From: support Date: Mon, 2 Jan 2023 16:38:03 +0000 (+0000) Subject: Built motion from commit dc14b02d.|2.6.27 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=37c1398e2b7eeaef97b6b9f3b9ef21ea5773de9d;p=motion2.git Built motion from commit dc14b02d.|2.6.27 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 6ed3f45..79f3195 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-02T11:17:56.314Z", + "time": "2023-01-02T16:29:17.656Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 925c56b..91ab20a 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-02T11:17:56.314Z", + "time": "2023-01-02T16:29:17.656Z", "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 16eba18..8b7cf4f 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 _0xda04=['browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xda04,0x185));var _0x4da0=function(_0x5b9a30,_0x2b3667){_0x5b9a30=_0x5b9a30-0x0;var _0x35f722=_0xda04[_0x5b9a30];return _0x35f722;};'use strict';var Sequelize=require(_0x4da0('0x0'));module[_0x4da0('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x180163){return this[_0x4da0('0x2')](_0x4da0('0x3'));}},'action':{'type':Sequelize[_0x4da0('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4da0('0x5'),_0x4da0('0x6'),_0x4da0('0x7'),_0x4da0('0x8'),_0x4da0('0x9'),_0x4da0('0xa'),_0x4da0('0xb'),_0x4da0('0xc')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x4da0('0xd')},'data1':{'type':Sequelize[_0x4da0('0x4')](0x1000),'comment':_0x4da0('0xe')},'data2':{'type':Sequelize[_0x4da0('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x4da0('0x4')](0x1000),'comment':_0x4da0('0xf')},'data4':{'type':Sequelize[_0x4da0('0x4')](0x1000),'comments':_0x4da0('0x10')},'data5':{'type':Sequelize[_0x4da0('0x4')](0x1000),'comments':_0x4da0('0x11')},'data6':{'type':Sequelize[_0x4da0('0x4')],'comments':_0x4da0('0x12')},'data7':{'type':Sequelize[_0x4da0('0x13')],'comments':_0x4da0('0x14')}}; \ No newline at end of file +var _0xb9b3=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[body]','sequelize','exports','getDataValue','contactManager','integration','motionbar','jscripty','urlForward','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0xe3260d,_0x26a406){var _0x226368=function(_0x318b66){while(--_0x318b66){_0xe3260d['push'](_0xe3260d['shift']());}};_0x226368(++_0x26a406);}(_0xb9b3,0x1a6));var _0x3b9b=function(_0x1efc87,_0x2774b4){_0x1efc87=_0x1efc87-0x0;var _0x29f3cd=_0xb9b3[_0x1efc87];return _0x29f3cd;};'use strict';var Sequelize=require(_0x3b9b('0x0'));module[_0x3b9b('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1cc4ec){return this[_0x3b9b('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x3b9b('0x3'),_0x3b9b('0x4'),_0x3b9b('0x5'),_0x3b9b('0x6'),_0x3b9b('0x7'),'browser',_0x3b9b('0x8'),'script']],'msg':_0x3b9b('0x9')}},'comment':_0x3b9b('0x9')},'data1':{'type':Sequelize[_0x3b9b('0xa')](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[_0x3b9b('0xa')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x3b9b('0xb')},'data4':{'type':Sequelize[_0x3b9b('0xa')](0x1000),'comments':_0x3b9b('0xc')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x3b9b('0xd')},'data6':{'type':Sequelize[_0x3b9b('0xa')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':_0x3b9b('0xe')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index ce32b9c..3406dff 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 _0x6606=['destroy','stack','send','body','params','catch','Action','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x432a5e,_0xbf10bb){var _0x55f1b1=function(_0x38f346){while(--_0x38f346){_0x432a5e['push'](_0x432a5e['shift']());}};_0x55f1b1(++_0xbf10bb);}(_0x6606,0x1a5));var _0x6660=function(_0x52382a,_0x10b3e7){_0x52382a=_0x52382a-0x0;var _0x542a0d=_0x6606[_0x52382a];return _0x542a0d;};'use strict';var emlformat=require(_0x6660('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6660('0x1'));var jsonpatch=require(_0x6660('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6660('0x3'));var Mustache=require(_0x6660('0x4'));var util=require(_0x6660('0x5'));var path=require(_0x6660('0x6'));var sox=require(_0x6660('0x7'));var csv=require(_0x6660('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6660('0x9'));var _=require(_0x6660('0xa'));var squel=require(_0x6660('0xb'));var crypto=require(_0x6660('0xc'));var jsforce=require(_0x6660('0xd'));var deskjs=require(_0x6660('0xe'));var toCsv=require(_0x6660('0x8'));var querystring=require(_0x6660('0xf'));var Papa=require(_0x6660('0x10'));var Redis=require('ioredis');var authService=require(_0x6660('0x11'));var qs=require(_0x6660('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6660('0x13'));var logger=require('../../config/logger')(_0x6660('0x14'));var utils=require(_0x6660('0x15'));var config=require(_0x6660('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6660('0x17'))['db'];function respondWithStatusCode(_0x69e480,_0x1ce4dd){_0x1ce4dd=_0x1ce4dd||0xcc;return function(_0x4e5c12){if(_0x4e5c12){return _0x69e480[_0x6660('0x18')](_0x1ce4dd);}return _0x69e480[_0x6660('0x19')](_0x1ce4dd)[_0x6660('0x1a')]();};}function respondWithResult(_0x1203ba,_0x458f93){_0x458f93=_0x458f93||0xc8;return function(_0xa39399){if(_0xa39399){return _0x1203ba[_0x6660('0x19')](_0x458f93)[_0x6660('0x1b')](_0xa39399);}};}function respondWithFilteredResult(_0xb74b22,_0x1943fd){return function(_0x815f77){if(_0x815f77){var _0x522644=typeof _0x1943fd[_0x6660('0x1c')]===_0x6660('0x1d')&&typeof _0x1943fd[_0x6660('0x1e')]===_0x6660('0x1d');var _0x3332ea=_0x815f77[_0x6660('0x1f')];var _0x560055=_0x522644?0x0:_0x1943fd[_0x6660('0x1c')];var _0x2fb3eb=_0x522644?_0x815f77[_0x6660('0x1f')]:_0x1943fd[_0x6660('0x1c')]+_0x1943fd[_0x6660('0x1e')];var _0x4d0e0e;if(_0x2fb3eb>=_0x3332ea){_0x2fb3eb=_0x3332ea;_0x4d0e0e=0xc8;}else{_0x4d0e0e=0xce;}_0xb74b22[_0x6660('0x19')](_0x4d0e0e);return _0xb74b22[_0x6660('0x20')](_0x6660('0x21'),_0x560055+'-'+_0x2fb3eb+'/'+_0x3332ea)[_0x6660('0x1b')](_0x815f77);}return null;};}function patchUpdates(_0x385acb){return function(_0x1a03aa){try{jsonpatch[_0x6660('0x22')](_0x1a03aa,_0x385acb,!![]);}catch(_0x534fd4){return BPromise[_0x6660('0x23')](_0x534fd4);}return _0x1a03aa[_0x6660('0x24')]();};}function saveUpdates(_0x28010b,_0x1ccd83){return function(_0x5c43e0){if(_0x5c43e0){return _0x5c43e0[_0x6660('0x25')](_0x28010b)[_0x6660('0x26')](function(_0x2c78fb){return _0x2c78fb;});}return null;};}function removeEntity(_0x81267a,_0x411270){return function(_0x5d4e52){if(_0x5d4e52){return _0x5d4e52[_0x6660('0x27')]()[_0x6660('0x26')](function(){_0x81267a[_0x6660('0x19')](0xcc)[_0x6660('0x1a')]();});}};}function handleEntityNotFound(_0xd5bc56,_0x7bd22b){return function(_0xef9fe5){if(!_0xef9fe5){_0xd5bc56[_0x6660('0x18')](0x194);}return _0xef9fe5;};}function handleError(_0x2b1817,_0x230ad0){_0x230ad0=_0x230ad0||0x1f4;return function(_0x558b67){logger['error'](_0x558b67[_0x6660('0x28')]);if(_0x558b67['name']){delete _0x558b67['name'];}_0x2b1817['status'](_0x230ad0)[_0x6660('0x29')](_0x558b67);};}exports[_0x6660('0x25')]=function(_0xac618e,_0x5aca42){if(_0xac618e[_0x6660('0x2a')]['id']){delete _0xac618e[_0x6660('0x2a')]['id'];}return db['Action']['find']({'where':{'id':_0xac618e[_0x6660('0x2b')]['id']}})[_0x6660('0x26')](handleEntityNotFound(_0x5aca42,null))[_0x6660('0x26')](saveUpdates(_0xac618e['body'],null))['then'](respondWithResult(_0x5aca42,null))[_0x6660('0x2c')](handleError(_0x5aca42,null));};exports[_0x6660('0x27')]=function(_0x1ade56,_0x1e1f87){return db[_0x6660('0x2d')]['find']({'where':{'id':_0x1ade56[_0x6660('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1e1f87,null))[_0x6660('0x26')](removeEntity(_0x1e1f87,null))[_0x6660('0x2c')](handleError(_0x1e1f87,null));}; \ No newline at end of file +var _0xf326=['reject','then','stack','name','send','update','body','Action','find','params','catch','destroy','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','Content-Range'];(function(_0x433ae0,_0x209a59){var _0x7b57dc=function(_0x10ad47){while(--_0x10ad47){_0x433ae0['push'](_0x433ae0['shift']());}};_0x7b57dc(++_0x209a59);}(_0xf326,0x164));var _0x6f32=function(_0x10a2ea,_0x487cf2){_0x10a2ea=_0x10a2ea-0x0;var _0x347b66=_0xf326[_0x10a2ea];return _0x347b66;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f32('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f32('0x1'));var rp=require('request-promise');var moment=require(_0x6f32('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6f32('0x3'));var util=require(_0x6f32('0x4'));var path=require(_0x6f32('0x5'));var sox=require(_0x6f32('0x6'));var csv=require(_0x6f32('0x7'));var ejs=require(_0x6f32('0x8'));var fs=require('fs');var fs_extra=require(_0x6f32('0x9'));var _=require(_0x6f32('0xa'));var squel=require(_0x6f32('0xb'));var crypto=require(_0x6f32('0xc'));var jsforce=require(_0x6f32('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6f32('0x7'));var querystring=require(_0x6f32('0xe'));var Papa=require(_0x6f32('0xf'));var Redis=require(_0x6f32('0x10'));var authService=require(_0x6f32('0x11'));var qs=require(_0x6f32('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f32('0x13'));var logger=require(_0x6f32('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6f32('0x15'));var db=require(_0x6f32('0x16'))['db'];function respondWithStatusCode(_0x282c17,_0x542818){_0x542818=_0x542818||0xcc;return function(_0xcd1eb2){if(_0xcd1eb2){return _0x282c17[_0x6f32('0x17')](_0x542818);}return _0x282c17['status'](_0x542818)[_0x6f32('0x18')]();};}function respondWithResult(_0x37b304,_0x21ccd3){_0x21ccd3=_0x21ccd3||0xc8;return function(_0x438714){if(_0x438714){return _0x37b304[_0x6f32('0x19')](_0x21ccd3)[_0x6f32('0x1a')](_0x438714);}};}function respondWithFilteredResult(_0x23d2f5,_0x243c65){return function(_0x56ee1d){if(_0x56ee1d){var _0x327fdd=typeof _0x243c65['offset']==='undefined'&&typeof _0x243c65[_0x6f32('0x1b')]==='undefined';var _0x21ac15=_0x56ee1d[_0x6f32('0x1c')];var _0x50b3d2=_0x327fdd?0x0:_0x243c65[_0x6f32('0x1d')];var _0x36a614=_0x327fdd?_0x56ee1d[_0x6f32('0x1c')]:_0x243c65['offset']+_0x243c65[_0x6f32('0x1b')];var _0x253c8d;if(_0x36a614>=_0x21ac15){_0x36a614=_0x21ac15;_0x253c8d=0xc8;}else{_0x253c8d=0xce;}_0x23d2f5[_0x6f32('0x19')](_0x253c8d);return _0x23d2f5['set'](_0x6f32('0x1e'),_0x50b3d2+'-'+_0x36a614+'/'+_0x21ac15)[_0x6f32('0x1a')](_0x56ee1d);}return null;};}function patchUpdates(_0x282b60){return function(_0x4b8015){try{jsonpatch['apply'](_0x4b8015,_0x282b60,!![]);}catch(_0x5ba0af){return BPromise[_0x6f32('0x1f')](_0x5ba0af);}return _0x4b8015['save']();};}function saveUpdates(_0x571ebc,_0x54586e){return function(_0x58db42){if(_0x58db42){return _0x58db42['update'](_0x571ebc)['then'](function(_0x36ebb0){return _0x36ebb0;});}return null;};}function removeEntity(_0x312b44,_0x2cd230){return function(_0x5d6180){if(_0x5d6180){return _0x5d6180['destroy']()[_0x6f32('0x20')](function(){_0x312b44['status'](0xcc)[_0x6f32('0x18')]();});}};}function handleEntityNotFound(_0x337a9b,_0xcce170){return function(_0x4aaee1){if(!_0x4aaee1){_0x337a9b[_0x6f32('0x17')](0x194);}return _0x4aaee1;};}function handleError(_0xc823ae,_0x3fc666){_0x3fc666=_0x3fc666||0x1f4;return function(_0x581803){logger['error'](_0x581803[_0x6f32('0x21')]);if(_0x581803[_0x6f32('0x22')]){delete _0x581803[_0x6f32('0x22')];}_0xc823ae[_0x6f32('0x19')](_0x3fc666)[_0x6f32('0x23')](_0x581803);};}exports[_0x6f32('0x24')]=function(_0x5d2bc7,_0x3ee85c){if(_0x5d2bc7[_0x6f32('0x25')]['id']){delete _0x5d2bc7['body']['id'];}return db[_0x6f32('0x26')][_0x6f32('0x27')]({'where':{'id':_0x5d2bc7[_0x6f32('0x28')]['id']}})['then'](handleEntityNotFound(_0x3ee85c,null))['then'](saveUpdates(_0x5d2bc7[_0x6f32('0x25')],null))[_0x6f32('0x20')](respondWithResult(_0x3ee85c,null))[_0x6f32('0x29')](handleError(_0x3ee85c,null));};exports[_0x6f32('0x2a')]=function(_0x1bdbc2,_0x40161f){return db[_0x6f32('0x26')][_0x6f32('0x27')]({'where':{'id':_0x1bdbc2[_0x6f32('0x28')]['id']}})[_0x6f32('0x20')](handleEntityNotFound(_0x40161f,null))[_0x6f32('0x20')](removeEntity(_0x40161f,null))[_0x6f32('0x29')](handleError(_0x40161f,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index bc9ed36..650cbdd 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 _0x9c2e=['tools_actions','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./action.attributes','Action'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9c2e,0x161));var _0xe9c2=function(_0x3f4e6a,_0x467be1){_0x3f4e6a=_0x3f4e6a-0x0;var _0x4beff8=_0x9c2e[_0x3f4e6a];return _0x4beff8;};'use strict';var _=require('lodash');var util=require(_0xe9c2('0x0'));var logger=require(_0xe9c2('0x1'))(_0xe9c2('0x2'));var moment=require(_0xe9c2('0x3'));var BPromise=require(_0xe9c2('0x4'));var rp=require(_0xe9c2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9c2('0x6'));var config=require(_0xe9c2('0x7'));var attributes=require(_0xe9c2('0x8'));module['exports']=function(_0x160096,_0x405cac){return _0x160096['define'](_0xe9c2('0x9'),attributes,{'tableName':_0xe9c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36f9=['path','rimraf','../../config/environment','./action.attributes','exports','define','Action','lodash','../../config/logger','bluebird','request-promise'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x36f9,0x151));var _0x936f=function(_0x1773ad,_0x10e77f){_0x1773ad=_0x1773ad-0x0;var _0x332287=_0x36f9[_0x1773ad];return _0x332287;};'use strict';var _=require(_0x936f('0x0'));var util=require('util');var logger=require(_0x936f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x936f('0x2'));var rp=require(_0x936f('0x3'));var fs=require('fs');var path=require(_0x936f('0x4'));var rimraf=require(_0x936f('0x5'));var config=require(_0x936f('0x6'));var attributes=require(_0x936f('0x7'));module[_0x936f('0x8')]=function(_0xb18ba3,_0x1c9c87){return _0xb18ba3[_0x936f('0x9')](_0x936f('0xa'),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 bfc0387..ea53862 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x5b45e1,_0x3186ee){var _0x1c6f23=function(_0x20517b){while(--_0x20517b){_0x5b45e1['push'](_0x5b45e1['shift']());}};_0x1c6f23(++_0x3186ee);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc4aa[_0x4ff09b];return _0x3f5c2e;};'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')]('Action,\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 _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\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(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x814b,0x1a2));var _0xb814=function(_0x104993,_0x3f9a6b){_0x104993=_0x104993-0x0;var _0x105a96=_0x814b[_0x104993];return _0x105a96;};'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')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 498789a..6bd961b 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 _0xdc0c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xdc0c,0x11c));var _0xcdc0=function(_0xe62ed,_0x44b6cd){_0xe62ed=_0xe62ed-0x0;var _0x3dd5cc=_0xdc0c[_0xe62ed];return _0x3dd5cc;};'use strict';var multer=require(_0xcdc0('0x0'));var util=require('util');var path=require(_0xcdc0('0x1'));var timeout=require(_0xcdc0('0x2'));var express=require(_0xcdc0('0x3'));var router=express[_0xcdc0('0x4')]();var fs_extra=require(_0xcdc0('0x5'));var auth=require(_0xcdc0('0x6'));var interaction=require(_0xcdc0('0x7'));var config=require('../../config/environment');var controller=require(_0xcdc0('0x8'));router[_0xcdc0('0x9')](_0xcdc0('0xa'),auth[_0xcdc0('0xb')](),controller[_0xcdc0('0xc')]);router[_0xcdc0('0xd')](_0xcdc0('0xa'),auth[_0xcdc0('0xb')](),controller[_0xcdc0('0xe')]);module[_0xcdc0('0xf')]=router; \ No newline at end of file +var _0x92df=['exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated','destroy'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x92df,0x169));var _0xf92d=function(_0x13658f,_0x1f0961){_0x13658f=_0x13658f-0x0;var _0x1fae13=_0x92df[_0x13658f];return _0x1fae13;};'use strict';var multer=require(_0xf92d('0x0'));var util=require(_0xf92d('0x1'));var path=require(_0xf92d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf92d('0x3')]();var fs_extra=require(_0xf92d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf92d('0x5'));var config=require(_0xf92d('0x6'));var controller=require(_0xf92d('0x7'));router[_0xf92d('0x8')](_0xf92d('0x9'),auth['isAuthenticated'](),controller[_0xf92d('0xa')]);router[_0xf92d('0xb')]('/:id',auth[_0xf92d('0xc')](),controller[_0xf92d('0xd')]);module[_0xf92d('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 dbe9548..2daf6a5 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 _0xf2ca=['STRING','TEXT','sequelize','exports'];(function(_0x37bc16,_0x3b3585){var _0xbde296=function(_0x5d4cbf){while(--_0x5d4cbf){_0x37bc16['push'](_0x37bc16['shift']());}};_0xbde296(++_0x3b3585);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x6148ee,_0x4d2fca){_0x6148ee=_0x6148ee-0x0;var _0x5afc74=_0xf2ca[_0x6148ee];return _0x5afc74;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xaf2c('0x2')]},'table':{'type':Sequelize[_0xaf2c('0x2')]},'conditions':{'type':Sequelize[_0xaf2c('0x3')]},'joins':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file +var _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x5ac75a,_0x110969){var _0x479de6=function(_0xa30b51){while(--_0xa30b51){_0x5ac75a['push'](_0x5ac75a['shift']());}};_0x479de6(++_0x110969);}(_0xb138,0x1dd));var _0x8b13=function(_0x3be8b2,_0x26c3b4){_0x3be8b2=_0x3be8b2-0x0;var _0x47672e=_0xb138[_0x3be8b2];return _0x47672e;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]},'parent':{'type':Sequelize[_0x8b13('0x2')]},'table':{'type':Sequelize[_0x8b13('0x2')]},'conditions':{'type':Sequelize[_0x8b13('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index ce1c875..bbd45d8 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 _0x3f5c=['options','AnalyticCustomReport','findAll','rows','catch','show','params','keys','length','includeAll','include','find','create','user','Reports','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','MetricId','metric','replace','function','format','orderBy','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','right_join','COUNT(%s)','MIN(%s)','UNIX_TIMESTAMP(%s)','includes','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','DESC','clone','output','web','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','fork','../../files/reports','savename','countTable','COUNT(*)','run','alias','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','CustomReports','UserProfileResource','destroy','stack','name','index','map','rawAttributes','fieldName','key','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge'];(function(_0xf99c03,_0x41b579){var _0x39b6ad=function(_0xc77b6b){while(--_0xc77b6b){_0xf99c03['push'](_0xf99c03['shift']());}};_0x39b6ad(++_0x41b579);}(_0x3f5c,0x64));var _0xc3f5=function(_0x45c84d,_0xb0e269){_0x45c84d=_0x45c84d-0x0;var _0x26c4c0=_0x3f5c[_0x45c84d];return _0x26c4c0;};'use strict';var emlformat=require(_0xc3f5('0x0'));var rimraf=require(_0xc3f5('0x1'));var zipdir=require(_0xc3f5('0x2'));var jsonpatch=require(_0xc3f5('0x3'));var rp=require(_0xc3f5('0x4'));var moment=require(_0xc3f5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f5('0x6'));var ejs=require(_0xc3f5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3f5('0x8'));var squel=require(_0xc3f5('0x9'));var crypto=require('crypto');var jsforce=require(_0xc3f5('0xa'));var deskjs=require(_0xc3f5('0xb'));var toCsv=require(_0xc3f5('0x6'));var querystring=require(_0xc3f5('0xc'));var Papa=require('papaparse');var Redis=require(_0xc3f5('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc3f5('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f5('0xf'));var logger=require(_0xc3f5('0x10'))(_0xc3f5('0x11'));var utils=require(_0xc3f5('0x12'));var config=require(_0xc3f5('0x13'));var licenseUtil=require(_0xc3f5('0x14'));var db=require(_0xc3f5('0x15'))['db'];var dbH=require('../../mysqldb')[_0xc3f5('0x16')];function respondWithStatusCode(_0x16858d,_0x8bad73){_0x8bad73=_0x8bad73||0xcc;return function(_0x1e9e86){if(_0x1e9e86){return _0x16858d[_0xc3f5('0x17')](_0x8bad73);}return _0x16858d['status'](_0x8bad73)[_0xc3f5('0x18')]();};}function respondWithResult(_0x37edb6,_0xa2594e){_0xa2594e=_0xa2594e||0xc8;return function(_0x5d62f9){if(_0x5d62f9){return _0x37edb6[_0xc3f5('0x19')](_0xa2594e)[_0xc3f5('0x1a')](_0x5d62f9);}};}function respondWithFilteredResult(_0x5e4d7a,_0x1635f8){return function(_0x2ac934){if(_0x2ac934){var _0x228ce7=typeof _0x1635f8[_0xc3f5('0x1b')]===_0xc3f5('0x1c')&&typeof _0x1635f8[_0xc3f5('0x1d')]===_0xc3f5('0x1c');var _0x127535=_0x2ac934[_0xc3f5('0x1e')];var _0x16e626=_0x228ce7?0x0:_0x1635f8['offset'];var _0x520aad=_0x228ce7?_0x2ac934['count']:_0x1635f8[_0xc3f5('0x1b')]+_0x1635f8['limit'];var _0x46aa82;if(_0x520aad>=_0x127535){_0x520aad=_0x127535;_0x46aa82=0xc8;}else{_0x46aa82=0xce;}_0x5e4d7a[_0xc3f5('0x19')](_0x46aa82);return _0x5e4d7a[_0xc3f5('0x1f')](_0xc3f5('0x20'),_0x16e626+'-'+_0x520aad+'/'+_0x127535)[_0xc3f5('0x1a')](_0x2ac934);}return null;};}function patchUpdates(_0x3c70fe){return function(_0x5f6a2f){try{jsonpatch[_0xc3f5('0x21')](_0x5f6a2f,_0x3c70fe,!![]);}catch(_0x15b606){return BPromise[_0xc3f5('0x22')](_0x15b606);}return _0x5f6a2f['save']();};}function saveUpdates(_0x2b2505,_0x1ebcd9){return function(_0x56e8e6){if(_0x56e8e6){return _0x56e8e6['update'](_0x2b2505)[_0xc3f5('0x23')](function(_0x47a36e){return _0x47a36e;});}return null;};}function removeEntity(_0x37d7ff,_0xb199a5){return function(_0x1b7f7c){if(_0x1b7f7c){return _0x1b7f7c['destroy']()[_0xc3f5('0x23')](function(){var _0x1e18cd=_0x1b7f7c[_0xc3f5('0x24')]({'plain':!![]});var _0x2d124a=_0xc3f5('0x25');return db[_0xc3f5('0x26')][_0xc3f5('0x27')]({'where':{'type':_0x2d124a,'resourceId':_0x1e18cd['id']}})['then'](function(){return _0x1b7f7c;});})['then'](function(){_0x37d7ff[_0xc3f5('0x19')](0xcc)[_0xc3f5('0x18')]();});}};}function handleEntityNotFound(_0x98cae2,_0x24d5c2){return function(_0x16b541){if(!_0x16b541){_0x98cae2[_0xc3f5('0x17')](0x194);}return _0x16b541;};}function handleError(_0x465447,_0x18afed){_0x18afed=_0x18afed||0x1f4;return function(_0x2e8043){logger['error'](_0x2e8043[_0xc3f5('0x28')]);if(_0x2e8043[_0xc3f5('0x29')]){delete _0x2e8043[_0xc3f5('0x29')];}_0x465447[_0xc3f5('0x19')](_0x18afed)['send'](_0x2e8043);};}exports[_0xc3f5('0x2a')]=function(_0x1b333a,_0xbbd2f2){var _0x405347={},_0x292feb={},_0x4911b1={'count':0x0,'rows':[]};var _0x5aaa6f=_[_0xc3f5('0x2b')](db['AnalyticCustomReport'][_0xc3f5('0x2c')],function(_0xefb90a){return{'name':_0xefb90a[_0xc3f5('0x2d')],'type':_0xefb90a['type'][_0xc3f5('0x2e')]};});_0x292feb['model']=_[_0xc3f5('0x2b')](_0x5aaa6f,_0xc3f5('0x29'));_0x292feb[_0xc3f5('0x2f')]=_['keys'](_0x1b333a[_0xc3f5('0x2f')]);_0x292feb['filters']=_[_0xc3f5('0x30')](_0x292feb['model'],_0x292feb[_0xc3f5('0x2f')]);_0x405347[_0xc3f5('0x31')]=_[_0xc3f5('0x30')](_0x292feb[_0xc3f5('0x32')],qs[_0xc3f5('0x33')](_0x1b333a[_0xc3f5('0x2f')][_0xc3f5('0x33')]));_0x405347[_0xc3f5('0x31')]=_0x405347[_0xc3f5('0x31')]['length']?_0x405347[_0xc3f5('0x31')]:_0x292feb[_0xc3f5('0x32')];if(!_0x1b333a[_0xc3f5('0x2f')][_0xc3f5('0x34')](_0xc3f5('0x35'))){_0x405347[_0xc3f5('0x1d')]=qs[_0xc3f5('0x1d')](_0x1b333a[_0xc3f5('0x2f')][_0xc3f5('0x1d')]);_0x405347[_0xc3f5('0x1b')]=qs[_0xc3f5('0x1b')](_0x1b333a[_0xc3f5('0x2f')]['offset']);}_0x405347[_0xc3f5('0x36')]=qs['sort'](_0x1b333a['query'][_0xc3f5('0x37')]);_0x405347[_0xc3f5('0x38')]=qs[_0xc3f5('0x39')](_[_0xc3f5('0x3a')](_0x1b333a['query'],_0x292feb[_0xc3f5('0x39')]),_0x5aaa6f);if(_0x1b333a[_0xc3f5('0x2f')][_0xc3f5('0x3b')]){_0x405347['where']=_['merge'](_0x405347[_0xc3f5('0x38')],{'$or':_[_0xc3f5('0x2b')](_0x5aaa6f,function(_0xc5f686){if(_0xc5f686[_0xc3f5('0x3c')]!==_0xc3f5('0x3d')){var _0x1e3af6={};_0x1e3af6[_0xc5f686[_0xc3f5('0x29')]]={'$like':'%'+_0x1b333a[_0xc3f5('0x2f')]['filter']+'%'};return _0x1e3af6;}})});}_0x405347=_[_0xc3f5('0x3e')]({},_0x405347,_0x1b333a[_0xc3f5('0x3f')]);var _0x2027b2={'where':_0x405347[_0xc3f5('0x38')]};return db[_0xc3f5('0x40')]['count'](_0x2027b2)['then'](function(_0x2cc154){_0x4911b1[_0xc3f5('0x1e')]=_0x2cc154;if(_0x1b333a['query']['includeAll']){_0x405347['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xc3f5('0x41')](_0x405347);})[_0xc3f5('0x23')](function(_0x419f8c){_0x4911b1[_0xc3f5('0x42')]=_0x419f8c;return _0x4911b1;})[_0xc3f5('0x23')](respondWithFilteredResult(_0xbbd2f2,_0x405347))[_0xc3f5('0x43')](handleError(_0xbbd2f2,null));};exports[_0xc3f5('0x44')]=function(_0x2699f9,_0x1c64ba){var _0x1ff32f={'raw':![],'where':{'id':_0x2699f9[_0xc3f5('0x45')]['id']}},_0x567e36={};_0x567e36[_0xc3f5('0x32')]=_[_0xc3f5('0x46')](db['AnalyticCustomReport'][_0xc3f5('0x2c')]);_0x567e36[_0xc3f5('0x2f')]=_[_0xc3f5('0x46')](_0x2699f9[_0xc3f5('0x2f')]);_0x567e36['filters']=_[_0xc3f5('0x30')](_0x567e36['model'],_0x567e36[_0xc3f5('0x2f')]);_0x1ff32f[_0xc3f5('0x31')]=_[_0xc3f5('0x30')](_0x567e36[_0xc3f5('0x32')],qs[_0xc3f5('0x33')](_0x2699f9[_0xc3f5('0x2f')][_0xc3f5('0x33')]));_0x1ff32f['attributes']=_0x1ff32f[_0xc3f5('0x31')][_0xc3f5('0x47')]?_0x1ff32f[_0xc3f5('0x31')]:_0x567e36[_0xc3f5('0x32')];if(_0x2699f9[_0xc3f5('0x2f')][_0xc3f5('0x48')]){_0x1ff32f[_0xc3f5('0x49')]=[{'all':!![]}];}_0x1ff32f=_[_0xc3f5('0x3e')]({},_0x1ff32f,_0x2699f9[_0xc3f5('0x3f')]);return db[_0xc3f5('0x40')][_0xc3f5('0x4a')](_0x1ff32f)[_0xc3f5('0x23')](handleEntityNotFound(_0x1c64ba,null))[_0xc3f5('0x23')](respondWithResult(_0x1c64ba,null))[_0xc3f5('0x43')](handleError(_0x1c64ba,null));};exports[_0xc3f5('0x4b')]=function(_0x17b215,_0x6aa0b8){return db[_0xc3f5('0x40')][_0xc3f5('0x4b')](_0x17b215['body'],{})[_0xc3f5('0x23')](function(_0x50207f){var _0x530ce0=_0x17b215['user'][_0xc3f5('0x24')]({'plain':!![]});if(!_0x530ce0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x530ce0['role']===_0xc3f5('0x4c')){var _0x2909cc=_0x50207f['get']({'plain':!![]});var _0x5e05b7=_0xc3f5('0x4d');return db[_0xc3f5('0x4e')]['find']({'where':{'name':_0x5e05b7,'userProfileId':_0x530ce0[_0xc3f5('0x4f')]},'raw':!![]})[_0xc3f5('0x23')](function(_0x1682c7){if(_0x1682c7&&_0x1682c7['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2909cc['name'],'resourceId':_0x2909cc['id'],'type':'CustomReports','sectionId':_0x1682c7['id']},{})[_0xc3f5('0x23')](function(){return _0x50207f;});}else{return _0x50207f;}})['catch'](function(_0x482db7){logger[_0xc3f5('0x50')](_0xc3f5('0x51'),_0x482db7);throw _0x482db7;});}return _0x50207f;})[_0xc3f5('0x23')](respondWithResult(_0x6aa0b8,0xc9))['catch'](handleError(_0x6aa0b8,null));};exports[_0xc3f5('0x52')]=function(_0x5266f3,_0x464a67){if(_0x5266f3['body']['id']){delete _0x5266f3[_0xc3f5('0x53')]['id'];}return db['AnalyticCustomReport'][_0xc3f5('0x4a')]({'where':{'id':_0x5266f3[_0xc3f5('0x45')]['id']}})[_0xc3f5('0x23')](handleEntityNotFound(_0x464a67,null))['then'](saveUpdates(_0x5266f3[_0xc3f5('0x53')],null))[_0xc3f5('0x23')](respondWithResult(_0x464a67,null))[_0xc3f5('0x43')](handleError(_0x464a67,null));};exports[_0xc3f5('0x27')]=function(_0x4a0ea8,_0x58691e){return db[_0xc3f5('0x40')][_0xc3f5('0x4a')]({'where':{'id':_0x4a0ea8[_0xc3f5('0x45')]['id']}})[_0xc3f5('0x23')](handleEntityNotFound(_0x58691e,null))[_0xc3f5('0x23')](removeEntity(_0x58691e,null))[_0xc3f5('0x43')](handleError(_0x58691e,null));};exports[_0xc3f5('0x54')]=function(_0x15e4a8,_0x725711){var _0x56a7ea=0xa;var _0x1f7f57=[_0xc3f5('0x55'),_0xc3f5('0x56'),'right_join',_0xc3f5('0x57')];var _0x5d156b={'SUM':_0xc3f5('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc3f5('0x59'),'MAX':_0xc3f5('0x5a'),'MIN':'MIN(%s)','AVG':_0xc3f5('0x5b'),'GROUP_CONCAT':_0xc3f5('0x5c'),'GROUP_CONCAT ASC':_0xc3f5('0x5d'),'GROUP_CONCAT DESC':_0xc3f5('0x5e')};var _0x16c3b0={'SEC_TO_TIME':_0xc3f5('0x5f'),'DATE':_0xc3f5('0x60'),'HOUR':_0xc3f5('0x61'),'ROUND':_0xc3f5('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x11187b=function(_0x4059c6){return!_['includes']([_0xc3f5('0x63'),_0xc3f5('0x64'),_0xc3f5('0x65'),_0xc3f5('0x66')],_0x4059c6);};var _0x1c51b3=function(_0x597f99){if(!_0x597f99||!_0x597f99[_0xc3f5('0x67')]['length']){return'';}for(var _0x23a311='(',_0x125864=0x0;_0x125864<_0x597f99[_0xc3f5('0x67')]['length'];_0x125864+=0x1){_0x125864>0x0&&(_0x23a311+='\x20'+_0x597f99[_0xc3f5('0x68')]+'\x20');_0x23a311+=_0x597f99['rules'][_0x125864][_0xc3f5('0x69')]?_0x1c51b3(_0x597f99[_0xc3f5('0x67')][_0x125864][_0xc3f5('0x69')]):_0x597f99[_0xc3f5('0x67')][_0x125864][_0xc3f5('0x6a')]+'\x20'+_0x597f99[_0xc3f5('0x67')][_0x125864][_0xc3f5('0x6b')]+(_0x11187b(_0x597f99[_0xc3f5('0x67')][_0x125864][_0xc3f5('0x6b')])?'\x20'+_0x597f99['rules'][_0x125864][_0xc3f5('0x6c')]:'');}return _0x23a311+')';};var _0x59cdf4={'where':{'id':_0x15e4a8['params']['id']}},_0x33623c,_0x3fb732,_0x425f48,_0x2fa2b7,_0x37c73;_0x59cdf4=_[_0xc3f5('0x3e')]({},_0x59cdf4,_0x15e4a8[_0xc3f5('0x3f')]);return db[_0xc3f5('0x40')][_0xc3f5('0x4a')](_0x59cdf4)[_0xc3f5('0x23')](function(_0x192f45){if(_0x192f45){_0x33623c=_0x192f45;return _0x192f45[_0xc3f5('0x6d')]();}return null;})[_0xc3f5('0x23')](function(_0x53eae9){if(_0x53eae9){if(!_0x53eae9['length']){throw new db[(_0xc3f5('0x6e'))][(_0xc3f5('0x6f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3fb732=_0x53eae9;return db[_0xc3f5('0x70')][_0xc3f5('0x41')]({'raw':!![]});}return null;})['then'](function(_0x758ea){if(_0x758ea){_0x425f48=_[_0xc3f5('0x71')](_0x758ea,'id');var _0x3c0631;var _0x16668c=squel[_0xc3f5('0x72')]();_0x16668c[_0xc3f5('0x73')](_0x33623c['table']);for(var _0x40a6bf=0x0;_0x40a6bf<_0x3fb732[_0xc3f5('0x47')];_0x40a6bf+=0x1){_0x3c0631=_0x3fb732[_0x40a6bf][_0xc3f5('0x74')]?_0x425f48[_0x3fb732[_0x40a6bf][_0xc3f5('0x74')]][_0xc3f5('0x75')]:_0x3fb732[_0x40a6bf][_0xc3f5('0x6a')];_0x3c0631=_0x3fb732[_0x40a6bf]['function']?_[_0xc3f5('0x76')](_0x5d156b[_0x3fb732[_0x40a6bf][_0xc3f5('0x77')]],'%s',_0x3c0631):_0x3c0631;_0x3c0631=_0x3fb732[_0x40a6bf][_0xc3f5('0x78')]?_['replace'](_0x16c3b0[_0x3fb732[_0x40a6bf]['format']],'%s',_0x3c0631):_0x3c0631;if(_0x3fb732[_0x40a6bf]['groupBy']){_0x16668c[_0xc3f5('0x69')](_0x3c0631);}_0x3fb732[_0x40a6bf][_0xc3f5('0x79')]&&_0x16668c[_0xc3f5('0x36')](_0x3c0631,_0x3fb732[_0x40a6bf][_0xc3f5('0x79')]==='DESC'?![]:!![]);_0x16668c['field'](_0x3c0631,_0x3fb732[_0x40a6bf]['alias']||_0x3c0631);}if(_0x33623c['joins']){_0x33623c[_0xc3f5('0x7a')]=JSON[_0xc3f5('0x7b')](_0x33623c['joins']);for(var _0x10b3c5=0x0;_0x10b3c5<_0x33623c[_0xc3f5('0x7a')][_0xc3f5('0x47')];_0x10b3c5+=0x1){if(_0x33623c[_0xc3f5('0x7a')][_0x10b3c5][_0xc3f5('0x3c')]&&_['includes'](_0x1f7f57,_0x33623c[_0xc3f5('0x7a')][_0x10b3c5][_0xc3f5('0x3c')])&&_0x33623c[_0xc3f5('0x7a')][_0x10b3c5][_0xc3f5('0x7c')]&&_0x33623c[_0xc3f5('0x7a')][_0x10b3c5][_0xc3f5('0x7d')]&&_0x33623c['joins'][_0x10b3c5][_0xc3f5('0x7e')]){_0x16668c[_0x33623c[_0xc3f5('0x7a')][_0x10b3c5][_0xc3f5('0x3c')]](_0x33623c['joins'][_0x10b3c5][_0xc3f5('0x7d')],null,util[_0xc3f5('0x78')](_0xc3f5('0x7f'),_0x33623c[_0xc3f5('0x80')],_0x33623c[_0xc3f5('0x7a')][_0x10b3c5][_0xc3f5('0x7c')],_0x33623c['joins'][_0x10b3c5][_0xc3f5('0x7d')],_0x33623c[_0xc3f5('0x7a')][_0x10b3c5][_0xc3f5('0x7e')]));}}}if(_0x33623c[_0xc3f5('0x81')]){_0x33623c[_0xc3f5('0x81')]=JSON[_0xc3f5('0x7b')](_0x33623c[_0xc3f5('0x81')]);_0x16668c[_0xc3f5('0x38')](_0x1c51b3(_0x33623c[_0xc3f5('0x81')][_0xc3f5('0x69')]));}_0x37c73=_0x16668c['clone']();_0x16668c[_0xc3f5('0x1d')](_0x56a7ea);_0x16668c[_0xc3f5('0x1b')](0x0);logger[_0xc3f5('0x82')](_0xc3f5('0x83'),_0x16668c['toString']());return dbH[_0xc3f5('0x84')][_0xc3f5('0x2f')](_0x16668c[_0xc3f5('0x85')](),{'type':dbH[_0xc3f5('0x84')][_0xc3f5('0x86')][_0xc3f5('0x87')]});}})[_0xc3f5('0x23')](respondWithResult(_0x725711,null))['catch'](handleError(_0x725711,null));};function runReport(_0x46c0c3,_0x523d92,_0x330ec2){var _0x4b5120=_0x523d92[_0xc3f5('0x29')];var _0x28407b=0xa;var _0x1edd24=[_0xc3f5('0x55'),_0xc3f5('0x56'),_0xc3f5('0x88'),_0xc3f5('0x57')];var _0x323960={'SUM':_0xc3f5('0x58'),'COUNT':_0xc3f5('0x89'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xc3f5('0x8a'),'AVG':_0xc3f5('0x5b'),'GROUP_CONCAT':_0xc3f5('0x5c'),'GROUP_CONCAT ASC':_0xc3f5('0x5d'),'GROUP_CONCAT DESC':_0xc3f5('0x5e')};var _0x2264ea={'SEC_TO_TIME':_0xc3f5('0x5f'),'DATE':_0xc3f5('0x60'),'HOUR':_0xc3f5('0x61'),'ROUND':_0xc3f5('0x62'),'UNIX_TIMESTAMP':_0xc3f5('0x8b')};var _0x5019f6=function(_0x4a13e4){return!_[_0xc3f5('0x8c')](['IS\x20NULL',_0xc3f5('0x64'),_0xc3f5('0x65'),'IS\x20NOT\x20EMPTY'],_0x4a13e4);};var _0x3e3d49=function(_0x5bb2e1){if(!_0x5bb2e1||!_0x5bb2e1[_0xc3f5('0x67')]['length']){return'';}for(var _0x4d8c8e='(',_0xc5824=0x0;_0xc5824<_0x5bb2e1[_0xc3f5('0x67')][_0xc3f5('0x47')];_0xc5824+=0x1){_0xc5824>0x0&&(_0x4d8c8e+='\x20'+_0x5bb2e1[_0xc3f5('0x68')]+'\x20');_0x4d8c8e+=_0x5bb2e1['rules'][_0xc5824]['group']?_0x3e3d49(_0x5bb2e1[_0xc3f5('0x67')][_0xc5824][_0xc3f5('0x69')]):_0x5bb2e1[_0xc3f5('0x67')][_0xc5824][_0xc3f5('0x6a')]+'\x20'+_0x5bb2e1[_0xc3f5('0x67')][_0xc5824][_0xc3f5('0x6b')]+(_0x5019f6(_0x5bb2e1[_0xc3f5('0x67')][_0xc5824][_0xc3f5('0x6b')])?'\x20'+_0x5bb2e1[_0xc3f5('0x67')][_0xc5824][_0xc3f5('0x6c')]:'');}return _0x4d8c8e+')';};var _0x23ce50={'where':{'id':_0x46c0c3['id']}},_0x2286d2,_0x33c4ab,_0x10b78f,_0x2c3fe2,_0x7cc8d;_0x23ce50=_[_0xc3f5('0x3e')]({},_0x23ce50,_0x330ec2);return db[_0xc3f5('0x40')][_0xc3f5('0x4a')](_0x23ce50)['then'](function(_0x107f6e){if(_0x107f6e){_0x2286d2=_0x107f6e;return _0x107f6e[_0xc3f5('0x6d')]();}return null;})['then'](function(_0x1fa2f0){if(_0x1fa2f0){if(!_0x1fa2f0[_0xc3f5('0x47')]){throw new db[(_0xc3f5('0x6e'))][(_0xc3f5('0x6f'))](_0xc3f5('0x8d'),0x193);}_0x33c4ab=_0x1fa2f0;return db['AnalyticMetric'][_0xc3f5('0x41')]({'raw':!![]});}return null;})[_0xc3f5('0x23')](function(_0x3a6624){if(_0x3a6624){_0x10b78f=_['keyBy'](_0x3a6624,'id');var _0x3b1248;var _0x31a4a6=squel[_0xc3f5('0x72')]();_0x31a4a6[_0xc3f5('0x73')](_0x2286d2['table']);for(var _0x4512e7=0x0;_0x4512e7<_0x33c4ab[_0xc3f5('0x47')];_0x4512e7+=0x1){_0x3b1248=_0x33c4ab[_0x4512e7][_0xc3f5('0x74')]?_0x10b78f[_0x33c4ab[_0x4512e7][_0xc3f5('0x74')]]['metric']:_0x33c4ab[_0x4512e7][_0xc3f5('0x6a')];_0x3b1248=_0x33c4ab[_0x4512e7][_0xc3f5('0x77')]?_[_0xc3f5('0x76')](_0x323960[_0x33c4ab[_0x4512e7][_0xc3f5('0x77')]],'%s',_0x3b1248):_0x3b1248;_0x3b1248=_0x33c4ab[_0x4512e7][_0xc3f5('0x78')]?_[_0xc3f5('0x76')](_0x2264ea[_0x33c4ab[_0x4512e7][_0xc3f5('0x78')]],'%s',_0x3b1248):_0x3b1248;if(_0x33c4ab[_0x4512e7][_0xc3f5('0x8e')]){_0x31a4a6[_0xc3f5('0x69')](_0x3b1248);}_0x33c4ab[_0x4512e7][_0xc3f5('0x79')]&&_0x31a4a6[_0xc3f5('0x36')](_0x3b1248,_0x33c4ab[_0x4512e7][_0xc3f5('0x79')]===_0xc3f5('0x8f')?![]:!![]);_0x31a4a6[_0xc3f5('0x6a')](_0x3b1248,_0x33c4ab[_0x4512e7]['alias']||_0x3b1248);}if(_0x2286d2[_0xc3f5('0x7a')]){_0x2286d2[_0xc3f5('0x7a')]=JSON[_0xc3f5('0x7b')](_0x2286d2['joins']);for(var _0x4656db=0x0;_0x4656db<_0x2286d2[_0xc3f5('0x7a')][_0xc3f5('0x47')];_0x4656db+=0x1){if(_0x2286d2[_0xc3f5('0x7a')][_0x4656db]['type']&&_[_0xc3f5('0x8c')](_0x1edd24,_0x2286d2[_0xc3f5('0x7a')][_0x4656db][_0xc3f5('0x3c')])&&_0x2286d2[_0xc3f5('0x7a')][_0x4656db][_0xc3f5('0x7c')]&&_0x2286d2[_0xc3f5('0x7a')][_0x4656db]['foreignTable']&&_0x2286d2['joins'][_0x4656db][_0xc3f5('0x7e')]){_0x31a4a6[_0x2286d2[_0xc3f5('0x7a')][_0x4656db]['type']](_0x2286d2[_0xc3f5('0x7a')][_0x4656db][_0xc3f5('0x7d')],null,util[_0xc3f5('0x78')](_0xc3f5('0x7f'),_0x2286d2[_0xc3f5('0x80')],_0x2286d2[_0xc3f5('0x7a')][_0x4656db]['parentKey'],_0x2286d2[_0xc3f5('0x7a')][_0x4656db][_0xc3f5('0x7d')],_0x2286d2[_0xc3f5('0x7a')][_0x4656db][_0xc3f5('0x7e')]));}}}if(_0x2286d2[_0xc3f5('0x81')]){_0x2286d2[_0xc3f5('0x81')]=JSON[_0xc3f5('0x7b')](_0x2286d2['conditions']);_0x31a4a6[_0xc3f5('0x38')](_0x3e3d49(_0x2286d2['conditions'][_0xc3f5('0x69')]));}_0x7cc8d=_0x31a4a6[_0xc3f5('0x90')]();_0x31a4a6[_0xc3f5('0x1d')](_0x28407b);_0x31a4a6[_0xc3f5('0x1b')](0x0);return;}})[_0xc3f5('0x23')](function(){if(_0x523d92[_0xc3f5('0x91')]===_0xc3f5('0x92')){return null;}var _0x29dc5b=_[_0xc3f5('0x3e')](_0x523d92,{'name':_0x523d92['fullPath']||_0x523d92[_0xc3f5('0x29')]||_0x2286d2['name'],'basename':_0x4b5120,'savename':util['format']('%s-%s.%s',_0x523d92[_0xc3f5('0x29')]||_0x2286d2[_0xc3f5('0x29')],require('randomstring')[_0xc3f5('0x93')](0x4),_0x523d92[_0xc3f5('0x91')]||_0xc3f5('0x94')),'reportId':_0x2286d2['id'],'reportType':_0xc3f5('0x95')});return db[_0xc3f5('0x96')][_0xc3f5('0x4b')](_0x29dc5b,{'raw':!![]});})[_0xc3f5('0x23')](function(_0xa537ae){if(_0x2286d2['table']==='cdr'){_0x7cc8d['where'](_0x2286d2[_0xc3f5('0x80')]+_0xc3f5('0x97'),_0x523d92[_0xc3f5('0x98')],_0x523d92[_0xc3f5('0x99')]);}else{_0x7cc8d[_0xc3f5('0x38')](_0x2286d2[_0xc3f5('0x80')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x523d92[_0xc3f5('0x98')],_0x523d92['endDate']);}if(_0xa537ae){logger[_0xc3f5('0x9a')](_0xc3f5('0x9b'),_0x7cc8d[_0xc3f5('0x85')]());require('child_process')[_0xc3f5('0x9c')](path[_0xc3f5('0x55')](__dirname,'../../components/export/',_0xa537ae[_0xc3f5('0x91')]),[_0xa537ae['id'],_0x7cc8d['toString'](),path[_0xc3f5('0x55')](__dirname,_0xc3f5('0x9d'),_0xa537ae[_0xc3f5('0x9e')]),_0x4b5120]);return _0xa537ae;}else{var _0x1c23b2=squel[_0xc3f5('0x72')]();_0x1c23b2[_0xc3f5('0x73')]('('+_0x7cc8d[_0xc3f5('0x85')]()+')',_0xc3f5('0x9f'));_0x1c23b2[_0xc3f5('0x6a')](_0xc3f5('0xa0'),_0xc3f5('0x1e'));_0x7cc8d[_0xc3f5('0x1d')](_0x523d92['limit']||_0x28407b);_0x7cc8d[_0xc3f5('0x1b')](_0x523d92[_0xc3f5('0x1b')]||0x0);return dbH[_0xc3f5('0x84')]['query'](_0x1c23b2[_0xc3f5('0x85')](),{'type':dbH[_0xc3f5('0x84')][_0xc3f5('0x86')]['SELECT']})['then'](function(_0x239ab4){if(!_0x239ab4['length']){_0x2c3fe2=0x0;}else{_0x2c3fe2=_0x239ab4[0x0]['count']||0x0;}return dbH[_0xc3f5('0x84')][_0xc3f5('0x2f')](_0x7cc8d[_0xc3f5('0x85')](),{'type':dbH[_0xc3f5('0x84')][_0xc3f5('0x86')][_0xc3f5('0x87')]});})['then'](function(_0x37e518){return{'rows':_0x37e518||[],'count':_0x2c3fe2};});}});}exports[_0xc3f5('0xa1')]=function(_0x3f2b9a,_0x19fe62){return runReport(_0x3f2b9a[_0xc3f5('0x45')],_0x3f2b9a['query'],_0x3f2b9a[_0xc3f5('0x3f')])[_0xc3f5('0x23')](respondWithResult(_0x19fe62,null))[_0xc3f5('0x43')](handleError(_0x19fe62,null));};exports['runReport']=runReport;exports[_0xc3f5('0x2f')]=function(_0x4a20fa,_0xbee7b0){var _0x4c0ddf=0xa;var _0x16bbc8=['join',_0xc3f5('0x56'),'right_join',_0xc3f5('0x57')];var _0x1d015b={'SUM':_0xc3f5('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc3f5('0x59'),'MAX':_0xc3f5('0x5a'),'MIN':_0xc3f5('0x8a'),'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 _0x549e6f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xc3f5('0x60'),'HOUR':'HOUR(%s)','ROUND':_0xc3f5('0x62'),'UNIX_TIMESTAMP':_0xc3f5('0x8b')};var _0x2b7f20=function(_0x3fd90c){return!_[_0xc3f5('0x8c')]([_0xc3f5('0x63'),_0xc3f5('0x64'),_0xc3f5('0x65'),_0xc3f5('0x66')],_0x3fd90c);};var _0x4b816f=function(_0xc7436b){if(!_0xc7436b||!_0xc7436b['rules'][_0xc3f5('0x47')]){return'';}for(var _0x4d67fe='(',_0x5454e9=0x0;_0x5454e9<_0xc7436b[_0xc3f5('0x67')]['length'];_0x5454e9+=0x1){_0x5454e9>0x0&&(_0x4d67fe+='\x20'+_0xc7436b[_0xc3f5('0x68')]+'\x20');_0x4d67fe+=_0xc7436b[_0xc3f5('0x67')][_0x5454e9][_0xc3f5('0x69')]?_0x4b816f(_0xc7436b[_0xc3f5('0x67')][_0x5454e9][_0xc3f5('0x69')]):_0xc7436b[_0xc3f5('0x67')][_0x5454e9][_0xc3f5('0x6a')]+'\x20'+_0xc7436b[_0xc3f5('0x67')][_0x5454e9][_0xc3f5('0x6b')]+(_0x2b7f20(_0xc7436b[_0xc3f5('0x67')][_0x5454e9][_0xc3f5('0x6b')])?'\x20'+_0xc7436b[_0xc3f5('0x67')][_0x5454e9][_0xc3f5('0x6c')]:'');}return _0x4d67fe+')';};var _0x2790df={'where':{'id':_0x4a20fa['params']['id']}},_0x2b6a94,_0x1975a4,_0x505175,_0x54ef51,_0x3509ee;_0x2790df=_[_0xc3f5('0x3e')]({},_0x2790df,_0x4a20fa[_0xc3f5('0x3f')]);return db['AnalyticCustomReport']['find'](_0x2790df)[_0xc3f5('0x23')](function(_0x4d8bea){if(_0x4d8bea){_0x2b6a94=_0x4d8bea;return _0x4d8bea[_0xc3f5('0x6d')]();}return null;})['then'](function(_0x41558e){if(_0x41558e){if(!_0x41558e['length']){throw new db[(_0xc3f5('0x6e'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1975a4=_0x41558e;return db[_0xc3f5('0x70')][_0xc3f5('0x41')]({'raw':!![]});}return null;})[_0xc3f5('0x23')](function(_0x5b9bc0){if(_0x5b9bc0){_0x505175=_['keyBy'](_0x5b9bc0,'id');var _0x55386a;var _0x2d8f7f=squel['select']();_0x2d8f7f[_0xc3f5('0x73')](_0x2b6a94[_0xc3f5('0x80')]);for(var _0x368886=0x0;_0x368886<_0x1975a4[_0xc3f5('0x47')];_0x368886+=0x1){_0x55386a=_0x1975a4[_0x368886][_0xc3f5('0x74')]?_0x505175[_0x1975a4[_0x368886][_0xc3f5('0x74')]][_0xc3f5('0x75')]:_0x1975a4[_0x368886][_0xc3f5('0x6a')];_0x55386a=_0x1975a4[_0x368886]['function']?_[_0xc3f5('0x76')](_0x1d015b[_0x1975a4[_0x368886][_0xc3f5('0x77')]],'%s',_0x55386a):_0x55386a;_0x55386a=_0x1975a4[_0x368886]['format']?_['replace'](_0x549e6f[_0x1975a4[_0x368886]['format']],'%s',_0x55386a):_0x55386a;if(_0x1975a4[_0x368886][_0xc3f5('0x8e')]){_0x2d8f7f[_0xc3f5('0x69')](_0x55386a);}_0x1975a4[_0x368886][_0xc3f5('0x79')]&&_0x2d8f7f[_0xc3f5('0x36')](_0x55386a,_0x1975a4[_0x368886][_0xc3f5('0x79')]===_0xc3f5('0x8f')?![]:!![]);_0x2d8f7f[_0xc3f5('0x6a')](_0x55386a,_0x1975a4[_0x368886][_0xc3f5('0xa2')]||_0x55386a);}if(_0x2b6a94[_0xc3f5('0x7a')]){_0x2b6a94['joins']=JSON['parse'](_0x2b6a94[_0xc3f5('0x7a')]);for(var _0x4941df=0x0;_0x4941df<_0x2b6a94['joins']['length'];_0x4941df+=0x1){if(_0x2b6a94[_0xc3f5('0x7a')][_0x4941df]['type']&&_['includes'](_0x16bbc8,_0x2b6a94[_0xc3f5('0x7a')][_0x4941df]['type'])&&_0x2b6a94[_0xc3f5('0x7a')][_0x4941df][_0xc3f5('0x7c')]&&_0x2b6a94[_0xc3f5('0x7a')][_0x4941df]['foreignTable']&&_0x2b6a94[_0xc3f5('0x7a')][_0x4941df][_0xc3f5('0x7e')]){_0x2d8f7f[_0x2b6a94[_0xc3f5('0x7a')][_0x4941df]['type']](_0x2b6a94['joins'][_0x4941df][_0xc3f5('0x7d')],null,util[_0xc3f5('0x78')](_0xc3f5('0x7f'),_0x2b6a94[_0xc3f5('0x80')],_0x2b6a94[_0xc3f5('0x7a')][_0x4941df][_0xc3f5('0x7c')],_0x2b6a94[_0xc3f5('0x7a')][_0x4941df][_0xc3f5('0x7d')],_0x2b6a94[_0xc3f5('0x7a')][_0x4941df][_0xc3f5('0x7e')]));}}}if(_0x2b6a94[_0xc3f5('0x81')]){_0x2b6a94[_0xc3f5('0x81')]=JSON[_0xc3f5('0x7b')](_0x2b6a94[_0xc3f5('0x81')]);_0x2d8f7f[_0xc3f5('0x38')](_0x4b816f(_0x2b6a94['conditions'][_0xc3f5('0x69')]));}_0x3509ee=_0x2d8f7f[_0xc3f5('0x90')]();_0x2d8f7f[_0xc3f5('0x1d')](_0x4c0ddf);_0x2d8f7f[_0xc3f5('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x2d8f7f[_0xc3f5('0x85')]());return dbH[_0xc3f5('0x84')][_0xc3f5('0x2f')](_0x2d8f7f[_0xc3f5('0x85')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})['then'](function(){return{'sql':_0x3509ee[_0xc3f5('0x85')]()};})[_0xc3f5('0x23')](respondWithResult(_0xbee7b0,null))['catch'](handleError(_0xbee7b0,null));}; \ No newline at end of file +var _0x96db=['util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','UserProfileResource','stack','name','send','map','AnalyticCustomReport','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','cross_join','UNIX_TIMESTAMP(%s)','ValidationErrorItem','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','countTable','run','runReport','SUM(%s)','ROUND(%s)','IS\x20EMPTY','alias','debug','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x26f4f5,_0x4ad85d){var _0x217fc0=function(_0x187120){while(--_0x187120){_0x26f4f5['push'](_0x26f4f5['shift']());}};_0x217fc0(++_0x4ad85d);}(_0x96db,0x13f));var _0xb96d=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x96db[_0x1bc0ae];return _0x501104;};'use strict';var emlformat=require(_0xb96d('0x0'));var rimraf=require(_0xb96d('0x1'));var zipdir=require(_0xb96d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb96d('0x3'));var moment=require(_0xb96d('0x4'));var BPromise=require(_0xb96d('0x5'));var Mustache=require(_0xb96d('0x6'));var util=require(_0xb96d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xb96d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb96d('0x9'));var _=require('lodash');var squel=require(_0xb96d('0xa'));var crypto=require(_0xb96d('0xb'));var jsforce=require(_0xb96d('0xc'));var deskjs=require(_0xb96d('0xd'));var toCsv=require(_0xb96d('0x8'));var querystring=require(_0xb96d('0xe'));var Papa=require(_0xb96d('0xf'));var Redis=require(_0xb96d('0x10'));var authService=require(_0xb96d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb96d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb96d('0x13'))(_0xb96d('0x14'));var utils=require('../../config/utils');var config=require(_0xb96d('0x15'));var licenseUtil=require(_0xb96d('0x16'));var db=require(_0xb96d('0x17'))['db'];var dbH=require(_0xb96d('0x17'))[_0xb96d('0x18')];function respondWithStatusCode(_0x5e004a,_0x16f18c){_0x16f18c=_0x16f18c||0xcc;return function(_0x37230c){if(_0x37230c){return _0x5e004a[_0xb96d('0x19')](_0x16f18c);}return _0x5e004a['status'](_0x16f18c)[_0xb96d('0x1a')]();};}function respondWithResult(_0x1f1e02,_0x2b5bf1){_0x2b5bf1=_0x2b5bf1||0xc8;return function(_0x5d1962){if(_0x5d1962){return _0x1f1e02[_0xb96d('0x1b')](_0x2b5bf1)[_0xb96d('0x1c')](_0x5d1962);}};}function respondWithFilteredResult(_0x5af532,_0x58e8d7){return function(_0x25ff3c){if(_0x25ff3c){var _0x4069db=typeof _0x58e8d7[_0xb96d('0x1d')]===_0xb96d('0x1e')&&typeof _0x58e8d7['limit']===_0xb96d('0x1e');var _0x2db8c7=_0x25ff3c[_0xb96d('0x1f')];var _0xb62640=_0x4069db?0x0:_0x58e8d7[_0xb96d('0x1d')];var _0x468243=_0x4069db?_0x25ff3c[_0xb96d('0x1f')]:_0x58e8d7[_0xb96d('0x1d')]+_0x58e8d7[_0xb96d('0x20')];var _0x51a564;if(_0x468243>=_0x2db8c7){_0x468243=_0x2db8c7;_0x51a564=0xc8;}else{_0x51a564=0xce;}_0x5af532[_0xb96d('0x1b')](_0x51a564);return _0x5af532[_0xb96d('0x21')](_0xb96d('0x22'),_0xb62640+'-'+_0x468243+'/'+_0x2db8c7)['json'](_0x25ff3c);}return null;};}function patchUpdates(_0x57706a){return function(_0x251cfe){try{jsonpatch['apply'](_0x251cfe,_0x57706a,!![]);}catch(_0x712fb5){return BPromise['reject'](_0x712fb5);}return _0x251cfe[_0xb96d('0x23')]();};}function saveUpdates(_0x53f947,_0x146d7c){return function(_0x4513fe){if(_0x4513fe){return _0x4513fe[_0xb96d('0x24')](_0x53f947)[_0xb96d('0x25')](function(_0xab92b6){return _0xab92b6;});}return null;};}function removeEntity(_0x66cdbb,_0x368a39){return function(_0x3722ad){if(_0x3722ad){return _0x3722ad[_0xb96d('0x26')]()[_0xb96d('0x25')](function(){var _0x3d4db6=_0x3722ad['get']({'plain':!![]});var _0xd32008='CustomReports';return db[_0xb96d('0x27')][_0xb96d('0x26')]({'where':{'type':_0xd32008,'resourceId':_0x3d4db6['id']}})[_0xb96d('0x25')](function(){return _0x3722ad;});})[_0xb96d('0x25')](function(){_0x66cdbb[_0xb96d('0x1b')](0xcc)[_0xb96d('0x1a')]();});}};}function handleEntityNotFound(_0x49d03b,_0x56748b){return function(_0x1a6b43){if(!_0x1a6b43){_0x49d03b[_0xb96d('0x19')](0x194);}return _0x1a6b43;};}function handleError(_0x5ef98e,_0x581142){_0x581142=_0x581142||0x1f4;return function(_0x13af36){logger['error'](_0x13af36[_0xb96d('0x28')]);if(_0x13af36['name']){delete _0x13af36[_0xb96d('0x29')];}_0x5ef98e[_0xb96d('0x1b')](_0x581142)[_0xb96d('0x2a')](_0x13af36);};}exports['index']=function(_0x4cd429,_0x3966cb){var _0x29554e={},_0x103eae={},_0x2133ca={'count':0x0,'rows':[]};var _0x215adf=_[_0xb96d('0x2b')](db[_0xb96d('0x2c')]['rawAttributes'],function(_0x239949){return{'name':_0x239949[_0xb96d('0x2d')],'type':_0x239949[_0xb96d('0x2e')]['key']};});_0x103eae['model']=_[_0xb96d('0x2b')](_0x215adf,_0xb96d('0x29'));_0x103eae[_0xb96d('0x2f')]=_['keys'](_0x4cd429[_0xb96d('0x2f')]);_0x103eae[_0xb96d('0x30')]=_['intersection'](_0x103eae[_0xb96d('0x31')],_0x103eae[_0xb96d('0x2f')]);_0x29554e[_0xb96d('0x32')]=_[_0xb96d('0x33')](_0x103eae[_0xb96d('0x31')],qs['fields'](_0x4cd429['query'][_0xb96d('0x34')]));_0x29554e[_0xb96d('0x32')]=_0x29554e[_0xb96d('0x32')][_0xb96d('0x35')]?_0x29554e[_0xb96d('0x32')]:_0x103eae[_0xb96d('0x31')];if(!_0x4cd429[_0xb96d('0x2f')][_0xb96d('0x36')]('nolimit')){_0x29554e['limit']=qs[_0xb96d('0x20')](_0x4cd429[_0xb96d('0x2f')][_0xb96d('0x20')]);_0x29554e[_0xb96d('0x1d')]=qs['offset'](_0x4cd429[_0xb96d('0x2f')][_0xb96d('0x1d')]);}_0x29554e[_0xb96d('0x37')]=qs[_0xb96d('0x38')](_0x4cd429[_0xb96d('0x2f')]['sort']);_0x29554e['where']=qs[_0xb96d('0x30')](_['pick'](_0x4cd429[_0xb96d('0x2f')],_0x103eae[_0xb96d('0x30')]),_0x215adf);if(_0x4cd429['query'][_0xb96d('0x39')]){_0x29554e[_0xb96d('0x3a')]=_[_0xb96d('0x3b')](_0x29554e[_0xb96d('0x3a')],{'$or':_['map'](_0x215adf,function(_0x17134a){if(_0x17134a['type']!==_0xb96d('0x3c')){var _0x5e17c7={};_0x5e17c7[_0x17134a['name']]={'$like':'%'+_0x4cd429[_0xb96d('0x2f')][_0xb96d('0x39')]+'%'};return _0x5e17c7;}})});}_0x29554e=_[_0xb96d('0x3b')]({},_0x29554e,_0x4cd429[_0xb96d('0x3d')]);var _0x53eb18={'where':_0x29554e['where']};return db[_0xb96d('0x2c')][_0xb96d('0x1f')](_0x53eb18)[_0xb96d('0x25')](function(_0x5c8917){_0x2133ca[_0xb96d('0x1f')]=_0x5c8917;if(_0x4cd429[_0xb96d('0x2f')][_0xb96d('0x3e')]){_0x29554e['include']=[{'all':!![]}];}return db[_0xb96d('0x2c')][_0xb96d('0x3f')](_0x29554e);})[_0xb96d('0x25')](function(_0xed0354){_0x2133ca[_0xb96d('0x40')]=_0xed0354;return _0x2133ca;})['then'](respondWithFilteredResult(_0x3966cb,_0x29554e))['catch'](handleError(_0x3966cb,null));};exports['show']=function(_0x12b75a,_0x38a95f){var _0x2c7517={'raw':![],'where':{'id':_0x12b75a[_0xb96d('0x41')]['id']}},_0x309d02={};_0x309d02['model']=_[_0xb96d('0x42')](db[_0xb96d('0x2c')][_0xb96d('0x43')]);_0x309d02['query']=_['keys'](_0x12b75a['query']);_0x309d02[_0xb96d('0x30')]=_[_0xb96d('0x33')](_0x309d02[_0xb96d('0x31')],_0x309d02[_0xb96d('0x2f')]);_0x2c7517[_0xb96d('0x32')]=_[_0xb96d('0x33')](_0x309d02[_0xb96d('0x31')],qs[_0xb96d('0x34')](_0x12b75a[_0xb96d('0x2f')][_0xb96d('0x34')]));_0x2c7517[_0xb96d('0x32')]=_0x2c7517[_0xb96d('0x32')][_0xb96d('0x35')]?_0x2c7517['attributes']:_0x309d02['model'];if(_0x12b75a[_0xb96d('0x2f')][_0xb96d('0x3e')]){_0x2c7517[_0xb96d('0x44')]=[{'all':!![]}];}_0x2c7517=_[_0xb96d('0x3b')]({},_0x2c7517,_0x12b75a['options']);return db['AnalyticCustomReport'][_0xb96d('0x45')](_0x2c7517)[_0xb96d('0x25')](handleEntityNotFound(_0x38a95f,null))[_0xb96d('0x25')](respondWithResult(_0x38a95f,null))['catch'](handleError(_0x38a95f,null));};exports[_0xb96d('0x46')]=function(_0x17a6a2,_0x4b0a62){return db[_0xb96d('0x2c')][_0xb96d('0x46')](_0x17a6a2[_0xb96d('0x47')],{})[_0xb96d('0x25')](function(_0x2519c9){var _0x5414fe=_0x17a6a2['user']['get']({'plain':!![]});if(!_0x5414fe)throw new Error(_0xb96d('0x48'));if(_0x5414fe[_0xb96d('0x49')]===_0xb96d('0x4a')){var _0x23ab58=_0x2519c9['get']({'plain':!![]});var _0x372c39=_0xb96d('0x4b');return db[_0xb96d('0x4c')]['find']({'where':{'name':_0x372c39,'userProfileId':_0x5414fe[_0xb96d('0x4d')]},'raw':!![]})[_0xb96d('0x25')](function(_0x27eb3e){if(_0x27eb3e&&_0x27eb3e[_0xb96d('0x4e')]===0x0){return db[_0xb96d('0x27')][_0xb96d('0x46')]({'name':_0x23ab58[_0xb96d('0x29')],'resourceId':_0x23ab58['id'],'type':_0xb96d('0x4f'),'sectionId':_0x27eb3e['id']},{})[_0xb96d('0x25')](function(){return _0x2519c9;});}else{return _0x2519c9;}})[_0xb96d('0x50')](function(_0x2a7a50){logger[_0xb96d('0x51')](_0xb96d('0x52'),_0x2a7a50);throw _0x2a7a50;});}return _0x2519c9;})[_0xb96d('0x25')](respondWithResult(_0x4b0a62,0xc9))['catch'](handleError(_0x4b0a62,null));};exports[_0xb96d('0x24')]=function(_0x3acca3,_0x3882e3){if(_0x3acca3[_0xb96d('0x47')]['id']){delete _0x3acca3['body']['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x3acca3[_0xb96d('0x41')]['id']}})[_0xb96d('0x25')](handleEntityNotFound(_0x3882e3,null))[_0xb96d('0x25')](saveUpdates(_0x3acca3[_0xb96d('0x47')],null))[_0xb96d('0x25')](respondWithResult(_0x3882e3,null))[_0xb96d('0x50')](handleError(_0x3882e3,null));};exports[_0xb96d('0x26')]=function(_0x105a48,_0x20b7eb){return db[_0xb96d('0x2c')][_0xb96d('0x45')]({'where':{'id':_0x105a48[_0xb96d('0x41')]['id']}})[_0xb96d('0x25')](handleEntityNotFound(_0x20b7eb,null))['then'](removeEntity(_0x20b7eb,null))['catch'](handleError(_0x20b7eb,null));};exports[_0xb96d('0x53')]=function(_0x42cca0,_0x48a953){var _0x28ee1e=0xa;var _0x4d0451=['join',_0xb96d('0x54'),_0xb96d('0x55'),'cross_join'];var _0x5df38c={'SUM':'SUM(%s)','COUNT':_0xb96d('0x56'),'COUNT DISTINCT':_0xb96d('0x57'),'MAX':_0xb96d('0x58'),'MIN':'MIN(%s)','AVG':_0xb96d('0x59'),'GROUP_CONCAT':_0xb96d('0x5a'),'GROUP_CONCAT ASC':_0xb96d('0x5b'),'GROUP_CONCAT DESC':_0xb96d('0x5c')};var _0x2c2006={'SEC_TO_TIME':_0xb96d('0x5d'),'DATE':_0xb96d('0x5e'),'HOUR':_0xb96d('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3d1d2e=function(_0x27206f){return!_[_0xb96d('0x60')]([_0xb96d('0x61'),_0xb96d('0x62'),'IS\x20EMPTY',_0xb96d('0x63')],_0x27206f);};var _0x594774=function(_0x549364){if(!_0x549364||!_0x549364[_0xb96d('0x64')]['length']){return'';}for(var _0x33d065='(',_0x564a7c=0x0;_0x564a7c<_0x549364[_0xb96d('0x64')][_0xb96d('0x35')];_0x564a7c+=0x1){_0x564a7c>0x0&&(_0x33d065+='\x20'+_0x549364[_0xb96d('0x65')]+'\x20');_0x33d065+=_0x549364[_0xb96d('0x64')][_0x564a7c][_0xb96d('0x66')]?_0x594774(_0x549364[_0xb96d('0x64')][_0x564a7c][_0xb96d('0x66')]):_0x549364['rules'][_0x564a7c][_0xb96d('0x67')]+'\x20'+_0x549364[_0xb96d('0x64')][_0x564a7c][_0xb96d('0x68')]+(_0x3d1d2e(_0x549364[_0xb96d('0x64')][_0x564a7c]['condition'])?'\x20'+_0x549364[_0xb96d('0x64')][_0x564a7c][_0xb96d('0x69')]:'');}return _0x33d065+')';};var _0x152281={'where':{'id':_0x42cca0[_0xb96d('0x41')]['id']}},_0x48631f,_0x1f7e8e,_0x4fee39,_0x10874c,_0x193c90;_0x152281=_['merge']({},_0x152281,_0x42cca0[_0xb96d('0x3d')]);return db[_0xb96d('0x2c')]['find'](_0x152281)[_0xb96d('0x25')](function(_0x501db0){if(_0x501db0){_0x48631f=_0x501db0;return _0x501db0[_0xb96d('0x6a')]();}return null;})[_0xb96d('0x25')](function(_0x495fac){if(_0x495fac){if(!_0x495fac[_0xb96d('0x35')]){throw new db[(_0xb96d('0x6b'))]['ValidationErrorItem'](_0xb96d('0x6c'),0x193);}_0x1f7e8e=_0x495fac;return db[_0xb96d('0x6d')][_0xb96d('0x3f')]({'raw':!![]});}return null;})[_0xb96d('0x25')](function(_0x1a5277){if(_0x1a5277){_0x4fee39=_[_0xb96d('0x6e')](_0x1a5277,'id');var _0x55593f;var _0x331fc3=squel[_0xb96d('0x6f')]();_0x331fc3[_0xb96d('0x70')](_0x48631f[_0xb96d('0x71')]);for(var _0x17e0d8=0x0;_0x17e0d8<_0x1f7e8e[_0xb96d('0x35')];_0x17e0d8+=0x1){_0x55593f=_0x1f7e8e[_0x17e0d8][_0xb96d('0x72')]?_0x4fee39[_0x1f7e8e[_0x17e0d8][_0xb96d('0x72')]][_0xb96d('0x73')]:_0x1f7e8e[_0x17e0d8][_0xb96d('0x67')];_0x55593f=_0x1f7e8e[_0x17e0d8][_0xb96d('0x74')]?_[_0xb96d('0x75')](_0x5df38c[_0x1f7e8e[_0x17e0d8][_0xb96d('0x74')]],'%s',_0x55593f):_0x55593f;_0x55593f=_0x1f7e8e[_0x17e0d8][_0xb96d('0x76')]?_[_0xb96d('0x75')](_0x2c2006[_0x1f7e8e[_0x17e0d8][_0xb96d('0x76')]],'%s',_0x55593f):_0x55593f;if(_0x1f7e8e[_0x17e0d8][_0xb96d('0x77')]){_0x331fc3[_0xb96d('0x66')](_0x55593f);}_0x1f7e8e[_0x17e0d8][_0xb96d('0x78')]&&_0x331fc3[_0xb96d('0x37')](_0x55593f,_0x1f7e8e[_0x17e0d8]['orderBy']===_0xb96d('0x79')?![]:!![]);_0x331fc3[_0xb96d('0x67')](_0x55593f,_0x1f7e8e[_0x17e0d8]['alias']||_0x55593f);}if(_0x48631f[_0xb96d('0x7a')]){_0x48631f['joins']=JSON[_0xb96d('0x7b')](_0x48631f[_0xb96d('0x7a')]);for(var _0x234538=0x0;_0x234538<_0x48631f[_0xb96d('0x7a')][_0xb96d('0x35')];_0x234538+=0x1){if(_0x48631f[_0xb96d('0x7a')][_0x234538][_0xb96d('0x2e')]&&_[_0xb96d('0x60')](_0x4d0451,_0x48631f[_0xb96d('0x7a')][_0x234538][_0xb96d('0x2e')])&&_0x48631f[_0xb96d('0x7a')][_0x234538][_0xb96d('0x7c')]&&_0x48631f[_0xb96d('0x7a')][_0x234538][_0xb96d('0x7d')]&&_0x48631f[_0xb96d('0x7a')][_0x234538]['foreignKey']){_0x331fc3[_0x48631f[_0xb96d('0x7a')][_0x234538][_0xb96d('0x2e')]](_0x48631f[_0xb96d('0x7a')][_0x234538][_0xb96d('0x7d')],null,util[_0xb96d('0x76')](_0xb96d('0x7e'),_0x48631f[_0xb96d('0x71')],_0x48631f['joins'][_0x234538][_0xb96d('0x7c')],_0x48631f[_0xb96d('0x7a')][_0x234538][_0xb96d('0x7d')],_0x48631f['joins'][_0x234538][_0xb96d('0x7f')]));}}}if(_0x48631f[_0xb96d('0x80')]){_0x48631f[_0xb96d('0x80')]=JSON['parse'](_0x48631f[_0xb96d('0x80')]);_0x331fc3[_0xb96d('0x3a')](_0x594774(_0x48631f[_0xb96d('0x80')][_0xb96d('0x66')]));}_0x193c90=_0x331fc3['clone']();_0x331fc3[_0xb96d('0x20')](_0x28ee1e);_0x331fc3[_0xb96d('0x1d')](0x0);logger['debug'](_0xb96d('0x81'),_0x331fc3[_0xb96d('0x82')]());return dbH[_0xb96d('0x83')][_0xb96d('0x2f')](_0x331fc3[_0xb96d('0x82')](),{'type':dbH['sequelize'][_0xb96d('0x84')][_0xb96d('0x85')]});}})['then'](respondWithResult(_0x48a953,null))[_0xb96d('0x50')](handleError(_0x48a953,null));};function runReport(_0x41385e,_0x2622fc,_0x2b55a2){var _0x12a123=_0x2622fc[_0xb96d('0x29')];var _0x5ea1df=0xa;var _0x27bdec=[_0xb96d('0x86'),_0xb96d('0x54'),_0xb96d('0x55'),_0xb96d('0x87')];var _0x3246fb={'SUM':'SUM(%s)','COUNT':_0xb96d('0x56'),'COUNT DISTINCT':_0xb96d('0x57'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xb96d('0x59'),'GROUP_CONCAT':_0xb96d('0x5a'),'GROUP_CONCAT ASC':_0xb96d('0x5b'),'GROUP_CONCAT DESC':_0xb96d('0x5c')};var _0xa0457d={'SEC_TO_TIME':_0xb96d('0x5d'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb96d('0x88')};var _0x474693=function(_0x192bf0){return!_['includes']([_0xb96d('0x61'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x192bf0);};var _0x24ff3c=function(_0x54a9ed){if(!_0x54a9ed||!_0x54a9ed[_0xb96d('0x64')][_0xb96d('0x35')]){return'';}for(var _0xc47bab='(',_0x325077=0x0;_0x325077<_0x54a9ed['rules']['length'];_0x325077+=0x1){_0x325077>0x0&&(_0xc47bab+='\x20'+_0x54a9ed[_0xb96d('0x65')]+'\x20');_0xc47bab+=_0x54a9ed['rules'][_0x325077][_0xb96d('0x66')]?_0x24ff3c(_0x54a9ed[_0xb96d('0x64')][_0x325077][_0xb96d('0x66')]):_0x54a9ed[_0xb96d('0x64')][_0x325077][_0xb96d('0x67')]+'\x20'+_0x54a9ed[_0xb96d('0x64')][_0x325077][_0xb96d('0x68')]+(_0x474693(_0x54a9ed['rules'][_0x325077][_0xb96d('0x68')])?'\x20'+_0x54a9ed[_0xb96d('0x64')][_0x325077][_0xb96d('0x69')]:'');}return _0xc47bab+')';};var _0x5b170f={'where':{'id':_0x41385e['id']}},_0x40ce0e,_0xe849b1,_0x50a20d,_0x2cea3b,_0x37171c;_0x5b170f=_[_0xb96d('0x3b')]({},_0x5b170f,_0x2b55a2);return db[_0xb96d('0x2c')][_0xb96d('0x45')](_0x5b170f)[_0xb96d('0x25')](function(_0x2424a9){if(_0x2424a9){_0x40ce0e=_0x2424a9;return _0x2424a9[_0xb96d('0x6a')]();}return null;})[_0xb96d('0x25')](function(_0x5a3b39){if(_0x5a3b39){if(!_0x5a3b39[_0xb96d('0x35')]){throw new db[(_0xb96d('0x6b'))][(_0xb96d('0x89'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xe849b1=_0x5a3b39;return db[_0xb96d('0x6d')][_0xb96d('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x1fa723){if(_0x1fa723){_0x50a20d=_['keyBy'](_0x1fa723,'id');var _0x48c4ae;var _0x4515ad=squel[_0xb96d('0x6f')]();_0x4515ad['from'](_0x40ce0e[_0xb96d('0x71')]);for(var _0x4150a6=0x0;_0x4150a6<_0xe849b1['length'];_0x4150a6+=0x1){_0x48c4ae=_0xe849b1[_0x4150a6][_0xb96d('0x72')]?_0x50a20d[_0xe849b1[_0x4150a6][_0xb96d('0x72')]][_0xb96d('0x73')]:_0xe849b1[_0x4150a6][_0xb96d('0x67')];_0x48c4ae=_0xe849b1[_0x4150a6][_0xb96d('0x74')]?_[_0xb96d('0x75')](_0x3246fb[_0xe849b1[_0x4150a6][_0xb96d('0x74')]],'%s',_0x48c4ae):_0x48c4ae;_0x48c4ae=_0xe849b1[_0x4150a6][_0xb96d('0x76')]?_[_0xb96d('0x75')](_0xa0457d[_0xe849b1[_0x4150a6][_0xb96d('0x76')]],'%s',_0x48c4ae):_0x48c4ae;if(_0xe849b1[_0x4150a6][_0xb96d('0x77')]){_0x4515ad[_0xb96d('0x66')](_0x48c4ae);}_0xe849b1[_0x4150a6]['orderBy']&&_0x4515ad[_0xb96d('0x37')](_0x48c4ae,_0xe849b1[_0x4150a6][_0xb96d('0x78')]==='DESC'?![]:!![]);_0x4515ad['field'](_0x48c4ae,_0xe849b1[_0x4150a6]['alias']||_0x48c4ae);}if(_0x40ce0e[_0xb96d('0x7a')]){_0x40ce0e[_0xb96d('0x7a')]=JSON[_0xb96d('0x7b')](_0x40ce0e['joins']);for(var _0x1e8af8=0x0;_0x1e8af8<_0x40ce0e[_0xb96d('0x7a')]['length'];_0x1e8af8+=0x1){if(_0x40ce0e[_0xb96d('0x7a')][_0x1e8af8]['type']&&_[_0xb96d('0x60')](_0x27bdec,_0x40ce0e['joins'][_0x1e8af8]['type'])&&_0x40ce0e[_0xb96d('0x7a')][_0x1e8af8][_0xb96d('0x7c')]&&_0x40ce0e[_0xb96d('0x7a')][_0x1e8af8]['foreignTable']&&_0x40ce0e['joins'][_0x1e8af8][_0xb96d('0x7f')]){_0x4515ad[_0x40ce0e[_0xb96d('0x7a')][_0x1e8af8][_0xb96d('0x2e')]](_0x40ce0e[_0xb96d('0x7a')][_0x1e8af8][_0xb96d('0x7d')],null,util['format'](_0xb96d('0x7e'),_0x40ce0e[_0xb96d('0x71')],_0x40ce0e[_0xb96d('0x7a')][_0x1e8af8]['parentKey'],_0x40ce0e[_0xb96d('0x7a')][_0x1e8af8][_0xb96d('0x7d')],_0x40ce0e[_0xb96d('0x7a')][_0x1e8af8][_0xb96d('0x7f')]));}}}if(_0x40ce0e[_0xb96d('0x80')]){_0x40ce0e['conditions']=JSON[_0xb96d('0x7b')](_0x40ce0e['conditions']);_0x4515ad['where'](_0x24ff3c(_0x40ce0e[_0xb96d('0x80')][_0xb96d('0x66')]));}_0x37171c=_0x4515ad[_0xb96d('0x8a')]();_0x4515ad[_0xb96d('0x20')](_0x5ea1df);_0x4515ad[_0xb96d('0x1d')](0x0);return;}})[_0xb96d('0x25')](function(){if(_0x2622fc[_0xb96d('0x8b')]===_0xb96d('0x8c')){return null;}var _0x26fe17=_['merge'](_0x2622fc,{'name':_0x2622fc[_0xb96d('0x8d')]||_0x2622fc[_0xb96d('0x29')]||_0x40ce0e[_0xb96d('0x29')],'basename':_0x12a123,'savename':util[_0xb96d('0x76')](_0xb96d('0x8e'),_0x2622fc[_0xb96d('0x29')]||_0x40ce0e[_0xb96d('0x29')],require(_0xb96d('0x8f'))[_0xb96d('0x90')](0x4),_0x2622fc[_0xb96d('0x8b')]||_0xb96d('0x91')),'reportId':_0x40ce0e['id'],'reportType':_0xb96d('0x92')});return db[_0xb96d('0x93')]['create'](_0x26fe17,{'raw':!![]});})['then'](function(_0x32fad0){if(_0x40ce0e[_0xb96d('0x71')]==='cdr'){_0x37171c[_0xb96d('0x3a')](_0x40ce0e[_0xb96d('0x71')]+_0xb96d('0x94'),_0x2622fc[_0xb96d('0x95')],_0x2622fc['endDate']);}else{_0x37171c[_0xb96d('0x3a')](_0x40ce0e['table']+_0xb96d('0x96'),_0x2622fc['startDate'],_0x2622fc[_0xb96d('0x97')]);}if(_0x32fad0){logger[_0xb96d('0x98')](_0xb96d('0x99'),_0x37171c[_0xb96d('0x82')]());require('child_process')[_0xb96d('0x9a')](path[_0xb96d('0x86')](__dirname,'../../components/export/',_0x32fad0[_0xb96d('0x8b')]),[_0x32fad0['id'],_0x37171c[_0xb96d('0x82')](),path['join'](__dirname,'../../files/reports',_0x32fad0['savename']),_0x12a123]);return _0x32fad0;}else{var _0xb3e0b3=squel['select']();_0xb3e0b3[_0xb96d('0x70')]('('+_0x37171c['toString']()+')',_0xb96d('0x9b'));_0xb3e0b3[_0xb96d('0x67')]('COUNT(*)',_0xb96d('0x1f'));_0x37171c['limit'](_0x2622fc[_0xb96d('0x20')]||_0x5ea1df);_0x37171c[_0xb96d('0x1d')](_0x2622fc[_0xb96d('0x1d')]||0x0);return dbH[_0xb96d('0x83')][_0xb96d('0x2f')](_0xb3e0b3[_0xb96d('0x82')](),{'type':dbH[_0xb96d('0x83')][_0xb96d('0x84')][_0xb96d('0x85')]})[_0xb96d('0x25')](function(_0x4baab1){if(!_0x4baab1[_0xb96d('0x35')]){_0x2cea3b=0x0;}else{_0x2cea3b=_0x4baab1[0x0][_0xb96d('0x1f')]||0x0;}return dbH[_0xb96d('0x83')][_0xb96d('0x2f')](_0x37171c[_0xb96d('0x82')](),{'type':dbH[_0xb96d('0x83')][_0xb96d('0x84')][_0xb96d('0x85')]});})[_0xb96d('0x25')](function(_0x10f801){return{'rows':_0x10f801||[],'count':_0x2cea3b};});}});}exports[_0xb96d('0x9c')]=function(_0x55c70b,_0x1b91eb){return runReport(_0x55c70b[_0xb96d('0x41')],_0x55c70b['query'],_0x55c70b[_0xb96d('0x3d')])[_0xb96d('0x25')](respondWithResult(_0x1b91eb,null))[_0xb96d('0x50')](handleError(_0x1b91eb,null));};exports[_0xb96d('0x9d')]=runReport;exports[_0xb96d('0x2f')]=function(_0x140adc,_0x60bfa6){var _0x6c57c8=0xa;var _0x2407e1=['join',_0xb96d('0x54'),_0xb96d('0x55'),_0xb96d('0x87')];var _0xb6a093={'SUM':_0xb96d('0x9e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb96d('0x58'),'MIN':'MIN(%s)','AVG':_0xb96d('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb96d('0x5b'),'GROUP_CONCAT DESC':_0xb96d('0x5c')};var _0x4f3db0={'SEC_TO_TIME':_0xb96d('0x5d'),'DATE':_0xb96d('0x5e'),'HOUR':_0xb96d('0x5f'),'ROUND':_0xb96d('0x9f'),'UNIX_TIMESTAMP':_0xb96d('0x88')};var _0x1244e9=function(_0x232e19){return!_[_0xb96d('0x60')]([_0xb96d('0x61'),_0xb96d('0x62'),_0xb96d('0xa0'),_0xb96d('0x63')],_0x232e19);};var _0x36f2e0=function(_0xc08d5f){if(!_0xc08d5f||!_0xc08d5f[_0xb96d('0x64')][_0xb96d('0x35')]){return'';}for(var _0x293531='(',_0x58acb1=0x0;_0x58acb1<_0xc08d5f[_0xb96d('0x64')][_0xb96d('0x35')];_0x58acb1+=0x1){_0x58acb1>0x0&&(_0x293531+='\x20'+_0xc08d5f[_0xb96d('0x65')]+'\x20');_0x293531+=_0xc08d5f[_0xb96d('0x64')][_0x58acb1][_0xb96d('0x66')]?_0x36f2e0(_0xc08d5f[_0xb96d('0x64')][_0x58acb1][_0xb96d('0x66')]):_0xc08d5f[_0xb96d('0x64')][_0x58acb1][_0xb96d('0x67')]+'\x20'+_0xc08d5f[_0xb96d('0x64')][_0x58acb1][_0xb96d('0x68')]+(_0x1244e9(_0xc08d5f[_0xb96d('0x64')][_0x58acb1][_0xb96d('0x68')])?'\x20'+_0xc08d5f[_0xb96d('0x64')][_0x58acb1][_0xb96d('0x69')]:'');}return _0x293531+')';};var _0x1376d7={'where':{'id':_0x140adc[_0xb96d('0x41')]['id']}},_0x1449ae,_0x367cf7,_0x2055bf,_0x5c2036,_0x17b113;_0x1376d7=_['merge']({},_0x1376d7,_0x140adc[_0xb96d('0x3d')]);return db[_0xb96d('0x2c')][_0xb96d('0x45')](_0x1376d7)[_0xb96d('0x25')](function(_0x40f6d3){if(_0x40f6d3){_0x1449ae=_0x40f6d3;return _0x40f6d3['getFields']();}return null;})[_0xb96d('0x25')](function(_0x4eb378){if(_0x4eb378){if(!_0x4eb378[_0xb96d('0x35')]){throw new db[(_0xb96d('0x6b'))][(_0xb96d('0x89'))](_0xb96d('0x6c'),0x193);}_0x367cf7=_0x4eb378;return db['AnalyticMetric'][_0xb96d('0x3f')]({'raw':!![]});}return null;})['then'](function(_0x5dc742){if(_0x5dc742){_0x2055bf=_['keyBy'](_0x5dc742,'id');var _0x4fca85;var _0x2fa93f=squel[_0xb96d('0x6f')]();_0x2fa93f[_0xb96d('0x70')](_0x1449ae['table']);for(var _0x4a8bf5=0x0;_0x4a8bf5<_0x367cf7[_0xb96d('0x35')];_0x4a8bf5+=0x1){_0x4fca85=_0x367cf7[_0x4a8bf5]['MetricId']?_0x2055bf[_0x367cf7[_0x4a8bf5][_0xb96d('0x72')]]['metric']:_0x367cf7[_0x4a8bf5][_0xb96d('0x67')];_0x4fca85=_0x367cf7[_0x4a8bf5]['function']?_[_0xb96d('0x75')](_0xb6a093[_0x367cf7[_0x4a8bf5]['function']],'%s',_0x4fca85):_0x4fca85;_0x4fca85=_0x367cf7[_0x4a8bf5][_0xb96d('0x76')]?_[_0xb96d('0x75')](_0x4f3db0[_0x367cf7[_0x4a8bf5]['format']],'%s',_0x4fca85):_0x4fca85;if(_0x367cf7[_0x4a8bf5][_0xb96d('0x77')]){_0x2fa93f[_0xb96d('0x66')](_0x4fca85);}_0x367cf7[_0x4a8bf5][_0xb96d('0x78')]&&_0x2fa93f[_0xb96d('0x37')](_0x4fca85,_0x367cf7[_0x4a8bf5][_0xb96d('0x78')]==='DESC'?![]:!![]);_0x2fa93f[_0xb96d('0x67')](_0x4fca85,_0x367cf7[_0x4a8bf5][_0xb96d('0xa1')]||_0x4fca85);}if(_0x1449ae['joins']){_0x1449ae[_0xb96d('0x7a')]=JSON[_0xb96d('0x7b')](_0x1449ae[_0xb96d('0x7a')]);for(var _0x1e0241=0x0;_0x1e0241<_0x1449ae[_0xb96d('0x7a')][_0xb96d('0x35')];_0x1e0241+=0x1){if(_0x1449ae[_0xb96d('0x7a')][_0x1e0241]['type']&&_[_0xb96d('0x60')](_0x2407e1,_0x1449ae[_0xb96d('0x7a')][_0x1e0241][_0xb96d('0x2e')])&&_0x1449ae[_0xb96d('0x7a')][_0x1e0241][_0xb96d('0x7c')]&&_0x1449ae[_0xb96d('0x7a')][_0x1e0241][_0xb96d('0x7d')]&&_0x1449ae[_0xb96d('0x7a')][_0x1e0241][_0xb96d('0x7f')]){_0x2fa93f[_0x1449ae[_0xb96d('0x7a')][_0x1e0241][_0xb96d('0x2e')]](_0x1449ae[_0xb96d('0x7a')][_0x1e0241][_0xb96d('0x7d')],null,util[_0xb96d('0x76')]('%s.%s\x20=\x20%s.%s',_0x1449ae[_0xb96d('0x71')],_0x1449ae[_0xb96d('0x7a')][_0x1e0241][_0xb96d('0x7c')],_0x1449ae[_0xb96d('0x7a')][_0x1e0241]['foreignTable'],_0x1449ae['joins'][_0x1e0241][_0xb96d('0x7f')]));}}}if(_0x1449ae[_0xb96d('0x80')]){_0x1449ae[_0xb96d('0x80')]=JSON[_0xb96d('0x7b')](_0x1449ae[_0xb96d('0x80')]);_0x2fa93f['where'](_0x36f2e0(_0x1449ae[_0xb96d('0x80')][_0xb96d('0x66')]));}_0x17b113=_0x2fa93f[_0xb96d('0x8a')]();_0x2fa93f[_0xb96d('0x20')](_0x6c57c8);_0x2fa93f['offset'](0x0);logger[_0xb96d('0xa2')](_0xb96d('0x81'),_0x2fa93f['toString']());return dbH[_0xb96d('0x83')][_0xb96d('0x2f')](_0x2fa93f[_0xb96d('0x82')](),{'type':dbH['sequelize']['QueryTypes'][_0xb96d('0x85')]});}})['then'](function(){return{'sql':_0x17b113[_0xb96d('0x82')]()};})['then'](respondWithResult(_0x60bfa6,null))[_0xb96d('0x50')](handleError(_0x60bfa6,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index ab3a215..2db1cf7 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 _0xe3fb=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe3fb,0x9c));var _0xbe3f=function(_0x21d1eb,_0x56f664){_0x21d1eb=_0x21d1eb-0x0;var _0x4cb8cd=_0xe3fb[_0x21d1eb];return _0x4cb8cd;};'use strict';var _=require(_0xbe3f('0x0'));var util=require('util');var logger=require(_0xbe3f('0x1'))(_0xbe3f('0x2'));var moment=require('moment');var BPromise=require(_0xbe3f('0x3'));var rp=require(_0xbe3f('0x4'));var fs=require('fs');var path=require(_0xbe3f('0x5'));var rimraf=require(_0xbe3f('0x6'));var config=require(_0xbe3f('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0xbe3f('0x8')]=function(_0x331574,_0x14da19){return _0x331574[_0xbe3f('0x9')](_0xbe3f('0xa'),attributes,{'tableName':_0xbe3f('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96ee=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','AnalyticCustomReport','lodash'];(function(_0x26cc43,_0x135965){var _0x25de4f=function(_0x36837d){while(--_0x36837d){_0x26cc43['push'](_0x26cc43['shift']());}};_0x25de4f(++_0x135965);}(_0x96ee,0x131));var _0xe96e=function(_0x395667,_0x45593a){_0x395667=_0x395667-0x0;var _0x5cdb8f=_0x96ee[_0x395667];return _0x5cdb8f;};'use strict';var _=require(_0xe96e('0x0'));var util=require(_0xe96e('0x1'));var logger=require(_0xe96e('0x2'))(_0xe96e('0x3'));var moment=require(_0xe96e('0x4'));var BPromise=require(_0xe96e('0x5'));var rp=require(_0xe96e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe96e('0x7'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x1dc1c0,_0x1af3ae){return _0x1dc1c0['define'](_0xe96e('0x8'),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 6fec822..85ae479 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 _0x9937=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','ioredis'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x9937,0x1b4));var _0x7993=function(_0x268787,_0x328324){_0x268787=_0x268787-0x0;var _0x3f530f=_0x9937[_0x268787];return _0x3f530f;};'use strict';var _=require(_0x7993('0x0'));var util=require('util');var moment=require(_0x7993('0x1'));var BPromise=require(_0x7993('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7993('0x3'));var db=require(_0x7993('0x4'))['db'];var utils=require(_0x7993('0x5'));var logger=require(_0x7993('0x6'))(_0x7993('0x7'));var config=require(_0x7993('0x8'));var jayson=require(_0x7993('0x9'));var client=jayson[_0x7993('0xa')][_0x7993('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30fb1e,_0x484077,_0x43444e){return new BPromise(function(_0x2a19d2,_0x4029c9){return client['request'](_0x30fb1e,_0x43444e)[_0x7993('0xc')](function(_0x5a5e47){logger[_0x7993('0xd')](_0x7993('0xe'),_0x484077,_0x7993('0xf'));logger['debug'](_0x7993('0x10'),_0x484077,_0x7993('0xf'),JSON['stringify'](_0x5a5e47));if(_0x5a5e47[_0x7993('0x11')]){if(_0x5a5e47[_0x7993('0x11')]['code']===0x1f4){logger[_0x7993('0x11')](_0x7993('0xe'),_0x484077,_0x5a5e47['error']['message']);return _0x4029c9(_0x5a5e47[_0x7993('0x11')][_0x7993('0x12')]);}logger[_0x7993('0x11')](_0x7993('0xe'),_0x484077,_0x5a5e47['error']['message']);return _0x2a19d2(_0x5a5e47['error'][_0x7993('0x12')]);}else{logger[_0x7993('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x484077,_0x7993('0xf'));_0x2a19d2(_0x5a5e47['result']['message']);}})[_0x7993('0x13')](function(_0x37d1f4){logger[_0x7993('0x11')](_0x7993('0xe'),_0x484077,_0x37d1f4);_0x4029c9(_0x37d1f4);});});} \ No newline at end of file +var _0x525f=['code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x32b70b,_0x5749c4){var _0x459147=function(_0x1ba5a7){while(--_0x1ba5a7){_0x32b70b['push'](_0x32b70b['shift']());}};_0x459147(++_0x5749c4);}(_0x525f,0x64));var _0xf525=function(_0x2d010a,_0x515cfa){_0x2d010a=_0x2d010a-0x0;var _0x16e6d2=_0x525f[_0x2d010a];return _0x16e6d2;};'use strict';var _=require(_0xf525('0x0'));var util=require(_0xf525('0x1'));var moment=require(_0xf525('0x2'));var BPromise=require(_0xf525('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf525('0x4'));var db=require(_0xf525('0x5'))['db'];var utils=require(_0xf525('0x6'));var logger=require(_0xf525('0x7'))(_0xf525('0x8'));var config=require('../../config/environment');var jayson=require(_0xf525('0x9'));var client=jayson[_0xf525('0xa')][_0xf525('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412592,_0x4f269c,_0x1e8a9b){return new BPromise(function(_0xd876f5,_0x55ccc4){return client[_0xf525('0xc')](_0x412592,_0x1e8a9b)['then'](function(_0x559e39){logger[_0xf525('0xd')](_0xf525('0xe'),_0x4f269c,_0xf525('0xf'));logger[_0xf525('0x10')](_0xf525('0x11'),_0x4f269c,_0xf525('0xf'),JSON[_0xf525('0x12')](_0x559e39));if(_0x559e39[_0xf525('0x13')]){if(_0x559e39['error'][_0xf525('0x14')]===0x1f4){logger[_0xf525('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4f269c,_0x559e39[_0xf525('0x13')][_0xf525('0x15')]);return _0x55ccc4(_0x559e39['error']['message']);}logger[_0xf525('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x4f269c,_0x559e39[_0xf525('0x13')][_0xf525('0x15')]);return _0xd876f5(_0x559e39[_0xf525('0x13')][_0xf525('0x15')]);}else{logger[_0xf525('0xd')](_0xf525('0xe'),_0x4f269c,_0xf525('0xf'));_0xd876f5(_0x559e39[_0xf525('0x16')][_0xf525('0x15')]);}})[_0xf525('0x17')](function(_0x7212fc){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x4f269c,_0x7212fc);_0x55ccc4(_0x7212fc);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index a55053e..55cae8c 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 _0x9036=['/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/preview'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9036,0x155));var _0x6903=function(_0x2709bd,_0x274e31){_0x2709bd=_0x2709bd-0x0;var _0x4b5d5c=_0x9036[_0x2709bd];return _0x4b5d5c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6903('0x0'));var express=require(_0x6903('0x1'));var router=express[_0x6903('0x2')]();var fs_extra=require(_0x6903('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6903('0x4'));var config=require(_0x6903('0x5'));var controller=require('./analyticCustomReport.controller');router[_0x6903('0x6')]('/',auth[_0x6903('0x7')](),controller['index']);router[_0x6903('0x6')](_0x6903('0x8'),auth[_0x6903('0x7')](),controller[_0x6903('0x9')]);router[_0x6903('0x6')](_0x6903('0xa'),auth[_0x6903('0x7')](),controller['preview']);router[_0x6903('0x6')](_0x6903('0xb'),auth[_0x6903('0x7')](),controller[_0x6903('0xc')]);router[_0x6903('0x6')](_0x6903('0xd'),auth[_0x6903('0x7')](),controller[_0x6903('0xe')]);router[_0x6903('0xf')]('/',auth[_0x6903('0x7')](),controller[_0x6903('0x10')]);router[_0x6903('0x11')](_0x6903('0x8'),auth[_0x6903('0x7')](),controller[_0x6903('0x12')]);router[_0x6903('0x13')](_0x6903('0x8'),auth['isAuthenticated'](),controller[_0x6903('0x14')]);module[_0x6903('0x15')]=router; \ No newline at end of file +var _0xbd51=['create','/:id','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','post'];(function(_0x1b2058,_0x29a3e9){var _0x52e1bf=function(_0xfccdb5){while(--_0xfccdb5){_0x1b2058['push'](_0x1b2058['shift']());}};_0x52e1bf(++_0x29a3e9);}(_0xbd51,0x89));var _0x1bd5=function(_0x2869ed,_0x547407){_0x2869ed=_0x2869ed-0x0;var _0xc061d5=_0xbd51[_0x2869ed];return _0xc061d5;};'use strict';var multer=require('multer');var util=require(_0x1bd5('0x0'));var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require('express');var router=express[_0x1bd5('0x3')]();var fs_extra=require(_0x1bd5('0x4'));var auth=require(_0x1bd5('0x5'));var interaction=require(_0x1bd5('0x6'));var config=require(_0x1bd5('0x7'));var controller=require(_0x1bd5('0x8'));router[_0x1bd5('0x9')]('/',auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xb')]);router[_0x1bd5('0x9')]('/:id',auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0x9')](_0x1bd5('0xd'),auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xe')]);router[_0x1bd5('0x9')](_0x1bd5('0xf'),auth[_0x1bd5('0xa')](),controller['run']);router[_0x1bd5('0x9')]('/:id/query',auth[_0x1bd5('0xa')](),controller['query']);router[_0x1bd5('0x10')]('/',auth[_0x1bd5('0xa')](),controller[_0x1bd5('0x11')]);router['put'](_0x1bd5('0x12'),auth[_0x1bd5('0xa')](),controller[_0x1bd5('0x13')]);router[_0x1bd5('0x14')](_0x1bd5('0x12'),auth[_0x1bd5('0xa')](),controller['destroy']);module[_0x1bd5('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index aed0213..d3d9a0c 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 _0x5d58=['TEXT','STRING'];(function(_0xdb8a50,_0x5c5a10){var _0x145296=function(_0x507357){while(--_0x507357){_0xdb8a50['push'](_0xdb8a50['shift']());}};_0x145296(++_0x5c5a10);}(_0x5d58,0x187));var _0x85d5=function(_0x2c5f95,_0x1bd928){_0x2c5f95=_0x2c5f95-0x0;var _0x2931da=_0x5d58[_0x2c5f95];return _0x2931da;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x85d5('0x0')]},'conditions':{'type':Sequelize[_0x85d5('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf494=['STRING','TEXT','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf494,0x1c6));var _0x4f49=function(_0x2386f2,_0x44a57b){_0x2386f2=_0x2386f2-0x0;var _0x587a2a=_0xf494[_0x2386f2];return _0x587a2a;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4f49('0x2')]},'table':{'type':Sequelize[_0x4f49('0x2')]},'conditions':{'type':Sequelize[_0x4f49('0x3')]},'joins':{'type':Sequelize[_0x4f49('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index bdfb3da..6d46c08 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x441fae,_0x3ab2ee){var _0x189025=function(_0x4914e1){while(--_0x4914e1){_0x441fae['push'](_0x441fae['shift']());}};_0x189025(++_0x3ab2ee);}(_0xba34,0x119));var _0x4ba3=function(_0x35987d,_0x3634ee){_0x35987d=_0x35987d-0x0;var _0x274b86=_0xba34[_0x35987d];return _0x274b86;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file +var _0x3f8a=['get','DefaultReports','end','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','keys','intersection','model','attributes','fields','query','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','condition','ValidationErrorItem','metric','DESC','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','QueryTypes','run','runReport','%s.%s\x20=\x20%s.%s','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then'];(function(_0x41320f,_0x28a6fa){var _0x555dc7=function(_0x22de94){while(--_0x22de94){_0x41320f['push'](_0x41320f['shift']());}};_0x555dc7(++_0x28a6fa);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x5e0251,_0x3da697){_0x5e0251=_0x5e0251-0x0;var _0x30f995=_0x3f8a[_0x5e0251];return _0x30f995;};'use strict';var emlformat=require(_0xa3f8('0x0'));var rimraf=require(_0xa3f8('0x1'));var zipdir=require(_0xa3f8('0x2'));var jsonpatch=require(_0xa3f8('0x3'));var rp=require('request-promise');var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var Mustache=require(_0xa3f8('0x6'));var util=require(_0xa3f8('0x7'));var path=require(_0xa3f8('0x8'));var sox=require(_0xa3f8('0x9'));var csv=require(_0xa3f8('0xa'));var ejs=require(_0xa3f8('0xb'));var fs=require('fs');var fs_extra=require(_0xa3f8('0xc'));var _=require(_0xa3f8('0xd'));var squel=require(_0xa3f8('0xe'));var crypto=require(_0xa3f8('0xf'));var jsforce=require(_0xa3f8('0x10'));var deskjs=require(_0xa3f8('0x11'));var toCsv=require(_0xa3f8('0xa'));var querystring=require(_0xa3f8('0x12'));var Papa=require(_0xa3f8('0x13'));var Redis=require('ioredis');var authService=require(_0xa3f8('0x14'));var qs=require(_0xa3f8('0x15'));var as=require(_0xa3f8('0x16'));var hardwareService=require(_0xa3f8('0x17'));var logger=require('../../config/logger')(_0xa3f8('0x18'));var utils=require(_0xa3f8('0x19'));var config=require(_0xa3f8('0x1a'));var licenseUtil=require(_0xa3f8('0x1b'));var db=require(_0xa3f8('0x1c'))['db'];var dbH=require(_0xa3f8('0x1c'))[_0xa3f8('0x1d')];function respondWithStatusCode(_0x63de8b,_0x324aa8){_0x324aa8=_0x324aa8||0xcc;return function(_0x36b1b8){if(_0x36b1b8){return _0x63de8b[_0xa3f8('0x1e')](_0x324aa8);}return _0x63de8b[_0xa3f8('0x1f')](_0x324aa8)['end']();};}function respondWithResult(_0x2d8f74,_0xe55848){_0xe55848=_0xe55848||0xc8;return function(_0x45014f){if(_0x45014f){return _0x2d8f74[_0xa3f8('0x1f')](_0xe55848)['json'](_0x45014f);}};}function respondWithFilteredResult(_0x39c450,_0x33b98e){return function(_0x46a8d9){if(_0x46a8d9){var _0x8cd130=typeof _0x33b98e[_0xa3f8('0x20')]===_0xa3f8('0x21')&&typeof _0x33b98e[_0xa3f8('0x22')]===_0xa3f8('0x21');var _0x2cb49f=_0x46a8d9[_0xa3f8('0x23')];var _0x54b870=_0x8cd130?0x0:_0x33b98e[_0xa3f8('0x20')];var _0x5a0e18=_0x8cd130?_0x46a8d9[_0xa3f8('0x23')]:_0x33b98e[_0xa3f8('0x20')]+_0x33b98e[_0xa3f8('0x22')];var _0x46042d;if(_0x5a0e18>=_0x2cb49f){_0x5a0e18=_0x2cb49f;_0x46042d=0xc8;}else{_0x46042d=0xce;}_0x39c450['status'](_0x46042d);return _0x39c450[_0xa3f8('0x24')]('Content-Range',_0x54b870+'-'+_0x5a0e18+'/'+_0x2cb49f)[_0xa3f8('0x25')](_0x46a8d9);}return null;};}function patchUpdates(_0x58336d){return function(_0x4066bb){try{jsonpatch[_0xa3f8('0x26')](_0x4066bb,_0x58336d,!![]);}catch(_0x353daa){return BPromise[_0xa3f8('0x27')](_0x353daa);}return _0x4066bb[_0xa3f8('0x28')]();};}function saveUpdates(_0x1e5f30,_0x187352){return function(_0x490717){if(_0x490717){return _0x490717[_0xa3f8('0x29')](_0x1e5f30)['then'](function(_0x3ce57b){return _0x3ce57b;});}return null;};}function removeEntity(_0xa5a697,_0x24985a){return function(_0x37b290){if(_0x37b290){return _0x37b290[_0xa3f8('0x2a')]()[_0xa3f8('0x2b')](function(){var _0x6e3cb4=_0x37b290[_0xa3f8('0x2c')]({'plain':!![]});var _0x1e22b8=_0xa3f8('0x2d');return db['UserProfileResource'][_0xa3f8('0x2a')]({'where':{'type':_0x1e22b8,'resourceId':_0x6e3cb4['id']}})[_0xa3f8('0x2b')](function(){return _0x37b290;});})[_0xa3f8('0x2b')](function(){_0xa5a697['status'](0xcc)[_0xa3f8('0x2e')]();});}};}function handleEntityNotFound(_0x57f6be,_0xbad6a6){return function(_0x3a3746){if(!_0x3a3746){_0x57f6be[_0xa3f8('0x1e')](0x194);}return _0x3a3746;};}function handleError(_0x4ea213,_0x458824){_0x458824=_0x458824||0x1f4;return function(_0x5e69e2){logger[_0xa3f8('0x2f')](_0x5e69e2[_0xa3f8('0x30')]);if(_0x5e69e2[_0xa3f8('0x31')]){delete _0x5e69e2[_0xa3f8('0x31')];}_0x4ea213[_0xa3f8('0x1f')](_0x458824)[_0xa3f8('0x32')](_0x5e69e2);};}exports[_0xa3f8('0x33')]=function(_0x424a3e,_0x25f9f5){var _0x290a4e={},_0x6e83b0={},_0x57c465={'count':0x0,'rows':[]};var _0x4404da=_[_0xa3f8('0x34')](db[_0xa3f8('0x35')][_0xa3f8('0x36')],function(_0x3bb4b0){return{'name':_0x3bb4b0['fieldName'],'type':_0x3bb4b0[_0xa3f8('0x37')][_0xa3f8('0x38')]};});_0x6e83b0['model']=_[_0xa3f8('0x34')](_0x4404da,_0xa3f8('0x31'));_0x6e83b0['query']=_[_0xa3f8('0x39')](_0x424a3e['query']);_0x6e83b0['filters']=_[_0xa3f8('0x3a')](_0x6e83b0[_0xa3f8('0x3b')],_0x6e83b0['query']);_0x290a4e[_0xa3f8('0x3c')]=_['intersection'](_0x6e83b0[_0xa3f8('0x3b')],qs[_0xa3f8('0x3d')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x290a4e['attributes']=_0x290a4e[_0xa3f8('0x3c')]['length']?_0x290a4e[_0xa3f8('0x3c')]:_0x6e83b0['model'];if(!_0x424a3e[_0xa3f8('0x3e')]['hasOwnProperty']('nolimit')){_0x290a4e['limit']=qs[_0xa3f8('0x22')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x22')]);_0x290a4e[_0xa3f8('0x20')]=qs['offset'](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x20')]);}_0x290a4e[_0xa3f8('0x3f')]=qs[_0xa3f8('0x40')](_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x40')]);_0x290a4e['where']=qs[_0xa3f8('0x41')](_[_0xa3f8('0x42')](_0x424a3e[_0xa3f8('0x3e')],_0x6e83b0['filters']),_0x4404da);if(_0x424a3e[_0xa3f8('0x3e')][_0xa3f8('0x43')]){_0x290a4e['where']=_[_0xa3f8('0x44')](_0x290a4e['where'],{'$or':_[_0xa3f8('0x34')](_0x4404da,function(_0x5a077c){if(_0x5a077c[_0xa3f8('0x37')]!==_0xa3f8('0x45')){var _0x9a00e7={};_0x9a00e7[_0x5a077c[_0xa3f8('0x31')]]={'$like':'%'+_0x424a3e[_0xa3f8('0x3e')]['filter']+'%'};return _0x9a00e7;}})});}_0x290a4e=_[_0xa3f8('0x44')]({},_0x290a4e,_0x424a3e[_0xa3f8('0x46')]);var _0x4db9c5={'where':_0x290a4e[_0xa3f8('0x47')]};return db['AnalyticDefaultReport'][_0xa3f8('0x23')](_0x4db9c5)[_0xa3f8('0x2b')](function(_0x1542cc){_0x57c465[_0xa3f8('0x23')]=_0x1542cc;if(_0x424a3e[_0xa3f8('0x3e')]['includeAll']){_0x290a4e[_0xa3f8('0x48')]=[{'all':!![]}];}return db[_0xa3f8('0x35')][_0xa3f8('0x49')](_0x290a4e);})[_0xa3f8('0x2b')](function(_0x337808){_0x57c465['rows']=_0x337808;return _0x57c465;})[_0xa3f8('0x2b')](respondWithFilteredResult(_0x25f9f5,_0x290a4e))[_0xa3f8('0x4a')](handleError(_0x25f9f5,null));};exports[_0xa3f8('0x4b')]=function(_0x32e371,_0x2a124b){var _0x314dba={'raw':!![],'where':{'id':_0x32e371[_0xa3f8('0x4c')]['id']}},_0x497217={};_0x497217[_0xa3f8('0x3b')]=_[_0xa3f8('0x39')](db[_0xa3f8('0x35')][_0xa3f8('0x36')]);_0x497217[_0xa3f8('0x3e')]=_['keys'](_0x32e371['query']);_0x497217['filters']=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],_0x497217[_0xa3f8('0x3e')]);_0x314dba[_0xa3f8('0x3c')]=_[_0xa3f8('0x3a')](_0x497217[_0xa3f8('0x3b')],qs['fields'](_0x32e371[_0xa3f8('0x3e')][_0xa3f8('0x3d')]));_0x314dba[_0xa3f8('0x3c')]=_0x314dba[_0xa3f8('0x3c')]['length']?_0x314dba[_0xa3f8('0x3c')]:_0x497217[_0xa3f8('0x3b')];if(_0x32e371[_0xa3f8('0x3e')]['includeAll']){_0x314dba['include']=[{'all':!![]}];}_0x314dba=_['merge']({},_0x314dba,_0x32e371[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')]['find'](_0x314dba)[_0xa3f8('0x2b')](handleEntityNotFound(_0x2a124b,null))[_0xa3f8('0x2b')](respondWithResult(_0x2a124b,null))[_0xa3f8('0x4a')](handleError(_0x2a124b,null));};exports[_0xa3f8('0x4d')]=function(_0x14932f,_0x3c74b5){return db[_0xa3f8('0x35')][_0xa3f8('0x4d')](_0x14932f[_0xa3f8('0x4e')],{})[_0xa3f8('0x2b')](function(_0x338554){var _0x29d8f5=_0x14932f[_0xa3f8('0x4f')][_0xa3f8('0x2c')]({'plain':!![]});if(!_0x29d8f5)throw new Error(_0xa3f8('0x50'));if(_0x29d8f5[_0xa3f8('0x51')]===_0xa3f8('0x4f')){var _0x559ae7=_0x338554['get']({'plain':!![]});var _0x1fad80=_0xa3f8('0x52');return db['UserProfileSection'][_0xa3f8('0x53')]({'where':{'name':_0x1fad80,'userProfileId':_0x29d8f5[_0xa3f8('0x54')]},'raw':!![]})[_0xa3f8('0x2b')](function(_0xaff79b){if(_0xaff79b&&_0xaff79b[_0xa3f8('0x55')]===0x0){return db[_0xa3f8('0x56')][_0xa3f8('0x4d')]({'name':_0x559ae7[_0xa3f8('0x31')],'resourceId':_0x559ae7['id'],'type':_0xa3f8('0x2d'),'sectionId':_0xaff79b['id']},{})[_0xa3f8('0x2b')](function(){return _0x338554;});}else{return _0x338554;}})[_0xa3f8('0x4a')](function(_0x3752fa){logger[_0xa3f8('0x2f')](_0xa3f8('0x57'),_0x3752fa);throw _0x3752fa;});}return _0x338554;})[_0xa3f8('0x2b')](respondWithResult(_0x3c74b5,0xc9))[_0xa3f8('0x4a')](handleError(_0x3c74b5,null));};exports['update']=function(_0x593614,_0xd0628e){if(_0x593614['body']['id']){delete _0x593614[_0xa3f8('0x4e')]['id'];}return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x593614['params']['id']}})[_0xa3f8('0x2b')](handleEntityNotFound(_0xd0628e,null))[_0xa3f8('0x2b')](saveUpdates(_0x593614[_0xa3f8('0x4e')],null))[_0xa3f8('0x2b')](respondWithResult(_0xd0628e,null))['catch'](handleError(_0xd0628e,null));};exports[_0xa3f8('0x2a')]=function(_0x47cc0c,_0x392e1e){return db[_0xa3f8('0x35')][_0xa3f8('0x53')]({'where':{'id':_0x47cc0c['params']['id']}})['then'](handleEntityNotFound(_0x392e1e,null))[_0xa3f8('0x2b')](removeEntity(_0x392e1e,null))[_0xa3f8('0x4a')](handleError(_0x392e1e,null));};exports[_0xa3f8('0x58')]=function(_0x6ad40a,_0x48f5a6){var _0x36eac9=0xa;var _0x3478e8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x5d7877={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x521719={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x27de61=function(_0x356643){return!_[_0xa3f8('0x68')](['IS\x20NULL',_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x356643);};var _0x42e3f8=function(_0x27c5aa){if(!_0x27c5aa||!_0x27c5aa[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x4d0404='(',_0x33ea06=0x0;_0x33ea06<_0x27c5aa[_0xa3f8('0x6c')]['length'];_0x33ea06+=0x1){_0x33ea06>0x0&&(_0x4d0404+='\x20'+_0x27c5aa[_0xa3f8('0x6e')]+'\x20');_0x4d0404+=_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]?_0x42e3f8(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x6f')]):_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x70')]+'\x20'+_0x27c5aa['rules'][_0x33ea06]['condition']+(_0x27de61(_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06]['condition'])?'\x20'+_0x27c5aa[_0xa3f8('0x6c')][_0x33ea06][_0xa3f8('0x71')]:'');}return _0x4d0404+')';};var _0x3ff369={'where':{'id':_0x6ad40a[_0xa3f8('0x4c')]['id']}},_0x1dba7e,_0x452e99,_0x35d4d6,_0xeca2dc,_0x14508d;_0x3ff369=_[_0xa3f8('0x44')]({},_0x3ff369,_0x6ad40a[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x3ff369)['then'](function(_0x5efdcf){if(_0x5efdcf){_0x1dba7e=_0x5efdcf;return _0x5efdcf[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x1688ca){if(_0x1688ca){if(!_0x1688ca[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))]['ValidationErrorItem'](_0xa3f8('0x74'),0x193);}_0x452e99=_0x1688ca;return db[_0xa3f8('0x75')][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x28d359){if(_0x28d359){_0x35d4d6=_[_0xa3f8('0x76')](_0x28d359,'id');var _0x3d45ae;var _0x3a2362=squel[_0xa3f8('0x77')]();_0x3a2362[_0xa3f8('0x78')](_0x1dba7e[_0xa3f8('0x79')]);for(var _0x5d4fe5=0x0;_0x5d4fe5<_0x452e99[_0xa3f8('0x6d')];_0x5d4fe5+=0x1){_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7a')]?_0x35d4d6[_0x452e99[_0x5d4fe5]['MetricId']]['metric']:_0x452e99[_0x5d4fe5][_0xa3f8('0x70')];_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x5d7877[_0x452e99[_0x5d4fe5][_0xa3f8('0x7b')]],'%s',_0x3d45ae):_0x3d45ae;_0x3d45ae=_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x521719[_0x452e99[_0x5d4fe5][_0xa3f8('0x7d')]],'%s',_0x3d45ae):_0x3d45ae;if(_0x452e99[_0x5d4fe5][_0xa3f8('0x7e')]){_0x3a2362['group'](_0x3d45ae);}_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]&&_0x3a2362[_0xa3f8('0x3f')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3a2362[_0xa3f8('0x70')](_0x3d45ae,_0x452e99[_0x5d4fe5][_0xa3f8('0x80')]||_0x3d45ae);}if(_0x1dba7e['joins']){_0x1dba7e[_0xa3f8('0x81')]=JSON[_0xa3f8('0x82')](_0x1dba7e[_0xa3f8('0x81')]);for(var _0x14a5b5=0x0;_0x14a5b5<_0x1dba7e[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x14a5b5+=0x1){if(_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x3478e8,_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x37')])&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x83')]&&_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')]&&_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x85')]){_0x3a2362[_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x37')]](_0x1dba7e['joins'][_0x14a5b5][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')]('%s.%s\x20=\x20%s.%s',_0x1dba7e[_0xa3f8('0x79')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x83')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5][_0xa3f8('0x84')],_0x1dba7e[_0xa3f8('0x81')][_0x14a5b5]['foreignKey']));}}}if(_0x1dba7e[_0xa3f8('0x86')]){_0x1dba7e[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1dba7e['conditions']);_0x3a2362[_0xa3f8('0x47')](_0x42e3f8(_0x1dba7e['conditions'][_0xa3f8('0x6f')]));}_0x14508d=_0x3a2362['clone']();_0x3a2362['limit'](_0x36eac9);_0x3a2362[_0xa3f8('0x20')](0x0);logger['debug'](_0xa3f8('0x87'),_0x3a2362['toString']());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3a2362[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](respondWithResult(_0x48f5a6,null))['catch'](handleError(_0x48f5a6,null));};function runReport(_0x3187e0,_0xd0d568,_0x3715ea){var _0x345089=_0xd0d568[_0xa3f8('0x31')];var _0x20ae51=0xa;var _0x190ce8=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x7dc5ec={'SUM':_0xa3f8('0x5c'),'COUNT':_0xa3f8('0x5d'),'COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2e2d99={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x599484=function(_0x24fe62){return!_[_0xa3f8('0x68')]([_0xa3f8('0x8c'),_0xa3f8('0x69'),'IS\x20EMPTY',_0xa3f8('0x6b')],_0x24fe62);};var _0x427830=function(_0x3c5091){if(!_0x3c5091||!_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')]){return'';}for(var _0x2db7dd='(',_0x12fe03=0x0;_0x12fe03<_0x3c5091[_0xa3f8('0x6c')][_0xa3f8('0x6d')];_0x12fe03+=0x1){_0x12fe03>0x0&&(_0x2db7dd+='\x20'+_0x3c5091[_0xa3f8('0x6e')]+'\x20');_0x2db7dd+=_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']?_0x427830(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03]['group']):_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x70')]+'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')]+(_0x599484(_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x8d')])?'\x20'+_0x3c5091[_0xa3f8('0x6c')][_0x12fe03][_0xa3f8('0x71')]:'');}return _0x2db7dd+')';};var _0x4bb7dd={'where':{'id':_0x3187e0['id']}},_0x2c6efe,_0x4f9513,_0x39bd5c,_0x52fcc3,_0x2d2883;_0x4bb7dd=_['merge']({},_0x4bb7dd,_0x3715ea);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x4bb7dd)[_0xa3f8('0x2b')](function(_0xe3cc6a){if(_0xe3cc6a){_0x2c6efe=_0xe3cc6a;return _0xe3cc6a['getFields']();}return null;})[_0xa3f8('0x2b')](function(_0x3d343f){if(_0x3d343f){if(!_0x3d343f[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f9513=_0x3d343f;return db['AnalyticMetric'][_0xa3f8('0x49')]({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0xbe1a54){if(_0xbe1a54){_0x39bd5c=_[_0xa3f8('0x76')](_0xbe1a54,'id');var _0x477b0a;var _0x565a10=squel[_0xa3f8('0x77')]();_0x565a10[_0xa3f8('0x78')](_0x2c6efe['table']);for(var _0x4494a5=0x0;_0x4494a5<_0x4f9513[_0xa3f8('0x6d')];_0x4494a5+=0x1){_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7a')]?_0x39bd5c[_0x4f9513[_0x4494a5]['MetricId']][_0xa3f8('0x8f')]:_0x4f9513[_0x4494a5][_0xa3f8('0x70')];_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]?_[_0xa3f8('0x7c')](_0x7dc5ec[_0x4f9513[_0x4494a5][_0xa3f8('0x7b')]],'%s',_0x477b0a):_0x477b0a;_0x477b0a=_0x4f9513[_0x4494a5][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x2e2d99[_0x4f9513[_0x4494a5]['format']],'%s',_0x477b0a):_0x477b0a;if(_0x4f9513[_0x4494a5][_0xa3f8('0x7e')]){_0x565a10[_0xa3f8('0x6f')](_0x477b0a);}_0x4f9513[_0x4494a5]['orderBy']&&_0x565a10[_0xa3f8('0x3f')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x7f')]===_0xa3f8('0x90')?![]:!![]);_0x565a10[_0xa3f8('0x70')](_0x477b0a,_0x4f9513[_0x4494a5][_0xa3f8('0x80')]||_0x477b0a);}if(_0x2c6efe[_0xa3f8('0x81')]){_0x2c6efe[_0xa3f8('0x81')]=JSON['parse'](_0x2c6efe[_0xa3f8('0x81')]);for(var _0x151bab=0x0;_0x151bab<_0x2c6efe[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x151bab+=0x1){if(_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x190ce8,_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')])&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')]&&_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable']&&_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x85')]){_0x565a10[_0x2c6efe['joins'][_0x151bab][_0xa3f8('0x37')]](_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x84')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2c6efe[_0xa3f8('0x79')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab][_0xa3f8('0x83')],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignTable'],_0x2c6efe[_0xa3f8('0x81')][_0x151bab]['foreignKey']));}}}if(_0x2c6efe[_0xa3f8('0x86')]){_0x2c6efe[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x2c6efe['conditions']);_0x565a10['where'](_0x427830(_0x2c6efe['conditions'][_0xa3f8('0x6f')]));}_0x2d2883=_0x565a10[_0xa3f8('0x91')]();_0x565a10[_0xa3f8('0x22')](_0x20ae51);_0x565a10[_0xa3f8('0x20')](0x0);return;}})[_0xa3f8('0x2b')](function(){if(_0xd0d568[_0xa3f8('0x92')]===_0xa3f8('0x93')){return null;}var _0x18890e=_['merge'](_0xd0d568,{'name':_0xd0d568[_0xa3f8('0x94')]||_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe[_0xa3f8('0x31')],'basename':_0x345089,'savename':util['format'](_0xa3f8('0x95'),_0xd0d568[_0xa3f8('0x31')]||_0x2c6efe['name'],require(_0xa3f8('0x96'))[_0xa3f8('0x97')](0x4),_0xd0d568['output']||_0xa3f8('0x98')),'reportId':_0x2c6efe['id'],'reportType':_0xa3f8('0x99')});return db['AnalyticExtractedReport'][_0xa3f8('0x4d')](_0x18890e,{'raw':!![]});})[_0xa3f8('0x2b')](function(_0x21cc1d){if(_0x2c6efe['table']===_0xa3f8('0x9a')){_0x2d2883[_0xa3f8('0x47')](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9b'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568['endDate']);}else{_0x2d2883['where'](_0x2c6efe[_0xa3f8('0x79')]+_0xa3f8('0x9d'),_0xd0d568[_0xa3f8('0x9c')],_0xd0d568[_0xa3f8('0x9e')]);}if(_0x21cc1d){logger['info'](_0xa3f8('0x9f'),_0x2d2883[_0xa3f8('0x89')]());require(_0xa3f8('0xa0'))[_0xa3f8('0xa1')](path[_0xa3f8('0x59')](__dirname,_0xa3f8('0xa2'),_0x21cc1d[_0xa3f8('0x92')]),[_0x21cc1d['id'],_0x2d2883[_0xa3f8('0x89')](),path['join'](__dirname,_0xa3f8('0xa3'),_0x21cc1d['savename']),_0x345089]);return _0x21cc1d;}else{var _0xe9842=squel['select']();_0xe9842['from']('('+_0x2d2883[_0xa3f8('0x89')]()+')',_0xa3f8('0xa4'));_0xe9842[_0xa3f8('0x70')](_0xa3f8('0xa5'),_0xa3f8('0x23'));_0x2d2883['limit'](_0xd0d568['limit']||_0x20ae51);_0x2d2883[_0xa3f8('0x20')](_0xd0d568[_0xa3f8('0x20')]||0x0);return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0xe9842[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')]['QueryTypes'][_0xa3f8('0x8a')]})[_0xa3f8('0x2b')](function(_0x5a4f4a){if(!_0x5a4f4a['length']){_0x52fcc3=0x0;}else{_0x52fcc3=_0x5a4f4a[0x0][_0xa3f8('0x23')]||0x0;}return dbH[_0xa3f8('0x88')]['query'](_0x2d2883[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});})[_0xa3f8('0x2b')](function(_0x52f592){return{'rows':_0x52f592||[],'count':_0x52fcc3};});}});}exports[_0xa3f8('0xa7')]=function(_0x59026b,_0x234636){return runReport(_0x59026b[_0xa3f8('0x4c')],_0x59026b['query'],_0x59026b['options'])[_0xa3f8('0x2b')](respondWithResult(_0x234636,null))[_0xa3f8('0x4a')](handleError(_0x234636,null));};exports[_0xa3f8('0xa8')]=runReport;exports[_0xa3f8('0x3e')]=function(_0x26ec07,_0x2c9db8){var _0x18ab67=0xa;var _0x1f21a2=[_0xa3f8('0x59'),_0xa3f8('0x5a'),_0xa3f8('0x5b'),'cross_join'];var _0x15a11c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xa3f8('0x5e'),'MAX':_0xa3f8('0x5f'),'MIN':_0xa3f8('0x60'),'AVG':_0xa3f8('0x61'),'GROUP_CONCAT':_0xa3f8('0x62'),'GROUP_CONCAT ASC':_0xa3f8('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x481b70={'SEC_TO_TIME':_0xa3f8('0x63'),'DATE':_0xa3f8('0x64'),'HOUR':_0xa3f8('0x65'),'ROUND':_0xa3f8('0x66'),'UNIX_TIMESTAMP':_0xa3f8('0x67')};var _0x1f776a=function(_0x5b1527){return!_['includes']([_0xa3f8('0x8c'),_0xa3f8('0x69'),_0xa3f8('0x6a'),_0xa3f8('0x6b')],_0x5b1527);};var _0x4670cc=function(_0xfde509){if(!_0xfde509||!_0xfde509['rules']['length']){return'';}for(var _0x3d81fe='(',_0x15111a=0x0;_0x15111a<_0xfde509[_0xa3f8('0x6c')]['length'];_0x15111a+=0x1){_0x15111a>0x0&&(_0x3d81fe+='\x20'+_0xfde509[_0xa3f8('0x6e')]+'\x20');_0x3d81fe+=_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']?_0x4670cc(_0xfde509[_0xa3f8('0x6c')][_0x15111a]['group']):_0xfde509[_0xa3f8('0x6c')][_0x15111a]['field']+'\x20'+_0xfde509['rules'][_0x15111a][_0xa3f8('0x8d')]+(_0x1f776a(_0xfde509[_0xa3f8('0x6c')][_0x15111a][_0xa3f8('0x8d')])?'\x20'+_0xfde509[_0xa3f8('0x6c')][_0x15111a]['value']:'');}return _0x3d81fe+')';};var _0x2e694e={'where':{'id':_0x26ec07[_0xa3f8('0x4c')]['id']}},_0x1669be,_0x4f248f,_0x6ef1ad,_0xae3a31,_0x31d45c;_0x2e694e=_[_0xa3f8('0x44')]({},_0x2e694e,_0x26ec07[_0xa3f8('0x46')]);return db[_0xa3f8('0x35')][_0xa3f8('0x53')](_0x2e694e)[_0xa3f8('0x2b')](function(_0x529021){if(_0x529021){_0x1669be=_0x529021;return _0x529021[_0xa3f8('0x72')]();}return null;})[_0xa3f8('0x2b')](function(_0x35c498){if(_0x35c498){if(!_0x35c498[_0xa3f8('0x6d')]){throw new db[(_0xa3f8('0x73'))][(_0xa3f8('0x8e'))](_0xa3f8('0x74'),0x193);}_0x4f248f=_0x35c498;return db[_0xa3f8('0x75')]['findAll']({'raw':!![]});}return null;})[_0xa3f8('0x2b')](function(_0x286490){if(_0x286490){_0x6ef1ad=_['keyBy'](_0x286490,'id');var _0x16e98d;var _0x3be5c9=squel['select']();_0x3be5c9[_0xa3f8('0x78')](_0x1669be[_0xa3f8('0x79')]);for(var _0x5260e0=0x0;_0x5260e0<_0x4f248f[_0xa3f8('0x6d')];_0x5260e0+=0x1){_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7a')]?_0x6ef1ad[_0x4f248f[_0x5260e0]['MetricId']][_0xa3f8('0x8f')]:_0x4f248f[_0x5260e0][_0xa3f8('0x70')];_0x16e98d=_0x4f248f[_0x5260e0]['function']?_['replace'](_0x15a11c[_0x4f248f[_0x5260e0][_0xa3f8('0x7b')]],'%s',_0x16e98d):_0x16e98d;_0x16e98d=_0x4f248f[_0x5260e0][_0xa3f8('0x7d')]?_[_0xa3f8('0x7c')](_0x481b70[_0x4f248f[_0x5260e0]['format']],'%s',_0x16e98d):_0x16e98d;if(_0x4f248f[_0x5260e0]['groupBy']){_0x3be5c9[_0xa3f8('0x6f')](_0x16e98d);}_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]&&_0x3be5c9['order'](_0x16e98d,_0x4f248f[_0x5260e0][_0xa3f8('0x7f')]==='DESC'?![]:!![]);_0x3be5c9[_0xa3f8('0x70')](_0x16e98d,_0x4f248f[_0x5260e0]['alias']||_0x16e98d);}if(_0x1669be[_0xa3f8('0x81')]){_0x1669be['joins']=JSON['parse'](_0x1669be[_0xa3f8('0x81')]);for(var _0x5ac693=0x0;_0x5ac693<_0x1669be[_0xa3f8('0x81')][_0xa3f8('0x6d')];_0x5ac693+=0x1){if(_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]&&_[_0xa3f8('0x68')](_0x1f21a2,_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')])&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')]&&_0x1669be['joins'][_0x5ac693][_0xa3f8('0x84')]&&_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]){_0x3be5c9[_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x37')]](_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x84')],null,util[_0xa3f8('0x7d')](_0xa3f8('0xa9'),_0x1669be[_0xa3f8('0x79')],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x83')],_0x1669be[_0xa3f8('0x81')][_0x5ac693]['foreignTable'],_0x1669be[_0xa3f8('0x81')][_0x5ac693][_0xa3f8('0x85')]));}}}if(_0x1669be[_0xa3f8('0x86')]){_0x1669be[_0xa3f8('0x86')]=JSON[_0xa3f8('0x82')](_0x1669be[_0xa3f8('0x86')]);_0x3be5c9['where'](_0x4670cc(_0x1669be[_0xa3f8('0x86')][_0xa3f8('0x6f')]));}_0x31d45c=_0x3be5c9[_0xa3f8('0x91')]();_0x3be5c9[_0xa3f8('0x22')](_0x18ab67);_0x3be5c9[_0xa3f8('0x20')](0x0);logger[_0xa3f8('0xaa')](_0xa3f8('0x87'),_0x3be5c9[_0xa3f8('0x89')]());return dbH[_0xa3f8('0x88')][_0xa3f8('0x3e')](_0x3be5c9[_0xa3f8('0x89')](),{'type':dbH[_0xa3f8('0x88')][_0xa3f8('0xa6')][_0xa3f8('0x8a')]});}})[_0xa3f8('0x2b')](function(){return{'sql':_0x31d45c[_0xa3f8('0x89')]()};})[_0xa3f8('0x2b')](respondWithResult(_0x2c9db8,null))[_0xa3f8('0x4a')](handleError(_0x2c9db8,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 2dbabfb..f4e4d90 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 _0x0803=['bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x0803,0xd4));var _0x3080=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0803[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3080('0x0'));var util=require(_0x3080('0x1'));var logger=require(_0x3080('0x2'))(_0x3080('0x3'));var moment=require('moment');var BPromise=require(_0x3080('0x4'));var rp=require(_0x3080('0x5'));var fs=require('fs');var path=require(_0x3080('0x6'));var rimraf=require('rimraf');var config=require(_0x3080('0x7'));var attributes=require(_0x3080('0x8'));module[_0x3080('0x9')]=function(_0xf39c0a,_0x348a9e){return _0xf39c0a['define'](_0x3080('0xa'),attributes,{'tableName':_0x3080('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7615=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports'];(function(_0x33dc24,_0x4de4c2){var _0x5b67d4=function(_0x24aac8){while(--_0x24aac8){_0x33dc24['push'](_0x33dc24['shift']());}};_0x5b67d4(++_0x4de4c2);}(_0x7615,0x16c));var _0x5761=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x7615[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x5761('0x0'));var util=require(_0x5761('0x1'));var logger=require(_0x5761('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5761('0x3'));var rp=require(_0x5761('0x4'));var fs=require('fs');var path=require(_0x5761('0x5'));var rimraf=require(_0x5761('0x6'));var config=require(_0x5761('0x7'));var attributes=require(_0x5761('0x8'));module[_0x5761('0x9')]=function(_0x479a32,_0x37b01f){return _0x479a32[_0x5761('0xa')](_0x5761('0xb'),attributes,{'tableName':_0x5761('0xc'),'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 bd24086..09482c7 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 _0x963c=['request\x20sent','stringify','error','message','AnalyticDefaultReport,\x20%s,\x20%s','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x2e1229,_0x41e7ef){var _0x47342a=function(_0x3dd0f8){while(--_0x3dd0f8){_0x2e1229['push'](_0x2e1229['shift']());}};_0x47342a(++_0x41e7ef);}(_0x963c,0x65));var _0xc963=function(_0x3b5a19,_0x3892be){_0x3b5a19=_0x3b5a19-0x0;var _0x29fee4=_0x963c[_0x3b5a19];return _0x29fee4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc963('0x0'));var BPromise=require(_0xc963('0x1'));var rs=require(_0xc963('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc963('0x3'))['db'];var utils=require(_0xc963('0x4'));var logger=require(_0xc963('0x5'))(_0xc963('0x6'));var config=require(_0xc963('0x7'));var jayson=require(_0xc963('0x8'));var client=jayson[_0xc963('0x9')][_0xc963('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eadd0,_0x3d8fda,_0x4e60ba){return new BPromise(function(_0x4de941,_0x2be018){return client['request'](_0x4eadd0,_0x4e60ba)[_0xc963('0xb')](function(_0x5f0c8a){logger[_0xc963('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d8fda,_0xc963('0xd'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x3d8fda,'request\x20sent',JSON[_0xc963('0xe')](_0x5f0c8a));if(_0x5f0c8a[_0xc963('0xf')]){if(_0x5f0c8a[_0xc963('0xf')]['code']===0x1f4){logger[_0xc963('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d8fda,_0x5f0c8a['error'][_0xc963('0x10')]);return _0x2be018(_0x5f0c8a[_0xc963('0xf')][_0xc963('0x10')]);}logger['error'](_0xc963('0x11'),_0x3d8fda,_0x5f0c8a['error'][_0xc963('0x10')]);return _0x4de941(_0x5f0c8a[_0xc963('0xf')]['message']);}else{logger['info'](_0xc963('0x11'),_0x3d8fda,_0xc963('0xd'));_0x4de941(_0x5f0c8a[_0xc963('0x12')][_0xc963('0x10')]);}})['catch'](function(_0xb601c){logger[_0xc963('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3d8fda,_0xb601c);_0x2be018(_0xb601c);});});} \ No newline at end of file +var _0xe556=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xe556,0xd8));var _0x6e55=function(_0x24d402,_0x2576d8){_0x24d402=_0x24d402-0x0;var _0x25e745=_0xe556[_0x24d402];return _0x25e745;};'use strict';var _=require(_0x6e55('0x0'));var util=require(_0x6e55('0x1'));var moment=require(_0x6e55('0x2'));var BPromise=require(_0x6e55('0x3'));var rs=require(_0x6e55('0x4'));var fs=require('fs');var Redis=require(_0x6e55('0x5'));var db=require(_0x6e55('0x6'))['db'];var utils=require(_0x6e55('0x7'));var logger=require(_0x6e55('0x8'))(_0x6e55('0x9'));var config=require(_0x6e55('0xa'));var jayson=require(_0x6e55('0xb'));var client=jayson['client'][_0x6e55('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4dadcc,_0x1b58b4,_0x5e598c){return new BPromise(function(_0xcdbc5a,_0x43a3d4){return client['request'](_0x4dadcc,_0x5e598c)['then'](function(_0x41013e){logger[_0x6e55('0xd')](_0x6e55('0xe'),_0x1b58b4,_0x6e55('0xf'));logger[_0x6e55('0x10')](_0x6e55('0x11'),_0x1b58b4,_0x6e55('0xf'),JSON[_0x6e55('0x12')](_0x41013e));if(_0x41013e[_0x6e55('0x13')]){if(_0x41013e[_0x6e55('0x13')][_0x6e55('0x14')]===0x1f4){logger[_0x6e55('0x13')](_0x6e55('0xe'),_0x1b58b4,_0x41013e['error']['message']);return _0x43a3d4(_0x41013e[_0x6e55('0x13')][_0x6e55('0x15')]);}logger['error'](_0x6e55('0xe'),_0x1b58b4,_0x41013e[_0x6e55('0x13')][_0x6e55('0x15')]);return _0xcdbc5a(_0x41013e['error'][_0x6e55('0x15')]);}else{logger[_0x6e55('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1b58b4,_0x6e55('0xf'));_0xcdbc5a(_0x41013e['result']['message']);}})[_0x6e55('0x16')](function(_0x21994c){logger[_0x6e55('0x13')](_0x6e55('0xe'),_0x1b58b4,_0x21994c);_0x43a3d4(_0x21994c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 0fb7632..5796d41 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 _0xa23d=['get','isAuthenticated','/:id','preview','/:id/run','run','query','create','update','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x26aa47,_0x3edb9b){var _0x471721=function(_0x4e1ebd){while(--_0x4e1ebd){_0x26aa47['push'](_0x26aa47['shift']());}};_0x471721(++_0x3edb9b);}(_0xa23d,0x119));var _0xda23=function(_0x3cb03c,_0x396ff0){_0x3cb03c=_0x3cb03c-0x0;var _0x1c533d=_0xa23d[_0x3cb03c];return _0x1c533d;};'use strict';var multer=require('multer');var util=require(_0xda23('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xda23('0x1'));var router=express[_0xda23('0x2')]();var fs_extra=require(_0xda23('0x3'));var auth=require(_0xda23('0x4'));var interaction=require(_0xda23('0x5'));var config=require(_0xda23('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0xda23('0x7')]('/',auth[_0xda23('0x8')](),controller['index']);router[_0xda23('0x7')](_0xda23('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xda23('0x7')]('/:id/preview',auth[_0xda23('0x8')](),controller[_0xda23('0xa')]);router[_0xda23('0x7')](_0xda23('0xb'),auth['isAuthenticated'](),controller[_0xda23('0xc')]);router['get']('/:id/query',auth[_0xda23('0x8')](),controller[_0xda23('0xd')]);router['post']('/',auth[_0xda23('0x8')](),controller[_0xda23('0xe')]);router['put'](_0xda23('0x9'),auth['isAuthenticated'](),controller[_0xda23('0xf')]);router['delete'](_0xda23('0x9'),auth[_0xda23('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc727=['put','delete','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','get','/:id','preview','/:id/run','run','/:id/query','query','post','create'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0xc727,0x1e5));var _0x7c72=function(_0x5c9f98,_0x581815){_0x5c9f98=_0x5c9f98-0x0;var _0x1e56a1=_0xc727[_0x5c9f98];return _0x1e56a1;};'use strict';var multer=require(_0x7c72('0x0'));var util=require(_0x7c72('0x1'));var path=require(_0x7c72('0x2'));var timeout=require('connect-timeout');var express=require(_0x7c72('0x3'));var router=express[_0x7c72('0x4')]();var fs_extra=require(_0x7c72('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7c72('0x6'));var config=require(_0x7c72('0x7'));var controller=require(_0x7c72('0x8'));router['get']('/',auth[_0x7c72('0x9')](),controller['index']);router[_0x7c72('0xa')](_0x7c72('0xb'),auth[_0x7c72('0x9')](),controller['show']);router[_0x7c72('0xa')]('/:id/preview',auth[_0x7c72('0x9')](),controller[_0x7c72('0xc')]);router[_0x7c72('0xa')](_0x7c72('0xd'),auth[_0x7c72('0x9')](),controller[_0x7c72('0xe')]);router[_0x7c72('0xa')](_0x7c72('0xf'),auth[_0x7c72('0x9')](),controller[_0x7c72('0x10')]);router[_0x7c72('0x11')]('/',auth['isAuthenticated'](),controller[_0x7c72('0x12')]);router[_0x7c72('0x13')](_0x7c72('0xb'),auth[_0x7c72('0x9')](),controller['update']);router[_0x7c72('0x14')](_0x7c72('0xb'),auth[_0x7c72('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 6fcccb2..e8bb80e 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 _0xc75e=['DATE','Loading','ENUM','manual','scheduled','INTEGER','UNSIGNED','sequelize','exports','STRING','pdf'];(function(_0x4b14e4,_0x23593b){var _0xcb77b0=function(_0x256808){while(--_0x256808){_0x4b14e4['push'](_0x4b14e4['shift']());}};_0xcb77b0(++_0x23593b);}(_0xc75e,0x167));var _0xec75=function(_0x787d70,_0x2d6602){_0x787d70=_0x787d70-0x0;var _0x326b32=_0xc75e[_0x787d70];return _0x326b32;};'use strict';var Sequelize=require(_0xec75('0x0'));var moment=require('moment');module[_0xec75('0x1')]={'name':{'type':Sequelize[_0xec75('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0xec75('0x3'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xec75('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xec75('0x4')]},'endDate':{'type':Sequelize[_0xec75('0x4')]},'status':{'type':Sequelize[_0xec75('0x2')],'defaultValue':_0xec75('0x5')},'type':{'type':Sequelize[_0xec75('0x6')](_0xec75('0x7'),_0xec75('0x8')),'allowNull':![],'defaultValue':_0xec75('0x7')},'reportId':{'type':Sequelize[_0xec75('0x9')](0xb)[_0xec75('0xa')]},'reportType':{'type':Sequelize[_0xec75('0x2')]}}; \ No newline at end of file +var _0xdb84=['exports','STRING','csv','xlsx','DATE','ENUM','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment'];(function(_0x15f22f,_0x4f44a5){var _0x35bc1b=function(_0x26a312){while(--_0x26a312){_0x15f22f['push'](_0x15f22f['shift']());}};_0x35bc1b(++_0x4f44a5);}(_0xdb84,0x76));var _0x4db8=function(_0x5adf77,_0x805933){_0x5adf77=_0x5adf77-0x0;var _0x48b099=_0xdb84[_0x5adf77];return _0x48b099;};'use strict';var Sequelize=require(_0x4db8('0x0'));var moment=require(_0x4db8('0x1'));module[_0x4db8('0x2')]={'name':{'type':Sequelize[_0x4db8('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x4db8('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x4db8('0x4'),'pdf',_0x4db8('0x5')),'allowNull':![],'defaultValue':_0x4db8('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x4db8('0x6')]},'endDate':{'type':Sequelize[_0x4db8('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x4db8('0x7')](_0x4db8('0x8'),_0x4db8('0x9')),'allowNull':![],'defaultValue':_0x4db8('0x8')},'reportId':{'type':Sequelize[_0x4db8('0xa')](0xb)[_0x4db8('0xb')]},'reportType':{'type':Sequelize[_0x4db8('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index f1a2dd4..8ac92d2 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 _0xe286=['request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','ExtractedReports','UserProfileResource','then','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','findAll','catch','params','rawAttributes','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','download','output','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','savename','format','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir'];(function(_0x3aa859,_0x439f05){var _0x51ac7c=function(_0x1be030){while(--_0x1be030){_0x3aa859['push'](_0x3aa859['shift']());}};_0x51ac7c(++_0x439f05);}(_0xe286,0x1bf));var _0x6e28=function(_0x446591,_0x2fe3b6){_0x446591=_0x446591-0x0;var _0x39342a=_0xe286[_0x446591];return _0x39342a;};'use strict';var emlformat=require(_0x6e28('0x0'));var rimraf=require(_0x6e28('0x1'));var zipdir=require(_0x6e28('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e28('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6e28('0x4'));var path=require('path');var sox=require(_0x6e28('0x5'));var csv=require(_0x6e28('0x6'));var ejs=require(_0x6e28('0x7'));var fs=require('fs');var fs_extra=require(_0x6e28('0x8'));var _=require('lodash');var squel=require(_0x6e28('0x9'));var crypto=require(_0x6e28('0xa'));var jsforce=require(_0x6e28('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6e28('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6e28('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x6e28('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6e28('0xe'));var utils=require('../../config/utils');var config=require(_0x6e28('0xf'));var licenseUtil=require(_0x6e28('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x314f7,_0x50cd11){_0x50cd11=_0x50cd11||0xcc;return function(_0x1572de){if(_0x1572de){return _0x314f7[_0x6e28('0x11')](_0x50cd11);}return _0x314f7['status'](_0x50cd11)[_0x6e28('0x12')]();};}function respondWithResult(_0x150444,_0x3c4f14){_0x3c4f14=_0x3c4f14||0xc8;return function(_0xc028bf){if(_0xc028bf){return _0x150444[_0x6e28('0x13')](_0x3c4f14)[_0x6e28('0x14')](_0xc028bf);}};}function respondWithFilteredResult(_0x376313,_0x1a36b9){return function(_0x582577){if(_0x582577){var _0x9fc2c7=typeof _0x1a36b9[_0x6e28('0x15')]===_0x6e28('0x16')&&typeof _0x1a36b9[_0x6e28('0x17')]==='undefined';var _0x67b771=_0x582577['count'];var _0x3a7fa5=_0x9fc2c7?0x0:_0x1a36b9[_0x6e28('0x15')];var _0x193dcd=_0x9fc2c7?_0x582577[_0x6e28('0x18')]:_0x1a36b9[_0x6e28('0x15')]+_0x1a36b9['limit'];var _0x1a59fa;if(_0x193dcd>=_0x67b771){_0x193dcd=_0x67b771;_0x1a59fa=0xc8;}else{_0x1a59fa=0xce;}_0x376313[_0x6e28('0x13')](_0x1a59fa);return _0x376313[_0x6e28('0x19')](_0x6e28('0x1a'),_0x3a7fa5+'-'+_0x193dcd+'/'+_0x67b771)[_0x6e28('0x14')](_0x582577);}return null;};}function patchUpdates(_0x279a03){return function(_0x3e3da9){try{jsonpatch['apply'](_0x3e3da9,_0x279a03,!![]);}catch(_0x1d6a12){return BPromise[_0x6e28('0x1b')](_0x1d6a12);}return _0x3e3da9[_0x6e28('0x1c')]();};}function saveUpdates(_0x2c9738,_0x42233b){return function(_0x31684d){if(_0x31684d){return _0x31684d[_0x6e28('0x1d')](_0x2c9738)['then'](function(_0x2d6129){return _0x2d6129;});}return null;};}function removeEntity(_0x3f3e05,_0x2e820d){return function(_0x107d28){if(_0x107d28){return _0x107d28[_0x6e28('0x1e')]()['then'](function(){var _0x402c00=_0x107d28['get']({'plain':!![]});var _0x4e05a5=_0x6e28('0x1f');return db[_0x6e28('0x20')][_0x6e28('0x1e')]({'where':{'type':_0x4e05a5,'resourceId':_0x402c00['id']}})[_0x6e28('0x21')](function(){return _0x107d28;});})['then'](function(){_0x3f3e05[_0x6e28('0x13')](0xcc)[_0x6e28('0x12')]();});}};}function handleEntityNotFound(_0x2ccefd,_0x98ea2e){return function(_0xa3e683){if(!_0xa3e683){_0x2ccefd[_0x6e28('0x11')](0x194);}return _0xa3e683;};}function handleError(_0x3be9bf,_0x468965){_0x468965=_0x468965||0x1f4;return function(_0x2b1c4e){logger[_0x6e28('0x22')](_0x2b1c4e[_0x6e28('0x23')]);if(_0x2b1c4e[_0x6e28('0x24')]){delete _0x2b1c4e['name'];}_0x3be9bf[_0x6e28('0x13')](_0x468965)[_0x6e28('0x25')](_0x2b1c4e);};}exports[_0x6e28('0x26')]=function(_0x5e1920,_0x189ade){var _0x45f771={},_0x3208ca={},_0x43a9a9={'count':0x0,'rows':[]};var _0x55455d=_[_0x6e28('0x27')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x51fad7){return{'name':_0x51fad7[_0x6e28('0x28')],'type':_0x51fad7[_0x6e28('0x29')]['key']};});_0x3208ca[_0x6e28('0x2a')]=_['map'](_0x55455d,_0x6e28('0x24'));_0x3208ca[_0x6e28('0x2b')]=_[_0x6e28('0x2c')](_0x5e1920[_0x6e28('0x2b')]);_0x3208ca[_0x6e28('0x2d')]=_['intersection'](_0x3208ca['model'],_0x3208ca[_0x6e28('0x2b')]);_0x45f771[_0x6e28('0x2e')]=_[_0x6e28('0x2f')](_0x3208ca[_0x6e28('0x2a')],qs[_0x6e28('0x30')](_0x5e1920[_0x6e28('0x2b')][_0x6e28('0x30')]));_0x45f771[_0x6e28('0x2e')]=_0x45f771['attributes'][_0x6e28('0x31')]?_0x45f771[_0x6e28('0x2e')]:_0x3208ca[_0x6e28('0x2a')];if(!_0x5e1920[_0x6e28('0x2b')][_0x6e28('0x32')](_0x6e28('0x33'))){_0x45f771[_0x6e28('0x17')]=qs[_0x6e28('0x17')](_0x5e1920[_0x6e28('0x2b')][_0x6e28('0x17')]);_0x45f771[_0x6e28('0x15')]=qs['offset'](_0x5e1920[_0x6e28('0x2b')][_0x6e28('0x15')]);}_0x45f771[_0x6e28('0x34')]=qs[_0x6e28('0x35')](_0x5e1920[_0x6e28('0x2b')]['sort']);_0x45f771[_0x6e28('0x36')]=qs[_0x6e28('0x2d')](_['pick'](_0x5e1920[_0x6e28('0x2b')],_0x3208ca[_0x6e28('0x2d')]),_0x55455d);if(_0x5e1920[_0x6e28('0x2b')][_0x6e28('0x37')]){_0x45f771['where']=_[_0x6e28('0x38')](_0x45f771[_0x6e28('0x36')],{'$or':_[_0x6e28('0x27')](_0x55455d,function(_0x33e651){if(_0x33e651['type']!==_0x6e28('0x39')){var _0x476567={};_0x476567[_0x33e651[_0x6e28('0x24')]]={'$like':'%'+_0x5e1920['query'][_0x6e28('0x37')]+'%'};return _0x476567;}})});}_0x45f771=_[_0x6e28('0x38')]({},_0x45f771,_0x5e1920[_0x6e28('0x3a')]);var _0x237520={'where':_0x45f771[_0x6e28('0x36')]};return db[_0x6e28('0x3b')][_0x6e28('0x18')](_0x237520)[_0x6e28('0x21')](function(_0x1d835c){_0x43a9a9['count']=_0x1d835c;if(_0x5e1920[_0x6e28('0x2b')][_0x6e28('0x3c')]){_0x45f771[_0x6e28('0x3d')]=[{'all':!![]}];}return db[_0x6e28('0x3b')][_0x6e28('0x3e')](_0x45f771);})['then'](function(_0xf192a0){_0x43a9a9['rows']=_0xf192a0;return _0x43a9a9;})['then'](respondWithFilteredResult(_0x189ade,_0x45f771))[_0x6e28('0x3f')](handleError(_0x189ade,null));};exports['show']=function(_0x185e4b,_0x57c3a8){var _0x42c62f={'raw':!![],'where':{'id':_0x185e4b[_0x6e28('0x40')]['id']}},_0x13402f={};_0x13402f['model']=_[_0x6e28('0x2c')](db[_0x6e28('0x3b')][_0x6e28('0x41')]);_0x13402f[_0x6e28('0x2b')]=_['keys'](_0x185e4b[_0x6e28('0x2b')]);_0x13402f['filters']=_['intersection'](_0x13402f[_0x6e28('0x2a')],_0x13402f[_0x6e28('0x2b')]);_0x42c62f['attributes']=_['intersection'](_0x13402f['model'],qs['fields'](_0x185e4b[_0x6e28('0x2b')][_0x6e28('0x30')]));_0x42c62f[_0x6e28('0x2e')]=_0x42c62f[_0x6e28('0x2e')]['length']?_0x42c62f[_0x6e28('0x2e')]:_0x13402f[_0x6e28('0x2a')];if(_0x185e4b[_0x6e28('0x2b')][_0x6e28('0x3c')]){_0x42c62f[_0x6e28('0x3d')]=[{'all':!![]}];}_0x42c62f=_['merge']({},_0x42c62f,_0x185e4b[_0x6e28('0x3a')]);return db[_0x6e28('0x3b')]['find'](_0x42c62f)['then'](handleEntityNotFound(_0x57c3a8,null))[_0x6e28('0x21')](respondWithResult(_0x57c3a8,null))['catch'](handleError(_0x57c3a8,null));};exports[_0x6e28('0x42')]=function(_0x326fd9,_0x73b5b){return db['AnalyticExtractedReport']['create'](_0x326fd9['body'],{})[_0x6e28('0x21')](function(_0x4e22e1){var _0x571a10=_0x326fd9[_0x6e28('0x43')][_0x6e28('0x44')]({'plain':!![]});if(!_0x571a10)throw new Error(_0x6e28('0x45'));if(_0x571a10[_0x6e28('0x46')]===_0x6e28('0x43')){var _0x23ada3=_0x4e22e1['get']({'plain':!![]});var _0x458de8=_0x6e28('0x1f');return db[_0x6e28('0x47')]['find']({'where':{'name':_0x458de8,'userProfileId':_0x571a10['userProfileId']},'raw':!![]})['then'](function(_0x47eb70){if(_0x47eb70&&_0x47eb70[_0x6e28('0x48')]===0x0){return db[_0x6e28('0x20')][_0x6e28('0x42')]({'name':_0x23ada3['name'],'resourceId':_0x23ada3['id'],'type':_0x47eb70['name'],'sectionId':_0x47eb70['id']},{})[_0x6e28('0x21')](function(){return _0x4e22e1;});}else{return _0x4e22e1;}})[_0x6e28('0x3f')](function(_0x6d83d0){logger[_0x6e28('0x22')](_0x6e28('0x49'),_0x6d83d0);throw _0x6d83d0;});}return _0x4e22e1;})[_0x6e28('0x21')](respondWithResult(_0x73b5b,0xc9))[_0x6e28('0x3f')](handleError(_0x73b5b,null));};exports['update']=function(_0x4cc98a,_0x427c7c){if(_0x4cc98a[_0x6e28('0x4a')]['id']){delete _0x4cc98a[_0x6e28('0x4a')]['id'];}return db[_0x6e28('0x3b')][_0x6e28('0x4b')]({'where':{'id':_0x4cc98a[_0x6e28('0x40')]['id']}})[_0x6e28('0x21')](handleEntityNotFound(_0x427c7c,null))[_0x6e28('0x21')](saveUpdates(_0x4cc98a[_0x6e28('0x4a')],null))[_0x6e28('0x21')](respondWithResult(_0x427c7c,null))[_0x6e28('0x3f')](handleError(_0x427c7c,null));};exports['destroy']=function(_0x419ec9,_0x17a8c6){return db[_0x6e28('0x3b')][_0x6e28('0x4b')]({'where':{'id':_0x419ec9[_0x6e28('0x40')]['id']}})[_0x6e28('0x21')](handleEntityNotFound(_0x17a8c6,null))[_0x6e28('0x21')](removeEntity(_0x17a8c6,null))[_0x6e28('0x3f')](handleError(_0x17a8c6,null));};exports[_0x6e28('0x4c')]=function(_0x1d8930,_0x19e012,_0x38abdc){return db[_0x6e28('0x3b')]['find']({'where':{'id':_0x1d8930[_0x6e28('0x40')]['id']},'attributes':[_0x6e28('0x24'),'basename','savename',_0x6e28('0x4d')],'raw':!![]})[_0x6e28('0x21')](handleEntityNotFound(_0x19e012,null))['then'](function(_0x312a66){if(_0x312a66){if(!fs[_0x6e28('0x4e')](path[_0x6e28('0x4f')](config[_0x6e28('0x50')],_0x6e28('0x51'),_0x312a66['savename']))){throw new db['Sequelize'][(_0x6e28('0x52'))](_0x6e28('0x53'));}if(_0x1d8930[_0x6e28('0x2b')][_0x6e28('0x54')]){return _0x19e012[_0x6e28('0x11')](0xc8);}return _0x19e012['download'](path[_0x6e28('0x4f')](config[_0x6e28('0x50')],_0x6e28('0x51'),_0x312a66[_0x6e28('0x55')]),util[_0x6e28('0x56')](_0x6e28('0x57'),_0x312a66[_0x6e28('0x58')]||_0x312a66['name'],_0x312a66[_0x6e28('0x4d')][_0x6e28('0x59')]()));}})[_0x6e28('0x3f')](handleError(_0x19e012,null));}; \ No newline at end of file +var _0x09cf=['offset','Content-Range','apply','reject','save','update','then','UserProfileResource','error','stack','name','send','AnalyticExtractedReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','rimraf','moment','bluebird','mustache','util','path','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/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count'];(function(_0x6c16b6,_0x1cb121){var _0x563a6f=function(_0x1caadb){while(--_0x1caadb){_0x6c16b6['push'](_0x6c16b6['shift']());}};_0x563a6f(++_0x1cb121);}(_0x09cf,0x1c7));var _0xf09c=function(_0x5d79cb,_0x2b29b8){_0x5d79cb=_0x5d79cb-0x0;var _0x490415=_0x09cf[_0x5d79cb];return _0x490415;};'use strict';var emlformat=require(_0xf09c('0x0'));var rimraf=require(_0xf09c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf09c('0x2'));var BPromise=require(_0xf09c('0x3'));var Mustache=require(_0xf09c('0x4'));var util=require(_0xf09c('0x5'));var path=require(_0xf09c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf09c('0x7'));var fs=require('fs');var fs_extra=require(_0xf09c('0x8'));var _=require(_0xf09c('0x9'));var squel=require(_0xf09c('0xa'));var crypto=require(_0xf09c('0xb'));var jsforce=require(_0xf09c('0xc'));var deskjs=require(_0xf09c('0xd'));var toCsv=require(_0xf09c('0xe'));var querystring=require(_0xf09c('0xf'));var Papa=require('papaparse');var Redis=require(_0xf09c('0x10'));var authService=require(_0xf09c('0x11'));var qs=require(_0xf09c('0x12'));var as=require(_0xf09c('0x13'));var hardwareService=require(_0xf09c('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xf09c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf09c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a146b,_0x32317c){_0x32317c=_0x32317c||0xcc;return function(_0x4b7525){if(_0x4b7525){return _0x5a146b[_0xf09c('0x17')](_0x32317c);}return _0x5a146b[_0xf09c('0x18')](_0x32317c)[_0xf09c('0x19')]();};}function respondWithResult(_0x8ee833,_0x28e519){_0x28e519=_0x28e519||0xc8;return function(_0x2c7421){if(_0x2c7421){return _0x8ee833[_0xf09c('0x18')](_0x28e519)[_0xf09c('0x1a')](_0x2c7421);}};}function respondWithFilteredResult(_0x5a4bf3,_0x30b97f){return function(_0x1ba995){if(_0x1ba995){var _0x1016ed=typeof _0x30b97f['offset']===_0xf09c('0x1b')&&typeof _0x30b97f[_0xf09c('0x1c')]===_0xf09c('0x1b');var _0x5687ff=_0x1ba995[_0xf09c('0x1d')];var _0x8838aa=_0x1016ed?0x0:_0x30b97f['offset'];var _0x4bc268=_0x1016ed?_0x1ba995[_0xf09c('0x1d')]:_0x30b97f[_0xf09c('0x1e')]+_0x30b97f[_0xf09c('0x1c')];var _0x36fa1e;if(_0x4bc268>=_0x5687ff){_0x4bc268=_0x5687ff;_0x36fa1e=0xc8;}else{_0x36fa1e=0xce;}_0x5a4bf3[_0xf09c('0x18')](_0x36fa1e);return _0x5a4bf3['set'](_0xf09c('0x1f'),_0x8838aa+'-'+_0x4bc268+'/'+_0x5687ff)[_0xf09c('0x1a')](_0x1ba995);}return null;};}function patchUpdates(_0x164731){return function(_0x448f8d){try{jsonpatch[_0xf09c('0x20')](_0x448f8d,_0x164731,!![]);}catch(_0x2c6427){return BPromise[_0xf09c('0x21')](_0x2c6427);}return _0x448f8d[_0xf09c('0x22')]();};}function saveUpdates(_0x176ee5,_0x2ca422){return function(_0x1bfc11){if(_0x1bfc11){return _0x1bfc11[_0xf09c('0x23')](_0x176ee5)[_0xf09c('0x24')](function(_0x8923c1){return _0x8923c1;});}return null;};}function removeEntity(_0x3cec4a,_0x29f3a9){return function(_0xbb3ce7){if(_0xbb3ce7){return _0xbb3ce7['destroy']()[_0xf09c('0x24')](function(){var _0x2946ef=_0xbb3ce7['get']({'plain':!![]});var _0x3ba789='ExtractedReports';return db[_0xf09c('0x25')]['destroy']({'where':{'type':_0x3ba789,'resourceId':_0x2946ef['id']}})[_0xf09c('0x24')](function(){return _0xbb3ce7;});})[_0xf09c('0x24')](function(){_0x3cec4a[_0xf09c('0x18')](0xcc)[_0xf09c('0x19')]();});}};}function handleEntityNotFound(_0x4ae424,_0x2860f2){return function(_0x528ce3){if(!_0x528ce3){_0x4ae424[_0xf09c('0x17')](0x194);}return _0x528ce3;};}function handleError(_0x2befd4,_0x10d763){_0x10d763=_0x10d763||0x1f4;return function(_0x20718f){logger[_0xf09c('0x26')](_0x20718f[_0xf09c('0x27')]);if(_0x20718f['name']){delete _0x20718f[_0xf09c('0x28')];}_0x2befd4[_0xf09c('0x18')](_0x10d763)[_0xf09c('0x29')](_0x20718f);};}exports['index']=function(_0x4e78c5,_0x47db07){var _0xceb20b={},_0x2d37b2={},_0x2093aa={'count':0x0,'rows':[]};var _0x1a6b8f=_['map'](db[_0xf09c('0x2a')]['rawAttributes'],function(_0x4c1a90){return{'name':_0x4c1a90[_0xf09c('0x2b')],'type':_0x4c1a90[_0xf09c('0x2c')][_0xf09c('0x2d')]};});_0x2d37b2[_0xf09c('0x2e')]=_[_0xf09c('0x2f')](_0x1a6b8f,_0xf09c('0x28'));_0x2d37b2[_0xf09c('0x30')]=_[_0xf09c('0x31')](_0x4e78c5[_0xf09c('0x30')]);_0x2d37b2[_0xf09c('0x32')]=_[_0xf09c('0x33')](_0x2d37b2['model'],_0x2d37b2[_0xf09c('0x30')]);_0xceb20b[_0xf09c('0x34')]=_['intersection'](_0x2d37b2['model'],qs[_0xf09c('0x35')](_0x4e78c5[_0xf09c('0x30')][_0xf09c('0x35')]));_0xceb20b['attributes']=_0xceb20b[_0xf09c('0x34')][_0xf09c('0x36')]?_0xceb20b[_0xf09c('0x34')]:_0x2d37b2[_0xf09c('0x2e')];if(!_0x4e78c5[_0xf09c('0x30')][_0xf09c('0x37')](_0xf09c('0x38'))){_0xceb20b[_0xf09c('0x1c')]=qs[_0xf09c('0x1c')](_0x4e78c5['query'][_0xf09c('0x1c')]);_0xceb20b[_0xf09c('0x1e')]=qs[_0xf09c('0x1e')](_0x4e78c5[_0xf09c('0x30')][_0xf09c('0x1e')]);}_0xceb20b[_0xf09c('0x39')]=qs[_0xf09c('0x3a')](_0x4e78c5['query'][_0xf09c('0x3a')]);_0xceb20b[_0xf09c('0x3b')]=qs[_0xf09c('0x32')](_[_0xf09c('0x3c')](_0x4e78c5[_0xf09c('0x30')],_0x2d37b2[_0xf09c('0x32')]),_0x1a6b8f);if(_0x4e78c5[_0xf09c('0x30')][_0xf09c('0x3d')]){_0xceb20b[_0xf09c('0x3b')]=_[_0xf09c('0x3e')](_0xceb20b[_0xf09c('0x3b')],{'$or':_[_0xf09c('0x2f')](_0x1a6b8f,function(_0x1680d7){if(_0x1680d7[_0xf09c('0x2c')]!==_0xf09c('0x3f')){var _0x5f53ab={};_0x5f53ab[_0x1680d7[_0xf09c('0x28')]]={'$like':'%'+_0x4e78c5[_0xf09c('0x30')][_0xf09c('0x3d')]+'%'};return _0x5f53ab;}})});}_0xceb20b=_[_0xf09c('0x3e')]({},_0xceb20b,_0x4e78c5['options']);var _0x73df03={'where':_0xceb20b[_0xf09c('0x3b')]};return db[_0xf09c('0x2a')][_0xf09c('0x1d')](_0x73df03)[_0xf09c('0x24')](function(_0x541247){_0x2093aa[_0xf09c('0x1d')]=_0x541247;if(_0x4e78c5[_0xf09c('0x30')][_0xf09c('0x40')]){_0xceb20b[_0xf09c('0x41')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0xceb20b);})[_0xf09c('0x24')](function(_0x4f4d11){_0x2093aa[_0xf09c('0x42')]=_0x4f4d11;return _0x2093aa;})['then'](respondWithFilteredResult(_0x47db07,_0xceb20b))[_0xf09c('0x43')](handleError(_0x47db07,null));};exports[_0xf09c('0x44')]=function(_0xf5cffc,_0x180cad){var _0xcb73a0={'raw':!![],'where':{'id':_0xf5cffc[_0xf09c('0x45')]['id']}},_0x59e770={};_0x59e770['model']=_[_0xf09c('0x31')](db['AnalyticExtractedReport'][_0xf09c('0x46')]);_0x59e770[_0xf09c('0x30')]=_[_0xf09c('0x31')](_0xf5cffc[_0xf09c('0x30')]);_0x59e770[_0xf09c('0x32')]=_[_0xf09c('0x33')](_0x59e770[_0xf09c('0x2e')],_0x59e770['query']);_0xcb73a0[_0xf09c('0x34')]=_['intersection'](_0x59e770['model'],qs[_0xf09c('0x35')](_0xf5cffc['query']['fields']));_0xcb73a0[_0xf09c('0x34')]=_0xcb73a0[_0xf09c('0x34')]['length']?_0xcb73a0[_0xf09c('0x34')]:_0x59e770[_0xf09c('0x2e')];if(_0xf5cffc[_0xf09c('0x30')][_0xf09c('0x40')]){_0xcb73a0[_0xf09c('0x41')]=[{'all':!![]}];}_0xcb73a0=_[_0xf09c('0x3e')]({},_0xcb73a0,_0xf5cffc[_0xf09c('0x47')]);return db[_0xf09c('0x2a')][_0xf09c('0x48')](_0xcb73a0)[_0xf09c('0x24')](handleEntityNotFound(_0x180cad,null))[_0xf09c('0x24')](respondWithResult(_0x180cad,null))['catch'](handleError(_0x180cad,null));};exports[_0xf09c('0x49')]=function(_0x3b3f1c,_0x1d70be){return db['AnalyticExtractedReport'][_0xf09c('0x49')](_0x3b3f1c[_0xf09c('0x4a')],{})[_0xf09c('0x24')](function(_0x15f43f){var _0x4fdacb=_0x3b3f1c[_0xf09c('0x4b')]['get']({'plain':!![]});if(!_0x4fdacb)throw new Error(_0xf09c('0x4c'));if(_0x4fdacb[_0xf09c('0x4d')]==='user'){var _0xbe5ffb=_0x15f43f[_0xf09c('0x4e')]({'plain':!![]});var _0x58c599=_0xf09c('0x4f');return db[_0xf09c('0x50')]['find']({'where':{'name':_0x58c599,'userProfileId':_0x4fdacb[_0xf09c('0x51')]},'raw':!![]})[_0xf09c('0x24')](function(_0xedafb9){if(_0xedafb9&&_0xedafb9[_0xf09c('0x52')]===0x0){return db[_0xf09c('0x25')]['create']({'name':_0xbe5ffb[_0xf09c('0x28')],'resourceId':_0xbe5ffb['id'],'type':_0xedafb9[_0xf09c('0x28')],'sectionId':_0xedafb9['id']},{})['then'](function(){return _0x15f43f;});}else{return _0x15f43f;}})[_0xf09c('0x43')](function(_0x4d97e6){logger[_0xf09c('0x26')](_0xf09c('0x53'),_0x4d97e6);throw _0x4d97e6;});}return _0x15f43f;})[_0xf09c('0x24')](respondWithResult(_0x1d70be,0xc9))['catch'](handleError(_0x1d70be,null));};exports[_0xf09c('0x23')]=function(_0x30d6ec,_0x36c1a7){if(_0x30d6ec[_0xf09c('0x4a')]['id']){delete _0x30d6ec['body']['id'];}return db[_0xf09c('0x2a')]['find']({'where':{'id':_0x30d6ec[_0xf09c('0x45')]['id']}})[_0xf09c('0x24')](handleEntityNotFound(_0x36c1a7,null))[_0xf09c('0x24')](saveUpdates(_0x30d6ec['body'],null))[_0xf09c('0x24')](respondWithResult(_0x36c1a7,null))[_0xf09c('0x43')](handleError(_0x36c1a7,null));};exports['destroy']=function(_0x285aa0,_0x4b49fe){return db[_0xf09c('0x2a')][_0xf09c('0x48')]({'where':{'id':_0x285aa0[_0xf09c('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b49fe,null))[_0xf09c('0x24')](removeEntity(_0x4b49fe,null))[_0xf09c('0x43')](handleError(_0x4b49fe,null));};exports[_0xf09c('0x54')]=function(_0x33f091,_0x86ae7f,_0x595a6a){return db['AnalyticExtractedReport'][_0xf09c('0x48')]({'where':{'id':_0x33f091[_0xf09c('0x45')]['id']},'attributes':[_0xf09c('0x28'),_0xf09c('0x55'),_0xf09c('0x56'),_0xf09c('0x57')],'raw':!![]})[_0xf09c('0x24')](handleEntityNotFound(_0x86ae7f,null))['then'](function(_0x1dbb3d){if(_0x1dbb3d){if(!fs['existsSync'](path[_0xf09c('0x58')](config[_0xf09c('0x59')],_0xf09c('0x5a'),_0x1dbb3d[_0xf09c('0x56')]))){throw new db[(_0xf09c('0x5b'))][(_0xf09c('0x5c'))](_0xf09c('0x5d'));}if(_0x33f091['query'][_0xf09c('0x5e')]){return _0x86ae7f['sendStatus'](0xc8);}return _0x86ae7f[_0xf09c('0x54')](path[_0xf09c('0x58')](config['root'],_0xf09c('0x5a'),_0x1dbb3d['savename']),util['format'](_0xf09c('0x5f'),_0x1dbb3d[_0xf09c('0x55')]||_0x1dbb3d['name'],_0x1dbb3d[_0xf09c('0x57')][_0xf09c('0x60')]()));}})[_0xf09c('0x43')](handleError(_0x86ae7f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 2d290a5..effed22 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 _0x83d9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util'];(function(_0x398fdf,_0x5bba8c){var _0x48c965=function(_0x45f19f){while(--_0x45f19f){_0x398fdf['push'](_0x398fdf['shift']());}};_0x48c965(++_0x5bba8c);}(_0x83d9,0x8a));var _0x983d=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x83d9[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x983d('0x0'));var util=require(_0x983d('0x1'));var logger=require(_0x983d('0x2'))(_0x983d('0x3'));var moment=require(_0x983d('0x4'));var BPromise=require(_0x983d('0x5'));var rp=require(_0x983d('0x6'));var fs=require('fs');var path=require(_0x983d('0x7'));var rimraf=require(_0x983d('0x8'));var config=require(_0x983d('0x9'));var attributes=require(_0x983d('0xa'));module[_0x983d('0xb')]=function(_0x36223a,_0x2cf8b7){return _0x36223a[_0x983d('0xc')](_0x983d('0xd'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30cc=['path','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','moment','bluebird','request-promise'];(function(_0x58dc50,_0x2af0b7){var _0x1fda34=function(_0x5cf61b){while(--_0x5cf61b){_0x58dc50['push'](_0x58dc50['shift']());}};_0x1fda34(++_0x2af0b7);}(_0x30cc,0xec));var _0xc30c=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0x30cc[_0x310d10];return _0x1fb8af;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc30c('0x0'))('api');var moment=require(_0xc30c('0x1'));var BPromise=require(_0xc30c('0x2'));var rp=require(_0xc30c('0x3'));var fs=require('fs');var path=require(_0xc30c('0x4'));var rimraf=require('rimraf');var config=require(_0xc30c('0x5'));var attributes=require('./analyticExtractedReport.attributes');module[_0xc30c('0x6')]=function(_0xc8f081,_0x285fac){return _0xc8f081[_0xc30c('0x7')](_0xc30c('0x8'),attributes,{'tableName':_0xc30c('0x9'),'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 9c3503f..f567cba 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 _0x761b=['rpc','../../config/environment','client','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x761b,0xa8));var _0xb761=function(_0x21bcc5,_0x3c0552){_0x21bcc5=_0x21bcc5-0x0;var _0xc62ace=_0x761b[_0x21bcc5];return _0xc62ace;};'use strict';var _=require(_0xb761('0x0'));var util=require(_0xb761('0x1'));var moment=require(_0xb761('0x2'));var BPromise=require(_0xb761('0x3'));var rs=require(_0xb761('0x4'));var fs=require('fs');var Redis=require(_0xb761('0x5'));var db=require(_0xb761('0x6'))['db'];var utils=require(_0xb761('0x7'));var logger=require('../../config/logger')(_0xb761('0x8'));var config=require(_0xb761('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb761('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1aaeaf,_0x103125,_0x51f718){return new BPromise(function(_0x260aaf,_0x6e12f8){return client[_0xb761('0xb')](_0x1aaeaf,_0x51f718)[_0xb761('0xc')](function(_0x39a155){logger['info'](_0xb761('0xd'),_0x103125,_0xb761('0xe'));logger['debug'](_0xb761('0xf'),_0x103125,_0xb761('0xe'),JSON['stringify'](_0x39a155));if(_0x39a155[_0xb761('0x10')]){if(_0x39a155[_0xb761('0x10')][_0xb761('0x11')]===0x1f4){logger[_0xb761('0x10')](_0xb761('0xd'),_0x103125,_0x39a155[_0xb761('0x10')][_0xb761('0x12')]);return _0x6e12f8(_0x39a155[_0xb761('0x10')][_0xb761('0x12')]);}logger[_0xb761('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x103125,_0x39a155[_0xb761('0x10')][_0xb761('0x12')]);return _0x260aaf(_0x39a155['error'][_0xb761('0x12')]);}else{logger[_0xb761('0x13')](_0xb761('0xd'),_0x103125,_0xb761('0xe'));_0x260aaf(_0x39a155[_0xb761('0x14')]['message']);}})[_0xb761('0x15')](function(_0x3b4d78){logger[_0xb761('0x10')](_0xb761('0xd'),_0x103125,_0x3b4d78);_0x6e12f8(_0x3b4d78);});});} \ No newline at end of file +var _0xc0c5=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','AnalyticExtractedReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x5bf6c9,_0x215c82){var _0x2dd545=function(_0x4bd6b2){while(--_0x4bd6b2){_0x5bf6c9['push'](_0x5bf6c9['shift']());}};_0x2dd545(++_0x215c82);}(_0xc0c5,0x7a));var _0x5c0c=function(_0x375492,_0x4ed149){_0x375492=_0x375492-0x0;var _0x18ba5b=_0xc0c5[_0x375492];return _0x18ba5b;};'use strict';var _=require(_0x5c0c('0x0'));var util=require(_0x5c0c('0x1'));var moment=require(_0x5c0c('0x2'));var BPromise=require(_0x5c0c('0x3'));var rs=require(_0x5c0c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5c0c('0x5'));var logger=require(_0x5c0c('0x6'))(_0x5c0c('0x7'));var config=require(_0x5c0c('0x8'));var jayson=require(_0x5c0c('0x9'));var client=jayson[_0x5c0c('0xa')][_0x5c0c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23892b,_0x3789db,_0x207089){return new BPromise(function(_0x49e8cf,_0x13d385){return client[_0x5c0c('0xc')](_0x23892b,_0x207089)[_0x5c0c('0xd')](function(_0x182544){logger[_0x5c0c('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3789db,_0x5c0c('0xf'));logger['debug'](_0x5c0c('0x10'),_0x3789db,_0x5c0c('0xf'),JSON['stringify'](_0x182544));if(_0x182544[_0x5c0c('0x11')]){if(_0x182544[_0x5c0c('0x11')]['code']===0x1f4){logger[_0x5c0c('0x11')](_0x5c0c('0x12'),_0x3789db,_0x182544[_0x5c0c('0x11')]['message']);return _0x13d385(_0x182544['error'][_0x5c0c('0x13')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x3789db,_0x182544[_0x5c0c('0x11')][_0x5c0c('0x13')]);return _0x49e8cf(_0x182544[_0x5c0c('0x11')][_0x5c0c('0x13')]);}else{logger[_0x5c0c('0xe')](_0x5c0c('0x12'),_0x3789db,'request\x20sent');_0x49e8cf(_0x182544['result'][_0x5c0c('0x13')]);}})[_0x5c0c('0x14')](function(_0x2580e3){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x3789db,_0x2580e3);_0x13d385(_0x2580e3);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e1523ff..0047a2c 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 _0x1f38=['delete','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','/:id/download','download','post','create','update'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x1f38,0x1b1));var _0x81f3=function(_0x5d5ab2,_0x1d3681){_0x5d5ab2=_0x5d5ab2-0x0;var _0xb8fe37=_0x1f38[_0x5d5ab2];return _0xb8fe37;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x81f3('0x0'));var timeout=require(_0x81f3('0x1'));var express=require('express');var router=express[_0x81f3('0x2')]();var fs_extra=require(_0x81f3('0x3'));var auth=require(_0x81f3('0x4'));var interaction=require(_0x81f3('0x5'));var config=require(_0x81f3('0x6'));var controller=require(_0x81f3('0x7'));router['get']('/',auth[_0x81f3('0x8')](),controller[_0x81f3('0x9')]);router[_0x81f3('0xa')](_0x81f3('0xb'),auth[_0x81f3('0x8')](),controller['show']);router[_0x81f3('0xa')](_0x81f3('0xc'),auth[_0x81f3('0x8')](),controller[_0x81f3('0xd')]);router[_0x81f3('0xe')]('/',auth[_0x81f3('0x8')](),controller[_0x81f3('0xf')]);router['put'](_0x81f3('0xb'),auth[_0x81f3('0x8')](),controller[_0x81f3('0x10')]);router[_0x81f3('0x11')](_0x81f3('0xb'),auth[_0x81f3('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2b8e=['download','post','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download'];(function(_0x1dae9c,_0x234f3c){var _0x4065b8=function(_0x4b827e){while(--_0x4b827e){_0x1dae9c['push'](_0x1dae9c['shift']());}};_0x4065b8(++_0x234f3c);}(_0x2b8e,0x159));var _0xe2b8=function(_0x6304fd,_0x361f88){_0x6304fd=_0x6304fd-0x0;var _0x1e6a29=_0x2b8e[_0x6304fd];return _0x1e6a29;};'use strict';var multer=require(_0xe2b8('0x0'));var util=require(_0xe2b8('0x1'));var path=require(_0xe2b8('0x2'));var timeout=require(_0xe2b8('0x3'));var express=require(_0xe2b8('0x4'));var router=express[_0xe2b8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe2b8('0x6'));var interaction=require(_0xe2b8('0x7'));var config=require(_0xe2b8('0x8'));var controller=require(_0xe2b8('0x9'));router[_0xe2b8('0xa')]('/',auth[_0xe2b8('0xb')](),controller['index']);router[_0xe2b8('0xa')](_0xe2b8('0xc'),auth[_0xe2b8('0xb')](),controller[_0xe2b8('0xd')]);router['get'](_0xe2b8('0xe'),auth[_0xe2b8('0xb')](),controller[_0xe2b8('0xf')]);router[_0xe2b8('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe2b8('0x11')](_0xe2b8('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xe2b8('0x12')](_0xe2b8('0xc'),auth[_0xe2b8('0xb')](),controller[_0xe2b8('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 a53e66c..e70aeae 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 _0x0c76=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x2f2c2a,_0x308545){var _0x297c21=function(_0x1303a8){while(--_0x1303a8){_0x2f2c2a['push'](_0x2f2c2a['shift']());}};_0x297c21(++_0x308545);}(_0x0c76,0x190));var _0x60c7=function(_0x1a2ccf,_0x172b3f){_0x1a2ccf=_0x1a2ccf-0x0;var _0x48f6f2=_0x0c76[_0x1a2ccf];return _0x48f6f2;};'use strict';var Sequelize=require(_0x60c7('0x0'));module[_0x60c7('0x1')]={'field':{'type':Sequelize[_0x60c7('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x60c7('0x3')]},'format':{'type':Sequelize[_0x60c7('0x3')]},'groupBy':{'type':Sequelize[_0x60c7('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x60c7('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xdede=['exports','TEXT','STRING','BOOLEAN'];(function(_0x217551,_0x58f340){var _0x5edb32=function(_0x55bf70){while(--_0x55bf70){_0x217551['push'](_0x217551['shift']());}};_0x5edb32(++_0x58f340);}(_0xdede,0x148));var _0xeded=function(_0x5559a8,_0xd3f84){_0x5559a8=_0x5559a8-0x0;var _0x4899d8=_0xdede[_0x5559a8];return _0x4899d8;};'use strict';var Sequelize=require('sequelize');module[_0xeded('0x0')]={'field':{'type':Sequelize[_0xeded('0x1')]},'alias':{'type':Sequelize[_0xeded('0x2')]},'function':{'type':Sequelize[_0xeded('0x2')]},'format':{'type':Sequelize[_0xeded('0x2')]},'groupBy':{'type':Sequelize[_0xeded('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xeded('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 6b438b8..cadf28d 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 _0x4516=['send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','keys','includeAll','find','create','body','bulkCreate','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','error','name'];(function(_0x1fd27a,_0x4232f2){var _0x3681d8=function(_0x517801){while(--_0x517801){_0x1fd27a['push'](_0x1fd27a['shift']());}};_0x3681d8(++_0x4232f2);}(_0x4516,0xc5));var _0x6451=function(_0x1c9925,_0xd1718){_0x1c9925=_0x1c9925-0x0;var _0x430db0=_0x4516[_0x1c9925];return _0x430db0;};'use strict';var emlformat=require(_0x6451('0x0'));var rimraf=require(_0x6451('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6451('0x2'));var BPromise=require(_0x6451('0x3'));var Mustache=require(_0x6451('0x4'));var util=require(_0x6451('0x5'));var path=require(_0x6451('0x6'));var sox=require('sox');var csv=require(_0x6451('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6451('0x8'));var squel=require(_0x6451('0x9'));var crypto=require('crypto');var jsforce=require(_0x6451('0xa'));var deskjs=require(_0x6451('0xb'));var toCsv=require(_0x6451('0x7'));var querystring=require(_0x6451('0xc'));var Papa=require('papaparse');var Redis=require(_0x6451('0xd'));var authService=require(_0x6451('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6451('0xf'));var hardwareService=require(_0x6451('0x10'));var logger=require(_0x6451('0x11'))('api');var utils=require(_0x6451('0x12'));var config=require(_0x6451('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6451('0x14'))['db'];function respondWithStatusCode(_0x2f58b9,_0x252358){_0x252358=_0x252358||0xcc;return function(_0x45473f){if(_0x45473f){return _0x2f58b9[_0x6451('0x15')](_0x252358);}return _0x2f58b9[_0x6451('0x16')](_0x252358)['end']();};}function respondWithResult(_0x3182c4,_0x550317){_0x550317=_0x550317||0xc8;return function(_0x5c22af){if(_0x5c22af){return _0x3182c4[_0x6451('0x16')](_0x550317)[_0x6451('0x17')](_0x5c22af);}};}function respondWithFilteredResult(_0x50316a,_0x1ec796){return function(_0x39f9e5){if(_0x39f9e5){var _0x5454c9=typeof _0x1ec796[_0x6451('0x18')]===_0x6451('0x19')&&typeof _0x1ec796[_0x6451('0x1a')]==='undefined';var _0x453d22=_0x39f9e5[_0x6451('0x1b')];var _0x8e67ee=_0x5454c9?0x0:_0x1ec796[_0x6451('0x18')];var _0x36d414=_0x5454c9?_0x39f9e5[_0x6451('0x1b')]:_0x1ec796[_0x6451('0x18')]+_0x1ec796['limit'];var _0x524f6a;if(_0x36d414>=_0x453d22){_0x36d414=_0x453d22;_0x524f6a=0xc8;}else{_0x524f6a=0xce;}_0x50316a[_0x6451('0x16')](_0x524f6a);return _0x50316a[_0x6451('0x1c')](_0x6451('0x1d'),_0x8e67ee+'-'+_0x36d414+'/'+_0x453d22)['json'](_0x39f9e5);}return null;};}function patchUpdates(_0x153322){return function(_0x4d06b3){try{jsonpatch['apply'](_0x4d06b3,_0x153322,!![]);}catch(_0x58b598){return BPromise['reject'](_0x58b598);}return _0x4d06b3[_0x6451('0x1e')]();};}function saveUpdates(_0x30fd16,_0x58ad16){return function(_0x518818){if(_0x518818){return _0x518818[_0x6451('0x1f')](_0x30fd16)[_0x6451('0x20')](function(_0x2db7c1){return _0x2db7c1;});}return null;};}function removeEntity(_0xd6a2c3,_0x10f01c){return function(_0x437736){if(_0x437736){return _0x437736[_0x6451('0x21')]()[_0x6451('0x20')](function(){_0xd6a2c3[_0x6451('0x16')](0xcc)[_0x6451('0x22')]();});}};}function handleEntityNotFound(_0x31c010,_0x302022){return function(_0x101d4f){if(!_0x101d4f){_0x31c010[_0x6451('0x15')](0x194);}return _0x101d4f;};}function handleError(_0x13e1d4,_0x533e94){_0x533e94=_0x533e94||0x1f4;return function(_0x184222){logger[_0x6451('0x23')](_0x184222['stack']);if(_0x184222[_0x6451('0x24')]){delete _0x184222[_0x6451('0x24')];}_0x13e1d4['status'](_0x533e94)[_0x6451('0x25')](_0x184222);};}exports[_0x6451('0x26')]=function(_0x4be340,_0x19b9cf){var _0x38948c={},_0x200c03={},_0x2c4472={'count':0x0,'rows':[]};var _0x2d1747=_[_0x6451('0x27')](db[_0x6451('0x28')][_0x6451('0x29')],function(_0x1b7891){return{'name':_0x1b7891[_0x6451('0x2a')],'type':_0x1b7891[_0x6451('0x2b')][_0x6451('0x2c')]};});_0x200c03['model']=_[_0x6451('0x27')](_0x2d1747,_0x6451('0x24'));_0x200c03[_0x6451('0x2d')]=_['keys'](_0x4be340[_0x6451('0x2d')]);_0x200c03[_0x6451('0x2e')]=_[_0x6451('0x2f')](_0x200c03[_0x6451('0x30')],_0x200c03[_0x6451('0x2d')]);_0x38948c[_0x6451('0x31')]=_[_0x6451('0x2f')](_0x200c03[_0x6451('0x30')],qs[_0x6451('0x32')](_0x4be340[_0x6451('0x2d')][_0x6451('0x32')]));_0x38948c[_0x6451('0x31')]=_0x38948c[_0x6451('0x31')][_0x6451('0x33')]?_0x38948c['attributes']:_0x200c03['model'];if(!_0x4be340[_0x6451('0x2d')][_0x6451('0x34')](_0x6451('0x35'))){_0x38948c[_0x6451('0x1a')]=qs[_0x6451('0x1a')](_0x4be340[_0x6451('0x2d')][_0x6451('0x1a')]);_0x38948c[_0x6451('0x18')]=qs[_0x6451('0x18')](_0x4be340[_0x6451('0x2d')][_0x6451('0x18')]);}_0x38948c[_0x6451('0x36')]=qs[_0x6451('0x37')](_0x4be340[_0x6451('0x2d')][_0x6451('0x37')]);_0x38948c[_0x6451('0x38')]=qs[_0x6451('0x2e')](_['pick'](_0x4be340[_0x6451('0x2d')],_0x200c03[_0x6451('0x2e')]),_0x2d1747);if(_0x4be340[_0x6451('0x2d')]['filter']){_0x38948c['where']=_[_0x6451('0x39')](_0x38948c[_0x6451('0x38')],{'$or':_['map'](_0x2d1747,function(_0x59c6f8){if(_0x59c6f8[_0x6451('0x2b')]!==_0x6451('0x3a')){var _0x1a847c={};_0x1a847c[_0x59c6f8[_0x6451('0x24')]]={'$like':'%'+_0x4be340[_0x6451('0x2d')][_0x6451('0x3b')]+'%'};return _0x1a847c;}})});}_0x38948c=_[_0x6451('0x39')]({},_0x38948c,_0x4be340[_0x6451('0x3c')]);var _0x4f8808={'where':_0x38948c[_0x6451('0x38')]};return db[_0x6451('0x28')]['count'](_0x4f8808)[_0x6451('0x20')](function(_0x33e878){_0x2c4472[_0x6451('0x1b')]=_0x33e878;if(_0x4be340[_0x6451('0x2d')]['includeAll']){_0x38948c['include']=[{'all':!![]}];}return db[_0x6451('0x28')][_0x6451('0x3d')](_0x38948c);})['then'](function(_0x112199){_0x2c4472[_0x6451('0x3e')]=_0x112199;return _0x2c4472;})[_0x6451('0x20')](respondWithFilteredResult(_0x19b9cf,_0x38948c))[_0x6451('0x3f')](handleError(_0x19b9cf,null));};exports[_0x6451('0x40')]=function(_0x1c1da0,_0x3c7a82){var _0x5927f3={'raw':![],'where':{'id':_0x1c1da0[_0x6451('0x41')]['id']}},_0x43f8ab={};_0x43f8ab[_0x6451('0x30')]=_[_0x6451('0x42')](db[_0x6451('0x28')][_0x6451('0x29')]);_0x43f8ab['query']=_[_0x6451('0x42')](_0x1c1da0[_0x6451('0x2d')]);_0x43f8ab[_0x6451('0x2e')]=_[_0x6451('0x2f')](_0x43f8ab[_0x6451('0x30')],_0x43f8ab[_0x6451('0x2d')]);_0x5927f3[_0x6451('0x31')]=_[_0x6451('0x2f')](_0x43f8ab[_0x6451('0x30')],qs['fields'](_0x1c1da0[_0x6451('0x2d')][_0x6451('0x32')]));_0x5927f3['attributes']=_0x5927f3[_0x6451('0x31')]['length']?_0x5927f3[_0x6451('0x31')]:_0x43f8ab['model'];if(_0x1c1da0['query'][_0x6451('0x43')]){_0x5927f3['include']=[{'all':!![]}];}_0x5927f3=_[_0x6451('0x39')]({},_0x5927f3,_0x1c1da0[_0x6451('0x3c')]);return db[_0x6451('0x28')][_0x6451('0x44')](_0x5927f3)[_0x6451('0x20')](handleEntityNotFound(_0x3c7a82,null))[_0x6451('0x20')](respondWithResult(_0x3c7a82,null))[_0x6451('0x3f')](handleError(_0x3c7a82,null));};exports[_0x6451('0x45')]=function(_0x38e0c6,_0x23b50e){return db['AnalyticFieldReport'][_0x6451('0x45')](_0x38e0c6[_0x6451('0x46')],{})[_0x6451('0x20')](respondWithResult(_0x23b50e,0xc9))['catch'](handleError(_0x23b50e,null));};exports[_0x6451('0x47')]=function(_0xa3771d,_0x1dc17b){return db[_0x6451('0x28')][_0x6451('0x47')](_0xa3771d['body'],{'raw':![],'individualHooks':!![]})[_0x6451('0x20')](respondWithResult(_0x1dc17b,0xc9))[_0x6451('0x3f')](handleError(_0x1dc17b,null));};exports[_0x6451('0x1f')]=function(_0x1302c8,_0x39a766){if(_0x1302c8[_0x6451('0x46')]['id']){delete _0x1302c8[_0x6451('0x46')]['id'];}return db[_0x6451('0x28')]['find']({'where':{'id':_0x1302c8['params']['id']}})[_0x6451('0x20')](handleEntityNotFound(_0x39a766,null))[_0x6451('0x20')](saveUpdates(_0x1302c8[_0x6451('0x46')],null))['then'](respondWithResult(_0x39a766,null))[_0x6451('0x3f')](handleError(_0x39a766,null));};exports[_0x6451('0x21')]=function(_0x47dec0,_0x385c60){return db[_0x6451('0x28')][_0x6451('0x44')]({'where':{'id':_0x47dec0[_0x6451('0x41')]['id']}})[_0x6451('0x20')](handleEntityNotFound(_0x385c60,null))[_0x6451('0x20')](removeEntity(_0x385c60,null))[_0x6451('0x3f')](handleError(_0x385c60,null));};exports['bulkDestroy']=function(_0x1420c4,_0xb4a682){return db[_0x6451('0x28')][_0x6451('0x21')]({'where':{'id':_0x1420c4['query'][_0x6451('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x6451('0x20')](respondWithResult(_0xb4a682,0xcc))[_0x6451('0x3f')](handleError(_0xb4a682,null));};exports['addFields']=function(_0x4329ab,_0x29f1c6,_0x1e35a4){return db[_0x6451('0x49')][_0x6451('0x4a')]({'where':{'id':_0x4329ab['params']['id']}})[_0x6451('0x20')](handleEntityNotFound(_0x29f1c6,null))['then'](function(_0x5de2c2){if(_0x5de2c2){return db[_0x6451('0x4b')][_0x6451('0x4c')](function(_0x2a94cd){return db['AnalyticFieldReport'][_0x6451('0x21')]({'where':{'CustomReportId':_0x4329ab[_0x6451('0x41')]['id']},'transaction':_0x2a94cd})['then'](function(_0x4cd22d){var _0x44ed34=_['map'](_0x4329ab[_0x6451('0x46')],function(_0x15b752){delete _0x15b752['id'];_0x15b752[_0x6451('0x4d')]=_0x4329ab[_0x6451('0x41')]['id'];return _0x15b752;});return db[_0x6451('0x28')][_0x6451('0x47')](_0x44ed34,{'transaction':_0x2a94cd});});})[_0x6451('0x20')](function(){return db['AnalyticFieldReport'][_0x6451('0x3d')]({'where':{'CustomReportId':_0x4329ab['params']['id']}});});}})[_0x6451('0x20')](respondWithResult(_0x29f1c6,null))[_0x6451('0x3f')](handleError(_0x29f1c6,null));}; \ No newline at end of file +var _0x1507=['end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','create','bulkCreate','body','find','bulkDestroy','destroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','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/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2dbe2e,_0x127139){var _0x2d6400=function(_0x344148){while(--_0x344148){_0x2dbe2e['push'](_0x2dbe2e['shift']());}};_0x2d6400(++_0x127139);}(_0x1507,0xdf));var _0x7150=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x1507[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7150('0x0'));var jsonpatch=require(_0x7150('0x1'));var rp=require(_0x7150('0x2'));var moment=require(_0x7150('0x3'));var BPromise=require(_0x7150('0x4'));var Mustache=require(_0x7150('0x5'));var util=require(_0x7150('0x6'));var path=require(_0x7150('0x7'));var sox=require(_0x7150('0x8'));var csv=require(_0x7150('0x9'));var ejs=require(_0x7150('0xa'));var fs=require('fs');var fs_extra=require(_0x7150('0xb'));var _=require(_0x7150('0xc'));var squel=require(_0x7150('0xd'));var crypto=require('crypto');var jsforce=require(_0x7150('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7150('0xf'));var Papa=require(_0x7150('0x10'));var Redis=require(_0x7150('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7150('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7150('0x13'));var logger=require('../../config/logger')(_0x7150('0x14'));var utils=require(_0x7150('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7150('0x16'));var db=require(_0x7150('0x17'))['db'];function respondWithStatusCode(_0x57b897,_0xf913d7){_0xf913d7=_0xf913d7||0xcc;return function(_0x1dd640){if(_0x1dd640){return _0x57b897[_0x7150('0x18')](_0xf913d7);}return _0x57b897[_0x7150('0x19')](_0xf913d7)[_0x7150('0x1a')]();};}function respondWithResult(_0xb17301,_0x2eaed9){_0x2eaed9=_0x2eaed9||0xc8;return function(_0x1065bd){if(_0x1065bd){return _0xb17301[_0x7150('0x19')](_0x2eaed9)[_0x7150('0x1b')](_0x1065bd);}};}function respondWithFilteredResult(_0x2e483f,_0x5ef2c7){return function(_0x5def86){if(_0x5def86){var _0x4e3c6a=typeof _0x5ef2c7[_0x7150('0x1c')]===_0x7150('0x1d')&&typeof _0x5ef2c7[_0x7150('0x1e')]===_0x7150('0x1d');var _0x1ed6b5=_0x5def86[_0x7150('0x1f')];var _0x4b93d3=_0x4e3c6a?0x0:_0x5ef2c7['offset'];var _0x29e14d=_0x4e3c6a?_0x5def86[_0x7150('0x1f')]:_0x5ef2c7[_0x7150('0x1c')]+_0x5ef2c7['limit'];var _0xf188df;if(_0x29e14d>=_0x1ed6b5){_0x29e14d=_0x1ed6b5;_0xf188df=0xc8;}else{_0xf188df=0xce;}_0x2e483f['status'](_0xf188df);return _0x2e483f[_0x7150('0x20')](_0x7150('0x21'),_0x4b93d3+'-'+_0x29e14d+'/'+_0x1ed6b5)[_0x7150('0x1b')](_0x5def86);}return null;};}function patchUpdates(_0x7d2809){return function(_0x199c94){try{jsonpatch['apply'](_0x199c94,_0x7d2809,!![]);}catch(_0x33d036){return BPromise['reject'](_0x33d036);}return _0x199c94[_0x7150('0x22')]();};}function saveUpdates(_0x160d49,_0x2e3eea){return function(_0x594849){if(_0x594849){return _0x594849[_0x7150('0x23')](_0x160d49)[_0x7150('0x24')](function(_0x3c88a9){return _0x3c88a9;});}return null;};}function removeEntity(_0x190321,_0x24ecc1){return function(_0x30e9a9){if(_0x30e9a9){return _0x30e9a9['destroy']()[_0x7150('0x24')](function(){_0x190321[_0x7150('0x19')](0xcc)[_0x7150('0x1a')]();});}};}function handleEntityNotFound(_0x35d2c9,_0x3fd423){return function(_0x4726e8){if(!_0x4726e8){_0x35d2c9[_0x7150('0x18')](0x194);}return _0x4726e8;};}function handleError(_0x5dd93f,_0xbaebe3){_0xbaebe3=_0xbaebe3||0x1f4;return function(_0x31b1c3){logger[_0x7150('0x25')](_0x31b1c3[_0x7150('0x26')]);if(_0x31b1c3['name']){delete _0x31b1c3[_0x7150('0x27')];}_0x5dd93f['status'](_0xbaebe3)[_0x7150('0x28')](_0x31b1c3);};}exports['index']=function(_0xe15340,_0xe17b06){var _0x203bc0={},_0x5d521c={},_0x397ea9={'count':0x0,'rows':[]};var _0x38d82b=_[_0x7150('0x29')](db[_0x7150('0x2a')][_0x7150('0x2b')],function(_0x16a6da){return{'name':_0x16a6da[_0x7150('0x2c')],'type':_0x16a6da[_0x7150('0x2d')][_0x7150('0x2e')]};});_0x5d521c[_0x7150('0x2f')]=_[_0x7150('0x29')](_0x38d82b,'name');_0x5d521c['query']=_[_0x7150('0x30')](_0xe15340[_0x7150('0x31')]);_0x5d521c[_0x7150('0x32')]=_['intersection'](_0x5d521c[_0x7150('0x2f')],_0x5d521c[_0x7150('0x31')]);_0x203bc0[_0x7150('0x33')]=_['intersection'](_0x5d521c['model'],qs[_0x7150('0x34')](_0xe15340['query'][_0x7150('0x34')]));_0x203bc0['attributes']=_0x203bc0[_0x7150('0x33')]['length']?_0x203bc0['attributes']:_0x5d521c[_0x7150('0x2f')];if(!_0xe15340[_0x7150('0x31')][_0x7150('0x35')](_0x7150('0x36'))){_0x203bc0[_0x7150('0x1e')]=qs[_0x7150('0x1e')](_0xe15340['query'][_0x7150('0x1e')]);_0x203bc0['offset']=qs[_0x7150('0x1c')](_0xe15340[_0x7150('0x31')][_0x7150('0x1c')]);}_0x203bc0['order']=qs['sort'](_0xe15340[_0x7150('0x31')][_0x7150('0x37')]);_0x203bc0[_0x7150('0x38')]=qs[_0x7150('0x32')](_[_0x7150('0x39')](_0xe15340[_0x7150('0x31')],_0x5d521c['filters']),_0x38d82b);if(_0xe15340[_0x7150('0x31')][_0x7150('0x3a')]){_0x203bc0['where']=_['merge'](_0x203bc0[_0x7150('0x38')],{'$or':_[_0x7150('0x29')](_0x38d82b,function(_0x18cecc){if(_0x18cecc[_0x7150('0x2d')]!==_0x7150('0x3b')){var _0x20a33c={};_0x20a33c[_0x18cecc[_0x7150('0x27')]]={'$like':'%'+_0xe15340[_0x7150('0x31')][_0x7150('0x3a')]+'%'};return _0x20a33c;}})});}_0x203bc0=_[_0x7150('0x3c')]({},_0x203bc0,_0xe15340['options']);var _0x37ce94={'where':_0x203bc0[_0x7150('0x38')]};return db['AnalyticFieldReport'][_0x7150('0x1f')](_0x37ce94)[_0x7150('0x24')](function(_0x108d50){_0x397ea9['count']=_0x108d50;if(_0xe15340['query'][_0x7150('0x3d')]){_0x203bc0[_0x7150('0x3e')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x7150('0x3f')](_0x203bc0);})['then'](function(_0x505fd5){_0x397ea9[_0x7150('0x40')]=_0x505fd5;return _0x397ea9;})['then'](respondWithFilteredResult(_0xe17b06,_0x203bc0))[_0x7150('0x41')](handleError(_0xe17b06,null));};exports[_0x7150('0x42')]=function(_0x5a76a4,_0x36f158){var _0x152721={'raw':![],'where':{'id':_0x5a76a4[_0x7150('0x43')]['id']}},_0x45d945={};_0x45d945['model']=_['keys'](db[_0x7150('0x2a')]['rawAttributes']);_0x45d945['query']=_[_0x7150('0x30')](_0x5a76a4['query']);_0x45d945[_0x7150('0x32')]=_['intersection'](_0x45d945[_0x7150('0x2f')],_0x45d945[_0x7150('0x31')]);_0x152721[_0x7150('0x33')]=_[_0x7150('0x44')](_0x45d945[_0x7150('0x2f')],qs[_0x7150('0x34')](_0x5a76a4[_0x7150('0x31')][_0x7150('0x34')]));_0x152721[_0x7150('0x33')]=_0x152721[_0x7150('0x33')][_0x7150('0x45')]?_0x152721[_0x7150('0x33')]:_0x45d945[_0x7150('0x2f')];if(_0x5a76a4[_0x7150('0x31')][_0x7150('0x3d')]){_0x152721['include']=[{'all':!![]}];}_0x152721=_[_0x7150('0x3c')]({},_0x152721,_0x5a76a4[_0x7150('0x46')]);return db[_0x7150('0x2a')]['find'](_0x152721)[_0x7150('0x24')](handleEntityNotFound(_0x36f158,null))['then'](respondWithResult(_0x36f158,null))[_0x7150('0x41')](handleError(_0x36f158,null));};exports[_0x7150('0x47')]=function(_0x497caf,_0x50a689){return db['AnalyticFieldReport']['create'](_0x497caf['body'],{})[_0x7150('0x24')](respondWithResult(_0x50a689,0xc9))[_0x7150('0x41')](handleError(_0x50a689,null));};exports[_0x7150('0x48')]=function(_0x43dd8d,_0xf7dccd){return db['AnalyticFieldReport'][_0x7150('0x48')](_0x43dd8d[_0x7150('0x49')],{'raw':![],'individualHooks':!![]})[_0x7150('0x24')](respondWithResult(_0xf7dccd,0xc9))[_0x7150('0x41')](handleError(_0xf7dccd,null));};exports[_0x7150('0x23')]=function(_0x4591fa,_0x221be7){if(_0x4591fa[_0x7150('0x49')]['id']){delete _0x4591fa[_0x7150('0x49')]['id'];}return db['AnalyticFieldReport'][_0x7150('0x4a')]({'where':{'id':_0x4591fa[_0x7150('0x43')]['id']}})['then'](handleEntityNotFound(_0x221be7,null))[_0x7150('0x24')](saveUpdates(_0x4591fa[_0x7150('0x49')],null))[_0x7150('0x24')](respondWithResult(_0x221be7,null))[_0x7150('0x41')](handleError(_0x221be7,null));};exports['destroy']=function(_0x51630c,_0xc2e711){return db[_0x7150('0x2a')][_0x7150('0x4a')]({'where':{'id':_0x51630c['params']['id']}})[_0x7150('0x24')](handleEntityNotFound(_0xc2e711,null))['then'](removeEntity(_0xc2e711,null))['catch'](handleError(_0xc2e711,null));};exports[_0x7150('0x4b')]=function(_0x5ed409,_0x4a30aa){return db[_0x7150('0x2a')][_0x7150('0x4c')]({'where':{'id':_0x5ed409[_0x7150('0x31')][_0x7150('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0x7150('0x24')](respondWithResult(_0x4a30aa,0xcc))[_0x7150('0x41')](handleError(_0x4a30aa,null));};exports[_0x7150('0x4e')]=function(_0x5ef15f,_0x5aff68,_0x3a9b3f){return db[_0x7150('0x4f')][_0x7150('0x50')]({'where':{'id':_0x5ef15f[_0x7150('0x43')]['id']}})[_0x7150('0x24')](handleEntityNotFound(_0x5aff68,null))['then'](function(_0x176a70){if(_0x176a70){return db[_0x7150('0x51')]['transaction'](function(_0x20b1c5){return db[_0x7150('0x2a')][_0x7150('0x4c')]({'where':{'CustomReportId':_0x5ef15f['params']['id']},'transaction':_0x20b1c5})[_0x7150('0x24')](function(_0x3bd311){var _0x37eb9a=_['map'](_0x5ef15f[_0x7150('0x49')],function(_0x1c4fcc){delete _0x1c4fcc['id'];_0x1c4fcc[_0x7150('0x52')]=_0x5ef15f['params']['id'];return _0x1c4fcc;});return db[_0x7150('0x2a')][_0x7150('0x48')](_0x37eb9a,{'transaction':_0x20b1c5});});})[_0x7150('0x24')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x5ef15f[_0x7150('0x43')]['id']}});});}})[_0x7150('0x24')](respondWithResult(_0x5aff68,null))[_0x7150('0x41')](handleError(_0x5aff68,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 1fb00b5..476c2d5 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 _0xf042=['./analyticFieldReport.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x1604b0,_0x48d196){var _0xf7ee7e=function(_0x368052){while(--_0x368052){_0x1604b0['push'](_0x1604b0['shift']());}};_0xf7ee7e(++_0x48d196);}(_0xf042,0x8f));var _0x2f04=function(_0x589fbe,_0x1aff49){_0x589fbe=_0x589fbe-0x0;var _0xfda1fb=_0xf042[_0x589fbe];return _0xfda1fb;};'use strict';var _=require(_0x2f04('0x0'));var util=require(_0x2f04('0x1'));var logger=require('../../config/logger')(_0x2f04('0x2'));var moment=require(_0x2f04('0x3'));var BPromise=require(_0x2f04('0x4'));var rp=require(_0x2f04('0x5'));var fs=require('fs');var path=require(_0x2f04('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2f04('0x7'));module[_0x2f04('0x8')]=function(_0x51f534,_0x90db24){return _0x51f534[_0x2f04('0x9')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7f0=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0xd7f0,0x1bb));var _0x0d7f=function(_0x4d991a,_0x299835){_0x4d991a=_0x4d991a-0x0;var _0x9a2a94=_0xd7f0[_0x4d991a];return _0x9a2a94;};'use strict';var _=require(_0x0d7f('0x0'));var util=require(_0x0d7f('0x1'));var logger=require(_0x0d7f('0x2'))(_0x0d7f('0x3'));var moment=require(_0x0d7f('0x4'));var BPromise=require(_0x0d7f('0x5'));var rp=require(_0x0d7f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0d7f('0x7'));var attributes=require(_0x0d7f('0x8'));module[_0x0d7f('0x9')]=function(_0x529184,_0x2623a2){return _0x529184[_0x0d7f('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x0d7f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index ca070f0..010fbbe 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 _0x3ef9=['code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','client','request','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4d8906,_0x5e033e){var _0x588c3d=function(_0x15f630){while(--_0x15f630){_0x4d8906['push'](_0x4d8906['shift']());}};_0x588c3d(++_0x5e033e);}(_0x3ef9,0x1f2));var _0x93ef=function(_0x510db3,_0x119a16){_0x510db3=_0x510db3-0x0;var _0x3a7e4d=_0x3ef9[_0x510db3];return _0x3a7e4d;};'use strict';var _=require(_0x93ef('0x0'));var util=require(_0x93ef('0x1'));var moment=require(_0x93ef('0x2'));var BPromise=require('bluebird');var rs=require(_0x93ef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93ef('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x93ef('0x5'));var config=require(_0x93ef('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x93ef('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a146c,_0xd50aa3,_0x5f1967){return new BPromise(function(_0xa5aa62,_0x3d95e2){return client[_0x93ef('0x8')](_0x5a146c,_0x5f1967)['then'](function(_0x350514){logger['info'](_0x93ef('0x9'),_0xd50aa3,_0x93ef('0xa'));logger[_0x93ef('0xb')](_0x93ef('0xc'),_0xd50aa3,_0x93ef('0xa'),JSON[_0x93ef('0xd')](_0x350514));if(_0x350514[_0x93ef('0xe')]){if(_0x350514[_0x93ef('0xe')][_0x93ef('0xf')]===0x1f4){logger[_0x93ef('0xe')](_0x93ef('0x9'),_0xd50aa3,_0x350514['error']['message']);return _0x3d95e2(_0x350514['error'][_0x93ef('0x10')]);}logger['error'](_0x93ef('0x9'),_0xd50aa3,_0x350514['error'][_0x93ef('0x10')]);return _0xa5aa62(_0x350514['error'][_0x93ef('0x10')]);}else{logger['info'](_0x93ef('0x9'),_0xd50aa3,_0x93ef('0xa'));_0xa5aa62(_0x350514[_0x93ef('0x11')][_0x93ef('0x10')]);}})[_0x93ef('0x12')](function(_0x479c62){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0xd50aa3,_0x479c62);_0x3d95e2(_0x479c62);});});} \ No newline at end of file +var _0xc958=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x2129a3,_0x48f17a){var _0x18842b=function(_0x254d06){while(--_0x254d06){_0x2129a3['push'](_0x2129a3['shift']());}};_0x18842b(++_0x48f17a);}(_0xc958,0xd7));var _0x8c95=function(_0x362d44,_0x43c9c7){_0x362d44=_0x362d44-0x0;var _0x2731d1=_0xc958[_0x362d44];return _0x2731d1;};'use strict';var _=require(_0x8c95('0x0'));var util=require(_0x8c95('0x1'));var moment=require(_0x8c95('0x2'));var BPromise=require(_0x8c95('0x3'));var rs=require(_0x8c95('0x4'));var fs=require('fs');var Redis=require(_0x8c95('0x5'));var db=require(_0x8c95('0x6'))['db'];var utils=require(_0x8c95('0x7'));var logger=require(_0x8c95('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8c95('0x9'));var client=jayson[_0x8c95('0xa')][_0x8c95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ecef0,_0x4b8bc9,_0x403b91){return new BPromise(function(_0x1eaa31,_0x4022b8){return client[_0x8c95('0xc')](_0x1ecef0,_0x403b91)[_0x8c95('0xd')](function(_0x5857bc){logger[_0x8c95('0xe')](_0x8c95('0xf'),_0x4b8bc9,_0x8c95('0x10'));logger[_0x8c95('0x11')](_0x8c95('0x12'),_0x4b8bc9,'request\x20sent',JSON['stringify'](_0x5857bc));if(_0x5857bc[_0x8c95('0x13')]){if(_0x5857bc[_0x8c95('0x13')][_0x8c95('0x14')]===0x1f4){logger[_0x8c95('0x13')](_0x8c95('0xf'),_0x4b8bc9,_0x5857bc[_0x8c95('0x13')][_0x8c95('0x15')]);return _0x4022b8(_0x5857bc['error'][_0x8c95('0x15')]);}logger['error'](_0x8c95('0xf'),_0x4b8bc9,_0x5857bc[_0x8c95('0x13')]['message']);return _0x1eaa31(_0x5857bc['error']['message']);}else{logger[_0x8c95('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4b8bc9,_0x8c95('0x10'));_0x1eaa31(_0x5857bc[_0x8c95('0x16')][_0x8c95('0x15')]);}})[_0x8c95('0x17')](function(_0x5e975b){logger[_0x8c95('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4b8bc9,_0x5e975b);_0x4022b8(_0x5e975b);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 9d0010b..b22c2e3 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(_0x380414,_0x4149b1){var _0x5eea14=function(_0x21cab1){while(--_0x21cab1){_0x380414['push'](_0x380414['shift']());}};_0x5eea14(++_0x4149b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x371bf5,_0x4bdad0){var _0x39c21d=function(_0x2702d0){while(--_0x2702d0){_0x371bf5['push'](_0x371bf5['shift']());}};_0x39c21d(++_0x4bdad0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 e5d4ad5..5cb83d8 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 _0xb12d=['STRING','sequelize','exports'];(function(_0x146207,_0x494980){var _0x3f15b8=function(_0x316ac4){while(--_0x316ac4){_0x146207['push'](_0x146207['shift']());}};_0x3f15b8(++_0x494980);}(_0xb12d,0x124));var _0xdb12=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0xb12d[_0x6e1239];return _0x418150;};'use strict';var Sequelize=require(_0xdb12('0x0'));module[_0xdb12('0x1')]={'name':{'type':Sequelize[_0xdb12('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xdb12('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xdb12('0x2')]}}; \ No newline at end of file +var _0xffaa=['sequelize','exports','STRING','TEXT'];(function(_0x261e73,_0x7768f3){var _0x5a1e03=function(_0x560981){while(--_0x560981){_0x261e73['push'](_0x261e73['shift']());}};_0x5a1e03(++_0x7768f3);}(_0xffaa,0x130));var _0xaffa=function(_0x430c5f,_0x1fb159){_0x430c5f=_0x430c5f-0x0;var _0x749624=_0xffaa[_0x430c5f];return _0x749624;};'use strict';var Sequelize=require(_0xaffa('0x0'));module[_0xaffa('0x1')]={'name':{'type':Sequelize[_0xaffa('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xaffa('0x3')]},'description':{'type':Sequelize[_0xaffa('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index fff66b7..4e5e54e 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5cb5cd,_0x6d4a7b){var _0x59caa6=function(_0x39bb7f){while(--_0x39bb7f){_0x5cb5cd['push'](_0x5cb5cd['shift']());}};_0x59caa6(++_0x6d4a7b);}(_0x55ca,0x126));var _0xa55c=function(_0x3e8f4d,_0x2973ed){_0x3e8f4d=_0x3e8f4d-0x0;var _0x590a2e=_0x55ca[_0x3e8f4d];return _0x590a2e;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file +var _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x3491ab,_0x13b16d){var _0x5ab8d2=function(_0xdf063b){while(--_0xdf063b){_0x3491ab['push'](_0x3491ab['shift']());}};_0x5ab8d2(++_0x13b16d);}(_0xe5b3,0x133));var _0x3e5b=function(_0x296295,_0x218428){_0x296295=_0x296295-0x0;var _0x546d2c=_0xe5b3[_0x296295];return _0x546d2c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index b2e69fd..c37b116 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 _0xc627=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x170cbb,_0x9093e){var _0x39fae4=function(_0x120b6b){while(--_0x120b6b){_0x170cbb['push'](_0x170cbb['shift']());}};_0x39fae4(++_0x9093e);}(_0xc627,0x14a));var _0x7c62=function(_0x44729e,_0x13b036){_0x44729e=_0x44729e-0x0;var _0x1876be=_0xc627[_0x44729e];return _0x1876be;};'use strict';var _=require('lodash');var util=require(_0x7c62('0x0'));var logger=require(_0x7c62('0x1'))(_0x7c62('0x2'));var moment=require('moment');var BPromise=require(_0x7c62('0x3'));var rp=require(_0x7c62('0x4'));var fs=require('fs');var path=require(_0x7c62('0x5'));var rimraf=require(_0x7c62('0x6'));var config=require(_0x7c62('0x7'));var attributes=require(_0x7c62('0x8'));module[_0x7c62('0x9')]=function(_0x448f4b,_0x25a5c8){return _0x448f4b[_0x7c62('0xa')](_0x7c62('0xb'),attributes,{'tableName':_0x7c62('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x29eb=['define','AnalyticMetric','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./analyticMetric.attributes','exports'];(function(_0x5150a2,_0x100437){var _0x40263f=function(_0xbdd2aa){while(--_0xbdd2aa){_0x5150a2['push'](_0x5150a2['shift']());}};_0x40263f(++_0x100437);}(_0x29eb,0x1c5));var _0xb29e=function(_0x4e968a,_0x466f96){_0x4e968a=_0x4e968a-0x0;var _0x1ce5e1=_0x29eb[_0x4e968a];return _0x1ce5e1;};'use strict';var _=require(_0xb29e('0x0'));var util=require(_0xb29e('0x1'));var logger=require(_0xb29e('0x2'))('api');var moment=require(_0xb29e('0x3'));var BPromise=require(_0xb29e('0x4'));var rp=require(_0xb29e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb29e('0x6'));var config=require('../../config/environment');var attributes=require(_0xb29e('0x7'));module[_0xb29e('0x8')]=function(_0x3426f3,_0x2e216f){return _0x3426f3[_0xb29e('0x9')](_0xb29e('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index cdbd34c..a7c8007 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 _0xc21c=['../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x189381,_0x2825dd){var _0xcb8c3=function(_0x37574a){while(--_0x37574a){_0x189381['push'](_0x189381['shift']());}};_0xcb8c3(++_0x2825dd);}(_0xc21c,0xcb));var _0xcc21=function(_0x305d9d,_0x4bd49f){_0x305d9d=_0x305d9d-0x0;var _0x37ea21=_0xc21c[_0x305d9d];return _0x37ea21;};'use strict';var _=require(_0xcc21('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcc21('0x1'));var rs=require(_0xcc21('0x2'));var fs=require('fs');var Redis=require(_0xcc21('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc21('0x4'));var logger=require(_0xcc21('0x5'))(_0xcc21('0x6'));var config=require(_0xcc21('0x7'));var jayson=require(_0xcc21('0x8'));var client=jayson[_0xcc21('0x9')][_0xcc21('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x302378,_0xaef0a5,_0x59a683){return new BPromise(function(_0x17fca9,_0x4dead6){return client[_0xcc21('0xb')](_0x302378,_0x59a683)[_0xcc21('0xc')](function(_0x3aa370){logger['info'](_0xcc21('0xd'),_0xaef0a5,_0xcc21('0xe'));logger['debug'](_0xcc21('0xf'),_0xaef0a5,_0xcc21('0xe'),JSON[_0xcc21('0x10')](_0x3aa370));if(_0x3aa370[_0xcc21('0x11')]){if(_0x3aa370[_0xcc21('0x11')]['code']===0x1f4){logger[_0xcc21('0x11')](_0xcc21('0xd'),_0xaef0a5,_0x3aa370[_0xcc21('0x11')][_0xcc21('0x12')]);return _0x4dead6(_0x3aa370[_0xcc21('0x11')][_0xcc21('0x12')]);}logger[_0xcc21('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0xaef0a5,_0x3aa370[_0xcc21('0x11')]['message']);return _0x17fca9(_0x3aa370[_0xcc21('0x11')][_0xcc21('0x12')]);}else{logger['info'](_0xcc21('0xd'),_0xaef0a5,_0xcc21('0xe'));_0x17fca9(_0x3aa370[_0xcc21('0x13')][_0xcc21('0x12')]);}})[_0xcc21('0x14')](function(_0x215cd3){logger[_0xcc21('0x11')](_0xcc21('0xd'),_0xaef0a5,_0x215cd3);_0x4dead6(_0x215cd3);});});} \ No newline at end of file +var _0xeb9a=['then','info','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticMetric,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x54de3d,_0x3a0f83){var _0x175fcd=function(_0x5d231d){while(--_0x5d231d){_0x54de3d['push'](_0x54de3d['shift']());}};_0x175fcd(++_0x3a0f83);}(_0xeb9a,0x87));var _0xaeb9=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xeb9a[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0xaeb9('0x0'));var util=require(_0xaeb9('0x1'));var moment=require(_0xaeb9('0x2'));var BPromise=require('bluebird');var rs=require(_0xaeb9('0x3'));var fs=require('fs');var Redis=require(_0xaeb9('0x4'));var db=require(_0xaeb9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaeb9('0x6'))(_0xaeb9('0x7'));var config=require(_0xaeb9('0x8'));var jayson=require(_0xaeb9('0x9'));var client=jayson[_0xaeb9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x147adb,_0x82024a,_0x244e16){return new BPromise(function(_0x388f24,_0x2be7ae){return client[_0xaeb9('0xb')](_0x147adb,_0x244e16)[_0xaeb9('0xc')](function(_0x260cb4){logger[_0xaeb9('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x82024a,'request\x20sent');logger['debug'](_0xaeb9('0xe'),_0x82024a,_0xaeb9('0xf'),JSON[_0xaeb9('0x10')](_0x260cb4));if(_0x260cb4[_0xaeb9('0x11')]){if(_0x260cb4[_0xaeb9('0x11')]['code']===0x1f4){logger[_0xaeb9('0x11')](_0xaeb9('0x12'),_0x82024a,_0x260cb4[_0xaeb9('0x11')][_0xaeb9('0x13')]);return _0x2be7ae(_0x260cb4[_0xaeb9('0x11')][_0xaeb9('0x13')]);}logger['error'](_0xaeb9('0x12'),_0x82024a,_0x260cb4[_0xaeb9('0x11')][_0xaeb9('0x13')]);return _0x388f24(_0x260cb4['error'][_0xaeb9('0x13')]);}else{logger[_0xaeb9('0xd')](_0xaeb9('0x12'),_0x82024a,_0xaeb9('0xf'));_0x388f24(_0x260cb4[_0xaeb9('0x14')][_0xaeb9('0x13')]);}})['catch'](function(_0x1cd0d7){logger[_0xaeb9('0x11')](_0xaeb9('0x12'),_0x82024a,_0x1cd0d7);_0x2be7ae(_0x1cd0d7);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f538bc0..b71a2a6 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 _0x14f5=['express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','util','connect-timeout'];(function(_0x146d85,_0x5ef426){var _0x3da482=function(_0xd844cd){while(--_0xd844cd){_0x146d85['push'](_0x146d85['shift']());}};_0x3da482(++_0x5ef426);}(_0x14f5,0xae));var _0x514f=function(_0x519554,_0x17e6b1){_0x519554=_0x519554-0x0;var _0xf68f51=_0x14f5[_0x519554];return _0xf68f51;};'use strict';var multer=require('multer');var util=require(_0x514f('0x0'));var path=require('path');var timeout=require(_0x514f('0x1'));var express=require(_0x514f('0x2'));var router=express[_0x514f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x514f('0x4'));var interaction=require(_0x514f('0x5'));var config=require('../../config/environment');var controller=require(_0x514f('0x6'));router[_0x514f('0x7')]('/',auth[_0x514f('0x8')](),controller[_0x514f('0x9')]);router[_0x514f('0x7')](_0x514f('0xa'),auth[_0x514f('0x8')](),controller['show']);router[_0x514f('0xb')]('/',auth['isAuthenticated'](),controller[_0x514f('0xc')]);router[_0x514f('0xd')](_0x514f('0xa'),auth[_0x514f('0x8')](),controller[_0x514f('0xe')]);router[_0x514f('0xf')](_0x514f('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4f5a=['destroy','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','put','update'];(function(_0x2499dc,_0x237995){var _0x47f07=function(_0x9a1853){while(--_0x9a1853){_0x2499dc['push'](_0x2499dc['shift']());}};_0x47f07(++_0x237995);}(_0x4f5a,0xaa));var _0xa4f5=function(_0x4aadc8,_0x311481){_0x4aadc8=_0x4aadc8-0x0;var _0x96db0e=_0x4f5a[_0x4aadc8];return _0x96db0e;};'use strict';var multer=require(_0xa4f5('0x0'));var util=require(_0xa4f5('0x1'));var path=require('path');var timeout=require(_0xa4f5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa4f5('0x3'));var config=require(_0xa4f5('0x4'));var controller=require('./analyticMetric.controller');router[_0xa4f5('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa4f5('0x6'),auth[_0xa4f5('0x7')](),controller[_0xa4f5('0x8')]);router[_0xa4f5('0x9')]('/',auth[_0xa4f5('0x7')](),controller['create']);router[_0xa4f5('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xa4f5('0xb')]);router['delete'](_0xa4f5('0x6'),auth[_0xa4f5('0x7')](),controller[_0xa4f5('0xc')]);module[_0xa4f5('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 67de44b..97dd9f3 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 _0x3cd1=['exports','TEXT'];(function(_0x3eddfa,_0x45950e){var _0x21a5fe=function(_0x1adaa9){while(--_0x1adaa9){_0x3eddfa['push'](_0x3eddfa['shift']());}};_0x21a5fe(++_0x45950e);}(_0x3cd1,0x112));var _0x13cd=function(_0x751d96,_0x4fde3f){_0x751d96=_0x751d96-0x0;var _0x20b0d4=_0x3cd1[_0x751d96];return _0x20b0d4;};'use strict';var Sequelize=require('sequelize');module[_0x13cd('0x0')]={'tree':{'type':Sequelize[_0x13cd('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3a2b=['TEXT','sequelize','exports'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0x3a2b,0x13c));var _0xb3a2=function(_0x2388bf,_0x1a5d51){_0x2388bf=_0x2388bf-0x0;var _0xaf8da9=_0x3a2b[_0x2388bf];return _0xaf8da9;};'use strict';var Sequelize=require(_0xb3a2('0x0'));module[_0xb3a2('0x1')]={'tree':{'type':Sequelize[_0xb3a2('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 1a01778..f1fb4b8 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 _0x1803=['crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','name','send','map','AnalyticTreeReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x4a896d,_0x186812){var _0x55b94b=function(_0x57e052){while(--_0x57e052){_0x4a896d['push'](_0x4a896d['shift']());}};_0x55b94b(++_0x186812);}(_0x1803,0x1f2));var _0x3180=function(_0x37a66c,_0x29d8f4){_0x37a66c=_0x37a66c-0x0;var _0x190911=_0x1803[_0x37a66c];return _0x190911;};'use strict';var emlformat=require(_0x3180('0x0'));var rimraf=require(_0x3180('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3180('0x2'));var rp=require('request-promise');var moment=require(_0x3180('0x3'));var BPromise=require(_0x3180('0x4'));var Mustache=require(_0x3180('0x5'));var util=require(_0x3180('0x6'));var path=require(_0x3180('0x7'));var sox=require(_0x3180('0x8'));var csv=require('to-csv');var ejs=require(_0x3180('0x9'));var fs=require('fs');var fs_extra=require(_0x3180('0xa'));var _=require(_0x3180('0xb'));var squel=require(_0x3180('0xc'));var crypto=require(_0x3180('0xd'));var jsforce=require(_0x3180('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3180('0xf'));var querystring=require(_0x3180('0x10'));var Papa=require(_0x3180('0x11'));var Redis=require(_0x3180('0x12'));var authService=require(_0x3180('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3180('0x14'));var logger=require(_0x3180('0x15'))(_0x3180('0x16'));var utils=require('../../config/utils');var config=require(_0x3180('0x17'));var licenseUtil=require(_0x3180('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x352a24,_0x382373){_0x382373=_0x382373||0xcc;return function(_0x138130){if(_0x138130){return _0x352a24[_0x3180('0x19')](_0x382373);}return _0x352a24['status'](_0x382373)[_0x3180('0x1a')]();};}function respondWithResult(_0x3dc208,_0x11641d){_0x11641d=_0x11641d||0xc8;return function(_0x2f275a){if(_0x2f275a){return _0x3dc208[_0x3180('0x1b')](_0x11641d)['json'](_0x2f275a);}};}function respondWithFilteredResult(_0x52b920,_0x394bfe){return function(_0x12c1fe){if(_0x12c1fe){var _0x5503f6=typeof _0x394bfe['offset']==='undefined'&&typeof _0x394bfe[_0x3180('0x1c')]===_0x3180('0x1d');var _0x12379a=_0x12c1fe[_0x3180('0x1e')];var _0x474ac4=_0x5503f6?0x0:_0x394bfe[_0x3180('0x1f')];var _0x3ccf63=_0x5503f6?_0x12c1fe['count']:_0x394bfe[_0x3180('0x1f')]+_0x394bfe['limit'];var _0x2aa541;if(_0x3ccf63>=_0x12379a){_0x3ccf63=_0x12379a;_0x2aa541=0xc8;}else{_0x2aa541=0xce;}_0x52b920['status'](_0x2aa541);return _0x52b920[_0x3180('0x20')](_0x3180('0x21'),_0x474ac4+'-'+_0x3ccf63+'/'+_0x12379a)['json'](_0x12c1fe);}return null;};}function patchUpdates(_0x28a9d7){return function(_0x4f52ad){try{jsonpatch[_0x3180('0x22')](_0x4f52ad,_0x28a9d7,!![]);}catch(_0x344c4f){return BPromise[_0x3180('0x23')](_0x344c4f);}return _0x4f52ad['save']();};}function saveUpdates(_0x27c69e,_0x2a60ed){return function(_0x4a2342){if(_0x4a2342){return _0x4a2342[_0x3180('0x24')](_0x27c69e)[_0x3180('0x25')](function(_0x5a9f83){return _0x5a9f83;});}return null;};}function removeEntity(_0x36dbed,_0x478dce){return function(_0x4a2cf1){if(_0x4a2cf1){return _0x4a2cf1[_0x3180('0x26')]()[_0x3180('0x25')](function(){_0x36dbed[_0x3180('0x1b')](0xcc)[_0x3180('0x1a')]();});}};}function handleEntityNotFound(_0x38e874,_0xbe5aef){return function(_0x5a29e7){if(!_0x5a29e7){_0x38e874['sendStatus'](0x194);}return _0x5a29e7;};}function handleError(_0x2a80a8,_0x4023dc){_0x4023dc=_0x4023dc||0x1f4;return function(_0x48a36c){logger['error'](_0x48a36c['stack']);if(_0x48a36c[_0x3180('0x27')]){delete _0x48a36c[_0x3180('0x27')];}_0x2a80a8['status'](_0x4023dc)[_0x3180('0x28')](_0x48a36c);};}exports['index']=function(_0xad9fa7,_0x2696f5){var _0x5cc875={},_0x366134={},_0x3598f2={'count':0x0,'rows':[]};var _0x5f4227=_[_0x3180('0x29')](db[_0x3180('0x2a')]['rawAttributes'],function(_0x27a78c){return{'name':_0x27a78c[_0x3180('0x2b')],'type':_0x27a78c[_0x3180('0x2c')][_0x3180('0x2d')]};});_0x366134[_0x3180('0x2e')]=_[_0x3180('0x29')](_0x5f4227,'name');_0x366134[_0x3180('0x2f')]=_[_0x3180('0x30')](_0xad9fa7[_0x3180('0x2f')]);_0x366134[_0x3180('0x31')]=_[_0x3180('0x32')](_0x366134['model'],_0x366134[_0x3180('0x2f')]);_0x5cc875[_0x3180('0x33')]=_[_0x3180('0x32')](_0x366134[_0x3180('0x2e')],qs[_0x3180('0x34')](_0xad9fa7[_0x3180('0x2f')][_0x3180('0x34')]));_0x5cc875['attributes']=_0x5cc875[_0x3180('0x33')][_0x3180('0x35')]?_0x5cc875[_0x3180('0x33')]:_0x366134[_0x3180('0x2e')];if(!_0xad9fa7[_0x3180('0x2f')][_0x3180('0x36')](_0x3180('0x37'))){_0x5cc875[_0x3180('0x1c')]=qs[_0x3180('0x1c')](_0xad9fa7[_0x3180('0x2f')]['limit']);_0x5cc875[_0x3180('0x1f')]=qs['offset'](_0xad9fa7[_0x3180('0x2f')]['offset']);}_0x5cc875[_0x3180('0x38')]=qs[_0x3180('0x39')](_0xad9fa7[_0x3180('0x2f')][_0x3180('0x39')]);_0x5cc875[_0x3180('0x3a')]=qs[_0x3180('0x31')](_[_0x3180('0x3b')](_0xad9fa7[_0x3180('0x2f')],_0x366134[_0x3180('0x31')]),_0x5f4227);if(_0xad9fa7[_0x3180('0x2f')]['filter']){_0x5cc875[_0x3180('0x3a')]=_[_0x3180('0x3c')](_0x5cc875[_0x3180('0x3a')],{'$or':_['map'](_0x5f4227,function(_0x2a885a){if(_0x2a885a[_0x3180('0x2c')]!==_0x3180('0x3d')){var _0x228ddb={};_0x228ddb[_0x2a885a['name']]={'$like':'%'+_0xad9fa7[_0x3180('0x2f')]['filter']+'%'};return _0x228ddb;}})});}_0x5cc875=_[_0x3180('0x3c')]({},_0x5cc875,_0xad9fa7[_0x3180('0x3e')]);var _0x14877e={'where':_0x5cc875[_0x3180('0x3a')]};return db[_0x3180('0x2a')]['count'](_0x14877e)[_0x3180('0x25')](function(_0x5437ba){_0x3598f2[_0x3180('0x1e')]=_0x5437ba;if(_0xad9fa7[_0x3180('0x2f')]['includeAll']){_0x5cc875[_0x3180('0x3f')]=[{'all':!![]}];}return db[_0x3180('0x2a')][_0x3180('0x40')](_0x5cc875);})['then'](function(_0x3279f7){_0x3598f2[_0x3180('0x41')]=_0x3279f7;return _0x3598f2;})[_0x3180('0x25')](respondWithFilteredResult(_0x2696f5,_0x5cc875))[_0x3180('0x42')](handleError(_0x2696f5,null));};exports['show']=function(_0x53f8d8,_0x3f2a41){var _0x475631={'raw':!![],'where':{'id':_0x53f8d8[_0x3180('0x43')]['id']}},_0x1a6449={};_0x1a6449[_0x3180('0x2e')]=_[_0x3180('0x30')](db[_0x3180('0x2a')][_0x3180('0x44')]);_0x1a6449['query']=_[_0x3180('0x30')](_0x53f8d8[_0x3180('0x2f')]);_0x1a6449['filters']=_[_0x3180('0x32')](_0x1a6449[_0x3180('0x2e')],_0x1a6449['query']);_0x475631[_0x3180('0x33')]=_[_0x3180('0x32')](_0x1a6449['model'],qs['fields'](_0x53f8d8[_0x3180('0x2f')]['fields']));_0x475631['attributes']=_0x475631[_0x3180('0x33')][_0x3180('0x35')]?_0x475631['attributes']:_0x1a6449[_0x3180('0x2e')];if(_0x53f8d8[_0x3180('0x2f')][_0x3180('0x45')]){_0x475631[_0x3180('0x3f')]=[{'all':!![]}];}_0x475631=_[_0x3180('0x3c')]({},_0x475631,_0x53f8d8[_0x3180('0x3e')]);return db[_0x3180('0x2a')][_0x3180('0x46')](_0x475631)[_0x3180('0x25')](handleEntityNotFound(_0x3f2a41,null))[_0x3180('0x25')](respondWithResult(_0x3f2a41,null))[_0x3180('0x42')](handleError(_0x3f2a41,null));};exports[_0x3180('0x47')]=function(_0x5b3ff5,_0x3c0ac4){return db[_0x3180('0x2a')]['create'](_0x5b3ff5[_0x3180('0x48')],{})[_0x3180('0x25')](respondWithResult(_0x3c0ac4,0xc9))['catch'](handleError(_0x3c0ac4,null));};exports[_0x3180('0x24')]=function(_0x4e476d,_0x4e2e43){if(_0x4e476d[_0x3180('0x48')]['id']){delete _0x4e476d[_0x3180('0x48')]['id'];}return db[_0x3180('0x2a')][_0x3180('0x46')]({'where':{'id':_0x4e476d['params']['id']}})[_0x3180('0x25')](handleEntityNotFound(_0x4e2e43,null))[_0x3180('0x25')](saveUpdates(_0x4e476d['body'],null))[_0x3180('0x25')](respondWithResult(_0x4e2e43,null))[_0x3180('0x42')](handleError(_0x4e2e43,null));};exports[_0x3180('0x26')]=function(_0x4518c3,_0x100da7){return db[_0x3180('0x2a')][_0x3180('0x46')]({'where':{'id':_0x4518c3[_0x3180('0x43')]['id']}})['then'](handleEntityNotFound(_0x100da7,null))[_0x3180('0x25')](removeEntity(_0x100da7,null))[_0x3180('0x42')](handleError(_0x100da7,null));}; \ No newline at end of file +var _0x7168=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','count','limit','Content-Range','json','apply','save','then','end','sendStatus','error','name','send','index','AnalyticTreeReport','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','find','create','body','params','destroy','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse'];(function(_0x247d58,_0x599006){var _0xd28d2e=function(_0x4bdd55){while(--_0x4bdd55){_0x247d58['push'](_0x247d58['shift']());}};_0xd28d2e(++_0x599006);}(_0x7168,0x1ea));var _0x8716=function(_0x4dec6f,_0x5c679b){_0x4dec6f=_0x4dec6f-0x0;var _0x84fec7=_0x7168[_0x4dec6f];return _0x84fec7;};'use strict';var emlformat=require(_0x8716('0x0'));var rimraf=require(_0x8716('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8716('0x2'));var moment=require(_0x8716('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8716('0x4'));var util=require(_0x8716('0x5'));var path=require('path');var sox=require(_0x8716('0x6'));var csv=require(_0x8716('0x7'));var ejs=require(_0x8716('0x8'));var fs=require('fs');var fs_extra=require(_0x8716('0x9'));var _=require('lodash');var squel=require(_0x8716('0xa'));var crypto=require(_0x8716('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8716('0xc'));var toCsv=require(_0x8716('0x7'));var querystring=require('querystring');var Papa=require(_0x8716('0xd'));var Redis=require(_0x8716('0xe'));var authService=require(_0x8716('0xf'));var qs=require(_0x8716('0x10'));var as=require(_0x8716('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8716('0x12'))(_0x8716('0x13'));var utils=require(_0x8716('0x14'));var config=require(_0x8716('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8716('0x16'))['db'];function respondWithStatusCode(_0x25143e,_0xb39877){_0xb39877=_0xb39877||0xcc;return function(_0x17bc19){if(_0x17bc19){return _0x25143e['sendStatus'](_0xb39877);}return _0x25143e[_0x8716('0x17')](_0xb39877)['end']();};}function respondWithResult(_0x1c601a,_0x3ec4a5){_0x3ec4a5=_0x3ec4a5||0xc8;return function(_0x57a9bc){if(_0x57a9bc){return _0x1c601a[_0x8716('0x17')](_0x3ec4a5)['json'](_0x57a9bc);}};}function respondWithFilteredResult(_0x39c462,_0x55314d){return function(_0x59c233){if(_0x59c233){var _0x9c54bc=typeof _0x55314d[_0x8716('0x18')]===_0x8716('0x19')&&typeof _0x55314d['limit']===_0x8716('0x19');var _0x4ee1c8=_0x59c233[_0x8716('0x1a')];var _0x49cb83=_0x9c54bc?0x0:_0x55314d[_0x8716('0x18')];var _0x32ab8f=_0x9c54bc?_0x59c233['count']:_0x55314d[_0x8716('0x18')]+_0x55314d[_0x8716('0x1b')];var _0x48b05d;if(_0x32ab8f>=_0x4ee1c8){_0x32ab8f=_0x4ee1c8;_0x48b05d=0xc8;}else{_0x48b05d=0xce;}_0x39c462[_0x8716('0x17')](_0x48b05d);return _0x39c462['set'](_0x8716('0x1c'),_0x49cb83+'-'+_0x32ab8f+'/'+_0x4ee1c8)[_0x8716('0x1d')](_0x59c233);}return null;};}function patchUpdates(_0x53b021){return function(_0x3cc87c){try{jsonpatch[_0x8716('0x1e')](_0x3cc87c,_0x53b021,!![]);}catch(_0x4010db){return BPromise['reject'](_0x4010db);}return _0x3cc87c[_0x8716('0x1f')]();};}function saveUpdates(_0x2f2654,_0x124bca){return function(_0x5c7f73){if(_0x5c7f73){return _0x5c7f73['update'](_0x2f2654)[_0x8716('0x20')](function(_0x46aff6){return _0x46aff6;});}return null;};}function removeEntity(_0xed545b,_0x29e097){return function(_0x406e7c){if(_0x406e7c){return _0x406e7c['destroy']()[_0x8716('0x20')](function(){_0xed545b['status'](0xcc)[_0x8716('0x21')]();});}};}function handleEntityNotFound(_0x1ee155,_0x153563){return function(_0x168888){if(!_0x168888){_0x1ee155[_0x8716('0x22')](0x194);}return _0x168888;};}function handleError(_0x3a262b,_0x4c8920){_0x4c8920=_0x4c8920||0x1f4;return function(_0x5caf9c){logger[_0x8716('0x23')](_0x5caf9c['stack']);if(_0x5caf9c[_0x8716('0x24')]){delete _0x5caf9c['name'];}_0x3a262b[_0x8716('0x17')](_0x4c8920)[_0x8716('0x25')](_0x5caf9c);};}exports[_0x8716('0x26')]=function(_0x483539,_0x26aeb3){var _0x322a43={},_0x45516b={},_0x4ca94a={'count':0x0,'rows':[]};var _0x21fd09=_['map'](db[_0x8716('0x27')]['rawAttributes'],function(_0x2f8cbb){return{'name':_0x2f8cbb['fieldName'],'type':_0x2f8cbb[_0x8716('0x28')][_0x8716('0x29')]};});_0x45516b[_0x8716('0x2a')]=_[_0x8716('0x2b')](_0x21fd09,'name');_0x45516b[_0x8716('0x2c')]=_['keys'](_0x483539[_0x8716('0x2c')]);_0x45516b[_0x8716('0x2d')]=_[_0x8716('0x2e')](_0x45516b[_0x8716('0x2a')],_0x45516b[_0x8716('0x2c')]);_0x322a43[_0x8716('0x2f')]=_['intersection'](_0x45516b[_0x8716('0x2a')],qs[_0x8716('0x30')](_0x483539[_0x8716('0x2c')][_0x8716('0x30')]));_0x322a43[_0x8716('0x2f')]=_0x322a43['attributes'][_0x8716('0x31')]?_0x322a43[_0x8716('0x2f')]:_0x45516b[_0x8716('0x2a')];if(!_0x483539[_0x8716('0x2c')][_0x8716('0x32')](_0x8716('0x33'))){_0x322a43[_0x8716('0x1b')]=qs['limit'](_0x483539['query'][_0x8716('0x1b')]);_0x322a43[_0x8716('0x18')]=qs[_0x8716('0x18')](_0x483539[_0x8716('0x2c')][_0x8716('0x18')]);}_0x322a43[_0x8716('0x34')]=qs['sort'](_0x483539[_0x8716('0x2c')][_0x8716('0x35')]);_0x322a43[_0x8716('0x36')]=qs[_0x8716('0x2d')](_['pick'](_0x483539['query'],_0x45516b['filters']),_0x21fd09);if(_0x483539[_0x8716('0x2c')][_0x8716('0x37')]){_0x322a43['where']=_[_0x8716('0x38')](_0x322a43['where'],{'$or':_[_0x8716('0x2b')](_0x21fd09,function(_0x16e732){if(_0x16e732[_0x8716('0x28')]!==_0x8716('0x39')){var _0x43b122={};_0x43b122[_0x16e732[_0x8716('0x24')]]={'$like':'%'+_0x483539[_0x8716('0x2c')]['filter']+'%'};return _0x43b122;}})});}_0x322a43=_[_0x8716('0x38')]({},_0x322a43,_0x483539[_0x8716('0x3a')]);var _0x5ef351={'where':_0x322a43['where']};return db[_0x8716('0x27')][_0x8716('0x1a')](_0x5ef351)[_0x8716('0x20')](function(_0x35201d){_0x4ca94a[_0x8716('0x1a')]=_0x35201d;if(_0x483539[_0x8716('0x2c')][_0x8716('0x3b')]){_0x322a43[_0x8716('0x3c')]=[{'all':!![]}];}return db[_0x8716('0x27')][_0x8716('0x3d')](_0x322a43);})[_0x8716('0x20')](function(_0x59876e){_0x4ca94a[_0x8716('0x3e')]=_0x59876e;return _0x4ca94a;})[_0x8716('0x20')](respondWithFilteredResult(_0x26aeb3,_0x322a43))[_0x8716('0x3f')](handleError(_0x26aeb3,null));};exports[_0x8716('0x40')]=function(_0x5d4e5a,_0x3af137){var _0x4c9b39={'raw':!![],'where':{'id':_0x5d4e5a['params']['id']}},_0x2522be={};_0x2522be[_0x8716('0x2a')]=_['keys'](db['AnalyticTreeReport'][_0x8716('0x41')]);_0x2522be[_0x8716('0x2c')]=_[_0x8716('0x42')](_0x5d4e5a['query']);_0x2522be[_0x8716('0x2d')]=_[_0x8716('0x2e')](_0x2522be[_0x8716('0x2a')],_0x2522be[_0x8716('0x2c')]);_0x4c9b39[_0x8716('0x2f')]=_[_0x8716('0x2e')](_0x2522be[_0x8716('0x2a')],qs[_0x8716('0x30')](_0x5d4e5a[_0x8716('0x2c')][_0x8716('0x30')]));_0x4c9b39['attributes']=_0x4c9b39[_0x8716('0x2f')][_0x8716('0x31')]?_0x4c9b39[_0x8716('0x2f')]:_0x2522be['model'];if(_0x5d4e5a[_0x8716('0x2c')][_0x8716('0x3b')]){_0x4c9b39[_0x8716('0x3c')]=[{'all':!![]}];}_0x4c9b39=_[_0x8716('0x38')]({},_0x4c9b39,_0x5d4e5a[_0x8716('0x3a')]);return db[_0x8716('0x27')][_0x8716('0x43')](_0x4c9b39)[_0x8716('0x20')](handleEntityNotFound(_0x3af137,null))[_0x8716('0x20')](respondWithResult(_0x3af137,null))[_0x8716('0x3f')](handleError(_0x3af137,null));};exports[_0x8716('0x44')]=function(_0x5aaca1,_0x26ffd7){return db[_0x8716('0x27')][_0x8716('0x44')](_0x5aaca1[_0x8716('0x45')],{})[_0x8716('0x20')](respondWithResult(_0x26ffd7,0xc9))[_0x8716('0x3f')](handleError(_0x26ffd7,null));};exports['update']=function(_0x252cf1,_0xfd7df){if(_0x252cf1[_0x8716('0x45')]['id']){delete _0x252cf1[_0x8716('0x45')]['id'];}return db[_0x8716('0x27')][_0x8716('0x43')]({'where':{'id':_0x252cf1[_0x8716('0x46')]['id']}})[_0x8716('0x20')](handleEntityNotFound(_0xfd7df,null))[_0x8716('0x20')](saveUpdates(_0x252cf1['body'],null))['then'](respondWithResult(_0xfd7df,null))[_0x8716('0x3f')](handleError(_0xfd7df,null));};exports[_0x8716('0x47')]=function(_0x3213f4,_0x5a3d5e){return db[_0x8716('0x27')][_0x8716('0x43')]({'where':{'id':_0x3213f4['params']['id']}})[_0x8716('0x20')](handleEntityNotFound(_0x5a3d5e,null))[_0x8716('0x20')](removeEntity(_0x5a3d5e,null))[_0x8716('0x3f')](handleError(_0x5a3d5e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index a3b139a..d5a4e73 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 _0xdffd=['./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','bluebird','request-promise','../../config/environment'];(function(_0x47859f,_0x1129cd){var _0x426044=function(_0x5ad499){while(--_0x5ad499){_0x47859f['push'](_0x47859f['shift']());}};_0x426044(++_0x1129cd);}(_0xdffd,0x144));var _0xddff=function(_0x307446,_0x399ee0){_0x307446=_0x307446-0x0;var _0x25ee94=_0xdffd[_0x307446];return _0x25ee94;};'use strict';var _=require(_0xddff('0x0'));var util=require(_0xddff('0x1'));var logger=require('../../config/logger')(_0xddff('0x2'));var moment=require('moment');var BPromise=require(_0xddff('0x3'));var rp=require(_0xddff('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xddff('0x5'));var attributes=require(_0xddff('0x6'));module[_0xddff('0x7')]=function(_0x43686f,_0x4fe9c1){return _0x43686f[_0xddff('0x8')](_0xddff('0x9'),attributes,{'tableName':_0xddff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03c5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','AnalyticTreeReport','analytics_report_trees'];(function(_0x152136,_0x4f14f1){var _0x20df44=function(_0x362877){while(--_0x362877){_0x152136['push'](_0x152136['shift']());}};_0x20df44(++_0x4f14f1);}(_0x03c5,0x174));var _0x503c=function(_0x28407a,_0x2a7269){_0x28407a=_0x28407a-0x0;var _0x8bd6ef=_0x03c5[_0x28407a];return _0x8bd6ef;};'use strict';var _=require('lodash');var util=require(_0x503c('0x0'));var logger=require(_0x503c('0x1'))(_0x503c('0x2'));var moment=require(_0x503c('0x3'));var BPromise=require(_0x503c('0x4'));var rp=require(_0x503c('0x5'));var fs=require('fs');var path=require(_0x503c('0x6'));var rimraf=require(_0x503c('0x7'));var config=require(_0x503c('0x8'));var attributes=require(_0x503c('0x9'));module['exports']=function(_0x49720b,_0x6e94b2){return _0x49720b['define'](_0x503c('0xa'),attributes,{'tableName':_0x503c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 94fa2ec..70c41d5 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x26fcec,_0x151800){var _0x3b1f26=function(_0x658104){while(--_0x658104){_0x26fcec['push'](_0x26fcec['shift']());}};_0x3b1f26(++_0x151800);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1987ca,_0x29497d){_0x1987ca=_0x1987ca-0x0;var _0x3a4b91=_0x5f2f[_0x1987ca];return _0x3a4b91;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\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(_0x350119,_0x3db5eb){var _0x297b6e=function(_0x515def){while(--_0x515def){_0x350119['push'](_0x350119['shift']());}};_0x297b6e(++_0x3db5eb);}(_0x1261,0x144));var _0x1126=function(_0x3a833e,_0x5a1878){_0x3a833e=_0x3a833e-0x0;var _0xdff445=_0x1261[_0x3a833e];return _0xdff445;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 676a2ba..5a4f015 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 _0x7db4=['delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','put'];(function(_0x20f363,_0x4a10fc){var _0x126a1e=function(_0x3450e1){while(--_0x3450e1){_0x20f363['push'](_0x20f363['shift']());}};_0x126a1e(++_0x4a10fc);}(_0x7db4,0x103));var _0x47db=function(_0x44cf8a,_0x25b667){_0x44cf8a=_0x44cf8a-0x0;var _0x41d2e3=_0x7db4[_0x44cf8a];return _0x41d2e3;};'use strict';var multer=require('multer');var util=require(_0x47db('0x0'));var path=require(_0x47db('0x1'));var timeout=require(_0x47db('0x2'));var express=require(_0x47db('0x3'));var router=express[_0x47db('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47db('0x5'));var interaction=require(_0x47db('0x6'));var config=require(_0x47db('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x47db('0x8')]('/',auth[_0x47db('0x9')](),controller['index']);router[_0x47db('0x8')]('/:id',auth[_0x47db('0x9')](),controller[_0x47db('0xa')]);router[_0x47db('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x47db('0xc')]('/:id',auth[_0x47db('0x9')](),controller['update']);router[_0x47db('0xd')](_0x47db('0xe'),auth['isAuthenticated'](),controller[_0x47db('0xf')]);module[_0x47db('0x10')]=router; \ No newline at end of file +var _0xdfc6=['create','put','/:id','update','destroy','exports','multer','util','express','Router','fs-extra','../../config/environment','get','isAuthenticated','show','post'];(function(_0x506d6d,_0xf98ca2){var _0x46b446=function(_0x89ed30){while(--_0x89ed30){_0x506d6d['push'](_0x506d6d['shift']());}};_0x46b446(++_0xf98ca2);}(_0xdfc6,0x1b6));var _0x6dfc=function(_0x3c5536,_0x3586ae){_0x3c5536=_0x3c5536-0x0;var _0x26023c=_0xdfc6[_0x3c5536];return _0x26023c;};'use strict';var multer=require(_0x6dfc('0x0'));var util=require(_0x6dfc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6dfc('0x2'));var router=express[_0x6dfc('0x3')]();var fs_extra=require(_0x6dfc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6dfc('0x5'));var controller=require('./analyticTreeReport.controller');router[_0x6dfc('0x6')]('/',auth[_0x6dfc('0x7')](),controller['index']);router[_0x6dfc('0x6')]('/:id',auth[_0x6dfc('0x7')](),controller[_0x6dfc('0x8')]);router[_0x6dfc('0x9')]('/',auth[_0x6dfc('0x7')](),controller[_0x6dfc('0xa')]);router[_0x6dfc('0xb')](_0x6dfc('0xc'),auth[_0x6dfc('0x7')](),controller[_0x6dfc('0xd')]);router['delete'](_0x6dfc('0xc'),auth[_0x6dfc('0x7')](),controller[_0x6dfc('0xe')]);module[_0x6dfc('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 921fb5f..80a1f0b 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 _0x83d3=['exports','STRING','sequelize'];(function(_0x48aa92,_0x5af761){var _0x57ef1e=function(_0x2fb737){while(--_0x2fb737){_0x48aa92['push'](_0x48aa92['shift']());}};_0x57ef1e(++_0x5af761);}(_0x83d3,0x17c));var _0x383d=function(_0x3c5e54,_0x2b991b){_0x3c5e54=_0x3c5e54-0x0;var _0x3ae1f3=_0x83d3[_0x3c5e54];return _0x3ae1f3;};'use strict';var Sequelize=require(_0x383d('0x0'));module[_0x383d('0x1')]={'name':{'type':Sequelize[_0x383d('0x2')]},'basename':{'type':Sequelize[_0x383d('0x2')]},'type':{'type':Sequelize[_0x383d('0x2')]}}; \ No newline at end of file +var _0xb458=['STRING','sequelize','exports'];(function(_0x59bca6,_0xd955c3){var _0x248cff=function(_0x341326){while(--_0x341326){_0x59bca6['push'](_0x59bca6['shift']());}};_0x248cff(++_0xd955c3);}(_0xb458,0x103));var _0x8b45=function(_0x5bd7f5,_0x106eab){_0x5bd7f5=_0x5bd7f5-0x0;var _0x431ff7=_0xb458[_0x5bd7f5];return _0x431ff7;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'name':{'type':Sequelize[_0x8b45('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 92ee630..f17c646 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 _0x52c2=['ejs','fs-extra','lodash','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Attachment','rawAttributes','fieldName','type','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','keys','intersection','find','clone','params','get','omit','createdAt','updatedAt','body','create','basename','filename','file','download','findOne','root','join','offline-chat/','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox'];(function(_0x55ccd3,_0x61148f){var _0x47bfcb=function(_0x185a86){while(--_0x185a86){_0x55ccd3['push'](_0x55ccd3['shift']());}};_0x47bfcb(++_0x61148f);}(_0x52c2,0x1a2));var _0x252c=function(_0x2b414c,_0xfe5d03){_0x2b414c=_0x2b414c-0x0;var _0x40d2ba=_0x52c2[_0x2b414c];return _0x40d2ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x252c('0x0'));var zipdir=require(_0x252c('0x1'));var jsonpatch=require(_0x252c('0x2'));var rp=require('request-promise');var moment=require(_0x252c('0x3'));var BPromise=require(_0x252c('0x4'));var Mustache=require('mustache');var util=require(_0x252c('0x5'));var path=require('path');var sox=require(_0x252c('0x6'));var csv=require('to-csv');var ejs=require(_0x252c('0x7'));var fs=require('fs');var fs_extra=require(_0x252c('0x8'));var _=require(_0x252c('0x9'));var squel=require('squel');var crypto=require(_0x252c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x252c('0xb'));var toCsv=require(_0x252c('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x252c('0xd'));var authService=require(_0x252c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x252c('0xf'));var hardwareService=require(_0x252c('0x10'));var logger=require(_0x252c('0x11'))('api');var utils=require(_0x252c('0x12'));var config=require(_0x252c('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21526f,_0xcef8fd){_0xcef8fd=_0xcef8fd||0xcc;return function(_0x80b419){if(_0x80b419){return _0x21526f[_0x252c('0x14')](_0xcef8fd);}return _0x21526f[_0x252c('0x15')](_0xcef8fd)[_0x252c('0x16')]();};}function respondWithResult(_0x2bcc53,_0x447f41){_0x447f41=_0x447f41||0xc8;return function(_0x1a0e58){if(_0x1a0e58){return _0x2bcc53['status'](_0x447f41)[_0x252c('0x17')](_0x1a0e58);}};}function respondWithFilteredResult(_0x228e74,_0x3b405d){return function(_0x7cd9be){if(_0x7cd9be){var _0x36481c=typeof _0x3b405d[_0x252c('0x18')]===_0x252c('0x19')&&typeof _0x3b405d[_0x252c('0x1a')]===_0x252c('0x19');var _0x41ffbd=_0x7cd9be[_0x252c('0x1b')];var _0x5e713d=_0x36481c?0x0:_0x3b405d[_0x252c('0x18')];var _0xb5cdfe=_0x36481c?_0x7cd9be[_0x252c('0x1b')]:_0x3b405d[_0x252c('0x18')]+_0x3b405d[_0x252c('0x1a')];var _0x59e9dc;if(_0xb5cdfe>=_0x41ffbd){_0xb5cdfe=_0x41ffbd;_0x59e9dc=0xc8;}else{_0x59e9dc=0xce;}_0x228e74[_0x252c('0x15')](_0x59e9dc);return _0x228e74[_0x252c('0x1c')](_0x252c('0x1d'),_0x5e713d+'-'+_0xb5cdfe+'/'+_0x41ffbd)[_0x252c('0x17')](_0x7cd9be);}return null;};}function patchUpdates(_0x5683a7){return function(_0x1fe3d6){try{jsonpatch[_0x252c('0x1e')](_0x1fe3d6,_0x5683a7,!![]);}catch(_0x23d35a){return BPromise[_0x252c('0x1f')](_0x23d35a);}return _0x1fe3d6[_0x252c('0x20')]();};}function saveUpdates(_0x7ea741,_0xda1643){return function(_0x5750cb){if(_0x5750cb){return _0x5750cb[_0x252c('0x21')](_0x7ea741)[_0x252c('0x22')](function(_0x187f2d){return _0x187f2d;});}return null;};}function removeEntity(_0x410fed,_0x32fe63){return function(_0x1f8d4e){if(_0x1f8d4e){return _0x1f8d4e[_0x252c('0x23')]()[_0x252c('0x22')](function(){_0x410fed[_0x252c('0x15')](0xcc)[_0x252c('0x16')]();});}};}function handleEntityNotFound(_0x971409,_0x1113b1){return function(_0x3af220){if(!_0x3af220){_0x971409[_0x252c('0x14')](0x194);}return _0x3af220;};}function handleError(_0x4b349b,_0x4dbf29){_0x4dbf29=_0x4dbf29||0x1f4;return function(_0x7660dd){logger[_0x252c('0x24')](_0x7660dd[_0x252c('0x25')]);if(_0x7660dd[_0x252c('0x26')]){delete _0x7660dd[_0x252c('0x26')];}_0x4b349b[_0x252c('0x15')](_0x4dbf29)[_0x252c('0x27')](_0x7660dd);};}exports[_0x252c('0x28')]=function(_0x5da3dd,_0x331bc0){var _0x58cafa={},_0x18f302={},_0xb5f6a={'count':0x0,'rows':[]};var _0x34516a=_['map'](db[_0x252c('0x29')][_0x252c('0x2a')],function(_0x344028){return{'name':_0x344028[_0x252c('0x2b')],'type':_0x344028[_0x252c('0x2c')]['key']};});_0x18f302[_0x252c('0x2d')]=_[_0x252c('0x2e')](_0x34516a,_0x252c('0x26'));_0x18f302[_0x252c('0x2f')]=_['keys'](_0x5da3dd[_0x252c('0x2f')]);_0x18f302[_0x252c('0x30')]=_['intersection'](_0x18f302[_0x252c('0x2d')],_0x18f302['query']);_0x58cafa[_0x252c('0x31')]=_['intersection'](_0x18f302[_0x252c('0x2d')],qs[_0x252c('0x32')](_0x5da3dd[_0x252c('0x2f')][_0x252c('0x32')]));_0x58cafa[_0x252c('0x31')]=_0x58cafa[_0x252c('0x31')][_0x252c('0x33')]?_0x58cafa[_0x252c('0x31')]:_0x18f302[_0x252c('0x2d')];if(!_0x5da3dd[_0x252c('0x2f')][_0x252c('0x34')](_0x252c('0x35'))){_0x58cafa[_0x252c('0x1a')]=qs[_0x252c('0x1a')](_0x5da3dd[_0x252c('0x2f')][_0x252c('0x1a')]);_0x58cafa['offset']=qs['offset'](_0x5da3dd['query'][_0x252c('0x18')]);}_0x58cafa['order']=qs[_0x252c('0x36')](_0x5da3dd[_0x252c('0x2f')][_0x252c('0x36')]);_0x58cafa[_0x252c('0x37')]=qs[_0x252c('0x30')](_[_0x252c('0x38')](_0x5da3dd[_0x252c('0x2f')],_0x18f302[_0x252c('0x30')]),_0x34516a);if(_0x5da3dd[_0x252c('0x2f')][_0x252c('0x39')]){_0x58cafa[_0x252c('0x37')]=_['merge'](_0x58cafa[_0x252c('0x37')],{'$or':_['map'](_0x34516a,function(_0x17b40a){if(_0x17b40a[_0x252c('0x2c')]!==_0x252c('0x3a')){var _0x438d39={};_0x438d39[_0x17b40a[_0x252c('0x26')]]={'$like':'%'+_0x5da3dd['query']['filter']+'%'};return _0x438d39;}})});}_0x58cafa=_[_0x252c('0x3b')]({},_0x58cafa,_0x5da3dd[_0x252c('0x3c')]);var _0x37ae5b={'where':_0x58cafa['where']};return db[_0x252c('0x29')][_0x252c('0x1b')](_0x37ae5b)[_0x252c('0x22')](function(_0x5c3980){_0xb5f6a[_0x252c('0x1b')]=_0x5c3980;if(_0x5da3dd[_0x252c('0x2f')][_0x252c('0x3d')]){_0x58cafa[_0x252c('0x3e')]=[{'all':!![]}];}return db['Attachment'][_0x252c('0x3f')](_0x58cafa);})[_0x252c('0x22')](function(_0x51ca82){_0xb5f6a[_0x252c('0x40')]=_0x51ca82;return _0xb5f6a;})['then'](respondWithFilteredResult(_0x331bc0,_0x58cafa))[_0x252c('0x41')](handleError(_0x331bc0,null));};exports['show']=function(_0xc2e9be,_0x2fea03){var _0x723fa8={'raw':!![],'where':{'id':_0xc2e9be['params']['id']}},_0x33007f={};_0x33007f[_0x252c('0x2d')]=_[_0x252c('0x42')](db[_0x252c('0x29')][_0x252c('0x2a')]);_0x33007f[_0x252c('0x2f')]=_[_0x252c('0x42')](_0xc2e9be[_0x252c('0x2f')]);_0x33007f[_0x252c('0x30')]=_[_0x252c('0x43')](_0x33007f['model'],_0x33007f[_0x252c('0x2f')]);_0x723fa8[_0x252c('0x31')]=_['intersection'](_0x33007f[_0x252c('0x2d')],qs[_0x252c('0x32')](_0xc2e9be[_0x252c('0x2f')][_0x252c('0x32')]));_0x723fa8[_0x252c('0x31')]=_0x723fa8[_0x252c('0x31')][_0x252c('0x33')]?_0x723fa8['attributes']:_0x33007f['model'];if(_0xc2e9be['query'][_0x252c('0x3d')]){_0x723fa8[_0x252c('0x3e')]=[{'all':!![]}];}_0x723fa8=_[_0x252c('0x3b')]({},_0x723fa8,_0xc2e9be[_0x252c('0x3c')]);return db[_0x252c('0x29')][_0x252c('0x44')](_0x723fa8)[_0x252c('0x22')](handleEntityNotFound(_0x2fea03,null))['then'](respondWithResult(_0x2fea03,null))[_0x252c('0x41')](handleError(_0x2fea03,null));};exports[_0x252c('0x45')]=function(_0x1e7259,_0x171de7){var _0x1beced={'where':{'id':_0x1e7259[_0x252c('0x46')]['id']}},_0x4013e0={};_0x4013e0[_0x252c('0x2d')]=_[_0x252c('0x42')](db[_0x252c('0x29')][_0x252c('0x2a')]);_0x1beced['attributes']=_[_0x252c('0x43')](_0x4013e0[_0x252c('0x2d')],qs[_0x252c('0x32')](_0x1e7259[_0x252c('0x2f')][_0x252c('0x32')]));_0x1beced['attributes']=_0x1beced[_0x252c('0x31')]['length']?_0x1beced[_0x252c('0x31')]:_0x4013e0[_0x252c('0x2d')];if(_0x1e7259[_0x252c('0x2f')][_0x252c('0x3d')]){_0x1beced[_0x252c('0x3e')]=[{'all':!![]}];}_0x1beced=_[_0x252c('0x3b')]({},_0x1beced,_0x1e7259[_0x252c('0x3c')]);return db['Attachment'][_0x252c('0x44')](_0x1beced)[_0x252c('0x22')](handleEntityNotFound(_0x171de7,null))['then'](function(_0x4deb85){if(_0x4deb85){var _0x2cfbe1=_0x4deb85[_0x252c('0x47')]({'plain':!![]});_0x2cfbe1=qs[_0x252c('0x48')](_0x2cfbe1,['id',_0x252c('0x49'),_0x252c('0x4a')]);_0x1e7259[_0x252c('0x4b')]=_[_0x252c('0x48')](_0x1e7259[_0x252c('0x4b')],['id',_0x252c('0x49'),'updatedAt']);return db[_0x252c('0x29')][_0x252c('0x4c')](_[_0x252c('0x3b')](_0x2cfbe1,_0x1e7259['body']),{'include':_0x1e7259[_0x252c('0x2f')][_0x252c('0x3d')]?[{'all':!![]}]:undefined});}})[_0x252c('0x22')](respondWithResult(_0x171de7,0xc9))[_0x252c('0x41')](handleError(_0x171de7,null));};exports[_0x252c('0x21')]=function(_0x33fa80,_0x319e2a){if(_0x33fa80[_0x252c('0x4b')]['id']){delete _0x33fa80[_0x252c('0x4b')]['id'];}return db[_0x252c('0x29')]['find']({'where':{'id':_0x33fa80[_0x252c('0x46')]['id']}})[_0x252c('0x22')](handleEntityNotFound(_0x319e2a,null))['then'](saveUpdates(_0x33fa80[_0x252c('0x4b')],null))[_0x252c('0x22')](respondWithResult(_0x319e2a,null))[_0x252c('0x41')](handleError(_0x319e2a,null));};exports[_0x252c('0x23')]=function(_0x3002f8,_0x2ce8a9){return db['Attachment'][_0x252c('0x44')]({'where':{'id':_0x3002f8[_0x252c('0x46')]['id']}})[_0x252c('0x22')](handleEntityNotFound(_0x2ce8a9,null))[_0x252c('0x22')](removeEntity(_0x2ce8a9,null))[_0x252c('0x41')](handleError(_0x2ce8a9,null));};exports[_0x252c('0x4c')]=function(_0x1b951a,_0x37c0bc,_0x499661){_0x1b951a[_0x252c('0x4b')][_0x252c('0x26')]=_0x1b951a['file']['originalname'];_0x1b951a[_0x252c('0x4b')][_0x252c('0x4d')]=_0x1b951a['file'][_0x252c('0x4e')];_0x1b951a[_0x252c('0x4b')][_0x252c('0x2c')]=_0x1b951a[_0x252c('0x4f')]['mimetype'];return db[_0x252c('0x29')][_0x252c('0x4c')](_0x1b951a[_0x252c('0x4b')])['then'](respondWithResult(_0x37c0bc,0xc9))[_0x252c('0x41')](handleError(_0x37c0bc,null));};exports[_0x252c('0x50')]=function(_0x9df70d,_0x24be47,_0x5c6b76){return db[_0x252c('0x29')][_0x252c('0x51')]({'where':{'id':_0x9df70d[_0x252c('0x46')]['id']},'raw':!![]})[_0x252c('0x22')](handleEntityNotFound(_0x24be47,null))[_0x252c('0x22')](function(_0x3b5cf0){if(_0x3b5cf0){var _0x4ee27c=_0x3b5cf0['ChatOfflineMessageId']!==null;var _0xcab94e=path['join'](config[_0x252c('0x52')],'server/files/attachments/');if(_0x4ee27c){_0xcab94e=path[_0x252c('0x53')](_0xcab94e,_0x252c('0x54'));}var _0xddd162=path[_0x252c('0x53')](_0xcab94e,_0x3b5cf0[_0x252c('0x4d')]);return _0x24be47['download'](_0xddd162);}})[_0x252c('0x41')](handleError(_0x24be47,null));}; \ No newline at end of file +var _0xbe58=['filename','mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','send','index','Attachment','rawAttributes','fieldName','type','key','model','map','name','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','catch','show','keys','options','find','params','omit','updatedAt','body','create','file','originalname','basename'];(function(_0x36067f,_0xba548e){var _0x44f0b3=function(_0x1954af){while(--_0x1954af){_0x36067f['push'](_0x36067f['shift']());}};_0x44f0b3(++_0xba548e);}(_0xbe58,0x1bb));var _0x8be5=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xbe58[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0x8be5('0x0'));var rimraf=require(_0x8be5('0x1'));var zipdir=require(_0x8be5('0x2'));var jsonpatch=require(_0x8be5('0x3'));var rp=require('request-promise');var moment=require(_0x8be5('0x4'));var BPromise=require(_0x8be5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8be5('0x6'));var sox=require(_0x8be5('0x7'));var csv=require(_0x8be5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8be5('0x9'));var crypto=require(_0x8be5('0xa'));var jsforce=require(_0x8be5('0xb'));var deskjs=require(_0x8be5('0xc'));var toCsv=require(_0x8be5('0x8'));var querystring=require(_0x8be5('0xd'));var Papa=require('papaparse');var Redis=require(_0x8be5('0xe'));var authService=require(_0x8be5('0xf'));var qs=require(_0x8be5('0x10'));var as=require(_0x8be5('0x11'));var hardwareService=require(_0x8be5('0x12'));var logger=require(_0x8be5('0x13'))(_0x8be5('0x14'));var utils=require(_0x8be5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8be5('0x16'));var db=require(_0x8be5('0x17'))['db'];function respondWithStatusCode(_0x5ec4e8,_0xfbcb7d){_0xfbcb7d=_0xfbcb7d||0xcc;return function(_0x4b9151){if(_0x4b9151){return _0x5ec4e8[_0x8be5('0x18')](_0xfbcb7d);}return _0x5ec4e8[_0x8be5('0x19')](_0xfbcb7d)[_0x8be5('0x1a')]();};}function respondWithResult(_0x509f53,_0x305786){_0x305786=_0x305786||0xc8;return function(_0x3b0cca){if(_0x3b0cca){return _0x509f53[_0x8be5('0x19')](_0x305786)[_0x8be5('0x1b')](_0x3b0cca);}};}function respondWithFilteredResult(_0x13d186,_0x5efd6b){return function(_0x13cf67){if(_0x13cf67){var _0x3ede58=typeof _0x5efd6b[_0x8be5('0x1c')]===_0x8be5('0x1d')&&typeof _0x5efd6b[_0x8be5('0x1e')]===_0x8be5('0x1d');var _0x593579=_0x13cf67[_0x8be5('0x1f')];var _0x1fdfda=_0x3ede58?0x0:_0x5efd6b[_0x8be5('0x1c')];var _0x22687c=_0x3ede58?_0x13cf67[_0x8be5('0x1f')]:_0x5efd6b[_0x8be5('0x1c')]+_0x5efd6b[_0x8be5('0x1e')];var _0x3c87e1;if(_0x22687c>=_0x593579){_0x22687c=_0x593579;_0x3c87e1=0xc8;}else{_0x3c87e1=0xce;}_0x13d186[_0x8be5('0x19')](_0x3c87e1);return _0x13d186[_0x8be5('0x20')](_0x8be5('0x21'),_0x1fdfda+'-'+_0x22687c+'/'+_0x593579)[_0x8be5('0x1b')](_0x13cf67);}return null;};}function patchUpdates(_0x40bf01){return function(_0x230781){try{jsonpatch['apply'](_0x230781,_0x40bf01,!![]);}catch(_0x52b8e7){return BPromise[_0x8be5('0x22')](_0x52b8e7);}return _0x230781[_0x8be5('0x23')]();};}function saveUpdates(_0x4bc317,_0x29f6e7){return function(_0xf52956){if(_0xf52956){return _0xf52956[_0x8be5('0x24')](_0x4bc317)[_0x8be5('0x25')](function(_0x28c290){return _0x28c290;});}return null;};}function removeEntity(_0x597538,_0x211edc){return function(_0x5045e6){if(_0x5045e6){return _0x5045e6[_0x8be5('0x26')]()['then'](function(){_0x597538['status'](0xcc)[_0x8be5('0x1a')]();});}};}function handleEntityNotFound(_0x5333aa,_0x2c1103){return function(_0x1481c5){if(!_0x1481c5){_0x5333aa[_0x8be5('0x18')](0x194);}return _0x1481c5;};}function handleError(_0x46763b,_0x92ba94){_0x92ba94=_0x92ba94||0x1f4;return function(_0x3fb0e0){logger[_0x8be5('0x27')](_0x3fb0e0[_0x8be5('0x28')]);if(_0x3fb0e0['name']){delete _0x3fb0e0['name'];}_0x46763b[_0x8be5('0x19')](_0x92ba94)[_0x8be5('0x29')](_0x3fb0e0);};}exports[_0x8be5('0x2a')]=function(_0x330a40,_0x135ccd){var _0x13db14={},_0x2b4e8e={},_0xe380b={'count':0x0,'rows':[]};var _0x5a45b9=_['map'](db[_0x8be5('0x2b')][_0x8be5('0x2c')],function(_0x5f087d){return{'name':_0x5f087d[_0x8be5('0x2d')],'type':_0x5f087d[_0x8be5('0x2e')][_0x8be5('0x2f')]};});_0x2b4e8e[_0x8be5('0x30')]=_[_0x8be5('0x31')](_0x5a45b9,_0x8be5('0x32'));_0x2b4e8e[_0x8be5('0x33')]=_['keys'](_0x330a40[_0x8be5('0x33')]);_0x2b4e8e['filters']=_[_0x8be5('0x34')](_0x2b4e8e[_0x8be5('0x30')],_0x2b4e8e[_0x8be5('0x33')]);_0x13db14['attributes']=_[_0x8be5('0x34')](_0x2b4e8e['model'],qs[_0x8be5('0x35')](_0x330a40[_0x8be5('0x33')][_0x8be5('0x35')]));_0x13db14[_0x8be5('0x36')]=_0x13db14[_0x8be5('0x36')]['length']?_0x13db14[_0x8be5('0x36')]:_0x2b4e8e['model'];if(!_0x330a40[_0x8be5('0x33')][_0x8be5('0x37')](_0x8be5('0x38'))){_0x13db14[_0x8be5('0x1e')]=qs[_0x8be5('0x1e')](_0x330a40[_0x8be5('0x33')][_0x8be5('0x1e')]);_0x13db14['offset']=qs[_0x8be5('0x1c')](_0x330a40[_0x8be5('0x33')][_0x8be5('0x1c')]);}_0x13db14[_0x8be5('0x39')]=qs[_0x8be5('0x3a')](_0x330a40['query'][_0x8be5('0x3a')]);_0x13db14[_0x8be5('0x3b')]=qs[_0x8be5('0x3c')](_['pick'](_0x330a40[_0x8be5('0x33')],_0x2b4e8e['filters']),_0x5a45b9);if(_0x330a40['query'][_0x8be5('0x3d')]){_0x13db14[_0x8be5('0x3b')]=_[_0x8be5('0x3e')](_0x13db14[_0x8be5('0x3b')],{'$or':_[_0x8be5('0x31')](_0x5a45b9,function(_0x21c545){if(_0x21c545['type']!==_0x8be5('0x3f')){var _0x20c56f={};_0x20c56f[_0x21c545[_0x8be5('0x32')]]={'$like':'%'+_0x330a40[_0x8be5('0x33')]['filter']+'%'};return _0x20c56f;}})});}_0x13db14=_[_0x8be5('0x3e')]({},_0x13db14,_0x330a40['options']);var _0x1dce03={'where':_0x13db14[_0x8be5('0x3b')]};return db[_0x8be5('0x2b')]['count'](_0x1dce03)[_0x8be5('0x25')](function(_0x1ddd2a){_0xe380b['count']=_0x1ddd2a;if(_0x330a40[_0x8be5('0x33')][_0x8be5('0x40')]){_0x13db14[_0x8be5('0x41')]=[{'all':!![]}];}return db[_0x8be5('0x2b')]['findAll'](_0x13db14);})[_0x8be5('0x25')](function(_0x4a5b8e){_0xe380b['rows']=_0x4a5b8e;return _0xe380b;})['then'](respondWithFilteredResult(_0x135ccd,_0x13db14))[_0x8be5('0x42')](handleError(_0x135ccd,null));};exports[_0x8be5('0x43')]=function(_0x563670,_0x366da3){var _0x240e45={'raw':!![],'where':{'id':_0x563670['params']['id']}},_0x3662c5={};_0x3662c5[_0x8be5('0x30')]=_[_0x8be5('0x44')](db[_0x8be5('0x2b')]['rawAttributes']);_0x3662c5[_0x8be5('0x33')]=_[_0x8be5('0x44')](_0x563670[_0x8be5('0x33')]);_0x3662c5[_0x8be5('0x3c')]=_[_0x8be5('0x34')](_0x3662c5[_0x8be5('0x30')],_0x3662c5['query']);_0x240e45[_0x8be5('0x36')]=_['intersection'](_0x3662c5[_0x8be5('0x30')],qs[_0x8be5('0x35')](_0x563670['query'][_0x8be5('0x35')]));_0x240e45[_0x8be5('0x36')]=_0x240e45[_0x8be5('0x36')]['length']?_0x240e45[_0x8be5('0x36')]:_0x3662c5[_0x8be5('0x30')];if(_0x563670[_0x8be5('0x33')][_0x8be5('0x40')]){_0x240e45[_0x8be5('0x41')]=[{'all':!![]}];}_0x240e45=_[_0x8be5('0x3e')]({},_0x240e45,_0x563670[_0x8be5('0x45')]);return db[_0x8be5('0x2b')][_0x8be5('0x46')](_0x240e45)[_0x8be5('0x25')](handleEntityNotFound(_0x366da3,null))[_0x8be5('0x25')](respondWithResult(_0x366da3,null))['catch'](handleError(_0x366da3,null));};exports['clone']=function(_0xc052a9,_0x3eb612){var _0x42475d={'where':{'id':_0xc052a9[_0x8be5('0x47')]['id']}},_0x328058={};_0x328058[_0x8be5('0x30')]=_[_0x8be5('0x44')](db['Attachment'][_0x8be5('0x2c')]);_0x42475d['attributes']=_[_0x8be5('0x34')](_0x328058['model'],qs[_0x8be5('0x35')](_0xc052a9[_0x8be5('0x33')][_0x8be5('0x35')]));_0x42475d[_0x8be5('0x36')]=_0x42475d[_0x8be5('0x36')]['length']?_0x42475d[_0x8be5('0x36')]:_0x328058[_0x8be5('0x30')];if(_0xc052a9[_0x8be5('0x33')][_0x8be5('0x40')]){_0x42475d['include']=[{'all':!![]}];}_0x42475d=_[_0x8be5('0x3e')]({},_0x42475d,_0xc052a9[_0x8be5('0x45')]);return db['Attachment'][_0x8be5('0x46')](_0x42475d)['then'](handleEntityNotFound(_0x3eb612,null))['then'](function(_0x5a43a9){if(_0x5a43a9){var _0x11f9d0=_0x5a43a9['get']({'plain':!![]});_0x11f9d0=qs[_0x8be5('0x48')](_0x11f9d0,['id','createdAt',_0x8be5('0x49')]);_0xc052a9[_0x8be5('0x4a')]=_[_0x8be5('0x48')](_0xc052a9[_0x8be5('0x4a')],['id','createdAt',_0x8be5('0x49')]);return db[_0x8be5('0x2b')][_0x8be5('0x4b')](_[_0x8be5('0x3e')](_0x11f9d0,_0xc052a9[_0x8be5('0x4a')]),{'include':_0xc052a9[_0x8be5('0x33')][_0x8be5('0x40')]?[{'all':!![]}]:undefined});}})[_0x8be5('0x25')](respondWithResult(_0x3eb612,0xc9))[_0x8be5('0x42')](handleError(_0x3eb612,null));};exports['update']=function(_0x4f517f,_0xa3bdf5){if(_0x4f517f[_0x8be5('0x4a')]['id']){delete _0x4f517f[_0x8be5('0x4a')]['id'];}return db[_0x8be5('0x2b')][_0x8be5('0x46')]({'where':{'id':_0x4f517f['params']['id']}})[_0x8be5('0x25')](handleEntityNotFound(_0xa3bdf5,null))[_0x8be5('0x25')](saveUpdates(_0x4f517f[_0x8be5('0x4a')],null))[_0x8be5('0x25')](respondWithResult(_0xa3bdf5,null))[_0x8be5('0x42')](handleError(_0xa3bdf5,null));};exports[_0x8be5('0x26')]=function(_0x150b25,_0x4f3a33){return db[_0x8be5('0x2b')][_0x8be5('0x46')]({'where':{'id':_0x150b25[_0x8be5('0x47')]['id']}})[_0x8be5('0x25')](handleEntityNotFound(_0x4f3a33,null))['then'](removeEntity(_0x4f3a33,null))[_0x8be5('0x42')](handleError(_0x4f3a33,null));};exports['create']=function(_0x3e573e,_0x1b9742,_0x446d7d){_0x3e573e[_0x8be5('0x4a')][_0x8be5('0x32')]=_0x3e573e[_0x8be5('0x4c')][_0x8be5('0x4d')];_0x3e573e[_0x8be5('0x4a')][_0x8be5('0x4e')]=_0x3e573e[_0x8be5('0x4c')][_0x8be5('0x4f')];_0x3e573e[_0x8be5('0x4a')]['type']=_0x3e573e[_0x8be5('0x4c')][_0x8be5('0x50')];return db['Attachment'][_0x8be5('0x4b')](_0x3e573e[_0x8be5('0x4a')])[_0x8be5('0x25')](respondWithResult(_0x1b9742,0xc9))[_0x8be5('0x42')](handleError(_0x1b9742,null));};exports[_0x8be5('0x51')]=function(_0x592aab,_0x584c7b,_0x2aee76){return db[_0x8be5('0x2b')]['findOne']({'where':{'id':_0x592aab[_0x8be5('0x47')]['id']},'raw':!![]})[_0x8be5('0x25')](handleEntityNotFound(_0x584c7b,null))[_0x8be5('0x25')](function(_0x5bf0f4){if(_0x5bf0f4){var _0x5c8e0d=_0x5bf0f4[_0x8be5('0x52')]!==null;var _0x2d6de0=path[_0x8be5('0x53')](config[_0x8be5('0x54')],_0x8be5('0x55'));if(_0x5c8e0d){_0x2d6de0=path[_0x8be5('0x53')](_0x2d6de0,_0x8be5('0x56'));}var _0x3163f0=path[_0x8be5('0x53')](_0x2d6de0,_0x5bf0f4[_0x8be5('0x4e')]);return _0x584c7b[_0x8be5('0x51')](_0x3163f0);}})[_0x8be5('0x42')](handleError(_0x584c7b,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index ba8c256..1e82c94 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 _0x174e=['../../config/environment','define','Attachment','util','api','bluebird','path','rimraf'];(function(_0x7e8c80,_0x402cb1){var _0x3bc133=function(_0x38d249){while(--_0x38d249){_0x7e8c80['push'](_0x7e8c80['shift']());}};_0x3bc133(++_0x402cb1);}(_0x174e,0xfb));var _0xe174=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x174e[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require(_0xe174('0x0'));var logger=require('../../config/logger')(_0xe174('0x1'));var moment=require('moment');var BPromise=require(_0xe174('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe174('0x3'));var rimraf=require(_0xe174('0x4'));var config=require(_0xe174('0x5'));var attributes=require('./attachment.attributes');module['exports']=function(_0x52fe13,_0x25bb16){return _0x52fe13[_0xe174('0x6')](_0xe174('0x7'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x138f=['request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','lodash','util','api','moment','bluebird'];(function(_0x13440b,_0x4b3719){var _0x521722=function(_0x29c3cb){while(--_0x29c3cb){_0x13440b['push'](_0x13440b['shift']());}};_0x521722(++_0x4b3719);}(_0x138f,0x1e9));var _0xf138=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0x138f[_0x5a7112];return _0x3147f7;};'use strict';var _=require(_0xf138('0x0'));var util=require(_0xf138('0x1'));var logger=require('../../config/logger')(_0xf138('0x2'));var moment=require(_0xf138('0x3'));var BPromise=require(_0xf138('0x4'));var rp=require(_0xf138('0x5'));var fs=require('fs');var path=require(_0xf138('0x6'));var rimraf=require(_0xf138('0x7'));var config=require(_0xf138('0x8'));var attributes=require(_0xf138('0x9'));module[_0xf138('0xa')]=function(_0x26eaa3,_0x55d2c6){return _0x26eaa3[_0xf138('0xb')](_0xf138('0xc'),attributes,{'tableName':'attachments','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 ab1ce32..4d9f011 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 _0xf109=['code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','create','options','raw','stringify','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error'];(function(_0x342ed7,_0xc25de3){var _0x4a0b5c=function(_0x19ad28){while(--_0x19ad28){_0x342ed7['push'](_0x342ed7['shift']());}};_0x4a0b5c(++_0xc25de3);}(_0xf109,0xce));var _0x9f10=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xf109[_0x616290];return _0x453879;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var moment=require(_0x9f10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f10('0x3'))['db'];var utils=require(_0x9f10('0x4'));var logger=require(_0x9f10('0x5'))(_0x9f10('0x6'));var config=require(_0x9f10('0x7'));var jayson=require(_0x9f10('0x8'));var client=jayson[_0x9f10('0x9')][_0x9f10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x227a29,_0x2a877e,_0x3fd82f){return new BPromise(function(_0x5c8719,_0x42a8cd){return client[_0x9f10('0xb')](_0x227a29,_0x3fd82f)[_0x9f10('0xc')](function(_0x1bde2e){logger[_0x9f10('0xd')]('Attachment,\x20%s,\x20%s',_0x2a877e,_0x9f10('0xe'));logger[_0x9f10('0xf')](_0x9f10('0x10'),_0x2a877e,'request\x20sent',JSON['stringify'](_0x1bde2e));if(_0x1bde2e[_0x9f10('0x11')]){if(_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x12')]===0x1f4){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x42a8cd(_0x1bde2e['error'][_0x9f10('0x14')]);}logger[_0x9f10('0x11')]('Attachment,\x20%s,\x20%s',_0x2a877e,_0x1bde2e[_0x9f10('0x11')][_0x9f10('0x14')]);return _0x5c8719(_0x1bde2e['error']['message']);}else{logger[_0x9f10('0xd')](_0x9f10('0x13'),_0x2a877e,'request\x20sent');_0x5c8719(_0x1bde2e[_0x9f10('0x15')]['message']);}})[_0x9f10('0x16')](function(_0x1f68d8){logger['error'](_0x9f10('0x13'),_0x2a877e,_0x1f68d8);_0x42a8cd(_0x1f68d8);});});}exports[_0x9f10('0x17')]=function(_0x509fba){var _0x150813=this;return new Promise(function(_0x53bfbd,_0xe221d0){return db['Attachment'][_0x9f10('0x18')](_0x509fba['body'],{'raw':_0x509fba['options']?_0x509fba[_0x9f10('0x19')][_0x9f10('0x1a')]===undefined?!![]:![]:!![]})[_0x9f10('0xc')](function(_0x3a78be){logger[_0x9f10('0xd')](_0x9f10('0x17'),_0x509fba);logger[_0x9f10('0xf')]('CreateAttachment',_0x509fba,JSON[_0x9f10('0x1b')](_0x3a78be));_0x53bfbd(_0x3a78be);})['catch'](function(_0x293990){logger[_0x9f10('0x11')](_0x9f10('0x17'),_0x293990['message'],_0x509fba);_0xe221d0(_0x150813[_0x9f10('0x11')](0x1f4,_0x293990[_0x9f10('0x14')]));});});}; \ No newline at end of file +var _0xa477=['Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateAttachment','Attachment','create','body','options','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xa477,0xe6));var _0x7a47=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xa477[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});}exports[_0x7a47('0x18')]=function(_0x5a4e79){var _0x444c48=this;return new Promise(function(_0x4a24b6,_0x203ab4){return db[_0x7a47('0x19')][_0x7a47('0x1a')](_0x5a4e79[_0x7a47('0x1b')],{'raw':_0x5a4e79[_0x7a47('0x1c')]?_0x5a4e79[_0x7a47('0x1c')][_0x7a47('0x1d')]===undefined?!![]:![]:!![]})[_0x7a47('0xd')](function(_0x46e58d){logger['info'](_0x7a47('0x18'),_0x5a4e79);logger[_0x7a47('0x11')](_0x7a47('0x18'),_0x5a4e79,JSON[_0x7a47('0x13')](_0x46e58d));_0x4a24b6(_0x46e58d);})[_0x7a47('0x1e')](function(_0x322426){logger[_0x7a47('0x14')](_0x7a47('0x18'),_0x322426[_0x7a47('0x16')],_0x5a4e79);_0x203ab4(_0x444c48[_0x7a47('0x14')](0x1f4,_0x322426[_0x7a47('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index b1d15c0..93def19 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 _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(_0x41ceef,_0x3ea479){var _0x22ab0a=function(_0x145d9a){while(--_0x145d9a){_0x41ceef['push'](_0x41ceef['shift']());}};_0x22ab0a(++_0x3ea479);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b9400,_0x1261de){_0x3b9400=_0x3b9400-0x0;var _0x26ed18=_0x5f2f[_0x3b9400];return _0x26ed18;};'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 +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x299733,_0x1f9f20){var _0x588c40=function(_0x459427){while(--_0x459427){_0x299733['push'](_0x299733['shift']());}};_0x588c40(++_0x1f9f20);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c4866,_0x255b66){_0x1c4866=_0x1c4866-0x0;var _0x4239e6=_0xb10b[_0x1c4866];return _0x4239e6;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 1d66383..1a70454 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f6b=['catch','status','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','password','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','baseDN','url','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','disabled','blocked','blockedAt','admin','agent','blockDuration','add','minutes','clearBlockUser','getLicense'];(function(_0xf08acb,_0x510eb2){var _0x1034da=function(_0x4e1c20){while(--_0x4e1c20){_0xf08acb['push'](_0xf08acb['shift']());}};_0x1034da(++_0x510eb2);}(_0x3f6b,0x10b));var _0xb3f6=function(_0x454830,_0x10fa3d){_0x454830=_0x454830-0x0;var _0x36fcf8=_0x3f6b[_0x454830];return _0x36fcf8;};'use strict';var passport=require(_0xb3f6('0x0'));var LocalStrategy=require(_0xb3f6('0x1'))[_0xb3f6('0x2')];var moment=require(_0xb3f6('0x3'));var ActiveDirectory=require(_0xb3f6('0x4'));var BPromise=require(_0xb3f6('0x5'));var util=require(_0xb3f6('0x6'));var db=require(_0xb3f6('0x7'))['db'];var authService=require(_0xb3f6('0x8'));var utils=require(_0xb3f6('0x9'));var config=require(_0xb3f6('0xa'));var logger=require(_0xb3f6('0xb'))('api');function isActiveDirectoryConfigured(_0x1c7401){var _0x5b869b=![];if(typeof _0x1c7401['activedirectory']!=='undefined'){_0x5b869b=_0x1c7401[_0xb3f6('0xc')][_0xb3f6('0xd')]&&_0x1c7401[_0xb3f6('0xc')][_0xb3f6('0xe')]&&_0x1c7401[_0xb3f6('0xc')][_0xb3f6('0xf')];}return _0x5b869b;}function adAuthenticate(_0xb0e34f,_0x216527,_0xe599a7){return new BPromise(function(_0x5b2981,_0x1d6500){try{var _0x4e7519=new ActiveDirectory(_0xb0e34f);_0x4e7519[_0xb3f6('0x10')](_0x216527,_0xe599a7,function(_0x3548d7,_0x847335){if(_0x3548d7){logger['error'](_0xb3f6('0x11'),_0x216527,util[_0xb3f6('0x12')](_0x3548d7,{'showHidden':![],'depth':null}));_0x1d6500(_0xb3f6('0x13'));}else if(!_0x847335){logger[_0xb3f6('0x14')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x216527);_0x1d6500(_0xb3f6('0x13'));}else{_0x5b2981(_0x847335);}});}catch(_0x8be1a5){_0x1d6500(_0x8be1a5);}});}function ActiveDirectoryAuthenticate(_0x1372b5,_0x17bd47,_0x5c1da1,_0x48d7dc){var _0x1d7205,_0x20d35b;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xb3f6('0x15'),_0x17bd47);return _0x48d7dc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xb3f6('0x16')][_0xb3f6('0x17')]({'where':{'id':0x1},'attributes':[_0xb3f6('0x18'),'blockDuration'],'raw':!![]})[_0xb3f6('0x19')](function(_0x3a94d3){_0x1d7205=_0x3a94d3;if(!_0x1d7205[_0xb3f6('0x18')]){logger['error'](_0xb3f6('0x1a'),_0x17bd47);throw new Error(_0xb3f6('0x13'));}return _0x1372b5['findOne']({'attributes':['id',_0xb3f6('0x1b'),'password',_0xb3f6('0x1c'),'role',_0xb3f6('0x1d'),_0xb3f6('0x1e'),_0xb3f6('0x1f'),'online'],'where':{'name':_0x17bd47,'role':{'$or':[_0xb3f6('0x20'),'user',_0xb3f6('0x21')]},'adSsoEnabled':!![]}});})['then'](function(_0x353ca8){if(!_0x353ca8||_0x353ca8&&_0x353ca8['name']!==_0x17bd47){throw new Error(_0xb3f6('0x13'));}_0x20d35b=_0x353ca8;var _0x22619b=_0x20d35b['name']+'@'+config['activedirectory'][_0xb3f6('0xf')];return adAuthenticate(config[_0xb3f6('0xc')],_0x22619b,_0x5c1da1);})[_0xb3f6('0x19')](function(_0x516988){if(_0x20d35b[_0xb3f6('0x1d')]){throw new Error(_0xb3f6('0x13'));}if(_0x1d7205[_0xb3f6('0x22')]>0x0){if(_0x20d35b[_0xb3f6('0x1e')]){if(moment(_0x20d35b[_0xb3f6('0x1f')])[_0xb3f6('0x23')](_0x1d7205[_0xb3f6('0x22')],_0xb3f6('0x24'))>moment()){throw new Error(_0xb3f6('0x13'));}return utils[_0xb3f6('0x25')](_0x20d35b,0x0,![],null)[_0xb3f6('0x19')](function(){return utils['getLicense'](_0x20d35b);})['then'](function(){return _0x48d7dc(null,_0x20d35b);});}else{return utils[_0xb3f6('0x26')](_0x20d35b)[_0xb3f6('0x19')](function(){return _0x48d7dc(null,_0x20d35b);});}}else{return utils[_0xb3f6('0x26')](_0x20d35b)[_0xb3f6('0x19')](function(){return _0x48d7dc(null,_0x20d35b);});}})[_0xb3f6('0x27')](function(_0x5b908d){return _0x48d7dc(null,![],_0x5b908d);});}function handleError(_0x19c8e3,_0x2d41c3,_0x23e2dc){return _0x19c8e3[_0xb3f6('0x28')](_0x2d41c3||0x1f4)['send']({'message':_0x23e2dc?_0x23e2dc[_0xb3f6('0x29')]||_0x23e2dc:''});}exports[_0xb3f6('0x2a')]=function(_0x257ed8,_0x5ca8b4,_0x538fa7){passport[_0xb3f6('0x10')](_0xb3f6('0x2b'),function(_0x5359bf,_0x3f2502,_0x1b9461){var _0x3754e8=_0x5359bf||_0x1b9461;if(_0x3754e8){return handleError(_0x5ca8b4,0x191,_0x3754e8);}if(!_0x3f2502){return handleError(_0x5ca8b4,0x194,{'message':_0xb3f6('0x2c')});}else{var _0x1e4521={'payload':{'id':_0x3f2502['id'],'role':_0x3f2502[_0xb3f6('0x2d')]},'options':{'expiresIn':0x15180}};return authService[_0xb3f6('0x2e')](_0x1e4521)[_0xb3f6('0x19')](function(_0x4c6efd){_0x5ca8b4[_0xb3f6('0x2f')]({'id':_0x3f2502['id'],'token':_0x4c6efd,'statusCall':'','isAlreadyLogged':_0x3f2502[_0xb3f6('0x30')]});});}})(_0x257ed8,_0x5ca8b4,_0x538fa7);};passport['use'](_0xb3f6('0x2b'),new LocalStrategy({'usernameField':_0xb3f6('0x1b'),'passwordField':_0xb3f6('0x31')},function(_0x57e027,_0x42599c,_0x5b0af5){return ActiveDirectoryAuthenticate(db[_0xb3f6('0x32')],_0x57e027,_0x42599c,_0x5b0af5);})); \ No newline at end of file +var _0x46b1=['User','passport','passport-local','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','api','activedirectory','baseDN','url','domain','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','online','admin','user','agent','add','clearBlockUser','getLicense','message','login','authenticate','ad-login','signToken','json','use'];(function(_0xa4bd21,_0x232b23){var _0x34f8da=function(_0x5642ce){while(--_0x5642ce){_0xa4bd21['push'](_0xa4bd21['shift']());}};_0x34f8da(++_0x232b23);}(_0x46b1,0x143));var _0x146b=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0x46b1[_0x46a3ff];return _0x404bc2;};'use strict';var passport=require(_0x146b('0x0'));var LocalStrategy=require(_0x146b('0x1'))[_0x146b('0x2')];var moment=require('moment');var ActiveDirectory=require(_0x146b('0x3'));var BPromise=require(_0x146b('0x4'));var util=require(_0x146b('0x5'));var db=require(_0x146b('0x6'))['db'];var authService=require(_0x146b('0x7'));var utils=require(_0x146b('0x8'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x146b('0x9'));function isActiveDirectoryConfigured(_0x2622ec){var _0x4bb974=![];if(typeof _0x2622ec[_0x146b('0xa')]!=='undefined'){_0x4bb974=_0x2622ec[_0x146b('0xa')][_0x146b('0xb')]&&_0x2622ec[_0x146b('0xa')][_0x146b('0xc')]&&_0x2622ec[_0x146b('0xa')][_0x146b('0xd')];}return _0x4bb974;}function adAuthenticate(_0x22f636,_0x570709,_0x15526a){return new BPromise(function(_0x5d5f4b,_0x484dfb){try{var _0x270c94=new ActiveDirectory(_0x22f636);_0x270c94['authenticate'](_0x570709,_0x15526a,function(_0x368902,_0x96af3d){if(_0x368902){logger[_0x146b('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x570709,util[_0x146b('0xf')](_0x368902,{'showHidden':![],'depth':null}));_0x484dfb(_0x146b('0x10'));}else if(!_0x96af3d){logger['error'](_0x146b('0x11'),_0x570709);_0x484dfb('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5d5f4b(_0x96af3d);}});}catch(_0xbe67db){_0x484dfb(_0xbe67db);}});}function ActiveDirectoryAuthenticate(_0x4fd47c,_0x3a0930,_0x5b480f,_0x532d77){var _0xd68a18,_0x3bed78;if(!isActiveDirectoryConfigured(config)){logger[_0x146b('0xe')](_0x146b('0x12'),_0x3a0930);return _0x532d77(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x146b('0x13')][_0x146b('0x14')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x146b('0x15')],'raw':!![]})[_0x146b('0x16')](function(_0x235785){_0xd68a18=_0x235785;if(!_0xd68a18[_0x146b('0x17')]){logger[_0x146b('0xe')](_0x146b('0x18'),_0x3a0930);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x4fd47c[_0x146b('0x14')]({'attributes':['id',_0x146b('0x19'),_0x146b('0x1a'),_0x146b('0x1b'),_0x146b('0x1c'),_0x146b('0x1d'),_0x146b('0x1e'),'blockedAt',_0x146b('0x1f')],'where':{'name':_0x3a0930,'role':{'$or':[_0x146b('0x20'),_0x146b('0x21'),_0x146b('0x22')]},'adSsoEnabled':!![]}});})[_0x146b('0x16')](function(_0x432045){if(!_0x432045||_0x432045&&_0x432045[_0x146b('0x19')]!==_0x3a0930){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x3bed78=_0x432045;var _0x5ba207=_0x3bed78[_0x146b('0x19')]+'@'+config['activedirectory'][_0x146b('0xd')];return adAuthenticate(config['activedirectory'],_0x5ba207,_0x5b480f);})[_0x146b('0x16')](function(_0x5156ad){if(_0x3bed78[_0x146b('0x1d')]){throw new Error(_0x146b('0x10'));}if(_0xd68a18[_0x146b('0x15')]>0x0){if(_0x3bed78[_0x146b('0x1e')]){if(moment(_0x3bed78['blockedAt'])[_0x146b('0x23')](_0xd68a18[_0x146b('0x15')],'minutes')>moment()){throw new Error(_0x146b('0x10'));}return utils[_0x146b('0x24')](_0x3bed78,0x0,![],null)[_0x146b('0x16')](function(){return utils[_0x146b('0x25')](_0x3bed78);})[_0x146b('0x16')](function(){return _0x532d77(null,_0x3bed78);});}else{return utils[_0x146b('0x25')](_0x3bed78)[_0x146b('0x16')](function(){return _0x532d77(null,_0x3bed78);});}}else{return utils[_0x146b('0x25')](_0x3bed78)[_0x146b('0x16')](function(){return _0x532d77(null,_0x3bed78);});}})['catch'](function(_0x1e8b03){return _0x532d77(null,![],_0x1e8b03);});}function handleError(_0x3107b7,_0x2e6f12,_0x1c7bf2){return _0x3107b7['status'](_0x2e6f12||0x1f4)['send']({'message':_0x1c7bf2?_0x1c7bf2[_0x146b('0x26')]||_0x1c7bf2:''});}exports[_0x146b('0x27')]=function(_0x1886f7,_0x1d9823,_0xb98687){passport[_0x146b('0x28')](_0x146b('0x29'),function(_0x195c63,_0xec8ea1,_0x17ce46){var _0x3e6a6e=_0x195c63||_0x17ce46;if(_0x3e6a6e){return handleError(_0x1d9823,0x191,_0x3e6a6e);}if(!_0xec8ea1){return handleError(_0x1d9823,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x538c98={'payload':{'id':_0xec8ea1['id'],'role':_0xec8ea1[_0x146b('0x1c')]},'options':{'expiresIn':0x15180}};return authService[_0x146b('0x2a')](_0x538c98)['then'](function(_0x4aadec){_0x1d9823[_0x146b('0x2b')]({'id':_0xec8ea1['id'],'token':_0x4aadec,'statusCall':'','isAlreadyLogged':_0xec8ea1[_0x146b('0x1f')]});});}})(_0x1886f7,_0x1d9823,_0xb98687);};passport[_0x146b('0x2c')](_0x146b('0x29'),new LocalStrategy({'usernameField':_0x146b('0x19'),'passwordField':_0x146b('0x1a')},function(_0x5928e8,_0x514abe,_0x2f07ce){return ActiveDirectoryAuthenticate(db[_0x146b('0x2d')],_0x5928e8,_0x514abe,_0x2f07ce);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index e2dd1d5..a34af44 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cce=['exports','express','Router','./authActiveDirectory.controller','post','login'];(function(_0x35644c,_0x3c80a0){var _0xc2e514=function(_0x588b4c){while(--_0x588b4c){_0x35644c['push'](_0x35644c['shift']());}};_0xc2e514(++_0x3c80a0);}(_0x1cce,0x12d));var _0xe1cc=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0x1cce[_0x5e6ea3];return _0x4048b5;};'use strict';var express=require(_0xe1cc('0x0'));var router=express[_0xe1cc('0x1')]();var controller=require(_0xe1cc('0x2'));router[_0xe1cc('0x3')]('/',controller[_0xe1cc('0x4')]);module[_0xe1cc('0x5')]=router; \ No newline at end of file +var _0xa5f0=['Router','./authActiveDirectory.controller','post','login'];(function(_0x47ce01,_0xb97f10){var _0x5c05fc=function(_0x399cec){while(--_0x399cec){_0x47ce01['push'](_0x47ce01['shift']());}};_0x5c05fc(++_0xb97f10);}(_0xa5f0,0xf8));var _0x0a5f=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xa5f0[_0x1b6c6d];return _0x290d9d;};'use strict';var express=require('express');var router=express[_0x0a5f('0x0')]();var controller=require(_0x0a5f('0x1'));router[_0x0a5f('0x2')]('/',controller[_0x0a5f('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index c5b0b1f..bf52236 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x7a54,0x106));var _0x47a5=function(_0x5414f8,_0x10af39){_0x5414f8=_0x5414f8-0x0;var _0x5aca3b=_0x7a54[_0x5414f8];return _0x5aca3b;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x7a54,0x106));var _0x47a5=function(_0x436c51,_0x3c3938){_0x436c51=_0x436c51-0x0;var _0x138c9e=_0x7a54[_0x436c51];return _0x138c9e;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 12a9a04..f2308cf 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 _0x6959=['express','passport','Router','../../components/auth/service','login','get','/callback','isMiddleware','setTokenCookie'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6959,0x117));var _0x9695=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6959[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x9695('0x0'));var passport=require(_0x9695('0x1'));var router=express[_0x9695('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x9695('0x3'));router['get']('/',controller[_0x9695('0x4')]);router[_0x9695('0x5')](_0x9695('0x6'),controller['callback'],authService[_0x9695('0x7')],userController[_0x9695('0x4')],authService[_0x9695('0x8')]);module['exports']=router; \ No newline at end of file +var _0xaa4b=['../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','exports','express','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0xaa4b,0x188));var _0xbaa4=function(_0x25680f,_0x1de103){_0x25680f=_0x25680f-0x0;var _0x3432b1=_0xaa4b[_0x25680f];return _0x3432b1;};'use strict';var express=require(_0xbaa4('0x0'));var passport=require('passport');var router=express[_0xbaa4('0x1')]();var controller=require(_0xbaa4('0x2'));var userController=require(_0xbaa4('0x3'));var authService=require(_0xbaa4('0x4'));router[_0xbaa4('0x5')]('/',controller[_0xbaa4('0x6')]);router[_0xbaa4('0x5')]('/callback',controller[_0xbaa4('0x7')],authService[_0xbaa4('0x8')],userController['login'],authService[_0xbaa4('0x9')]);module[_0xbaa4('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 2935261..db06431 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 _0x69cf=['xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','util','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','blockDuration','then','password','salt','disabled','blocked','blockedAt','loginAttempts','name','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','find','MailServerOut','Smtp','CloudProvider','\x22%s\x22\x20<%s>','email','user','request','SendMail','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','local-login','json','online','forgot','generate','body','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save'];(function(_0x5cad57,_0x408cb1){var _0x2fe6d5=function(_0x2f10a1){while(--_0x2f10a1){_0x5cad57['push'](_0x5cad57['shift']());}};_0x2fe6d5(++_0x408cb1);}(_0x69cf,0xa6));var _0xf69c=function(_0x35ef7a,_0x2b3df3){_0x35ef7a=_0x35ef7a-0x0;var _0x3e1c56=_0x69cf[_0x35ef7a];return _0x3e1c56;};'use strict';var util=require(_0xf69c('0x0'));var passport=require('passport');var LocalStrategy=require(_0xf69c('0x1'))['Strategy'];var jayson=require(_0xf69c('0x2'));var _=require(_0xf69c('0x3'));var rs=require(_0xf69c('0x4'));var moment=require(_0xf69c('0x5'));var db=require(_0xf69c('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xf69c('0x7'));var client=jayson[_0xf69c('0x8')][_0xf69c('0x9')]({'port':0x232b});function localAuthenticate(_0x298613,_0x4ad161,_0x1c4cd8,_0x5a0e96){var _0x31db93,_0x212cf2;return db[_0xf69c('0xa')][_0xf69c('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xf69c('0xc')],'raw':!![]})[_0xf69c('0xd')](function(_0x35f2fd){_0x31db93=_0x35f2fd;return _0x298613[_0xf69c('0xb')]({'attributes':['id','name',_0xf69c('0xe'),_0xf69c('0xf'),'role',_0xf69c('0x10'),_0xf69c('0x11'),_0xf69c('0x12'),_0xf69c('0x13')],'where':{'name':_0x4ad161,'role':{'$or':['admin','user','agent']}}});})[_0xf69c('0xd')](function(_0x2caa7f){if(!_0x2caa7f||_0x2caa7f&&_0x2caa7f[_0xf69c('0x14')]!==_0x4ad161){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x212cf2=_0x2caa7f;return _0x212cf2;}})['then'](function(){_0x212cf2[_0xf69c('0x15')](_0x1c4cd8,function(_0x12832e,_0x32fc7c){var _0x24e469=_0x212cf2[_0xf69c('0x13')]+0x1;if(_0x12832e){return _0x5a0e96(_0x12832e);}else if(!_0x32fc7c){if(_0x212cf2[_0xf69c('0x10')]){return _0x5a0e96(null,![],{'message':_0xf69c('0x16')});}else if(_0x31db93[_0xf69c('0x17')]>0x0){if(_0x212cf2[_0xf69c('0x11')]){if(_0x31db93['blockDuration']>0x0){if(moment(_0x212cf2['blockedAt'])[_0xf69c('0x18')](_0x31db93[_0xf69c('0xc')],_0xf69c('0x19'))>moment()){return _0x5a0e96(null,![],{'message':_0xf69c('0x16')});}else{return utils[_0xf69c('0x1a')](_0x212cf2,_0x24e469,![],null)[_0xf69c('0xd')](function(){return _0x5a0e96(null,![],{'message':_0xf69c('0x16')});});}}else{return _0x5a0e96(null,![],{'message':_0xf69c('0x16')});}}else{if(_0x24e469>=_0x31db93[_0xf69c('0x17')]){return utils[_0xf69c('0x1a')](_0x212cf2,0x0,!![],moment())[_0xf69c('0xd')](function(){return _0x5a0e96(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xf69c('0x1a')](_0x212cf2,_0x24e469,![],null)[_0xf69c('0xd')](function(){return _0x5a0e96(null,![],{'message':_0xf69c('0x16')});});}}}else{return _0x5a0e96(null,![],{'message':_0xf69c('0x16')});}}else{if(_0x212cf2[_0xf69c('0x10')]){return _0x5a0e96(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x31db93[_0xf69c('0x17')]>0x0){if(_0x212cf2['blocked']){if(_0x31db93[_0xf69c('0xc')]>0x0){if(moment(_0x212cf2[_0xf69c('0x12')])[_0xf69c('0x18')](_0x31db93[_0xf69c('0xc')],_0xf69c('0x19'))>moment()){return _0x5a0e96(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xf69c('0x1a')](_0x212cf2,0x0,![],null)[_0xf69c('0xd')](function(){return utils[_0xf69c('0x1b')](_0x212cf2);})[_0xf69c('0xd')](function(){return _0x5a0e96(null,_0x212cf2);});}}else{return _0x5a0e96(null,![],{'message':_0xf69c('0x16')});}}else{return utils[_0xf69c('0x1a')](_0x212cf2,0x0,![],null)[_0xf69c('0xd')](function(){return utils[_0xf69c('0x1b')](_0x212cf2);})[_0xf69c('0xd')](function(){return _0x5a0e96(null,_0x212cf2);})[_0xf69c('0x1c')](function(_0x3f0917){return _0x5a0e96(null,![],_0x3f0917);});}}else{if(_0x212cf2['blocked']){return _0x5a0e96(null,![],{'message':_0xf69c('0x16')});}else{return utils['getLicense'](_0x212cf2)['then'](function(){return _0x5a0e96(null,_0x212cf2);});}}}});})[_0xf69c('0x1c')](function(_0xc3b590){return _0x5a0e96(null,![],_0xc3b590);});}function sendServiceMail(_0x1abf87){return db['MailAccount'][_0xf69c('0x1d')]({'where':{'service':!![]},'attributes':['id',_0xf69c('0x14'),'email'],'include':[{'model':db[_0xf69c('0x1e')],'as':_0xf69c('0x1f'),'include':[{'model':db[_0xf69c('0x20')],'as':_0xf69c('0x20')}]}]})[_0xf69c('0xd')](function(_0x3411f4){if(!_0x3411f4){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5bb43b=_0x3411f4['getSmtpOptions']();var _0x400cc4={'account':_0x5bb43b,'message':_['merge']({'from':util['format'](_0xf69c('0x21'),_0x3411f4[_0xf69c('0x14')],_0x3411f4[_0xf69c('0x22')]||_0x3411f4[_0xf69c('0x1f')][_0xf69c('0x23')])},_0x1abf87)};return client[_0xf69c('0x24')](_0xf69c('0x25'),_0x400cc4);})[_0xf69c('0xd')](function(_0x345f86){if(_0x345f86['error']){throw new Error(util[_0xf69c('0x26')](_0xf69c('0x27'),_0x345f86[_0xf69c('0x28')][_0xf69c('0x29')]||JSON[_0xf69c('0x2a')](_0x345f86[_0xf69c('0x28')])));}return!![];});}function handleError(_0x199745,_0x5d9955,_0x5543ad){return _0x199745[_0xf69c('0x2b')](_0x5d9955||0x1f4)[_0xf69c('0x2c')]({'message':_0x5543ad?_0x5543ad[_0xf69c('0x29')]||_0x5543ad:''});}exports['login']=function(_0x36be49,_0x394471,_0x204c23){passport[_0xf69c('0x15')](_0xf69c('0x2d'),function(_0xb553cc,_0x549604,_0x57a6cd){var _0x6c0c2d=_0xb553cc||_0x57a6cd;if(_0x6c0c2d){return handleError(_0x394471,0x191,_0x6c0c2d);}if(!_0x549604){return handleError(_0x394471,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x55cfc6={'payload':{'id':_0x549604['id'],'role':_0x549604['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x55cfc6)['then'](function(_0xbe7ae3){_0x394471[_0xf69c('0x2e')]({'id':_0x549604['id'],'token':_0xbe7ae3,'statusCall':'','isAlreadyLogged':_0x549604[_0xf69c('0x2f')]});});}})(_0x36be49,_0x394471,_0x204c23);};exports[_0xf69c('0x30')]=function(_0x5a3ff4,_0x3e6b4c){if(!_0x5a3ff4['body']['email']){return handleError(_0x3e6b4c,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x4e5318=rs[_0xf69c('0x31')]();_0x5a3ff4['body'][_0xf69c('0x22')]=_0x5a3ff4[_0xf69c('0x32')][_0xf69c('0x22')]['trim']()[_0xf69c('0x33')]();var _0x307861;return db[_0xf69c('0xa')][_0xf69c('0xb')]({'where':{'id':0x1},'attributes':[_0xf69c('0x17'),_0xf69c('0xc')],'raw':!![]})[_0xf69c('0xd')](function(_0x494f5a){_0x307861=_0x494f5a;return db[_0xf69c('0x34')][_0xf69c('0x1d')]({'where':{'email':_0x5a3ff4['body'][_0xf69c('0x22')]}});})[_0xf69c('0xd')](function(_0x22da9b){if(!_0x22da9b){throw new Error(_0xf69c('0x35'));}if(_0x22da9b[_0xf69c('0x10')]){throw new Error(_0xf69c('0x36'));}if(_0x22da9b['blocked']){if(moment(_0x22da9b[_0xf69c('0x12')])['add'](_0x307861[_0xf69c('0xc')],_0xf69c('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x22da9b[_0xf69c('0x11')]=![];_0x22da9b[_0xf69c('0x12')]=null;}}_0x22da9b[_0xf69c('0x37')]=_0x4e5318;_0x22da9b[_0xf69c('0x38')]=Date[_0xf69c('0x39')]()+0x36ee80;return _0x22da9b[_0xf69c('0x3a')]();})['then'](function(){return sendServiceMail({'to':_0x5a3ff4[_0xf69c('0x32')][_0xf69c('0x22')],'subject':_0xf69c('0x3b'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xf69c('0x3c')+_0xf69c('0x3d')+_0x5a3ff4[_0xf69c('0x3e')][_0xf69c('0x3f')]+_0xf69c('0x40')+_0x4e5318+'\x0a\x0a'+_0xf69c('0x41')});})[_0xf69c('0xd')](function(){_0x3e6b4c[_0xf69c('0x2b')](0xc8)[_0xf69c('0x2c')]({'message':_0xf69c('0x42')});})['catch'](function(_0x2a19a8){return handleError(_0x3e6b4c,0x1f4,_0x2a19a8);});};exports[_0xf69c('0x43')]=function(_0x376dba,_0x43fac1){return db[_0xf69c('0x34')]['find']({'where':{'resetPasswordToken':_0x376dba['params']['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xf69c('0xd')](function(_0x656ecc){if(!_0x656ecc){throw new Error(_0xf69c('0x44'));}return db[_0xf69c('0xa')]['findOne']({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x1217d9){if(_0x1217d9[_0xf69c('0x45')])authService[_0xf69c('0x46')](_0x376dba[_0xf69c('0x32')][_0xf69c('0xe')]);if(!_0x1217d9[_0xf69c('0x47')]||!_0x656ecc['previousPasswords'])return _0x656ecc;authService[_0xf69c('0x48')](_0x376dba['body'][_0xf69c('0xe')],_0x656ecc['previousPasswords'],_0x1217d9[_0xf69c('0x49')]);return _0x656ecc;})[_0xf69c('0xd')](function(){_0x656ecc['password']=_0x376dba[_0xf69c('0x32')][_0xf69c('0xe')];_0x656ecc['resetPasswordToken']=null;_0x656ecc['resetPasswordExpires']=null;return _0x656ecc[_0xf69c('0x3a')]();});})['then'](function(){_0x43fac1[_0xf69c('0x2b')](0xc8)[_0xf69c('0x2c')]({'message':_0xf69c('0x4a')});})[_0xf69c('0x1c')](function(_0x23d93e){return handleError(_0x43fac1,0x1f4,_0x23d93e);});};passport['use'](_0xf69c('0x2d'),new LocalStrategy({'usernameField':_0xf69c('0x14'),'passwordField':'password'},function(_0x2c4e08,_0x4ee086,_0x39251b){return localAuthenticate(db[_0xf69c('0x34')],_0x2c4e08,_0x4ee086,_0x39251b);})); \ No newline at end of file +var _0xcfc8=['reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','use','User','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','then','name','password','salt','role','disabled','blocked','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','blockedAt','add','clearBlockUser','minutes','catch','getLicense','MailAccount','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','merge','format','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','trim','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','body','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'];(function(_0x1e0b1b,_0x339fb7){var _0x332481=function(_0x84430f){while(--_0x84430f){_0x1e0b1b['push'](_0x1e0b1b['shift']());}};_0x332481(++_0x339fb7);}(_0xcfc8,0x1b2));var _0x8cfc=function(_0x369496,_0x32faa7){_0x369496=_0x369496-0x0;var _0x33bda5=_0xcfc8[_0x369496];return _0x33bda5;};'use strict';var util=require(_0x8cfc('0x0'));var passport=require(_0x8cfc('0x1'));var LocalStrategy=require(_0x8cfc('0x2'))[_0x8cfc('0x3')];var jayson=require(_0x8cfc('0x4'));var _=require('lodash');var rs=require(_0x8cfc('0x5'));var moment=require(_0x8cfc('0x6'));var db=require(_0x8cfc('0x7'))['db'];var authService=require(_0x8cfc('0x8'));var utils=require(_0x8cfc('0x9'));var client=jayson[_0x8cfc('0xa')][_0x8cfc('0xb')]({'port':0x232b});function localAuthenticate(_0xd3ae63,_0x1096e2,_0x70b508,_0x96fb9c){var _0x276bfa,_0x2f7ffa;return db['Setting'][_0x8cfc('0xc')]({'where':{'id':0x1},'attributes':[_0x8cfc('0xd'),'blockDuration'],'raw':!![]})[_0x8cfc('0xe')](function(_0x533668){_0x276bfa=_0x533668;return _0xd3ae63[_0x8cfc('0xc')]({'attributes':['id',_0x8cfc('0xf'),_0x8cfc('0x10'),_0x8cfc('0x11'),_0x8cfc('0x12'),_0x8cfc('0x13'),_0x8cfc('0x14'),'blockedAt',_0x8cfc('0x15')],'where':{'name':_0x1096e2,'role':{'$or':[_0x8cfc('0x16'),_0x8cfc('0x17'),_0x8cfc('0x18')]}}});})[_0x8cfc('0xe')](function(_0x13a462){if(!_0x13a462||_0x13a462&&_0x13a462['name']!==_0x1096e2){throw new Error(_0x8cfc('0x19'));}else{_0x2f7ffa=_0x13a462;return _0x2f7ffa;}})['then'](function(){_0x2f7ffa[_0x8cfc('0x1a')](_0x70b508,function(_0x499cde,_0x4227ae){var _0x32bf40=_0x2f7ffa[_0x8cfc('0x15')]+0x1;if(_0x499cde){return _0x96fb9c(_0x499cde);}else if(!_0x4227ae){if(_0x2f7ffa[_0x8cfc('0x13')]){return _0x96fb9c(null,![],{'message':_0x8cfc('0x19')});}else if(_0x276bfa[_0x8cfc('0xd')]>0x0){if(_0x2f7ffa[_0x8cfc('0x14')]){if(_0x276bfa[_0x8cfc('0x1b')]>0x0){if(moment(_0x2f7ffa[_0x8cfc('0x1c')])[_0x8cfc('0x1d')](_0x276bfa[_0x8cfc('0x1b')],'minutes')>moment()){return _0x96fb9c(null,![],{'message':_0x8cfc('0x19')});}else{return utils[_0x8cfc('0x1e')](_0x2f7ffa,_0x32bf40,![],null)[_0x8cfc('0xe')](function(){return _0x96fb9c(null,![],{'message':_0x8cfc('0x19')});});}}else{return _0x96fb9c(null,![],{'message':_0x8cfc('0x19')});}}else{if(_0x32bf40>=_0x276bfa['allowedLoginAttempts']){return utils[_0x8cfc('0x1e')](_0x2f7ffa,0x0,!![],moment())[_0x8cfc('0xe')](function(){return _0x96fb9c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x8cfc('0x1e')](_0x2f7ffa,_0x32bf40,![],null)[_0x8cfc('0xe')](function(){return _0x96fb9c(null,![],{'message':_0x8cfc('0x19')});});}}}else{return _0x96fb9c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2f7ffa[_0x8cfc('0x13')]){return _0x96fb9c(null,![],{'message':_0x8cfc('0x19')});}else if(_0x276bfa[_0x8cfc('0xd')]>0x0){if(_0x2f7ffa[_0x8cfc('0x14')]){if(_0x276bfa[_0x8cfc('0x1b')]>0x0){if(moment(_0x2f7ffa['blockedAt'])[_0x8cfc('0x1d')](_0x276bfa[_0x8cfc('0x1b')],_0x8cfc('0x1f'))>moment()){return _0x96fb9c(null,![],{'message':_0x8cfc('0x19')});}else{return utils[_0x8cfc('0x1e')](_0x2f7ffa,0x0,![],null)['then'](function(){return utils['getLicense'](_0x2f7ffa);})[_0x8cfc('0xe')](function(){return _0x96fb9c(null,_0x2f7ffa);});}}else{return _0x96fb9c(null,![],{'message':_0x8cfc('0x19')});}}else{return utils[_0x8cfc('0x1e')](_0x2f7ffa,0x0,![],null)[_0x8cfc('0xe')](function(){return utils['getLicense'](_0x2f7ffa);})[_0x8cfc('0xe')](function(){return _0x96fb9c(null,_0x2f7ffa);})[_0x8cfc('0x20')](function(_0x32d6c9){return _0x96fb9c(null,![],_0x32d6c9);});}}else{if(_0x2f7ffa[_0x8cfc('0x14')]){return _0x96fb9c(null,![],{'message':_0x8cfc('0x19')});}else{return utils[_0x8cfc('0x21')](_0x2f7ffa)['then'](function(){return _0x96fb9c(null,_0x2f7ffa);});}}}});})['catch'](function(_0x547e98){return _0x96fb9c(null,![],_0x547e98);});}function sendServiceMail(_0x5a2eeb){return db[_0x8cfc('0x22')]['find']({'where':{'service':!![]},'attributes':['id',_0x8cfc('0xf'),_0x8cfc('0x23')],'include':[{'model':db[_0x8cfc('0x24')],'as':_0x8cfc('0x25'),'include':[{'model':db[_0x8cfc('0x26')],'as':_0x8cfc('0x26')}]}]})[_0x8cfc('0xe')](function(_0x1d97e6){if(!_0x1d97e6){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1a7dfc=_0x1d97e6[_0x8cfc('0x27')]();var _0x276bb6={'account':_0x1a7dfc,'message':_[_0x8cfc('0x28')]({'from':util[_0x8cfc('0x29')]('\x22%s\x22\x20<%s>',_0x1d97e6[_0x8cfc('0xf')],_0x1d97e6['email']||_0x1d97e6['Smtp'][_0x8cfc('0x17')])},_0x5a2eeb)};return client['request'](_0x8cfc('0x2a'),_0x276bb6);})[_0x8cfc('0xe')](function(_0x26e451){if(_0x26e451[_0x8cfc('0x2b')]){throw new Error(util[_0x8cfc('0x29')](_0x8cfc('0x2c'),_0x26e451['error'][_0x8cfc('0x2d')]||JSON['stringify'](_0x26e451[_0x8cfc('0x2b')])));}return!![];});}function handleError(_0x5a28a3,_0x35a45b,_0x361d2f){return _0x5a28a3[_0x8cfc('0x2e')](_0x35a45b||0x1f4)[_0x8cfc('0x2f')]({'message':_0x361d2f?_0x361d2f[_0x8cfc('0x2d')]||_0x361d2f:''});}exports[_0x8cfc('0x30')]=function(_0x42d781,_0x478d90,_0x3f6a2e){passport[_0x8cfc('0x1a')](_0x8cfc('0x31'),function(_0x29be9f,_0x255765,_0x34dcd0){var _0x503372=_0x29be9f||_0x34dcd0;if(_0x503372){return handleError(_0x478d90,0x191,_0x503372);}if(!_0x255765){return handleError(_0x478d90,0x194,{'message':_0x8cfc('0x32')});}else{var _0x551a30={'payload':{'id':_0x255765['id'],'role':_0x255765[_0x8cfc('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x8cfc('0x33')](_0x551a30)['then'](function(_0x35b66a){_0x478d90['json']({'id':_0x255765['id'],'token':_0x35b66a,'statusCall':'','isAlreadyLogged':_0x255765[_0x8cfc('0x34')]});});}})(_0x42d781,_0x478d90,_0x3f6a2e);};exports[_0x8cfc('0x35')]=function(_0x364745,_0x5e81fe){if(!_0x364745['body'][_0x8cfc('0x23')]){return handleError(_0x5e81fe,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x5e12d1=rs['generate']();_0x364745['body'][_0x8cfc('0x23')]=_0x364745['body']['email'][_0x8cfc('0x36')]()[_0x8cfc('0x37')]();var _0x306f01;return db['Setting'][_0x8cfc('0xc')]({'where':{'id':0x1},'attributes':[_0x8cfc('0xd'),'blockDuration'],'raw':!![]})[_0x8cfc('0xe')](function(_0x1f167b){_0x306f01=_0x1f167b;return db['User'][_0x8cfc('0x38')]({'where':{'email':_0x364745['body'][_0x8cfc('0x23')]}});})['then'](function(_0x584c4f){if(!_0x584c4f){throw new Error(_0x8cfc('0x39'));}if(_0x584c4f['disabled']){throw new Error(_0x8cfc('0x3a'));}if(_0x584c4f[_0x8cfc('0x14')]){if(moment(_0x584c4f[_0x8cfc('0x1c')])[_0x8cfc('0x1d')](_0x306f01[_0x8cfc('0x1b')],_0x8cfc('0x1f'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x584c4f[_0x8cfc('0x14')]=![];_0x584c4f[_0x8cfc('0x1c')]=null;}}_0x584c4f[_0x8cfc('0x3b')]=_0x5e12d1;_0x584c4f[_0x8cfc('0x3c')]=Date[_0x8cfc('0x3d')]()+0x36ee80;return _0x584c4f[_0x8cfc('0x3e')]();})[_0x8cfc('0xe')](function(){return sendServiceMail({'to':_0x364745[_0x8cfc('0x3f')][_0x8cfc('0x23')],'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'+_0x8cfc('0x40')+_0x8cfc('0x41')+_0x364745[_0x8cfc('0x42')][_0x8cfc('0x43')]+_0x8cfc('0x44')+_0x5e12d1+'\x0a\x0a'+_0x8cfc('0x45')});})[_0x8cfc('0xe')](function(){_0x5e81fe['status'](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0x8cfc('0x20')](function(_0x3732eb){return handleError(_0x5e81fe,0x1f4,_0x3732eb);});};exports[_0x8cfc('0x46')]=function(_0x3c7fec,_0x17135d){return db['User'][_0x8cfc('0x38')]({'where':{'resetPasswordToken':_0x3c7fec[_0x8cfc('0x47')][_0x8cfc('0x48')],'resetPasswordExpires':{'$gt':Date[_0x8cfc('0x3d')]()}}})[_0x8cfc('0xe')](function(_0x5cec05){if(!_0x5cec05){throw new Error(_0x8cfc('0x49'));}return db[_0x8cfc('0x4a')][_0x8cfc('0xc')]({'attributes':['id',_0x8cfc('0x4b'),'enforcePasswordHistory',_0x8cfc('0x4c')]})[_0x8cfc('0xe')](function(_0x43d5f3){if(_0x43d5f3[_0x8cfc('0x4b')])authService[_0x8cfc('0x4d')](_0x3c7fec[_0x8cfc('0x3f')]['password']);if(!_0x43d5f3[_0x8cfc('0x4e')]||!_0x5cec05[_0x8cfc('0x4f')])return _0x5cec05;authService[_0x8cfc('0x50')](_0x3c7fec[_0x8cfc('0x3f')]['password'],_0x5cec05[_0x8cfc('0x4f')],_0x43d5f3['passwordHistoryLimit']);return _0x5cec05;})[_0x8cfc('0xe')](function(){_0x5cec05['password']=_0x3c7fec[_0x8cfc('0x3f')][_0x8cfc('0x10')];_0x5cec05[_0x8cfc('0x3b')]=null;_0x5cec05[_0x8cfc('0x3c')]=null;return _0x5cec05['save']();});})[_0x8cfc('0xe')](function(){_0x17135d['status'](0xc8)['send']({'message':_0x8cfc('0x51')});})[_0x8cfc('0x20')](function(_0x3c4392){return handleError(_0x17135d,0x1f4,_0x3c4392);});};passport[_0x8cfc('0x52')](_0x8cfc('0x31'),new LocalStrategy({'usernameField':_0x8cfc('0xf'),'passwordField':_0x8cfc('0x10')},function(_0x2e58b9,_0x9bb427,_0x2ea60f){return localAuthenticate(db[_0x8cfc('0x53')],_0x2e58b9,_0x9bb427,_0x2ea60f);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 5b72015..6d904dd 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 _0x5b68=['Router','./authLocal.controller','post','login','forgot','reset','exports','express'];(function(_0x5ce850,_0x28bfe5){var _0x12753a=function(_0x5eacdb){while(--_0x5eacdb){_0x5ce850['push'](_0x5ce850['shift']());}};_0x12753a(++_0x28bfe5);}(_0x5b68,0x15f));var _0x85b6=function(_0x4b34c4,_0xc61ba4){_0x4b34c4=_0x4b34c4-0x0;var _0x418e46=_0x5b68[_0x4b34c4];return _0x418e46;};'use strict';var express=require(_0x85b6('0x0'));var router=express[_0x85b6('0x1')]();var controller=require(_0x85b6('0x2'));router[_0x85b6('0x3')]('/',controller[_0x85b6('0x4')]);router['post']('/forgot',controller[_0x85b6('0x5')]);router[_0x85b6('0x3')]('/reset/:token',controller[_0x85b6('0x6')]);module[_0x85b6('0x7')]=router; \ No newline at end of file +var _0xd6fb=['express','post','/reset/:token','exports'];(function(_0x22b5ff,_0x27c560){var _0x16401d=function(_0x46978f){while(--_0x46978f){_0x22b5ff['push'](_0x22b5ff['shift']());}};_0x16401d(++_0x27c560);}(_0xd6fb,0x1bc));var _0xbd6f=function(_0x45fc19,_0x354723){_0x45fc19=_0x45fc19-0x0;var _0x4e8510=_0xd6fb[_0x45fc19];return _0x4e8510;};'use strict';var express=require(_0xbd6f('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0xbd6f('0x1')]('/',controller['login']);router[_0xbd6f('0x1')]('/forgot',controller['forgot']);router[_0xbd6f('0x1')](_0xbd6f('0x2'),controller['reset']);module[_0xbd6f('0x3')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 61c00a4..be6098a 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 _0xef06=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xef06,0x1a0));var _0x6ef0=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0xef06[_0x5f519b];return _0x2461e2;};'use strict';var Sequelize=require(_0x6ef0('0x0'));module[_0x6ef0('0x1')]={'name':{'type':Sequelize[_0x6ef0('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6ef0('0x2')]},'status':{'type':Sequelize[_0x6ef0('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6ef0('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7a6c=['STRING','INTEGER','sequelize'];(function(_0x2d5730,_0x5bcd05){var _0x51d28d=function(_0xe36442){while(--_0xe36442){_0x2d5730['push'](_0x2d5730['shift']());}};_0x51d28d(++_0x5bcd05);}(_0x7a6c,0xd7));var _0xc7a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc7a6('0x0'));module['exports']={'name':{'type':Sequelize[_0xc7a6('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xc7a6('0x1')]},'description':{'type':Sequelize[_0xc7a6('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc7a6('0x2')],'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 24974eb..4bbc1d8 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 _0x744f=['findAll','rows','catch','show','params','find','create','body','addConditions','Condition','omit','ids','getConditions','order','nolimit','addActions','getActions','findOne','Action','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','where','merge','map','filter','options','Automation','include'];(function(_0x2dc79e,_0xcde3dd){var _0x1679a0=function(_0x1363c8){while(--_0x1363c8){_0x2dc79e['push'](_0x2dc79e['shift']());}};_0x1679a0(++_0xcde3dd);}(_0x744f,0x1e7));var _0xf744=function(_0x192937,_0x445940){_0x192937=_0x192937-0x0;var _0x289d0d=_0x744f[_0x192937];return _0x289d0d;};'use strict';var emlformat=require(_0xf744('0x0'));var rimraf=require(_0xf744('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf744('0x2'));var rp=require(_0xf744('0x3'));var moment=require(_0xf744('0x4'));var BPromise=require(_0xf744('0x5'));var Mustache=require('mustache');var util=require(_0xf744('0x6'));var path=require(_0xf744('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf744('0x8'));var _=require(_0xf744('0x9'));var squel=require(_0xf744('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf744('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf744('0xc'));var Redis=require(_0xf744('0xd'));var authService=require(_0xf744('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf744('0xf'));var hardwareService=require(_0xf744('0x10'));var logger=require(_0xf744('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf744('0x12'));var db=require(_0xf744('0x13'))['db'];function respondWithStatusCode(_0x3dc899,_0x33877c){_0x33877c=_0x33877c||0xcc;return function(_0x1913c4){if(_0x1913c4){return _0x3dc899['sendStatus'](_0x33877c);}return _0x3dc899[_0xf744('0x14')](_0x33877c)[_0xf744('0x15')]();};}function respondWithResult(_0x1b5e1c,_0x546cd8){_0x546cd8=_0x546cd8||0xc8;return function(_0x1dadce){if(_0x1dadce){return _0x1b5e1c[_0xf744('0x14')](_0x546cd8)[_0xf744('0x16')](_0x1dadce);}};}function respondWithFilteredResult(_0xf00208,_0x3c3b47){return function(_0x4a0c38){if(_0x4a0c38){var _0x2bd560=typeof _0x3c3b47[_0xf744('0x17')]==='undefined'&&typeof _0x3c3b47[_0xf744('0x18')]==='undefined';var _0x202f88=_0x4a0c38[_0xf744('0x19')];var _0x3ab722=_0x2bd560?0x0:_0x3c3b47[_0xf744('0x17')];var _0x55914=_0x2bd560?_0x4a0c38[_0xf744('0x19')]:_0x3c3b47[_0xf744('0x17')]+_0x3c3b47['limit'];var _0x244ab8;if(_0x55914>=_0x202f88){_0x55914=_0x202f88;_0x244ab8=0xc8;}else{_0x244ab8=0xce;}_0xf00208[_0xf744('0x14')](_0x244ab8);return _0xf00208[_0xf744('0x1a')](_0xf744('0x1b'),_0x3ab722+'-'+_0x55914+'/'+_0x202f88)['json'](_0x4a0c38);}return null;};}function patchUpdates(_0x35c7f1){return function(_0x14a07b){try{jsonpatch[_0xf744('0x1c')](_0x14a07b,_0x35c7f1,!![]);}catch(_0x249ef9){return BPromise[_0xf744('0x1d')](_0x249ef9);}return _0x14a07b[_0xf744('0x1e')]();};}function saveUpdates(_0x40b907,_0x46b888){return function(_0x4bdce8){if(_0x4bdce8){return _0x4bdce8[_0xf744('0x1f')](_0x40b907)[_0xf744('0x20')](function(_0x1bc6db){return _0x1bc6db;});}return null;};}function removeEntity(_0x4e560b,_0x145e7b){return function(_0x4e195a){if(_0x4e195a){return _0x4e195a[_0xf744('0x21')]()[_0xf744('0x20')](function(){_0x4e560b['status'](0xcc)[_0xf744('0x15')]();});}};}function handleEntityNotFound(_0x4e8c04,_0x3d84f6){return function(_0x42c192){if(!_0x42c192){_0x4e8c04['sendStatus'](0x194);}return _0x42c192;};}function handleError(_0x5127a1,_0x4f32b7){_0x4f32b7=_0x4f32b7||0x1f4;return function(_0x2bf37d){logger['error'](_0x2bf37d[_0xf744('0x22')]);if(_0x2bf37d[_0xf744('0x23')]){delete _0x2bf37d[_0xf744('0x23')];}_0x5127a1['status'](_0x4f32b7)['send'](_0x2bf37d);};}exports[_0xf744('0x24')]=function(_0x2f76c6,_0x3da644){var _0x32c01a={},_0x480479={},_0x46ddb0={'count':0x0,'rows':[]};var _0xd63676=_['map'](db['Automation'][_0xf744('0x25')],function(_0x5bbbbf){return{'name':_0x5bbbbf[_0xf744('0x26')],'type':_0x5bbbbf[_0xf744('0x27')][_0xf744('0x28')]};});_0x480479[_0xf744('0x29')]=_['map'](_0xd63676,_0xf744('0x23'));_0x480479['query']=_[_0xf744('0x2a')](_0x2f76c6[_0xf744('0x2b')]);_0x480479[_0xf744('0x2c')]=_['intersection'](_0x480479['model'],_0x480479[_0xf744('0x2b')]);_0x32c01a[_0xf744('0x2d')]=_[_0xf744('0x2e')](_0x480479[_0xf744('0x29')],qs[_0xf744('0x2f')](_0x2f76c6[_0xf744('0x2b')][_0xf744('0x2f')]));_0x32c01a[_0xf744('0x2d')]=_0x32c01a[_0xf744('0x2d')][_0xf744('0x30')]?_0x32c01a[_0xf744('0x2d')]:_0x480479['model'];if(!_0x2f76c6[_0xf744('0x2b')][_0xf744('0x31')]('nolimit')){_0x32c01a['limit']=qs[_0xf744('0x18')](_0x2f76c6[_0xf744('0x2b')]['limit']);_0x32c01a[_0xf744('0x17')]=qs[_0xf744('0x17')](_0x2f76c6[_0xf744('0x2b')][_0xf744('0x17')]);}_0x32c01a['order']=qs[_0xf744('0x32')](_0x2f76c6['query']['sort']);_0x32c01a['where']=qs[_0xf744('0x2c')](_[_0xf744('0x33')](_0x2f76c6[_0xf744('0x2b')],_0x480479['filters']),_0xd63676);if(_0x2f76c6[_0xf744('0x2b')]['filter']){_0x32c01a[_0xf744('0x34')]=_[_0xf744('0x35')](_0x32c01a[_0xf744('0x34')],{'$or':_[_0xf744('0x36')](_0xd63676,function(_0x189f15){if(_0x189f15[_0xf744('0x27')]!=='VIRTUAL'){var _0x407d73={};_0x407d73[_0x189f15[_0xf744('0x23')]]={'$like':'%'+_0x2f76c6['query'][_0xf744('0x37')]+'%'};return _0x407d73;}})});}_0x32c01a=_['merge']({},_0x32c01a,_0x2f76c6[_0xf744('0x38')]);var _0x46f277={'where':_0x32c01a[_0xf744('0x34')]};return db[_0xf744('0x39')][_0xf744('0x19')](_0x46f277)[_0xf744('0x20')](function(_0x841c0e){_0x46ddb0[_0xf744('0x19')]=_0x841c0e;if(_0x2f76c6[_0xf744('0x2b')]['includeAll']){_0x32c01a[_0xf744('0x3a')]=[{'all':!![]}];}return db['Automation'][_0xf744('0x3b')](_0x32c01a);})[_0xf744('0x20')](function(_0x7692f2){_0x46ddb0[_0xf744('0x3c')]=_0x7692f2;return _0x46ddb0;})[_0xf744('0x20')](respondWithFilteredResult(_0x3da644,_0x32c01a))[_0xf744('0x3d')](handleError(_0x3da644,null));};exports[_0xf744('0x3e')]=function(_0x219ddf,_0x123d35){var _0xa89e27={'raw':![],'where':{'id':_0x219ddf[_0xf744('0x3f')]['id']}},_0x2d076d={};_0x2d076d[_0xf744('0x29')]=_[_0xf744('0x2a')](db[_0xf744('0x39')][_0xf744('0x25')]);_0x2d076d[_0xf744('0x2b')]=_['keys'](_0x219ddf[_0xf744('0x2b')]);_0x2d076d[_0xf744('0x2c')]=_[_0xf744('0x2e')](_0x2d076d[_0xf744('0x29')],_0x2d076d[_0xf744('0x2b')]);_0xa89e27['attributes']=_[_0xf744('0x2e')](_0x2d076d['model'],qs[_0xf744('0x2f')](_0x219ddf[_0xf744('0x2b')]['fields']));_0xa89e27[_0xf744('0x2d')]=_0xa89e27[_0xf744('0x2d')][_0xf744('0x30')]?_0xa89e27['attributes']:_0x2d076d[_0xf744('0x29')];if(_0x219ddf[_0xf744('0x2b')]['includeAll']){_0xa89e27[_0xf744('0x3a')]=[{'all':!![]}];}_0xa89e27=_[_0xf744('0x35')]({},_0xa89e27,_0x219ddf[_0xf744('0x38')]);return db[_0xf744('0x39')][_0xf744('0x40')](_0xa89e27)[_0xf744('0x20')](handleEntityNotFound(_0x123d35,null))[_0xf744('0x20')](respondWithResult(_0x123d35,null))[_0xf744('0x3d')](handleError(_0x123d35,null));};exports['create']=function(_0x44ecd7,_0x243b5b){return db[_0xf744('0x39')][_0xf744('0x41')](_0x44ecd7[_0xf744('0x42')],{})[_0xf744('0x20')](respondWithResult(_0x243b5b,0xc9))[_0xf744('0x3d')](handleError(_0x243b5b,null));};exports[_0xf744('0x1f')]=function(_0x47f1df,_0xb263ef){if(_0x47f1df[_0xf744('0x42')]['id']){delete _0x47f1df['body']['id'];}return db[_0xf744('0x39')]['find']({'where':{'id':_0x47f1df[_0xf744('0x3f')]['id']}})[_0xf744('0x20')](handleEntityNotFound(_0xb263ef,null))['then'](saveUpdates(_0x47f1df['body'],null))[_0xf744('0x20')](respondWithResult(_0xb263ef,null))[_0xf744('0x3d')](handleError(_0xb263ef,null));};exports[_0xf744('0x21')]=function(_0x5198f1,_0x4da51c){return db[_0xf744('0x39')][_0xf744('0x40')]({'where':{'id':_0x5198f1[_0xf744('0x3f')]['id']}})[_0xf744('0x20')](handleEntityNotFound(_0x4da51c,null))[_0xf744('0x20')](removeEntity(_0x4da51c,null))[_0xf744('0x3d')](handleError(_0x4da51c,null));};exports[_0xf744('0x43')]=function(_0x225161,_0x37f881,_0xec9ece){return db[_0xf744('0x44')]['find']({'where':{'id':_0x225161[_0xf744('0x3f')]['id']}})[_0xf744('0x20')](handleEntityNotFound(_0x37f881,null))[_0xf744('0x20')](function(_0x524bcd){if(_0x524bcd){return _0x524bcd[_0xf744('0x43')](_0x225161[_0xf744('0x42')]['ids'],_[_0xf744('0x45')](_0x225161[_0xf744('0x42')],[_0xf744('0x46'),'id'])||{});}})['then'](respondWithResult(_0x37f881,null))[_0xf744('0x3d')](handleError(_0x37f881,null));};exports[_0xf744('0x47')]=function(_0x2e1bf7,_0x4d3721,_0x4a1bab){var _0x5a15c6={};var _0x403467={};var _0x5aae4d;var _0x2bcf2c;return db[_0xf744('0x39')]['findOne']({'where':{'id':_0x2e1bf7[_0xf744('0x3f')]['id']}})[_0xf744('0x20')](handleEntityNotFound(_0x4d3721,null))[_0xf744('0x20')](function(_0x18d59f){if(_0x18d59f){_0x5aae4d=_0x18d59f;_0x403467[_0xf744('0x29')]=_['keys'](db[_0xf744('0x44')][_0xf744('0x25')]);_0x403467['query']=_[_0xf744('0x2a')](_0x2e1bf7[_0xf744('0x2b')]);_0x403467[_0xf744('0x2c')]=_[_0xf744('0x2e')](_0x403467[_0xf744('0x29')],_0x403467[_0xf744('0x2b')]);_0x5a15c6[_0xf744('0x2d')]=_['intersection'](_0x403467[_0xf744('0x29')],qs['fields'](_0x2e1bf7[_0xf744('0x2b')]['fields']));_0x5a15c6[_0xf744('0x2d')]=_0x5a15c6[_0xf744('0x2d')][_0xf744('0x30')]?_0x5a15c6[_0xf744('0x2d')]:_0x403467[_0xf744('0x29')];_0x5a15c6[_0xf744('0x48')]=qs[_0xf744('0x32')](_0x2e1bf7['query'][_0xf744('0x32')]);_0x5a15c6[_0xf744('0x34')]=qs[_0xf744('0x2c')](_[_0xf744('0x33')](_0x2e1bf7[_0xf744('0x2b')],_0x403467[_0xf744('0x2c')]));if(_0x2e1bf7['query']['filter']){_0x5a15c6[_0xf744('0x34')]=_[_0xf744('0x35')](_0x5a15c6[_0xf744('0x34')],{'$or':_[_0xf744('0x36')](_0x5a15c6[_0xf744('0x2d')],function(_0x529815){var _0x1cb35c={};_0x1cb35c[_0x529815]={'$like':'%'+_0x2e1bf7[_0xf744('0x2b')][_0xf744('0x37')]+'%'};return _0x1cb35c;})});}_0x5a15c6=_[_0xf744('0x35')]({},_0x5a15c6,_0x2e1bf7[_0xf744('0x38')]);return _0x5aae4d[_0xf744('0x47')](_0x5a15c6);}})[_0xf744('0x20')](function(_0x55aebe){if(_0x55aebe){_0x2bcf2c=_0x55aebe[_0xf744('0x30')];if(!_0x2e1bf7[_0xf744('0x2b')][_0xf744('0x31')](_0xf744('0x49'))){_0x5a15c6[_0xf744('0x18')]=qs['limit'](_0x2e1bf7[_0xf744('0x2b')][_0xf744('0x18')]);_0x5a15c6[_0xf744('0x17')]=qs[_0xf744('0x17')](_0x2e1bf7[_0xf744('0x2b')]['offset']);}return _0x5aae4d[_0xf744('0x47')](_0x5a15c6);}})[_0xf744('0x20')](function(_0x26b6da){if(_0x26b6da){return _0x26b6da?{'count':_0x2bcf2c,'rows':_0x26b6da}:null;}})['then'](respondWithResult(_0x4d3721,null))[_0xf744('0x3d')](handleError(_0x4d3721,null));};exports[_0xf744('0x4a')]=function(_0x369af0,_0x401cb2,_0x4a4e0b){return db['Action'][_0xf744('0x40')]({'where':{'id':_0x369af0[_0xf744('0x3f')]['id']}})['then'](handleEntityNotFound(_0x401cb2,null))['then'](function(_0x2e3e16){if(_0x2e3e16){return _0x2e3e16[_0xf744('0x4a')](_0x369af0[_0xf744('0x42')][_0xf744('0x46')],_[_0xf744('0x45')](_0x369af0[_0xf744('0x42')],['ids','id'])||{});}})[_0xf744('0x20')](respondWithResult(_0x401cb2,null))[_0xf744('0x3d')](handleError(_0x401cb2,null));};exports[_0xf744('0x4b')]=function(_0x58bc2d,_0x3bc2a0,_0x25a338){var _0x456079={};var _0x58a2db={};var _0x43369d;var _0xba7f3e;return db[_0xf744('0x39')][_0xf744('0x4c')]({'where':{'id':_0x58bc2d['params']['id']}})[_0xf744('0x20')](handleEntityNotFound(_0x3bc2a0,null))[_0xf744('0x20')](function(_0x508447){if(_0x508447){_0x43369d=_0x508447;_0x58a2db['model']=_[_0xf744('0x2a')](db[_0xf744('0x4d')]['rawAttributes']);_0x58a2db[_0xf744('0x2b')]=_['keys'](_0x58bc2d[_0xf744('0x2b')]);_0x58a2db[_0xf744('0x2c')]=_[_0xf744('0x2e')](_0x58a2db[_0xf744('0x29')],_0x58a2db[_0xf744('0x2b')]);_0x456079[_0xf744('0x2d')]=_[_0xf744('0x2e')](_0x58a2db[_0xf744('0x29')],qs[_0xf744('0x2f')](_0x58bc2d['query'][_0xf744('0x2f')]));_0x456079['attributes']=_0x456079[_0xf744('0x2d')][_0xf744('0x30')]?_0x456079[_0xf744('0x2d')]:_0x58a2db[_0xf744('0x29')];_0x456079[_0xf744('0x48')]=qs[_0xf744('0x32')](_0x58bc2d[_0xf744('0x2b')][_0xf744('0x32')]);_0x456079[_0xf744('0x34')]=qs['filters'](_['pick'](_0x58bc2d['query'],_0x58a2db[_0xf744('0x2c')]));if(_0x58bc2d['query'][_0xf744('0x37')]){_0x456079[_0xf744('0x34')]=_[_0xf744('0x35')](_0x456079[_0xf744('0x34')],{'$or':_['map'](_0x456079[_0xf744('0x2d')],function(_0x9b4747){var _0x13cf9b={};_0x13cf9b[_0x9b4747]={'$like':'%'+_0x58bc2d[_0xf744('0x2b')][_0xf744('0x37')]+'%'};return _0x13cf9b;})});}_0x456079=_[_0xf744('0x35')]({},_0x456079,_0x58bc2d[_0xf744('0x38')]);return _0x43369d[_0xf744('0x4b')](_0x456079);}})[_0xf744('0x20')](function(_0x44164d){if(_0x44164d){_0xba7f3e=_0x44164d[_0xf744('0x30')];if(!_0x58bc2d[_0xf744('0x2b')][_0xf744('0x31')](_0xf744('0x49'))){_0x456079['limit']=qs[_0xf744('0x18')](_0x58bc2d[_0xf744('0x2b')][_0xf744('0x18')]);_0x456079[_0xf744('0x17')]=qs[_0xf744('0x17')](_0x58bc2d[_0xf744('0x2b')][_0xf744('0x17')]);}return _0x43369d[_0xf744('0x4b')](_0x456079);}})['then'](function(_0x4dd8fe){if(_0x4dd8fe){return _0x4dd8fe?{'count':_0xba7f3e,'rows':_0x4dd8fe}:null;}})[_0xf744('0x20')](respondWithResult(_0x3bc2a0,null))['catch'](handleError(_0x3bc2a0,null));}; \ No newline at end of file +var _0xfacc=['keys','length','find','body','addConditions','Condition','ids','omit','getConditions','addActions','getActions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','status','end','name','send','Automation','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params'];(function(_0x380b8f,_0x32271d){var _0x646c69=function(_0x57c77f){while(--_0x57c77f){_0x380b8f['push'](_0x380b8f['shift']());}};_0x646c69(++_0x32271d);}(_0xfacc,0x19c));var _0xcfac=function(_0x3e1926,_0x11e729){_0x3e1926=_0x3e1926-0x0;var _0x5517e9=_0xfacc[_0x3e1926];return _0x5517e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfac('0x0'));var zipdir=require(_0xcfac('0x1'));var jsonpatch=require(_0xcfac('0x2'));var rp=require(_0xcfac('0x3'));var moment=require('moment');var BPromise=require(_0xcfac('0x4'));var Mustache=require(_0xcfac('0x5'));var util=require(_0xcfac('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('fs-extra');var _=require(_0xcfac('0x7'));var squel=require(_0xcfac('0x8'));var crypto=require(_0xcfac('0x9'));var jsforce=require(_0xcfac('0xa'));var deskjs=require(_0xcfac('0xb'));var toCsv=require(_0xcfac('0xc'));var querystring=require(_0xcfac('0xd'));var Papa=require(_0xcfac('0xe'));var Redis=require(_0xcfac('0xf'));var authService=require(_0xcfac('0x10'));var qs=require(_0xcfac('0x11'));var as=require(_0xcfac('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcfac('0x13'))(_0xcfac('0x14'));var utils=require(_0xcfac('0x15'));var config=require(_0xcfac('0x16'));var licenseUtil=require(_0xcfac('0x17'));var db=require(_0xcfac('0x18'))['db'];function respondWithStatusCode(_0x5e336a,_0x258223){_0x258223=_0x258223||0xcc;return function(_0x3c967f){if(_0x3c967f){return _0x5e336a[_0xcfac('0x19')](_0x258223);}return _0x5e336a['status'](_0x258223)['end']();};}function respondWithResult(_0x341a91,_0x37a5f7){_0x37a5f7=_0x37a5f7||0xc8;return function(_0x4f1d61){if(_0x4f1d61){return _0x341a91['status'](_0x37a5f7)[_0xcfac('0x1a')](_0x4f1d61);}};}function respondWithFilteredResult(_0x2fabe9,_0x36236e){return function(_0x20f557){if(_0x20f557){var _0x2f9341=typeof _0x36236e[_0xcfac('0x1b')]===_0xcfac('0x1c')&&typeof _0x36236e[_0xcfac('0x1d')]===_0xcfac('0x1c');var _0x5baa42=_0x20f557['count'];var _0x12f47e=_0x2f9341?0x0:_0x36236e['offset'];var _0x234643=_0x2f9341?_0x20f557[_0xcfac('0x1e')]:_0x36236e[_0xcfac('0x1b')]+_0x36236e['limit'];var _0x3f27b0;if(_0x234643>=_0x5baa42){_0x234643=_0x5baa42;_0x3f27b0=0xc8;}else{_0x3f27b0=0xce;}_0x2fabe9['status'](_0x3f27b0);return _0x2fabe9['set']('Content-Range',_0x12f47e+'-'+_0x234643+'/'+_0x5baa42)[_0xcfac('0x1a')](_0x20f557);}return null;};}function patchUpdates(_0x12abef){return function(_0x108246){try{jsonpatch[_0xcfac('0x1f')](_0x108246,_0x12abef,!![]);}catch(_0x3f32dc){return BPromise[_0xcfac('0x20')](_0x3f32dc);}return _0x108246[_0xcfac('0x21')]();};}function saveUpdates(_0x24d8fd,_0x155d73){return function(_0x4755ff){if(_0x4755ff){return _0x4755ff[_0xcfac('0x22')](_0x24d8fd)['then'](function(_0x520c84){return _0x520c84;});}return null;};}function removeEntity(_0x1d9b88,_0x1f72cb){return function(_0x12e68f){if(_0x12e68f){return _0x12e68f[_0xcfac('0x23')]()[_0xcfac('0x24')](function(){_0x1d9b88[_0xcfac('0x25')](0xcc)[_0xcfac('0x26')]();});}};}function handleEntityNotFound(_0x5655d4,_0x4ab0b5){return function(_0x2858e7){if(!_0x2858e7){_0x5655d4[_0xcfac('0x19')](0x194);}return _0x2858e7;};}function handleError(_0x4f9ee3,_0xad035e){_0xad035e=_0xad035e||0x1f4;return function(_0xf8af77){logger['error'](_0xf8af77['stack']);if(_0xf8af77[_0xcfac('0x27')]){delete _0xf8af77[_0xcfac('0x27')];}_0x4f9ee3[_0xcfac('0x25')](_0xad035e)[_0xcfac('0x28')](_0xf8af77);};}exports['index']=function(_0x4fd910,_0x58b0c2){var _0x312263={},_0x564137={},_0x5e6ed0={'count':0x0,'rows':[]};var _0x41c252=_['map'](db[_0xcfac('0x29')][_0xcfac('0x2a')],function(_0x1fdcb0){return{'name':_0x1fdcb0[_0xcfac('0x2b')],'type':_0x1fdcb0[_0xcfac('0x2c')][_0xcfac('0x2d')]};});_0x564137[_0xcfac('0x2e')]=_[_0xcfac('0x2f')](_0x41c252,'name');_0x564137['query']=_['keys'](_0x4fd910[_0xcfac('0x30')]);_0x564137[_0xcfac('0x31')]=_[_0xcfac('0x32')](_0x564137['model'],_0x564137['query']);_0x312263[_0xcfac('0x33')]=_[_0xcfac('0x32')](_0x564137[_0xcfac('0x2e')],qs[_0xcfac('0x34')](_0x4fd910[_0xcfac('0x30')][_0xcfac('0x34')]));_0x312263['attributes']=_0x312263[_0xcfac('0x33')]['length']?_0x312263['attributes']:_0x564137[_0xcfac('0x2e')];if(!_0x4fd910[_0xcfac('0x30')][_0xcfac('0x35')](_0xcfac('0x36'))){_0x312263[_0xcfac('0x1d')]=qs[_0xcfac('0x1d')](_0x4fd910[_0xcfac('0x30')]['limit']);_0x312263[_0xcfac('0x1b')]=qs[_0xcfac('0x1b')](_0x4fd910['query'][_0xcfac('0x1b')]);}_0x312263[_0xcfac('0x37')]=qs[_0xcfac('0x38')](_0x4fd910[_0xcfac('0x30')][_0xcfac('0x38')]);_0x312263[_0xcfac('0x39')]=qs[_0xcfac('0x31')](_[_0xcfac('0x3a')](_0x4fd910[_0xcfac('0x30')],_0x564137[_0xcfac('0x31')]),_0x41c252);if(_0x4fd910[_0xcfac('0x30')][_0xcfac('0x3b')]){_0x312263[_0xcfac('0x39')]=_[_0xcfac('0x3c')](_0x312263['where'],{'$or':_[_0xcfac('0x2f')](_0x41c252,function(_0x4416ac){if(_0x4416ac[_0xcfac('0x2c')]!==_0xcfac('0x3d')){var _0x2f0bc4={};_0x2f0bc4[_0x4416ac['name']]={'$like':'%'+_0x4fd910[_0xcfac('0x30')]['filter']+'%'};return _0x2f0bc4;}})});}_0x312263=_[_0xcfac('0x3c')]({},_0x312263,_0x4fd910[_0xcfac('0x3e')]);var _0x5da6f8={'where':_0x312263[_0xcfac('0x39')]};return db['Automation']['count'](_0x5da6f8)[_0xcfac('0x24')](function(_0x4eceb5){_0x5e6ed0['count']=_0x4eceb5;if(_0x4fd910[_0xcfac('0x30')][_0xcfac('0x3f')]){_0x312263[_0xcfac('0x40')]=[{'all':!![]}];}return db[_0xcfac('0x29')]['findAll'](_0x312263);})[_0xcfac('0x24')](function(_0x3986a4){_0x5e6ed0[_0xcfac('0x41')]=_0x3986a4;return _0x5e6ed0;})[_0xcfac('0x24')](respondWithFilteredResult(_0x58b0c2,_0x312263))[_0xcfac('0x42')](handleError(_0x58b0c2,null));};exports['show']=function(_0x1713ac,_0x53e629){var _0x3616c1={'raw':![],'where':{'id':_0x1713ac[_0xcfac('0x43')]['id']}},_0x2d13e5={};_0x2d13e5[_0xcfac('0x2e')]=_[_0xcfac('0x44')](db[_0xcfac('0x29')][_0xcfac('0x2a')]);_0x2d13e5['query']=_['keys'](_0x1713ac['query']);_0x2d13e5[_0xcfac('0x31')]=_[_0xcfac('0x32')](_0x2d13e5[_0xcfac('0x2e')],_0x2d13e5[_0xcfac('0x30')]);_0x3616c1['attributes']=_['intersection'](_0x2d13e5[_0xcfac('0x2e')],qs[_0xcfac('0x34')](_0x1713ac[_0xcfac('0x30')][_0xcfac('0x34')]));_0x3616c1['attributes']=_0x3616c1[_0xcfac('0x33')][_0xcfac('0x45')]?_0x3616c1[_0xcfac('0x33')]:_0x2d13e5[_0xcfac('0x2e')];if(_0x1713ac['query'][_0xcfac('0x3f')]){_0x3616c1[_0xcfac('0x40')]=[{'all':!![]}];}_0x3616c1=_[_0xcfac('0x3c')]({},_0x3616c1,_0x1713ac[_0xcfac('0x3e')]);return db[_0xcfac('0x29')][_0xcfac('0x46')](_0x3616c1)[_0xcfac('0x24')](handleEntityNotFound(_0x53e629,null))[_0xcfac('0x24')](respondWithResult(_0x53e629,null))[_0xcfac('0x42')](handleError(_0x53e629,null));};exports['create']=function(_0x4252f5,_0x20532a){return db[_0xcfac('0x29')]['create'](_0x4252f5[_0xcfac('0x47')],{})['then'](respondWithResult(_0x20532a,0xc9))[_0xcfac('0x42')](handleError(_0x20532a,null));};exports[_0xcfac('0x22')]=function(_0x1981bb,_0x291d2b){if(_0x1981bb[_0xcfac('0x47')]['id']){delete _0x1981bb[_0xcfac('0x47')]['id'];}return db[_0xcfac('0x29')]['find']({'where':{'id':_0x1981bb['params']['id']}})['then'](handleEntityNotFound(_0x291d2b,null))['then'](saveUpdates(_0x1981bb[_0xcfac('0x47')],null))[_0xcfac('0x24')](respondWithResult(_0x291d2b,null))['catch'](handleError(_0x291d2b,null));};exports[_0xcfac('0x23')]=function(_0x1ee9c4,_0x35c2b5){return db[_0xcfac('0x29')][_0xcfac('0x46')]({'where':{'id':_0x1ee9c4[_0xcfac('0x43')]['id']}})[_0xcfac('0x24')](handleEntityNotFound(_0x35c2b5,null))[_0xcfac('0x24')](removeEntity(_0x35c2b5,null))[_0xcfac('0x42')](handleError(_0x35c2b5,null));};exports[_0xcfac('0x48')]=function(_0x30221b,_0x380973,_0x24cc8c){return db[_0xcfac('0x49')][_0xcfac('0x46')]({'where':{'id':_0x30221b[_0xcfac('0x43')]['id']}})[_0xcfac('0x24')](handleEntityNotFound(_0x380973,null))[_0xcfac('0x24')](function(_0x5d267f){if(_0x5d267f){return _0x5d267f[_0xcfac('0x48')](_0x30221b['body'][_0xcfac('0x4a')],_[_0xcfac('0x4b')](_0x30221b['body'],[_0xcfac('0x4a'),'id'])||{});}})[_0xcfac('0x24')](respondWithResult(_0x380973,null))[_0xcfac('0x42')](handleError(_0x380973,null));};exports[_0xcfac('0x4c')]=function(_0x239048,_0x168fe4,_0x45d9ac){var _0x3fd5a0={};var _0x30a8dd={};var _0x5dcfd2;var _0x2ac7c4;return db['Automation']['findOne']({'where':{'id':_0x239048[_0xcfac('0x43')]['id']}})[_0xcfac('0x24')](handleEntityNotFound(_0x168fe4,null))[_0xcfac('0x24')](function(_0x89c765){if(_0x89c765){_0x5dcfd2=_0x89c765;_0x30a8dd['model']=_[_0xcfac('0x44')](db['Condition'][_0xcfac('0x2a')]);_0x30a8dd[_0xcfac('0x30')]=_[_0xcfac('0x44')](_0x239048[_0xcfac('0x30')]);_0x30a8dd[_0xcfac('0x31')]=_[_0xcfac('0x32')](_0x30a8dd['model'],_0x30a8dd['query']);_0x3fd5a0[_0xcfac('0x33')]=_['intersection'](_0x30a8dd[_0xcfac('0x2e')],qs[_0xcfac('0x34')](_0x239048[_0xcfac('0x30')][_0xcfac('0x34')]));_0x3fd5a0[_0xcfac('0x33')]=_0x3fd5a0[_0xcfac('0x33')][_0xcfac('0x45')]?_0x3fd5a0[_0xcfac('0x33')]:_0x30a8dd[_0xcfac('0x2e')];_0x3fd5a0['order']=qs[_0xcfac('0x38')](_0x239048[_0xcfac('0x30')]['sort']);_0x3fd5a0[_0xcfac('0x39')]=qs['filters'](_[_0xcfac('0x3a')](_0x239048[_0xcfac('0x30')],_0x30a8dd['filters']));if(_0x239048[_0xcfac('0x30')]['filter']){_0x3fd5a0[_0xcfac('0x39')]=_['merge'](_0x3fd5a0[_0xcfac('0x39')],{'$or':_[_0xcfac('0x2f')](_0x3fd5a0['attributes'],function(_0x51e34c){var _0x357f03={};_0x357f03[_0x51e34c]={'$like':'%'+_0x239048[_0xcfac('0x30')][_0xcfac('0x3b')]+'%'};return _0x357f03;})});}_0x3fd5a0=_[_0xcfac('0x3c')]({},_0x3fd5a0,_0x239048[_0xcfac('0x3e')]);return _0x5dcfd2['getConditions'](_0x3fd5a0);}})['then'](function(_0x557586){if(_0x557586){_0x2ac7c4=_0x557586[_0xcfac('0x45')];if(!_0x239048[_0xcfac('0x30')][_0xcfac('0x35')](_0xcfac('0x36'))){_0x3fd5a0['limit']=qs[_0xcfac('0x1d')](_0x239048['query'][_0xcfac('0x1d')]);_0x3fd5a0['offset']=qs['offset'](_0x239048[_0xcfac('0x30')][_0xcfac('0x1b')]);}return _0x5dcfd2['getConditions'](_0x3fd5a0);}})[_0xcfac('0x24')](function(_0xd56e27){if(_0xd56e27){return _0xd56e27?{'count':_0x2ac7c4,'rows':_0xd56e27}:null;}})[_0xcfac('0x24')](respondWithResult(_0x168fe4,null))[_0xcfac('0x42')](handleError(_0x168fe4,null));};exports[_0xcfac('0x4d')]=function(_0x1e0136,_0x30723e,_0x1d1c79){return db['Action']['find']({'where':{'id':_0x1e0136[_0xcfac('0x43')]['id']}})[_0xcfac('0x24')](handleEntityNotFound(_0x30723e,null))[_0xcfac('0x24')](function(_0xd1717){if(_0xd1717){return _0xd1717['addActions'](_0x1e0136['body'][_0xcfac('0x4a')],_[_0xcfac('0x4b')](_0x1e0136['body'],[_0xcfac('0x4a'),'id'])||{});}})[_0xcfac('0x24')](respondWithResult(_0x30723e,null))[_0xcfac('0x42')](handleError(_0x30723e,null));};exports[_0xcfac('0x4e')]=function(_0x3ff825,_0x8c520f,_0x501198){var _0x4f5578={};var _0x2c3789={};var _0x241427;var _0xe86a34;return db[_0xcfac('0x29')][_0xcfac('0x4f')]({'where':{'id':_0x3ff825[_0xcfac('0x43')]['id']}})[_0xcfac('0x24')](handleEntityNotFound(_0x8c520f,null))[_0xcfac('0x24')](function(_0x32b792){if(_0x32b792){_0x241427=_0x32b792;_0x2c3789[_0xcfac('0x2e')]=_['keys'](db['Action'][_0xcfac('0x2a')]);_0x2c3789[_0xcfac('0x30')]=_[_0xcfac('0x44')](_0x3ff825[_0xcfac('0x30')]);_0x2c3789[_0xcfac('0x31')]=_['intersection'](_0x2c3789[_0xcfac('0x2e')],_0x2c3789[_0xcfac('0x30')]);_0x4f5578[_0xcfac('0x33')]=_[_0xcfac('0x32')](_0x2c3789['model'],qs[_0xcfac('0x34')](_0x3ff825[_0xcfac('0x30')][_0xcfac('0x34')]));_0x4f5578[_0xcfac('0x33')]=_0x4f5578['attributes'][_0xcfac('0x45')]?_0x4f5578['attributes']:_0x2c3789['model'];_0x4f5578['order']=qs['sort'](_0x3ff825['query']['sort']);_0x4f5578['where']=qs[_0xcfac('0x31')](_['pick'](_0x3ff825['query'],_0x2c3789['filters']));if(_0x3ff825['query'][_0xcfac('0x3b')]){_0x4f5578[_0xcfac('0x39')]=_[_0xcfac('0x3c')](_0x4f5578['where'],{'$or':_[_0xcfac('0x2f')](_0x4f5578['attributes'],function(_0x56b5a0){var _0x5f27a3={};_0x5f27a3[_0x56b5a0]={'$like':'%'+_0x3ff825[_0xcfac('0x30')]['filter']+'%'};return _0x5f27a3;})});}_0x4f5578=_[_0xcfac('0x3c')]({},_0x4f5578,_0x3ff825[_0xcfac('0x3e')]);return _0x241427[_0xcfac('0x4e')](_0x4f5578);}})[_0xcfac('0x24')](function(_0x125bdf){if(_0x125bdf){_0xe86a34=_0x125bdf[_0xcfac('0x45')];if(!_0x3ff825[_0xcfac('0x30')]['hasOwnProperty']('nolimit')){_0x4f5578[_0xcfac('0x1d')]=qs['limit'](_0x3ff825[_0xcfac('0x30')]['limit']);_0x4f5578[_0xcfac('0x1b')]=qs[_0xcfac('0x1b')](_0x3ff825[_0xcfac('0x30')]['offset']);}return _0x241427['getActions'](_0x4f5578);}})[_0xcfac('0x24')](function(_0x5bac80){if(_0x5bac80){return _0x5bac80?{'count':_0xe86a34,'rows':_0x5bac80}:null;}})[_0xcfac('0x24')](respondWithResult(_0x8c520f,null))[_0xcfac('0x42')](handleError(_0x8c520f,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index a7551cb..89142ce 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 _0x620c=['define','Automation','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x620c,0x106));var _0xc620=function(_0x429468,_0x5e5cc2){_0x429468=_0x429468-0x0;var _0x2c0799=_0x620c[_0x429468];return _0x2c0799;};'use strict';var _=require(_0xc620('0x0'));var util=require('util');var logger=require(_0xc620('0x1'))(_0xc620('0x2'));var moment=require(_0xc620('0x3'));var BPromise=require(_0xc620('0x4'));var rp=require(_0xc620('0x5'));var fs=require('fs');var path=require(_0xc620('0x6'));var rimraf=require(_0xc620('0x7'));var config=require(_0xc620('0x8'));var attributes=require(_0xc620('0x9'));module[_0xc620('0xa')]=function(_0x4cf6fa,_0x1f1212){return _0x4cf6fa[_0xc620('0xb')](_0xc620('0xc'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc08a=['util','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes','define','tools_automations'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xc08a,0xd0));var _0xac08=function(_0x4aa92e,_0x207b21){_0x4aa92e=_0x4aa92e-0x0;var _0x440f2b=_0xc08a[_0x4aa92e];return _0x440f2b;};'use strict';var _=require('lodash');var util=require(_0xac08('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xac08('0x1'));var rp=require(_0xac08('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac08('0x3'));var config=require(_0xac08('0x4'));var attributes=require(_0xac08('0x5'));module['exports']=function(_0x5cfc44,_0x57a579){return _0x5cfc44[_0xac08('0x6')]('Automation',attributes,{'tableName':_0xac08('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 0b9518e..8ea49a9 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 _0xdac7=['error','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b0208,_0x58666d){var _0x5800b4=function(_0x21dfc5){while(--_0x21dfc5){_0x5b0208['push'](_0x5b0208['shift']());}};_0x5800b4(++_0x58666d);}(_0xdac7,0x180));var _0x7dac=function(_0x25adf6,_0x2d42a2){_0x25adf6=_0x25adf6-0x0;var _0x3aba69=_0xdac7[_0x25adf6];return _0x3aba69;};'use strict';var _=require(_0x7dac('0x0'));var util=require(_0x7dac('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7dac('0x2'));var db=require(_0x7dac('0x3'))['db'];var utils=require(_0x7dac('0x4'));var logger=require(_0x7dac('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7dac('0x6')][_0x7dac('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x505705,_0x28cc84,_0x53c460){return new BPromise(function(_0x3b319f,_0x5ccf75){return client[_0x7dac('0x8')](_0x505705,_0x53c460)[_0x7dac('0x9')](function(_0x45fbdc){logger[_0x7dac('0xa')](_0x7dac('0xb'),_0x28cc84,_0x7dac('0xc'));logger[_0x7dac('0xd')](_0x7dac('0xe'),_0x28cc84,_0x7dac('0xc'),JSON[_0x7dac('0xf')](_0x45fbdc));if(_0x45fbdc['error']){if(_0x45fbdc['error']['code']===0x1f4){logger[_0x7dac('0x10')]('Automation,\x20%s,\x20%s',_0x28cc84,_0x45fbdc[_0x7dac('0x10')]['message']);return _0x5ccf75(_0x45fbdc[_0x7dac('0x10')][_0x7dac('0x11')]);}logger[_0x7dac('0x10')](_0x7dac('0xb'),_0x28cc84,_0x45fbdc[_0x7dac('0x10')][_0x7dac('0x11')]);return _0x3b319f(_0x45fbdc[_0x7dac('0x10')]['message']);}else{logger[_0x7dac('0xa')]('Automation,\x20%s,\x20%s',_0x28cc84,'request\x20sent');_0x3b319f(_0x45fbdc[_0x7dac('0x12')][_0x7dac('0x11')]);}})[_0x7dac('0x13')](function(_0x2de4ea){logger[_0x7dac('0x10')]('Automation,\x20%s,\x20%s',_0x28cc84,_0x2de4ea);_0x5ccf75(_0x2de4ea);});});} \ No newline at end of file +var _0xf9ac=['info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','then'];(function(_0x5f5ac5,_0x526505){var _0x3697f2=function(_0x49cec5){while(--_0x49cec5){_0x5f5ac5['push'](_0x5f5ac5['shift']());}};_0x3697f2(++_0x526505);}(_0xf9ac,0x87));var _0xcf9a=function(_0x56139e,_0x714ec2){_0x56139e=_0x56139e-0x0;var _0x113526=_0xf9ac[_0x56139e];return _0x113526;};'use strict';var _=require(_0xcf9a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcf9a('0x1'));var rs=require(_0xcf9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf9a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf9a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf9a('0x5'));var client=jayson[_0xcf9a('0x6')][_0xcf9a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x235e47,_0x54ebf6,_0x33a1a6){return new BPromise(function(_0x3d2f54,_0x4c0665){return client['request'](_0x235e47,_0x33a1a6)[_0xcf9a('0x8')](function(_0x579cf9){logger[_0xcf9a('0x9')]('Automation,\x20%s,\x20%s',_0x54ebf6,_0xcf9a('0xa'));logger['debug'](_0xcf9a('0xb'),_0x54ebf6,_0xcf9a('0xa'),JSON[_0xcf9a('0xc')](_0x579cf9));if(_0x579cf9['error']){if(_0x579cf9['error']['code']===0x1f4){logger[_0xcf9a('0xd')](_0xcf9a('0xe'),_0x54ebf6,_0x579cf9['error'][_0xcf9a('0xf')]);return _0x4c0665(_0x579cf9[_0xcf9a('0xd')][_0xcf9a('0xf')]);}logger['error'](_0xcf9a('0xe'),_0x54ebf6,_0x579cf9['error']['message']);return _0x3d2f54(_0x579cf9['error']['message']);}else{logger[_0xcf9a('0x9')](_0xcf9a('0xe'),_0x54ebf6,_0xcf9a('0xa'));_0x3d2f54(_0x579cf9[_0xcf9a('0x10')][_0xcf9a('0xf')]);}})[_0xcf9a('0x11')](function(_0x25dc10){logger['error'](_0xcf9a('0xe'),_0x54ebf6,_0x25dc10);_0x4c0665(_0x25dc10);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 9ada502..d0ae512 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 _0x38d3=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','update','destroy','exports','multer','util'];(function(_0x3c4e6c,_0x3b3101){var _0x2eb90c=function(_0x42e9c7){while(--_0x42e9c7){_0x3c4e6c['push'](_0x3c4e6c['shift']());}};_0x2eb90c(++_0x3b3101);}(_0x38d3,0x1a7));var _0x338d=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x38d3[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x338d('0x0'));var util=require(_0x338d('0x1'));var path=require('path');var timeout=require(_0x338d('0x2'));var express=require(_0x338d('0x3'));var router=express[_0x338d('0x4')]();var fs_extra=require(_0x338d('0x5'));var auth=require(_0x338d('0x6'));var interaction=require(_0x338d('0x7'));var config=require(_0x338d('0x8'));var controller=require(_0x338d('0x9'));router[_0x338d('0xa')]('/',auth['isAuthenticated'](),controller[_0x338d('0xb')]);router[_0x338d('0xa')](_0x338d('0xc'),auth[_0x338d('0xd')](),controller[_0x338d('0xe')]);router[_0x338d('0xa')](_0x338d('0xf'),auth['isAuthenticated'](),controller[_0x338d('0x10')]);router[_0x338d('0xa')](_0x338d('0x11'),auth[_0x338d('0xd')](),controller[_0x338d('0x12')]);router[_0x338d('0x13')]('/',auth['isAuthenticated'](),controller[_0x338d('0x14')]);router[_0x338d('0x13')](_0x338d('0xf'),auth[_0x338d('0xd')](),controller[_0x338d('0x15')]);router[_0x338d('0x13')](_0x338d('0x11'),auth[_0x338d('0xd')](),controller['addActions']);router['put']('/:id',auth[_0x338d('0xd')](),controller[_0x338d('0x16')]);router['delete'](_0x338d('0xc'),auth['isAuthenticated'](),controller[_0x338d('0x17')]);module[_0x338d('0x18')]=router; \ No newline at end of file +var _0x9f60=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','getActions','post','create','addConditions','/:id/actions','addActions','put','update','exports','multer','path'];(function(_0x1c6f4b,_0x5b8829){var _0x3f7940=function(_0x38193c){while(--_0x38193c){_0x1c6f4b['push'](_0x1c6f4b['shift']());}};_0x3f7940(++_0x5b8829);}(_0x9f60,0x1ae));var _0x09f6=function(_0x34a8e6,_0x341712){_0x34a8e6=_0x34a8e6-0x0;var _0x56df52=_0x9f60[_0x34a8e6];return _0x56df52;};'use strict';var multer=require(_0x09f6('0x0'));var util=require('util');var path=require(_0x09f6('0x1'));var timeout=require(_0x09f6('0x2'));var express=require(_0x09f6('0x3'));var router=express[_0x09f6('0x4')]();var fs_extra=require(_0x09f6('0x5'));var auth=require(_0x09f6('0x6'));var interaction=require(_0x09f6('0x7'));var config=require('../../config/environment');var controller=require(_0x09f6('0x8'));router[_0x09f6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x09f6('0xa'),auth[_0x09f6('0xb')](),controller[_0x09f6('0xc')]);router[_0x09f6('0x9')](_0x09f6('0xd'),auth[_0x09f6('0xb')](),controller[_0x09f6('0xe')]);router[_0x09f6('0x9')]('/:id/actions',auth[_0x09f6('0xb')](),controller[_0x09f6('0xf')]);router[_0x09f6('0x10')]('/',auth['isAuthenticated'](),controller[_0x09f6('0x11')]);router[_0x09f6('0x10')]('/:id/conditions',auth[_0x09f6('0xb')](),controller[_0x09f6('0x12')]);router[_0x09f6('0x10')](_0x09f6('0x13'),auth[_0x09f6('0xb')](),controller[_0x09f6('0x14')]);router[_0x09f6('0x15')](_0x09f6('0xa'),auth[_0x09f6('0xb')](),controller[_0x09f6('0x16')]);router['delete'](_0x09f6('0xa'),auth[_0x09f6('0xb')](),controller['destroy']);module[_0x09f6('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 9b331ec..8fa1a75 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 _0x257c=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x257c,0x111));var _0xc257=function(_0x281820,_0x47572b){_0x281820=_0x281820-0x0;var _0x2d05f6=_0x257c[_0x281820];return _0x2d05f6;};'use strict';var Sequelize=require('sequelize');module[_0xc257('0x0')]={'name':{'type':Sequelize[_0xc257('0x1')],'unique':_0xc257('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc257('0x3')](_0xc257('0x4')),'allowNull':![],'defaultValue':_0xc257('0x4')},'description':{'type':Sequelize[_0xc257('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc257('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xc257('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xc257('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc257('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc257('0x8')](0x3)[_0xc257('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc257('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc257('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc257('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xc257('0x8')](0x3)[_0xc257('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc257('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc257('0x8')](0x5)[_0xc257('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc257('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc257('0x6')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc257('0x8')](0x5)[_0xc257('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xc257('0x8')](0x3)[_0xc257('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc257('0xd')},'dialTimezone':{'type':Sequelize[_0xc257('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xc257('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xc257('0x3')](_0xc257('0xf'),_0xc257('0x10'),_0xc257('0x11')),'defaultValue':_0xc257('0xf')},'dialAMDActive':{'type':Sequelize[_0xc257('0x12')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc257('0x8')](0x9)[_0xc257('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc257('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xc257('0x8')](0x9)[_0xc257('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc257('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc257('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc257('0x8')](0x9)[_0xc257('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc257('0x8')](0x9)[_0xc257('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc257('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc257('0x8')](0x9)[_0xc257('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc257('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc257('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc257('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xc257('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc257('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc257('0x8')](0x9)[_0xc257('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc257('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc257('0x3')](_0xc257('0x1a'),_0xc257('0x1b')),'defaultValue':_0xc257('0x1a')},'dialPrefix':{'type':Sequelize[_0xc257('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc257('0x8')](0x3)[_0xc257('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc257('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xc257('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc257('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc257('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc257('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc257('0x8')](0x5)[_0xc257('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc257('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xc257('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc257('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc257('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc257('0x8')](0x3)[_0xc257('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc257('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc257('0x8')](0x5)[_0xc257('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc257('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xc257('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc257('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc257('0x8')](0x3)[_0xc257('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc257('0x8')](0x5)[_0xc257('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc257('0x24')}}; \ No newline at end of file +var _0xd2ce=['07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','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)'];(function(_0x338b7a,_0xe2fcc3){var _0x15f01a=function(_0x145310){while(--_0x145310){_0x338b7a['push'](_0x338b7a['shift']());}};_0x15f01a(++_0xe2fcc3);}(_0xd2ce,0x158));var _0xed2c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd2ce[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xed2c('0x0'));module['exports']={'name':{'type':Sequelize[_0xed2c('0x1')],'unique':_0xed2c('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xed2c('0x3')]('ivr'),'allowNull':![],'defaultValue':_0xed2c('0x4')},'description':{'type':Sequelize[_0xed2c('0x1')]},'active':{'type':Sequelize[_0xed2c('0x5')],'defaultValue':0x0,'comment':_0xed2c('0x6')},'limitCalls':{'type':Sequelize[_0xed2c('0x7')](0x4)[_0xed2c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xed2c('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xed2c('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xed2c('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xed2c('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xed2c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xed2c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xed2c('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xed2c('0x7')](0x3)[_0xed2c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xed2c('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xed2c('0x7')](0x5)[_0xed2c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xed2c('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xed2c('0x7')](0x3)[_0xed2c('0x8')],'defaultValue':0x3,'comment':_0xed2c('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xed2c('0x7')](0x5)[_0xed2c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xed2c('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xed2c('0x7')](0x3)[_0xed2c('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xed2c('0xf')},'dialTimezone':{'type':Sequelize[_0xed2c('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xed2c('0x1')],'defaultValue':_0xed2c('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xed2c('0x11'),_0xed2c('0x12'),_0xed2c('0x13')),'defaultValue':_0xed2c('0x11')},'dialAMDActive':{'type':Sequelize[_0xed2c('0x5')],'defaultValue':0x0,'comment':_0xed2c('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xed2c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xed2c('0x15')},'dialAMDGreeting':{'type':Sequelize[_0xed2c('0x7')](0x9)[_0xed2c('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xed2c('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xed2c('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xed2c('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xed2c('0x7')](0x9)[_0xed2c('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xed2c('0x18')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xed2c('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xed2c('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xed2c('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xed2c('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xed2c('0x1b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xed2c('0x7')](0x5)[_0xed2c('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xed2c('0x1c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xed2c('0x7')](0x9)[_0xed2c('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xed2c('0x3')](_0xed2c('0x1d'),'ASC'),'defaultValue':_0xed2c('0x1d')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xed2c('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xed2c('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xed2c('0x7')](0x3)[_0xed2c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xed2c('0x7')](0x5)[_0xed2c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xed2c('0x7')](0x3)[_0xed2c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xed2c('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xed2c('0x7')](0x5)[_0xed2c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xed2c('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xed2c('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xed2c('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xed2c('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xed2c('0x7')](0x3)[_0xed2c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xed2c('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xed2c('0x7')](0x5)[_0xed2c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xed2c('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xed2c('0x7')](0x3)[_0xed2c('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xed2c('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xed2c('0x7')](0x5)[_0xed2c('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index cc0327f..4f3039e 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 _0x4d6e=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','name','send','index','map','Campaign','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','options','includeAll','include','findAll','catch','show','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','error','clone','params','omit','createdAt','updatedAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','rows','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','field','NOW()','scheduledAt','ContactId','CmListId','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','cmHopperId','h.id','ci.item','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x21e040,_0x20e57f){var _0x262b18=function(_0x2322c9){while(--_0x2322c9){_0x21e040['push'](_0x21e040['shift']());}};_0x262b18(++_0x20e57f);}(_0x4d6e,0x77));var _0xe4d6=function(_0xbc6566,_0x32d463){_0xbc6566=_0xbc6566-0x0;var _0x4ed128=_0x4d6e[_0xbc6566];return _0x4ed128;};'use strict';var emlformat=require(_0xe4d6('0x0'));var rimraf=require(_0xe4d6('0x1'));var zipdir=require(_0xe4d6('0x2'));var jsonpatch=require(_0xe4d6('0x3'));var rp=require(_0xe4d6('0x4'));var moment=require('moment');var BPromise=require(_0xe4d6('0x5'));var Mustache=require(_0xe4d6('0x6'));var util=require(_0xe4d6('0x7'));var path=require(_0xe4d6('0x8'));var sox=require(_0xe4d6('0x9'));var csv=require(_0xe4d6('0xa'));var ejs=require(_0xe4d6('0xb'));var fs=require('fs');var fs_extra=require(_0xe4d6('0xc'));var _=require(_0xe4d6('0xd'));var squel=require(_0xe4d6('0xe'));var crypto=require(_0xe4d6('0xf'));var jsforce=require(_0xe4d6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe4d6('0xa'));var querystring=require(_0xe4d6('0x11'));var Papa=require('papaparse');var Redis=require(_0xe4d6('0x12'));var authService=require(_0xe4d6('0x13'));var qs=require(_0xe4d6('0x14'));var as=require(_0xe4d6('0x15'));var hardwareService=require(_0xe4d6('0x16'));var logger=require(_0xe4d6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe4d6('0x18'));var licenseUtil=require(_0xe4d6('0x19'));var db=require(_0xe4d6('0x1a'))['db'];function respondWithStatusCode(_0x5a14e5,_0x1a80eb){_0x1a80eb=_0x1a80eb||0xcc;return function(_0x3f7441){if(_0x3f7441){return _0x5a14e5['sendStatus'](_0x1a80eb);}return _0x5a14e5[_0xe4d6('0x1b')](_0x1a80eb)[_0xe4d6('0x1c')]();};}function respondWithResult(_0x5dbcc5,_0xdc7f40){_0xdc7f40=_0xdc7f40||0xc8;return function(_0x780caa){if(_0x780caa){return _0x5dbcc5[_0xe4d6('0x1b')](_0xdc7f40)[_0xe4d6('0x1d')](_0x780caa);}};}function respondWithFilteredResult(_0x53ca26,_0x2e04a9){return function(_0x28e001){if(_0x28e001){var _0x3dbe31=typeof _0x2e04a9[_0xe4d6('0x1e')]==='undefined'&&typeof _0x2e04a9[_0xe4d6('0x1f')]==='undefined';var _0x526dd6=_0x28e001[_0xe4d6('0x20')];var _0x351a17=_0x3dbe31?0x0:_0x2e04a9[_0xe4d6('0x1e')];var _0x1928f9=_0x3dbe31?_0x28e001[_0xe4d6('0x20')]:_0x2e04a9['offset']+_0x2e04a9[_0xe4d6('0x1f')];var _0x42b261;if(_0x1928f9>=_0x526dd6){_0x1928f9=_0x526dd6;_0x42b261=0xc8;}else{_0x42b261=0xce;}_0x53ca26[_0xe4d6('0x1b')](_0x42b261);return _0x53ca26[_0xe4d6('0x21')](_0xe4d6('0x22'),_0x351a17+'-'+_0x1928f9+'/'+_0x526dd6)[_0xe4d6('0x1d')](_0x28e001);}return null;};}function patchUpdates(_0x26b9b6){return function(_0x27e824){try{jsonpatch['apply'](_0x27e824,_0x26b9b6,!![]);}catch(_0x1afb27){return BPromise['reject'](_0x1afb27);}return _0x27e824[_0xe4d6('0x23')]();};}function saveUpdates(_0x34e7ca,_0x31f569){return function(_0x162b57){if(_0x162b57){return _0x162b57[_0xe4d6('0x24')](_0x34e7ca)[_0xe4d6('0x25')](function(_0x455011){return _0x455011;});}return null;};}function removeEntity(_0x202f67,_0x59233f){return function(_0x404fe1){if(_0x404fe1){return _0x404fe1[_0xe4d6('0x26')]()['then'](function(){var _0xb869f=_0x404fe1[_0xe4d6('0x27')]({'plain':!![]});var _0x2807e7=_0xe4d6('0x28');return db[_0xe4d6('0x29')][_0xe4d6('0x26')]({'where':{'type':_0x2807e7,'resourceId':_0xb869f['id']}})[_0xe4d6('0x25')](function(){return _0x404fe1;});})[_0xe4d6('0x25')](function(){_0x202f67['status'](0xcc)[_0xe4d6('0x1c')]();});}};}function handleEntityNotFound(_0x152d16,_0x4daadb){return function(_0x4ccf6b){if(!_0x4ccf6b){_0x152d16['sendStatus'](0x194);}return _0x4ccf6b;};}function handleError(_0x2b732e,_0x4a7e63){_0x4a7e63=_0x4a7e63||0x1f4;return function(_0x3d2efe){logger['error'](_0x3d2efe['stack']);if(_0x3d2efe[_0xe4d6('0x2a')]){delete _0x3d2efe['name'];}_0x2b732e['status'](_0x4a7e63)[_0xe4d6('0x2b')](_0x3d2efe);};}exports[_0xe4d6('0x2c')]=function(_0x5a0859,_0x580d44){var _0x3fd34f={},_0x4077c1={},_0x4db1fb={'count':0x0,'rows':[]};var _0xc58fcb=_[_0xe4d6('0x2d')](db[_0xe4d6('0x2e')][_0xe4d6('0x2f')],function(_0x279961){return{'name':_0x279961[_0xe4d6('0x30')],'type':_0x279961['type']['key']};});_0x4077c1[_0xe4d6('0x31')]=_[_0xe4d6('0x2d')](_0xc58fcb,'name');_0x4077c1[_0xe4d6('0x32')]=_['keys'](_0x5a0859[_0xe4d6('0x32')]);_0x4077c1['filters']=_['intersection'](_0x4077c1[_0xe4d6('0x31')],_0x4077c1['query']);_0x3fd34f['attributes']=_[_0xe4d6('0x33')](_0x4077c1[_0xe4d6('0x31')],qs[_0xe4d6('0x34')](_0x5a0859[_0xe4d6('0x32')]['fields']));_0x3fd34f[_0xe4d6('0x35')]=_0x3fd34f[_0xe4d6('0x35')][_0xe4d6('0x36')]?_0x3fd34f[_0xe4d6('0x35')]:_0x4077c1[_0xe4d6('0x31')];if(!_0x5a0859[_0xe4d6('0x32')][_0xe4d6('0x37')](_0xe4d6('0x38'))){_0x3fd34f[_0xe4d6('0x1f')]=qs[_0xe4d6('0x1f')](_0x5a0859['query'][_0xe4d6('0x1f')]);_0x3fd34f['offset']=qs[_0xe4d6('0x1e')](_0x5a0859[_0xe4d6('0x32')][_0xe4d6('0x1e')]);}_0x3fd34f[_0xe4d6('0x39')]=qs['sort'](_0x5a0859['query'][_0xe4d6('0x3a')]);_0x3fd34f[_0xe4d6('0x3b')]=qs[_0xe4d6('0x3c')](_[_0xe4d6('0x3d')](_0x5a0859[_0xe4d6('0x32')],_0x4077c1[_0xe4d6('0x3c')]),_0xc58fcb);if(_0x5a0859[_0xe4d6('0x32')]['filter']){_0x3fd34f[_0xe4d6('0x3b')]=_[_0xe4d6('0x3e')](_0x3fd34f['where'],{'$or':_['map'](_0xc58fcb,function(_0x4662c7){if(_0x4662c7[_0xe4d6('0x3f')]!=='VIRTUAL'){var _0x1a577f={};_0x1a577f[_0x4662c7[_0xe4d6('0x2a')]]={'$like':'%'+_0x5a0859[_0xe4d6('0x32')][_0xe4d6('0x40')]+'%'};return _0x1a577f;}})});}_0x3fd34f=_['merge']({},_0x3fd34f,_0x5a0859[_0xe4d6('0x41')]);var _0x222771={'where':_0x3fd34f[_0xe4d6('0x3b')]};return db[_0xe4d6('0x2e')][_0xe4d6('0x20')](_0x222771)[_0xe4d6('0x25')](function(_0x5a32c0){_0x4db1fb['count']=_0x5a32c0;if(_0x5a0859['query'][_0xe4d6('0x42')]){_0x3fd34f[_0xe4d6('0x43')]=[{'all':!![]}];}return db[_0xe4d6('0x2e')][_0xe4d6('0x44')](_0x3fd34f);})['then'](function(_0x3d2516){_0x4db1fb['rows']=_0x3d2516;return _0x4db1fb;})['then'](respondWithFilteredResult(_0x580d44,_0x3fd34f))[_0xe4d6('0x45')](handleError(_0x580d44,null));};exports[_0xe4d6('0x46')]=function(_0x1f3c05,_0x29b3b2){var _0x373bfa={'raw':![],'where':{'id':_0x1f3c05['params']['id']}},_0x978b7c={};_0x978b7c[_0xe4d6('0x31')]=_[_0xe4d6('0x47')](db[_0xe4d6('0x2e')][_0xe4d6('0x2f')]);_0x978b7c[_0xe4d6('0x32')]=_[_0xe4d6('0x47')](_0x1f3c05[_0xe4d6('0x32')]);_0x978b7c[_0xe4d6('0x3c')]=_['intersection'](_0x978b7c[_0xe4d6('0x31')],_0x978b7c[_0xe4d6('0x32')]);_0x373bfa[_0xe4d6('0x35')]=_['intersection'](_0x978b7c['model'],qs[_0xe4d6('0x34')](_0x1f3c05[_0xe4d6('0x32')][_0xe4d6('0x34')]));_0x373bfa[_0xe4d6('0x35')]=_0x373bfa[_0xe4d6('0x35')][_0xe4d6('0x36')]?_0x373bfa[_0xe4d6('0x35')]:_0x978b7c[_0xe4d6('0x31')];if(_0x1f3c05[_0xe4d6('0x32')][_0xe4d6('0x42')]){_0x373bfa[_0xe4d6('0x43')]=[{'all':!![]}];}_0x373bfa=_[_0xe4d6('0x3e')]({},_0x373bfa,_0x1f3c05[_0xe4d6('0x41')]);return db[_0xe4d6('0x2e')][_0xe4d6('0x48')](_0x373bfa)[_0xe4d6('0x25')](handleEntityNotFound(_0x29b3b2,null))['then'](respondWithResult(_0x29b3b2,null))[_0xe4d6('0x45')](handleError(_0x29b3b2,null));};exports[_0xe4d6('0x49')]=function(_0x546a80,_0x2bea52){return db['Campaign'][_0xe4d6('0x49')](_0x546a80[_0xe4d6('0x4a')],{})['then'](function(_0x6c991){var _0x48bcdc=_0x546a80['user'][_0xe4d6('0x27')]({'plain':!![]});if(!_0x48bcdc)throw new Error(_0xe4d6('0x4b'));if(_0x48bcdc['role']===_0xe4d6('0x4c')){var _0x338cda=_0x6c991[_0xe4d6('0x27')]({'plain':!![]});var _0x278c96=_0xe4d6('0x28');return db['UserProfileSection'][_0xe4d6('0x48')]({'where':{'name':_0x278c96,'userProfileId':_0x48bcdc[_0xe4d6('0x4d')]},'raw':!![]})['then'](function(_0x57c178){if(_0x57c178&&_0x57c178[_0xe4d6('0x4e')]===0x0){return db[_0xe4d6('0x29')][_0xe4d6('0x49')]({'name':_0x338cda['name'],'resourceId':_0x338cda['id'],'type':_0x57c178[_0xe4d6('0x2a')],'sectionId':_0x57c178['id']},{})[_0xe4d6('0x25')](function(){return _0x6c991;});}else{return _0x6c991;}})[_0xe4d6('0x45')](function(_0x427575){logger[_0xe4d6('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x427575);throw _0x427575;});}return _0x6c991;})[_0xe4d6('0x25')](respondWithResult(_0x2bea52,0xc9))[_0xe4d6('0x45')](handleError(_0x2bea52,null));};exports[_0xe4d6('0x50')]=function(_0x1b22c2,_0x38a427){var _0x4e1d04={'where':{'id':_0x1b22c2[_0xe4d6('0x51')]['id']}},_0x279056={};_0x279056[_0xe4d6('0x31')]=_[_0xe4d6('0x47')](db[_0xe4d6('0x2e')][_0xe4d6('0x2f')]);_0x4e1d04['attributes']=_[_0xe4d6('0x33')](_0x279056[_0xe4d6('0x31')],qs[_0xe4d6('0x34')](_0x1b22c2[_0xe4d6('0x32')][_0xe4d6('0x34')]));_0x4e1d04[_0xe4d6('0x35')]=_0x4e1d04[_0xe4d6('0x35')][_0xe4d6('0x36')]?_0x4e1d04[_0xe4d6('0x35')]:_0x279056[_0xe4d6('0x31')];if(_0x1b22c2[_0xe4d6('0x32')]['includeAll']){_0x4e1d04[_0xe4d6('0x43')]=[{'all':!![]}];}_0x4e1d04=_[_0xe4d6('0x3e')]({},_0x4e1d04,_0x1b22c2[_0xe4d6('0x41')]);return db[_0xe4d6('0x2e')][_0xe4d6('0x48')](_0x4e1d04)[_0xe4d6('0x25')](handleEntityNotFound(_0x38a427,null))['then'](function(_0x539eca){if(_0x539eca){var _0x6a1df0=_0x539eca[_0xe4d6('0x27')]({'plain':!![]});_0x6a1df0=qs[_0xe4d6('0x52')](_0x6a1df0,['id',_0xe4d6('0x53'),'updatedAt']);_0x1b22c2['body']=_[_0xe4d6('0x52')](_0x1b22c2[_0xe4d6('0x4a')],['id',_0xe4d6('0x53'),_0xe4d6('0x54')]);return db['Campaign'][_0xe4d6('0x49')](_[_0xe4d6('0x3e')](_0x6a1df0,_0x1b22c2['body']),{'include':_0x1b22c2[_0xe4d6('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0xe4d6('0x25')](function(_0x3b155b){var _0x4f13c7=_0x1b22c2[_0xe4d6('0x4c')]['get']({'plain':!![]});if(!_0x4f13c7)throw new Error(_0xe4d6('0x4b'));if(_0x4f13c7[_0xe4d6('0x55')]==='user'){var _0x41ef7b=_0x3b155b[_0xe4d6('0x27')]({'plain':!![]});var _0x18d2d4='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x18d2d4,'userProfileId':_0x4f13c7[_0xe4d6('0x4d')]},'raw':!![]})[_0xe4d6('0x25')](function(_0x2ae27f){if(_0x2ae27f&&_0x2ae27f[_0xe4d6('0x4e')]===0x0){return db[_0xe4d6('0x29')][_0xe4d6('0x49')]({'name':_0x41ef7b['name'],'resourceId':_0x41ef7b['id'],'type':_0x2ae27f[_0xe4d6('0x2a')],'sectionId':_0x2ae27f['id']},{})[_0xe4d6('0x25')](function(){return _0x3b155b;});}else{return _0x3b155b;}})[_0xe4d6('0x45')](function(_0xdd0ded){logger[_0xe4d6('0x4f')](_0xe4d6('0x56'),_0xdd0ded);throw _0xdd0ded;});}return _0x3b155b;});}})[_0xe4d6('0x25')](respondWithResult(_0x38a427,0xc9))[_0xe4d6('0x45')](handleError(_0x38a427,null));};exports[_0xe4d6('0x24')]=function(_0x4fde5e,_0x57ef4e){if(_0x4fde5e[_0xe4d6('0x4a')]['id']){delete _0x4fde5e[_0xe4d6('0x4a')]['id'];}return db['Campaign']['find']({'where':{'id':_0x4fde5e[_0xe4d6('0x51')]['id']}})[_0xe4d6('0x25')](handleEntityNotFound(_0x57ef4e,null))[_0xe4d6('0x25')](saveUpdates(_0x4fde5e[_0xe4d6('0x4a')],null))[_0xe4d6('0x25')](respondWithResult(_0x57ef4e,null))['catch'](handleError(_0x57ef4e,null));};exports[_0xe4d6('0x26')]=function(_0x3bb13b,_0x349b56){return db[_0xe4d6('0x2e')][_0xe4d6('0x48')]({'where':{'id':_0x3bb13b[_0xe4d6('0x51')]['id']}})['then'](handleEntityNotFound(_0x349b56,null))[_0xe4d6('0x25')](removeEntity(_0x349b56,null))['catch'](handleError(_0x349b56,null));};exports[_0xe4d6('0x57')]=function(_0x40e3de,_0xb29ae,_0x148b10){var _0x4f2fc2={'raw':!![],'where':{}};var _0x2a6a5d={};var _0xea686f={'count':0x0,'rows':[]};return db[_0xe4d6('0x2e')][_0xe4d6('0x58')]({'where':{'id':_0x40e3de['params']['id']}})[_0xe4d6('0x25')](handleEntityNotFound(_0xb29ae,null))[_0xe4d6('0x25')](function(_0x16d598){if(_0x16d598){_0x2a6a5d[_0xe4d6('0x31')]=_[_0xe4d6('0x47')](db[_0xe4d6('0x59')][_0xe4d6('0x2f')]);_0x2a6a5d[_0xe4d6('0x32')]=_[_0xe4d6('0x47')](_0x40e3de[_0xe4d6('0x32')]);_0x2a6a5d[_0xe4d6('0x3c')]=_[_0xe4d6('0x33')](_0x2a6a5d[_0xe4d6('0x31')],_0x2a6a5d[_0xe4d6('0x32')]);_0x4f2fc2[_0xe4d6('0x35')]=_[_0xe4d6('0x33')](_0x2a6a5d[_0xe4d6('0x31')],qs[_0xe4d6('0x34')](_0x40e3de['query'][_0xe4d6('0x34')]));_0x4f2fc2[_0xe4d6('0x35')]=_0x4f2fc2[_0xe4d6('0x35')][_0xe4d6('0x36')]?_0x4f2fc2['attributes']:_0x2a6a5d[_0xe4d6('0x31')];if(!_0x40e3de[_0xe4d6('0x32')][_0xe4d6('0x37')]('nolimit')){_0x4f2fc2['limit']=qs[_0xe4d6('0x1f')](_0x40e3de['query'][_0xe4d6('0x1f')]);_0x4f2fc2[_0xe4d6('0x1e')]=qs[_0xe4d6('0x1e')](_0x40e3de['query'][_0xe4d6('0x1e')]);}_0x4f2fc2[_0xe4d6('0x39')]=qs[_0xe4d6('0x3a')](_0x40e3de[_0xe4d6('0x32')][_0xe4d6('0x3a')]);_0x4f2fc2[_0xe4d6('0x3b')]=qs[_0xe4d6('0x3c')](_[_0xe4d6('0x3d')](_0x40e3de[_0xe4d6('0x32')],_0x2a6a5d[_0xe4d6('0x3c')]));_0x4f2fc2[_0xe4d6('0x3b')]['CampaignId']=_0x16d598['id'];if(_0x40e3de[_0xe4d6('0x32')]['filter']){_0x4f2fc2[_0xe4d6('0x3b')]=_['merge'](_0x4f2fc2[_0xe4d6('0x3b')],{'$or':_[_0xe4d6('0x2d')](_0x4f2fc2[_0xe4d6('0x35')],function(_0x437a06){var _0x253355={};_0x253355[_0x437a06]={'$like':'%'+_0x40e3de[_0xe4d6('0x32')][_0xe4d6('0x40')]+'%'};return _0x253355;})});}_0x4f2fc2=_[_0xe4d6('0x3e')]({},_0x4f2fc2,_0x40e3de[_0xe4d6('0x41')]);return db['CmHopper'][_0xe4d6('0x20')]({'where':_0x4f2fc2[_0xe4d6('0x3b')]})['then'](function(_0x14834f){_0xea686f[_0xe4d6('0x20')]=_0x14834f;if(_0x40e3de[_0xe4d6('0x32')]['includeAll']){_0x4f2fc2[_0xe4d6('0x43')]=[{'all':!![]}];}return db['CmHopper'][_0xe4d6('0x44')](_0x4f2fc2);})[_0xe4d6('0x25')](function(_0x36d67d){_0xea686f[_0xe4d6('0x5a')]=_0x36d67d;return _0xea686f;});}})['then'](respondWithFilteredResult(_0xb29ae,_0x4f2fc2))[_0xe4d6('0x45')](handleError(_0xb29ae,null));};exports['getHopperHistories']=function(_0x38aec5,_0x31991a,_0x18048e){var _0x10e4e6={'raw':!![],'where':{}};var _0xa54dfb={};var _0x22a99f={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x38aec5[_0xe4d6('0x51')]['id']}})[_0xe4d6('0x25')](handleEntityNotFound(_0x31991a,null))[_0xe4d6('0x25')](function(_0x47c558){if(_0x47c558){_0xa54dfb[_0xe4d6('0x31')]=_['keys'](db[_0xe4d6('0x5b')][_0xe4d6('0x2f')]);_0xa54dfb[_0xe4d6('0x32')]=_[_0xe4d6('0x47')](_0x38aec5[_0xe4d6('0x32')]);_0xa54dfb[_0xe4d6('0x3c')]=_[_0xe4d6('0x33')](_0xa54dfb['model'],_0xa54dfb[_0xe4d6('0x32')]);_0x10e4e6[_0xe4d6('0x35')]=_[_0xe4d6('0x33')](_0xa54dfb[_0xe4d6('0x31')],qs['fields'](_0x38aec5[_0xe4d6('0x32')][_0xe4d6('0x34')]));_0x10e4e6[_0xe4d6('0x35')]=_0x10e4e6['attributes'][_0xe4d6('0x36')]?_0x10e4e6[_0xe4d6('0x35')]:_0xa54dfb[_0xe4d6('0x31')];if(!_0x38aec5['query'][_0xe4d6('0x37')](_0xe4d6('0x38'))){_0x10e4e6[_0xe4d6('0x1f')]=qs[_0xe4d6('0x1f')](_0x38aec5[_0xe4d6('0x32')][_0xe4d6('0x1f')]);_0x10e4e6[_0xe4d6('0x1e')]=qs[_0xe4d6('0x1e')](_0x38aec5[_0xe4d6('0x32')][_0xe4d6('0x1e')]);}_0x10e4e6['order']=qs[_0xe4d6('0x3a')](_0x38aec5[_0xe4d6('0x32')][_0xe4d6('0x3a')]);_0x10e4e6[_0xe4d6('0x3b')]=qs['filters'](_[_0xe4d6('0x3d')](_0x38aec5[_0xe4d6('0x32')],_0xa54dfb[_0xe4d6('0x3c')]));_0x10e4e6[_0xe4d6('0x3b')][_0xe4d6('0x5c')]=_0x47c558['id'];if(_0x38aec5[_0xe4d6('0x32')][_0xe4d6('0x40')]){_0x10e4e6[_0xe4d6('0x3b')]=_[_0xe4d6('0x3e')](_0x10e4e6[_0xe4d6('0x3b')],{'$or':_['map'](_0x10e4e6[_0xe4d6('0x35')],function(_0x56558c){var _0x572d34={};_0x572d34[_0x56558c]={'$like':'%'+_0x38aec5[_0xe4d6('0x32')][_0xe4d6('0x40')]+'%'};return _0x572d34;})});}_0x10e4e6=_[_0xe4d6('0x3e')]({},_0x10e4e6,_0x38aec5['options']);return db[_0xe4d6('0x5b')]['count']({'where':_0x10e4e6[_0xe4d6('0x3b')]})[_0xe4d6('0x25')](function(_0x20d0c3){_0x22a99f[_0xe4d6('0x20')]=_0x20d0c3;if(_0x38aec5[_0xe4d6('0x32')][_0xe4d6('0x42')]){_0x10e4e6[_0xe4d6('0x43')]=[{'all':!![]}];}return db[_0xe4d6('0x5b')][_0xe4d6('0x44')](_0x10e4e6);})['then'](function(_0x575bbf){_0x22a99f[_0xe4d6('0x5a')]=_0x575bbf;return _0x22a99f;});}})['then'](respondWithFilteredResult(_0x31991a,_0x10e4e6))[_0xe4d6('0x45')](handleError(_0x31991a,null));};exports[_0xe4d6('0x5d')]=function(_0xe0b7bb,_0x2550d6,_0x30aaa7){var _0x4b5132={'raw':!![],'where':{}};var _0x50c43d={};var _0x21c20b={'count':0x0,'rows':[]};return db[_0xe4d6('0x2e')]['findOne']({'where':{'id':_0xe0b7bb[_0xe4d6('0x51')]['id']}})[_0xe4d6('0x25')](handleEntityNotFound(_0x2550d6,null))[_0xe4d6('0x25')](function(_0xa5a102){if(_0xa5a102){_0x50c43d[_0xe4d6('0x31')]=_[_0xe4d6('0x47')](db[_0xe4d6('0x5e')][_0xe4d6('0x2f')]);_0x50c43d[_0xe4d6('0x32')]=_[_0xe4d6('0x47')](_0xe0b7bb[_0xe4d6('0x32')]);_0x50c43d['filters']=_['intersection'](_0x50c43d[_0xe4d6('0x31')],_0x50c43d[_0xe4d6('0x32')]);_0x4b5132['attributes']=_[_0xe4d6('0x33')](_0x50c43d['model'],qs[_0xe4d6('0x34')](_0xe0b7bb[_0xe4d6('0x32')][_0xe4d6('0x34')]));_0x4b5132[_0xe4d6('0x35')]=_0x4b5132['attributes']['length']?_0x4b5132[_0xe4d6('0x35')]:_0x50c43d[_0xe4d6('0x31')];if(!_0xe0b7bb[_0xe4d6('0x32')][_0xe4d6('0x37')](_0xe4d6('0x38'))){_0x4b5132[_0xe4d6('0x1f')]=qs[_0xe4d6('0x1f')](_0xe0b7bb[_0xe4d6('0x32')][_0xe4d6('0x1f')]);_0x4b5132[_0xe4d6('0x1e')]=qs[_0xe4d6('0x1e')](_0xe0b7bb['query'][_0xe4d6('0x1e')]);}_0x4b5132[_0xe4d6('0x39')]=qs[_0xe4d6('0x3a')](_0xe0b7bb[_0xe4d6('0x32')]['sort']);_0x4b5132[_0xe4d6('0x3b')]=qs[_0xe4d6('0x3c')](_['pick'](_0xe0b7bb['query'],_0x50c43d['filters']));_0x4b5132['where']['CampaignId']=_0xa5a102['id'];if(_0xe0b7bb[_0xe4d6('0x32')]['filter']){_0x4b5132['where']=_[_0xe4d6('0x3e')](_0x4b5132[_0xe4d6('0x3b')],{'$or':_[_0xe4d6('0x2d')](_0x4b5132[_0xe4d6('0x35')],function(_0x4b2380){var _0x4e86f7={};_0x4e86f7[_0x4b2380]={'$like':'%'+_0xe0b7bb[_0xe4d6('0x32')][_0xe4d6('0x40')]+'%'};return _0x4e86f7;})});}_0x4b5132=_[_0xe4d6('0x3e')]({},_0x4b5132,_0xe0b7bb[_0xe4d6('0x41')]);return db[_0xe4d6('0x5e')][_0xe4d6('0x20')]({'where':_0x4b5132[_0xe4d6('0x3b')]})[_0xe4d6('0x25')](function(_0x5ce0ac){_0x21c20b[_0xe4d6('0x20')]=_0x5ce0ac;if(_0xe0b7bb['query'][_0xe4d6('0x42')]){_0x4b5132[_0xe4d6('0x43')]=[{'all':!![]}];}return db[_0xe4d6('0x5e')][_0xe4d6('0x44')](_0x4b5132);})[_0xe4d6('0x25')](function(_0x138381){_0x21c20b[_0xe4d6('0x5a')]=_0x138381;return _0x21c20b;});}})[_0xe4d6('0x25')](respondWithFilteredResult(_0x2550d6,_0x4b5132))[_0xe4d6('0x45')](handleError(_0x2550d6,null));};exports['getHopperBlacks']=function(_0x40b1ad,_0x10c2bb,_0x2848ed){var _0x39873f={'raw':!![],'where':{}};var _0x5bd860={};var _0x3a6de3={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x40b1ad[_0xe4d6('0x51')]['id']}})['then'](handleEntityNotFound(_0x10c2bb,null))[_0xe4d6('0x25')](function(_0x4bd9e1){if(_0x4bd9e1){_0x5bd860[_0xe4d6('0x31')]=_[_0xe4d6('0x47')](db[_0xe4d6('0x5f')][_0xe4d6('0x2f')]);_0x5bd860['query']=_[_0xe4d6('0x47')](_0x40b1ad['query']);_0x5bd860[_0xe4d6('0x3c')]=_['intersection'](_0x5bd860[_0xe4d6('0x31')],_0x5bd860['query']);_0x39873f[_0xe4d6('0x35')]=_['intersection'](_0x5bd860[_0xe4d6('0x31')],qs['fields'](_0x40b1ad[_0xe4d6('0x32')][_0xe4d6('0x34')]));_0x39873f['attributes']=_0x39873f[_0xe4d6('0x35')][_0xe4d6('0x36')]?_0x39873f[_0xe4d6('0x35')]:_0x5bd860['model'];if(!_0x40b1ad[_0xe4d6('0x32')][_0xe4d6('0x37')](_0xe4d6('0x38'))){_0x39873f[_0xe4d6('0x1f')]=qs[_0xe4d6('0x1f')](_0x40b1ad[_0xe4d6('0x32')][_0xe4d6('0x1f')]);_0x39873f[_0xe4d6('0x1e')]=qs[_0xe4d6('0x1e')](_0x40b1ad[_0xe4d6('0x32')][_0xe4d6('0x1e')]);}_0x39873f[_0xe4d6('0x39')]=qs[_0xe4d6('0x3a')](_0x40b1ad['query'][_0xe4d6('0x3a')]);_0x39873f[_0xe4d6('0x3b')]=qs[_0xe4d6('0x3c')](_[_0xe4d6('0x3d')](_0x40b1ad['query'],_0x5bd860[_0xe4d6('0x3c')]));_0x39873f[_0xe4d6('0x3b')][_0xe4d6('0x5c')]=_0x4bd9e1['id'];if(_0x40b1ad[_0xe4d6('0x32')][_0xe4d6('0x40')]){_0x39873f[_0xe4d6('0x3b')]=_[_0xe4d6('0x3e')](_0x39873f[_0xe4d6('0x3b')],{'$or':_['map'](_0x39873f[_0xe4d6('0x35')],function(_0x29168e){var _0x88ccab={};_0x88ccab[_0x29168e]={'$like':'%'+_0x40b1ad[_0xe4d6('0x32')]['filter']+'%'};return _0x88ccab;})});}_0x39873f=_[_0xe4d6('0x3e')]({},_0x39873f,_0x40b1ad[_0xe4d6('0x41')]);return db[_0xe4d6('0x5f')][_0xe4d6('0x20')]({'where':_0x39873f[_0xe4d6('0x3b')]})['then'](function(_0x409c8f){_0x3a6de3['count']=_0x409c8f;if(_0x40b1ad[_0xe4d6('0x32')][_0xe4d6('0x42')]){_0x39873f[_0xe4d6('0x43')]=[{'all':!![]}];}return db[_0xe4d6('0x5f')][_0xe4d6('0x44')](_0x39873f);})[_0xe4d6('0x25')](function(_0x36ab7f){_0x3a6de3[_0xe4d6('0x5a')]=_0x36ab7f;return _0x3a6de3;});}})[_0xe4d6('0x25')](respondWithFilteredResult(_0x10c2bb,_0x39873f))['catch'](handleError(_0x10c2bb,null));};exports[_0xe4d6('0x60')]=function(_0x3e6142,_0x21d29c,_0x164e9a){var _0x1bb099={};var _0x47f170={};var _0xd4bf7c;var _0x5cd884;return db['Campaign'][_0xe4d6('0x58')]({'where':{'id':_0x3e6142[_0xe4d6('0x51')]['id']}})['then'](handleEntityNotFound(_0x21d29c,null))[_0xe4d6('0x25')](function(_0x59c2f9){if(_0x59c2f9){_0xd4bf7c=_0x59c2f9;_0x47f170[_0xe4d6('0x31')]=_['keys'](db[_0xe4d6('0x61')][_0xe4d6('0x2f')]);_0x47f170[_0xe4d6('0x32')]=_[_0xe4d6('0x47')](_0x3e6142[_0xe4d6('0x32')]);_0x47f170[_0xe4d6('0x3c')]=_[_0xe4d6('0x33')](_0x47f170[_0xe4d6('0x31')],_0x47f170[_0xe4d6('0x32')]);_0x1bb099[_0xe4d6('0x35')]=_[_0xe4d6('0x33')](_0x47f170[_0xe4d6('0x31')],qs['fields'](_0x3e6142[_0xe4d6('0x32')][_0xe4d6('0x34')]));_0x1bb099[_0xe4d6('0x35')]=_0x1bb099[_0xe4d6('0x35')][_0xe4d6('0x36')]?_0x1bb099[_0xe4d6('0x35')]:_0x47f170[_0xe4d6('0x31')];_0x1bb099['order']=qs[_0xe4d6('0x3a')](_0x3e6142[_0xe4d6('0x32')][_0xe4d6('0x3a')]);_0x1bb099[_0xe4d6('0x3b')]=qs[_0xe4d6('0x3c')](_[_0xe4d6('0x3d')](_0x3e6142[_0xe4d6('0x32')],_0x47f170[_0xe4d6('0x3c')]));if(_0x3e6142[_0xe4d6('0x32')][_0xe4d6('0x40')]){_0x1bb099['where']=_[_0xe4d6('0x3e')](_0x1bb099[_0xe4d6('0x3b')],{'$or':_[_0xe4d6('0x2d')](_0x1bb099[_0xe4d6('0x35')],function(_0x1cdd7e){var _0x3aa9ce={};_0x3aa9ce[_0x1cdd7e]={'$like':'%'+_0x3e6142['query'][_0xe4d6('0x40')]+'%'};return _0x3aa9ce;})});}_0x1bb099=_[_0xe4d6('0x3e')]({},_0x1bb099,_0x3e6142[_0xe4d6('0x41')]);return _0xd4bf7c[_0xe4d6('0x60')](_0x1bb099);}})[_0xe4d6('0x25')](function(_0x525508){if(_0x525508){_0x5cd884=_0x525508['length'];if(!_0x3e6142[_0xe4d6('0x32')][_0xe4d6('0x37')](_0xe4d6('0x38'))){_0x1bb099['limit']=qs[_0xe4d6('0x1f')](_0x3e6142[_0xe4d6('0x32')][_0xe4d6('0x1f')]);_0x1bb099[_0xe4d6('0x1e')]=qs[_0xe4d6('0x1e')](_0x3e6142[_0xe4d6('0x32')][_0xe4d6('0x1e')]);}return _0xd4bf7c[_0xe4d6('0x60')](_0x1bb099);}})['then'](function(_0x293c7d){if(_0x293c7d){return _0x293c7d?{'count':_0x5cd884,'rows':_0x293c7d}:null;}})[_0xe4d6('0x25')](respondWithResult(_0x21d29c,null))[_0xe4d6('0x45')](handleError(_0x21d29c,null));};exports[_0xe4d6('0x62')]=function(_0x1e6f6f,_0x2d96b8,_0x5173fb){var _0xd5aa28,_0x20b128;var _0x1305d7=[];var _0x4362c4=moment()[_0xe4d6('0x63')](_0xe4d6('0x64'));return db[_0xe4d6('0x2e')][_0xe4d6('0x48')]({'where':{'id':_0x1e6f6f[_0xe4d6('0x51')]['id']}})[_0xe4d6('0x25')](handleEntityNotFound(_0x2d96b8,null))['then'](function(_0x29ab0a){if(_0x29ab0a){_0x20b128=_0x29ab0a;return _0x29ab0a[_0xe4d6('0x62')](_0x1e6f6f['body'][_0xe4d6('0x65')],_[_0xe4d6('0x52')](_0x1e6f6f[_0xe4d6('0x4a')],[_0xe4d6('0x65'),'id'])||{});}return null;})[_0xe4d6('0x66')](function(_0x3d71cc){var _0x2e8fed;var _0x1af54e;_0xd5aa28=_0x3d71cc||[];var _0x139151=[];if(_0x3d71cc){for(var _0x5ec548=0x0;_0x5ec548<_0x3d71cc[_0xe4d6('0x36')];_0x5ec548+=0x1){var _0x2817d5=_0x3d71cc[_0x5ec548][_0xe4d6('0x27')]({'plain':!![]});_0x20b128['dialCheckDuplicateType']=_0x1e6f6f[_0xe4d6('0x4a')]['dialCheckDuplicateType']?_0x1e6f6f['body'][_0xe4d6('0x67')]:_0x20b128[_0xe4d6('0x67')];switch(_0x20b128['dialCheckDuplicateType']){case _0xe4d6('0x68'):_0x2e8fed=squel[_0xe4d6('0x69')]()[_0xe4d6('0x6a')](_0xe4d6('0x6b'))['fromQuery']([_0xe4d6('0x6c'),'scheduledAt','ContactId','ListId',_0xe4d6('0x5c'),'createdAt',_0xe4d6('0x54')],squel['select']()['field'](_0xe4d6('0x6c'),_0xe4d6('0x6c'))[_0xe4d6('0x6d')](_0xe4d6('0x6e'),_0xe4d6('0x6f'))[_0xe4d6('0x6d')]('id',_0xe4d6('0x70'))[_0xe4d6('0x6d')](_0x2817d5[_0xe4d6('0x71')][_0xe4d6('0x72')](),_0xe4d6('0x73'))[_0xe4d6('0x6d')](_0x1e6f6f['params']['id'][_0xe4d6('0x72')](),'CampaignId')[_0xe4d6('0x6d')]('\x27'+_0x4362c4+'\x27',_0xe4d6('0x53'))['field']('\x27'+_0x4362c4+'\x27',_0xe4d6('0x54'))[_0xe4d6('0x74')](_0xe4d6('0x75'))[_0xe4d6('0x3b')](_0xe4d6('0x76'))['where'](_0xe4d6('0x77'),_0x2817d5['CmListId'][_0xe4d6('0x72')]())['where'](_0xe4d6('0x78'))[_0xe4d6('0x3b')](_0xe4d6('0x79'),squel[_0xe4d6('0x7a')]()[_0xe4d6('0x6d')](_0xe4d6('0x7b'))[_0xe4d6('0x74')]('cm_hopper_final')[_0xe4d6('0x3b')](_0xe4d6('0x7c'),_0x1e6f6f[_0xe4d6('0x51')]['id']['toString']()))['where'](_0xe4d6('0x79'),squel[_0xe4d6('0x7a')]()[_0xe4d6('0x6d')]('COALESCE(phone,\x27\x27)')[_0xe4d6('0x74')](_0xe4d6('0x6b'))['where'](_0xe4d6('0x7c'),_0x1e6f6f[_0xe4d6('0x51')]['id'][_0xe4d6('0x72')]())))[_0xe4d6('0x72')]();break;case _0xe4d6('0x7d'):_0x2e8fed=squel[_0xe4d6('0x69')]()['into'](_0xe4d6('0x6b'))['fromQuery']([_0xe4d6('0x6c'),_0xe4d6('0x6f'),_0xe4d6('0x70'),_0xe4d6('0x73'),'CampaignId','createdAt',_0xe4d6('0x54')],squel['select']()[_0xe4d6('0x6d')](_0xe4d6('0x6c'),_0xe4d6('0x6c'))[_0xe4d6('0x6d')](_0xe4d6('0x6e'),_0xe4d6('0x6f'))[_0xe4d6('0x6d')]('id',_0xe4d6('0x70'))['field'](_0x2817d5['CmListId'][_0xe4d6('0x72')](),_0xe4d6('0x73'))[_0xe4d6('0x6d')](_0x1e6f6f[_0xe4d6('0x51')]['id'][_0xe4d6('0x72')](),_0xe4d6('0x5c'))['field']('\x27'+_0x4362c4+'\x27',_0xe4d6('0x53'))[_0xe4d6('0x6d')]('\x27'+_0x4362c4+'\x27',_0xe4d6('0x54'))[_0xe4d6('0x74')](_0xe4d6('0x75'))[_0xe4d6('0x3b')](_0xe4d6('0x76'))[_0xe4d6('0x3b')](_0xe4d6('0x77'),_0x2817d5[_0xe4d6('0x71')]['toString']())['where'](_0xe4d6('0x78'))[_0xe4d6('0x3b')](_0xe4d6('0x79'),squel[_0xe4d6('0x7a')]()[_0xe4d6('0x6d')]('COALESCE(phone,\x27\x27)')[_0xe4d6('0x74')]('cm_hopper')[_0xe4d6('0x3b')](_0xe4d6('0x7c'),_0x1e6f6f['params']['id'][_0xe4d6('0x72')]())))[_0xe4d6('0x72')]();break;default:_0x2e8fed=squel[_0xe4d6('0x69')]()[_0xe4d6('0x6a')]('cm_hopper')[_0xe4d6('0x7e')](['phone','scheduledAt','ContactId',_0xe4d6('0x73'),_0xe4d6('0x5c'),_0xe4d6('0x53'),'updatedAt'],squel[_0xe4d6('0x7a')]()[_0xe4d6('0x6d')](_0xe4d6('0x6c'),'phone')['field']('NOW()',_0xe4d6('0x6f'))[_0xe4d6('0x6d')]('id',_0xe4d6('0x70'))[_0xe4d6('0x6d')](_0x2817d5['CmListId'][_0xe4d6('0x72')](),'ListId')[_0xe4d6('0x6d')](_0x1e6f6f[_0xe4d6('0x51')]['id']['toString'](),_0xe4d6('0x5c'))[_0xe4d6('0x6d')]('\x27'+_0x4362c4+'\x27',_0xe4d6('0x53'))[_0xe4d6('0x6d')]('\x27'+_0x4362c4+'\x27',_0xe4d6('0x54'))[_0xe4d6('0x74')](_0xe4d6('0x75'))[_0xe4d6('0x3b')](_0xe4d6('0x76'))[_0xe4d6('0x3b')](_0xe4d6('0x77'),_0x2817d5[_0xe4d6('0x71')]['toString']())[_0xe4d6('0x3b')](_0xe4d6('0x78')))[_0xe4d6('0x72')]();}_0x1af54e=squel[_0xe4d6('0x69')]()['into']('cm_hopper_additional_phones')[_0xe4d6('0x7e')]([_0xe4d6('0x7f'),_0xe4d6('0x6f'),'phone','OrderBy',_0xe4d6('0x53'),'updatedAt'],squel[_0xe4d6('0x7a')]()[_0xe4d6('0x6d')](_0xe4d6('0x80'),'id')[_0xe4d6('0x6d')](_0xe4d6('0x6e'),'scheduledAt')['field'](_0xe4d6('0x81'),'phone')[_0xe4d6('0x6d')]('ci.OrderBY',_0xe4d6('0x82'))[_0xe4d6('0x6d')]('\x27'+_0x4362c4+'\x27','createdAt')[_0xe4d6('0x6d')]('\x27'+_0x4362c4+'\x27','updatedAt')[_0xe4d6('0x74')](_0xe4d6('0x83'),'ci')[_0xe4d6('0x84')](_0xe4d6('0x6b'),'h',_0xe4d6('0x85'))['where']('h.ListId\x20=\x20?',_0x2817d5[_0xe4d6('0x71')][_0xe4d6('0x72')]())[_0xe4d6('0x3b')](_0xe4d6('0x86'),_0x1e6f6f[_0xe4d6('0x51')]['id'][_0xe4d6('0x72')]())[_0xe4d6('0x3b')]('h.createdAt\x20=\x20?',_0x4362c4))[_0xe4d6('0x72')]();_0x139151[_0xe4d6('0x87')](db['sequelize'][_0xe4d6('0x32')](_0x2e8fed));_0x1305d7[_0xe4d6('0x87')](db['sequelize']['query'](_0x1af54e));}return BPromise[_0xe4d6('0x88')](_0x139151);}})['then'](function(){return BPromise[_0xe4d6('0x88')](_0x1305d7);})['then'](function(){return _0xd5aa28;})[_0xe4d6('0x25')](respondWithResult(_0x2d96b8,null))[_0xe4d6('0x45')](handleError(_0x2d96b8,null));};exports[_0xe4d6('0x89')]=function(_0x23635d,_0x4dcaa5,_0x38dd51){return db[_0xe4d6('0x2e')][_0xe4d6('0x48')]({'where':{'id':_0x23635d[_0xe4d6('0x51')]['id']}})['then'](handleEntityNotFound(_0x4dcaa5,null))['then'](function(_0x3b597e){if(_0x3b597e){return _0x3b597e[_0xe4d6('0x89')](_0x23635d[_0xe4d6('0x32')][_0xe4d6('0x65')]);}})[_0xe4d6('0x25')](function(_0x5f08ab){if(_0x5f08ab){return db[_0xe4d6('0x59')][_0xe4d6('0x26')]({'where':{'ListId':_0x23635d[_0xe4d6('0x32')][_0xe4d6('0x65')],'CampaignId':_0x23635d['params']['id']}})[_0xe4d6('0x25')](function(){return _0x5f08ab;});}})[_0xe4d6('0x25')](respondWithStatusCode(_0x4dcaa5,null))[_0xe4d6('0x45')](handleError(_0x4dcaa5,null));};exports['getBlackLists']=function(_0x5b354f,_0x40ac96,_0x2bd510){var _0x3cadb9={};var _0x38e0ff={};var _0x3984ed;var _0x286fd6;return db[_0xe4d6('0x2e')]['findOne']({'where':{'id':_0x5b354f[_0xe4d6('0x51')]['id']}})[_0xe4d6('0x25')](handleEntityNotFound(_0x40ac96,null))['then'](function(_0x430212){if(_0x430212){_0x3984ed=_0x430212;_0x38e0ff[_0xe4d6('0x31')]=_[_0xe4d6('0x47')](db[_0xe4d6('0x61')][_0xe4d6('0x2f')]);_0x38e0ff[_0xe4d6('0x32')]=_['keys'](_0x5b354f[_0xe4d6('0x32')]);_0x38e0ff[_0xe4d6('0x3c')]=_[_0xe4d6('0x33')](_0x38e0ff['model'],_0x38e0ff[_0xe4d6('0x32')]);_0x3cadb9['attributes']=_[_0xe4d6('0x33')](_0x38e0ff['model'],qs[_0xe4d6('0x34')](_0x5b354f['query']['fields']));_0x3cadb9[_0xe4d6('0x35')]=_0x3cadb9[_0xe4d6('0x35')]['length']?_0x3cadb9[_0xe4d6('0x35')]:_0x38e0ff['model'];_0x3cadb9[_0xe4d6('0x39')]=qs[_0xe4d6('0x3a')](_0x5b354f[_0xe4d6('0x32')]['sort']);_0x3cadb9[_0xe4d6('0x3b')]=qs[_0xe4d6('0x3c')](_[_0xe4d6('0x3d')](_0x5b354f[_0xe4d6('0x32')],_0x38e0ff[_0xe4d6('0x3c')]));if(_0x5b354f[_0xe4d6('0x32')][_0xe4d6('0x40')]){_0x3cadb9['where']=_[_0xe4d6('0x3e')](_0x3cadb9[_0xe4d6('0x3b')],{'$or':_['map'](_0x3cadb9[_0xe4d6('0x35')],function(_0x3cbeb4){var _0x3a5040={};_0x3a5040[_0x3cbeb4]={'$like':'%'+_0x5b354f[_0xe4d6('0x32')][_0xe4d6('0x40')]+'%'};return _0x3a5040;})});}_0x3cadb9=_['merge']({},_0x3cadb9,_0x5b354f[_0xe4d6('0x41')]);return _0x3984ed[_0xe4d6('0x8a')](_0x3cadb9);}})[_0xe4d6('0x25')](function(_0x3c9a1a){if(_0x3c9a1a){_0x286fd6=_0x3c9a1a['length'];if(!_0x5b354f[_0xe4d6('0x32')][_0xe4d6('0x37')](_0xe4d6('0x38'))){_0x3cadb9[_0xe4d6('0x1f')]=qs[_0xe4d6('0x1f')](_0x5b354f[_0xe4d6('0x32')][_0xe4d6('0x1f')]);_0x3cadb9['offset']=qs[_0xe4d6('0x1e')](_0x5b354f['query']['offset']);}return _0x3984ed[_0xe4d6('0x8a')](_0x3cadb9);}})[_0xe4d6('0x25')](function(_0x3f1007){if(_0x3f1007){return _0x3f1007?{'count':_0x286fd6,'rows':_0x3f1007}:null;}})[_0xe4d6('0x25')](respondWithResult(_0x40ac96,null))[_0xe4d6('0x45')](handleError(_0x40ac96,null));};exports[_0xe4d6('0x8b')]=function(_0x328516,_0x4c4774,_0x47c6f2){var _0x5ad555,_0x1e4cae;var _0x490bf0=[];var _0x5a1ac6=moment()[_0xe4d6('0x63')](_0xe4d6('0x64'));return db[_0xe4d6('0x2e')][_0xe4d6('0x48')]({'where':{'id':_0x328516[_0xe4d6('0x51')]['id']}})['then'](handleEntityNotFound(_0x4c4774,null))[_0xe4d6('0x25')](function(_0x54562f){if(_0x54562f){_0x1e4cae=_0x54562f;return _0x54562f[_0xe4d6('0x8b')](_0x328516[_0xe4d6('0x4a')]['ids'],_[_0xe4d6('0x52')](_0x328516[_0xe4d6('0x4a')],['ids','id'])||{});}return null;})[_0xe4d6('0x66')](function(_0x5e268b){var _0x3b1cb7;var _0x5beeed;_0x5ad555=_0x5e268b||[];var _0x150db3=[];if(_0x5e268b){for(var _0x8ecf96=0x0;_0x8ecf96<_0x5e268b[_0xe4d6('0x36')];_0x8ecf96+=0x1){var _0x3c3542=_0x5e268b[_0x8ecf96][_0xe4d6('0x27')]({'plain':!![]});_0x3b1cb7=squel['insert']()[_0xe4d6('0x6a')](_0xe4d6('0x8c'))['fromQuery'](['phone',_0xe4d6('0x70'),_0xe4d6('0x73'),_0xe4d6('0x5c'),'createdAt','updatedAt'],squel['select']()['field'](_0xe4d6('0x6c'),'phone')[_0xe4d6('0x6d')]('id','ContactId')[_0xe4d6('0x6d')](_0x3c3542['CmListId'][_0xe4d6('0x72')](),_0xe4d6('0x73'))['field'](_0x328516[_0xe4d6('0x51')]['id']['toString'](),'CampaignId')['field'](_0xe4d6('0x6e'),_0xe4d6('0x53'))[_0xe4d6('0x6d')]('NOW()','updatedAt')[_0xe4d6('0x74')](_0xe4d6('0x75'))[_0xe4d6('0x3b')](_0xe4d6('0x76'))[_0xe4d6('0x3b')](_0xe4d6('0x77'),_0x3c3542[_0xe4d6('0x71')][_0xe4d6('0x72')]())[_0xe4d6('0x3b')](_0xe4d6('0x78')))['toString']();_0x150db3[_0xe4d6('0x87')](db[_0xe4d6('0x8d')]['query'](_0x3b1cb7));}return BPromise['all'](_0x150db3);}})[_0xe4d6('0x25')](function(){return _0x5ad555;})[_0xe4d6('0x25')](respondWithResult(_0x4c4774,null))[_0xe4d6('0x45')](handleError(_0x4c4774,null));};exports[_0xe4d6('0x8e')]=function(_0x293c99,_0x56cd8c,_0x49ebda){return db[_0xe4d6('0x2e')][_0xe4d6('0x48')]({'where':{'id':_0x293c99['params']['id']}})['then'](handleEntityNotFound(_0x56cd8c,null))[_0xe4d6('0x25')](function(_0x48cb50){if(_0x48cb50){return _0x48cb50[_0xe4d6('0x8e')](_0x293c99[_0xe4d6('0x32')][_0xe4d6('0x65')]);}})[_0xe4d6('0x25')](function(_0x3f510d){if(_0x3f510d){return db[_0xe4d6('0x5f')][_0xe4d6('0x26')]({'where':{'ListId':_0x293c99['query']['ids'],'CampaignId':_0x293c99['params']['id']}})['then'](function(){return _0x3f510d;});}})[_0xe4d6('0x25')](respondWithStatusCode(_0x56cd8c,null))[_0xe4d6('0x45')](handleError(_0x56cd8c,null));}; \ No newline at end of file +var _0x351d=['format','cm_hopper_black','removeBlackLists','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','sendStatus','end','status','json','limit','count','offset','apply','reject','save','update','destroy','then','get','IvrCampaigns','error','stack','name','send','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','length','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','find','omit','createdAt','updatedAt','role','user','getHoppers','findOne','CmHopper','CampaignId','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','select','field','NOW()','scheduledAt','ContactId','CmListId','ListId','toString','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','from','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','h.id','ci.item','ci.OrderBY','OrderBy','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x351d,0x90));var _0xd351=function(_0x21b21d,_0xf168b7){_0x21b21d=_0x21b21d-0x0;var _0xbd69e9=_0x351d[_0x21b21d];return _0xbd69e9;};'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'];function respondWithStatusCode(_0x3eb40c,_0x15549a){_0x15549a=_0x15549a||0xcc;return function(_0x23445f){if(_0x23445f){return _0x3eb40c[_0xd351('0x13')](_0x15549a);}return _0x3eb40c['status'](_0x15549a)[_0xd351('0x14')]();};}function respondWithResult(_0x316cf6,_0x597d7c){_0x597d7c=_0x597d7c||0xc8;return function(_0xc5a145){if(_0xc5a145){return _0x316cf6[_0xd351('0x15')](_0x597d7c)[_0xd351('0x16')](_0xc5a145);}};}function respondWithFilteredResult(_0xf1c285,_0x3867fb){return function(_0x4d238c){if(_0x4d238c){var _0x9f790f=typeof _0x3867fb['offset']==='undefined'&&typeof _0x3867fb[_0xd351('0x17')]==='undefined';var _0x21e591=_0x4d238c[_0xd351('0x18')];var _0x4e0164=_0x9f790f?0x0:_0x3867fb['offset'];var _0x1e1a3c=_0x9f790f?_0x4d238c[_0xd351('0x18')]:_0x3867fb[_0xd351('0x19')]+_0x3867fb[_0xd351('0x17')];var _0x51f265;if(_0x1e1a3c>=_0x21e591){_0x1e1a3c=_0x21e591;_0x51f265=0xc8;}else{_0x51f265=0xce;}_0xf1c285[_0xd351('0x15')](_0x51f265);return _0xf1c285['set']('Content-Range',_0x4e0164+'-'+_0x1e1a3c+'/'+_0x21e591)[_0xd351('0x16')](_0x4d238c);}return null;};}function patchUpdates(_0x4a427b){return function(_0x33b1e5){try{jsonpatch[_0xd351('0x1a')](_0x33b1e5,_0x4a427b,!![]);}catch(_0x3634c9){return BPromise[_0xd351('0x1b')](_0x3634c9);}return _0x33b1e5[_0xd351('0x1c')]();};}function saveUpdates(_0x53e729,_0x18625b){return function(_0xbbc58){if(_0xbbc58){return _0xbbc58[_0xd351('0x1d')](_0x53e729)['then'](function(_0x1ce7f7){return _0x1ce7f7;});}return null;};}function removeEntity(_0x2d9aa0,_0x365bbc){return function(_0x59fb6d){if(_0x59fb6d){return _0x59fb6d[_0xd351('0x1e')]()[_0xd351('0x1f')](function(){var _0x4626c4=_0x59fb6d[_0xd351('0x20')]({'plain':!![]});var _0x489c9a=_0xd351('0x21');return db['UserProfileResource'][_0xd351('0x1e')]({'where':{'type':_0x489c9a,'resourceId':_0x4626c4['id']}})[_0xd351('0x1f')](function(){return _0x59fb6d;});})['then'](function(){_0x2d9aa0[_0xd351('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d67e,_0x1d0cb1){return function(_0x560be9){if(!_0x560be9){_0x50d67e['sendStatus'](0x194);}return _0x560be9;};}function handleError(_0x134580,_0x555a50){_0x555a50=_0x555a50||0x1f4;return function(_0x38471c){logger[_0xd351('0x22')](_0x38471c[_0xd351('0x23')]);if(_0x38471c['name']){delete _0x38471c[_0xd351('0x24')];}_0x134580['status'](_0x555a50)[_0xd351('0x25')](_0x38471c);};}exports['index']=function(_0x5f07b1,_0xeb4da9){var _0x38c82f={},_0x3f9ef3={},_0x33b43d={'count':0x0,'rows':[]};var _0x48aa96=_[_0xd351('0x26')](db[_0xd351('0x27')][_0xd351('0x28')],function(_0x41da60){return{'name':_0x41da60[_0xd351('0x29')],'type':_0x41da60[_0xd351('0x2a')][_0xd351('0x2b')]};});_0x3f9ef3[_0xd351('0x2c')]=_[_0xd351('0x26')](_0x48aa96,'name');_0x3f9ef3[_0xd351('0x2d')]=_[_0xd351('0x2e')](_0x5f07b1[_0xd351('0x2d')]);_0x3f9ef3[_0xd351('0x2f')]=_['intersection'](_0x3f9ef3[_0xd351('0x2c')],_0x3f9ef3[_0xd351('0x2d')]);_0x38c82f[_0xd351('0x30')]=_[_0xd351('0x31')](_0x3f9ef3[_0xd351('0x2c')],qs[_0xd351('0x32')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x32')]));_0x38c82f[_0xd351('0x30')]=_0x38c82f['attributes']['length']?_0x38c82f[_0xd351('0x30')]:_0x3f9ef3[_0xd351('0x2c')];if(!_0x5f07b1[_0xd351('0x2d')][_0xd351('0x33')](_0xd351('0x34'))){_0x38c82f[_0xd351('0x17')]=qs['limit'](_0x5f07b1['query'][_0xd351('0x17')]);_0x38c82f['offset']=qs[_0xd351('0x19')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x19')]);}_0x38c82f[_0xd351('0x35')]=qs[_0xd351('0x36')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x36')]);_0x38c82f[_0xd351('0x37')]=qs[_0xd351('0x2f')](_[_0xd351('0x38')](_0x5f07b1[_0xd351('0x2d')],_0x3f9ef3['filters']),_0x48aa96);if(_0x5f07b1[_0xd351('0x2d')]['filter']){_0x38c82f[_0xd351('0x37')]=_[_0xd351('0x39')](_0x38c82f[_0xd351('0x37')],{'$or':_[_0xd351('0x26')](_0x48aa96,function(_0x3b42e7){if(_0x3b42e7[_0xd351('0x2a')]!=='VIRTUAL'){var _0x3ad98e={};_0x3ad98e[_0x3b42e7[_0xd351('0x24')]]={'$like':'%'+_0x5f07b1['query'][_0xd351('0x3a')]+'%'};return _0x3ad98e;}})});}_0x38c82f=_[_0xd351('0x39')]({},_0x38c82f,_0x5f07b1[_0xd351('0x3b')]);var _0x1fc216={'where':_0x38c82f[_0xd351('0x37')]};return db['Campaign']['count'](_0x1fc216)[_0xd351('0x1f')](function(_0x3935aa){_0x33b43d['count']=_0x3935aa;if(_0x5f07b1['query'][_0xd351('0x3c')]){_0x38c82f[_0xd351('0x3d')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x38c82f);})[_0xd351('0x1f')](function(_0x18f9d1){_0x33b43d[_0xd351('0x3e')]=_0x18f9d1;return _0x33b43d;})[_0xd351('0x1f')](respondWithFilteredResult(_0xeb4da9,_0x38c82f))[_0xd351('0x3f')](handleError(_0xeb4da9,null));};exports[_0xd351('0x40')]=function(_0x6192c3,_0x110458){var _0x129605={'raw':![],'where':{'id':_0x6192c3['params']['id']}},_0x553360={};_0x553360[_0xd351('0x2c')]=_[_0xd351('0x2e')](db[_0xd351('0x27')][_0xd351('0x28')]);_0x553360[_0xd351('0x2d')]=_[_0xd351('0x2e')](_0x6192c3[_0xd351('0x2d')]);_0x553360[_0xd351('0x2f')]=_[_0xd351('0x31')](_0x553360[_0xd351('0x2c')],_0x553360[_0xd351('0x2d')]);_0x129605[_0xd351('0x30')]=_[_0xd351('0x31')](_0x553360[_0xd351('0x2c')],qs[_0xd351('0x32')](_0x6192c3[_0xd351('0x2d')]['fields']));_0x129605[_0xd351('0x30')]=_0x129605[_0xd351('0x30')][_0xd351('0x41')]?_0x129605['attributes']:_0x553360[_0xd351('0x2c')];if(_0x6192c3[_0xd351('0x2d')][_0xd351('0x3c')]){_0x129605[_0xd351('0x3d')]=[{'all':!![]}];}_0x129605=_[_0xd351('0x39')]({},_0x129605,_0x6192c3['options']);return db[_0xd351('0x27')]['find'](_0x129605)[_0xd351('0x1f')](handleEntityNotFound(_0x110458,null))[_0xd351('0x1f')](respondWithResult(_0x110458,null))['catch'](handleError(_0x110458,null));};exports['create']=function(_0x1bd727,_0x444206){return db[_0xd351('0x27')]['create'](_0x1bd727[_0xd351('0x42')],{})[_0xd351('0x1f')](function(_0x548d90){var _0xf3ce5=_0x1bd727['user'][_0xd351('0x20')]({'plain':!![]});if(!_0xf3ce5)throw new Error(_0xd351('0x43'));if(_0xf3ce5['role']==='user'){var _0x25ea1e=_0x548d90['get']({'plain':!![]});var _0xf9f375=_0xd351('0x21');return db[_0xd351('0x44')]['find']({'where':{'name':_0xf9f375,'userProfileId':_0xf3ce5[_0xd351('0x45')]},'raw':!![]})['then'](function(_0x5527da){if(_0x5527da&&_0x5527da['autoAssociation']===0x0){return db[_0xd351('0x46')][_0xd351('0x47')]({'name':_0x25ea1e[_0xd351('0x24')],'resourceId':_0x25ea1e['id'],'type':_0x5527da['name'],'sectionId':_0x5527da['id']},{})['then'](function(){return _0x548d90;});}else{return _0x548d90;}})[_0xd351('0x3f')](function(_0x42f248){logger['error'](_0xd351('0x48'),_0x42f248);throw _0x42f248;});}return _0x548d90;})[_0xd351('0x1f')](respondWithResult(_0x444206,0xc9))['catch'](handleError(_0x444206,null));};exports[_0xd351('0x49')]=function(_0x59ab0f,_0x22394e){var _0x4d554f={'where':{'id':_0x59ab0f[_0xd351('0x4a')]['id']}},_0x6f0446={};_0x6f0446[_0xd351('0x2c')]=_[_0xd351('0x2e')](db[_0xd351('0x27')][_0xd351('0x28')]);_0x4d554f[_0xd351('0x30')]=_['intersection'](_0x6f0446['model'],qs[_0xd351('0x32')](_0x59ab0f[_0xd351('0x2d')]['fields']));_0x4d554f[_0xd351('0x30')]=_0x4d554f[_0xd351('0x30')][_0xd351('0x41')]?_0x4d554f['attributes']:_0x6f0446[_0xd351('0x2c')];if(_0x59ab0f['query']['includeAll']){_0x4d554f[_0xd351('0x3d')]=[{'all':!![]}];}_0x4d554f=_[_0xd351('0x39')]({},_0x4d554f,_0x59ab0f['options']);return db[_0xd351('0x27')][_0xd351('0x4b')](_0x4d554f)[_0xd351('0x1f')](handleEntityNotFound(_0x22394e,null))[_0xd351('0x1f')](function(_0x21d096){if(_0x21d096){var _0x2dc745=_0x21d096['get']({'plain':!![]});_0x2dc745=qs[_0xd351('0x4c')](_0x2dc745,['id',_0xd351('0x4d'),_0xd351('0x4e')]);_0x59ab0f[_0xd351('0x42')]=_[_0xd351('0x4c')](_0x59ab0f[_0xd351('0x42')],['id',_0xd351('0x4d'),'updatedAt']);return db[_0xd351('0x27')]['create'](_[_0xd351('0x39')](_0x2dc745,_0x59ab0f[_0xd351('0x42')]),{'include':_0x59ab0f[_0xd351('0x2d')][_0xd351('0x3c')]?[{'all':!![]}]:undefined})[_0xd351('0x1f')](function(_0x4eaf18){var _0x413931=_0x59ab0f['user'][_0xd351('0x20')]({'plain':!![]});if(!_0x413931)throw new Error(_0xd351('0x43'));if(_0x413931[_0xd351('0x4f')]===_0xd351('0x50')){var _0x4097ca=_0x4eaf18['get']({'plain':!![]});var _0x5f43a9=_0xd351('0x21');return db[_0xd351('0x44')]['find']({'where':{'name':_0x5f43a9,'userProfileId':_0x413931[_0xd351('0x45')]},'raw':!![]})[_0xd351('0x1f')](function(_0x2718e9){if(_0x2718e9&&_0x2718e9['autoAssociation']===0x0){return db[_0xd351('0x46')][_0xd351('0x47')]({'name':_0x4097ca[_0xd351('0x24')],'resourceId':_0x4097ca['id'],'type':_0x2718e9[_0xd351('0x24')],'sectionId':_0x2718e9['id']},{})['then'](function(){return _0x4eaf18;});}else{return _0x4eaf18;}})['catch'](function(_0x40c78b){logger[_0xd351('0x22')](_0xd351('0x48'),_0x40c78b);throw _0x40c78b;});}return _0x4eaf18;});}})[_0xd351('0x1f')](respondWithResult(_0x22394e,0xc9))[_0xd351('0x3f')](handleError(_0x22394e,null));};exports[_0xd351('0x1d')]=function(_0x2c83fe,_0x5e2e06){if(_0x2c83fe[_0xd351('0x42')]['id']){delete _0x2c83fe['body']['id'];}return db['Campaign'][_0xd351('0x4b')]({'where':{'id':_0x2c83fe[_0xd351('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5e2e06,null))[_0xd351('0x1f')](saveUpdates(_0x2c83fe['body'],null))['then'](respondWithResult(_0x5e2e06,null))['catch'](handleError(_0x5e2e06,null));};exports[_0xd351('0x1e')]=function(_0x33a381,_0x1d22bc){return db['Campaign'][_0xd351('0x4b')]({'where':{'id':_0x33a381[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x1d22bc,null))[_0xd351('0x1f')](removeEntity(_0x1d22bc,null))[_0xd351('0x3f')](handleError(_0x1d22bc,null));};exports[_0xd351('0x51')]=function(_0x15fcab,_0x6bf19c,_0x130617){var _0x22672={'raw':!![],'where':{}};var _0x18c261={};var _0x4d20af={'count':0x0,'rows':[]};return db[_0xd351('0x27')][_0xd351('0x52')]({'where':{'id':_0x15fcab[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x6bf19c,null))[_0xd351('0x1f')](function(_0x17d061){if(_0x17d061){_0x18c261['model']=_[_0xd351('0x2e')](db[_0xd351('0x53')]['rawAttributes']);_0x18c261['query']=_[_0xd351('0x2e')](_0x15fcab[_0xd351('0x2d')]);_0x18c261[_0xd351('0x2f')]=_[_0xd351('0x31')](_0x18c261[_0xd351('0x2c')],_0x18c261[_0xd351('0x2d')]);_0x22672[_0xd351('0x30')]=_[_0xd351('0x31')](_0x18c261[_0xd351('0x2c')],qs['fields'](_0x15fcab[_0xd351('0x2d')][_0xd351('0x32')]));_0x22672['attributes']=_0x22672[_0xd351('0x30')]['length']?_0x22672[_0xd351('0x30')]:_0x18c261['model'];if(!_0x15fcab[_0xd351('0x2d')][_0xd351('0x33')](_0xd351('0x34'))){_0x22672[_0xd351('0x17')]=qs[_0xd351('0x17')](_0x15fcab[_0xd351('0x2d')][_0xd351('0x17')]);_0x22672['offset']=qs[_0xd351('0x19')](_0x15fcab[_0xd351('0x2d')][_0xd351('0x19')]);}_0x22672[_0xd351('0x35')]=qs[_0xd351('0x36')](_0x15fcab['query'][_0xd351('0x36')]);_0x22672[_0xd351('0x37')]=qs[_0xd351('0x2f')](_['pick'](_0x15fcab[_0xd351('0x2d')],_0x18c261[_0xd351('0x2f')]));_0x22672[_0xd351('0x37')][_0xd351('0x54')]=_0x17d061['id'];if(_0x15fcab[_0xd351('0x2d')][_0xd351('0x3a')]){_0x22672[_0xd351('0x37')]=_[_0xd351('0x39')](_0x22672[_0xd351('0x37')],{'$or':_['map'](_0x22672[_0xd351('0x30')],function(_0x190a00){var _0x5036e6={};_0x5036e6[_0x190a00]={'$like':'%'+_0x15fcab[_0xd351('0x2d')]['filter']+'%'};return _0x5036e6;})});}_0x22672=_['merge']({},_0x22672,_0x15fcab['options']);return db[_0xd351('0x53')][_0xd351('0x18')]({'where':_0x22672[_0xd351('0x37')]})['then'](function(_0x8f05e7){_0x4d20af['count']=_0x8f05e7;if(_0x15fcab[_0xd351('0x2d')]['includeAll']){_0x22672[_0xd351('0x3d')]=[{'all':!![]}];}return db[_0xd351('0x53')][_0xd351('0x55')](_0x22672);})[_0xd351('0x1f')](function(_0x35b148){_0x4d20af[_0xd351('0x3e')]=_0x35b148;return _0x4d20af;});}})[_0xd351('0x1f')](respondWithFilteredResult(_0x6bf19c,_0x22672))[_0xd351('0x3f')](handleError(_0x6bf19c,null));};exports[_0xd351('0x56')]=function(_0x2e0e2,_0x2fa076,_0x25694a){var _0x5ac63c={'raw':!![],'where':{}};var _0x46f6a7={};var _0xf8befd={'count':0x0,'rows':[]};return db[_0xd351('0x27')][_0xd351('0x52')]({'where':{'id':_0x2e0e2[_0xd351('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2fa076,null))[_0xd351('0x1f')](function(_0x1e6c85){if(_0x1e6c85){_0x46f6a7[_0xd351('0x2c')]=_[_0xd351('0x2e')](db['CmHopperHistory'][_0xd351('0x28')]);_0x46f6a7[_0xd351('0x2d')]=_['keys'](_0x2e0e2[_0xd351('0x2d')]);_0x46f6a7[_0xd351('0x2f')]=_[_0xd351('0x31')](_0x46f6a7[_0xd351('0x2c')],_0x46f6a7['query']);_0x5ac63c['attributes']=_[_0xd351('0x31')](_0x46f6a7[_0xd351('0x2c')],qs[_0xd351('0x32')](_0x2e0e2[_0xd351('0x2d')]['fields']));_0x5ac63c[_0xd351('0x30')]=_0x5ac63c[_0xd351('0x30')][_0xd351('0x41')]?_0x5ac63c[_0xd351('0x30')]:_0x46f6a7[_0xd351('0x2c')];if(!_0x2e0e2['query'][_0xd351('0x33')](_0xd351('0x34'))){_0x5ac63c['limit']=qs[_0xd351('0x17')](_0x2e0e2[_0xd351('0x2d')]['limit']);_0x5ac63c[_0xd351('0x19')]=qs['offset'](_0x2e0e2[_0xd351('0x2d')]['offset']);}_0x5ac63c[_0xd351('0x35')]=qs[_0xd351('0x36')](_0x2e0e2[_0xd351('0x2d')][_0xd351('0x36')]);_0x5ac63c[_0xd351('0x37')]=qs[_0xd351('0x2f')](_[_0xd351('0x38')](_0x2e0e2[_0xd351('0x2d')],_0x46f6a7[_0xd351('0x2f')]));_0x5ac63c['where'][_0xd351('0x54')]=_0x1e6c85['id'];if(_0x2e0e2[_0xd351('0x2d')][_0xd351('0x3a')]){_0x5ac63c[_0xd351('0x37')]=_[_0xd351('0x39')](_0x5ac63c[_0xd351('0x37')],{'$or':_[_0xd351('0x26')](_0x5ac63c[_0xd351('0x30')],function(_0x56458b){var _0x3b8f86={};_0x3b8f86[_0x56458b]={'$like':'%'+_0x2e0e2['query'][_0xd351('0x3a')]+'%'};return _0x3b8f86;})});}_0x5ac63c=_[_0xd351('0x39')]({},_0x5ac63c,_0x2e0e2[_0xd351('0x3b')]);return db[_0xd351('0x57')][_0xd351('0x18')]({'where':_0x5ac63c['where']})[_0xd351('0x1f')](function(_0x1a95ee){_0xf8befd[_0xd351('0x18')]=_0x1a95ee;if(_0x2e0e2[_0xd351('0x2d')][_0xd351('0x3c')]){_0x5ac63c[_0xd351('0x3d')]=[{'all':!![]}];}return db[_0xd351('0x57')][_0xd351('0x55')](_0x5ac63c);})[_0xd351('0x1f')](function(_0x5e439){_0xf8befd[_0xd351('0x3e')]=_0x5e439;return _0xf8befd;});}})[_0xd351('0x1f')](respondWithFilteredResult(_0x2fa076,_0x5ac63c))[_0xd351('0x3f')](handleError(_0x2fa076,null));};exports['getHopperFinals']=function(_0x5eaaa7,_0x230719,_0x4becc0){var _0x5c202f={'raw':!![],'where':{}};var _0x426964={};var _0x4557ed={'count':0x0,'rows':[]};return db[_0xd351('0x27')][_0xd351('0x52')]({'where':{'id':_0x5eaaa7['params']['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x230719,null))['then'](function(_0x47ebca){if(_0x47ebca){_0x426964[_0xd351('0x2c')]=_[_0xd351('0x2e')](db[_0xd351('0x58')][_0xd351('0x28')]);_0x426964[_0xd351('0x2d')]=_[_0xd351('0x2e')](_0x5eaaa7[_0xd351('0x2d')]);_0x426964['filters']=_[_0xd351('0x31')](_0x426964[_0xd351('0x2c')],_0x426964[_0xd351('0x2d')]);_0x5c202f[_0xd351('0x30')]=_[_0xd351('0x31')](_0x426964[_0xd351('0x2c')],qs['fields'](_0x5eaaa7['query'][_0xd351('0x32')]));_0x5c202f['attributes']=_0x5c202f[_0xd351('0x30')][_0xd351('0x41')]?_0x5c202f['attributes']:_0x426964[_0xd351('0x2c')];if(!_0x5eaaa7[_0xd351('0x2d')][_0xd351('0x33')](_0xd351('0x34'))){_0x5c202f[_0xd351('0x17')]=qs['limit'](_0x5eaaa7[_0xd351('0x2d')]['limit']);_0x5c202f[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x5eaaa7['query'][_0xd351('0x19')]);}_0x5c202f[_0xd351('0x35')]=qs[_0xd351('0x36')](_0x5eaaa7[_0xd351('0x2d')]['sort']);_0x5c202f['where']=qs['filters'](_[_0xd351('0x38')](_0x5eaaa7[_0xd351('0x2d')],_0x426964[_0xd351('0x2f')]));_0x5c202f[_0xd351('0x37')][_0xd351('0x54')]=_0x47ebca['id'];if(_0x5eaaa7[_0xd351('0x2d')][_0xd351('0x3a')]){_0x5c202f['where']=_[_0xd351('0x39')](_0x5c202f['where'],{'$or':_[_0xd351('0x26')](_0x5c202f['attributes'],function(_0x4be59d){var _0x3b4eb6={};_0x3b4eb6[_0x4be59d]={'$like':'%'+_0x5eaaa7['query'][_0xd351('0x3a')]+'%'};return _0x3b4eb6;})});}_0x5c202f=_[_0xd351('0x39')]({},_0x5c202f,_0x5eaaa7[_0xd351('0x3b')]);return db[_0xd351('0x58')][_0xd351('0x18')]({'where':_0x5c202f[_0xd351('0x37')]})['then'](function(_0x4ede59){_0x4557ed[_0xd351('0x18')]=_0x4ede59;if(_0x5eaaa7[_0xd351('0x2d')]['includeAll']){_0x5c202f[_0xd351('0x3d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xd351('0x55')](_0x5c202f);})[_0xd351('0x1f')](function(_0x6fd03b){_0x4557ed[_0xd351('0x3e')]=_0x6fd03b;return _0x4557ed;});}})[_0xd351('0x1f')](respondWithFilteredResult(_0x230719,_0x5c202f))['catch'](handleError(_0x230719,null));};exports[_0xd351('0x59')]=function(_0x52220d,_0x581e66,_0x1fe4b3){var _0x338c15={'raw':!![],'where':{}};var _0x1f0538={};var _0x4e98ac={'count':0x0,'rows':[]};return db['Campaign'][_0xd351('0x52')]({'where':{'id':_0x52220d[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x581e66,null))[_0xd351('0x1f')](function(_0x1ddacf){if(_0x1ddacf){_0x1f0538['model']=_[_0xd351('0x2e')](db[_0xd351('0x5a')][_0xd351('0x28')]);_0x1f0538[_0xd351('0x2d')]=_['keys'](_0x52220d[_0xd351('0x2d')]);_0x1f0538[_0xd351('0x2f')]=_['intersection'](_0x1f0538[_0xd351('0x2c')],_0x1f0538[_0xd351('0x2d')]);_0x338c15[_0xd351('0x30')]=_[_0xd351('0x31')](_0x1f0538[_0xd351('0x2c')],qs['fields'](_0x52220d[_0xd351('0x2d')][_0xd351('0x32')]));_0x338c15['attributes']=_0x338c15[_0xd351('0x30')]['length']?_0x338c15[_0xd351('0x30')]:_0x1f0538[_0xd351('0x2c')];if(!_0x52220d['query'][_0xd351('0x33')](_0xd351('0x34'))){_0x338c15[_0xd351('0x17')]=qs[_0xd351('0x17')](_0x52220d[_0xd351('0x2d')]['limit']);_0x338c15[_0xd351('0x19')]=qs['offset'](_0x52220d[_0xd351('0x2d')][_0xd351('0x19')]);}_0x338c15[_0xd351('0x35')]=qs[_0xd351('0x36')](_0x52220d[_0xd351('0x2d')][_0xd351('0x36')]);_0x338c15[_0xd351('0x37')]=qs[_0xd351('0x2f')](_[_0xd351('0x38')](_0x52220d['query'],_0x1f0538[_0xd351('0x2f')]));_0x338c15[_0xd351('0x37')][_0xd351('0x54')]=_0x1ddacf['id'];if(_0x52220d[_0xd351('0x2d')]['filter']){_0x338c15[_0xd351('0x37')]=_['merge'](_0x338c15[_0xd351('0x37')],{'$or':_[_0xd351('0x26')](_0x338c15[_0xd351('0x30')],function(_0x403312){var _0x14703b={};_0x14703b[_0x403312]={'$like':'%'+_0x52220d['query'][_0xd351('0x3a')]+'%'};return _0x14703b;})});}_0x338c15=_[_0xd351('0x39')]({},_0x338c15,_0x52220d['options']);return db['CmHopperBlack'][_0xd351('0x18')]({'where':_0x338c15[_0xd351('0x37')]})[_0xd351('0x1f')](function(_0x3fdf18){_0x4e98ac[_0xd351('0x18')]=_0x3fdf18;if(_0x52220d[_0xd351('0x2d')][_0xd351('0x3c')]){_0x338c15[_0xd351('0x3d')]=[{'all':!![]}];}return db[_0xd351('0x5a')][_0xd351('0x55')](_0x338c15);})[_0xd351('0x1f')](function(_0x6f4c1e){_0x4e98ac[_0xd351('0x3e')]=_0x6f4c1e;return _0x4e98ac;});}})['then'](respondWithFilteredResult(_0x581e66,_0x338c15))['catch'](handleError(_0x581e66,null));};exports[_0xd351('0x5b')]=function(_0x52d5b5,_0x1ca1bd,_0x5c0373){var _0x2c1858={};var _0x18a2cd={};var _0xf1100;var _0x3365ce;return db['Campaign'][_0xd351('0x52')]({'where':{'id':_0x52d5b5[_0xd351('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ca1bd,null))[_0xd351('0x1f')](function(_0x51925a){if(_0x51925a){_0xf1100=_0x51925a;_0x18a2cd['model']=_[_0xd351('0x2e')](db[_0xd351('0x5c')]['rawAttributes']);_0x18a2cd[_0xd351('0x2d')]=_[_0xd351('0x2e')](_0x52d5b5['query']);_0x18a2cd[_0xd351('0x2f')]=_[_0xd351('0x31')](_0x18a2cd[_0xd351('0x2c')],_0x18a2cd[_0xd351('0x2d')]);_0x2c1858[_0xd351('0x30')]=_['intersection'](_0x18a2cd[_0xd351('0x2c')],qs[_0xd351('0x32')](_0x52d5b5[_0xd351('0x2d')][_0xd351('0x32')]));_0x2c1858[_0xd351('0x30')]=_0x2c1858[_0xd351('0x30')][_0xd351('0x41')]?_0x2c1858[_0xd351('0x30')]:_0x18a2cd[_0xd351('0x2c')];_0x2c1858[_0xd351('0x35')]=qs[_0xd351('0x36')](_0x52d5b5[_0xd351('0x2d')][_0xd351('0x36')]);_0x2c1858['where']=qs[_0xd351('0x2f')](_[_0xd351('0x38')](_0x52d5b5[_0xd351('0x2d')],_0x18a2cd[_0xd351('0x2f')]));if(_0x52d5b5[_0xd351('0x2d')][_0xd351('0x3a')]){_0x2c1858[_0xd351('0x37')]=_[_0xd351('0x39')](_0x2c1858[_0xd351('0x37')],{'$or':_[_0xd351('0x26')](_0x2c1858[_0xd351('0x30')],function(_0x9f72e1){var _0x5ef051={};_0x5ef051[_0x9f72e1]={'$like':'%'+_0x52d5b5['query'][_0xd351('0x3a')]+'%'};return _0x5ef051;})});}_0x2c1858=_['merge']({},_0x2c1858,_0x52d5b5['options']);return _0xf1100[_0xd351('0x5b')](_0x2c1858);}})[_0xd351('0x1f')](function(_0x22659f){if(_0x22659f){_0x3365ce=_0x22659f[_0xd351('0x41')];if(!_0x52d5b5['query'][_0xd351('0x33')]('nolimit')){_0x2c1858[_0xd351('0x17')]=qs[_0xd351('0x17')](_0x52d5b5[_0xd351('0x2d')]['limit']);_0x2c1858[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x52d5b5['query']['offset']);}return _0xf1100['getLists'](_0x2c1858);}})[_0xd351('0x1f')](function(_0x45bc42){if(_0x45bc42){return _0x45bc42?{'count':_0x3365ce,'rows':_0x45bc42}:null;}})[_0xd351('0x1f')](respondWithResult(_0x1ca1bd,null))[_0xd351('0x3f')](handleError(_0x1ca1bd,null));};exports[_0xd351('0x5d')]=function(_0x3ce802,_0x2942e0,_0x2f72fb){var _0x575060,_0xea076f;var _0x5f3c4c=[];var _0x2d6e5f=moment()['format'](_0xd351('0x5e'));return db['Campaign'][_0xd351('0x4b')]({'where':{'id':_0x3ce802[_0xd351('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2942e0,null))[_0xd351('0x1f')](function(_0x35ad6d){if(_0x35ad6d){_0xea076f=_0x35ad6d;return _0x35ad6d[_0xd351('0x5d')](_0x3ce802[_0xd351('0x42')][_0xd351('0x5f')],_[_0xd351('0x4c')](_0x3ce802[_0xd351('0x42')],[_0xd351('0x5f'),'id'])||{});}return null;})[_0xd351('0x60')](function(_0x1c0290){var _0x413163;var _0x3425c5;_0x575060=_0x1c0290||[];var _0x2d3695=[];if(_0x1c0290){for(var _0x1e14ec=0x0;_0x1e14ec<_0x1c0290[_0xd351('0x41')];_0x1e14ec+=0x1){var _0x228325=_0x1c0290[_0x1e14ec][_0xd351('0x20')]({'plain':!![]});_0xea076f['dialCheckDuplicateType']=_0x3ce802['body'][_0xd351('0x61')]?_0x3ce802['body'][_0xd351('0x61')]:_0xea076f[_0xd351('0x61')];switch(_0xea076f[_0xd351('0x61')]){case _0xd351('0x62'):_0x413163=squel[_0xd351('0x63')]()[_0xd351('0x64')](_0xd351('0x65'))[_0xd351('0x66')]([_0xd351('0x67'),'scheduledAt','ContactId','ListId','CampaignId',_0xd351('0x4d'),_0xd351('0x4e')],squel[_0xd351('0x68')]()[_0xd351('0x69')](_0xd351('0x67'),_0xd351('0x67'))['field'](_0xd351('0x6a'),_0xd351('0x6b'))[_0xd351('0x69')]('id',_0xd351('0x6c'))['field'](_0x228325[_0xd351('0x6d')]['toString'](),_0xd351('0x6e'))[_0xd351('0x69')](_0x3ce802[_0xd351('0x4a')]['id'][_0xd351('0x6f')](),_0xd351('0x54'))['field']('\x27'+_0x2d6e5f+'\x27',_0xd351('0x4d'))[_0xd351('0x69')]('\x27'+_0x2d6e5f+'\x27',_0xd351('0x4e'))['from']('cm_contacts')[_0xd351('0x37')]('deletedAt\x20IS\x20NULL')['where'](_0xd351('0x70'),_0x228325[_0xd351('0x6d')][_0xd351('0x6f')]())[_0xd351('0x37')](_0xd351('0x71'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xd351('0x69')]('COALESCE(calleridnum,\x27\x27)')[_0xd351('0x72')](_0xd351('0x73'))[_0xd351('0x37')](_0xd351('0x74'),_0x3ce802[_0xd351('0x4a')]['id'][_0xd351('0x6f')]()))[_0xd351('0x37')](_0xd351('0x75'),squel[_0xd351('0x68')]()[_0xd351('0x69')](_0xd351('0x76'))[_0xd351('0x72')](_0xd351('0x65'))[_0xd351('0x37')](_0xd351('0x74'),_0x3ce802[_0xd351('0x4a')]['id']['toString']())))[_0xd351('0x6f')]();break;case _0xd351('0x77'):_0x413163=squel['insert']()[_0xd351('0x64')](_0xd351('0x65'))['fromQuery']([_0xd351('0x67'),_0xd351('0x6b'),_0xd351('0x6c'),_0xd351('0x6e'),_0xd351('0x54'),_0xd351('0x4d'),_0xd351('0x4e')],squel[_0xd351('0x68')]()[_0xd351('0x69')](_0xd351('0x67'),_0xd351('0x67'))[_0xd351('0x69')]('NOW()',_0xd351('0x6b'))[_0xd351('0x69')]('id','ContactId')['field'](_0x228325[_0xd351('0x6d')][_0xd351('0x6f')](),'ListId')[_0xd351('0x69')](_0x3ce802['params']['id'][_0xd351('0x6f')](),_0xd351('0x54'))['field']('\x27'+_0x2d6e5f+'\x27',_0xd351('0x4d'))[_0xd351('0x69')]('\x27'+_0x2d6e5f+'\x27',_0xd351('0x4e'))[_0xd351('0x72')](_0xd351('0x78'))[_0xd351('0x37')](_0xd351('0x79'))[_0xd351('0x37')](_0xd351('0x70'),_0x228325[_0xd351('0x6d')]['toString']())['where'](_0xd351('0x71'))[_0xd351('0x37')]('phone\x20NOT\x20IN\x20(?)',squel[_0xd351('0x68')]()[_0xd351('0x69')](_0xd351('0x76'))[_0xd351('0x72')](_0xd351('0x65'))[_0xd351('0x37')]('CampaignId\x20=\x20?',_0x3ce802[_0xd351('0x4a')]['id'][_0xd351('0x6f')]())))['toString']();break;default:_0x413163=squel[_0xd351('0x63')]()[_0xd351('0x64')]('cm_hopper')[_0xd351('0x66')]([_0xd351('0x67'),_0xd351('0x6b'),_0xd351('0x6c'),_0xd351('0x6e'),_0xd351('0x54'),'createdAt',_0xd351('0x4e')],squel[_0xd351('0x68')]()[_0xd351('0x69')](_0xd351('0x67'),_0xd351('0x67'))['field'](_0xd351('0x6a'),'scheduledAt')['field']('id','ContactId')[_0xd351('0x69')](_0x228325['CmListId'][_0xd351('0x6f')](),_0xd351('0x6e'))[_0xd351('0x69')](_0x3ce802[_0xd351('0x4a')]['id'][_0xd351('0x6f')](),_0xd351('0x54'))[_0xd351('0x69')]('\x27'+_0x2d6e5f+'\x27',_0xd351('0x4d'))[_0xd351('0x69')]('\x27'+_0x2d6e5f+'\x27',_0xd351('0x4e'))[_0xd351('0x72')](_0xd351('0x78'))[_0xd351('0x37')](_0xd351('0x79'))[_0xd351('0x37')]('ListId\x20=\x20?',_0x228325[_0xd351('0x6d')][_0xd351('0x6f')]())[_0xd351('0x37')](_0xd351('0x71')))[_0xd351('0x6f')]();}_0x3425c5=squel[_0xd351('0x63')]()['into'](_0xd351('0x7a'))[_0xd351('0x66')]([_0xd351('0x7b'),_0xd351('0x6b'),_0xd351('0x67'),'OrderBy',_0xd351('0x4d'),_0xd351('0x4e')],squel[_0xd351('0x68')]()[_0xd351('0x69')](_0xd351('0x7c'),'id')['field'](_0xd351('0x6a'),_0xd351('0x6b'))[_0xd351('0x69')](_0xd351('0x7d'),_0xd351('0x67'))[_0xd351('0x69')](_0xd351('0x7e'),_0xd351('0x7f'))[_0xd351('0x69')]('\x27'+_0x2d6e5f+'\x27',_0xd351('0x4d'))[_0xd351('0x69')]('\x27'+_0x2d6e5f+'\x27',_0xd351('0x4e'))[_0xd351('0x72')]('cm_contact_has_items','ci')['join'](_0xd351('0x65'),'h',_0xd351('0x80'))[_0xd351('0x37')](_0xd351('0x81'),_0x228325[_0xd351('0x6d')][_0xd351('0x6f')]())[_0xd351('0x37')](_0xd351('0x82'),_0x3ce802['params']['id'][_0xd351('0x6f')]())['where'](_0xd351('0x83'),_0x2d6e5f))['toString']();_0x2d3695[_0xd351('0x84')](db[_0xd351('0x85')][_0xd351('0x2d')](_0x413163));_0x5f3c4c[_0xd351('0x84')](db['sequelize'][_0xd351('0x2d')](_0x3425c5));}return BPromise[_0xd351('0x86')](_0x2d3695);}})[_0xd351('0x1f')](function(){return BPromise[_0xd351('0x86')](_0x5f3c4c);})[_0xd351('0x1f')](function(){return _0x575060;})[_0xd351('0x1f')](respondWithResult(_0x2942e0,null))[_0xd351('0x3f')](handleError(_0x2942e0,null));};exports[_0xd351('0x87')]=function(_0x531c99,_0x573d5f,_0x533d01){return db[_0xd351('0x27')][_0xd351('0x4b')]({'where':{'id':_0x531c99[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x573d5f,null))[_0xd351('0x1f')](function(_0x2fcbba){if(_0x2fcbba){return _0x2fcbba[_0xd351('0x87')](_0x531c99['query'][_0xd351('0x5f')]);}})['then'](function(_0x37617d){if(_0x37617d){return db[_0xd351('0x53')]['destroy']({'where':{'ListId':_0x531c99['query'][_0xd351('0x5f')],'CampaignId':_0x531c99[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](function(){return _0x37617d;});}})['then'](respondWithStatusCode(_0x573d5f,null))['catch'](handleError(_0x573d5f,null));};exports[_0xd351('0x88')]=function(_0x35342a,_0x1b0faa,_0xd7a147){var _0x337625={};var _0x1b6432={};var _0x33928a;var _0xfba712;return db['Campaign']['findOne']({'where':{'id':_0x35342a[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x1b0faa,null))[_0xd351('0x1f')](function(_0x2db37e){if(_0x2db37e){_0x33928a=_0x2db37e;_0x1b6432['model']=_[_0xd351('0x2e')](db['CmList'][_0xd351('0x28')]);_0x1b6432[_0xd351('0x2d')]=_[_0xd351('0x2e')](_0x35342a[_0xd351('0x2d')]);_0x1b6432[_0xd351('0x2f')]=_[_0xd351('0x31')](_0x1b6432[_0xd351('0x2c')],_0x1b6432[_0xd351('0x2d')]);_0x337625[_0xd351('0x30')]=_[_0xd351('0x31')](_0x1b6432[_0xd351('0x2c')],qs[_0xd351('0x32')](_0x35342a[_0xd351('0x2d')][_0xd351('0x32')]));_0x337625[_0xd351('0x30')]=_0x337625[_0xd351('0x30')]['length']?_0x337625['attributes']:_0x1b6432[_0xd351('0x2c')];_0x337625[_0xd351('0x35')]=qs[_0xd351('0x36')](_0x35342a['query'][_0xd351('0x36')]);_0x337625[_0xd351('0x37')]=qs[_0xd351('0x2f')](_[_0xd351('0x38')](_0x35342a[_0xd351('0x2d')],_0x1b6432[_0xd351('0x2f')]));if(_0x35342a[_0xd351('0x2d')]['filter']){_0x337625['where']=_[_0xd351('0x39')](_0x337625[_0xd351('0x37')],{'$or':_[_0xd351('0x26')](_0x337625[_0xd351('0x30')],function(_0x37ed3a){var _0x1768e9={};_0x1768e9[_0x37ed3a]={'$like':'%'+_0x35342a[_0xd351('0x2d')]['filter']+'%'};return _0x1768e9;})});}_0x337625=_['merge']({},_0x337625,_0x35342a[_0xd351('0x3b')]);return _0x33928a[_0xd351('0x88')](_0x337625);}})[_0xd351('0x1f')](function(_0x32ff27){if(_0x32ff27){_0xfba712=_0x32ff27['length'];if(!_0x35342a['query'][_0xd351('0x33')]('nolimit')){_0x337625[_0xd351('0x17')]=qs[_0xd351('0x17')](_0x35342a[_0xd351('0x2d')][_0xd351('0x17')]);_0x337625[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x35342a['query'][_0xd351('0x19')]);}return _0x33928a[_0xd351('0x88')](_0x337625);}})['then'](function(_0x3152b0){if(_0x3152b0){return _0x3152b0?{'count':_0xfba712,'rows':_0x3152b0}:null;}})[_0xd351('0x1f')](respondWithResult(_0x1b0faa,null))[_0xd351('0x3f')](handleError(_0x1b0faa,null));};exports[_0xd351('0x89')]=function(_0x5cde55,_0x1cab71,_0x1fb798){var _0x3184d5,_0x6bfc11;var _0x5be410=[];var _0x2f0107=moment()[_0xd351('0x8a')](_0xd351('0x5e'));return db[_0xd351('0x27')][_0xd351('0x4b')]({'where':{'id':_0x5cde55['params']['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x1cab71,null))['then'](function(_0x52f5a4){if(_0x52f5a4){_0x6bfc11=_0x52f5a4;return _0x52f5a4[_0xd351('0x89')](_0x5cde55[_0xd351('0x42')][_0xd351('0x5f')],_[_0xd351('0x4c')](_0x5cde55[_0xd351('0x42')],[_0xd351('0x5f'),'id'])||{});}return null;})['spread'](function(_0x18f942){var _0x2af57a;var _0x4bfaa8;_0x3184d5=_0x18f942||[];var _0x4a604c=[];if(_0x18f942){for(var _0x2bc5e7=0x0;_0x2bc5e7<_0x18f942['length'];_0x2bc5e7+=0x1){var _0x5e60e2=_0x18f942[_0x2bc5e7]['get']({'plain':!![]});_0x2af57a=squel[_0xd351('0x63')]()[_0xd351('0x64')](_0xd351('0x8b'))[_0xd351('0x66')]([_0xd351('0x67'),_0xd351('0x6c'),'ListId',_0xd351('0x54'),'createdAt',_0xd351('0x4e')],squel[_0xd351('0x68')]()[_0xd351('0x69')](_0xd351('0x67'),_0xd351('0x67'))[_0xd351('0x69')]('id',_0xd351('0x6c'))['field'](_0x5e60e2[_0xd351('0x6d')]['toString'](),_0xd351('0x6e'))[_0xd351('0x69')](_0x5cde55['params']['id']['toString'](),_0xd351('0x54'))[_0xd351('0x69')]('NOW()',_0xd351('0x4d'))[_0xd351('0x69')](_0xd351('0x6a'),'updatedAt')[_0xd351('0x72')](_0xd351('0x78'))[_0xd351('0x37')]('deletedAt\x20IS\x20NULL')[_0xd351('0x37')]('ListId\x20=\x20?',_0x5e60e2[_0xd351('0x6d')][_0xd351('0x6f')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xd351('0x6f')]();_0x4a604c[_0xd351('0x84')](db['sequelize'][_0xd351('0x2d')](_0x2af57a));}return BPromise[_0xd351('0x86')](_0x4a604c);}})[_0xd351('0x1f')](function(){return _0x3184d5;})[_0xd351('0x1f')](respondWithResult(_0x1cab71,null))[_0xd351('0x3f')](handleError(_0x1cab71,null));};exports[_0xd351('0x8c')]=function(_0x2fd44b,_0x4f5fef,_0x54a8be){return db[_0xd351('0x27')][_0xd351('0x4b')]({'where':{'id':_0x2fd44b[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x4f5fef,null))['then'](function(_0x575347){if(_0x575347){return _0x575347[_0xd351('0x8c')](_0x2fd44b[_0xd351('0x2d')][_0xd351('0x5f')]);}})[_0xd351('0x1f')](function(_0xd0834c){if(_0xd0834c){return db[_0xd351('0x5a')][_0xd351('0x1e')]({'where':{'ListId':_0x2fd44b[_0xd351('0x2d')][_0xd351('0x5f')],'CampaignId':_0x2fd44b[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](function(){return _0xd0834c;});}})['then'](respondWithStatusCode(_0x4f5fef,null))[_0xd351('0x3f')](handleError(_0x4f5fef,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 36a38fb..351be69 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(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index e382ccd..d7969a5 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 _0xe3ed=['code','message','info','catch','GetCampaign','options','raw','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0xe3ed,0x8d));var _0xde3e=function(_0x3a341a,_0x4058c4){_0x3a341a=_0x3a341a-0x0;var _0x142b47=_0xe3ed[_0x3a341a];return _0x142b47;};'use strict';var _=require(_0xde3e('0x0'));var util=require(_0xde3e('0x1'));var moment=require(_0xde3e('0x2'));var BPromise=require(_0xde3e('0x3'));var rs=require(_0xde3e('0x4'));var fs=require('fs');var Redis=require(_0xde3e('0x5'));var db=require(_0xde3e('0x6'))['db'];var utils=require(_0xde3e('0x7'));var logger=require('../../config/logger')(_0xde3e('0x8'));var config=require(_0xde3e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xde3e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x184b02,_0x4c4ac6,_0x47e97f){return new BPromise(function(_0x3e0bb4,_0x3b1597){return client[_0xde3e('0xb')](_0x184b02,_0x47e97f)[_0xde3e('0xc')](function(_0x76daf5){logger['info'](_0xde3e('0xd'),_0x4c4ac6,_0xde3e('0xe'));logger[_0xde3e('0xf')](_0xde3e('0x10'),_0x4c4ac6,'request\x20sent',JSON[_0xde3e('0x11')](_0x76daf5));if(_0x76daf5[_0xde3e('0x12')]){if(_0x76daf5['error'][_0xde3e('0x13')]===0x1f4){logger[_0xde3e('0x12')]('Campaign,\x20%s,\x20%s',_0x4c4ac6,_0x76daf5[_0xde3e('0x12')]['message']);return _0x3b1597(_0x76daf5[_0xde3e('0x12')][_0xde3e('0x14')]);}logger[_0xde3e('0x12')]('Campaign,\x20%s,\x20%s',_0x4c4ac6,_0x76daf5[_0xde3e('0x12')][_0xde3e('0x14')]);return _0x3e0bb4(_0x76daf5['error']['message']);}else{logger[_0xde3e('0x15')](_0xde3e('0xd'),_0x4c4ac6,_0xde3e('0xe'));_0x3e0bb4(_0x76daf5['result']['message']);}})[_0xde3e('0x16')](function(_0x5e041a){logger['error'](_0xde3e('0xd'),_0x4c4ac6,_0x5e041a);_0x3b1597(_0x5e041a);});});}exports[_0xde3e('0x17')]=function(_0x4aa02c){var _0x460d69=this;return new Promise(function(_0x276e83,_0x264603){return db['Campaign']['findAll']({'raw':_0x4aa02c['options']?_0x4aa02c[_0xde3e('0x18')][_0xde3e('0x19')]===undefined?!![]:![]:!![],'where':_0x4aa02c[_0xde3e('0x18')]?_0x4aa02c['options'][_0xde3e('0x1a')]||null:null,'attributes':_0x4aa02c[_0xde3e('0x18')]?_0x4aa02c[_0xde3e('0x18')][_0xde3e('0x1b')]||null:null,'limit':_0x4aa02c[_0xde3e('0x18')]?_0x4aa02c[_0xde3e('0x18')][_0xde3e('0x1c')]||null:null,'include':_0x4aa02c[_0xde3e('0x18')]?_0x4aa02c[_0xde3e('0x18')]['include']?_[_0xde3e('0x1d')](_0x4aa02c[_0xde3e('0x18')][_0xde3e('0x1e')],function(_0x57df9e){return{'model':db[_0x57df9e[_0xde3e('0x1f')]],'as':_0x57df9e['as'],'attributes':_0x57df9e[_0xde3e('0x1b')],'include':_0x57df9e[_0xde3e('0x1e')]?_['map'](_0x57df9e[_0xde3e('0x1e')],function(_0x78647){return{'model':db[_0x78647[_0xde3e('0x1f')]],'as':_0x78647['as'],'attributes':_0x78647[_0xde3e('0x1b')],'include':_0x78647[_0xde3e('0x1e')]?_['map'](_0x78647['include'],function(_0x6c0db0){return{'model':db[_0x6c0db0[_0xde3e('0x1f')]],'as':_0x6c0db0['as'],'attributes':_0x6c0db0[_0xde3e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d1404){logger[_0xde3e('0x15')]('GetCampaign',_0x4aa02c);logger['debug'](_0xde3e('0x17'),_0x4aa02c,JSON[_0xde3e('0x11')](_0x3d1404));_0x276e83(_0x3d1404);})['catch'](function(_0x2e4c62){logger[_0xde3e('0x12')](_0xde3e('0x17'),_0x2e4c62['message'],_0x4aa02c);_0x264603(_0x460d69['error'](0x1f4,_0x2e4c62[_0xde3e('0x14')]));});});}; \ No newline at end of file +var _0xb7cf=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','debug','stringify','error','code','message','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','lodash','util'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xb7cf,0xca));var _0xfb7c=function(_0x540178,_0x1feb3d){_0x540178=_0x540178-0x0;var _0x58a85c=_0xb7cf[_0x540178];return _0x58a85c;};'use strict';var _=require(_0xfb7c('0x0'));var util=require(_0xfb7c('0x1'));var moment=require(_0xfb7c('0x2'));var BPromise=require(_0xfb7c('0x3'));var rs=require(_0xfb7c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb7c('0x5'))['db'];var utils=require(_0xfb7c('0x6'));var logger=require(_0xfb7c('0x7'))(_0xfb7c('0x8'));var config=require(_0xfb7c('0x9'));var jayson=require(_0xfb7c('0xa'));var client=jayson[_0xfb7c('0xb')][_0xfb7c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41dcce,_0x2fd757,_0x3c21f3){return new BPromise(function(_0x34b889,_0x289874){return client[_0xfb7c('0xd')](_0x41dcce,_0x3c21f3)['then'](function(_0x13dcc3){logger[_0xfb7c('0xe')](_0xfb7c('0xf'),_0x2fd757,'request\x20sent');logger[_0xfb7c('0x10')]('Campaign,\x20%s,\x20%s,\x20%s',_0x2fd757,'request\x20sent',JSON[_0xfb7c('0x11')](_0x13dcc3));if(_0x13dcc3[_0xfb7c('0x12')]){if(_0x13dcc3[_0xfb7c('0x12')][_0xfb7c('0x13')]===0x1f4){logger[_0xfb7c('0x12')](_0xfb7c('0xf'),_0x2fd757,_0x13dcc3[_0xfb7c('0x12')][_0xfb7c('0x14')]);return _0x289874(_0x13dcc3['error'][_0xfb7c('0x14')]);}logger[_0xfb7c('0x12')]('Campaign,\x20%s,\x20%s',_0x2fd757,_0x13dcc3[_0xfb7c('0x12')][_0xfb7c('0x14')]);return _0x34b889(_0x13dcc3[_0xfb7c('0x12')][_0xfb7c('0x14')]);}else{logger[_0xfb7c('0xe')](_0xfb7c('0xf'),_0x2fd757,'request\x20sent');_0x34b889(_0x13dcc3['result'][_0xfb7c('0x14')]);}})['catch'](function(_0xa66d3a){logger[_0xfb7c('0x12')](_0xfb7c('0xf'),_0x2fd757,_0xa66d3a);_0x289874(_0xa66d3a);});});}exports[_0xfb7c('0x15')]=function(_0x493d7b){var _0x20115a=this;return new Promise(function(_0x4f0c3b,_0xa29a57){return db[_0xfb7c('0x16')][_0xfb7c('0x17')]({'raw':_0x493d7b[_0xfb7c('0x18')]?_0x493d7b[_0xfb7c('0x18')][_0xfb7c('0x19')]===undefined?!![]:![]:!![],'where':_0x493d7b[_0xfb7c('0x18')]?_0x493d7b['options'][_0xfb7c('0x1a')]||null:null,'attributes':_0x493d7b['options']?_0x493d7b[_0xfb7c('0x18')][_0xfb7c('0x1b')]||null:null,'limit':_0x493d7b[_0xfb7c('0x18')]?_0x493d7b[_0xfb7c('0x18')][_0xfb7c('0x1c')]||null:null,'include':_0x493d7b[_0xfb7c('0x18')]?_0x493d7b[_0xfb7c('0x18')][_0xfb7c('0x1d')]?_[_0xfb7c('0x1e')](_0x493d7b['options'][_0xfb7c('0x1d')],function(_0x4b1598){return{'model':db[_0x4b1598['model']],'as':_0x4b1598['as'],'attributes':_0x4b1598[_0xfb7c('0x1b')],'include':_0x4b1598[_0xfb7c('0x1d')]?_['map'](_0x4b1598[_0xfb7c('0x1d')],function(_0x4fcb72){return{'model':db[_0x4fcb72['model']],'as':_0x4fcb72['as'],'attributes':_0x4fcb72[_0xfb7c('0x1b')],'include':_0x4fcb72[_0xfb7c('0x1d')]?_[_0xfb7c('0x1e')](_0x4fcb72[_0xfb7c('0x1d')],function(_0x7a795){return{'model':db[_0x7a795[_0xfb7c('0x1f')]],'as':_0x7a795['as'],'attributes':_0x7a795[_0xfb7c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfb7c('0x20')](function(_0x5f2229){logger[_0xfb7c('0xe')](_0xfb7c('0x15'),_0x493d7b);logger[_0xfb7c('0x10')]('GetCampaign',_0x493d7b,JSON['stringify'](_0x5f2229));_0x4f0c3b(_0x5f2229);})[_0xfb7c('0x21')](function(_0x4d3029){logger['error']('GetCampaign',_0x4d3029[_0xfb7c('0x14')],_0x493d7b);_0xa29a57(_0x20115a[_0xfb7c('0x12')](0x1f4,_0x4d3029[_0xfb7c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 5688765..731052f 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 _0x201d=['/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','clone','addLists','update','delete','destroy','removeLists','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','get','/:id','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x201d,0xd2));var _0xd201=function(_0x384b33,_0x46d914){_0x384b33=_0x384b33-0x0;var _0x1fe5df=_0x201d[_0x384b33];return _0x1fe5df;};'use strict';var multer=require(_0xd201('0x0'));var util=require('util');var path=require(_0xd201('0x1'));var timeout=require(_0xd201('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd201('0x3'));var interaction=require(_0xd201('0x4'));var config=require('../../config/environment');var controller=require(_0xd201('0x5'));router['get']('/',auth[_0xd201('0x6')](),controller['index']);router[_0xd201('0x7')](_0xd201('0x8'),auth[_0xd201('0x6')](),controller['show']);router['get'](_0xd201('0x9'),auth['isAuthenticated'](),controller[_0xd201('0xa')]);router[_0xd201('0x7')]('/:id/hopper_histories',auth[_0xd201('0x6')](),controller[_0xd201('0xb')]);router[_0xd201('0x7')](_0xd201('0xc'),auth[_0xd201('0x6')](),controller[_0xd201('0xd')]);router[_0xd201('0x7')](_0xd201('0xe'),auth[_0xd201('0x6')](),controller[_0xd201('0xf')]);router[_0xd201('0x7')](_0xd201('0x10'),auth[_0xd201('0x6')](),controller[_0xd201('0x11')]);router[_0xd201('0x7')](_0xd201('0x12'),auth[_0xd201('0x6')](),controller['getBlackLists']);router[_0xd201('0x13')]('/',auth[_0xd201('0x6')](),controller['create']);router[_0xd201('0x13')](_0xd201('0x14'),auth['isAuthenticated'](),controller[_0xd201('0x15')]);router[_0xd201('0x13')](_0xd201('0x10'),auth[_0xd201('0x6')](),controller[_0xd201('0x16')]);router['post'](_0xd201('0x12'),auth[_0xd201('0x6')](),controller['addBlackLists']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd201('0x17')]);router[_0xd201('0x18')](_0xd201('0x8'),auth[_0xd201('0x6')](),controller[_0xd201('0x19')]);router[_0xd201('0x18')](_0xd201('0x10'),auth[_0xd201('0x6')](),controller[_0xd201('0x1a')]);router[_0xd201('0x18')](_0xd201('0x12'),auth[_0xd201('0x6')](),controller['removeBlackLists']);module[_0xd201('0x1b')]=router; \ No newline at end of file +var _0xa78e=['isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addLists','addBlackLists','put','update','destroy','delete','removeLists','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xa78e,0x1e1));var _0xea78=function(_0x1ed0ad,_0x40d811){_0x1ed0ad=_0x1ed0ad-0x0;var _0x38263b=_0xa78e[_0x1ed0ad];return _0x38263b;};'use strict';var multer=require(_0xea78('0x0'));var util=require(_0xea78('0x1'));var path=require(_0xea78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xea78('0x3')]();var fs_extra=require(_0xea78('0x4'));var auth=require(_0xea78('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea78('0x6'));var controller=require(_0xea78('0x7'));router[_0xea78('0x8')]('/',auth[_0xea78('0x9')](),controller[_0xea78('0xa')]);router['get'](_0xea78('0xb'),auth['isAuthenticated'](),controller[_0xea78('0xc')]);router['get']('/:id/hoppers',auth[_0xea78('0x9')](),controller[_0xea78('0xd')]);router[_0xea78('0x8')](_0xea78('0xe'),auth[_0xea78('0x9')](),controller[_0xea78('0xf')]);router['get'](_0xea78('0x10'),auth['isAuthenticated'](),controller[_0xea78('0x11')]);router[_0xea78('0x8')](_0xea78('0x12'),auth[_0xea78('0x9')](),controller[_0xea78('0x13')]);router[_0xea78('0x8')](_0xea78('0x14'),auth['isAuthenticated'](),controller[_0xea78('0x15')]);router[_0xea78('0x8')](_0xea78('0x16'),auth[_0xea78('0x9')](),controller[_0xea78('0x17')]);router[_0xea78('0x18')]('/',auth['isAuthenticated'](),controller[_0xea78('0x19')]);router[_0xea78('0x18')](_0xea78('0x1a'),auth[_0xea78('0x9')](),controller['clone']);router[_0xea78('0x18')]('/:id/lists',auth['isAuthenticated'](),controller[_0xea78('0x1b')]);router[_0xea78('0x18')]('/:id/blacklists',auth[_0xea78('0x9')](),controller[_0xea78('0x1c')]);router[_0xea78('0x1d')](_0xea78('0xb'),auth['isAuthenticated'](),controller[_0xea78('0x1e')]);router['delete'](_0xea78('0xb'),auth[_0xea78('0x9')](),controller[_0xea78('0x1f')]);router[_0xea78('0x20')]('/:id/lists',auth[_0xea78('0x9')](),controller[_0xea78('0x21')]);router[_0xea78('0x20')](_0xea78('0x16'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xea78('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 66ea7c0..a13f379 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 _0x6d52=['TEXT','medium','STRING','VIRTUAL','getDataValue','key','sequelize'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x6d52,0xca));var _0x26d5=function(_0x571d8c,_0x4eb9d7){_0x571d8c=_0x571d8c-0x0;var _0x5d32d7=_0x6d52[_0x571d8c];return _0x5d32d7;};'use strict';var Sequelize=require(_0x26d5('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x26d5('0x1')],'length':_0x26d5('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x26d5('0x3')]},'name':{'type':Sequelize[_0x26d5('0x4')],'get':function(){return this[_0x26d5('0x5')](_0x26d5('0x6'));}}}; \ No newline at end of file +var _0xbc2d=['STRING','medium','VIRTUAL','getDataValue','key','sequelize'];(function(_0x54db09,_0x1e4e6b){var _0x40e28e=function(_0x309ba5){while(--_0x309ba5){_0x54db09['push'](_0x54db09['shift']());}};_0x40e28e(++_0x1e4e6b);}(_0xbc2d,0x83));var _0xdbc2=function(_0xf81ba7,_0x3c1adf){_0xf81ba7=_0xf81ba7-0x0;var _0x1a88df=_0xbc2d[_0xf81ba7];return _0x1a88df;};'use strict';var Sequelize=require(_0xdbc2('0x0'));module['exports']={'key':{'type':Sequelize[_0xdbc2('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0xdbc2('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xdbc2('0x1')]},'name':{'type':Sequelize[_0xdbc2('0x3')],'get':function(){return this[_0xdbc2('0x4')](_0xdbc2('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index a800c0b..1fdba80 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 _0x9791=['attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','keys','find','catch','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','filters','intersection'];(function(_0x46527b,_0x4faf52){var _0x3cac19=function(_0x2c70bb){while(--_0x2c70bb){_0x46527b['push'](_0x46527b['shift']());}};_0x3cac19(++_0x4faf52);}(_0x9791,0x180));var _0x1979=function(_0x5e90e3,_0x37a3cf){_0x5e90e3=_0x5e90e3-0x0;var _0x487022=_0x9791[_0x5e90e3];return _0x487022;};'use strict';var emlformat=require(_0x1979('0x0'));var rimraf=require(_0x1979('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1979('0x2'));var rp=require(_0x1979('0x3'));var moment=require(_0x1979('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1979('0x5'));var sox=require(_0x1979('0x6'));var csv=require(_0x1979('0x7'));var ejs=require(_0x1979('0x8'));var fs=require('fs');var fs_extra=require(_0x1979('0x9'));var _=require(_0x1979('0xa'));var squel=require(_0x1979('0xb'));var crypto=require(_0x1979('0xc'));var jsforce=require(_0x1979('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1979('0x7'));var querystring=require(_0x1979('0xe'));var Papa=require('papaparse');var Redis=require(_0x1979('0xf'));var authService=require(_0x1979('0x10'));var qs=require(_0x1979('0x11'));var as=require(_0x1979('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1979('0x13'))(_0x1979('0x14'));var utils=require(_0x1979('0x15'));var config=require(_0x1979('0x16'));var licenseUtil=require(_0x1979('0x17'));var db=require(_0x1979('0x18'))['db'];function respondWithStatusCode(_0x5c6c61,_0x19ad1a){_0x19ad1a=_0x19ad1a||0xcc;return function(_0x1b5850){if(_0x1b5850){return _0x5c6c61[_0x1979('0x19')](_0x19ad1a);}return _0x5c6c61[_0x1979('0x1a')](_0x19ad1a)[_0x1979('0x1b')]();};}function respondWithResult(_0x3505d7,_0x242318){_0x242318=_0x242318||0xc8;return function(_0x3f3629){if(_0x3f3629){return _0x3505d7[_0x1979('0x1a')](_0x242318)[_0x1979('0x1c')](_0x3f3629);}};}function respondWithFilteredResult(_0x2a009f,_0x2bf564){return function(_0x2c896b){if(_0x2c896b){var _0xe70144=typeof _0x2bf564['offset']===_0x1979('0x1d')&&typeof _0x2bf564[_0x1979('0x1e')]===_0x1979('0x1d');var _0x529904=_0x2c896b[_0x1979('0x1f')];var _0x4af683=_0xe70144?0x0:_0x2bf564[_0x1979('0x20')];var _0xc9c574=_0xe70144?_0x2c896b[_0x1979('0x1f')]:_0x2bf564[_0x1979('0x20')]+_0x2bf564[_0x1979('0x1e')];var _0x5c4129;if(_0xc9c574>=_0x529904){_0xc9c574=_0x529904;_0x5c4129=0xc8;}else{_0x5c4129=0xce;}_0x2a009f['status'](_0x5c4129);return _0x2a009f['set'](_0x1979('0x21'),_0x4af683+'-'+_0xc9c574+'/'+_0x529904)[_0x1979('0x1c')](_0x2c896b);}return null;};}function patchUpdates(_0x1b326a){return function(_0x55d3ac){try{jsonpatch['apply'](_0x55d3ac,_0x1b326a,!![]);}catch(_0x44d560){return BPromise['reject'](_0x44d560);}return _0x55d3ac[_0x1979('0x22')]();};}function saveUpdates(_0x3ebc59,_0x1b46cf){return function(_0x19cb99){if(_0x19cb99){return _0x19cb99[_0x1979('0x23')](_0x3ebc59)[_0x1979('0x24')](function(_0x355892){return _0x355892;});}return null;};}function removeEntity(_0x446251,_0x1d757b){return function(_0x48dc67){if(_0x48dc67){return _0x48dc67[_0x1979('0x25')]()[_0x1979('0x24')](function(){var _0xaf1c18=_0x48dc67[_0x1979('0x26')]({'plain':!![]});var _0x1f9327=_0x1979('0x27');return db[_0x1979('0x28')][_0x1979('0x25')]({'where':{'type':_0x1f9327,'resourceId':_0xaf1c18['id']}})[_0x1979('0x24')](function(){return _0x48dc67;});})[_0x1979('0x24')](function(){_0x446251[_0x1979('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x65556c,_0x577070){return function(_0x3899f1){if(!_0x3899f1){_0x65556c['sendStatus'](0x194);}return _0x3899f1;};}function handleError(_0xbb9687,_0x5faf67){_0x5faf67=_0x5faf67||0x1f4;return function(_0x2fb2eb){logger[_0x1979('0x29')](_0x2fb2eb[_0x1979('0x2a')]);if(_0x2fb2eb[_0x1979('0x2b')]){delete _0x2fb2eb[_0x1979('0x2b')];}_0xbb9687[_0x1979('0x1a')](_0x5faf67)[_0x1979('0x2c')](_0x2fb2eb);};}exports[_0x1979('0x2d')]=function(_0xf8795,_0x1e5f2f){var _0x2e9128={},_0x3d89a9={},_0x21d34f={'count':0x0,'rows':[]};var _0x4e8b6a=_['map'](db[_0x1979('0x2e')][_0x1979('0x2f')],function(_0x57bd90){return{'name':_0x57bd90[_0x1979('0x30')],'type':_0x57bd90[_0x1979('0x31')][_0x1979('0x32')]};});_0x3d89a9[_0x1979('0x33')]=_[_0x1979('0x34')](_0x4e8b6a,_0x1979('0x2b'));_0x3d89a9[_0x1979('0x35')]=_['keys'](_0xf8795[_0x1979('0x35')]);_0x3d89a9[_0x1979('0x36')]=_[_0x1979('0x37')](_0x3d89a9[_0x1979('0x33')],_0x3d89a9[_0x1979('0x35')]);_0x2e9128[_0x1979('0x38')]=_[_0x1979('0x37')](_0x3d89a9[_0x1979('0x33')],qs['fields'](_0xf8795[_0x1979('0x35')][_0x1979('0x39')]));_0x2e9128[_0x1979('0x38')]=_0x2e9128[_0x1979('0x38')][_0x1979('0x3a')]?_0x2e9128['attributes']:_0x3d89a9[_0x1979('0x33')];if(!_0xf8795[_0x1979('0x35')]['hasOwnProperty'](_0x1979('0x3b'))){_0x2e9128[_0x1979('0x1e')]=qs[_0x1979('0x1e')](_0xf8795[_0x1979('0x35')][_0x1979('0x1e')]);_0x2e9128['offset']=qs[_0x1979('0x20')](_0xf8795[_0x1979('0x35')]['offset']);}_0x2e9128[_0x1979('0x3c')]=qs['sort'](_0xf8795['query'][_0x1979('0x3d')]);_0x2e9128[_0x1979('0x3e')]=qs['filters'](_[_0x1979('0x3f')](_0xf8795[_0x1979('0x35')],_0x3d89a9[_0x1979('0x36')]),_0x4e8b6a);if(_0xf8795[_0x1979('0x35')][_0x1979('0x40')]){_0x2e9128['where']=_[_0x1979('0x41')](_0x2e9128['where'],{'$or':[{'key':{'$like':'%'+_0xf8795['query'][_0x1979('0x40')]+'%'}},{'value':{'$like':'%'+_0xf8795[_0x1979('0x35')][_0x1979('0x40')]+'%'}}]});}_0x2e9128=_[_0x1979('0x41')]({},_0x2e9128,_0xf8795[_0x1979('0x42')]);var _0x32aa5c={'where':_0x2e9128['where']};return db[_0x1979('0x2e')][_0x1979('0x1f')](_0x32aa5c)[_0x1979('0x24')](function(_0x1e0a52){_0x21d34f[_0x1979('0x1f')]=_0x1e0a52;if(_0xf8795[_0x1979('0x35')][_0x1979('0x43')]){_0x2e9128['include']=[{'all':!![]}];}return db[_0x1979('0x2e')][_0x1979('0x44')](_0x2e9128);})[_0x1979('0x24')](function(_0xb1abb2){_0x21d34f[_0x1979('0x45')]=_0xb1abb2;return _0x21d34f;})[_0x1979('0x24')](respondWithFilteredResult(_0x1e5f2f,_0x2e9128))['catch'](handleError(_0x1e5f2f,null));};exports[_0x1979('0x46')]=function(_0xaf0cf4,_0x16241a){var _0x34a3b0={'raw':!![],'where':{'id':_0xaf0cf4[_0x1979('0x47')]['id']}},_0x52bc2c={};_0x52bc2c[_0x1979('0x33')]=_[_0x1979('0x48')](db[_0x1979('0x2e')][_0x1979('0x2f')]);_0x52bc2c[_0x1979('0x35')]=_[_0x1979('0x48')](_0xaf0cf4['query']);_0x52bc2c[_0x1979('0x36')]=_[_0x1979('0x37')](_0x52bc2c[_0x1979('0x33')],_0x52bc2c['query']);_0x34a3b0[_0x1979('0x38')]=_[_0x1979('0x37')](_0x52bc2c['model'],qs[_0x1979('0x39')](_0xaf0cf4['query'][_0x1979('0x39')]));_0x34a3b0[_0x1979('0x38')]=_0x34a3b0[_0x1979('0x38')][_0x1979('0x3a')]?_0x34a3b0[_0x1979('0x38')]:_0x52bc2c['model'];if(_0xaf0cf4[_0x1979('0x35')][_0x1979('0x43')]){_0x34a3b0['include']=[{'all':!![]}];}_0x34a3b0=_[_0x1979('0x41')]({},_0x34a3b0,_0xaf0cf4[_0x1979('0x42')]);return db[_0x1979('0x2e')][_0x1979('0x49')](_0x34a3b0)[_0x1979('0x24')](handleEntityNotFound(_0x16241a,null))[_0x1979('0x24')](respondWithResult(_0x16241a,null))[_0x1979('0x4a')](handleError(_0x16241a,null));};exports[_0x1979('0x23')]=function(_0x244a5e,_0x47caab){if(_0x244a5e[_0x1979('0x4b')]['id']){delete _0x244a5e[_0x1979('0x4b')]['id'];}return db[_0x1979('0x2e')][_0x1979('0x49')]({'where':{'id':_0x244a5e[_0x1979('0x47')]['id']}})[_0x1979('0x24')](handleEntityNotFound(_0x47caab,null))['then'](saveUpdates(_0x244a5e[_0x1979('0x4b')],null))['then'](respondWithResult(_0x47caab,null))['catch'](handleError(_0x47caab,null));};exports['destroy']=function(_0x1d09eb,_0x4959f9){return db[_0x1979('0x2e')][_0x1979('0x49')]({'where':{'id':_0x1d09eb[_0x1979('0x47')]['id']}})[_0x1979('0x24')](handleEntityNotFound(_0x4959f9,null))[_0x1979('0x24')](removeEntity(_0x4959f9,null))[_0x1979('0x4a')](handleError(_0x4959f9,null));};exports['create']=function(_0x1f9774,_0x20adc0){var _0x5a58bc={'key':_0x1f9774[_0x1979('0x4b')]['key']};if(_0x1f9774[_0x1979('0x4b')][_0x1979('0x4c')]){_0x5a58bc[_0x1979('0x4c')]=_0x1f9774[_0x1979('0x4b')][_0x1979('0x4c')];}else if(_0x1f9774['body']['SmsAccountId']){_0x5a58bc['SmsAccountId']=_0x1f9774['body'][_0x1979('0x4d')];}else if(_0x1f9774[_0x1979('0x4b')][_0x1979('0x4e')]){_0x5a58bc[_0x1979('0x4e')]=_0x1f9774[_0x1979('0x4b')]['OpenchannelAccountId'];}else if(_0x1f9774[_0x1979('0x4b')][_0x1979('0x4f')]){_0x5a58bc['ChatWebsiteId']=_0x1f9774[_0x1979('0x4b')][_0x1979('0x4f')];}return db['CannedAnswer']['find']({'where':_0x5a58bc})[_0x1979('0x24')](function(_0x242bcb){if(_0x242bcb){throw new db['Sequelize'][(_0x1979('0x50'))](_0x1979('0x51'));}return db['CannedAnswer'][_0x1979('0x52')](_0x1f9774['body']);})[_0x1979('0x24')](function(_0x22f97d){var _0x67b4c6=_0x1f9774[_0x1979('0x53')][_0x1979('0x26')]({'plain':!![]});if(!_0x67b4c6)throw new Error(_0x1979('0x54'));if(_0x67b4c6['role']===_0x1979('0x53')){var _0x4158cf=_0x22f97d['get']({'plain':!![]});return db['UserProfileSection'][_0x1979('0x49')]({'where':{'name':_0x1979('0x27'),'userProfileId':_0x67b4c6[_0x1979('0x55')]},'raw':!![]})[_0x1979('0x24')](function(_0x2a1e96){if(_0x2a1e96&&_0x2a1e96[_0x1979('0x56')]===0x0){return db[_0x1979('0x28')][_0x1979('0x52')]({'name':_0x4158cf[_0x1979('0x2b')],'resourceId':_0x4158cf['id'],'type':_0x2a1e96['name'],'sectionId':_0x2a1e96['id']},{})[_0x1979('0x24')](function(){return _0x22f97d;});}else{return _0x22f97d;}})[_0x1979('0x4a')](function(_0x56fba7){logger['error'](_0x1979('0x57'),_0x56fba7);throw _0x56fba7;});}return _0x22f97d;})[_0x1979('0x24')](respondWithResult(_0x20adc0,0xc9))[_0x1979('0x4a')](handleError(_0x20adc0,null));}; \ No newline at end of file +var _0xeb9e=['crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','map','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','CannedAnswer','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','autoAssociation','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4fdb79,_0x12c116){var _0x3ec15b=function(_0x50c82e){while(--_0x50c82e){_0x4fdb79['push'](_0x4fdb79['shift']());}};_0x3ec15b(++_0x12c116);}(_0xeb9e,0x1f3));var _0xeeb9=function(_0x2692d4,_0x1f323c){_0x2692d4=_0x2692d4-0x0;var _0x2c5d1d=_0xeb9e[_0x2692d4];return _0x2c5d1d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeeb9('0x0'));var zipdir=require(_0xeeb9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeeb9('0x2'));var moment=require(_0xeeb9('0x3'));var BPromise=require(_0xeeb9('0x4'));var Mustache=require(_0xeeb9('0x5'));var util=require('util');var path=require('path');var sox=require(_0xeeb9('0x6'));var csv=require(_0xeeb9('0x7'));var ejs=require(_0xeeb9('0x8'));var fs=require('fs');var fs_extra=require(_0xeeb9('0x9'));var _=require(_0xeeb9('0xa'));var squel=require('squel');var crypto=require(_0xeeb9('0xb'));var jsforce=require(_0xeeb9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeeb9('0x7'));var querystring=require('querystring');var Papa=require(_0xeeb9('0xd'));var Redis=require('ioredis');var authService=require(_0xeeb9('0xe'));var qs=require(_0xeeb9('0xf'));var as=require(_0xeeb9('0x10'));var hardwareService=require(_0xeeb9('0x11'));var logger=require(_0xeeb9('0x12'))(_0xeeb9('0x13'));var utils=require(_0xeeb9('0x14'));var config=require(_0xeeb9('0x15'));var licenseUtil=require(_0xeeb9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4397e2,_0x498afb){_0x498afb=_0x498afb||0xcc;return function(_0x40a5f3){if(_0x40a5f3){return _0x4397e2[_0xeeb9('0x17')](_0x498afb);}return _0x4397e2[_0xeeb9('0x18')](_0x498afb)['end']();};}function respondWithResult(_0x3e1ef3,_0x1e11ec){_0x1e11ec=_0x1e11ec||0xc8;return function(_0x498851){if(_0x498851){return _0x3e1ef3['status'](_0x1e11ec)[_0xeeb9('0x19')](_0x498851);}};}function respondWithFilteredResult(_0x1db606,_0x2caba1){return function(_0x27be5b){if(_0x27be5b){var _0x3d1353=typeof _0x2caba1['offset']===_0xeeb9('0x1a')&&typeof _0x2caba1[_0xeeb9('0x1b')]===_0xeeb9('0x1a');var _0x3cfb50=_0x27be5b[_0xeeb9('0x1c')];var _0x225b93=_0x3d1353?0x0:_0x2caba1[_0xeeb9('0x1d')];var _0x552641=_0x3d1353?_0x27be5b['count']:_0x2caba1[_0xeeb9('0x1d')]+_0x2caba1[_0xeeb9('0x1b')];var _0xdd65f9;if(_0x552641>=_0x3cfb50){_0x552641=_0x3cfb50;_0xdd65f9=0xc8;}else{_0xdd65f9=0xce;}_0x1db606[_0xeeb9('0x18')](_0xdd65f9);return _0x1db606['set'](_0xeeb9('0x1e'),_0x225b93+'-'+_0x552641+'/'+_0x3cfb50)[_0xeeb9('0x19')](_0x27be5b);}return null;};}function patchUpdates(_0x371cde){return function(_0x794e5d){try{jsonpatch[_0xeeb9('0x1f')](_0x794e5d,_0x371cde,!![]);}catch(_0x148a2d){return BPromise[_0xeeb9('0x20')](_0x148a2d);}return _0x794e5d[_0xeeb9('0x21')]();};}function saveUpdates(_0x63685e,_0x336384){return function(_0x2df51b){if(_0x2df51b){return _0x2df51b[_0xeeb9('0x22')](_0x63685e)[_0xeeb9('0x23')](function(_0x6d30ef){return _0x6d30ef;});}return null;};}function removeEntity(_0x5bfd44,_0x477a7c){return function(_0x57004f){if(_0x57004f){return _0x57004f[_0xeeb9('0x24')]()[_0xeeb9('0x23')](function(){var _0x1c0e10=_0x57004f[_0xeeb9('0x25')]({'plain':!![]});var _0x5742a3='CannedAnswers';return db[_0xeeb9('0x26')]['destroy']({'where':{'type':_0x5742a3,'resourceId':_0x1c0e10['id']}})[_0xeeb9('0x23')](function(){return _0x57004f;});})[_0xeeb9('0x23')](function(){_0x5bfd44[_0xeeb9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48ef78,_0x4385c8){return function(_0x45f2e7){if(!_0x45f2e7){_0x48ef78['sendStatus'](0x194);}return _0x45f2e7;};}function handleError(_0x4c801c,_0x12a95d){_0x12a95d=_0x12a95d||0x1f4;return function(_0xc6b615){logger[_0xeeb9('0x27')](_0xc6b615['stack']);if(_0xc6b615[_0xeeb9('0x28')]){delete _0xc6b615[_0xeeb9('0x28')];}_0x4c801c[_0xeeb9('0x18')](_0x12a95d)[_0xeeb9('0x29')](_0xc6b615);};}exports['index']=function(_0x40cb8d,_0x357016){var _0x11e8a5={},_0x12d986={},_0x1f27f4={'count':0x0,'rows':[]};var _0x36cd74=_[_0xeeb9('0x2a')](db['CannedAnswer']['rawAttributes'],function(_0x4ab129){return{'name':_0x4ab129[_0xeeb9('0x2b')],'type':_0x4ab129['type'][_0xeeb9('0x2c')]};});_0x12d986[_0xeeb9('0x2d')]=_['map'](_0x36cd74,_0xeeb9('0x28'));_0x12d986[_0xeeb9('0x2e')]=_[_0xeeb9('0x2f')](_0x40cb8d[_0xeeb9('0x2e')]);_0x12d986[_0xeeb9('0x30')]=_['intersection'](_0x12d986[_0xeeb9('0x2d')],_0x12d986['query']);_0x11e8a5[_0xeeb9('0x31')]=_[_0xeeb9('0x32')](_0x12d986[_0xeeb9('0x2d')],qs[_0xeeb9('0x33')](_0x40cb8d[_0xeeb9('0x2e')]['fields']));_0x11e8a5[_0xeeb9('0x31')]=_0x11e8a5[_0xeeb9('0x31')][_0xeeb9('0x34')]?_0x11e8a5[_0xeeb9('0x31')]:_0x12d986['model'];if(!_0x40cb8d[_0xeeb9('0x2e')]['hasOwnProperty'](_0xeeb9('0x35'))){_0x11e8a5[_0xeeb9('0x1b')]=qs[_0xeeb9('0x1b')](_0x40cb8d['query']['limit']);_0x11e8a5[_0xeeb9('0x1d')]=qs[_0xeeb9('0x1d')](_0x40cb8d[_0xeeb9('0x2e')][_0xeeb9('0x1d')]);}_0x11e8a5[_0xeeb9('0x36')]=qs[_0xeeb9('0x37')](_0x40cb8d['query']['sort']);_0x11e8a5[_0xeeb9('0x38')]=qs[_0xeeb9('0x30')](_[_0xeeb9('0x39')](_0x40cb8d[_0xeeb9('0x2e')],_0x12d986[_0xeeb9('0x30')]),_0x36cd74);if(_0x40cb8d[_0xeeb9('0x2e')][_0xeeb9('0x3a')]){_0x11e8a5[_0xeeb9('0x38')]=_[_0xeeb9('0x3b')](_0x11e8a5[_0xeeb9('0x38')],{'$or':[{'key':{'$like':'%'+_0x40cb8d['query'][_0xeeb9('0x3a')]+'%'}},{'value':{'$like':'%'+_0x40cb8d[_0xeeb9('0x2e')][_0xeeb9('0x3a')]+'%'}}]});}_0x11e8a5=_[_0xeeb9('0x3b')]({},_0x11e8a5,_0x40cb8d['options']);var _0xae4f0c={'where':_0x11e8a5['where']};return db[_0xeeb9('0x3c')][_0xeeb9('0x1c')](_0xae4f0c)[_0xeeb9('0x23')](function(_0x2b41da){_0x1f27f4['count']=_0x2b41da;if(_0x40cb8d[_0xeeb9('0x2e')][_0xeeb9('0x3d')]){_0x11e8a5[_0xeeb9('0x3e')]=[{'all':!![]}];}return db[_0xeeb9('0x3c')][_0xeeb9('0x3f')](_0x11e8a5);})[_0xeeb9('0x23')](function(_0x2cf7cd){_0x1f27f4[_0xeeb9('0x40')]=_0x2cf7cd;return _0x1f27f4;})[_0xeeb9('0x23')](respondWithFilteredResult(_0x357016,_0x11e8a5))[_0xeeb9('0x41')](handleError(_0x357016,null));};exports[_0xeeb9('0x42')]=function(_0x4856cc,_0x16129d){var _0x3e76a3={'raw':!![],'where':{'id':_0x4856cc[_0xeeb9('0x43')]['id']}},_0x3d4f25={};_0x3d4f25['model']=_[_0xeeb9('0x2f')](db[_0xeeb9('0x3c')][_0xeeb9('0x44')]);_0x3d4f25[_0xeeb9('0x2e')]=_[_0xeeb9('0x2f')](_0x4856cc['query']);_0x3d4f25[_0xeeb9('0x30')]=_[_0xeeb9('0x32')](_0x3d4f25[_0xeeb9('0x2d')],_0x3d4f25['query']);_0x3e76a3[_0xeeb9('0x31')]=_['intersection'](_0x3d4f25['model'],qs[_0xeeb9('0x33')](_0x4856cc[_0xeeb9('0x2e')][_0xeeb9('0x33')]));_0x3e76a3[_0xeeb9('0x31')]=_0x3e76a3[_0xeeb9('0x31')]['length']?_0x3e76a3['attributes']:_0x3d4f25['model'];if(_0x4856cc[_0xeeb9('0x2e')][_0xeeb9('0x3d')]){_0x3e76a3[_0xeeb9('0x3e')]=[{'all':!![]}];}_0x3e76a3=_[_0xeeb9('0x3b')]({},_0x3e76a3,_0x4856cc['options']);return db[_0xeeb9('0x3c')][_0xeeb9('0x45')](_0x3e76a3)[_0xeeb9('0x23')](handleEntityNotFound(_0x16129d,null))[_0xeeb9('0x23')](respondWithResult(_0x16129d,null))[_0xeeb9('0x41')](handleError(_0x16129d,null));};exports[_0xeeb9('0x22')]=function(_0x213290,_0x2ee7f2){if(_0x213290[_0xeeb9('0x46')]['id']){delete _0x213290[_0xeeb9('0x46')]['id'];}return db['CannedAnswer'][_0xeeb9('0x45')]({'where':{'id':_0x213290[_0xeeb9('0x43')]['id']}})['then'](handleEntityNotFound(_0x2ee7f2,null))['then'](saveUpdates(_0x213290[_0xeeb9('0x46')],null))[_0xeeb9('0x23')](respondWithResult(_0x2ee7f2,null))['catch'](handleError(_0x2ee7f2,null));};exports[_0xeeb9('0x24')]=function(_0x4b73ad,_0x56dca3){return db[_0xeeb9('0x3c')][_0xeeb9('0x45')]({'where':{'id':_0x4b73ad[_0xeeb9('0x43')]['id']}})[_0xeeb9('0x23')](handleEntityNotFound(_0x56dca3,null))['then'](removeEntity(_0x56dca3,null))[_0xeeb9('0x41')](handleError(_0x56dca3,null));};exports[_0xeeb9('0x47')]=function(_0x24a840,_0x1f3d30){var _0xe90ba7={'key':_0x24a840[_0xeeb9('0x46')]['key']};if(_0x24a840['body']['MailAccountId']){_0xe90ba7['MailAccountId']=_0x24a840[_0xeeb9('0x46')][_0xeeb9('0x48')];}else if(_0x24a840[_0xeeb9('0x46')][_0xeeb9('0x49')]){_0xe90ba7[_0xeeb9('0x49')]=_0x24a840[_0xeeb9('0x46')][_0xeeb9('0x49')];}else if(_0x24a840[_0xeeb9('0x46')][_0xeeb9('0x4a')]){_0xe90ba7[_0xeeb9('0x4a')]=_0x24a840[_0xeeb9('0x46')][_0xeeb9('0x4a')];}else if(_0x24a840[_0xeeb9('0x46')][_0xeeb9('0x4b')]){_0xe90ba7[_0xeeb9('0x4b')]=_0x24a840[_0xeeb9('0x46')][_0xeeb9('0x4b')];}return db[_0xeeb9('0x3c')]['find']({'where':_0xe90ba7})['then'](function(_0x51b55b){if(_0x51b55b){throw new db[(_0xeeb9('0x4c'))][(_0xeeb9('0x4d'))](_0xeeb9('0x4e'));}return db[_0xeeb9('0x3c')][_0xeeb9('0x47')](_0x24a840['body']);})['then'](function(_0x5b5bb8){var _0x31da99=_0x24a840[_0xeeb9('0x4f')][_0xeeb9('0x25')]({'plain':!![]});if(!_0x31da99)throw new Error(_0xeeb9('0x50'));if(_0x31da99[_0xeeb9('0x51')]===_0xeeb9('0x4f')){var _0x749e5=_0x5b5bb8[_0xeeb9('0x25')]({'plain':!![]});return db[_0xeeb9('0x52')][_0xeeb9('0x45')]({'where':{'name':_0xeeb9('0x53'),'userProfileId':_0x31da99['userProfileId']},'raw':!![]})[_0xeeb9('0x23')](function(_0xff6a7e){if(_0xff6a7e&&_0xff6a7e[_0xeeb9('0x54')]===0x0){return db['UserProfileResource'][_0xeeb9('0x47')]({'name':_0x749e5[_0xeeb9('0x28')],'resourceId':_0x749e5['id'],'type':_0xff6a7e[_0xeeb9('0x28')],'sectionId':_0xff6a7e['id']},{})['then'](function(){return _0x5b5bb8;});}else{return _0x5b5bb8;}})[_0xeeb9('0x41')](function(_0x4cd81e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cd81e);throw _0x4cd81e;});}return _0x5b5bb8;})[_0xeeb9('0x23')](respondWithResult(_0x1f3d30,0xc9))[_0xeeb9('0x41')](handleError(_0x1f3d30,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 1eb303a..08dcbbc 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 _0x1006=['api','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x1f6923,_0x440d12){var _0x25d600=function(_0x250df8){while(--_0x250df8){_0x1f6923['push'](_0x1f6923['shift']());}};_0x25d600(++_0x440d12);}(_0x1006,0x102));var _0x6100=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x1006[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x6100('0x0'));var util=require(_0x6100('0x1'));var logger=require('../../config/logger')(_0x6100('0x2'));var moment=require('moment');var BPromise=require(_0x6100('0x3'));var rp=require(_0x6100('0x4'));var fs=require('fs');var path=require(_0x6100('0x5'));var rimraf=require(_0x6100('0x6'));var config=require('../../config/environment');var attributes=require(_0x6100('0x7'));module[_0x6100('0x8')]=function(_0x5f26e6,_0x2e5166){return _0x5f26e6[_0x6100('0x9')]('CannedAnswer',attributes,{'tableName':_0x6100('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6100('0xb'),'collate':_0x6100('0xc')});}; \ No newline at end of file +var _0xfb50=['api','moment','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','lodash','util'];(function(_0x28fa12,_0x431959){var _0x5abdeb=function(_0x2769ca){while(--_0x2769ca){_0x28fa12['push'](_0x28fa12['shift']());}};_0x5abdeb(++_0x431959);}(_0xfb50,0x148));var _0x0fb5=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0xfb50[_0x55821d];return _0x58ea8a;};'use strict';var _=require(_0x0fb5('0x0'));var util=require(_0x0fb5('0x1'));var logger=require('../../config/logger')(_0x0fb5('0x2'));var moment=require(_0x0fb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0fb5('0x4'));var config=require(_0x0fb5('0x5'));var attributes=require(_0x0fb5('0x6'));module[_0x0fb5('0x7')]=function(_0x1d689e,_0x2c0d97){return _0x1d689e[_0x0fb5('0x8')]('CannedAnswer',attributes,{'tableName':_0x0fb5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0fb5('0xa'),'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 4866d79..1e7c0da 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(_0x423ee6,_0xaa40a3){var _0x5caeca=function(_0x266960){while(--_0x266960){_0x423ee6['push'](_0x423ee6['shift']());}};_0x5caeca(++_0xaa40a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x384643,_0x51b03f){var _0x3c4c99=function(_0x156f68){while(--_0x156f68){_0x384643['push'](_0x384643['shift']());}};_0x3c4c99(++_0x51b03f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 d256b07..4aa6f18 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 _0x35d7=['get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller'];(function(_0x4877ef,_0x21a8f0){var _0x3b01d5=function(_0x5e76e9){while(--_0x5e76e9){_0x4877ef['push'](_0x4877ef['shift']());}};_0x3b01d5(++_0x21a8f0);}(_0x35d7,0x1cc));var _0x735d=function(_0x2b3bbb,_0x116659){_0x2b3bbb=_0x2b3bbb-0x0;var _0x1b71aa=_0x35d7[_0x2b3bbb];return _0x1b71aa;};'use strict';var multer=require(_0x735d('0x0'));var util=require(_0x735d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x735d('0x2'));var router=express[_0x735d('0x3')]();var fs_extra=require(_0x735d('0x4'));var auth=require(_0x735d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x735d('0x6'));var controller=require(_0x735d('0x7'));router[_0x735d('0x8')]('/',auth[_0x735d('0x9')](),controller[_0x735d('0xa')]);router[_0x735d('0x8')](_0x735d('0xb'),auth[_0x735d('0x9')](),controller[_0x735d('0xc')]);router[_0x735d('0xd')]('/',auth[_0x735d('0x9')](),controller[_0x735d('0xe')]);router['put'](_0x735d('0xb'),auth[_0x735d('0x9')](),controller[_0x735d('0xf')]);router[_0x735d('0x10')](_0x735d('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x735d('0x11')]=router; \ No newline at end of file +var _0x08e0=['delete','destroy','multer','path','express','Router','fs-extra','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','update'];(function(_0x4b8cd7,_0x2da774){var _0x1dbab5=function(_0x322891){while(--_0x322891){_0x4b8cd7['push'](_0x4b8cd7['shift']());}};_0x1dbab5(++_0x2da774);}(_0x08e0,0xe3));var _0x008e=function(_0x4defd6,_0x37bbd3){_0x4defd6=_0x4defd6-0x0;var _0x4c9276=_0x08e0[_0x4defd6];return _0x4c9276;};'use strict';var multer=require(_0x008e('0x0'));var util=require('util');var path=require(_0x008e('0x1'));var timeout=require('connect-timeout');var express=require(_0x008e('0x2'));var router=express[_0x008e('0x3')]();var fs_extra=require(_0x008e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x008e('0x5'));var controller=require(_0x008e('0x6'));router[_0x008e('0x7')]('/',auth[_0x008e('0x8')](),controller['index']);router[_0x008e('0x7')](_0x008e('0x9'),auth[_0x008e('0x8')](),controller[_0x008e('0xa')]);router[_0x008e('0xb')]('/',auth[_0x008e('0x8')](),controller['create']);router['put'](_0x008e('0x9'),auth[_0x008e('0x8')](),controller[_0x008e('0xc')]);router[_0x008e('0xd')](_0x008e('0x9'),auth[_0x008e('0x8')](),controller[_0x008e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index e42ac85..dff1339 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 _0x652b=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x4227e6,_0x202f7c){var _0x44e865=function(_0x1a31ac){while(--_0x1a31ac){_0x4227e6['push'](_0x4227e6['shift']());}};_0x44e865(++_0x202f7c);}(_0x652b,0x68));var _0xb652=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x652b[_0x41d432];return _0x1650f9;};'use strict';var Sequelize=require(_0xb652('0x0'));module[_0xb652('0x1')]={'calldate':{'type':Sequelize[_0xb652('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xb652('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xb652('0x3')]},'channel':{'type':Sequelize[_0xb652('0x3')]},'dstchannel':{'type':Sequelize[_0xb652('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xb652('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xb652('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xb652('0x3')]},'uniqueid':{'type':Sequelize[_0xb652('0x3')]},'linkedid':{'type':Sequelize[_0xb652('0x3')]},'sequence':{'type':Sequelize[_0xb652('0x3')]},'peeraccount':{'type':Sequelize[_0xb652('0x3')]},'type':{'type':Sequelize[_0xb652('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xda55=['INTEGER','sequelize','exports','STRING'];(function(_0x42a1fb,_0xbbf9dd){var _0x4c109d=function(_0x308d18){while(--_0x308d18){_0x42a1fb['push'](_0x42a1fb['shift']());}};_0x4c109d(++_0xbbf9dd);}(_0xda55,0x6d));var _0x5da5=function(_0x3b7a06,_0x41f79e){_0x3b7a06=_0x3b7a06-0x0;var _0x363e31=_0xda55[_0x3b7a06];return _0x363e31;};'use strict';var Sequelize=require(_0x5da5('0x0'));module[_0x5da5('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x5da5('0x2')]},'src':{'type':Sequelize[_0x5da5('0x2')]},'dst':{'type':Sequelize[_0x5da5('0x2')]},'dcontext':{'type':Sequelize[_0x5da5('0x2')]},'channel':{'type':Sequelize[_0x5da5('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x5da5('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x5da5('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5da5('0x2')]},'amaflags':{'type':Sequelize[_0x5da5('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5da5('0x2')]},'userfield':{'type':Sequelize[_0x5da5('0x2')]},'uniqueid':{'type':Sequelize[_0x5da5('0x2')]},'linkedid':{'type':Sequelize[_0x5da5('0x2')]},'sequence':{'type':Sequelize[_0x5da5('0x2')]},'peeraccount':{'type':Sequelize[_0x5da5('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x5da5('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 78ecfe9..bbd0e1f 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 _0xd13e=['limit','count','Content-Range','reject','save','update','destroy','then','end','sendStatus','error','name','index','map','Cdr','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','where','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd13e,0x193));var _0xed13=function(_0x17db89,_0x4482c9){_0x17db89=_0x17db89-0x0;var _0x39d187=_0xd13e[_0x17db89];return _0x39d187;};'use strict';var emlformat=require(_0xed13('0x0'));var rimraf=require(_0xed13('0x1'));var zipdir=require(_0xed13('0x2'));var jsonpatch=require(_0xed13('0x3'));var rp=require('request-promise');var moment=require(_0xed13('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed13('0x5'));var util=require('util');var path=require(_0xed13('0x6'));var sox=require(_0xed13('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed13('0x8'));var squel=require(_0xed13('0x9'));var crypto=require(_0xed13('0xa'));var jsforce=require(_0xed13('0xb'));var deskjs=require(_0xed13('0xc'));var toCsv=require(_0xed13('0xd'));var querystring=require(_0xed13('0xe'));var Papa=require(_0xed13('0xf'));var Redis=require(_0xed13('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xed13('0x11'));var as=require(_0xed13('0x12'));var hardwareService=require(_0xed13('0x13'));var logger=require(_0xed13('0x14'))(_0xed13('0x15'));var utils=require('../../config/utils');var config=require(_0xed13('0x16'));var licenseUtil=require(_0xed13('0x17'));var db=require(_0xed13('0x18'))['db'];function respondWithStatusCode(_0x3c0b22,_0x936103){_0x936103=_0x936103||0xcc;return function(_0x3295ba){if(_0x3295ba){return _0x3c0b22['sendStatus'](_0x936103);}return _0x3c0b22[_0xed13('0x19')](_0x936103)['end']();};}function respondWithResult(_0x257074,_0x56fdc6){_0x56fdc6=_0x56fdc6||0xc8;return function(_0x6e2978){if(_0x6e2978){return _0x257074['status'](_0x56fdc6)[_0xed13('0x1a')](_0x6e2978);}};}function respondWithFilteredResult(_0x4d5435,_0x38901a){return function(_0xf900d2){if(_0xf900d2){var _0x1d3d67=typeof _0x38901a[_0xed13('0x1b')]===_0xed13('0x1c')&&typeof _0x38901a[_0xed13('0x1d')]===_0xed13('0x1c');var _0x1148a3=_0xf900d2[_0xed13('0x1e')];var _0x1e161f=_0x1d3d67?0x0:_0x38901a[_0xed13('0x1b')];var _0x31de07=_0x1d3d67?_0xf900d2[_0xed13('0x1e')]:_0x38901a[_0xed13('0x1b')]+_0x38901a[_0xed13('0x1d')];var _0x2f38c9;if(_0x31de07>=_0x1148a3){_0x31de07=_0x1148a3;_0x2f38c9=0xc8;}else{_0x2f38c9=0xce;}_0x4d5435['status'](_0x2f38c9);return _0x4d5435['set'](_0xed13('0x1f'),_0x1e161f+'-'+_0x31de07+'/'+_0x1148a3)[_0xed13('0x1a')](_0xf900d2);}return null;};}function patchUpdates(_0x4f455b){return function(_0x40dd86){try{jsonpatch['apply'](_0x40dd86,_0x4f455b,!![]);}catch(_0x4e9e3b){return BPromise[_0xed13('0x20')](_0x4e9e3b);}return _0x40dd86[_0xed13('0x21')]();};}function saveUpdates(_0x2d62cd,_0x192d12){return function(_0x1d7621){if(_0x1d7621){return _0x1d7621[_0xed13('0x22')](_0x2d62cd)['then'](function(_0x5c0daf){return _0x5c0daf;});}return null;};}function removeEntity(_0x5d7ae1,_0x19d51b){return function(_0x3b1f23){if(_0x3b1f23){return _0x3b1f23[_0xed13('0x23')]()[_0xed13('0x24')](function(){_0x5d7ae1[_0xed13('0x19')](0xcc)[_0xed13('0x25')]();});}};}function handleEntityNotFound(_0x1f0405,_0x276c57){return function(_0x2410e2){if(!_0x2410e2){_0x1f0405[_0xed13('0x26')](0x194);}return _0x2410e2;};}function handleError(_0x1f064c,_0x3bc666){_0x3bc666=_0x3bc666||0x1f4;return function(_0x2c6c33){logger[_0xed13('0x27')](_0x2c6c33['stack']);if(_0x2c6c33['name']){delete _0x2c6c33[_0xed13('0x28')];}_0x1f064c[_0xed13('0x19')](_0x3bc666)['send'](_0x2c6c33);};}exports[_0xed13('0x29')]=function(_0x40444a,_0x4ed119){var _0x7ce996={},_0x2066ca={},_0x323156={'count':0x0,'rows':[]};var _0x570929=_[_0xed13('0x2a')](db[_0xed13('0x2b')]['rawAttributes'],function(_0x433665){return{'name':_0x433665[_0xed13('0x2c')],'type':_0x433665['type'][_0xed13('0x2d')]};});_0x2066ca[_0xed13('0x2e')]=_[_0xed13('0x2a')](_0x570929,_0xed13('0x28'));_0x2066ca[_0xed13('0x2f')]=_[_0xed13('0x30')](_0x40444a[_0xed13('0x2f')]);_0x2066ca['filters']=_[_0xed13('0x31')](_0x2066ca['model'],_0x2066ca['query']);_0x7ce996[_0xed13('0x32')]=_[_0xed13('0x31')](_0x2066ca[_0xed13('0x2e')],qs['fields'](_0x40444a[_0xed13('0x2f')][_0xed13('0x33')]));_0x7ce996[_0xed13('0x32')]=_0x7ce996['attributes'][_0xed13('0x34')]?_0x7ce996[_0xed13('0x32')]:_0x2066ca[_0xed13('0x2e')];if(!_0x40444a[_0xed13('0x2f')]['hasOwnProperty'](_0xed13('0x35'))){_0x7ce996[_0xed13('0x1d')]=qs[_0xed13('0x1d')](_0x40444a[_0xed13('0x2f')][_0xed13('0x1d')]);_0x7ce996[_0xed13('0x1b')]=qs[_0xed13('0x1b')](_0x40444a[_0xed13('0x2f')][_0xed13('0x1b')]);}_0x7ce996[_0xed13('0x36')]=qs['sort'](_0x40444a[_0xed13('0x2f')][_0xed13('0x37')]);_0x7ce996['where']=qs['filters'](_['pick'](_0x40444a[_0xed13('0x2f')],_0x2066ca[_0xed13('0x38')]),_0x570929);if(_0x40444a['query']['filter']){_0x7ce996[_0xed13('0x39')]=_[_0xed13('0x3a')](_0x7ce996[_0xed13('0x39')],{'$or':_[_0xed13('0x2a')](_0x570929,function(_0x358098){if(_0x358098['type']!=='VIRTUAL'){var _0x1e943a={};_0x1e943a[_0x358098['name']]={'$like':'%'+_0x40444a[_0xed13('0x2f')]['filter']+'%'};return _0x1e943a;}})});}_0x7ce996=_[_0xed13('0x3a')]({},_0x7ce996,_0x40444a['options']);var _0x4d6429={'where':_0x7ce996['where']};return db[_0xed13('0x2b')][_0xed13('0x1e')](_0x4d6429)[_0xed13('0x24')](function(_0x42d5f7){_0x323156[_0xed13('0x1e')]=_0x42d5f7;if(_0x40444a['query'][_0xed13('0x3b')]){_0x7ce996[_0xed13('0x3c')]=[{'all':!![]}];}return db[_0xed13('0x2b')][_0xed13('0x3d')](_0x7ce996);})[_0xed13('0x24')](function(_0x5a8cfb){_0x323156[_0xed13('0x3e')]=_0x5a8cfb;return _0x323156;})[_0xed13('0x24')](respondWithFilteredResult(_0x4ed119,_0x7ce996))[_0xed13('0x3f')](handleError(_0x4ed119,null));};exports[_0xed13('0x40')]=function(_0x187e28,_0x2e43b5){var _0x535de7={'raw':!![],'where':{'id':_0x187e28[_0xed13('0x41')]['id']}},_0x2f04ef={};_0x2f04ef[_0xed13('0x2e')]=_[_0xed13('0x30')](db[_0xed13('0x2b')][_0xed13('0x42')]);_0x2f04ef[_0xed13('0x2f')]=_[_0xed13('0x30')](_0x187e28[_0xed13('0x2f')]);_0x2f04ef[_0xed13('0x38')]=_[_0xed13('0x31')](_0x2f04ef[_0xed13('0x2e')],_0x2f04ef[_0xed13('0x2f')]);_0x535de7[_0xed13('0x32')]=_['intersection'](_0x2f04ef[_0xed13('0x2e')],qs[_0xed13('0x33')](_0x187e28['query'][_0xed13('0x33')]));_0x535de7[_0xed13('0x32')]=_0x535de7[_0xed13('0x32')]['length']?_0x535de7[_0xed13('0x32')]:_0x2f04ef[_0xed13('0x2e')];if(_0x187e28[_0xed13('0x2f')]['includeAll']){_0x535de7['include']=[{'all':!![]}];}_0x535de7=_[_0xed13('0x3a')]({},_0x535de7,_0x187e28[_0xed13('0x43')]);return db['Cdr'][_0xed13('0x44')](_0x535de7)[_0xed13('0x24')](handleEntityNotFound(_0x2e43b5,null))[_0xed13('0x24')](respondWithResult(_0x2e43b5,null))[_0xed13('0x3f')](handleError(_0x2e43b5,null));};exports['create']=function(_0x1df911,_0xf4ea89){return db[_0xed13('0x2b')][_0xed13('0x45')](_0x1df911['body'],{})[_0xed13('0x24')](respondWithResult(_0xf4ea89,0xc9))['catch'](handleError(_0xf4ea89,null));};exports[_0xed13('0x22')]=function(_0x50d12f,_0x5a0828){if(_0x50d12f[_0xed13('0x46')]['id']){delete _0x50d12f[_0xed13('0x46')]['id'];}return db['Cdr'][_0xed13('0x44')]({'where':{'id':_0x50d12f[_0xed13('0x41')]['id']}})[_0xed13('0x24')](handleEntityNotFound(_0x5a0828,null))[_0xed13('0x24')](saveUpdates(_0x50d12f['body'],null))[_0xed13('0x24')](respondWithResult(_0x5a0828,null))['catch'](handleError(_0x5a0828,null));};exports[_0xed13('0x23')]=function(_0x365e50,_0x19762a){return db[_0xed13('0x2b')][_0xed13('0x44')]({'where':{'id':_0x365e50[_0xed13('0x41')]['id']}})[_0xed13('0x24')](handleEntityNotFound(_0x19762a,null))[_0xed13('0x24')](removeEntity(_0x19762a,null))['catch'](handleError(_0x19762a,null));};exports[_0xed13('0x47')]=function(_0x38f66d,_0x372deb){return db[_0xed13('0x2b')]['describe']()[_0xed13('0x24')](respondWithResult(_0x372deb,null))['catch'](handleError(_0x372deb,null));}; \ No newline at end of file +var _0xe0ae=['where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','params','includeAll','catch','create','body','update','find','describe','zip-dir','fast-json-patch','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','Cdr','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort'];(function(_0x185d2a,_0x308609){var _0x4dea27=function(_0x513443){while(--_0x513443){_0x185d2a['push'](_0x185d2a['shift']());}};_0x4dea27(++_0x308609);}(_0xe0ae,0xa1));var _0xee0a=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xe0ae[_0x44946b];return _0x249bc4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee0a('0x0'));var jsonpatch=require(_0xee0a('0x1'));var rp=require('request-promise');var moment=require(_0xee0a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xee0a('0x3'));var util=require(_0xee0a('0x4'));var path=require('path');var sox=require(_0xee0a('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee0a('0x6'));var _=require(_0xee0a('0x7'));var squel=require(_0xee0a('0x8'));var crypto=require(_0xee0a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xee0a('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee0a('0xb'));var Redis=require(_0xee0a('0xc'));var authService=require(_0xee0a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xee0a('0xe'));var hardwareService=require(_0xee0a('0xf'));var logger=require('../../config/logger')(_0xee0a('0x10'));var utils=require('../../config/utils');var config=require(_0xee0a('0x11'));var licenseUtil=require(_0xee0a('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fcf59,_0x5c56d9){_0x5c56d9=_0x5c56d9||0xcc;return function(_0x32fad9){if(_0x32fad9){return _0x1fcf59[_0xee0a('0x13')](_0x5c56d9);}return _0x1fcf59['status'](_0x5c56d9)['end']();};}function respondWithResult(_0x325a8e,_0x41b70a){_0x41b70a=_0x41b70a||0xc8;return function(_0x347604){if(_0x347604){return _0x325a8e[_0xee0a('0x14')](_0x41b70a)[_0xee0a('0x15')](_0x347604);}};}function respondWithFilteredResult(_0x57afe6,_0xb891a9){return function(_0xd39431){if(_0xd39431){var _0x50063f=typeof _0xb891a9[_0xee0a('0x16')]===_0xee0a('0x17')&&typeof _0xb891a9[_0xee0a('0x18')]===_0xee0a('0x17');var _0x4f711b=_0xd39431[_0xee0a('0x19')];var _0x1d7a8a=_0x50063f?0x0:_0xb891a9[_0xee0a('0x16')];var _0x55c474=_0x50063f?_0xd39431[_0xee0a('0x19')]:_0xb891a9[_0xee0a('0x16')]+_0xb891a9[_0xee0a('0x18')];var _0x24f8f1;if(_0x55c474>=_0x4f711b){_0x55c474=_0x4f711b;_0x24f8f1=0xc8;}else{_0x24f8f1=0xce;}_0x57afe6['status'](_0x24f8f1);return _0x57afe6[_0xee0a('0x1a')](_0xee0a('0x1b'),_0x1d7a8a+'-'+_0x55c474+'/'+_0x4f711b)[_0xee0a('0x15')](_0xd39431);}return null;};}function patchUpdates(_0x201d32){return function(_0x5c981e){try{jsonpatch[_0xee0a('0x1c')](_0x5c981e,_0x201d32,!![]);}catch(_0xff2f14){return BPromise[_0xee0a('0x1d')](_0xff2f14);}return _0x5c981e[_0xee0a('0x1e')]();};}function saveUpdates(_0x39fa96,_0x1eb176){return function(_0x2c543c){if(_0x2c543c){return _0x2c543c['update'](_0x39fa96)[_0xee0a('0x1f')](function(_0x3d5459){return _0x3d5459;});}return null;};}function removeEntity(_0x27989c,_0x38d029){return function(_0x567810){if(_0x567810){return _0x567810[_0xee0a('0x20')]()[_0xee0a('0x1f')](function(){_0x27989c[_0xee0a('0x14')](0xcc)[_0xee0a('0x21')]();});}};}function handleEntityNotFound(_0x4c61e2,_0x50e9d1){return function(_0x578ecf){if(!_0x578ecf){_0x4c61e2[_0xee0a('0x13')](0x194);}return _0x578ecf;};}function handleError(_0x4f9f56,_0x5c7cfa){_0x5c7cfa=_0x5c7cfa||0x1f4;return function(_0x1c9ad8){logger[_0xee0a('0x22')](_0x1c9ad8[_0xee0a('0x23')]);if(_0x1c9ad8['name']){delete _0x1c9ad8[_0xee0a('0x24')];}_0x4f9f56[_0xee0a('0x14')](_0x5c7cfa)[_0xee0a('0x25')](_0x1c9ad8);};}exports[_0xee0a('0x26')]=function(_0x2e7f18,_0x45538d){var _0x145332={},_0x408909={},_0x65e054={'count':0x0,'rows':[]};var _0x7b472b=_['map'](db[_0xee0a('0x27')][_0xee0a('0x28')],function(_0x284be5){return{'name':_0x284be5[_0xee0a('0x29')],'type':_0x284be5[_0xee0a('0x2a')][_0xee0a('0x2b')]};});_0x408909['model']=_[_0xee0a('0x2c')](_0x7b472b,_0xee0a('0x24'));_0x408909[_0xee0a('0x2d')]=_[_0xee0a('0x2e')](_0x2e7f18['query']);_0x408909[_0xee0a('0x2f')]=_['intersection'](_0x408909[_0xee0a('0x30')],_0x408909[_0xee0a('0x2d')]);_0x145332[_0xee0a('0x31')]=_[_0xee0a('0x32')](_0x408909[_0xee0a('0x30')],qs[_0xee0a('0x33')](_0x2e7f18[_0xee0a('0x2d')][_0xee0a('0x33')]));_0x145332['attributes']=_0x145332[_0xee0a('0x31')][_0xee0a('0x34')]?_0x145332['attributes']:_0x408909[_0xee0a('0x30')];if(!_0x2e7f18[_0xee0a('0x2d')][_0xee0a('0x35')]('nolimit')){_0x145332[_0xee0a('0x18')]=qs[_0xee0a('0x18')](_0x2e7f18[_0xee0a('0x2d')]['limit']);_0x145332[_0xee0a('0x16')]=qs[_0xee0a('0x16')](_0x2e7f18[_0xee0a('0x2d')]['offset']);}_0x145332['order']=qs[_0xee0a('0x36')](_0x2e7f18[_0xee0a('0x2d')][_0xee0a('0x36')]);_0x145332[_0xee0a('0x37')]=qs[_0xee0a('0x2f')](_[_0xee0a('0x38')](_0x2e7f18[_0xee0a('0x2d')],_0x408909[_0xee0a('0x2f')]),_0x7b472b);if(_0x2e7f18[_0xee0a('0x2d')]['filter']){_0x145332[_0xee0a('0x37')]=_[_0xee0a('0x39')](_0x145332['where'],{'$or':_[_0xee0a('0x2c')](_0x7b472b,function(_0x20a6f2){if(_0x20a6f2['type']!==_0xee0a('0x3a')){var _0x22b1c0={};_0x22b1c0[_0x20a6f2[_0xee0a('0x24')]]={'$like':'%'+_0x2e7f18[_0xee0a('0x2d')][_0xee0a('0x3b')]+'%'};return _0x22b1c0;}})});}_0x145332=_[_0xee0a('0x39')]({},_0x145332,_0x2e7f18[_0xee0a('0x3c')]);var _0x1b88df={'where':_0x145332[_0xee0a('0x37')]};return db['Cdr'][_0xee0a('0x19')](_0x1b88df)[_0xee0a('0x1f')](function(_0x41eba8){_0x65e054[_0xee0a('0x19')]=_0x41eba8;if(_0x2e7f18['query']['includeAll']){_0x145332[_0xee0a('0x3d')]=[{'all':!![]}];}return db[_0xee0a('0x27')][_0xee0a('0x3e')](_0x145332);})[_0xee0a('0x1f')](function(_0x1b69b9){_0x65e054[_0xee0a('0x3f')]=_0x1b69b9;return _0x65e054;})[_0xee0a('0x1f')](respondWithFilteredResult(_0x45538d,_0x145332))['catch'](handleError(_0x45538d,null));};exports['show']=function(_0x285543,_0x283062){var _0x587ee3={'raw':!![],'where':{'id':_0x285543[_0xee0a('0x40')]['id']}},_0x3293b5={};_0x3293b5['model']=_[_0xee0a('0x2e')](db[_0xee0a('0x27')][_0xee0a('0x28')]);_0x3293b5[_0xee0a('0x2d')]=_[_0xee0a('0x2e')](_0x285543[_0xee0a('0x2d')]);_0x3293b5[_0xee0a('0x2f')]=_['intersection'](_0x3293b5['model'],_0x3293b5[_0xee0a('0x2d')]);_0x587ee3['attributes']=_['intersection'](_0x3293b5['model'],qs[_0xee0a('0x33')](_0x285543[_0xee0a('0x2d')]['fields']));_0x587ee3['attributes']=_0x587ee3['attributes']['length']?_0x587ee3[_0xee0a('0x31')]:_0x3293b5[_0xee0a('0x30')];if(_0x285543[_0xee0a('0x2d')][_0xee0a('0x41')]){_0x587ee3[_0xee0a('0x3d')]=[{'all':!![]}];}_0x587ee3=_[_0xee0a('0x39')]({},_0x587ee3,_0x285543['options']);return db[_0xee0a('0x27')]['find'](_0x587ee3)[_0xee0a('0x1f')](handleEntityNotFound(_0x283062,null))[_0xee0a('0x1f')](respondWithResult(_0x283062,null))[_0xee0a('0x42')](handleError(_0x283062,null));};exports[_0xee0a('0x43')]=function(_0x567680,_0x3ef07b){return db[_0xee0a('0x27')][_0xee0a('0x43')](_0x567680[_0xee0a('0x44')],{})[_0xee0a('0x1f')](respondWithResult(_0x3ef07b,0xc9))[_0xee0a('0x42')](handleError(_0x3ef07b,null));};exports[_0xee0a('0x45')]=function(_0x4cd7d3,_0x51300e){if(_0x4cd7d3[_0xee0a('0x44')]['id']){delete _0x4cd7d3[_0xee0a('0x44')]['id'];}return db[_0xee0a('0x27')][_0xee0a('0x46')]({'where':{'id':_0x4cd7d3[_0xee0a('0x40')]['id']}})[_0xee0a('0x1f')](handleEntityNotFound(_0x51300e,null))[_0xee0a('0x1f')](saveUpdates(_0x4cd7d3[_0xee0a('0x44')],null))[_0xee0a('0x1f')](respondWithResult(_0x51300e,null))[_0xee0a('0x42')](handleError(_0x51300e,null));};exports[_0xee0a('0x20')]=function(_0x335356,_0x57face){return db[_0xee0a('0x27')][_0xee0a('0x46')]({'where':{'id':_0x335356[_0xee0a('0x40')]['id']}})[_0xee0a('0x1f')](handleEntityNotFound(_0x57face,null))[_0xee0a('0x1f')](removeEntity(_0x57face,null))['catch'](handleError(_0x57face,null));};exports[_0xee0a('0x47')]=function(_0x160123,_0xc9c3a3){return db[_0xee0a('0x27')][_0xee0a('0x47')]()['then'](respondWithResult(_0xc9c3a3,null))[_0xee0a('0x42')](handleError(_0xc9c3a3,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2b7e2f0..f00f463 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x261408,_0x213155){var _0x41cd82=function(_0x2135d8){while(--_0x2135d8){_0x261408['push'](_0x261408['shift']());}};_0x41cd82(++_0x213155);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x501eaf,_0x48b211){var _0x15c5b1=function(_0x4d7d1d){while(--_0x4d7d1d){_0x501eaf['push'](_0x501eaf['shift']());}};_0x15c5b1(++_0x48b211);}(_0x7a54,0x106));var _0x47a5=function(_0x20b406,_0x52c9f4){_0x20b406=_0x20b406-0x0;var _0x1ccf53=_0x7a54[_0x20b406];return _0x1ccf53;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index e8ebe65..7bdb560 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 _0xbfac=['request\x20sent','error','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Cdr,\x20%s,\x20%s'];(function(_0xb6c6f1,_0x12fa19){var _0xb8552f=function(_0x3b2dc7){while(--_0x3b2dc7){_0xb6c6f1['push'](_0xb6c6f1['shift']());}};_0xb8552f(++_0x12fa19);}(_0xbfac,0x110));var _0xcbfa=function(_0xff3bc2,_0x1d1b8e){_0xff3bc2=_0xff3bc2-0x0;var _0x18b857=_0xbfac[_0xff3bc2];return _0x18b857;};'use strict';var _=require('lodash');var util=require(_0xcbfa('0x0'));var moment=require(_0xcbfa('0x1'));var BPromise=require(_0xcbfa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbfa('0x3'));var db=require(_0xcbfa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbfa('0x5'))(_0xcbfa('0x6'));var config=require(_0xcbfa('0x7'));var jayson=require(_0xcbfa('0x8'));var client=jayson[_0xcbfa('0x9')][_0xcbfa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x241c96,_0x25426a,_0x3e7494){return new BPromise(function(_0x395361,_0x19127a){return client[_0xcbfa('0xb')](_0x241c96,_0x3e7494)['then'](function(_0x49543f){logger['info'](_0xcbfa('0xc'),_0x25426a,_0xcbfa('0xd'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x25426a,'request\x20sent',JSON['stringify'](_0x49543f));if(_0x49543f['error']){if(_0x49543f[_0xcbfa('0xe')]['code']===0x1f4){logger['error'](_0xcbfa('0xc'),_0x25426a,_0x49543f[_0xcbfa('0xe')]['message']);return _0x19127a(_0x49543f[_0xcbfa('0xe')][_0xcbfa('0xf')]);}logger['error'](_0xcbfa('0xc'),_0x25426a,_0x49543f[_0xcbfa('0xe')][_0xcbfa('0xf')]);return _0x395361(_0x49543f[_0xcbfa('0xe')][_0xcbfa('0xf')]);}else{logger[_0xcbfa('0x10')](_0xcbfa('0xc'),_0x25426a,_0xcbfa('0xd'));_0x395361(_0x49543f[_0xcbfa('0x11')][_0xcbfa('0xf')]);}})[_0xcbfa('0x12')](function(_0xe56d5d){logger[_0xcbfa('0xe')](_0xcbfa('0xc'),_0x25426a,_0xe56d5d);_0x19127a(_0xe56d5d);});});} \ No newline at end of file +var _0xf1f9=['debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','Cdr,\x20%s,\x20%s','request\x20sent'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xf1f9,0x153));var _0x9f1f=function(_0x1bf77e,_0x3e3daa){_0x1bf77e=_0x1bf77e-0x0;var _0x33473d=_0xf1f9[_0x1bf77e];return _0x33473d;};'use strict';var _=require(_0x9f1f('0x0'));var util=require(_0x9f1f('0x1'));var moment=require(_0x9f1f('0x2'));var BPromise=require(_0x9f1f('0x3'));var rs=require(_0x9f1f('0x4'));var fs=require('fs');var Redis=require(_0x9f1f('0x5'));var db=require(_0x9f1f('0x6'))['db'];var utils=require(_0x9f1f('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x9f1f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9f1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x123f17,_0x15ecad,_0x41c687){return new BPromise(function(_0x258f43,_0x2aa253){return client[_0x9f1f('0xa')](_0x123f17,_0x41c687)['then'](function(_0x3a0bb8){logger['info'](_0x9f1f('0xb'),_0x15ecad,_0x9f1f('0xc'));logger[_0x9f1f('0xd')](_0x9f1f('0xe'),_0x15ecad,_0x9f1f('0xc'),JSON[_0x9f1f('0xf')](_0x3a0bb8));if(_0x3a0bb8['error']){if(_0x3a0bb8[_0x9f1f('0x10')][_0x9f1f('0x11')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x15ecad,_0x3a0bb8['error'][_0x9f1f('0x12')]);return _0x2aa253(_0x3a0bb8['error'][_0x9f1f('0x12')]);}logger[_0x9f1f('0x10')](_0x9f1f('0xb'),_0x15ecad,_0x3a0bb8[_0x9f1f('0x10')][_0x9f1f('0x12')]);return _0x258f43(_0x3a0bb8[_0x9f1f('0x10')]['message']);}else{logger[_0x9f1f('0x13')](_0x9f1f('0xb'),_0x15ecad,'request\x20sent');_0x258f43(_0x3a0bb8[_0x9f1f('0x14')][_0x9f1f('0x12')]);}})[_0x9f1f('0x15')](function(_0x37ee03){logger['error']('Cdr,\x20%s,\x20%s',_0x15ecad,_0x37ee03);_0x2aa253(_0x37ee03);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 539ba14..3910d4c 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x25a972,_0x5d2fcd){var _0x24ad56=function(_0x3d0e5f){while(--_0x3d0e5f){_0x25a972['push'](_0x25a972['shift']());}};_0x24ad56(++_0x5d2fcd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x325111,_0x5a9c59){var _0x34362d=function(_0x24e95a){while(--_0x24e95a){_0x325111['push'](_0x325111['shift']());}};_0x34362d(++_0x5a9c59);}(_0xb10b,0x12a));var _0xbb10=function(_0x1399d6,_0x2c1661){_0x1399d6=_0x1399d6-0x0;var _0x4a9db4=_0xb10b[_0x1399d6];return _0x4a9db4;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index d4175fc..59259fe 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 _0xd0fe=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0xd0fe,0x1f2));var _0xed0f=function(_0x362ba1,_0x55f987){_0x362ba1=_0x362ba1-0x0;var _0x4977e7=_0xd0fe[_0x362ba1];return _0x4977e7;};'use strict';var Sequelize=require(_0xed0f('0x0'));module[_0xed0f('0x1')]={'priority':{'type':Sequelize[_0xed0f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xed0f('0x3')],'allowNull':![],'defaultValue':_0xed0f('0x4')},'appdata':{'type':Sequelize[_0xed0f('0x5')]()},'description':{'type':Sequelize[_0xed0f('0x3')]},'interval':{'type':Sequelize[_0xed0f('0x3')],'defaultValue':_0xed0f('0x6')}}; \ No newline at end of file +var _0x04d0=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x2800ea,_0x54d58a){var _0x3d37aa=function(_0x13251c){while(--_0x13251c){_0x2800ea['push'](_0x2800ea['shift']());}};_0x3d37aa(++_0x54d58a);}(_0x04d0,0x7e));var _0x004d=function(_0x1b7433,_0x3f4f45){_0x1b7433=_0x1b7433-0x0;var _0x2b116f=_0x04d0[_0x1b7433];return _0x2b116f;};'use strict';var Sequelize=require(_0x004d('0x0'));module[_0x004d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x004d('0x2')],'allowNull':![],'defaultValue':_0x004d('0x3')},'appdata':{'type':Sequelize[_0x004d('0x4')]()},'description':{'type':Sequelize[_0x004d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x004d('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 18d8a5a..6380806 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 _0x3ae9=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','stack','name','send','show','params','model','query','filters','attributes','intersection','fields','length','includeAll','include','merge','ChatApplication','catch','body','find','destroy','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x252884,_0x117ddf){var _0x4de0e6=function(_0x442519){while(--_0x442519){_0x252884['push'](_0x252884['shift']());}};_0x4de0e6(++_0x117ddf);}(_0x3ae9,0xdb));var _0x93ae=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x3ae9[_0x376b45];return _0x2341b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x93ae('0x0'));var jsonpatch=require(_0x93ae('0x1'));var rp=require(_0x93ae('0x2'));var moment=require('moment');var BPromise=require(_0x93ae('0x3'));var Mustache=require(_0x93ae('0x4'));var util=require(_0x93ae('0x5'));var path=require(_0x93ae('0x6'));var sox=require('sox');var csv=require(_0x93ae('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x93ae('0x8'));var _=require(_0x93ae('0x9'));var squel=require(_0x93ae('0xa'));var crypto=require(_0x93ae('0xb'));var jsforce=require(_0x93ae('0xc'));var deskjs=require(_0x93ae('0xd'));var toCsv=require('to-csv');var querystring=require(_0x93ae('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x93ae('0xf'));var as=require(_0x93ae('0x10'));var hardwareService=require(_0x93ae('0x11'));var logger=require(_0x93ae('0x12'))(_0x93ae('0x13'));var utils=require(_0x93ae('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x93ae('0x15'))['db'];function respondWithStatusCode(_0x1a23a3,_0x4a9f52){_0x4a9f52=_0x4a9f52||0xcc;return function(_0x571e5f){if(_0x571e5f){return _0x1a23a3[_0x93ae('0x16')](_0x4a9f52);}return _0x1a23a3['status'](_0x4a9f52)[_0x93ae('0x17')]();};}function respondWithResult(_0xbaf0e,_0x5b4ea1){_0x5b4ea1=_0x5b4ea1||0xc8;return function(_0x392a55){if(_0x392a55){return _0xbaf0e[_0x93ae('0x18')](_0x5b4ea1)[_0x93ae('0x19')](_0x392a55);}};}function respondWithFilteredResult(_0x1f8aa2,_0x121937){return function(_0x2d1df5){if(_0x2d1df5){var _0x5ed82a=typeof _0x121937[_0x93ae('0x1a')]===_0x93ae('0x1b')&&typeof _0x121937[_0x93ae('0x1c')]==='undefined';var _0x1a1718=_0x2d1df5['count'];var _0x54cfd0=_0x5ed82a?0x0:_0x121937[_0x93ae('0x1a')];var _0x51c77d=_0x5ed82a?_0x2d1df5[_0x93ae('0x1d')]:_0x121937[_0x93ae('0x1a')]+_0x121937['limit'];var _0x2dd19a;if(_0x51c77d>=_0x1a1718){_0x51c77d=_0x1a1718;_0x2dd19a=0xc8;}else{_0x2dd19a=0xce;}_0x1f8aa2[_0x93ae('0x18')](_0x2dd19a);return _0x1f8aa2[_0x93ae('0x1e')](_0x93ae('0x1f'),_0x54cfd0+'-'+_0x51c77d+'/'+_0x1a1718)['json'](_0x2d1df5);}return null;};}function patchUpdates(_0x128913){return function(_0x2f4187){try{jsonpatch['apply'](_0x2f4187,_0x128913,!![]);}catch(_0x3e0407){return BPromise[_0x93ae('0x20')](_0x3e0407);}return _0x2f4187[_0x93ae('0x21')]();};}function saveUpdates(_0x29922f,_0x26d5ac){return function(_0x468fdf){if(_0x468fdf){return _0x468fdf[_0x93ae('0x22')](_0x29922f)['then'](function(_0x5e7c32){return _0x5e7c32;});}return null;};}function removeEntity(_0xd33af5,_0x283e50){return function(_0x4f9f43){if(_0x4f9f43){return _0x4f9f43['destroy']()[_0x93ae('0x23')](function(){_0xd33af5[_0x93ae('0x18')](0xcc)[_0x93ae('0x17')]();});}};}function handleEntityNotFound(_0x10f6a3,_0x1abea7){return function(_0xe17086){if(!_0xe17086){_0x10f6a3[_0x93ae('0x16')](0x194);}return _0xe17086;};}function handleError(_0x32ddca,_0x542656){_0x542656=_0x542656||0x1f4;return function(_0x564c15){logger['error'](_0x564c15[_0x93ae('0x24')]);if(_0x564c15[_0x93ae('0x25')]){delete _0x564c15[_0x93ae('0x25')];}_0x32ddca[_0x93ae('0x18')](_0x542656)[_0x93ae('0x26')](_0x564c15);};}exports[_0x93ae('0x27')]=function(_0x520d6d,_0x54a37b){var _0x223f42={'raw':!![],'where':{'id':_0x520d6d[_0x93ae('0x28')]['id']}},_0x115ac5={};_0x115ac5[_0x93ae('0x29')]=_['keys'](db['ChatApplication']['rawAttributes']);_0x115ac5[_0x93ae('0x2a')]=_['keys'](_0x520d6d[_0x93ae('0x2a')]);_0x115ac5[_0x93ae('0x2b')]=_['intersection'](_0x115ac5[_0x93ae('0x29')],_0x115ac5[_0x93ae('0x2a')]);_0x223f42[_0x93ae('0x2c')]=_[_0x93ae('0x2d')](_0x115ac5[_0x93ae('0x29')],qs[_0x93ae('0x2e')](_0x520d6d[_0x93ae('0x2a')][_0x93ae('0x2e')]));_0x223f42['attributes']=_0x223f42[_0x93ae('0x2c')][_0x93ae('0x2f')]?_0x223f42[_0x93ae('0x2c')]:_0x115ac5[_0x93ae('0x29')];if(_0x520d6d[_0x93ae('0x2a')][_0x93ae('0x30')]){_0x223f42[_0x93ae('0x31')]=[{'all':!![]}];}_0x223f42=_[_0x93ae('0x32')]({},_0x223f42,_0x520d6d['options']);return db[_0x93ae('0x33')]['find'](_0x223f42)[_0x93ae('0x23')](handleEntityNotFound(_0x54a37b,null))[_0x93ae('0x23')](respondWithResult(_0x54a37b,null))[_0x93ae('0x34')](handleError(_0x54a37b,null));};exports[_0x93ae('0x22')]=function(_0x1778f7,_0x46ade5){if(_0x1778f7['body']['id']){delete _0x1778f7[_0x93ae('0x35')]['id'];}return db[_0x93ae('0x33')][_0x93ae('0x36')]({'where':{'id':_0x1778f7['params']['id']}})[_0x93ae('0x23')](handleEntityNotFound(_0x46ade5,null))[_0x93ae('0x23')](saveUpdates(_0x1778f7[_0x93ae('0x35')],null))['then'](respondWithResult(_0x46ade5,null))['catch'](handleError(_0x46ade5,null));};exports[_0x93ae('0x37')]=function(_0x266126,_0x31e9b0){return db[_0x93ae('0x33')][_0x93ae('0x36')]({'where':{'id':_0x266126[_0x93ae('0x28')]['id']}})[_0x93ae('0x23')](handleEntityNotFound(_0x31e9b0,null))[_0x93ae('0x23')](removeEntity(_0x31e9b0,null))[_0x93ae('0x34')](handleError(_0x31e9b0,null));}; \ No newline at end of file +var _0x30fe=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','count','status','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','includeAll','merge','options','find','catch','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x30fe,0x149));var _0xe30f=function(_0x3871a0,_0x435b1c){_0x3871a0=_0x3871a0-0x0;var _0x44e180=_0x30fe[_0x3871a0];return _0x44e180;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe30f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe30f('0x1'));var rp=require('request-promise');var moment=require(_0xe30f('0x2'));var BPromise=require(_0xe30f('0x3'));var Mustache=require(_0xe30f('0x4'));var util=require(_0xe30f('0x5'));var path=require(_0xe30f('0x6'));var sox=require('sox');var csv=require(_0xe30f('0x7'));var ejs=require(_0xe30f('0x8'));var fs=require('fs');var fs_extra=require(_0xe30f('0x9'));var _=require(_0xe30f('0xa'));var squel=require(_0xe30f('0xb'));var crypto=require(_0xe30f('0xc'));var jsforce=require(_0xe30f('0xd'));var deskjs=require(_0xe30f('0xe'));var toCsv=require(_0xe30f('0x7'));var querystring=require(_0xe30f('0xf'));var Papa=require('papaparse');var Redis=require(_0xe30f('0x10'));var authService=require(_0xe30f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe30f('0x12'));var hardwareService=require(_0xe30f('0x13'));var logger=require(_0xe30f('0x14'))(_0xe30f('0x15'));var utils=require('../../config/utils');var config=require(_0xe30f('0x16'));var licenseUtil=require(_0xe30f('0x17'));var db=require(_0xe30f('0x18'))['db'];function respondWithStatusCode(_0x583eb9,_0x3859df){_0x3859df=_0x3859df||0xcc;return function(_0x19970e){if(_0x19970e){return _0x583eb9[_0xe30f('0x19')](_0x3859df);}return _0x583eb9['status'](_0x3859df)[_0xe30f('0x1a')]();};}function respondWithResult(_0x460e07,_0x122e2a){_0x122e2a=_0x122e2a||0xc8;return function(_0x7d684c){if(_0x7d684c){return _0x460e07['status'](_0x122e2a)['json'](_0x7d684c);}};}function respondWithFilteredResult(_0x5ac4b2,_0x3c9680){return function(_0x494ad3){if(_0x494ad3){var _0x2b6a9b=typeof _0x3c9680[_0xe30f('0x1b')]==='undefined'&&typeof _0x3c9680[_0xe30f('0x1c')]==='undefined';var _0x2dbb2b=_0x494ad3[_0xe30f('0x1d')];var _0x406c98=_0x2b6a9b?0x0:_0x3c9680[_0xe30f('0x1b')];var _0x17024a=_0x2b6a9b?_0x494ad3['count']:_0x3c9680['offset']+_0x3c9680[_0xe30f('0x1c')];var _0x535873;if(_0x17024a>=_0x2dbb2b){_0x17024a=_0x2dbb2b;_0x535873=0xc8;}else{_0x535873=0xce;}_0x5ac4b2[_0xe30f('0x1e')](_0x535873);return _0x5ac4b2['set'](_0xe30f('0x1f'),_0x406c98+'-'+_0x17024a+'/'+_0x2dbb2b)[_0xe30f('0x20')](_0x494ad3);}return null;};}function patchUpdates(_0x2c4d1f){return function(_0x2a0432){try{jsonpatch[_0xe30f('0x21')](_0x2a0432,_0x2c4d1f,!![]);}catch(_0x5b33fa){return BPromise[_0xe30f('0x22')](_0x5b33fa);}return _0x2a0432['save']();};}function saveUpdates(_0xf66c5a,_0x5af7b5){return function(_0x322ee0){if(_0x322ee0){return _0x322ee0[_0xe30f('0x23')](_0xf66c5a)[_0xe30f('0x24')](function(_0x42833a){return _0x42833a;});}return null;};}function removeEntity(_0x7f7b1f,_0x378d6f){return function(_0x50bca4){if(_0x50bca4){return _0x50bca4[_0xe30f('0x25')]()['then'](function(){_0x7f7b1f[_0xe30f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d4fbe,_0x4fc220){return function(_0x11a539){if(!_0x11a539){_0x4d4fbe['sendStatus'](0x194);}return _0x11a539;};}function handleError(_0x412015,_0x25e3cf){_0x25e3cf=_0x25e3cf||0x1f4;return function(_0x37c716){logger[_0xe30f('0x26')](_0x37c716[_0xe30f('0x27')]);if(_0x37c716[_0xe30f('0x28')]){delete _0x37c716['name'];}_0x412015[_0xe30f('0x1e')](_0x25e3cf)[_0xe30f('0x29')](_0x37c716);};}exports['show']=function(_0x15a217,_0x2d67d4){var _0x5a6cc3={'raw':!![],'where':{'id':_0x15a217['params']['id']}},_0x500626={};_0x500626[_0xe30f('0x2a')]=_[_0xe30f('0x2b')](db[_0xe30f('0x2c')][_0xe30f('0x2d')]);_0x500626[_0xe30f('0x2e')]=_[_0xe30f('0x2b')](_0x15a217['query']);_0x500626[_0xe30f('0x2f')]=_['intersection'](_0x500626[_0xe30f('0x2a')],_0x500626[_0xe30f('0x2e')]);_0x5a6cc3[_0xe30f('0x30')]=_[_0xe30f('0x31')](_0x500626['model'],qs[_0xe30f('0x32')](_0x15a217[_0xe30f('0x2e')][_0xe30f('0x32')]));_0x5a6cc3['attributes']=_0x5a6cc3[_0xe30f('0x30')]['length']?_0x5a6cc3[_0xe30f('0x30')]:_0x500626[_0xe30f('0x2a')];if(_0x15a217[_0xe30f('0x2e')][_0xe30f('0x33')]){_0x5a6cc3['include']=[{'all':!![]}];}_0x5a6cc3=_[_0xe30f('0x34')]({},_0x5a6cc3,_0x15a217[_0xe30f('0x35')]);return db[_0xe30f('0x2c')][_0xe30f('0x36')](_0x5a6cc3)[_0xe30f('0x24')](handleEntityNotFound(_0x2d67d4,null))[_0xe30f('0x24')](respondWithResult(_0x2d67d4,null))[_0xe30f('0x37')](handleError(_0x2d67d4,null));};exports['update']=function(_0x139915,_0xcc659c){if(_0x139915[_0xe30f('0x38')]['id']){delete _0x139915['body']['id'];}return db[_0xe30f('0x2c')][_0xe30f('0x36')]({'where':{'id':_0x139915['params']['id']}})[_0xe30f('0x24')](handleEntityNotFound(_0xcc659c,null))['then'](saveUpdates(_0x139915[_0xe30f('0x38')],null))['then'](respondWithResult(_0xcc659c,null))['catch'](handleError(_0xcc659c,null));};exports['destroy']=function(_0xf09327,_0x86fbbc){return db['ChatApplication'][_0xe30f('0x36')]({'where':{'id':_0xf09327['params']['id']}})[_0xe30f('0x24')](handleEntityNotFound(_0x86fbbc,null))[_0xe30f('0x24')](removeEntity(_0x86fbbc,null))[_0xe30f('0x37')](handleError(_0x86fbbc,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index d88ae86..ad11634 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 _0x71e2=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','path','../../config/environment','./chatApplication.attributes','exports'];(function(_0x366388,_0x4595a6){var _0x41c97e=function(_0x4b9fff){while(--_0x4b9fff){_0x366388['push'](_0x366388['shift']());}};_0x41c97e(++_0x4595a6);}(_0x71e2,0x1c0));var _0x271e=function(_0x1712c9,_0x4cd577){_0x1712c9=_0x1712c9-0x0;var _0x4097e9=_0x71e2[_0x1712c9];return _0x4097e9;};'use strict';var _=require('lodash');var util=require(_0x271e('0x0'));var logger=require('../../config/logger')(_0x271e('0x1'));var moment=require(_0x271e('0x2'));var BPromise=require(_0x271e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x271e('0x4'));var rimraf=require('rimraf');var config=require(_0x271e('0x5'));var attributes=require(_0x271e('0x6'));module[_0x271e('0x7')]=function(_0x147b7f,_0x55ac72){return _0x147b7f['define'](_0x271e('0x8'),attributes,{'tableName':_0x271e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x271e('0xa'),'collate':_0x271e('0xb')});}; \ No newline at end of file +var _0x27e6=['ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x14f78e,_0x9b82f5){var _0x20fa1c=function(_0x591bf1){while(--_0x591bf1){_0x14f78e['push'](_0x14f78e['shift']());}};_0x20fa1c(++_0x9b82f5);}(_0x27e6,0x121));var _0x627e=function(_0x11a7bd,_0x3126ac){_0x11a7bd=_0x11a7bd-0x0;var _0x3418a2=_0x27e6[_0x11a7bd];return _0x3418a2;};'use strict';var _=require(_0x627e('0x0'));var util=require(_0x627e('0x1'));var logger=require(_0x627e('0x2'))(_0x627e('0x3'));var moment=require(_0x627e('0x4'));var BPromise=require('bluebird');var rp=require(_0x627e('0x5'));var fs=require('fs');var path=require(_0x627e('0x6'));var rimraf=require(_0x627e('0x7'));var config=require(_0x627e('0x8'));var attributes=require('./chatApplication.attributes');module[_0x627e('0x9')]=function(_0x480c11,_0x516027){return _0x480c11[_0x627e('0xa')](_0x627e('0xb'),attributes,{'tableName':_0x627e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x627e('0xd'),'collate':_0x627e('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index c8e032b..64bf0d7 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 _0x6e03=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','util','moment','bluebird','randomstring'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x6e03,0xa7));var _0x36e0=function(_0x180a58,_0x2e70f5){_0x180a58=_0x180a58-0x0;var _0xc40946=_0x6e03[_0x180a58];return _0xc40946;};'use strict';var _=require('lodash');var util=require(_0x36e0('0x0'));var moment=require(_0x36e0('0x1'));var BPromise=require(_0x36e0('0x2'));var rs=require(_0x36e0('0x3'));var fs=require('fs');var Redis=require(_0x36e0('0x4'));var db=require(_0x36e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x36e0('0x6'))('rpc');var config=require(_0x36e0('0x7'));var jayson=require(_0x36e0('0x8'));var client=jayson[_0x36e0('0x9')][_0x36e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f54d5,_0x3125b4,_0xc07829){return new BPromise(function(_0x3e7571,_0xa7144c){return client['request'](_0x3f54d5,_0xc07829)[_0x36e0('0xb')](function(_0x2295b9){logger['info'](_0x36e0('0xc'),_0x3125b4,_0x36e0('0xd'));logger[_0x36e0('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x3125b4,'request\x20sent',JSON['stringify'](_0x2295b9));if(_0x2295b9[_0x36e0('0xf')]){if(_0x2295b9['error']['code']===0x1f4){logger[_0x36e0('0xf')](_0x36e0('0xc'),_0x3125b4,_0x2295b9[_0x36e0('0xf')][_0x36e0('0x10')]);return _0xa7144c(_0x2295b9[_0x36e0('0xf')][_0x36e0('0x10')]);}logger[_0x36e0('0xf')](_0x36e0('0xc'),_0x3125b4,_0x2295b9[_0x36e0('0xf')]['message']);return _0x3e7571(_0x2295b9['error'][_0x36e0('0x10')]);}else{logger[_0x36e0('0x11')]('ChatApplication,\x20%s,\x20%s',_0x3125b4,'request\x20sent');_0x3e7571(_0x2295b9[_0x36e0('0x12')][_0x36e0('0x10')]);}})['catch'](function(_0x5372f9){logger['error']('ChatApplication,\x20%s,\x20%s',_0x3125b4,_0x5372f9);_0xa7144c(_0x5372f9);});});} \ No newline at end of file +var _0x0fe0=['../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','ChatApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1e46d8,_0x44fe74){var _0x52bd0f=function(_0x30e28a){while(--_0x30e28a){_0x1e46d8['push'](_0x1e46d8['shift']());}};_0x52bd0f(++_0x44fe74);}(_0x0fe0,0x133));var _0x00fe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0fe0[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x00fe('0x0'));var util=require(_0x00fe('0x1'));var moment=require(_0x00fe('0x2'));var BPromise=require(_0x00fe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00fe('0x4'));var db=require(_0x00fe('0x5'))['db'];var utils=require(_0x00fe('0x6'));var logger=require('../../config/logger')(_0x00fe('0x7'));var config=require(_0x00fe('0x8'));var jayson=require(_0x00fe('0x9'));var client=jayson[_0x00fe('0xa')][_0x00fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x144d2d,_0x21f9f1,_0x2bec27){return new BPromise(function(_0x23540b,_0x36232f){return client[_0x00fe('0xc')](_0x144d2d,_0x2bec27)['then'](function(_0x3a3a36){logger[_0x00fe('0xd')]('ChatApplication,\x20%s,\x20%s',_0x21f9f1,_0x00fe('0xe'));logger[_0x00fe('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x21f9f1,_0x00fe('0xe'),JSON[_0x00fe('0x10')](_0x3a3a36));if(_0x3a3a36[_0x00fe('0x11')]){if(_0x3a3a36[_0x00fe('0x11')]['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x21f9f1,_0x3a3a36[_0x00fe('0x11')]['message']);return _0x36232f(_0x3a3a36[_0x00fe('0x11')]['message']);}logger[_0x00fe('0x11')](_0x00fe('0x12'),_0x21f9f1,_0x3a3a36[_0x00fe('0x11')][_0x00fe('0x13')]);return _0x23540b(_0x3a3a36[_0x00fe('0x11')]['message']);}else{logger[_0x00fe('0xd')](_0x00fe('0x12'),_0x21f9f1,_0x00fe('0xe'));_0x23540b(_0x3a3a36['result'][_0x00fe('0x13')]);}})[_0x00fe('0x14')](function(_0xb17a67){logger['error'](_0x00fe('0x12'),_0x21f9f1,_0xb17a67);_0x36232f(_0xb17a67);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index b3bd625..374f68f 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 _0x93a7=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x93a7,0x75));var _0x793a=function(_0x472056,_0x5d2d46){_0x472056=_0x472056-0x0;var _0x5ded8b=_0x93a7[_0x472056];return _0x5ded8b;};'use strict';var multer=require('multer');var util=require(_0x793a('0x0'));var path=require(_0x793a('0x1'));var timeout=require(_0x793a('0x2'));var express=require(_0x793a('0x3'));var router=express[_0x793a('0x4')]();var fs_extra=require(_0x793a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x793a('0x6'));var config=require(_0x793a('0x7'));var controller=require(_0x793a('0x8'));router['get'](_0x793a('0x9'),auth[_0x793a('0xa')](),controller[_0x793a('0xb')]);router[_0x793a('0xc')](_0x793a('0x9'),auth[_0x793a('0xa')](),controller[_0x793a('0xd')]);router[_0x793a('0xe')](_0x793a('0x9'),auth[_0x793a('0xa')](),controller[_0x793a('0xf')]);module[_0x793a('0x10')]=router; \ No newline at end of file +var _0x3740=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','put','delete','/:id','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x126d3b,_0x5c6195){var _0x136fe3=function(_0x555633){while(--_0x555633){_0x126d3b['push'](_0x126d3b['shift']());}};_0x136fe3(++_0x5c6195);}(_0x3740,0xcc));var _0x0374=function(_0x4855fa,_0x490cf3){_0x4855fa=_0x4855fa-0x0;var _0x4b7a91=_0x3740[_0x4855fa];return _0x4b7a91;};'use strict';var multer=require(_0x0374('0x0'));var util=require(_0x0374('0x1'));var path=require(_0x0374('0x2'));var timeout=require(_0x0374('0x3'));var express=require('express');var router=express[_0x0374('0x4')]();var fs_extra=require(_0x0374('0x5'));var auth=require(_0x0374('0x6'));var interaction=require(_0x0374('0x7'));var config=require(_0x0374('0x8'));var controller=require('./chatApplication.controller');router[_0x0374('0x9')]('/:id',auth[_0x0374('0xa')](),controller['show']);router[_0x0374('0xb')]('/:id',auth[_0x0374('0xa')](),controller['update']);router[_0x0374('0xc')](_0x0374('0xd'),auth[_0x0374('0xa')](),controller['destroy']);module[_0x0374('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 22d4d9e..20fe260 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 _0xb778=['sequelize','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb778,0x1c8));var _0x8b77=function(_0x2c90c1,_0x446eda){_0x2c90c1=_0x2c90c1-0x0;var _0xcb55d4=_0xb778[_0x2c90c1];return _0xcb55d4;};'use strict';var Sequelize=require(_0x8b77('0x0'));module['exports']={'name':{'type':Sequelize[_0x8b77('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x7097=['exports','STRING','sequelize'];(function(_0x4e813f,_0x301c69){var _0x49c4f1=function(_0x84ac36){while(--_0x84ac36){_0x4e813f['push'](_0x4e813f['shift']());}};_0x49c4f1(++_0x301c69);}(_0x7097,0x1be));var _0x7709=function(_0x18de0f,_0x4c40e5){_0x18de0f=_0x18de0f-0x0;var _0x16ab8e=_0x7097[_0x18de0f];return _0x16ab8e;};'use strict';var Sequelize=require(_0x7709('0x0'));module[_0x7709('0x1')]={'name':{'type':Sequelize[_0x7709('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 34011c9..8194735 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 _0xa7b9=['destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','redis','register','sendStatus','end','json','offset','undefined','count','limit','status','set','save','update','then'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa7b9,0x154));var _0x9a7b=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0xa7b9[_0xed5f9c];return _0x3a1c43;};'use strict';var emlformat=require(_0x9a7b('0x0'));var rimraf=require(_0x9a7b('0x1'));var zipdir=require(_0x9a7b('0x2'));var jsonpatch=require(_0x9a7b('0x3'));var rp=require(_0x9a7b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9a7b('0x5'));var util=require(_0x9a7b('0x6'));var path=require(_0x9a7b('0x7'));var sox=require(_0x9a7b('0x8'));var csv=require(_0x9a7b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a7b('0xa'));var _=require(_0x9a7b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9a7b('0xc'));var deskjs=require(_0x9a7b('0xd'));var toCsv=require(_0x9a7b('0x9'));var querystring=require(_0x9a7b('0xe'));var Papa=require(_0x9a7b('0xf'));var Redis=require(_0x9a7b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9a7b('0x11'));var as=require(_0x9a7b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a7b('0x13'))(_0x9a7b('0x14'));var utils=require(_0x9a7b('0x15'));var config=require(_0x9a7b('0x16'));var licenseUtil=require(_0x9a7b('0x17'));var db=require(_0x9a7b('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x9a7b('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a7b('0x1a')]));require('./chatGroup.socket')[_0x9a7b('0x1b')](socket);function respondWithStatusCode(_0x14b5f6,_0x29ae7a){_0x29ae7a=_0x29ae7a||0xcc;return function(_0x47065c){if(_0x47065c){return _0x14b5f6[_0x9a7b('0x1c')](_0x29ae7a);}return _0x14b5f6['status'](_0x29ae7a)[_0x9a7b('0x1d')]();};}function respondWithResult(_0xa830ad,_0x39b855){_0x39b855=_0x39b855||0xc8;return function(_0x1f5fd3){if(_0x1f5fd3){return _0xa830ad['status'](_0x39b855)[_0x9a7b('0x1e')](_0x1f5fd3);}};}function respondWithFilteredResult(_0x6c62e9,_0x1b1a37){return function(_0x40ecdc){if(_0x40ecdc){var _0x5217ab=typeof _0x1b1a37[_0x9a7b('0x1f')]===_0x9a7b('0x20')&&typeof _0x1b1a37['limit']===_0x9a7b('0x20');var _0x192466=_0x40ecdc['count'];var _0x35f3f2=_0x5217ab?0x0:_0x1b1a37['offset'];var _0x9731be=_0x5217ab?_0x40ecdc[_0x9a7b('0x21')]:_0x1b1a37[_0x9a7b('0x1f')]+_0x1b1a37[_0x9a7b('0x22')];var _0x1e8dd2;if(_0x9731be>=_0x192466){_0x9731be=_0x192466;_0x1e8dd2=0xc8;}else{_0x1e8dd2=0xce;}_0x6c62e9[_0x9a7b('0x23')](_0x1e8dd2);return _0x6c62e9[_0x9a7b('0x24')]('Content-Range',_0x35f3f2+'-'+_0x9731be+'/'+_0x192466)[_0x9a7b('0x1e')](_0x40ecdc);}return null;};}function patchUpdates(_0x26f52e){return function(_0x40eca6){try{jsonpatch['apply'](_0x40eca6,_0x26f52e,!![]);}catch(_0x34c059){return BPromise['reject'](_0x34c059);}return _0x40eca6[_0x9a7b('0x25')]();};}function saveUpdates(_0x4f4870,_0x2332f4){return function(_0x43e53d){if(_0x43e53d){return _0x43e53d[_0x9a7b('0x26')](_0x4f4870)[_0x9a7b('0x27')](function(_0x3e3a6e){return _0x3e3a6e;});}return null;};}function removeEntity(_0x4c606a,_0x48fa1c){return function(_0x28e71a){if(_0x28e71a){return _0x28e71a[_0x9a7b('0x28')]()[_0x9a7b('0x27')](function(){_0x4c606a['status'](0xcc)[_0x9a7b('0x1d')]();});}};}function handleEntityNotFound(_0x5cb6b7,_0x2b86a4){return function(_0x1cc563){if(!_0x1cc563){_0x5cb6b7[_0x9a7b('0x1c')](0x194);}return _0x1cc563;};}function handleError(_0x5569b1,_0x1ca3ad){_0x1ca3ad=_0x1ca3ad||0x1f4;return function(_0x11adca){logger[_0x9a7b('0x29')](_0x11adca[_0x9a7b('0x2a')]);if(_0x11adca[_0x9a7b('0x2b')]){delete _0x11adca[_0x9a7b('0x2b')];}_0x5569b1[_0x9a7b('0x23')](_0x1ca3ad)[_0x9a7b('0x2c')](_0x11adca);};}exports[_0x9a7b('0x2d')]=function(_0x485fd9,_0x3c5394){var _0x1fd313={},_0x5371bf={},_0x28a26f={'count':0x0,'rows':[]};var _0x4776a2=_[_0x9a7b('0x2e')](db[_0x9a7b('0x2f')][_0x9a7b('0x30')],function(_0x22e76d){return{'name':_0x22e76d['fieldName'],'type':_0x22e76d[_0x9a7b('0x31')][_0x9a7b('0x32')]};});_0x5371bf[_0x9a7b('0x33')]=_[_0x9a7b('0x2e')](_0x4776a2,_0x9a7b('0x2b'));_0x5371bf[_0x9a7b('0x34')]=_[_0x9a7b('0x35')](_0x485fd9[_0x9a7b('0x34')]);_0x5371bf[_0x9a7b('0x36')]=_[_0x9a7b('0x37')](_0x5371bf[_0x9a7b('0x33')],_0x5371bf[_0x9a7b('0x34')]);_0x1fd313[_0x9a7b('0x38')]=_[_0x9a7b('0x37')](_0x5371bf['model'],qs[_0x9a7b('0x39')](_0x485fd9[_0x9a7b('0x34')][_0x9a7b('0x39')]));_0x1fd313[_0x9a7b('0x38')]=_0x1fd313['attributes'][_0x9a7b('0x3a')]?_0x1fd313[_0x9a7b('0x38')]:_0x5371bf[_0x9a7b('0x33')];if(!_0x485fd9[_0x9a7b('0x34')][_0x9a7b('0x3b')](_0x9a7b('0x3c'))){_0x1fd313[_0x9a7b('0x22')]=qs[_0x9a7b('0x22')](_0x485fd9[_0x9a7b('0x34')][_0x9a7b('0x22')]);_0x1fd313[_0x9a7b('0x1f')]=qs['offset'](_0x485fd9['query'][_0x9a7b('0x1f')]);}_0x1fd313[_0x9a7b('0x3d')]=qs[_0x9a7b('0x3e')](_0x485fd9[_0x9a7b('0x34')][_0x9a7b('0x3e')]);_0x1fd313[_0x9a7b('0x3f')]=qs['filters'](_[_0x9a7b('0x40')](_0x485fd9[_0x9a7b('0x34')],_0x5371bf[_0x9a7b('0x36')]),_0x4776a2);if(_0x485fd9[_0x9a7b('0x34')][_0x9a7b('0x41')]){_0x1fd313['where']=_[_0x9a7b('0x42')](_0x1fd313[_0x9a7b('0x3f')],{'$or':_[_0x9a7b('0x2e')](_0x4776a2,function(_0x2d6003){if(_0x2d6003['type']!=='VIRTUAL'){var _0x26e7a8={};_0x26e7a8[_0x2d6003['name']]={'$like':'%'+_0x485fd9[_0x9a7b('0x34')][_0x9a7b('0x41')]+'%'};return _0x26e7a8;}})});}_0x1fd313=_[_0x9a7b('0x42')]({},_0x1fd313,_0x485fd9[_0x9a7b('0x43')]);var _0x2526e4={'where':_0x1fd313['where']};return db[_0x9a7b('0x2f')][_0x9a7b('0x21')](_0x2526e4)[_0x9a7b('0x27')](function(_0x3225d8){_0x28a26f['count']=_0x3225d8;if(_0x485fd9[_0x9a7b('0x34')][_0x9a7b('0x44')]){_0x1fd313[_0x9a7b('0x45')]=[{'all':!![]}];}return db[_0x9a7b('0x2f')]['findAll'](_0x1fd313);})[_0x9a7b('0x27')](function(_0x5ab8f5){_0x28a26f[_0x9a7b('0x46')]=_0x5ab8f5;return _0x28a26f;})[_0x9a7b('0x27')](respondWithFilteredResult(_0x3c5394,_0x1fd313))['catch'](handleError(_0x3c5394,null));};exports[_0x9a7b('0x47')]=function(_0xd76ac7,_0x2fbdf0){var _0x4d558c={'raw':!![],'where':{'id':_0xd76ac7[_0x9a7b('0x48')]['id']}},_0x3c347f={};_0x3c347f[_0x9a7b('0x33')]=_[_0x9a7b('0x35')](db['ChatGroup'][_0x9a7b('0x30')]);_0x3c347f[_0x9a7b('0x34')]=_[_0x9a7b('0x35')](_0xd76ac7[_0x9a7b('0x34')]);_0x3c347f[_0x9a7b('0x36')]=_[_0x9a7b('0x37')](_0x3c347f['model'],_0x3c347f[_0x9a7b('0x34')]);_0x4d558c[_0x9a7b('0x38')]=_[_0x9a7b('0x37')](_0x3c347f[_0x9a7b('0x33')],qs[_0x9a7b('0x39')](_0xd76ac7[_0x9a7b('0x34')]['fields']));_0x4d558c[_0x9a7b('0x38')]=_0x4d558c['attributes'][_0x9a7b('0x3a')]?_0x4d558c['attributes']:_0x3c347f[_0x9a7b('0x33')];if(_0xd76ac7[_0x9a7b('0x34')]['includeAll']){_0x4d558c[_0x9a7b('0x45')]=[{'all':!![]}];}_0x4d558c=_[_0x9a7b('0x42')]({},_0x4d558c,_0xd76ac7[_0x9a7b('0x43')]);return db[_0x9a7b('0x2f')][_0x9a7b('0x49')](_0x4d558c)[_0x9a7b('0x27')](handleEntityNotFound(_0x2fbdf0,null))[_0x9a7b('0x27')](respondWithResult(_0x2fbdf0,null))[_0x9a7b('0x4a')](handleError(_0x2fbdf0,null));};exports[_0x9a7b('0x4b')]=function(_0x28add3,_0x1df749){return db[_0x9a7b('0x2f')][_0x9a7b('0x4b')](_0x28add3[_0x9a7b('0x4c')],{})[_0x9a7b('0x27')](respondWithResult(_0x1df749,0xc9))['catch'](handleError(_0x1df749,null));};exports[_0x9a7b('0x26')]=function(_0x3dcfd4,_0x2d6545){if(_0x3dcfd4['body']['id']){delete _0x3dcfd4['body']['id'];}return db[_0x9a7b('0x2f')]['find']({'where':{'id':_0x3dcfd4[_0x9a7b('0x48')]['id']}})[_0x9a7b('0x27')](handleEntityNotFound(_0x2d6545,null))[_0x9a7b('0x27')](saveUpdates(_0x3dcfd4[_0x9a7b('0x4c')],null))[_0x9a7b('0x27')](respondWithResult(_0x2d6545,null))['catch'](handleError(_0x2d6545,null));};exports[_0x9a7b('0x28')]=function(_0x247a98,_0x274be1){return db['ChatGroup'][_0x9a7b('0x49')]({'where':{'id':_0x247a98[_0x9a7b('0x48')]['id']}})[_0x9a7b('0x27')](handleEntityNotFound(_0x274be1,null))['then'](removeEntity(_0x274be1,null))[_0x9a7b('0x4a')](handleError(_0x274be1,null));};exports[_0x9a7b('0x4d')]=function(_0x492dbd,_0x22119b){return db[_0x9a7b('0x2f')][_0x9a7b('0x4d')]()[_0x9a7b('0x27')](respondWithResult(_0x22119b,null))[_0x9a7b('0x4a')](handleError(_0x22119b,null));};exports[_0x9a7b('0x4e')]=function(_0x2816a0,_0x2de27f,_0x1c3b7d){return db[_0x9a7b('0x4f')]['count']({'where':{'ChatGroupId':_0x2816a0[_0x9a7b('0x48')]['id'],'ToId':_0x2816a0[_0x9a7b('0x50')]['id'],'read':![]}})['then'](function(_0x428c28){return{'id':_[_0x9a7b('0x51')](_0x2816a0[_0x9a7b('0x48')]['id']),'count':_0x428c28};})[_0x9a7b('0x27')](respondWithResult(_0x2de27f,null))[_0x9a7b('0x4a')](handleError(_0x2de27f,null));};exports[_0x9a7b('0x52')]=function(_0x436414,_0x55f23d,_0x5180c4){return db['ChatGroup'][_0x9a7b('0x49')]({'where':{'id':_0x436414[_0x9a7b('0x48')]['id']}})['then'](handleEntityNotFound(_0x55f23d,null))[_0x9a7b('0x27')](function(_0x2f1370){if(_0x2f1370){return _0x2f1370[_0x9a7b('0x52')](_0x436414[_0x9a7b('0x4c')][_0x9a7b('0x53')],_[_0x9a7b('0x54')](_0x436414[_0x9a7b('0x4c')],[_0x9a7b('0x53'),'id'])||{});}})['then'](respondWithResult(_0x55f23d,null))[_0x9a7b('0x4a')](handleError(_0x55f23d,null));};exports[_0x9a7b('0x55')]=function(_0xb82aec,_0x49fac5,_0x5ed2c3){var _0x25e571={};var _0x59018e={};var _0x43a819;var _0x497daf;return db[_0x9a7b('0x2f')][_0x9a7b('0x56')]({'where':{'id':_0xb82aec['params']['id']}})['then'](handleEntityNotFound(_0x49fac5,null))['then'](function(_0x11bce4){if(_0x11bce4){_0x43a819=_0x11bce4;_0x59018e[_0x9a7b('0x33')]=_[_0x9a7b('0x35')](db[_0x9a7b('0x57')]['rawAttributes']);_0x59018e[_0x9a7b('0x34')]=_[_0x9a7b('0x35')](_0xb82aec[_0x9a7b('0x34')]);_0x59018e[_0x9a7b('0x36')]=_[_0x9a7b('0x37')](_0x59018e[_0x9a7b('0x33')],_0x59018e[_0x9a7b('0x34')]);_0x25e571[_0x9a7b('0x38')]=_['intersection'](_0x59018e[_0x9a7b('0x33')],qs[_0x9a7b('0x39')](_0xb82aec[_0x9a7b('0x34')][_0x9a7b('0x39')]));_0x25e571[_0x9a7b('0x38')]=_0x25e571[_0x9a7b('0x38')][_0x9a7b('0x3a')]?_0x25e571[_0x9a7b('0x38')]:_0x59018e[_0x9a7b('0x33')];_0x25e571[_0x9a7b('0x3d')]=qs['sort'](_0xb82aec[_0x9a7b('0x34')][_0x9a7b('0x3e')]);_0x25e571['where']=qs[_0x9a7b('0x36')](_[_0x9a7b('0x40')](_0xb82aec['query'],_0x59018e[_0x9a7b('0x36')]));if(_0xb82aec[_0x9a7b('0x34')][_0x9a7b('0x41')]){_0x25e571['where']=_[_0x9a7b('0x42')](_0x25e571[_0x9a7b('0x3f')],{'$or':_[_0x9a7b('0x2e')](_0x25e571[_0x9a7b('0x38')],function(_0x507c9e){var _0x2ac152={};_0x2ac152[_0x507c9e]={'$like':'%'+_0xb82aec[_0x9a7b('0x34')]['filter']+'%'};return _0x2ac152;})});}_0x25e571=_[_0x9a7b('0x42')]({},_0x25e571,_0xb82aec[_0x9a7b('0x43')]);return _0x43a819['getMembers'](_0x25e571);}})['then'](function(_0x5ada24){if(_0x5ada24){_0x497daf=_0x5ada24[_0x9a7b('0x3a')];if(!_0xb82aec['query'][_0x9a7b('0x3b')](_0x9a7b('0x3c'))){_0x25e571[_0x9a7b('0x22')]=qs['limit'](_0xb82aec[_0x9a7b('0x34')]['limit']);_0x25e571['offset']=qs['offset'](_0xb82aec[_0x9a7b('0x34')][_0x9a7b('0x1f')]);}return _0x43a819[_0x9a7b('0x55')](_0x25e571);}})['then'](function(_0x447edc){if(_0x447edc){return _0x447edc?{'count':_0x497daf,'rows':_0x447edc}:null;}})[_0x9a7b('0x27')](respondWithResult(_0x49fac5,null))['catch'](handleError(_0x49fac5,null));};exports['removeMembers']=function(_0x137863,_0xe93210,_0x4cfaa2){return db[_0x9a7b('0x2f')][_0x9a7b('0x49')]({'where':{'id':_0x137863[_0x9a7b('0x48')]['id']}})['then'](handleEntityNotFound(_0xe93210,null))['then'](function(_0x179e9b){if(_0x179e9b){return _0x179e9b['removeMembers'](_0x137863[_0x9a7b('0x34')]['ids']);}})[_0x9a7b('0x27')](respondWithStatusCode(_0xe93210,null))[_0x9a7b('0x4a')](handleError(_0xe93210,null));};exports[_0x9a7b('0x58')]=function(_0x60e9ff,_0x58e17f,_0x487da8){if(_0x60e9ff[_0x9a7b('0x4c')]['id']){delete _0x60e9ff[_0x9a7b('0x4c')]['id'];}return db['ChatGroup'][_0x9a7b('0x49')]({'where':{'id':_0x60e9ff[_0x9a7b('0x48')]['id']}})[_0x9a7b('0x27')](handleEntityNotFound(_0x58e17f,null))[_0x9a7b('0x27')](function(_0x153381){if(_0x153381){_0x60e9ff[_0x9a7b('0x4c')][_0x9a7b('0x59')]=_0x153381['id'];return db[_0x9a7b('0x4f')][_0x9a7b('0x4b')](_0x60e9ff[_0x9a7b('0x4c')]);}})[_0x9a7b('0x27')](respondWithResult(_0x58e17f,null))[_0x9a7b('0x4a')](handleError(_0x58e17f,null));};exports[_0x9a7b('0x5a')]=function(_0x4b8312,_0x3584b9,_0x2ff79f){var _0xf5281f={};var _0x39a81a={};var _0x4511dd;var _0x933cfa;return db[_0x9a7b('0x2f')][_0x9a7b('0x56')]({'where':{'id':_0x4b8312['params']['id']}})[_0x9a7b('0x27')](handleEntityNotFound(_0x3584b9,null))[_0x9a7b('0x27')](function(_0xa33561){if(_0xa33561){_0x4511dd=_0xa33561;_0x39a81a['model']=_[_0x9a7b('0x35')](db[_0x9a7b('0x4f')][_0x9a7b('0x30')]);_0x39a81a[_0x9a7b('0x34')]=_[_0x9a7b('0x35')](_0x4b8312[_0x9a7b('0x34')]);_0x39a81a[_0x9a7b('0x36')]=_[_0x9a7b('0x37')](_0x39a81a[_0x9a7b('0x33')],_0x39a81a[_0x9a7b('0x34')]);_0xf5281f[_0x9a7b('0x38')]=_[_0x9a7b('0x37')](_0x39a81a[_0x9a7b('0x33')],qs[_0x9a7b('0x39')](_0x4b8312[_0x9a7b('0x34')][_0x9a7b('0x39')]));_0xf5281f[_0x9a7b('0x38')]=_0xf5281f[_0x9a7b('0x38')][_0x9a7b('0x3a')]?_0xf5281f[_0x9a7b('0x38')]:_0x39a81a[_0x9a7b('0x33')];_0xf5281f['order']=qs['sort'](_0x4b8312['query'][_0x9a7b('0x3e')]);_0xf5281f[_0x9a7b('0x3f')]=qs[_0x9a7b('0x36')](_[_0x9a7b('0x40')](_0x4b8312[_0x9a7b('0x34')],_0x39a81a[_0x9a7b('0x36')]));if(_0x4b8312[_0x9a7b('0x34')][_0x9a7b('0x41')]){_0xf5281f[_0x9a7b('0x3f')]=_[_0x9a7b('0x42')](_0xf5281f['where'],{'$or':_[_0x9a7b('0x2e')](_0xf5281f[_0x9a7b('0x38')],function(_0x1a5c5b){var _0x136cc8={};_0x136cc8[_0x1a5c5b]={'$like':'%'+_0x4b8312['query'][_0x9a7b('0x41')]+'%'};return _0x136cc8;})});}if(_0x4b8312[_0x9a7b('0x34')][_0x9a7b('0x5b')]){var _0x4ec4c7=_0x4b8312['query'][_0x9a7b('0x5b')][_0x9a7b('0x5c')](',');var _0xd099da={};_0xd099da[_0x4ec4c7[0x0]]={'$gte':moment(_0x4ec4c7[0x1])[_0x9a7b('0x5d')](_0x9a7b('0x5e'))};_0xf5281f[_0x9a7b('0x3f')]=_[_0x9a7b('0x42')](_0xf5281f[_0x9a7b('0x3f')],_0xd099da);}_0xf5281f=_[_0x9a7b('0x42')]({},_0xf5281f,_0x4b8312[_0x9a7b('0x43')]);return _0x4511dd['getMessages'](_0xf5281f);}})[_0x9a7b('0x27')](function(_0x76e584){if(_0x76e584){_0x933cfa=_0x76e584[_0x9a7b('0x3a')];if(!_0x4b8312[_0x9a7b('0x34')]['hasOwnProperty'](_0x9a7b('0x3c'))){_0xf5281f[_0x9a7b('0x22')]=qs[_0x9a7b('0x22')](_0x4b8312[_0x9a7b('0x34')][_0x9a7b('0x22')]);_0xf5281f[_0x9a7b('0x1f')]=qs['offset'](_0x4b8312['query']['offset']);}return _0x4511dd[_0x9a7b('0x5a')](_0xf5281f);}})[_0x9a7b('0x27')](function(_0x4b57f9){if(_0x4b57f9){return _0x4b57f9?{'count':_0x933cfa,'rows':_0x4b57f9}:null;}})[_0x9a7b('0x27')](respondWithResult(_0x3584b9,null))[_0x9a7b('0x4a')](handleError(_0x3584b9,null));}; \ No newline at end of file +var _0x6959=['user','toInteger','addMembers','omit','ids','User','getMembers','nolimit','removeMembers','addMessage','create','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','fields','find','body','describe','ChatInternalMessage'];(function(_0xcf581b,_0x4359dd){var _0x4f454d=function(_0x182d58){while(--_0x182d58){_0xcf581b['push'](_0xcf581b['shift']());}};_0x4f454d(++_0x4359dd);}(_0x6959,0x1e7));var _0x9695=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6959[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9695('0x0'));var rp=require(_0x9695('0x1'));var moment=require(_0x9695('0x2'));var BPromise=require(_0x9695('0x3'));var Mustache=require('mustache');var util=require(_0x9695('0x4'));var path=require(_0x9695('0x5'));var sox=require(_0x9695('0x6'));var csv=require(_0x9695('0x7'));var ejs=require(_0x9695('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9695('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9695('0xa'));var toCsv=require(_0x9695('0x7'));var querystring=require(_0x9695('0xb'));var Papa=require(_0x9695('0xc'));var Redis=require(_0x9695('0xd'));var authService=require(_0x9695('0xe'));var qs=require(_0x9695('0xf'));var as=require(_0x9695('0x10'));var hardwareService=require(_0x9695('0x11'));var logger=require(_0x9695('0x12'))('api');var utils=require(_0x9695('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9695('0x14'));var db=require(_0x9695('0x15'))['db'];config[_0x9695('0x16')]=_[_0x9695('0x17')](config[_0x9695('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9695('0x18'))(new Redis(config[_0x9695('0x16')]));require(_0x9695('0x19'))[_0x9695('0x1a')](socket);function respondWithStatusCode(_0x45e7e3,_0x262b4c){_0x262b4c=_0x262b4c||0xcc;return function(_0x5570a9){if(_0x5570a9){return _0x45e7e3[_0x9695('0x1b')](_0x262b4c);}return _0x45e7e3[_0x9695('0x1c')](_0x262b4c)[_0x9695('0x1d')]();};}function respondWithResult(_0x280b30,_0x461c04){_0x461c04=_0x461c04||0xc8;return function(_0x65e57b){if(_0x65e57b){return _0x280b30[_0x9695('0x1c')](_0x461c04)[_0x9695('0x1e')](_0x65e57b);}};}function respondWithFilteredResult(_0x1fc81f,_0x2ad476){return function(_0x314715){if(_0x314715){var _0x325f12=typeof _0x2ad476[_0x9695('0x1f')]==='undefined'&&typeof _0x2ad476[_0x9695('0x20')]===_0x9695('0x21');var _0x597c0f=_0x314715[_0x9695('0x22')];var _0x44bcd9=_0x325f12?0x0:_0x2ad476[_0x9695('0x1f')];var _0x342cb4=_0x325f12?_0x314715['count']:_0x2ad476[_0x9695('0x1f')]+_0x2ad476['limit'];var _0x5d7b6f;if(_0x342cb4>=_0x597c0f){_0x342cb4=_0x597c0f;_0x5d7b6f=0xc8;}else{_0x5d7b6f=0xce;}_0x1fc81f['status'](_0x5d7b6f);return _0x1fc81f[_0x9695('0x23')](_0x9695('0x24'),_0x44bcd9+'-'+_0x342cb4+'/'+_0x597c0f)[_0x9695('0x1e')](_0x314715);}return null;};}function patchUpdates(_0x514d6a){return function(_0x4b6302){try{jsonpatch['apply'](_0x4b6302,_0x514d6a,!![]);}catch(_0x272a39){return BPromise['reject'](_0x272a39);}return _0x4b6302['save']();};}function saveUpdates(_0x13f7a7,_0x251276){return function(_0x43af33){if(_0x43af33){return _0x43af33[_0x9695('0x25')](_0x13f7a7)[_0x9695('0x26')](function(_0x5238b8){return _0x5238b8;});}return null;};}function removeEntity(_0x54f48a,_0xbbbba0){return function(_0x4a04a6){if(_0x4a04a6){return _0x4a04a6[_0x9695('0x27')]()[_0x9695('0x26')](function(){_0x54f48a['status'](0xcc)[_0x9695('0x1d')]();});}};}function handleEntityNotFound(_0x33d731,_0x4698b0){return function(_0x79d9c5){if(!_0x79d9c5){_0x33d731[_0x9695('0x1b')](0x194);}return _0x79d9c5;};}function handleError(_0x52d1d4,_0xc27eb9){_0xc27eb9=_0xc27eb9||0x1f4;return function(_0x3b342e){logger['error'](_0x3b342e[_0x9695('0x28')]);if(_0x3b342e[_0x9695('0x29')]){delete _0x3b342e[_0x9695('0x29')];}_0x52d1d4[_0x9695('0x1c')](_0xc27eb9)[_0x9695('0x2a')](_0x3b342e);};}exports[_0x9695('0x2b')]=function(_0x352df9,_0x5ce624){var _0x2c4e3a={},_0x2e0de4={},_0x446569={'count':0x0,'rows':[]};var _0x15f5e4=_[_0x9695('0x2c')](db[_0x9695('0x2d')][_0x9695('0x2e')],function(_0x5a3c8a){return{'name':_0x5a3c8a[_0x9695('0x2f')],'type':_0x5a3c8a[_0x9695('0x30')][_0x9695('0x31')]};});_0x2e0de4[_0x9695('0x32')]=_[_0x9695('0x2c')](_0x15f5e4,_0x9695('0x29'));_0x2e0de4[_0x9695('0x33')]=_['keys'](_0x352df9[_0x9695('0x33')]);_0x2e0de4[_0x9695('0x34')]=_[_0x9695('0x35')](_0x2e0de4['model'],_0x2e0de4[_0x9695('0x33')]);_0x2c4e3a[_0x9695('0x36')]=_[_0x9695('0x35')](_0x2e0de4[_0x9695('0x32')],qs['fields'](_0x352df9[_0x9695('0x33')]['fields']));_0x2c4e3a['attributes']=_0x2c4e3a[_0x9695('0x36')][_0x9695('0x37')]?_0x2c4e3a[_0x9695('0x36')]:_0x2e0de4[_0x9695('0x32')];if(!_0x352df9[_0x9695('0x33')][_0x9695('0x38')]('nolimit')){_0x2c4e3a[_0x9695('0x20')]=qs[_0x9695('0x20')](_0x352df9['query'][_0x9695('0x20')]);_0x2c4e3a['offset']=qs[_0x9695('0x1f')](_0x352df9[_0x9695('0x33')][_0x9695('0x1f')]);}_0x2c4e3a[_0x9695('0x39')]=qs[_0x9695('0x3a')](_0x352df9[_0x9695('0x33')][_0x9695('0x3a')]);_0x2c4e3a[_0x9695('0x3b')]=qs[_0x9695('0x34')](_[_0x9695('0x3c')](_0x352df9[_0x9695('0x33')],_0x2e0de4[_0x9695('0x34')]),_0x15f5e4);if(_0x352df9['query'][_0x9695('0x3d')]){_0x2c4e3a[_0x9695('0x3b')]=_[_0x9695('0x3e')](_0x2c4e3a[_0x9695('0x3b')],{'$or':_[_0x9695('0x2c')](_0x15f5e4,function(_0x2fe060){if(_0x2fe060[_0x9695('0x30')]!==_0x9695('0x3f')){var _0x4d68bd={};_0x4d68bd[_0x2fe060['name']]={'$like':'%'+_0x352df9['query'][_0x9695('0x3d')]+'%'};return _0x4d68bd;}})});}_0x2c4e3a=_[_0x9695('0x3e')]({},_0x2c4e3a,_0x352df9[_0x9695('0x40')]);var _0x567eb0={'where':_0x2c4e3a[_0x9695('0x3b')]};return db[_0x9695('0x2d')][_0x9695('0x22')](_0x567eb0)[_0x9695('0x26')](function(_0x510b5e){_0x446569[_0x9695('0x22')]=_0x510b5e;if(_0x352df9[_0x9695('0x33')][_0x9695('0x41')]){_0x2c4e3a[_0x9695('0x42')]=[{'all':!![]}];}return db[_0x9695('0x2d')][_0x9695('0x43')](_0x2c4e3a);})[_0x9695('0x26')](function(_0x14b8b1){_0x446569['rows']=_0x14b8b1;return _0x446569;})[_0x9695('0x26')](respondWithFilteredResult(_0x5ce624,_0x2c4e3a))[_0x9695('0x44')](handleError(_0x5ce624,null));};exports[_0x9695('0x45')]=function(_0xc21b0d,_0x3d78c0){var _0x50eed5={'raw':!![],'where':{'id':_0xc21b0d[_0x9695('0x46')]['id']}},_0x3781d2={};_0x3781d2['model']=_[_0x9695('0x47')](db[_0x9695('0x2d')][_0x9695('0x2e')]);_0x3781d2['query']=_[_0x9695('0x47')](_0xc21b0d[_0x9695('0x33')]);_0x3781d2[_0x9695('0x34')]=_[_0x9695('0x35')](_0x3781d2[_0x9695('0x32')],_0x3781d2[_0x9695('0x33')]);_0x50eed5[_0x9695('0x36')]=_[_0x9695('0x35')](_0x3781d2[_0x9695('0x32')],qs['fields'](_0xc21b0d[_0x9695('0x33')][_0x9695('0x48')]));_0x50eed5[_0x9695('0x36')]=_0x50eed5[_0x9695('0x36')]['length']?_0x50eed5[_0x9695('0x36')]:_0x3781d2[_0x9695('0x32')];if(_0xc21b0d[_0x9695('0x33')][_0x9695('0x41')]){_0x50eed5['include']=[{'all':!![]}];}_0x50eed5=_[_0x9695('0x3e')]({},_0x50eed5,_0xc21b0d[_0x9695('0x40')]);return db[_0x9695('0x2d')][_0x9695('0x49')](_0x50eed5)['then'](handleEntityNotFound(_0x3d78c0,null))[_0x9695('0x26')](respondWithResult(_0x3d78c0,null))[_0x9695('0x44')](handleError(_0x3d78c0,null));};exports['create']=function(_0x5a9631,_0xd5d1e3){return db[_0x9695('0x2d')]['create'](_0x5a9631[_0x9695('0x4a')],{})[_0x9695('0x26')](respondWithResult(_0xd5d1e3,0xc9))[_0x9695('0x44')](handleError(_0xd5d1e3,null));};exports[_0x9695('0x25')]=function(_0x97edbd,_0x56d4ed){if(_0x97edbd['body']['id']){delete _0x97edbd[_0x9695('0x4a')]['id'];}return db[_0x9695('0x2d')]['find']({'where':{'id':_0x97edbd['params']['id']}})[_0x9695('0x26')](handleEntityNotFound(_0x56d4ed,null))['then'](saveUpdates(_0x97edbd['body'],null))['then'](respondWithResult(_0x56d4ed,null))[_0x9695('0x44')](handleError(_0x56d4ed,null));};exports[_0x9695('0x27')]=function(_0x56ef9b,_0x36e635){return db[_0x9695('0x2d')][_0x9695('0x49')]({'where':{'id':_0x56ef9b['params']['id']}})['then'](handleEntityNotFound(_0x36e635,null))[_0x9695('0x26')](removeEntity(_0x36e635,null))[_0x9695('0x44')](handleError(_0x36e635,null));};exports[_0x9695('0x4b')]=function(_0x4a8ffd,_0x32f6b8){return db[_0x9695('0x2d')][_0x9695('0x4b')]()[_0x9695('0x26')](respondWithResult(_0x32f6b8,null))[_0x9695('0x44')](handleError(_0x32f6b8,null));};exports['getUnread']=function(_0x2a331c,_0x1ef95f,_0x58429e){return db[_0x9695('0x4c')][_0x9695('0x22')]({'where':{'ChatGroupId':_0x2a331c[_0x9695('0x46')]['id'],'ToId':_0x2a331c[_0x9695('0x4d')]['id'],'read':![]}})[_0x9695('0x26')](function(_0x252cb7){return{'id':_[_0x9695('0x4e')](_0x2a331c[_0x9695('0x46')]['id']),'count':_0x252cb7};})[_0x9695('0x26')](respondWithResult(_0x1ef95f,null))[_0x9695('0x44')](handleError(_0x1ef95f,null));};exports[_0x9695('0x4f')]=function(_0xaff686,_0x58bcff,_0x3b0077){return db[_0x9695('0x2d')]['find']({'where':{'id':_0xaff686[_0x9695('0x46')]['id']}})[_0x9695('0x26')](handleEntityNotFound(_0x58bcff,null))[_0x9695('0x26')](function(_0x13b9e6){if(_0x13b9e6){return _0x13b9e6[_0x9695('0x4f')](_0xaff686[_0x9695('0x4a')]['ids'],_[_0x9695('0x50')](_0xaff686[_0x9695('0x4a')],[_0x9695('0x51'),'id'])||{});}})['then'](respondWithResult(_0x58bcff,null))[_0x9695('0x44')](handleError(_0x58bcff,null));};exports['getMembers']=function(_0x4ba9ee,_0x513182,_0x51b192){var _0x36a4ac={};var _0x32bf00={};var _0x2b1cef;var _0x2df1f1;return db[_0x9695('0x2d')]['findOne']({'where':{'id':_0x4ba9ee['params']['id']}})[_0x9695('0x26')](handleEntityNotFound(_0x513182,null))[_0x9695('0x26')](function(_0x26994d){if(_0x26994d){_0x2b1cef=_0x26994d;_0x32bf00['model']=_[_0x9695('0x47')](db[_0x9695('0x52')][_0x9695('0x2e')]);_0x32bf00['query']=_[_0x9695('0x47')](_0x4ba9ee[_0x9695('0x33')]);_0x32bf00[_0x9695('0x34')]=_[_0x9695('0x35')](_0x32bf00['model'],_0x32bf00[_0x9695('0x33')]);_0x36a4ac[_0x9695('0x36')]=_[_0x9695('0x35')](_0x32bf00[_0x9695('0x32')],qs['fields'](_0x4ba9ee[_0x9695('0x33')][_0x9695('0x48')]));_0x36a4ac[_0x9695('0x36')]=_0x36a4ac[_0x9695('0x36')][_0x9695('0x37')]?_0x36a4ac['attributes']:_0x32bf00['model'];_0x36a4ac['order']=qs[_0x9695('0x3a')](_0x4ba9ee['query'][_0x9695('0x3a')]);_0x36a4ac[_0x9695('0x3b')]=qs[_0x9695('0x34')](_[_0x9695('0x3c')](_0x4ba9ee[_0x9695('0x33')],_0x32bf00[_0x9695('0x34')]));if(_0x4ba9ee[_0x9695('0x33')][_0x9695('0x3d')]){_0x36a4ac[_0x9695('0x3b')]=_['merge'](_0x36a4ac['where'],{'$or':_[_0x9695('0x2c')](_0x36a4ac[_0x9695('0x36')],function(_0x148061){var _0x5ae665={};_0x5ae665[_0x148061]={'$like':'%'+_0x4ba9ee[_0x9695('0x33')][_0x9695('0x3d')]+'%'};return _0x5ae665;})});}_0x36a4ac=_[_0x9695('0x3e')]({},_0x36a4ac,_0x4ba9ee['options']);return _0x2b1cef[_0x9695('0x53')](_0x36a4ac);}})['then'](function(_0x141ff0){if(_0x141ff0){_0x2df1f1=_0x141ff0[_0x9695('0x37')];if(!_0x4ba9ee[_0x9695('0x33')][_0x9695('0x38')](_0x9695('0x54'))){_0x36a4ac[_0x9695('0x20')]=qs[_0x9695('0x20')](_0x4ba9ee[_0x9695('0x33')][_0x9695('0x20')]);_0x36a4ac[_0x9695('0x1f')]=qs[_0x9695('0x1f')](_0x4ba9ee[_0x9695('0x33')][_0x9695('0x1f')]);}return _0x2b1cef[_0x9695('0x53')](_0x36a4ac);}})[_0x9695('0x26')](function(_0x10940c){if(_0x10940c){return _0x10940c?{'count':_0x2df1f1,'rows':_0x10940c}:null;}})[_0x9695('0x26')](respondWithResult(_0x513182,null))[_0x9695('0x44')](handleError(_0x513182,null));};exports[_0x9695('0x55')]=function(_0x596b05,_0x37e26b,_0x1853bb){return db[_0x9695('0x2d')][_0x9695('0x49')]({'where':{'id':_0x596b05[_0x9695('0x46')]['id']}})[_0x9695('0x26')](handleEntityNotFound(_0x37e26b,null))[_0x9695('0x26')](function(_0x390c88){if(_0x390c88){return _0x390c88[_0x9695('0x55')](_0x596b05[_0x9695('0x33')]['ids']);}})[_0x9695('0x26')](respondWithStatusCode(_0x37e26b,null))[_0x9695('0x44')](handleError(_0x37e26b,null));};exports[_0x9695('0x56')]=function(_0x1945ef,_0x4f18f9,_0x381f0d){if(_0x1945ef[_0x9695('0x4a')]['id']){delete _0x1945ef['body']['id'];}return db[_0x9695('0x2d')][_0x9695('0x49')]({'where':{'id':_0x1945ef[_0x9695('0x46')]['id']}})[_0x9695('0x26')](handleEntityNotFound(_0x4f18f9,null))[_0x9695('0x26')](function(_0x329371){if(_0x329371){_0x1945ef['body']['ChatGroupId']=_0x329371['id'];return db[_0x9695('0x4c')][_0x9695('0x57')](_0x1945ef[_0x9695('0x4a')]);}})[_0x9695('0x26')](respondWithResult(_0x4f18f9,null))['catch'](handleError(_0x4f18f9,null));};exports[_0x9695('0x58')]=function(_0x1a59f0,_0x4f13a4,_0x1ed816){var _0x49009b={};var _0x108e09={};var _0x4dcbd9;var _0x1077e3;return db['ChatGroup'][_0x9695('0x59')]({'where':{'id':_0x1a59f0[_0x9695('0x46')]['id']}})[_0x9695('0x26')](handleEntityNotFound(_0x4f13a4,null))[_0x9695('0x26')](function(_0x21c976){if(_0x21c976){_0x4dcbd9=_0x21c976;_0x108e09['model']=_[_0x9695('0x47')](db[_0x9695('0x4c')][_0x9695('0x2e')]);_0x108e09[_0x9695('0x33')]=_[_0x9695('0x47')](_0x1a59f0['query']);_0x108e09[_0x9695('0x34')]=_[_0x9695('0x35')](_0x108e09[_0x9695('0x32')],_0x108e09[_0x9695('0x33')]);_0x49009b['attributes']=_[_0x9695('0x35')](_0x108e09[_0x9695('0x32')],qs[_0x9695('0x48')](_0x1a59f0[_0x9695('0x33')][_0x9695('0x48')]));_0x49009b[_0x9695('0x36')]=_0x49009b[_0x9695('0x36')][_0x9695('0x37')]?_0x49009b[_0x9695('0x36')]:_0x108e09[_0x9695('0x32')];_0x49009b['order']=qs[_0x9695('0x3a')](_0x1a59f0[_0x9695('0x33')][_0x9695('0x3a')]);_0x49009b[_0x9695('0x3b')]=qs['filters'](_['pick'](_0x1a59f0['query'],_0x108e09[_0x9695('0x34')]));if(_0x1a59f0['query'][_0x9695('0x3d')]){_0x49009b[_0x9695('0x3b')]=_['merge'](_0x49009b[_0x9695('0x3b')],{'$or':_['map'](_0x49009b[_0x9695('0x36')],function(_0x5109a1){var _0x2eb356={};_0x2eb356[_0x5109a1]={'$like':'%'+_0x1a59f0[_0x9695('0x33')][_0x9695('0x3d')]+'%'};return _0x2eb356;})});}if(_0x1a59f0[_0x9695('0x33')][_0x9695('0x5a')]){var _0x50f131=_0x1a59f0[_0x9695('0x33')]['$gte'][_0x9695('0x5b')](',');var _0x5c6315={};_0x5c6315[_0x50f131[0x0]]={'$gte':moment(_0x50f131[0x1])[_0x9695('0x5c')](_0x9695('0x5d'))};_0x49009b[_0x9695('0x3b')]=_[_0x9695('0x3e')](_0x49009b[_0x9695('0x3b')],_0x5c6315);}_0x49009b=_['merge']({},_0x49009b,_0x1a59f0[_0x9695('0x40')]);return _0x4dcbd9['getMessages'](_0x49009b);}})[_0x9695('0x26')](function(_0x2337df){if(_0x2337df){_0x1077e3=_0x2337df[_0x9695('0x37')];if(!_0x1a59f0['query'][_0x9695('0x38')]('nolimit')){_0x49009b[_0x9695('0x20')]=qs[_0x9695('0x20')](_0x1a59f0[_0x9695('0x33')]['limit']);_0x49009b[_0x9695('0x1f')]=qs[_0x9695('0x1f')](_0x1a59f0[_0x9695('0x33')][_0x9695('0x1f')]);}return _0x4dcbd9[_0x9695('0x58')](_0x49009b);}})[_0x9695('0x26')](function(_0x2e78f4){if(_0x2e78f4){return _0x2e78f4?{'count':_0x1077e3,'rows':_0x2e78f4}:null;}})['then'](respondWithResult(_0x4f13a4,null))[_0x9695('0x44')](handleError(_0x4f13a4,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 09691ea..54eae1f 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 _0xa3fe=['ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','events'];(function(_0x1659c0,_0x5b4a18){var _0x82934a=function(_0x3d73d1){while(--_0x3d73d1){_0x1659c0['push'](_0x1659c0['shift']());}};_0x82934a(++_0x5b4a18);}(_0xa3fe,0xd8));var _0xea3f=function(_0x1016aa,_0x1e3d5f){_0x1016aa=_0x1016aa-0x0;var _0x1d340f=_0xa3fe[_0x1016aa];return _0x1d340f;};'use strict';var EventEmitter=require(_0xea3f('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xea3f('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xea3f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xea3f('0x3'),'afterDestroy':_0xea3f('0x4')};function emitEvent(_0xc23ba9){return function(_0x5d6309,_0x2880a2,_0x4e8978){ChatGroupEvents[_0xea3f('0x5')](_0xc23ba9+':'+_0x5d6309['id'],_0x5d6309);ChatGroupEvents[_0xea3f('0x5')](_0xc23ba9,_0x5d6309);_0x4e8978(null);};}for(var e in events){if(events[_0xea3f('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xbde2=['emit','hasOwnProperty','hook','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0xc835d8,_0x413012){var _0x25950f=function(_0x752daa){while(--_0x752daa){_0xc835d8['push'](_0xc835d8['shift']());}};_0x25950f(++_0x413012);}(_0xbde2,0x111));var _0x2bde=function(_0x2fc7d4,_0x3db10f){_0x2fc7d4=_0x2fc7d4-0x0;var _0xaa4af2=_0xbde2[_0x2fc7d4];return _0xaa4af2;};'use strict';var EventEmitter=require(_0x2bde('0x0'));var ChatGroup=require(_0x2bde('0x1'))['db'][_0x2bde('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2bde('0x3')](0x0);var events={'afterCreate':_0x2bde('0x4'),'afterUpdate':_0x2bde('0x5'),'afterDestroy':'remove'};function emitEvent(_0xb82ff){return function(_0x12729e,_0x24d16c,_0x85ba82){ChatGroupEvents[_0x2bde('0x6')](_0xb82ff+':'+_0x12729e['id'],_0x12729e);ChatGroupEvents[_0x2bde('0x6')](_0xb82ff,_0x12729e);_0x85ba82(null);};}for(var e in events){if(events[_0x2bde('0x7')](e)){var event=events[e];ChatGroup[_0x2bde('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 00c8397..6ba3b54 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 _0x26ad=['ChatGroup','chat_groups','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','define'];(function(_0x15445a,_0x28a4f4){var _0x4a2a27=function(_0x179401){while(--_0x179401){_0x15445a['push'](_0x15445a['shift']());}};_0x4a2a27(++_0x28a4f4);}(_0x26ad,0x1be));var _0xd26a=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x26ad[_0x2468b5];return _0x1056e4;};'use strict';var _=require(_0xd26a('0x0'));var util=require(_0xd26a('0x1'));var logger=require(_0xd26a('0x2'))('api');var moment=require(_0xd26a('0x3'));var BPromise=require('bluebird');var rp=require(_0xd26a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd26a('0x5'));var config=require(_0xd26a('0x6'));var attributes=require(_0xd26a('0x7'));module[_0xd26a('0x8')]=function(_0x559912,_0x8d94c0){return _0x559912[_0xd26a('0x9')](_0xd26a('0xa'),attributes,{'tableName':_0xd26a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6821=['bluebird','request-promise','path','rimraf','../../config/environment','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x6821,0x8a));var _0x1682=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x6821[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x1682('0x0'));var util=require(_0x1682('0x1'));var logger=require(_0x1682('0x2'))(_0x1682('0x3'));var moment=require(_0x1682('0x4'));var BPromise=require(_0x1682('0x5'));var rp=require(_0x1682('0x6'));var fs=require('fs');var path=require(_0x1682('0x7'));var rimraf=require(_0x1682('0x8'));var config=require(_0x1682('0x9'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x3ec660,_0x18fc81){return _0x3ec660[_0x1682('0xa')](_0x1682('0xb'),attributes,{'tableName':_0x1682('0xc'),'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 5d3d53d..3d5aab6 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 _0x946e=['request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatGroup.socket','request','then','ChatGroup,\x20%s,\x20%s'];(function(_0x54212c,_0x5aaa27){var _0x384f5e=function(_0x37661e){while(--_0x37661e){_0x54212c['push'](_0x54212c['shift']());}};_0x384f5e(++_0x5aaa27);}(_0x946e,0x1d0));var _0xe946=function(_0x2799fa,_0x4e822b){_0x2799fa=_0x2799fa-0x0;var _0x47ec47=_0x946e[_0x2799fa];return _0x47ec47;};'use strict';var _=require(_0xe946('0x0'));var util=require('util');var moment=require(_0xe946('0x1'));var BPromise=require('bluebird');var rs=require(_0xe946('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe946('0x3'));var logger=require(_0xe946('0x4'))(_0xe946('0x5'));var config=require(_0xe946('0x6'));var jayson=require(_0xe946('0x7'));var client=jayson['client'][_0xe946('0x8')]({'port':0x232a});config[_0xe946('0x9')]=_[_0xe946('0xa')](config['redis'],{'host':_0xe946('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe946('0x9')]));require(_0xe946('0xc'))['register'](socket);function respondWithRpcPromise(_0x47e7a1,_0x49e9fc,_0x286140){return new BPromise(function(_0x49b412,_0x5679f6){return client[_0xe946('0xd')](_0x47e7a1,_0x286140)[_0xe946('0xe')](function(_0x56d82e){logger['info'](_0xe946('0xf'),_0x49e9fc,_0xe946('0x10'));logger['debug'](_0xe946('0x11'),_0x49e9fc,_0xe946('0x10'),JSON[_0xe946('0x12')](_0x56d82e));if(_0x56d82e[_0xe946('0x13')]){if(_0x56d82e[_0xe946('0x13')][_0xe946('0x14')]===0x1f4){logger[_0xe946('0x13')]('ChatGroup,\x20%s,\x20%s',_0x49e9fc,_0x56d82e['error'][_0xe946('0x15')]);return _0x5679f6(_0x56d82e[_0xe946('0x13')][_0xe946('0x15')]);}logger['error'](_0xe946('0xf'),_0x49e9fc,_0x56d82e[_0xe946('0x13')][_0xe946('0x15')]);return _0x49b412(_0x56d82e['error'][_0xe946('0x15')]);}else{logger[_0xe946('0x16')](_0xe946('0xf'),_0x49e9fc,'request\x20sent');_0x49b412(_0x56d82e[_0xe946('0x17')][_0xe946('0x15')]);}})['catch'](function(_0x2b2b66){logger['error'](_0xe946('0xf'),_0x49e9fc,_0x2b2b66);_0x5679f6(_0x2b2b66);});});} \ No newline at end of file +var _0x8ccb=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatGroup,\x20%s,\x20%s'];(function(_0x89f265,_0x5e2d96){var _0x5b0b9a=function(_0x271469){while(--_0x271469){_0x89f265['push'](_0x89f265['shift']());}};_0x5b0b9a(++_0x5e2d96);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0x8ccb[_0x1f7996];return _0x584609;};'use strict';var _=require(_0xb8cc('0x0'));var util=require(_0xb8cc('0x1'));var moment=require('moment');var BPromise=require(_0xb8cc('0x2'));var rs=require(_0xb8cc('0x3'));var fs=require('fs');var Redis=require(_0xb8cc('0x4'));var db=require(_0xb8cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8cc('0x6'));var config=require(_0xb8cc('0x7'));var jayson=require(_0xb8cc('0x8'));var client=jayson['client'][_0xb8cc('0x9')]({'port':0x232a});config[_0xb8cc('0xa')]=_[_0xb8cc('0xb')](config['redis'],{'host':_0xb8cc('0xc'),'port':0x18eb});var socket=require(_0xb8cc('0xd'))(new Redis(config[_0xb8cc('0xa')]));require('./chatGroup.socket')[_0xb8cc('0xe')](socket);function respondWithRpcPromise(_0x1bb3ab,_0x4a6dba,_0x54b0b4){return new BPromise(function(_0x454465,_0x91df57){return client['request'](_0x1bb3ab,_0x54b0b4)['then'](function(_0x14c621){logger[_0xb8cc('0xf')]('ChatGroup,\x20%s,\x20%s',_0x4a6dba,_0xb8cc('0x10'));logger[_0xb8cc('0x11')](_0xb8cc('0x12'),_0x4a6dba,_0xb8cc('0x10'),JSON[_0xb8cc('0x13')](_0x14c621));if(_0x14c621[_0xb8cc('0x14')]){if(_0x14c621[_0xb8cc('0x14')]['code']===0x1f4){logger[_0xb8cc('0x14')]('ChatGroup,\x20%s,\x20%s',_0x4a6dba,_0x14c621[_0xb8cc('0x14')][_0xb8cc('0x15')]);return _0x91df57(_0x14c621[_0xb8cc('0x14')]['message']);}logger[_0xb8cc('0x14')](_0xb8cc('0x16'),_0x4a6dba,_0x14c621[_0xb8cc('0x14')]['message']);return _0x454465(_0x14c621[_0xb8cc('0x14')]['message']);}else{logger[_0xb8cc('0xf')]('ChatGroup,\x20%s,\x20%s',_0x4a6dba,_0xb8cc('0x10'));_0x454465(_0x14c621[_0xb8cc('0x17')][_0xb8cc('0x15')]);}})[_0xb8cc('0x18')](function(_0xf59627){logger['error'](_0xb8cc('0x16'),_0x4a6dba,_0xf59627);_0x91df57(_0xf59627);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 1bcb4e8..d810e63 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 _0xf645=['removeListener','register','./chatGroup.events','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf645,0x129));var _0x5f64=function(_0x222ac2,_0x57ec8c){_0x222ac2=_0x222ac2-0x0;var _0x4b6f35=_0xf645[_0x222ac2];return _0x4b6f35;};'use strict';var ChatGroupEvents=require(_0x5f64('0x0'));var events=[_0x5f64('0x1'),'remove',_0x5f64('0x2')];function createListener(_0xa78e79,_0x34cbf4){return function(_0x41c6b8){_0x34cbf4['emit'](_0xa78e79,_0x41c6b8);};}function removeListener(_0x1182ed,_0x3305a0){return function(){ChatGroupEvents[_0x5f64('0x3')](_0x1182ed,_0x3305a0);};}exports[_0x5f64('0x4')]=function(_0x4f7470){for(var _0x450120=0x0,_0x3339a1=events['length'];_0x450120<_0x3339a1;_0x450120++){var _0x1d0749=events[_0x450120];var _0x226c92=createListener('chatGroup:'+_0x1d0749,_0x4f7470);ChatGroupEvents['on'](_0x1d0749,_0x226c92);}}; \ No newline at end of file +var _0x602a=['update','emit','removeListener','register','length','chatGroup:','./chatGroup.events','remove'];(function(_0x478970,_0x3d45d9){var _0x493237=function(_0x40fce3){while(--_0x40fce3){_0x478970['push'](_0x478970['shift']());}};_0x493237(++_0x3d45d9);}(_0x602a,0x1de));var _0xa602=function(_0x4314fe,_0x36b15c){_0x4314fe=_0x4314fe-0x0;var _0x47ac83=_0x602a[_0x4314fe];return _0x47ac83;};'use strict';var ChatGroupEvents=require(_0xa602('0x0'));var events=['save',_0xa602('0x1'),_0xa602('0x2')];function createListener(_0x403c06,_0x1e9fa4){return function(_0x4f8890){_0x1e9fa4[_0xa602('0x3')](_0x403c06,_0x4f8890);};}function removeListener(_0x25afef,_0x583cba){return function(){ChatGroupEvents[_0xa602('0x4')](_0x25afef,_0x583cba);};}exports[_0xa602('0x5')]=function(_0x5c79a1){for(var _0x2a9d2f=0x0,_0x58d7d5=events[_0xa602('0x6')];_0x2a9d2f<_0x58d7d5;_0x2a9d2f++){var _0x1c4ee9=events[_0x2a9d2f];var _0x31bc1b=createListener(_0xa602('0x7')+_0x1c4ee9,_0x5c79a1);ChatGroupEvents['on'](_0x1c4ee9,_0x31bc1b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 55ce0fb..83436c4 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 _0xaf40=['update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMessage','put'];(function(_0x4afee3,_0x4b7714){var _0xdb146a=function(_0x429b44){while(--_0x429b44){_0x4afee3['push'](_0x4afee3['shift']());}};_0xdb146a(++_0x4b7714);}(_0xaf40,0x155));var _0x0af4=function(_0x506851,_0x11f505){_0x506851=_0x506851-0x0;var _0x4fbd47=_0xaf40[_0x506851];return _0x4fbd47;};'use strict';var multer=require(_0x0af4('0x0'));var util=require(_0x0af4('0x1'));var path=require(_0x0af4('0x2'));var timeout=require('connect-timeout');var express=require(_0x0af4('0x3'));var router=express['Router']();var fs_extra=require(_0x0af4('0x4'));var auth=require(_0x0af4('0x5'));var interaction=require(_0x0af4('0x6'));var config=require(_0x0af4('0x7'));var controller=require(_0x0af4('0x8'));router[_0x0af4('0x9')]('/',auth[_0x0af4('0xa')](),controller[_0x0af4('0xb')]);router['get'](_0x0af4('0xc'),auth[_0x0af4('0xa')](),controller['describe']);router[_0x0af4('0x9')](_0x0af4('0xd'),auth[_0x0af4('0xa')](),controller['show']);router[_0x0af4('0x9')](_0x0af4('0xe'),auth[_0x0af4('0xa')](),controller[_0x0af4('0xf')]);router[_0x0af4('0x9')](_0x0af4('0x10'),auth['isAuthenticated'](),controller[_0x0af4('0x11')]);router[_0x0af4('0x9')](_0x0af4('0x12'),auth[_0x0af4('0xa')](),controller['getMessages']);router[_0x0af4('0x13')]('/',auth[_0x0af4('0xa')](),controller[_0x0af4('0x14')]);router['post'](_0x0af4('0x10'),auth['isAuthenticated'](),controller['addMembers']);router[_0x0af4('0x13')]('/:id/messages',auth[_0x0af4('0xa')](),controller[_0x0af4('0x15')]);router[_0x0af4('0x16')](_0x0af4('0xd'),auth['isAuthenticated'](),controller[_0x0af4('0x17')]);router['delete']('/:id',auth[_0x0af4('0xa')](),controller['destroy']);router[_0x0af4('0x18')]('/:id/members',auth[_0x0af4('0xa')](),controller['removeMembers']);module[_0x0af4('0x19')]=router; \ No newline at end of file +var _0x54ec=['addMessage','update','delete','destroy','removeMembers','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','/describe','/:id','/:id/unread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers'];(function(_0x2bc498,_0x3cb268){var _0x2a53a2=function(_0x327eea){while(--_0x327eea){_0x2bc498['push'](_0x2bc498['shift']());}};_0x2a53a2(++_0x3cb268);}(_0x54ec,0x1c8));var _0xc54e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x54ec[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xc54e('0x0'));var util=require(_0xc54e('0x1'));var path=require(_0xc54e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc54e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc54e('0x4'));var interaction=require(_0xc54e('0x5'));var config=require('../../config/environment');var controller=require(_0xc54e('0x6'));router[_0xc54e('0x7')]('/',auth[_0xc54e('0x8')](),controller['index']);router[_0xc54e('0x7')](_0xc54e('0x9'),auth[_0xc54e('0x8')](),controller['describe']);router['get'](_0xc54e('0xa'),auth[_0xc54e('0x8')](),controller['show']);router[_0xc54e('0x7')](_0xc54e('0xb'),auth[_0xc54e('0x8')](),controller['getUnread']);router['get']('/:id/members',auth[_0xc54e('0x8')](),controller[_0xc54e('0xc')]);router[_0xc54e('0x7')](_0xc54e('0xd'),auth[_0xc54e('0x8')](),controller[_0xc54e('0xe')]);router[_0xc54e('0xf')]('/',auth[_0xc54e('0x8')](),controller[_0xc54e('0x10')]);router[_0xc54e('0xf')](_0xc54e('0x11'),auth[_0xc54e('0x8')](),controller[_0xc54e('0x12')]);router[_0xc54e('0xf')](_0xc54e('0xd'),auth[_0xc54e('0x8')](),controller[_0xc54e('0x13')]);router['put'](_0xc54e('0xa'),auth[_0xc54e('0x8')](),controller[_0xc54e('0x14')]);router[_0xc54e('0x15')](_0xc54e('0xa'),auth['isAuthenticated'](),controller[_0xc54e('0x16')]);router[_0xc54e('0x15')]('/:id/members',auth[_0xc54e('0x8')](),controller[_0xc54e('0x17')]);module[_0xc54e('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 0145647..44efd04 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 _0x0f5a=['BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','out','sequelize','exports'];(function(_0x554a86,_0x3b78fe){var _0x21f1ef=function(_0x2dd308){while(--_0x2dd308){_0x554a86['push'](_0x554a86['shift']());}};_0x21f1ef(++_0x3b78fe);}(_0x0f5a,0x1e2));var _0xa0f5=function(_0x4c99ee,_0x2d8768){_0x4c99ee=_0x4c99ee-0x0;var _0x24bc5f=_0x0f5a[_0x4c99ee];return _0x24bc5f;};'use strict';var Sequelize=require(_0xa0f5('0x0'));module[_0xa0f5('0x1')]={'closed':{'type':Sequelize[_0xa0f5('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xa0f5('0x3')]},'ratingType':{'type':Sequelize[_0xa0f5('0x4')](_0xa0f5('0x5'),_0xa0f5('0x6')),'defaultValue':_0xa0f5('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xa0f5('0x7')]},'mailTranscript':{'type':Sequelize[_0xa0f5('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa0f5('0x9')]},'disposition':{'type':Sequelize[_0xa0f5('0x8')]},'secondDisposition':{'type':Sequelize[_0xa0f5('0x8')]},'thirdDisposition':{'type':Sequelize[_0xa0f5('0x8')]},'note':{'type':Sequelize[_0xa0f5('0x8')]},'browserName':{'type':Sequelize[_0xa0f5('0x8')]},'browserVersion':{'type':Sequelize[_0xa0f5('0x8')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xa0f5('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xa0f5('0x8')]},'deviceType':{'type':Sequelize[_0xa0f5('0x8')]},'referer':{'type':Sequelize[_0xa0f5('0x7')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xa0f5('0x7')]('long')},'read1stAt':{'type':Sequelize[_0xa0f5('0x9')]},'lastMsgAt':{'type':Sequelize[_0xa0f5('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa0f5('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa0f5('0x8')]},'customerPort':{'type':Sequelize[_0xa0f5('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xa0f5('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0xa0f5('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0c35=['INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','BOOLEAN','sequelize','exports'];(function(_0x2aa6a9,_0xcc04d3){var _0x272634=function(_0x2f6b10){while(--_0x2f6b10){_0x2aa6a9['push'](_0x2aa6a9['shift']());}};_0x272634(++_0xcc04d3);}(_0x0c35,0x196));var _0x50c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0c35[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x50c3('0x0'));module[_0x50c3('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x50c3('0x2')]},'ratingType':{'type':Sequelize[_0x50c3('0x3')](_0x50c3('0x4'),_0x50c3('0x5')),'defaultValue':_0x50c3('0x4')},'ratingMessage':{'type':Sequelize[_0x50c3('0x6')]},'pathTranscript':{'type':Sequelize[_0x50c3('0x6')]},'mailTranscript':{'type':Sequelize[_0x50c3('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x50c3('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x50c3('0x7')]},'note':{'type':Sequelize[_0x50c3('0x7')]},'browserName':{'type':Sequelize[_0x50c3('0x7')]},'browserVersion':{'type':Sequelize[_0x50c3('0x7')]},'osName':{'type':Sequelize[_0x50c3('0x7')]},'osVersion':{'type':Sequelize[_0x50c3('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x50c3('0x7')]},'deviceType':{'type':Sequelize[_0x50c3('0x7')]},'referer':{'type':Sequelize[_0x50c3('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x50c3('0x6')](_0x50c3('0x9'))},'read1stAt':{'type':Sequelize[_0x50c3('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x50c3('0x3')]('in',_0x50c3('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x50c3('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x50c3('0xb')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x50c3('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index d10fdad..132f63a 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 _0x73ad=['ids','getMessages','filters','hasOwnProperty','order','sort','where','pick','filter','map','$gte','split','ChatInteractionId','push','rows','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','attachments','firstName','lastName','direction','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','osName','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','sendStatus','stack','name','merge','body','contact','agent','interaction','account','index','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','user','show','params','model','rawAttributes','query','keys','intersection','attributes','fields','length','includeAll','include','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','follow','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','Contact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','originalname','filename','file','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','basename','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','CmContact','Messages','UserId','agentAlias','%s%d','ContactId','website_alias','System','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage'];(function(_0x23dbda,_0x5977dc){var _0x5298f6=function(_0x1b87ab){while(--_0x1b87ab){_0x23dbda['push'](_0x23dbda['shift']());}};_0x5298f6(++_0x5977dc);}(_0x73ad,0x1c7));var _0xd73a=function(_0x490041,_0x903c15){_0x490041=_0x490041-0x0;var _0x4aa9a3=_0x73ad[_0x490041];return _0x4aa9a3;};'use strict';var rimraf=require(_0xd73a('0x0'));var zipdir=require(_0xd73a('0x1'));var rp=require(_0xd73a('0x2'));var moment=require('moment');var BPromise=require(_0xd73a('0x3'));var Mustache=require(_0xd73a('0x4'));var util=require(_0xd73a('0x5'));var path=require(_0xd73a('0x6'));var ejs=require(_0xd73a('0x7'));var fs=require('fs');var _=require(_0xd73a('0x8'));var Redis=require(_0xd73a('0x9'));var interaction=require('../../components/interaction/service');var qs=require(_0xd73a('0xa'));var pdf=require(_0xd73a('0xb'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0xd73a('0xc'))['db'];config[_0xd73a('0xd')]=_['defaults'](config[_0xd73a('0xd')],{'host':_0xd73a('0xe'),'port':0x18eb});var socket=require(_0xd73a('0xf'))(new Redis(config[_0xd73a('0xd')]));require(_0xd73a('0x10'))[_0xd73a('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd73a('0x12')][_0xd73a('0x13')]({'port':0x232b});var client9004=jayson[_0xd73a('0x12')][_0xd73a('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x3733dd,_0x893ae8,_0x3c17fd,_0x489aea){return new BPromise(function(_0x5c5799,_0x6405da){var _0x1da722=_0x489aea||client;return _0x1da722[_0xd73a('0x14')](_0x3733dd,_0x3c17fd)[_0xd73a('0x15')](function(_0x26db88){logger[_0xd73a('0x16')](_0xd73a('0x17'),_0x893ae8,_0xd73a('0x18'));logger[_0xd73a('0x19')](_0xd73a('0x1a'),_0x893ae8,'request\x20sent',JSON[_0xd73a('0x1b')](_0x26db88));if(_0x26db88[_0xd73a('0x1c')]){if(_0x26db88['error'][_0xd73a('0x1d')]===0x1f4){logger[_0xd73a('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x893ae8,_0x26db88[_0xd73a('0x1c')][_0xd73a('0x1e')]);return _0x6405da(_0x26db88[_0xd73a('0x1c')][_0xd73a('0x1e')]);}logger['error'](_0xd73a('0x17'),_0x893ae8,_0x26db88[_0xd73a('0x1c')]['message']);return _0x5c5799(_0x26db88[_0xd73a('0x1c')]['message']);}else{logger[_0xd73a('0x16')](_0xd73a('0x17'),_0x893ae8,_0xd73a('0x18'));_0x5c5799(_0x26db88[_0xd73a('0x1f')][_0xd73a('0x1e')]);}})[_0xd73a('0x20')](function(_0x61fb06){logger['error'](_0xd73a('0x17'),_0x893ae8,_0x61fb06);_0x6405da(_0x61fb06);});});}function respondWithStatusCode(_0x3c9ab6,_0x1d66ea){_0x1d66ea=_0x1d66ea||0xcc;return function(_0x5c9dd9){if(_0x5c9dd9){return _0x3c9ab6['sendStatus'](_0x1d66ea);}return _0x3c9ab6[_0xd73a('0x21')](_0x1d66ea)[_0xd73a('0x22')]();};}function respondWithResult(_0x173b7b,_0x3e1a35){_0x3e1a35=_0x3e1a35||0xc8;return function(_0x3a4df3){if(_0x3a4df3){return _0x173b7b[_0xd73a('0x21')](_0x3e1a35)[_0xd73a('0x23')](_0x3a4df3);}};}function respondWithFilteredResult(_0x2c5106,_0x45f2e8){return function(_0x50eb7d){if(_0x50eb7d){var _0xf5362a=typeof _0x45f2e8[_0xd73a('0x24')]===_0xd73a('0x25')&&typeof _0x45f2e8[_0xd73a('0x26')]===_0xd73a('0x25');var _0x521fd4=_0x50eb7d[_0xd73a('0x27')];var _0x458be1=_0xf5362a?0x0:_0x45f2e8[_0xd73a('0x24')];var _0x51ebb6=_0xf5362a?_0x50eb7d[_0xd73a('0x27')]:_0x45f2e8[_0xd73a('0x24')]+_0x45f2e8[_0xd73a('0x26')];var _0xe973d1;if(_0x51ebb6>=_0x521fd4){_0x51ebb6=_0x521fd4;_0xe973d1=0xc8;}else{_0xe973d1=0xce;}_0x2c5106['status'](_0xe973d1);return _0x2c5106[_0xd73a('0x28')](_0xd73a('0x29'),_0x458be1+'-'+_0x51ebb6+'/'+_0x521fd4)['json'](_0x50eb7d);}return null;};}function saveUpdates(_0x508a73){return function(_0x2dcebf){if(_0x2dcebf){return _0x2dcebf[_0xd73a('0x2a')](_0x508a73)[_0xd73a('0x15')](function(_0x4a294c){return _0x4a294c;});}return null;};}function removeEntity(_0x4fda3a){return function(_0x46796b){if(_0x46796b){return _0x46796b[_0xd73a('0x2b')]()['then'](function(){_0x4fda3a[_0xd73a('0x21')](0xcc)[_0xd73a('0x22')]();});}};}function handleEntityNotFound(_0x1ba488){return function(_0x34b95d){if(!_0x34b95d){_0x1ba488[_0xd73a('0x2c')](0x194);}return _0x34b95d;};}function handleError(_0x43ce24,_0x21bc22){_0x21bc22=_0x21bc22||0x1f4;return function(_0x2da040){logger[_0xd73a('0x1c')](_0x2da040[_0xd73a('0x2d')]);if(_0x2da040[_0xd73a('0x2e')]){delete _0x2da040[_0xd73a('0x2e')];}_0x43ce24[_0xd73a('0x21')](_0x21bc22)['send'](_0x2da040);};}function getMustacheRender(_0xbd7ff8,_0x54573a){return Mustache['render'](_0xbd7ff8,_[_0xd73a('0x2f')](_0x54573a[_0xd73a('0x30')],{'contact':_0x54573a[_0xd73a('0x31')],'message':_0x54573a[_0xd73a('0x1e')],'agent':_0x54573a[_0xd73a('0x32')],'interaction':_0x54573a[_0xd73a('0x33')],'account':_0x54573a[_0xd73a('0x34')]}))||'';}exports[_0xd73a('0x35')]=function(_0x1224aa,_0x4ba260){var _0x570a30={};var _0x1d161c=_['map'](db[_0xd73a('0x36')]['rawAttributes'],function(_0x401149){return{'name':_0x401149[_0xd73a('0x37')],'type':_0x401149[_0xd73a('0x38')][_0xd73a('0x39')]};});_0x570a30=qs[_0xd73a('0x3a')](_0x1d161c,_0x1224aa);return interaction[_0xd73a('0x3b')](_0xd73a('0x3c'),_0x1224aa['query'],_0x1224aa[_0xd73a('0x3d')],_0x570a30,_0x1d161c)[_0xd73a('0x15')](respondWithFilteredResult(_0x4ba260,_0x570a30))[_0xd73a('0x20')](handleError(_0x4ba260,null));};exports[_0xd73a('0x3e')]=function(_0x47cc33,_0x286497){var _0x1f368a={'raw':![],'where':{'id':_0x47cc33[_0xd73a('0x3f')]['id']}},_0x19c63b={};_0x19c63b[_0xd73a('0x40')]=_['keys'](db[_0xd73a('0x36')][_0xd73a('0x41')]);_0x19c63b[_0xd73a('0x42')]=_[_0xd73a('0x43')](_0x47cc33[_0xd73a('0x42')]);_0x19c63b['filters']=_[_0xd73a('0x44')](_0x19c63b[_0xd73a('0x40')],_0x19c63b[_0xd73a('0x42')]);_0x1f368a[_0xd73a('0x45')]=_[_0xd73a('0x44')](_0x19c63b[_0xd73a('0x40')],qs[_0xd73a('0x46')](_0x47cc33[_0xd73a('0x42')]['fields']));_0x1f368a[_0xd73a('0x45')]=_0x1f368a['attributes'][_0xd73a('0x47')]?_0x1f368a[_0xd73a('0x45')]:_0x19c63b[_0xd73a('0x40')];if(_0x47cc33[_0xd73a('0x42')][_0xd73a('0x48')]){_0x1f368a[_0xd73a('0x49')]=[{'all':!![]}];}_0x1f368a=_['merge']({},_0x1f368a,_0x47cc33[_0xd73a('0x4a')]);return db[_0xd73a('0x36')][_0xd73a('0x4b')](_0x1f368a)['then'](handleEntityNotFound(_0x286497,null))[_0xd73a('0x15')](respondWithResult(_0x286497,null))['catch'](handleError(_0x286497,null));};exports[_0xd73a('0x4c')]=function(_0x305576,_0x41ae0a){return db[_0xd73a('0x36')][_0xd73a('0x4c')](_0x305576[_0xd73a('0x30')],{})[_0xd73a('0x15')](respondWithResult(_0x41ae0a,0xc9))['catch'](handleError(_0x41ae0a,null));};exports[_0xd73a('0x2a')]=function(_0x10f900,_0x4a02a1){if(_0x10f900[_0xd73a('0x30')]['id']){delete _0x10f900[_0xd73a('0x30')]['id'];}return db[_0xd73a('0x36')][_0xd73a('0x4b')]({'where':{'id':_0x10f900[_0xd73a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4a02a1,null))[_0xd73a('0x15')](saveUpdates(_0x10f900[_0xd73a('0x30')],null))[_0xd73a('0x15')](respondWithResult(_0x4a02a1,null))['catch'](handleError(_0x4a02a1,null));};exports[_0xd73a('0x2b')]=function(_0x48caac,_0x311678){return db[_0xd73a('0x36')][_0xd73a('0x4b')]({'where':{'id':_0x48caac[_0xd73a('0x3f')]['id']}})[_0xd73a('0x15')](handleEntityNotFound(_0x311678,null))[_0xd73a('0x15')](removeEntity(_0x311678,null))['catch'](handleError(_0x311678,null));};exports[_0xd73a('0x4d')]=function(_0x4b75ed,_0x47cd76){return db[_0xd73a('0x36')][_0xd73a('0x4d')]()['then'](respondWithResult(_0x47cd76,null))['catch'](handleError(_0x47cd76,null));};exports[_0xd73a('0x4e')]=function(_0x4d4344,_0x456052){var _0x2627e2=_0x4d4344[_0xd73a('0x3f')]['id'];var _0x18e84e;var _0x38174a;var _0x4297b1;return db['ChatInteraction'][_0xd73a('0x4f')]({'where':{'id':_0x2627e2}})[_0xd73a('0x15')](function(_0x58ff52){_0x18e84e=_0x58ff52;return db[_0xd73a('0x50')][_0xd73a('0x4f')]({'where':{'id':_0x58ff52[_0xd73a('0x51')]},'attributes':['id',_0xd73a('0x52'),_0xd73a('0x53'),_0xd73a('0x54'),_0xd73a('0x55'),_0xd73a('0x56')],'raw':!![]});})['then'](function(_0x138c82){if(_0x138c82&&_0x138c82[_0xd73a('0x52')]&&_0x138c82[_0xd73a('0x53')]){_0x38174a=_0x138c82;var _0x3e23ac={'interaction':{'id':_0x2627e2},'agent':{'id':_0x4d4344[_0xd73a('0x3d')]['id'],'name':_0x4d4344[_0xd73a('0x3d')][_0xd73a('0x2e')],'fullname':_0x4d4344[_0xd73a('0x3d')][_0xd73a('0x57')],'email':_0x4d4344['user'][_0xd73a('0x58')]},'contact':_0x4d4344['body'][_0xd73a('0x31')],'account':_0x4d4344[_0xd73a('0x30')][_0xd73a('0x34')]};var _0x8dc5d3={'rejectUnauthorized':![],'method':'POST','url':_0xd73a('0x59'),'headers':{'X-APIKEY':_0x138c82[_0xd73a('0x52')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4d4344[_0xd73a('0x3d')][_0xd73a('0x58')]],'buttons':null,'topic':_0x38174a[_0xd73a('0x54')],'note':_['isNull'](_0x38174a[_0xd73a('0x55')])?null:getMustacheRender(_0x38174a[_0xd73a('0x55')],_0x3e23ac),'metadata':null},'redirect':_0xd73a('0x5a'),'json':!![]};try{if(!_['isNull'](_0x38174a['vidaooMetadata'])){var _0x252f18=getMustacheRender(_0x38174a[_0xd73a('0x56')],_0x3e23ac);var _0x1cc0cb=JSON['parse'](_0x252f18);_0x8dc5d3[_0xd73a('0x30')]['metadata']=_0x1cc0cb;}}catch(_0xf79de3){throw new db[(_0xd73a('0x5b'))][(_0xd73a('0x5c'))](_0xd73a('0x5d'));}return rp(_0x8dc5d3);}else{throw new db[(_0xd73a('0x5b'))][(_0xd73a('0x5c'))](_0xd73a('0x5e'));}})['then'](function(_0x2cc852){_0x4297b1=_0x2cc852;if(_0x4297b1['id']){var _0x54fb96={'body':_0x4297b1[_0xd73a('0x5f')],'ChatWebsiteId':_0x38174a['id'],'ChatInteractionId':_0x18e84e['id'],'direction':_0xd73a('0x60'),'UserId':_0x4d4344[_0xd73a('0x3d')]['id']};return db[_0xd73a('0x61')][_0xd73a('0x4c')](_0x54fb96,{});}else{throw new db[(_0xd73a('0x5b'))][(_0xd73a('0x5c'))](_0xd73a('0x62'));}})[_0xd73a('0x15')](function(){return _0x18e84e[_0xd73a('0x63')]({'vidaooSessionId':_0x4297b1['id']});})[_0xd73a('0x15')](respondWithResult(_0x456052,null))['catch'](handleError(_0x456052,null));};exports['customUpdate']=function(_0x594737,_0x25da65){if(_0x594737[_0xd73a('0x30')]['id']){delete _0x594737['body']['id'];}return db['ChatInteraction'][_0xd73a('0x4b')]({'where':{'id':_0x594737['params']['id']},'include':[{'model':db['CmContact'],'as':_0xd73a('0x64')}]})[_0xd73a('0x15')](handleEntityNotFound(_0x25da65,null))[_0xd73a('0x15')](saveUpdates(_0x594737[_0xd73a('0x30')],null))[_0xd73a('0x15')](respondWithResult(_0x25da65,null))['catch'](handleError(_0x25da65,null));};exports[_0xd73a('0x65')]=function(_0x125eb8,_0x1a85a1){if(_0x125eb8[_0xd73a('0x30')]['id']){delete _0x125eb8[_0xd73a('0x30')]['id'];}return db[_0xd73a('0x36')][_0xd73a('0x4b')]({'where':{'id':_0x125eb8[_0xd73a('0x3f')]['id']}})['then'](function(_0x521423){if(!_0x521423){logger[_0xd73a('0x1c')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xd73a('0x65'),0x194,_0xd73a('0x66'));_0x1a85a1[_0xd73a('0x2c')](0x194);}else{if(_0x521423['UserId']){throw new db['Sequelize'][(_0xd73a('0x5c'))](_0xd73a('0x67'));}}return _0x521423;})[_0xd73a('0x15')](function(_0x45fe11){if(_0x45fe11){return _0x45fe11[_0xd73a('0x2a')]({'closed':_0x125eb8[_0xd73a('0x30')][_0xd73a('0x68')],'disposition':_0x125eb8[_0xd73a('0x30')][_0xd73a('0x69')]})[_0xd73a('0x15')](function(_0x258aa8){return _0x258aa8;});}})['then'](function(){return respondWithRpcPromise(_0xd73a('0x6a'),_0xd73a('0x65'),_0x125eb8[_0xd73a('0x30')],client9004);})[_0xd73a('0x15')](respondWithResult(_0x1a85a1,null))[_0xd73a('0x20')](handleError(_0x1a85a1,null));};exports['attachmentUpload']=function(_0x29f821,_0x4afb2c){_0x29f821[_0xd73a('0x30')][_0xd73a('0x2e')]=_0x29f821['file'][_0xd73a('0x6b')];_0x29f821[_0xd73a('0x30')]['basename']=_0x29f821['file'][_0xd73a('0x6c')];_0x29f821[_0xd73a('0x30')][_0xd73a('0x38')]=_0x29f821[_0xd73a('0x6d')][_0xd73a('0x6e')];return db['Attachment'][_0xd73a('0x4c')](_0x29f821[_0xd73a('0x30')])[_0xd73a('0x15')](respondWithResult(_0x4afb2c,0xc9))[_0xd73a('0x20')](handleError(_0x4afb2c,null));};exports[_0xd73a('0x6f')]=function(_0x59cd92,_0x33e68f){return db[_0xd73a('0x36')][_0xd73a('0x4f')]({'where':{'id':_0x59cd92[_0xd73a('0x3f')]['id']},'raw':!![]})[_0xd73a('0x15')](handleEntityNotFound(_0x33e68f,null))[_0xd73a('0x15')](function(_0x2365b3){if(_0x2365b3){if(_0x2365b3[_0xd73a('0x68')]){return _0x33e68f['status'](0x193)['json']({'status':0x193,'message':_0xd73a('0x70')});}return db[_0xd73a('0x71')][_0xd73a('0x4f')]({'where':{'id':_0x59cd92[_0xd73a('0x42')][_0xd73a('0x72')]},'raw':!![]})[_0xd73a('0x15')](handleEntityNotFound(_0x33e68f,null));}})['then'](function(_0x3a8ba1){if(_0x3a8ba1){var _0x1d7884=_0x3a8ba1[_0xd73a('0x73')]!==null;var _0x1d44df=path[_0xd73a('0x74')](config['root'],'server/files/attachments/');if(_0x1d7884){_0x1d44df=path[_0xd73a('0x74')](_0x1d44df,'offline-chat/');}var _0x14fb84=path[_0xd73a('0x74')](_0x1d44df,_0x3a8ba1[_0xd73a('0x75')]);return _0x33e68f[_0xd73a('0x76')](_0x14fb84);}})[_0xd73a('0x20')](handleError(_0x33e68f,null));};exports['close']=function(_0x30457c,_0x3c7fec){var _0x200ad6=null;var _0x54540d=null;var _0x44abcd=null;if(_0x30457c[_0xd73a('0x30')]['id']){delete _0x30457c['body']['id'];}if(_0x30457c[_0xd73a('0x30')][_0xd73a('0x77')]){_0x44abcd=path['join'](config['root'],_0xd73a('0x78'),util[_0xd73a('0x79')](_0xd73a('0x7a'),Date[_0xd73a('0x7b')]()));_0x30457c[_0xd73a('0x30')][_0xd73a('0x7c')]=_0x44abcd;}return db['ChatInteraction'][_0xd73a('0x4b')]({'where':{'id':_0x30457c['params']['id']},'include':[{'model':db[_0xd73a('0x61')],'as':'Messages','include':[{'model':db[_0xd73a('0x7d')],'as':_0xd73a('0x7d')}]}]})[_0xd73a('0x15')](handleEntityNotFound(_0x3c7fec,null))[_0xd73a('0x15')](saveUpdates(_0x30457c[_0xd73a('0x30')],null))[_0xd73a('0x15')](function(_0x57e46c){if(_0x57e46c){_0x200ad6=_0x57e46c;return db[_0xd73a('0x50')][_0xd73a('0x4b')]({'where':{'id':_0x200ad6['ChatWebsiteId']}});}})[_0xd73a('0x15')](function(_0x479f8c){if(_0x479f8c){_0x54540d=_0x479f8c;return db[_0xd73a('0x7e')][_0xd73a('0x4b')]({'where':{'id':_0x200ad6['ContactId']}});}})[_0xd73a('0x15')](function(_0x4705ca){if(_0x4705ca){if(_0x44abcd){var _0x55cfd1=null;for(var _0xb15e72=0x1;_0xb15e72<_0x200ad6[_0xd73a('0x7f')][_0xd73a('0x47')];++_0xb15e72){_0x55cfd1=_0x200ad6['Messages'][_0xb15e72];var _0x1bf2d6=_0x55cfd1[_0xd73a('0x80')]?util['format']('%s%d',_0x54540d[_0xd73a('0x81')],_0x55cfd1[_0xd73a('0x80')]):'System';var _0x3182e7=_0x30457c[_0xd73a('0x30')]['customer']||util[_0xd73a('0x79')](_0xd73a('0x82'),'Visitor',_0x55cfd1[_0xd73a('0x83')]);switch(_0x54540d['agentIdentifier']){case _0xd73a('0x84'):_0x1bf2d6=_0x55cfd1[_0xd73a('0x80')]?util[_0xd73a('0x79')]('%s%d',_0x54540d['agentAlias'],_0x55cfd1[_0xd73a('0x80')]):_0xd73a('0x85');break;case _0xd73a('0x86'):_0x1bf2d6=_0x55cfd1[_0xd73a('0x80')]?_0x55cfd1[_0xd73a('0x7d')][_0xd73a('0x87')]||_0x55cfd1['User'][_0xd73a('0x57')]:_0xd73a('0x85');break;case'agent_fullname':_0x1bf2d6=_0x55cfd1[_0xd73a('0x80')]?_0x55cfd1[_0xd73a('0x7d')]['fullname']:_0xd73a('0x85');break;default:_0x1bf2d6=_0x55cfd1[_0xd73a('0x80')]?util[_0xd73a('0x79')]('%s%d',_0x54540d[_0xd73a('0x81')],_0x55cfd1['UserId']):'System';}var _0x2b9f93=util[_0xd73a('0x79')](_0xd73a('0x88'),moment(_0x55cfd1[_0xd73a('0x89')])[_0xd73a('0x79')](_0xd73a('0x8a')),_0x55cfd1['direction']==='in'?_0x3182e7:_0x1bf2d6,_0x55cfd1[_0xd73a('0x30')]);if(!_0x55cfd1[_0xd73a('0x8b')]){fs[_0xd73a('0x8c')](_0x44abcd,_0x2b9f93);}}return db[_0xd73a('0x8d')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xd73a('0x8e')],'as':_0xd73a('0x8f'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xd73a('0x15')](function(_0x5901a3){if(!_0x5901a3||!_0x5901a3['Smtp']||!_0x30457c[_0xd73a('0x30')])return _0x200ad6;var _0x54d2f4=_0x5901a3[_0xd73a('0x90')]();return respondWithRpcPromise(_0xd73a('0x91'),_0xd73a('0x92'),{'account':_0x54d2f4,'message':{'from':util[_0xd73a('0x79')](_0xd73a('0x93'),_0x5901a3['name'],_0x5901a3['email']||_0x5901a3[_0xd73a('0x8f')]['user']),'to':_0x30457c['body'][_0xd73a('0x77')],'subject':_0xd73a('0x94'),'text':util[_0xd73a('0x79')](_0xd73a('0x95'),_0x30457c[_0xd73a('0x30')]['mailTranscript']),'attachments':[{'path':_0x44abcd}]}})[_0xd73a('0x15')](function(){return _0x200ad6;})['catch'](function(_0x3f9fbe){logger[_0xd73a('0x1c')](_0x3f9fbe);});})[_0xd73a('0x15')](respondWithStatusCode(_0x3c7fec,0xc8))['catch'](handleError(_0x3c7fec,null));};exports[_0xd73a('0x96')]=function(_0x459cf1,_0x51d306){return db[_0xd73a('0x61')][_0xd73a('0x4b')]({'where':{'id':_0x459cf1[_0xd73a('0x3f')]['id']}})[_0xd73a('0x15')](handleEntityNotFound(_0x51d306,null))['then'](function(_0x3f8497){if(_0x3f8497){return _0x3f8497[_0xd73a('0x96')](_0x459cf1[_0xd73a('0x30')]['ids'],_['omit'](_0x459cf1['body'],[_0xd73a('0x97'),'id'])||{});}})[_0xd73a('0x15')](respondWithResult(_0x51d306,null))[_0xd73a('0x20')](handleError(_0x51d306,null));};exports[_0xd73a('0x98')]=function(_0x58c8a5,_0x5cd2a3){var _0x20fb27={'raw':![],'where':{}};var _0x5c3a34={};var _0x52aae2={'count':0x0,'rows':[]};return db[_0xd73a('0x36')][_0xd73a('0x4f')]({'where':{'id':_0x58c8a5[_0xd73a('0x3f')]['id']}})[_0xd73a('0x15')](handleEntityNotFound(_0x5cd2a3,null))[_0xd73a('0x15')](function(_0x5c87d7){if(_0x5c87d7){_0x5c3a34[_0xd73a('0x40')]=_['keys'](db[_0xd73a('0x61')]['rawAttributes']);_0x5c3a34[_0xd73a('0x42')]=_[_0xd73a('0x43')](_0x58c8a5[_0xd73a('0x42')]);_0x5c3a34[_0xd73a('0x99')]=_[_0xd73a('0x44')](_0x5c3a34[_0xd73a('0x40')],_0x5c3a34['query']);_0x20fb27['attributes']=_[_0xd73a('0x44')](_0x5c3a34[_0xd73a('0x40')],qs['fields'](_0x58c8a5['query'][_0xd73a('0x46')]));_0x20fb27['attributes']=_0x20fb27[_0xd73a('0x45')][_0xd73a('0x47')]?_0x20fb27[_0xd73a('0x45')]:_0x5c3a34[_0xd73a('0x40')];if(!_0x58c8a5[_0xd73a('0x42')][_0xd73a('0x9a')]('nolimit')){_0x20fb27[_0xd73a('0x26')]=qs[_0xd73a('0x26')](_0x58c8a5[_0xd73a('0x42')][_0xd73a('0x26')]);_0x20fb27[_0xd73a('0x24')]=qs[_0xd73a('0x24')](_0x58c8a5[_0xd73a('0x42')][_0xd73a('0x24')]);}_0x20fb27[_0xd73a('0x9b')]=qs[_0xd73a('0x9c')](_0x58c8a5['query']['sort']);_0x20fb27[_0xd73a('0x9d')]=qs['filters'](_[_0xd73a('0x9e')](_0x58c8a5['query'],_0x5c3a34['filters']));_0x20fb27[_0xd73a('0x9d')]['ChatInteractionId']=_0x5c87d7['id'];if(_0x58c8a5[_0xd73a('0x42')][_0xd73a('0x9f')]){_0x20fb27[_0xd73a('0x9d')]=_['merge'](_0x20fb27[_0xd73a('0x9d')],{'$or':_[_0xd73a('0xa0')](_0x20fb27[_0xd73a('0x45')],function(_0x121339){var _0x51f573={};_0x51f573[_0x121339]={'$like':'%'+_0x58c8a5[_0xd73a('0x42')][_0xd73a('0x9f')]+'%'};return _0x51f573;})});}if(_0x58c8a5[_0xd73a('0x42')][_0xd73a('0xa1')]){var _0x582e6e=_0x58c8a5[_0xd73a('0x42')][_0xd73a('0xa1')][_0xd73a('0xa2')](',');var _0x286bd2={};_0x286bd2[_0x582e6e[0x0]]={'$gte':moment(_0x582e6e[0x1])[_0xd73a('0x79')]('YYYY-MM-DD\x20HH:mm:ss')};_0x20fb27[_0xd73a('0x9d')]=_[_0xd73a('0x2f')](_0x20fb27[_0xd73a('0x9d')],_0x286bd2);}_0x20fb27=_['merge']({},_0x20fb27,_0x58c8a5[_0xd73a('0x4a')]);return db[_0xd73a('0x61')][_0xd73a('0x27')]({'where':_0x20fb27[_0xd73a('0x9d')]})[_0xd73a('0x15')](function(_0x47c5fc){_0x52aae2[_0xd73a('0x27')]=_0x47c5fc;if(_0x58c8a5[_0xd73a('0x42')][_0xd73a('0x48')]){_0x20fb27[_0xd73a('0x49')]=[{'all':!![]}];}return db[_0xd73a('0x61')][_0xd73a('0x3b')](_0x20fb27);})['then'](function(_0x43e3a7){_0x52aae2['rows']=_0x43e3a7;return _0x52aae2;});}})[_0xd73a('0x15')](respondWithFilteredResult(_0x5cd2a3,_0x20fb27))['catch'](handleError(_0x5cd2a3,null));};exports['getMyMessages']=function(_0x1c0b90,_0x1c8dc8){var _0x34b6da={'where':{}},_0x20550d={},_0x2472a7={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xd73a('0x4f')]({'where':{'id':_0x1c0b90[_0xd73a('0x3f')]['id']}})[_0xd73a('0x15')](handleEntityNotFound(_0x1c8dc8,null))['then'](function(_0x3ba533){if(_0x3ba533){_0x20550d[_0xd73a('0x40')]=_[_0xd73a('0x43')](db[_0xd73a('0x61')][_0xd73a('0x41')]);_0x20550d[_0xd73a('0x42')]=_[_0xd73a('0x43')](_0x1c0b90['query']);_0x20550d['filters']=_['intersection'](_0x20550d[_0xd73a('0x40')],_0x20550d[_0xd73a('0x42')]);_0x34b6da['attributes']=_[_0xd73a('0x44')](_0x20550d[_0xd73a('0x40')],qs[_0xd73a('0x46')](_0x1c0b90[_0xd73a('0x42')]['fields']));_0x34b6da[_0xd73a('0x45')]=_0x34b6da[_0xd73a('0x45')][_0xd73a('0x47')]?_0x34b6da['attributes']:_0x20550d[_0xd73a('0x40')];if(!_0x1c0b90[_0xd73a('0x42')][_0xd73a('0x9a')]('nolimit')){_0x34b6da[_0xd73a('0x26')]=qs['limit'](_0x1c0b90[_0xd73a('0x42')][_0xd73a('0x26')]);_0x34b6da[_0xd73a('0x24')]=qs[_0xd73a('0x24')](_0x1c0b90[_0xd73a('0x42')][_0xd73a('0x24')]);}_0x34b6da[_0xd73a('0x9b')]=qs[_0xd73a('0x9c')](_0x1c0b90[_0xd73a('0x42')][_0xd73a('0x9c')]);_0x34b6da['where']=qs[_0xd73a('0x99')](_['pick'](_0x1c0b90['query'],_0x20550d['filters']));_0x34b6da[_0xd73a('0x9d')][_0xd73a('0xa3')]=_0x3ba533['id'];if(_0x1c0b90['query'][_0xd73a('0x9f')]){_0x34b6da['where']=_['merge'](_0x34b6da['where'],{'$or':_['map'](_0x34b6da[_0xd73a('0x45')],function(_0x3897b7){var _0x2d2706={};_0x2d2706[_0x3897b7]={'$like':'%'+_0x1c0b90[_0xd73a('0x42')]['filter']+'%'};return _0x2d2706;})});}_0x34b6da['where']['secret']=![];if(_0x1c0b90[_0xd73a('0x42')]['id']){_0x34b6da['where']['id']={'$gt':_0x1c0b90[_0xd73a('0x42')]['id']};}_0x34b6da=_['merge']({},_0x34b6da,_0x1c0b90['options']);return db[_0xd73a('0x61')][_0xd73a('0x27')]({'where':_0x34b6da[_0xd73a('0x9d')]})[_0xd73a('0x15')](function(_0x2960b3){_0x2472a7[_0xd73a('0x27')]=_0x2960b3;_0x34b6da['include']=[];if(_0x1c0b90[_0xd73a('0x42')]['includeAgent']){_0x34b6da['include'][_0xd73a('0xa4')]({'model':db[_0xd73a('0x7d')],'as':_0xd73a('0x7d'),'attributes':['id',_0xd73a('0x57'),_0xd73a('0x87')]});}if(_0x1c0b90[_0xd73a('0x42')]['includeAll']){_0x34b6da[_0xd73a('0x49')]=[{'all':!![]}];}return db[_0xd73a('0x61')]['findAll'](_0x34b6da);})[_0xd73a('0x15')](function(_0x2a836b){_0x2472a7[_0xd73a('0xa5')]=_0x2a836b;return _0x2472a7;});}})[_0xd73a('0x15')](respondWithFilteredResult(_0x1c8dc8,_0x34b6da))[_0xd73a('0x20')](handleError(_0x1c8dc8,null));};exports['addTags']=function(_0x154642,_0x9a04bf){return db[_0xd73a('0x36')]['find']({'where':{'id':_0x154642[_0xd73a('0x3f')]['id']}})[_0xd73a('0x15')](handleEntityNotFound(_0x9a04bf,null))['then'](function(_0x187a9a){if(_0x187a9a){return _0x187a9a['setTags'](_0x154642[_0xd73a('0x30')]['ids'],_[_0xd73a('0xa6')](_0x154642[_0xd73a('0x30')],[_0xd73a('0x97'),'id'])||{})[_0xd73a('0xa7')](function(){return db[_0xd73a('0xa8')][_0xd73a('0x3b')]({'attributes':['id',_0xd73a('0x2e'),_0xd73a('0xa9')],'where':{'id':_0x154642[_0xd73a('0x30')]['ids']}});})[_0xd73a('0x15')](function(_0x1e1a92){socket[_0xd73a('0xaa')](_0xd73a('0xab'),{'id':Number(_0x154642[_0xd73a('0x3f')]['id']),'tags':_0x1e1a92||[]});return{'id':Number(_0x154642['params']['id']),'tags':_0x1e1a92||[]};});}})[_0xd73a('0x15')](respondWithResult(_0x9a04bf,null))[_0xd73a('0x20')](handleError(_0x9a04bf,null));};exports[_0xd73a('0xac')]=function(_0x54a3cf,_0x50e40d){return db['ChatInteraction']['find']({'where':{'id':_0x54a3cf[_0xd73a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x50e40d,null))[_0xd73a('0x15')](function(_0x231819){if(_0x231819){return _0x231819['removeTags'](_0x54a3cf[_0xd73a('0x42')][_0xd73a('0x97')]);}})['then'](respondWithStatusCode(_0x50e40d,null))[_0xd73a('0x20')](handleError(_0x50e40d,null));};exports[_0xd73a('0x76')]=function(_0x28f376,_0x8eaccc){var _0x597a55=moment()[_0xd73a('0xad')]()[_0xd73a('0xae')]();var _0x193117=path[_0xd73a('0x74')](config['root'],_0xd73a('0xaf'),'files','tmp');var _0x5123f9=path[_0xd73a('0x74')](config['root'],'server',_0xd73a('0xb0'),_0xd73a('0xb1'));var _0xb69059=path[_0xd73a('0x74')](_0x193117,_0x597a55);var _0xb1a0e6=util[_0xd73a('0x79')]('transcript-%d-%s.zip',_0x28f376[_0xd73a('0x3f')]['id'],_0x597a55);var _0x1e6203=path[_0xd73a('0x74')](_0x193117,_0xb1a0e6);var _0x233289=[];_0x233289[_0xd73a('0xa4')]({'model':db[_0xd73a('0x7d')],'as':_0xd73a('0x7d'),'attributes':['id',_0xd73a('0x57')],'raw':!![]});_0x233289[_0xd73a('0xa4')]({'model':db[_0xd73a('0x7e')],'as':_0xd73a('0x64'),'attributes':['id',_0xd73a('0xb2'),_0xd73a('0xb3')],'raw':!![]});if(_0x28f376[_0xd73a('0x42')]['attachments']){_0x233289[_0xd73a('0xa4')]({'model':db[_0xd73a('0x71')],'as':_0xd73a('0x71'),'raw':!![]});}var _0x15dd6f=[{'model':db['ChatMessage'],'as':_0xd73a('0x7f'),'attributes':['id',_0xd73a('0x30'),_0xd73a('0x89'),_0xd73a('0xb4'),_0xd73a('0x8b'),'read'],'include':_0x233289}];_0x15dd6f[_0xd73a('0xa4')]({'model':db[_0xd73a('0x50')],'as':_0xd73a('0xb5'),'attributes':['id',_0xd73a('0x2e')]});_0x15dd6f['push']({'model':db[_0xd73a('0x7d')],'as':_0xd73a('0xb6'),'attributes':['id','fullname']});return db[_0xd73a('0x36')][_0xd73a('0x4b')]({'where':{'id':_0x28f376[_0xd73a('0x3f')]['id']},'include':_0x15dd6f})[_0xd73a('0x15')](handleEntityNotFound(_0x8eaccc,null))[_0xd73a('0x15')](function(_0xaa7c9e){if(_0xaa7c9e){var _0x3b2bfd=_0xaa7c9e[_0xd73a('0xb7')]({'plain':!![]});fs[_0xd73a('0xb8')](_0xb69059);var _0x4f4160={'channel':_0xd73a('0xb9'),'account':_0x3b2bfd['Account']['name'],'agent':_0x3b2bfd['Owner']?_0x3b2bfd['Owner']['fullname']:_0xd73a('0xba'),'createdAt':moment(_0x3b2bfd['createdAt'])['format'](_0xd73a('0xbb'))['toString'](),'closedAt':_0x3b2bfd[_0xd73a('0x68')]?moment(_0x3b2bfd['closedAt'])['format'](_0xd73a('0xbb'))[_0xd73a('0xae')]():'','disposition':_0x3b2bfd[_0xd73a('0x69')],'chatInfo':{'browser':_0x3b2bfd['browserName'],'os':_0x3b2bfd[_0xd73a('0xbc')],'referer':_0x3b2bfd['referer'],'customerIp':_0x3b2bfd[_0xd73a('0xbd')],'customerPort':_0x3b2bfd[_0xd73a('0xbe')]?_0x3b2bfd[_0xd73a('0xbe')]:_0xd73a('0xba')},'messages':_(_0x3b2bfd[_0xd73a('0x7f')])['tail']()[_0xd73a('0x9f')]({'secret':![]})[_0xd73a('0xa0')](function(_0x122c5a){if(_0x122c5a[_0xd73a('0x71')]){var _0xfbd6d6=path[_0xd73a('0x74')](_0x5123f9,_0x122c5a[_0xd73a('0x71')][_0xd73a('0x75')]);if(fs[_0xd73a('0xbf')](_0xfbd6d6)){fs[_0xd73a('0xc0')](_0xfbd6d6)[_0xd73a('0xc1')](fs[_0xd73a('0xc2')](path[_0xd73a('0x74')](_0xb69059,_0x122c5a[_0xd73a('0x71')][_0xd73a('0x75')])));}}return{'date':moment(_0x122c5a[_0xd73a('0x89')])[_0xd73a('0x79')]('YYYY-MM-DD\x20HH:mm:ss')[_0xd73a('0xae')](),'sender':_0x122c5a[_0xd73a('0xb4')]===_0xd73a('0x60')?_0x122c5a[_0xd73a('0x7d')]?_0x122c5a['User'][_0xd73a('0x57')]:'System':_0x122c5a[_0xd73a('0x64')][_0xd73a('0xb2')]+(_0x122c5a[_0xd73a('0x64')]['lastName']?'\x20'+_0x122c5a[_0xd73a('0x64')][_0xd73a('0xb3')]:''),'body':_0x122c5a[_0xd73a('0x71')]?_0x122c5a[_0xd73a('0x71')][_0xd73a('0x75')]:_0x122c5a[_0xd73a('0x30')],'direction':_0x122c5a[_0xd73a('0xb4')]===_0xd73a('0x60')?'A':'C','secret':_0x122c5a[_0xd73a('0x8b')],'read':_0x122c5a['read'],'attachment':_0x122c5a[_0xd73a('0x71')]};})[_0xd73a('0xc3')]()};return ejs[_0xd73a('0xc4')](path['join'](config['root'],_0xd73a('0xaf'),'views','downloadInteraction.ejs'),{'interaction':_0x4f4160})[_0xd73a('0x15')](function(_0x4e3375){var _0x1acf4e=path['join'](_0xb69059,_0xd73a('0xc5')+_0x3b2bfd['id']+'-'+_0x597a55+_0xd73a('0xc6'));var _0x373f90={'path':_0x1acf4e,'channel':_0xd73a('0xb9'),'interactionId':_0x3b2bfd['id']};return pdf[_0xd73a('0xc7')](_0x4e3375,_0x373f90);})[_0xd73a('0x15')](function(){return new Promise(function(_0x250654,_0x10d47d){zipdir(_0xb69059,{'saveTo':_0x1e6203},function(_0x384337,_0x468edc){if(_0x384337)return _0x10d47d(_0x384337);return _0x250654(_0x468edc);});})['then'](function(){return new BPromise(function(_0x5714e7,_0xa56fea){rimraf(_0xb69059,function(_0x13e12d){if(_0x13e12d)_0xa56fea(_0x13e12d);return _0x5714e7();});});})[_0xd73a('0x15')](function(){return _0x8eaccc['download'](_0x1e6203,_0xb1a0e6,function(_0x58b22c){if(_0x58b22c){logger[_0xd73a('0x1c')](_0xd73a('0xc8'),_0x58b22c);}else{fs[_0xd73a('0xc9')](_0x1e6203);}});});});}else{return _0x8eaccc['sendStatus'](0xc8);}})[_0xd73a('0x20')](handleError(_0x8eaccc,null));}; \ No newline at end of file +var _0xa06f=['customUpdate','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','UserId','Interaction\x20already\x20assigned','update','closed','disposition','AbandonInteraction','attachmentUpload','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','join','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','pathTranscript','User','ChatWebsite','ChatWebsiteId','CmContact','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','options','includeAgent','push','alias','rows','spread','Tag','color','emit','chatInteractionTags:save','toString','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','attachments','direction','Account','Owner','get','closedAt','browserName','osName','referer','customerIp','customerPort','N.A.','Messages','basename','pipe','out','value','renderFile','views','transcript-','.pdf','Chat','createPdfFromHTML','err','request-promise','bluebird','mustache','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','stack','name','send','render','merge','contact','agent','interaction','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','chat','user','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','find','create','body','destroy','describe','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes'];(function(_0x4c16c4,_0x1f4fb2){var _0x2d2ddf=function(_0xfa51f8){while(--_0xfa51f8){_0x4c16c4['push'](_0x4c16c4['shift']());}};_0x2d2ddf(++_0x1f4fb2);}(_0xa06f,0x73));var _0xfa06=function(_0x52fa9a,_0x2026f9){_0x52fa9a=_0x52fa9a-0x0;var _0xa5ee31=_0xa06f[_0x52fa9a];return _0xa5ee31;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var rp=require(_0xfa06('0x0'));var moment=require('moment');var BPromise=require(_0xfa06('0x1'));var Mustache=require(_0xfa06('0x2'));var util=require(_0xfa06('0x3'));var path=require(_0xfa06('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfa06('0x5'));var Redis=require(_0xfa06('0x6'));var interaction=require(_0xfa06('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xfa06('0x8'))('api');var config=require(_0xfa06('0x9'));var db=require(_0xfa06('0xa'))['db'];config[_0xfa06('0xb')]=_[_0xfa06('0xc')](config[_0xfa06('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa06('0xd'))(new Redis(config['redis']));require(_0xfa06('0xe'))['register'](socket);var jayson=require(_0xfa06('0xf'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0xfa06('0x10')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3c9f78,_0x1b10d5,_0x5a048a,_0x2880ef){return new BPromise(function(_0x79d15a,_0x5dcba1){var _0x57e5e0=_0x2880ef||client;return _0x57e5e0['request'](_0x3c9f78,_0x5a048a)[_0xfa06('0x11')](function(_0x6464cd){logger[_0xfa06('0x12')](_0xfa06('0x13'),_0x1b10d5,_0xfa06('0x14'));logger[_0xfa06('0x15')](_0xfa06('0x16'),_0x1b10d5,_0xfa06('0x14'),JSON[_0xfa06('0x17')](_0x6464cd));if(_0x6464cd[_0xfa06('0x18')]){if(_0x6464cd[_0xfa06('0x18')]['code']===0x1f4){logger[_0xfa06('0x18')](_0xfa06('0x13'),_0x1b10d5,_0x6464cd[_0xfa06('0x18')][_0xfa06('0x19')]);return _0x5dcba1(_0x6464cd[_0xfa06('0x18')][_0xfa06('0x19')]);}logger[_0xfa06('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x1b10d5,_0x6464cd[_0xfa06('0x18')]['message']);return _0x79d15a(_0x6464cd[_0xfa06('0x18')]['message']);}else{logger[_0xfa06('0x12')](_0xfa06('0x13'),_0x1b10d5,_0xfa06('0x14'));_0x79d15a(_0x6464cd['result'][_0xfa06('0x19')]);}})[_0xfa06('0x1a')](function(_0x2be302){logger[_0xfa06('0x18')](_0xfa06('0x13'),_0x1b10d5,_0x2be302);_0x5dcba1(_0x2be302);});});}function respondWithStatusCode(_0x378406,_0x1cb7d7){_0x1cb7d7=_0x1cb7d7||0xcc;return function(_0x93f3c9){if(_0x93f3c9){return _0x378406[_0xfa06('0x1b')](_0x1cb7d7);}return _0x378406['status'](_0x1cb7d7)[_0xfa06('0x1c')]();};}function respondWithResult(_0x3515ea,_0x40288f){_0x40288f=_0x40288f||0xc8;return function(_0x4e818f){if(_0x4e818f){return _0x3515ea[_0xfa06('0x1d')](_0x40288f)[_0xfa06('0x1e')](_0x4e818f);}};}function respondWithFilteredResult(_0x548146,_0x131d19){return function(_0x5ab739){if(_0x5ab739){var _0x1b2e81=typeof _0x131d19[_0xfa06('0x1f')]===_0xfa06('0x20')&&typeof _0x131d19['limit']===_0xfa06('0x20');var _0x43e303=_0x5ab739[_0xfa06('0x21')];var _0x330dd8=_0x1b2e81?0x0:_0x131d19[_0xfa06('0x1f')];var _0x2ba30e=_0x1b2e81?_0x5ab739['count']:_0x131d19[_0xfa06('0x1f')]+_0x131d19['limit'];var _0x123134;if(_0x2ba30e>=_0x43e303){_0x2ba30e=_0x43e303;_0x123134=0xc8;}else{_0x123134=0xce;}_0x548146[_0xfa06('0x1d')](_0x123134);return _0x548146[_0xfa06('0x22')](_0xfa06('0x23'),_0x330dd8+'-'+_0x2ba30e+'/'+_0x43e303)['json'](_0x5ab739);}return null;};}function saveUpdates(_0x2873c5){return function(_0x3140c8){if(_0x3140c8){return _0x3140c8['update'](_0x2873c5)[_0xfa06('0x11')](function(_0x2870f9){return _0x2870f9;});}return null;};}function removeEntity(_0x23c433){return function(_0x12c98c){if(_0x12c98c){return _0x12c98c['destroy']()[_0xfa06('0x11')](function(){_0x23c433[_0xfa06('0x1d')](0xcc)[_0xfa06('0x1c')]();});}};}function handleEntityNotFound(_0x5ee9f6){return function(_0x18be50){if(!_0x18be50){_0x5ee9f6[_0xfa06('0x1b')](0x194);}return _0x18be50;};}function handleError(_0x433fe1,_0x2ae2c2){_0x2ae2c2=_0x2ae2c2||0x1f4;return function(_0x1f7586){logger[_0xfa06('0x18')](_0x1f7586[_0xfa06('0x24')]);if(_0x1f7586[_0xfa06('0x25')]){delete _0x1f7586[_0xfa06('0x25')];}_0x433fe1[_0xfa06('0x1d')](_0x2ae2c2)[_0xfa06('0x26')](_0x1f7586);};}function getMustacheRender(_0x4e5688,_0x514836){return Mustache[_0xfa06('0x27')](_0x4e5688,_[_0xfa06('0x28')](_0x514836['body'],{'contact':_0x514836[_0xfa06('0x29')],'message':_0x514836[_0xfa06('0x19')],'agent':_0x514836[_0xfa06('0x2a')],'interaction':_0x514836[_0xfa06('0x2b')],'account':_0x514836['account']}))||'';}exports[_0xfa06('0x2c')]=function(_0x50699c,_0x4856ad){var _0x8b2f70={};var _0x32cbf1=_[_0xfa06('0x2d')](db[_0xfa06('0x2e')][_0xfa06('0x2f')],function(_0x10f42c){return{'name':_0x10f42c[_0xfa06('0x30')],'type':_0x10f42c[_0xfa06('0x31')][_0xfa06('0x32')]};});_0x8b2f70=qs[_0xfa06('0x33')](_0x32cbf1,_0x50699c);return interaction['findAll'](_0xfa06('0x34'),_0x50699c['query'],_0x50699c[_0xfa06('0x35')],_0x8b2f70,_0x32cbf1)[_0xfa06('0x11')](respondWithFilteredResult(_0x4856ad,_0x8b2f70))['catch'](handleError(_0x4856ad,null));};exports[_0xfa06('0x36')]=function(_0x5ccb85,_0x3333ba){var _0x4d9679={'raw':![],'where':{'id':_0x5ccb85[_0xfa06('0x37')]['id']}},_0x226991={};_0x226991[_0xfa06('0x38')]=_[_0xfa06('0x39')](db[_0xfa06('0x2e')]['rawAttributes']);_0x226991['query']=_[_0xfa06('0x39')](_0x5ccb85[_0xfa06('0x3a')]);_0x226991['filters']=_[_0xfa06('0x3b')](_0x226991[_0xfa06('0x38')],_0x226991['query']);_0x4d9679[_0xfa06('0x3c')]=_[_0xfa06('0x3b')](_0x226991[_0xfa06('0x38')],qs['fields'](_0x5ccb85[_0xfa06('0x3a')][_0xfa06('0x3d')]));_0x4d9679[_0xfa06('0x3c')]=_0x4d9679[_0xfa06('0x3c')][_0xfa06('0x3e')]?_0x4d9679[_0xfa06('0x3c')]:_0x226991[_0xfa06('0x38')];if(_0x5ccb85[_0xfa06('0x3a')][_0xfa06('0x3f')]){_0x4d9679['include']=[{'all':!![]}];}_0x4d9679=_[_0xfa06('0x28')]({},_0x4d9679,_0x5ccb85['options']);return db[_0xfa06('0x2e')][_0xfa06('0x40')](_0x4d9679)['then'](handleEntityNotFound(_0x3333ba,null))[_0xfa06('0x11')](respondWithResult(_0x3333ba,null))['catch'](handleError(_0x3333ba,null));};exports['create']=function(_0x3a746d,_0x212bab){return db[_0xfa06('0x2e')][_0xfa06('0x41')](_0x3a746d[_0xfa06('0x42')],{})[_0xfa06('0x11')](respondWithResult(_0x212bab,0xc9))[_0xfa06('0x1a')](handleError(_0x212bab,null));};exports['update']=function(_0x4db1e8,_0x390281){if(_0x4db1e8['body']['id']){delete _0x4db1e8['body']['id'];}return db[_0xfa06('0x2e')][_0xfa06('0x40')]({'where':{'id':_0x4db1e8[_0xfa06('0x37')]['id']}})['then'](handleEntityNotFound(_0x390281,null))[_0xfa06('0x11')](saveUpdates(_0x4db1e8[_0xfa06('0x42')],null))[_0xfa06('0x11')](respondWithResult(_0x390281,null))[_0xfa06('0x1a')](handleError(_0x390281,null));};exports[_0xfa06('0x43')]=function(_0xeb89d1,_0x1c9223){return db[_0xfa06('0x2e')][_0xfa06('0x40')]({'where':{'id':_0xeb89d1[_0xfa06('0x37')]['id']}})[_0xfa06('0x11')](handleEntityNotFound(_0x1c9223,null))['then'](removeEntity(_0x1c9223,null))['catch'](handleError(_0x1c9223,null));};exports['describe']=function(_0x23d165,_0x217724){return db[_0xfa06('0x2e')][_0xfa06('0x44')]()[_0xfa06('0x11')](respondWithResult(_0x217724,null))[_0xfa06('0x1a')](handleError(_0x217724,null));};exports['createVidaooSession']=function(_0x80b2e0,_0x2c2189){var _0x40b78a=_0x80b2e0[_0xfa06('0x37')]['id'];var _0x1b4bb1;var _0x3ec7f8;var _0xc6c530;return db[_0xfa06('0x2e')][_0xfa06('0x45')]({'where':{'id':_0x40b78a}})[_0xfa06('0x11')](function(_0x2811f3){_0x1b4bb1=_0x2811f3;return db['ChatWebsite']['findOne']({'where':{'id':_0x2811f3['ChatWebsiteId']},'attributes':['id',_0xfa06('0x46'),_0xfa06('0x47'),_0xfa06('0x48'),_0xfa06('0x49'),_0xfa06('0x4a')],'raw':!![]});})[_0xfa06('0x11')](function(_0x1ad57c){if(_0x1ad57c&&_0x1ad57c[_0xfa06('0x46')]&&_0x1ad57c[_0xfa06('0x47')]){_0x3ec7f8=_0x1ad57c;var _0x71041f={'interaction':{'id':_0x40b78a},'agent':{'id':_0x80b2e0[_0xfa06('0x35')]['id'],'name':_0x80b2e0[_0xfa06('0x35')]['name'],'fullname':_0x80b2e0[_0xfa06('0x35')][_0xfa06('0x4b')],'email':_0x80b2e0[_0xfa06('0x35')][_0xfa06('0x4c')]},'contact':_0x80b2e0['body']['contact'],'account':_0x80b2e0['body']['account']};var _0x546b9c={'rejectUnauthorized':![],'method':_0xfa06('0x4d'),'url':_0xfa06('0x4e'),'headers':{'X-APIKEY':_0x1ad57c[_0xfa06('0x46')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x80b2e0[_0xfa06('0x35')][_0xfa06('0x4c')]],'buttons':null,'topic':_0x3ec7f8[_0xfa06('0x48')],'note':_[_0xfa06('0x4f')](_0x3ec7f8[_0xfa06('0x49')])?null:getMustacheRender(_0x3ec7f8[_0xfa06('0x49')],_0x71041f),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xfa06('0x4f')](_0x3ec7f8[_0xfa06('0x4a')])){var _0x240d76=getMustacheRender(_0x3ec7f8['vidaooMetadata'],_0x71041f);var _0x5c62f7=JSON[_0xfa06('0x50')](_0x240d76);_0x546b9c[_0xfa06('0x42')][_0xfa06('0x51')]=_0x5c62f7;}}catch(_0x41ff8a){throw new db['Sequelize'][(_0xfa06('0x52'))](_0xfa06('0x53'));}return rp(_0x546b9c);}else{throw new db[(_0xfa06('0x54'))][(_0xfa06('0x52'))](_0xfa06('0x55'));}})[_0xfa06('0x11')](function(_0x5469a3){_0xc6c530=_0x5469a3;if(_0xc6c530['id']){var _0x421c2e={'body':_0xc6c530[_0xfa06('0x56')],'ChatWebsiteId':_0x3ec7f8['id'],'ChatInteractionId':_0x1b4bb1['id'],'direction':'out','UserId':_0x80b2e0[_0xfa06('0x35')]['id']};return db[_0xfa06('0x57')][_0xfa06('0x41')](_0x421c2e,{});}else{throw new db[(_0xfa06('0x54'))][(_0xfa06('0x52'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x1b4bb1[_0xfa06('0x58')]({'vidaooSessionId':_0xc6c530['id']});})[_0xfa06('0x11')](respondWithResult(_0x2c2189,null))[_0xfa06('0x1a')](handleError(_0x2c2189,null));};exports[_0xfa06('0x59')]=function(_0x44c74a,_0x230d23){if(_0x44c74a[_0xfa06('0x42')]['id']){delete _0x44c74a['body']['id'];}return db[_0xfa06('0x2e')][_0xfa06('0x40')]({'where':{'id':_0x44c74a['params']['id']},'include':[{'model':db['CmContact'],'as':_0xfa06('0x5a')}]})[_0xfa06('0x11')](handleEntityNotFound(_0x230d23,null))[_0xfa06('0x11')](saveUpdates(_0x44c74a['body'],null))[_0xfa06('0x11')](respondWithResult(_0x230d23,null))[_0xfa06('0x1a')](handleError(_0x230d23,null));};exports['abandon']=function(_0x3a30bf,_0xef924c){if(_0x3a30bf[_0xfa06('0x42')]['id']){delete _0x3a30bf[_0xfa06('0x42')]['id'];}return db[_0xfa06('0x2e')][_0xfa06('0x40')]({'where':{'id':_0x3a30bf[_0xfa06('0x37')]['id']}})['then'](function(_0x5263f2){if(!_0x5263f2){logger[_0xfa06('0x18')](_0xfa06('0x5b'),_0xfa06('0x5c'),0x194,'entity\x20not\x20found');_0xef924c[_0xfa06('0x1b')](0x194);}else{if(_0x5263f2[_0xfa06('0x5d')]){throw new db[(_0xfa06('0x54'))][(_0xfa06('0x52'))](_0xfa06('0x5e'));}}return _0x5263f2;})[_0xfa06('0x11')](function(_0x2872f9){if(_0x2872f9){return _0x2872f9[_0xfa06('0x5f')]({'closed':_0x3a30bf[_0xfa06('0x42')][_0xfa06('0x60')],'disposition':_0x3a30bf[_0xfa06('0x42')][_0xfa06('0x61')]})['then'](function(_0x954e17){return _0x954e17;});}})['then'](function(){return respondWithRpcPromise(_0xfa06('0x62'),'abandon',_0x3a30bf[_0xfa06('0x42')],client9004);})[_0xfa06('0x11')](respondWithResult(_0xef924c,null))[_0xfa06('0x1a')](handleError(_0xef924c,null));};exports[_0xfa06('0x63')]=function(_0x2f2023,_0x509e4f){_0x2f2023['body'][_0xfa06('0x25')]=_0x2f2023[_0xfa06('0x64')]['originalname'];_0x2f2023[_0xfa06('0x42')]['basename']=_0x2f2023[_0xfa06('0x64')][_0xfa06('0x65')];_0x2f2023[_0xfa06('0x42')][_0xfa06('0x31')]=_0x2f2023[_0xfa06('0x64')][_0xfa06('0x66')];return db[_0xfa06('0x67')][_0xfa06('0x41')](_0x2f2023[_0xfa06('0x42')])[_0xfa06('0x11')](respondWithResult(_0x509e4f,0xc9))['catch'](handleError(_0x509e4f,null));};exports[_0xfa06('0x68')]=function(_0x48d3b5,_0x45eaa5){return db[_0xfa06('0x2e')][_0xfa06('0x45')]({'where':{'id':_0x48d3b5['params']['id']},'raw':!![]})[_0xfa06('0x11')](handleEntityNotFound(_0x45eaa5,null))[_0xfa06('0x11')](function(_0x3bf5c6){if(_0x3bf5c6){if(_0x3bf5c6[_0xfa06('0x60')]){return _0x45eaa5[_0xfa06('0x1d')](0x193)['json']({'status':0x193,'message':_0xfa06('0x69')});}return db[_0xfa06('0x67')][_0xfa06('0x45')]({'where':{'id':_0x48d3b5[_0xfa06('0x3a')][_0xfa06('0x6a')]},'raw':!![]})['then'](handleEntityNotFound(_0x45eaa5,null));}})[_0xfa06('0x11')](function(_0x21a920){if(_0x21a920){var _0x593315=_0x21a920[_0xfa06('0x6b')]!==null;var _0x55efc2=path['join'](config[_0xfa06('0x6c')],'server/files/attachments/');if(_0x593315){_0x55efc2=path[_0xfa06('0x6d')](_0x55efc2,_0xfa06('0x6e'));}var _0x68410=path[_0xfa06('0x6d')](_0x55efc2,_0x21a920['basename']);return _0x45eaa5[_0xfa06('0x6f')](_0x68410);}})['catch'](handleError(_0x45eaa5,null));};exports['close']=function(_0x2f2f90,_0x5bedeb){var _0x43d972=null;var _0x18b594=null;var _0x507a31=null;if(_0x2f2f90['body']['id']){delete _0x2f2f90[_0xfa06('0x42')]['id'];}if(_0x2f2f90[_0xfa06('0x42')][_0xfa06('0x70')]){_0x507a31=path[_0xfa06('0x6d')](config['root'],_0xfa06('0x71'),util[_0xfa06('0x72')]('transcript-%s.txt',Date['now']()));_0x2f2f90[_0xfa06('0x42')][_0xfa06('0x73')]=_0x507a31;}return db['ChatInteraction']['find']({'where':{'id':_0x2f2f90[_0xfa06('0x37')]['id']},'include':[{'model':db[_0xfa06('0x57')],'as':'Messages','include':[{'model':db[_0xfa06('0x74')],'as':_0xfa06('0x74')}]}]})[_0xfa06('0x11')](handleEntityNotFound(_0x5bedeb,null))[_0xfa06('0x11')](saveUpdates(_0x2f2f90['body'],null))[_0xfa06('0x11')](function(_0x444995){if(_0x444995){_0x43d972=_0x444995;return db[_0xfa06('0x75')]['find']({'where':{'id':_0x43d972[_0xfa06('0x76')]}});}})[_0xfa06('0x11')](function(_0x5174ce){if(_0x5174ce){_0x18b594=_0x5174ce;return db[_0xfa06('0x77')]['find']({'where':{'id':_0x43d972[_0xfa06('0x78')]}});}})[_0xfa06('0x11')](function(_0x90eea1){if(_0x90eea1){if(_0x507a31){var _0xbeb00a=null;for(var _0x2bc10d=0x1;_0x2bc10d<_0x43d972['Messages'][_0xfa06('0x3e')];++_0x2bc10d){_0xbeb00a=_0x43d972['Messages'][_0x2bc10d];var _0x41f8e4=_0xbeb00a[_0xfa06('0x5d')]?util['format'](_0xfa06('0x79'),_0x18b594[_0xfa06('0x7a')],_0xbeb00a[_0xfa06('0x5d')]):_0xfa06('0x7b');var _0x2bff57=_0x2f2f90[_0xfa06('0x42')][_0xfa06('0x7c')]||util[_0xfa06('0x72')]('%s%d',_0xfa06('0x7d'),_0xbeb00a[_0xfa06('0x78')]);switch(_0x18b594[_0xfa06('0x7e')]){case _0xfa06('0x7f'):_0x41f8e4=_0xbeb00a[_0xfa06('0x5d')]?util['format']('%s%d',_0x18b594[_0xfa06('0x7a')],_0xbeb00a[_0xfa06('0x5d')]):_0xfa06('0x7b');break;case _0xfa06('0x80'):_0x41f8e4=_0xbeb00a[_0xfa06('0x5d')]?_0xbeb00a['User']['alias']||_0xbeb00a[_0xfa06('0x74')]['fullname']:_0xfa06('0x7b');break;case _0xfa06('0x81'):_0x41f8e4=_0xbeb00a['UserId']?_0xbeb00a['User'][_0xfa06('0x4b')]:'System';break;default:_0x41f8e4=_0xbeb00a[_0xfa06('0x5d')]?util['format'](_0xfa06('0x79'),_0x18b594[_0xfa06('0x7a')],_0xbeb00a[_0xfa06('0x5d')]):'System';}var _0x579ca1=util[_0xfa06('0x72')](_0xfa06('0x82'),moment(_0xbeb00a[_0xfa06('0x83')])[_0xfa06('0x72')](_0xfa06('0x84')),_0xbeb00a['direction']==='in'?_0x2bff57:_0x41f8e4,_0xbeb00a[_0xfa06('0x42')]);if(!_0xbeb00a[_0xfa06('0x85')]){fs['appendFileSync'](_0x507a31,_0x579ca1);}}return db[_0xfa06('0x86')][_0xfa06('0x45')]({'where':{'service':!![]},'include':[{'model':db[_0xfa06('0x87')],'as':_0xfa06('0x88'),'raw':!![],'include':[{'model':db[_0xfa06('0x89')],'as':_0xfa06('0x89'),'raw':!![]}]}]});}}})[_0xfa06('0x11')](function(_0xb02d75){if(!_0xb02d75||!_0xb02d75[_0xfa06('0x88')]||!_0x2f2f90['body'])return _0x43d972;var _0x3add96=_0xb02d75[_0xfa06('0x8a')]();return respondWithRpcPromise(_0xfa06('0x8b'),_0xfa06('0x8c'),{'account':_0x3add96,'message':{'from':util[_0xfa06('0x72')](_0xfa06('0x8d'),_0xb02d75[_0xfa06('0x25')],_0xb02d75['email']||_0xb02d75['Smtp'][_0xfa06('0x35')]),'to':_0x2f2f90[_0xfa06('0x42')]['mailTranscript'],'subject':_0xfa06('0x8e'),'text':util[_0xfa06('0x72')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x2f2f90[_0xfa06('0x42')][_0xfa06('0x70')]),'attachments':[{'path':_0x507a31}]}})[_0xfa06('0x11')](function(){return _0x43d972;})[_0xfa06('0x1a')](function(_0x147969){logger[_0xfa06('0x18')](_0x147969);});})[_0xfa06('0x11')](respondWithStatusCode(_0x5bedeb,0xc8))['catch'](handleError(_0x5bedeb,null));};exports[_0xfa06('0x8f')]=function(_0x559f69,_0x5ca78b){return db[_0xfa06('0x57')][_0xfa06('0x40')]({'where':{'id':_0x559f69[_0xfa06('0x37')]['id']}})['then'](handleEntityNotFound(_0x5ca78b,null))[_0xfa06('0x11')](function(_0x6910c6){if(_0x6910c6){return _0x6910c6[_0xfa06('0x8f')](_0x559f69[_0xfa06('0x42')][_0xfa06('0x90')],_[_0xfa06('0x91')](_0x559f69[_0xfa06('0x42')],[_0xfa06('0x90'),'id'])||{});}})[_0xfa06('0x11')](respondWithResult(_0x5ca78b,null))[_0xfa06('0x1a')](handleError(_0x5ca78b,null));};exports[_0xfa06('0x92')]=function(_0x21ec61,_0x36aa41){var _0xe0ade6={'raw':![],'where':{}};var _0x12df69={};var _0x2e6683={'count':0x0,'rows':[]};return db[_0xfa06('0x2e')][_0xfa06('0x45')]({'where':{'id':_0x21ec61[_0xfa06('0x37')]['id']}})[_0xfa06('0x11')](handleEntityNotFound(_0x36aa41,null))[_0xfa06('0x11')](function(_0xb0ac61){if(_0xb0ac61){_0x12df69['model']=_[_0xfa06('0x39')](db['ChatMessage'][_0xfa06('0x2f')]);_0x12df69['query']=_['keys'](_0x21ec61[_0xfa06('0x3a')]);_0x12df69['filters']=_[_0xfa06('0x3b')](_0x12df69[_0xfa06('0x38')],_0x12df69[_0xfa06('0x3a')]);_0xe0ade6[_0xfa06('0x3c')]=_[_0xfa06('0x3b')](_0x12df69['model'],qs[_0xfa06('0x3d')](_0x21ec61[_0xfa06('0x3a')][_0xfa06('0x3d')]));_0xe0ade6[_0xfa06('0x3c')]=_0xe0ade6[_0xfa06('0x3c')][_0xfa06('0x3e')]?_0xe0ade6[_0xfa06('0x3c')]:_0x12df69['model'];if(!_0x21ec61[_0xfa06('0x3a')][_0xfa06('0x93')](_0xfa06('0x94'))){_0xe0ade6[_0xfa06('0x95')]=qs[_0xfa06('0x95')](_0x21ec61[_0xfa06('0x3a')][_0xfa06('0x95')]);_0xe0ade6[_0xfa06('0x1f')]=qs[_0xfa06('0x1f')](_0x21ec61[_0xfa06('0x3a')]['offset']);}_0xe0ade6[_0xfa06('0x96')]=qs[_0xfa06('0x97')](_0x21ec61[_0xfa06('0x3a')][_0xfa06('0x97')]);_0xe0ade6[_0xfa06('0x98')]=qs[_0xfa06('0x99')](_[_0xfa06('0x9a')](_0x21ec61[_0xfa06('0x3a')],_0x12df69[_0xfa06('0x99')]));_0xe0ade6['where'][_0xfa06('0x9b')]=_0xb0ac61['id'];if(_0x21ec61[_0xfa06('0x3a')][_0xfa06('0x9c')]){_0xe0ade6[_0xfa06('0x98')]=_[_0xfa06('0x28')](_0xe0ade6['where'],{'$or':_[_0xfa06('0x2d')](_0xe0ade6[_0xfa06('0x3c')],function(_0x2e65df){var _0x5cd305={};_0x5cd305[_0x2e65df]={'$like':'%'+_0x21ec61['query'][_0xfa06('0x9c')]+'%'};return _0x5cd305;})});}if(_0x21ec61[_0xfa06('0x3a')][_0xfa06('0x9d')]){var _0xffb293=_0x21ec61[_0xfa06('0x3a')][_0xfa06('0x9d')][_0xfa06('0x9e')](',');var _0x198b80={};_0x198b80[_0xffb293[0x0]]={'$gte':moment(_0xffb293[0x1])['format'](_0xfa06('0x9f'))};_0xe0ade6[_0xfa06('0x98')]=_[_0xfa06('0x28')](_0xe0ade6['where'],_0x198b80);}_0xe0ade6=_['merge']({},_0xe0ade6,_0x21ec61['options']);return db[_0xfa06('0x57')]['count']({'where':_0xe0ade6['where']})[_0xfa06('0x11')](function(_0x474f0b){_0x2e6683['count']=_0x474f0b;if(_0x21ec61[_0xfa06('0x3a')][_0xfa06('0x3f')]){_0xe0ade6[_0xfa06('0xa0')]=[{'all':!![]}];}return db[_0xfa06('0x57')][_0xfa06('0xa1')](_0xe0ade6);})[_0xfa06('0x11')](function(_0x359630){_0x2e6683['rows']=_0x359630;return _0x2e6683;});}})[_0xfa06('0x11')](respondWithFilteredResult(_0x36aa41,_0xe0ade6))[_0xfa06('0x1a')](handleError(_0x36aa41,null));};exports[_0xfa06('0xa2')]=function(_0x4b7cfd,_0x1f22a7){var _0x4e20b4={'where':{}},_0x53ce5d={},_0x2a3f50={'count':0x0,'rows':[]};return db[_0xfa06('0x2e')][_0xfa06('0x45')]({'where':{'id':_0x4b7cfd[_0xfa06('0x37')]['id']}})[_0xfa06('0x11')](handleEntityNotFound(_0x1f22a7,null))['then'](function(_0x2402e8){if(_0x2402e8){_0x53ce5d[_0xfa06('0x38')]=_[_0xfa06('0x39')](db[_0xfa06('0x57')][_0xfa06('0x2f')]);_0x53ce5d[_0xfa06('0x3a')]=_['keys'](_0x4b7cfd['query']);_0x53ce5d['filters']=_[_0xfa06('0x3b')](_0x53ce5d[_0xfa06('0x38')],_0x53ce5d[_0xfa06('0x3a')]);_0x4e20b4[_0xfa06('0x3c')]=_[_0xfa06('0x3b')](_0x53ce5d[_0xfa06('0x38')],qs[_0xfa06('0x3d')](_0x4b7cfd['query'][_0xfa06('0x3d')]));_0x4e20b4[_0xfa06('0x3c')]=_0x4e20b4[_0xfa06('0x3c')][_0xfa06('0x3e')]?_0x4e20b4[_0xfa06('0x3c')]:_0x53ce5d[_0xfa06('0x38')];if(!_0x4b7cfd['query'][_0xfa06('0x93')](_0xfa06('0x94'))){_0x4e20b4[_0xfa06('0x95')]=qs[_0xfa06('0x95')](_0x4b7cfd[_0xfa06('0x3a')]['limit']);_0x4e20b4[_0xfa06('0x1f')]=qs[_0xfa06('0x1f')](_0x4b7cfd[_0xfa06('0x3a')][_0xfa06('0x1f')]);}_0x4e20b4['order']=qs['sort'](_0x4b7cfd['query'][_0xfa06('0x97')]);_0x4e20b4['where']=qs[_0xfa06('0x99')](_[_0xfa06('0x9a')](_0x4b7cfd[_0xfa06('0x3a')],_0x53ce5d[_0xfa06('0x99')]));_0x4e20b4['where'][_0xfa06('0x9b')]=_0x2402e8['id'];if(_0x4b7cfd[_0xfa06('0x3a')][_0xfa06('0x9c')]){_0x4e20b4[_0xfa06('0x98')]=_[_0xfa06('0x28')](_0x4e20b4['where'],{'$or':_[_0xfa06('0x2d')](_0x4e20b4[_0xfa06('0x3c')],function(_0x27a982){var _0x3d6167={};_0x3d6167[_0x27a982]={'$like':'%'+_0x4b7cfd[_0xfa06('0x3a')][_0xfa06('0x9c')]+'%'};return _0x3d6167;})});}_0x4e20b4[_0xfa06('0x98')][_0xfa06('0x85')]=![];if(_0x4b7cfd[_0xfa06('0x3a')]['id']){_0x4e20b4[_0xfa06('0x98')]['id']={'$gt':_0x4b7cfd[_0xfa06('0x3a')]['id']};}_0x4e20b4=_[_0xfa06('0x28')]({},_0x4e20b4,_0x4b7cfd[_0xfa06('0xa3')]);return db['ChatMessage']['count']({'where':_0x4e20b4[_0xfa06('0x98')]})['then'](function(_0x4cad6a){_0x2a3f50[_0xfa06('0x21')]=_0x4cad6a;_0x4e20b4[_0xfa06('0xa0')]=[];if(_0x4b7cfd[_0xfa06('0x3a')][_0xfa06('0xa4')]){_0x4e20b4[_0xfa06('0xa0')][_0xfa06('0xa5')]({'model':db[_0xfa06('0x74')],'as':_0xfa06('0x74'),'attributes':['id',_0xfa06('0x4b'),_0xfa06('0xa6')]});}if(_0x4b7cfd[_0xfa06('0x3a')][_0xfa06('0x3f')]){_0x4e20b4[_0xfa06('0xa0')]=[{'all':!![]}];}return db[_0xfa06('0x57')][_0xfa06('0xa1')](_0x4e20b4);})[_0xfa06('0x11')](function(_0x617b24){_0x2a3f50[_0xfa06('0xa7')]=_0x617b24;return _0x2a3f50;});}})[_0xfa06('0x11')](respondWithFilteredResult(_0x1f22a7,_0x4e20b4))[_0xfa06('0x1a')](handleError(_0x1f22a7,null));};exports['addTags']=function(_0x33a91d,_0x201866){return db[_0xfa06('0x2e')][_0xfa06('0x40')]({'where':{'id':_0x33a91d[_0xfa06('0x37')]['id']}})['then'](handleEntityNotFound(_0x201866,null))[_0xfa06('0x11')](function(_0x4b225c){if(_0x4b225c){return _0x4b225c['setTags'](_0x33a91d['body'][_0xfa06('0x90')],_[_0xfa06('0x91')](_0x33a91d[_0xfa06('0x42')],[_0xfa06('0x90'),'id'])||{})[_0xfa06('0xa8')](function(){return db[_0xfa06('0xa9')][_0xfa06('0xa1')]({'attributes':['id',_0xfa06('0x25'),_0xfa06('0xaa')],'where':{'id':_0x33a91d['body'][_0xfa06('0x90')]}});})[_0xfa06('0x11')](function(_0x4322ae){socket[_0xfa06('0xab')](_0xfa06('0xac'),{'id':Number(_0x33a91d['params']['id']),'tags':_0x4322ae||[]});return{'id':Number(_0x33a91d[_0xfa06('0x37')]['id']),'tags':_0x4322ae||[]};});}})[_0xfa06('0x11')](respondWithResult(_0x201866,null))['catch'](handleError(_0x201866,null));};exports['removeTags']=function(_0x1ffe14,_0x1f5fc5){return db[_0xfa06('0x2e')][_0xfa06('0x40')]({'where':{'id':_0x1ffe14[_0xfa06('0x37')]['id']}})[_0xfa06('0x11')](handleEntityNotFound(_0x1f5fc5,null))[_0xfa06('0x11')](function(_0x52c190){if(_0x52c190){return _0x52c190['removeTags'](_0x1ffe14[_0xfa06('0x3a')]['ids']);}})[_0xfa06('0x11')](respondWithStatusCode(_0x1f5fc5,null))[_0xfa06('0x1a')](handleError(_0x1f5fc5,null));};exports['download']=function(_0x395eee,_0x5cda7d){var _0x3f5a53=moment()['unix']()[_0xfa06('0xad')]();var _0x430109=path[_0xfa06('0x6d')](config[_0xfa06('0x6c')],_0xfa06('0xae'),_0xfa06('0xaf'),_0xfa06('0xb0'));var _0x375902=path[_0xfa06('0x6d')](config['root'],'server',_0xfa06('0xaf'),'attachments');var _0x10280b=path['join'](_0x430109,_0x3f5a53);var _0x442b09=util[_0xfa06('0x72')](_0xfa06('0xb1'),_0x395eee['params']['id'],_0x3f5a53);var _0x55cbdc=path[_0xfa06('0x6d')](_0x430109,_0x442b09);var _0x565113=[];_0x565113[_0xfa06('0xa5')]({'model':db[_0xfa06('0x74')],'as':_0xfa06('0x74'),'attributes':['id',_0xfa06('0x4b')],'raw':!![]});_0x565113[_0xfa06('0xa5')]({'model':db[_0xfa06('0x77')],'as':_0xfa06('0x5a'),'attributes':['id',_0xfa06('0xb2'),_0xfa06('0xb3')],'raw':!![]});if(_0x395eee[_0xfa06('0x3a')][_0xfa06('0xb4')]){_0x565113[_0xfa06('0xa5')]({'model':db[_0xfa06('0x67')],'as':'Attachment','raw':!![]});}var _0x36371d=[{'model':db[_0xfa06('0x57')],'as':'Messages','attributes':['id',_0xfa06('0x42'),_0xfa06('0x83'),_0xfa06('0xb5'),_0xfa06('0x85'),'read'],'include':_0x565113}];_0x36371d['push']({'model':db[_0xfa06('0x75')],'as':_0xfa06('0xb6'),'attributes':['id',_0xfa06('0x25')]});_0x36371d[_0xfa06('0xa5')]({'model':db[_0xfa06('0x74')],'as':_0xfa06('0xb7'),'attributes':['id',_0xfa06('0x4b')]});return db[_0xfa06('0x2e')][_0xfa06('0x40')]({'where':{'id':_0x395eee[_0xfa06('0x37')]['id']},'include':_0x36371d})[_0xfa06('0x11')](handleEntityNotFound(_0x5cda7d,null))[_0xfa06('0x11')](function(_0xaf430d){if(_0xaf430d){var _0x4960dd=_0xaf430d[_0xfa06('0xb8')]({'plain':!![]});fs['mkdirSync'](_0x10280b);var _0x9329e5={'channel':'Chat','account':_0x4960dd[_0xfa06('0xb6')][_0xfa06('0x25')],'agent':_0x4960dd[_0xfa06('0xb7')]?_0x4960dd[_0xfa06('0xb7')]['fullname']:'N.A.','createdAt':moment(_0x4960dd[_0xfa06('0x83')])[_0xfa06('0x72')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x4960dd['closed']?moment(_0x4960dd[_0xfa06('0xb9')])[_0xfa06('0x72')](_0xfa06('0x9f'))[_0xfa06('0xad')]():'','disposition':_0x4960dd[_0xfa06('0x61')],'chatInfo':{'browser':_0x4960dd[_0xfa06('0xba')],'os':_0x4960dd[_0xfa06('0xbb')],'referer':_0x4960dd[_0xfa06('0xbc')],'customerIp':_0x4960dd[_0xfa06('0xbd')],'customerPort':_0x4960dd[_0xfa06('0xbe')]?_0x4960dd['customerPort']:_0xfa06('0xbf')},'messages':_(_0x4960dd[_0xfa06('0xc0')])['tail']()['filter']({'secret':![]})[_0xfa06('0x2d')](function(_0x4e8c51){if(_0x4e8c51['Attachment']){var _0xa988cb=path[_0xfa06('0x6d')](_0x375902,_0x4e8c51[_0xfa06('0x67')][_0xfa06('0xc1')]);if(fs['existsSync'](_0xa988cb)){fs['createReadStream'](_0xa988cb)[_0xfa06('0xc2')](fs['createWriteStream'](path['join'](_0x10280b,_0x4e8c51['Attachment'][_0xfa06('0xc1')])));}}return{'date':moment(_0x4e8c51[_0xfa06('0x83')])[_0xfa06('0x72')](_0xfa06('0x9f'))[_0xfa06('0xad')](),'sender':_0x4e8c51[_0xfa06('0xb5')]===_0xfa06('0xc3')?_0x4e8c51[_0xfa06('0x74')]?_0x4e8c51['User'][_0xfa06('0x4b')]:_0xfa06('0x7b'):_0x4e8c51['Contact'][_0xfa06('0xb2')]+(_0x4e8c51['Contact']['lastName']?'\x20'+_0x4e8c51[_0xfa06('0x5a')][_0xfa06('0xb3')]:''),'body':_0x4e8c51['Attachment']?_0x4e8c51[_0xfa06('0x67')]['basename']:_0x4e8c51[_0xfa06('0x42')],'direction':_0x4e8c51['direction']===_0xfa06('0xc3')?'A':'C','secret':_0x4e8c51[_0xfa06('0x85')],'read':_0x4e8c51['read'],'attachment':_0x4e8c51['Attachment']};})[_0xfa06('0xc4')]()};return ejs[_0xfa06('0xc5')](path['join'](config[_0xfa06('0x6c')],_0xfa06('0xae'),_0xfa06('0xc6'),'downloadInteraction.ejs'),{'interaction':_0x9329e5})[_0xfa06('0x11')](function(_0xe2c3e6){var _0xc49619=path[_0xfa06('0x6d')](_0x10280b,_0xfa06('0xc7')+_0x4960dd['id']+'-'+_0x3f5a53+_0xfa06('0xc8'));var _0x43c246={'path':_0xc49619,'channel':_0xfa06('0xc9'),'interactionId':_0x4960dd['id']};return pdf[_0xfa06('0xca')](_0xe2c3e6,_0x43c246);})[_0xfa06('0x11')](function(){return new Promise(function(_0x2a0504,_0x2b540b){zipdir(_0x10280b,{'saveTo':_0x55cbdc},function(_0x4b77ee,_0x218c5e){if(_0x4b77ee)return _0x2b540b(_0x4b77ee);return _0x2a0504(_0x218c5e);});})[_0xfa06('0x11')](function(){return new BPromise(function(_0x1242ed,_0x18a5f9){rimraf(_0x10280b,function(_0x270245){if(_0x270245)_0x18a5f9(_0x270245);return _0x1242ed();});});})[_0xfa06('0x11')](function(){return _0x5cda7d['download'](_0x55cbdc,_0x442b09,function(_0x6a08e2){if(_0x6a08e2){logger[_0xfa06('0x18')](_0xfa06('0xcb'),_0x6a08e2);}else{fs['unlinkSync'](_0x55cbdc);}});});});}else{return _0x5cda7d[_0xfa06('0x1b')](0xc8);}})[_0xfa06('0x1a')](handleError(_0x5cda7d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 3eca891..da336e5 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 _0x89d9=['Users','map','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0x55e4e1,_0x352a79){var _0x1644e8=function(_0x4a2446){while(--_0x4a2446){_0x55e4e1['push'](_0x55e4e1['shift']());}};_0x1644e8(++_0x352a79);}(_0x89d9,0x6e));var _0x989d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x89d9[_0x126558];return _0x1f6d14;};'use strict';var EventEmitter=require(_0x989d('0x0'));var ChatInteraction=require(_0x989d('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x989d('0x1'))['db'][_0x989d('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x989d('0x3')](0x0);var events={'afterCreate':_0x989d('0x4'),'afterUpdate':_0x989d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x42a5d5){return function(_0x39d123,_0x582595,_0x37ce51){_0x39d123[_0x989d('0x6')]({'attributes':['id'],'raw':!![]})[_0x989d('0x7')](function(_0x21b93c){_0x39d123[_0x989d('0x8')](_0x989d('0x9'),_0x21b93c[_0x989d('0xa')](function(_0x185765){return{'id':_0x185765['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x39d123['id'],'direction':'in','read':![]},'raw':!![]});})[_0x989d('0x7')](function(_0x5a4345){_0x39d123[_0x989d('0x8')](_0x989d('0xb'),_0x5a4345[_0x989d('0xc')]);ChatInteractionEvents[_0x989d('0xd')](_0x42a5d5+':'+_0x39d123['id'],_0x39d123);ChatInteractionEvents[_0x989d('0xd')](_0x42a5d5,_0x39d123);_0x37ce51(null);})['catch'](_0x37ce51(null));};}for(var e in events){if(events[_0x989d('0xe')](e)){var event=events[e];ChatInteraction[_0x989d('0xf')](e,emitEvent(event));}}module[_0x989d('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x5f0a=['setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb'];(function(_0x2ae529,_0x2f7071){var _0x5e9735=function(_0x4413b0){while(--_0x4413b0){_0x2ae529['push'](_0x2ae529['shift']());}};_0x5e9735(++_0x2f7071);}(_0x5f0a,0xfc));var _0xa5f0=function(_0x4cdd80,_0xbf8a2f){_0x4cdd80=_0x4cdd80-0x0;var _0x3b20bf=_0x5f0a[_0x4cdd80];return _0x3b20bf;};'use strict';var EventEmitter=require(_0xa5f0('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xa5f0('0x1')];var ChatMessage=require(_0xa5f0('0x2'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xa5f0('0x3')](0x0);var events={'afterCreate':_0xa5f0('0x4'),'afterUpdate':_0xa5f0('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4d1ae5){return function(_0x2d253e,_0x3a0e2f,_0x23cd85){_0x2d253e[_0xa5f0('0x6')]({'attributes':['id'],'raw':!![]})[_0xa5f0('0x7')](function(_0x11fff0){_0x2d253e[_0xa5f0('0x8')](_0xa5f0('0x9'),_0x11fff0[_0xa5f0('0xa')](function(_0x50f586){return{'id':_0x50f586['id']};}));return ChatMessage[_0xa5f0('0xb')]({'where':{'ChatInteractionId':_0x2d253e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa5f0('0x7')](function(_0x261033){_0x2d253e['setDataValue'](_0xa5f0('0xc'),_0x261033['length']);ChatInteractionEvents[_0xa5f0('0xd')](_0x4d1ae5+':'+_0x2d253e['id'],_0x2d253e);ChatInteractionEvents[_0xa5f0('0xd')](_0x4d1ae5,_0x2d253e);_0x23cd85(null);})['catch'](_0x23cd85(null));};}for(var e in events){if(events[_0xa5f0('0xe')](e)){var event=events[e];ChatInteraction[_0xa5f0('0xf')](e,emitEvent(event));}}module[_0xa5f0('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 866791e..16c8a01 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 _0x39ed=['moment','path','../../config/environment','exports','ChatInteraction','chat_interactions','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x2bc400,_0x27208f){var _0x36ab53=function(_0x257660){while(--_0x257660){_0x2bc400['push'](_0x2bc400['shift']());}};_0x36ab53(++_0x27208f);}(_0x39ed,0x14e));var _0xd39e=function(_0x1d4586,_0xb42dc7){_0x1d4586=_0x1d4586-0x0;var _0x5c3059=_0x39ed[_0x1d4586];return _0x5c3059;};'use strict';var _=require('lodash');var util=require(_0xd39e('0x0'));var logger=require(_0xd39e('0x1'))('api');var moment=require(_0xd39e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd39e('0x3'));var rimraf=require('rimraf');var config=require(_0xd39e('0x4'));var attributes=require('./chatInteraction.attributes');module[_0xd39e('0x5')]=function(_0x598bd9,_0x528d65){return _0x598bd9['define'](_0xd39e('0x6'),attributes,{'tableName':_0xd39e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1006b4,_0x4d1c72,_0x353c43){if(_0x1006b4['changed']('closed')){_0x1006b4['closedAt']=moment()[_0xd39e('0x8')](_0xd39e('0x9'));}_0x353c43(null,_0x1006b4);}},'charset':_0xd39e('0xa'),'collate':_0xd39e('0xb')});}; \ No newline at end of file +var _0x3856=['rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','bluebird','request-promise','path'];(function(_0x5a8f34,_0x11c27b){var _0x497614=function(_0x2089e3){while(--_0x2089e3){_0x5a8f34['push'](_0x5a8f34['shift']());}};_0x497614(++_0x11c27b);}(_0x3856,0x100));var _0x6385=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x3856[_0x10004e];return _0x5af990;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6385('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6385('0x1'));var rp=require(_0x6385('0x2'));var fs=require('fs');var path=require(_0x6385('0x3'));var rimraf=require(_0x6385('0x4'));var config=require(_0x6385('0x5'));var attributes=require(_0x6385('0x6'));module[_0x6385('0x7')]=function(_0x2064b0,_0x28ed2c){return _0x2064b0['define'](_0x6385('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38360a,_0x23980c,_0x18f5f8){if(_0x38360a[_0x6385('0x9')](_0x6385('0xa'))){_0x38360a['closedAt']=moment()[_0x6385('0xb')](_0x6385('0xc'));}_0x18f5f8(null,_0x38360a);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 415df25..54d2be2 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 _0x389d=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateChatInteraction','ChatInteraction','body','options','raw','attributes','limit','then','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2265da,_0xfbbd2e){var _0x430c2b=function(_0x20d671){while(--_0x20d671){_0x2265da['push'](_0x2265da['shift']());}};_0x430c2b(++_0xfbbd2e);}(_0x389d,0xc6));var _0xd389=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0x389d[_0x3bd52b];return _0x1e5b89;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd389('0x0'));var BPromise=require(_0xd389('0x1'));var rs=require(_0xd389('0x2'));var fs=require('fs');var Redis=require(_0xd389('0x3'));var db=require(_0xd389('0x4'))['db'];var utils=require(_0xd389('0x5'));var logger=require(_0xd389('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd389('0x7'));var client=jayson[_0xd389('0x8')][_0xd389('0x9')]({'port':0x232a});config[_0xd389('0xa')]=_[_0xd389('0xb')](config[_0xd389('0xa')],{'host':_0xd389('0xc'),'port':0x18eb});var socket=require(_0xd389('0xd'))(new Redis(config[_0xd389('0xa')]));require(_0xd389('0xe'))['register'](socket);function respondWithRpcPromise(_0x40654c,_0x2a28eb,_0x27ee9b){return new BPromise(function(_0xb7b633,_0xa6450a){return client[_0xd389('0xf')](_0x40654c,_0x27ee9b)['then'](function(_0xdf4523){logger[_0xd389('0x10')](_0xd389('0x11'),_0x2a28eb,'request\x20sent');logger[_0xd389('0x12')](_0xd389('0x13'),_0x2a28eb,_0xd389('0x14'),JSON[_0xd389('0x15')](_0xdf4523));if(_0xdf4523[_0xd389('0x16')]){if(_0xdf4523['error']['code']===0x1f4){logger[_0xd389('0x16')](_0xd389('0x11'),_0x2a28eb,_0xdf4523['error'][_0xd389('0x17')]);return _0xa6450a(_0xdf4523[_0xd389('0x16')][_0xd389('0x17')]);}logger[_0xd389('0x16')](_0xd389('0x11'),_0x2a28eb,_0xdf4523['error'][_0xd389('0x17')]);return _0xb7b633(_0xdf4523['error'][_0xd389('0x17')]);}else{logger[_0xd389('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x2a28eb,_0xd389('0x14'));_0xb7b633(_0xdf4523[_0xd389('0x18')][_0xd389('0x17')]);}})['catch'](function(_0x36bce5){logger['error'](_0xd389('0x11'),_0x2a28eb,_0x36bce5);_0xa6450a(_0x36bce5);});});}exports[_0xd389('0x19')]=function(_0x68032d){var _0x40a030=this;return new Promise(function(_0x40f6f3,_0xb041ac){return db[_0xd389('0x1a')]['update'](_0x68032d[_0xd389('0x1b')],{'raw':_0x68032d['options']?_0x68032d[_0xd389('0x1c')][_0xd389('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x68032d[_0xd389('0x1c')]?_0x68032d[_0xd389('0x1c')]['where']||null:null,'attributes':_0x68032d['options']?_0x68032d['options'][_0xd389('0x1e')]||null:null,'limit':_0x68032d[_0xd389('0x1c')]?_0x68032d[_0xd389('0x1c')][_0xd389('0x1f')]||null:null})[_0xd389('0x20')](function(_0x1d4ff5){logger[_0xd389('0x10')](_0xd389('0x19'),_0x68032d);logger[_0xd389('0x12')](_0xd389('0x19'),_0x68032d,JSON['stringify'](_0x1d4ff5));_0x40f6f3(_0x1d4ff5);})['catch'](function(_0x5b9be5){logger[_0xd389('0x16')](_0xd389('0x19'),_0x5b9be5[_0xd389('0x17')],_0x68032d);_0xb041ac(_0x40a030[_0xd389('0x16')](0x1f4,_0x5b9be5[_0xd389('0x17')]));});});};exports[_0xd389('0x21')]=function(_0x172edc){return new Promise(function(_0x4d10c3,_0x2dae25){return db[_0xd389('0x1a')][_0xd389('0x22')]({'where':_0x172edc[_0xd389('0x1c')]?_0x172edc[_0xd389('0x1c')][_0xd389('0x23')]||null:null})[_0xd389('0x20')](function(_0x402b00){if(_0x402b00){return _0x402b00[_0xd389('0x24')](_0x172edc[_0xd389('0x1b')][_0xd389('0x25')],_[_0xd389('0x26')](_0x172edc[_0xd389('0x1b')],[_0xd389('0x25'),'id'])||{});}})[_0xd389('0x27')](function(_0x14aca4){logger[_0xd389('0x10')](_0xd389('0x28'),_0x172edc);logger[_0xd389('0x12')](_0xd389('0x28'),_0x172edc,JSON[_0xd389('0x15')](_0x14aca4));_0x4d10c3(_0x14aca4);})['catch'](function(_0x354ba2){logger[_0xd389('0x16')](_0xd389('0x28'),_0x354ba2[_0xd389('0x17')],_0x172edc);_0x2dae25(_this[_0xd389('0x16')](0x1f4,_0x354ba2[_0xd389('0x17')]));});});}; \ No newline at end of file +var _0xcf21=['./chatInteraction.socket','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','debug','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','socket.io-emitter'];(function(_0x1cbfc5,_0x4cfaae){var _0x555830=function(_0x5f5728){while(--_0x5f5728){_0x1cbfc5['push'](_0x1cbfc5['shift']());}};_0x555830(++_0x4cfaae);}(_0xcf21,0x69));var _0x1cf2=function(_0x176258,_0x58a87d){_0x176258=_0x176258-0x0;var _0x3633f9=_0xcf21[_0x176258];return _0x3633f9;};'use strict';var _=require(_0x1cf2('0x0'));var util=require(_0x1cf2('0x1'));var moment=require(_0x1cf2('0x2'));var BPromise=require(_0x1cf2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cf2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cf2('0x5'));var logger=require(_0x1cf2('0x6'))('rpc');var config=require(_0x1cf2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1cf2('0x8')]['http']({'port':0x232a});config[_0x1cf2('0x9')]=_[_0x1cf2('0xa')](config[_0x1cf2('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1cf2('0xb'))(new Redis(config[_0x1cf2('0x9')]));require(_0x1cf2('0xc'))['register'](socket);function respondWithRpcPromise(_0x1963c5,_0x1ed4bd,_0x51716f){return new BPromise(function(_0x105083,_0x355f29){return client['request'](_0x1963c5,_0x51716f)[_0x1cf2('0xd')](function(_0x2b8297){logger[_0x1cf2('0xe')](_0x1cf2('0xf'),_0x1ed4bd,_0x1cf2('0x10'));logger['debug'](_0x1cf2('0x11'),_0x1ed4bd,'request\x20sent',JSON['stringify'](_0x2b8297));if(_0x2b8297[_0x1cf2('0x12')]){if(_0x2b8297[_0x1cf2('0x12')][_0x1cf2('0x13')]===0x1f4){logger[_0x1cf2('0x12')](_0x1cf2('0xf'),_0x1ed4bd,_0x2b8297['error']['message']);return _0x355f29(_0x2b8297[_0x1cf2('0x12')]['message']);}logger[_0x1cf2('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x1ed4bd,_0x2b8297[_0x1cf2('0x12')]['message']);return _0x105083(_0x2b8297[_0x1cf2('0x12')][_0x1cf2('0x14')]);}else{logger[_0x1cf2('0xe')](_0x1cf2('0xf'),_0x1ed4bd,_0x1cf2('0x10'));_0x105083(_0x2b8297[_0x1cf2('0x15')][_0x1cf2('0x14')]);}})[_0x1cf2('0x16')](function(_0x5106d6){logger[_0x1cf2('0x12')](_0x1cf2('0xf'),_0x1ed4bd,_0x5106d6);_0x355f29(_0x5106d6);});});}exports[_0x1cf2('0x17')]=function(_0x2cd305){var _0x318952=this;return new Promise(function(_0x4a0959,_0x341af6){return db[_0x1cf2('0x18')][_0x1cf2('0x19')](_0x2cd305[_0x1cf2('0x1a')],{'raw':_0x2cd305[_0x1cf2('0x1b')]?_0x2cd305['options'][_0x1cf2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cd305['options']?_0x2cd305[_0x1cf2('0x1b')][_0x1cf2('0x1d')]||null:null,'attributes':_0x2cd305[_0x1cf2('0x1b')]?_0x2cd305[_0x1cf2('0x1b')][_0x1cf2('0x1e')]||null:null,'limit':_0x2cd305[_0x1cf2('0x1b')]?_0x2cd305[_0x1cf2('0x1b')]['limit']||null:null})[_0x1cf2('0xd')](function(_0xbc447d){logger[_0x1cf2('0xe')](_0x1cf2('0x17'),_0x2cd305);logger[_0x1cf2('0x1f')](_0x1cf2('0x17'),_0x2cd305,JSON['stringify'](_0xbc447d));_0x4a0959(_0xbc447d);})['catch'](function(_0x29405e){logger['error']('UpdateChatInteraction',_0x29405e['message'],_0x2cd305);_0x341af6(_0x318952[_0x1cf2('0x12')](0x1f4,_0x29405e[_0x1cf2('0x14')]));});});};exports[_0x1cf2('0x20')]=function(_0x3c4411){return new Promise(function(_0x326a5a,_0x5513ef){return db[_0x1cf2('0x18')][_0x1cf2('0x21')]({'where':_0x3c4411[_0x1cf2('0x1b')]?_0x3c4411[_0x1cf2('0x1b')][_0x1cf2('0x1d')]||null:null})['then'](function(_0x369572){if(_0x369572){return _0x369572[_0x1cf2('0x22')](_0x3c4411[_0x1cf2('0x1a')][_0x1cf2('0x23')],_[_0x1cf2('0x24')](_0x3c4411['body'],['ids','id'])||{});}})['spread'](function(_0xda80cd){logger[_0x1cf2('0xe')]('AddTags',_0x3c4411);logger[_0x1cf2('0x1f')](_0x1cf2('0x25'),_0x3c4411,JSON[_0x1cf2('0x26')](_0xda80cd));_0x326a5a(_0xda80cd);})['catch'](function(_0x50855b){logger['error'](_0x1cf2('0x25'),_0x50855b['message'],_0x3c4411);_0x5513ef(_this[_0x1cf2('0x12')](0x1f4,_0x50855b[_0x1cf2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 2747d9d..e63c2e6 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 _0x6c6f=['length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener'];(function(_0x1bafe4,_0x1cdfd4){var _0x25fa81=function(_0x1793a1){while(--_0x1793a1){_0x1bafe4['push'](_0x1bafe4['shift']());}};_0x25fa81(++_0x1cdfd4);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x13d577,_0x54156b){_0x13d577=_0x13d577-0x0;var _0x54304e=_0x6c6f[_0x13d577];return _0x54304e;};'use strict';var ChatInteractionEvents=require(_0xf6c6('0x0'));var events=[_0xf6c6('0x1'),_0xf6c6('0x2'),_0xf6c6('0x3')];function createListener(_0x2f571d,_0x3c8fc3){return function(_0x332916){_0x3c8fc3[_0xf6c6('0x4')](_0x2f571d,_0x332916);};}function removeListener(_0x36fcd2,_0xa1183){return function(){ChatInteractionEvents[_0xf6c6('0x5')](_0x36fcd2,_0xa1183);};}exports['register']=function(_0x3b4e7b){for(var _0x4f8e34=0x0,_0x4c27f8=events[_0xf6c6('0x6')];_0x4f8e34<_0x4c27f8;_0x4f8e34++){var _0x5b34df=events[_0x4f8e34];var _0x308c42=createListener(_0xf6c6('0x7')+_0x5b34df,_0x3b4e7b);ChatInteractionEvents['on'](_0x5b34df,_0x308c42);}}; \ No newline at end of file +var _0x92d7=['length','chatInteraction:','./chatInteraction.events','save','remove','update','removeListener'];(function(_0x23bf7f,_0x578f6c){var _0x64b00e=function(_0x3e6da9){while(--_0x3e6da9){_0x23bf7f['push'](_0x23bf7f['shift']());}};_0x64b00e(++_0x578f6c);}(_0x92d7,0x79));var _0x792d=function(_0xf3e76b,_0x213ce7){_0xf3e76b=_0xf3e76b-0x0;var _0x13f72c=_0x92d7[_0xf3e76b];return _0x13f72c;};'use strict';var ChatInteractionEvents=require(_0x792d('0x0'));var events=[_0x792d('0x1'),_0x792d('0x2'),_0x792d('0x3')];function createListener(_0x51687a,_0x460304){return function(_0x12b12f){_0x460304['emit'](_0x51687a,_0x12b12f);};}function removeListener(_0x5343b2,_0x1a96d5){return function(){ChatInteractionEvents[_0x792d('0x4')](_0x5343b2,_0x1a96d5);};}exports['register']=function(_0x5b8320){for(var _0x383b31=0x0,_0x35ad7f=events[_0x792d('0x5')];_0x383b31<_0x35ad7f;_0x383b31++){var _0x1dd67d=events[_0x383b31];var _0xdc1464=createListener(_0x792d('0x6')+_0x1dd67d,_0x5b8320);ChatInteractionEvents['on'](_0x1dd67d,_0xdc1464);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 504cfcd..2e8d722 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 _0x2723=['isChatInteractionAuthorized','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','/:id/attachment_upload','single','attachmentUpload','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x73d4ff,_0x52a911){var _0x453042=function(_0x2b3700){while(--_0x2b3700){_0x73d4ff['push'](_0x73d4ff['shift']());}};_0x453042(++_0x52a911);}(_0x2723,0x87));var _0x3272=function(_0xb3d3ba,_0x493c86){_0xb3d3ba=_0xb3d3ba-0x0;var _0x5aee93=_0x2723[_0xb3d3ba];return _0x5aee93;};'use strict';var multer=require(_0x3272('0x0'));var util=require(_0x3272('0x1'));var path=require(_0x3272('0x2'));var timeout=require('connect-timeout');var express=require(_0x3272('0x3'));var router=express[_0x3272('0x4')]();var fs_extra=require(_0x3272('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3272('0x6'));var config=require(_0x3272('0x7'));var controller=require(_0x3272('0x8'));router['get']('/',auth[_0x3272('0x9')](),controller[_0x3272('0xa')]);router[_0x3272('0xb')](_0x3272('0xc'),auth[_0x3272('0x9')](),controller[_0x3272('0xd')]);router['get'](_0x3272('0xe'),auth[_0x3272('0xf')](),controller[_0x3272('0x10')]);router[_0x3272('0xb')]('/:id/attachment_download',auth[_0x3272('0xf')](),controller['attachmentDownload']);router[_0x3272('0xb')](_0x3272('0x11'),auth[_0x3272('0x9')](),controller[_0x3272('0x12')]);router[_0x3272('0xb')]('/:id/my_messages',auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0x3272('0xb')](_0x3272('0x13'),auth[_0x3272('0x9')](),controller[_0x3272('0x14')]);router[_0x3272('0x15')]('/',auth[_0x3272('0x9')](),controller[_0x3272('0x16')]);router[_0x3272('0x15')](_0x3272('0x17'),auth[_0x3272('0x9')](),controller[_0x3272('0x18')]);var upload=multer({'storage':multer[_0x3272('0x19')]({'destination':function(_0x5c44ec,_0x1e1d86,_0x41c964){_0x41c964(null,path[_0x3272('0x1a')](config[_0x3272('0x1b')],_0x3272('0x1c')));},'filename':function(_0x4c4876,_0x3e05f0,_0x3265c7){_0x3265c7(null,util['format'](_0x3272('0x1d'),Date[_0x3272('0x1e')](),_0x3e05f0['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3272('0x15')](_0x3272('0x1f'),upload[_0x3272('0x20')]('file'),controller[_0x3272('0x21')]);router[_0x3272('0x15')](_0x3272('0x11'),auth[_0x3272('0xf')](),controller['addMessage']);router[_0x3272('0x15')](_0x3272('0x22'),auth[_0x3272('0x9')](),interaction[_0x3272('0x23')](_0x3272('0x24'),_0x3272('0x25')),controller[_0x3272('0x26')]);router[_0x3272('0x27')](_0x3272('0xe'),auth[_0x3272('0x9')](),interaction[_0x3272('0x23')]('chat','chatinteraction:update'),controller[_0x3272('0x28')]);router[_0x3272('0x27')](_0x3272('0x29'),controller[_0x3272('0x2a')]);router['put'](_0x3272('0x2b'),auth[_0x3272('0xf')](),controller[_0x3272('0x2c')]);router[_0x3272('0x27')](_0x3272('0x2d'),controller['close']);router[_0x3272('0x2e')](_0x3272('0xe'),auth[_0x3272('0x9')](),interaction[_0x3272('0x23')](_0x3272('0x24'),_0x3272('0x2f')),controller[_0x3272('0x30')]);router[_0x3272('0x2e')](_0x3272('0x22'),auth[_0x3272('0x9')](),controller[_0x3272('0x31')]);module['exports']=router; \ No newline at end of file +var _0xfc23=['customUpdate','/:id/abandon','chatinteraction:destroy','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','/:id/custom_update'];(function(_0x5ad0d7,_0x2645f8){var _0xd83bd=function(_0x33d3bd){while(--_0x33d3bd){_0x5ad0d7['push'](_0x5ad0d7['shift']());}};_0xd83bd(++_0x2645f8);}(_0xfc23,0x98));var _0x3fc2=function(_0x319b26,_0x150b80){_0x319b26=_0x319b26-0x0;var _0x3f5ec5=_0xfc23[_0x319b26];return _0x3f5ec5;};'use strict';var multer=require(_0x3fc2('0x0'));var util=require('util');var path=require(_0x3fc2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3fc2('0x2')]();var fs_extra=require(_0x3fc2('0x3'));var auth=require(_0x3fc2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3fc2('0x5'));var controller=require(_0x3fc2('0x6'));router['get']('/',auth[_0x3fc2('0x7')](),controller[_0x3fc2('0x8')]);router[_0x3fc2('0x9')](_0x3fc2('0xa'),auth['isAuthenticated'](),controller[_0x3fc2('0xb')]);router['get'](_0x3fc2('0xc'),auth[_0x3fc2('0xd')](),controller[_0x3fc2('0xe')]);router['get'](_0x3fc2('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x3fc2('0x10')]);router[_0x3fc2('0x9')](_0x3fc2('0x11'),auth['isAuthenticated'](),controller[_0x3fc2('0x12')]);router['get']('/:id/my_messages',auth[_0x3fc2('0xd')](),controller[_0x3fc2('0x13')]);router[_0x3fc2('0x9')](_0x3fc2('0x14'),auth[_0x3fc2('0x7')](),controller['download']);router[_0x3fc2('0x15')]('/',auth[_0x3fc2('0x7')](),controller['create']);router[_0x3fc2('0x15')](_0x3fc2('0x16'),auth[_0x3fc2('0x7')](),controller[_0x3fc2('0x17')]);var upload=multer({'storage':multer[_0x3fc2('0x18')]({'destination':function(_0x1c56bc,_0x214338,_0x384ee3){_0x384ee3(null,path[_0x3fc2('0x19')](config[_0x3fc2('0x1a')],_0x3fc2('0x1b')));},'filename':function(_0x217b4b,_0x5331ba,_0x54436a){_0x54436a(null,util[_0x3fc2('0x1c')](_0x3fc2('0x1d'),Date[_0x3fc2('0x1e')](),_0x5331ba[_0x3fc2('0x1f')][_0x3fc2('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x3fc2('0x21')](_0x3fc2('0x22')),controller[_0x3fc2('0x23')]);router[_0x3fc2('0x15')](_0x3fc2('0x11'),auth[_0x3fc2('0xd')](),controller[_0x3fc2('0x24')]);router[_0x3fc2('0x15')](_0x3fc2('0x25'),auth[_0x3fc2('0x7')](),interaction['tracked'](_0x3fc2('0x26'),_0x3fc2('0x27')),controller[_0x3fc2('0x28')]);router[_0x3fc2('0x29')](_0x3fc2('0xc'),auth['isAuthenticated'](),interaction[_0x3fc2('0x2a')](_0x3fc2('0x26'),'chatinteraction:update'),controller['update']);router['put'](_0x3fc2('0x2b'),controller[_0x3fc2('0x2c')]);router[_0x3fc2('0x29')](_0x3fc2('0x2d'),auth[_0x3fc2('0xd')](),controller['abandon']);router['put']('/:id/close',controller['close']);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x3fc2('0x26'),_0x3fc2('0x2e')),controller[_0x3fc2('0x2f')]);router['delete'](_0x3fc2('0x25'),auth[_0x3fc2('0x7')](),controller['removeTags']);module[_0x3fc2('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 3246e19..024ce24 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 _0xc58c=['INTEGER','sequelize','TEXT','medium'];(function(_0x3707dc,_0x2b0a3a){var _0x3d8361=function(_0x3fb76d){while(--_0x3fb76d){_0x3707dc['push'](_0x3707dc['shift']());}};_0x3d8361(++_0x2b0a3a);}(_0xc58c,0x17d));var _0xcc58=function(_0x159301,_0x36eee4){_0x159301=_0x159301-0x0;var _0x32e257=_0xc58c[_0x159301];return _0x32e257;};'use strict';var Sequelize=require(_0xcc58('0x0'));module['exports']={'body':{'type':Sequelize[_0xcc58('0x1')](_0xcc58('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xcc58('0x3')]}}; \ No newline at end of file +var _0x22e7=['INTEGER','sequelize','exports'];(function(_0xb5fc3e,_0x234703){var _0x2efc3c=function(_0x4e4e44){while(--_0x4e4e44){_0xb5fc3e['push'](_0xb5fc3e['shift']());}};_0x2efc3c(++_0x234703);}(_0x22e7,0x157));var _0x722e=function(_0xfaaf84,_0x4196c0){_0xfaaf84=_0xfaaf84-0x0;var _0x249547=_0x22e7[_0xfaaf84];return _0x249547;};'use strict';var Sequelize=require(_0x722e('0x0'));module[_0x722e('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x722e('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 1485606..4bd5114 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 _0xdbfc=['format','YYYY-MM-DD\x20HH:mm:ss','agent','user','fullname','role','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','Agents','userProfileId','UserProfileResource','resourceId','push','FromId','ToId','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','stack','send','ChatInternalMessage','rawAttributes','type','key','model','name','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','params','describe','get','messages','lastMessageAt','createdAt','lastMessage'];(function(_0x33b770,_0x113bf3){var _0x5083e8=function(_0x2fbf32){while(--_0x2fbf32){_0x33b770['push'](_0x33b770['shift']());}};_0x5083e8(++_0x113bf3);}(_0xdbfc,0xe5));var _0xcdbf=function(_0x288417,_0x48f76d){_0x288417=_0x288417-0x0;var _0x5cb215=_0xdbfc[_0x288417];return _0x5cb215;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdbf('0x0'));var zipdir=require(_0xcdbf('0x1'));var jsonpatch=require(_0xcdbf('0x2'));var rp=require(_0xcdbf('0x3'));var moment=require('moment');var BPromise=require(_0xcdbf('0x4'));var Mustache=require(_0xcdbf('0x5'));var util=require(_0xcdbf('0x6'));var path=require(_0xcdbf('0x7'));var sox=require(_0xcdbf('0x8'));var csv=require(_0xcdbf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcdbf('0xa'));var squel=require(_0xcdbf('0xb'));var crypto=require(_0xcdbf('0xc'));var jsforce=require(_0xcdbf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcdbf('0x9'));var querystring=require(_0xcdbf('0xe'));var Papa=require(_0xcdbf('0xf'));var Redis=require(_0xcdbf('0x10'));var authService=require(_0xcdbf('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdbf('0x12'));var logger=require(_0xcdbf('0x13'))(_0xcdbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcdbf('0x15'));var db=require('../../mysqldb')['db'];config[_0xcdbf('0x16')]=_[_0xcdbf('0x17')](config[_0xcdbf('0x16')],{'host':_0xcdbf('0x18'),'port':0x18eb});var socket=require(_0xcdbf('0x19'))(new Redis(config[_0xcdbf('0x16')]));require(_0xcdbf('0x1a'))[_0xcdbf('0x1b')](socket);function respondWithStatusCode(_0x9bb892,_0x44386e){_0x44386e=_0x44386e||0xcc;return function(_0x1180f9){if(_0x1180f9){return _0x9bb892[_0xcdbf('0x1c')](_0x44386e);}return _0x9bb892['status'](_0x44386e)['end']();};}function respondWithResult(_0x1a139c,_0x1446de){_0x1446de=_0x1446de||0xc8;return function(_0x407772){if(_0x407772){return _0x1a139c[_0xcdbf('0x1d')](_0x1446de)[_0xcdbf('0x1e')](_0x407772);}};}function respondWithFilteredResult(_0x597d6b,_0x2f5386){return function(_0x441336){if(_0x441336){var _0x1d735d=typeof _0x2f5386[_0xcdbf('0x1f')]===_0xcdbf('0x20')&&typeof _0x2f5386[_0xcdbf('0x21')]===_0xcdbf('0x20');var _0x4056fd=_0x441336['count'];var _0x3da6db=_0x1d735d?0x0:_0x2f5386[_0xcdbf('0x1f')];var _0x1cb1e5=_0x1d735d?_0x441336['count']:_0x2f5386[_0xcdbf('0x1f')]+_0x2f5386[_0xcdbf('0x21')];var _0x5b0d9d;if(_0x1cb1e5>=_0x4056fd){_0x1cb1e5=_0x4056fd;_0x5b0d9d=0xc8;}else{_0x5b0d9d=0xce;}_0x597d6b[_0xcdbf('0x1d')](_0x5b0d9d);return _0x597d6b[_0xcdbf('0x22')](_0xcdbf('0x23'),_0x3da6db+'-'+_0x1cb1e5+'/'+_0x4056fd)[_0xcdbf('0x1e')](_0x441336);}return null;};}function patchUpdates(_0x3054ba){return function(_0x4be81){try{jsonpatch[_0xcdbf('0x24')](_0x4be81,_0x3054ba,!![]);}catch(_0x4026a7){return BPromise[_0xcdbf('0x25')](_0x4026a7);}return _0x4be81['save']();};}function saveUpdates(_0x3c61ee,_0x43a012){return function(_0x3364ac){if(_0x3364ac){return _0x3364ac[_0xcdbf('0x26')](_0x3c61ee)[_0xcdbf('0x27')](function(_0x4fece){return _0x4fece;});}return null;};}function removeEntity(_0x326a79,_0x41e43a){return function(_0xc0427b){if(_0xc0427b){return _0xc0427b[_0xcdbf('0x28')]()['then'](function(){_0x326a79['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30f69d,_0x51f082){return function(_0x107fe5){if(!_0x107fe5){_0x30f69d[_0xcdbf('0x1c')](0x194);}return _0x107fe5;};}function handleError(_0x46da79,_0x2eea81){_0x2eea81=_0x2eea81||0x1f4;return function(_0x286a89){logger['error'](_0x286a89[_0xcdbf('0x29')]);if(_0x286a89['name']){delete _0x286a89['name'];}_0x46da79['status'](_0x2eea81)[_0xcdbf('0x2a')](_0x286a89);};}exports['index']=function(_0x199b32,_0x3a2474){var _0x58b76a={},_0x440e73={},_0x56a4e2={'count':0x0,'rows':[]};var _0x25ed74=_['map'](db[_0xcdbf('0x2b')][_0xcdbf('0x2c')],function(_0x250b27){return{'name':_0x250b27['fieldName'],'type':_0x250b27[_0xcdbf('0x2d')][_0xcdbf('0x2e')]};});_0x440e73[_0xcdbf('0x2f')]=_['map'](_0x25ed74,_0xcdbf('0x30'));_0x440e73[_0xcdbf('0x31')]=_[_0xcdbf('0x32')](_0x199b32['query']);_0x440e73[_0xcdbf('0x33')]=_['intersection'](_0x440e73['model'],_0x440e73[_0xcdbf('0x31')]);_0x58b76a[_0xcdbf('0x34')]=_[_0xcdbf('0x35')](_0x440e73[_0xcdbf('0x2f')],qs[_0xcdbf('0x36')](_0x199b32[_0xcdbf('0x31')][_0xcdbf('0x36')]));_0x58b76a['attributes']=_0x58b76a[_0xcdbf('0x34')]['length']?_0x58b76a[_0xcdbf('0x34')]:_0x440e73[_0xcdbf('0x2f')];if(!_0x199b32['query']['hasOwnProperty'](_0xcdbf('0x37'))){_0x58b76a[_0xcdbf('0x21')]=qs[_0xcdbf('0x21')](_0x199b32['query'][_0xcdbf('0x21')]);_0x58b76a[_0xcdbf('0x1f')]=qs[_0xcdbf('0x1f')](_0x199b32[_0xcdbf('0x31')][_0xcdbf('0x1f')]);}_0x58b76a[_0xcdbf('0x38')]=qs[_0xcdbf('0x39')](_0x199b32[_0xcdbf('0x31')][_0xcdbf('0x39')]);_0x58b76a[_0xcdbf('0x3a')]=qs['filters'](_[_0xcdbf('0x3b')](_0x199b32[_0xcdbf('0x31')],_0x440e73['filters']),_0x25ed74);if(_0x199b32[_0xcdbf('0x31')][_0xcdbf('0x3c')]){_0x58b76a['where']=_[_0xcdbf('0x3d')](_0x58b76a[_0xcdbf('0x3a')],{'$or':_[_0xcdbf('0x3e')](_0x25ed74,function(_0x1c9359){if(_0x1c9359['type']!==_0xcdbf('0x3f')){var _0x56d9b7={};_0x56d9b7[_0x1c9359['name']]={'$like':'%'+_0x199b32[_0xcdbf('0x31')]['filter']+'%'};return _0x56d9b7;}})});}_0x58b76a=_['merge']({},_0x58b76a,_0x199b32['options']);var _0x5a2101={'where':_0x58b76a['where']};return db['ChatInternalMessage']['count'](_0x5a2101)[_0xcdbf('0x27')](function(_0x51b9c2){_0x56a4e2[_0xcdbf('0x40')]=_0x51b9c2;if(_0x199b32[_0xcdbf('0x31')][_0xcdbf('0x41')]){_0x58b76a[_0xcdbf('0x42')]=[{'all':!![]}];}return db[_0xcdbf('0x2b')][_0xcdbf('0x43')](_0x58b76a);})[_0xcdbf('0x27')](function(_0x21a274){_0x56a4e2[_0xcdbf('0x44')]=_0x21a274;return _0x56a4e2;})[_0xcdbf('0x27')](respondWithFilteredResult(_0x3a2474,_0x58b76a))[_0xcdbf('0x45')](handleError(_0x3a2474,null));};exports[_0xcdbf('0x46')]=function(_0x5b3607,_0x26684f){var _0x55ada2={'raw':!![],'where':{'id':_0x5b3607['params']['id']}},_0x5d6fd7={};_0x5d6fd7[_0xcdbf('0x2f')]=_[_0xcdbf('0x32')](db[_0xcdbf('0x2b')][_0xcdbf('0x2c')]);_0x5d6fd7[_0xcdbf('0x31')]=_[_0xcdbf('0x32')](_0x5b3607[_0xcdbf('0x31')]);_0x5d6fd7[_0xcdbf('0x33')]=_[_0xcdbf('0x35')](_0x5d6fd7['model'],_0x5d6fd7['query']);_0x55ada2[_0xcdbf('0x34')]=_[_0xcdbf('0x35')](_0x5d6fd7[_0xcdbf('0x2f')],qs[_0xcdbf('0x36')](_0x5b3607[_0xcdbf('0x31')][_0xcdbf('0x36')]));_0x55ada2[_0xcdbf('0x34')]=_0x55ada2[_0xcdbf('0x34')][_0xcdbf('0x47')]?_0x55ada2[_0xcdbf('0x34')]:_0x5d6fd7[_0xcdbf('0x2f')];if(_0x5b3607['query']['includeAll']){_0x55ada2['include']=[{'all':!![]}];}_0x55ada2=_['merge']({},_0x55ada2,_0x5b3607[_0xcdbf('0x48')]);return db[_0xcdbf('0x2b')][_0xcdbf('0x49')](_0x55ada2)[_0xcdbf('0x27')](handleEntityNotFound(_0x26684f,null))[_0xcdbf('0x27')](respondWithResult(_0x26684f,null))[_0xcdbf('0x45')](handleError(_0x26684f,null));};exports[_0xcdbf('0x4a')]=function(_0x12d272,_0x40d22e){return db[_0xcdbf('0x2b')][_0xcdbf('0x4a')](_0x12d272[_0xcdbf('0x4b')],{})[_0xcdbf('0x27')](respondWithResult(_0x40d22e,0xc9))[_0xcdbf('0x45')](handleError(_0x40d22e,null));};exports[_0xcdbf('0x26')]=function(_0x583cbb,_0x798612){if(_0x583cbb[_0xcdbf('0x4b')]['id']){delete _0x583cbb[_0xcdbf('0x4b')]['id'];}return db[_0xcdbf('0x2b')][_0xcdbf('0x49')]({'where':{'id':_0x583cbb[_0xcdbf('0x4c')]['id']}})[_0xcdbf('0x27')](handleEntityNotFound(_0x798612,null))['then'](saveUpdates(_0x583cbb['body'],null))[_0xcdbf('0x27')](respondWithResult(_0x798612,null))['catch'](handleError(_0x798612,null));};exports['destroy']=function(_0x18b722,_0x5ea48c){return db[_0xcdbf('0x2b')][_0xcdbf('0x49')]({'where':{'id':_0x18b722[_0xcdbf('0x4c')]['id']}})[_0xcdbf('0x27')](handleEntityNotFound(_0x5ea48c,null))[_0xcdbf('0x27')](removeEntity(_0x5ea48c,null))[_0xcdbf('0x45')](handleError(_0x5ea48c,null));};exports[_0xcdbf('0x4d')]=function(_0x5f1567,_0x169e84){return db[_0xcdbf('0x2b')][_0xcdbf('0x4d')]()[_0xcdbf('0x27')](respondWithResult(_0x169e84,null))['catch'](handleError(_0x169e84,null));};function wrapUser(_0x3467de){return function(_0x564952){var _0x38ab64=_0x3467de[_0xcdbf('0x4e')]({'plain':!![]});_0x38ab64[_0xcdbf('0x4f')]=[];if(_0x564952){_0x38ab64[_0xcdbf('0x50')]=_0x564952[_0xcdbf('0x51')];_0x38ab64[_0xcdbf('0x52')]=_0x564952;}else{_0x38ab64[_0xcdbf('0x50')]=moment(0x0)[_0xcdbf('0x53')](_0xcdbf('0x54'));_0x38ab64[_0xcdbf('0x52')]={};}return _0x38ab64;};}exports['getUsers']=function(_0x382bd9,_0x4d3120,_0x17007){var _0x3c06e1=[];return db['User'][_0xcdbf('0x43')]({'where':{'role':[_0xcdbf('0x55'),'admin',_0xcdbf('0x56')]},'attributes':['id',_0xcdbf('0x57'),'name',_0xcdbf('0x58'),'userpic',_0xcdbf('0x59'),_0xcdbf('0x5a'),'lastLoginAt',_0xcdbf('0x5b'),_0xcdbf('0x5c')],'order':qs['sort'](_0xcdbf('0x5d')),'include':[{'model':db[_0xcdbf('0x5e')],'as':'VoiceQueues','attributes':['id',_0xcdbf('0x30'),_0xcdbf('0x2d')],'through':{'attributes':[]}}]})[_0xcdbf('0x27')](function(_0x46182f){if(_0x46182f){var _0x3070d3=_0x382bd9[_0xcdbf('0x56')][_0xcdbf('0x4e')]({'plain':!![]});if(!_0x3070d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3070d3[_0xcdbf('0x58')]===_0xcdbf('0x56')){return db['UserProfileSection'][_0xcdbf('0x49')]({'where':{'name':_0xcdbf('0x5f'),'userProfileId':_0x3070d3[_0xcdbf('0x60')]},'raw':!![]})['then'](function(_0x1fd337){if(_0x1fd337){if(_0x1fd337['autoAssociation']===0x0){return db[_0xcdbf('0x61')]['findAll']({'where':{'sectionId':_0x1fd337['id']},'raw':!![]})[_0xcdbf('0x27')](function(_0x37c5d7){var _0x583ecd=[];if(_['isEmpty'](_0x37c5d7)){_0x583ecd=_['filter'](_0x46182f,function(_0x20af5b){if(_0x20af5b[_0xcdbf('0x58')]!==_0xcdbf('0x55')){return _0x20af5b;}});return _0x583ecd;}else{for(var _0x92e106=0x0;_0x92e106<_0x46182f[_0xcdbf('0x47')];_0x92e106++){var _0x5b8f1f=_0x46182f[_0x92e106];if(_0x5b8f1f[_0xcdbf('0x58')]===_0xcdbf('0x55')){var _0x27844b=_[_0xcdbf('0x49')](_0x37c5d7,function(_0x5d97b9){return _0x5d97b9[_0xcdbf('0x62')]===_0x5b8f1f['id'];});if(_0x27844b)_0x583ecd['push'](_0x5b8f1f);}else{_0x583ecd[_0xcdbf('0x63')](_0x5b8f1f);}}return _0x583ecd;}});}else{return _0x46182f;}}else{var _0x3fa553=_[_0xcdbf('0x3c')](_0x46182f,function(_0x2d8934){if(_0x2d8934['role']!==_0xcdbf('0x55')){return _0x2d8934;}});return _0x3fa553;}});}else{return _0x46182f;}}})['then'](function(_0x5ed73d){var _0x3a3f9b=[];if(_0x5ed73d){_0x3c06e1=_0x5ed73d;for(var _0x240b84=0x0;_0x240b84<_0x5ed73d[_0xcdbf('0x47')];_0x240b84+=0x1){_0x3c06e1[_0x240b84][_0xcdbf('0x4f')]=[];_0x3a3f9b[_0xcdbf('0x63')](db[_0xcdbf('0x2b')]['find']({'where':{'FromId':[_0x382bd9[_0xcdbf('0x56')]['id'],_0x5ed73d[_0x240b84]['id']],'ToId':[_0x382bd9['user']['id'],_0x5ed73d[_0x240b84]['id']],'ChatGroupId':null},'attributes':['id',_0xcdbf('0x51'),_0xcdbf('0x64'),_0xcdbf('0x65'),'read','body'],'order':qs[_0xcdbf('0x39')](_0xcdbf('0x66')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xcdbf('0x27')](wrapUser(_0x5ed73d[_0x240b84])));}return BPromise[_0xcdbf('0x67')](_0x3a3f9b);}return[];})[_0xcdbf('0x27')](function(_0x5cfb6d){return{'rows':_0x5cfb6d,'count':_0x5cfb6d['length']};})[_0xcdbf('0x27')](respondWithResult(_0x4d3120,null))[_0xcdbf('0x45')](handleError(_0x4d3120,null));}; \ No newline at end of file +var _0x8f5a=['sox','to-csv','fs-extra','lodash','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','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','body','params','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','admin','user','userpic','online','lastLoginAt','allowmessenger','sort','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x8f5a,0xd5));var _0xa8f5=function(_0x338a0c,_0xd91210){_0x338a0c=_0x338a0c-0x0;var _0x19e594=_0x8f5a[_0x338a0c];return _0x19e594;};'use strict';var emlformat=require(_0xa8f5('0x0'));var rimraf=require(_0xa8f5('0x1'));var zipdir=require(_0xa8f5('0x2'));var jsonpatch=require(_0xa8f5('0x3'));var rp=require(_0xa8f5('0x4'));var moment=require(_0xa8f5('0x5'));var BPromise=require(_0xa8f5('0x6'));var Mustache=require('mustache');var util=require(_0xa8f5('0x7'));var path=require(_0xa8f5('0x8'));var sox=require(_0xa8f5('0x9'));var csv=require(_0xa8f5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa8f5('0xb'));var _=require(_0xa8f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa8f5('0xd'));var toCsv=require(_0xa8f5('0xa'));var querystring=require(_0xa8f5('0xe'));var Papa=require(_0xa8f5('0xf'));var Redis=require(_0xa8f5('0x10'));var authService=require(_0xa8f5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa8f5('0x12'));var hardwareService=require(_0xa8f5('0x13'));var logger=require(_0xa8f5('0x14'))(_0xa8f5('0x15'));var utils=require(_0xa8f5('0x16'));var config=require(_0xa8f5('0x17'));var licenseUtil=require(_0xa8f5('0x18'));var db=require(_0xa8f5('0x19'))['db'];config[_0xa8f5('0x1a')]=_[_0xa8f5('0x1b')](config[_0xa8f5('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xa8f5('0x1c'))(new Redis(config[_0xa8f5('0x1a')]));require(_0xa8f5('0x1d'))[_0xa8f5('0x1e')](socket);function respondWithStatusCode(_0x4bca60,_0x5a53f9){_0x5a53f9=_0x5a53f9||0xcc;return function(_0x57d1ea){if(_0x57d1ea){return _0x4bca60[_0xa8f5('0x1f')](_0x5a53f9);}return _0x4bca60[_0xa8f5('0x20')](_0x5a53f9)[_0xa8f5('0x21')]();};}function respondWithResult(_0xf0d6c8,_0xa8339c){_0xa8339c=_0xa8339c||0xc8;return function(_0x100f8c){if(_0x100f8c){return _0xf0d6c8[_0xa8f5('0x20')](_0xa8339c)[_0xa8f5('0x22')](_0x100f8c);}};}function respondWithFilteredResult(_0x1437f5,_0x180835){return function(_0xa702cc){if(_0xa702cc){var _0x2eed4b=typeof _0x180835[_0xa8f5('0x23')]===_0xa8f5('0x24')&&typeof _0x180835[_0xa8f5('0x25')]==='undefined';var _0x3a07be=_0xa702cc[_0xa8f5('0x26')];var _0x403a84=_0x2eed4b?0x0:_0x180835[_0xa8f5('0x23')];var _0x229be1=_0x2eed4b?_0xa702cc[_0xa8f5('0x26')]:_0x180835[_0xa8f5('0x23')]+_0x180835[_0xa8f5('0x25')];var _0x828cfe;if(_0x229be1>=_0x3a07be){_0x229be1=_0x3a07be;_0x828cfe=0xc8;}else{_0x828cfe=0xce;}_0x1437f5[_0xa8f5('0x20')](_0x828cfe);return _0x1437f5[_0xa8f5('0x27')](_0xa8f5('0x28'),_0x403a84+'-'+_0x229be1+'/'+_0x3a07be)[_0xa8f5('0x22')](_0xa702cc);}return null;};}function patchUpdates(_0x8a30b0){return function(_0x434341){try{jsonpatch[_0xa8f5('0x29')](_0x434341,_0x8a30b0,!![]);}catch(_0x3f9ecf){return BPromise[_0xa8f5('0x2a')](_0x3f9ecf);}return _0x434341[_0xa8f5('0x2b')]();};}function saveUpdates(_0x463867,_0x2f651f){return function(_0x542418){if(_0x542418){return _0x542418[_0xa8f5('0x2c')](_0x463867)['then'](function(_0x1f0023){return _0x1f0023;});}return null;};}function removeEntity(_0x1ba262,_0x14b7ca){return function(_0x422414){if(_0x422414){return _0x422414['destroy']()[_0xa8f5('0x2d')](function(){_0x1ba262['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cd0d5,_0x51b130){return function(_0x1c7cd6){if(!_0x1c7cd6){_0x3cd0d5[_0xa8f5('0x1f')](0x194);}return _0x1c7cd6;};}function handleError(_0x353673,_0x206975){_0x206975=_0x206975||0x1f4;return function(_0x8a7ad0){logger[_0xa8f5('0x2e')](_0x8a7ad0['stack']);if(_0x8a7ad0[_0xa8f5('0x2f')]){delete _0x8a7ad0[_0xa8f5('0x2f')];}_0x353673['status'](_0x206975)[_0xa8f5('0x30')](_0x8a7ad0);};}exports[_0xa8f5('0x31')]=function(_0x1c071d,_0x29b8d5){var _0x471775={},_0x17cb24={},_0x41b1f1={'count':0x0,'rows':[]};var _0x279b85=_[_0xa8f5('0x32')](db[_0xa8f5('0x33')][_0xa8f5('0x34')],function(_0x2627f1){return{'name':_0x2627f1['fieldName'],'type':_0x2627f1[_0xa8f5('0x35')][_0xa8f5('0x36')]};});_0x17cb24[_0xa8f5('0x37')]=_[_0xa8f5('0x32')](_0x279b85,_0xa8f5('0x2f'));_0x17cb24[_0xa8f5('0x38')]=_[_0xa8f5('0x39')](_0x1c071d[_0xa8f5('0x38')]);_0x17cb24[_0xa8f5('0x3a')]=_[_0xa8f5('0x3b')](_0x17cb24[_0xa8f5('0x37')],_0x17cb24['query']);_0x471775['attributes']=_[_0xa8f5('0x3b')](_0x17cb24[_0xa8f5('0x37')],qs['fields'](_0x1c071d[_0xa8f5('0x38')][_0xa8f5('0x3c')]));_0x471775[_0xa8f5('0x3d')]=_0x471775[_0xa8f5('0x3d')]['length']?_0x471775['attributes']:_0x17cb24[_0xa8f5('0x37')];if(!_0x1c071d[_0xa8f5('0x38')][_0xa8f5('0x3e')]('nolimit')){_0x471775[_0xa8f5('0x25')]=qs[_0xa8f5('0x25')](_0x1c071d[_0xa8f5('0x38')][_0xa8f5('0x25')]);_0x471775[_0xa8f5('0x23')]=qs[_0xa8f5('0x23')](_0x1c071d[_0xa8f5('0x38')][_0xa8f5('0x23')]);}_0x471775['order']=qs['sort'](_0x1c071d[_0xa8f5('0x38')]['sort']);_0x471775[_0xa8f5('0x3f')]=qs[_0xa8f5('0x3a')](_[_0xa8f5('0x40')](_0x1c071d['query'],_0x17cb24[_0xa8f5('0x3a')]),_0x279b85);if(_0x1c071d[_0xa8f5('0x38')][_0xa8f5('0x41')]){_0x471775[_0xa8f5('0x3f')]=_[_0xa8f5('0x42')](_0x471775[_0xa8f5('0x3f')],{'$or':_[_0xa8f5('0x32')](_0x279b85,function(_0x49e4a7){if(_0x49e4a7['type']!==_0xa8f5('0x43')){var _0x1f7646={};_0x1f7646[_0x49e4a7[_0xa8f5('0x2f')]]={'$like':'%'+_0x1c071d[_0xa8f5('0x38')][_0xa8f5('0x41')]+'%'};return _0x1f7646;}})});}_0x471775=_[_0xa8f5('0x42')]({},_0x471775,_0x1c071d[_0xa8f5('0x44')]);var _0x39c45b={'where':_0x471775['where']};return db[_0xa8f5('0x33')][_0xa8f5('0x26')](_0x39c45b)['then'](function(_0x449738){_0x41b1f1[_0xa8f5('0x26')]=_0x449738;if(_0x1c071d[_0xa8f5('0x38')][_0xa8f5('0x45')]){_0x471775['include']=[{'all':!![]}];}return db[_0xa8f5('0x33')]['findAll'](_0x471775);})[_0xa8f5('0x2d')](function(_0x184e98){_0x41b1f1[_0xa8f5('0x46')]=_0x184e98;return _0x41b1f1;})[_0xa8f5('0x2d')](respondWithFilteredResult(_0x29b8d5,_0x471775))[_0xa8f5('0x47')](handleError(_0x29b8d5,null));};exports[_0xa8f5('0x48')]=function(_0x47b6ec,_0xd9a62){var _0x187d11={'raw':!![],'where':{'id':_0x47b6ec['params']['id']}},_0x1a092c={};_0x1a092c[_0xa8f5('0x37')]=_[_0xa8f5('0x39')](db['ChatInternalMessage'][_0xa8f5('0x34')]);_0x1a092c[_0xa8f5('0x38')]=_[_0xa8f5('0x39')](_0x47b6ec['query']);_0x1a092c['filters']=_[_0xa8f5('0x3b')](_0x1a092c[_0xa8f5('0x37')],_0x1a092c[_0xa8f5('0x38')]);_0x187d11[_0xa8f5('0x3d')]=_[_0xa8f5('0x3b')](_0x1a092c[_0xa8f5('0x37')],qs[_0xa8f5('0x3c')](_0x47b6ec[_0xa8f5('0x38')][_0xa8f5('0x3c')]));_0x187d11[_0xa8f5('0x3d')]=_0x187d11[_0xa8f5('0x3d')][_0xa8f5('0x49')]?_0x187d11[_0xa8f5('0x3d')]:_0x1a092c[_0xa8f5('0x37')];if(_0x47b6ec[_0xa8f5('0x38')][_0xa8f5('0x45')]){_0x187d11[_0xa8f5('0x4a')]=[{'all':!![]}];}_0x187d11=_[_0xa8f5('0x42')]({},_0x187d11,_0x47b6ec['options']);return db[_0xa8f5('0x33')][_0xa8f5('0x4b')](_0x187d11)['then'](handleEntityNotFound(_0xd9a62,null))['then'](respondWithResult(_0xd9a62,null))[_0xa8f5('0x47')](handleError(_0xd9a62,null));};exports[_0xa8f5('0x4c')]=function(_0x24176c,_0x5cad96){return db['ChatInternalMessage']['create'](_0x24176c['body'],{})[_0xa8f5('0x2d')](respondWithResult(_0x5cad96,0xc9))[_0xa8f5('0x47')](handleError(_0x5cad96,null));};exports['update']=function(_0x3b5ee0,_0x563142){if(_0x3b5ee0[_0xa8f5('0x4d')]['id']){delete _0x3b5ee0['body']['id'];}return db[_0xa8f5('0x33')][_0xa8f5('0x4b')]({'where':{'id':_0x3b5ee0['params']['id']}})[_0xa8f5('0x2d')](handleEntityNotFound(_0x563142,null))[_0xa8f5('0x2d')](saveUpdates(_0x3b5ee0[_0xa8f5('0x4d')],null))['then'](respondWithResult(_0x563142,null))[_0xa8f5('0x47')](handleError(_0x563142,null));};exports['destroy']=function(_0x583158,_0x49c2a9){return db[_0xa8f5('0x33')][_0xa8f5('0x4b')]({'where':{'id':_0x583158[_0xa8f5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c2a9,null))[_0xa8f5('0x2d')](removeEntity(_0x49c2a9,null))['catch'](handleError(_0x49c2a9,null));};exports['describe']=function(_0x8069b4,_0x169bbd){return db[_0xa8f5('0x33')]['describe']()[_0xa8f5('0x2d')](respondWithResult(_0x169bbd,null))[_0xa8f5('0x47')](handleError(_0x169bbd,null));};function wrapUser(_0x15ee9e){return function(_0x5cd195){var _0x3e99a9=_0x15ee9e[_0xa8f5('0x4f')]({'plain':!![]});_0x3e99a9[_0xa8f5('0x50')]=[];if(_0x5cd195){_0x3e99a9[_0xa8f5('0x51')]=_0x5cd195[_0xa8f5('0x52')];_0x3e99a9[_0xa8f5('0x53')]=_0x5cd195;}else{_0x3e99a9[_0xa8f5('0x51')]=moment(0x0)[_0xa8f5('0x54')](_0xa8f5('0x55'));_0x3e99a9['lastMessage']={};}return _0x3e99a9;};}exports[_0xa8f5('0x56')]=function(_0x3405e9,_0x48c315,_0x3c509d){var _0x3c87fe=[];return db['User'][_0xa8f5('0x57')]({'where':{'role':['agent',_0xa8f5('0x58'),_0xa8f5('0x59')]},'attributes':['id','fullname','name','role',_0xa8f5('0x5a'),'internal',_0xa8f5('0x5b'),_0xa8f5('0x5c'),_0xa8f5('0x5d'),'showWebBar'],'order':qs[_0xa8f5('0x5e')]('-online'),'include':[{'model':db[_0xa8f5('0x5f')],'as':_0xa8f5('0x60'),'attributes':['id',_0xa8f5('0x2f'),_0xa8f5('0x35')],'through':{'attributes':[]}}]})[_0xa8f5('0x2d')](function(_0x1840bc){if(_0x1840bc){var _0x2416c2=_0x3405e9['user']['get']({'plain':!![]});if(!_0x2416c2)throw new Error(_0xa8f5('0x61'));if(_0x2416c2[_0xa8f5('0x62')]===_0xa8f5('0x59')){return db['UserProfileSection']['find']({'where':{'name':_0xa8f5('0x63'),'userProfileId':_0x2416c2[_0xa8f5('0x64')]},'raw':!![]})[_0xa8f5('0x2d')](function(_0x654a2c){if(_0x654a2c){if(_0x654a2c[_0xa8f5('0x65')]===0x0){return db[_0xa8f5('0x66')][_0xa8f5('0x57')]({'where':{'sectionId':_0x654a2c['id']},'raw':!![]})[_0xa8f5('0x2d')](function(_0x4a245f){var _0x134075=[];if(_[_0xa8f5('0x67')](_0x4a245f)){_0x134075=_[_0xa8f5('0x41')](_0x1840bc,function(_0x2ee20b){if(_0x2ee20b[_0xa8f5('0x62')]!==_0xa8f5('0x68')){return _0x2ee20b;}});return _0x134075;}else{for(var _0x26b054=0x0;_0x26b054<_0x1840bc[_0xa8f5('0x49')];_0x26b054++){var _0x4b7173=_0x1840bc[_0x26b054];if(_0x4b7173[_0xa8f5('0x62')]==='agent'){var _0x3e79e4=_[_0xa8f5('0x4b')](_0x4a245f,function(_0x3a1233){return _0x3a1233[_0xa8f5('0x69')]===_0x4b7173['id'];});if(_0x3e79e4)_0x134075[_0xa8f5('0x6a')](_0x4b7173);}else{_0x134075[_0xa8f5('0x6a')](_0x4b7173);}}return _0x134075;}});}else{return _0x1840bc;}}else{var _0x416265=_[_0xa8f5('0x41')](_0x1840bc,function(_0x1bf5bc){if(_0x1bf5bc['role']!=='agent'){return _0x1bf5bc;}});return _0x416265;}});}else{return _0x1840bc;}}})[_0xa8f5('0x2d')](function(_0x42c6d2){var _0x3bf2c1=[];if(_0x42c6d2){_0x3c87fe=_0x42c6d2;for(var _0x4df976=0x0;_0x4df976<_0x42c6d2['length'];_0x4df976+=0x1){_0x3c87fe[_0x4df976][_0xa8f5('0x50')]=[];_0x3bf2c1['push'](db[_0xa8f5('0x33')][_0xa8f5('0x4b')]({'where':{'FromId':[_0x3405e9[_0xa8f5('0x59')]['id'],_0x42c6d2[_0x4df976]['id']],'ToId':[_0x3405e9[_0xa8f5('0x59')]['id'],_0x42c6d2[_0x4df976]['id']],'ChatGroupId':null},'attributes':['id',_0xa8f5('0x52'),_0xa8f5('0x6b'),_0xa8f5('0x6c'),'read',_0xa8f5('0x4d')],'order':qs['sort'](_0xa8f5('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x42c6d2[_0x4df976])));}return BPromise[_0xa8f5('0x6e')](_0x3bf2c1);}return[];})[_0xa8f5('0x2d')](function(_0x2d8aed){return{'rows':_0x2d8aed,'count':_0x2d8aed[_0xa8f5('0x49')]};})['then'](respondWithResult(_0x48c315,null))[_0xa8f5('0x47')](handleError(_0x48c315,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 0dd436e..aec30b2 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 _0x2a39=['exports','events','ChatInternalMessage','update','remove','emit','hasOwnProperty','hook'];(function(_0x16e95b,_0x41ebba){var _0x160dcc=function(_0x28b933){while(--_0x28b933){_0x16e95b['push'](_0x16e95b['shift']());}};_0x160dcc(++_0x41ebba);}(_0x2a39,0x101));var _0x92a3=function(_0x187f4b,_0x12fd52){_0x187f4b=_0x187f4b-0x0;var _0x132087=_0x2a39[_0x187f4b];return _0x132087;};'use strict';var EventEmitter=require(_0x92a3('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x92a3('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x92a3('0x2'),'afterDestroy':_0x92a3('0x3')};function emitEvent(_0xa4280e){return function(_0x43f481,_0x128ac8,_0x3778aa){ChatInternalMessageEvents[_0x92a3('0x4')](_0xa4280e+':'+_0x43f481['id'],_0x43f481);ChatInternalMessageEvents[_0x92a3('0x4')](_0xa4280e,_0x43f481);_0x3778aa(null);};}for(var e in events){if(events[_0x92a3('0x5')](e)){var event=events[e];ChatInternalMessage[_0x92a3('0x6')](e,emitEvent(event));}}module[_0x92a3('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x9be8=['ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x46a30c,_0x6d3772){var _0xc5fbcd=function(_0x344280){while(--_0x344280){_0x46a30c['push'](_0x46a30c['shift']());}};_0xc5fbcd(++_0x6d3772);}(_0x9be8,0x103));var _0x89be=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9be8[_0x565c49];return _0x20ca34;};'use strict';var EventEmitter=require(_0x89be('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x89be('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x89be('0x2')](0x0);var events={'afterCreate':_0x89be('0x3'),'afterUpdate':_0x89be('0x4'),'afterDestroy':_0x89be('0x5')};function emitEvent(_0x1436d5){return function(_0x2950d7,_0x58ac89,_0x23b134){ChatInternalMessageEvents['emit'](_0x1436d5+':'+_0x2950d7['id'],_0x2950d7);ChatInternalMessageEvents[_0x89be('0x6')](_0x1436d5,_0x2950d7);_0x23b134(null);};}for(var e in events){if(events[_0x89be('0x7')](e)){var event=events[e];ChatInternalMessage[_0x89be('0x8')](e,emitEvent(event));}}module[_0x89be('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index caa45b6..ccec92f 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 _0x1ff3=['utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x1ff3,0xd2));var _0x31ff=function(_0x234bbf,_0xac44ad){_0x234bbf=_0x234bbf-0x0;var _0x57b207=_0x1ff3[_0x234bbf];return _0x57b207;};'use strict';var _=require('lodash');var util=require(_0x31ff('0x0'));var logger=require(_0x31ff('0x1'))(_0x31ff('0x2'));var moment=require('moment');var BPromise=require(_0x31ff('0x3'));var rp=require(_0x31ff('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x31ff('0x5'));module[_0x31ff('0x6')]=function(_0x3a6786,_0x294cbd){return _0x3a6786['define'](_0x31ff('0x7'),attributes,{'tableName':_0x31ff('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x31ff('0x9'),'collate':_0x31ff('0xa')});}; \ No newline at end of file +var _0x322c=['../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x490046,_0x293a0e){var _0x13233f=function(_0x3640c4){while(--_0x3640c4){_0x490046['push'](_0x490046['shift']());}};_0x13233f(++_0x293a0e);}(_0x322c,0xe7));var _0xc322=function(_0x4a2037,_0x157834){_0x4a2037=_0x4a2037-0x0;var _0x1b2838=_0x322c[_0x4a2037];return _0x1b2838;};'use strict';var _=require(_0xc322('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc322('0x1'));var moment=require(_0xc322('0x2'));var BPromise=require(_0xc322('0x3'));var rp=require(_0xc322('0x4'));var fs=require('fs');var path=require(_0xc322('0x5'));var rimraf=require(_0xc322('0x6'));var config=require(_0xc322('0x7'));var attributes=require(_0xc322('0x8'));module[_0xc322('0x9')]=function(_0x868c5a,_0x3f5daf){return _0x868c5a[_0xc322('0xa')]('ChatInternalMessage',attributes,{'tableName':_0xc322('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc322('0xc'),'collate':_0xc322('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 652a3ac..ec1b3fb 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 _0xfec2=['stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x32f940,_0x2fc9ef){var _0x1a8feb=function(_0x2f27a0){while(--_0x2f27a0){_0x32f940['push'](_0x32f940['shift']());}};_0x1a8feb(++_0x2fc9ef);}(_0xfec2,0x17c));var _0x2fec=function(_0x62fc86,_0x5b7a30){_0x62fc86=_0x62fc86-0x0;var _0x29f9fe=_0xfec2[_0x62fc86];return _0x29f9fe;};'use strict';var _=require('lodash');var util=require(_0x2fec('0x0'));var moment=require(_0x2fec('0x1'));var BPromise=require('bluebird');var rs=require(_0x2fec('0x2'));var fs=require('fs');var Redis=require(_0x2fec('0x3'));var db=require(_0x2fec('0x4'))['db'];var utils=require(_0x2fec('0x5'));var logger=require(_0x2fec('0x6'))('rpc');var config=require(_0x2fec('0x7'));var jayson=require(_0x2fec('0x8'));var client=jayson[_0x2fec('0x9')][_0x2fec('0xa')]({'port':0x232a});config['redis']=_[_0x2fec('0xb')](config['redis'],{'host':_0x2fec('0xc'),'port':0x18eb});var socket=require(_0x2fec('0xd'))(new Redis(config[_0x2fec('0xe')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x426ff0,_0x169b4c,_0x13fafa){return new BPromise(function(_0x358220,_0x3349e7){return client[_0x2fec('0xf')](_0x426ff0,_0x13fafa)['then'](function(_0x34a041){logger[_0x2fec('0x10')](_0x2fec('0x11'),_0x169b4c,_0x2fec('0x12'));logger[_0x2fec('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x169b4c,_0x2fec('0x12'),JSON[_0x2fec('0x14')](_0x34a041));if(_0x34a041[_0x2fec('0x15')]){if(_0x34a041[_0x2fec('0x15')][_0x2fec('0x16')]===0x1f4){logger['error'](_0x2fec('0x11'),_0x169b4c,_0x34a041[_0x2fec('0x15')]['message']);return _0x3349e7(_0x34a041[_0x2fec('0x15')][_0x2fec('0x17')]);}logger['error'](_0x2fec('0x11'),_0x169b4c,_0x34a041['error'][_0x2fec('0x17')]);return _0x358220(_0x34a041[_0x2fec('0x15')][_0x2fec('0x17')]);}else{logger[_0x2fec('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x169b4c,_0x2fec('0x12'));_0x358220(_0x34a041['result']['message']);}})[_0x2fec('0x18')](function(_0x15c4dd){logger['error'](_0x2fec('0x11'),_0x169b4c,_0x15c4dd);_0x3349e7(_0x15c4dd);});});} \ No newline at end of file +var _0xea52=['code','message','result','catch','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0xea52,0x162));var _0x2ea5=function(_0x381f21,_0x5dea54){_0x381f21=_0x381f21-0x0;var _0x45f14b=_0xea52[_0x381f21];return _0x45f14b;};'use strict';var _=require('lodash');var util=require(_0x2ea5('0x0'));var moment=require(_0x2ea5('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(_0x2ea5('0x2'));var logger=require(_0x2ea5('0x3'))(_0x2ea5('0x4'));var config=require(_0x2ea5('0x5'));var jayson=require(_0x2ea5('0x6'));var client=jayson['client'][_0x2ea5('0x7')]({'port':0x232a});config[_0x2ea5('0x8')]=_[_0x2ea5('0x9')](config[_0x2ea5('0x8')],{'host':_0x2ea5('0xa'),'port':0x18eb});var socket=require(_0x2ea5('0xb'))(new Redis(config['redis']));require(_0x2ea5('0xc'))[_0x2ea5('0xd')](socket);function respondWithRpcPromise(_0x1107ef,_0x1f2a52,_0x462fbc){return new BPromise(function(_0x42916a,_0x5a3afd){return client[_0x2ea5('0xe')](_0x1107ef,_0x462fbc)[_0x2ea5('0xf')](function(_0x543d45){logger[_0x2ea5('0x10')](_0x2ea5('0x11'),_0x1f2a52,_0x2ea5('0x12'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x1f2a52,_0x2ea5('0x12'),JSON[_0x2ea5('0x13')](_0x543d45));if(_0x543d45[_0x2ea5('0x14')]){if(_0x543d45[_0x2ea5('0x14')][_0x2ea5('0x15')]===0x1f4){logger[_0x2ea5('0x14')](_0x2ea5('0x11'),_0x1f2a52,_0x543d45['error'][_0x2ea5('0x16')]);return _0x5a3afd(_0x543d45[_0x2ea5('0x14')][_0x2ea5('0x16')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1f2a52,_0x543d45[_0x2ea5('0x14')][_0x2ea5('0x16')]);return _0x42916a(_0x543d45[_0x2ea5('0x14')][_0x2ea5('0x16')]);}else{logger[_0x2ea5('0x10')](_0x2ea5('0x11'),_0x1f2a52,'request\x20sent');_0x42916a(_0x543d45[_0x2ea5('0x17')][_0x2ea5('0x16')]);}})[_0x2ea5('0x18')](function(_0x49a43d){logger[_0x2ea5('0x14')](_0x2ea5('0x11'),_0x1f2a52,_0x49a43d);_0x5a3afd(_0x49a43d);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 5ca23bf..be86573 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 _0x7ce4=['./chatInternalMessage.events','update','emit','length','chatInternalMessage:'];(function(_0x257852,_0x7ab85){var _0x3a278c=function(_0xec50da){while(--_0xec50da){_0x257852['push'](_0x257852['shift']());}};_0x3a278c(++_0x7ab85);}(_0x7ce4,0x181));var _0x47ce=function(_0x235f5a,_0x5425a1){_0x235f5a=_0x235f5a-0x0;var _0x2fc979=_0x7ce4[_0x235f5a];return _0x2fc979;};'use strict';var ChatInternalMessageEvents=require(_0x47ce('0x0'));var events=['save','remove',_0x47ce('0x1')];function createListener(_0x36ec6e,_0x4f008e){return function(_0x1c167a){_0x4f008e[_0x47ce('0x2')](_0x36ec6e,_0x1c167a);};}function removeListener(_0x23769d,_0x472092){return function(){ChatInternalMessageEvents['removeListener'](_0x23769d,_0x472092);};}exports['register']=function(_0x5cf098){for(var _0x3ba1dd=0x0,_0x214195=events[_0x47ce('0x3')];_0x3ba1dd<_0x214195;_0x3ba1dd++){var _0x3540f5=events[_0x3ba1dd];var _0x55f59e=createListener(_0x47ce('0x4')+_0x3540f5,_0x5cf098);ChatInternalMessageEvents['on'](_0x3540f5,_0x55f59e);}}; \ No newline at end of file +var _0x59a4=['update','emit','removeListener','register','chatInternalMessage:','./chatInternalMessage.events','remove'];(function(_0x150c65,_0x303f38){var _0x4ca489=function(_0x2c2e26){while(--_0x2c2e26){_0x150c65['push'](_0x150c65['shift']());}};_0x4ca489(++_0x303f38);}(_0x59a4,0x101));var _0x459a=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0x59a4[_0x305c31];return _0x17f39f;};'use strict';var ChatInternalMessageEvents=require(_0x459a('0x0'));var events=['save',_0x459a('0x1'),_0x459a('0x2')];function createListener(_0x63b68a,_0x1ee4a7){return function(_0x1fc099){_0x1ee4a7[_0x459a('0x3')](_0x63b68a,_0x1fc099);};}function removeListener(_0x4df779,_0x4e7402){return function(){ChatInternalMessageEvents[_0x459a('0x4')](_0x4df779,_0x4e7402);};}exports[_0x459a('0x5')]=function(_0x40c671){for(var _0x3dfc50=0x0,_0x128ff7=events['length'];_0x3dfc50<_0x128ff7;_0x3dfc50++){var _0x394a9b=events[_0x3dfc50];var _0x4a0c6c=createListener(_0x459a('0x6')+_0x394a9b,_0x40c671);ChatInternalMessageEvents['on'](_0x394a9b,_0x4a0c6c);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 6a9b848..631dcda 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 _0xc077=['getUsers','/:id','show','post','put','update','delete','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/users'];(function(_0x3d4ace,_0x568c73){var _0x47c799=function(_0x57d9ca){while(--_0x57d9ca){_0x3d4ace['push'](_0x3d4ace['shift']());}};_0x47c799(++_0x568c73);}(_0xc077,0x197));var _0x7c07=function(_0x208749,_0x2b7b66){_0x208749=_0x208749-0x0;var _0x3e0042=_0xc077[_0x208749];return _0x3e0042;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7c07('0x0'));var timeout=require(_0x7c07('0x1'));var express=require(_0x7c07('0x2'));var router=express['Router']();var fs_extra=require(_0x7c07('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7c07('0x4'));var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router[_0x7c07('0x5')]('/',auth['isAuthenticated'](),controller[_0x7c07('0x6')]);router[_0x7c07('0x5')](_0x7c07('0x7'),auth[_0x7c07('0x8')](),controller[_0x7c07('0x9')]);router[_0x7c07('0x5')](_0x7c07('0xa'),auth[_0x7c07('0x8')](),controller[_0x7c07('0xb')]);router[_0x7c07('0x5')](_0x7c07('0xc'),auth[_0x7c07('0x8')](),controller[_0x7c07('0xd')]);router[_0x7c07('0xe')]('/',auth[_0x7c07('0x8')](),controller['create']);router[_0x7c07('0xf')](_0x7c07('0xc'),controller[_0x7c07('0x10')]);router[_0x7c07('0x11')](_0x7c07('0xc'),auth[_0x7c07('0x8')](),controller['destroy']);module[_0x7c07('0x12')]=router; \ No newline at end of file +var _0x7bf8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','getUsers','/:id','post','create','update','delete','multer','util','path','connect-timeout','express'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x7bf8,0xb9));var _0x87bf=function(_0x42a945,_0x1afb1b){_0x42a945=_0x42a945-0x0;var _0x1d2fee=_0x7bf8[_0x42a945];return _0x1d2fee;};'use strict';var multer=require(_0x87bf('0x0'));var util=require(_0x87bf('0x1'));var path=require(_0x87bf('0x2'));var timeout=require(_0x87bf('0x3'));var express=require(_0x87bf('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x87bf('0x5'));var interaction=require(_0x87bf('0x6'));var config=require(_0x87bf('0x7'));var controller=require(_0x87bf('0x8'));router[_0x87bf('0x9')]('/',auth['isAuthenticated'](),controller[_0x87bf('0xa')]);router[_0x87bf('0x9')](_0x87bf('0xb'),auth[_0x87bf('0xc')](),controller['describe']);router[_0x87bf('0x9')]('/users',auth[_0x87bf('0xc')](),controller[_0x87bf('0xd')]);router[_0x87bf('0x9')](_0x87bf('0xe'),auth[_0x87bf('0xc')](),controller['show']);router[_0x87bf('0xf')]('/',auth[_0x87bf('0xc')](),controller[_0x87bf('0x10')]);router['put']('/:id',controller[_0x87bf('0x11')]);router[_0x87bf('0x12')](_0x87bf('0xe'),auth[_0x87bf('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 989a88f..0c1e9bc 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 _0x02a7=['medium','BOOLEAN','ENUM','out','DATE','STRING','exports','TEXT'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x02a7,0x1a6));var _0x702a=function(_0x437e28,_0x504535){_0x437e28=_0x437e28-0x0;var _0x39dc81=_0x02a7[_0x437e28];return _0x39dc81;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'body':{'type':Sequelize[_0x702a('0x1')](_0x702a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x702a('0x4')]('in',_0x702a('0x5')),'defaultValue':_0x702a('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x702a('0x6')]},'providerName':{'type':Sequelize[_0x702a('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3266=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3ea8b7,_0xf567a0){var _0x4ca438=function(_0x58f233){while(--_0x58f233){_0x3ea8b7['push'](_0x3ea8b7['shift']());}};_0x4ca438(++_0xf567a0);}(_0x3266,0x6a));var _0x6326=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x3266[_0x5eaa0b];return _0x28b295;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'body':{'type':Sequelize[_0x6326('0x2')](_0x6326('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6326('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6326('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6326('0x5')]('in',_0x6326('0x6')),'defaultValue':_0x6326('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6326('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 797a5a9..c5faeab 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 _0xdf6b=['params','includeAll','options','find','create','body','describe','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','reject','chat','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','rejectmessage','eml-format','fast-json-patch','moment','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/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','destroy','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','VIRTUAL','ChatMessage','include','findAll','show'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xdf6b,0x138));var _0xbdf6=function(_0x2ce5af,_0x487e0a){_0x2ce5af=_0x2ce5af-0x0;var _0x19fbb8=_0xdf6b[_0x2ce5af];return _0x19fbb8;};'use strict';var emlformat=require(_0xbdf6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbdf6('0x1'));var rp=require('request-promise');var moment=require(_0xbdf6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbdf6('0x3'));var util=require(_0xbdf6('0x4'));var path=require(_0xbdf6('0x5'));var sox=require(_0xbdf6('0x6'));var csv=require(_0xbdf6('0x7'));var ejs=require(_0xbdf6('0x8'));var fs=require('fs');var fs_extra=require(_0xbdf6('0x9'));var _=require(_0xbdf6('0xa'));var squel=require(_0xbdf6('0xb'));var crypto=require(_0xbdf6('0xc'));var jsforce=require(_0xbdf6('0xd'));var deskjs=require(_0xbdf6('0xe'));var toCsv=require(_0xbdf6('0x7'));var querystring=require(_0xbdf6('0xf'));var Papa=require(_0xbdf6('0x10'));var Redis=require(_0xbdf6('0x11'));var authService=require(_0xbdf6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbdf6('0x13'));var hardwareService=require(_0xbdf6('0x14'));var logger=require(_0xbdf6('0x15'))(_0xbdf6('0x16'));var utils=require(_0xbdf6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbdf6('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xbdf6('0x19')](config[_0xbdf6('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbdf6('0x1b'))[_0xbdf6('0x1c')](socket);var jayson=require(_0xbdf6('0x1d'));var client=jayson[_0xbdf6('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xbdf6('0x1e')][_0xbdf6('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x42d471,_0x4d23e5,_0x405680,_0x5e952a){return new BPromise(function(_0xb116ca,_0xca4faf){var _0x462fd0=_0x5e952a||client;return _0x462fd0[_0xbdf6('0x20')](_0x42d471,_0x405680)[_0xbdf6('0x21')](function(_0x509d5d){logger['info'](_0xbdf6('0x22'),_0x4d23e5,'request\x20sent');logger[_0xbdf6('0x23')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4d23e5,_0xbdf6('0x24'),JSON[_0xbdf6('0x25')](_0x509d5d));if(_0x509d5d['error']){if(_0x509d5d['error']['code']===0x1f4){logger[_0xbdf6('0x26')](_0xbdf6('0x22'),_0x4d23e5,_0x509d5d[_0xbdf6('0x26')]['message']);return _0xca4faf(_0x509d5d[_0xbdf6('0x26')][_0xbdf6('0x27')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x4d23e5,_0x509d5d[_0xbdf6('0x26')][_0xbdf6('0x27')]);return _0xb116ca(_0x509d5d[_0xbdf6('0x26')][_0xbdf6('0x27')]);}else{logger[_0xbdf6('0x28')](_0xbdf6('0x22'),_0x4d23e5,_0xbdf6('0x24'));_0xb116ca(_0x509d5d[_0xbdf6('0x29')][_0xbdf6('0x27')]);}})[_0xbdf6('0x2a')](function(_0x175c94){logger['error'](_0xbdf6('0x22'),_0x4d23e5,_0x175c94);_0xca4faf(_0x175c94);});});}function respondWithStatusCode(_0x439056,_0x257ee3){_0x257ee3=_0x257ee3||0xcc;return function(_0x4b4cc6){if(_0x4b4cc6){return _0x439056[_0xbdf6('0x2b')](_0x257ee3);}return _0x439056[_0xbdf6('0x2c')](_0x257ee3)['end']();};}function respondWithResult(_0x2afc52,_0x3aa135){_0x3aa135=_0x3aa135||0xc8;return function(_0x1ab404){if(_0x1ab404){return _0x2afc52[_0xbdf6('0x2c')](_0x3aa135)[_0xbdf6('0x2d')](_0x1ab404);}};}function respondWithFilteredResult(_0x105bcd,_0x44b3fd){return function(_0x32db27){if(_0x32db27){var _0x4d2736=typeof _0x44b3fd['offset']===_0xbdf6('0x2e')&&typeof _0x44b3fd['limit']===_0xbdf6('0x2e');var _0xc2e368=_0x32db27['count'];var _0x40fe6e=_0x4d2736?0x0:_0x44b3fd[_0xbdf6('0x2f')];var _0x58e939=_0x4d2736?_0x32db27[_0xbdf6('0x30')]:_0x44b3fd[_0xbdf6('0x2f')]+_0x44b3fd[_0xbdf6('0x31')];var _0x2d0c9e;if(_0x58e939>=_0xc2e368){_0x58e939=_0xc2e368;_0x2d0c9e=0xc8;}else{_0x2d0c9e=0xce;}_0x105bcd[_0xbdf6('0x2c')](_0x2d0c9e);return _0x105bcd[_0xbdf6('0x32')](_0xbdf6('0x33'),_0x40fe6e+'-'+_0x58e939+'/'+_0xc2e368)[_0xbdf6('0x2d')](_0x32db27);}return null;};}function patchUpdates(_0x15f1ac){return function(_0x378004){try{jsonpatch[_0xbdf6('0x34')](_0x378004,_0x15f1ac,!![]);}catch(_0x47b274){return BPromise['reject'](_0x47b274);}return _0x378004[_0xbdf6('0x35')]();};}function saveUpdates(_0xb22843,_0x5132b3){return function(_0x2a4757){if(_0x2a4757){return _0x2a4757[_0xbdf6('0x36')](_0xb22843)['then'](function(_0x10e721){return _0x10e721;});}return null;};}function removeEntity(_0x2baee4,_0x1f671f){return function(_0x409190){if(_0x409190){return _0x409190[_0xbdf6('0x37')]()['then'](function(){_0x2baee4[_0xbdf6('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249139,_0x2c1c4f){return function(_0x2fdc0f){if(!_0x2fdc0f){_0x249139['sendStatus'](0x194);}return _0x2fdc0f;};}function handleError(_0xbd2ca6,_0x1ce7d5){_0x1ce7d5=_0x1ce7d5||0x1f4;return function(_0x366303){logger[_0xbdf6('0x26')](_0x366303['stack']);if(_0x366303[_0xbdf6('0x38')]){delete _0x366303[_0xbdf6('0x38')];}_0xbd2ca6[_0xbdf6('0x2c')](_0x1ce7d5)[_0xbdf6('0x39')](_0x366303);};}exports['index']=function(_0x10d21c,_0x4d5ff9){var _0x5a6966={},_0x58182e={},_0x1ac365={'count':0x0,'rows':[]};var _0xa3b4a=_[_0xbdf6('0x3a')](db['ChatMessage'][_0xbdf6('0x3b')],function(_0x102365){return{'name':_0x102365[_0xbdf6('0x3c')],'type':_0x102365[_0xbdf6('0x3d')][_0xbdf6('0x3e')]};});_0x58182e[_0xbdf6('0x3f')]=_[_0xbdf6('0x3a')](_0xa3b4a,'name');_0x58182e[_0xbdf6('0x40')]=_[_0xbdf6('0x41')](_0x10d21c[_0xbdf6('0x40')]);_0x58182e[_0xbdf6('0x42')]=_[_0xbdf6('0x43')](_0x58182e[_0xbdf6('0x3f')],_0x58182e['query']);_0x5a6966['attributes']=_[_0xbdf6('0x43')](_0x58182e[_0xbdf6('0x3f')],qs[_0xbdf6('0x44')](_0x10d21c[_0xbdf6('0x40')][_0xbdf6('0x44')]));_0x5a6966[_0xbdf6('0x45')]=_0x5a6966[_0xbdf6('0x45')][_0xbdf6('0x46')]?_0x5a6966[_0xbdf6('0x45')]:_0x58182e[_0xbdf6('0x3f')];if(!_0x10d21c[_0xbdf6('0x40')]['hasOwnProperty']('nolimit')){_0x5a6966[_0xbdf6('0x31')]=qs[_0xbdf6('0x31')](_0x10d21c[_0xbdf6('0x40')]['limit']);_0x5a6966[_0xbdf6('0x2f')]=qs['offset'](_0x10d21c[_0xbdf6('0x40')]['offset']);}_0x5a6966[_0xbdf6('0x47')]=qs[_0xbdf6('0x48')](_0x10d21c[_0xbdf6('0x40')][_0xbdf6('0x48')]);_0x5a6966[_0xbdf6('0x49')]=qs[_0xbdf6('0x42')](_[_0xbdf6('0x4a')](_0x10d21c[_0xbdf6('0x40')],_0x58182e[_0xbdf6('0x42')]),_0xa3b4a);if(_0x10d21c['query']['filter']){_0x5a6966[_0xbdf6('0x49')]=_[_0xbdf6('0x4b')](_0x5a6966[_0xbdf6('0x49')],{'$or':_[_0xbdf6('0x3a')](_0xa3b4a,function(_0x3d0deb){if(_0x3d0deb[_0xbdf6('0x3d')]!==_0xbdf6('0x4c')){var _0x35eea4={};_0x35eea4[_0x3d0deb[_0xbdf6('0x38')]]={'$like':'%'+_0x10d21c[_0xbdf6('0x40')]['filter']+'%'};return _0x35eea4;}})});}_0x5a6966=_[_0xbdf6('0x4b')]({},_0x5a6966,_0x10d21c['options']);var _0x498b5a={'where':_0x5a6966[_0xbdf6('0x49')]};return db[_0xbdf6('0x4d')]['count'](_0x498b5a)[_0xbdf6('0x21')](function(_0x39d9fa){_0x1ac365[_0xbdf6('0x30')]=_0x39d9fa;if(_0x10d21c[_0xbdf6('0x40')]['includeAll']){_0x5a6966[_0xbdf6('0x4e')]=[{'all':!![]}];}return db['ChatMessage'][_0xbdf6('0x4f')](_0x5a6966);})[_0xbdf6('0x21')](function(_0x18a899){_0x1ac365['rows']=_0x18a899;return _0x1ac365;})[_0xbdf6('0x21')](respondWithFilteredResult(_0x4d5ff9,_0x5a6966))['catch'](handleError(_0x4d5ff9,null));};exports[_0xbdf6('0x50')]=function(_0x1dfbba,_0x48dffa){var _0x356f78={'raw':!![],'where':{'id':_0x1dfbba[_0xbdf6('0x51')]['id']}},_0xd97653={};_0xd97653[_0xbdf6('0x3f')]=_[_0xbdf6('0x41')](db['ChatMessage']['rawAttributes']);_0xd97653[_0xbdf6('0x40')]=_[_0xbdf6('0x41')](_0x1dfbba['query']);_0xd97653[_0xbdf6('0x42')]=_[_0xbdf6('0x43')](_0xd97653[_0xbdf6('0x3f')],_0xd97653[_0xbdf6('0x40')]);_0x356f78[_0xbdf6('0x45')]=_[_0xbdf6('0x43')](_0xd97653[_0xbdf6('0x3f')],qs[_0xbdf6('0x44')](_0x1dfbba['query']['fields']));_0x356f78['attributes']=_0x356f78[_0xbdf6('0x45')][_0xbdf6('0x46')]?_0x356f78[_0xbdf6('0x45')]:_0xd97653[_0xbdf6('0x3f')];if(_0x1dfbba[_0xbdf6('0x40')][_0xbdf6('0x52')]){_0x356f78[_0xbdf6('0x4e')]=[{'all':!![]}];}_0x356f78=_['merge']({},_0x356f78,_0x1dfbba[_0xbdf6('0x53')]);return db['ChatMessage'][_0xbdf6('0x54')](_0x356f78)[_0xbdf6('0x21')](handleEntityNotFound(_0x48dffa,null))[_0xbdf6('0x21')](respondWithResult(_0x48dffa,null))[_0xbdf6('0x2a')](handleError(_0x48dffa,null));};exports['create']=function(_0x2bad72,_0x612b62){return db[_0xbdf6('0x4d')][_0xbdf6('0x55')](_0x2bad72[_0xbdf6('0x56')],{})[_0xbdf6('0x21')](respondWithResult(_0x612b62,0xc9))[_0xbdf6('0x2a')](handleError(_0x612b62,null));};exports[_0xbdf6('0x36')]=function(_0x187919,_0x62865f){if(_0x187919[_0xbdf6('0x56')]['id']){delete _0x187919[_0xbdf6('0x56')]['id'];}return db[_0xbdf6('0x4d')][_0xbdf6('0x54')]({'where':{'id':_0x187919[_0xbdf6('0x51')]['id']}})['then'](handleEntityNotFound(_0x62865f,null))[_0xbdf6('0x21')](saveUpdates(_0x187919[_0xbdf6('0x56')],null))['then'](respondWithResult(_0x62865f,null))['catch'](handleError(_0x62865f,null));};exports[_0xbdf6('0x37')]=function(_0x28e0b7,_0x17ab28){return db[_0xbdf6('0x4d')][_0xbdf6('0x54')]({'where':{'id':_0x28e0b7['params']['id']}})[_0xbdf6('0x21')](handleEntityNotFound(_0x17ab28,null))[_0xbdf6('0x21')](removeEntity(_0x17ab28,null))['catch'](handleError(_0x17ab28,null));};exports[_0xbdf6('0x57')]=function(_0x9296a4,_0x118646){return db[_0xbdf6('0x4d')]['describe']()[_0xbdf6('0x21')](respondWithResult(_0x118646,null))[_0xbdf6('0x2a')](handleError(_0x118646,null));};var interaction_log=require(_0xbdf6('0x15'))('chat-interactions');exports['accept']=function(_0x4718b4,_0x44d815,_0x350f06){var _0x4e205d={'agent':{},'channel':'chat'};if(_0x4718b4[_0xbdf6('0x56')]['id']){delete _0x4718b4[_0xbdf6('0x56')]['id'];}_0x4718b4[_0xbdf6('0x56')][_0xbdf6('0x58')]=!![];_0x4718b4['body'][_0xbdf6('0x59')]=moment()['format'](_0xbdf6('0x5a'));_0x4718b4['body'][_0xbdf6('0x5b')]=_0x4718b4[_0xbdf6('0x56')][_0xbdf6('0x5b')]||_0x4718b4[_0xbdf6('0x5c')]['id'];_0x4e205d['agent']['id']=_0x4718b4[_0xbdf6('0x56')][_0xbdf6('0x5b')];return db[_0xbdf6('0x4d')][_0xbdf6('0x54')]({'where':{'id':_0x4718b4[_0xbdf6('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x44d815,null))[_0xbdf6('0x21')](saveUpdates(_0x4718b4[_0xbdf6('0x56')],null))[_0xbdf6('0x21')](function(_0x20930a){if(_0x20930a){_0x4e205d[_0xbdf6('0x27')]=_0x20930a[_0xbdf6('0x5d')]({'plain':!![]});return db[_0xbdf6('0x5e')][_0xbdf6('0x54')]({'where':{'id':_0x20930a['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x44d815,null))[_0xbdf6('0x21')](function(_0x5ea94e){if(_0x5ea94e){return _0x5ea94e[_0xbdf6('0x36')]({'UserId':_0x4718b4[_0xbdf6('0x56')]['UserId'],'read1stAt':_[_0xbdf6('0x5f')](_0x5ea94e[_0xbdf6('0x60')])?moment()[_0xbdf6('0x61')](_0xbdf6('0x5a')):undefined});}return null;})['then'](function(_0x2f73b7){if(_0x2f73b7){_0x4e205d[_0xbdf6('0x62')]=_0x2f73b7[_0xbdf6('0x5d')]({'plain':!![]});interaction_log['info'](_0xbdf6('0x63'),_0x4718b4[_0xbdf6('0x5c')]['id'],_0x4718b4[_0xbdf6('0x5c')][_0xbdf6('0x38')],_0x4718b4[_0xbdf6('0x5c')][_0xbdf6('0x64')],_0x4e205d[_0xbdf6('0x62')]['id'],_0x4718b4[_0xbdf6('0x56')]?JSON[_0xbdf6('0x25')](_0x4718b4['body']):_0xbdf6('0x65'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x4e205d);}return null;})[_0xbdf6('0x21')](function(_0x2e3e3c){var _0x38f7d9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2e3e3c[_0xbdf6('0x27')][_0xbdf6('0x66')];return db[_0xbdf6('0x67')][_0xbdf6('0x40')](_0x38f7d9,{'type':db[_0xbdf6('0x68')][_0xbdf6('0x69')][_0xbdf6('0x6a')],'raw':!![]})[_0xbdf6('0x21')](function(_0x43d707){return _0x43d707;});})[_0xbdf6('0x21')](function(_0xc0732){if(_0xc0732){_0x4e205d[_0xbdf6('0x27')][_0xbdf6('0x6b')]=_0xc0732[0x0];if(!_0x4718b4[_0xbdf6('0x56')]['UserId'])return;return db[_0xbdf6('0x6c')][_0xbdf6('0x54')]({'where':{'id':_0x4718b4[_0xbdf6('0x56')][_0xbdf6('0x5b')],'role':_0xbdf6('0x6d')},'attributes':['id',_0xbdf6('0x38'),_0xbdf6('0x6e'),'email',_0xbdf6('0x6f')],'raw':!![]});}return null;})['then'](function(_0x498404){if(!_0x498404)return null;_0x4e205d[_0xbdf6('0x27')][_0xbdf6('0x6d')]=_0x498404;return _0x4e205d;})[_0xbdf6('0x21')](function(_0x18eeae){if(_0x18eeae){if(_0x4718b4[_0xbdf6('0x56')][_0xbdf6('0x70')]){_0x4e205d['message'][_0xbdf6('0x71')]=util[_0xbdf6('0x61')](_0xbdf6('0x72'),_0x4718b4['user']['name']);_0x4e205d[_0xbdf6('0x27')]['channel']=_0x4e205d[_0xbdf6('0x73')];_0x4e205d[_0xbdf6('0x27')][_0xbdf6('0x74')]=_0x4e205d[_0xbdf6('0x73')];_0x4e205d[_0xbdf6('0x27')][_0xbdf6('0x75')]=_0xbdf6('0x76');return respondWithRpcPromise(_0xbdf6('0x77'),_0xbdf6('0x77'),{'event':_0xbdf6('0x78'),'message':_[_0xbdf6('0x4b')](_0x4e205d[_0xbdf6('0x27')],JSON[_0xbdf6('0x79')](_0x4e205d[_0xbdf6('0x62')]['formData']))},client9002)['then'](function(){return _0x4e205d;});}return _0x4e205d;}return null;})[_0xbdf6('0x21')](respondWithResult(_0x44d815,null))[_0xbdf6('0x2a')](handleError(_0x44d815,null));};var interaction_log=require(_0xbdf6('0x15'))('chat-interactions');exports[_0xbdf6('0x7a')]=function(_0x1cf53e,_0x3cec00,_0x479db6){var _0x183fd1={'agent':{},'channel':_0xbdf6('0x7b')};if(_0x1cf53e[_0xbdf6('0x56')]['id']){delete _0x1cf53e['body']['id'];}_0x1cf53e[_0xbdf6('0x56')]['UserId']=_0x1cf53e[_0xbdf6('0x56')]['UserId']||_0x1cf53e[_0xbdf6('0x5c')]['id'];_0x183fd1[_0xbdf6('0x6d')]['id']=_0x1cf53e[_0xbdf6('0x56')]['UserId'];return db[_0xbdf6('0x4d')]['find']({'where':{'id':_0x1cf53e[_0xbdf6('0x51')]['id'],'UserId':null}})[_0xbdf6('0x21')](handleEntityNotFound(_0x3cec00,null))[_0xbdf6('0x21')](function(_0x1d2225){if(_0x1d2225){_0x183fd1[_0xbdf6('0x27')]=_0x1d2225[_0xbdf6('0x5d')]({'plain':!![]});return db['ChatInteraction'][_0xbdf6('0x54')]({'where':{'id':_0x1d2225[_0xbdf6('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x3cec00,null))[_0xbdf6('0x21')](function(_0x4e3d26){if(_0x4e3d26){_0x183fd1[_0xbdf6('0x62')]=_0x4e3d26[_0xbdf6('0x5d')]({'plain':!![]});interaction_log[_0xbdf6('0x28')](_0xbdf6('0x7d'),_0x1cf53e[_0xbdf6('0x5c')]['id'],_0x1cf53e['user'][_0xbdf6('0x38')],_0x1cf53e['user'][_0xbdf6('0x64')],_0x183fd1[_0xbdf6('0x62')]['id'],_0x1cf53e[_0xbdf6('0x56')]?JSON[_0xbdf6('0x25')](_0x1cf53e[_0xbdf6('0x56')]):_0xbdf6('0x65'));return respondWithRpcPromise(_0xbdf6('0x7e'),_0xbdf6('0x7f'),_0x183fd1);}return null;})[_0xbdf6('0x21')](function(_0x17c6eb){var _0x2e5667=_0xbdf6('0x80')+_0x17c6eb[_0xbdf6('0x27')]['ContactId'];return db[_0xbdf6('0x67')][_0xbdf6('0x40')](_0x2e5667,{'type':db[_0xbdf6('0x68')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x116329){return _0x116329;});})[_0xbdf6('0x21')](function(_0x4a87c9){if(_0x4a87c9){_0x183fd1['message'][_0xbdf6('0x6b')]=_0x4a87c9[0x0];if(!_0x1cf53e[_0xbdf6('0x56')][_0xbdf6('0x5b')])return;return db[_0xbdf6('0x6c')][_0xbdf6('0x54')]({'where':{'id':_0x1cf53e[_0xbdf6('0x56')]['UserId'],'role':_0xbdf6('0x6d')},'attributes':['id','name',_0xbdf6('0x6e'),_0xbdf6('0x81'),_0xbdf6('0x6f')],'raw':!![]});}return null;})[_0xbdf6('0x21')](function(_0x46f5f3){if(!_0x46f5f3)return null;_0x183fd1[_0xbdf6('0x27')][_0xbdf6('0x6d')]=_0x46f5f3;return _0x183fd1;})[_0xbdf6('0x21')](function(_0x44e935){if(_0x44e935){_0x44e935[_0xbdf6('0x27')]['interface']=util['format'](_0xbdf6('0x72'),_0x1cf53e[_0xbdf6('0x5c')]['name']);_0x44e935[_0xbdf6('0x27')][_0xbdf6('0x73')]=_0x183fd1['channel'];_0x44e935[_0xbdf6('0x27')][_0xbdf6('0x74')]=_0x183fd1[_0xbdf6('0x73')];_0x44e935[_0xbdf6('0x27')]['event']=_0xbdf6('0x7a');respondWithRpcPromise(_0xbdf6('0x77'),_0xbdf6('0x77'),{'event':_0xbdf6('0x82'),'message':_[_0xbdf6('0x4b')](_0x183fd1[_0xbdf6('0x27')],JSON[_0xbdf6('0x79')](_0x183fd1[_0xbdf6('0x62')]['formData']))},client9002);return _0x183fd1;}return null;})['then'](respondWithResult(_0x3cec00,null))[_0xbdf6('0x2a')](handleError(_0x3cec00,null));}; \ No newline at end of file +var _0x0ca9=['ChatMessage','includeAll','findAll','rows','catch','params','keys','include','find','create','body','describe','chat-interactions','accept','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','name','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','agent','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','Sequelize','QueryTypes','contact','User','interface','rejectmessage','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','send','index','map','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','options'];(function(_0x3495e7,_0x2f6a1f){var _0x5cbb6f=function(_0x247f30){while(--_0x247f30){_0x3495e7['push'](_0x3495e7['shift']());}};_0x5cbb6f(++_0x2f6a1f);}(_0x0ca9,0xbc));var _0x90ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ca9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90ca('0x0'));var zipdir=require(_0x90ca('0x1'));var jsonpatch=require(_0x90ca('0x2'));var rp=require('request-promise');var moment=require(_0x90ca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x90ca('0x4'));var util=require(_0x90ca('0x5'));var path=require(_0x90ca('0x6'));var sox=require(_0x90ca('0x7'));var csv=require(_0x90ca('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x90ca('0x9'));var _=require('lodash');var squel=require(_0x90ca('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90ca('0xb'));var toCsv=require(_0x90ca('0x8'));var querystring=require(_0x90ca('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x90ca('0xd'));var qs=require(_0x90ca('0xe'));var as=require(_0x90ca('0xf'));var hardwareService=require(_0x90ca('0x10'));var logger=require(_0x90ca('0x11'))(_0x90ca('0x12'));var utils=require(_0x90ca('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x90ca('0x14'));var db=require(_0x90ca('0x15'))['db'];config[_0x90ca('0x16')]=_[_0x90ca('0x17')](config[_0x90ca('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x90ca('0x18'))(new Redis(config['redis']));require(_0x90ca('0x19'))[_0x90ca('0x1a')](socket);var jayson=require(_0x90ca('0x1b'));var client=jayson[_0x90ca('0x1c')][_0x90ca('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x90ca('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xfca5fc,_0x3d7cba,_0x389247,_0xcc839f){return new BPromise(function(_0x357a87,_0xfa2fe0){var _0x6e0465=_0xcc839f||client;return _0x6e0465[_0x90ca('0x1e')](_0xfca5fc,_0x389247)[_0x90ca('0x1f')](function(_0x4b0a59){logger[_0x90ca('0x20')](_0x90ca('0x21'),_0x3d7cba,'request\x20sent');logger[_0x90ca('0x22')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3d7cba,_0x90ca('0x23'),JSON[_0x90ca('0x24')](_0x4b0a59));if(_0x4b0a59[_0x90ca('0x25')]){if(_0x4b0a59[_0x90ca('0x25')]['code']===0x1f4){logger['error'](_0x90ca('0x21'),_0x3d7cba,_0x4b0a59['error'][_0x90ca('0x26')]);return _0xfa2fe0(_0x4b0a59['error'][_0x90ca('0x26')]);}logger[_0x90ca('0x25')](_0x90ca('0x21'),_0x3d7cba,_0x4b0a59[_0x90ca('0x25')]['message']);return _0x357a87(_0x4b0a59[_0x90ca('0x25')][_0x90ca('0x26')]);}else{logger[_0x90ca('0x20')]('ChatMessage,\x20%s,\x20%s',_0x3d7cba,_0x90ca('0x23'));_0x357a87(_0x4b0a59[_0x90ca('0x27')][_0x90ca('0x26')]);}})['catch'](function(_0x2953f8){logger[_0x90ca('0x25')](_0x90ca('0x21'),_0x3d7cba,_0x2953f8);_0xfa2fe0(_0x2953f8);});});}function respondWithStatusCode(_0x4bdc10,_0x4df407){_0x4df407=_0x4df407||0xcc;return function(_0x3c8895){if(_0x3c8895){return _0x4bdc10['sendStatus'](_0x4df407);}return _0x4bdc10['status'](_0x4df407)[_0x90ca('0x28')]();};}function respondWithResult(_0x45da61,_0x25224c){_0x25224c=_0x25224c||0xc8;return function(_0x428c00){if(_0x428c00){return _0x45da61[_0x90ca('0x29')](_0x25224c)[_0x90ca('0x2a')](_0x428c00);}};}function respondWithFilteredResult(_0x35bf72,_0x3067ea){return function(_0x7461b1){if(_0x7461b1){var _0x21dafc=typeof _0x3067ea[_0x90ca('0x2b')]==='undefined'&&typeof _0x3067ea[_0x90ca('0x2c')]===_0x90ca('0x2d');var _0x3acfb6=_0x7461b1[_0x90ca('0x2e')];var _0x19fefb=_0x21dafc?0x0:_0x3067ea[_0x90ca('0x2b')];var _0x2b03e4=_0x21dafc?_0x7461b1['count']:_0x3067ea[_0x90ca('0x2b')]+_0x3067ea[_0x90ca('0x2c')];var _0x58c5e4;if(_0x2b03e4>=_0x3acfb6){_0x2b03e4=_0x3acfb6;_0x58c5e4=0xc8;}else{_0x58c5e4=0xce;}_0x35bf72[_0x90ca('0x29')](_0x58c5e4);return _0x35bf72[_0x90ca('0x2f')](_0x90ca('0x30'),_0x19fefb+'-'+_0x2b03e4+'/'+_0x3acfb6)['json'](_0x7461b1);}return null;};}function patchUpdates(_0x30aa73){return function(_0x146173){try{jsonpatch[_0x90ca('0x31')](_0x146173,_0x30aa73,!![]);}catch(_0x4b5fe6){return BPromise[_0x90ca('0x32')](_0x4b5fe6);}return _0x146173[_0x90ca('0x33')]();};}function saveUpdates(_0x4bf1c4,_0x5062b8){return function(_0x2a0092){if(_0x2a0092){return _0x2a0092[_0x90ca('0x34')](_0x4bf1c4)['then'](function(_0x55ad85){return _0x55ad85;});}return null;};}function removeEntity(_0x2d2c05,_0x4f5beb){return function(_0xdd34ad){if(_0xdd34ad){return _0xdd34ad[_0x90ca('0x35')]()[_0x90ca('0x1f')](function(){_0x2d2c05['status'](0xcc)[_0x90ca('0x28')]();});}};}function handleEntityNotFound(_0xab3fb7,_0x2004bf){return function(_0x39c4ac){if(!_0x39c4ac){_0xab3fb7[_0x90ca('0x36')](0x194);}return _0x39c4ac;};}function handleError(_0x5b130e,_0x4581b0){_0x4581b0=_0x4581b0||0x1f4;return function(_0x2c90a0){logger[_0x90ca('0x25')](_0x2c90a0[_0x90ca('0x37')]);if(_0x2c90a0['name']){delete _0x2c90a0['name'];}_0x5b130e['status'](_0x4581b0)[_0x90ca('0x38')](_0x2c90a0);};}exports[_0x90ca('0x39')]=function(_0x205ab2,_0x47c696){var _0x5144a9={},_0x1dce6f={},_0xbdaf36={'count':0x0,'rows':[]};var _0x2664ca=_[_0x90ca('0x3a')](db['ChatMessage'][_0x90ca('0x3b')],function(_0x535ad0){return{'name':_0x535ad0[_0x90ca('0x3c')],'type':_0x535ad0['type'][_0x90ca('0x3d')]};});_0x1dce6f['model']=_[_0x90ca('0x3a')](_0x2664ca,'name');_0x1dce6f[_0x90ca('0x3e')]=_['keys'](_0x205ab2[_0x90ca('0x3e')]);_0x1dce6f['filters']=_[_0x90ca('0x3f')](_0x1dce6f[_0x90ca('0x40')],_0x1dce6f[_0x90ca('0x3e')]);_0x5144a9[_0x90ca('0x41')]=_[_0x90ca('0x3f')](_0x1dce6f[_0x90ca('0x40')],qs['fields'](_0x205ab2['query'][_0x90ca('0x42')]));_0x5144a9['attributes']=_0x5144a9['attributes'][_0x90ca('0x43')]?_0x5144a9[_0x90ca('0x41')]:_0x1dce6f[_0x90ca('0x40')];if(!_0x205ab2['query'][_0x90ca('0x44')](_0x90ca('0x45'))){_0x5144a9['limit']=qs[_0x90ca('0x2c')](_0x205ab2['query']['limit']);_0x5144a9[_0x90ca('0x2b')]=qs[_0x90ca('0x2b')](_0x205ab2[_0x90ca('0x3e')]['offset']);}_0x5144a9[_0x90ca('0x46')]=qs[_0x90ca('0x47')](_0x205ab2['query'][_0x90ca('0x47')]);_0x5144a9['where']=qs[_0x90ca('0x48')](_[_0x90ca('0x49')](_0x205ab2[_0x90ca('0x3e')],_0x1dce6f['filters']),_0x2664ca);if(_0x205ab2[_0x90ca('0x3e')][_0x90ca('0x4a')]){_0x5144a9['where']=_[_0x90ca('0x4b')](_0x5144a9[_0x90ca('0x4c')],{'$or':_[_0x90ca('0x3a')](_0x2664ca,function(_0x41d41b){if(_0x41d41b[_0x90ca('0x4d')]!==_0x90ca('0x4e')){var _0xa3c832={};_0xa3c832[_0x41d41b['name']]={'$like':'%'+_0x205ab2[_0x90ca('0x3e')][_0x90ca('0x4a')]+'%'};return _0xa3c832;}})});}_0x5144a9=_[_0x90ca('0x4b')]({},_0x5144a9,_0x205ab2[_0x90ca('0x4f')]);var _0x258e73={'where':_0x5144a9[_0x90ca('0x4c')]};return db[_0x90ca('0x50')][_0x90ca('0x2e')](_0x258e73)['then'](function(_0x534655){_0xbdaf36[_0x90ca('0x2e')]=_0x534655;if(_0x205ab2[_0x90ca('0x3e')][_0x90ca('0x51')]){_0x5144a9['include']=[{'all':!![]}];}return db['ChatMessage'][_0x90ca('0x52')](_0x5144a9);})[_0x90ca('0x1f')](function(_0x31833b){_0xbdaf36[_0x90ca('0x53')]=_0x31833b;return _0xbdaf36;})[_0x90ca('0x1f')](respondWithFilteredResult(_0x47c696,_0x5144a9))[_0x90ca('0x54')](handleError(_0x47c696,null));};exports['show']=function(_0x56bab0,_0x3bcc1d){var _0x2e5016={'raw':!![],'where':{'id':_0x56bab0[_0x90ca('0x55')]['id']}},_0x50f571={};_0x50f571['model']=_['keys'](db[_0x90ca('0x50')][_0x90ca('0x3b')]);_0x50f571[_0x90ca('0x3e')]=_[_0x90ca('0x56')](_0x56bab0[_0x90ca('0x3e')]);_0x50f571['filters']=_[_0x90ca('0x3f')](_0x50f571[_0x90ca('0x40')],_0x50f571[_0x90ca('0x3e')]);_0x2e5016['attributes']=_[_0x90ca('0x3f')](_0x50f571[_0x90ca('0x40')],qs[_0x90ca('0x42')](_0x56bab0[_0x90ca('0x3e')][_0x90ca('0x42')]));_0x2e5016[_0x90ca('0x41')]=_0x2e5016[_0x90ca('0x41')][_0x90ca('0x43')]?_0x2e5016[_0x90ca('0x41')]:_0x50f571[_0x90ca('0x40')];if(_0x56bab0[_0x90ca('0x3e')][_0x90ca('0x51')]){_0x2e5016[_0x90ca('0x57')]=[{'all':!![]}];}_0x2e5016=_[_0x90ca('0x4b')]({},_0x2e5016,_0x56bab0[_0x90ca('0x4f')]);return db['ChatMessage'][_0x90ca('0x58')](_0x2e5016)[_0x90ca('0x1f')](handleEntityNotFound(_0x3bcc1d,null))[_0x90ca('0x1f')](respondWithResult(_0x3bcc1d,null))['catch'](handleError(_0x3bcc1d,null));};exports[_0x90ca('0x59')]=function(_0x5526cf,_0x3b8c02){return db[_0x90ca('0x50')][_0x90ca('0x59')](_0x5526cf[_0x90ca('0x5a')],{})[_0x90ca('0x1f')](respondWithResult(_0x3b8c02,0xc9))[_0x90ca('0x54')](handleError(_0x3b8c02,null));};exports[_0x90ca('0x34')]=function(_0x26db81,_0x188f66){if(_0x26db81['body']['id']){delete _0x26db81[_0x90ca('0x5a')]['id'];}return db[_0x90ca('0x50')][_0x90ca('0x58')]({'where':{'id':_0x26db81[_0x90ca('0x55')]['id']}})[_0x90ca('0x1f')](handleEntityNotFound(_0x188f66,null))[_0x90ca('0x1f')](saveUpdates(_0x26db81[_0x90ca('0x5a')],null))[_0x90ca('0x1f')](respondWithResult(_0x188f66,null))[_0x90ca('0x54')](handleError(_0x188f66,null));};exports[_0x90ca('0x35')]=function(_0x382822,_0x2bb0cc){return db[_0x90ca('0x50')]['find']({'where':{'id':_0x382822['params']['id']}})[_0x90ca('0x1f')](handleEntityNotFound(_0x2bb0cc,null))[_0x90ca('0x1f')](removeEntity(_0x2bb0cc,null))[_0x90ca('0x54')](handleError(_0x2bb0cc,null));};exports[_0x90ca('0x5b')]=function(_0x5a9d3a,_0x4679e6){return db[_0x90ca('0x50')][_0x90ca('0x5b')]()[_0x90ca('0x1f')](respondWithResult(_0x4679e6,null))[_0x90ca('0x54')](handleError(_0x4679e6,null));};var interaction_log=require(_0x90ca('0x11'))(_0x90ca('0x5c'));exports[_0x90ca('0x5d')]=function(_0x26ffb2,_0x458d65,_0x467460){var _0x2650d4={'agent':{},'channel':'chat'};if(_0x26ffb2[_0x90ca('0x5a')]['id']){delete _0x26ffb2['body']['id'];}_0x26ffb2['body']['read']=!![];_0x26ffb2['body']['readAt']=moment()['format'](_0x90ca('0x5e'));_0x26ffb2[_0x90ca('0x5a')][_0x90ca('0x5f')]=_0x26ffb2['body'][_0x90ca('0x5f')]||_0x26ffb2[_0x90ca('0x60')]['id'];_0x2650d4['agent']['id']=_0x26ffb2[_0x90ca('0x5a')][_0x90ca('0x5f')];return db['ChatMessage']['find']({'where':{'id':_0x26ffb2[_0x90ca('0x55')]['id'],'UserId':null}})[_0x90ca('0x1f')](handleEntityNotFound(_0x458d65,null))[_0x90ca('0x1f')](saveUpdates(_0x26ffb2[_0x90ca('0x5a')],null))[_0x90ca('0x1f')](function(_0x569a1f){if(_0x569a1f){_0x2650d4['message']=_0x569a1f[_0x90ca('0x61')]({'plain':!![]});return db[_0x90ca('0x62')][_0x90ca('0x58')]({'where':{'id':_0x569a1f[_0x90ca('0x63')]}});}return null;})[_0x90ca('0x1f')](handleEntityNotFound(_0x458d65,null))[_0x90ca('0x1f')](function(_0x41cdfe){if(_0x41cdfe){return _0x41cdfe['update']({'UserId':_0x26ffb2[_0x90ca('0x5a')][_0x90ca('0x5f')],'read1stAt':_[_0x90ca('0x64')](_0x41cdfe[_0x90ca('0x65')])?moment()[_0x90ca('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0xf3a9c0){if(_0xf3a9c0){_0x2650d4['interaction']=_0xf3a9c0[_0x90ca('0x61')]({'plain':!![]});interaction_log[_0x90ca('0x20')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x26ffb2[_0x90ca('0x60')]['id'],_0x26ffb2['user'][_0x90ca('0x67')],_0x26ffb2[_0x90ca('0x60')]['role'],_0x2650d4[_0x90ca('0x68')]['id'],_0x26ffb2[_0x90ca('0x5a')]?JSON[_0x90ca('0x24')](_0x26ffb2[_0x90ca('0x5a')]):_0x90ca('0x69'));return respondWithRpcPromise(_0x90ca('0x6a'),_0x90ca('0x6b'),_0x2650d4);}return null;})[_0x90ca('0x1f')](function(_0xc26cfc){var _0x44cc82=_0x90ca('0x6c')+_0xc26cfc[_0x90ca('0x26')]['ContactId'];return db['sequelize'][_0x90ca('0x3e')](_0x44cc82,{'type':db['Sequelize']['QueryTypes'][_0x90ca('0x6d')],'raw':!![]})['then'](function(_0x489abc){return _0x489abc;});})[_0x90ca('0x1f')](function(_0x16e579){if(_0x16e579){_0x2650d4[_0x90ca('0x26')]['contact']=_0x16e579[0x0];if(!_0x26ffb2[_0x90ca('0x5a')][_0x90ca('0x5f')])return;return db['User']['find']({'where':{'id':_0x26ffb2[_0x90ca('0x5a')][_0x90ca('0x5f')],'role':_0x90ca('0x6e')},'attributes':['id',_0x90ca('0x67'),_0x90ca('0x6f'),_0x90ca('0x70'),_0x90ca('0x71')],'raw':!![]});}return null;})['then'](function(_0x1640d4){if(!_0x1640d4)return null;_0x2650d4[_0x90ca('0x26')][_0x90ca('0x6e')]=_0x1640d4;return _0x2650d4;})[_0x90ca('0x1f')](function(_0xea76dc){if(_0xea76dc){if(_0x26ffb2[_0x90ca('0x5a')][_0x90ca('0x72')]){_0x2650d4[_0x90ca('0x26')]['interface']=util[_0x90ca('0x66')](_0x90ca('0x73'),_0x26ffb2['user'][_0x90ca('0x67')]);_0x2650d4[_0x90ca('0x26')][_0x90ca('0x74')]=_0x2650d4[_0x90ca('0x74')];_0x2650d4[_0x90ca('0x26')][_0x90ca('0x75')]=_0x2650d4['channel'];_0x2650d4[_0x90ca('0x26')][_0x90ca('0x76')]=_0x90ca('0x5d');return respondWithRpcPromise(_0x90ca('0x77'),'EventManager',{'event':'acceptmessage','message':_[_0x90ca('0x4b')](_0x2650d4['message'],JSON[_0x90ca('0x78')](_0x2650d4[_0x90ca('0x68')][_0x90ca('0x79')]))},client9002)[_0x90ca('0x1f')](function(){return _0x2650d4;});}return _0x2650d4;}return null;})[_0x90ca('0x1f')](respondWithResult(_0x458d65,null))['catch'](handleError(_0x458d65,null));};var interaction_log=require(_0x90ca('0x11'))(_0x90ca('0x5c'));exports['reject']=function(_0x301a65,_0x40c1f9,_0x288b01){var _0xc59adf={'agent':{},'channel':_0x90ca('0x7a')};if(_0x301a65[_0x90ca('0x5a')]['id']){delete _0x301a65[_0x90ca('0x5a')]['id'];}_0x301a65[_0x90ca('0x5a')][_0x90ca('0x5f')]=_0x301a65['body'][_0x90ca('0x5f')]||_0x301a65[_0x90ca('0x60')]['id'];_0xc59adf[_0x90ca('0x6e')]['id']=_0x301a65[_0x90ca('0x5a')][_0x90ca('0x5f')];return db[_0x90ca('0x50')][_0x90ca('0x58')]({'where':{'id':_0x301a65[_0x90ca('0x55')]['id'],'UserId':null}})[_0x90ca('0x1f')](handleEntityNotFound(_0x40c1f9,null))[_0x90ca('0x1f')](function(_0xbf292a){if(_0xbf292a){_0xc59adf[_0x90ca('0x26')]=_0xbf292a[_0x90ca('0x61')]({'plain':!![]});return db[_0x90ca('0x62')][_0x90ca('0x58')]({'where':{'id':_0xbf292a[_0x90ca('0x63')]}});}return null;})[_0x90ca('0x1f')](handleEntityNotFound(_0x40c1f9,null))[_0x90ca('0x1f')](function(_0x5763d8){if(_0x5763d8){_0xc59adf[_0x90ca('0x68')]=_0x5763d8['get']({'plain':!![]});interaction_log[_0x90ca('0x20')](_0x90ca('0x7b'),_0x301a65['user']['id'],_0x301a65[_0x90ca('0x60')][_0x90ca('0x67')],_0x301a65['user'][_0x90ca('0x7c')],_0xc59adf[_0x90ca('0x68')]['id'],_0x301a65[_0x90ca('0x5a')]?JSON[_0x90ca('0x24')](_0x301a65[_0x90ca('0x5a')]):_0x90ca('0x69'));return respondWithRpcPromise(_0x90ca('0x7d'),_0x90ca('0x7e'),_0xc59adf);}return null;})[_0x90ca('0x1f')](function(_0x314569){var _0x3cda27=_0x90ca('0x6c')+_0x314569[_0x90ca('0x26')][_0x90ca('0x7f')];return db['sequelize'][_0x90ca('0x3e')](_0x3cda27,{'type':db[_0x90ca('0x80')][_0x90ca('0x81')][_0x90ca('0x6d')],'raw':!![]})[_0x90ca('0x1f')](function(_0x40216e){return _0x40216e;});})[_0x90ca('0x1f')](function(_0x2ad97e){if(_0x2ad97e){_0xc59adf['message'][_0x90ca('0x82')]=_0x2ad97e[0x0];if(!_0x301a65['body'][_0x90ca('0x5f')])return;return db[_0x90ca('0x83')]['find']({'where':{'id':_0x301a65['body'][_0x90ca('0x5f')],'role':_0x90ca('0x6e')},'attributes':['id',_0x90ca('0x67'),'fullname',_0x90ca('0x70'),_0x90ca('0x71')],'raw':!![]});}return null;})[_0x90ca('0x1f')](function(_0xb6f57a){if(!_0xb6f57a)return null;_0xc59adf[_0x90ca('0x26')][_0x90ca('0x6e')]=_0xb6f57a;return _0xc59adf;})[_0x90ca('0x1f')](function(_0x5e1305){if(_0x5e1305){_0x5e1305['message'][_0x90ca('0x84')]=util[_0x90ca('0x66')](_0x90ca('0x73'),_0x301a65['user']['name']);_0x5e1305[_0x90ca('0x26')][_0x90ca('0x74')]=_0xc59adf[_0x90ca('0x74')];_0x5e1305[_0x90ca('0x26')][_0x90ca('0x75')]=_0xc59adf[_0x90ca('0x74')];_0x5e1305[_0x90ca('0x26')]['event']='reject';respondWithRpcPromise('EventManager',_0x90ca('0x77'),{'event':_0x90ca('0x85'),'message':_[_0x90ca('0x4b')](_0xc59adf[_0x90ca('0x26')],JSON['parse'](_0xc59adf[_0x90ca('0x68')][_0x90ca('0x79')]))},client9002);return _0xc59adf;}return null;})[_0x90ca('0x1f')](respondWithResult(_0x40c1f9,null))[_0x90ca('0x54')](handleError(_0x40c1f9,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index f0a5ee2..c0adbcd 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 _0x792f=['events','ChatMessage','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x792f,0xb0));var _0xf792=function(_0x555ebb,_0x4b1b68){_0x555ebb=_0x555ebb-0x0;var _0x3c0a4a=_0x792f[_0x555ebb];return _0x3c0a4a;};'use strict';var EventEmitter=require(_0xf792('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xf792('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf792('0x2'),'afterUpdate':_0xf792('0x3'),'afterDestroy':_0xf792('0x4')};function emitEvent(_0x2ae700){return function(_0x49a3d0,_0x2ce722,_0x5a9883){ChatMessageEvents[_0xf792('0x5')](_0x2ae700+':'+_0x49a3d0['id'],_0x49a3d0);ChatMessageEvents[_0xf792('0x5')](_0x2ae700,_0x49a3d0);_0x5a9883(null);};}for(var e in events){if(events[_0xf792('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xf792('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xe0b7=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','ChatMessage'];(function(_0x28ecc1,_0x3adcab){var _0x574b40=function(_0x1b7d78){while(--_0x1b7d78){_0x28ecc1['push'](_0x28ecc1['shift']());}};_0x574b40(++_0x3adcab);}(_0xe0b7,0x9e));var _0x7e0b=function(_0x36fa08,_0x5c94cb){_0x36fa08=_0x36fa08-0x0;var _0x2f4fd1=_0xe0b7[_0x36fa08];return _0x2f4fd1;};'use strict';var EventEmitter=require(_0x7e0b('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x7e0b('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7e0b('0x2')](0x0);var events={'afterCreate':_0x7e0b('0x3'),'afterUpdate':_0x7e0b('0x4'),'afterDestroy':_0x7e0b('0x5')};function emitEvent(_0x3f92d0){return function(_0x187b6b,_0x220e17,_0x3382e5){ChatMessageEvents[_0x7e0b('0x6')](_0x3f92d0+':'+_0x187b6b['id'],_0x187b6b);ChatMessageEvents[_0x7e0b('0x6')](_0x3f92d0,_0x187b6b);_0x3382e5(null);};}for(var e in events){if(events[_0x7e0b('0x7')](e)){var event=events[e];ChatMessage[_0x7e0b('0x8')](e,emitEvent(event));}}module[_0x7e0b('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 8d55f73..b41f8e1 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 _0x4fba=['request-promise','path','rimraf','../../config/environment','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird'];(function(_0x156dee,_0x48937d){var _0x847c00=function(_0xd8425e){while(--_0xd8425e){_0x156dee['push'](_0x156dee['shift']());}};_0x847c00(++_0x48937d);}(_0x4fba,0x11e));var _0xa4fb=function(_0x1b4b8f,_0x1e3080){_0x1b4b8f=_0x1b4b8f-0x0;var _0x178821=_0x4fba[_0x1b4b8f];return _0x178821;};'use strict';var _=require(_0xa4fb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa4fb('0x1'));var moment=require(_0xa4fb('0x2'));var BPromise=require(_0xa4fb('0x3'));var rp=require(_0xa4fb('0x4'));var fs=require('fs');var path=require(_0xa4fb('0x5'));var rimraf=require(_0xa4fb('0x6'));var config=require(_0xa4fb('0x7'));var attributes=require('./chatMessage.attributes');module[_0xa4fb('0x8')]=function(_0x15c3bf,_0x4c71d7){return _0x15c3bf[_0xa4fb('0x9')](_0xa4fb('0xa'),attributes,{'tableName':_0xa4fb('0xb'),'paranoid':![],'indexes':[{'name':_0xa4fb('0xc'),'fields':[_0xa4fb('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1591c5,_0xd1c870,_0x263fed){var _0x924d7f=_0x15c3bf['models'];var _0x2c46f0=_0x1591c5[_0xa4fb('0xe')]({'plain':!![]});if(_0x2c46f0[_0xa4fb('0xf')][_0xa4fb('0x10')]()==='in'||_0x2c46f0[_0xa4fb('0xf')]['toLowerCase']()==='out'&&!_0x2c46f0[_0xa4fb('0x11')]&&!_[_0xa4fb('0x12')](_0x2c46f0[_0xa4fb('0x13')])){_0x924d7f[_0xa4fb('0x14')]['findOne']({'where':{'id':_0x2c46f0[_0xa4fb('0x15')]}})[_0xa4fb('0x16')](function(_0x2fb990){if(_0x2fb990){_0x2fb990[_0xa4fb('0x17')]({'lastMsgAt':_0x2c46f0[_0xa4fb('0x18')],'lastMsgDirection':_0x2c46f0['direction'][_0xa4fb('0x10')]()});}})[_0xa4fb('0x19')](function(_0x4efbf5){console[_0xa4fb('0x1a')](_0x4efbf5);});}_0x263fed();}},'charset':_0xa4fb('0x1b'),'collate':_0xa4fb('0x1c')});}; \ No newline at end of file +var _0x0571=['out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','chat_messages','body','direction'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0x0571,0xa4));var _0x1057=function(_0x3b9d5f,_0x2e9039){_0x3b9d5f=_0x3b9d5f-0x0;var _0x39924e=_0x0571[_0x3b9d5f];return _0x39924e;};'use strict';var _=require(_0x1057('0x0'));var util=require(_0x1057('0x1'));var logger=require('../../config/logger')(_0x1057('0x2'));var moment=require('moment');var BPromise=require(_0x1057('0x3'));var rp=require(_0x1057('0x4'));var fs=require('fs');var path=require(_0x1057('0x5'));var rimraf=require(_0x1057('0x6'));var config=require(_0x1057('0x7'));var attributes=require(_0x1057('0x8'));module['exports']=function(_0x13cc55,_0x944f90){return _0x13cc55['define']('ChatMessage',attributes,{'tableName':_0x1057('0x9'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x1057('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e2ebc,_0x1d0e1a,_0x5d93bf){var _0x4aafcc=_0x13cc55['models'];var _0x3ba2c9=_0x4e2ebc['get']({'plain':!![]});if(_0x3ba2c9['direction']['toLowerCase']()==='in'||_0x3ba2c9[_0x1057('0xb')]['toLowerCase']()===_0x1057('0xc')&&!_0x3ba2c9[_0x1057('0xd')]&&!_[_0x1057('0xe')](_0x3ba2c9[_0x1057('0xf')])){_0x4aafcc[_0x1057('0x10')][_0x1057('0x11')]({'where':{'id':_0x3ba2c9[_0x1057('0x12')]}})[_0x1057('0x13')](function(_0x5690b8){if(_0x5690b8){_0x5690b8['update']({'lastMsgAt':_0x3ba2c9[_0x1057('0x14')],'lastMsgDirection':_0x3ba2c9[_0x1057('0xb')]['toLowerCase']()});}})['catch'](function(_0x7e30cf){console['error'](_0x7e30cf);});}_0x5d93bf();}},'charset':'utf8mb4','collate':_0x1057('0x15')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index e8a898e..fecb01f 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 _0xe485=['stringify','error','code','message','result','catch','CreateChatMessage','create','body','options','raw','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xe485,0x114));var _0x5e48=function(_0x4f6cfc,_0x2cdf93){_0x4f6cfc=_0x4f6cfc-0x0;var _0x41a947=_0xe485[_0x4f6cfc];return _0x41a947;};'use strict';var _=require(_0x5e48('0x0'));var util=require('util');var moment=require(_0x5e48('0x1'));var BPromise=require(_0x5e48('0x2'));var rs=require(_0x5e48('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e48('0x4'))['db'];var utils=require(_0x5e48('0x5'));var logger=require('../../config/logger')(_0x5e48('0x6'));var config=require(_0x5e48('0x7'));var jayson=require(_0x5e48('0x8'));var client=jayson[_0x5e48('0x9')][_0x5e48('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5e48('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5e48('0xc'))(new Redis(config['redis']));require(_0x5e48('0xd'))[_0x5e48('0xe')](socket);function respondWithRpcPromise(_0x4d5905,_0x2ac2f6,_0x2cf654){return new BPromise(function(_0x3fd04e,_0x406075){return client[_0x5e48('0xf')](_0x4d5905,_0x2cf654)[_0x5e48('0x10')](function(_0xbd868){logger[_0x5e48('0x11')](_0x5e48('0x12'),_0x2ac2f6,_0x5e48('0x13'));logger['debug'](_0x5e48('0x14'),_0x2ac2f6,'request\x20sent',JSON[_0x5e48('0x15')](_0xbd868));if(_0xbd868[_0x5e48('0x16')]){if(_0xbd868[_0x5e48('0x16')][_0x5e48('0x17')]===0x1f4){logger[_0x5e48('0x16')](_0x5e48('0x12'),_0x2ac2f6,_0xbd868['error'][_0x5e48('0x18')]);return _0x406075(_0xbd868[_0x5e48('0x16')][_0x5e48('0x18')]);}logger[_0x5e48('0x16')](_0x5e48('0x12'),_0x2ac2f6,_0xbd868[_0x5e48('0x16')]['message']);return _0x3fd04e(_0xbd868[_0x5e48('0x16')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x2ac2f6,_0x5e48('0x13'));_0x3fd04e(_0xbd868[_0x5e48('0x19')][_0x5e48('0x18')]);}})[_0x5e48('0x1a')](function(_0x479411){logger[_0x5e48('0x16')](_0x5e48('0x12'),_0x2ac2f6,_0x479411);_0x406075(_0x479411);});});}exports[_0x5e48('0x1b')]=function(_0x38cbc5){var _0x7ebb5=this;return new Promise(function(_0x5ac8d5,_0x412089){return db['ChatMessage'][_0x5e48('0x1c')](_0x38cbc5[_0x5e48('0x1d')],{'raw':_0x38cbc5[_0x5e48('0x1e')]?_0x38cbc5[_0x5e48('0x1e')][_0x5e48('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x4e8080){logger[_0x5e48('0x11')](_0x5e48('0x1b'),_0x38cbc5);logger[_0x5e48('0x20')](_0x5e48('0x1b'),_0x38cbc5,JSON[_0x5e48('0x15')](_0x4e8080));_0x5ac8d5(_0x4e8080);})[_0x5e48('0x1a')](function(_0x541208){logger[_0x5e48('0x16')](_0x5e48('0x1b'),_0x541208['message'],_0x38cbc5);_0x412089(_0x7ebb5['error'](0x1f4,_0x541208[_0x5e48('0x18')]));});});}; \ No newline at end of file +var _0xc6ac=['ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','CreateChatMessage','create','options','raw','stringify','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','debug'];(function(_0x5c6de0,_0x5ab8d4){var _0x332182=function(_0x368ad2){while(--_0x368ad2){_0x5c6de0['push'](_0x5c6de0['shift']());}};_0x332182(++_0x5ab8d4);}(_0xc6ac,0xb3));var _0xcc6a=function(_0x38bf29,_0x3eb867){_0x38bf29=_0x38bf29-0x0;var _0x547480=_0xc6ac[_0x38bf29];return _0x547480;};'use strict';var _=require(_0xcc6a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc6a('0x1'));var fs=require('fs');var Redis=require(_0xcc6a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc6a('0x3'));var logger=require('../../config/logger')(_0xcc6a('0x4'));var config=require(_0xcc6a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xcc6a('0x6')][_0xcc6a('0x7')]({'port':0x232a});config['redis']=_[_0xcc6a('0x8')](config[_0xcc6a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xcc6a('0xa'))(new Redis(config[_0xcc6a('0x9')]));require(_0xcc6a('0xb'))[_0xcc6a('0xc')](socket);function respondWithRpcPromise(_0x2f4f82,_0x3b2035,_0x565017){return new BPromise(function(_0x4920cd,_0x56f5b7){return client[_0xcc6a('0xd')](_0x2f4f82,_0x565017)[_0xcc6a('0xe')](function(_0x16230b){logger['info'](_0xcc6a('0xf'),_0x3b2035,'request\x20sent');logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3b2035,_0xcc6a('0x12'),JSON['stringify'](_0x16230b));if(_0x16230b[_0xcc6a('0x13')]){if(_0x16230b[_0xcc6a('0x13')]['code']===0x1f4){logger[_0xcc6a('0x13')](_0xcc6a('0xf'),_0x3b2035,_0x16230b['error'][_0xcc6a('0x14')]);return _0x56f5b7(_0x16230b[_0xcc6a('0x13')][_0xcc6a('0x14')]);}logger['error'](_0xcc6a('0xf'),_0x3b2035,_0x16230b[_0xcc6a('0x13')]['message']);return _0x4920cd(_0x16230b[_0xcc6a('0x13')]['message']);}else{logger[_0xcc6a('0x15')]('ChatMessage,\x20%s,\x20%s',_0x3b2035,_0xcc6a('0x12'));_0x4920cd(_0x16230b['result'][_0xcc6a('0x14')]);}})[_0xcc6a('0x16')](function(_0x25fb64){logger[_0xcc6a('0x13')](_0xcc6a('0xf'),_0x3b2035,_0x25fb64);_0x56f5b7(_0x25fb64);});});}exports[_0xcc6a('0x17')]=function(_0x440d05){var _0x4d1848=this;return new Promise(function(_0x33356e,_0x22b551){return db['ChatMessage'][_0xcc6a('0x18')](_0x440d05['body'],{'raw':_0x440d05[_0xcc6a('0x19')]?_0x440d05[_0xcc6a('0x19')][_0xcc6a('0x1a')]===undefined?!![]:![]:!![]})[_0xcc6a('0xe')](function(_0x4d461b){logger[_0xcc6a('0x15')](_0xcc6a('0x17'),_0x440d05);logger[_0xcc6a('0x10')]('CreateChatMessage',_0x440d05,JSON[_0xcc6a('0x1b')](_0x4d461b));_0x33356e(_0x4d461b);})[_0xcc6a('0x16')](function(_0x1225a8){logger[_0xcc6a('0x13')](_0xcc6a('0x17'),_0x1225a8[_0xcc6a('0x14')],_0x440d05);_0x22b551(_0x4d1848[_0xcc6a('0x13')](0x1f4,_0x1225a8[_0xcc6a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e063a43..9b5d5c4 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 _0x102b=['length','chatMessage:','save','update','emit','removeListener'];(function(_0x45b9c6,_0xa7acf9){var _0x214665=function(_0x3c9701){while(--_0x3c9701){_0x45b9c6['push'](_0x45b9c6['shift']());}};_0x214665(++_0xa7acf9);}(_0x102b,0x1be));var _0xb102=function(_0x1b6165,_0x2a6401){_0x1b6165=_0x1b6165-0x0;var _0x23fce1=_0x102b[_0x1b6165];return _0x23fce1;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xb102('0x0'),'remove',_0xb102('0x1')];function createListener(_0x3e1311,_0x42172c){return function(_0x1be904){_0x42172c[_0xb102('0x2')](_0x3e1311,_0x1be904);};}function removeListener(_0x1402fb,_0x19e35d){return function(){ChatMessageEvents[_0xb102('0x3')](_0x1402fb,_0x19e35d);};}exports['register']=function(_0x3325b7){for(var _0x370baa=0x0,_0xd131eb=events[_0xb102('0x4')];_0x370baa<_0xd131eb;_0x370baa++){var _0x1ee0c0=events[_0x370baa];var _0x5879bb=createListener(_0xb102('0x5')+_0x1ee0c0,_0x3325b7);ChatMessageEvents['on'](_0x1ee0c0,_0x5879bb);}}; \ No newline at end of file +var _0xcea5=['save','remove','update','emit','register','chatMessage:','./chatMessage.events'];(function(_0x1d77b4,_0x53f449){var _0x57fbd8=function(_0x553fac){while(--_0x553fac){_0x1d77b4['push'](_0x1d77b4['shift']());}};_0x57fbd8(++_0x53f449);}(_0xcea5,0xed));var _0x5cea=function(_0x211703,_0x3060bd){_0x211703=_0x211703-0x0;var _0x405be6=_0xcea5[_0x211703];return _0x405be6;};'use strict';var ChatMessageEvents=require(_0x5cea('0x0'));var events=[_0x5cea('0x1'),_0x5cea('0x2'),_0x5cea('0x3')];function createListener(_0x2c6970,_0x52a9b8){return function(_0x20a2d9){_0x52a9b8[_0x5cea('0x4')](_0x2c6970,_0x20a2d9);};}function removeListener(_0x382c21,_0x319dba){return function(){ChatMessageEvents['removeListener'](_0x382c21,_0x319dba);};}exports[_0x5cea('0x5')]=function(_0x31e6f3){for(var _0x599bc5=0x0,_0x49db13=events['length'];_0x599bc5<_0x49db13;_0x599bc5++){var _0x502d95=events[_0x599bc5];var _0x3b6fbc=createListener(_0x5cea('0x6')+_0x502d95,_0x31e6f3);ChatMessageEvents['on'](_0x502d95,_0x3b6fbc);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 75b7252..c3a074f 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 _0x9711=['post','tracked','chat','put','update','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x5275b8,_0x51e5dd){var _0x568a9b=function(_0x583a71){while(--_0x583a71){_0x5275b8['push'](_0x5275b8['shift']());}};_0x568a9b(++_0x51e5dd);}(_0x9711,0x135));var _0x1971=function(_0x3b09f8,_0x18e503){_0x3b09f8=_0x3b09f8-0x0;var _0x5ccbe0=_0x9711[_0x3b09f8];return _0x5ccbe0;};'use strict';var multer=require(_0x1971('0x0'));var util=require('util');var path=require(_0x1971('0x1'));var timeout=require(_0x1971('0x2'));var express=require(_0x1971('0x3'));var router=express[_0x1971('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1971('0x5'));var interaction=require(_0x1971('0x6'));var config=require('../../config/environment');var controller=require(_0x1971('0x7'));router[_0x1971('0x8')]('/',auth[_0x1971('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x1971('0xa')]);router[_0x1971('0x8')](_0x1971('0xb'),auth[_0x1971('0x9')](),controller[_0x1971('0xc')]);router[_0x1971('0xd')]('/',auth[_0x1971('0x9')](),interaction[_0x1971('0xe')](_0x1971('0xf'),'chatmessage:create'),controller['create']);router[_0x1971('0x10')](_0x1971('0xb'),controller[_0x1971('0x11')]);router[_0x1971('0x10')]('/:id/accept',auth[_0x1971('0x9')](),controller[_0x1971('0x12')]);router[_0x1971('0x10')](_0x1971('0x13'),auth[_0x1971('0x9')](),controller[_0x1971('0x14')]);router[_0x1971('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1971('0x16')]=router; \ No newline at end of file +var _0xfab7=['create','put','update','accept','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create'];(function(_0x1bb145,_0x533b57){var _0x5a0b5c=function(_0x55613e){while(--_0x55613e){_0x1bb145['push'](_0x1bb145['shift']());}};_0x5a0b5c(++_0x533b57);}(_0xfab7,0x14c));var _0x7fab=function(_0x5e901f,_0x29ca09){_0x5e901f=_0x5e901f-0x0;var _0x30bb1b=_0xfab7[_0x5e901f];return _0x30bb1b;};'use strict';var multer=require(_0x7fab('0x0'));var util=require('util');var path=require(_0x7fab('0x1'));var timeout=require(_0x7fab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7fab('0x3'));var auth=require(_0x7fab('0x4'));var interaction=require(_0x7fab('0x5'));var config=require(_0x7fab('0x6'));var controller=require(_0x7fab('0x7'));router['get']('/',auth[_0x7fab('0x8')](),controller[_0x7fab('0x9')]);router[_0x7fab('0xa')](_0x7fab('0xb'),auth[_0x7fab('0x8')](),controller[_0x7fab('0xc')]);router['get'](_0x7fab('0xd'),auth['isAuthenticated'](),controller[_0x7fab('0xe')]);router[_0x7fab('0xf')]('/',auth[_0x7fab('0x8')](),interaction[_0x7fab('0x10')](_0x7fab('0x11'),_0x7fab('0x12')),controller[_0x7fab('0x13')]);router[_0x7fab('0x14')](_0x7fab('0xd'),controller[_0x7fab('0x15')]);router['put']('/:id/accept',auth[_0x7fab('0x8')](),controller[_0x7fab('0x16')]);router['put'](_0x7fab('0x17'),auth[_0x7fab('0x8')](),controller[_0x7fab('0x18')]);router[_0x7fab('0x19')](_0x7fab('0xd'),auth[_0x7fab('0x8')](),controller[_0x7fab('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index e0dfbb8..77e6d53 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 _0xadb5=['medium','TEXT','exports'];(function(_0x556bed,_0x2be59e){var _0x23787d=function(_0x5655cc){while(--_0x5655cc){_0x556bed['push'](_0x556bed['shift']());}};_0x23787d(++_0x2be59e);}(_0xadb5,0xad));var _0x5adb=function(_0x57a364,_0x1ca64){_0x57a364=_0x57a364-0x0;var _0x359c20=_0xadb5[_0x57a364];return _0x359c20;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x56b368,_0x51d063){var _0x29c7e0=function(_0x3ad95c){while(--_0x3ad95c){_0x56b368['push'](_0x56b368['shift']());}};_0x29c7e0(++_0x51d063);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index fe2d2e1..75a9546 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 _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x7a54,0x106));var _0x47a5=function(_0x283e91,_0x1889d0){_0x283e91=_0x283e91-0x0;var _0x22f43c=_0x7a54[_0x283e91];return _0x22f43c;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x7a54,0x106));var _0x47a5=function(_0x435707,_0x3e180a){_0x435707=_0x435707-0x0;var _0x21ab30=_0x7a54[_0x435707];return _0x21ab30;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index c1c02af..48d09e1 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4677=['exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xf8d86a,_0x4c5b98){var _0x2a3775=function(_0x2d36cc){while(--_0x2d36cc){_0xf8d86a['push'](_0xf8d86a['shift']());}};_0x2a3775(++_0x4c5b98);}(_0x4677,0x105));var _0x7467=function(_0x21017d,_0x49513c){_0x21017d=_0x21017d-0x0;var _0x5c66d2=_0x4677[_0x21017d];return _0x5c66d2;};'use strict';var EventEmitter=require(_0x7467('0x0'));var ChatOfflineMessage=require(_0x7467('0x1'))['db'][_0x7467('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x7467('0x3')](0x0);var events={'afterCreate':_0x7467('0x4'),'afterUpdate':_0x7467('0x5'),'afterDestroy':_0x7467('0x6')};function emitEvent(_0x12d8c6){return function(_0x242012,_0x344a0e,_0x29a3b7){ChatOfflineMessageEvents[_0x7467('0x7')](_0x12d8c6+':'+_0x242012['id'],_0x242012);ChatOfflineMessageEvents[_0x7467('0x7')](_0x12d8c6,_0x242012);_0x29a3b7(null);};}for(var e in events){if(events[_0x7467('0x8')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x7467('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x4b36=['update','remove','emit','hasOwnProperty','exports','events','ChatOfflineMessage','setMaxListeners','save'];(function(_0x7d80c1,_0x20b039){var _0x20a123=function(_0x3a63fb){while(--_0x3a63fb){_0x7d80c1['push'](_0x7d80c1['shift']());}};_0x20a123(++_0x20b039);}(_0x4b36,0xcb));var _0x64b3=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x4b36[_0x1ccdf7];return _0x52a0ae;};'use strict';var EventEmitter=require(_0x64b3('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x64b3('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x64b3('0x2')](0x0);var events={'afterCreate':_0x64b3('0x3'),'afterUpdate':_0x64b3('0x4'),'afterDestroy':_0x64b3('0x5')};function emitEvent(_0x2381bf){return function(_0xf24537,_0x35462d,_0x54d190){ChatOfflineMessageEvents[_0x64b3('0x6')](_0x2381bf+':'+_0xf24537['id'],_0xf24537);ChatOfflineMessageEvents[_0x64b3('0x6')](_0x2381bf,_0xf24537);_0x54d190(null);};}for(var e in events){if(events[_0x64b3('0x7')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x64b3('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 3ab87fe..2c5ea3e 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 _0x2777=['ChatOfflineMessage','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2777,0x1cf));var _0x7277=function(_0x5a5391,_0x45acbf){_0x5a5391=_0x5a5391-0x0;var _0x59966c=_0x2777[_0x5a5391];return _0x59966c;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x7277('0x0')]=function(_0x6957f4){return _0x6957f4[_0x7277('0x1')](_0x7277('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd45e=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define'];(function(_0x47f370,_0xe59903){var _0x4eb63e=function(_0x3ea81e){while(--_0x3ea81e){_0x47f370['push'](_0x47f370['shift']());}};_0x4eb63e(++_0xe59903);}(_0xd45e,0xd6));var _0xed45=function(_0xa78994,_0x4a568d){_0xa78994=_0xa78994-0x0;var _0x3a14a7=_0xd45e[_0xa78994];return _0x3a14a7;};'use strict';var attributes=require(_0xed45('0x0'));module[_0xed45('0x1')]=function(_0x1a9696){return _0x1a9696[_0xed45('0x2')](_0xed45('0x3'),attributes,{'tableName':_0xed45('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xed45('0x5'),'collate':_0xed45('0x6')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 2fbc9d5..613d3df 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 _0xdfea=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x169045,_0x36511c){var _0x5a78ef=function(_0x21ccd0){while(--_0x21ccd0){_0x169045['push'](_0x169045['shift']());}};_0x5a78ef(++_0x36511c);}(_0xdfea,0x1cd));var _0xadfe=function(_0x57ffe6,_0xee95cc){_0x57ffe6=_0x57ffe6-0x0;var _0x59698f=_0xdfea[_0x57ffe6];return _0x59698f;};'use strict';var _=require(_0xadfe('0x0'));var util=require(_0xadfe('0x1'));var moment=require('moment');var BPromise=require(_0xadfe('0x2'));var rs=require(_0xadfe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadfe('0x4'))['db'];var utils=require(_0xadfe('0x5'));var logger=require(_0xadfe('0x6'))(_0xadfe('0x7'));var config=require('../../config/environment');var jayson=require(_0xadfe('0x8'));var client=jayson['client'][_0xadfe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15d3b1,_0x253e70,_0x238db5){return new BPromise(function(_0x4ba44f,_0x2bdbf0){return client['request'](_0x15d3b1,_0x238db5)[_0xadfe('0xa')](function(_0x1863e1){logger[_0xadfe('0xb')](_0xadfe('0xc'),_0x253e70,'request\x20sent');logger[_0xadfe('0xd')](_0xadfe('0xe'),_0x253e70,_0xadfe('0xf'),JSON[_0xadfe('0x10')](_0x1863e1));if(_0x1863e1[_0xadfe('0x11')]){if(_0x1863e1['error'][_0xadfe('0x12')]===0x1f4){logger['error'](_0xadfe('0xc'),_0x253e70,_0x1863e1[_0xadfe('0x11')][_0xadfe('0x13')]);return _0x2bdbf0(_0x1863e1[_0xadfe('0x11')][_0xadfe('0x13')]);}logger[_0xadfe('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x253e70,_0x1863e1[_0xadfe('0x11')][_0xadfe('0x13')]);return _0x4ba44f(_0x1863e1['error'][_0xadfe('0x13')]);}else{logger[_0xadfe('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x253e70,'request\x20sent');_0x4ba44f(_0x1863e1[_0xadfe('0x14')][_0xadfe('0x13')]);}})[_0xadfe('0x15')](function(_0x1fa58f){logger[_0xadfe('0x11')](_0xadfe('0xc'),_0x253e70,_0x1fa58f);_0x2bdbf0(_0x1fa58f);});});} \ No newline at end of file +var _0xc777=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x40643a,_0x12ba82){var _0x53ea1b=function(_0x3cbb17){while(--_0x3cbb17){_0x40643a['push'](_0x40643a['shift']());}};_0x53ea1b(++_0x12ba82);}(_0xc777,0x1b7));var _0x7c77=function(_0x343b00,_0x1525ed){_0x343b00=_0x343b00-0x0;var _0x3f73eb=_0xc777[_0x343b00];return _0x3f73eb;};'use strict';var _=require(_0x7c77('0x0'));var util=require(_0x7c77('0x1'));var moment=require('moment');var BPromise=require(_0x7c77('0x2'));var rs=require(_0x7c77('0x3'));var fs=require('fs');var Redis=require(_0x7c77('0x4'));var db=require(_0x7c77('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c77('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c77('0x7'));var client=jayson[_0x7c77('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x392218,_0x27c6ce,_0x32adc2){return new BPromise(function(_0x5a6e0e,_0x21a24e){return client['request'](_0x392218,_0x32adc2)[_0x7c77('0x9')](function(_0x224f4c){logger[_0x7c77('0xa')](_0x7c77('0xb'),_0x27c6ce,_0x7c77('0xc'));logger[_0x7c77('0xd')](_0x7c77('0xe'),_0x27c6ce,_0x7c77('0xc'),JSON['stringify'](_0x224f4c));if(_0x224f4c[_0x7c77('0xf')]){if(_0x224f4c['error'][_0x7c77('0x10')]===0x1f4){logger[_0x7c77('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x27c6ce,_0x224f4c[_0x7c77('0xf')][_0x7c77('0x11')]);return _0x21a24e(_0x224f4c[_0x7c77('0xf')]['message']);}logger[_0x7c77('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x27c6ce,_0x224f4c['error']['message']);return _0x5a6e0e(_0x224f4c[_0x7c77('0xf')][_0x7c77('0x11')]);}else{logger['info'](_0x7c77('0xb'),_0x27c6ce,_0x7c77('0xc'));_0x5a6e0e(_0x224f4c[_0x7c77('0x12')][_0x7c77('0x11')]);}})[_0x7c77('0x13')](function(_0x1d83bd){logger[_0x7c77('0xf')](_0x7c77('0xb'),_0x27c6ce,_0x1d83bd);_0x21a24e(_0x1d83bd);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 484604c..ad9e65b 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 _0x8e0d=['index','/describe','describe','/:id','show','post','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated'];(function(_0x30d6da,_0x2d3b39){var _0x175667=function(_0x5ab094){while(--_0x5ab094){_0x30d6da['push'](_0x30d6da['shift']());}};_0x175667(++_0x2d3b39);}(_0x8e0d,0x9c));var _0xd8e0=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x8e0d[_0xdc37a1];return _0x99b4fe;};'use strict';var multer=require(_0xd8e0('0x0'));var util=require(_0xd8e0('0x1'));var path=require(_0xd8e0('0x2'));var timeout=require('connect-timeout');var express=require(_0xd8e0('0x3'));var router=express[_0xd8e0('0x4')]();var fs_extra=require(_0xd8e0('0x5'));var auth=require(_0xd8e0('0x6'));var interaction=require(_0xd8e0('0x7'));var config=require(_0xd8e0('0x8'));var controller=require(_0xd8e0('0x9'));router[_0xd8e0('0xa')]('/',auth[_0xd8e0('0xb')](),controller[_0xd8e0('0xc')]);router[_0xd8e0('0xa')](_0xd8e0('0xd'),auth['isAuthenticated'](),controller[_0xd8e0('0xe')]);router[_0xd8e0('0xa')](_0xd8e0('0xf'),auth['isAuthenticated'](),controller[_0xd8e0('0x10')]);router[_0xd8e0('0x11')]('/',auth[_0xd8e0('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xd8e0('0x12')]);router['delete'](_0xd8e0('0xf'),auth['isAuthenticated'](),controller[_0xd8e0('0x13')]);module[_0xd8e0('0x14')]=router; \ No newline at end of file +var _0xf9e7=['/describe','describe','/:id','post','put','update','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index'];(function(_0x12aba8,_0x40a036){var _0x2aac66=function(_0x3e56b7){while(--_0x3e56b7){_0x12aba8['push'](_0x12aba8['shift']());}};_0x2aac66(++_0x40a036);}(_0xf9e7,0x196));var _0x7f9e=function(_0x1bd822,_0x1c8078){_0x1bd822=_0x1bd822-0x0;var _0x3c3a69=_0xf9e7[_0x1bd822];return _0x3c3a69;};'use strict';var multer=require(_0x7f9e('0x0'));var util=require('util');var path=require(_0x7f9e('0x1'));var timeout=require(_0x7f9e('0x2'));var express=require(_0x7f9e('0x3'));var router=express['Router']();var fs_extra=require(_0x7f9e('0x4'));var auth=require(_0x7f9e('0x5'));var interaction=require(_0x7f9e('0x6'));var config=require(_0x7f9e('0x7'));var controller=require(_0x7f9e('0x8'));router[_0x7f9e('0x9')]('/',auth[_0x7f9e('0xa')](),controller[_0x7f9e('0xb')]);router[_0x7f9e('0x9')](_0x7f9e('0xc'),auth[_0x7f9e('0xa')](),controller[_0x7f9e('0xd')]);router['get'](_0x7f9e('0xe'),auth[_0x7f9e('0xa')](),controller['show']);router[_0x7f9e('0xf')]('/',auth[_0x7f9e('0xa')](),controller['create']);router[_0x7f9e('0x10')](_0x7f9e('0xe'),auth['isAuthenticated'](),controller[_0x7f9e('0x11')]);router['delete'](_0x7f9e('0xe'),auth[_0x7f9e('0xa')](),controller[_0x7f9e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index ed48de4..679450b 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 _0x1bc0=['mouseOver','INTEGER','sequelize','exports','STRING','ENUM','timeout'];(function(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0x1bc0,0x11a));var _0x01bc=function(_0x24ae3f,_0x1d0ba2){_0x24ae3f=_0x24ae3f-0x0;var _0x944aeb=_0x1bc0[_0x24ae3f];return _0x944aeb;};'use strict';var Sequelize=require(_0x01bc('0x0'));module[_0x01bc('0x1')]={'name':{'type':Sequelize[_0x01bc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x01bc('0x3')]('mouseOver',_0x01bc('0x4')),'defaultValue':_0x01bc('0x5')},'selector':{'type':Sequelize[_0x01bc('0x2')]},'timeout':{'type':Sequelize[_0x01bc('0x6')]}}; \ No newline at end of file +var _0xe0af=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0xe0af,0x8d));var _0xfe0a=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0xe0af[_0xfedc72];return _0x2c7c78;};'use strict';var Sequelize=require(_0xfe0a('0x0'));module[_0xfe0a('0x1')]={'name':{'type':Sequelize[_0xfe0a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xfe0a('0x3')](_0xfe0a('0x4'),_0xfe0a('0x5')),'defaultValue':_0xfe0a('0x4')},'selector':{'type':Sequelize[_0xfe0a('0x2')]},'timeout':{'type':Sequelize[_0xfe0a('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 6649257..bcd3035 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 _0xac0a=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','send','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','include','merge','options','find','catch','create','body','params','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x319fd8,_0x535e92){var _0x65cfd=function(_0x4ea40e){while(--_0x4ea40e){_0x319fd8['push'](_0x319fd8['shift']());}};_0x65cfd(++_0x535e92);}(_0xac0a,0x11e));var _0xaac0=function(_0x28ba9e,_0x1e8204){_0x28ba9e=_0x28ba9e-0x0;var _0x18c3cb=_0xac0a[_0x28ba9e];return _0x18c3cb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaac0('0x0'));var jsonpatch=require(_0xaac0('0x1'));var rp=require('request-promise');var moment=require(_0xaac0('0x2'));var BPromise=require(_0xaac0('0x3'));var Mustache=require(_0xaac0('0x4'));var util=require(_0xaac0('0x5'));var path=require(_0xaac0('0x6'));var sox=require(_0xaac0('0x7'));var csv=require(_0xaac0('0x8'));var ejs=require(_0xaac0('0x9'));var fs=require('fs');var fs_extra=require(_0xaac0('0xa'));var _=require(_0xaac0('0xb'));var squel=require(_0xaac0('0xc'));var crypto=require(_0xaac0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaac0('0xe'));var toCsv=require(_0xaac0('0x8'));var querystring=require('querystring');var Papa=require(_0xaac0('0xf'));var Redis=require(_0xaac0('0x10'));var authService=require(_0xaac0('0x11'));var qs=require(_0xaac0('0x12'));var as=require(_0xaac0('0x13'));var hardwareService=require(_0xaac0('0x14'));var logger=require(_0xaac0('0x15'))(_0xaac0('0x16'));var utils=require(_0xaac0('0x17'));var config=require(_0xaac0('0x18'));var licenseUtil=require(_0xaac0('0x19'));var db=require(_0xaac0('0x1a'))['db'];function respondWithStatusCode(_0x418abc,_0x2d19b8){_0x2d19b8=_0x2d19b8||0xcc;return function(_0x1a28a8){if(_0x1a28a8){return _0x418abc[_0xaac0('0x1b')](_0x2d19b8);}return _0x418abc[_0xaac0('0x1c')](_0x2d19b8)[_0xaac0('0x1d')]();};}function respondWithResult(_0x41a054,_0x259ce3){_0x259ce3=_0x259ce3||0xc8;return function(_0x8f2200){if(_0x8f2200){return _0x41a054[_0xaac0('0x1c')](_0x259ce3)[_0xaac0('0x1e')](_0x8f2200);}};}function respondWithFilteredResult(_0x3bbf93,_0x186cc1){return function(_0x3182fe){if(_0x3182fe){var _0x259d9f=typeof _0x186cc1['offset']===_0xaac0('0x1f')&&typeof _0x186cc1['limit']==='undefined';var _0x1ec445=_0x3182fe[_0xaac0('0x20')];var _0x4a7b58=_0x259d9f?0x0:_0x186cc1[_0xaac0('0x21')];var _0x3cdc8f=_0x259d9f?_0x3182fe['count']:_0x186cc1[_0xaac0('0x21')]+_0x186cc1[_0xaac0('0x22')];var _0x57cdd5;if(_0x3cdc8f>=_0x1ec445){_0x3cdc8f=_0x1ec445;_0x57cdd5=0xc8;}else{_0x57cdd5=0xce;}_0x3bbf93[_0xaac0('0x1c')](_0x57cdd5);return _0x3bbf93[_0xaac0('0x23')](_0xaac0('0x24'),_0x4a7b58+'-'+_0x3cdc8f+'/'+_0x1ec445)['json'](_0x3182fe);}return null;};}function patchUpdates(_0x58f4ba){return function(_0x3dcbe9){try{jsonpatch[_0xaac0('0x25')](_0x3dcbe9,_0x58f4ba,!![]);}catch(_0x4f6947){return BPromise['reject'](_0x4f6947);}return _0x3dcbe9[_0xaac0('0x26')]();};}function saveUpdates(_0x20a65e,_0x5aefda){return function(_0x222baa){if(_0x222baa){return _0x222baa[_0xaac0('0x27')](_0x20a65e)[_0xaac0('0x28')](function(_0x4aa2cc){return _0x4aa2cc;});}return null;};}function removeEntity(_0x430517,_0x206fb4){return function(_0x2269fd){if(_0x2269fd){return _0x2269fd[_0xaac0('0x29')]()[_0xaac0('0x28')](function(){_0x430517[_0xaac0('0x1c')](0xcc)[_0xaac0('0x1d')]();});}};}function handleEntityNotFound(_0x50106e,_0xa05ba7){return function(_0x37fa18){if(!_0x37fa18){_0x50106e[_0xaac0('0x1b')](0x194);}return _0x37fa18;};}function handleError(_0x3a0dc0,_0x48a8b4){_0x48a8b4=_0x48a8b4||0x1f4;return function(_0x2f626f){logger[_0xaac0('0x2a')](_0x2f626f[_0xaac0('0x2b')]);if(_0x2f626f['name']){delete _0x2f626f['name'];}_0x3a0dc0[_0xaac0('0x1c')](_0x48a8b4)[_0xaac0('0x2c')](_0x2f626f);};}exports['show']=function(_0x5c8563,_0x2bc7b6){var _0x8432d7={'raw':!![],'where':{'id':_0x5c8563['params']['id']}},_0x50aae6={};_0x50aae6[_0xaac0('0x2d')]=_[_0xaac0('0x2e')](db[_0xaac0('0x2f')][_0xaac0('0x30')]);_0x50aae6[_0xaac0('0x31')]=_['keys'](_0x5c8563[_0xaac0('0x31')]);_0x50aae6[_0xaac0('0x32')]=_[_0xaac0('0x33')](_0x50aae6[_0xaac0('0x2d')],_0x50aae6[_0xaac0('0x31')]);_0x8432d7['attributes']=_[_0xaac0('0x33')](_0x50aae6['model'],qs[_0xaac0('0x34')](_0x5c8563[_0xaac0('0x31')]['fields']));_0x8432d7[_0xaac0('0x35')]=_0x8432d7[_0xaac0('0x35')]['length']?_0x8432d7[_0xaac0('0x35')]:_0x50aae6['model'];if(_0x5c8563[_0xaac0('0x31')]['includeAll']){_0x8432d7[_0xaac0('0x36')]=[{'all':!![]}];}_0x8432d7=_[_0xaac0('0x37')]({},_0x8432d7,_0x5c8563[_0xaac0('0x38')]);return db[_0xaac0('0x2f')][_0xaac0('0x39')](_0x8432d7)[_0xaac0('0x28')](handleEntityNotFound(_0x2bc7b6,null))[_0xaac0('0x28')](respondWithResult(_0x2bc7b6,null))[_0xaac0('0x3a')](handleError(_0x2bc7b6,null));};exports[_0xaac0('0x3b')]=function(_0x36a8a8,_0x30a33a){return db['ChatProactiveAction'][_0xaac0('0x3b')](_0x36a8a8[_0xaac0('0x3c')],{})[_0xaac0('0x28')](respondWithResult(_0x30a33a,0xc9))[_0xaac0('0x3a')](handleError(_0x30a33a,null));};exports['update']=function(_0x4f6e4c,_0x5814c8){if(_0x4f6e4c['body']['id']){delete _0x4f6e4c[_0xaac0('0x3c')]['id'];}return db[_0xaac0('0x2f')][_0xaac0('0x39')]({'where':{'id':_0x4f6e4c['params']['id']}})['then'](handleEntityNotFound(_0x5814c8,null))[_0xaac0('0x28')](saveUpdates(_0x4f6e4c[_0xaac0('0x3c')],null))[_0xaac0('0x28')](respondWithResult(_0x5814c8,null))[_0xaac0('0x3a')](handleError(_0x5814c8,null));};exports['destroy']=function(_0x545544,_0x47ab5d){return db[_0xaac0('0x2f')][_0xaac0('0x39')]({'where':{'id':_0x545544[_0xaac0('0x3d')]['id']}})[_0xaac0('0x28')](handleEntityNotFound(_0x47ab5d,null))[_0xaac0('0x28')](removeEntity(_0x47ab5d,null))['catch'](handleError(_0x47ab5d,null));}; \ No newline at end of file +var _0xa87e=['length','includeAll','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','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','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields'];(function(_0x5828f4,_0xc0a643){var _0x4ab242=function(_0x727a6d){while(--_0x727a6d){_0x5828f4['push'](_0x5828f4['shift']());}};_0x4ab242(++_0xc0a643);}(_0xa87e,0x1c2));var _0xea87=function(_0x2cd2bf,_0x327362){_0x2cd2bf=_0x2cd2bf-0x0;var _0x1ffed5=_0xa87e[_0x2cd2bf];return _0x1ffed5;};'use strict';var emlformat=require(_0xea87('0x0'));var rimraf=require(_0xea87('0x1'));var zipdir=require(_0xea87('0x2'));var jsonpatch=require(_0xea87('0x3'));var rp=require('request-promise');var moment=require(_0xea87('0x4'));var BPromise=require(_0xea87('0x5'));var Mustache=require(_0xea87('0x6'));var util=require('util');var path=require(_0xea87('0x7'));var sox=require(_0xea87('0x8'));var csv=require(_0xea87('0x9'));var ejs=require(_0xea87('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea87('0xb'));var squel=require(_0xea87('0xc'));var crypto=require(_0xea87('0xd'));var jsforce=require(_0xea87('0xe'));var deskjs=require(_0xea87('0xf'));var toCsv=require(_0xea87('0x9'));var querystring=require(_0xea87('0x10'));var Papa=require(_0xea87('0x11'));var Redis=require(_0xea87('0x12'));var authService=require(_0xea87('0x13'));var qs=require(_0xea87('0x14'));var as=require(_0xea87('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea87('0x16'))(_0xea87('0x17'));var utils=require(_0xea87('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xea87('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcfefe4,_0x34eab0){_0x34eab0=_0x34eab0||0xcc;return function(_0x15c163){if(_0x15c163){return _0xcfefe4['sendStatus'](_0x34eab0);}return _0xcfefe4[_0xea87('0x1a')](_0x34eab0)[_0xea87('0x1b')]();};}function respondWithResult(_0xe33198,_0x2d1d7c){_0x2d1d7c=_0x2d1d7c||0xc8;return function(_0x2c7787){if(_0x2c7787){return _0xe33198[_0xea87('0x1a')](_0x2d1d7c)[_0xea87('0x1c')](_0x2c7787);}};}function respondWithFilteredResult(_0x488658,_0x2f170f){return function(_0x4f3b7d){if(_0x4f3b7d){var _0x58622e=typeof _0x2f170f['offset']==='undefined'&&typeof _0x2f170f[_0xea87('0x1d')]===_0xea87('0x1e');var _0x25af8f=_0x4f3b7d['count'];var _0x540d7d=_0x58622e?0x0:_0x2f170f['offset'];var _0x1ef58e=_0x58622e?_0x4f3b7d[_0xea87('0x1f')]:_0x2f170f[_0xea87('0x20')]+_0x2f170f[_0xea87('0x1d')];var _0x4b42a1;if(_0x1ef58e>=_0x25af8f){_0x1ef58e=_0x25af8f;_0x4b42a1=0xc8;}else{_0x4b42a1=0xce;}_0x488658[_0xea87('0x1a')](_0x4b42a1);return _0x488658[_0xea87('0x21')](_0xea87('0x22'),_0x540d7d+'-'+_0x1ef58e+'/'+_0x25af8f)['json'](_0x4f3b7d);}return null;};}function patchUpdates(_0x57ee13){return function(_0x1a4096){try{jsonpatch[_0xea87('0x23')](_0x1a4096,_0x57ee13,!![]);}catch(_0x1f449f){return BPromise[_0xea87('0x24')](_0x1f449f);}return _0x1a4096[_0xea87('0x25')]();};}function saveUpdates(_0x41cf0c,_0x2280f8){return function(_0x1f553f){if(_0x1f553f){return _0x1f553f['update'](_0x41cf0c)[_0xea87('0x26')](function(_0x275a7a){return _0x275a7a;});}return null;};}function removeEntity(_0x5a0ea1,_0x233058){return function(_0x452425){if(_0x452425){return _0x452425[_0xea87('0x27')]()[_0xea87('0x26')](function(){_0x5a0ea1['status'](0xcc)[_0xea87('0x1b')]();});}};}function handleEntityNotFound(_0x2d0f03,_0x510a2c){return function(_0xb65c63){if(!_0xb65c63){_0x2d0f03['sendStatus'](0x194);}return _0xb65c63;};}function handleError(_0x4452aa,_0x37f58c){_0x37f58c=_0x37f58c||0x1f4;return function(_0x417847){logger[_0xea87('0x28')](_0x417847[_0xea87('0x29')]);if(_0x417847[_0xea87('0x2a')]){delete _0x417847[_0xea87('0x2a')];}_0x4452aa[_0xea87('0x1a')](_0x37f58c)[_0xea87('0x2b')](_0x417847);};}exports['show']=function(_0x5d2b86,_0x475734){var _0x453bc3={'raw':!![],'where':{'id':_0x5d2b86[_0xea87('0x2c')]['id']}},_0x97db5c={};_0x97db5c[_0xea87('0x2d')]=_[_0xea87('0x2e')](db[_0xea87('0x2f')][_0xea87('0x30')]);_0x97db5c['query']=_['keys'](_0x5d2b86[_0xea87('0x31')]);_0x97db5c[_0xea87('0x32')]=_['intersection'](_0x97db5c[_0xea87('0x2d')],_0x97db5c[_0xea87('0x31')]);_0x453bc3[_0xea87('0x33')]=_[_0xea87('0x34')](_0x97db5c['model'],qs[_0xea87('0x35')](_0x5d2b86[_0xea87('0x31')][_0xea87('0x35')]));_0x453bc3['attributes']=_0x453bc3['attributes'][_0xea87('0x36')]?_0x453bc3[_0xea87('0x33')]:_0x97db5c[_0xea87('0x2d')];if(_0x5d2b86['query'][_0xea87('0x37')]){_0x453bc3[_0xea87('0x38')]=[{'all':!![]}];}_0x453bc3=_[_0xea87('0x39')]({},_0x453bc3,_0x5d2b86[_0xea87('0x3a')]);return db[_0xea87('0x2f')][_0xea87('0x3b')](_0x453bc3)[_0xea87('0x26')](handleEntityNotFound(_0x475734,null))['then'](respondWithResult(_0x475734,null))[_0xea87('0x3c')](handleError(_0x475734,null));};exports[_0xea87('0x3d')]=function(_0x235e2f,_0x1b9daf){return db[_0xea87('0x2f')][_0xea87('0x3d')](_0x235e2f[_0xea87('0x3e')],{})[_0xea87('0x26')](respondWithResult(_0x1b9daf,0xc9))[_0xea87('0x3c')](handleError(_0x1b9daf,null));};exports['update']=function(_0x303f8e,_0x494c53){if(_0x303f8e[_0xea87('0x3e')]['id']){delete _0x303f8e[_0xea87('0x3e')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x303f8e[_0xea87('0x2c')]['id']}})[_0xea87('0x26')](handleEntityNotFound(_0x494c53,null))[_0xea87('0x26')](saveUpdates(_0x303f8e[_0xea87('0x3e')],null))[_0xea87('0x26')](respondWithResult(_0x494c53,null))[_0xea87('0x3c')](handleError(_0x494c53,null));};exports['destroy']=function(_0x583e6c,_0x533869){return db['ChatProactiveAction']['find']({'where':{'id':_0x583e6c['params']['id']}})['then'](handleEntityNotFound(_0x533869,null))[_0xea87('0x26')](removeEntity(_0x533869,null))['catch'](handleError(_0x533869,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 8b58f14..275b86a 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 _0x2aaf=['request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment','bluebird'];(function(_0x171635,_0x1e9d6b){var _0x5bb29f=function(_0x1b5bef){while(--_0x1b5bef){_0x171635['push'](_0x171635['shift']());}};_0x5bb29f(++_0x1e9d6b);}(_0x2aaf,0x18e));var _0xf2aa=function(_0x4c5a9f,_0x184db7){_0x4c5a9f=_0x4c5a9f-0x0;var _0x548f59=_0x2aaf[_0x4c5a9f];return _0x548f59;};'use strict';var _=require(_0xf2aa('0x0'));var util=require(_0xf2aa('0x1'));var logger=require('../../config/logger')(_0xf2aa('0x2'));var moment=require(_0xf2aa('0x3'));var BPromise=require(_0xf2aa('0x4'));var rp=require(_0xf2aa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf2aa('0x6'));var config=require(_0xf2aa('0x7'));var attributes=require(_0xf2aa('0x8'));module[_0xf2aa('0x9')]=function(_0x2938e8,_0x536380){return _0x2938e8[_0xf2aa('0xa')](_0xf2aa('0xb'),attributes,{'tableName':_0xf2aa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6af5=['path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash','util','api','moment'];(function(_0x11d3ae,_0xce4cf3){var _0x33d1fc=function(_0xb3e53c){while(--_0xb3e53c){_0x11d3ae['push'](_0x11d3ae['shift']());}};_0x33d1fc(++_0xce4cf3);}(_0x6af5,0x1ca));var _0x56af=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x6af5[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x56af('0x0'));var util=require(_0x56af('0x1'));var logger=require('../../config/logger')(_0x56af('0x2'));var moment=require(_0x56af('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x56af('0x4'));var rimraf=require(_0x56af('0x5'));var config=require(_0x56af('0x6'));var attributes=require(_0x56af('0x7'));module[_0x56af('0x8')]=function(_0x49428a,_0x1d692b){return _0x49428a[_0x56af('0x9')]('ChatProactiveAction',attributes,{'tableName':_0x56af('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 2ed4d75..fd6e8be 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 _0x8332=['message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','result'];(function(_0x1335cd,_0x5d41b5){var _0x391787=function(_0x11bd94){while(--_0x11bd94){_0x1335cd['push'](_0x1335cd['shift']());}};_0x391787(++_0x5d41b5);}(_0x8332,0x6b));var _0x2833=function(_0x30cffe,_0x5b0a2d){_0x30cffe=_0x30cffe-0x0;var _0x46cf4e=_0x8332[_0x30cffe];return _0x46cf4e;};'use strict';var _=require(_0x2833('0x0'));var util=require('util');var moment=require(_0x2833('0x1'));var BPromise=require(_0x2833('0x2'));var rs=require(_0x2833('0x3'));var fs=require('fs');var Redis=require(_0x2833('0x4'));var db=require(_0x2833('0x5'))['db'];var utils=require(_0x2833('0x6'));var logger=require(_0x2833('0x7'))('rpc');var config=require(_0x2833('0x8'));var jayson=require(_0x2833('0x9'));var client=jayson['client'][_0x2833('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d99b5,_0x1e0c0e,_0x4b7add){return new BPromise(function(_0x324e40,_0x58be64){return client['request'](_0x2d99b5,_0x4b7add)[_0x2833('0xb')](function(_0x4ca852){logger[_0x2833('0xc')](_0x2833('0xd'),_0x1e0c0e,_0x2833('0xe'));logger[_0x2833('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x1e0c0e,_0x2833('0xe'),JSON[_0x2833('0x10')](_0x4ca852));if(_0x4ca852['error']){if(_0x4ca852[_0x2833('0x11')]['code']===0x1f4){logger['error'](_0x2833('0xd'),_0x1e0c0e,_0x4ca852[_0x2833('0x11')]['message']);return _0x58be64(_0x4ca852[_0x2833('0x11')]['message']);}logger[_0x2833('0x11')](_0x2833('0xd'),_0x1e0c0e,_0x4ca852[_0x2833('0x11')]['message']);return _0x324e40(_0x4ca852[_0x2833('0x11')]['message']);}else{logger[_0x2833('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x1e0c0e,_0x2833('0xe'));_0x324e40(_0x4ca852[_0x2833('0x12')][_0x2833('0x13')]);}})[_0x2833('0x14')](function(_0x328cab){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x1e0c0e,_0x328cab);_0x58be64(_0x328cab);});});} \ No newline at end of file +var _0x9904=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x9904,0x1a4));var _0x4990=function(_0x1057cb,_0x7b8162){_0x1057cb=_0x1057cb-0x0;var _0x7fbf7e=_0x9904[_0x1057cb];return _0x7fbf7e;};'use strict';var _=require(_0x4990('0x0'));var util=require('util');var moment=require(_0x4990('0x1'));var BPromise=require('bluebird');var rs=require(_0x4990('0x2'));var fs=require('fs');var Redis=require(_0x4990('0x3'));var db=require(_0x4990('0x4'))['db'];var utils=require(_0x4990('0x5'));var logger=require(_0x4990('0x6'))(_0x4990('0x7'));var config=require('../../config/environment');var jayson=require(_0x4990('0x8'));var client=jayson[_0x4990('0x9')][_0x4990('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a7554,_0x490778,_0x2a2030){return new BPromise(function(_0x5e7967,_0x1d32dd){return client[_0x4990('0xb')](_0x3a7554,_0x2a2030)['then'](function(_0x358469){logger[_0x4990('0xc')](_0x4990('0xd'),_0x490778,_0x4990('0xe'));logger[_0x4990('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x490778,'request\x20sent',JSON[_0x4990('0x10')](_0x358469));if(_0x358469[_0x4990('0x11')]){if(_0x358469[_0x4990('0x11')]['code']===0x1f4){logger[_0x4990('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x490778,_0x358469[_0x4990('0x11')][_0x4990('0x12')]);return _0x1d32dd(_0x358469[_0x4990('0x11')][_0x4990('0x12')]);}logger[_0x4990('0x11')](_0x4990('0xd'),_0x490778,_0x358469[_0x4990('0x11')][_0x4990('0x12')]);return _0x5e7967(_0x358469['error'][_0x4990('0x12')]);}else{logger['info'](_0x4990('0xd'),_0x490778,_0x4990('0xe'));_0x5e7967(_0x358469['result']['message']);}})[_0x4990('0x13')](function(_0x1c2b47){logger['error'](_0x4990('0xd'),_0x490778,_0x1c2b47);_0x1d32dd(_0x1c2b47);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index a585c27..8491635 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 _0x2bd8=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','exports'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x2bd8,0x130));var _0x82bd=function(_0x8c4603,_0x2c0c2c){_0x8c4603=_0x8c4603-0x0;var _0x3cf1f9=_0x2bd8[_0x8c4603];return _0x3cf1f9;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')](_0x82bd('0xa'),auth['isAuthenticated'](),controller[_0x82bd('0xb')]);router[_0x82bd('0xc')]('/',auth[_0x82bd('0xd')](),controller[_0x82bd('0xe')]);router['put'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x82bd('0xf')]=router; \ No newline at end of file +var _0x032e=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x27c1cc,_0x18cee7){var _0x4ee271=function(_0x391308){while(--_0x391308){_0x27c1cc['push'](_0x27c1cc['shift']());}};_0x4ee271(++_0x18cee7);}(_0x032e,0x124));var _0xe032=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x032e[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')]('/',auth[_0xe032('0xa')](),controller[_0xe032('0xd')]);router[_0xe032('0xe')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xf')]);router[_0xe032('0x10')](_0xe032('0x9'),auth['isAuthenticated'](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 803f229..86fcb9b 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 _0xaca4=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x3ec9cc,_0x7659b0){var _0x215f11=function(_0x370554){while(--_0x370554){_0x3ec9cc['push'](_0x3ec9cc['shift']());}};_0x215f11(++_0x7659b0);}(_0xaca4,0x179));var _0x4aca=function(_0x2b6876,_0x193ced){_0x2b6876=_0x2b6876-0x0;var _0x5e613e=_0xaca4[_0x2b6876];return _0x5e613e;};'use strict';var Sequelize=require(_0x4aca('0x0'));module[_0x4aca('0x1')]={'name':{'type':Sequelize[_0x4aca('0x2')],'unique':_0x4aca('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4aca('0x2')]},'timeout':{'type':Sequelize[_0x4aca('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4aca('0x5')](_0x4aca('0x6'),_0x4aca('0x7'),_0x4aca('0x8'))}}; \ No newline at end of file +var _0x05c1=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x3ce0d2,_0x245c50){var _0x5322a0=function(_0x17ba88){while(--_0x17ba88){_0x3ce0d2['push'](_0x3ce0d2['shift']());}};_0x5322a0(++_0x245c50);}(_0x05c1,0xed));var _0x105c=function(_0x3c5735,_0x1f4f53){_0x3c5735=_0x3c5735-0x0;var _0x2cd61d=_0x05c1[_0x3c5735];return _0x2cd61d;};'use strict';var Sequelize=require(_0x105c('0x0'));module[_0x105c('0x1')]={'name':{'type':Sequelize[_0x105c('0x2')],'unique':_0x105c('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x105c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x105c('0x5')](_0x105c('0x6'),_0x105c('0x7'),_0x105c('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 0bcfe76..1f4ec87 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 _0x96ae=['../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','status','offset','undefined','count','limit','set','json','update','then','destroy','get','ChatQueues','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','query','findAll','show','params','ChatQueue','keys','model','intersection','fields','attributes','includeAll','include','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','describe','getMembers','findOne','UserChatQueue','filters','length','hasOwnProperty','order','sort','ChatQueueId','filter','merge','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','pick','nolimit','Team','Agents','online','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','ioredis'];(function(_0x555d1e,_0x4bcfdb){var _0x3aee29=function(_0x3a5311){while(--_0x3a5311){_0x555d1e['push'](_0x555d1e['shift']());}};_0x3aee29(++_0x4bcfdb);}(_0x96ae,0xfc));var _0xe96a=function(_0x1e2f72,_0x4ecd3d){_0x1e2f72=_0x1e2f72-0x0;var _0x2f00a8=_0x96ae[_0x1e2f72];return _0x2f00a8;};'use strict';var BPromise=require('bluebird');var util=require(_0xe96a('0x0'));var _=require(_0xe96a('0x1'));var squel=require(_0xe96a('0x2'));var Redis=require(_0xe96a('0x3'));var qs=require(_0xe96a('0x4'));var logger=require(_0xe96a('0x5'))(_0xe96a('0x6'));var config=require(_0xe96a('0x7'));var db=require(_0xe96a('0x8'))['db'];config[_0xe96a('0x9')]=_[_0xe96a('0xa')](config['redis'],{'host':_0xe96a('0xb'),'port':0x18eb});var socket=require(_0xe96a('0xc'))(new Redis(config[_0xe96a('0x9')]));require(_0xe96a('0xd'))[_0xe96a('0xe')](socket);function respondWithStatusCode(_0x5b5f3d,_0x2d57ae){_0x2d57ae=_0x2d57ae||0xcc;return function(_0x408d26){if(_0x408d26){return _0x5b5f3d['sendStatus'](_0x2d57ae);}return _0x5b5f3d[_0xe96a('0xf')](_0x2d57ae)['end']();};}function respondWithResult(_0x323567,_0x4bae6c){_0x4bae6c=_0x4bae6c||0xc8;return function(_0x53e3a1){if(_0x53e3a1){return _0x323567['status'](_0x4bae6c)['json'](_0x53e3a1);}};}function respondWithFilteredResult(_0xf32694,_0x3dd7aa){return function(_0x74b282){if(_0x74b282){var _0x4f10a0=typeof _0x3dd7aa[_0xe96a('0x10')]===_0xe96a('0x11')&&typeof _0x3dd7aa['limit']===_0xe96a('0x11');var _0x41bc1d=_0x74b282[_0xe96a('0x12')];var _0x210224=_0x4f10a0?0x0:_0x3dd7aa[_0xe96a('0x10')];var _0x427237=_0x4f10a0?_0x74b282[_0xe96a('0x12')]:_0x3dd7aa[_0xe96a('0x10')]+_0x3dd7aa[_0xe96a('0x13')];var _0x4552ca;if(_0x427237>=_0x41bc1d){_0x427237=_0x41bc1d;_0x4552ca=0xc8;}else{_0x4552ca=0xce;}_0xf32694['status'](_0x4552ca);return _0xf32694[_0xe96a('0x14')]('Content-Range',_0x210224+'-'+_0x427237+'/'+_0x41bc1d)[_0xe96a('0x15')](_0x74b282);}return null;};}function saveUpdates(_0x1fd976){return function(_0xe5ab2c){if(_0xe5ab2c){return _0xe5ab2c[_0xe96a('0x16')](_0x1fd976)[_0xe96a('0x17')](function(_0x136c76){return _0x136c76;});}return null;};}function removeEntity(_0x5d7005){return function(_0x18fb44){if(_0x18fb44){return _0x18fb44[_0xe96a('0x18')]()[_0xe96a('0x17')](function(){var _0x338b60=_0x18fb44[_0xe96a('0x19')]({'plain':!![]});var _0x19e67c=_0xe96a('0x1a');return db['UserProfileResource'][_0xe96a('0x18')]({'where':{'type':_0x19e67c,'resourceId':_0x338b60['id']}})[_0xe96a('0x17')](function(){return _0x18fb44;});})['then'](function(){_0x5d7005[_0xe96a('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f6493){return function(_0x526fd2){if(!_0x526fd2){_0x4f6493[_0xe96a('0x1b')](0x194);}return _0x526fd2;};}function handleError(_0x2da20b,_0x3a0e2e){_0x3a0e2e=_0x3a0e2e||0x1f4;return function(_0x2fb83e){logger[_0xe96a('0x1c')](_0x2fb83e[_0xe96a('0x1d')]);if(_0x2fb83e['name']){delete _0x2fb83e[_0xe96a('0x1e')];}_0x2da20b[_0xe96a('0xf')](_0x3a0e2e)[_0xe96a('0x1f')](_0x2fb83e);};}exports[_0xe96a('0x20')]=function(_0x1fd315,_0x418bd0){var _0x52e9b8={};var _0x308bd6={'count':0x0,'rows':[]};var _0xe09d50=_[_0xe96a('0x21')](db['ChatQueue'][_0xe96a('0x22')],function(_0x8928e0){return{'name':_0x8928e0[_0xe96a('0x23')],'type':_0x8928e0[_0xe96a('0x24')][_0xe96a('0x25')]};});_0x52e9b8=qs[_0xe96a('0x26')](_0xe09d50,_0x1fd315);var _0x41b84c={'where':_0x52e9b8[_0xe96a('0x27')]};return db['ChatQueue'][_0xe96a('0x12')](_0x41b84c)[_0xe96a('0x17')](function(_0x12b724){_0x308bd6[_0xe96a('0x12')]=_0x12b724;_0x52e9b8['include']=qs['include'](_0x1fd315[_0xe96a('0x28')]);return db['ChatQueue'][_0xe96a('0x29')](_0x52e9b8);})['then'](function(_0x26a7d7){_0x308bd6['rows']=_0x26a7d7;return _0x308bd6;})[_0xe96a('0x17')](respondWithFilteredResult(_0x418bd0,_0x52e9b8))['catch'](handleError(_0x418bd0,null));};exports[_0xe96a('0x2a')]=function(_0x3d175a,_0x533d4f){var _0x1fba9d={'raw':!![],'where':{'id':_0x3d175a[_0xe96a('0x2b')]['id']}},_0x5e51e2={};_0x5e51e2['model']=_['keys'](db[_0xe96a('0x2c')][_0xe96a('0x22')]);_0x5e51e2[_0xe96a('0x28')]=_[_0xe96a('0x2d')](_0x3d175a['query']);_0x5e51e2['filters']=_['intersection'](_0x5e51e2[_0xe96a('0x2e')],_0x5e51e2['query']);_0x1fba9d['attributes']=_[_0xe96a('0x2f')](_0x5e51e2[_0xe96a('0x2e')],qs[_0xe96a('0x30')](_0x3d175a[_0xe96a('0x28')][_0xe96a('0x30')]));_0x1fba9d[_0xe96a('0x31')]=_0x1fba9d[_0xe96a('0x31')]['length']?_0x1fba9d['attributes']:_0x5e51e2['model'];if(_0x3d175a[_0xe96a('0x28')][_0xe96a('0x32')]){_0x1fba9d[_0xe96a('0x33')]=[{'all':!![]}];}_0x1fba9d=_['merge']({},_0x1fba9d,_0x3d175a[_0xe96a('0x34')]);return db[_0xe96a('0x2c')][_0xe96a('0x35')](_0x1fba9d)['then'](handleEntityNotFound(_0x533d4f,null))['then'](respondWithResult(_0x533d4f,null))[_0xe96a('0x36')](handleError(_0x533d4f,null));};exports['create']=function(_0x55e891,_0x18c151){return db[_0xe96a('0x2c')][_0xe96a('0x37')](_0x55e891['body'],{})['then'](function(_0x93e172){var _0x1bec3b=_0x55e891['user'][_0xe96a('0x19')]({'plain':!![]});if(!_0x1bec3b)throw new Error(_0xe96a('0x38'));if(_0x1bec3b['role']==='user'){var _0x3a076d=_0x93e172['get']({'plain':!![]});var _0x5a6a58=_0xe96a('0x1a');return db[_0xe96a('0x39')][_0xe96a('0x35')]({'where':{'name':_0x5a6a58,'userProfileId':_0x1bec3b[_0xe96a('0x3a')]},'raw':!![]})[_0xe96a('0x17')](function(_0x2593ff){if(_0x2593ff&&_0x2593ff[_0xe96a('0x3b')]===0x0){return db[_0xe96a('0x3c')][_0xe96a('0x37')]({'name':_0x3a076d['name'],'resourceId':_0x3a076d['id'],'type':_0x2593ff['name'],'sectionId':_0x2593ff['id']},{})[_0xe96a('0x17')](function(){return _0x93e172;});}else{return _0x93e172;}})['catch'](function(_0x50ea3b){logger[_0xe96a('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ea3b);throw _0x50ea3b;});}return _0x93e172;})[_0xe96a('0x17')](respondWithResult(_0x18c151,0xc9))[_0xe96a('0x36')](handleError(_0x18c151,null));};exports[_0xe96a('0x16')]=function(_0x5e6e6c,_0x3d836d){if(_0x5e6e6c[_0xe96a('0x3d')]['id']){delete _0x5e6e6c['body']['id'];}return db[_0xe96a('0x2c')][_0xe96a('0x35')]({'where':{'id':_0x5e6e6c[_0xe96a('0x2b')]['id']}})[_0xe96a('0x17')](handleEntityNotFound(_0x3d836d,null))['then'](saveUpdates(_0x5e6e6c[_0xe96a('0x3d')],null))[_0xe96a('0x17')](respondWithResult(_0x3d836d,null))[_0xe96a('0x36')](handleError(_0x3d836d,null));};exports[_0xe96a('0x18')]=function(_0x28f0fa,_0x120b67){return db[_0xe96a('0x2c')][_0xe96a('0x35')]({'where':{'id':_0x28f0fa[_0xe96a('0x2b')]['id']}})[_0xe96a('0x17')](handleEntityNotFound(_0x120b67,null))[_0xe96a('0x17')](removeEntity(_0x120b67,null))['catch'](handleError(_0x120b67,null));};exports[_0xe96a('0x3e')]=function(_0x5abc9c,_0x4df340){return db[_0xe96a('0x2c')][_0xe96a('0x3e')]()['then'](respondWithResult(_0x4df340,null))[_0xe96a('0x36')](handleError(_0x4df340,null));};exports[_0xe96a('0x3f')]=function(_0x23cdb3,_0x2aeecf){var _0x12045d={'raw':!![],'where':{}},_0x376506={},_0x4752c2;return db['ChatQueue'][_0xe96a('0x40')]({'where':{'id':_0x23cdb3[_0xe96a('0x2b')]['id']}})[_0xe96a('0x17')](handleEntityNotFound(_0x2aeecf,null))[_0xe96a('0x17')](function(_0x1713c2){if(_0x1713c2){_0x4752c2=_0x1713c2[_0xe96a('0x19')]({'plain':!![]});_0x376506[_0xe96a('0x2e')]=_[_0xe96a('0x2d')](db[_0xe96a('0x41')][_0xe96a('0x22')]);_0x376506[_0xe96a('0x28')]=_['keys'](_0x23cdb3['query']);_0x376506[_0xe96a('0x42')]=_[_0xe96a('0x2f')](_0x376506[_0xe96a('0x2e')],_0x376506[_0xe96a('0x28')]);_0x12045d['attributes']=_[_0xe96a('0x2f')](_0x376506[_0xe96a('0x2e')],qs['fields'](_0x23cdb3[_0xe96a('0x28')][_0xe96a('0x30')]));_0x12045d[_0xe96a('0x31')]=_0x12045d[_0xe96a('0x31')][_0xe96a('0x43')]?_0x12045d['attributes']:_0x376506[_0xe96a('0x2e')];if(!_0x23cdb3[_0xe96a('0x28')][_0xe96a('0x44')]('nolimit')){_0x12045d[_0xe96a('0x13')]=qs[_0xe96a('0x13')](_0x23cdb3[_0xe96a('0x28')]['limit']);_0x12045d[_0xe96a('0x10')]=qs[_0xe96a('0x10')](_0x23cdb3[_0xe96a('0x28')][_0xe96a('0x10')]);}_0x12045d[_0xe96a('0x45')]=qs['sort'](_0x23cdb3[_0xe96a('0x28')][_0xe96a('0x46')]);_0x12045d['where']=qs[_0xe96a('0x42')](_['pick'](_0x23cdb3[_0xe96a('0x28')],_0x376506[_0xe96a('0x42')]));_0x12045d[_0xe96a('0x27')][_0xe96a('0x47')]=_0x1713c2['id'];if(_0x23cdb3[_0xe96a('0x28')][_0xe96a('0x48')]){_0x12045d[_0xe96a('0x27')]=_['merge'](_0x12045d[_0xe96a('0x27')],{'$or':_[_0xe96a('0x21')](_0x12045d[_0xe96a('0x31')],function(_0x257117){var _0x2b59c2={};_0x2b59c2[_0x257117]={'$like':'%'+_0x23cdb3['query'][_0xe96a('0x48')]+'%'};return _0x2b59c2;})});}_0x12045d=_[_0xe96a('0x49')]({},_0x12045d,_0x23cdb3[_0xe96a('0x34')]);return db[_0xe96a('0x41')]['findAll'](_0x12045d);}})[_0xe96a('0x17')](function(_0x564dca){if(_0x564dca){return db[_0xe96a('0x4a')][_0xe96a('0x4b')]({'where':{'id':_[_0xe96a('0x21')](_0x564dca,_0xe96a('0x4c')),'role':_0xe96a('0x4d')},'attributes':['id',_0xe96a('0x1e'),_0xe96a('0x4e'),_0xe96a('0x4f'),_0xe96a('0x50')]});}})[_0xe96a('0x17')](function(_0x1a79ea){if(_0x1a79ea){return{'count':_0x1a79ea[_0xe96a('0x12')],'rows':_[_0xe96a('0x21')](_0x1a79ea[_0xe96a('0x51')],function(_0x332dc2){return{'membername':_0x332dc2['name'],'UserId':_0x332dc2['id'],'queue_name':_0x4752c2[_0xe96a('0x1e')],'ChatQueueId':_0x4752c2['id'],'interface':util[_0xe96a('0x52')](_0xe96a('0x53'),_0xe96a('0x54'),_0x332dc2[_0xe96a('0x1e')]),'penalty':0x0,'paused':_0x332dc2[_0xe96a('0x4e')],'createdAt':_0x332dc2[_0xe96a('0x50')],'updatedAt':_0x332dc2[_0xe96a('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe96a('0x17')](respondWithFilteredResult(_0x2aeecf,_0x12045d))['catch'](handleError(_0x2aeecf,null));};exports[_0xe96a('0x55')]=function(_0x24a9a6,_0x4c076c){var _0x447262={};var _0x2e5ea2={};var _0x5f2488;var _0x447794;return db[_0xe96a('0x2c')][_0xe96a('0x40')]({'where':{'id':_0x24a9a6[_0xe96a('0x2b')]['id']}})[_0xe96a('0x17')](handleEntityNotFound(_0x4c076c,null))[_0xe96a('0x17')](function(_0x5378b7){if(_0x5378b7){_0x5f2488=_0x5378b7;_0x2e5ea2[_0xe96a('0x2e')]=_['keys'](db['Team']['rawAttributes']);_0x2e5ea2['query']=_[_0xe96a('0x2d')](_0x24a9a6['query']);_0x2e5ea2['filters']=_['intersection'](_0x2e5ea2[_0xe96a('0x2e')],_0x2e5ea2[_0xe96a('0x28')]);_0x447262['attributes']=_[_0xe96a('0x2f')](_0x2e5ea2[_0xe96a('0x2e')],qs['fields'](_0x24a9a6[_0xe96a('0x28')][_0xe96a('0x30')]));_0x447262[_0xe96a('0x31')]=_0x447262[_0xe96a('0x31')]['length']?_0x447262[_0xe96a('0x31')]:_0x2e5ea2[_0xe96a('0x2e')];_0x447262[_0xe96a('0x45')]=qs[_0xe96a('0x46')](_0x24a9a6[_0xe96a('0x28')][_0xe96a('0x46')]);_0x447262[_0xe96a('0x27')]=qs[_0xe96a('0x42')](_[_0xe96a('0x56')](_0x24a9a6['query'],_0x2e5ea2[_0xe96a('0x42')]));if(_0x24a9a6['query']['filter']){_0x447262[_0xe96a('0x27')]=_[_0xe96a('0x49')](_0x447262[_0xe96a('0x27')],{'$or':_[_0xe96a('0x21')](_0x447262[_0xe96a('0x31')],function(_0x556674){var _0x39acec={};_0x39acec[_0x556674]={'$like':'%'+_0x24a9a6[_0xe96a('0x28')][_0xe96a('0x48')]+'%'};return _0x39acec;})});}_0x447262=_['merge']({},_0x447262,_0x24a9a6['options']);return _0x5f2488[_0xe96a('0x55')](_0x447262);}})[_0xe96a('0x17')](function(_0x58bc1a){if(_0x58bc1a){_0x447794=_0x58bc1a[_0xe96a('0x43')];if(!_0x24a9a6[_0xe96a('0x28')][_0xe96a('0x44')](_0xe96a('0x57'))){_0x447262[_0xe96a('0x13')]=qs[_0xe96a('0x13')](_0x24a9a6[_0xe96a('0x28')][_0xe96a('0x13')]);_0x447262[_0xe96a('0x10')]=qs['offset'](_0x24a9a6[_0xe96a('0x28')]['offset']);}return _0x5f2488[_0xe96a('0x55')](_0x447262);}})['then'](function(_0x1eb844){if(_0x1eb844){return _0x1eb844?{'count':_0x447794,'rows':_0x1eb844}:null;}})[_0xe96a('0x17')](respondWithResult(_0x4c076c,null))[_0xe96a('0x36')](handleError(_0x4c076c,null));};exports['addTeams']=function(_0x323c06,_0x32b035){var _0x5ae6e7=_0x323c06[_0xe96a('0x3d')]['ids'];return db[_0xe96a('0x58')][_0xe96a('0x29')]({'where':{'id':_0x5ae6e7},'attributes':['id'],'include':[{'model':db[_0xe96a('0x4a')],'as':_0xe96a('0x59'),'attributes':['id','name',_0xe96a('0x5a'),'voicePause','interface'],'raw':!![]}]})[_0xe96a('0x17')](function(_0x36421b){if(_0x36421b){var _0x19bc49=_[_0xe96a('0x5b')](_0x36421b,function(_0x2db234){var _0x109986=_0x2db234['get']({'plain':!![]});return _0x109986[_0xe96a('0x59')];});return db['ChatQueue'][_0xe96a('0x35')]({'where':{'id':_0x323c06['params']['id']}})['then'](function(_0x4b5d4d){return db[_0xe96a('0x5c')][_0xe96a('0x5d')](function(_0x263916){return _0x4b5d4d[_0xe96a('0x5e')](_0x5ae6e7,{'transaction':_0x263916})[_0xe96a('0x17')](function(){return BPromise[_0xe96a('0x5f')](_0x19bc49,function(_0x5c2383){return db['UserChatQueue'][_0xe96a('0x60')]({'where':{'UserId':_0x5c2383['id'],'ChatQueueId':_0x323c06['params']['id']},'transaction':_0x263916});});})[_0xe96a('0x17')](function(){_0x19bc49[_0xe96a('0x61')](function(_0x12f779){socket[_0xe96a('0x62')](_0xe96a('0x63'),{'UserId':_0x12f779['id'],'ChatQueueId':_0x4b5d4d['id']});});});});});}})[_0xe96a('0x17')](respondWithStatusCode(_0x32b035,null))['catch'](handleError(_0x32b035,null));};exports[_0xe96a('0x64')]=function(_0x4cf705,_0x803fd0){return db[_0xe96a('0x58')]['findAll']({'where':{'id':_0x4cf705[_0xe96a('0x28')][_0xe96a('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe96a('0x59'),'attributes':['id'],'raw':!![]}]})[_0xe96a('0x17')](handleEntityNotFound(_0x803fd0,null))[_0xe96a('0x17')](function(_0xb515e0){var _0x4d1a0b=_[_0xe96a('0x21')](_0xb515e0,'id');var _0x3c084b=[];var _0x4bc803=[];var _0x5a8104=squel[_0xe96a('0x66')]();_0x5a8104['field']('tq.TeamId')['from'](_0xe96a('0x67'),'tq')[_0xe96a('0x68')](_0xe96a('0x69'),'ut',_0xe96a('0x6a'))[_0xe96a('0x27')](_0xe96a('0x6b'),_0x4cf705[_0xe96a('0x2b')]['id']);for(var _0x1bd8ac=0x0;_0x1bd8ac<_0xb515e0[_0xe96a('0x43')];_0x1bd8ac+=0x1){let _0x4cf6d5=_0xb515e0[_0x1bd8ac];for(var _0x4055fb=0x0;_0x4055fb<_0x4cf6d5['Agents'][_0xe96a('0x43')];_0x4055fb+=0x1){let _0x387bc8=_0x4cf6d5['Agents'][_0x4055fb];var _0x23b97b=_0x5a8104[_0xe96a('0x6c')]();_0x23b97b[_0xe96a('0x27')](_0xe96a('0x6d'),_0x387bc8['id']);_0x4bc803[_0xe96a('0x6e')](db[_0xe96a('0x5c')][_0xe96a('0x28')](_0x23b97b[_0xe96a('0x6f')](),{'type':db[_0xe96a('0x5c')][_0xe96a('0x70')][_0xe96a('0x71')]})[_0xe96a('0x17')](function(_0x4eca53){if(_0x4eca53[_0xe96a('0x43')]===0x1){return _0x387bc8['id'];}else{var _0x5c11c5=_[_0xe96a('0x72')](_['map'](_0x4eca53,_0xe96a('0x73')),function(_0x3eb557){return _[_0xe96a('0x74')](_0x4d1a0b,_0x3eb557);});if(_0x5c11c5){return _0x387bc8['id'];}}}));}}return BPromise[_0xe96a('0x75')](_0x4bc803)[_0xe96a('0x17')](function(_0x3f5f73){_0x3c084b=_(_0x3c084b)['union'](_0x3f5f73)[_0xe96a('0x76')]()[_0xe96a('0x77')]();return db[_0xe96a('0x2c')][_0xe96a('0x35')]({'where':{'id':_0x4cf705[_0xe96a('0x2b')]['id']}})[_0xe96a('0x17')](function(_0x3d948d){return db['sequelize'][_0xe96a('0x5d')](function(_0x5bbd16){return _0x3d948d[_0xe96a('0x64')](_0x4cf705['query']['ids'],{'transaction':_0x5bbd16})[_0xe96a('0x17')](function(){if(!_[_0xe96a('0x78')](_0x3c084b)){return _0x3d948d[_0xe96a('0x79')](_0x3c084b,{'transaction':_0x5bbd16});}})[_0xe96a('0x17')](function(){_0x3c084b[_0xe96a('0x61')](function(_0x510846){socket[_0xe96a('0x62')](_0xe96a('0x7a'),{'UserId':_0x510846,'ChatQueueId':_0x3d948d['id']});});});});});});})['then'](respondWithStatusCode(_0x803fd0,null))[_0xe96a('0x36')](handleError(_0x803fd0,null));};exports[_0xe96a('0x7b')]=function(_0x5624cf,_0x5e76d4){return db[_0xe96a('0x2c')]['find']({'where':{'id':_0x5624cf['params']['id']}})[_0xe96a('0x17')](handleEntityNotFound(_0x5e76d4,null))[_0xe96a('0x17')](function(_0x7addce){if(_0x7addce){return _0x7addce[_0xe96a('0x7b')](_0x5624cf[_0xe96a('0x3d')][_0xe96a('0x65')],_[_0xe96a('0x7c')](_0x5624cf['body'],[_0xe96a('0x65'),'id'])||{})[_0xe96a('0x7d')](function(_0x1a61e5){for(var _0x41083f=0x0;_0x41083f<_0x5624cf[_0xe96a('0x3d')][_0xe96a('0x65')][_0xe96a('0x43')];_0x41083f+=0x1){socket[_0xe96a('0x62')](_0xe96a('0x63'),{'UserId':Number(_0x5624cf['body'][_0xe96a('0x65')][_0x41083f]),'ChatQueueId':Number(_0x5624cf[_0xe96a('0x2b')]['id'])});}return _0x1a61e5;});}})[_0xe96a('0x17')](respondWithResult(_0x5e76d4,null))[_0xe96a('0x36')](handleError(_0x5e76d4,null));};exports[_0xe96a('0x79')]=function(_0x4171be,_0x2a4777){return db[_0xe96a('0x2c')]['find']({'where':{'id':_0x4171be[_0xe96a('0x2b')]['id']}})[_0xe96a('0x17')](handleEntityNotFound(_0x2a4777,null))[_0xe96a('0x17')](function(_0x3ea0a6){if(_0x3ea0a6){return _0x3ea0a6[_0xe96a('0x79')](_0x4171be[_0xe96a('0x28')]['ids'])[_0xe96a('0x17')](function(){if(_[_0xe96a('0x7e')](_0x4171be[_0xe96a('0x28')][_0xe96a('0x65')])){for(var _0x229630=0x0;_0x229630<_0x4171be[_0xe96a('0x28')]['ids'][_0xe96a('0x43')];_0x229630+=0x1){socket[_0xe96a('0x62')](_0xe96a('0x7a'),{'UserId':Number(_0x4171be['query'][_0xe96a('0x65')][_0x229630]),'ChatQueueId':Number(_0x4171be[_0xe96a('0x2b')]['id'])});}}else{socket['emit'](_0xe96a('0x7a'),{'UserId':Number(_0x4171be['query']['ids']),'ChatQueueId':Number(_0x4171be[_0xe96a('0x2b')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a4777,null))[_0xe96a('0x36')](handleError(_0x2a4777,null));};exports[_0xe96a('0x7f')]=function(_0x1295f6,_0x3d5181){var _0x1cbfce={};var _0x27b937={};var _0x49c2cb;var _0x49408a;return db[_0xe96a('0x2c')][_0xe96a('0x40')]({'where':{'id':_0x1295f6[_0xe96a('0x2b')]['id']}})[_0xe96a('0x17')](handleEntityNotFound(_0x3d5181,null))['then'](function(_0x3754ad){if(_0x3754ad){_0x49c2cb=_0x3754ad;_0x27b937[_0xe96a('0x2e')]=_[_0xe96a('0x2d')](db[_0xe96a('0x4a')][_0xe96a('0x22')]);_0x27b937[_0xe96a('0x28')]=_[_0xe96a('0x2d')](_0x1295f6[_0xe96a('0x28')]);_0x27b937['filters']=_[_0xe96a('0x2f')](_0x27b937[_0xe96a('0x2e')],_0x27b937[_0xe96a('0x28')]);_0x1cbfce['attributes']=_[_0xe96a('0x2f')](_0x27b937[_0xe96a('0x2e')],qs[_0xe96a('0x30')](_0x1295f6[_0xe96a('0x28')][_0xe96a('0x30')]));_0x1cbfce[_0xe96a('0x31')]=_0x1cbfce[_0xe96a('0x31')]['length']?_0x1cbfce['attributes']:_0x27b937[_0xe96a('0x2e')];_0x1cbfce[_0xe96a('0x45')]=qs['sort'](_0x1295f6[_0xe96a('0x28')]['sort']);_0x1cbfce[_0xe96a('0x27')]=qs['filters'](_[_0xe96a('0x56')](_0x1295f6['query'],_0x27b937['filters']));if(_0x1295f6[_0xe96a('0x28')]['filter']){_0x1cbfce[_0xe96a('0x27')]=_['merge'](_0x1cbfce[_0xe96a('0x27')],{'$or':_[_0xe96a('0x21')](_0x1cbfce[_0xe96a('0x31')],function(_0x23408f){var _0x194e91={};_0x194e91[_0x23408f]={'$like':'%'+_0x1295f6[_0xe96a('0x28')][_0xe96a('0x48')]+'%'};return _0x194e91;})});}_0x1cbfce=_[_0xe96a('0x49')]({},_0x1cbfce,_0x1295f6['options']);return _0x49c2cb[_0xe96a('0x7f')](_0x1cbfce);}})[_0xe96a('0x17')](function(_0x239724){if(_0x239724){_0x49408a=_0x239724[_0xe96a('0x43')];if(!_0x1295f6[_0xe96a('0x28')][_0xe96a('0x44')](_0xe96a('0x57'))){_0x1cbfce[_0xe96a('0x13')]=qs[_0xe96a('0x13')](_0x1295f6['query'][_0xe96a('0x13')]);_0x1cbfce['offset']=qs[_0xe96a('0x10')](_0x1295f6[_0xe96a('0x28')][_0xe96a('0x10')]);}return _0x49c2cb[_0xe96a('0x7f')](_0x1cbfce);}})[_0xe96a('0x17')](function(_0x50fa66){if(_0x50fa66){return _0x50fa66?{'count':_0x49408a,'rows':_0x50fa66}:null;}})[_0xe96a('0x17')](respondWithResult(_0x3d5181,null))[_0xe96a('0x36')](handleError(_0x3d5181,null));}; \ No newline at end of file +var _0xb7a5=['json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','stack','name','send','map','key','getOptions','where','ChatQueue','query','findAll','rows','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','findAndCountAll','UserId','agent','chatPause','createdAt','format','SIP','updatedAt','Team','getTeams','addTeams','User','Agents','interface','flatMap','sequelize','transaction','each','findOrCreate','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','forEach','emit','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','end','status'];(function(_0x39f445,_0x4d192e){var _0x5b1bf8=function(_0x2f0445){while(--_0x2f0445){_0x39f445['push'](_0x39f445['shift']());}};_0x5b1bf8(++_0x4d192e);}(_0xb7a5,0x6b));var _0x5b7a=function(_0x1651e5,_0x56d279){_0x1651e5=_0x1651e5-0x0;var _0x43369b=_0xb7a5[_0x1651e5];return _0x43369b;};'use strict';var BPromise=require(_0x5b7a('0x0'));var util=require(_0x5b7a('0x1'));var _=require(_0x5b7a('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x5b7a('0x3'));var logger=require(_0x5b7a('0x4'))(_0x5b7a('0x5'));var config=require('../../config/environment');var db=require(_0x5b7a('0x6'))['db'];config[_0x5b7a('0x7')]=_[_0x5b7a('0x8')](config[_0x5b7a('0x7')],{'host':_0x5b7a('0x9'),'port':0x18eb});var socket=require(_0x5b7a('0xa'))(new Redis(config['redis']));require(_0x5b7a('0xb'))[_0x5b7a('0xc')](socket);function respondWithStatusCode(_0x3e7181,_0x2ff886){_0x2ff886=_0x2ff886||0xcc;return function(_0x1475fd){if(_0x1475fd){return _0x3e7181['sendStatus'](_0x2ff886);}return _0x3e7181['status'](_0x2ff886)[_0x5b7a('0xd')]();};}function respondWithResult(_0x36b009,_0x35eaee){_0x35eaee=_0x35eaee||0xc8;return function(_0x13a38d){if(_0x13a38d){return _0x36b009[_0x5b7a('0xe')](_0x35eaee)[_0x5b7a('0xf')](_0x13a38d);}};}function respondWithFilteredResult(_0x1fb973,_0x459320){return function(_0x2f6b13){if(_0x2f6b13){var _0x3d7e7f=typeof _0x459320[_0x5b7a('0x10')]===_0x5b7a('0x11')&&typeof _0x459320[_0x5b7a('0x12')]===_0x5b7a('0x11');var _0x5f280f=_0x2f6b13[_0x5b7a('0x13')];var _0x53910e=_0x3d7e7f?0x0:_0x459320[_0x5b7a('0x10')];var _0x28a41c=_0x3d7e7f?_0x2f6b13['count']:_0x459320[_0x5b7a('0x10')]+_0x459320['limit'];var _0x3e50df;if(_0x28a41c>=_0x5f280f){_0x28a41c=_0x5f280f;_0x3e50df=0xc8;}else{_0x3e50df=0xce;}_0x1fb973[_0x5b7a('0xe')](_0x3e50df);return _0x1fb973[_0x5b7a('0x14')](_0x5b7a('0x15'),_0x53910e+'-'+_0x28a41c+'/'+_0x5f280f)[_0x5b7a('0xf')](_0x2f6b13);}return null;};}function saveUpdates(_0xd14809){return function(_0x1340b8){if(_0x1340b8){return _0x1340b8[_0x5b7a('0x16')](_0xd14809)[_0x5b7a('0x17')](function(_0x48a46c){return _0x48a46c;});}return null;};}function removeEntity(_0x54e4e9){return function(_0x252a5e){if(_0x252a5e){return _0x252a5e[_0x5b7a('0x18')]()[_0x5b7a('0x17')](function(){var _0x14dacf=_0x252a5e[_0x5b7a('0x19')]({'plain':!![]});var _0x32d008=_0x5b7a('0x1a');return db[_0x5b7a('0x1b')]['destroy']({'where':{'type':_0x32d008,'resourceId':_0x14dacf['id']}})[_0x5b7a('0x17')](function(){return _0x252a5e;});})[_0x5b7a('0x17')](function(){_0x54e4e9[_0x5b7a('0xe')](0xcc)[_0x5b7a('0xd')]();});}};}function handleEntityNotFound(_0x16b4ba){return function(_0x5b53d0){if(!_0x5b53d0){_0x16b4ba['sendStatus'](0x194);}return _0x5b53d0;};}function handleError(_0x27e2cf,_0x2609f2){_0x2609f2=_0x2609f2||0x1f4;return function(_0x311b02){logger['error'](_0x311b02[_0x5b7a('0x1c')]);if(_0x311b02[_0x5b7a('0x1d')]){delete _0x311b02['name'];}_0x27e2cf[_0x5b7a('0xe')](_0x2609f2)[_0x5b7a('0x1e')](_0x311b02);};}exports['index']=function(_0x483dd9,_0x318d89){var _0x530d8c={};var _0x1a937e={'count':0x0,'rows':[]};var _0x373ae6=_[_0x5b7a('0x1f')](db['ChatQueue']['rawAttributes'],function(_0x4b362b){return{'name':_0x4b362b['fieldName'],'type':_0x4b362b['type'][_0x5b7a('0x20')]};});_0x530d8c=qs[_0x5b7a('0x21')](_0x373ae6,_0x483dd9);var _0x209147={'where':_0x530d8c[_0x5b7a('0x22')]};return db[_0x5b7a('0x23')][_0x5b7a('0x13')](_0x209147)[_0x5b7a('0x17')](function(_0x36c4fc){_0x1a937e['count']=_0x36c4fc;_0x530d8c['include']=qs['include'](_0x483dd9[_0x5b7a('0x24')]);return db['ChatQueue'][_0x5b7a('0x25')](_0x530d8c);})[_0x5b7a('0x17')](function(_0x5c7361){_0x1a937e[_0x5b7a('0x26')]=_0x5c7361;return _0x1a937e;})[_0x5b7a('0x17')](respondWithFilteredResult(_0x318d89,_0x530d8c))[_0x5b7a('0x27')](handleError(_0x318d89,null));};exports[_0x5b7a('0x28')]=function(_0x495b62,_0x340403){var _0x1c79fa={'raw':!![],'where':{'id':_0x495b62[_0x5b7a('0x29')]['id']}},_0x5568cd={};_0x5568cd[_0x5b7a('0x2a')]=_[_0x5b7a('0x2b')](db['ChatQueue'][_0x5b7a('0x2c')]);_0x5568cd[_0x5b7a('0x24')]=_['keys'](_0x495b62[_0x5b7a('0x24')]);_0x5568cd[_0x5b7a('0x2d')]=_[_0x5b7a('0x2e')](_0x5568cd[_0x5b7a('0x2a')],_0x5568cd['query']);_0x1c79fa[_0x5b7a('0x2f')]=_[_0x5b7a('0x2e')](_0x5568cd[_0x5b7a('0x2a')],qs['fields'](_0x495b62[_0x5b7a('0x24')][_0x5b7a('0x30')]));_0x1c79fa[_0x5b7a('0x2f')]=_0x1c79fa[_0x5b7a('0x2f')][_0x5b7a('0x31')]?_0x1c79fa[_0x5b7a('0x2f')]:_0x5568cd[_0x5b7a('0x2a')];if(_0x495b62[_0x5b7a('0x24')][_0x5b7a('0x32')]){_0x1c79fa[_0x5b7a('0x33')]=[{'all':!![]}];}_0x1c79fa=_[_0x5b7a('0x34')]({},_0x1c79fa,_0x495b62[_0x5b7a('0x35')]);return db[_0x5b7a('0x23')][_0x5b7a('0x36')](_0x1c79fa)[_0x5b7a('0x17')](handleEntityNotFound(_0x340403,null))[_0x5b7a('0x17')](respondWithResult(_0x340403,null))['catch'](handleError(_0x340403,null));};exports[_0x5b7a('0x37')]=function(_0x2939b3,_0x3021c6){return db[_0x5b7a('0x23')][_0x5b7a('0x37')](_0x2939b3[_0x5b7a('0x38')],{})['then'](function(_0x21aaf7){var _0xef2b4=_0x2939b3[_0x5b7a('0x39')][_0x5b7a('0x19')]({'plain':!![]});if(!_0xef2b4)throw new Error(_0x5b7a('0x3a'));if(_0xef2b4[_0x5b7a('0x3b')]===_0x5b7a('0x39')){var _0x5816e7=_0x21aaf7[_0x5b7a('0x19')]({'plain':!![]});var _0x55ec6f=_0x5b7a('0x1a');return db[_0x5b7a('0x3c')][_0x5b7a('0x36')]({'where':{'name':_0x55ec6f,'userProfileId':_0xef2b4[_0x5b7a('0x3d')]},'raw':!![]})[_0x5b7a('0x17')](function(_0x736a94){if(_0x736a94&&_0x736a94[_0x5b7a('0x3e')]===0x0){return db[_0x5b7a('0x1b')][_0x5b7a('0x37')]({'name':_0x5816e7[_0x5b7a('0x1d')],'resourceId':_0x5816e7['id'],'type':_0x736a94[_0x5b7a('0x1d')],'sectionId':_0x736a94['id']},{})[_0x5b7a('0x17')](function(){return _0x21aaf7;});}else{return _0x21aaf7;}})[_0x5b7a('0x27')](function(_0x1aa0e5){logger['error'](_0x5b7a('0x3f'),_0x1aa0e5);throw _0x1aa0e5;});}return _0x21aaf7;})[_0x5b7a('0x17')](respondWithResult(_0x3021c6,0xc9))[_0x5b7a('0x27')](handleError(_0x3021c6,null));};exports['update']=function(_0x5d0f52,_0x5b5b05){if(_0x5d0f52[_0x5b7a('0x38')]['id']){delete _0x5d0f52['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x5d0f52['params']['id']}})[_0x5b7a('0x17')](handleEntityNotFound(_0x5b5b05,null))[_0x5b7a('0x17')](saveUpdates(_0x5d0f52['body'],null))[_0x5b7a('0x17')](respondWithResult(_0x5b5b05,null))[_0x5b7a('0x27')](handleError(_0x5b5b05,null));};exports[_0x5b7a('0x18')]=function(_0x171070,_0x25be0e){return db[_0x5b7a('0x23')][_0x5b7a('0x36')]({'where':{'id':_0x171070[_0x5b7a('0x29')]['id']}})[_0x5b7a('0x17')](handleEntityNotFound(_0x25be0e,null))[_0x5b7a('0x17')](removeEntity(_0x25be0e,null))['catch'](handleError(_0x25be0e,null));};exports[_0x5b7a('0x40')]=function(_0x5bce08,_0x5de87a){return db[_0x5b7a('0x23')][_0x5b7a('0x40')]()[_0x5b7a('0x17')](respondWithResult(_0x5de87a,null))[_0x5b7a('0x27')](handleError(_0x5de87a,null));};exports[_0x5b7a('0x41')]=function(_0x39124d,_0x28afb6){var _0x275d3c={'raw':!![],'where':{}},_0x14d90f={},_0x4e57c6;return db[_0x5b7a('0x23')][_0x5b7a('0x42')]({'where':{'id':_0x39124d[_0x5b7a('0x29')]['id']}})[_0x5b7a('0x17')](handleEntityNotFound(_0x28afb6,null))[_0x5b7a('0x17')](function(_0x215614){if(_0x215614){_0x4e57c6=_0x215614['get']({'plain':!![]});_0x14d90f[_0x5b7a('0x2a')]=_['keys'](db[_0x5b7a('0x43')][_0x5b7a('0x2c')]);_0x14d90f['query']=_[_0x5b7a('0x2b')](_0x39124d[_0x5b7a('0x24')]);_0x14d90f[_0x5b7a('0x2d')]=_[_0x5b7a('0x2e')](_0x14d90f[_0x5b7a('0x2a')],_0x14d90f[_0x5b7a('0x24')]);_0x275d3c[_0x5b7a('0x2f')]=_[_0x5b7a('0x2e')](_0x14d90f[_0x5b7a('0x2a')],qs[_0x5b7a('0x30')](_0x39124d[_0x5b7a('0x24')][_0x5b7a('0x30')]));_0x275d3c[_0x5b7a('0x2f')]=_0x275d3c[_0x5b7a('0x2f')][_0x5b7a('0x31')]?_0x275d3c[_0x5b7a('0x2f')]:_0x14d90f[_0x5b7a('0x2a')];if(!_0x39124d['query'][_0x5b7a('0x44')](_0x5b7a('0x45'))){_0x275d3c[_0x5b7a('0x12')]=qs[_0x5b7a('0x12')](_0x39124d[_0x5b7a('0x24')][_0x5b7a('0x12')]);_0x275d3c[_0x5b7a('0x10')]=qs[_0x5b7a('0x10')](_0x39124d[_0x5b7a('0x24')]['offset']);}_0x275d3c[_0x5b7a('0x46')]=qs[_0x5b7a('0x47')](_0x39124d[_0x5b7a('0x24')][_0x5b7a('0x47')]);_0x275d3c[_0x5b7a('0x22')]=qs[_0x5b7a('0x2d')](_[_0x5b7a('0x48')](_0x39124d[_0x5b7a('0x24')],_0x14d90f[_0x5b7a('0x2d')]));_0x275d3c[_0x5b7a('0x22')][_0x5b7a('0x49')]=_0x215614['id'];if(_0x39124d['query'][_0x5b7a('0x4a')]){_0x275d3c['where']=_['merge'](_0x275d3c[_0x5b7a('0x22')],{'$or':_[_0x5b7a('0x1f')](_0x275d3c['attributes'],function(_0x300838){var _0x2689fb={};_0x2689fb[_0x300838]={'$like':'%'+_0x39124d['query'][_0x5b7a('0x4a')]+'%'};return _0x2689fb;})});}_0x275d3c=_['merge']({},_0x275d3c,_0x39124d['options']);return db[_0x5b7a('0x43')][_0x5b7a('0x25')](_0x275d3c);}})[_0x5b7a('0x17')](function(_0x3e6ac3){if(_0x3e6ac3){return db['User'][_0x5b7a('0x4b')]({'where':{'id':_[_0x5b7a('0x1f')](_0x3e6ac3,_0x5b7a('0x4c')),'role':_0x5b7a('0x4d')},'attributes':['id',_0x5b7a('0x1d'),_0x5b7a('0x4e'),'updatedAt',_0x5b7a('0x4f')]});}})[_0x5b7a('0x17')](function(_0x3e8238){if(_0x3e8238){return{'count':_0x3e8238[_0x5b7a('0x13')],'rows':_[_0x5b7a('0x1f')](_0x3e8238[_0x5b7a('0x26')],function(_0xd86ab3){return{'membername':_0xd86ab3[_0x5b7a('0x1d')],'UserId':_0xd86ab3['id'],'queue_name':_0x4e57c6[_0x5b7a('0x1d')],'ChatQueueId':_0x4e57c6['id'],'interface':util[_0x5b7a('0x50')]('%s/%s',_0x5b7a('0x51'),_0xd86ab3[_0x5b7a('0x1d')]),'penalty':0x0,'paused':_0xd86ab3[_0x5b7a('0x4e')],'createdAt':_0xd86ab3[_0x5b7a('0x4f')],'updatedAt':_0xd86ab3[_0x5b7a('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5b7a('0x17')](respondWithFilteredResult(_0x28afb6,_0x275d3c))[_0x5b7a('0x27')](handleError(_0x28afb6,null));};exports['getTeams']=function(_0x4e6fc1,_0xf85181){var _0x1627e1={};var _0x429451={};var _0xa77d7a;var _0x441b85;return db[_0x5b7a('0x23')][_0x5b7a('0x42')]({'where':{'id':_0x4e6fc1[_0x5b7a('0x29')]['id']}})[_0x5b7a('0x17')](handleEntityNotFound(_0xf85181,null))[_0x5b7a('0x17')](function(_0x5237dd){if(_0x5237dd){_0xa77d7a=_0x5237dd;_0x429451[_0x5b7a('0x2a')]=_[_0x5b7a('0x2b')](db[_0x5b7a('0x53')][_0x5b7a('0x2c')]);_0x429451[_0x5b7a('0x24')]=_[_0x5b7a('0x2b')](_0x4e6fc1[_0x5b7a('0x24')]);_0x429451[_0x5b7a('0x2d')]=_[_0x5b7a('0x2e')](_0x429451[_0x5b7a('0x2a')],_0x429451[_0x5b7a('0x24')]);_0x1627e1[_0x5b7a('0x2f')]=_[_0x5b7a('0x2e')](_0x429451[_0x5b7a('0x2a')],qs['fields'](_0x4e6fc1[_0x5b7a('0x24')][_0x5b7a('0x30')]));_0x1627e1[_0x5b7a('0x2f')]=_0x1627e1[_0x5b7a('0x2f')][_0x5b7a('0x31')]?_0x1627e1[_0x5b7a('0x2f')]:_0x429451[_0x5b7a('0x2a')];_0x1627e1['order']=qs['sort'](_0x4e6fc1[_0x5b7a('0x24')][_0x5b7a('0x47')]);_0x1627e1[_0x5b7a('0x22')]=qs['filters'](_[_0x5b7a('0x48')](_0x4e6fc1[_0x5b7a('0x24')],_0x429451[_0x5b7a('0x2d')]));if(_0x4e6fc1[_0x5b7a('0x24')]['filter']){_0x1627e1['where']=_[_0x5b7a('0x34')](_0x1627e1[_0x5b7a('0x22')],{'$or':_['map'](_0x1627e1['attributes'],function(_0x106d81){var _0x4babef={};_0x4babef[_0x106d81]={'$like':'%'+_0x4e6fc1['query'][_0x5b7a('0x4a')]+'%'};return _0x4babef;})});}_0x1627e1=_[_0x5b7a('0x34')]({},_0x1627e1,_0x4e6fc1[_0x5b7a('0x35')]);return _0xa77d7a['getTeams'](_0x1627e1);}})[_0x5b7a('0x17')](function(_0x1e2caf){if(_0x1e2caf){_0x441b85=_0x1e2caf[_0x5b7a('0x31')];if(!_0x4e6fc1[_0x5b7a('0x24')][_0x5b7a('0x44')](_0x5b7a('0x45'))){_0x1627e1[_0x5b7a('0x12')]=qs['limit'](_0x4e6fc1[_0x5b7a('0x24')][_0x5b7a('0x12')]);_0x1627e1[_0x5b7a('0x10')]=qs[_0x5b7a('0x10')](_0x4e6fc1[_0x5b7a('0x24')][_0x5b7a('0x10')]);}return _0xa77d7a[_0x5b7a('0x54')](_0x1627e1);}})[_0x5b7a('0x17')](function(_0x57c0a0){if(_0x57c0a0){return _0x57c0a0?{'count':_0x441b85,'rows':_0x57c0a0}:null;}})[_0x5b7a('0x17')](respondWithResult(_0xf85181,null))[_0x5b7a('0x27')](handleError(_0xf85181,null));};exports[_0x5b7a('0x55')]=function(_0x1660ee,_0x3158e0){var _0x327c20=_0x1660ee[_0x5b7a('0x38')]['ids'];return db[_0x5b7a('0x53')]['findAll']({'where':{'id':_0x327c20},'attributes':['id'],'include':[{'model':db[_0x5b7a('0x56')],'as':_0x5b7a('0x57'),'attributes':['id','name','online','voicePause',_0x5b7a('0x58')],'raw':!![]}]})[_0x5b7a('0x17')](function(_0x239f66){if(_0x239f66){var _0x3efcfc=_[_0x5b7a('0x59')](_0x239f66,function(_0x2bf572){var _0x164f34=_0x2bf572[_0x5b7a('0x19')]({'plain':!![]});return _0x164f34[_0x5b7a('0x57')];});return db[_0x5b7a('0x23')][_0x5b7a('0x36')]({'where':{'id':_0x1660ee[_0x5b7a('0x29')]['id']}})['then'](function(_0x3cb002){return db[_0x5b7a('0x5a')][_0x5b7a('0x5b')](function(_0x2c951d){return _0x3cb002['addTeams'](_0x327c20,{'transaction':_0x2c951d})[_0x5b7a('0x17')](function(){return BPromise[_0x5b7a('0x5c')](_0x3efcfc,function(_0x369bf2){return db['UserChatQueue'][_0x5b7a('0x5d')]({'where':{'UserId':_0x369bf2['id'],'ChatQueueId':_0x1660ee[_0x5b7a('0x29')]['id']},'transaction':_0x2c951d});});})[_0x5b7a('0x17')](function(){_0x3efcfc['forEach'](function(_0x46031f){socket['emit'](_0x5b7a('0x5e'),{'UserId':_0x46031f['id'],'ChatQueueId':_0x3cb002['id']});});});});});}})[_0x5b7a('0x17')](respondWithStatusCode(_0x3158e0,null))[_0x5b7a('0x27')](handleError(_0x3158e0,null));};exports[_0x5b7a('0x5f')]=function(_0x2ed11f,_0x5f4d23){return db[_0x5b7a('0x53')][_0x5b7a('0x25')]({'where':{'id':_0x2ed11f['query'][_0x5b7a('0x60')]},'attributes':['id'],'include':[{'model':db[_0x5b7a('0x56')],'as':_0x5b7a('0x57'),'attributes':['id'],'raw':!![]}]})[_0x5b7a('0x17')](handleEntityNotFound(_0x5f4d23,null))[_0x5b7a('0x17')](function(_0x16233c){var _0x31effd=_[_0x5b7a('0x1f')](_0x16233c,'id');var _0x5322b9=[];var _0x51c858=[];var _0x468887=squel[_0x5b7a('0x61')]();_0x468887[_0x5b7a('0x62')](_0x5b7a('0x63'))[_0x5b7a('0x64')]('team_has_chat_queues','tq')[_0x5b7a('0x65')]('user_has_teams','ut',_0x5b7a('0x66'))['where']('ChatQueueId\x20=\x20?',_0x2ed11f[_0x5b7a('0x29')]['id']);for(var _0x73aa8c=0x0;_0x73aa8c<_0x16233c[_0x5b7a('0x31')];_0x73aa8c+=0x1){let _0x5886ce=_0x16233c[_0x73aa8c];for(var _0x58b382=0x0;_0x58b382<_0x5886ce[_0x5b7a('0x57')][_0x5b7a('0x31')];_0x58b382+=0x1){let _0x3432dd=_0x5886ce[_0x5b7a('0x57')][_0x58b382];var _0x4a2934=_0x468887['clone']();_0x4a2934[_0x5b7a('0x22')](_0x5b7a('0x67'),_0x3432dd['id']);_0x51c858[_0x5b7a('0x68')](db['sequelize'][_0x5b7a('0x24')](_0x4a2934['toString'](),{'type':db['sequelize'][_0x5b7a('0x69')][_0x5b7a('0x6a')]})['then'](function(_0x4fc618){if(_0x4fc618['length']===0x1){return _0x3432dd['id'];}else{var _0x4415e1=_['every'](_[_0x5b7a('0x1f')](_0x4fc618,_0x5b7a('0x6b')),function(_0x174782){return _[_0x5b7a('0x6c')](_0x31effd,_0x174782);});if(_0x4415e1){return _0x3432dd['id'];}}}));}}return BPromise['all'](_0x51c858)[_0x5b7a('0x17')](function(_0x2187c4){_0x5322b9=_(_0x5322b9)[_0x5b7a('0x6d')](_0x2187c4)[_0x5b7a('0x6e')]()[_0x5b7a('0x6f')]();return db[_0x5b7a('0x23')]['find']({'where':{'id':_0x2ed11f['params']['id']}})[_0x5b7a('0x17')](function(_0x5806a8){return db[_0x5b7a('0x5a')]['transaction'](function(_0x31ab24){return _0x5806a8[_0x5b7a('0x5f')](_0x2ed11f['query'][_0x5b7a('0x60')],{'transaction':_0x31ab24})['then'](function(){if(!_[_0x5b7a('0x70')](_0x5322b9)){return _0x5806a8[_0x5b7a('0x71')](_0x5322b9,{'transaction':_0x31ab24});}})['then'](function(){_0x5322b9[_0x5b7a('0x72')](function(_0x1c774b){socket[_0x5b7a('0x73')](_0x5b7a('0x74'),{'UserId':_0x1c774b,'ChatQueueId':_0x5806a8['id']});});});});});});})[_0x5b7a('0x17')](respondWithStatusCode(_0x5f4d23,null))[_0x5b7a('0x27')](handleError(_0x5f4d23,null));};exports['addAgents']=function(_0x2f5267,_0x13d155){return db[_0x5b7a('0x23')]['find']({'where':{'id':_0x2f5267['params']['id']}})[_0x5b7a('0x17')](handleEntityNotFound(_0x13d155,null))[_0x5b7a('0x17')](function(_0x164823){if(_0x164823){return _0x164823[_0x5b7a('0x75')](_0x2f5267['body'][_0x5b7a('0x60')],_[_0x5b7a('0x76')](_0x2f5267[_0x5b7a('0x38')],[_0x5b7a('0x60'),'id'])||{})[_0x5b7a('0x77')](function(_0xbf572b){for(var _0x19a0c9=0x0;_0x19a0c9<_0x2f5267[_0x5b7a('0x38')][_0x5b7a('0x60')][_0x5b7a('0x31')];_0x19a0c9+=0x1){socket[_0x5b7a('0x73')](_0x5b7a('0x5e'),{'UserId':Number(_0x2f5267[_0x5b7a('0x38')][_0x5b7a('0x60')][_0x19a0c9]),'ChatQueueId':Number(_0x2f5267[_0x5b7a('0x29')]['id'])});}return _0xbf572b;});}})[_0x5b7a('0x17')](respondWithResult(_0x13d155,null))[_0x5b7a('0x27')](handleError(_0x13d155,null));};exports['removeAgents']=function(_0x4fcbfd,_0x306dbe){return db[_0x5b7a('0x23')]['find']({'where':{'id':_0x4fcbfd['params']['id']}})['then'](handleEntityNotFound(_0x306dbe,null))[_0x5b7a('0x17')](function(_0x37132c){if(_0x37132c){return _0x37132c[_0x5b7a('0x71')](_0x4fcbfd[_0x5b7a('0x24')][_0x5b7a('0x60')])['then'](function(){if(_[_0x5b7a('0x78')](_0x4fcbfd[_0x5b7a('0x24')][_0x5b7a('0x60')])){for(var _0x485a18=0x0;_0x485a18<_0x4fcbfd['query'][_0x5b7a('0x60')][_0x5b7a('0x31')];_0x485a18+=0x1){socket['emit'](_0x5b7a('0x74'),{'UserId':Number(_0x4fcbfd[_0x5b7a('0x24')]['ids'][_0x485a18]),'ChatQueueId':Number(_0x4fcbfd['params']['id'])});}}else{socket[_0x5b7a('0x73')](_0x5b7a('0x74'),{'UserId':Number(_0x4fcbfd['query'][_0x5b7a('0x60')]),'ChatQueueId':Number(_0x4fcbfd[_0x5b7a('0x29')]['id'])});}});}})[_0x5b7a('0x17')](respondWithStatusCode(_0x306dbe,null))['catch'](handleError(_0x306dbe,null));};exports[_0x5b7a('0x79')]=function(_0x200743,_0x41cf65){var _0x3de00d={};var _0x59f230={};var _0x506bc5;var _0x29612f;return db[_0x5b7a('0x23')][_0x5b7a('0x42')]({'where':{'id':_0x200743[_0x5b7a('0x29')]['id']}})[_0x5b7a('0x17')](handleEntityNotFound(_0x41cf65,null))[_0x5b7a('0x17')](function(_0x538d63){if(_0x538d63){_0x506bc5=_0x538d63;_0x59f230[_0x5b7a('0x2a')]=_[_0x5b7a('0x2b')](db['User'][_0x5b7a('0x2c')]);_0x59f230[_0x5b7a('0x24')]=_[_0x5b7a('0x2b')](_0x200743[_0x5b7a('0x24')]);_0x59f230[_0x5b7a('0x2d')]=_['intersection'](_0x59f230[_0x5b7a('0x2a')],_0x59f230[_0x5b7a('0x24')]);_0x3de00d[_0x5b7a('0x2f')]=_[_0x5b7a('0x2e')](_0x59f230[_0x5b7a('0x2a')],qs['fields'](_0x200743[_0x5b7a('0x24')]['fields']));_0x3de00d[_0x5b7a('0x2f')]=_0x3de00d[_0x5b7a('0x2f')][_0x5b7a('0x31')]?_0x3de00d[_0x5b7a('0x2f')]:_0x59f230[_0x5b7a('0x2a')];_0x3de00d[_0x5b7a('0x46')]=qs[_0x5b7a('0x47')](_0x200743[_0x5b7a('0x24')][_0x5b7a('0x47')]);_0x3de00d['where']=qs['filters'](_[_0x5b7a('0x48')](_0x200743[_0x5b7a('0x24')],_0x59f230[_0x5b7a('0x2d')]));if(_0x200743[_0x5b7a('0x24')][_0x5b7a('0x4a')]){_0x3de00d[_0x5b7a('0x22')]=_['merge'](_0x3de00d[_0x5b7a('0x22')],{'$or':_['map'](_0x3de00d[_0x5b7a('0x2f')],function(_0x140f8d){var _0xa4734f={};_0xa4734f[_0x140f8d]={'$like':'%'+_0x200743[_0x5b7a('0x24')][_0x5b7a('0x4a')]+'%'};return _0xa4734f;})});}_0x3de00d=_[_0x5b7a('0x34')]({},_0x3de00d,_0x200743['options']);return _0x506bc5['getAgents'](_0x3de00d);}})[_0x5b7a('0x17')](function(_0x2eda4b){if(_0x2eda4b){_0x29612f=_0x2eda4b[_0x5b7a('0x31')];if(!_0x200743[_0x5b7a('0x24')]['hasOwnProperty']('nolimit')){_0x3de00d[_0x5b7a('0x12')]=qs['limit'](_0x200743[_0x5b7a('0x24')][_0x5b7a('0x12')]);_0x3de00d[_0x5b7a('0x10')]=qs[_0x5b7a('0x10')](_0x200743['query'][_0x5b7a('0x10')]);}return _0x506bc5[_0x5b7a('0x79')](_0x3de00d);}})[_0x5b7a('0x17')](function(_0x3c24f5){if(_0x3c24f5){return _0x3c24f5?{'count':_0x29612f,'rows':_0x3c24f5}:null;}})[_0x5b7a('0x17')](respondWithResult(_0x41cf65,null))[_0x5b7a('0x27')](handleError(_0x41cf65,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index a99f26f..9227e69 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 _0xb584=['events','ChatQueue','emit','hasOwnProperty','hook','exports'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0xb584,0x16e));var _0x4b58=function(_0xf1eadc,_0x118c22){_0xf1eadc=_0xf1eadc-0x0;var _0x3e53e1=_0xb584[_0xf1eadc];return _0x3e53e1;};'use strict';var EventEmitter=require(_0x4b58('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x4b58('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c4e27){return function(_0x3813d6,_0xf07418,_0x3a8164){ChatQueueEvents[_0x4b58('0x2')](_0x5c4e27+':'+_0x3813d6['id'],_0x3813d6);ChatQueueEvents[_0x4b58('0x2')](_0x5c4e27,_0x3813d6);_0x3a8164(null);};}for(var e in events){if(events[_0x4b58('0x3')](e)){var event=events[e];ChatQueue[_0x4b58('0x4')](e,emitEvent(event));}}module[_0x4b58('0x5')]=ChatQueueEvents; \ No newline at end of file +var _0x75fd=['exports','events','ChatQueue','setMaxListeners','update','emit','hook'];(function(_0x58ec6b,_0x55bf35){var _0x5396e8=function(_0x305f7f){while(--_0x305f7f){_0x58ec6b['push'](_0x58ec6b['shift']());}};_0x5396e8(++_0x55bf35);}(_0x75fd,0x197));var _0xd75f=function(_0x5bcfe2,_0x348f00){_0x5bcfe2=_0x5bcfe2-0x0;var _0x45d45d=_0x75fd[_0x5bcfe2];return _0x45d45d;};'use strict';var EventEmitter=require(_0xd75f('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xd75f('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xd75f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd75f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x18cb0b){return function(_0x2182c9,_0x172207,_0x1d2033){ChatQueueEvents[_0xd75f('0x4')](_0x18cb0b+':'+_0x2182c9['id'],_0x2182c9);ChatQueueEvents[_0xd75f('0x4')](_0x18cb0b,_0x2182c9);_0x1d2033(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xd75f('0x5')](e,emitEvent(event));}}module[_0xd75f('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index fa7ffc6..d4b41f9 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 _0xaa9a=['chat_queues','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatQueue.attributes','ChatQueue'];(function(_0x372129,_0x539547){var _0x2385b4=function(_0x17969f){while(--_0x17969f){_0x372129['push'](_0x372129['shift']());}};_0x2385b4(++_0x539547);}(_0xaa9a,0x6f));var _0xaaa9=function(_0x15f468,_0x10b42b){_0x15f468=_0x15f468-0x0;var _0x29decb=_0xaa9a[_0x15f468];return _0x29decb;};'use strict';var _=require(_0xaaa9('0x0'));var util=require(_0xaaa9('0x1'));var logger=require(_0xaaa9('0x2'))(_0xaaa9('0x3'));var moment=require(_0xaaa9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaaa9('0x5'));var rimraf=require(_0xaaa9('0x6'));var config=require(_0xaaa9('0x7'));var attributes=require(_0xaaa9('0x8'));module['exports']=function(_0x486007,_0x99af58){return _0x486007['define'](_0xaaa9('0x9'),attributes,{'tableName':_0xaaa9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12db=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./chatQueue.attributes','ChatQueue','chat_queues','util'];(function(_0x112923,_0x341874){var _0x10a022=function(_0x4e644a){while(--_0x4e644a){_0x112923['push'](_0x112923['shift']());}};_0x10a022(++_0x341874);}(_0x12db,0x13f));var _0xb12d=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x12db[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0xb12d('0x0'));var logger=require(_0xb12d('0x1'))(_0xb12d('0x2'));var moment=require(_0xb12d('0x3'));var BPromise=require(_0xb12d('0x4'));var rp=require(_0xb12d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb12d('0x6'));var config=require('../../config/environment');var attributes=require(_0xb12d('0x7'));module['exports']=function(_0x205abc,_0xc9bdb7){return _0x205abc['define'](_0xb12d('0x8'),attributes,{'tableName':_0xb12d('0x9'),'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 de632b1..0473723 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 _0x51f9=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatQueue,\x20%s,\x20%s','message','result','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','include','model','map','attributes','stringify','catch','ShowChatQueue','find','lodash','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x51f9,0x132));var _0x951f=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0x51f9[_0x466247];return _0x4b352e;};'use strict';var _=require(_0x951f('0x0'));var util=require(_0x951f('0x1'));var moment=require('moment');var BPromise=require(_0x951f('0x2'));var rs=require(_0x951f('0x3'));var fs=require('fs');var Redis=require(_0x951f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x951f('0x5'));var logger=require(_0x951f('0x6'))(_0x951f('0x7'));var config=require(_0x951f('0x8'));var jayson=require(_0x951f('0x9'));var client=jayson[_0x951f('0xa')][_0x951f('0xb')]({'port':0x232a});config['redis']=_[_0x951f('0xc')](config[_0x951f('0xd')],{'host':_0x951f('0xe'),'port':0x18eb});var socket=require(_0x951f('0xf'))(new Redis(config[_0x951f('0xd')]));require(_0x951f('0x10'))[_0x951f('0x11')](socket);function respondWithRpcPromise(_0x3b0a01,_0x453eac,_0x110e9a){return new BPromise(function(_0xf8c622,_0x135985){return client[_0x951f('0x12')](_0x3b0a01,_0x110e9a)[_0x951f('0x13')](function(_0x2c582b){logger[_0x951f('0x14')]('ChatQueue,\x20%s,\x20%s',_0x453eac,'request\x20sent');logger[_0x951f('0x15')](_0x951f('0x16'),_0x453eac,_0x951f('0x17'),JSON['stringify'](_0x2c582b));if(_0x2c582b[_0x951f('0x18')]){if(_0x2c582b['error'][_0x951f('0x19')]===0x1f4){logger[_0x951f('0x18')](_0x951f('0x1a'),_0x453eac,_0x2c582b[_0x951f('0x18')][_0x951f('0x1b')]);return _0x135985(_0x2c582b['error'][_0x951f('0x1b')]);}logger[_0x951f('0x18')](_0x951f('0x1a'),_0x453eac,_0x2c582b[_0x951f('0x18')][_0x951f('0x1b')]);return _0xf8c622(_0x2c582b[_0x951f('0x18')][_0x951f('0x1b')]);}else{logger[_0x951f('0x14')](_0x951f('0x1a'),_0x453eac,_0x951f('0x17'));_0xf8c622(_0x2c582b[_0x951f('0x1c')][_0x951f('0x1b')]);}})['catch'](function(_0x3b7994){logger[_0x951f('0x18')](_0x951f('0x1a'),_0x453eac,_0x3b7994);_0x135985(_0x3b7994);});});}exports[_0x951f('0x1d')]=function(_0x36bed2){var _0x4a72fc=this;return new Promise(function(_0xd65ad2,_0x492e75){return db[_0x951f('0x1e')][_0x951f('0x1f')]({'raw':_0x36bed2['options']?_0x36bed2[_0x951f('0x20')][_0x951f('0x21')]===undefined?!![]:![]:!![],'where':_0x36bed2[_0x951f('0x20')]?_0x36bed2['options'][_0x951f('0x22')]||null:null,'attributes':_0x36bed2[_0x951f('0x20')]?_0x36bed2['options']['attributes']||null:null,'limit':_0x36bed2[_0x951f('0x20')]?_0x36bed2[_0x951f('0x20')][_0x951f('0x23')]||null:null,'include':_0x36bed2[_0x951f('0x20')]?_0x36bed2[_0x951f('0x20')]['include']?_['map'](_0x36bed2[_0x951f('0x20')][_0x951f('0x24')],function(_0x5d5698){return{'model':db[_0x5d5698[_0x951f('0x25')]],'as':_0x5d5698['as'],'attributes':_0x5d5698['attributes'],'include':_0x5d5698[_0x951f('0x24')]?_[_0x951f('0x26')](_0x5d5698['include'],function(_0x5f5af3){return{'model':db[_0x5f5af3[_0x951f('0x25')]],'as':_0x5f5af3['as'],'attributes':_0x5f5af3['attributes'],'include':_0x5f5af3['include']?_['map'](_0x5f5af3['include'],function(_0x1d69a1){return{'model':db[_0x1d69a1['model']],'as':_0x1d69a1['as'],'attributes':_0x1d69a1[_0x951f('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59b50b){logger[_0x951f('0x14')](_0x951f('0x1d'),_0x36bed2);logger[_0x951f('0x15')]('GetChatQueue',_0x36bed2,JSON[_0x951f('0x28')](_0x59b50b));_0xd65ad2(_0x59b50b);})[_0x951f('0x29')](function(_0x57ed97){logger['error'](_0x951f('0x1d'),_0x57ed97[_0x951f('0x1b')],_0x36bed2);_0x492e75(_0x4a72fc[_0x951f('0x18')](0x1f4,_0x57ed97[_0x951f('0x1b')]));});});};exports[_0x951f('0x2a')]=function(_0x2355bf){var _0x56ad04=this;return new Promise(function(_0x41f82a,_0x154bec){return db[_0x951f('0x1e')][_0x951f('0x2b')]({'raw':_0x2355bf[_0x951f('0x20')]?_0x2355bf[_0x951f('0x20')][_0x951f('0x21')]===undefined?!![]:![]:!![],'where':_0x2355bf[_0x951f('0x20')]?_0x2355bf[_0x951f('0x20')][_0x951f('0x22')]||null:null,'attributes':_0x2355bf['options']?_0x2355bf[_0x951f('0x20')][_0x951f('0x27')]||null:null,'include':_0x2355bf[_0x951f('0x20')]?_0x2355bf[_0x951f('0x20')][_0x951f('0x24')]?_['map'](_0x2355bf[_0x951f('0x20')]['include'],function(_0x1e52b4){return{'model':db[_0x1e52b4[_0x951f('0x25')]],'as':_0x1e52b4['as'],'attributes':_0x1e52b4[_0x951f('0x27')],'include':_0x1e52b4[_0x951f('0x24')]?_[_0x951f('0x26')](_0x1e52b4[_0x951f('0x24')],function(_0x35f1ed){return{'model':db[_0x35f1ed[_0x951f('0x25')]],'as':_0x35f1ed['as'],'attributes':_0x35f1ed[_0x951f('0x27')],'include':_0x35f1ed['include']?_[_0x951f('0x26')](_0x35f1ed[_0x951f('0x24')],function(_0x424143){return{'model':db[_0x424143[_0x951f('0x25')]],'as':_0x424143['as'],'attributes':_0x424143[_0x951f('0x27')]};}):[]};}):[]};}):[]:[]})[_0x951f('0x13')](function(_0x593f0f){logger['info'](_0x951f('0x2a'),_0x2355bf);logger[_0x951f('0x15')]('ShowChatQueue',_0x2355bf,JSON[_0x951f('0x28')](_0x593f0f));_0x41f82a(_0x593f0f);})[_0x951f('0x29')](function(_0x36da2d){logger[_0x951f('0x18')](_0x951f('0x2a'),_0x36da2d[_0x951f('0x1b')],_0x2355bf);_0x154bec(_0x56ad04[_0x951f('0x18')](0x1f4,_0x36da2d['message']));});});}; \ No newline at end of file +var _0xaa56=['../../config/utils','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','options','attributes','limit','include','map','model','ShowChatQueue','ChatQueue','where','util','moment','randomstring','ioredis'];(function(_0x4c59c1,_0x2529ec){var _0x2fc4bd=function(_0x1795a0){while(--_0x1795a0){_0x4c59c1['push'](_0x4c59c1['shift']());}};_0x2fc4bd(++_0x2529ec);}(_0xaa56,0x1ac));var _0x6aa5=function(_0x51949d,_0x5715bc){_0x51949d=_0x51949d-0x0;var _0x4614e8=_0xaa56[_0x51949d];return _0x4614e8;};'use strict';var _=require('lodash');var util=require(_0x6aa5('0x0'));var moment=require(_0x6aa5('0x1'));var BPromise=require('bluebird');var rs=require(_0x6aa5('0x2'));var fs=require('fs');var Redis=require(_0x6aa5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6aa5('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6aa5('0x5'));var jayson=require(_0x6aa5('0x6'));var client=jayson[_0x6aa5('0x7')][_0x6aa5('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x6aa5('0x9'),'port':0x18eb});var socket=require(_0x6aa5('0xa'))(new Redis(config['redis']));require(_0x6aa5('0xb'))[_0x6aa5('0xc')](socket);function respondWithRpcPromise(_0x268e07,_0xe703f1,_0x24e44c){return new BPromise(function(_0x2c689f,_0x17c0df){return client[_0x6aa5('0xd')](_0x268e07,_0x24e44c)[_0x6aa5('0xe')](function(_0x643691){logger[_0x6aa5('0xf')]('ChatQueue,\x20%s,\x20%s',_0xe703f1,_0x6aa5('0x10'));logger[_0x6aa5('0x11')](_0x6aa5('0x12'),_0xe703f1,'request\x20sent',JSON[_0x6aa5('0x13')](_0x643691));if(_0x643691[_0x6aa5('0x14')]){if(_0x643691[_0x6aa5('0x14')][_0x6aa5('0x15')]===0x1f4){logger[_0x6aa5('0x14')](_0x6aa5('0x16'),_0xe703f1,_0x643691[_0x6aa5('0x14')][_0x6aa5('0x17')]);return _0x17c0df(_0x643691[_0x6aa5('0x14')]['message']);}logger[_0x6aa5('0x14')]('ChatQueue,\x20%s,\x20%s',_0xe703f1,_0x643691[_0x6aa5('0x14')][_0x6aa5('0x17')]);return _0x2c689f(_0x643691['error'][_0x6aa5('0x17')]);}else{logger[_0x6aa5('0xf')]('ChatQueue,\x20%s,\x20%s',_0xe703f1,_0x6aa5('0x10'));_0x2c689f(_0x643691[_0x6aa5('0x18')][_0x6aa5('0x17')]);}})[_0x6aa5('0x19')](function(_0x2fded3){logger['error'](_0x6aa5('0x16'),_0xe703f1,_0x2fded3);_0x17c0df(_0x2fded3);});});}exports[_0x6aa5('0x1a')]=function(_0x1f6458){var _0x1e0b1a=this;return new Promise(function(_0xd80c38,_0x1c1a91){return db['ChatQueue']['findAll']({'raw':_0x1f6458['options']?_0x1f6458[_0x6aa5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1f6458[_0x6aa5('0x1b')]?_0x1f6458[_0x6aa5('0x1b')]['where']||null:null,'attributes':_0x1f6458[_0x6aa5('0x1b')]?_0x1f6458[_0x6aa5('0x1b')][_0x6aa5('0x1c')]||null:null,'limit':_0x1f6458[_0x6aa5('0x1b')]?_0x1f6458['options'][_0x6aa5('0x1d')]||null:null,'include':_0x1f6458[_0x6aa5('0x1b')]?_0x1f6458[_0x6aa5('0x1b')][_0x6aa5('0x1e')]?_[_0x6aa5('0x1f')](_0x1f6458[_0x6aa5('0x1b')][_0x6aa5('0x1e')],function(_0x132f13){return{'model':db[_0x132f13['model']],'as':_0x132f13['as'],'attributes':_0x132f13['attributes'],'include':_0x132f13[_0x6aa5('0x1e')]?_[_0x6aa5('0x1f')](_0x132f13['include'],function(_0x563805){return{'model':db[_0x563805[_0x6aa5('0x20')]],'as':_0x563805['as'],'attributes':_0x563805['attributes'],'include':_0x563805[_0x6aa5('0x1e')]?_[_0x6aa5('0x1f')](_0x563805[_0x6aa5('0x1e')],function(_0x482e8f){return{'model':db[_0x482e8f[_0x6aa5('0x20')]],'as':_0x482e8f['as'],'attributes':_0x482e8f[_0x6aa5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ca2a3){logger[_0x6aa5('0xf')](_0x6aa5('0x1a'),_0x1f6458);logger[_0x6aa5('0x11')](_0x6aa5('0x1a'),_0x1f6458,JSON[_0x6aa5('0x13')](_0x2ca2a3));_0xd80c38(_0x2ca2a3);})[_0x6aa5('0x19')](function(_0x2f4952){logger[_0x6aa5('0x14')](_0x6aa5('0x1a'),_0x2f4952[_0x6aa5('0x17')],_0x1f6458);_0x1c1a91(_0x1e0b1a[_0x6aa5('0x14')](0x1f4,_0x2f4952[_0x6aa5('0x17')]));});});};exports[_0x6aa5('0x21')]=function(_0x44bf86){var _0x263e1e=this;return new Promise(function(_0x40e3c7,_0x5d2669){return db[_0x6aa5('0x22')]['find']({'raw':_0x44bf86[_0x6aa5('0x1b')]?_0x44bf86[_0x6aa5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x44bf86[_0x6aa5('0x1b')]?_0x44bf86[_0x6aa5('0x1b')][_0x6aa5('0x23')]||null:null,'attributes':_0x44bf86[_0x6aa5('0x1b')]?_0x44bf86[_0x6aa5('0x1b')][_0x6aa5('0x1c')]||null:null,'include':_0x44bf86['options']?_0x44bf86['options'][_0x6aa5('0x1e')]?_[_0x6aa5('0x1f')](_0x44bf86['options'][_0x6aa5('0x1e')],function(_0x9e3915){return{'model':db[_0x9e3915[_0x6aa5('0x20')]],'as':_0x9e3915['as'],'attributes':_0x9e3915[_0x6aa5('0x1c')],'include':_0x9e3915[_0x6aa5('0x1e')]?_[_0x6aa5('0x1f')](_0x9e3915['include'],function(_0x52a091){return{'model':db[_0x52a091[_0x6aa5('0x20')]],'as':_0x52a091['as'],'attributes':_0x52a091[_0x6aa5('0x1c')],'include':_0x52a091['include']?_['map'](_0x52a091['include'],function(_0x4d8494){return{'model':db[_0x4d8494[_0x6aa5('0x20')]],'as':_0x4d8494['as'],'attributes':_0x4d8494[_0x6aa5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6aa5('0xe')](function(_0x15aa86){logger[_0x6aa5('0xf')](_0x6aa5('0x21'),_0x44bf86);logger[_0x6aa5('0x11')](_0x6aa5('0x21'),_0x44bf86,JSON[_0x6aa5('0x13')](_0x15aa86));_0x40e3c7(_0x15aa86);})[_0x6aa5('0x19')](function(_0x262558){logger[_0x6aa5('0x14')](_0x6aa5('0x21'),_0x262558['message'],_0x44bf86);_0x5d2669(_0x263e1e[_0x6aa5('0x14')](0x1f4,_0x262558['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 9a320c5..1ec5018 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 _0x579c=['chatQueue:','./chatQueue.events','save','remove','update','removeListener','register'];(function(_0x130b0b,_0x23bdf4){var _0x48062d=function(_0x1cf46b){while(--_0x1cf46b){_0x130b0b['push'](_0x130b0b['shift']());}};_0x48062d(++_0x23bdf4);}(_0x579c,0xda));var _0xc579=function(_0x3ab0bc,_0xc5a476){_0x3ab0bc=_0x3ab0bc-0x0;var _0x4625b4=_0x579c[_0x3ab0bc];return _0x4625b4;};'use strict';var ChatQueueEvents=require(_0xc579('0x0'));var events=[_0xc579('0x1'),_0xc579('0x2'),_0xc579('0x3')];function createListener(_0x397136,_0x586948){return function(_0x1e2808){_0x586948['emit'](_0x397136,_0x1e2808);};}function removeListener(_0x21a0a2,_0x3b913c){return function(){ChatQueueEvents[_0xc579('0x4')](_0x21a0a2,_0x3b913c);};}exports[_0xc579('0x5')]=function(_0x124ee5){for(var _0x1bd276=0x0,_0x2e451b=events['length'];_0x1bd276<_0x2e451b;_0x1bd276++){var _0x1c6d9c=events[_0x1bd276];var _0x293c4a=createListener(_0xc579('0x6')+_0x1c6d9c,_0x124ee5);ChatQueueEvents['on'](_0x1c6d9c,_0x293c4a);}}; \ No newline at end of file +var _0x04de=['save','remove','update','emit','removeListener','length','chatQueue:','./chatQueue.events'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x04de,0x107));var _0xe04d=function(_0x3df0da,_0x4046f7){_0x3df0da=_0x3df0da-0x0;var _0x4afedb=_0x04de[_0x3df0da];return _0x4afedb;};'use strict';var ChatQueueEvents=require(_0xe04d('0x0'));var events=[_0xe04d('0x1'),_0xe04d('0x2'),_0xe04d('0x3')];function createListener(_0x1e650d,_0x28f63f){return function(_0x1113af){_0x28f63f[_0xe04d('0x4')](_0x1e650d,_0x1113af);};}function removeListener(_0x2593a4,_0x70ead0){return function(){ChatQueueEvents[_0xe04d('0x5')](_0x2593a4,_0x70ead0);};}exports['register']=function(_0x4bb925){for(var _0x4f7637=0x0,_0x531688=events[_0xe04d('0x6')];_0x4f7637<_0x531688;_0x4f7637++){var _0x210e93=events[_0x4f7637];var _0x72b1ce=createListener(_0xe04d('0x7')+_0x210e93,_0x4bb925);ChatQueueEvents['on'](_0x210e93,_0x72b1ce);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index ca509f7..7c85b38 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 _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x202e0a,_0x4fd76b){var _0xf368ba=function(_0x2865c7){while(--_0x2865c7){_0x202e0a['push'](_0x202e0a['shift']());}};_0xf368ba(++_0x4fd76b);}(_0x814b,0x1a2));var _0xb814=function(_0x2a5b3b,_0x4ebe31){_0x2a5b3b=_0x2a5b3b-0x0;var _0xae665a=_0x814b[_0x2a5b3b];return _0xae665a;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x5fc3,0xa8));var _0x35fc=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x5fc3[_0x254b22];return _0x1279db;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 6045beb..59192e1 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 _0x0e39=['STRING','DATE','moment','sequelize','exports'];(function(_0xb5e1dd,_0x2dc4c2){var _0xfa5b12=function(_0x38f0a4){while(--_0x38f0a4){_0xb5e1dd['push'](_0xb5e1dd['shift']());}};_0xfa5b12(++_0x2dc4c2);}(_0x0e39,0x11a));var _0x90e3=function(_0x2cee34,_0x7e21a9){_0x2cee34=_0x2cee34-0x0;var _0x5a369e=_0x0e39[_0x2cee34];return _0x5a369e;};'use strict';var moment=require(_0x90e3('0x0'));var Sequelize=require(_0x90e3('0x1'));module[_0x90e3('0x2')]={'uniqueid':{'type':Sequelize[_0x90e3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x90e3('0x3')]},'joinAt':{'type':Sequelize[_0x90e3('0x4')]},'leaveAt':{'type':Sequelize[_0x90e3('0x4')]},'acceptAt':{'type':Sequelize[_0x90e3('0x4')]},'exitAt':{'type':Sequelize[_0x90e3('0x4')]},'reason':{'type':Sequelize[_0x90e3('0x3')]}}; \ No newline at end of file +var _0x7ea0=['moment','exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ea0,0x1b0));var _0x07ea=function(_0x17a472,_0x324bb8){_0x17a472=_0x17a472-0x0;var _0x1cbad3=_0x7ea0[_0x17a472];return _0x1cbad3;};'use strict';var moment=require(_0x07ea('0x0'));var Sequelize=require('sequelize');module[_0x07ea('0x1')]={'uniqueid':{'type':Sequelize[_0x07ea('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x07ea('0x3')]},'leaveAt':{'type':Sequelize[_0x07ea('0x3')]},'acceptAt':{'type':Sequelize[_0x07ea('0x3')]},'exitAt':{'type':Sequelize[_0x07ea('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 697f524..39aaa4b 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 _0x5d95=['count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x290e98,_0x368978){var _0x48fbd1=function(_0x26fa98){while(--_0x26fa98){_0x290e98['push'](_0x290e98['shift']());}};_0x48fbd1(++_0x368978);}(_0x5d95,0x77));var _0x55d9=function(_0x1fdfe1,_0xeabf7b){_0x1fdfe1=_0x1fdfe1-0x0;var _0x2708cc=_0x5d95[_0x1fdfe1];return _0x2708cc;};'use strict';var emlformat=require(_0x55d9('0x0'));var rimraf=require(_0x55d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55d9('0x2'));var rp=require(_0x55d9('0x3'));var moment=require(_0x55d9('0x4'));var BPromise=require(_0x55d9('0x5'));var Mustache=require(_0x55d9('0x6'));var util=require('util');var path=require(_0x55d9('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x55d9('0x8'));var fs=require('fs');var fs_extra=require(_0x55d9('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x55d9('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x55d9('0xb'));var authService=require(_0x55d9('0xc'));var qs=require(_0x55d9('0xd'));var as=require(_0x55d9('0xe'));var hardwareService=require(_0x55d9('0xf'));var logger=require(_0x55d9('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x55d9('0x11'));var licenseUtil=require(_0x55d9('0x12'));var db=require(_0x55d9('0x13'))['db'];function respondWithStatusCode(_0x44e501,_0x134318){_0x134318=_0x134318||0xcc;return function(_0x244af1){if(_0x244af1){return _0x44e501[_0x55d9('0x14')](_0x134318);}return _0x44e501[_0x55d9('0x15')](_0x134318)[_0x55d9('0x16')]();};}function respondWithResult(_0x581e43,_0x97a577){_0x97a577=_0x97a577||0xc8;return function(_0x39967c){if(_0x39967c){return _0x581e43[_0x55d9('0x15')](_0x97a577)[_0x55d9('0x17')](_0x39967c);}};}function respondWithFilteredResult(_0x2c3111,_0x3ec410){return function(_0x25fcf7){if(_0x25fcf7){var _0x5c66e2=typeof _0x3ec410[_0x55d9('0x18')]===_0x55d9('0x19')&&typeof _0x3ec410[_0x55d9('0x1a')]===_0x55d9('0x19');var _0x45a0cc=_0x25fcf7[_0x55d9('0x1b')];var _0x50faa6=_0x5c66e2?0x0:_0x3ec410[_0x55d9('0x18')];var _0x1af997=_0x5c66e2?_0x25fcf7['count']:_0x3ec410['offset']+_0x3ec410['limit'];var _0xed70ef;if(_0x1af997>=_0x45a0cc){_0x1af997=_0x45a0cc;_0xed70ef=0xc8;}else{_0xed70ef=0xce;}_0x2c3111[_0x55d9('0x15')](_0xed70ef);return _0x2c3111[_0x55d9('0x1c')](_0x55d9('0x1d'),_0x50faa6+'-'+_0x1af997+'/'+_0x45a0cc)['json'](_0x25fcf7);}return null;};}function patchUpdates(_0x13d435){return function(_0x2f4811){try{jsonpatch[_0x55d9('0x1e')](_0x2f4811,_0x13d435,!![]);}catch(_0x556d6f){return BPromise[_0x55d9('0x1f')](_0x556d6f);}return _0x2f4811[_0x55d9('0x20')]();};}function saveUpdates(_0x368cc7,_0xbfb957){return function(_0x54c648){if(_0x54c648){return _0x54c648['update'](_0x368cc7)[_0x55d9('0x21')](function(_0x416cc6){return _0x416cc6;});}return null;};}function removeEntity(_0x1f1b46,_0x3e1eef){return function(_0x334a6b){if(_0x334a6b){return _0x334a6b[_0x55d9('0x22')]()[_0x55d9('0x21')](function(){_0x1f1b46[_0x55d9('0x15')](0xcc)[_0x55d9('0x16')]();});}};}function handleEntityNotFound(_0x4bd725,_0x2686d7){return function(_0x2c5d21){if(!_0x2c5d21){_0x4bd725['sendStatus'](0x194);}return _0x2c5d21;};}function handleError(_0x267e5f,_0x581ee8){_0x581ee8=_0x581ee8||0x1f4;return function(_0x2c1890){logger[_0x55d9('0x23')](_0x2c1890[_0x55d9('0x24')]);if(_0x2c1890[_0x55d9('0x25')]){delete _0x2c1890[_0x55d9('0x25')];}_0x267e5f['status'](_0x581ee8)[_0x55d9('0x26')](_0x2c1890);};}exports['index']=function(_0x4c1bbe,_0x224c2a){var _0x3bb455={},_0x1b18bb={},_0x4d0027={'count':0x0,'rows':[]};var _0x3536a7=_[_0x55d9('0x27')](db[_0x55d9('0x28')][_0x55d9('0x29')],function(_0x1c89cd){return{'name':_0x1c89cd[_0x55d9('0x2a')],'type':_0x1c89cd[_0x55d9('0x2b')][_0x55d9('0x2c')]};});_0x1b18bb[_0x55d9('0x2d')]=_[_0x55d9('0x27')](_0x3536a7,_0x55d9('0x25'));_0x1b18bb[_0x55d9('0x2e')]=_[_0x55d9('0x2f')](_0x4c1bbe[_0x55d9('0x2e')]);_0x1b18bb[_0x55d9('0x30')]=_[_0x55d9('0x31')](_0x1b18bb[_0x55d9('0x2d')],_0x1b18bb[_0x55d9('0x2e')]);_0x3bb455[_0x55d9('0x32')]=_[_0x55d9('0x31')](_0x1b18bb[_0x55d9('0x2d')],qs[_0x55d9('0x33')](_0x4c1bbe[_0x55d9('0x2e')][_0x55d9('0x33')]));_0x3bb455['attributes']=_0x3bb455['attributes'][_0x55d9('0x34')]?_0x3bb455[_0x55d9('0x32')]:_0x1b18bb[_0x55d9('0x2d')];if(!_0x4c1bbe[_0x55d9('0x2e')][_0x55d9('0x35')](_0x55d9('0x36'))){_0x3bb455[_0x55d9('0x1a')]=qs[_0x55d9('0x1a')](_0x4c1bbe['query'][_0x55d9('0x1a')]);_0x3bb455[_0x55d9('0x18')]=qs[_0x55d9('0x18')](_0x4c1bbe[_0x55d9('0x2e')][_0x55d9('0x18')]);}_0x3bb455['order']=qs[_0x55d9('0x37')](_0x4c1bbe[_0x55d9('0x2e')][_0x55d9('0x37')]);_0x3bb455[_0x55d9('0x38')]=qs[_0x55d9('0x30')](_[_0x55d9('0x39')](_0x4c1bbe[_0x55d9('0x2e')],_0x1b18bb[_0x55d9('0x30')]),_0x3536a7);if(_0x4c1bbe[_0x55d9('0x2e')][_0x55d9('0x3a')]){_0x3bb455[_0x55d9('0x38')]=_[_0x55d9('0x3b')](_0x3bb455[_0x55d9('0x38')],{'$or':_[_0x55d9('0x27')](_0x3536a7,function(_0xc8484d){if(_0xc8484d[_0x55d9('0x2b')]!==_0x55d9('0x3c')){var _0x5f47ba={};_0x5f47ba[_0xc8484d[_0x55d9('0x25')]]={'$like':'%'+_0x4c1bbe['query'][_0x55d9('0x3a')]+'%'};return _0x5f47ba;}})});}_0x3bb455=_[_0x55d9('0x3b')]({},_0x3bb455,_0x4c1bbe[_0x55d9('0x3d')]);var _0x1b8969={'where':_0x3bb455['where']};return db[_0x55d9('0x28')][_0x55d9('0x1b')](_0x1b8969)[_0x55d9('0x21')](function(_0x1ee925){_0x4d0027['count']=_0x1ee925;if(_0x4c1bbe['query'][_0x55d9('0x3e')]){_0x3bb455[_0x55d9('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x3bb455);})[_0x55d9('0x21')](function(_0x3f0cee){_0x4d0027[_0x55d9('0x40')]=_0x3f0cee;return _0x4d0027;})[_0x55d9('0x21')](respondWithFilteredResult(_0x224c2a,_0x3bb455))[_0x55d9('0x41')](handleError(_0x224c2a,null));};exports[_0x55d9('0x42')]=function(_0x59a39e,_0x4236aa){var _0x16424b={'raw':!![],'where':{'id':_0x59a39e[_0x55d9('0x43')]['id']}},_0xb71831={};_0xb71831[_0x55d9('0x2d')]=_['keys'](db['ChatQueueReport'][_0x55d9('0x29')]);_0xb71831[_0x55d9('0x2e')]=_[_0x55d9('0x2f')](_0x59a39e[_0x55d9('0x2e')]);_0xb71831[_0x55d9('0x30')]=_[_0x55d9('0x31')](_0xb71831[_0x55d9('0x2d')],_0xb71831['query']);_0x16424b[_0x55d9('0x32')]=_[_0x55d9('0x31')](_0xb71831[_0x55d9('0x2d')],qs[_0x55d9('0x33')](_0x59a39e[_0x55d9('0x2e')]['fields']));_0x16424b['attributes']=_0x16424b[_0x55d9('0x32')]['length']?_0x16424b[_0x55d9('0x32')]:_0xb71831['model'];if(_0x59a39e[_0x55d9('0x2e')][_0x55d9('0x3e')]){_0x16424b[_0x55d9('0x3f')]=[{'all':!![]}];}_0x16424b=_[_0x55d9('0x3b')]({},_0x16424b,_0x59a39e['options']);return db[_0x55d9('0x28')]['find'](_0x16424b)['then'](handleEntityNotFound(_0x4236aa,null))['then'](respondWithResult(_0x4236aa,null))[_0x55d9('0x41')](handleError(_0x4236aa,null));};exports[_0x55d9('0x44')]=function(_0x5f0954,_0x246b81){return db['ChatQueueReport'][_0x55d9('0x44')](_0x5f0954[_0x55d9('0x45')],{})[_0x55d9('0x21')](respondWithResult(_0x246b81,0xc9))[_0x55d9('0x41')](handleError(_0x246b81,null));};exports[_0x55d9('0x46')]=function(_0x576013,_0x5c853b){if(_0x576013[_0x55d9('0x45')]['id']){delete _0x576013[_0x55d9('0x45')]['id'];}return db[_0x55d9('0x28')][_0x55d9('0x47')]({'where':{'id':_0x576013[_0x55d9('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c853b,null))[_0x55d9('0x21')](saveUpdates(_0x576013[_0x55d9('0x45')],null))[_0x55d9('0x21')](respondWithResult(_0x5c853b,null))[_0x55d9('0x41')](handleError(_0x5c853b,null));};exports[_0x55d9('0x22')]=function(_0x3b8e1f,_0x8e8814){return db['ChatQueueReport'][_0x55d9('0x47')]({'where':{'id':_0x3b8e1f[_0x55d9('0x43')]['id']}})[_0x55d9('0x21')](handleEntityNotFound(_0x8e8814,null))[_0x55d9('0x21')](removeEntity(_0x8e8814,null))[_0x55d9('0x41')](handleError(_0x8e8814,null));};exports['describe']=function(_0x345e6c,_0x595644){return db[_0x55d9('0x28')][_0x55d9('0x48')]()[_0x55d9('0x21')](respondWithResult(_0x595644,null))[_0x55d9('0x41')](handleError(_0x595644,null));}; \ No newline at end of file +var _0x5e8d=['then','end','error','stack','name','index','ChatQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','length','includeAll','include','find','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x34d867,_0x3b8f27){_0x34d867=_0x34d867-0x0;var _0x3412f4=_0x5e8d[_0x34d867];return _0x3412f4;};'use strict';var emlformat=require(_0xd5e8('0x0'));var rimraf=require(_0xd5e8('0x1'));var zipdir=require(_0xd5e8('0x2'));var jsonpatch=require(_0xd5e8('0x3'));var rp=require(_0xd5e8('0x4'));var moment=require(_0xd5e8('0x5'));var BPromise=require(_0xd5e8('0x6'));var Mustache=require('mustache');var util=require(_0xd5e8('0x7'));var path=require(_0xd5e8('0x8'));var sox=require('sox');var csv=require(_0xd5e8('0x9'));var ejs=require(_0xd5e8('0xa'));var fs=require('fs');var fs_extra=require(_0xd5e8('0xb'));var _=require('lodash');var squel=require(_0xd5e8('0xc'));var crypto=require(_0xd5e8('0xd'));var jsforce=require(_0xd5e8('0xe'));var deskjs=require(_0xd5e8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd5e8('0x10'));var Redis=require(_0xd5e8('0x11'));var authService=require(_0xd5e8('0x12'));var qs=require(_0xd5e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd5e8('0x14'));var logger=require(_0xd5e8('0x15'))('api');var utils=require(_0xd5e8('0x16'));var config=require(_0xd5e8('0x17'));var licenseUtil=require(_0xd5e8('0x18'));var db=require(_0xd5e8('0x19'))['db'];function respondWithStatusCode(_0xd8fa54,_0x3b2780){_0x3b2780=_0x3b2780||0xcc;return function(_0x397eb3){if(_0x397eb3){return _0xd8fa54[_0xd5e8('0x1a')](_0x3b2780);}return _0xd8fa54[_0xd5e8('0x1b')](_0x3b2780)['end']();};}function respondWithResult(_0x5a6665,_0x457bfb){_0x457bfb=_0x457bfb||0xc8;return function(_0x32de91){if(_0x32de91){return _0x5a6665[_0xd5e8('0x1b')](_0x457bfb)[_0xd5e8('0x1c')](_0x32de91);}};}function respondWithFilteredResult(_0x5a35cd,_0x399cb1){return function(_0x489a8e){if(_0x489a8e){var _0x2ef357=typeof _0x399cb1[_0xd5e8('0x1d')]===_0xd5e8('0x1e')&&typeof _0x399cb1[_0xd5e8('0x1f')]==='undefined';var _0x3daf6a=_0x489a8e[_0xd5e8('0x20')];var _0x529d45=_0x2ef357?0x0:_0x399cb1[_0xd5e8('0x1d')];var _0x1be884=_0x2ef357?_0x489a8e[_0xd5e8('0x20')]:_0x399cb1[_0xd5e8('0x1d')]+_0x399cb1[_0xd5e8('0x1f')];var _0x196648;if(_0x1be884>=_0x3daf6a){_0x1be884=_0x3daf6a;_0x196648=0xc8;}else{_0x196648=0xce;}_0x5a35cd[_0xd5e8('0x1b')](_0x196648);return _0x5a35cd[_0xd5e8('0x21')]('Content-Range',_0x529d45+'-'+_0x1be884+'/'+_0x3daf6a)[_0xd5e8('0x1c')](_0x489a8e);}return null;};}function patchUpdates(_0x1b1631){return function(_0x2c4fde){try{jsonpatch[_0xd5e8('0x22')](_0x2c4fde,_0x1b1631,!![]);}catch(_0x26b187){return BPromise[_0xd5e8('0x23')](_0x26b187);}return _0x2c4fde[_0xd5e8('0x24')]();};}function saveUpdates(_0x1d515d,_0x45bb02){return function(_0x33a4ff){if(_0x33a4ff){return _0x33a4ff[_0xd5e8('0x25')](_0x1d515d)[_0xd5e8('0x26')](function(_0x4592e5){return _0x4592e5;});}return null;};}function removeEntity(_0x5bfbb2,_0x4a133e){return function(_0x5f177c){if(_0x5f177c){return _0x5f177c['destroy']()[_0xd5e8('0x26')](function(){_0x5bfbb2['status'](0xcc)[_0xd5e8('0x27')]();});}};}function handleEntityNotFound(_0x3b1a69,_0x4add91){return function(_0x4efec6){if(!_0x4efec6){_0x3b1a69[_0xd5e8('0x1a')](0x194);}return _0x4efec6;};}function handleError(_0xfaad96,_0x2e220b){_0x2e220b=_0x2e220b||0x1f4;return function(_0x26018b){logger[_0xd5e8('0x28')](_0x26018b[_0xd5e8('0x29')]);if(_0x26018b[_0xd5e8('0x2a')]){delete _0x26018b[_0xd5e8('0x2a')];}_0xfaad96[_0xd5e8('0x1b')](_0x2e220b)['send'](_0x26018b);};}exports[_0xd5e8('0x2b')]=function(_0x570e6a,_0x2aa786){var _0x24f7e1={},_0x38414b={},_0x180d1f={'count':0x0,'rows':[]};var _0x1bbcb7=_['map'](db[_0xd5e8('0x2c')][_0xd5e8('0x2d')],function(_0x49276c){return{'name':_0x49276c[_0xd5e8('0x2e')],'type':_0x49276c['type'][_0xd5e8('0x2f')]};});_0x38414b[_0xd5e8('0x30')]=_[_0xd5e8('0x31')](_0x1bbcb7,_0xd5e8('0x2a'));_0x38414b[_0xd5e8('0x32')]=_[_0xd5e8('0x33')](_0x570e6a[_0xd5e8('0x32')]);_0x38414b[_0xd5e8('0x34')]=_['intersection'](_0x38414b[_0xd5e8('0x30')],_0x38414b[_0xd5e8('0x32')]);_0x24f7e1[_0xd5e8('0x35')]=_[_0xd5e8('0x36')](_0x38414b[_0xd5e8('0x30')],qs[_0xd5e8('0x37')](_0x570e6a[_0xd5e8('0x32')][_0xd5e8('0x37')]));_0x24f7e1['attributes']=_0x24f7e1['attributes']['length']?_0x24f7e1[_0xd5e8('0x35')]:_0x38414b[_0xd5e8('0x30')];if(!_0x570e6a[_0xd5e8('0x32')][_0xd5e8('0x38')](_0xd5e8('0x39'))){_0x24f7e1[_0xd5e8('0x1f')]=qs[_0xd5e8('0x1f')](_0x570e6a['query']['limit']);_0x24f7e1[_0xd5e8('0x1d')]=qs[_0xd5e8('0x1d')](_0x570e6a[_0xd5e8('0x32')][_0xd5e8('0x1d')]);}_0x24f7e1[_0xd5e8('0x3a')]=qs[_0xd5e8('0x3b')](_0x570e6a[_0xd5e8('0x32')][_0xd5e8('0x3b')]);_0x24f7e1[_0xd5e8('0x3c')]=qs[_0xd5e8('0x34')](_[_0xd5e8('0x3d')](_0x570e6a['query'],_0x38414b[_0xd5e8('0x34')]),_0x1bbcb7);if(_0x570e6a['query'][_0xd5e8('0x3e')]){_0x24f7e1['where']=_[_0xd5e8('0x3f')](_0x24f7e1['where'],{'$or':_[_0xd5e8('0x31')](_0x1bbcb7,function(_0x3f89fa){if(_0x3f89fa[_0xd5e8('0x40')]!==_0xd5e8('0x41')){var _0x39655c={};_0x39655c[_0x3f89fa[_0xd5e8('0x2a')]]={'$like':'%'+_0x570e6a['query']['filter']+'%'};return _0x39655c;}})});}_0x24f7e1=_[_0xd5e8('0x3f')]({},_0x24f7e1,_0x570e6a[_0xd5e8('0x42')]);var _0x4dc9d3={'where':_0x24f7e1['where']};return db[_0xd5e8('0x2c')][_0xd5e8('0x20')](_0x4dc9d3)[_0xd5e8('0x26')](function(_0x1c381c){_0x180d1f[_0xd5e8('0x20')]=_0x1c381c;if(_0x570e6a[_0xd5e8('0x32')]['includeAll']){_0x24f7e1['include']=[{'all':!![]}];}return db[_0xd5e8('0x2c')][_0xd5e8('0x43')](_0x24f7e1);})['then'](function(_0x13c718){_0x180d1f[_0xd5e8('0x44')]=_0x13c718;return _0x180d1f;})[_0xd5e8('0x26')](respondWithFilteredResult(_0x2aa786,_0x24f7e1))[_0xd5e8('0x45')](handleError(_0x2aa786,null));};exports[_0xd5e8('0x46')]=function(_0xc682e6,_0x488c46){var _0x53813a={'raw':!![],'where':{'id':_0xc682e6['params']['id']}},_0x26b14e={};_0x26b14e['model']=_[_0xd5e8('0x33')](db[_0xd5e8('0x2c')][_0xd5e8('0x2d')]);_0x26b14e['query']=_['keys'](_0xc682e6[_0xd5e8('0x32')]);_0x26b14e[_0xd5e8('0x34')]=_['intersection'](_0x26b14e[_0xd5e8('0x30')],_0x26b14e[_0xd5e8('0x32')]);_0x53813a[_0xd5e8('0x35')]=_[_0xd5e8('0x36')](_0x26b14e[_0xd5e8('0x30')],qs[_0xd5e8('0x37')](_0xc682e6[_0xd5e8('0x32')]['fields']));_0x53813a[_0xd5e8('0x35')]=_0x53813a[_0xd5e8('0x35')][_0xd5e8('0x47')]?_0x53813a[_0xd5e8('0x35')]:_0x26b14e[_0xd5e8('0x30')];if(_0xc682e6[_0xd5e8('0x32')][_0xd5e8('0x48')]){_0x53813a[_0xd5e8('0x49')]=[{'all':!![]}];}_0x53813a=_['merge']({},_0x53813a,_0xc682e6[_0xd5e8('0x42')]);return db[_0xd5e8('0x2c')][_0xd5e8('0x4a')](_0x53813a)[_0xd5e8('0x26')](handleEntityNotFound(_0x488c46,null))[_0xd5e8('0x26')](respondWithResult(_0x488c46,null))['catch'](handleError(_0x488c46,null));};exports[_0xd5e8('0x4b')]=function(_0x363051,_0x38c9be){return db[_0xd5e8('0x2c')]['create'](_0x363051[_0xd5e8('0x4c')],{})[_0xd5e8('0x26')](respondWithResult(_0x38c9be,0xc9))[_0xd5e8('0x45')](handleError(_0x38c9be,null));};exports['update']=function(_0x58a40b,_0x4b2f79){if(_0x58a40b['body']['id']){delete _0x58a40b[_0xd5e8('0x4c')]['id'];}return db[_0xd5e8('0x2c')][_0xd5e8('0x4a')]({'where':{'id':_0x58a40b['params']['id']}})[_0xd5e8('0x26')](handleEntityNotFound(_0x4b2f79,null))[_0xd5e8('0x26')](saveUpdates(_0x58a40b['body'],null))['then'](respondWithResult(_0x4b2f79,null))['catch'](handleError(_0x4b2f79,null));};exports[_0xd5e8('0x4d')]=function(_0x1c9926,_0x294c3f){return db[_0xd5e8('0x2c')]['find']({'where':{'id':_0x1c9926[_0xd5e8('0x4e')]['id']}})[_0xd5e8('0x26')](handleEntityNotFound(_0x294c3f,null))[_0xd5e8('0x26')](removeEntity(_0x294c3f,null))[_0xd5e8('0x45')](handleError(_0x294c3f,null));};exports[_0xd5e8('0x4f')]=function(_0x187a8a,_0x37e83d){return db['ChatQueueReport'][_0xd5e8('0x4f')]()[_0xd5e8('0x26')](respondWithResult(_0x37e83d,null))['catch'](handleError(_0x37e83d,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 881f2ac..91e96bb 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x4c2623,_0x4838bb){var _0x2be431=function(_0x55829d){while(--_0x55829d){_0x4c2623['push'](_0x4c2623['shift']());}};_0x2be431(++_0x4838bb);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x4d5a16,_0x72c052){var _0x49163b=function(_0xa69992){while(--_0xa69992){_0x4d5a16['push'](_0x4d5a16['shift']());}};_0x49163b(++_0x72c052);}(_0xb7e7,0x121));var _0x7b7e=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xb7e7[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index fa729f4..55c3662 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 _0x0419=['debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','stringify','UpdateChatQueueReport','update','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0x0419,0x153));var _0x9041=function(_0x11c361,_0x4f5b42){_0x11c361=_0x11c361-0x0;var _0x1f5355=_0x0419[_0x11c361];return _0x1f5355;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9041('0x0'));var BPromise=require(_0x9041('0x1'));var rs=require(_0x9041('0x2'));var fs=require('fs');var Redis=require(_0x9041('0x3'));var db=require(_0x9041('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9041('0x5'));var config=require(_0x9041('0x6'));var jayson=require(_0x9041('0x7'));var client=jayson[_0x9041('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x118c44,_0x11a488,_0x5457be){return new BPromise(function(_0x48ac45,_0x39296c){return client[_0x9041('0x9')](_0x118c44,_0x5457be)[_0x9041('0xa')](function(_0x5afe95){logger[_0x9041('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x11a488,_0x9041('0xc'));logger[_0x9041('0xd')](_0x9041('0xe'),_0x11a488,'request\x20sent',JSON['stringify'](_0x5afe95));if(_0x5afe95[_0x9041('0xf')]){if(_0x5afe95[_0x9041('0xf')]['code']===0x1f4){logger['error'](_0x9041('0x10'),_0x11a488,_0x5afe95[_0x9041('0xf')][_0x9041('0x11')]);return _0x39296c(_0x5afe95[_0x9041('0xf')][_0x9041('0x11')]);}logger[_0x9041('0xf')](_0x9041('0x10'),_0x11a488,_0x5afe95[_0x9041('0xf')][_0x9041('0x11')]);return _0x48ac45(_0x5afe95[_0x9041('0xf')][_0x9041('0x11')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x11a488,'request\x20sent');_0x48ac45(_0x5afe95[_0x9041('0x12')][_0x9041('0x11')]);}})[_0x9041('0x13')](function(_0x54c323){logger[_0x9041('0xf')](_0x9041('0x10'),_0x11a488,_0x54c323);_0x39296c(_0x54c323);});});}exports[_0x9041('0x14')]=function(_0x4ebe42){var _0xe4a017=this;return new Promise(function(_0xf0630d,_0x3daf50){return db[_0x9041('0x15')][_0x9041('0x16')](_0x4ebe42[_0x9041('0x17')],{'raw':_0x4ebe42[_0x9041('0x18')]?_0x4ebe42[_0x9041('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9041('0xa')](function(_0xa8ee07){logger[_0x9041('0xb')]('CreateChatQueueReport',_0x4ebe42);logger[_0x9041('0xd')](_0x9041('0x14'),_0x4ebe42,JSON[_0x9041('0x19')](_0xa8ee07));_0xf0630d(_0xa8ee07);})['catch'](function(_0x12c81c){logger['error'](_0x9041('0x14'),_0x12c81c[_0x9041('0x11')],_0x4ebe42);_0x3daf50(_0xe4a017['error'](0x1f4,_0x12c81c['message']));});});};exports[_0x9041('0x1a')]=function(_0x3d0002){var _0x9d7f9a=this;return new Promise(function(_0x3fe32e,_0x5b164d){return db['ChatQueueReport'][_0x9041('0x1b')](_0x3d0002[_0x9041('0x17')],{'raw':_0x3d0002[_0x9041('0x18')]?_0x3d0002[_0x9041('0x18')][_0x9041('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d0002['options']?_0x3d0002[_0x9041('0x18')][_0x9041('0x1d')]||null:null,'attributes':_0x3d0002['options']?_0x3d0002[_0x9041('0x18')][_0x9041('0x1e')]||null:null,'limit':_0x3d0002[_0x9041('0x18')]?_0x3d0002[_0x9041('0x18')][_0x9041('0x1f')]||null:null})[_0x9041('0xa')](function(_0x20b434){logger[_0x9041('0xb')](_0x9041('0x1a'),_0x3d0002);logger[_0x9041('0xd')](_0x9041('0x1a'),_0x3d0002,JSON[_0x9041('0x19')](_0x20b434));_0x3fe32e(_0x20b434);})[_0x9041('0x13')](function(_0x36f89d){logger[_0x9041('0xf')](_0x9041('0x1a'),_0x36f89d['message'],_0x3d0002);_0x5b164d(_0x9d7f9a[_0x9041('0xf')](0x1f4,_0x36f89d[_0x9041('0x11')]));});});}; \ No newline at end of file +var _0x9f05=['ChatQueueReport','create','body','options','info','debug','UpdateChatQueueReport','update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateChatQueueReport'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x9f05,0xf9));var _0x59f0=function(_0x305b94,_0x103317){_0x305b94=_0x305b94-0x0;var _0x5ebacd=_0x9f05[_0x305b94];return _0x5ebacd;};'use strict';var _=require(_0x59f0('0x0'));var util=require(_0x59f0('0x1'));var moment=require(_0x59f0('0x2'));var BPromise=require(_0x59f0('0x3'));var rs=require(_0x59f0('0x4'));var fs=require('fs');var Redis=require(_0x59f0('0x5'));var db=require(_0x59f0('0x6'))['db'];var utils=require(_0x59f0('0x7'));var logger=require(_0x59f0('0x8'))('rpc');var config=require(_0x59f0('0x9'));var jayson=require(_0x59f0('0xa'));var client=jayson[_0x59f0('0xb')][_0x59f0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b7b82,_0x2dbd8e,_0x252889){return new BPromise(function(_0x48263f,_0x45c883){return client[_0x59f0('0xd')](_0x4b7b82,_0x252889)[_0x59f0('0xe')](function(_0x59a0c8){logger['info'](_0x59f0('0xf'),_0x2dbd8e,'request\x20sent');logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x2dbd8e,_0x59f0('0x10'),JSON['stringify'](_0x59a0c8));if(_0x59a0c8[_0x59f0('0x11')]){if(_0x59a0c8['error'][_0x59f0('0x12')]===0x1f4){logger[_0x59f0('0x11')](_0x59f0('0xf'),_0x2dbd8e,_0x59a0c8[_0x59f0('0x11')][_0x59f0('0x13')]);return _0x45c883(_0x59a0c8[_0x59f0('0x11')][_0x59f0('0x13')]);}logger[_0x59f0('0x11')](_0x59f0('0xf'),_0x2dbd8e,_0x59a0c8[_0x59f0('0x11')][_0x59f0('0x13')]);return _0x48263f(_0x59a0c8[_0x59f0('0x11')][_0x59f0('0x13')]);}else{logger['info'](_0x59f0('0xf'),_0x2dbd8e,'request\x20sent');_0x48263f(_0x59a0c8[_0x59f0('0x14')][_0x59f0('0x13')]);}})[_0x59f0('0x15')](function(_0x3aae73){logger['error'](_0x59f0('0xf'),_0x2dbd8e,_0x3aae73);_0x45c883(_0x3aae73);});});}exports[_0x59f0('0x16')]=function(_0x54a71a){var _0x4eced8=this;return new Promise(function(_0x52c5d9,_0xa75eb7){return db[_0x59f0('0x17')][_0x59f0('0x18')](_0x54a71a[_0x59f0('0x19')],{'raw':_0x54a71a[_0x59f0('0x1a')]?_0x54a71a[_0x59f0('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x59f0('0xe')](function(_0x29ce7f){logger[_0x59f0('0x1b')]('CreateChatQueueReport',_0x54a71a);logger[_0x59f0('0x1c')](_0x59f0('0x16'),_0x54a71a,JSON['stringify'](_0x29ce7f));_0x52c5d9(_0x29ce7f);})[_0x59f0('0x15')](function(_0x57cd4e){logger[_0x59f0('0x11')](_0x59f0('0x16'),_0x57cd4e[_0x59f0('0x13')],_0x54a71a);_0xa75eb7(_0x4eced8[_0x59f0('0x11')](0x1f4,_0x57cd4e[_0x59f0('0x13')]));});});};exports[_0x59f0('0x1d')]=function(_0xd2d993){var _0x318fb7=this;return new Promise(function(_0x34ffa1,_0xee0084){return db[_0x59f0('0x17')][_0x59f0('0x1e')](_0xd2d993[_0x59f0('0x19')],{'raw':_0xd2d993[_0x59f0('0x1a')]?_0xd2d993[_0x59f0('0x1a')][_0x59f0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd2d993[_0x59f0('0x1a')]?_0xd2d993[_0x59f0('0x1a')][_0x59f0('0x20')]||null:null,'attributes':_0xd2d993[_0x59f0('0x1a')]?_0xd2d993[_0x59f0('0x1a')][_0x59f0('0x21')]||null:null,'limit':_0xd2d993[_0x59f0('0x1a')]?_0xd2d993['options']['limit']||null:null})[_0x59f0('0xe')](function(_0x2f3a8b){logger[_0x59f0('0x1b')](_0x59f0('0x1d'),_0xd2d993);logger[_0x59f0('0x1c')]('UpdateChatQueueReport',_0xd2d993,JSON['stringify'](_0x2f3a8b));_0x34ffa1(_0x2f3a8b);})[_0x59f0('0x15')](function(_0x522fb5){logger['error'](_0x59f0('0x1d'),_0x522fb5[_0x59f0('0x13')],_0xd2d993);_0xee0084(_0x318fb7[_0x59f0('0x11')](0x1f4,_0x522fb5[_0x59f0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index e647012..44e028e 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 _0xdfd7=['path','express','fs-extra','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','describe','post','create','put','update','delete','/:id','destroy','exports','multer','util'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xdfd7,0x83));var _0x7dfd=function(_0x1d2e49,_0x5d2a1c){_0x1d2e49=_0x1d2e49-0x0;var _0x30ee76=_0xdfd7[_0x1d2e49];return _0x30ee76;};'use strict';var multer=require(_0x7dfd('0x0'));var util=require(_0x7dfd('0x1'));var path=require(_0x7dfd('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dfd('0x3'));var router=express['Router']();var fs_extra=require(_0x7dfd('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7dfd('0x5'));var controller=require(_0x7dfd('0x6'));router['get']('/',auth[_0x7dfd('0x7')](),controller[_0x7dfd('0x8')]);router[_0x7dfd('0x9')]('/describe',auth[_0x7dfd('0x7')](),controller[_0x7dfd('0xa')]);router[_0x7dfd('0x9')]('/:id',auth[_0x7dfd('0x7')](),controller['show']);router[_0x7dfd('0xb')]('/',auth[_0x7dfd('0x7')](),controller[_0x7dfd('0xc')]);router[_0x7dfd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x7dfd('0xe')]);router[_0x7dfd('0xf')](_0x7dfd('0x10'),auth[_0x7dfd('0x7')](),controller[_0x7dfd('0x11')]);module[_0x7dfd('0x12')]=router; \ No newline at end of file +var _0x3b7c=['update','destroy','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','/:id','create','put'];(function(_0x4f8877,_0x2af478){var _0x597b3e=function(_0x327587){while(--_0x327587){_0x4f8877['push'](_0x4f8877['shift']());}};_0x597b3e(++_0x2af478);}(_0x3b7c,0x192));var _0xc3b7=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0x3b7c[_0x24392f];return _0x591e33;};'use strict';var multer=require(_0xc3b7('0x0'));var util=require(_0xc3b7('0x1'));var path=require(_0xc3b7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc3b7('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc3b7('0x4'));var config=require(_0xc3b7('0x5'));var controller=require(_0xc3b7('0x6'));router[_0xc3b7('0x7')]('/',auth[_0xc3b7('0x8')](),controller[_0xc3b7('0x9')]);router['get'](_0xc3b7('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xc3b7('0xb'),auth[_0xc3b7('0x8')](),controller['show']);router['post']('/',auth[_0xc3b7('0x8')](),controller[_0xc3b7('0xc')]);router[_0xc3b7('0xd')](_0xc3b7('0xb'),auth[_0xc3b7('0x8')](),controller[_0xc3b7('0xe')]);router['delete'](_0xc3b7('0xb'),auth[_0xc3b7('0x8')](),controller[_0xc3b7('0xf')]);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 e9c1cc4..e9095b7 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x643b2,_0x14e495){var _0x2e5346=function(_0x3ed065){while(--_0x3ed065){_0x643b2['push'](_0x643b2['shift']());}};_0x2e5346(++_0x14e495);}(_0x008c,0x188));var _0xc008=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0x008c[_0x5ce8b9];return _0xe34be0;};'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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x5aa023,_0x1cf1d2){var _0x31ceb5=function(_0x40f643){while(--_0x40f643){_0x5aa023['push'](_0x5aa023['shift']());}};_0x31ceb5(++_0x1cf1d2);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 03cc2fd..904c33b 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 _0xff6f=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','ChatTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','options','includeAll','catch','show','keys','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x43ccac,_0x2c7511){var _0x384b91=function(_0x448e0){while(--_0x448e0){_0x43ccac['push'](_0x43ccac['shift']());}};_0x384b91(++_0x2c7511);}(_0xff6f,0x1f2));var _0xfff6=function(_0x357169,_0x68edd6){_0x357169=_0x357169-0x0;var _0x55dad1=_0xff6f[_0x357169];return _0x55dad1;};'use strict';var emlformat=require(_0xfff6('0x0'));var rimraf=require(_0xfff6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfff6('0x2'));var rp=require(_0xfff6('0x3'));var moment=require(_0xfff6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfff6('0x5'));var util=require(_0xfff6('0x6'));var path=require(_0xfff6('0x7'));var sox=require(_0xfff6('0x8'));var csv=require(_0xfff6('0x9'));var ejs=require(_0xfff6('0xa'));var fs=require('fs');var fs_extra=require(_0xfff6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfff6('0xc'));var jsforce=require(_0xfff6('0xd'));var deskjs=require(_0xfff6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfff6('0xf'));var Papa=require(_0xfff6('0x10'));var Redis=require(_0xfff6('0x11'));var authService=require(_0xfff6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfff6('0x13'));var hardwareService=require(_0xfff6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xfff6('0x15'));var config=require(_0xfff6('0x16'));var licenseUtil=require(_0xfff6('0x17'));var db=require(_0xfff6('0x18'))['db'];function respondWithStatusCode(_0x2dbae7,_0x3440cb){_0x3440cb=_0x3440cb||0xcc;return function(_0x4fb107){if(_0x4fb107){return _0x2dbae7[_0xfff6('0x19')](_0x3440cb);}return _0x2dbae7['status'](_0x3440cb)[_0xfff6('0x1a')]();};}function respondWithResult(_0x386d7d,_0x235ce0){_0x235ce0=_0x235ce0||0xc8;return function(_0xbf20a6){if(_0xbf20a6){return _0x386d7d['status'](_0x235ce0)[_0xfff6('0x1b')](_0xbf20a6);}};}function respondWithFilteredResult(_0x5d1f54,_0x33a827){return function(_0x3c06ef){if(_0x3c06ef){var _0x204e53=typeof _0x33a827[_0xfff6('0x1c')]===_0xfff6('0x1d')&&typeof _0x33a827[_0xfff6('0x1e')]===_0xfff6('0x1d');var _0x436c42=_0x3c06ef['count'];var _0x422b28=_0x204e53?0x0:_0x33a827[_0xfff6('0x1c')];var _0xa37963=_0x204e53?_0x3c06ef[_0xfff6('0x1f')]:_0x33a827[_0xfff6('0x1c')]+_0x33a827['limit'];var _0x292a3e;if(_0xa37963>=_0x436c42){_0xa37963=_0x436c42;_0x292a3e=0xc8;}else{_0x292a3e=0xce;}_0x5d1f54[_0xfff6('0x20')](_0x292a3e);return _0x5d1f54['set'](_0xfff6('0x21'),_0x422b28+'-'+_0xa37963+'/'+_0x436c42)[_0xfff6('0x1b')](_0x3c06ef);}return null;};}function patchUpdates(_0x57630f){return function(_0x367f53){try{jsonpatch[_0xfff6('0x22')](_0x367f53,_0x57630f,!![]);}catch(_0x175b27){return BPromise[_0xfff6('0x23')](_0x175b27);}return _0x367f53[_0xfff6('0x24')]();};}function saveUpdates(_0x3ea21c,_0x3d2bf8){return function(_0x1244bd){if(_0x1244bd){return _0x1244bd[_0xfff6('0x25')](_0x3ea21c)[_0xfff6('0x26')](function(_0x20e5e4){return _0x20e5e4;});}return null;};}function removeEntity(_0x3251b8,_0x21cd52){return function(_0x214c72){if(_0x214c72){return _0x214c72[_0xfff6('0x27')]()[_0xfff6('0x26')](function(){_0x3251b8['status'](0xcc)[_0xfff6('0x1a')]();});}};}function handleEntityNotFound(_0x14c2cc,_0x175ea7){return function(_0x2b80a6){if(!_0x2b80a6){_0x14c2cc[_0xfff6('0x19')](0x194);}return _0x2b80a6;};}function handleError(_0x7448e0,_0x3f6db1){_0x3f6db1=_0x3f6db1||0x1f4;return function(_0xb93e20){logger[_0xfff6('0x28')](_0xb93e20[_0xfff6('0x29')]);if(_0xb93e20[_0xfff6('0x2a')]){delete _0xb93e20[_0xfff6('0x2a')];}_0x7448e0[_0xfff6('0x20')](_0x3f6db1)['send'](_0xb93e20);};}exports[_0xfff6('0x2b')]=function(_0x27799c,_0x544bfe){var _0x3b0451={},_0x5434cf={},_0x1d5da7={'count':0x0,'rows':[]};var _0x1388cc=_['map'](db[_0xfff6('0x2c')]['rawAttributes'],function(_0x47246b){return{'name':_0x47246b[_0xfff6('0x2d')],'type':_0x47246b[_0xfff6('0x2e')][_0xfff6('0x2f')]};});_0x5434cf[_0xfff6('0x30')]=_['map'](_0x1388cc,_0xfff6('0x2a'));_0x5434cf[_0xfff6('0x31')]=_['keys'](_0x27799c[_0xfff6('0x31')]);_0x5434cf[_0xfff6('0x32')]=_[_0xfff6('0x33')](_0x5434cf[_0xfff6('0x30')],_0x5434cf[_0xfff6('0x31')]);_0x3b0451[_0xfff6('0x34')]=_[_0xfff6('0x33')](_0x5434cf[_0xfff6('0x30')],qs[_0xfff6('0x35')](_0x27799c['query'][_0xfff6('0x35')]));_0x3b0451['attributes']=_0x3b0451[_0xfff6('0x34')][_0xfff6('0x36')]?_0x3b0451[_0xfff6('0x34')]:_0x5434cf[_0xfff6('0x30')];if(!_0x27799c[_0xfff6('0x31')][_0xfff6('0x37')](_0xfff6('0x38'))){_0x3b0451[_0xfff6('0x1e')]=qs[_0xfff6('0x1e')](_0x27799c['query']['limit']);_0x3b0451[_0xfff6('0x1c')]=qs[_0xfff6('0x1c')](_0x27799c[_0xfff6('0x31')][_0xfff6('0x1c')]);}_0x3b0451[_0xfff6('0x39')]=qs[_0xfff6('0x3a')](_0x27799c[_0xfff6('0x31')]['sort']);_0x3b0451[_0xfff6('0x3b')]=qs[_0xfff6('0x32')](_[_0xfff6('0x3c')](_0x27799c['query'],_0x5434cf[_0xfff6('0x32')]),_0x1388cc);if(_0x27799c[_0xfff6('0x31')]['filter']){_0x3b0451[_0xfff6('0x3b')]=_[_0xfff6('0x3d')](_0x3b0451['where'],{'$or':_[_0xfff6('0x3e')](_0x1388cc,function(_0x4c3b53){if(_0x4c3b53[_0xfff6('0x2e')]!==_0xfff6('0x3f')){var _0x1fc640={};_0x1fc640[_0x4c3b53['name']]={'$like':'%'+_0x27799c[_0xfff6('0x31')]['filter']+'%'};return _0x1fc640;}})});}_0x3b0451=_['merge']({},_0x3b0451,_0x27799c[_0xfff6('0x40')]);var _0x51f4a9={'where':_0x3b0451['where']};return db[_0xfff6('0x2c')][_0xfff6('0x1f')](_0x51f4a9)[_0xfff6('0x26')](function(_0x3d1ac6){_0x1d5da7['count']=_0x3d1ac6;if(_0x27799c[_0xfff6('0x31')][_0xfff6('0x41')]){_0x3b0451['include']=[{'all':!![]}];}return db[_0xfff6('0x2c')]['findAll'](_0x3b0451);})[_0xfff6('0x26')](function(_0x1544c5){_0x1d5da7['rows']=_0x1544c5;return _0x1d5da7;})[_0xfff6('0x26')](respondWithFilteredResult(_0x544bfe,_0x3b0451))[_0xfff6('0x42')](handleError(_0x544bfe,null));};exports[_0xfff6('0x43')]=function(_0x1a8dae,_0x236f24){var _0x4f9872={'raw':!![],'where':{'id':_0x1a8dae['params']['id']}},_0x26c582={};_0x26c582[_0xfff6('0x30')]=_[_0xfff6('0x44')](db[_0xfff6('0x2c')]['rawAttributes']);_0x26c582['query']=_[_0xfff6('0x44')](_0x1a8dae[_0xfff6('0x31')]);_0x26c582['filters']=_[_0xfff6('0x33')](_0x26c582[_0xfff6('0x30')],_0x26c582[_0xfff6('0x31')]);_0x4f9872['attributes']=_['intersection'](_0x26c582[_0xfff6('0x30')],qs['fields'](_0x1a8dae['query'][_0xfff6('0x35')]));_0x4f9872[_0xfff6('0x34')]=_0x4f9872[_0xfff6('0x34')]['length']?_0x4f9872[_0xfff6('0x34')]:_0x26c582[_0xfff6('0x30')];if(_0x1a8dae[_0xfff6('0x31')]['includeAll']){_0x4f9872['include']=[{'all':!![]}];}_0x4f9872=_[_0xfff6('0x3d')]({},_0x4f9872,_0x1a8dae[_0xfff6('0x40')]);return db[_0xfff6('0x2c')]['find'](_0x4f9872)[_0xfff6('0x26')](handleEntityNotFound(_0x236f24,null))[_0xfff6('0x26')](respondWithResult(_0x236f24,null))['catch'](handleError(_0x236f24,null));};exports[_0xfff6('0x45')]=function(_0x5352cb,_0xa72982){return db['ChatTransferReport']['create'](_0x5352cb['body'],{})[_0xfff6('0x26')](respondWithResult(_0xa72982,0xc9))[_0xfff6('0x42')](handleError(_0xa72982,null));};exports[_0xfff6('0x25')]=function(_0x5ceb80,_0x45aa6c){if(_0x5ceb80[_0xfff6('0x46')]['id']){delete _0x5ceb80[_0xfff6('0x46')]['id'];}return db['ChatTransferReport'][_0xfff6('0x47')]({'where':{'id':_0x5ceb80[_0xfff6('0x48')]['id']}})['then'](handleEntityNotFound(_0x45aa6c,null))[_0xfff6('0x26')](saveUpdates(_0x5ceb80[_0xfff6('0x46')],null))['then'](respondWithResult(_0x45aa6c,null))[_0xfff6('0x42')](handleError(_0x45aa6c,null));};exports[_0xfff6('0x27')]=function(_0x5f46e6,_0x53c1b2){return db[_0xfff6('0x2c')][_0xfff6('0x47')]({'where':{'id':_0x5f46e6['params']['id']}})['then'](handleEntityNotFound(_0x53c1b2,null))[_0xfff6('0x26')](removeEntity(_0x53c1b2,null))['catch'](handleError(_0x53c1b2,null));};exports[_0xfff6('0x49')]=function(_0x15f89a,_0x57818c){return db[_0xfff6('0x2c')]['describe']()['then'](respondWithResult(_0x57818c,null))[_0xfff6('0x42')](handleError(_0x57818c,null));}; \ No newline at end of file +var _0x7451=['type','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','ChatTransferReport'];(function(_0x4a2743,_0x1572fd){var _0x58b0d2=function(_0x2bc153){while(--_0x2bc153){_0x4a2743['push'](_0x4a2743['shift']());}};_0x58b0d2(++_0x1572fd);}(_0x7451,0x140));var _0x1745=function(_0x1e7c56,_0x304c82){_0x1e7c56=_0x1e7c56-0x0;var _0x5bb5e9=_0x7451[_0x1e7c56];return _0x5bb5e9;};'use strict';var emlformat=require(_0x1745('0x0'));var rimraf=require(_0x1745('0x1'));var zipdir=require(_0x1745('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1745('0x3'));var moment=require(_0x1745('0x4'));var BPromise=require(_0x1745('0x5'));var Mustache=require(_0x1745('0x6'));var util=require(_0x1745('0x7'));var path=require(_0x1745('0x8'));var sox=require(_0x1745('0x9'));var csv=require(_0x1745('0xa'));var ejs=require(_0x1745('0xb'));var fs=require('fs');var fs_extra=require(_0x1745('0xc'));var _=require(_0x1745('0xd'));var squel=require(_0x1745('0xe'));var crypto=require(_0x1745('0xf'));var jsforce=require(_0x1745('0x10'));var deskjs=require(_0x1745('0x11'));var toCsv=require(_0x1745('0xa'));var querystring=require('querystring');var Papa=require(_0x1745('0x12'));var Redis=require(_0x1745('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1745('0x14'));var hardwareService=require(_0x1745('0x15'));var logger=require('../../config/logger')(_0x1745('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1745('0x17'));var db=require(_0x1745('0x18'))['db'];function respondWithStatusCode(_0x9fb94d,_0x59b146){_0x59b146=_0x59b146||0xcc;return function(_0x2a8d8e){if(_0x2a8d8e){return _0x9fb94d[_0x1745('0x19')](_0x59b146);}return _0x9fb94d[_0x1745('0x1a')](_0x59b146)['end']();};}function respondWithResult(_0x4bd09e,_0x21f192){_0x21f192=_0x21f192||0xc8;return function(_0xecad73){if(_0xecad73){return _0x4bd09e[_0x1745('0x1a')](_0x21f192)[_0x1745('0x1b')](_0xecad73);}};}function respondWithFilteredResult(_0x46b7f8,_0x405140){return function(_0xf4ef4a){if(_0xf4ef4a){var _0x4f8ac6=typeof _0x405140[_0x1745('0x1c')]==='undefined'&&typeof _0x405140[_0x1745('0x1d')]==='undefined';var _0x992770=_0xf4ef4a[_0x1745('0x1e')];var _0x245498=_0x4f8ac6?0x0:_0x405140['offset'];var _0x1179f6=_0x4f8ac6?_0xf4ef4a[_0x1745('0x1e')]:_0x405140[_0x1745('0x1c')]+_0x405140[_0x1745('0x1d')];var _0x5960c8;if(_0x1179f6>=_0x992770){_0x1179f6=_0x992770;_0x5960c8=0xc8;}else{_0x5960c8=0xce;}_0x46b7f8['status'](_0x5960c8);return _0x46b7f8[_0x1745('0x1f')](_0x1745('0x20'),_0x245498+'-'+_0x1179f6+'/'+_0x992770)['json'](_0xf4ef4a);}return null;};}function patchUpdates(_0x376769){return function(_0xe89c3d){try{jsonpatch[_0x1745('0x21')](_0xe89c3d,_0x376769,!![]);}catch(_0x5d1b58){return BPromise[_0x1745('0x22')](_0x5d1b58);}return _0xe89c3d[_0x1745('0x23')]();};}function saveUpdates(_0x1f7506,_0x1dcaa2){return function(_0x5bad83){if(_0x5bad83){return _0x5bad83[_0x1745('0x24')](_0x1f7506)[_0x1745('0x25')](function(_0x373568){return _0x373568;});}return null;};}function removeEntity(_0xd5a17f,_0x32e8e2){return function(_0x5ab634){if(_0x5ab634){return _0x5ab634[_0x1745('0x26')]()[_0x1745('0x25')](function(){_0xd5a17f['status'](0xcc)[_0x1745('0x27')]();});}};}function handleEntityNotFound(_0x1f7fb5,_0x1ecfd){return function(_0x2f6a1d){if(!_0x2f6a1d){_0x1f7fb5[_0x1745('0x19')](0x194);}return _0x2f6a1d;};}function handleError(_0x39b45f,_0x2d8e4b){_0x2d8e4b=_0x2d8e4b||0x1f4;return function(_0x311467){logger['error'](_0x311467[_0x1745('0x28')]);if(_0x311467[_0x1745('0x29')]){delete _0x311467[_0x1745('0x29')];}_0x39b45f[_0x1745('0x1a')](_0x2d8e4b)[_0x1745('0x2a')](_0x311467);};}exports['index']=function(_0x3c0b29,_0x3616e7){var _0x800834={},_0xdf9628={},_0x27e72d={'count':0x0,'rows':[]};var _0x2481b4=_[_0x1745('0x2b')](db[_0x1745('0x2c')]['rawAttributes'],function(_0x3ce03f){return{'name':_0x3ce03f['fieldName'],'type':_0x3ce03f[_0x1745('0x2d')]['key']};});_0xdf9628['model']=_[_0x1745('0x2b')](_0x2481b4,_0x1745('0x29'));_0xdf9628[_0x1745('0x2e')]=_[_0x1745('0x2f')](_0x3c0b29['query']);_0xdf9628['filters']=_[_0x1745('0x30')](_0xdf9628['model'],_0xdf9628[_0x1745('0x2e')]);_0x800834[_0x1745('0x31')]=_[_0x1745('0x30')](_0xdf9628[_0x1745('0x32')],qs[_0x1745('0x33')](_0x3c0b29[_0x1745('0x2e')]['fields']));_0x800834[_0x1745('0x31')]=_0x800834[_0x1745('0x31')][_0x1745('0x34')]?_0x800834['attributes']:_0xdf9628[_0x1745('0x32')];if(!_0x3c0b29[_0x1745('0x2e')]['hasOwnProperty'](_0x1745('0x35'))){_0x800834[_0x1745('0x1d')]=qs[_0x1745('0x1d')](_0x3c0b29['query'][_0x1745('0x1d')]);_0x800834[_0x1745('0x1c')]=qs[_0x1745('0x1c')](_0x3c0b29[_0x1745('0x2e')][_0x1745('0x1c')]);}_0x800834[_0x1745('0x36')]=qs['sort'](_0x3c0b29[_0x1745('0x2e')][_0x1745('0x37')]);_0x800834[_0x1745('0x38')]=qs['filters'](_['pick'](_0x3c0b29[_0x1745('0x2e')],_0xdf9628[_0x1745('0x39')]),_0x2481b4);if(_0x3c0b29[_0x1745('0x2e')][_0x1745('0x3a')]){_0x800834['where']=_['merge'](_0x800834[_0x1745('0x38')],{'$or':_['map'](_0x2481b4,function(_0x4771b3){if(_0x4771b3[_0x1745('0x2d')]!==_0x1745('0x3b')){var _0x4e6664={};_0x4e6664[_0x4771b3[_0x1745('0x29')]]={'$like':'%'+_0x3c0b29[_0x1745('0x2e')][_0x1745('0x3a')]+'%'};return _0x4e6664;}})});}_0x800834=_[_0x1745('0x3c')]({},_0x800834,_0x3c0b29['options']);var _0x3cc171={'where':_0x800834['where']};return db['ChatTransferReport'][_0x1745('0x1e')](_0x3cc171)[_0x1745('0x25')](function(_0x37f854){_0x27e72d[_0x1745('0x1e')]=_0x37f854;if(_0x3c0b29[_0x1745('0x2e')][_0x1745('0x3d')]){_0x800834[_0x1745('0x3e')]=[{'all':!![]}];}return db[_0x1745('0x2c')][_0x1745('0x3f')](_0x800834);})[_0x1745('0x25')](function(_0x21c633){_0x27e72d[_0x1745('0x40')]=_0x21c633;return _0x27e72d;})[_0x1745('0x25')](respondWithFilteredResult(_0x3616e7,_0x800834))[_0x1745('0x41')](handleError(_0x3616e7,null));};exports['show']=function(_0x234501,_0x599523){var _0x47c49f={'raw':!![],'where':{'id':_0x234501[_0x1745('0x42')]['id']}},_0x157e6d={};_0x157e6d['model']=_[_0x1745('0x2f')](db[_0x1745('0x2c')][_0x1745('0x43')]);_0x157e6d[_0x1745('0x2e')]=_[_0x1745('0x2f')](_0x234501[_0x1745('0x2e')]);_0x157e6d[_0x1745('0x39')]=_[_0x1745('0x30')](_0x157e6d[_0x1745('0x32')],_0x157e6d[_0x1745('0x2e')]);_0x47c49f[_0x1745('0x31')]=_[_0x1745('0x30')](_0x157e6d[_0x1745('0x32')],qs['fields'](_0x234501[_0x1745('0x2e')][_0x1745('0x33')]));_0x47c49f['attributes']=_0x47c49f['attributes'][_0x1745('0x34')]?_0x47c49f[_0x1745('0x31')]:_0x157e6d[_0x1745('0x32')];if(_0x234501[_0x1745('0x2e')][_0x1745('0x3d')]){_0x47c49f[_0x1745('0x3e')]=[{'all':!![]}];}_0x47c49f=_[_0x1745('0x3c')]({},_0x47c49f,_0x234501[_0x1745('0x44')]);return db[_0x1745('0x2c')][_0x1745('0x45')](_0x47c49f)[_0x1745('0x25')](handleEntityNotFound(_0x599523,null))[_0x1745('0x25')](respondWithResult(_0x599523,null))['catch'](handleError(_0x599523,null));};exports[_0x1745('0x46')]=function(_0x30674c,_0x52432d){return db['ChatTransferReport']['create'](_0x30674c[_0x1745('0x47')],{})[_0x1745('0x25')](respondWithResult(_0x52432d,0xc9))['catch'](handleError(_0x52432d,null));};exports[_0x1745('0x24')]=function(_0x228456,_0xc86480){if(_0x228456[_0x1745('0x47')]['id']){delete _0x228456[_0x1745('0x47')]['id'];}return db[_0x1745('0x2c')][_0x1745('0x45')]({'where':{'id':_0x228456['params']['id']}})[_0x1745('0x25')](handleEntityNotFound(_0xc86480,null))[_0x1745('0x25')](saveUpdates(_0x228456[_0x1745('0x47')],null))['then'](respondWithResult(_0xc86480,null))[_0x1745('0x41')](handleError(_0xc86480,null));};exports['destroy']=function(_0xa3ae47,_0x254f8c){return db[_0x1745('0x2c')][_0x1745('0x45')]({'where':{'id':_0xa3ae47['params']['id']}})[_0x1745('0x25')](handleEntityNotFound(_0x254f8c,null))[_0x1745('0x25')](removeEntity(_0x254f8c,null))[_0x1745('0x41')](handleError(_0x254f8c,null));};exports[_0x1745('0x48')]=function(_0x56cd02,_0x3355ae){return db['ChatTransferReport'][_0x1745('0x48')]()['then'](respondWithResult(_0x3355ae,null))[_0x1745('0x41')](handleError(_0x3355ae,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 7d6c31a..59e150e 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 _0x3c9a=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash'];(function(_0x259c84,_0x51de45){var _0x4ecbab=function(_0x18c1eb){while(--_0x18c1eb){_0x259c84['push'](_0x259c84['shift']());}};_0x4ecbab(++_0x51de45);}(_0x3c9a,0x144));var _0xa3c9=function(_0x274d1a,_0x1a4f13){_0x274d1a=_0x274d1a-0x0;var _0x5c05d7=_0x3c9a[_0x274d1a];return _0x5c05d7;};'use strict';var _=require(_0xa3c9('0x0'));var util=require('util');var logger=require(_0xa3c9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa3c9('0x2'));var rp=require(_0xa3c9('0x3'));var fs=require('fs');var path=require(_0xa3c9('0x4'));var rimraf=require(_0xa3c9('0x5'));var config=require(_0xa3c9('0x6'));var attributes=require(_0xa3c9('0x7'));module[_0xa3c9('0x8')]=function(_0x2df3a6,_0x330c30){return _0x2df3a6[_0xa3c9('0x9')](_0xa3c9('0xa'),attributes,{'tableName':_0xa3c9('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa3c9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x218d=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','define'];(function(_0x51c1cd,_0x16afbe){var _0x5c0836=function(_0x22b1ca){while(--_0x22b1ca){_0x51c1cd['push'](_0x51c1cd['shift']());}};_0x5c0836(++_0x16afbe);}(_0x218d,0x1a3));var _0xd218=function(_0x532440,_0x11d6cb){_0x532440=_0x532440-0x0;var _0x15caff=_0x218d[_0x532440];return _0x15caff;};'use strict';var _=require(_0xd218('0x0'));var util=require(_0xd218('0x1'));var logger=require(_0xd218('0x2'))(_0xd218('0x3'));var moment=require('moment');var BPromise=require(_0xd218('0x4'));var rp=require(_0xd218('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd218('0x6'));var config=require(_0xd218('0x7'));var attributes=require(_0xd218('0x8'));module['exports']=function(_0x1c344e,_0x5d1c3d){return _0x1c344e[_0xd218('0x9')](_0xd218('0xa'),attributes,{'tableName':_0xd218('0xb'),'paranoid':![],'indexes':[{'name':_0xd218('0xc'),'fields':[_0xd218('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 471cdf4..8547cae 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 _0x102a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x48dfc9,_0x182be1){var _0x4c9b9c=function(_0x1c0e95){while(--_0x1c0e95){_0x48dfc9['push'](_0x48dfc9['shift']());}};_0x4c9b9c(++_0x182be1);}(_0x102a,0xe3));var _0xa102=function(_0x3d6d11,_0x4e4815){_0x3d6d11=_0x3d6d11-0x0;var _0x44f745=_0x102a[_0x3d6d11];return _0x44f745;};'use strict';var _=require(_0xa102('0x0'));var util=require('util');var moment=require(_0xa102('0x1'));var BPromise=require(_0xa102('0x2'));var rs=require(_0xa102('0x3'));var fs=require('fs');var Redis=require(_0xa102('0x4'));var db=require(_0xa102('0x5'))['db'];var utils=require(_0xa102('0x6'));var logger=require(_0xa102('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa102('0x8'));var client=jayson[_0xa102('0x9')][_0xa102('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d9c35,_0x2f1e59,_0x18249a){return new BPromise(function(_0x1f13ed,_0x48cd69){return client[_0xa102('0xb')](_0x1d9c35,_0x18249a)['then'](function(_0x46f5bd){logger[_0xa102('0xc')](_0xa102('0xd'),_0x2f1e59,_0xa102('0xe'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2f1e59,_0xa102('0xe'),JSON[_0xa102('0xf')](_0x46f5bd));if(_0x46f5bd['error']){if(_0x46f5bd[_0xa102('0x10')][_0xa102('0x11')]===0x1f4){logger['error'](_0xa102('0xd'),_0x2f1e59,_0x46f5bd['error'][_0xa102('0x12')]);return _0x48cd69(_0x46f5bd[_0xa102('0x10')]['message']);}logger[_0xa102('0x10')](_0xa102('0xd'),_0x2f1e59,_0x46f5bd['error'][_0xa102('0x12')]);return _0x1f13ed(_0x46f5bd[_0xa102('0x10')][_0xa102('0x12')]);}else{logger[_0xa102('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x2f1e59,'request\x20sent');_0x1f13ed(_0x46f5bd[_0xa102('0x13')][_0xa102('0x12')]);}})[_0xa102('0x14')](function(_0x46102e){logger[_0xa102('0x10')](_0xa102('0xd'),_0x2f1e59,_0x46102e);_0x48cd69(_0x46102e);});});} \ No newline at end of file +var _0x17c0=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1905f5,_0x52e8ee){var _0x35a32a=function(_0x3b5644){while(--_0x3b5644){_0x1905f5['push'](_0x1905f5['shift']());}};_0x35a32a(++_0x52e8ee);}(_0x17c0,0x191));var _0x017c=function(_0x104a84,_0x285970){_0x104a84=_0x104a84-0x0;var _0x4973ff=_0x17c0[_0x104a84];return _0x4973ff;};'use strict';var _=require(_0x017c('0x0'));var util=require(_0x017c('0x1'));var moment=require(_0x017c('0x2'));var BPromise=require('bluebird');var rs=require(_0x017c('0x3'));var fs=require('fs');var Redis=require(_0x017c('0x4'));var db=require(_0x017c('0x5'))['db'];var utils=require(_0x017c('0x6'));var logger=require(_0x017c('0x7'))('rpc');var config=require(_0x017c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x017c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1118e3,_0x47af27,_0x113c95){return new BPromise(function(_0x575c99,_0x588267){return client[_0x017c('0xa')](_0x1118e3,_0x113c95)['then'](function(_0x25400d){logger[_0x017c('0xb')](_0x017c('0xc'),_0x47af27,_0x017c('0xd'));logger[_0x017c('0xe')](_0x017c('0xf'),_0x47af27,_0x017c('0xd'),JSON[_0x017c('0x10')](_0x25400d));if(_0x25400d['error']){if(_0x25400d[_0x017c('0x11')][_0x017c('0x12')]===0x1f4){logger[_0x017c('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x47af27,_0x25400d[_0x017c('0x11')]['message']);return _0x588267(_0x25400d[_0x017c('0x11')]['message']);}logger[_0x017c('0x11')](_0x017c('0xc'),_0x47af27,_0x25400d[_0x017c('0x11')][_0x017c('0x13')]);return _0x575c99(_0x25400d[_0x017c('0x11')][_0x017c('0x13')]);}else{logger[_0x017c('0xb')](_0x017c('0xc'),_0x47af27,_0x017c('0xd'));_0x575c99(_0x25400d['result'][_0x017c('0x13')]);}})[_0x017c('0x14')](function(_0x53145c){logger[_0x017c('0x11')](_0x017c('0xc'),_0x47af27,_0x53145c);_0x588267(_0x53145c);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 8931f77..cedf073 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 _0xaa39=['delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0x372632,_0x539bcc){var _0x5f2006=function(_0xe5b6bc){while(--_0xe5b6bc){_0x372632['push'](_0x372632['shift']());}};_0x5f2006(++_0x539bcc);}(_0xaa39,0xae));var _0x9aa3=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0xaa39[_0x3e3bee];return _0x3ae14c;};'use strict';var multer=require(_0x9aa3('0x0'));var util=require('util');var path=require(_0x9aa3('0x1'));var timeout=require('connect-timeout');var express=require(_0x9aa3('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9aa3('0x3'));var interaction=require(_0x9aa3('0x4'));var config=require('../../config/environment');var controller=require(_0x9aa3('0x5'));router[_0x9aa3('0x6')]('/',auth[_0x9aa3('0x7')](),controller[_0x9aa3('0x8')]);router[_0x9aa3('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x9aa3('0x9')]);router['get'](_0x9aa3('0xa'),auth['isAuthenticated'](),controller[_0x9aa3('0xb')]);router[_0x9aa3('0xc')]('/',auth['isAuthenticated'](),controller[_0x9aa3('0xd')]);router[_0x9aa3('0xe')](_0x9aa3('0xa'),auth[_0x9aa3('0x7')](),controller[_0x9aa3('0xf')]);router[_0x9aa3('0x10')]('/:id',auth[_0x9aa3('0x7')](),controller[_0x9aa3('0x11')]);module[_0x9aa3('0x12')]=router; \ No newline at end of file +var _0x4426=['index','/describe','describe','/:id','show','post','create','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4426,0x198));var _0x6442=function(_0x237845,_0x49efa5){_0x237845=_0x237845-0x0;var _0x1bd715=_0x4426[_0x237845];return _0x1bd715;};'use strict';var multer=require(_0x6442('0x0'));var util=require(_0x6442('0x1'));var path=require(_0x6442('0x2'));var timeout=require(_0x6442('0x3'));var express=require(_0x6442('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6442('0x5'));var config=require(_0x6442('0x6'));var controller=require(_0x6442('0x7'));router[_0x6442('0x8')]('/',auth[_0x6442('0x9')](),controller[_0x6442('0xa')]);router[_0x6442('0x8')](_0x6442('0xb'),auth[_0x6442('0x9')](),controller[_0x6442('0xc')]);router['get'](_0x6442('0xd'),auth['isAuthenticated'](),controller[_0x6442('0xe')]);router[_0x6442('0xf')]('/',auth['isAuthenticated'](),controller[_0x6442('0x10')]);router['put']('/:id',auth[_0x6442('0x9')](),controller['update']);router[_0x6442('0x11')]('/:id',auth[_0x6442('0x9')](),controller['destroy']);module[_0x6442('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 76c2ae7..15a628e 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 _0x9edf=['ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','TEXT','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','Agent','#ffffff','INTEGER','BOOLEAN'];(function(_0x48924d,_0xc70b2f){var _0xb4c95c=function(_0x46400e){while(--_0x46400e){_0x48924d['push'](_0x48924d['shift']());}};_0xb4c95c(++_0xc70b2f);}(_0x9edf,0xe7));var _0xf9ed=function(_0x113166,_0x58e406){_0x113166=_0x113166-0x0;var _0x5483f0=_0x9edf[_0x113166];return _0x5483f0;};'use strict';var Sequelize=require(_0xf9ed('0x0'));var rs=require(_0xf9ed('0x1'));module[_0xf9ed('0x2')]={'name':{'type':Sequelize[_0xf9ed('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0x4')},'mapKeyOffline':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0x4')},'key':{'type':Sequelize[_0xf9ed('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0x5')},'customerAlias':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf9ed('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf9ed('0x3')],'allowNull':![],'defaultValue':_0xf9ed('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf9ed('0x3')],'allowNull':![],'defaultValue':_0xf9ed('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf9ed('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf9ed('0x3')]},'animation':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf9ed('0x9')](_0xf9ed('0xa'),_0xf9ed('0xb')),'defaultValue':_0xf9ed('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xf9ed('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0xd')},'header_offline':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0xe')},'download_transcript':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf9ed('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0xf')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf9ed('0x10')},'noteTitle':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf9ed('0x11')},'closingMessage':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0x12')},'closingMessageButton':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0xd')},'skipMessageButton':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0x13')},'conditionAgreement':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0x14')},'ratingType':{'type':Sequelize['ENUM']('star',_0xf9ed('0x15')),'defaultValue':_0xf9ed('0x16')},'ratingStarsNumber':{'type':Sequelize[_0xf9ed('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf9ed('0x17')]({'items':[{'type':_0xf9ed('0x18'),'variable':null,'config':{'placeholder':_0xf9ed('0x19'),'type':_0xf9ed('0x1a'),'required':!![]},'props':{'title':_0xf9ed('0x19'),'helpText':''}},{'type':_0xf9ed('0x18'),'props':{'title':_0xf9ed('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xf9ed('0x4'),'type':_0xf9ed('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf9ed('0x1b')](_0xf9ed('0x1c'))?JSON[_0xf9ed('0x1d')](this['getDataValue'](_0xf9ed('0x1c'))):{};},'set':function(_0x2301b4){return this['setDataValue']('onlineForm',JSON[_0xf9ed('0x17')](_0x2301b4));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf9ed('0x17')]({'items':[{'type':_0xf9ed('0x18'),'props':{'title':_0xf9ed('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xf9ed('0x4'),'type':_0xf9ed('0x4')},'variable':null},{'type':_0xf9ed('0x1e'),'config':{'placeholder':_0xf9ed('0x1f')},'props':{'title':_0xf9ed('0x1f'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xf9ed('0x20'))?JSON['parse'](this[_0xf9ed('0x1b')](_0xf9ed('0x20'))):{};},'set':function(_0x5a2bb2){return this[_0xf9ed('0x21')](_0xf9ed('0x20'),JSON[_0xf9ed('0x17')](_0x5a2bb2));}},'token':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':function(){return rs[_0xf9ed('0x22')]();}},'autoclose':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf9ed('0x3')]},'forwardOffline':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf9ed('0x23')},'waitingMessage':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0x25')},'offlineMessageBody':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0x13')},'sendUnmanaged':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf9ed('0x27')]},'showAgentAvatar':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf9ed('0x3')]},'notificationTemplate':{'type':Sequelize[_0xf9ed('0x27')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xf9ed('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf9ed('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xf9ed('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0xf9ed('0x28')},'messagesAlignment':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0x29')},'defaultTitle':{'type':Sequelize[_0xf9ed('0x3')]},'customerAvatar':{'type':Sequelize[_0xf9ed('0x27')]},'showCustomerAvatar':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf9ed('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf9ed('0x3')],'allowNull':![],'defaultValue':_0xf9ed('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf9ed('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':_0xf9ed('0x2b')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf9ed('0x7')],'comment':_0xf9ed('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1a4cd9){if(!_0x1a4cd9)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0xf9ed('0x2d'),_0x1a4cd9);}},'vidaooEscalation':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf9ed('0x3')]},'vidaooTopic':{'type':Sequelize[_0xf9ed('0x3')],'allowNull':![],'defaultValue':_0xf9ed('0x2e')},'vidaooNote':{'type':Sequelize[_0xf9ed('0x3')],'defaultValue':function(){return _0xf9ed('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0xf9ed('0x27')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf9ed('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf9ed('0x27')]}}; \ No newline at end of file +var _0x4e0a=['textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','address','STRING','email','#011F6A','#ffffff','INTEGER','ENUM','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse'];(function(_0x2c9b79,_0x7cf58b){var _0x265032=function(_0x188a92){while(--_0x188a92){_0x2c9b79['push'](_0x2c9b79['shift']());}};_0x265032(++_0x7cf58b);}(_0x4e0a,0x1bb));var _0xa4e0=function(_0x3d1996,_0x1f08f0){_0x3d1996=_0x3d1996-0x0;var _0x550afd=_0x4e0a[_0x3d1996];return _0x550afd;};'use strict';var Sequelize=require(_0xa4e0('0x0'));var rs=require('randomstring');module[_0xa4e0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa4e0('0x2')},'description':{'type':Sequelize[_0xa4e0('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xa4e0('0x4')},'mapKeyOffline':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xa4e0('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa4e0('0x3')],'allowNull':![],'defaultValue':_0xa4e0('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa4e0('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa4e0('0x3')],'allowNull':![],'defaultValue':_0xa4e0('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xa4e0('0x3')],'allowNull':![],'defaultValue':_0xa4e0('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa4e0('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xa4e0('0x8')]('rounded',_0xa4e0('0x9')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xa4e0('0xa')},'start_chat_button':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0xb')},'offline_chat_button':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0xc')},'header_offline':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0xd')},'download_transcript':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xa4e0('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xa4e0('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa4e0('0x10')]},'closingQuestion':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0x13')},'noteTitle':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa4e0('0x15')},'closingMessage':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0x16')},'closingMessageButton':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xa4e0('0x17')},'conditionAgreement':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0x18')},'ratingType':{'type':Sequelize['ENUM'](_0xa4e0('0x19'),_0xa4e0('0x1a')),'defaultValue':_0xa4e0('0x19')},'ratingStarsNumber':{'type':Sequelize[_0xa4e0('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xa4e0('0x1b')]({'items':[{'type':_0xa4e0('0x1c'),'variable':null,'config':{'placeholder':_0xa4e0('0x1d'),'type':_0xa4e0('0x1e'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0xa4e0('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xa4e0('0x4'),'type':_0xa4e0('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xa4e0('0x1f')](_0xa4e0('0x20'))?JSON[_0xa4e0('0x21')](this[_0xa4e0('0x1f')](_0xa4e0('0x20'))):{};},'set':function(_0x175767){return this['setDataValue'](_0xa4e0('0x20'),JSON[_0xa4e0('0x1b')](_0x175767));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xa4e0('0x1b')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xa4e0('0x4'),'type':'email'},'variable':null},{'type':_0xa4e0('0x22'),'config':{'placeholder':_0xa4e0('0x23')},'props':{'title':'Comments','helpText':_0xa4e0('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0xa4e0('0x1f')](_0xa4e0('0x25'))?JSON[_0xa4e0('0x21')](this[_0xa4e0('0x1f')](_0xa4e0('0x25'))):{};},'set':function(_0x30eb88){return this['setDataValue'](_0xa4e0('0x25'),JSON[_0xa4e0('0x1b')](_0x30eb88));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa4e0('0x26')]();}},'autoclose':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xa4e0('0x3')]},'forwardOffline':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xa4e0('0x3')]},'waitingTitle':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0x29')},'skipUnmanaged':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0xc')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa4e0('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa4e0('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa4e0('0x10')],'defaultValue':function(){return _0xa4e0('0x2a');}},'notificationSound':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xa4e0('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa4e0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0x2d')},'messagesAlignment':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':_0xa4e0('0x2e')},'defaultTitle':{'type':Sequelize[_0xa4e0('0x3')]},'customerAvatar':{'type':Sequelize[_0xa4e0('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xa4e0('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa4e0('0x3')],'allowNull':![],'defaultValue':_0xa4e0('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xa4e0('0x30')},'systemAvatar':{'type':Sequelize[_0xa4e0('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa4e0('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':![],'comment':_0xa4e0('0x31'),'set':function(_0x4acd2d){if(!_0x4acd2d)this[_0xa4e0('0x32')](_0xa4e0('0x33'),null);this[_0xa4e0('0x32')](_0xa4e0('0x34'),_0x4acd2d);}},'vidaooEscalation':{'type':Sequelize[_0xa4e0('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa4e0('0x3')]},'vidaooTopic':{'type':Sequelize[_0xa4e0('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xa4e0('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xa4e0('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xa4e0('0x10')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index ac98aae..b02c613 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 _0x847c=['hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','length','include','find','testWildcardValidity','body','address','\x22\x20is\x20not\x20a\x20valid\x20website\x20domain','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','ChatWebsiteId','Disposition','getDispositions','findOne','intersection','removeDispositions','ids','CannedAnswer','getAnswers','nolimit','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','join','server/files/images/logos/','sitepic','download','getAvatar','server/files/images/avatars/default_avatar.png','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','Interval','resolve','timezone','ifTime','notify','from','From\x20is\x20mandatory','mapKey','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','CmList','List','Contacts','ChatApplication','Applications','Intervals','interval','applications','asc','account','list','contact','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','Writing\x20on\x20closed\x20interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','send','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','mapValues','subjectOffline','email','MailAccount','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','User','Owner','fullname','internal','Tags','color','tag','getProactiveActions','virtual','custom','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.9.0','origin','replace','testWebsiteWithWildcard','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','addApplications','Transaction','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','ChatProactiveAction','online','offlineForm','onlineForm','items','fromKey','Contact','Attachments','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','mustache','util','ejs','fs-extra','jayson/promise','../../components/parsers/qs','api','../../config/environment','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','URL','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','client','http','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatWebsite,\x20%s,\x20%s','message','catch','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','update','then','destroy','stack','name','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','model','type','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','query','keys','filters','fields','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x847c,0xdd));var _0xc847=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x847c[_0x1b2ff7];return _0x31656a;};'use strict';var Mustache=require(_0xc847('0x0'));var util=require(_0xc847('0x1'));var path=require('path');var ejs=require(_0xc847('0x2'));var fs=require('fs');var fs_extra=require(_0xc847('0x3'));var _=require('lodash');var querystring=require('querystring');var htmlToText=require('html-to-text');var Redis=require('ioredis');var jayson=require(_0xc847('0x4'));var qs=require(_0xc847('0x5'));var logger=require('../../config/logger')(_0xc847('0x6'));var config=require(_0xc847('0x7'));var APIBadRequestError=require(_0xc847('0x8'))['APIBadRequestError'];var APINotFoundError=require(_0xc847('0x8'))[_0xc847('0x9')];var APIOutOfIntervalError=require(_0xc847('0x8'))[_0xc847('0xa')];var APIHandleError=require(_0xc847('0x8'))[_0xc847('0xb')];var APIConflictError=require(_0xc847('0x8'))[_0xc847('0xc')];var wildcardUtils=require(_0xc847('0xd'));var URL=require('url')[_0xc847('0xe')];var db=require(_0xc847('0xf'))['db'];config[_0xc847('0x10')]=_[_0xc847('0x11')](config[_0xc847('0x10')],{'host':_0xc847('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc847('0x13'))[_0xc847('0x14')](socket);var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0xc847('0x15')][_0xc847('0x16')]({'port':0x232b});var client9001=jayson[_0xc847('0x15')][_0xc847('0x16')]({'port':0x2329});function respondWithRpcPromise(_0xdc4f11,_0xa2474e,_0x1460cd,_0x560702){return new Promise(function(_0x56647c,_0x63fdab){var _0x253f61=_0x560702||client;return _0x253f61['request'](_0xdc4f11,_0x1460cd)['then'](function(_0x18efc5){logger[_0xc847('0x17')]('ChatWebsite,\x20%s,\x20%s',_0xa2474e,_0xc847('0x18'));logger[_0xc847('0x19')](_0xc847('0x1a'),_0xa2474e,_0xc847('0x18'),JSON[_0xc847('0x1b')](_0x18efc5));if(_0x18efc5['error']){if(_0x18efc5['error'][_0xc847('0x1c')]===0x1f4){logger[_0xc847('0x1d')](_0xc847('0x1e'),_0xa2474e,_0x18efc5[_0xc847('0x1d')][_0xc847('0x1f')]);return _0x63fdab(_0x18efc5[_0xc847('0x1d')][_0xc847('0x1f')]);}logger[_0xc847('0x1d')](_0xc847('0x1e'),_0xa2474e,_0x18efc5[_0xc847('0x1d')][_0xc847('0x1f')]);return _0x56647c(_0x18efc5[_0xc847('0x1d')][_0xc847('0x1f')]);}else{logger[_0xc847('0x17')](_0xc847('0x1e'),_0xa2474e,_0xc847('0x18'));_0x56647c(_0x18efc5['result'][_0xc847('0x1f')]);}})[_0xc847('0x20')](function(_0x106daa){logger[_0xc847('0x1d')](_0xc847('0x1e'),_0xa2474e,_0x106daa);_0x63fdab(_0x106daa);});});}function respondWithStatusCode(_0x525372,_0x67850d){_0x67850d=_0x67850d||0xcc;return function(_0x314c7f){if(_0x314c7f){return _0x525372[_0xc847('0x21')](_0x67850d);}return _0x525372['status'](_0x67850d)[_0xc847('0x22')]();};}function respondWithResult(_0x36f93a,_0x48dc43){_0x48dc43=_0x48dc43||0xc8;return function(_0x486619){if(_0x486619){return _0x36f93a[_0xc847('0x23')](_0x48dc43)[_0xc847('0x24')](_0x486619);}};}function respondWithFilteredResult(_0x272da5,_0x222cd9){return function(_0x52f812){if(_0x52f812){var _0x520d3a=typeof _0x222cd9['offset']===_0xc847('0x25')&&typeof _0x222cd9['limit']==='undefined';var _0x1110fa=_0x52f812[_0xc847('0x26')];var _0x4212fe=_0x520d3a?0x0:_0x222cd9[_0xc847('0x27')];var _0x130273=_0x520d3a?_0x52f812['count']:_0x222cd9[_0xc847('0x27')]+_0x222cd9[_0xc847('0x28')];var _0x2f61a5;if(_0x130273>=_0x1110fa){_0x130273=_0x1110fa;_0x2f61a5=0xc8;}else{_0x2f61a5=0xce;}_0x272da5['status'](_0x2f61a5);return _0x272da5['set'](_0xc847('0x29'),_0x4212fe+'-'+_0x130273+'/'+_0x1110fa)[_0xc847('0x24')](_0x52f812);}return null;};}function saveUpdates(_0x123625){return function(_0x21f2d0){if(_0x21f2d0){return _0x21f2d0[_0xc847('0x2a')](_0x123625)[_0xc847('0x2b')](function(_0x4e81ee){return _0x4e81ee;});}return null;};}function removeEntity(_0x523c4e){return function(_0x4109c7){if(_0x4109c7){return _0x4109c7['destroy']()[_0xc847('0x2b')](function(){var _0x44debe=_0x4109c7['get']({'plain':!![]});var _0x299501='ChatWebsites';return db['UserProfileResource'][_0xc847('0x2c')]({'where':{'type':_0x299501,'resourceId':_0x44debe['id']}})['then'](function(){return _0x4109c7;});})[_0xc847('0x2b')](function(){_0x523c4e[_0xc847('0x23')](0xcc)[_0xc847('0x22')]();});}};}function handleEntityNotFound(_0x3b7dbd){return function(_0x449ac1){if(!_0x449ac1){_0x3b7dbd[_0xc847('0x21')](0x194);}return _0x449ac1;};}function handleError(_0x13a310,_0x44cfa0){_0x44cfa0=_0x44cfa0||0x1f4;return function(_0x2b7194){logger[_0xc847('0x1d')](_0x2b7194[_0xc847('0x2d')]);if(_0x2b7194['name']){delete _0x2b7194[_0xc847('0x2e')];}_0x13a310['status'](_0x44cfa0)['send'](_0x2b7194);};}function createInteractionObject(_0x57e297,_0x1b0f9d,_0x36c5c6,_0xe279f7){var _0x4d04c4=require('user-agent-parser');var _0x2787f8=new _0x4d04c4();var _0xf8cb59=_0x2787f8[_0xc847('0x2f')](_0x36c5c6[_0xc847('0x30')])[_0xc847('0x31')]();var _0xcfe003=_0x1b0f9d[_0xc847('0x32')];if(_0x36c5c6[_0xc847('0x33')]){_0xcfe003=_0x36c5c6['cf-connecting-ip'];}else if(_0x36c5c6[_0xc847('0x34')]){_0xcfe003=_['first'](_0x36c5c6[_0xc847('0x34')][_0xc847('0x35')](','));}return{'ContactId':_0xe279f7['id'],'ChatWebsiteId':_0x57e297,'from':(_0xe279f7[_0xc847('0x36')]||'')+'\x20'+(_0xe279f7[_0xc847('0x37')]||''),'customerIp':_0xcfe003,'customerPort':_0x36c5c6[_0xc847('0x38')]?_0x36c5c6['x-real-port']:null,'referer':_0x1b0f9d[_0xc847('0x39')],'browserName':_0xf8cb59['browser'][_0xc847('0x2e')]&&_0xf8cb59[_0xc847('0x3a')][_0xc847('0x3b')]?util[_0xc847('0x3c')](_0xc847('0x3d'),_0xf8cb59[_0xc847('0x3a')]['name'],_0xf8cb59['browser']['version']):_0xc847('0x3e'),'browserVersion':_0xf8cb59['browser'][_0xc847('0x3b')]||_0xc847('0x3e'),'osName':util[_0xc847('0x3c')](_0xc847('0x3d'),_0xf8cb59['os'][_0xc847('0x2e')],_0xf8cb59['os'][_0xc847('0x3b')]),'osVersion':_0xf8cb59['os'][_0xc847('0x3b')],'deviceModel':_0xf8cb59[_0xc847('0x3f')]['model']&&_0xf8cb59[_0xc847('0x3f')][_0xc847('0x40')]?util[_0xc847('0x3c')](_0xc847('0x41'),_0xf8cb59[_0xc847('0x3f')][_0xc847('0x42')],_0xf8cb59[_0xc847('0x3f')][_0xc847('0x40')],_0xf8cb59[_0xc847('0x3f')][_0xc847('0x43')]):null,'deviceVendor':_0xf8cb59[_0xc847('0x3f')][_0xc847('0x40')],'deviceType':_0xf8cb59[_0xc847('0x3f')]['type'],'formData':JSON[_0xc847('0x1b')](_0x1b0f9d)};}exports['index']=function(_0x4be50a,_0x111aa4){var _0x1e5fb5={'include':[{'model':db[_0xc847('0x44')],'as':_0xc847('0x45')}]},_0x234d94={},_0x300d72={'count':0x0,'rows':[]};var _0x1414b9=_[_0xc847('0x46')](db[_0xc847('0x47')][_0xc847('0x48')],function(_0x3f01be){return{'name':_0x3f01be['fieldName'],'type':_0x3f01be[_0xc847('0x43')]['key']};});_0x234d94[_0xc847('0x42')]=_[_0xc847('0x46')](_0x1414b9,'name');_0x234d94[_0xc847('0x49')]=_[_0xc847('0x4a')](_0x4be50a['query']);_0x234d94[_0xc847('0x4b')]=_['intersection'](_0x234d94[_0xc847('0x42')],_0x234d94[_0xc847('0x49')]);_0x1e5fb5['attributes']=_['intersection'](_0x234d94[_0xc847('0x42')],qs[_0xc847('0x4c')](_0x4be50a['query'][_0xc847('0x4c')]));_0x1e5fb5[_0xc847('0x4d')]=_0x1e5fb5[_0xc847('0x4d')]['length']?_0x1e5fb5[_0xc847('0x4d')]:_0x234d94['model'];if(!_0x4be50a['query'][_0xc847('0x4e')]('nolimit')){_0x1e5fb5[_0xc847('0x28')]=qs[_0xc847('0x28')](_0x4be50a[_0xc847('0x49')][_0xc847('0x28')]);_0x1e5fb5[_0xc847('0x27')]=qs[_0xc847('0x27')](_0x4be50a[_0xc847('0x49')][_0xc847('0x27')]);}_0x1e5fb5[_0xc847('0x4f')]=qs[_0xc847('0x50')](_0x4be50a[_0xc847('0x49')][_0xc847('0x50')]);_0x1e5fb5['where']=qs[_0xc847('0x4b')](_[_0xc847('0x51')](_0x4be50a[_0xc847('0x49')],_0x234d94['filters']),_0x1414b9);if(_0x4be50a['query'][_0xc847('0x52')]){_0x1e5fb5['where']=_['merge'](_0x1e5fb5[_0xc847('0x53')],{'$or':_['map'](_0x1414b9,function(_0x476891){if(_0x476891[_0xc847('0x43')]!==_0xc847('0x54')){var _0x1df134={};_0x1df134[_0x476891['name']]={'$like':'%'+_0x4be50a[_0xc847('0x49')][_0xc847('0x52')]+'%'};return _0x1df134;}})});}_0x1e5fb5=_[_0xc847('0x55')]({},_0x1e5fb5,_0x4be50a[_0xc847('0x56')]);var _0x2205e3={'where':_0x1e5fb5[_0xc847('0x53')]};return db[_0xc847('0x47')][_0xc847('0x26')](_0x2205e3)['then'](function(_0x4a03cd){_0x300d72[_0xc847('0x26')]=_0x4a03cd;if(_0x4be50a[_0xc847('0x49')][_0xc847('0x57')]){_0x1e5fb5['include']=[{'all':!![]}];}return db['ChatWebsite'][_0xc847('0x58')](_0x1e5fb5);})['then'](function(_0x54aa3e){_0x300d72[_0xc847('0x59')]=_0x54aa3e;return _0x300d72;})[_0xc847('0x2b')](respondWithFilteredResult(_0x111aa4,_0x1e5fb5))[_0xc847('0x20')](handleError(_0x111aa4,null));};exports[_0xc847('0x5a')]=function(_0x3e6bdf,_0x2aeaa4){var _0x533186={'raw':![],'where':{'id':_0x3e6bdf[_0xc847('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4c48d2={};_0x4c48d2[_0xc847('0x42')]=_[_0xc847('0x4a')](db[_0xc847('0x47')]['rawAttributes']);_0x4c48d2[_0xc847('0x49')]=_[_0xc847('0x4a')](_0x3e6bdf[_0xc847('0x49')]);_0x4c48d2[_0xc847('0x4b')]=_['intersection'](_0x4c48d2[_0xc847('0x42')],_0x4c48d2[_0xc847('0x49')]);_0x533186[_0xc847('0x4d')]=_['intersection'](_0x4c48d2[_0xc847('0x42')],qs['fields'](_0x3e6bdf['query'][_0xc847('0x4c')]));_0x533186[_0xc847('0x4d')]=_0x533186['attributes'][_0xc847('0x5c')]?_0x533186[_0xc847('0x4d')]:_0x4c48d2[_0xc847('0x42')];if(_0x3e6bdf['query'][_0xc847('0x57')]){_0x533186[_0xc847('0x5d')]=[{'all':!![]}];}_0x533186=_['merge']({},_0x533186,_0x3e6bdf[_0xc847('0x56')]);return db[_0xc847('0x47')][_0xc847('0x5e')](_0x533186)[_0xc847('0x2b')](handleEntityNotFound(_0x2aeaa4,null))[_0xc847('0x2b')](respondWithResult(_0x2aeaa4,null))[_0xc847('0x20')](handleError(_0x2aeaa4,null));};exports['create']=function(_0xbc7c1f,_0x11ea70){if(!wildcardUtils[_0xc847('0x5f')](_0xbc7c1f[_0xc847('0x60')][_0xc847('0x61')])){return handleError(_0x11ea70,null)(new APIBadRequestError('\x22'+_0xbc7c1f[_0xc847('0x60')]['address']+_0xc847('0x62')));}return db[_0xc847('0x47')][_0xc847('0x63')](_0xbc7c1f['body'],{})[_0xc847('0x2b')](function(_0x3d63c4){var _0x27cbb5=_0xbc7c1f[_0xc847('0x64')]['get']({'plain':!![]});if(!_0x27cbb5)throw new Error(_0xc847('0x65'));if(_0x27cbb5[_0xc847('0x66')]===_0xc847('0x64')){var _0x4eaac2=_0x3d63c4[_0xc847('0x67')]({'plain':!![]});var _0x56add4=_0xc847('0x68');return db[_0xc847('0x69')][_0xc847('0x5e')]({'where':{'name':_0x56add4,'userProfileId':_0x27cbb5[_0xc847('0x6a')]},'raw':!![]})[_0xc847('0x2b')](function(_0x253849){if(_0x253849&&_0x253849[_0xc847('0x6b')]===0x0){return db[_0xc847('0x6c')]['create']({'name':_0x4eaac2[_0xc847('0x2e')],'resourceId':_0x4eaac2['id'],'type':_0x253849[_0xc847('0x2e')],'sectionId':_0x253849['id']},{})['then'](function(){return _0x3d63c4;});}else{return _0x3d63c4;}})[_0xc847('0x20')](function(_0x318e84){logger[_0xc847('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x318e84);throw _0x318e84;});}return _0x3d63c4;})[_0xc847('0x2b')](respondWithResult(_0x11ea70,0xc9))[_0xc847('0x20')](handleError(_0x11ea70,null));};exports['update']=function(_0x282dd0,_0x1a6477){if(!wildcardUtils[_0xc847('0x5f')](_0x282dd0['body']['address'])){return handleError(_0x1a6477,null)(new APIBadRequestError('\x22'+_0x282dd0[_0xc847('0x60')]['address']+'\x22\x20is\x20not\x20a\x20valid\x20website\x20domain'));}if(_0x282dd0[_0xc847('0x60')]['id']){delete _0x282dd0['body']['id'];}return db[_0xc847('0x47')][_0xc847('0x5e')]({'where':{'id':_0x282dd0[_0xc847('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xc847('0x45')}]})[_0xc847('0x2b')](handleEntityNotFound(_0x1a6477,null))[_0xc847('0x2b')](saveUpdates(_0x282dd0[_0xc847('0x60')],null))[_0xc847('0x2b')](respondWithResult(_0x1a6477,null))[_0xc847('0x20')](handleError(_0x1a6477,null));};exports[_0xc847('0x2c')]=function(_0x5aa906,_0x11b859){return db[_0xc847('0x47')]['find']({'where':{'id':_0x5aa906['params']['id']}})[_0xc847('0x2b')](handleEntityNotFound(_0x11b859,null))[_0xc847('0x2b')](removeEntity(_0x11b859,null))[_0xc847('0x20')](handleError(_0x11b859,null));};exports[_0xc847('0x6d')]=function(_0x1cbc54,_0x4887a8){return db[_0xc847('0x47')][_0xc847('0x6d')]()['then'](respondWithResult(_0x4887a8,null))[_0xc847('0x20')](handleError(_0x4887a8,null));};exports['addDisposition']=function(_0x592b96,_0x42993c){if(_0x592b96[_0xc847('0x60')]['id']){delete _0x592b96[_0xc847('0x60')]['id'];}return db[_0xc847('0x47')][_0xc847('0x5e')]({'where':{'id':_0x592b96[_0xc847('0x5b')]['id']}})[_0xc847('0x2b')](handleEntityNotFound(_0x42993c,null))[_0xc847('0x2b')](function(_0x523814){if(_0x523814){_0x592b96[_0xc847('0x60')][_0xc847('0x6e')]=_0x523814['id'];return db[_0xc847('0x6f')][_0xc847('0x63')](_0x592b96[_0xc847('0x60')]);}})['then'](respondWithResult(_0x42993c,null))[_0xc847('0x20')](handleError(_0x42993c,null));};exports[_0xc847('0x70')]=function(_0x44bdc2,_0x24a3ba){var _0x4148b7={'raw':![],'where':{}};var _0x297a70={};var _0xeef1bb={'count':0x0,'rows':[]};return db[_0xc847('0x47')][_0xc847('0x71')]({'where':{'id':_0x44bdc2[_0xc847('0x5b')]['id']}})['then'](handleEntityNotFound(_0x24a3ba,null))[_0xc847('0x2b')](function(_0x3e2b0a){if(_0x3e2b0a){_0x297a70[_0xc847('0x42')]=_[_0xc847('0x4a')](db[_0xc847('0x6f')][_0xc847('0x48')]);_0x297a70[_0xc847('0x49')]=_[_0xc847('0x4a')](_0x44bdc2[_0xc847('0x49')]);_0x297a70[_0xc847('0x4b')]=_[_0xc847('0x72')](_0x297a70['model'],_0x297a70['query']);_0x4148b7[_0xc847('0x4d')]=_[_0xc847('0x72')](_0x297a70['model'],qs[_0xc847('0x4c')](_0x44bdc2[_0xc847('0x49')][_0xc847('0x4c')]));_0x4148b7[_0xc847('0x4d')]=_0x4148b7[_0xc847('0x4d')][_0xc847('0x5c')]?_0x4148b7['attributes']:_0x297a70[_0xc847('0x42')];if(!_0x44bdc2[_0xc847('0x49')][_0xc847('0x4e')]('nolimit')){_0x4148b7[_0xc847('0x28')]=qs[_0xc847('0x28')](_0x44bdc2['query']['limit']);_0x4148b7[_0xc847('0x27')]=qs[_0xc847('0x27')](_0x44bdc2[_0xc847('0x49')]['offset']);}_0x4148b7[_0xc847('0x4f')]=qs[_0xc847('0x50')](_0x44bdc2[_0xc847('0x49')][_0xc847('0x50')]);_0x4148b7[_0xc847('0x53')]=qs[_0xc847('0x4b')](_[_0xc847('0x51')](_0x44bdc2[_0xc847('0x49')],_0x297a70[_0xc847('0x4b')]));_0x4148b7['where'][_0xc847('0x6e')]=_0x3e2b0a['id'];if(_0x44bdc2['query'][_0xc847('0x52')]){_0x4148b7['where']=_[_0xc847('0x55')](_0x4148b7['where'],{'$or':_['map'](_0x4148b7[_0xc847('0x4d')],function(_0x292e7e){var _0x4f675b={};_0x4f675b[_0x292e7e]={'$like':'%'+_0x44bdc2[_0xc847('0x49')][_0xc847('0x52')]+'%'};return _0x4f675b;})});}_0x4148b7=_[_0xc847('0x55')]({},_0x4148b7,_0x44bdc2[_0xc847('0x56')]);return db[_0xc847('0x6f')][_0xc847('0x26')]({'where':_0x4148b7[_0xc847('0x53')]})['then'](function(_0x31c9d8){_0xeef1bb[_0xc847('0x26')]=_0x31c9d8;if(_0x44bdc2[_0xc847('0x49')][_0xc847('0x57')]){_0x4148b7[_0xc847('0x5d')]=[{'all':!![]}];}return db[_0xc847('0x6f')][_0xc847('0x58')](_0x4148b7);})[_0xc847('0x2b')](function(_0x4728d4){_0xeef1bb['rows']=_0x4728d4;return _0xeef1bb;});}})[_0xc847('0x2b')](respondWithFilteredResult(_0x24a3ba,_0x4148b7))[_0xc847('0x20')](handleError(_0x24a3ba,null));};exports[_0xc847('0x73')]=function(_0x4e51d8,_0x3f4beb){return db['ChatWebsite']['find']({'where':{'id':_0x4e51d8[_0xc847('0x5b')]['id']}})[_0xc847('0x2b')](handleEntityNotFound(_0x3f4beb,null))['then'](function(_0x3342dc){if(_0x3342dc){return _0x3342dc[_0xc847('0x73')](_0x4e51d8['query'][_0xc847('0x74')]);}})[_0xc847('0x2b')](respondWithStatusCode(_0x3f4beb,null))[_0xc847('0x20')](handleError(_0x3f4beb,null));};exports['addAnswer']=function(_0x5ef70c,_0x161d5c){if(_0x5ef70c[_0xc847('0x60')]['id']){delete _0x5ef70c['body']['id'];}return db[_0xc847('0x47')][_0xc847('0x5e')]({'where':{'id':_0x5ef70c[_0xc847('0x5b')]['id']}})['then'](handleEntityNotFound(_0x161d5c,null))['then'](function(_0x4a3561){if(_0x4a3561){_0x5ef70c[_0xc847('0x60')][_0xc847('0x6e')]=_0x4a3561['id'];return db[_0xc847('0x75')][_0xc847('0x63')](_0x5ef70c[_0xc847('0x60')]);}})['then'](respondWithResult(_0x161d5c,null))[_0xc847('0x20')](handleError(_0x161d5c,null));};exports[_0xc847('0x76')]=function(_0x3e5c2a,_0x151e6f){var _0x17270a={'raw':![],'where':{}};var _0x5609fa={};var _0x2525eb={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc847('0x71')]({'where':{'id':_0x3e5c2a['params']['id']}})[_0xc847('0x2b')](handleEntityNotFound(_0x151e6f,null))[_0xc847('0x2b')](function(_0x2a86e4){if(_0x2a86e4){_0x5609fa['model']=_[_0xc847('0x4a')](db[_0xc847('0x75')][_0xc847('0x48')]);_0x5609fa['query']=_[_0xc847('0x4a')](_0x3e5c2a[_0xc847('0x49')]);_0x5609fa[_0xc847('0x4b')]=_[_0xc847('0x72')](_0x5609fa[_0xc847('0x42')],_0x5609fa['query']);_0x17270a[_0xc847('0x4d')]=_[_0xc847('0x72')](_0x5609fa[_0xc847('0x42')],qs['fields'](_0x3e5c2a[_0xc847('0x49')][_0xc847('0x4c')]));_0x17270a[_0xc847('0x4d')]=_0x17270a[_0xc847('0x4d')]['length']?_0x17270a['attributes']:_0x5609fa['model'];if(!_0x3e5c2a[_0xc847('0x49')]['hasOwnProperty'](_0xc847('0x77'))){_0x17270a['limit']=qs[_0xc847('0x28')](_0x3e5c2a['query']['limit']);_0x17270a['offset']=qs[_0xc847('0x27')](_0x3e5c2a['query'][_0xc847('0x27')]);}_0x17270a[_0xc847('0x4f')]=qs['sort'](_0x3e5c2a[_0xc847('0x49')][_0xc847('0x50')]);_0x17270a['where']=qs[_0xc847('0x4b')](_[_0xc847('0x51')](_0x3e5c2a[_0xc847('0x49')],_0x5609fa[_0xc847('0x4b')]));_0x17270a[_0xc847('0x53')]['ChatWebsiteId']=_0x2a86e4['id'];if(_0x3e5c2a['query'][_0xc847('0x52')]){_0x17270a['where']=_['merge'](_0x17270a[_0xc847('0x53')],{'$or':_[_0xc847('0x46')](_0x17270a[_0xc847('0x4d')],function(_0x17ef3e){var _0x4fda31={};_0x4fda31[_0x17ef3e]={'$like':'%'+_0x3e5c2a[_0xc847('0x49')]['filter']+'%'};return _0x4fda31;})});}_0x17270a=_[_0xc847('0x55')]({},_0x17270a,_0x3e5c2a[_0xc847('0x56')]);return db[_0xc847('0x75')][_0xc847('0x26')]({'where':_0x17270a[_0xc847('0x53')]})[_0xc847('0x2b')](function(_0x3f74ae){_0x2525eb['count']=_0x3f74ae;if(_0x3e5c2a[_0xc847('0x49')]['includeAll']){_0x17270a['include']=[{'all':!![]}];}return db[_0xc847('0x75')]['findAll'](_0x17270a);})[_0xc847('0x2b')](function(_0xd1decb){_0x2525eb[_0xc847('0x59')]=_0xd1decb;return _0x2525eb;});}})[_0xc847('0x2b')](respondWithFilteredResult(_0x151e6f,_0x17270a))[_0xc847('0x20')](handleError(_0x151e6f,null));};exports[_0xc847('0x78')]=function(_0x25cb24,_0x883b3d){return db[_0xc847('0x47')][_0xc847('0x5e')]({'where':{'id':_0x25cb24[_0xc847('0x5b')]['id']}})[_0xc847('0x2b')](handleEntityNotFound(_0x883b3d,null))[_0xc847('0x2b')](function(_0xddb3ad){if(_0xddb3ad){return _0xddb3ad[_0xc847('0x78')](_0x25cb24[_0xc847('0x49')][_0xc847('0x74')]);}})['then'](respondWithStatusCode(_0x883b3d,null))[_0xc847('0x20')](handleError(_0x883b3d,null));};exports[_0xc847('0x79')]=function(_0x32b268,_0x255f31){_0x32b268[_0xc847('0x60')]['sitepic']=_0x32b268[_0xc847('0x7a')][_0xc847('0x7b')];return db['ChatWebsite']['find']({'where':{'id':_0x32b268[_0xc847('0x5b')]['id']}})[_0xc847('0x2b')](handleEntityNotFound(_0x255f31,null))['then'](saveUpdates(_0x32b268[_0xc847('0x60')],null))[_0xc847('0x2b')](respondWithResult(_0x255f31,null))[_0xc847('0x20')](handleError(_0x255f31,null));};exports[_0xc847('0x7c')]=function(_0x23e38e,_0x47f60c){_0x23e38e[_0xc847('0x60')][_0xc847('0x7d')]=_0x23e38e[_0xc847('0x7a')][_0xc847('0x7b')];return db[_0xc847('0x47')][_0xc847('0x5e')]({'where':{'id':_0x23e38e[_0xc847('0x5b')]['id']}})['then'](handleEntityNotFound(_0x47f60c,null))[_0xc847('0x2b')](saveUpdates(_0x23e38e[_0xc847('0x60')],null))[_0xc847('0x2b')](respondWithResult(_0x47f60c,null))[_0xc847('0x20')](handleError(_0x47f60c,null));};exports[_0xc847('0x7e')]=function(_0x476a29,_0x5a16bc){_0x476a29[_0xc847('0x60')][_0xc847('0x7f')]=_0x476a29[_0xc847('0x7a')]['filename'];return db['ChatWebsite'][_0xc847('0x5e')]({'where':{'id':_0x476a29[_0xc847('0x5b')]['id']}})[_0xc847('0x2b')](handleEntityNotFound(_0x5a16bc,null))[_0xc847('0x2b')](saveUpdates(_0x476a29[_0xc847('0x60')],null))['then'](respondWithResult(_0x5a16bc,null))[_0xc847('0x20')](handleError(_0x5a16bc,null));};exports[_0xc847('0x80')]=function(_0xf18b3a,_0x31f9e0){_0xf18b3a['body'][_0xc847('0x81')]=_0xf18b3a['file'][_0xc847('0x7b')];return db[_0xc847('0x47')][_0xc847('0x5e')]({'where':{'id':_0xf18b3a[_0xc847('0x5b')]['id']}})['then'](handleEntityNotFound(_0x31f9e0,null))['then'](saveUpdates(_0xf18b3a['body'],null))[_0xc847('0x2b')](respondWithResult(_0x31f9e0,null))[_0xc847('0x20')](handleError(_0x31f9e0,null));};exports[_0xc847('0x82')]=function(_0x20de1f,_0x564195){var _0x23bde5=path['join'](config[_0xc847('0x83')],_0xc847('0x84'));var _0x3ff402={'where':{'id':_0x20de1f[_0xc847('0x5b')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x1da92c=![];return require(_0xc847('0x85'))[_0xc847('0x86')]()['then'](function(_0x1878c1){if(_0x1878c1){_0x1da92c=_0x1878c1['custom'];}})['then'](function(){return db['ChatWebsite'][_0xc847('0x5e')](_0x3ff402);})[_0xc847('0x2b')](handleEntityNotFound(_0x564195,null))['then'](function(_0x4af202){if(_0x4af202){if(!_[_0xc847('0x87')](_0x4af202['sitepic'])){if(fs[_0xc847('0x88')](path[_0xc847('0x89')](config[_0xc847('0x83')],_0xc847('0x8a'),_0x4af202[_0xc847('0x8b')]))&&_0x1da92c){_0x23bde5=path[_0xc847('0x89')](config['root'],_0xc847('0x8a'),_0x4af202['sitepic']);}}return _0x564195[_0xc847('0x8c')](_0x23bde5);}})['catch'](handleError(_0x564195,null));};exports[_0xc847('0x8d')]=function(_0x108395,_0x5f4f3b){var _0x36feaf=path[_0xc847('0x89')](config[_0xc847('0x83')],_0xc847('0x8e'));var _0x3dd7bb={'where':{'id':_0x108395[_0xc847('0x5b')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db['ChatWebsite'][_0xc847('0x5e')](_0x3dd7bb)[_0xc847('0x2b')](handleEntityNotFound(_0x5f4f3b,null))[_0xc847('0x2b')](function(_0x17fe66){if(_0x17fe66){if(!_['isNil'](_0x17fe66['agentAvatar'])){if(fs[_0xc847('0x88')](path['join'](config[_0xc847('0x83')],'server/files/images/avatars/',_0x17fe66['agentAvatar']))){_0x36feaf=path[_0xc847('0x89')](config[_0xc847('0x83')],'server/files/images/avatars/',_0x17fe66[_0xc847('0x7d')]);}}return _0x5f4f3b[_0xc847('0x8c')](_0x36feaf);}})[_0xc847('0x20')](handleError(_0x5f4f3b,null));};exports[_0xc847('0x8f')]=function(_0x26fe91,_0x35f5ab){var _0x19f2a1=path[_0xc847('0x89')](config[_0xc847('0x83')],_0xc847('0x90'));var _0x250b1c={'where':{'id':_0x26fe91[_0xc847('0x5b')]['id']},'attributes':['id',_0xc847('0x7f'),_0xc847('0x91')],'raw':!![]};return db['ChatWebsite'][_0xc847('0x5e')](_0x250b1c)[_0xc847('0x2b')](handleEntityNotFound(_0x35f5ab,null))[_0xc847('0x2b')](function(_0x1abd14){if(_0x1abd14){if(!_['isNil'](_0x1abd14[_0xc847('0x7f')])){if(fs[_0xc847('0x88')](path['join'](config[_0xc847('0x83')],_0xc847('0x92'),_0x1abd14[_0xc847('0x7f')]))&&_0x1abd14[_0xc847('0x91')]){_0x19f2a1=path[_0xc847('0x89')](config[_0xc847('0x83')],_0xc847('0x92'),_0x1abd14[_0xc847('0x7f')]);}}return _0x35f5ab['download'](_0x19f2a1);}})[_0xc847('0x20')](handleError(_0x35f5ab,null));};exports['getSystemAvatar']=function(_0x4c82e7,_0x4c8770){var _0x2b7f5=path[_0xc847('0x89')](config[_0xc847('0x83')],'server/files/images/avatars/system_avatar.png');var _0x1d4976={'where':{'id':_0x4c82e7[_0xc847('0x5b')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0xc847('0x5e')](_0x1d4976)[_0xc847('0x2b')](handleEntityNotFound(_0x4c8770,null))[_0xc847('0x2b')](function(_0x29d61a){if(_0x29d61a){if(!_['isNil'](_0x29d61a[_0xc847('0x81')])){if(fs[_0xc847('0x88')](path[_0xc847('0x89')](config[_0xc847('0x83')],_0xc847('0x92'),_0x29d61a[_0xc847('0x81')]))){_0x2b7f5=path[_0xc847('0x89')](config[_0xc847('0x83')],_0xc847('0x92'),_0x29d61a['systemAvatar']);}}return _0x4c8770[_0xc847('0x8c')](_0x2b7f5);}})['catch'](handleError(_0x4c8770,null));};function checkWebsiteInterval(_0x27e854){var _0xbf18c5=_0x27e854[_0xc847('0x93')];if(!_0xbf18c5){return Promise[_0xc847('0x94')](_0x27e854);}var _0x556e53=_0x27e854[_0xc847('0x95')]||undefined;return _0xbf18c5[_0xc847('0x96')](_0x556e53)[_0xc847('0x2b')](function(_0x1ea923){if(!_0x1ea923){throw new APIOutOfIntervalError();}return _0x27e854;});}exports[_0xc847('0x97')]=function(_0x2665b1,_0x4c198f){var _0x567171={'body':_0x2665b1['body'],'channel':'chat'};var _0x4469f5=[];var _0x4cfac0=[];var _0x393204={};var _0xba6183=![];if(_0x2665b1[_0xc847('0x60')]['id']){delete _0x2665b1['body']['id'];}if(_['isNil'](_0x2665b1['body'][_0xc847('0x98')])){throw new APIBadRequestError(_0xc847('0x99'));}if(_[_0xc847('0x87')](_0x2665b1[_0xc847('0x60')][_0xc847('0x9a')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_['isEmpty'](_0x2665b1[_0xc847('0x60')]['body'])){throw new APIBadRequestError(_0xc847('0x9b'));}var _0x43e2f9=_0x2665b1['body'][_0xc847('0x32')]&&_0x2665b1[_0xc847('0x60')]['referer'];return db[_0xc847('0x9c')][_0xc847('0x6d')]()[_0xc847('0x2b')](function(_0x29d83b){if(!_0x29d83b){throw new Error(_0xc847('0x9d'));}_0x4469f5=Object[_0xc847('0x4a')](_0x29d83b)[_0xc847('0x52')](function(_0x13a521){return![_0xc847('0x9e'),_0xc847('0x9f')][_0xc847('0xa0')](_0x13a521);});_0x4cfac0=Object['keys'](_0x29d83b)[_0xc847('0x52')](function(_0x57e994){return![_0xc847('0x9e'),'updatedAt',_0xc847('0xa1'),_0xc847('0xa2')]['includes'](_0x57e994);});if(!_[_0xc847('0xa0')](_0x4cfac0,_0x2665b1['body'][_0xc847('0x9a')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x4cfac0[_0xc847('0x89')](',\x20'));}_0x393204[_0x2665b1['body'][_0xc847('0x9a')]]=_0x2665b1[_0xc847('0x60')][_0xc847('0x98')];})['then'](function(){return db[_0xc847('0x47')][_0xc847('0x5e')]({'where':{'id':_0x2665b1[_0xc847('0x5b')]['id']},'include':[{'model':db[_0xc847('0xa3')],'as':_0xc847('0xa4'),'include':[{'model':db['CmContact'],'as':_0xc847('0xa5'),'where':_0x393204,'limit':0x1,'order':[[_0xc847('0x9f'),'DESC']]}]},{'model':db[_0xc847('0xa6')],'as':_0xc847('0xa7')},{'model':db['Interval'],'as':_0xc847('0x93'),'include':[{'model':db['Interval'],'as':_0xc847('0xa8'),'attributes':['id',_0xc847('0xa9')],'raw':!![]}]}]});})['then'](function(_0x5a2e52){if(!_0x5a2e52){throw new APINotFoundError(util[_0xc847('0x3c')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x2665b1[_0xc847('0x5b')]['id']));}if(_0x43e2f9){return checkWebsiteInterval(_0x5a2e52);}return _0x5a2e52;})[_0xc847('0x2b')](function(_0x15d9c8){_0x567171['account']=_0x15d9c8;_0x567171[_0xc847('0xaa')]=_['orderBy'](_0x15d9c8['Applications'],['priority'],[_0xc847('0xab')]);if(_0x567171[_0xc847('0xac')][_0xc847('0xa7')]){delete _0x567171[_0xc847('0xac')]['Applications'];}_0x567171[_0xc847('0xad')]=_0x15d9c8['List']||{'id':_0x15d9c8[_0xc847('0xa2')]};if(_0x567171[_0xc847('0xad')]&&_0x567171[_0xc847('0xad')][_0xc847('0xa5')]['length']){return _0x567171[_0xc847('0xad')][_0xc847('0xa5')][0x0];}var _0x46acec=_[_0xc847('0x11')](_0x2665b1[_0xc847('0x60')],{'firstName':_0x2665b1['body'][_0xc847('0x98')],'ListId':_0x15d9c8[_0xc847('0xa2')]});_0x46acec[_0x2665b1[_0xc847('0x60')][_0xc847('0x9a')]]=_0x2665b1[_0xc847('0x60')]['from'];return db[_0xc847('0x9c')][_0xc847('0x63')](_0x46acec,{'fields':_0x4469f5,'raw':!![]});})[_0xc847('0x2b')](function(_0x2a981e){_0x567171[_0xc847('0xae')]=_0x2a981e;var _0x48ad90=createInteractionObject(_0x2665b1[_0xc847('0x5b')]['id'],_0x2665b1[_0xc847('0x60')],_0x2665b1[_0xc847('0xaf')],_0x2a981e);var _0x2e2d2e={'ChatWebsiteId':_0x2665b1[_0xc847('0x5b')]['id']};if(_0x2665b1[_0xc847('0x60')][_0xc847('0xb0')]){_0x2e2d2e[_0xc847('0xb0')]=_0x2665b1['body'][_0xc847('0xb0')];_0x2e2d2e['closed']=![];return db[_0xc847('0xb1')][_0xc847('0x5e')]({'where':_0x2e2d2e})[_0xc847('0x2b')](function(_0x9baef6){var _0x3f22d7=_0x2665b1['body']['customerIp']&&_0x2665b1[_0xc847('0x60')]['referer'];if(_0x9baef6){_0xba6183=!![];return _0x9baef6;}else if(!_0x3f22d7&&_0x9baef6&&_0x9baef6['closed']){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x48ad90[_0xc847('0xb0')]=_0x2665b1[_0xc847('0x60')]['threadId'];_0x48ad90['externalUrl']=_0x2665b1['body'][_0xc847('0xb2')];return db[_0xc847('0xb1')][_0xc847('0x63')](_0x48ad90);});}_0x2e2d2e[_0xc847('0xb3')]=_0x2a981e['id'];if(_0x2665b1[_0xc847('0x60')][_0xc847('0xb4')]&&_0x2665b1[_0xc847('0x60')]['interaction']['id']){_0x2e2d2e['id']=_0x2665b1['body'][_0xc847('0xb4')]['id'];return db[_0xc847('0xb1')][_0xc847('0x5e')]({'where':_0x2e2d2e})[_0xc847('0x2b')](function(_0x219c1d){var _0x4086da=_0x2665b1['body'][_0xc847('0x32')]&&_0x2665b1[_0xc847('0x60')]['referer'];if(!_0x4086da&&_0x219c1d&&_0x219c1d['closed']){throw new APIConflictError(_0xc847('0xb5'));}else if(_0x219c1d){_0xba6183=!![];return _0x219c1d;}else{return db[_0xc847('0xb1')][_0xc847('0x63')](_0x48ad90);}});}return db[_0xc847('0xb1')]['create'](_0x48ad90);})[_0xc847('0x2b')](function(_0xb1f3f2){if(!_0xba6183){return _0xb1f3f2;}var _0x362b40={'from':(_0x567171[_0xc847('0xae')]['firstName']||'')+'\x20'+(_0x567171[_0xc847('0xae')][_0xc847('0x37')]||'')};if(_0x2665b1['body']['threadId']&&_0x2665b1[_0xc847('0x60')][_0xc847('0xb6')]&&_0x2665b1['body'][_0xc847('0xb0')]!=_0x2665b1[_0xc847('0x60')][_0xc847('0xb6')]){_0x362b40[_0xc847('0xb0')]=_0x2665b1[_0xc847('0x60')][_0xc847('0xb6')];}return _0xb1f3f2[_0xc847('0x2a')](_0x362b40);})['then'](function(_0x33932a){_0x567171[_0xc847('0xb4')]=_0x33932a[_0xc847('0x67')]({'plain':!![]});_0x567171[_0xc847('0xb4')]['created']=!_0xba6183;if(_0x567171[_0xc847('0xb4')][_0xc847('0xb7')]){if(_0x567171[_0xc847('0xac')][_0xc847('0xb8')]){_0x567171[_0xc847('0xaa')][_0xc847('0xb9')]({'id':0x0,'priority':_0x567171[_0xc847('0xaa')][_0xc847('0x5c')]+0x1,'app':_0xc847('0xba'),'appdata':_0xc847('0xbb'),'interval':_0xc847('0xbc')});}}return db['ChatMessage'][_0xc847('0x63')]({'body':_0x2665b1['body'][_0xc847('0x60')],'ChatWebsiteId':_0x2665b1['params']['id'],'ChatInteractionId':_0x33932a['id'],'direction':'in','ContactId':_0x567171[_0xc847('0xae')]['id'],'AttachmentId':_0x2665b1[_0xc847('0x60')][_0xc847('0xbd')]});})[_0xc847('0x2b')](function(_0x2da930){_0x567171[_0xc847('0x1f')]=_0x2da930;if(!_0x567171['interaction'][_0xc847('0xbe')]){return;}return db['User'][_0xc847('0x5e')]({'attributes':['id',_0xc847('0x2e')],'where':{'id':_0x567171[_0xc847('0xb4')][_0xc847('0xbe')]}});})[_0xc847('0x2b')](function(_0x3232dc){if(_0x3232dc){_0x567171[_0xc847('0xaa')][_0xc847('0xbf')]({'id':0x0,'priority':0x0,'app':_0xc847('0xc0'),'appdata':_0x3232dc['name']+','+(_0x567171[_0xc847('0xac')][_0xc847('0xc1')]||0xa),'interval':_0xc847('0xbc')});_0x567171['forcedOwnership']=!![];}if(!_0x567171[_0xc847('0xb4')][_0xc847('0xc2')]){return;}return db[_0xc847('0xc3')][_0xc847('0x5e')]({'attributes':['id',_0xc847('0x2e')],'where':{'id':_0x567171['interaction'][_0xc847('0xc2')]}});})[_0xc847('0x2b')](function(_0x4027d0){if(_0x4027d0){_0x567171['applications'][_0xc847('0xbf')]({'id':0x0,'priority':0x1,'app':_0xc847('0xc4'),'appdata':_0x4027d0['name']+','+(_0x567171[_0xc847('0xac')][_0xc847('0xc5')]||0x12c),'interval':_0xc847('0xbc')});}return respondWithRpcPromise(_0xc847('0xc6'),_0xc847('0xc7'),_0x567171);})['then'](function(_0x1515c6){respondWithRpcPromise('EventManager','EventManager',{'event':_0xc847('0x97'),'message':_0x1515c6},client9002);return _0x1515c6;})['then'](respondWithResult(_0x4c198f,null))[_0xc847('0x20')](APIHandleError(_0x4c198f));};exports[_0xc847('0xc8')]=function(_0x2a59dd,_0x4c7f4a){var _0x471372,_0x951697,_0x79a2aa;var _0x1e6fcb=[];var _0x309efd={};var _0x432835=_0x2a59dd[_0xc847('0xc9')]||[];var _0x1a4653=[];var _0x602504;return db[_0xc847('0x9c')][_0xc847('0x6d')]()[_0xc847('0x2b')](function(_0x55d339){if(!_0x55d339){throw new db[(_0xc847('0xca'))][(_0xc847('0xcb'))](_0xc847('0xcc'));}_0x1e6fcb=_['difference'](_[_0xc847('0x4a')](_0x55d339),[_0xc847('0x9e'),_0xc847('0x9f'),_0xc847('0xa1'),_0xc847('0xa2')]);if(_0x2a59dd[_0xc847('0x60')]['id']){delete _0x2a59dd[_0xc847('0x60')]['id'];}if(_[_0xc847('0x87')](_0x2a59dd[_0xc847('0x60')][_0xc847('0x98')])){throw _0x4c7f4a[_0xc847('0x23')](0x1f4)[_0xc847('0xcd')](new db[(_0xc847('0xca'))][(_0xc847('0xcb'))](_0xc847('0xce')));}if(_[_0xc847('0x87')](_0x2a59dd[_0xc847('0x60')][_0xc847('0x60')])||_0x2a59dd[_0xc847('0x60')]['body']===''){throw _0x4c7f4a[_0xc847('0x23')](0x1f4)[_0xc847('0xcd')](new db[(_0xc847('0xca'))][(_0xc847('0xcb'))](_0xc847('0xcf')));}if(_[_0xc847('0x87')](_0x2a59dd['body'][_0xc847('0xd0')])){throw _0x4c7f4a['status'](0x1f4)[_0xc847('0xcd')](new db['Sequelize']['ValidationError'](_0xc847('0xd1')+_0x1e6fcb));}if(!_[_0xc847('0xa0')](_0x1e6fcb,_0x2a59dd[_0xc847('0x60')][_0xc847('0xd0')])){throw _0x4c7f4a[_0xc847('0x23')](0x1f4)[_0xc847('0xcd')](new db['Sequelize']['ValidationError'](_0xc847('0xd2')+_0x1e6fcb));}_0x309efd[_0x2a59dd[_0xc847('0x60')][_0xc847('0xd0')]]=_0x2a59dd[_0xc847('0x60')]['from'];})[_0xc847('0x2b')](function(){return db[_0xc847('0x47')][_0xc847('0x5e')]({'where':{'id':_0x2a59dd[_0xc847('0x5b')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0xc847('0x2b')](handleEntityNotFound(_0x4c7f4a,null))[_0xc847('0x2b')](function(_0x347451){if(_0x347451&&_0x347451['List']){_0x951697=_0x347451;var _0x5b1af2=_[_0xc847('0x11')](_0x2a59dd['body'],{'firstName':_0x2a59dd['body']['from'],'phone':_0x2a59dd[_0xc847('0x60')][_0xc847('0x98')],'ListId':_0x347451[_0xc847('0xa2')]});_0x5b1af2[_0x2a59dd[_0xc847('0x60')][_0xc847('0xd0')]]=_0x2a59dd[_0xc847('0x60')][_0xc847('0x98')];return db[_0xc847('0x9c')][_0xc847('0xd3')]({'where':_0x309efd,'defaults':_0x5b1af2});}})[_0xc847('0xd4')](function(_0x5cb089){if(_0x5cb089){_0x79a2aa=_0x5cb089;var _0x5590be=fs['readFileSync'](path[_0xc847('0x89')](config[_0xc847('0x83')],_0xc847('0xd5')),_0xc847('0xd6'));var _0x2a7578=ejs[_0xc847('0xd7')](_0x5590be,{'body':_[_0xc847('0xd8')](_0x2a59dd['body']['body']),'bodyTitle':_0x951697['offlineMessageBody']});return db[_0xc847('0xd9')]['create']({'body':_0x2a7578,'plainBody':htmlToText[_0xc847('0xda')](_0x2a7578),'ContactId':_0x5cb089['id'],'ChatWebsiteId':_0x951697['id']});}})['then'](function(_0xf4fb59){_0x602504=_0xf4fb59;if(_0x432835[_0xc847('0x5c')]){var _0x45c4f7=_0x432835['map'](function(_0x1548c4){return{'name':_0x1548c4[_0xc847('0xdb')],'basename':_0x1548c4[_0xc847('0x7b')],'type':_0x1548c4[_0xc847('0xdc')],'ChatOfflineMessageId':_0xf4fb59['id']};});_0x1a4653=_0x45c4f7['map'](_0x2855d9=>{var _0x5926f3={'filename':_0x2855d9['name'],'path':path[_0xc847('0x89')](config[_0xc847('0x83')],_0xc847('0xdd'),_0xc847('0xc9'),_0xc847('0xde'),_0xc847('0xdf'),_0x2855d9[_0xc847('0xe0')])};return _0x5926f3;});if(!_0x951697[_0xc847('0xe1')]){return db[_0xc847('0xe2')][_0xc847('0xe3')](function(_0x2da126){return db[_0xc847('0xe4')][_0xc847('0xe5')](_0x45c4f7,{'transaction':_0x2da126});});}}})[_0xc847('0x2b')](function(){if(_0x602504){_0x471372=_0x602504;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xc847('0xe6')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc847('0xe7'),'raw':!![]}]}]});}})[_0xc847('0x2b')](function(_0x5b4ba2){if(_0x5b4ba2&&_0x5b4ba2[_0xc847('0xe8')]&&_0x951697['forwardOffline']&&_0x951697[_0xc847('0xe9')]){var _0x2c8e41=_0x5b4ba2[_0xc847('0xea')]();return respondWithRpcPromise(_0xc847('0xeb'),'sendMail',{'account':_0x2c8e41,'message':{'from':util['format'](_0xc847('0xec'),_0x5b4ba2['name'],_0x5b4ba2['email']||_0x5b4ba2[_0xc847('0xe8')][_0xc847('0x64')]),'to':_0x951697['forwardOfflineAddress'],'subject':_0x951697[_0xc847('0xed')],'html':_0x471372['body'],'attachments':_0x1a4653}},client9003)[_0xc847('0x2b')](function(){return _0x471372;})[_0xc847('0x20')](function(_0x6c54de){logger[_0xc847('0x1d')](_0x6c54de);});}})[_0xc847('0x2b')](function(){if(_0x951697&&_0x951697[_0xc847('0xe1')]&&_0x951697[_0xc847('0xee')]){var _0x34afcc=[];if(_0x432835[_0xc847('0x5c')]){_0x34afcc=_0x432835[_0xc847('0x46')](function(_0x4027c4){return{'name':_0x4027c4['originalname'],'basename':_0x4027c4[_0xc847('0x7b')],'type':_0x4027c4['mimetype'],'ChatOfflineMessageId':_0x602504['id']};});}var _0x1ff90b;if(!_['isNil'](_0x951697['subjectOffline'])){var _0x3292be=_[_0xc847('0x46')](_0x2a59dd[_0xc847('0x60')],function(_0x39d09a){return _0x39d09a;});var _0xa99c9f=_['toPairsIn'](_0x3292be)[0x0];var _0x4f32ce=_[_0xc847('0xef')](_0xa99c9f,function(_0x4daeed){return _0x4daeed;});_0x1ff90b=_0x4f32ce[0x1][_0x951697[_0xc847('0xf0')]];}var _0x2f4c7b={'from':_0x79a2aa[_0xc847('0xf1')],'firstName':_0x79a2aa[_0xc847('0x36')],'lastName':_0x79a2aa['lastName'],'mapKey':_0xc847('0xf1'),'message':{'from':_0x79a2aa['email'],'to':_0x951697[_0xc847('0xf2')][_0xc847('0xf1')],'cc':'','subject':_[_0xc847('0x87')](_0x1ff90b)?_0x951697[_0xc847('0xed')]:_0x1ff90b,'messageId':'','sentAt':new Date(),'attach':_0x34afcc[_0xc847('0x5c')],'attachments':_0x34afcc,'originChannel':'Chat','ChatWebsiteId':_0x951697['id'],'ChatOfflineMessageId':_0x471372['id'],'originTo':_0x951697['MailAccount']['email']},'body':_0x471372[_0xc847('0x60')]};var _0x1f9d71={'account':{'id':_0x951697['MailAccountId']},'body':_0x2f4c7b,'log':_0xc847('0xf3')};return respondWithRpcPromise('NotifyMailAccount',_0xc847('0xf4'),_0x1f9d71,client9001)[_0xc847('0x2b')](function(){return _0x471372;})[_0xc847('0x20')](function(_0x2ba0d8){logger['error'](_0x2ba0d8);});}return;})[_0xc847('0x2b')](function(){if(_0x471372){return _0x471372;}})[_0xc847('0x2b')](respondWithResult(_0x4c7f4a,null))[_0xc847('0x20')](function(){for(var _0x5a11aa of _0x432835){var _0x51b74d=path[_0xc847('0x89')](config['root'],_0xc847('0xdd'),_0xc847('0xc9'),_0xc847('0xde'),_0xc847('0xdf'),_0x5a11aa[_0xc847('0x7b')]);fs_extra[_0xc847('0xf5')](_0x51b74d)['catch'](function(_0x3d9585){logger[_0xc847('0x1d')](_0xc847('0xf6'),_0x51b74d,_0x3d9585);});}});};exports[_0xc847('0xf7')]=function(_0x3e3b26,_0x5d381b){return db['ChatInteraction'][_0xc847('0x5e')]({'where':{'id':_0x3e3b26[_0xc847('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5d381b,null))[_0xc847('0x2b')](function(_0x532556){if(_0x532556){return _0x532556['addInteraction'](_0x3e3b26[_0xc847('0x60')][_0xc847('0x74')],_[_0xc847('0xf8')](_0x3e3b26[_0xc847('0x60')],[_0xc847('0x74'),'id'])||{});}})['then'](respondWithResult(_0x5d381b,null))[_0xc847('0x20')](handleError(_0x5d381b,null));};exports[_0xc847('0xf9')]=function(_0x7b5fce,_0x49316a){var _0x51792b={'raw':![],'where':{}};var _0x142e7b={};var _0x318684={'count':0x0,'rows':[]};return db[_0xc847('0x47')][_0xc847('0x71')]({'where':{'id':_0x7b5fce[_0xc847('0x5b')]['id']}})['then'](handleEntityNotFound(_0x49316a,null))[_0xc847('0x2b')](function(_0xdb9dc3){if(_0xdb9dc3){_0x142e7b[_0xc847('0x42')]=_[_0xc847('0x4a')](db[_0xc847('0xb1')]['rawAttributes']);_0x142e7b[_0xc847('0x49')]=_[_0xc847('0x4a')](_0x7b5fce[_0xc847('0x49')]);_0x142e7b[_0xc847('0x4b')]=_[_0xc847('0x72')](_0x142e7b[_0xc847('0x42')],_0x142e7b[_0xc847('0x49')]);_0x51792b['attributes']=_['intersection'](_0x142e7b['model'],qs[_0xc847('0x4c')](_0x7b5fce['query'][_0xc847('0x4c')]));_0x51792b[_0xc847('0x4d')]=_0x51792b[_0xc847('0x4d')][_0xc847('0x5c')]?_0x51792b[_0xc847('0x4d')]:_0x142e7b['model'];if(!_0x7b5fce[_0xc847('0x49')]['hasOwnProperty'](_0xc847('0x77'))){_0x51792b['limit']=qs['limit'](_0x7b5fce[_0xc847('0x49')][_0xc847('0x28')]);_0x51792b[_0xc847('0x27')]=qs[_0xc847('0x27')](_0x7b5fce[_0xc847('0x49')]['offset']);}_0x51792b['order']=qs[_0xc847('0x50')](_0x7b5fce[_0xc847('0x49')]['sort']);_0x51792b[_0xc847('0x53')]=qs[_0xc847('0x4b')](_[_0xc847('0x51')](_0x7b5fce[_0xc847('0x49')],_0x142e7b[_0xc847('0x4b')]));_0x51792b[_0xc847('0x53')]['ChatWebsiteId']=_0xdb9dc3['id'];if(_0x7b5fce[_0xc847('0x49')][_0xc847('0x52')]){_0x51792b['where']=_[_0xc847('0x55')](_0x51792b['where'],{'$or':_['map'](_0x51792b['attributes'],function(_0x16d9f0){var _0x4a97a4={};_0x4a97a4[_0x16d9f0]={'$like':'%'+_0x7b5fce[_0xc847('0x49')][_0xc847('0x52')]+'%'};return _0x4a97a4;})});}_0x51792b=_[_0xc847('0x55')]({},_0x51792b,_0x7b5fce[_0xc847('0x56')]);return db['ChatInteraction'][_0xc847('0x26')]({'where':_0x51792b['where']})['then'](function(_0x54c6d9){_0x318684[_0xc847('0x26')]=_0x54c6d9;if(_0x7b5fce[_0xc847('0x49')][_0xc847('0x57')]){_0x51792b['include']=[{'model':db[_0xc847('0x9c')],'as':'Contact','required':![]},{'model':db[_0xc847('0xfa')],'as':_0xc847('0xfb'),'attributes':[_0xc847('0x2e'),_0xc847('0xfc'),_0xc847('0xfd')],'required':![]},{'model':db['Tag'],'as':_0xc847('0xfe'),'attributes':['id',_0xc847('0x2e'),_0xc847('0xff')],'where':_0x7b5fce[_0xc847('0x49')][_0xc847('0x100')]?{'id':_0x7b5fce[_0xc847('0x49')][_0xc847('0x100')]}:undefined,'required':_0x7b5fce['query'][_0xc847('0x100')]?!![]:![]}];}return db[_0xc847('0xb1')][_0xc847('0x58')](_0x51792b);})['then'](function(_0x318d27){_0x318684[_0xc847('0x59')]=_0x318d27;return _0x318684;});}})[_0xc847('0x2b')](respondWithFilteredResult(_0x49316a,_0x51792b))[_0xc847('0x20')](handleError(_0x49316a,null));};exports['getSnippet']=function(_0x1c8979,_0x53cf8d){var _0x1d7e06=0x0;var _0x30f855=0x0;var _0x53149d=![];var _0x1de783;var _0x55c902;return db[_0xc847('0x47')]['find']({'where':{'id':_0x1c8979['params']['id']},'include':[{'model':db[_0xc847('0x93')],'as':_0xc847('0x93'),'include':[{'model':db[_0xc847('0x93')],'as':_0xc847('0xa8'),'attributes':['id','interval']}]}]})[_0xc847('0x2b')](handleEntityNotFound(_0x53cf8d,null))[_0xc847('0x2b')](function(_0x13b8f3){if(_0x13b8f3){_0x1de783=_0x13b8f3;return _0x13b8f3[_0xc847('0x101')]({'raw':!![]});}})[_0xc847('0x2b')](function(_0x5ee3cb){if(_0x1de783){if(_0x5ee3cb){_0x55c902=_0x5ee3cb;}}return require('../../config/license/util')[_0xc847('0x86')]();})['then'](function(_0x1fbe3d){if(_0x1fbe3d){_0x30f855=_0x1fbe3d[_0xc847('0x102')];_0x53149d=_0x1fbe3d[_0xc847('0x103')];}})['then'](function(){return db[_0xc847('0xb1')][_0xc847('0x26')]({'where':{'closed':![]}});})[_0xc847('0x2b')](function(_0x4474f3){_0x1d7e06=_0x4474f3;if(_0x30f855&&_0x4474f3>_0x30f855){return db[_0xc847('0x104')][_0xc847('0x71')]({'where':{'id':0x1}})[_0xc847('0x2b')](function(_0x3712fe){if(_0x3712fe){_0x3712fe[_0xc847('0x105')](_0xc847('0x106'));}});}})[_0xc847('0x2b')](function(){var _0x3ca1be=_0x1de783[_0xc847('0x93')];var _0x475316=_0x1de783[_0xc847('0x95')]||undefined;return _0x3ca1be?_0x3ca1be[_0xc847('0x96')](_0x475316):!![];})['then'](function(_0x177b1f){var _0x582b73=fs['readFileSync'](path[_0xc847('0x89')](config[_0xc847('0x83')],_0xc847('0x107')),_0xc847('0xd6'));var _0x292548=_0xc847('0x108');var _0x17aa00=![];try{const _0x2a8a51=new URL(_0x1de783[_0xc847('0x61')]);_0x1de783[_0xc847('0x61')]=_0x2a8a51[_0xc847('0x109')];}catch(_0x12cfaf){}var _0x2ada4f;if(_0x1c8979['headers'][_0xc847('0x39')]){_0x1c8979[_0xc847('0xaf')][_0xc847('0x39')]=_0x1c8979['headers']['referer'][_0xc847('0x10a')](/\/$/,'');_0x2ada4f=wildcardUtils[_0xc847('0x10b')](_0x1de783[_0xc847('0x61')],_0x1c8979[_0xc847('0xaf')][_0xc847('0x39')]);}else{_0x1c8979[_0xc847('0xaf')][_0xc847('0x39')]=_0x1de783[_0xc847('0x61')];_0x2ada4f=!![];}var _0x16ecd1={'chatVersion':_0x292548,'chatWebsiteAddressOrigin':_0x2ada4f?_0x1c8979[_0xc847('0xaf')][_0xc847('0x39')]:_0x1de783[_0xc847('0x61')],'remote':_0x1de783['remote'],'query':querystring[_0xc847('0x1b')](_[_0xc847('0x55')](_0x1de783[_0xc847('0x67')]({'plain':!![]}),{'customerIp':_0x1c8979[_0xc847('0xaf')][_0xc847('0x34')]||_0x1c8979[_0xc847('0xaf')][_0xc847('0x10c')]||_0x1c8979[_0xc847('0x10d')][_0xc847('0x10e')]||_0x1c8979['ip'],'referer':_0x1c8979['headers'][_0xc847('0x39')],'openedInteractions':_0x1d7e06,'maxInteractions':_0x30f855,'virtual':_0x53149d[_0xc847('0x102')],'online':_0x177b1f,'custom':_0x53149d,'address':_0x2ada4f?_0x1c8979[_0xc847('0xaf')]['referer']:null}))[_0xc847('0x10a')](/'/g,'\x5c\x27')};_0x53cf8d[_0xc847('0xcd')](ejs['render'](Mustache[_0xc847('0xd7')](_0x582b73,_0x16ecd1),{'proactiveActions':_0x55c902,'alignment':_0x1de783[_0xc847('0x10f')],'verticalAlignment':_0x1de783[_0xc847('0x110')],'div_color':_0x1de783[_0xc847('0xff')],'labelText':_0x1de783[_0xc847('0x111')],'text_color':_0x1de783[_0xc847('0x112')],'text_button_color':_0x1de783[_0xc847('0x113')],'button_color':_0x1de783[_0xc847('0x114')],'background_color':_0x1de783[_0xc847('0x115')],'hideWhenOffline':_0x1de783['hideWhenOffline'],'intervalId':_0x1de783['IntervalId'],'isDevelopment':_0x17aa00,'chatVersion':_0x292548}));})[_0xc847('0x20')](handleError(_0x53cf8d,null));};exports[_0xc847('0x116')]=function(_0x46f156,_0x14f8a9){var _0x212780=_0x46f156[_0xc847('0x5b')]['id'];var _0x2c17df=_0x46f156[_0xc847('0x60')];var _0x109a34=0xc8;var _0x5d1d89=null;return db[_0xc847('0xe2')][_0xc847('0xe3')]({'isolationLevel':db[_0xc847('0xe2')][_0xc847('0x117')]['ISOLATION_LEVELS'][_0xc847('0x118')]},function(_0x452c23){return db[_0xc847('0x47')][_0xc847('0x71')]({'where':{'id':_0x212780},'transaction':_0x452c23})[_0xc847('0x2b')](function(_0x3dcda8){if(_0x3dcda8){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x212780},'transaction':_0x452c23})['then'](function(){var _0x509ca1=_[_0xc847('0x46')](_0x2c17df,function(_0x2f478e){_0x2f478e[_0xc847('0x6e')]=_0x212780;return _0x2f478e;});return db['ChatApplication']['bulkCreate'](_0x509ca1,{'transaction':_0x452c23});});}else{_0x109a34=0x194;_0x5d1d89=[];}});})[_0xc847('0x2b')](function(){if(_0x109a34!==0x194){return db[_0xc847('0xa6')][_0xc847('0x119')]({'where':{'ChatWebsiteId':_0x212780},'order':_0xc847('0x11a')})[_0xc847('0x2b')](function(_0x26b96e){_0x5d1d89=_0x26b96e;});}})[_0xc847('0x20')](function(_0x13a6d5){_0x109a34=0x1f4;logger[_0xc847('0x1d')](_0x13a6d5[_0xc847('0x2d')]);if(_0x13a6d5[_0xc847('0x2e')]){delete _0x13a6d5['name'];}_0x5d1d89=_0x13a6d5;})[_0xc847('0x11b')](function(){if(_0x5d1d89===null){_0x14f8a9[_0xc847('0x21')](_0x109a34);}else{if(_0x109a34===0x1f4){_0x14f8a9[_0xc847('0x23')](_0x109a34)[_0xc847('0xcd')](_0x5d1d89);}else{_0x14f8a9[_0xc847('0x23')](_0x109a34)['json'](_0x5d1d89);}}});};exports[_0xc847('0x11c')]=function(_0xce5a3e,_0x176603){var _0x21beba={};var _0x3745d5={};var _0x1abb6b;var _0x7720a7;return db['ChatWebsite'][_0xc847('0x71')]({'where':{'id':_0xce5a3e[_0xc847('0x5b')]['id']}})[_0xc847('0x2b')](handleEntityNotFound(_0x176603,null))['then'](function(_0x44a82c){if(_0x44a82c){_0x1abb6b=_0x44a82c;_0x3745d5[_0xc847('0x42')]=_[_0xc847('0x4a')](db[_0xc847('0xa6')][_0xc847('0x48')]);_0x3745d5[_0xc847('0x49')]=_[_0xc847('0x4a')](_0xce5a3e['query']);_0x3745d5[_0xc847('0x4b')]=_['intersection'](_0x3745d5[_0xc847('0x42')],_0x3745d5[_0xc847('0x49')]);_0x21beba[_0xc847('0x4d')]=_['intersection'](_0x3745d5[_0xc847('0x42')],qs[_0xc847('0x4c')](_0xce5a3e['query'][_0xc847('0x4c')]));_0x21beba[_0xc847('0x4d')]=_0x21beba[_0xc847('0x4d')]['length']?_0x21beba[_0xc847('0x4d')]:_0x3745d5[_0xc847('0x42')];_0x21beba[_0xc847('0x4f')]=qs[_0xc847('0x50')](_0xce5a3e[_0xc847('0x49')][_0xc847('0x50')]);_0x21beba[_0xc847('0x53')]=qs['filters'](_[_0xc847('0x51')](_0xce5a3e['query'],_0x3745d5[_0xc847('0x4b')]));if(_0xce5a3e[_0xc847('0x49')]['filter']){_0x21beba[_0xc847('0x53')]=_['merge'](_0x21beba[_0xc847('0x53')],{'$or':_[_0xc847('0x46')](_0x21beba['attributes'],function(_0x1446a3){var _0x26d02c={};_0x26d02c[_0x1446a3]={'$like':'%'+_0xce5a3e[_0xc847('0x49')][_0xc847('0x52')]+'%'};return _0x26d02c;})});}_0x21beba=_[_0xc847('0x55')]({},_0x21beba,_0xce5a3e[_0xc847('0x56')]);return _0x1abb6b[_0xc847('0x11c')](_0x21beba);}})[_0xc847('0x2b')](function(_0x375490){if(_0x375490){_0x7720a7=_0x375490[_0xc847('0x5c')];if(!_0xce5a3e[_0xc847('0x49')][_0xc847('0x4e')](_0xc847('0x77'))){_0x21beba['limit']=qs[_0xc847('0x28')](_0xce5a3e[_0xc847('0x49')][_0xc847('0x28')]);_0x21beba[_0xc847('0x27')]=qs[_0xc847('0x27')](_0xce5a3e[_0xc847('0x49')][_0xc847('0x27')]);}return _0x1abb6b[_0xc847('0x11c')](_0x21beba);}})[_0xc847('0x2b')](function(_0x40bd43){if(_0x40bd43){return _0x40bd43?{'count':_0x7720a7,'rows':_0x40bd43}:null;}})['then'](respondWithResult(_0x176603,null))[_0xc847('0x20')](handleError(_0x176603,null));};exports['addProactiveActions']=function(_0x25d78f,_0x3c630c){return db['chatProactiveAction'][_0xc847('0x5e')]({'where':{'id':_0x25d78f[_0xc847('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3c630c,null))[_0xc847('0x2b')](function(_0x7bef2a){if(_0x7bef2a){return _0x7bef2a['addProactiveActions'](_0x25d78f[_0xc847('0x60')][_0xc847('0x74')],_[_0xc847('0xf8')](_0x25d78f[_0xc847('0x60')],['ids','id'])||{});}})[_0xc847('0x2b')](respondWithResult(_0x3c630c,null))[_0xc847('0x20')](handleError(_0x3c630c,null));};exports[_0xc847('0x101')]=function(_0x46fed7,_0x2d5153){var _0x48002b={};var _0x496342={};var _0x4ad949;var _0x2d83ff;return db['ChatWebsite'][_0xc847('0x71')]({'where':{'id':_0x46fed7['params']['id']}})['then'](handleEntityNotFound(_0x2d5153,null))['then'](function(_0x193287){if(_0x193287){_0x4ad949=_0x193287;_0x496342[_0xc847('0x42')]=_[_0xc847('0x4a')](db[_0xc847('0x11d')]['rawAttributes']);_0x496342[_0xc847('0x49')]=_['keys'](_0x46fed7['query']);_0x496342[_0xc847('0x4b')]=_[_0xc847('0x72')](_0x496342[_0xc847('0x42')],_0x496342[_0xc847('0x49')]);_0x48002b['attributes']=_['intersection'](_0x496342[_0xc847('0x42')],qs[_0xc847('0x4c')](_0x46fed7['query'][_0xc847('0x4c')]));_0x48002b[_0xc847('0x4d')]=_0x48002b['attributes'][_0xc847('0x5c')]?_0x48002b[_0xc847('0x4d')]:_0x496342[_0xc847('0x42')];_0x48002b[_0xc847('0x4f')]=qs[_0xc847('0x50')](_0x46fed7[_0xc847('0x49')][_0xc847('0x50')]);_0x48002b['where']=qs[_0xc847('0x4b')](_['pick'](_0x46fed7['query'],_0x496342[_0xc847('0x4b')]));if(_0x46fed7['query'][_0xc847('0x52')]){_0x48002b['where']=_['merge'](_0x48002b[_0xc847('0x53')],{'$or':_[_0xc847('0x46')](_0x48002b[_0xc847('0x4d')],function(_0x2c42ba){var _0x39799f={};_0x39799f[_0x2c42ba]={'$like':'%'+_0x46fed7['query'][_0xc847('0x52')]+'%'};return _0x39799f;})});}_0x48002b=_[_0xc847('0x55')]({},_0x48002b,_0x46fed7[_0xc847('0x56')]);return _0x4ad949['getProactiveActions'](_0x48002b);}})[_0xc847('0x2b')](function(_0x8109b8){if(_0x8109b8){_0x2d83ff=_0x8109b8[_0xc847('0x5c')];if(!_0x46fed7[_0xc847('0x49')][_0xc847('0x4e')](_0xc847('0x77'))){_0x48002b[_0xc847('0x28')]=qs['limit'](_0x46fed7[_0xc847('0x49')][_0xc847('0x28')]);_0x48002b[_0xc847('0x27')]=qs[_0xc847('0x27')](_0x46fed7[_0xc847('0x49')][_0xc847('0x27')]);}return _0x4ad949[_0xc847('0x101')](_0x48002b);}})[_0xc847('0x2b')](function(_0x402d6e){if(_0x402d6e){return _0x402d6e?{'count':_0x2d83ff,'rows':_0x402d6e}:null;}})['then'](respondWithResult(_0x2d5153,null))[_0xc847('0x20')](handleError(_0x2d5153,null));};exports['getFields']=function(_0x53a54b,_0x207da7){var _0x2c6712=_0x53a54b[_0xc847('0x49')][_0xc847('0x11e')]==='false'?_0xc847('0x11f'):_0xc847('0x120');return db[_0xc847('0x47')]['find']({'attributes':['id',_0x2c6712],'where':{'id':_0x53a54b[_0xc847('0x5b')]['id']}})[_0xc847('0x2b')](handleEntityNotFound(_0x207da7,null))[_0xc847('0x2b')](function(_0x52a35f){if(_0x52a35f){var _0x4aadd4=_0x52a35f[_0x2c6712];var _0x5d3266=_0x4aadd4&&_0x4aadd4[_0xc847('0x121')]?_0x4aadd4['items']:[];_0x207da7[_0xc847('0xcd')]({'fromKey':_['isNil'](_0x4aadd4['fromKey'])?undefined:_0x4aadd4[_0xc847('0x122')],'count':_0x5d3266['length'],'rows':_0x5d3266});}})[_0xc847('0x20')](handleError(_0x207da7,null));};exports['getOfflineMessages']=function(_0x2b4d72,_0x20116f){var _0x31974b={'raw':![],'where':{}};var _0x1f005f={};var _0x357f4f={'count':0x0,'rows':[]};return db[_0xc847('0x47')][_0xc847('0x71')]({'where':{'id':_0x2b4d72[_0xc847('0x5b')]['id']}})['then'](handleEntityNotFound(_0x20116f,null))['then'](function(_0x403222){if(_0x403222){_0x1f005f['model']=_[_0xc847('0x4a')](db[_0xc847('0xd9')][_0xc847('0x48')]);_0x1f005f[_0xc847('0x49')]=_[_0xc847('0x4a')](_0x2b4d72[_0xc847('0x49')]);_0x1f005f[_0xc847('0x4b')]=_[_0xc847('0x72')](_0x1f005f[_0xc847('0x42')],_0x1f005f[_0xc847('0x49')]);_0x31974b[_0xc847('0x4d')]=_[_0xc847('0x72')](_0x1f005f[_0xc847('0x42')],qs[_0xc847('0x4c')](_0x2b4d72[_0xc847('0x49')][_0xc847('0x4c')]));_0x31974b[_0xc847('0x4d')]=_0x31974b[_0xc847('0x4d')]['length']?_0x31974b[_0xc847('0x4d')]:_0x1f005f['model'];if(!_0x2b4d72[_0xc847('0x49')][_0xc847('0x4e')]('nolimit')){_0x31974b[_0xc847('0x28')]=qs[_0xc847('0x28')](_0x2b4d72[_0xc847('0x49')][_0xc847('0x28')]);_0x31974b[_0xc847('0x27')]=qs[_0xc847('0x27')](_0x2b4d72[_0xc847('0x49')][_0xc847('0x27')]);}_0x31974b['order']=qs[_0xc847('0x50')](_0x2b4d72[_0xc847('0x49')][_0xc847('0x50')]);_0x31974b[_0xc847('0x53')]=qs[_0xc847('0x4b')](_[_0xc847('0x51')](_0x2b4d72[_0xc847('0x49')],_0x1f005f['filters']));_0x31974b[_0xc847('0x53')][_0xc847('0x6e')]=_0x403222['id'];if(_0x2b4d72['query'][_0xc847('0x52')]){_0x31974b[_0xc847('0x53')]=_[_0xc847('0x55')](_0x31974b['where'],{'$or':_[_0xc847('0x46')](_0x31974b[_0xc847('0x4d')],function(_0x2800c7){var _0x494f6c={};_0x494f6c[_0x2800c7]={'$like':'%'+_0x2b4d72[_0xc847('0x49')]['filter']+'%'};return _0x494f6c;})});}_0x31974b=_['merge']({},_0x31974b,_0x2b4d72[_0xc847('0x56')]);return db['ChatOfflineMessage']['count']({'where':_0x31974b[_0xc847('0x53')]})[_0xc847('0x2b')](function(_0x2e3451){_0x357f4f['count']=_0x2e3451;if(_0x2b4d72[_0xc847('0x49')][_0xc847('0x57')]){_0x31974b['include']=[{'all':!![]}];}else{_0x31974b[_0xc847('0x5d')]=[{'model':db[_0xc847('0x9c')],'as':_0xc847('0x123'),'required':![]},{'model':db['Attachment'],'as':_0xc847('0x124'),'required':![]}];}return db[_0xc847('0xd9')][_0xc847('0x58')](_0x31974b);})[_0xc847('0x2b')](function(_0x519fc6){_0x357f4f[_0xc847('0x59')]=_0x519fc6;return _0x357f4f;});}})[_0xc847('0x2b')](respondWithFilteredResult(_0x20116f,_0x31974b))[_0xc847('0x20')](handleError(_0x20116f,null));};exports[_0xc847('0x125')]=function(_0x58c6c5,_0x264e00){return db[_0xc847('0x47')][_0xc847('0x5e')]({'where':{'id':_0x58c6c5[_0xc847('0x5b')]['id']}})[_0xc847('0x2b')](handleEntityNotFound(_0x264e00,null))[_0xc847('0x2b')](function(_0x19ba24){if(_0x19ba24){return _0x19ba24[_0xc847('0x125')](_0x58c6c5[_0xc847('0x60')]['ids'],_[_0xc847('0xf8')](_0x58c6c5[_0xc847('0x60')],[_0xc847('0x74'),'id'])||{})[_0xc847('0xd4')](function(_0x54c994){for(var _0x3c15da=0x0;_0x3c15da<_0x58c6c5[_0xc847('0x60')][_0xc847('0x74')][_0xc847('0x5c')];_0x3c15da+=0x1){socket['emit'](_0xc847('0x126'),{'UserId':Number(_0x58c6c5[_0xc847('0x60')]['ids'][_0x3c15da]),'ChatWebsiteId':Number(_0x58c6c5['params']['id'])});}return _0x54c994;});}})[_0xc847('0x2b')](respondWithResult(_0x264e00,null))[_0xc847('0x20')](handleError(_0x264e00,null));};exports[_0xc847('0x127')]=function(_0x1acb41,_0x22b8d8){return db[_0xc847('0x47')][_0xc847('0x5e')]({'where':{'id':_0x1acb41[_0xc847('0x5b')]['id']}})[_0xc847('0x2b')](handleEntityNotFound(_0x22b8d8,null))[_0xc847('0x2b')](function(_0x439e1a){if(_0x439e1a){return _0x439e1a[_0xc847('0x127')](_0x1acb41[_0xc847('0x49')][_0xc847('0x74')])[_0xc847('0x2b')](function(){if(_['isArray'](_0x1acb41[_0xc847('0x49')][_0xc847('0x74')])){for(var _0x366b57=0x0;_0x366b57<_0x1acb41[_0xc847('0x49')]['ids'][_0xc847('0x5c')];_0x366b57+=0x1){socket[_0xc847('0x128')]('userChatWebsite:remove',{'UserId':Number(_0x1acb41[_0xc847('0x49')][_0xc847('0x74')][_0x366b57]),'ChatWebsiteId':Number(_0x1acb41[_0xc847('0x5b')]['id'])});}}else{socket[_0xc847('0x128')](_0xc847('0x129'),{'UserId':Number(_0x1acb41[_0xc847('0x49')][_0xc847('0x74')]),'ChatWebsiteId':Number(_0x1acb41[_0xc847('0x5b')]['id'])});}});}})[_0xc847('0x2b')](respondWithStatusCode(_0x22b8d8,null))[_0xc847('0x20')](handleError(_0x22b8d8,null));};exports[_0xc847('0x12a')]=function(_0x95031d,_0x5dd6f8){var _0x396fcf={};var _0x298bb6={};var _0x1ec3f6;var _0x435d02;return db[_0xc847('0x47')][_0xc847('0x71')]({'where':{'id':_0x95031d[_0xc847('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5dd6f8,null))[_0xc847('0x2b')](function(_0x34a101){if(_0x34a101){_0x1ec3f6=_0x34a101;_0x298bb6[_0xc847('0x42')]=_[_0xc847('0x4a')](db[_0xc847('0xfa')]['rawAttributes']);_0x298bb6[_0xc847('0x49')]=_[_0xc847('0x4a')](_0x95031d[_0xc847('0x49')]);_0x298bb6['filters']=_[_0xc847('0x72')](_0x298bb6[_0xc847('0x42')],_0x298bb6[_0xc847('0x49')]);_0x396fcf[_0xc847('0x4d')]=_[_0xc847('0x72')](_0x298bb6['model'],qs[_0xc847('0x4c')](_0x95031d[_0xc847('0x49')][_0xc847('0x4c')]));_0x396fcf[_0xc847('0x4d')]=_0x396fcf['attributes']['length']?_0x396fcf[_0xc847('0x4d')]:_0x298bb6[_0xc847('0x42')];_0x396fcf['order']=qs[_0xc847('0x50')](_0x95031d[_0xc847('0x49')][_0xc847('0x50')]);_0x396fcf[_0xc847('0x53')]=qs[_0xc847('0x4b')](_[_0xc847('0x51')](_0x95031d['query'],_0x298bb6[_0xc847('0x4b')]));if(_0x95031d[_0xc847('0x49')]['filter']){_0x396fcf[_0xc847('0x53')]=_[_0xc847('0x55')](_0x396fcf[_0xc847('0x53')],{'$or':_[_0xc847('0x46')](_0x396fcf['attributes'],function(_0x123603){var _0x18ba59={};_0x18ba59[_0x123603]={'$like':'%'+_0x95031d[_0xc847('0x49')]['filter']+'%'};return _0x18ba59;})});}_0x396fcf=_[_0xc847('0x55')]({},_0x396fcf,_0x95031d[_0xc847('0x56')]);return _0x1ec3f6[_0xc847('0x12a')](_0x396fcf);}})['then'](function(_0x23e308){if(_0x23e308){_0x435d02=_0x23e308[_0xc847('0x5c')];if(!_0x95031d[_0xc847('0x49')][_0xc847('0x4e')](_0xc847('0x77'))){_0x396fcf[_0xc847('0x28')]=qs[_0xc847('0x28')](_0x95031d[_0xc847('0x49')][_0xc847('0x28')]);_0x396fcf[_0xc847('0x27')]=qs[_0xc847('0x27')](_0x95031d[_0xc847('0x49')][_0xc847('0x27')]);}return _0x1ec3f6[_0xc847('0x12a')](_0x396fcf);}})[_0xc847('0x2b')](function(_0x5db331){if(_0x5db331){return _0x5db331?{'count':_0x435d02,'rows':_0x5db331}:null;}})['then'](respondWithResult(_0x5dd6f8,null))['catch'](handleError(_0x5dd6f8,null));}; \ No newline at end of file +var _0xb429=['attachments','offline-chat','basename','openNewInteraction','bulkCreate','MailAccount','MailServerOut','CloudProvider','Smtp','forwardOffline','forwardOfflineAddress','SendMail','sendMail','email','MailAccountId','toPairsIn','subjectOffline','Chat','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','fullname','internal','Tags','color','tag','getSnippet','interval','getProactiveActions','../../config/license/util','virtual','custom','License','increment','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','3.9.0','replace','testWebsiteWithWildcard','remote','stringify','connection','remoteAddress','render','alignment','verticalAlignment','labelText','textColor','color_button','hideWhenOffline','IntervalId','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachment','Attachments','addAgents','omit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','mustache','util','lodash','querystring','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','ChatWebsites','name','user-agent-parser','setUA','user-agent','getResult','customerIp','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','show','params','include','find','create','testWildcardValidity','body','address','\x22\x20is\x20not\x20a\x20valid\x20website\x20domain','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','isNil','existsSync','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','timezone','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','orderBy','priority','asc','account','list','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','contact','firstName','messageId','created','push','close','unmanaged','ChatMessage','User','UserId','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','queueId','unshift','queue','Start','startRouting','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','spread','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server'];(function(_0x288c80,_0x19f8b2){var _0x4faaf4=function(_0x68de74){while(--_0x68de74){_0x288c80['push'](_0x288c80['shift']());}};_0x4faaf4(++_0x19f8b2);}(_0xb429,0x189));var _0x9b42=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xb429[_0x1e3c16];return _0x47a0c9;};'use strict';var Mustache=require(_0x9b42('0x0'));var util=require(_0x9b42('0x1'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b42('0x2'));var querystring=require(_0x9b42('0x3'));var htmlToText=require(_0x9b42('0x4'));var Redis=require(_0x9b42('0x5'));var jayson=require('jayson/promise');var qs=require(_0x9b42('0x6'));var logger=require(_0x9b42('0x7'))(_0x9b42('0x8'));var config=require(_0x9b42('0x9'));var APIBadRequestError=require(_0x9b42('0xa'))[_0x9b42('0xb')];var APINotFoundError=require('../../errors/api')[_0x9b42('0xc')];var APIOutOfIntervalError=require(_0x9b42('0xa'))[_0x9b42('0xd')];var APIHandleError=require('../../errors/api')[_0x9b42('0xe')];var APIConflictError=require(_0x9b42('0xa'))[_0x9b42('0xf')];var wildcardUtils=require(_0x9b42('0x10'));var URL=require('url')[_0x9b42('0x11')];var db=require(_0x9b42('0x12'))['db'];config[_0x9b42('0x13')]=_[_0x9b42('0x14')](config[_0x9b42('0x13')],{'host':_0x9b42('0x15'),'port':0x18eb});var socket=require(_0x9b42('0x16'))(new Redis(config[_0x9b42('0x13')]));require(_0x9b42('0x17'))['register'](socket);var client=jayson[_0x9b42('0x18')][_0x9b42('0x19')]({'port':0x232c});var client9002=jayson[_0x9b42('0x18')]['http']({'port':0x232a});var client9003=jayson[_0x9b42('0x18')]['http']({'port':0x232b});var client9001=jayson[_0x9b42('0x18')][_0x9b42('0x19')]({'port':0x2329});function respondWithRpcPromise(_0x434e89,_0x25d3b6,_0x3db60a,_0x2c7ef6){return new Promise(function(_0x1c2503,_0x37c1b9){var _0x81af40=_0x2c7ef6||client;return _0x81af40[_0x9b42('0x1a')](_0x434e89,_0x3db60a)['then'](function(_0x4e7410){logger[_0x9b42('0x1b')](_0x9b42('0x1c'),_0x25d3b6,_0x9b42('0x1d'));logger[_0x9b42('0x1e')](_0x9b42('0x1f'),_0x25d3b6,'request\x20sent',JSON['stringify'](_0x4e7410));if(_0x4e7410[_0x9b42('0x20')]){if(_0x4e7410[_0x9b42('0x20')][_0x9b42('0x21')]===0x1f4){logger[_0x9b42('0x20')](_0x9b42('0x1c'),_0x25d3b6,_0x4e7410[_0x9b42('0x20')][_0x9b42('0x22')]);return _0x37c1b9(_0x4e7410[_0x9b42('0x20')][_0x9b42('0x22')]);}logger['error'](_0x9b42('0x1c'),_0x25d3b6,_0x4e7410['error']['message']);return _0x1c2503(_0x4e7410[_0x9b42('0x20')][_0x9b42('0x22')]);}else{logger['info'](_0x9b42('0x1c'),_0x25d3b6,_0x9b42('0x1d'));_0x1c2503(_0x4e7410[_0x9b42('0x23')][_0x9b42('0x22')]);}})[_0x9b42('0x24')](function(_0x56d7e0){logger[_0x9b42('0x20')](_0x9b42('0x1c'),_0x25d3b6,_0x56d7e0);_0x37c1b9(_0x56d7e0);});});}function respondWithStatusCode(_0x2a127b,_0x49663c){_0x49663c=_0x49663c||0xcc;return function(_0x5e9983){if(_0x5e9983){return _0x2a127b[_0x9b42('0x25')](_0x49663c);}return _0x2a127b[_0x9b42('0x26')](_0x49663c)[_0x9b42('0x27')]();};}function respondWithResult(_0x4b54b1,_0x5c9342){_0x5c9342=_0x5c9342||0xc8;return function(_0xdbb715){if(_0xdbb715){return _0x4b54b1['status'](_0x5c9342)['json'](_0xdbb715);}};}function respondWithFilteredResult(_0x4062a5,_0x5305cf){return function(_0x67531){if(_0x67531){var _0x3a53c7=typeof _0x5305cf[_0x9b42('0x28')]===_0x9b42('0x29')&&typeof _0x5305cf[_0x9b42('0x2a')]===_0x9b42('0x29');var _0x4137ff=_0x67531[_0x9b42('0x2b')];var _0x2c4120=_0x3a53c7?0x0:_0x5305cf[_0x9b42('0x28')];var _0x16f992=_0x3a53c7?_0x67531[_0x9b42('0x2b')]:_0x5305cf[_0x9b42('0x28')]+_0x5305cf[_0x9b42('0x2a')];var _0x4b3a4c;if(_0x16f992>=_0x4137ff){_0x16f992=_0x4137ff;_0x4b3a4c=0xc8;}else{_0x4b3a4c=0xce;}_0x4062a5['status'](_0x4b3a4c);return _0x4062a5[_0x9b42('0x2c')](_0x9b42('0x2d'),_0x2c4120+'-'+_0x16f992+'/'+_0x4137ff)[_0x9b42('0x2e')](_0x67531);}return null;};}function saveUpdates(_0x2a2ecb){return function(_0x13a313){if(_0x13a313){return _0x13a313[_0x9b42('0x2f')](_0x2a2ecb)[_0x9b42('0x30')](function(_0x3358e3){return _0x3358e3;});}return null;};}function removeEntity(_0x517d33){return function(_0x2bf45d){if(_0x2bf45d){return _0x2bf45d[_0x9b42('0x31')]()['then'](function(){var _0x17362f=_0x2bf45d[_0x9b42('0x32')]({'plain':!![]});var _0x1ed125=_0x9b42('0x33');return db['UserProfileResource'][_0x9b42('0x31')]({'where':{'type':_0x1ed125,'resourceId':_0x17362f['id']}})[_0x9b42('0x30')](function(){return _0x2bf45d;});})[_0x9b42('0x30')](function(){_0x517d33['status'](0xcc)[_0x9b42('0x27')]();});}};}function handleEntityNotFound(_0x494a2c){return function(_0x2b0750){if(!_0x2b0750){_0x494a2c['sendStatus'](0x194);}return _0x2b0750;};}function handleError(_0x2c26e6,_0x49badc){_0x49badc=_0x49badc||0x1f4;return function(_0x74e174){logger[_0x9b42('0x20')](_0x74e174['stack']);if(_0x74e174[_0x9b42('0x34')]){delete _0x74e174[_0x9b42('0x34')];}_0x2c26e6[_0x9b42('0x26')](_0x49badc)['send'](_0x74e174);};}function createInteractionObject(_0x1992d6,_0x1083a1,_0xc6fd48,_0x1e22f4){var _0x56a844=require(_0x9b42('0x35'));var _0x42c05d=new _0x56a844();var _0x35cb2e=_0x42c05d[_0x9b42('0x36')](_0xc6fd48[_0x9b42('0x37')])[_0x9b42('0x38')]();var _0x3ea973=_0x1083a1[_0x9b42('0x39')];if(_0xc6fd48['cf-connecting-ip']){_0x3ea973=_0xc6fd48['cf-connecting-ip'];}else if(_0xc6fd48[_0x9b42('0x3a')]){_0x3ea973=_[_0x9b42('0x3b')](_0xc6fd48[_0x9b42('0x3a')][_0x9b42('0x3c')](','));}return{'ContactId':_0x1e22f4['id'],'ChatWebsiteId':_0x1992d6,'from':(_0x1e22f4['firstName']||'')+'\x20'+(_0x1e22f4[_0x9b42('0x3d')]||''),'customerIp':_0x3ea973,'customerPort':_0xc6fd48[_0x9b42('0x3e')]?_0xc6fd48[_0x9b42('0x3e')]:null,'referer':_0x1083a1[_0x9b42('0x3f')],'browserName':_0x35cb2e[_0x9b42('0x40')][_0x9b42('0x34')]&&_0x35cb2e[_0x9b42('0x40')][_0x9b42('0x41')]?util[_0x9b42('0x42')](_0x9b42('0x43'),_0x35cb2e[_0x9b42('0x40')][_0x9b42('0x34')],_0x35cb2e[_0x9b42('0x40')][_0x9b42('0x41')]):_0x9b42('0x44'),'browserVersion':_0x35cb2e[_0x9b42('0x40')][_0x9b42('0x41')]||_0x9b42('0x44'),'osName':util[_0x9b42('0x42')](_0x9b42('0x43'),_0x35cb2e['os'][_0x9b42('0x34')],_0x35cb2e['os']['version']),'osVersion':_0x35cb2e['os'][_0x9b42('0x41')],'deviceModel':_0x35cb2e[_0x9b42('0x45')][_0x9b42('0x46')]&&_0x35cb2e[_0x9b42('0x45')][_0x9b42('0x47')]?util['format'](_0x9b42('0x48'),_0x35cb2e[_0x9b42('0x45')][_0x9b42('0x46')],_0x35cb2e[_0x9b42('0x45')][_0x9b42('0x47')],_0x35cb2e[_0x9b42('0x45')][_0x9b42('0x49')]):null,'deviceVendor':_0x35cb2e[_0x9b42('0x45')][_0x9b42('0x47')],'deviceType':_0x35cb2e['device']['type'],'formData':JSON['stringify'](_0x1083a1)};}exports[_0x9b42('0x4a')]=function(_0x36dc7b,_0x40246b){var _0x488f3f={'include':[{'model':db[_0x9b42('0x4b')],'as':_0x9b42('0x4c')}]},_0x5e8dcd={},_0x13207c={'count':0x0,'rows':[]};var _0x54eee5=_[_0x9b42('0x4d')](db[_0x9b42('0x4e')][_0x9b42('0x4f')],function(_0x83dc11){return{'name':_0x83dc11[_0x9b42('0x50')],'type':_0x83dc11[_0x9b42('0x49')][_0x9b42('0x51')]};});_0x5e8dcd['model']=_[_0x9b42('0x4d')](_0x54eee5,'name');_0x5e8dcd[_0x9b42('0x52')]=_[_0x9b42('0x53')](_0x36dc7b['query']);_0x5e8dcd[_0x9b42('0x54')]=_[_0x9b42('0x55')](_0x5e8dcd['model'],_0x5e8dcd['query']);_0x488f3f[_0x9b42('0x56')]=_[_0x9b42('0x55')](_0x5e8dcd[_0x9b42('0x46')],qs['fields'](_0x36dc7b[_0x9b42('0x52')][_0x9b42('0x57')]));_0x488f3f[_0x9b42('0x56')]=_0x488f3f[_0x9b42('0x56')][_0x9b42('0x58')]?_0x488f3f[_0x9b42('0x56')]:_0x5e8dcd[_0x9b42('0x46')];if(!_0x36dc7b[_0x9b42('0x52')][_0x9b42('0x59')](_0x9b42('0x5a'))){_0x488f3f['limit']=qs[_0x9b42('0x2a')](_0x36dc7b['query'][_0x9b42('0x2a')]);_0x488f3f[_0x9b42('0x28')]=qs['offset'](_0x36dc7b[_0x9b42('0x52')][_0x9b42('0x28')]);}_0x488f3f[_0x9b42('0x5b')]=qs[_0x9b42('0x5c')](_0x36dc7b['query'][_0x9b42('0x5c')]);_0x488f3f[_0x9b42('0x5d')]=qs[_0x9b42('0x54')](_[_0x9b42('0x5e')](_0x36dc7b[_0x9b42('0x52')],_0x5e8dcd[_0x9b42('0x54')]),_0x54eee5);if(_0x36dc7b[_0x9b42('0x52')][_0x9b42('0x5f')]){_0x488f3f[_0x9b42('0x5d')]=_['merge'](_0x488f3f[_0x9b42('0x5d')],{'$or':_[_0x9b42('0x4d')](_0x54eee5,function(_0xbd33df){if(_0xbd33df[_0x9b42('0x49')]!=='VIRTUAL'){var _0x2739ce={};_0x2739ce[_0xbd33df[_0x9b42('0x34')]]={'$like':'%'+_0x36dc7b[_0x9b42('0x52')]['filter']+'%'};return _0x2739ce;}})});}_0x488f3f=_[_0x9b42('0x60')]({},_0x488f3f,_0x36dc7b[_0x9b42('0x61')]);var _0x462e01={'where':_0x488f3f[_0x9b42('0x5d')]};return db['ChatWebsite'][_0x9b42('0x2b')](_0x462e01)[_0x9b42('0x30')](function(_0x59f211){_0x13207c['count']=_0x59f211;if(_0x36dc7b[_0x9b42('0x52')][_0x9b42('0x62')]){_0x488f3f['include']=[{'all':!![]}];}return db[_0x9b42('0x4e')][_0x9b42('0x63')](_0x488f3f);})['then'](function(_0x51016e){_0x13207c['rows']=_0x51016e;return _0x13207c;})[_0x9b42('0x30')](respondWithFilteredResult(_0x40246b,_0x488f3f))[_0x9b42('0x24')](handleError(_0x40246b,null));};exports[_0x9b42('0x64')]=function(_0x2efdbc,_0x23c02f){var _0x4e61b0={'raw':![],'where':{'id':_0x2efdbc[_0x9b42('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0x9b42('0x4c')}]},_0x37c063={};_0x37c063[_0x9b42('0x46')]=_['keys'](db[_0x9b42('0x4e')]['rawAttributes']);_0x37c063[_0x9b42('0x52')]=_[_0x9b42('0x53')](_0x2efdbc['query']);_0x37c063[_0x9b42('0x54')]=_['intersection'](_0x37c063[_0x9b42('0x46')],_0x37c063[_0x9b42('0x52')]);_0x4e61b0[_0x9b42('0x56')]=_[_0x9b42('0x55')](_0x37c063[_0x9b42('0x46')],qs['fields'](_0x2efdbc[_0x9b42('0x52')][_0x9b42('0x57')]));_0x4e61b0['attributes']=_0x4e61b0['attributes'][_0x9b42('0x58')]?_0x4e61b0[_0x9b42('0x56')]:_0x37c063[_0x9b42('0x46')];if(_0x2efdbc[_0x9b42('0x52')][_0x9b42('0x62')]){_0x4e61b0[_0x9b42('0x66')]=[{'all':!![]}];}_0x4e61b0=_[_0x9b42('0x60')]({},_0x4e61b0,_0x2efdbc[_0x9b42('0x61')]);return db[_0x9b42('0x4e')][_0x9b42('0x67')](_0x4e61b0)[_0x9b42('0x30')](handleEntityNotFound(_0x23c02f,null))[_0x9b42('0x30')](respondWithResult(_0x23c02f,null))[_0x9b42('0x24')](handleError(_0x23c02f,null));};exports[_0x9b42('0x68')]=function(_0x518439,_0x53b214){if(!wildcardUtils[_0x9b42('0x69')](_0x518439[_0x9b42('0x6a')][_0x9b42('0x6b')])){return handleError(_0x53b214,null)(new APIBadRequestError('\x22'+_0x518439['body'][_0x9b42('0x6b')]+_0x9b42('0x6c')));}return db['ChatWebsite'][_0x9b42('0x68')](_0x518439[_0x9b42('0x6a')],{})['then'](function(_0x397137){var _0x220708=_0x518439[_0x9b42('0x6d')][_0x9b42('0x32')]({'plain':!![]});if(!_0x220708)throw new Error(_0x9b42('0x6e'));if(_0x220708[_0x9b42('0x6f')]===_0x9b42('0x6d')){var _0x1993db=_0x397137[_0x9b42('0x32')]({'plain':!![]});var _0x148644=_0x9b42('0x33');return db[_0x9b42('0x70')][_0x9b42('0x67')]({'where':{'name':_0x148644,'userProfileId':_0x220708[_0x9b42('0x71')]},'raw':!![]})[_0x9b42('0x30')](function(_0x25df6f){if(_0x25df6f&&_0x25df6f[_0x9b42('0x72')]===0x0){return db[_0x9b42('0x73')]['create']({'name':_0x1993db[_0x9b42('0x34')],'resourceId':_0x1993db['id'],'type':_0x25df6f[_0x9b42('0x34')],'sectionId':_0x25df6f['id']},{})[_0x9b42('0x30')](function(){return _0x397137;});}else{return _0x397137;}})[_0x9b42('0x24')](function(_0x58fadd){logger[_0x9b42('0x20')](_0x9b42('0x74'),_0x58fadd);throw _0x58fadd;});}return _0x397137;})[_0x9b42('0x30')](respondWithResult(_0x53b214,0xc9))['catch'](handleError(_0x53b214,null));};exports[_0x9b42('0x2f')]=function(_0x192eec,_0x200a3c){if(!wildcardUtils['testWildcardValidity'](_0x192eec[_0x9b42('0x6a')]['address'])){return handleError(_0x200a3c,null)(new APIBadRequestError('\x22'+_0x192eec[_0x9b42('0x6a')][_0x9b42('0x6b')]+'\x22\x20is\x20not\x20a\x20valid\x20website\x20domain'));}if(_0x192eec[_0x9b42('0x6a')]['id']){delete _0x192eec[_0x9b42('0x6a')]['id'];}return db[_0x9b42('0x4e')][_0x9b42('0x67')]({'where':{'id':_0x192eec['params']['id']},'include':[{'model':db[_0x9b42('0x4b')],'as':_0x9b42('0x4c')}]})[_0x9b42('0x30')](handleEntityNotFound(_0x200a3c,null))[_0x9b42('0x30')](saveUpdates(_0x192eec[_0x9b42('0x6a')],null))[_0x9b42('0x30')](respondWithResult(_0x200a3c,null))[_0x9b42('0x24')](handleError(_0x200a3c,null));};exports[_0x9b42('0x31')]=function(_0x1b805d,_0x4cce34){return db['ChatWebsite'][_0x9b42('0x67')]({'where':{'id':_0x1b805d[_0x9b42('0x65')]['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0x4cce34,null))[_0x9b42('0x30')](removeEntity(_0x4cce34,null))[_0x9b42('0x24')](handleError(_0x4cce34,null));};exports['describe']=function(_0x93d2b5,_0x12cffe){return db[_0x9b42('0x4e')][_0x9b42('0x75')]()['then'](respondWithResult(_0x12cffe,null))[_0x9b42('0x24')](handleError(_0x12cffe,null));};exports[_0x9b42('0x76')]=function(_0x303197,_0x150451){if(_0x303197[_0x9b42('0x6a')]['id']){delete _0x303197[_0x9b42('0x6a')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x303197[_0x9b42('0x65')]['id']}})['then'](handleEntityNotFound(_0x150451,null))[_0x9b42('0x30')](function(_0x2e3f6a){if(_0x2e3f6a){_0x303197['body'][_0x9b42('0x77')]=_0x2e3f6a['id'];return db[_0x9b42('0x78')][_0x9b42('0x68')](_0x303197['body']);}})[_0x9b42('0x30')](respondWithResult(_0x150451,null))[_0x9b42('0x24')](handleError(_0x150451,null));};exports['getDispositions']=function(_0x5a1a77,_0x3fa862){var _0x2b0b73={'raw':![],'where':{}};var _0x550247={};var _0x4322a9={'count':0x0,'rows':[]};return db[_0x9b42('0x4e')][_0x9b42('0x79')]({'where':{'id':_0x5a1a77['params']['id']}})['then'](handleEntityNotFound(_0x3fa862,null))[_0x9b42('0x30')](function(_0x545e4b){if(_0x545e4b){_0x550247['model']=_[_0x9b42('0x53')](db['Disposition'][_0x9b42('0x4f')]);_0x550247[_0x9b42('0x52')]=_['keys'](_0x5a1a77[_0x9b42('0x52')]);_0x550247['filters']=_[_0x9b42('0x55')](_0x550247[_0x9b42('0x46')],_0x550247['query']);_0x2b0b73[_0x9b42('0x56')]=_[_0x9b42('0x55')](_0x550247['model'],qs[_0x9b42('0x57')](_0x5a1a77[_0x9b42('0x52')][_0x9b42('0x57')]));_0x2b0b73[_0x9b42('0x56')]=_0x2b0b73[_0x9b42('0x56')]['length']?_0x2b0b73[_0x9b42('0x56')]:_0x550247[_0x9b42('0x46')];if(!_0x5a1a77[_0x9b42('0x52')][_0x9b42('0x59')](_0x9b42('0x5a'))){_0x2b0b73['limit']=qs[_0x9b42('0x2a')](_0x5a1a77[_0x9b42('0x52')]['limit']);_0x2b0b73[_0x9b42('0x28')]=qs[_0x9b42('0x28')](_0x5a1a77['query'][_0x9b42('0x28')]);}_0x2b0b73[_0x9b42('0x5b')]=qs[_0x9b42('0x5c')](_0x5a1a77['query']['sort']);_0x2b0b73[_0x9b42('0x5d')]=qs[_0x9b42('0x54')](_['pick'](_0x5a1a77[_0x9b42('0x52')],_0x550247[_0x9b42('0x54')]));_0x2b0b73['where']['ChatWebsiteId']=_0x545e4b['id'];if(_0x5a1a77[_0x9b42('0x52')]['filter']){_0x2b0b73[_0x9b42('0x5d')]=_[_0x9b42('0x60')](_0x2b0b73[_0x9b42('0x5d')],{'$or':_['map'](_0x2b0b73[_0x9b42('0x56')],function(_0x4c0121){var _0x4933e8={};_0x4933e8[_0x4c0121]={'$like':'%'+_0x5a1a77[_0x9b42('0x52')][_0x9b42('0x5f')]+'%'};return _0x4933e8;})});}_0x2b0b73=_['merge']({},_0x2b0b73,_0x5a1a77[_0x9b42('0x61')]);return db[_0x9b42('0x78')][_0x9b42('0x2b')]({'where':_0x2b0b73[_0x9b42('0x5d')]})[_0x9b42('0x30')](function(_0x58afa7){_0x4322a9[_0x9b42('0x2b')]=_0x58afa7;if(_0x5a1a77[_0x9b42('0x52')][_0x9b42('0x62')]){_0x2b0b73['include']=[{'all':!![]}];}return db[_0x9b42('0x78')][_0x9b42('0x63')](_0x2b0b73);})[_0x9b42('0x30')](function(_0x24a215){_0x4322a9[_0x9b42('0x7a')]=_0x24a215;return _0x4322a9;});}})[_0x9b42('0x30')](respondWithFilteredResult(_0x3fa862,_0x2b0b73))[_0x9b42('0x24')](handleError(_0x3fa862,null));};exports['removeDispositions']=function(_0x2c3704,_0x527bc6){return db[_0x9b42('0x4e')][_0x9b42('0x67')]({'where':{'id':_0x2c3704[_0x9b42('0x65')]['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0x527bc6,null))['then'](function(_0x5b438e){if(_0x5b438e){return _0x5b438e[_0x9b42('0x7b')](_0x2c3704[_0x9b42('0x52')][_0x9b42('0x7c')]);}})[_0x9b42('0x30')](respondWithStatusCode(_0x527bc6,null))[_0x9b42('0x24')](handleError(_0x527bc6,null));};exports['addAnswer']=function(_0x2789b0,_0x198809){if(_0x2789b0[_0x9b42('0x6a')]['id']){delete _0x2789b0[_0x9b42('0x6a')]['id'];}return db['ChatWebsite'][_0x9b42('0x67')]({'where':{'id':_0x2789b0[_0x9b42('0x65')]['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0x198809,null))[_0x9b42('0x30')](function(_0x3e296f){if(_0x3e296f){_0x2789b0[_0x9b42('0x6a')][_0x9b42('0x77')]=_0x3e296f['id'];return db[_0x9b42('0x7d')][_0x9b42('0x68')](_0x2789b0[_0x9b42('0x6a')]);}})['then'](respondWithResult(_0x198809,null))[_0x9b42('0x24')](handleError(_0x198809,null));};exports[_0x9b42('0x7e')]=function(_0x233b09,_0x57c854){var _0x4484c9={'raw':![],'where':{}};var _0x598bc4={};var _0x207357={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9b42('0x79')]({'where':{'id':_0x233b09[_0x9b42('0x65')]['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0x57c854,null))[_0x9b42('0x30')](function(_0x4803f8){if(_0x4803f8){_0x598bc4[_0x9b42('0x46')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x598bc4[_0x9b42('0x52')]=_[_0x9b42('0x53')](_0x233b09[_0x9b42('0x52')]);_0x598bc4[_0x9b42('0x54')]=_['intersection'](_0x598bc4[_0x9b42('0x46')],_0x598bc4['query']);_0x4484c9[_0x9b42('0x56')]=_['intersection'](_0x598bc4[_0x9b42('0x46')],qs['fields'](_0x233b09[_0x9b42('0x52')][_0x9b42('0x57')]));_0x4484c9['attributes']=_0x4484c9[_0x9b42('0x56')][_0x9b42('0x58')]?_0x4484c9['attributes']:_0x598bc4[_0x9b42('0x46')];if(!_0x233b09[_0x9b42('0x52')][_0x9b42('0x59')](_0x9b42('0x5a'))){_0x4484c9[_0x9b42('0x2a')]=qs[_0x9b42('0x2a')](_0x233b09['query'][_0x9b42('0x2a')]);_0x4484c9[_0x9b42('0x28')]=qs['offset'](_0x233b09[_0x9b42('0x52')][_0x9b42('0x28')]);}_0x4484c9[_0x9b42('0x5b')]=qs['sort'](_0x233b09['query'][_0x9b42('0x5c')]);_0x4484c9[_0x9b42('0x5d')]=qs[_0x9b42('0x54')](_['pick'](_0x233b09[_0x9b42('0x52')],_0x598bc4[_0x9b42('0x54')]));_0x4484c9[_0x9b42('0x5d')][_0x9b42('0x77')]=_0x4803f8['id'];if(_0x233b09[_0x9b42('0x52')][_0x9b42('0x5f')]){_0x4484c9[_0x9b42('0x5d')]=_[_0x9b42('0x60')](_0x4484c9[_0x9b42('0x5d')],{'$or':_[_0x9b42('0x4d')](_0x4484c9[_0x9b42('0x56')],function(_0x51adf2){var _0x566455={};_0x566455[_0x51adf2]={'$like':'%'+_0x233b09['query'][_0x9b42('0x5f')]+'%'};return _0x566455;})});}_0x4484c9=_[_0x9b42('0x60')]({},_0x4484c9,_0x233b09[_0x9b42('0x61')]);return db[_0x9b42('0x7d')][_0x9b42('0x2b')]({'where':_0x4484c9[_0x9b42('0x5d')]})[_0x9b42('0x30')](function(_0x598759){_0x207357['count']=_0x598759;if(_0x233b09[_0x9b42('0x52')]['includeAll']){_0x4484c9['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x9b42('0x63')](_0x4484c9);})[_0x9b42('0x30')](function(_0x201508){_0x207357['rows']=_0x201508;return _0x207357;});}})[_0x9b42('0x30')](respondWithFilteredResult(_0x57c854,_0x4484c9))[_0x9b42('0x24')](handleError(_0x57c854,null));};exports['removeAnswers']=function(_0x716a1d,_0x2b6a69){return db['ChatWebsite'][_0x9b42('0x67')]({'where':{'id':_0x716a1d[_0x9b42('0x65')]['id']}})['then'](handleEntityNotFound(_0x2b6a69,null))['then'](function(_0x2159b0){if(_0x2159b0){return _0x2159b0[_0x9b42('0x7f')](_0x716a1d[_0x9b42('0x52')]['ids']);}})[_0x9b42('0x30')](respondWithStatusCode(_0x2b6a69,null))['catch'](handleError(_0x2b6a69,null));};exports['addLogo']=function(_0xd8eca8,_0x1a9e68){_0xd8eca8[_0x9b42('0x6a')][_0x9b42('0x80')]=_0xd8eca8[_0x9b42('0x81')][_0x9b42('0x82')];return db[_0x9b42('0x4e')][_0x9b42('0x67')]({'where':{'id':_0xd8eca8[_0x9b42('0x65')]['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0x1a9e68,null))[_0x9b42('0x30')](saveUpdates(_0xd8eca8[_0x9b42('0x6a')],null))[_0x9b42('0x30')](respondWithResult(_0x1a9e68,null))['catch'](handleError(_0x1a9e68,null));};exports['addAvatar']=function(_0x121552,_0x28e7ff){_0x121552[_0x9b42('0x6a')][_0x9b42('0x83')]=_0x121552[_0x9b42('0x81')][_0x9b42('0x82')];return db['ChatWebsite'][_0x9b42('0x67')]({'where':{'id':_0x121552[_0x9b42('0x65')]['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0x28e7ff,null))[_0x9b42('0x30')](saveUpdates(_0x121552[_0x9b42('0x6a')],null))[_0x9b42('0x30')](respondWithResult(_0x28e7ff,null))['catch'](handleError(_0x28e7ff,null));};exports[_0x9b42('0x84')]=function(_0x510f65,_0x1c286d){_0x510f65['body'][_0x9b42('0x85')]=_0x510f65[_0x9b42('0x81')][_0x9b42('0x82')];return db['ChatWebsite'][_0x9b42('0x67')]({'where':{'id':_0x510f65[_0x9b42('0x65')]['id']}})['then'](handleEntityNotFound(_0x1c286d,null))[_0x9b42('0x30')](saveUpdates(_0x510f65['body'],null))['then'](respondWithResult(_0x1c286d,null))[_0x9b42('0x24')](handleError(_0x1c286d,null));};exports['addSystemAvatar']=function(_0x5b34f3,_0x375f50){_0x5b34f3[_0x9b42('0x6a')][_0x9b42('0x86')]=_0x5b34f3[_0x9b42('0x81')][_0x9b42('0x82')];return db['ChatWebsite'][_0x9b42('0x67')]({'where':{'id':_0x5b34f3[_0x9b42('0x65')]['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0x375f50,null))['then'](saveUpdates(_0x5b34f3['body'],null))[_0x9b42('0x30')](respondWithResult(_0x375f50,null))[_0x9b42('0x24')](handleError(_0x375f50,null));};exports[_0x9b42('0x87')]=function(_0x524e33,_0x5be5eb){var _0xd0c7ea=path[_0x9b42('0x88')](config[_0x9b42('0x89')],'server/files/images/logos/default_logo.svg');var _0x380550={'where':{'id':_0x524e33[_0x9b42('0x65')]['id']},'attributes':['id',_0x9b42('0x80')],'raw':!![]};var _0x29ed60=![];return require('../../config/license/util')['getLicense']()[_0x9b42('0x30')](function(_0xffaac9){if(_0xffaac9){_0x29ed60=_0xffaac9['custom'];}})['then'](function(){return db[_0x9b42('0x4e')][_0x9b42('0x67')](_0x380550);})[_0x9b42('0x30')](handleEntityNotFound(_0x5be5eb,null))[_0x9b42('0x30')](function(_0x294dfe){if(_0x294dfe){if(!_[_0x9b42('0x8a')](_0x294dfe['sitepic'])){if(fs[_0x9b42('0x8b')](path[_0x9b42('0x88')](config[_0x9b42('0x89')],'server/files/images/logos/',_0x294dfe[_0x9b42('0x80')]))&&_0x29ed60){_0xd0c7ea=path['join'](config[_0x9b42('0x89')],'server/files/images/logos/',_0x294dfe[_0x9b42('0x80')]);}}return _0x5be5eb[_0x9b42('0x8c')](_0xd0c7ea);}})['catch'](handleError(_0x5be5eb,null));};exports['getAvatar']=function(_0x24a740,_0x48cf6b){var _0x9509e1=path['join'](config[_0x9b42('0x89')],_0x9b42('0x8d'));var _0x3833b6={'where':{'id':_0x24a740[_0x9b42('0x65')]['id']},'attributes':['id',_0x9b42('0x83')],'raw':!![]};return db[_0x9b42('0x4e')][_0x9b42('0x67')](_0x3833b6)[_0x9b42('0x30')](handleEntityNotFound(_0x48cf6b,null))[_0x9b42('0x30')](function(_0x2c9842){if(_0x2c9842){if(!_[_0x9b42('0x8a')](_0x2c9842['agentAvatar'])){if(fs[_0x9b42('0x8b')](path[_0x9b42('0x88')](config[_0x9b42('0x89')],_0x9b42('0x8e'),_0x2c9842[_0x9b42('0x83')]))){_0x9509e1=path['join'](config[_0x9b42('0x89')],_0x9b42('0x8e'),_0x2c9842[_0x9b42('0x83')]);}}return _0x48cf6b['download'](_0x9509e1);}})['catch'](handleError(_0x48cf6b,null));};exports['getCustomerAvatar']=function(_0x3c0d5b,_0x218802){var _0x12bd5a=path[_0x9b42('0x88')](config[_0x9b42('0x89')],'server/files/images/avatars/customer_avatar.png');var _0x109099={'where':{'id':_0x3c0d5b['params']['id']},'attributes':['id',_0x9b42('0x85'),_0x9b42('0x8f')],'raw':!![]};return db[_0x9b42('0x4e')][_0x9b42('0x67')](_0x109099)['then'](handleEntityNotFound(_0x218802,null))[_0x9b42('0x30')](function(_0x436537){if(_0x436537){if(!_[_0x9b42('0x8a')](_0x436537[_0x9b42('0x85')])){if(fs[_0x9b42('0x8b')](path[_0x9b42('0x88')](config['root'],_0x9b42('0x8e'),_0x436537[_0x9b42('0x85')]))&&_0x436537[_0x9b42('0x8f')]){_0x12bd5a=path[_0x9b42('0x88')](config[_0x9b42('0x89')],_0x9b42('0x8e'),_0x436537['customerAvatar']);}}return _0x218802[_0x9b42('0x8c')](_0x12bd5a);}})['catch'](handleError(_0x218802,null));};exports[_0x9b42('0x90')]=function(_0x2b0005,_0x149067){var _0x300f5f=path[_0x9b42('0x88')](config[_0x9b42('0x89')],_0x9b42('0x91'));var _0x187f98={'where':{'id':_0x2b0005[_0x9b42('0x65')]['id']},'attributes':['id',_0x9b42('0x86')],'raw':!![]};return db[_0x9b42('0x4e')][_0x9b42('0x67')](_0x187f98)['then'](handleEntityNotFound(_0x149067,null))[_0x9b42('0x30')](function(_0xe6095b){if(_0xe6095b){if(!_[_0x9b42('0x8a')](_0xe6095b[_0x9b42('0x86')])){if(fs[_0x9b42('0x8b')](path[_0x9b42('0x88')](config[_0x9b42('0x89')],_0x9b42('0x8e'),_0xe6095b['systemAvatar']))){_0x300f5f=path[_0x9b42('0x88')](config[_0x9b42('0x89')],'server/files/images/avatars/',_0xe6095b['systemAvatar']);}}return _0x149067[_0x9b42('0x8c')](_0x300f5f);}})[_0x9b42('0x24')](handleError(_0x149067,null));};function checkWebsiteInterval(_0x387ba2){var _0x2f93ba=_0x387ba2[_0x9b42('0x92')];if(!_0x2f93ba){return Promise['resolve'](_0x387ba2);}var _0x3df6fe=_0x387ba2[_0x9b42('0x93')]||undefined;return _0x2f93ba['ifTime'](_0x3df6fe)['then'](function(_0x97f2df){if(!_0x97f2df){throw new APIOutOfIntervalError();}return _0x387ba2;});}exports[_0x9b42('0x94')]=function(_0x4725cc,_0x45013f){var _0x126a8b={'body':_0x4725cc['body'],'channel':_0x9b42('0x95')};var _0x503727=[];var _0x5d8b5c=[];var _0x3c2539={};var _0x29b182=![];if(_0x4725cc['body']['id']){delete _0x4725cc['body']['id'];}if(_[_0x9b42('0x8a')](_0x4725cc[_0x9b42('0x6a')][_0x9b42('0x96')])){throw new APIBadRequestError(_0x9b42('0x97'));}if(_[_0x9b42('0x8a')](_0x4725cc['body'][_0x9b42('0x98')])){throw new APIBadRequestError(_0x9b42('0x99'));}if(_['isEmpty'](_0x4725cc[_0x9b42('0x6a')][_0x9b42('0x6a')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x1a1417=_0x4725cc[_0x9b42('0x6a')][_0x9b42('0x39')]&&_0x4725cc['body']['referer'];return db[_0x9b42('0x9a')][_0x9b42('0x75')]()[_0x9b42('0x30')](function(_0x292ac9){if(!_0x292ac9){throw new Error(_0x9b42('0x9b'));}_0x503727=Object[_0x9b42('0x53')](_0x292ac9)['filter'](function(_0x2eb276){return![_0x9b42('0x9c'),_0x9b42('0x9d')]['includes'](_0x2eb276);});_0x5d8b5c=Object[_0x9b42('0x53')](_0x292ac9)[_0x9b42('0x5f')](function(_0x1ee390){return![_0x9b42('0x9c'),_0x9b42('0x9d'),_0x9b42('0x9e'),_0x9b42('0x9f')]['includes'](_0x1ee390);});if(!_['includes'](_0x5d8b5c,_0x4725cc['body']['mapKey'])){throw new APIBadRequestError(_0x9b42('0xa0')+_0x5d8b5c[_0x9b42('0x88')](',\x20'));}_0x3c2539[_0x4725cc[_0x9b42('0x6a')][_0x9b42('0x98')]]=_0x4725cc[_0x9b42('0x6a')][_0x9b42('0x96')];})[_0x9b42('0x30')](function(){return db[_0x9b42('0x4e')][_0x9b42('0x67')]({'where':{'id':_0x4725cc[_0x9b42('0x65')]['id']},'include':[{'model':db[_0x9b42('0xa1')],'as':_0x9b42('0xa2'),'include':[{'model':db[_0x9b42('0x9a')],'as':_0x9b42('0xa3'),'where':_0x3c2539,'limit':0x1,'order':[[_0x9b42('0x9d'),_0x9b42('0xa4')]]}]},{'model':db[_0x9b42('0xa5')],'as':_0x9b42('0xa6')},{'model':db[_0x9b42('0x92')],'as':'Interval','include':[{'model':db[_0x9b42('0x92')],'as':_0x9b42('0xa7'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x9b42('0x30')](function(_0x14e2e0){if(!_0x14e2e0){throw new APINotFoundError(util[_0x9b42('0x42')](_0x9b42('0xa8'),_0x4725cc[_0x9b42('0x65')]['id']));}if(_0x1a1417){return checkWebsiteInterval(_0x14e2e0);}return _0x14e2e0;})[_0x9b42('0x30')](function(_0x17af03){_0x126a8b['account']=_0x17af03;_0x126a8b[_0x9b42('0xa9')]=_[_0x9b42('0xaa')](_0x17af03[_0x9b42('0xa6')],[_0x9b42('0xab')],[_0x9b42('0xac')]);if(_0x126a8b['account'][_0x9b42('0xa6')]){delete _0x126a8b[_0x9b42('0xad')]['Applications'];}_0x126a8b['list']=_0x17af03[_0x9b42('0xa2')]||{'id':_0x17af03[_0x9b42('0x9f')]};if(_0x126a8b['list']&&_0x126a8b[_0x9b42('0xae')]['Contacts'][_0x9b42('0x58')]){return _0x126a8b[_0x9b42('0xae')][_0x9b42('0xa3')][0x0];}var _0x26ee51=_['defaults'](_0x4725cc['body'],{'firstName':_0x4725cc[_0x9b42('0x6a')][_0x9b42('0x96')],'ListId':_0x17af03['ListId']});_0x26ee51[_0x4725cc[_0x9b42('0x6a')][_0x9b42('0x98')]]=_0x4725cc[_0x9b42('0x6a')][_0x9b42('0x96')];return db[_0x9b42('0x9a')][_0x9b42('0x68')](_0x26ee51,{'fields':_0x503727,'raw':!![]});})[_0x9b42('0x30')](function(_0x118300){_0x126a8b['contact']=_0x118300;var _0x33c1ea=createInteractionObject(_0x4725cc[_0x9b42('0x65')]['id'],_0x4725cc[_0x9b42('0x6a')],_0x4725cc[_0x9b42('0xaf')],_0x118300);var _0x45df6c={'ChatWebsiteId':_0x4725cc['params']['id']};if(_0x4725cc[_0x9b42('0x6a')][_0x9b42('0xb0')]){_0x45df6c[_0x9b42('0xb0')]=_0x4725cc[_0x9b42('0x6a')][_0x9b42('0xb0')];_0x45df6c[_0x9b42('0xb1')]=![];return db[_0x9b42('0xb2')]['find']({'where':_0x45df6c})[_0x9b42('0x30')](function(_0x2e3df0){var _0x5e6bcb=_0x4725cc[_0x9b42('0x6a')][_0x9b42('0x39')]&&_0x4725cc['body'][_0x9b42('0x3f')];if(_0x2e3df0){_0x29b182=!![];return _0x2e3df0;}else if(!_0x5e6bcb&&_0x2e3df0&&_0x2e3df0[_0x9b42('0xb1')]){throw new APIConflictError(_0x9b42('0xb3'));}_0x33c1ea['threadId']=_0x4725cc[_0x9b42('0x6a')]['threadId'];_0x33c1ea[_0x9b42('0xb4')]=_0x4725cc[_0x9b42('0x6a')][_0x9b42('0xb4')];return db['ChatInteraction'][_0x9b42('0x68')](_0x33c1ea);});}_0x45df6c[_0x9b42('0xb5')]=_0x118300['id'];if(_0x4725cc['body'][_0x9b42('0xb6')]&&_0x4725cc['body'][_0x9b42('0xb6')]['id']){_0x45df6c['id']=_0x4725cc['body'][_0x9b42('0xb6')]['id'];return db[_0x9b42('0xb2')][_0x9b42('0x67')]({'where':_0x45df6c})[_0x9b42('0x30')](function(_0x55f92d){var _0x25974e=_0x4725cc[_0x9b42('0x6a')][_0x9b42('0x39')]&&_0x4725cc[_0x9b42('0x6a')][_0x9b42('0x3f')];if(!_0x25974e&&_0x55f92d&&_0x55f92d[_0x9b42('0xb1')]){throw new APIConflictError(_0x9b42('0xb3'));}else if(_0x55f92d){_0x29b182=!![];return _0x55f92d;}else{return db['ChatInteraction']['create'](_0x33c1ea);}});}return db['ChatInteraction']['create'](_0x33c1ea);})[_0x9b42('0x30')](function(_0x25f6d3){if(!_0x29b182){return _0x25f6d3;}var _0x57ff3a={'from':(_0x126a8b[_0x9b42('0xb7')][_0x9b42('0xb8')]||'')+'\x20'+(_0x126a8b[_0x9b42('0xb7')][_0x9b42('0x3d')]||'')};if(_0x4725cc['body']['threadId']&&_0x4725cc[_0x9b42('0x6a')][_0x9b42('0xb9')]&&_0x4725cc['body'][_0x9b42('0xb0')]!=_0x4725cc['body'][_0x9b42('0xb9')]){_0x57ff3a[_0x9b42('0xb0')]=_0x4725cc[_0x9b42('0x6a')][_0x9b42('0xb9')];}return _0x25f6d3[_0x9b42('0x2f')](_0x57ff3a);})[_0x9b42('0x30')](function(_0x4cf76b){_0x126a8b['interaction']=_0x4cf76b[_0x9b42('0x32')]({'plain':!![]});_0x126a8b[_0x9b42('0xb6')][_0x9b42('0xba')]=!_0x29b182;if(_0x126a8b[_0x9b42('0xb6')][_0x9b42('0xba')]){if(_0x126a8b['account']['autoclose']){_0x126a8b[_0x9b42('0xa9')][_0x9b42('0xbb')]({'id':0x0,'priority':_0x126a8b[_0x9b42('0xa9')][_0x9b42('0x58')]+0x1,'app':_0x9b42('0xbc'),'appdata':_0x9b42('0xbd'),'interval':'*,*,*,*'});}}return db[_0x9b42('0xbe')][_0x9b42('0x68')]({'body':_0x4725cc[_0x9b42('0x6a')][_0x9b42('0x6a')],'ChatWebsiteId':_0x4725cc[_0x9b42('0x65')]['id'],'ChatInteractionId':_0x4cf76b['id'],'direction':'in','ContactId':_0x126a8b[_0x9b42('0xb7')]['id'],'AttachmentId':_0x4725cc[_0x9b42('0x6a')]['AttachmentId']});})[_0x9b42('0x30')](function(_0x43fdf1){_0x126a8b[_0x9b42('0x22')]=_0x43fdf1;if(!_0x126a8b[_0x9b42('0xb6')]['UserId']){return;}return db[_0x9b42('0xbf')][_0x9b42('0x67')]({'attributes':['id','name'],'where':{'id':_0x126a8b['interaction'][_0x9b42('0xc0')]}});})[_0x9b42('0x30')](function(_0x26e106){if(_0x26e106){_0x126a8b[_0x9b42('0xa9')]['unshift']({'id':0x0,'priority':0x0,'app':_0x9b42('0xc1'),'appdata':_0x26e106['name']+','+(_0x126a8b[_0x9b42('0xad')][_0x9b42('0xc2')]||0xa),'interval':_0x9b42('0xc3')});_0x126a8b[_0x9b42('0xc4')]=!![];}if(!_0x126a8b[_0x9b42('0xb6')]['queueId']){return;}return db['ChatQueue'][_0x9b42('0x67')]({'attributes':['id',_0x9b42('0x34')],'where':{'id':_0x126a8b[_0x9b42('0xb6')][_0x9b42('0xc5')]}});})[_0x9b42('0x30')](function(_0x56b9ab){if(_0x56b9ab){_0x126a8b[_0x9b42('0xa9')][_0x9b42('0xc6')]({'id':0x0,'priority':0x1,'app':_0x9b42('0xc7'),'appdata':_0x56b9ab[_0x9b42('0x34')]+','+(_0x126a8b[_0x9b42('0xad')]['waitForTheAssignedQueue']||0x12c),'interval':_0x9b42('0xc3')});}return respondWithRpcPromise(_0x9b42('0xc8'),_0x9b42('0xc9'),_0x126a8b);})[_0x9b42('0x30')](function(_0x3a8e6d){respondWithRpcPromise(_0x9b42('0xca'),_0x9b42('0xca'),{'event':_0x9b42('0x94'),'message':_0x3a8e6d},client9002);return _0x3a8e6d;})[_0x9b42('0x30')](respondWithResult(_0x45013f,null))['catch'](APIHandleError(_0x45013f));};exports[_0x9b42('0xcb')]=function(_0x321215,_0x18dad2){var _0x1a17f9,_0x586872,_0x7e5d00;var _0x47c0cd=[];var _0x3fa57a={};var _0x4c3e16=_0x321215[_0x9b42('0xcc')]||[];var _0x2cbaac=[];var _0x4b1be3;return db[_0x9b42('0x9a')][_0x9b42('0x75')]()[_0x9b42('0x30')](function(_0x6bf389){if(!_0x6bf389){throw new db[(_0x9b42('0xcd'))][(_0x9b42('0xce'))](_0x9b42('0xcf'));}_0x47c0cd=_[_0x9b42('0xd0')](_[_0x9b42('0x53')](_0x6bf389),[_0x9b42('0x9c'),'updatedAt',_0x9b42('0x9e'),_0x9b42('0x9f')]);if(_0x321215[_0x9b42('0x6a')]['id']){delete _0x321215['body']['id'];}if(_['isNil'](_0x321215[_0x9b42('0x6a')][_0x9b42('0x96')])){throw _0x18dad2[_0x9b42('0x26')](0x1f4)[_0x9b42('0xd1')](new db[(_0x9b42('0xcd'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x9b42('0x8a')](_0x321215[_0x9b42('0x6a')][_0x9b42('0x6a')])||_0x321215[_0x9b42('0x6a')]['body']===''){throw _0x18dad2[_0x9b42('0x26')](0x1f4)[_0x9b42('0xd1')](new db[(_0x9b42('0xcd'))][(_0x9b42('0xce'))](_0x9b42('0xd2')));}if(_[_0x9b42('0x8a')](_0x321215['body']['mapKeyOffline'])){throw _0x18dad2[_0x9b42('0x26')](0x1f4)['send'](new db[(_0x9b42('0xcd'))][(_0x9b42('0xce'))](_0x9b42('0xd3')+_0x47c0cd));}if(!_['includes'](_0x47c0cd,_0x321215[_0x9b42('0x6a')][_0x9b42('0xd4')])){throw _0x18dad2['status'](0x1f4)[_0x9b42('0xd1')](new db[(_0x9b42('0xcd'))][(_0x9b42('0xce'))](_0x9b42('0xd5')+_0x47c0cd));}_0x3fa57a[_0x321215['body'][_0x9b42('0xd4')]]=_0x321215[_0x9b42('0x6a')][_0x9b42('0x96')];})[_0x9b42('0x30')](function(){return db[_0x9b42('0x4e')][_0x9b42('0x67')]({'where':{'id':_0x321215[_0x9b42('0x65')]['id']},'include':[{'model':db[_0x9b42('0xa1')],'as':'List'},{'model':db['MailAccount'],'as':'MailAccount'}]});})[_0x9b42('0x30')](handleEntityNotFound(_0x18dad2,null))['then'](function(_0x19a0b3){if(_0x19a0b3&&_0x19a0b3[_0x9b42('0xa2')]){_0x586872=_0x19a0b3;var _0x195e6e=_[_0x9b42('0x14')](_0x321215[_0x9b42('0x6a')],{'firstName':_0x321215['body'][_0x9b42('0x96')],'phone':_0x321215[_0x9b42('0x6a')][_0x9b42('0x96')],'ListId':_0x19a0b3[_0x9b42('0x9f')]});_0x195e6e[_0x321215['body'][_0x9b42('0xd4')]]=_0x321215['body']['from'];return db[_0x9b42('0x9a')]['findOrCreate']({'where':_0x3fa57a,'defaults':_0x195e6e});}})[_0x9b42('0xd6')](function(_0xc33731){if(_0xc33731){_0x7e5d00=_0xc33731;var _0x3daee8=fs['readFileSync'](path['join'](config['root'],_0x9b42('0xd7')),_0x9b42('0xd8'));var _0x4a9c0d=ejs['render'](_0x3daee8,{'body':_['toPairs'](_0x321215[_0x9b42('0x6a')][_0x9b42('0x6a')]),'bodyTitle':_0x586872[_0x9b42('0xd9')]});return db[_0x9b42('0xda')][_0x9b42('0x68')]({'body':_0x4a9c0d,'plainBody':htmlToText[_0x9b42('0xdb')](_0x4a9c0d),'ContactId':_0xc33731['id'],'ChatWebsiteId':_0x586872['id']});}})[_0x9b42('0x30')](function(_0x843f49){_0x4b1be3=_0x843f49;if(_0x4c3e16[_0x9b42('0x58')]){var _0x814cac=_0x4c3e16[_0x9b42('0x4d')](function(_0x3c040e){return{'name':_0x3c040e[_0x9b42('0xdc')],'basename':_0x3c040e[_0x9b42('0x82')],'type':_0x3c040e[_0x9b42('0xdd')],'ChatOfflineMessageId':_0x843f49['id']};});_0x2cbaac=_0x814cac['map'](_0x5aee82=>{var _0x1115c6={'filename':_0x5aee82[_0x9b42('0x34')],'path':path['join'](config['root'],_0x9b42('0xde'),'files',_0x9b42('0xdf'),_0x9b42('0xe0'),_0x5aee82[_0x9b42('0xe1')])};return _0x1115c6;});if(!_0x586872[_0x9b42('0xe2')]){return db['sequelize']['transaction'](function(_0x1b1359){return db['Attachment'][_0x9b42('0xe3')](_0x814cac,{'transaction':_0x1b1359});});}}})[_0x9b42('0x30')](function(){if(_0x4b1be3){_0x1a17f9=_0x4b1be3;return db[_0x9b42('0xe4')][_0x9b42('0x79')]({'where':{'service':!![]},'include':[{'model':db[_0x9b42('0xe5')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x9b42('0xe6')],'as':_0x9b42('0xe6'),'raw':!![]}]}]});}})[_0x9b42('0x30')](function(_0x4bab32){if(_0x4bab32&&_0x4bab32[_0x9b42('0xe7')]&&_0x586872[_0x9b42('0xe8')]&&_0x586872[_0x9b42('0xe9')]){var _0x243892=_0x4bab32['getSmtpOptions']();return respondWithRpcPromise(_0x9b42('0xea'),_0x9b42('0xeb'),{'account':_0x243892,'message':{'from':util[_0x9b42('0x42')]('\x22%s\x22\x20<%s>',_0x4bab32[_0x9b42('0x34')],_0x4bab32[_0x9b42('0xec')]||_0x4bab32[_0x9b42('0xe7')][_0x9b42('0x6d')]),'to':_0x586872[_0x9b42('0xe9')],'subject':_0x586872['offlineMessageSubject'],'html':_0x1a17f9[_0x9b42('0x6a')],'attachments':_0x2cbaac}},client9003)[_0x9b42('0x30')](function(){return _0x1a17f9;})[_0x9b42('0x24')](function(_0x5e2aa9){logger[_0x9b42('0x20')](_0x5e2aa9);});}})[_0x9b42('0x30')](function(){if(_0x586872&&_0x586872[_0x9b42('0xe2')]&&_0x586872[_0x9b42('0xed')]){var _0x43768b=[];if(_0x4c3e16[_0x9b42('0x58')]){_0x43768b=_0x4c3e16[_0x9b42('0x4d')](function(_0x20b09e){return{'name':_0x20b09e[_0x9b42('0xdc')],'basename':_0x20b09e[_0x9b42('0x82')],'type':_0x20b09e['mimetype'],'ChatOfflineMessageId':_0x4b1be3['id']};});}var _0xa040a;if(!_['isNil'](_0x586872['subjectOffline'])){var _0x485248=_[_0x9b42('0x4d')](_0x321215[_0x9b42('0x6a')],function(_0x19a529){return _0x19a529;});var _0x1b898a=_[_0x9b42('0xee')](_0x485248)[0x0];var _0xc8a08c=_['mapValues'](_0x1b898a,function(_0xaa8704){return _0xaa8704;});_0xa040a=_0xc8a08c[0x1][_0x586872[_0x9b42('0xef')]];}var _0x313055={'from':_0x7e5d00['email'],'firstName':_0x7e5d00[_0x9b42('0xb8')],'lastName':_0x7e5d00[_0x9b42('0x3d')],'mapKey':'email','message':{'from':_0x7e5d00[_0x9b42('0xec')],'to':_0x586872[_0x9b42('0xe4')][_0x9b42('0xec')],'cc':'','subject':_[_0x9b42('0x8a')](_0xa040a)?_0x586872['offlineMessageSubject']:_0xa040a,'messageId':'','sentAt':new Date(),'attach':_0x43768b[_0x9b42('0x58')],'attachments':_0x43768b,'originChannel':_0x9b42('0xf0'),'ChatWebsiteId':_0x586872['id'],'ChatOfflineMessageId':_0x1a17f9['id'],'originTo':_0x586872[_0x9b42('0xe4')]['email']},'body':_0x1a17f9['body']};var _0x1dfd18={'account':{'id':_0x586872[_0x9b42('0xed')]},'body':_0x313055,'log':_0x9b42('0xf1')};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x1dfd18,client9001)[_0x9b42('0x30')](function(){return _0x1a17f9;})[_0x9b42('0x24')](function(_0x42b05e){logger[_0x9b42('0x20')](_0x42b05e);});}return;})[_0x9b42('0x30')](function(){if(_0x1a17f9){return _0x1a17f9;}})[_0x9b42('0x30')](respondWithResult(_0x18dad2,null))[_0x9b42('0x24')](function(){for(var _0x1b77f3 of _0x4c3e16){var _0x5c8765=path[_0x9b42('0x88')](config['root'],_0x9b42('0xde'),_0x9b42('0xcc'),'attachments','offline-chat',_0x1b77f3[_0x9b42('0x82')]);fs_extra[_0x9b42('0xf2')](_0x5c8765)[_0x9b42('0x24')](function(_0xa6bd72){logger[_0x9b42('0x20')](_0x9b42('0xf3'),_0x5c8765,_0xa6bd72);});}});};exports['addInteraction']=function(_0x13ebf2,_0x53d109){return db[_0x9b42('0xb2')][_0x9b42('0x67')]({'where':{'id':_0x13ebf2[_0x9b42('0x65')]['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0x53d109,null))[_0x9b42('0x30')](function(_0x4952c9){if(_0x4952c9){return _0x4952c9[_0x9b42('0xf4')](_0x13ebf2['body']['ids'],_['omit'](_0x13ebf2[_0x9b42('0x6a')],[_0x9b42('0x7c'),'id'])||{});}})['then'](respondWithResult(_0x53d109,null))['catch'](handleError(_0x53d109,null));};exports[_0x9b42('0xf5')]=function(_0x5e135c,_0x1e5015){var _0xe4c986={'raw':![],'where':{}};var _0x2f0ca0={};var _0x17ebdf={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x5e135c['params']['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0x1e5015,null))[_0x9b42('0x30')](function(_0x2ba174){if(_0x2ba174){_0x2f0ca0[_0x9b42('0x46')]=_[_0x9b42('0x53')](db[_0x9b42('0xb2')]['rawAttributes']);_0x2f0ca0[_0x9b42('0x52')]=_[_0x9b42('0x53')](_0x5e135c[_0x9b42('0x52')]);_0x2f0ca0[_0x9b42('0x54')]=_[_0x9b42('0x55')](_0x2f0ca0['model'],_0x2f0ca0[_0x9b42('0x52')]);_0xe4c986[_0x9b42('0x56')]=_[_0x9b42('0x55')](_0x2f0ca0['model'],qs[_0x9b42('0x57')](_0x5e135c[_0x9b42('0x52')][_0x9b42('0x57')]));_0xe4c986['attributes']=_0xe4c986[_0x9b42('0x56')]['length']?_0xe4c986['attributes']:_0x2f0ca0[_0x9b42('0x46')];if(!_0x5e135c['query'][_0x9b42('0x59')](_0x9b42('0x5a'))){_0xe4c986[_0x9b42('0x2a')]=qs[_0x9b42('0x2a')](_0x5e135c['query'][_0x9b42('0x2a')]);_0xe4c986[_0x9b42('0x28')]=qs['offset'](_0x5e135c[_0x9b42('0x52')]['offset']);}_0xe4c986['order']=qs[_0x9b42('0x5c')](_0x5e135c[_0x9b42('0x52')][_0x9b42('0x5c')]);_0xe4c986[_0x9b42('0x5d')]=qs[_0x9b42('0x54')](_[_0x9b42('0x5e')](_0x5e135c['query'],_0x2f0ca0[_0x9b42('0x54')]));_0xe4c986[_0x9b42('0x5d')]['ChatWebsiteId']=_0x2ba174['id'];if(_0x5e135c['query'][_0x9b42('0x5f')]){_0xe4c986[_0x9b42('0x5d')]=_[_0x9b42('0x60')](_0xe4c986[_0x9b42('0x5d')],{'$or':_[_0x9b42('0x4d')](_0xe4c986[_0x9b42('0x56')],function(_0x7c3ba8){var _0x190307={};_0x190307[_0x7c3ba8]={'$like':'%'+_0x5e135c['query'][_0x9b42('0x5f')]+'%'};return _0x190307;})});}_0xe4c986=_[_0x9b42('0x60')]({},_0xe4c986,_0x5e135c[_0x9b42('0x61')]);return db[_0x9b42('0xb2')][_0x9b42('0x2b')]({'where':_0xe4c986[_0x9b42('0x5d')]})['then'](function(_0x1691e1){_0x17ebdf[_0x9b42('0x2b')]=_0x1691e1;if(_0x5e135c['query'][_0x9b42('0x62')]){_0xe4c986[_0x9b42('0x66')]=[{'model':db[_0x9b42('0x9a')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x9b42('0x34'),_0x9b42('0xf6'),_0x9b42('0xf7')],'required':![]},{'model':db['Tag'],'as':_0x9b42('0xf8'),'attributes':['id','name',_0x9b42('0xf9')],'where':_0x5e135c[_0x9b42('0x52')][_0x9b42('0xfa')]?{'id':_0x5e135c[_0x9b42('0x52')]['tag']}:undefined,'required':_0x5e135c[_0x9b42('0x52')][_0x9b42('0xfa')]?!![]:![]}];}return db[_0x9b42('0xb2')][_0x9b42('0x63')](_0xe4c986);})[_0x9b42('0x30')](function(_0x754524){_0x17ebdf['rows']=_0x754524;return _0x17ebdf;});}})['then'](respondWithFilteredResult(_0x1e5015,_0xe4c986))['catch'](handleError(_0x1e5015,null));};exports[_0x9b42('0xfb')]=function(_0x484ffe,_0x423cad){var _0x324ba5=0x0;var _0x40726f=0x0;var _0x30dd2d=![];var _0x1a442a;var _0x5b4636;return db[_0x9b42('0x4e')]['find']({'where':{'id':_0x484ffe[_0x9b42('0x65')]['id']},'include':[{'model':db[_0x9b42('0x92')],'as':_0x9b42('0x92'),'include':[{'model':db[_0x9b42('0x92')],'as':'Intervals','attributes':['id',_0x9b42('0xfc')]}]}]})[_0x9b42('0x30')](handleEntityNotFound(_0x423cad,null))[_0x9b42('0x30')](function(_0x227f39){if(_0x227f39){_0x1a442a=_0x227f39;return _0x227f39[_0x9b42('0xfd')]({'raw':!![]});}})[_0x9b42('0x30')](function(_0x142494){if(_0x1a442a){if(_0x142494){_0x5b4636=_0x142494;}}return require(_0x9b42('0xfe'))['getLicense']();})[_0x9b42('0x30')](function(_0x49c044){if(_0x49c044){_0x40726f=_0x49c044[_0x9b42('0xff')];_0x30dd2d=_0x49c044[_0x9b42('0x100')];}})[_0x9b42('0x30')](function(){return db[_0x9b42('0xb2')][_0x9b42('0x2b')]({'where':{'closed':![]}});})[_0x9b42('0x30')](function(_0x13faff){_0x324ba5=_0x13faff;if(_0x40726f&&_0x13faff>_0x40726f){return db[_0x9b42('0x101')][_0x9b42('0x79')]({'where':{'id':0x1}})[_0x9b42('0x30')](function(_0x41a00f){if(_0x41a00f){_0x41a00f[_0x9b42('0x102')](_0x9b42('0x103'));}});}})[_0x9b42('0x30')](function(){var _0x2c33e9=_0x1a442a[_0x9b42('0x92')];var _0x1bc1f9=_0x1a442a[_0x9b42('0x93')]||undefined;return _0x2c33e9?_0x2c33e9['ifTime'](_0x1bc1f9):!![];})[_0x9b42('0x30')](function(_0x5030ff){var _0x295807=fs[_0x9b42('0x104')](path[_0x9b42('0x88')](config[_0x9b42('0x89')],_0x9b42('0x105')),_0x9b42('0xd8'));var _0x4eaff1=_0x9b42('0x106');var _0x3b108f=![];try{const _0x19b224=new URL(_0x1a442a[_0x9b42('0x6b')]);_0x1a442a['address']=_0x19b224['origin'];}catch(_0x497cff){}var _0x39e3a9;if(_0x484ffe[_0x9b42('0xaf')][_0x9b42('0x3f')]){_0x484ffe[_0x9b42('0xaf')]['referer']=_0x484ffe[_0x9b42('0xaf')][_0x9b42('0x3f')][_0x9b42('0x107')](/\/$/,'');_0x39e3a9=wildcardUtils[_0x9b42('0x108')](_0x1a442a['address'],_0x484ffe[_0x9b42('0xaf')]['referer']);}else{_0x484ffe['headers'][_0x9b42('0x3f')]=_0x1a442a['address'];_0x39e3a9=!![];}var _0x2f033f={'chatVersion':_0x4eaff1,'chatWebsiteAddressOrigin':_0x39e3a9?_0x484ffe[_0x9b42('0xaf')][_0x9b42('0x3f')]:_0x1a442a[_0x9b42('0x6b')],'remote':_0x1a442a[_0x9b42('0x109')],'query':querystring[_0x9b42('0x10a')](_['merge'](_0x1a442a[_0x9b42('0x32')]({'plain':!![]}),{'customerIp':_0x484ffe[_0x9b42('0xaf')][_0x9b42('0x3a')]||_0x484ffe[_0x9b42('0xaf')]['x-real-ip']||_0x484ffe[_0x9b42('0x10b')][_0x9b42('0x10c')]||_0x484ffe['ip'],'referer':_0x484ffe[_0x9b42('0xaf')]['referer'],'openedInteractions':_0x324ba5,'maxInteractions':_0x40726f,'virtual':_0x30dd2d['virtual'],'online':_0x5030ff,'custom':_0x30dd2d,'address':_0x39e3a9?_0x484ffe['headers']['referer']:null}))[_0x9b42('0x107')](/'/g,'\x5c\x27')};_0x423cad['send'](ejs[_0x9b42('0x10d')](Mustache['render'](_0x295807,_0x2f033f),{'proactiveActions':_0x5b4636,'alignment':_0x1a442a[_0x9b42('0x10e')],'verticalAlignment':_0x1a442a[_0x9b42('0x10f')],'div_color':_0x1a442a[_0x9b42('0xf9')],'labelText':_0x1a442a[_0x9b42('0x110')],'text_color':_0x1a442a[_0x9b42('0x111')],'text_button_color':_0x1a442a['textButtonColor'],'button_color':_0x1a442a[_0x9b42('0x112')],'background_color':_0x1a442a['backgroundColor'],'hideWhenOffline':_0x1a442a[_0x9b42('0x113')],'intervalId':_0x1a442a[_0x9b42('0x114')],'isDevelopment':_0x3b108f,'chatVersion':_0x4eaff1}));})[_0x9b42('0x24')](handleError(_0x423cad,null));};exports['addApplications']=function(_0x5b5e58,_0x45c955){var _0x3bc2c5=_0x5b5e58['params']['id'];var _0x6e629d=_0x5b5e58[_0x9b42('0x6a')];var _0x49c1c2=0xc8;var _0x5eaad8=null;return db[_0x9b42('0x115')][_0x9b42('0x116')]({'isolationLevel':db[_0x9b42('0x115')][_0x9b42('0x117')][_0x9b42('0x118')][_0x9b42('0x119')]},function(_0x169289){return db[_0x9b42('0x4e')][_0x9b42('0x79')]({'where':{'id':_0x3bc2c5},'transaction':_0x169289})[_0x9b42('0x30')](function(_0x871f37){if(_0x871f37){return db['ChatApplication'][_0x9b42('0x31')]({'where':{'ChatWebsiteId':_0x3bc2c5},'transaction':_0x169289})[_0x9b42('0x30')](function(){var _0x1c1dfb=_[_0x9b42('0x4d')](_0x6e629d,function(_0x24d6e2){_0x24d6e2[_0x9b42('0x77')]=_0x3bc2c5;return _0x24d6e2;});return db[_0x9b42('0xa5')][_0x9b42('0xe3')](_0x1c1dfb,{'transaction':_0x169289});});}else{_0x49c1c2=0x194;_0x5eaad8=[];}});})['then'](function(){if(_0x49c1c2!==0x194){return db[_0x9b42('0xa5')][_0x9b42('0x11a')]({'where':{'ChatWebsiteId':_0x3bc2c5},'order':_0x9b42('0xab')})[_0x9b42('0x30')](function(_0x59325a){_0x5eaad8=_0x59325a;});}})['catch'](function(_0x10630d){_0x49c1c2=0x1f4;logger[_0x9b42('0x20')](_0x10630d[_0x9b42('0x11b')]);if(_0x10630d[_0x9b42('0x34')]){delete _0x10630d[_0x9b42('0x34')];}_0x5eaad8=_0x10630d;})[_0x9b42('0x11c')](function(){if(_0x5eaad8===null){_0x45c955[_0x9b42('0x25')](_0x49c1c2);}else{if(_0x49c1c2===0x1f4){_0x45c955[_0x9b42('0x26')](_0x49c1c2)[_0x9b42('0xd1')](_0x5eaad8);}else{_0x45c955['status'](_0x49c1c2)[_0x9b42('0x2e')](_0x5eaad8);}}});};exports[_0x9b42('0x11d')]=function(_0x323ccb,_0x5c1496){var _0x21f8e6={};var _0x1e101d={};var _0x365f38;var _0x513435;return db['ChatWebsite']['findOne']({'where':{'id':_0x323ccb[_0x9b42('0x65')]['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0x5c1496,null))[_0x9b42('0x30')](function(_0x311e86){if(_0x311e86){_0x365f38=_0x311e86;_0x1e101d[_0x9b42('0x46')]=_['keys'](db[_0x9b42('0xa5')][_0x9b42('0x4f')]);_0x1e101d[_0x9b42('0x52')]=_[_0x9b42('0x53')](_0x323ccb[_0x9b42('0x52')]);_0x1e101d[_0x9b42('0x54')]=_[_0x9b42('0x55')](_0x1e101d[_0x9b42('0x46')],_0x1e101d[_0x9b42('0x52')]);_0x21f8e6[_0x9b42('0x56')]=_[_0x9b42('0x55')](_0x1e101d[_0x9b42('0x46')],qs[_0x9b42('0x57')](_0x323ccb[_0x9b42('0x52')][_0x9b42('0x57')]));_0x21f8e6[_0x9b42('0x56')]=_0x21f8e6[_0x9b42('0x56')][_0x9b42('0x58')]?_0x21f8e6['attributes']:_0x1e101d[_0x9b42('0x46')];_0x21f8e6[_0x9b42('0x5b')]=qs[_0x9b42('0x5c')](_0x323ccb['query'][_0x9b42('0x5c')]);_0x21f8e6['where']=qs[_0x9b42('0x54')](_['pick'](_0x323ccb[_0x9b42('0x52')],_0x1e101d['filters']));if(_0x323ccb[_0x9b42('0x52')][_0x9b42('0x5f')]){_0x21f8e6[_0x9b42('0x5d')]=_[_0x9b42('0x60')](_0x21f8e6['where'],{'$or':_[_0x9b42('0x4d')](_0x21f8e6[_0x9b42('0x56')],function(_0x2e0f53){var _0x40cf89={};_0x40cf89[_0x2e0f53]={'$like':'%'+_0x323ccb['query'][_0x9b42('0x5f')]+'%'};return _0x40cf89;})});}_0x21f8e6=_[_0x9b42('0x60')]({},_0x21f8e6,_0x323ccb[_0x9b42('0x61')]);return _0x365f38[_0x9b42('0x11d')](_0x21f8e6);}})['then'](function(_0x48eedb){if(_0x48eedb){_0x513435=_0x48eedb['length'];if(!_0x323ccb[_0x9b42('0x52')][_0x9b42('0x59')](_0x9b42('0x5a'))){_0x21f8e6[_0x9b42('0x2a')]=qs[_0x9b42('0x2a')](_0x323ccb[_0x9b42('0x52')][_0x9b42('0x2a')]);_0x21f8e6[_0x9b42('0x28')]=qs[_0x9b42('0x28')](_0x323ccb[_0x9b42('0x52')][_0x9b42('0x28')]);}return _0x365f38[_0x9b42('0x11d')](_0x21f8e6);}})['then'](function(_0x2d43b7){if(_0x2d43b7){return _0x2d43b7?{'count':_0x513435,'rows':_0x2d43b7}:null;}})[_0x9b42('0x30')](respondWithResult(_0x5c1496,null))[_0x9b42('0x24')](handleError(_0x5c1496,null));};exports['addProactiveActions']=function(_0x3fc59e,_0xe2c033){return db[_0x9b42('0x11e')][_0x9b42('0x67')]({'where':{'id':_0x3fc59e[_0x9b42('0x65')]['id']}})['then'](handleEntityNotFound(_0xe2c033,null))['then'](function(_0x427942){if(_0x427942){return _0x427942[_0x9b42('0x11f')](_0x3fc59e[_0x9b42('0x6a')][_0x9b42('0x7c')],_['omit'](_0x3fc59e[_0x9b42('0x6a')],[_0x9b42('0x7c'),'id'])||{});}})[_0x9b42('0x30')](respondWithResult(_0xe2c033,null))[_0x9b42('0x24')](handleError(_0xe2c033,null));};exports[_0x9b42('0xfd')]=function(_0x259b4f,_0x1f931f){var _0x5b0e7e={};var _0x28d965={};var _0x2220e3;var _0x2758ca;return db['ChatWebsite']['findOne']({'where':{'id':_0x259b4f[_0x9b42('0x65')]['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0x1f931f,null))[_0x9b42('0x30')](function(_0x2b1e63){if(_0x2b1e63){_0x2220e3=_0x2b1e63;_0x28d965[_0x9b42('0x46')]=_['keys'](db[_0x9b42('0x120')][_0x9b42('0x4f')]);_0x28d965['query']=_[_0x9b42('0x53')](_0x259b4f[_0x9b42('0x52')]);_0x28d965[_0x9b42('0x54')]=_['intersection'](_0x28d965[_0x9b42('0x46')],_0x28d965[_0x9b42('0x52')]);_0x5b0e7e['attributes']=_[_0x9b42('0x55')](_0x28d965[_0x9b42('0x46')],qs[_0x9b42('0x57')](_0x259b4f[_0x9b42('0x52')][_0x9b42('0x57')]));_0x5b0e7e[_0x9b42('0x56')]=_0x5b0e7e[_0x9b42('0x56')][_0x9b42('0x58')]?_0x5b0e7e['attributes']:_0x28d965[_0x9b42('0x46')];_0x5b0e7e['order']=qs['sort'](_0x259b4f[_0x9b42('0x52')][_0x9b42('0x5c')]);_0x5b0e7e[_0x9b42('0x5d')]=qs['filters'](_[_0x9b42('0x5e')](_0x259b4f[_0x9b42('0x52')],_0x28d965[_0x9b42('0x54')]));if(_0x259b4f[_0x9b42('0x52')]['filter']){_0x5b0e7e[_0x9b42('0x5d')]=_[_0x9b42('0x60')](_0x5b0e7e['where'],{'$or':_[_0x9b42('0x4d')](_0x5b0e7e[_0x9b42('0x56')],function(_0x9f2b28){var _0x23862d={};_0x23862d[_0x9f2b28]={'$like':'%'+_0x259b4f[_0x9b42('0x52')]['filter']+'%'};return _0x23862d;})});}_0x5b0e7e=_[_0x9b42('0x60')]({},_0x5b0e7e,_0x259b4f[_0x9b42('0x61')]);return _0x2220e3['getProactiveActions'](_0x5b0e7e);}})['then'](function(_0x2888ab){if(_0x2888ab){_0x2758ca=_0x2888ab[_0x9b42('0x58')];if(!_0x259b4f['query'][_0x9b42('0x59')]('nolimit')){_0x5b0e7e[_0x9b42('0x2a')]=qs[_0x9b42('0x2a')](_0x259b4f[_0x9b42('0x52')]['limit']);_0x5b0e7e[_0x9b42('0x28')]=qs[_0x9b42('0x28')](_0x259b4f['query'][_0x9b42('0x28')]);}return _0x2220e3[_0x9b42('0xfd')](_0x5b0e7e);}})[_0x9b42('0x30')](function(_0x5c0b27){if(_0x5c0b27){return _0x5c0b27?{'count':_0x2758ca,'rows':_0x5c0b27}:null;}})[_0x9b42('0x30')](respondWithResult(_0x1f931f,null))[_0x9b42('0x24')](handleError(_0x1f931f,null));};exports[_0x9b42('0x121')]=function(_0x59b0b7,_0x251c36){var _0x1deeed=_0x59b0b7[_0x9b42('0x52')][_0x9b42('0x122')]===_0x9b42('0x123')?_0x9b42('0x124'):_0x9b42('0x125');return db[_0x9b42('0x4e')]['find']({'attributes':['id',_0x1deeed],'where':{'id':_0x59b0b7[_0x9b42('0x65')]['id']}})['then'](handleEntityNotFound(_0x251c36,null))[_0x9b42('0x30')](function(_0x32a512){if(_0x32a512){var _0x5d820b=_0x32a512[_0x1deeed];var _0x1a3999=_0x5d820b&&_0x5d820b[_0x9b42('0x126')]?_0x5d820b['items']:[];_0x251c36[_0x9b42('0xd1')]({'fromKey':_[_0x9b42('0x8a')](_0x5d820b['fromKey'])?undefined:_0x5d820b[_0x9b42('0x127')],'count':_0x1a3999['length'],'rows':_0x1a3999});}})[_0x9b42('0x24')](handleError(_0x251c36,null));};exports[_0x9b42('0x128')]=function(_0x1f9bae,_0x490346){var _0x1f9d24={'raw':![],'where':{}};var _0x2d9f71={};var _0x59d52c={'count':0x0,'rows':[]};return db[_0x9b42('0x4e')]['findOne']({'where':{'id':_0x1f9bae[_0x9b42('0x65')]['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0x490346,null))[_0x9b42('0x30')](function(_0x54dcf4){if(_0x54dcf4){_0x2d9f71['model']=_[_0x9b42('0x53')](db['ChatOfflineMessage']['rawAttributes']);_0x2d9f71[_0x9b42('0x52')]=_[_0x9b42('0x53')](_0x1f9bae[_0x9b42('0x52')]);_0x2d9f71['filters']=_[_0x9b42('0x55')](_0x2d9f71[_0x9b42('0x46')],_0x2d9f71[_0x9b42('0x52')]);_0x1f9d24['attributes']=_[_0x9b42('0x55')](_0x2d9f71[_0x9b42('0x46')],qs[_0x9b42('0x57')](_0x1f9bae['query'][_0x9b42('0x57')]));_0x1f9d24['attributes']=_0x1f9d24[_0x9b42('0x56')][_0x9b42('0x58')]?_0x1f9d24[_0x9b42('0x56')]:_0x2d9f71[_0x9b42('0x46')];if(!_0x1f9bae[_0x9b42('0x52')][_0x9b42('0x59')](_0x9b42('0x5a'))){_0x1f9d24['limit']=qs['limit'](_0x1f9bae[_0x9b42('0x52')][_0x9b42('0x2a')]);_0x1f9d24['offset']=qs['offset'](_0x1f9bae[_0x9b42('0x52')][_0x9b42('0x28')]);}_0x1f9d24[_0x9b42('0x5b')]=qs[_0x9b42('0x5c')](_0x1f9bae[_0x9b42('0x52')][_0x9b42('0x5c')]);_0x1f9d24['where']=qs['filters'](_['pick'](_0x1f9bae[_0x9b42('0x52')],_0x2d9f71['filters']));_0x1f9d24[_0x9b42('0x5d')][_0x9b42('0x77')]=_0x54dcf4['id'];if(_0x1f9bae['query']['filter']){_0x1f9d24[_0x9b42('0x5d')]=_[_0x9b42('0x60')](_0x1f9d24[_0x9b42('0x5d')],{'$or':_[_0x9b42('0x4d')](_0x1f9d24[_0x9b42('0x56')],function(_0x11b787){var _0x3915be={};_0x3915be[_0x11b787]={'$like':'%'+_0x1f9bae['query'][_0x9b42('0x5f')]+'%'};return _0x3915be;})});}_0x1f9d24=_[_0x9b42('0x60')]({},_0x1f9d24,_0x1f9bae[_0x9b42('0x61')]);return db['ChatOfflineMessage'][_0x9b42('0x2b')]({'where':_0x1f9d24[_0x9b42('0x5d')]})[_0x9b42('0x30')](function(_0x3185cd){_0x59d52c[_0x9b42('0x2b')]=_0x3185cd;if(_0x1f9bae['query']['includeAll']){_0x1f9d24[_0x9b42('0x66')]=[{'all':!![]}];}else{_0x1f9d24[_0x9b42('0x66')]=[{'model':db['CmContact'],'as':_0x9b42('0x129'),'required':![]},{'model':db[_0x9b42('0x12a')],'as':_0x9b42('0x12b'),'required':![]}];}return db[_0x9b42('0xda')][_0x9b42('0x63')](_0x1f9d24);})[_0x9b42('0x30')](function(_0x5ebef1){_0x59d52c['rows']=_0x5ebef1;return _0x59d52c;});}})[_0x9b42('0x30')](respondWithFilteredResult(_0x490346,_0x1f9d24))[_0x9b42('0x24')](handleError(_0x490346,null));};exports['addAgents']=function(_0x569ecd,_0x4d9b8b){return db[_0x9b42('0x4e')]['find']({'where':{'id':_0x569ecd[_0x9b42('0x65')]['id']}})['then'](handleEntityNotFound(_0x4d9b8b,null))[_0x9b42('0x30')](function(_0x15d696){if(_0x15d696){return _0x15d696[_0x9b42('0x12c')](_0x569ecd[_0x9b42('0x6a')]['ids'],_[_0x9b42('0x12d')](_0x569ecd[_0x9b42('0x6a')],[_0x9b42('0x7c'),'id'])||{})['spread'](function(_0x4827aa){for(var _0x4ea0dc=0x0;_0x4ea0dc<_0x569ecd['body']['ids'][_0x9b42('0x58')];_0x4ea0dc+=0x1){socket['emit'](_0x9b42('0x12e'),{'UserId':Number(_0x569ecd[_0x9b42('0x6a')]['ids'][_0x4ea0dc]),'ChatWebsiteId':Number(_0x569ecd['params']['id'])});}return _0x4827aa;});}})[_0x9b42('0x30')](respondWithResult(_0x4d9b8b,null))[_0x9b42('0x24')](handleError(_0x4d9b8b,null));};exports['removeAgents']=function(_0x47bde1,_0x5d6d48){return db[_0x9b42('0x4e')][_0x9b42('0x67')]({'where':{'id':_0x47bde1[_0x9b42('0x65')]['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0x5d6d48,null))[_0x9b42('0x30')](function(_0x4c4031){if(_0x4c4031){return _0x4c4031[_0x9b42('0x12f')](_0x47bde1[_0x9b42('0x52')]['ids'])['then'](function(){if(_[_0x9b42('0x130')](_0x47bde1['query'][_0x9b42('0x7c')])){for(var _0x1def5f=0x0;_0x1def5f<_0x47bde1[_0x9b42('0x52')][_0x9b42('0x7c')]['length'];_0x1def5f+=0x1){socket['emit'](_0x9b42('0x131'),{'UserId':Number(_0x47bde1[_0x9b42('0x52')][_0x9b42('0x7c')][_0x1def5f]),'ChatWebsiteId':Number(_0x47bde1['params']['id'])});}}else{socket[_0x9b42('0x132')](_0x9b42('0x131'),{'UserId':Number(_0x47bde1[_0x9b42('0x52')][_0x9b42('0x7c')]),'ChatWebsiteId':Number(_0x47bde1['params']['id'])});}});}})[_0x9b42('0x30')](respondWithStatusCode(_0x5d6d48,null))[_0x9b42('0x24')](handleError(_0x5d6d48,null));};exports[_0x9b42('0x133')]=function(_0x167d48,_0xa4159d){var _0x1ea965={};var _0x25e394={};var _0x31ae89;var _0x1e7ca7;return db['ChatWebsite'][_0x9b42('0x79')]({'where':{'id':_0x167d48['params']['id']}})[_0x9b42('0x30')](handleEntityNotFound(_0xa4159d,null))['then'](function(_0x2a42ed){if(_0x2a42ed){_0x31ae89=_0x2a42ed;_0x25e394[_0x9b42('0x46')]=_[_0x9b42('0x53')](db[_0x9b42('0xbf')]['rawAttributes']);_0x25e394['query']=_[_0x9b42('0x53')](_0x167d48[_0x9b42('0x52')]);_0x25e394[_0x9b42('0x54')]=_[_0x9b42('0x55')](_0x25e394[_0x9b42('0x46')],_0x25e394[_0x9b42('0x52')]);_0x1ea965[_0x9b42('0x56')]=_[_0x9b42('0x55')](_0x25e394[_0x9b42('0x46')],qs[_0x9b42('0x57')](_0x167d48['query'][_0x9b42('0x57')]));_0x1ea965[_0x9b42('0x56')]=_0x1ea965[_0x9b42('0x56')]['length']?_0x1ea965[_0x9b42('0x56')]:_0x25e394[_0x9b42('0x46')];_0x1ea965[_0x9b42('0x5b')]=qs[_0x9b42('0x5c')](_0x167d48[_0x9b42('0x52')][_0x9b42('0x5c')]);_0x1ea965[_0x9b42('0x5d')]=qs[_0x9b42('0x54')](_[_0x9b42('0x5e')](_0x167d48[_0x9b42('0x52')],_0x25e394['filters']));if(_0x167d48[_0x9b42('0x52')][_0x9b42('0x5f')]){_0x1ea965[_0x9b42('0x5d')]=_[_0x9b42('0x60')](_0x1ea965[_0x9b42('0x5d')],{'$or':_[_0x9b42('0x4d')](_0x1ea965[_0x9b42('0x56')],function(_0x7c2c60){var _0x5caae6={};_0x5caae6[_0x7c2c60]={'$like':'%'+_0x167d48[_0x9b42('0x52')][_0x9b42('0x5f')]+'%'};return _0x5caae6;})});}_0x1ea965=_['merge']({},_0x1ea965,_0x167d48['options']);return _0x31ae89[_0x9b42('0x133')](_0x1ea965);}})[_0x9b42('0x30')](function(_0xbd060b){if(_0xbd060b){_0x1e7ca7=_0xbd060b[_0x9b42('0x58')];if(!_0x167d48['query'][_0x9b42('0x59')](_0x9b42('0x5a'))){_0x1ea965[_0x9b42('0x2a')]=qs[_0x9b42('0x2a')](_0x167d48['query'][_0x9b42('0x2a')]);_0x1ea965[_0x9b42('0x28')]=qs[_0x9b42('0x28')](_0x167d48[_0x9b42('0x52')][_0x9b42('0x28')]);}return _0x31ae89[_0x9b42('0x133')](_0x1ea965);}})['then'](function(_0x28bcd0){if(_0x28bcd0){return _0x28bcd0?{'count':_0x1e7ca7,'rows':_0x28bcd0}:null;}})[_0x9b42('0x30')](respondWithResult(_0xa4159d,null))['catch'](handleError(_0xa4159d,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index bc7dd65..ea91285 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 _0x85d8=['hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x1fc27e,_0x52402c){var _0x252a06=function(_0x53fa6f){while(--_0x53fa6f){_0x1fc27e['push'](_0x1fc27e['shift']());}};_0x252a06(++_0x52402c);}(_0x85d8,0x1b0));var _0x885d=function(_0x2471fe,_0x3f7322){_0x2471fe=_0x2471fe-0x0;var _0x43a604=_0x85d8[_0x2471fe];return _0x43a604;};'use strict';var EventEmitter=require(_0x885d('0x0'));var ChatWebsite=require(_0x885d('0x1'))['db'][_0x885d('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x885d('0x3')](0x0);var events={'afterCreate':_0x885d('0x4'),'afterUpdate':'update','afterDestroy':_0x885d('0x5')};function emitEvent(_0x212c26){return function(_0x320d7d,_0x3fe8a0,_0x50cb53){ChatWebsiteEvents['emit'](_0x212c26+':'+_0x320d7d['id'],_0x320d7d);ChatWebsiteEvents[_0x885d('0x6')](_0x212c26,_0x320d7d);_0x50cb53(null);};}for(var e in events){if(events[_0x885d('0x7')](e)){var event=events[e];ChatWebsite[_0x885d('0x8')](e,emitEvent(event));}}module[_0x885d('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xff96=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x51310f,_0x5a9dcf){var _0x24b7ae=function(_0x382f74){while(--_0x382f74){_0x51310f['push'](_0x51310f['shift']());}};_0x24b7ae(++_0x5a9dcf);}(_0xff96,0x179));var _0x6ff9=function(_0x5b474c,_0x426d87){_0x5b474c=_0x5b474c-0x0;var _0x273b2c=_0xff96[_0x5b474c];return _0x273b2c;};'use strict';var EventEmitter=require(_0x6ff9('0x0'));var ChatWebsite=require(_0x6ff9('0x1'))['db'][_0x6ff9('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x6ff9('0x3')](0x0);var events={'afterCreate':_0x6ff9('0x4'),'afterUpdate':_0x6ff9('0x5'),'afterDestroy':_0x6ff9('0x6')};function emitEvent(_0x1a81c5){return function(_0x3561d7,_0x207c06,_0x874737){ChatWebsiteEvents[_0x6ff9('0x7')](_0x1a81c5+':'+_0x3561d7['id'],_0x3561d7);ChatWebsiteEvents['emit'](_0x1a81c5,_0x3561d7);_0x874737(null);};}for(var e in events){if(events[_0x6ff9('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d5190c8..4fa09d3 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 _0xa48f=['ChatWebsite','chat_websites','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x58736a,_0x5d0121){var _0x4518e2=function(_0x2d9433){while(--_0x2d9433){_0x58736a['push'](_0x58736a['shift']());}};_0x4518e2(++_0x5d0121);}(_0xa48f,0x7a));var _0xfa48=function(_0x44e892,_0x12a6db){_0x44e892=_0x44e892-0x0;var _0x5d8324=_0xa48f[_0x44e892];return _0x5d8324;};'use strict';var _=require(_0xfa48('0x0'));var util=require(_0xfa48('0x1'));var logger=require(_0xfa48('0x2'))(_0xfa48('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfa48('0x4'));var fs=require('fs');var path=require(_0xfa48('0x5'));var rimraf=require(_0xfa48('0x6'));var config=require(_0xfa48('0x7'));var attributes=require(_0xfa48('0x8'));module[_0xfa48('0x9')]=function(_0x33bf73,_0x595a82){return _0x33bf73['define'](_0xfa48('0xa'),attributes,{'tableName':_0xfa48('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92a9=['ChatWebsite','chat_websites','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x50fe0f,_0x52b096){var _0x8e5d6c=function(_0xcb9ca){while(--_0xcb9ca){_0x50fe0f['push'](_0x50fe0f['shift']());}};_0x8e5d6c(++_0x52b096);}(_0x92a9,0x1f0));var _0x992a=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x92a9[_0x172747];return _0x509692;};'use strict';var _=require('lodash');var util=require(_0x992a('0x0'));var logger=require(_0x992a('0x1'))(_0x992a('0x2'));var moment=require(_0x992a('0x3'));var BPromise=require(_0x992a('0x4'));var rp=require(_0x992a('0x5'));var fs=require('fs');var path=require(_0x992a('0x6'));var rimraf=require(_0x992a('0x7'));var config=require(_0x992a('0x8'));var attributes=require('./chatWebsite.attributes');module[_0x992a('0x9')]=function(_0x5bcf05,_0x558ef2){return _0x5bcf05[_0x992a('0xa')](_0x992a('0xb'),attributes,{'tableName':_0x992a('0xc'),'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 01fb927..52820d7 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 _0x57a5=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s'];(function(_0x92a52c,_0x46a240){var _0x53491d=function(_0x197668){while(--_0x197668){_0x92a52c['push'](_0x92a52c['shift']());}};_0x53491d(++_0x46a240);}(_0x57a5,0xc1));var _0x557a=function(_0x39f28f,_0x352bf1){_0x39f28f=_0x39f28f-0x0;var _0x595e11=_0x57a5[_0x39f28f];return _0x595e11;};'use strict';var _=require(_0x557a('0x0'));var util=require(_0x557a('0x1'));var moment=require(_0x557a('0x2'));var BPromise=require(_0x557a('0x3'));var rs=require(_0x557a('0x4'));var fs=require('fs');var Redis=require(_0x557a('0x5'));var db=require(_0x557a('0x6'))['db'];var utils=require(_0x557a('0x7'));var logger=require('../../config/logger')(_0x557a('0x8'));var config=require(_0x557a('0x9'));var jayson=require(_0x557a('0xa'));var client=jayson['client'][_0x557a('0xb')]({'port':0x232a});config[_0x557a('0xc')]=_[_0x557a('0xd')](config[_0x557a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x557a('0xe'))(new Redis(config[_0x557a('0xc')]));require(_0x557a('0xf'))[_0x557a('0x10')](socket);function respondWithRpcPromise(_0x128530,_0x3da554,_0x5a4285){return new BPromise(function(_0x3300d4,_0x24021d){return client['request'](_0x128530,_0x5a4285)[_0x557a('0x11')](function(_0x403f49){logger[_0x557a('0x12')](_0x557a('0x13'),_0x3da554,_0x557a('0x14'));logger[_0x557a('0x15')](_0x557a('0x16'),_0x3da554,'request\x20sent',JSON['stringify'](_0x403f49));if(_0x403f49[_0x557a('0x17')]){if(_0x403f49['error'][_0x557a('0x18')]===0x1f4){logger[_0x557a('0x17')](_0x557a('0x13'),_0x3da554,_0x403f49[_0x557a('0x17')][_0x557a('0x19')]);return _0x24021d(_0x403f49[_0x557a('0x17')][_0x557a('0x19')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3da554,_0x403f49[_0x557a('0x17')][_0x557a('0x19')]);return _0x3300d4(_0x403f49[_0x557a('0x17')][_0x557a('0x19')]);}else{logger['info'](_0x557a('0x13'),_0x3da554,'request\x20sent');_0x3300d4(_0x403f49[_0x557a('0x1a')][_0x557a('0x19')]);}})['catch'](function(_0x59dd38){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3da554,_0x59dd38);_0x24021d(_0x59dd38);});});} \ No newline at end of file +var _0x28f1=['randomstring','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','request\x20sent','debug','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x182094,_0x269200){var _0x2e74ff=function(_0x41b982){while(--_0x41b982){_0x182094['push'](_0x182094['shift']());}};_0x2e74ff(++_0x269200);}(_0x28f1,0x8c));var _0x128f=function(_0x23bf0b,_0xf80021){_0x23bf0b=_0x23bf0b-0x0;var _0x1136ab=_0x28f1[_0x23bf0b];return _0x1136ab;};'use strict';var _=require(_0x128f('0x0'));var util=require(_0x128f('0x1'));var moment=require(_0x128f('0x2'));var BPromise=require(_0x128f('0x3'));var rs=require(_0x128f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x128f('0x5'));var jayson=require(_0x128f('0x6'));var client=jayson[_0x128f('0x7')]['http']({'port':0x232a});config[_0x128f('0x8')]=_[_0x128f('0x9')](config['redis'],{'host':_0x128f('0xa'),'port':0x18eb});var socket=require(_0x128f('0xb'))(new Redis(config[_0x128f('0x8')]));require(_0x128f('0xc'))[_0x128f('0xd')](socket);function respondWithRpcPromise(_0x5f0181,_0x3248e4,_0x353519){return new BPromise(function(_0x1ae6a2,_0x196fa2){return client[_0x128f('0xe')](_0x5f0181,_0x353519)['then'](function(_0x138b82){logger[_0x128f('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x3248e4,_0x128f('0x10'));logger[_0x128f('0x11')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x3248e4,'request\x20sent',JSON['stringify'](_0x138b82));if(_0x138b82[_0x128f('0x12')]){if(_0x138b82[_0x128f('0x12')][_0x128f('0x13')]===0x1f4){logger['error'](_0x128f('0x14'),_0x3248e4,_0x138b82[_0x128f('0x12')]['message']);return _0x196fa2(_0x138b82[_0x128f('0x12')][_0x128f('0x15')]);}logger[_0x128f('0x12')](_0x128f('0x14'),_0x3248e4,_0x138b82['error']['message']);return _0x1ae6a2(_0x138b82[_0x128f('0x12')][_0x128f('0x15')]);}else{logger[_0x128f('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x3248e4,_0x128f('0x10'));_0x1ae6a2(_0x138b82[_0x128f('0x16')]['message']);}})[_0x128f('0x17')](function(_0x2e5f5f){logger[_0x128f('0x12')](_0x128f('0x14'),_0x3248e4,_0x2e5f5f);_0x196fa2(_0x2e5f5f);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index bd23966..efe6152 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 _0xdac9=['update','emit','removeListener','register','length','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdac9,0x1a9));var _0x9dac=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0xdac9[_0x2605dc];return _0x4568c9;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x9dac('0x0'),'remove',_0x9dac('0x1')];function createListener(_0xd31622,_0x1b3027){return function(_0x4a75d8){_0x1b3027[_0x9dac('0x2')](_0xd31622,_0x4a75d8);};}function removeListener(_0x1a0e93,_0x74b2ac){return function(){ChatWebsiteEvents[_0x9dac('0x3')](_0x1a0e93,_0x74b2ac);};}exports[_0x9dac('0x4')]=function(_0x254dac){for(var _0x13e4e1=0x0,_0x3c1c56=events[_0x9dac('0x5')];_0x13e4e1<_0x3c1c56;_0x13e4e1++){var _0x9c3a50=events[_0x13e4e1];var _0x4a6218=createListener('chatWebsite:'+_0x9c3a50,_0x254dac);ChatWebsiteEvents['on'](_0x9c3a50,_0x4a6218);}}; \ No newline at end of file +var _0xa0ea=['update','emit','removeListener','register','save','remove'];(function(_0x213107,_0x2b3d1a){var _0x247584=function(_0x5d3fb2){while(--_0x5d3fb2){_0x213107['push'](_0x213107['shift']());}};_0x247584(++_0x2b3d1a);}(_0xa0ea,0x100));var _0xaa0e=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xa0ea[_0x725a4c];return _0x37b2cc;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xaa0e('0x0'),_0xaa0e('0x1'),_0xaa0e('0x2')];function createListener(_0x238ba5,_0x149fab){return function(_0x4b66f2){_0x149fab[_0xaa0e('0x3')](_0x238ba5,_0x4b66f2);};}function removeListener(_0xd81fc4,_0x1b67df){return function(){ChatWebsiteEvents[_0xaa0e('0x4')](_0xd81fc4,_0x1b67df);};}exports[_0xaa0e('0x5')]=function(_0x2f4f1a){for(var _0x4be6eb=0x0,_0x476a26=events['length'];_0x4be6eb<_0x476a26;_0x4be6eb++){var _0x2ec8c2=events[_0x4be6eb];var _0x51fdf9=createListener('chatWebsite:'+_0x2ec8c2,_0x2f4f1a);ChatWebsiteEvents['on'](_0x2ec8c2,_0x51fdf9);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 8f114a4..75b2e11 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7794=['replace','localhost','test','exports','escapeRegExp','url','URL'];(function(_0x566c77,_0x305564){var _0x165ade=function(_0x20417e){while(--_0x20417e){_0x566c77['push'](_0x566c77['shift']());}};_0x165ade(++_0x305564);}(_0x7794,0x7b));var _0x4779=function(_0x411ca8,_0x319708){_0x411ca8=_0x411ca8-0x0;var _0x1ef3fc=_0x7794[_0x411ca8];return _0x1ef3fc;};var escapeRegExp=require('../../../utils/misc')[_0x4779('0x0')];var URL=require(_0x4779('0x1'))[_0x4779('0x2')];function testWildcardValidity(_0xa47992){let _0x493318=!![];try{new URL(_0xa47992[_0x4779('0x3')]('*',_0x4779('0x4')));}catch(_0x4d3b05){_0x493318=![];}return _0x493318&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x4779('0x5')](_0xa47992);}function testWebsiteWithWildcard(_0x54dc7f,_0x59d1bf){let _0x53fd58;const _0x45cd71=escapeRegExp(_0x54dc7f)[_0x4779('0x3')]('\x5c*','([\x5cw]+)');try{new URL(_0x54dc7f[_0x4779('0x3')]('\x5c*',_0x4779('0x4')));_0x53fd58=new RegExp(_0x45cd71)[_0x4779('0x5')](_0x59d1bf);}catch(_0x20e2af){_0x53fd58=![];}return _0x53fd58;}module[_0x4779('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x593e=['replace','localhost','test','([\x5cw]+)','exports','../../../utils/misc','escapeRegExp','url','URL'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x593e,0xcb));var _0xe593=function(_0xfac42c,_0x193713){_0xfac42c=_0xfac42c-0x0;var _0x1e6340=_0x593e[_0xfac42c];return _0x1e6340;};var escapeRegExp=require(_0xe593('0x0'))[_0xe593('0x1')];var URL=require(_0xe593('0x2'))[_0xe593('0x3')];function testWildcardValidity(_0x43dabb){let _0x184a6b=!![];try{new URL(_0x43dabb[_0xe593('0x4')]('*',_0xe593('0x5')));}catch(_0x550574){_0x184a6b=![];}return _0x184a6b&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xe593('0x6')](_0x43dabb);}function testWebsiteWithWildcard(_0x2475f5,_0x404e3a){let _0x1e50d3;const _0x3b7082=escapeRegExp(_0x2475f5)[_0xe593('0x4')]('\x5c*',_0xe593('0x7'));try{new URL(_0x2475f5[_0xe593('0x4')]('\x5c*',_0xe593('0x5')));_0x1e50d3=new RegExp(_0x3b7082)[_0xe593('0x6')](_0x404e3a);}catch(_0x51b862){_0x1e50d3=![];}return _0x1e50d3;}module[_0xe593('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 18a7d48..bea3044 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 _0xc0c4=['ensureDir','replace','extname','any','/:id/interactions','addInteraction','/:id/proactive_actions','addProactiveActions','update','destroy','delete','removeDispositions','removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','create','post','/:id/dispositions','addDisposition','addAnswer','join','server/files/images/logos/','format','%s-%s','originalname','single','file','addLogo','diskStorage','root','server/files/images/avatars/','addAvatar','now','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc0c4,0x171));var _0x4c0c=function(_0x255c47,_0x33c250){_0x255c47=_0x255c47-0x0;var _0x21a7e9=_0xc0c4[_0x255c47];return _0x21a7e9;};'use strict';var multer=require(_0x4c0c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4c0c('0x1'));var express=require('express');var router=express[_0x4c0c('0x2')]();var fs_extra=require(_0x4c0c('0x3'));var auth=require(_0x4c0c('0x4'));var interaction=require(_0x4c0c('0x5'));var config=require('../../config/environment');var controller=require(_0x4c0c('0x6'));router[_0x4c0c('0x7')]('/',auth[_0x4c0c('0x8')](),controller[_0x4c0c('0x9')]);router[_0x4c0c('0x7')](_0x4c0c('0xa'),auth[_0x4c0c('0x8')](),controller[_0x4c0c('0xb')]);router[_0x4c0c('0x7')](_0x4c0c('0xc'),auth[_0x4c0c('0x8')](),controller[_0x4c0c('0xd')]);router[_0x4c0c('0x7')]('/:id/dispositions',auth[_0x4c0c('0x8')](),controller['getDispositions']);router[_0x4c0c('0x7')](_0x4c0c('0xe'),auth['isAuthenticated'](),controller[_0x4c0c('0xf')]);router[_0x4c0c('0x7')](_0x4c0c('0x10'),controller[_0x4c0c('0x11')]);router[_0x4c0c('0x7')](_0x4c0c('0x12'),controller['getAvatar']);router['get'](_0x4c0c('0x13'),controller[_0x4c0c('0x14')]);router[_0x4c0c('0x7')](_0x4c0c('0x15'),controller[_0x4c0c('0x16')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x4c0c('0x17')]);router['get'](_0x4c0c('0x18'),controller[_0x4c0c('0x19')]);router[_0x4c0c('0x7')](_0x4c0c('0x1a'),auth['isAuthenticated'](),controller[_0x4c0c('0x1b')]);router[_0x4c0c('0x7')]('/:id/proactive_actions',auth[_0x4c0c('0x8')](),controller[_0x4c0c('0x1c')]);router['get'](_0x4c0c('0x1d'),controller[_0x4c0c('0x1e')]);router[_0x4c0c('0x7')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x4c0c('0x1f')]);router[_0x4c0c('0x7')](_0x4c0c('0x20'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x4c0c('0x8')](),controller[_0x4c0c('0x21')]);router[_0x4c0c('0x22')](_0x4c0c('0x23'),auth[_0x4c0c('0x8')](),controller[_0x4c0c('0x24')]);router[_0x4c0c('0x22')](_0x4c0c('0xe'),auth[_0x4c0c('0x8')](),controller[_0x4c0c('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1dfea5,_0x438c59,_0x8eaba8){_0x8eaba8(null,path[_0x4c0c('0x26')](config['root'],_0x4c0c('0x27')));},'filename':function(_0x4259fc,_0x44fd86,_0x5c7d6a){_0x5c7d6a(null,util[_0x4c0c('0x28')](_0x4c0c('0x29'),Date['now'](),_0x44fd86[_0x4c0c('0x2a')]));}})});router[_0x4c0c('0x22')](_0x4c0c('0x10'),upload[_0x4c0c('0x2b')](_0x4c0c('0x2c')),controller[_0x4c0c('0x2d')]);var upload=multer({'storage':multer[_0x4c0c('0x2e')]({'destination':function(_0x46e5d5,_0x5cd999,_0x258c5d){_0x258c5d(null,path[_0x4c0c('0x26')](config[_0x4c0c('0x2f')],_0x4c0c('0x30')));},'filename':function(_0x1fe6c7,_0x182dfc,_0x3e6c55){_0x3e6c55(null,util[_0x4c0c('0x28')](_0x4c0c('0x29'),Date['now'](),_0x182dfc[_0x4c0c('0x2a')]));}})});router['post']('/:id/avatar',upload[_0x4c0c('0x2b')](_0x4c0c('0x2c')),controller[_0x4c0c('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x175c40,_0x456792,_0x2aa7c3){_0x2aa7c3(null,path[_0x4c0c('0x26')](config[_0x4c0c('0x2f')],_0x4c0c('0x30')));},'filename':function(_0x152d4e,_0x37047a,_0x574d52){_0x574d52(null,util[_0x4c0c('0x28')]('%s-%s',Date[_0x4c0c('0x32')](),_0x37047a['originalname']));}})});router[_0x4c0c('0x22')](_0x4c0c('0x13'),upload[_0x4c0c('0x2b')]('file'),controller[_0x4c0c('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x494849,_0x56e52c,_0x293eca){_0x293eca(null,path[_0x4c0c('0x26')](config[_0x4c0c('0x2f')],_0x4c0c('0x30')));},'filename':function(_0x2d4254,_0x3b73e4,_0x4a2ed0){_0x4a2ed0(null,util[_0x4c0c('0x28')](_0x4c0c('0x29'),Date[_0x4c0c('0x32')](),_0x3b73e4[_0x4c0c('0x2a')]));}})});router[_0x4c0c('0x22')](_0x4c0c('0x15'),upload[_0x4c0c('0x2b')](_0x4c0c('0x2c')),controller[_0x4c0c('0x34')]);router[_0x4c0c('0x22')](_0x4c0c('0x35'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x31bd8d,_0x4b9b1c,_0x22e40e){const _0x19a8b9=path['join'](config[_0x4c0c('0x2f')],_0x4c0c('0x36'),_0x4c0c('0x37'),_0x4c0c('0x38'));fs_extra[_0x4c0c('0x39')](_0x19a8b9,function(){_0x22e40e(null,_0x19a8b9);});},'filename':function(_0x399e42,_0x27d53c,_0x110f0d){const _0x21981e=_0x27d53c[_0x4c0c('0x2a')][_0x4c0c('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x675e11=path[_0x4c0c('0x3b')](_0x21981e);const _0x545e62=Date['now']()+'-'+_0x21981e[_0x4c0c('0x3a')](_0x675e11,'')+_0x675e11;_0x110f0d(null,_0x545e62);}})});router[_0x4c0c('0x22')]('/:id/offline',offlineUploadMulter[_0x4c0c('0x3c')](),controller['offline']);router[_0x4c0c('0x22')](_0x4c0c('0x3d'),auth[_0x4c0c('0x8')](),controller[_0x4c0c('0x3e')]);router[_0x4c0c('0x22')](_0x4c0c('0x1a'),auth[_0x4c0c('0x8')](),controller['addApplications']);router[_0x4c0c('0x22')](_0x4c0c('0x3f'),auth['isAuthenticated'](),controller[_0x4c0c('0x40')]);router['post'](_0x4c0c('0x20'),auth[_0x4c0c('0x8')](),controller['addAgents']);router['put'](_0x4c0c('0xc'),auth[_0x4c0c('0x8')](),controller[_0x4c0c('0x41')]);router['delete'](_0x4c0c('0xc'),auth[_0x4c0c('0x8')](),controller[_0x4c0c('0x42')]);router[_0x4c0c('0x43')](_0x4c0c('0x23'),auth[_0x4c0c('0x8')](),controller[_0x4c0c('0x44')]);router[_0x4c0c('0x43')]('/:id/canned_answers',auth[_0x4c0c('0x8')](),controller['removeAnswers']);router[_0x4c0c('0x43')]('/:id/users',auth['isAuthenticated'](),controller[_0x4c0c('0x45')]);module[_0x4c0c('0x46')]=router; \ No newline at end of file +var _0x99c8=['file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','/:id/notify','notify','offline-chat','ensureDir','replace','extname','any','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','isAuthenticated','get','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','create','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single'];(function(_0x393b9e,_0x2023b2){var _0x24540b=function(_0x103cc4){while(--_0x103cc4){_0x393b9e['push'](_0x393b9e['shift']());}};_0x24540b(++_0x2023b2);}(_0x99c8,0x179));var _0x899c=function(_0xf8ddf5,_0x5352e7){_0xf8ddf5=_0xf8ddf5-0x0;var _0x5a02d7=_0x99c8[_0xf8ddf5];return _0x5a02d7;};'use strict';var multer=require(_0x899c('0x0'));var util=require(_0x899c('0x1'));var path=require(_0x899c('0x2'));var timeout=require(_0x899c('0x3'));var express=require(_0x899c('0x4'));var router=express[_0x899c('0x5')]();var fs_extra=require(_0x899c('0x6'));var auth=require(_0x899c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x899c('0x8'));var controller=require(_0x899c('0x9'));router['get']('/',auth[_0x899c('0xa')](),controller['index']);router[_0x899c('0xb')](_0x899c('0xc'),auth[_0x899c('0xa')](),controller[_0x899c('0xd')]);router['get'](_0x899c('0xe'),auth[_0x899c('0xa')](),controller[_0x899c('0xf')]);router[_0x899c('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x899c('0x10')]);router[_0x899c('0xb')](_0x899c('0x11'),auth['isAuthenticated'](),controller[_0x899c('0x12')]);router[_0x899c('0xb')](_0x899c('0x13'),controller['getLogo']);router[_0x899c('0xb')]('/:id/avatar',controller[_0x899c('0x14')]);router[_0x899c('0xb')](_0x899c('0x15'),controller[_0x899c('0x16')]);router[_0x899c('0xb')](_0x899c('0x17'),controller['getSystemAvatar']);router[_0x899c('0xb')](_0x899c('0x18'),auth[_0x899c('0xa')](),controller[_0x899c('0x19')]);router[_0x899c('0xb')]('/:id/snippet',controller[_0x899c('0x1a')]);router[_0x899c('0xb')](_0x899c('0x1b'),auth['isAuthenticated'](),controller[_0x899c('0x1c')]);router['get'](_0x899c('0x1d'),auth[_0x899c('0xa')](),controller[_0x899c('0x1e')]);router['get'](_0x899c('0x1f'),controller[_0x899c('0x20')]);router['get'](_0x899c('0x21'),auth[_0x899c('0xa')](),controller['getOfflineMessages']);router[_0x899c('0xb')](_0x899c('0x22'),auth[_0x899c('0xa')](),controller[_0x899c('0x23')]);router['post']('/',auth[_0x899c('0xa')](),controller[_0x899c('0x24')]);router[_0x899c('0x25')]('/:id/dispositions',auth[_0x899c('0xa')](),controller[_0x899c('0x26')]);router[_0x899c('0x25')](_0x899c('0x11'),auth[_0x899c('0xa')](),controller[_0x899c('0x27')]);var upload=multer({'storage':multer[_0x899c('0x28')]({'destination':function(_0x4be7ac,_0x19d815,_0x961038){_0x961038(null,path[_0x899c('0x29')](config[_0x899c('0x2a')],_0x899c('0x2b')));},'filename':function(_0x1da85e,_0x211e5e,_0x2b9a38){_0x2b9a38(null,util[_0x899c('0x2c')](_0x899c('0x2d'),Date[_0x899c('0x2e')](),_0x211e5e[_0x899c('0x2f')]));}})});router[_0x899c('0x25')](_0x899c('0x13'),upload[_0x899c('0x30')](_0x899c('0x31')),controller[_0x899c('0x32')]);var upload=multer({'storage':multer[_0x899c('0x28')]({'destination':function(_0x20368f,_0x4ebe4e,_0x471679){_0x471679(null,path[_0x899c('0x29')](config['root'],_0x899c('0x33')));},'filename':function(_0x503a82,_0x2efa17,_0x30d7b3){_0x30d7b3(null,util['format'](_0x899c('0x2d'),Date[_0x899c('0x2e')](),_0x2efa17[_0x899c('0x2f')]));}})});router['post']('/:id/avatar',upload['single']('file'),controller[_0x899c('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52af1c,_0x3e2340,_0x2bebc3){_0x2bebc3(null,path[_0x899c('0x29')](config[_0x899c('0x2a')],_0x899c('0x33')));},'filename':function(_0x8b219f,_0x3b3e03,_0x1b9944){_0x1b9944(null,util['format'](_0x899c('0x2d'),Date[_0x899c('0x2e')](),_0x3b3e03[_0x899c('0x2f')]));}})});router['post'](_0x899c('0x15'),upload[_0x899c('0x30')](_0x899c('0x31')),controller[_0x899c('0x35')]);var upload=multer({'storage':multer[_0x899c('0x28')]({'destination':function(_0x34af6e,_0x57153c,_0x21dc25){_0x21dc25(null,path[_0x899c('0x29')](config[_0x899c('0x2a')],_0x899c('0x33')));},'filename':function(_0x3f5ba6,_0x45fa7d,_0x2cbfba){_0x2cbfba(null,util[_0x899c('0x2c')]('%s-%s',Date[_0x899c('0x2e')](),_0x45fa7d[_0x899c('0x2f')]));}})});router[_0x899c('0x25')](_0x899c('0x17'),upload['single'](_0x899c('0x31')),controller['addSystemAvatar']);router[_0x899c('0x25')](_0x899c('0x36'),controller[_0x899c('0x37')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0xfd5feb,_0x59dd6a,_0x389082){const _0x12ff0b=path[_0x899c('0x29')](config[_0x899c('0x2a')],'server/files','attachments',_0x899c('0x38'));fs_extra[_0x899c('0x39')](_0x12ff0b,function(){_0x389082(null,_0x12ff0b);});},'filename':function(_0x2a6eee,_0x3831ed,_0x4d5689){const _0x51f5cb=_0x3831ed[_0x899c('0x2f')][_0x899c('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5f2714=path[_0x899c('0x3b')](_0x51f5cb);const _0x2a6f83=Date[_0x899c('0x2e')]()+'-'+_0x51f5cb['replace'](_0x5f2714,'')+_0x5f2714;_0x4d5689(null,_0x2a6f83);}})});router['post']('/:id/offline',offlineUploadMulter[_0x899c('0x3c')](),controller['offline']);router['post'](_0x899c('0x18'),auth[_0x899c('0xa')](),controller[_0x899c('0x3d')]);router[_0x899c('0x25')](_0x899c('0x1b'),auth[_0x899c('0xa')](),controller[_0x899c('0x3e')]);router[_0x899c('0x25')]('/:id/proactive_actions',auth[_0x899c('0xa')](),controller[_0x899c('0x3f')]);router['post'](_0x899c('0x22'),auth[_0x899c('0xa')](),controller[_0x899c('0x40')]);router[_0x899c('0x41')](_0x899c('0xe'),auth['isAuthenticated'](),controller[_0x899c('0x42')]);router[_0x899c('0x43')]('/:id',auth[_0x899c('0xa')](),controller[_0x899c('0x44')]);router[_0x899c('0x43')]('/:id/dispositions',auth[_0x899c('0xa')](),controller['removeDispositions']);router[_0x899c('0x43')](_0x899c('0x11'),auth['isAuthenticated'](),controller[_0x899c('0x45')]);router[_0x899c('0x43')](_0x899c('0x22'),auth[_0x899c('0xa')](),controller[_0x899c('0x46')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 9f0f08c..6dbbf20 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc466=['app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','Router','env','production'];(function(_0xce48e5,_0x5e798b){var _0x1aa613=function(_0x5bd51a){while(--_0x5bd51a){_0xce48e5['push'](_0xce48e5['shift']());}};_0x1aa613(++_0x5e798b);}(_0xc466,0xbd));var _0x6c46=function(_0x90e312,_0x4deaf4){_0x90e312=_0x90e312-0x0;var _0xe11402=_0xc466[_0x90e312];return _0xe11402;};var beaverLogger=require(_0x6c46('0x0'));var express=require('express');var auth=require(_0x6c46('0x1'));var config=require(_0x6c46('0x2'));var router=express[_0x6c46('0x3')]();var isProduction=config[_0x6c46('0x4')]===_0x6c46('0x5')||![];function clientSideLogs(_0x17c2b6,_0x580520,_0x38d080){var _0x560b6e=_0x17c2b6[_0x6c46('0x6')][_0x6c46('0x7')](_0x6c46('0x8'));if(!_0x560b6e){throw new Error(_0x6c46('0x9'));}return beaverLogger[_0x6c46('0xa')]({'uri':_0x6c46('0xb'),'logger':_0x560b6e,'enableCors':!isProduction})(_0x17c2b6,_0x580520,_0x38d080);}router[_0x6c46('0xc')](auth[_0x6c46('0xd')](),clientSideLogs);module[_0x6c46('0xe')]=router; \ No newline at end of file +var _0xe315=['use','exports','beaver-logger/server','express','Router','production','app','get','Client-Side\x20logger\x20not\x20found!','/client-logs'];(function(_0x230a30,_0x386c72){var _0xc80173=function(_0x9cfa65){while(--_0x9cfa65){_0x230a30['push'](_0x230a30['shift']());}};_0xc80173(++_0x386c72);}(_0xe315,0x110));var _0x5e31=function(_0x51e011,_0x5abb6e){_0x51e011=_0x51e011-0x0;var _0x5d9aa3=_0xe315[_0x51e011];return _0x5d9aa3;};var beaverLogger=require(_0x5e31('0x0'));var express=require(_0x5e31('0x1'));var auth=require('../components/auth/service');var config=require('../config/environment');var router=express[_0x5e31('0x2')]();var isProduction=config['env']===_0x5e31('0x3')||![];function clientSideLogs(_0xa809a7,_0x3ccc0f,_0x395871){var _0x90cd50=_0xa809a7[_0x5e31('0x4')][_0x5e31('0x5')]('client-side-logger');if(!_0x90cd50){throw new Error(_0x5e31('0x6'));}return beaverLogger['expressEndpoint']({'uri':_0x5e31('0x7'),'logger':_0x90cd50,'enableCors':!isProduction})(_0xa809a7,_0x3ccc0f,_0x395871);}router[_0x5e31('0x8')](auth['isAuthenticated'](),clientSideLogs);module[_0x5e31('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index f7b2c84..232ad9e 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 _0x2567=['MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','ENUM','AmazonAWS','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2567,0x163));var _0x7256=function(_0x43028e,_0x33a648){_0x43028e=_0x43028e-0x0;var _0x2fed6d=_0x2567[_0x43028e];return _0x2fed6d;};'use strict';var Sequelize=require(_0x7256('0x0'));module[_0x7256('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7256('0x2')](_0x7256('0x3'),'Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x7256('0x2')](_0x7256('0x4'),_0x7256('0x5'))},'data1':{'type':Sequelize[_0x7256('0x6')],'comment':_0x7256('0x7')},'data2':{'type':Sequelize[_0x7256('0x6')],'comment':_0x7256('0x8')},'data3':{'type':Sequelize[_0x7256('0x6')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize['STRING'],'comment':_0x7256('0x9')},'data5':{'type':Sequelize[_0x7256('0xa')],'comment':_0x7256('0xb')},'data6':{'type':Sequelize[_0x7256('0xa')],'comment':_0x7256('0xc')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x71ee=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','STRING'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x71ee,0x13b));var _0xe71e=function(_0x575e6d,_0x1e19ac){_0x575e6d=_0x575e6d-0x0;var _0x5d4dfd=_0x71ee[_0x575e6d];return _0x5d4dfd;};'use strict';var Sequelize=require(_0xe71e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe71e('0x1')](_0xe71e('0x2'),_0xe71e('0x3'),_0xe71e('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xe71e('0x1')]('Outlook365',_0xe71e('0x5'))},'data1':{'type':Sequelize[_0xe71e('0x6')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xe71e('0x6')],'comment':_0xe71e('0x7')},'data3':{'type':Sequelize[_0xe71e('0x6')],'comment':_0xe71e('0x8')},'data4':{'type':Sequelize['STRING'],'comment':_0xe71e('0x9')},'data5':{'type':Sequelize[_0xe71e('0xa')],'comment':_0xe71e('0xb')},'data6':{'type':Sequelize[_0xe71e('0xa')],'comment':_0xe71e('0xc')},'data7':{'type':Sequelize[_0xe71e('0xa')],'comment':_0xe71e('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index a93ef5e..fc196ff 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 _0xb6f6=['localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','then','destroy','stack','name','send','padEnd','slice','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','CloudProvider','options','find','create','body','Service\x20parameter\x20not\x20specified','values','includes','join','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','state','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','code','data5','access_token','data6','refresh_token','update','microsoftAuthorization:success','emit','microsoftAuthorization:error','error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults'];(function(_0x415158,_0x4841d5){var _0xa677f0=function(_0x5b1a73){while(--_0x5b1a73){_0x415158['push'](_0x415158['shift']());}};_0xa677f0(++_0x4841d5);}(_0xb6f6,0x10d));var _0x6b6f=function(_0x5e4d93,_0x218315){_0x5e4d93=_0x5e4d93-0x0;var _0x1e3cac=_0xb6f6[_0x5e4d93];return _0x1e3cac;};'use strict';var _=require(_0x6b6f('0x0'));var Redis=require(_0x6b6f('0x1'));var qs=require(_0x6b6f('0x2'));var encryptor=require('../../components/encryptor');var config=require(_0x6b6f('0x3'));var logger=require(_0x6b6f('0x4'))(_0x6b6f('0x5'));var db=require(_0x6b6f('0x6'))['db'];var oauth=require(_0x6b6f('0x7'));config[_0x6b6f('0x8')]=_[_0x6b6f('0x9')](config[_0x6b6f('0x8')],{'host':_0x6b6f('0xa'),'port':0x18eb});var socket=require(_0x6b6f('0xb'))(new Redis(config['redis']));var redis=new Redis(config[_0x6b6f('0x8')]);function respondWithStatusCode(_0x35625e,_0xf2417a){_0xf2417a=_0xf2417a||0xcc;return function(_0x3c8269){if(_0x3c8269){return _0x35625e[_0x6b6f('0xc')](_0xf2417a);}return _0x35625e['status'](_0xf2417a)[_0x6b6f('0xd')]();};}function respondWithResult(_0x31e0ac,_0x3d1f37){_0x3d1f37=_0x3d1f37||0xc8;return function(_0x482b21){if(_0x482b21){return _0x31e0ac[_0x6b6f('0xe')](_0x3d1f37)[_0x6b6f('0xf')](_0x482b21);}};}function respondWithFilteredResult(_0x5b0597,_0x4a06d6){return function(_0x2414d4){if(_0x2414d4){var _0x385e5f=typeof _0x4a06d6[_0x6b6f('0x10')]===_0x6b6f('0x11')&&typeof _0x4a06d6[_0x6b6f('0x12')]===_0x6b6f('0x11');var _0x440509=_0x2414d4[_0x6b6f('0x13')];var _0x4c274a=_0x385e5f?0x0:_0x4a06d6['offset'];var _0x1a5d1c=_0x385e5f?_0x2414d4['count']:_0x4a06d6[_0x6b6f('0x10')]+_0x4a06d6[_0x6b6f('0x12')];var _0x895f65;if(_0x1a5d1c>=_0x440509){_0x1a5d1c=_0x440509;_0x895f65=0xc8;}else{_0x895f65=0xce;}_0x5b0597[_0x6b6f('0xe')](_0x895f65);return _0x5b0597[_0x6b6f('0x14')]('Content-Range',_0x4c274a+'-'+_0x1a5d1c+'/'+_0x440509)[_0x6b6f('0xf')](_0x2414d4);}return null;};}function saveUpdates(_0x689945){return function(_0x122da4){if(_0x122da4){return _0x122da4['update'](_0x689945)[_0x6b6f('0x15')](function(_0x44c125){return _0x44c125;});}return null;};}function removeEntity(_0x469779){return function(_0x1bb3c5){if(_0x1bb3c5){return _0x1bb3c5[_0x6b6f('0x16')]()[_0x6b6f('0x15')](function(){_0x469779[_0x6b6f('0xe')](0xcc)[_0x6b6f('0xd')]();});}};}function handleEntityNotFound(_0x5bf608){return function(_0x6e8359){if(!_0x6e8359){_0x5bf608['sendStatus'](0x194);}return _0x6e8359;};}function handleError(_0xb74391,_0x306f3e){_0x306f3e=_0x306f3e||0x1f4;return function(_0x1a5b74){logger['error'](_0x1a5b74[_0x6b6f('0x17')]);if(_0x1a5b74['name']){delete _0x1a5b74[_0x6b6f('0x18')];}_0xb74391['status'](_0x306f3e)[_0x6b6f('0x19')](_0x1a5b74);};}function maskClientSecret(_0x2e8703){return _[_0x6b6f('0x1a')](_0x2e8703[_0x6b6f('0x1b')](0x0,0x3),0x14,'*');}exports['index']=function(_0x57dbf7,_0x5b2df1){var _0x535452={},_0x4ee862={},_0x18f19f={'count':0x0,'rows':[]};var _0x40e586=_[_0x6b6f('0x1c')](db['CloudProvider'][_0x6b6f('0x1d')],function(_0x313d37){return{'name':_0x313d37[_0x6b6f('0x1e')],'type':_0x313d37[_0x6b6f('0x1f')][_0x6b6f('0x20')]};});_0x4ee862[_0x6b6f('0x21')]=_[_0x6b6f('0x1c')](_0x40e586,_0x6b6f('0x18'));_0x4ee862['query']=_['keys'](_0x57dbf7[_0x6b6f('0x22')]);_0x4ee862[_0x6b6f('0x23')]=_[_0x6b6f('0x24')](_0x4ee862[_0x6b6f('0x21')],_0x4ee862[_0x6b6f('0x22')]);_0x535452[_0x6b6f('0x25')]=_[_0x6b6f('0x24')](_0x4ee862[_0x6b6f('0x21')],qs[_0x6b6f('0x26')](_0x57dbf7['query'][_0x6b6f('0x26')]));_0x535452[_0x6b6f('0x25')]=_0x535452['attributes'][_0x6b6f('0x27')]?_0x535452['attributes']:_0x4ee862[_0x6b6f('0x21')];if(!_0x57dbf7['query'][_0x6b6f('0x28')](_0x6b6f('0x29'))){_0x535452[_0x6b6f('0x12')]=qs[_0x6b6f('0x12')](_0x57dbf7[_0x6b6f('0x22')][_0x6b6f('0x12')]);_0x535452[_0x6b6f('0x10')]=qs[_0x6b6f('0x10')](_0x57dbf7[_0x6b6f('0x22')][_0x6b6f('0x10')]);}_0x535452['order']=qs[_0x6b6f('0x2a')](_0x57dbf7[_0x6b6f('0x22')][_0x6b6f('0x2a')]);_0x535452[_0x6b6f('0x2b')]=qs[_0x6b6f('0x23')](_['pick'](_0x57dbf7[_0x6b6f('0x22')],_0x4ee862[_0x6b6f('0x23')]),_0x40e586);if(_0x57dbf7[_0x6b6f('0x22')][_0x6b6f('0x2c')]){_0x535452[_0x6b6f('0x2b')]=_[_0x6b6f('0x2d')](_0x535452[_0x6b6f('0x2b')],{'$or':_[_0x6b6f('0x1c')](_0x40e586,function(_0x1bf470){if(_0x1bf470[_0x6b6f('0x1f')]!==_0x6b6f('0x2e')){var _0x10d11c={};_0x10d11c[_0x1bf470[_0x6b6f('0x18')]]={'$like':'%'+_0x57dbf7[_0x6b6f('0x22')][_0x6b6f('0x2c')]+'%'};return _0x10d11c;}})});}_0x535452=_['merge']({},_0x535452,_0x57dbf7['options']);var _0x29075e={'where':_0x535452[_0x6b6f('0x2b')]};return db['CloudProvider'][_0x6b6f('0x13')](_0x29075e)[_0x6b6f('0x15')](function(_0x44e28b){_0x18f19f[_0x6b6f('0x13')]=_0x44e28b;if(_0x57dbf7[_0x6b6f('0x22')][_0x6b6f('0x2f')]){_0x535452[_0x6b6f('0x30')]=[{'all':!![]}];}return db['CloudProvider'][_0x6b6f('0x31')](_0x535452);})[_0x6b6f('0x15')](function(_0x244016){_0x18f19f[_0x6b6f('0x32')]=_[_0x6b6f('0x1c')](_0x244016,function(_0xbc106f){if(_0xbc106f[_0x6b6f('0x33')]===_0x6b6f('0x34')){var _0x4a7a68=encryptor[_0x6b6f('0x35')](_0xbc106f[_0x6b6f('0x36')]);_0xbc106f[_0x6b6f('0x36')]=maskClientSecret(_0x4a7a68);}return _0xbc106f;});return _0x18f19f;})[_0x6b6f('0x15')](respondWithFilteredResult(_0x5b2df1,_0x535452))[_0x6b6f('0x37')](handleError(_0x5b2df1,null));};exports[_0x6b6f('0x38')]=function(_0x354813,_0x2223a1){var _0x369f9b={'raw':!![],'where':{'id':_0x354813[_0x6b6f('0x39')]['id']}},_0x4fbfcb={};_0x4fbfcb[_0x6b6f('0x21')]=_[_0x6b6f('0x3a')](db[_0x6b6f('0x3b')][_0x6b6f('0x1d')]);_0x4fbfcb[_0x6b6f('0x22')]=_['keys'](_0x354813[_0x6b6f('0x22')]);_0x4fbfcb[_0x6b6f('0x23')]=_[_0x6b6f('0x24')](_0x4fbfcb[_0x6b6f('0x21')],_0x4fbfcb[_0x6b6f('0x22')]);_0x369f9b[_0x6b6f('0x25')]=_[_0x6b6f('0x24')](_0x4fbfcb['model'],qs[_0x6b6f('0x26')](_0x354813[_0x6b6f('0x22')]['fields']));_0x369f9b[_0x6b6f('0x25')]=_0x369f9b[_0x6b6f('0x25')][_0x6b6f('0x27')]?_0x369f9b[_0x6b6f('0x25')]:_0x4fbfcb[_0x6b6f('0x21')];if(_0x354813['query']['includeAll']){_0x369f9b[_0x6b6f('0x30')]=[{'all':!![]}];}_0x369f9b=_[_0x6b6f('0x2d')]({},_0x369f9b,_0x354813[_0x6b6f('0x3c')]);return db[_0x6b6f('0x3b')][_0x6b6f('0x3d')](_0x369f9b)[_0x6b6f('0x15')](handleEntityNotFound(_0x2223a1,null))['then'](function(_0x5dec95){if(_0x5dec95['service']===_0x6b6f('0x34')){var _0x331119=encryptor[_0x6b6f('0x35')](_0x5dec95[_0x6b6f('0x36')]);_0x5dec95[_0x6b6f('0x36')]=maskClientSecret(_0x331119);}return _0x5dec95;})[_0x6b6f('0x15')](respondWithResult(_0x2223a1,null))['catch'](handleError(_0x2223a1,null));};exports[_0x6b6f('0x3e')]=function(_0x1e5859,_0x43fa3d){if(!_0x1e5859[_0x6b6f('0x3f')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x1e5859[_0x6b6f('0x3f')][_0x6b6f('0x33')])throw new Error(_0x6b6f('0x40'));var _0x1ba624=db['CloudProvider'][_0x6b6f('0x1d')][_0x6b6f('0x33')][_0x6b6f('0x41')];if(!_0x1ba624[_0x6b6f('0x42')](_0x1e5859[_0x6b6f('0x3f')][_0x6b6f('0x33')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x1ba624[_0x6b6f('0x43')](',\x20'));if(_0x1e5859[_0x6b6f('0x3f')][_0x6b6f('0x33')]===_0x6b6f('0x34')&&_0x1e5859[_0x6b6f('0x3f')]['data3']){_0x1e5859['body']['data3']=encryptor[_0x6b6f('0x44')](_0x1e5859[_0x6b6f('0x3f')][_0x6b6f('0x36')]);}return db[_0x6b6f('0x3b')]['create'](_0x1e5859['body'],{})['then'](respondWithResult(_0x43fa3d,0xc9))[_0x6b6f('0x37')](handleError(_0x43fa3d,null));};exports['update']=function(_0x349ad8,_0x5cab8e){if(_0x349ad8[_0x6b6f('0x3f')]['id']){delete _0x349ad8[_0x6b6f('0x3f')]['id'];}return db[_0x6b6f('0x3b')][_0x6b6f('0x3d')]({'where':{'id':_0x349ad8[_0x6b6f('0x39')]['id']}})[_0x6b6f('0x15')](handleEntityNotFound(_0x5cab8e,null))[_0x6b6f('0x15')](function(_0x1ca870){if(_0x1ca870['service']===_0x6b6f('0x34')&&_0x349ad8[_0x6b6f('0x3f')][_0x6b6f('0x36')]){_0x349ad8[_0x6b6f('0x3f')][_0x6b6f('0x36')]=encryptor['encryptString'](_0x349ad8[_0x6b6f('0x3f')][_0x6b6f('0x36')]);}return _0x1ca870;})[_0x6b6f('0x15')](saveUpdates(_0x349ad8['body'],null))[_0x6b6f('0x15')](respondWithResult(_0x5cab8e,null))[_0x6b6f('0x37')](handleError(_0x5cab8e,null));};exports[_0x6b6f('0x16')]=function(_0x5bbccb,_0x4025c1){return db[_0x6b6f('0x3b')]['find']({'where':{'id':_0x5bbccb[_0x6b6f('0x39')]['id']}})[_0x6b6f('0x15')](handleEntityNotFound(_0x4025c1,null))[_0x6b6f('0x15')](removeEntity(_0x4025c1,null))['catch'](handleError(_0x4025c1,null));};exports[_0x6b6f('0x45')]=function(_0x2c0920,_0x41faff){return db['CloudProvider']['findOne']({'where':{'id':_0x2c0920[_0x6b6f('0x39')]['id']},'raw':!![]})[_0x6b6f('0x15')](function(_0x1383fb){if(!_0x1383fb)return _0x41faff[_0x6b6f('0xc')](0x194);return{'url':oauth[_0x6b6f('0x46')](_0x1383fb,_0x2c0920[_0x6b6f('0x47')]['id'])};})[_0x6b6f('0x15')](respondWithResult(_0x41faff,null))[_0x6b6f('0x37')](handleError(_0x41faff,null));};exports['oauth2MicrosoftCallback']=function(_0x25cf49,_0x3816e){var _0x1fac3a=_0x25cf49[_0x6b6f('0x3f')];var _0x20544b;var _0x9b055f;if(_0x1fac3a['error'])throw _0x1fac3a;redis['get'](_0x1fac3a[_0x6b6f('0x48')])[_0x6b6f('0x15')](function(_0x4e91ef){if(!_0x4e91ef)throw new Error('Invalid\x20state\x20parameter');_0x20544b=JSON['parse'](_0x4e91ef);var _0x253eba=Buffer['from'](_0x1fac3a['state'],_0x6b6f('0x49'))[_0x6b6f('0x4a')](_0x6b6f('0x4b'));_0x9b055f=JSON['parse'](_0x253eba);if(!oauth[_0x6b6f('0x4c')](_0x1fac3a[_0x6b6f('0x4d')],_0x20544b[_0x6b6f('0x4e')]))throw new Error(_0x6b6f('0x4f'));redis['del'](_0x1fac3a[_0x6b6f('0x48')]);return oauth['getOauth2MicrosoftAccessToken'](_0x1fac3a[_0x6b6f('0x50')],_0x20544b);})[_0x6b6f('0x15')](function(_0xecea44){_0x20544b[_0x6b6f('0x51')]=_0xecea44[_0x6b6f('0x52')];_0x20544b[_0x6b6f('0x53')]=_0xecea44[_0x6b6f('0x54')];return db[_0x6b6f('0x3b')][_0x6b6f('0x55')]({'data5':_0x20544b[_0x6b6f('0x51')],'data6':_0x20544b['data6']},{'where':{'id':_0x20544b['id']}});})[_0x6b6f('0x15')](function(){oauth['startRefreshInterval'](_0x20544b);socket['emit'](_0x6b6f('0x56'),{'id':_0x9b055f['id']});return;})[_0x6b6f('0x15')](respondWithStatusCode(_0x3816e,null))[_0x6b6f('0x37')](function(_0x5f5640){if(_0x9b055f){socket[_0x6b6f('0x57')](_0x6b6f('0x58'),{'id':_0x9b055f['id']});}if(!_0x20544b){logger[_0x6b6f('0x59')](_0x6b6f('0x5a'),_0x5f5640);return _0x3816e['status'](0x1f4)[_0x6b6f('0x19')](_0x5f5640[_0x6b6f('0x5b')]);}logger[_0x6b6f('0x59')](_0x6b6f('0x5c'),_0x20544b['id'],JSON['stringify'](_0x5f5640));});}; \ No newline at end of file +var _0xa86f=['redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','offset','limit','set','update','then','error','stack','name','send','map','CloudProvider','rawAttributes','model','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','params','keys','length','find','catch','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','join','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','oauth2MicrosoftCallback','get','state','parse','from','base64','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth'];(function(_0xa43518,_0x2a4c6b){var _0x5e9b94=function(_0x3d3c7f){while(--_0x3d3c7f){_0xa43518['push'](_0xa43518['shift']());}};_0x5e9b94(++_0x2a4c6b);}(_0xa86f,0xfc));var _0xfa86=function(_0x134287,_0x5a67d6){_0x134287=_0x134287-0x0;var _0x3097d0=_0xa86f[_0x134287];return _0x3097d0;};'use strict';var _=require(_0xfa86('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0xfa86('0x1'));var config=require(_0xfa86('0x2'));var logger=require('../../config/logger')(_0xfa86('0x3'));var db=require(_0xfa86('0x4'))['db'];var oauth=require(_0xfa86('0x5'));config[_0xfa86('0x6')]=_[_0xfa86('0x7')](config[_0xfa86('0x6')],{'host':_0xfa86('0x8'),'port':0x18eb});var socket=require(_0xfa86('0x9'))(new Redis(config[_0xfa86('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x1691b2,_0x1cbc70){_0x1cbc70=_0x1cbc70||0xcc;return function(_0x7606c3){if(_0x7606c3){return _0x1691b2[_0xfa86('0xa')](_0x1cbc70);}return _0x1691b2[_0xfa86('0xb')](_0x1cbc70)[_0xfa86('0xc')]();};}function respondWithResult(_0x29a607,_0x118936){_0x118936=_0x118936||0xc8;return function(_0x389f51){if(_0x389f51){return _0x29a607['status'](_0x118936)[_0xfa86('0xd')](_0x389f51);}};}function respondWithFilteredResult(_0x1c16f4,_0x764861){return function(_0x3bd00e){if(_0x3bd00e){var _0x104561=typeof _0x764861['offset']===_0xfa86('0xe')&&typeof _0x764861['limit']===_0xfa86('0xe');var _0xe4d1b4=_0x3bd00e['count'];var _0x27becd=_0x104561?0x0:_0x764861[_0xfa86('0xf')];var _0x5013dc=_0x104561?_0x3bd00e['count']:_0x764861[_0xfa86('0xf')]+_0x764861[_0xfa86('0x10')];var _0x5ec8ce;if(_0x5013dc>=_0xe4d1b4){_0x5013dc=_0xe4d1b4;_0x5ec8ce=0xc8;}else{_0x5ec8ce=0xce;}_0x1c16f4[_0xfa86('0xb')](_0x5ec8ce);return _0x1c16f4[_0xfa86('0x11')]('Content-Range',_0x27becd+'-'+_0x5013dc+'/'+_0xe4d1b4)[_0xfa86('0xd')](_0x3bd00e);}return null;};}function saveUpdates(_0x32d38b){return function(_0x4ced7e){if(_0x4ced7e){return _0x4ced7e[_0xfa86('0x12')](_0x32d38b)[_0xfa86('0x13')](function(_0x38e533){return _0x38e533;});}return null;};}function removeEntity(_0x2d832e){return function(_0x547350){if(_0x547350){return _0x547350['destroy']()[_0xfa86('0x13')](function(){_0x2d832e[_0xfa86('0xb')](0xcc)[_0xfa86('0xc')]();});}};}function handleEntityNotFound(_0x3e2cab){return function(_0x4e92d9){if(!_0x4e92d9){_0x3e2cab[_0xfa86('0xa')](0x194);}return _0x4e92d9;};}function handleError(_0x1c97b7,_0x132217){_0x132217=_0x132217||0x1f4;return function(_0x4550bb){logger[_0xfa86('0x14')](_0x4550bb[_0xfa86('0x15')]);if(_0x4550bb[_0xfa86('0x16')]){delete _0x4550bb['name'];}_0x1c97b7[_0xfa86('0xb')](_0x132217)[_0xfa86('0x17')](_0x4550bb);};}function maskClientSecret(_0x3ecfdf){return _['padEnd'](_0x3ecfdf['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x1869ce,_0x2bfb64){var _0x53926b={},_0x249b8e={},_0x3193b4={'count':0x0,'rows':[]};var _0x415383=_[_0xfa86('0x18')](db[_0xfa86('0x19')][_0xfa86('0x1a')],function(_0xd5495d){return{'name':_0xd5495d['fieldName'],'type':_0xd5495d['type']['key']};});_0x249b8e[_0xfa86('0x1b')]=_[_0xfa86('0x18')](_0x415383,_0xfa86('0x16'));_0x249b8e['query']=_['keys'](_0x1869ce[_0xfa86('0x1c')]);_0x249b8e['filters']=_[_0xfa86('0x1d')](_0x249b8e[_0xfa86('0x1b')],_0x249b8e['query']);_0x53926b[_0xfa86('0x1e')]=_[_0xfa86('0x1d')](_0x249b8e['model'],qs[_0xfa86('0x1f')](_0x1869ce[_0xfa86('0x1c')][_0xfa86('0x1f')]));_0x53926b[_0xfa86('0x1e')]=_0x53926b[_0xfa86('0x1e')]['length']?_0x53926b[_0xfa86('0x1e')]:_0x249b8e[_0xfa86('0x1b')];if(!_0x1869ce[_0xfa86('0x1c')][_0xfa86('0x20')]('nolimit')){_0x53926b['limit']=qs[_0xfa86('0x10')](_0x1869ce[_0xfa86('0x1c')][_0xfa86('0x10')]);_0x53926b[_0xfa86('0xf')]=qs['offset'](_0x1869ce['query'][_0xfa86('0xf')]);}_0x53926b['order']=qs[_0xfa86('0x21')](_0x1869ce[_0xfa86('0x1c')][_0xfa86('0x21')]);_0x53926b[_0xfa86('0x22')]=qs[_0xfa86('0x23')](_['pick'](_0x1869ce[_0xfa86('0x1c')],_0x249b8e[_0xfa86('0x23')]),_0x415383);if(_0x1869ce[_0xfa86('0x1c')][_0xfa86('0x24')]){_0x53926b['where']=_['merge'](_0x53926b[_0xfa86('0x22')],{'$or':_[_0xfa86('0x18')](_0x415383,function(_0x23b74f){if(_0x23b74f[_0xfa86('0x25')]!==_0xfa86('0x26')){var _0x4242fa={};_0x4242fa[_0x23b74f[_0xfa86('0x16')]]={'$like':'%'+_0x1869ce[_0xfa86('0x1c')][_0xfa86('0x24')]+'%'};return _0x4242fa;}})});}_0x53926b=_[_0xfa86('0x27')]({},_0x53926b,_0x1869ce[_0xfa86('0x28')]);var _0x1f74d1={'where':_0x53926b[_0xfa86('0x22')]};return db[_0xfa86('0x19')][_0xfa86('0x29')](_0x1f74d1)[_0xfa86('0x13')](function(_0x1189d7){_0x3193b4[_0xfa86('0x29')]=_0x1189d7;if(_0x1869ce['query'][_0xfa86('0x2a')]){_0x53926b[_0xfa86('0x2b')]=[{'all':!![]}];}return db['CloudProvider'][_0xfa86('0x2c')](_0x53926b);})[_0xfa86('0x13')](function(_0x285818){_0x3193b4[_0xfa86('0x2d')]=_[_0xfa86('0x18')](_0x285818,function(_0x36f969){if(_0x36f969[_0xfa86('0x2e')]===_0xfa86('0x2f')){var _0x33523d=encryptor[_0xfa86('0x30')](_0x36f969['data3']);_0x36f969[_0xfa86('0x31')]=maskClientSecret(_0x33523d);}return _0x36f969;});return _0x3193b4;})[_0xfa86('0x13')](respondWithFilteredResult(_0x2bfb64,_0x53926b))['catch'](handleError(_0x2bfb64,null));};exports['show']=function(_0x21f385,_0x87ce45){var _0x1eca1b={'raw':!![],'where':{'id':_0x21f385[_0xfa86('0x32')]['id']}},_0x43fe38={};_0x43fe38['model']=_[_0xfa86('0x33')](db[_0xfa86('0x19')]['rawAttributes']);_0x43fe38[_0xfa86('0x1c')]=_[_0xfa86('0x33')](_0x21f385[_0xfa86('0x1c')]);_0x43fe38['filters']=_['intersection'](_0x43fe38['model'],_0x43fe38[_0xfa86('0x1c')]);_0x1eca1b['attributes']=_[_0xfa86('0x1d')](_0x43fe38['model'],qs[_0xfa86('0x1f')](_0x21f385[_0xfa86('0x1c')]['fields']));_0x1eca1b[_0xfa86('0x1e')]=_0x1eca1b['attributes'][_0xfa86('0x34')]?_0x1eca1b['attributes']:_0x43fe38[_0xfa86('0x1b')];if(_0x21f385[_0xfa86('0x1c')]['includeAll']){_0x1eca1b[_0xfa86('0x2b')]=[{'all':!![]}];}_0x1eca1b=_['merge']({},_0x1eca1b,_0x21f385[_0xfa86('0x28')]);return db[_0xfa86('0x19')][_0xfa86('0x35')](_0x1eca1b)[_0xfa86('0x13')](handleEntityNotFound(_0x87ce45,null))[_0xfa86('0x13')](function(_0x31d986){if(_0x31d986[_0xfa86('0x2e')]===_0xfa86('0x2f')){var _0x492754=encryptor['decryptString'](_0x31d986[_0xfa86('0x31')]);_0x31d986[_0xfa86('0x31')]=maskClientSecret(_0x492754);}return _0x31d986;})[_0xfa86('0x13')](respondWithResult(_0x87ce45,null))[_0xfa86('0x36')](handleError(_0x87ce45,null));};exports[_0xfa86('0x37')]=function(_0x4c2131,_0x437a00){if(!_0x4c2131[_0xfa86('0x38')][_0xfa86('0x16')])throw new Error(_0xfa86('0x39'));if(!_0x4c2131[_0xfa86('0x38')][_0xfa86('0x2e')])throw new Error(_0xfa86('0x3a'));var _0x543018=db[_0xfa86('0x19')]['rawAttributes']['service']['values'];if(!_0x543018[_0xfa86('0x3b')](_0x4c2131[_0xfa86('0x38')][_0xfa86('0x2e')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x543018[_0xfa86('0x3c')](',\x20'));if(_0x4c2131['body']['service']===_0xfa86('0x2f')&&_0x4c2131[_0xfa86('0x38')][_0xfa86('0x31')]){_0x4c2131['body']['data3']=encryptor[_0xfa86('0x3d')](_0x4c2131['body']['data3']);}return db[_0xfa86('0x19')]['create'](_0x4c2131[_0xfa86('0x38')],{})['then'](respondWithResult(_0x437a00,0xc9))[_0xfa86('0x36')](handleError(_0x437a00,null));};exports['update']=function(_0x5ee5db,_0x370498){if(_0x5ee5db['body']['id']){delete _0x5ee5db[_0xfa86('0x38')]['id'];}return db[_0xfa86('0x19')][_0xfa86('0x35')]({'where':{'id':_0x5ee5db[_0xfa86('0x32')]['id']}})['then'](handleEntityNotFound(_0x370498,null))[_0xfa86('0x13')](function(_0x5931a6){if(_0x5931a6[_0xfa86('0x2e')]===_0xfa86('0x2f')&&_0x5ee5db[_0xfa86('0x38')][_0xfa86('0x31')]){_0x5ee5db[_0xfa86('0x38')][_0xfa86('0x31')]=encryptor[_0xfa86('0x3d')](_0x5ee5db['body'][_0xfa86('0x31')]);}return _0x5931a6;})[_0xfa86('0x13')](saveUpdates(_0x5ee5db['body'],null))[_0xfa86('0x13')](respondWithResult(_0x370498,null))['catch'](handleError(_0x370498,null));};exports[_0xfa86('0x3e')]=function(_0x4dd6ec,_0x41414e){return db['CloudProvider'][_0xfa86('0x35')]({'where':{'id':_0x4dd6ec[_0xfa86('0x32')]['id']}})[_0xfa86('0x13')](handleEntityNotFound(_0x41414e,null))[_0xfa86('0x13')](removeEntity(_0x41414e,null))[_0xfa86('0x36')](handleError(_0x41414e,null));};exports[_0xfa86('0x3f')]=function(_0xf5d888,_0xf960c9){return db['CloudProvider'][_0xfa86('0x40')]({'where':{'id':_0xf5d888['params']['id']},'raw':!![]})[_0xfa86('0x13')](function(_0x5696b7){if(!_0x5696b7)return _0xf960c9['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x5696b7,_0xf5d888['user']['id'])};})[_0xfa86('0x13')](respondWithResult(_0xf960c9,null))[_0xfa86('0x36')](handleError(_0xf960c9,null));};exports[_0xfa86('0x41')]=function(_0x5ec677,_0x500056){var _0x18a153=_0x5ec677['body'];var _0x5b784c;var _0x3b4c5a;if(_0x18a153[_0xfa86('0x14')])throw _0x18a153;redis[_0xfa86('0x42')](_0x18a153[_0xfa86('0x43')])[_0xfa86('0x13')](function(_0x7b17f3){if(!_0x7b17f3)throw new Error('Invalid\x20state\x20parameter');_0x5b784c=JSON[_0xfa86('0x44')](_0x7b17f3);var _0x49dbfe=Buffer[_0xfa86('0x45')](_0x18a153['state'],_0xfa86('0x46'))['toString'](_0xfa86('0x47'));_0x3b4c5a=JSON[_0xfa86('0x44')](_0x49dbfe);if(!oauth['isValidIdToken'](_0x18a153[_0xfa86('0x48')],_0x5b784c[_0xfa86('0x49')]))throw new Error(_0xfa86('0x4a'));redis[_0xfa86('0x4b')](_0x18a153[_0xfa86('0x43')]);return oauth[_0xfa86('0x4c')](_0x18a153[_0xfa86('0x4d')],_0x5b784c);})[_0xfa86('0x13')](function(_0x3ba5b4){_0x5b784c[_0xfa86('0x4e')]=_0x3ba5b4['access_token'];_0x5b784c[_0xfa86('0x4f')]=_0x3ba5b4[_0xfa86('0x50')];return db[_0xfa86('0x19')][_0xfa86('0x12')]({'data5':_0x5b784c[_0xfa86('0x4e')],'data6':_0x5b784c[_0xfa86('0x4f')]},{'where':{'id':_0x5b784c['id']}});})['then'](function(){oauth[_0xfa86('0x51')](_0x5b784c);socket[_0xfa86('0x52')](_0xfa86('0x53'),{'id':_0x3b4c5a['id']});return;})[_0xfa86('0x13')](respondWithStatusCode(_0x500056,null))[_0xfa86('0x36')](function(_0x4a8927){if(_0x3b4c5a){socket[_0xfa86('0x52')](_0xfa86('0x54'),{'id':_0x3b4c5a['id']});}if(!_0x5b784c){logger[_0xfa86('0x14')]('Invalid\x20authentication\x20state\x20parameter',_0x4a8927);return _0x500056[_0xfa86('0xb')](0x1f4)[_0xfa86('0x17')](_0x4a8927['message']);}logger[_0xfa86('0x14')](_0xfa86('0x55'),_0x5b784c['id'],JSON['stringify'](_0x4a8927));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 9576449..f6f14b5 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 _0xd83f=['request-promise','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','moment','bluebird'];(function(_0x241bc4,_0x1a46ad){var _0x3d65a0=function(_0x231ef8){while(--_0x231ef8){_0x241bc4['push'](_0x241bc4['shift']());}};_0x3d65a0(++_0x1a46ad);}(_0xd83f,0x1b5));var _0xfd83=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd83f[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xfd83('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfd83('0x1'));var BPromise=require(_0xfd83('0x2'));var rp=require(_0xfd83('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd83('0x4'));var config=require(_0xfd83('0x5'));var attributes=require(_0xfd83('0x6'));module[_0xfd83('0x7')]=function(_0x2f21d7,_0x12ebf4){return _0x2f21d7[_0xfd83('0x8')](_0xfd83('0x9'),attributes,{'tableName':_0xfd83('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e20=['request-promise','path','rimraf','../../config/environment','exports','define','CloudProvider','cloud_providers','../../config/logger','moment','bluebird'];(function(_0x572a45,_0x12b67e){var _0x5a91e4=function(_0x2350a4){while(--_0x2350a4){_0x572a45['push'](_0x572a45['shift']());}};_0x5a91e4(++_0x12b67e);}(_0x7e20,0x1ec));var _0x07e2=function(_0x265b8f,_0xa5d91b){_0x265b8f=_0x265b8f-0x0;var _0xa73272=_0x7e20[_0x265b8f];return _0xa73272;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x07e2('0x0'))('api');var moment=require(_0x07e2('0x1'));var BPromise=require(_0x07e2('0x2'));var rp=require(_0x07e2('0x3'));var fs=require('fs');var path=require(_0x07e2('0x4'));var rimraf=require(_0x07e2('0x5'));var config=require(_0x07e2('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x07e2('0x7')]=function(_0x3e3ad5,_0x159175){return _0x3e3ad5[_0x07e2('0x8')](_0x07e2('0x9'),attributes,{'tableName':_0x07e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 1be4a62..494be52 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8432=['intervals','all','inspect','lodash','crypto','moment','ioredis','request-promise','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','id_token','from','toString','client_id','data1','response_type','data4','form_post','scope','prompt','login','key','oauth2Claims','set','decode','iss','issuer','audience','isAfter','unix','exp','resolve','then','data3','refresh_token','data6','{TENANT_ID}','data2','data5','access_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString'];(function(_0x2e96d6,_0x3a2096){var _0x397996=function(_0x812368){while(--_0x812368){_0x2e96d6['push'](_0x2e96d6['shift']());}};_0x397996(++_0x3a2096);}(_0x8432,0x157));var _0x2843=function(_0x2f430a,_0x46d370){_0x2f430a=_0x2f430a-0x0;var _0x10def3=_0x8432[_0x2f430a];return _0x10def3;};'use strict';var _=require(_0x2843('0x0'));var crypto=require(_0x2843('0x1'));var jwt=require('jsonwebtoken');var moment=require(_0x2843('0x2'));var Redis=require(_0x2843('0x3'));var rp=require(_0x2843('0x4'));var util=require(_0x2843('0x5'));var encryptor=require('../../components/encryptor');var config=require(_0x2843('0x6'));var logger=require(_0x2843('0x7'))(_0x2843('0x8'));var schedule=require(_0x2843('0x9'));var db=require(_0x2843('0xa'))['db'];config['redis']=_[_0x2843('0xb')](config[_0x2843('0xc')],{'host':_0x2843('0xd'),'port':0x18eb});var redis=new Redis(config[_0x2843('0xc')]);var MICROSOFT_AUTH_URL=_0x2843('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0x2843('0xf'),'profile',_0x2843('0x10'),'offline_access',_0x2843('0x11'),'https://outlook.office.com/POP.AccessAsUser.All',_0x2843('0x12')],'Dynamics365':[_0x2843('0xf'),_0x2843('0x13')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x2843('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5edc48){var _0x32e20f=_[_0x2843('0x15')](AZURE_AUTH_SCOPES[_0x5edc48[_0x2843('0x16')]]);if(_0x5edc48[_0x2843('0x16')]===_0x2843('0x17'))_0x32e20f[_0x2843('0x18')](_0x5edc48[_0x2843('0x19')]+_0x2843('0x1a'));return _0x32e20f[_0x2843('0x1b')]('\x20');}function getAccessTokenScope(_0x205922){if(_0x205922[_0x2843('0x16')]===_0x2843('0x1c'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x205922[_0x2843('0x16')]==='Dynamics365')return _0x205922[_0x2843('0x19')]+_0x2843('0x1a');}function generateMicrosoftAuthorizationUrl(_0x5b5890,_0x10c567){var _0x22a372=MICROSOFT_AUTH_URL[_0x2843('0x1d')]('{TENANT_ID}',_0x5b5890['data2']);var _0x3a7748=['code',_0x2843('0x1e')];var _0x1fe7a4=Buffer[_0x2843('0x1f')](JSON['stringify']({'id':_0x10c567}))['toString']('base64');var _0x18c416=crypto['randomBytes'](0x10)[_0x2843('0x20')]('hex');var _0x34d969=getAuthorizationScopes(_0x5b5890);var _0x2a2ea0=[{'key':_0x2843('0x21'),'value':_0x5b5890[_0x2843('0x22')]},{'key':_0x2843('0x23'),'value':encodeURIComponent(_0x3a7748[_0x2843('0x1b')]('\x20'))},{'key':'redirect_uri','value':_0x5b5890[_0x2843('0x24')]},{'key':'response_mode','value':_0x2843('0x25')},{'key':_0x2843('0x26'),'value':encodeURIComponent(_0x34d969)},{'key':'state','value':_0x1fe7a4},{'key':'nonce','value':_0x18c416},{'key':_0x2843('0x27'),'value':_0x2843('0x28')}];var _0xab9079=_0x22a372+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x2843('0x15')](_0x2a2ea0,function(_0x5e3228){return _0x5e3228[_0x2843('0x29')]+'='+_0x5e3228['value'];})[_0x2843('0x1b')]('&');_0x5b5890[_0x2843('0x2a')]={'issuer':_0x22a372[_0x2843('0x1d')]('oauth2/',''),'audience':_0x5b5890['data1'],'state':_0x1fe7a4,'nonce':_0x18c416};redis[_0x2843('0x2b')](_0x1fe7a4,JSON['stringify'](_0x5b5890));return _0xab9079;}function isValidIdToken(_0x469d51,_0x3bc9fc){try{var _0x1012ff=jwt[_0x2843('0x2c')](_0x469d51,{'complete':!![]});var _0x3a4534=_0x1012ff['payload'];if(_0x3a4534[_0x2843('0x2d')]!==_0x3bc9fc[_0x2843('0x2e')])return![];if(_0x3a4534['aud']!==_0x3bc9fc[_0x2843('0x2f')])return![];if(_0x3a4534['nonce']!==_0x3bc9fc['nonce'])return![];if(moment()[_0x2843('0x30')](moment[_0x2843('0x31')](_0x3a4534[_0x2843('0x32')])))return![];return!![];}catch(_0x4a273c){throw _0x4a273c;}}function refreshOauth2MicrosoftAccessToken(_0x1263d5){return Promise[_0x2843('0x33')]()[_0x2843('0x34')](function(){if(_0x1263d5[_0x2843('0x35')])return _0x1263d5;return db['CloudProvider']['findOne']({'where':{'id':_0x1263d5['id']},'raw':!![]});})['then'](function(_0x1e04aa){var _0x408b5f={'grant_type':_0x2843('0x36'),'refresh_token':_0x1e04aa[_0x2843('0x37')],'scope':getAccessTokenScope(_0x1e04aa),'redirect_uri':_0x1e04aa[_0x2843('0x24')],'client_id':_0x1e04aa[_0x2843('0x22')],'client_secret':encryptor['decryptString'](_0x1e04aa[_0x2843('0x35')])};var _0x2b501a={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x2843('0x1d')](_0x2843('0x38'),_0x1e04aa[_0x2843('0x39')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x408b5f,'json':!![]};return rp(_0x2b501a);})[_0x2843('0x34')](function(_0x1d6584){_0x1263d5[_0x2843('0x3a')]=_0x1d6584[_0x2843('0x3b')];_0x1263d5[_0x2843('0x37')]=_0x1d6584[_0x2843('0x36')];return db['CloudProvider']['update']({'data5':_0x1263d5[_0x2843('0x3a')],'data6':_0x1263d5[_0x2843('0x37')]},{'where':{'id':_0x1263d5['id']}});})[_0x2843('0x34')](function(){return _0x1263d5;})[_0x2843('0x3c')](function(_0x170ba4){logger[_0x2843('0x3d')](_0x2843('0x3e'),_0x1263d5['id'],_0x170ba4);});}function getOauth2MicrosoftAccessToken(_0x333f23,_0x8c81cd){var _0x5267ad={'grant_type':_0x2843('0x3f'),'code':_0x333f23,'scope':getAccessTokenScope(_0x8c81cd),'redirect_uri':_0x8c81cd[_0x2843('0x24')],'client_id':_0x8c81cd[_0x2843('0x22')],'client_secret':encryptor[_0x2843('0x40')](_0x8c81cd[_0x2843('0x35')])};var _0x205bae={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x2843('0x1d')](_0x2843('0x38'),_0x8c81cd[_0x2843('0x39')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5267ad,'json':!![]};return rp(_0x205bae);}function startRefreshInterval(_0x28277c){var _0x570550=schedule['intervals'];if(_0x570550[_0x28277c['id']])clearInterval(_0x570550[_0x28277c['id']]);_0x570550[_0x28277c['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x28277c['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x2843('0x41')]=_0x570550;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x3e8750){var _0x134fcb=_0x3e8750[_0x2843('0x15')](function(_0x386e14){return refreshOauth2MicrosoftAccessToken(_0x386e14)['then'](function(_0x483b6e){startRefreshInterval(_0x483b6e);});});return Promise[_0x2843('0x42')](_0x134fcb);})['catch'](function(_0x306921){var _0x3058cd=_0x306921?util[_0x2843('0x43')](_0x306921,{'showHidden':![],'depth':null}):'';logger[_0x2843('0x3d')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x3058cd);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xee9d=['hex','client_id','data1','response_type','redirect_uri','data4','scope','state','nonce','prompt','map','key','oauth2Claims','set','stringify','decode','payload','issuer','aud','isAfter','unix','resolve','data3','CloudProvider','then','refresh_token','data6','POST','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','bind','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','openid','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','type','Dynamics365','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','id_token','from','toString','base64'];(function(_0x5868e8,_0x52e7c3){var _0x24ac5=function(_0x55e12c){while(--_0x55e12c){_0x5868e8['push'](_0x5868e8['shift']());}};_0x24ac5(++_0x52e7c3);}(_0xee9d,0x1e5));var _0xdee9=function(_0x2832cb,_0x35cd83){_0x2832cb=_0x2832cb-0x0;var _0x1d868f=_0xee9d[_0x2832cb];return _0x1d868f;};'use strict';var _=require(_0xdee9('0x0'));var crypto=require(_0xdee9('0x1'));var jwt=require(_0xdee9('0x2'));var moment=require('moment');var Redis=require(_0xdee9('0x3'));var rp=require(_0xdee9('0x4'));var util=require(_0xdee9('0x5'));var encryptor=require(_0xdee9('0x6'));var config=require(_0xdee9('0x7'));var logger=require(_0xdee9('0x8'))('api');var schedule=require(_0xdee9('0x9'));var db=require(_0xdee9('0xa'))['db'];config['redis']=_['defaults'](config[_0xdee9('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0xdee9('0xb')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xdee9('0xc'),'profile',_0xdee9('0xd'),'offline_access',_0xdee9('0xe'),'https://outlook.office.com/POP.AccessAsUser.All',_0xdee9('0xf')],'Dynamics365':[_0xdee9('0xc'),_0xdee9('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0xdee9('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0xdee9('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x27030e){var _0x12cbaa=_['map'](AZURE_AUTH_SCOPES[_0x27030e[_0xdee9('0x13')]]);if(_0x27030e[_0xdee9('0x13')]===_0xdee9('0x14'))_0x12cbaa['push'](_0x27030e[_0xdee9('0x15')]+_0xdee9('0x16'));return _0x12cbaa[_0xdee9('0x17')]('\x20');}function getAccessTokenScope(_0x3abe3a){if(_0x3abe3a[_0xdee9('0x13')]===_0xdee9('0x18'))return _0xdee9('0xe');if(_0x3abe3a[_0xdee9('0x13')]===_0xdee9('0x14'))return _0x3abe3a[_0xdee9('0x15')]+_0xdee9('0x16');}function generateMicrosoftAuthorizationUrl(_0x20fc25,_0x3dbca8){var _0x448682=MICROSOFT_AUTH_URL[_0xdee9('0x19')](_0xdee9('0x1a'),_0x20fc25[_0xdee9('0x1b')]);var _0xc4a46e=[_0xdee9('0x1c'),_0xdee9('0x1d')];var _0x422240=Buffer[_0xdee9('0x1e')](JSON['stringify']({'id':_0x3dbca8}))[_0xdee9('0x1f')](_0xdee9('0x20'));var _0x12e8c4=crypto['randomBytes'](0x10)[_0xdee9('0x1f')](_0xdee9('0x21'));var _0x177150=getAuthorizationScopes(_0x20fc25);var _0x4d83e0=[{'key':_0xdee9('0x22'),'value':_0x20fc25[_0xdee9('0x23')]},{'key':_0xdee9('0x24'),'value':encodeURIComponent(_0xc4a46e[_0xdee9('0x17')]('\x20'))},{'key':_0xdee9('0x25'),'value':_0x20fc25[_0xdee9('0x26')]},{'key':'response_mode','value':'form_post'},{'key':_0xdee9('0x27'),'value':encodeURIComponent(_0x177150)},{'key':_0xdee9('0x28'),'value':_0x422240},{'key':_0xdee9('0x29'),'value':_0x12e8c4},{'key':_0xdee9('0x2a'),'value':'login'}];var _0x36ff5d=_0x448682+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xdee9('0x2b')](_0x4d83e0,function(_0xeb9b4c){return _0xeb9b4c[_0xdee9('0x2c')]+'='+_0xeb9b4c['value'];})[_0xdee9('0x17')]('&');_0x20fc25[_0xdee9('0x2d')]={'issuer':_0x448682[_0xdee9('0x19')]('oauth2/',''),'audience':_0x20fc25[_0xdee9('0x23')],'state':_0x422240,'nonce':_0x12e8c4};redis[_0xdee9('0x2e')](_0x422240,JSON[_0xdee9('0x2f')](_0x20fc25));return _0x36ff5d;}function isValidIdToken(_0x215dc5,_0x17f7c9){try{var _0x2e0459=jwt[_0xdee9('0x30')](_0x215dc5,{'complete':!![]});var _0x2e7423=_0x2e0459[_0xdee9('0x31')];if(_0x2e7423['iss']!==_0x17f7c9[_0xdee9('0x32')])return![];if(_0x2e7423[_0xdee9('0x33')]!==_0x17f7c9['audience'])return![];if(_0x2e7423[_0xdee9('0x29')]!==_0x17f7c9[_0xdee9('0x29')])return![];if(moment()[_0xdee9('0x34')](moment[_0xdee9('0x35')](_0x2e7423['exp'])))return![];return!![];}catch(_0x35d019){throw _0x35d019;}}function refreshOauth2MicrosoftAccessToken(_0x219fee){return Promise[_0xdee9('0x36')]()['then'](function(){if(_0x219fee[_0xdee9('0x37')])return _0x219fee;return db[_0xdee9('0x38')]['findOne']({'where':{'id':_0x219fee['id']},'raw':!![]});})[_0xdee9('0x39')](function(_0x19fe99){var _0x1975af={'grant_type':_0xdee9('0x3a'),'refresh_token':_0x19fe99[_0xdee9('0x3b')],'scope':getAccessTokenScope(_0x19fe99),'redirect_uri':_0x19fe99[_0xdee9('0x26')],'client_id':_0x19fe99['data1'],'client_secret':encryptor['decryptString'](_0x19fe99[_0xdee9('0x37')])};var _0x1e72a9={'method':_0xdee9('0x3c'),'uri':MICROSOFT_AUTH_URL['replace'](_0xdee9('0x1a'),_0x19fe99[_0xdee9('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1975af,'json':!![]};return rp(_0x1e72a9);})[_0xdee9('0x39')](function(_0x8439cb){_0x219fee['data5']=_0x8439cb[_0xdee9('0x3d')];_0x219fee[_0xdee9('0x3b')]=_0x8439cb[_0xdee9('0x3a')];return db[_0xdee9('0x38')][_0xdee9('0x3e')]({'data5':_0x219fee['data5'],'data6':_0x219fee[_0xdee9('0x3b')]},{'where':{'id':_0x219fee['id']}});})[_0xdee9('0x39')](function(){return _0x219fee;})[_0xdee9('0x3f')](function(_0x4d6cc2){logger[_0xdee9('0x40')](_0xdee9('0x41'),_0x219fee['id'],_0x4d6cc2);});}function getOauth2MicrosoftAccessToken(_0x2882bb,_0x2732ca){var _0x4752e9={'grant_type':_0xdee9('0x42'),'code':_0x2882bb,'scope':getAccessTokenScope(_0x2732ca),'redirect_uri':_0x2732ca[_0xdee9('0x26')],'client_id':_0x2732ca[_0xdee9('0x23')],'client_secret':encryptor[_0xdee9('0x43')](_0x2732ca['data3'])};var _0x263509={'method':_0xdee9('0x3c'),'uri':MICROSOFT_AUTH_URL['replace'](_0xdee9('0x1a'),_0x2732ca[_0xdee9('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4752e9,'json':!![]};return rp(_0x263509);}function startRefreshInterval(_0x220620){var _0x9cbc55=schedule[_0xdee9('0x44')];if(_0x9cbc55[_0x220620['id']])clearInterval(_0x9cbc55[_0x220620['id']]);_0x9cbc55[_0x220620['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xdee9('0x45')](this,{'id':_0x220620['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xdee9('0x44')]=_0x9cbc55;}function startAllRefreshIntervals(){return db[_0xdee9('0x38')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x264470){var _0x16bc6b=_0x264470['map'](function(_0x214cb6){return refreshOauth2MicrosoftAccessToken(_0x214cb6)[_0xdee9('0x39')](function(_0x230b63){startRefreshInterval(_0x230b63);});});return Promise[_0xdee9('0x46')](_0x16bc6b);})[_0xdee9('0x3f')](function(_0x131539){var _0x306592=_0x131539?util[_0xdee9('0x47')](_0x131539,{'showHidden':![],'depth':null}):'';logger['error'](_0xdee9('0x48'),_0x306592);});}module[_0xdee9('0x49')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 10b8679..adeb689 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 _0x29b1=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','info','message','catch','lodash','util','moment'];(function(_0x13bc21,_0x5627ce){var _0x51823e=function(_0x285f5c){while(--_0x285f5c){_0x13bc21['push'](_0x13bc21['shift']());}};_0x51823e(++_0x5627ce);}(_0x29b1,0x16d));var _0x129b=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x29b1[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x129b('0x0'));var util=require(_0x129b('0x1'));var moment=require(_0x129b('0x2'));var BPromise=require(_0x129b('0x3'));var rs=require(_0x129b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x129b('0x5'))['db'];var utils=require(_0x129b('0x6'));var logger=require(_0x129b('0x7'))(_0x129b('0x8'));var config=require(_0x129b('0x9'));var jayson=require(_0x129b('0xa'));var client=jayson[_0x129b('0xb')][_0x129b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ce8f9,_0x3ef769,_0x5ac368){return new BPromise(function(_0x2c99a1,_0x1e29d6){return client['request'](_0x5ce8f9,_0x5ac368)[_0x129b('0xd')](function(_0x1abf45){logger['info'](_0x129b('0xe'),_0x3ef769,'request\x20sent');logger[_0x129b('0xf')](_0x129b('0x10'),_0x3ef769,_0x129b('0x11'),JSON['stringify'](_0x1abf45));if(_0x1abf45[_0x129b('0x12')]){if(_0x1abf45[_0x129b('0x12')][_0x129b('0x13')]===0x1f4){logger[_0x129b('0x12')]('CloudProvider,\x20%s,\x20%s',_0x3ef769,_0x1abf45['error']['message']);return _0x1e29d6(_0x1abf45[_0x129b('0x12')]['message']);}logger[_0x129b('0x12')](_0x129b('0xe'),_0x3ef769,_0x1abf45[_0x129b('0x12')]['message']);return _0x2c99a1(_0x1abf45[_0x129b('0x12')]['message']);}else{logger[_0x129b('0x14')](_0x129b('0xe'),_0x3ef769,_0x129b('0x11'));_0x2c99a1(_0x1abf45['result'][_0x129b('0x15')]);}})[_0x129b('0x16')](function(_0x1364f8){logger[_0x129b('0x12')](_0x129b('0xe'),_0x3ef769,_0x1364f8);_0x1e29d6(_0x1364f8);});});} \ No newline at end of file +var _0x1aab=['CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x1aab,0x122));var _0xb1aa=function(_0x336a3b,_0x1d422c){_0x336a3b=_0x336a3b-0x0;var _0x1f505a=_0x1aab[_0x336a3b];return _0x1f505a;};'use strict';var _=require(_0xb1aa('0x0'));var util=require(_0xb1aa('0x1'));var moment=require(_0xb1aa('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1aa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1aa('0x4'))['db'];var utils=require(_0xb1aa('0x5'));var logger=require(_0xb1aa('0x6'))(_0xb1aa('0x7'));var config=require(_0xb1aa('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb1aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x277448,_0x13a350,_0x283ad6){return new BPromise(function(_0x3415f7,_0x405387){return client[_0xb1aa('0xa')](_0x277448,_0x283ad6)['then'](function(_0x12067d){logger[_0xb1aa('0xb')]('CloudProvider,\x20%s,\x20%s',_0x13a350,_0xb1aa('0xc'));logger[_0xb1aa('0xd')](_0xb1aa('0xe'),_0x13a350,_0xb1aa('0xc'),JSON[_0xb1aa('0xf')](_0x12067d));if(_0x12067d[_0xb1aa('0x10')]){if(_0x12067d[_0xb1aa('0x10')][_0xb1aa('0x11')]===0x1f4){logger[_0xb1aa('0x10')](_0xb1aa('0x12'),_0x13a350,_0x12067d[_0xb1aa('0x10')][_0xb1aa('0x13')]);return _0x405387(_0x12067d[_0xb1aa('0x10')][_0xb1aa('0x13')]);}logger[_0xb1aa('0x10')]('CloudProvider,\x20%s,\x20%s',_0x13a350,_0x12067d['error'][_0xb1aa('0x13')]);return _0x3415f7(_0x12067d['error'][_0xb1aa('0x13')]);}else{logger['info'](_0xb1aa('0x12'),_0x13a350,'request\x20sent');_0x3415f7(_0x12067d[_0xb1aa('0x14')]['message']);}})[_0xb1aa('0x15')](function(_0x408bf8){logger['error'](_0xb1aa('0x12'),_0x13a350,_0x408bf8);_0x405387(_0x408bf8);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 65126e4..02997c6 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x52e4ed,_0x26fb97){var _0x2920bc=function(_0x3752f0){while(--_0x3752f0){_0x52e4ed['push'](_0x52e4ed['shift']());}};_0x2920bc(++_0x26fb97);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x139172,_0x3745e4){var _0x5ee33f=function(_0x4caee9){while(--_0x4caee9){_0x139172['push'](_0x139172['shift']());}};_0x5ee33f(++_0x3745e4);}(_0xadb5,0xad));var _0x5adb=function(_0x4973c5,_0x5694de){_0x4973c5=_0x4973c5-0x0;var _0x5c0ed1=_0xadb5[_0x4973c5];return _0x5c0ed1;};'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['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 80e16f8..3f93a21 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 _0xf57a=['sequelize','STRING'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xf57a,0x108));var _0xaf57=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xf57a[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0xaf57('0x0'));module['exports']={'name':{'type':Sequelize[_0xaf57('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xaf57('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xaf57('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xaf57('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xaf57('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xaf57('0x1')]},'sCity':{'type':Sequelize[_0xaf57('0x1')]},'sCountry':{'type':Sequelize[_0xaf57('0x1')]},'description':{'type':Sequelize[_0xaf57('0x1')]}}; \ No newline at end of file +var _0xef8b=['exports','STRING','name'];(function(_0x5dc4fb,_0xf9b034){var _0x3b2a3e=function(_0x2ea71b){while(--_0x2ea71b){_0x5dc4fb['push'](_0x5dc4fb['shift']());}};_0x3b2a3e(++_0xf9b034);}(_0xef8b,0x192));var _0xbef8=function(_0xdb01a,_0x54a83a){_0xdb01a=_0xdb01a-0x0;var _0x107ede=_0xef8b[_0xdb01a];return _0x107ede;};'use strict';var Sequelize=require('sequelize');module[_0xbef8('0x0')]={'name':{'type':Sequelize[_0xbef8('0x1')],'unique':_0xbef8('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xbef8('0x1')]},'companyId':{'type':Sequelize[_0xbef8('0x1')]},'website':{'type':Sequelize[_0xbef8('0x1')]},'phone':{'type':Sequelize[_0xbef8('0x1')]},'fax':{'type':Sequelize[_0xbef8('0x1')]},'type':{'type':Sequelize[_0xbef8('0x1')]},'street':{'type':Sequelize[_0xbef8('0x1')]},'postalCode':{'type':Sequelize[_0xbef8('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xbef8('0x1')]},'email':{'type':Sequelize[_0xbef8('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbef8('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xbef8('0x1')]},'sCity':{'type':Sequelize[_0xbef8('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 6d47881..4842556 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 _0xa935=['show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','addContacts','CmContact','params','ids','omit','findOne','filter','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','end','error','stack','send','index','describe','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','options','CmCompany','count','includeAll','include','findAll','rows','catch'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xa935,0x120));var _0x5a93=function(_0xbaf094,_0x2f86ad){_0xbaf094=_0xbaf094-0x0;var _0x3974fd=_0xa935[_0xbaf094];return _0x3974fd;};'use strict';var emlformat=require(_0x5a93('0x0'));var rimraf=require(_0x5a93('0x1'));var zipdir=require(_0x5a93('0x2'));var jsonpatch=require(_0x5a93('0x3'));var rp=require(_0x5a93('0x4'));var moment=require(_0x5a93('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5a93('0x6'));var util=require('util');var path=require(_0x5a93('0x7'));var sox=require(_0x5a93('0x8'));var csv=require(_0x5a93('0x9'));var ejs=require(_0x5a93('0xa'));var fs=require('fs');var fs_extra=require(_0x5a93('0xb'));var _=require(_0x5a93('0xc'));var squel=require(_0x5a93('0xd'));var crypto=require('crypto');var jsforce=require(_0x5a93('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5a93('0x9'));var querystring=require(_0x5a93('0xf'));var Papa=require('papaparse');var Redis=require(_0x5a93('0x10'));var authService=require(_0x5a93('0x11'));var qs=require(_0x5a93('0x12'));var as=require(_0x5a93('0x13'));var hardwareService=require(_0x5a93('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5a93('0x15'));var config=require(_0x5a93('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a93('0x17'))['db'];function respondWithStatusCode(_0xc32fb,_0x3baca4){_0x3baca4=_0x3baca4||0xcc;return function(_0x36241d){if(_0x36241d){return _0xc32fb[_0x5a93('0x18')](_0x3baca4);}return _0xc32fb['status'](_0x3baca4)['end']();};}function respondWithResult(_0xb61717,_0x5290e0){_0x5290e0=_0x5290e0||0xc8;return function(_0x3f3251){if(_0x3f3251){return _0xb61717[_0x5a93('0x19')](_0x5290e0)[_0x5a93('0x1a')](_0x3f3251);}};}function respondWithFilteredResult(_0x615998,_0x21fd64){return function(_0x1ecbb7){if(_0x1ecbb7){var _0x296650=typeof _0x21fd64['offset']===_0x5a93('0x1b')&&typeof _0x21fd64['limit']===_0x5a93('0x1b');var _0xb0c114=_0x1ecbb7['count'];var _0x510241=_0x296650?0x0:_0x21fd64['offset'];var _0xd6fced=_0x296650?_0x1ecbb7['count']:_0x21fd64[_0x5a93('0x1c')]+_0x21fd64[_0x5a93('0x1d')];var _0x282ece;if(_0xd6fced>=_0xb0c114){_0xd6fced=_0xb0c114;_0x282ece=0xc8;}else{_0x282ece=0xce;}_0x615998['status'](_0x282ece);return _0x615998[_0x5a93('0x1e')](_0x5a93('0x1f'),_0x510241+'-'+_0xd6fced+'/'+_0xb0c114)[_0x5a93('0x1a')](_0x1ecbb7);}return null;};}function patchUpdates(_0xc43576){return function(_0x24ee83){try{jsonpatch[_0x5a93('0x20')](_0x24ee83,_0xc43576,!![]);}catch(_0x586242){return BPromise[_0x5a93('0x21')](_0x586242);}return _0x24ee83[_0x5a93('0x22')]();};}function saveUpdates(_0x389a48,_0x30139f){return function(_0xa6b6ff){if(_0xa6b6ff){return _0xa6b6ff['update'](_0x389a48)[_0x5a93('0x23')](function(_0x1ce08e){return _0x1ce08e;});}return null;};}function removeEntity(_0x468131,_0x190219){return function(_0x30f526){if(_0x30f526){return _0x30f526[_0x5a93('0x24')]()[_0x5a93('0x23')](function(){var _0x5b988c=_0x30f526[_0x5a93('0x25')]({'plain':!![]});var _0x4dbd36='Companies';return db['UserProfileResource'][_0x5a93('0x24')]({'where':{'type':_0x4dbd36,'resourceId':_0x5b988c['id']}})[_0x5a93('0x23')](function(){return _0x30f526;});})[_0x5a93('0x23')](function(){_0x468131[_0x5a93('0x19')](0xcc)[_0x5a93('0x26')]();});}};}function handleEntityNotFound(_0x54c58a,_0x41d4fd){return function(_0x6de4f0){if(!_0x6de4f0){_0x54c58a[_0x5a93('0x18')](0x194);}return _0x6de4f0;};}function handleError(_0x462d87,_0x498644){_0x498644=_0x498644||0x1f4;return function(_0x1d5b4e){logger[_0x5a93('0x27')](_0x1d5b4e[_0x5a93('0x28')]);if(_0x1d5b4e['name']){delete _0x1d5b4e['name'];}_0x462d87[_0x5a93('0x19')](_0x498644)[_0x5a93('0x29')](_0x1d5b4e);};}exports[_0x5a93('0x2a')]=function(_0x485e20,_0x472087){var _0x445078={},_0x1d34b1={},_0x17e7b6={'count':0x0,'rows':[]};return db['CmCompany'][_0x5a93('0x2b')]()[_0x5a93('0x23')](function(_0x2d1cf1){_0x1d34b1[_0x5a93('0x2c')]=_['keys'](_0x2d1cf1);_0x1d34b1['query']=_[_0x5a93('0x2d')](_0x485e20[_0x5a93('0x2e')]);_0x1d34b1[_0x5a93('0x2f')]=_['intersection'](_0x1d34b1[_0x5a93('0x2c')],_0x1d34b1[_0x5a93('0x2e')]);_0x445078[_0x5a93('0x30')]=_[_0x5a93('0x31')](_0x1d34b1['model'],qs[_0x5a93('0x32')](_0x485e20[_0x5a93('0x2e')][_0x5a93('0x32')]));_0x445078[_0x5a93('0x30')]=_0x445078[_0x5a93('0x30')][_0x5a93('0x33')]?_0x445078['attributes']:_0x1d34b1[_0x5a93('0x2c')];if(!_0x485e20['query'][_0x5a93('0x34')](_0x5a93('0x35'))){_0x445078['limit']=qs[_0x5a93('0x1d')](_0x485e20[_0x5a93('0x2e')][_0x5a93('0x1d')]);_0x445078[_0x5a93('0x1c')]=qs['offset'](_0x485e20[_0x5a93('0x2e')][_0x5a93('0x1c')]);}_0x445078[_0x5a93('0x36')]=qs[_0x5a93('0x37')](_0x485e20['query'][_0x5a93('0x37')]);_0x445078[_0x5a93('0x38')]=qs[_0x5a93('0x2f')](_[_0x5a93('0x39')](_0x485e20[_0x5a93('0x2e')],_0x1d34b1[_0x5a93('0x2f')]),_0x2d1cf1);if(_0x485e20[_0x5a93('0x2e')]['filter']){_0x445078['where']=_[_0x5a93('0x3a')](_0x445078['where'],{'$or':_[_0x5a93('0x3b')](_0x445078['attributes'],function(_0x1c016e){var _0x4dcb87={};_0x4dcb87[_0x1c016e]={'$like':'%'+_0x485e20['query']['filter']+'%'};return _0x4dcb87;})});}_0x445078=_['merge']({},_0x445078,_0x485e20[_0x5a93('0x3c')]);var _0x23974a={'where':_0x445078[_0x5a93('0x38')]};return db[_0x5a93('0x3d')][_0x5a93('0x3e')](_0x23974a)[_0x5a93('0x23')](function(_0x8da53a){_0x17e7b6[_0x5a93('0x3e')]=_0x8da53a;if(_0x485e20[_0x5a93('0x2e')][_0x5a93('0x3f')]){_0x445078[_0x5a93('0x40')]=[{'all':!![]}];}return db[_0x5a93('0x3d')][_0x5a93('0x41')](_0x445078);})['then'](function(_0xb6abd4){_0x17e7b6[_0x5a93('0x42')]=_0xb6abd4;return _0x17e7b6;})[_0x5a93('0x23')](respondWithFilteredResult(_0x472087,_0x445078))[_0x5a93('0x43')](handleError(_0x472087,null));})[_0x5a93('0x43')](handleError(_0x472087,null));};exports[_0x5a93('0x44')]=function(_0xbe22f2,_0x41495e){var _0x4c0e36={'raw':![],'where':{'id':_0xbe22f2['params']['id']}},_0x4b4e14={};_0x4b4e14['model']=_['keys'](db[_0x5a93('0x3d')][_0x5a93('0x45')]);_0x4b4e14[_0x5a93('0x2e')]=_['keys'](_0xbe22f2[_0x5a93('0x2e')]);_0x4b4e14[_0x5a93('0x2f')]=_[_0x5a93('0x31')](_0x4b4e14[_0x5a93('0x2c')],_0x4b4e14[_0x5a93('0x2e')]);_0x4c0e36[_0x5a93('0x30')]=_[_0x5a93('0x31')](_0x4b4e14[_0x5a93('0x2c')],qs[_0x5a93('0x32')](_0xbe22f2[_0x5a93('0x2e')]['fields']));_0x4c0e36[_0x5a93('0x30')]=_0x4c0e36['attributes'][_0x5a93('0x33')]?_0x4c0e36[_0x5a93('0x30')]:_0x4b4e14['model'];if(_0xbe22f2[_0x5a93('0x2e')][_0x5a93('0x3f')]){_0x4c0e36[_0x5a93('0x40')]=[{'all':!![]}];}_0x4c0e36=_[_0x5a93('0x3a')]({},_0x4c0e36,_0xbe22f2[_0x5a93('0x3c')]);return db['CmCompany'][_0x5a93('0x46')](_0x4c0e36)['then'](handleEntityNotFound(_0x41495e,null))[_0x5a93('0x23')](respondWithResult(_0x41495e,null))['catch'](handleError(_0x41495e,null));};exports['create']=function(_0x33a641,_0x186d2e){return db[_0x5a93('0x3d')][_0x5a93('0x47')](_0x33a641[_0x5a93('0x48')],{})[_0x5a93('0x23')](function(_0x28de0e){var _0x10a411=_0x33a641[_0x5a93('0x49')][_0x5a93('0x25')]({'plain':!![]});if(!_0x10a411)throw new Error(_0x5a93('0x4a'));if(_0x10a411[_0x5a93('0x4b')]===_0x5a93('0x49')){var _0x3c4f06=_0x28de0e[_0x5a93('0x25')]({'plain':!![]});var _0x4ee28f='Companies';return db[_0x5a93('0x4c')][_0x5a93('0x46')]({'where':{'name':_0x4ee28f,'userProfileId':_0x10a411[_0x5a93('0x4d')]},'raw':!![]})[_0x5a93('0x23')](function(_0x567417){if(_0x567417&&_0x567417[_0x5a93('0x4e')]===0x0){return db[_0x5a93('0x4f')][_0x5a93('0x47')]({'name':_0x3c4f06['name'],'resourceId':_0x3c4f06['id'],'type':_0x567417['name'],'sectionId':_0x567417['id']},{})[_0x5a93('0x23')](function(){return _0x28de0e;});}else{return _0x28de0e;}})[_0x5a93('0x43')](function(_0x29cc14){logger[_0x5a93('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x29cc14);throw _0x29cc14;});}return _0x28de0e;})[_0x5a93('0x23')](respondWithResult(_0x186d2e,0xc9))[_0x5a93('0x43')](handleError(_0x186d2e,null));};exports[_0x5a93('0x50')]=function(_0x22a08e,_0x349b94){if(_0x22a08e[_0x5a93('0x48')]['id']){delete _0x22a08e[_0x5a93('0x48')]['id'];}return db[_0x5a93('0x3d')][_0x5a93('0x46')]({'where':{'id':_0x22a08e['params']['id']}})[_0x5a93('0x23')](handleEntityNotFound(_0x349b94,null))[_0x5a93('0x23')](saveUpdates(_0x22a08e[_0x5a93('0x48')],null))[_0x5a93('0x23')](respondWithResult(_0x349b94,null))[_0x5a93('0x43')](handleError(_0x349b94,null));};exports[_0x5a93('0x24')]=function(_0x395eab,_0x51631f){return db[_0x5a93('0x3d')]['find']({'where':{'id':_0x395eab['params']['id']}})[_0x5a93('0x23')](handleEntityNotFound(_0x51631f,null))[_0x5a93('0x23')](removeEntity(_0x51631f,null))['catch'](handleError(_0x51631f,null));};exports[_0x5a93('0x2b')]=function(_0x161b43,_0x18aeac){return db[_0x5a93('0x3d')][_0x5a93('0x2b')]()[_0x5a93('0x23')](respondWithResult(_0x18aeac,null))[_0x5a93('0x43')](handleError(_0x18aeac,null));};exports[_0x5a93('0x51')]=function(_0x5129b3,_0x4519e2,_0x48bedd){return db[_0x5a93('0x52')][_0x5a93('0x46')]({'where':{'id':_0x5129b3[_0x5a93('0x53')]['id']}})[_0x5a93('0x23')](handleEntityNotFound(_0x4519e2,null))['then'](function(_0x587a5e){if(_0x587a5e){return _0x587a5e['addContacts'](_0x5129b3[_0x5a93('0x48')][_0x5a93('0x54')],_[_0x5a93('0x55')](_0x5129b3[_0x5a93('0x48')],[_0x5a93('0x54'),'id'])||{});}})['then'](respondWithResult(_0x4519e2,null))['catch'](handleError(_0x4519e2,null));};exports['getContacts']=function(_0x4438dc,_0x51b10f,_0x25fadd){var _0x2efbd1={};var _0x250092={};var _0xeafa5d;var _0x151955;return db[_0x5a93('0x3d')][_0x5a93('0x56')]({'where':{'id':_0x4438dc['params']['id']}})[_0x5a93('0x23')](handleEntityNotFound(_0x51b10f,null))[_0x5a93('0x23')](function(_0x2f0609){if(_0x2f0609){_0xeafa5d=_0x2f0609;_0x250092['model']=_['keys'](db[_0x5a93('0x52')][_0x5a93('0x45')]);_0x250092[_0x5a93('0x2e')]=_[_0x5a93('0x2d')](_0x4438dc['query']);_0x250092[_0x5a93('0x2f')]=_['intersection'](_0x250092[_0x5a93('0x2c')],_0x250092[_0x5a93('0x2e')]);_0x2efbd1[_0x5a93('0x30')]=_[_0x5a93('0x31')](_0x250092[_0x5a93('0x2c')],qs[_0x5a93('0x32')](_0x4438dc['query'][_0x5a93('0x32')]));_0x2efbd1[_0x5a93('0x30')]=_0x2efbd1['attributes'][_0x5a93('0x33')]?_0x2efbd1['attributes']:_0x250092['model'];_0x2efbd1[_0x5a93('0x36')]=qs[_0x5a93('0x37')](_0x4438dc['query'][_0x5a93('0x37')]);_0x2efbd1[_0x5a93('0x38')]=qs[_0x5a93('0x2f')](_[_0x5a93('0x39')](_0x4438dc['query'],_0x250092['filters']));if(_0x4438dc['query'][_0x5a93('0x57')]){_0x2efbd1[_0x5a93('0x38')]=_[_0x5a93('0x3a')](_0x2efbd1[_0x5a93('0x38')],{'$or':_[_0x5a93('0x3b')](_0x2efbd1['attributes'],function(_0xda95c9){var _0x4e65a3={};_0x4e65a3[_0xda95c9]={'$like':'%'+_0x4438dc['query'][_0x5a93('0x57')]+'%'};return _0x4e65a3;})});}_0x2efbd1=_[_0x5a93('0x3a')]({},_0x2efbd1,_0x4438dc[_0x5a93('0x3c')]);return _0xeafa5d[_0x5a93('0x58')](_0x2efbd1);}})[_0x5a93('0x23')](function(_0x3a5d02){if(_0x3a5d02){_0x151955=_0x3a5d02[_0x5a93('0x33')];if(!_0x4438dc[_0x5a93('0x2e')][_0x5a93('0x34')]('nolimit')){_0x2efbd1['limit']=qs['limit'](_0x4438dc[_0x5a93('0x2e')]['limit']);_0x2efbd1['offset']=qs['offset'](_0x4438dc[_0x5a93('0x2e')][_0x5a93('0x1c')]);}return _0xeafa5d[_0x5a93('0x58')](_0x2efbd1);}})[_0x5a93('0x23')](function(_0x22d980){if(_0x22d980){return _0x22d980?{'count':_0x151955,'rows':_0x22d980}:null;}})[_0x5a93('0x23')](respondWithResult(_0x51b10f,null))['catch'](handleError(_0x51b10f,null));}; \ No newline at end of file +var _0x7736=['error','stack','name','CmCompany','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','filters','pick','filter','where','merge','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','addContacts','ids','getContacts','findOne','CmContact','nolimit','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','get','Companies','UserProfileResource','sendStatus'];(function(_0x22c6cd,_0x5eb90e){var _0x2da0e9=function(_0x32a2ed){while(--_0x32a2ed){_0x22c6cd['push'](_0x22c6cd['shift']());}};_0x2da0e9(++_0x5eb90e);}(_0x7736,0x13b));var _0x6773=function(_0x99a726,_0x1f9436){_0x99a726=_0x99a726-0x0;var _0x41f6dc=_0x7736[_0x99a726];return _0x41f6dc;};'use strict';var emlformat=require(_0x6773('0x0'));var rimraf=require(_0x6773('0x1'));var zipdir=require(_0x6773('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6773('0x3'));var moment=require('moment');var BPromise=require(_0x6773('0x4'));var Mustache=require('mustache');var util=require(_0x6773('0x5'));var path=require(_0x6773('0x6'));var sox=require(_0x6773('0x7'));var csv=require(_0x6773('0x8'));var ejs=require(_0x6773('0x9'));var fs=require('fs');var fs_extra=require(_0x6773('0xa'));var _=require(_0x6773('0xb'));var squel=require(_0x6773('0xc'));var crypto=require(_0x6773('0xd'));var jsforce=require(_0x6773('0xe'));var deskjs=require(_0x6773('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6773('0x10'));var Papa=require(_0x6773('0x11'));var Redis=require(_0x6773('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6773('0x13'));var logger=require(_0x6773('0x14'))(_0x6773('0x15'));var utils=require('../../config/utils');var config=require(_0x6773('0x16'));var licenseUtil=require(_0x6773('0x17'));var db=require(_0x6773('0x18'))['db'];function respondWithStatusCode(_0x1e68ae,_0x1b47e2){_0x1b47e2=_0x1b47e2||0xcc;return function(_0x4aabea){if(_0x4aabea){return _0x1e68ae['sendStatus'](_0x1b47e2);}return _0x1e68ae['status'](_0x1b47e2)[_0x6773('0x19')]();};}function respondWithResult(_0x98dfbe,_0x4c2b9c){_0x4c2b9c=_0x4c2b9c||0xc8;return function(_0x4afa77){if(_0x4afa77){return _0x98dfbe[_0x6773('0x1a')](_0x4c2b9c)[_0x6773('0x1b')](_0x4afa77);}};}function respondWithFilteredResult(_0x241de9,_0x9c1850){return function(_0x2b9f8a){if(_0x2b9f8a){var _0x5883f3=typeof _0x9c1850[_0x6773('0x1c')]===_0x6773('0x1d')&&typeof _0x9c1850['limit']==='undefined';var _0x2ca55f=_0x2b9f8a['count'];var _0x3bba78=_0x5883f3?0x0:_0x9c1850[_0x6773('0x1c')];var _0x444e46=_0x5883f3?_0x2b9f8a[_0x6773('0x1e')]:_0x9c1850[_0x6773('0x1c')]+_0x9c1850['limit'];var _0x324f90;if(_0x444e46>=_0x2ca55f){_0x444e46=_0x2ca55f;_0x324f90=0xc8;}else{_0x324f90=0xce;}_0x241de9[_0x6773('0x1a')](_0x324f90);return _0x241de9[_0x6773('0x1f')](_0x6773('0x20'),_0x3bba78+'-'+_0x444e46+'/'+_0x2ca55f)[_0x6773('0x1b')](_0x2b9f8a);}return null;};}function patchUpdates(_0x4a55ef){return function(_0x376f69){try{jsonpatch[_0x6773('0x21')](_0x376f69,_0x4a55ef,!![]);}catch(_0x5131ec){return BPromise[_0x6773('0x22')](_0x5131ec);}return _0x376f69[_0x6773('0x23')]();};}function saveUpdates(_0x16d264,_0x3bcd13){return function(_0x890e55){if(_0x890e55){return _0x890e55['update'](_0x16d264)[_0x6773('0x24')](function(_0x5bc81a){return _0x5bc81a;});}return null;};}function removeEntity(_0x435498,_0x25d99c){return function(_0x212e4c){if(_0x212e4c){return _0x212e4c['destroy']()[_0x6773('0x24')](function(){var _0x21a612=_0x212e4c[_0x6773('0x25')]({'plain':!![]});var _0x2e6d06=_0x6773('0x26');return db[_0x6773('0x27')]['destroy']({'where':{'type':_0x2e6d06,'resourceId':_0x21a612['id']}})[_0x6773('0x24')](function(){return _0x212e4c;});})[_0x6773('0x24')](function(){_0x435498[_0x6773('0x1a')](0xcc)[_0x6773('0x19')]();});}};}function handleEntityNotFound(_0x56f8b5,_0x547d66){return function(_0x41a3a8){if(!_0x41a3a8){_0x56f8b5[_0x6773('0x28')](0x194);}return _0x41a3a8;};}function handleError(_0xfccda1,_0x51735a){_0x51735a=_0x51735a||0x1f4;return function(_0x2113c3){logger[_0x6773('0x29')](_0x2113c3[_0x6773('0x2a')]);if(_0x2113c3[_0x6773('0x2b')]){delete _0x2113c3['name'];}_0xfccda1[_0x6773('0x1a')](_0x51735a)['send'](_0x2113c3);};}exports['index']=function(_0x2406b9,_0x174a38){var _0x44f446={},_0x355349={},_0x5ebab3={'count':0x0,'rows':[]};return db[_0x6773('0x2c')]['describe']()['then'](function(_0x178e6d){_0x355349[_0x6773('0x2d')]=_[_0x6773('0x2e')](_0x178e6d);_0x355349[_0x6773('0x2f')]=_[_0x6773('0x2e')](_0x2406b9[_0x6773('0x2f')]);_0x355349['filters']=_['intersection'](_0x355349['model'],_0x355349[_0x6773('0x2f')]);_0x44f446[_0x6773('0x30')]=_[_0x6773('0x31')](_0x355349[_0x6773('0x2d')],qs[_0x6773('0x32')](_0x2406b9[_0x6773('0x2f')]['fields']));_0x44f446[_0x6773('0x30')]=_0x44f446['attributes'][_0x6773('0x33')]?_0x44f446['attributes']:_0x355349[_0x6773('0x2d')];if(!_0x2406b9[_0x6773('0x2f')][_0x6773('0x34')]('nolimit')){_0x44f446['limit']=qs[_0x6773('0x35')](_0x2406b9[_0x6773('0x2f')][_0x6773('0x35')]);_0x44f446[_0x6773('0x1c')]=qs[_0x6773('0x1c')](_0x2406b9[_0x6773('0x2f')][_0x6773('0x1c')]);}_0x44f446[_0x6773('0x36')]=qs[_0x6773('0x37')](_0x2406b9[_0x6773('0x2f')][_0x6773('0x37')]);_0x44f446['where']=qs[_0x6773('0x38')](_[_0x6773('0x39')](_0x2406b9[_0x6773('0x2f')],_0x355349[_0x6773('0x38')]),_0x178e6d);if(_0x2406b9['query'][_0x6773('0x3a')]){_0x44f446[_0x6773('0x3b')]=_[_0x6773('0x3c')](_0x44f446[_0x6773('0x3b')],{'$or':_[_0x6773('0x3d')](_0x44f446[_0x6773('0x30')],function(_0xac8364){var _0x4e476b={};_0x4e476b[_0xac8364]={'$like':'%'+_0x2406b9['query'][_0x6773('0x3a')]+'%'};return _0x4e476b;})});}_0x44f446=_[_0x6773('0x3c')]({},_0x44f446,_0x2406b9[_0x6773('0x3e')]);var _0xbce8d3={'where':_0x44f446['where']};return db['CmCompany'][_0x6773('0x1e')](_0xbce8d3)[_0x6773('0x24')](function(_0x18c1f5){_0x5ebab3[_0x6773('0x1e')]=_0x18c1f5;if(_0x2406b9['query'][_0x6773('0x3f')]){_0x44f446[_0x6773('0x40')]=[{'all':!![]}];}return db[_0x6773('0x2c')][_0x6773('0x41')](_0x44f446);})[_0x6773('0x24')](function(_0x200f4a){_0x5ebab3[_0x6773('0x42')]=_0x200f4a;return _0x5ebab3;})[_0x6773('0x24')](respondWithFilteredResult(_0x174a38,_0x44f446))['catch'](handleError(_0x174a38,null));})[_0x6773('0x43')](handleError(_0x174a38,null));};exports[_0x6773('0x44')]=function(_0x108f43,_0x3625a7){var _0x4e3a42={'raw':![],'where':{'id':_0x108f43[_0x6773('0x45')]['id']}},_0x5a17a6={};_0x5a17a6[_0x6773('0x2d')]=_[_0x6773('0x2e')](db['CmCompany'][_0x6773('0x46')]);_0x5a17a6[_0x6773('0x2f')]=_['keys'](_0x108f43[_0x6773('0x2f')]);_0x5a17a6[_0x6773('0x38')]=_[_0x6773('0x31')](_0x5a17a6[_0x6773('0x2d')],_0x5a17a6[_0x6773('0x2f')]);_0x4e3a42[_0x6773('0x30')]=_[_0x6773('0x31')](_0x5a17a6[_0x6773('0x2d')],qs[_0x6773('0x32')](_0x108f43[_0x6773('0x2f')][_0x6773('0x32')]));_0x4e3a42['attributes']=_0x4e3a42['attributes'][_0x6773('0x33')]?_0x4e3a42['attributes']:_0x5a17a6['model'];if(_0x108f43[_0x6773('0x2f')][_0x6773('0x3f')]){_0x4e3a42['include']=[{'all':!![]}];}_0x4e3a42=_[_0x6773('0x3c')]({},_0x4e3a42,_0x108f43[_0x6773('0x3e')]);return db['CmCompany'][_0x6773('0x47')](_0x4e3a42)[_0x6773('0x24')](handleEntityNotFound(_0x3625a7,null))['then'](respondWithResult(_0x3625a7,null))['catch'](handleError(_0x3625a7,null));};exports[_0x6773('0x48')]=function(_0x477b22,_0x118950){return db[_0x6773('0x2c')]['create'](_0x477b22['body'],{})['then'](function(_0x47d768){var _0x2549ef=_0x477b22[_0x6773('0x49')]['get']({'plain':!![]});if(!_0x2549ef)throw new Error(_0x6773('0x4a'));if(_0x2549ef[_0x6773('0x4b')]===_0x6773('0x49')){var _0x5aecf0=_0x47d768[_0x6773('0x25')]({'plain':!![]});var _0x5764fc=_0x6773('0x26');return db['UserProfileSection'][_0x6773('0x47')]({'where':{'name':_0x5764fc,'userProfileId':_0x2549ef[_0x6773('0x4c')]},'raw':!![]})[_0x6773('0x24')](function(_0x2dd27f){if(_0x2dd27f&&_0x2dd27f[_0x6773('0x4d')]===0x0){return db['UserProfileResource'][_0x6773('0x48')]({'name':_0x5aecf0['name'],'resourceId':_0x5aecf0['id'],'type':_0x2dd27f['name'],'sectionId':_0x2dd27f['id']},{})['then'](function(){return _0x47d768;});}else{return _0x47d768;}})['catch'](function(_0x229e27){logger[_0x6773('0x29')](_0x6773('0x4e'),_0x229e27);throw _0x229e27;});}return _0x47d768;})['then'](respondWithResult(_0x118950,0xc9))[_0x6773('0x43')](handleError(_0x118950,null));};exports[_0x6773('0x4f')]=function(_0x549227,_0x1abfeb){if(_0x549227[_0x6773('0x50')]['id']){delete _0x549227['body']['id'];}return db['CmCompany']['find']({'where':{'id':_0x549227[_0x6773('0x45')]['id']}})[_0x6773('0x24')](handleEntityNotFound(_0x1abfeb,null))[_0x6773('0x24')](saveUpdates(_0x549227[_0x6773('0x50')],null))[_0x6773('0x24')](respondWithResult(_0x1abfeb,null))['catch'](handleError(_0x1abfeb,null));};exports[_0x6773('0x51')]=function(_0x499e8c,_0x1fe567){return db[_0x6773('0x2c')][_0x6773('0x47')]({'where':{'id':_0x499e8c[_0x6773('0x45')]['id']}})[_0x6773('0x24')](handleEntityNotFound(_0x1fe567,null))[_0x6773('0x24')](removeEntity(_0x1fe567,null))[_0x6773('0x43')](handleError(_0x1fe567,null));};exports[_0x6773('0x52')]=function(_0x4d82f2,_0x505c2f){return db[_0x6773('0x2c')][_0x6773('0x52')]()['then'](respondWithResult(_0x505c2f,null))[_0x6773('0x43')](handleError(_0x505c2f,null));};exports[_0x6773('0x53')]=function(_0x38ff6d,_0x5d67df,_0xba08f4){return db['CmContact']['find']({'where':{'id':_0x38ff6d[_0x6773('0x45')]['id']}})[_0x6773('0x24')](handleEntityNotFound(_0x5d67df,null))[_0x6773('0x24')](function(_0xf71307){if(_0xf71307){return _0xf71307[_0x6773('0x53')](_0x38ff6d[_0x6773('0x50')][_0x6773('0x54')],_['omit'](_0x38ff6d[_0x6773('0x50')],[_0x6773('0x54'),'id'])||{});}})['then'](respondWithResult(_0x5d67df,null))['catch'](handleError(_0x5d67df,null));};exports[_0x6773('0x55')]=function(_0x248aac,_0xa06cb5,_0xfa9ea0){var _0x4d6a8d={};var _0x3c7e7e={};var _0x29aec1;var _0x4297bb;return db['CmCompany'][_0x6773('0x56')]({'where':{'id':_0x248aac[_0x6773('0x45')]['id']}})['then'](handleEntityNotFound(_0xa06cb5,null))[_0x6773('0x24')](function(_0x179617){if(_0x179617){_0x29aec1=_0x179617;_0x3c7e7e[_0x6773('0x2d')]=_['keys'](db[_0x6773('0x57')][_0x6773('0x46')]);_0x3c7e7e[_0x6773('0x2f')]=_['keys'](_0x248aac['query']);_0x3c7e7e[_0x6773('0x38')]=_[_0x6773('0x31')](_0x3c7e7e[_0x6773('0x2d')],_0x3c7e7e[_0x6773('0x2f')]);_0x4d6a8d[_0x6773('0x30')]=_[_0x6773('0x31')](_0x3c7e7e['model'],qs[_0x6773('0x32')](_0x248aac[_0x6773('0x2f')][_0x6773('0x32')]));_0x4d6a8d['attributes']=_0x4d6a8d[_0x6773('0x30')]['length']?_0x4d6a8d[_0x6773('0x30')]:_0x3c7e7e[_0x6773('0x2d')];_0x4d6a8d[_0x6773('0x36')]=qs[_0x6773('0x37')](_0x248aac[_0x6773('0x2f')]['sort']);_0x4d6a8d['where']=qs[_0x6773('0x38')](_[_0x6773('0x39')](_0x248aac[_0x6773('0x2f')],_0x3c7e7e[_0x6773('0x38')]));if(_0x248aac[_0x6773('0x2f')][_0x6773('0x3a')]){_0x4d6a8d[_0x6773('0x3b')]=_[_0x6773('0x3c')](_0x4d6a8d[_0x6773('0x3b')],{'$or':_[_0x6773('0x3d')](_0x4d6a8d['attributes'],function(_0x385acc){var _0x195119={};_0x195119[_0x385acc]={'$like':'%'+_0x248aac[_0x6773('0x2f')][_0x6773('0x3a')]+'%'};return _0x195119;})});}_0x4d6a8d=_['merge']({},_0x4d6a8d,_0x248aac[_0x6773('0x3e')]);return _0x29aec1['getContacts'](_0x4d6a8d);}})[_0x6773('0x24')](function(_0x3a3e24){if(_0x3a3e24){_0x4297bb=_0x3a3e24['length'];if(!_0x248aac[_0x6773('0x2f')][_0x6773('0x34')](_0x6773('0x58'))){_0x4d6a8d[_0x6773('0x35')]=qs[_0x6773('0x35')](_0x248aac[_0x6773('0x2f')][_0x6773('0x35')]);_0x4d6a8d[_0x6773('0x1c')]=qs[_0x6773('0x1c')](_0x248aac[_0x6773('0x2f')][_0x6773('0x1c')]);}return _0x29aec1[_0x6773('0x55')](_0x4d6a8d);}})[_0x6773('0x24')](function(_0x526d46){if(_0x526d46){return _0x526d46?{'count':_0x4297bb,'rows':_0x526d46}:null;}})['then'](respondWithResult(_0xa06cb5,null))['catch'](handleError(_0xa06cb5,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 9c4cd7a..0ab58c0 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 _0x236b=['rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x236b,0x158));var _0xb236=function(_0x574607,_0x3cfc23){_0x574607=_0x574607-0x0;var _0x3398c9=_0x236b[_0x574607];return _0x3398c9;};'use strict';var _=require(_0xb236('0x0'));var util=require(_0xb236('0x1'));var logger=require(_0xb236('0x2'))(_0xb236('0x3'));var moment=require(_0xb236('0x4'));var BPromise=require('bluebird');var rp=require(_0xb236('0x5'));var fs=require('fs');var path=require(_0xb236('0x6'));var rimraf=require(_0xb236('0x7'));var config=require(_0xb236('0x8'));var attributes=require(_0xb236('0x9'));module[_0xb236('0xa')]=function(_0x148661,_0x361ae0){return _0x148661['define'](_0xb236('0xb'),attributes,{'tableName':_0xb236('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13b9=['api','bluebird','request-promise','path','rimraf','./cmCompany.attributes','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x572255,_0x486db9){var _0x5196e9=function(_0x439c28){while(--_0x439c28){_0x572255['push'](_0x572255['shift']());}};_0x5196e9(++_0x486db9);}(_0x13b9,0xad));var _0x913b=function(_0x30188e,_0x3c4f44){_0x30188e=_0x30188e-0x0;var _0xac7d52=_0x13b9[_0x30188e];return _0xac7d52;};'use strict';var _=require(_0x913b('0x0'));var util=require(_0x913b('0x1'));var logger=require(_0x913b('0x2'))(_0x913b('0x3'));var moment=require('moment');var BPromise=require(_0x913b('0x4'));var rp=require(_0x913b('0x5'));var fs=require('fs');var path=require(_0x913b('0x6'));var rimraf=require(_0x913b('0x7'));var config=require('../../config/environment');var attributes=require(_0x913b('0x8'));module['exports']=function(_0x44b30c,_0x31a4a2){return _0x44b30c['define'](_0x913b('0x9'),attributes,{'tableName':_0x913b('0xa'),'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 a60f7b0..ff721b6 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 _0x6502=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x4b39cf,_0x2b4885){var _0x297208=function(_0x2dcbc9){while(--_0x2dcbc9){_0x4b39cf['push'](_0x4b39cf['shift']());}};_0x297208(++_0x2b4885);}(_0x6502,0x135));var _0x2650=function(_0x342fca,_0x572bdf){_0x342fca=_0x342fca-0x0;var _0x59c1a2=_0x6502[_0x342fca];return _0x59c1a2;};'use strict';var _=require(_0x2650('0x0'));var util=require(_0x2650('0x1'));var moment=require(_0x2650('0x2'));var BPromise=require(_0x2650('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2650('0x4'));var db=require(_0x2650('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2650('0x6'))(_0x2650('0x7'));var config=require(_0x2650('0x8'));var jayson=require(_0x2650('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c05be,_0x1efab2,_0x537132){return new BPromise(function(_0x4155ce,_0x155c6b){return client['request'](_0x3c05be,_0x537132)[_0x2650('0xa')](function(_0x23f51e){logger[_0x2650('0xb')](_0x2650('0xc'),_0x1efab2,_0x2650('0xd'));logger[_0x2650('0xe')](_0x2650('0xf'),_0x1efab2,'request\x20sent',JSON['stringify'](_0x23f51e));if(_0x23f51e[_0x2650('0x10')]){if(_0x23f51e[_0x2650('0x10')][_0x2650('0x11')]===0x1f4){logger[_0x2650('0x10')](_0x2650('0xc'),_0x1efab2,_0x23f51e['error']['message']);return _0x155c6b(_0x23f51e[_0x2650('0x10')][_0x2650('0x12')]);}logger[_0x2650('0x10')](_0x2650('0xc'),_0x1efab2,_0x23f51e[_0x2650('0x10')]['message']);return _0x4155ce(_0x23f51e['error'][_0x2650('0x12')]);}else{logger['info'](_0x2650('0xc'),_0x1efab2,_0x2650('0xd'));_0x4155ce(_0x23f51e['result'][_0x2650('0x12')]);}})[_0x2650('0x13')](function(_0x4dc7fd){logger[_0x2650('0x10')](_0x2650('0xc'),_0x1efab2,_0x4dc7fd);_0x155c6b(_0x4dc7fd);});});} \ No newline at end of file +var _0xe58f=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1be448,_0x1fb778){var _0x39a54d=function(_0x335cf9){while(--_0x335cf9){_0x1be448['push'](_0x1be448['shift']());}};_0x39a54d(++_0x1fb778);}(_0xe58f,0x113));var _0xfe58=function(_0x23fdaa,_0x15302b){_0x23fdaa=_0x23fdaa-0x0;var _0x540a39=_0xe58f[_0x23fdaa];return _0x540a39;};'use strict';var _=require(_0xfe58('0x0'));var util=require('util');var moment=require(_0xfe58('0x1'));var BPromise=require(_0xfe58('0x2'));var rs=require(_0xfe58('0x3'));var fs=require('fs');var Redis=require(_0xfe58('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe58('0x5'));var logger=require('../../config/logger')(_0xfe58('0x6'));var config=require(_0xfe58('0x7'));var jayson=require(_0xfe58('0x8'));var client=jayson[_0xfe58('0x9')][_0xfe58('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dcef2,_0x1270b0,_0x482d7a){return new BPromise(function(_0x159510,_0x26aaab){return client['request'](_0x2dcef2,_0x482d7a)['then'](function(_0x6805b9){logger[_0xfe58('0xb')](_0xfe58('0xc'),_0x1270b0,_0xfe58('0xd'));logger[_0xfe58('0xe')](_0xfe58('0xf'),_0x1270b0,_0xfe58('0xd'),JSON[_0xfe58('0x10')](_0x6805b9));if(_0x6805b9[_0xfe58('0x11')]){if(_0x6805b9[_0xfe58('0x11')][_0xfe58('0x12')]===0x1f4){logger[_0xfe58('0x11')]('CmCompany,\x20%s,\x20%s',_0x1270b0,_0x6805b9['error']['message']);return _0x26aaab(_0x6805b9[_0xfe58('0x11')][_0xfe58('0x13')]);}logger[_0xfe58('0x11')](_0xfe58('0xc'),_0x1270b0,_0x6805b9[_0xfe58('0x11')][_0xfe58('0x13')]);return _0x159510(_0x6805b9[_0xfe58('0x11')][_0xfe58('0x13')]);}else{logger[_0xfe58('0xb')]('CmCompany,\x20%s,\x20%s',_0x1270b0,_0xfe58('0xd'));_0x159510(_0x6805b9[_0xfe58('0x14')][_0xfe58('0x13')]);}})['catch'](function(_0x58ef91){logger['error'](_0xfe58('0xc'),_0x1270b0,_0x58ef91);_0x26aaab(_0x58ef91);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index db41fd0..b35e74a 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 _0x8344=['describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','update','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','get','/describe'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x8344,0x1c2));var _0x4834=function(_0x2d540e,_0x507489){_0x2d540e=_0x2d540e-0x0;var _0x3b1161=_0x8344[_0x2d540e];return _0x3b1161;};'use strict';var multer=require(_0x4834('0x0'));var util=require(_0x4834('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4834('0x2'));var router=express[_0x4834('0x3')]();var fs_extra=require(_0x4834('0x4'));var auth=require(_0x4834('0x5'));var interaction=require(_0x4834('0x6'));var config=require(_0x4834('0x7'));var controller=require(_0x4834('0x8'));router['get']('/',auth[_0x4834('0x9')](),controller['index']);router[_0x4834('0xa')](_0x4834('0xb'),auth[_0x4834('0x9')](),controller[_0x4834('0xc')]);router[_0x4834('0xa')](_0x4834('0xd'),auth[_0x4834('0x9')](),controller[_0x4834('0xe')]);router[_0x4834('0xa')](_0x4834('0xf'),auth[_0x4834('0x9')](),controller[_0x4834('0x10')]);router[_0x4834('0x11')]('/',auth[_0x4834('0x9')](),controller[_0x4834('0x12')]);router['post'](_0x4834('0xf'),auth[_0x4834('0x9')](),controller[_0x4834('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4834('0x14')]);router['delete'](_0x4834('0xd'),auth[_0x4834('0x9')](),controller['destroy']);module[_0x4834('0x15')]=router; \ No newline at end of file +var _0x0068=['../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','post','addContacts','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x484646,_0xa7feed){var _0x296c03=function(_0x178910){while(--_0x178910){_0x484646['push'](_0x484646['shift']());}};_0x296c03(++_0xa7feed);}(_0x0068,0x15a));var _0x8006=function(_0x5d4a21,_0x3c715d){_0x5d4a21=_0x5d4a21-0x0;var _0x4336a4=_0x0068[_0x5d4a21];return _0x4336a4;};'use strict';var multer=require(_0x8006('0x0'));var util=require(_0x8006('0x1'));var path=require(_0x8006('0x2'));var timeout=require('connect-timeout');var express=require(_0x8006('0x3'));var router=express[_0x8006('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8006('0x5'));var config=require(_0x8006('0x6'));var controller=require(_0x8006('0x7'));router[_0x8006('0x8')]('/',auth[_0x8006('0x9')](),controller[_0x8006('0xa')]);router[_0x8006('0x8')](_0x8006('0xb'),auth[_0x8006('0x9')](),controller[_0x8006('0xc')]);router[_0x8006('0x8')]('/:id',auth[_0x8006('0x9')](),controller[_0x8006('0xd')]);router[_0x8006('0x8')]('/:id/contacts',auth[_0x8006('0x9')](),controller['getContacts']);router[_0x8006('0xe')]('/',auth[_0x8006('0x9')](),controller['create']);router[_0x8006('0xe')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x8006('0xf')]);router[_0x8006('0x10')](_0x8006('0x11'),auth[_0x8006('0x9')](),controller[_0x8006('0x12')]);router[_0x8006('0x13')]('/:id',auth[_0x8006('0x9')](),controller[_0x8006('0x14')]);module[_0x8006('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 3d66ed6..96ad41e 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 _0x973c=['lodash','exports','STRING','INTEGER','DATE','NOW'];(function(_0x386220,_0x35e9e1){var _0x5a0da1=function(_0x3b8c8e){while(--_0x3b8c8e){_0x386220['push'](_0x386220['shift']());}};_0x5a0da1(++_0x35e9e1);}(_0x973c,0x1d4));var _0xc973=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x973c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc973('0x0'));var Sequelize=require('sequelize');module[_0xc973('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xc973('0x2')]},'postalCode':{'type':Sequelize[_0xc973('0x2')]},'city':{'type':Sequelize[_0xc973('0x2')]},'country':{'type':Sequelize[_0xc973('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xc973('0x2')]},'mobile':{'type':Sequelize[_0xc973('0x2')]},'fax':{'type':Sequelize[_0xc973('0x2')]},'email':{'type':Sequelize[_0xc973('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xc973('0x2')]},'fb_data':{'type':Sequelize[_0xc973('0x2')]},'twitter':{'type':Sequelize[_0xc973('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xc973('0x2')]},'wechat':{'type':Sequelize[_0xc973('0x2')]},'telegram':{'type':Sequelize[_0xc973('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xc973('0x2')]},'priority':{'type':Sequelize[_0xc973('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc973('0x4')],'defaultValue':Sequelize[_0xc973('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xc973('0x3')]}}; \ No newline at end of file +var _0x24f1=['lodash','sequelize','exports','STRING','TEXT','INTEGER','DATE'];(function(_0x5bd18f,_0x1bd227){var _0x41944c=function(_0x7b5e15){while(--_0x7b5e15){_0x5bd18f['push'](_0x5bd18f['shift']());}};_0x41944c(++_0x1bd227);}(_0x24f1,0xb6));var _0x124f=function(_0x16c9a4,_0x37559c){_0x16c9a4=_0x16c9a4-0x0;var _0x261dfa=_0x24f1[_0x16c9a4];return _0x261dfa;};'use strict';var _=require(_0x124f('0x0'));var Sequelize=require(_0x124f('0x1'));module[_0x124f('0x2')]={'firstName':{'type':Sequelize[_0x124f('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x124f('0x3')]},'street':{'type':Sequelize[_0x124f('0x3')]},'postalCode':{'type':Sequelize[_0x124f('0x3')]},'city':{'type':Sequelize[_0x124f('0x3')]},'country':{'type':Sequelize[_0x124f('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x124f('0x4')]},'phone':{'type':Sequelize[_0x124f('0x3')]},'mobile':{'type':Sequelize[_0x124f('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x124f('0x3')]},'url':{'type':Sequelize[_0x124f('0x3')]},'facebook':{'type':Sequelize[_0x124f('0x3')]},'fb_data':{'type':Sequelize[_0x124f('0x3')]},'twitter':{'type':Sequelize[_0x124f('0x3')]},'skype':{'type':Sequelize[_0x124f('0x3')]},'teams':{'type':Sequelize[_0x124f('0x3')]},'viber':{'type':Sequelize[_0x124f('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x124f('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x124f('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x124f('0x3')]},'priority':{'type':Sequelize[_0x124f('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x124f('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x124f('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 839275d..7cb90f8 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 _0x8142=['path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','status','json','offset','undefined','count','update','destroy','then','end','sendStatus','error','stack','name','index','describe','findAll','query','CmContact','find','catch','keys','startsWith','cf_','columnName','displayName','analytics','CmCustomField','length','alias','custom','type','info','hasOwnProperty','body','from','get','mergeWith','isArray','tags','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','MailQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','isNil','dialTimezone','timezones','additionalPhones','each','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','all','show','Tags','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','format','cf_%d','utcOffset','params','map','table','cm_contacts','id\x20=\x20?','text','values','CmHopper','phone','findOne','model','Tag','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','options','getTags','nolimit','limit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','item','PHONE','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmHopperAdditionalPhone','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','ContactId','includeAll','include','rows','getHopperHistories','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','child_process','fork','../../components/import/cm/csv','binding_keys','CompanyId','pid','send','upload','createReadStream','parse','meta','import','User','agent','No\x20ListId\x20specified','binding','No\x20phone\x20column\x20specified','join','../../components/import/cm/csv2','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','stringify','mail','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','endtime','duration','note','userDisposition','fullname','DESC','VoiceCallReport','findAndCountAll','startCase','chat','Website','Account','createdAt','disposition','secondDisposition','thirdDisposition','UserId','key','Owner','browserName','customerIp','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','openchannel','externalUrl','flatten','sortBy','reverse','value','slice','moment','bluebird','util'];(function(_0x53e986,_0x20f21f){var _0x290b59=function(_0x2652ef){while(--_0x2652ef){_0x53e986['push'](_0x53e986['shift']());}};_0x290b59(++_0x20f21f);}(_0x8142,0xfa));var _0x2814=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x8142[_0x1b51ea];return _0x18bbdc;};'use strict';var moment=require(_0x2814('0x0'));var BPromise=require(_0x2814('0x1'));var util=require(_0x2814('0x2'));var path=require(_0x2814('0x3'));var fs=require('fs');var _=require(_0x2814('0x4'));var squel=require(_0x2814('0x5'));var Papa=require(_0x2814('0x6'));var Redis=require(_0x2814('0x7'));var contacts=require(_0x2814('0x8'));var qs=require(_0x2814('0x9'));var logger=require(_0x2814('0xa'))(_0x2814('0xb'));var config=require(_0x2814('0xc'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config[_0x2814('0xd')]=_['defaults'](config[_0x2814('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2814('0xd')]));require('./cmContact.socket')['register'](socket);function respondWithResult(_0x56f51c,_0x4dd874){_0x4dd874=_0x4dd874||0xc8;return function(_0x2fe985){if(_0x2fe985){return _0x56f51c[_0x2814('0xe')](_0x4dd874)[_0x2814('0xf')](_0x2fe985);}};}function respondWithFilteredResult(_0x591049,_0x500b22){return function(_0x50de76){if(_0x50de76){var _0x482417=typeof _0x500b22[_0x2814('0x10')]===_0x2814('0x11')&&typeof _0x500b22['limit']===_0x2814('0x11');var _0x5b48c3=_0x50de76[_0x2814('0x12')];var _0x2dac02=_0x482417?0x0:_0x500b22['offset'];var _0x29192d=_0x482417?_0x50de76[_0x2814('0x12')]:_0x500b22[_0x2814('0x10')]+_0x500b22['limit'];var _0xe7d8da;if(_0x29192d>=_0x5b48c3){_0x29192d=_0x5b48c3;_0xe7d8da=0xc8;}else{_0xe7d8da=0xce;}_0x591049[_0x2814('0xe')](_0xe7d8da);return _0x591049['set']('Content-Range',_0x2dac02+'-'+_0x29192d+'/'+_0x5b48c3)['json'](_0x50de76);}return null;};}function saveUpdates(_0x57feb7){return function(_0x37d55e){if(_0x37d55e){return _0x37d55e[_0x2814('0x13')](_0x57feb7)['then'](function(_0x3ce015){return _0x3ce015;});}return null;};}function removeEntity(_0x62695a){return function(_0x136a02){if(_0x136a02){return _0x136a02[_0x2814('0x14')]()[_0x2814('0x15')](function(){_0x62695a[_0x2814('0xe')](0xcc)[_0x2814('0x16')]();});}};}function handleEntityNotFound(_0xf2b090){return function(_0x131f4b){if(!_0x131f4b){_0xf2b090[_0x2814('0x17')](0x194);}return _0x131f4b;};}function handleError(_0x6d7337,_0xfc76b){_0xfc76b=_0xfc76b||0x1f4;return function(_0x45193c){logger[_0x2814('0x18')](_0x45193c[_0x2814('0x19')]);if(_0x45193c['name']){delete _0x45193c[_0x2814('0x1a')];}_0x6d7337['status'](_0xfc76b)['send'](_0x45193c);};}exports[_0x2814('0x1b')]=function(_0x530ce6,_0x52492f){var _0x35d63c={};return contacts[_0x2814('0x1c')]()['then'](function(_0x4c52f9){_0x35d63c=qs['getOptions'](_0x4c52f9,_0x530ce6);return contacts[_0x2814('0x1d')](_0x530ce6[_0x2814('0x1e')],_0x530ce6['user'],_0x35d63c,_0x4c52f9);})['then'](respondWithFilteredResult(_0x52492f,_0x35d63c))['catch'](handleError(_0x52492f,null));};exports[_0x2814('0x14')]=function(_0x5ef5c3,_0x8c9279){return db[_0x2814('0x1f')][_0x2814('0x20')]({'where':{'id':_0x5ef5c3['params']['id']}})['then'](handleEntityNotFound(_0x8c9279,null))[_0x2814('0x15')](removeEntity(_0x8c9279,null))[_0x2814('0x21')](handleError(_0x8c9279,null));};exports[_0x2814('0x1c')]=function(_0x318aad,_0x292e1a){return db[_0x2814('0x1f')]['describe']()[_0x2814('0x15')](function(_0x125756){delete _0x125756['tags'];for(var _0x265539=0x0;_0x2655390x0){return new Promise(function(_0x562751){var _0xcbe5fc=[];for(var _0x2ebb5b=0x0;_0x2ebb5b<_0x541022[_0x2814('0x29')];_0x2ebb5b++){_0xcbe5fc[_0x2814('0x52')](insertAdditionalPhones(_0x541022[_0x2ebb5b][_0x2814('0x56')],_0x541022[_0x2ebb5b]['additionalPhones']));}Promise[_0x2814('0x57')](_0xcbe5fc)[_0x2814('0x15')](function(){_0x562751(0x1);});})[_0x2814('0x15')](function(){return{'success':_0x440f5c,'failure':_0x35cf06,'duplicates':_0x3665a2};});}else{return{'success':_0x440f5c,'failure':_0x35cf06,'duplicates':_0x3665a2};}}})[_0x2814('0x15')](respondWithResult(_0x11281b,0xc9))['catch'](handleError(_0x11281b,null));};exports[_0x2814('0x58')]=function(_0x25b9fa,_0x23e01b){var _0xd26486;return db[_0x2814('0x1f')][_0x2814('0x1c')]()['then'](function(_0x41d8b6){return db[_0x2814('0x1f')][_0x2814('0x20')]({'where':{'id':_0x25b9fa['params']['id']},'include':[{'model':db['Tag'],'as':_0x2814('0x59'),'attributes':['id',_0x2814('0x1a'),_0x2814('0x5a')],'required':_0x25b9fa['query'][_0x2814('0x5b')]?!![]:![]},{'model':db[_0x2814('0x42')],'as':_0x2814('0x5c'),'where':{'CmContactId':_0x25b9fa['params']['id']},'required':![],'include':[{'model':db[_0x2814('0x5d')],'as':_0x2814('0x5e')}]}],'order':[db[_0x2814('0x5f')][_0x2814('0x60')](_0x2814('0x61'))],'attributes':_['keys'](_0x41d8b6)});})['then'](function(_0x55e43b){if(!_[_0x2814('0x4a')](_0x55e43b)){_0xd26486=_0x55e43b[_0x2814('0x31')]({'plain':!![]});var _0x3b7898={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x55e43b&&_0x55e43b[_0x2814('0x53')]){if(_0x55e43b['ListId']){_0x3b7898[_0x2814('0x50')][_0x2814('0x62')][_0x2814('0x52')]({'ListId':{'$ne':_0x55e43b[_0x2814('0x53')]}});}}return db[_0x2814('0x28')][_0x2814('0x1d')](_0x3b7898);}})['then'](function(_0xd8b342){if(!_[_0x2814('0x4a')](_0xd8b342)){return _[_0x2814('0x63')](_0xd26486,_['map'](_0xd8b342,function(_0x155026){return util[_0x2814('0x64')](_0x2814('0x65'),_0x155026['id']);}));}})['then'](handleEntityNotFound(_0x23e01b,null))[_0x2814('0x15')](respondWithResult(_0x23e01b,null))[_0x2814('0x21')](handleError(_0x23e01b,null));};exports[_0x2814('0x13')]=function(_0x53a842,_0x5ec661){var _0x33e6be;if(_0x53a842[_0x2814('0x2f')]['id']){delete _0x53a842[_0x2814('0x2f')]['id'];}if(!_[_0x2814('0x4a')](_0x53a842[_0x2814('0x2f')][_0x2814('0x4b')])){var _0x36ac14=_0x53a842[_0x2814('0x2f')][_0x2814('0x4b')];if(!_[_0x2814('0x4a')](shared[_0x2814('0x4c')][_0x36ac14]))_0x53a842['body']['utcOffset']=shared[_0x2814('0x4c')][_0x36ac14][_0x2814('0x66')];}return db[_0x2814('0x1f')]['find']({'where':{'id':_0x53a842[_0x2814('0x67')]['id']}})[_0x2814('0x15')](handleEntityNotFound(_0x5ec661,null))[_0x2814('0x15')](saveUpdates(_0x53a842[_0x2814('0x2f')],null))['then'](function(_0x33a44f){_0x33e6be=_0x33a44f;var _0xb7d520={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x33a44f&&_0x33a44f[_0x2814('0x53')]){if(_0x33a44f[_0x2814('0x53')]){_0xb7d520[_0x2814('0x50')][_0x2814('0x62')][_0x2814('0x52')]({'ListId':{'$ne':_0x33a44f[_0x2814('0x53')]}});}}return db[_0x2814('0x28')][_0x2814('0x1d')](_0xb7d520);})['then'](function(_0x8b3455){if(_0x8b3455){return _[_0x2814('0x63')](_['pickBy'](_0x53a842['body'],function(_0x5172a2,_0x340114){return _[_0x2814('0x23')](_0x340114,_0x2814('0x24'));}),_[_0x2814('0x68')](_0x8b3455,function(_0x4defe3){return util['format'](_0x2814('0x65'),_0x4defe3['id']);}));}})[_0x2814('0x15')](function(_0x2ddedd){if(_0x2ddedd&&!_['isEmpty'](_0x2ddedd)){var _0xdb5b4a=squel[_0x2814('0x13')]()[_0x2814('0x69')](_0x2814('0x6a'))['setFields'](_0x2ddedd)[_0x2814('0x50')](_0x2814('0x6b'),_0x53a842[_0x2814('0x67')]['id'])['toParam']();return db[_0x2814('0x5f')][_0x2814('0x1e')](_0xdb5b4a[_0x2814('0x6c')],{'replacements':_0xdb5b4a[_0x2814('0x6d')]});}})[_0x2814('0x15')](function(){if(_0x53a842[_0x2814('0x2f')]['phone']&&_0x33e6be){return db[_0x2814('0x6e')][_0x2814('0x13')]({'phone':_0x53a842[_0x2814('0x2f')][_0x2814('0x6f')],'OrderBy':0x0},{'where':{'ContactId':_0x33e6be['id']}});}})[_0x2814('0x15')](function(){return _0x33e6be;})[_0x2814('0x15')](respondWithResult(_0x5ec661,null))['catch'](handleError(_0x5ec661,null));};exports['getTags']=function(_0x535dcb,_0x5564ce){var _0xac93be={};var _0xdcb846={};var _0x56b957;var _0x5805c9;return db[_0x2814('0x1f')][_0x2814('0x70')]({'where':{'id':_0x535dcb[_0x2814('0x67')]['id']}})[_0x2814('0x15')](handleEntityNotFound(_0x5564ce,null))[_0x2814('0x15')](function(_0x25c137){if(_0x25c137){_0x56b957=_0x25c137;_0xdcb846[_0x2814('0x71')]=_[_0x2814('0x22')](db[_0x2814('0x72')][_0x2814('0x73')]);_0xdcb846['query']=_[_0x2814('0x22')](_0x535dcb['query']);_0xdcb846[_0x2814('0x74')]=_[_0x2814('0x75')](_0xdcb846[_0x2814('0x71')],_0xdcb846[_0x2814('0x1e')]);_0xac93be[_0x2814('0x76')]=_[_0x2814('0x75')](_0xdcb846[_0x2814('0x71')],qs[_0x2814('0x77')](_0x535dcb['query'][_0x2814('0x77')]));_0xac93be[_0x2814('0x76')]=_0xac93be[_0x2814('0x76')]['length']?_0xac93be['attributes']:_0xdcb846[_0x2814('0x71')];_0xac93be[_0x2814('0x78')]=qs[_0x2814('0x79')](_0x535dcb[_0x2814('0x1e')][_0x2814('0x79')]);_0xac93be['where']=qs[_0x2814('0x74')](_[_0x2814('0x7a')](_0x535dcb[_0x2814('0x1e')],_0xdcb846['filters']));if(_0x535dcb[_0x2814('0x1e')][_0x2814('0x7b')]){_0xac93be[_0x2814('0x50')]=_[_0x2814('0x7c')](_0xac93be[_0x2814('0x50')],{'$or':_[_0x2814('0x68')](_0xac93be['attributes'],function(_0x5dc41b){var _0x2872b5={};_0x2872b5[_0x5dc41b]={'$like':'%'+_0x535dcb[_0x2814('0x1e')]['filter']+'%'};return _0x2872b5;})});}_0xac93be=_['merge']({},_0xac93be,_0x535dcb[_0x2814('0x7d')]);return _0x56b957[_0x2814('0x7e')](_0xac93be);}})[_0x2814('0x15')](function(_0xa4ddbe){if(_0xa4ddbe){_0x5805c9=_0xa4ddbe[_0x2814('0x29')];if(!_0x535dcb[_0x2814('0x1e')][_0x2814('0x2e')](_0x2814('0x7f'))){_0xac93be[_0x2814('0x80')]=qs['limit'](_0x535dcb[_0x2814('0x1e')][_0x2814('0x80')]);_0xac93be[_0x2814('0x10')]=qs[_0x2814('0x10')](_0x535dcb['query'][_0x2814('0x10')]);}return _0x56b957[_0x2814('0x7e')](_0xac93be);}})[_0x2814('0x15')](function(_0x5a2dd4){if(_0x5a2dd4){return _0x5a2dd4?{'count':_0x5805c9,'rows':_0x5a2dd4}:null;}})['then'](respondWithResult(_0x5564ce,null))[_0x2814('0x21')](handleError(_0x5564ce,null));};exports[_0x2814('0x81')]=function(_0x43b932,_0x1b1021){if(_0x43b932['body']['id']){delete _0x43b932[_0x2814('0x2f')]['id'];}return db[_0x2814('0x1f')][_0x2814('0x70')]({'where':{'id':_0x43b932['params']['id']}})[_0x2814('0x15')](handleEntityNotFound(_0x1b1021,null))[_0x2814('0x15')](function(_0x4967be){if(_0x4967be){return _0x4967be[_0x2814('0x81')](_0x43b932['body'][_0x2814('0x82')]||[]);}return null;})[_0x2814('0x15')](respondWithResult(_0x1b1021,null))[_0x2814('0x21')](handleError(_0x1b1021,null));};exports[_0x2814('0x83')]=function(_0x2405d3,_0x2189fc){var _0x5e70e4=[];_0x5e70e4[_0x2814('0x52')](addAdditionalPhones(_0x2405d3[_0x2814('0x2f')]));Promise['all'](_0x5e70e4)[_0x2814('0x15')](function(){_0x5e70e4=[];_0x5e70e4[_0x2814('0x52')](deleteCmHopperPhones(_0x2405d3['body']['id']));_0x5e70e4[_0x2814('0x52')](addCmHopperPhones(_0x2405d3['body']['id']));Promise[_0x2814('0x57')](_0x5e70e4)[_0x2814('0x15')](function(){return[0x1];})['then'](respondWithResult(_0x2189fc,null));});};function addAdditionalPhones(_0x45cb60){var _0x258db4;return new Promise(function(_0x37ea1d){return db[_0x2814('0x42')][_0x2814('0x14')]({'where':{'CmContactId':_0x45cb60['id']}})['then'](function(){db[_0x2814('0x5d')]['findAll']({'raw':!![],'attributes':['id',_0x2814('0x84')]})[_0x2814('0x15')](function(_0x4e864b){var _0x29d53a=[];for(var _0x291444=0x0;_0x291444<_0x45cb60[_0x2814('0x85')][_0x2814('0x29')];_0x291444++){var _0x11ff3b=_0x45cb60['item_types']?_[_0x2814('0x4a')](_0x45cb60[_0x2814('0x86')][_0x291444])?'':_0x45cb60[_0x2814('0x86')][_0x291444]:_0x45cb60[_0x2814('0x85')][_0x291444][_0x2814('0x87')]?_0x45cb60['items'][_0x291444][_0x2814('0x87')]:'';var _0x2d19a7=_['isNil'](_0x45cb60[_0x2814('0x85')][_0x291444][_0x2814('0x88')])?'':_0x45cb60[_0x2814('0x85')][_0x291444][_0x2814('0x88')];var _0x388912=_0x11ff3b+':'+_0x45cb60[_0x2814('0x85')][_0x291444][_0x2814('0x6f')]+'§'+_0x2d19a7;if(_[_0x2814('0x4a')](_0x258db4))_0x258db4=_0x388912;else _0x258db4+=';'+_0x388912;var _0x310952=null;var _0x34676a=null;if(_0x45cb60['item_types']){if(!_[_0x2814('0x4a')](_0x45cb60[_0x2814('0x86')][_0x291444])){_0x34676a=_['find'](_0x4e864b,function(_0x11d647){return _0x11d647['id']===_0x45cb60['item_types'][_0x291444];});if(!_[_0x2814('0x4a')](_0x34676a)){_0x310952=_0x34676a[_0x2814('0x84')];}}}else{if(!_[_0x2814('0x4a')](_0x45cb60[_0x2814('0x85')][_0x291444])){_0x34676a=_[_0x2814('0x20')](_0x4e864b,function(_0x4355ab){return _0x4355ab['id']===_0x45cb60[_0x2814('0x85')][_0x291444][_0x2814('0x87')];});if(!_['isNil'](_0x34676a)){_0x310952=_0x291444;}}}if(_[_0x2814('0x4a')](_0x310952)){_0x310952=0x64;}_0x29d53a[_0x2814('0x52')](addAdditionalPhone(_0x45cb60['id'],_0x45cb60[_0x2814('0x85')][_0x291444][_0x2814('0x6f')],_0x45cb60['item_types']?_[_0x2814('0x4a')](_0x45cb60[_0x2814('0x86')][_0x291444])?null:_0x45cb60[_0x2814('0x86')][_0x291444]:_0x45cb60[_0x2814('0x85')][_0x291444][_0x2814('0x87')]?_0x45cb60[_0x2814('0x85')][_0x291444][_0x2814('0x87')]:null,_0x310952,_0x2d19a7));}Promise['all'](_0x29d53a)[_0x2814('0x15')](function(){db[_0x2814('0x1f')][_0x2814('0x13')]({'AdditionalPhones':_0x258db4},{'where':{'id':_0x45cb60['id']}})[_0x2814('0x15')](function(){_0x37ea1d(0x1);});});});});});}function addAdditionalPhone(_0x4f73ac,_0x5b2637,_0x590ad2,_0x5b45b6,_0x5d4f30){return db[_0x2814('0x42')][_0x2814('0x20')]({'where':{'CmContactId':_0x4f73ac,'item':_0x5b2637}})['then'](function(_0xc36274){if(_0xc36274)logger[_0x2814('0x2d')](_0x2814('0x89'),_0xc36274);else{db[_0x2814('0x42')][_0x2814('0x38')]({'CmContactId':_0x4f73ac,'item':_0x5b2637,'ItemTypeId':_0x590ad2,'OrderBy':_0x5b45b6,'ItemClass':'PHONE','description':_0x5d4f30});}});}function deleteCmHopperPhones(_0x47564e){return new Promise(function(_0x45ed06){return db[_0x2814('0x6e')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x47564e}})[_0x2814('0x15')](function(_0x38d58d){db['CmHopperAdditionalPhone'][_0x2814('0x14')]({'where':{'CmHopperId':{'$in':_[_0x2814('0x68')](_0x38d58d,'id')}}});})[_0x2814('0x15')](function(){_0x45ed06(0x1);});});}function addCmHopperPhones(_0x1d8ae2){return new Promise(function(_0x4173c4){return db['CmHopper'][_0x2814('0x1d')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d8ae2}})[_0x2814('0x15')](function(_0x53a8fb){var _0x15506a=[];_['map'](_0x53a8fb,function(_0x2518ce){_0x15506a['push'](createCmHopperPhone(_0x1d8ae2,_0x2518ce['id']));});Promise['all'](_0x15506a)[_0x2814('0x15')](function(){_0x4173c4(0x1);});});});}function createCmHopperPhone(_0x5cf0fe,_0x27659f){return new Promise(function(_0x2cf747){db[_0x2814('0x42')][_0x2814('0x1d')]({'raw':!![],'attributes':[_0x2814('0x8a'),_0x2814('0x84')],'where':{'CmContactId':_0x5cf0fe,'ItemClass':_0x2814('0x8b')},'include':[{'model':db[_0x2814('0x5d')],'attributes':[_0x2814('0x84')],'as':_0x2814('0x5e')}],'order':[_0x2814('0x84'),db[_0x2814('0x5f')]['literal'](_0x2814('0x8c'))]})[_0x2814('0x15')](function(_0x4f6cb3){var _0x414c27=0x1;var _0x345229=_['map'](_0x4f6cb3,function(_0xed5af5){_0xed5af5[_0x2814('0x8d')]=_0x27659f;_0xed5af5[_0x2814('0x6f')]=_0xed5af5[_0x2814('0x8a')];_0xed5af5['OrderBy']=_0x414c27;delete _0xed5af5[_0x2814('0x8e')];_0x414c27=_0x414c27+0x1;return _0xed5af5;});return db[_0x2814('0x8f')][_0x2814('0x90')](_0x345229,{});})[_0x2814('0x15')](function(){_0x2cf747(0x1);});});}function insertAdditionalPhones(_0x13fc09,_0x4102de){return new Promise(function(_0x426860){var _0x19fcb9=[];for(var _0x418878=0x0;_0x418878<_0x4102de['length'];_0x418878++){var _0x5e2396=_0x4102de[_0x418878];_0x19fcb9[_0x2814('0x52')](parseContactItemType(_0x5e2396));}Promise[_0x2814('0x57')](_0x19fcb9)[_0x2814('0x15')](function(){var _0x577b7a={'id':_0x13fc09['id'],'items':_0x4102de};return addAdditionalPhones(_0x577b7a)[_0x2814('0x15')](function(){return addCmHopperPhones(_0x13fc09['id']);});})[_0x2814('0x15')](function(){_0x426860(_0x13fc09);});});}function parseContactItemType(_0x2a4281){return new Promise(function(_0x86286a){if(_0x2a4281[_0x2814('0x2e')]('ItemTypeId')){_0x86286a(_0x2a4281);}else{return db['ContactItemType'][_0x2814('0x20')]({'where':{'name':_0x2a4281['ItemType']}})[_0x2814('0x15')](function(_0x4c2b7d){if(_['isNil'](_0x4c2b7d))_0x2a4281[_0x2814('0x87')]=null;else _0x2a4281[_0x2814('0x87')]=_0x4c2b7d['id'];_0x86286a(_0x2a4281);});}});}exports[_0x2814('0x91')]=function(_0x449e72,_0x2a512b){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x449e72[_0x2814('0x67')]['id'],'ItemClass':_0x2814('0x8b')},'include':[{'model':db['ContactItemType'],'as':_0x2814('0x5e')}],'order':[[_0x2814('0x84')],[db['sequelize']['literal'](_0x2814('0x8c'))]]})[_0x2814('0x15')](function(_0xd25ea1){return _0xd25ea1;})['then'](respondWithResult(_0x2a512b,null))[_0x2814('0x21')](handleError(_0x2a512b,null));};exports[_0x2814('0x92')]=function(_0x52d32d,_0x35437f){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x52d32d[_0x2814('0x2f')][_0x2814('0x93')]}})[_0x2814('0x15')](function(_0x4cd685){var _0x408417=_['map'](_0x4cd685,function(_0x5af8cd){_0x5af8cd[_0x2814('0x94')]=_0x52d32d['body']['toContactId'];return _0x5af8cd;});return db['CmContactHasItem']['bulkCreate'](_0x408417,{});})[_0x2814('0x15')](function(){return addCmHopperPhones(_0x52d32d[_0x2814('0x2f')][_0x2814('0x95')]);})['then'](function(){return['ok'];})[_0x2814('0x15')](respondWithResult(_0x35437f,null))[_0x2814('0x21')](handleError(_0x35437f,null));};exports[_0x2814('0x96')]=function(_0x3709a0,_0x1869c9){var _0x299ba8=[];_0x299ba8[_0x2814('0x52')](createCmHopperPhone(_0x3709a0[_0x2814('0x2f')]['id'],_0x3709a0['body'][_0x2814('0x97')]));Promise['all'](_0x299ba8)['then'](function(){return[0x1];})[_0x2814('0x15')](respondWithResult(_0x1869c9,null));};exports['getHoppers']=function(_0x3a2bda,_0x39ba34){var _0x1cae8d={'raw':![],'where':{}};var _0x5f32c8={};var _0x2b37ad={'count':0x0,'rows':[]};return db['CmContact'][_0x2814('0x70')]({'where':{'id':_0x3a2bda['params']['id']}})[_0x2814('0x15')](handleEntityNotFound(_0x39ba34,null))[_0x2814('0x15')](function(_0x5328e8){if(_0x5328e8){_0x5f32c8[_0x2814('0x71')]=_[_0x2814('0x22')](db['CmHopper']['rawAttributes']);_0x5f32c8[_0x2814('0x1e')]=_[_0x2814('0x22')](_0x3a2bda['query']);_0x5f32c8[_0x2814('0x74')]=_[_0x2814('0x75')](_0x5f32c8[_0x2814('0x71')],_0x5f32c8[_0x2814('0x1e')]);_0x1cae8d['attributes']=_[_0x2814('0x75')](_0x5f32c8[_0x2814('0x71')],qs[_0x2814('0x77')](_0x3a2bda['query'][_0x2814('0x77')]));_0x1cae8d[_0x2814('0x76')]=_0x1cae8d[_0x2814('0x76')][_0x2814('0x29')]?_0x1cae8d[_0x2814('0x76')]:_0x5f32c8['model'];if(!_0x3a2bda[_0x2814('0x1e')]['hasOwnProperty'](_0x2814('0x7f'))){_0x1cae8d[_0x2814('0x80')]=qs[_0x2814('0x80')](_0x3a2bda[_0x2814('0x1e')][_0x2814('0x80')]);_0x1cae8d[_0x2814('0x10')]=qs[_0x2814('0x10')](_0x3a2bda[_0x2814('0x1e')][_0x2814('0x10')]);}_0x1cae8d[_0x2814('0x78')]=qs[_0x2814('0x79')](_0x3a2bda[_0x2814('0x1e')][_0x2814('0x79')]);_0x1cae8d['where']=qs[_0x2814('0x74')](_['pick'](_0x3a2bda[_0x2814('0x1e')],_0x5f32c8[_0x2814('0x74')]));_0x1cae8d[_0x2814('0x50')][_0x2814('0x98')]=_0x5328e8['id'];if(_0x3a2bda[_0x2814('0x1e')][_0x2814('0x7b')]){_0x1cae8d[_0x2814('0x50')]=_[_0x2814('0x7c')](_0x1cae8d[_0x2814('0x50')],{'$or':_[_0x2814('0x68')](_0x1cae8d['attributes'],function(_0x3fd7c4){var _0x3045c0={};_0x3045c0[_0x3fd7c4]={'$like':'%'+_0x3a2bda['query'][_0x2814('0x7b')]+'%'};return _0x3045c0;})});}_0x1cae8d=_[_0x2814('0x7c')]({},_0x1cae8d,_0x3a2bda[_0x2814('0x7d')]);return db[_0x2814('0x6e')][_0x2814('0x12')]({'where':_0x1cae8d[_0x2814('0x50')]})[_0x2814('0x15')](function(_0x1180ce){_0x2b37ad[_0x2814('0x12')]=_0x1180ce;if(_0x3a2bda[_0x2814('0x1e')][_0x2814('0x99')]){_0x1cae8d[_0x2814('0x9a')]=[{'all':!![]}];}return db[_0x2814('0x6e')][_0x2814('0x1d')](_0x1cae8d);})[_0x2814('0x15')](function(_0x3bb622){_0x2b37ad[_0x2814('0x9b')]=_0x3bb622;return _0x2b37ad;});}})[_0x2814('0x15')](respondWithFilteredResult(_0x39ba34,_0x1cae8d))[_0x2814('0x21')](handleError(_0x39ba34,null));};exports[_0x2814('0x9c')]=function(_0x2c00be,_0x4ee7b8){var _0x317eff={'raw':!![],'where':{}};var _0x4fdf93={};var _0x34a1f8={'count':0x0,'rows':[]};return db[_0x2814('0x1f')][_0x2814('0x70')]({'where':{'id':_0x2c00be[_0x2814('0x67')]['id']}})[_0x2814('0x15')](handleEntityNotFound(_0x4ee7b8,null))[_0x2814('0x15')](function(_0x432679){if(_0x432679){_0x4fdf93[_0x2814('0x71')]=_['keys'](db[_0x2814('0x44')][_0x2814('0x73')]);_0x4fdf93[_0x2814('0x1e')]=_[_0x2814('0x22')](_0x2c00be['query']);_0x4fdf93[_0x2814('0x74')]=_[_0x2814('0x75')](_0x4fdf93[_0x2814('0x71')],_0x4fdf93['query']);_0x317eff[_0x2814('0x76')]=_[_0x2814('0x75')](_0x4fdf93['model'],qs[_0x2814('0x77')](_0x2c00be[_0x2814('0x1e')][_0x2814('0x77')]));_0x317eff[_0x2814('0x76')]=_0x317eff['attributes'][_0x2814('0x29')]?_0x317eff['attributes']:_0x4fdf93[_0x2814('0x71')];if(!_0x2c00be['query'][_0x2814('0x2e')](_0x2814('0x7f'))){_0x317eff[_0x2814('0x80')]=qs['limit'](_0x2c00be[_0x2814('0x1e')]['limit']);_0x317eff['offset']=qs['offset'](_0x2c00be['query'][_0x2814('0x10')]);}_0x317eff[_0x2814('0x78')]=qs[_0x2814('0x79')](_0x2c00be[_0x2814('0x1e')][_0x2814('0x79')]);_0x317eff['where']=qs['filters'](_[_0x2814('0x7a')](_0x2c00be['query'],_0x4fdf93['filters']));_0x317eff[_0x2814('0x50')][_0x2814('0x98')]=_0x432679['id'];if(_0x2c00be[_0x2814('0x1e')][_0x2814('0x7b')]){_0x317eff[_0x2814('0x50')]=_[_0x2814('0x7c')](_0x317eff[_0x2814('0x50')],{'$or':_[_0x2814('0x68')](_0x317eff['attributes'],function(_0x97401c){var _0x12c8a9={};_0x12c8a9[_0x97401c]={'$like':'%'+_0x2c00be[_0x2814('0x1e')][_0x2814('0x7b')]+'%'};return _0x12c8a9;})});}_0x317eff=_['merge']({},_0x317eff,_0x2c00be[_0x2814('0x7d')]);return db[_0x2814('0x44')][_0x2814('0x12')]({'where':_0x317eff[_0x2814('0x50')]})[_0x2814('0x15')](function(_0x712486){_0x34a1f8[_0x2814('0x12')]=_0x712486;if(_0x2c00be['query'][_0x2814('0x99')]){_0x317eff[_0x2814('0x9a')]=[{'all':!![]}];}return db[_0x2814('0x44')][_0x2814('0x1d')](_0x317eff);})[_0x2814('0x15')](function(_0x2e65fc){_0x34a1f8[_0x2814('0x9b')]=_0x2e65fc;return _0x34a1f8;});}})[_0x2814('0x15')](respondWithFilteredResult(_0x4ee7b8,_0x317eff))[_0x2814('0x21')](handleError(_0x4ee7b8,null));};exports[_0x2814('0x9d')]=function(_0x45f250,_0x2bdbcb){var _0x36691b={'raw':!![],'where':{}};var _0x30c0e9={};var _0x5370a3={'count':0x0,'rows':[]};return db[_0x2814('0x1f')]['findOne']({'where':{'id':_0x45f250[_0x2814('0x67')]['id']}})[_0x2814('0x15')](handleEntityNotFound(_0x2bdbcb,null))[_0x2814('0x15')](function(_0x5869e7){if(_0x5869e7){_0x30c0e9['model']=_[_0x2814('0x22')](db[_0x2814('0x43')][_0x2814('0x73')]);_0x30c0e9[_0x2814('0x1e')]=_['keys'](_0x45f250[_0x2814('0x1e')]);_0x30c0e9[_0x2814('0x74')]=_[_0x2814('0x75')](_0x30c0e9[_0x2814('0x71')],_0x30c0e9[_0x2814('0x1e')]);_0x36691b[_0x2814('0x76')]=_['intersection'](_0x30c0e9[_0x2814('0x71')],qs[_0x2814('0x77')](_0x45f250[_0x2814('0x1e')][_0x2814('0x77')]));_0x36691b['attributes']=_0x36691b[_0x2814('0x76')][_0x2814('0x29')]?_0x36691b['attributes']:_0x30c0e9[_0x2814('0x71')];if(!_0x45f250['query'][_0x2814('0x2e')](_0x2814('0x7f'))){_0x36691b[_0x2814('0x80')]=qs['limit'](_0x45f250[_0x2814('0x1e')]['limit']);_0x36691b[_0x2814('0x10')]=qs[_0x2814('0x10')](_0x45f250['query']['offset']);}_0x36691b[_0x2814('0x78')]=qs[_0x2814('0x79')](_0x45f250[_0x2814('0x1e')][_0x2814('0x79')]);_0x36691b[_0x2814('0x50')]=qs[_0x2814('0x74')](_[_0x2814('0x7a')](_0x45f250[_0x2814('0x1e')],_0x30c0e9[_0x2814('0x74')]));_0x36691b[_0x2814('0x50')][_0x2814('0x98')]=_0x5869e7['id'];if(_0x45f250['query']['filter']){_0x36691b[_0x2814('0x50')]=_['merge'](_0x36691b[_0x2814('0x50')],{'$or':_[_0x2814('0x68')](_0x36691b[_0x2814('0x76')],function(_0x24bf21){var _0x8370ac={};_0x8370ac[_0x24bf21]={'$like':'%'+_0x45f250[_0x2814('0x1e')][_0x2814('0x7b')]+'%'};return _0x8370ac;})});}_0x36691b=_['merge']({},_0x36691b,_0x45f250[_0x2814('0x7d')]);return db['CmHopperFinal'][_0x2814('0x12')]({'where':_0x36691b[_0x2814('0x50')]})[_0x2814('0x15')](function(_0x2db735){_0x5370a3[_0x2814('0x12')]=_0x2db735;if(_0x45f250['query']['includeAll']){_0x36691b[_0x2814('0x9a')]=[{'all':!![]}];}return db[_0x2814('0x43')][_0x2814('0x1d')](_0x36691b);})[_0x2814('0x15')](function(_0x50b09a){_0x5370a3[_0x2814('0x9b')]=_0x50b09a;return _0x5370a3;});}})[_0x2814('0x15')](respondWithFilteredResult(_0x2bdbcb,_0x36691b))[_0x2814('0x21')](handleError(_0x2bdbcb,null));};exports[_0x2814('0x9e')]=function(_0x32bac4,_0xfc8c03){var _0x357df6={'raw':!![],'where':{}};var _0x3ad62b={};var _0x23c44d={'count':0x0,'rows':[]};return db['CmContact'][_0x2814('0x70')]({'where':{'id':_0x32bac4[_0x2814('0x67')]['id']}})[_0x2814('0x15')](handleEntityNotFound(_0xfc8c03,null))['then'](function(_0x156acb){if(_0x156acb){_0x3ad62b[_0x2814('0x71')]=_[_0x2814('0x22')](db[_0x2814('0x9f')][_0x2814('0x73')]);_0x3ad62b['query']=_[_0x2814('0x22')](_0x32bac4[_0x2814('0x1e')]);_0x3ad62b[_0x2814('0x74')]=_[_0x2814('0x75')](_0x3ad62b[_0x2814('0x71')],_0x3ad62b[_0x2814('0x1e')]);_0x357df6[_0x2814('0x76')]=_[_0x2814('0x75')](_0x3ad62b[_0x2814('0x71')],qs[_0x2814('0x77')](_0x32bac4['query']['fields']));_0x357df6[_0x2814('0x76')]=_0x357df6[_0x2814('0x76')][_0x2814('0x29')]?_0x357df6[_0x2814('0x76')]:_0x3ad62b['model'];if(!_0x32bac4[_0x2814('0x1e')]['hasOwnProperty']('nolimit')){_0x357df6[_0x2814('0x80')]=qs['limit'](_0x32bac4[_0x2814('0x1e')][_0x2814('0x80')]);_0x357df6[_0x2814('0x10')]=qs[_0x2814('0x10')](_0x32bac4[_0x2814('0x1e')]['offset']);}_0x357df6['order']=qs[_0x2814('0x79')](_0x32bac4[_0x2814('0x1e')][_0x2814('0x79')]);_0x357df6[_0x2814('0x50')]=qs['filters'](_[_0x2814('0x7a')](_0x32bac4[_0x2814('0x1e')],_0x3ad62b[_0x2814('0x74')]));_0x357df6[_0x2814('0x50')]['ContactId']=_0x156acb['id'];if(_0x32bac4[_0x2814('0x1e')][_0x2814('0x7b')]){_0x357df6[_0x2814('0x50')]=_[_0x2814('0x7c')](_0x357df6[_0x2814('0x50')],{'$or':_[_0x2814('0x68')](_0x357df6[_0x2814('0x76')],function(_0x58122e){var _0x18df57={};_0x18df57[_0x58122e]={'$like':'%'+_0x32bac4[_0x2814('0x1e')][_0x2814('0x7b')]+'%'};return _0x18df57;})});}_0x357df6=_[_0x2814('0x7c')]({},_0x357df6,_0x32bac4['options']);return db['JscriptySessionReport'][_0x2814('0x12')]({'where':_0x357df6['where']})[_0x2814('0x15')](function(_0x5f1918){_0x23c44d['count']=_0x5f1918;if(_0x32bac4[_0x2814('0x1e')][_0x2814('0x99')]){_0x357df6[_0x2814('0x9a')]=[{'all':!![]}];}return db[_0x2814('0x9f')][_0x2814('0x1d')](_0x357df6);})[_0x2814('0x15')](function(_0x424f76){_0x23c44d[_0x2814('0x9b')]=_0x424f76;return _0x23c44d;});}})[_0x2814('0x15')](respondWithFilteredResult(_0xfc8c03,_0x357df6))[_0x2814('0x21')](handleError(_0xfc8c03,null));};exports[_0x2814('0xa0')]=function(_0x57f13c,_0x1263dc){try{if(!_0x57f13c[_0x2814('0x2f')][_0x2814('0x53')]){throw new Error('No\x20ListId\x20specified');}if(!_0x57f13c['body']['binding_keys']){throw new Error(_0x2814('0xa1'));}if(!_0x57f13c[_0x2814('0x2f')][_0x2814('0xa2')]){throw new Error(_0x2814('0xa3'));}if(!_0x57f13c[_0x2814('0x2f')][_0x2814('0xa4')]){throw new Error(_0x2814('0xa5'));}var _0x4b32a2=_0x57f13c[_0x2814('0x2f')]['binding_keys'][_0x2814('0xa6')](',');var _0x16aa9d=_0x57f13c['body']['binding_values']['split'](',');if(!_0x4b32a2[_0x2814('0x29')]||!_0x16aa9d[_0x2814('0x29')]||_0x4b32a2[_0x2814('0x29')]!==_0x16aa9d[_0x2814('0x29')]){throw new Error(_0x2814('0xa7'));}_0x57f13c[_0x2814('0x2f')][_0x2814('0x77')]=_[_0x2814('0xa8')](_0x4b32a2,_0x16aa9d);if(!_0x57f13c['body'][_0x2814('0x77')][_0x2814('0x6f')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x57f13c['body'][_0x2814('0x77')][_0x2814('0xa9')]){throw new Error(_0x2814('0xaa'));}var _0x37f080=path['join'](config[_0x2814('0xab')],_0x2814('0xac'),_0x57f13c[_0x2814('0xad')][_0x2814('0xae')]);fs['chmodSync'](_0x37f080,parseInt(_0x2814('0xaf'),0x8));var _0x184ad8=require(_0x2814('0xb0'))[_0x2814('0xb1')](path['join'](__dirname,_0x2814('0xb2')),[_0x37f080,_0x57f13c[_0x2814('0x2f')][_0x2814('0xb3')],_0x57f13c[_0x2814('0x2f')][_0x2814('0xa2')],_0x57f13c[_0x2814('0x2f')][_0x2814('0x53')],_0x57f13c[_0x2814('0x2f')][_0x2814('0xb4')],_0x57f13c[_0x2814('0x2f')][_0x2814('0x4f')],_0x57f13c[_0x2814('0x2f')][_0x2814('0xa4')]]);return _0x1263dc[_0x2814('0xe')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x184ad8[_0x2814('0xb5')]});}catch(_0x1f75a9){return _0x1263dc['status'](0x1f4)[_0x2814('0xb6')](_0x1f75a9);}};exports[_0x2814('0xb7')]=function(_0x5b2f47,_0x52d75a){var _0x157e13=fs[_0x2814('0xb8')](_0x5b2f47['file']['path']);Papa[_0x2814('0xb9')](_0x157e13,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x2aa1f8){return _0x52d75a[_0x2814('0xe')](0xc8)['json']({'file':_0x5b2f47[_0x2814('0xad')],'fields':_0x2aa1f8[_0x2814('0xba')]['fields']});}});};exports[_0x2814('0xbb')]=function(_0x53aede,_0xbbc596){return db[_0x2814('0xbc')][_0x2814('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x2814('0xbd')}})[_0x2814('0x15')](function(_0x3dcb59){var _0x172272=![];if(!_0x53aede['body'][_0x2814('0x53')]){throw new Error(_0x2814('0xbe'));}if(!_0x53aede[_0x2814('0x2f')][_0x2814('0xbf')][_0x2814('0x6f')]){throw new Error(_0x2814('0xc0'));}if(!_0x53aede[_0x2814('0x2f')][_0x2814('0xbf')][_0x2814('0xa9')]){throw new Error(_0x2814('0xaa'));}if(!_0x53aede['body'][_0x2814('0xa4')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x26e719=require(_0x2814('0xb0'))['fork'](path[_0x2814('0xc1')](__dirname,_0x2814('0xc2')),[_0x53aede[_0x2814('0x67')]['id'],JSON['stringify'](_0x53aede['body']),JSON['stringify'](_0x3dcb59)]);_0x26e719['on']('message',function(){_0x172272=!![];return _0xbbc596[_0x2814('0xe')](0xc8)[_0x2814('0xf')]({'message':_0x2814('0xc3'),'pid':_0x26e719[_0x2814('0xb5')]});});_0x26e719['on'](_0x2814('0xc4'),function(_0x57119d){if(_0x57119d&&!_0x172272){return _0xbbc596[_0x2814('0xe')](0x1f4)[_0x2814('0xf')]({'message':_0x2814('0xc5'),'pid':_0x26e719[_0x2814('0xb5')]});}});})[_0x2814('0x21')](handleError(_0xbbc596,null));};exports[_0x2814('0xc6')]=function(_0x39e642,_0x413717){return db[_0x2814('0xbc')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x2814('0xbd')}})[_0x2814('0x15')](function(_0x233f13){var _0xfa9312=![];if(!_0x39e642['body'][_0x2814('0x53')]){throw new Error(_0x2814('0xbe'));}if(!_0x39e642['body'][_0x2814('0xbf')][_0x2814('0x6f')]){throw new Error(_0x2814('0xc0'));}if(!_0x39e642[_0x2814('0x2f')][_0x2814('0xbf')][_0x2814('0xa9')]){throw new Error(_0x2814('0xaa'));}if(!_0x39e642[_0x2814('0x2f')][_0x2814('0xa4')]){throw new Error(_0x2814('0xa5'));}var _0x41b269=require(_0x2814('0xb0'))[_0x2814('0xb1')](path['join'](__dirname,_0x2814('0xc7')),[_0x39e642[_0x2814('0x67')]['id'],JSON[_0x2814('0xc8')](_0x39e642[_0x2814('0x2f')]),JSON[_0x2814('0xc8')](_0x233f13)]);_0x41b269['on']('message',function(){_0xfa9312=!![];return _0x413717[_0x2814('0xe')](0xc8)[_0x2814('0xf')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x41b269[_0x2814('0xb5')]});});_0x41b269['on'](_0x2814('0xc4'),function(_0x25ae91){if(_0x25ae91&&!_0xfa9312){return _0x413717[_0x2814('0xe')](0x1f4)[_0x2814('0xf')]({'message':_0x2814('0xc5'),'pid':_0x41b269['pid']});}});})[_0x2814('0x21')](handleError(_0x413717,null));};exports['getJourney']=function(_0x32c770,_0x4058f8){var _0x3362fb=[_0x2814('0xc9'),'chat','sms','openchannel',_0x2814('0xca'),_0x2814('0xcb'),_0x2814('0xcc')];var _0x56a2a0={'offset':0x0,'order':qs[_0x2814('0x79')](_0x2814('0xcd'))},_0x3b6436={'count':0x0,'rows':[]};Promise['resolve']()[_0x2814('0x15')](function(){if(_0x32c770[_0x2814('0x1e')][_0x2814('0xce')]){if(!_[_0x2814('0xcf')](_0x3362fb,_0x32c770['query']['channel'][_0x2814('0xd0')]())){throw new Error(_0x2814('0xd1'));}_0x3362fb=[_0x32c770[_0x2814('0x1e')][_0x2814('0xce')][_0x2814('0xd0')]()];}if(_0x32c770[_0x2814('0x1e')][_0x2814('0xd2')]){try{var _0x590de5=JSON[_0x2814('0xb9')](_0x32c770[_0x2814('0x1e')]['range']);if(!moment(_0x590de5[_0x2814('0x30')])[_0x2814('0xd3')]()){throw new Error(_0x2814('0xd4'));}if(!moment(_0x590de5['to'])[_0x2814('0xd3')]()){throw new Error(_0x2814('0xd5'));}}catch(_0x152999){throw new Error(_0x2814('0xd6'));}}if(!_0x32c770[_0x2814('0x1e')][_0x2814('0x2e')]('nolimit')){_0x56a2a0[_0x2814('0x80')]=qs[_0x2814('0x80')](_0x32c770[_0x2814('0x1e')]['limit']||0xa);_0x56a2a0[_0x2814('0x10')]=qs[_0x2814('0x10')](_0x32c770[_0x2814('0x1e')]['offset']);}var _0x3323a0=_0x3362fb['map'](function(_0x4f9837){if(_0x4f9837==='voice'){var _0x2321d8={'attributes':['id','uniqueid',_0x2814('0x2c'),_0x2814('0xd7'),_0x2814('0xd8'),_0x2814('0xd9'),_0x2814('0xda'),_0x2814('0xdb'),_0x2814('0xdc'),_0x2814('0xdd'),'createdAt',_0x2814('0xde'),'userSecondDisposition','userThirdDisposition','UserId'],'where':{'ContactId':_0x32c770[_0x2814('0x67')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id',_0x2814('0x1a'),_0x2814('0xdf'),_0x2814('0x2a')]}],'order':[['createdAt',_0x2814('0xe0')]]};if(_0x32c770[_0x2814('0x1e')][_0x2814('0xd2')]){_0x2321d8[_0x2814('0x50')]['createdAt']={'$gte':_0x590de5['from'],'$lte':_0x590de5['to']};}return db[_0x2814('0xe1')][_0x2814('0xe2')](_0x2321d8)[_0x2814('0x15')](function(_0x546ea1){_0x3b6436[_0x2814('0x12')]+=_0x546ea1['count'];return _[_0x2814('0x68')](_0x546ea1[_0x2814('0x9b')],function(_0x11012c){var _0x250abe=_0x11012c['get']({'plain':!![]});_0x250abe[_0x2814('0xce')]=_0x4f9837;if(_0x250abe[_0x2814('0xbc')]){_0x250abe['User']={'id':_0x250abe['User']['id'],'name':_0x250abe[_0x2814('0xbc')]['name'],'fullname':_0x250abe[_0x2814('0xbc')][_0x2814('0xdf')],'alias':_0x250abe[_0x2814('0xbc')][_0x2814('0x2a')]};}return _0x250abe;});});}else{var _0x5709be=_[_0x2814('0xe3')](_0x4f9837)+(_0x4f9837===_0x2814('0xe4')?_0x2814('0xe5'):_0x2814('0xe6'));var _0x5dda42={'attributes':['id','closed','closedAt',_0x2814('0xe7'),_0x2814('0xdd'),_0x2814('0xe8'),_0x2814('0xe9'),_0x2814('0xea'),_0x2814('0xeb'),_0x5709be+'Id'],'where':{'ContactId':_0x32c770[_0x2814('0x67')]['id']},'include':[{'model':db[_0x5709be],'as':_0x2814('0xe6'),'attributes':['id','name',_0x2814('0xec')]},{'model':db[_0x2814('0xbc')],'as':_0x2814('0xed'),'attributes':['id','name',_0x2814('0xdf')]},{'model':db[_0x2814('0x72')],'as':'Tags','attributes':['id','name',_0x2814('0x5a')],'through':{'attributes':[]}}],'order':[[_0x2814('0xe7'),_0x2814('0xe0')]]};if(_0x32c770[_0x2814('0x1e')][_0x2814('0xd2')]){_0x5dda42[_0x2814('0x50')][_0x2814('0xe7')]={'$gte':_0x590de5[_0x2814('0x30')],'$lte':_0x590de5['to']};}switch(_0x4f9837){case _0x2814('0xe4'):_0x5dda42[_0x2814('0x76')][_0x2814('0x52')](_0x2814('0xee'),_0x2814('0xef'),'customerPort',_0x2814('0xf0'),'osName',_0x2814('0xf1'),_0x2814('0xf2'),_0x2814('0xf3'),_0x2814('0xf4'));break;case _0x2814('0xc9'):_0x5dda42[_0x2814('0x76')][_0x2814('0x52')](_0x2814('0xf5'),'substatus');break;case _0x2814('0xf6'):_0x5dda42[_0x2814('0x76')][_0x2814('0x52')](_0x2814('0xf7'),'threadId');break;}return db[_[_0x2814('0xe3')](_0x4f9837)+'Interaction'][_0x2814('0xe2')](_0x5dda42)[_0x2814('0x15')](function(_0x26dfd3){_0x3b6436['count']+=_0x26dfd3[_0x2814('0x12')];return _[_0x2814('0x68')](_0x26dfd3[_0x2814('0x9b')],function(_0x5f15f2){var _0x4b55bb=_0x5f15f2[_0x2814('0x31')]({'plain':!![]});_0x4b55bb[_0x2814('0xce')]=_0x4f9837;if(_0x4b55bb[_0x2814('0xed')]){_0x4b55bb[_0x2814('0xed')]={'id':_0x4b55bb['Owner']['id'],'name':_0x4b55bb[_0x2814('0xed')][_0x2814('0x1a')],'fullname':_0x4b55bb[_0x2814('0xed')][_0x2814('0xdf')]};}return _0x4b55bb;});});}});return Promise[_0x2814('0x57')](_0x3323a0);})[_0x2814('0x15')](function(_0x12d601){return _(_0x12d601)[_0x2814('0xf8')]()[_0x2814('0xf9')](_0x2814('0xe7'))[_0x2814('0xfa')]()[_0x2814('0xfb')]();})[_0x2814('0x15')](function(_0x112c50){_0x3b6436[_0x2814('0x9b')]=_0x56a2a0[_0x2814('0x80')]?_0x112c50[_0x2814('0xfc')](_0x56a2a0[_0x2814('0x10')],_0x56a2a0[_0x2814('0x10')]+_0x56a2a0[_0x2814('0x80')]):_0x112c50;return _0x3b6436;})[_0x2814('0x15')](respondWithFilteredResult(_0x4058f8,_0x56a2a0))[_0x2814('0x21')](handleError(_0x4058f8,null));}; \ No newline at end of file +var _0x8d54=['ContactItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','pickBy','format','cf_%d','isEmpty','table','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','findOne','rawAttributes','intersection','model','fields','attributes','order','sort','filters','pick','filter','merge','options','setTags','ids','setAdditionalPhones','all','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','ItemType','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','bulkCreate','getAdditionalPhones','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','includeAll','include','rows','CmHopperHistory','nolimit','ContactId','getJscriptySessions','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','server/files/tmp','file','filename','0777','child_process','binding_keys','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','agent','binding','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','fork','../../components/import/cm/csv2','stringify','message','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','getJourney','mail','sms','fax','whatsapp','voice','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','source','destination','callerid','starttime','endtime','note','createdAt','userDisposition','userThirdDisposition','fullname','DESC','findAndCountAll','startCase','chat','Account','closedAt','disposition','secondDisposition','thirdDisposition','UserId','key','Owner','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','openchannel','externalUrl','threadId','sortBy','reverse','value','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../config/logger','../../config/environment','redis','defaults','localhost','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','sendStatus','error','stack','name','send','index','describe','getOptions','findAll','user','catch','find','params','CmContact','tags','keys','length','startsWith','cf_','displayName','query','analytics','CmCustomField','alias','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','columnName','body','from','get','mergeWith','isArray','join','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','where','$or','push','ListId','findOrCreate','spread','hasOwnProperty','contact','show','Tag','Tags','color','tag','Phones'];(function(_0x570673,_0x47bf60){var _0x43fbad=function(_0x2caf12){while(--_0x2caf12){_0x570673['push'](_0x570673['shift']());}};_0x43fbad(++_0x47bf60);}(_0x8d54,0x191));var _0x48d5=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0x8d54[_0x400322];return _0xfdd597;};'use strict';var moment=require('moment');var BPromise=require(_0x48d5('0x0'));var util=require(_0x48d5('0x1'));var path=require(_0x48d5('0x2'));var fs=require('fs');var _=require(_0x48d5('0x3'));var squel=require(_0x48d5('0x4'));var Papa=require(_0x48d5('0x5'));var Redis=require(_0x48d5('0x6'));var contacts=require(_0x48d5('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x48d5('0x8'))('api');var config=require(_0x48d5('0x9'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config[_0x48d5('0xa')]=_[_0x48d5('0xb')](config[_0x48d5('0xa')],{'host':_0x48d5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48d5('0xa')]));require(_0x48d5('0xd'))[_0x48d5('0xe')](socket);function respondWithResult(_0x2223ee,_0x25a1a4){_0x25a1a4=_0x25a1a4||0xc8;return function(_0x44169d){if(_0x44169d){return _0x2223ee[_0x48d5('0xf')](_0x25a1a4)[_0x48d5('0x10')](_0x44169d);}};}function respondWithFilteredResult(_0x50e2d4,_0x1b86b8){return function(_0x1dc5a2){if(_0x1dc5a2){var _0x1752b2=typeof _0x1b86b8[_0x48d5('0x11')]===_0x48d5('0x12')&&typeof _0x1b86b8[_0x48d5('0x13')]==='undefined';var _0x280b72=_0x1dc5a2[_0x48d5('0x14')];var _0x5a3b3b=_0x1752b2?0x0:_0x1b86b8['offset'];var _0x4fd721=_0x1752b2?_0x1dc5a2[_0x48d5('0x14')]:_0x1b86b8[_0x48d5('0x11')]+_0x1b86b8[_0x48d5('0x13')];var _0x9bc46c;if(_0x4fd721>=_0x280b72){_0x4fd721=_0x280b72;_0x9bc46c=0xc8;}else{_0x9bc46c=0xce;}_0x50e2d4[_0x48d5('0xf')](_0x9bc46c);return _0x50e2d4[_0x48d5('0x15')](_0x48d5('0x16'),_0x5a3b3b+'-'+_0x4fd721+'/'+_0x280b72)['json'](_0x1dc5a2);}return null;};}function saveUpdates(_0x29e9ee){return function(_0x1ae339){if(_0x1ae339){return _0x1ae339['update'](_0x29e9ee)[_0x48d5('0x17')](function(_0xd2c71e){return _0xd2c71e;});}return null;};}function removeEntity(_0x4e639d){return function(_0x1cba1e){if(_0x1cba1e){return _0x1cba1e[_0x48d5('0x18')]()['then'](function(){_0x4e639d['status'](0xcc)[_0x48d5('0x19')]();});}};}function handleEntityNotFound(_0x3bb0b1){return function(_0x2313f6){if(!_0x2313f6){_0x3bb0b1[_0x48d5('0x1a')](0x194);}return _0x2313f6;};}function handleError(_0x49199e,_0x2be6eb){_0x2be6eb=_0x2be6eb||0x1f4;return function(_0x4fcf07){logger[_0x48d5('0x1b')](_0x4fcf07[_0x48d5('0x1c')]);if(_0x4fcf07[_0x48d5('0x1d')]){delete _0x4fcf07['name'];}_0x49199e[_0x48d5('0xf')](_0x2be6eb)[_0x48d5('0x1e')](_0x4fcf07);};}exports[_0x48d5('0x1f')]=function(_0x1b2dbe,_0x1be2b3){var _0x56da36={};return contacts[_0x48d5('0x20')]()[_0x48d5('0x17')](function(_0x5dab8d){_0x56da36=qs[_0x48d5('0x21')](_0x5dab8d,_0x1b2dbe);return contacts[_0x48d5('0x22')](_0x1b2dbe['query'],_0x1b2dbe[_0x48d5('0x23')],_0x56da36,_0x5dab8d);})[_0x48d5('0x17')](respondWithFilteredResult(_0x1be2b3,_0x56da36))[_0x48d5('0x24')](handleError(_0x1be2b3,null));};exports[_0x48d5('0x18')]=function(_0x546263,_0x417e0e){return db['CmContact'][_0x48d5('0x25')]({'where':{'id':_0x546263[_0x48d5('0x26')]['id']}})[_0x48d5('0x17')](handleEntityNotFound(_0x417e0e,null))[_0x48d5('0x17')](removeEntity(_0x417e0e,null))[_0x48d5('0x24')](handleError(_0x417e0e,null));};exports['describe']=function(_0x4b8411,_0x1d1984){return db[_0x48d5('0x27')][_0x48d5('0x20')]()[_0x48d5('0x17')](function(_0x39b758){delete _0x39b758[_0x48d5('0x28')];for(var _0x34cae0=0x0;_0x34cae00x0){return new Promise(function(_0x35cb8d){var _0x22f0f5=[];for(var _0xc421ba=0x0;_0xc421ba<_0x469330[_0x48d5('0x2a')];_0xc421ba++){_0x22f0f5[_0x48d5('0x5d')](insertAdditionalPhones(_0x469330[_0xc421ba][_0x48d5('0x62')],_0x469330[_0xc421ba]['additionalPhones']));}Promise['all'](_0x22f0f5)['then'](function(){_0x35cb8d(0x1);});})[_0x48d5('0x17')](function(){return{'success':_0x470d27,'failure':_0x521ee1,'duplicates':_0x5ed18e};});}else{return{'success':_0x470d27,'failure':_0x521ee1,'duplicates':_0x5ed18e};}}})['then'](respondWithResult(_0x4e5fc0,0xc9))['catch'](handleError(_0x4e5fc0,null));};exports[_0x48d5('0x63')]=function(_0x3e81f3,_0x24b330){var _0x64a180;return db[_0x48d5('0x27')][_0x48d5('0x20')]()[_0x48d5('0x17')](function(_0xee237b){return db[_0x48d5('0x27')][_0x48d5('0x25')]({'where':{'id':_0x3e81f3[_0x48d5('0x26')]['id']},'include':[{'model':db[_0x48d5('0x64')],'as':_0x48d5('0x65'),'attributes':['id','name',_0x48d5('0x66')],'required':_0x3e81f3[_0x48d5('0x2e')][_0x48d5('0x67')]?!![]:![]},{'model':db[_0x48d5('0x4a')],'as':_0x48d5('0x68'),'where':{'CmContactId':_0x3e81f3[_0x48d5('0x26')]['id']},'required':![],'include':[{'model':db[_0x48d5('0x69')],'as':'ItemType'}]}],'order':[db[_0x48d5('0x6a')][_0x48d5('0x6b')](_0x48d5('0x6c'))],'attributes':_[_0x48d5('0x29')](_0xee237b)});})['then'](function(_0x1001b3){if(!_[_0x48d5('0x55')](_0x1001b3)){_0x64a180=_0x1001b3[_0x48d5('0x3a')]({'plain':!![]});var _0x2f3279={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1001b3&&_0x1001b3[_0x48d5('0x5e')]){if(_0x1001b3[_0x48d5('0x5e')]){_0x2f3279['where'][_0x48d5('0x6d')]['push']({'ListId':{'$ne':_0x1001b3['ListId']}});}}return db[_0x48d5('0x30')][_0x48d5('0x22')](_0x2f3279);}})[_0x48d5('0x17')](function(_0x527994){if(!_['isNil'](_0x527994)){return _[_0x48d5('0x6e')](_0x64a180,_[_0x48d5('0x6f')](_0x527994,function(_0xc6a94e){return util['format']('cf_%d',_0xc6a94e['id']);}));}})[_0x48d5('0x17')](handleEntityNotFound(_0x24b330,null))[_0x48d5('0x17')](respondWithResult(_0x24b330,null))[_0x48d5('0x24')](handleError(_0x24b330,null));};exports[_0x48d5('0x43')]=function(_0x23855d,_0xeeda08){var _0x44ef1f;if(_0x23855d['body']['id']){delete _0x23855d[_0x48d5('0x38')]['id'];}if(!_['isNil'](_0x23855d[_0x48d5('0x38')][_0x48d5('0x56')])){var _0x2c115d=_0x23855d['body']['dialTimezone'];if(!_[_0x48d5('0x55')](shared[_0x48d5('0x57')][_0x2c115d]))_0x23855d['body'][_0x48d5('0x58')]=shared[_0x48d5('0x57')][_0x2c115d][_0x48d5('0x58')];}return db[_0x48d5('0x27')][_0x48d5('0x25')]({'where':{'id':_0x23855d[_0x48d5('0x26')]['id']}})[_0x48d5('0x17')](handleEntityNotFound(_0xeeda08,null))['then'](saveUpdates(_0x23855d[_0x48d5('0x38')],null))[_0x48d5('0x17')](function(_0x3bd456){_0x44ef1f=_0x3bd456;var _0x5748e8={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3bd456&&_0x3bd456[_0x48d5('0x5e')]){if(_0x3bd456[_0x48d5('0x5e')]){_0x5748e8['where']['$and']['push']({'ListId':{'$ne':_0x3bd456['ListId']}});}}return db[_0x48d5('0x30')]['findAll'](_0x5748e8);})['then'](function(_0x2f6851){if(_0x2f6851){return _[_0x48d5('0x6e')](_[_0x48d5('0x70')](_0x23855d['body'],function(_0x226894,_0x102e01){return _[_0x48d5('0x2b')](_0x102e01,_0x48d5('0x2c'));}),_[_0x48d5('0x6f')](_0x2f6851,function(_0x285a41){return util[_0x48d5('0x71')](_0x48d5('0x72'),_0x285a41['id']);}));}})[_0x48d5('0x17')](function(_0x12c9d0){if(_0x12c9d0&&!_[_0x48d5('0x73')](_0x12c9d0)){var _0x30cff6=squel[_0x48d5('0x43')]()[_0x48d5('0x74')](_0x48d5('0x75'))['setFields'](_0x12c9d0)[_0x48d5('0x5b')](_0x48d5('0x76'),_0x23855d[_0x48d5('0x26')]['id'])[_0x48d5('0x77')]();return db['sequelize'][_0x48d5('0x2e')](_0x30cff6[_0x48d5('0x78')],{'replacements':_0x30cff6[_0x48d5('0x33')]});}})[_0x48d5('0x17')](function(){if(_0x23855d['body']['phone']&&_0x44ef1f){return db[_0x48d5('0x3e')][_0x48d5('0x43')]({'phone':_0x23855d[_0x48d5('0x38')][_0x48d5('0x79')],'OrderBy':0x0},{'where':{'ContactId':_0x44ef1f['id']}});}})[_0x48d5('0x17')](function(){return _0x44ef1f;})[_0x48d5('0x17')](respondWithResult(_0xeeda08,null))[_0x48d5('0x24')](handleError(_0xeeda08,null));};exports[_0x48d5('0x7a')]=function(_0x19c851,_0x29a83f){var _0xc60980={};var _0x3f1388={};var _0x1f6b49;var _0x57af4c;return db[_0x48d5('0x27')][_0x48d5('0x7b')]({'where':{'id':_0x19c851[_0x48d5('0x26')]['id']}})[_0x48d5('0x17')](handleEntityNotFound(_0x29a83f,null))[_0x48d5('0x17')](function(_0x2d3cb6){if(_0x2d3cb6){_0x1f6b49=_0x2d3cb6;_0x3f1388['model']=_[_0x48d5('0x29')](db[_0x48d5('0x64')][_0x48d5('0x7c')]);_0x3f1388[_0x48d5('0x2e')]=_['keys'](_0x19c851['query']);_0x3f1388['filters']=_[_0x48d5('0x7d')](_0x3f1388[_0x48d5('0x7e')],_0x3f1388[_0x48d5('0x2e')]);_0xc60980['attributes']=_[_0x48d5('0x7d')](_0x3f1388[_0x48d5('0x7e')],qs[_0x48d5('0x7f')](_0x19c851[_0x48d5('0x2e')][_0x48d5('0x7f')]));_0xc60980[_0x48d5('0x80')]=_0xc60980[_0x48d5('0x80')][_0x48d5('0x2a')]?_0xc60980[_0x48d5('0x80')]:_0x3f1388[_0x48d5('0x7e')];_0xc60980[_0x48d5('0x81')]=qs['sort'](_0x19c851[_0x48d5('0x2e')][_0x48d5('0x82')]);_0xc60980[_0x48d5('0x5b')]=qs[_0x48d5('0x83')](_[_0x48d5('0x84')](_0x19c851[_0x48d5('0x2e')],_0x3f1388[_0x48d5('0x83')]));if(_0x19c851[_0x48d5('0x2e')]['filter']){_0xc60980['where']=_['merge'](_0xc60980[_0x48d5('0x5b')],{'$or':_[_0x48d5('0x6f')](_0xc60980[_0x48d5('0x80')],function(_0x19ec86){var _0x1f4cc3={};_0x1f4cc3[_0x19ec86]={'$like':'%'+_0x19c851['query'][_0x48d5('0x85')]+'%'};return _0x1f4cc3;})});}_0xc60980=_[_0x48d5('0x86')]({},_0xc60980,_0x19c851[_0x48d5('0x87')]);return _0x1f6b49[_0x48d5('0x7a')](_0xc60980);}})['then'](function(_0x48471b){if(_0x48471b){_0x57af4c=_0x48471b[_0x48d5('0x2a')];if(!_0x19c851[_0x48d5('0x2e')]['hasOwnProperty']('nolimit')){_0xc60980['limit']=qs[_0x48d5('0x13')](_0x19c851[_0x48d5('0x2e')][_0x48d5('0x13')]);_0xc60980[_0x48d5('0x11')]=qs[_0x48d5('0x11')](_0x19c851[_0x48d5('0x2e')][_0x48d5('0x11')]);}return _0x1f6b49[_0x48d5('0x7a')](_0xc60980);}})[_0x48d5('0x17')](function(_0x198e9a){if(_0x198e9a){return _0x198e9a?{'count':_0x57af4c,'rows':_0x198e9a}:null;}})[_0x48d5('0x17')](respondWithResult(_0x29a83f,null))[_0x48d5('0x24')](handleError(_0x29a83f,null));};exports[_0x48d5('0x88')]=function(_0x287806,_0xb32d22){if(_0x287806[_0x48d5('0x38')]['id']){delete _0x287806[_0x48d5('0x38')]['id'];}return db[_0x48d5('0x27')][_0x48d5('0x7b')]({'where':{'id':_0x287806[_0x48d5('0x26')]['id']}})['then'](handleEntityNotFound(_0xb32d22,null))[_0x48d5('0x17')](function(_0x2b1662){if(_0x2b1662){return _0x2b1662['setTags'](_0x287806[_0x48d5('0x38')][_0x48d5('0x89')]||[]);}return null;})[_0x48d5('0x17')](respondWithResult(_0xb32d22,null))[_0x48d5('0x24')](handleError(_0xb32d22,null));};exports[_0x48d5('0x8a')]=function(_0x1d36dd,_0x1ec07d){var _0x161931=[];_0x161931['push'](addAdditionalPhones(_0x1d36dd[_0x48d5('0x38')]));Promise['all'](_0x161931)[_0x48d5('0x17')](function(){_0x161931=[];_0x161931['push'](deleteCmHopperPhones(_0x1d36dd[_0x48d5('0x38')]['id']));_0x161931[_0x48d5('0x5d')](addCmHopperPhones(_0x1d36dd[_0x48d5('0x38')]['id']));Promise[_0x48d5('0x8b')](_0x161931)[_0x48d5('0x17')](function(){return[0x1];})[_0x48d5('0x17')](respondWithResult(_0x1ec07d,null));});};function addAdditionalPhones(_0x52375e){var _0xf70369;return new Promise(function(_0x58824e){return db[_0x48d5('0x4a')][_0x48d5('0x18')]({'where':{'CmContactId':_0x52375e['id']}})[_0x48d5('0x17')](function(){db[_0x48d5('0x69')][_0x48d5('0x22')]({'raw':!![],'attributes':['id',_0x48d5('0x8c')]})['then'](function(_0x3d2351){var _0x27abb4=[];for(var _0x483242=0x0;_0x483242<_0x52375e[_0x48d5('0x8d')][_0x48d5('0x2a')];_0x483242++){var _0x56af4c=_0x52375e[_0x48d5('0x8e')]?_[_0x48d5('0x55')](_0x52375e[_0x48d5('0x8e')][_0x483242])?'':_0x52375e['item_types'][_0x483242]:_0x52375e['items'][_0x483242][_0x48d5('0x8f')]?_0x52375e[_0x48d5('0x8d')][_0x483242]['ItemTypeId']:'';var _0x804fc9=_['isNil'](_0x52375e[_0x48d5('0x8d')][_0x483242][_0x48d5('0x90')])?'':_0x52375e[_0x48d5('0x8d')][_0x483242][_0x48d5('0x90')];var _0x4af940=_0x56af4c+':'+_0x52375e[_0x48d5('0x8d')][_0x483242][_0x48d5('0x79')]+'§'+_0x804fc9;if(_[_0x48d5('0x55')](_0xf70369))_0xf70369=_0x4af940;else _0xf70369+=';'+_0x4af940;var _0x487209=null;var _0x3292e0=null;if(_0x52375e[_0x48d5('0x8e')]){if(!_[_0x48d5('0x55')](_0x52375e[_0x48d5('0x8e')][_0x483242])){_0x3292e0=_['find'](_0x3d2351,function(_0x2cd757){return _0x2cd757['id']===_0x52375e['item_types'][_0x483242];});if(!_[_0x48d5('0x55')](_0x3292e0)){_0x487209=_0x3292e0[_0x48d5('0x8c')];}}}else{if(!_[_0x48d5('0x55')](_0x52375e['items'][_0x483242])){_0x3292e0=_['find'](_0x3d2351,function(_0x207f00){return _0x207f00['id']===_0x52375e[_0x48d5('0x8d')][_0x483242][_0x48d5('0x8f')];});if(!_[_0x48d5('0x55')](_0x3292e0)){_0x487209=_0x483242;}}}if(_['isNil'](_0x487209)){_0x487209=0x64;}_0x27abb4['push'](addAdditionalPhone(_0x52375e['id'],_0x52375e[_0x48d5('0x8d')][_0x483242][_0x48d5('0x79')],_0x52375e[_0x48d5('0x8e')]?_[_0x48d5('0x55')](_0x52375e[_0x48d5('0x8e')][_0x483242])?null:_0x52375e[_0x48d5('0x8e')][_0x483242]:_0x52375e['items'][_0x483242][_0x48d5('0x8f')]?_0x52375e[_0x48d5('0x8d')][_0x483242][_0x48d5('0x8f')]:null,_0x487209,_0x804fc9));}Promise[_0x48d5('0x8b')](_0x27abb4)['then'](function(){db[_0x48d5('0x27')][_0x48d5('0x43')]({'AdditionalPhones':_0xf70369},{'where':{'id':_0x52375e['id']}})['then'](function(){_0x58824e(0x1);});});});});});}function addAdditionalPhone(_0x56e22d,_0x52ab5e,_0x26cae4,_0x1db13b,_0x2a63fe){return db['CmContactHasItem'][_0x48d5('0x25')]({'where':{'CmContactId':_0x56e22d,'item':_0x52ab5e}})[_0x48d5('0x17')](function(_0x51fc66){if(_0x51fc66)logger[_0x48d5('0x34')](_0x48d5('0x91'),_0x51fc66);else{db['CmContactHasItem'][_0x48d5('0x41')]({'CmContactId':_0x56e22d,'item':_0x52ab5e,'ItemTypeId':_0x26cae4,'OrderBy':_0x1db13b,'ItemClass':'PHONE','description':_0x2a63fe});}});}function deleteCmHopperPhones(_0x1d521a){return new Promise(function(_0xa0f99d){return db[_0x48d5('0x3e')][_0x48d5('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d521a}})[_0x48d5('0x17')](function(_0x4a7a8a){db['CmHopperAdditionalPhone'][_0x48d5('0x18')]({'where':{'CmHopperId':{'$in':_[_0x48d5('0x6f')](_0x4a7a8a,'id')}}});})['then'](function(){_0xa0f99d(0x1);});});}function addCmHopperPhones(_0x55c8e3){return new Promise(function(_0x41eba8){return db[_0x48d5('0x3e')][_0x48d5('0x22')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x55c8e3}})[_0x48d5('0x17')](function(_0x4dc83c){var _0x191114=[];_[_0x48d5('0x6f')](_0x4dc83c,function(_0x4e0614){_0x191114[_0x48d5('0x5d')](createCmHopperPhone(_0x55c8e3,_0x4e0614['id']));});Promise[_0x48d5('0x8b')](_0x191114)[_0x48d5('0x17')](function(){_0x41eba8(0x1);});});});}function createCmHopperPhone(_0x318b1f,_0x249141){return new Promise(function(_0x4bcd8e){db[_0x48d5('0x4a')][_0x48d5('0x22')]({'raw':!![],'attributes':['item','OrderBy'],'where':{'CmContactId':_0x318b1f,'ItemClass':_0x48d5('0x92')},'include':[{'model':db[_0x48d5('0x69')],'attributes':[_0x48d5('0x8c')],'as':_0x48d5('0x93')}],'order':[_0x48d5('0x8c'),db[_0x48d5('0x6a')]['literal'](_0x48d5('0x94'))]})[_0x48d5('0x17')](function(_0x5dba6c){var _0xc6644f=0x1;var _0x2408ad=_['map'](_0x5dba6c,function(_0x316df8){_0x316df8[_0x48d5('0x95')]=_0x249141;_0x316df8[_0x48d5('0x79')]=_0x316df8[_0x48d5('0x96')];_0x316df8[_0x48d5('0x8c')]=_0xc6644f;delete _0x316df8[_0x48d5('0x97')];_0xc6644f=_0xc6644f+0x1;return _0x316df8;});return db['CmHopperAdditionalPhone'][_0x48d5('0x98')](_0x2408ad,{});})[_0x48d5('0x17')](function(){_0x4bcd8e(0x1);});});}function insertAdditionalPhones(_0x189ebe,_0x23412d){return new Promise(function(_0xb30f1b){var _0x872be1=[];for(var _0xe63626=0x0;_0xe63626<_0x23412d[_0x48d5('0x2a')];_0xe63626++){var _0x2daca2=_0x23412d[_0xe63626];_0x872be1['push'](parseContactItemType(_0x2daca2));}Promise[_0x48d5('0x8b')](_0x872be1)['then'](function(){var _0x17951e={'id':_0x189ebe['id'],'items':_0x23412d};return addAdditionalPhones(_0x17951e)['then'](function(){return addCmHopperPhones(_0x189ebe['id']);});})[_0x48d5('0x17')](function(){_0xb30f1b(_0x189ebe);});});}function parseContactItemType(_0x1e2315){return new Promise(function(_0x15e251){if(_0x1e2315[_0x48d5('0x61')]('ItemTypeId')){_0x15e251(_0x1e2315);}else{return db[_0x48d5('0x69')][_0x48d5('0x25')]({'where':{'name':_0x1e2315[_0x48d5('0x93')]}})[_0x48d5('0x17')](function(_0x35a6a4){if(_[_0x48d5('0x55')](_0x35a6a4))_0x1e2315[_0x48d5('0x8f')]=null;else _0x1e2315[_0x48d5('0x8f')]=_0x35a6a4['id'];_0x15e251(_0x1e2315);});}});}exports[_0x48d5('0x99')]=function(_0x10ccb8,_0x3b12f6){return db['CmContactHasItem'][_0x48d5('0x22')]({'raw':!![],'where':{'CmContactId':_0x10ccb8[_0x48d5('0x26')]['id'],'ItemClass':_0x48d5('0x92')},'include':[{'model':db['ContactItemType'],'as':_0x48d5('0x93')}],'order':[[_0x48d5('0x8c')],[db[_0x48d5('0x6a')]['literal'](_0x48d5('0x94'))]]})['then'](function(_0x49fb39){return _0x49fb39;})['then'](respondWithResult(_0x3b12f6,null))[_0x48d5('0x24')](handleError(_0x3b12f6,null));};exports[_0x48d5('0x9a')]=function(_0x430239,_0x4df4da){return db[_0x48d5('0x4a')][_0x48d5('0x22')]({'raw':!![],'where':{'CmContactId':_0x430239[_0x48d5('0x38')]['fromContactId']}})['then'](function(_0x3ac591){var _0x29fc99=_['map'](_0x3ac591,function(_0x45ac74){_0x45ac74[_0x48d5('0x9b')]=_0x430239[_0x48d5('0x38')][_0x48d5('0x9c')];return _0x45ac74;});return db['CmContactHasItem'][_0x48d5('0x98')](_0x29fc99,{});})[_0x48d5('0x17')](function(){return addCmHopperPhones(_0x430239[_0x48d5('0x38')][_0x48d5('0x9c')]);})[_0x48d5('0x17')](function(){return['ok'];})['then'](respondWithResult(_0x4df4da,null))[_0x48d5('0x24')](handleError(_0x4df4da,null));};exports[_0x48d5('0x9d')]=function(_0x219aad,_0x3ce379){var _0x36bc61=[];_0x36bc61[_0x48d5('0x5d')](createCmHopperPhone(_0x219aad['body']['id'],_0x219aad[_0x48d5('0x38')][_0x48d5('0x9e')]));Promise[_0x48d5('0x8b')](_0x36bc61)[_0x48d5('0x17')](function(){return[0x1];})[_0x48d5('0x17')](respondWithResult(_0x3ce379,null));};exports[_0x48d5('0x9f')]=function(_0xc15fb5,_0x5c716e){var _0x2d68d9={'raw':![],'where':{}};var _0xc27338={};var _0x16c20c={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0xc15fb5[_0x48d5('0x26')]['id']}})['then'](handleEntityNotFound(_0x5c716e,null))['then'](function(_0x53d5d3){if(_0x53d5d3){_0xc27338[_0x48d5('0x7e')]=_['keys'](db[_0x48d5('0x3e')]['rawAttributes']);_0xc27338[_0x48d5('0x2e')]=_['keys'](_0xc15fb5['query']);_0xc27338['filters']=_['intersection'](_0xc27338[_0x48d5('0x7e')],_0xc27338[_0x48d5('0x2e')]);_0x2d68d9[_0x48d5('0x80')]=_[_0x48d5('0x7d')](_0xc27338[_0x48d5('0x7e')],qs[_0x48d5('0x7f')](_0xc15fb5[_0x48d5('0x2e')][_0x48d5('0x7f')]));_0x2d68d9[_0x48d5('0x80')]=_0x2d68d9[_0x48d5('0x80')][_0x48d5('0x2a')]?_0x2d68d9[_0x48d5('0x80')]:_0xc27338[_0x48d5('0x7e')];if(!_0xc15fb5['query'][_0x48d5('0x61')]('nolimit')){_0x2d68d9[_0x48d5('0x13')]=qs[_0x48d5('0x13')](_0xc15fb5['query'][_0x48d5('0x13')]);_0x2d68d9[_0x48d5('0x11')]=qs[_0x48d5('0x11')](_0xc15fb5[_0x48d5('0x2e')]['offset']);}_0x2d68d9['order']=qs[_0x48d5('0x82')](_0xc15fb5['query']['sort']);_0x2d68d9[_0x48d5('0x5b')]=qs[_0x48d5('0x83')](_[_0x48d5('0x84')](_0xc15fb5[_0x48d5('0x2e')],_0xc27338['filters']));_0x2d68d9[_0x48d5('0x5b')]['ContactId']=_0x53d5d3['id'];if(_0xc15fb5[_0x48d5('0x2e')][_0x48d5('0x85')]){_0x2d68d9[_0x48d5('0x5b')]=_[_0x48d5('0x86')](_0x2d68d9['where'],{'$or':_[_0x48d5('0x6f')](_0x2d68d9[_0x48d5('0x80')],function(_0x50de30){var _0x219d48={};_0x219d48[_0x50de30]={'$like':'%'+_0xc15fb5[_0x48d5('0x2e')][_0x48d5('0x85')]+'%'};return _0x219d48;})});}_0x2d68d9=_[_0x48d5('0x86')]({},_0x2d68d9,_0xc15fb5['options']);return db[_0x48d5('0x3e')]['count']({'where':_0x2d68d9[_0x48d5('0x5b')]})['then'](function(_0x3304cb){_0x16c20c[_0x48d5('0x14')]=_0x3304cb;if(_0xc15fb5[_0x48d5('0x2e')][_0x48d5('0xa0')]){_0x2d68d9[_0x48d5('0xa1')]=[{'all':!![]}];}return db[_0x48d5('0x3e')][_0x48d5('0x22')](_0x2d68d9);})[_0x48d5('0x17')](function(_0x1297d6){_0x16c20c[_0x48d5('0xa2')]=_0x1297d6;return _0x16c20c;});}})['then'](respondWithFilteredResult(_0x5c716e,_0x2d68d9))['catch'](handleError(_0x5c716e,null));};exports['getHopperHistories']=function(_0x4c6706,_0x3d2e6c){var _0x29aff2={'raw':!![],'where':{}};var _0x7914ff={};var _0x3f2ba5={'count':0x0,'rows':[]};return db[_0x48d5('0x27')][_0x48d5('0x7b')]({'where':{'id':_0x4c6706[_0x48d5('0x26')]['id']}})[_0x48d5('0x17')](handleEntityNotFound(_0x3d2e6c,null))[_0x48d5('0x17')](function(_0xdf4feb){if(_0xdf4feb){_0x7914ff[_0x48d5('0x7e')]=_['keys'](db[_0x48d5('0xa3')][_0x48d5('0x7c')]);_0x7914ff[_0x48d5('0x2e')]=_['keys'](_0x4c6706[_0x48d5('0x2e')]);_0x7914ff['filters']=_[_0x48d5('0x7d')](_0x7914ff[_0x48d5('0x7e')],_0x7914ff[_0x48d5('0x2e')]);_0x29aff2[_0x48d5('0x80')]=_[_0x48d5('0x7d')](_0x7914ff[_0x48d5('0x7e')],qs[_0x48d5('0x7f')](_0x4c6706['query']['fields']));_0x29aff2['attributes']=_0x29aff2[_0x48d5('0x80')][_0x48d5('0x2a')]?_0x29aff2[_0x48d5('0x80')]:_0x7914ff[_0x48d5('0x7e')];if(!_0x4c6706[_0x48d5('0x2e')][_0x48d5('0x61')](_0x48d5('0xa4'))){_0x29aff2[_0x48d5('0x13')]=qs[_0x48d5('0x13')](_0x4c6706[_0x48d5('0x2e')]['limit']);_0x29aff2['offset']=qs['offset'](_0x4c6706[_0x48d5('0x2e')][_0x48d5('0x11')]);}_0x29aff2[_0x48d5('0x81')]=qs[_0x48d5('0x82')](_0x4c6706[_0x48d5('0x2e')][_0x48d5('0x82')]);_0x29aff2[_0x48d5('0x5b')]=qs[_0x48d5('0x83')](_[_0x48d5('0x84')](_0x4c6706[_0x48d5('0x2e')],_0x7914ff[_0x48d5('0x83')]));_0x29aff2[_0x48d5('0x5b')][_0x48d5('0xa5')]=_0xdf4feb['id'];if(_0x4c6706[_0x48d5('0x2e')][_0x48d5('0x85')]){_0x29aff2['where']=_[_0x48d5('0x86')](_0x29aff2[_0x48d5('0x5b')],{'$or':_['map'](_0x29aff2[_0x48d5('0x80')],function(_0x20a9d5){var _0x42cb5f={};_0x42cb5f[_0x20a9d5]={'$like':'%'+_0x4c6706[_0x48d5('0x2e')]['filter']+'%'};return _0x42cb5f;})});}_0x29aff2=_[_0x48d5('0x86')]({},_0x29aff2,_0x4c6706[_0x48d5('0x87')]);return db['CmHopperHistory']['count']({'where':_0x29aff2[_0x48d5('0x5b')]})[_0x48d5('0x17')](function(_0x1b03a0){_0x3f2ba5[_0x48d5('0x14')]=_0x1b03a0;if(_0x4c6706['query'][_0x48d5('0xa0')]){_0x29aff2[_0x48d5('0xa1')]=[{'all':!![]}];}return db[_0x48d5('0xa3')][_0x48d5('0x22')](_0x29aff2);})[_0x48d5('0x17')](function(_0xa469dd){_0x3f2ba5[_0x48d5('0xa2')]=_0xa469dd;return _0x3f2ba5;});}})[_0x48d5('0x17')](respondWithFilteredResult(_0x3d2e6c,_0x29aff2))['catch'](handleError(_0x3d2e6c,null));};exports['getHopperFinals']=function(_0x5e0d2a,_0x2ca42){var _0x32979c={'raw':!![],'where':{}};var _0x25539f={};var _0x5ec23a={'count':0x0,'rows':[]};return db[_0x48d5('0x27')][_0x48d5('0x7b')]({'where':{'id':_0x5e0d2a['params']['id']}})[_0x48d5('0x17')](handleEntityNotFound(_0x2ca42,null))['then'](function(_0x4e4fdf){if(_0x4e4fdf){_0x25539f[_0x48d5('0x7e')]=_['keys'](db[_0x48d5('0x4b')][_0x48d5('0x7c')]);_0x25539f['query']=_[_0x48d5('0x29')](_0x5e0d2a['query']);_0x25539f['filters']=_['intersection'](_0x25539f[_0x48d5('0x7e')],_0x25539f[_0x48d5('0x2e')]);_0x32979c['attributes']=_[_0x48d5('0x7d')](_0x25539f[_0x48d5('0x7e')],qs[_0x48d5('0x7f')](_0x5e0d2a[_0x48d5('0x2e')][_0x48d5('0x7f')]));_0x32979c['attributes']=_0x32979c[_0x48d5('0x80')][_0x48d5('0x2a')]?_0x32979c['attributes']:_0x25539f[_0x48d5('0x7e')];if(!_0x5e0d2a[_0x48d5('0x2e')][_0x48d5('0x61')](_0x48d5('0xa4'))){_0x32979c['limit']=qs[_0x48d5('0x13')](_0x5e0d2a[_0x48d5('0x2e')][_0x48d5('0x13')]);_0x32979c[_0x48d5('0x11')]=qs[_0x48d5('0x11')](_0x5e0d2a[_0x48d5('0x2e')][_0x48d5('0x11')]);}_0x32979c[_0x48d5('0x81')]=qs['sort'](_0x5e0d2a['query'][_0x48d5('0x82')]);_0x32979c[_0x48d5('0x5b')]=qs['filters'](_[_0x48d5('0x84')](_0x5e0d2a['query'],_0x25539f[_0x48d5('0x83')]));_0x32979c[_0x48d5('0x5b')][_0x48d5('0xa5')]=_0x4e4fdf['id'];if(_0x5e0d2a[_0x48d5('0x2e')]['filter']){_0x32979c[_0x48d5('0x5b')]=_['merge'](_0x32979c[_0x48d5('0x5b')],{'$or':_[_0x48d5('0x6f')](_0x32979c[_0x48d5('0x80')],function(_0x178ed8){var _0x29ab48={};_0x29ab48[_0x178ed8]={'$like':'%'+_0x5e0d2a[_0x48d5('0x2e')][_0x48d5('0x85')]+'%'};return _0x29ab48;})});}_0x32979c=_[_0x48d5('0x86')]({},_0x32979c,_0x5e0d2a[_0x48d5('0x87')]);return db[_0x48d5('0x4b')]['count']({'where':_0x32979c[_0x48d5('0x5b')]})['then'](function(_0xb834ef){_0x5ec23a[_0x48d5('0x14')]=_0xb834ef;if(_0x5e0d2a[_0x48d5('0x2e')]['includeAll']){_0x32979c[_0x48d5('0xa1')]=[{'all':!![]}];}return db[_0x48d5('0x4b')]['findAll'](_0x32979c);})[_0x48d5('0x17')](function(_0x37b3c2){_0x5ec23a[_0x48d5('0xa2')]=_0x37b3c2;return _0x5ec23a;});}})[_0x48d5('0x17')](respondWithFilteredResult(_0x2ca42,_0x32979c))['catch'](handleError(_0x2ca42,null));};exports[_0x48d5('0xa6')]=function(_0x47034f,_0x378ef8){var _0x3811e6={'raw':!![],'where':{}};var _0x4d4d22={};var _0x13209f={'count':0x0,'rows':[]};return db[_0x48d5('0x27')]['findOne']({'where':{'id':_0x47034f['params']['id']}})[_0x48d5('0x17')](handleEntityNotFound(_0x378ef8,null))['then'](function(_0x3c960c){if(_0x3c960c){_0x4d4d22[_0x48d5('0x7e')]=_[_0x48d5('0x29')](db['JscriptySessionReport'][_0x48d5('0x7c')]);_0x4d4d22[_0x48d5('0x2e')]=_[_0x48d5('0x29')](_0x47034f[_0x48d5('0x2e')]);_0x4d4d22['filters']=_['intersection'](_0x4d4d22[_0x48d5('0x7e')],_0x4d4d22[_0x48d5('0x2e')]);_0x3811e6[_0x48d5('0x80')]=_[_0x48d5('0x7d')](_0x4d4d22['model'],qs['fields'](_0x47034f[_0x48d5('0x2e')][_0x48d5('0x7f')]));_0x3811e6['attributes']=_0x3811e6[_0x48d5('0x80')]['length']?_0x3811e6[_0x48d5('0x80')]:_0x4d4d22[_0x48d5('0x7e')];if(!_0x47034f[_0x48d5('0x2e')]['hasOwnProperty'](_0x48d5('0xa4'))){_0x3811e6['limit']=qs[_0x48d5('0x13')](_0x47034f[_0x48d5('0x2e')][_0x48d5('0x13')]);_0x3811e6['offset']=qs['offset'](_0x47034f[_0x48d5('0x2e')][_0x48d5('0x11')]);}_0x3811e6[_0x48d5('0x81')]=qs[_0x48d5('0x82')](_0x47034f[_0x48d5('0x2e')][_0x48d5('0x82')]);_0x3811e6[_0x48d5('0x5b')]=qs[_0x48d5('0x83')](_['pick'](_0x47034f[_0x48d5('0x2e')],_0x4d4d22[_0x48d5('0x83')]));_0x3811e6['where'][_0x48d5('0xa5')]=_0x3c960c['id'];if(_0x47034f[_0x48d5('0x2e')][_0x48d5('0x85')]){_0x3811e6[_0x48d5('0x5b')]=_[_0x48d5('0x86')](_0x3811e6['where'],{'$or':_[_0x48d5('0x6f')](_0x3811e6[_0x48d5('0x80')],function(_0x3c84fb){var _0x58cfc6={};_0x58cfc6[_0x3c84fb]={'$like':'%'+_0x47034f[_0x48d5('0x2e')][_0x48d5('0x85')]+'%'};return _0x58cfc6;})});}_0x3811e6=_['merge']({},_0x3811e6,_0x47034f['options']);return db['JscriptySessionReport']['count']({'where':_0x3811e6[_0x48d5('0x5b')]})['then'](function(_0x36eb1e){_0x13209f['count']=_0x36eb1e;if(_0x47034f[_0x48d5('0x2e')][_0x48d5('0xa0')]){_0x3811e6['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x48d5('0x22')](_0x3811e6);})['then'](function(_0x541245){_0x13209f[_0x48d5('0xa2')]=_0x541245;return _0x13209f;});}})['then'](respondWithFilteredResult(_0x378ef8,_0x3811e6))[_0x48d5('0x24')](handleError(_0x378ef8,null));};exports['uploadCsv']=function(_0x455cd1,_0x27407d){try{if(!_0x455cd1[_0x48d5('0x38')][_0x48d5('0x5e')]){throw new Error(_0x48d5('0xa7'));}if(!_0x455cd1[_0x48d5('0x38')]['binding_keys']){throw new Error(_0x48d5('0xa8'));}if(!_0x455cd1[_0x48d5('0x38')][_0x48d5('0xa9')]){throw new Error(_0x48d5('0xaa'));}if(!_0x455cd1[_0x48d5('0x38')]['socket_timestamp']){throw new Error(_0x48d5('0xab'));}var _0x1622a3=_0x455cd1['body']['binding_keys'][_0x48d5('0xac')](',');var _0x44232c=_0x455cd1[_0x48d5('0x38')][_0x48d5('0xa9')]['split'](',');if(!_0x1622a3[_0x48d5('0x2a')]||!_0x44232c[_0x48d5('0x2a')]||_0x1622a3[_0x48d5('0x2a')]!==_0x44232c[_0x48d5('0x2a')]){throw new Error(_0x48d5('0xad'));}_0x455cd1[_0x48d5('0x38')]['fields']=_[_0x48d5('0xae')](_0x1622a3,_0x44232c);if(!_0x455cd1[_0x48d5('0x38')][_0x48d5('0x7f')][_0x48d5('0x79')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x455cd1[_0x48d5('0x38')][_0x48d5('0x7f')][_0x48d5('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x206f91=path[_0x48d5('0x3d')](config['root'],_0x48d5('0xb0'),_0x455cd1[_0x48d5('0xb1')][_0x48d5('0xb2')]);fs['chmodSync'](_0x206f91,parseInt(_0x48d5('0xb3'),0x8));var _0xc07a41=require(_0x48d5('0xb4'))['fork'](path['join'](__dirname,'../../components/import/cm/csv'),[_0x206f91,_0x455cd1[_0x48d5('0x38')][_0x48d5('0xb5')],_0x455cd1[_0x48d5('0x38')][_0x48d5('0xa9')],_0x455cd1[_0x48d5('0x38')][_0x48d5('0x5e')],_0x455cd1['body']['CompanyId'],_0x455cd1[_0x48d5('0x38')][_0x48d5('0x5a')],_0x455cd1[_0x48d5('0x38')][_0x48d5('0xb6')]]);return _0x27407d['status'](0xc8)[_0x48d5('0x10')]({'message':_0x48d5('0xb7'),'pid':_0xc07a41[_0x48d5('0xb8')]});}catch(_0x20dcb5){return _0x27407d['status'](0x1f4)['send'](_0x20dcb5);}};exports[_0x48d5('0xb9')]=function(_0xa76023,_0x370016){var _0x32d778=fs[_0x48d5('0xba')](_0xa76023[_0x48d5('0xb1')][_0x48d5('0x2')]);Papa[_0x48d5('0xbb')](_0x32d778,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x17ab42){return _0x370016[_0x48d5('0xf')](0xc8)['json']({'file':_0xa76023[_0x48d5('0xb1')],'fields':_0x17ab42['meta'][_0x48d5('0x7f')]});}});};exports['import']=function(_0x18364c,_0x3a2d76){return db['User'][_0x48d5('0x22')]({'raw':!![],'attributes':['id'],'where':{'role':_0x48d5('0xbc')}})[_0x48d5('0x17')](function(_0x47abc8){var _0x3b55dd=![];if(!_0x18364c[_0x48d5('0x38')]['ListId']){throw new Error(_0x48d5('0xa7'));}if(!_0x18364c[_0x48d5('0x38')][_0x48d5('0xbd')][_0x48d5('0x79')]){throw new Error(_0x48d5('0xbe'));}if(!_0x18364c[_0x48d5('0x38')][_0x48d5('0xbd')][_0x48d5('0xaf')]){throw new Error(_0x48d5('0xbf'));}if(!_0x18364c['body']['socket_timestamp']){throw new Error(_0x48d5('0xab'));}var _0x244616=require(_0x48d5('0xb4'))[_0x48d5('0xc0')](path['join'](__dirname,_0x48d5('0xc1')),[_0x18364c[_0x48d5('0x26')]['id'],JSON['stringify'](_0x18364c[_0x48d5('0x38')]),JSON[_0x48d5('0xc2')](_0x47abc8)]);_0x244616['on'](_0x48d5('0xc3'),function(){_0x3b55dd=!![];return _0x3a2d76['status'](0xc8)[_0x48d5('0x10')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x244616[_0x48d5('0xb8')]});});_0x244616['on']('exit',function(_0x118aa8){if(_0x118aa8&&!_0x3b55dd){return _0x3a2d76['status'](0x1f4)[_0x48d5('0x10')]({'message':_0x48d5('0xc4'),'pid':_0x244616[_0x48d5('0xb8')]});}});})['catch'](handleError(_0x3a2d76,null));};exports[_0x48d5('0xc5')]=function(_0x51bed9,_0x40cf6a){return db[_0x48d5('0xc6')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x48d5('0x17')](function(_0x5d7a2c){var _0x4c13af=![];if(!_0x51bed9[_0x48d5('0x38')][_0x48d5('0x5e')]){throw new Error(_0x48d5('0xa7'));}if(!_0x51bed9[_0x48d5('0x38')][_0x48d5('0xbd')]['phone']){throw new Error(_0x48d5('0xbe'));}if(!_0x51bed9[_0x48d5('0x38')][_0x48d5('0xbd')][_0x48d5('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x51bed9[_0x48d5('0x38')][_0x48d5('0xb6')]){throw new Error(_0x48d5('0xab'));}var _0x8553f5=require(_0x48d5('0xb4'))[_0x48d5('0xc0')](path[_0x48d5('0x3d')](__dirname,_0x48d5('0xc7')),[_0x51bed9[_0x48d5('0x26')]['id'],JSON[_0x48d5('0xc2')](_0x51bed9[_0x48d5('0x38')]),JSON[_0x48d5('0xc2')](_0x5d7a2c)]);_0x8553f5['on'](_0x48d5('0xc3'),function(){_0x4c13af=!![];return _0x40cf6a[_0x48d5('0xf')](0xc8)[_0x48d5('0x10')]({'message':_0x48d5('0xc8'),'pid':_0x8553f5[_0x48d5('0xb8')]});});_0x8553f5['on']('exit',function(_0x333ca3){if(_0x333ca3&&!_0x4c13af){return _0x40cf6a[_0x48d5('0xf')](0x1f4)[_0x48d5('0x10')]({'message':_0x48d5('0xc4'),'pid':_0x8553f5[_0x48d5('0xb8')]});}});})[_0x48d5('0x24')](handleError(_0x40cf6a,null));};exports[_0x48d5('0xc9')]=function(_0xc1024f,_0x501880){var _0x90cb3c=[_0x48d5('0xca'),'chat',_0x48d5('0xcb'),'openchannel',_0x48d5('0xcc'),_0x48d5('0xcd'),_0x48d5('0xce')];var _0x59f073={'offset':0x0,'order':qs[_0x48d5('0x82')](_0x48d5('0xcf'))},_0x2836b7={'count':0x0,'rows':[]};Promise[_0x48d5('0xd0')]()[_0x48d5('0x17')](function(){if(_0xc1024f[_0x48d5('0x2e')]['channel']){if(!_['includes'](_0x90cb3c,_0xc1024f['query'][_0x48d5('0xd1')][_0x48d5('0xd2')]())){throw new Error(_0x48d5('0xd3'));}_0x90cb3c=[_0xc1024f[_0x48d5('0x2e')]['channel'][_0x48d5('0xd2')]()];}if(_0xc1024f['query'][_0x48d5('0xd4')]){try{var _0x22036d=JSON[_0x48d5('0xbb')](_0xc1024f[_0x48d5('0x2e')]['range']);if(!moment(_0x22036d[_0x48d5('0x39')])[_0x48d5('0xd5')]()){throw new Error(_0x48d5('0xd6'));}if(!moment(_0x22036d['to'])[_0x48d5('0xd5')]()){throw new Error(_0x48d5('0xd7'));}}catch(_0x410834){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0xc1024f['query']['hasOwnProperty'](_0x48d5('0xa4'))){_0x59f073[_0x48d5('0x13')]=qs[_0x48d5('0x13')](_0xc1024f[_0x48d5('0x2e')][_0x48d5('0x13')]||0xa);_0x59f073[_0x48d5('0x11')]=qs[_0x48d5('0x11')](_0xc1024f['query'][_0x48d5('0x11')]);}var _0x3a8599=_0x90cb3c[_0x48d5('0x6f')](function(_0x3a1f94){if(_0x3a1f94===_0x48d5('0xce')){var _0x40aff8={'attributes':['id','uniqueid','type',_0x48d5('0xd8'),_0x48d5('0xd9'),_0x48d5('0xda'),_0x48d5('0xdb'),_0x48d5('0xdc'),'duration',_0x48d5('0xdd'),_0x48d5('0xde'),_0x48d5('0xdf'),'userSecondDisposition',_0x48d5('0xe0'),'UserId'],'where':{'ContactId':_0xc1024f[_0x48d5('0x26')]['id']},'include':[{'model':db[_0x48d5('0xc6')],'as':'User','attributes':['id',_0x48d5('0x1d'),_0x48d5('0xe1'),_0x48d5('0x31')]}],'order':[[_0x48d5('0xde'),_0x48d5('0xe2')]]};if(_0xc1024f['query'][_0x48d5('0xd4')]){_0x40aff8[_0x48d5('0x5b')]['createdAt']={'$gte':_0x22036d[_0x48d5('0x39')],'$lte':_0x22036d['to']};}return db[_0x48d5('0x4c')][_0x48d5('0xe3')](_0x40aff8)[_0x48d5('0x17')](function(_0x4e711b){_0x2836b7['count']+=_0x4e711b[_0x48d5('0x14')];return _[_0x48d5('0x6f')](_0x4e711b[_0x48d5('0xa2')],function(_0x24461e){var _0x283cfd=_0x24461e[_0x48d5('0x3a')]({'plain':!![]});_0x283cfd[_0x48d5('0xd1')]=_0x3a1f94;if(_0x283cfd[_0x48d5('0xc6')]){_0x283cfd[_0x48d5('0xc6')]={'id':_0x283cfd['User']['id'],'name':_0x283cfd[_0x48d5('0xc6')][_0x48d5('0x1d')],'fullname':_0x283cfd[_0x48d5('0xc6')][_0x48d5('0xe1')],'alias':_0x283cfd[_0x48d5('0xc6')][_0x48d5('0x31')]};}return _0x283cfd;});});}else{var _0x14bd29=_[_0x48d5('0xe4')](_0x3a1f94)+(_0x3a1f94===_0x48d5('0xe5')?'Website':_0x48d5('0xe6'));var _0x297ed6={'attributes':['id','closed',_0x48d5('0xe7'),'createdAt',_0x48d5('0xdd'),_0x48d5('0xe8'),_0x48d5('0xe9'),_0x48d5('0xea'),_0x48d5('0xeb'),_0x14bd29+'Id'],'where':{'ContactId':_0xc1024f[_0x48d5('0x26')]['id']},'include':[{'model':db[_0x14bd29],'as':'Account','attributes':['id',_0x48d5('0x1d'),_0x48d5('0xec')]},{'model':db['User'],'as':_0x48d5('0xed'),'attributes':['id','name','fullname']},{'model':db[_0x48d5('0x64')],'as':_0x48d5('0x65'),'attributes':['id',_0x48d5('0x1d'),_0x48d5('0x66')],'through':{'attributes':[]}}],'order':[[_0x48d5('0xde'),_0x48d5('0xe2')]]};if(_0xc1024f[_0x48d5('0x2e')][_0x48d5('0xd4')]){_0x297ed6['where'][_0x48d5('0xde')]={'$gte':_0x22036d[_0x48d5('0x39')],'$lte':_0x22036d['to']};}switch(_0x3a1f94){case _0x48d5('0xe5'):_0x297ed6[_0x48d5('0x80')][_0x48d5('0x5d')](_0x48d5('0xee'),_0x48d5('0xef'),_0x48d5('0xf0'),_0x48d5('0xf1'),'osName',_0x48d5('0xf2'),_0x48d5('0xf3'),_0x48d5('0xf4'),_0x48d5('0xf5'));break;case'mail':_0x297ed6[_0x48d5('0x80')][_0x48d5('0x5d')](_0x48d5('0xf6'),'substatus');break;case _0x48d5('0xf7'):_0x297ed6['attributes'][_0x48d5('0x5d')](_0x48d5('0xf8'),_0x48d5('0xf9'));break;}return db[_[_0x48d5('0xe4')](_0x3a1f94)+'Interaction'][_0x48d5('0xe3')](_0x297ed6)[_0x48d5('0x17')](function(_0x58f94b){_0x2836b7['count']+=_0x58f94b[_0x48d5('0x14')];return _[_0x48d5('0x6f')](_0x58f94b['rows'],function(_0x307e51){var _0x3754d4=_0x307e51[_0x48d5('0x3a')]({'plain':!![]});_0x3754d4['channel']=_0x3a1f94;if(_0x3754d4[_0x48d5('0xed')]){_0x3754d4[_0x48d5('0xed')]={'id':_0x3754d4[_0x48d5('0xed')]['id'],'name':_0x3754d4[_0x48d5('0xed')][_0x48d5('0x1d')],'fullname':_0x3754d4[_0x48d5('0xed')][_0x48d5('0xe1')]};}return _0x3754d4;});});}});return Promise[_0x48d5('0x8b')](_0x3a8599);})[_0x48d5('0x17')](function(_0x1bc9ca){return _(_0x1bc9ca)['flatten']()[_0x48d5('0xfa')](_0x48d5('0xde'))[_0x48d5('0xfb')]()[_0x48d5('0xfc')]();})['then'](function(_0x327708){_0x2836b7[_0x48d5('0xa2')]=_0x59f073[_0x48d5('0x13')]?_0x327708['slice'](_0x59f073['offset'],_0x59f073['offset']+_0x59f073[_0x48d5('0x13')]):_0x327708;return _0x2836b7;})[_0x48d5('0x17')](respondWithFilteredResult(_0x501880,_0x59f073))[_0x48d5('0x24')](handleError(_0x501880,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 1328002..ad87bb8 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc932=['remove','emit','hasOwnProperty','events','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x5b5232,_0x48f82f){var _0x33dfa5=function(_0x278c5e){while(--_0x278c5e){_0x5b5232['push'](_0x5b5232['shift']());}};_0x33dfa5(++_0x48f82f);}(_0xc932,0x93));var _0x2c93=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc932[_0x46698a];return _0x356db0;};'use strict';var EventEmitter=require(_0x2c93('0x0'));var CmContact=require(_0x2c93('0x1'))['db'][_0x2c93('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2c93('0x3')](0x0);var events={'afterCreate':_0x2c93('0x4'),'afterUpdate':'update','afterDestroy':_0x2c93('0x5')};function emitEvent(_0x6bd3d9){return function(_0x9c0121,_0x5ae451,_0x4506db){CmContactEvents[_0x2c93('0x6')](_0x6bd3d9+':'+_0x9c0121['id'],_0x9c0121);CmContactEvents[_0x2c93('0x6')](_0x6bd3d9,_0x9c0121);_0x4506db(null);};}for(var e in events){if(events[_0x2c93('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0xc626=['../../mysqldb','CmContact','setMaxListeners','save','update','emit','hook','exports'];(function(_0x1d1afd,_0x4dbc30){var _0x517e05=function(_0x102cfb){while(--_0x102cfb){_0x1d1afd['push'](_0x1d1afd['shift']());}};_0x517e05(++_0x4dbc30);}(_0xc626,0x1d0));var _0x6c62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc626[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x6c62('0x0'))['db'][_0x6c62('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x6c62('0x2')](0x0);var events={'afterCreate':_0x6c62('0x3'),'afterUpdate':_0x6c62('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5b2c8d){return function(_0x33d340,_0x192d24,_0x309914){CmContactEvents[_0x6c62('0x5')](_0x5b2c8d+':'+_0x33d340['id'],_0x33d340);CmContactEvents[_0x6c62('0x5')](_0x5b2c8d,_0x33d340);_0x309914(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x6c62('0x6')](e,emitEvent(event));}}module[_0x6c62('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 8b443e7..3030d30 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x472c=['fax','email','FULLTEXT','utf8mb4_unicode_ci','get','cmContact','afterCreate','inspect','scheduledat','format','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','minutes','YYYY-MM-DD\x20HH:mm:ss','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','priority','callbackUniqueid','catch','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','error','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','ListId','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','onlyIfOpen','Campaign','List\x20not\x20found','isEmpty','destroy','ContactId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','CmContact','cm_contacts','phone','fti_cm_contacts','mobile'];(function(_0x5ee2de,_0x3cc7de){var _0x366793=function(_0x497f44){while(--_0x497f44){_0x5ee2de['push'](_0x5ee2de['shift']());}};_0x366793(++_0x3cc7de);}(_0x472c,0x1a6));var _0xc472=function(_0x53d51f,_0x23d04a){_0x53d51f=_0x53d51f-0x0;var _0x10ecb5=_0x472c[_0x53d51f];return _0x10ecb5;};'use strict';var _=require(_0xc472('0x0'));var util=require(_0xc472('0x1'));var logger=require('../../config/logger')(_0xc472('0x2'));var moment=require(_0xc472('0x3'));var BPromise=require(_0xc472('0x4'));var rp=require(_0xc472('0x5'));var fs=require('fs');var path=require(_0xc472('0x6'));var rimraf=require(_0xc472('0x7'));var config=require('../../config/environment');var shared=require(_0xc472('0x8'));var attributes=require(_0xc472('0x9'));module[_0xc472('0xa')]=function(_0x56b1ba,_0xec845){return _0x56b1ba['define'](_0xc472('0xb'),attributes,{'tableName':_0xc472('0xc'),'paranoid':!![],'indexes':[{'name':_0xc472('0xd'),'fields':['phone']},{'name':_0xc472('0xe'),'fields':['firstName','lastName',_0xc472('0xd'),_0xc472('0xf'),_0xc472('0x10'),_0xc472('0x11')],'type':_0xc472('0x12')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xc472('0x13'),'hooks':{'afterCreate':function(_0x2fd390,_0x43f1a9,_0x520e70){var _0x120e03=_0x56b1ba['models'];var _0x1260b6=_0x2fd390[_0xc472('0x14')]({'plain':!![]});function _0x1b48e1(){return function(_0x2d8b95){logger['error'](_0xc472('0x15'),_0xc472('0x16'),util[_0xc472('0x17')](_0x2d8b95,{'showHidden':![],'depth':null}));};}function _0x421ce5(_0x98b0b0,_0x4e9666){var _0x54627a=_0x4e9666[_0xc472('0x18')]?_0x4e9666[_0xc472('0x18')]:moment()[_0xc472('0x19')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x40dcae,_0x437e1b){if(_[_0xc472('0x1a')](_0x4e9666[_0xc472('0x1b')])){_0x40dcae({'ret':_0x54627a});}else{_0x120e03[_0xc472('0x1c')][_0xc472('0x1d')]({'where':{'id':_0x98b0b0['id']}})[_0xc472('0x1e')](function(_0x531499){if(!_[_0xc472('0x1a')](_0x531499)){var _0x15fc8d=_0x531499['dialTimezone'];if(!_[_0xc472('0x1a')](_0x15fc8d)){var _0x45a9aa=shared[_0xc472('0x1f')];var _0x2c797f=_0x45a9aa[_0x15fc8d];var _0x4885f7=_0x45a9aa[_0x4e9666[_0xc472('0x1b')]];if(!_[_0xc472('0x1a')](_0x2c797f)&&!_['isNil'](_0x4885f7)){var _0x57d11d=_0x2c797f[_0xc472('0x20')]-_0x4885f7[_0xc472('0x20')];_0x54627a=_0x4e9666[_0xc472('0x18')]?_0x4e9666[_0xc472('0x18')]:moment();var _0x12d51d=moment(_0x54627a)['add'](_0x57d11d,_0xc472('0x21'));_0x40dcae({'ret':_0x12d51d[_0xc472('0x19')](_0xc472('0x22'))});}else _0x40dcae({'ret':_0x54627a});}else _0x40dcae({'ret':_0x54627a});}else{_0x40dcae({'ret':_0x54627a});}});}});return 0xa;}var _0x1c1023=function(_0x4c84ee){return new BPromise(function(_0x1e09ed,_0x104a04){_0x421ce5(_0x4c84ee,_0x1260b6)['then'](function(_0x32f441){_0x1260b6[_0xc472('0x18')]=_0x32f441['ret'];_0x120e03['CmHopper'][_0xc472('0x1d')]({'where':{'phone':_0x1260b6[_0xc472('0xd')],'VoiceQueueId':_0x4c84ee['id']}})['then'](function(_0x2b23d7){if(!_[_0xc472('0x1a')](_0x2b23d7)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1260b6[_0xc472('0xd')]+_0xc472('0x23')+_0x4c84ee['id']);}return _0x120e03[_0xc472('0x24')][_0xc472('0x25')]({'phone':_0x1260b6['phone'],'ContactId':_0x1260b6['id'],'ListId':_0x1260b6['ListId'],'priority':_0x1260b6[_0xc472('0x26')]?_0x1260b6[_0xc472('0x26')]:0x2,'scheduledat':_0x1260b6[_0xc472('0x18')]?_0x1260b6[_0xc472('0x18')]:moment()[_0xc472('0x19')](_0xc472('0x22')),'callback':_0x1260b6[_0xc472('0x27')]?!![]:![],'callbackuniqueid':_0x1260b6[_0xc472('0x27')]?_0x1260b6[_0xc472('0x27')]:undefined,'callbackat':_0x1260b6[_0xc472('0x27')]?moment()[_0xc472('0x19')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x4c84ee['id']});})[_0xc472('0x28')](function(_0x52a6f1){_0x104a04(_0x52a6f1);});});});};var _0x2ccec2=function(_0x117a6d){return new BPromise(function(_0x9927fa,_0x22dc81){_0x421ce5(_0x117a6d,_0x1260b6)[_0xc472('0x1e')](function(_0x141a01){_0x1260b6[_0xc472('0x18')]=_0x141a01[_0xc472('0x29')];_0x120e03[_0xc472('0x24')][_0xc472('0x1d')]({'where':{'phone':_0x1260b6[_0xc472('0xd')],'VoiceQueueId':_0x117a6d['id']}})['then'](function(_0x4abf40){if(!_[_0xc472('0x1a')](_0x4abf40)){throw new Error(_0xc472('0x2a')+_0x1260b6[_0xc472('0xd')]+_0xc472('0x2b')+_0x117a6d['id']);}return _0x120e03[_0xc472('0x2c')][_0xc472('0x1d')]({'where':{'calleridnum':_0x1260b6[_0xc472('0xd')],'VoiceQueueId':_0x117a6d['id']}});})[_0xc472('0x1e')](function(_0x8d2a9a){if(!_[_0xc472('0x1a')](_0x8d2a9a)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x1260b6['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x117a6d['id']);}return _0x120e03[_0xc472('0x24')]['create']({'phone':_0x1260b6['phone'],'ContactId':_0x1260b6['id'],'ListId':_0x1260b6['ListId'],'priority':_0x1260b6['priority']?_0x1260b6['priority']:0x2,'scheduledat':_0x1260b6[_0xc472('0x18')]?_0x1260b6[_0xc472('0x18')]:moment()[_0xc472('0x19')](_0xc472('0x22')),'callback':_0x1260b6[_0xc472('0x27')]?!![]:![],'callbackuniqueid':_0x1260b6[_0xc472('0x27')]?_0x1260b6[_0xc472('0x27')]:undefined,'callbackat':_0x1260b6[_0xc472('0x27')]?moment()[_0xc472('0x19')](_0xc472('0x22')):undefined,'VoiceQueueId':_0x117a6d['id']});})[_0xc472('0x28')](function(_0x2b5e11){_0x22dc81(_0x2b5e11);});});});};function _0x352a6e(){return function(_0x10ee88){logger[_0xc472('0x2d')](_0xc472('0x15'),'afterCreate',util[_0xc472('0x17')](_0x10ee88,{'showHidden':![],'depth':null}));};}function _0x176303(_0xad6522,_0x172c0d){var _0x4c2a78=_0x172c0d[_0xc472('0x18')]?_0x172c0d[_0xc472('0x18')]:moment()[_0xc472('0x19')](_0xc472('0x22'));return new BPromise(function(_0x1de762,_0x38bdf6){if(_[_0xc472('0x1a')](_0x172c0d[_0xc472('0x1b')])){_0x1de762({'ret':_0x4c2a78});}else{_0x120e03['Campaign']['findOne']({'where':{'id':_0xad6522['id']}})[_0xc472('0x1e')](function(_0xc38575){if(!_['isNil'](_0xc38575)){var _0x3daa6b=_0xc38575[_0xc472('0x1b')];if(!_[_0xc472('0x1a')](_0x3daa6b)){var _0x3d3ef3=shared[_0xc472('0x1f')];var _0x39cb09=_0x3d3ef3[_0x3daa6b];var _0x233de9=_0x3d3ef3[_0x172c0d['dialTimezone']];if(!_[_0xc472('0x1a')](_0x39cb09)&&!_[_0xc472('0x1a')](_0x233de9)){var _0x41d5c4=_0x39cb09[_0xc472('0x20')]-_0x233de9[_0xc472('0x20')];_0x4c2a78=_0x172c0d[_0xc472('0x18')]?_0x172c0d[_0xc472('0x18')]:moment();var _0x5af189=moment(_0x4c2a78)[_0xc472('0x2e')](_0x41d5c4,_0xc472('0x21'));_0x1de762({'ret':_0x5af189['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x1de762({'ret':_0x4c2a78});}else _0x1de762({'ret':_0x4c2a78});}else{_0x1de762({'ret':_0x4c2a78});}});}});return 0xa;}var _0x151759=function(_0x5b475e){return new BPromise(function(_0x3b24e9,_0x3d91a6){_0x176303(_0x5b475e,_0x1260b6)[_0xc472('0x1e')](function(_0x386a1c){_0x1260b6[_0xc472('0x18')]=_0x386a1c['ret'];_0x120e03[_0xc472('0x24')][_0xc472('0x1d')]({'where':{'phone':_0x1260b6['phone'],'CampaignId':_0x5b475e['id']}})[_0xc472('0x1e')](function(_0xdb6254){if(!_['isNil'](_0xdb6254)){throw new Error(_0xc472('0x2a')+_0x1260b6['phone']+_0xc472('0x2f')+_0x5b475e['id']);}return _0x120e03[_0xc472('0x24')][_0xc472('0x25')]({'phone':_0x1260b6[_0xc472('0xd')],'ContactId':_0x1260b6['id'],'ListId':_0x1260b6['ListId'],'priority':_0x1260b6[_0xc472('0x26')]?_0x1260b6['priority']:0x2,'scheduledat':_0x1260b6[_0xc472('0x18')]?_0x1260b6[_0xc472('0x18')]:moment()[_0xc472('0x19')](_0xc472('0x22')),'callback':_0x1260b6[_0xc472('0x27')]?!![]:![],'callbackuniqueid':_0x1260b6['callbackUniqueid']?_0x1260b6[_0xc472('0x27')]:undefined,'callbackat':_0x1260b6['callbackUniqueid']?moment()['format'](_0xc472('0x22')):undefined,'CampaignId':_0x5b475e['id']});})[_0xc472('0x28')](function(_0x4b6d05){_0x3d91a6(_0x4b6d05);});});});};var _0x4fbaed=function(_0xc2c1d){return new BPromise(function(_0x4a9188,_0x33d6e7){_0x176303(_0xc2c1d,_0x1260b6)[_0xc472('0x1e')](function(_0x20909e){_0x1260b6[_0xc472('0x18')]=_0x20909e[_0xc472('0x29')];_0x120e03[_0xc472('0x24')][_0xc472('0x1d')]({'where':{'phone':_0x1260b6[_0xc472('0xd')],'CampaignId':_0xc2c1d['id']}})[_0xc472('0x1e')](function(_0x140092){if(!_[_0xc472('0x1a')](_0x140092)){throw new Error(_0xc472('0x2a')+_0x1260b6['phone']+_0xc472('0x30')+_0xc2c1d['id']);}return _0x120e03[_0xc472('0x2c')][_0xc472('0x1d')]({'where':{'calleridnum':_0x1260b6['phone'],'CampaignId':_0xc2c1d['id']}});})[_0xc472('0x1e')](function(_0x100ab5){if(!_[_0xc472('0x1a')](_0x100ab5)){throw new Error(_0xc472('0x31')+_0x1260b6[_0xc472('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0xc2c1d['id']);}return _0x120e03[_0xc472('0x24')][_0xc472('0x25')]({'phone':_0x1260b6[_0xc472('0xd')],'ContactId':_0x1260b6['id'],'ListId':_0x1260b6['ListId'],'priority':_0x1260b6[_0xc472('0x26')]?_0x1260b6[_0xc472('0x26')]:0x2,'scheduledat':_0x1260b6[_0xc472('0x18')]?_0x1260b6[_0xc472('0x18')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1260b6[_0xc472('0x27')]?!![]:![],'callbackuniqueid':_0x1260b6[_0xc472('0x27')]?_0x1260b6[_0xc472('0x27')]:undefined,'callbackat':_0x1260b6[_0xc472('0x27')]?moment()[_0xc472('0x19')](_0xc472('0x22')):undefined,'CampaignId':_0xc2c1d['id']});})['catch'](function(_0x28d774){_0x33d6e7(_0x28d774);});});});};if(_0x1260b6[_0xc472('0x32')]){_0x120e03['VoiceQueue'][_0xc472('0x33')]({'where':{'type':_0xc472('0x34')},'attributes':['id',_0xc472('0x35'),'dialTimezone'],'include':[{'model':_0x120e03[_0xc472('0x36')],'as':_0xc472('0x37'),'where':{'id':_0x1260b6[_0xc472('0x32')]}}]})[_0xc472('0x1e')](function(_0x1cf6dd){if(_0x1cf6dd){var _0x2f3ed7=[];for(var _0x47959d=0x0,_0x524a5b;_0x47959d<_0x1cf6dd[_0xc472('0x38')];_0x47959d+=0x1){_0x524a5b=_0x1cf6dd[_0x47959d][_0xc472('0x14')]({'plain':!![]});switch(_0x524a5b[_0xc472('0x35')]){case _0xc472('0x39'):_0x2ccec2(_0x524a5b)[_0xc472('0x28')](_0x1b48e1());break;case'onlyIfOpen':_0x1c1023(_0x524a5b)['catch'](_0x1b48e1());break;default:_0x176303(_0x524a5b,_0x1260b6)['then'](function(_0x5d2f18){_0x1260b6['scheduledat']=_0x5d2f18[_0xc472('0x29')];_0x120e03['CmHopper'][_0xc472('0x25')]({'phone':_0x1260b6[_0xc472('0xd')],'ContactId':_0x1260b6['id'],'ListId':_0x1260b6[_0xc472('0x32')],'scheduledat':_0x1260b6[_0xc472('0x18')]?_0x1260b6[_0xc472('0x18')]:moment()[_0xc472('0x19')](_0xc472('0x22')),'priority':_0x1260b6[_0xc472('0x26')]?_0x1260b6[_0xc472('0x26')]:0x2,'callback':_0x1260b6[_0xc472('0x27')]?!![]:![],'callbackuniqueid':_0x1260b6[_0xc472('0x27')]?_0x1260b6['callbackUniqueid']:undefined,'callbackat':_0x1260b6[_0xc472('0x27')]?moment()[_0xc472('0x19')](_0xc472('0x22')):undefined,'VoiceQueueId':_0x524a5b['id']})[_0xc472('0x28')](_0x1b48e1());});}}}})['then'](function(){return _0x120e03[_0xc472('0x1c')][_0xc472('0x33')]({'where':{'type':_0xc472('0x34')},'attributes':['id'],'include':[{'model':_0x120e03['CmList'],'as':_0xc472('0x3a'),'where':{'id':_0x1260b6[_0xc472('0x32')]}}]})[_0xc472('0x1e')](function(_0x137af4){if(_0x137af4){var _0x33bad3=[];for(var _0x166802=0x0,_0x5a57b9;_0x166802<_0x137af4[_0xc472('0x38')];_0x166802+=0x1){_0x5a57b9=_0x137af4[_0x166802][_0xc472('0x14')]({'plain':!![]});_0x120e03[_0xc472('0x3b')][_0xc472('0x25')]({'phone':_0x1260b6[_0xc472('0xd')],'ContactId':_0x1260b6['id'],'ListId':_0x1260b6[_0xc472('0x32')],'VoiceQueueId':_0x5a57b9['id']})[_0xc472('0x28')](function(_0x143c82){logger[_0xc472('0x2d')](_0xc472('0x3c'),_0xc472('0x16'),_0x143c82[_0xc472('0x3d')]);});}}});})[_0xc472('0x1e')](function(){return _0x120e03['Campaign']['findAll']({'attributes':['id',_0xc472('0x35'),_0xc472('0x1b')],'include':[{'model':_0x120e03[_0xc472('0x36')],'as':_0xc472('0x37'),'where':{'id':_0x1260b6['ListId']}}]})['then'](function(_0x31e551){if(_0x31e551){var _0x2ce787=[];for(var _0x142571=0x0,_0x62e979;_0x142571<_0x31e551[_0xc472('0x38')];_0x142571+=0x1){_0x62e979=_0x31e551[_0x142571][_0xc472('0x14')]({'plain':!![]});switch(_0x62e979[_0xc472('0x35')]){case _0xc472('0x39'):_0x4fbaed(_0x62e979)[_0xc472('0x28')](_0x352a6e());break;case _0xc472('0x3e'):_0x151759(_0x62e979)[_0xc472('0x28')](_0x352a6e());break;default:_0x120e03['CmHopper'][_0xc472('0x25')]({'phone':_0x1260b6[_0xc472('0xd')],'ContactId':_0x1260b6['id'],'ListId':_0x1260b6[_0xc472('0x32')],'scheduledat':_0x1260b6['scheduledat']?_0x1260b6['scheduledat']:moment()[_0xc472('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x1260b6[_0xc472('0x26')]?_0x1260b6[_0xc472('0x26')]:0x2,'callback':_0x1260b6[_0xc472('0x27')]?!![]:![],'callbackuniqueid':_0x1260b6['callbackUniqueid']?_0x1260b6[_0xc472('0x27')]:undefined,'callbackat':_0x1260b6[_0xc472('0x27')]?moment()[_0xc472('0x19')](_0xc472('0x22')):undefined,'CampaignId':_0x62e979['id']})[_0xc472('0x28')](_0x352a6e());}}}});})[_0xc472('0x1e')](function(){return _0x120e03[_0xc472('0x3f')][_0xc472('0x33')]({'attributes':['id'],'include':[{'model':_0x120e03[_0xc472('0x36')],'as':_0xc472('0x3a'),'where':{'id':_0x1260b6[_0xc472('0x32')]}}]})['then'](function(_0x1be134){if(_0x1be134){var _0x4ee29e=[];for(var _0x2719ea=0x0,_0x29fc67;_0x2719ea<_0x1be134[_0xc472('0x38')];_0x2719ea+=0x1){_0x29fc67=_0x1be134[_0x2719ea][_0xc472('0x14')]({'plain':!![]});_0x120e03[_0xc472('0x3b')][_0xc472('0x25')]({'phone':_0x1260b6[_0xc472('0xd')],'ContactId':_0x1260b6['id'],'ListId':_0x1260b6[_0xc472('0x32')],'CampaignId':_0x29fc67['id']})[_0xc472('0x28')](function(_0x4d1106){logger[_0xc472('0x2d')](_0xc472('0x3c'),'afterCreate',_0x4d1106[_0xc472('0x3d')]);});}}});})[_0xc472('0x1e')](function(){_0x520e70();})[_0xc472('0x28')](function(_0x1574d4){logger[_0xc472('0x2d')](_0xc472('0x3c'),_0xc472('0x16'),_0x1574d4[_0xc472('0x3d')]);_0x520e70(_0x1574d4);});}else{_0x520e70(new Error(_0xc472('0x40')));}},'afterDestroy':function(_0x3b732d,_0x3f9b91,_0x4ef231){var _0x7f2ad8=_0x56b1ba['models'];var _0x56807e=_0x3b732d[_0xc472('0x14')]({'plain':!![]});return _0x7f2ad8[_0xc472('0x24')][_0xc472('0x33')]({'raw':!![],'where':{'ListId':_0x56807e['ListId'],'ContactId':_0x56807e['id']}})[_0xc472('0x1e')](function(_0x3a3120){if(!_[_0xc472('0x41')](_0x3a3120)){var _0x4a1aa9=[];for(var _0x2087bf=0x0;_0x2087bf<_0x3a3120[_0xc472('0x38')];_0x2087bf+=0x1){var _0x12808d=_0x7f2ad8['CmHopper'][_0xc472('0x42')]({'where':{'ListId':_0x3a3120[_0x2087bf][_0xc472('0x32')],'ContactId':_0x3a3120[_0x2087bf][_0xc472('0x43')],'VoiceQueueId':_0x3a3120[_0x2087bf]['VoiceQueueId'],'CampaignId':_0x3a3120[_0x2087bf][_0xc472('0x44')]}});_0x4a1aa9['push'](_0x12808d);}return BPromise[_0xc472('0x45')](_0x4a1aa9);}})[_0xc472('0x1e')](function(_0x46cf79){logger[_0xc472('0x46')](_0xc472('0x47'),util[_0xc472('0x17')](_0x46cf79,{'showHidden':![],'depth':null}));_0x4ef231();})[_0xc472('0x28')](function(_0x520136){logger['error'](_0xc472('0x48'),util['inspect'](_0x520136,{'showHidden':![],'depth':null}));_0x4ef231(_0x520136);});}}});}; \ No newline at end of file +var _0x6e5a=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','models','isEmpty','destroy','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','../../config/environment/shared','./cmContact.attributes','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','scheduledat','format','isNil','dialTimezone','VoiceQueue','findOne','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','then','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','cmContact','afterCreate','inspect','Campaign','cmContact,\x20afterCreate\x20'];(function(_0x26245c,_0x5b7b27){var _0xb53ee2=function(_0x129f11){while(--_0x129f11){_0x26245c['push'](_0x26245c['shift']());}};_0xb53ee2(++_0x5b7b27);}(_0x6e5a,0x185));var _0xa6e5=function(_0x3d2e8e,_0x49d65f){_0x3d2e8e=_0x3d2e8e-0x0;var _0x5b1d40=_0x6e5a[_0x3d2e8e];return _0x5b1d40;};'use strict';var _=require(_0xa6e5('0x0'));var util=require('util');var logger=require(_0xa6e5('0x1'))(_0xa6e5('0x2'));var moment=require('moment');var BPromise=require(_0xa6e5('0x3'));var rp=require(_0xa6e5('0x4'));var fs=require('fs');var path=require(_0xa6e5('0x5'));var rimraf=require('rimraf');var config=require(_0xa6e5('0x6'));var shared=require(_0xa6e5('0x7'));var attributes=require(_0xa6e5('0x8'));module['exports']=function(_0x3fdee5,_0x2b048a){return _0x3fdee5['define']('CmContact',attributes,{'tableName':_0xa6e5('0x9'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0xa6e5('0xa')]},{'name':_0xa6e5('0xb'),'fields':[_0xa6e5('0xc'),_0xa6e5('0xd'),'phone',_0xa6e5('0xe'),_0xa6e5('0xf'),'email'],'type':_0xa6e5('0x10')}],'timestamps':!![],'charset':_0xa6e5('0x11'),'collate':_0xa6e5('0x12'),'hooks':{'afterCreate':function(_0x42b66d,_0x162a86,_0x27a677){var _0x150364=_0x3fdee5['models'];var _0x55ae02=_0x42b66d[_0xa6e5('0x13')]({'plain':!![]});function _0x5d78f8(){return function(_0x1715a0){logger[_0xa6e5('0x14')]('cmContact','afterCreate',util['inspect'](_0x1715a0,{'showHidden':![],'depth':null}));};}function _0x385f01(_0x30504e,_0x4b4542){var _0x47ca41=_0x4b4542[_0xa6e5('0x15')]?_0x4b4542[_0xa6e5('0x15')]:moment()[_0xa6e5('0x16')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x5aa33b,_0x2097fa){if(_[_0xa6e5('0x17')](_0x4b4542[_0xa6e5('0x18')])){_0x5aa33b({'ret':_0x47ca41});}else{_0x150364[_0xa6e5('0x19')][_0xa6e5('0x1a')]({'where':{'id':_0x30504e['id']}})['then'](function(_0x472341){if(!_['isNil'](_0x472341)){var _0x1511b6=_0x472341[_0xa6e5('0x18')];if(!_[_0xa6e5('0x17')](_0x1511b6)){var _0x5aaafe=shared[_0xa6e5('0x1b')];var _0x3d4c4a=_0x5aaafe[_0x1511b6];var _0x38ac91=_0x5aaafe[_0x4b4542[_0xa6e5('0x18')]];if(!_['isNil'](_0x3d4c4a)&&!_[_0xa6e5('0x17')](_0x38ac91)){var _0x15c53c=_0x3d4c4a[_0xa6e5('0x1c')]-_0x38ac91[_0xa6e5('0x1c')];_0x47ca41=_0x4b4542[_0xa6e5('0x15')]?_0x4b4542[_0xa6e5('0x15')]:moment();var _0x4f6bdf=moment(_0x47ca41)[_0xa6e5('0x1d')](_0x15c53c,_0xa6e5('0x1e'));_0x5aa33b({'ret':_0x4f6bdf[_0xa6e5('0x16')](_0xa6e5('0x1f'))});}else _0x5aa33b({'ret':_0x47ca41});}else _0x5aa33b({'ret':_0x47ca41});}else{_0x5aa33b({'ret':_0x47ca41});}});}});return 0xa;}var _0x180c8b=function(_0x10576e){return new BPromise(function(_0x140777,_0x49e997){_0x385f01(_0x10576e,_0x55ae02)[_0xa6e5('0x20')](function(_0x5efc52){_0x55ae02[_0xa6e5('0x15')]=_0x5efc52[_0xa6e5('0x21')];_0x150364[_0xa6e5('0x22')]['findOne']({'where':{'phone':_0x55ae02[_0xa6e5('0xa')],'VoiceQueueId':_0x10576e['id']}})['then'](function(_0x2e3b78){if(!_['isNil'](_0x2e3b78)){throw new Error('cmContact,\x20afterCreate\x20'+_0x55ae02[_0xa6e5('0xa')]+_0xa6e5('0x23')+_0x10576e['id']);}return _0x150364[_0xa6e5('0x22')]['create']({'phone':_0x55ae02[_0xa6e5('0xa')],'ContactId':_0x55ae02['id'],'ListId':_0x55ae02[_0xa6e5('0x24')],'priority':_0x55ae02['priority']?_0x55ae02[_0xa6e5('0x25')]:0x2,'scheduledat':_0x55ae02[_0xa6e5('0x15')]?_0x55ae02[_0xa6e5('0x15')]:moment()[_0xa6e5('0x16')](_0xa6e5('0x1f')),'callback':_0x55ae02[_0xa6e5('0x26')]?!![]:![],'callbackuniqueid':_0x55ae02[_0xa6e5('0x26')]?_0x55ae02[_0xa6e5('0x26')]:undefined,'callbackat':_0x55ae02[_0xa6e5('0x26')]?moment()['format'](_0xa6e5('0x1f')):undefined,'VoiceQueueId':_0x10576e['id']});})[_0xa6e5('0x27')](function(_0x18bdda){_0x49e997(_0x18bdda);});});});};var _0x1e7076=function(_0xd2e830){return new BPromise(function(_0x4b4155,_0x3ba10d){_0x385f01(_0xd2e830,_0x55ae02)[_0xa6e5('0x20')](function(_0x299731){_0x55ae02['scheduledat']=_0x299731[_0xa6e5('0x21')];_0x150364[_0xa6e5('0x22')][_0xa6e5('0x1a')]({'where':{'phone':_0x55ae02[_0xa6e5('0xa')],'VoiceQueueId':_0xd2e830['id']}})[_0xa6e5('0x20')](function(_0x17d534){if(!_['isNil'](_0x17d534)){throw new Error('cmContact,\x20afterCreate\x20'+_0x55ae02[_0xa6e5('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0xd2e830['id']);}return _0x150364[_0xa6e5('0x28')]['findOne']({'where':{'calleridnum':_0x55ae02[_0xa6e5('0xa')],'VoiceQueueId':_0xd2e830['id']}});})[_0xa6e5('0x20')](function(_0x3237cd){if(!_[_0xa6e5('0x17')](_0x3237cd)){throw new Error(_0xa6e5('0x29')+_0x55ae02['phone']+_0xa6e5('0x2a')+_0xd2e830['id']);}return _0x150364[_0xa6e5('0x22')][_0xa6e5('0x2b')]({'phone':_0x55ae02[_0xa6e5('0xa')],'ContactId':_0x55ae02['id'],'ListId':_0x55ae02[_0xa6e5('0x24')],'priority':_0x55ae02[_0xa6e5('0x25')]?_0x55ae02['priority']:0x2,'scheduledat':_0x55ae02['scheduledat']?_0x55ae02[_0xa6e5('0x15')]:moment()[_0xa6e5('0x16')](_0xa6e5('0x1f')),'callback':_0x55ae02[_0xa6e5('0x26')]?!![]:![],'callbackuniqueid':_0x55ae02[_0xa6e5('0x26')]?_0x55ae02[_0xa6e5('0x26')]:undefined,'callbackat':_0x55ae02[_0xa6e5('0x26')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xd2e830['id']});})['catch'](function(_0x28f556){_0x3ba10d(_0x28f556);});});});};function _0x5986de(){return function(_0x52f09f){logger[_0xa6e5('0x14')](_0xa6e5('0x2c'),_0xa6e5('0x2d'),util[_0xa6e5('0x2e')](_0x52f09f,{'showHidden':![],'depth':null}));};}function _0x340aa4(_0x53862e,_0x2bbe79){var _0x4d78e1=_0x2bbe79[_0xa6e5('0x15')]?_0x2bbe79[_0xa6e5('0x15')]:moment()['format'](_0xa6e5('0x1f'));return new BPromise(function(_0x48b914,_0x12d306){if(_[_0xa6e5('0x17')](_0x2bbe79[_0xa6e5('0x18')])){_0x48b914({'ret':_0x4d78e1});}else{_0x150364[_0xa6e5('0x2f')][_0xa6e5('0x1a')]({'where':{'id':_0x53862e['id']}})['then'](function(_0x105076){if(!_[_0xa6e5('0x17')](_0x105076)){var _0xc2b731=_0x105076[_0xa6e5('0x18')];if(!_[_0xa6e5('0x17')](_0xc2b731)){var _0xe3e7dd=shared['timezones'];var _0x461800=_0xe3e7dd[_0xc2b731];var _0x3836bd=_0xe3e7dd[_0x2bbe79['dialTimezone']];if(!_[_0xa6e5('0x17')](_0x461800)&&!_[_0xa6e5('0x17')](_0x3836bd)){var _0x25112a=_0x461800['utcOffset']-_0x3836bd[_0xa6e5('0x1c')];_0x4d78e1=_0x2bbe79[_0xa6e5('0x15')]?_0x2bbe79['scheduledat']:moment();var _0xa17dd=moment(_0x4d78e1)[_0xa6e5('0x1d')](_0x25112a,_0xa6e5('0x1e'));_0x48b914({'ret':_0xa17dd[_0xa6e5('0x16')](_0xa6e5('0x1f'))});}else _0x48b914({'ret':_0x4d78e1});}else _0x48b914({'ret':_0x4d78e1});}else{_0x48b914({'ret':_0x4d78e1});}});}});return 0xa;}var _0xc2179=function(_0x2b7de7){return new BPromise(function(_0x348a23,_0x2702ec){_0x340aa4(_0x2b7de7,_0x55ae02)[_0xa6e5('0x20')](function(_0x584a02){_0x55ae02[_0xa6e5('0x15')]=_0x584a02[_0xa6e5('0x21')];_0x150364[_0xa6e5('0x22')][_0xa6e5('0x1a')]({'where':{'phone':_0x55ae02[_0xa6e5('0xa')],'CampaignId':_0x2b7de7['id']}})['then'](function(_0x25b028){if(!_['isNil'](_0x25b028)){throw new Error(_0xa6e5('0x30')+_0x55ae02[_0xa6e5('0xa')]+_0xa6e5('0x31')+_0x2b7de7['id']);}return _0x150364['CmHopper']['create']({'phone':_0x55ae02[_0xa6e5('0xa')],'ContactId':_0x55ae02['id'],'ListId':_0x55ae02['ListId'],'priority':_0x55ae02[_0xa6e5('0x25')]?_0x55ae02[_0xa6e5('0x25')]:0x2,'scheduledat':_0x55ae02[_0xa6e5('0x15')]?_0x55ae02[_0xa6e5('0x15')]:moment()['format'](_0xa6e5('0x1f')),'callback':_0x55ae02['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x55ae02[_0xa6e5('0x26')]?_0x55ae02[_0xa6e5('0x26')]:undefined,'callbackat':_0x55ae02[_0xa6e5('0x26')]?moment()[_0xa6e5('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x2b7de7['id']});})[_0xa6e5('0x27')](function(_0x108cbb){_0x2702ec(_0x108cbb);});});});};var _0xfacd8f=function(_0x44b13a){return new BPromise(function(_0x1fbfca,_0x1405b3){_0x340aa4(_0x44b13a,_0x55ae02)[_0xa6e5('0x20')](function(_0x5d2ffc){_0x55ae02[_0xa6e5('0x15')]=_0x5d2ffc[_0xa6e5('0x21')];_0x150364['CmHopper'][_0xa6e5('0x1a')]({'where':{'phone':_0x55ae02[_0xa6e5('0xa')],'CampaignId':_0x44b13a['id']}})[_0xa6e5('0x20')](function(_0x3f8a26){if(!_[_0xa6e5('0x17')](_0x3f8a26)){throw new Error('cmContact,\x20afterCreate\x20'+_0x55ae02[_0xa6e5('0xa')]+_0xa6e5('0x32')+_0x44b13a['id']);}return _0x150364[_0xa6e5('0x28')]['findOne']({'where':{'calleridnum':_0x55ae02[_0xa6e5('0xa')],'CampaignId':_0x44b13a['id']}});})[_0xa6e5('0x20')](function(_0x2652af){if(!_[_0xa6e5('0x17')](_0x2652af)){throw new Error(_0xa6e5('0x29')+_0x55ae02[_0xa6e5('0xa')]+_0xa6e5('0x33')+_0x44b13a['id']);}return _0x150364[_0xa6e5('0x22')][_0xa6e5('0x2b')]({'phone':_0x55ae02['phone'],'ContactId':_0x55ae02['id'],'ListId':_0x55ae02[_0xa6e5('0x24')],'priority':_0x55ae02[_0xa6e5('0x25')]?_0x55ae02['priority']:0x2,'scheduledat':_0x55ae02[_0xa6e5('0x15')]?_0x55ae02[_0xa6e5('0x15')]:moment()['format'](_0xa6e5('0x1f')),'callback':_0x55ae02[_0xa6e5('0x26')]?!![]:![],'callbackuniqueid':_0x55ae02[_0xa6e5('0x26')]?_0x55ae02[_0xa6e5('0x26')]:undefined,'callbackat':_0x55ae02[_0xa6e5('0x26')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x44b13a['id']});})['catch'](function(_0xfacece){_0x1405b3(_0xfacece);});});});};if(_0x55ae02[_0xa6e5('0x24')]){_0x150364['VoiceQueue'][_0xa6e5('0x34')]({'where':{'type':_0xa6e5('0x35')},'attributes':['id',_0xa6e5('0x36'),_0xa6e5('0x18')],'include':[{'model':_0x150364[_0xa6e5('0x37')],'as':_0xa6e5('0x38'),'where':{'id':_0x55ae02[_0xa6e5('0x24')]}}]})[_0xa6e5('0x20')](function(_0x232363){if(_0x232363){var _0x24722e=[];for(var _0x23d00a=0x0,_0xa9fef3;_0x23d00a<_0x232363[_0xa6e5('0x39')];_0x23d00a+=0x1){_0xa9fef3=_0x232363[_0x23d00a][_0xa6e5('0x13')]({'plain':!![]});switch(_0xa9fef3[_0xa6e5('0x36')]){case _0xa6e5('0x3a'):_0x1e7076(_0xa9fef3)[_0xa6e5('0x27')](_0x5d78f8());break;case _0xa6e5('0x3b'):_0x180c8b(_0xa9fef3)[_0xa6e5('0x27')](_0x5d78f8());break;default:_0x340aa4(_0xa9fef3,_0x55ae02)[_0xa6e5('0x20')](function(_0x138ec6){_0x55ae02[_0xa6e5('0x15')]=_0x138ec6['ret'];_0x150364['CmHopper'][_0xa6e5('0x2b')]({'phone':_0x55ae02[_0xa6e5('0xa')],'ContactId':_0x55ae02['id'],'ListId':_0x55ae02[_0xa6e5('0x24')],'scheduledat':_0x55ae02[_0xa6e5('0x15')]?_0x55ae02[_0xa6e5('0x15')]:moment()[_0xa6e5('0x16')](_0xa6e5('0x1f')),'priority':_0x55ae02[_0xa6e5('0x25')]?_0x55ae02[_0xa6e5('0x25')]:0x2,'callback':_0x55ae02['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x55ae02['callbackUniqueid']?_0x55ae02[_0xa6e5('0x26')]:undefined,'callbackat':_0x55ae02['callbackUniqueid']?moment()['format'](_0xa6e5('0x1f')):undefined,'VoiceQueueId':_0xa9fef3['id']})[_0xa6e5('0x27')](_0x5d78f8());});}}}})['then'](function(){return _0x150364[_0xa6e5('0x19')][_0xa6e5('0x34')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x150364[_0xa6e5('0x37')],'as':_0xa6e5('0x3c'),'where':{'id':_0x55ae02['ListId']}}]})[_0xa6e5('0x20')](function(_0x49f787){if(_0x49f787){var _0x2ee278=[];for(var _0x4a6f64=0x0,_0xa6da43;_0x4a6f64<_0x49f787[_0xa6e5('0x39')];_0x4a6f64+=0x1){_0xa6da43=_0x49f787[_0x4a6f64]['get']({'plain':!![]});_0x150364[_0xa6e5('0x3d')][_0xa6e5('0x2b')]({'phone':_0x55ae02[_0xa6e5('0xa')],'ContactId':_0x55ae02['id'],'ListId':_0x55ae02[_0xa6e5('0x24')],'VoiceQueueId':_0xa6da43['id']})[_0xa6e5('0x27')](function(_0x1abda0){logger['error'](_0xa6e5('0x3e'),_0xa6e5('0x2d'),_0x1abda0[_0xa6e5('0x3f')]);});}}});})[_0xa6e5('0x20')](function(){return _0x150364[_0xa6e5('0x2f')][_0xa6e5('0x34')]({'attributes':['id',_0xa6e5('0x36'),'dialTimezone'],'include':[{'model':_0x150364['CmList'],'as':'Lists','where':{'id':_0x55ae02[_0xa6e5('0x24')]}}]})['then'](function(_0xb86bd4){if(_0xb86bd4){var _0x1d04cc=[];for(var _0x2b4a2c=0x0,_0x17ddfe;_0x2b4a2c<_0xb86bd4[_0xa6e5('0x39')];_0x2b4a2c+=0x1){_0x17ddfe=_0xb86bd4[_0x2b4a2c][_0xa6e5('0x13')]({'plain':!![]});switch(_0x17ddfe[_0xa6e5('0x36')]){case _0xa6e5('0x3a'):_0xfacd8f(_0x17ddfe)[_0xa6e5('0x27')](_0x5986de());break;case _0xa6e5('0x3b'):_0xc2179(_0x17ddfe)[_0xa6e5('0x27')](_0x5986de());break;default:_0x150364[_0xa6e5('0x22')][_0xa6e5('0x2b')]({'phone':_0x55ae02[_0xa6e5('0xa')],'ContactId':_0x55ae02['id'],'ListId':_0x55ae02[_0xa6e5('0x24')],'scheduledat':_0x55ae02['scheduledat']?_0x55ae02[_0xa6e5('0x15')]:moment()['format'](_0xa6e5('0x1f')),'priority':_0x55ae02[_0xa6e5('0x25')]?_0x55ae02['priority']:0x2,'callback':_0x55ae02[_0xa6e5('0x26')]?!![]:![],'callbackuniqueid':_0x55ae02[_0xa6e5('0x26')]?_0x55ae02[_0xa6e5('0x26')]:undefined,'callbackat':_0x55ae02['callbackUniqueid']?moment()[_0xa6e5('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x17ddfe['id']})[_0xa6e5('0x27')](_0x5986de());}}}});})['then'](function(){return _0x150364[_0xa6e5('0x2f')][_0xa6e5('0x34')]({'attributes':['id'],'include':[{'model':_0x150364['CmList'],'as':'BlackLists','where':{'id':_0x55ae02[_0xa6e5('0x24')]}}]})[_0xa6e5('0x20')](function(_0x331cd0){if(_0x331cd0){var _0x381731=[];for(var _0x10b6f0=0x0,_0x2b5fc7;_0x10b6f0<_0x331cd0[_0xa6e5('0x39')];_0x10b6f0+=0x1){_0x2b5fc7=_0x331cd0[_0x10b6f0]['get']({'plain':!![]});_0x150364[_0xa6e5('0x3d')]['create']({'phone':_0x55ae02[_0xa6e5('0xa')],'ContactId':_0x55ae02['id'],'ListId':_0x55ae02[_0xa6e5('0x24')],'CampaignId':_0x2b5fc7['id']})[_0xa6e5('0x27')](function(_0x29247c){logger[_0xa6e5('0x14')](_0xa6e5('0x3e'),_0xa6e5('0x2d'),_0x29247c[_0xa6e5('0x3f')]);});}}});})['then'](function(){_0x27a677();})['catch'](function(_0x40a5de){logger[_0xa6e5('0x14')](_0xa6e5('0x3e'),'afterCreate',_0x40a5de[_0xa6e5('0x3f')]);_0x27a677(_0x40a5de);});}else{_0x27a677(new Error(_0xa6e5('0x40')));}},'afterDestroy':function(_0x18cb78,_0x3a2926,_0x3bf7fb){var _0x51fcac=_0x3fdee5[_0xa6e5('0x41')];var _0x5c032b=_0x18cb78['get']({'plain':!![]});return _0x51fcac[_0xa6e5('0x22')]['findAll']({'raw':!![],'where':{'ListId':_0x5c032b[_0xa6e5('0x24')],'ContactId':_0x5c032b['id']}})[_0xa6e5('0x20')](function(_0x373e99){if(!_[_0xa6e5('0x42')](_0x373e99)){var _0x59f07b=[];for(var _0x7baa29=0x0;_0x7baa29<_0x373e99[_0xa6e5('0x39')];_0x7baa29+=0x1){var _0xb34fb0=_0x51fcac[_0xa6e5('0x22')][_0xa6e5('0x43')]({'where':{'ListId':_0x373e99[_0x7baa29][_0xa6e5('0x24')],'ContactId':_0x373e99[_0x7baa29]['ContactId'],'VoiceQueueId':_0x373e99[_0x7baa29]['VoiceQueueId'],'CampaignId':_0x373e99[_0x7baa29][_0xa6e5('0x44')]}});_0x59f07b[_0xa6e5('0x45')](_0xb34fb0);}return BPromise[_0xa6e5('0x46')](_0x59f07b);}})[_0xa6e5('0x20')](function(_0x2364d6){logger[_0xa6e5('0x47')](_0xa6e5('0x48'),util[_0xa6e5('0x2e')](_0x2364d6,{'showHidden':![],'depth':null}));_0x3bf7fb();})[_0xa6e5('0x27')](function(_0x4eb980){logger['error']('[CmContact][afterDestroy][Error]',util[_0xa6e5('0x2e')](_0x4eb980,{'showHidden':![],'depth':null}));_0x3bf7fb(_0x4eb980);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 9895dbd..ef22840 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x53eabd,_0xf11f6a){var _0x4d6fa6=function(_0x48fe9b){while(--_0x48fe9b){_0x53eabd['push'](_0x53eabd['shift']());}};_0x4d6fa6(++_0xf11f6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index cff86ce..04a10e8 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb903=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x22bfd6,_0x39608a){var _0x4d9bba=function(_0xadfc6f){while(--_0xadfc6f){_0x22bfd6['push'](_0x22bfd6['shift']());}};_0x4d9bba(++_0x39608a);}(_0xb903,0x185));var _0x3b90=function(_0x4502fa,_0x18e69d){_0x4502fa=_0x4502fa-0x0;var _0x2f11fd=_0xb903[_0x4502fa];return _0x2f11fd;};'use strict';var Sequelize=require(_0x3b90('0x0'));module[_0x3b90('0x1')]={'CmContactId':{'type':Sequelize[_0x3b90('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':_0x3b90('0x4')},'OrderBy':{'type':Sequelize[_0x3b90('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x3b90('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0xca8d=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0xad884f,_0x52177c){var _0x468408=function(_0x15978c){while(--_0x15978c){_0xad884f['push'](_0xad884f['shift']());}};_0x468408(++_0x52177c);}(_0xca8d,0x172));var _0xdca8=function(_0x4fcb07,_0x4a77a4){_0x4fcb07=_0x4fcb07-0x0;var _0xf2eeb=_0xca8d[_0x4fcb07];return _0xf2eeb;};'use strict';var Sequelize=require(_0xdca8('0x0'));module[_0xdca8('0x1')]={'CmContactId':{'type':Sequelize[_0xdca8('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xdca8('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':_0xdca8('0x4')},'OrderBy':{'type':Sequelize[_0xdca8('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xdca8('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 12fc1a3..d8f3a52 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9f5=['limit','count','Content-Range','json','reject','then','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','find','autoAssociation','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x104656,_0x51f363){var _0x540fb4=function(_0x386628){while(--_0x386628){_0x104656['push'](_0x104656['shift']());}};_0x540fb4(++_0x51f363);}(_0xd9f5,0xcc));var _0x5d9f=function(_0x2c3c23,_0x3609b5){_0x2c3c23=_0x2c3c23-0x0;var _0x24e0ee=_0xd9f5[_0x2c3c23];return _0x24e0ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d9f('0x0'));var zipdir=require(_0x5d9f('0x1'));var jsonpatch=require(_0x5d9f('0x2'));var rp=require(_0x5d9f('0x3'));var moment=require(_0x5d9f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5d9f('0x5'));var util=require('util');var path=require(_0x5d9f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5d9f('0x7'));var fs=require('fs');var fs_extra=require(_0x5d9f('0x8'));var _=require(_0x5d9f('0x9'));var squel=require(_0x5d9f('0xa'));var crypto=require(_0x5d9f('0xb'));var jsforce=require(_0x5d9f('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5d9f('0xd'));var Papa=require(_0x5d9f('0xe'));var Redis=require(_0x5d9f('0xf'));var authService=require(_0x5d9f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5d9f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d9f('0x12'))('api');var utils=require(_0x5d9f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5d9f('0x14'));var db=require(_0x5d9f('0x15'))['db'];function respondWithStatusCode(_0x537974,_0x270416){_0x270416=_0x270416||0xcc;return function(_0x19c30a){if(_0x19c30a){return _0x537974[_0x5d9f('0x16')](_0x270416);}return _0x537974[_0x5d9f('0x17')](_0x270416)[_0x5d9f('0x18')]();};}function respondWithResult(_0xc7979f,_0x51caeb){_0x51caeb=_0x51caeb||0xc8;return function(_0x44aff1){if(_0x44aff1){return _0xc7979f[_0x5d9f('0x17')](_0x51caeb)['json'](_0x44aff1);}};}function respondWithFilteredResult(_0x25a60a,_0x43219b){return function(_0x4fbe66){if(_0x4fbe66){var _0x1d83af=typeof _0x43219b[_0x5d9f('0x19')]===_0x5d9f('0x1a')&&typeof _0x43219b[_0x5d9f('0x1b')]===_0x5d9f('0x1a');var _0xd1d98f=_0x4fbe66[_0x5d9f('0x1c')];var _0x1d4b81=_0x1d83af?0x0:_0x43219b[_0x5d9f('0x19')];var _0xb6ab50=_0x1d83af?_0x4fbe66['count']:_0x43219b[_0x5d9f('0x19')]+_0x43219b[_0x5d9f('0x1b')];var _0x2c2372;if(_0xb6ab50>=_0xd1d98f){_0xb6ab50=_0xd1d98f;_0x2c2372=0xc8;}else{_0x2c2372=0xce;}_0x25a60a[_0x5d9f('0x17')](_0x2c2372);return _0x25a60a['set'](_0x5d9f('0x1d'),_0x1d4b81+'-'+_0xb6ab50+'/'+_0xd1d98f)[_0x5d9f('0x1e')](_0x4fbe66);}return null;};}function patchUpdates(_0x25cf69){return function(_0x4450f9){try{jsonpatch['apply'](_0x4450f9,_0x25cf69,!![]);}catch(_0x3e1436){return BPromise[_0x5d9f('0x1f')](_0x3e1436);}return _0x4450f9['save']();};}function saveUpdates(_0x61b558,_0x559bba){return function(_0x10439e){if(_0x10439e){return _0x10439e['update'](_0x61b558)['then'](function(_0x5dcdcd){return _0x5dcdcd;});}return null;};}function removeEntity(_0x439301,_0x47e499){return function(_0x3722e4){if(_0x3722e4){return _0x3722e4['destroy']()[_0x5d9f('0x20')](function(){var _0x11c7f3=_0x3722e4['get']({'plain':!![]});var _0xe1ab0b=_0x5d9f('0x21');return db[_0x5d9f('0x22')]['destroy']({'where':{'type':_0xe1ab0b,'resourceId':_0x11c7f3['id']}})['then'](function(){return _0x3722e4;});})['then'](function(){_0x439301[_0x5d9f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x559fd8,_0x349f86){return function(_0x561eb2){if(!_0x561eb2){_0x559fd8[_0x5d9f('0x16')](0x194);}return _0x561eb2;};}function handleError(_0x32567b,_0x6a9dff){_0x6a9dff=_0x6a9dff||0x1f4;return function(_0x2524f2){logger[_0x5d9f('0x23')](_0x2524f2[_0x5d9f('0x24')]);if(_0x2524f2[_0x5d9f('0x25')]){delete _0x2524f2[_0x5d9f('0x25')];}_0x32567b[_0x5d9f('0x17')](_0x6a9dff)[_0x5d9f('0x26')](_0x2524f2);};}exports[_0x5d9f('0x27')]=function(_0x1be948,_0x52e94e){var _0x3241cc={},_0x534bab={},_0x499928={'count':0x0,'rows':[]};var _0x5ca3f4=_[_0x5d9f('0x28')](db[_0x5d9f('0x29')][_0x5d9f('0x2a')],function(_0x2e7e13){return{'name':_0x2e7e13[_0x5d9f('0x2b')],'type':_0x2e7e13[_0x5d9f('0x2c')][_0x5d9f('0x2d')]};});_0x534bab['model']=_[_0x5d9f('0x28')](_0x5ca3f4,'name');_0x534bab[_0x5d9f('0x2e')]=_['keys'](_0x1be948[_0x5d9f('0x2e')]);_0x534bab[_0x5d9f('0x2f')]=_[_0x5d9f('0x30')](_0x534bab[_0x5d9f('0x31')],_0x534bab[_0x5d9f('0x2e')]);_0x3241cc[_0x5d9f('0x32')]=_[_0x5d9f('0x30')](_0x534bab['model'],qs[_0x5d9f('0x33')](_0x1be948[_0x5d9f('0x2e')][_0x5d9f('0x33')]));_0x3241cc[_0x5d9f('0x32')]=_0x3241cc['attributes']['length']?_0x3241cc[_0x5d9f('0x32')]:_0x534bab['model'];if(!_0x1be948['query'][_0x5d9f('0x34')](_0x5d9f('0x35'))){_0x3241cc['limit']=qs['limit'](_0x1be948[_0x5d9f('0x2e')][_0x5d9f('0x1b')]);_0x3241cc['offset']=qs[_0x5d9f('0x19')](_0x1be948[_0x5d9f('0x2e')]['offset']);}_0x3241cc[_0x5d9f('0x36')]=qs[_0x5d9f('0x37')](_0x1be948[_0x5d9f('0x2e')]['sort']);_0x3241cc[_0x5d9f('0x38')]=qs[_0x5d9f('0x2f')](_['pick'](_0x1be948[_0x5d9f('0x2e')],_0x534bab[_0x5d9f('0x2f')]),_0x5ca3f4);if(_0x1be948[_0x5d9f('0x2e')][_0x5d9f('0x39')]){_0x3241cc[_0x5d9f('0x38')]=_[_0x5d9f('0x3a')](_0x3241cc[_0x5d9f('0x38')],{'$or':_[_0x5d9f('0x28')](_0x5ca3f4,function(_0x311193){if(_0x311193[_0x5d9f('0x2c')]!==_0x5d9f('0x3b')){var _0x2dcfa6={};_0x2dcfa6[_0x311193[_0x5d9f('0x25')]]={'$like':'%'+_0x1be948['query'][_0x5d9f('0x39')]+'%'};return _0x2dcfa6;}})});}_0x3241cc=_[_0x5d9f('0x3a')]({},_0x3241cc,_0x1be948[_0x5d9f('0x3c')]);var _0x4428c0={'where':_0x3241cc[_0x5d9f('0x38')]};return db['CmContactHasItem']['count'](_0x4428c0)[_0x5d9f('0x20')](function(_0x53a9a3){_0x499928[_0x5d9f('0x1c')]=_0x53a9a3;if(_0x1be948[_0x5d9f('0x2e')][_0x5d9f('0x3d')]){_0x3241cc[_0x5d9f('0x3e')]=[{'all':!![]}];}return db[_0x5d9f('0x29')]['findAll'](_0x3241cc);})[_0x5d9f('0x20')](function(_0x225026){_0x499928['rows']=_0x225026;return _0x499928;})['then'](respondWithFilteredResult(_0x52e94e,_0x3241cc))[_0x5d9f('0x3f')](handleError(_0x52e94e,null));};exports[_0x5d9f('0x40')]=function(_0x55d087,_0x1100ec){var _0x189e9a={'raw':!![],'where':{'id':_0x55d087[_0x5d9f('0x41')]['id']}},_0x513676={};_0x513676[_0x5d9f('0x31')]=_[_0x5d9f('0x42')](db[_0x5d9f('0x29')][_0x5d9f('0x2a')]);_0x513676[_0x5d9f('0x2e')]=_[_0x5d9f('0x42')](_0x55d087[_0x5d9f('0x2e')]);_0x513676[_0x5d9f('0x2f')]=_[_0x5d9f('0x30')](_0x513676[_0x5d9f('0x31')],_0x513676['query']);_0x189e9a[_0x5d9f('0x32')]=_[_0x5d9f('0x30')](_0x513676[_0x5d9f('0x31')],qs[_0x5d9f('0x33')](_0x55d087['query']['fields']));_0x189e9a[_0x5d9f('0x32')]=_0x189e9a[_0x5d9f('0x32')]['length']?_0x189e9a[_0x5d9f('0x32')]:_0x513676['model'];if(_0x55d087[_0x5d9f('0x2e')][_0x5d9f('0x3d')]){_0x189e9a[_0x5d9f('0x3e')]=[{'all':!![]}];}_0x189e9a=_['merge']({},_0x189e9a,_0x55d087[_0x5d9f('0x3c')]);return db[_0x5d9f('0x29')]['find'](_0x189e9a)[_0x5d9f('0x20')](handleEntityNotFound(_0x1100ec,null))[_0x5d9f('0x20')](respondWithResult(_0x1100ec,null))[_0x5d9f('0x3f')](handleError(_0x1100ec,null));};exports['create']=function(_0x32b6c8,_0x4ab2a6){return db[_0x5d9f('0x29')][_0x5d9f('0x43')](_0x32b6c8[_0x5d9f('0x44')],{})[_0x5d9f('0x20')](function(_0x10231a){var _0x464c4b=_0x32b6c8['user']['get']({'plain':!![]});if(!_0x464c4b)throw new Error(_0x5d9f('0x45'));if(_0x464c4b['role']===_0x5d9f('0x46')){var _0x46853b=_0x10231a[_0x5d9f('0x47')]({'plain':!![]});var _0x442755=_0x5d9f('0x21');return db[_0x5d9f('0x48')][_0x5d9f('0x49')]({'where':{'name':_0x442755,'userProfileId':_0x464c4b['userProfileId']},'raw':!![]})[_0x5d9f('0x20')](function(_0x2ff407){if(_0x2ff407&&_0x2ff407[_0x5d9f('0x4a')]===0x0){return db[_0x5d9f('0x22')][_0x5d9f('0x43')]({'name':_0x46853b[_0x5d9f('0x25')],'resourceId':_0x46853b['id'],'type':_0x2ff407['name'],'sectionId':_0x2ff407['id']},{})['then'](function(){return _0x10231a;});}else{return _0x10231a;}})[_0x5d9f('0x3f')](function(_0x3de469){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3de469);throw _0x3de469;});}return _0x10231a;})['then'](respondWithResult(_0x4ab2a6,0xc9))[_0x5d9f('0x3f')](handleError(_0x4ab2a6,null));};exports[_0x5d9f('0x4b')]=function(_0x88be59,_0x276205){if(_0x88be59[_0x5d9f('0x44')]['id']){delete _0x88be59['body']['id'];}return db[_0x5d9f('0x29')]['find']({'where':{'id':_0x88be59[_0x5d9f('0x41')]['id']}})['then'](handleEntityNotFound(_0x276205,null))[_0x5d9f('0x20')](saveUpdates(_0x88be59['body'],null))[_0x5d9f('0x20')](respondWithResult(_0x276205,null))[_0x5d9f('0x3f')](handleError(_0x276205,null));};exports[_0x5d9f('0x4c')]=function(_0x2ebd81,_0x46d9d4){return db[_0x5d9f('0x29')][_0x5d9f('0x49')]({'where':{'id':_0x2ebd81[_0x5d9f('0x41')]['id']}})[_0x5d9f('0x20')](handleEntityNotFound(_0x46d9d4,null))[_0x5d9f('0x20')](removeEntity(_0x46d9d4,null))[_0x5d9f('0x3f')](handleError(_0x46d9d4,null));}; \ No newline at end of file +var _0xf8ab=['count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x253f22,_0x1ee489){var _0x26c040=function(_0x199449){while(--_0x199449){_0x253f22['push'](_0x253f22['shift']());}};_0x26c040(++_0x1ee489);}(_0xf8ab,0x84));var _0xbf8a=function(_0x419c7a,_0x2153a8){_0x419c7a=_0x419c7a-0x0;var _0x228a4f=_0xf8ab[_0x419c7a];return _0x228a4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf8a('0x0'));var zipdir=require(_0xbf8a('0x1'));var jsonpatch=require(_0xbf8a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbf8a('0x3'));var Mustache=require(_0xbf8a('0x4'));var util=require(_0xbf8a('0x5'));var path=require('path');var sox=require(_0xbf8a('0x6'));var csv=require(_0xbf8a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf8a('0x8'));var _=require(_0xbf8a('0x9'));var squel=require(_0xbf8a('0xa'));var crypto=require(_0xbf8a('0xb'));var jsforce=require(_0xbf8a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbf8a('0x7'));var querystring=require(_0xbf8a('0xd'));var Papa=require(_0xbf8a('0xe'));var Redis=require('ioredis');var authService=require(_0xbf8a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf8a('0x10'));var logger=require(_0xbf8a('0x11'))(_0xbf8a('0x12'));var utils=require(_0xbf8a('0x13'));var config=require(_0xbf8a('0x14'));var licenseUtil=require(_0xbf8a('0x15'));var db=require(_0xbf8a('0x16'))['db'];function respondWithStatusCode(_0x3967e9,_0x1739a8){_0x1739a8=_0x1739a8||0xcc;return function(_0x4ce38e){if(_0x4ce38e){return _0x3967e9[_0xbf8a('0x17')](_0x1739a8);}return _0x3967e9[_0xbf8a('0x18')](_0x1739a8)[_0xbf8a('0x19')]();};}function respondWithResult(_0x2c9e4b,_0x54c4fa){_0x54c4fa=_0x54c4fa||0xc8;return function(_0x2894b2){if(_0x2894b2){return _0x2c9e4b[_0xbf8a('0x18')](_0x54c4fa)['json'](_0x2894b2);}};}function respondWithFilteredResult(_0x5906d8,_0x5b3ea4){return function(_0x57563e){if(_0x57563e){var _0x5b952a=typeof _0x5b3ea4[_0xbf8a('0x1a')]===_0xbf8a('0x1b')&&typeof _0x5b3ea4['limit']===_0xbf8a('0x1b');var _0x5dabd1=_0x57563e[_0xbf8a('0x1c')];var _0x2e4f5d=_0x5b952a?0x0:_0x5b3ea4['offset'];var _0x38fa8e=_0x5b952a?_0x57563e[_0xbf8a('0x1c')]:_0x5b3ea4[_0xbf8a('0x1a')]+_0x5b3ea4['limit'];var _0x2ed70a;if(_0x38fa8e>=_0x5dabd1){_0x38fa8e=_0x5dabd1;_0x2ed70a=0xc8;}else{_0x2ed70a=0xce;}_0x5906d8[_0xbf8a('0x18')](_0x2ed70a);return _0x5906d8[_0xbf8a('0x1d')](_0xbf8a('0x1e'),_0x2e4f5d+'-'+_0x38fa8e+'/'+_0x5dabd1)['json'](_0x57563e);}return null;};}function patchUpdates(_0x5cf8e2){return function(_0x51d51e){try{jsonpatch[_0xbf8a('0x1f')](_0x51d51e,_0x5cf8e2,!![]);}catch(_0x4a21c1){return BPromise[_0xbf8a('0x20')](_0x4a21c1);}return _0x51d51e['save']();};}function saveUpdates(_0x301608,_0x9b6eb){return function(_0x58e372){if(_0x58e372){return _0x58e372[_0xbf8a('0x21')](_0x301608)[_0xbf8a('0x22')](function(_0x4e4dae){return _0x4e4dae;});}return null;};}function removeEntity(_0x21a66b,_0xc723fb){return function(_0x3b8397){if(_0x3b8397){return _0x3b8397[_0xbf8a('0x23')]()[_0xbf8a('0x22')](function(){var _0x47fd87=_0x3b8397[_0xbf8a('0x24')]({'plain':!![]});var _0x5114ec='CmContactHasItems';return db[_0xbf8a('0x25')]['destroy']({'where':{'type':_0x5114ec,'resourceId':_0x47fd87['id']}})[_0xbf8a('0x22')](function(){return _0x3b8397;});})[_0xbf8a('0x22')](function(){_0x21a66b[_0xbf8a('0x18')](0xcc)[_0xbf8a('0x19')]();});}};}function handleEntityNotFound(_0x23dc33,_0x58d515){return function(_0x42db7b){if(!_0x42db7b){_0x23dc33['sendStatus'](0x194);}return _0x42db7b;};}function handleError(_0x114959,_0x4f45b2){_0x4f45b2=_0x4f45b2||0x1f4;return function(_0x5239e0){logger[_0xbf8a('0x26')](_0x5239e0[_0xbf8a('0x27')]);if(_0x5239e0[_0xbf8a('0x28')]){delete _0x5239e0[_0xbf8a('0x28')];}_0x114959[_0xbf8a('0x18')](_0x4f45b2)[_0xbf8a('0x29')](_0x5239e0);};}exports[_0xbf8a('0x2a')]=function(_0x27875d,_0x3ed4f8){var _0x88da8f={},_0x4c4b4e={},_0x111c50={'count':0x0,'rows':[]};var _0x241278=_[_0xbf8a('0x2b')](db[_0xbf8a('0x2c')][_0xbf8a('0x2d')],function(_0x310a7e){return{'name':_0x310a7e['fieldName'],'type':_0x310a7e['type'][_0xbf8a('0x2e')]};});_0x4c4b4e[_0xbf8a('0x2f')]=_['map'](_0x241278,'name');_0x4c4b4e[_0xbf8a('0x30')]=_[_0xbf8a('0x31')](_0x27875d[_0xbf8a('0x30')]);_0x4c4b4e[_0xbf8a('0x32')]=_[_0xbf8a('0x33')](_0x4c4b4e[_0xbf8a('0x2f')],_0x4c4b4e[_0xbf8a('0x30')]);_0x88da8f[_0xbf8a('0x34')]=_['intersection'](_0x4c4b4e[_0xbf8a('0x2f')],qs[_0xbf8a('0x35')](_0x27875d[_0xbf8a('0x30')][_0xbf8a('0x35')]));_0x88da8f[_0xbf8a('0x34')]=_0x88da8f[_0xbf8a('0x34')][_0xbf8a('0x36')]?_0x88da8f[_0xbf8a('0x34')]:_0x4c4b4e[_0xbf8a('0x2f')];if(!_0x27875d[_0xbf8a('0x30')]['hasOwnProperty']('nolimit')){_0x88da8f[_0xbf8a('0x37')]=qs[_0xbf8a('0x37')](_0x27875d[_0xbf8a('0x30')][_0xbf8a('0x37')]);_0x88da8f[_0xbf8a('0x1a')]=qs[_0xbf8a('0x1a')](_0x27875d[_0xbf8a('0x30')]['offset']);}_0x88da8f[_0xbf8a('0x38')]=qs[_0xbf8a('0x39')](_0x27875d[_0xbf8a('0x30')][_0xbf8a('0x39')]);_0x88da8f[_0xbf8a('0x3a')]=qs[_0xbf8a('0x32')](_['pick'](_0x27875d[_0xbf8a('0x30')],_0x4c4b4e[_0xbf8a('0x32')]),_0x241278);if(_0x27875d[_0xbf8a('0x30')]['filter']){_0x88da8f[_0xbf8a('0x3a')]=_[_0xbf8a('0x3b')](_0x88da8f[_0xbf8a('0x3a')],{'$or':_['map'](_0x241278,function(_0x5dd71c){if(_0x5dd71c[_0xbf8a('0x3c')]!==_0xbf8a('0x3d')){var _0x353389={};_0x353389[_0x5dd71c[_0xbf8a('0x28')]]={'$like':'%'+_0x27875d[_0xbf8a('0x30')][_0xbf8a('0x3e')]+'%'};return _0x353389;}})});}_0x88da8f=_[_0xbf8a('0x3b')]({},_0x88da8f,_0x27875d[_0xbf8a('0x3f')]);var _0x10ba0f={'where':_0x88da8f[_0xbf8a('0x3a')]};return db['CmContactHasItem'][_0xbf8a('0x1c')](_0x10ba0f)[_0xbf8a('0x22')](function(_0x5e89ed){_0x111c50[_0xbf8a('0x1c')]=_0x5e89ed;if(_0x27875d[_0xbf8a('0x30')][_0xbf8a('0x40')]){_0x88da8f[_0xbf8a('0x41')]=[{'all':!![]}];}return db[_0xbf8a('0x2c')][_0xbf8a('0x42')](_0x88da8f);})[_0xbf8a('0x22')](function(_0x3c8f61){_0x111c50[_0xbf8a('0x43')]=_0x3c8f61;return _0x111c50;})[_0xbf8a('0x22')](respondWithFilteredResult(_0x3ed4f8,_0x88da8f))[_0xbf8a('0x44')](handleError(_0x3ed4f8,null));};exports[_0xbf8a('0x45')]=function(_0x4ba32,_0xc0672a){var _0x5d6e77={'raw':!![],'where':{'id':_0x4ba32[_0xbf8a('0x46')]['id']}},_0x4ef136={};_0x4ef136['model']=_['keys'](db['CmContactHasItem'][_0xbf8a('0x2d')]);_0x4ef136[_0xbf8a('0x30')]=_[_0xbf8a('0x31')](_0x4ba32[_0xbf8a('0x30')]);_0x4ef136['filters']=_['intersection'](_0x4ef136[_0xbf8a('0x2f')],_0x4ef136[_0xbf8a('0x30')]);_0x5d6e77['attributes']=_[_0xbf8a('0x33')](_0x4ef136[_0xbf8a('0x2f')],qs[_0xbf8a('0x35')](_0x4ba32[_0xbf8a('0x30')][_0xbf8a('0x35')]));_0x5d6e77['attributes']=_0x5d6e77[_0xbf8a('0x34')][_0xbf8a('0x36')]?_0x5d6e77[_0xbf8a('0x34')]:_0x4ef136[_0xbf8a('0x2f')];if(_0x4ba32['query'][_0xbf8a('0x40')]){_0x5d6e77[_0xbf8a('0x41')]=[{'all':!![]}];}_0x5d6e77=_['merge']({},_0x5d6e77,_0x4ba32['options']);return db[_0xbf8a('0x2c')][_0xbf8a('0x47')](_0x5d6e77)[_0xbf8a('0x22')](handleEntityNotFound(_0xc0672a,null))['then'](respondWithResult(_0xc0672a,null))[_0xbf8a('0x44')](handleError(_0xc0672a,null));};exports[_0xbf8a('0x48')]=function(_0x37f965,_0x591d5f){return db['CmContactHasItem'][_0xbf8a('0x48')](_0x37f965[_0xbf8a('0x49')],{})[_0xbf8a('0x22')](function(_0xa313b0){var _0x5262bf=_0x37f965[_0xbf8a('0x4a')]['get']({'plain':!![]});if(!_0x5262bf)throw new Error(_0xbf8a('0x4b'));if(_0x5262bf[_0xbf8a('0x4c')]==='user'){var _0x3a1834=_0xa313b0[_0xbf8a('0x24')]({'plain':!![]});var _0x2beaad='CmContactHasItems';return db[_0xbf8a('0x4d')][_0xbf8a('0x47')]({'where':{'name':_0x2beaad,'userProfileId':_0x5262bf['userProfileId']},'raw':!![]})[_0xbf8a('0x22')](function(_0x59d9d3){if(_0x59d9d3&&_0x59d9d3[_0xbf8a('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x3a1834[_0xbf8a('0x28')],'resourceId':_0x3a1834['id'],'type':_0x59d9d3[_0xbf8a('0x28')],'sectionId':_0x59d9d3['id']},{})[_0xbf8a('0x22')](function(){return _0xa313b0;});}else{return _0xa313b0;}})[_0xbf8a('0x44')](function(_0x5c72d2){logger[_0xbf8a('0x26')](_0xbf8a('0x4f'),_0x5c72d2);throw _0x5c72d2;});}return _0xa313b0;})[_0xbf8a('0x22')](respondWithResult(_0x591d5f,0xc9))[_0xbf8a('0x44')](handleError(_0x591d5f,null));};exports[_0xbf8a('0x21')]=function(_0x385543,_0x5e0e8a){if(_0x385543[_0xbf8a('0x49')]['id']){delete _0x385543[_0xbf8a('0x49')]['id'];}return db[_0xbf8a('0x2c')]['find']({'where':{'id':_0x385543[_0xbf8a('0x46')]['id']}})[_0xbf8a('0x22')](handleEntityNotFound(_0x5e0e8a,null))['then'](saveUpdates(_0x385543[_0xbf8a('0x49')],null))['then'](respondWithResult(_0x5e0e8a,null))['catch'](handleError(_0x5e0e8a,null));};exports[_0xbf8a('0x23')]=function(_0x2deaad,_0x1ad3ca){return db[_0xbf8a('0x2c')]['find']({'where':{'id':_0x2deaad[_0xbf8a('0x46')]['id']}})['then'](handleEntityNotFound(_0x1ad3ca,null))[_0xbf8a('0x22')](removeEntity(_0x1ad3ca,null))[_0xbf8a('0x44')](handleError(_0x1ad3ca,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 13ab8e3..8e25705 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x41da=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5190b6,_0x398466){var _0x5d319c=function(_0x1a2106){while(--_0x1a2106){_0x5190b6['push'](_0x5190b6['shift']());}};_0x5d319c(++_0x398466);}(_0x41da,0x19b));var _0xa41d=function(_0x413ff0,_0x1e782d){_0x413ff0=_0x413ff0-0x0;var _0x3826d4=_0x41da[_0x413ff0];return _0x3826d4;};'use strict';var _=require(_0xa41d('0x0'));var util=require(_0xa41d('0x1'));var logger=require(_0xa41d('0x2'))(_0xa41d('0x3'));var moment=require(_0xa41d('0x4'));var BPromise=require(_0xa41d('0x5'));var rp=require(_0xa41d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa41d('0x7'));module[_0xa41d('0x8')]=function(_0x2494ee,_0x190f63){return _0x2494ee[_0xa41d('0x9')](_0xa41d('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0471=['path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x9d929a,_0x5f5c55){var _0x5d8627=function(_0x5717b1){while(--_0x5717b1){_0x9d929a['push'](_0x9d929a['shift']());}};_0x5d8627(++_0x5f5c55);}(_0x0471,0xf6));var _0x1047=function(_0x8d73fb,_0x14b813){_0x8d73fb=_0x8d73fb-0x0;var _0x51a5dd=_0x0471[_0x8d73fb];return _0x51a5dd;};'use strict';var _=require(_0x1047('0x0'));var util=require(_0x1047('0x1'));var logger=require(_0x1047('0x2'))(_0x1047('0x3'));var moment=require(_0x1047('0x4'));var BPromise=require('bluebird');var rp=require(_0x1047('0x5'));var fs=require('fs');var path=require(_0x1047('0x6'));var rimraf=require(_0x1047('0x7'));var config=require(_0x1047('0x8'));var attributes=require(_0x1047('0x9'));module[_0x1047('0xa')]=function(_0x3257af,_0x44186e){return _0x3257af[_0x1047('0xb')](_0x1047('0xc'),attributes,{'tableName':_0x1047('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 8541d13..51dd704 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf51d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0x352fc5,_0xc25f36){var _0x47095f=function(_0xb9849e){while(--_0xb9849e){_0x352fc5['push'](_0x352fc5['shift']());}};_0x47095f(++_0xc25f36);}(_0xf51d,0x195));var _0xdf51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf51d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdf51('0x0'));var util=require(_0xdf51('0x1'));var moment=require(_0xdf51('0x2'));var BPromise=require(_0xdf51('0x3'));var rs=require(_0xdf51('0x4'));var fs=require('fs');var Redis=require(_0xdf51('0x5'));var db=require(_0xdf51('0x6'))['db'];var utils=require(_0xdf51('0x7'));var logger=require(_0xdf51('0x8'))(_0xdf51('0x9'));var config=require(_0xdf51('0xa'));var jayson=require(_0xdf51('0xb'));var client=jayson[_0xdf51('0xc')][_0xdf51('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x51e023,_0x27d2fb,_0x5e663b){return new BPromise(function(_0xb80997,_0x32cc6a){return client['request'](_0x51e023,_0x5e663b)['then'](function(_0xd4e186){logger[_0xdf51('0xe')](_0xdf51('0xf'),_0x27d2fb,'request\x20sent');logger[_0xdf51('0x10')](_0xdf51('0x11'),_0x27d2fb,_0xdf51('0x12'),JSON['stringify'](_0xd4e186));if(_0xd4e186[_0xdf51('0x13')]){if(_0xd4e186[_0xdf51('0x13')][_0xdf51('0x14')]===0x1f4){logger[_0xdf51('0x13')](_0xdf51('0xf'),_0x27d2fb,_0xd4e186['error']['message']);return _0x32cc6a(_0xd4e186[_0xdf51('0x13')][_0xdf51('0x15')]);}logger[_0xdf51('0x13')](_0xdf51('0xf'),_0x27d2fb,_0xd4e186[_0xdf51('0x13')][_0xdf51('0x15')]);return _0xb80997(_0xd4e186[_0xdf51('0x13')]['message']);}else{logger[_0xdf51('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x27d2fb,'request\x20sent');_0xb80997(_0xd4e186[_0xdf51('0x16')][_0xdf51('0x15')]);}})[_0xdf51('0x17')](function(_0x521e42){logger['error'](_0xdf51('0xf'),_0x27d2fb,_0x521e42);_0x32cc6a(_0x521e42);});});} \ No newline at end of file +var _0x38a5=['result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message'];(function(_0x544baa,_0x1b17fe){var _0x5e8cc1=function(_0x1b55dc){while(--_0x1b55dc){_0x544baa['push'](_0x544baa['shift']());}};_0x5e8cc1(++_0x1b17fe);}(_0x38a5,0x112));var _0x538a=function(_0x850ca0,_0x3deeb1){_0x850ca0=_0x850ca0-0x0;var _0x268b70=_0x38a5[_0x850ca0];return _0x268b70;};'use strict';var _=require('lodash');var util=require(_0x538a('0x0'));var moment=require('moment');var BPromise=require(_0x538a('0x1'));var rs=require(_0x538a('0x2'));var fs=require('fs');var Redis=require(_0x538a('0x3'));var db=require(_0x538a('0x4'))['db'];var utils=require(_0x538a('0x5'));var logger=require(_0x538a('0x6'))(_0x538a('0x7'));var config=require('../../config/environment');var jayson=require(_0x538a('0x8'));var client=jayson['client'][_0x538a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17c9e7,_0x56ef3c,_0x37b8c2){return new BPromise(function(_0x44fd9a,_0x5a21b5){return client[_0x538a('0xa')](_0x17c9e7,_0x37b8c2)[_0x538a('0xb')](function(_0x211586){logger[_0x538a('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x56ef3c,_0x538a('0xd'));logger['debug'](_0x538a('0xe'),_0x56ef3c,_0x538a('0xd'),JSON[_0x538a('0xf')](_0x211586));if(_0x211586[_0x538a('0x10')]){if(_0x211586[_0x538a('0x10')][_0x538a('0x11')]===0x1f4){logger[_0x538a('0x10')](_0x538a('0x12'),_0x56ef3c,_0x211586[_0x538a('0x10')][_0x538a('0x13')]);return _0x5a21b5(_0x211586['error'][_0x538a('0x13')]);}logger['error'](_0x538a('0x12'),_0x56ef3c,_0x211586[_0x538a('0x10')][_0x538a('0x13')]);return _0x44fd9a(_0x211586['error']['message']);}else{logger[_0x538a('0xc')](_0x538a('0x12'),_0x56ef3c,'request\x20sent');_0x44fd9a(_0x211586[_0x538a('0x14')]['message']);}})['catch'](function(_0x230d7b){logger[_0x538a('0x10')](_0x538a('0x12'),_0x56ef3c,_0x230d7b);_0x5a21b5(_0x230d7b);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 066b8e0..6e7c955 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ea5=['./cmContactHasItem.controller','isAuthenticated','index','/:id','post','create','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x54dcc5,_0x1ad7dd){var _0x3cb084=function(_0x39236f){while(--_0x39236f){_0x54dcc5['push'](_0x54dcc5['shift']());}};_0x3cb084(++_0x1ad7dd);}(_0x4ea5,0xcb));var _0x54ea=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x4ea5[_0x412e27];return _0x53da42;};'use strict';var multer=require(_0x54ea('0x0'));var util=require('util');var path=require(_0x54ea('0x1'));var timeout=require(_0x54ea('0x2'));var express=require(_0x54ea('0x3'));var router=express['Router']();var fs_extra=require(_0x54ea('0x4'));var auth=require(_0x54ea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x54ea('0x6'));var controller=require(_0x54ea('0x7'));router['get']('/',auth[_0x54ea('0x8')](),controller[_0x54ea('0x9')]);router['get'](_0x54ea('0xa'),auth[_0x54ea('0x8')](),controller['show']);router[_0x54ea('0xb')]('/',auth[_0x54ea('0x8')](),controller[_0x54ea('0xc')]);router['put']('/:id',auth[_0x54ea('0x8')](),controller['update']);router['delete'](_0x54ea('0xa'),auth['isAuthenticated'](),controller[_0x54ea('0xd')]);module[_0x54ea('0xe')]=router; \ No newline at end of file +var _0x7268=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','delete','multer','path','connect-timeout','express'];(function(_0x578c7e,_0x2a87ef){var _0x4f9afb=function(_0x57cf32){while(--_0x57cf32){_0x578c7e['push'](_0x578c7e['shift']());}};_0x4f9afb(++_0x2a87ef);}(_0x7268,0x146));var _0x8726=function(_0x1fa9fc,_0x4e9d79){_0x1fa9fc=_0x1fa9fc-0x0;var _0x3c0df6=_0x7268[_0x1fa9fc];return _0x3c0df6;};'use strict';var multer=require(_0x8726('0x0'));var util=require('util');var path=require(_0x8726('0x1'));var timeout=require(_0x8726('0x2'));var express=require(_0x8726('0x3'));var router=express[_0x8726('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8726('0x5'));var interaction=require(_0x8726('0x6'));var config=require(_0x8726('0x7'));var controller=require('./cmContactHasItem.controller');router[_0x8726('0x8')]('/',auth['isAuthenticated'](),controller[_0x8726('0x9')]);router[_0x8726('0x8')](_0x8726('0xa'),auth[_0x8726('0xb')](),controller[_0x8726('0xc')]);router[_0x8726('0xd')]('/',auth[_0x8726('0xb')](),controller['create']);router['put'](_0x8726('0xa'),auth[_0x8726('0xb')](),controller['update']);router[_0x8726('0xe')](_0x8726('0xa'),auth[_0x8726('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 51a3781..a555c33 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 _0x5473=['select','values','isArray','stringify','BOOLEAN','sequelize','exports','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type'];(function(_0x59d55e,_0x3b9224){var _0x592bbb=function(_0x248933){while(--_0x248933){_0x59d55e['push'](_0x59d55e['shift']());}};_0x592bbb(++_0x3b9224);}(_0x5473,0x1d6));var _0x3547=function(_0x3b4922,_0x25b030){_0x3b4922=_0x3b4922-0x0;var _0xab3838=_0x5473[_0x3b4922];return _0xab3838;};'use strict';var Sequelize=require(_0x3547('0x0'));var _=require('lodash');module[_0x3547('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5e7cbb){return this[_0x3547('0x2')](_0x3547('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x29bcbc){this[_0x3547('0x4')]('alias',_0x29bcbc?_0x29bcbc:this[_0x3547('0x2')](_0x3547('0x5')));}},'type':{'type':Sequelize[_0x3547('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x3547('0x7')](_0x3547('0x8')),'get':function(){if(this['getDataValue'](_0x3547('0x9'))===_0x3547('0xa')){return JSON['parse'](this[_0x3547('0x2')]('values'));}else{return this[_0x3547('0x2')](_0x3547('0xb'));}},'set':function(_0x1f73c5){if(Array[_0x3547('0xc')](_0x1f73c5)){this[_0x3547('0x4')](_0x3547('0xb'),JSON[_0x3547('0xd')](_0x1f73c5));}else{this[_0x3547('0x4')](_0x3547('0xb'),_0x1f73c5);}}},'required':{'type':Sequelize[_0x3547('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM']('voice')}}; \ No newline at end of file +var _0x0eac=['exports','getDataValue','alias','STRING','setDataValue','long','type','select','parse','isArray','values','BOOLEAN','ENUM','voice','sequelize','lodash'];(function(_0x15a7f0,_0x28e284){var _0x54c04a=function(_0x45d3f7){while(--_0x45d3f7){_0x15a7f0['push'](_0x15a7f0['shift']());}};_0x54c04a(++_0x28e284);}(_0x0eac,0x17e));var _0xc0ea=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x0eac[_0x2e4aa2];return _0x5e6092;};'use strict';var Sequelize=require(_0xc0ea('0x0'));var _=require(_0xc0ea('0x1'));module[_0xc0ea('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x26e92e){return this[_0xc0ea('0x3')](_0xc0ea('0x4'));}},'alias':{'type':Sequelize[_0xc0ea('0x5')],'allowNull':![],'set':function(_0x410bf9){this[_0xc0ea('0x6')](_0xc0ea('0x4'),_0x410bf9?_0x410bf9:this[_0xc0ea('0x3')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xc0ea('0x7')),'get':function(){if(this[_0xc0ea('0x3')](_0xc0ea('0x8'))===_0xc0ea('0x9')){return JSON[_0xc0ea('0xa')](this[_0xc0ea('0x3')]('values'));}else{return this[_0xc0ea('0x3')]('values');}},'set':function(_0x5bca9d){if(Array[_0xc0ea('0xb')](_0x5bca9d)){this['setDataValue'](_0xc0ea('0xc'),JSON['stringify'](_0x5bca9d));}else{this[_0xc0ea('0x6')](_0xc0ea('0xc'),_0x5bca9d);}}},'required':{'type':Sequelize[_0xc0ea('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc0ea('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc0ea('0xe')](_0xc0ea('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index a561707..ce2a07e 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 _0x1c44=['BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','format','cf_%d','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','reject','update','then','destroy','sendStatus','stack','name','send','index','CmCustomField','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','Sequelize','TEXT','INTEGER','switch'];(function(_0x20883c,_0x3fb3c9){var _0x4dd27f=function(_0xb73cfa){while(--_0xb73cfa){_0x20883c['push'](_0x20883c['shift']());}};_0x4dd27f(++_0x3fb3c9);}(_0x1c44,0xa9));var _0x41c4=function(_0x48373b,_0x6667c){_0x48373b=_0x48373b-0x0;var _0xd234c7=_0x1c44[_0x48373b];return _0xd234c7;};'use strict';var emlformat=require(_0x41c4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x41c4('0x1'));var rp=require('request-promise');var moment=require(_0x41c4('0x2'));var BPromise=require(_0x41c4('0x3'));var Mustache=require(_0x41c4('0x4'));var util=require(_0x41c4('0x5'));var path=require(_0x41c4('0x6'));var sox=require(_0x41c4('0x7'));var csv=require(_0x41c4('0x8'));var ejs=require(_0x41c4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41c4('0xa'));var squel=require(_0x41c4('0xb'));var crypto=require(_0x41c4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x41c4('0xd'));var toCsv=require(_0x41c4('0x8'));var querystring=require(_0x41c4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x41c4('0xf'));var qs=require(_0x41c4('0x10'));var as=require(_0x41c4('0x11'));var hardwareService=require(_0x41c4('0x12'));var logger=require(_0x41c4('0x13'))('api');var utils=require(_0x41c4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x41c4('0x15'));var db=require(_0x41c4('0x16'))['db'];function respondWithStatusCode(_0x5dc186,_0x60666d){_0x60666d=_0x60666d||0xcc;return function(_0x288523){if(_0x288523){return _0x5dc186['sendStatus'](_0x60666d);}return _0x5dc186[_0x41c4('0x17')](_0x60666d)[_0x41c4('0x18')]();};}function respondWithResult(_0x1e1e9e,_0x149a84){_0x149a84=_0x149a84||0xc8;return function(_0x3c47ab){if(_0x3c47ab){return _0x1e1e9e[_0x41c4('0x17')](_0x149a84)[_0x41c4('0x19')](_0x3c47ab);}};}function respondWithFilteredResult(_0x1bb76e,_0xf346fe){return function(_0x2ac10f){if(_0x2ac10f){var _0x2cce69=typeof _0xf346fe['offset']===_0x41c4('0x1a')&&typeof _0xf346fe[_0x41c4('0x1b')]===_0x41c4('0x1a');var _0x5f477e=_0x2ac10f[_0x41c4('0x1c')];var _0x2eb13a=_0x2cce69?0x0:_0xf346fe[_0x41c4('0x1d')];var _0x2d1f5f=_0x2cce69?_0x2ac10f[_0x41c4('0x1c')]:_0xf346fe['offset']+_0xf346fe[_0x41c4('0x1b')];var _0x5a556e;if(_0x2d1f5f>=_0x5f477e){_0x2d1f5f=_0x5f477e;_0x5a556e=0xc8;}else{_0x5a556e=0xce;}_0x1bb76e[_0x41c4('0x17')](_0x5a556e);return _0x1bb76e[_0x41c4('0x1e')]('Content-Range',_0x2eb13a+'-'+_0x2d1f5f+'/'+_0x5f477e)[_0x41c4('0x19')](_0x2ac10f);}return null;};}function patchUpdates(_0x49317c){return function(_0x3ad3a9){try{jsonpatch['apply'](_0x3ad3a9,_0x49317c,!![]);}catch(_0x2de8ae){return BPromise[_0x41c4('0x1f')](_0x2de8ae);}return _0x3ad3a9['save']();};}function saveUpdates(_0x1827ed,_0x292aa8){return function(_0x43913f){if(_0x43913f){return _0x43913f[_0x41c4('0x20')](_0x1827ed)[_0x41c4('0x21')](function(_0x1de290){return _0x1de290;});}return null;};}function removeEntity(_0x2f1e54,_0x4916e6){return function(_0x1521c9){if(_0x1521c9){return _0x1521c9[_0x41c4('0x22')]()[_0x41c4('0x21')](function(){_0x2f1e54[_0x41c4('0x17')](0xcc)[_0x41c4('0x18')]();});}};}function handleEntityNotFound(_0x49e93e,_0xe342ee){return function(_0x54cfc3){if(!_0x54cfc3){_0x49e93e[_0x41c4('0x23')](0x194);}return _0x54cfc3;};}function handleError(_0xebeb43,_0x4416ca){_0x4416ca=_0x4416ca||0x1f4;return function(_0x2db613){logger['error'](_0x2db613[_0x41c4('0x24')]);if(_0x2db613[_0x41c4('0x25')]){delete _0x2db613[_0x41c4('0x25')];}_0xebeb43[_0x41c4('0x17')](_0x4416ca)[_0x41c4('0x26')](_0x2db613);};}exports[_0x41c4('0x27')]=function(_0x9354f,_0x237434){var _0x4af11e={},_0x17924d={},_0x58e3fb={'count':0x0,'rows':[]};var _0x76da63=_['map'](db[_0x41c4('0x28')]['rawAttributes'],function(_0x39e048){return{'name':_0x39e048['fieldName'],'type':_0x39e048[_0x41c4('0x29')][_0x41c4('0x2a')]};});_0x17924d['model']=_[_0x41c4('0x2b')](_['map'](_0x76da63,_0x41c4('0x25')),['name']);_0x17924d[_0x41c4('0x2c')]=_[_0x41c4('0x2d')](_0x9354f[_0x41c4('0x2c')]);_0x17924d[_0x41c4('0x2e')]=_[_0x41c4('0x2f')](_0x17924d[_0x41c4('0x30')],_0x17924d[_0x41c4('0x2c')]);_0x4af11e[_0x41c4('0x31')]=_[_0x41c4('0x2f')](_0x17924d[_0x41c4('0x30')],qs['fields'](_0x9354f[_0x41c4('0x2c')][_0x41c4('0x32')]));_0x4af11e['attributes']=_0x4af11e[_0x41c4('0x31')]['length']?_0x4af11e[_0x41c4('0x31')]:_0x17924d[_0x41c4('0x30')];if(!_0x9354f['query'][_0x41c4('0x33')]('nolimit')){_0x4af11e[_0x41c4('0x1b')]=qs[_0x41c4('0x1b')](_0x9354f['query']['limit']);_0x4af11e[_0x41c4('0x1d')]=qs[_0x41c4('0x1d')](_0x9354f[_0x41c4('0x2c')]['offset']);}_0x4af11e['order']=qs[_0x41c4('0x34')](_0x9354f[_0x41c4('0x2c')][_0x41c4('0x34')]);_0x4af11e[_0x41c4('0x35')]=qs[_0x41c4('0x2e')](_[_0x41c4('0x36')](_0x9354f['query'],_0x17924d[_0x41c4('0x2e')]),_0x76da63);if(_0x9354f[_0x41c4('0x2c')][_0x41c4('0x37')]){_0x4af11e[_0x41c4('0x35')]=_[_0x41c4('0x38')](_0x4af11e['where'],{'$or':_[_0x41c4('0x39')](_0x76da63,function(_0x52966b){if(_0x52966b['type']!=='VIRTUAL'){var _0xca0eaa={};_0xca0eaa[_0x52966b[_0x41c4('0x25')]]={'$like':'%'+_0x9354f[_0x41c4('0x2c')][_0x41c4('0x37')]+'%'};return _0xca0eaa;}})});}_0x4af11e=_['merge']({},_0x4af11e,_0x9354f[_0x41c4('0x3a')]);var _0x363644={'where':_0x4af11e['where']};return db[_0x41c4('0x28')][_0x41c4('0x1c')](_0x363644)['then'](function(_0x2f86a3){_0x58e3fb['count']=_0x2f86a3;if(_0x9354f['query'][_0x41c4('0x3b')]){_0x4af11e[_0x41c4('0x3c')]=[{'all':!![]}];}return db['CmCustomField'][_0x41c4('0x3d')](_0x4af11e);})[_0x41c4('0x21')](function(_0x26ce51){_0x58e3fb[_0x41c4('0x3e')]=_0x26ce51;return _0x58e3fb;})[_0x41c4('0x21')](respondWithFilteredResult(_0x237434,_0x4af11e))[_0x41c4('0x3f')](handleError(_0x237434,null));};exports[_0x41c4('0x40')]=function(_0x14be0c,_0x355ebd){var _0x4fa358={'raw':!![],'where':{'id':_0x14be0c[_0x41c4('0x41')]['id']}},_0x17b5f0={};_0x17b5f0[_0x41c4('0x30')]=_[_0x41c4('0x2d')](db[_0x41c4('0x28')][_0x41c4('0x42')]);_0x17b5f0['query']=_[_0x41c4('0x2d')](_0x14be0c['query']);_0x17b5f0['filters']=_[_0x41c4('0x2f')](_0x17b5f0[_0x41c4('0x30')],_0x17b5f0[_0x41c4('0x2c')]);_0x4fa358[_0x41c4('0x31')]=_[_0x41c4('0x2f')](_0x17b5f0[_0x41c4('0x30')],qs[_0x41c4('0x32')](_0x14be0c[_0x41c4('0x2c')][_0x41c4('0x32')]));_0x4fa358[_0x41c4('0x31')]=_0x4fa358[_0x41c4('0x31')][_0x41c4('0x43')]?_0x4fa358[_0x41c4('0x31')]:_0x17b5f0[_0x41c4('0x30')];if(_0x14be0c[_0x41c4('0x2c')][_0x41c4('0x3b')]){_0x4fa358['include']=[{'all':!![]}];}_0x4fa358=_[_0x41c4('0x38')]({},_0x4fa358,_0x14be0c['options']);return db[_0x41c4('0x28')][_0x41c4('0x44')](_0x4fa358)[_0x41c4('0x21')](handleEntityNotFound(_0x355ebd,null))[_0x41c4('0x21')](respondWithResult(_0x355ebd,null))[_0x41c4('0x3f')](handleError(_0x355ebd,null));};exports[_0x41c4('0x20')]=function(_0x5ab25e,_0x482a50){if(_0x5ab25e[_0x41c4('0x45')]['id']){delete _0x5ab25e['body']['id'];}return db[_0x41c4('0x28')]['find']({'where':{'id':_0x5ab25e[_0x41c4('0x41')]['id']}})[_0x41c4('0x21')](handleEntityNotFound(_0x482a50,null))[_0x41c4('0x21')](saveUpdates(_0x5ab25e[_0x41c4('0x45')],null))[_0x41c4('0x21')](respondWithResult(_0x482a50,null))[_0x41c4('0x3f')](handleError(_0x482a50,null));};exports[_0x41c4('0x22')]=function(_0x26bfb1,_0xd95d2b){return db[_0x41c4('0x28')][_0x41c4('0x44')]({'where':{'id':_0x26bfb1['params']['id']}})[_0x41c4('0x21')](handleEntityNotFound(_0xd95d2b,null))[_0x41c4('0x21')](removeEntity(_0xd95d2b,null))[_0x41c4('0x3f')](handleError(_0xd95d2b,null));};exports['create']=function(_0x457fe8,_0x8557fc){var _0x56da2f;return db['sequelize']['transaction'](function(_0x530ef4){return db[_0x41c4('0x28')]['create'](_0x457fe8[_0x41c4('0x45')],{'transaction':_0x530ef4})['then'](function(_0x4e403d){_0x56da2f=_0x4e403d;var _0x14cb70={'type':db[_0x41c4('0x46')][_0x41c4('0x47')],'transaction':_0x530ef4};switch(_0x457fe8[_0x41c4('0x45')]['type']){case'text':_0x14cb70['type']=db['Sequelize']['TEXT'];break;case'number':_0x14cb70[_0x41c4('0x29')]=db[_0x41c4('0x46')][_0x41c4('0x48')];break;case _0x41c4('0x49'):_0x14cb70['type']=db[_0x41c4('0x46')][_0x41c4('0x4a')];_0x14cb70[_0x41c4('0x4b')]=![];break;default:}return db[_0x41c4('0x4c')][_0x41c4('0x4d')][_0x41c4('0x4e')]('cm_contacts',util[_0x41c4('0x4f')](_0x41c4('0x50'),_0x56da2f['id']),_0x14cb70);})['then'](function(){return _0x56da2f;});})[_0x41c4('0x21')](respondWithResult(_0x8557fc,0xc9))['catch'](handleError(_0x8557fc,null));}; \ No newline at end of file +var _0xbb2e=['map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','CmCustomField','include','findAll','rows','catch','show','params','length','includeAll','options','find','update','body','create','transaction','number','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send'];(function(_0x59d351,_0x5ef282){var _0x1abb50=function(_0x4e565b){while(--_0x4e565b){_0x59d351['push'](_0x59d351['shift']());}};_0x1abb50(++_0x5ef282);}(_0xbb2e,0x192));var _0xebb2=function(_0x52dfb0,_0x279168){_0x52dfb0=_0x52dfb0-0x0;var _0x58bdd8=_0xbb2e[_0x52dfb0];return _0x58bdd8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebb2('0x0'));var zipdir=require(_0xebb2('0x1'));var jsonpatch=require(_0xebb2('0x2'));var rp=require(_0xebb2('0x3'));var moment=require(_0xebb2('0x4'));var BPromise=require(_0xebb2('0x5'));var Mustache=require(_0xebb2('0x6'));var util=require(_0xebb2('0x7'));var path=require(_0xebb2('0x8'));var sox=require('sox');var csv=require(_0xebb2('0x9'));var ejs=require(_0xebb2('0xa'));var fs=require('fs');var fs_extra=require(_0xebb2('0xb'));var _=require('lodash');var squel=require(_0xebb2('0xc'));var crypto=require(_0xebb2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xebb2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xebb2('0xf'));var Papa=require(_0xebb2('0x10'));var Redis=require('ioredis');var authService=require(_0xebb2('0x11'));var qs=require(_0xebb2('0x12'));var as=require(_0xebb2('0x13'));var hardwareService=require(_0xebb2('0x14'));var logger=require(_0xebb2('0x15'))(_0xebb2('0x16'));var utils=require('../../config/utils');var config=require(_0xebb2('0x17'));var licenseUtil=require(_0xebb2('0x18'));var db=require(_0xebb2('0x19'))['db'];function respondWithStatusCode(_0x37172c,_0x1bf44c){_0x1bf44c=_0x1bf44c||0xcc;return function(_0x4c0df5){if(_0x4c0df5){return _0x37172c[_0xebb2('0x1a')](_0x1bf44c);}return _0x37172c['status'](_0x1bf44c)[_0xebb2('0x1b')]();};}function respondWithResult(_0x27f406,_0xf237c2){_0xf237c2=_0xf237c2||0xc8;return function(_0x128e25){if(_0x128e25){return _0x27f406[_0xebb2('0x1c')](_0xf237c2)['json'](_0x128e25);}};}function respondWithFilteredResult(_0x11ac07,_0x3bb95d){return function(_0x4afe58){if(_0x4afe58){var _0xf61f22=typeof _0x3bb95d['offset']===_0xebb2('0x1d')&&typeof _0x3bb95d[_0xebb2('0x1e')]===_0xebb2('0x1d');var _0x4b6612=_0x4afe58[_0xebb2('0x1f')];var _0x299c3f=_0xf61f22?0x0:_0x3bb95d['offset'];var _0x29ba23=_0xf61f22?_0x4afe58[_0xebb2('0x1f')]:_0x3bb95d[_0xebb2('0x20')]+_0x3bb95d[_0xebb2('0x1e')];var _0x2c48b3;if(_0x29ba23>=_0x4b6612){_0x29ba23=_0x4b6612;_0x2c48b3=0xc8;}else{_0x2c48b3=0xce;}_0x11ac07['status'](_0x2c48b3);return _0x11ac07[_0xebb2('0x21')](_0xebb2('0x22'),_0x299c3f+'-'+_0x29ba23+'/'+_0x4b6612)['json'](_0x4afe58);}return null;};}function patchUpdates(_0x5b7b55){return function(_0x2038b7){try{jsonpatch[_0xebb2('0x23')](_0x2038b7,_0x5b7b55,!![]);}catch(_0x2859f4){return BPromise[_0xebb2('0x24')](_0x2859f4);}return _0x2038b7[_0xebb2('0x25')]();};}function saveUpdates(_0x4b463f,_0x4a64e5){return function(_0x42d450){if(_0x42d450){return _0x42d450['update'](_0x4b463f)[_0xebb2('0x26')](function(_0x1722a0){return _0x1722a0;});}return null;};}function removeEntity(_0x477927,_0x31eb0e){return function(_0x28d958){if(_0x28d958){return _0x28d958[_0xebb2('0x27')]()[_0xebb2('0x26')](function(){_0x477927[_0xebb2('0x1c')](0xcc)[_0xebb2('0x1b')]();});}};}function handleEntityNotFound(_0x13de4a,_0x2d1366){return function(_0x5d135d){if(!_0x5d135d){_0x13de4a[_0xebb2('0x1a')](0x194);}return _0x5d135d;};}function handleError(_0x4f5ab9,_0x32088d){_0x32088d=_0x32088d||0x1f4;return function(_0x20f1bb){logger[_0xebb2('0x28')](_0x20f1bb['stack']);if(_0x20f1bb[_0xebb2('0x29')]){delete _0x20f1bb[_0xebb2('0x29')];}_0x4f5ab9['status'](_0x32088d)[_0xebb2('0x2a')](_0x20f1bb);};}exports['index']=function(_0x2282ce,_0x50b20){var _0x3d5cd5={},_0x46ba38={},_0x330d73={'count':0x0,'rows':[]};var _0x114c5d=_[_0xebb2('0x2b')](db['CmCustomField'][_0xebb2('0x2c')],function(_0x5439af){return{'name':_0x5439af[_0xebb2('0x2d')],'type':_0x5439af[_0xebb2('0x2e')][_0xebb2('0x2f')]};});_0x46ba38[_0xebb2('0x30')]=_[_0xebb2('0x31')](_[_0xebb2('0x2b')](_0x114c5d,_0xebb2('0x29')),[_0xebb2('0x29')]);_0x46ba38[_0xebb2('0x32')]=_[_0xebb2('0x33')](_0x2282ce[_0xebb2('0x32')]);_0x46ba38[_0xebb2('0x34')]=_[_0xebb2('0x35')](_0x46ba38[_0xebb2('0x30')],_0x46ba38[_0xebb2('0x32')]);_0x3d5cd5[_0xebb2('0x36')]=_[_0xebb2('0x35')](_0x46ba38['model'],qs[_0xebb2('0x37')](_0x2282ce[_0xebb2('0x32')]['fields']));_0x3d5cd5[_0xebb2('0x36')]=_0x3d5cd5[_0xebb2('0x36')]['length']?_0x3d5cd5[_0xebb2('0x36')]:_0x46ba38['model'];if(!_0x2282ce[_0xebb2('0x32')][_0xebb2('0x38')]('nolimit')){_0x3d5cd5[_0xebb2('0x1e')]=qs[_0xebb2('0x1e')](_0x2282ce[_0xebb2('0x32')][_0xebb2('0x1e')]);_0x3d5cd5[_0xebb2('0x20')]=qs['offset'](_0x2282ce[_0xebb2('0x32')][_0xebb2('0x20')]);}_0x3d5cd5['order']=qs[_0xebb2('0x39')](_0x2282ce[_0xebb2('0x32')]['sort']);_0x3d5cd5[_0xebb2('0x3a')]=qs[_0xebb2('0x34')](_[_0xebb2('0x3b')](_0x2282ce[_0xebb2('0x32')],_0x46ba38[_0xebb2('0x34')]),_0x114c5d);if(_0x2282ce[_0xebb2('0x32')][_0xebb2('0x3c')]){_0x3d5cd5[_0xebb2('0x3a')]=_[_0xebb2('0x3d')](_0x3d5cd5[_0xebb2('0x3a')],{'$or':_[_0xebb2('0x2b')](_0x114c5d,function(_0x78846e){if(_0x78846e[_0xebb2('0x2e')]!==_0xebb2('0x3e')){var _0x1a3f76={};_0x1a3f76[_0x78846e[_0xebb2('0x29')]]={'$like':'%'+_0x2282ce[_0xebb2('0x32')][_0xebb2('0x3c')]+'%'};return _0x1a3f76;}})});}_0x3d5cd5=_[_0xebb2('0x3d')]({},_0x3d5cd5,_0x2282ce['options']);var _0x5aaf92={'where':_0x3d5cd5['where']};return db[_0xebb2('0x3f')][_0xebb2('0x1f')](_0x5aaf92)[_0xebb2('0x26')](function(_0x5b4c4c){_0x330d73['count']=_0x5b4c4c;if(_0x2282ce[_0xebb2('0x32')]['includeAll']){_0x3d5cd5[_0xebb2('0x40')]=[{'all':!![]}];}return db[_0xebb2('0x3f')][_0xebb2('0x41')](_0x3d5cd5);})[_0xebb2('0x26')](function(_0x5cc25a){_0x330d73[_0xebb2('0x42')]=_0x5cc25a;return _0x330d73;})[_0xebb2('0x26')](respondWithFilteredResult(_0x50b20,_0x3d5cd5))[_0xebb2('0x43')](handleError(_0x50b20,null));};exports[_0xebb2('0x44')]=function(_0x457254,_0x32a914){var _0x2161a9={'raw':!![],'where':{'id':_0x457254[_0xebb2('0x45')]['id']}},_0x5454a9={};_0x5454a9[_0xebb2('0x30')]=_[_0xebb2('0x33')](db[_0xebb2('0x3f')][_0xebb2('0x2c')]);_0x5454a9['query']=_[_0xebb2('0x33')](_0x457254[_0xebb2('0x32')]);_0x5454a9[_0xebb2('0x34')]=_['intersection'](_0x5454a9['model'],_0x5454a9[_0xebb2('0x32')]);_0x2161a9['attributes']=_['intersection'](_0x5454a9[_0xebb2('0x30')],qs[_0xebb2('0x37')](_0x457254[_0xebb2('0x32')][_0xebb2('0x37')]));_0x2161a9['attributes']=_0x2161a9['attributes'][_0xebb2('0x46')]?_0x2161a9['attributes']:_0x5454a9['model'];if(_0x457254[_0xebb2('0x32')][_0xebb2('0x47')]){_0x2161a9['include']=[{'all':!![]}];}_0x2161a9=_[_0xebb2('0x3d')]({},_0x2161a9,_0x457254[_0xebb2('0x48')]);return db[_0xebb2('0x3f')][_0xebb2('0x49')](_0x2161a9)[_0xebb2('0x26')](handleEntityNotFound(_0x32a914,null))['then'](respondWithResult(_0x32a914,null))[_0xebb2('0x43')](handleError(_0x32a914,null));};exports[_0xebb2('0x4a')]=function(_0x2f088f,_0x357d69){if(_0x2f088f['body']['id']){delete _0x2f088f[_0xebb2('0x4b')]['id'];}return db[_0xebb2('0x3f')]['find']({'where':{'id':_0x2f088f['params']['id']}})[_0xebb2('0x26')](handleEntityNotFound(_0x357d69,null))[_0xebb2('0x26')](saveUpdates(_0x2f088f[_0xebb2('0x4b')],null))[_0xebb2('0x26')](respondWithResult(_0x357d69,null))['catch'](handleError(_0x357d69,null));};exports['destroy']=function(_0x2810bc,_0x5d3092){return db[_0xebb2('0x3f')][_0xebb2('0x49')]({'where':{'id':_0x2810bc['params']['id']}})[_0xebb2('0x26')](handleEntityNotFound(_0x5d3092,null))[_0xebb2('0x26')](removeEntity(_0x5d3092,null))[_0xebb2('0x43')](handleError(_0x5d3092,null));};exports[_0xebb2('0x4c')]=function(_0x5c64b3,_0x842cec){var _0x53ed5c;return db['sequelize'][_0xebb2('0x4d')](function(_0x263aac){return db['CmCustomField'][_0xebb2('0x4c')](_0x5c64b3[_0xebb2('0x4b')],{'transaction':_0x263aac})[_0xebb2('0x26')](function(_0x5c642f){_0x53ed5c=_0x5c642f;var _0x289ce0={'type':db['Sequelize']['TEXT'],'transaction':_0x263aac};switch(_0x5c64b3['body']['type']){case'text':_0x289ce0[_0xebb2('0x2e')]=db['Sequelize']['TEXT'];break;case _0xebb2('0x4e'):_0x289ce0[_0xebb2('0x2e')]=db[_0xebb2('0x4f')][_0xebb2('0x50')];break;case _0xebb2('0x51'):_0x289ce0['type']=db[_0xebb2('0x4f')][_0xebb2('0x52')];_0x289ce0[_0xebb2('0x53')]=![];break;default:}return db[_0xebb2('0x54')][_0xebb2('0x55')][_0xebb2('0x56')](_0xebb2('0x57'),util[_0xebb2('0x58')]('cf_%d',_0x53ed5c['id']),_0x289ce0);})['then'](function(){return _0x53ed5c;});})[_0xebb2('0x26')](respondWithResult(_0x842cec,0xc9))[_0xebb2('0x43')](handleError(_0x842cec,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 93a7750..f47450c 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 _0x8374=['./cmCustomField.attributes','define','CmCustomField','lodash','moment','bluebird','request-promise','path','rimraf'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x8374,0x17d));var _0x4837=function(_0x2cbf6c,_0x3ef4ac){_0x2cbf6c=_0x2cbf6c-0x0;var _0x591635=_0x8374[_0x2cbf6c];return _0x591635;};'use strict';var _=require(_0x4837('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4837('0x1'));var BPromise=require(_0x4837('0x2'));var rp=require(_0x4837('0x3'));var fs=require('fs');var path=require(_0x4837('0x4'));var rimraf=require(_0x4837('0x5'));var config=require('../../config/environment');var attributes=require(_0x4837('0x6'));module['exports']=function(_0xa9e4e4,_0x34587b){return _0xa9e4e4[_0x4837('0x7')](_0x4837('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf89=['lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./cmCustomField.attributes','CmCustomField','cm_custom_fields'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0xdf89,0x1a4));var _0x9df8=function(_0x1320d9,_0x79d565){_0x1320d9=_0x1320d9-0x0;var _0x5b6be0=_0xdf89[_0x1320d9];return _0x5b6be0;};'use strict';var _=require(_0x9df8('0x0'));var util=require(_0x9df8('0x1'));var logger=require(_0x9df8('0x2'))(_0x9df8('0x3'));var moment=require(_0x9df8('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9df8('0x5'));var config=require(_0x9df8('0x6'));var attributes=require(_0x9df8('0x7'));module['exports']=function(_0xb60956,_0x35acce){return _0xb60956['define'](_0x9df8('0x8'),attributes,{'tableName':_0x9df8('0x9'),'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 b0de4f6..139a028 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 _0x7124=['CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1ea230,_0x2ebb2e){var _0x2dc7f1=function(_0x2cf467){while(--_0x2cf467){_0x1ea230['push'](_0x1ea230['shift']());}};_0x2dc7f1(++_0x2ebb2e);}(_0x7124,0x1a4));var _0x4712=function(_0x25d2fa,_0x1d35c6){_0x25d2fa=_0x25d2fa-0x0;var _0x42d4aa=_0x7124[_0x25d2fa];return _0x42d4aa;};'use strict';var _=require(_0x4712('0x0'));var util=require(_0x4712('0x1'));var moment=require('moment');var BPromise=require(_0x4712('0x2'));var rs=require(_0x4712('0x3'));var fs=require('fs');var Redis=require(_0x4712('0x4'));var db=require(_0x4712('0x5'))['db'];var utils=require(_0x4712('0x6'));var logger=require(_0x4712('0x7'))(_0x4712('0x8'));var config=require('../../config/environment');var jayson=require(_0x4712('0x9'));var client=jayson[_0x4712('0xa')][_0x4712('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54a5fd,_0x47c9ff,_0x23c652){return new BPromise(function(_0x5d7852,_0x425634){return client[_0x4712('0xc')](_0x54a5fd,_0x23c652)[_0x4712('0xd')](function(_0x45e715){logger['info'](_0x4712('0xe'),_0x47c9ff,_0x4712('0xf'));logger[_0x4712('0x10')](_0x4712('0x11'),_0x47c9ff,_0x4712('0xf'),JSON['stringify'](_0x45e715));if(_0x45e715[_0x4712('0x12')]){if(_0x45e715['error'][_0x4712('0x13')]===0x1f4){logger[_0x4712('0x12')]('CmCustomField,\x20%s,\x20%s',_0x47c9ff,_0x45e715[_0x4712('0x12')][_0x4712('0x14')]);return _0x425634(_0x45e715['error'][_0x4712('0x14')]);}logger[_0x4712('0x12')](_0x4712('0xe'),_0x47c9ff,_0x45e715['error']['message']);return _0x5d7852(_0x45e715[_0x4712('0x12')][_0x4712('0x14')]);}else{logger[_0x4712('0x15')](_0x4712('0xe'),_0x47c9ff,_0x4712('0xf'));_0x5d7852(_0x45e715[_0x4712('0x16')]['message']);}})['catch'](function(_0x261284){logger[_0x4712('0x12')](_0x4712('0xe'),_0x47c9ff,_0x261284);_0x425634(_0x261284);});});} \ No newline at end of file +var _0x8bd1=['info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','CmCustomField,\x20%s,\x20%s','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x574584,_0x4f408e){var _0x1a3157=function(_0x618f44){while(--_0x618f44){_0x574584['push'](_0x574584['shift']());}};_0x1a3157(++_0x4f408e);}(_0x8bd1,0x73));var _0x18bd=function(_0x5dce90,_0x29e41f){_0x5dce90=_0x5dce90-0x0;var _0xf037e7=_0x8bd1[_0x5dce90];return _0xf037e7;};'use strict';var _=require(_0x18bd('0x0'));var util=require(_0x18bd('0x1'));var moment=require(_0x18bd('0x2'));var BPromise=require(_0x18bd('0x3'));var rs=require(_0x18bd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18bd('0x5'))['db'];var utils=require(_0x18bd('0x6'));var logger=require('../../config/logger')(_0x18bd('0x7'));var config=require(_0x18bd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x18bd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d4183,_0x260199,_0x7c73be){return new BPromise(function(_0x5c30e8,_0x49835d){return client['request'](_0x4d4183,_0x7c73be)[_0x18bd('0xa')](function(_0x2b4f82){logger['info'](_0x18bd('0xb'),_0x260199,'request\x20sent');logger['debug'](_0x18bd('0xc'),_0x260199,_0x18bd('0xd'),JSON[_0x18bd('0xe')](_0x2b4f82));if(_0x2b4f82[_0x18bd('0xf')]){if(_0x2b4f82[_0x18bd('0xf')][_0x18bd('0x10')]===0x1f4){logger[_0x18bd('0xf')](_0x18bd('0xb'),_0x260199,_0x2b4f82['error'][_0x18bd('0x11')]);return _0x49835d(_0x2b4f82[_0x18bd('0xf')][_0x18bd('0x11')]);}logger[_0x18bd('0xf')](_0x18bd('0xb'),_0x260199,_0x2b4f82[_0x18bd('0xf')][_0x18bd('0x11')]);return _0x5c30e8(_0x2b4f82[_0x18bd('0xf')][_0x18bd('0x11')]);}else{logger[_0x18bd('0x12')](_0x18bd('0xb'),_0x260199,_0x18bd('0xd'));_0x5c30e8(_0x2b4f82['result']['message']);}})['catch'](function(_0xb3a251){logger[_0x18bd('0xf')](_0x18bd('0xb'),_0x260199,_0xb3a251);_0x49835d(_0xb3a251);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index f8d08c9..9defab2 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 _0x938d=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','create','put','update'];(function(_0x597106,_0x44de51){var _0x3ca6b5=function(_0x9e6058){while(--_0x9e6058){_0x597106['push'](_0x597106['shift']());}};_0x3ca6b5(++_0x44de51);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd938('0x0'));var util=require(_0xd938('0x1'));var path=require('path');var timeout=require(_0xd938('0x2'));var express=require(_0xd938('0x3'));var router=express[_0xd938('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd938('0x5'));var config=require(_0xd938('0x6'));var controller=require(_0xd938('0x7'));router['get']('/',auth[_0xd938('0x8')](),controller[_0xd938('0x9')]);router[_0xd938('0xa')](_0xd938('0xb'),auth[_0xd938('0x8')](),controller[_0xd938('0xc')]);router['post']('/',auth[_0xd938('0x8')](),controller[_0xd938('0xd')]);router[_0xd938('0xe')](_0xd938('0xb'),auth[_0xd938('0x8')](),controller[_0xd938('0xf')]);router['delete'](_0xd938('0xb'),auth[_0xd938('0x8')](),controller[_0xd938('0x10')]);module[_0xd938('0x11')]=router; \ No newline at end of file +var _0xabe8=['post','create','put','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','show'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xabe8,0x8c));var _0x8abe=function(_0x27c342,_0x503bb4){_0x27c342=_0x27c342-0x0;var _0x8f06ae=_0xabe8[_0x27c342];return _0x8f06ae;};'use strict';var multer=require(_0x8abe('0x0'));var util=require(_0x8abe('0x1'));var path=require(_0x8abe('0x2'));var timeout=require('connect-timeout');var express=require(_0x8abe('0x3'));var router=express[_0x8abe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8abe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8abe('0x6'));var controller=require(_0x8abe('0x7'));router[_0x8abe('0x8')]('/',auth[_0x8abe('0x9')](),controller[_0x8abe('0xa')]);router['get']('/:id',auth[_0x8abe('0x9')](),controller[_0x8abe('0xb')]);router[_0x8abe('0xc')]('/',auth[_0x8abe('0x9')](),controller[_0x8abe('0xd')]);router[_0x8abe('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8abe('0xf')](_0x8abe('0x10'),auth[_0x8abe('0x9')](),controller[_0x8abe('0x11')]);module[_0x8abe('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 c7232fc..a3cb6cc 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 _0x9f3c=['INTEGER','STRING','DATE','UNSIGNED','contactListQueue','moment','exports','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9f3c,0x16d));var _0xc9f3=function(_0x478bea,_0x575209){_0x478bea=_0x478bea-0x0;var _0x108f07=_0x9f3c[_0x478bea];return _0x108f07;};'use strict';var moment=require(_0xc9f3('0x0'));var Sequelize=require('sequelize');module[_0xc9f3('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xc9f3('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xc9f3('0x3'))},'countbusyretry':{'type':Sequelize[_0xc9f3('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc9f3('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc9f3('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc9f3('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc9f3('0x6')]},'priority':{'type':Sequelize[_0xc9f3('0x4')](0x2)[_0xc9f3('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc9f3('0x4')],'unique':_0xc9f3('0x8')},'ListId':{'type':Sequelize[_0xc9f3('0x4')],'unique':_0xc9f3('0x8')},'UserId':{'type':Sequelize[_0xc9f3('0x4')]},'VoiceQueueId':{'type':Sequelize[_0xc9f3('0x4')],'unique':_0xc9f3('0x8')},'CampaignId':{'type':Sequelize[_0xc9f3('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xc9f3('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc9f3('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc9f3('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc9f3('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc9f3('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xc9f3('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc9f3('0x5')]},'recallmeNotifiedDate':{'type':Sequelize[_0xc9f3('0x6')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x7e13=['INTEGER','UNSIGNED','contactListQueue','moment','STRING','BOOLEAN','DATE','format'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x7e13,0xdb));var _0x37e1=function(_0x327a81,_0xedbb61){_0x327a81=_0x327a81-0x0;var _0x1ad62e=_0x7e13[_0x327a81];return _0x1ad62e;};'use strict';var moment=require(_0x37e1('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x37e1('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x37e1('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x37e1('0x3')],'defaultValue':moment()[_0x37e1('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x37e1('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x37e1('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x37e1('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x37e1('0x5')](0x2)[_0x37e1('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x37e1('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x37e1('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x37e1('0x7')},'UserId':{'type':Sequelize[_0x37e1('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x37e1('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x37e1('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x37e1('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x37e1('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x37e1('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x37e1('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x37e1('0x1')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 7b01da8..48f048a 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 _0x5fd1=['createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','calleridnum','campaigntype','queue','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','YYYY-MM-DD\x20HH:mm:ss','dialPreviewAutoRecallMe','value','direction','isEmpty','hopperIds','priority','ASC','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','CmCompany','Company','CmList','List','getPreviewRecall','UPDATE','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','json','undefined','limit','count','offset','status','set','Content-Range','update','sendStatus','error','stack','index','map','CmHopper','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','concat','$and','$or','$gt','$lt','$ne','$eq','$not','$notBetween','$in','$notIn','$notLike','$notILike','$like','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','then','include','rows','show','params','keys','length','find','catch','create','body','describe','destroy','VoiceQueue','Campaign','VoiceQueueId','CampaignId','omit'];(function(_0x881f4e,_0x4bc3ba){var _0x5834dc=function(_0x55ff4d){while(--_0x55ff4d){_0x881f4e['push'](_0x881f4e['shift']());}};_0x5834dc(++_0x4bc3ba);}(_0x5fd1,0x155));var _0x15fd=function(_0x21cd3d,_0x467607){_0x21cd3d=_0x21cd3d-0x0;var _0x5a21c4=_0x5fd1[_0x21cd3d];return _0x5a21c4;};'use strict';var moment=require(_0x15fd('0x0'));var _=require('lodash');var qs=require(_0x15fd('0x1'));var logger=require(_0x15fd('0x2'))(_0x15fd('0x3'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x370d34,_0x3138f3){_0x3138f3=_0x3138f3||0xc8;return function(_0x411b0e){if(_0x411b0e){return _0x370d34['status'](_0x3138f3)[_0x15fd('0x4')](_0x411b0e);}};}function respondWithFilteredResult(_0x386441,_0x18450c){return function(_0x2e88bf){if(_0x2e88bf){var _0x225728=typeof _0x18450c['offset']===_0x15fd('0x5')&&typeof _0x18450c[_0x15fd('0x6')]===_0x15fd('0x5');var _0x4c861f=_0x2e88bf[_0x15fd('0x7')];var _0x5c9c63=_0x225728?0x0:_0x18450c[_0x15fd('0x8')];var _0x250457=_0x225728?_0x2e88bf['count']:_0x18450c['offset']+_0x18450c['limit'];var _0x3dd2af;if(_0x250457>=_0x4c861f){_0x250457=_0x4c861f;_0x3dd2af=0xc8;}else{_0x3dd2af=0xce;}_0x386441[_0x15fd('0x9')](_0x3dd2af);return _0x386441[_0x15fd('0xa')](_0x15fd('0xb'),_0x5c9c63+'-'+_0x250457+'/'+_0x4c861f)[_0x15fd('0x4')](_0x2e88bf);}return null;};}function saveUpdates(_0x2e18ec,_0x346ab1){return function(_0x2660db){if(_0x2660db){return _0x2660db[_0x15fd('0xc')](_0x2e18ec)['then'](function(_0x5b7af0){return _0x5b7af0;});}return null;};}function handleEntityNotFound(_0x5784a3,_0x3fda60){return function(_0x135a15){if(!_0x135a15){_0x5784a3[_0x15fd('0xd')](0x194);}return _0x135a15;};}function handleError(_0x29caad,_0x44eae6){_0x44eae6=_0x44eae6||0x1f4;return function(_0x2ffa03){logger[_0x15fd('0xe')](_0x2ffa03[_0x15fd('0xf')]);if(_0x2ffa03['name']){delete _0x2ffa03['name'];}_0x29caad[_0x15fd('0x9')](_0x44eae6)['send'](_0x2ffa03);};}exports[_0x15fd('0x10')]=function(_0x579ee2,_0x917fe4){var _0x318f47={},_0x855bae={},_0x49ceac={'count':0x0,'rows':[]};var _0x367c36=_[_0x15fd('0x11')](db[_0x15fd('0x12')][_0x15fd('0x13')],function(_0x2fb919){return{'name':_0x2fb919[_0x15fd('0x14')],'type':_0x2fb919[_0x15fd('0x15')][_0x15fd('0x16')]};});_0x855bae[_0x15fd('0x17')]=_[_0x15fd('0x11')](_0x367c36,_0x15fd('0x18'));_0x855bae['query']=_['keys'](_0x579ee2[_0x15fd('0x19')]);_0x855bae[_0x15fd('0x1a')]=_[_0x15fd('0x1b')](_0x855bae[_0x15fd('0x17')],_0x855bae[_0x15fd('0x19')]);_0x855bae[_0x15fd('0x1a')]=_[_0x15fd('0x1c')](_0x855bae['filters'],[_0x15fd('0x1d'),_0x15fd('0x1e'),_0x15fd('0x1f'),'$gte',_0x15fd('0x20'),'$lte',_0x15fd('0x21'),_0x15fd('0x22'),_0x15fd('0x23'),'$between',_0x15fd('0x24'),_0x15fd('0x25'),_0x15fd('0x26'),'$like',_0x15fd('0x27'),'$iLike',_0x15fd('0x28'),_0x15fd('0x29'),_0x15fd('0x2a'),_0x15fd('0x2b'),_0x15fd('0x2c'),_0x15fd('0x2d')]);_0x318f47[_0x15fd('0x2e')]=_[_0x15fd('0x1b')](_0x855bae[_0x15fd('0x17')],qs[_0x15fd('0x2f')](_0x579ee2[_0x15fd('0x19')]['fields']));_0x318f47[_0x15fd('0x2e')]=_0x318f47[_0x15fd('0x2e')]['length']?_0x318f47[_0x15fd('0x2e')]:_0x855bae[_0x15fd('0x17')];if(!_0x579ee2['query'][_0x15fd('0x30')](_0x15fd('0x31'))){_0x318f47['limit']=qs[_0x15fd('0x6')](_0x579ee2[_0x15fd('0x19')][_0x15fd('0x6')]);_0x318f47[_0x15fd('0x8')]=qs[_0x15fd('0x8')](_0x579ee2[_0x15fd('0x19')]['offset']);}_0x318f47[_0x15fd('0x32')]=qs[_0x15fd('0x33')](_0x579ee2[_0x15fd('0x19')][_0x15fd('0x33')]);_0x318f47['where']=qs[_0x15fd('0x1a')](_[_0x15fd('0x34')](_0x579ee2[_0x15fd('0x19')],_0x855bae[_0x15fd('0x1a')]),_0x367c36);if(_0x579ee2[_0x15fd('0x19')][_0x15fd('0x35')]){_0x318f47['where']=_[_0x15fd('0x36')](_0x318f47[_0x15fd('0x37')],{'$or':_['map'](_0x367c36,function(_0x3f9aec){if(_0x3f9aec[_0x15fd('0x15')]!==_0x15fd('0x38')){var _0x5cb227={};_0x5cb227[_0x3f9aec[_0x15fd('0x18')]]={'$like':'%'+_0x579ee2[_0x15fd('0x19')][_0x15fd('0x35')]+'%'};return _0x5cb227;}})});}_0x318f47=_[_0x15fd('0x36')]({},_0x318f47,_0x579ee2[_0x15fd('0x39')]);var _0x6b2ac8={'where':_0x318f47['where']};return db['CmHopper']['count'](_0x6b2ac8)[_0x15fd('0x3a')](function(_0x289710){_0x49ceac[_0x15fd('0x7')]=_0x289710;if(_0x579ee2['query']['includeAll']){_0x318f47[_0x15fd('0x3b')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x318f47);})['then'](function(_0x2edb0d){_0x49ceac[_0x15fd('0x3c')]=_0x2edb0d;return _0x49ceac;})[_0x15fd('0x3a')](respondWithFilteredResult(_0x917fe4,_0x318f47))['catch'](handleError(_0x917fe4,null));};exports[_0x15fd('0x3d')]=function(_0x3a10e2,_0xd85d3e){var _0x5beb6e={'raw':!![],'where':{'id':_0x3a10e2[_0x15fd('0x3e')]['id']}},_0x1d693e={};_0x1d693e[_0x15fd('0x17')]=_[_0x15fd('0x3f')](db[_0x15fd('0x12')][_0x15fd('0x13')]);_0x1d693e[_0x15fd('0x19')]=_[_0x15fd('0x3f')](_0x3a10e2[_0x15fd('0x19')]);_0x1d693e['filters']=_[_0x15fd('0x1b')](_0x1d693e[_0x15fd('0x17')],_0x1d693e[_0x15fd('0x19')]);_0x5beb6e[_0x15fd('0x2e')]=_[_0x15fd('0x1b')](_0x1d693e[_0x15fd('0x17')],qs[_0x15fd('0x2f')](_0x3a10e2[_0x15fd('0x19')][_0x15fd('0x2f')]));_0x5beb6e[_0x15fd('0x2e')]=_0x5beb6e[_0x15fd('0x2e')][_0x15fd('0x40')]?_0x5beb6e[_0x15fd('0x2e')]:_0x1d693e[_0x15fd('0x17')];if(_0x3a10e2[_0x15fd('0x19')]['includeAll']){_0x5beb6e[_0x15fd('0x3b')]=[{'all':!![]}];}_0x5beb6e=_[_0x15fd('0x36')]({},_0x5beb6e,_0x3a10e2[_0x15fd('0x39')]);return db[_0x15fd('0x12')][_0x15fd('0x41')](_0x5beb6e)[_0x15fd('0x3a')](handleEntityNotFound(_0xd85d3e,null))[_0x15fd('0x3a')](respondWithResult(_0xd85d3e,null))[_0x15fd('0x42')](handleError(_0xd85d3e,null));};exports['create']=function(_0x4cd97b,_0x21f448){return db['CmHopper'][_0x15fd('0x43')](_0x4cd97b[_0x15fd('0x44')],{})['then'](respondWithResult(_0x21f448,0xc9))[_0x15fd('0x42')](handleError(_0x21f448,null));};exports[_0x15fd('0xc')]=function(_0x131eb4,_0x2611ba){if(_0x131eb4[_0x15fd('0x44')]['id']){delete _0x131eb4[_0x15fd('0x44')]['id'];}return db['CmHopper'][_0x15fd('0x41')]({'where':{'id':_0x131eb4[_0x15fd('0x3e')]['id']}})[_0x15fd('0x3a')](handleEntityNotFound(_0x2611ba,null))[_0x15fd('0x3a')](saveUpdates(_0x131eb4[_0x15fd('0x44')],null))[_0x15fd('0x3a')](respondWithResult(_0x2611ba,null))[_0x15fd('0x42')](handleError(_0x2611ba,null));};exports[_0x15fd('0x45')]=function(_0x24cb44,_0x1d3beb){return db[_0x15fd('0x12')][_0x15fd('0x45')]()['then'](respondWithResult(_0x1d3beb,null))[_0x15fd('0x42')](handleError(_0x1d3beb,null));};exports['destroy']=function(_0x284f51,_0x34c250){var _0xeb1e06;var _0x5a1f32=_0x284f51[_0x15fd('0x3e')]['id'];return db[_0x15fd('0x12')][_0x15fd('0x41')]({'where':{'id':_0x284f51[_0x15fd('0x3e')]['id']}})['then'](handleEntityNotFound(_0x34c250,null))[_0x15fd('0x3a')](function(_0x1a9605){if(_0x1a9605){return _0x1a9605[_0x15fd('0x46')]()[_0x15fd('0x3a')](function(_0x4b6827){return _0x4b6827;});}})[_0x15fd('0x3a')](function(_0x322623){_0xeb1e06=_0x322623;if(_0x322623){if(_0x322623['VoiceQueueId']||_0x322623['CampaignId']){return db[_0x322623['VoiceQueueId']?_0x15fd('0x47'):_0x15fd('0x48')][_0x15fd('0x41')]({'where':{'id':_0x322623[_0x15fd('0x49')]?_0x322623[_0x15fd('0x49')]:_0x322623[_0x15fd('0x4a')]},'attributes':['id','name'],'raw':!![]});}}})[_0x15fd('0x3a')](function(_0x22cc14){var _0xbb16ef={};if(_0x22cc14){_['merge'](_0xbb16ef,_[_0x15fd('0x4b')](_0xeb1e06['dataValues'],[_0x15fd('0x4c'),_0x15fd('0x4d'),'id']));_0xbb16ef[_0x15fd('0x4e')]=0x15;_0xbb16ef[_0x15fd('0x4f')]=_0x15fd('0x50');_0xbb16ef[_0x15fd('0x51')]=_0x22cc14[_0x15fd('0x18')];_0xbb16ef[_0x15fd('0x52')]=_0x284f51[_0x15fd('0x53')][_0x15fd('0x18')];_0xbb16ef[_0x15fd('0x54')]=_0x284f51[_0x15fd('0x53')]['id'];_0xbb16ef[_0x15fd('0x50')]=!![];_0xbb16ef['deletedat']=moment()[_0x15fd('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0xbb16ef[_0x15fd('0x56')]=_0xeb1e06['phone'];_0xbb16ef[_0x15fd('0x57')]=_0xeb1e06[_0x15fd('0x49')]?_0x15fd('0x58'):'ivr';return db['CmContact'][_0x15fd('0x41')]({'where':{'id':_0xbb16ef[_0x15fd('0x59')]},'attributes':[_0x15fd('0x5a'),_0x15fd('0x5b')]})['then'](function(_0x242c9d){if(!_[_0x15fd('0x5c')](_0x34c250)&&!_[_0x15fd('0x5c')](_0x242c9d[_0x15fd('0x5a')])){_0xbb16ef[_0x15fd('0x5d')]=_0x242c9d[_0x15fd('0x5a')];if(!_['isNil'](_0x242c9d[_0x15fd('0x5b')])){_0xbb16ef[_0x15fd('0x5d')]+='\x20'+_0x242c9d[_0x15fd('0x5b')];}}})[_0x15fd('0x5e')](function(){return db[_0x15fd('0x5f')][_0x15fd('0x43')](_0xbb16ef);});}})['then'](function(_0x4f2a17){return db[_0x15fd('0x60')][_0x15fd('0x46')]({'where':{'CmHopperId':_0x5a1f32}});})['then'](function(){return _0x34c250[_0x15fd('0x9')](0xcc)[_0x15fd('0x61')]();})['catch'](handleError(_0x34c250,null));};exports[_0x15fd('0x62')]=function(_0x4626ac,_0x24c3a0){var _0x53bfd7=[];return db[_0x15fd('0x63')][_0x15fd('0x45')]()[_0x15fd('0x3a')](function(_0x2db860){_0x53bfd7=_[_0x15fd('0x3f')](_0x2db860);return _0x4626ac[_0x15fd('0x53')][_0x15fd('0x64')]({'where':{'type':_0x15fd('0x65'),'dialActive':!![],'dialMethod':_0x15fd('0x66')},'attributes':['id',_0x15fd('0x67'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x15fd('0x3a')](function(_0x3a26c8){if(_0x3a26c8&&_0x3a26c8['length']){return db['sequelize'][_0x15fd('0x68')](function(_0x39e6ee){var _0x2bd6ef={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x15fd('0x55')](_0x15fd('0x69'))},'VoiceQueueId':{'$in':_[_0x15fd('0x11')](_0x3a26c8,'id')},'$or':[{'UserId':null},{'UserId':_0x4626ac['user']['id']}]};var _0x41d398={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3a26c8)[_0x15fd('0x35')]([_0x15fd('0x6a'),0x0])[_0x15fd('0x11')]('id')[_0x15fd('0x6b')]()},'$or':[{'UserId':null},{'UserId':_0x4626ac[_0x15fd('0x53')]['id']}]};var _0xf27ab4={'$or':[_0x2bd6ef,_0x41d398]};var _0x1fe6cb=[];if(_0x4626ac[_0x15fd('0x44')][_0x15fd('0x6c')]&&_0x4626ac[_0x15fd('0x44')]['direction']==='prev'){if(!_[_0x15fd('0x6d')](_0x4626ac[_0x15fd('0x44')][_0x15fd('0x6e')])){_0xf27ab4['id']={'$in':_0x4626ac[_0x15fd('0x44')][_0x15fd('0x6e')]};}_0x1fe6cb=[[_0x15fd('0x6f'),_0x15fd('0x70')],['scheduledAt',_0x3a26c8[0x0][_0x15fd('0x67')]==='ASC'?_0x15fd('0x71'):'ASC'],db[_0x15fd('0x72')]['literal'](_0x15fd('0x73')),['id',_0x15fd('0x71')]];}else{if(!_[_0x15fd('0x6d')](_0x4626ac[_0x15fd('0x44')][_0x15fd('0x6e')])){_0xf27ab4['id']={'$notIn':_0x4626ac[_0x15fd('0x44')][_0x15fd('0x6e')]};}_0x1fe6cb=[[_0x15fd('0x6f'),_0x15fd('0x71')],['scheduledAt',_0x3a26c8[0x0]['dialOrderByScheduledAt']],db[_0x15fd('0x72')][_0x15fd('0x74')](_0x15fd('0x75')),['id','ASC']];}return db[_0x15fd('0x12')][_0x15fd('0x76')]({'attributes':['id',_0x15fd('0x77'),'phone',_0x15fd('0x78')],'where':_0xf27ab4,'order':_0x1fe6cb,'transaction':_0x39e6ee,'lock':_0x39e6ee[_0x15fd('0x79')]['UPDATE'],'include':[{'model':db[_0x15fd('0x63')],'as':'Contact','attributes':_0x53bfd7,'include':[{'model':db[_0x15fd('0x7a')],'as':_0x15fd('0x7b'),'attributes':['id',_0x15fd('0x18')]}]},{'model':db[_0x15fd('0x7c')],'as':_0x15fd('0x7d'),'attributes':['id','name']},{'model':db[_0x15fd('0x47')],'as':'Queue','attributes':['id',_0x15fd('0x18'),'dialActive']}]})[_0x15fd('0x3a')](function(_0x26fa9a){if(_0x26fa9a){return _0x26fa9a['update']({'UserId':_0x4626ac[_0x15fd('0x53')]['id']},{'transaction':_0x39e6ee});}});});}})[_0x15fd('0x3a')](handleEntityNotFound(_0x24c3a0,null))['then'](respondWithResult(_0x24c3a0,null))['catch'](handleError(_0x24c3a0,null));};exports[_0x15fd('0x7e')]=function(_0x5a9db1,_0x279bc1,_0x2feba1){var _0x166016=[];var _0x2121cb=_0x5a9db1[_0x15fd('0x3e')]['id'];var _0x54ab7d=_0x5a9db1[_0x15fd('0x53')]['id'];return db[_0x15fd('0x63')]['describe']()[_0x15fd('0x3a')](function(_0x3a4646){_0x166016=_[_0x15fd('0x3f')](_0x3a4646);return db[_0x15fd('0x72')][_0x15fd('0x68')](function(_0x1d529d){const _0x438ee3={'id':_0x2121cb};return db[_0x15fd('0x12')][_0x15fd('0x76')]({'attributes':['id',_0x15fd('0x77'),_0x15fd('0x78')],'where':_0x438ee3,'transaction':_0x1d529d,'lock':_0x1d529d[_0x15fd('0x79')][_0x15fd('0x7f')],'include':[{'model':db[_0x15fd('0x63')],'as':'Contact','attributes':_0x166016,'include':[{'model':db[_0x15fd('0x7a')],'as':'Company','attributes':['id',_0x15fd('0x18')]}]},{'model':db[_0x15fd('0x7c')],'as':_0x15fd('0x7d'),'attributes':['id',_0x15fd('0x18')]},{'model':db['VoiceQueue'],'as':_0x15fd('0x80'),'attributes':['id',_0x15fd('0x18'),_0x15fd('0x81')]}]})[_0x15fd('0x3a')](function(_0x4accfd){if(_0x4accfd){return _0x4accfd[_0x15fd('0xc')]({'UserId':_0x54ab7d},{'transaction':_0x1d529d});}});});})[_0x15fd('0x3a')](handleEntityNotFound(_0x279bc1,null))['then'](respondWithResult(_0x279bc1,null))[_0x15fd('0x42')](handleError(_0x279bc1,null));};exports[_0x15fd('0x82')]=function(_0x128ee3,_0x57089a){return _0x128ee3[_0x15fd('0x53')][_0x15fd('0x64')]({'where':{'type':_0x15fd('0x65'),'dialActive':!![],'dialMethod':_0x15fd('0x66')},'attributes':['id'],'raw':!![]})[_0x15fd('0x3a')](function(_0x2d24a2){if(_0x2d24a2&&_0x2d24a2[_0x15fd('0x40')]){return db[_0x15fd('0x12')][_0x15fd('0x7')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x15fd('0x55')](_0x15fd('0x69'))},'VoiceQueueId':{'$in':_[_0x15fd('0x11')](_0x2d24a2,'id')},'$or':[{'UserId':null},{'UserId':_0x128ee3['user']['id']}]}});}return 0x0;})[_0x15fd('0x3a')](function(_0x399962){if(!_[_0x15fd('0x5c')](_0x399962)&&_[_0x15fd('0x83')](_0x399962)){return _0x57089a[_0x15fd('0x9')](0xc8)['json']({'contacts':_0x399962});}else{logger['error'](_0x15fd('0x84'),_0x15fd('0x82'),0x194,_0x15fd('0x85'));_0x57089a[_0x15fd('0xd')](0x194);}})[_0x15fd('0x42')](handleError(_0x57089a,null));};exports[_0x15fd('0x86')]=function(_0xd13be0,_0x27c8b4){var _0x132613=shared['timezones'];var _0x2bea72=[];_[_0x15fd('0x11')](_0x132613,function(_0x573a5a){_0x2bea72[_0x15fd('0x87')]({'id':_0x573a5a[_0x15fd('0x18')],'name':_0x573a5a[_0x15fd('0x18')],'utcOffset':_0x573a5a[_0x15fd('0x88')]});});return _0x27c8b4['status'](0xc8)[_0x15fd('0x4')]({'tz':_0x2bea72});};exports[_0x15fd('0x89')]=function(_0x4be4bb,_0x47529c){var _0x1b5407=shared[_0x15fd('0x8a')];var _0x5e3696={};if(!_[_0x15fd('0x5c')](_0x1b5407[_0x4be4bb[_0x15fd('0x44')]['id']]))_0x5e3696=_0x1b5407[_0x4be4bb[_0x15fd('0x44')]['id']];return _0x47529c[_0x15fd('0x9')](0xc8)[_0x15fd('0x4')](_0x5e3696);}; \ No newline at end of file +var _0xd6d6=['membername','user','UserId','deletedat','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','format','YYYY-MM-DD\x20HH:mm:ss','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','CmCompany','List','dialActive','recallme','CmList','getOpenContacts','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','update','then','sendStatus','stack','name','send','CmHopper','fieldName','type','key','model','map','query','keys','filters','intersection','concat','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$contained','$any','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','findAll','rows','catch','show','rawAttributes','includeAll','include','options','create','body','find','params','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign'];(function(_0x27fd73,_0x362399){var _0x6abb0b=function(_0x4e259c){while(--_0x4e259c){_0x27fd73['push'](_0x27fd73['shift']());}};_0x6abb0b(++_0x362399);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x3e7870,_0x243a87){_0x3e7870=_0x3e7870-0x0;var _0x120f8c=_0xd6d6[_0x3e7870];return _0x120f8c;};'use strict';var moment=require(_0x6d6d('0x0'));var _=require(_0x6d6d('0x1'));var qs=require(_0x6d6d('0x2'));var logger=require(_0x6d6d('0x3'))('api');var shared=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];function respondWithResult(_0x1b8610,_0x2a838a){_0x2a838a=_0x2a838a||0xc8;return function(_0x5207c9){if(_0x5207c9){return _0x1b8610[_0x6d6d('0x6')](_0x2a838a)[_0x6d6d('0x7')](_0x5207c9);}};}function respondWithFilteredResult(_0x5702dc,_0x210ff7){return function(_0x1bf731){if(_0x1bf731){var _0x44f83d=typeof _0x210ff7[_0x6d6d('0x8')]===_0x6d6d('0x9')&&typeof _0x210ff7[_0x6d6d('0xa')]===_0x6d6d('0x9');var _0x51585f=_0x1bf731['count'];var _0x404c88=_0x44f83d?0x0:_0x210ff7[_0x6d6d('0x8')];var _0x23b18a=_0x44f83d?_0x1bf731[_0x6d6d('0xb')]:_0x210ff7[_0x6d6d('0x8')]+_0x210ff7['limit'];var _0x1f2b86;if(_0x23b18a>=_0x51585f){_0x23b18a=_0x51585f;_0x1f2b86=0xc8;}else{_0x1f2b86=0xce;}_0x5702dc[_0x6d6d('0x6')](_0x1f2b86);return _0x5702dc['set']('Content-Range',_0x404c88+'-'+_0x23b18a+'/'+_0x51585f)[_0x6d6d('0x7')](_0x1bf731);}return null;};}function saveUpdates(_0x32146d,_0xe61c36){return function(_0x3f8542){if(_0x3f8542){return _0x3f8542[_0x6d6d('0xc')](_0x32146d)[_0x6d6d('0xd')](function(_0x19cf50){return _0x19cf50;});}return null;};}function handleEntityNotFound(_0x2cb2dd,_0x5f4154){return function(_0xd09ea7){if(!_0xd09ea7){_0x2cb2dd[_0x6d6d('0xe')](0x194);}return _0xd09ea7;};}function handleError(_0x1f2aac,_0xa3b05d){_0xa3b05d=_0xa3b05d||0x1f4;return function(_0x29cbd8){logger['error'](_0x29cbd8[_0x6d6d('0xf')]);if(_0x29cbd8['name']){delete _0x29cbd8[_0x6d6d('0x10')];}_0x1f2aac[_0x6d6d('0x6')](_0xa3b05d)[_0x6d6d('0x11')](_0x29cbd8);};}exports['index']=function(_0x499c2e,_0x9e1e18){var _0x1a75d8={},_0x2b59d4={},_0x2c5314={'count':0x0,'rows':[]};var _0x51fff6=_['map'](db[_0x6d6d('0x12')]['rawAttributes'],function(_0x26f631){return{'name':_0x26f631[_0x6d6d('0x13')],'type':_0x26f631[_0x6d6d('0x14')][_0x6d6d('0x15')]};});_0x2b59d4[_0x6d6d('0x16')]=_[_0x6d6d('0x17')](_0x51fff6,_0x6d6d('0x10'));_0x2b59d4[_0x6d6d('0x18')]=_[_0x6d6d('0x19')](_0x499c2e[_0x6d6d('0x18')]);_0x2b59d4[_0x6d6d('0x1a')]=_[_0x6d6d('0x1b')](_0x2b59d4[_0x6d6d('0x16')],_0x2b59d4[_0x6d6d('0x18')]);_0x2b59d4[_0x6d6d('0x1a')]=_[_0x6d6d('0x1c')](_0x2b59d4[_0x6d6d('0x1a')],['$and',_0x6d6d('0x1d'),_0x6d6d('0x1e'),_0x6d6d('0x1f'),_0x6d6d('0x20'),_0x6d6d('0x21'),_0x6d6d('0x22'),'$eq',_0x6d6d('0x23'),_0x6d6d('0x24'),_0x6d6d('0x25'),_0x6d6d('0x26'),_0x6d6d('0x27'),_0x6d6d('0x28'),_0x6d6d('0x29'),'$iLike',_0x6d6d('0x2a'),_0x6d6d('0x28'),'$overlap','$contains',_0x6d6d('0x2b'),_0x6d6d('0x2c')]);_0x1a75d8[_0x6d6d('0x2d')]=_['intersection'](_0x2b59d4[_0x6d6d('0x16')],qs[_0x6d6d('0x2e')](_0x499c2e[_0x6d6d('0x18')][_0x6d6d('0x2e')]));_0x1a75d8[_0x6d6d('0x2d')]=_0x1a75d8[_0x6d6d('0x2d')][_0x6d6d('0x2f')]?_0x1a75d8[_0x6d6d('0x2d')]:_0x2b59d4[_0x6d6d('0x16')];if(!_0x499c2e[_0x6d6d('0x18')]['hasOwnProperty'](_0x6d6d('0x30'))){_0x1a75d8['limit']=qs[_0x6d6d('0xa')](_0x499c2e[_0x6d6d('0x18')][_0x6d6d('0xa')]);_0x1a75d8[_0x6d6d('0x8')]=qs['offset'](_0x499c2e[_0x6d6d('0x18')]['offset']);}_0x1a75d8[_0x6d6d('0x31')]=qs[_0x6d6d('0x32')](_0x499c2e['query'][_0x6d6d('0x32')]);_0x1a75d8[_0x6d6d('0x33')]=qs[_0x6d6d('0x1a')](_[_0x6d6d('0x34')](_0x499c2e[_0x6d6d('0x18')],_0x2b59d4[_0x6d6d('0x1a')]),_0x51fff6);if(_0x499c2e[_0x6d6d('0x18')][_0x6d6d('0x35')]){_0x1a75d8[_0x6d6d('0x33')]=_[_0x6d6d('0x36')](_0x1a75d8[_0x6d6d('0x33')],{'$or':_[_0x6d6d('0x17')](_0x51fff6,function(_0x17d863){if(_0x17d863[_0x6d6d('0x14')]!=='VIRTUAL'){var _0x1335ef={};_0x1335ef[_0x17d863[_0x6d6d('0x10')]]={'$like':'%'+_0x499c2e[_0x6d6d('0x18')][_0x6d6d('0x35')]+'%'};return _0x1335ef;}})});}_0x1a75d8=_['merge']({},_0x1a75d8,_0x499c2e['options']);var _0x3726ba={'where':_0x1a75d8[_0x6d6d('0x33')]};return db[_0x6d6d('0x12')]['count'](_0x3726ba)[_0x6d6d('0xd')](function(_0x2607c1){_0x2c5314[_0x6d6d('0xb')]=_0x2607c1;if(_0x499c2e[_0x6d6d('0x18')]['includeAll']){_0x1a75d8['include']=[{'all':!![]}];}return db['CmHopper'][_0x6d6d('0x37')](_0x1a75d8);})[_0x6d6d('0xd')](function(_0x33c8f2){_0x2c5314[_0x6d6d('0x38')]=_0x33c8f2;return _0x2c5314;})['then'](respondWithFilteredResult(_0x9e1e18,_0x1a75d8))[_0x6d6d('0x39')](handleError(_0x9e1e18,null));};exports[_0x6d6d('0x3a')]=function(_0x344f6f,_0x3c6d23){var _0x3d632c={'raw':!![],'where':{'id':_0x344f6f['params']['id']}},_0x38ae8c={};_0x38ae8c[_0x6d6d('0x16')]=_[_0x6d6d('0x19')](db[_0x6d6d('0x12')][_0x6d6d('0x3b')]);_0x38ae8c[_0x6d6d('0x18')]=_[_0x6d6d('0x19')](_0x344f6f[_0x6d6d('0x18')]);_0x38ae8c['filters']=_[_0x6d6d('0x1b')](_0x38ae8c[_0x6d6d('0x16')],_0x38ae8c[_0x6d6d('0x18')]);_0x3d632c[_0x6d6d('0x2d')]=_[_0x6d6d('0x1b')](_0x38ae8c['model'],qs[_0x6d6d('0x2e')](_0x344f6f[_0x6d6d('0x18')]['fields']));_0x3d632c[_0x6d6d('0x2d')]=_0x3d632c['attributes'][_0x6d6d('0x2f')]?_0x3d632c[_0x6d6d('0x2d')]:_0x38ae8c['model'];if(_0x344f6f[_0x6d6d('0x18')][_0x6d6d('0x3c')]){_0x3d632c[_0x6d6d('0x3d')]=[{'all':!![]}];}_0x3d632c=_[_0x6d6d('0x36')]({},_0x3d632c,_0x344f6f[_0x6d6d('0x3e')]);return db['CmHopper']['find'](_0x3d632c)[_0x6d6d('0xd')](handleEntityNotFound(_0x3c6d23,null))['then'](respondWithResult(_0x3c6d23,null))['catch'](handleError(_0x3c6d23,null));};exports[_0x6d6d('0x3f')]=function(_0x3e4d6c,_0x2f236a){return db['CmHopper'][_0x6d6d('0x3f')](_0x3e4d6c['body'],{})[_0x6d6d('0xd')](respondWithResult(_0x2f236a,0xc9))[_0x6d6d('0x39')](handleError(_0x2f236a,null));};exports[_0x6d6d('0xc')]=function(_0x4606eb,_0x75f298){if(_0x4606eb[_0x6d6d('0x40')]['id']){delete _0x4606eb[_0x6d6d('0x40')]['id'];}return db['CmHopper'][_0x6d6d('0x41')]({'where':{'id':_0x4606eb[_0x6d6d('0x42')]['id']}})[_0x6d6d('0xd')](handleEntityNotFound(_0x75f298,null))[_0x6d6d('0xd')](saveUpdates(_0x4606eb[_0x6d6d('0x40')],null))[_0x6d6d('0xd')](respondWithResult(_0x75f298,null))[_0x6d6d('0x39')](handleError(_0x75f298,null));};exports[_0x6d6d('0x43')]=function(_0x24cec2,_0x5e4c04){return db['CmHopper'][_0x6d6d('0x43')]()[_0x6d6d('0xd')](respondWithResult(_0x5e4c04,null))[_0x6d6d('0x39')](handleError(_0x5e4c04,null));};exports[_0x6d6d('0x44')]=function(_0xe2a20e,_0x492834){var _0x47170d;var _0x27b396=_0xe2a20e[_0x6d6d('0x42')]['id'];return db[_0x6d6d('0x12')][_0x6d6d('0x41')]({'where':{'id':_0xe2a20e[_0x6d6d('0x42')]['id']}})[_0x6d6d('0xd')](handleEntityNotFound(_0x492834,null))[_0x6d6d('0xd')](function(_0x442be8){if(_0x442be8){return _0x442be8[_0x6d6d('0x44')]()[_0x6d6d('0xd')](function(_0x175e26){return _0x175e26;});}})['then'](function(_0x190786){_0x47170d=_0x190786;if(_0x190786){if(_0x190786[_0x6d6d('0x45')]||_0x190786[_0x6d6d('0x46')]){return db[_0x190786[_0x6d6d('0x45')]?_0x6d6d('0x47'):'Campaign'][_0x6d6d('0x41')]({'where':{'id':_0x190786[_0x6d6d('0x45')]?_0x190786[_0x6d6d('0x45')]:_0x190786['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x6d6d('0xd')](function(_0x50042e){var _0x3ea57e={};if(_0x50042e){_[_0x6d6d('0x36')](_0x3ea57e,_[_0x6d6d('0x48')](_0x47170d[_0x6d6d('0x49')],[_0x6d6d('0x4a'),_0x6d6d('0x4b'),'id']));_0x3ea57e[_0x6d6d('0x4c')]=0x15;_0x3ea57e[_0x6d6d('0x4d')]=_0x6d6d('0x4e');_0x3ea57e[_0x6d6d('0x4f')]=_0x50042e['name'];_0x3ea57e[_0x6d6d('0x50')]=_0xe2a20e[_0x6d6d('0x51')][_0x6d6d('0x10')];_0x3ea57e[_0x6d6d('0x52')]=_0xe2a20e[_0x6d6d('0x51')]['id'];_0x3ea57e[_0x6d6d('0x4e')]=!![];_0x3ea57e[_0x6d6d('0x53')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3ea57e[_0x6d6d('0x54')]=_0x47170d[_0x6d6d('0x55')];_0x3ea57e['campaigntype']=_0x47170d[_0x6d6d('0x45')]?_0x6d6d('0x56'):_0x6d6d('0x57');return db[_0x6d6d('0x58')][_0x6d6d('0x41')]({'where':{'id':_0x3ea57e[_0x6d6d('0x59')]},'attributes':[_0x6d6d('0x5a'),_0x6d6d('0x5b')]})[_0x6d6d('0xd')](function(_0x36f37a){if(!_[_0x6d6d('0x5c')](_0x492834)&&!_[_0x6d6d('0x5c')](_0x36f37a[_0x6d6d('0x5a')])){_0x3ea57e[_0x6d6d('0x5d')]=_0x36f37a[_0x6d6d('0x5a')];if(!_['isNil'](_0x36f37a[_0x6d6d('0x5b')])){_0x3ea57e[_0x6d6d('0x5d')]+='\x20'+_0x36f37a['lastName'];}}})[_0x6d6d('0x5e')](function(){return db[_0x6d6d('0x5f')][_0x6d6d('0x3f')](_0x3ea57e);});}})[_0x6d6d('0xd')](function(_0x2d61cc){return db[_0x6d6d('0x60')][_0x6d6d('0x44')]({'where':{'CmHopperId':_0x27b396}});})[_0x6d6d('0xd')](function(){return _0x492834[_0x6d6d('0x6')](0xcc)['end']();})['catch'](handleError(_0x492834,null));};exports[_0x6d6d('0x61')]=function(_0x325fe2,_0x3a20ea){var _0x5de33f=[];return db['CmContact'][_0x6d6d('0x43')]()['then'](function(_0x30badc){_0x5de33f=_['keys'](_0x30badc);return _0x325fe2[_0x6d6d('0x51')][_0x6d6d('0x62')]({'where':{'type':_0x6d6d('0x63'),'dialActive':!![],'dialMethod':_0x6d6d('0x64')},'attributes':['id',_0x6d6d('0x65'),_0x6d6d('0x66')],'raw':!![]});})['then'](function(_0x41e576){if(_0x41e576&&_0x41e576['length']){return db[_0x6d6d('0x67')]['transaction'](function(_0x2a21d8){var _0x3e48f7={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6d6d('0x68')](_0x6d6d('0x69'))},'VoiceQueueId':{'$in':_[_0x6d6d('0x17')](_0x41e576,'id')},'$or':[{'UserId':null},{'UserId':_0x325fe2[_0x6d6d('0x51')]['id']}]};var _0x23d950={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x41e576)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x6d6d('0x17')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x325fe2[_0x6d6d('0x51')]['id']}]};var _0x53b77a={'$or':[_0x3e48f7,_0x23d950]};var _0xe19d23=[];if(_0x325fe2[_0x6d6d('0x40')][_0x6d6d('0x6a')]&&_0x325fe2[_0x6d6d('0x40')][_0x6d6d('0x6a')]===_0x6d6d('0x6b')){if(!_['isEmpty'](_0x325fe2[_0x6d6d('0x40')][_0x6d6d('0x6c')])){_0x53b77a['id']={'$in':_0x325fe2[_0x6d6d('0x40')][_0x6d6d('0x6c')]};}_0xe19d23=[[_0x6d6d('0x6d'),_0x6d6d('0x6e')],[_0x6d6d('0x6f'),_0x41e576[0x0]['dialOrderByScheduledAt']===_0x6d6d('0x6e')?_0x6d6d('0x70'):_0x6d6d('0x6e')],db[_0x6d6d('0x67')][_0x6d6d('0x71')](_0x6d6d('0x72')),['id',_0x6d6d('0x70')]];}else{if(!_[_0x6d6d('0x73')](_0x325fe2[_0x6d6d('0x40')][_0x6d6d('0x6c')])){_0x53b77a['id']={'$notIn':_0x325fe2[_0x6d6d('0x40')]['hopperIds']};}_0xe19d23=[['priority',_0x6d6d('0x70')],['scheduledAt',_0x41e576[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x6d6d('0x71')](_0x6d6d('0x74')),['id',_0x6d6d('0x6e')]];}return db[_0x6d6d('0x12')][_0x6d6d('0x75')]({'attributes':['id',_0x6d6d('0x76'),'phone','recallme'],'where':_0x53b77a,'order':_0xe19d23,'transaction':_0x2a21d8,'lock':_0x2a21d8[_0x6d6d('0x77')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x5de33f,'include':[{'model':db[_0x6d6d('0x78')],'as':'Company','attributes':['id',_0x6d6d('0x10')]}]},{'model':db['CmList'],'as':_0x6d6d('0x79'),'attributes':['id',_0x6d6d('0x10')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x6d6d('0x10'),_0x6d6d('0x7a')]}]})[_0x6d6d('0xd')](function(_0x36bdfd){if(_0x36bdfd){return _0x36bdfd['update']({'UserId':_0x325fe2[_0x6d6d('0x51')]['id']},{'transaction':_0x2a21d8});}});});}})[_0x6d6d('0xd')](handleEntityNotFound(_0x3a20ea,null))[_0x6d6d('0xd')](respondWithResult(_0x3a20ea,null))[_0x6d6d('0x39')](handleError(_0x3a20ea,null));};exports['getPreviewRecall']=function(_0x19fcfd,_0x5d7606,_0x4b6594){var _0x580001=[];var _0x3da125=_0x19fcfd['params']['id'];var _0x342b26=_0x19fcfd[_0x6d6d('0x51')]['id'];return db[_0x6d6d('0x58')]['describe']()['then'](function(_0x55d877){_0x580001=_[_0x6d6d('0x19')](_0x55d877);return db['sequelize']['transaction'](function(_0x24684a){const _0x22b759={'id':_0x3da125};return db[_0x6d6d('0x12')][_0x6d6d('0x75')]({'attributes':['id',_0x6d6d('0x76'),_0x6d6d('0x7b')],'where':_0x22b759,'transaction':_0x24684a,'lock':_0x24684a[_0x6d6d('0x77')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x580001,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db[_0x6d6d('0x7c')],'as':_0x6d6d('0x79'),'attributes':['id',_0x6d6d('0x10')]},{'model':db[_0x6d6d('0x47')],'as':'Queue','attributes':['id','name','dialActive']}]})[_0x6d6d('0xd')](function(_0xfbad7a){if(_0xfbad7a){return _0xfbad7a[_0x6d6d('0xc')]({'UserId':_0x342b26},{'transaction':_0x24684a});}});});})[_0x6d6d('0xd')](handleEntityNotFound(_0x5d7606,null))['then'](respondWithResult(_0x5d7606,null))['catch'](handleError(_0x5d7606,null));};exports[_0x6d6d('0x7d')]=function(_0x1e1c4e,_0x478ed4){return _0x1e1c4e[_0x6d6d('0x51')][_0x6d6d('0x62')]({'where':{'type':_0x6d6d('0x63'),'dialActive':!![],'dialMethod':_0x6d6d('0x64')},'attributes':['id'],'raw':!![]})[_0x6d6d('0xd')](function(_0x581027){if(_0x581027&&_0x581027[_0x6d6d('0x2f')]){return db['CmHopper'][_0x6d6d('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x6d6d('0x69'))},'VoiceQueueId':{'$in':_['map'](_0x581027,'id')},'$or':[{'UserId':null},{'UserId':_0x1e1c4e[_0x6d6d('0x51')]['id']}]}});}return 0x0;})[_0x6d6d('0xd')](function(_0x1c51fc){if(!_[_0x6d6d('0x5c')](_0x1c51fc)&&_[_0x6d6d('0x7e')](_0x1c51fc)){return _0x478ed4[_0x6d6d('0x6')](0xc8)[_0x6d6d('0x7')]({'contacts':_0x1c51fc});}else{logger[_0x6d6d('0x7f')](_0x6d6d('0x80'),_0x6d6d('0x7d'),0x194,_0x6d6d('0x81'));_0x478ed4[_0x6d6d('0xe')](0x194);}})[_0x6d6d('0x39')](handleError(_0x478ed4,null));};exports[_0x6d6d('0x82')]=function(_0x227066,_0x1ee7b2){var _0x5b5fc2=shared['timezones'];var _0x139b61=[];_['map'](_0x5b5fc2,function(_0x3327a5){_0x139b61[_0x6d6d('0x83')]({'id':_0x3327a5['name'],'name':_0x3327a5['name'],'utcOffset':_0x3327a5[_0x6d6d('0x84')]});});return _0x1ee7b2['status'](0xc8)[_0x6d6d('0x7')]({'tz':_0x139b61});};exports[_0x6d6d('0x85')]=function(_0x1e867f,_0x86285c){var _0x438b67=shared[_0x6d6d('0x86')];var _0x3b7bdd={};if(!_[_0x6d6d('0x5c')](_0x438b67[_0x1e867f['body']['id']]))_0x3b7bdd=_0x438b67[_0x1e867f[_0x6d6d('0x40')]['id']];return _0x86285c[_0x6d6d('0x6')](0xc8)[_0x6d6d('0x7')](_0x3b7bdd);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index b7bc0ca..e4ab145 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 _0xdbf5=['define','CmHopper','cm_hopper','scheduledat','phone','priority','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x440559,_0x3e3da2){var _0x56c7e7=function(_0x322c32){while(--_0x322c32){_0x440559['push'](_0x440559['shift']());}};_0x56c7e7(++_0x3e3da2);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2bdfa8,_0xeb7c51){_0x2bdfa8=_0x2bdfa8-0x0;var _0x201b23=_0xdbf5[_0x2bdfa8];return _0x201b23;};'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'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x5dbf('0xc')]},{'name':'phone','fields':[_0x5dbf('0xd')]},{'name':_0x5dbf('0xe'),'fields':[_0x5dbf('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x4975,0x86));var _0x5497=function(_0x1ec721,_0x3853fa){_0x1ec721=_0x1ec721-0x0;var _0x2647e7=_0x4975[_0x1ec721];return _0x2647e7;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['scheduledat']},{'name':_0x5497('0xe'),'fields':['phone']},{'name':_0x5497('0xf'),'fields':[_0x5497('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 1b9d699..f5175d3 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 _0x8a31=['voicePause','List','CmHopperHandlePreviewRecallNotifications','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','include','map','model','info','debug','stringify','catch','error','message','ShowCmHopper','find','raw','then','CreateCmHopper','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','LOCK','UPDATE','CmContact','Contact','User','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','create','MoveContactManagedDialer','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','order','GetCmHopperPreview','keys','GetContactByPhone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Agent','name'];(function(_0x4530db,_0x2e7747){var _0x5b9547=function(_0x10b0da){while(--_0x10b0da){_0x4530db['push'](_0x4530db['shift']());}};_0x5b9547(++_0x2e7747);}(_0x8a31,0xa1));var _0x18a3=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x8a31[_0x2ec461];return _0x28603d;};'use strict';var _=require('lodash');var util=require(_0x18a3('0x0'));var moment=require(_0x18a3('0x1'));var BPromise=require(_0x18a3('0x2'));var db=require(_0x18a3('0x3'))['db'];var logger=require('../../config/logger')(_0x18a3('0x4'));exports[_0x18a3('0x5')]=function(_0x417bc1){var _0x3ffbdc=this;return new Promise(function(_0x5e7551,_0x5bd5fb){return db[_0x18a3('0x6')][_0x18a3('0x7')]({'raw':_0x417bc1[_0x18a3('0x8')]?_0x417bc1[_0x18a3('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x417bc1[_0x18a3('0x8')]?_0x417bc1[_0x18a3('0x8')][_0x18a3('0x9')]||null:null,'attributes':_0x417bc1[_0x18a3('0x8')]?_0x417bc1[_0x18a3('0x8')][_0x18a3('0xa')]||null:null,'limit':_0x417bc1[_0x18a3('0x8')]?_0x417bc1[_0x18a3('0x8')][_0x18a3('0xb')]||null:null,'include':_0x417bc1[_0x18a3('0x8')]?_0x417bc1[_0x18a3('0x8')][_0x18a3('0xc')]?_[_0x18a3('0xd')](_0x417bc1[_0x18a3('0x8')][_0x18a3('0xc')],function(_0x2b435a){return{'model':db[_0x2b435a['model']],'as':_0x2b435a['as'],'attributes':_0x2b435a[_0x18a3('0xa')],'include':_0x2b435a[_0x18a3('0xc')]?_[_0x18a3('0xd')](_0x2b435a[_0x18a3('0xc')],function(_0x3caae9){return{'model':db[_0x3caae9[_0x18a3('0xe')]],'as':_0x3caae9['as'],'attributes':_0x3caae9[_0x18a3('0xa')],'include':_0x3caae9[_0x18a3('0xc')]?_[_0x18a3('0xd')](_0x3caae9['include'],function(_0x280fdb){return{'model':db[_0x280fdb['model']],'as':_0x280fdb['as'],'attributes':_0x280fdb[_0x18a3('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x452f99){logger[_0x18a3('0xf')](_0x18a3('0x5'),_0x417bc1);logger[_0x18a3('0x10')](_0x18a3('0x5'),_0x417bc1,JSON[_0x18a3('0x11')](_0x452f99));_0x5e7551(_0x452f99);})[_0x18a3('0x12')](function(_0x35e6b6){logger[_0x18a3('0x13')](_0x18a3('0x5'),_0x35e6b6[_0x18a3('0x14')],_0x417bc1);_0x5bd5fb(_0x3ffbdc[_0x18a3('0x13')](0x1f4,_0x35e6b6[_0x18a3('0x14')]));});});};exports[_0x18a3('0x15')]=function(_0x21eb1c){var _0xc454b1=this;return new Promise(function(_0x50a642,_0x528994){return db[_0x18a3('0x6')][_0x18a3('0x16')]({'raw':_0x21eb1c['options']?_0x21eb1c[_0x18a3('0x8')][_0x18a3('0x17')]===undefined?!![]:![]:!![],'where':_0x21eb1c[_0x18a3('0x8')]?_0x21eb1c[_0x18a3('0x8')]['where']||null:null,'attributes':_0x21eb1c['options']?_0x21eb1c[_0x18a3('0x8')][_0x18a3('0xa')]||null:null,'include':_0x21eb1c[_0x18a3('0x8')]?_0x21eb1c[_0x18a3('0x8')]['include']?_[_0x18a3('0xd')](_0x21eb1c[_0x18a3('0x8')][_0x18a3('0xc')],function(_0x516da6){return{'model':db[_0x516da6['model']],'as':_0x516da6['as'],'attributes':_0x516da6[_0x18a3('0xa')],'include':_0x516da6['include']?_[_0x18a3('0xd')](_0x516da6[_0x18a3('0xc')],function(_0x3552d8){return{'model':db[_0x3552d8[_0x18a3('0xe')]],'as':_0x3552d8['as'],'attributes':_0x3552d8[_0x18a3('0xa')],'include':_0x3552d8['include']?_[_0x18a3('0xd')](_0x3552d8[_0x18a3('0xc')],function(_0x51a8c2){return{'model':db[_0x51a8c2['model']],'as':_0x51a8c2['as'],'attributes':_0x51a8c2[_0x18a3('0xa')]};}):[]};}):[]};}):[]:[]})[_0x18a3('0x18')](function(_0x47cac8){logger[_0x18a3('0xf')](_0x18a3('0x15'),_0x21eb1c);logger[_0x18a3('0x10')](_0x18a3('0x15'),_0x21eb1c,JSON[_0x18a3('0x11')](_0x47cac8));_0x50a642(_0x47cac8);})[_0x18a3('0x12')](function(_0x25a455){logger['error'](_0x18a3('0x15'),_0x25a455[_0x18a3('0x14')],_0x21eb1c);_0x528994(_0xc454b1[_0x18a3('0x13')](0x1f4,_0x25a455[_0x18a3('0x14')]));});});};exports['CreateCmHopper']=function(_0x4d0f30){var _0x2ec945=this;return new Promise(function(_0x28d92f,_0x262534){return db[_0x18a3('0x6')]['create'](_0x4d0f30['body'],{'raw':_0x4d0f30[_0x18a3('0x8')]?_0x4d0f30[_0x18a3('0x8')][_0x18a3('0x17')]===undefined?!![]:![]:!![]})[_0x18a3('0x18')](function(_0x5cedcd){logger['info'](_0x18a3('0x19'),_0x4d0f30);logger[_0x18a3('0x10')]('CreateCmHopper',_0x4d0f30,JSON[_0x18a3('0x11')](_0x5cedcd));_0x28d92f(_0x5cedcd);})[_0x18a3('0x12')](function(_0x20f77c){logger[_0x18a3('0x13')]('CreateCmHopper',_0x20f77c[_0x18a3('0x14')],_0x4d0f30);_0x262534(_0x2ec945[_0x18a3('0x13')](0x1f4,_0x20f77c['message']));});});};exports[_0x18a3('0x1a')]=function(_0x4b64a4){var _0x22472a=this;return new Promise(function(_0x536c2b,_0x42f163){return db[_0x18a3('0x6')][_0x18a3('0x1b')](_0x4b64a4[_0x18a3('0x1c')],{'raw':_0x4b64a4[_0x18a3('0x8')]?_0x4b64a4[_0x18a3('0x8')][_0x18a3('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b64a4[_0x18a3('0x8')]?_0x4b64a4[_0x18a3('0x8')]['where']||null:null,'attributes':_0x4b64a4[_0x18a3('0x8')]?_0x4b64a4['options'][_0x18a3('0xa')]||null:null,'limit':_0x4b64a4['options']?_0x4b64a4[_0x18a3('0x8')]['limit']||null:null})[_0x18a3('0x18')](function(_0x4bbc3d){logger['info']('UpdateCmHopper',_0x4b64a4);logger[_0x18a3('0xf')](_0x18a3('0x1d'),JSON['stringify'](_0x4b64a4[_0x18a3('0x8')][_0x18a3('0x9')]),_0x4b64a4[_0x18a3('0x1c')][_0x18a3('0x1e')]);logger['debug'](_0x18a3('0x1a'),_0x4b64a4,JSON[_0x18a3('0x11')](_0x4bbc3d));_0x536c2b(_0x4bbc3d);})[_0x18a3('0x12')](function(_0x59a8e7){logger[_0x18a3('0x13')](_0x18a3('0x1a'),_0x59a8e7['message'],_0x4b64a4);_0x42f163(_0x22472a[_0x18a3('0x13')](0x1f4,_0x59a8e7[_0x18a3('0x14')]));});});};exports[_0x18a3('0x1f')]=function(_0x225bdd){var _0xc960c=this;return new Promise(function(_0x461a8b,_0x22a950){return db['CmHopper'][_0x18a3('0x20')]({'where':_0x225bdd['options']?_0x225bdd[_0x18a3('0x8')]['where']||null:null})[_0x18a3('0x18')](function(_0x241a6e){logger[_0x18a3('0xf')](_0x18a3('0x1f'),_0x225bdd);logger[_0x18a3('0x10')]('DestroyCmHopper',_0x225bdd,JSON[_0x18a3('0x11')](_0x241a6e));_0x461a8b(_0x241a6e);})[_0x18a3('0x12')](function(_0x8cb3e2){logger[_0x18a3('0x13')](_0x18a3('0x1f'),_0x8cb3e2['message'],_0x225bdd);_0x22a950(_0xc960c[_0x18a3('0x13')](0x1f4,_0x8cb3e2[_0x18a3('0x14')]));});});};exports[_0x18a3('0x21')]=function(_0x5903ce){var _0x50bdb1=this;return new Promise(function(_0x55d370,_0x147099){return db['CmContact'][_0x18a3('0x22')]()[_0x18a3('0x18')](function(_0x59181a){return db[_0x18a3('0x23')][_0x18a3('0x24')](function(_0xcc1e6b){return db[_0x18a3('0x6')][_0x18a3('0x7')]({'where':_0x5903ce[_0x18a3('0x8')]?_0x5903ce[_0x18a3('0x8')]['where']||null:null,'attributes':_0x5903ce[_0x18a3('0x8')]?_0x5903ce[_0x18a3('0x8')]['attributes']||null:null,'limit':_0x5903ce[_0x18a3('0x8')]?_0x5903ce[_0x18a3('0x8')][_0x18a3('0xb')]||null:null,'order':_0x5903ce[_0x18a3('0x8')]?_0x5903ce[_0x18a3('0x8')]['order']||null:null,'transaction':_0xcc1e6b,'lock':_0xcc1e6b[_0x18a3('0x25')][_0x18a3('0x26')],'include':[{'model':db[_0x18a3('0x27')],'as':_0x18a3('0x28'),'attributes':_['keys'](_0x59181a)},{'model':db[_0x18a3('0x29')],'as':'Agent','attributes':['id','name','voicePause']}]})['then'](function(_0x410946){var _0x57418e=[];var _0x40191a=[];for(var _0x5603cb=0x0;_0x5603cb<_0x410946[_0x18a3('0x2a')];_0x5603cb+=0x1){var _0xec398f=_0x410946[_0x5603cb][_0x18a3('0x2b')];if(_0xec398f===null){_0x57418e[_0x18a3('0x2c')](_0x410946[_0x5603cb][_0x18a3('0x1b')](_0x5903ce[_0x18a3('0x1c')],{'transaction':_0xcc1e6b}));}else if(!_0x40191a[_0x18a3('0x2d')](_0xec398f)){_0x40191a[_0x18a3('0x2c')](_0xec398f);_0x57418e['push'](_0x410946[_0x5603cb][_0x18a3('0x1b')](_0x5903ce[_0x18a3('0x1c')],{'transaction':_0xcc1e6b}));}}return BPromise[_0x18a3('0x2e')](_0x57418e);});})[_0x18a3('0x18')](function(_0x8687a9){logger['info'](_0x18a3('0x21'),_0x5903ce);if(_0x8687a9[_0x18a3('0x2a')]>0x0){logger[_0x18a3('0xf')](_0x18a3('0x2f'),_0x8687a9[0x0][_0x18a3('0x30')]['id'],_0x8687a9[0x0][_0x18a3('0x30')]['ContactId'],_0x8687a9[0x0][_0x18a3('0x30')][_0x18a3('0x1e')]);}logger[_0x18a3('0x10')]('GetContactDialer',_0x5903ce,JSON['stringify'](_0x8687a9));_0x55d370(_0x8687a9);})[_0x18a3('0x12')](function(_0x18b1f2){logger['error']('GetContactDialer',_0x18b1f2[_0x18a3('0x14')],_0x5903ce);_0x147099(_0x50bdb1[_0x18a3('0x13')](0x1f4,_0x18b1f2[_0x18a3('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x3fd2a7){var _0x899998=this;return new Promise(function(_0x5040a7,_0x22eded){return db[_0x18a3('0x23')][_0x18a3('0x24')](function(_0x441d80){return db['CmHopperFinal'][_0x18a3('0x31')](_0x3fd2a7[_0x18a3('0x1c')],{'raw':_0x3fd2a7['options']?_0x3fd2a7[_0x18a3('0x8')][_0x18a3('0x17')]===undefined?!![]:![]:!![],'transaction':_0x441d80})[_0x18a3('0x18')](function(){logger[_0x18a3('0xf')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x18a3('0x11')](_0x3fd2a7[_0x18a3('0x8')][_0x18a3('0x9')]),_0x3fd2a7['options'][_0x18a3('0x9')][_0x18a3('0x1e')]);return db[_0x18a3('0x6')][_0x18a3('0x20')]({'where':_0x3fd2a7[_0x18a3('0x8')]?_0x3fd2a7[_0x18a3('0x8')][_0x18a3('0x9')]||null:null,'transaction':_0x441d80});});})[_0x18a3('0x18')](function(_0x507ccd){logger[_0x18a3('0xf')]('MoveContactManagedDialer',_0x3fd2a7);logger[_0x18a3('0x10')](_0x18a3('0x32'),_0x3fd2a7,JSON[_0x18a3('0x11')](_0x507ccd));_0x5040a7(_0x507ccd);})[_0x18a3('0x12')](function(_0x1064f6){logger[_0x18a3('0x13')](_0x18a3('0x32'),_0x1064f6[_0x18a3('0x14')],_0x3fd2a7);_0x22eded(_0x899998[_0x18a3('0x13')](0x1f4,_0x1064f6[_0x18a3('0x14')]));});});};exports['CountReScheduled']=function(_0x5910f9){var _0x6460cf=this;return new Promise(function(_0x452320,_0x206580){return db[_0x18a3('0x6')]['findAll']({'raw':_0x5910f9[_0x18a3('0x8')]?_0x5910f9['options'][_0x18a3('0x17')]===undefined?!![]:![]:!![],'where':_0x5910f9['options']?_0x5910f9[_0x18a3('0x8')][_0x18a3('0x9')]||null:null,'attributes':[[db[_0x18a3('0x23')]['fn'](_0x18a3('0x33'),db['sequelize']['fn']('IF',db[_0x18a3('0x23')][_0x18a3('0x34')](_0x18a3('0x35')+util[_0x18a3('0x36')](_0x18a3('0x37'),moment()['format'](_0x18a3('0x38')))+_0x18a3('0x39')))),_0x18a3('0x3a')]]})['then'](function(_0x3718e3){logger['info'](_0x18a3('0x3b'),_0x5910f9);logger[_0x18a3('0x10')]('CountReScheduled',_0x5910f9,JSON['stringify'](_0x3718e3));_0x452320(_0x3718e3);})[_0x18a3('0x12')](function(_0x59d526){logger['error'](_0x18a3('0x3b'),_0x59d526['message'],_0x5910f9);_0x206580(_0x6460cf[_0x18a3('0x13')](0x1f4,_0x59d526[_0x18a3('0x14')]));});});};exports[_0x18a3('0x3c')]=function(_0x545964){var _0x37adba=this;return new Promise(function(_0x540900,_0x612cf1){return db[_0x18a3('0x27')][_0x18a3('0x22')]()['then'](function(){return db[_0x18a3('0x23')][_0x18a3('0x24')](function(_0x4a7903){return db['CmHopper'][_0x18a3('0x7')]({'where':_0x545964[_0x18a3('0x8')]?_0x545964[_0x18a3('0x8')][_0x18a3('0x9')]||null:null,'attributes':_0x545964[_0x18a3('0x8')]?_0x545964[_0x18a3('0x8')][_0x18a3('0xa')]||null:null,'limit':0x1,'order':_0x545964[_0x18a3('0x8')]?_0x545964['options'][_0x18a3('0x3d')]||null:null,'group':db[_0x18a3('0x6')][_0x18a3('0x2b')],'transaction':_0x4a7903,'lock':_0x4a7903[_0x18a3('0x25')][_0x18a3('0x26')],'include':_0x545964[_0x18a3('0x8')]?_0x545964[_0x18a3('0x8')]['include']?_[_0x18a3('0xd')](_0x545964[_0x18a3('0x8')]['include'],function(_0xaa8027){return{'model':db[_0xaa8027[_0x18a3('0xe')]],'as':_0xaa8027['as'],'attributes':_0xaa8027[_0x18a3('0xa')],'include':_0xaa8027['include']?_[_0x18a3('0xd')](_0xaa8027[_0x18a3('0xc')],function(_0x267a2c){return{'model':db[_0x267a2c['model']],'as':_0x267a2c['as'],'attributes':_0x267a2c[_0x18a3('0xa')],'include':_0x267a2c['include']?_[_0x18a3('0xd')](_0x267a2c[_0x18a3('0xc')],function(_0x10cec4){return{'model':db[_0x10cec4[_0x18a3('0xe')]],'as':_0x10cec4['as'],'attributes':_0x10cec4[_0x18a3('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3560d6){var _0x44b4d8=[];for(var _0x2302c0=0x0;_0x2302c0<_0x3560d6[_0x18a3('0x2a')];_0x2302c0+=0x1){_0x44b4d8[_0x18a3('0x2c')](_0x3560d6[_0x2302c0]['update'](_0x545964[_0x18a3('0x1c')],{'transaction':_0x4a7903}));}return BPromise[_0x18a3('0x2e')](_0x44b4d8);});})[_0x18a3('0x18')](function(_0x3ee2f3){logger[_0x18a3('0xf')]('GetContactRecallMe',_0x545964);logger[_0x18a3('0x10')]('GetContactRecallMe',_0x545964,JSON[_0x18a3('0x11')](_0x3ee2f3));_0x540900(_0x3ee2f3);})[_0x18a3('0x12')](function(_0x381786){logger['error'](_0x18a3('0x3c'),_0x381786[_0x18a3('0x14')],_0x545964);_0x612cf1(_0x37adba[_0x18a3('0x13')](0x1f4,_0x381786['message']));});});});};exports[_0x18a3('0x3e')]=function(_0x371659){var _0x280b93=this;return new Promise(function(_0x59699e,_0x170e7e){db[_0x18a3('0x27')][_0x18a3('0x22')]()['then'](function(_0x1e6730){return db[_0x18a3('0x6')]['findAll']({'raw':_0x371659['options']?_0x371659['options']['raw']===undefined?!![]:![]:!![],'where':_0x371659[_0x18a3('0x8')]?_0x371659[_0x18a3('0x8')]['where']||null:null,'attributes':_0x371659[_0x18a3('0x8')]?_0x371659[_0x18a3('0x8')][_0x18a3('0xa')]||null:null,'limit':_0x371659[_0x18a3('0x8')]?_0x371659[_0x18a3('0x8')][_0x18a3('0xb')]||null:null,'include':_0x371659[_0x18a3('0x8')]?_0x371659[_0x18a3('0x8')]['include']?_['map'](_0x371659[_0x18a3('0x8')][_0x18a3('0xc')],function(_0x505fc6){return{'model':db[_0x505fc6['model']],'as':_0x505fc6['as'],'attributes':_0x505fc6['as']===_0x18a3('0x28')?_[_0x18a3('0x3f')](_0x1e6730):_0x505fc6[_0x18a3('0xa')],'include':_0x505fc6['include']?_['map'](_0x505fc6[_0x18a3('0xc')],function(_0x1207d2){return{'model':db[_0x1207d2[_0x18a3('0xe')]],'as':_0x1207d2['as'],'attributes':_0x1207d2['attributes'],'include':_0x1207d2[_0x18a3('0xc')]?_[_0x18a3('0xd')](_0x1207d2[_0x18a3('0xc')],function(_0x57af69){return{'model':db[_0x57af69[_0x18a3('0xe')]],'as':_0x57af69['as'],'attributes':_0x57af69[_0x18a3('0xa')]};}):[]};}):[]};}):[]:[]})[_0x18a3('0x18')](function(_0x4982a4){logger['info'](_0x18a3('0x5'),_0x371659);logger[_0x18a3('0x10')](_0x18a3('0x5'),_0x371659,JSON[_0x18a3('0x11')](_0x4982a4));_0x59699e(_0x4982a4);})[_0x18a3('0x12')](function(_0x56d5f7){logger['error'](_0x18a3('0x5'),_0x56d5f7['message'],_0x371659);_0x170e7e(_0x280b93[_0x18a3('0x13')](0x1f4,_0x56d5f7['message']));});});});};exports[_0x18a3('0x40')]=function(_0x5f573){var _0x55456e=this;return new Promise(function(_0x52a8f3,_0x97895){return db[_0x18a3('0x27')]['findOne']({'raw':!![],'where':{'phone':_0x5f573[_0x18a3('0x8')][_0x18a3('0x9')]['phone']},'attributes':['id',_0x18a3('0x41')],'order':[['id',_0x18a3('0x42')]]})[_0x18a3('0x18')](function(_0x2fb27b){logger['info'](_0x18a3('0x43'),_0x5f573);logger['debug']('getContactByPhone',_0x5f573,JSON['stringify'](_0x2fb27b));_0x52a8f3(_0x2fb27b);})['catch'](function(_0xa8cd76){logger[_0x18a3('0x13')](_0x18a3('0x43'),_0xa8cd76[_0x18a3('0x14')],_0x5f573);_0x97895(_0x55456e[_0x18a3('0x13')](0x1f4,_0xa8cd76[_0x18a3('0x14')]));});});};exports[_0x18a3('0x44')]=function(_0x282bfe){var _0x2d351b=this;return new Promise(function(_0x3a3911,_0x28dc4e){return db[_0x18a3('0x23')][_0x18a3('0x24')](function(_0x449f39){var _0x3be5fb=_0x282bfe[_0x18a3('0x8')]&&_0x282bfe[_0x18a3('0x8')]['where']?_0x282bfe[_0x18a3('0x8')][_0x18a3('0x9')]:{};return db['CmHopper'][_0x18a3('0x1b')](_0x282bfe[_0x18a3('0x1c')],{'where':_0x3be5fb,'transaction':_0x449f39})[_0x18a3('0x18')](function(_0x13bcae){logger[_0x18a3('0xf')](_0x18a3('0x44'),_0x282bfe);logger[_0x18a3('0x10')]('ResetActiveCalls',_0x282bfe,JSON[_0x18a3('0x11')](_0x13bcae));_0x3a3911(_0x13bcae);})[_0x18a3('0x12')](function(_0x405e86){logger[_0x18a3('0x13')](_0x18a3('0x44'),_0x405e86[_0x18a3('0x14')],_0x282bfe);_0x28dc4e(_0x2d351b['error'](0x1f4,_0x405e86['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x4f3a1a){var _0x29ddb2=this;var _0x1901c6=_0x4f3a1a[_0x18a3('0x1c')][_0x18a3('0x9')][_0x18a3('0x45')];var _0x27554d=_0x4f3a1a[_0x18a3('0x1c')]['where']['interval'];var _0x2b25dc=_0x4f3a1a[_0x18a3('0x1c')][_0x18a3('0x9')][_0x18a3('0x46')];return new Promise(function(_0x2fa705,_0x58ea7f){return db[_0x18a3('0x6')][_0x18a3('0x7')]({'where':{'voiceQueueId':{'$in':_0x1901c6},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x18a3('0x23')]['literal'](_0x18a3('0x47')+_0x27554d+_0x18a3('0x48')),'$gt':db[_0x18a3('0x23')][_0x18a3('0x34')](_0x18a3('0x49'))}},'UserId':{'$in':_0x2b25dc}},'include':[{'model':db['CmContact'],'as':_0x18a3('0x28')},{'model':db[_0x18a3('0x29')],'as':_0x18a3('0x4a'),'attributes':['id',_0x18a3('0x4b'),_0x18a3('0x4c')]},{'model':db['CmList'],'as':_0x18a3('0x4d')}]})[_0x18a3('0x18')](function(_0x3cd624){if(_0x3cd624['length']>0x0){return db[_0x18a3('0x23')][_0x18a3('0x24')](function(_0x4e1b3a){return db[_0x18a3('0x6')]['update']({'recallmeNotifiedDate':db[_0x18a3('0x23')][_0x18a3('0x34')](_0x18a3('0x49'))},{'where':{'id':{'$in':_[_0x18a3('0xd')](_0x3cd624,'id')}},'transaction':_0x4e1b3a})[_0x18a3('0x18')](function(){_0x2fa705(_0x3cd624);})[_0x18a3('0x12')](function(_0x72b3ed){logger[_0x18a3('0x13')](_0x18a3('0x4e'),_0x72b3ed[_0x18a3('0x14')],_0x4f3a1a);_0x58ea7f(_0x29ddb2[_0x18a3('0x13')](0x1f4,_0x72b3ed['message']));});})['catch'](function(_0x39a3a2){logger[_0x18a3('0x13')](_0x18a3('0x4e'),_0x39a3a2[_0x18a3('0x14')],_0x4f3a1a);_0x58ea7f(_0x29ddb2['error'](0x1f4,_0x39a3a2['message']));});}else{_0x2fa705(_0x3cd624);}});});}; \ No newline at end of file +var _0xc0aa=['all','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','List','CmHopperHandlePreviewRecallNotifications','util','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','map','include','model','then','stringify','message','ShowCmHopper','debug','error','CreateCmHopper','create','body','info','update','limit','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','catch','GetContactDialer','CmContact','sequelize','transaction','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','describe','order'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc0aa,0x15f));var _0xac0a=function(_0x126dab,_0x51293c){_0x126dab=_0x126dab-0x0;var _0xfb0545=_0xc0aa[_0x126dab];return _0xfb0545;};'use strict';var _=require('lodash');var util=require(_0xac0a('0x0'));var moment=require('moment');var BPromise=require(_0xac0a('0x1'));var db=require(_0xac0a('0x2'))['db'];var logger=require(_0xac0a('0x3'))(_0xac0a('0x4'));exports[_0xac0a('0x5')]=function(_0x32605b){var _0x27929e=this;return new Promise(function(_0x5f574a,_0x535bbb){return db[_0xac0a('0x6')][_0xac0a('0x7')]({'raw':_0x32605b['options']?_0x32605b[_0xac0a('0x8')][_0xac0a('0x9')]===undefined?!![]:![]:!![],'where':_0x32605b[_0xac0a('0x8')]?_0x32605b[_0xac0a('0x8')][_0xac0a('0xa')]||null:null,'attributes':_0x32605b[_0xac0a('0x8')]?_0x32605b['options'][_0xac0a('0xb')]||null:null,'limit':_0x32605b[_0xac0a('0x8')]?_0x32605b['options']['limit']||null:null,'include':_0x32605b[_0xac0a('0x8')]?_0x32605b[_0xac0a('0x8')]['include']?_[_0xac0a('0xc')](_0x32605b[_0xac0a('0x8')][_0xac0a('0xd')],function(_0x392d04){return{'model':db[_0x392d04[_0xac0a('0xe')]],'as':_0x392d04['as'],'attributes':_0x392d04[_0xac0a('0xb')],'include':_0x392d04[_0xac0a('0xd')]?_[_0xac0a('0xc')](_0x392d04[_0xac0a('0xd')],function(_0xb3da60){return{'model':db[_0xb3da60[_0xac0a('0xe')]],'as':_0xb3da60['as'],'attributes':_0xb3da60[_0xac0a('0xb')],'include':_0xb3da60[_0xac0a('0xd')]?_[_0xac0a('0xc')](_0xb3da60[_0xac0a('0xd')],function(_0x23b934){return{'model':db[_0x23b934[_0xac0a('0xe')]],'as':_0x23b934['as'],'attributes':_0x23b934[_0xac0a('0xb')]};}):[]};}):[]};}):[]:[]})[_0xac0a('0xf')](function(_0x1ba1ba){logger['info'](_0xac0a('0x5'),_0x32605b);logger['debug']('GetCmHopper',_0x32605b,JSON[_0xac0a('0x10')](_0x1ba1ba));_0x5f574a(_0x1ba1ba);})['catch'](function(_0x3cc143){logger['error']('GetCmHopper',_0x3cc143[_0xac0a('0x11')],_0x32605b);_0x535bbb(_0x27929e['error'](0x1f4,_0x3cc143[_0xac0a('0x11')]));});});};exports[_0xac0a('0x12')]=function(_0x53d729){var _0x325514=this;return new Promise(function(_0x2d5475,_0x4ab8a9){return db[_0xac0a('0x6')]['find']({'raw':_0x53d729[_0xac0a('0x8')]?_0x53d729[_0xac0a('0x8')][_0xac0a('0x9')]===undefined?!![]:![]:!![],'where':_0x53d729['options']?_0x53d729[_0xac0a('0x8')][_0xac0a('0xa')]||null:null,'attributes':_0x53d729['options']?_0x53d729[_0xac0a('0x8')][_0xac0a('0xb')]||null:null,'include':_0x53d729[_0xac0a('0x8')]?_0x53d729[_0xac0a('0x8')]['include']?_[_0xac0a('0xc')](_0x53d729[_0xac0a('0x8')][_0xac0a('0xd')],function(_0x3355ee){return{'model':db[_0x3355ee[_0xac0a('0xe')]],'as':_0x3355ee['as'],'attributes':_0x3355ee['attributes'],'include':_0x3355ee['include']?_[_0xac0a('0xc')](_0x3355ee[_0xac0a('0xd')],function(_0x316116){return{'model':db[_0x316116['model']],'as':_0x316116['as'],'attributes':_0x316116[_0xac0a('0xb')],'include':_0x316116[_0xac0a('0xd')]?_[_0xac0a('0xc')](_0x316116[_0xac0a('0xd')],function(_0x1bef4a){return{'model':db[_0x1bef4a[_0xac0a('0xe')]],'as':_0x1bef4a['as'],'attributes':_0x1bef4a[_0xac0a('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17b29e){logger['info']('ShowCmHopper',_0x53d729);logger[_0xac0a('0x13')](_0xac0a('0x12'),_0x53d729,JSON[_0xac0a('0x10')](_0x17b29e));_0x2d5475(_0x17b29e);})['catch'](function(_0x1982fa){logger[_0xac0a('0x14')]('ShowCmHopper',_0x1982fa[_0xac0a('0x11')],_0x53d729);_0x4ab8a9(_0x325514[_0xac0a('0x14')](0x1f4,_0x1982fa[_0xac0a('0x11')]));});});};exports[_0xac0a('0x15')]=function(_0x421def){var _0x15a7f1=this;return new Promise(function(_0x1dce56,_0x4156b8){return db['CmHopper'][_0xac0a('0x16')](_0x421def[_0xac0a('0x17')],{'raw':_0x421def[_0xac0a('0x8')]?_0x421def[_0xac0a('0x8')][_0xac0a('0x9')]===undefined?!![]:![]:!![]})[_0xac0a('0xf')](function(_0x5e0f41){logger[_0xac0a('0x18')](_0xac0a('0x15'),_0x421def);logger[_0xac0a('0x13')](_0xac0a('0x15'),_0x421def,JSON[_0xac0a('0x10')](_0x5e0f41));_0x1dce56(_0x5e0f41);})['catch'](function(_0x4a40f8){logger[_0xac0a('0x14')](_0xac0a('0x15'),_0x4a40f8['message'],_0x421def);_0x4156b8(_0x15a7f1['error'](0x1f4,_0x4a40f8[_0xac0a('0x11')]));});});};exports['UpdateCmHopper']=function(_0x5c06a4){var _0x4ec8ff=this;return new Promise(function(_0x29e405,_0x51805b){return db['CmHopper'][_0xac0a('0x19')](_0x5c06a4['body'],{'raw':_0x5c06a4[_0xac0a('0x8')]?_0x5c06a4[_0xac0a('0x8')][_0xac0a('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c06a4['options']?_0x5c06a4[_0xac0a('0x8')][_0xac0a('0xa')]||null:null,'attributes':_0x5c06a4['options']?_0x5c06a4['options'][_0xac0a('0xb')]||null:null,'limit':_0x5c06a4[_0xac0a('0x8')]?_0x5c06a4[_0xac0a('0x8')][_0xac0a('0x1a')]||null:null})[_0xac0a('0xf')](function(_0x359274){logger[_0xac0a('0x18')](_0xac0a('0x1b'),_0x5c06a4);logger[_0xac0a('0x18')](_0xac0a('0x1c'),JSON[_0xac0a('0x10')](_0x5c06a4[_0xac0a('0x8')]['where']),_0x5c06a4[_0xac0a('0x17')][_0xac0a('0x1d')]);logger[_0xac0a('0x13')](_0xac0a('0x1b'),_0x5c06a4,JSON[_0xac0a('0x10')](_0x359274));_0x29e405(_0x359274);})['catch'](function(_0x1a7e69){logger['error'](_0xac0a('0x1b'),_0x1a7e69[_0xac0a('0x11')],_0x5c06a4);_0x51805b(_0x4ec8ff[_0xac0a('0x14')](0x1f4,_0x1a7e69['message']));});});};exports[_0xac0a('0x1e')]=function(_0x5f162b){var _0x44332a=this;return new Promise(function(_0x2ce4b,_0x2f8c56){return db['CmHopper'][_0xac0a('0x1f')]({'where':_0x5f162b['options']?_0x5f162b[_0xac0a('0x8')]['where']||null:null})[_0xac0a('0xf')](function(_0xeaadfc){logger['info'](_0xac0a('0x1e'),_0x5f162b);logger[_0xac0a('0x13')](_0xac0a('0x1e'),_0x5f162b,JSON[_0xac0a('0x10')](_0xeaadfc));_0x2ce4b(_0xeaadfc);})[_0xac0a('0x20')](function(_0x16c8d8){logger['error']('DestroyCmHopper',_0x16c8d8['message'],_0x5f162b);_0x2f8c56(_0x44332a[_0xac0a('0x14')](0x1f4,_0x16c8d8[_0xac0a('0x11')]));});});};exports[_0xac0a('0x21')]=function(_0xc7c4c7){var _0x49a46b=this;return new Promise(function(_0x197d28,_0x53ec15){return db[_0xac0a('0x22')]['describe']()[_0xac0a('0xf')](function(_0x2f7a4a){return db[_0xac0a('0x23')][_0xac0a('0x24')](function(_0x4407ce){return db[_0xac0a('0x6')][_0xac0a('0x7')]({'where':_0xc7c4c7['options']?_0xc7c4c7[_0xac0a('0x8')]['where']||null:null,'attributes':_0xc7c4c7[_0xac0a('0x8')]?_0xc7c4c7[_0xac0a('0x8')][_0xac0a('0xb')]||null:null,'limit':_0xc7c4c7[_0xac0a('0x8')]?_0xc7c4c7[_0xac0a('0x8')]['limit']||null:null,'order':_0xc7c4c7['options']?_0xc7c4c7[_0xac0a('0x8')]['order']||null:null,'transaction':_0x4407ce,'lock':_0x4407ce[_0xac0a('0x25')][_0xac0a('0x26')],'include':[{'model':db[_0xac0a('0x22')],'as':_0xac0a('0x27'),'attributes':_[_0xac0a('0x28')](_0x2f7a4a)},{'model':db[_0xac0a('0x29')],'as':_0xac0a('0x2a'),'attributes':['id',_0xac0a('0x2b'),_0xac0a('0x2c')]}]})[_0xac0a('0xf')](function(_0x3827c7){var _0x54f059=[];var _0x2a294b=[];for(var _0x25f9f2=0x0;_0x25f9f2<_0x3827c7[_0xac0a('0x2d')];_0x25f9f2+=0x1){var _0x29a6f4=_0x3827c7[_0x25f9f2][_0xac0a('0x2e')];if(_0x29a6f4===null){_0x54f059[_0xac0a('0x2f')](_0x3827c7[_0x25f9f2][_0xac0a('0x19')](_0xc7c4c7['body'],{'transaction':_0x4407ce}));}else if(!_0x2a294b[_0xac0a('0x30')](_0x29a6f4)){_0x2a294b[_0xac0a('0x2f')](_0x29a6f4);_0x54f059[_0xac0a('0x2f')](_0x3827c7[_0x25f9f2][_0xac0a('0x19')](_0xc7c4c7[_0xac0a('0x17')],{'transaction':_0x4407ce}));}}return BPromise['all'](_0x54f059);});})[_0xac0a('0xf')](function(_0x352521){logger[_0xac0a('0x18')](_0xac0a('0x21'),_0xc7c4c7);if(_0x352521[_0xac0a('0x2d')]>0x0){logger[_0xac0a('0x18')](_0xac0a('0x31'),_0x352521[0x0][_0xac0a('0x32')]['id'],_0x352521[0x0][_0xac0a('0x32')][_0xac0a('0x33')],_0x352521[0x0]['dataValues'][_0xac0a('0x1d')]);}logger['debug'](_0xac0a('0x21'),_0xc7c4c7,JSON[_0xac0a('0x10')](_0x352521));_0x197d28(_0x352521);})[_0xac0a('0x20')](function(_0x12323d){logger[_0xac0a('0x14')](_0xac0a('0x21'),_0x12323d[_0xac0a('0x11')],_0xc7c4c7);_0x53ec15(_0x49a46b['error'](0x1f4,_0x12323d[_0xac0a('0x11')]));});});});};exports[_0xac0a('0x34')]=function(_0x427d10){var _0x5cb438=this;return new Promise(function(_0x252e33,_0x533867){return db[_0xac0a('0x23')][_0xac0a('0x24')](function(_0x4c3ca4){return db[_0xac0a('0x35')][_0xac0a('0x16')](_0x427d10[_0xac0a('0x17')],{'raw':_0x427d10[_0xac0a('0x8')]?_0x427d10[_0xac0a('0x8')][_0xac0a('0x9')]===undefined?!![]:![]:!![],'transaction':_0x4c3ca4})[_0xac0a('0xf')](function(){logger['info'](_0xac0a('0x36'),JSON[_0xac0a('0x10')](_0x427d10['options']['where']),_0x427d10['options'][_0xac0a('0xa')][_0xac0a('0x1d')]);return db[_0xac0a('0x6')][_0xac0a('0x1f')]({'where':_0x427d10['options']?_0x427d10['options']['where']||null:null,'transaction':_0x4c3ca4});});})[_0xac0a('0xf')](function(_0x3a6b63){logger[_0xac0a('0x18')]('MoveContactManagedDialer',_0x427d10);logger[_0xac0a('0x13')](_0xac0a('0x34'),_0x427d10,JSON[_0xac0a('0x10')](_0x3a6b63));_0x252e33(_0x3a6b63);})[_0xac0a('0x20')](function(_0x134cd1){logger[_0xac0a('0x14')](_0xac0a('0x34'),_0x134cd1['message'],_0x427d10);_0x533867(_0x5cb438['error'](0x1f4,_0x134cd1[_0xac0a('0x11')]));});});};exports['CountReScheduled']=function(_0x3b10b1){var _0x30968a=this;return new Promise(function(_0x2d58c6,_0x5289d0){return db[_0xac0a('0x6')][_0xac0a('0x7')]({'raw':_0x3b10b1['options']?_0x3b10b1[_0xac0a('0x8')][_0xac0a('0x9')]===undefined?!![]:![]:!![],'where':_0x3b10b1[_0xac0a('0x8')]?_0x3b10b1[_0xac0a('0x8')][_0xac0a('0xa')]||null:null,'attributes':[[db['sequelize']['fn'](_0xac0a('0x37'),db['sequelize']['fn']('IF',db[_0xac0a('0x23')]['literal'](_0xac0a('0x38')+util[_0xac0a('0x39')]('\x22%s\x22',moment()[_0xac0a('0x39')](_0xac0a('0x3a')))+_0xac0a('0x3b')))),_0xac0a('0x3c')]]})[_0xac0a('0xf')](function(_0x403a99){logger[_0xac0a('0x18')]('CountReScheduled',_0x3b10b1);logger[_0xac0a('0x13')]('CountReScheduled',_0x3b10b1,JSON[_0xac0a('0x10')](_0x403a99));_0x2d58c6(_0x403a99);})['catch'](function(_0x480b35){logger[_0xac0a('0x14')](_0xac0a('0x3d'),_0x480b35[_0xac0a('0x11')],_0x3b10b1);_0x5289d0(_0x30968a[_0xac0a('0x14')](0x1f4,_0x480b35['message']));});});};exports['GetContactRecallMe']=function(_0x1ded4a){var _0x637c23=this;return new Promise(function(_0x5dd9d5,_0x1177c4){return db[_0xac0a('0x22')][_0xac0a('0x3e')]()[_0xac0a('0xf')](function(){return db[_0xac0a('0x23')][_0xac0a('0x24')](function(_0x4927d1){return db[_0xac0a('0x6')]['findAll']({'where':_0x1ded4a[_0xac0a('0x8')]?_0x1ded4a[_0xac0a('0x8')][_0xac0a('0xa')]||null:null,'attributes':_0x1ded4a[_0xac0a('0x8')]?_0x1ded4a[_0xac0a('0x8')][_0xac0a('0xb')]||null:null,'limit':0x1,'order':_0x1ded4a['options']?_0x1ded4a[_0xac0a('0x8')][_0xac0a('0x3f')]||null:null,'group':db[_0xac0a('0x6')]['UserId'],'transaction':_0x4927d1,'lock':_0x4927d1['LOCK'][_0xac0a('0x26')],'include':_0x1ded4a[_0xac0a('0x8')]?_0x1ded4a['options'][_0xac0a('0xd')]?_[_0xac0a('0xc')](_0x1ded4a['options'][_0xac0a('0xd')],function(_0x2f4a19){return{'model':db[_0x2f4a19[_0xac0a('0xe')]],'as':_0x2f4a19['as'],'attributes':_0x2f4a19[_0xac0a('0xb')],'include':_0x2f4a19[_0xac0a('0xd')]?_[_0xac0a('0xc')](_0x2f4a19[_0xac0a('0xd')],function(_0x2fcb6e){return{'model':db[_0x2fcb6e[_0xac0a('0xe')]],'as':_0x2fcb6e['as'],'attributes':_0x2fcb6e['attributes'],'include':_0x2fcb6e[_0xac0a('0xd')]?_[_0xac0a('0xc')](_0x2fcb6e[_0xac0a('0xd')],function(_0x23555a){return{'model':db[_0x23555a[_0xac0a('0xe')]],'as':_0x23555a['as'],'attributes':_0x23555a[_0xac0a('0xb')]};}):[]};}):[]};}):[]:[]})[_0xac0a('0xf')](function(_0x1174a1){var _0x2e6945=[];for(var _0x37daf5=0x0;_0x37daf5<_0x1174a1[_0xac0a('0x2d')];_0x37daf5+=0x1){_0x2e6945['push'](_0x1174a1[_0x37daf5][_0xac0a('0x19')](_0x1ded4a[_0xac0a('0x17')],{'transaction':_0x4927d1}));}return BPromise[_0xac0a('0x40')](_0x2e6945);});})[_0xac0a('0xf')](function(_0x15c755){logger[_0xac0a('0x18')]('GetContactRecallMe',_0x1ded4a);logger[_0xac0a('0x13')](_0xac0a('0x41'),_0x1ded4a,JSON['stringify'](_0x15c755));_0x5dd9d5(_0x15c755);})['catch'](function(_0x40cf56){logger[_0xac0a('0x14')](_0xac0a('0x41'),_0x40cf56['message'],_0x1ded4a);_0x1177c4(_0x637c23[_0xac0a('0x14')](0x1f4,_0x40cf56[_0xac0a('0x11')]));});});});};exports[_0xac0a('0x42')]=function(_0x385612){var _0x558a67=this;return new Promise(function(_0x842761,_0x18e23c){db[_0xac0a('0x22')]['describe']()[_0xac0a('0xf')](function(_0x1b9a67){return db['CmHopper']['findAll']({'raw':_0x385612[_0xac0a('0x8')]?_0x385612[_0xac0a('0x8')][_0xac0a('0x9')]===undefined?!![]:![]:!![],'where':_0x385612[_0xac0a('0x8')]?_0x385612[_0xac0a('0x8')][_0xac0a('0xa')]||null:null,'attributes':_0x385612[_0xac0a('0x8')]?_0x385612['options'][_0xac0a('0xb')]||null:null,'limit':_0x385612[_0xac0a('0x8')]?_0x385612['options']['limit']||null:null,'include':_0x385612[_0xac0a('0x8')]?_0x385612[_0xac0a('0x8')][_0xac0a('0xd')]?_['map'](_0x385612[_0xac0a('0x8')][_0xac0a('0xd')],function(_0x46be52){return{'model':db[_0x46be52[_0xac0a('0xe')]],'as':_0x46be52['as'],'attributes':_0x46be52['as']==='Contact'?_[_0xac0a('0x28')](_0x1b9a67):_0x46be52[_0xac0a('0xb')],'include':_0x46be52[_0xac0a('0xd')]?_[_0xac0a('0xc')](_0x46be52[_0xac0a('0xd')],function(_0x1482e){return{'model':db[_0x1482e[_0xac0a('0xe')]],'as':_0x1482e['as'],'attributes':_0x1482e[_0xac0a('0xb')],'include':_0x1482e[_0xac0a('0xd')]?_['map'](_0x1482e[_0xac0a('0xd')],function(_0xb4372e){return{'model':db[_0xb4372e[_0xac0a('0xe')]],'as':_0xb4372e['as'],'attributes':_0xb4372e[_0xac0a('0xb')]};}):[]};}):[]};}):[]:[]})[_0xac0a('0xf')](function(_0xb50d57){logger['info'](_0xac0a('0x5'),_0x385612);logger['debug'](_0xac0a('0x5'),_0x385612,JSON[_0xac0a('0x10')](_0xb50d57));_0x842761(_0xb50d57);})[_0xac0a('0x20')](function(_0x3050f0){logger[_0xac0a('0x14')](_0xac0a('0x5'),_0x3050f0[_0xac0a('0x11')],_0x385612);_0x18e23c(_0x558a67[_0xac0a('0x14')](0x1f4,_0x3050f0[_0xac0a('0x11')]));});});});};exports[_0xac0a('0x43')]=function(_0x3604cf){var _0x5c11ce=this;return new Promise(function(_0x368450,_0x4e8f18){return db[_0xac0a('0x22')][_0xac0a('0x44')]({'raw':!![],'where':{'phone':_0x3604cf[_0xac0a('0x8')][_0xac0a('0xa')][_0xac0a('0x45')]},'attributes':['id',_0xac0a('0x46')],'order':[['id',_0xac0a('0x47')]]})[_0xac0a('0xf')](function(_0x5b5846){logger[_0xac0a('0x18')]('getContactByPhone',_0x3604cf);logger[_0xac0a('0x13')](_0xac0a('0x48'),_0x3604cf,JSON[_0xac0a('0x10')](_0x5b5846));_0x368450(_0x5b5846);})[_0xac0a('0x20')](function(_0x2beb68){logger[_0xac0a('0x14')](_0xac0a('0x48'),_0x2beb68['message'],_0x3604cf);_0x4e8f18(_0x5c11ce[_0xac0a('0x14')](0x1f4,_0x2beb68['message']));});});};exports[_0xac0a('0x49')]=function(_0x23533a){var _0x3bcacb=this;return new Promise(function(_0x1ae7ea,_0x1c0d6d){return db[_0xac0a('0x23')][_0xac0a('0x24')](function(_0x565569){var _0x875729=_0x23533a[_0xac0a('0x8')]&&_0x23533a[_0xac0a('0x8')][_0xac0a('0xa')]?_0x23533a[_0xac0a('0x8')][_0xac0a('0xa')]:{};return db[_0xac0a('0x6')][_0xac0a('0x19')](_0x23533a['body'],{'where':_0x875729,'transaction':_0x565569})[_0xac0a('0xf')](function(_0x2b04e3){logger['info'](_0xac0a('0x49'),_0x23533a);logger['debug'](_0xac0a('0x49'),_0x23533a,JSON[_0xac0a('0x10')](_0x2b04e3));_0x1ae7ea(_0x2b04e3);})[_0xac0a('0x20')](function(_0x466f82){logger['error'](_0xac0a('0x49'),_0x466f82[_0xac0a('0x11')],_0x23533a);_0x1c0d6d(_0x3bcacb[_0xac0a('0x14')](0x1f4,_0x466f82[_0xac0a('0x11')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x485d86){var _0x6f2bd1=this;var _0x9de65=_0x485d86[_0xac0a('0x17')][_0xac0a('0xa')][_0xac0a('0x4a')];var _0x328684=_0x485d86[_0xac0a('0x17')][_0xac0a('0xa')][_0xac0a('0x4b')];var _0x45952f=_0x485d86[_0xac0a('0x17')][_0xac0a('0xa')][_0xac0a('0x4c')];return new Promise(function(_0x52bf75,_0x260e88){return db[_0xac0a('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x9de65},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xac0a('0x23')][_0xac0a('0x4d')](_0xac0a('0x4e')+_0x328684+'\x20MINUTE'),'$gt':db[_0xac0a('0x23')][_0xac0a('0x4d')](_0xac0a('0x4f'))}},'UserId':{'$in':_0x45952f}},'include':[{'model':db[_0xac0a('0x22')],'as':'Contact'},{'model':db['User'],'as':'Agent','attributes':['id',_0xac0a('0x2b'),_0xac0a('0x2c')]},{'model':db[_0xac0a('0x50')],'as':_0xac0a('0x51')}]})[_0xac0a('0xf')](function(_0x2ee133){if(_0x2ee133[_0xac0a('0x2d')]>0x0){return db[_0xac0a('0x23')]['transaction'](function(_0x23a2c3){return db[_0xac0a('0x6')][_0xac0a('0x19')]({'recallmeNotifiedDate':db[_0xac0a('0x23')][_0xac0a('0x4d')](_0xac0a('0x4f'))},{'where':{'id':{'$in':_[_0xac0a('0xc')](_0x2ee133,'id')}},'transaction':_0x23a2c3})[_0xac0a('0xf')](function(){_0x52bf75(_0x2ee133);})[_0xac0a('0x20')](function(_0x2822c8){logger[_0xac0a('0x14')](_0xac0a('0x52'),_0x2822c8[_0xac0a('0x11')],_0x485d86);_0x260e88(_0x6f2bd1[_0xac0a('0x14')](0x1f4,_0x2822c8['message']));});})[_0xac0a('0x20')](function(_0x3cc6b6){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x3cc6b6['message'],_0x485d86);_0x260e88(_0x6f2bd1[_0xac0a('0x14')](0x1f4,_0x3cc6b6[_0xac0a('0x11')]));});}else{_0x52bf75(_0x2ee133);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 0c9b34b..820ca84 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 _0xea92=['/describe','describe','/opencontacts','getOpenContacts','/timezones','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','/:id','update','delete','destroy','express','Router','../../components/auth/service','get','isAuthenticated','index'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xea92,0xdb));var _0x2ea9=function(_0x465c36,_0x52e104){_0x465c36=_0x465c36-0x0;var _0x2b471f=_0xea92[_0x465c36];return _0x2b471f;};'use strict';var express=require(_0x2ea9('0x0'));var router=express[_0x2ea9('0x1')]();var auth=require(_0x2ea9('0x2'));var controller=require('./cmHopper.controller');router[_0x2ea9('0x3')]('/',auth[_0x2ea9('0x4')](),controller[_0x2ea9('0x5')]);router[_0x2ea9('0x3')](_0x2ea9('0x6'),auth[_0x2ea9('0x4')](),controller[_0x2ea9('0x7')]);router[_0x2ea9('0x3')](_0x2ea9('0x8'),auth[_0x2ea9('0x4')](),controller[_0x2ea9('0x9')]);router[_0x2ea9('0x3')](_0x2ea9('0xa'),auth[_0x2ea9('0x4')](),controller['getTimezones']);router[_0x2ea9('0x3')]('/:id',auth[_0x2ea9('0x4')](),controller[_0x2ea9('0xb')]);router[_0x2ea9('0x3')](_0x2ea9('0xc'),auth[_0x2ea9('0x4')](),controller[_0x2ea9('0xd')]);router[_0x2ea9('0xe')]('/',auth[_0x2ea9('0x4')](),controller[_0x2ea9('0xf')]);router[_0x2ea9('0xe')](_0x2ea9('0x10'),auth[_0x2ea9('0x4')](),controller[_0x2ea9('0x11')]);router['post'](_0x2ea9('0x12'),auth[_0x2ea9('0x4')](),controller[_0x2ea9('0x13')]);router[_0x2ea9('0x14')](_0x2ea9('0x15'),auth[_0x2ea9('0x4')](),controller[_0x2ea9('0x16')]);router[_0x2ea9('0x17')](_0x2ea9('0x15'),auth[_0x2ea9('0x4')](),controller[_0x2ea9('0x18')]);module['exports']=router; \ No newline at end of file +var _0x11fa=['/opencontacts','getOpenContacts','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','getTimezone','put','update','delete','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x416a99,_0x8df9a2){var _0xf622fb=function(_0x9e688){while(--_0x9e688){_0x416a99['push'](_0x416a99['shift']());}};_0xf622fb(++_0x8df9a2);}(_0x11fa,0x1db));var _0xa11f=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x11fa[_0x1b6c6d];return _0x290d9d;};'use strict';var express=require(_0xa11f('0x0'));var router=express[_0xa11f('0x1')]();var auth=require(_0xa11f('0x2'));var controller=require(_0xa11f('0x3'));router[_0xa11f('0x4')]('/',auth['isAuthenticated'](),controller[_0xa11f('0x5')]);router[_0xa11f('0x4')](_0xa11f('0x6'),auth[_0xa11f('0x7')](),controller[_0xa11f('0x8')]);router[_0xa11f('0x4')](_0xa11f('0x9'),auth[_0xa11f('0x7')](),controller[_0xa11f('0xa')]);router[_0xa11f('0x4')]('/timezones',auth['isAuthenticated'](),controller['getTimezones']);router[_0xa11f('0x4')](_0xa11f('0xb'),auth[_0xa11f('0x7')](),controller['show']);router[_0xa11f('0x4')](_0xa11f('0xc'),auth['isAuthenticated'](),controller[_0xa11f('0xd')]);router[_0xa11f('0xe')]('/',auth[_0xa11f('0x7')](),controller[_0xa11f('0xf')]);router[_0xa11f('0xe')](_0xa11f('0x10'),auth['isAuthenticated'](),controller['getPreview']);router[_0xa11f('0xe')]('/timezone',auth['isAuthenticated'](),controller[_0xa11f('0x11')]);router[_0xa11f('0x12')](_0xa11f('0xb'),auth[_0xa11f('0x7')](),controller[_0xa11f('0x13')]);router[_0xa11f('0x14')]('/:id',auth[_0xa11f('0x7')](),controller['destroy']);module[_0xa11f('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 86a2f12..135a11e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa11d=['INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0xbe8abc,_0x299e9a){var _0x61d4b9=function(_0x37f8f4){while(--_0x37f8f4){_0xbe8abc['push'](_0xbe8abc['shift']());}};_0x61d4b9(++_0x299e9a);}(_0xa11d,0x153));var _0xda11=function(_0x59654b,_0x79965b){_0x59654b=_0x59654b-0x0;var _0x2ac9e2=_0xa11d[_0x59654b];return _0x2ac9e2;};'use strict';var moment=require('moment');var Sequelize=require(_0xda11('0x0'));module['exports']={'CmHopperId':{'type':Sequelize[_0xda11('0x1')]},'phone':{'type':Sequelize[_0xda11('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xda11('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xda11('0x3')](_0xda11('0x4'))},'countbusyretry':{'type':Sequelize[_0xda11('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xda11('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xda11('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xda11('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xda11('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xda11('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0a81=['moment','sequelize','exports','INTEGER','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2932ee,_0x12c402){var _0x586623=function(_0x4fe83a){while(--_0x4fe83a){_0x2932ee['push'](_0x2932ee['shift']());}};_0x586623(++_0x12c402);}(_0x0a81,0x78));var _0x10a8=function(_0x5424fb,_0x497360){_0x5424fb=_0x5424fb-0x0;var _0x3ea205=_0x0a81[_0x5424fb];return _0x3ea205;};'use strict';var moment=require(_0x10a8('0x0'));var Sequelize=require(_0x10a8('0x1'));module[_0x10a8('0x2')]={'CmHopperId':{'type':Sequelize[_0x10a8('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x10a8('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x10a8('0x4')](_0x10a8('0x5'))},'countbusyretry':{'type':Sequelize[_0x10a8('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x10a8('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x10a8('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x10a8('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x10a8('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x10a8('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 85203bd..a8126ab 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbaf=['map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','get','CmHopperAdditionalPhones','UserProfileResource','destroy','stack','name','send','index'];(function(_0x8c3829,_0x5a1f2a){var _0x1bdaf7=function(_0x4e7957){while(--_0x4e7957){_0x8c3829['push'](_0x8c3829['shift']());}};_0x1bdaf7(++_0x5a1f2a);}(_0xbbaf,0xd1));var _0xfbba=function(_0x568753,_0x1d4c4b){_0x568753=_0x568753-0x0;var _0x1def3f=_0xbbaf[_0x568753];return _0x1def3f;};'use strict';var emlformat=require(_0xfbba('0x0'));var rimraf=require(_0xfbba('0x1'));var zipdir=require(_0xfbba('0x2'));var jsonpatch=require(_0xfbba('0x3'));var rp=require(_0xfbba('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfbba('0x5'));var util=require(_0xfbba('0x6'));var path=require(_0xfbba('0x7'));var sox=require(_0xfbba('0x8'));var csv=require(_0xfbba('0x9'));var ejs=require(_0xfbba('0xa'));var fs=require('fs');var fs_extra=require(_0xfbba('0xb'));var _=require(_0xfbba('0xc'));var squel=require('squel');var crypto=require(_0xfbba('0xd'));var jsforce=require(_0xfbba('0xe'));var deskjs=require(_0xfbba('0xf'));var toCsv=require(_0xfbba('0x9'));var querystring=require('querystring');var Papa=require(_0xfbba('0x10'));var Redis=require(_0xfbba('0x11'));var authService=require(_0xfbba('0x12'));var qs=require(_0xfbba('0x13'));var as=require(_0xfbba('0x14'));var hardwareService=require(_0xfbba('0x15'));var logger=require('../../config/logger')(_0xfbba('0x16'));var utils=require(_0xfbba('0x17'));var config=require(_0xfbba('0x18'));var licenseUtil=require(_0xfbba('0x19'));var db=require(_0xfbba('0x1a'))['db'];function respondWithStatusCode(_0x36133d,_0x185b75){_0x185b75=_0x185b75||0xcc;return function(_0x4b9d07){if(_0x4b9d07){return _0x36133d[_0xfbba('0x1b')](_0x185b75);}return _0x36133d[_0xfbba('0x1c')](_0x185b75)[_0xfbba('0x1d')]();};}function respondWithResult(_0x23fbec,_0x22f370){_0x22f370=_0x22f370||0xc8;return function(_0xaa2a29){if(_0xaa2a29){return _0x23fbec['status'](_0x22f370)['json'](_0xaa2a29);}};}function respondWithFilteredResult(_0x3bcde5,_0x56dae7){return function(_0x522d66){if(_0x522d66){var _0x40d166=typeof _0x56dae7[_0xfbba('0x1e')]==='undefined'&&typeof _0x56dae7['limit']===_0xfbba('0x1f');var _0x4cfa04=_0x522d66[_0xfbba('0x20')];var _0x32d6c7=_0x40d166?0x0:_0x56dae7[_0xfbba('0x1e')];var _0x4962ea=_0x40d166?_0x522d66[_0xfbba('0x20')]:_0x56dae7['offset']+_0x56dae7[_0xfbba('0x21')];var _0x2e94d9;if(_0x4962ea>=_0x4cfa04){_0x4962ea=_0x4cfa04;_0x2e94d9=0xc8;}else{_0x2e94d9=0xce;}_0x3bcde5[_0xfbba('0x1c')](_0x2e94d9);return _0x3bcde5[_0xfbba('0x22')](_0xfbba('0x23'),_0x32d6c7+'-'+_0x4962ea+'/'+_0x4cfa04)[_0xfbba('0x24')](_0x522d66);}return null;};}function patchUpdates(_0x27f2d7){return function(_0x3551e7){try{jsonpatch[_0xfbba('0x25')](_0x3551e7,_0x27f2d7,!![]);}catch(_0x46bf4e){return BPromise[_0xfbba('0x26')](_0x46bf4e);}return _0x3551e7[_0xfbba('0x27')]();};}function saveUpdates(_0x2f334e,_0x1126b3){return function(_0xf93211){if(_0xf93211){return _0xf93211[_0xfbba('0x28')](_0x2f334e)['then'](function(_0xe209ac){return _0xe209ac;});}return null;};}function removeEntity(_0x5a24f1,_0xf7d220){return function(_0x50ae1b){if(_0x50ae1b){return _0x50ae1b['destroy']()['then'](function(){var _0x3ce450=_0x50ae1b[_0xfbba('0x29')]({'plain':!![]});var _0xc11652=_0xfbba('0x2a');return db[_0xfbba('0x2b')][_0xfbba('0x2c')]({'where':{'type':_0xc11652,'resourceId':_0x3ce450['id']}})['then'](function(){return _0x50ae1b;});})['then'](function(){_0x5a24f1[_0xfbba('0x1c')](0xcc)[_0xfbba('0x1d')]();});}};}function handleEntityNotFound(_0x54cca9,_0x1aa698){return function(_0x144ffe){if(!_0x144ffe){_0x54cca9[_0xfbba('0x1b')](0x194);}return _0x144ffe;};}function handleError(_0x2099a2,_0x241b55){_0x241b55=_0x241b55||0x1f4;return function(_0x1ecc4d){logger['error'](_0x1ecc4d[_0xfbba('0x2d')]);if(_0x1ecc4d[_0xfbba('0x2e')]){delete _0x1ecc4d[_0xfbba('0x2e')];}_0x2099a2[_0xfbba('0x1c')](_0x241b55)[_0xfbba('0x2f')](_0x1ecc4d);};}exports[_0xfbba('0x30')]=function(_0x599cb2,_0x1b89fb){var _0x2bb8c3={},_0x3afc6c={},_0x32f21c={'count':0x0,'rows':[]};var _0x535f7c=_[_0xfbba('0x31')](db[_0xfbba('0x32')][_0xfbba('0x33')],function(_0x2fe38a){return{'name':_0x2fe38a[_0xfbba('0x34')],'type':_0x2fe38a[_0xfbba('0x35')][_0xfbba('0x36')]};});_0x3afc6c[_0xfbba('0x37')]=_[_0xfbba('0x31')](_0x535f7c,'name');_0x3afc6c[_0xfbba('0x38')]=_[_0xfbba('0x39')](_0x599cb2['query']);_0x3afc6c[_0xfbba('0x3a')]=_[_0xfbba('0x3b')](_0x3afc6c[_0xfbba('0x37')],_0x3afc6c[_0xfbba('0x38')]);_0x2bb8c3['attributes']=_[_0xfbba('0x3b')](_0x3afc6c[_0xfbba('0x37')],qs['fields'](_0x599cb2[_0xfbba('0x38')][_0xfbba('0x3c')]));_0x2bb8c3[_0xfbba('0x3d')]=_0x2bb8c3['attributes'][_0xfbba('0x3e')]?_0x2bb8c3[_0xfbba('0x3d')]:_0x3afc6c[_0xfbba('0x37')];if(!_0x599cb2['query'][_0xfbba('0x3f')](_0xfbba('0x40'))){_0x2bb8c3[_0xfbba('0x21')]=qs[_0xfbba('0x21')](_0x599cb2[_0xfbba('0x38')]['limit']);_0x2bb8c3[_0xfbba('0x1e')]=qs[_0xfbba('0x1e')](_0x599cb2[_0xfbba('0x38')]['offset']);}_0x2bb8c3[_0xfbba('0x41')]=qs['sort'](_0x599cb2['query'][_0xfbba('0x42')]);_0x2bb8c3[_0xfbba('0x43')]=qs[_0xfbba('0x3a')](_[_0xfbba('0x44')](_0x599cb2[_0xfbba('0x38')],_0x3afc6c[_0xfbba('0x3a')]),_0x535f7c);if(_0x599cb2[_0xfbba('0x38')][_0xfbba('0x45')]){_0x2bb8c3[_0xfbba('0x43')]=_[_0xfbba('0x46')](_0x2bb8c3[_0xfbba('0x43')],{'$or':_[_0xfbba('0x31')](_0x535f7c,function(_0x541fbd){if(_0x541fbd['type']!==_0xfbba('0x47')){var _0x2caf03={};_0x2caf03[_0x541fbd['name']]={'$like':'%'+_0x599cb2['query']['filter']+'%'};return _0x2caf03;}})});}_0x2bb8c3=_['merge']({},_0x2bb8c3,_0x599cb2[_0xfbba('0x48')]);var _0x60a623={'where':_0x2bb8c3[_0xfbba('0x43')]};return db[_0xfbba('0x32')][_0xfbba('0x20')](_0x60a623)[_0xfbba('0x49')](function(_0x4cca80){_0x32f21c[_0xfbba('0x20')]=_0x4cca80;if(_0x599cb2[_0xfbba('0x38')][_0xfbba('0x4a')]){_0x2bb8c3[_0xfbba('0x4b')]=[{'all':!![]}];}return db[_0xfbba('0x32')]['findAll'](_0x2bb8c3);})['then'](function(_0x65c81b){_0x32f21c['rows']=_0x65c81b;return _0x32f21c;})[_0xfbba('0x49')](respondWithFilteredResult(_0x1b89fb,_0x2bb8c3))[_0xfbba('0x4c')](handleError(_0x1b89fb,null));};exports[_0xfbba('0x4d')]=function(_0x7111be,_0x4de47a){var _0x3ea469={'raw':!![],'where':{'id':_0x7111be[_0xfbba('0x4e')]['id']}},_0x18e10c={};_0x18e10c[_0xfbba('0x37')]=_[_0xfbba('0x39')](db[_0xfbba('0x32')][_0xfbba('0x33')]);_0x18e10c[_0xfbba('0x38')]=_[_0xfbba('0x39')](_0x7111be[_0xfbba('0x38')]);_0x18e10c[_0xfbba('0x3a')]=_[_0xfbba('0x3b')](_0x18e10c[_0xfbba('0x37')],_0x18e10c[_0xfbba('0x38')]);_0x3ea469[_0xfbba('0x3d')]=_[_0xfbba('0x3b')](_0x18e10c['model'],qs[_0xfbba('0x3c')](_0x7111be[_0xfbba('0x38')][_0xfbba('0x3c')]));_0x3ea469['attributes']=_0x3ea469[_0xfbba('0x3d')][_0xfbba('0x3e')]?_0x3ea469[_0xfbba('0x3d')]:_0x18e10c[_0xfbba('0x37')];if(_0x7111be[_0xfbba('0x38')][_0xfbba('0x4a')]){_0x3ea469[_0xfbba('0x4b')]=[{'all':!![]}];}_0x3ea469=_[_0xfbba('0x46')]({},_0x3ea469,_0x7111be[_0xfbba('0x48')]);return db[_0xfbba('0x32')][_0xfbba('0x4f')](_0x3ea469)[_0xfbba('0x49')](handleEntityNotFound(_0x4de47a,null))['then'](respondWithResult(_0x4de47a,null))['catch'](handleError(_0x4de47a,null));};exports[_0xfbba('0x50')]=function(_0x593f21,_0x2f49dc){return db[_0xfbba('0x32')][_0xfbba('0x50')](_0x593f21['body'],{})[_0xfbba('0x49')](function(_0x2ae58f){var _0x570133=_0x593f21[_0xfbba('0x51')][_0xfbba('0x29')]({'plain':!![]});if(!_0x570133)throw new Error(_0xfbba('0x52'));if(_0x570133['role']===_0xfbba('0x51')){var _0x38b18c=_0x2ae58f[_0xfbba('0x29')]({'plain':!![]});var _0x24e8ad=_0xfbba('0x2a');return db['UserProfileSection'][_0xfbba('0x4f')]({'where':{'name':_0x24e8ad,'userProfileId':_0x570133[_0xfbba('0x53')]},'raw':!![]})['then'](function(_0x57521b){if(_0x57521b&&_0x57521b['autoAssociation']===0x0){return db['UserProfileResource'][_0xfbba('0x50')]({'name':_0x38b18c[_0xfbba('0x2e')],'resourceId':_0x38b18c['id'],'type':_0x57521b[_0xfbba('0x2e')],'sectionId':_0x57521b['id']},{})[_0xfbba('0x49')](function(){return _0x2ae58f;});}else{return _0x2ae58f;}})[_0xfbba('0x4c')](function(_0x4688f7){logger['error'](_0xfbba('0x54'),_0x4688f7);throw _0x4688f7;});}return _0x2ae58f;})[_0xfbba('0x49')](respondWithResult(_0x2f49dc,0xc9))[_0xfbba('0x4c')](handleError(_0x2f49dc,null));};exports[_0xfbba('0x28')]=function(_0x2d2501,_0x310a38){if(_0x2d2501['body']['id']){delete _0x2d2501[_0xfbba('0x55')]['id'];}return db[_0xfbba('0x32')][_0xfbba('0x4f')]({'where':{'id':_0x2d2501['params']['id']}})[_0xfbba('0x49')](handleEntityNotFound(_0x310a38,null))[_0xfbba('0x49')](saveUpdates(_0x2d2501[_0xfbba('0x55')],null))['then'](respondWithResult(_0x310a38,null))[_0xfbba('0x4c')](handleError(_0x310a38,null));};exports['destroy']=function(_0x3d754b,_0x461595){return db[_0xfbba('0x32')]['find']({'where':{'id':_0x3d754b[_0xfbba('0x4e')]['id']}})[_0xfbba('0x49')](handleEntityNotFound(_0x461595,null))['then'](removeEntity(_0x461595,null))[_0xfbba('0x4c')](handleError(_0x461595,null));}; \ No newline at end of file +var _0x812a=['model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type'];(function(_0x3d56ca,_0xe40508){var _0x211cd0=function(_0x28709e){while(--_0x28709e){_0x3d56ca['push'](_0x3d56ca['shift']());}};_0x211cd0(++_0xe40508);}(_0x812a,0x169));var _0xa812=function(_0x285175,_0x1b95b9){_0x285175=_0x285175-0x0;var _0x2145e2=_0x812a[_0x285175];return _0x2145e2;};'use strict';var emlformat=require(_0xa812('0x0'));var rimraf=require(_0xa812('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa812('0x2'));var moment=require('moment');var BPromise=require(_0xa812('0x3'));var Mustache=require(_0xa812('0x4'));var util=require('util');var path=require(_0xa812('0x5'));var sox=require(_0xa812('0x6'));var csv=require(_0xa812('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa812('0x8'));var _=require('lodash');var squel=require(_0xa812('0x9'));var crypto=require('crypto');var jsforce=require(_0xa812('0xa'));var deskjs=require(_0xa812('0xb'));var toCsv=require(_0xa812('0x7'));var querystring=require(_0xa812('0xc'));var Papa=require('papaparse');var Redis=require(_0xa812('0xd'));var authService=require(_0xa812('0xe'));var qs=require(_0xa812('0xf'));var as=require(_0xa812('0x10'));var hardwareService=require(_0xa812('0x11'));var logger=require('../../config/logger')(_0xa812('0x12'));var utils=require(_0xa812('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa812('0x14'));var db=require(_0xa812('0x15'))['db'];function respondWithStatusCode(_0x5ac771,_0xc9a57e){_0xc9a57e=_0xc9a57e||0xcc;return function(_0x502bae){if(_0x502bae){return _0x5ac771[_0xa812('0x16')](_0xc9a57e);}return _0x5ac771['status'](_0xc9a57e)[_0xa812('0x17')]();};}function respondWithResult(_0x3617b7,_0x54bcef){_0x54bcef=_0x54bcef||0xc8;return function(_0xc11dbd){if(_0xc11dbd){return _0x3617b7[_0xa812('0x18')](_0x54bcef)[_0xa812('0x19')](_0xc11dbd);}};}function respondWithFilteredResult(_0x45bbb8,_0x1505ee){return function(_0xd02926){if(_0xd02926){var _0x55a9f4=typeof _0x1505ee['offset']===_0xa812('0x1a')&&typeof _0x1505ee[_0xa812('0x1b')]===_0xa812('0x1a');var _0x4146ce=_0xd02926['count'];var _0x3b7ce5=_0x55a9f4?0x0:_0x1505ee[_0xa812('0x1c')];var _0x9748f4=_0x55a9f4?_0xd02926[_0xa812('0x1d')]:_0x1505ee[_0xa812('0x1c')]+_0x1505ee[_0xa812('0x1b')];var _0xf40f0c;if(_0x9748f4>=_0x4146ce){_0x9748f4=_0x4146ce;_0xf40f0c=0xc8;}else{_0xf40f0c=0xce;}_0x45bbb8[_0xa812('0x18')](_0xf40f0c);return _0x45bbb8[_0xa812('0x1e')](_0xa812('0x1f'),_0x3b7ce5+'-'+_0x9748f4+'/'+_0x4146ce)[_0xa812('0x19')](_0xd02926);}return null;};}function patchUpdates(_0x5c435f){return function(_0x42e925){try{jsonpatch['apply'](_0x42e925,_0x5c435f,!![]);}catch(_0x38934a){return BPromise[_0xa812('0x20')](_0x38934a);}return _0x42e925[_0xa812('0x21')]();};}function saveUpdates(_0x2cc91c,_0x3cec63){return function(_0x2725b0){if(_0x2725b0){return _0x2725b0['update'](_0x2cc91c)[_0xa812('0x22')](function(_0x408000){return _0x408000;});}return null;};}function removeEntity(_0x368913,_0x8179dd){return function(_0x231b66){if(_0x231b66){return _0x231b66[_0xa812('0x23')]()[_0xa812('0x22')](function(){var _0x151de8=_0x231b66[_0xa812('0x24')]({'plain':!![]});var _0x3b5646=_0xa812('0x25');return db[_0xa812('0x26')][_0xa812('0x23')]({'where':{'type':_0x3b5646,'resourceId':_0x151de8['id']}})[_0xa812('0x22')](function(){return _0x231b66;});})[_0xa812('0x22')](function(){_0x368913[_0xa812('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe4d2f6,_0x4b3f51){return function(_0x32cb8d){if(!_0x32cb8d){_0xe4d2f6[_0xa812('0x16')](0x194);}return _0x32cb8d;};}function handleError(_0x5d717f,_0xce62b5){_0xce62b5=_0xce62b5||0x1f4;return function(_0x47b2ea){logger[_0xa812('0x27')](_0x47b2ea[_0xa812('0x28')]);if(_0x47b2ea['name']){delete _0x47b2ea[_0xa812('0x29')];}_0x5d717f['status'](_0xce62b5)[_0xa812('0x2a')](_0x47b2ea);};}exports[_0xa812('0x2b')]=function(_0xc88c05,_0x5f445f){var _0x248a2f={},_0x2a9a49={},_0x5a7c42={'count':0x0,'rows':[]};var _0x2a2cd0=_[_0xa812('0x2c')](db[_0xa812('0x2d')][_0xa812('0x2e')],function(_0xb03174){return{'name':_0xb03174[_0xa812('0x2f')],'type':_0xb03174[_0xa812('0x30')]['key']};});_0x2a9a49[_0xa812('0x31')]=_[_0xa812('0x2c')](_0x2a2cd0,_0xa812('0x29'));_0x2a9a49['query']=_[_0xa812('0x32')](_0xc88c05['query']);_0x2a9a49[_0xa812('0x33')]=_[_0xa812('0x34')](_0x2a9a49[_0xa812('0x31')],_0x2a9a49[_0xa812('0x35')]);_0x248a2f['attributes']=_[_0xa812('0x34')](_0x2a9a49[_0xa812('0x31')],qs[_0xa812('0x36')](_0xc88c05[_0xa812('0x35')]['fields']));_0x248a2f[_0xa812('0x37')]=_0x248a2f[_0xa812('0x37')][_0xa812('0x38')]?_0x248a2f[_0xa812('0x37')]:_0x2a9a49[_0xa812('0x31')];if(!_0xc88c05[_0xa812('0x35')][_0xa812('0x39')](_0xa812('0x3a'))){_0x248a2f[_0xa812('0x1b')]=qs['limit'](_0xc88c05['query'][_0xa812('0x1b')]);_0x248a2f['offset']=qs[_0xa812('0x1c')](_0xc88c05[_0xa812('0x35')][_0xa812('0x1c')]);}_0x248a2f[_0xa812('0x3b')]=qs[_0xa812('0x3c')](_0xc88c05['query'][_0xa812('0x3c')]);_0x248a2f[_0xa812('0x3d')]=qs[_0xa812('0x33')](_[_0xa812('0x3e')](_0xc88c05[_0xa812('0x35')],_0x2a9a49['filters']),_0x2a2cd0);if(_0xc88c05[_0xa812('0x35')]['filter']){_0x248a2f['where']=_[_0xa812('0x3f')](_0x248a2f['where'],{'$or':_[_0xa812('0x2c')](_0x2a2cd0,function(_0x3a21ab){if(_0x3a21ab['type']!==_0xa812('0x40')){var _0x57db26={};_0x57db26[_0x3a21ab[_0xa812('0x29')]]={'$like':'%'+_0xc88c05['query'][_0xa812('0x41')]+'%'};return _0x57db26;}})});}_0x248a2f=_[_0xa812('0x3f')]({},_0x248a2f,_0xc88c05[_0xa812('0x42')]);var _0x4a2ad5={'where':_0x248a2f[_0xa812('0x3d')]};return db['CmHopperAdditionalPhone']['count'](_0x4a2ad5)[_0xa812('0x22')](function(_0x50475f){_0x5a7c42[_0xa812('0x1d')]=_0x50475f;if(_0xc88c05[_0xa812('0x35')][_0xa812('0x43')]){_0x248a2f[_0xa812('0x44')]=[{'all':!![]}];}return db[_0xa812('0x2d')]['findAll'](_0x248a2f);})[_0xa812('0x22')](function(_0x201d3c){_0x5a7c42[_0xa812('0x45')]=_0x201d3c;return _0x5a7c42;})[_0xa812('0x22')](respondWithFilteredResult(_0x5f445f,_0x248a2f))[_0xa812('0x46')](handleError(_0x5f445f,null));};exports[_0xa812('0x47')]=function(_0x64afa6,_0x475eca){var _0x79d1c={'raw':!![],'where':{'id':_0x64afa6[_0xa812('0x48')]['id']}},_0x1ec871={};_0x1ec871[_0xa812('0x31')]=_['keys'](db['CmHopperAdditionalPhone']['rawAttributes']);_0x1ec871['query']=_[_0xa812('0x32')](_0x64afa6['query']);_0x1ec871['filters']=_[_0xa812('0x34')](_0x1ec871['model'],_0x1ec871[_0xa812('0x35')]);_0x79d1c['attributes']=_[_0xa812('0x34')](_0x1ec871[_0xa812('0x31')],qs[_0xa812('0x36')](_0x64afa6[_0xa812('0x35')]['fields']));_0x79d1c['attributes']=_0x79d1c[_0xa812('0x37')][_0xa812('0x38')]?_0x79d1c[_0xa812('0x37')]:_0x1ec871[_0xa812('0x31')];if(_0x64afa6['query'][_0xa812('0x43')]){_0x79d1c[_0xa812('0x44')]=[{'all':!![]}];}_0x79d1c=_['merge']({},_0x79d1c,_0x64afa6[_0xa812('0x42')]);return db[_0xa812('0x2d')]['find'](_0x79d1c)[_0xa812('0x22')](handleEntityNotFound(_0x475eca,null))[_0xa812('0x22')](respondWithResult(_0x475eca,null))['catch'](handleError(_0x475eca,null));};exports['create']=function(_0x538087,_0x44139c){return db[_0xa812('0x2d')][_0xa812('0x49')](_0x538087['body'],{})['then'](function(_0x5a80c6){var _0x161acf=_0x538087[_0xa812('0x4a')][_0xa812('0x24')]({'plain':!![]});if(!_0x161acf)throw new Error(_0xa812('0x4b'));if(_0x161acf[_0xa812('0x4c')]===_0xa812('0x4a')){var _0x26a25c=_0x5a80c6['get']({'plain':!![]});var _0x58bc55=_0xa812('0x25');return db['UserProfileSection'][_0xa812('0x4d')]({'where':{'name':_0x58bc55,'userProfileId':_0x161acf[_0xa812('0x4e')]},'raw':!![]})['then'](function(_0x1e283d){if(_0x1e283d&&_0x1e283d['autoAssociation']===0x0){return db[_0xa812('0x26')][_0xa812('0x49')]({'name':_0x26a25c['name'],'resourceId':_0x26a25c['id'],'type':_0x1e283d[_0xa812('0x29')],'sectionId':_0x1e283d['id']},{})[_0xa812('0x22')](function(){return _0x5a80c6;});}else{return _0x5a80c6;}})[_0xa812('0x46')](function(_0x241a57){logger[_0xa812('0x27')](_0xa812('0x4f'),_0x241a57);throw _0x241a57;});}return _0x5a80c6;})['then'](respondWithResult(_0x44139c,0xc9))['catch'](handleError(_0x44139c,null));};exports[_0xa812('0x50')]=function(_0x5d2fb7,_0x5bf276){if(_0x5d2fb7[_0xa812('0x51')]['id']){delete _0x5d2fb7[_0xa812('0x51')]['id'];}return db[_0xa812('0x2d')][_0xa812('0x4d')]({'where':{'id':_0x5d2fb7[_0xa812('0x48')]['id']}})[_0xa812('0x22')](handleEntityNotFound(_0x5bf276,null))[_0xa812('0x22')](saveUpdates(_0x5d2fb7['body'],null))[_0xa812('0x22')](respondWithResult(_0x5bf276,null))[_0xa812('0x46')](handleError(_0x5bf276,null));};exports[_0xa812('0x23')]=function(_0x5b46c9,_0x20058a){return db['CmHopperAdditionalPhone'][_0xa812('0x4d')]({'where':{'id':_0x5b46c9['params']['id']}})['then'](handleEntityNotFound(_0x20058a,null))['then'](removeEntity(_0x20058a,null))['catch'](handleError(_0x20058a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index d518de9..0278f9c 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc878=['rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','../../config/logger','api','moment','request-promise'];(function(_0x425561,_0x3a4598){var _0x303b28=function(_0x42f9f3){while(--_0x42f9f3){_0x425561['push'](_0x425561['shift']());}};_0x303b28(++_0x3a4598);}(_0xc878,0x10f));var _0x8c87=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0xc878[_0x12b8ec];return _0x21af77;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8c87('0x0'))(_0x8c87('0x1'));var moment=require(_0x8c87('0x2'));var BPromise=require('bluebird');var rp=require(_0x8c87('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c87('0x4'));var config=require(_0x8c87('0x5'));var attributes=require(_0x8c87('0x6'));module[_0x8c87('0x7')]=function(_0x5243dc,_0x36436c){return _0x5243dc[_0x8c87('0x8')](_0x8c87('0x9'),attributes,{'tableName':_0x8c87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1af1=['rimraf','../../config/environment','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','moment','bluebird','request-promise','path'];(function(_0x411311,_0x1651fb){var _0x1e0525=function(_0x231e8b){while(--_0x231e8b){_0x411311['push'](_0x411311['shift']());}};_0x1e0525(++_0x1651fb);}(_0x1af1,0x1e9));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x11af('0x0'));var util=require(_0x11af('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x11af('0x2'));var BPromise=require(_0x11af('0x3'));var rp=require(_0x11af('0x4'));var fs=require('fs');var path=require(_0x11af('0x5'));var rimraf=require(_0x11af('0x6'));var config=require(_0x11af('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x11af('0x8')]=function(_0x1534f0,_0x17830a){return _0x1534f0['define'](_0x11af('0x9'),attributes,{'tableName':_0x11af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index a64e71b..f8ebb18 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a2d=['lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','updatedAt','createdAt','sequelize','transaction','update','IncrementPreviewCounters'];(function(_0x3570b3,_0x4b559f){var _0x2781a2=function(_0x3dfb96){while(--_0x3dfb96){_0x3570b3['push'](_0x3570b3['shift']());}};_0x2781a2(++_0x4b559f);}(_0x0a2d,0x14a));var _0xd0a2=function(_0x47b69f,_0x5655d0){_0x47b69f=_0x47b69f-0x0;var _0x221e4f=_0x0a2d[_0x47b69f];return _0x221e4f;};'use strict';var _=require(_0xd0a2('0x0'));var util=require(_0xd0a2('0x1'));var moment=require(_0xd0a2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0a2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0a2('0x4'))(_0xd0a2('0x5'));var config=require(_0xd0a2('0x6'));var jayson=require(_0xd0a2('0x7'));var client=jayson[_0xd0a2('0x8')][_0xd0a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x469fc7,_0x40d1b7,_0x3db807){return new BPromise(function(_0x3c7da5,_0x2ae30a){return client[_0xd0a2('0xa')](_0x469fc7,_0x3db807)[_0xd0a2('0xb')](function(_0x36890b){logger[_0xd0a2('0xc')](_0xd0a2('0xd'),_0x40d1b7,'request\x20sent');logger[_0xd0a2('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x40d1b7,'request\x20sent',JSON['stringify'](_0x36890b));if(_0x36890b['error']){if(_0x36890b[_0xd0a2('0xf')][_0xd0a2('0x10')]===0x1f4){logger['error'](_0xd0a2('0xd'),_0x40d1b7,_0x36890b[_0xd0a2('0xf')][_0xd0a2('0x11')]);return _0x2ae30a(_0x36890b['error'][_0xd0a2('0x11')]);}logger[_0xd0a2('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x40d1b7,_0x36890b['error'][_0xd0a2('0x11')]);return _0x3c7da5(_0x36890b[_0xd0a2('0xf')][_0xd0a2('0x11')]);}else{logger[_0xd0a2('0xc')](_0xd0a2('0xd'),_0x40d1b7,_0xd0a2('0x12'));_0x3c7da5(_0x36890b['result'][_0xd0a2('0x11')]);}})[_0xd0a2('0x13')](function(_0x24830e){logger[_0xd0a2('0xf')](_0xd0a2('0xd'),_0x40d1b7,_0x24830e);_0x2ae30a(_0x24830e);});});}exports['VerifyAdditionalPhones']=function(_0x349b6c){var _0x18e5c1=this;return new Promise(function(_0x43319b,_0x3de7a0){return db[_0xd0a2('0x14')][_0xd0a2('0x15')]({'raw':!![],'where':{'ContactId':_0x349b6c['body'][_0xd0a2('0x16')],'ListId':_0x349b6c[_0xd0a2('0x17')][_0xd0a2('0x18')],'VoiceQueueId':_0x349b6c[_0xd0a2('0x17')][_0xd0a2('0x19')]===undefined?null:_0x349b6c[_0xd0a2('0x17')][_0xd0a2('0x19')],'CampaignId':_0x349b6c[_0xd0a2('0x17')][_0xd0a2('0x1a')]===undefined?null:_0x349b6c[_0xd0a2('0x17')]['CampaignId']}})[_0xd0a2('0xb')](function(_0x313cd2){if(_0x313cd2!=null){return db[_0xd0a2('0x1b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x313cd2['id'],'OrderBy':{'$gt':_0x313cd2[_0xd0a2('0x1c')]}},'order':[['OrderBy',_0xd0a2('0x1d')]]})[_0xd0a2('0xb')](function(_0x405111){var _0x2a6b8d=0x0;if(_0x405111){if(_0x405111[_0xd0a2('0x1e')]+_0x405111[_0xd0a2('0x1f')]+_0x405111[_0xd0a2('0x20')]+_0x405111[_0xd0a2('0x21')]+_0x405111[_0xd0a2('0x22')]+_0x405111['countabandonedretry']+_0x405111[_0xd0a2('0x23')]+_0x405111['countagentrejectretry']<_0x349b6c['entity']['dialGlobalMaxRetry'])_0x2a6b8d=0x1;_0x43319b({'additional':_0x2a6b8d});}else{return db[_0xd0a2('0x1b')][_0xd0a2('0x15')]({'raw':!![],'where':{'CmHopperId':_0x313cd2['id']},'order':[[_0xd0a2('0x1c'),'ASC']]})[_0xd0a2('0xb')](function(_0x27c7e9){var _0x1683bc=0x0;if(_0x27c7e9){if(_0x27c7e9[_0xd0a2('0x1e')]+_0x27c7e9['countcongestionretry']+_0x27c7e9['countnoanswerretry']+_0x27c7e9['countnosuchnumberretry']+_0x27c7e9[_0xd0a2('0x22')]+_0x27c7e9[_0xd0a2('0x24')]+_0x27c7e9[_0xd0a2('0x23')]+_0x27c7e9[_0xd0a2('0x25')]<_0x349b6c[_0xd0a2('0x26')][_0xd0a2('0x27')])_0x1683bc=0x1;_0x43319b({'additional':_0x1683bc});}else{_0x43319b({'additional':0x0});}})[_0xd0a2('0x13')](function(_0x22a4e2){logger[_0xd0a2('0xf')](_0xd0a2('0x28'),_0x22a4e2['message']);_0x3de7a0(_0x18e5c1[_0xd0a2('0xf')](0x1f4,_0x22a4e2[_0xd0a2('0x11')]));});}})['catch'](function(_0x406db5){logger[_0xd0a2('0xf')](_0xd0a2('0x28'),_0x406db5[_0xd0a2('0x11')]);_0x3de7a0(_0x18e5c1[_0xd0a2('0xf')](0x1f4,_0x406db5[_0xd0a2('0x11')]));});}else _0x43319b({'additional':0x0});});});};exports[_0xd0a2('0x29')]=function(_0x550167){var _0x21e925=this;return new Promise(function(_0x5762f7,_0x33ffff){return db[_0xd0a2('0x14')][_0xd0a2('0x15')]({'raw':!![],'where':{'ContactId':_0x550167[_0xd0a2('0x17')][_0xd0a2('0x16')],'ListId':_0x550167[_0xd0a2('0x17')][_0xd0a2('0x18')],'VoiceQueueId':_0x550167[_0xd0a2('0x17')]['VoiceQueueId']===undefined?null:_0x550167[_0xd0a2('0x17')][_0xd0a2('0x19')],'CampaignId':_0x550167[_0xd0a2('0x17')][_0xd0a2('0x1a')]===undefined?null:_0x550167[_0xd0a2('0x17')][_0xd0a2('0x1a')]}})[_0xd0a2('0xb')](function(_0x1cd114){if(_0x1cd114!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1cd114['id'],'OrderBy':{'$gte':_0x1cd114[_0xd0a2('0x1c')]}},'order':[[_0xd0a2('0x1c'),_0xd0a2('0x1d')]]})[_0xd0a2('0xb')](function(_0x1b3c34){if(_0x1b3c34)return activateAdditionalPhone(_0x1cd114,_0x550167[_0xd0a2('0x17')],_0x1b3c34,_0x550167[_0xd0a2('0x2a')],_0x550167['waitTime'])[_0xd0a2('0xb')](function(_0x49a619){_0x5762f7(_0x49a619);});else{return db['CmHopperAdditionalPhone'][_0xd0a2('0x15')]({'raw':!![],'where':{'CmHopperId':_0x1cd114['id']},'order':[['OrderBy',_0xd0a2('0x1d')]]})[_0xd0a2('0xb')](function(_0x5644d4){if(_0x5644d4)return activateAdditionalPhone(_0x1cd114,_0x550167['body'],_0x5644d4,_0x550167[_0xd0a2('0x2a')],_0x550167[_0xd0a2('0x2b')])[_0xd0a2('0xb')](function(_0x4a5e9c){_0x5762f7(_0x4a5e9c);});else{_0x5762f7({'id':_0x1cd114['id'],'phone':''});}})[_0xd0a2('0x13')](function(_0x320b7f){logger[_0xd0a2('0xf')](_0xd0a2('0x28'),_0x320b7f[_0xd0a2('0x11')]);_0x33ffff(_0x21e925['error'](0x1f4,_0x320b7f[_0xd0a2('0x11')]));});}})[_0xd0a2('0x13')](function(_0x393f36){logger[_0xd0a2('0xf')]('VerifyAdditionalPhones',_0x393f36['message']);_0x33ffff(_0x21e925[_0xd0a2('0xf')](0x1f4,_0x393f36[_0xd0a2('0x11')]));});}else _0x5762f7(0x1);});});};function activateAdditionalPhone(_0x493886,_0x3a503b,_0x1dac1b,_0x5cc2d1,_0x399db6){return new Promise(function(_0xa01283,_0x6b3d8d){var _0x438e58;if(_[_0xd0a2('0x2c')](_0x1dac1b[_0xd0a2('0x2d')])){_0x1dac1b['scheduledat']=moment();}if(moment()>moment(_0x1dac1b['scheduledat'])){_0x438e58=moment()[_0xd0a2('0x2e')](_0x399db6||0x3,_0xd0a2('0x2f'));}else{if(_0x1dac1b[_0xd0a2('0x1c')]==0x0){_0x438e58=moment(_0x1dac1b[_0xd0a2('0x2d')]);}else{_0x438e58=moment()['add'](_0x399db6||0x3,'minutes');}}if(_[_0xd0a2('0x2c')](_0x438e58)){_0x438e58=moment()[_0xd0a2('0x2e')](_0x399db6||0x3,'minutes');}var _0x134a13={'phone':_0x493886[_0xd0a2('0x30')],'active':0x0,'OrderBy':_[_0xd0a2('0x2c')](_0x493886[_0xd0a2('0x1c')])?0x0:_0x493886[_0xd0a2('0x1c')],'scheduledat':moment()['add'](_0x5cc2d1||0x1,_0xd0a2('0x2f')),'countbusyretry':_0x3a503b[_0xd0a2('0x1e')],'countcongestionretry':_0x3a503b[_0xd0a2('0x1f')],'countnoanswerretry':_0x3a503b['countnoanswerretry'],'countnosuchnumberretry':_0x3a503b[_0xd0a2('0x21')],'countdropretry':_0x3a503b[_0xd0a2('0x22')],'countabandonedretry':_0x3a503b[_0xd0a2('0x24')],'countmachineretry':_0x3a503b['countmachineretry'],'countagentrejectretry':_0x3a503b[_0xd0a2('0x25')],'createdAt':_0x3a503b['createdAt'],'updatedAt':_0x3a503b[_0xd0a2('0x31')]};var _0x4a1db1={'CmHopperId':_0x493886['id'],'phone':_0x1dac1b[_0xd0a2('0x30')],'active':0x0,'OrderBy':_[_0xd0a2('0x2c')](_0x1dac1b[_0xd0a2('0x1c')])?0x0:_0x1dac1b['OrderBy'],'scheduledat':_0x438e58,'countbusyretry':_0x1dac1b['countbusyretry'],'countcongestionretry':_0x1dac1b[_0xd0a2('0x1f')],'countnoanswerretry':_0x1dac1b[_0xd0a2('0x20')],'countnosuchnumberretry':_0x1dac1b[_0xd0a2('0x21')],'countdropretry':_0x1dac1b['countdropretry'],'countabandonedretry':_0x1dac1b[_0xd0a2('0x24')],'countmachineretry':_0x1dac1b[_0xd0a2('0x23')],'countagentrejectretry':_0x1dac1b[_0xd0a2('0x25')],'createdAt':_0x1dac1b[_0xd0a2('0x32')],'updatedAt':_0x1dac1b[_0xd0a2('0x31')]};return db[_0xd0a2('0x33')][_0xd0a2('0x34')](function(_0x243a3d){return db[_0xd0a2('0x1b')][_0xd0a2('0x35')](_0x134a13,{'where':{'id':_0x1dac1b['id']}},{'transaction':_0x243a3d})[_0xd0a2('0xb')](function(){return db['CmHopper'][_0xd0a2('0x35')](_0x4a1db1,{'where':{'id':_0x493886['id']}},{'transaction':_0x243a3d});});})['then'](function(_0x4894df){_0xa01283({'id':_0x493886['id'],'phone':_0x1dac1b[_0xd0a2('0x30')]});})[_0xd0a2('0x13')](function(_0x5d3cdd){logger[_0xd0a2('0xf')]('activateAdditionalPhone',_0x5d3cdd[_0xd0a2('0x11')]);_0x6b3d8d({'error':_0x5d3cdd[_0xd0a2('0x11')]});});});}exports[_0xd0a2('0x36')]=function(_0x18639d){var _0x3e3a54=this;return new Promise(function(_0x9f74ae,_0x18cbeb){return db['CmHopper']['update'](_0x18639d['body']['field'],{'where':{'id':_0x18639d['body']['id']}})[_0xd0a2('0xb')](function(_0x5cc585){_0x9f74ae(_0x5cc585);})[_0xd0a2('0x13')](function(_0x509f4b){logger[_0xd0a2('0xf')](_0xd0a2('0x36'),_0x509f4b[_0xd0a2('0x11')]);_0x18cbeb(_0x3e3a54[_0xd0a2('0xf')](0x1f4,_0x509f4b[_0xd0a2('0x11')]));});});}; \ No newline at end of file +var _0x85d2=['client','http','request','then','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countdropretry','SwapAdditionalPhones','ListId','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1f751b,_0x439667){var _0xc3ca81=function(_0x4e75b6){while(--_0x4e75b6){_0x1f751b['push'](_0x1f751b['shift']());}};_0xc3ca81(++_0x439667);}(_0x85d2,0x1d7));var _0x285d=function(_0x2920c4,_0x299f76){_0x2920c4=_0x2920c4-0x0;var _0x4ef89c=_0x85d2[_0x2920c4];return _0x4ef89c;};'use strict';var _=require(_0x285d('0x0'));var util=require(_0x285d('0x1'));var moment=require('moment');var BPromise=require(_0x285d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x285d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x285d('0x4'));var logger=require(_0x285d('0x5'))(_0x285d('0x6'));var config=require(_0x285d('0x7'));var jayson=require(_0x285d('0x8'));var client=jayson[_0x285d('0x9')][_0x285d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d636a,_0x2c8ccc,_0x474e49){return new BPromise(function(_0x4b1134,_0x31e26a){return client[_0x285d('0xb')](_0x2d636a,_0x474e49)[_0x285d('0xc')](function(_0x162f0a){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2c8ccc,_0x285d('0xd'));logger[_0x285d('0xe')](_0x285d('0xf'),_0x2c8ccc,'request\x20sent',JSON[_0x285d('0x10')](_0x162f0a));if(_0x162f0a[_0x285d('0x11')]){if(_0x162f0a[_0x285d('0x11')][_0x285d('0x12')]===0x1f4){logger[_0x285d('0x11')](_0x285d('0x13'),_0x2c8ccc,_0x162f0a[_0x285d('0x11')][_0x285d('0x14')]);return _0x31e26a(_0x162f0a[_0x285d('0x11')][_0x285d('0x14')]);}logger[_0x285d('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2c8ccc,_0x162f0a[_0x285d('0x11')]['message']);return _0x4b1134(_0x162f0a[_0x285d('0x11')][_0x285d('0x14')]);}else{logger[_0x285d('0x15')](_0x285d('0x13'),_0x2c8ccc,'request\x20sent');_0x4b1134(_0x162f0a[_0x285d('0x16')]['message']);}})[_0x285d('0x17')](function(_0x4246f6){logger[_0x285d('0x11')](_0x285d('0x13'),_0x2c8ccc,_0x4246f6);_0x31e26a(_0x4246f6);});});}exports[_0x285d('0x18')]=function(_0x32c291){var _0x41e537=this;return new Promise(function(_0x41fb1e,_0x42564f){return db[_0x285d('0x19')][_0x285d('0x1a')]({'raw':!![],'where':{'ContactId':_0x32c291[_0x285d('0x1b')][_0x285d('0x1c')],'ListId':_0x32c291['body']['ListId'],'VoiceQueueId':_0x32c291[_0x285d('0x1b')][_0x285d('0x1d')]===undefined?null:_0x32c291[_0x285d('0x1b')][_0x285d('0x1d')],'CampaignId':_0x32c291[_0x285d('0x1b')][_0x285d('0x1e')]===undefined?null:_0x32c291['body']['CampaignId']}})[_0x285d('0xc')](function(_0xe153cb){if(_0xe153cb!=null){return db[_0x285d('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0xe153cb['id'],'OrderBy':{'$gt':_0xe153cb['OrderBy']}},'order':[[_0x285d('0x20'),_0x285d('0x21')]]})[_0x285d('0xc')](function(_0x100a71){var _0x2d7364=0x0;if(_0x100a71){if(_0x100a71[_0x285d('0x22')]+_0x100a71[_0x285d('0x23')]+_0x100a71[_0x285d('0x24')]+_0x100a71[_0x285d('0x25')]+_0x100a71['countdropretry']+_0x100a71[_0x285d('0x26')]+_0x100a71[_0x285d('0x27')]+_0x100a71[_0x285d('0x28')]<_0x32c291[_0x285d('0x29')][_0x285d('0x2a')])_0x2d7364=0x1;_0x41fb1e({'additional':_0x2d7364});}else{return db[_0x285d('0x1f')][_0x285d('0x1a')]({'raw':!![],'where':{'CmHopperId':_0xe153cb['id']},'order':[[_0x285d('0x20'),'ASC']]})[_0x285d('0xc')](function(_0x1ffb00){var _0x1e2d5f=0x0;if(_0x1ffb00){if(_0x1ffb00['countbusyretry']+_0x1ffb00[_0x285d('0x23')]+_0x1ffb00[_0x285d('0x24')]+_0x1ffb00[_0x285d('0x25')]+_0x1ffb00[_0x285d('0x2b')]+_0x1ffb00[_0x285d('0x26')]+_0x1ffb00['countmachineretry']+_0x1ffb00['countagentrejectretry']<_0x32c291[_0x285d('0x29')][_0x285d('0x2a')])_0x1e2d5f=0x1;_0x41fb1e({'additional':_0x1e2d5f});}else{_0x41fb1e({'additional':0x0});}})['catch'](function(_0x3a4e5f){logger[_0x285d('0x11')](_0x285d('0x18'),_0x3a4e5f[_0x285d('0x14')]);_0x42564f(_0x41e537[_0x285d('0x11')](0x1f4,_0x3a4e5f[_0x285d('0x14')]));});}})['catch'](function(_0x4b5bdd){logger['error'](_0x285d('0x18'),_0x4b5bdd[_0x285d('0x14')]);_0x42564f(_0x41e537[_0x285d('0x11')](0x1f4,_0x4b5bdd['message']));});}else _0x41fb1e({'additional':0x0});});});};exports[_0x285d('0x2c')]=function(_0x4fb90e){var _0x4d4c3e=this;return new Promise(function(_0x26304b,_0x2bb1b4){return db[_0x285d('0x19')][_0x285d('0x1a')]({'raw':!![],'where':{'ContactId':_0x4fb90e[_0x285d('0x1b')][_0x285d('0x1c')],'ListId':_0x4fb90e[_0x285d('0x1b')][_0x285d('0x2d')],'VoiceQueueId':_0x4fb90e['body'][_0x285d('0x1d')]===undefined?null:_0x4fb90e[_0x285d('0x1b')][_0x285d('0x1d')],'CampaignId':_0x4fb90e[_0x285d('0x1b')][_0x285d('0x1e')]===undefined?null:_0x4fb90e[_0x285d('0x1b')][_0x285d('0x1e')]}})[_0x285d('0xc')](function(_0x471c55){if(_0x471c55!=null){return db[_0x285d('0x1f')][_0x285d('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x471c55['id'],'OrderBy':{'$gte':_0x471c55['OrderBy']}},'order':[[_0x285d('0x20'),_0x285d('0x21')]]})[_0x285d('0xc')](function(_0x50dae9){if(_0x50dae9)return activateAdditionalPhone(_0x471c55,_0x4fb90e['body'],_0x50dae9,_0x4fb90e[_0x285d('0x2e')],_0x4fb90e[_0x285d('0x2f')])[_0x285d('0xc')](function(_0x30d51e){_0x26304b(_0x30d51e);});else{return db[_0x285d('0x1f')][_0x285d('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x471c55['id']},'order':[[_0x285d('0x20'),_0x285d('0x21')]]})[_0x285d('0xc')](function(_0x1df089){if(_0x1df089)return activateAdditionalPhone(_0x471c55,_0x4fb90e['body'],_0x1df089,_0x4fb90e[_0x285d('0x2e')],_0x4fb90e[_0x285d('0x2f')])[_0x285d('0xc')](function(_0x5528d4){_0x26304b(_0x5528d4);});else{_0x26304b({'id':_0x471c55['id'],'phone':''});}})[_0x285d('0x17')](function(_0x5b79da){logger[_0x285d('0x11')]('VerifyAdditionalPhones',_0x5b79da[_0x285d('0x14')]);_0x2bb1b4(_0x4d4c3e[_0x285d('0x11')](0x1f4,_0x5b79da[_0x285d('0x14')]));});}})['catch'](function(_0x5ad386){logger[_0x285d('0x11')](_0x285d('0x18'),_0x5ad386[_0x285d('0x14')]);_0x2bb1b4(_0x4d4c3e[_0x285d('0x11')](0x1f4,_0x5ad386['message']));});}else _0x26304b(0x1);});});};function activateAdditionalPhone(_0x850cc7,_0x1c5c09,_0x33b7e7,_0x473d7a,_0x3b331c){return new Promise(function(_0x39336d,_0x59d93d){var _0x253ef5;if(_[_0x285d('0x30')](_0x33b7e7['scheduledat'])){_0x33b7e7[_0x285d('0x31')]=moment();}if(moment()>moment(_0x33b7e7['scheduledat'])){_0x253ef5=moment()[_0x285d('0x32')](_0x3b331c||0x3,_0x285d('0x33'));}else{if(_0x33b7e7[_0x285d('0x20')]==0x0){_0x253ef5=moment(_0x33b7e7[_0x285d('0x31')]);}else{_0x253ef5=moment()[_0x285d('0x32')](_0x3b331c||0x3,_0x285d('0x33'));}}if(_[_0x285d('0x30')](_0x253ef5)){_0x253ef5=moment()[_0x285d('0x32')](_0x3b331c||0x3,_0x285d('0x33'));}var _0x3584a2={'phone':_0x850cc7[_0x285d('0x34')],'active':0x0,'OrderBy':_[_0x285d('0x30')](_0x850cc7[_0x285d('0x20')])?0x0:_0x850cc7[_0x285d('0x20')],'scheduledat':moment()['add'](_0x473d7a||0x1,_0x285d('0x33')),'countbusyretry':_0x1c5c09[_0x285d('0x22')],'countcongestionretry':_0x1c5c09['countcongestionretry'],'countnoanswerretry':_0x1c5c09[_0x285d('0x24')],'countnosuchnumberretry':_0x1c5c09[_0x285d('0x25')],'countdropretry':_0x1c5c09[_0x285d('0x2b')],'countabandonedretry':_0x1c5c09[_0x285d('0x26')],'countmachineretry':_0x1c5c09[_0x285d('0x27')],'countagentrejectretry':_0x1c5c09[_0x285d('0x28')],'createdAt':_0x1c5c09[_0x285d('0x35')],'updatedAt':_0x1c5c09[_0x285d('0x36')]};var _0x32c3c6={'CmHopperId':_0x850cc7['id'],'phone':_0x33b7e7['phone'],'active':0x0,'OrderBy':_[_0x285d('0x30')](_0x33b7e7[_0x285d('0x20')])?0x0:_0x33b7e7[_0x285d('0x20')],'scheduledat':_0x253ef5,'countbusyretry':_0x33b7e7[_0x285d('0x22')],'countcongestionretry':_0x33b7e7[_0x285d('0x23')],'countnoanswerretry':_0x33b7e7['countnoanswerretry'],'countnosuchnumberretry':_0x33b7e7[_0x285d('0x25')],'countdropretry':_0x33b7e7[_0x285d('0x2b')],'countabandonedretry':_0x33b7e7[_0x285d('0x26')],'countmachineretry':_0x33b7e7['countmachineretry'],'countagentrejectretry':_0x33b7e7[_0x285d('0x28')],'createdAt':_0x33b7e7[_0x285d('0x35')],'updatedAt':_0x33b7e7[_0x285d('0x36')]};return db[_0x285d('0x37')][_0x285d('0x38')](function(_0x49a7c2){return db['CmHopperAdditionalPhone'][_0x285d('0x39')](_0x3584a2,{'where':{'id':_0x33b7e7['id']}},{'transaction':_0x49a7c2})[_0x285d('0xc')](function(){return db['CmHopper'][_0x285d('0x39')](_0x32c3c6,{'where':{'id':_0x850cc7['id']}},{'transaction':_0x49a7c2});});})[_0x285d('0xc')](function(_0x2ea9b2){_0x39336d({'id':_0x850cc7['id'],'phone':_0x33b7e7['phone']});})[_0x285d('0x17')](function(_0x2c2c2b){logger[_0x285d('0x11')]('activateAdditionalPhone',_0x2c2c2b[_0x285d('0x14')]);_0x59d93d({'error':_0x2c2c2b[_0x285d('0x14')]});});});}exports[_0x285d('0x3a')]=function(_0x3dc25){var _0x1d69c8=this;return new Promise(function(_0x47d2df,_0x51930c){return db[_0x285d('0x19')][_0x285d('0x39')](_0x3dc25['body'][_0x285d('0x3b')],{'where':{'id':_0x3dc25[_0x285d('0x1b')]['id']}})[_0x285d('0xc')](function(_0x13cea1){_0x47d2df(_0x13cea1);})[_0x285d('0x17')](function(_0x81101c){logger['error'](_0x285d('0x3a'),_0x81101c[_0x285d('0x14')]);_0x51930c(_0x1d69c8['error'](0x1f4,_0x81101c['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index e920630..55b0fd2 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc3b7=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4b777e,_0x10c10d){var _0x32686e=function(_0x50d078){while(--_0x50d078){_0x4b777e['push'](_0x4b777e['shift']());}};_0x32686e(++_0x10c10d);}(_0xc3b7,0xb4));var _0x7c3b=function(_0x43a0ac,_0x31d904){_0x43a0ac=_0x43a0ac-0x0;var _0x430d8b=_0xc3b7[_0x43a0ac];return _0x430d8b;};'use strict';var multer=require('multer');var util=require(_0x7c3b('0x0'));var path=require(_0x7c3b('0x1'));var timeout=require(_0x7c3b('0x2'));var express=require(_0x7c3b('0x3'));var router=express[_0x7c3b('0x4')]();var fs_extra=require(_0x7c3b('0x5'));var auth=require(_0x7c3b('0x6'));var interaction=require(_0x7c3b('0x7'));var config=require(_0x7c3b('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0x7c3b('0x9')](),controller[_0x7c3b('0xa')]);router[_0x7c3b('0xb')](_0x7c3b('0xc'),auth['isAuthenticated'](),controller[_0x7c3b('0xd')]);router[_0x7c3b('0xe')]('/',auth[_0x7c3b('0x9')](),controller[_0x7c3b('0xf')]);router[_0x7c3b('0x10')](_0x7c3b('0xc'),auth[_0x7c3b('0x9')](),controller[_0x7c3b('0x11')]);router[_0x7c3b('0x12')](_0x7c3b('0xc'),auth[_0x7c3b('0x9')](),controller[_0x7c3b('0x13')]);module[_0x7c3b('0x14')]=router; \ No newline at end of file +var _0xd94e=['create','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x3e37de,_0x11682b){var _0x35ded9=function(_0x407e14){while(--_0x407e14){_0x3e37de['push'](_0x3e37de['shift']());}};_0x35ded9(++_0x11682b);}(_0xd94e,0x16e));var _0xed94=function(_0x21bfce,_0x4c2c80){_0x21bfce=_0x21bfce-0x0;var _0x1cd9e0=_0xd94e[_0x21bfce];return _0x1cd9e0;};'use strict';var multer=require('multer');var util=require(_0xed94('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xed94('0x1'));var router=express[_0xed94('0x2')]();var fs_extra=require(_0xed94('0x3'));var auth=require(_0xed94('0x4'));var interaction=require(_0xed94('0x5'));var config=require(_0xed94('0x6'));var controller=require(_0xed94('0x7'));router[_0xed94('0x8')]('/',auth[_0xed94('0x9')](),controller[_0xed94('0xa')]);router[_0xed94('0x8')](_0xed94('0xb'),auth[_0xed94('0x9')](),controller[_0xed94('0xc')]);router[_0xed94('0xd')]('/',auth[_0xed94('0x9')](),controller[_0xed94('0xe')]);router[_0xed94('0xf')]('/:id',auth[_0xed94('0x9')](),controller[_0xed94('0x10')]);router[_0xed94('0x11')](_0xed94('0xb'),auth[_0xed94('0x9')](),controller[_0xed94('0x12')]);module[_0xed94('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 4365560..2e848e0 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 _0xbea5=['moment','sequelize','STRING','INTEGER','contactListQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbea5,0x177));var _0x5bea=function(_0x1f5143,_0x5e31e6){_0x1f5143=_0x1f5143-0x0;var _0x383a38=_0xbea5[_0x1f5143];return _0x383a38;};'use strict';var moment=require(_0x5bea('0x0'));var Sequelize=require(_0x5bea('0x1'));module['exports']={'phone':{'type':Sequelize[_0x5bea('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5bea('0x3')],'unique':_0x5bea('0x4')},'ListId':{'type':Sequelize[_0x5bea('0x3')],'unique':_0x5bea('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xf0b0=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0xf0b0,0xc8));var _0x0f0b=function(_0x19d08c,_0x12c2d3){_0x19d08c=_0x19d08c-0x0;var _0x12c1c2=_0xf0b0[_0x19d08c];return _0x12c1c2;};'use strict';var moment=require(_0x0f0b('0x0'));var Sequelize=require(_0x0f0b('0x1'));module[_0x0f0b('0x2')]={'phone':{'type':Sequelize[_0x0f0b('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x0f0b('0x4')],'unique':_0x0f0b('0x5')},'ListId':{'type':Sequelize[_0x0f0b('0x4')],'unique':_0x0f0b('0x5')},'VoiceQueueId':{'type':Sequelize[_0x0f0b('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index a18e6d0..bd4d7da 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 _0x8ca0=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','CmHopperBlack','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse'];(function(_0x2cd747,_0x463491){var _0x1a0266=function(_0x27f156){while(--_0x27f156){_0x2cd747['push'](_0x2cd747['shift']());}};_0x1a0266(++_0x463491);}(_0x8ca0,0x16c));var _0x08ca=function(_0x3c4fb3,_0x2a2db7){_0x3c4fb3=_0x3c4fb3-0x0;var _0x5411b5=_0x8ca0[_0x3c4fb3];return _0x5411b5;};'use strict';var emlformat=require(_0x08ca('0x0'));var rimraf=require(_0x08ca('0x1'));var zipdir=require(_0x08ca('0x2'));var jsonpatch=require(_0x08ca('0x3'));var rp=require(_0x08ca('0x4'));var moment=require(_0x08ca('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x08ca('0x6'));var util=require(_0x08ca('0x7'));var path=require(_0x08ca('0x8'));var sox=require('sox');var csv=require(_0x08ca('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x08ca('0xa'));var _=require(_0x08ca('0xb'));var squel=require(_0x08ca('0xc'));var crypto=require(_0x08ca('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x08ca('0xe'));var toCsv=require(_0x08ca('0x9'));var querystring=require('querystring');var Papa=require(_0x08ca('0xf'));var Redis=require(_0x08ca('0x10'));var authService=require(_0x08ca('0x11'));var qs=require(_0x08ca('0x12'));var as=require(_0x08ca('0x13'));var hardwareService=require(_0x08ca('0x14'));var logger=require(_0x08ca('0x15'))(_0x08ca('0x16'));var utils=require(_0x08ca('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x08ca('0x18'))['db'];function respondWithStatusCode(_0x5c38d1,_0xf7db1f){_0xf7db1f=_0xf7db1f||0xcc;return function(_0x5723a7){if(_0x5723a7){return _0x5c38d1[_0x08ca('0x19')](_0xf7db1f);}return _0x5c38d1[_0x08ca('0x1a')](_0xf7db1f)[_0x08ca('0x1b')]();};}function respondWithResult(_0x528a72,_0x3ee7d4){_0x3ee7d4=_0x3ee7d4||0xc8;return function(_0x5e5f9c){if(_0x5e5f9c){return _0x528a72[_0x08ca('0x1a')](_0x3ee7d4)[_0x08ca('0x1c')](_0x5e5f9c);}};}function respondWithFilteredResult(_0x46c2e4,_0x37b2a7){return function(_0x4a67cd){if(_0x4a67cd){var _0x4464de=typeof _0x37b2a7[_0x08ca('0x1d')]===_0x08ca('0x1e')&&typeof _0x37b2a7['limit']===_0x08ca('0x1e');var _0x557ad6=_0x4a67cd[_0x08ca('0x1f')];var _0x41444f=_0x4464de?0x0:_0x37b2a7[_0x08ca('0x1d')];var _0x32c98e=_0x4464de?_0x4a67cd[_0x08ca('0x1f')]:_0x37b2a7[_0x08ca('0x1d')]+_0x37b2a7[_0x08ca('0x20')];var _0x745b1e;if(_0x32c98e>=_0x557ad6){_0x32c98e=_0x557ad6;_0x745b1e=0xc8;}else{_0x745b1e=0xce;}_0x46c2e4[_0x08ca('0x1a')](_0x745b1e);return _0x46c2e4[_0x08ca('0x21')]('Content-Range',_0x41444f+'-'+_0x32c98e+'/'+_0x557ad6)[_0x08ca('0x1c')](_0x4a67cd);}return null;};}function patchUpdates(_0x136a32){return function(_0xebad7e){try{jsonpatch[_0x08ca('0x22')](_0xebad7e,_0x136a32,!![]);}catch(_0x527267){return BPromise[_0x08ca('0x23')](_0x527267);}return _0xebad7e[_0x08ca('0x24')]();};}function saveUpdates(_0x4aa705,_0x570ea3){return function(_0x5d4992){if(_0x5d4992){return _0x5d4992[_0x08ca('0x25')](_0x4aa705)[_0x08ca('0x26')](function(_0x4f58b9){return _0x4f58b9;});}return null;};}function removeEntity(_0x50ad14,_0x2f6705){return function(_0x2fc402){if(_0x2fc402){return _0x2fc402['destroy']()['then'](function(){_0x50ad14[_0x08ca('0x1a')](0xcc)[_0x08ca('0x1b')]();});}};}function handleEntityNotFound(_0x59e825,_0x5a0ea6){return function(_0x4fb43f){if(!_0x4fb43f){_0x59e825[_0x08ca('0x19')](0x194);}return _0x4fb43f;};}function handleError(_0x571fd9,_0x2963fd){_0x2963fd=_0x2963fd||0x1f4;return function(_0x1b7675){logger[_0x08ca('0x27')](_0x1b7675[_0x08ca('0x28')]);if(_0x1b7675[_0x08ca('0x29')]){delete _0x1b7675[_0x08ca('0x29')];}_0x571fd9[_0x08ca('0x1a')](_0x2963fd)[_0x08ca('0x2a')](_0x1b7675);};}exports[_0x08ca('0x2b')]=function(_0x530704,_0x4d36e2){var _0x2c8692={},_0x4033d0={},_0x46e400={'count':0x0,'rows':[]};var _0x2a8107=_[_0x08ca('0x2c')](db['CmHopperBlack']['rawAttributes'],function(_0x1698df){return{'name':_0x1698df[_0x08ca('0x2d')],'type':_0x1698df[_0x08ca('0x2e')][_0x08ca('0x2f')]};});_0x4033d0[_0x08ca('0x30')]=_[_0x08ca('0x2c')](_0x2a8107,_0x08ca('0x29'));_0x4033d0['query']=_[_0x08ca('0x31')](_0x530704[_0x08ca('0x32')]);_0x4033d0[_0x08ca('0x33')]=_[_0x08ca('0x34')](_0x4033d0[_0x08ca('0x30')],_0x4033d0[_0x08ca('0x32')]);_0x2c8692[_0x08ca('0x35')]=_['intersection'](_0x4033d0[_0x08ca('0x30')],qs[_0x08ca('0x36')](_0x530704[_0x08ca('0x32')][_0x08ca('0x36')]));_0x2c8692[_0x08ca('0x35')]=_0x2c8692['attributes']['length']?_0x2c8692[_0x08ca('0x35')]:_0x4033d0['model'];if(!_0x530704['query'][_0x08ca('0x37')](_0x08ca('0x38'))){_0x2c8692[_0x08ca('0x20')]=qs[_0x08ca('0x20')](_0x530704[_0x08ca('0x32')][_0x08ca('0x20')]);_0x2c8692[_0x08ca('0x1d')]=qs[_0x08ca('0x1d')](_0x530704[_0x08ca('0x32')][_0x08ca('0x1d')]);}_0x2c8692[_0x08ca('0x39')]=qs[_0x08ca('0x3a')](_0x530704[_0x08ca('0x32')][_0x08ca('0x3a')]);_0x2c8692['where']=qs[_0x08ca('0x33')](_[_0x08ca('0x3b')](_0x530704[_0x08ca('0x32')],_0x4033d0[_0x08ca('0x33')]),_0x2a8107);if(_0x530704['query'][_0x08ca('0x3c')]){_0x2c8692['where']=_[_0x08ca('0x3d')](_0x2c8692[_0x08ca('0x3e')],{'$or':_[_0x08ca('0x2c')](_0x2a8107,function(_0x25f6aa){if(_0x25f6aa['type']!=='VIRTUAL'){var _0x3931fd={};_0x3931fd[_0x25f6aa[_0x08ca('0x29')]]={'$like':'%'+_0x530704['query'][_0x08ca('0x3c')]+'%'};return _0x3931fd;}})});}_0x2c8692=_['merge']({},_0x2c8692,_0x530704[_0x08ca('0x3f')]);var _0x2e846={'where':_0x2c8692[_0x08ca('0x3e')]};return db[_0x08ca('0x40')][_0x08ca('0x1f')](_0x2e846)[_0x08ca('0x26')](function(_0x26adf3){_0x46e400[_0x08ca('0x1f')]=_0x26adf3;if(_0x530704['query'][_0x08ca('0x41')]){_0x2c8692['include']=[{'all':!![]}];}return db[_0x08ca('0x40')][_0x08ca('0x42')](_0x2c8692);})[_0x08ca('0x26')](function(_0x263baa){_0x46e400[_0x08ca('0x43')]=_0x263baa;return _0x46e400;})['then'](respondWithFilteredResult(_0x4d36e2,_0x2c8692))[_0x08ca('0x44')](handleError(_0x4d36e2,null));};exports[_0x08ca('0x45')]=function(_0x10ffc7,_0x4e9c6d){var _0x3f6cee={'raw':!![],'where':{'id':_0x10ffc7[_0x08ca('0x46')]['id']}},_0x5d470a={};_0x5d470a[_0x08ca('0x30')]=_[_0x08ca('0x31')](db[_0x08ca('0x40')][_0x08ca('0x47')]);_0x5d470a[_0x08ca('0x32')]=_['keys'](_0x10ffc7[_0x08ca('0x32')]);_0x5d470a[_0x08ca('0x33')]=_['intersection'](_0x5d470a[_0x08ca('0x30')],_0x5d470a['query']);_0x3f6cee[_0x08ca('0x35')]=_['intersection'](_0x5d470a['model'],qs[_0x08ca('0x36')](_0x10ffc7['query'][_0x08ca('0x36')]));_0x3f6cee[_0x08ca('0x35')]=_0x3f6cee[_0x08ca('0x35')]['length']?_0x3f6cee[_0x08ca('0x35')]:_0x5d470a[_0x08ca('0x30')];if(_0x10ffc7[_0x08ca('0x32')][_0x08ca('0x41')]){_0x3f6cee[_0x08ca('0x48')]=[{'all':!![]}];}_0x3f6cee=_[_0x08ca('0x3d')]({},_0x3f6cee,_0x10ffc7[_0x08ca('0x3f')]);return db[_0x08ca('0x40')][_0x08ca('0x49')](_0x3f6cee)[_0x08ca('0x26')](handleEntityNotFound(_0x4e9c6d,null))[_0x08ca('0x26')](respondWithResult(_0x4e9c6d,null))['catch'](handleError(_0x4e9c6d,null));};exports['update']=function(_0x1bbd88,_0x213839){if(_0x1bbd88[_0x08ca('0x4a')]['id']){delete _0x1bbd88['body']['id'];}return db[_0x08ca('0x40')][_0x08ca('0x49')]({'where':{'id':_0x1bbd88[_0x08ca('0x46')]['id']}})[_0x08ca('0x26')](handleEntityNotFound(_0x213839,null))['then'](saveUpdates(_0x1bbd88['body'],null))[_0x08ca('0x26')](respondWithResult(_0x213839,null))['catch'](handleError(_0x213839,null));};exports['destroy']=function(_0x59629e,_0x241ca4){return db[_0x08ca('0x40')][_0x08ca('0x49')]({'where':{'id':_0x59629e[_0x08ca('0x46')]['id']}})[_0x08ca('0x26')](handleEntityNotFound(_0x241ca4,null))['then'](removeEntity(_0x241ca4,null))[_0x08ca('0x44')](handleError(_0x241ca4,null));};exports[_0x08ca('0x4b')]=function(_0x55737c,_0x1aecf3){return db['CmHopperBlack'][_0x08ca('0x4b')]()[_0x08ca('0x26')](respondWithResult(_0x1aecf3,null))[_0x08ca('0x44')](handleError(_0x1aecf3,null));}; \ No newline at end of file +var _0x04fc=['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','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','fields','attributes','length','order','sort','where','pick','filter','merge','options','include','findAll','show','params','includeAll','catch','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0x04fc,0x11c));var _0xc04f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x04fc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc04f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc04f('0x1'));var jsonpatch=require(_0xc04f('0x2'));var rp=require(_0xc04f('0x3'));var moment=require(_0xc04f('0x4'));var BPromise=require(_0xc04f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc04f('0x6'));var sox=require(_0xc04f('0x7'));var csv=require(_0xc04f('0x8'));var ejs=require(_0xc04f('0x9'));var fs=require('fs');var fs_extra=require(_0xc04f('0xa'));var _=require('lodash');var squel=require(_0xc04f('0xb'));var crypto=require(_0xc04f('0xc'));var jsforce=require(_0xc04f('0xd'));var deskjs=require(_0xc04f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc04f('0xf'));var Papa=require(_0xc04f('0x10'));var Redis=require(_0xc04f('0x11'));var authService=require(_0xc04f('0x12'));var qs=require(_0xc04f('0x13'));var as=require(_0xc04f('0x14'));var hardwareService=require(_0xc04f('0x15'));var logger=require(_0xc04f('0x16'))(_0xc04f('0x17'));var utils=require(_0xc04f('0x18'));var config=require(_0xc04f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc04f('0x1a'))['db'];function respondWithStatusCode(_0x432cff,_0xf28516){_0xf28516=_0xf28516||0xcc;return function(_0x274e5f){if(_0x274e5f){return _0x432cff[_0xc04f('0x1b')](_0xf28516);}return _0x432cff['status'](_0xf28516)['end']();};}function respondWithResult(_0x226b63,_0x1ea7f0){_0x1ea7f0=_0x1ea7f0||0xc8;return function(_0x577d1b){if(_0x577d1b){return _0x226b63[_0xc04f('0x1c')](_0x1ea7f0)[_0xc04f('0x1d')](_0x577d1b);}};}function respondWithFilteredResult(_0x2f7cd2,_0x5b05bd){return function(_0x319f03){if(_0x319f03){var _0x3e3fb5=typeof _0x5b05bd[_0xc04f('0x1e')]===_0xc04f('0x1f')&&typeof _0x5b05bd[_0xc04f('0x20')]===_0xc04f('0x1f');var _0x371ccd=_0x319f03[_0xc04f('0x21')];var _0xf1adb2=_0x3e3fb5?0x0:_0x5b05bd[_0xc04f('0x1e')];var _0x551c23=_0x3e3fb5?_0x319f03[_0xc04f('0x21')]:_0x5b05bd[_0xc04f('0x1e')]+_0x5b05bd[_0xc04f('0x20')];var _0x41af77;if(_0x551c23>=_0x371ccd){_0x551c23=_0x371ccd;_0x41af77=0xc8;}else{_0x41af77=0xce;}_0x2f7cd2['status'](_0x41af77);return _0x2f7cd2[_0xc04f('0x22')](_0xc04f('0x23'),_0xf1adb2+'-'+_0x551c23+'/'+_0x371ccd)[_0xc04f('0x1d')](_0x319f03);}return null;};}function patchUpdates(_0x567ce2){return function(_0x52ff76){try{jsonpatch[_0xc04f('0x24')](_0x52ff76,_0x567ce2,!![]);}catch(_0x205d19){return BPromise[_0xc04f('0x25')](_0x205d19);}return _0x52ff76[_0xc04f('0x26')]();};}function saveUpdates(_0x2bda09,_0x2fa5be){return function(_0x289f58){if(_0x289f58){return _0x289f58[_0xc04f('0x27')](_0x2bda09)[_0xc04f('0x28')](function(_0x4a2c1b){return _0x4a2c1b;});}return null;};}function removeEntity(_0x14c0ad,_0x5569b4){return function(_0x4f2e1a){if(_0x4f2e1a){return _0x4f2e1a[_0xc04f('0x29')]()[_0xc04f('0x28')](function(){_0x14c0ad[_0xc04f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18daef,_0x4f9393){return function(_0x442ae9){if(!_0x442ae9){_0x18daef['sendStatus'](0x194);}return _0x442ae9;};}function handleError(_0x24be36,_0x4fcaa8){_0x4fcaa8=_0x4fcaa8||0x1f4;return function(_0x18cd19){logger['error'](_0x18cd19['stack']);if(_0x18cd19[_0xc04f('0x2a')]){delete _0x18cd19[_0xc04f('0x2a')];}_0x24be36[_0xc04f('0x1c')](_0x4fcaa8)[_0xc04f('0x2b')](_0x18cd19);};}exports[_0xc04f('0x2c')]=function(_0x355114,_0x3a83e4){var _0x39ae24={},_0x2d64f0={},_0x347cab={'count':0x0,'rows':[]};var _0x1e2f30=_[_0xc04f('0x2d')](db[_0xc04f('0x2e')][_0xc04f('0x2f')],function(_0x573d7c){return{'name':_0x573d7c[_0xc04f('0x30')],'type':_0x573d7c[_0xc04f('0x31')][_0xc04f('0x32')]};});_0x2d64f0['model']=_[_0xc04f('0x2d')](_0x1e2f30,'name');_0x2d64f0['query']=_[_0xc04f('0x33')](_0x355114['query']);_0x2d64f0[_0xc04f('0x34')]=_[_0xc04f('0x35')](_0x2d64f0[_0xc04f('0x36')],_0x2d64f0[_0xc04f('0x37')]);_0x39ae24['attributes']=_[_0xc04f('0x35')](_0x2d64f0[_0xc04f('0x36')],qs[_0xc04f('0x38')](_0x355114['query'][_0xc04f('0x38')]));_0x39ae24[_0xc04f('0x39')]=_0x39ae24[_0xc04f('0x39')][_0xc04f('0x3a')]?_0x39ae24[_0xc04f('0x39')]:_0x2d64f0[_0xc04f('0x36')];if(!_0x355114[_0xc04f('0x37')]['hasOwnProperty']('nolimit')){_0x39ae24[_0xc04f('0x20')]=qs[_0xc04f('0x20')](_0x355114[_0xc04f('0x37')][_0xc04f('0x20')]);_0x39ae24[_0xc04f('0x1e')]=qs[_0xc04f('0x1e')](_0x355114['query'][_0xc04f('0x1e')]);}_0x39ae24[_0xc04f('0x3b')]=qs[_0xc04f('0x3c')](_0x355114[_0xc04f('0x37')][_0xc04f('0x3c')]);_0x39ae24[_0xc04f('0x3d')]=qs[_0xc04f('0x34')](_[_0xc04f('0x3e')](_0x355114['query'],_0x2d64f0[_0xc04f('0x34')]),_0x1e2f30);if(_0x355114[_0xc04f('0x37')][_0xc04f('0x3f')]){_0x39ae24['where']=_[_0xc04f('0x40')](_0x39ae24[_0xc04f('0x3d')],{'$or':_[_0xc04f('0x2d')](_0x1e2f30,function(_0x1bd671){if(_0x1bd671[_0xc04f('0x31')]!=='VIRTUAL'){var _0x508cd5={};_0x508cd5[_0x1bd671[_0xc04f('0x2a')]]={'$like':'%'+_0x355114[_0xc04f('0x37')]['filter']+'%'};return _0x508cd5;}})});}_0x39ae24=_['merge']({},_0x39ae24,_0x355114[_0xc04f('0x41')]);var _0xe85d7d={'where':_0x39ae24['where']};return db[_0xc04f('0x2e')][_0xc04f('0x21')](_0xe85d7d)[_0xc04f('0x28')](function(_0x1a8ab4){_0x347cab[_0xc04f('0x21')]=_0x1a8ab4;if(_0x355114[_0xc04f('0x37')]['includeAll']){_0x39ae24[_0xc04f('0x42')]=[{'all':!![]}];}return db[_0xc04f('0x2e')][_0xc04f('0x43')](_0x39ae24);})[_0xc04f('0x28')](function(_0x4a1382){_0x347cab['rows']=_0x4a1382;return _0x347cab;})[_0xc04f('0x28')](respondWithFilteredResult(_0x3a83e4,_0x39ae24))['catch'](handleError(_0x3a83e4,null));};exports[_0xc04f('0x44')]=function(_0x24714e,_0xf8c309){var _0x52693b={'raw':!![],'where':{'id':_0x24714e[_0xc04f('0x45')]['id']}},_0x36f775={};_0x36f775[_0xc04f('0x36')]=_[_0xc04f('0x33')](db['CmHopperBlack'][_0xc04f('0x2f')]);_0x36f775[_0xc04f('0x37')]=_[_0xc04f('0x33')](_0x24714e[_0xc04f('0x37')]);_0x36f775[_0xc04f('0x34')]=_[_0xc04f('0x35')](_0x36f775['model'],_0x36f775[_0xc04f('0x37')]);_0x52693b['attributes']=_['intersection'](_0x36f775[_0xc04f('0x36')],qs[_0xc04f('0x38')](_0x24714e['query']['fields']));_0x52693b[_0xc04f('0x39')]=_0x52693b[_0xc04f('0x39')][_0xc04f('0x3a')]?_0x52693b[_0xc04f('0x39')]:_0x36f775[_0xc04f('0x36')];if(_0x24714e[_0xc04f('0x37')][_0xc04f('0x46')]){_0x52693b[_0xc04f('0x42')]=[{'all':!![]}];}_0x52693b=_[_0xc04f('0x40')]({},_0x52693b,_0x24714e[_0xc04f('0x41')]);return db[_0xc04f('0x2e')]['find'](_0x52693b)[_0xc04f('0x28')](handleEntityNotFound(_0xf8c309,null))['then'](respondWithResult(_0xf8c309,null))[_0xc04f('0x47')](handleError(_0xf8c309,null));};exports['update']=function(_0x48caa7,_0xb4446e){if(_0x48caa7['body']['id']){delete _0x48caa7['body']['id'];}return db[_0xc04f('0x2e')]['find']({'where':{'id':_0x48caa7['params']['id']}})['then'](handleEntityNotFound(_0xb4446e,null))[_0xc04f('0x28')](saveUpdates(_0x48caa7[_0xc04f('0x48')],null))['then'](respondWithResult(_0xb4446e,null))[_0xc04f('0x47')](handleError(_0xb4446e,null));};exports['destroy']=function(_0x3118fb,_0x4d7373){return db[_0xc04f('0x2e')][_0xc04f('0x49')]({'where':{'id':_0x3118fb['params']['id']}})[_0xc04f('0x28')](handleEntityNotFound(_0x4d7373,null))[_0xc04f('0x28')](removeEntity(_0x4d7373,null))[_0xc04f('0x47')](handleError(_0x4d7373,null));};exports[_0xc04f('0x4a')]=function(_0x111f0e,_0x2a0f35){return db['CmHopperBlack'][_0xc04f('0x4a')]()[_0xc04f('0x28')](respondWithResult(_0x2a0f35,null))[_0xc04f('0x47')](handleError(_0x2a0f35,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index b9c58c6..cc64eb3 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 _0x73d0=['bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','util','api','moment'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0x73d0,0x69));var _0x073d=function(_0x3b5377,_0x1cf47a){_0x3b5377=_0x3b5377-0x0;var _0x40ffde=_0x73d0[_0x3b5377];return _0x40ffde;};'use strict';var _=require('lodash');var util=require(_0x073d('0x0'));var logger=require('../../config/logger')(_0x073d('0x1'));var moment=require(_0x073d('0x2'));var BPromise=require(_0x073d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x073d('0x4'));var rimraf=require(_0x073d('0x5'));var config=require(_0x073d('0x6'));var attributes=require(_0x073d('0x7'));module[_0x073d('0x8')]=function(_0xf78912,_0x3888d3){return _0xf78912[_0x073d('0x9')](_0x073d('0xa'),attributes,{'tableName':_0x073d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5b4=['api','moment','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger'];(function(_0x302582,_0x2befa8){var _0x1c2e28=function(_0x796cbc){while(--_0x796cbc){_0x302582['push'](_0x302582['shift']());}};_0x1c2e28(++_0x2befa8);}(_0xc5b4,0x174));var _0x4c5b=function(_0x38f246,_0x594ba3){_0x38f246=_0x38f246-0x0;var _0x3b3cf7=_0xc5b4[_0x38f246];return _0x3b3cf7;};'use strict';var _=require(_0x4c5b('0x0'));var util=require('util');var logger=require(_0x4c5b('0x1'))(_0x4c5b('0x2'));var moment=require(_0x4c5b('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c5b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c5b('0x5'));var config=require(_0x4c5b('0x6'));var attributes=require(_0x4c5b('0x7'));module['exports']=function(_0x55fc78,_0xa88b35){return _0x55fc78[_0x4c5b('0x8')](_0x4c5b('0x9'),attributes,{'tableName':_0x4c5b('0xa'),'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 688f117..5538419 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 _0xe3c8=['message','GetCmHopperBlack','findAll','options','where','attributes','limit','include','map','model','debug','catch','CmHopperBlack','update','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','code','error'];(function(_0x13cacd,_0x3db28f){var _0x3c4cd1=function(_0x270afc){while(--_0x270afc){_0x13cacd['push'](_0x13cacd['shift']());}};_0x3c4cd1(++_0x3db28f);}(_0xe3c8,0xa1));var _0x8e3c=function(_0x46ee5b,_0x8418bd){_0x46ee5b=_0x46ee5b-0x0;var _0xbe0dc8=_0xe3c8[_0x46ee5b];return _0xbe0dc8;};'use strict';var _=require(_0x8e3c('0x0'));var util=require(_0x8e3c('0x1'));var moment=require(_0x8e3c('0x2'));var BPromise=require(_0x8e3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e3c('0x4'));var db=require(_0x8e3c('0x5'))['db'];var utils=require(_0x8e3c('0x6'));var logger=require('../../config/logger')(_0x8e3c('0x7'));var config=require(_0x8e3c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8e3c('0x9')][_0x8e3c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11077a,_0x22ed3c,_0x4d64c5){return new BPromise(function(_0xe2265e,_0x38bc11){return client[_0x8e3c('0xb')](_0x11077a,_0x4d64c5)[_0x8e3c('0xc')](function(_0x11f16b){logger[_0x8e3c('0xd')](_0x8e3c('0xe'),_0x22ed3c,_0x8e3c('0xf'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x22ed3c,_0x8e3c('0xf'),JSON[_0x8e3c('0x10')](_0x11f16b));if(_0x11f16b['error']){if(_0x11f16b['error'][_0x8e3c('0x11')]===0x1f4){logger[_0x8e3c('0x12')](_0x8e3c('0xe'),_0x22ed3c,_0x11f16b[_0x8e3c('0x12')][_0x8e3c('0x13')]);return _0x38bc11(_0x11f16b['error'][_0x8e3c('0x13')]);}logger[_0x8e3c('0x12')](_0x8e3c('0xe'),_0x22ed3c,_0x11f16b['error'][_0x8e3c('0x13')]);return _0xe2265e(_0x11f16b['error'][_0x8e3c('0x13')]);}else{logger[_0x8e3c('0xd')](_0x8e3c('0xe'),_0x22ed3c,_0x8e3c('0xf'));_0xe2265e(_0x11f16b['result'][_0x8e3c('0x13')]);}})['catch'](function(_0x259c8c){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x22ed3c,_0x259c8c);_0x38bc11(_0x259c8c);});});}exports[_0x8e3c('0x14')]=function(_0x522164){var _0x7c4c0c=this;return new Promise(function(_0x54c3e0,_0x5993e1){return db['CmHopperBlack'][_0x8e3c('0x15')]({'raw':_0x522164[_0x8e3c('0x16')]?_0x522164[_0x8e3c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x522164[_0x8e3c('0x16')]?_0x522164[_0x8e3c('0x16')][_0x8e3c('0x17')]||null:null,'attributes':_0x522164[_0x8e3c('0x16')]?_0x522164[_0x8e3c('0x16')][_0x8e3c('0x18')]||null:null,'limit':_0x522164[_0x8e3c('0x16')]?_0x522164[_0x8e3c('0x16')][_0x8e3c('0x19')]||null:null,'include':_0x522164['options']?_0x522164[_0x8e3c('0x16')][_0x8e3c('0x1a')]?_[_0x8e3c('0x1b')](_0x522164[_0x8e3c('0x16')][_0x8e3c('0x1a')],function(_0x1ef0f5){return{'model':db[_0x1ef0f5[_0x8e3c('0x1c')]],'as':_0x1ef0f5['as'],'attributes':_0x1ef0f5['attributes'],'include':_0x1ef0f5[_0x8e3c('0x1a')]?_[_0x8e3c('0x1b')](_0x1ef0f5[_0x8e3c('0x1a')],function(_0x272642){return{'model':db[_0x272642[_0x8e3c('0x1c')]],'as':_0x272642['as'],'attributes':_0x272642[_0x8e3c('0x18')],'include':_0x272642[_0x8e3c('0x1a')]?_[_0x8e3c('0x1b')](_0x272642[_0x8e3c('0x1a')],function(_0x540537){return{'model':db[_0x540537[_0x8e3c('0x1c')]],'as':_0x540537['as'],'attributes':_0x540537['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e3c('0xc')](function(_0xf656f2){logger[_0x8e3c('0xd')](_0x8e3c('0x14'),_0x522164);logger[_0x8e3c('0x1d')]('GetCmHopperBlack',_0x522164,JSON['stringify'](_0xf656f2));_0x54c3e0(_0xf656f2);})[_0x8e3c('0x1e')](function(_0x358b19){logger['error']('GetCmHopperBlack',_0x358b19[_0x8e3c('0x13')],_0x522164);_0x5993e1(_0x7c4c0c[_0x8e3c('0x12')](0x1f4,_0x358b19[_0x8e3c('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x1c87b0){var _0x572d08=this;return new Promise(function(_0x128ee1,_0x2b371e){return db[_0x8e3c('0x1f')][_0x8e3c('0x20')](_0x1c87b0['body'],{'raw':_0x1c87b0[_0x8e3c('0x16')]?_0x1c87b0[_0x8e3c('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c87b0[_0x8e3c('0x16')]?_0x1c87b0[_0x8e3c('0x16')][_0x8e3c('0x17')]||null:null,'attributes':_0x1c87b0[_0x8e3c('0x16')]?_0x1c87b0[_0x8e3c('0x16')][_0x8e3c('0x18')]||null:null,'limit':_0x1c87b0[_0x8e3c('0x16')]?_0x1c87b0[_0x8e3c('0x16')]['limit']||null:null})[_0x8e3c('0xc')](function(_0x2b31c6){logger[_0x8e3c('0xd')](_0x8e3c('0x21'),_0x1c87b0);logger[_0x8e3c('0x1d')](_0x8e3c('0x21'),_0x1c87b0,JSON['stringify'](_0x2b31c6));_0x128ee1(_0x2b31c6);})[_0x8e3c('0x1e')](function(_0x1d79db){logger[_0x8e3c('0x12')](_0x8e3c('0x21'),_0x1d79db['message'],_0x1c87b0);_0x2b371e(_0x572d08[_0x8e3c('0x12')](0x1f4,_0x1d79db[_0x8e3c('0x13')]));});});};exports[_0x8e3c('0x22')]=function(_0x9130f3){var _0x3c5513=this;return new Promise(function(_0x34e656,_0x5dfdad){return db[_0x8e3c('0x1f')][_0x8e3c('0x23')]({'where':_0x9130f3[_0x8e3c('0x16')]?_0x9130f3[_0x8e3c('0x16')]['where']||null:null})['then'](function(_0x281914){logger[_0x8e3c('0xd')](_0x8e3c('0x22'),_0x9130f3);logger[_0x8e3c('0x1d')](_0x8e3c('0x22'),_0x9130f3,JSON[_0x8e3c('0x10')](_0x281914));_0x34e656(_0x281914);})[_0x8e3c('0x1e')](function(_0x3202ea){logger[_0x8e3c('0x12')]('DestroyCmHopperBlack',_0x3202ea[_0x8e3c('0x13')],_0x9130f3);_0x5dfdad(_0x3c5513[_0x8e3c('0x12')](0x1f4,_0x3202ea['message']));});});}; \ No newline at end of file +var _0xeb19=['then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopperBlack','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb19,0x1a1));var _0x9eb1=function(_0x5a7124,_0x5adc9e){_0x5a7124=_0x5a7124-0x0;var _0x5a4fd3=_0xeb19[_0x5a7124];return _0x5a4fd3;};'use strict';var _=require(_0x9eb1('0x0'));var util=require(_0x9eb1('0x1'));var moment=require(_0x9eb1('0x2'));var BPromise=require(_0x9eb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9eb1('0x4'));var db=require(_0x9eb1('0x5'))['db'];var utils=require(_0x9eb1('0x6'));var logger=require(_0x9eb1('0x7'))(_0x9eb1('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9eb1('0x9')][_0x9eb1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c6c30,_0x13f994,_0x1a08f3){return new BPromise(function(_0x127794,_0x1ce3a1){return client[_0x9eb1('0xb')](_0x2c6c30,_0x1a08f3)[_0x9eb1('0xc')](function(_0x134f64){logger['info'](_0x9eb1('0xd'),_0x13f994,_0x9eb1('0xe'));logger['debug'](_0x9eb1('0xf'),_0x13f994,_0x9eb1('0xe'),JSON[_0x9eb1('0x10')](_0x134f64));if(_0x134f64[_0x9eb1('0x11')]){if(_0x134f64[_0x9eb1('0x11')][_0x9eb1('0x12')]===0x1f4){logger[_0x9eb1('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x13f994,_0x134f64[_0x9eb1('0x11')][_0x9eb1('0x13')]);return _0x1ce3a1(_0x134f64[_0x9eb1('0x11')][_0x9eb1('0x13')]);}logger[_0x9eb1('0x11')](_0x9eb1('0xd'),_0x13f994,_0x134f64['error'][_0x9eb1('0x13')]);return _0x127794(_0x134f64['error'][_0x9eb1('0x13')]);}else{logger[_0x9eb1('0x14')](_0x9eb1('0xd'),_0x13f994,_0x9eb1('0xe'));_0x127794(_0x134f64[_0x9eb1('0x15')][_0x9eb1('0x13')]);}})[_0x9eb1('0x16')](function(_0x10ee5d){logger[_0x9eb1('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x13f994,_0x10ee5d);_0x1ce3a1(_0x10ee5d);});});}exports['GetCmHopperBlack']=function(_0x4270a0){var _0x2eb599=this;return new Promise(function(_0x2f23b5,_0x24b841){return db[_0x9eb1('0x17')][_0x9eb1('0x18')]({'raw':_0x4270a0['options']?_0x4270a0[_0x9eb1('0x19')][_0x9eb1('0x1a')]===undefined?!![]:![]:!![],'where':_0x4270a0[_0x9eb1('0x19')]?_0x4270a0[_0x9eb1('0x19')][_0x9eb1('0x1b')]||null:null,'attributes':_0x4270a0['options']?_0x4270a0[_0x9eb1('0x19')][_0x9eb1('0x1c')]||null:null,'limit':_0x4270a0['options']?_0x4270a0['options'][_0x9eb1('0x1d')]||null:null,'include':_0x4270a0[_0x9eb1('0x19')]?_0x4270a0[_0x9eb1('0x19')][_0x9eb1('0x1e')]?_[_0x9eb1('0x1f')](_0x4270a0['options'][_0x9eb1('0x1e')],function(_0x49f378){return{'model':db[_0x49f378[_0x9eb1('0x20')]],'as':_0x49f378['as'],'attributes':_0x49f378[_0x9eb1('0x1c')],'include':_0x49f378[_0x9eb1('0x1e')]?_[_0x9eb1('0x1f')](_0x49f378[_0x9eb1('0x1e')],function(_0x1b85bb){return{'model':db[_0x1b85bb[_0x9eb1('0x20')]],'as':_0x1b85bb['as'],'attributes':_0x1b85bb[_0x9eb1('0x1c')],'include':_0x1b85bb[_0x9eb1('0x1e')]?_[_0x9eb1('0x1f')](_0x1b85bb[_0x9eb1('0x1e')],function(_0x3b0aab){return{'model':db[_0x3b0aab['model']],'as':_0x3b0aab['as'],'attributes':_0x3b0aab[_0x9eb1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9eb1('0xc')](function(_0x5d3fd4){logger['info'](_0x9eb1('0x21'),_0x4270a0);logger['debug'](_0x9eb1('0x21'),_0x4270a0,JSON[_0x9eb1('0x10')](_0x5d3fd4));_0x2f23b5(_0x5d3fd4);})[_0x9eb1('0x16')](function(_0x8e88a0){logger[_0x9eb1('0x11')](_0x9eb1('0x21'),_0x8e88a0[_0x9eb1('0x13')],_0x4270a0);_0x24b841(_0x2eb599[_0x9eb1('0x11')](0x1f4,_0x8e88a0[_0x9eb1('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0xb5bffe){var _0x1bc18b=this;return new Promise(function(_0x3b49ed,_0x56954b){return db[_0x9eb1('0x17')][_0x9eb1('0x22')](_0xb5bffe[_0x9eb1('0x23')],{'raw':_0xb5bffe[_0x9eb1('0x19')]?_0xb5bffe[_0x9eb1('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb5bffe[_0x9eb1('0x19')]?_0xb5bffe[_0x9eb1('0x19')]['where']||null:null,'attributes':_0xb5bffe['options']?_0xb5bffe['options'][_0x9eb1('0x1c')]||null:null,'limit':_0xb5bffe[_0x9eb1('0x19')]?_0xb5bffe['options'][_0x9eb1('0x1d')]||null:null})[_0x9eb1('0xc')](function(_0x350903){logger[_0x9eb1('0x14')](_0x9eb1('0x24'),_0xb5bffe);logger['debug'](_0x9eb1('0x24'),_0xb5bffe,JSON[_0x9eb1('0x10')](_0x350903));_0x3b49ed(_0x350903);})[_0x9eb1('0x16')](function(_0x5a70d6){logger['error'](_0x9eb1('0x24'),_0x5a70d6[_0x9eb1('0x13')],_0xb5bffe);_0x56954b(_0x1bc18b['error'](0x1f4,_0x5a70d6[_0x9eb1('0x13')]));});});};exports[_0x9eb1('0x25')]=function(_0x4e5771){var _0x35cf64=this;return new Promise(function(_0x491a98,_0x11cab7){return db[_0x9eb1('0x17')]['destroy']({'where':_0x4e5771[_0x9eb1('0x19')]?_0x4e5771['options'][_0x9eb1('0x1b')]||null:null})[_0x9eb1('0xc')](function(_0x4e5f50){logger['info']('DestroyCmHopperBlack',_0x4e5771);logger[_0x9eb1('0x26')](_0x9eb1('0x25'),_0x4e5771,JSON[_0x9eb1('0x10')](_0x4e5f50));_0x491a98(_0x4e5f50);})['catch'](function(_0xace3b8){logger[_0x9eb1('0x11')](_0x9eb1('0x25'),_0xace3b8[_0x9eb1('0x13')],_0x4e5771);_0x11cab7(_0x35cf64['error'](0x1f4,_0xace3b8[_0x9eb1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 92fa231..39115ff 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 _0x27a0=['isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','./cmHopperBlack.controller','get'];(function(_0x1f1bf8,_0x48c57d){var _0xcefd99=function(_0xd6ae83){while(--_0xd6ae83){_0x1f1bf8['push'](_0x1f1bf8['shift']());}};_0xcefd99(++_0x48c57d);}(_0x27a0,0xbf));var _0x027a=function(_0x1b706d,_0x25d6e8){_0x1b706d=_0x1b706d-0x0;var _0x22360e=_0x27a0[_0x1b706d];return _0x22360e;};'use strict';var multer=require('multer');var util=require(_0x027a('0x0'));var path=require(_0x027a('0x1'));var timeout=require(_0x027a('0x2'));var express=require(_0x027a('0x3'));var router=express[_0x027a('0x4')]();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(_0x027a('0x5'));router[_0x027a('0x6')]('/',auth[_0x027a('0x7')](),controller[_0x027a('0x8')]);router[_0x027a('0x6')](_0x027a('0x9'),auth['isAuthenticated'](),controller[_0x027a('0xa')]);router[_0x027a('0x6')](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0xc')]);router[_0x027a('0xd')](_0x027a('0xb'),auth['isAuthenticated'](),controller[_0x027a('0xe')]);router[_0x027a('0xf')](_0x027a('0xb'),auth[_0x027a('0x7')](),controller[_0x027a('0x10')]);module[_0x027a('0x11')]=router; \ No newline at end of file +var _0xe2fe=['/describe','describe','/:id','put','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1af0e5,_0x152990){var _0x3c444a=function(_0x3b3d13){while(--_0x3b3d13){_0x1af0e5['push'](_0x1af0e5['shift']());}};_0x3c444a(++_0x152990);}(_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('./cmHopperBlack.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')](_0xee2f('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xee2f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index c61d7ec..b45dbe3 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 _0x689b=['getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x9481a3,_0x4886b5){var _0x3bf3de=function(_0x53fc6e){while(--_0x53fc6e){_0x9481a3['push'](_0x9481a3['shift']());}};_0x3bf3de(++_0x4886b5);}(_0x689b,0x119));var _0xb689=function(_0x3fc98a,_0x4b83f9){_0x3fc98a=_0x3fc98a-0x0;var _0x529131=_0x689b[_0x3fc98a];return _0x529131;};'use strict';var Sequelize=require(_0xb689('0x0'));var moment=require('moment');module[_0xb689('0x1')]={'state':{'type':Sequelize[_0xb689('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb689('0x3')]},'scheduledat':{'type':Sequelize[_0xb689('0x4')]},'countbusyretry':{'type':Sequelize[_0xb689('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb689('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb689('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb689('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb689('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xb689('0x3')]},'calleridnum':{'type':Sequelize[_0xb689('0x3')]},'calleridname':{'type':Sequelize[_0xb689('0x3')]},'starttime':{'type':Sequelize[_0xb689('0x4')]},'responsetime':{'type':Sequelize[_0xb689('0x4')]},'answertime':{'type':Sequelize[_0xb689('0x4')]},'droptime':{'type':Sequelize[_0xb689('0x4')]},'endtime':{'type':Sequelize[_0xb689('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb689('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb689('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb689('0x3')]},'campaign':{'type':Sequelize[_0xb689('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb689('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xb689('0x4')],'set':function(_0x4bd18b){var _0x59aa2e=this[_0xb689('0x5')](_0xb689('0x6'));if(_0x59aa2e&&_0x4bd18b){this[_0xb689('0x7')](_0xb689('0x8'),moment(_0x4bd18b)[_0xb689('0x9')](moment(_0x59aa2e),'seconds'));}}},'amd':{'type':Sequelize[_0xb689('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb689('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xb689('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xb689('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xb689('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xb689('0x4')]},'recallme':{'type':Sequelize[_0xb689('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xb689('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb689('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb689('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb689('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x61b2=['DATE','getDataValue','endtime','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x61b2,0x97));var _0x261b=function(_0x265d8d,_0x43f9e8){_0x265d8d=_0x265d8d-0x0;var _0x5875b6=_0x61b2[_0x265d8d];return _0x5875b6;};'use strict';var Sequelize=require(_0x261b('0x0'));var moment=require(_0x261b('0x1'));module[_0x261b('0x2')]={'state':{'type':Sequelize[_0x261b('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x261b('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x261b('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x261b('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x261b('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x261b('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x261b('0x4')]},'originatecalleridname':{'type':Sequelize[_0x261b('0x4')]},'calleridnum':{'type':Sequelize[_0x261b('0x4')]},'calleridname':{'type':Sequelize[_0x261b('0x4')]},'starttime':{'type':Sequelize[_0x261b('0x5')]},'responsetime':{'type':Sequelize[_0x261b('0x5')]},'answertime':{'type':Sequelize[_0x261b('0x5')]},'droptime':{'type':Sequelize[_0x261b('0x5')]},'endtime':{'type':Sequelize[_0x261b('0x5')]},'ringtime':{'type':Sequelize[_0x261b('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x261b('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x261b('0x4')]},'campaign':{'type':Sequelize[_0x261b('0x4')]},'campaigntype':{'type':Sequelize[_0x261b('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x261b('0x4')]},'disposition':{'type':Sequelize[_0x261b('0x4')]},'secondDisposition':{'type':Sequelize[_0x261b('0x4')]},'thirdDisposition':{'type':Sequelize[_0x261b('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x11af55){var _0x3aaef8=this[_0x261b('0x6')](_0x261b('0x7'));if(_0x3aaef8&&_0x11af55){this['setDataValue'](_0x261b('0x8'),moment(_0x11af55)[_0x261b('0x9')](moment(_0x3aaef8),_0x261b('0xa')));}}},'amd':{'type':Sequelize[_0x261b('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x261b('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x261b('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x261b('0x5')]},'callback':{'type':Sequelize[_0x261b('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x261b('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x261b('0x5')]},'deleted':{'type':Sequelize[_0x261b('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x261b('0x5')]},'recallme':{'type':Sequelize[_0x261b('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x261b('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x261b('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x261b('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x261b('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x261b('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 b4ac67c..4f6b395 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 _0xf61e=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','describe','update','body','uniqueid','params','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','noSuchContacts','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','cm_hopper','phone','scheduledAt','VoiceQueueId','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','fromQuery','ContactId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','checkContactHopper','findOne','eml-format'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xf61e,0x191));var _0xef61=function(_0x51d9dc,_0xcd495a){_0x51d9dc=_0x51d9dc-0x0;var _0xb0a597=_0xf61e[_0x51d9dc];return _0xb0a597;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['CmHopperFinal']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':!![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')]()['then'](respondWithResult(_0x47b09d,null))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x13d0f8,_0x2904e0){if(_0x13d0f8[_0xef61('0x4a')][_0xef61('0x4b')]){delete _0x13d0f8[_0xef61('0x4a')]['uniqueid'];}return db[_0xef61('0x30')]['find']({'where':{'uniqueid':_0x13d0f8[_0xef61('0x4c')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x2904e0,null))[_0xef61('0x28')](saveUpdates(_0x13d0f8[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x2904e0,null))[_0xef61('0x45')](handleError(_0x2904e0,null));};exports[_0xef61('0x4d')]=function(_0x1565c7,_0x264877,_0x4af2f3){return db[_0xef61('0x30')][_0xef61('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x1565c7['params']['id']},'attributes':[[db['sequelize']['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db['sequelize'][_0xef61('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0xef61('0x51')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')]('`state`\x20=\x203,\x201,\x20null'))),_0xef61('0x52')],[db[_0xef61('0x4f')]['fn']('COUNT',db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xef61('0x53')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xef61('0x54')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x55')))),_0xef61('0x56')],[db['sequelize']['fn']('COUNT',db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x57')))),_0xef61('0x58')],[db['sequelize']['fn'](_0xef61('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0xef61('0x50')](_0xef61('0x59')))),_0xef61('0x5a')],[db['sequelize']['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x5b')))),_0xef61('0x5c')]]})[_0xef61('0x28')](handleEntityNotFound(_0x264877,null))[_0xef61('0x28')](respondWithResult(_0x264877,null))[_0xef61('0x45')](handleError(_0x264877,null));};exports[_0xef61('0x5d')]=function(_0x5507ee,_0x15a8c5,_0x4b26e6){return db['CmHopperFinal'][_0xef61('0x44')]({'raw':![],'where':{'CampaignId':_0x5507ee[_0xef61('0x4c')]['id']},'attributes':[[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xef61('0x51')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x5e')))),_0xef61('0x52')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db['sequelize'][_0xef61('0x50')](_0xef61('0x5f')))),'busyContacts'],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x60')))),_0xef61('0x54')],[db[_0xef61('0x4f')]['fn']('COUNT',db[_0xef61('0x4f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xef61('0x56')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db['sequelize']['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x57')))),_0xef61('0x58')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x59')))),_0xef61('0x5a')],[db[_0xef61('0x4f')]['fn'](_0xef61('0x4e'),db[_0xef61('0x4f')]['fn']('IF',db[_0xef61('0x4f')][_0xef61('0x50')](_0xef61('0x5b')))),_0xef61('0x5c')]]})['then'](handleEntityNotFound(_0x15a8c5,null))[_0xef61('0x28')](respondWithResult(_0x15a8c5,null))[_0xef61('0x45')](handleError(_0x15a8c5,null));};exports[_0xef61('0x61')]=function(_0x5ab4fe,_0x38117b,_0x346752){return db['VoiceQueue'][_0xef61('0x47')]({'where':{'id':_0x5ab4fe[_0xef61('0x4c')]['id']}})['then'](handleEntityNotFound(_0x38117b,null))[_0xef61('0x28')](function(_0x54777a){var _0xe62ec2;if(_0x54777a){_0xe62ec2=squel[_0xef61('0x62')]()['into'](_0xef61('0x63'))['fromQuery']([_0xef61('0x64'),_0xef61('0x65'),'ContactId','ListId',_0xef61('0x66'),_0xef61('0x67'),_0xef61('0x68')],squel[_0xef61('0x69')]()[_0xef61('0x6a')]('ANY_VALUE(calleridnum)',_0xef61('0x64'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x65'))[_0xef61('0x6a')](_0xef61('0x6c'),'ContactId')[_0xef61('0x6a')]('ANY_VALUE(ListId)',_0xef61('0x6d'))[_0xef61('0x6a')](_0xef61('0x6e'),_0xef61('0x66'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x67'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x68'))[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')]('VoiceQueueId\x20=\x20?',_0x5ab4fe[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x72'),_0x5ab4fe['body'][_0xef61('0x73')]['toString']())['where'](_0xef61('0x74'))['where'](_0xef61('0x75'),squel['select']()['field'](_0xef61('0x64'))[_0xef61('0x6f')]('cm_hopper')[_0xef61('0x3d')]('VoiceQueueId\x20=\x20?',_0x5ab4fe[_0xef61('0x4c')]['id'][_0xef61('0x71')]()))[_0xef61('0x3d')](_0xef61('0x75'),squel['select']()[_0xef61('0x6a')]('calleridnum')[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')](_0xef61('0x76'),_0x5ab4fe[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x77')))[_0xef61('0x78')]('ContactId'))[_0xef61('0x71')]();return db['sequelize'][_0xef61('0x34')](_0xe62ec2);}return[];})[_0xef61('0x28')](respondWithResult(_0x38117b,null))['catch'](handleError(_0x38117b,null));};exports[_0xef61('0x79')]=function(_0x5b86e4,_0x52f7c5,_0x465fb5){return db[_0xef61('0x7a')]['find']({'where':{'id':_0x5b86e4[_0xef61('0x4c')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x52f7c5,null))['then'](function(_0x352633){var _0x2cb8a8;if(_0x352633){_0x2cb8a8=squel['insert']()[_0xef61('0x7b')]('cm_hopper')[_0xef61('0x7c')]([_0xef61('0x64'),_0xef61('0x65'),_0xef61('0x7d'),'ListId',_0xef61('0x7e'),_0xef61('0x67'),_0xef61('0x68')],squel['select']()[_0xef61('0x6a')](_0xef61('0x7f'),'phone')['field'](_0xef61('0x6b'),_0xef61('0x65'))[_0xef61('0x6a')](_0xef61('0x6c'),_0xef61('0x7d'))[_0xef61('0x6a')](_0xef61('0x80'),_0xef61('0x6d'))[_0xef61('0x6a')](_0xef61('0x81'),_0xef61('0x7e'))[_0xef61('0x6a')](_0xef61('0x6b'),_0xef61('0x67'))[_0xef61('0x6a')](_0xef61('0x6b'),'updatedAt')[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')](_0xef61('0x82'),_0x5b86e4[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x72'),_0x5b86e4[_0xef61('0x4a')][_0xef61('0x73')][_0xef61('0x71')]())[_0xef61('0x3d')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xef61('0x3d')](_0xef61('0x75'),squel['select']()[_0xef61('0x6a')](_0xef61('0x64'))[_0xef61('0x6f')](_0xef61('0x63'))[_0xef61('0x3d')]('CampaignId\x20=\x20?',_0x5b86e4[_0xef61('0x4c')]['id']['toString']()))[_0xef61('0x3d')](_0xef61('0x75'),squel[_0xef61('0x69')]()[_0xef61('0x6a')](_0xef61('0x83'))[_0xef61('0x6f')](_0xef61('0x70'))[_0xef61('0x3d')]('CampaignId\x20=\x20?',_0x5b86e4[_0xef61('0x4c')]['id'][_0xef61('0x71')]())[_0xef61('0x3d')](_0xef61('0x77')))[_0xef61('0x78')](_0xef61('0x7d')))[_0xef61('0x71')]();return db[_0xef61('0x4f')][_0xef61('0x34')](_0x2cb8a8);}return[];})['then'](respondWithResult(_0x52f7c5,null))[_0xef61('0x45')](handleError(_0x52f7c5,null));};exports[_0xef61('0x84')]=function(_0x22006a,_0x317c4a,_0x5d8ee9){return db['CmHopper'][_0xef61('0x85')]({'where':{'VoiceQueueId':_0x22006a[_0xef61('0x4a')][_0xef61('0x66')],'CampaignId':_0x22006a[_0xef61('0x4a')][_0xef61('0x7e')],'ContactId':_0x22006a[_0xef61('0x4a')][_0xef61('0x7d')]}})['then'](handleEntityNotFound(_0x317c4a,null))[_0xef61('0x28')](function(_0x660c71){if(_0x660c71){return _0x660c71;}return null;})[_0xef61('0x28')](respondWithResult(_0x317c4a,null))[_0xef61('0x45')](handleError(_0x317c4a,null));}; \ No newline at end of file +var _0xc1c6=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','CmHopperFinal','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','ANY_VALUE(ContactId)','field','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x410e70,_0x3339be){_0x410e70=_0x410e70-0x0;var _0x43aea6=_0xc1c6[_0x410e70];return _0x43aea6;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['CmHopperFinal']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':!![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['CmHopperFinal'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['describe']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')]()[_0x6c1c('0x25')](respondWithResult(_0x58d075,null))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x26cf7f,_0x52c14d){if(_0x26cf7f[_0x6c1c('0x48')][_0x6c1c('0x49')]){delete _0x26cf7f['body'][_0x6c1c('0x49')];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'uniqueid':_0x26cf7f[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x52c14d,null))[_0x6c1c('0x25')](saveUpdates(_0x26cf7f[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0x52c14d,null))['catch'](handleError(_0x52c14d,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x56b367,_0x5714a6,_0x5008b7){return db[_0x6c1c('0x2b')][_0x6c1c('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x56b367['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x53')))),'congestionContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x55')))),_0x6c1c('0x56')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db['sequelize'][_0x6c1c('0x4e')](_0x6c1c('0x57')))),_0x6c1c('0x58')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),'answeringMachine']]})[_0x6c1c('0x25')](handleEntityNotFound(_0x5714a6,null))[_0x6c1c('0x25')](respondWithResult(_0x5714a6,null))[_0x6c1c('0x41')](handleError(_0x5714a6,null));};exports[_0x6c1c('0x5a')]=function(_0x14f3b5,_0x3229e6,_0xed095f){return db['CmHopperFinal'][_0x6c1c('0x3f')]({'raw':![],'where':{'CampaignId':_0x14f3b5['params']['id']},'attributes':[[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x4c')))),_0x6c1c('0x4d')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x4f')))),_0x6c1c('0x50')],[db[_0x6c1c('0x4a')]['fn'](_0x6c1c('0x4b'),db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x51')))),_0x6c1c('0x52')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')]['literal'](_0x6c1c('0x53')))),_0x6c1c('0x5b')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x5c')))),_0x6c1c('0x54')],[db[_0x6c1c('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn'](_0x6c1c('0x4b'),db[_0x6c1c('0x4a')]['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x6c1c('0x58')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6c1c('0x4a')][_0x6c1c('0x4e')](_0x6c1c('0x59')))),_0x6c1c('0x5d')]]})[_0x6c1c('0x25')](handleEntityNotFound(_0x3229e6,null))[_0x6c1c('0x25')](respondWithResult(_0x3229e6,null))['catch'](handleError(_0x3229e6,null));};exports[_0x6c1c('0x5e')]=function(_0x16b741,_0x204e78,_0x5a919a){return db['VoiceQueue']['find']({'where':{'id':_0x16b741[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x204e78,null))['then'](function(_0x10e499){var _0x579ca3;if(_0x10e499){_0x579ca3=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))[_0x6c1c('0x62')](['phone',_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId','VoiceQueueId',_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))['field']('NOW()','scheduledAt')['field'](_0x6c1c('0x6a'),'ContactId')[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))['field'](_0x6c1c('0x6e'),_0x6c1c('0x6f'))[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x65'))['field'](_0x6c1c('0x70'),'updatedAt')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x16b741['body'][_0x6c1c('0x76')]['toString']())['where'](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x69'))['from'](_0x6c1c('0x61'))['where'](_0x6c1c('0x73'),_0x16b741[_0x6c1c('0x43')]['id'][_0x6c1c('0x74')]()))['where'](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')]('calleridnum')[_0x6c1c('0x71')](_0x6c1c('0x72'))[_0x6c1c('0x38')](_0x6c1c('0x73'),_0x16b741['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))['toString']();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x579ca3);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x204e78,null))[_0x6c1c('0x41')](handleError(_0x204e78,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1ad9e2,_0x44d8c4,_0x33a141){return db['Campaign'][_0x6c1c('0x46')]({'where':{'id':_0x1ad9e2[_0x6c1c('0x43')]['id']}})['then'](handleEntityNotFound(_0x44d8c4,null))[_0x6c1c('0x25')](function(_0x50b56b){var _0x1a493a;if(_0x50b56b){_0x1a493a=squel[_0x6c1c('0x5f')]()[_0x6c1c('0x60')](_0x6c1c('0x61'))['fromQuery']([_0x6c1c('0x69'),_0x6c1c('0x63'),_0x6c1c('0x64'),'ListId',_0x6c1c('0x7b'),_0x6c1c('0x65'),_0x6c1c('0x66')],squel[_0x6c1c('0x67')]()['field'](_0x6c1c('0x68'),_0x6c1c('0x69'))[_0x6c1c('0x6b')]('NOW()',_0x6c1c('0x63'))['field'](_0x6c1c('0x6a'),_0x6c1c('0x64'))[_0x6c1c('0x6b')](_0x6c1c('0x6c'),_0x6c1c('0x6d'))[_0x6c1c('0x6b')](_0x6c1c('0x7c'),_0x6c1c('0x7b'))['field'](_0x6c1c('0x70'),'createdAt')[_0x6c1c('0x6b')](_0x6c1c('0x70'),_0x6c1c('0x66'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2[_0x6c1c('0x43')]['id']['toString']())[_0x6c1c('0x38')](_0x6c1c('0x75'),_0x1ad9e2['body']['state'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x77'))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x69'))[_0x6c1c('0x71')](_0x6c1c('0x61'))[_0x6c1c('0x38')](_0x6c1c('0x7d'),_0x1ad9e2['params']['id'][_0x6c1c('0x74')]()))[_0x6c1c('0x38')](_0x6c1c('0x78'),squel[_0x6c1c('0x67')]()[_0x6c1c('0x6b')](_0x6c1c('0x7e'))[_0x6c1c('0x71')]('cm_hopper_final')[_0x6c1c('0x38')]('CampaignId\x20=\x20?',_0x1ad9e2['params']['id'][_0x6c1c('0x74')]())[_0x6c1c('0x38')](_0x6c1c('0x79')))[_0x6c1c('0x7a')](_0x6c1c('0x64')))[_0x6c1c('0x74')]();return db[_0x6c1c('0x4a')][_0x6c1c('0x30')](_0x1a493a);}return[];})[_0x6c1c('0x25')](respondWithResult(_0x44d8c4,null))[_0x6c1c('0x41')](handleError(_0x44d8c4,null));};exports['checkContactHopper']=function(_0x3e40b6,_0x654041,_0x1a0da8){return db[_0x6c1c('0x7f')][_0x6c1c('0x80')]({'where':{'VoiceQueueId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x6f')],'CampaignId':_0x3e40b6[_0x6c1c('0x48')]['CampaignId'],'ContactId':_0x3e40b6[_0x6c1c('0x48')][_0x6c1c('0x64')]}})[_0x6c1c('0x25')](handleEntityNotFound(_0x654041,null))[_0x6c1c('0x25')](function(_0x385629){if(_0x385629){return _0x385629;}return null;})[_0x6c1c('0x25')](respondWithResult(_0x654041,null))[_0x6c1c('0x41')](handleError(_0x654041,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 85d4522..4bb09ec 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 _0x77ee=['../../config/logger','api','moment','bluebird','path','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x419b6a,_0x265b43){var _0x229232=function(_0x514a3e){while(--_0x514a3e){_0x419b6a['push'](_0x419b6a['shift']());}};_0x229232(++_0x265b43);}(_0x77ee,0xa6));var _0xe77e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x77ee[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe77e('0x0'));var util=require(_0xe77e('0x1'));var logger=require(_0xe77e('0x2'))(_0xe77e('0x3'));var moment=require(_0xe77e('0x4'));var BPromise=require(_0xe77e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe77e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0xe77e('0x7')]=function(_0x226c4c,_0x26b064){return _0x226c4c['define'](_0xe77e('0x8'),attributes,{'tableName':_0xe77e('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xe77e('0xa')]},{'name':'uniqueid','fields':[_0xe77e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc27f=['moment','request-promise','path','rimraf','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api'];(function(_0x132144,_0x2e978a){var _0xc0de5a=function(_0x333052){while(--_0x333052){_0x132144['push'](_0x132144['shift']());}};_0xc0de5a(++_0x2e978a);}(_0xc27f,0x7a));var _0xfc27=function(_0x550c5a,_0x288ebe){_0x550c5a=_0x550c5a-0x0;var _0x4353fc=_0xc27f[_0x550c5a];return _0x4353fc;};'use strict';var _=require(_0xfc27('0x0'));var util=require(_0xfc27('0x1'));var logger=require(_0xfc27('0x2'))(_0xfc27('0x3'));var moment=require(_0xfc27('0x4'));var BPromise=require('bluebird');var rp=require(_0xfc27('0x5'));var fs=require('fs');var path=require(_0xfc27('0x6'));var rimraf=require(_0xfc27('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0xfc27('0x8')]=function(_0x113aac,_0x22b820){return _0x113aac[_0xfc27('0x9')](_0xfc27('0xa'),attributes,{'tableName':_0xfc27('0xb'),'paranoid':![],'indexes':[{'name':_0xfc27('0xc'),'fields':[_0xfc27('0xc')]},{'name':_0xfc27('0xd'),'fields':[_0xfc27('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 0bdfef4..af9fa57 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4d5e6c,_0x277c90){var _0x9528a7=function(_0x186d57){while(--_0x186d57){_0x4d5e6c['push'](_0x4d5e6c['shift']());}};_0x9528a7(++_0x277c90);}(_0xb10b,0x12a));var _0xbb10=function(_0x112d20,_0x4bd3b6){_0x112d20=_0x112d20-0x0;var _0x48c4ce=_0xb10b[_0x112d20];return _0x48c4ce;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x538e82,_0x3f5ff4){var _0x8530c6=function(_0x4c5279){while(--_0x4c5279){_0x538e82['push'](_0x538e82['shift']());}};_0x8530c6(++_0x3f5ff4);}(_0x7a54,0x106));var _0x47a5=function(_0xfb4b3e,_0x13d119){_0xfb4b3e=_0xfb4b3e-0x0;var _0x2a59de=_0x7a54[_0xfb4b3e];return _0x2a59de;};'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 1de012e..24a466b 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 _0x6e87=['isAuthenticated','index','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./cmHopperFinal.controller','get'];(function(_0x5c15f0,_0x5e5b0d){var _0x326029=function(_0x339e11){while(--_0x339e11){_0x5c15f0['push'](_0x5c15f0['shift']());}};_0x326029(++_0x5e5b0d);}(_0x6e87,0x7e));var _0x76e8=function(_0x1b14e4,_0x154a76){_0x1b14e4=_0x1b14e4-0x0;var _0x39197a=_0x6e87[_0x1b14e4];return _0x39197a;};'use strict';var multer=require('multer');var util=require(_0x76e8('0x0'));var path=require(_0x76e8('0x1'));var timeout=require(_0x76e8('0x2'));var express=require(_0x76e8('0x3'));var router=express[_0x76e8('0x4')]();var fs_extra=require(_0x76e8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x76e8('0x6'));var controller=require(_0x76e8('0x7'));router[_0x76e8('0x8')]('/',auth[_0x76e8('0x9')](),controller[_0x76e8('0xa')]);router[_0x76e8('0x8')](_0x76e8('0xb'),auth[_0x76e8('0x9')](),controller['describe']);router['get'](_0x76e8('0xc'),auth['isAuthenticated'](),controller[_0x76e8('0xd')]);router[_0x76e8('0x8')](_0x76e8('0xe'),auth[_0x76e8('0x9')](),controller[_0x76e8('0xf')]);router[_0x76e8('0x8')](_0x76e8('0x10'),auth[_0x76e8('0x9')](),controller[_0x76e8('0x11')]);router[_0x76e8('0x12')](_0x76e8('0x13'),auth[_0x76e8('0x9')](),controller[_0x76e8('0x14')]);router['post'](_0x76e8('0x15'),auth['isAuthenticated'](),controller[_0x76e8('0x16')]);router[_0x76e8('0x12')](_0x76e8('0x17'),auth[_0x76e8('0x9')](),controller[_0x76e8('0x18')]);router[_0x76e8('0x19')](_0x76e8('0xc'),auth[_0x76e8('0x9')](),controller[_0x76e8('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x4f54=['checkContactHopper','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4f54,0x123));var _0x44f5=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x4f54[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x44f5('0x0'));var util=require(_0x44f5('0x1'));var path=require(_0x44f5('0x2'));var timeout=require(_0x44f5('0x3'));var express=require(_0x44f5('0x4'));var router=express[_0x44f5('0x5')]();var fs_extra=require(_0x44f5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x44f5('0x7'));var config=require(_0x44f5('0x8'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x44f5('0x9')]('/describe',auth[_0x44f5('0xa')](),controller[_0x44f5('0xb')]);router[_0x44f5('0x9')]('/:id',auth[_0x44f5('0xa')](),controller[_0x44f5('0xc')]);router[_0x44f5('0x9')]('/voice/queue/countAttributes/:id',auth[_0x44f5('0xa')](),controller[_0x44f5('0xd')]);router[_0x44f5('0x9')](_0x44f5('0xe'),auth[_0x44f5('0xa')](),controller[_0x44f5('0xf')]);router[_0x44f5('0x10')](_0x44f5('0x11'),auth[_0x44f5('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x44f5('0x10')](_0x44f5('0x12'),auth['isAuthenticated'](),controller[_0x44f5('0x13')]);router[_0x44f5('0x10')](_0x44f5('0x14'),auth[_0x44f5('0xa')](),controller[_0x44f5('0x15')]);router[_0x44f5('0x16')](_0x44f5('0x17'),auth['isAuthenticated'](),controller[_0x44f5('0x18')]);module[_0x44f5('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index a651128..abeecb1 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 _0x5e61=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x29b754,_0x305852){var _0x428652=function(_0x4cd18a){while(--_0x4cd18a){_0x29b754['push'](_0x29b754['shift']());}};_0x428652(++_0x305852);}(_0x5e61,0x1e0));var _0x15e6=function(_0xf9a4c4,_0x393f56){_0xf9a4c4=_0xf9a4c4-0x0;var _0x480c5f=_0x5e61[_0xf9a4c4];return _0x480c5f;};'use strict';var Sequelize=require(_0x15e6('0x0'));module[_0x15e6('0x1')]={'state':{'type':Sequelize[_0x15e6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x15e6('0x3')]},'scheduledat':{'type':Sequelize[_0x15e6('0x4')]},'countbusyretry':{'type':Sequelize[_0x15e6('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x15e6('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x15e6('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x15e6('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x15e6('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x15e6('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x15e6('0x3')]},'starttime':{'type':Sequelize[_0x15e6('0x4')]},'responsetime':{'type':Sequelize[_0x15e6('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x15e6('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x15e6('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x15e6('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x15e6('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x15e6('0x3')]},'campaign':{'type':Sequelize[_0x15e6('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x15e6('0x3')]},'reason':{'type':Sequelize[_0x15e6('0x3')]},'amd':{'type':Sequelize[_0x15e6('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x15e6('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x15e6('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x15e6('0x4')]},'recallme':{'type':Sequelize[_0x15e6('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x15e6('0x4')]},'edited':{'type':Sequelize[_0x15e6('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x15e6('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x15e6('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x15e6('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x15e6('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x15e6('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3021=['DATE','STRING','BOOLEAN','sequelize','INTEGER'];(function(_0x287af1,_0x32b491){var _0x4c4233=function(_0xf7a45b){while(--_0xf7a45b){_0x287af1['push'](_0x287af1['shift']());}};_0x4c4233(++_0x32b491);}(_0x3021,0xfd));var _0x1302=function(_0x302c60,_0x2b94cc){_0x302c60=_0x302c60-0x0;var _0x5b4e54=_0x3021[_0x302c60];return _0x5b4e54;};'use strict';var Sequelize=require(_0x1302('0x0'));module['exports']={'state':{'type':Sequelize[_0x1302('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1302('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1302('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1302('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1302('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1302('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x1302('0x3')]},'originatecalleridname':{'type':Sequelize[_0x1302('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x1302('0x2')]},'answertime':{'type':Sequelize[_0x1302('0x2')]},'droptime':{'type':Sequelize[_0x1302('0x2')]},'endtime':{'type':Sequelize[_0x1302('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1302('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1302('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1302('0x3')]},'campaign':{'type':Sequelize[_0x1302('0x3')]},'campaigntype':{'type':Sequelize[_0x1302('0x3')]},'membername':{'type':Sequelize[_0x1302('0x3')]},'reason':{'type':Sequelize[_0x1302('0x3')]},'amd':{'type':Sequelize[_0x1302('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1302('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1302('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1302('0x2')]},'recallme':{'type':Sequelize[_0x1302('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1302('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1302('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1302('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1302('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1302('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index ef9de9e..1dee59f 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 _0x4fb9=['undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','stack','name','index','CmHopperHistory','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','type','includeAll','include','catch','show','params','keys','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','status','json','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fb9,0x1d1));var _0x94fb=function(_0x1da97d,_0x11f740){_0x1da97d=_0x1da97d-0x0;var _0x2675a0=_0x4fb9[_0x1da97d];return _0x2675a0;};'use strict';var emlformat=require(_0x94fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94fb('0x1'));var jsonpatch=require(_0x94fb('0x2'));var rp=require('request-promise');var moment=require(_0x94fb('0x3'));var BPromise=require(_0x94fb('0x4'));var Mustache=require(_0x94fb('0x5'));var util=require(_0x94fb('0x6'));var path=require(_0x94fb('0x7'));var sox=require(_0x94fb('0x8'));var csv=require(_0x94fb('0x9'));var ejs=require(_0x94fb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94fb('0xb'));var squel=require(_0x94fb('0xc'));var crypto=require(_0x94fb('0xd'));var jsforce=require(_0x94fb('0xe'));var deskjs=require(_0x94fb('0xf'));var toCsv=require(_0x94fb('0x9'));var querystring=require('querystring');var Papa=require(_0x94fb('0x10'));var Redis=require(_0x94fb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x94fb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x94fb('0x13'));var utils=require(_0x94fb('0x14'));var config=require(_0x94fb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5160c7,_0x20a4fd){_0x20a4fd=_0x20a4fd||0xcc;return function(_0x19968d){if(_0x19968d){return _0x5160c7['sendStatus'](_0x20a4fd);}return _0x5160c7[_0x94fb('0x16')](_0x20a4fd)['end']();};}function respondWithResult(_0x131e60,_0x5cbc70){_0x5cbc70=_0x5cbc70||0xc8;return function(_0x3138c2){if(_0x3138c2){return _0x131e60[_0x94fb('0x16')](_0x5cbc70)[_0x94fb('0x17')](_0x3138c2);}};}function respondWithFilteredResult(_0x5ca2da,_0x31a772){return function(_0x50ccd9){if(_0x50ccd9){var _0x1d67a0=typeof _0x31a772[_0x94fb('0x18')]===_0x94fb('0x19')&&typeof _0x31a772[_0x94fb('0x1a')]===_0x94fb('0x19');var _0x15271d=_0x50ccd9[_0x94fb('0x1b')];var _0x163487=_0x1d67a0?0x0:_0x31a772[_0x94fb('0x18')];var _0x2a417f=_0x1d67a0?_0x50ccd9['count']:_0x31a772[_0x94fb('0x18')]+_0x31a772[_0x94fb('0x1a')];var _0x4ad51d;if(_0x2a417f>=_0x15271d){_0x2a417f=_0x15271d;_0x4ad51d=0xc8;}else{_0x4ad51d=0xce;}_0x5ca2da['status'](_0x4ad51d);return _0x5ca2da[_0x94fb('0x1c')](_0x94fb('0x1d'),_0x163487+'-'+_0x2a417f+'/'+_0x15271d)[_0x94fb('0x17')](_0x50ccd9);}return null;};}function patchUpdates(_0x1120d5){return function(_0x151f33){try{jsonpatch['apply'](_0x151f33,_0x1120d5,!![]);}catch(_0x24f765){return BPromise[_0x94fb('0x1e')](_0x24f765);}return _0x151f33[_0x94fb('0x1f')]();};}function saveUpdates(_0xcaa94c,_0x24abfd){return function(_0x5a6446){if(_0x5a6446){return _0x5a6446[_0x94fb('0x20')](_0xcaa94c)[_0x94fb('0x21')](function(_0x321cd7){return _0x321cd7;});}return null;};}function removeEntity(_0x13213f,_0x3fbfd5){return function(_0x16fb8f){if(_0x16fb8f){return _0x16fb8f[_0x94fb('0x22')]()[_0x94fb('0x21')](function(){_0x13213f[_0x94fb('0x16')](0xcc)[_0x94fb('0x23')]();});}};}function handleEntityNotFound(_0x44f9f8,_0x3fa59a){return function(_0x438f9f){if(!_0x438f9f){_0x44f9f8[_0x94fb('0x24')](0x194);}return _0x438f9f;};}function handleError(_0x4666b0,_0x49b5e4){_0x49b5e4=_0x49b5e4||0x1f4;return function(_0x56a8dd){logger['error'](_0x56a8dd[_0x94fb('0x25')]);if(_0x56a8dd[_0x94fb('0x26')]){delete _0x56a8dd[_0x94fb('0x26')];}_0x4666b0['status'](_0x49b5e4)['send'](_0x56a8dd);};}exports[_0x94fb('0x27')]=function(_0x565825,_0x52de3b){var _0x196983={},_0x1f0e7f={},_0x5bb376={'count':0x0,'rows':[]};var _0xfea768=_['map'](db[_0x94fb('0x28')][_0x94fb('0x29')],function(_0x4490c3){return{'name':_0x4490c3[_0x94fb('0x2a')],'type':_0x4490c3['type'][_0x94fb('0x2b')]};});_0x1f0e7f['model']=_['map'](_0xfea768,_0x94fb('0x26'));_0x1f0e7f[_0x94fb('0x2c')]=_['keys'](_0x565825['query']);_0x1f0e7f[_0x94fb('0x2d')]=_[_0x94fb('0x2e')](_0x1f0e7f[_0x94fb('0x2f')],_0x1f0e7f[_0x94fb('0x2c')]);_0x196983[_0x94fb('0x30')]=_[_0x94fb('0x2e')](_0x1f0e7f[_0x94fb('0x2f')],qs[_0x94fb('0x31')](_0x565825['query'][_0x94fb('0x31')]));_0x196983[_0x94fb('0x30')]=_0x196983[_0x94fb('0x30')][_0x94fb('0x32')]?_0x196983[_0x94fb('0x30')]:_0x1f0e7f[_0x94fb('0x2f')];if(!_0x565825[_0x94fb('0x2c')][_0x94fb('0x33')]('nolimit')){_0x196983[_0x94fb('0x1a')]=qs[_0x94fb('0x1a')](_0x565825['query'][_0x94fb('0x1a')]);_0x196983[_0x94fb('0x18')]=qs[_0x94fb('0x18')](_0x565825[_0x94fb('0x2c')][_0x94fb('0x18')]);}_0x196983[_0x94fb('0x34')]=qs['sort'](_0x565825[_0x94fb('0x2c')][_0x94fb('0x35')]);_0x196983[_0x94fb('0x36')]=qs[_0x94fb('0x2d')](_[_0x94fb('0x37')](_0x565825[_0x94fb('0x2c')],_0x1f0e7f[_0x94fb('0x2d')]),_0xfea768);if(_0x565825[_0x94fb('0x2c')][_0x94fb('0x38')]){_0x196983[_0x94fb('0x36')]=_[_0x94fb('0x39')](_0x196983[_0x94fb('0x36')],{'$or':_[_0x94fb('0x3a')](_0xfea768,function(_0x2a21c2){if(_0x2a21c2[_0x94fb('0x3b')]!=='VIRTUAL'){var _0x192512={};_0x192512[_0x2a21c2[_0x94fb('0x26')]]={'$like':'%'+_0x565825['query'][_0x94fb('0x38')]+'%'};return _0x192512;}})});}_0x196983=_[_0x94fb('0x39')]({},_0x196983,_0x565825['options']);var _0x20ea81={'where':_0x196983[_0x94fb('0x36')]};return db[_0x94fb('0x28')][_0x94fb('0x1b')](_0x20ea81)['then'](function(_0x349b1b){_0x5bb376[_0x94fb('0x1b')]=_0x349b1b;if(_0x565825[_0x94fb('0x2c')][_0x94fb('0x3c')]){_0x196983[_0x94fb('0x3d')]=[{'all':!![]}];}return db[_0x94fb('0x28')]['findAll'](_0x196983);})[_0x94fb('0x21')](function(_0x4830cb){_0x5bb376['rows']=_0x4830cb;return _0x5bb376;})[_0x94fb('0x21')](respondWithFilteredResult(_0x52de3b,_0x196983))[_0x94fb('0x3e')](handleError(_0x52de3b,null));};exports[_0x94fb('0x3f')]=function(_0x2355d6,_0x310dac){var _0x43d38d={'raw':!![],'where':{'id':_0x2355d6[_0x94fb('0x40')]['id']}},_0x5b9381={};_0x5b9381[_0x94fb('0x2f')]=_[_0x94fb('0x41')](db[_0x94fb('0x28')][_0x94fb('0x29')]);_0x5b9381[_0x94fb('0x2c')]=_[_0x94fb('0x41')](_0x2355d6[_0x94fb('0x2c')]);_0x5b9381['filters']=_[_0x94fb('0x2e')](_0x5b9381['model'],_0x5b9381[_0x94fb('0x2c')]);_0x43d38d[_0x94fb('0x30')]=_['intersection'](_0x5b9381['model'],qs[_0x94fb('0x31')](_0x2355d6[_0x94fb('0x2c')][_0x94fb('0x31')]));_0x43d38d['attributes']=_0x43d38d[_0x94fb('0x30')][_0x94fb('0x32')]?_0x43d38d[_0x94fb('0x30')]:_0x5b9381[_0x94fb('0x2f')];if(_0x2355d6['query'][_0x94fb('0x3c')]){_0x43d38d[_0x94fb('0x3d')]=[{'all':!![]}];}_0x43d38d=_[_0x94fb('0x39')]({},_0x43d38d,_0x2355d6['options']);return db['CmHopperHistory']['find'](_0x43d38d)[_0x94fb('0x21')](handleEntityNotFound(_0x310dac,null))[_0x94fb('0x21')](respondWithResult(_0x310dac,null))[_0x94fb('0x3e')](handleError(_0x310dac,null));};exports[_0x94fb('0x42')]=function(_0x26f592,_0x5e656b){return db[_0x94fb('0x28')][_0x94fb('0x42')](_0x26f592[_0x94fb('0x43')],{})[_0x94fb('0x21')](respondWithResult(_0x5e656b,0xc9))['catch'](handleError(_0x5e656b,null));};exports[_0x94fb('0x44')]=function(_0x4f9920,_0x1f3ef0){return db[_0x94fb('0x28')][_0x94fb('0x44')]()[_0x94fb('0x21')](respondWithResult(_0x1f3ef0,null))['catch'](handleError(_0x1f3ef0,null));};exports['update']=function(_0x184b9e,_0x4d59f4){if(_0x184b9e[_0x94fb('0x43')]['uniqueid']){delete _0x184b9e[_0x94fb('0x43')][_0x94fb('0x45')];}return db[_0x94fb('0x28')]['find']({'where':{'uniqueid':_0x184b9e[_0x94fb('0x40')]['id']}})[_0x94fb('0x21')](handleEntityNotFound(_0x4d59f4,null))['then'](saveUpdates(_0x184b9e[_0x94fb('0x43')],null))[_0x94fb('0x21')](respondWithResult(_0x4d59f4,null))['catch'](handleError(_0x4d59f4,null));}; \ No newline at end of file +var _0xe261=['to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','stack','name','index','CmHopperHistory','rawAttributes','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','describe','uniqueid','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js'];(function(_0x448ca2,_0x3fc577){var _0x89d9f=function(_0x28b414){while(--_0x28b414){_0x448ca2['push'](_0x448ca2['shift']());}};_0x89d9f(++_0x3fc577);}(_0xe261,0xcb));var _0x1e26=function(_0x13b036,_0x4b41b7){_0x13b036=_0x13b036-0x0;var _0x4dff09=_0xe261[_0x13b036];return _0x4dff09;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e26('0x0'));var zipdir=require(_0x1e26('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e26('0x2'));var moment=require(_0x1e26('0x3'));var BPromise=require(_0x1e26('0x4'));var Mustache=require('mustache');var util=require(_0x1e26('0x5'));var path=require(_0x1e26('0x6'));var sox=require(_0x1e26('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e26('0x8'));var squel=require(_0x1e26('0x9'));var crypto=require(_0x1e26('0xa'));var jsforce=require(_0x1e26('0xb'));var deskjs=require(_0x1e26('0xc'));var toCsv=require(_0x1e26('0xd'));var querystring=require(_0x1e26('0xe'));var Papa=require('papaparse');var Redis=require(_0x1e26('0xf'));var authService=require(_0x1e26('0x10'));var qs=require(_0x1e26('0x11'));var as=require(_0x1e26('0x12'));var hardwareService=require(_0x1e26('0x13'));var logger=require('../../config/logger')(_0x1e26('0x14'));var utils=require(_0x1e26('0x15'));var config=require(_0x1e26('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e26('0x17'))['db'];function respondWithStatusCode(_0xb7d1ab,_0x4e0bfb){_0x4e0bfb=_0x4e0bfb||0xcc;return function(_0x10b139){if(_0x10b139){return _0xb7d1ab[_0x1e26('0x18')](_0x4e0bfb);}return _0xb7d1ab[_0x1e26('0x19')](_0x4e0bfb)[_0x1e26('0x1a')]();};}function respondWithResult(_0x54fd4e,_0x11d5c2){_0x11d5c2=_0x11d5c2||0xc8;return function(_0x4c0c00){if(_0x4c0c00){return _0x54fd4e[_0x1e26('0x19')](_0x11d5c2)[_0x1e26('0x1b')](_0x4c0c00);}};}function respondWithFilteredResult(_0xb34111,_0x109f54){return function(_0x52bca0){if(_0x52bca0){var _0x117157=typeof _0x109f54[_0x1e26('0x1c')]===_0x1e26('0x1d')&&typeof _0x109f54[_0x1e26('0x1e')]===_0x1e26('0x1d');var _0x41728a=_0x52bca0[_0x1e26('0x1f')];var _0x447898=_0x117157?0x0:_0x109f54[_0x1e26('0x1c')];var _0x33a426=_0x117157?_0x52bca0['count']:_0x109f54[_0x1e26('0x1c')]+_0x109f54['limit'];var _0x1638ca;if(_0x33a426>=_0x41728a){_0x33a426=_0x41728a;_0x1638ca=0xc8;}else{_0x1638ca=0xce;}_0xb34111[_0x1e26('0x19')](_0x1638ca);return _0xb34111[_0x1e26('0x20')]('Content-Range',_0x447898+'-'+_0x33a426+'/'+_0x41728a)[_0x1e26('0x1b')](_0x52bca0);}return null;};}function patchUpdates(_0x3250e9){return function(_0x269627){try{jsonpatch[_0x1e26('0x21')](_0x269627,_0x3250e9,!![]);}catch(_0x4508f2){return BPromise[_0x1e26('0x22')](_0x4508f2);}return _0x269627['save']();};}function saveUpdates(_0x1e609c,_0x3238af){return function(_0x3c2e82){if(_0x3c2e82){return _0x3c2e82['update'](_0x1e609c)[_0x1e26('0x23')](function(_0x1fc877){return _0x1fc877;});}return null;};}function removeEntity(_0x511a58,_0x10027a){return function(_0x33f8c1){if(_0x33f8c1){return _0x33f8c1[_0x1e26('0x24')]()[_0x1e26('0x23')](function(){_0x511a58[_0x1e26('0x19')](0xcc)[_0x1e26('0x1a')]();});}};}function handleEntityNotFound(_0x3dc697,_0x52e5c7){return function(_0x3ef468){if(!_0x3ef468){_0x3dc697['sendStatus'](0x194);}return _0x3ef468;};}function handleError(_0x4920cb,_0x40e139){_0x40e139=_0x40e139||0x1f4;return function(_0x5cad93){logger['error'](_0x5cad93[_0x1e26('0x25')]);if(_0x5cad93[_0x1e26('0x26')]){delete _0x5cad93[_0x1e26('0x26')];}_0x4920cb['status'](_0x40e139)['send'](_0x5cad93);};}exports[_0x1e26('0x27')]=function(_0x4cad41,_0x4d650e){var _0x202804={},_0x58ce6a={},_0x558411={'count':0x0,'rows':[]};var _0x5e6bbe=_['map'](db[_0x1e26('0x28')][_0x1e26('0x29')],function(_0x405d16){return{'name':_0x405d16['fieldName'],'type':_0x405d16['type'][_0x1e26('0x2a')]};});_0x58ce6a['model']=_[_0x1e26('0x2b')](_0x5e6bbe,'name');_0x58ce6a[_0x1e26('0x2c')]=_[_0x1e26('0x2d')](_0x4cad41[_0x1e26('0x2c')]);_0x58ce6a[_0x1e26('0x2e')]=_['intersection'](_0x58ce6a[_0x1e26('0x2f')],_0x58ce6a[_0x1e26('0x2c')]);_0x202804[_0x1e26('0x30')]=_[_0x1e26('0x31')](_0x58ce6a[_0x1e26('0x2f')],qs[_0x1e26('0x32')](_0x4cad41[_0x1e26('0x2c')][_0x1e26('0x32')]));_0x202804[_0x1e26('0x30')]=_0x202804['attributes'][_0x1e26('0x33')]?_0x202804['attributes']:_0x58ce6a['model'];if(!_0x4cad41[_0x1e26('0x2c')][_0x1e26('0x34')]('nolimit')){_0x202804[_0x1e26('0x1e')]=qs[_0x1e26('0x1e')](_0x4cad41['query'][_0x1e26('0x1e')]);_0x202804[_0x1e26('0x1c')]=qs[_0x1e26('0x1c')](_0x4cad41[_0x1e26('0x2c')][_0x1e26('0x1c')]);}_0x202804['order']=qs['sort'](_0x4cad41[_0x1e26('0x2c')][_0x1e26('0x35')]);_0x202804[_0x1e26('0x36')]=qs['filters'](_[_0x1e26('0x37')](_0x4cad41[_0x1e26('0x2c')],_0x58ce6a[_0x1e26('0x2e')]),_0x5e6bbe);if(_0x4cad41['query'][_0x1e26('0x38')]){_0x202804[_0x1e26('0x36')]=_['merge'](_0x202804['where'],{'$or':_['map'](_0x5e6bbe,function(_0x1e1ca3){if(_0x1e1ca3[_0x1e26('0x39')]!==_0x1e26('0x3a')){var _0x14779a={};_0x14779a[_0x1e1ca3[_0x1e26('0x26')]]={'$like':'%'+_0x4cad41[_0x1e26('0x2c')][_0x1e26('0x38')]+'%'};return _0x14779a;}})});}_0x202804=_[_0x1e26('0x3b')]({},_0x202804,_0x4cad41[_0x1e26('0x3c')]);var _0x5115df={'where':_0x202804[_0x1e26('0x36')]};return db[_0x1e26('0x28')]['count'](_0x5115df)[_0x1e26('0x23')](function(_0x9387e9){_0x558411[_0x1e26('0x1f')]=_0x9387e9;if(_0x4cad41[_0x1e26('0x2c')][_0x1e26('0x3d')]){_0x202804[_0x1e26('0x3e')]=[{'all':!![]}];}return db[_0x1e26('0x28')][_0x1e26('0x3f')](_0x202804);})[_0x1e26('0x23')](function(_0x43f48e){_0x558411['rows']=_0x43f48e;return _0x558411;})['then'](respondWithFilteredResult(_0x4d650e,_0x202804))['catch'](handleError(_0x4d650e,null));};exports[_0x1e26('0x40')]=function(_0x4ad73e,_0x2d370b){var _0x25202e={'raw':!![],'where':{'id':_0x4ad73e[_0x1e26('0x41')]['id']}},_0x3e5fd0={};_0x3e5fd0[_0x1e26('0x2f')]=_['keys'](db[_0x1e26('0x28')][_0x1e26('0x29')]);_0x3e5fd0[_0x1e26('0x2c')]=_[_0x1e26('0x2d')](_0x4ad73e['query']);_0x3e5fd0['filters']=_[_0x1e26('0x31')](_0x3e5fd0[_0x1e26('0x2f')],_0x3e5fd0[_0x1e26('0x2c')]);_0x25202e['attributes']=_[_0x1e26('0x31')](_0x3e5fd0[_0x1e26('0x2f')],qs[_0x1e26('0x32')](_0x4ad73e[_0x1e26('0x2c')][_0x1e26('0x32')]));_0x25202e[_0x1e26('0x30')]=_0x25202e[_0x1e26('0x30')][_0x1e26('0x33')]?_0x25202e['attributes']:_0x3e5fd0['model'];if(_0x4ad73e[_0x1e26('0x2c')][_0x1e26('0x3d')]){_0x25202e[_0x1e26('0x3e')]=[{'all':!![]}];}_0x25202e=_[_0x1e26('0x3b')]({},_0x25202e,_0x4ad73e[_0x1e26('0x3c')]);return db['CmHopperHistory'][_0x1e26('0x42')](_0x25202e)[_0x1e26('0x23')](handleEntityNotFound(_0x2d370b,null))[_0x1e26('0x23')](respondWithResult(_0x2d370b,null))[_0x1e26('0x43')](handleError(_0x2d370b,null));};exports[_0x1e26('0x44')]=function(_0x51e277,_0x5919db){return db[_0x1e26('0x28')][_0x1e26('0x44')](_0x51e277[_0x1e26('0x45')],{})['then'](respondWithResult(_0x5919db,0xc9))[_0x1e26('0x43')](handleError(_0x5919db,null));};exports[_0x1e26('0x46')]=function(_0x45a213,_0x3ac349){return db['CmHopperHistory'][_0x1e26('0x46')]()[_0x1e26('0x23')](respondWithResult(_0x3ac349,null))['catch'](handleError(_0x3ac349,null));};exports['update']=function(_0x4c521f,_0x3cac44){if(_0x4c521f[_0x1e26('0x45')][_0x1e26('0x47')]){delete _0x4c521f[_0x1e26('0x45')][_0x1e26('0x47')];}return db[_0x1e26('0x28')]['find']({'where':{'uniqueid':_0x4c521f['params']['id']}})[_0x1e26('0x23')](handleEntityNotFound(_0x3cac44,null))[_0x1e26('0x23')](saveUpdates(_0x4c521f[_0x1e26('0x45')],null))[_0x1e26('0x23')](respondWithResult(_0x3cac44,null))[_0x1e26('0x43')](handleError(_0x3cac44,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 096bdfd..7c6e42a 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 _0x49db=['endtime','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cmHopperHistory.attributes','define','CmHopperHistory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x49db,0xc5));var _0xb49d=function(_0x47b4f7,_0x4e34ff){_0x47b4f7=_0x47b4f7-0x0;var _0x10a0ca=_0x49db[_0x47b4f7];return _0x10a0ca;};'use strict';var _=require(_0xb49d('0x0'));var util=require(_0xb49d('0x1'));var logger=require(_0xb49d('0x2'))(_0xb49d('0x3'));var moment=require(_0xb49d('0x4'));var BPromise=require('bluebird');var rp=require(_0xb49d('0x5'));var fs=require('fs');var path=require(_0xb49d('0x6'));var rimraf=require(_0xb49d('0x7'));var config=require('../../config/environment');var attributes=require(_0xb49d('0x8'));module['exports']=function(_0x4c6887,_0x144a9a){return _0x4c6887[_0xb49d('0x9')](_0xb49d('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xb49d('0xb'),'fields':[_0xb49d('0xb')]},{'name':_0xb49d('0xc'),'fields':[_0xb49d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x11f3=['CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','define'];(function(_0x5a4adb,_0x2300eb){var _0x6c57da=function(_0x1b2c7b){while(--_0x1b2c7b){_0x5a4adb['push'](_0x5a4adb['shift']());}};_0x6c57da(++_0x2300eb);}(_0x11f3,0x149));var _0x311f=function(_0x34d7b3,_0x583851){_0x34d7b3=_0x34d7b3-0x0;var _0x1b850a=_0x11f3[_0x34d7b3];return _0x1b850a;};'use strict';var _=require(_0x311f('0x0'));var util=require(_0x311f('0x1'));var logger=require(_0x311f('0x2'))('api');var moment=require(_0x311f('0x3'));var BPromise=require('bluebird');var rp=require(_0x311f('0x4'));var fs=require('fs');var path=require(_0x311f('0x5'));var rimraf=require(_0x311f('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x311f('0x7')]=function(_0x57ee36,_0x30d05f){return _0x57ee36[_0x311f('0x8')](_0x311f('0x9'),attributes,{'tableName':_0x311f('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x311f('0xb')]},{'name':_0x311f('0xc'),'fields':[_0x311f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 935c07c..98ee7ce 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 _0x2c54=['debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','catch','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent'];(function(_0x301ae8,_0x3609f2){var _0x79cca0=function(_0xeda2c2){while(--_0xeda2c2){_0x301ae8['push'](_0x301ae8['shift']());}};_0x79cca0(++_0x3609f2);}(_0x2c54,0x136));var _0x42c5=function(_0xcbbda3,_0x461039){_0xcbbda3=_0xcbbda3-0x0;var _0x424eb4=_0x2c54[_0xcbbda3];return _0x424eb4;};'use strict';var _=require(_0x42c5('0x0'));var util=require(_0x42c5('0x1'));var moment=require(_0x42c5('0x2'));var BPromise=require('bluebird');var rs=require(_0x42c5('0x3'));var fs=require('fs');var Redis=require(_0x42c5('0x4'));var db=require(_0x42c5('0x5'))['db'];var utils=require(_0x42c5('0x6'));var logger=require(_0x42c5('0x7'))(_0x42c5('0x8'));var config=require('../../config/environment');var jayson=require(_0x42c5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1959c1,_0x44516e,_0x38d528){return new BPromise(function(_0x134cb6,_0x14538f){return client[_0x42c5('0xa')](_0x1959c1,_0x38d528)[_0x42c5('0xb')](function(_0x3ca4de){logger[_0x42c5('0xc')](_0x42c5('0xd'),_0x44516e,_0x42c5('0xe'));logger[_0x42c5('0xf')](_0x42c5('0x10'),_0x44516e,_0x42c5('0xe'),JSON[_0x42c5('0x11')](_0x3ca4de));if(_0x3ca4de[_0x42c5('0x12')]){if(_0x3ca4de[_0x42c5('0x12')][_0x42c5('0x13')]===0x1f4){logger[_0x42c5('0x12')](_0x42c5('0xd'),_0x44516e,_0x3ca4de[_0x42c5('0x12')][_0x42c5('0x14')]);return _0x14538f(_0x3ca4de['error']['message']);}logger[_0x42c5('0x12')](_0x42c5('0xd'),_0x44516e,_0x3ca4de[_0x42c5('0x12')][_0x42c5('0x14')]);return _0x134cb6(_0x3ca4de['error'][_0x42c5('0x14')]);}else{logger[_0x42c5('0xc')](_0x42c5('0xd'),_0x44516e,'request\x20sent');_0x134cb6(_0x3ca4de[_0x42c5('0x15')]['message']);}})['catch'](function(_0x466b47){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x44516e,_0x466b47);_0x14538f(_0x466b47);});});}exports[_0x42c5('0x16')]=function(_0x3a2115){var _0x10e31e=this;return new Promise(function(_0x3f4172,_0x431f4e){return db[_0x42c5('0x17')][_0x42c5('0x18')](_0x3a2115[_0x42c5('0x19')],{'raw':_0x3a2115[_0x42c5('0x1a')]?_0x3a2115[_0x42c5('0x1a')][_0x42c5('0x1b')]===undefined?!![]:![]:!![]})[_0x42c5('0xb')](function(_0x11c6e8){logger[_0x42c5('0xc')]('CreateCmHopperHistory',_0x3a2115);logger[_0x42c5('0xf')](_0x42c5('0x16'),_0x3a2115,JSON[_0x42c5('0x11')](_0x11c6e8));_0x3f4172(_0x11c6e8);})['catch'](function(_0x245e72){logger[_0x42c5('0x12')]('CreateCmHopperHistory',_0x245e72[_0x42c5('0x14')],_0x3a2115);_0x431f4e(_0x10e31e[_0x42c5('0x12')](0x1f4,_0x245e72[_0x42c5('0x14')]));});});};exports[_0x42c5('0x1c')]=function(_0x119580){var _0x4119bf=this;return new Promise(function(_0x5cca39,_0x2d319d){return db['CmHopperHistory'][_0x42c5('0x1d')]({'raw':_0x119580[_0x42c5('0x1a')]?_0x119580['options'][_0x42c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x119580['options']?_0x119580[_0x42c5('0x1a')][_0x42c5('0x1e')]||null:null,'attributes':[[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')][_0x42c5('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0x42c5('0x1f')]['fn']('COUNT',db[_0x42c5('0x1f')]['fn']('IF',db[_0x42c5('0x1f')][_0x42c5('0x22')](_0x42c5('0x23')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db['sequelize'][_0x42c5('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),_0x42c5('0x24')],[db['sequelize']['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db[_0x42c5('0x1f')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0x42c5('0x25')],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x26'),db[_0x42c5('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x42c5('0x27')))),_0x42c5('0x28')],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x26'),db[_0x42c5('0x1f')]['fn']('IF',db['sequelize'][_0x42c5('0x22')](_0x42c5('0x29')))),'predictiveIntervalAvgTalktime']]})[_0x42c5('0xb')](function(_0x5a8f00){logger[_0x42c5('0xc')](_0x42c5('0x1c'),_0x119580);logger['debug']('AvgHandleTime',_0x119580,JSON['stringify'](_0x5a8f00));_0x5cca39(_0x5a8f00);})['catch'](function(_0x320cb1){logger[_0x42c5('0x12')](_0x42c5('0x1c'),_0x320cb1[_0x42c5('0x14')],_0x119580);_0x2d319d(_0x4119bf['error'](0x1f4,_0x320cb1[_0x42c5('0x14')]));});});};exports[_0x42c5('0x2a')]=function(_0x416198){var _0x3d0146=this;return new Promise(function(_0x481202,_0x53dc30){return db[_0x42c5('0x17')]['findAll']({'raw':_0x416198['options']?_0x416198['options'][_0x42c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x416198[_0x42c5('0x1a')]?_0x416198[_0x42c5('0x1a')][_0x42c5('0x1e')]||null:null,'attributes':[[_0x42c5('0x2b'),_0x42c5('0x2c')],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db[_0x42c5('0x1f')]['literal'](_0x42c5('0x2d')))),_0x42c5('0x2e')],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db['sequelize'][_0x42c5('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0x42c5('0x2f')],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db[_0x42c5('0x1f')][_0x42c5('0x22')](_0x42c5('0x23')))),_0x42c5('0x30')],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db[_0x42c5('0x1f')][_0x42c5('0x22')](_0x42c5('0x31')))),_0x42c5('0x32')],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db[_0x42c5('0x1f')][_0x42c5('0x22')](_0x42c5('0x33')))),'outboundCongestionCallsDay'],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x20'),db['sequelize']['fn']('IF',db[_0x42c5('0x1f')][_0x42c5('0x22')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x42c5('0x34')],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db[_0x42c5('0x1f')][_0x42c5('0x22')](_0x42c5('0x35')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db[_0x42c5('0x1f')][_0x42c5('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db[_0x42c5('0x1f')][_0x42c5('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x42c5('0x36')],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db['sequelize'][_0x42c5('0x22')](_0x42c5('0x37')))),_0x42c5('0x38')],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db[_0x42c5('0x1f')][_0x42c5('0x22')](_0x42c5('0x39')))),_0x42c5('0x3a')],[db['sequelize']['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db[_0x42c5('0x1f')]['literal'](_0x42c5('0x3b')))),_0x42c5('0x3c')],[db['sequelize']['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db[_0x42c5('0x1f')][_0x42c5('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),_0x42c5('0x3a')],[db[_0x42c5('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x42c5('0x1f')][_0x42c5('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':['campaign']})[_0x42c5('0xb')](function(_0x4d3a08){logger[_0x42c5('0xc')](_0x42c5('0x2a'),_0x416198);logger[_0x42c5('0xf')](_0x42c5('0x2a'),_0x416198,JSON[_0x42c5('0x11')](_0x4d3a08));_0x481202(_0x4d3a08);})[_0x42c5('0x3d')](function(_0x24265c){logger[_0x42c5('0x12')](_0x42c5('0x2a'),_0x24265c[_0x42c5('0x14')],_0x416198);_0x53dc30(_0x3d0146[_0x42c5('0x12')](0x1f4,_0x24265c[_0x42c5('0x14')]));});});};exports[_0x42c5('0x3e')]=function(_0x475ed3){var _0x58f15d=this;return new Promise(function(_0x598f8a,_0x267b2e){return db[_0x42c5('0x17')][_0x42c5('0x1d')]({'raw':_0x475ed3[_0x42c5('0x1a')]?_0x475ed3[_0x42c5('0x1a')][_0x42c5('0x1b')]===undefined?!![]:![]:!![],'where':_0x475ed3[_0x42c5('0x1a')]?_0x475ed3[_0x42c5('0x1a')]['where']||null:null,'attributes':[[_0x42c5('0x2b'),_0x42c5('0x2c')],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['col']('id')),_0x42c5('0x3f')],[db[_0x42c5('0x1f')]['fn'](_0x42c5('0x20'),db[_0x42c5('0x1f')]['fn']('IF',db[_0x42c5('0x1f')][_0x42c5('0x22')](_0x42c5('0x23')))),_0x42c5('0x40')]],'group':[_0x42c5('0x2b')]})['then'](function(_0x46a53c){logger['info'](_0x42c5('0x3e'),_0x475ed3);logger['debug']('GetCampaignHopperHistory',_0x475ed3,JSON[_0x42c5('0x11')](_0x46a53c));_0x598f8a(_0x46a53c);})['catch'](function(_0x101c27){logger['error'](_0x42c5('0x3e'),_0x101c27[_0x42c5('0x14')],_0x475ed3);_0x267b2e(_0x58f15d['error'](0x1f4,_0x101c27['message']));});});}; \ No newline at end of file +var _0x51c4=['`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperHistory,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','info','AvgHandleTime','findAll','where','sequelize','col','COUNT','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x203,\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','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null'];(function(_0x403c71,_0x5cea7e){var _0x2c35d0=function(_0x464db4){while(--_0x464db4){_0x403c71['push'](_0x403c71['shift']());}};_0x2c35d0(++_0x5cea7e);}(_0x51c4,0x192));var _0x451c=function(_0x273182,_0x4c5ab8){_0x273182=_0x273182-0x0;var _0x26f2b6=_0x51c4[_0x273182];return _0x26f2b6;};'use strict';var _=require('lodash');var util=require(_0x451c('0x0'));var moment=require(_0x451c('0x1'));var BPromise=require(_0x451c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x451c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x451c('0x4'));var logger=require(_0x451c('0x5'))(_0x451c('0x6'));var config=require(_0x451c('0x7'));var jayson=require(_0x451c('0x8'));var client=jayson[_0x451c('0x9')][_0x451c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ba692,_0x4b0e68,_0x27ee37){return new BPromise(function(_0x3dc7e0,_0xdb4846){return client['request'](_0x3ba692,_0x27ee37)[_0x451c('0xb')](function(_0x5f0588){logger['info'](_0x451c('0xc'),_0x4b0e68,'request\x20sent');logger[_0x451c('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4b0e68,_0x451c('0xe'),JSON[_0x451c('0xf')](_0x5f0588));if(_0x5f0588[_0x451c('0x10')]){if(_0x5f0588[_0x451c('0x10')][_0x451c('0x11')]===0x1f4){logger[_0x451c('0x10')](_0x451c('0xc'),_0x4b0e68,_0x5f0588[_0x451c('0x10')][_0x451c('0x12')]);return _0xdb4846(_0x5f0588[_0x451c('0x10')][_0x451c('0x12')]);}logger[_0x451c('0x10')](_0x451c('0xc'),_0x4b0e68,_0x5f0588[_0x451c('0x10')][_0x451c('0x12')]);return _0x3dc7e0(_0x5f0588[_0x451c('0x10')][_0x451c('0x12')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x4b0e68,'request\x20sent');_0x3dc7e0(_0x5f0588[_0x451c('0x13')][_0x451c('0x12')]);}})[_0x451c('0x14')](function(_0x43165c){logger[_0x451c('0x10')](_0x451c('0xc'),_0x4b0e68,_0x43165c);_0xdb4846(_0x43165c);});});}exports[_0x451c('0x15')]=function(_0x99af07){var _0x3e4f70=this;return new Promise(function(_0x1a0727,_0x4f1cca){return db[_0x451c('0x16')][_0x451c('0x17')](_0x99af07['body'],{'raw':_0x99af07['options']?_0x99af07[_0x451c('0x18')][_0x451c('0x19')]===undefined?!![]:![]:!![]})[_0x451c('0xb')](function(_0x381814){logger[_0x451c('0x1a')]('CreateCmHopperHistory',_0x99af07);logger[_0x451c('0xd')](_0x451c('0x15'),_0x99af07,JSON[_0x451c('0xf')](_0x381814));_0x1a0727(_0x381814);})['catch'](function(_0x3f167e){logger['error'](_0x451c('0x15'),_0x3f167e[_0x451c('0x12')],_0x99af07);_0x4f1cca(_0x3e4f70[_0x451c('0x10')](0x1f4,_0x3f167e['message']));});});};exports[_0x451c('0x1b')]=function(_0x2138a1){var _0x29e1e9=this;return new Promise(function(_0x4bd4be,_0x6fb206){return db[_0x451c('0x16')][_0x451c('0x1c')]({'raw':_0x2138a1[_0x451c('0x18')]?_0x2138a1[_0x451c('0x18')][_0x451c('0x19')]===undefined?!![]:![]:!![],'where':_0x2138a1[_0x451c('0x18')]?_0x2138a1['options'][_0x451c('0x1d')]||null:null,'attributes':[[db[_0x451c('0x1e')]['fn']('COUNT',db[_0x451c('0x1e')][_0x451c('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db[_0x451c('0x1e')]['fn'](_0x451c('0x20'),db[_0x451c('0x1e')]['fn']('IF',db[_0x451c('0x1e')]['literal'](_0x451c('0x21')))),_0x451c('0x22')],[db[_0x451c('0x1e')]['fn'](_0x451c('0x20'),db[_0x451c('0x1e')]['fn']('IF',db[_0x451c('0x1e')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x451c('0x23')],[db[_0x451c('0x1e')]['fn']('COUNT',db[_0x451c('0x1e')]['fn']('IF',db[_0x451c('0x1e')][_0x451c('0x24')](_0x451c('0x25')))),_0x451c('0x26')],[db[_0x451c('0x1e')]['fn'](_0x451c('0x27'),db[_0x451c('0x1e')]['fn']('IF',db[_0x451c('0x1e')][_0x451c('0x24')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x451c('0x28')],[db[_0x451c('0x1e')]['fn'](_0x451c('0x27'),db['sequelize']['fn']('IF',db[_0x451c('0x1e')]['literal'](_0x451c('0x29')))),_0x451c('0x2a')]]})[_0x451c('0xb')](function(_0x297f51){logger['info'](_0x451c('0x1b'),_0x2138a1);logger[_0x451c('0xd')](_0x451c('0x1b'),_0x2138a1,JSON[_0x451c('0xf')](_0x297f51));_0x4bd4be(_0x297f51);})[_0x451c('0x14')](function(_0x7e125){logger[_0x451c('0x10')](_0x451c('0x1b'),_0x7e125[_0x451c('0x12')],_0x2138a1);_0x6fb206(_0x29e1e9['error'](0x1f4,_0x7e125[_0x451c('0x12')]));});});};exports[_0x451c('0x2b')]=function(_0x5a7560){var _0x371746=this;return new Promise(function(_0x45f8e9,_0x1f66ad){return db[_0x451c('0x16')][_0x451c('0x1c')]({'raw':_0x5a7560[_0x451c('0x18')]?_0x5a7560['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a7560[_0x451c('0x18')]?_0x5a7560[_0x451c('0x18')][_0x451c('0x1d')]||null:null,'attributes':[['campaign',_0x451c('0x2c')],[db['sequelize']['fn']('COUNT',db[_0x451c('0x1e')]['fn']('IF',db[_0x451c('0x1e')][_0x451c('0x24')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x451c('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x451c('0x1e')][_0x451c('0x24')](_0x451c('0x2d')))),'outboundNoAnswerCallsDay'],[db[_0x451c('0x1e')]['fn'](_0x451c('0x20'),db[_0x451c('0x1e')]['fn']('IF',db[_0x451c('0x1e')][_0x451c('0x24')](_0x451c('0x21')))),_0x451c('0x2e')],[db[_0x451c('0x1e')]['fn'](_0x451c('0x20'),db[_0x451c('0x1e')]['fn']('IF',db[_0x451c('0x1e')][_0x451c('0x24')]('`state`\x20=\x205,\x201,\x20null'))),_0x451c('0x2f')],[db[_0x451c('0x1e')]['fn'](_0x451c('0x20'),db[_0x451c('0x1e')]['fn']('IF',db[_0x451c('0x1e')][_0x451c('0x24')](_0x451c('0x30')))),_0x451c('0x31')],[db[_0x451c('0x1e')]['fn'](_0x451c('0x20'),db['sequelize']['fn']('IF',db[_0x451c('0x1e')][_0x451c('0x24')](_0x451c('0x32')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x451c('0x20'),db[_0x451c('0x1e')]['fn']('IF',db[_0x451c('0x1e')]['literal'](_0x451c('0x33')))),_0x451c('0x34')],[db['sequelize']['fn'](_0x451c('0x20'),db[_0x451c('0x1e')]['fn']('IF',db[_0x451c('0x1e')][_0x451c('0x24')](_0x451c('0x35')))),'outboundUnknownCallsDay'],[db[_0x451c('0x1e')]['fn'](_0x451c('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x451c('0x24')](_0x451c('0x36')))),_0x451c('0x37')],[db[_0x451c('0x1e')]['fn'](_0x451c('0x20'),db['sequelize']['fn']('IF',db[_0x451c('0x1e')][_0x451c('0x24')]('`state`\x20=\x2014,\x201,\x20null'))),_0x451c('0x38')],[db['sequelize']['fn'](_0x451c('0x20'),db[_0x451c('0x1e')]['fn']('IF',db[_0x451c('0x1e')][_0x451c('0x24')]('`state`\x20=\x2018,\x201,\x20null'))),_0x451c('0x39')],[db['sequelize']['fn'](_0x451c('0x20'),db[_0x451c('0x1e')]['fn']('IF',db['sequelize'][_0x451c('0x24')](_0x451c('0x3a')))),'outboundAnswerAgiCallsDay'],[db[_0x451c('0x1e')]['fn'](_0x451c('0x20'),db['sequelize']['fn']('IF',db[_0x451c('0x1e')]['literal'](_0x451c('0x3b')))),_0x451c('0x39')],[db[_0x451c('0x1e')]['fn'](_0x451c('0x20'),db[_0x451c('0x1e')]['fn']('IF',db[_0x451c('0x1e')][_0x451c('0x24')](_0x451c('0x3c')))),_0x451c('0x3d')]],'group':[_0x451c('0x3e')]})['then'](function(_0x372d16){logger['info'](_0x451c('0x2b'),_0x5a7560);logger[_0x451c('0xd')]('GetVoiceQueueHopperHistory',_0x5a7560,JSON['stringify'](_0x372d16));_0x45f8e9(_0x372d16);})[_0x451c('0x14')](function(_0x17b35b){logger[_0x451c('0x10')](_0x451c('0x2b'),_0x17b35b[_0x451c('0x12')],_0x5a7560);_0x1f66ad(_0x371746[_0x451c('0x10')](0x1f4,_0x17b35b[_0x451c('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x3c16ad){var _0x1f8a95=this;return new Promise(function(_0x10c5aa,_0x2089f5){return db[_0x451c('0x16')][_0x451c('0x1c')]({'raw':_0x3c16ad[_0x451c('0x18')]?_0x3c16ad[_0x451c('0x18')][_0x451c('0x19')]===undefined?!![]:![]:!![],'where':_0x3c16ad[_0x451c('0x18')]?_0x3c16ad['options']['where']||null:null,'attributes':[[_0x451c('0x3e'),_0x451c('0x2c')],[db['sequelize']['fn'](_0x451c('0x20'),db[_0x451c('0x1e')]['col']('id')),_0x451c('0x3f')],[db[_0x451c('0x1e')]['fn'](_0x451c('0x20'),db[_0x451c('0x1e')]['fn']('IF',db['sequelize'][_0x451c('0x24')](_0x451c('0x21')))),_0x451c('0x40')]],'group':[_0x451c('0x3e')]})[_0x451c('0xb')](function(_0x14dbf){logger[_0x451c('0x1a')](_0x451c('0x41'),_0x3c16ad);logger['debug']('GetCampaignHopperHistory',_0x3c16ad,JSON[_0x451c('0xf')](_0x14dbf));_0x10c5aa(_0x14dbf);})[_0x451c('0x14')](function(_0x542346){logger[_0x451c('0x10')](_0x451c('0x41'),_0x542346[_0x451c('0x12')],_0x3c16ad);_0x2089f5(_0x1f8a95[_0x451c('0x10')](0x1f4,_0x542346[_0x451c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index fe23de8..9496201 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 _0x657f=['show','post','create','put','update','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x5dd840,_0x4394a3){var _0x2a8253=function(_0x32d8af){while(--_0x32d8af){_0x5dd840['push'](_0x5dd840['shift']());}};_0x2a8253(++_0x4394a3);}(_0x657f,0x181));var _0xf657=function(_0x5ae93d,_0x48a929){_0x5ae93d=_0x5ae93d-0x0;var _0x3bc344=_0x657f[_0x5ae93d];return _0x3bc344;};'use strict';var multer=require('multer');var util=require(_0xf657('0x0'));var path=require('path');var timeout=require(_0xf657('0x1'));var express=require(_0xf657('0x2'));var router=express[_0xf657('0x3')]();var fs_extra=require(_0xf657('0x4'));var auth=require(_0xf657('0x5'));var interaction=require(_0xf657('0x6'));var config=require(_0xf657('0x7'));var controller=require(_0xf657('0x8'));router[_0xf657('0x9')]('/',auth[_0xf657('0xa')](),controller[_0xf657('0xb')]);router[_0xf657('0x9')](_0xf657('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xf657('0x9')](_0xf657('0xd'),auth['isAuthenticated'](),controller[_0xf657('0xe')]);router[_0xf657('0xf')]('/',auth[_0xf657('0xa')](),controller[_0xf657('0x10')]);router[_0xf657('0x11')](_0xf657('0xd'),auth[_0xf657('0xa')](),controller[_0xf657('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5cf8=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','post','create','/:id','update','exports','multer','util'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0x5cf8,0x1de));var _0x85cf=function(_0x14e393,_0x5ef7b3){_0x14e393=_0x14e393-0x0;var _0x5b5ffa=_0x5cf8[_0x14e393];return _0x5b5ffa;};'use strict';var multer=require(_0x85cf('0x0'));var util=require(_0x85cf('0x1'));var path=require(_0x85cf('0x2'));var timeout=require(_0x85cf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x85cf('0x4'));var interaction=require(_0x85cf('0x5'));var config=require(_0x85cf('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x85cf('0x7')]('/',auth[_0x85cf('0x8')](),controller['index']);router[_0x85cf('0x7')](_0x85cf('0x9'),auth[_0x85cf('0x8')](),controller[_0x85cf('0xa')]);router[_0x85cf('0x7')]('/:id',auth[_0x85cf('0x8')](),controller['show']);router[_0x85cf('0xb')]('/',auth[_0x85cf('0x8')](),controller[_0x85cf('0xc')]);router['put'](_0x85cf('0xd'),auth[_0x85cf('0x8')](),controller[_0x85cf('0xe')]);module[_0x85cf('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 8d5e891..1d601b4 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 _0xf8b2=['STRING','name','sequelize','exports'];(function(_0x272c3c,_0x524816){var _0x1f96d4=function(_0x107301){while(--_0x107301){_0x272c3c['push'](_0x272c3c['shift']());}};_0x1f96d4(++_0x524816);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x6ae66b,_0x3ba914){_0x6ae66b=_0x6ae66b-0x0;var _0x465cef=_0xf8b2[_0x6ae66b];return _0x465cef;};'use strict';var Sequelize=require(_0x2f8b('0x0'));module[_0x2f8b('0x1')]={'name':{'type':Sequelize[_0x2f8b('0x2')],'unique':_0x2f8b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2f8b('0x2')]},'dialPrefix':{'type':Sequelize[_0x2f8b('0x2')]}}; \ No newline at end of file +var _0xc906=['STRING','sequelize','exports','name'];(function(_0xfa9e49,_0x41cfbe){var _0x2650bf=function(_0x58069d){while(--_0x58069d){_0xfa9e49['push'](_0xfa9e49['shift']());}};_0x2650bf(++_0x41cfbe);}(_0xc906,0x1ad));var _0x6c90=function(_0x13002c,_0x4e79e8){_0x13002c=_0x13002c-0x0;var _0x1b9606=_0xc906[_0x13002c];return _0x1b9606;};'use strict';var Sequelize=require(_0x6c90('0x0'));module[_0x6c90('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6c90('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6c90('0x3')]},'dialPrefix':{'type':Sequelize[_0x6c90('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 6c2dd02..9644097 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 _0x36af=['CmCustomField','CustomFields','concat','format','hasOwnProperty','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','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','defaults','redis','socket.io-emitter','register','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','Lists','UserProfileResource','then','error','stack','name','send','map','CmList','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','ListId','filter','removeDispositions','ids','CmContact','tags','isArray','join','push','each','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts'];(function(_0x4c7c31,_0x494b9c){var _0x210ee9=function(_0x48b6ab){while(--_0x48b6ab){_0x4c7c31['push'](_0x4c7c31['shift']());}};_0x210ee9(++_0x494b9c);}(_0x36af,0x185));var _0xf36a=function(_0x38bbb8,_0x3f5dda){_0x38bbb8=_0x38bbb8-0x0;var _0x1d7e26=_0x36af[_0x38bbb8];return _0x1d7e26;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf36a('0x0'));var zipdir=require(_0xf36a('0x1'));var jsonpatch=require(_0xf36a('0x2'));var rp=require(_0xf36a('0x3'));var moment=require(_0xf36a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf36a('0x5'));var util=require('util');var path=require(_0xf36a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf36a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf36a('0x8'));var squel=require(_0xf36a('0x9'));var crypto=require(_0xf36a('0xa'));var jsforce=require(_0xf36a('0xb'));var deskjs=require(_0xf36a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf36a('0xd'));var Papa=require(_0xf36a('0xe'));var Redis=require(_0xf36a('0xf'));var authService=require(_0xf36a('0x10'));var qs=require(_0xf36a('0x11'));var as=require(_0xf36a('0x12'));var hardwareService=require(_0xf36a('0x13'));var logger=require(_0xf36a('0x14'))('api');var utils=require(_0xf36a('0x15'));var config=require(_0xf36a('0x16'));var licenseUtil=require(_0xf36a('0x17'));var db=require(_0xf36a('0x18'))['db'];var csv_results;config['redis']=_[_0xf36a('0x19')](config[_0xf36a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xf36a('0x1b'))(new Redis(config[_0xf36a('0x1a')]));require('./cmList.socket')[_0xf36a('0x1c')](socket);function respondWithStatusCode(_0xd3eb18,_0x129a4f){_0x129a4f=_0x129a4f||0xcc;return function(_0x1929b3){if(_0x1929b3){return _0xd3eb18[_0xf36a('0x1d')](_0x129a4f);}return _0xd3eb18[_0xf36a('0x1e')](_0x129a4f)['end']();};}function respondWithResult(_0x3a742b,_0x172bad){_0x172bad=_0x172bad||0xc8;return function(_0xc3e747){if(_0xc3e747){return _0x3a742b[_0xf36a('0x1e')](_0x172bad)[_0xf36a('0x1f')](_0xc3e747);}};}function respondWithFilteredResult(_0x239ac1,_0x4a8930){return function(_0xaab686){if(_0xaab686){var _0x55677d=typeof _0x4a8930[_0xf36a('0x20')]==='undefined'&&typeof _0x4a8930['limit']==='undefined';var _0x24ad5f=_0xaab686[_0xf36a('0x21')];var _0x150c4b=_0x55677d?0x0:_0x4a8930[_0xf36a('0x20')];var _0x32a70f=_0x55677d?_0xaab686['count']:_0x4a8930[_0xf36a('0x20')]+_0x4a8930[_0xf36a('0x22')];var _0x1e46ea;if(_0x32a70f>=_0x24ad5f){_0x32a70f=_0x24ad5f;_0x1e46ea=0xc8;}else{_0x1e46ea=0xce;}_0x239ac1[_0xf36a('0x1e')](_0x1e46ea);return _0x239ac1[_0xf36a('0x23')](_0xf36a('0x24'),_0x150c4b+'-'+_0x32a70f+'/'+_0x24ad5f)[_0xf36a('0x1f')](_0xaab686);}return null;};}function patchUpdates(_0x71020){return function(_0x199f05){try{jsonpatch[_0xf36a('0x25')](_0x199f05,_0x71020,!![]);}catch(_0x3d251f){return BPromise[_0xf36a('0x26')](_0x3d251f);}return _0x199f05[_0xf36a('0x27')]();};}function saveUpdates(_0x274e61,_0x2407f0){return function(_0x14574c){if(_0x14574c){return _0x14574c[_0xf36a('0x28')](_0x274e61)['then'](function(_0x266075){return _0x266075;});}return null;};}function removeEntity(_0x5d283f,_0x4ba4a6){return function(_0x4d4527){if(_0x4d4527){return _0x4d4527[_0xf36a('0x29')]()['then'](function(){var _0x48fbf6=_0x4d4527['get']({'plain':!![]});var _0x5b506d=_0xf36a('0x2a');return db[_0xf36a('0x2b')][_0xf36a('0x29')]({'where':{'type':_0x5b506d,'resourceId':_0x48fbf6['id']}})[_0xf36a('0x2c')](function(){return _0x4d4527;});})[_0xf36a('0x2c')](function(){_0x5d283f[_0xf36a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ae27a,_0x3a2d54){return function(_0x2e6684){if(!_0x2e6684){_0x3ae27a[_0xf36a('0x1d')](0x194);}return _0x2e6684;};}function handleError(_0x1a8cab,_0x135293){_0x135293=_0x135293||0x1f4;return function(_0x2f8cad){logger[_0xf36a('0x2d')](_0x2f8cad[_0xf36a('0x2e')]);if(_0x2f8cad[_0xf36a('0x2f')]){delete _0x2f8cad[_0xf36a('0x2f')];}_0x1a8cab['status'](_0x135293)[_0xf36a('0x30')](_0x2f8cad);};}exports['index']=function(_0x24c376,_0x4ce894){var _0x13e459={},_0x4dcd95={},_0x1a8dfe={'count':0x0,'rows':[]};var _0x2b310d=_[_0xf36a('0x31')](db[_0xf36a('0x32')]['rawAttributes'],function(_0x4860df){return{'name':_0x4860df[_0xf36a('0x33')],'type':_0x4860df[_0xf36a('0x34')][_0xf36a('0x35')]};});_0x4dcd95[_0xf36a('0x36')]=_['map'](_0x2b310d,_0xf36a('0x2f'));_0x4dcd95[_0xf36a('0x37')]=_[_0xf36a('0x38')](_0x24c376[_0xf36a('0x37')]);_0x4dcd95[_0xf36a('0x39')]=_[_0xf36a('0x3a')](_0x4dcd95[_0xf36a('0x36')],_0x4dcd95[_0xf36a('0x37')]);_0x13e459[_0xf36a('0x3b')]=_[_0xf36a('0x3a')](_0x4dcd95[_0xf36a('0x36')],qs[_0xf36a('0x3c')](_0x24c376[_0xf36a('0x37')][_0xf36a('0x3c')]));_0x13e459[_0xf36a('0x3b')]=_0x13e459[_0xf36a('0x3b')][_0xf36a('0x3d')]?_0x13e459['attributes']:_0x4dcd95[_0xf36a('0x36')];if(!_0x24c376[_0xf36a('0x37')]['hasOwnProperty'](_0xf36a('0x3e'))){_0x13e459[_0xf36a('0x22')]=qs[_0xf36a('0x22')](_0x24c376[_0xf36a('0x37')][_0xf36a('0x22')]);_0x13e459['offset']=qs['offset'](_0x24c376[_0xf36a('0x37')][_0xf36a('0x20')]);}_0x13e459[_0xf36a('0x3f')]=qs[_0xf36a('0x40')](_0x24c376[_0xf36a('0x37')][_0xf36a('0x40')]);_0x13e459[_0xf36a('0x41')]=qs[_0xf36a('0x39')](_[_0xf36a('0x42')](_0x24c376['query'],_0x4dcd95['filters']),_0x2b310d);if(_0x24c376[_0xf36a('0x37')]['filter']){_0x13e459[_0xf36a('0x41')]=_[_0xf36a('0x43')](_0x13e459[_0xf36a('0x41')],{'$or':_['map'](_0x2b310d,function(_0x28778d){if(_0x28778d[_0xf36a('0x34')]!==_0xf36a('0x44')){var _0x418ea0={};_0x418ea0[_0x28778d[_0xf36a('0x2f')]]={'$like':'%'+_0x24c376[_0xf36a('0x37')]['filter']+'%'};return _0x418ea0;}})});}_0x13e459=_[_0xf36a('0x43')]({},_0x13e459,_0x24c376[_0xf36a('0x45')]);var _0x19a763={'where':_0x13e459[_0xf36a('0x41')]};return db[_0xf36a('0x32')][_0xf36a('0x21')](_0x19a763)[_0xf36a('0x2c')](function(_0x4ffb4c){_0x1a8dfe['count']=_0x4ffb4c;if(_0x24c376[_0xf36a('0x37')][_0xf36a('0x46')]){_0x13e459[_0xf36a('0x47')]=[{'all':!![]}];}return db['CmList'][_0xf36a('0x48')](_0x13e459);})[_0xf36a('0x2c')](function(_0x424dac){_0x1a8dfe['rows']=_0x424dac;return _0x1a8dfe;})['then'](respondWithFilteredResult(_0x4ce894,_0x13e459))[_0xf36a('0x49')](handleError(_0x4ce894,null));};exports[_0xf36a('0x4a')]=function(_0x53237a,_0x50d453){var _0x255b66={'raw':![],'where':{'id':_0x53237a[_0xf36a('0x4b')]['id']}},_0x3ad3f3={};_0x3ad3f3[_0xf36a('0x36')]=_[_0xf36a('0x38')](db[_0xf36a('0x32')][_0xf36a('0x4c')]);_0x3ad3f3[_0xf36a('0x37')]=_[_0xf36a('0x38')](_0x53237a[_0xf36a('0x37')]);_0x3ad3f3[_0xf36a('0x39')]=_[_0xf36a('0x3a')](_0x3ad3f3[_0xf36a('0x36')],_0x3ad3f3['query']);_0x255b66[_0xf36a('0x3b')]=_[_0xf36a('0x3a')](_0x3ad3f3[_0xf36a('0x36')],qs[_0xf36a('0x3c')](_0x53237a[_0xf36a('0x37')][_0xf36a('0x3c')]));_0x255b66[_0xf36a('0x3b')]=_0x255b66[_0xf36a('0x3b')]['length']?_0x255b66[_0xf36a('0x3b')]:_0x3ad3f3['model'];if(_0x53237a[_0xf36a('0x37')][_0xf36a('0x46')]){_0x255b66[_0xf36a('0x47')]=[{'all':!![]}];}_0x255b66=_[_0xf36a('0x43')]({},_0x255b66,_0x53237a[_0xf36a('0x45')]);return db['CmList'][_0xf36a('0x4d')](_0x255b66)[_0xf36a('0x2c')](handleEntityNotFound(_0x50d453,null))[_0xf36a('0x2c')](respondWithResult(_0x50d453,null))[_0xf36a('0x49')](handleError(_0x50d453,null));};exports[_0xf36a('0x4e')]=function(_0x46fe3f,_0x5eeb1a){return db[_0xf36a('0x32')]['create'](_0x46fe3f[_0xf36a('0x4f')],{})['then'](function(_0xfc786d){var _0x1d2e31=_0x46fe3f['user'][_0xf36a('0x50')]({'plain':!![]});if(!_0x1d2e31)throw new Error(_0xf36a('0x51'));if(_0x1d2e31[_0xf36a('0x52')]===_0xf36a('0x53')){var _0x568a58=_0xfc786d['get']({'plain':!![]});var _0x57cd4c='Lists';return db[_0xf36a('0x54')][_0xf36a('0x4d')]({'where':{'name':_0x57cd4c,'userProfileId':_0x1d2e31[_0xf36a('0x55')]},'raw':!![]})[_0xf36a('0x2c')](function(_0xbdef9e){if(_0xbdef9e&&_0xbdef9e[_0xf36a('0x56')]===0x0){return db[_0xf36a('0x2b')][_0xf36a('0x4e')]({'name':_0x568a58[_0xf36a('0x2f')],'resourceId':_0x568a58['id'],'type':_0xbdef9e[_0xf36a('0x2f')],'sectionId':_0xbdef9e['id']},{})[_0xf36a('0x2c')](function(){return _0xfc786d;});}else{return _0xfc786d;}})[_0xf36a('0x49')](function(_0x13f974){logger['error'](_0xf36a('0x57'),_0x13f974);throw _0x13f974;});}return _0xfc786d;})[_0xf36a('0x2c')](respondWithResult(_0x5eeb1a,0xc9))[_0xf36a('0x49')](handleError(_0x5eeb1a,null));};exports[_0xf36a('0x28')]=function(_0x1b5f92,_0x4da8a6){if(_0x1b5f92[_0xf36a('0x4f')]['id']){delete _0x1b5f92[_0xf36a('0x4f')]['id'];}return db[_0xf36a('0x32')][_0xf36a('0x4d')]({'where':{'id':_0x1b5f92[_0xf36a('0x4b')]['id']}})[_0xf36a('0x2c')](handleEntityNotFound(_0x4da8a6,null))[_0xf36a('0x2c')](saveUpdates(_0x1b5f92[_0xf36a('0x4f')],null))[_0xf36a('0x2c')](respondWithResult(_0x4da8a6,null))[_0xf36a('0x49')](handleError(_0x4da8a6,null));};exports[_0xf36a('0x29')]=function(_0x3634f6,_0x596b0a){return db[_0xf36a('0x32')]['find']({'where':{'id':_0x3634f6['params']['id']}})[_0xf36a('0x2c')](handleEntityNotFound(_0x596b0a,null))['then'](removeEntity(_0x596b0a,null))[_0xf36a('0x49')](handleError(_0x596b0a,null));};exports[_0xf36a('0x58')]=function(_0x244591,_0xbc5fb8){return db[_0xf36a('0x32')][_0xf36a('0x58')]()['then'](respondWithResult(_0xbc5fb8,null))[_0xf36a('0x49')](handleError(_0xbc5fb8,null));};exports[_0xf36a('0x59')]=function(_0x273cc7,_0x1cd65c,_0x49f12e){if(_0x273cc7[_0xf36a('0x4f')]['id']){delete _0x273cc7[_0xf36a('0x4f')]['id'];}return db[_0xf36a('0x32')][_0xf36a('0x4d')]({'where':{'id':_0x273cc7['params']['id']}})['then'](handleEntityNotFound(_0x1cd65c,null))['then'](function(_0x398f94){if(_0x398f94){_0x273cc7[_0xf36a('0x4f')]['ListId']=_0x398f94['id'];return db[_0xf36a('0x5a')]['create'](_0x273cc7[_0xf36a('0x4f')]);}})[_0xf36a('0x2c')](respondWithResult(_0x1cd65c,null))[_0xf36a('0x49')](handleError(_0x1cd65c,null));};exports[_0xf36a('0x5b')]=function(_0x23b210,_0x565e61,_0x487a06){var _0x2cbbed={'raw':![],'where':{}};var _0x3c3222={};var _0x74c2b5={'count':0x0,'rows':[]};return db[_0xf36a('0x32')][_0xf36a('0x5c')]({'where':{'id':_0x23b210[_0xf36a('0x4b')]['id']}})[_0xf36a('0x2c')](handleEntityNotFound(_0x565e61,null))[_0xf36a('0x2c')](function(_0x3db48a){if(_0x3db48a){_0x3c3222['model']=_[_0xf36a('0x38')](db[_0xf36a('0x5a')][_0xf36a('0x4c')]);_0x3c3222[_0xf36a('0x37')]=_[_0xf36a('0x38')](_0x23b210[_0xf36a('0x37')]);_0x3c3222[_0xf36a('0x39')]=_[_0xf36a('0x3a')](_0x3c3222['model'],_0x3c3222['query']);_0x2cbbed['attributes']=_['intersection'](_0x3c3222[_0xf36a('0x36')],qs[_0xf36a('0x3c')](_0x23b210[_0xf36a('0x37')][_0xf36a('0x3c')]));_0x2cbbed[_0xf36a('0x3b')]=_0x2cbbed[_0xf36a('0x3b')][_0xf36a('0x3d')]?_0x2cbbed[_0xf36a('0x3b')]:_0x3c3222['model'];if(!_0x23b210[_0xf36a('0x37')]['hasOwnProperty'](_0xf36a('0x3e'))){_0x2cbbed[_0xf36a('0x22')]=qs[_0xf36a('0x22')](_0x23b210[_0xf36a('0x37')]['limit']);_0x2cbbed['offset']=qs['offset'](_0x23b210[_0xf36a('0x37')][_0xf36a('0x20')]);}_0x2cbbed[_0xf36a('0x3f')]=qs[_0xf36a('0x40')](_0x23b210[_0xf36a('0x37')][_0xf36a('0x40')]);_0x2cbbed['where']=qs[_0xf36a('0x39')](_[_0xf36a('0x42')](_0x23b210[_0xf36a('0x37')],_0x3c3222[_0xf36a('0x39')]));_0x2cbbed[_0xf36a('0x41')][_0xf36a('0x5d')]=_0x3db48a['id'];if(_0x23b210[_0xf36a('0x37')][_0xf36a('0x5e')]){_0x2cbbed[_0xf36a('0x41')]=_[_0xf36a('0x43')](_0x2cbbed['where'],{'$or':_['map'](_0x2cbbed[_0xf36a('0x3b')],function(_0x135205){var _0x1122fa={};_0x1122fa[_0x135205]={'$like':'%'+_0x23b210[_0xf36a('0x37')][_0xf36a('0x5e')]+'%'};return _0x1122fa;})});}_0x2cbbed=_[_0xf36a('0x43')]({},_0x2cbbed,_0x23b210['options']);return db[_0xf36a('0x5a')][_0xf36a('0x21')]({'where':_0x2cbbed[_0xf36a('0x41')]})[_0xf36a('0x2c')](function(_0x43e4d1){_0x74c2b5[_0xf36a('0x21')]=_0x43e4d1;if(_0x23b210[_0xf36a('0x37')]['includeAll']){_0x2cbbed['include']=[{'all':!![]}];}return db[_0xf36a('0x5a')][_0xf36a('0x48')](_0x2cbbed);})[_0xf36a('0x2c')](function(_0x497efb){_0x74c2b5['rows']=_0x497efb;return _0x74c2b5;});}})[_0xf36a('0x2c')](respondWithFilteredResult(_0x565e61,_0x2cbbed))['catch'](handleError(_0x565e61,null));};exports[_0xf36a('0x5f')]=function(_0x10d9ea,_0x1f69ed,_0x298663){return db['CmList'][_0xf36a('0x4d')]({'where':{'id':_0x10d9ea[_0xf36a('0x4b')]['id']}})[_0xf36a('0x2c')](handleEntityNotFound(_0x1f69ed,null))[_0xf36a('0x2c')](function(_0x36ffc9){if(_0x36ffc9){return _0x36ffc9['removeDispositions'](_0x10d9ea[_0xf36a('0x37')][_0xf36a('0x60')]);}})[_0xf36a('0x2c')](respondWithStatusCode(_0x1f69ed,null))[_0xf36a('0x49')](handleError(_0x1f69ed,null));};exports['addContacts']=function(_0x54416e,_0x163938,_0x175aea){return db[_0xf36a('0x32')][_0xf36a('0x4d')]({'where':{'id':_0x54416e[_0xf36a('0x4b')]['id']}})[_0xf36a('0x2c')](handleEntityNotFound(_0x163938,null))[_0xf36a('0x2c')](function(_0xce9f6a){if(_0xce9f6a){var _0x3efa18=[];var _0x21c95e={'success':[],'errors':[]};return db[_0xf36a('0x61')][_0xf36a('0x58')]()[_0xf36a('0x2c')](function(_0xef2fd6){if(_0x54416e[_0xf36a('0x4f')][_0xf36a('0x62')]&&_[_0xf36a('0x63')](_0x54416e[_0xf36a('0x4f')][_0xf36a('0x62')])){if(_0x54416e[_0xf36a('0x4f')][_0xf36a('0x62')]['length']){_0x54416e[_0xf36a('0x4f')][_0xf36a('0x62')]=_0x54416e[_0xf36a('0x4f')][_0xf36a('0x62')][_0xf36a('0x64')](';')+';';}else{_0x54416e[_0xf36a('0x4f')][_0xf36a('0x62')]=null;}}else{_0x54416e[_0xf36a('0x4f')][_0xf36a('0x62')]=null;}if(_0x54416e['body']&&_['isArray'](_0x54416e[_0xf36a('0x4f')])){for(var _0x5dfaff=0x0;_0x5dfaff<_0x54416e[_0xf36a('0x4f')]['length'];_0x5dfaff+=0x1){_0x54416e[_0xf36a('0x4f')][_0x5dfaff][_0xf36a('0x5d')]=_0x54416e[_0xf36a('0x4b')]['id'];_0x3efa18[_0xf36a('0x65')](_0x54416e[_0xf36a('0x4f')][_0x5dfaff]);}return BPromise[_0xf36a('0x66')](_0x3efa18,function(_0x624815){return db[_0xf36a('0x61')]['create'](_['omit'](_0x624815,[_0xf36a('0x60'),'id'])||{},{'fields':_['keys'](_0xef2fd6),'raw':!![]})[_0xf36a('0x2c')](function(_0x1a7541){_0x21c95e[_0xf36a('0x67')][_0xf36a('0x65')](_0x1a7541[_0xf36a('0x68')]);})[_0xf36a('0x49')](function(_0x37a0b8){_0x21c95e[_0xf36a('0x69')][_0xf36a('0x65')]({'data':_0x624815,'error':_0x37a0b8[_0xf36a('0x6a')]});});})[_0xf36a('0x2c')](function(_0xe5fb72){return _0x21c95e;})['catch'](function(_0x376f71){return _0x376f71;});}else{_0x163938[_0xf36a('0x1e')](0x190)['json']({'message':_0xf36a('0x6b')});}});}})[_0xf36a('0x2c')](respondWithResult(_0x163938,null))['catch'](handleError(_0x163938,null));};exports[_0xf36a('0x6c')]=function(_0x4a5f5b,_0xf856f0,_0x37d7b7){var _0x18ea5a;return db[_0xf36a('0x32')][_0xf36a('0x4d')]({'where':{'id':_0x4a5f5b[_0xf36a('0x4b')]['id']},'include':[{'model':db[_0xf36a('0x6d')],'as':_0xf36a('0x6e')}]})['then'](handleEntityNotFound(_0xf856f0,null))[_0xf36a('0x2c')](function(_0x5039e8){if(_0x5039e8){_0x18ea5a=_0x5039e8;return db[_0xf36a('0x61')][_0xf36a('0x4c')];}})[_0xf36a('0x2c')](function(_0x4c5c4c){if(_0x4c5c4c){var _0x48add2={};var _0x4e3c83={};_0x4e3c83[_0xf36a('0x36')]=_[_0xf36a('0x6f')](_[_0xf36a('0x38')](_0x4c5c4c),_[_0xf36a('0x31')](_0x18ea5a[_0xf36a('0x6e')],function(_0x4d68cb){return util[_0xf36a('0x70')]('cf_%d',_0x4d68cb['id']);}));_0x4e3c83[_0xf36a('0x37')]=_[_0xf36a('0x38')](_0x4a5f5b[_0xf36a('0x37')]);_0x4e3c83[_0xf36a('0x39')]=_['intersection'](_0x4e3c83[_0xf36a('0x36')],_0x4e3c83['query']);_0x48add2[_0xf36a('0x3b')]=_[_0xf36a('0x3a')](_0x4e3c83[_0xf36a('0x36')],qs[_0xf36a('0x3c')](_0x4a5f5b['query']['fields']));_0x48add2['attributes']=_0x48add2[_0xf36a('0x3b')][_0xf36a('0x3d')]?_0x48add2[_0xf36a('0x3b')]:_0x4e3c83['model'];if(!_0x4a5f5b[_0xf36a('0x37')][_0xf36a('0x71')]('nolimit')){_0x48add2[_0xf36a('0x22')]=qs[_0xf36a('0x22')](_0x4a5f5b[_0xf36a('0x37')][_0xf36a('0x22')]);_0x48add2[_0xf36a('0x20')]=qs[_0xf36a('0x20')](_0x4a5f5b[_0xf36a('0x37')][_0xf36a('0x20')]);}_0x48add2[_0xf36a('0x3f')]=qs[_0xf36a('0x40')](_0x4a5f5b[_0xf36a('0x37')][_0xf36a('0x40')]);_0x48add2[_0xf36a('0x41')]=qs['filters'](_['pick'](_0x4a5f5b[_0xf36a('0x37')],_0x4e3c83['filters']));_0x48add2[_0xf36a('0x72')]=!![];if(_0x4a5f5b['query'][_0xf36a('0x5e')]){_0x48add2[_0xf36a('0x41')]=_[_0xf36a('0x43')](_0x48add2[_0xf36a('0x41')],{'$or':_[_0xf36a('0x31')](_0x48add2[_0xf36a('0x3b')],function(_0x4546d1){var _0x419702={};_0x419702[_0x4546d1]={'$like':'%'+_0x4a5f5b[_0xf36a('0x37')]['filter']+'%'};return _0x419702;})});}_0x48add2=_[_0xf36a('0x43')]({},_0x48add2,_0x4a5f5b[_0xf36a('0x45')]);return _0x18ea5a[_0xf36a('0x6c')](_0x48add2);}})[_0xf36a('0x2c')](respondWithResult(_0xf856f0,null))[_0xf36a('0x49')](handleError(_0xf856f0,null));};exports[_0xf36a('0x73')]=function(_0x15eb23,_0x19e072,_0x18c476){var _0x358162;var _0xb91171;var _0x3f4580;var _0x1b95b5=_0x15eb23[_0xf36a('0x4b')]['id'];csv_results=[];return db[_0xf36a('0x74')][_0xf36a('0x48')]({'attributes':['id',_0xf36a('0x2f')],'raw':!![],'order':[_0xf36a('0x75')]})[_0xf36a('0x2c')](function(_0x3eb690){_0x358162=_0x3eb690;var _0x55831d=_[_0xf36a('0x38')](db[_0xf36a('0x61')][_0xf36a('0x4c')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0xf36a('0x76')]})['then'](function(_0x5131e9){_0xb91171=_0x5131e9;var _0x56a4ff=squel[_0xf36a('0x77')]()[_0xf36a('0x3c')](_0x55831d)[_0xf36a('0x78')](_0xf36a('0x79'),'c')[_0xf36a('0x41')](_0xf36a('0x7a'),_0x1b95b5)['where'](_0xf36a('0x7b'))[_0xf36a('0x7c')]();for(var _0x703b37=0x0;_0x703b37<_0xb91171[_0xf36a('0x3d')];_0x703b37++){_0x56a4ff[_0xf36a('0x7d')](_0xf36a('0x7e')+_0xb91171[_0x703b37]['id'],_0xf36a('0x7f')+_0xb91171[_0x703b37][_0xf36a('0x76')]);}for(var _0x703b37=0x0;_0x703b37<_0x358162['length'];_0x703b37++){_0x56a4ff['field'](squel[_0xf36a('0x77')]()[_0xf36a('0x7d')](_0xf36a('0x80'))['from'](_0xf36a('0x81'))['where'](_0xf36a('0x82'),_0x358162[_0x703b37]['id'])[_0xf36a('0x41')](_0xf36a('0x83')),_0xf36a('0x84')+_0x358162[_0x703b37][_0xf36a('0x2f')]);_0x56a4ff['field'](squel[_0xf36a('0x77')]()[_0xf36a('0x7d')](_0xf36a('0x85'))['from']('cm_contact_has_items')['where'](_0xf36a('0x82'),_0x358162[_0x703b37]['id'])[_0xf36a('0x41')](_0xf36a('0x83')),'description_additionalPhone_'+_0x358162[_0x703b37][_0xf36a('0x2f')]);}var _0xb25b7c=[];_0xb25b7c['push'](_0x56a4ff['toString']());BPromise['each'](_0xb25b7c,handleQuery)[_0xf36a('0x2c')](function(_0x16d2de){handleQuery(_0x56a4ff['toString']());var _0x90589f=csv_results[0x0];if(!_['isEmpty'](_0x90589f)){var _0x3ffbf9=toCsv(_0x90589f);var _0x5cffc4=Date[_0xf36a('0x86')]();fs[_0xf36a('0x87')](util[_0xf36a('0x70')]('/tmp/list_%d_%s.csv',_0x1b95b5,_0x5cffc4),_0x3ffbf9);_0x19e072[_0xf36a('0x88')](_0xf36a('0x89'),_0xf36a('0x8a')+util['format'](_0xf36a('0x8b'),_0x1b95b5,_0x5cffc4));_0x19e072[_0xf36a('0x88')]('Content-type',_0xf36a('0x8c'));return _0x19e072['download'](util[_0xf36a('0x70')]('/tmp/list_%d_%s.csv',_0x1b95b5,_0x5cffc4));}else{return _0x19e072[_0xf36a('0x1d')](0xcc);}});});});};exports[_0xf36a('0x8d')]=function(_0x5b67bf,_0x313a5d,_0x16b2fd){var _0x2f62bc;delete _0x5b67bf[_0xf36a('0x4f')]['id'];return db['CmList']['findOne']({'where':{'id':_0x5b67bf[_0xf36a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x313a5d,null))[_0xf36a('0x2c')](function(_0x8ff234){if(_0x8ff234){return db[_0xf36a('0x8e')][_0xf36a('0x8f')](function(_0x36c3a4){return db[_0xf36a('0x6d')][_0xf36a('0x4e')](_0x5b67bf[_0xf36a('0x4f')],{'transaction':_0x36c3a4})[_0xf36a('0x2c')](function(_0x37bc6b){_0x2f62bc=_0x37bc6b;return _0x8ff234[_0xf36a('0x90')](_0x37bc6b,{'transaction':_0x36c3a4});})[_0xf36a('0x2c')](function(){var _0x5c8180={'type':db[_0xf36a('0x91')][_0xf36a('0x92')],'transaction':_0x36c3a4};switch(_0x5b67bf[_0xf36a('0x4f')][_0xf36a('0x34')]){case'text':_0x5c8180['type']=db[_0xf36a('0x91')][_0xf36a('0x92')];break;case _0xf36a('0x93'):_0x5c8180[_0xf36a('0x34')]=db['Sequelize'][_0xf36a('0x94')];break;case _0xf36a('0x95'):_0x5c8180[_0xf36a('0x34')]=db['Sequelize'][_0xf36a('0x96')];_0x5c8180[_0xf36a('0x97')]=![];break;default:}return db['sequelize'][_0xf36a('0x98')][_0xf36a('0x99')](_0xf36a('0x79'),util[_0xf36a('0x70')]('cf_%s',_0x2f62bc['id']),_0x5c8180);})['then'](function(){return _0x2f62bc;});});}})['then'](respondWithResult(_0x313a5d,null))[_0xf36a('0x49')](handleError(_0x313a5d,null));};exports[_0xf36a('0x9a')]=function(_0x433b9c,_0x27b74c,_0x13c80f){var _0x36ed09={};var _0x16b6f9={};var _0x71df59;var _0x33f9a7;return db[_0xf36a('0x32')]['findOne']({'where':{'id':_0x433b9c[_0xf36a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x27b74c,null))[_0xf36a('0x2c')](function(_0x7a9c68){if(_0x7a9c68){_0x71df59=_0x7a9c68;_0x16b6f9[_0xf36a('0x36')]=_['keys'](db[_0xf36a('0x6d')]['rawAttributes']);_0x16b6f9[_0xf36a('0x37')]=_[_0xf36a('0x38')](_0x433b9c['query']);_0x16b6f9['filters']=_[_0xf36a('0x3a')](_0x16b6f9[_0xf36a('0x36')],_0x16b6f9[_0xf36a('0x37')]);_0x36ed09[_0xf36a('0x3b')]=_[_0xf36a('0x3a')](_0x16b6f9['model'],qs['fields'](_0x433b9c[_0xf36a('0x37')][_0xf36a('0x3c')]));_0x36ed09[_0xf36a('0x3b')]=_0x36ed09[_0xf36a('0x3b')][_0xf36a('0x3d')]?_0x36ed09[_0xf36a('0x3b')]:_0x16b6f9[_0xf36a('0x36')];_0x36ed09[_0xf36a('0x3f')]=qs[_0xf36a('0x40')](_0x433b9c[_0xf36a('0x37')][_0xf36a('0x40')]);_0x36ed09[_0xf36a('0x41')]=qs['filters'](_[_0xf36a('0x42')](_0x433b9c[_0xf36a('0x37')],_0x16b6f9[_0xf36a('0x39')]));_0x36ed09[_0xf36a('0x41')]=_[_0xf36a('0x43')](_0x36ed09[_0xf36a('0x41')],{'$or':[{'ListId':_0x7a9c68['id']},{'ListId':null}]});if(_0x433b9c[_0xf36a('0x37')][_0xf36a('0x5e')]){_0x36ed09[_0xf36a('0x41')]=_[_0xf36a('0x43')](_0x36ed09[_0xf36a('0x41')],{'$or':_[_0xf36a('0x31')](_0x36ed09['attributes'],function(_0x4a33f2){var _0x18cbac={};_0x18cbac[_0x4a33f2]={'$like':'%'+_0x433b9c[_0xf36a('0x37')]['filter']+'%'};return _0x18cbac;})});}_0x36ed09=_[_0xf36a('0x43')]({},_0x36ed09,_0x433b9c[_0xf36a('0x45')]);return db[_0xf36a('0x6d')][_0xf36a('0x9b')](_0x36ed09);}})[_0xf36a('0x2c')](respondWithResult(_0x27b74c,null))['catch'](handleError(_0x27b74c,null));};exports[_0xf36a('0x9c')]=function(_0x59e7a7,_0x507041){return db[_0xf36a('0x6d')][_0xf36a('0x9b')]({'where':{'ListId':null}})[_0xf36a('0x2c')](handleEntityNotFound(_0x507041,null))['then'](function(_0x488ec6){return _0x488ec6;})[_0xf36a('0x2c')](respondWithResult(_0x507041,null))[_0xf36a('0x49')](handleError(_0x507041,null));};exports['addAgents']=function(_0x235937,_0x205fcb,_0x1fbe87){return db[_0xf36a('0x32')][_0xf36a('0x4d')]({'where':{'id':_0x235937['params']['id']}})['then'](handleEntityNotFound(_0x205fcb,null))[_0xf36a('0x2c')](function(_0x570e45){if(_0x570e45){return _0x570e45[_0xf36a('0x9d')](_0x235937[_0xf36a('0x4f')][_0xf36a('0x60')],_[_0xf36a('0x9e')](_0x235937[_0xf36a('0x4f')],[_0xf36a('0x60'),'id'])||{})[_0xf36a('0x9f')](function(_0x1d378d){for(var _0x19fa31=0x0;_0x19fa31<_0x235937['body'][_0xf36a('0x60')]['length'];_0x19fa31+=0x1){socket['emit'](_0xf36a('0xa0'),{'UserId':Number(_0x235937[_0xf36a('0x4f')][_0xf36a('0x60')][_0x19fa31]),'CmListId':Number(_0x235937['params']['id'])});}return _0x1d378d;});}})[_0xf36a('0x2c')](respondWithResult(_0x205fcb,null))[_0xf36a('0x49')](handleError(_0x205fcb,null));};exports[_0xf36a('0xa1')]=function(_0x4ab33f,_0x364dd7,_0x4c9087){return db[_0xf36a('0x32')][_0xf36a('0x4d')]({'where':{'id':_0x4ab33f['params']['id']}})['then'](handleEntityNotFound(_0x364dd7,null))['then'](function(_0x117c8a){if(_0x117c8a){return _0x117c8a[_0xf36a('0xa1')](_0x4ab33f['query'][_0xf36a('0x60')])[_0xf36a('0x2c')](function(){if(_[_0xf36a('0x63')](_0x4ab33f[_0xf36a('0x37')]['ids'])){for(var _0x1561f0=0x0;_0x1561f0<_0x4ab33f[_0xf36a('0x37')][_0xf36a('0x60')][_0xf36a('0x3d')];_0x1561f0+=0x1){socket[_0xf36a('0xa2')](_0xf36a('0xa3'),{'UserId':Number(_0x4ab33f[_0xf36a('0x37')]['ids'][_0x1561f0]),'CmListId':Number(_0x4ab33f['params']['id'])});}}else{socket[_0xf36a('0xa2')](_0xf36a('0xa3'),{'UserId':Number(_0x4ab33f[_0xf36a('0x37')][_0xf36a('0x60')]),'CmListId':Number(_0x4ab33f[_0xf36a('0x4b')]['id'])});}});}})[_0xf36a('0x2c')](respondWithStatusCode(_0x364dd7,null))[_0xf36a('0x49')](handleError(_0x364dd7,null));};exports[_0xf36a('0xa4')]=function(_0x36626e,_0x4d849d,_0x502615){var _0x3c4390={};var _0x38d122={};var _0xb02546;var _0x3688a2;return db[_0xf36a('0x32')][_0xf36a('0x5c')]({'where':{'id':_0x36626e['params']['id']}})[_0xf36a('0x2c')](handleEntityNotFound(_0x4d849d,null))['then'](function(_0x1a5f81){if(_0x1a5f81){_0xb02546=_0x1a5f81;_0x38d122[_0xf36a('0x36')]=_['keys'](db['User'][_0xf36a('0x4c')]);_0x38d122[_0xf36a('0x37')]=_[_0xf36a('0x38')](_0x36626e['query']);_0x38d122[_0xf36a('0x39')]=_[_0xf36a('0x3a')](_0x38d122['model'],_0x38d122[_0xf36a('0x37')]);_0x3c4390[_0xf36a('0x3b')]=_[_0xf36a('0x3a')](_0x38d122[_0xf36a('0x36')],qs[_0xf36a('0x3c')](_0x36626e[_0xf36a('0x37')][_0xf36a('0x3c')]));_0x3c4390[_0xf36a('0x3b')]=_0x3c4390['attributes'][_0xf36a('0x3d')]?_0x3c4390[_0xf36a('0x3b')]:_0x38d122[_0xf36a('0x36')];_0x3c4390[_0xf36a('0x3f')]=qs[_0xf36a('0x40')](_0x36626e[_0xf36a('0x37')][_0xf36a('0x40')]);_0x3c4390[_0xf36a('0x41')]=qs[_0xf36a('0x39')](_[_0xf36a('0x42')](_0x36626e[_0xf36a('0x37')],_0x38d122[_0xf36a('0x39')]));if(_0x36626e[_0xf36a('0x37')]['filter']){_0x3c4390[_0xf36a('0x41')]=_[_0xf36a('0x43')](_0x3c4390[_0xf36a('0x41')],{'$or':_[_0xf36a('0x31')](_0x3c4390['attributes'],function(_0xb6ab6e){var _0x12feba={};_0x12feba[_0xb6ab6e]={'$like':'%'+_0x36626e[_0xf36a('0x37')]['filter']+'%'};return _0x12feba;})});}_0x3c4390=_[_0xf36a('0x43')]({},_0x3c4390,_0x36626e[_0xf36a('0x45')]);return _0xb02546[_0xf36a('0xa4')](_0x3c4390);}})[_0xf36a('0x2c')](function(_0x2e6c7e){if(_0x2e6c7e){_0x3688a2=_0x2e6c7e[_0xf36a('0x3d')];if(!_0x36626e[_0xf36a('0x37')]['hasOwnProperty'](_0xf36a('0x3e'))){_0x3c4390[_0xf36a('0x22')]=qs[_0xf36a('0x22')](_0x36626e[_0xf36a('0x37')][_0xf36a('0x22')]);_0x3c4390[_0xf36a('0x20')]=qs['offset'](_0x36626e[_0xf36a('0x37')][_0xf36a('0x20')]);}return _0xb02546[_0xf36a('0xa4')](_0x3c4390);}})[_0xf36a('0x2c')](function(_0x316073){if(_0x316073){return _0x316073?{'count':_0x3688a2,'rows':_0x316073}:null;}})[_0xf36a('0x2c')](respondWithResult(_0x4d849d,null))[_0xf36a('0x49')](handleError(_0x4d849d,null));};function handleQuery(_0x5dc992){logger[_0xf36a('0xa5')](_0x5dc992);return db['sequelize'][_0xf36a('0x37')](_0x5dc992)['spread'](function(_0x533add){csv_results[_0xf36a('0x65')](_0x533add);})[_0xf36a('0x49')](function(_0x1a8573){logger[_0xf36a('0x2d')](_0x1a8573[_0xf36a('0x6a')]);});} \ No newline at end of file +var _0x9141=['type','model','keys','filters','attributes','intersection','fields','length','nolimit','query','order','sort','pick','filter','where','VIRTUAL','options','CmList','include','findAll','rows','catch','show','params','includeAll','merge','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','ListId','getDispositions','findOne','hasOwnProperty','Disposition','removeDispositions','addContacts','CmContact','tags','join','isArray','push','each','success','dataValues','errors','message','Malformed\x20request\x20syntax','CustomFields','cf_%d','getContacts','getContactsCsv','ContactItemType','OrderBy','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','now','/tmp/list_%d_%s.csv','attachment;\x20filename=','format','list_%d_%s.csv','setHeader','Content-type','text/csv','download','sequelize','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','addColumn','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','ids','omit','spread','emit','userCmList:save','userCmList:remove','getAgents','User','eml-format','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','defaults','redis','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','Lists','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x561195,_0x1f9dec){var _0x5c87c3=function(_0x32ee97){while(--_0x32ee97){_0x561195['push'](_0x561195['shift']());}};_0x5c87c3(++_0x1f9dec);}(_0x9141,0x10d));var _0x1914=function(_0x47038a,_0x485cfe){_0x47038a=_0x47038a-0x0;var _0x27b7e8=_0x9141[_0x47038a];return _0x27b7e8;};'use strict';var emlformat=require(_0x1914('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1914('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1914('0x2'));var moment=require(_0x1914('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1914('0x4'));var util=require(_0x1914('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1914('0x6'));var ejs=require(_0x1914('0x7'));var fs=require('fs');var fs_extra=require(_0x1914('0x8'));var _=require(_0x1914('0x9'));var squel=require(_0x1914('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1914('0xb'));var toCsv=require(_0x1914('0x6'));var querystring=require(_0x1914('0xc'));var Papa=require('papaparse');var Redis=require(_0x1914('0xd'));var authService=require(_0x1914('0xe'));var qs=require(_0x1914('0xf'));var as=require(_0x1914('0x10'));var hardwareService=require(_0x1914('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x1914('0x12'));var config=require(_0x1914('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config['redis']=_[_0x1914('0x14')](config[_0x1914('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1914('0x15')]));require(_0x1914('0x16'))[_0x1914('0x17')](socket);function respondWithStatusCode(_0x47ed30,_0x1965d8){_0x1965d8=_0x1965d8||0xcc;return function(_0x447b98){if(_0x447b98){return _0x47ed30[_0x1914('0x18')](_0x1965d8);}return _0x47ed30[_0x1914('0x19')](_0x1965d8)[_0x1914('0x1a')]();};}function respondWithResult(_0x5d721d,_0x51979e){_0x51979e=_0x51979e||0xc8;return function(_0x507ed6){if(_0x507ed6){return _0x5d721d[_0x1914('0x19')](_0x51979e)[_0x1914('0x1b')](_0x507ed6);}};}function respondWithFilteredResult(_0x39d1ab,_0x657eb8){return function(_0x298d68){if(_0x298d68){var _0x1aeb6f=typeof _0x657eb8[_0x1914('0x1c')]===_0x1914('0x1d')&&typeof _0x657eb8[_0x1914('0x1e')]===_0x1914('0x1d');var _0x345acf=_0x298d68[_0x1914('0x1f')];var _0x10281b=_0x1aeb6f?0x0:_0x657eb8[_0x1914('0x1c')];var _0x18754f=_0x1aeb6f?_0x298d68[_0x1914('0x1f')]:_0x657eb8[_0x1914('0x1c')]+_0x657eb8['limit'];var _0x487253;if(_0x18754f>=_0x345acf){_0x18754f=_0x345acf;_0x487253=0xc8;}else{_0x487253=0xce;}_0x39d1ab[_0x1914('0x19')](_0x487253);return _0x39d1ab[_0x1914('0x20')](_0x1914('0x21'),_0x10281b+'-'+_0x18754f+'/'+_0x345acf)[_0x1914('0x1b')](_0x298d68);}return null;};}function patchUpdates(_0x3004d5){return function(_0x89ae7e){try{jsonpatch[_0x1914('0x22')](_0x89ae7e,_0x3004d5,!![]);}catch(_0x4a0335){return BPromise['reject'](_0x4a0335);}return _0x89ae7e[_0x1914('0x23')]();};}function saveUpdates(_0x4137f5,_0x3343f7){return function(_0x1dd8e0){if(_0x1dd8e0){return _0x1dd8e0[_0x1914('0x24')](_0x4137f5)[_0x1914('0x25')](function(_0x45157a){return _0x45157a;});}return null;};}function removeEntity(_0x2fbd9c,_0x44bfc0){return function(_0x56d8ee){if(_0x56d8ee){return _0x56d8ee[_0x1914('0x26')]()[_0x1914('0x25')](function(){var _0x17c600=_0x56d8ee['get']({'plain':!![]});var _0x550826=_0x1914('0x27');return db[_0x1914('0x28')][_0x1914('0x26')]({'where':{'type':_0x550826,'resourceId':_0x17c600['id']}})[_0x1914('0x25')](function(){return _0x56d8ee;});})[_0x1914('0x25')](function(){_0x2fbd9c[_0x1914('0x19')](0xcc)[_0x1914('0x1a')]();});}};}function handleEntityNotFound(_0x281a7a,_0x113e30){return function(_0x5b8878){if(!_0x5b8878){_0x281a7a[_0x1914('0x18')](0x194);}return _0x5b8878;};}function handleError(_0x312ca6,_0x103d4b){_0x103d4b=_0x103d4b||0x1f4;return function(_0x212f81){logger[_0x1914('0x29')](_0x212f81[_0x1914('0x2a')]);if(_0x212f81['name']){delete _0x212f81[_0x1914('0x2b')];}_0x312ca6[_0x1914('0x19')](_0x103d4b)[_0x1914('0x2c')](_0x212f81);};}exports[_0x1914('0x2d')]=function(_0x2e6929,_0x29aa91){var _0x2b7343={},_0x4dd350={},_0x597a6f={'count':0x0,'rows':[]};var _0x4292ca=_[_0x1914('0x2e')](db['CmList'][_0x1914('0x2f')],function(_0x56fa1f){return{'name':_0x56fa1f[_0x1914('0x30')],'type':_0x56fa1f[_0x1914('0x31')]['key']};});_0x4dd350[_0x1914('0x32')]=_[_0x1914('0x2e')](_0x4292ca,_0x1914('0x2b'));_0x4dd350['query']=_[_0x1914('0x33')](_0x2e6929['query']);_0x4dd350[_0x1914('0x34')]=_['intersection'](_0x4dd350[_0x1914('0x32')],_0x4dd350['query']);_0x2b7343[_0x1914('0x35')]=_[_0x1914('0x36')](_0x4dd350[_0x1914('0x32')],qs['fields'](_0x2e6929['query'][_0x1914('0x37')]));_0x2b7343[_0x1914('0x35')]=_0x2b7343[_0x1914('0x35')][_0x1914('0x38')]?_0x2b7343[_0x1914('0x35')]:_0x4dd350[_0x1914('0x32')];if(!_0x2e6929['query']['hasOwnProperty'](_0x1914('0x39'))){_0x2b7343[_0x1914('0x1e')]=qs[_0x1914('0x1e')](_0x2e6929[_0x1914('0x3a')]['limit']);_0x2b7343['offset']=qs[_0x1914('0x1c')](_0x2e6929[_0x1914('0x3a')]['offset']);}_0x2b7343[_0x1914('0x3b')]=qs[_0x1914('0x3c')](_0x2e6929['query'][_0x1914('0x3c')]);_0x2b7343['where']=qs[_0x1914('0x34')](_[_0x1914('0x3d')](_0x2e6929[_0x1914('0x3a')],_0x4dd350[_0x1914('0x34')]),_0x4292ca);if(_0x2e6929[_0x1914('0x3a')][_0x1914('0x3e')]){_0x2b7343['where']=_['merge'](_0x2b7343[_0x1914('0x3f')],{'$or':_[_0x1914('0x2e')](_0x4292ca,function(_0x3ba502){if(_0x3ba502[_0x1914('0x31')]!==_0x1914('0x40')){var _0x3ec38f={};_0x3ec38f[_0x3ba502[_0x1914('0x2b')]]={'$like':'%'+_0x2e6929[_0x1914('0x3a')][_0x1914('0x3e')]+'%'};return _0x3ec38f;}})});}_0x2b7343=_['merge']({},_0x2b7343,_0x2e6929[_0x1914('0x41')]);var _0xfcc82={'where':_0x2b7343[_0x1914('0x3f')]};return db[_0x1914('0x42')][_0x1914('0x1f')](_0xfcc82)[_0x1914('0x25')](function(_0x2575a8){_0x597a6f[_0x1914('0x1f')]=_0x2575a8;if(_0x2e6929[_0x1914('0x3a')]['includeAll']){_0x2b7343[_0x1914('0x43')]=[{'all':!![]}];}return db[_0x1914('0x42')][_0x1914('0x44')](_0x2b7343);})[_0x1914('0x25')](function(_0x53156d){_0x597a6f[_0x1914('0x45')]=_0x53156d;return _0x597a6f;})[_0x1914('0x25')](respondWithFilteredResult(_0x29aa91,_0x2b7343))[_0x1914('0x46')](handleError(_0x29aa91,null));};exports[_0x1914('0x47')]=function(_0x3d7da2,_0x202655){var _0x386089={'raw':![],'where':{'id':_0x3d7da2[_0x1914('0x48')]['id']}},_0x2024d4={};_0x2024d4[_0x1914('0x32')]=_[_0x1914('0x33')](db[_0x1914('0x42')]['rawAttributes']);_0x2024d4[_0x1914('0x3a')]=_[_0x1914('0x33')](_0x3d7da2[_0x1914('0x3a')]);_0x2024d4['filters']=_[_0x1914('0x36')](_0x2024d4['model'],_0x2024d4[_0x1914('0x3a')]);_0x386089[_0x1914('0x35')]=_['intersection'](_0x2024d4[_0x1914('0x32')],qs[_0x1914('0x37')](_0x3d7da2[_0x1914('0x3a')][_0x1914('0x37')]));_0x386089[_0x1914('0x35')]=_0x386089[_0x1914('0x35')]['length']?_0x386089['attributes']:_0x2024d4[_0x1914('0x32')];if(_0x3d7da2[_0x1914('0x3a')][_0x1914('0x49')]){_0x386089[_0x1914('0x43')]=[{'all':!![]}];}_0x386089=_[_0x1914('0x4a')]({},_0x386089,_0x3d7da2[_0x1914('0x41')]);return db[_0x1914('0x42')][_0x1914('0x4b')](_0x386089)[_0x1914('0x25')](handleEntityNotFound(_0x202655,null))[_0x1914('0x25')](respondWithResult(_0x202655,null))[_0x1914('0x46')](handleError(_0x202655,null));};exports[_0x1914('0x4c')]=function(_0x3639f2,_0x2ec2d3){return db[_0x1914('0x42')][_0x1914('0x4c')](_0x3639f2['body'],{})[_0x1914('0x25')](function(_0x5902b4){var _0x47a40b=_0x3639f2['user'][_0x1914('0x4d')]({'plain':!![]});if(!_0x47a40b)throw new Error(_0x1914('0x4e'));if(_0x47a40b[_0x1914('0x4f')]===_0x1914('0x50')){var _0x318e8d=_0x5902b4[_0x1914('0x4d')]({'plain':!![]});var _0x5043b7='Lists';return db[_0x1914('0x51')]['find']({'where':{'name':_0x5043b7,'userProfileId':_0x47a40b[_0x1914('0x52')]},'raw':!![]})['then'](function(_0x46e48b){if(_0x46e48b&&_0x46e48b[_0x1914('0x53')]===0x0){return db['UserProfileResource'][_0x1914('0x4c')]({'name':_0x318e8d['name'],'resourceId':_0x318e8d['id'],'type':_0x46e48b[_0x1914('0x2b')],'sectionId':_0x46e48b['id']},{})[_0x1914('0x25')](function(){return _0x5902b4;});}else{return _0x5902b4;}})[_0x1914('0x46')](function(_0x5b0305){logger[_0x1914('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b0305);throw _0x5b0305;});}return _0x5902b4;})[_0x1914('0x25')](respondWithResult(_0x2ec2d3,0xc9))[_0x1914('0x46')](handleError(_0x2ec2d3,null));};exports[_0x1914('0x24')]=function(_0x45309b,_0x321b89){if(_0x45309b[_0x1914('0x54')]['id']){delete _0x45309b[_0x1914('0x54')]['id'];}return db[_0x1914('0x42')][_0x1914('0x4b')]({'where':{'id':_0x45309b[_0x1914('0x48')]['id']}})[_0x1914('0x25')](handleEntityNotFound(_0x321b89,null))[_0x1914('0x25')](saveUpdates(_0x45309b[_0x1914('0x54')],null))['then'](respondWithResult(_0x321b89,null))[_0x1914('0x46')](handleError(_0x321b89,null));};exports[_0x1914('0x26')]=function(_0x26e8c8,_0x300af1){return db[_0x1914('0x42')]['find']({'where':{'id':_0x26e8c8['params']['id']}})[_0x1914('0x25')](handleEntityNotFound(_0x300af1,null))['then'](removeEntity(_0x300af1,null))[_0x1914('0x46')](handleError(_0x300af1,null));};exports[_0x1914('0x55')]=function(_0x1335dd,_0x4f1608){return db[_0x1914('0x42')]['describe']()['then'](respondWithResult(_0x4f1608,null))[_0x1914('0x46')](handleError(_0x4f1608,null));};exports[_0x1914('0x56')]=function(_0x378eaa,_0x137b38,_0x30002){if(_0x378eaa['body']['id']){delete _0x378eaa['body']['id'];}return db[_0x1914('0x42')][_0x1914('0x4b')]({'where':{'id':_0x378eaa[_0x1914('0x48')]['id']}})[_0x1914('0x25')](handleEntityNotFound(_0x137b38,null))[_0x1914('0x25')](function(_0x21a3c4){if(_0x21a3c4){_0x378eaa[_0x1914('0x54')][_0x1914('0x57')]=_0x21a3c4['id'];return db['Disposition'][_0x1914('0x4c')](_0x378eaa[_0x1914('0x54')]);}})[_0x1914('0x25')](respondWithResult(_0x137b38,null))[_0x1914('0x46')](handleError(_0x137b38,null));};exports[_0x1914('0x58')]=function(_0x50f353,_0x2ad052,_0x58718c){var _0x56bde3={'raw':![],'where':{}};var _0xdbc528={};var _0x323ac4={'count':0x0,'rows':[]};return db[_0x1914('0x42')][_0x1914('0x59')]({'where':{'id':_0x50f353['params']['id']}})[_0x1914('0x25')](handleEntityNotFound(_0x2ad052,null))[_0x1914('0x25')](function(_0x31f79a){if(_0x31f79a){_0xdbc528[_0x1914('0x32')]=_[_0x1914('0x33')](db['Disposition']['rawAttributes']);_0xdbc528[_0x1914('0x3a')]=_[_0x1914('0x33')](_0x50f353[_0x1914('0x3a')]);_0xdbc528[_0x1914('0x34')]=_[_0x1914('0x36')](_0xdbc528[_0x1914('0x32')],_0xdbc528[_0x1914('0x3a')]);_0x56bde3[_0x1914('0x35')]=_['intersection'](_0xdbc528['model'],qs[_0x1914('0x37')](_0x50f353[_0x1914('0x3a')]['fields']));_0x56bde3[_0x1914('0x35')]=_0x56bde3[_0x1914('0x35')]['length']?_0x56bde3['attributes']:_0xdbc528[_0x1914('0x32')];if(!_0x50f353[_0x1914('0x3a')][_0x1914('0x5a')](_0x1914('0x39'))){_0x56bde3[_0x1914('0x1e')]=qs['limit'](_0x50f353[_0x1914('0x3a')][_0x1914('0x1e')]);_0x56bde3['offset']=qs[_0x1914('0x1c')](_0x50f353[_0x1914('0x3a')][_0x1914('0x1c')]);}_0x56bde3['order']=qs[_0x1914('0x3c')](_0x50f353[_0x1914('0x3a')][_0x1914('0x3c')]);_0x56bde3[_0x1914('0x3f')]=qs[_0x1914('0x34')](_[_0x1914('0x3d')](_0x50f353['query'],_0xdbc528[_0x1914('0x34')]));_0x56bde3[_0x1914('0x3f')][_0x1914('0x57')]=_0x31f79a['id'];if(_0x50f353[_0x1914('0x3a')][_0x1914('0x3e')]){_0x56bde3[_0x1914('0x3f')]=_[_0x1914('0x4a')](_0x56bde3[_0x1914('0x3f')],{'$or':_[_0x1914('0x2e')](_0x56bde3['attributes'],function(_0x31f360){var _0x5eaaac={};_0x5eaaac[_0x31f360]={'$like':'%'+_0x50f353[_0x1914('0x3a')]['filter']+'%'};return _0x5eaaac;})});}_0x56bde3=_[_0x1914('0x4a')]({},_0x56bde3,_0x50f353[_0x1914('0x41')]);return db[_0x1914('0x5b')][_0x1914('0x1f')]({'where':_0x56bde3[_0x1914('0x3f')]})[_0x1914('0x25')](function(_0x433f80){_0x323ac4[_0x1914('0x1f')]=_0x433f80;if(_0x50f353[_0x1914('0x3a')][_0x1914('0x49')]){_0x56bde3[_0x1914('0x43')]=[{'all':!![]}];}return db[_0x1914('0x5b')][_0x1914('0x44')](_0x56bde3);})[_0x1914('0x25')](function(_0x546490){_0x323ac4['rows']=_0x546490;return _0x323ac4;});}})[_0x1914('0x25')](respondWithFilteredResult(_0x2ad052,_0x56bde3))[_0x1914('0x46')](handleError(_0x2ad052,null));};exports['removeDispositions']=function(_0x53d27a,_0x32594c,_0x38fd49){return db['CmList']['find']({'where':{'id':_0x53d27a[_0x1914('0x48')]['id']}})[_0x1914('0x25')](handleEntityNotFound(_0x32594c,null))[_0x1914('0x25')](function(_0x590f0a){if(_0x590f0a){return _0x590f0a[_0x1914('0x5c')](_0x53d27a[_0x1914('0x3a')]['ids']);}})[_0x1914('0x25')](respondWithStatusCode(_0x32594c,null))[_0x1914('0x46')](handleError(_0x32594c,null));};exports[_0x1914('0x5d')]=function(_0x4f67e7,_0x9f60ac,_0x33101a){return db[_0x1914('0x42')][_0x1914('0x4b')]({'where':{'id':_0x4f67e7[_0x1914('0x48')]['id']}})[_0x1914('0x25')](handleEntityNotFound(_0x9f60ac,null))['then'](function(_0x144c54){if(_0x144c54){var _0x2da4d2=[];var _0x4d5f5c={'success':[],'errors':[]};return db[_0x1914('0x5e')][_0x1914('0x55')]()[_0x1914('0x25')](function(_0x167e9d){if(_0x4f67e7['body'][_0x1914('0x5f')]&&_['isArray'](_0x4f67e7[_0x1914('0x54')][_0x1914('0x5f')])){if(_0x4f67e7['body'][_0x1914('0x5f')][_0x1914('0x38')]){_0x4f67e7['body'][_0x1914('0x5f')]=_0x4f67e7[_0x1914('0x54')][_0x1914('0x5f')][_0x1914('0x60')](';')+';';}else{_0x4f67e7['body']['tags']=null;}}else{_0x4f67e7['body'][_0x1914('0x5f')]=null;}if(_0x4f67e7[_0x1914('0x54')]&&_[_0x1914('0x61')](_0x4f67e7[_0x1914('0x54')])){for(var _0x56ad29=0x0;_0x56ad29<_0x4f67e7[_0x1914('0x54')]['length'];_0x56ad29+=0x1){_0x4f67e7[_0x1914('0x54')][_0x56ad29][_0x1914('0x57')]=_0x4f67e7[_0x1914('0x48')]['id'];_0x2da4d2[_0x1914('0x62')](_0x4f67e7[_0x1914('0x54')][_0x56ad29]);}return BPromise[_0x1914('0x63')](_0x2da4d2,function(_0x52e939){return db['CmContact'][_0x1914('0x4c')](_['omit'](_0x52e939,['ids','id'])||{},{'fields':_[_0x1914('0x33')](_0x167e9d),'raw':!![]})['then'](function(_0x2e635a){_0x4d5f5c[_0x1914('0x64')][_0x1914('0x62')](_0x2e635a[_0x1914('0x65')]);})[_0x1914('0x46')](function(_0x3242bd){_0x4d5f5c[_0x1914('0x66')]['push']({'data':_0x52e939,'error':_0x3242bd[_0x1914('0x67')]});});})[_0x1914('0x25')](function(_0x52bf80){return _0x4d5f5c;})[_0x1914('0x46')](function(_0x4b4cd2){return _0x4b4cd2;});}else{_0x9f60ac[_0x1914('0x19')](0x190)[_0x1914('0x1b')]({'message':_0x1914('0x68')});}});}})['then'](respondWithResult(_0x9f60ac,null))[_0x1914('0x46')](handleError(_0x9f60ac,null));};exports['getContacts']=function(_0x34b8f2,_0x3fa836,_0x4791e2){var _0x213f3e;return db[_0x1914('0x42')][_0x1914('0x4b')]({'where':{'id':_0x34b8f2['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x1914('0x69')}]})[_0x1914('0x25')](handleEntityNotFound(_0x3fa836,null))[_0x1914('0x25')](function(_0x1ce75b){if(_0x1ce75b){_0x213f3e=_0x1ce75b;return db[_0x1914('0x5e')][_0x1914('0x2f')];}})['then'](function(_0x2927e6){if(_0x2927e6){var _0x2e0057={};var _0x21b1ee={};_0x21b1ee[_0x1914('0x32')]=_['concat'](_[_0x1914('0x33')](_0x2927e6),_[_0x1914('0x2e')](_0x213f3e['CustomFields'],function(_0x375138){return util['format'](_0x1914('0x6a'),_0x375138['id']);}));_0x21b1ee[_0x1914('0x3a')]=_[_0x1914('0x33')](_0x34b8f2[_0x1914('0x3a')]);_0x21b1ee[_0x1914('0x34')]=_[_0x1914('0x36')](_0x21b1ee['model'],_0x21b1ee[_0x1914('0x3a')]);_0x2e0057[_0x1914('0x35')]=_[_0x1914('0x36')](_0x21b1ee['model'],qs[_0x1914('0x37')](_0x34b8f2[_0x1914('0x3a')][_0x1914('0x37')]));_0x2e0057[_0x1914('0x35')]=_0x2e0057[_0x1914('0x35')]['length']?_0x2e0057[_0x1914('0x35')]:_0x21b1ee[_0x1914('0x32')];if(!_0x34b8f2[_0x1914('0x3a')][_0x1914('0x5a')](_0x1914('0x39'))){_0x2e0057[_0x1914('0x1e')]=qs['limit'](_0x34b8f2[_0x1914('0x3a')][_0x1914('0x1e')]);_0x2e0057[_0x1914('0x1c')]=qs[_0x1914('0x1c')](_0x34b8f2[_0x1914('0x3a')][_0x1914('0x1c')]);}_0x2e0057[_0x1914('0x3b')]=qs[_0x1914('0x3c')](_0x34b8f2[_0x1914('0x3a')][_0x1914('0x3c')]);_0x2e0057['where']=qs[_0x1914('0x34')](_[_0x1914('0x3d')](_0x34b8f2['query'],_0x21b1ee[_0x1914('0x34')]));_0x2e0057['raw']=!![];if(_0x34b8f2[_0x1914('0x3a')][_0x1914('0x3e')]){_0x2e0057['where']=_['merge'](_0x2e0057['where'],{'$or':_[_0x1914('0x2e')](_0x2e0057[_0x1914('0x35')],function(_0x22d239){var _0x2e992e={};_0x2e992e[_0x22d239]={'$like':'%'+_0x34b8f2['query']['filter']+'%'};return _0x2e992e;})});}_0x2e0057=_[_0x1914('0x4a')]({},_0x2e0057,_0x34b8f2['options']);return _0x213f3e[_0x1914('0x6b')](_0x2e0057);}})[_0x1914('0x25')](respondWithResult(_0x3fa836,null))['catch'](handleError(_0x3fa836,null));};exports[_0x1914('0x6c')]=function(_0x5eb69b,_0x4a4fd4,_0x328703){var _0x21b1c1;var _0x14a30e;var _0x30690f;var _0x58f165=_0x5eb69b[_0x1914('0x48')]['id'];csv_results=[];return db[_0x1914('0x6d')][_0x1914('0x44')]({'attributes':['id','name'],'raw':!![],'order':[_0x1914('0x6e')]})[_0x1914('0x25')](function(_0x4d93e9){_0x21b1c1=_0x4d93e9;var _0x40367d=_[_0x1914('0x33')](db[_0x1914('0x5e')]['rawAttributes']);return db[_0x1914('0x6f')][_0x1914('0x44')]({'raw':!![],'attributes':['id',_0x1914('0x70')]})[_0x1914('0x25')](function(_0xbe4869){_0x14a30e=_0xbe4869;var _0x689b8f=squel[_0x1914('0x71')]()[_0x1914('0x37')](_0x40367d)[_0x1914('0x72')](_0x1914('0x73'),'c')['where'](_0x1914('0x74'),_0x58f165)['where']('c.deletedAt\x20is\x20null')[_0x1914('0x75')]();for(var _0x3f28b8=0x0;_0x3f28b8<_0x14a30e[_0x1914('0x38')];_0x3f28b8++){_0x689b8f[_0x1914('0x76')](_0x1914('0x77')+_0x14a30e[_0x3f28b8]['id'],'customField_'+_0x14a30e[_0x3f28b8][_0x1914('0x70')]);}for(var _0x3f28b8=0x0;_0x3f28b8<_0x21b1c1['length'];_0x3f28b8++){_0x689b8f[_0x1914('0x76')](squel[_0x1914('0x71')]()[_0x1914('0x76')](_0x1914('0x78'))[_0x1914('0x72')](_0x1914('0x79'))[_0x1914('0x3f')](_0x1914('0x7a'),_0x21b1c1[_0x3f28b8]['id'])[_0x1914('0x3f')](_0x1914('0x7b')),_0x1914('0x7c')+_0x21b1c1[_0x3f28b8][_0x1914('0x2b')]);_0x689b8f[_0x1914('0x76')](squel['select']()['field'](_0x1914('0x7d'))[_0x1914('0x72')](_0x1914('0x79'))[_0x1914('0x3f')](_0x1914('0x7a'),_0x21b1c1[_0x3f28b8]['id'])['where'](_0x1914('0x7b')),_0x1914('0x7e')+_0x21b1c1[_0x3f28b8][_0x1914('0x2b')]);}var _0x3ea268=[];_0x3ea268[_0x1914('0x62')](_0x689b8f[_0x1914('0x7f')]());BPromise[_0x1914('0x63')](_0x3ea268,handleQuery)['then'](function(_0x388986){handleQuery(_0x689b8f[_0x1914('0x7f')]());var _0x590f44=csv_results[0x0];if(!_[_0x1914('0x80')](_0x590f44)){var _0x55a62f=toCsv(_0x590f44);var _0xcba34=Date[_0x1914('0x81')]();fs['writeFileSync'](util['format'](_0x1914('0x82'),_0x58f165,_0xcba34),_0x55a62f);_0x4a4fd4['setHeader']('Content-disposition',_0x1914('0x83')+util[_0x1914('0x84')](_0x1914('0x85'),_0x58f165,_0xcba34));_0x4a4fd4[_0x1914('0x86')](_0x1914('0x87'),_0x1914('0x88'));return _0x4a4fd4[_0x1914('0x89')](util['format']('/tmp/list_%d_%s.csv',_0x58f165,_0xcba34));}else{return _0x4a4fd4['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x5e44b6,_0x491652,_0x54e226){var _0x5997d8;delete _0x5e44b6[_0x1914('0x54')]['id'];return db[_0x1914('0x42')]['findOne']({'where':{'id':_0x5e44b6[_0x1914('0x48')]['id']}})[_0x1914('0x25')](handleEntityNotFound(_0x491652,null))[_0x1914('0x25')](function(_0x11e3c4){if(_0x11e3c4){return db[_0x1914('0x8a')]['transaction'](function(_0x39152a){return db['CmCustomField'][_0x1914('0x4c')](_0x5e44b6[_0x1914('0x54')],{'transaction':_0x39152a})[_0x1914('0x25')](function(_0x3b8041){_0x5997d8=_0x3b8041;return _0x11e3c4[_0x1914('0x8b')](_0x3b8041,{'transaction':_0x39152a});})[_0x1914('0x25')](function(){var _0x4c9804={'type':db[_0x1914('0x8c')][_0x1914('0x8d')],'transaction':_0x39152a};switch(_0x5e44b6[_0x1914('0x54')][_0x1914('0x31')]){case _0x1914('0x8e'):_0x4c9804['type']=db[_0x1914('0x8c')][_0x1914('0x8d')];break;case _0x1914('0x8f'):_0x4c9804[_0x1914('0x31')]=db[_0x1914('0x8c')]['INTEGER'];break;case _0x1914('0x90'):_0x4c9804[_0x1914('0x31')]=db[_0x1914('0x8c')][_0x1914('0x91')];_0x4c9804['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0x1914('0x92')](_0x1914('0x73'),util['format']('cf_%s',_0x5997d8['id']),_0x4c9804);})[_0x1914('0x25')](function(){return _0x5997d8;});});}})[_0x1914('0x25')](respondWithResult(_0x491652,null))['catch'](handleError(_0x491652,null));};exports[_0x1914('0x93')]=function(_0x1d16b1,_0x26811a,_0x46834f){var _0x4a81a0={};var _0x538b1c={};var _0x384d88;var _0x1bce66;return db[_0x1914('0x42')][_0x1914('0x59')]({'where':{'id':_0x1d16b1[_0x1914('0x48')]['id']}})[_0x1914('0x25')](handleEntityNotFound(_0x26811a,null))[_0x1914('0x25')](function(_0x1ad3ea){if(_0x1ad3ea){_0x384d88=_0x1ad3ea;_0x538b1c[_0x1914('0x32')]=_[_0x1914('0x33')](db['CmCustomField'][_0x1914('0x2f')]);_0x538b1c['query']=_[_0x1914('0x33')](_0x1d16b1[_0x1914('0x3a')]);_0x538b1c[_0x1914('0x34')]=_[_0x1914('0x36')](_0x538b1c[_0x1914('0x32')],_0x538b1c[_0x1914('0x3a')]);_0x4a81a0['attributes']=_['intersection'](_0x538b1c['model'],qs[_0x1914('0x37')](_0x1d16b1[_0x1914('0x3a')][_0x1914('0x37')]));_0x4a81a0[_0x1914('0x35')]=_0x4a81a0['attributes']['length']?_0x4a81a0[_0x1914('0x35')]:_0x538b1c[_0x1914('0x32')];_0x4a81a0['order']=qs['sort'](_0x1d16b1['query']['sort']);_0x4a81a0[_0x1914('0x3f')]=qs['filters'](_['pick'](_0x1d16b1[_0x1914('0x3a')],_0x538b1c[_0x1914('0x34')]));_0x4a81a0['where']=_[_0x1914('0x4a')](_0x4a81a0[_0x1914('0x3f')],{'$or':[{'ListId':_0x1ad3ea['id']},{'ListId':null}]});if(_0x1d16b1[_0x1914('0x3a')]['filter']){_0x4a81a0[_0x1914('0x3f')]=_['merge'](_0x4a81a0[_0x1914('0x3f')],{'$or':_['map'](_0x4a81a0['attributes'],function(_0x2dd273){var _0x5627db={};_0x5627db[_0x2dd273]={'$like':'%'+_0x1d16b1[_0x1914('0x3a')][_0x1914('0x3e')]+'%'};return _0x5627db;})});}_0x4a81a0=_['merge']({},_0x4a81a0,_0x1d16b1['options']);return db[_0x1914('0x6f')][_0x1914('0x94')](_0x4a81a0);}})[_0x1914('0x25')](respondWithResult(_0x26811a,null))['catch'](handleError(_0x26811a,null));};exports[_0x1914('0x95')]=function(_0xde89a3,_0x177500){return db[_0x1914('0x6f')][_0x1914('0x94')]({'where':{'ListId':null}})[_0x1914('0x25')](handleEntityNotFound(_0x177500,null))[_0x1914('0x25')](function(_0x5efaf5){return _0x5efaf5;})['then'](respondWithResult(_0x177500,null))[_0x1914('0x46')](handleError(_0x177500,null));};exports[_0x1914('0x96')]=function(_0x4fdd7,_0x3c946a,_0x411e56){return db[_0x1914('0x42')]['find']({'where':{'id':_0x4fdd7[_0x1914('0x48')]['id']}})['then'](handleEntityNotFound(_0x3c946a,null))[_0x1914('0x25')](function(_0x4bbd6a){if(_0x4bbd6a){return _0x4bbd6a['addAgents'](_0x4fdd7[_0x1914('0x54')][_0x1914('0x97')],_[_0x1914('0x98')](_0x4fdd7['body'],['ids','id'])||{})[_0x1914('0x99')](function(_0x28f1db){for(var _0xd26318=0x0;_0xd26318<_0x4fdd7['body'][_0x1914('0x97')]['length'];_0xd26318+=0x1){socket[_0x1914('0x9a')](_0x1914('0x9b'),{'UserId':Number(_0x4fdd7[_0x1914('0x54')]['ids'][_0xd26318]),'CmListId':Number(_0x4fdd7[_0x1914('0x48')]['id'])});}return _0x28f1db;});}})[_0x1914('0x25')](respondWithResult(_0x3c946a,null))[_0x1914('0x46')](handleError(_0x3c946a,null));};exports['removeAgents']=function(_0x18dc88,_0x143703,_0x38b79c){return db[_0x1914('0x42')][_0x1914('0x4b')]({'where':{'id':_0x18dc88[_0x1914('0x48')]['id']}})[_0x1914('0x25')](handleEntityNotFound(_0x143703,null))['then'](function(_0xa94ae5){if(_0xa94ae5){return _0xa94ae5['removeAgents'](_0x18dc88[_0x1914('0x3a')][_0x1914('0x97')])[_0x1914('0x25')](function(){if(_['isArray'](_0x18dc88[_0x1914('0x3a')][_0x1914('0x97')])){for(var _0x3bd044=0x0;_0x3bd044<_0x18dc88[_0x1914('0x3a')]['ids'][_0x1914('0x38')];_0x3bd044+=0x1){socket[_0x1914('0x9a')](_0x1914('0x9c'),{'UserId':Number(_0x18dc88[_0x1914('0x3a')][_0x1914('0x97')][_0x3bd044]),'CmListId':Number(_0x18dc88[_0x1914('0x48')]['id'])});}}else{socket['emit'](_0x1914('0x9c'),{'UserId':Number(_0x18dc88[_0x1914('0x3a')]['ids']),'CmListId':Number(_0x18dc88[_0x1914('0x48')]['id'])});}});}})[_0x1914('0x25')](respondWithStatusCode(_0x143703,null))[_0x1914('0x46')](handleError(_0x143703,null));};exports[_0x1914('0x9d')]=function(_0x35abff,_0x2dd25f,_0x11c762){var _0x4bd82c={};var _0xb40a2b={};var _0x255a18;var _0x480859;return db[_0x1914('0x42')][_0x1914('0x59')]({'where':{'id':_0x35abff[_0x1914('0x48')]['id']}})[_0x1914('0x25')](handleEntityNotFound(_0x2dd25f,null))[_0x1914('0x25')](function(_0xd45ea8){if(_0xd45ea8){_0x255a18=_0xd45ea8;_0xb40a2b[_0x1914('0x32')]=_[_0x1914('0x33')](db[_0x1914('0x9e')][_0x1914('0x2f')]);_0xb40a2b[_0x1914('0x3a')]=_[_0x1914('0x33')](_0x35abff[_0x1914('0x3a')]);_0xb40a2b[_0x1914('0x34')]=_[_0x1914('0x36')](_0xb40a2b[_0x1914('0x32')],_0xb40a2b['query']);_0x4bd82c['attributes']=_[_0x1914('0x36')](_0xb40a2b[_0x1914('0x32')],qs[_0x1914('0x37')](_0x35abff[_0x1914('0x3a')]['fields']));_0x4bd82c[_0x1914('0x35')]=_0x4bd82c['attributes']['length']?_0x4bd82c[_0x1914('0x35')]:_0xb40a2b[_0x1914('0x32')];_0x4bd82c[_0x1914('0x3b')]=qs[_0x1914('0x3c')](_0x35abff[_0x1914('0x3a')]['sort']);_0x4bd82c[_0x1914('0x3f')]=qs[_0x1914('0x34')](_[_0x1914('0x3d')](_0x35abff[_0x1914('0x3a')],_0xb40a2b['filters']));if(_0x35abff['query']['filter']){_0x4bd82c[_0x1914('0x3f')]=_[_0x1914('0x4a')](_0x4bd82c[_0x1914('0x3f')],{'$or':_[_0x1914('0x2e')](_0x4bd82c[_0x1914('0x35')],function(_0x6ec517){var _0x2ce3e4={};_0x2ce3e4[_0x6ec517]={'$like':'%'+_0x35abff[_0x1914('0x3a')][_0x1914('0x3e')]+'%'};return _0x2ce3e4;})});}_0x4bd82c=_[_0x1914('0x4a')]({},_0x4bd82c,_0x35abff[_0x1914('0x41')]);return _0x255a18[_0x1914('0x9d')](_0x4bd82c);}})[_0x1914('0x25')](function(_0x3cb263){if(_0x3cb263){_0x480859=_0x3cb263['length'];if(!_0x35abff[_0x1914('0x3a')]['hasOwnProperty'](_0x1914('0x39'))){_0x4bd82c[_0x1914('0x1e')]=qs[_0x1914('0x1e')](_0x35abff[_0x1914('0x3a')]['limit']);_0x4bd82c[_0x1914('0x1c')]=qs[_0x1914('0x1c')](_0x35abff[_0x1914('0x3a')][_0x1914('0x1c')]);}return _0x255a18[_0x1914('0x9d')](_0x4bd82c);}})['then'](function(_0x2a99d9){if(_0x2a99d9){return _0x2a99d9?{'count':_0x480859,'rows':_0x2a99d9}:null;}})['then'](respondWithResult(_0x2dd25f,null))[_0x1914('0x46')](handleError(_0x2dd25f,null));};function handleQuery(_0x361d3e){logger['info'](_0x361d3e);return db[_0x1914('0x8a')]['query'](_0x361d3e)[_0x1914('0x99')](function(_0x19db02){csv_results[_0x1914('0x62')](_0x19db02);})[_0x1914('0x46')](function(_0x1e45e0){logger[_0x1914('0x29')](_0x1e45e0[_0x1914('0x67')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 96f4cc5..91451e3 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0x7217,0x19e));var _0x7721=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x7217[_0xf71120];return _0xbe2fd3;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x3014a4,_0x56b5aa){var _0x4ff3da=function(_0x17c093){while(--_0x17c093){_0x3014a4['push'](_0x3014a4['shift']());}};_0x4ff3da(++_0x56b5aa);}(_0x7217,0x19e));var _0x7721=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x7217[_0x1b828b];return _0x98da1a;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index dc002b1..fd9b8bb 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 _0x91a7=['bluebird','path','./cmList.attributes','exports','CmList','cm_lists','util','../../config/logger','api'];(function(_0x5906a5,_0x48af0a){var _0x1b9a31=function(_0x4b72ac){while(--_0x4b72ac){_0x5906a5['push'](_0x5906a5['shift']());}};_0x1b9a31(++_0x48af0a);}(_0x91a7,0xe7));var _0x791a=function(_0x418fa4,_0x2a17d7){_0x418fa4=_0x418fa4-0x0;var _0x1d5b67=_0x91a7[_0x418fa4];return _0x1d5b67;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x791a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x791a('0x5'));module[_0x791a('0x6')]=function(_0x49a9b7,_0x361f53){return _0x49a9b7['define'](_0x791a('0x7'),attributes,{'tableName':_0x791a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41bb=['bluebird','request-promise','path','rimraf','./cmList.attributes','exports','cm_lists','lodash','util','api'];(function(_0x33ce67,_0x503005){var _0x3e21f4=function(_0x232751){while(--_0x232751){_0x33ce67['push'](_0x33ce67['shift']());}};_0x3e21f4(++_0x503005);}(_0x41bb,0xc5));var _0xb41b=function(_0x4cac0f,_0x5d0b68){_0x4cac0f=_0x4cac0f-0x0;var _0x59c3d1=_0x41bb[_0x4cac0f];return _0x59c3d1;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('CmList',attributes,{'tableName':_0xb41b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index cd1cb42..64c0121 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 _0x2d7e=['CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','localhost','socket.io-emitter','register','request','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4439e5,_0x2e9766){var _0x57e633=function(_0x4e45b3){while(--_0x4e45b3){_0x4439e5['push'](_0x4439e5['shift']());}};_0x57e633(++_0x2e9766);}(_0x2d7e,0xf8));var _0xe2d7=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x2d7e[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0xe2d7('0x0'));var util=require(_0xe2d7('0x1'));var moment=require(_0xe2d7('0x2'));var BPromise=require(_0xe2d7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe2d7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe2d7('0x5'));var config=require(_0xe2d7('0x6'));var jayson=require(_0xe2d7('0x7'));var client=jayson['client'][_0xe2d7('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xe2d7('0x9'),'port':0x18eb});var socket=require(_0xe2d7('0xa'))(new Redis(config['redis']));require('./cmList.socket')[_0xe2d7('0xb')](socket);function respondWithRpcPromise(_0x57fb3e,_0xce1b8e,_0x227b30){return new BPromise(function(_0x2c1220,_0x1088de){return client[_0xe2d7('0xc')](_0x57fb3e,_0x227b30)['then'](function(_0x31f2d6){logger['info'](_0xe2d7('0xd'),_0xce1b8e,_0xe2d7('0xe'));logger[_0xe2d7('0xf')](_0xe2d7('0x10'),_0xce1b8e,_0xe2d7('0xe'),JSON[_0xe2d7('0x11')](_0x31f2d6));if(_0x31f2d6[_0xe2d7('0x12')]){if(_0x31f2d6['error'][_0xe2d7('0x13')]===0x1f4){logger[_0xe2d7('0x12')]('CmList,\x20%s,\x20%s',_0xce1b8e,_0x31f2d6[_0xe2d7('0x12')][_0xe2d7('0x14')]);return _0x1088de(_0x31f2d6['error'][_0xe2d7('0x14')]);}logger[_0xe2d7('0x12')](_0xe2d7('0xd'),_0xce1b8e,_0x31f2d6[_0xe2d7('0x12')]['message']);return _0x2c1220(_0x31f2d6['error'][_0xe2d7('0x14')]);}else{logger[_0xe2d7('0x15')](_0xe2d7('0xd'),_0xce1b8e,_0xe2d7('0xe'));_0x2c1220(_0x31f2d6[_0xe2d7('0x16')][_0xe2d7('0x14')]);}})[_0xe2d7('0x17')](function(_0x2a8e4f){logger[_0xe2d7('0x12')](_0xe2d7('0xd'),_0xce1b8e,_0x2a8e4f);_0x1088de(_0x2a8e4f);});});} \ No newline at end of file +var _0xfb15=['message','lodash','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4883cb,_0x3df63c){var _0x33aad7=function(_0x2e901e){while(--_0x2e901e){_0x4883cb['push'](_0x4883cb['shift']());}};_0x33aad7(++_0x3df63c);}(_0xfb15,0x18d));var _0x5fb1=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfb15[_0x432682];return _0x463d05;};'use strict';var _=require(_0x5fb1('0x0'));var util=require('util');var moment=require(_0x5fb1('0x1'));var BPromise=require('bluebird');var rs=require(_0x5fb1('0x2'));var fs=require('fs');var Redis=require(_0x5fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5fb1('0x4'));var logger=require('../../config/logger')(_0x5fb1('0x5'));var config=require('../../config/environment');var jayson=require(_0x5fb1('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x5fb1('0x7')]=_[_0x5fb1('0x8')](config[_0x5fb1('0x7')],{'host':_0x5fb1('0x9'),'port':0x18eb});var socket=require(_0x5fb1('0xa'))(new Redis(config[_0x5fb1('0x7')]));require(_0x5fb1('0xb'))[_0x5fb1('0xc')](socket);function respondWithRpcPromise(_0xfdf30f,_0x242f67,_0x5c1dae){return new BPromise(function(_0x3051f6,_0xcde81a){return client[_0x5fb1('0xd')](_0xfdf30f,_0x5c1dae)[_0x5fb1('0xe')](function(_0x3f2f6b){logger[_0x5fb1('0xf')](_0x5fb1('0x10'),_0x242f67,_0x5fb1('0x11'));logger['debug'](_0x5fb1('0x12'),_0x242f67,_0x5fb1('0x11'),JSON['stringify'](_0x3f2f6b));if(_0x3f2f6b['error']){if(_0x3f2f6b[_0x5fb1('0x13')][_0x5fb1('0x14')]===0x1f4){logger[_0x5fb1('0x13')]('CmList,\x20%s,\x20%s',_0x242f67,_0x3f2f6b[_0x5fb1('0x13')][_0x5fb1('0x15')]);return _0xcde81a(_0x3f2f6b[_0x5fb1('0x13')][_0x5fb1('0x15')]);}logger[_0x5fb1('0x13')](_0x5fb1('0x10'),_0x242f67,_0x3f2f6b[_0x5fb1('0x13')]['message']);return _0x3051f6(_0x3f2f6b[_0x5fb1('0x13')][_0x5fb1('0x15')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x242f67,'request\x20sent');_0x3051f6(_0x3f2f6b['result'][_0x5fb1('0x15')]);}})['catch'](function(_0x4fe126){logger[_0x5fb1('0x13')](_0x5fb1('0x10'),_0x242f67,_0x4fe126);_0xcde81a(_0x4fe126);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index a531e14..c696372 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 _0x4c0a=['register','length','cmList:','save','remove','update','emit'];(function(_0x367604,_0x2070e9){var _0x4eb2a2=function(_0x10cb9a){while(--_0x10cb9a){_0x367604['push'](_0x367604['shift']());}};_0x4eb2a2(++_0x2070e9);}(_0x4c0a,0xce));var _0xa4c0=function(_0x3692ec,_0x1f6238){_0x3692ec=_0x3692ec-0x0;var _0x11d60d=_0x4c0a[_0x3692ec];return _0x11d60d;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xa4c0('0x0'),_0xa4c0('0x1'),_0xa4c0('0x2')];function createListener(_0x1e0939,_0x3444b9){return function(_0x33bb4){_0x3444b9[_0xa4c0('0x3')](_0x1e0939,_0x33bb4);};}function removeListener(_0x2f315b,_0x2a98ef){return function(){CmListEvents['removeListener'](_0x2f315b,_0x2a98ef);};}exports[_0xa4c0('0x4')]=function(_0x21cc69){for(var _0x25db05=0x0,_0x2ab6f1=events[_0xa4c0('0x5')];_0x25db05<_0x2ab6f1;_0x25db05++){var _0x20db3b=events[_0x25db05];var _0x37d99b=createListener(_0xa4c0('0x6')+_0x20db3b,_0x21cc69);CmListEvents['on'](_0x20db3b,_0x37d99b);}}; \ No newline at end of file +var _0x4a58=['./cmList.events','update','emit','removeListener','register','length','cmList:'];(function(_0x438f29,_0x11c25f){var _0x270351=function(_0x292452){while(--_0x292452){_0x438f29['push'](_0x438f29['shift']());}};_0x270351(++_0x11c25f);}(_0x4a58,0x1c7));var _0x84a5=function(_0x5ea51f,_0x1e3a5b){_0x5ea51f=_0x5ea51f-0x0;var _0x28f6ab=_0x4a58[_0x5ea51f];return _0x28f6ab;};'use strict';var CmListEvents=require(_0x84a5('0x0'));var events=['save','remove',_0x84a5('0x1')];function createListener(_0x17d4f2,_0x362d2d){return function(_0x5d47a8){_0x362d2d[_0x84a5('0x2')](_0x17d4f2,_0x5d47a8);};}function removeListener(_0x213f37,_0x280e99){return function(){CmListEvents[_0x84a5('0x3')](_0x213f37,_0x280e99);};}exports[_0x84a5('0x4')]=function(_0x34389a){for(var _0x52238c=0x0,_0x39ff53=events[_0x84a5('0x5')];_0x52238c<_0x39ff53;_0x52238c++){var _0x57a63a=events[_0x52238c];var _0x15e7f3=createListener(_0x84a5('0x6')+_0x57a63a,_0x34389a);CmListEvents['on'](_0x57a63a,_0x15e7f3);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 8983f57..3b5a93c 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 _0xa198=['get','index','/describe','isAuthenticated','/global_fields','/:id','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addContacts','addCustomField','addAgents','update','delete','/:id/dispositions','removeDispositions','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller'];(function(_0x48d14e,_0x1a0fe2){var _0x6a5280=function(_0x52c21f){while(--_0x52c21f){_0x48d14e['push'](_0x48d14e['shift']());}};_0x6a5280(++_0x1a0fe2);}(_0xa198,0x7f));var _0x8a19=function(_0x3933c6,_0xf68658){_0x3933c6=_0x3933c6-0x0;var _0x5b171b=_0xa198[_0x3933c6];return _0x5b171b;};'use strict';var multer=require(_0x8a19('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8a19('0x1'));var express=require(_0x8a19('0x2'));var router=express[_0x8a19('0x3')]();var fs_extra=require(_0x8a19('0x4'));var auth=require(_0x8a19('0x5'));var interaction=require(_0x8a19('0x6'));var config=require(_0x8a19('0x7'));var controller=require(_0x8a19('0x8'));router[_0x8a19('0x9')]('/',auth['isAuthenticated'](),controller[_0x8a19('0xa')]);router['get'](_0x8a19('0xb'),auth[_0x8a19('0xc')](),controller['describe']);router[_0x8a19('0x9')](_0x8a19('0xd'),auth[_0x8a19('0xc')](),controller['getGlobalCustomFields']);router[_0x8a19('0x9')](_0x8a19('0xe'),auth[_0x8a19('0xc')](),controller['show']);router[_0x8a19('0x9')]('/:id/dispositions',auth[_0x8a19('0xc')](),controller[_0x8a19('0xf')]);router[_0x8a19('0x9')](_0x8a19('0x10'),auth['isAuthenticated'](),controller['getContacts']);router[_0x8a19('0x9')](_0x8a19('0x11'),auth['isAuthenticated'](),controller[_0x8a19('0x12')]);router[_0x8a19('0x9')](_0x8a19('0x13'),auth[_0x8a19('0xc')](),controller[_0x8a19('0x14')]);router[_0x8a19('0x9')](_0x8a19('0x15'),auth[_0x8a19('0xc')](),controller[_0x8a19('0x16')]);router['post']('/',auth[_0x8a19('0xc')](),controller[_0x8a19('0x17')]);router[_0x8a19('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x8a19('0x10'),auth[_0x8a19('0xc')](),controller[_0x8a19('0x19')]);router['post']('/:id/fields',auth[_0x8a19('0xc')](),controller[_0x8a19('0x1a')]);router[_0x8a19('0x18')](_0x8a19('0x15'),auth['isAuthenticated'](),controller[_0x8a19('0x1b')]);router['put'](_0x8a19('0xe'),auth['isAuthenticated'](),controller[_0x8a19('0x1c')]);router[_0x8a19('0x1d')](_0x8a19('0xe'),auth[_0x8a19('0xc')](),controller['destroy']);router[_0x8a19('0x1d')](_0x8a19('0x1e'),auth[_0x8a19('0xc')](),controller[_0x8a19('0x1f')]);router['delete'](_0x8a19('0x15'),auth[_0x8a19('0xc')](),controller[_0x8a19('0x20')]);module[_0x8a19('0x21')]=router; \ No newline at end of file +var _0x863a=['index','describe','getGlobalCustomFields','/:id','show','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','exports','util','path','express','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x863a,0x107));var _0xa863=function(_0x4e3836,_0x3abedb){_0x4e3836=_0x4e3836-0x0;var _0xfe1d4a=_0x863a[_0x4e3836];return _0xfe1d4a;};'use strict';var multer=require('multer');var util=require(_0xa863('0x0'));var path=require(_0xa863('0x1'));var timeout=require('connect-timeout');var express=require(_0xa863('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa863('0x3'));var controller=require(_0xa863('0x4'));router[_0xa863('0x5')]('/',auth[_0xa863('0x6')](),controller[_0xa863('0x7')]);router['get']('/describe',auth[_0xa863('0x6')](),controller[_0xa863('0x8')]);router[_0xa863('0x5')]('/global_fields',auth[_0xa863('0x6')](),controller[_0xa863('0x9')]);router[_0xa863('0x5')](_0xa863('0xa'),auth[_0xa863('0x6')](),controller[_0xa863('0xb')]);router[_0xa863('0x5')]('/:id/dispositions',auth[_0xa863('0x6')](),controller[_0xa863('0xc')]);router[_0xa863('0x5')](_0xa863('0xd'),auth['isAuthenticated'](),controller['getContacts']);router[_0xa863('0x5')](_0xa863('0xe'),auth[_0xa863('0x6')](),controller[_0xa863('0xf')]);router[_0xa863('0x5')](_0xa863('0x10'),auth[_0xa863('0x6')](),controller[_0xa863('0x11')]);router['get'](_0xa863('0x12'),auth[_0xa863('0x6')](),controller['getAgents']);router[_0xa863('0x13')]('/',auth['isAuthenticated'](),controller[_0xa863('0x14')]);router[_0xa863('0x13')](_0xa863('0x15'),auth[_0xa863('0x6')](),controller[_0xa863('0x16')]);router[_0xa863('0x13')]('/:id/contacts',auth[_0xa863('0x6')](),controller[_0xa863('0x17')]);router['post'](_0xa863('0x10'),auth[_0xa863('0x6')](),controller[_0xa863('0x18')]);router[_0xa863('0x13')](_0xa863('0x12'),auth[_0xa863('0x6')](),controller[_0xa863('0x19')]);router[_0xa863('0x1a')](_0xa863('0xa'),auth['isAuthenticated'](),controller[_0xa863('0x1b')]);router['delete'](_0xa863('0xa'),auth[_0xa863('0x6')](),controller['destroy']);router[_0xa863('0x1c')](_0xa863('0x15'),auth[_0xa863('0x6')](),controller['removeDispositions']);router[_0xa863('0x1c')](_0xa863('0x12'),auth[_0xa863('0x6')](),controller['removeAgents']);module[_0xa863('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 fc073f2..cd8397f 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 _0x86f3=['exports','VIRTUAL','field','STRING','sequelize'];(function(_0x324e58,_0x5667bf){var _0x41bda1=function(_0x370b04){while(--_0x370b04){_0x324e58['push'](_0x324e58['shift']());}};_0x41bda1(++_0x5667bf);}(_0x86f3,0x14e));var _0x386f=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x86f3[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0x386f('0x0'));module[_0x386f('0x1')]={'name':{'type':Sequelize[_0x386f('0x2')],'get':function(_0x19f5dd){return this['getDataValue'](_0x386f('0x3'));}},'field':{'type':Sequelize[_0x386f('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x386f('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x2dcf=['field','STRING','sequelize','VIRTUAL','getDataValue'];(function(_0x1cbf1d,_0x33a0fe){var _0x4291d6=function(_0x501e85){while(--_0x501e85){_0x1cbf1d['push'](_0x1cbf1d['shift']());}};_0x4291d6(++_0x33a0fe);}(_0x2dcf,0x10b));var _0xf2dc=function(_0x2abfd6,_0x488035){_0x2abfd6=_0x2abfd6-0x0;var _0x13f52e=_0x2dcf[_0x2abfd6];return _0x13f52e;};'use strict';var Sequelize=require(_0xf2dc('0x0'));module['exports']={'name':{'type':Sequelize[_0xf2dc('0x1')],'get':function(_0x20623c){return this[_0xf2dc('0x2')](_0xf2dc('0x3'));}},'field':{'type':Sequelize[_0xf2dc('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xf2dc('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xf2dc('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 7c42175..180f39c 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1d14b1,_0x384093){var _0x1afb51=function(_0x4f93ae){while(--_0x4f93ae){_0x1d14b1['push'](_0x1d14b1['shift']());}};_0x1afb51(++_0x384093);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x903657,_0xf2a63){var _0x341184=function(_0x28bf64){while(--_0x28bf64){_0x903657['push'](_0x903657['shift']());}};_0x341184(++_0xf2a63);}(_0x7a54,0x106));var _0x47a5=function(_0x4c0009,_0x268872){_0x4c0009=_0x4c0009-0x0;var _0x5cbc85=_0x7a54[_0x4c0009];return _0x5cbc85;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 0a8f4e1..96d2c9b 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 _0x8a02=['./condition.attributes','exports','Condition','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3f5da6,_0x3551dc){var _0xbe3ea1=function(_0x4a6d42){while(--_0x4a6d42){_0x3f5da6['push'](_0x3f5da6['shift']());}};_0xbe3ea1(++_0x3551dc);}(_0x8a02,0x19d));var _0x28a0=function(_0x124ba5,_0x2bcf6d){_0x124ba5=_0x124ba5-0x0;var _0x447535=_0x8a02[_0x124ba5];return _0x447535;};'use strict';var _=require(_0x28a0('0x0'));var util=require('util');var logger=require(_0x28a0('0x1'))(_0x28a0('0x2'));var moment=require(_0x28a0('0x3'));var BPromise=require(_0x28a0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x28a0('0x5'));var rimraf=require(_0x28a0('0x6'));var config=require('../../config/environment');var attributes=require(_0x28a0('0x7'));module[_0x28a0('0x8')]=function(_0x4c3cd1,_0x47255b){return _0x4c3cd1['define'](_0x28a0('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcabe=['Condition','tools_conditions','lodash','util','../../config/logger','api','path','rimraf','./condition.attributes','exports','define'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0xcabe,0x183));var _0xecab=function(_0x5ee6e7,_0x35bb03){_0x5ee6e7=_0x5ee6e7-0x0;var _0x43e8c9=_0xcabe[_0x5ee6e7];return _0x43e8c9;};'use strict';var _=require(_0xecab('0x0'));var util=require(_0xecab('0x1'));var logger=require(_0xecab('0x2'))(_0xecab('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xecab('0x4'));var rimraf=require(_0xecab('0x5'));var config=require('../../config/environment');var attributes=require(_0xecab('0x6'));module[_0xecab('0x7')]=function(_0x4b71a8,_0x29f49e){return _0x4b71a8[_0xecab('0x8')](_0xecab('0x9'),attributes,{'tableName':_0xecab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index fea369d..f4a0897 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 _0x4871=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x204250,_0x45ed8e){var _0x2b94a8=function(_0x28bcd2){while(--_0x28bcd2){_0x204250['push'](_0x204250['shift']());}};_0x2b94a8(++_0x45ed8e);}(_0x4871,0xaf));var _0x1487=function(_0xa05ddf,_0x352d9f){_0xa05ddf=_0xa05ddf-0x0;var _0x155fec=_0x4871[_0xa05ddf];return _0x155fec;};'use strict';var _=require(_0x1487('0x0'));var util=require(_0x1487('0x1'));var moment=require(_0x1487('0x2'));var BPromise=require(_0x1487('0x3'));var rs=require(_0x1487('0x4'));var fs=require('fs');var Redis=require(_0x1487('0x5'));var db=require(_0x1487('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1487('0x7'))('rpc');var config=require(_0x1487('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1487('0x9')][_0x1487('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4751c3,_0x44d554,_0x71de76){return new BPromise(function(_0x3f2c76,_0x402a66){return client[_0x1487('0xb')](_0x4751c3,_0x71de76)['then'](function(_0x5401ee){logger[_0x1487('0xc')](_0x1487('0xd'),_0x44d554,'request\x20sent');logger[_0x1487('0xe')](_0x1487('0xf'),_0x44d554,_0x1487('0x10'),JSON[_0x1487('0x11')](_0x5401ee));if(_0x5401ee[_0x1487('0x12')]){if(_0x5401ee[_0x1487('0x12')][_0x1487('0x13')]===0x1f4){logger[_0x1487('0x12')]('Condition,\x20%s,\x20%s',_0x44d554,_0x5401ee[_0x1487('0x12')][_0x1487('0x14')]);return _0x402a66(_0x5401ee['error']['message']);}logger['error'](_0x1487('0xd'),_0x44d554,_0x5401ee[_0x1487('0x12')][_0x1487('0x14')]);return _0x3f2c76(_0x5401ee[_0x1487('0x12')][_0x1487('0x14')]);}else{logger[_0x1487('0xc')]('Condition,\x20%s,\x20%s',_0x44d554,_0x1487('0x10'));_0x3f2c76(_0x5401ee['result']['message']);}})[_0x1487('0x15')](function(_0x29eaf6){logger['error']('Condition,\x20%s,\x20%s',_0x44d554,_0x29eaf6);_0x402a66(_0x29eaf6);});});} \ No newline at end of file +var _0xfa35=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x39e4e6,_0x3c5d98){var _0x51ad61=function(_0x57d5bb){while(--_0x57d5bb){_0x39e4e6['push'](_0x39e4e6['shift']());}};_0x51ad61(++_0x3c5d98);}(_0xfa35,0x172));var _0x5fa3=function(_0x326ad4,_0x1744ac){_0x326ad4=_0x326ad4-0x0;var _0x58df34=_0xfa35[_0x326ad4];return _0x58df34;};'use strict';var _=require(_0x5fa3('0x0'));var util=require(_0x5fa3('0x1'));var moment=require('moment');var BPromise=require(_0x5fa3('0x2'));var rs=require(_0x5fa3('0x3'));var fs=require('fs');var Redis=require(_0x5fa3('0x4'));var db=require(_0x5fa3('0x5'))['db'];var utils=require(_0x5fa3('0x6'));var logger=require(_0x5fa3('0x7'))(_0x5fa3('0x8'));var config=require(_0x5fa3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5fa3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5334e0,_0x57ffd2,_0x5a272e){return new BPromise(function(_0x8ec117,_0x335f5f){return client[_0x5fa3('0xb')](_0x5334e0,_0x5a272e)[_0x5fa3('0xc')](function(_0x39dd8d){logger[_0x5fa3('0xd')](_0x5fa3('0xe'),_0x57ffd2,'request\x20sent');logger[_0x5fa3('0xf')](_0x5fa3('0x10'),_0x57ffd2,_0x5fa3('0x11'),JSON[_0x5fa3('0x12')](_0x39dd8d));if(_0x39dd8d[_0x5fa3('0x13')]){if(_0x39dd8d[_0x5fa3('0x13')][_0x5fa3('0x14')]===0x1f4){logger['error'](_0x5fa3('0xe'),_0x57ffd2,_0x39dd8d[_0x5fa3('0x13')]['message']);return _0x335f5f(_0x39dd8d[_0x5fa3('0x13')]['message']);}logger[_0x5fa3('0x13')](_0x5fa3('0xe'),_0x57ffd2,_0x39dd8d[_0x5fa3('0x13')][_0x5fa3('0x15')]);return _0x8ec117(_0x39dd8d[_0x5fa3('0x13')][_0x5fa3('0x15')]);}else{logger[_0x5fa3('0xd')]('Condition,\x20%s,\x20%s',_0x57ffd2,_0x5fa3('0x11'));_0x8ec117(_0x39dd8d['result']['message']);}})[_0x5fa3('0x16')](function(_0x3bc77f){logger[_0x5fa3('0x13')]('Condition,\x20%s,\x20%s',_0x57ffd2,_0x3bc77f);_0x335f5f(_0x3bc77f);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 243eb3e..bb60d44 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 _0x4300=['/:id','isAuthenticated','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./condition.controller','put'];(function(_0x26d500,_0x327b38){var _0x409a5b=function(_0x291e1a){while(--_0x291e1a){_0x26d500['push'](_0x26d500['shift']());}};_0x409a5b(++_0x327b38);}(_0x4300,0x1a3));var _0x0430=function(_0x18e3c7,_0x5b2966){_0x18e3c7=_0x18e3c7-0x0;var _0x199e1d=_0x4300[_0x18e3c7];return _0x199e1d;};'use strict';var multer=require(_0x0430('0x0'));var util=require(_0x0430('0x1'));var path=require(_0x0430('0x2'));var timeout=require(_0x0430('0x3'));var express=require(_0x0430('0x4'));var router=express[_0x0430('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0430('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0430('0x7'));var controller=require(_0x0430('0x8'));router[_0x0430('0x9')](_0x0430('0xa'),auth[_0x0430('0xb')](),controller['update']);router[_0x0430('0xc')]('/:id',auth[_0x0430('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5a36=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated','update','delete'];(function(_0x4bd1e4,_0x57b471){var _0x5a374b=function(_0x4b51a4){while(--_0x4b51a4){_0x4bd1e4['push'](_0x4bd1e4['shift']());}};_0x5a374b(++_0x57b471);}(_0x5a36,0x1eb));var _0x65a3=function(_0x4e6972,_0x29b35e){_0x4e6972=_0x4e6972-0x0;var _0x1a073c=_0x5a36[_0x4e6972];return _0x1a073c;};'use strict';var multer=require(_0x65a3('0x0'));var util=require(_0x65a3('0x1'));var path=require(_0x65a3('0x2'));var timeout=require(_0x65a3('0x3'));var express=require(_0x65a3('0x4'));var router=express[_0x65a3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x65a3('0x6'));var interaction=require(_0x65a3('0x7'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x65a3('0x8')](_0x65a3('0x9'),auth[_0x65a3('0xa')](),controller[_0x65a3('0xb')]);router[_0x65a3('0xc')](_0x65a3('0x9'),auth[_0x65a3('0xa')](),controller['destroy']);module[_0x65a3('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 34798ef..5e8a6e4 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1c7=['exports','STRING','name','sequelize'];(function(_0x5cc4de,_0x2df335){var _0x1bf255=function(_0x479413){while(--_0x479413){_0x5cc4de['push'](_0x5cc4de['shift']());}};_0x1bf255(++_0x2df335);}(_0xb1c7,0x183));var _0x7b1c=function(_0xea98ab,_0x297344){_0xea98ab=_0xea98ab-0x0;var _0x39058e=_0xb1c7[_0xea98ab];return _0x39058e;};'use strict';var Sequelize=require(_0x7b1c('0x0'));module[_0x7b1c('0x1')]={'name':{'type':Sequelize[_0x7b1c('0x2')],'allowNull':![],'unique':_0x7b1c('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x7b1c('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xc9a3=['STRING','name','INTEGER','sequelize','exports'];(function(_0x471c0e,_0x35a7ac){var _0x1cbad8=function(_0x1df22d){while(--_0x1df22d){_0x471c0e['push'](_0x471c0e['shift']());}};_0x1cbad8(++_0x35a7ac);}(_0xc9a3,0x99));var _0x3c9a=function(_0x11d2d1,_0x3b215b){_0x11d2d1=_0x11d2d1-0x0;var _0x3edbfe=_0xc9a3[_0x11d2d1];return _0x3edbfe;};'use strict';var Sequelize=require(_0x3c9a('0x0'));module[_0x3c9a('0x1')]={'name':{'type':Sequelize[_0x3c9a('0x2')],'allowNull':![],'unique':_0x3c9a('0x3')},'OrderBy':{'type':Sequelize[_0x3c9a('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x3c9a('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 54b3ceb..d96c635 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32f4=['Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','end','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','nolimit','limit','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','options','find','create'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x32f4,0x154));var _0x432f=function(_0x78bad,_0x1eef1b){_0x78bad=_0x78bad-0x0;var _0x41476d=_0x32f4[_0x78bad];return _0x41476d;};'use strict';var emlformat=require(_0x432f('0x0'));var rimraf=require(_0x432f('0x1'));var zipdir=require(_0x432f('0x2'));var jsonpatch=require(_0x432f('0x3'));var rp=require('request-promise');var moment=require(_0x432f('0x4'));var BPromise=require(_0x432f('0x5'));var Mustache=require('mustache');var util=require(_0x432f('0x6'));var path=require(_0x432f('0x7'));var sox=require(_0x432f('0x8'));var csv=require(_0x432f('0x9'));var ejs=require(_0x432f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x432f('0xb'));var crypto=require(_0x432f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x432f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x432f('0xe'));var Papa=require(_0x432f('0xf'));var Redis=require(_0x432f('0x10'));var authService=require(_0x432f('0x11'));var qs=require(_0x432f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x432f('0x13'));var logger=require('../../config/logger')(_0x432f('0x14'));var utils=require('../../config/utils');var config=require(_0x432f('0x15'));var licenseUtil=require(_0x432f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x457389,_0x29f7d2){_0x29f7d2=_0x29f7d2||0xcc;return function(_0x52e40f){if(_0x52e40f){return _0x457389[_0x432f('0x17')](_0x29f7d2);}return _0x457389[_0x432f('0x18')](_0x29f7d2)['end']();};}function respondWithResult(_0x48a4db,_0x28d9e9){_0x28d9e9=_0x28d9e9||0xc8;return function(_0x44756d){if(_0x44756d){return _0x48a4db[_0x432f('0x18')](_0x28d9e9)[_0x432f('0x19')](_0x44756d);}};}function respondWithFilteredResult(_0x419bfe,_0x4f91c5){return function(_0x175ba7){if(_0x175ba7){var _0x2f0708=typeof _0x4f91c5[_0x432f('0x1a')]===_0x432f('0x1b')&&typeof _0x4f91c5['limit']===_0x432f('0x1b');var _0x30f231=_0x175ba7[_0x432f('0x1c')];var _0x243cf=_0x2f0708?0x0:_0x4f91c5[_0x432f('0x1a')];var _0x129582=_0x2f0708?_0x175ba7['count']:_0x4f91c5[_0x432f('0x1a')]+_0x4f91c5['limit'];var _0x3d545d;if(_0x129582>=_0x30f231){_0x129582=_0x30f231;_0x3d545d=0xc8;}else{_0x3d545d=0xce;}_0x419bfe[_0x432f('0x18')](_0x3d545d);return _0x419bfe[_0x432f('0x1d')](_0x432f('0x1e'),_0x243cf+'-'+_0x129582+'/'+_0x30f231)[_0x432f('0x19')](_0x175ba7);}return null;};}function patchUpdates(_0xf1f5d){return function(_0x10f39b){try{jsonpatch[_0x432f('0x1f')](_0x10f39b,_0xf1f5d,!![]);}catch(_0x693eb3){return BPromise[_0x432f('0x20')](_0x693eb3);}return _0x10f39b[_0x432f('0x21')]();};}function saveUpdates(_0x3446fd,_0x4dd230){return function(_0x5940bd){if(_0x5940bd){return _0x5940bd[_0x432f('0x22')](_0x3446fd)['then'](function(_0x28968e){return _0x28968e;});}return null;};}function removeEntity(_0x5b9c70,_0x37f136){return function(_0x175d1b){if(_0x175d1b){return _0x175d1b[_0x432f('0x23')]()[_0x432f('0x24')](function(){var _0x2f84a7=_0x175d1b[_0x432f('0x25')]({'plain':!![]});var _0x59f352=_0x432f('0x26');return db[_0x432f('0x27')]['destroy']({'where':{'type':_0x59f352,'resourceId':_0x2f84a7['id']}})[_0x432f('0x24')](function(){return _0x175d1b;});})[_0x432f('0x24')](function(){_0x5b9c70[_0x432f('0x18')](0xcc)[_0x432f('0x28')]();});}};}function handleEntityNotFound(_0x44839,_0x781862){return function(_0x138a6a){if(!_0x138a6a){_0x44839['sendStatus'](0x194);}return _0x138a6a;};}function handleError(_0x294bfe,_0x4eeae1){_0x4eeae1=_0x4eeae1||0x1f4;return function(_0x1f1fdd){logger['error'](_0x1f1fdd[_0x432f('0x29')]);if(_0x1f1fdd['name']){delete _0x1f1fdd[_0x432f('0x2a')];}_0x294bfe['status'](_0x4eeae1)[_0x432f('0x2b')](_0x1f1fdd);};}exports[_0x432f('0x2c')]=function(_0x263cd8,_0x59c1ab){var _0x6a116e={},_0x24406a={},_0x48139b={'count':0x0,'rows':[]};var _0x5ee0fa=_[_0x432f('0x2d')](db[_0x432f('0x2e')][_0x432f('0x2f')],function(_0x3581c2){return{'name':_0x3581c2[_0x432f('0x30')],'type':_0x3581c2[_0x432f('0x31')]['key']};});_0x24406a['model']=_[_0x432f('0x2d')](_0x5ee0fa,_0x432f('0x2a'));_0x24406a[_0x432f('0x32')]=_['keys'](_0x263cd8[_0x432f('0x32')]);_0x24406a[_0x432f('0x33')]=_[_0x432f('0x34')](_0x24406a[_0x432f('0x35')],_0x24406a[_0x432f('0x32')]);_0x6a116e[_0x432f('0x36')]=_[_0x432f('0x34')](_0x24406a[_0x432f('0x35')],qs['fields'](_0x263cd8['query'][_0x432f('0x37')]));_0x6a116e[_0x432f('0x36')]=_0x6a116e['attributes']['length']?_0x6a116e['attributes']:_0x24406a[_0x432f('0x35')];if(!_0x263cd8[_0x432f('0x32')]['hasOwnProperty'](_0x432f('0x38'))){_0x6a116e[_0x432f('0x39')]=qs[_0x432f('0x39')](_0x263cd8['query'][_0x432f('0x39')]);_0x6a116e[_0x432f('0x1a')]=qs['offset'](_0x263cd8[_0x432f('0x32')][_0x432f('0x1a')]);}_0x6a116e['order']=qs[_0x432f('0x3a')](_0x263cd8[_0x432f('0x32')][_0x432f('0x3a')]);_0x6a116e[_0x432f('0x3b')]=qs[_0x432f('0x33')](_[_0x432f('0x3c')](_0x263cd8[_0x432f('0x32')],_0x24406a[_0x432f('0x33')]),_0x5ee0fa);if(_0x263cd8[_0x432f('0x32')][_0x432f('0x3d')]){_0x6a116e[_0x432f('0x3b')]=_['merge'](_0x6a116e[_0x432f('0x3b')],{'$or':_['map'](_0x5ee0fa,function(_0x1550fc){if(_0x1550fc[_0x432f('0x31')]!=='VIRTUAL'){var _0x43d836={};_0x43d836[_0x1550fc['name']]={'$like':'%'+_0x263cd8[_0x432f('0x32')][_0x432f('0x3d')]+'%'};return _0x43d836;}})});}_0x6a116e=_['merge']({},_0x6a116e,_0x263cd8['options']);var _0xbd4240={'where':_0x6a116e[_0x432f('0x3b')]};return db[_0x432f('0x2e')][_0x432f('0x1c')](_0xbd4240)[_0x432f('0x24')](function(_0x513a57){_0x48139b['count']=_0x513a57;if(_0x263cd8['query'][_0x432f('0x3e')]){_0x6a116e[_0x432f('0x3f')]=[{'all':!![]}];}return db['ContactItemType'][_0x432f('0x40')](_0x6a116e);})[_0x432f('0x24')](function(_0x41c90c){_0x48139b[_0x432f('0x41')]=_0x41c90c;return _0x48139b;})[_0x432f('0x24')](respondWithFilteredResult(_0x59c1ab,_0x6a116e))[_0x432f('0x42')](handleError(_0x59c1ab,null));};exports[_0x432f('0x43')]=function(_0x1a2be2,_0x1c5f87){var _0x5c6298={'raw':!![],'where':{'id':_0x1a2be2[_0x432f('0x44')]['id']}},_0x247b63={};_0x247b63['model']=_[_0x432f('0x45')](db[_0x432f('0x2e')][_0x432f('0x2f')]);_0x247b63[_0x432f('0x32')]=_[_0x432f('0x45')](_0x1a2be2[_0x432f('0x32')]);_0x247b63[_0x432f('0x33')]=_[_0x432f('0x34')](_0x247b63[_0x432f('0x35')],_0x247b63[_0x432f('0x32')]);_0x5c6298[_0x432f('0x36')]=_[_0x432f('0x34')](_0x247b63[_0x432f('0x35')],qs[_0x432f('0x37')](_0x1a2be2['query']['fields']));_0x5c6298[_0x432f('0x36')]=_0x5c6298[_0x432f('0x36')][_0x432f('0x46')]?_0x5c6298[_0x432f('0x36')]:_0x247b63[_0x432f('0x35')];if(_0x1a2be2['query'][_0x432f('0x3e')]){_0x5c6298[_0x432f('0x3f')]=[{'all':!![]}];}_0x5c6298=_[_0x432f('0x47')]({},_0x5c6298,_0x1a2be2[_0x432f('0x48')]);return db[_0x432f('0x2e')][_0x432f('0x49')](_0x5c6298)[_0x432f('0x24')](handleEntityNotFound(_0x1c5f87,null))['then'](respondWithResult(_0x1c5f87,null))[_0x432f('0x42')](handleError(_0x1c5f87,null));};exports[_0x432f('0x4a')]=function(_0x359853,_0x547bd0){return db[_0x432f('0x2e')][_0x432f('0x4a')](_0x359853['body'],{})['then'](function(_0x3b2021){var _0x24f244=_0x359853['user']['get']({'plain':!![]});if(!_0x24f244)throw new Error(_0x432f('0x4b'));if(_0x24f244['role']===_0x432f('0x4c')){var _0x66b80e=_0x3b2021['get']({'plain':!![]});var _0x12f2f7='ContactItemTypes';return db[_0x432f('0x4d')][_0x432f('0x49')]({'where':{'name':_0x12f2f7,'userProfileId':_0x24f244[_0x432f('0x4e')]},'raw':!![]})[_0x432f('0x24')](function(_0x3051ea){if(_0x3051ea&&_0x3051ea[_0x432f('0x4f')]===0x0){return db['UserProfileResource'][_0x432f('0x4a')]({'name':_0x66b80e['name'],'resourceId':_0x66b80e['id'],'type':_0x3051ea[_0x432f('0x2a')],'sectionId':_0x3051ea['id']},{})[_0x432f('0x24')](function(){return _0x3b2021;});}else{return _0x3b2021;}})[_0x432f('0x42')](function(_0x21ae8c){logger['error'](_0x432f('0x50'),_0x21ae8c);throw _0x21ae8c;});}return _0x3b2021;})[_0x432f('0x24')](respondWithResult(_0x547bd0,0xc9))[_0x432f('0x42')](handleError(_0x547bd0,null));};exports[_0x432f('0x22')]=function(_0x13aced,_0x2a26bd){if(_0x13aced[_0x432f('0x51')]['id']){delete _0x13aced['body']['id'];}return db['ContactItemType'][_0x432f('0x49')]({'where':{'id':_0x13aced[_0x432f('0x44')]['id']}})[_0x432f('0x24')](handleEntityNotFound(_0x2a26bd,null))[_0x432f('0x24')](saveUpdates(_0x13aced[_0x432f('0x51')],null))[_0x432f('0x24')](respondWithResult(_0x2a26bd,null))['catch'](handleError(_0x2a26bd,null));};exports[_0x432f('0x23')]=function(_0x545035,_0x4e96d8){return db[_0x432f('0x2e')][_0x432f('0x49')]({'where':{'id':_0x545035[_0x432f('0x44')]['id']}})[_0x432f('0x24')](handleEntityNotFound(_0x4e96d8,null))[_0x432f('0x24')](db[_0x432f('0x52')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x545035[_0x432f('0x44')]['id']}}))[_0x432f('0x24')](removeEntity(_0x4e96d8,null))['catch'](handleError(_0x4e96d8,null));}; \ No newline at end of file +var _0x32f4=['Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','end','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','nolimit','limit','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','options','find','create'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x32f4,0x154));var _0x432f=function(_0x22f923,_0x57281c){_0x22f923=_0x22f923-0x0;var _0x33b0c7=_0x32f4[_0x22f923];return _0x33b0c7;};'use strict';var emlformat=require(_0x432f('0x0'));var rimraf=require(_0x432f('0x1'));var zipdir=require(_0x432f('0x2'));var jsonpatch=require(_0x432f('0x3'));var rp=require('request-promise');var moment=require(_0x432f('0x4'));var BPromise=require(_0x432f('0x5'));var Mustache=require('mustache');var util=require(_0x432f('0x6'));var path=require(_0x432f('0x7'));var sox=require(_0x432f('0x8'));var csv=require(_0x432f('0x9'));var ejs=require(_0x432f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x432f('0xb'));var crypto=require(_0x432f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x432f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x432f('0xe'));var Papa=require(_0x432f('0xf'));var Redis=require(_0x432f('0x10'));var authService=require(_0x432f('0x11'));var qs=require(_0x432f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x432f('0x13'));var logger=require('../../config/logger')(_0x432f('0x14'));var utils=require('../../config/utils');var config=require(_0x432f('0x15'));var licenseUtil=require(_0x432f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x457389,_0x29f7d2){_0x29f7d2=_0x29f7d2||0xcc;return function(_0x52e40f){if(_0x52e40f){return _0x457389[_0x432f('0x17')](_0x29f7d2);}return _0x457389[_0x432f('0x18')](_0x29f7d2)['end']();};}function respondWithResult(_0x48a4db,_0x28d9e9){_0x28d9e9=_0x28d9e9||0xc8;return function(_0x44756d){if(_0x44756d){return _0x48a4db[_0x432f('0x18')](_0x28d9e9)[_0x432f('0x19')](_0x44756d);}};}function respondWithFilteredResult(_0x419bfe,_0x4f91c5){return function(_0x175ba7){if(_0x175ba7){var _0x2f0708=typeof _0x4f91c5[_0x432f('0x1a')]===_0x432f('0x1b')&&typeof _0x4f91c5['limit']===_0x432f('0x1b');var _0x30f231=_0x175ba7[_0x432f('0x1c')];var _0x243cf=_0x2f0708?0x0:_0x4f91c5[_0x432f('0x1a')];var _0x129582=_0x2f0708?_0x175ba7['count']:_0x4f91c5[_0x432f('0x1a')]+_0x4f91c5['limit'];var _0x3d545d;if(_0x129582>=_0x30f231){_0x129582=_0x30f231;_0x3d545d=0xc8;}else{_0x3d545d=0xce;}_0x419bfe[_0x432f('0x18')](_0x3d545d);return _0x419bfe[_0x432f('0x1d')](_0x432f('0x1e'),_0x243cf+'-'+_0x129582+'/'+_0x30f231)[_0x432f('0x19')](_0x175ba7);}return null;};}function patchUpdates(_0xf1f5d){return function(_0x10f39b){try{jsonpatch[_0x432f('0x1f')](_0x10f39b,_0xf1f5d,!![]);}catch(_0x693eb3){return BPromise[_0x432f('0x20')](_0x693eb3);}return _0x10f39b[_0x432f('0x21')]();};}function saveUpdates(_0x3446fd,_0x4dd230){return function(_0x5940bd){if(_0x5940bd){return _0x5940bd[_0x432f('0x22')](_0x3446fd)['then'](function(_0x28968e){return _0x28968e;});}return null;};}function removeEntity(_0x5b9c70,_0x37f136){return function(_0x175d1b){if(_0x175d1b){return _0x175d1b[_0x432f('0x23')]()[_0x432f('0x24')](function(){var _0x2f84a7=_0x175d1b[_0x432f('0x25')]({'plain':!![]});var _0x59f352=_0x432f('0x26');return db[_0x432f('0x27')]['destroy']({'where':{'type':_0x59f352,'resourceId':_0x2f84a7['id']}})[_0x432f('0x24')](function(){return _0x175d1b;});})[_0x432f('0x24')](function(){_0x5b9c70[_0x432f('0x18')](0xcc)[_0x432f('0x28')]();});}};}function handleEntityNotFound(_0x44839,_0x781862){return function(_0x138a6a){if(!_0x138a6a){_0x44839['sendStatus'](0x194);}return _0x138a6a;};}function handleError(_0x294bfe,_0x4eeae1){_0x4eeae1=_0x4eeae1||0x1f4;return function(_0x1f1fdd){logger['error'](_0x1f1fdd[_0x432f('0x29')]);if(_0x1f1fdd['name']){delete _0x1f1fdd[_0x432f('0x2a')];}_0x294bfe['status'](_0x4eeae1)[_0x432f('0x2b')](_0x1f1fdd);};}exports[_0x432f('0x2c')]=function(_0x263cd8,_0x59c1ab){var _0x6a116e={},_0x24406a={},_0x48139b={'count':0x0,'rows':[]};var _0x5ee0fa=_[_0x432f('0x2d')](db[_0x432f('0x2e')][_0x432f('0x2f')],function(_0x3581c2){return{'name':_0x3581c2[_0x432f('0x30')],'type':_0x3581c2[_0x432f('0x31')]['key']};});_0x24406a['model']=_[_0x432f('0x2d')](_0x5ee0fa,_0x432f('0x2a'));_0x24406a[_0x432f('0x32')]=_['keys'](_0x263cd8[_0x432f('0x32')]);_0x24406a[_0x432f('0x33')]=_[_0x432f('0x34')](_0x24406a[_0x432f('0x35')],_0x24406a[_0x432f('0x32')]);_0x6a116e[_0x432f('0x36')]=_[_0x432f('0x34')](_0x24406a[_0x432f('0x35')],qs['fields'](_0x263cd8['query'][_0x432f('0x37')]));_0x6a116e[_0x432f('0x36')]=_0x6a116e['attributes']['length']?_0x6a116e['attributes']:_0x24406a[_0x432f('0x35')];if(!_0x263cd8[_0x432f('0x32')]['hasOwnProperty'](_0x432f('0x38'))){_0x6a116e[_0x432f('0x39')]=qs[_0x432f('0x39')](_0x263cd8['query'][_0x432f('0x39')]);_0x6a116e[_0x432f('0x1a')]=qs['offset'](_0x263cd8[_0x432f('0x32')][_0x432f('0x1a')]);}_0x6a116e['order']=qs[_0x432f('0x3a')](_0x263cd8[_0x432f('0x32')][_0x432f('0x3a')]);_0x6a116e[_0x432f('0x3b')]=qs[_0x432f('0x33')](_[_0x432f('0x3c')](_0x263cd8[_0x432f('0x32')],_0x24406a[_0x432f('0x33')]),_0x5ee0fa);if(_0x263cd8[_0x432f('0x32')][_0x432f('0x3d')]){_0x6a116e[_0x432f('0x3b')]=_['merge'](_0x6a116e[_0x432f('0x3b')],{'$or':_['map'](_0x5ee0fa,function(_0x1550fc){if(_0x1550fc[_0x432f('0x31')]!=='VIRTUAL'){var _0x43d836={};_0x43d836[_0x1550fc['name']]={'$like':'%'+_0x263cd8[_0x432f('0x32')][_0x432f('0x3d')]+'%'};return _0x43d836;}})});}_0x6a116e=_['merge']({},_0x6a116e,_0x263cd8['options']);var _0xbd4240={'where':_0x6a116e[_0x432f('0x3b')]};return db[_0x432f('0x2e')][_0x432f('0x1c')](_0xbd4240)[_0x432f('0x24')](function(_0x513a57){_0x48139b['count']=_0x513a57;if(_0x263cd8['query'][_0x432f('0x3e')]){_0x6a116e[_0x432f('0x3f')]=[{'all':!![]}];}return db['ContactItemType'][_0x432f('0x40')](_0x6a116e);})[_0x432f('0x24')](function(_0x41c90c){_0x48139b[_0x432f('0x41')]=_0x41c90c;return _0x48139b;})[_0x432f('0x24')](respondWithFilteredResult(_0x59c1ab,_0x6a116e))[_0x432f('0x42')](handleError(_0x59c1ab,null));};exports[_0x432f('0x43')]=function(_0x1a2be2,_0x1c5f87){var _0x5c6298={'raw':!![],'where':{'id':_0x1a2be2[_0x432f('0x44')]['id']}},_0x247b63={};_0x247b63['model']=_[_0x432f('0x45')](db[_0x432f('0x2e')][_0x432f('0x2f')]);_0x247b63[_0x432f('0x32')]=_[_0x432f('0x45')](_0x1a2be2[_0x432f('0x32')]);_0x247b63[_0x432f('0x33')]=_[_0x432f('0x34')](_0x247b63[_0x432f('0x35')],_0x247b63[_0x432f('0x32')]);_0x5c6298[_0x432f('0x36')]=_[_0x432f('0x34')](_0x247b63[_0x432f('0x35')],qs[_0x432f('0x37')](_0x1a2be2['query']['fields']));_0x5c6298[_0x432f('0x36')]=_0x5c6298[_0x432f('0x36')][_0x432f('0x46')]?_0x5c6298[_0x432f('0x36')]:_0x247b63[_0x432f('0x35')];if(_0x1a2be2['query'][_0x432f('0x3e')]){_0x5c6298[_0x432f('0x3f')]=[{'all':!![]}];}_0x5c6298=_[_0x432f('0x47')]({},_0x5c6298,_0x1a2be2[_0x432f('0x48')]);return db[_0x432f('0x2e')][_0x432f('0x49')](_0x5c6298)[_0x432f('0x24')](handleEntityNotFound(_0x1c5f87,null))['then'](respondWithResult(_0x1c5f87,null))[_0x432f('0x42')](handleError(_0x1c5f87,null));};exports[_0x432f('0x4a')]=function(_0x359853,_0x547bd0){return db[_0x432f('0x2e')][_0x432f('0x4a')](_0x359853['body'],{})['then'](function(_0x3b2021){var _0x24f244=_0x359853['user']['get']({'plain':!![]});if(!_0x24f244)throw new Error(_0x432f('0x4b'));if(_0x24f244['role']===_0x432f('0x4c')){var _0x66b80e=_0x3b2021['get']({'plain':!![]});var _0x12f2f7='ContactItemTypes';return db[_0x432f('0x4d')][_0x432f('0x49')]({'where':{'name':_0x12f2f7,'userProfileId':_0x24f244[_0x432f('0x4e')]},'raw':!![]})[_0x432f('0x24')](function(_0x3051ea){if(_0x3051ea&&_0x3051ea[_0x432f('0x4f')]===0x0){return db['UserProfileResource'][_0x432f('0x4a')]({'name':_0x66b80e['name'],'resourceId':_0x66b80e['id'],'type':_0x3051ea[_0x432f('0x2a')],'sectionId':_0x3051ea['id']},{})[_0x432f('0x24')](function(){return _0x3b2021;});}else{return _0x3b2021;}})[_0x432f('0x42')](function(_0x21ae8c){logger['error'](_0x432f('0x50'),_0x21ae8c);throw _0x21ae8c;});}return _0x3b2021;})[_0x432f('0x24')](respondWithResult(_0x547bd0,0xc9))[_0x432f('0x42')](handleError(_0x547bd0,null));};exports[_0x432f('0x22')]=function(_0x13aced,_0x2a26bd){if(_0x13aced[_0x432f('0x51')]['id']){delete _0x13aced['body']['id'];}return db['ContactItemType'][_0x432f('0x49')]({'where':{'id':_0x13aced[_0x432f('0x44')]['id']}})[_0x432f('0x24')](handleEntityNotFound(_0x2a26bd,null))[_0x432f('0x24')](saveUpdates(_0x13aced[_0x432f('0x51')],null))[_0x432f('0x24')](respondWithResult(_0x2a26bd,null))['catch'](handleError(_0x2a26bd,null));};exports[_0x432f('0x23')]=function(_0x545035,_0x4e96d8){return db[_0x432f('0x2e')][_0x432f('0x49')]({'where':{'id':_0x545035[_0x432f('0x44')]['id']}})[_0x432f('0x24')](handleEntityNotFound(_0x4e96d8,null))[_0x432f('0x24')](db[_0x432f('0x52')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x545035[_0x432f('0x44')]['id']}}))[_0x432f('0x24')](removeEntity(_0x4e96d8,null))['catch'](handleError(_0x4e96d8,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index d64e4b4..05783a6 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ec4=['ContactItemType','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./contactItemType.attributes','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2ec4,0x1b9));var _0x42ec=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x2ec4[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x42ec('0x0'));var util=require(_0x42ec('0x1'));var logger=require(_0x42ec('0x2'))('api');var moment=require(_0x42ec('0x3'));var BPromise=require(_0x42ec('0x4'));var rp=require(_0x42ec('0x5'));var fs=require('fs');var path=require(_0x42ec('0x6'));var rimraf=require('rimraf');var config=require(_0x42ec('0x7'));var attributes=require(_0x42ec('0x8'));module[_0x42ec('0x9')]=function(_0x4fe4f7,_0x3880f8){return _0x4fe4f7['define'](_0x42ec('0xa'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabbc=['exports','define','ContactItemType','tools_contact_item_types','lodash','util','moment','../../config/environment','./contactItemType.attributes'];(function(_0x482923,_0x2c07f5){var _0x393d71=function(_0xc731c6){while(--_0xc731c6){_0x482923['push'](_0x482923['shift']());}};_0x393d71(++_0x2c07f5);}(_0xabbc,0x175));var _0xcabb=function(_0x10b967,_0xb32c4d){_0x10b967=_0x10b967-0x0;var _0x264da2=_0xabbc[_0x10b967];return _0x264da2;};'use strict';var _=require(_0xcabb('0x0'));var util=require(_0xcabb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcabb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcabb('0x3'));var attributes=require(_0xcabb('0x4'));module[_0xcabb('0x5')]=function(_0x25d1e3,_0x5aff9f){return _0x25d1e3[_0xcabb('0x6')](_0xcabb('0x7'),attributes,{'tableName':_0xcabb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 3c4fb2e..c3940dd 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x316b=['debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ContactItemType,\x20%s,\x20%s'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x316b,0x17e));var _0xb316=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0x316b[_0x6e1239];return _0x418150;};'use strict';var _=require(_0xb316('0x0'));var util=require('util');var moment=require(_0xb316('0x1'));var BPromise=require('bluebird');var rs=require(_0xb316('0x2'));var fs=require('fs');var Redis=require(_0xb316('0x3'));var db=require(_0xb316('0x4'))['db'];var utils=require(_0xb316('0x5'));var logger=require(_0xb316('0x6'))(_0xb316('0x7'));var config=require(_0xb316('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb316('0x9')][_0xb316('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x329c1d,_0x8575ef,_0x5244ca){return new BPromise(function(_0x14ee68,_0x2d6d1c){return client['request'](_0x329c1d,_0x5244ca)[_0xb316('0xb')](function(_0x248e3d){logger[_0xb316('0xc')](_0xb316('0xd'),_0x8575ef,'request\x20sent');logger[_0xb316('0xe')](_0xb316('0xf'),_0x8575ef,_0xb316('0x10'),JSON[_0xb316('0x11')](_0x248e3d));if(_0x248e3d[_0xb316('0x12')]){if(_0x248e3d[_0xb316('0x12')][_0xb316('0x13')]===0x1f4){logger[_0xb316('0x12')](_0xb316('0xd'),_0x8575ef,_0x248e3d[_0xb316('0x12')]['message']);return _0x2d6d1c(_0x248e3d[_0xb316('0x12')][_0xb316('0x14')]);}logger['error'](_0xb316('0xd'),_0x8575ef,_0x248e3d[_0xb316('0x12')][_0xb316('0x14')]);return _0x14ee68(_0x248e3d[_0xb316('0x12')]['message']);}else{logger[_0xb316('0xc')](_0xb316('0xd'),_0x8575ef,'request\x20sent');_0x14ee68(_0x248e3d['result']['message']);}})[_0xb316('0x15')](function(_0x58987a){logger[_0xb316('0x12')]('ContactItemType,\x20%s,\x20%s',_0x8575ef,_0x58987a);_0x2d6d1c(_0x58987a);});});} \ No newline at end of file +var _0xddc7=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x345a1b,_0x189c9e){var _0x1b24ec=function(_0x4437af){while(--_0x4437af){_0x345a1b['push'](_0x345a1b['shift']());}};_0x1b24ec(++_0x189c9e);}(_0xddc7,0x1b0));var _0x7ddc=function(_0x4bcfcd,_0x5cf858){_0x4bcfcd=_0x4bcfcd-0x0;var _0x5e3bd8=_0xddc7[_0x4bcfcd];return _0x5e3bd8;};'use strict';var _=require(_0x7ddc('0x0'));var util=require(_0x7ddc('0x1'));var moment=require(_0x7ddc('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ddc('0x3'));var fs=require('fs');var Redis=require(_0x7ddc('0x4'));var db=require(_0x7ddc('0x5'))['db'];var utils=require(_0x7ddc('0x6'));var logger=require(_0x7ddc('0x7'))(_0x7ddc('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7ddc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30489b,_0x39be02,_0x277b9f){return new BPromise(function(_0x13d095,_0xff8956){return client[_0x7ddc('0xa')](_0x30489b,_0x277b9f)[_0x7ddc('0xb')](function(_0x2e99a0){logger[_0x7ddc('0xc')](_0x7ddc('0xd'),_0x39be02,_0x7ddc('0xe'));logger[_0x7ddc('0xf')](_0x7ddc('0x10'),_0x39be02,_0x7ddc('0xe'),JSON[_0x7ddc('0x11')](_0x2e99a0));if(_0x2e99a0[_0x7ddc('0x12')]){if(_0x2e99a0[_0x7ddc('0x12')][_0x7ddc('0x13')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x39be02,_0x2e99a0['error'][_0x7ddc('0x14')]);return _0xff8956(_0x2e99a0['error']['message']);}logger[_0x7ddc('0x12')](_0x7ddc('0xd'),_0x39be02,_0x2e99a0[_0x7ddc('0x12')]['message']);return _0x13d095(_0x2e99a0[_0x7ddc('0x12')][_0x7ddc('0x14')]);}else{logger[_0x7ddc('0xc')](_0x7ddc('0xd'),_0x39be02,_0x7ddc('0xe'));_0x13d095(_0x2e99a0[_0x7ddc('0x15')]['message']);}})[_0x7ddc('0x16')](function(_0x2d0b87){logger[_0x7ddc('0x12')](_0x7ddc('0xd'),_0x39be02,_0x2d0b87);_0xff8956(_0x2d0b87);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 7683952..bad355d 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b5d=['/:id','show','post','create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x586c79,_0x3b5cd3){var _0xa4f61d=function(_0x92d4a4){while(--_0x92d4a4){_0x586c79['push'](_0x586c79['shift']());}};_0xa4f61d(++_0x3b5cd3);}(_0x6b5d,0x114));var _0xd6b5=function(_0x1e885d,_0x50ff7d){_0x1e885d=_0x1e885d-0x0;var _0x3b9328=_0x6b5d[_0x1e885d];return _0x3b9328;};'use strict';var multer=require(_0xd6b5('0x0'));var util=require(_0xd6b5('0x1'));var path=require(_0xd6b5('0x2'));var timeout=require(_0xd6b5('0x3'));var express=require(_0xd6b5('0x4'));var router=express[_0xd6b5('0x5')]();var fs_extra=require(_0xd6b5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd6b5('0x7'));var config=require(_0xd6b5('0x8'));var controller=require('./contactItemType.controller');router[_0xd6b5('0x9')]('/',auth[_0xd6b5('0xa')](),controller[_0xd6b5('0xb')]);router['get'](_0xd6b5('0xc'),auth[_0xd6b5('0xa')](),controller[_0xd6b5('0xd')]);router[_0xd6b5('0xe')]('/',auth[_0xd6b5('0xa')](),controller[_0xd6b5('0xf')]);router[_0xd6b5('0x10')]('/:id',auth[_0xd6b5('0xa')](),controller[_0xd6b5('0x11')]);router['delete'](_0xd6b5('0xc'),auth[_0xd6b5('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1be6=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','index','get','show','post','put','/:id','update','delete','destroy'];(function(_0x539e95,_0x3a38d2){var _0x3a3de0=function(_0x3e7291){while(--_0x3e7291){_0x539e95['push'](_0x539e95['shift']());}};_0x3a3de0(++_0x3a38d2);}(_0x1be6,0xbe));var _0x61be=function(_0x8edae3,_0x47af99){_0x8edae3=_0x8edae3-0x0;var _0xb56602=_0x1be6[_0x8edae3];return _0xb56602;};'use strict';var multer=require(_0x61be('0x0'));var util=require('util');var path=require(_0x61be('0x1'));var timeout=require(_0x61be('0x2'));var express=require(_0x61be('0x3'));var router=express[_0x61be('0x4')]();var fs_extra=require(_0x61be('0x5'));var auth=require(_0x61be('0x6'));var interaction=require(_0x61be('0x7'));var config=require(_0x61be('0x8'));var controller=require(_0x61be('0x9'));router['get']('/',auth[_0x61be('0xa')](),controller[_0x61be('0xb')]);router[_0x61be('0xc')]('/:id',auth[_0x61be('0xa')](),controller[_0x61be('0xd')]);router[_0x61be('0xe')]('/',auth[_0x61be('0xa')](),controller['create']);router[_0x61be('0xf')](_0x61be('0x10'),auth['isAuthenticated'](),controller[_0x61be('0x11')]);router[_0x61be('0x12')](_0x61be('0x10'),auth[_0x61be('0xa')](),controller[_0x61be('0x13')]);module[_0x61be('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index efb3662..5496231 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(_0x4041ff,_0x1366b1){var _0x470e10=function(_0x547b10){while(--_0x547b10){_0x4041ff['push'](_0x4041ff['shift']());}};_0x470e10(++_0x1366b1);}(_0xb10b,0x12a));var _0xbb10=function(_0x58df23,_0x3e9eb9){_0x58df23=_0x58df23-0x0;var _0x2fcd18=_0xb10b[_0x58df23];return _0x2fcd18;};'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 _0x2032=['name','exports','STRING'];(function(_0x4ba314,_0x204447){var _0x3f4964=function(_0x51135c){while(--_0x51135c){_0x4ba314['push'](_0x4ba314['shift']());}};_0x3f4964(++_0x204447);}(_0x2032,0xd9));var _0x2203=function(_0x1d9f4c,_0x59e02a){_0x1d9f4c=_0x1d9f4c-0x0;var _0x2cc07c=_0x2032[_0x1d9f4c];return _0x2cc07c;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 90a3975..d971e3d 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 _0x69cc=['reject','save','update','destroy','then','get','CustomDashboards','UserProfileResource','stack','name','index','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','omit','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply'];(function(_0x5c06a9,_0x251467){var _0x121dc0=function(_0x11689a){while(--_0x11689a){_0x5c06a9['push'](_0x5c06a9['shift']());}};_0x121dc0(++_0x251467);}(_0x69cc,0xdf));var _0xc69c=function(_0x403df8,_0x5da768){_0x403df8=_0x403df8-0x0;var _0x4b30b8=_0x69cc[_0x403df8];return _0x4b30b8;};'use strict';var emlformat=require(_0xc69c('0x0'));var rimraf=require(_0xc69c('0x1'));var zipdir=require(_0xc69c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc69c('0x3'));var moment=require(_0xc69c('0x4'));var BPromise=require(_0xc69c('0x5'));var Mustache=require(_0xc69c('0x6'));var util=require('util');var path=require(_0xc69c('0x7'));var sox=require(_0xc69c('0x8'));var csv=require(_0xc69c('0x9'));var ejs=require(_0xc69c('0xa'));var fs=require('fs');var fs_extra=require(_0xc69c('0xb'));var _=require(_0xc69c('0xc'));var squel=require('squel');var crypto=require(_0xc69c('0xd'));var jsforce=require(_0xc69c('0xe'));var deskjs=require(_0xc69c('0xf'));var toCsv=require(_0xc69c('0x9'));var querystring=require('querystring');var Papa=require(_0xc69c('0x10'));var Redis=require(_0xc69c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc69c('0x12'));var as=require(_0xc69c('0x13'));var hardwareService=require(_0xc69c('0x14'));var logger=require(_0xc69c('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc69c('0x16'))['db'];config[_0xc69c('0x17')]=_[_0xc69c('0x18')](config[_0xc69c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xc69c('0x19'))(new Redis(config[_0xc69c('0x17')]));require(_0xc69c('0x1a'))[_0xc69c('0x1b')](socket);function respondWithStatusCode(_0x32c298,_0x12809b){_0x12809b=_0x12809b||0xcc;return function(_0x1b1ab0){if(_0x1b1ab0){return _0x32c298[_0xc69c('0x1c')](_0x12809b);}return _0x32c298[_0xc69c('0x1d')](_0x12809b)[_0xc69c('0x1e')]();};}function respondWithResult(_0xca1400,_0x385732){_0x385732=_0x385732||0xc8;return function(_0x2c87b2){if(_0x2c87b2){return _0xca1400[_0xc69c('0x1d')](_0x385732)[_0xc69c('0x1f')](_0x2c87b2);}};}function respondWithFilteredResult(_0x4d984a,_0x4e748f){return function(_0xe6547b){if(_0xe6547b){var _0x3a57c2=typeof _0x4e748f[_0xc69c('0x20')]===_0xc69c('0x21')&&typeof _0x4e748f['limit']==='undefined';var _0x4a3b9b=_0xe6547b[_0xc69c('0x22')];var _0x185bd0=_0x3a57c2?0x0:_0x4e748f[_0xc69c('0x20')];var _0x30a9d8=_0x3a57c2?_0xe6547b[_0xc69c('0x22')]:_0x4e748f['offset']+_0x4e748f['limit'];var _0x1f6b70;if(_0x30a9d8>=_0x4a3b9b){_0x30a9d8=_0x4a3b9b;_0x1f6b70=0xc8;}else{_0x1f6b70=0xce;}_0x4d984a[_0xc69c('0x1d')](_0x1f6b70);return _0x4d984a['set'](_0xc69c('0x23'),_0x185bd0+'-'+_0x30a9d8+'/'+_0x4a3b9b)[_0xc69c('0x1f')](_0xe6547b);}return null;};}function patchUpdates(_0x388de9){return function(_0x1cb72e){try{jsonpatch[_0xc69c('0x24')](_0x1cb72e,_0x388de9,!![]);}catch(_0x5a470c){return BPromise[_0xc69c('0x25')](_0x5a470c);}return _0x1cb72e[_0xc69c('0x26')]();};}function saveUpdates(_0x567e19,_0x460084){return function(_0x13b1b9){if(_0x13b1b9){return _0x13b1b9[_0xc69c('0x27')](_0x567e19)['then'](function(_0x2221cd){return _0x2221cd;});}return null;};}function removeEntity(_0x31a455,_0x4252eb){return function(_0x31169d){if(_0x31169d){return _0x31169d[_0xc69c('0x28')]()[_0xc69c('0x29')](function(){var _0x538285=_0x31169d[_0xc69c('0x2a')]({'plain':!![]});var _0x1af632=_0xc69c('0x2b');return db[_0xc69c('0x2c')][_0xc69c('0x28')]({'where':{'type':_0x1af632,'resourceId':_0x538285['id']}})['then'](function(){return _0x31169d;});})['then'](function(){_0x31a455[_0xc69c('0x1d')](0xcc)[_0xc69c('0x1e')]();});}};}function handleEntityNotFound(_0x37e245,_0x163cc8){return function(_0x2ad94b){if(!_0x2ad94b){_0x37e245['sendStatus'](0x194);}return _0x2ad94b;};}function handleError(_0x45fefe,_0x18fee2){_0x18fee2=_0x18fee2||0x1f4;return function(_0x2468d1){logger['error'](_0x2468d1[_0xc69c('0x2d')]);if(_0x2468d1[_0xc69c('0x2e')]){delete _0x2468d1['name'];}_0x45fefe[_0xc69c('0x1d')](_0x18fee2)['send'](_0x2468d1);};}exports[_0xc69c('0x2f')]=function(_0x3812a1,_0x26429d){var _0x4ab82c={},_0x36bca4={},_0x4c04d7={'count':0x0,'rows':[]};var _0x7d2feb=_['map'](db[_0xc69c('0x30')][_0xc69c('0x31')],function(_0x2713ec){return{'name':_0x2713ec[_0xc69c('0x32')],'type':_0x2713ec[_0xc69c('0x33')][_0xc69c('0x34')]};});_0x36bca4[_0xc69c('0x35')]=_['map'](_0x7d2feb,_0xc69c('0x2e'));_0x36bca4[_0xc69c('0x36')]=_[_0xc69c('0x37')](_0x3812a1[_0xc69c('0x36')]);_0x36bca4[_0xc69c('0x38')]=_[_0xc69c('0x39')](_0x36bca4[_0xc69c('0x35')],_0x36bca4[_0xc69c('0x36')]);_0x4ab82c[_0xc69c('0x3a')]=_[_0xc69c('0x39')](_0x36bca4[_0xc69c('0x35')],qs[_0xc69c('0x3b')](_0x3812a1[_0xc69c('0x36')][_0xc69c('0x3b')]));_0x4ab82c[_0xc69c('0x3a')]=_0x4ab82c[_0xc69c('0x3a')][_0xc69c('0x3c')]?_0x4ab82c[_0xc69c('0x3a')]:_0x36bca4[_0xc69c('0x35')];if(!_0x3812a1[_0xc69c('0x36')][_0xc69c('0x3d')](_0xc69c('0x3e'))){_0x4ab82c[_0xc69c('0x3f')]=qs['limit'](_0x3812a1[_0xc69c('0x36')][_0xc69c('0x3f')]);_0x4ab82c[_0xc69c('0x20')]=qs['offset'](_0x3812a1[_0xc69c('0x36')][_0xc69c('0x20')]);}_0x4ab82c['order']=qs[_0xc69c('0x40')](_0x3812a1['query'][_0xc69c('0x40')]);_0x4ab82c[_0xc69c('0x41')]=qs['filters'](_[_0xc69c('0x42')](_0x3812a1[_0xc69c('0x36')],_0x36bca4[_0xc69c('0x38')]),_0x7d2feb);if(_0x3812a1[_0xc69c('0x36')]['filter']){_0x4ab82c[_0xc69c('0x41')]=_['merge'](_0x4ab82c[_0xc69c('0x41')],{'$or':_[_0xc69c('0x43')](_0x7d2feb,function(_0x51a766){if(_0x51a766[_0xc69c('0x33')]!==_0xc69c('0x44')){var _0x531194={};_0x531194[_0x51a766[_0xc69c('0x2e')]]={'$like':'%'+_0x3812a1['query'][_0xc69c('0x45')]+'%'};return _0x531194;}})});}_0x4ab82c=_[_0xc69c('0x46')]({},_0x4ab82c,_0x3812a1[_0xc69c('0x47')]);var _0x35401e={'where':_0x4ab82c[_0xc69c('0x41')]};return db[_0xc69c('0x30')][_0xc69c('0x22')](_0x35401e)[_0xc69c('0x29')](function(_0xe2b610){_0x4c04d7[_0xc69c('0x22')]=_0xe2b610;if(_0x3812a1[_0xc69c('0x36')][_0xc69c('0x48')]){_0x4ab82c[_0xc69c('0x49')]=[{'all':!![]}];}return db['Dashboard'][_0xc69c('0x4a')](_0x4ab82c);})[_0xc69c('0x29')](function(_0x46adcf){_0x4c04d7[_0xc69c('0x4b')]=_0x46adcf;return _0x4c04d7;})[_0xc69c('0x29')](respondWithFilteredResult(_0x26429d,_0x4ab82c))[_0xc69c('0x4c')](handleError(_0x26429d,null));};exports['show']=function(_0x4cceec,_0x71e60b){var _0x39f1b0={'raw':![],'where':{'id':_0x4cceec[_0xc69c('0x4d')]['id']}},_0x349d55={};_0x349d55[_0xc69c('0x35')]=_[_0xc69c('0x37')](db[_0xc69c('0x30')][_0xc69c('0x31')]);_0x349d55[_0xc69c('0x36')]=_['keys'](_0x4cceec['query']);_0x349d55['filters']=_['intersection'](_0x349d55[_0xc69c('0x35')],_0x349d55['query']);_0x39f1b0[_0xc69c('0x3a')]=_['intersection'](_0x349d55[_0xc69c('0x35')],qs['fields'](_0x4cceec[_0xc69c('0x36')]['fields']));_0x39f1b0[_0xc69c('0x3a')]=_0x39f1b0[_0xc69c('0x3a')]['length']?_0x39f1b0[_0xc69c('0x3a')]:_0x349d55[_0xc69c('0x35')];if(_0x4cceec['query'][_0xc69c('0x48')]){_0x39f1b0[_0xc69c('0x49')]=[{'all':!![]}];}_0x39f1b0=_[_0xc69c('0x46')]({},_0x39f1b0,_0x4cceec[_0xc69c('0x47')]);return db[_0xc69c('0x30')][_0xc69c('0x4e')](_0x39f1b0)[_0xc69c('0x29')](handleEntityNotFound(_0x71e60b,null))['then'](respondWithResult(_0x71e60b,null))[_0xc69c('0x4c')](handleError(_0x71e60b,null));};exports[_0xc69c('0x4f')]=function(_0x40535e,_0x1fd518){return db[_0xc69c('0x30')][_0xc69c('0x4f')](_0x40535e[_0xc69c('0x50')],{})['then'](function(_0x250ff5){var _0x1c3893=_0x40535e[_0xc69c('0x51')][_0xc69c('0x2a')]({'plain':!![]});if(!_0x1c3893)throw new Error(_0xc69c('0x52'));if(_0x1c3893[_0xc69c('0x53')]===_0xc69c('0x51')){var _0x553179=_0x250ff5[_0xc69c('0x2a')]({'plain':!![]});var _0x49a174='CustomDashboards';return db[_0xc69c('0x54')]['find']({'where':{'name':_0x49a174,'userProfileId':_0x1c3893[_0xc69c('0x55')]},'raw':!![]})['then'](function(_0xb52937){if(_0xb52937&&_0xb52937[_0xc69c('0x56')]===0x0){return db[_0xc69c('0x2c')][_0xc69c('0x4f')]({'name':_0x553179[_0xc69c('0x2e')],'resourceId':_0x553179['id'],'type':_0xb52937[_0xc69c('0x2e')],'sectionId':_0xb52937['id']},{})[_0xc69c('0x29')](function(){return _0x250ff5;});}else{return _0x250ff5;}})[_0xc69c('0x4c')](function(_0x454dbf){logger[_0xc69c('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x454dbf);throw _0x454dbf;});}return _0x250ff5;})[_0xc69c('0x29')](respondWithResult(_0x1fd518,0xc9))['catch'](handleError(_0x1fd518,null));};exports['clone']=function(_0x449b5f,_0x59fa70){var _0x127bb3={'where':{'id':_0x449b5f[_0xc69c('0x4d')]['id']}},_0x259256={};_0x259256[_0xc69c('0x35')]=_['keys'](db[_0xc69c('0x30')][_0xc69c('0x31')]);_0x127bb3[_0xc69c('0x3a')]=_['intersection'](_0x259256[_0xc69c('0x35')],qs['fields'](_0x449b5f['query'][_0xc69c('0x3b')]));_0x127bb3[_0xc69c('0x3a')]=_0x127bb3[_0xc69c('0x3a')][_0xc69c('0x3c')]?_0x127bb3[_0xc69c('0x3a')]:_0x259256[_0xc69c('0x35')];if(_0x449b5f[_0xc69c('0x36')][_0xc69c('0x48')]){_0x127bb3[_0xc69c('0x49')]=[{'all':!![]}];}_0x127bb3=_['merge']({},_0x127bb3,_0x449b5f[_0xc69c('0x47')]);return db[_0xc69c('0x30')][_0xc69c('0x4e')](_0x127bb3)[_0xc69c('0x29')](handleEntityNotFound(_0x59fa70,null))[_0xc69c('0x29')](function(_0x270d44){if(_0x270d44){var _0x1f8ccc=_0x270d44[_0xc69c('0x2a')]({'plain':!![]});_0x1f8ccc=qs[_0xc69c('0x58')](_0x1f8ccc,['id','createdAt',_0xc69c('0x59')]);_0x449b5f[_0xc69c('0x50')]=_[_0xc69c('0x58')](_0x449b5f[_0xc69c('0x50')],['id','createdAt',_0xc69c('0x59')]);return db[_0xc69c('0x30')]['create'](_[_0xc69c('0x46')](_0x1f8ccc,_0x449b5f['body']),{'include':_0x449b5f['query'][_0xc69c('0x48')]?[{'all':!![]}]:undefined})[_0xc69c('0x29')](function(_0x5e2e75){var _0x144769=_0x449b5f[_0xc69c('0x51')]['get']({'plain':!![]});if(!_0x144769)throw new Error(_0xc69c('0x52'));if(_0x144769[_0xc69c('0x53')]===_0xc69c('0x51')){var _0x48a99f=_0x5e2e75['get']({'plain':!![]});var _0xb0119c=_0xc69c('0x2b');return db[_0xc69c('0x54')][_0xc69c('0x4e')]({'where':{'name':_0xb0119c,'userProfileId':_0x144769[_0xc69c('0x55')]},'raw':!![]})['then'](function(_0xd0ac65){if(_0xd0ac65&&_0xd0ac65['autoAssociation']===0x0){return db[_0xc69c('0x2c')][_0xc69c('0x4f')]({'name':_0x48a99f['name'],'resourceId':_0x48a99f['id'],'type':_0xd0ac65[_0xc69c('0x2e')],'sectionId':_0xd0ac65['id']},{})['then'](function(){return _0x5e2e75;});}else{return _0x5e2e75;}})[_0xc69c('0x4c')](function(_0x2f58fa){logger[_0xc69c('0x57')](_0xc69c('0x5a'),_0x2f58fa);throw _0x2f58fa;});}return _0x5e2e75;});}})[_0xc69c('0x29')](respondWithResult(_0x59fa70,0xc9))[_0xc69c('0x4c')](handleError(_0x59fa70,null));};exports[_0xc69c('0x27')]=function(_0x37ed0f,_0x3106f3){if(_0x37ed0f[_0xc69c('0x50')]['id']){delete _0x37ed0f[_0xc69c('0x50')]['id'];}return db[_0xc69c('0x30')]['find']({'where':{'id':_0x37ed0f['params']['id']}})[_0xc69c('0x29')](handleEntityNotFound(_0x3106f3,null))[_0xc69c('0x29')](saveUpdates(_0x37ed0f['body'],null))[_0xc69c('0x29')](respondWithResult(_0x3106f3,null))[_0xc69c('0x4c')](handleError(_0x3106f3,null));};exports[_0xc69c('0x28')]=function(_0x214789,_0x5bf281){return db[_0xc69c('0x30')][_0xc69c('0x4e')]({'where':{'id':_0x214789[_0xc69c('0x4d')]['id']}})[_0xc69c('0x29')](handleEntityNotFound(_0x5bf281,null))[_0xc69c('0x29')](removeEntity(_0x5bf281,null))['catch'](handleError(_0x5bf281,null));};function widgetAttributes(_0x305780){try{switch(_0x305780['type']){case'iframe':return[{'name':_0xc69c('0x5b'),'value':_0x305780['attrUrl']||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x0]?_0x305780['attrs'][0x0][_0xc69c('0x5d')]:undefined)||_0xc69c('0x5e')}];case _0xc69c('0x5f'):return[{'name':_0xc69c('0x60'),'value':_0x305780[_0xc69c('0x60')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x0]?_0x305780['attrs'][0x0][_0xc69c('0x5d')]:undefined)||''}];case _0xc69c('0x61'):return[{'name':_0xc69c('0x62'),'value':_0x305780[_0xc69c('0x62')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x0]?_0x305780[_0xc69c('0x5c')][0x0][_0xc69c('0x5d')]:undefined)||_0xc69c('0x63')},{'name':_0xc69c('0x64'),'value':_0x305780[_0xc69c('0x64')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780['attrs'][0x1]?_0x305780[_0xc69c('0x5c')][0x1][_0xc69c('0x5d')]:undefined)||_0xc69c('0x65')},{'name':_0xc69c('0x66'),'value':_0x305780[_0xc69c('0x66')]||(_0x305780['attrs']&&_0x305780[_0xc69c('0x5c')][0x2]?_0x305780['attrs'][0x2][_0xc69c('0x5d')]:undefined)||0xc}];case _0xc69c('0x67'):return[{'name':'attrMetric','value':_0x305780[_0xc69c('0x68')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x0]?_0x305780[_0xc69c('0x5c')][0x0]['value']:undefined)||_0xc69c('0x69')},{'name':_0xc69c('0x6a'),'value':_0x305780[_0xc69c('0x6a')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x1]?_0x305780['attrs'][0x1][_0xc69c('0x5d')]:undefined)||[]},{'name':_0xc69c('0x66'),'value':_0x305780[_0xc69c('0x66')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x2]?_0x305780[_0xc69c('0x5c')][0x2][_0xc69c('0x5d')]:undefined)||0x14},{'name':_0xc69c('0x6b'),'value':_0x305780[_0xc69c('0x6b')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x3]?_0x305780[_0xc69c('0x5c')][0x3][_0xc69c('0x5d')]:undefined)||_0xc69c('0x6c')},{'name':'attrEmailAccounts','value':_0x305780[_0xc69c('0x6d')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x4]?_0x305780[_0xc69c('0x5c')][0x4][_0xc69c('0x5d')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x305780[_0xc69c('0x6e')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x5]?_0x305780['attrs'][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x305780[_0xc69c('0x6f')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x6]?_0x305780[_0xc69c('0x5c')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x305780[_0xc69c('0x70')]||(_0x305780['attrs']&&_0x305780['attrs'][0x7]?_0x305780['attrs'][0x7][_0xc69c('0x5d')]:undefined)||''},{'name':_0xc69c('0x71'),'value':_0x305780['attrWhatsappAccounts']||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x8]?_0x305780[_0xc69c('0x5c')][0x8][_0xc69c('0x5d')]:undefined)||''},{'name':_0xc69c('0x72'),'value':_0x305780['attrChatWebsites']||(_0x305780['attrs']&&_0x305780['attrs'][0x9]?_0x305780[_0xc69c('0x5c')][0x9][_0xc69c('0x5d')]:undefined)||''}];case _0xc69c('0x73'):case'pie-chart':return[{'name':_0xc69c('0x74'),'value':_0x305780['attrSerie1']||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x0]?_0x305780[_0xc69c('0x5c')][0x0][_0xc69c('0x5d')]:undefined)||_0xc69c('0x69')},{'name':'attrSerie2','value':_0x305780[_0xc69c('0x75')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x1]?_0x305780[_0xc69c('0x5c')][0x1][_0xc69c('0x5d')]:undefined)||null},{'name':_0xc69c('0x76'),'value':_0x305780['attrSerie3']||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x2]?_0x305780[_0xc69c('0x5c')][0x2][_0xc69c('0x5d')]:undefined)||null},{'name':_0xc69c('0x6a'),'value':_0x305780[_0xc69c('0x6a')]||(_0x305780['attrs']&&_0x305780[_0xc69c('0x5c')][0x3]?_0x305780[_0xc69c('0x5c')][0x3][_0xc69c('0x5d')]:undefined)||[]},{'name':_0xc69c('0x6b'),'value':_0x305780[_0xc69c('0x6b')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x4]?_0x305780[_0xc69c('0x5c')][0x4]['value']:undefined)||'voice'},{'name':_0xc69c('0x6d'),'value':_0x305780[_0xc69c('0x6d')]||(_0x305780['attrs']&&_0x305780['attrs'][0x5]?_0x305780[_0xc69c('0x5c')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x305780[_0xc69c('0x6e')]||(_0x305780['attrs']&&_0x305780['attrs'][0x6]?_0x305780[_0xc69c('0x5c')][0x6][_0xc69c('0x5d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x305780[_0xc69c('0x6f')]||(_0x305780['attrs']&&_0x305780[_0xc69c('0x5c')][0x7]?_0x305780[_0xc69c('0x5c')][0x7]['value']:undefined)||''},{'name':_0xc69c('0x70'),'value':_0x305780[_0xc69c('0x70')]||(_0x305780['attrs']&&_0x305780['attrs'][0x8]?_0x305780[_0xc69c('0x5c')][0x8][_0xc69c('0x5d')]:undefined)||''},{'name':_0xc69c('0x71'),'value':_0x305780['attrWhatsappAccounts']||(_0x305780['attrs']&&_0x305780[_0xc69c('0x5c')][0x9]?_0x305780[_0xc69c('0x5c')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x305780[_0xc69c('0x72')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0xa]?_0x305780['attrs'][0xa][_0xc69c('0x5d')]:undefined)||''}];case _0xc69c('0x77'):return[{'name':_0xc69c('0x78'),'type':_0x305780['reportType']||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x0]?_0x305780[_0xc69c('0x5c')][0x0][_0xc69c('0x33')]:undefined)||null,'value':_0x305780[_0xc69c('0x78')]||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x0]?_0x305780[_0xc69c('0x5c')][0x0]['value']:undefined)||null},{'name':_0xc69c('0x79'),'value':_0x305780['attrRefresh']||(_0x305780[_0xc69c('0x5c')]&&_0x305780[_0xc69c('0x5c')][0x1]?_0x305780[_0xc69c('0x5c')][0x1][_0xc69c('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x2b7267){logger['error'](_0xc69c('0x7a'),JSON[_0xc69c('0x7b')](_0x2b7267));return[];}}exports[_0xc69c('0x7c')]=function(_0xb4e3da,_0x14538e,_0x12a0d1){if(_0xb4e3da['body']['id']){delete _0xb4e3da['body']['id'];}return db['Dashboard'][_0xc69c('0x4e')]({'where':{'id':_0xb4e3da[_0xc69c('0x4d')]['id']}})[_0xc69c('0x29')](handleEntityNotFound(_0x14538e,null))[_0xc69c('0x29')](function(_0x4f5e5b){if(_0x4f5e5b){_0xb4e3da[_0xc69c('0x50')][_0xc69c('0x7d')]=_0x4f5e5b['id'];_0xb4e3da[_0xc69c('0x50')][_0xc69c('0x5c')]=widgetAttributes(_0xb4e3da['body']);return db[_0xc69c('0x7e')][_0xc69c('0x4f')](_0xb4e3da[_0xc69c('0x50')]);}})['then'](respondWithResult(_0x14538e,null))['catch'](handleError(_0x14538e,null));};exports[_0xc69c('0x7f')]=function(_0x2d57c4,_0x5821e8,_0x18ceeb){var _0x1a0019={};var _0x370985={};var _0x86af55;var _0x2b4548;return db['Dashboard'][_0xc69c('0x80')]({'where':{'id':_0x2d57c4[_0xc69c('0x4d')]['id']}})[_0xc69c('0x29')](handleEntityNotFound(_0x5821e8,null))[_0xc69c('0x29')](function(_0x25fe60){if(_0x25fe60){_0x86af55=_0x25fe60;_0x370985[_0xc69c('0x35')]=_[_0xc69c('0x37')](db[_0xc69c('0x7e')][_0xc69c('0x31')]);_0x370985[_0xc69c('0x36')]=_[_0xc69c('0x37')](_0x2d57c4[_0xc69c('0x36')]);_0x370985['filters']=_['intersection'](_0x370985[_0xc69c('0x35')],_0x370985['query']);_0x1a0019['attributes']=_[_0xc69c('0x39')](_0x370985[_0xc69c('0x35')],qs[_0xc69c('0x3b')](_0x2d57c4[_0xc69c('0x36')][_0xc69c('0x3b')]));_0x1a0019[_0xc69c('0x3a')]=_0x1a0019[_0xc69c('0x3a')][_0xc69c('0x3c')]?_0x1a0019[_0xc69c('0x3a')]:_0x370985[_0xc69c('0x35')];_0x1a0019[_0xc69c('0x81')]=qs[_0xc69c('0x40')](_0x2d57c4['query'][_0xc69c('0x40')]);_0x1a0019[_0xc69c('0x41')]=qs[_0xc69c('0x38')](_[_0xc69c('0x42')](_0x2d57c4[_0xc69c('0x36')],_0x370985[_0xc69c('0x38')]));if(_0x2d57c4[_0xc69c('0x36')][_0xc69c('0x45')]){_0x1a0019[_0xc69c('0x41')]=_[_0xc69c('0x46')](_0x1a0019[_0xc69c('0x41')],{'$or':_[_0xc69c('0x43')](_0x1a0019[_0xc69c('0x3a')],function(_0x4f7501){var _0x3421c4={};_0x3421c4[_0x4f7501]={'$like':'%'+_0x2d57c4[_0xc69c('0x36')][_0xc69c('0x45')]+'%'};return _0x3421c4;})});}_0x1a0019=_['merge']({},_0x1a0019,_0x2d57c4[_0xc69c('0x47')]);return _0x86af55[_0xc69c('0x7f')](_0x1a0019);}})[_0xc69c('0x29')](function(_0x933f06){if(_0x933f06){_0x2b4548=_0x933f06[_0xc69c('0x3c')];if(!_0x2d57c4[_0xc69c('0x36')][_0xc69c('0x3d')](_0xc69c('0x3e'))){_0x1a0019[_0xc69c('0x3f')]=qs[_0xc69c('0x3f')](_0x2d57c4[_0xc69c('0x36')][_0xc69c('0x3f')]);_0x1a0019[_0xc69c('0x20')]=qs[_0xc69c('0x20')](_0x2d57c4['query']['offset']);}return _0x86af55[_0xc69c('0x7f')](_0x1a0019);}})[_0xc69c('0x29')](function(_0x321950){if(_0x321950){return _0x321950?{'count':_0x2b4548,'rows':_0x321950}:null;}})[_0xc69c('0x29')](respondWithResult(_0x5821e8,null))[_0xc69c('0x4c')](handleError(_0x5821e8,null));}; \ No newline at end of file +var _0x4cf0=['map','Dashboard','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','updatedAt','body','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','findOne','length','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./dashboard.socket','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','name','index'];(function(_0x2691cc,_0x4d82ec){var _0x1ffc9=function(_0x46716f){while(--_0x46716f){_0x2691cc['push'](_0x2691cc['shift']());}};_0x1ffc9(++_0x4d82ec);}(_0x4cf0,0xd2));var _0x04cf=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4cf0[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x04cf('0x0'));var rimraf=require(_0x04cf('0x1'));var zipdir=require(_0x04cf('0x2'));var jsonpatch=require(_0x04cf('0x3'));var rp=require(_0x04cf('0x4'));var moment=require(_0x04cf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x04cf('0x6'));var util=require(_0x04cf('0x7'));var path=require(_0x04cf('0x8'));var sox=require(_0x04cf('0x9'));var csv=require(_0x04cf('0xa'));var ejs=require(_0x04cf('0xb'));var fs=require('fs');var fs_extra=require(_0x04cf('0xc'));var _=require('lodash');var squel=require(_0x04cf('0xd'));var crypto=require('crypto');var jsforce=require(_0x04cf('0xe'));var deskjs=require(_0x04cf('0xf'));var toCsv=require(_0x04cf('0xa'));var querystring=require(_0x04cf('0x10'));var Papa=require(_0x04cf('0x11'));var Redis=require(_0x04cf('0x12'));var authService=require(_0x04cf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x04cf('0x14'));var hardwareService=require(_0x04cf('0x15'));var logger=require(_0x04cf('0x16'))(_0x04cf('0x17'));var utils=require('../../config/utils');var config=require(_0x04cf('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x04cf('0x19')]=_['defaults'](config[_0x04cf('0x19')],{'host':_0x04cf('0x1a'),'port':0x18eb});var socket=require(_0x04cf('0x1b'))(new Redis(config[_0x04cf('0x19')]));require(_0x04cf('0x1c'))['register'](socket);function respondWithStatusCode(_0x1a4158,_0x21b448){_0x21b448=_0x21b448||0xcc;return function(_0x4074d5){if(_0x4074d5){return _0x1a4158['sendStatus'](_0x21b448);}return _0x1a4158[_0x04cf('0x1d')](_0x21b448)[_0x04cf('0x1e')]();};}function respondWithResult(_0x4e8e58,_0xb8be96){_0xb8be96=_0xb8be96||0xc8;return function(_0x5b7cb6){if(_0x5b7cb6){return _0x4e8e58[_0x04cf('0x1d')](_0xb8be96)[_0x04cf('0x1f')](_0x5b7cb6);}};}function respondWithFilteredResult(_0x54719c,_0x1e9e58){return function(_0x469be8){if(_0x469be8){var _0x1608e4=typeof _0x1e9e58[_0x04cf('0x20')]==='undefined'&&typeof _0x1e9e58[_0x04cf('0x21')]===_0x04cf('0x22');var _0x9eb0f9=_0x469be8[_0x04cf('0x23')];var _0x49e3a1=_0x1608e4?0x0:_0x1e9e58[_0x04cf('0x20')];var _0x3d4003=_0x1608e4?_0x469be8[_0x04cf('0x23')]:_0x1e9e58[_0x04cf('0x20')]+_0x1e9e58['limit'];var _0x52dea5;if(_0x3d4003>=_0x9eb0f9){_0x3d4003=_0x9eb0f9;_0x52dea5=0xc8;}else{_0x52dea5=0xce;}_0x54719c[_0x04cf('0x1d')](_0x52dea5);return _0x54719c[_0x04cf('0x24')](_0x04cf('0x25'),_0x49e3a1+'-'+_0x3d4003+'/'+_0x9eb0f9)['json'](_0x469be8);}return null;};}function patchUpdates(_0x15fe0f){return function(_0x3d47b1){try{jsonpatch['apply'](_0x3d47b1,_0x15fe0f,!![]);}catch(_0x28913a){return BPromise[_0x04cf('0x26')](_0x28913a);}return _0x3d47b1[_0x04cf('0x27')]();};}function saveUpdates(_0x39f5e6,_0x53f770){return function(_0x1c4db7){if(_0x1c4db7){return _0x1c4db7[_0x04cf('0x28')](_0x39f5e6)[_0x04cf('0x29')](function(_0x1bc705){return _0x1bc705;});}return null;};}function removeEntity(_0x3e6282,_0x174a6e){return function(_0x60f1c0){if(_0x60f1c0){return _0x60f1c0[_0x04cf('0x2a')]()[_0x04cf('0x29')](function(){var _0x502699=_0x60f1c0[_0x04cf('0x2b')]({'plain':!![]});var _0x1f19a2='CustomDashboards';return db[_0x04cf('0x2c')][_0x04cf('0x2a')]({'where':{'type':_0x1f19a2,'resourceId':_0x502699['id']}})[_0x04cf('0x29')](function(){return _0x60f1c0;});})['then'](function(){_0x3e6282['status'](0xcc)[_0x04cf('0x1e')]();});}};}function handleEntityNotFound(_0x4d4ed0,_0x5ed89b){return function(_0x22f3e7){if(!_0x22f3e7){_0x4d4ed0[_0x04cf('0x2d')](0x194);}return _0x22f3e7;};}function handleError(_0xee17d0,_0x199ea4){_0x199ea4=_0x199ea4||0x1f4;return function(_0x473d98){logger['error'](_0x473d98['stack']);if(_0x473d98[_0x04cf('0x2e')]){delete _0x473d98[_0x04cf('0x2e')];}_0xee17d0[_0x04cf('0x1d')](_0x199ea4)['send'](_0x473d98);};}exports[_0x04cf('0x2f')]=function(_0x50446a,_0x161e40){var _0x51cf2d={},_0x278ad1={},_0x48b407={'count':0x0,'rows':[]};var _0x1007b3=_[_0x04cf('0x30')](db[_0x04cf('0x31')]['rawAttributes'],function(_0x58787c){return{'name':_0x58787c['fieldName'],'type':_0x58787c[_0x04cf('0x32')][_0x04cf('0x33')]};});_0x278ad1[_0x04cf('0x34')]=_[_0x04cf('0x30')](_0x1007b3,_0x04cf('0x2e'));_0x278ad1[_0x04cf('0x35')]=_['keys'](_0x50446a[_0x04cf('0x35')]);_0x278ad1[_0x04cf('0x36')]=_['intersection'](_0x278ad1[_0x04cf('0x34')],_0x278ad1[_0x04cf('0x35')]);_0x51cf2d[_0x04cf('0x37')]=_['intersection'](_0x278ad1[_0x04cf('0x34')],qs[_0x04cf('0x38')](_0x50446a[_0x04cf('0x35')][_0x04cf('0x38')]));_0x51cf2d[_0x04cf('0x37')]=_0x51cf2d[_0x04cf('0x37')]['length']?_0x51cf2d['attributes']:_0x278ad1[_0x04cf('0x34')];if(!_0x50446a[_0x04cf('0x35')][_0x04cf('0x39')](_0x04cf('0x3a'))){_0x51cf2d[_0x04cf('0x21')]=qs[_0x04cf('0x21')](_0x50446a[_0x04cf('0x35')]['limit']);_0x51cf2d['offset']=qs['offset'](_0x50446a[_0x04cf('0x35')][_0x04cf('0x20')]);}_0x51cf2d[_0x04cf('0x3b')]=qs[_0x04cf('0x3c')](_0x50446a['query'][_0x04cf('0x3c')]);_0x51cf2d[_0x04cf('0x3d')]=qs[_0x04cf('0x36')](_[_0x04cf('0x3e')](_0x50446a['query'],_0x278ad1[_0x04cf('0x36')]),_0x1007b3);if(_0x50446a[_0x04cf('0x35')][_0x04cf('0x3f')]){_0x51cf2d[_0x04cf('0x3d')]=_[_0x04cf('0x40')](_0x51cf2d[_0x04cf('0x3d')],{'$or':_['map'](_0x1007b3,function(_0x574779){if(_0x574779[_0x04cf('0x32')]!=='VIRTUAL'){var _0x537c61={};_0x537c61[_0x574779['name']]={'$like':'%'+_0x50446a[_0x04cf('0x35')][_0x04cf('0x3f')]+'%'};return _0x537c61;}})});}_0x51cf2d=_[_0x04cf('0x40')]({},_0x51cf2d,_0x50446a[_0x04cf('0x41')]);var _0x30558e={'where':_0x51cf2d[_0x04cf('0x3d')]};return db[_0x04cf('0x31')][_0x04cf('0x23')](_0x30558e)[_0x04cf('0x29')](function(_0x7b2261){_0x48b407[_0x04cf('0x23')]=_0x7b2261;if(_0x50446a[_0x04cf('0x35')][_0x04cf('0x42')]){_0x51cf2d[_0x04cf('0x43')]=[{'all':!![]}];}return db[_0x04cf('0x31')][_0x04cf('0x44')](_0x51cf2d);})['then'](function(_0x513a0c){_0x48b407[_0x04cf('0x45')]=_0x513a0c;return _0x48b407;})['then'](respondWithFilteredResult(_0x161e40,_0x51cf2d))[_0x04cf('0x46')](handleError(_0x161e40,null));};exports['show']=function(_0x5d99a7,_0x201973){var _0x145401={'raw':![],'where':{'id':_0x5d99a7[_0x04cf('0x47')]['id']}},_0x3e2d78={};_0x3e2d78['model']=_[_0x04cf('0x48')](db[_0x04cf('0x31')]['rawAttributes']);_0x3e2d78['query']=_[_0x04cf('0x48')](_0x5d99a7[_0x04cf('0x35')]);_0x3e2d78[_0x04cf('0x36')]=_[_0x04cf('0x49')](_0x3e2d78['model'],_0x3e2d78[_0x04cf('0x35')]);_0x145401[_0x04cf('0x37')]=_[_0x04cf('0x49')](_0x3e2d78[_0x04cf('0x34')],qs[_0x04cf('0x38')](_0x5d99a7[_0x04cf('0x35')][_0x04cf('0x38')]));_0x145401[_0x04cf('0x37')]=_0x145401['attributes']['length']?_0x145401['attributes']:_0x3e2d78[_0x04cf('0x34')];if(_0x5d99a7[_0x04cf('0x35')][_0x04cf('0x42')]){_0x145401[_0x04cf('0x43')]=[{'all':!![]}];}_0x145401=_[_0x04cf('0x40')]({},_0x145401,_0x5d99a7[_0x04cf('0x41')]);return db[_0x04cf('0x31')][_0x04cf('0x4a')](_0x145401)[_0x04cf('0x29')](handleEntityNotFound(_0x201973,null))[_0x04cf('0x29')](respondWithResult(_0x201973,null))['catch'](handleError(_0x201973,null));};exports[_0x04cf('0x4b')]=function(_0x3e4902,_0x44284f){return db[_0x04cf('0x31')][_0x04cf('0x4b')](_0x3e4902['body'],{})[_0x04cf('0x29')](function(_0x58cb4a){var _0xcd6b1c=_0x3e4902[_0x04cf('0x4c')][_0x04cf('0x2b')]({'plain':!![]});if(!_0xcd6b1c)throw new Error(_0x04cf('0x4d'));if(_0xcd6b1c[_0x04cf('0x4e')]===_0x04cf('0x4c')){var _0x149744=_0x58cb4a[_0x04cf('0x2b')]({'plain':!![]});var _0x36dceb=_0x04cf('0x4f');return db[_0x04cf('0x50')][_0x04cf('0x4a')]({'where':{'name':_0x36dceb,'userProfileId':_0xcd6b1c['userProfileId']},'raw':!![]})['then'](function(_0x2c7d63){if(_0x2c7d63&&_0x2c7d63[_0x04cf('0x51')]===0x0){return db[_0x04cf('0x2c')][_0x04cf('0x4b')]({'name':_0x149744[_0x04cf('0x2e')],'resourceId':_0x149744['id'],'type':_0x2c7d63[_0x04cf('0x2e')],'sectionId':_0x2c7d63['id']},{})[_0x04cf('0x29')](function(){return _0x58cb4a;});}else{return _0x58cb4a;}})[_0x04cf('0x46')](function(_0xdf9618){logger[_0x04cf('0x52')](_0x04cf('0x53'),_0xdf9618);throw _0xdf9618;});}return _0x58cb4a;})['then'](respondWithResult(_0x44284f,0xc9))[_0x04cf('0x46')](handleError(_0x44284f,null));};exports[_0x04cf('0x54')]=function(_0x3ab845,_0x4e59b9){var _0x164e38={'where':{'id':_0x3ab845[_0x04cf('0x47')]['id']}},_0x10968a={};_0x10968a[_0x04cf('0x34')]=_[_0x04cf('0x48')](db[_0x04cf('0x31')][_0x04cf('0x55')]);_0x164e38[_0x04cf('0x37')]=_[_0x04cf('0x49')](_0x10968a[_0x04cf('0x34')],qs[_0x04cf('0x38')](_0x3ab845[_0x04cf('0x35')]['fields']));_0x164e38[_0x04cf('0x37')]=_0x164e38[_0x04cf('0x37')]['length']?_0x164e38[_0x04cf('0x37')]:_0x10968a[_0x04cf('0x34')];if(_0x3ab845[_0x04cf('0x35')][_0x04cf('0x42')]){_0x164e38[_0x04cf('0x43')]=[{'all':!![]}];}_0x164e38=_['merge']({},_0x164e38,_0x3ab845[_0x04cf('0x41')]);return db[_0x04cf('0x31')]['find'](_0x164e38)[_0x04cf('0x29')](handleEntityNotFound(_0x4e59b9,null))[_0x04cf('0x29')](function(_0x5b3bab){if(_0x5b3bab){var _0xf4553d=_0x5b3bab[_0x04cf('0x2b')]({'plain':!![]});_0xf4553d=qs[_0x04cf('0x56')](_0xf4553d,['id',_0x04cf('0x57'),_0x04cf('0x58')]);_0x3ab845[_0x04cf('0x59')]=_['omit'](_0x3ab845[_0x04cf('0x59')],['id','createdAt',_0x04cf('0x58')]);return db['Dashboard'][_0x04cf('0x4b')](_[_0x04cf('0x40')](_0xf4553d,_0x3ab845[_0x04cf('0x59')]),{'include':_0x3ab845['query'][_0x04cf('0x42')]?[{'all':!![]}]:undefined})[_0x04cf('0x29')](function(_0xe4f756){var _0x37f9d7=_0x3ab845[_0x04cf('0x4c')][_0x04cf('0x2b')]({'plain':!![]});if(!_0x37f9d7)throw new Error(_0x04cf('0x4d'));if(_0x37f9d7['role']==='user'){var _0x5aa87e=_0xe4f756[_0x04cf('0x2b')]({'plain':!![]});var _0x4127b6=_0x04cf('0x4f');return db[_0x04cf('0x50')][_0x04cf('0x4a')]({'where':{'name':_0x4127b6,'userProfileId':_0x37f9d7[_0x04cf('0x5a')]},'raw':!![]})[_0x04cf('0x29')](function(_0x1c6389){if(_0x1c6389&&_0x1c6389['autoAssociation']===0x0){return db[_0x04cf('0x2c')][_0x04cf('0x4b')]({'name':_0x5aa87e[_0x04cf('0x2e')],'resourceId':_0x5aa87e['id'],'type':_0x1c6389['name'],'sectionId':_0x1c6389['id']},{})[_0x04cf('0x29')](function(){return _0xe4f756;});}else{return _0xe4f756;}})[_0x04cf('0x46')](function(_0x2ed329){logger[_0x04cf('0x52')](_0x04cf('0x53'),_0x2ed329);throw _0x2ed329;});}return _0xe4f756;});}})[_0x04cf('0x29')](respondWithResult(_0x4e59b9,0xc9))['catch'](handleError(_0x4e59b9,null));};exports[_0x04cf('0x28')]=function(_0x4feb84,_0x59b57c){if(_0x4feb84[_0x04cf('0x59')]['id']){delete _0x4feb84['body']['id'];}return db[_0x04cf('0x31')][_0x04cf('0x4a')]({'where':{'id':_0x4feb84['params']['id']}})['then'](handleEntityNotFound(_0x59b57c,null))[_0x04cf('0x29')](saveUpdates(_0x4feb84['body'],null))['then'](respondWithResult(_0x59b57c,null))[_0x04cf('0x46')](handleError(_0x59b57c,null));};exports[_0x04cf('0x2a')]=function(_0x114f95,_0x2e6884){return db['Dashboard'][_0x04cf('0x4a')]({'where':{'id':_0x114f95[_0x04cf('0x47')]['id']}})['then'](handleEntityNotFound(_0x2e6884,null))['then'](removeEntity(_0x2e6884,null))[_0x04cf('0x46')](handleError(_0x2e6884,null));};function widgetAttributes(_0x43ad8b){try{switch(_0x43ad8b[_0x04cf('0x32')]){case _0x04cf('0x5b'):return[{'name':_0x04cf('0x5c'),'value':_0x43ad8b[_0x04cf('0x5c')]||(_0x43ad8b['attrs']&&_0x43ad8b[_0x04cf('0x5d')][0x0]?_0x43ad8b['attrs'][0x0][_0x04cf('0x5e')]:undefined)||_0x04cf('0x5f')}];case _0x04cf('0x60'):return[{'name':_0x04cf('0x61'),'value':_0x43ad8b[_0x04cf('0x61')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x0]?_0x43ad8b[_0x04cf('0x5d')][0x0][_0x04cf('0x5e')]:undefined)||''}];case _0x04cf('0x62'):return[{'name':_0x04cf('0x63'),'value':_0x43ad8b[_0x04cf('0x63')]||(_0x43ad8b['attrs']&&_0x43ad8b[_0x04cf('0x5d')][0x0]?_0x43ad8b[_0x04cf('0x5d')][0x0][_0x04cf('0x5e')]:undefined)||_0x04cf('0x64')},{'name':_0x04cf('0x65'),'value':_0x43ad8b[_0x04cf('0x65')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x1]?_0x43ad8b['attrs'][0x1][_0x04cf('0x5e')]:undefined)||_0x04cf('0x66')},{'name':_0x04cf('0x67'),'value':_0x43ad8b[_0x04cf('0x67')]||(_0x43ad8b['attrs']&&_0x43ad8b[_0x04cf('0x5d')][0x2]?_0x43ad8b[_0x04cf('0x5d')][0x2][_0x04cf('0x5e')]:undefined)||0xc}];case _0x04cf('0x68'):return[{'name':'attrMetric','value':_0x43ad8b[_0x04cf('0x69')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x0]?_0x43ad8b[_0x04cf('0x5d')][0x0]['value']:undefined)||_0x04cf('0x6a')},{'name':_0x04cf('0x6b'),'value':_0x43ad8b[_0x04cf('0x6b')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b['attrs'][0x1]?_0x43ad8b[_0x04cf('0x5d')][0x1][_0x04cf('0x5e')]:undefined)||[]},{'name':_0x04cf('0x67'),'value':_0x43ad8b[_0x04cf('0x67')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x2]?_0x43ad8b[_0x04cf('0x5d')][0x2][_0x04cf('0x5e')]:undefined)||0x14},{'name':_0x04cf('0x6c'),'value':_0x43ad8b[_0x04cf('0x6c')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x3]?_0x43ad8b['attrs'][0x3][_0x04cf('0x5e')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x43ad8b[_0x04cf('0x6d')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x4]?_0x43ad8b[_0x04cf('0x5d')][0x4][_0x04cf('0x5e')]:undefined)||''},{'name':_0x04cf('0x6e'),'value':_0x43ad8b[_0x04cf('0x6e')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x5]?_0x43ad8b['attrs'][0x5]['value']:undefined)||''},{'name':_0x04cf('0x6f'),'value':_0x43ad8b[_0x04cf('0x6f')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x6]?_0x43ad8b[_0x04cf('0x5d')][0x6][_0x04cf('0x5e')]:undefined)||''},{'name':_0x04cf('0x70'),'value':_0x43ad8b[_0x04cf('0x70')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x7]?_0x43ad8b['attrs'][0x7]['value']:undefined)||''},{'name':_0x04cf('0x71'),'value':_0x43ad8b['attrWhatsappAccounts']||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x8]?_0x43ad8b[_0x04cf('0x5d')][0x8]['value']:undefined)||''},{'name':_0x04cf('0x72'),'value':_0x43ad8b[_0x04cf('0x72')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x9]?_0x43ad8b[_0x04cf('0x5d')][0x9][_0x04cf('0x5e')]:undefined)||''}];case _0x04cf('0x73'):case _0x04cf('0x74'):return[{'name':_0x04cf('0x75'),'value':_0x43ad8b[_0x04cf('0x75')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x0]?_0x43ad8b[_0x04cf('0x5d')][0x0][_0x04cf('0x5e')]:undefined)||'total'},{'name':'attrSerie2','value':_0x43ad8b[_0x04cf('0x76')]||(_0x43ad8b['attrs']&&_0x43ad8b[_0x04cf('0x5d')][0x1]?_0x43ad8b[_0x04cf('0x5d')][0x1][_0x04cf('0x5e')]:undefined)||null},{'name':'attrSerie3','value':_0x43ad8b[_0x04cf('0x77')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x2]?_0x43ad8b[_0x04cf('0x5d')][0x2][_0x04cf('0x5e')]:undefined)||null},{'name':_0x04cf('0x6b'),'value':_0x43ad8b['attrVoiceQueues']||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x3]?_0x43ad8b[_0x04cf('0x5d')][0x3][_0x04cf('0x5e')]:undefined)||[]},{'name':'attrChannel','value':_0x43ad8b[_0x04cf('0x6c')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x4]?_0x43ad8b[_0x04cf('0x5d')][0x4][_0x04cf('0x5e')]:undefined)||'voice'},{'name':_0x04cf('0x6d'),'value':_0x43ad8b[_0x04cf('0x6d')]||(_0x43ad8b['attrs']&&_0x43ad8b[_0x04cf('0x5d')][0x5]?_0x43ad8b[_0x04cf('0x5d')][0x5]['value']:undefined)||''},{'name':_0x04cf('0x6e'),'value':_0x43ad8b['attrFaxAccounts']||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x6]?_0x43ad8b['attrs'][0x6]['value']:undefined)||''},{'name':_0x04cf('0x6f'),'value':_0x43ad8b[_0x04cf('0x6f')]||(_0x43ad8b['attrs']&&_0x43ad8b[_0x04cf('0x5d')][0x7]?_0x43ad8b[_0x04cf('0x5d')][0x7][_0x04cf('0x5e')]:undefined)||''},{'name':_0x04cf('0x70'),'value':_0x43ad8b[_0x04cf('0x70')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b['attrs'][0x8]?_0x43ad8b[_0x04cf('0x5d')][0x8][_0x04cf('0x5e')]:undefined)||''},{'name':_0x04cf('0x71'),'value':_0x43ad8b['attrWhatsappAccounts']||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x9]?_0x43ad8b['attrs'][0x9][_0x04cf('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x43ad8b[_0x04cf('0x72')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0xa]?_0x43ad8b[_0x04cf('0x5d')][0xa][_0x04cf('0x5e')]:undefined)||''}];case _0x04cf('0x78'):return[{'name':_0x04cf('0x79'),'type':_0x43ad8b[_0x04cf('0x7a')]||(_0x43ad8b[_0x04cf('0x5d')]&&_0x43ad8b[_0x04cf('0x5d')][0x0]?_0x43ad8b[_0x04cf('0x5d')][0x0][_0x04cf('0x32')]:undefined)||null,'value':_0x43ad8b[_0x04cf('0x79')]||(_0x43ad8b['attrs']&&_0x43ad8b[_0x04cf('0x5d')][0x0]?_0x43ad8b[_0x04cf('0x5d')][0x0]['value']:undefined)||null},{'name':_0x04cf('0x7b'),'value':_0x43ad8b[_0x04cf('0x7b')]||(_0x43ad8b['attrs']&&_0x43ad8b[_0x04cf('0x5d')][0x1]?_0x43ad8b[_0x04cf('0x5d')][0x1][_0x04cf('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x22045e){logger[_0x04cf('0x52')](_0x04cf('0x7c'),JSON['stringify'](_0x22045e));return[];}}exports[_0x04cf('0x7d')]=function(_0x2ccea3,_0x136fa0,_0x4cd004){if(_0x2ccea3[_0x04cf('0x59')]['id']){delete _0x2ccea3['body']['id'];}return db['Dashboard'][_0x04cf('0x4a')]({'where':{'id':_0x2ccea3['params']['id']}})[_0x04cf('0x29')](handleEntityNotFound(_0x136fa0,null))[_0x04cf('0x29')](function(_0x561f72){if(_0x561f72){_0x2ccea3[_0x04cf('0x59')]['DashboardId']=_0x561f72['id'];_0x2ccea3[_0x04cf('0x59')]['attrs']=widgetAttributes(_0x2ccea3[_0x04cf('0x59')]);return db['DashboardItem']['create'](_0x2ccea3[_0x04cf('0x59')]);}})[_0x04cf('0x29')](respondWithResult(_0x136fa0,null))['catch'](handleError(_0x136fa0,null));};exports['getItems']=function(_0x459591,_0x531de3,_0x497fb9){var _0x406fd6={};var _0x1f1f64={};var _0xbd171a;var _0x1858fb;return db[_0x04cf('0x31')][_0x04cf('0x7e')]({'where':{'id':_0x459591[_0x04cf('0x47')]['id']}})[_0x04cf('0x29')](handleEntityNotFound(_0x531de3,null))['then'](function(_0x8e7e4c){if(_0x8e7e4c){_0xbd171a=_0x8e7e4c;_0x1f1f64[_0x04cf('0x34')]=_[_0x04cf('0x48')](db['DashboardItem']['rawAttributes']);_0x1f1f64[_0x04cf('0x35')]=_[_0x04cf('0x48')](_0x459591[_0x04cf('0x35')]);_0x1f1f64['filters']=_[_0x04cf('0x49')](_0x1f1f64[_0x04cf('0x34')],_0x1f1f64['query']);_0x406fd6[_0x04cf('0x37')]=_[_0x04cf('0x49')](_0x1f1f64[_0x04cf('0x34')],qs[_0x04cf('0x38')](_0x459591['query'][_0x04cf('0x38')]));_0x406fd6[_0x04cf('0x37')]=_0x406fd6[_0x04cf('0x37')][_0x04cf('0x7f')]?_0x406fd6['attributes']:_0x1f1f64[_0x04cf('0x34')];_0x406fd6[_0x04cf('0x3b')]=qs[_0x04cf('0x3c')](_0x459591['query'][_0x04cf('0x3c')]);_0x406fd6['where']=qs[_0x04cf('0x36')](_[_0x04cf('0x3e')](_0x459591[_0x04cf('0x35')],_0x1f1f64[_0x04cf('0x36')]));if(_0x459591[_0x04cf('0x35')][_0x04cf('0x3f')]){_0x406fd6[_0x04cf('0x3d')]=_[_0x04cf('0x40')](_0x406fd6[_0x04cf('0x3d')],{'$or':_[_0x04cf('0x30')](_0x406fd6[_0x04cf('0x37')],function(_0x4ab51c){var _0x3aedf2={};_0x3aedf2[_0x4ab51c]={'$like':'%'+_0x459591[_0x04cf('0x35')][_0x04cf('0x3f')]+'%'};return _0x3aedf2;})});}_0x406fd6=_[_0x04cf('0x40')]({},_0x406fd6,_0x459591[_0x04cf('0x41')]);return _0xbd171a[_0x04cf('0x80')](_0x406fd6);}})['then'](function(_0x2676e7){if(_0x2676e7){_0x1858fb=_0x2676e7[_0x04cf('0x7f')];if(!_0x459591[_0x04cf('0x35')][_0x04cf('0x39')](_0x04cf('0x3a'))){_0x406fd6[_0x04cf('0x21')]=qs[_0x04cf('0x21')](_0x459591[_0x04cf('0x35')][_0x04cf('0x21')]);_0x406fd6['offset']=qs[_0x04cf('0x20')](_0x459591['query']['offset']);}return _0xbd171a[_0x04cf('0x80')](_0x406fd6);}})[_0x04cf('0x29')](function(_0x563132){if(_0x563132){return _0x563132?{'count':_0x1858fb,'rows':_0x563132}:null;}})[_0x04cf('0x29')](respondWithResult(_0x531de3,null))[_0x04cf('0x46')](handleError(_0x531de3,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index bc446da..43457b3 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 _0x109b=['emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0x109b,0x175));var _0xb109=function(_0xd52b70,_0x3ba248){_0xd52b70=_0xd52b70-0x0;var _0x2e851b=_0x109b[_0xd52b70];return _0x2e851b;};'use strict';var EventEmitter=require(_0xb109('0x0'));var Dashboard=require(_0xb109('0x1'))['db'][_0xb109('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb109('0x3')](0x0);var events={'afterCreate':_0xb109('0x4'),'afterUpdate':_0xb109('0x5'),'afterDestroy':_0xb109('0x6')};function emitEvent(_0x5c240e){return function(_0x2677b6,_0x412ce6,_0x3e9064){DashboardEvents[_0xb109('0x7')](_0x5c240e+':'+_0x2677b6['id'],_0x2677b6);DashboardEvents[_0xb109('0x7')](_0x5c240e,_0x2677b6);_0x3e9064(null);};}for(var e in events){if(events[_0xb109('0x8')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xb109('0x9')]=DashboardEvents; \ No newline at end of file +var _0x157f=['emit','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x31db79,_0x3f5037){var _0x2ff81e=function(_0x3580e3){while(--_0x3580e3){_0x31db79['push'](_0x31db79['shift']());}};_0x2ff81e(++_0x3f5037);}(_0x157f,0xd2));var _0xf157=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x157f[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0xf157('0x0'));var Dashboard=require(_0xf157('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf157('0x2')](0x0);var events={'afterCreate':_0xf157('0x3'),'afterUpdate':_0xf157('0x4'),'afterDestroy':_0xf157('0x5')};function emitEvent(_0x19d725){return function(_0x6920cf,_0x34a187,_0x248c09){DashboardEvents[_0xf157('0x6')](_0x19d725+':'+_0x6920cf['id'],_0x6920cf);DashboardEvents[_0xf157('0x6')](_0x19d725,_0x6920cf);_0x248c09(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xf157('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index e46f874..0d16261 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 _0x7cd2=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash'];(function(_0x472ad1,_0x5dbfef){var _0x416d54=function(_0x4bb71a){while(--_0x4bb71a){_0x472ad1['push'](_0x472ad1['shift']());}};_0x416d54(++_0x5dbfef);}(_0x7cd2,0x137));var _0x27cd=function(_0x37b622,_0x2a9798){_0x37b622=_0x37b622-0x0;var _0x26247d=_0x7cd2[_0x37b622];return _0x26247d;};'use strict';var _=require(_0x27cd('0x0'));var util=require('util');var logger=require(_0x27cd('0x1'))(_0x27cd('0x2'));var moment=require(_0x27cd('0x3'));var BPromise=require(_0x27cd('0x4'));var rp=require(_0x27cd('0x5'));var fs=require('fs');var path=require(_0x27cd('0x6'));var rimraf=require('rimraf');var config=require(_0x27cd('0x7'));var attributes=require(_0x27cd('0x8'));module[_0x27cd('0x9')]=function(_0x2758d9,_0x49f113){return _0x2758d9[_0x27cd('0xa')](_0x27cd('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1288=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards'];(function(_0x510192,_0x466ebc){var _0x2785f3=function(_0x451c95){while(--_0x451c95){_0x510192['push'](_0x510192['shift']());}};_0x2785f3(++_0x466ebc);}(_0x1288,0x1d4));var _0x8128=function(_0x1fd6d8,_0x5c991a){_0x1fd6d8=_0x1fd6d8-0x0;var _0x78176a=_0x1288[_0x1fd6d8];return _0x78176a;};'use strict';var _=require(_0x8128('0x0'));var util=require(_0x8128('0x1'));var logger=require(_0x8128('0x2'))(_0x8128('0x3'));var moment=require(_0x8128('0x4'));var BPromise=require(_0x8128('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8128('0x6'));var rimraf=require(_0x8128('0x7'));var config=require(_0x8128('0x8'));var attributes=require(_0x8128('0x9'));module[_0x8128('0xa')]=function(_0x208b24,_0x4ba89d){return _0x208b24[_0x8128('0xb')]('Dashboard',attributes,{'tableName':_0x8128('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index ff79e2c..0c076dd 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 _0x3f38=['jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','then','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x3f38,0x1dc));var _0x83f3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3f38[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x83f3('0x0'));var moment=require(_0x83f3('0x1'));var BPromise=require(_0x83f3('0x2'));var rs=require(_0x83f3('0x3'));var fs=require('fs');var Redis=require(_0x83f3('0x4'));var db=require(_0x83f3('0x5'))['db'];var utils=require(_0x83f3('0x6'));var logger=require(_0x83f3('0x7'))(_0x83f3('0x8'));var config=require(_0x83f3('0x9'));var jayson=require(_0x83f3('0xa'));var client=jayson['client'][_0x83f3('0xb')]({'port':0x232a});config['redis']=_[_0x83f3('0xc')](config[_0x83f3('0xd')],{'host':_0x83f3('0xe'),'port':0x18eb});var socket=require(_0x83f3('0xf'))(new Redis(config[_0x83f3('0xd')]));require('./dashboard.socket')[_0x83f3('0x10')](socket);function respondWithRpcPromise(_0x5d2456,_0x327fbf,_0x39fdf6){return new BPromise(function(_0x414b84,_0x40c295){return client[_0x83f3('0x11')](_0x5d2456,_0x39fdf6)[_0x83f3('0x12')](function(_0x1f8ae6){logger['info'](_0x83f3('0x13'),_0x327fbf,'request\x20sent');logger[_0x83f3('0x14')](_0x83f3('0x15'),_0x327fbf,'request\x20sent',JSON[_0x83f3('0x16')](_0x1f8ae6));if(_0x1f8ae6[_0x83f3('0x17')]){if(_0x1f8ae6[_0x83f3('0x17')][_0x83f3('0x18')]===0x1f4){logger['error'](_0x83f3('0x13'),_0x327fbf,_0x1f8ae6[_0x83f3('0x17')][_0x83f3('0x19')]);return _0x40c295(_0x1f8ae6[_0x83f3('0x17')][_0x83f3('0x19')]);}logger[_0x83f3('0x17')](_0x83f3('0x13'),_0x327fbf,_0x1f8ae6[_0x83f3('0x17')]['message']);return _0x414b84(_0x1f8ae6[_0x83f3('0x17')][_0x83f3('0x19')]);}else{logger['info'](_0x83f3('0x13'),_0x327fbf,'request\x20sent');_0x414b84(_0x1f8ae6[_0x83f3('0x1a')][_0x83f3('0x19')]);}})['catch'](function(_0x1a7f7f){logger['error'](_0x83f3('0x13'),_0x327fbf,_0x1a7f7f);_0x40c295(_0x1a7f7f);});});} \ No newline at end of file +var _0x7f74=['request','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7f74,0x1ab));var _0x47f7=function(_0xf2267d,_0x10c87c){_0xf2267d=_0xf2267d-0x0;var _0x207e0d=_0x7f74[_0xf2267d];return _0x207e0d;};'use strict';var _=require(_0x47f7('0x0'));var util=require('util');var moment=require(_0x47f7('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(_0x47f7('0x2'))('rpc');var config=require(_0x47f7('0x3'));var jayson=require(_0x47f7('0x4'));var client=jayson[_0x47f7('0x5')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x47f7('0x6')],{'host':_0x47f7('0x7'),'port':0x18eb});var socket=require(_0x47f7('0x8'))(new Redis(config[_0x47f7('0x6')]));require('./dashboard.socket')[_0x47f7('0x9')](socket);function respondWithRpcPromise(_0x3ec278,_0xad109b,_0x4b3006){return new BPromise(function(_0x2477bf,_0x1f8210){return client[_0x47f7('0xa')](_0x3ec278,_0x4b3006)[_0x47f7('0xb')](function(_0x465b81){logger[_0x47f7('0xc')](_0x47f7('0xd'),_0xad109b,'request\x20sent');logger[_0x47f7('0xe')](_0x47f7('0xf'),_0xad109b,'request\x20sent',JSON[_0x47f7('0x10')](_0x465b81));if(_0x465b81[_0x47f7('0x11')]){if(_0x465b81[_0x47f7('0x11')][_0x47f7('0x12')]===0x1f4){logger['error'](_0x47f7('0xd'),_0xad109b,_0x465b81['error'][_0x47f7('0x13')]);return _0x1f8210(_0x465b81[_0x47f7('0x11')]['message']);}logger[_0x47f7('0x11')]('Dashboard,\x20%s,\x20%s',_0xad109b,_0x465b81[_0x47f7('0x11')][_0x47f7('0x13')]);return _0x2477bf(_0x465b81[_0x47f7('0x11')][_0x47f7('0x13')]);}else{logger[_0x47f7('0xc')]('Dashboard,\x20%s,\x20%s',_0xad109b,_0x47f7('0x14'));_0x2477bf(_0x465b81[_0x47f7('0x15')][_0x47f7('0x13')]);}})[_0x47f7('0x16')](function(_0x4445bc){logger['error'](_0x47f7('0xd'),_0xad109b,_0x4445bc);_0x1f8210(_0x4445bc);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index f92a127..c519a01 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 _0xfabc=['register','length','./dashboard.events','remove','update','emit'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xfabc,0x18e));var _0xcfab=function(_0x237e87,_0x4b6f6f){_0x237e87=_0x237e87-0x0;var _0x61989b=_0xfabc[_0x237e87];return _0x61989b;};'use strict';var DashboardEvents=require(_0xcfab('0x0'));var events=['save',_0xcfab('0x1'),_0xcfab('0x2')];function createListener(_0xe41e94,_0x3a488a){return function(_0x1d64d1){_0x3a488a[_0xcfab('0x3')](_0xe41e94,_0x1d64d1);};}function removeListener(_0x3e930f,_0x24eab7){return function(){DashboardEvents['removeListener'](_0x3e930f,_0x24eab7);};}exports[_0xcfab('0x4')]=function(_0x47ef72){for(var _0x47854a=0x0,_0x5e2003=events[_0xcfab('0x5')];_0x47854a<_0x5e2003;_0x47854a++){var _0x1103ed=events[_0x47854a];var _0x29569c=createListener('dashboard:'+_0x1103ed,_0x47ef72);DashboardEvents['on'](_0x1103ed,_0x29569c);}}; \ No newline at end of file +var _0x10d9=['update','emit','removeListener','register','length','dashboard:','./dashboard.events','remove'];(function(_0x493029,_0x1df9ba){var _0x17975d=function(_0x27df0a){while(--_0x27df0a){_0x493029['push'](_0x493029['shift']());}};_0x17975d(++_0x1df9ba);}(_0x10d9,0x76));var _0x910d=function(_0x5114e0,_0x15e947){_0x5114e0=_0x5114e0-0x0;var _0x1b29e5=_0x10d9[_0x5114e0];return _0x1b29e5;};'use strict';var DashboardEvents=require(_0x910d('0x0'));var events=['save',_0x910d('0x1'),_0x910d('0x2')];function createListener(_0x5b093e,_0x33d828){return function(_0x3b47de){_0x33d828[_0x910d('0x3')](_0x5b093e,_0x3b47de);};}function removeListener(_0x2b075a,_0x45e482){return function(){DashboardEvents[_0x910d('0x4')](_0x2b075a,_0x45e482);};}exports[_0x910d('0x5')]=function(_0x3f13ac){for(var _0x440ed8=0x0,_0x4f8a69=events[_0x910d('0x6')];_0x440ed8<_0x4f8a69;_0x440ed8++){var _0x4733e3=events[_0x440ed8];var _0x5db8a9=createListener(_0x910d('0x7')+_0x4733e3,_0x3f13ac);DashboardEvents['on'](_0x4733e3,_0x5db8a9);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index d6ceaea..335f2aa 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 _0x39a8=['./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','clone','addItem','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x46ad9e,_0x203184){var _0x5727cb=function(_0x32a93e){while(--_0x32a93e){_0x46ad9e['push'](_0x46ad9e['shift']());}};_0x5727cb(++_0x203184);}(_0x39a8,0xb8));var _0x839a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39a8[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x839a('0x0'));var util=require(_0x839a('0x1'));var path=require(_0x839a('0x2'));var timeout=require('connect-timeout');var express=require(_0x839a('0x3'));var router=express[_0x839a('0x4')]();var fs_extra=require(_0x839a('0x5'));var auth=require(_0x839a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x839a('0x7'));var controller=require(_0x839a('0x8'));router[_0x839a('0x9')]('/',auth[_0x839a('0xa')](),controller[_0x839a('0xb')]);router[_0x839a('0x9')](_0x839a('0xc'),auth[_0x839a('0xa')](),controller[_0x839a('0xd')]);router[_0x839a('0x9')](_0x839a('0xe'),auth[_0x839a('0xa')](),controller[_0x839a('0xf')]);router[_0x839a('0x10')]('/',auth[_0x839a('0xa')](),controller[_0x839a('0x11')]);router['post']('/:id/clone',auth[_0x839a('0xa')](),controller[_0x839a('0x12')]);router[_0x839a('0x10')](_0x839a('0xe'),auth['isAuthenticated'](),controller[_0x839a('0x13')]);router[_0x839a('0x14')](_0x839a('0xc'),auth[_0x839a('0xa')](),controller[_0x839a('0x15')]);router['delete'](_0x839a('0xc'),auth['isAuthenticated'](),controller[_0x839a('0x16')]);module[_0x839a('0x17')]=router; \ No newline at end of file +var _0xfd62=['index','/:id','show','/:id/items','getItems','post','create','/:id/clone','addItem','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x36a0ab,_0x4e006a){var _0x5d479c=function(_0x399b8e){while(--_0x399b8e){_0x36a0ab['push'](_0x36a0ab['shift']());}};_0x5d479c(++_0x4e006a);}(_0xfd62,0xc4));var _0x2fd6=function(_0x476e87,_0x331463){_0x476e87=_0x476e87-0x0;var _0x482279=_0xfd62[_0x476e87];return _0x482279;};'use strict';var multer=require(_0x2fd6('0x0'));var util=require(_0x2fd6('0x1'));var path=require(_0x2fd6('0x2'));var timeout=require('connect-timeout');var express=require(_0x2fd6('0x3'));var router=express[_0x2fd6('0x4')]();var fs_extra=require(_0x2fd6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2fd6('0x6'));var config=require(_0x2fd6('0x7'));var controller=require(_0x2fd6('0x8'));router[_0x2fd6('0x9')]('/',auth[_0x2fd6('0xa')](),controller[_0x2fd6('0xb')]);router[_0x2fd6('0x9')](_0x2fd6('0xc'),auth[_0x2fd6('0xa')](),controller[_0x2fd6('0xd')]);router['get'](_0x2fd6('0xe'),auth['isAuthenticated'](),controller[_0x2fd6('0xf')]);router[_0x2fd6('0x10')]('/',auth[_0x2fd6('0xa')](),controller[_0x2fd6('0x11')]);router[_0x2fd6('0x10')](_0x2fd6('0x12'),auth[_0x2fd6('0xa')](),controller['clone']);router['post'](_0x2fd6('0xe'),auth[_0x2fd6('0xa')](),controller[_0x2fd6('0x13')]);router[_0x2fd6('0x14')](_0x2fd6('0xc'),auth[_0x2fd6('0xa')](),controller[_0x2fd6('0x15')]);router[_0x2fd6('0x16')](_0x2fd6('0xc'),auth[_0x2fd6('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index f8f7899..0262399 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 _0xba34=['attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','parse','getDataValue'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0xba34,0x119));var _0x4ba3=function(_0x390045,_0x27af51){_0x390045=_0x390045-0x0;var _0x56c6a2=_0xba34[_0x390045];return _0x56c6a2;};'use strict';var Sequelize=require(_0x4ba3('0x0'));var squel=require(_0x4ba3('0x1'));var _=require(_0x4ba3('0x2'));module[_0x4ba3('0x3')]={'title':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON[_0x4ba3('0x5')](this[_0x4ba3('0x6')](_0x4ba3('0x7')));}catch(_0x1011ec){return[];}},'set':function(_0x3590a1){try{this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON['stringify'](_0x3590a1));}catch(_0x6254fb){this[_0x4ba3('0x8')](_0x4ba3('0x7'),JSON[_0x4ba3('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4ba3('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4ba3('0xa')]},'col':{'type':Sequelize[_0x4ba3('0xa')]},'background':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':_0x4ba3('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4ba3('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4ba3('0x4')]},'titleFontSize':{'type':Sequelize[_0x4ba3('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x6f47=['#ffffff','squel','lodash','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x5e17e7,_0x551ed9){var _0x19a417=function(_0x10c981){while(--_0x10c981){_0x5e17e7['push'](_0x5e17e7['shift']());}};_0x19a417(++_0x551ed9);}(_0x6f47,0xc7));var _0x76f4=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x6f47[_0x710815];return _0x5b3b89;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));module['exports']={'title':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x76f4('0x3')]('long'),'get':function(){try{return JSON[_0x76f4('0x4')](this[_0x76f4('0x5')](_0x76f4('0x6')));}catch(_0x2523ba){return[];}},'set':function(_0x5754ca){try{this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')](_0x5754ca));}catch(_0x497f99){this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![],'defaultValue':_0x76f4('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x76f4('0x2')]},'titleFontSize':{'type':Sequelize[_0x76f4('0x9')],'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 a8cb2a4..f8adf00 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 _0x25fa=['Content-Range','apply','reject','update','then','error','stack','name','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','catch','destroy','find','params','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','count','set'];(function(_0x53f8b7,_0x1d14a6){var _0x51cfbd=function(_0x34e79d){while(--_0x34e79d){_0x53f8b7['push'](_0x53f8b7['shift']());}};_0x51cfbd(++_0x1d14a6);}(_0x25fa,0x109));var _0xa25f=function(_0xe5eabd,_0x16805c){_0xe5eabd=_0xe5eabd-0x0;var _0x23a210=_0x25fa[_0xe5eabd];return _0x23a210;};'use strict';var emlformat=require(_0xa25f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa25f('0x1'));var jsonpatch=require(_0xa25f('0x2'));var rp=require('request-promise');var moment=require(_0xa25f('0x3'));var BPromise=require(_0xa25f('0x4'));var Mustache=require(_0xa25f('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa25f('0x6'));var csv=require('to-csv');var ejs=require(_0xa25f('0x7'));var fs=require('fs');var fs_extra=require(_0xa25f('0x8'));var _=require(_0xa25f('0x9'));var squel=require(_0xa25f('0xa'));var crypto=require(_0xa25f('0xb'));var jsforce=require(_0xa25f('0xc'));var deskjs=require(_0xa25f('0xd'));var toCsv=require(_0xa25f('0xe'));var querystring=require(_0xa25f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa25f('0x10'));var authService=require(_0xa25f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa25f('0x12'));var hardwareService=require(_0xa25f('0x13'));var logger=require(_0xa25f('0x14'))(_0xa25f('0x15'));var utils=require('../../config/utils');var config=require(_0xa25f('0x16'));var licenseUtil=require(_0xa25f('0x17'));var db=require('../../mysqldb')['db'];config[_0xa25f('0x18')]=_[_0xa25f('0x19')](config['redis'],{'host':_0xa25f('0x1a'),'port':0x18eb});var socket=require(_0xa25f('0x1b'))(new Redis(config[_0xa25f('0x18')]));require(_0xa25f('0x1c'))[_0xa25f('0x1d')](socket);function respondWithStatusCode(_0x2a627f,_0x46cd8c){_0x46cd8c=_0x46cd8c||0xcc;return function(_0x363668){if(_0x363668){return _0x2a627f[_0xa25f('0x1e')](_0x46cd8c);}return _0x2a627f[_0xa25f('0x1f')](_0x46cd8c)[_0xa25f('0x20')]();};}function respondWithResult(_0x1859ba,_0x57ada6){_0x57ada6=_0x57ada6||0xc8;return function(_0x2d4f0f){if(_0x2d4f0f){return _0x1859ba[_0xa25f('0x1f')](_0x57ada6)[_0xa25f('0x21')](_0x2d4f0f);}};}function respondWithFilteredResult(_0x451a6e,_0x18705c){return function(_0x427105){if(_0x427105){var _0x4a4805=typeof _0x18705c[_0xa25f('0x22')]==='undefined'&&typeof _0x18705c[_0xa25f('0x23')]==='undefined';var _0x559c89=_0x427105[_0xa25f('0x24')];var _0x489c83=_0x4a4805?0x0:_0x18705c[_0xa25f('0x22')];var _0x131c68=_0x4a4805?_0x427105[_0xa25f('0x24')]:_0x18705c[_0xa25f('0x22')]+_0x18705c[_0xa25f('0x23')];var _0x504135;if(_0x131c68>=_0x559c89){_0x131c68=_0x559c89;_0x504135=0xc8;}else{_0x504135=0xce;}_0x451a6e[_0xa25f('0x1f')](_0x504135);return _0x451a6e[_0xa25f('0x25')](_0xa25f('0x26'),_0x489c83+'-'+_0x131c68+'/'+_0x559c89)[_0xa25f('0x21')](_0x427105);}return null;};}function patchUpdates(_0x5d2803){return function(_0x7dc402){try{jsonpatch[_0xa25f('0x27')](_0x7dc402,_0x5d2803,!![]);}catch(_0x248c0c){return BPromise[_0xa25f('0x28')](_0x248c0c);}return _0x7dc402['save']();};}function saveUpdates(_0x2b710f,_0x906388){return function(_0x22f123){if(_0x22f123){return _0x22f123[_0xa25f('0x29')](_0x2b710f)['then'](function(_0x2812d7){return _0x2812d7;});}return null;};}function removeEntity(_0x898446,_0x53f011){return function(_0x23d1ba){if(_0x23d1ba){return _0x23d1ba['destroy']()[_0xa25f('0x2a')](function(){_0x898446['status'](0xcc)[_0xa25f('0x20')]();});}};}function handleEntityNotFound(_0x2448f4,_0x493de0){return function(_0xf6c928){if(!_0xf6c928){_0x2448f4[_0xa25f('0x1e')](0x194);}return _0xf6c928;};}function handleError(_0x54d98c,_0x471e7c){_0x471e7c=_0x471e7c||0x1f4;return function(_0x5d39c7){logger[_0xa25f('0x2b')](_0x5d39c7[_0xa25f('0x2c')]);if(_0x5d39c7[_0xa25f('0x2d')]){delete _0x5d39c7[_0xa25f('0x2d')];}_0x54d98c[_0xa25f('0x1f')](_0x471e7c)['send'](_0x5d39c7);};}exports[_0xa25f('0x2e')]=function(_0x28d84e,_0x119ffc){var _0x245684={'raw':![],'where':{'id':_0x28d84e['params']['id']}},_0x3bdde0={};_0x3bdde0[_0xa25f('0x2f')]=_[_0xa25f('0x30')](db[_0xa25f('0x31')][_0xa25f('0x32')]);_0x3bdde0[_0xa25f('0x33')]=_[_0xa25f('0x30')](_0x28d84e[_0xa25f('0x33')]);_0x3bdde0[_0xa25f('0x34')]=_[_0xa25f('0x35')](_0x3bdde0['model'],_0x3bdde0['query']);_0x245684['attributes']=_[_0xa25f('0x35')](_0x3bdde0[_0xa25f('0x2f')],qs[_0xa25f('0x36')](_0x28d84e[_0xa25f('0x33')][_0xa25f('0x36')]));_0x245684[_0xa25f('0x37')]=_0x245684[_0xa25f('0x37')][_0xa25f('0x38')]?_0x245684[_0xa25f('0x37')]:_0x3bdde0[_0xa25f('0x2f')];if(_0x28d84e[_0xa25f('0x33')]['includeAll']){_0x245684['include']=[{'all':!![]}];}_0x245684=_[_0xa25f('0x39')]({},_0x245684,_0x28d84e[_0xa25f('0x3a')]);return db[_0xa25f('0x31')]['find'](_0x245684)['then'](handleEntityNotFound(_0x119ffc,null))['then'](respondWithResult(_0x119ffc,null))[_0xa25f('0x3b')](handleError(_0x119ffc,null));};exports[_0xa25f('0x3c')]=function(_0x1078c4,_0x4a334b){return db['DashboardItem'][_0xa25f('0x3d')]({'where':{'id':_0x1078c4[_0xa25f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4a334b,null))['then'](removeEntity(_0x4a334b,null))[_0xa25f('0x3b')](handleError(_0x4a334b,null));};function widgetAttributes(_0x33ad7a){try{switch(_0x33ad7a[_0xa25f('0x3f')]){case'iframe':return[{'name':_0xa25f('0x40'),'value':_0x33ad7a[_0xa25f('0x40')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a['attrs'][0x0]?_0x33ad7a['attrs'][0x0][_0xa25f('0x42')]:undefined)||_0xa25f('0x43')}];case _0xa25f('0x44'):return[{'name':_0xa25f('0x45'),'value':_0x33ad7a[_0xa25f('0x45')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x0]?_0x33ad7a[_0xa25f('0x41')][0x0]['value']:undefined)||''}];case _0xa25f('0x46'):return[{'name':_0xa25f('0x47'),'value':_0x33ad7a[_0xa25f('0x47')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x0]?_0x33ad7a[_0xa25f('0x41')][0x0][_0xa25f('0x42')]:undefined)||_0xa25f('0x48')},{'name':_0xa25f('0x49'),'value':_0x33ad7a[_0xa25f('0x49')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x1]?_0x33ad7a[_0xa25f('0x41')][0x1]['value']:undefined)||_0xa25f('0x4a')},{'name':'attrFontSize','value':_0x33ad7a[_0xa25f('0x4b')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x2]?_0x33ad7a['attrs'][0x2][_0xa25f('0x42')]:undefined)||0xc}];case _0xa25f('0x4c'):return[{'name':_0xa25f('0x4d'),'value':_0x33ad7a[_0xa25f('0x4d')]||(_0x33ad7a['attrs']&&_0x33ad7a[_0xa25f('0x41')][0x0]?_0x33ad7a[_0xa25f('0x41')][0x0][_0xa25f('0x42')]:undefined)||_0xa25f('0x4e')},{'name':_0xa25f('0x4f'),'value':_0x33ad7a[_0xa25f('0x4f')]||(_0x33ad7a['attrs']&&_0x33ad7a[_0xa25f('0x41')][0x1]?_0x33ad7a[_0xa25f('0x41')][0x1]['value']:undefined)||[]},{'name':_0xa25f('0x4b'),'value':_0x33ad7a[_0xa25f('0x4b')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x2]?_0x33ad7a[_0xa25f('0x41')][0x2][_0xa25f('0x42')]:undefined)||0x14},{'name':_0xa25f('0x50'),'value':_0x33ad7a[_0xa25f('0x50')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x3]?_0x33ad7a[_0xa25f('0x41')][0x3][_0xa25f('0x42')]:undefined)||_0xa25f('0x51')},{'name':'attrEmailAccounts','value':_0x33ad7a[_0xa25f('0x52')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x4]?_0x33ad7a[_0xa25f('0x41')][0x4]['value']:undefined)||''},{'name':_0xa25f('0x53'),'value':_0x33ad7a[_0xa25f('0x53')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a['attrs'][0x5]?_0x33ad7a[_0xa25f('0x41')][0x5][_0xa25f('0x42')]:undefined)||''},{'name':_0xa25f('0x54'),'value':_0x33ad7a[_0xa25f('0x54')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x6]?_0x33ad7a[_0xa25f('0x41')][0x6][_0xa25f('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x33ad7a[_0xa25f('0x55')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x7]?_0x33ad7a[_0xa25f('0x41')][0x7][_0xa25f('0x42')]:undefined)||''},{'name':_0xa25f('0x56'),'value':_0x33ad7a[_0xa25f('0x56')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x8]?_0x33ad7a[_0xa25f('0x41')][0x8][_0xa25f('0x42')]:undefined)||''},{'name':_0xa25f('0x57'),'value':_0x33ad7a[_0xa25f('0x57')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x9]?_0x33ad7a[_0xa25f('0x41')][0x9][_0xa25f('0x42')]:undefined)||''}];case _0xa25f('0x58'):case _0xa25f('0x59'):return[{'name':_0xa25f('0x5a'),'value':_0x33ad7a[_0xa25f('0x5a')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a['attrs'][0x0]?_0x33ad7a[_0xa25f('0x41')][0x0][_0xa25f('0x42')]:undefined)||_0xa25f('0x4e')},{'name':_0xa25f('0x5b'),'value':_0x33ad7a['attrSerie2']||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a['attrs'][0x1]?_0x33ad7a[_0xa25f('0x41')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x33ad7a[_0xa25f('0x5c')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x2]?_0x33ad7a[_0xa25f('0x41')][0x2][_0xa25f('0x42')]:undefined)||null},{'name':_0xa25f('0x4f'),'value':_0x33ad7a[_0xa25f('0x4f')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x3]?_0x33ad7a[_0xa25f('0x41')][0x3][_0xa25f('0x42')]:undefined)||[]},{'name':_0xa25f('0x50'),'value':_0x33ad7a['attrChannel']||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x4]?_0x33ad7a[_0xa25f('0x41')][0x4][_0xa25f('0x42')]:undefined)||'voice'},{'name':_0xa25f('0x52'),'value':_0x33ad7a['attrEmailAccounts']||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x5]?_0x33ad7a[_0xa25f('0x41')][0x5][_0xa25f('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x33ad7a[_0xa25f('0x53')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x6]?_0x33ad7a['attrs'][0x6][_0xa25f('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x33ad7a[_0xa25f('0x54')]||(_0x33ad7a['attrs']&&_0x33ad7a[_0xa25f('0x41')][0x7]?_0x33ad7a[_0xa25f('0x41')][0x7][_0xa25f('0x42')]:undefined)||''},{'name':_0xa25f('0x55'),'value':_0x33ad7a[_0xa25f('0x55')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a['attrs'][0x8]?_0x33ad7a[_0xa25f('0x41')][0x8][_0xa25f('0x42')]:undefined)||''},{'name':_0xa25f('0x56'),'value':_0x33ad7a[_0xa25f('0x56')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x9]?_0x33ad7a[_0xa25f('0x41')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x33ad7a['attrChatWebsites']||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0xa]?_0x33ad7a[_0xa25f('0x41')][0xa][_0xa25f('0x42')]:undefined)||''}];case _0xa25f('0x5d'):return[{'name':_0xa25f('0x5e'),'type':_0x33ad7a[_0xa25f('0x5f')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x0]?_0x33ad7a[_0xa25f('0x41')][0x0][_0xa25f('0x3f')]:undefined)||null,'value':_0x33ad7a['attrReport']||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x0]?_0x33ad7a[_0xa25f('0x41')][0x0][_0xa25f('0x42')]:undefined)||null},{'name':_0xa25f('0x60'),'value':_0x33ad7a['attrRefresh']||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x1]?_0x33ad7a['attrs'][0x1][_0xa25f('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x214d6a){logger['error'](_0xa25f('0x61'),JSON[_0xa25f('0x62')](_0x214d6a));return[];}}exports[_0xa25f('0x63')]=function(_0x336beb,_0x380f61){if(_0x336beb['body']){_0x336beb[_0xa25f('0x64')][_0xa25f('0x41')]=widgetAttributes(_0x336beb[_0xa25f('0x64')]);}return db['DashboardItem'][_0xa25f('0x63')](_0x336beb[_0xa25f('0x64')],{})[_0xa25f('0x2a')](respondWithResult(_0x380f61,0xc9))['catch'](handleError(_0x380f61,null));};exports[_0xa25f('0x29')]=function(_0x2595a2,_0x23029f){if(_0x2595a2[_0xa25f('0x64')]['id']){delete _0x2595a2['body']['id'];}_0x2595a2['body'][_0xa25f('0x41')]=widgetAttributes(_0x2595a2[_0xa25f('0x64')]);return db[_0xa25f('0x31')][_0xa25f('0x3d')]({'where':{'id':_0x2595a2[_0xa25f('0x3e')]['id']}})[_0xa25f('0x2a')](handleEntityNotFound(_0x23029f,null))[_0xa25f('0x2a')](saveUpdates(_0x2595a2['body'],null))['then'](respondWithResult(_0x23029f,null))[_0xa25f('0x3b')](handleError(_0x23029f,null));}; \ No newline at end of file +var _0x01db=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','show','params','model','keys','rawAttributes','query','filters','attributes','fields','length','include','merge','options','DashboardItem','catch','find','type','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrEmailAccounts','web-report','attrReport','reportType','attrRefresh','create','body','eml-format','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xf8bd19,_0x476c09){var _0x376ded=function(_0x50a1a9){while(--_0x50a1a9){_0xf8bd19['push'](_0xf8bd19['shift']());}};_0x376ded(++_0x476c09);}(_0x01db,0x171));var _0xb01d=function(_0x33b501,_0x4ca151){_0x33b501=_0x33b501-0x0;var _0x4c08f1=_0x01db[_0x33b501];return _0x4c08f1;};'use strict';var emlformat=require(_0xb01d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb01d('0x1'));var rp=require(_0xb01d('0x2'));var moment=require(_0xb01d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb01d('0x4'));var util=require('util');var path=require('path');var sox=require(_0xb01d('0x5'));var csv=require(_0xb01d('0x6'));var ejs=require(_0xb01d('0x7'));var fs=require('fs');var fs_extra=require(_0xb01d('0x8'));var _=require(_0xb01d('0x9'));var squel=require(_0xb01d('0xa'));var crypto=require(_0xb01d('0xb'));var jsforce=require(_0xb01d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb01d('0xd'));var Papa=require(_0xb01d('0xe'));var Redis=require(_0xb01d('0xf'));var authService=require(_0xb01d('0x10'));var qs=require(_0xb01d('0x11'));var as=require(_0xb01d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb01d('0x13'));var utils=require(_0xb01d('0x14'));var config=require(_0xb01d('0x15'));var licenseUtil=require(_0xb01d('0x16'));var db=require(_0xb01d('0x17'))['db'];config[_0xb01d('0x18')]=_[_0xb01d('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb01d('0x1a'))(new Redis(config['redis']));require(_0xb01d('0x1b'))[_0xb01d('0x1c')](socket);function respondWithStatusCode(_0x4a7641,_0x28ee78){_0x28ee78=_0x28ee78||0xcc;return function(_0x34fcf8){if(_0x34fcf8){return _0x4a7641[_0xb01d('0x1d')](_0x28ee78);}return _0x4a7641[_0xb01d('0x1e')](_0x28ee78)['end']();};}function respondWithResult(_0x135604,_0x507930){_0x507930=_0x507930||0xc8;return function(_0xd9c0b0){if(_0xd9c0b0){return _0x135604[_0xb01d('0x1e')](_0x507930)[_0xb01d('0x1f')](_0xd9c0b0);}};}function respondWithFilteredResult(_0x2009a2,_0x566298){return function(_0xe47874){if(_0xe47874){var _0x45454b=typeof _0x566298[_0xb01d('0x20')]==='undefined'&&typeof _0x566298[_0xb01d('0x21')]==='undefined';var _0x42961b=_0xe47874[_0xb01d('0x22')];var _0x3e96ef=_0x45454b?0x0:_0x566298[_0xb01d('0x20')];var _0x3d5c9d=_0x45454b?_0xe47874['count']:_0x566298[_0xb01d('0x20')]+_0x566298[_0xb01d('0x21')];var _0x149b50;if(_0x3d5c9d>=_0x42961b){_0x3d5c9d=_0x42961b;_0x149b50=0xc8;}else{_0x149b50=0xce;}_0x2009a2[_0xb01d('0x1e')](_0x149b50);return _0x2009a2[_0xb01d('0x23')](_0xb01d('0x24'),_0x3e96ef+'-'+_0x3d5c9d+'/'+_0x42961b)[_0xb01d('0x1f')](_0xe47874);}return null;};}function patchUpdates(_0x42064d){return function(_0x138485){try{jsonpatch[_0xb01d('0x25')](_0x138485,_0x42064d,!![]);}catch(_0x1151ea){return BPromise[_0xb01d('0x26')](_0x1151ea);}return _0x138485['save']();};}function saveUpdates(_0x446824,_0x48dc4c){return function(_0xed76c0){if(_0xed76c0){return _0xed76c0[_0xb01d('0x27')](_0x446824)[_0xb01d('0x28')](function(_0x3ce3f8){return _0x3ce3f8;});}return null;};}function removeEntity(_0xf92ae7,_0x1d8f04){return function(_0x2a7af0){if(_0x2a7af0){return _0x2a7af0[_0xb01d('0x29')]()[_0xb01d('0x28')](function(){_0xf92ae7[_0xb01d('0x1e')](0xcc)[_0xb01d('0x2a')]();});}};}function handleEntityNotFound(_0x531d37,_0x2b9fac){return function(_0x37e513){if(!_0x37e513){_0x531d37[_0xb01d('0x1d')](0x194);}return _0x37e513;};}function handleError(_0x483a27,_0x1cf399){_0x1cf399=_0x1cf399||0x1f4;return function(_0x1bd8d2){logger[_0xb01d('0x2b')](_0x1bd8d2['stack']);if(_0x1bd8d2[_0xb01d('0x2c')]){delete _0x1bd8d2['name'];}_0x483a27[_0xb01d('0x1e')](_0x1cf399)[_0xb01d('0x2d')](_0x1bd8d2);};}exports[_0xb01d('0x2e')]=function(_0x513eac,_0x2f3046){var _0x2f0f7c={'raw':![],'where':{'id':_0x513eac[_0xb01d('0x2f')]['id']}},_0x1666a1={};_0x1666a1[_0xb01d('0x30')]=_[_0xb01d('0x31')](db['DashboardItem'][_0xb01d('0x32')]);_0x1666a1[_0xb01d('0x33')]=_[_0xb01d('0x31')](_0x513eac['query']);_0x1666a1[_0xb01d('0x34')]=_['intersection'](_0x1666a1['model'],_0x1666a1[_0xb01d('0x33')]);_0x2f0f7c[_0xb01d('0x35')]=_['intersection'](_0x1666a1['model'],qs[_0xb01d('0x36')](_0x513eac[_0xb01d('0x33')][_0xb01d('0x36')]));_0x2f0f7c[_0xb01d('0x35')]=_0x2f0f7c[_0xb01d('0x35')][_0xb01d('0x37')]?_0x2f0f7c[_0xb01d('0x35')]:_0x1666a1[_0xb01d('0x30')];if(_0x513eac[_0xb01d('0x33')]['includeAll']){_0x2f0f7c[_0xb01d('0x38')]=[{'all':!![]}];}_0x2f0f7c=_[_0xb01d('0x39')]({},_0x2f0f7c,_0x513eac[_0xb01d('0x3a')]);return db[_0xb01d('0x3b')]['find'](_0x2f0f7c)[_0xb01d('0x28')](handleEntityNotFound(_0x2f3046,null))['then'](respondWithResult(_0x2f3046,null))[_0xb01d('0x3c')](handleError(_0x2f3046,null));};exports[_0xb01d('0x29')]=function(_0x38ff51,_0x2717dc){return db['DashboardItem'][_0xb01d('0x3d')]({'where':{'id':_0x38ff51[_0xb01d('0x2f')]['id']}})[_0xb01d('0x28')](handleEntityNotFound(_0x2717dc,null))[_0xb01d('0x28')](removeEntity(_0x2717dc,null))[_0xb01d('0x3c')](handleError(_0x2717dc,null));};function widgetAttributes(_0x5edfcb){try{switch(_0x5edfcb[_0xb01d('0x3e')]){case _0xb01d('0x3f'):return[{'name':_0xb01d('0x40'),'value':_0x5edfcb[_0xb01d('0x40')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x0]?_0x5edfcb[_0xb01d('0x41')][0x0]['value']:undefined)||'https://'}];case _0xb01d('0x42'):return[{'name':'attrPath','value':_0x5edfcb[_0xb01d('0x43')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb['attrs'][0x0]?_0x5edfcb[_0xb01d('0x41')][0x0][_0xb01d('0x44')]:undefined)||''}];case _0xb01d('0x45'):return[{'name':_0xb01d('0x46'),'value':_0x5edfcb['attrHourFormat']||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x0]?_0x5edfcb['attrs'][0x0][_0xb01d('0x44')]:undefined)||'HH:mm:ss'},{'name':_0xb01d('0x47'),'value':_0x5edfcb[_0xb01d('0x47')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb['attrs'][0x1]?_0x5edfcb[_0xb01d('0x41')][0x1]['value']:undefined)||_0xb01d('0x48')},{'name':_0xb01d('0x49'),'value':_0x5edfcb[_0xb01d('0x49')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb['attrs'][0x2]?_0x5edfcb['attrs'][0x2][_0xb01d('0x44')]:undefined)||0xc}];case _0xb01d('0x4a'):return[{'name':_0xb01d('0x4b'),'value':_0x5edfcb[_0xb01d('0x4b')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x0]?_0x5edfcb[_0xb01d('0x41')][0x0][_0xb01d('0x44')]:undefined)||_0xb01d('0x4c')},{'name':'attrVoiceQueues','value':_0x5edfcb['attrVoiceQueues']||(_0x5edfcb['attrs']&&_0x5edfcb[_0xb01d('0x41')][0x1]?_0x5edfcb[_0xb01d('0x41')][0x1]['value']:undefined)||[]},{'name':_0xb01d('0x49'),'value':_0x5edfcb['attrFontSize']||(_0x5edfcb['attrs']&&_0x5edfcb[_0xb01d('0x41')][0x2]?_0x5edfcb[_0xb01d('0x41')][0x2]['value']:undefined)||0x14},{'name':_0xb01d('0x4d'),'value':_0x5edfcb[_0xb01d('0x4d')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x3]?_0x5edfcb[_0xb01d('0x41')][0x3][_0xb01d('0x44')]:undefined)||_0xb01d('0x4e')},{'name':'attrEmailAccounts','value':_0x5edfcb['attrEmailAccounts']||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb['attrs'][0x4]?_0x5edfcb['attrs'][0x4][_0xb01d('0x44')]:undefined)||''},{'name':_0xb01d('0x4f'),'value':_0x5edfcb[_0xb01d('0x4f')]||(_0x5edfcb['attrs']&&_0x5edfcb[_0xb01d('0x41')][0x5]?_0x5edfcb[_0xb01d('0x41')][0x5][_0xb01d('0x44')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5edfcb[_0xb01d('0x50')]||(_0x5edfcb['attrs']&&_0x5edfcb['attrs'][0x6]?_0x5edfcb[_0xb01d('0x41')][0x6][_0xb01d('0x44')]:undefined)||''},{'name':_0xb01d('0x51'),'value':_0x5edfcb[_0xb01d('0x51')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x7]?_0x5edfcb[_0xb01d('0x41')][0x7][_0xb01d('0x44')]:undefined)||''},{'name':_0xb01d('0x52'),'value':_0x5edfcb[_0xb01d('0x52')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x8]?_0x5edfcb[_0xb01d('0x41')][0x8][_0xb01d('0x44')]:undefined)||''},{'name':_0xb01d('0x53'),'value':_0x5edfcb['attrChatWebsites']||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x9]?_0x5edfcb[_0xb01d('0x41')][0x9][_0xb01d('0x44')]:undefined)||''}];case _0xb01d('0x54'):case _0xb01d('0x55'):return[{'name':'attrSerie1','value':_0x5edfcb[_0xb01d('0x56')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x0]?_0x5edfcb[_0xb01d('0x41')][0x0][_0xb01d('0x44')]:undefined)||_0xb01d('0x4c')},{'name':_0xb01d('0x57'),'value':_0x5edfcb[_0xb01d('0x57')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb['attrs'][0x1]?_0x5edfcb[_0xb01d('0x41')][0x1]['value']:undefined)||null},{'name':_0xb01d('0x58'),'value':_0x5edfcb[_0xb01d('0x58')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x2]?_0x5edfcb[_0xb01d('0x41')][0x2][_0xb01d('0x44')]:undefined)||null},{'name':_0xb01d('0x59'),'value':_0x5edfcb[_0xb01d('0x59')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x3]?_0x5edfcb[_0xb01d('0x41')][0x3][_0xb01d('0x44')]:undefined)||[]},{'name':_0xb01d('0x4d'),'value':_0x5edfcb[_0xb01d('0x4d')]||(_0x5edfcb['attrs']&&_0x5edfcb[_0xb01d('0x41')][0x4]?_0x5edfcb[_0xb01d('0x41')][0x4][_0xb01d('0x44')]:undefined)||_0xb01d('0x4e')},{'name':'attrEmailAccounts','value':_0x5edfcb[_0xb01d('0x5a')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x5]?_0x5edfcb[_0xb01d('0x41')][0x5][_0xb01d('0x44')]:undefined)||''},{'name':_0xb01d('0x4f'),'value':_0x5edfcb[_0xb01d('0x4f')]||(_0x5edfcb['attrs']&&_0x5edfcb[_0xb01d('0x41')][0x6]?_0x5edfcb['attrs'][0x6][_0xb01d('0x44')]:undefined)||''},{'name':_0xb01d('0x50'),'value':_0x5edfcb[_0xb01d('0x50')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x7]?_0x5edfcb[_0xb01d('0x41')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5edfcb[_0xb01d('0x51')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x8]?_0x5edfcb[_0xb01d('0x41')][0x8]['value']:undefined)||''},{'name':_0xb01d('0x52'),'value':_0x5edfcb[_0xb01d('0x52')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb['attrs'][0x9]?_0x5edfcb[_0xb01d('0x41')][0x9][_0xb01d('0x44')]:undefined)||''},{'name':_0xb01d('0x53'),'value':_0x5edfcb[_0xb01d('0x53')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0xa]?_0x5edfcb['attrs'][0xa][_0xb01d('0x44')]:undefined)||''}];case _0xb01d('0x5b'):return[{'name':_0xb01d('0x5c'),'type':_0x5edfcb[_0xb01d('0x5d')]||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x0]?_0x5edfcb[_0xb01d('0x41')][0x0][_0xb01d('0x3e')]:undefined)||null,'value':_0x5edfcb['attrReport']||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x0]?_0x5edfcb['attrs'][0x0][_0xb01d('0x44')]:undefined)||null},{'name':_0xb01d('0x5e'),'value':_0x5edfcb['attrRefresh']||(_0x5edfcb[_0xb01d('0x41')]&&_0x5edfcb[_0xb01d('0x41')][0x1]?_0x5edfcb[_0xb01d('0x41')][0x1][_0xb01d('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x23a4e0){logger['error']('widgetAttributes:\x20%s',JSON['stringify'](_0x23a4e0));return[];}}exports[_0xb01d('0x5f')]=function(_0x524ae8,_0x36bbbc){if(_0x524ae8[_0xb01d('0x60')]){_0x524ae8['body'][_0xb01d('0x41')]=widgetAttributes(_0x524ae8[_0xb01d('0x60')]);}return db[_0xb01d('0x3b')][_0xb01d('0x5f')](_0x524ae8[_0xb01d('0x60')],{})[_0xb01d('0x28')](respondWithResult(_0x36bbbc,0xc9))['catch'](handleError(_0x36bbbc,null));};exports[_0xb01d('0x27')]=function(_0x4104b0,_0x2f64b3){if(_0x4104b0['body']['id']){delete _0x4104b0['body']['id'];}_0x4104b0['body'][_0xb01d('0x41')]=widgetAttributes(_0x4104b0[_0xb01d('0x60')]);return db[_0xb01d('0x3b')][_0xb01d('0x3d')]({'where':{'id':_0x4104b0[_0xb01d('0x2f')]['id']}})[_0xb01d('0x28')](handleEntityNotFound(_0x2f64b3,null))[_0xb01d('0x28')](saveUpdates(_0x4104b0[_0xb01d('0x60')],null))['then'](respondWithResult(_0x2f64b3,null))['catch'](handleError(_0x2f64b3,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0aa54c8..1c725be 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 _0x775e=['hasOwnProperty','hook','events','DashboardItem','setMaxListeners','save','update','emit'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0x775e,0xda));var _0xe775=function(_0x4d115a,_0x321a99){_0x4d115a=_0x4d115a-0x0;var _0x2808f3=_0x775e[_0x4d115a];return _0x2808f3;};'use strict';var EventEmitter=require(_0xe775('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xe775('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe775('0x2')](0x0);var events={'afterCreate':_0xe775('0x3'),'afterUpdate':_0xe775('0x4'),'afterDestroy':'remove'};function emitEvent(_0x95078d){return function(_0x43afd3,_0x330d30,_0x523a54){DashboardItemEvents[_0xe775('0x5')](_0x95078d+':'+_0x43afd3['id'],_0x43afd3);DashboardItemEvents[_0xe775('0x5')](_0x95078d,_0x43afd3);_0x523a54(null);};}for(var e in events){if(events[_0xe775('0x6')](e)){var event=events[e];DashboardItem[_0xe775('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xe78b=['events','DashboardItem','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xe78b,0x1dd));var _0xbe78=function(_0x387d19,_0x3f290e){_0x387d19=_0x387d19-0x0;var _0x27fd4b=_0xe78b[_0x387d19];return _0x27fd4b;};'use strict';var EventEmitter=require(_0xbe78('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xbe78('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xbe78('0x2')](0x0);var events={'afterCreate':_0xbe78('0x3'),'afterUpdate':_0xbe78('0x4'),'afterDestroy':_0xbe78('0x5')};function emitEvent(_0x307598){return function(_0x22c7cc,_0x5d81b3,_0x97f8fa){DashboardItemEvents[_0xbe78('0x6')](_0x307598+':'+_0x22c7cc['id'],_0x22c7cc);DashboardItemEvents['emit'](_0x307598,_0x22c7cc);_0x97f8fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xbe78('0x7')](e,emitEvent(event));}}module[_0xbe78('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 201c3ef..4c42e6d 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 _0x510c=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x50b15b,_0x71ac13){var _0x1334e2=function(_0x1bf4fa){while(--_0x1bf4fa){_0x50b15b['push'](_0x50b15b['shift']());}};_0x1334e2(++_0x71ac13);}(_0x510c,0x117));var _0xc510=function(_0x5c498c,_0x4eab12){_0x5c498c=_0x5c498c-0x0;var _0x541def=_0x510c[_0x5c498c];return _0x541def;};'use strict';var _=require(_0xc510('0x0'));var util=require(_0xc510('0x1'));var logger=require(_0xc510('0x2'))(_0xc510('0x3'));var moment=require(_0xc510('0x4'));var BPromise=require(_0xc510('0x5'));var rp=require(_0xc510('0x6'));var fs=require('fs');var path=require(_0xc510('0x7'));var rimraf=require(_0xc510('0x8'));var config=require(_0xc510('0x9'));var attributes=require(_0xc510('0xa'));module[_0xc510('0xb')]=function(_0x3cd54b,_0x1fe3e6){return _0x3cd54b[_0xc510('0xc')](_0xc510('0xd'),attributes,{'tableName':_0xc510('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb826=['moment','bluebird','request-promise','path','rimraf','exports','define','DashboardItem','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb826,0x1b8));var _0x6b82=function(_0x542660,_0xd6744f){_0x542660=_0x542660-0x0;var _0x352890=_0xb826[_0x542660];return _0x352890;};'use strict';var _=require(_0x6b82('0x0'));var util=require(_0x6b82('0x1'));var logger=require(_0x6b82('0x2'))(_0x6b82('0x3'));var moment=require(_0x6b82('0x4'));var BPromise=require(_0x6b82('0x5'));var rp=require(_0x6b82('0x6'));var fs=require('fs');var path=require(_0x6b82('0x7'));var rimraf=require(_0x6b82('0x8'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0x6b82('0x9')]=function(_0x55921b,_0x2edc5d){return _0x55921b[_0x6b82('0xa')](_0x6b82('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 0982796..f0acb7c 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 _0xa9e2=['request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','redis','defaults','localhost','./dashboardItem.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e2,0x1f3));var _0x2a9e=function(_0x102fd4,_0x88d6d3){_0x102fd4=_0x102fd4-0x0;var _0xcacdba=_0xa9e2[_0x102fd4];return _0xcacdba;};'use strict';var _=require(_0x2a9e('0x0'));var util=require(_0x2a9e('0x1'));var moment=require('moment');var BPromise=require(_0x2a9e('0x2'));var rs=require(_0x2a9e('0x3'));var fs=require('fs');var Redis=require(_0x2a9e('0x4'));var db=require(_0x2a9e('0x5'))['db'];var utils=require(_0x2a9e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2a9e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2a9e('0x8')]({'port':0x232a});config[_0x2a9e('0x9')]=_[_0x2a9e('0xa')](config[_0x2a9e('0x9')],{'host':_0x2a9e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2a9e('0xc'))[_0x2a9e('0xd')](socket);function respondWithRpcPromise(_0x12da89,_0x20a71a,_0x160d7b){return new BPromise(function(_0x3e1a4e,_0x435613){return client[_0x2a9e('0xe')](_0x12da89,_0x160d7b)[_0x2a9e('0xf')](function(_0x531275){logger[_0x2a9e('0x10')](_0x2a9e('0x11'),_0x20a71a,'request\x20sent');logger[_0x2a9e('0x12')](_0x2a9e('0x13'),_0x20a71a,'request\x20sent',JSON[_0x2a9e('0x14')](_0x531275));if(_0x531275[_0x2a9e('0x15')]){if(_0x531275[_0x2a9e('0x15')][_0x2a9e('0x16')]===0x1f4){logger['error'](_0x2a9e('0x11'),_0x20a71a,_0x531275[_0x2a9e('0x15')][_0x2a9e('0x17')]);return _0x435613(_0x531275['error'][_0x2a9e('0x17')]);}logger[_0x2a9e('0x15')](_0x2a9e('0x11'),_0x20a71a,_0x531275[_0x2a9e('0x15')][_0x2a9e('0x17')]);return _0x3e1a4e(_0x531275[_0x2a9e('0x15')][_0x2a9e('0x17')]);}else{logger[_0x2a9e('0x10')](_0x2a9e('0x11'),_0x20a71a,_0x2a9e('0x18'));_0x3e1a4e(_0x531275[_0x2a9e('0x19')][_0x2a9e('0x17')]);}})[_0x2a9e('0x1a')](function(_0x4c397e){logger['error'](_0x2a9e('0x11'),_0x20a71a,_0x4c397e);_0x435613(_0x4c397e);});});} \ No newline at end of file +var _0x21a4=['client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x539749,_0x254517){var _0x44915f=function(_0x4ce838){while(--_0x4ce838){_0x539749['push'](_0x539749['shift']());}};_0x44915f(++_0x254517);}(_0x21a4,0xaa));var _0x421a=function(_0x540a9e,_0x43d530){_0x540a9e=_0x540a9e-0x0;var _0x5d3c93=_0x21a4[_0x540a9e];return _0x5d3c93;};'use strict';var _=require(_0x421a('0x0'));var util=require(_0x421a('0x1'));var moment=require(_0x421a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x421a('0x3'));var db=require(_0x421a('0x4'))['db'];var utils=require(_0x421a('0x5'));var logger=require(_0x421a('0x6'))(_0x421a('0x7'));var config=require(_0x421a('0x8'));var jayson=require(_0x421a('0x9'));var client=jayson[_0x421a('0xa')][_0x421a('0xb')]({'port':0x232a});config['redis']=_[_0x421a('0xc')](config[_0x421a('0xd')],{'host':_0x421a('0xe'),'port':0x18eb});var socket=require(_0x421a('0xf'))(new Redis(config[_0x421a('0xd')]));require(_0x421a('0x10'))[_0x421a('0x11')](socket);function respondWithRpcPromise(_0x580d78,_0x3c035b,_0x499502){return new BPromise(function(_0x1b5aff,_0x131b7f){return client[_0x421a('0x12')](_0x580d78,_0x499502)[_0x421a('0x13')](function(_0x38b86b){logger[_0x421a('0x14')]('DashboardItem,\x20%s,\x20%s',_0x3c035b,_0x421a('0x15'));logger['debug'](_0x421a('0x16'),_0x3c035b,_0x421a('0x15'),JSON[_0x421a('0x17')](_0x38b86b));if(_0x38b86b[_0x421a('0x18')]){if(_0x38b86b[_0x421a('0x18')][_0x421a('0x19')]===0x1f4){logger[_0x421a('0x18')](_0x421a('0x1a'),_0x3c035b,_0x38b86b[_0x421a('0x18')]['message']);return _0x131b7f(_0x38b86b[_0x421a('0x18')][_0x421a('0x1b')]);}logger[_0x421a('0x18')](_0x421a('0x1a'),_0x3c035b,_0x38b86b[_0x421a('0x18')]['message']);return _0x1b5aff(_0x38b86b[_0x421a('0x18')][_0x421a('0x1b')]);}else{logger['info'](_0x421a('0x1a'),_0x3c035b,_0x421a('0x15'));_0x1b5aff(_0x38b86b[_0x421a('0x1c')]['message']);}})[_0x421a('0x1d')](function(_0x1f4790){logger[_0x421a('0x18')](_0x421a('0x1a'),_0x3c035b,_0x1f4790);_0x131b7f(_0x1f4790);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 4fcca60..f46a81c 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 _0xdebc=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x420c7e,_0x2fb00d){var _0x1fdcb0=function(_0xe73be0){while(--_0xe73be0){_0x420c7e['push'](_0x420c7e['shift']());}};_0x1fdcb0(++_0x2fb00d);}(_0xdebc,0xf5));var _0xcdeb=function(_0x37595c,_0xc5a19b){_0x37595c=_0x37595c-0x0;var _0x4903e5=_0xdebc[_0x37595c];return _0x4903e5;};'use strict';var DashboardItemEvents=require(_0xcdeb('0x0'));var events=[_0xcdeb('0x1'),_0xcdeb('0x2'),'update'];function createListener(_0x5de118,_0x3ac98d){return function(_0x5e5ad8){_0x3ac98d[_0xcdeb('0x3')](_0x5de118,_0x5e5ad8);};}function removeListener(_0x33b581,_0x241a4b){return function(){DashboardItemEvents[_0xcdeb('0x4')](_0x33b581,_0x241a4b);};}exports[_0xcdeb('0x5')]=function(_0x5a5d02){for(var _0xf5f83=0x0,_0x1da383=events[_0xcdeb('0x6')];_0xf5f83<_0x1da383;_0xf5f83++){var _0x58d55d=events[_0xf5f83];var _0x510d2e=createListener(_0xcdeb('0x7')+_0x58d55d,_0x5a5d02);DashboardItemEvents['on'](_0x58d55d,_0x510d2e);}}; \ No newline at end of file +var _0xa205=['length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x39df6e,_0x548a5a){var _0xcbceb6=function(_0x467d77){while(--_0x467d77){_0x39df6e['push'](_0x39df6e['shift']());}};_0xcbceb6(++_0x548a5a);}(_0xa205,0x13d));var _0x5a20=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0xa205[_0x5f4cd7];return _0x47c93f;};'use strict';var DashboardItemEvents=require(_0x5a20('0x0'));var events=[_0x5a20('0x1'),_0x5a20('0x2'),_0x5a20('0x3')];function createListener(_0x58e778,_0x136fdb){return function(_0xdc16af){_0x136fdb[_0x5a20('0x4')](_0x58e778,_0xdc16af);};}function removeListener(_0x58ca35,_0xefa013){return function(){DashboardItemEvents[_0x5a20('0x5')](_0x58ca35,_0xefa013);};}exports[_0x5a20('0x6')]=function(_0x49ed8c){for(var _0x306196=0x0,_0x55da36=events[_0x5a20('0x7')];_0x306196<_0x55da36;_0x306196++){var _0x1c2866=events[_0x306196];var _0x14cea5=createListener(_0x5a20('0x8')+_0x1c2866,_0x49ed8c);DashboardItemEvents['on'](_0x1c2866,_0x14cea5);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 33b52de..db5883c 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 _0x3ab3=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3ab3,0x1d9));var _0x33ab=function(_0x5090d4,_0x1950a7){_0x5090d4=_0x5090d4-0x0;var _0x56c310=_0x3ab3[_0x5090d4];return _0x56c310;};'use strict';var multer=require(_0x33ab('0x0'));var util=require(_0x33ab('0x1'));var path=require(_0x33ab('0x2'));var timeout=require('connect-timeout');var express=require(_0x33ab('0x3'));var router=express[_0x33ab('0x4')]();var fs_extra=require(_0x33ab('0x5'));var auth=require(_0x33ab('0x6'));var interaction=require(_0x33ab('0x7'));var config=require('../../config/environment');var controller=require(_0x33ab('0x8'));router[_0x33ab('0x9')](_0x33ab('0xa'),auth['isAuthenticated'](),controller[_0x33ab('0xb')]);router['post']('/',auth[_0x33ab('0xc')](),controller[_0x33ab('0xd')]);router[_0x33ab('0xe')](_0x33ab('0xa'),auth[_0x33ab('0xc')](),controller[_0x33ab('0xf')]);router[_0x33ab('0x10')]('/:id',auth[_0x33ab('0xc')](),controller[_0x33ab('0x11')]);module[_0x33ab('0x12')]=router; \ No newline at end of file +var _0x8c67=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','delete','destroy','exports','multer'];(function(_0x1fcf9e,_0xa054f0){var _0x5c8b27=function(_0x5281b6){while(--_0x5281b6){_0x1fcf9e['push'](_0x1fcf9e['shift']());}};_0x5c8b27(++_0xa054f0);}(_0x8c67,0x1da));var _0x78c6=function(_0x42d29a,_0xf8afdf){_0x42d29a=_0x42d29a-0x0;var _0x516a01=_0x8c67[_0x42d29a];return _0x516a01;};'use strict';var multer=require(_0x78c6('0x0'));var util=require(_0x78c6('0x1'));var path=require(_0x78c6('0x2'));var timeout=require(_0x78c6('0x3'));var express=require(_0x78c6('0x4'));var router=express['Router']();var fs_extra=require(_0x78c6('0x5'));var auth=require(_0x78c6('0x6'));var interaction=require(_0x78c6('0x7'));var config=require(_0x78c6('0x8'));var controller=require(_0x78c6('0x9'));router[_0x78c6('0xa')](_0x78c6('0xb'),auth[_0x78c6('0xc')](),controller[_0x78c6('0xd')]);router[_0x78c6('0xe')]('/',auth[_0x78c6('0xc')](),controller[_0x78c6('0xf')]);router['put'](_0x78c6('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x78c6('0x10')](_0x78c6('0xb'),auth[_0x78c6('0xc')](),controller[_0x78c6('0x11')]);module[_0x78c6('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 1cde474..f4b5c55 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 _0x9711=['ENUM','first','second','third','STRING'];(function(_0x51f2bf,_0x3a6699){var _0x2079ff=function(_0x3ace8b){while(--_0x3ace8b){_0x51f2bf['push'](_0x51f2bf['shift']());}};_0x2079ff(++_0x3a6699);}(_0x9711,0x13b));var _0x1971=function(_0xc2ab6f,_0x55731b){_0xc2ab6f=_0xc2ab6f-0x0;var _0x263fd2=_0x9711[_0xc2ab6f];return _0x263fd2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x1971('0x0')](_0x1971('0x1'),_0x1971('0x2'),_0x1971('0x3')),'allowNull':![],'defaultValue':_0x1971('0x1')},'description':{'type':Sequelize[_0x1971('0x4')]}}; \ No newline at end of file +var _0xd01e=['third','STRING','ENUM','first','second'];(function(_0x1d8ef2,_0x359182){var _0x36f0f8=function(_0x357ec4){while(--_0x357ec4){_0x1d8ef2['push'](_0x1d8ef2['shift']());}};_0x36f0f8(++_0x359182);}(_0xd01e,0x1c4));var _0xed01=function(_0x131590,_0x18212d){_0x131590=_0x131590-0x0;var _0x258968=_0xd01e[_0x131590];return _0x258968;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xed01('0x0')](_0xed01('0x1'),_0xed01('0x2'),_0xed01('0x3')),'allowNull':![],'defaultValue':_0xed01('0x1')},'description':{'type':Sequelize[_0xed01('0x4')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 1c3ba74..c4c29e5 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 _0x4819=['destroy','Dispositions','error','stack','name','send','index','map','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','Disposition','includeAll','include','findAll','catch','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','update','then'];(function(_0x1c3370,_0xf617e8){var _0xa9b358=function(_0x39cb44){while(--_0x39cb44){_0x1c3370['push'](_0x1c3370['shift']());}};_0xa9b358(++_0xf617e8);}(_0x4819,0xcd));var _0x9481=function(_0x19c5f2,_0x44ed13){_0x19c5f2=_0x19c5f2-0x0;var _0xb94caf=_0x4819[_0x19c5f2];return _0xb94caf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){var _0x56c889=_0x49ecfa['get']({'plain':!![]});var _0x12b0c3=_0x9481('0x27');return db['UserProfileResource'][_0x9481('0x26')]({'where':{'type':_0x12b0c3,'resourceId':_0x56c889['id']}})[_0x9481('0x25')](function(){return _0x49ecfa;});})[_0x9481('0x25')](function(){_0x1809d2[_0x9481('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14f03e,_0x3ca064){return function(_0x3c2585){if(!_0x3c2585){_0x14f03e['sendStatus'](0x194);}return _0x3c2585;};}function handleError(_0x1791b2,_0x56e944){_0x56e944=_0x56e944||0x1f4;return function(_0x2e1eff){logger[_0x9481('0x28')](_0x2e1eff[_0x9481('0x29')]);if(_0x2e1eff[_0x9481('0x2a')]){delete _0x2e1eff[_0x9481('0x2a')];}_0x1791b2['status'](_0x56e944)[_0x9481('0x2b')](_0x2e1eff);};}exports[_0x9481('0x2c')]=function(_0x46e4ab,_0x4895a0){var _0x56752e={},_0x1addc8={},_0x427c25={'count':0x0,'rows':[]};var _0x42df68=_[_0x9481('0x2d')](db['Disposition']['rawAttributes'],function(_0x5e7d16){return{'name':_0x5e7d16[_0x9481('0x2e')],'type':_0x5e7d16['type'][_0x9481('0x2f')]};});_0x1addc8['model']=_[_0x9481('0x2d')](_0x42df68,_0x9481('0x2a'));_0x1addc8[_0x9481('0x30')]=_[_0x9481('0x31')](_0x46e4ab[_0x9481('0x30')]);_0x1addc8['filters']=_[_0x9481('0x32')](_0x1addc8[_0x9481('0x33')],_0x1addc8[_0x9481('0x30')]);_0x56752e['attributes']=_[_0x9481('0x32')](_0x1addc8[_0x9481('0x33')],qs[_0x9481('0x34')](_0x46e4ab[_0x9481('0x30')][_0x9481('0x34')]));_0x56752e[_0x9481('0x35')]=_0x56752e['attributes'][_0x9481('0x36')]?_0x56752e['attributes']:_0x1addc8[_0x9481('0x33')];if(!_0x46e4ab[_0x9481('0x30')][_0x9481('0x37')](_0x9481('0x38'))){_0x56752e[_0x9481('0x1e')]=qs[_0x9481('0x1e')](_0x46e4ab['query'][_0x9481('0x1e')]);_0x56752e[_0x9481('0x1f')]=qs['offset'](_0x46e4ab['query'][_0x9481('0x1f')]);}_0x56752e['order']=qs[_0x9481('0x39')](_0x46e4ab[_0x9481('0x30')][_0x9481('0x39')]);_0x56752e[_0x9481('0x3a')]=qs['filters'](_[_0x9481('0x3b')](_0x46e4ab['query'],_0x1addc8[_0x9481('0x3c')]),_0x42df68);if(_0x46e4ab['query'][_0x9481('0x3d')]){_0x56752e['where']=_[_0x9481('0x3e')](_0x56752e[_0x9481('0x3a')],{'$or':_[_0x9481('0x2d')](_0x42df68,function(_0x37c5c3){if(_0x37c5c3[_0x9481('0x3f')]!==_0x9481('0x40')){var _0xb6ff1={};_0xb6ff1[_0x37c5c3['name']]={'$like':'%'+_0x46e4ab[_0x9481('0x30')][_0x9481('0x3d')]+'%'};return _0xb6ff1;}})});}_0x56752e=_[_0x9481('0x3e')]({},_0x56752e,_0x46e4ab[_0x9481('0x41')]);var _0x3f1b6f={'where':_0x56752e[_0x9481('0x3a')]};return db[_0x9481('0x42')]['count'](_0x3f1b6f)[_0x9481('0x25')](function(_0x1872ff){_0x427c25['count']=_0x1872ff;if(_0x46e4ab[_0x9481('0x30')][_0x9481('0x43')]){_0x56752e[_0x9481('0x44')]=[{'all':!![]}];}return db[_0x9481('0x42')][_0x9481('0x45')](_0x56752e);})['then'](function(_0x304791){_0x427c25['rows']=_0x304791;return _0x427c25;})[_0x9481('0x25')](respondWithFilteredResult(_0x4895a0,_0x56752e))[_0x9481('0x46')](handleError(_0x4895a0,null));};exports['show']=function(_0x5ac68d,_0x398d8d){var _0x1d0df0={'raw':!![],'where':{'id':_0x5ac68d['params']['id']}},_0x42b19a={};_0x42b19a[_0x9481('0x33')]=_[_0x9481('0x31')](db['Disposition']['rawAttributes']);_0x42b19a[_0x9481('0x30')]=_['keys'](_0x5ac68d[_0x9481('0x30')]);_0x42b19a[_0x9481('0x3c')]=_[_0x9481('0x32')](_0x42b19a[_0x9481('0x33')],_0x42b19a[_0x9481('0x30')]);_0x1d0df0['attributes']=_[_0x9481('0x32')](_0x42b19a[_0x9481('0x33')],qs['fields'](_0x5ac68d[_0x9481('0x30')][_0x9481('0x34')]));_0x1d0df0[_0x9481('0x35')]=_0x1d0df0[_0x9481('0x35')][_0x9481('0x36')]?_0x1d0df0[_0x9481('0x35')]:_0x42b19a[_0x9481('0x33')];if(_0x5ac68d[_0x9481('0x30')][_0x9481('0x43')]){_0x1d0df0['include']=[{'all':!![]}];}_0x1d0df0=_[_0x9481('0x3e')]({},_0x1d0df0,_0x5ac68d['options']);return db['Disposition'][_0x9481('0x47')](_0x1d0df0)['then'](handleEntityNotFound(_0x398d8d,null))[_0x9481('0x25')](respondWithResult(_0x398d8d,null))[_0x9481('0x46')](handleError(_0x398d8d,null));};exports['create']=function(_0x277e2a,_0x1044a2){return db[_0x9481('0x42')][_0x9481('0x48')](_0x277e2a[_0x9481('0x49')],{})[_0x9481('0x25')](function(_0x4c5e54){var _0x5a2893=_0x277e2a[_0x9481('0x4a')][_0x9481('0x4b')]({'plain':!![]});if(!_0x5a2893)throw new Error(_0x9481('0x4c'));if(_0x5a2893[_0x9481('0x4d')]===_0x9481('0x4a')){var _0x353aab=_0x4c5e54[_0x9481('0x4b')]({'plain':!![]});var _0x3d2250='Dispositions';return db[_0x9481('0x4e')][_0x9481('0x47')]({'where':{'name':_0x3d2250,'userProfileId':_0x5a2893[_0x9481('0x4f')]},'raw':!![]})[_0x9481('0x25')](function(_0x1b3eac){if(_0x1b3eac&&_0x1b3eac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9481('0x48')]({'name':_0x353aab[_0x9481('0x2a')],'resourceId':_0x353aab['id'],'type':_0x1b3eac[_0x9481('0x2a')],'sectionId':_0x1b3eac['id']},{})['then'](function(){return _0x4c5e54;});}else{return _0x4c5e54;}})['catch'](function(_0x4bd225){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bd225);throw _0x4bd225;});}return _0x4c5e54;})['then'](respondWithResult(_0x1044a2,0xc9))['catch'](handleError(_0x1044a2,null));};exports[_0x9481('0x24')]=function(_0x136bd8,_0x588f7a){if(_0x136bd8[_0x9481('0x49')]['id']){delete _0x136bd8['body']['id'];}return db[_0x9481('0x42')][_0x9481('0x47')]({'where':{'id':_0x136bd8[_0x9481('0x50')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x588f7a,null))[_0x9481('0x25')](saveUpdates(_0x136bd8[_0x9481('0x49')],null))[_0x9481('0x25')](respondWithResult(_0x588f7a,null))['catch'](handleError(_0x588f7a,null));};exports[_0x9481('0x26')]=function(_0x1b51b7,_0x4dc5cc){return db[_0x9481('0x42')][_0x9481('0x47')]({'where':{'id':_0x1b51b7[_0x9481('0x50')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x4dc5cc,null))[_0x9481('0x25')](removeEntity(_0x4dc5cc,null))['catch'](handleError(_0x4dc5cc,null));}; \ No newline at end of file +var _0x19dd=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','name','send','index','Disposition','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x51cd7c,_0x59bee7){var _0xe383b3=function(_0x1bcaae){while(--_0x1bcaae){_0x51cd7c['push'](_0x51cd7c['shift']());}};_0xe383b3(++_0x59bee7);}(_0x19dd,0x18a));var _0xd19d=function(_0x51f46a,_0x5c8b19){_0x51f46a=_0x51f46a-0x0;var _0x24896c=_0x19dd[_0x51f46a];return _0x24896c;};'use strict';var emlformat=require(_0xd19d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd19d('0x1'));var jsonpatch=require(_0xd19d('0x2'));var rp=require(_0xd19d('0x3'));var moment=require(_0xd19d('0x4'));var BPromise=require(_0xd19d('0x5'));var Mustache=require(_0xd19d('0x6'));var util=require(_0xd19d('0x7'));var path=require(_0xd19d('0x8'));var sox=require(_0xd19d('0x9'));var csv=require('to-csv');var ejs=require(_0xd19d('0xa'));var fs=require('fs');var fs_extra=require(_0xd19d('0xb'));var _=require(_0xd19d('0xc'));var squel=require(_0xd19d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd19d('0xe'));var toCsv=require(_0xd19d('0xf'));var querystring=require(_0xd19d('0x10'));var Papa=require(_0xd19d('0x11'));var Redis=require('ioredis');var authService=require(_0xd19d('0x12'));var qs=require(_0xd19d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd19d('0x14'));var logger=require(_0xd19d('0x15'))('api');var utils=require(_0xd19d('0x16'));var config=require(_0xd19d('0x17'));var licenseUtil=require(_0xd19d('0x18'));var db=require(_0xd19d('0x19'))['db'];function respondWithStatusCode(_0x1ad154,_0x34aac0){_0x34aac0=_0x34aac0||0xcc;return function(_0x2a9a43){if(_0x2a9a43){return _0x1ad154[_0xd19d('0x1a')](_0x34aac0);}return _0x1ad154[_0xd19d('0x1b')](_0x34aac0)[_0xd19d('0x1c')]();};}function respondWithResult(_0x35bd70,_0x49cfc2){_0x49cfc2=_0x49cfc2||0xc8;return function(_0xead2e2){if(_0xead2e2){return _0x35bd70['status'](_0x49cfc2)['json'](_0xead2e2);}};}function respondWithFilteredResult(_0x1f0004,_0x559c58){return function(_0x45c988){if(_0x45c988){var _0x46f50=typeof _0x559c58[_0xd19d('0x1d')]===_0xd19d('0x1e')&&typeof _0x559c58[_0xd19d('0x1f')]==='undefined';var _0x39c5a0=_0x45c988[_0xd19d('0x20')];var _0x43d569=_0x46f50?0x0:_0x559c58[_0xd19d('0x1d')];var _0x180667=_0x46f50?_0x45c988[_0xd19d('0x20')]:_0x559c58['offset']+_0x559c58[_0xd19d('0x1f')];var _0xa520;if(_0x180667>=_0x39c5a0){_0x180667=_0x39c5a0;_0xa520=0xc8;}else{_0xa520=0xce;}_0x1f0004[_0xd19d('0x1b')](_0xa520);return _0x1f0004[_0xd19d('0x21')](_0xd19d('0x22'),_0x43d569+'-'+_0x180667+'/'+_0x39c5a0)[_0xd19d('0x23')](_0x45c988);}return null;};}function patchUpdates(_0x4b361b){return function(_0x3121ef){try{jsonpatch[_0xd19d('0x24')](_0x3121ef,_0x4b361b,!![]);}catch(_0x221630){return BPromise[_0xd19d('0x25')](_0x221630);}return _0x3121ef[_0xd19d('0x26')]();};}function saveUpdates(_0x444570,_0x1cc92b){return function(_0x2437e9){if(_0x2437e9){return _0x2437e9[_0xd19d('0x27')](_0x444570)[_0xd19d('0x28')](function(_0x5da7c4){return _0x5da7c4;});}return null;};}function removeEntity(_0x320c69,_0x20648d){return function(_0x26da83){if(_0x26da83){return _0x26da83[_0xd19d('0x29')]()[_0xd19d('0x28')](function(){var _0x5a8e5d=_0x26da83[_0xd19d('0x2a')]({'plain':!![]});var _0x38ff48=_0xd19d('0x2b');return db[_0xd19d('0x2c')][_0xd19d('0x29')]({'where':{'type':_0x38ff48,'resourceId':_0x5a8e5d['id']}})[_0xd19d('0x28')](function(){return _0x26da83;});})[_0xd19d('0x28')](function(){_0x320c69[_0xd19d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9a6c,_0x2d9160){return function(_0x14d608){if(!_0x14d608){_0x9a6c[_0xd19d('0x1a')](0x194);}return _0x14d608;};}function handleError(_0x12177f,_0x4a16fe){_0x4a16fe=_0x4a16fe||0x1f4;return function(_0x249d7e){logger['error'](_0x249d7e['stack']);if(_0x249d7e[_0xd19d('0x2d')]){delete _0x249d7e[_0xd19d('0x2d')];}_0x12177f[_0xd19d('0x1b')](_0x4a16fe)[_0xd19d('0x2e')](_0x249d7e);};}exports[_0xd19d('0x2f')]=function(_0x1f9254,_0x4599b1){var _0x315860={},_0x1cb844={},_0x350751={'count':0x0,'rows':[]};var _0x46801b=_['map'](db[_0xd19d('0x30')][_0xd19d('0x31')],function(_0x521d56){return{'name':_0x521d56[_0xd19d('0x32')],'type':_0x521d56[_0xd19d('0x33')][_0xd19d('0x34')]};});_0x1cb844[_0xd19d('0x35')]=_[_0xd19d('0x36')](_0x46801b,_0xd19d('0x2d'));_0x1cb844[_0xd19d('0x37')]=_[_0xd19d('0x38')](_0x1f9254[_0xd19d('0x37')]);_0x1cb844['filters']=_[_0xd19d('0x39')](_0x1cb844[_0xd19d('0x35')],_0x1cb844[_0xd19d('0x37')]);_0x315860[_0xd19d('0x3a')]=_['intersection'](_0x1cb844['model'],qs[_0xd19d('0x3b')](_0x1f9254[_0xd19d('0x37')][_0xd19d('0x3b')]));_0x315860[_0xd19d('0x3a')]=_0x315860[_0xd19d('0x3a')]['length']?_0x315860[_0xd19d('0x3a')]:_0x1cb844['model'];if(!_0x1f9254[_0xd19d('0x37')][_0xd19d('0x3c')](_0xd19d('0x3d'))){_0x315860[_0xd19d('0x1f')]=qs[_0xd19d('0x1f')](_0x1f9254[_0xd19d('0x37')][_0xd19d('0x1f')]);_0x315860[_0xd19d('0x1d')]=qs[_0xd19d('0x1d')](_0x1f9254[_0xd19d('0x37')][_0xd19d('0x1d')]);}_0x315860['order']=qs['sort'](_0x1f9254[_0xd19d('0x37')][_0xd19d('0x3e')]);_0x315860['where']=qs['filters'](_['pick'](_0x1f9254[_0xd19d('0x37')],_0x1cb844[_0xd19d('0x3f')]),_0x46801b);if(_0x1f9254[_0xd19d('0x37')]['filter']){_0x315860['where']=_[_0xd19d('0x40')](_0x315860[_0xd19d('0x41')],{'$or':_[_0xd19d('0x36')](_0x46801b,function(_0x133264){if(_0x133264['type']!==_0xd19d('0x42')){var _0x440aa1={};_0x440aa1[_0x133264[_0xd19d('0x2d')]]={'$like':'%'+_0x1f9254[_0xd19d('0x37')]['filter']+'%'};return _0x440aa1;}})});}_0x315860=_['merge']({},_0x315860,_0x1f9254[_0xd19d('0x43')]);var _0x145f3c={'where':_0x315860[_0xd19d('0x41')]};return db[_0xd19d('0x30')]['count'](_0x145f3c)[_0xd19d('0x28')](function(_0x54241c){_0x350751[_0xd19d('0x20')]=_0x54241c;if(_0x1f9254[_0xd19d('0x37')][_0xd19d('0x44')]){_0x315860[_0xd19d('0x45')]=[{'all':!![]}];}return db[_0xd19d('0x30')][_0xd19d('0x46')](_0x315860);})[_0xd19d('0x28')](function(_0x3b314d){_0x350751['rows']=_0x3b314d;return _0x350751;})[_0xd19d('0x28')](respondWithFilteredResult(_0x4599b1,_0x315860))[_0xd19d('0x47')](handleError(_0x4599b1,null));};exports['show']=function(_0x38bb3d,_0x537488){var _0x368fd1={'raw':!![],'where':{'id':_0x38bb3d[_0xd19d('0x48')]['id']}},_0x422959={};_0x422959[_0xd19d('0x35')]=_[_0xd19d('0x38')](db['Disposition']['rawAttributes']);_0x422959[_0xd19d('0x37')]=_[_0xd19d('0x38')](_0x38bb3d[_0xd19d('0x37')]);_0x422959[_0xd19d('0x3f')]=_[_0xd19d('0x39')](_0x422959[_0xd19d('0x35')],_0x422959[_0xd19d('0x37')]);_0x368fd1[_0xd19d('0x3a')]=_[_0xd19d('0x39')](_0x422959[_0xd19d('0x35')],qs[_0xd19d('0x3b')](_0x38bb3d['query'][_0xd19d('0x3b')]));_0x368fd1['attributes']=_0x368fd1['attributes'][_0xd19d('0x49')]?_0x368fd1[_0xd19d('0x3a')]:_0x422959[_0xd19d('0x35')];if(_0x38bb3d['query']['includeAll']){_0x368fd1['include']=[{'all':!![]}];}_0x368fd1=_['merge']({},_0x368fd1,_0x38bb3d[_0xd19d('0x43')]);return db[_0xd19d('0x30')]['find'](_0x368fd1)[_0xd19d('0x28')](handleEntityNotFound(_0x537488,null))[_0xd19d('0x28')](respondWithResult(_0x537488,null))[_0xd19d('0x47')](handleError(_0x537488,null));};exports[_0xd19d('0x4a')]=function(_0x2dd728,_0x4f1a5d){return db[_0xd19d('0x30')][_0xd19d('0x4a')](_0x2dd728[_0xd19d('0x4b')],{})['then'](function(_0x4a0527){var _0x635877=_0x2dd728[_0xd19d('0x4c')][_0xd19d('0x2a')]({'plain':!![]});if(!_0x635877)throw new Error(_0xd19d('0x4d'));if(_0x635877[_0xd19d('0x4e')]==='user'){var _0x56adc5=_0x4a0527[_0xd19d('0x2a')]({'plain':!![]});var _0x372bc3=_0xd19d('0x2b');return db[_0xd19d('0x4f')][_0xd19d('0x50')]({'where':{'name':_0x372bc3,'userProfileId':_0x635877[_0xd19d('0x51')]},'raw':!![]})[_0xd19d('0x28')](function(_0x254556){if(_0x254556&&_0x254556[_0xd19d('0x52')]===0x0){return db[_0xd19d('0x2c')][_0xd19d('0x4a')]({'name':_0x56adc5[_0xd19d('0x2d')],'resourceId':_0x56adc5['id'],'type':_0x254556[_0xd19d('0x2d')],'sectionId':_0x254556['id']},{})[_0xd19d('0x28')](function(){return _0x4a0527;});}else{return _0x4a0527;}})[_0xd19d('0x47')](function(_0x33ea79){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33ea79);throw _0x33ea79;});}return _0x4a0527;})[_0xd19d('0x28')](respondWithResult(_0x4f1a5d,0xc9))['catch'](handleError(_0x4f1a5d,null));};exports[_0xd19d('0x27')]=function(_0x39e528,_0x3a7c26){if(_0x39e528[_0xd19d('0x4b')]['id']){delete _0x39e528[_0xd19d('0x4b')]['id'];}return db[_0xd19d('0x30')]['find']({'where':{'id':_0x39e528[_0xd19d('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a7c26,null))['then'](saveUpdates(_0x39e528['body'],null))[_0xd19d('0x28')](respondWithResult(_0x3a7c26,null))[_0xd19d('0x47')](handleError(_0x3a7c26,null));};exports[_0xd19d('0x29')]=function(_0x2069a,_0x5bc63b){return db['Disposition'][_0xd19d('0x50')]({'where':{'id':_0x2069a[_0xd19d('0x48')]['id']}})[_0xd19d('0x28')](handleEntityNotFound(_0x5bc63b,null))[_0xd19d('0x28')](removeEntity(_0x5bc63b,null))[_0xd19d('0x47')](handleError(_0x5bc63b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 80c8f98..d4c4774 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 _0xd25b=['ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','rimraf','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat'];(function(_0x59db34,_0x593726){var _0x568a53=function(_0x2bf3b4){while(--_0x2bf3b4){_0x59db34['push'](_0x59db34['shift']());}};_0x568a53(++_0x593726);}(_0xd25b,0x7d));var _0xbd25=function(_0x18e833,_0x220e11){_0x18e833=_0x18e833-0x0;var _0x5229d8=_0xd25b[_0x18e833];return _0x5229d8;};'use strict';var _=require(_0xbd25('0x0'));var util=require('util');var logger=require(_0xbd25('0x1'))(_0xbd25('0x2'));var moment=require(_0xbd25('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbd25('0x4'));var config=require('../../config/environment');var attributes=require(_0xbd25('0x5'));module['exports']=function(_0x197fd8,_0x20ff67){return _0x197fd8[_0xbd25('0x6')](_0xbd25('0x7'),attributes,{'tableName':_0xbd25('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xbd25('0x9'),'fields':[_0xbd25('0xa'),_0xbd25('0xb')]},{'unique':!![],'name':_0xbd25('0xc'),'fields':[_0xbd25('0xa'),_0xbd25('0xd')]},{'unique':!![],'name':_0xbd25('0xe'),'fields':[_0xbd25('0xa'),_0xbd25('0xf')]},{'unique':!![],'name':'name_sms','fields':['name',_0xbd25('0x10')]},{'unique':!![],'name':_0xbd25('0x11'),'fields':[_0xbd25('0xa'),_0xbd25('0x12')]},{'unique':!![],'name':_0xbd25('0x13'),'fields':[_0xbd25('0xa'),_0xbd25('0x14')]},{'unique':!![],'name':_0xbd25('0x15'),'fields':[_0xbd25('0xa'),_0xbd25('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbeda=['name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','Disposition','tools_dispositions','name','ListId'];(function(_0x3da308,_0x11a6aa){var _0x1b0cec=function(_0x3db681){while(--_0x3db681){_0x3da308['push'](_0x3da308['shift']());}};_0x1b0cec(++_0x11a6aa);}(_0xbeda,0x195));var _0xabed=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0xbeda[_0x1e4f2d];return _0xd05ce5;};'use strict';var _=require(_0xabed('0x0'));var util=require(_0xabed('0x1'));var logger=require(_0xabed('0x2'))(_0xabed('0x3'));var moment=require(_0xabed('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xabed('0x5'));var rimraf=require(_0xabed('0x6'));var config=require(_0xabed('0x7'));var attributes=require('./disposition.attributes');module[_0xabed('0x8')]=function(_0x9ffa55,_0x779b47){return _0x9ffa55['define'](_0xabed('0x9'),attributes,{'tableName':_0xabed('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xabed('0xb'),_0xabed('0xc')]},{'unique':!![],'name':_0xabed('0xd'),'fields':[_0xabed('0xb'),_0xabed('0xe')]},{'unique':!![],'name':_0xabed('0xf'),'fields':[_0xabed('0xb'),'MailAccountId']},{'unique':!![],'name':_0xabed('0x10'),'fields':[_0xabed('0xb'),_0xabed('0x11')]},{'unique':!![],'name':_0xabed('0x12'),'fields':[_0xabed('0xb'),_0xabed('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0xabed('0xb'),_0xabed('0x14')]},{'unique':!![],'name':_0xabed('0x15'),'fields':[_0xabed('0xb'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f0baf1c..da183be 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(_0x1e8278,_0x413a4e){var _0x300ec6=function(_0x30c35e){while(--_0x30c35e){_0x1e8278['push'](_0x1e8278['shift']());}};_0x300ec6(++_0x413a4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x2d7df8,_0x469a64){var _0x58d726=function(_0x40cd87){while(--_0x40cd87){_0x2d7df8['push'](_0x2d7df8['shift']());}};_0x58d726(++_0x469a64);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 f4a937c..fdf7ae7 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 _0xaa3c=['/:id','isAuthenticated','post','create','put','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xaa3c,0xd8));var _0xcaa3=function(_0x456921,_0x28586c){_0x456921=_0x456921-0x0;var _0x59d4b0=_0xaa3c[_0x456921];return _0x59d4b0;};'use strict';var multer=require('multer');var util=require(_0xcaa3('0x0'));var path=require('path');var timeout=require(_0xcaa3('0x1'));var express=require(_0xcaa3('0x2'));var router=express[_0xcaa3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcaa3('0x4'));var interaction=require(_0xcaa3('0x5'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0xcaa3('0x6')]('/',auth['isAuthenticated'](),controller[_0xcaa3('0x7')]);router['get'](_0xcaa3('0x8'),auth[_0xcaa3('0x9')](),controller['show']);router[_0xcaa3('0xa')]('/',auth[_0xcaa3('0x9')](),controller[_0xcaa3('0xb')]);router[_0xcaa3('0xc')](_0xcaa3('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xcaa3('0xd')](_0xcaa3('0x8'),auth['isAuthenticated'](),controller[_0xcaa3('0xe')]);module[_0xcaa3('0xf')]=router; \ No newline at end of file +var _0x21ad=['./disposition.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5c4b95,_0xe74971){var _0x34fff4=function(_0x1278b3){while(--_0x1278b3){_0x5c4b95['push'](_0x5c4b95['shift']());}};_0x34fff4(++_0xe74971);}(_0x21ad,0x1b0));var _0xd21a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x21ad[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0xd21a('0x0'));var util=require('util');var path=require(_0xd21a('0x1'));var timeout=require(_0xd21a('0x2'));var express=require(_0xd21a('0x3'));var router=express[_0xd21a('0x4')]();var fs_extra=require(_0xd21a('0x5'));var auth=require(_0xd21a('0x6'));var interaction=require(_0xd21a('0x7'));var config=require('../../config/environment');var controller=require(_0xd21a('0x8'));router[_0xd21a('0x9')]('/',auth[_0xd21a('0xa')](),controller[_0xd21a('0xb')]);router[_0xd21a('0x9')](_0xd21a('0xc'),auth[_0xd21a('0xa')](),controller['show']);router[_0xd21a('0xd')]('/',auth[_0xd21a('0xa')](),controller[_0xd21a('0xe')]);router[_0xd21a('0xf')](_0xd21a('0xc'),auth[_0xd21a('0xa')](),controller[_0xd21a('0x10')]);router[_0xd21a('0x11')](_0xd21a('0xc'),auth[_0xd21a('0xa')](),controller[_0xd21a('0x12')]);module[_0xd21a('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 4c3b1a3..14da6c4 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 _0x3c94=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0x3c94,0xcd));var _0x43c9=function(_0x40ecd0,_0x27de55){_0x40ecd0=_0x40ecd0-0x0;var _0x5a9953=_0x3c94[_0x40ecd0];return _0x5a9953;};'use strict';var Sequelize=require(_0x43c9('0x0'));module[_0x43c9('0x1')]={'name':{'type':Sequelize[_0x43c9('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x43c9('0x2')]},'ecm':{'type':Sequelize[_0x43c9('0x3')](_0x43c9('0x4'),'no'),'defaultValue':_0x43c9('0x4')},'headerinfo':{'type':Sequelize[_0x43c9('0x2')],'defaultValue':_0x43c9('0x5')},'localstationid':{'type':Sequelize[_0x43c9('0x2')],'unique':_0x43c9('0x6')},'minrate':{'type':Sequelize[_0x43c9('0x3')]('2400',_0x43c9('0x7'),_0x43c9('0x8'),_0x43c9('0x9'),_0x43c9('0xa'),_0x43c9('0xb')),'defaultValue':_0x43c9('0x7')},'maxrate':{'type':Sequelize[_0x43c9('0x3')](_0x43c9('0xc'),_0x43c9('0x7'),'7200',_0x43c9('0x9'),_0x43c9('0xa'),_0x43c9('0xb')),'defaultValue':_0x43c9('0xb')},'modem':{'type':Sequelize[_0x43c9('0x2')],'defaultValue':_0x43c9('0xd')},'gateway':{'type':Sequelize[_0x43c9('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x43c9('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x43c9('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x43c9('0x3')](_0x43c9('0xf'),_0x43c9('0x10'),_0x43c9('0x11'),_0x43c9('0x12')),'defaultValue':_0x43c9('0xf')},'key':{'type':Sequelize[_0x43c9('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x43c9('0x13')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x43c9('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x43c9('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x43c9('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x43c9('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x43c9('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x43c9('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x43c9('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x43c9('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x43c9('0x14')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1d63cf){if(!_0x1d63cf)this[_0x43c9('0x16')](_0x43c9('0x17'),null);this[_0x43c9('0x16')](_0x43c9('0x18'),_0x1d63cf);}}}; \ No newline at end of file +var _0x8958=['7200','9600','12000','ENUM','14400','INTEGER','SIP','IAX','KHOMP','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','yes','xCALLY\x20Motion\x20Fax','STRING','localstationid','2400','4800'];(function(_0x326e38,_0x27421c){var _0x2f1690=function(_0x53cefb){while(--_0x53cefb){_0x326e38['push'](_0x326e38['shift']());}};_0x2f1690(++_0x27421c);}(_0x8958,0x93));var _0x8895=function(_0x4fb39d,_0x2bd254){_0x4fb39d=_0x4fb39d-0x0;var _0x54b54e=_0x8958[_0x4fb39d];return _0x54b54e;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x8895('0x1')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x8895('0x2')},'localstationid':{'type':Sequelize[_0x8895('0x3')],'unique':_0x8895('0x4')},'minrate':{'type':Sequelize['ENUM'](_0x8895('0x5'),_0x8895('0x6'),_0x8895('0x7'),_0x8895('0x8'),_0x8895('0x9'),'14400'),'defaultValue':_0x8895('0x6')},'maxrate':{'type':Sequelize[_0x8895('0xa')](_0x8895('0x5'),_0x8895('0x6'),_0x8895('0x7'),_0x8895('0x8'),_0x8895('0x9'),_0x8895('0xb')),'defaultValue':_0x8895('0xb')},'modem':{'type':Sequelize[_0x8895('0x3')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x8895('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8895('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8895('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8895('0xa')](_0x8895('0xd'),_0x8895('0xe'),'DADHI',_0x8895('0xf')),'defaultValue':_0x8895('0xd')},'key':{'type':Sequelize[_0x8895('0x3')],'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[_0x8895('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8895('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8895('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8895('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8895('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8895('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8895('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x8895('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x8895('0x10')],'defaultValue':![],'comment':_0x8895('0x12'),'set':function(_0x2848b7){if(!_0x2848b7)this[_0x8895('0x13')](_0x8895('0x14'),null);this[_0x8895('0x13')](_0x8895('0x15'),_0x2848b7);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 9029864..711e290 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 _0x3132=['sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','modem','t38timeout','FAXOPT(','ReceiveFax','transaction','VoiceExtension','updateAccountApplications','key','createdAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','CmList','List','CmContact','Contacts','updatedAt','attachments','join','server/files/attachments','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','FaxAccountId','Disposition','create','getDispositions','findOne','rawAttributes','hasOwnProperty','options','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','internal','Tags','tag'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3132,0x1cf));var _0x2313=function(_0x5bfa44,_0x76dacc){_0x5bfa44=_0x5bfa44-0x0;var _0x43815f=_0x3132[_0x5bfa44];return _0x43815f;};'use strict';var emlformat=require(_0x2313('0x0'));var rimraf=require(_0x2313('0x1'));var zipdir=require(_0x2313('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2313('0x3'));var moment=require(_0x2313('0x4'));var BPromise=require(_0x2313('0x5'));var Mustache=require(_0x2313('0x6'));var util=require(_0x2313('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2313('0x8'));var ejs=require(_0x2313('0x9'));var fs=require('fs');var fs_extra=require(_0x2313('0xa'));var _=require(_0x2313('0xb'));var squel=require(_0x2313('0xc'));var crypto=require(_0x2313('0xd'));var jsforce=require(_0x2313('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2313('0x8'));var querystring=require(_0x2313('0xf'));var Papa=require('papaparse');var Redis=require(_0x2313('0x10'));var authService=require(_0x2313('0x11'));var qs=require(_0x2313('0x12'));var as=require(_0x2313('0x13'));var hardwareService=require(_0x2313('0x14'));var logger=require(_0x2313('0x15'))(_0x2313('0x16'));var utils=require(_0x2313('0x17'));var config=require(_0x2313('0x18'));var licenseUtil=require(_0x2313('0x19'));var db=require('../../mysqldb')['db'];config[_0x2313('0x1a')]=_[_0x2313('0x1b')](config[_0x2313('0x1a')],{'host':_0x2313('0x1c'),'port':0x18eb});var socket=require(_0x2313('0x1d'))(new Redis(config[_0x2313('0x1a')]));require(_0x2313('0x1e'))[_0x2313('0x1f')](socket);var jayson=require(_0x2313('0x20'));var client=jayson[_0x2313('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x2313('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x415a55,_0x44ee7a,_0x1dc31,_0x2b3536){return new BPromise(function(_0x2fe95a,_0x6a43e4){var _0x5a2cb2=_0x2b3536||client;return _0x5a2cb2['request'](_0x415a55,_0x1dc31)[_0x2313('0x22')](function(_0x1de0dc){logger[_0x2313('0x23')](_0x2313('0x24'),_0x44ee7a,_0x2313('0x25'));logger[_0x2313('0x26')](_0x2313('0x27'),_0x44ee7a,'request\x20sent',JSON[_0x2313('0x28')](_0x1de0dc));if(_0x1de0dc['error']){if(_0x1de0dc['error']['code']===0x1f4){logger[_0x2313('0x29')](_0x2313('0x24'),_0x44ee7a,_0x1de0dc[_0x2313('0x29')][_0x2313('0x2a')]);return _0x6a43e4(_0x1de0dc[_0x2313('0x29')][_0x2313('0x2a')]);}logger[_0x2313('0x29')](_0x2313('0x24'),_0x44ee7a,_0x1de0dc[_0x2313('0x29')]['message']);return _0x2fe95a(_0x1de0dc['error'][_0x2313('0x2a')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x44ee7a,_0x2313('0x25'));_0x2fe95a(_0x1de0dc[_0x2313('0x2b')][_0x2313('0x2a')]);}})[_0x2313('0x2c')](function(_0x407505){logger['error'](_0x2313('0x24'),_0x44ee7a,_0x407505);_0x6a43e4(_0x407505);});});}function respondWithStatusCode(_0x5680c7,_0x2ae60e){_0x2ae60e=_0x2ae60e||0xcc;return function(_0x26c281){if(_0x26c281){return _0x5680c7[_0x2313('0x2d')](_0x2ae60e);}return _0x5680c7[_0x2313('0x2e')](_0x2ae60e)[_0x2313('0x2f')]();};}function respondWithResult(_0x55a64f,_0x5bafdb){_0x5bafdb=_0x5bafdb||0xc8;return function(_0x165a64){if(_0x165a64){return _0x55a64f[_0x2313('0x2e')](_0x5bafdb)[_0x2313('0x30')](_0x165a64);}};}function respondWithFilteredResult(_0x31f0f7,_0x5ef55a){return function(_0x4419fa){if(_0x4419fa){var _0x46f44e=typeof _0x5ef55a[_0x2313('0x31')]===_0x2313('0x32')&&typeof _0x5ef55a['limit']==='undefined';var _0x5cc4f6=_0x4419fa[_0x2313('0x33')];var _0x106731=_0x46f44e?0x0:_0x5ef55a[_0x2313('0x31')];var _0x3ac2ef=_0x46f44e?_0x4419fa[_0x2313('0x33')]:_0x5ef55a['offset']+_0x5ef55a[_0x2313('0x34')];var _0x16e32c;if(_0x3ac2ef>=_0x5cc4f6){_0x3ac2ef=_0x5cc4f6;_0x16e32c=0xc8;}else{_0x16e32c=0xce;}_0x31f0f7['status'](_0x16e32c);return _0x31f0f7[_0x2313('0x35')](_0x2313('0x36'),_0x106731+'-'+_0x3ac2ef+'/'+_0x5cc4f6)[_0x2313('0x30')](_0x4419fa);}return null;};}function patchUpdates(_0x87cf81){return function(_0x13e950){try{jsonpatch[_0x2313('0x37')](_0x13e950,_0x87cf81,!![]);}catch(_0x1ab6e2){return BPromise[_0x2313('0x38')](_0x1ab6e2);}return _0x13e950[_0x2313('0x39')]();};}function saveUpdates(_0x7ba58e,_0x467a40){return function(_0x41832f){if(_0x41832f){return _0x41832f['update'](_0x7ba58e)[_0x2313('0x22')](function(_0x5a5d8b){return _0x5a5d8b;});}return null;};}function removeEntity(_0x423c0d,_0x43dba0){return function(_0x5bf298){if(_0x5bf298){return _0x5bf298[_0x2313('0x3a')]()['then'](function(){var _0x3cabc9=_0x5bf298[_0x2313('0x3b')]({'plain':!![]});var _0x42b817='FaxAccounts';return db[_0x2313('0x3c')][_0x2313('0x3a')]({'where':{'type':_0x42b817,'resourceId':_0x3cabc9['id']}})[_0x2313('0x22')](function(){return _0x5bf298;});})[_0x2313('0x22')](function(){_0x423c0d['status'](0xcc)[_0x2313('0x2f')]();});}};}function handleEntityNotFound(_0x2a5b14,_0x4343de){return function(_0x223c66){if(!_0x223c66){_0x2a5b14['sendStatus'](0x194);}return _0x223c66;};}function handleError(_0x5d4eb1,_0x1085e8){_0x1085e8=_0x1085e8||0x1f4;return function(_0x35d333){logger[_0x2313('0x29')](_0x35d333[_0x2313('0x3d')]);if(_0x35d333[_0x2313('0x3e')]){delete _0x35d333[_0x2313('0x3e')];}_0x5d4eb1['status'](_0x1085e8)[_0x2313('0x3f')](_0x35d333);};}exports[_0x2313('0x40')]=function(_0x494db3,_0x9a9048){var _0x1bfbf0={'include':[{'model':db[_0x2313('0x41')],'as':_0x2313('0x42')}]},_0x5bc71a={},_0x49779a={'count':0x0,'rows':[]};var _0x5b8647=_[_0x2313('0x43')](db[_0x2313('0x44')]['rawAttributes'],function(_0x30e0c2){return{'name':_0x30e0c2[_0x2313('0x45')],'type':_0x30e0c2[_0x2313('0x46')]['key']};});_0x5bc71a[_0x2313('0x47')]=_[_0x2313('0x43')](_0x5b8647,'name');_0x5bc71a[_0x2313('0x48')]=_['keys'](_0x494db3['query']);_0x5bc71a[_0x2313('0x49')]=_[_0x2313('0x4a')](_0x5bc71a[_0x2313('0x47')],_0x5bc71a[_0x2313('0x48')]);_0x1bfbf0[_0x2313('0x4b')]=_[_0x2313('0x4a')](_0x5bc71a[_0x2313('0x47')],qs['fields'](_0x494db3[_0x2313('0x48')][_0x2313('0x4c')]));_0x1bfbf0[_0x2313('0x4b')]=_0x1bfbf0[_0x2313('0x4b')][_0x2313('0x4d')]?_0x1bfbf0[_0x2313('0x4b')]:_0x5bc71a[_0x2313('0x47')];if(!_0x494db3[_0x2313('0x48')]['hasOwnProperty'](_0x2313('0x4e'))){_0x1bfbf0['limit']=qs[_0x2313('0x34')](_0x494db3['query'][_0x2313('0x34')]);_0x1bfbf0[_0x2313('0x31')]=qs[_0x2313('0x31')](_0x494db3[_0x2313('0x48')][_0x2313('0x31')]);}_0x1bfbf0[_0x2313('0x4f')]=qs['sort'](_0x494db3[_0x2313('0x48')][_0x2313('0x50')]);_0x1bfbf0[_0x2313('0x51')]=qs[_0x2313('0x49')](_[_0x2313('0x52')](_0x494db3[_0x2313('0x48')],_0x5bc71a[_0x2313('0x49')]),_0x5b8647);if(_0x494db3[_0x2313('0x48')][_0x2313('0x53')]){_0x1bfbf0[_0x2313('0x51')]=_[_0x2313('0x54')](_0x1bfbf0[_0x2313('0x51')],{'$or':_[_0x2313('0x43')](_0x5b8647,function(_0x57830c){if(_0x57830c[_0x2313('0x46')]!==_0x2313('0x55')){var _0x1e279f={};_0x1e279f[_0x57830c['name']]={'$like':'%'+_0x494db3['query']['filter']+'%'};return _0x1e279f;}})});}_0x1bfbf0=_[_0x2313('0x54')]({},_0x1bfbf0,_0x494db3['options']);var _0x4da470={'where':_0x1bfbf0[_0x2313('0x51')]};return db['FaxAccount'][_0x2313('0x33')](_0x4da470)[_0x2313('0x22')](function(_0x126fda){_0x49779a[_0x2313('0x33')]=_0x126fda;if(_0x494db3[_0x2313('0x48')][_0x2313('0x56')]){_0x1bfbf0[_0x2313('0x57')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x1bfbf0);})[_0x2313('0x22')](function(_0x259aa7){_0x49779a[_0x2313('0x58')]=_0x259aa7;return _0x49779a;})[_0x2313('0x22')](respondWithFilteredResult(_0x9a9048,_0x1bfbf0))[_0x2313('0x2c')](handleError(_0x9a9048,null));};exports['show']=function(_0x2540b6,_0x29c212){var _0x50776e={'raw':![],'where':{'id':_0x2540b6['params']['id']},'include':[{'model':db[_0x2313('0x41')],'as':_0x2313('0x42')}]},_0x42ba52={};_0x42ba52['model']=_[_0x2313('0x59')](db['FaxAccount']['rawAttributes']);_0x42ba52[_0x2313('0x48')]=_[_0x2313('0x59')](_0x2540b6[_0x2313('0x48')]);_0x42ba52[_0x2313('0x49')]=_['intersection'](_0x42ba52[_0x2313('0x47')],_0x42ba52[_0x2313('0x48')]);_0x50776e[_0x2313('0x4b')]=_[_0x2313('0x4a')](_0x42ba52[_0x2313('0x47')],qs[_0x2313('0x4c')](_0x2540b6['query'][_0x2313('0x4c')]));_0x50776e[_0x2313('0x4b')]=_0x50776e[_0x2313('0x4b')][_0x2313('0x4d')]?_0x50776e['attributes']:_0x42ba52[_0x2313('0x47')];if(_0x2540b6[_0x2313('0x48')][_0x2313('0x56')]){_0x50776e['include']=[{'all':!![]}];}_0x50776e=_[_0x2313('0x54')]({},_0x50776e,_0x2540b6['options']);return db[_0x2313('0x44')][_0x2313('0x5a')](_0x50776e)[_0x2313('0x22')](handleEntityNotFound(_0x29c212,null))[_0x2313('0x22')](respondWithResult(_0x29c212,null))[_0x2313('0x2c')](handleError(_0x29c212,null));};exports['create']=function(_0x16d06d,_0x375844){return db['FaxAccount']['create'](_0x16d06d[_0x2313('0x5b')],{})[_0x2313('0x22')](function(_0x35ef2d){var _0x2c30e2=_0x16d06d[_0x2313('0x5c')][_0x2313('0x3b')]({'plain':!![]});if(!_0x2c30e2)throw new Error(_0x2313('0x5d'));if(_0x2c30e2[_0x2313('0x5e')]===_0x2313('0x5c')){var _0x327a86=_0x35ef2d['get']({'plain':!![]});var _0x4a3878=_0x2313('0x5f');return db[_0x2313('0x60')][_0x2313('0x5a')]({'where':{'name':_0x4a3878,'userProfileId':_0x2c30e2[_0x2313('0x61')]},'raw':!![]})[_0x2313('0x22')](function(_0x5c8395){if(_0x5c8395&&_0x5c8395[_0x2313('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x327a86[_0x2313('0x3e')],'resourceId':_0x327a86['id'],'type':_0x5c8395[_0x2313('0x3e')],'sectionId':_0x5c8395['id']},{})[_0x2313('0x22')](function(){return _0x35ef2d;});}else{return _0x35ef2d;}})[_0x2313('0x2c')](function(_0xcf4342){logger[_0x2313('0x29')](_0x2313('0x63'),_0xcf4342);throw _0xcf4342;});}return _0x35ef2d;})['then'](respondWithResult(_0x375844,0xc9))[_0x2313('0x2c')](handleError(_0x375844,null));};exports[_0x2313('0x64')]=function(_0x2570f2,_0x2d15bb){if(_0x2570f2['body']['id']){delete _0x2570f2['body']['id'];}return db['FaxAccount'][_0x2313('0x5a')]({'where':{'id':_0x2570f2[_0x2313('0x65')]['id']},'include':[{'model':db[_0x2313('0x41')],'as':_0x2313('0x42')}]})[_0x2313('0x22')](handleEntityNotFound(_0x2d15bb,null))[_0x2313('0x22')](saveUpdates(_0x2570f2['body'],null))['then'](respondWithResult(_0x2d15bb,null))[_0x2313('0x2c')](handleError(_0x2d15bb,null));};exports['destroy']=function(_0x11f1c9,_0x131e69){return db[_0x2313('0x44')]['find']({'where':{'id':_0x11f1c9[_0x2313('0x65')]['id']}})[_0x2313('0x22')](handleEntityNotFound(_0x131e69,null))[_0x2313('0x22')](removeEntity(_0x131e69,null))[_0x2313('0x2c')](handleError(_0x131e69,null));};exports['describe']=function(_0xaef4ff,_0xe55174){return db['FaxAccount'][_0x2313('0x66')]()[_0x2313('0x22')](respondWithResult(_0xe55174,null))['catch'](handleError(_0xe55174,null));};exports['addDisposition']=function(_0x2b289c,_0x3dedfb,_0x11f73b){if(_0x2b289c[_0x2313('0x5b')]['id']){delete _0x2b289c[_0x2313('0x5b')]['id'];}return db[_0x2313('0x44')][_0x2313('0x5a')]({'where':{'id':_0x2b289c[_0x2313('0x65')]['id']}})[_0x2313('0x22')](handleEntityNotFound(_0x3dedfb,null))[_0x2313('0x22')](function(_0x408ea8){if(_0x408ea8){_0x2b289c[_0x2313('0x5b')][_0x2313('0x67')]=_0x408ea8['id'];return db[_0x2313('0x68')][_0x2313('0x69')](_0x2b289c[_0x2313('0x5b')]);}})[_0x2313('0x22')](respondWithResult(_0x3dedfb,null))[_0x2313('0x2c')](handleError(_0x3dedfb,null));};exports[_0x2313('0x6a')]=function(_0x4fa002,_0x3ee0c9,_0xf95791){var _0x35c8cf={'raw':![],'where':{}};var _0x26d3be={};var _0x251000={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2313('0x6b')]({'where':{'id':_0x4fa002[_0x2313('0x65')]['id']}})['then'](handleEntityNotFound(_0x3ee0c9,null))[_0x2313('0x22')](function(_0x4cc70a){if(_0x4cc70a){_0x26d3be['model']=_[_0x2313('0x59')](db['Disposition'][_0x2313('0x6c')]);_0x26d3be[_0x2313('0x48')]=_['keys'](_0x4fa002[_0x2313('0x48')]);_0x26d3be[_0x2313('0x49')]=_['intersection'](_0x26d3be[_0x2313('0x47')],_0x26d3be[_0x2313('0x48')]);_0x35c8cf[_0x2313('0x4b')]=_['intersection'](_0x26d3be['model'],qs[_0x2313('0x4c')](_0x4fa002[_0x2313('0x48')][_0x2313('0x4c')]));_0x35c8cf[_0x2313('0x4b')]=_0x35c8cf[_0x2313('0x4b')][_0x2313('0x4d')]?_0x35c8cf[_0x2313('0x4b')]:_0x26d3be['model'];if(!_0x4fa002[_0x2313('0x48')][_0x2313('0x6d')]('nolimit')){_0x35c8cf[_0x2313('0x34')]=qs[_0x2313('0x34')](_0x4fa002[_0x2313('0x48')][_0x2313('0x34')]);_0x35c8cf[_0x2313('0x31')]=qs['offset'](_0x4fa002[_0x2313('0x48')][_0x2313('0x31')]);}_0x35c8cf['order']=qs['sort'](_0x4fa002[_0x2313('0x48')][_0x2313('0x50')]);_0x35c8cf[_0x2313('0x51')]=qs[_0x2313('0x49')](_[_0x2313('0x52')](_0x4fa002[_0x2313('0x48')],_0x26d3be['filters']));_0x35c8cf['where'][_0x2313('0x67')]=_0x4cc70a['id'];if(_0x4fa002['query'][_0x2313('0x53')]){_0x35c8cf[_0x2313('0x51')]=_['merge'](_0x35c8cf['where'],{'$or':_[_0x2313('0x43')](_0x35c8cf[_0x2313('0x4b')],function(_0x196bf8){var _0x2ab6d6={};_0x2ab6d6[_0x196bf8]={'$like':'%'+_0x4fa002[_0x2313('0x48')][_0x2313('0x53')]+'%'};return _0x2ab6d6;})});}_0x35c8cf=_['merge']({},_0x35c8cf,_0x4fa002[_0x2313('0x6e')]);return db[_0x2313('0x68')][_0x2313('0x33')]({'where':_0x35c8cf[_0x2313('0x51')]})['then'](function(_0x53e2e8){_0x251000[_0x2313('0x33')]=_0x53e2e8;if(_0x4fa002[_0x2313('0x48')][_0x2313('0x56')]){_0x35c8cf[_0x2313('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x2313('0x6f')](_0x35c8cf);})['then'](function(_0x5bfe2e){_0x251000[_0x2313('0x58')]=_0x5bfe2e;return _0x251000;});}})[_0x2313('0x22')](respondWithFilteredResult(_0x3ee0c9,_0x35c8cf))['catch'](handleError(_0x3ee0c9,null));};exports[_0x2313('0x70')]=function(_0xce994,_0xee4f2f,_0x4c1f2f){return db[_0x2313('0x44')]['find']({'where':{'id':_0xce994[_0x2313('0x65')]['id']}})['then'](handleEntityNotFound(_0xee4f2f,null))[_0x2313('0x22')](function(_0x5cd867){if(_0x5cd867){return _0x5cd867[_0x2313('0x70')](_0xce994['query'][_0x2313('0x71')]);}})[_0x2313('0x22')](respondWithStatusCode(_0xee4f2f,null))['catch'](handleError(_0xee4f2f,null));};exports[_0x2313('0x72')]=function(_0x1d3027,_0x36fdd8,_0x23a4e1){if(_0x1d3027[_0x2313('0x5b')]['id']){delete _0x1d3027[_0x2313('0x5b')]['id'];}return db[_0x2313('0x44')]['find']({'where':{'id':_0x1d3027[_0x2313('0x65')]['id']}})[_0x2313('0x22')](handleEntityNotFound(_0x36fdd8,null))[_0x2313('0x22')](function(_0x3b6055){if(_0x3b6055){_0x1d3027[_0x2313('0x5b')]['FaxAccountId']=_0x3b6055['id'];return db[_0x2313('0x73')][_0x2313('0x69')](_0x1d3027['body']);}})[_0x2313('0x22')](respondWithResult(_0x36fdd8,null))['catch'](handleError(_0x36fdd8,null));};exports[_0x2313('0x74')]=function(_0x1dd886,_0x4dc4ed,_0x57e3d9){var _0x4bf2cb={'raw':![],'where':{}};var _0xb22c41={};var _0x358398={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x1dd886[_0x2313('0x65')]['id']}})['then'](handleEntityNotFound(_0x4dc4ed,null))[_0x2313('0x22')](function(_0x119420){if(_0x119420){_0xb22c41[_0x2313('0x47')]=_['keys'](db[_0x2313('0x73')][_0x2313('0x6c')]);_0xb22c41['query']=_[_0x2313('0x59')](_0x1dd886['query']);_0xb22c41[_0x2313('0x49')]=_['intersection'](_0xb22c41[_0x2313('0x47')],_0xb22c41[_0x2313('0x48')]);_0x4bf2cb['attributes']=_[_0x2313('0x4a')](_0xb22c41[_0x2313('0x47')],qs[_0x2313('0x4c')](_0x1dd886[_0x2313('0x48')][_0x2313('0x4c')]));_0x4bf2cb[_0x2313('0x4b')]=_0x4bf2cb['attributes'][_0x2313('0x4d')]?_0x4bf2cb[_0x2313('0x4b')]:_0xb22c41[_0x2313('0x47')];if(!_0x1dd886[_0x2313('0x48')][_0x2313('0x6d')](_0x2313('0x4e'))){_0x4bf2cb['limit']=qs['limit'](_0x1dd886[_0x2313('0x48')][_0x2313('0x34')]);_0x4bf2cb[_0x2313('0x31')]=qs[_0x2313('0x31')](_0x1dd886[_0x2313('0x48')]['offset']);}_0x4bf2cb[_0x2313('0x4f')]=qs[_0x2313('0x50')](_0x1dd886[_0x2313('0x48')][_0x2313('0x50')]);_0x4bf2cb[_0x2313('0x51')]=qs['filters'](_[_0x2313('0x52')](_0x1dd886[_0x2313('0x48')],_0xb22c41[_0x2313('0x49')]));_0x4bf2cb[_0x2313('0x51')]['FaxAccountId']=_0x119420['id'];if(_0x1dd886['query'][_0x2313('0x53')]){_0x4bf2cb['where']=_[_0x2313('0x54')](_0x4bf2cb[_0x2313('0x51')],{'$or':_[_0x2313('0x43')](_0x4bf2cb['attributes'],function(_0x50909e){var _0x36310b={};_0x36310b[_0x50909e]={'$like':'%'+_0x1dd886['query'][_0x2313('0x53')]+'%'};return _0x36310b;})});}_0x4bf2cb=_[_0x2313('0x54')]({},_0x4bf2cb,_0x1dd886['options']);return db[_0x2313('0x73')][_0x2313('0x33')]({'where':_0x4bf2cb[_0x2313('0x51')]})[_0x2313('0x22')](function(_0x45a134){_0x358398[_0x2313('0x33')]=_0x45a134;if(_0x1dd886[_0x2313('0x48')][_0x2313('0x56')]){_0x4bf2cb[_0x2313('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2313('0x6f')](_0x4bf2cb);})[_0x2313('0x22')](function(_0x486a27){_0x358398['rows']=_0x486a27;return _0x358398;});}})[_0x2313('0x22')](respondWithFilteredResult(_0x4dc4ed,_0x4bf2cb))[_0x2313('0x2c')](handleError(_0x4dc4ed,null));};exports['removeAnswers']=function(_0x49c1dc,_0x18f232,_0x2634e6){return db[_0x2313('0x44')][_0x2313('0x5a')]({'where':{'id':_0x49c1dc[_0x2313('0x65')]['id']}})['then'](handleEntityNotFound(_0x18f232,null))[_0x2313('0x22')](function(_0x21c61e){if(_0x21c61e){return _0x21c61e[_0x2313('0x75')](_0x49c1dc[_0x2313('0x48')][_0x2313('0x71')]);}})[_0x2313('0x22')](respondWithStatusCode(_0x18f232,null))['catch'](handleError(_0x18f232,null));};exports[_0x2313('0x76')]=function(_0x477e68,_0x2f86d9,_0x245da3){return db[_0x2313('0x77')][_0x2313('0x5a')]({'where':{'id':_0x477e68[_0x2313('0x65')]['id']}})[_0x2313('0x22')](handleEntityNotFound(_0x2f86d9,null))['then'](function(_0x29a9de){if(_0x29a9de){return _0x29a9de[_0x2313('0x76')](_0x477e68[_0x2313('0x5b')][_0x2313('0x71')],_[_0x2313('0x78')](_0x477e68['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x2f86d9,null))['catch'](handleError(_0x2f86d9,null));};exports[_0x2313('0x79')]=function(_0x3aff8b,_0x4a1b1d,_0x26f630){var _0x19a6d8={'raw':![],'where':{}};var _0x1dc6ae={};var _0x31987f={'count':0x0,'rows':[]};return db[_0x2313('0x44')][_0x2313('0x6b')]({'where':{'id':_0x3aff8b[_0x2313('0x65')]['id']}})[_0x2313('0x22')](handleEntityNotFound(_0x4a1b1d,null))[_0x2313('0x22')](function(_0x1cf120){if(_0x1cf120){_0x1dc6ae[_0x2313('0x47')]=_[_0x2313('0x59')](db[_0x2313('0x77')]['rawAttributes']);_0x1dc6ae[_0x2313('0x48')]=_['keys'](_0x3aff8b['query']);_0x1dc6ae[_0x2313('0x49')]=_['intersection'](_0x1dc6ae[_0x2313('0x47')],_0x1dc6ae[_0x2313('0x48')]);_0x19a6d8[_0x2313('0x4b')]=_[_0x2313('0x4a')](_0x1dc6ae[_0x2313('0x47')],qs['fields'](_0x3aff8b[_0x2313('0x48')][_0x2313('0x4c')]));_0x19a6d8['attributes']=_0x19a6d8['attributes'][_0x2313('0x4d')]?_0x19a6d8[_0x2313('0x4b')]:_0x1dc6ae[_0x2313('0x47')];if(!_0x3aff8b['query'][_0x2313('0x6d')](_0x2313('0x4e'))){_0x19a6d8[_0x2313('0x34')]=qs['limit'](_0x3aff8b[_0x2313('0x48')][_0x2313('0x34')]);_0x19a6d8[_0x2313('0x31')]=qs[_0x2313('0x31')](_0x3aff8b[_0x2313('0x48')]['offset']);}_0x19a6d8['order']=qs[_0x2313('0x50')](_0x3aff8b['query'][_0x2313('0x50')]);_0x19a6d8[_0x2313('0x51')]=qs[_0x2313('0x49')](_[_0x2313('0x52')](_0x3aff8b['query'],_0x1dc6ae[_0x2313('0x49')]));_0x19a6d8['where'][_0x2313('0x67')]=_0x1cf120['id'];if(_0x3aff8b[_0x2313('0x48')][_0x2313('0x53')]){_0x19a6d8[_0x2313('0x51')]=_[_0x2313('0x54')](_0x19a6d8[_0x2313('0x51')],{'$or':_[_0x2313('0x43')](_0x19a6d8[_0x2313('0x4b')],function(_0x28f1e2){var _0x432a42={};_0x432a42[_0x28f1e2]={'$like':'%'+_0x3aff8b['query'][_0x2313('0x53')]+'%'};return _0x432a42;})});}_0x19a6d8=_[_0x2313('0x54')]({},_0x19a6d8,_0x3aff8b['options']);return db['FaxInteraction'][_0x2313('0x33')]({'where':_0x19a6d8[_0x2313('0x51')]})[_0x2313('0x22')](function(_0x239604){_0x31987f[_0x2313('0x33')]=_0x239604;if(_0x3aff8b[_0x2313('0x48')][_0x2313('0x56')]){_0x19a6d8[_0x2313('0x57')]=[{'model':db['CmContact'],'as':_0x2313('0x7a'),'required':![]},{'model':db[_0x2313('0x7b')],'as':_0x2313('0x7c'),'attributes':['name','fullname',_0x2313('0x7d')],'required':![]},{'model':db['Tag'],'as':_0x2313('0x7e'),'attributes':['id',_0x2313('0x3e'),'color'],'where':_0x3aff8b[_0x2313('0x48')]['tag']?{'id':_0x3aff8b[_0x2313('0x48')][_0x2313('0x7f')]}:undefined,'required':_0x3aff8b[_0x2313('0x48')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x2313('0x6f')](_0x19a6d8);})[_0x2313('0x22')](function(_0x37e331){_0x31987f[_0x2313('0x58')]=_0x37e331;return _0x31987f;});}})[_0x2313('0x22')](respondWithFilteredResult(_0x4a1b1d,_0x19a6d8))[_0x2313('0x2c')](handleError(_0x4a1b1d,null));};exports['addApplications']=function(_0x36fe20,_0x244708){var _0x534728=_0x36fe20[_0x2313('0x65')]['id'];var _0x1e1f25=_0x36fe20[_0x2313('0x5b')];var _0x1046bd=0xc8;var _0x245abc=null;return db[_0x2313('0x80')]['transaction']({'isolationLevel':db[_0x2313('0x80')][_0x2313('0x81')][_0x2313('0x82')][_0x2313('0x83')]},function(_0xaa8c0){return db[_0x2313('0x44')][_0x2313('0x6b')]({'where':{'id':_0x534728},'transaction':_0xaa8c0})[_0x2313('0x22')](function(_0x3b7e14){if(_0x3b7e14){return db['FaxApplication'][_0x2313('0x3a')]({'where':{'FaxAccountId':_0x534728},'transaction':_0xaa8c0})[_0x2313('0x22')](function(){var _0x51c934=_[_0x2313('0x43')](_0x1e1f25,function(_0x1f233b){_0x1f233b[_0x2313('0x67')]=_0x534728;return _0x1f233b;});return db[_0x2313('0x84')][_0x2313('0x85')](_0x51c934,{'transaction':_0xaa8c0});});}else{_0x1046bd=0x194;_0x245abc=[];}});})[_0x2313('0x22')](function(){if(_0x1046bd!==0x194){return db[_0x2313('0x84')][_0x2313('0x86')]({'where':{'FaxAccountId':_0x534728},'order':_0x2313('0x87')})[_0x2313('0x22')](function(_0x16f76e){_0x245abc=_0x16f76e;});}})['catch'](function(_0x3c5331){_0x1046bd=0x1f4;logger[_0x2313('0x29')](_0x3c5331[_0x2313('0x3d')]);if(_0x3c5331[_0x2313('0x3e')]){delete _0x3c5331[_0x2313('0x3e')];}_0x245abc=_0x3c5331;})['finally'](function(){if(_0x245abc===null){_0x244708[_0x2313('0x2d')](_0x1046bd);}else{if(_0x1046bd===0x1f4){_0x244708['status'](_0x1046bd)[_0x2313('0x3f')](_0x245abc);}else{_0x244708[_0x2313('0x2e')](_0x1046bd)[_0x2313('0x30')](_0x245abc);}}});};exports[_0x2313('0x88')]=function(_0x5c3e63,_0x5df0df,_0x2464ce){var _0x263306={};var _0x24efde={};var _0x597a56;var _0x4f3562;return db[_0x2313('0x44')][_0x2313('0x6b')]({'where':{'id':_0x5c3e63[_0x2313('0x65')]['id']}})[_0x2313('0x22')](handleEntityNotFound(_0x5df0df,null))['then'](function(_0x22a92b){if(_0x22a92b){_0x597a56=_0x22a92b;_0x24efde[_0x2313('0x47')]=_['keys'](db[_0x2313('0x84')][_0x2313('0x6c')]);_0x24efde[_0x2313('0x48')]=_[_0x2313('0x59')](_0x5c3e63[_0x2313('0x48')]);_0x24efde[_0x2313('0x49')]=_[_0x2313('0x4a')](_0x24efde[_0x2313('0x47')],_0x24efde[_0x2313('0x48')]);_0x263306[_0x2313('0x4b')]=_[_0x2313('0x4a')](_0x24efde[_0x2313('0x47')],qs['fields'](_0x5c3e63[_0x2313('0x48')][_0x2313('0x4c')]));_0x263306['attributes']=_0x263306[_0x2313('0x4b')][_0x2313('0x4d')]?_0x263306['attributes']:_0x24efde[_0x2313('0x47')];_0x263306['order']=qs[_0x2313('0x50')](_0x5c3e63[_0x2313('0x48')]['sort']);_0x263306[_0x2313('0x51')]=qs[_0x2313('0x49')](_[_0x2313('0x52')](_0x5c3e63[_0x2313('0x48')],_0x24efde[_0x2313('0x49')]));if(_0x5c3e63[_0x2313('0x48')]['filter']){_0x263306['where']=_[_0x2313('0x54')](_0x263306['where'],{'$or':_[_0x2313('0x43')](_0x263306['attributes'],function(_0x56fd8a){var _0x328afb={};_0x328afb[_0x56fd8a]={'$like':'%'+_0x5c3e63[_0x2313('0x48')][_0x2313('0x53')]+'%'};return _0x328afb;})});}_0x263306=_[_0x2313('0x54')]({},_0x263306,_0x5c3e63[_0x2313('0x6e')]);return _0x597a56[_0x2313('0x88')](_0x263306);}})['then'](function(_0x1fe306){if(_0x1fe306){_0x4f3562=_0x1fe306['length'];if(!_0x5c3e63[_0x2313('0x48')][_0x2313('0x6d')]('nolimit')){_0x263306[_0x2313('0x34')]=qs[_0x2313('0x34')](_0x5c3e63[_0x2313('0x48')][_0x2313('0x34')]);_0x263306[_0x2313('0x31')]=qs['offset'](_0x5c3e63[_0x2313('0x48')]['offset']);}return _0x597a56['getApplications'](_0x263306);}})[_0x2313('0x22')](function(_0x18a013){if(_0x18a013){return _0x18a013?{'count':_0x4f3562,'rows':_0x18a013}:null;}})['then'](respondWithResult(_0x5df0df,null))[_0x2313('0x2c')](handleError(_0x5df0df,null));};function Extension(_0x3754a4,_0x1756d7,_0x9ee855,_0x276d53){this['context']=_0x2313('0x89');this[_0x2313('0x8a')]=_0x3754a4[_0x2313('0x8b')];this[_0x2313('0x8c')]=_0x276d53;this['type']=_0x2313('0x8d');this[_0x2313('0x8e')]=_0x2313('0x8f');this[_0x2313('0x67')]=_0x3754a4['id'];this['priority']=_0x1756d7;this[_0x2313('0x90')]=_0x9ee855;}function createExtensionsReciveFax(_0x6acae9){var _0x16a575=0x1;var _0x38edd3=[];_0x38edd3[_0x2313('0x91')](new Extension(_0x6acae9,_0x16a575,'',_0x2313('0x92')));_0x16a575+=0x1;_0x38edd3[_0x2313('0x91')](new Extension(_0x6acae9,_0x16a575,_0x2313('0x93'),_0x2313('0x94')));_0x16a575+=0x1;for(var _0x593dd8 in _0x6acae9){if(_0x6acae9[_0x2313('0x6d')](_0x593dd8)&&(_0x593dd8===_0x2313('0x95')||_0x593dd8===_0x2313('0x8b')||_0x593dd8===_0x2313('0x96')||_0x593dd8===_0x2313('0x97')||_0x593dd8==='headerinfo'||_0x593dd8==='maxrate'||_0x593dd8==='minrate'||_0x593dd8===_0x2313('0x98')||_0x593dd8===_0x2313('0x99'))){_0x38edd3[_0x2313('0x91')](new Extension(_0x6acae9,_0x16a575,_0x2313('0x9a')+_0x593dd8+')='+_0x6acae9[_0x593dd8],_0x2313('0x94')));_0x16a575+=0x1;}}_0x38edd3[_0x2313('0x91')](new Extension(_0x6acae9,_0x16a575,'6','Wait'));_0x16a575+=0x1;_0x38edd3['push'](new Extension(_0x6acae9,_0x16a575,'/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',_0x2313('0x9b')));_0x16a575=0x0;return _0x38edd3;}exports['addAccountApplications']=function(_0x45439f,_0x25b6bc,_0x46a1bb){var _0x596aa8;return db[_0x2313('0x80')][_0x2313('0x9c')](function(_0x593099){return db[_0x2313('0x44')]['create'](_0x45439f[_0x2313('0x5b')],{'transaction':_0x593099})[_0x2313('0x22')](function(_0xe9cc2a){_0x596aa8=_0xe9cc2a[_0x2313('0x3b')]({'plain':!![]});return db[_0x2313('0x9d')][_0x2313('0x85')](createExtensionsReciveFax(_0x596aa8),{'transaction':_0x593099});});})[_0x2313('0x22')](function(){return _0x596aa8;})[_0x2313('0x22')](respondWithResult(_0x25b6bc,null))[_0x2313('0x2c')](handleError(_0x25b6bc,null));};exports[_0x2313('0x9e')]=function(_0x14086c,_0x1fc63a,_0x23ac76){var _0x415340;return db['sequelize'][_0x2313('0x9c')](function(_0xee7798){return db[_0x2313('0x44')][_0x2313('0x64')](_0x14086c[_0x2313('0x5b')],{'where':{'id':_0x14086c['body']['id']},'transaction':_0xee7798})[_0x2313('0x22')](function(_0x4c509d){return db[_0x2313('0x9d')]['destroy']({'where':{'FaxAccountId':_0x14086c[_0x2313('0x5b')]['id']},'transaction':_0xee7798})[_0x2313('0x22')](function(_0x367faf){return db[_0x2313('0x9d')][_0x2313('0x85')](createExtensionsReciveFax(_[_0x2313('0x78')](_0x14086c[_0x2313('0x5b')],['tech',_0x2313('0x9f'),_0x2313('0xa0'),'updatedAt',_0x2313('0xa1'),_0x2313('0xa2')])),{'transaction':_0xee7798});});});})[_0x2313('0x22')](function(){return db[_0x2313('0x44')][_0x2313('0xa3')](_0x14086c[_0x2313('0x5b')]['id']);})['then'](respondWithResult(_0x1fc63a,null))[_0x2313('0x2c')](handleError(_0x1fc63a,null));};exports['getMessages']=function(_0x48419e,_0x587c64,_0x182bdc){var _0x42f2ff={'raw':!![],'where':{}};var _0x3639ba={};var _0x4c035b={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2313('0x6b')]({'where':{'id':_0x48419e[_0x2313('0x65')]['id']}})[_0x2313('0x22')](handleEntityNotFound(_0x587c64,null))[_0x2313('0x22')](function(_0x56df68){if(_0x56df68){_0x3639ba['model']=_[_0x2313('0x59')](db[_0x2313('0xa4')][_0x2313('0x6c')]);_0x3639ba[_0x2313('0x48')]=_[_0x2313('0x59')](_0x48419e[_0x2313('0x48')]);_0x3639ba['filters']=_[_0x2313('0x4a')](_0x3639ba[_0x2313('0x47')],_0x3639ba[_0x2313('0x48')]);_0x42f2ff[_0x2313('0x4b')]=_['intersection'](_0x3639ba['model'],qs['fields'](_0x48419e[_0x2313('0x48')][_0x2313('0x4c')]));_0x42f2ff[_0x2313('0x4b')]=_0x42f2ff[_0x2313('0x4b')][_0x2313('0x4d')]?_0x42f2ff['attributes']:_0x3639ba[_0x2313('0x47')];if(!_0x48419e[_0x2313('0x48')][_0x2313('0x6d')](_0x2313('0x4e'))){_0x42f2ff[_0x2313('0x34')]=qs[_0x2313('0x34')](_0x48419e[_0x2313('0x48')][_0x2313('0x34')]);_0x42f2ff[_0x2313('0x31')]=qs[_0x2313('0x31')](_0x48419e[_0x2313('0x48')]['offset']);}_0x42f2ff['order']=qs[_0x2313('0x50')](_0x48419e['query'][_0x2313('0x50')]);_0x42f2ff['where']=qs[_0x2313('0x49')](_[_0x2313('0x52')](_0x48419e[_0x2313('0x48')],_0x3639ba[_0x2313('0x49')]));_0x42f2ff['where'][_0x2313('0x67')]=_0x56df68['id'];if(_0x48419e[_0x2313('0x48')][_0x2313('0x53')]){_0x42f2ff['where']=_['merge'](_0x42f2ff[_0x2313('0x51')],{'$or':_[_0x2313('0x43')](_0x42f2ff['attributes'],function(_0xfc0dd9){var _0x38850d={};_0x38850d[_0xfc0dd9]={'$like':'%'+_0x48419e['query'][_0x2313('0x53')]+'%'};return _0x38850d;})});}if(_0x48419e[_0x2313('0x48')][_0x2313('0xa5')]){var _0x2b60e2=_0x48419e[_0x2313('0x48')][_0x2313('0xa5')][_0x2313('0xa6')](',');var _0x6be767={};_0x6be767[_0x2b60e2[0x0]]={'$gte':moment(_0x2b60e2[0x1])[_0x2313('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x42f2ff[_0x2313('0x51')]=_['merge'](_0x42f2ff[_0x2313('0x51')],_0x6be767);}_0x42f2ff=_[_0x2313('0x54')]({},_0x42f2ff,_0x48419e[_0x2313('0x6e')]);return db[_0x2313('0xa4')][_0x2313('0x33')]({'where':_0x42f2ff['where']})['then'](function(_0x386922){_0x4c035b[_0x2313('0x33')]=_0x386922;if(_0x48419e[_0x2313('0x48')][_0x2313('0x56')]){_0x42f2ff['include']=[{'all':!![]}];}return db[_0x2313('0xa4')][_0x2313('0x6f')](_0x42f2ff);})[_0x2313('0x22')](function(_0x5b5b98){_0x4c035b['rows']=_0x5b5b98;return _0x4c035b;});}})[_0x2313('0x22')](respondWithFilteredResult(_0x587c64,_0x42f2ff))[_0x2313('0x2c')](handleError(_0x587c64,null));};exports[_0x2313('0x3f')]=function(_0x286699,_0xc509c2,_0x10f6c1){var _0x1820b5,_0x2e820f={},_0x4c45a8;if(_0x286699[_0x2313('0x5b')]['to']){_0x4c45a8=_0x286699['body']['to'][0x0];}return db[_0x2313('0x44')][_0x2313('0x5a')]({'where':{'id':_0x286699[_0x2313('0x65')]['id']},'include':[{'model':db[_0x2313('0xa8')],'as':_0x2313('0xa9'),'include':[{'model':db[_0x2313('0xaa')],'as':_0x2313('0xab'),'where':{'fax':_0x4c45a8},'limit':0x1,'order':[[_0x2313('0xac'),'DESC']]}]}]})[_0x2313('0x22')](handleEntityNotFound(_0xc509c2,null))[_0x2313('0x22')](function(_0x332662){_0x1820b5=_0x332662;if(_0x286699[_0x2313('0x5b')][_0x2313('0xad')]&&_0x286699['body'][_0x2313('0xad')][_0x2313('0x4d')]){for(var _0x3e1bc7=0x0;_0x3e1bc7<_0x286699[_0x2313('0x5b')]['attachments'][_0x2313('0x4d')];_0x3e1bc7+=0x1){_0x286699[_0x2313('0x5b')][_0x2313('0xad')][_0x3e1bc7]={'filename':_0x286699[_0x2313('0x5b')][_0x2313('0xad')][_0x3e1bc7][_0x2313('0x3e')],'id':_0x286699[_0x2313('0x5b')][_0x2313('0xad')][_0x3e1bc7]['id'],'path':path[_0x2313('0xae')](config['root'],_0x2313('0xaf'),_0x286699['body'][_0x2313('0xad')][_0x3e1bc7]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x2313('0xb0'),{'FaxAccountId':_[_0x2313('0xb1')](_0x286699[_0x2313('0x65')]['id'])?undefined:_0x286699[_0x2313('0x65')]['id'],'path':_[_0x2313('0xb1')](_0x286699[_0x2313('0x5b')][_0x2313('0xad')][0x0][_0x2313('0xb2')])?undefined:_0x286699[_0x2313('0x5b')][_0x2313('0xad')][0x0]['path'],'fax':_[_0x2313('0xb1')](_0x286699['body']['to'][0x0])?undefined:_0x286699[_0x2313('0x5b')]['to'][0x0]},client9002);})['then'](function(){if(_0x1820b5){if(_['isNil'](_0x286699[_0x2313('0x5b')][_0x2313('0xb3')])){_0x286699['body'][_0x2313('0xb3')]=util[_0x2313('0xa7')](_0x2313('0xb4'),_0x1820b5[_0x2313('0x3e')],_0x1820b5['fax']);}if(_0x1820b5[_0x2313('0xa9')]){if(_0x1820b5[_0x2313('0xa9')][_0x2313('0xab')][_0x2313('0x4d')]){return _0x1820b5[_0x2313('0xa9')][_0x2313('0xab')][0x0];}else{return db['CmContact'][_0x2313('0x69')](_[_0x2313('0x1b')](_0x286699[_0x2313('0x5b')],{'firstName':_0x286699['body']['to'][0x0],'phone':_0x286699['body']['to'][0x0],'fax':_0x286699[_0x2313('0x5b')]['to'][0x0],'ListId':_0x1820b5[_0x2313('0xa2')]}));}}else{throw new Error(_0x2313('0xb5'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x2313('0x22')](function(_0x64160f){if(_0x64160f){return db['FaxInteraction'][_0x2313('0x5a')]({'where':{'ContactId':_0x64160f['id'],'closed':![],'FaxAccountId':_0x1820b5['id']}})[_0x2313('0x22')](function(_0x3c108b){if(_0x3c108b){return[_0x3c108b,![]];}return db[_0x2313('0x77')][_0x2313('0x69')]({'UserId':_0x286699['user']['id'],'ContactId':_0x64160f['id'],'FaxAccountId':_0x1820b5['id'],'fax':_0x286699[_0x2313('0x5b')]['to'][0x0],'firstMsgDirection':_0x2313('0xb6'),'Messages':[_[_0x2313('0x54')](_0x286699[_0x2313('0x5b')],{'read':![],'body':_0x286699[_0x2313('0x5b')][_0x2313('0xad')][0x0][_0x2313('0xb7')],'FaxAccountId':_0x1820b5['id'],'UserId':_0x286699['user']['id'],'ContactId':_0x64160f['id'],'AttachmentId':_0x286699['body'][_0x2313('0xad')][0x0]['id']})]},{'include':[{'model':db[_0x2313('0xa4')],'as':_0x2313('0xb8')}]})[_0x2313('0x22')](function(_0x3a57cb){return[_0x3a57cb,!![]];});});}else{throw new Error(_0x2313('0xb9'));}})[_0x2313('0xba')](function(_0x3ca639,_0x1a1620){if(_0x1a1620){return _0x3ca639;}return db[_0x2313('0xa4')][_0x2313('0x69')]({'direction':'out','read':![],'body':_0x286699[_0x2313('0x5b')][_0x2313('0xad')][0x0]['filename'],'FaxAccountId':_0x1820b5['id'],'FaxInteractionId':_0x3ca639['id'],'UserId':_0x286699[_0x2313('0x5c')]['id'],'ContactId':_0x3ca639[_0x2313('0xbb')],'AttachmentId':_0x286699[_0x2313('0x5b')][_0x2313('0xad')][0x0]['id']})['then'](function(_0xea3ec0){_0x3ca639['dataValues'][_0x2313('0xb8')]=[];_0x3ca639['dataValues'][_0x2313('0xb8')][_0x2313('0x91')](_0xea3ec0['dataValues']);return _0x3ca639;});})[_0x2313('0x22')](function(_0x5ac985){respondWithRpcPromise(_0x2313('0xbc'),_0x2313('0xbc'),{'FaxAccountId':_[_0x2313('0xb1')](_0x286699[_0x2313('0x65')]['id'])?undefined:_0x286699['params']['id'],'path':_[_0x2313('0xb1')](_0x286699[_0x2313('0x5b')][_0x2313('0xad')][0x0][_0x2313('0xb2')])?undefined:_0x286699[_0x2313('0x5b')][_0x2313('0xad')][0x0][_0x2313('0xb2')],'fax':_[_0x2313('0xb1')](_0x286699[_0x2313('0x5b')]['to'][0x0])?undefined:_0x286699[_0x2313('0x5b')]['to'][0x0],'AttachmentId':_0x286699[_0x2313('0x5b')]['attachments'][0x0]['id']},client9002)[_0x2313('0x22')](function(_0x16171a){logger[_0x2313('0x23')]('SendFaxRpc,\x20%s',_0x16171a);})[_0x2313('0x2c')](function(_0x46aa14){logger[_0x2313('0x23')](_0x2313('0xbd'),_0x46aa14);});return _0x5ac985;})['then'](respondWithResult(_0xc509c2,null))[_0x2313('0x2c')](handleError(_0xc509c2,null));};exports[_0x2313('0xbe')]=function(_0x5d780a,_0x4e254b,_0x3d2c23){return db[_0x2313('0x44')][_0x2313('0x5a')]({'where':{'id':_0x5d780a['params']['id']}})[_0x2313('0x22')](handleEntityNotFound(_0x4e254b,null))[_0x2313('0x22')](function(_0x7a0737){if(_0x7a0737){return _0x7a0737[_0x2313('0xbe')](_0x5d780a['body'][_0x2313('0x71')],_[_0x2313('0x78')](_0x5d780a['body'],[_0x2313('0x71'),'id'])||{})[_0x2313('0xba')](function(_0x79f533){for(var _0x1c657c=0x0;_0x1c657c<_0x5d780a[_0x2313('0x5b')][_0x2313('0x71')]['length'];_0x1c657c+=0x1){socket[_0x2313('0xbf')](_0x2313('0xc0'),{'UserId':Number(_0x5d780a['body'][_0x2313('0x71')][_0x1c657c]),'FaxAccountId':Number(_0x5d780a[_0x2313('0x65')]['id'])});}return _0x79f533;});}})[_0x2313('0x22')](respondWithResult(_0x4e254b,null))[_0x2313('0x2c')](handleError(_0x4e254b,null));};exports['removeAgents']=function(_0x335f3c,_0x18b534,_0x147a18){return db[_0x2313('0x44')]['find']({'where':{'id':_0x335f3c[_0x2313('0x65')]['id']}})[_0x2313('0x22')](handleEntityNotFound(_0x18b534,null))[_0x2313('0x22')](function(_0x41c407){if(_0x41c407){return _0x41c407[_0x2313('0xc1')](_0x335f3c[_0x2313('0x48')][_0x2313('0x71')])[_0x2313('0x22')](function(){if(_[_0x2313('0xc2')](_0x335f3c[_0x2313('0x48')]['ids'])){for(var _0x26cbb5=0x0;_0x26cbb5<_0x335f3c[_0x2313('0x48')][_0x2313('0x71')][_0x2313('0x4d')];_0x26cbb5+=0x1){socket[_0x2313('0xbf')]('userFaxAccount:remove',{'UserId':Number(_0x335f3c[_0x2313('0x48')][_0x2313('0x71')][_0x26cbb5]),'FaxAccountId':Number(_0x335f3c[_0x2313('0x65')]['id'])});}}else{socket[_0x2313('0xbf')](_0x2313('0xc3'),{'UserId':Number(_0x335f3c[_0x2313('0x48')][_0x2313('0x71')]),'FaxAccountId':Number(_0x335f3c[_0x2313('0x65')]['id'])});}});}})[_0x2313('0x22')](respondWithStatusCode(_0x18b534,null))[_0x2313('0x2c')](handleError(_0x18b534,null));};exports[_0x2313('0xc4')]=function(_0x57abdd,_0x13d48b,_0x1c8c72){var _0x3a4e93={};var _0x441057={};var _0xfb8ed3;var _0x236059;return db['FaxAccount'][_0x2313('0x6b')]({'where':{'id':_0x57abdd[_0x2313('0x65')]['id']}})[_0x2313('0x22')](handleEntityNotFound(_0x13d48b,null))[_0x2313('0x22')](function(_0x2ff3ff){if(_0x2ff3ff){_0xfb8ed3=_0x2ff3ff;_0x441057[_0x2313('0x47')]=_[_0x2313('0x59')](db[_0x2313('0x7b')][_0x2313('0x6c')]);_0x441057[_0x2313('0x48')]=_[_0x2313('0x59')](_0x57abdd['query']);_0x441057['filters']=_[_0x2313('0x4a')](_0x441057[_0x2313('0x47')],_0x441057[_0x2313('0x48')]);_0x3a4e93['attributes']=_[_0x2313('0x4a')](_0x441057[_0x2313('0x47')],qs['fields'](_0x57abdd[_0x2313('0x48')][_0x2313('0x4c')]));_0x3a4e93[_0x2313('0x4b')]=_0x3a4e93[_0x2313('0x4b')][_0x2313('0x4d')]?_0x3a4e93[_0x2313('0x4b')]:_0x441057['model'];_0x3a4e93['order']=qs[_0x2313('0x50')](_0x57abdd[_0x2313('0x48')][_0x2313('0x50')]);_0x3a4e93[_0x2313('0x51')]=qs[_0x2313('0x49')](_[_0x2313('0x52')](_0x57abdd[_0x2313('0x48')],_0x441057[_0x2313('0x49')]));if(_0x57abdd['query']['filter']){_0x3a4e93[_0x2313('0x51')]=_[_0x2313('0x54')](_0x3a4e93['where'],{'$or':_[_0x2313('0x43')](_0x3a4e93[_0x2313('0x4b')],function(_0x2ecd9c){var _0x4a118e={};_0x4a118e[_0x2ecd9c]={'$like':'%'+_0x57abdd[_0x2313('0x48')][_0x2313('0x53')]+'%'};return _0x4a118e;})});}_0x3a4e93=_['merge']({},_0x3a4e93,_0x57abdd[_0x2313('0x6e')]);return _0xfb8ed3['getAgents'](_0x3a4e93);}})[_0x2313('0x22')](function(_0x4d1829){if(_0x4d1829){_0x236059=_0x4d1829[_0x2313('0x4d')];if(!_0x57abdd[_0x2313('0x48')]['hasOwnProperty'](_0x2313('0x4e'))){_0x3a4e93['limit']=qs[_0x2313('0x34')](_0x57abdd['query'][_0x2313('0x34')]);_0x3a4e93['offset']=qs[_0x2313('0x31')](_0x57abdd[_0x2313('0x48')][_0x2313('0x31')]);}return _0xfb8ed3[_0x2313('0xc4')](_0x3a4e93);}})['then'](function(_0x24c8c8){if(_0x24c8c8){return _0x24c8c8?{'count':_0x236059,'rows':_0x24c8c8}:null;}})[_0x2313('0x22')](respondWithResult(_0x13d48b,null))['catch'](handleError(_0x13d48b,null));}; \ No newline at end of file +var _0xe5c4=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','FaxAccount,\x20%s,\x20%s','message','request\x20sent','catch','status','json','offset','undefined','count','limit','set','reject','then','destroy','FaxAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','FaxAccount','includeAll','include','findAll','show','params','Pause','mandatoryDispositionPause','rawAttributes','options','find','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','hasOwnProperty','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','rows','removeAnswers','ids','FaxInteraction','omit','CmContact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','tech','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3c4dad,_0x25ffd5){var _0x1a4f49=function(_0x6fe6c){while(--_0x6fe6c){_0x3c4dad['push'](_0x3c4dad['shift']());}};_0x1a4f49(++_0x25ffd5);}(_0xe5c4,0xb6));var _0x4e5c=function(_0x5127d1,_0x35af94){_0x5127d1=_0x5127d1-0x0;var _0x3be2ab=_0xe5c4[_0x5127d1];return _0x3be2ab;};'use strict';var emlformat=require(_0x4e5c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4e5c('0x1'));var BPromise=require(_0x4e5c('0x2'));var Mustache=require(_0x4e5c('0x3'));var util=require(_0x4e5c('0x4'));var path=require(_0x4e5c('0x5'));var sox=require(_0x4e5c('0x6'));var csv=require(_0x4e5c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e5c('0x8'));var _=require(_0x4e5c('0x9'));var squel=require(_0x4e5c('0xa'));var crypto=require(_0x4e5c('0xb'));var jsforce=require(_0x4e5c('0xc'));var deskjs=require(_0x4e5c('0xd'));var toCsv=require(_0x4e5c('0x7'));var querystring=require(_0x4e5c('0xe'));var Papa=require(_0x4e5c('0xf'));var Redis=require(_0x4e5c('0x10'));var authService=require(_0x4e5c('0x11'));var qs=require(_0x4e5c('0x12'));var as=require(_0x4e5c('0x13'));var hardwareService=require(_0x4e5c('0x14'));var logger=require('../../config/logger')(_0x4e5c('0x15'));var utils=require(_0x4e5c('0x16'));var config=require(_0x4e5c('0x17'));var licenseUtil=require(_0x4e5c('0x18'));var db=require(_0x4e5c('0x19'))['db'];config[_0x4e5c('0x1a')]=_['defaults'](config[_0x4e5c('0x1a')],{'host':_0x4e5c('0x1b'),'port':0x18eb});var socket=require(_0x4e5c('0x1c'))(new Redis(config[_0x4e5c('0x1a')]));require('./faxAccount.socket')[_0x4e5c('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4e5c('0x1e')][_0x4e5c('0x1f')]({'port':0x232c});var client9002=jayson[_0x4e5c('0x1e')][_0x4e5c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x43a34b,_0x35cd5a,_0x2349c8,_0xec19e0){return new BPromise(function(_0x21d769,_0x49c160){var _0x2a4c59=_0xec19e0||client;return _0x2a4c59[_0x4e5c('0x20')](_0x43a34b,_0x2349c8)['then'](function(_0x304a8c){logger[_0x4e5c('0x21')]('FaxAccount,\x20%s,\x20%s',_0x35cd5a,'request\x20sent');logger[_0x4e5c('0x22')](_0x4e5c('0x23'),_0x35cd5a,'request\x20sent',JSON['stringify'](_0x304a8c));if(_0x304a8c[_0x4e5c('0x24')]){if(_0x304a8c[_0x4e5c('0x24')]['code']===0x1f4){logger['error'](_0x4e5c('0x25'),_0x35cd5a,_0x304a8c[_0x4e5c('0x24')][_0x4e5c('0x26')]);return _0x49c160(_0x304a8c[_0x4e5c('0x24')]['message']);}logger[_0x4e5c('0x24')](_0x4e5c('0x25'),_0x35cd5a,_0x304a8c['error'][_0x4e5c('0x26')]);return _0x21d769(_0x304a8c['error'][_0x4e5c('0x26')]);}else{logger[_0x4e5c('0x21')]('FaxAccount,\x20%s,\x20%s',_0x35cd5a,_0x4e5c('0x27'));_0x21d769(_0x304a8c['result'][_0x4e5c('0x26')]);}})[_0x4e5c('0x28')](function(_0x8f0844){logger[_0x4e5c('0x24')](_0x4e5c('0x25'),_0x35cd5a,_0x8f0844);_0x49c160(_0x8f0844);});});}function respondWithStatusCode(_0x5b6b46,_0x4f3d4f){_0x4f3d4f=_0x4f3d4f||0xcc;return function(_0x339da4){if(_0x339da4){return _0x5b6b46['sendStatus'](_0x4f3d4f);}return _0x5b6b46[_0x4e5c('0x29')](_0x4f3d4f)['end']();};}function respondWithResult(_0x116e81,_0x4806d5){_0x4806d5=_0x4806d5||0xc8;return function(_0x1a3342){if(_0x1a3342){return _0x116e81[_0x4e5c('0x29')](_0x4806d5)[_0x4e5c('0x2a')](_0x1a3342);}};}function respondWithFilteredResult(_0x4fa602,_0x4f5453){return function(_0x2f4956){if(_0x2f4956){var _0x37035f=typeof _0x4f5453[_0x4e5c('0x2b')]===_0x4e5c('0x2c')&&typeof _0x4f5453['limit']===_0x4e5c('0x2c');var _0x34fe21=_0x2f4956[_0x4e5c('0x2d')];var _0x15d6bd=_0x37035f?0x0:_0x4f5453[_0x4e5c('0x2b')];var _0x21ba87=_0x37035f?_0x2f4956[_0x4e5c('0x2d')]:_0x4f5453[_0x4e5c('0x2b')]+_0x4f5453[_0x4e5c('0x2e')];var _0x589382;if(_0x21ba87>=_0x34fe21){_0x21ba87=_0x34fe21;_0x589382=0xc8;}else{_0x589382=0xce;}_0x4fa602['status'](_0x589382);return _0x4fa602[_0x4e5c('0x2f')]('Content-Range',_0x15d6bd+'-'+_0x21ba87+'/'+_0x34fe21)['json'](_0x2f4956);}return null;};}function patchUpdates(_0x3bcdd8){return function(_0x1980fa){try{jsonpatch['apply'](_0x1980fa,_0x3bcdd8,!![]);}catch(_0x2035a5){return BPromise[_0x4e5c('0x30')](_0x2035a5);}return _0x1980fa['save']();};}function saveUpdates(_0x516921,_0x2d8f91){return function(_0x1f1a3b){if(_0x1f1a3b){return _0x1f1a3b['update'](_0x516921)[_0x4e5c('0x31')](function(_0x2e87d1){return _0x2e87d1;});}return null;};}function removeEntity(_0xbd7bf5,_0x5176cb){return function(_0x450d48){if(_0x450d48){return _0x450d48[_0x4e5c('0x32')]()[_0x4e5c('0x31')](function(){var _0xa6aeac=_0x450d48['get']({'plain':!![]});var _0x45e7b0=_0x4e5c('0x33');return db[_0x4e5c('0x34')][_0x4e5c('0x32')]({'where':{'type':_0x45e7b0,'resourceId':_0xa6aeac['id']}})[_0x4e5c('0x31')](function(){return _0x450d48;});})['then'](function(){_0xbd7bf5[_0x4e5c('0x29')](0xcc)[_0x4e5c('0x35')]();});}};}function handleEntityNotFound(_0x324403,_0x1f4b53){return function(_0x3282d4){if(!_0x3282d4){_0x324403[_0x4e5c('0x36')](0x194);}return _0x3282d4;};}function handleError(_0x5e2373,_0x337446){_0x337446=_0x337446||0x1f4;return function(_0x38ee78){logger[_0x4e5c('0x24')](_0x38ee78[_0x4e5c('0x37')]);if(_0x38ee78['name']){delete _0x38ee78[_0x4e5c('0x38')];}_0x5e2373[_0x4e5c('0x29')](_0x337446)[_0x4e5c('0x39')](_0x38ee78);};}exports[_0x4e5c('0x3a')]=function(_0x51ba6b,_0x57c48e){var _0x2a90da={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x420b1e={},_0x430cc1={'count':0x0,'rows':[]};var _0x4c5f7c=_[_0x4e5c('0x3b')](db['FaxAccount']['rawAttributes'],function(_0x29cab6){return{'name':_0x29cab6[_0x4e5c('0x3c')],'type':_0x29cab6[_0x4e5c('0x3d')][_0x4e5c('0x3e')]};});_0x420b1e[_0x4e5c('0x3f')]=_[_0x4e5c('0x3b')](_0x4c5f7c,_0x4e5c('0x38'));_0x420b1e[_0x4e5c('0x40')]=_[_0x4e5c('0x41')](_0x51ba6b[_0x4e5c('0x40')]);_0x420b1e[_0x4e5c('0x42')]=_[_0x4e5c('0x43')](_0x420b1e[_0x4e5c('0x3f')],_0x420b1e[_0x4e5c('0x40')]);_0x2a90da[_0x4e5c('0x44')]=_[_0x4e5c('0x43')](_0x420b1e['model'],qs[_0x4e5c('0x45')](_0x51ba6b[_0x4e5c('0x40')][_0x4e5c('0x45')]));_0x2a90da[_0x4e5c('0x44')]=_0x2a90da[_0x4e5c('0x44')][_0x4e5c('0x46')]?_0x2a90da['attributes']:_0x420b1e[_0x4e5c('0x3f')];if(!_0x51ba6b[_0x4e5c('0x40')]['hasOwnProperty'](_0x4e5c('0x47'))){_0x2a90da[_0x4e5c('0x2e')]=qs[_0x4e5c('0x2e')](_0x51ba6b[_0x4e5c('0x40')]['limit']);_0x2a90da[_0x4e5c('0x2b')]=qs[_0x4e5c('0x2b')](_0x51ba6b[_0x4e5c('0x40')]['offset']);}_0x2a90da[_0x4e5c('0x48')]=qs[_0x4e5c('0x49')](_0x51ba6b[_0x4e5c('0x40')][_0x4e5c('0x49')]);_0x2a90da[_0x4e5c('0x4a')]=qs[_0x4e5c('0x42')](_[_0x4e5c('0x4b')](_0x51ba6b[_0x4e5c('0x40')],_0x420b1e[_0x4e5c('0x42')]),_0x4c5f7c);if(_0x51ba6b[_0x4e5c('0x40')]['filter']){_0x2a90da['where']=_[_0x4e5c('0x4c')](_0x2a90da['where'],{'$or':_[_0x4e5c('0x3b')](_0x4c5f7c,function(_0x2f4a5a){if(_0x2f4a5a[_0x4e5c('0x3d')]!==_0x4e5c('0x4d')){var _0x86fac={};_0x86fac[_0x2f4a5a['name']]={'$like':'%'+_0x51ba6b[_0x4e5c('0x40')][_0x4e5c('0x4e')]+'%'};return _0x86fac;}})});}_0x2a90da=_[_0x4e5c('0x4c')]({},_0x2a90da,_0x51ba6b['options']);var _0x3cf932={'where':_0x2a90da[_0x4e5c('0x4a')]};return db[_0x4e5c('0x4f')][_0x4e5c('0x2d')](_0x3cf932)[_0x4e5c('0x31')](function(_0x3e9b76){_0x430cc1[_0x4e5c('0x2d')]=_0x3e9b76;if(_0x51ba6b[_0x4e5c('0x40')][_0x4e5c('0x50')]){_0x2a90da[_0x4e5c('0x51')]=[{'all':!![]}];}return db[_0x4e5c('0x4f')][_0x4e5c('0x52')](_0x2a90da);})[_0x4e5c('0x31')](function(_0x4b9ab2){_0x430cc1['rows']=_0x4b9ab2;return _0x430cc1;})[_0x4e5c('0x31')](respondWithFilteredResult(_0x57c48e,_0x2a90da))[_0x4e5c('0x28')](handleError(_0x57c48e,null));};exports[_0x4e5c('0x53')]=function(_0x3b9fee,_0x1e70d2){var _0x2ffef7={'raw':![],'where':{'id':_0x3b9fee[_0x4e5c('0x54')]['id']},'include':[{'model':db[_0x4e5c('0x55')],'as':_0x4e5c('0x56')}]},_0x110d82={};_0x110d82[_0x4e5c('0x3f')]=_[_0x4e5c('0x41')](db['FaxAccount'][_0x4e5c('0x57')]);_0x110d82['query']=_[_0x4e5c('0x41')](_0x3b9fee[_0x4e5c('0x40')]);_0x110d82[_0x4e5c('0x42')]=_[_0x4e5c('0x43')](_0x110d82['model'],_0x110d82[_0x4e5c('0x40')]);_0x2ffef7['attributes']=_[_0x4e5c('0x43')](_0x110d82[_0x4e5c('0x3f')],qs[_0x4e5c('0x45')](_0x3b9fee[_0x4e5c('0x40')][_0x4e5c('0x45')]));_0x2ffef7[_0x4e5c('0x44')]=_0x2ffef7[_0x4e5c('0x44')][_0x4e5c('0x46')]?_0x2ffef7[_0x4e5c('0x44')]:_0x110d82['model'];if(_0x3b9fee[_0x4e5c('0x40')][_0x4e5c('0x50')]){_0x2ffef7[_0x4e5c('0x51')]=[{'all':!![]}];}_0x2ffef7=_[_0x4e5c('0x4c')]({},_0x2ffef7,_0x3b9fee[_0x4e5c('0x58')]);return db[_0x4e5c('0x4f')][_0x4e5c('0x59')](_0x2ffef7)[_0x4e5c('0x31')](handleEntityNotFound(_0x1e70d2,null))[_0x4e5c('0x31')](respondWithResult(_0x1e70d2,null))['catch'](handleError(_0x1e70d2,null));};exports[_0x4e5c('0x5a')]=function(_0x2936e1,_0x2eb1fa){return db['FaxAccount'][_0x4e5c('0x5a')](_0x2936e1[_0x4e5c('0x5b')],{})[_0x4e5c('0x31')](function(_0x1d5d72){var _0x445241=_0x2936e1[_0x4e5c('0x5c')][_0x4e5c('0x5d')]({'plain':!![]});if(!_0x445241)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x445241[_0x4e5c('0x5e')]===_0x4e5c('0x5c')){var _0x5017f4=_0x1d5d72['get']({'plain':!![]});var _0x5236db='FaxAccounts';return db[_0x4e5c('0x5f')]['find']({'where':{'name':_0x5236db,'userProfileId':_0x445241[_0x4e5c('0x60')]},'raw':!![]})[_0x4e5c('0x31')](function(_0x48ed97){if(_0x48ed97&&_0x48ed97['autoAssociation']===0x0){return db[_0x4e5c('0x34')][_0x4e5c('0x5a')]({'name':_0x5017f4['name'],'resourceId':_0x5017f4['id'],'type':_0x48ed97[_0x4e5c('0x38')],'sectionId':_0x48ed97['id']},{})['then'](function(){return _0x1d5d72;});}else{return _0x1d5d72;}})['catch'](function(_0x4e536e){logger[_0x4e5c('0x24')](_0x4e5c('0x61'),_0x4e536e);throw _0x4e536e;});}return _0x1d5d72;})[_0x4e5c('0x31')](respondWithResult(_0x2eb1fa,0xc9))['catch'](handleError(_0x2eb1fa,null));};exports[_0x4e5c('0x62')]=function(_0x2bc14b,_0x2a69e5){if(_0x2bc14b[_0x4e5c('0x5b')]['id']){delete _0x2bc14b[_0x4e5c('0x5b')]['id'];}return db[_0x4e5c('0x4f')][_0x4e5c('0x59')]({'where':{'id':_0x2bc14b[_0x4e5c('0x54')]['id']},'include':[{'model':db[_0x4e5c('0x55')],'as':_0x4e5c('0x56')}]})[_0x4e5c('0x31')](handleEntityNotFound(_0x2a69e5,null))[_0x4e5c('0x31')](saveUpdates(_0x2bc14b[_0x4e5c('0x5b')],null))[_0x4e5c('0x31')](respondWithResult(_0x2a69e5,null))[_0x4e5c('0x28')](handleError(_0x2a69e5,null));};exports[_0x4e5c('0x32')]=function(_0x471f56,_0x23c9c1){return db[_0x4e5c('0x4f')][_0x4e5c('0x59')]({'where':{'id':_0x471f56['params']['id']}})[_0x4e5c('0x31')](handleEntityNotFound(_0x23c9c1,null))[_0x4e5c('0x31')](removeEntity(_0x23c9c1,null))[_0x4e5c('0x28')](handleError(_0x23c9c1,null));};exports[_0x4e5c('0x63')]=function(_0x2f6de0,_0x1eb527){return db[_0x4e5c('0x4f')][_0x4e5c('0x63')]()[_0x4e5c('0x31')](respondWithResult(_0x1eb527,null))[_0x4e5c('0x28')](handleError(_0x1eb527,null));};exports[_0x4e5c('0x64')]=function(_0x54b8ab,_0x2e773c,_0x2b4b84){if(_0x54b8ab[_0x4e5c('0x5b')]['id']){delete _0x54b8ab['body']['id'];}return db[_0x4e5c('0x4f')][_0x4e5c('0x59')]({'where':{'id':_0x54b8ab[_0x4e5c('0x54')]['id']}})[_0x4e5c('0x31')](handleEntityNotFound(_0x2e773c,null))[_0x4e5c('0x31')](function(_0x53d383){if(_0x53d383){_0x54b8ab['body'][_0x4e5c('0x65')]=_0x53d383['id'];return db[_0x4e5c('0x66')][_0x4e5c('0x5a')](_0x54b8ab['body']);}})[_0x4e5c('0x31')](respondWithResult(_0x2e773c,null))[_0x4e5c('0x28')](handleError(_0x2e773c,null));};exports['getDispositions']=function(_0xefc9b6,_0xb8775,_0x3b07fe){var _0x741167={'raw':![],'where':{}};var _0x59a8b7={};var _0x1de048={'count':0x0,'rows':[]};return db[_0x4e5c('0x4f')]['findOne']({'where':{'id':_0xefc9b6[_0x4e5c('0x54')]['id']}})[_0x4e5c('0x31')](handleEntityNotFound(_0xb8775,null))[_0x4e5c('0x31')](function(_0x1588c7){if(_0x1588c7){_0x59a8b7[_0x4e5c('0x3f')]=_['keys'](db[_0x4e5c('0x66')][_0x4e5c('0x57')]);_0x59a8b7[_0x4e5c('0x40')]=_[_0x4e5c('0x41')](_0xefc9b6[_0x4e5c('0x40')]);_0x59a8b7[_0x4e5c('0x42')]=_[_0x4e5c('0x43')](_0x59a8b7[_0x4e5c('0x3f')],_0x59a8b7[_0x4e5c('0x40')]);_0x741167['attributes']=_['intersection'](_0x59a8b7[_0x4e5c('0x3f')],qs[_0x4e5c('0x45')](_0xefc9b6[_0x4e5c('0x40')][_0x4e5c('0x45')]));_0x741167['attributes']=_0x741167[_0x4e5c('0x44')][_0x4e5c('0x46')]?_0x741167['attributes']:_0x59a8b7['model'];if(!_0xefc9b6['query'][_0x4e5c('0x67')](_0x4e5c('0x47'))){_0x741167[_0x4e5c('0x2e')]=qs[_0x4e5c('0x2e')](_0xefc9b6[_0x4e5c('0x40')][_0x4e5c('0x2e')]);_0x741167[_0x4e5c('0x2b')]=qs[_0x4e5c('0x2b')](_0xefc9b6[_0x4e5c('0x40')][_0x4e5c('0x2b')]);}_0x741167[_0x4e5c('0x48')]=qs[_0x4e5c('0x49')](_0xefc9b6['query'][_0x4e5c('0x49')]);_0x741167[_0x4e5c('0x4a')]=qs[_0x4e5c('0x42')](_['pick'](_0xefc9b6[_0x4e5c('0x40')],_0x59a8b7['filters']));_0x741167[_0x4e5c('0x4a')][_0x4e5c('0x65')]=_0x1588c7['id'];if(_0xefc9b6[_0x4e5c('0x40')]['filter']){_0x741167['where']=_[_0x4e5c('0x4c')](_0x741167[_0x4e5c('0x4a')],{'$or':_[_0x4e5c('0x3b')](_0x741167[_0x4e5c('0x44')],function(_0x29e4c2){var _0x8e5e7c={};_0x8e5e7c[_0x29e4c2]={'$like':'%'+_0xefc9b6[_0x4e5c('0x40')][_0x4e5c('0x4e')]+'%'};return _0x8e5e7c;})});}_0x741167=_[_0x4e5c('0x4c')]({},_0x741167,_0xefc9b6[_0x4e5c('0x58')]);return db[_0x4e5c('0x66')][_0x4e5c('0x2d')]({'where':_0x741167['where']})['then'](function(_0x3d68fd){_0x1de048[_0x4e5c('0x2d')]=_0x3d68fd;if(_0xefc9b6[_0x4e5c('0x40')]['includeAll']){_0x741167[_0x4e5c('0x51')]=[{'all':!![]}];}return db[_0x4e5c('0x66')][_0x4e5c('0x52')](_0x741167);})[_0x4e5c('0x31')](function(_0x3cf05d){_0x1de048['rows']=_0x3cf05d;return _0x1de048;});}})[_0x4e5c('0x31')](respondWithFilteredResult(_0xb8775,_0x741167))[_0x4e5c('0x28')](handleError(_0xb8775,null));};exports[_0x4e5c('0x68')]=function(_0x19d85d,_0x39d065,_0xf82d22){return db['FaxAccount'][_0x4e5c('0x59')]({'where':{'id':_0x19d85d[_0x4e5c('0x54')]['id']}})[_0x4e5c('0x31')](handleEntityNotFound(_0x39d065,null))[_0x4e5c('0x31')](function(_0xb2f9c){if(_0xb2f9c){return _0xb2f9c['removeDispositions'](_0x19d85d[_0x4e5c('0x40')]['ids']);}})[_0x4e5c('0x31')](respondWithStatusCode(_0x39d065,null))[_0x4e5c('0x28')](handleError(_0x39d065,null));};exports[_0x4e5c('0x69')]=function(_0x8bbc34,_0x3d10b7,_0x39d55e){if(_0x8bbc34[_0x4e5c('0x5b')]['id']){delete _0x8bbc34['body']['id'];}return db['FaxAccount'][_0x4e5c('0x59')]({'where':{'id':_0x8bbc34['params']['id']}})['then'](handleEntityNotFound(_0x3d10b7,null))['then'](function(_0x5e5552){if(_0x5e5552){_0x8bbc34['body'][_0x4e5c('0x65')]=_0x5e5552['id'];return db['CannedAnswer'][_0x4e5c('0x5a')](_0x8bbc34[_0x4e5c('0x5b')]);}})[_0x4e5c('0x31')](respondWithResult(_0x3d10b7,null))[_0x4e5c('0x28')](handleError(_0x3d10b7,null));};exports[_0x4e5c('0x6a')]=function(_0x68978c,_0x1c94fc,_0x1ef546){var _0x20a037={'raw':![],'where':{}};var _0x342719={};var _0x4fbdb8={'count':0x0,'rows':[]};return db[_0x4e5c('0x4f')][_0x4e5c('0x6b')]({'where':{'id':_0x68978c[_0x4e5c('0x54')]['id']}})[_0x4e5c('0x31')](handleEntityNotFound(_0x1c94fc,null))[_0x4e5c('0x31')](function(_0x5022b2){if(_0x5022b2){_0x342719[_0x4e5c('0x3f')]=_[_0x4e5c('0x41')](db['CannedAnswer']['rawAttributes']);_0x342719[_0x4e5c('0x40')]=_['keys'](_0x68978c[_0x4e5c('0x40')]);_0x342719[_0x4e5c('0x42')]=_['intersection'](_0x342719[_0x4e5c('0x3f')],_0x342719[_0x4e5c('0x40')]);_0x20a037[_0x4e5c('0x44')]=_['intersection'](_0x342719[_0x4e5c('0x3f')],qs[_0x4e5c('0x45')](_0x68978c['query'][_0x4e5c('0x45')]));_0x20a037[_0x4e5c('0x44')]=_0x20a037[_0x4e5c('0x44')]['length']?_0x20a037[_0x4e5c('0x44')]:_0x342719[_0x4e5c('0x3f')];if(!_0x68978c[_0x4e5c('0x40')][_0x4e5c('0x67')](_0x4e5c('0x47'))){_0x20a037['limit']=qs[_0x4e5c('0x2e')](_0x68978c[_0x4e5c('0x40')]['limit']);_0x20a037[_0x4e5c('0x2b')]=qs[_0x4e5c('0x2b')](_0x68978c[_0x4e5c('0x40')][_0x4e5c('0x2b')]);}_0x20a037[_0x4e5c('0x48')]=qs[_0x4e5c('0x49')](_0x68978c[_0x4e5c('0x40')][_0x4e5c('0x49')]);_0x20a037['where']=qs[_0x4e5c('0x42')](_[_0x4e5c('0x4b')](_0x68978c[_0x4e5c('0x40')],_0x342719['filters']));_0x20a037[_0x4e5c('0x4a')][_0x4e5c('0x65')]=_0x5022b2['id'];if(_0x68978c[_0x4e5c('0x40')][_0x4e5c('0x4e')]){_0x20a037[_0x4e5c('0x4a')]=_[_0x4e5c('0x4c')](_0x20a037[_0x4e5c('0x4a')],{'$or':_[_0x4e5c('0x3b')](_0x20a037[_0x4e5c('0x44')],function(_0x4c063e){var _0x2d9552={};_0x2d9552[_0x4c063e]={'$like':'%'+_0x68978c[_0x4e5c('0x40')][_0x4e5c('0x4e')]+'%'};return _0x2d9552;})});}_0x20a037=_[_0x4e5c('0x4c')]({},_0x20a037,_0x68978c['options']);return db[_0x4e5c('0x6c')][_0x4e5c('0x2d')]({'where':_0x20a037[_0x4e5c('0x4a')]})['then'](function(_0x5e55fd){_0x4fbdb8[_0x4e5c('0x2d')]=_0x5e55fd;if(_0x68978c[_0x4e5c('0x40')][_0x4e5c('0x50')]){_0x20a037[_0x4e5c('0x51')]=[{'all':!![]}];}return db[_0x4e5c('0x6c')][_0x4e5c('0x52')](_0x20a037);})[_0x4e5c('0x31')](function(_0x23cc4a){_0x4fbdb8[_0x4e5c('0x6d')]=_0x23cc4a;return _0x4fbdb8;});}})[_0x4e5c('0x31')](respondWithFilteredResult(_0x1c94fc,_0x20a037))[_0x4e5c('0x28')](handleError(_0x1c94fc,null));};exports[_0x4e5c('0x6e')]=function(_0x518388,_0x4de5c4,_0x173b57){return db[_0x4e5c('0x4f')]['find']({'where':{'id':_0x518388[_0x4e5c('0x54')]['id']}})[_0x4e5c('0x31')](handleEntityNotFound(_0x4de5c4,null))['then'](function(_0x50f43a){if(_0x50f43a){return _0x50f43a[_0x4e5c('0x6e')](_0x518388[_0x4e5c('0x40')][_0x4e5c('0x6f')]);}})[_0x4e5c('0x31')](respondWithStatusCode(_0x4de5c4,null))[_0x4e5c('0x28')](handleError(_0x4de5c4,null));};exports['addInteraction']=function(_0x5963a1,_0x56a692,_0x48846c){return db[_0x4e5c('0x70')]['find']({'where':{'id':_0x5963a1[_0x4e5c('0x54')]['id']}})['then'](handleEntityNotFound(_0x56a692,null))[_0x4e5c('0x31')](function(_0x35e6df){if(_0x35e6df){return _0x35e6df['addInteraction'](_0x5963a1[_0x4e5c('0x5b')][_0x4e5c('0x6f')],_[_0x4e5c('0x71')](_0x5963a1[_0x4e5c('0x5b')],['ids','id'])||{});}})['then'](respondWithResult(_0x56a692,null))['catch'](handleError(_0x56a692,null));};exports['getInteractions']=function(_0x3294b6,_0x403464,_0x5e3792){var _0x274ca2={'raw':![],'where':{}};var _0xb640cc={};var _0x57aa74={'count':0x0,'rows':[]};return db[_0x4e5c('0x4f')]['findOne']({'where':{'id':_0x3294b6[_0x4e5c('0x54')]['id']}})[_0x4e5c('0x31')](handleEntityNotFound(_0x403464,null))[_0x4e5c('0x31')](function(_0x570427){if(_0x570427){_0xb640cc[_0x4e5c('0x3f')]=_['keys'](db[_0x4e5c('0x70')][_0x4e5c('0x57')]);_0xb640cc[_0x4e5c('0x40')]=_[_0x4e5c('0x41')](_0x3294b6[_0x4e5c('0x40')]);_0xb640cc[_0x4e5c('0x42')]=_[_0x4e5c('0x43')](_0xb640cc['model'],_0xb640cc[_0x4e5c('0x40')]);_0x274ca2[_0x4e5c('0x44')]=_['intersection'](_0xb640cc[_0x4e5c('0x3f')],qs[_0x4e5c('0x45')](_0x3294b6[_0x4e5c('0x40')][_0x4e5c('0x45')]));_0x274ca2['attributes']=_0x274ca2['attributes']['length']?_0x274ca2['attributes']:_0xb640cc['model'];if(!_0x3294b6[_0x4e5c('0x40')][_0x4e5c('0x67')]('nolimit')){_0x274ca2[_0x4e5c('0x2e')]=qs[_0x4e5c('0x2e')](_0x3294b6[_0x4e5c('0x40')]['limit']);_0x274ca2[_0x4e5c('0x2b')]=qs[_0x4e5c('0x2b')](_0x3294b6[_0x4e5c('0x40')][_0x4e5c('0x2b')]);}_0x274ca2[_0x4e5c('0x48')]=qs[_0x4e5c('0x49')](_0x3294b6[_0x4e5c('0x40')][_0x4e5c('0x49')]);_0x274ca2['where']=qs[_0x4e5c('0x42')](_['pick'](_0x3294b6[_0x4e5c('0x40')],_0xb640cc[_0x4e5c('0x42')]));_0x274ca2[_0x4e5c('0x4a')][_0x4e5c('0x65')]=_0x570427['id'];if(_0x3294b6['query'][_0x4e5c('0x4e')]){_0x274ca2[_0x4e5c('0x4a')]=_[_0x4e5c('0x4c')](_0x274ca2[_0x4e5c('0x4a')],{'$or':_[_0x4e5c('0x3b')](_0x274ca2[_0x4e5c('0x44')],function(_0x3045f4){var _0x3152e1={};_0x3152e1[_0x3045f4]={'$like':'%'+_0x3294b6[_0x4e5c('0x40')][_0x4e5c('0x4e')]+'%'};return _0x3152e1;})});}_0x274ca2=_['merge']({},_0x274ca2,_0x3294b6[_0x4e5c('0x58')]);return db[_0x4e5c('0x70')][_0x4e5c('0x2d')]({'where':_0x274ca2[_0x4e5c('0x4a')]})[_0x4e5c('0x31')](function(_0x2e2aef){_0x57aa74[_0x4e5c('0x2d')]=_0x2e2aef;if(_0x3294b6[_0x4e5c('0x40')]['includeAll']){_0x274ca2['include']=[{'model':db[_0x4e5c('0x72')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x4e5c('0x73'),'attributes':[_0x4e5c('0x38'),_0x4e5c('0x74'),_0x4e5c('0x75')],'required':![]},{'model':db[_0x4e5c('0x76')],'as':_0x4e5c('0x77'),'attributes':['id',_0x4e5c('0x38'),_0x4e5c('0x78')],'where':_0x3294b6['query'][_0x4e5c('0x79')]?{'id':_0x3294b6[_0x4e5c('0x40')]['tag']}:undefined,'required':_0x3294b6[_0x4e5c('0x40')][_0x4e5c('0x79')]?!![]:![]}];}return db[_0x4e5c('0x70')][_0x4e5c('0x52')](_0x274ca2);})[_0x4e5c('0x31')](function(_0x523862){_0x57aa74[_0x4e5c('0x6d')]=_0x523862;return _0x57aa74;});}})[_0x4e5c('0x31')](respondWithFilteredResult(_0x403464,_0x274ca2))[_0x4e5c('0x28')](handleError(_0x403464,null));};exports[_0x4e5c('0x7a')]=function(_0x1c31b5,_0x459cfc){var _0x3a92e5=_0x1c31b5[_0x4e5c('0x54')]['id'];var _0x527abd=_0x1c31b5['body'];var _0x23dc17=0xc8;var _0x5df01e=null;return db[_0x4e5c('0x7b')]['transaction']({'isolationLevel':db[_0x4e5c('0x7b')][_0x4e5c('0x7c')][_0x4e5c('0x7d')][_0x4e5c('0x7e')]},function(_0x4342c2){return db['FaxAccount']['findOne']({'where':{'id':_0x3a92e5},'transaction':_0x4342c2})['then'](function(_0x35c8cd){if(_0x35c8cd){return db[_0x4e5c('0x7f')][_0x4e5c('0x32')]({'where':{'FaxAccountId':_0x3a92e5},'transaction':_0x4342c2})[_0x4e5c('0x31')](function(){var _0x396bbe=_[_0x4e5c('0x3b')](_0x527abd,function(_0x49a545){_0x49a545[_0x4e5c('0x65')]=_0x3a92e5;return _0x49a545;});return db[_0x4e5c('0x7f')][_0x4e5c('0x80')](_0x396bbe,{'transaction':_0x4342c2});});}else{_0x23dc17=0x194;_0x5df01e=[];}});})[_0x4e5c('0x31')](function(){if(_0x23dc17!==0x194){return db[_0x4e5c('0x7f')]['findAndCountAll']({'where':{'FaxAccountId':_0x3a92e5},'order':_0x4e5c('0x81')})[_0x4e5c('0x31')](function(_0xe52f55){_0x5df01e=_0xe52f55;});}})[_0x4e5c('0x28')](function(_0x4e3974){_0x23dc17=0x1f4;logger[_0x4e5c('0x24')](_0x4e3974[_0x4e5c('0x37')]);if(_0x4e3974[_0x4e5c('0x38')]){delete _0x4e3974[_0x4e5c('0x38')];}_0x5df01e=_0x4e3974;})[_0x4e5c('0x82')](function(){if(_0x5df01e===null){_0x459cfc['sendStatus'](_0x23dc17);}else{if(_0x23dc17===0x1f4){_0x459cfc[_0x4e5c('0x29')](_0x23dc17)[_0x4e5c('0x39')](_0x5df01e);}else{_0x459cfc['status'](_0x23dc17)[_0x4e5c('0x2a')](_0x5df01e);}}});};exports[_0x4e5c('0x83')]=function(_0x329a7,_0x4b3218,_0x24ba8e){var _0x21cbef={};var _0x41fc76={};var _0x1fb080;var _0x542ce1;return db[_0x4e5c('0x4f')][_0x4e5c('0x6b')]({'where':{'id':_0x329a7[_0x4e5c('0x54')]['id']}})[_0x4e5c('0x31')](handleEntityNotFound(_0x4b3218,null))[_0x4e5c('0x31')](function(_0x149fe6){if(_0x149fe6){_0x1fb080=_0x149fe6;_0x41fc76[_0x4e5c('0x3f')]=_[_0x4e5c('0x41')](db[_0x4e5c('0x7f')]['rawAttributes']);_0x41fc76[_0x4e5c('0x40')]=_[_0x4e5c('0x41')](_0x329a7[_0x4e5c('0x40')]);_0x41fc76[_0x4e5c('0x42')]=_[_0x4e5c('0x43')](_0x41fc76[_0x4e5c('0x3f')],_0x41fc76[_0x4e5c('0x40')]);_0x21cbef[_0x4e5c('0x44')]=_['intersection'](_0x41fc76[_0x4e5c('0x3f')],qs[_0x4e5c('0x45')](_0x329a7[_0x4e5c('0x40')][_0x4e5c('0x45')]));_0x21cbef['attributes']=_0x21cbef[_0x4e5c('0x44')][_0x4e5c('0x46')]?_0x21cbef['attributes']:_0x41fc76['model'];_0x21cbef[_0x4e5c('0x48')]=qs[_0x4e5c('0x49')](_0x329a7['query']['sort']);_0x21cbef[_0x4e5c('0x4a')]=qs[_0x4e5c('0x42')](_[_0x4e5c('0x4b')](_0x329a7[_0x4e5c('0x40')],_0x41fc76[_0x4e5c('0x42')]));if(_0x329a7['query'][_0x4e5c('0x4e')]){_0x21cbef[_0x4e5c('0x4a')]=_[_0x4e5c('0x4c')](_0x21cbef['where'],{'$or':_[_0x4e5c('0x3b')](_0x21cbef['attributes'],function(_0x39f3df){var _0x3cf911={};_0x3cf911[_0x39f3df]={'$like':'%'+_0x329a7['query'][_0x4e5c('0x4e')]+'%'};return _0x3cf911;})});}_0x21cbef=_[_0x4e5c('0x4c')]({},_0x21cbef,_0x329a7[_0x4e5c('0x58')]);return _0x1fb080['getApplications'](_0x21cbef);}})[_0x4e5c('0x31')](function(_0x2d2e03){if(_0x2d2e03){_0x542ce1=_0x2d2e03[_0x4e5c('0x46')];if(!_0x329a7[_0x4e5c('0x40')][_0x4e5c('0x67')](_0x4e5c('0x47'))){_0x21cbef[_0x4e5c('0x2e')]=qs[_0x4e5c('0x2e')](_0x329a7[_0x4e5c('0x40')][_0x4e5c('0x2e')]);_0x21cbef['offset']=qs[_0x4e5c('0x2b')](_0x329a7['query'][_0x4e5c('0x2b')]);}return _0x1fb080[_0x4e5c('0x83')](_0x21cbef);}})[_0x4e5c('0x31')](function(_0x5210ad){if(_0x5210ad){return _0x5210ad?{'count':_0x542ce1,'rows':_0x5210ad}:null;}})[_0x4e5c('0x31')](respondWithResult(_0x4b3218,null))[_0x4e5c('0x28')](handleError(_0x4b3218,null));};function Extension(_0xf64c57,_0x5a4558,_0x3e7227,_0x1ba98a){this['context']=_0x4e5c('0x84');this[_0x4e5c('0x85')]=_0xf64c57[_0x4e5c('0x86')];this[_0x4e5c('0x87')]=_0x1ba98a;this[_0x4e5c('0x3d')]=_0x4e5c('0x88');this[_0x4e5c('0x89')]=_0x4e5c('0x8a');this[_0x4e5c('0x65')]=_0xf64c57['id'];this[_0x4e5c('0x81')]=_0x5a4558;this[_0x4e5c('0x8b')]=_0x3e7227;}function createExtensionsReciveFax(_0x454433){var _0x495f10=0x1;var _0xa914d=[];_0xa914d[_0x4e5c('0x8c')](new Extension(_0x454433,_0x495f10,'',_0x4e5c('0x8d')));_0x495f10+=0x1;_0xa914d[_0x4e5c('0x8c')](new Extension(_0x454433,_0x495f10,_0x4e5c('0x8e'),_0x4e5c('0x8f')));_0x495f10+=0x1;for(var _0x811e38 in _0x454433){if(_0x454433[_0x4e5c('0x67')](_0x811e38)&&(_0x811e38===_0x4e5c('0x90')||_0x811e38===_0x4e5c('0x86')||_0x811e38===_0x4e5c('0x91')||_0x811e38===_0x4e5c('0x92')||_0x811e38===_0x4e5c('0x93')||_0x811e38==='maxrate'||_0x811e38===_0x4e5c('0x94')||_0x811e38==='modem'||_0x811e38===_0x4e5c('0x95'))){_0xa914d['push'](new Extension(_0x454433,_0x495f10,_0x4e5c('0x96')+_0x811e38+')='+_0x454433[_0x811e38],_0x4e5c('0x8f')));_0x495f10+=0x1;}}_0xa914d[_0x4e5c('0x8c')](new Extension(_0x454433,_0x495f10,'6',_0x4e5c('0x97')));_0x495f10+=0x1;_0xa914d['push'](new Extension(_0x454433,_0x495f10,_0x4e5c('0x98'),_0x4e5c('0x99')));_0x495f10=0x0;return _0xa914d;}exports[_0x4e5c('0x9a')]=function(_0x26f5af,_0xe1a3b3,_0xf32863){var _0x41a6ec;return db[_0x4e5c('0x7b')][_0x4e5c('0x9b')](function(_0x423507){return db[_0x4e5c('0x4f')][_0x4e5c('0x5a')](_0x26f5af[_0x4e5c('0x5b')],{'transaction':_0x423507})[_0x4e5c('0x31')](function(_0x578d4b){_0x41a6ec=_0x578d4b[_0x4e5c('0x5d')]({'plain':!![]});return db[_0x4e5c('0x9c')][_0x4e5c('0x80')](createExtensionsReciveFax(_0x41a6ec),{'transaction':_0x423507});});})[_0x4e5c('0x31')](function(){return _0x41a6ec;})['then'](respondWithResult(_0xe1a3b3,null))[_0x4e5c('0x28')](handleError(_0xe1a3b3,null));};exports['updateAccountApplications']=function(_0x112edf,_0xb69f04,_0x3e5df9){var _0x5cf8d2;return db[_0x4e5c('0x7b')][_0x4e5c('0x9b')](function(_0x297475){return db[_0x4e5c('0x4f')][_0x4e5c('0x62')](_0x112edf[_0x4e5c('0x5b')],{'where':{'id':_0x112edf[_0x4e5c('0x5b')]['id']},'transaction':_0x297475})['then'](function(_0x35f82c){return db['VoiceExtension'][_0x4e5c('0x32')]({'where':{'FaxAccountId':_0x112edf[_0x4e5c('0x5b')]['id']},'transaction':_0x297475})[_0x4e5c('0x31')](function(_0x2cce0e){return db[_0x4e5c('0x9c')][_0x4e5c('0x80')](createExtensionsReciveFax(_[_0x4e5c('0x71')](_0x112edf['body'],[_0x4e5c('0x9d'),_0x4e5c('0x3e'),'createdAt','updatedAt',_0x4e5c('0x9e'),_0x4e5c('0x9f')])),{'transaction':_0x297475});});});})[_0x4e5c('0x31')](function(){return db['FaxAccount'][_0x4e5c('0xa0')](_0x112edf[_0x4e5c('0x5b')]['id']);})['then'](respondWithResult(_0xb69f04,null))[_0x4e5c('0x28')](handleError(_0xb69f04,null));};exports[_0x4e5c('0xa1')]=function(_0x3ef578,_0x3fc988,_0x2b4452){var _0x2a1d18={'raw':!![],'where':{}};var _0x4dae51={};var _0x50885a={'count':0x0,'rows':[]};return db[_0x4e5c('0x4f')][_0x4e5c('0x6b')]({'where':{'id':_0x3ef578[_0x4e5c('0x54')]['id']}})[_0x4e5c('0x31')](handleEntityNotFound(_0x3fc988,null))['then'](function(_0x455da3){if(_0x455da3){_0x4dae51['model']=_[_0x4e5c('0x41')](db[_0x4e5c('0xa2')][_0x4e5c('0x57')]);_0x4dae51[_0x4e5c('0x40')]=_['keys'](_0x3ef578[_0x4e5c('0x40')]);_0x4dae51[_0x4e5c('0x42')]=_[_0x4e5c('0x43')](_0x4dae51[_0x4e5c('0x3f')],_0x4dae51['query']);_0x2a1d18[_0x4e5c('0x44')]=_[_0x4e5c('0x43')](_0x4dae51['model'],qs[_0x4e5c('0x45')](_0x3ef578[_0x4e5c('0x40')][_0x4e5c('0x45')]));_0x2a1d18[_0x4e5c('0x44')]=_0x2a1d18['attributes'][_0x4e5c('0x46')]?_0x2a1d18[_0x4e5c('0x44')]:_0x4dae51['model'];if(!_0x3ef578[_0x4e5c('0x40')][_0x4e5c('0x67')](_0x4e5c('0x47'))){_0x2a1d18[_0x4e5c('0x2e')]=qs[_0x4e5c('0x2e')](_0x3ef578[_0x4e5c('0x40')][_0x4e5c('0x2e')]);_0x2a1d18[_0x4e5c('0x2b')]=qs['offset'](_0x3ef578[_0x4e5c('0x40')][_0x4e5c('0x2b')]);}_0x2a1d18[_0x4e5c('0x48')]=qs[_0x4e5c('0x49')](_0x3ef578[_0x4e5c('0x40')]['sort']);_0x2a1d18[_0x4e5c('0x4a')]=qs[_0x4e5c('0x42')](_[_0x4e5c('0x4b')](_0x3ef578[_0x4e5c('0x40')],_0x4dae51[_0x4e5c('0x42')]));_0x2a1d18[_0x4e5c('0x4a')][_0x4e5c('0x65')]=_0x455da3['id'];if(_0x3ef578[_0x4e5c('0x40')]['filter']){_0x2a1d18[_0x4e5c('0x4a')]=_[_0x4e5c('0x4c')](_0x2a1d18[_0x4e5c('0x4a')],{'$or':_['map'](_0x2a1d18[_0x4e5c('0x44')],function(_0x757245){var _0x1d6fdf={};_0x1d6fdf[_0x757245]={'$like':'%'+_0x3ef578[_0x4e5c('0x40')]['filter']+'%'};return _0x1d6fdf;})});}if(_0x3ef578['query'][_0x4e5c('0xa3')]){var _0x190e14=_0x3ef578['query'][_0x4e5c('0xa3')]['split'](',');var _0x4ce31c={};_0x4ce31c[_0x190e14[0x0]]={'$gte':moment(_0x190e14[0x1])[_0x4e5c('0xa4')](_0x4e5c('0xa5'))};_0x2a1d18[_0x4e5c('0x4a')]=_[_0x4e5c('0x4c')](_0x2a1d18['where'],_0x4ce31c);}_0x2a1d18=_[_0x4e5c('0x4c')]({},_0x2a1d18,_0x3ef578[_0x4e5c('0x58')]);return db[_0x4e5c('0xa2')]['count']({'where':_0x2a1d18[_0x4e5c('0x4a')]})[_0x4e5c('0x31')](function(_0x45e527){_0x50885a[_0x4e5c('0x2d')]=_0x45e527;if(_0x3ef578[_0x4e5c('0x40')][_0x4e5c('0x50')]){_0x2a1d18[_0x4e5c('0x51')]=[{'all':!![]}];}return db[_0x4e5c('0xa2')][_0x4e5c('0x52')](_0x2a1d18);})[_0x4e5c('0x31')](function(_0x4479d2){_0x50885a[_0x4e5c('0x6d')]=_0x4479d2;return _0x50885a;});}})['then'](respondWithFilteredResult(_0x3fc988,_0x2a1d18))[_0x4e5c('0x28')](handleError(_0x3fc988,null));};exports[_0x4e5c('0x39')]=function(_0x889fd9,_0x33c669,_0x10aab5){var _0x262db1,_0xf49806={},_0x1cdcbc;if(_0x889fd9[_0x4e5c('0x5b')]['to']){_0x1cdcbc=_0x889fd9[_0x4e5c('0x5b')]['to'][0x0];}return db[_0x4e5c('0x4f')][_0x4e5c('0x59')]({'where':{'id':_0x889fd9[_0x4e5c('0x54')]['id']},'include':[{'model':db[_0x4e5c('0xa6')],'as':_0x4e5c('0xa7'),'include':[{'model':db[_0x4e5c('0x72')],'as':'Contacts','where':{'fax':_0x1cdcbc},'limit':0x1,'order':[[_0x4e5c('0xa8'),_0x4e5c('0xa9')]]}]}]})[_0x4e5c('0x31')](handleEntityNotFound(_0x33c669,null))[_0x4e5c('0x31')](function(_0x957675){_0x262db1=_0x957675;if(_0x889fd9['body'][_0x4e5c('0xaa')]&&_0x889fd9[_0x4e5c('0x5b')][_0x4e5c('0xaa')][_0x4e5c('0x46')]){for(var _0x51461e=0x0;_0x51461e<_0x889fd9[_0x4e5c('0x5b')]['attachments'][_0x4e5c('0x46')];_0x51461e+=0x1){_0x889fd9[_0x4e5c('0x5b')][_0x4e5c('0xaa')][_0x51461e]={'filename':_0x889fd9[_0x4e5c('0x5b')][_0x4e5c('0xaa')][_0x51461e][_0x4e5c('0x38')],'id':_0x889fd9['body'][_0x4e5c('0xaa')][_0x51461e]['id'],'path':path[_0x4e5c('0xab')](config[_0x4e5c('0xac')],'server/files/attachments',_0x889fd9['body']['attachments'][_0x51461e][_0x4e5c('0xad')])};}}return respondWithRpcPromise(_0x4e5c('0xae'),_0x4e5c('0xae'),{'FaxAccountId':_[_0x4e5c('0xaf')](_0x889fd9[_0x4e5c('0x54')]['id'])?undefined:_0x889fd9[_0x4e5c('0x54')]['id'],'path':_[_0x4e5c('0xaf')](_0x889fd9['body']['attachments'][0x0][_0x4e5c('0x5')])?undefined:_0x889fd9[_0x4e5c('0x5b')]['attachments'][0x0][_0x4e5c('0x5')],'fax':_[_0x4e5c('0xaf')](_0x889fd9[_0x4e5c('0x5b')]['to'][0x0])?undefined:_0x889fd9[_0x4e5c('0x5b')]['to'][0x0]},client9002);})['then'](function(){if(_0x262db1){if(_['isNil'](_0x889fd9[_0x4e5c('0x5b')][_0x4e5c('0xb0')])){_0x889fd9[_0x4e5c('0x5b')][_0x4e5c('0xb0')]=util[_0x4e5c('0xa4')](_0x4e5c('0xb1'),_0x262db1[_0x4e5c('0x38')],_0x262db1[_0x4e5c('0xb2')]);}if(_0x262db1[_0x4e5c('0xa7')]){if(_0x262db1[_0x4e5c('0xa7')][_0x4e5c('0xb3')]['length']){return _0x262db1['List'][_0x4e5c('0xb3')][0x0];}else{return db[_0x4e5c('0x72')][_0x4e5c('0x5a')](_[_0x4e5c('0xb4')](_0x889fd9[_0x4e5c('0x5b')],{'firstName':_0x889fd9[_0x4e5c('0x5b')]['to'][0x0],'phone':_0x889fd9['body']['to'][0x0],'fax':_0x889fd9['body']['to'][0x0],'ListId':_0x262db1[_0x4e5c('0x9f')]}));}}else{throw new Error(_0x4e5c('0xb5'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x4e5c('0x31')](function(_0x3902b4){if(_0x3902b4){return db[_0x4e5c('0x70')][_0x4e5c('0x59')]({'where':{'ContactId':_0x3902b4['id'],'closed':![],'FaxAccountId':_0x262db1['id']}})[_0x4e5c('0x31')](function(_0x5d5fa2){if(_0x5d5fa2){return[_0x5d5fa2,![]];}return db[_0x4e5c('0x70')][_0x4e5c('0x5a')]({'UserId':_0x889fd9[_0x4e5c('0x5c')]['id'],'ContactId':_0x3902b4['id'],'FaxAccountId':_0x262db1['id'],'fax':_0x889fd9[_0x4e5c('0x5b')]['to'][0x0],'firstMsgDirection':_0x4e5c('0xb6'),'Messages':[_[_0x4e5c('0x4c')](_0x889fd9['body'],{'read':![],'body':_0x889fd9[_0x4e5c('0x5b')]['attachments'][0x0][_0x4e5c('0xb7')],'FaxAccountId':_0x262db1['id'],'UserId':_0x889fd9[_0x4e5c('0x5c')]['id'],'ContactId':_0x3902b4['id'],'AttachmentId':_0x889fd9[_0x4e5c('0x5b')][_0x4e5c('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x4e5c('0xa2')],'as':_0x4e5c('0xb8')}]})[_0x4e5c('0x31')](function(_0x173fcc){return[_0x173fcc,!![]];});});}else{throw new Error(_0x4e5c('0xb9'));}})['spread'](function(_0x425ed0,_0x78bdb7){if(_0x78bdb7){return _0x425ed0;}return db[_0x4e5c('0xa2')]['create']({'direction':_0x4e5c('0xb6'),'read':![],'body':_0x889fd9[_0x4e5c('0x5b')]['attachments'][0x0][_0x4e5c('0xb7')],'FaxAccountId':_0x262db1['id'],'FaxInteractionId':_0x425ed0['id'],'UserId':_0x889fd9[_0x4e5c('0x5c')]['id'],'ContactId':_0x425ed0[_0x4e5c('0xba')],'AttachmentId':_0x889fd9[_0x4e5c('0x5b')][_0x4e5c('0xaa')][0x0]['id']})[_0x4e5c('0x31')](function(_0x7f0175){_0x425ed0['dataValues'][_0x4e5c('0xb8')]=[];_0x425ed0[_0x4e5c('0xbb')][_0x4e5c('0xb8')][_0x4e5c('0x8c')](_0x7f0175[_0x4e5c('0xbb')]);return _0x425ed0;});})[_0x4e5c('0x31')](function(_0x4527e0){respondWithRpcPromise(_0x4e5c('0xbc'),_0x4e5c('0xbc'),{'FaxAccountId':_[_0x4e5c('0xaf')](_0x889fd9[_0x4e5c('0x54')]['id'])?undefined:_0x889fd9[_0x4e5c('0x54')]['id'],'path':_[_0x4e5c('0xaf')](_0x889fd9[_0x4e5c('0x5b')][_0x4e5c('0xaa')][0x0]['path'])?undefined:_0x889fd9[_0x4e5c('0x5b')][_0x4e5c('0xaa')][0x0][_0x4e5c('0x5')],'fax':_[_0x4e5c('0xaf')](_0x889fd9[_0x4e5c('0x5b')]['to'][0x0])?undefined:_0x889fd9[_0x4e5c('0x5b')]['to'][0x0],'AttachmentId':_0x889fd9[_0x4e5c('0x5b')][_0x4e5c('0xaa')][0x0]['id']},client9002)[_0x4e5c('0x31')](function(_0x240332){logger[_0x4e5c('0x21')](_0x4e5c('0xbd'),_0x240332);})['catch'](function(_0x5ba4b9){logger[_0x4e5c('0x21')](_0x4e5c('0xbd'),_0x5ba4b9);});return _0x4527e0;})[_0x4e5c('0x31')](respondWithResult(_0x33c669,null))[_0x4e5c('0x28')](handleError(_0x33c669,null));};exports[_0x4e5c('0xbe')]=function(_0x1a0c7f,_0x4ae40b,_0x54e486){return db[_0x4e5c('0x4f')]['find']({'where':{'id':_0x1a0c7f[_0x4e5c('0x54')]['id']}})[_0x4e5c('0x31')](handleEntityNotFound(_0x4ae40b,null))[_0x4e5c('0x31')](function(_0xb5a987){if(_0xb5a987){return _0xb5a987[_0x4e5c('0xbe')](_0x1a0c7f[_0x4e5c('0x5b')][_0x4e5c('0x6f')],_[_0x4e5c('0x71')](_0x1a0c7f[_0x4e5c('0x5b')],['ids','id'])||{})[_0x4e5c('0xbf')](function(_0x30d4b4){for(var _0x2106b9=0x0;_0x2106b9<_0x1a0c7f['body'][_0x4e5c('0x6f')]['length'];_0x2106b9+=0x1){socket[_0x4e5c('0xc0')](_0x4e5c('0xc1'),{'UserId':Number(_0x1a0c7f[_0x4e5c('0x5b')][_0x4e5c('0x6f')][_0x2106b9]),'FaxAccountId':Number(_0x1a0c7f[_0x4e5c('0x54')]['id'])});}return _0x30d4b4;});}})['then'](respondWithResult(_0x4ae40b,null))[_0x4e5c('0x28')](handleError(_0x4ae40b,null));};exports[_0x4e5c('0xc2')]=function(_0x5061c2,_0x243ab0,_0x43d492){return db[_0x4e5c('0x4f')][_0x4e5c('0x59')]({'where':{'id':_0x5061c2[_0x4e5c('0x54')]['id']}})[_0x4e5c('0x31')](handleEntityNotFound(_0x243ab0,null))['then'](function(_0x6c76ff){if(_0x6c76ff){return _0x6c76ff[_0x4e5c('0xc2')](_0x5061c2['query'][_0x4e5c('0x6f')])[_0x4e5c('0x31')](function(){if(_[_0x4e5c('0xc3')](_0x5061c2[_0x4e5c('0x40')][_0x4e5c('0x6f')])){for(var _0x583d11=0x0;_0x583d11<_0x5061c2[_0x4e5c('0x40')]['ids'][_0x4e5c('0x46')];_0x583d11+=0x1){socket[_0x4e5c('0xc0')](_0x4e5c('0xc4'),{'UserId':Number(_0x5061c2[_0x4e5c('0x40')]['ids'][_0x583d11]),'FaxAccountId':Number(_0x5061c2[_0x4e5c('0x54')]['id'])});}}else{socket[_0x4e5c('0xc0')]('userFaxAccount:remove',{'UserId':Number(_0x5061c2[_0x4e5c('0x40')]['ids']),'FaxAccountId':Number(_0x5061c2[_0x4e5c('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x243ab0,null))[_0x4e5c('0x28')](handleError(_0x243ab0,null));};exports[_0x4e5c('0xc5')]=function(_0x5e49d1,_0x23bf61,_0x54bc10){var _0x5e8cef={};var _0xaf75d9={};var _0x557140;var _0x26ce57;return db['FaxAccount'][_0x4e5c('0x6b')]({'where':{'id':_0x5e49d1[_0x4e5c('0x54')]['id']}})[_0x4e5c('0x31')](handleEntityNotFound(_0x23bf61,null))[_0x4e5c('0x31')](function(_0x5f47a9){if(_0x5f47a9){_0x557140=_0x5f47a9;_0xaf75d9[_0x4e5c('0x3f')]=_[_0x4e5c('0x41')](db[_0x4e5c('0xc6')][_0x4e5c('0x57')]);_0xaf75d9[_0x4e5c('0x40')]=_[_0x4e5c('0x41')](_0x5e49d1['query']);_0xaf75d9[_0x4e5c('0x42')]=_['intersection'](_0xaf75d9['model'],_0xaf75d9['query']);_0x5e8cef['attributes']=_[_0x4e5c('0x43')](_0xaf75d9[_0x4e5c('0x3f')],qs[_0x4e5c('0x45')](_0x5e49d1[_0x4e5c('0x40')][_0x4e5c('0x45')]));_0x5e8cef[_0x4e5c('0x44')]=_0x5e8cef[_0x4e5c('0x44')][_0x4e5c('0x46')]?_0x5e8cef['attributes']:_0xaf75d9[_0x4e5c('0x3f')];_0x5e8cef[_0x4e5c('0x48')]=qs[_0x4e5c('0x49')](_0x5e49d1[_0x4e5c('0x40')]['sort']);_0x5e8cef[_0x4e5c('0x4a')]=qs[_0x4e5c('0x42')](_[_0x4e5c('0x4b')](_0x5e49d1[_0x4e5c('0x40')],_0xaf75d9['filters']));if(_0x5e49d1[_0x4e5c('0x40')][_0x4e5c('0x4e')]){_0x5e8cef[_0x4e5c('0x4a')]=_['merge'](_0x5e8cef[_0x4e5c('0x4a')],{'$or':_[_0x4e5c('0x3b')](_0x5e8cef[_0x4e5c('0x44')],function(_0x394693){var _0x154b9e={};_0x154b9e[_0x394693]={'$like':'%'+_0x5e49d1[_0x4e5c('0x40')]['filter']+'%'};return _0x154b9e;})});}_0x5e8cef=_[_0x4e5c('0x4c')]({},_0x5e8cef,_0x5e49d1[_0x4e5c('0x58')]);return _0x557140[_0x4e5c('0xc5')](_0x5e8cef);}})[_0x4e5c('0x31')](function(_0x292795){if(_0x292795){_0x26ce57=_0x292795[_0x4e5c('0x46')];if(!_0x5e49d1[_0x4e5c('0x40')][_0x4e5c('0x67')](_0x4e5c('0x47'))){_0x5e8cef[_0x4e5c('0x2e')]=qs[_0x4e5c('0x2e')](_0x5e49d1[_0x4e5c('0x40')][_0x4e5c('0x2e')]);_0x5e8cef[_0x4e5c('0x2b')]=qs[_0x4e5c('0x2b')](_0x5e49d1[_0x4e5c('0x40')][_0x4e5c('0x2b')]);}return _0x557140[_0x4e5c('0xc5')](_0x5e8cef);}})[_0x4e5c('0x31')](function(_0x347be0){if(_0x347be0){return _0x347be0?{'count':_0x26ce57,'rows':_0x347be0}:null;}})['then'](respondWithResult(_0x23bf61,null))[_0x4e5c('0x28')](handleError(_0x23bf61,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9033c53..12d89bf 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 _0x08d9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','update'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x08d9,0x1a2));var _0x908d=function(_0x5eff18,_0x2acf39){_0x5eff18=_0x5eff18-0x0;var _0x48d0e2=_0x08d9[_0x5eff18];return _0x48d0e2;};'use strict';var EventEmitter=require(_0x908d('0x0'));var FaxAccount=require(_0x908d('0x1'))['db'][_0x908d('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x908d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x908d('0x4'),'afterDestroy':'remove'};function emitEvent(_0xc95d15){return function(_0x5390d5,_0xc3ef92,_0x20cdef){FaxAccountEvents[_0x908d('0x5')](_0xc95d15+':'+_0x5390d5['id'],_0x5390d5);FaxAccountEvents['emit'](_0xc95d15,_0x5390d5);_0x20cdef(null);};}for(var e in events){if(events[_0x908d('0x6')](e)){var event=events[e];FaxAccount[_0x908d('0x7')](e,emitEvent(event));}}module[_0x908d('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xca70=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x405574,_0x5c3986){var _0x1e8f8b=function(_0x693dc){while(--_0x693dc){_0x405574['push'](_0x405574['shift']());}};_0x1e8f8b(++_0x5c3986);}(_0xca70,0x1e9));var _0x0ca7=function(_0x5ce52a,_0x3ec888){_0x5ce52a=_0x5ce52a-0x0;var _0x4d5114=_0xca70[_0x5ce52a];return _0x4d5114;};'use strict';var EventEmitter=require(_0x0ca7('0x0'));var FaxAccount=require(_0x0ca7('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0ca7('0x2')](0x0);var events={'afterCreate':_0x0ca7('0x3'),'afterUpdate':_0x0ca7('0x4'),'afterDestroy':_0x0ca7('0x5')};function emitEvent(_0x3a2521){return function(_0x27fcfa,_0x22ee1b,_0x5709ad){FaxAccountEvents[_0x0ca7('0x6')](_0x3a2521+':'+_0x27fcfa['id'],_0x27fcfa);FaxAccountEvents[_0x0ca7('0x6')](_0x3a2521,_0x27fcfa);_0x5709ad(null);};}for(var e in events){if(events[_0x0ca7('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x0ca7('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index b14a377..6177409 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 _0x4f16=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','fax_accounts','lodash'];(function(_0x10526c,_0x36aa29){var _0x2526a5=function(_0x23de08){while(--_0x23de08){_0x10526c['push'](_0x10526c['shift']());}};_0x2526a5(++_0x36aa29);}(_0x4f16,0xd7));var _0x64f1=function(_0xa28b1a,_0x384f4b){_0xa28b1a=_0xa28b1a-0x0;var _0x4c9b78=_0x4f16[_0xa28b1a];return _0x4c9b78;};'use strict';var _=require(_0x64f1('0x0'));var util=require(_0x64f1('0x1'));var logger=require(_0x64f1('0x2'))(_0x64f1('0x3'));var moment=require(_0x64f1('0x4'));var BPromise=require(_0x64f1('0x5'));var rp=require(_0x64f1('0x6'));var fs=require('fs');var path=require(_0x64f1('0x7'));var rimraf=require(_0x64f1('0x8'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x64f1('0x9')]=function(_0x8c6356,_0x4e1626){return _0x8c6356[_0x64f1('0xa')]('FaxAccount',attributes,{'tableName':_0x64f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6121=['bluebird','request-promise','rimraf','../../config/environment','exports','FaxAccount','lodash','util','../../config/logger','api'];(function(_0x44a5b3,_0xe4cae){var _0x4676a1=function(_0x2555cd){while(--_0x2555cd){_0x44a5b3['push'](_0x44a5b3['shift']());}};_0x4676a1(++_0xe4cae);}(_0x6121,0x1d2));var _0x1612=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6121[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x1612('0x0'));var util=require(_0x1612('0x1'));var logger=require(_0x1612('0x2'))(_0x1612('0x3'));var moment=require('moment');var BPromise=require(_0x1612('0x4'));var rp=require(_0x1612('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1612('0x6'));var config=require(_0x1612('0x7'));var attributes=require('./faxAccount.attributes');module[_0x1612('0x8')]=function(_0x3460d2,_0x127f1c){return _0x3460d2['define'](_0x1612('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 174c877..ff488b7 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 _0x03d0=['ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','FaxApplication','Applications','applications','list','List','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','interaction','UserId','unshift','agent','name','waitForTheAssignedAgent','queueId','FaxQueue','find','queue','waitForTheAssignedQueue','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetFaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId'];(function(_0xc88b6c,_0x2b12a1){var _0x4d02cf=function(_0xc1f65e){while(--_0xc1f65e){_0xc88b6c['push'](_0xc88b6c['shift']());}};_0x4d02cf(++_0x2b12a1);}(_0x03d0,0xed));var _0x003d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x03d0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x003d('0x0'));var moment=require(_0x003d('0x1'));var BPromise=require(_0x003d('0x2'));var rs=require(_0x003d('0x3'));var fs=require('fs');var Redis=require(_0x003d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x003d('0x5'));var logger=require(_0x003d('0x6'))(_0x003d('0x7'));var config=require(_0x003d('0x8'));var jayson=require(_0x003d('0x9'));var client=jayson[_0x003d('0xa')][_0x003d('0xb')]({'port':0x232c});config[_0x003d('0xc')]=_[_0x003d('0xd')](config[_0x003d('0xc')],{'host':_0x003d('0xe'),'port':0x18eb});var socket=require(_0x003d('0xf'))(new Redis(config['redis']));require(_0x003d('0x10'))[_0x003d('0x11')](socket);function respondWithRpcPromise(_0x4c0e5a,_0x5d313d,_0x17fc1a){return new BPromise(function(_0x455ce4,_0x1170a1){return client[_0x003d('0x12')](_0x4c0e5a,_0x17fc1a)[_0x003d('0x13')](function(_0x5d8e6c){logger[_0x003d('0x14')](_0x003d('0x15'),_0x5d313d,_0x003d('0x16'));logger[_0x003d('0x17')](_0x003d('0x18'),_0x5d313d,_0x003d('0x16'),JSON[_0x003d('0x19')](_0x5d8e6c));if(_0x5d8e6c['error']){if(_0x5d8e6c['error'][_0x003d('0x1a')]===0x1f4){logger[_0x003d('0x1b')](_0x003d('0x15'),_0x5d313d,_0x5d8e6c[_0x003d('0x1b')]['message']);return _0x1170a1(_0x5d8e6c[_0x003d('0x1b')][_0x003d('0x1c')]);}logger[_0x003d('0x1b')](_0x003d('0x15'),_0x5d313d,_0x5d8e6c[_0x003d('0x1b')]['message']);return _0x455ce4(_0x5d8e6c[_0x003d('0x1b')][_0x003d('0x1c')]);}else{logger[_0x003d('0x14')](_0x003d('0x15'),_0x5d313d,_0x003d('0x16'));_0x455ce4(_0x5d8e6c[_0x003d('0x1d')]['message']);}})[_0x003d('0x1e')](function(_0x21ee21){logger[_0x003d('0x1b')](_0x003d('0x15'),_0x5d313d,_0x21ee21);_0x1170a1(_0x21ee21);});});}exports[_0x003d('0x1f')]=function(_0x2c567d){var _0x112cb8=this;return new Promise(function(_0x4e9b49,_0x8d4976){return db['FaxAccount'][_0x003d('0x20')]({'raw':_0x2c567d[_0x003d('0x21')]?_0x2c567d[_0x003d('0x21')][_0x003d('0x22')]===undefined?!![]:![]:!![],'where':_0x2c567d['options']?_0x2c567d[_0x003d('0x21')][_0x003d('0x23')]||null:null,'attributes':_0x2c567d[_0x003d('0x21')]?_0x2c567d[_0x003d('0x21')][_0x003d('0x24')]||null:null,'limit':_0x2c567d[_0x003d('0x21')]?_0x2c567d['options'][_0x003d('0x25')]||null:null,'include':_0x2c567d[_0x003d('0x21')]?_0x2c567d[_0x003d('0x21')][_0x003d('0x26')]?_['map'](_0x2c567d[_0x003d('0x21')][_0x003d('0x26')],function(_0x13f9b5){return{'model':db[_0x13f9b5[_0x003d('0x27')]],'as':_0x13f9b5['as'],'attributes':_0x13f9b5[_0x003d('0x24')],'include':_0x13f9b5['include']?_[_0x003d('0x28')](_0x13f9b5[_0x003d('0x26')],function(_0x44c6d0){return{'model':db[_0x44c6d0[_0x003d('0x27')]],'as':_0x44c6d0['as'],'attributes':_0x44c6d0[_0x003d('0x24')],'include':_0x44c6d0[_0x003d('0x26')]?_['map'](_0x44c6d0[_0x003d('0x26')],function(_0x188807){return{'model':db[_0x188807[_0x003d('0x27')]],'as':_0x188807['as'],'attributes':_0x188807[_0x003d('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x278b4a){logger[_0x003d('0x14')](_0x003d('0x1f'),_0x2c567d);logger[_0x003d('0x17')]('GetFaxAccount',_0x2c567d,JSON[_0x003d('0x19')](_0x278b4a));_0x4e9b49(_0x278b4a);})[_0x003d('0x1e')](function(_0x527e2b){logger['error'](_0x003d('0x1f'),_0x527e2b[_0x003d('0x1c')],_0x2c567d);_0x8d4976(_0x112cb8[_0x003d('0x1b')](0x1f4,_0x527e2b[_0x003d('0x1c')]));});});};exports[_0x003d('0x29')]=function(_0x35e5ff,_0x32fa84,_0x5cd6d3){var _0x558ac1=this;return new Promise(function(_0x31fbc4,_0x38340a){var _0x3b6172={'body':_0x35e5ff[_0x003d('0x2a')],'channel':_0x003d('0x2b')};var _0x4efb7d=[];var _0x58d010=[];var _0x2c1eaf={};return db[_0x003d('0x2c')][_0x003d('0x2d')]()[_0x003d('0x13')](function(_0x2d116){if(!_0x2d116){throw new db[(_0x003d('0x2e'))][(_0x003d('0x2f'))](_0x003d('0x30'));}_0x4efb7d=_[_0x003d('0x31')](_[_0x003d('0x32')](_0x2d116),[_0x003d('0x33'),_0x003d('0x34')]);_0x58d010=_[_0x003d('0x31')](_[_0x003d('0x32')](_0x2d116),[_0x003d('0x33'),'updatedAt',_0x003d('0x35'),_0x003d('0x36')]);if(_0x35e5ff[_0x003d('0x2a')]['id']){delete _0x35e5ff[_0x003d('0x2a')]['id'];}if(_['isNil'](_0x35e5ff[_0x003d('0x2a')][_0x003d('0x37')])){throw new db['Sequelize'][(_0x003d('0x2f'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x35e5ff[_0x003d('0x2a')]['body'])||_0x35e5ff[_0x003d('0x2a')][_0x003d('0x2a')]===''){throw new db[(_0x003d('0x2e'))]['ValidationError'](_0x003d('0x38'));}if(_[_0x003d('0x39')](_0x35e5ff[_0x003d('0x2a')][_0x003d('0x3a')])){throw new db[(_0x003d('0x2e'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x58d010);}if(!_['includes'](_0x58d010,_0x35e5ff['body'][_0x003d('0x3a')])){throw new db[(_0x003d('0x2e'))][(_0x003d('0x2f'))](_0x003d('0x3b')+_0x58d010);}_0x2c1eaf[_0x35e5ff[_0x003d('0x2a')][_0x003d('0x3a')]]=_0x35e5ff['body'][_0x003d('0x37')];})[_0x003d('0x13')](function(){return db['FaxAccount']['find']({'where':{'id':_0x35e5ff[_0x003d('0x3c')]['id']},'include':[{'model':db[_0x003d('0x3d')],'as':'List','include':[{'model':db[_0x003d('0x2c')],'as':_0x003d('0x3e'),'where':_0x2c1eaf,'limit':0x1,'order':[[_0x003d('0x34'),_0x003d('0x3f')]]}]},{'model':db[_0x003d('0x40')],'as':_0x003d('0x41')}]});})[_0x003d('0x13')](function(_0x39107b){if(_0x39107b&&_0x39107b['List']){var _0x19eda3=_0x39107b['get']({'plain':!![]});_0x3b6172['account']=_0x19eda3;_0x3b6172[_0x003d('0x42')]=_0x19eda3[_0x003d('0x41')];_0x3b6172[_0x003d('0x43')]=_0x19eda3[_0x003d('0x44')];_0x3b6172[_0x003d('0x42')]=_['orderBy'](_0x3b6172[_0x003d('0x42')],[_0x003d('0x45')],[_0x003d('0x46')]);if(_0x3b6172[_0x003d('0x3c')][_0x003d('0x41')]){delete _0x3b6172[_0x003d('0x3c')]['Applications'];}if(_0x3b6172[_0x003d('0x3c')][_0x003d('0x44')]&&_0x3b6172[_0x003d('0x3c')][_0x003d('0x44')][_0x003d('0x3e')][_0x003d('0x47')]){return _0x3b6172[_0x003d('0x3c')]['List']['Contacts'][0x0];}var _0x5530fb=_[_0x003d('0xd')](_0x35e5ff['body'],{'firstName':_0x35e5ff['body']['from'],'ListId':_0x19eda3['ListId']});_0x5530fb[_0x35e5ff[_0x003d('0x2a')]['mapKey']]=_0x35e5ff[_0x003d('0x2a')]['from'];return db[_0x003d('0x2c')][_0x003d('0x48')](_0x5530fb,{'fields':_0x4efb7d,'raw':!![]});}})[_0x003d('0x13')](function(_0x2e6f8c){_0x3b6172[_0x003d('0x49')]=_0x2e6f8c;if(_0x2e6f8c){var _0xd9782e={'ContactId':_0x2e6f8c['id'],'FaxAccountId':_0x35e5ff[_0x003d('0x3c')]['id'],'fax':_0x2e6f8c[_0x003d('0x2b')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x2e6f8c['id'],'closed':![],'FaxAccountId':_0x35e5ff[_0x003d('0x3c')]['id']}})[_0x003d('0x13')](function(_0xfc768){if(_0xfc768){return[_0xfc768,![]];}return db[_0x003d('0x4a')][_0x003d('0x48')](_0xd9782e)['then'](function(_0x3ae5d5){return[_0x3ae5d5,!![]];});});}else{throw new Error(_0x003d('0x4b'));}})[_0x003d('0x4c')](function(_0x522c03,_0x472440){var _0x3c5636=_0x522c03['get']({'plain':!![]});if(_0x472440){if(_0x3b6172[_0x003d('0x3c')][_0x003d('0x4d')]){_0x3b6172[_0x003d('0x42')][_0x003d('0x4e')]({'id':0x0,'priority':_0x3b6172[_0x003d('0x42')][_0x003d('0x47')]+0x1,'app':'close','appdata':_0x003d('0x4f'),'interval':_0x003d('0x50')});}_0x3c5636[_0x003d('0x51')]=!![];}else{_0x3c5636[_0x003d('0x51')]=![];}_0x3b6172['interaction']=_0x3c5636;return db[_0x003d('0x52')][_0x003d('0x48')]({'body':_0x35e5ff['body'][_0x003d('0x2a')],'FaxAccountId':_0x35e5ff['account']['id'],'FaxInteractionId':_0x522c03['id'],'direction':'in','ContactId':_0x522c03['ContactId'],'AttachmentId':_0x35e5ff[_0x003d('0x2a')][_0x003d('0x53')]});})[_0x003d('0x13')](function(_0x1d7c28){_0x3b6172[_0x003d('0x1c')]=_0x1d7c28;if(!_0x3b6172['interaction']['UserId'])return;return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x3b6172[_0x003d('0x54')][_0x003d('0x55')]}});})['then'](function(_0x302c8c){if(_0x302c8c){_0x3b6172[_0x003d('0x42')][_0x003d('0x56')]({'id':0x0,'priority':0x0,'app':_0x003d('0x57'),'appdata':_0x302c8c[_0x003d('0x58')]+','+(_0x3b6172[_0x003d('0x3c')][_0x003d('0x59')]||0xa),'interval':'*,*,*,*'});}if(!_0x3b6172['interaction'][_0x003d('0x5a')])return;return db[_0x003d('0x5b')][_0x003d('0x5c')]({'attributes':['id',_0x003d('0x58')],'where':{'id':_0x3b6172[_0x003d('0x54')][_0x003d('0x5a')]}});})['then'](function(_0xf90215){if(_0xf90215){_0x3b6172[_0x003d('0x42')][_0x003d('0x56')]({'id':0x0,'priority':0x1,'app':_0x003d('0x5d'),'appdata':_0xf90215[_0x003d('0x58')]+','+(_0x3b6172[_0x003d('0x3c')][_0x003d('0x5e')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x003d('0x5f'),_0x003d('0x60'),_0x3b6172);})[_0x003d('0x13')](function(_0x18272a){_0x31fbc4(_0x18272a);})[_0x003d('0x1e')](function(_0x36045f){_0x38340a(_0x558ac1[_0x003d('0x1b')](0x1f4,_0x36045f[_0x003d('0x1c')]));});});}; \ No newline at end of file +var _0xd2e8=['length','create','FaxInteraction','Contact\x20not\x20found','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','GetFaxAccount','options','raw','where','limit','include','map','model','attributes','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','keys','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','FaxAccount','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','list','orderBy','applications','priority','asc'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xd2e8,0x133));var _0x8d2e=function(_0x54bac5,_0x8d3a16){_0x54bac5=_0x54bac5-0x0;var _0xc15971=_0xd2e8[_0x54bac5];return _0xc15971;};'use strict';var _=require(_0x8d2e('0x0'));var util=require('util');var moment=require(_0x8d2e('0x1'));var BPromise=require(_0x8d2e('0x2'));var rs=require(_0x8d2e('0x3'));var fs=require('fs');var Redis=require(_0x8d2e('0x4'));var db=require(_0x8d2e('0x5'))['db'];var utils=require(_0x8d2e('0x6'));var logger=require(_0x8d2e('0x7'))('rpc');var config=require(_0x8d2e('0x8'));var jayson=require(_0x8d2e('0x9'));var client=jayson[_0x8d2e('0xa')][_0x8d2e('0xb')]({'port':0x232c});config['redis']=_[_0x8d2e('0xc')](config[_0x8d2e('0xd')],{'host':_0x8d2e('0xe'),'port':0x18eb});var socket=require(_0x8d2e('0xf'))(new Redis(config['redis']));require(_0x8d2e('0x10'))[_0x8d2e('0x11')](socket);function respondWithRpcPromise(_0x42d9ea,_0x162a38,_0x429bc1){return new BPromise(function(_0x29cbf0,_0xcc8e9e){return client[_0x8d2e('0x12')](_0x42d9ea,_0x429bc1)[_0x8d2e('0x13')](function(_0x17ebb3){logger['info']('FaxAccount,\x20%s,\x20%s',_0x162a38,_0x8d2e('0x14'));logger[_0x8d2e('0x15')](_0x8d2e('0x16'),_0x162a38,_0x8d2e('0x14'),JSON[_0x8d2e('0x17')](_0x17ebb3));if(_0x17ebb3[_0x8d2e('0x18')]){if(_0x17ebb3[_0x8d2e('0x18')][_0x8d2e('0x19')]===0x1f4){logger[_0x8d2e('0x18')](_0x8d2e('0x1a'),_0x162a38,_0x17ebb3['error'][_0x8d2e('0x1b')]);return _0xcc8e9e(_0x17ebb3[_0x8d2e('0x18')][_0x8d2e('0x1b')]);}logger['error'](_0x8d2e('0x1a'),_0x162a38,_0x17ebb3[_0x8d2e('0x18')]['message']);return _0x29cbf0(_0x17ebb3['error']['message']);}else{logger[_0x8d2e('0x1c')](_0x8d2e('0x1a'),_0x162a38,_0x8d2e('0x14'));_0x29cbf0(_0x17ebb3[_0x8d2e('0x1d')][_0x8d2e('0x1b')]);}})[_0x8d2e('0x1e')](function(_0x4381e6){logger['error']('FaxAccount,\x20%s,\x20%s',_0x162a38,_0x4381e6);_0xcc8e9e(_0x4381e6);});});}exports[_0x8d2e('0x1f')]=function(_0x2f6bf3){var _0x2bc18a=this;return new Promise(function(_0x456be3,_0x2ff8b1){return db['FaxAccount']['findAll']({'raw':_0x2f6bf3[_0x8d2e('0x20')]?_0x2f6bf3[_0x8d2e('0x20')][_0x8d2e('0x21')]===undefined?!![]:![]:!![],'where':_0x2f6bf3[_0x8d2e('0x20')]?_0x2f6bf3['options'][_0x8d2e('0x22')]||null:null,'attributes':_0x2f6bf3[_0x8d2e('0x20')]?_0x2f6bf3['options']['attributes']||null:null,'limit':_0x2f6bf3[_0x8d2e('0x20')]?_0x2f6bf3[_0x8d2e('0x20')][_0x8d2e('0x23')]||null:null,'include':_0x2f6bf3[_0x8d2e('0x20')]?_0x2f6bf3['options'][_0x8d2e('0x24')]?_[_0x8d2e('0x25')](_0x2f6bf3[_0x8d2e('0x20')][_0x8d2e('0x24')],function(_0x24d838){return{'model':db[_0x24d838[_0x8d2e('0x26')]],'as':_0x24d838['as'],'attributes':_0x24d838[_0x8d2e('0x27')],'include':_0x24d838[_0x8d2e('0x24')]?_[_0x8d2e('0x25')](_0x24d838[_0x8d2e('0x24')],function(_0x384b7f){return{'model':db[_0x384b7f[_0x8d2e('0x26')]],'as':_0x384b7f['as'],'attributes':_0x384b7f[_0x8d2e('0x27')],'include':_0x384b7f[_0x8d2e('0x24')]?_[_0x8d2e('0x25')](_0x384b7f[_0x8d2e('0x24')],function(_0x3c5ca3){return{'model':db[_0x3c5ca3[_0x8d2e('0x26')]],'as':_0x3c5ca3['as'],'attributes':_0x3c5ca3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59c61a){logger[_0x8d2e('0x1c')](_0x8d2e('0x1f'),_0x2f6bf3);logger[_0x8d2e('0x15')](_0x8d2e('0x1f'),_0x2f6bf3,JSON[_0x8d2e('0x17')](_0x59c61a));_0x456be3(_0x59c61a);})['catch'](function(_0x3ee113){logger[_0x8d2e('0x18')](_0x8d2e('0x1f'),_0x3ee113['message'],_0x2f6bf3);_0x2ff8b1(_0x2bc18a[_0x8d2e('0x18')](0x1f4,_0x3ee113[_0x8d2e('0x1b')]));});});};exports[_0x8d2e('0x28')]=function(_0x4b1ad2,_0x415391,_0x4e22b1){var _0x346933=this;return new Promise(function(_0x3246fc,_0x2ed74d){var _0x2d5551={'body':_0x4b1ad2[_0x8d2e('0x29')],'channel':_0x8d2e('0x2a')};var _0x281371=[];var _0x55af45=[];var _0x8be902={};return db[_0x8d2e('0x2b')][_0x8d2e('0x2c')]()['then'](function(_0x560910){if(!_0x560910){throw new db[(_0x8d2e('0x2d'))][(_0x8d2e('0x2e'))]('no\x20available\x20attributes');}_0x281371=_['difference'](_[_0x8d2e('0x2f')](_0x560910),['createdAt',_0x8d2e('0x30')]);_0x55af45=_[_0x8d2e('0x31')](_[_0x8d2e('0x2f')](_0x560910),['createdAt',_0x8d2e('0x30'),_0x8d2e('0x32'),_0x8d2e('0x33')]);if(_0x4b1ad2[_0x8d2e('0x29')]['id']){delete _0x4b1ad2[_0x8d2e('0x29')]['id'];}if(_[_0x8d2e('0x34')](_0x4b1ad2[_0x8d2e('0x29')][_0x8d2e('0x35')])){throw new db[(_0x8d2e('0x2d'))][(_0x8d2e('0x2e'))](_0x8d2e('0x36'));}if(_[_0x8d2e('0x34')](_0x4b1ad2[_0x8d2e('0x29')][_0x8d2e('0x29')])||_0x4b1ad2[_0x8d2e('0x29')]['body']===''){throw new db[(_0x8d2e('0x2d'))][(_0x8d2e('0x2e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4b1ad2[_0x8d2e('0x29')][_0x8d2e('0x37')])){throw new db[(_0x8d2e('0x2d'))][(_0x8d2e('0x2e'))](_0x8d2e('0x38')+_0x55af45);}if(!_[_0x8d2e('0x39')](_0x55af45,_0x4b1ad2[_0x8d2e('0x29')][_0x8d2e('0x37')])){throw new db['Sequelize'][(_0x8d2e('0x2e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x55af45);}_0x8be902[_0x4b1ad2[_0x8d2e('0x29')][_0x8d2e('0x37')]]=_0x4b1ad2[_0x8d2e('0x29')][_0x8d2e('0x35')];})[_0x8d2e('0x13')](function(){return db[_0x8d2e('0x3a')][_0x8d2e('0x3b')]({'where':{'id':_0x4b1ad2[_0x8d2e('0x3c')]['id']},'include':[{'model':db[_0x8d2e('0x3d')],'as':_0x8d2e('0x3e'),'include':[{'model':db[_0x8d2e('0x2b')],'as':_0x8d2e('0x3f'),'where':_0x8be902,'limit':0x1,'order':[[_0x8d2e('0x30'),_0x8d2e('0x40')]]}]},{'model':db[_0x8d2e('0x41')],'as':_0x8d2e('0x42')}]});})[_0x8d2e('0x13')](function(_0x68c996){if(_0x68c996&&_0x68c996[_0x8d2e('0x3e')]){var _0x4cdc86=_0x68c996[_0x8d2e('0x43')]({'plain':!![]});_0x2d5551[_0x8d2e('0x3c')]=_0x4cdc86;_0x2d5551['applications']=_0x4cdc86[_0x8d2e('0x42')];_0x2d5551[_0x8d2e('0x44')]=_0x4cdc86['List'];_0x2d5551['applications']=_[_0x8d2e('0x45')](_0x2d5551[_0x8d2e('0x46')],[_0x8d2e('0x47')],[_0x8d2e('0x48')]);if(_0x2d5551[_0x8d2e('0x3c')][_0x8d2e('0x42')]){delete _0x2d5551[_0x8d2e('0x3c')][_0x8d2e('0x42')];}if(_0x2d5551[_0x8d2e('0x3c')][_0x8d2e('0x3e')]&&_0x2d5551['account']['List'][_0x8d2e('0x3f')][_0x8d2e('0x49')]){return _0x2d5551['account'][_0x8d2e('0x3e')]['Contacts'][0x0];}var _0x24a375=_['defaults'](_0x4b1ad2[_0x8d2e('0x29')],{'firstName':_0x4b1ad2[_0x8d2e('0x29')][_0x8d2e('0x35')],'ListId':_0x4cdc86[_0x8d2e('0x33')]});_0x24a375[_0x4b1ad2[_0x8d2e('0x29')][_0x8d2e('0x37')]]=_0x4b1ad2['body'][_0x8d2e('0x35')];return db['CmContact'][_0x8d2e('0x4a')](_0x24a375,{'fields':_0x281371,'raw':!![]});}})[_0x8d2e('0x13')](function(_0x415741){_0x2d5551['contact']=_0x415741;if(_0x415741){var _0x404a96={'ContactId':_0x415741['id'],'FaxAccountId':_0x4b1ad2['account']['id'],'fax':_0x415741[_0x8d2e('0x2a')]};return db[_0x8d2e('0x4b')][_0x8d2e('0x3b')]({'where':{'ContactId':_0x415741['id'],'closed':![],'FaxAccountId':_0x4b1ad2[_0x8d2e('0x3c')]['id']}})['then'](function(_0x58ee47){if(_0x58ee47){return[_0x58ee47,![]];}return db['FaxInteraction'][_0x8d2e('0x4a')](_0x404a96)['then'](function(_0x4df55c){return[_0x4df55c,!![]];});});}else{throw new Error(_0x8d2e('0x4c'));}})['spread'](function(_0x1dcf14,_0x5bf0cf){var _0x53b501=_0x1dcf14[_0x8d2e('0x43')]({'plain':!![]});if(_0x5bf0cf){if(_0x2d5551[_0x8d2e('0x3c')]['autoclose']){_0x2d5551[_0x8d2e('0x46')][_0x8d2e('0x4d')]({'id':0x0,'priority':_0x2d5551[_0x8d2e('0x46')][_0x8d2e('0x49')]+0x1,'app':_0x8d2e('0x4e'),'appdata':_0x8d2e('0x4f'),'interval':_0x8d2e('0x50')});}_0x53b501['created']=!![];}else{_0x53b501[_0x8d2e('0x51')]=![];}_0x2d5551[_0x8d2e('0x52')]=_0x53b501;return db[_0x8d2e('0x53')][_0x8d2e('0x4a')]({'body':_0x4b1ad2[_0x8d2e('0x29')]['body'],'FaxAccountId':_0x4b1ad2[_0x8d2e('0x3c')]['id'],'FaxInteractionId':_0x1dcf14['id'],'direction':'in','ContactId':_0x1dcf14[_0x8d2e('0x54')],'AttachmentId':_0x4b1ad2[_0x8d2e('0x29')][_0x8d2e('0x55')]});})['then'](function(_0x4d9e0d){_0x2d5551[_0x8d2e('0x1b')]=_0x4d9e0d;if(!_0x2d5551['interaction'][_0x8d2e('0x56')])return;return db[_0x8d2e('0x57')][_0x8d2e('0x3b')]({'attributes':['id',_0x8d2e('0x58')],'where':{'id':_0x2d5551[_0x8d2e('0x52')][_0x8d2e('0x56')]}});})[_0x8d2e('0x13')](function(_0x2198bf){if(_0x2198bf){_0x2d5551[_0x8d2e('0x46')][_0x8d2e('0x59')]({'id':0x0,'priority':0x0,'app':_0x8d2e('0x5a'),'appdata':_0x2198bf['name']+','+(_0x2d5551[_0x8d2e('0x3c')][_0x8d2e('0x5b')]||0xa),'interval':_0x8d2e('0x50')});}if(!_0x2d5551['interaction'][_0x8d2e('0x5c')])return;return db[_0x8d2e('0x5d')][_0x8d2e('0x3b')]({'attributes':['id','name'],'where':{'id':_0x2d5551['interaction'][_0x8d2e('0x5c')]}});})[_0x8d2e('0x13')](function(_0x399350){if(_0x399350){_0x2d5551['applications'][_0x8d2e('0x59')]({'id':0x0,'priority':0x1,'app':_0x8d2e('0x5e'),'appdata':_0x399350[_0x8d2e('0x58')]+','+(_0x2d5551[_0x8d2e('0x3c')]['waitForTheAssignedQueue']||0x12c),'interval':_0x8d2e('0x50')});}return respondWithRpcPromise('Start','startRouting',_0x2d5551);})[_0x8d2e('0x13')](function(_0x1daa95){_0x3246fc(_0x1daa95);})['catch'](function(_0x10f23c){_0x2ed74d(_0x346933['error'](0x1f4,_0x10f23c[_0x8d2e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 81e30fb..f688f59 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 _0x6ff4=['removeListener','register','length','./faxAccount.events','save','update','emit'];(function(_0x301b7a,_0x59d948){var _0x38bf42=function(_0x1d2fc5){while(--_0x1d2fc5){_0x301b7a['push'](_0x301b7a['shift']());}};_0x38bf42(++_0x59d948);}(_0x6ff4,0xdc));var _0x46ff=function(_0x219e35,_0x1aa12c){_0x219e35=_0x219e35-0x0;var _0x559ea2=_0x6ff4[_0x219e35];return _0x559ea2;};'use strict';var FaxAccountEvents=require(_0x46ff('0x0'));var events=[_0x46ff('0x1'),'remove',_0x46ff('0x2')];function createListener(_0x474866,_0x83ef78){return function(_0x2732d0){_0x83ef78[_0x46ff('0x3')](_0x474866,_0x2732d0);};}function removeListener(_0x22cba3,_0x576a71){return function(){FaxAccountEvents[_0x46ff('0x4')](_0x22cba3,_0x576a71);};}exports[_0x46ff('0x5')]=function(_0x341a14){for(var _0x529028=0x0,_0x3b7216=events[_0x46ff('0x6')];_0x529028<_0x3b7216;_0x529028++){var _0x19e05c=events[_0x529028];var _0x5d9762=createListener('faxAccount:'+_0x19e05c,_0x341a14);FaxAccountEvents['on'](_0x19e05c,_0x5d9762);}}; \ No newline at end of file +var _0x6b3d=['emit','removeListener','faxAccount:','./faxAccount.events','save','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b3d,0x159));var _0xd6b3=function(_0x3a547f,_0x5556c6){_0x3a547f=_0x3a547f-0x0;var _0x584afa=_0x6b3d[_0x3a547f];return _0x584afa;};'use strict';var FaxAccountEvents=require(_0xd6b3('0x0'));var events=[_0xd6b3('0x1'),'remove',_0xd6b3('0x2')];function createListener(_0x29dcd1,_0x9171ab){return function(_0x2fad9d){_0x9171ab[_0xd6b3('0x3')](_0x29dcd1,_0x2fad9d);};}function removeListener(_0x277de6,_0x2ad1ef){return function(){FaxAccountEvents[_0xd6b3('0x4')](_0x277de6,_0x2ad1ef);};}exports['register']=function(_0x1469c5){for(var _0xfcd969=0x0,_0x403b6=events['length'];_0xfcd969<_0x403b6;_0xfcd969++){var _0x2165e6=events[_0xfcd969];var _0x51f9f6=createListener(_0xd6b3('0x5')+_0x2165e6,_0x1469c5);FaxAccountEvents['on'](_0x2165e6,_0x51f9f6);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 4bf55d3..feb669a 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 _0xc7c5=['/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','create','addDisposition','post','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','update','destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','/describe','describe'];(function(_0x5938dd,_0x35458f){var _0x5d8b0f=function(_0x14952c){while(--_0x14952c){_0x5938dd['push'](_0x5938dd['shift']());}};_0x5d8b0f(++_0x35458f);}(_0xc7c5,0x1ea));var _0x5c7c=function(_0x77562a,_0x21566f){_0x77562a=_0x77562a-0x0;var _0x271ed8=_0xc7c5[_0x77562a];return _0x271ed8;};'use strict';var multer=require(_0x5c7c('0x0'));var util=require(_0x5c7c('0x1'));var path=require(_0x5c7c('0x2'));var timeout=require(_0x5c7c('0x3'));var express=require(_0x5c7c('0x4'));var router=express[_0x5c7c('0x5')]();var fs_extra=require(_0x5c7c('0x6'));var auth=require(_0x5c7c('0x7'));var interaction=require(_0x5c7c('0x8'));var config=require('../../config/environment');var controller=require(_0x5c7c('0x9'));router[_0x5c7c('0xa')]('/',auth[_0x5c7c('0xb')](),controller['index']);router[_0x5c7c('0xa')](_0x5c7c('0xc'),auth['isAuthenticated'](),controller[_0x5c7c('0xd')]);router['get'](_0x5c7c('0xe'),auth[_0x5c7c('0xb')](),controller['show']);router[_0x5c7c('0xa')](_0x5c7c('0xf'),auth[_0x5c7c('0xb')](),controller['getDispositions']);router['get'](_0x5c7c('0x10'),auth[_0x5c7c('0xb')](),controller[_0x5c7c('0x11')]);router[_0x5c7c('0xa')](_0x5c7c('0x12'),auth[_0x5c7c('0xb')](),controller['getInteractions']);router[_0x5c7c('0xa')](_0x5c7c('0x13'),auth[_0x5c7c('0xb')](),controller['getApplications']);router['get'](_0x5c7c('0x14'),auth[_0x5c7c('0xb')](),controller[_0x5c7c('0x15')]);router['get'](_0x5c7c('0x16'),auth[_0x5c7c('0xb')](),controller[_0x5c7c('0x17')]);router['post']('/',auth[_0x5c7c('0xb')](),controller[_0x5c7c('0x18')]);router['post'](_0x5c7c('0xf'),auth[_0x5c7c('0xb')](),controller[_0x5c7c('0x19')]);router[_0x5c7c('0x1a')](_0x5c7c('0x10'),auth[_0x5c7c('0xb')](),controller[_0x5c7c('0x1b')]);router['post'](_0x5c7c('0x12'),auth['isAuthenticated'](),controller[_0x5c7c('0x1c')]);router['post'](_0x5c7c('0x13'),auth[_0x5c7c('0xb')](),controller[_0x5c7c('0x1d')]);router[_0x5c7c('0x1a')]('/addaccountapplications',auth[_0x5c7c('0xb')](),controller[_0x5c7c('0x1e')]);router[_0x5c7c('0x1a')](_0x5c7c('0x1f'),auth[_0x5c7c('0xb')](),controller['updateAccountApplications']);router['post'](_0x5c7c('0x20'),auth[_0x5c7c('0xb')](),controller[_0x5c7c('0x21')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x5c7c('0x22')]);router[_0x5c7c('0x23')](_0x5c7c('0xe'),auth[_0x5c7c('0xb')](),controller[_0x5c7c('0x24')]);router['delete'](_0x5c7c('0xe'),auth[_0x5c7c('0xb')](),controller[_0x5c7c('0x25')]);router['delete']('/:id/dispositions',auth[_0x5c7c('0xb')](),controller['removeDispositions']);router[_0x5c7c('0x26')](_0x5c7c('0x10'),auth[_0x5c7c('0xb')](),controller[_0x5c7c('0x27')]);router[_0x5c7c('0x26')](_0x5c7c('0x16'),auth[_0x5c7c('0xb')](),controller[_0x5c7c('0x28')]);module[_0x5c7c('0x29')]=router; \ No newline at end of file +var _0xe578=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/users','getAgents','post','create','addDisposition','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','update','delete','destroy','removeDispositions','removeAgents','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe578,0x7b));var _0x8e57=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe578[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x8e57('0x0'));var util=require(_0x8e57('0x1'));var path=require(_0x8e57('0x2'));var timeout=require(_0x8e57('0x3'));var express=require(_0x8e57('0x4'));var router=express[_0x8e57('0x5')]();var fs_extra=require(_0x8e57('0x6'));var auth=require(_0x8e57('0x7'));var interaction=require(_0x8e57('0x8'));var config=require('../../config/environment');var controller=require(_0x8e57('0x9'));router[_0x8e57('0xa')]('/',auth['isAuthenticated'](),controller[_0x8e57('0xb')]);router[_0x8e57('0xa')](_0x8e57('0xc'),auth[_0x8e57('0xd')](),controller[_0x8e57('0xe')]);router[_0x8e57('0xa')](_0x8e57('0xf'),auth[_0x8e57('0xd')](),controller[_0x8e57('0x10')]);router[_0x8e57('0xa')](_0x8e57('0x11'),auth[_0x8e57('0xd')](),controller[_0x8e57('0x12')]);router[_0x8e57('0xa')](_0x8e57('0x13'),auth[_0x8e57('0xd')](),controller[_0x8e57('0x14')]);router[_0x8e57('0xa')](_0x8e57('0x15'),auth['isAuthenticated'](),controller[_0x8e57('0x16')]);router[_0x8e57('0xa')](_0x8e57('0x17'),auth[_0x8e57('0xd')](),controller['getApplications']);router[_0x8e57('0xa')]('/:id/messages',auth[_0x8e57('0xd')](),controller['getMessages']);router[_0x8e57('0xa')](_0x8e57('0x18'),auth[_0x8e57('0xd')](),controller[_0x8e57('0x19')]);router[_0x8e57('0x1a')]('/',auth[_0x8e57('0xd')](),controller[_0x8e57('0x1b')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8e57('0x1c')]);router[_0x8e57('0x1a')]('/:id/canned_answers',auth[_0x8e57('0xd')](),controller['addAnswer']);router['post']('/:id/interactions',auth[_0x8e57('0xd')](),controller['addInteraction']);router['post'](_0x8e57('0x17'),auth[_0x8e57('0xd')](),controller[_0x8e57('0x1d')]);router[_0x8e57('0x1a')](_0x8e57('0x1e'),auth[_0x8e57('0xd')](),controller[_0x8e57('0x1f')]);router['post'](_0x8e57('0x20'),auth[_0x8e57('0xd')](),controller[_0x8e57('0x21')]);router['post'](_0x8e57('0x22'),auth[_0x8e57('0xd')](),controller['send']);router['post'](_0x8e57('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x8e57('0xf'),auth[_0x8e57('0xd')](),controller[_0x8e57('0x23')]);router[_0x8e57('0x24')](_0x8e57('0xf'),auth[_0x8e57('0xd')](),controller[_0x8e57('0x25')]);router[_0x8e57('0x24')](_0x8e57('0x11'),auth[_0x8e57('0xd')](),controller[_0x8e57('0x26')]);router[_0x8e57('0x24')]('/:id/canned_answers',auth[_0x8e57('0xd')](),controller['removeAnswers']);router[_0x8e57('0x24')](_0x8e57('0x18'),auth[_0x8e57('0xd')](),controller[_0x8e57('0x27')]);module[_0x8e57('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 1d9bf13..f654af9 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 _0x6f92=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x15431b,_0x35f41b){var _0x135ee1=function(_0x5cc7d4){while(--_0x5cc7d4){_0x15431b['push'](_0x15431b['shift']());}};_0x135ee1(++_0x35f41b);}(_0x6f92,0x14f));var _0x26f9=function(_0x490fba,_0x1acf5d){_0x490fba=_0x490fba-0x0;var _0x5ecfb6=_0x6f92[_0x490fba];return _0x5ecfb6;};'use strict';var Sequelize=require(_0x26f9('0x0'));module[_0x26f9('0x1')]={'priority':{'type':Sequelize[_0x26f9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x26f9('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x26f9('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x26f9('0x4')}}; \ No newline at end of file +var _0xf57e=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x29cc56,_0x572e53){var _0x816a75=function(_0x452807){while(--_0x452807){_0x29cc56['push'](_0x29cc56['shift']());}};_0x816a75(++_0x572e53);}(_0xf57e,0x10b));var _0xef57=function(_0xfcecf4,_0x3748c1){_0xfcecf4=_0xfcecf4-0x0;var _0x13a799=_0xf57e[_0xfcecf4];return _0x13a799;};'use strict';var Sequelize=require(_0xef57('0x0'));module[_0xef57('0x1')]={'priority':{'type':Sequelize[_0xef57('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xef57('0x3')],'allowNull':![],'defaultValue':_0xef57('0x4')},'appdata':{'type':Sequelize[_0xef57('0x5')]()},'description':{'type':Sequelize[_0xef57('0x3')]},'interval':{'type':Sequelize[_0xef57('0x3')],'defaultValue':_0xef57('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4ed2181..bfcd5cf 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 _0x07cf=['include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','filter','options','FaxApplication','includeAll'];(function(_0x44d6a1,_0x3498f3){var _0x3c6f24=function(_0x6ad393){while(--_0x6ad393){_0x44d6a1['push'](_0x44d6a1['shift']());}};_0x3c6f24(++_0x3498f3);}(_0x07cf,0xe3));var _0xf07c=function(_0xea6018,_0x4cf082){_0xea6018=_0xea6018-0x0;var _0x57b54d=_0x07cf[_0xea6018];return _0x57b54d;};'use strict';var emlformat=require(_0xf07c('0x0'));var rimraf=require(_0xf07c('0x1'));var zipdir=require(_0xf07c('0x2'));var jsonpatch=require(_0xf07c('0x3'));var rp=require('request-promise');var moment=require(_0xf07c('0x4'));var BPromise=require(_0xf07c('0x5'));var Mustache=require(_0xf07c('0x6'));var util=require('util');var path=require(_0xf07c('0x7'));var sox=require(_0xf07c('0x8'));var csv=require('to-csv');var ejs=require(_0xf07c('0x9'));var fs=require('fs');var fs_extra=require(_0xf07c('0xa'));var _=require(_0xf07c('0xb'));var squel=require('squel');var crypto=require(_0xf07c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf07c('0xd'));var toCsv=require(_0xf07c('0xe'));var querystring=require(_0xf07c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf07c('0x10'));var qs=require(_0xf07c('0x11'));var as=require(_0xf07c('0x12'));var hardwareService=require(_0xf07c('0x13'));var logger=require(_0xf07c('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xf07c('0x15'));var licenseUtil=require(_0xf07c('0x16'));var db=require(_0xf07c('0x17'))['db'];function respondWithStatusCode(_0x32f11b,_0x26fbe1){_0x26fbe1=_0x26fbe1||0xcc;return function(_0x530d44){if(_0x530d44){return _0x32f11b[_0xf07c('0x18')](_0x26fbe1);}return _0x32f11b[_0xf07c('0x19')](_0x26fbe1)[_0xf07c('0x1a')]();};}function respondWithResult(_0x1d1be6,_0x23e9d2){_0x23e9d2=_0x23e9d2||0xc8;return function(_0x33ab3a){if(_0x33ab3a){return _0x1d1be6['status'](_0x23e9d2)[_0xf07c('0x1b')](_0x33ab3a);}};}function respondWithFilteredResult(_0x292b2e,_0xfce727){return function(_0x28f327){if(_0x28f327){var _0xcbb295=typeof _0xfce727[_0xf07c('0x1c')]===_0xf07c('0x1d')&&typeof _0xfce727['limit']==='undefined';var _0x4befda=_0x28f327['count'];var _0x2717de=_0xcbb295?0x0:_0xfce727[_0xf07c('0x1c')];var _0x22d67a=_0xcbb295?_0x28f327[_0xf07c('0x1e')]:_0xfce727[_0xf07c('0x1c')]+_0xfce727['limit'];var _0x2adc18;if(_0x22d67a>=_0x4befda){_0x22d67a=_0x4befda;_0x2adc18=0xc8;}else{_0x2adc18=0xce;}_0x292b2e[_0xf07c('0x19')](_0x2adc18);return _0x292b2e[_0xf07c('0x1f')](_0xf07c('0x20'),_0x2717de+'-'+_0x22d67a+'/'+_0x4befda)[_0xf07c('0x1b')](_0x28f327);}return null;};}function patchUpdates(_0x33d8d1){return function(_0x4c2d8b){try{jsonpatch[_0xf07c('0x21')](_0x4c2d8b,_0x33d8d1,!![]);}catch(_0x4f99d7){return BPromise[_0xf07c('0x22')](_0x4f99d7);}return _0x4c2d8b[_0xf07c('0x23')]();};}function saveUpdates(_0x3dbf26,_0x499141){return function(_0x4baee8){if(_0x4baee8){return _0x4baee8[_0xf07c('0x24')](_0x3dbf26)[_0xf07c('0x25')](function(_0x5249ac){return _0x5249ac;});}return null;};}function removeEntity(_0x2e630c,_0x432157){return function(_0x24d7e5){if(_0x24d7e5){return _0x24d7e5[_0xf07c('0x26')]()['then'](function(){_0x2e630c[_0xf07c('0x19')](0xcc)[_0xf07c('0x1a')]();});}};}function handleEntityNotFound(_0x5e2359,_0x399122){return function(_0x2e7814){if(!_0x2e7814){_0x5e2359[_0xf07c('0x18')](0x194);}return _0x2e7814;};}function handleError(_0x5aa1aa,_0x516c6c){_0x516c6c=_0x516c6c||0x1f4;return function(_0x44f5e2){logger[_0xf07c('0x27')](_0x44f5e2['stack']);if(_0x44f5e2['name']){delete _0x44f5e2[_0xf07c('0x28')];}_0x5aa1aa['status'](_0x516c6c)['send'](_0x44f5e2);};}exports['index']=function(_0x35ba10,_0x1103a0){var _0x2df4ac={},_0x334b77={},_0x18fb16={'count':0x0,'rows':[]};var _0xc899d3=_['map'](db['FaxApplication'][_0xf07c('0x29')],function(_0x5bca23){return{'name':_0x5bca23[_0xf07c('0x2a')],'type':_0x5bca23[_0xf07c('0x2b')][_0xf07c('0x2c')]};});_0x334b77[_0xf07c('0x2d')]=_[_0xf07c('0x2e')](_0xc899d3,_0xf07c('0x28'));_0x334b77[_0xf07c('0x2f')]=_[_0xf07c('0x30')](_0x35ba10['query']);_0x334b77[_0xf07c('0x31')]=_[_0xf07c('0x32')](_0x334b77[_0xf07c('0x2d')],_0x334b77['query']);_0x2df4ac[_0xf07c('0x33')]=_['intersection'](_0x334b77['model'],qs[_0xf07c('0x34')](_0x35ba10['query']['fields']));_0x2df4ac[_0xf07c('0x33')]=_0x2df4ac[_0xf07c('0x33')][_0xf07c('0x35')]?_0x2df4ac['attributes']:_0x334b77[_0xf07c('0x2d')];if(!_0x35ba10[_0xf07c('0x2f')][_0xf07c('0x36')](_0xf07c('0x37'))){_0x2df4ac[_0xf07c('0x38')]=qs['limit'](_0x35ba10['query'][_0xf07c('0x38')]);_0x2df4ac[_0xf07c('0x1c')]=qs['offset'](_0x35ba10['query'][_0xf07c('0x1c')]);}_0x2df4ac[_0xf07c('0x39')]=qs[_0xf07c('0x3a')](_0x35ba10[_0xf07c('0x2f')][_0xf07c('0x3a')]);_0x2df4ac[_0xf07c('0x3b')]=qs[_0xf07c('0x31')](_['pick'](_0x35ba10[_0xf07c('0x2f')],_0x334b77[_0xf07c('0x31')]),_0xc899d3);if(_0x35ba10[_0xf07c('0x2f')]['filter']){_0x2df4ac[_0xf07c('0x3b')]=_['merge'](_0x2df4ac[_0xf07c('0x3b')],{'$or':_[_0xf07c('0x2e')](_0xc899d3,function(_0xe8a8f3){if(_0xe8a8f3[_0xf07c('0x2b')]!==_0xf07c('0x3c')){var _0x1173d0={};_0x1173d0[_0xe8a8f3[_0xf07c('0x28')]]={'$like':'%'+_0x35ba10['query'][_0xf07c('0x3d')]+'%'};return _0x1173d0;}})});}_0x2df4ac=_['merge']({},_0x2df4ac,_0x35ba10[_0xf07c('0x3e')]);var _0x3d368e={'where':_0x2df4ac['where']};return db[_0xf07c('0x3f')][_0xf07c('0x1e')](_0x3d368e)[_0xf07c('0x25')](function(_0x473dde){_0x18fb16[_0xf07c('0x1e')]=_0x473dde;if(_0x35ba10[_0xf07c('0x2f')][_0xf07c('0x40')]){_0x2df4ac[_0xf07c('0x41')]=[{'all':!![]}];}return db[_0xf07c('0x3f')][_0xf07c('0x42')](_0x2df4ac);})[_0xf07c('0x25')](function(_0x1367cb){_0x18fb16['rows']=_0x1367cb;return _0x18fb16;})['then'](respondWithFilteredResult(_0x1103a0,_0x2df4ac))[_0xf07c('0x43')](handleError(_0x1103a0,null));};exports[_0xf07c('0x44')]=function(_0x592dce,_0x2f66bc){var _0x2304dd={'raw':!![],'where':{'id':_0x592dce[_0xf07c('0x45')]['id']}},_0x2f78d9={};_0x2f78d9[_0xf07c('0x2d')]=_[_0xf07c('0x30')](db[_0xf07c('0x3f')][_0xf07c('0x29')]);_0x2f78d9[_0xf07c('0x2f')]=_[_0xf07c('0x30')](_0x592dce[_0xf07c('0x2f')]);_0x2f78d9[_0xf07c('0x31')]=_[_0xf07c('0x32')](_0x2f78d9[_0xf07c('0x2d')],_0x2f78d9[_0xf07c('0x2f')]);_0x2304dd[_0xf07c('0x33')]=_[_0xf07c('0x32')](_0x2f78d9[_0xf07c('0x2d')],qs[_0xf07c('0x34')](_0x592dce[_0xf07c('0x2f')][_0xf07c('0x34')]));_0x2304dd[_0xf07c('0x33')]=_0x2304dd[_0xf07c('0x33')][_0xf07c('0x35')]?_0x2304dd['attributes']:_0x2f78d9[_0xf07c('0x2d')];if(_0x592dce['query'][_0xf07c('0x40')]){_0x2304dd[_0xf07c('0x41')]=[{'all':!![]}];}_0x2304dd=_['merge']({},_0x2304dd,_0x592dce[_0xf07c('0x3e')]);return db[_0xf07c('0x3f')][_0xf07c('0x46')](_0x2304dd)[_0xf07c('0x25')](handleEntityNotFound(_0x2f66bc,null))[_0xf07c('0x25')](respondWithResult(_0x2f66bc,null))[_0xf07c('0x43')](handleError(_0x2f66bc,null));};exports['create']=function(_0x11a8fa,_0x1e9c72){return db[_0xf07c('0x3f')][_0xf07c('0x47')](_0x11a8fa[_0xf07c('0x48')],{})[_0xf07c('0x25')](respondWithResult(_0x1e9c72,0xc9))[_0xf07c('0x43')](handleError(_0x1e9c72,null));};exports[_0xf07c('0x24')]=function(_0x3fb537,_0x4edbba){if(_0x3fb537[_0xf07c('0x48')]['id']){delete _0x3fb537['body']['id'];}return db[_0xf07c('0x3f')][_0xf07c('0x46')]({'where':{'id':_0x3fb537[_0xf07c('0x45')]['id']}})[_0xf07c('0x25')](handleEntityNotFound(_0x4edbba,null))[_0xf07c('0x25')](saveUpdates(_0x3fb537['body'],null))['then'](respondWithResult(_0x4edbba,null))['catch'](handleError(_0x4edbba,null));};exports[_0xf07c('0x26')]=function(_0x56b094,_0x400111){return db[_0xf07c('0x3f')]['find']({'where':{'id':_0x56b094[_0xf07c('0x45')]['id']}})[_0xf07c('0x25')](handleEntityNotFound(_0x400111,null))[_0xf07c('0x25')](removeEntity(_0x400111,null))[_0xf07c('0x43')](handleError(_0x400111,null));}; \ No newline at end of file +var _0xe3ba=['FaxApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','show','params','keys','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','then','status','error','stack','name','send','index'];(function(_0x159183,_0xb67a84){var _0x17eca7=function(_0x414087){while(--_0x414087){_0x159183['push'](_0x159183['shift']());}};_0x17eca7(++_0xb67a84);}(_0xe3ba,0x150));var _0xae3b=function(_0x35e06d,_0xad434c){_0x35e06d=_0x35e06d-0x0;var _0x1b7a39=_0xe3ba[_0x35e06d];return _0x1b7a39;};'use strict';var emlformat=require(_0xae3b('0x0'));var rimraf=require(_0xae3b('0x1'));var zipdir=require(_0xae3b('0x2'));var jsonpatch=require(_0xae3b('0x3'));var rp=require(_0xae3b('0x4'));var moment=require(_0xae3b('0x5'));var BPromise=require(_0xae3b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xae3b('0x7'));var csv=require(_0xae3b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae3b('0x9'));var _=require(_0xae3b('0xa'));var squel=require(_0xae3b('0xb'));var crypto=require(_0xae3b('0xc'));var jsforce=require(_0xae3b('0xd'));var deskjs=require(_0xae3b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xae3b('0xf'));var Papa=require(_0xae3b('0x10'));var Redis=require(_0xae3b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xae3b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae3b('0x13'));var logger=require(_0xae3b('0x14'))(_0xae3b('0x15'));var utils=require(_0xae3b('0x16'));var config=require(_0xae3b('0x17'));var licenseUtil=require(_0xae3b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8e0882,_0x2ea2e3){_0x2ea2e3=_0x2ea2e3||0xcc;return function(_0x33d5b8){if(_0x33d5b8){return _0x8e0882[_0xae3b('0x19')](_0x2ea2e3);}return _0x8e0882['status'](_0x2ea2e3)[_0xae3b('0x1a')]();};}function respondWithResult(_0x5e84c9,_0x553efc){_0x553efc=_0x553efc||0xc8;return function(_0x27b5f3){if(_0x27b5f3){return _0x5e84c9['status'](_0x553efc)[_0xae3b('0x1b')](_0x27b5f3);}};}function respondWithFilteredResult(_0x3ee721,_0x3ecd75){return function(_0x45d38d){if(_0x45d38d){var _0x354c0e=typeof _0x3ecd75[_0xae3b('0x1c')]===_0xae3b('0x1d')&&typeof _0x3ecd75['limit']==='undefined';var _0x5f1802=_0x45d38d[_0xae3b('0x1e')];var _0x431ab5=_0x354c0e?0x0:_0x3ecd75[_0xae3b('0x1c')];var _0x57f7a3=_0x354c0e?_0x45d38d[_0xae3b('0x1e')]:_0x3ecd75['offset']+_0x3ecd75['limit'];var _0x443b21;if(_0x57f7a3>=_0x5f1802){_0x57f7a3=_0x5f1802;_0x443b21=0xc8;}else{_0x443b21=0xce;}_0x3ee721['status'](_0x443b21);return _0x3ee721[_0xae3b('0x1f')](_0xae3b('0x20'),_0x431ab5+'-'+_0x57f7a3+'/'+_0x5f1802)[_0xae3b('0x1b')](_0x45d38d);}return null;};}function patchUpdates(_0x5c03af){return function(_0x3f72dc){try{jsonpatch[_0xae3b('0x21')](_0x3f72dc,_0x5c03af,!![]);}catch(_0x2a8ab3){return BPromise[_0xae3b('0x22')](_0x2a8ab3);}return _0x3f72dc['save']();};}function saveUpdates(_0x16851c,_0x51a239){return function(_0x48e4ee){if(_0x48e4ee){return _0x48e4ee[_0xae3b('0x23')](_0x16851c)['then'](function(_0x149080){return _0x149080;});}return null;};}function removeEntity(_0x168c08,_0x3e6002){return function(_0x53909c){if(_0x53909c){return _0x53909c[_0xae3b('0x24')]()[_0xae3b('0x25')](function(){_0x168c08[_0xae3b('0x26')](0xcc)[_0xae3b('0x1a')]();});}};}function handleEntityNotFound(_0x55429a,_0x47656f){return function(_0x5a1368){if(!_0x5a1368){_0x55429a['sendStatus'](0x194);}return _0x5a1368;};}function handleError(_0x477249,_0x2be3ec){_0x2be3ec=_0x2be3ec||0x1f4;return function(_0x2b2460){logger[_0xae3b('0x27')](_0x2b2460[_0xae3b('0x28')]);if(_0x2b2460[_0xae3b('0x29')]){delete _0x2b2460['name'];}_0x477249['status'](_0x2be3ec)[_0xae3b('0x2a')](_0x2b2460);};}exports[_0xae3b('0x2b')]=function(_0x45f914,_0x3dd08b){var _0x4e84bf={},_0x3dd6ab={},_0x4cf405={'count':0x0,'rows':[]};var _0x39e224=_['map'](db[_0xae3b('0x2c')][_0xae3b('0x2d')],function(_0x54c803){return{'name':_0x54c803[_0xae3b('0x2e')],'type':_0x54c803[_0xae3b('0x2f')][_0xae3b('0x30')]};});_0x3dd6ab[_0xae3b('0x31')]=_[_0xae3b('0x32')](_0x39e224,'name');_0x3dd6ab[_0xae3b('0x33')]=_['keys'](_0x45f914[_0xae3b('0x33')]);_0x3dd6ab[_0xae3b('0x34')]=_[_0xae3b('0x35')](_0x3dd6ab[_0xae3b('0x31')],_0x3dd6ab['query']);_0x4e84bf['attributes']=_[_0xae3b('0x35')](_0x3dd6ab['model'],qs[_0xae3b('0x36')](_0x45f914[_0xae3b('0x33')][_0xae3b('0x36')]));_0x4e84bf['attributes']=_0x4e84bf[_0xae3b('0x37')][_0xae3b('0x38')]?_0x4e84bf[_0xae3b('0x37')]:_0x3dd6ab['model'];if(!_0x45f914['query'][_0xae3b('0x39')](_0xae3b('0x3a'))){_0x4e84bf[_0xae3b('0x3b')]=qs[_0xae3b('0x3b')](_0x45f914[_0xae3b('0x33')][_0xae3b('0x3b')]);_0x4e84bf[_0xae3b('0x1c')]=qs[_0xae3b('0x1c')](_0x45f914[_0xae3b('0x33')]['offset']);}_0x4e84bf[_0xae3b('0x3c')]=qs['sort'](_0x45f914[_0xae3b('0x33')]['sort']);_0x4e84bf['where']=qs['filters'](_['pick'](_0x45f914[_0xae3b('0x33')],_0x3dd6ab[_0xae3b('0x34')]),_0x39e224);if(_0x45f914[_0xae3b('0x33')][_0xae3b('0x3d')]){_0x4e84bf['where']=_[_0xae3b('0x3e')](_0x4e84bf['where'],{'$or':_['map'](_0x39e224,function(_0x5d2efb){if(_0x5d2efb[_0xae3b('0x2f')]!==_0xae3b('0x3f')){var _0x5809e9={};_0x5809e9[_0x5d2efb[_0xae3b('0x29')]]={'$like':'%'+_0x45f914[_0xae3b('0x33')][_0xae3b('0x3d')]+'%'};return _0x5809e9;}})});}_0x4e84bf=_[_0xae3b('0x3e')]({},_0x4e84bf,_0x45f914[_0xae3b('0x40')]);var _0x239669={'where':_0x4e84bf[_0xae3b('0x41')]};return db[_0xae3b('0x2c')]['count'](_0x239669)[_0xae3b('0x25')](function(_0x39231d){_0x4cf405[_0xae3b('0x1e')]=_0x39231d;if(_0x45f914['query'][_0xae3b('0x42')]){_0x4e84bf['include']=[{'all':!![]}];}return db[_0xae3b('0x2c')][_0xae3b('0x43')](_0x4e84bf);})[_0xae3b('0x25')](function(_0x15d0b1){_0x4cf405[_0xae3b('0x44')]=_0x15d0b1;return _0x4cf405;})[_0xae3b('0x25')](respondWithFilteredResult(_0x3dd08b,_0x4e84bf))['catch'](handleError(_0x3dd08b,null));};exports[_0xae3b('0x45')]=function(_0x1d0084,_0xb83521){var _0x48bf63={'raw':!![],'where':{'id':_0x1d0084[_0xae3b('0x46')]['id']}},_0x3a7da2={};_0x3a7da2[_0xae3b('0x31')]=_[_0xae3b('0x47')](db[_0xae3b('0x2c')][_0xae3b('0x2d')]);_0x3a7da2[_0xae3b('0x33')]=_[_0xae3b('0x47')](_0x1d0084[_0xae3b('0x33')]);_0x3a7da2['filters']=_[_0xae3b('0x35')](_0x3a7da2[_0xae3b('0x31')],_0x3a7da2[_0xae3b('0x33')]);_0x48bf63[_0xae3b('0x37')]=_[_0xae3b('0x35')](_0x3a7da2['model'],qs[_0xae3b('0x36')](_0x1d0084[_0xae3b('0x33')][_0xae3b('0x36')]));_0x48bf63[_0xae3b('0x37')]=_0x48bf63['attributes'][_0xae3b('0x38')]?_0x48bf63[_0xae3b('0x37')]:_0x3a7da2[_0xae3b('0x31')];if(_0x1d0084[_0xae3b('0x33')][_0xae3b('0x42')]){_0x48bf63['include']=[{'all':!![]}];}_0x48bf63=_[_0xae3b('0x3e')]({},_0x48bf63,_0x1d0084[_0xae3b('0x40')]);return db[_0xae3b('0x2c')][_0xae3b('0x48')](_0x48bf63)[_0xae3b('0x25')](handleEntityNotFound(_0xb83521,null))[_0xae3b('0x25')](respondWithResult(_0xb83521,null))[_0xae3b('0x49')](handleError(_0xb83521,null));};exports[_0xae3b('0x4a')]=function(_0x3a3c58,_0xceb5d0){return db[_0xae3b('0x2c')]['create'](_0x3a3c58[_0xae3b('0x4b')],{})[_0xae3b('0x25')](respondWithResult(_0xceb5d0,0xc9))[_0xae3b('0x49')](handleError(_0xceb5d0,null));};exports[_0xae3b('0x23')]=function(_0x39cd64,_0x40fe90){if(_0x39cd64[_0xae3b('0x4b')]['id']){delete _0x39cd64['body']['id'];}return db[_0xae3b('0x2c')][_0xae3b('0x48')]({'where':{'id':_0x39cd64[_0xae3b('0x46')]['id']}})['then'](handleEntityNotFound(_0x40fe90,null))[_0xae3b('0x25')](saveUpdates(_0x39cd64[_0xae3b('0x4b')],null))['then'](respondWithResult(_0x40fe90,null))[_0xae3b('0x49')](handleError(_0x40fe90,null));};exports[_0xae3b('0x24')]=function(_0x326eff,_0x16d673){return db['FaxApplication'][_0xae3b('0x48')]({'where':{'id':_0x326eff[_0xae3b('0x46')]['id']}})[_0xae3b('0x25')](handleEntityNotFound(_0x16d673,null))[_0xae3b('0x25')](removeEntity(_0x16d673,null))[_0xae3b('0x49')](handleError(_0x16d673,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index e46ce1e..a770e36 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 _0x11ed=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x1d0f91,_0x2a0c1b){var _0x36a1a9=function(_0x11fda5){while(--_0x11fda5){_0x1d0f91['push'](_0x1d0f91['shift']());}};_0x36a1a9(++_0x2a0c1b);}(_0x11ed,0x1dd));var _0xd11e=function(_0x4c8b3e,_0x1e121f){_0x4c8b3e=_0x4c8b3e-0x0;var _0xe38d89=_0x11ed[_0x4c8b3e];return _0xe38d89;};'use strict';var _=require(_0xd11e('0x0'));var util=require('util');var logger=require(_0xd11e('0x1'))(_0xd11e('0x2'));var moment=require(_0xd11e('0x3'));var BPromise=require(_0xd11e('0x4'));var rp=require(_0xd11e('0x5'));var fs=require('fs');var path=require(_0xd11e('0x6'));var rimraf=require(_0xd11e('0x7'));var config=require(_0xd11e('0x8'));var attributes=require('./faxApplication.attributes');module[_0xd11e('0x9')]=function(_0x4aba1c,_0x2b6077){return _0x4aba1c[_0xd11e('0xa')](_0xd11e('0xb'),attributes,{'tableName':_0xd11e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd11e('0xd'),'collate':_0xd11e('0xe')});}; \ No newline at end of file +var _0x4acc=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','./faxApplication.attributes','define','FaxApplication','fax_applications'];(function(_0x5db683,_0x45873a){var _0x545cd2=function(_0xb4e7e9){while(--_0xb4e7e9){_0x5db683['push'](_0x5db683['shift']());}};_0x545cd2(++_0x45873a);}(_0x4acc,0x7b));var _0xc4ac=function(_0x15cdd3,_0xaef8aa){_0x15cdd3=_0x15cdd3-0x0;var _0xd283e4=_0x4acc[_0x15cdd3];return _0xd283e4;};'use strict';var _=require(_0xc4ac('0x0'));var util=require(_0xc4ac('0x1'));var logger=require(_0xc4ac('0x2'))(_0xc4ac('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4ac('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc4ac('0x5'));module['exports']=function(_0x48b83a,_0x5ab1c3){return _0x48b83a[_0xc4ac('0x6')](_0xc4ac('0x7'),attributes,{'tableName':_0xc4ac('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc4ac('0x9'),'collate':_0xc4ac('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index b5bc776..e63b7c6 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 _0xa5cd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','catch','lodash','util','moment','randomstring'];(function(_0xb3f98c,_0x41edf9){var _0x5b500b=function(_0x2d2fbe){while(--_0x2d2fbe){_0xb3f98c['push'](_0xb3f98c['shift']());}};_0x5b500b(++_0x41edf9);}(_0xa5cd,0x151));var _0xda5c=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xa5cd[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xda5c('0x0'));var util=require(_0xda5c('0x1'));var moment=require(_0xda5c('0x2'));var BPromise=require('bluebird');var rs=require(_0xda5c('0x3'));var fs=require('fs');var Redis=require(_0xda5c('0x4'));var db=require(_0xda5c('0x5'))['db'];var utils=require(_0xda5c('0x6'));var logger=require(_0xda5c('0x7'))(_0xda5c('0x8'));var config=require(_0xda5c('0x9'));var jayson=require(_0xda5c('0xa'));var client=jayson[_0xda5c('0xb')][_0xda5c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x581700,_0x281d15,_0x464a62){return new BPromise(function(_0x501e87,_0x4b43d5){return client[_0xda5c('0xd')](_0x581700,_0x464a62)[_0xda5c('0xe')](function(_0x3d23f9){logger[_0xda5c('0xf')](_0xda5c('0x10'),_0x281d15,_0xda5c('0x11'));logger[_0xda5c('0x12')](_0xda5c('0x13'),_0x281d15,_0xda5c('0x11'),JSON[_0xda5c('0x14')](_0x3d23f9));if(_0x3d23f9[_0xda5c('0x15')]){if(_0x3d23f9['error']['code']===0x1f4){logger[_0xda5c('0x15')]('FaxApplication,\x20%s,\x20%s',_0x281d15,_0x3d23f9[_0xda5c('0x15')][_0xda5c('0x16')]);return _0x4b43d5(_0x3d23f9['error'][_0xda5c('0x16')]);}logger[_0xda5c('0x15')](_0xda5c('0x10'),_0x281d15,_0x3d23f9[_0xda5c('0x15')][_0xda5c('0x16')]);return _0x501e87(_0x3d23f9['error'][_0xda5c('0x16')]);}else{logger[_0xda5c('0xf')](_0xda5c('0x10'),_0x281d15,_0xda5c('0x11'));_0x501e87(_0x3d23f9['result'][_0xda5c('0x16')]);}})['catch'](function(_0x3ec22a){logger[_0xda5c('0x15')]('FaxApplication,\x20%s,\x20%s',_0x281d15,_0x3ec22a);_0x4b43d5(_0x3ec22a);});});}exports[_0xda5c('0x17')]=function(_0x2de004){var _0x24f1c2=this;return new Promise(function(_0x2bd919,_0x1cce2c){return db[_0xda5c('0x18')]['update'](_0x2de004[_0xda5c('0x19')],{'raw':_0x2de004[_0xda5c('0x1a')]?_0x2de004[_0xda5c('0x1a')][_0xda5c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2de004[_0xda5c('0x1a')]?_0x2de004[_0xda5c('0x1a')][_0xda5c('0x1c')]||null:null,'attributes':_0x2de004[_0xda5c('0x1a')]?_0x2de004[_0xda5c('0x1a')][_0xda5c('0x1d')]||null:null,'limit':_0x2de004[_0xda5c('0x1a')]?_0x2de004[_0xda5c('0x1a')]['limit']||null:null})[_0xda5c('0xe')](function(_0x8530d2){logger[_0xda5c('0xf')](_0xda5c('0x17'),_0x2de004);logger[_0xda5c('0x12')](_0xda5c('0x17'),_0x2de004,JSON['stringify'](_0x8530d2));_0x2bd919(_0x8530d2);})[_0xda5c('0x1e')](function(_0x282359){logger[_0xda5c('0x15')](_0xda5c('0x17'),_0x282359[_0xda5c('0x16')],_0x2de004);_0x1cce2c(_0x24f1c2[_0xda5c('0x15')](0x1f4,_0x282359['message']));});});}; \ No newline at end of file +var _0x567c=['stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit'];(function(_0x55f2bc,_0x426708){var _0xe85b87=function(_0x3e2862){while(--_0x3e2862){_0x55f2bc['push'](_0x55f2bc['shift']());}};_0xe85b87(++_0x426708);}(_0x567c,0x8d));var _0xc567=function(_0x413b91,_0x54a0e0){_0x413b91=_0x413b91-0x0;var _0x2d032b=_0x567c[_0x413b91];return _0x2d032b;};'use strict';var _=require(_0xc567('0x0'));var util=require(_0xc567('0x1'));var moment=require(_0xc567('0x2'));var BPromise=require(_0xc567('0x3'));var rs=require(_0xc567('0x4'));var fs=require('fs');var Redis=require(_0xc567('0x5'));var db=require(_0xc567('0x6'))['db'];var utils=require(_0xc567('0x7'));var logger=require(_0xc567('0x8'))(_0xc567('0x9'));var config=require(_0xc567('0xa'));var jayson=require(_0xc567('0xb'));var client=jayson[_0xc567('0xc')][_0xc567('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1622dd,_0x3467c1,_0x3e2aa9){return new BPromise(function(_0x181d6d,_0x2d5942){return client[_0xc567('0xe')](_0x1622dd,_0x3e2aa9)[_0xc567('0xf')](function(_0x3e8049){logger['info'](_0xc567('0x10'),_0x3467c1,'request\x20sent');logger[_0xc567('0x11')](_0xc567('0x12'),_0x3467c1,_0xc567('0x13'),JSON['stringify'](_0x3e8049));if(_0x3e8049[_0xc567('0x14')]){if(_0x3e8049['error'][_0xc567('0x15')]===0x1f4){logger[_0xc567('0x14')](_0xc567('0x10'),_0x3467c1,_0x3e8049[_0xc567('0x14')]['message']);return _0x2d5942(_0x3e8049[_0xc567('0x14')][_0xc567('0x16')]);}logger[_0xc567('0x14')]('FaxApplication,\x20%s,\x20%s',_0x3467c1,_0x3e8049[_0xc567('0x14')][_0xc567('0x16')]);return _0x181d6d(_0x3e8049[_0xc567('0x14')]['message']);}else{logger[_0xc567('0x17')](_0xc567('0x10'),_0x3467c1,'request\x20sent');_0x181d6d(_0x3e8049[_0xc567('0x18')][_0xc567('0x16')]);}})[_0xc567('0x19')](function(_0x521588){logger[_0xc567('0x14')](_0xc567('0x10'),_0x3467c1,_0x521588);_0x2d5942(_0x521588);});});}exports[_0xc567('0x1a')]=function(_0x1c0009){var _0x517401=this;return new Promise(function(_0x52f3ec,_0x4789e2){return db[_0xc567('0x1b')]['update'](_0x1c0009[_0xc567('0x1c')],{'raw':_0x1c0009[_0xc567('0x1d')]?_0x1c0009['options'][_0xc567('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c0009['options']?_0x1c0009[_0xc567('0x1d')][_0xc567('0x1f')]||null:null,'attributes':_0x1c0009[_0xc567('0x1d')]?_0x1c0009['options'][_0xc567('0x20')]||null:null,'limit':_0x1c0009[_0xc567('0x1d')]?_0x1c0009['options'][_0xc567('0x21')]||null:null})[_0xc567('0xf')](function(_0x354b8e){logger[_0xc567('0x17')](_0xc567('0x1a'),_0x1c0009);logger[_0xc567('0x11')]('UpdateFaxApplication',_0x1c0009,JSON[_0xc567('0x22')](_0x354b8e));_0x52f3ec(_0x354b8e);})[_0xc567('0x19')](function(_0x56772d){logger[_0xc567('0x14')]('UpdateFaxApplication',_0x56772d[_0xc567('0x16')],_0x1c0009);_0x4789e2(_0x517401[_0xc567('0x14')](0x1f4,_0x56772d[_0xc567('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 33bd438..70d5f1b 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 _0x1eba=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x48ce56,_0x213bea){var _0x25e8a1=function(_0x34f473){while(--_0x34f473){_0x48ce56['push'](_0x48ce56['shift']());}};_0x25e8a1(++_0x213bea);}(_0x1eba,0x1d7));var _0xa1eb=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0x1eba[_0xdeefbd];return _0x4ff63f;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var path=require(_0xa1eb('0x2'));var timeout=require(_0xa1eb('0x3'));var express=require(_0xa1eb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa1eb('0x5'));var interaction=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var controller=require(_0xa1eb('0x8'));router[_0xa1eb('0x9')]('/',auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xb')]);router[_0xa1eb('0x9')](_0xa1eb('0xc'),auth[_0xa1eb('0xa')](),controller[_0xa1eb('0xd')]);router[_0xa1eb('0xe')]('/',auth['isAuthenticated'](),controller[_0xa1eb('0xf')]);router['put'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x10')]);router['delete'](_0xa1eb('0xc'),auth['isAuthenticated'](),controller[_0xa1eb('0x11')]);module[_0xa1eb('0x12')]=router; \ No newline at end of file +var _0x3266=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3266,0x6a));var _0x6326=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x3266[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var fs_extra=require(_0x6326('0x6'));var auth=require(_0x6326('0x7'));var interaction=require(_0x6326('0x8'));var config=require('../../config/environment');var controller=require(_0x6326('0x9'));router['get']('/',auth[_0x6326('0xa')](),controller[_0x6326('0xb')]);router[_0x6326('0xc')]('/:id',auth[_0x6326('0xa')](),controller['show']);router[_0x6326('0xd')]('/',auth[_0x6326('0xa')](),controller[_0x6326('0xe')]);router[_0x6326('0xf')](_0x6326('0x10'),auth['isAuthenticated'](),controller[_0x6326('0x11')]);router[_0x6326('0x12')](_0x6326('0x10'),auth[_0x6326('0xa')](),controller[_0x6326('0x13')]);module[_0x6326('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 951406e..b287ec2 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 _0xf4f4=['out','ENUM','INTEGER','sequelize','exports','DATE','STRING'];(function(_0x1a2c01,_0x40f3ff){var _0x205487=function(_0x311338){while(--_0x311338){_0x1a2c01['push'](_0x1a2c01['shift']());}};_0x205487(++_0x40f3ff);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x38500c,_0x347c56){_0x38500c=_0x38500c-0x0;var _0x50c21d=_0xf4f4[_0x38500c];return _0x50c21d;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4f4f('0x2')]},'disposition':{'type':Sequelize[_0x4f4f('0x3')]},'secondDisposition':{'type':Sequelize[_0x4f4f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4f4f('0x3')]},'note':{'type':Sequelize[_0x4f4f('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x4f4f('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4f4f('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4f4f('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4f4f('0x5')]('in',_0x4f4f('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x4f4f('0x6')]}}; \ No newline at end of file +var _0x0b0e=['out','sequelize','BOOLEAN','STRING','DATE','ENUM'];(function(_0x333eb8,_0x4b7f48){var _0x249dc1=function(_0x42da6e){while(--_0x42da6e){_0x333eb8['push'](_0x333eb8['shift']());}};_0x249dc1(++_0x4b7f48);}(_0x0b0e,0x187));var _0xe0b0=function(_0x16d411,_0x5e0970){_0x16d411=_0x16d411-0x0;var _0x20336d=_0x0b0e[_0x16d411];return _0x20336d;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'closed':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe0b0('0x2')]},'secondDisposition':{'type':Sequelize[_0xe0b0('0x2')]},'thirdDisposition':{'type':Sequelize[_0xe0b0('0x2')]},'note':{'type':Sequelize[_0xe0b0('0x2')]},'read1stAt':{'type':Sequelize[_0xe0b0('0x3')]},'fax':{'type':Sequelize[_0xe0b0('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xe0b0('0x4')]('in',_0xe0b0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe0b0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe0b0('0x4')]('in',_0xe0b0('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 990e1dd..c1b7bf1 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 _0xeeaa=['stack','name','send','index','map','rawAttributes','fieldName','key','getOptions','findAll','fax','query','user','catch','show','model','keys','FaxInteraction','filters','intersection','attributes','fields','length','includeAll','options','find','body','params','describe','addMessage','FaxMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','$gte','split','include','rows','addTags','setTags','omit','spread','color','emit','faxInteractionTags:save','removeTags','toString','join','root','server','files','tmp','format','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','zip-dir','moment','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeeaa,0x11c));var _0xaeea=function(_0xab88ac,_0x10c41b){_0xab88ac=_0xab88ac-0x0;var _0x6aa214=_0xeeaa[_0xab88ac];return _0x6aa214;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xaeea('0x0'));var moment=require(_0xaeea('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xaeea('0x2'));var fs=require('fs');var _=require(_0xaeea('0x3'));var Redis=require(_0xaeea('0x4'));var interaction=require(_0xaeea('0x5'));var qs=require(_0xaeea('0x6'));var logger=require(_0xaeea('0x7'))(_0xaeea('0x8'));var config=require(_0xaeea('0x9'));var db=require(_0xaeea('0xa'))['db'];config[_0xaeea('0xb')]=_[_0xaeea('0xc')](config[_0xaeea('0xb')],{'host':_0xaeea('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaeea('0xb')]));require(_0xaeea('0xe'))['register'](socket);function respondWithStatusCode(_0x1fa134,_0x1592c7){_0x1592c7=_0x1592c7||0xcc;return function(_0x57e5cd){if(_0x57e5cd){return _0x1fa134[_0xaeea('0xf')](_0x1592c7);}return _0x1fa134[_0xaeea('0x10')](_0x1592c7)[_0xaeea('0x11')]();};}function respondWithResult(_0x2cafa4,_0xb2cb6b){_0xb2cb6b=_0xb2cb6b||0xc8;return function(_0x5677ad){if(_0x5677ad){return _0x2cafa4[_0xaeea('0x10')](_0xb2cb6b)['json'](_0x5677ad);}};}function respondWithFilteredResult(_0x2b4116,_0x299498){return function(_0x130aec){if(_0x130aec){var _0x56757c=typeof _0x299498[_0xaeea('0x12')]===_0xaeea('0x13')&&typeof _0x299498[_0xaeea('0x14')]===_0xaeea('0x13');var _0x2a6886=_0x130aec[_0xaeea('0x15')];var _0x169adc=_0x56757c?0x0:_0x299498[_0xaeea('0x12')];var _0x3d66b5=_0x56757c?_0x130aec['count']:_0x299498[_0xaeea('0x12')]+_0x299498[_0xaeea('0x14')];var _0x3995ee;if(_0x3d66b5>=_0x2a6886){_0x3d66b5=_0x2a6886;_0x3995ee=0xc8;}else{_0x3995ee=0xce;}_0x2b4116[_0xaeea('0x10')](_0x3995ee);return _0x2b4116[_0xaeea('0x16')]('Content-Range',_0x169adc+'-'+_0x3d66b5+'/'+_0x2a6886)[_0xaeea('0x17')](_0x130aec);}return null;};}function saveUpdates(_0x8a246a){return function(_0x49cb4f){if(_0x49cb4f){return _0x49cb4f[_0xaeea('0x18')](_0x8a246a)[_0xaeea('0x19')](function(_0x1a3dfa){return _0x1a3dfa;});}return null;};}function removeEntity(_0x4ca075){return function(_0x24c543){if(_0x24c543){return _0x24c543[_0xaeea('0x1a')]()[_0xaeea('0x19')](function(){_0x4ca075[_0xaeea('0x10')](0xcc)[_0xaeea('0x11')]();});}};}function handleEntityNotFound(_0x156863){return function(_0x5363b4){if(!_0x5363b4){_0x156863[_0xaeea('0xf')](0x194);}return _0x5363b4;};}function handleError(_0x223e5b,_0xbde687){_0xbde687=_0xbde687||0x1f4;return function(_0x45e1eb){logger[_0xaeea('0x1b')](_0x45e1eb[_0xaeea('0x1c')]);if(_0x45e1eb['name']){delete _0x45e1eb[_0xaeea('0x1d')];}_0x223e5b[_0xaeea('0x10')](_0xbde687)[_0xaeea('0x1e')](_0x45e1eb);};}exports[_0xaeea('0x1f')]=function(_0x19128c,_0xda727c){var _0x405b63={};var _0x35f456=_[_0xaeea('0x20')](db['FaxInteraction'][_0xaeea('0x21')],function(_0x4fae01){return{'name':_0x4fae01[_0xaeea('0x22')],'type':_0x4fae01['type'][_0xaeea('0x23')]};});_0x405b63=qs[_0xaeea('0x24')](_0x35f456,_0x19128c);return interaction[_0xaeea('0x25')](_0xaeea('0x26'),_0x19128c[_0xaeea('0x27')],_0x19128c[_0xaeea('0x28')],_0x405b63,_0x35f456)['then'](respondWithFilteredResult(_0xda727c,_0x405b63))[_0xaeea('0x29')](handleError(_0xda727c,null));};exports[_0xaeea('0x2a')]=function(_0x5a1bcf,_0x5a3f45){var _0x47ae86={'raw':![],'where':{'id':_0x5a1bcf['params']['id']}},_0x88f577={};_0x88f577[_0xaeea('0x2b')]=_[_0xaeea('0x2c')](db[_0xaeea('0x2d')][_0xaeea('0x21')]);_0x88f577[_0xaeea('0x27')]=_[_0xaeea('0x2c')](_0x5a1bcf[_0xaeea('0x27')]);_0x88f577[_0xaeea('0x2e')]=_[_0xaeea('0x2f')](_0x88f577[_0xaeea('0x2b')],_0x88f577[_0xaeea('0x27')]);_0x47ae86[_0xaeea('0x30')]=_['intersection'](_0x88f577['model'],qs[_0xaeea('0x31')](_0x5a1bcf[_0xaeea('0x27')]['fields']));_0x47ae86['attributes']=_0x47ae86[_0xaeea('0x30')][_0xaeea('0x32')]?_0x47ae86[_0xaeea('0x30')]:_0x88f577['model'];if(_0x5a1bcf[_0xaeea('0x27')][_0xaeea('0x33')]){_0x47ae86['include']=[{'all':!![]}];}_0x47ae86=_['merge']({},_0x47ae86,_0x5a1bcf[_0xaeea('0x34')]);return db[_0xaeea('0x2d')][_0xaeea('0x35')](_0x47ae86)[_0xaeea('0x19')](handleEntityNotFound(_0x5a3f45,null))['then'](respondWithResult(_0x5a3f45,null))[_0xaeea('0x29')](handleError(_0x5a3f45,null));};exports['create']=function(_0x1f7eac,_0x49d3d5){return db[_0xaeea('0x2d')]['create'](_0x1f7eac[_0xaeea('0x36')],{})['then'](respondWithResult(_0x49d3d5,0xc9))['catch'](handleError(_0x49d3d5,null));};exports[_0xaeea('0x18')]=function(_0x45ace7,_0x34e7a7){if(_0x45ace7[_0xaeea('0x36')]['id']){delete _0x45ace7['body']['id'];}return db['FaxInteraction'][_0xaeea('0x35')]({'where':{'id':_0x45ace7[_0xaeea('0x37')]['id']}})['then'](handleEntityNotFound(_0x34e7a7,null))[_0xaeea('0x19')](saveUpdates(_0x45ace7[_0xaeea('0x36')],null))[_0xaeea('0x19')](respondWithResult(_0x34e7a7,null))[_0xaeea('0x29')](handleError(_0x34e7a7,null));};exports[_0xaeea('0x1a')]=function(_0x18529e,_0x5eee50){return db[_0xaeea('0x2d')][_0xaeea('0x35')]({'where':{'id':_0x18529e[_0xaeea('0x37')]['id']}})[_0xaeea('0x19')](handleEntityNotFound(_0x5eee50,null))['then'](removeEntity(_0x5eee50,null))[_0xaeea('0x29')](handleError(_0x5eee50,null));};exports[_0xaeea('0x38')]=function(_0x2f83a4,_0x420a59){return db[_0xaeea('0x2d')][_0xaeea('0x38')]()[_0xaeea('0x19')](respondWithResult(_0x420a59,null))[_0xaeea('0x29')](handleError(_0x420a59,null));};exports[_0xaeea('0x39')]=function(_0x56b0a5,_0x21c244){return db[_0xaeea('0x3a')]['find']({'where':{'id':_0x56b0a5[_0xaeea('0x37')]['id']}})[_0xaeea('0x19')](handleEntityNotFound(_0x21c244,null))[_0xaeea('0x19')](function(_0x8eec91){if(_0x8eec91){return _0x8eec91[_0xaeea('0x39')](_0x56b0a5[_0xaeea('0x36')]['ids'],_['omit'](_0x56b0a5[_0xaeea('0x36')],[_0xaeea('0x3b'),'id'])||{});}})[_0xaeea('0x19')](respondWithResult(_0x21c244,null))['catch'](handleError(_0x21c244,null));};exports[_0xaeea('0x3c')]=function(_0x3e10b5,_0x2fcb35){var _0x8f93a0={'raw':![],'where':{}};var _0xadab47={};var _0x19eb40={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xaeea('0x3d')]({'where':{'id':_0x3e10b5[_0xaeea('0x37')]['id']}})[_0xaeea('0x19')](handleEntityNotFound(_0x2fcb35,null))[_0xaeea('0x19')](function(_0x5a62d8){if(_0x5a62d8){_0xadab47[_0xaeea('0x2b')]=_[_0xaeea('0x2c')](db[_0xaeea('0x3a')][_0xaeea('0x21')]);_0xadab47[_0xaeea('0x27')]=_[_0xaeea('0x2c')](_0x3e10b5['query']);_0xadab47['filters']=_[_0xaeea('0x2f')](_0xadab47['model'],_0xadab47[_0xaeea('0x27')]);_0x8f93a0[_0xaeea('0x30')]=_[_0xaeea('0x2f')](_0xadab47[_0xaeea('0x2b')],qs[_0xaeea('0x31')](_0x3e10b5[_0xaeea('0x27')][_0xaeea('0x31')]));_0x8f93a0[_0xaeea('0x30')]=_0x8f93a0[_0xaeea('0x30')][_0xaeea('0x32')]?_0x8f93a0[_0xaeea('0x30')]:_0xadab47[_0xaeea('0x2b')];if(!_0x3e10b5[_0xaeea('0x27')][_0xaeea('0x3e')](_0xaeea('0x3f'))){_0x8f93a0['limit']=qs['limit'](_0x3e10b5[_0xaeea('0x27')][_0xaeea('0x14')]);_0x8f93a0[_0xaeea('0x12')]=qs[_0xaeea('0x12')](_0x3e10b5[_0xaeea('0x27')][_0xaeea('0x12')]);}_0x8f93a0[_0xaeea('0x40')]=qs['sort'](_0x3e10b5[_0xaeea('0x27')][_0xaeea('0x41')]);_0x8f93a0['where']=qs['filters'](_[_0xaeea('0x42')](_0x3e10b5['query'],_0xadab47['filters']));_0x8f93a0[_0xaeea('0x43')]['FaxInteractionId']=_0x5a62d8['id'];if(_0x3e10b5[_0xaeea('0x27')]['filter']){_0x8f93a0[_0xaeea('0x43')]=_[_0xaeea('0x44')](_0x8f93a0[_0xaeea('0x43')],{'$or':_[_0xaeea('0x20')](_0x8f93a0['attributes'],function(_0x237b8a){var _0xf4e2dc={};_0xf4e2dc[_0x237b8a]={'$like':'%'+_0x3e10b5[_0xaeea('0x27')][_0xaeea('0x45')]+'%'};return _0xf4e2dc;})});}if(_0x3e10b5[_0xaeea('0x27')][_0xaeea('0x46')]){var _0x52bc8f=_0x3e10b5[_0xaeea('0x27')]['$gte'][_0xaeea('0x47')](',');var _0x92e5a={};_0x92e5a[_0x52bc8f[0x0]]={'$gte':moment(_0x52bc8f[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x8f93a0[_0xaeea('0x43')]=_[_0xaeea('0x44')](_0x8f93a0['where'],_0x92e5a);}_0x8f93a0=_[_0xaeea('0x44')]({},_0x8f93a0,_0x3e10b5['options']);return db[_0xaeea('0x3a')][_0xaeea('0x15')]({'where':_0x8f93a0['where']})[_0xaeea('0x19')](function(_0xb28228){_0x19eb40['count']=_0xb28228;if(_0x3e10b5[_0xaeea('0x27')][_0xaeea('0x33')]){_0x8f93a0[_0xaeea('0x48')]=[{'all':!![]}];}return db[_0xaeea('0x3a')][_0xaeea('0x25')](_0x8f93a0);})[_0xaeea('0x19')](function(_0x27b610){_0x19eb40[_0xaeea('0x49')]=_0x27b610;return _0x19eb40;});}})[_0xaeea('0x19')](respondWithFilteredResult(_0x2fcb35,_0x8f93a0))[_0xaeea('0x29')](handleError(_0x2fcb35,null));};exports[_0xaeea('0x4a')]=function(_0x3d4a34,_0x4d9021){return db[_0xaeea('0x2d')][_0xaeea('0x35')]({'where':{'id':_0x3d4a34[_0xaeea('0x37')]['id']}})[_0xaeea('0x19')](handleEntityNotFound(_0x4d9021,null))['then'](function(_0x3f19bd){if(_0x3f19bd){return _0x3f19bd[_0xaeea('0x4b')](_0x3d4a34[_0xaeea('0x36')][_0xaeea('0x3b')],_[_0xaeea('0x4c')](_0x3d4a34['body'],[_0xaeea('0x3b'),'id'])||{})[_0xaeea('0x4d')](function(){return db['Tag'][_0xaeea('0x25')]({'attributes':['id',_0xaeea('0x1d'),_0xaeea('0x4e')],'where':{'id':_0x3d4a34[_0xaeea('0x36')][_0xaeea('0x3b')]}});})['then'](function(_0x4fb803){socket[_0xaeea('0x4f')](_0xaeea('0x50'),{'id':Number(_0x3d4a34[_0xaeea('0x37')]['id']),'tags':_0x4fb803||[]});return{'id':Number(_0x3d4a34[_0xaeea('0x37')]['id']),'tags':_0x4fb803||[]};});}})[_0xaeea('0x19')](respondWithResult(_0x4d9021,null))[_0xaeea('0x29')](handleError(_0x4d9021,null));};exports[_0xaeea('0x51')]=function(_0x30add6,_0x13284b){return db[_0xaeea('0x2d')][_0xaeea('0x35')]({'where':{'id':_0x30add6['params']['id']}})['then'](handleEntityNotFound(_0x13284b,null))['then'](function(_0x40193c){if(_0x40193c){return _0x40193c['removeTags'](_0x30add6[_0xaeea('0x27')][_0xaeea('0x3b')]);}})[_0xaeea('0x19')](respondWithStatusCode(_0x13284b,null))[_0xaeea('0x29')](handleError(_0x13284b,null));};exports['download']=function(_0xe217a2,_0x138cff){var _0x4ef392=moment()['unix']()[_0xaeea('0x52')]();var _0x372cfc=path[_0xaeea('0x53')](config[_0xaeea('0x54')],_0xaeea('0x55'),_0xaeea('0x56'),_0xaeea('0x57'));var _0x5a6bce=path[_0xaeea('0x53')](config[_0xaeea('0x54')],_0xaeea('0x55'),_0xaeea('0x56'),'attachments');var _0x378848=path[_0xaeea('0x53')](_0x372cfc,_0x4ef392);var _0x47d402=util[_0xaeea('0x58')](_0xaeea('0x59'),_0xe217a2[_0xaeea('0x37')]['id'],_0x4ef392);var _0xa94575=path[_0xaeea('0x53')](_0x372cfc,_0x47d402);var _0x1c0c76=[];_0x1c0c76[_0xaeea('0x5a')]({'model':db['Attachment'],'as':_0xaeea('0x5b'),'raw':!![]});var _0x22c6b6=[{'model':db[_0xaeea('0x3a')],'as':'Messages','attributes':['id',_0xaeea('0x36'),_0xaeea('0x5c')],'include':_0x1c0c76}];return db[_0xaeea('0x2d')][_0xaeea('0x35')]({'where':{'id':_0xe217a2[_0xaeea('0x37')]['id']},'include':_0x22c6b6})[_0xaeea('0x19')](handleEntityNotFound(_0x138cff,null))['then'](function(_0x525f8d){if(_0x525f8d&&_0x525f8d[_0xaeea('0x5d')]){var _0x144cc0=_0x525f8d[_0xaeea('0x5e')]({'plain':!![]});fs[_0xaeea('0x5f')](_0x378848);for(var _0xfea8d5=0x0;_0xfea8d5<_0x144cc0['Messages'][_0xaeea('0x32')];_0xfea8d5++){var _0x5b7f84=_0x144cc0['Messages'][_0xfea8d5][_0xaeea('0x5b')];if(_0x5b7f84){var _0x57e7c5=path[_0xaeea('0x53')](_0x5a6bce,_0x5b7f84['basename']);if(fs[_0xaeea('0x60')](_0x57e7c5)){fs[_0xaeea('0x61')](_0x57e7c5)[_0xaeea('0x62')](fs[_0xaeea('0x63')](path[_0xaeea('0x53')](_0x378848,_0x5b7f84[_0xaeea('0x64')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x11361c,_0x3fcc3c){zipdir(_0x378848,{'saveTo':_0xa94575},function(_0x4063cb,_0x71323f){if(_0x4063cb)return _0x3fcc3c(_0x4063cb);return _0x11361c(_0x71323f);});})['then'](function(){return new BPromise(function(_0x1c26d2,_0x1207f7){rimraf(_0x378848,function(_0x35a0e7){if(_0x35a0e7)_0x1207f7(_0x35a0e7);return _0x1c26d2();});});})['then'](function(){return _0x138cff['download'](_0xa94575,_0x47d402,function(_0x25bdd3){if(_0x25bdd3){console[_0xaeea('0x65')](_0xaeea('0x66'),_0x25bdd3);}else{fs[_0xaeea('0x67')](_0xa94575);}});});});}else{return _0x138cff[_0xaeea('0xf')](0xc8);}})[_0xaeea('0x29')](handleError(_0x138cff,null));}; \ No newline at end of file +var _0xdfd5=['stack','name','send','index','map','FaxInteraction','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','includeAll','merge','options','find','create','body','describe','addMessage','omit','getMessages','FaxMessage','length','hasOwnProperty','order','sort','where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','ids','spread','Tag','color','faxInteractionTags:save','removeTags','toString','root','server','files','join','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','download','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error'];(function(_0x3f2ce5,_0xd87ace){var _0x167ce8=function(_0x2a832a){while(--_0x2a832a){_0x3f2ce5['push'](_0x3f2ce5['shift']());}};_0x167ce8(++_0xd87ace);}(_0xdfd5,0xb3));var _0x5dfd=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xdfd5[_0x243217];return _0x478029;};'use strict';var rimraf=require(_0x5dfd('0x0'));var zipdir=require(_0x5dfd('0x1'));var moment=require(_0x5dfd('0x2'));var BPromise=require('bluebird');var util=require(_0x5dfd('0x3'));var path=require(_0x5dfd('0x4'));var fs=require('fs');var _=require(_0x5dfd('0x5'));var Redis=require(_0x5dfd('0x6'));var interaction=require(_0x5dfd('0x7'));var qs=require(_0x5dfd('0x8'));var logger=require(_0x5dfd('0x9'))(_0x5dfd('0xa'));var config=require(_0x5dfd('0xb'));var db=require(_0x5dfd('0xc'))['db'];config[_0x5dfd('0xd')]=_[_0x5dfd('0xe')](config[_0x5dfd('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x5dfd('0xf'))(new Redis(config[_0x5dfd('0xd')]));require(_0x5dfd('0x10'))[_0x5dfd('0x11')](socket);function respondWithStatusCode(_0x1e0443,_0x4a8a83){_0x4a8a83=_0x4a8a83||0xcc;return function(_0x7d4c9b){if(_0x7d4c9b){return _0x1e0443['sendStatus'](_0x4a8a83);}return _0x1e0443[_0x5dfd('0x12')](_0x4a8a83)['end']();};}function respondWithResult(_0x30fcbc,_0x1ec409){_0x1ec409=_0x1ec409||0xc8;return function(_0x8b6f21){if(_0x8b6f21){return _0x30fcbc[_0x5dfd('0x12')](_0x1ec409)[_0x5dfd('0x13')](_0x8b6f21);}};}function respondWithFilteredResult(_0x4de135,_0x390bab){return function(_0x592cd4){if(_0x592cd4){var _0x33dada=typeof _0x390bab[_0x5dfd('0x14')]===_0x5dfd('0x15')&&typeof _0x390bab[_0x5dfd('0x16')]==='undefined';var _0x2bc398=_0x592cd4[_0x5dfd('0x17')];var _0x4a82c9=_0x33dada?0x0:_0x390bab[_0x5dfd('0x14')];var _0x2b9332=_0x33dada?_0x592cd4['count']:_0x390bab[_0x5dfd('0x14')]+_0x390bab[_0x5dfd('0x16')];var _0x58ba7c;if(_0x2b9332>=_0x2bc398){_0x2b9332=_0x2bc398;_0x58ba7c=0xc8;}else{_0x58ba7c=0xce;}_0x4de135['status'](_0x58ba7c);return _0x4de135[_0x5dfd('0x18')](_0x5dfd('0x19'),_0x4a82c9+'-'+_0x2b9332+'/'+_0x2bc398)['json'](_0x592cd4);}return null;};}function saveUpdates(_0x5c3f62){return function(_0x4b2a89){if(_0x4b2a89){return _0x4b2a89[_0x5dfd('0x1a')](_0x5c3f62)[_0x5dfd('0x1b')](function(_0x562ca6){return _0x562ca6;});}return null;};}function removeEntity(_0x4952a8){return function(_0x301b48){if(_0x301b48){return _0x301b48[_0x5dfd('0x1c')]()['then'](function(){_0x4952a8[_0x5dfd('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x91189c){return function(_0x7fcd2){if(!_0x7fcd2){_0x91189c[_0x5dfd('0x1d')](0x194);}return _0x7fcd2;};}function handleError(_0x565148,_0x5acb6e){_0x5acb6e=_0x5acb6e||0x1f4;return function(_0xbe1230){logger[_0x5dfd('0x1e')](_0xbe1230[_0x5dfd('0x1f')]);if(_0xbe1230[_0x5dfd('0x20')]){delete _0xbe1230['name'];}_0x565148['status'](_0x5acb6e)[_0x5dfd('0x21')](_0xbe1230);};}exports[_0x5dfd('0x22')]=function(_0x3e6053,_0x4f574b){var _0x38366c={};var _0x3fe857=_[_0x5dfd('0x23')](db[_0x5dfd('0x24')]['rawAttributes'],function(_0x3e7753){return{'name':_0x3e7753[_0x5dfd('0x25')],'type':_0x3e7753[_0x5dfd('0x26')][_0x5dfd('0x27')]};});_0x38366c=qs[_0x5dfd('0x28')](_0x3fe857,_0x3e6053);return interaction[_0x5dfd('0x29')](_0x5dfd('0x2a'),_0x3e6053[_0x5dfd('0x2b')],_0x3e6053[_0x5dfd('0x2c')],_0x38366c,_0x3fe857)[_0x5dfd('0x1b')](respondWithFilteredResult(_0x4f574b,_0x38366c))[_0x5dfd('0x2d')](handleError(_0x4f574b,null));};exports[_0x5dfd('0x2e')]=function(_0x5676fa,_0x57d4fc){var _0x4ef91f={'raw':![],'where':{'id':_0x5676fa[_0x5dfd('0x2f')]['id']}},_0x3e14c6={};_0x3e14c6[_0x5dfd('0x30')]=_[_0x5dfd('0x31')](db[_0x5dfd('0x24')]['rawAttributes']);_0x3e14c6[_0x5dfd('0x2b')]=_[_0x5dfd('0x31')](_0x5676fa[_0x5dfd('0x2b')]);_0x3e14c6[_0x5dfd('0x32')]=_[_0x5dfd('0x33')](_0x3e14c6['model'],_0x3e14c6['query']);_0x4ef91f['attributes']=_[_0x5dfd('0x33')](_0x3e14c6['model'],qs[_0x5dfd('0x34')](_0x5676fa[_0x5dfd('0x2b')][_0x5dfd('0x34')]));_0x4ef91f[_0x5dfd('0x35')]=_0x4ef91f[_0x5dfd('0x35')]['length']?_0x4ef91f[_0x5dfd('0x35')]:_0x3e14c6[_0x5dfd('0x30')];if(_0x5676fa[_0x5dfd('0x2b')][_0x5dfd('0x36')]){_0x4ef91f['include']=[{'all':!![]}];}_0x4ef91f=_[_0x5dfd('0x37')]({},_0x4ef91f,_0x5676fa[_0x5dfd('0x38')]);return db[_0x5dfd('0x24')][_0x5dfd('0x39')](_0x4ef91f)[_0x5dfd('0x1b')](handleEntityNotFound(_0x57d4fc,null))['then'](respondWithResult(_0x57d4fc,null))[_0x5dfd('0x2d')](handleError(_0x57d4fc,null));};exports[_0x5dfd('0x3a')]=function(_0x15c6a4,_0x1d2ecc){return db[_0x5dfd('0x24')][_0x5dfd('0x3a')](_0x15c6a4[_0x5dfd('0x3b')],{})['then'](respondWithResult(_0x1d2ecc,0xc9))['catch'](handleError(_0x1d2ecc,null));};exports['update']=function(_0x36a7ca,_0x469187){if(_0x36a7ca['body']['id']){delete _0x36a7ca[_0x5dfd('0x3b')]['id'];}return db['FaxInteraction'][_0x5dfd('0x39')]({'where':{'id':_0x36a7ca[_0x5dfd('0x2f')]['id']}})[_0x5dfd('0x1b')](handleEntityNotFound(_0x469187,null))[_0x5dfd('0x1b')](saveUpdates(_0x36a7ca[_0x5dfd('0x3b')],null))[_0x5dfd('0x1b')](respondWithResult(_0x469187,null))[_0x5dfd('0x2d')](handleError(_0x469187,null));};exports[_0x5dfd('0x1c')]=function(_0x65fe88,_0x408661){return db[_0x5dfd('0x24')][_0x5dfd('0x39')]({'where':{'id':_0x65fe88['params']['id']}})[_0x5dfd('0x1b')](handleEntityNotFound(_0x408661,null))[_0x5dfd('0x1b')](removeEntity(_0x408661,null))[_0x5dfd('0x2d')](handleError(_0x408661,null));};exports['describe']=function(_0xb6e1ca,_0x4c7639){return db[_0x5dfd('0x24')][_0x5dfd('0x3c')]()[_0x5dfd('0x1b')](respondWithResult(_0x4c7639,null))['catch'](handleError(_0x4c7639,null));};exports[_0x5dfd('0x3d')]=function(_0x3a963d,_0x376d5b){return db['FaxMessage'][_0x5dfd('0x39')]({'where':{'id':_0x3a963d[_0x5dfd('0x2f')]['id']}})['then'](handleEntityNotFound(_0x376d5b,null))['then'](function(_0x3e0609){if(_0x3e0609){return _0x3e0609[_0x5dfd('0x3d')](_0x3a963d[_0x5dfd('0x3b')]['ids'],_[_0x5dfd('0x3e')](_0x3a963d['body'],['ids','id'])||{});}})[_0x5dfd('0x1b')](respondWithResult(_0x376d5b,null))[_0x5dfd('0x2d')](handleError(_0x376d5b,null));};exports[_0x5dfd('0x3f')]=function(_0x5e6e12,_0x263f65){var _0x2dc4b0={'raw':![],'where':{}};var _0x20aa44={};var _0x263c90={'count':0x0,'rows':[]};return db[_0x5dfd('0x24')]['findOne']({'where':{'id':_0x5e6e12[_0x5dfd('0x2f')]['id']}})[_0x5dfd('0x1b')](handleEntityNotFound(_0x263f65,null))['then'](function(_0x2e7442){if(_0x2e7442){_0x20aa44[_0x5dfd('0x30')]=_['keys'](db[_0x5dfd('0x40')]['rawAttributes']);_0x20aa44[_0x5dfd('0x2b')]=_['keys'](_0x5e6e12[_0x5dfd('0x2b')]);_0x20aa44['filters']=_[_0x5dfd('0x33')](_0x20aa44['model'],_0x20aa44['query']);_0x2dc4b0[_0x5dfd('0x35')]=_[_0x5dfd('0x33')](_0x20aa44[_0x5dfd('0x30')],qs[_0x5dfd('0x34')](_0x5e6e12[_0x5dfd('0x2b')][_0x5dfd('0x34')]));_0x2dc4b0[_0x5dfd('0x35')]=_0x2dc4b0[_0x5dfd('0x35')][_0x5dfd('0x41')]?_0x2dc4b0['attributes']:_0x20aa44[_0x5dfd('0x30')];if(!_0x5e6e12[_0x5dfd('0x2b')][_0x5dfd('0x42')]('nolimit')){_0x2dc4b0[_0x5dfd('0x16')]=qs[_0x5dfd('0x16')](_0x5e6e12['query'][_0x5dfd('0x16')]);_0x2dc4b0['offset']=qs[_0x5dfd('0x14')](_0x5e6e12[_0x5dfd('0x2b')][_0x5dfd('0x14')]);}_0x2dc4b0[_0x5dfd('0x43')]=qs[_0x5dfd('0x44')](_0x5e6e12[_0x5dfd('0x2b')][_0x5dfd('0x44')]);_0x2dc4b0[_0x5dfd('0x45')]=qs[_0x5dfd('0x32')](_[_0x5dfd('0x46')](_0x5e6e12[_0x5dfd('0x2b')],_0x20aa44['filters']));_0x2dc4b0['where'][_0x5dfd('0x47')]=_0x2e7442['id'];if(_0x5e6e12[_0x5dfd('0x2b')][_0x5dfd('0x48')]){_0x2dc4b0[_0x5dfd('0x45')]=_[_0x5dfd('0x37')](_0x2dc4b0[_0x5dfd('0x45')],{'$or':_[_0x5dfd('0x23')](_0x2dc4b0[_0x5dfd('0x35')],function(_0x27c892){var _0x2ada15={};_0x2ada15[_0x27c892]={'$like':'%'+_0x5e6e12[_0x5dfd('0x2b')][_0x5dfd('0x48')]+'%'};return _0x2ada15;})});}if(_0x5e6e12[_0x5dfd('0x2b')][_0x5dfd('0x49')]){var _0x1d752c=_0x5e6e12[_0x5dfd('0x2b')][_0x5dfd('0x49')][_0x5dfd('0x4a')](',');var _0x5216da={};_0x5216da[_0x1d752c[0x0]]={'$gte':moment(_0x1d752c[0x1])[_0x5dfd('0x4b')](_0x5dfd('0x4c'))};_0x2dc4b0[_0x5dfd('0x45')]=_[_0x5dfd('0x37')](_0x2dc4b0[_0x5dfd('0x45')],_0x5216da);}_0x2dc4b0=_[_0x5dfd('0x37')]({},_0x2dc4b0,_0x5e6e12[_0x5dfd('0x38')]);return db[_0x5dfd('0x40')][_0x5dfd('0x17')]({'where':_0x2dc4b0[_0x5dfd('0x45')]})[_0x5dfd('0x1b')](function(_0x4bbb43){_0x263c90['count']=_0x4bbb43;if(_0x5e6e12[_0x5dfd('0x2b')][_0x5dfd('0x36')]){_0x2dc4b0[_0x5dfd('0x4d')]=[{'all':!![]}];}return db[_0x5dfd('0x40')][_0x5dfd('0x29')](_0x2dc4b0);})[_0x5dfd('0x1b')](function(_0x46ff1c){_0x263c90['rows']=_0x46ff1c;return _0x263c90;});}})[_0x5dfd('0x1b')](respondWithFilteredResult(_0x263f65,_0x2dc4b0))[_0x5dfd('0x2d')](handleError(_0x263f65,null));};exports[_0x5dfd('0x4e')]=function(_0x4b665c,_0x2c2b4b){return db[_0x5dfd('0x24')][_0x5dfd('0x39')]({'where':{'id':_0x4b665c[_0x5dfd('0x2f')]['id']}})[_0x5dfd('0x1b')](handleEntityNotFound(_0x2c2b4b,null))[_0x5dfd('0x1b')](function(_0x67f8be){if(_0x67f8be){return _0x67f8be[_0x5dfd('0x4f')](_0x4b665c['body'][_0x5dfd('0x50')],_[_0x5dfd('0x3e')](_0x4b665c[_0x5dfd('0x3b')],[_0x5dfd('0x50'),'id'])||{})[_0x5dfd('0x51')](function(){return db[_0x5dfd('0x52')][_0x5dfd('0x29')]({'attributes':['id',_0x5dfd('0x20'),_0x5dfd('0x53')],'where':{'id':_0x4b665c[_0x5dfd('0x3b')][_0x5dfd('0x50')]}});})['then'](function(_0x32d6a8){socket['emit'](_0x5dfd('0x54'),{'id':Number(_0x4b665c[_0x5dfd('0x2f')]['id']),'tags':_0x32d6a8||[]});return{'id':Number(_0x4b665c[_0x5dfd('0x2f')]['id']),'tags':_0x32d6a8||[]};});}})[_0x5dfd('0x1b')](respondWithResult(_0x2c2b4b,null))[_0x5dfd('0x2d')](handleError(_0x2c2b4b,null));};exports['removeTags']=function(_0x13a661,_0x120e64){return db[_0x5dfd('0x24')][_0x5dfd('0x39')]({'where':{'id':_0x13a661[_0x5dfd('0x2f')]['id']}})[_0x5dfd('0x1b')](handleEntityNotFound(_0x120e64,null))[_0x5dfd('0x1b')](function(_0xeba578){if(_0xeba578){return _0xeba578[_0x5dfd('0x55')](_0x13a661[_0x5dfd('0x2b')][_0x5dfd('0x50')]);}})[_0x5dfd('0x1b')](respondWithStatusCode(_0x120e64,null))[_0x5dfd('0x2d')](handleError(_0x120e64,null));};exports['download']=function(_0x4b9fd8,_0x5eda72){var _0x1be556=moment()['unix']()[_0x5dfd('0x56')]();var _0x386ad6=path['join'](config[_0x5dfd('0x57')],_0x5dfd('0x58'),_0x5dfd('0x59'),'tmp');var _0x15f736=path[_0x5dfd('0x5a')](config[_0x5dfd('0x57')],_0x5dfd('0x58'),_0x5dfd('0x59'),'attachments');var _0x1be73f=path[_0x5dfd('0x5a')](_0x386ad6,_0x1be556);var _0x246d11=util[_0x5dfd('0x4b')](_0x5dfd('0x5b'),_0x4b9fd8[_0x5dfd('0x2f')]['id'],_0x1be556);var _0x238a9b=path[_0x5dfd('0x5a')](_0x386ad6,_0x246d11);var _0x218a1a=[];_0x218a1a[_0x5dfd('0x5c')]({'model':db[_0x5dfd('0x5d')],'as':_0x5dfd('0x5d'),'raw':!![]});var _0x30eb2f=[{'model':db['FaxMessage'],'as':_0x5dfd('0x5e'),'attributes':['id',_0x5dfd('0x3b'),'createdAt'],'include':_0x218a1a}];return db[_0x5dfd('0x24')][_0x5dfd('0x39')]({'where':{'id':_0x4b9fd8[_0x5dfd('0x2f')]['id']},'include':_0x30eb2f})[_0x5dfd('0x1b')](handleEntityNotFound(_0x5eda72,null))['then'](function(_0x27e402){if(_0x27e402&&_0x27e402['Messages']){var _0x567d5f=_0x27e402[_0x5dfd('0x5f')]({'plain':!![]});fs[_0x5dfd('0x60')](_0x1be73f);for(var _0x175afd=0x0;_0x175afd<_0x567d5f[_0x5dfd('0x5e')][_0x5dfd('0x41')];_0x175afd++){var _0x4c3568=_0x567d5f[_0x5dfd('0x5e')][_0x175afd][_0x5dfd('0x5d')];if(_0x4c3568){var _0x4bf864=path['join'](_0x15f736,_0x4c3568[_0x5dfd('0x61')]);if(fs[_0x5dfd('0x62')](_0x4bf864)){fs[_0x5dfd('0x63')](_0x4bf864)[_0x5dfd('0x64')](fs['createWriteStream'](path[_0x5dfd('0x5a')](_0x1be73f,_0x4c3568['basename'])));}}}return BPromise['resolve']()[_0x5dfd('0x1b')](function(){return new BPromise(function(_0x10e0c6,_0x3461d6){zipdir(_0x1be73f,{'saveTo':_0x238a9b},function(_0x17a82b,_0x47fba2){if(_0x17a82b)return _0x3461d6(_0x17a82b);return _0x10e0c6(_0x47fba2);});})[_0x5dfd('0x1b')](function(){return new BPromise(function(_0x2f8fcb,_0x127e19){rimraf(_0x1be73f,function(_0x22384f){if(_0x22384f)_0x127e19(_0x22384f);return _0x2f8fcb();});});})[_0x5dfd('0x1b')](function(){return _0x5eda72[_0x5dfd('0x65')](_0x238a9b,_0x246d11,function(_0x51ed94){if(_0x51ed94){console[_0x5dfd('0x66')](_0x5dfd('0x67'),_0x51ed94);}else{fs[_0x5dfd('0x68')](_0x238a9b);}});});});}else{return _0x5eda72['sendStatus'](0xc8);}})[_0x5dfd('0x2d')](handleError(_0x5eda72,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 742fe61..bed0b55 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 _0x3e3d=['Users','map','findAll','unreadMessages','length','emit','catch','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove','then','setDataValue'];(function(_0x49fac0,_0x1c6c82){var _0x59b597=function(_0x4ac46c){while(--_0x4ac46c){_0x49fac0['push'](_0x49fac0['shift']());}};_0x59b597(++_0x1c6c82);}(_0x3e3d,0x1c8));var _0xd3e3=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3e3d[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0xd3e3('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xd3e3('0x1'))['db'][_0xd3e3('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xd3e3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd3e3('0x4'),'afterDestroy':_0xd3e3('0x5')};function emitEvent(_0x34f1f0){return function(_0x439c52,_0x490397,_0x6987a9){_0x439c52['getUsers']({'attributes':['id'],'raw':!![]})[_0xd3e3('0x6')](function(_0x2c2572){_0x439c52[_0xd3e3('0x7')](_0xd3e3('0x8'),_0x2c2572[_0xd3e3('0x9')](function(_0x143644){return{'id':_0x143644['id']};}));return FaxMessage[_0xd3e3('0xa')]({'where':{'FaxInteractionId':_0x439c52['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd3e3('0x6')](function(_0x1e90de){_0x439c52['setDataValue'](_0xd3e3('0xb'),_0x1e90de[_0xd3e3('0xc')]);FaxInteractionEvents[_0xd3e3('0xd')](_0x34f1f0+':'+_0x439c52['id'],_0x439c52);FaxInteractionEvents[_0xd3e3('0xd')](_0x34f1f0,_0x439c52);_0x6987a9(null);})[_0xd3e3('0xe')](_0x6987a9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xd3e3('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x6f80=['catch','hasOwnProperty','exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length'];(function(_0x4e76d8,_0x85e650){var _0x340fb6=function(_0x33118e){while(--_0x33118e){_0x4e76d8['push'](_0x4e76d8['shift']());}};_0x340fb6(++_0x85e650);}(_0x6f80,0x7a));var _0x06f8=function(_0x1b5639,_0x2475dc){_0x1b5639=_0x1b5639-0x0;var _0x3f6bcf=_0x6f80[_0x1b5639];return _0x3f6bcf;};'use strict';var EventEmitter=require(_0x06f8('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x06f8('0x1')];var FaxMessage=require(_0x06f8('0x2'))['db'][_0x06f8('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x06f8('0x4')](0x0);var events={'afterCreate':_0x06f8('0x5'),'afterUpdate':'update','afterDestroy':_0x06f8('0x6')};function emitEvent(_0x390711){return function(_0x5c0466,_0x56c7d9,_0x299e20){_0x5c0466[_0x06f8('0x7')]({'attributes':['id'],'raw':!![]})[_0x06f8('0x8')](function(_0x48b4f7){_0x5c0466[_0x06f8('0x9')](_0x06f8('0xa'),_0x48b4f7['map'](function(_0x406c20){return{'id':_0x406c20['id']};}));return FaxMessage[_0x06f8('0xb')]({'where':{'FaxInteractionId':_0x5c0466['id'],'direction':'in','read':![]},'raw':!![]});})[_0x06f8('0x8')](function(_0x1a8ff2){_0x5c0466['setDataValue'](_0x06f8('0xc'),_0x1a8ff2[_0x06f8('0xd')]);FaxInteractionEvents['emit'](_0x390711+':'+_0x5c0466['id'],_0x5c0466);FaxInteractionEvents['emit'](_0x390711,_0x5c0466);_0x299e20(null);})[_0x06f8('0xe')](_0x299e20(null));};}for(var e in events){if(events[_0x06f8('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x06f8('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 6771ca9..6cafa0d 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 _0x8fd4=['./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x8fd4,0x178));var _0x48fd=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x8fd4[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var util=require(_0x48fd('0x0'));var logger=require(_0x48fd('0x1'))(_0x48fd('0x2'));var moment=require(_0x48fd('0x3'));var BPromise=require(_0x48fd('0x4'));var rp=require(_0x48fd('0x5'));var fs=require('fs');var path=require(_0x48fd('0x6'));var rimraf=require('rimraf');var config=require(_0x48fd('0x7'));var attributes=require(_0x48fd('0x8'));module['exports']=function(_0x2b7864,_0x1d3c43){return _0x2b7864[_0x48fd('0x9')](_0x48fd('0xa'),attributes,{'tableName':_0x48fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x344f0d,_0x46bd0b,_0x1cfef7){if(_0x344f0d[_0x48fd('0xc')](_0x48fd('0xd'))){_0x344f0d[_0x48fd('0xe')]=moment()['format'](_0x48fd('0xf'));}_0x1cfef7(null,_0x344f0d);}}});}; \ No newline at end of file +var _0xd86f=['define','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','exports'];(function(_0x4c6f33,_0x17f272){var _0xed3711=function(_0x1139c1){while(--_0x1139c1){_0x4c6f33['push'](_0x4c6f33['shift']());}};_0xed3711(++_0x17f272);}(_0xd86f,0x180));var _0xfd86=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd86f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xfd86('0x0'));var util=require(_0xfd86('0x1'));var logger=require(_0xfd86('0x2'))(_0xfd86('0x3'));var moment=require(_0xfd86('0x4'));var BPromise=require(_0xfd86('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd86('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0xfd86('0x7')]=function(_0x4192c6,_0xc6094a){return _0x4192c6[_0xfd86('0x8')]('FaxInteraction',attributes,{'tableName':_0xfd86('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x599568,_0x4b5351,_0x15862f){if(_0x599568[_0xfd86('0xa')](_0xfd86('0xb'))){_0x599568[_0xfd86('0xc')]=moment()['format'](_0xfd86('0xd'));}_0x15862f(null,_0x599568);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 456739a..36fec8e 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 _0x550d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateFaxInteraction','update','body','raw','options','where','attributes','limit','FaxInteraction','find','addTags','ids','spread','AddTags','util','bluebird','randomstring'];(function(_0x5a985b,_0x52474d){var _0xa42159=function(_0x954724){while(--_0x954724){_0x5a985b['push'](_0x5a985b['shift']());}};_0xa42159(++_0x52474d);}(_0x550d,0x14d));var _0xd550=function(_0x27356c,_0x1d83c){_0x27356c=_0x27356c-0x0;var _0x502994=_0x550d[_0x27356c];return _0x502994;};'use strict';var _=require('lodash');var util=require(_0xd550('0x0'));var moment=require('moment');var BPromise=require(_0xd550('0x1'));var rs=require(_0xd550('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd550('0x3'))['db'];var utils=require(_0xd550('0x4'));var logger=require(_0xd550('0x5'))(_0xd550('0x6'));var config=require(_0xd550('0x7'));var jayson=require(_0xd550('0x8'));var client=jayson[_0xd550('0x9')][_0xd550('0xa')]({'port':0x232a});config[_0xd550('0xb')]=_['defaults'](config[_0xd550('0xb')],{'host':_0xd550('0xc'),'port':0x18eb});var socket=require(_0xd550('0xd'))(new Redis(config[_0xd550('0xb')]));require(_0xd550('0xe'))[_0xd550('0xf')](socket);function respondWithRpcPromise(_0x23afea,_0x13703e,_0x2fcb52){return new BPromise(function(_0x337e8d,_0x5d7354){return client[_0xd550('0x10')](_0x23afea,_0x2fcb52)[_0xd550('0x11')](function(_0x1f4795){logger['info'](_0xd550('0x12'),_0x13703e,_0xd550('0x13'));logger[_0xd550('0x14')](_0xd550('0x15'),_0x13703e,_0xd550('0x13'),JSON[_0xd550('0x16')](_0x1f4795));if(_0x1f4795[_0xd550('0x17')]){if(_0x1f4795[_0xd550('0x17')]['code']===0x1f4){logger['error'](_0xd550('0x12'),_0x13703e,_0x1f4795[_0xd550('0x17')][_0xd550('0x18')]);return _0x5d7354(_0x1f4795[_0xd550('0x17')][_0xd550('0x18')]);}logger[_0xd550('0x17')](_0xd550('0x12'),_0x13703e,_0x1f4795[_0xd550('0x17')][_0xd550('0x18')]);return _0x337e8d(_0x1f4795[_0xd550('0x17')][_0xd550('0x18')]);}else{logger[_0xd550('0x19')](_0xd550('0x12'),_0x13703e,'request\x20sent');_0x337e8d(_0x1f4795[_0xd550('0x1a')][_0xd550('0x18')]);}})[_0xd550('0x1b')](function(_0x5bb0d8){logger[_0xd550('0x17')](_0xd550('0x12'),_0x13703e,_0x5bb0d8);_0x5d7354(_0x5bb0d8);});});}exports[_0xd550('0x1c')]=function(_0x14b8f3){var _0x26c2e7=this;return new Promise(function(_0x31f357,_0x8a20ef){return db['FaxInteraction'][_0xd550('0x1d')](_0x14b8f3[_0xd550('0x1e')],{'raw':_0x14b8f3['options']?_0x14b8f3['options'][_0xd550('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14b8f3['options']?_0x14b8f3[_0xd550('0x20')][_0xd550('0x21')]||null:null,'attributes':_0x14b8f3[_0xd550('0x20')]?_0x14b8f3[_0xd550('0x20')][_0xd550('0x22')]||null:null,'limit':_0x14b8f3[_0xd550('0x20')]?_0x14b8f3[_0xd550('0x20')][_0xd550('0x23')]||null:null})['then'](function(_0x94827e){logger[_0xd550('0x19')](_0xd550('0x1c'),_0x14b8f3);logger['debug'](_0xd550('0x1c'),_0x14b8f3,JSON[_0xd550('0x16')](_0x94827e));_0x31f357(_0x94827e);})['catch'](function(_0x235f2b){logger[_0xd550('0x17')](_0xd550('0x1c'),_0x235f2b['message'],_0x14b8f3);_0x8a20ef(_0x26c2e7[_0xd550('0x17')](0x1f4,_0x235f2b['message']));});});};exports['AddTagsToFaxInteraction']=function(_0xc067fa){return new Promise(function(_0x23f79b,_0x1c57da){return db[_0xd550('0x24')][_0xd550('0x25')]({'where':_0xc067fa[_0xd550('0x20')]?_0xc067fa[_0xd550('0x20')][_0xd550('0x21')]||null:null})['then'](function(_0x23ad9a){if(_0x23ad9a){return _0x23ad9a[_0xd550('0x26')](_0xc067fa[_0xd550('0x1e')][_0xd550('0x27')],_['omit'](_0xc067fa[_0xd550('0x1e')],[_0xd550('0x27'),'id'])||{});}})[_0xd550('0x28')](function(_0x46d5d2){logger[_0xd550('0x19')](_0xd550('0x29'),_0xc067fa);logger[_0xd550('0x14')]('AddTags',_0xc067fa,JSON[_0xd550('0x16')](_0x46d5d2));_0x23f79b(_0x46d5d2);})['catch'](function(_0x1df35a){logger[_0xd550('0x17')](_0xd550('0x29'),_0x1df35a[_0xd550('0x18')],_0xc067fa);_0x1c57da(_this[_0xd550('0x17')](0x1f4,_0x1df35a[_0xd550('0x18')]));});});}; \ No newline at end of file +var _0x4cf6=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','catch','UpdateFaxInteraction','update','body','options','where','attributes','limit','debug','stringify','AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0x4cf6,0x77));var _0x64cf=function(_0x349a5f,_0x547038){_0x349a5f=_0x349a5f-0x0;var _0x404c1a=_0x4cf6[_0x349a5f];return _0x404c1a;};'use strict';var _=require(_0x64cf('0x0'));var util=require(_0x64cf('0x1'));var moment=require(_0x64cf('0x2'));var BPromise=require(_0x64cf('0x3'));var rs=require(_0x64cf('0x4'));var fs=require('fs');var Redis=require(_0x64cf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x64cf('0x6'));var logger=require(_0x64cf('0x7'))('rpc');var config=require(_0x64cf('0x8'));var jayson=require(_0x64cf('0x9'));var client=jayson[_0x64cf('0xa')][_0x64cf('0xb')]({'port':0x232a});config[_0x64cf('0xc')]=_['defaults'](config[_0x64cf('0xc')],{'host':_0x64cf('0xd'),'port':0x18eb});var socket=require(_0x64cf('0xe'))(new Redis(config[_0x64cf('0xc')]));require(_0x64cf('0xf'))[_0x64cf('0x10')](socket);function respondWithRpcPromise(_0x4b8178,_0x4a1ccb,_0x2266ba){return new BPromise(function(_0x487aa7,_0xc4a449){return client['request'](_0x4b8178,_0x2266ba)[_0x64cf('0x11')](function(_0x2c8135){logger[_0x64cf('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x4a1ccb,_0x64cf('0x13'));logger['debug'](_0x64cf('0x14'),_0x4a1ccb,_0x64cf('0x13'),JSON['stringify'](_0x2c8135));if(_0x2c8135[_0x64cf('0x15')]){if(_0x2c8135[_0x64cf('0x15')][_0x64cf('0x16')]===0x1f4){logger[_0x64cf('0x15')](_0x64cf('0x17'),_0x4a1ccb,_0x2c8135[_0x64cf('0x15')][_0x64cf('0x18')]);return _0xc4a449(_0x2c8135['error'][_0x64cf('0x18')]);}logger['error'](_0x64cf('0x17'),_0x4a1ccb,_0x2c8135[_0x64cf('0x15')][_0x64cf('0x18')]);return _0x487aa7(_0x2c8135[_0x64cf('0x15')][_0x64cf('0x18')]);}else{logger[_0x64cf('0x12')](_0x64cf('0x17'),_0x4a1ccb,_0x64cf('0x13'));_0x487aa7(_0x2c8135['result'][_0x64cf('0x18')]);}})[_0x64cf('0x19')](function(_0xabcb84){logger[_0x64cf('0x15')](_0x64cf('0x17'),_0x4a1ccb,_0xabcb84);_0xc4a449(_0xabcb84);});});}exports[_0x64cf('0x1a')]=function(_0x10bbdc){var _0x4ef02c=this;return new Promise(function(_0x398bc5,_0x581ee0){return db['FaxInteraction'][_0x64cf('0x1b')](_0x10bbdc[_0x64cf('0x1c')],{'raw':_0x10bbdc[_0x64cf('0x1d')]?_0x10bbdc[_0x64cf('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10bbdc[_0x64cf('0x1d')]?_0x10bbdc[_0x64cf('0x1d')][_0x64cf('0x1e')]||null:null,'attributes':_0x10bbdc[_0x64cf('0x1d')]?_0x10bbdc[_0x64cf('0x1d')][_0x64cf('0x1f')]||null:null,'limit':_0x10bbdc['options']?_0x10bbdc[_0x64cf('0x1d')][_0x64cf('0x20')]||null:null})[_0x64cf('0x11')](function(_0x15da5c){logger[_0x64cf('0x12')](_0x64cf('0x1a'),_0x10bbdc);logger[_0x64cf('0x21')]('UpdateFaxInteraction',_0x10bbdc,JSON[_0x64cf('0x22')](_0x15da5c));_0x398bc5(_0x15da5c);})[_0x64cf('0x19')](function(_0x3ded19){logger[_0x64cf('0x15')](_0x64cf('0x1a'),_0x3ded19['message'],_0x10bbdc);_0x581ee0(_0x4ef02c[_0x64cf('0x15')](0x1f4,_0x3ded19[_0x64cf('0x18')]));});});};exports[_0x64cf('0x23')]=function(_0x4e0b52){return new Promise(function(_0x3a7f8c,_0x3d2d88){return db[_0x64cf('0x24')]['find']({'where':_0x4e0b52[_0x64cf('0x1d')]?_0x4e0b52[_0x64cf('0x1d')][_0x64cf('0x1e')]||null:null})[_0x64cf('0x11')](function(_0x194ff8){if(_0x194ff8){return _0x194ff8[_0x64cf('0x25')](_0x4e0b52[_0x64cf('0x1c')][_0x64cf('0x26')],_[_0x64cf('0x27')](_0x4e0b52[_0x64cf('0x1c')],['ids','id'])||{});}})[_0x64cf('0x28')](function(_0x5f081e){logger[_0x64cf('0x12')](_0x64cf('0x29'),_0x4e0b52);logger[_0x64cf('0x21')](_0x64cf('0x29'),_0x4e0b52,JSON[_0x64cf('0x22')](_0x5f081e));_0x3a7f8c(_0x5f081e);})[_0x64cf('0x19')](function(_0x51c2e1){logger[_0x64cf('0x15')]('AddTags',_0x51c2e1['message'],_0x4e0b52);_0x3d2d88(_this[_0x64cf('0x15')](0x1f4,_0x51c2e1[_0x64cf('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d79f060..f3bdb11 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 _0x60f9=['./faxInteraction.events','save','remove','update','register','faxInteraction:'];(function(_0x8e7cc2,_0x31abf3){var _0x252b8f=function(_0x44c9df){while(--_0x44c9df){_0x8e7cc2['push'](_0x8e7cc2['shift']());}};_0x252b8f(++_0x31abf3);}(_0x60f9,0xde));var _0x960f=function(_0x28742a,_0x1d9a25){_0x28742a=_0x28742a-0x0;var _0x4b661e=_0x60f9[_0x28742a];return _0x4b661e;};'use strict';var FaxInteractionEvents=require(_0x960f('0x0'));var events=[_0x960f('0x1'),_0x960f('0x2'),_0x960f('0x3')];function createListener(_0x4476a4,_0x18b598){return function(_0x3c3f44){_0x18b598['emit'](_0x4476a4,_0x3c3f44);};}function removeListener(_0x212a83,_0x35a181){return function(){FaxInteractionEvents['removeListener'](_0x212a83,_0x35a181);};}exports[_0x960f('0x4')]=function(_0x40948e){for(var _0x5cff58=0x0,_0x2bc547=events['length'];_0x5cff58<_0x2bc547;_0x5cff58++){var _0x5a54a6=events[_0x5cff58];var _0x118ce1=createListener(_0x960f('0x5')+_0x5a54a6,_0x40948e);FaxInteractionEvents['on'](_0x5a54a6,_0x118ce1);}}; \ No newline at end of file +var _0x4ce6=['save','remove','update','emit','register','./faxInteraction.events'];(function(_0x47894f,_0x1d322c){var _0x273c9b=function(_0xeae052){while(--_0xeae052){_0x47894f['push'](_0x47894f['shift']());}};_0x273c9b(++_0x1d322c);}(_0x4ce6,0x83));var _0x64ce=function(_0x77d286,_0x1ddc6d){_0x77d286=_0x77d286-0x0;var _0x5446a5=_0x4ce6[_0x77d286];return _0x5446a5;};'use strict';var FaxInteractionEvents=require(_0x64ce('0x0'));var events=[_0x64ce('0x1'),_0x64ce('0x2'),_0x64ce('0x3')];function createListener(_0xe7080d,_0x28d6f0){return function(_0x154998){_0x28d6f0[_0x64ce('0x4')](_0xe7080d,_0x154998);};}function removeListener(_0x4e3301,_0x3ec73e){return function(){FaxInteractionEvents['removeListener'](_0x4e3301,_0x3ec73e);};}exports[_0x64ce('0x5')]=function(_0x2ddb1c){for(var _0x4e59d8=0x0,_0xe223ae=events['length'];_0x4e59d8<_0xe223ae;_0x4e59d8++){var _0x43cb62=events[_0x4e59d8];var _0x5cbaa8=createListener('faxInteraction:'+_0x43cb62,_0x2ddb1c);FaxInteractionEvents['on'](_0x43cb62,_0x5cbaa8);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index a21c217..5a259ca 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 _0x242e=['/describe','describe','/:id','show','/:id/messages','/:id/download','post','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','fax','faxinteraction:update','delete','faxinteraction:destroy','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x23a49a,_0x45fd99){var _0x2e0cb8=function(_0x11a7e4){while(--_0x11a7e4){_0x23a49a['push'](_0x23a49a['shift']());}};_0x2e0cb8(++_0x45fd99);}(_0x242e,0x12a));var _0xe242=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x242e[_0x2be8c2];return _0x97f531;};'use strict';var multer=require('multer');var util=require(_0xe242('0x0'));var path=require(_0xe242('0x1'));var timeout=require('connect-timeout');var express=require(_0xe242('0x2'));var router=express[_0xe242('0x3')]();var fs_extra=require(_0xe242('0x4'));var auth=require(_0xe242('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe242('0x6'));var controller=require('./faxInteraction.controller');router[_0xe242('0x7')]('/',auth[_0xe242('0x8')](),controller[_0xe242('0x9')]);router[_0xe242('0x7')](_0xe242('0xa'),auth[_0xe242('0x8')](),controller[_0xe242('0xb')]);router['get'](_0xe242('0xc'),auth[_0xe242('0x8')](),controller[_0xe242('0xd')]);router[_0xe242('0x7')](_0xe242('0xe'),auth[_0xe242('0x8')](),controller['getMessages']);router['get'](_0xe242('0xf'),auth[_0xe242('0x8')](),controller['download']);router[_0xe242('0x10')]('/',auth[_0xe242('0x8')](),controller['create']);router['post'](_0xe242('0xe'),auth[_0xe242('0x8')](),controller[_0xe242('0x11')]);router[_0xe242('0x10')](_0xe242('0x12'),auth[_0xe242('0x8')](),interaction[_0xe242('0x13')]('fax',_0xe242('0x14')),controller[_0xe242('0x15')]);router['put'](_0xe242('0xc'),auth[_0xe242('0x8')](),interaction['tracked'](_0xe242('0x16'),_0xe242('0x17')),controller['update']);router[_0xe242('0x18')](_0xe242('0xc'),auth['isAuthenticated'](),interaction[_0xe242('0x13')](_0xe242('0x16'),_0xe242('0x19')),controller[_0xe242('0x1a')]);router['delete'](_0xe242('0x12'),auth[_0xe242('0x8')](),controller['removeTags']);module[_0xe242('0x1b')]=router; \ No newline at end of file +var _0x0b6b=['update','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxInteraction.controller','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','faxinteraction:addtags','addTags','put','tracked','fax','faxinteraction:update'];(function(_0x51a819,_0x1756cd){var _0x4a3747=function(_0x8697e4){while(--_0x8697e4){_0x51a819['push'](_0x51a819['shift']());}};_0x4a3747(++_0x1756cd);}(_0x0b6b,0xdf));var _0xb0b6=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x0b6b[_0x5c2e3e];return _0x53f64a;};'use strict';var multer=require(_0xb0b6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb0b6('0x1'));var express=require(_0xb0b6('0x2'));var router=express[_0xb0b6('0x3')]();var fs_extra=require(_0xb0b6('0x4'));var auth=require(_0xb0b6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb0b6('0x6'));router['get']('/',auth[_0xb0b6('0x7')](),controller[_0xb0b6('0x8')]);router[_0xb0b6('0x9')]('/describe',auth[_0xb0b6('0x7')](),controller[_0xb0b6('0xa')]);router[_0xb0b6('0x9')](_0xb0b6('0xb'),auth[_0xb0b6('0x7')](),controller[_0xb0b6('0xc')]);router[_0xb0b6('0x9')](_0xb0b6('0xd'),auth[_0xb0b6('0x7')](),controller[_0xb0b6('0xe')]);router[_0xb0b6('0x9')](_0xb0b6('0xf'),auth[_0xb0b6('0x7')](),controller[_0xb0b6('0x10')]);router[_0xb0b6('0x11')]('/',auth[_0xb0b6('0x7')](),controller[_0xb0b6('0x12')]);router[_0xb0b6('0x11')](_0xb0b6('0xd'),auth[_0xb0b6('0x7')](),controller['addMessage']);router[_0xb0b6('0x11')]('/:id/tags',auth[_0xb0b6('0x7')](),interaction['tracked']('fax',_0xb0b6('0x13')),controller[_0xb0b6('0x14')]);router[_0xb0b6('0x15')]('/:id',auth[_0xb0b6('0x7')](),interaction[_0xb0b6('0x16')](_0xb0b6('0x17'),_0xb0b6('0x18')),controller[_0xb0b6('0x19')]);router['delete']('/:id',auth[_0xb0b6('0x7')](),interaction['tracked'](_0xb0b6('0x17'),_0xb0b6('0x1a')),controller[_0xb0b6('0x1b')]);router['delete'](_0xb0b6('0x1c'),auth[_0xb0b6('0x7')](),controller[_0xb0b6('0x1d')]);module[_0xb0b6('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 95c141d..4e09ae6 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 _0x3d6d=['ENUM','out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x1faaa1,_0x1568dd){var _0x994ec=function(_0x298ef4){while(--_0x298ef4){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x994ec(++_0x1568dd);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x52ab8a,_0xee034b){_0x52ab8a=_0x52ab8a-0x0;var _0x5d6ddc=_0x3d6d[_0x52ab8a];return _0x5d6ddc;};'use strict';var Sequelize=require(_0xd3d6('0x0'));module[_0xd3d6('0x1')]={'body':{'type':Sequelize[_0xd3d6('0x2')](_0xd3d6('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd3d6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd3d6('0x5')]('in',_0xd3d6('0x6')),'defaultValue':_0xd3d6('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xd3d6('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xd3d6('0x7')]}}; \ No newline at end of file +var _0xea89=['BOOLEAN','out','sequelize','exports','TEXT','medium'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xea89,0x1e2));var _0x9ea8=function(_0x1af07b,_0x1aa449){_0x1af07b=_0x1af07b-0x0;var _0x300ad6=_0xea89[_0x1af07b];return _0x300ad6;};'use strict';var Sequelize=require(_0x9ea8('0x0'));module[_0x9ea8('0x1')]={'body':{'type':Sequelize[_0x9ea8('0x2')](_0x9ea8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9ea8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9ea8('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x9ea8('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index c0b19af..39c8480 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 _0xae36=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','http','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','sendStatus','offset','limit','undefined','count','set','json','apply','save','end','name','status','send','index','map','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','FaxMessage','includeAll','include','rows','show','params','options','find','catch','update','body','destroy','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','Sequelize','interface','create','CmContact','Attachment','AttachmentId','isNil','FaxAccountId','basename','download','join','root','files','attachments','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x41b6ff,_0x55349a){var _0x682188=function(_0xc7db79){while(--_0xc7db79){_0x41b6ff['push'](_0x41b6ff['shift']());}};_0x682188(++_0x55349a);}(_0xae36,0x1a9));var _0x6ae3=function(_0x24ca67,_0x3edf7a){_0x24ca67=_0x24ca67-0x0;var _0x40a9ac=_0xae36[_0x24ca67];return _0x40a9ac;};'use strict';var emlformat=require(_0x6ae3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ae3('0x1'));var jsonpatch=require(_0x6ae3('0x2'));var rp=require(_0x6ae3('0x3'));var moment=require(_0x6ae3('0x4'));var BPromise=require(_0x6ae3('0x5'));var Mustache=require(_0x6ae3('0x6'));var util=require(_0x6ae3('0x7'));var path=require(_0x6ae3('0x8'));var sox=require(_0x6ae3('0x9'));var csv=require(_0x6ae3('0xa'));var ejs=require(_0x6ae3('0xb'));var fs=require('fs');var fs_extra=require(_0x6ae3('0xc'));var _=require(_0x6ae3('0xd'));var squel=require(_0x6ae3('0xe'));var crypto=require(_0x6ae3('0xf'));var jsforce=require(_0x6ae3('0x10'));var deskjs=require(_0x6ae3('0x11'));var toCsv=require(_0x6ae3('0xa'));var querystring=require(_0x6ae3('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6ae3('0x13'));var qs=require(_0x6ae3('0x14'));var as=require(_0x6ae3('0x15'));var hardwareService=require(_0x6ae3('0x16'));var logger=require(_0x6ae3('0x17'))(_0x6ae3('0x18'));var utils=require(_0x6ae3('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x6ae3('0x1a'));var db=require(_0x6ae3('0x1b'))['db'];config[_0x6ae3('0x1c')]=_[_0x6ae3('0x1d')](config[_0x6ae3('0x1c')],{'host':_0x6ae3('0x1e'),'port':0x18eb});var socket=require(_0x6ae3('0x1f'))(new Redis(config[_0x6ae3('0x1c')]));require(_0x6ae3('0x20'))[_0x6ae3('0x21')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x6ae3('0x22')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44a166,_0x28a60c,_0x557db0,_0x193046){return new BPromise(function(_0x13b31d,_0x227a2a){var _0x1ad91d=_0x193046||client;return _0x1ad91d[_0x6ae3('0x23')](_0x44a166,_0x557db0)[_0x6ae3('0x24')](function(_0x55a758){logger[_0x6ae3('0x25')]('FaxMessage,\x20%s,\x20%s',_0x28a60c,_0x6ae3('0x26'));logger['debug'](_0x6ae3('0x27'),_0x28a60c,_0x6ae3('0x26'),JSON[_0x6ae3('0x28')](_0x55a758));if(_0x55a758['error']){if(_0x55a758[_0x6ae3('0x29')][_0x6ae3('0x2a')]===0x1f4){logger[_0x6ae3('0x29')]('FaxMessage,\x20%s,\x20%s',_0x28a60c,_0x55a758[_0x6ae3('0x29')][_0x6ae3('0x2b')]);return _0x227a2a(_0x55a758[_0x6ae3('0x29')][_0x6ae3('0x2b')]);}logger[_0x6ae3('0x29')](_0x6ae3('0x2c'),_0x28a60c,_0x55a758[_0x6ae3('0x29')]['message']);return _0x13b31d(_0x55a758['error'][_0x6ae3('0x2b')]);}else{logger[_0x6ae3('0x25')](_0x6ae3('0x2c'),_0x28a60c,_0x6ae3('0x26'));_0x13b31d(_0x55a758[_0x6ae3('0x2d')]['message']);}})['catch'](function(_0x21adbe){logger[_0x6ae3('0x29')](_0x6ae3('0x2c'),_0x28a60c,_0x21adbe);_0x227a2a(_0x21adbe);});});}function respondWithStatusCode(_0x46ab19,_0x3f5f3b){_0x3f5f3b=_0x3f5f3b||0xcc;return function(_0x5e0a96){if(_0x5e0a96){return _0x46ab19[_0x6ae3('0x2e')](_0x3f5f3b);}return _0x46ab19['status'](_0x3f5f3b)['end']();};}function respondWithResult(_0xf84f73,_0x525773){_0x525773=_0x525773||0xc8;return function(_0x36ddda){if(_0x36ddda){return _0xf84f73['status'](_0x525773)['json'](_0x36ddda);}};}function respondWithFilteredResult(_0x9bdbba,_0x4576f9){return function(_0x1c7041){if(_0x1c7041){var _0x1f7059=typeof _0x4576f9[_0x6ae3('0x2f')]==='undefined'&&typeof _0x4576f9[_0x6ae3('0x30')]===_0x6ae3('0x31');var _0x11ae35=_0x1c7041[_0x6ae3('0x32')];var _0x2598a3=_0x1f7059?0x0:_0x4576f9[_0x6ae3('0x2f')];var _0x4691df=_0x1f7059?_0x1c7041['count']:_0x4576f9[_0x6ae3('0x2f')]+_0x4576f9[_0x6ae3('0x30')];var _0x5f173d;if(_0x4691df>=_0x11ae35){_0x4691df=_0x11ae35;_0x5f173d=0xc8;}else{_0x5f173d=0xce;}_0x9bdbba['status'](_0x5f173d);return _0x9bdbba[_0x6ae3('0x33')]('Content-Range',_0x2598a3+'-'+_0x4691df+'/'+_0x11ae35)[_0x6ae3('0x34')](_0x1c7041);}return null;};}function patchUpdates(_0x40e6a7){return function(_0x182731){try{jsonpatch[_0x6ae3('0x35')](_0x182731,_0x40e6a7,!![]);}catch(_0x36ad44){return BPromise['reject'](_0x36ad44);}return _0x182731[_0x6ae3('0x36')]();};}function saveUpdates(_0x44be4d,_0x4c3cec){return function(_0x43c9f0){if(_0x43c9f0){return _0x43c9f0['update'](_0x44be4d)[_0x6ae3('0x24')](function(_0x10cac9){return _0x10cac9;});}return null;};}function removeEntity(_0x4b8cad,_0x325fe9){return function(_0x34d940){if(_0x34d940){return _0x34d940['destroy']()[_0x6ae3('0x24')](function(){_0x4b8cad['status'](0xcc)[_0x6ae3('0x37')]();});}};}function handleEntityNotFound(_0x21b09b,_0x468c08){return function(_0xe7ed60){if(!_0xe7ed60){_0x21b09b[_0x6ae3('0x2e')](0x194);}return _0xe7ed60;};}function handleError(_0x45b3e0,_0x588c69){_0x588c69=_0x588c69||0x1f4;return function(_0xa516c9){logger[_0x6ae3('0x29')](_0xa516c9['stack']);if(_0xa516c9[_0x6ae3('0x38')]){delete _0xa516c9[_0x6ae3('0x38')];}_0x45b3e0[_0x6ae3('0x39')](_0x588c69)[_0x6ae3('0x3a')](_0xa516c9);};}exports[_0x6ae3('0x3b')]=function(_0x24c9dd,_0x30a677){var _0x3359e0={},_0x4a8b94={},_0x3cf770={'count':0x0,'rows':[]};var _0x49afbd=_[_0x6ae3('0x3c')](db['FaxMessage']['rawAttributes'],function(_0x44d444){return{'name':_0x44d444['fieldName'],'type':_0x44d444[_0x6ae3('0x3d')][_0x6ae3('0x3e')]};});_0x4a8b94[_0x6ae3('0x3f')]=_[_0x6ae3('0x3c')](_0x49afbd,_0x6ae3('0x38'));_0x4a8b94[_0x6ae3('0x40')]=_[_0x6ae3('0x41')](_0x24c9dd[_0x6ae3('0x40')]);_0x4a8b94['filters']=_[_0x6ae3('0x42')](_0x4a8b94['model'],_0x4a8b94[_0x6ae3('0x40')]);_0x3359e0[_0x6ae3('0x43')]=_[_0x6ae3('0x42')](_0x4a8b94[_0x6ae3('0x3f')],qs[_0x6ae3('0x44')](_0x24c9dd[_0x6ae3('0x40')][_0x6ae3('0x44')]));_0x3359e0[_0x6ae3('0x43')]=_0x3359e0[_0x6ae3('0x43')][_0x6ae3('0x45')]?_0x3359e0[_0x6ae3('0x43')]:_0x4a8b94[_0x6ae3('0x3f')];if(!_0x24c9dd['query'][_0x6ae3('0x46')](_0x6ae3('0x47'))){_0x3359e0[_0x6ae3('0x30')]=qs['limit'](_0x24c9dd['query']['limit']);_0x3359e0[_0x6ae3('0x2f')]=qs[_0x6ae3('0x2f')](_0x24c9dd[_0x6ae3('0x40')][_0x6ae3('0x2f')]);}_0x3359e0[_0x6ae3('0x48')]=qs[_0x6ae3('0x49')](_0x24c9dd[_0x6ae3('0x40')][_0x6ae3('0x49')]);_0x3359e0[_0x6ae3('0x4a')]=qs[_0x6ae3('0x4b')](_[_0x6ae3('0x4c')](_0x24c9dd[_0x6ae3('0x40')],_0x4a8b94[_0x6ae3('0x4b')]),_0x49afbd);if(_0x24c9dd[_0x6ae3('0x40')][_0x6ae3('0x4d')]){_0x3359e0[_0x6ae3('0x4a')]=_[_0x6ae3('0x4e')](_0x3359e0[_0x6ae3('0x4a')],{'$or':_['map'](_0x49afbd,function(_0x18a542){if(_0x18a542[_0x6ae3('0x3d')]!=='VIRTUAL'){var _0x478021={};_0x478021[_0x18a542[_0x6ae3('0x38')]]={'$like':'%'+_0x24c9dd[_0x6ae3('0x40')]['filter']+'%'};return _0x478021;}})});}_0x3359e0=_[_0x6ae3('0x4e')]({},_0x3359e0,_0x24c9dd['options']);var _0x6fd5c6={'where':_0x3359e0[_0x6ae3('0x4a')]};return db[_0x6ae3('0x4f')][_0x6ae3('0x32')](_0x6fd5c6)[_0x6ae3('0x24')](function(_0x11731d){_0x3cf770[_0x6ae3('0x32')]=_0x11731d;if(_0x24c9dd['query'][_0x6ae3('0x50')]){_0x3359e0[_0x6ae3('0x51')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x3359e0);})['then'](function(_0x1e4039){_0x3cf770[_0x6ae3('0x52')]=_0x1e4039;return _0x3cf770;})[_0x6ae3('0x24')](respondWithFilteredResult(_0x30a677,_0x3359e0))['catch'](handleError(_0x30a677,null));};exports[_0x6ae3('0x53')]=function(_0x3c1b4e,_0x179a3c){var _0x42a749={'raw':!![],'where':{'id':_0x3c1b4e[_0x6ae3('0x54')]['id']}},_0x25f1f7={};_0x25f1f7[_0x6ae3('0x3f')]=_[_0x6ae3('0x41')](db['FaxMessage']['rawAttributes']);_0x25f1f7['query']=_[_0x6ae3('0x41')](_0x3c1b4e['query']);_0x25f1f7['filters']=_[_0x6ae3('0x42')](_0x25f1f7[_0x6ae3('0x3f')],_0x25f1f7[_0x6ae3('0x40')]);_0x42a749['attributes']=_[_0x6ae3('0x42')](_0x25f1f7[_0x6ae3('0x3f')],qs[_0x6ae3('0x44')](_0x3c1b4e[_0x6ae3('0x40')][_0x6ae3('0x44')]));_0x42a749[_0x6ae3('0x43')]=_0x42a749[_0x6ae3('0x43')][_0x6ae3('0x45')]?_0x42a749[_0x6ae3('0x43')]:_0x25f1f7[_0x6ae3('0x3f')];if(_0x3c1b4e['query'][_0x6ae3('0x50')]){_0x42a749[_0x6ae3('0x51')]=[{'all':!![]}];}_0x42a749=_[_0x6ae3('0x4e')]({},_0x42a749,_0x3c1b4e[_0x6ae3('0x55')]);return db[_0x6ae3('0x4f')][_0x6ae3('0x56')](_0x42a749)[_0x6ae3('0x24')](handleEntityNotFound(_0x179a3c,null))['then'](respondWithResult(_0x179a3c,null))[_0x6ae3('0x57')](handleError(_0x179a3c,null));};exports[_0x6ae3('0x58')]=function(_0x33aaf8,_0x5682fa){if(_0x33aaf8[_0x6ae3('0x59')]['id']){delete _0x33aaf8['body']['id'];}return db['FaxMessage'][_0x6ae3('0x56')]({'where':{'id':_0x33aaf8['params']['id']}})[_0x6ae3('0x24')](handleEntityNotFound(_0x5682fa,null))['then'](saveUpdates(_0x33aaf8[_0x6ae3('0x59')],null))[_0x6ae3('0x24')](respondWithResult(_0x5682fa,null))['catch'](handleError(_0x5682fa,null));};exports[_0x6ae3('0x5a')]=function(_0xd10389,_0xd71b4){return db[_0x6ae3('0x4f')][_0x6ae3('0x56')]({'where':{'id':_0xd10389[_0x6ae3('0x54')]['id']}})[_0x6ae3('0x24')](handleEntityNotFound(_0xd71b4,null))[_0x6ae3('0x24')](removeEntity(_0xd71b4,null))['catch'](handleError(_0xd71b4,null));};exports[_0x6ae3('0x5b')]=function(_0x2538fa,_0x1337ed){return db[_0x6ae3('0x4f')][_0x6ae3('0x5b')]()[_0x6ae3('0x24')](respondWithResult(_0x1337ed,null))[_0x6ae3('0x57')](handleError(_0x1337ed,null));};var interaction_log=require(_0x6ae3('0x17'))(_0x6ae3('0x5c'));exports[_0x6ae3('0x5d')]=function(_0x4f8792,_0x74452f,_0x12ba3b){var _0x774023={'agent':{},'channel':_0x6ae3('0x5e')};if(_0x4f8792[_0x6ae3('0x59')]['id']){delete _0x4f8792['body']['id'];}_0x4f8792[_0x6ae3('0x59')][_0x6ae3('0x5f')]=!![];_0x4f8792[_0x6ae3('0x59')][_0x6ae3('0x60')]=moment()[_0x6ae3('0x61')](_0x6ae3('0x62'));_0x4f8792[_0x6ae3('0x59')][_0x6ae3('0x63')]=_0x4f8792[_0x6ae3('0x59')][_0x6ae3('0x63')]||_0x4f8792[_0x6ae3('0x64')]['id'];_0x774023[_0x6ae3('0x65')]['id']=_0x4f8792[_0x6ae3('0x59')][_0x6ae3('0x63')];return db[_0x6ae3('0x4f')][_0x6ae3('0x56')]({'where':{'id':_0x4f8792[_0x6ae3('0x54')]['id'],'UserId':null}})[_0x6ae3('0x24')](handleEntityNotFound(_0x74452f,null))[_0x6ae3('0x24')](saveUpdates(_0x4f8792['body'],null))['then'](function(_0x302b7a){if(_0x302b7a){_0x774023[_0x6ae3('0x2b')]=_0x302b7a[_0x6ae3('0x66')]({'plain':!![]});return db[_0x6ae3('0x67')]['find']({'where':{'id':_0x302b7a[_0x6ae3('0x68')]}});}return null;})[_0x6ae3('0x24')](handleEntityNotFound(_0x74452f,null))[_0x6ae3('0x24')](function(_0x83a8ad){if(_0x83a8ad){return _0x83a8ad[_0x6ae3('0x58')]({'UserId':_0x4f8792[_0x6ae3('0x59')][_0x6ae3('0x63')],'read1stAt':_['isNil'](_0x83a8ad[_0x6ae3('0x69')])?moment()[_0x6ae3('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6ae3('0x24')](function(_0x4bfd74){if(_0x4bfd74){_0x774023[_0x6ae3('0x6a')]=_0x4bfd74['get']({'plain':!![]});interaction_log[_0x6ae3('0x25')](_0x6ae3('0x6b'),_0x4f8792[_0x6ae3('0x64')]['id'],_0x4f8792['user'][_0x6ae3('0x38')],_0x4f8792[_0x6ae3('0x64')]['role'],_0x774023[_0x6ae3('0x6a')]['id'],_0x4f8792[_0x6ae3('0x59')]?JSON[_0x6ae3('0x28')](_0x4f8792[_0x6ae3('0x59')]):'null');return respondWithRpcPromise(_0x6ae3('0x6c'),_0x6ae3('0x6d'),_0x774023);}return null;})[_0x6ae3('0x24')](function(_0x3e99f3){var _0x162f35=_0x6ae3('0x6e')+_0x3e99f3[_0x6ae3('0x2b')][_0x6ae3('0x6f')];return db[_0x6ae3('0x70')][_0x6ae3('0x40')](_0x162f35,{'type':db['Sequelize'][_0x6ae3('0x71')][_0x6ae3('0x72')],'raw':!![]})[_0x6ae3('0x24')](function(_0xbf44d7){return _0xbf44d7;});})['then'](function(_0x195685){if(_0x195685){_0x774023[_0x6ae3('0x2b')][_0x6ae3('0x73')]=_0x195685[0x0];if(!_0x4f8792[_0x6ae3('0x59')][_0x6ae3('0x63')])return;return db[_0x6ae3('0x74')][_0x6ae3('0x56')]({'where':{'id':_0x4f8792['body'][_0x6ae3('0x63')],'role':_0x6ae3('0x65')},'attributes':['id',_0x6ae3('0x38'),_0x6ae3('0x75'),_0x6ae3('0x76'),_0x6ae3('0x77')],'raw':!![]});}return null;})[_0x6ae3('0x24')](function(_0x28f166){if(!_0x28f166)return null;_0x774023[_0x6ae3('0x2b')]['agent']=_0x28f166;return _0x774023;})['then'](function(_0x1770a9){if(_0x1770a9){if(_0x4f8792[_0x6ae3('0x59')][_0x6ae3('0x78')]){_0x774023[_0x6ae3('0x2b')]['interface']=util['format'](_0x6ae3('0x79'),_0x4f8792[_0x6ae3('0x64')][_0x6ae3('0x38')]);_0x774023['message'][_0x6ae3('0x7a')]=_0x774023[_0x6ae3('0x7a')];_0x774023[_0x6ae3('0x2b')][_0x6ae3('0x7b')]=_0x774023['channel'];_0x774023[_0x6ae3('0x2b')][_0x6ae3('0x7c')]=_0x6ae3('0x5d');return respondWithRpcPromise(_0x6ae3('0x7d'),'EventManager',{'event':_0x6ae3('0x7e'),'message':_0x774023[_0x6ae3('0x2b')]},client9002)['then'](function(){return _0x774023;});}return _0x774023;}return null;})[_0x6ae3('0x24')](respondWithResult(_0x74452f,null))['catch'](handleError(_0x74452f,null));};var interaction_log=require(_0x6ae3('0x17'))(_0x6ae3('0x5c'));exports[_0x6ae3('0x7f')]=function(_0x36c135,_0x58e24f,_0x494d26){var _0x3d8d7e={'agent':{},'channel':'fax'};if(_0x36c135[_0x6ae3('0x59')]['id']){delete _0x36c135[_0x6ae3('0x59')]['id'];}_0x36c135['body'][_0x6ae3('0x63')]=_0x36c135['body'][_0x6ae3('0x63')]||_0x36c135[_0x6ae3('0x64')]['id'];_0x3d8d7e[_0x6ae3('0x65')]['id']=_0x36c135[_0x6ae3('0x59')][_0x6ae3('0x63')];return db[_0x6ae3('0x4f')][_0x6ae3('0x56')]({'where':{'id':_0x36c135[_0x6ae3('0x54')]['id'],'UserId':null}})[_0x6ae3('0x24')](handleEntityNotFound(_0x58e24f,null))[_0x6ae3('0x24')](function(_0x5af7bc){if(_0x5af7bc){_0x3d8d7e['message']=_0x5af7bc[_0x6ae3('0x66')]({'plain':!![]});return db[_0x6ae3('0x67')]['find']({'where':{'id':_0x5af7bc[_0x6ae3('0x68')]}});}return null;})[_0x6ae3('0x24')](handleEntityNotFound(_0x58e24f,null))[_0x6ae3('0x24')](function(_0x6d2307){if(_0x6d2307){_0x3d8d7e['interaction']=_0x6d2307[_0x6ae3('0x66')]({'plain':!![]});interaction_log[_0x6ae3('0x25')](_0x6ae3('0x80'),_0x36c135['user']['id'],_0x36c135[_0x6ae3('0x64')][_0x6ae3('0x38')],_0x36c135['user'][_0x6ae3('0x81')],_0x3d8d7e[_0x6ae3('0x6a')]['id'],_0x36c135[_0x6ae3('0x59')]?JSON[_0x6ae3('0x28')](_0x36c135[_0x6ae3('0x59')]):'null');return respondWithRpcPromise('RejectMessage',_0x6ae3('0x82'),_0x3d8d7e);}return null;})[_0x6ae3('0x24')](function(_0x534948){var _0x1288f1=_0x6ae3('0x6e')+_0x534948['message'][_0x6ae3('0x6f')];return db[_0x6ae3('0x70')][_0x6ae3('0x40')](_0x1288f1,{'type':db[_0x6ae3('0x83')][_0x6ae3('0x71')][_0x6ae3('0x72')],'raw':!![]})[_0x6ae3('0x24')](function(_0x245c54){return _0x245c54;});})[_0x6ae3('0x24')](function(_0x35ba0c){if(_0x35ba0c){_0x3d8d7e['message']['contact']=_0x35ba0c[0x0];if(!_0x36c135[_0x6ae3('0x59')][_0x6ae3('0x63')])return;return db[_0x6ae3('0x74')]['find']({'where':{'id':_0x36c135['body'][_0x6ae3('0x63')],'role':'agent'},'attributes':['id',_0x6ae3('0x38'),'fullname',_0x6ae3('0x76'),_0x6ae3('0x77')],'raw':!![]});}return null;})['then'](function(_0xce24bb){if(!_0xce24bb)return null;_0x3d8d7e[_0x6ae3('0x2b')][_0x6ae3('0x65')]=_0xce24bb;return _0x3d8d7e;})[_0x6ae3('0x24')](function(_0x5a1ba5){if(_0x5a1ba5){_0x5a1ba5['message'][_0x6ae3('0x84')]=util[_0x6ae3('0x61')]('SIP/%s',_0x36c135['user'][_0x6ae3('0x38')]);_0x5a1ba5['message'][_0x6ae3('0x7a')]=_0x3d8d7e[_0x6ae3('0x7a')];_0x5a1ba5[_0x6ae3('0x2b')][_0x6ae3('0x7b')]=_0x3d8d7e[_0x6ae3('0x7a')];_0x5a1ba5['message'][_0x6ae3('0x7c')]=_0x6ae3('0x7f');respondWithRpcPromise(_0x6ae3('0x7d'),'EventManager',{'event':'rejectmessage','message':_0x5a1ba5[_0x6ae3('0x2b')]},client9002);return _0x3d8d7e;}return null;})[_0x6ae3('0x24')](respondWithResult(_0x58e24f,null))[_0x6ae3('0x57')](handleError(_0x58e24f,null));};exports[_0x6ae3('0x85')]=function(_0x3216c2,_0x4418c9){var _0x1409be;return db['FaxMessage'][_0x6ae3('0x85')](_0x3216c2[_0x6ae3('0x59')],{})['then'](function(_0xa997e2){_0x1409be=_0xa997e2;return db[_0x6ae3('0x86')]['findOne']({'where':{'id':_0x1409be[_0x6ae3('0x6f')]}});})[_0x6ae3('0x24')](function(_0x3bd920){if(_['isNil'](_0x3bd920)){return;}else{_0x1409be[_0x6ae3('0x5e')]=_0x3bd920[_0x6ae3('0x5e')];return db[_0x6ae3('0x87')]['findOne']({'where':{'id':_0x1409be[_0x6ae3('0x88')]}});}})[_0x6ae3('0x24')](function(_0x156304){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x6ae3('0x89')](_0x3216c2[_0x6ae3('0x59')])?undefined:_0x3216c2[_0x6ae3('0x59')][_0x6ae3('0x8a')],'path':_[_0x6ae3('0x89')](_0x156304)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x156304[_0x6ae3('0x8b')]),'fax':_[_0x6ae3('0x89')](_0x1409be[_0x6ae3('0x5e')])?undefined:_0x1409be['fax'],'AttachmentId':_0x1409be[_0x6ae3('0x88')]},client9002);})['then'](respondWithResult(_0x4418c9,0xc9))[_0x6ae3('0x57')](handleError(_0x4418c9,null));};exports[_0x6ae3('0x8c')]=function(_0x44c1c5,_0x2dc905){var _0x2a848d=path[_0x6ae3('0x8d')](config[_0x6ae3('0x8e')],'server',_0x6ae3('0x8f'),_0x6ae3('0x90'));return db[_0x6ae3('0x4f')]['find']({'where':{'id':_0x44c1c5[_0x6ae3('0x54')]['id']},'include':[{'model':db[_0x6ae3('0x87')],'as':_0x6ae3('0x87')}]})[_0x6ae3('0x24')](handleEntityNotFound(_0x2dc905,null))[_0x6ae3('0x24')](function(_0x13c7da){if(_0x13c7da){return _0x2dc905[_0x6ae3('0x8c')](path[_0x6ae3('0x8d')](_0x2a848d,_0x13c7da['Attachment'][_0x6ae3('0x8b')]));}})[_0x6ae3('0x57')](handleError(_0x2dc905,null));}; \ No newline at end of file +var _0xe5f3=['include','findAll','show','params','keys','rawAttributes','find','body','describe','fax-interactions','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','FaxInteractionId','format','interaction','user','role','null','AcceptMessage','QueryTypes','email','internal','agent','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','ContactId','Sequelize','contact','fullname','event','rejectmessage','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','server','files','attachments','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','end','stack','name','map','FaxMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x82b1d4,_0x54ee9b){var _0x1afcee=function(_0x8cbfdd){while(--_0x8cbfdd){_0x82b1d4['push'](_0x82b1d4['shift']());}};_0x1afcee(++_0x54ee9b);}(_0xe5f3,0x1c5));var _0x3e5f=function(_0x5ed7a3,_0x13fbc4){_0x5ed7a3=_0x5ed7a3-0x0;var _0x2121fd=_0xe5f3[_0x5ed7a3];return _0x2121fd;};'use strict';var emlformat=require(_0x3e5f('0x0'));var rimraf=require(_0x3e5f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e5f('0x2'));var rp=require('request-promise');var moment=require(_0x3e5f('0x3'));var BPromise=require(_0x3e5f('0x4'));var Mustache=require(_0x3e5f('0x5'));var util=require(_0x3e5f('0x6'));var path=require('path');var sox=require(_0x3e5f('0x7'));var csv=require(_0x3e5f('0x8'));var ejs=require(_0x3e5f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e5f('0xa'));var squel=require(_0x3e5f('0xb'));var crypto=require(_0x3e5f('0xc'));var jsforce=require(_0x3e5f('0xd'));var deskjs=require(_0x3e5f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3e5f('0xf'));var Papa=require(_0x3e5f('0x10'));var Redis=require(_0x3e5f('0x11'));var authService=require(_0x3e5f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3e5f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e5f('0x14'))(_0x3e5f('0x15'));var utils=require(_0x3e5f('0x16'));var config=require(_0x3e5f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e5f('0x18'))['db'];config[_0x3e5f('0x19')]=_['defaults'](config[_0x3e5f('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e5f('0x1a'))(new Redis(config[_0x3e5f('0x19')]));require(_0x3e5f('0x1b'))['register'](socket);var jayson=require(_0x3e5f('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x3e5f('0x1d')][_0x3e5f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x18afb5,_0x211cd8,_0x42165f,_0x2467ca){return new BPromise(function(_0x5e7dbe,_0x462b2a){var _0x1b54cf=_0x2467ca||client;return _0x1b54cf[_0x3e5f('0x1f')](_0x18afb5,_0x42165f)[_0x3e5f('0x20')](function(_0x1b4c4b){logger[_0x3e5f('0x21')](_0x3e5f('0x22'),_0x211cd8,'request\x20sent');logger[_0x3e5f('0x23')](_0x3e5f('0x24'),_0x211cd8,_0x3e5f('0x25'),JSON[_0x3e5f('0x26')](_0x1b4c4b));if(_0x1b4c4b[_0x3e5f('0x27')]){if(_0x1b4c4b[_0x3e5f('0x27')][_0x3e5f('0x28')]===0x1f4){logger[_0x3e5f('0x27')](_0x3e5f('0x22'),_0x211cd8,_0x1b4c4b[_0x3e5f('0x27')][_0x3e5f('0x29')]);return _0x462b2a(_0x1b4c4b['error'][_0x3e5f('0x29')]);}logger[_0x3e5f('0x27')](_0x3e5f('0x22'),_0x211cd8,_0x1b4c4b[_0x3e5f('0x27')][_0x3e5f('0x29')]);return _0x5e7dbe(_0x1b4c4b[_0x3e5f('0x27')][_0x3e5f('0x29')]);}else{logger[_0x3e5f('0x21')](_0x3e5f('0x22'),_0x211cd8,'request\x20sent');_0x5e7dbe(_0x1b4c4b[_0x3e5f('0x2a')]['message']);}})[_0x3e5f('0x2b')](function(_0x4ddfef){logger[_0x3e5f('0x27')](_0x3e5f('0x22'),_0x211cd8,_0x4ddfef);_0x462b2a(_0x4ddfef);});});}function respondWithStatusCode(_0xefa52e,_0x44a544){_0x44a544=_0x44a544||0xcc;return function(_0x310188){if(_0x310188){return _0xefa52e[_0x3e5f('0x2c')](_0x44a544);}return _0xefa52e[_0x3e5f('0x2d')](_0x44a544)['end']();};}function respondWithResult(_0x13afc1,_0x486809){_0x486809=_0x486809||0xc8;return function(_0x2c614e){if(_0x2c614e){return _0x13afc1[_0x3e5f('0x2d')](_0x486809)[_0x3e5f('0x2e')](_0x2c614e);}};}function respondWithFilteredResult(_0x502d20,_0x249d65){return function(_0x203d9c){if(_0x203d9c){var _0x38d7fe=typeof _0x249d65['offset']===_0x3e5f('0x2f')&&typeof _0x249d65[_0x3e5f('0x30')]==='undefined';var _0x9d410=_0x203d9c[_0x3e5f('0x31')];var _0x4462b4=_0x38d7fe?0x0:_0x249d65[_0x3e5f('0x32')];var _0x2e2718=_0x38d7fe?_0x203d9c[_0x3e5f('0x31')]:_0x249d65[_0x3e5f('0x32')]+_0x249d65['limit'];var _0x4200b3;if(_0x2e2718>=_0x9d410){_0x2e2718=_0x9d410;_0x4200b3=0xc8;}else{_0x4200b3=0xce;}_0x502d20[_0x3e5f('0x2d')](_0x4200b3);return _0x502d20[_0x3e5f('0x33')](_0x3e5f('0x34'),_0x4462b4+'-'+_0x2e2718+'/'+_0x9d410)['json'](_0x203d9c);}return null;};}function patchUpdates(_0x1510fe){return function(_0x1061d5){try{jsonpatch['apply'](_0x1061d5,_0x1510fe,!![]);}catch(_0x8fd4e){return BPromise[_0x3e5f('0x35')](_0x8fd4e);}return _0x1061d5[_0x3e5f('0x36')]();};}function saveUpdates(_0x50abe7,_0x477b33){return function(_0x1bf879){if(_0x1bf879){return _0x1bf879[_0x3e5f('0x37')](_0x50abe7)['then'](function(_0x34324b){return _0x34324b;});}return null;};}function removeEntity(_0x20a7f3,_0x269603){return function(_0x2f3263){if(_0x2f3263){return _0x2f3263[_0x3e5f('0x38')]()['then'](function(){_0x20a7f3['status'](0xcc)[_0x3e5f('0x39')]();});}};}function handleEntityNotFound(_0x43ee09,_0x39bbd8){return function(_0x1600dc){if(!_0x1600dc){_0x43ee09[_0x3e5f('0x2c')](0x194);}return _0x1600dc;};}function handleError(_0x1853d8,_0x40e75f){_0x40e75f=_0x40e75f||0x1f4;return function(_0x501002){logger[_0x3e5f('0x27')](_0x501002[_0x3e5f('0x3a')]);if(_0x501002[_0x3e5f('0x3b')]){delete _0x501002[_0x3e5f('0x3b')];}_0x1853d8[_0x3e5f('0x2d')](_0x40e75f)['send'](_0x501002);};}exports['index']=function(_0x50af74,_0x2a70dd){var _0x4802d5={},_0xc7258={},_0x4dff55={'count':0x0,'rows':[]};var _0x1222bc=_[_0x3e5f('0x3c')](db[_0x3e5f('0x3d')]['rawAttributes'],function(_0x1d3327){return{'name':_0x1d3327[_0x3e5f('0x3e')],'type':_0x1d3327[_0x3e5f('0x3f')][_0x3e5f('0x40')]};});_0xc7258[_0x3e5f('0x41')]=_[_0x3e5f('0x3c')](_0x1222bc,'name');_0xc7258[_0x3e5f('0x42')]=_['keys'](_0x50af74[_0x3e5f('0x42')]);_0xc7258[_0x3e5f('0x43')]=_[_0x3e5f('0x44')](_0xc7258[_0x3e5f('0x41')],_0xc7258['query']);_0x4802d5[_0x3e5f('0x45')]=_['intersection'](_0xc7258[_0x3e5f('0x41')],qs[_0x3e5f('0x46')](_0x50af74[_0x3e5f('0x42')]['fields']));_0x4802d5[_0x3e5f('0x45')]=_0x4802d5[_0x3e5f('0x45')]['length']?_0x4802d5[_0x3e5f('0x45')]:_0xc7258[_0x3e5f('0x41')];if(!_0x50af74[_0x3e5f('0x42')]['hasOwnProperty']('nolimit')){_0x4802d5['limit']=qs[_0x3e5f('0x30')](_0x50af74[_0x3e5f('0x42')][_0x3e5f('0x30')]);_0x4802d5[_0x3e5f('0x32')]=qs[_0x3e5f('0x32')](_0x50af74[_0x3e5f('0x42')]['offset']);}_0x4802d5[_0x3e5f('0x47')]=qs[_0x3e5f('0x48')](_0x50af74['query'][_0x3e5f('0x48')]);_0x4802d5['where']=qs[_0x3e5f('0x43')](_['pick'](_0x50af74[_0x3e5f('0x42')],_0xc7258[_0x3e5f('0x43')]),_0x1222bc);if(_0x50af74[_0x3e5f('0x42')][_0x3e5f('0x49')]){_0x4802d5[_0x3e5f('0x4a')]=_[_0x3e5f('0x4b')](_0x4802d5['where'],{'$or':_[_0x3e5f('0x3c')](_0x1222bc,function(_0x2cb86d){if(_0x2cb86d[_0x3e5f('0x3f')]!==_0x3e5f('0x4c')){var _0x4ee72f={};_0x4ee72f[_0x2cb86d[_0x3e5f('0x3b')]]={'$like':'%'+_0x50af74[_0x3e5f('0x42')]['filter']+'%'};return _0x4ee72f;}})});}_0x4802d5=_[_0x3e5f('0x4b')]({},_0x4802d5,_0x50af74[_0x3e5f('0x4d')]);var _0x17d23c={'where':_0x4802d5[_0x3e5f('0x4a')]};return db[_0x3e5f('0x3d')]['count'](_0x17d23c)[_0x3e5f('0x20')](function(_0x2687b1){_0x4dff55[_0x3e5f('0x31')]=_0x2687b1;if(_0x50af74[_0x3e5f('0x42')][_0x3e5f('0x4e')]){_0x4802d5[_0x3e5f('0x4f')]=[{'all':!![]}];}return db[_0x3e5f('0x3d')][_0x3e5f('0x50')](_0x4802d5);})[_0x3e5f('0x20')](function(_0x14b4f8){_0x4dff55['rows']=_0x14b4f8;return _0x4dff55;})[_0x3e5f('0x20')](respondWithFilteredResult(_0x2a70dd,_0x4802d5))[_0x3e5f('0x2b')](handleError(_0x2a70dd,null));};exports[_0x3e5f('0x51')]=function(_0xce0520,_0x1318d2){var _0x58f00b={'raw':!![],'where':{'id':_0xce0520[_0x3e5f('0x52')]['id']}},_0x47befb={};_0x47befb[_0x3e5f('0x41')]=_[_0x3e5f('0x53')](db['FaxMessage'][_0x3e5f('0x54')]);_0x47befb[_0x3e5f('0x42')]=_[_0x3e5f('0x53')](_0xce0520[_0x3e5f('0x42')]);_0x47befb['filters']=_[_0x3e5f('0x44')](_0x47befb['model'],_0x47befb['query']);_0x58f00b['attributes']=_[_0x3e5f('0x44')](_0x47befb[_0x3e5f('0x41')],qs[_0x3e5f('0x46')](_0xce0520['query'][_0x3e5f('0x46')]));_0x58f00b[_0x3e5f('0x45')]=_0x58f00b[_0x3e5f('0x45')]['length']?_0x58f00b[_0x3e5f('0x45')]:_0x47befb[_0x3e5f('0x41')];if(_0xce0520[_0x3e5f('0x42')][_0x3e5f('0x4e')]){_0x58f00b[_0x3e5f('0x4f')]=[{'all':!![]}];}_0x58f00b=_[_0x3e5f('0x4b')]({},_0x58f00b,_0xce0520[_0x3e5f('0x4d')]);return db[_0x3e5f('0x3d')][_0x3e5f('0x55')](_0x58f00b)[_0x3e5f('0x20')](handleEntityNotFound(_0x1318d2,null))['then'](respondWithResult(_0x1318d2,null))[_0x3e5f('0x2b')](handleError(_0x1318d2,null));};exports[_0x3e5f('0x37')]=function(_0x59a99d,_0x41633e){if(_0x59a99d['body']['id']){delete _0x59a99d[_0x3e5f('0x56')]['id'];}return db[_0x3e5f('0x3d')]['find']({'where':{'id':_0x59a99d['params']['id']}})[_0x3e5f('0x20')](handleEntityNotFound(_0x41633e,null))['then'](saveUpdates(_0x59a99d[_0x3e5f('0x56')],null))['then'](respondWithResult(_0x41633e,null))['catch'](handleError(_0x41633e,null));};exports[_0x3e5f('0x38')]=function(_0x3d0c78,_0x29c99c){return db[_0x3e5f('0x3d')][_0x3e5f('0x55')]({'where':{'id':_0x3d0c78[_0x3e5f('0x52')]['id']}})[_0x3e5f('0x20')](handleEntityNotFound(_0x29c99c,null))['then'](removeEntity(_0x29c99c,null))[_0x3e5f('0x2b')](handleError(_0x29c99c,null));};exports[_0x3e5f('0x57')]=function(_0x353964,_0xf088b3){return db[_0x3e5f('0x3d')][_0x3e5f('0x57')]()['then'](respondWithResult(_0xf088b3,null))[_0x3e5f('0x2b')](handleError(_0xf088b3,null));};var interaction_log=require(_0x3e5f('0x14'))(_0x3e5f('0x58'));exports['accept']=function(_0xcaf84,_0x2e4438,_0x4cd3ee){var _0x1b87ca={'agent':{},'channel':'fax'};if(_0xcaf84[_0x3e5f('0x56')]['id']){delete _0xcaf84[_0x3e5f('0x56')]['id'];}_0xcaf84[_0x3e5f('0x56')]['read']=!![];_0xcaf84['body'][_0x3e5f('0x59')]=moment()['format'](_0x3e5f('0x5a'));_0xcaf84[_0x3e5f('0x56')]['UserId']=_0xcaf84[_0x3e5f('0x56')][_0x3e5f('0x5b')]||_0xcaf84['user']['id'];_0x1b87ca['agent']['id']=_0xcaf84[_0x3e5f('0x56')]['UserId'];return db['FaxMessage'][_0x3e5f('0x55')]({'where':{'id':_0xcaf84[_0x3e5f('0x52')]['id'],'UserId':null}})[_0x3e5f('0x20')](handleEntityNotFound(_0x2e4438,null))['then'](saveUpdates(_0xcaf84[_0x3e5f('0x56')],null))[_0x3e5f('0x20')](function(_0x47f7f7){if(_0x47f7f7){_0x1b87ca['message']=_0x47f7f7[_0x3e5f('0x5c')]({'plain':!![]});return db[_0x3e5f('0x5d')][_0x3e5f('0x55')]({'where':{'id':_0x47f7f7[_0x3e5f('0x5e')]}});}return null;})[_0x3e5f('0x20')](handleEntityNotFound(_0x2e4438,null))[_0x3e5f('0x20')](function(_0x47de57){if(_0x47de57){return _0x47de57['update']({'UserId':_0xcaf84[_0x3e5f('0x56')][_0x3e5f('0x5b')],'read1stAt':_['isNil'](_0x47de57['read1stAt'])?moment()[_0x3e5f('0x5f')](_0x3e5f('0x5a')):undefined});}return null;})['then'](function(_0x12b51b){if(_0x12b51b){_0x1b87ca[_0x3e5f('0x60')]=_0x12b51b['get']({'plain':!![]});interaction_log[_0x3e5f('0x21')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xcaf84[_0x3e5f('0x61')]['id'],_0xcaf84['user'][_0x3e5f('0x3b')],_0xcaf84[_0x3e5f('0x61')][_0x3e5f('0x62')],_0x1b87ca[_0x3e5f('0x60')]['id'],_0xcaf84[_0x3e5f('0x56')]?JSON[_0x3e5f('0x26')](_0xcaf84['body']):_0x3e5f('0x63'));return respondWithRpcPromise(_0x3e5f('0x64'),'acceptMessage',_0x1b87ca);}return null;})[_0x3e5f('0x20')](function(_0x195cfa){var _0xeb1403='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x195cfa[_0x3e5f('0x29')]['ContactId'];return db['sequelize'][_0x3e5f('0x42')](_0xeb1403,{'type':db['Sequelize'][_0x3e5f('0x65')]['SELECT'],'raw':!![]})[_0x3e5f('0x20')](function(_0x5a2e82){return _0x5a2e82;});})[_0x3e5f('0x20')](function(_0x1a0ed2){if(_0x1a0ed2){_0x1b87ca[_0x3e5f('0x29')]['contact']=_0x1a0ed2[0x0];if(!_0xcaf84[_0x3e5f('0x56')][_0x3e5f('0x5b')])return;return db['User'][_0x3e5f('0x55')]({'where':{'id':_0xcaf84['body'][_0x3e5f('0x5b')],'role':'agent'},'attributes':['id',_0x3e5f('0x3b'),'fullname',_0x3e5f('0x66'),_0x3e5f('0x67')],'raw':!![]});}return null;})['then'](function(_0x1c330d){if(!_0x1c330d)return null;_0x1b87ca[_0x3e5f('0x29')][_0x3e5f('0x68')]=_0x1c330d;return _0x1b87ca;})['then'](function(_0x136893){if(_0x136893){if(_0xcaf84[_0x3e5f('0x56')]['manual']){_0x1b87ca[_0x3e5f('0x29')][_0x3e5f('0x69')]=util['format'](_0x3e5f('0x6a'),_0xcaf84[_0x3e5f('0x61')][_0x3e5f('0x3b')]);_0x1b87ca[_0x3e5f('0x29')]['channel']=_0x1b87ca[_0x3e5f('0x6b')];_0x1b87ca['message'][_0x3e5f('0x6c')]=_0x1b87ca[_0x3e5f('0x6b')];_0x1b87ca[_0x3e5f('0x29')]['event']=_0x3e5f('0x6d');return respondWithRpcPromise(_0x3e5f('0x6e'),_0x3e5f('0x6e'),{'event':_0x3e5f('0x6f'),'message':_0x1b87ca[_0x3e5f('0x29')]},client9002)['then'](function(){return _0x1b87ca;});}return _0x1b87ca;}return null;})[_0x3e5f('0x20')](respondWithResult(_0x2e4438,null))[_0x3e5f('0x2b')](handleError(_0x2e4438,null));};var interaction_log=require('../../config/logger')(_0x3e5f('0x58'));exports[_0x3e5f('0x35')]=function(_0x32247f,_0x23e782,_0x3097a8){var _0x493d3e={'agent':{},'channel':_0x3e5f('0x70')};if(_0x32247f[_0x3e5f('0x56')]['id']){delete _0x32247f[_0x3e5f('0x56')]['id'];}_0x32247f[_0x3e5f('0x56')][_0x3e5f('0x5b')]=_0x32247f[_0x3e5f('0x56')][_0x3e5f('0x5b')]||_0x32247f[_0x3e5f('0x61')]['id'];_0x493d3e[_0x3e5f('0x68')]['id']=_0x32247f['body'][_0x3e5f('0x5b')];return db[_0x3e5f('0x3d')][_0x3e5f('0x55')]({'where':{'id':_0x32247f[_0x3e5f('0x52')]['id'],'UserId':null}})[_0x3e5f('0x20')](handleEntityNotFound(_0x23e782,null))[_0x3e5f('0x20')](function(_0x1e7484){if(_0x1e7484){_0x493d3e['message']=_0x1e7484['get']({'plain':!![]});return db[_0x3e5f('0x5d')][_0x3e5f('0x55')]({'where':{'id':_0x1e7484['FaxInteractionId']}});}return null;})[_0x3e5f('0x20')](handleEntityNotFound(_0x23e782,null))['then'](function(_0x109494){if(_0x109494){_0x493d3e['interaction']=_0x109494[_0x3e5f('0x5c')]({'plain':!![]});interaction_log[_0x3e5f('0x21')](_0x3e5f('0x71'),_0x32247f[_0x3e5f('0x61')]['id'],_0x32247f[_0x3e5f('0x61')][_0x3e5f('0x3b')],_0x32247f[_0x3e5f('0x61')][_0x3e5f('0x62')],_0x493d3e[_0x3e5f('0x60')]['id'],_0x32247f['body']?JSON[_0x3e5f('0x26')](_0x32247f[_0x3e5f('0x56')]):_0x3e5f('0x63'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x493d3e);}return null;})[_0x3e5f('0x20')](function(_0x4aa82a){var _0x520188='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4aa82a[_0x3e5f('0x29')][_0x3e5f('0x72')];return db['sequelize']['query'](_0x520188,{'type':db[_0x3e5f('0x73')][_0x3e5f('0x65')]['SELECT'],'raw':!![]})['then'](function(_0x3816b0){return _0x3816b0;});})['then'](function(_0x2c692b){if(_0x2c692b){_0x493d3e['message'][_0x3e5f('0x74')]=_0x2c692b[0x0];if(!_0x32247f[_0x3e5f('0x56')][_0x3e5f('0x5b')])return;return db['User'][_0x3e5f('0x55')]({'where':{'id':_0x32247f[_0x3e5f('0x56')]['UserId'],'role':'agent'},'attributes':['id','name',_0x3e5f('0x75'),'email',_0x3e5f('0x67')],'raw':!![]});}return null;})['then'](function(_0x217238){if(!_0x217238)return null;_0x493d3e[_0x3e5f('0x29')][_0x3e5f('0x68')]=_0x217238;return _0x493d3e;})[_0x3e5f('0x20')](function(_0x54efe6){if(_0x54efe6){_0x54efe6[_0x3e5f('0x29')]['interface']=util[_0x3e5f('0x5f')](_0x3e5f('0x6a'),_0x32247f['user'][_0x3e5f('0x3b')]);_0x54efe6['message'][_0x3e5f('0x6b')]=_0x493d3e[_0x3e5f('0x6b')];_0x54efe6['message'][_0x3e5f('0x6c')]=_0x493d3e['channel'];_0x54efe6[_0x3e5f('0x29')][_0x3e5f('0x76')]=_0x3e5f('0x35');respondWithRpcPromise(_0x3e5f('0x6e'),_0x3e5f('0x6e'),{'event':_0x3e5f('0x77'),'message':_0x54efe6[_0x3e5f('0x29')]},client9002);return _0x493d3e;}return null;})[_0x3e5f('0x20')](respondWithResult(_0x23e782,null))['catch'](handleError(_0x23e782,null));};exports['create']=function(_0x5c9685,_0xa24e31){var _0x184638;return db['FaxMessage'][_0x3e5f('0x78')](_0x5c9685[_0x3e5f('0x56')],{})[_0x3e5f('0x20')](function(_0x157de6){_0x184638=_0x157de6;return db[_0x3e5f('0x79')][_0x3e5f('0x7a')]({'where':{'id':_0x184638[_0x3e5f('0x72')]}});})[_0x3e5f('0x20')](function(_0x59d3a8){if(_[_0x3e5f('0x7b')](_0x59d3a8)){return;}else{_0x184638[_0x3e5f('0x70')]=_0x59d3a8[_0x3e5f('0x70')];return db[_0x3e5f('0x7c')]['findOne']({'where':{'id':_0x184638[_0x3e5f('0x7d')]}});}})[_0x3e5f('0x20')](function(_0x429f01){return respondWithRpcPromise('SendFax',_0x3e5f('0x7e'),{'FaxAccountId':_[_0x3e5f('0x7b')](_0x5c9685['body'])?undefined:_0x5c9685[_0x3e5f('0x56')][_0x3e5f('0x7f')],'path':_['isNil'](_0x429f01)?undefined:util[_0x3e5f('0x5f')]('/var/opt/motion2/server/files/attachments/%s',_0x429f01[_0x3e5f('0x80')]),'fax':_[_0x3e5f('0x7b')](_0x184638['fax'])?undefined:_0x184638['fax'],'AttachmentId':_0x184638[_0x3e5f('0x7d')]},client9002);})[_0x3e5f('0x20')](respondWithResult(_0xa24e31,0xc9))[_0x3e5f('0x2b')](handleError(_0xa24e31,null));};exports[_0x3e5f('0x81')]=function(_0x302e28,_0x58e313){var _0xbeb9fc=path['join'](config['root'],_0x3e5f('0x82'),_0x3e5f('0x83'),_0x3e5f('0x84'));return db[_0x3e5f('0x3d')][_0x3e5f('0x55')]({'where':{'id':_0x302e28[_0x3e5f('0x52')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x3e5f('0x20')](handleEntityNotFound(_0x58e313,null))[_0x3e5f('0x20')](function(_0x143f55){if(_0x143f55){return _0x58e313[_0x3e5f('0x81')](path['join'](_0xbeb9fc,_0x143f55[_0x3e5f('0x7c')]['basename']));}})[_0x3e5f('0x2b')](handleError(_0x58e313,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index d781a25..be8079c 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 _0x1488=['events','FaxMessage','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x2b26b1,_0x121949){var _0x19acbd=function(_0x26a915){while(--_0x26a915){_0x2b26b1['push'](_0x2b26b1['shift']());}};_0x19acbd(++_0x121949);}(_0x1488,0x88));var _0x8148=function(_0x349a9e,_0x473cb8){_0x349a9e=_0x349a9e-0x0;var _0x24c207=_0x1488[_0x349a9e];return _0x24c207;};'use strict';var EventEmitter=require(_0x8148('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x8148('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x8148('0x2')](0x0);var events={'afterCreate':_0x8148('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2fdd7e){return function(_0x5b1a48,_0x32d78,_0x74ecbc){FaxMessageEvents[_0x8148('0x4')](_0x2fdd7e+':'+_0x5b1a48['id'],_0x5b1a48);FaxMessageEvents[_0x8148('0x4')](_0x2fdd7e,_0x5b1a48);_0x74ecbc(null);};}for(var e in events){if(events[_0x8148('0x5')](e)){var event=events[e];FaxMessage[_0x8148('0x6')](e,emitEvent(event));}}module[_0x8148('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x073d=['hook','exports','../../mysqldb','FaxMessage','setMaxListeners','update','emit','hasOwnProperty'];(function(_0xf1bf12,_0x4558e4){var _0x340ce8=function(_0x15c95e){while(--_0x15c95e){_0xf1bf12['push'](_0xf1bf12['shift']());}};_0x340ce8(++_0x4558e4);}(_0x073d,0xd2));var _0xd073=function(_0x5509a8,_0x1a8b93){_0x5509a8=_0x5509a8-0x0;var _0x5383b1=_0x073d[_0x5509a8];return _0x5383b1;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xd073('0x0'))['db'][_0xd073('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xd073('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd073('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3ad2eb){return function(_0x423dc8,_0x494f81,_0x11bd94){FaxMessageEvents[_0xd073('0x4')](_0x3ad2eb+':'+_0x423dc8['id'],_0x423dc8);FaxMessageEvents[_0xd073('0x4')](_0x3ad2eb,_0x423dc8);_0x11bd94(null);};}for(var e in events){if(events[_0xd073('0x5')](e)){var event=events[e];FaxMessage[_0xd073('0x6')](e,emitEvent(event));}}module[_0xd073('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index bf78348..f2ed28f 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 _0x67c7=['get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteractionId','then','createdAt','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','models'];(function(_0x3c73a0,_0x3772b3){var _0x43f364=function(_0x504748){while(--_0x504748){_0x3c73a0['push'](_0x3c73a0['shift']());}};_0x43f364(++_0x3772b3);}(_0x67c7,0x137));var _0x767c=function(_0x1bad8a,_0x4a160f){_0x1bad8a=_0x1bad8a-0x0;var _0xfa3b6b=_0x67c7[_0x1bad8a];return _0xfa3b6b;};'use strict';var _=require(_0x767c('0x0'));var util=require(_0x767c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x767c('0x2'));var rp=require(_0x767c('0x3'));var fs=require('fs');var path=require(_0x767c('0x4'));var rimraf=require(_0x767c('0x5'));var config=require(_0x767c('0x6'));var attributes=require(_0x767c('0x7'));module[_0x767c('0x8')]=function(_0x40b624,_0x44448e){return _0x40b624[_0x767c('0x9')](_0x767c('0xa'),attributes,{'tableName':_0x767c('0xb'),'paranoid':![],'indexes':[{'name':_0x767c('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ac2d9,_0x468194,_0x475ebd){var _0x36ca34=_0x40b624[_0x767c('0xd')];var _0x73d1a3=_0x1ac2d9[_0x767c('0xe')]({'plain':!![]});if(_0x73d1a3[_0x767c('0xf')][_0x767c('0x10')]()==='in'||_0x73d1a3[_0x767c('0xf')][_0x767c('0x10')]()===_0x767c('0x11')&&!_0x73d1a3[_0x767c('0x12')]&&!_[_0x767c('0x13')](_0x73d1a3[_0x767c('0x14')])){_0x36ca34['FaxInteraction']['findOne']({'where':{'id':_0x73d1a3[_0x767c('0x15')]}})[_0x767c('0x16')](function(_0x1e0697){if(_0x1e0697){_0x1e0697['update']({'lastMsgAt':_0x73d1a3[_0x767c('0x17')],'lastMsgDirection':_0x73d1a3['direction'][_0x767c('0x10')]()});}})['catch'](function(_0x4c9545){console['error'](_0x4c9545);});}_0x475ebd();}},'charset':'utf8mb4','collate':_0x767c('0x18')});}; \ No newline at end of file +var _0x13dd=['bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','findOne','FaxInteractionId','then','update','createdAt','error','lodash','util','../../config/logger','api'];(function(_0x30bf31,_0x215c2a){var _0x587c16=function(_0x4cdca2){while(--_0x4cdca2){_0x30bf31['push'](_0x30bf31['shift']());}};_0x587c16(++_0x215c2a);}(_0x13dd,0x68));var _0xd13d=function(_0x597ad5,_0x17e1ff){_0x597ad5=_0x597ad5-0x0;var _0x25b2b4=_0x13dd[_0x597ad5];return _0x25b2b4;};'use strict';var _=require(_0xd13d('0x0'));var util=require(_0xd13d('0x1'));var logger=require(_0xd13d('0x2'))(_0xd13d('0x3'));var moment=require('moment');var BPromise=require(_0xd13d('0x4'));var rp=require(_0xd13d('0x5'));var fs=require('fs');var path=require(_0xd13d('0x6'));var rimraf=require(_0xd13d('0x7'));var config=require(_0xd13d('0x8'));var attributes=require(_0xd13d('0x9'));module['exports']=function(_0x54efa9,_0x21e63d){return _0x54efa9[_0xd13d('0xa')](_0xd13d('0xb'),attributes,{'tableName':_0xd13d('0xc'),'paranoid':![],'indexes':[{'name':_0xd13d('0xd'),'fields':[_0xd13d('0xe')],'type':_0xd13d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x86d737,_0x573386,_0x64bea9){var _0x1570b8=_0x54efa9['models'];var _0x56231b=_0x86d737[_0xd13d('0x10')]({'plain':!![]});if(_0x56231b['direction'][_0xd13d('0x11')]()==='in'||_0x56231b[_0xd13d('0x12')][_0xd13d('0x11')]()==='out'&&!_0x56231b[_0xd13d('0x13')]&&!_[_0xd13d('0x14')](_0x56231b['UserId'])){_0x1570b8['FaxInteraction'][_0xd13d('0x15')]({'where':{'id':_0x56231b[_0xd13d('0x16')]}})[_0xd13d('0x17')](function(_0xb1a5){if(_0xb1a5){_0xb1a5[_0xd13d('0x18')]({'lastMsgAt':_0x56231b[_0xd13d('0x19')],'lastMsgDirection':_0x56231b[_0xd13d('0x12')][_0xd13d('0x11')]()});}})['catch'](function(_0x51ab07){console[_0xd13d('0x1a')](_0x51ab07);});}_0x64bea9();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index d9d81fb..b0a7ffd 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 _0xe14d=['code','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5b38d9,_0x395c58){var _0x416c1f=function(_0x207475){while(--_0x207475){_0x5b38d9['push'](_0x5b38d9['shift']());}};_0x416c1f(++_0x395c58);}(_0xe14d,0x1ee));var _0xde14=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xe14d[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xde14('0xc')],{'host':_0xde14('0xd'),'port':0x18eb});var socket=require(_0xde14('0xe'))(new Redis(config[_0xde14('0xc')]));require(_0xde14('0xf'))[_0xde14('0x10')](socket);function respondWithRpcPromise(_0xa17e8,_0x1ce0a2,_0x4b2b15){return new BPromise(function(_0x1a7167,_0xe785fb){return client[_0xde14('0x11')](_0xa17e8,_0x4b2b15)[_0xde14('0x12')](function(_0x8e0e){logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));logger[_0xde14('0x16')](_0xde14('0x17'),_0x1ce0a2,_0xde14('0x15'),JSON[_0xde14('0x18')](_0x8e0e));if(_0x8e0e[_0xde14('0x19')]){if(_0x8e0e[_0xde14('0x19')][_0xde14('0x1a')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0xe785fb(_0x8e0e[_0xde14('0x19')]['message']);}logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0x1a7167(_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);}else{logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));_0x1a7167(_0x8e0e[_0xde14('0x1c')]['message']);}})[_0xde14('0x1d')](function(_0x3bfc59){logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x3bfc59);_0xe785fb(_0x3bfc59);});});}exports['CreateFaxMessage']=function(_0x394de7){var _0x53e905=this;return new Promise(function(_0x45d101,_0x4c24a8){return db[_0xde14('0x1e')][_0xde14('0x1f')](_0x394de7[_0xde14('0x20')],{'raw':_0x394de7[_0xde14('0x21')]?_0x394de7[_0xde14('0x21')][_0xde14('0x22')]===undefined?!![]:![]:!![]})[_0xde14('0x12')](function(_0x2dd9e7){logger[_0xde14('0x13')](_0xde14('0x23'),_0x394de7);logger[_0xde14('0x16')](_0xde14('0x23'),_0x394de7,JSON[_0xde14('0x18')](_0x2dd9e7));_0x45d101(_0x2dd9e7);})['catch'](function(_0x42dd4f){logger[_0xde14('0x19')](_0xde14('0x23'),_0x42dd4f[_0xde14('0x1b')],_0x394de7);_0x4c24a8(_0x53e905[_0xde14('0x19')](0x1f4,_0x42dd4f[_0xde14('0x1b')]));});});};exports[_0xde14('0x24')]=function(_0x23c735){var _0x1618e1=this;return new Promise(function(_0x350a78,_0x4eff65){return db[_0xde14('0x1e')][_0xde14('0x25')](_0x23c735[_0xde14('0x20')],{'raw':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')]['where']||null:null,'attributes':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x26')]||null:null,'limit':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')][_0xde14('0x27')]||null:null})[_0xde14('0x12')](function(_0x237d3f){logger[_0xde14('0x13')](_0xde14('0x24'),_0x23c735);logger['debug'](_0xde14('0x24'),_0x23c735,JSON[_0xde14('0x18')](_0x237d3f));_0x350a78(_0x237d3f);})['catch'](function(_0xf25a9e){logger['error'](_0xde14('0x24'),_0xf25a9e[_0xde14('0x1b')],_0x23c735);_0x4eff65(_0x1618e1[_0xde14('0x19')](0x1f4,_0xf25a9e[_0xde14('0x1b')]));});});}; \ No newline at end of file +var _0xb458=['info','result','catch','FaxMessage','create','body','options','then','CreateFaxMessage','update','raw','where','attributes','UpdateFaxMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','register','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xb458,0x103));var _0x8b45=function(_0x575c17,_0x58cf05){_0x575c17=_0x575c17-0x0;var _0x4be569=_0xb458[_0x575c17];return _0x4be569;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});config[_0x8b45('0x9')]=_[_0x8b45('0xa')](config[_0x8b45('0x9')],{'host':_0x8b45('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b45('0x9')]));require(_0x8b45('0xc'))[_0x8b45('0xd')](socket);function respondWithRpcPromise(_0x2bc809,_0x2f7117,_0x499899){return new BPromise(function(_0x2a4c83,_0x7cc49b){return client['request'](_0x2bc809,_0x499899)['then'](function(_0x5bb708){logger['info'](_0x8b45('0xe'),_0x2f7117,_0x8b45('0xf'));logger[_0x8b45('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2f7117,_0x8b45('0xf'),JSON[_0x8b45('0x11')](_0x5bb708));if(_0x5bb708[_0x8b45('0x12')]){if(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x13')]===0x1f4){logger[_0x8b45('0x12')]('FaxMessage,\x20%s,\x20%s',_0x2f7117,_0x5bb708['error'][_0x8b45('0x14')]);return _0x7cc49b(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);}logger[_0x8b45('0x12')](_0x8b45('0xe'),_0x2f7117,_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);return _0x2a4c83(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);}else{logger[_0x8b45('0x15')](_0x8b45('0xe'),_0x2f7117,_0x8b45('0xf'));_0x2a4c83(_0x5bb708[_0x8b45('0x16')][_0x8b45('0x14')]);}})[_0x8b45('0x17')](function(_0x31c6b4){logger[_0x8b45('0x12')](_0x8b45('0xe'),_0x2f7117,_0x31c6b4);_0x7cc49b(_0x31c6b4);});});}exports['CreateFaxMessage']=function(_0x25e8a1){var _0x2db2d1=this;return new Promise(function(_0x1767d5,_0x46e21a){return db[_0x8b45('0x18')][_0x8b45('0x19')](_0x25e8a1[_0x8b45('0x1a')],{'raw':_0x25e8a1[_0x8b45('0x1b')]?_0x25e8a1['options']['raw']===undefined?!![]:![]:!![]})[_0x8b45('0x1c')](function(_0x580e17){logger[_0x8b45('0x15')](_0x8b45('0x1d'),_0x25e8a1);logger[_0x8b45('0x10')](_0x8b45('0x1d'),_0x25e8a1,JSON[_0x8b45('0x11')](_0x580e17));_0x1767d5(_0x580e17);})[_0x8b45('0x17')](function(_0x32b12b){logger['error']('CreateFaxMessage',_0x32b12b[_0x8b45('0x14')],_0x25e8a1);_0x46e21a(_0x2db2d1[_0x8b45('0x12')](0x1f4,_0x32b12b['message']));});});};exports['UpdateFaxMessage']=function(_0x129c35){var _0x32f6f0=this;return new Promise(function(_0x2ca2d9,_0x2f37bc){return db['FaxMessage'][_0x8b45('0x1e')](_0x129c35[_0x8b45('0x1a')],{'raw':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x20')]||null:null,'attributes':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x21')]||null:null,'limit':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')]['limit']||null:null})[_0x8b45('0x1c')](function(_0x36db96){logger[_0x8b45('0x15')](_0x8b45('0x22'),_0x129c35);logger[_0x8b45('0x10')](_0x8b45('0x22'),_0x129c35,JSON[_0x8b45('0x11')](_0x36db96));_0x2ca2d9(_0x36db96);})[_0x8b45('0x17')](function(_0x5d8938){logger[_0x8b45('0x12')](_0x8b45('0x22'),_0x5d8938[_0x8b45('0x14')],_0x129c35);_0x2f37bc(_0x32f6f0[_0x8b45('0x12')](0x1f4,_0x5d8938[_0x8b45('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 96c9bfd..18f1cf9 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 _0xcb6e=['emit','removeListener','register','length','faxMessage:','./faxMessage.events','save','remove'];(function(_0x15203e,_0x4142fe){var _0x215a47=function(_0x120ca7){while(--_0x120ca7){_0x15203e['push'](_0x15203e['shift']());}};_0x215a47(++_0x4142fe);}(_0xcb6e,0xfd));var _0xecb6=function(_0x586182,_0x2db147){_0x586182=_0x586182-0x0;var _0x55c119=_0xcb6e[_0x586182];return _0x55c119;};'use strict';var FaxMessageEvents=require(_0xecb6('0x0'));var events=[_0xecb6('0x1'),_0xecb6('0x2'),'update'];function createListener(_0x59d36b,_0x49bde3){return function(_0x38b0c9){_0x49bde3[_0xecb6('0x3')](_0x59d36b,_0x38b0c9);};}function removeListener(_0x2b8a4f,_0x49531b){return function(){FaxMessageEvents[_0xecb6('0x4')](_0x2b8a4f,_0x49531b);};}exports[_0xecb6('0x5')]=function(_0x72cf5){for(var _0x5dd00a=0x0,_0x58f082=events[_0xecb6('0x6')];_0x5dd00a<_0x58f082;_0x5dd00a++){var _0x22b8dc=events[_0x5dd00a];var _0x16cdf4=createListener(_0xecb6('0x7')+_0x22b8dc,_0x72cf5);FaxMessageEvents['on'](_0x22b8dc,_0x16cdf4);}}; \ No newline at end of file +var _0xa672=['save','remove','update','emit','removeListener','register','length','./faxMessage.events'];(function(_0x4c4ee1,_0x36341c){var _0x456f15=function(_0x27cea0){while(--_0x27cea0){_0x4c4ee1['push'](_0x4c4ee1['shift']());}};_0x456f15(++_0x36341c);}(_0xa672,0xb7));var _0x2a67=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xa672[_0x5c2e3e];return _0x53f64a;};'use strict';var FaxMessageEvents=require(_0x2a67('0x0'));var events=[_0x2a67('0x1'),_0x2a67('0x2'),_0x2a67('0x3')];function createListener(_0xd6fe4f,_0x38b494){return function(_0x57a29a){_0x38b494[_0x2a67('0x4')](_0xd6fe4f,_0x57a29a);};}function removeListener(_0x2b9912,_0x12a338){return function(){FaxMessageEvents[_0x2a67('0x5')](_0x2b9912,_0x12a338);};}exports[_0x2a67('0x6')]=function(_0x4e909f){for(var _0x174f5b=0x0,_0x1ab4a5=events[_0x2a67('0x7')];_0x174f5b<_0x1ab4a5;_0x174f5b++){var _0x2eae21=events[_0x174f5b];var _0x420f78=createListener('faxMessage:'+_0x2eae21,_0x4e909f);FaxMessageEvents['on'](_0x2eae21,_0x420f78);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 97d9084..f29e831 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 _0x593e=['../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','show','download','post','fax','faxmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3ce4a5,_0x50bc4b){var _0x3f5809=function(_0x2f5b78){while(--_0x2f5b78){_0x3ce4a5['push'](_0x3ce4a5['shift']());}};_0x3f5809(++_0x50bc4b);}(_0x593e,0xcb));var _0xe593=function(_0x5841ef,_0x4b27aa){_0x5841ef=_0x5841ef-0x0;var _0x21b4cd=_0x593e[_0x5841ef];return _0x21b4cd;};'use strict';var multer=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var timeout=require(_0xe593('0x3'));var express=require(_0xe593('0x4'));var router=express[_0xe593('0x5')]();var fs_extra=require(_0xe593('0x6'));var auth=require(_0xe593('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe593('0x8'));var controller=require(_0xe593('0x9'));router[_0xe593('0xa')]('/',auth[_0xe593('0xb')](),controller[_0xe593('0xc')]);router[_0xe593('0xa')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0xe')]);router[_0xe593('0xa')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0xf')]);router[_0xe593('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xe593('0x10')]);router[_0xe593('0x11')]('/',auth[_0xe593('0xb')](),interaction['tracked'](_0xe593('0x12'),_0xe593('0x13')),controller[_0xe593('0x14')]);router[_0xe593('0x15')](_0xe593('0x16'),auth[_0xe593('0xb')](),controller[_0xe593('0x17')]);router[_0xe593('0x15')](_0xe593('0x18'),auth[_0xe593('0xb')](),controller['accept']);router[_0xe593('0x15')](_0xe593('0x19'),auth['isAuthenticated'](),controller[_0xe593('0x1a')]);router[_0xe593('0x1b')]('/:id',auth[_0xe593('0xb')](),controller[_0xe593('0x1c')]);module[_0xe593('0x1d')]=router; \ No newline at end of file +var _0x702d=['get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x543297,_0x1192b1){var _0x5f3cdb=function(_0x332135){while(--_0x332135){_0x543297['push'](_0x543297['shift']());}};_0x5f3cdb(++_0x1192b1);}(_0x702d,0x147));var _0xd702=function(_0xf9ce83,_0x335302){_0xf9ce83=_0xf9ce83-0x0;var _0x2e7800=_0x702d[_0xf9ce83];return _0x2e7800;};'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('./faxMessage.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('0x9')](_0xd702('0x10'),auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')]('/',auth[_0xd702('0xe')](),interaction[_0xd702('0x13')]('fax','faxmessage:create'),controller[_0xd702('0x14')]);router[_0xd702('0x15')](_0xd702('0xd'),auth['isAuthenticated'](),controller[_0xd702('0x16')]);router[_0xd702('0x15')](_0xd702('0x17'),auth[_0xd702('0xe')](),controller[_0xd702('0x18')]);router[_0xd702('0x15')]('/:id/reject',auth[_0xd702('0xe')](),controller[_0xd702('0x19')]);router['delete'](_0xd702('0xd'),auth['isAuthenticated'](),controller[_0xd702('0x1a')]);module[_0xd702('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 351aeb2..d447a32 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 _0x2525=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x2525,0x1f0));var _0x5252=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x2525[_0x3b5250];return _0xc844a1;};'use strict';var Sequelize=require(_0x5252('0x0'));module[_0x5252('0x1')]={'name':{'type':Sequelize[_0x5252('0x2')],'unique':_0x5252('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5252('0x2')]},'timeout':{'type':Sequelize[_0x5252('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5252('0x5')](_0x5252('0x6'),_0x5252('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7bb9=['roundrobin','INTEGER','sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x306813,_0x193d2a){var _0x200e73=function(_0x41e19d){while(--_0x41e19d){_0x306813['push'](_0x306813['shift']());}};_0x200e73(++_0x193d2a);}(_0x7bb9,0x89));var _0x97bb=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x7bb9[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0x97bb('0x0'));module[_0x97bb('0x1')]={'name':{'type':Sequelize[_0x97bb('0x2')],'unique':_0x97bb('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x97bb('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x97bb('0x4')](_0x97bb('0x5'),_0x97bb('0x6'),_0x97bb('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x97bb('0x8')],'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 1e2f831..0e38ec0 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 _0xb470=['lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','FaxQueues','destroy','end','error','stack','name','index','map','FaxQueue','fieldName','type','key','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','merge','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','UserFaxQueue','length','hasOwnProperty','nolimit','sort','pick','FaxQueueId','filter','User','findAndCountAll','UserId','updatedAt','createdAt','%s/%s','SIP','faxPause','getTeams','Team','order','options','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','field','from','user_has_teams','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','value','removeAgents','omit','isArray','userFaxQueue:remove','getAgents','rawAttributes','bluebird','util'];(function(_0x32c395,_0x37b0bd){var _0x193c67=function(_0x203eaa){while(--_0x203eaa){_0x32c395['push'](_0x32c395['shift']());}};_0x193c67(++_0x37b0bd);}(_0xb470,0x75));var _0x0b47=function(_0x2140aa,_0x2f27d8){_0x2140aa=_0x2140aa-0x0;var _0x556c1e=_0xb470[_0x2140aa];return _0x556c1e;};'use strict';var BPromise=require(_0x0b47('0x0'));var util=require(_0x0b47('0x1'));var _=require(_0x0b47('0x2'));var squel=require(_0x0b47('0x3'));var Redis=require('ioredis');var qs=require(_0x0b47('0x4'));var logger=require(_0x0b47('0x5'))(_0x0b47('0x6'));var config=require('../../config/environment');var db=require(_0x0b47('0x7'))['db'];config[_0x0b47('0x8')]=_[_0x0b47('0x9')](config[_0x0b47('0x8')],{'host':_0x0b47('0xa'),'port':0x18eb});var socket=require(_0x0b47('0xb'))(new Redis(config[_0x0b47('0x8')]));require(_0x0b47('0xc'))['register'](socket);function respondWithStatusCode(_0x56543c,_0x5f02db){_0x5f02db=_0x5f02db||0xcc;return function(_0x5c21d2){if(_0x5c21d2){return _0x56543c[_0x0b47('0xd')](_0x5f02db);}return _0x56543c[_0x0b47('0xe')](_0x5f02db)['end']();};}function respondWithResult(_0x127232,_0x19b87e){_0x19b87e=_0x19b87e||0xc8;return function(_0x243f01){if(_0x243f01){return _0x127232[_0x0b47('0xe')](_0x19b87e)[_0x0b47('0xf')](_0x243f01);}};}function respondWithFilteredResult(_0x26036,_0x36a570){return function(_0x457146){if(_0x457146){var _0x58b8d=typeof _0x36a570[_0x0b47('0x10')]==='undefined'&&typeof _0x36a570['limit']===_0x0b47('0x11');var _0x511b6e=_0x457146[_0x0b47('0x12')];var _0x1e4988=_0x58b8d?0x0:_0x36a570['offset'];var _0x36fe0a=_0x58b8d?_0x457146[_0x0b47('0x12')]:_0x36a570[_0x0b47('0x10')]+_0x36a570[_0x0b47('0x13')];var _0x387084;if(_0x36fe0a>=_0x511b6e){_0x36fe0a=_0x511b6e;_0x387084=0xc8;}else{_0x387084=0xce;}_0x26036[_0x0b47('0xe')](_0x387084);return _0x26036[_0x0b47('0x14')](_0x0b47('0x15'),_0x1e4988+'-'+_0x36fe0a+'/'+_0x511b6e)[_0x0b47('0xf')](_0x457146);}return null;};}function saveUpdates(_0x1da847){return function(_0x4c94c9){if(_0x4c94c9){return _0x4c94c9[_0x0b47('0x16')](_0x1da847)['then'](function(_0x11f305){return _0x11f305;});}return null;};}function removeEntity(_0x1620fc){return function(_0x2b1024){if(_0x2b1024){return _0x2b1024['destroy']()[_0x0b47('0x17')](function(){var _0x5aee61=_0x2b1024['get']({'plain':!![]});var _0x257bca=_0x0b47('0x18');return db['UserProfileResource'][_0x0b47('0x19')]({'where':{'type':_0x257bca,'resourceId':_0x5aee61['id']}})['then'](function(){return _0x2b1024;});})[_0x0b47('0x17')](function(){_0x1620fc[_0x0b47('0xe')](0xcc)[_0x0b47('0x1a')]();});}};}function handleEntityNotFound(_0x1b8f26){return function(_0x13180b){if(!_0x13180b){_0x1b8f26[_0x0b47('0xd')](0x194);}return _0x13180b;};}function handleError(_0x3bd7f1,_0x2dfdb4){_0x2dfdb4=_0x2dfdb4||0x1f4;return function(_0x3bff28){logger[_0x0b47('0x1b')](_0x3bff28[_0x0b47('0x1c')]);if(_0x3bff28['name']){delete _0x3bff28[_0x0b47('0x1d')];}_0x3bd7f1[_0x0b47('0xe')](_0x2dfdb4)['send'](_0x3bff28);};}exports[_0x0b47('0x1e')]=function(_0x2a2287,_0x27518e){var _0xd9c35c={};var _0x59af8e={'count':0x0,'rows':[]};var _0x47d1b2=_[_0x0b47('0x1f')](db[_0x0b47('0x20')]['rawAttributes'],function(_0x138a03){return{'name':_0x138a03[_0x0b47('0x21')],'type':_0x138a03[_0x0b47('0x22')][_0x0b47('0x23')]};});_0xd9c35c=qs[_0x0b47('0x24')](_0x47d1b2,_0x2a2287);var _0x1bfbd1={'where':_0xd9c35c[_0x0b47('0x25')]};return db[_0x0b47('0x20')][_0x0b47('0x12')](_0x1bfbd1)[_0x0b47('0x17')](function(_0x370022){_0x59af8e['count']=_0x370022;_0xd9c35c['include']=qs[_0x0b47('0x26')](_0x2a2287['query']);return db[_0x0b47('0x20')][_0x0b47('0x27')](_0xd9c35c);})[_0x0b47('0x17')](function(_0xccf571){_0x59af8e[_0x0b47('0x28')]=_0xccf571;return _0x59af8e;})['then'](respondWithFilteredResult(_0x27518e,_0xd9c35c))[_0x0b47('0x29')](handleError(_0x27518e,null));};exports[_0x0b47('0x2a')]=function(_0x374589,_0x595c3f){var _0x173c12={'raw':!![],'where':{'id':_0x374589[_0x0b47('0x2b')]['id']}},_0x18b804={};_0x18b804[_0x0b47('0x2c')]=_[_0x0b47('0x2d')](db[_0x0b47('0x20')]['rawAttributes']);_0x18b804['query']=_[_0x0b47('0x2d')](_0x374589[_0x0b47('0x2e')]);_0x18b804[_0x0b47('0x2f')]=_[_0x0b47('0x30')](_0x18b804[_0x0b47('0x2c')],_0x18b804[_0x0b47('0x2e')]);_0x173c12[_0x0b47('0x31')]=_[_0x0b47('0x30')](_0x18b804[_0x0b47('0x2c')],qs[_0x0b47('0x32')](_0x374589[_0x0b47('0x2e')]['fields']));_0x173c12['attributes']=_0x173c12[_0x0b47('0x31')]['length']?_0x173c12[_0x0b47('0x31')]:_0x18b804[_0x0b47('0x2c')];if(_0x374589[_0x0b47('0x2e')][_0x0b47('0x33')]){_0x173c12[_0x0b47('0x26')]=[{'all':!![]}];}_0x173c12=_[_0x0b47('0x34')]({},_0x173c12,_0x374589['options']);return db['FaxQueue']['find'](_0x173c12)[_0x0b47('0x17')](handleEntityNotFound(_0x595c3f,null))[_0x0b47('0x17')](respondWithResult(_0x595c3f,null))[_0x0b47('0x29')](handleError(_0x595c3f,null));};exports[_0x0b47('0x35')]=function(_0x197706,_0x22227f){return db['FaxQueue'][_0x0b47('0x35')](_0x197706[_0x0b47('0x36')],{})[_0x0b47('0x17')](function(_0x907222){var _0x56f92b=_0x197706['user'][_0x0b47('0x37')]({'plain':!![]});if(!_0x56f92b)throw new Error(_0x0b47('0x38'));if(_0x56f92b['role']===_0x0b47('0x39')){var _0x10e52b=_0x907222[_0x0b47('0x37')]({'plain':!![]});var _0x5cc3b6='FaxQueues';return db[_0x0b47('0x3a')][_0x0b47('0x3b')]({'where':{'name':_0x5cc3b6,'userProfileId':_0x56f92b[_0x0b47('0x3c')]},'raw':!![]})[_0x0b47('0x17')](function(_0x166334){if(_0x166334&&_0x166334[_0x0b47('0x3d')]===0x0){return db[_0x0b47('0x3e')][_0x0b47('0x35')]({'name':_0x10e52b[_0x0b47('0x1d')],'resourceId':_0x10e52b['id'],'type':_0x166334[_0x0b47('0x1d')],'sectionId':_0x166334['id']},{})[_0x0b47('0x17')](function(){return _0x907222;});}else{return _0x907222;}})[_0x0b47('0x29')](function(_0x2bd25b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bd25b);throw _0x2bd25b;});}return _0x907222;})[_0x0b47('0x17')](respondWithResult(_0x22227f,0xc9))['catch'](handleError(_0x22227f,null));};exports[_0x0b47('0x16')]=function(_0x484efb,_0x38e02f){if(_0x484efb[_0x0b47('0x36')]['id']){delete _0x484efb[_0x0b47('0x36')]['id'];}return db[_0x0b47('0x20')]['find']({'where':{'id':_0x484efb[_0x0b47('0x2b')]['id']}})[_0x0b47('0x17')](handleEntityNotFound(_0x38e02f,null))['then'](saveUpdates(_0x484efb[_0x0b47('0x36')],null))['then'](respondWithResult(_0x38e02f,null))[_0x0b47('0x29')](handleError(_0x38e02f,null));};exports[_0x0b47('0x19')]=function(_0x1db971,_0x9a5585){return db[_0x0b47('0x20')][_0x0b47('0x3b')]({'where':{'id':_0x1db971[_0x0b47('0x2b')]['id']}})[_0x0b47('0x17')](handleEntityNotFound(_0x9a5585,null))[_0x0b47('0x17')](removeEntity(_0x9a5585,null))[_0x0b47('0x29')](handleError(_0x9a5585,null));};exports['describe']=function(_0x4f3bd6,_0x5cee3e){return db['FaxQueue'][_0x0b47('0x3f')]()[_0x0b47('0x17')](respondWithResult(_0x5cee3e,null))['catch'](handleError(_0x5cee3e,null));};exports[_0x0b47('0x40')]=function(_0x540137,_0x3e5b44){var _0x3cd7d1={'raw':!![],'where':{}},_0x566f2d={},_0xce508c;return db[_0x0b47('0x20')][_0x0b47('0x41')]({'where':{'id':_0x540137[_0x0b47('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3e5b44,null))[_0x0b47('0x17')](function(_0x209363){if(_0x209363){_0xce508c=_0x209363[_0x0b47('0x37')]({'plain':!![]});_0x566f2d['model']=_[_0x0b47('0x2d')](db[_0x0b47('0x42')]['rawAttributes']);_0x566f2d[_0x0b47('0x2e')]=_['keys'](_0x540137['query']);_0x566f2d[_0x0b47('0x2f')]=_[_0x0b47('0x30')](_0x566f2d['model'],_0x566f2d[_0x0b47('0x2e')]);_0x3cd7d1['attributes']=_[_0x0b47('0x30')](_0x566f2d[_0x0b47('0x2c')],qs[_0x0b47('0x32')](_0x540137['query']['fields']));_0x3cd7d1[_0x0b47('0x31')]=_0x3cd7d1[_0x0b47('0x31')][_0x0b47('0x43')]?_0x3cd7d1[_0x0b47('0x31')]:_0x566f2d[_0x0b47('0x2c')];if(!_0x540137[_0x0b47('0x2e')][_0x0b47('0x44')](_0x0b47('0x45'))){_0x3cd7d1[_0x0b47('0x13')]=qs[_0x0b47('0x13')](_0x540137[_0x0b47('0x2e')]['limit']);_0x3cd7d1[_0x0b47('0x10')]=qs[_0x0b47('0x10')](_0x540137[_0x0b47('0x2e')]['offset']);}_0x3cd7d1['order']=qs['sort'](_0x540137['query'][_0x0b47('0x46')]);_0x3cd7d1[_0x0b47('0x25')]=qs[_0x0b47('0x2f')](_[_0x0b47('0x47')](_0x540137[_0x0b47('0x2e')],_0x566f2d[_0x0b47('0x2f')]));_0x3cd7d1['where'][_0x0b47('0x48')]=_0x209363['id'];if(_0x540137[_0x0b47('0x2e')][_0x0b47('0x49')]){_0x3cd7d1['where']=_[_0x0b47('0x34')](_0x3cd7d1[_0x0b47('0x25')],{'$or':_[_0x0b47('0x1f')](_0x3cd7d1[_0x0b47('0x31')],function(_0x2029c9){var _0x53050b={};_0x53050b[_0x2029c9]={'$like':'%'+_0x540137['query'][_0x0b47('0x49')]+'%'};return _0x53050b;})});}_0x3cd7d1=_[_0x0b47('0x34')]({},_0x3cd7d1,_0x540137['options']);return db[_0x0b47('0x42')][_0x0b47('0x27')](_0x3cd7d1);}})[_0x0b47('0x17')](function(_0x3e3181){if(_0x3e3181){return db[_0x0b47('0x4a')][_0x0b47('0x4b')]({'where':{'id':_[_0x0b47('0x1f')](_0x3e3181,_0x0b47('0x4c')),'role':'agent'},'attributes':['id',_0x0b47('0x1d'),'faxPause',_0x0b47('0x4d'),_0x0b47('0x4e')]});}})[_0x0b47('0x17')](function(_0x4e02bb){if(_0x4e02bb){return{'count':_0x4e02bb[_0x0b47('0x12')],'rows':_[_0x0b47('0x1f')](_0x4e02bb[_0x0b47('0x28')],function(_0x3712c8){return{'membername':_0x3712c8['name'],'UserId':_0x3712c8['id'],'queue_name':_0xce508c[_0x0b47('0x1d')],'FaxQueueId':_0xce508c['id'],'interface':util['format'](_0x0b47('0x4f'),_0x0b47('0x50'),_0x3712c8[_0x0b47('0x1d')]),'penalty':0x0,'paused':_0x3712c8[_0x0b47('0x51')],'createdAt':_0x3712c8[_0x0b47('0x4e')],'updatedAt':_0x3712c8[_0x0b47('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0b47('0x17')](respondWithFilteredResult(_0x3e5b44,_0x3cd7d1))[_0x0b47('0x29')](handleError(_0x3e5b44,null));};exports[_0x0b47('0x52')]=function(_0x15ec82,_0x18d524){var _0x3ded91={};var _0x34d854={};var _0x363ff3;var _0x54af23;return db[_0x0b47('0x20')][_0x0b47('0x41')]({'where':{'id':_0x15ec82['params']['id']}})[_0x0b47('0x17')](handleEntityNotFound(_0x18d524,null))[_0x0b47('0x17')](function(_0x2108e2){if(_0x2108e2){_0x363ff3=_0x2108e2;_0x34d854[_0x0b47('0x2c')]=_[_0x0b47('0x2d')](db[_0x0b47('0x53')]['rawAttributes']);_0x34d854[_0x0b47('0x2e')]=_[_0x0b47('0x2d')](_0x15ec82[_0x0b47('0x2e')]);_0x34d854[_0x0b47('0x2f')]=_['intersection'](_0x34d854[_0x0b47('0x2c')],_0x34d854[_0x0b47('0x2e')]);_0x3ded91[_0x0b47('0x31')]=_['intersection'](_0x34d854['model'],qs[_0x0b47('0x32')](_0x15ec82['query'][_0x0b47('0x32')]));_0x3ded91[_0x0b47('0x31')]=_0x3ded91[_0x0b47('0x31')][_0x0b47('0x43')]?_0x3ded91['attributes']:_0x34d854[_0x0b47('0x2c')];_0x3ded91[_0x0b47('0x54')]=qs[_0x0b47('0x46')](_0x15ec82[_0x0b47('0x2e')][_0x0b47('0x46')]);_0x3ded91['where']=qs['filters'](_[_0x0b47('0x47')](_0x15ec82[_0x0b47('0x2e')],_0x34d854[_0x0b47('0x2f')]));if(_0x15ec82['query'][_0x0b47('0x49')]){_0x3ded91['where']=_[_0x0b47('0x34')](_0x3ded91[_0x0b47('0x25')],{'$or':_[_0x0b47('0x1f')](_0x3ded91[_0x0b47('0x31')],function(_0x1a7265){var _0x40e51d={};_0x40e51d[_0x1a7265]={'$like':'%'+_0x15ec82[_0x0b47('0x2e')][_0x0b47('0x49')]+'%'};return _0x40e51d;})});}_0x3ded91=_[_0x0b47('0x34')]({},_0x3ded91,_0x15ec82[_0x0b47('0x55')]);return _0x363ff3[_0x0b47('0x52')](_0x3ded91);}})[_0x0b47('0x17')](function(_0x47dd74){if(_0x47dd74){_0x54af23=_0x47dd74[_0x0b47('0x43')];if(!_0x15ec82[_0x0b47('0x2e')][_0x0b47('0x44')](_0x0b47('0x45'))){_0x3ded91[_0x0b47('0x13')]=qs[_0x0b47('0x13')](_0x15ec82[_0x0b47('0x2e')]['limit']);_0x3ded91[_0x0b47('0x10')]=qs[_0x0b47('0x10')](_0x15ec82['query'][_0x0b47('0x10')]);}return _0x363ff3[_0x0b47('0x52')](_0x3ded91);}})['then'](function(_0x14b66b){if(_0x14b66b){return _0x14b66b?{'count':_0x54af23,'rows':_0x14b66b}:null;}})[_0x0b47('0x17')](respondWithResult(_0x18d524,null))[_0x0b47('0x29')](handleError(_0x18d524,null));};exports[_0x0b47('0x56')]=function(_0x34f2b8,_0xbe5003){var _0xb27e48=_0x34f2b8[_0x0b47('0x36')]['ids'];return db['Team'][_0x0b47('0x27')]({'where':{'id':_0xb27e48},'attributes':['id'],'include':[{'model':db[_0x0b47('0x4a')],'as':_0x0b47('0x57'),'attributes':['id',_0x0b47('0x1d'),_0x0b47('0x58'),_0x0b47('0x59'),_0x0b47('0x5a')],'raw':!![]}]})[_0x0b47('0x17')](function(_0x1ece91){if(_0x1ece91){var _0x183160=_[_0x0b47('0x5b')](_0x1ece91,function(_0x16b806){var _0x48c46a=_0x16b806[_0x0b47('0x37')]({'plain':!![]});return _0x48c46a[_0x0b47('0x57')];});return db['FaxQueue'][_0x0b47('0x3b')]({'where':{'id':_0x34f2b8[_0x0b47('0x2b')]['id']}})[_0x0b47('0x17')](function(_0x4634d4){return db[_0x0b47('0x5c')][_0x0b47('0x5d')](function(_0x1e824c){return _0x4634d4[_0x0b47('0x56')](_0xb27e48,{'transaction':_0x1e824c})[_0x0b47('0x17')](function(){return BPromise[_0x0b47('0x5e')](_0x183160,function(_0xbf0317){return db[_0x0b47('0x42')][_0x0b47('0x5f')]({'where':{'UserId':_0xbf0317['id'],'FaxQueueId':_0x34f2b8[_0x0b47('0x2b')]['id']},'transaction':_0x1e824c});});})[_0x0b47('0x17')](function(){_0x183160[_0x0b47('0x60')](function(_0x50600f){socket[_0x0b47('0x61')](_0x0b47('0x62'),{'UserId':_0x50600f['id'],'FaxQueueId':_0x4634d4['id']});});});});});}})[_0x0b47('0x17')](respondWithStatusCode(_0xbe5003,null))[_0x0b47('0x29')](handleError(_0xbe5003,null));};exports[_0x0b47('0x63')]=function(_0x59b5fb,_0x4511e6){return db['Team'][_0x0b47('0x27')]({'where':{'id':_0x59b5fb[_0x0b47('0x2e')][_0x0b47('0x64')]},'attributes':['id'],'include':[{'model':db[_0x0b47('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0b47('0x17')](handleEntityNotFound(_0x4511e6,null))[_0x0b47('0x17')](function(_0xf54f1a){var _0x3879a7=_[_0x0b47('0x1f')](_0xf54f1a,'id');var _0x12f0b7=[];var _0x3b4204=[];var _0x3d8ddf=squel['select']();_0x3d8ddf[_0x0b47('0x65')]('tq.TeamId')[_0x0b47('0x66')]('team_has_fax_queues','tq')['join'](_0x0b47('0x67'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0b47('0x25')](_0x0b47('0x68'),_0x59b5fb[_0x0b47('0x2b')]['id']);for(var _0x9ca191=0x0;_0x9ca191<_0xf54f1a[_0x0b47('0x43')];_0x9ca191+=0x1){let _0xdd8804=_0xf54f1a[_0x9ca191];for(var _0x4563bd=0x0;_0x4563bd<_0xdd8804[_0x0b47('0x57')][_0x0b47('0x43')];_0x4563bd+=0x1){let _0x29f242=_0xdd8804[_0x0b47('0x57')][_0x4563bd];var _0xaa2024=_0x3d8ddf['clone']();_0xaa2024[_0x0b47('0x25')](_0x0b47('0x69'),_0x29f242['id']);_0x3b4204[_0x0b47('0x6a')](db[_0x0b47('0x5c')]['query'](_0xaa2024[_0x0b47('0x6b')](),{'type':db[_0x0b47('0x5c')][_0x0b47('0x6c')]['SELECT']})[_0x0b47('0x17')](function(_0x3d14a3){if(_0x3d14a3[_0x0b47('0x43')]===0x1){return _0x29f242['id'];}else{var _0x4eb284=_['every'](_[_0x0b47('0x1f')](_0x3d14a3,_0x0b47('0x6d')),function(_0x43e9fe){return _[_0x0b47('0x6e')](_0x3879a7,_0x43e9fe);});if(_0x4eb284){return _0x29f242['id'];}}}));}}return BPromise[_0x0b47('0x6f')](_0x3b4204)[_0x0b47('0x17')](function(_0x1ab4bb){_0x12f0b7=_(_0x12f0b7)['union'](_0x1ab4bb)['compact']()[_0x0b47('0x70')]();return db[_0x0b47('0x20')][_0x0b47('0x3b')]({'where':{'id':_0x59b5fb['params']['id']}})[_0x0b47('0x17')](function(_0x3ca3e8){return db[_0x0b47('0x5c')][_0x0b47('0x5d')](function(_0x20a125){return _0x3ca3e8[_0x0b47('0x63')](_0x59b5fb[_0x0b47('0x2e')][_0x0b47('0x64')],{'transaction':_0x20a125})['then'](function(){if(!_['isEmpty'](_0x12f0b7)){return _0x3ca3e8[_0x0b47('0x71')](_0x12f0b7,{'transaction':_0x20a125});}})[_0x0b47('0x17')](function(){_0x12f0b7['forEach'](function(_0x46a97b){socket['emit']('userFaxQueue:remove',{'UserId':_0x46a97b,'FaxQueueId':_0x3ca3e8['id']});});});});});});})['then'](respondWithStatusCode(_0x4511e6,null))['catch'](handleError(_0x4511e6,null));};exports['addAgents']=function(_0x274ad8,_0x302a09){return db[_0x0b47('0x20')][_0x0b47('0x3b')]({'where':{'id':_0x274ad8[_0x0b47('0x2b')]['id']}})[_0x0b47('0x17')](handleEntityNotFound(_0x302a09,null))[_0x0b47('0x17')](function(_0x224cae){if(_0x224cae){return _0x224cae['addAgents'](_0x274ad8[_0x0b47('0x36')][_0x0b47('0x64')],_[_0x0b47('0x72')](_0x274ad8['body'],[_0x0b47('0x64'),'id'])||{})['spread'](function(_0x3c060e){for(var _0x3ad0ad=0x0;_0x3ad0ad<_0x274ad8[_0x0b47('0x36')][_0x0b47('0x64')][_0x0b47('0x43')];_0x3ad0ad+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x274ad8[_0x0b47('0x36')]['ids'][_0x3ad0ad]),'FaxQueueId':Number(_0x274ad8[_0x0b47('0x2b')]['id'])});}return _0x3c060e;});}})['then'](respondWithResult(_0x302a09,null))[_0x0b47('0x29')](handleError(_0x302a09,null));};exports['removeAgents']=function(_0x118292,_0xbe0cda){return db[_0x0b47('0x20')][_0x0b47('0x3b')]({'where':{'id':_0x118292[_0x0b47('0x2b')]['id']}})[_0x0b47('0x17')](handleEntityNotFound(_0xbe0cda,null))[_0x0b47('0x17')](function(_0x15adf6){if(_0x15adf6){return _0x15adf6['removeAgents'](_0x118292['query'][_0x0b47('0x64')])['then'](function(){if(_[_0x0b47('0x73')](_0x118292[_0x0b47('0x2e')][_0x0b47('0x64')])){for(var _0x34b77b=0x0;_0x34b77b<_0x118292['query'][_0x0b47('0x64')]['length'];_0x34b77b+=0x1){socket[_0x0b47('0x61')](_0x0b47('0x74'),{'UserId':Number(_0x118292['query'][_0x0b47('0x64')][_0x34b77b]),'FaxQueueId':Number(_0x118292['params']['id'])});}}else{socket[_0x0b47('0x61')](_0x0b47('0x74'),{'UserId':Number(_0x118292[_0x0b47('0x2e')][_0x0b47('0x64')]),'FaxQueueId':Number(_0x118292[_0x0b47('0x2b')]['id'])});}});}})[_0x0b47('0x17')](respondWithStatusCode(_0xbe0cda,null))[_0x0b47('0x29')](handleError(_0xbe0cda,null));};exports[_0x0b47('0x75')]=function(_0x25288d,_0x1994c7){var _0x3a4917={};var _0x4d9588={};var _0x59fdf3;var _0x4055c3;return db[_0x0b47('0x20')][_0x0b47('0x41')]({'where':{'id':_0x25288d[_0x0b47('0x2b')]['id']}})[_0x0b47('0x17')](handleEntityNotFound(_0x1994c7,null))[_0x0b47('0x17')](function(_0x2ec526){if(_0x2ec526){_0x59fdf3=_0x2ec526;_0x4d9588[_0x0b47('0x2c')]=_[_0x0b47('0x2d')](db[_0x0b47('0x4a')][_0x0b47('0x76')]);_0x4d9588[_0x0b47('0x2e')]=_['keys'](_0x25288d[_0x0b47('0x2e')]);_0x4d9588[_0x0b47('0x2f')]=_[_0x0b47('0x30')](_0x4d9588[_0x0b47('0x2c')],_0x4d9588[_0x0b47('0x2e')]);_0x3a4917['attributes']=_[_0x0b47('0x30')](_0x4d9588[_0x0b47('0x2c')],qs[_0x0b47('0x32')](_0x25288d[_0x0b47('0x2e')][_0x0b47('0x32')]));_0x3a4917['attributes']=_0x3a4917[_0x0b47('0x31')][_0x0b47('0x43')]?_0x3a4917[_0x0b47('0x31')]:_0x4d9588[_0x0b47('0x2c')];_0x3a4917['order']=qs[_0x0b47('0x46')](_0x25288d[_0x0b47('0x2e')][_0x0b47('0x46')]);_0x3a4917[_0x0b47('0x25')]=qs[_0x0b47('0x2f')](_[_0x0b47('0x47')](_0x25288d[_0x0b47('0x2e')],_0x4d9588['filters']));if(_0x25288d[_0x0b47('0x2e')][_0x0b47('0x49')]){_0x3a4917[_0x0b47('0x25')]=_[_0x0b47('0x34')](_0x3a4917[_0x0b47('0x25')],{'$or':_['map'](_0x3a4917[_0x0b47('0x31')],function(_0x4ba1f7){var _0x70d119={};_0x70d119[_0x4ba1f7]={'$like':'%'+_0x25288d[_0x0b47('0x2e')]['filter']+'%'};return _0x70d119;})});}_0x3a4917=_[_0x0b47('0x34')]({},_0x3a4917,_0x25288d[_0x0b47('0x55')]);return _0x59fdf3['getAgents'](_0x3a4917);}})['then'](function(_0xbc0370){if(_0xbc0370){_0x4055c3=_0xbc0370[_0x0b47('0x43')];if(!_0x25288d['query']['hasOwnProperty'](_0x0b47('0x45'))){_0x3a4917[_0x0b47('0x13')]=qs[_0x0b47('0x13')](_0x25288d[_0x0b47('0x2e')]['limit']);_0x3a4917['offset']=qs[_0x0b47('0x10')](_0x25288d[_0x0b47('0x2e')][_0x0b47('0x10')]);}return _0x59fdf3[_0x0b47('0x75')](_0x3a4917);}})['then'](function(_0x31675a){if(_0x31675a){return _0x31675a?{'count':_0x4055c3,'rows':_0x31675a}:null;}})[_0x0b47('0x17')](respondWithResult(_0x1994c7,null))['catch'](handleError(_0x1994c7,null));}; \ No newline at end of file +var _0xba18=['set','Content-Range','update','then','destroy','get','FaxQueues','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','FaxQueue','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','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','describe','getMembers','UserFaxQueue','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','findAndCountAll','agent','faxPause','updatedAt','createdAt','format','SIP','findOne','options','getTeams','addTeams','ids','Team','User','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','includes','union','compact','value','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x3f9791,_0x32e4e9){var _0x1497eb=function(_0x2ba5a6){while(--_0x2ba5a6){_0x3f9791['push'](_0x3f9791['shift']());}};_0x1497eb(++_0x32e4e9);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x8ba1('0x0'));var util=require(_0x8ba1('0x1'));var _=require(_0x8ba1('0x2'));var squel=require(_0x8ba1('0x3'));var Redis=require(_0x8ba1('0x4'));var qs=require(_0x8ba1('0x5'));var logger=require(_0x8ba1('0x6'))(_0x8ba1('0x7'));var config=require('../../config/environment');var db=require(_0x8ba1('0x8'))['db'];config[_0x8ba1('0x9')]=_[_0x8ba1('0xa')](config[_0x8ba1('0x9')],{'host':_0x8ba1('0xb'),'port':0x18eb});var socket=require(_0x8ba1('0xc'))(new Redis(config['redis']));require(_0x8ba1('0xd'))[_0x8ba1('0xe')](socket);function respondWithStatusCode(_0x4dc6c4,_0x49709e){_0x49709e=_0x49709e||0xcc;return function(_0x4aa3e3){if(_0x4aa3e3){return _0x4dc6c4[_0x8ba1('0xf')](_0x49709e);}return _0x4dc6c4[_0x8ba1('0x10')](_0x49709e)['end']();};}function respondWithResult(_0x457158,_0x38aae9){_0x38aae9=_0x38aae9||0xc8;return function(_0x460e69){if(_0x460e69){return _0x457158[_0x8ba1('0x10')](_0x38aae9)[_0x8ba1('0x11')](_0x460e69);}};}function respondWithFilteredResult(_0x4c270f,_0x1d6e55){return function(_0x2bad04){if(_0x2bad04){var _0xd913ff=typeof _0x1d6e55[_0x8ba1('0x12')]===_0x8ba1('0x13')&&typeof _0x1d6e55[_0x8ba1('0x14')]==='undefined';var _0x108541=_0x2bad04[_0x8ba1('0x15')];var _0x2e81d1=_0xd913ff?0x0:_0x1d6e55[_0x8ba1('0x12')];var _0x4c8d5c=_0xd913ff?_0x2bad04['count']:_0x1d6e55['offset']+_0x1d6e55[_0x8ba1('0x14')];var _0x398f40;if(_0x4c8d5c>=_0x108541){_0x4c8d5c=_0x108541;_0x398f40=0xc8;}else{_0x398f40=0xce;}_0x4c270f[_0x8ba1('0x10')](_0x398f40);return _0x4c270f[_0x8ba1('0x16')](_0x8ba1('0x17'),_0x2e81d1+'-'+_0x4c8d5c+'/'+_0x108541)[_0x8ba1('0x11')](_0x2bad04);}return null;};}function saveUpdates(_0x107846){return function(_0x14d73b){if(_0x14d73b){return _0x14d73b[_0x8ba1('0x18')](_0x107846)[_0x8ba1('0x19')](function(_0x4d75fa){return _0x4d75fa;});}return null;};}function removeEntity(_0x4c6325){return function(_0x1a48fa){if(_0x1a48fa){return _0x1a48fa[_0x8ba1('0x1a')]()['then'](function(){var _0xd8bda0=_0x1a48fa[_0x8ba1('0x1b')]({'plain':!![]});var _0x3fadfc=_0x8ba1('0x1c');return db[_0x8ba1('0x1d')][_0x8ba1('0x1a')]({'where':{'type':_0x3fadfc,'resourceId':_0xd8bda0['id']}})['then'](function(){return _0x1a48fa;});})[_0x8ba1('0x19')](function(){_0x4c6325['status'](0xcc)[_0x8ba1('0x1e')]();});}};}function handleEntityNotFound(_0x244245){return function(_0x121cc4){if(!_0x121cc4){_0x244245[_0x8ba1('0xf')](0x194);}return _0x121cc4;};}function handleError(_0x4e66e1,_0x1d619c){_0x1d619c=_0x1d619c||0x1f4;return function(_0x25b65c){logger[_0x8ba1('0x1f')](_0x25b65c[_0x8ba1('0x20')]);if(_0x25b65c[_0x8ba1('0x21')]){delete _0x25b65c[_0x8ba1('0x21')];}_0x4e66e1[_0x8ba1('0x10')](_0x1d619c)[_0x8ba1('0x22')](_0x25b65c);};}exports[_0x8ba1('0x23')]=function(_0x31a38c,_0x3b205c){var _0x550d33={};var _0x5c924e={'count':0x0,'rows':[]};var _0x41c2bb=_[_0x8ba1('0x24')](db['FaxQueue'][_0x8ba1('0x25')],function(_0xef508d){return{'name':_0xef508d[_0x8ba1('0x26')],'type':_0xef508d[_0x8ba1('0x27')][_0x8ba1('0x28')]};});_0x550d33=qs[_0x8ba1('0x29')](_0x41c2bb,_0x31a38c);var _0x2acf1c={'where':_0x550d33[_0x8ba1('0x2a')]};return db[_0x8ba1('0x2b')][_0x8ba1('0x15')](_0x2acf1c)[_0x8ba1('0x19')](function(_0x136eef){_0x5c924e[_0x8ba1('0x15')]=_0x136eef;_0x550d33[_0x8ba1('0x2c')]=qs['include'](_0x31a38c[_0x8ba1('0x2d')]);return db[_0x8ba1('0x2b')][_0x8ba1('0x2e')](_0x550d33);})[_0x8ba1('0x19')](function(_0x243a0a){_0x5c924e[_0x8ba1('0x2f')]=_0x243a0a;return _0x5c924e;})['then'](respondWithFilteredResult(_0x3b205c,_0x550d33))[_0x8ba1('0x30')](handleError(_0x3b205c,null));};exports[_0x8ba1('0x31')]=function(_0x51d1c5,_0x1015c8){var _0x580b4a={'raw':!![],'where':{'id':_0x51d1c5[_0x8ba1('0x32')]['id']}},_0x1fb817={};_0x1fb817['model']=_[_0x8ba1('0x33')](db[_0x8ba1('0x2b')][_0x8ba1('0x25')]);_0x1fb817[_0x8ba1('0x2d')]=_[_0x8ba1('0x33')](_0x51d1c5['query']);_0x1fb817[_0x8ba1('0x34')]=_[_0x8ba1('0x35')](_0x1fb817[_0x8ba1('0x36')],_0x1fb817[_0x8ba1('0x2d')]);_0x580b4a[_0x8ba1('0x37')]=_[_0x8ba1('0x35')](_0x1fb817[_0x8ba1('0x36')],qs[_0x8ba1('0x38')](_0x51d1c5['query'][_0x8ba1('0x38')]));_0x580b4a[_0x8ba1('0x37')]=_0x580b4a[_0x8ba1('0x37')][_0x8ba1('0x39')]?_0x580b4a[_0x8ba1('0x37')]:_0x1fb817[_0x8ba1('0x36')];if(_0x51d1c5[_0x8ba1('0x2d')][_0x8ba1('0x3a')]){_0x580b4a[_0x8ba1('0x2c')]=[{'all':!![]}];}_0x580b4a=_[_0x8ba1('0x3b')]({},_0x580b4a,_0x51d1c5['options']);return db[_0x8ba1('0x2b')][_0x8ba1('0x3c')](_0x580b4a)[_0x8ba1('0x19')](handleEntityNotFound(_0x1015c8,null))[_0x8ba1('0x19')](respondWithResult(_0x1015c8,null))[_0x8ba1('0x30')](handleError(_0x1015c8,null));};exports[_0x8ba1('0x3d')]=function(_0x3034aa,_0x2db01a){return db[_0x8ba1('0x2b')][_0x8ba1('0x3d')](_0x3034aa['body'],{})['then'](function(_0x11ce52){var _0x3b02a6=_0x3034aa[_0x8ba1('0x3e')][_0x8ba1('0x1b')]({'plain':!![]});if(!_0x3b02a6)throw new Error(_0x8ba1('0x3f'));if(_0x3b02a6[_0x8ba1('0x40')]===_0x8ba1('0x3e')){var _0x64bf9e=_0x11ce52[_0x8ba1('0x1b')]({'plain':!![]});var _0x2305ff=_0x8ba1('0x1c');return db[_0x8ba1('0x41')][_0x8ba1('0x3c')]({'where':{'name':_0x2305ff,'userProfileId':_0x3b02a6[_0x8ba1('0x42')]},'raw':!![]})['then'](function(_0xf8c3b){if(_0xf8c3b&&_0xf8c3b[_0x8ba1('0x43')]===0x0){return db[_0x8ba1('0x1d')][_0x8ba1('0x3d')]({'name':_0x64bf9e['name'],'resourceId':_0x64bf9e['id'],'type':_0xf8c3b['name'],'sectionId':_0xf8c3b['id']},{})[_0x8ba1('0x19')](function(){return _0x11ce52;});}else{return _0x11ce52;}})[_0x8ba1('0x30')](function(_0x1d1ffd){logger[_0x8ba1('0x1f')](_0x8ba1('0x44'),_0x1d1ffd);throw _0x1d1ffd;});}return _0x11ce52;})['then'](respondWithResult(_0x2db01a,0xc9))[_0x8ba1('0x30')](handleError(_0x2db01a,null));};exports[_0x8ba1('0x18')]=function(_0x16bdb1,_0x5b02d8){if(_0x16bdb1[_0x8ba1('0x45')]['id']){delete _0x16bdb1[_0x8ba1('0x45')]['id'];}return db[_0x8ba1('0x2b')][_0x8ba1('0x3c')]({'where':{'id':_0x16bdb1[_0x8ba1('0x32')]['id']}})[_0x8ba1('0x19')](handleEntityNotFound(_0x5b02d8,null))['then'](saveUpdates(_0x16bdb1[_0x8ba1('0x45')],null))['then'](respondWithResult(_0x5b02d8,null))[_0x8ba1('0x30')](handleError(_0x5b02d8,null));};exports[_0x8ba1('0x1a')]=function(_0x3ce6f7,_0xe5cebc){return db[_0x8ba1('0x2b')][_0x8ba1('0x3c')]({'where':{'id':_0x3ce6f7['params']['id']}})[_0x8ba1('0x19')](handleEntityNotFound(_0xe5cebc,null))[_0x8ba1('0x19')](removeEntity(_0xe5cebc,null))['catch'](handleError(_0xe5cebc,null));};exports['describe']=function(_0x25200b,_0x3e285a){return db[_0x8ba1('0x2b')][_0x8ba1('0x46')]()[_0x8ba1('0x19')](respondWithResult(_0x3e285a,null))[_0x8ba1('0x30')](handleError(_0x3e285a,null));};exports[_0x8ba1('0x47')]=function(_0x2061df,_0x225653){var _0x195b8e={'raw':!![],'where':{}},_0x413285={},_0x144073;return db[_0x8ba1('0x2b')]['findOne']({'where':{'id':_0x2061df[_0x8ba1('0x32')]['id']}})[_0x8ba1('0x19')](handleEntityNotFound(_0x225653,null))[_0x8ba1('0x19')](function(_0x447881){if(_0x447881){_0x144073=_0x447881[_0x8ba1('0x1b')]({'plain':!![]});_0x413285[_0x8ba1('0x36')]=_[_0x8ba1('0x33')](db[_0x8ba1('0x48')][_0x8ba1('0x25')]);_0x413285[_0x8ba1('0x2d')]=_[_0x8ba1('0x33')](_0x2061df[_0x8ba1('0x2d')]);_0x413285[_0x8ba1('0x34')]=_[_0x8ba1('0x35')](_0x413285['model'],_0x413285[_0x8ba1('0x2d')]);_0x195b8e[_0x8ba1('0x37')]=_['intersection'](_0x413285[_0x8ba1('0x36')],qs[_0x8ba1('0x38')](_0x2061df[_0x8ba1('0x2d')][_0x8ba1('0x38')]));_0x195b8e[_0x8ba1('0x37')]=_0x195b8e['attributes']['length']?_0x195b8e[_0x8ba1('0x37')]:_0x413285[_0x8ba1('0x36')];if(!_0x2061df['query'][_0x8ba1('0x49')](_0x8ba1('0x4a'))){_0x195b8e[_0x8ba1('0x14')]=qs['limit'](_0x2061df[_0x8ba1('0x2d')][_0x8ba1('0x14')]);_0x195b8e[_0x8ba1('0x12')]=qs['offset'](_0x2061df[_0x8ba1('0x2d')][_0x8ba1('0x12')]);}_0x195b8e[_0x8ba1('0x4b')]=qs[_0x8ba1('0x4c')](_0x2061df['query'][_0x8ba1('0x4c')]);_0x195b8e[_0x8ba1('0x2a')]=qs[_0x8ba1('0x34')](_[_0x8ba1('0x4d')](_0x2061df[_0x8ba1('0x2d')],_0x413285['filters']));_0x195b8e[_0x8ba1('0x2a')][_0x8ba1('0x4e')]=_0x447881['id'];if(_0x2061df[_0x8ba1('0x2d')][_0x8ba1('0x4f')]){_0x195b8e['where']=_[_0x8ba1('0x3b')](_0x195b8e[_0x8ba1('0x2a')],{'$or':_[_0x8ba1('0x24')](_0x195b8e[_0x8ba1('0x37')],function(_0x417f6e){var _0x13d1df={};_0x13d1df[_0x417f6e]={'$like':'%'+_0x2061df['query'][_0x8ba1('0x4f')]+'%'};return _0x13d1df;})});}_0x195b8e=_['merge']({},_0x195b8e,_0x2061df['options']);return db[_0x8ba1('0x48')]['findAll'](_0x195b8e);}})[_0x8ba1('0x19')](function(_0x42c4e8){if(_0x42c4e8){return db['User'][_0x8ba1('0x50')]({'where':{'id':_['map'](_0x42c4e8,'UserId'),'role':_0x8ba1('0x51')},'attributes':['id','name',_0x8ba1('0x52'),_0x8ba1('0x53'),_0x8ba1('0x54')]});}})[_0x8ba1('0x19')](function(_0xc0550b){if(_0xc0550b){return{'count':_0xc0550b[_0x8ba1('0x15')],'rows':_['map'](_0xc0550b[_0x8ba1('0x2f')],function(_0x48ed68){return{'membername':_0x48ed68[_0x8ba1('0x21')],'UserId':_0x48ed68['id'],'queue_name':_0x144073['name'],'FaxQueueId':_0x144073['id'],'interface':util[_0x8ba1('0x55')]('%s/%s',_0x8ba1('0x56'),_0x48ed68[_0x8ba1('0x21')]),'penalty':0x0,'paused':_0x48ed68[_0x8ba1('0x52')],'createdAt':_0x48ed68[_0x8ba1('0x54')],'updatedAt':_0x48ed68[_0x8ba1('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x225653,_0x195b8e))['catch'](handleError(_0x225653,null));};exports['getTeams']=function(_0x52a539,_0x12e7e9){var _0x10b9fa={};var _0x27b704={};var _0x24d33a;var _0x594244;return db[_0x8ba1('0x2b')][_0x8ba1('0x57')]({'where':{'id':_0x52a539[_0x8ba1('0x32')]['id']}})[_0x8ba1('0x19')](handleEntityNotFound(_0x12e7e9,null))['then'](function(_0x5e4e6e){if(_0x5e4e6e){_0x24d33a=_0x5e4e6e;_0x27b704['model']=_[_0x8ba1('0x33')](db['Team'][_0x8ba1('0x25')]);_0x27b704[_0x8ba1('0x2d')]=_[_0x8ba1('0x33')](_0x52a539['query']);_0x27b704[_0x8ba1('0x34')]=_['intersection'](_0x27b704[_0x8ba1('0x36')],_0x27b704[_0x8ba1('0x2d')]);_0x10b9fa[_0x8ba1('0x37')]=_[_0x8ba1('0x35')](_0x27b704[_0x8ba1('0x36')],qs[_0x8ba1('0x38')](_0x52a539[_0x8ba1('0x2d')][_0x8ba1('0x38')]));_0x10b9fa[_0x8ba1('0x37')]=_0x10b9fa['attributes'][_0x8ba1('0x39')]?_0x10b9fa[_0x8ba1('0x37')]:_0x27b704[_0x8ba1('0x36')];_0x10b9fa[_0x8ba1('0x4b')]=qs[_0x8ba1('0x4c')](_0x52a539[_0x8ba1('0x2d')]['sort']);_0x10b9fa[_0x8ba1('0x2a')]=qs[_0x8ba1('0x34')](_['pick'](_0x52a539[_0x8ba1('0x2d')],_0x27b704[_0x8ba1('0x34')]));if(_0x52a539[_0x8ba1('0x2d')][_0x8ba1('0x4f')]){_0x10b9fa['where']=_[_0x8ba1('0x3b')](_0x10b9fa[_0x8ba1('0x2a')],{'$or':_[_0x8ba1('0x24')](_0x10b9fa[_0x8ba1('0x37')],function(_0x162a33){var _0x1434bc={};_0x1434bc[_0x162a33]={'$like':'%'+_0x52a539['query'][_0x8ba1('0x4f')]+'%'};return _0x1434bc;})});}_0x10b9fa=_[_0x8ba1('0x3b')]({},_0x10b9fa,_0x52a539[_0x8ba1('0x58')]);return _0x24d33a[_0x8ba1('0x59')](_0x10b9fa);}})[_0x8ba1('0x19')](function(_0x23e8e2){if(_0x23e8e2){_0x594244=_0x23e8e2[_0x8ba1('0x39')];if(!_0x52a539['query'][_0x8ba1('0x49')](_0x8ba1('0x4a'))){_0x10b9fa[_0x8ba1('0x14')]=qs[_0x8ba1('0x14')](_0x52a539[_0x8ba1('0x2d')][_0x8ba1('0x14')]);_0x10b9fa['offset']=qs[_0x8ba1('0x12')](_0x52a539['query'][_0x8ba1('0x12')]);}return _0x24d33a['getTeams'](_0x10b9fa);}})['then'](function(_0x5b3f0b){if(_0x5b3f0b){return _0x5b3f0b?{'count':_0x594244,'rows':_0x5b3f0b}:null;}})[_0x8ba1('0x19')](respondWithResult(_0x12e7e9,null))[_0x8ba1('0x30')](handleError(_0x12e7e9,null));};exports[_0x8ba1('0x5a')]=function(_0x576fd3,_0x27cc85){var _0x88506=_0x576fd3[_0x8ba1('0x45')][_0x8ba1('0x5b')];return db[_0x8ba1('0x5c')][_0x8ba1('0x2e')]({'where':{'id':_0x88506},'attributes':['id'],'include':[{'model':db[_0x8ba1('0x5d')],'as':_0x8ba1('0x5e'),'attributes':['id','name',_0x8ba1('0x5f'),'voicePause',_0x8ba1('0x60')],'raw':!![]}]})[_0x8ba1('0x19')](function(_0x94947f){if(_0x94947f){var _0x488294=_[_0x8ba1('0x61')](_0x94947f,function(_0x34c8c8){var _0x3308fa=_0x34c8c8[_0x8ba1('0x1b')]({'plain':!![]});return _0x3308fa[_0x8ba1('0x5e')];});return db[_0x8ba1('0x2b')]['find']({'where':{'id':_0x576fd3[_0x8ba1('0x32')]['id']}})[_0x8ba1('0x19')](function(_0x5b62ab){return db[_0x8ba1('0x62')][_0x8ba1('0x63')](function(_0x45d5b2){return _0x5b62ab[_0x8ba1('0x5a')](_0x88506,{'transaction':_0x45d5b2})[_0x8ba1('0x19')](function(){return BPromise['each'](_0x488294,function(_0x1ff266){return db[_0x8ba1('0x48')][_0x8ba1('0x64')]({'where':{'UserId':_0x1ff266['id'],'FaxQueueId':_0x576fd3[_0x8ba1('0x32')]['id']},'transaction':_0x45d5b2});});})[_0x8ba1('0x19')](function(){_0x488294[_0x8ba1('0x65')](function(_0xfd5022){socket[_0x8ba1('0x66')]('userFaxQueue:save',{'UserId':_0xfd5022['id'],'FaxQueueId':_0x5b62ab['id']});});});});});}})[_0x8ba1('0x19')](respondWithStatusCode(_0x27cc85,null))[_0x8ba1('0x30')](handleError(_0x27cc85,null));};exports['removeTeams']=function(_0x10a876,_0x83447e){return db[_0x8ba1('0x5c')]['findAll']({'where':{'id':_0x10a876[_0x8ba1('0x2d')][_0x8ba1('0x5b')]},'attributes':['id'],'include':[{'model':db[_0x8ba1('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8ba1('0x19')](handleEntityNotFound(_0x83447e,null))[_0x8ba1('0x19')](function(_0x586f79){var _0x2ba03b=_[_0x8ba1('0x24')](_0x586f79,'id');var _0x365f15=[];var _0x3740df=[];var _0x531104=squel['select']();_0x531104[_0x8ba1('0x67')](_0x8ba1('0x68'))[_0x8ba1('0x69')]('team_has_fax_queues','tq')[_0x8ba1('0x6a')]('user_has_teams','ut',_0x8ba1('0x6b'))[_0x8ba1('0x2a')]('FaxQueueId\x20=\x20?',_0x10a876['params']['id']);for(var _0x534fdc=0x0;_0x534fdc<_0x586f79[_0x8ba1('0x39')];_0x534fdc+=0x1){let _0x343fab=_0x586f79[_0x534fdc];for(var _0x2218eb=0x0;_0x2218eb<_0x343fab[_0x8ba1('0x5e')][_0x8ba1('0x39')];_0x2218eb+=0x1){let _0x64246=_0x343fab[_0x8ba1('0x5e')][_0x2218eb];var _0x170ab6=_0x531104[_0x8ba1('0x6c')]();_0x170ab6['where']('ut.UserId\x20=\x20?',_0x64246['id']);_0x3740df[_0x8ba1('0x6d')](db[_0x8ba1('0x62')]['query'](_0x170ab6[_0x8ba1('0x6e')](),{'type':db['sequelize'][_0x8ba1('0x6f')][_0x8ba1('0x70')]})[_0x8ba1('0x19')](function(_0x3127fd){if(_0x3127fd[_0x8ba1('0x39')]===0x1){return _0x64246['id'];}else{var _0x5ab322=_[_0x8ba1('0x71')](_[_0x8ba1('0x24')](_0x3127fd,'TeamId'),function(_0x5c01e5){return _[_0x8ba1('0x72')](_0x2ba03b,_0x5c01e5);});if(_0x5ab322){return _0x64246['id'];}}}));}}return BPromise['all'](_0x3740df)[_0x8ba1('0x19')](function(_0x2c9e1d){_0x365f15=_(_0x365f15)[_0x8ba1('0x73')](_0x2c9e1d)[_0x8ba1('0x74')]()[_0x8ba1('0x75')]();return db[_0x8ba1('0x2b')]['find']({'where':{'id':_0x10a876['params']['id']}})[_0x8ba1('0x19')](function(_0x42c7d7){return db[_0x8ba1('0x62')][_0x8ba1('0x63')](function(_0x3362fd){return _0x42c7d7[_0x8ba1('0x76')](_0x10a876[_0x8ba1('0x2d')][_0x8ba1('0x5b')],{'transaction':_0x3362fd})[_0x8ba1('0x19')](function(){if(!_[_0x8ba1('0x77')](_0x365f15)){return _0x42c7d7[_0x8ba1('0x78')](_0x365f15,{'transaction':_0x3362fd});}})[_0x8ba1('0x19')](function(){_0x365f15[_0x8ba1('0x65')](function(_0x1a32bd){socket[_0x8ba1('0x66')](_0x8ba1('0x79'),{'UserId':_0x1a32bd,'FaxQueueId':_0x42c7d7['id']});});});});});});})['then'](respondWithStatusCode(_0x83447e,null))[_0x8ba1('0x30')](handleError(_0x83447e,null));};exports[_0x8ba1('0x7a')]=function(_0x3c816d,_0x2331b3){return db[_0x8ba1('0x2b')][_0x8ba1('0x3c')]({'where':{'id':_0x3c816d[_0x8ba1('0x32')]['id']}})[_0x8ba1('0x19')](handleEntityNotFound(_0x2331b3,null))['then'](function(_0x1fce95){if(_0x1fce95){return _0x1fce95[_0x8ba1('0x7a')](_0x3c816d[_0x8ba1('0x45')][_0x8ba1('0x5b')],_[_0x8ba1('0x7b')](_0x3c816d[_0x8ba1('0x45')],[_0x8ba1('0x5b'),'id'])||{})[_0x8ba1('0x7c')](function(_0x966f54){for(var _0xb0e292=0x0;_0xb0e292<_0x3c816d[_0x8ba1('0x45')][_0x8ba1('0x5b')][_0x8ba1('0x39')];_0xb0e292+=0x1){socket[_0x8ba1('0x66')](_0x8ba1('0x7d'),{'UserId':Number(_0x3c816d[_0x8ba1('0x45')][_0x8ba1('0x5b')][_0xb0e292]),'FaxQueueId':Number(_0x3c816d['params']['id'])});}return _0x966f54;});}})[_0x8ba1('0x19')](respondWithResult(_0x2331b3,null))[_0x8ba1('0x30')](handleError(_0x2331b3,null));};exports['removeAgents']=function(_0x2ba9d9,_0x120f59){return db[_0x8ba1('0x2b')][_0x8ba1('0x3c')]({'where':{'id':_0x2ba9d9[_0x8ba1('0x32')]['id']}})[_0x8ba1('0x19')](handleEntityNotFound(_0x120f59,null))[_0x8ba1('0x19')](function(_0x4f1e28){if(_0x4f1e28){return _0x4f1e28[_0x8ba1('0x78')](_0x2ba9d9['query'][_0x8ba1('0x5b')])[_0x8ba1('0x19')](function(){if(_[_0x8ba1('0x7e')](_0x2ba9d9[_0x8ba1('0x2d')][_0x8ba1('0x5b')])){for(var _0x4d4a11=0x0;_0x4d4a11<_0x2ba9d9['query'][_0x8ba1('0x5b')][_0x8ba1('0x39')];_0x4d4a11+=0x1){socket['emit'](_0x8ba1('0x79'),{'UserId':Number(_0x2ba9d9['query'][_0x8ba1('0x5b')][_0x4d4a11]),'FaxQueueId':Number(_0x2ba9d9['params']['id'])});}}else{socket[_0x8ba1('0x66')](_0x8ba1('0x79'),{'UserId':Number(_0x2ba9d9[_0x8ba1('0x2d')][_0x8ba1('0x5b')]),'FaxQueueId':Number(_0x2ba9d9[_0x8ba1('0x32')]['id'])});}});}})[_0x8ba1('0x19')](respondWithStatusCode(_0x120f59,null))['catch'](handleError(_0x120f59,null));};exports[_0x8ba1('0x7f')]=function(_0x3a559a,_0x40d653){var _0x2261be={};var _0x517c5={};var _0xf19593;var _0x127db6;return db[_0x8ba1('0x2b')][_0x8ba1('0x57')]({'where':{'id':_0x3a559a[_0x8ba1('0x32')]['id']}})['then'](handleEntityNotFound(_0x40d653,null))[_0x8ba1('0x19')](function(_0x4ba027){if(_0x4ba027){_0xf19593=_0x4ba027;_0x517c5['model']=_['keys'](db['User']['rawAttributes']);_0x517c5[_0x8ba1('0x2d')]=_[_0x8ba1('0x33')](_0x3a559a[_0x8ba1('0x2d')]);_0x517c5[_0x8ba1('0x34')]=_[_0x8ba1('0x35')](_0x517c5[_0x8ba1('0x36')],_0x517c5[_0x8ba1('0x2d')]);_0x2261be[_0x8ba1('0x37')]=_['intersection'](_0x517c5[_0x8ba1('0x36')],qs['fields'](_0x3a559a[_0x8ba1('0x2d')][_0x8ba1('0x38')]));_0x2261be[_0x8ba1('0x37')]=_0x2261be[_0x8ba1('0x37')][_0x8ba1('0x39')]?_0x2261be['attributes']:_0x517c5[_0x8ba1('0x36')];_0x2261be[_0x8ba1('0x4b')]=qs[_0x8ba1('0x4c')](_0x3a559a[_0x8ba1('0x2d')][_0x8ba1('0x4c')]);_0x2261be['where']=qs[_0x8ba1('0x34')](_['pick'](_0x3a559a[_0x8ba1('0x2d')],_0x517c5[_0x8ba1('0x34')]));if(_0x3a559a[_0x8ba1('0x2d')][_0x8ba1('0x4f')]){_0x2261be[_0x8ba1('0x2a')]=_[_0x8ba1('0x3b')](_0x2261be[_0x8ba1('0x2a')],{'$or':_[_0x8ba1('0x24')](_0x2261be['attributes'],function(_0x5b3663){var _0x41e61e={};_0x41e61e[_0x5b3663]={'$like':'%'+_0x3a559a['query']['filter']+'%'};return _0x41e61e;})});}_0x2261be=_[_0x8ba1('0x3b')]({},_0x2261be,_0x3a559a['options']);return _0xf19593[_0x8ba1('0x7f')](_0x2261be);}})[_0x8ba1('0x19')](function(_0x157d91){if(_0x157d91){_0x127db6=_0x157d91[_0x8ba1('0x39')];if(!_0x3a559a[_0x8ba1('0x2d')]['hasOwnProperty'](_0x8ba1('0x4a'))){_0x2261be['limit']=qs[_0x8ba1('0x14')](_0x3a559a[_0x8ba1('0x2d')][_0x8ba1('0x14')]);_0x2261be['offset']=qs[_0x8ba1('0x12')](_0x3a559a[_0x8ba1('0x2d')]['offset']);}return _0xf19593[_0x8ba1('0x7f')](_0x2261be);}})[_0x8ba1('0x19')](function(_0x422ac5){if(_0x422ac5){return _0x422ac5?{'count':_0x127db6,'rows':_0x422ac5}:null;}})[_0x8ba1('0x19')](respondWithResult(_0x40d653,null))[_0x8ba1('0x30')](handleError(_0x40d653,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 4ad8429..233b29a 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 _0x95f3=['emit','hasOwnProperty','exports','../../mysqldb','FaxQueue','setMaxListeners','save','remove'];(function(_0x43073b,_0x26cd7c){var _0x5210e3=function(_0x12e176){while(--_0x12e176){_0x43073b['push'](_0x43073b['shift']());}};_0x5210e3(++_0x26cd7c);}(_0x95f3,0x1ab));var _0x395f=function(_0xa90e84,_0x19a470){_0xa90e84=_0xa90e84-0x0;var _0x5d264d=_0x95f3[_0xa90e84];return _0x5d264d;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x395f('0x0'))['db'][_0x395f('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x395f('0x2')](0x0);var events={'afterCreate':_0x395f('0x3'),'afterUpdate':'update','afterDestroy':_0x395f('0x4')};function emitEvent(_0x5b5637){return function(_0x209b92,_0x4569c8,_0x5f2191){FaxQueueEvents[_0x395f('0x5')](_0x5b5637+':'+_0x209b92['id'],_0x209b92);FaxQueueEvents['emit'](_0x5b5637,_0x209b92);_0x5f2191(null);};}for(var e in events){if(events[_0x395f('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x395f('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xbe7f=['hasOwnProperty','hook','exports','../../mysqldb','FaxQueue','save','update','remove','emit'];(function(_0x53ba69,_0x295206){var _0x29f2f0=function(_0x4d2dc8){while(--_0x4d2dc8){_0x53ba69['push'](_0x53ba69['shift']());}};_0x29f2f0(++_0x295206);}(_0xbe7f,0x1bc));var _0xfbe7=function(_0x2f4d41,_0x525047){_0x2f4d41=_0x2f4d41-0x0;var _0x3b0bb2=_0xbe7f[_0x2f4d41];return _0x3b0bb2;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xfbe7('0x0'))['db'][_0xfbe7('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfbe7('0x2'),'afterUpdate':_0xfbe7('0x3'),'afterDestroy':_0xfbe7('0x4')};function emitEvent(_0x310406){return function(_0x44549b,_0x2a537e,_0x568bc3){FaxQueueEvents['emit'](_0x310406+':'+_0x44549b['id'],_0x44549b);FaxQueueEvents[_0xfbe7('0x5')](_0x310406,_0x44549b);_0x568bc3(null);};}for(var e in events){if(events[_0xfbe7('0x6')](e)){var event=events[e];FaxQueue[_0xfbe7('0x7')](e,emitEvent(event));}}module[_0xfbe7('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 1f203fd..2cd733f 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 _0xf586=['bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','lodash','util','api'];(function(_0x38e3f3,_0x39a49a){var _0x4ca93d=function(_0x17a89e){while(--_0x17a89e){_0x38e3f3['push'](_0x38e3f3['shift']());}};_0x4ca93d(++_0x39a49a);}(_0xf586,0x189));var _0x6f58=function(_0x25ba6a,_0x4422d6){_0x25ba6a=_0x25ba6a-0x0;var _0x1be09a=_0xf586[_0x25ba6a];return _0x1be09a;};'use strict';var _=require(_0x6f58('0x0'));var util=require(_0x6f58('0x1'));var logger=require('../../config/logger')(_0x6f58('0x2'));var moment=require('moment');var BPromise=require(_0x6f58('0x3'));var rp=require(_0x6f58('0x4'));var fs=require('fs');var path=require(_0x6f58('0x5'));var rimraf=require(_0x6f58('0x6'));var config=require(_0x6f58('0x7'));var attributes=require(_0x6f58('0x8'));module[_0x6f58('0x9')]=function(_0x5ab943,_0x267f47){return _0x5ab943[_0x6f58('0xa')](_0x6f58('0xb'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ed7=['request-promise','path','rimraf','../../config/environment','fax_queues','lodash','util','api','bluebird'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x5ed7,0xdd));var _0x75ed=function(_0x402d1a,_0x52b2ae){_0x402d1a=_0x402d1a-0x0;var _0x2902c4=_0x5ed7[_0x402d1a];return _0x2902c4;};'use strict';var _=require(_0x75ed('0x0'));var util=require(_0x75ed('0x1'));var logger=require('../../config/logger')(_0x75ed('0x2'));var moment=require('moment');var BPromise=require(_0x75ed('0x3'));var rp=require(_0x75ed('0x4'));var fs=require('fs');var path=require(_0x75ed('0x5'));var rimraf=require(_0x75ed('0x6'));var config=require(_0x75ed('0x7'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x382b69,_0x1b1d02){return _0x382b69['define']('FaxQueue',attributes,{'tableName':_0x75ed('0x8'),'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 2e3d8e0..de36248 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 _0xb0fd=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','attributes','include','map','model','then','GetFaxQueue','ShowFaxQueue','FaxQueue','find','lodash'];(function(_0x2e7c23,_0x2598dd){var _0x34ca89=function(_0x29646b){while(--_0x29646b){_0x2e7c23['push'](_0x2e7c23['shift']());}};_0x34ca89(++_0x2598dd);}(_0xb0fd,0x109));var _0xdb0f=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xb0fd[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xdb0f('0x0'));var util=require(_0xdb0f('0x1'));var moment=require(_0xdb0f('0x2'));var BPromise=require(_0xdb0f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb0f('0x4'));var db=require(_0xdb0f('0x5'))['db'];var utils=require(_0xdb0f('0x6'));var logger=require(_0xdb0f('0x7'))(_0xdb0f('0x8'));var config=require('../../config/environment');var jayson=require(_0xdb0f('0x9'));var client=jayson[_0xdb0f('0xa')][_0xdb0f('0xb')]({'port':0x232a});config[_0xdb0f('0xc')]=_[_0xdb0f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdb0f('0xe'))(new Redis(config['redis']));require(_0xdb0f('0xf'))['register'](socket);function respondWithRpcPromise(_0x14db57,_0xb9da5d,_0x20d7ba){return new BPromise(function(_0x22bb34,_0x19de2d){return client['request'](_0x14db57,_0x20d7ba)['then'](function(_0x4250df){logger[_0xdb0f('0x10')](_0xdb0f('0x11'),_0xb9da5d,_0xdb0f('0x12'));logger[_0xdb0f('0x13')](_0xdb0f('0x14'),_0xb9da5d,_0xdb0f('0x12'),JSON[_0xdb0f('0x15')](_0x4250df));if(_0x4250df[_0xdb0f('0x16')]){if(_0x4250df['error']['code']===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0xb9da5d,_0x4250df['error'][_0xdb0f('0x17')]);return _0x19de2d(_0x4250df[_0xdb0f('0x16')][_0xdb0f('0x17')]);}logger[_0xdb0f('0x16')](_0xdb0f('0x11'),_0xb9da5d,_0x4250df[_0xdb0f('0x16')][_0xdb0f('0x17')]);return _0x22bb34(_0x4250df[_0xdb0f('0x16')][_0xdb0f('0x17')]);}else{logger[_0xdb0f('0x10')](_0xdb0f('0x11'),_0xb9da5d,'request\x20sent');_0x22bb34(_0x4250df[_0xdb0f('0x18')][_0xdb0f('0x17')]);}})[_0xdb0f('0x19')](function(_0x121a96){logger[_0xdb0f('0x16')]('FaxQueue,\x20%s,\x20%s',_0xb9da5d,_0x121a96);_0x19de2d(_0x121a96);});});}exports['GetFaxQueue']=function(_0x3b6d6a){var _0x31ad48=this;return new Promise(function(_0x1c219f,_0x506c81){return db['FaxQueue'][_0xdb0f('0x1a')]({'raw':_0x3b6d6a[_0xdb0f('0x1b')]?_0x3b6d6a[_0xdb0f('0x1b')][_0xdb0f('0x1c')]===undefined?!![]:![]:!![],'where':_0x3b6d6a[_0xdb0f('0x1b')]?_0x3b6d6a['options']['where']||null:null,'attributes':_0x3b6d6a[_0xdb0f('0x1b')]?_0x3b6d6a[_0xdb0f('0x1b')][_0xdb0f('0x1d')]||null:null,'limit':_0x3b6d6a[_0xdb0f('0x1b')]?_0x3b6d6a['options']['limit']||null:null,'include':_0x3b6d6a[_0xdb0f('0x1b')]?_0x3b6d6a[_0xdb0f('0x1b')][_0xdb0f('0x1e')]?_[_0xdb0f('0x1f')](_0x3b6d6a[_0xdb0f('0x1b')][_0xdb0f('0x1e')],function(_0x3afd4f){return{'model':db[_0x3afd4f[_0xdb0f('0x20')]],'as':_0x3afd4f['as'],'attributes':_0x3afd4f[_0xdb0f('0x1d')],'include':_0x3afd4f[_0xdb0f('0x1e')]?_['map'](_0x3afd4f['include'],function(_0x29f40b){return{'model':db[_0x29f40b[_0xdb0f('0x20')]],'as':_0x29f40b['as'],'attributes':_0x29f40b[_0xdb0f('0x1d')],'include':_0x29f40b[_0xdb0f('0x1e')]?_[_0xdb0f('0x1f')](_0x29f40b[_0xdb0f('0x1e')],function(_0xb0761b){return{'model':db[_0xb0761b[_0xdb0f('0x20')]],'as':_0xb0761b['as'],'attributes':_0xb0761b[_0xdb0f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdb0f('0x21')](function(_0x28c6ac){logger[_0xdb0f('0x10')](_0xdb0f('0x22'),_0x3b6d6a);logger[_0xdb0f('0x13')](_0xdb0f('0x22'),_0x3b6d6a,JSON[_0xdb0f('0x15')](_0x28c6ac));_0x1c219f(_0x28c6ac);})[_0xdb0f('0x19')](function(_0x406346){logger[_0xdb0f('0x16')](_0xdb0f('0x22'),_0x406346[_0xdb0f('0x17')],_0x3b6d6a);_0x506c81(_0x31ad48['error'](0x1f4,_0x406346[_0xdb0f('0x17')]));});});};exports[_0xdb0f('0x23')]=function(_0x142e3b){var _0x519816=this;return new Promise(function(_0x2bf059,_0x317e89){return db[_0xdb0f('0x24')][_0xdb0f('0x25')]({'raw':_0x142e3b[_0xdb0f('0x1b')]?_0x142e3b[_0xdb0f('0x1b')][_0xdb0f('0x1c')]===undefined?!![]:![]:!![],'where':_0x142e3b['options']?_0x142e3b[_0xdb0f('0x1b')]['where']||null:null,'attributes':_0x142e3b['options']?_0x142e3b['options'][_0xdb0f('0x1d')]||null:null,'include':_0x142e3b[_0xdb0f('0x1b')]?_0x142e3b[_0xdb0f('0x1b')][_0xdb0f('0x1e')]?_['map'](_0x142e3b[_0xdb0f('0x1b')][_0xdb0f('0x1e')],function(_0x476b8f){return{'model':db[_0x476b8f['model']],'as':_0x476b8f['as'],'attributes':_0x476b8f[_0xdb0f('0x1d')],'include':_0x476b8f[_0xdb0f('0x1e')]?_[_0xdb0f('0x1f')](_0x476b8f['include'],function(_0x3ca6cd){return{'model':db[_0x3ca6cd[_0xdb0f('0x20')]],'as':_0x3ca6cd['as'],'attributes':_0x3ca6cd[_0xdb0f('0x1d')],'include':_0x3ca6cd[_0xdb0f('0x1e')]?_['map'](_0x3ca6cd[_0xdb0f('0x1e')],function(_0x388a01){return{'model':db[_0x388a01['model']],'as':_0x388a01['as'],'attributes':_0x388a01[_0xdb0f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdb0f('0x21')](function(_0x1708a5){logger['info'](_0xdb0f('0x23'),_0x142e3b);logger[_0xdb0f('0x13')](_0xdb0f('0x23'),_0x142e3b,JSON[_0xdb0f('0x15')](_0x1708a5));_0x2bf059(_0x1708a5);})[_0xdb0f('0x19')](function(_0x32e1c0){logger[_0xdb0f('0x16')](_0xdb0f('0x23'),_0x32e1c0[_0xdb0f('0x17')],_0x142e3b);_0x317e89(_0x519816['error'](0x1f4,_0x32e1c0[_0xdb0f('0x17')]));});});}; \ No newline at end of file +var _0x70a8=['debug','find','ShowFaxQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxQueue'];(function(_0x15315,_0x257989){var _0x3f8a80=function(_0x3df02a){while(--_0x3df02a){_0x15315['push'](_0x15315['shift']());}};_0x3f8a80(++_0x257989);}(_0x70a8,0x1cb));var _0x870a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x70a8[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x870a('0x0'));var util=require('util');var moment=require(_0x870a('0x1'));var BPromise=require(_0x870a('0x2'));var rs=require(_0x870a('0x3'));var fs=require('fs');var Redis=require(_0x870a('0x4'));var db=require(_0x870a('0x5'))['db'];var utils=require(_0x870a('0x6'));var logger=require('../../config/logger')(_0x870a('0x7'));var config=require('../../config/environment');var jayson=require(_0x870a('0x8'));var client=jayson[_0x870a('0x9')][_0x870a('0xa')]({'port':0x232a});config[_0x870a('0xb')]=_[_0x870a('0xc')](config[_0x870a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x870a('0xd'))(new Redis(config[_0x870a('0xb')]));require(_0x870a('0xe'))['register'](socket);function respondWithRpcPromise(_0x422683,_0x5409b2,_0x39ae53){return new BPromise(function(_0x3f451a,_0x502f31){return client['request'](_0x422683,_0x39ae53)[_0x870a('0xf')](function(_0x5ba004){logger[_0x870a('0x10')](_0x870a('0x11'),_0x5409b2,_0x870a('0x12'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x5409b2,_0x870a('0x12'),JSON[_0x870a('0x13')](_0x5ba004));if(_0x5ba004['error']){if(_0x5ba004[_0x870a('0x14')]['code']===0x1f4){logger['error'](_0x870a('0x11'),_0x5409b2,_0x5ba004[_0x870a('0x14')][_0x870a('0x15')]);return _0x502f31(_0x5ba004[_0x870a('0x14')][_0x870a('0x15')]);}logger[_0x870a('0x14')](_0x870a('0x11'),_0x5409b2,_0x5ba004['error']['message']);return _0x3f451a(_0x5ba004[_0x870a('0x14')][_0x870a('0x15')]);}else{logger[_0x870a('0x10')](_0x870a('0x11'),_0x5409b2,_0x870a('0x12'));_0x3f451a(_0x5ba004[_0x870a('0x16')][_0x870a('0x15')]);}})[_0x870a('0x17')](function(_0x1e5944){logger[_0x870a('0x14')](_0x870a('0x11'),_0x5409b2,_0x1e5944);_0x502f31(_0x1e5944);});});}exports['GetFaxQueue']=function(_0x268827){var _0xdce902=this;return new Promise(function(_0x421e0a,_0x12271b){return db[_0x870a('0x18')][_0x870a('0x19')]({'raw':_0x268827['options']?_0x268827[_0x870a('0x1a')][_0x870a('0x1b')]===undefined?!![]:![]:!![],'where':_0x268827[_0x870a('0x1a')]?_0x268827[_0x870a('0x1a')][_0x870a('0x1c')]||null:null,'attributes':_0x268827['options']?_0x268827[_0x870a('0x1a')][_0x870a('0x1d')]||null:null,'limit':_0x268827['options']?_0x268827[_0x870a('0x1a')][_0x870a('0x1e')]||null:null,'include':_0x268827[_0x870a('0x1a')]?_0x268827[_0x870a('0x1a')][_0x870a('0x1f')]?_[_0x870a('0x20')](_0x268827[_0x870a('0x1a')]['include'],function(_0x3f9fbf){return{'model':db[_0x3f9fbf['model']],'as':_0x3f9fbf['as'],'attributes':_0x3f9fbf[_0x870a('0x1d')],'include':_0x3f9fbf['include']?_[_0x870a('0x20')](_0x3f9fbf[_0x870a('0x1f')],function(_0x1b7f2d){return{'model':db[_0x1b7f2d[_0x870a('0x21')]],'as':_0x1b7f2d['as'],'attributes':_0x1b7f2d[_0x870a('0x1d')],'include':_0x1b7f2d[_0x870a('0x1f')]?_[_0x870a('0x20')](_0x1b7f2d[_0x870a('0x1f')],function(_0xf08a34){return{'model':db[_0xf08a34[_0x870a('0x21')]],'as':_0xf08a34['as'],'attributes':_0xf08a34[_0x870a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x870a('0xf')](function(_0x5148c9){logger[_0x870a('0x10')](_0x870a('0x22'),_0x268827);logger[_0x870a('0x23')](_0x870a('0x22'),_0x268827,JSON[_0x870a('0x13')](_0x5148c9));_0x421e0a(_0x5148c9);})['catch'](function(_0xc934f6){logger[_0x870a('0x14')]('GetFaxQueue',_0xc934f6['message'],_0x268827);_0x12271b(_0xdce902[_0x870a('0x14')](0x1f4,_0xc934f6[_0x870a('0x15')]));});});};exports['ShowFaxQueue']=function(_0x47c4b5){var _0x1f1d00=this;return new Promise(function(_0x4b0e1e,_0x326c09){return db[_0x870a('0x18')][_0x870a('0x24')]({'raw':_0x47c4b5[_0x870a('0x1a')]?_0x47c4b5[_0x870a('0x1a')][_0x870a('0x1b')]===undefined?!![]:![]:!![],'where':_0x47c4b5[_0x870a('0x1a')]?_0x47c4b5[_0x870a('0x1a')][_0x870a('0x1c')]||null:null,'attributes':_0x47c4b5['options']?_0x47c4b5[_0x870a('0x1a')][_0x870a('0x1d')]||null:null,'include':_0x47c4b5[_0x870a('0x1a')]?_0x47c4b5[_0x870a('0x1a')][_0x870a('0x1f')]?_[_0x870a('0x20')](_0x47c4b5['options'][_0x870a('0x1f')],function(_0x2e97f3){return{'model':db[_0x2e97f3[_0x870a('0x21')]],'as':_0x2e97f3['as'],'attributes':_0x2e97f3[_0x870a('0x1d')],'include':_0x2e97f3[_0x870a('0x1f')]?_['map'](_0x2e97f3[_0x870a('0x1f')],function(_0x27fc33){return{'model':db[_0x27fc33['model']],'as':_0x27fc33['as'],'attributes':_0x27fc33[_0x870a('0x1d')],'include':_0x27fc33['include']?_['map'](_0x27fc33[_0x870a('0x1f')],function(_0x20765a){return{'model':db[_0x20765a['model']],'as':_0x20765a['as'],'attributes':_0x20765a[_0x870a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x870a('0xf')](function(_0x287bee){logger[_0x870a('0x10')](_0x870a('0x25'),_0x47c4b5);logger[_0x870a('0x23')](_0x870a('0x25'),_0x47c4b5,JSON['stringify'](_0x287bee));_0x4b0e1e(_0x287bee);})[_0x870a('0x17')](function(_0x33e3da){logger[_0x870a('0x14')](_0x870a('0x25'),_0x33e3da['message'],_0x47c4b5);_0x326c09(_0x1f1d00[_0x870a('0x14')](0x1f4,_0x33e3da[_0x870a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 50eb2e1..e1c3046 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 _0x4169=['emit','removeListener','register','faxQueue:','save','remove'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x4169,0x14e));var _0x9416=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4169[_0x321bb2];return _0x9c12ed;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x9416('0x0'),_0x9416('0x1'),'update'];function createListener(_0x24fda9,_0x211e3b){return function(_0x51bd35){_0x211e3b[_0x9416('0x2')](_0x24fda9,_0x51bd35);};}function removeListener(_0x53dbc5,_0x32572f){return function(){FaxQueueEvents[_0x9416('0x3')](_0x53dbc5,_0x32572f);};}exports[_0x9416('0x4')]=function(_0x4143f4){for(var _0x53b277=0x0,_0x341fe3=events['length'];_0x53b277<_0x341fe3;_0x53b277++){var _0x1f1a87=events[_0x53b277];var _0x4de595=createListener(_0x9416('0x5')+_0x1f1a87,_0x4143f4);FaxQueueEvents['on'](_0x1f1a87,_0x4de595);}}; \ No newline at end of file +var _0x1247=['register','length','./faxQueue.events','save','removeListener'];(function(_0x267be3,_0x18ef5f){var _0x57fe29=function(_0x5bb754){while(--_0x5bb754){_0x267be3['push'](_0x267be3['shift']());}};_0x57fe29(++_0x18ef5f);}(_0x1247,0xb6));var _0x7124=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x1247[_0x1b4b23];return _0x2a325b;};'use strict';var FaxQueueEvents=require(_0x7124('0x0'));var events=[_0x7124('0x1'),'remove','update'];function createListener(_0xb217bf,_0x461882){return function(_0x37ccf8){_0x461882['emit'](_0xb217bf,_0x37ccf8);};}function removeListener(_0x3bdce3,_0x3ab32e){return function(){FaxQueueEvents[_0x7124('0x2')](_0x3bdce3,_0x3ab32e);};}exports[_0x7124('0x3')]=function(_0x15ba0c){for(var _0x33f61b=0x0,_0x396f11=events[_0x7124('0x4')];_0x33f61b<_0x396f11;_0x33f61b++){var _0x29d7b2=events[_0x33f61b];var _0x3b5a48=createListener('faxQueue:'+_0x29d7b2,_0x15ba0c);FaxQueueEvents['on'](_0x29d7b2,_0x3b5a48);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 57c65bd..c8cf8ed 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 _0x741c=['getMembers','/:id/teams','getTeams','post','create','addTeams','addAgents','put','destroy','delete','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x408add,_0x231ed3){var _0x225522=function(_0x4c8bb8){while(--_0x4c8bb8){_0x408add['push'](_0x408add['shift']());}};_0x225522(++_0x231ed3);}(_0x741c,0x196));var _0xc741=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x741c[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['describe']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['get']('/:id/members',auth[_0xc741('0x9')](),controller[_0xc741('0xe')]);router[_0xc741('0x8')](_0xc741('0xf'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);router[_0xc741('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xc741('0x11')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0x12')]);router[_0xc741('0x11')](_0xc741('0xf'),auth['isAuthenticated'](),controller[_0xc741('0x13')]);router[_0xc741('0x11')]('/:id/users',auth[_0xc741('0x9')](),controller[_0xc741('0x14')]);router[_0xc741('0x15')](_0xc741('0xc'),auth[_0xc741('0x9')](),controller['update']);router['delete'](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0x16')]);router[_0xc741('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0xc741('0x18')]);router[_0xc741('0x17')](_0xc741('0x19'),auth['isAuthenticated'](),controller[_0xc741('0x1a')]);module[_0xc741('0x1b')]=router; \ No newline at end of file +var _0x6931=['post','create','addAgents','removeTeams','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x246573,_0x856eb9){var _0x441c04=function(_0x2a28bb){while(--_0x2a28bb){_0x246573['push'](_0x246573['shift']());}};_0x441c04(++_0x856eb9);}(_0x6931,0x1a9));var _0x1693=function(_0x48b130,_0x102ad8){_0x48b130=_0x48b130-0x0;var _0x1859c7=_0x6931[_0x48b130];return _0x1859c7;};'use strict';var multer=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var path=require(_0x1693('0x2'));var timeout=require(_0x1693('0x3'));var express=require(_0x1693('0x4'));var router=express[_0x1693('0x5')]();var fs_extra=require(_0x1693('0x6'));var auth=require(_0x1693('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1693('0x8'));var controller=require(_0x1693('0x9'));router[_0x1693('0xa')]('/',auth[_0x1693('0xb')](),controller[_0x1693('0xc')]);router['get'](_0x1693('0xd'),auth[_0x1693('0xb')](),controller[_0x1693('0xe')]);router['get'](_0x1693('0xf'),auth[_0x1693('0xb')](),controller[_0x1693('0x10')]);router[_0x1693('0xa')](_0x1693('0x11'),auth[_0x1693('0xb')](),controller[_0x1693('0x12')]);router[_0x1693('0xa')](_0x1693('0x13'),auth[_0x1693('0xb')](),controller[_0x1693('0x14')]);router['get'](_0x1693('0x15'),auth[_0x1693('0xb')](),controller[_0x1693('0x16')]);router[_0x1693('0x17')]('/',auth[_0x1693('0xb')](),controller[_0x1693('0x18')]);router[_0x1693('0x17')]('/:id/teams',auth[_0x1693('0xb')](),controller['addTeams']);router[_0x1693('0x17')]('/:id/users',auth[_0x1693('0xb')](),controller[_0x1693('0x19')]);router['put']('/:id',auth[_0x1693('0xb')](),controller['update']);router['delete']('/:id',auth[_0x1693('0xb')](),controller['destroy']);router['delete'](_0x1693('0x13'),auth[_0x1693('0xb')](),controller[_0x1693('0x1a')]);router[_0x1693('0x1b')](_0x1693('0x15'),auth[_0x1693('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 093534c..1d220bd 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 _0x93b2=['moment','sequelize','exports','STRING','DATE'];(function(_0x5eb9c8,_0x55b365){var _0x3a6a21=function(_0x3bdbdd){while(--_0x3bdbdd){_0x5eb9c8['push'](_0x5eb9c8['shift']());}};_0x3a6a21(++_0x55b365);}(_0x93b2,0x104));var _0x293b=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x93b2[_0x53ccf2];return _0x5a2964;};'use strict';var moment=require(_0x293b('0x0'));var Sequelize=require(_0x293b('0x1'));module[_0x293b('0x2')]={'uniqueid':{'type':Sequelize[_0x293b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x293b('0x3')]},'joinAt':{'type':Sequelize[_0x293b('0x4')]},'leaveAt':{'type':Sequelize[_0x293b('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x293b('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2929=['STRING','DATE','moment','sequelize','exports'];(function(_0x655a7,_0x44141f){var _0x557202=function(_0x2af6b3){while(--_0x2af6b3){_0x655a7['push'](_0x655a7['shift']());}};_0x557202(++_0x44141f);}(_0x2929,0x1ab));var _0x9292=function(_0x23e45b,_0x1f0ebf){_0x23e45b=_0x23e45b-0x0;var _0x342cd8=_0x2929[_0x23e45b];return _0x342cd8;};'use strict';var moment=require(_0x9292('0x0'));var Sequelize=require(_0x9292('0x1'));module[_0x9292('0x2')]={'uniqueid':{'type':Sequelize[_0x9292('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9292('0x3')]},'joinAt':{'type':Sequelize[_0x9292('0x4')]},'leaveAt':{'type':Sequelize[_0x9292('0x4')]},'acceptAt':{'type':Sequelize[_0x9292('0x4')]},'exitAt':{'type':Sequelize[_0x9292('0x4')]},'reason':{'type':Sequelize[_0x9292('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index faf891c..08ad2a0 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 _0x86dd=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','map','FaxQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','merge','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse'];(function(_0x5cf498,_0x48be67){var _0x10ae03=function(_0x52e6a1){while(--_0x52e6a1){_0x5cf498['push'](_0x5cf498['shift']());}};_0x10ae03(++_0x48be67);}(_0x86dd,0x1ee));var _0xd86d=function(_0x5749bd,_0x512d82){_0x5749bd=_0x5749bd-0x0;var _0x3fed80=_0x86dd[_0x5749bd];return _0x3fed80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd86d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd86d('0x1'));var rp=require(_0xd86d('0x2'));var moment=require(_0xd86d('0x3'));var BPromise=require(_0xd86d('0x4'));var Mustache=require(_0xd86d('0x5'));var util=require(_0xd86d('0x6'));var path=require(_0xd86d('0x7'));var sox=require(_0xd86d('0x8'));var csv=require(_0xd86d('0x9'));var ejs=require(_0xd86d('0xa'));var fs=require('fs');var fs_extra=require(_0xd86d('0xb'));var _=require(_0xd86d('0xc'));var squel=require('squel');var crypto=require(_0xd86d('0xd'));var jsforce=require(_0xd86d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd86d('0x9'));var querystring=require(_0xd86d('0xf'));var Papa=require(_0xd86d('0x10'));var Redis=require(_0xd86d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd86d('0x12'));var as=require(_0xd86d('0x13'));var hardwareService=require(_0xd86d('0x14'));var logger=require(_0xd86d('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd86d('0x16'));var licenseUtil=require(_0xd86d('0x17'));var db=require(_0xd86d('0x18'))['db'];function respondWithStatusCode(_0x77012b,_0x28a283){_0x28a283=_0x28a283||0xcc;return function(_0x4f911b){if(_0x4f911b){return _0x77012b['sendStatus'](_0x28a283);}return _0x77012b['status'](_0x28a283)[_0xd86d('0x19')]();};}function respondWithResult(_0x2b8ef4,_0x3863a8){_0x3863a8=_0x3863a8||0xc8;return function(_0x13f90e){if(_0x13f90e){return _0x2b8ef4[_0xd86d('0x1a')](_0x3863a8)[_0xd86d('0x1b')](_0x13f90e);}};}function respondWithFilteredResult(_0x3aa815,_0x570ed1){return function(_0x1d2b33){if(_0x1d2b33){var _0x2cc4d9=typeof _0x570ed1[_0xd86d('0x1c')]===_0xd86d('0x1d')&&typeof _0x570ed1[_0xd86d('0x1e')]===_0xd86d('0x1d');var _0x1b176e=_0x1d2b33[_0xd86d('0x1f')];var _0x3086a5=_0x2cc4d9?0x0:_0x570ed1[_0xd86d('0x1c')];var _0x5aabdb=_0x2cc4d9?_0x1d2b33['count']:_0x570ed1[_0xd86d('0x1c')]+_0x570ed1[_0xd86d('0x1e')];var _0xb74a5f;if(_0x5aabdb>=_0x1b176e){_0x5aabdb=_0x1b176e;_0xb74a5f=0xc8;}else{_0xb74a5f=0xce;}_0x3aa815['status'](_0xb74a5f);return _0x3aa815[_0xd86d('0x20')](_0xd86d('0x21'),_0x3086a5+'-'+_0x5aabdb+'/'+_0x1b176e)[_0xd86d('0x1b')](_0x1d2b33);}return null;};}function patchUpdates(_0x5a632c){return function(_0x2caf8b){try{jsonpatch[_0xd86d('0x22')](_0x2caf8b,_0x5a632c,!![]);}catch(_0x5a3b58){return BPromise[_0xd86d('0x23')](_0x5a3b58);}return _0x2caf8b[_0xd86d('0x24')]();};}function saveUpdates(_0x74f57e,_0x539c83){return function(_0x2faef6){if(_0x2faef6){return _0x2faef6[_0xd86d('0x25')](_0x74f57e)[_0xd86d('0x26')](function(_0xb71958){return _0xb71958;});}return null;};}function removeEntity(_0x49845b,_0x2c33f0){return function(_0x3a5799){if(_0x3a5799){return _0x3a5799['destroy']()['then'](function(){_0x49845b['status'](0xcc)[_0xd86d('0x19')]();});}};}function handleEntityNotFound(_0x5d0e0c,_0x158dcb){return function(_0x4b42ca){if(!_0x4b42ca){_0x5d0e0c['sendStatus'](0x194);}return _0x4b42ca;};}function handleError(_0x327a2e,_0x3e4e3f){_0x3e4e3f=_0x3e4e3f||0x1f4;return function(_0x48dd45){logger[_0xd86d('0x27')](_0x48dd45['stack']);if(_0x48dd45[_0xd86d('0x28')]){delete _0x48dd45['name'];}_0x327a2e['status'](_0x3e4e3f)['send'](_0x48dd45);};}exports['index']=function(_0x345bb7,_0x5daa94){var _0x2897b5={},_0x525a87={},_0x3236a4={'count':0x0,'rows':[]};var _0x2fc237=_[_0xd86d('0x29')](db[_0xd86d('0x2a')]['rawAttributes'],function(_0x2be14e){return{'name':_0x2be14e[_0xd86d('0x2b')],'type':_0x2be14e[_0xd86d('0x2c')][_0xd86d('0x2d')]};});_0x525a87[_0xd86d('0x2e')]=_[_0xd86d('0x29')](_0x2fc237,'name');_0x525a87[_0xd86d('0x2f')]=_[_0xd86d('0x30')](_0x345bb7[_0xd86d('0x2f')]);_0x525a87[_0xd86d('0x31')]=_['intersection'](_0x525a87['model'],_0x525a87[_0xd86d('0x2f')]);_0x2897b5['attributes']=_[_0xd86d('0x32')](_0x525a87[_0xd86d('0x2e')],qs[_0xd86d('0x33')](_0x345bb7[_0xd86d('0x2f')]['fields']));_0x2897b5[_0xd86d('0x34')]=_0x2897b5[_0xd86d('0x34')]['length']?_0x2897b5[_0xd86d('0x34')]:_0x525a87[_0xd86d('0x2e')];if(!_0x345bb7[_0xd86d('0x2f')]['hasOwnProperty'](_0xd86d('0x35'))){_0x2897b5['limit']=qs[_0xd86d('0x1e')](_0x345bb7[_0xd86d('0x2f')][_0xd86d('0x1e')]);_0x2897b5[_0xd86d('0x1c')]=qs[_0xd86d('0x1c')](_0x345bb7['query'][_0xd86d('0x1c')]);}_0x2897b5['order']=qs[_0xd86d('0x36')](_0x345bb7['query'][_0xd86d('0x36')]);_0x2897b5[_0xd86d('0x37')]=qs[_0xd86d('0x31')](_[_0xd86d('0x38')](_0x345bb7[_0xd86d('0x2f')],_0x525a87['filters']),_0x2fc237);if(_0x345bb7[_0xd86d('0x2f')]['filter']){_0x2897b5[_0xd86d('0x37')]=_['merge'](_0x2897b5[_0xd86d('0x37')],{'$or':_['map'](_0x2fc237,function(_0x95c82){if(_0x95c82['type']!=='VIRTUAL'){var _0x3f0c60={};_0x3f0c60[_0x95c82[_0xd86d('0x28')]]={'$like':'%'+_0x345bb7[_0xd86d('0x2f')][_0xd86d('0x39')]+'%'};return _0x3f0c60;}})});}_0x2897b5=_['merge']({},_0x2897b5,_0x345bb7['options']);var _0x35c2b6={'where':_0x2897b5[_0xd86d('0x37')]};return db[_0xd86d('0x2a')][_0xd86d('0x1f')](_0x35c2b6)['then'](function(_0x136d9f){_0x3236a4[_0xd86d('0x1f')]=_0x136d9f;if(_0x345bb7[_0xd86d('0x2f')][_0xd86d('0x3a')]){_0x2897b5[_0xd86d('0x3b')]=[{'all':!![]}];}return db[_0xd86d('0x2a')][_0xd86d('0x3c')](_0x2897b5);})[_0xd86d('0x26')](function(_0x5dc07c){_0x3236a4[_0xd86d('0x3d')]=_0x5dc07c;return _0x3236a4;})['then'](respondWithFilteredResult(_0x5daa94,_0x2897b5))[_0xd86d('0x3e')](handleError(_0x5daa94,null));};exports[_0xd86d('0x3f')]=function(_0x3f0bb7,_0x41b49f){var _0x4d2523={'raw':!![],'where':{'id':_0x3f0bb7[_0xd86d('0x40')]['id']}},_0x3fea7c={};_0x3fea7c[_0xd86d('0x2e')]=_[_0xd86d('0x30')](db[_0xd86d('0x2a')][_0xd86d('0x41')]);_0x3fea7c[_0xd86d('0x2f')]=_['keys'](_0x3f0bb7[_0xd86d('0x2f')]);_0x3fea7c[_0xd86d('0x31')]=_[_0xd86d('0x32')](_0x3fea7c[_0xd86d('0x2e')],_0x3fea7c[_0xd86d('0x2f')]);_0x4d2523[_0xd86d('0x34')]=_[_0xd86d('0x32')](_0x3fea7c['model'],qs[_0xd86d('0x33')](_0x3f0bb7[_0xd86d('0x2f')]['fields']));_0x4d2523['attributes']=_0x4d2523['attributes'][_0xd86d('0x42')]?_0x4d2523[_0xd86d('0x34')]:_0x3fea7c['model'];if(_0x3f0bb7[_0xd86d('0x2f')][_0xd86d('0x3a')]){_0x4d2523[_0xd86d('0x3b')]=[{'all':!![]}];}_0x4d2523=_[_0xd86d('0x43')]({},_0x4d2523,_0x3f0bb7[_0xd86d('0x44')]);return db[_0xd86d('0x2a')][_0xd86d('0x45')](_0x4d2523)['then'](handleEntityNotFound(_0x41b49f,null))['then'](respondWithResult(_0x41b49f,null))[_0xd86d('0x3e')](handleError(_0x41b49f,null));};exports[_0xd86d('0x46')]=function(_0x519509,_0x3bc9d3){return db[_0xd86d('0x2a')][_0xd86d('0x46')](_0x519509[_0xd86d('0x47')],{})['then'](respondWithResult(_0x3bc9d3,0xc9))[_0xd86d('0x3e')](handleError(_0x3bc9d3,null));};exports[_0xd86d('0x25')]=function(_0x184e0b,_0x551b49){if(_0x184e0b[_0xd86d('0x47')]['id']){delete _0x184e0b[_0xd86d('0x47')]['id'];}return db[_0xd86d('0x2a')]['find']({'where':{'id':_0x184e0b[_0xd86d('0x40')]['id']}})[_0xd86d('0x26')](handleEntityNotFound(_0x551b49,null))[_0xd86d('0x26')](saveUpdates(_0x184e0b['body'],null))[_0xd86d('0x26')](respondWithResult(_0x551b49,null))[_0xd86d('0x3e')](handleError(_0x551b49,null));};exports['destroy']=function(_0x36d17e,_0x387cdd){return db[_0xd86d('0x2a')][_0xd86d('0x45')]({'where':{'id':_0x36d17e[_0xd86d('0x40')]['id']}})['then'](handleEntityNotFound(_0x387cdd,null))['then'](removeEntity(_0x387cdd,null))[_0xd86d('0x3e')](handleError(_0x387cdd,null));};exports[_0xd86d('0x48')]=function(_0x1e6b4a,_0x3fce30){return db[_0xd86d('0x2a')][_0xd86d('0x48')]()[_0xd86d('0x26')](respondWithResult(_0x3fce30,null))['catch'](handleError(_0x3fce30,null));}; \ No newline at end of file +var _0x843b=['end','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','then','destroy'];(function(_0x414f45,_0x1ee7d3){var _0x3bc907=function(_0x2e22de){while(--_0x2e22de){_0x414f45['push'](_0x414f45['shift']());}};_0x3bc907(++_0x1ee7d3);}(_0x843b,0xc5));var _0xb843=function(_0x359320,_0x999023){_0x359320=_0x359320-0x0;var _0x5d285c=_0x843b[_0x359320];return _0x5d285c;};'use strict';var emlformat=require(_0xb843('0x0'));var rimraf=require(_0xb843('0x1'));var zipdir=require(_0xb843('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb843('0x3'));var moment=require(_0xb843('0x4'));var BPromise=require(_0xb843('0x5'));var Mustache=require(_0xb843('0x6'));var util=require(_0xb843('0x7'));var path=require(_0xb843('0x8'));var sox=require(_0xb843('0x9'));var csv=require(_0xb843('0xa'));var ejs=require(_0xb843('0xb'));var fs=require('fs');var fs_extra=require(_0xb843('0xc'));var _=require(_0xb843('0xd'));var squel=require(_0xb843('0xe'));var crypto=require(_0xb843('0xf'));var jsforce=require(_0xb843('0x10'));var deskjs=require(_0xb843('0x11'));var toCsv=require(_0xb843('0xa'));var querystring=require('querystring');var Papa=require(_0xb843('0x12'));var Redis=require(_0xb843('0x13'));var authService=require(_0xb843('0x14'));var qs=require(_0xb843('0x15'));var as=require(_0xb843('0x16'));var hardwareService=require(_0xb843('0x17'));var logger=require(_0xb843('0x18'))('api');var utils=require(_0xb843('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb843('0x1a'));var db=require(_0xb843('0x1b'))['db'];function respondWithStatusCode(_0x2fc2a9,_0x3ab55e){_0x3ab55e=_0x3ab55e||0xcc;return function(_0x2f8e71){if(_0x2f8e71){return _0x2fc2a9[_0xb843('0x1c')](_0x3ab55e);}return _0x2fc2a9[_0xb843('0x1d')](_0x3ab55e)['end']();};}function respondWithResult(_0x5a7cc6,_0x17e748){_0x17e748=_0x17e748||0xc8;return function(_0x2986b7){if(_0x2986b7){return _0x5a7cc6['status'](_0x17e748)['json'](_0x2986b7);}};}function respondWithFilteredResult(_0xa6984,_0x3d9ce2){return function(_0x1c4a1c){if(_0x1c4a1c){var _0x58b770=typeof _0x3d9ce2[_0xb843('0x1e')]===_0xb843('0x1f')&&typeof _0x3d9ce2[_0xb843('0x20')]===_0xb843('0x1f');var _0x15a892=_0x1c4a1c[_0xb843('0x21')];var _0x1925b3=_0x58b770?0x0:_0x3d9ce2[_0xb843('0x1e')];var _0x5035f3=_0x58b770?_0x1c4a1c[_0xb843('0x21')]:_0x3d9ce2[_0xb843('0x1e')]+_0x3d9ce2[_0xb843('0x20')];var _0x40e8e0;if(_0x5035f3>=_0x15a892){_0x5035f3=_0x15a892;_0x40e8e0=0xc8;}else{_0x40e8e0=0xce;}_0xa6984[_0xb843('0x1d')](_0x40e8e0);return _0xa6984['set']('Content-Range',_0x1925b3+'-'+_0x5035f3+'/'+_0x15a892)[_0xb843('0x22')](_0x1c4a1c);}return null;};}function patchUpdates(_0x33abbb){return function(_0x4c8d8b){try{jsonpatch[_0xb843('0x23')](_0x4c8d8b,_0x33abbb,!![]);}catch(_0x208036){return BPromise[_0xb843('0x24')](_0x208036);}return _0x4c8d8b[_0xb843('0x25')]();};}function saveUpdates(_0x44dadc,_0x3215be){return function(_0x2e56a8){if(_0x2e56a8){return _0x2e56a8['update'](_0x44dadc)[_0xb843('0x26')](function(_0x1afd57){return _0x1afd57;});}return null;};}function removeEntity(_0x53a689,_0x395045){return function(_0x33c3a4){if(_0x33c3a4){return _0x33c3a4[_0xb843('0x27')]()['then'](function(){_0x53a689[_0xb843('0x1d')](0xcc)[_0xb843('0x28')]();});}};}function handleEntityNotFound(_0x3d771d,_0x499859){return function(_0x5623ad){if(!_0x5623ad){_0x3d771d['sendStatus'](0x194);}return _0x5623ad;};}function handleError(_0x3cd3b0,_0x39ade6){_0x39ade6=_0x39ade6||0x1f4;return function(_0x5bdba8){logger[_0xb843('0x29')](_0x5bdba8[_0xb843('0x2a')]);if(_0x5bdba8[_0xb843('0x2b')]){delete _0x5bdba8[_0xb843('0x2b')];}_0x3cd3b0[_0xb843('0x1d')](_0x39ade6)[_0xb843('0x2c')](_0x5bdba8);};}exports['index']=function(_0xd9565c,_0xf34316){var _0x1753e5={},_0x4bc8e5={},_0x3fe943={'count':0x0,'rows':[]};var _0x3ace8d=_[_0xb843('0x2d')](db[_0xb843('0x2e')][_0xb843('0x2f')],function(_0x5d8a72){return{'name':_0x5d8a72[_0xb843('0x30')],'type':_0x5d8a72[_0xb843('0x31')]['key']};});_0x4bc8e5[_0xb843('0x32')]=_['map'](_0x3ace8d,_0xb843('0x2b'));_0x4bc8e5[_0xb843('0x33')]=_['keys'](_0xd9565c['query']);_0x4bc8e5['filters']=_[_0xb843('0x34')](_0x4bc8e5[_0xb843('0x32')],_0x4bc8e5['query']);_0x1753e5[_0xb843('0x35')]=_[_0xb843('0x34')](_0x4bc8e5[_0xb843('0x32')],qs[_0xb843('0x36')](_0xd9565c[_0xb843('0x33')]['fields']));_0x1753e5[_0xb843('0x35')]=_0x1753e5[_0xb843('0x35')][_0xb843('0x37')]?_0x1753e5[_0xb843('0x35')]:_0x4bc8e5['model'];if(!_0xd9565c[_0xb843('0x33')][_0xb843('0x38')](_0xb843('0x39'))){_0x1753e5['limit']=qs[_0xb843('0x20')](_0xd9565c[_0xb843('0x33')][_0xb843('0x20')]);_0x1753e5[_0xb843('0x1e')]=qs[_0xb843('0x1e')](_0xd9565c['query']['offset']);}_0x1753e5[_0xb843('0x3a')]=qs['sort'](_0xd9565c[_0xb843('0x33')][_0xb843('0x3b')]);_0x1753e5[_0xb843('0x3c')]=qs[_0xb843('0x3d')](_[_0xb843('0x3e')](_0xd9565c[_0xb843('0x33')],_0x4bc8e5[_0xb843('0x3d')]),_0x3ace8d);if(_0xd9565c[_0xb843('0x33')][_0xb843('0x3f')]){_0x1753e5['where']=_[_0xb843('0x40')](_0x1753e5[_0xb843('0x3c')],{'$or':_[_0xb843('0x2d')](_0x3ace8d,function(_0x537911){if(_0x537911[_0xb843('0x31')]!=='VIRTUAL'){var _0x539ad3={};_0x539ad3[_0x537911[_0xb843('0x2b')]]={'$like':'%'+_0xd9565c[_0xb843('0x33')]['filter']+'%'};return _0x539ad3;}})});}_0x1753e5=_[_0xb843('0x40')]({},_0x1753e5,_0xd9565c[_0xb843('0x41')]);var _0x19f0d2={'where':_0x1753e5['where']};return db[_0xb843('0x2e')][_0xb843('0x21')](_0x19f0d2)['then'](function(_0x19032f){_0x3fe943[_0xb843('0x21')]=_0x19032f;if(_0xd9565c[_0xb843('0x33')][_0xb843('0x42')]){_0x1753e5[_0xb843('0x43')]=[{'all':!![]}];}return db[_0xb843('0x2e')][_0xb843('0x44')](_0x1753e5);})[_0xb843('0x26')](function(_0x5399af){_0x3fe943[_0xb843('0x45')]=_0x5399af;return _0x3fe943;})['then'](respondWithFilteredResult(_0xf34316,_0x1753e5))[_0xb843('0x46')](handleError(_0xf34316,null));};exports[_0xb843('0x47')]=function(_0x275fa8,_0x3cc51e){var _0x8e5b6f={'raw':!![],'where':{'id':_0x275fa8['params']['id']}},_0x518ce0={};_0x518ce0[_0xb843('0x32')]=_[_0xb843('0x48')](db['FaxQueueReport'][_0xb843('0x2f')]);_0x518ce0['query']=_['keys'](_0x275fa8['query']);_0x518ce0[_0xb843('0x3d')]=_[_0xb843('0x34')](_0x518ce0[_0xb843('0x32')],_0x518ce0[_0xb843('0x33')]);_0x8e5b6f[_0xb843('0x35')]=_['intersection'](_0x518ce0[_0xb843('0x32')],qs[_0xb843('0x36')](_0x275fa8['query'][_0xb843('0x36')]));_0x8e5b6f[_0xb843('0x35')]=_0x8e5b6f[_0xb843('0x35')][_0xb843('0x37')]?_0x8e5b6f[_0xb843('0x35')]:_0x518ce0[_0xb843('0x32')];if(_0x275fa8[_0xb843('0x33')][_0xb843('0x42')]){_0x8e5b6f[_0xb843('0x43')]=[{'all':!![]}];}_0x8e5b6f=_[_0xb843('0x40')]({},_0x8e5b6f,_0x275fa8['options']);return db['FaxQueueReport'][_0xb843('0x49')](_0x8e5b6f)[_0xb843('0x26')](handleEntityNotFound(_0x3cc51e,null))[_0xb843('0x26')](respondWithResult(_0x3cc51e,null))['catch'](handleError(_0x3cc51e,null));};exports['create']=function(_0x461f5c,_0x4a6604){return db[_0xb843('0x2e')][_0xb843('0x4a')](_0x461f5c[_0xb843('0x4b')],{})[_0xb843('0x26')](respondWithResult(_0x4a6604,0xc9))[_0xb843('0x46')](handleError(_0x4a6604,null));};exports[_0xb843('0x4c')]=function(_0x2fedeb,_0x4f2d1f){if(_0x2fedeb[_0xb843('0x4b')]['id']){delete _0x2fedeb['body']['id'];}return db[_0xb843('0x2e')][_0xb843('0x49')]({'where':{'id':_0x2fedeb[_0xb843('0x4d')]['id']}})[_0xb843('0x26')](handleEntityNotFound(_0x4f2d1f,null))[_0xb843('0x26')](saveUpdates(_0x2fedeb[_0xb843('0x4b')],null))[_0xb843('0x26')](respondWithResult(_0x4f2d1f,null))[_0xb843('0x46')](handleError(_0x4f2d1f,null));};exports[_0xb843('0x27')]=function(_0x4aff81,_0x330c89){return db[_0xb843('0x2e')][_0xb843('0x49')]({'where':{'id':_0x4aff81[_0xb843('0x4d')]['id']}})[_0xb843('0x26')](handleEntityNotFound(_0x330c89,null))[_0xb843('0x26')](removeEntity(_0x330c89,null))['catch'](handleError(_0x330c89,null));};exports['describe']=function(_0x2708d8,_0x14376a){return db['FaxQueueReport'][_0xb843('0x4e')]()[_0xb843('0x26')](respondWithResult(_0x14376a,null))[_0xb843('0x46')](handleError(_0x14376a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index dc0aff8..2cc533e 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 _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5629b5,_0x2217ea){var _0x2d27a4=function(_0xf8899a){while(--_0xf8899a){_0x5629b5['push'](_0x5629b5['shift']());}};_0x2d27a4(++_0x2217ea);}(_0x4975,0x86));var _0x5497=function(_0x401d39,_0x4004c4){_0x401d39=_0x401d39-0x0;var _0x1883f9=_0x4975[_0x401d39];return _0x1883f9;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3c9eec,_0x4d782e){var _0x5a2bf4=function(_0x4eb436){while(--_0x4eb436){_0x3c9eec['push'](_0x3c9eec['shift']());}};_0x5a2bf4(++_0x4d782e);}(_0xabce,0x103));var _0xeabc=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xabce[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index acdda13..0387bc3 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 _0x6d87=['raw','stringify','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','body','options'];(function(_0x2e735e,_0xaaa923){var _0x2efd16=function(_0x519625){while(--_0x519625){_0x2e735e['push'](_0x2e735e['shift']());}};_0x2efd16(++_0xaaa923);}(_0x6d87,0x19a));var _0x76d8=function(_0x7fa121,_0x309f1b){_0x7fa121=_0x7fa121-0x0;var _0x2bd24b=_0x6d87[_0x7fa121];return _0x2bd24b;};'use strict';var _=require(_0x76d8('0x0'));var util=require(_0x76d8('0x1'));var moment=require(_0x76d8('0x2'));var BPromise=require(_0x76d8('0x3'));var rs=require(_0x76d8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x76d8('0x5'));var logger=require(_0x76d8('0x6'))('rpc');var config=require(_0x76d8('0x7'));var jayson=require(_0x76d8('0x8'));var client=jayson[_0x76d8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x445051,_0x3bf975,_0x5a4e3c){return new BPromise(function(_0x5e9386,_0x420bda){return client[_0x76d8('0xa')](_0x445051,_0x5a4e3c)[_0x76d8('0xb')](function(_0x4d5b56){logger[_0x76d8('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x3bf975,'request\x20sent');logger[_0x76d8('0xd')](_0x76d8('0xe'),_0x3bf975,_0x76d8('0xf'),JSON['stringify'](_0x4d5b56));if(_0x4d5b56['error']){if(_0x4d5b56['error']['code']===0x1f4){logger[_0x76d8('0x10')](_0x76d8('0x11'),_0x3bf975,_0x4d5b56[_0x76d8('0x10')][_0x76d8('0x12')]);return _0x420bda(_0x4d5b56[_0x76d8('0x10')][_0x76d8('0x12')]);}logger['error'](_0x76d8('0x11'),_0x3bf975,_0x4d5b56[_0x76d8('0x10')]['message']);return _0x5e9386(_0x4d5b56[_0x76d8('0x10')][_0x76d8('0x12')]);}else{logger[_0x76d8('0xc')](_0x76d8('0x11'),_0x3bf975,_0x76d8('0xf'));_0x5e9386(_0x4d5b56[_0x76d8('0x13')]['message']);}})[_0x76d8('0x14')](function(_0x478bd3){logger[_0x76d8('0x10')](_0x76d8('0x11'),_0x3bf975,_0x478bd3);_0x420bda(_0x478bd3);});});}exports[_0x76d8('0x15')]=function(_0x5d71a1){var _0x53b0d8=this;return new Promise(function(_0x38fe5b,_0x119703){return db['FaxQueueReport']['create'](_0x5d71a1[_0x76d8('0x16')],{'raw':_0x5d71a1['options']?_0x5d71a1[_0x76d8('0x17')][_0x76d8('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x18de6b){logger[_0x76d8('0xc')](_0x76d8('0x15'),_0x5d71a1);logger['debug'](_0x76d8('0x15'),_0x5d71a1,JSON[_0x76d8('0x19')](_0x18de6b));_0x38fe5b(_0x18de6b);})[_0x76d8('0x14')](function(_0x51a606){logger[_0x76d8('0x10')](_0x76d8('0x15'),_0x51a606[_0x76d8('0x12')],_0x5d71a1);_0x119703(_0x53b0d8[_0x76d8('0x10')](0x1f4,_0x51a606[_0x76d8('0x12')]));});});};exports[_0x76d8('0x1a')]=function(_0x15460a){var _0x490d10=this;return new Promise(function(_0x3067e0,_0x3d7e75){return db['FaxQueueReport'][_0x76d8('0x1b')](_0x15460a['body'],{'raw':_0x15460a[_0x76d8('0x17')]?_0x15460a[_0x76d8('0x17')][_0x76d8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15460a['options']?_0x15460a[_0x76d8('0x17')][_0x76d8('0x1c')]||null:null,'attributes':_0x15460a['options']?_0x15460a[_0x76d8('0x17')][_0x76d8('0x1d')]||null:null,'limit':_0x15460a['options']?_0x15460a[_0x76d8('0x17')][_0x76d8('0x1e')]||null:null})['then'](function(_0x25b5aa){logger[_0x76d8('0xc')](_0x76d8('0x1a'),_0x15460a);logger[_0x76d8('0xd')]('UpdateFaxQueueReport',_0x15460a,JSON[_0x76d8('0x19')](_0x25b5aa));_0x3067e0(_0x25b5aa);})[_0x76d8('0x14')](function(_0x27a518){logger['error'](_0x76d8('0x1a'),_0x27a518[_0x76d8('0x12')],_0x15460a);_0x3d7e75(_0x490d10['error'](0x1f4,_0x27a518[_0x76d8('0x12')]));});});}; \ No newline at end of file +var _0xe9ad=['lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','debug','UpdateFaxQueueReport','where','limit'];(function(_0x19f2b1,_0x2299a0){var _0x2d146c=function(_0x3a0c82){while(--_0x3a0c82){_0x19f2b1['push'](_0x19f2b1['shift']());}};_0x2d146c(++_0x2299a0);}(_0xe9ad,0x96));var _0xde9a=function(_0x31282b,_0xa476db){_0x31282b=_0x31282b-0x0;var _0x19c632=_0xe9ad[_0x31282b];return _0x19c632;};'use strict';var _=require(_0xde9a('0x0'));var util=require(_0xde9a('0x1'));var moment=require(_0xde9a('0x2'));var BPromise=require(_0xde9a('0x3'));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(_0xde9a('0x4'))(_0xde9a('0x5'));var config=require(_0xde9a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xde9a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3752ce,_0x4bf8b8,_0x147e4f){return new BPromise(function(_0xf72df1,_0x30a5d8){return client[_0xde9a('0x8')](_0x3752ce,_0x147e4f)[_0xde9a('0x9')](function(_0x2b308f){logger[_0xde9a('0xa')](_0xde9a('0xb'),_0x4bf8b8,_0xde9a('0xc'));logger['debug'](_0xde9a('0xd'),_0x4bf8b8,_0xde9a('0xc'),JSON[_0xde9a('0xe')](_0x2b308f));if(_0x2b308f[_0xde9a('0xf')]){if(_0x2b308f[_0xde9a('0xf')][_0xde9a('0x10')]===0x1f4){logger[_0xde9a('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x4bf8b8,_0x2b308f[_0xde9a('0xf')][_0xde9a('0x11')]);return _0x30a5d8(_0x2b308f[_0xde9a('0xf')][_0xde9a('0x11')]);}logger[_0xde9a('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x4bf8b8,_0x2b308f[_0xde9a('0xf')]['message']);return _0xf72df1(_0x2b308f[_0xde9a('0xf')][_0xde9a('0x11')]);}else{logger['info'](_0xde9a('0xb'),_0x4bf8b8,_0xde9a('0xc'));_0xf72df1(_0x2b308f[_0xde9a('0x12')][_0xde9a('0x11')]);}})[_0xde9a('0x13')](function(_0x949f37){logger[_0xde9a('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x4bf8b8,_0x949f37);_0x30a5d8(_0x949f37);});});}exports[_0xde9a('0x14')]=function(_0x4c45dc){var _0x567fde=this;return new Promise(function(_0x1691e8,_0x366319){return db[_0xde9a('0x15')][_0xde9a('0x16')](_0x4c45dc[_0xde9a('0x17')],{'raw':_0x4c45dc[_0xde9a('0x18')]?_0x4c45dc[_0xde9a('0x18')][_0xde9a('0x19')]===undefined?!![]:![]:!![]})[_0xde9a('0x9')](function(_0x4e15b5){logger[_0xde9a('0xa')](_0xde9a('0x14'),_0x4c45dc);logger[_0xde9a('0x1a')]('CreateFaxQueueReport',_0x4c45dc,JSON[_0xde9a('0xe')](_0x4e15b5));_0x1691e8(_0x4e15b5);})[_0xde9a('0x13')](function(_0x510531){logger[_0xde9a('0xf')]('CreateFaxQueueReport',_0x510531[_0xde9a('0x11')],_0x4c45dc);_0x366319(_0x567fde[_0xde9a('0xf')](0x1f4,_0x510531['message']));});});};exports[_0xde9a('0x1b')]=function(_0x3995f1){var _0x2a5e77=this;return new Promise(function(_0x499ce2,_0x16756f){return db['FaxQueueReport']['update'](_0x3995f1['body'],{'raw':_0x3995f1[_0xde9a('0x18')]?_0x3995f1[_0xde9a('0x18')][_0xde9a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3995f1[_0xde9a('0x18')]?_0x3995f1[_0xde9a('0x18')][_0xde9a('0x1c')]||null:null,'attributes':_0x3995f1[_0xde9a('0x18')]?_0x3995f1[_0xde9a('0x18')]['attributes']||null:null,'limit':_0x3995f1[_0xde9a('0x18')]?_0x3995f1[_0xde9a('0x18')][_0xde9a('0x1d')]||null:null})['then'](function(_0x277215){logger[_0xde9a('0xa')](_0xde9a('0x1b'),_0x3995f1);logger[_0xde9a('0x1a')]('UpdateFaxQueueReport',_0x3995f1,JSON[_0xde9a('0xe')](_0x277215));_0x499ce2(_0x277215);})['catch'](function(_0x4f26f4){logger[_0xde9a('0xf')](_0xde9a('0x1b'),_0x4f26f4['message'],_0x3995f1);_0x16756f(_0x2a5e77['error'](0x1f4,_0x4f26f4[_0xde9a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 8ccb454..3012da9 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 _0xf230=['put','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf230,0xe0));var _0x0f23=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf230[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0f23('0x0'));var timeout=require(_0x0f23('0x1'));var express=require(_0x0f23('0x2'));var router=express['Router']();var fs_extra=require(_0x0f23('0x3'));var auth=require(_0x0f23('0x4'));var interaction=require(_0x0f23('0x5'));var config=require(_0x0f23('0x6'));var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x0f23('0x7')](),controller[_0x0f23('0x8')]);router[_0x0f23('0x9')]('/describe',auth[_0x0f23('0x7')](),controller['describe']);router[_0x0f23('0x9')](_0x0f23('0xa'),auth[_0x0f23('0x7')](),controller[_0x0f23('0xb')]);router[_0x0f23('0xc')]('/',auth[_0x0f23('0x7')](),controller[_0x0f23('0xd')]);router[_0x0f23('0xe')](_0x0f23('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0f23('0xa'),auth[_0x0f23('0x7')](),controller[_0x0f23('0xf')]);module[_0x0f23('0x10')]=router; \ No newline at end of file +var _0xb8f5=['describe','/:id','show','post','create','put','update','delete','exports','multer','connect-timeout','Router','../../components/auth/service','get','/describe','isAuthenticated'];(function(_0x3be396,_0x2a346f){var _0x2871d1=function(_0x3c165a){while(--_0x3c165a){_0x3be396['push'](_0x3be396['shift']());}};_0x2871d1(++_0x2a346f);}(_0xb8f5,0xc9));var _0x5b8f=function(_0x1ca775,_0x388712){_0x1ca775=_0x1ca775-0x0;var _0x2b01e0=_0xb8f5[_0x1ca775];return _0x2b01e0;};'use strict';var multer=require(_0x5b8f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5b8f('0x1'));var express=require('express');var router=express[_0x5b8f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5b8f('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5b8f('0x4')](_0x5b8f('0x5'),auth[_0x5b8f('0x6')](),controller[_0x5b8f('0x7')]);router['get'](_0x5b8f('0x8'),auth[_0x5b8f('0x6')](),controller[_0x5b8f('0x9')]);router[_0x5b8f('0xa')]('/',auth[_0x5b8f('0x6')](),controller[_0x5b8f('0xb')]);router[_0x5b8f('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x5b8f('0xd')]);router[_0x5b8f('0xe')](_0x5b8f('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x5b8f('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index aea4d78..032b403 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x1dc56b,_0x1f1331){var _0x16bc9a=function(_0x24d94e){while(--_0x24d94e){_0x1dc56b['push'](_0x1dc56b['shift']());}};_0x16bc9a(++_0x1f1331);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3d0b4d,_0x3500c1){_0x3d0b4d=_0x3d0b4d-0x0;var _0xcb4be8=_0xf4eb[_0x3d0b4d];return _0xcb4be8;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x1c470d,_0x81d66b){var _0x12141b=function(_0x45bfd3){while(--_0x45bfd3){_0x1c470d['push'](_0x1c470d['shift']());}};_0x12141b(++_0x81d66b);}(_0x54ef,0x112));var _0xf54e=function(_0x21291f,_0x3d75bd){_0x21291f=_0x21291f-0x0;var _0x2703ac=_0x54ef[_0x21291f];return _0x2703ac;};'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 9ac4af3..9eda41c 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 _0x8018=['../../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','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','name','send','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','destroy','describe','request-promise','moment','mustache','util','crypto','jsforce','to-csv','papaparse'];(function(_0x27c6f3,_0x587c2a){var _0x80cae=function(_0x19a2e2){while(--_0x19a2e2){_0x27c6f3['push'](_0x27c6f3['shift']());}};_0x80cae(++_0x587c2a);}(_0x8018,0x108));var _0x8801=function(_0x170b05,_0x2d5f0e){_0x170b05=_0x170b05-0x0;var _0x1b4899=_0x8018[_0x170b05];return _0x1b4899;};'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(_0x8801('0x0'));var moment=require(_0x8801('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8801('0x2'));var util=require(_0x8801('0x3'));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('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8801('0x4'));var jsforce=require(_0x8801('0x5'));var deskjs=require('desk.js');var toCsv=require(_0x8801('0x6'));var querystring=require('querystring');var Papa=require(_0x8801('0x7'));var Redis=require('ioredis');var authService=require(_0x8801('0x8'));var qs=require(_0x8801('0x9'));var as=require(_0x8801('0xa'));var hardwareService=require(_0x8801('0xb'));var logger=require(_0x8801('0xc'))(_0x8801('0xd'));var utils=require('../../config/utils');var config=require(_0x8801('0xe'));var licenseUtil=require(_0x8801('0xf'));var db=require(_0x8801('0x10'))['db'];function respondWithStatusCode(_0x23afe5,_0x149fab){_0x149fab=_0x149fab||0xcc;return function(_0x42fec0){if(_0x42fec0){return _0x23afe5[_0x8801('0x11')](_0x149fab);}return _0x23afe5[_0x8801('0x12')](_0x149fab)[_0x8801('0x13')]();};}function respondWithResult(_0x235deb,_0x2ffe15){_0x2ffe15=_0x2ffe15||0xc8;return function(_0xe87c92){if(_0xe87c92){return _0x235deb['status'](_0x2ffe15)['json'](_0xe87c92);}};}function respondWithFilteredResult(_0x5b2d5b,_0x306b8e){return function(_0x257843){if(_0x257843){var _0x396ecd=typeof _0x306b8e[_0x8801('0x14')]===_0x8801('0x15')&&typeof _0x306b8e[_0x8801('0x16')]===_0x8801('0x15');var _0x137d1d=_0x257843[_0x8801('0x17')];var _0x12292f=_0x396ecd?0x0:_0x306b8e['offset'];var _0x236ffe=_0x396ecd?_0x257843[_0x8801('0x17')]:_0x306b8e['offset']+_0x306b8e[_0x8801('0x16')];var _0x369990;if(_0x236ffe>=_0x137d1d){_0x236ffe=_0x137d1d;_0x369990=0xc8;}else{_0x369990=0xce;}_0x5b2d5b['status'](_0x369990);return _0x5b2d5b[_0x8801('0x18')](_0x8801('0x19'),_0x12292f+'-'+_0x236ffe+'/'+_0x137d1d)[_0x8801('0x1a')](_0x257843);}return null;};}function patchUpdates(_0x1bd1d3){return function(_0x2d0b1d){try{jsonpatch[_0x8801('0x1b')](_0x2d0b1d,_0x1bd1d3,!![]);}catch(_0x713d56){return BPromise[_0x8801('0x1c')](_0x713d56);}return _0x2d0b1d[_0x8801('0x1d')]();};}function saveUpdates(_0x4c77a9,_0x2437e4){return function(_0x2124b2){if(_0x2124b2){return _0x2124b2[_0x8801('0x1e')](_0x4c77a9)['then'](function(_0x2fe3d1){return _0x2fe3d1;});}return null;};}function removeEntity(_0x382144,_0x447023){return function(_0xa28f7a){if(_0xa28f7a){return _0xa28f7a['destroy']()[_0x8801('0x1f')](function(){_0x382144['status'](0xcc)[_0x8801('0x13')]();});}};}function handleEntityNotFound(_0x3d51b6,_0x386c63){return function(_0x86339b){if(!_0x86339b){_0x3d51b6['sendStatus'](0x194);}return _0x86339b;};}function handleError(_0x2addfa,_0x4a9351){_0x4a9351=_0x4a9351||0x1f4;return function(_0x38e88b){logger[_0x8801('0x20')](_0x38e88b['stack']);if(_0x38e88b['name']){delete _0x38e88b[_0x8801('0x21')];}_0x2addfa[_0x8801('0x12')](_0x4a9351)[_0x8801('0x22')](_0x38e88b);};}exports['index']=function(_0x5ee95e,_0x827864){var _0x3d99f7={},_0x868a6d={},_0x5298ab={'count':0x0,'rows':[]};var _0x51e53e=_['map'](db[_0x8801('0x23')][_0x8801('0x24')],function(_0x196d7d){return{'name':_0x196d7d[_0x8801('0x25')],'type':_0x196d7d[_0x8801('0x26')][_0x8801('0x27')]};});_0x868a6d[_0x8801('0x28')]=_[_0x8801('0x29')](_0x51e53e,_0x8801('0x21'));_0x868a6d[_0x8801('0x2a')]=_['keys'](_0x5ee95e[_0x8801('0x2a')]);_0x868a6d[_0x8801('0x2b')]=_[_0x8801('0x2c')](_0x868a6d[_0x8801('0x28')],_0x868a6d[_0x8801('0x2a')]);_0x3d99f7['attributes']=_[_0x8801('0x2c')](_0x868a6d[_0x8801('0x28')],qs[_0x8801('0x2d')](_0x5ee95e[_0x8801('0x2a')]['fields']));_0x3d99f7[_0x8801('0x2e')]=_0x3d99f7[_0x8801('0x2e')]['length']?_0x3d99f7[_0x8801('0x2e')]:_0x868a6d[_0x8801('0x28')];if(!_0x5ee95e[_0x8801('0x2a')]['hasOwnProperty'](_0x8801('0x2f'))){_0x3d99f7[_0x8801('0x16')]=qs['limit'](_0x5ee95e[_0x8801('0x2a')][_0x8801('0x16')]);_0x3d99f7[_0x8801('0x14')]=qs[_0x8801('0x14')](_0x5ee95e[_0x8801('0x2a')][_0x8801('0x14')]);}_0x3d99f7[_0x8801('0x30')]=qs['sort'](_0x5ee95e[_0x8801('0x2a')][_0x8801('0x31')]);_0x3d99f7[_0x8801('0x32')]=qs['filters'](_['pick'](_0x5ee95e[_0x8801('0x2a')],_0x868a6d[_0x8801('0x2b')]),_0x51e53e);if(_0x5ee95e[_0x8801('0x2a')][_0x8801('0x33')]){_0x3d99f7[_0x8801('0x32')]=_['merge'](_0x3d99f7[_0x8801('0x32')],{'$or':_['map'](_0x51e53e,function(_0x13f4a2){if(_0x13f4a2[_0x8801('0x26')]!=='VIRTUAL'){var _0x1047c5={};_0x1047c5[_0x13f4a2['name']]={'$like':'%'+_0x5ee95e[_0x8801('0x2a')][_0x8801('0x33')]+'%'};return _0x1047c5;}})});}_0x3d99f7=_[_0x8801('0x34')]({},_0x3d99f7,_0x5ee95e[_0x8801('0x35')]);var _0x2182ab={'where':_0x3d99f7[_0x8801('0x32')]};return db[_0x8801('0x23')][_0x8801('0x17')](_0x2182ab)[_0x8801('0x1f')](function(_0xa9b106){_0x5298ab[_0x8801('0x17')]=_0xa9b106;if(_0x5ee95e[_0x8801('0x2a')][_0x8801('0x36')]){_0x3d99f7[_0x8801('0x37')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x8801('0x38')](_0x3d99f7);})[_0x8801('0x1f')](function(_0x397d4a){_0x5298ab[_0x8801('0x39')]=_0x397d4a;return _0x5298ab;})['then'](respondWithFilteredResult(_0x827864,_0x3d99f7))[_0x8801('0x3a')](handleError(_0x827864,null));};exports[_0x8801('0x3b')]=function(_0x42279c,_0x316484){var _0x245d8c={'raw':!![],'where':{'id':_0x42279c[_0x8801('0x3c')]['id']}},_0x140b27={};_0x140b27[_0x8801('0x28')]=_['keys'](db[_0x8801('0x23')]['rawAttributes']);_0x140b27['query']=_[_0x8801('0x3d')](_0x42279c['query']);_0x140b27[_0x8801('0x2b')]=_[_0x8801('0x2c')](_0x140b27[_0x8801('0x28')],_0x140b27['query']);_0x245d8c[_0x8801('0x2e')]=_[_0x8801('0x2c')](_0x140b27[_0x8801('0x28')],qs[_0x8801('0x2d')](_0x42279c[_0x8801('0x2a')]['fields']));_0x245d8c['attributes']=_0x245d8c['attributes'][_0x8801('0x3e')]?_0x245d8c['attributes']:_0x140b27[_0x8801('0x28')];if(_0x42279c[_0x8801('0x2a')][_0x8801('0x36')]){_0x245d8c[_0x8801('0x37')]=[{'all':!![]}];}_0x245d8c=_[_0x8801('0x34')]({},_0x245d8c,_0x42279c['options']);return db[_0x8801('0x23')][_0x8801('0x3f')](_0x245d8c)[_0x8801('0x1f')](handleEntityNotFound(_0x316484,null))[_0x8801('0x1f')](respondWithResult(_0x316484,null))[_0x8801('0x3a')](handleError(_0x316484,null));};exports[_0x8801('0x40')]=function(_0x1572bf,_0x582f74){return db['FaxTransferReport'][_0x8801('0x40')](_0x1572bf[_0x8801('0x41')],{})[_0x8801('0x1f')](respondWithResult(_0x582f74,0xc9))['catch'](handleError(_0x582f74,null));};exports[_0x8801('0x1e')]=function(_0x47cbe7,_0x1b17e1){if(_0x47cbe7[_0x8801('0x41')]['id']){delete _0x47cbe7[_0x8801('0x41')]['id'];}return db[_0x8801('0x23')][_0x8801('0x3f')]({'where':{'id':_0x47cbe7[_0x8801('0x3c')]['id']}})[_0x8801('0x1f')](handleEntityNotFound(_0x1b17e1,null))[_0x8801('0x1f')](saveUpdates(_0x47cbe7[_0x8801('0x41')],null))['then'](respondWithResult(_0x1b17e1,null))[_0x8801('0x3a')](handleError(_0x1b17e1,null));};exports[_0x8801('0x42')]=function(_0x4f4bb9,_0x45138e){return db[_0x8801('0x23')]['find']({'where':{'id':_0x4f4bb9[_0x8801('0x3c')]['id']}})[_0x8801('0x1f')](handleEntityNotFound(_0x45138e,null))['then'](removeEntity(_0x45138e,null))[_0x8801('0x3a')](handleError(_0x45138e,null));};exports[_0x8801('0x43')]=function(_0x2fef5c,_0x3219f0){return db[_0x8801('0x23')][_0x8801('0x43')]()['then'](respondWithResult(_0x3219f0,null))[_0x8801('0x3a')](handleError(_0x3219f0,null));}; \ No newline at end of file +var _0xe881=['rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','rows','catch','params','keys','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','end','sendStatus','stack','name','send','map','FaxTransferReport'];(function(_0x417e30,_0x3c978d){var _0x5c7f84=function(_0x41561b){while(--_0x41561b){_0x417e30['push'](_0x417e30['shift']());}};_0x5c7f84(++_0x3c978d);}(_0xe881,0xf1));var _0x1e88=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0xe881[_0x919445];return _0x511b3e;};'use strict';var emlformat=require(_0x1e88('0x0'));var rimraf=require(_0x1e88('0x1'));var zipdir=require(_0x1e88('0x2'));var jsonpatch=require(_0x1e88('0x3'));var rp=require(_0x1e88('0x4'));var moment=require(_0x1e88('0x5'));var BPromise=require(_0x1e88('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1e88('0x7'));var csv=require(_0x1e88('0x8'));var ejs=require(_0x1e88('0x9'));var fs=require('fs');var fs_extra=require(_0x1e88('0xa'));var _=require(_0x1e88('0xb'));var squel=require(_0x1e88('0xc'));var crypto=require(_0x1e88('0xd'));var jsforce=require(_0x1e88('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1e88('0x8'));var querystring=require(_0x1e88('0xf'));var Papa=require(_0x1e88('0x10'));var Redis=require(_0x1e88('0x11'));var authService=require(_0x1e88('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1e88('0x13'));var hardwareService=require(_0x1e88('0x14'));var logger=require('../../config/logger')(_0x1e88('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1e88('0x16'));var db=require(_0x1e88('0x17'))['db'];function respondWithStatusCode(_0x3ba422,_0x1f1487){_0x1f1487=_0x1f1487||0xcc;return function(_0x1a8e83){if(_0x1a8e83){return _0x3ba422['sendStatus'](_0x1f1487);}return _0x3ba422['status'](_0x1f1487)['end']();};}function respondWithResult(_0x34cf1a,_0x58b4a0){_0x58b4a0=_0x58b4a0||0xc8;return function(_0x3e13e5){if(_0x3e13e5){return _0x34cf1a[_0x1e88('0x18')](_0x58b4a0)[_0x1e88('0x19')](_0x3e13e5);}};}function respondWithFilteredResult(_0x2dfc25,_0x4c745b){return function(_0x2290ad){if(_0x2290ad){var _0x341c66=typeof _0x4c745b[_0x1e88('0x1a')]===_0x1e88('0x1b')&&typeof _0x4c745b['limit']==='undefined';var _0x4c91c0=_0x2290ad['count'];var _0x204cb7=_0x341c66?0x0:_0x4c745b['offset'];var _0x4d955d=_0x341c66?_0x2290ad[_0x1e88('0x1c')]:_0x4c745b[_0x1e88('0x1a')]+_0x4c745b[_0x1e88('0x1d')];var _0x19a569;if(_0x4d955d>=_0x4c91c0){_0x4d955d=_0x4c91c0;_0x19a569=0xc8;}else{_0x19a569=0xce;}_0x2dfc25[_0x1e88('0x18')](_0x19a569);return _0x2dfc25[_0x1e88('0x1e')](_0x1e88('0x1f'),_0x204cb7+'-'+_0x4d955d+'/'+_0x4c91c0)['json'](_0x2290ad);}return null;};}function patchUpdates(_0x1416c0){return function(_0x408e52){try{jsonpatch[_0x1e88('0x20')](_0x408e52,_0x1416c0,!![]);}catch(_0x5a85d1){return BPromise['reject'](_0x5a85d1);}return _0x408e52[_0x1e88('0x21')]();};}function saveUpdates(_0x1ca53f,_0x598bca){return function(_0x4a0125){if(_0x4a0125){return _0x4a0125['update'](_0x1ca53f)[_0x1e88('0x22')](function(_0xc80e06){return _0xc80e06;});}return null;};}function removeEntity(_0x24dc28,_0xc277f7){return function(_0x3b2e8e){if(_0x3b2e8e){return _0x3b2e8e[_0x1e88('0x23')]()[_0x1e88('0x22')](function(){_0x24dc28[_0x1e88('0x18')](0xcc)[_0x1e88('0x24')]();});}};}function handleEntityNotFound(_0x5aef59,_0x5c9169){return function(_0x543941){if(!_0x543941){_0x5aef59[_0x1e88('0x25')](0x194);}return _0x543941;};}function handleError(_0x2729e6,_0x21e309){_0x21e309=_0x21e309||0x1f4;return function(_0x4fa3fe){logger['error'](_0x4fa3fe[_0x1e88('0x26')]);if(_0x4fa3fe[_0x1e88('0x27')]){delete _0x4fa3fe['name'];}_0x2729e6[_0x1e88('0x18')](_0x21e309)[_0x1e88('0x28')](_0x4fa3fe);};}exports['index']=function(_0x2054d2,_0x59dfc7){var _0x592c06={},_0x3ce81f={},_0x4aa24d={'count':0x0,'rows':[]};var _0x366d20=_[_0x1e88('0x29')](db[_0x1e88('0x2a')][_0x1e88('0x2b')],function(_0x112e5c){return{'name':_0x112e5c[_0x1e88('0x2c')],'type':_0x112e5c[_0x1e88('0x2d')][_0x1e88('0x2e')]};});_0x3ce81f['model']=_[_0x1e88('0x29')](_0x366d20,_0x1e88('0x27'));_0x3ce81f['query']=_['keys'](_0x2054d2[_0x1e88('0x2f')]);_0x3ce81f[_0x1e88('0x30')]=_[_0x1e88('0x31')](_0x3ce81f['model'],_0x3ce81f[_0x1e88('0x2f')]);_0x592c06['attributes']=_['intersection'](_0x3ce81f[_0x1e88('0x32')],qs[_0x1e88('0x33')](_0x2054d2[_0x1e88('0x2f')][_0x1e88('0x33')]));_0x592c06[_0x1e88('0x34')]=_0x592c06[_0x1e88('0x34')][_0x1e88('0x35')]?_0x592c06[_0x1e88('0x34')]:_0x3ce81f['model'];if(!_0x2054d2[_0x1e88('0x2f')][_0x1e88('0x36')](_0x1e88('0x37'))){_0x592c06[_0x1e88('0x1d')]=qs['limit'](_0x2054d2[_0x1e88('0x2f')][_0x1e88('0x1d')]);_0x592c06[_0x1e88('0x1a')]=qs['offset'](_0x2054d2[_0x1e88('0x2f')]['offset']);}_0x592c06[_0x1e88('0x38')]=qs[_0x1e88('0x39')](_0x2054d2[_0x1e88('0x2f')][_0x1e88('0x39')]);_0x592c06[_0x1e88('0x3a')]=qs[_0x1e88('0x30')](_[_0x1e88('0x3b')](_0x2054d2[_0x1e88('0x2f')],_0x3ce81f[_0x1e88('0x30')]),_0x366d20);if(_0x2054d2[_0x1e88('0x2f')]['filter']){_0x592c06[_0x1e88('0x3a')]=_[_0x1e88('0x3c')](_0x592c06[_0x1e88('0x3a')],{'$or':_[_0x1e88('0x29')](_0x366d20,function(_0x234103){if(_0x234103['type']!=='VIRTUAL'){var _0x5727a8={};_0x5727a8[_0x234103[_0x1e88('0x27')]]={'$like':'%'+_0x2054d2[_0x1e88('0x2f')]['filter']+'%'};return _0x5727a8;}})});}_0x592c06=_[_0x1e88('0x3c')]({},_0x592c06,_0x2054d2['options']);var _0x3ca2bf={'where':_0x592c06[_0x1e88('0x3a')]};return db[_0x1e88('0x2a')][_0x1e88('0x1c')](_0x3ca2bf)[_0x1e88('0x22')](function(_0x3db0f5){_0x4aa24d[_0x1e88('0x1c')]=_0x3db0f5;if(_0x2054d2[_0x1e88('0x2f')]['includeAll']){_0x592c06['include']=[{'all':!![]}];}return db[_0x1e88('0x2a')]['findAll'](_0x592c06);})[_0x1e88('0x22')](function(_0x25a082){_0x4aa24d[_0x1e88('0x3d')]=_0x25a082;return _0x4aa24d;})[_0x1e88('0x22')](respondWithFilteredResult(_0x59dfc7,_0x592c06))[_0x1e88('0x3e')](handleError(_0x59dfc7,null));};exports['show']=function(_0x29fce8,_0x152e87){var _0x21d2b4={'raw':!![],'where':{'id':_0x29fce8[_0x1e88('0x3f')]['id']}},_0x20bf39={};_0x20bf39[_0x1e88('0x32')]=_[_0x1e88('0x40')](db[_0x1e88('0x2a')][_0x1e88('0x2b')]);_0x20bf39[_0x1e88('0x2f')]=_[_0x1e88('0x40')](_0x29fce8[_0x1e88('0x2f')]);_0x20bf39[_0x1e88('0x30')]=_[_0x1e88('0x31')](_0x20bf39['model'],_0x20bf39[_0x1e88('0x2f')]);_0x21d2b4['attributes']=_['intersection'](_0x20bf39[_0x1e88('0x32')],qs[_0x1e88('0x33')](_0x29fce8['query'][_0x1e88('0x33')]));_0x21d2b4['attributes']=_0x21d2b4[_0x1e88('0x34')][_0x1e88('0x35')]?_0x21d2b4[_0x1e88('0x34')]:_0x20bf39[_0x1e88('0x32')];if(_0x29fce8['query']['includeAll']){_0x21d2b4[_0x1e88('0x41')]=[{'all':!![]}];}_0x21d2b4=_[_0x1e88('0x3c')]({},_0x21d2b4,_0x29fce8[_0x1e88('0x42')]);return db[_0x1e88('0x2a')][_0x1e88('0x43')](_0x21d2b4)[_0x1e88('0x22')](handleEntityNotFound(_0x152e87,null))['then'](respondWithResult(_0x152e87,null))['catch'](handleError(_0x152e87,null));};exports[_0x1e88('0x44')]=function(_0x1c1b56,_0x3f813b){return db['FaxTransferReport'][_0x1e88('0x44')](_0x1c1b56[_0x1e88('0x45')],{})['then'](respondWithResult(_0x3f813b,0xc9))[_0x1e88('0x3e')](handleError(_0x3f813b,null));};exports['update']=function(_0x54a84c,_0x3c2217){if(_0x54a84c[_0x1e88('0x45')]['id']){delete _0x54a84c[_0x1e88('0x45')]['id'];}return db[_0x1e88('0x2a')][_0x1e88('0x43')]({'where':{'id':_0x54a84c[_0x1e88('0x3f')]['id']}})[_0x1e88('0x22')](handleEntityNotFound(_0x3c2217,null))[_0x1e88('0x22')](saveUpdates(_0x54a84c['body'],null))[_0x1e88('0x22')](respondWithResult(_0x3c2217,null))[_0x1e88('0x3e')](handleError(_0x3c2217,null));};exports[_0x1e88('0x23')]=function(_0x32d260,_0x5c9454){return db['FaxTransferReport']['find']({'where':{'id':_0x32d260['params']['id']}})[_0x1e88('0x22')](handleEntityNotFound(_0x5c9454,null))[_0x1e88('0x22')](removeEntity(_0x5c9454,null))['catch'](handleError(_0x5c9454,null));};exports[_0x1e88('0x46')]=function(_0x278e03,_0x2e112a){return db[_0x1e88('0x2a')][_0x1e88('0x46')]()[_0x1e88('0x22')](respondWithResult(_0x2e112a,null))[_0x1e88('0x3e')](handleError(_0x2e112a,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 5633d59..0d9be92 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 _0x18f3=['../../config/environment','./faxTransferReport.attributes','exports','define','uniqueid','util','../../config/logger','api','request-promise','rimraf'];(function(_0x482e5e,_0x1aa4b0){var _0x231cba=function(_0x488846){while(--_0x488846){_0x482e5e['push'](_0x482e5e['shift']());}};_0x231cba(++_0x1aa4b0);}(_0x18f3,0x19f));var _0x318f=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x18f3[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x318f('0x0'));var logger=require(_0x318f('0x1'))(_0x318f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x318f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x318f('0x4'));var config=require(_0x318f('0x5'));var attributes=require(_0x318f('0x6'));module[_0x318f('0x7')]=function(_0x52e7bc,_0x5f7340){return _0x52e7bc[_0x318f('0x8')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x318f('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x07a2=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x1c566b,_0x3618ab){var _0x13ed76=function(_0x5053df){while(--_0x5053df){_0x1c566b['push'](_0x1c566b['shift']());}};_0x13ed76(++_0x3618ab);}(_0x07a2,0x12c));var _0x207a=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0x07a2[_0x52f159];return _0x156799;};'use strict';var _=require(_0x207a('0x0'));var util=require(_0x207a('0x1'));var logger=require('../../config/logger')(_0x207a('0x2'));var moment=require(_0x207a('0x3'));var BPromise=require(_0x207a('0x4'));var rp=require(_0x207a('0x5'));var fs=require('fs');var path=require(_0x207a('0x6'));var rimraf=require(_0x207a('0x7'));var config=require(_0x207a('0x8'));var attributes=require(_0x207a('0x9'));module[_0x207a('0xa')]=function(_0x47dbbf,_0x5b1fa9){return _0x47dbbf[_0x207a('0xb')](_0x207a('0xc'),attributes,{'tableName':_0x207a('0xd'),'paranoid':![],'indexes':[{'name':_0x207a('0xe'),'fields':[_0x207a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 4d7cc75..63f7ae2 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 _0x4f77=['request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4f77,0x69));var _0x74f7=function(_0x375358,_0x272cca){_0x375358=_0x375358-0x0;var _0x363baf=_0x4f77[_0x375358];return _0x363baf;};'use strict';var _=require(_0x74f7('0x0'));var util=require('util');var moment=require(_0x74f7('0x1'));var BPromise=require(_0x74f7('0x2'));var rs=require(_0x74f7('0x3'));var fs=require('fs');var Redis=require(_0x74f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x74f7('0x5'))('rpc');var config=require(_0x74f7('0x6'));var jayson=require(_0x74f7('0x7'));var client=jayson[_0x74f7('0x8')][_0x74f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aadd9,_0x3beab7,_0x36138a){return new BPromise(function(_0x2c6097,_0x163b88){return client[_0x74f7('0xa')](_0x5aadd9,_0x36138a)[_0x74f7('0xb')](function(_0x3a8d09){logger[_0x74f7('0xc')](_0x74f7('0xd'),_0x3beab7,_0x74f7('0xe'));logger[_0x74f7('0xf')](_0x74f7('0x10'),_0x3beab7,_0x74f7('0xe'),JSON[_0x74f7('0x11')](_0x3a8d09));if(_0x3a8d09[_0x74f7('0x12')]){if(_0x3a8d09[_0x74f7('0x12')][_0x74f7('0x13')]===0x1f4){logger[_0x74f7('0x12')](_0x74f7('0xd'),_0x3beab7,_0x3a8d09[_0x74f7('0x12')]['message']);return _0x163b88(_0x3a8d09[_0x74f7('0x12')][_0x74f7('0x14')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x3beab7,_0x3a8d09['error'][_0x74f7('0x14')]);return _0x2c6097(_0x3a8d09[_0x74f7('0x12')]['message']);}else{logger[_0x74f7('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x3beab7,_0x74f7('0xe'));_0x2c6097(_0x3a8d09[_0x74f7('0x15')]['message']);}})[_0x74f7('0x16')](function(_0x5c42e4){logger[_0x74f7('0x12')](_0x74f7('0xd'),_0x3beab7,_0x5c42e4);_0x163b88(_0x5c42e4);});});} \ No newline at end of file +var _0xe8a5=['request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x307bf4,_0xc1ec2c){var _0x1e936a=function(_0x3c0cf5){while(--_0x3c0cf5){_0x307bf4['push'](_0x307bf4['shift']());}};_0x1e936a(++_0xc1ec2c);}(_0xe8a5,0x11f));var _0x5e8a=function(_0x53586d,_0x51f6e2){_0x53586d=_0x53586d-0x0;var _0x32c2dc=_0xe8a5[_0x53586d];return _0x32c2dc;};'use strict';var _=require(_0x5e8a('0x0'));var util=require(_0x5e8a('0x1'));var moment=require(_0x5e8a('0x2'));var BPromise=require('bluebird');var rs=require(_0x5e8a('0x3'));var fs=require('fs');var Redis=require(_0x5e8a('0x4'));var db=require(_0x5e8a('0x5'))['db'];var utils=require(_0x5e8a('0x6'));var logger=require(_0x5e8a('0x7'))(_0x5e8a('0x8'));var config=require(_0x5e8a('0x9'));var jayson=require(_0x5e8a('0xa'));var client=jayson[_0x5e8a('0xb')][_0x5e8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x79d3bf,_0x25e4c0,_0xc5d23d){return new BPromise(function(_0x495800,_0x531066){return client[_0x5e8a('0xd')](_0x79d3bf,_0xc5d23d)[_0x5e8a('0xe')](function(_0xd7939e){logger[_0x5e8a('0xf')](_0x5e8a('0x10'),_0x25e4c0,_0x5e8a('0x11'));logger['debug'](_0x5e8a('0x12'),_0x25e4c0,_0x5e8a('0x11'),JSON[_0x5e8a('0x13')](_0xd7939e));if(_0xd7939e['error']){if(_0xd7939e['error'][_0x5e8a('0x14')]===0x1f4){logger[_0x5e8a('0x15')](_0x5e8a('0x10'),_0x25e4c0,_0xd7939e[_0x5e8a('0x15')][_0x5e8a('0x16')]);return _0x531066(_0xd7939e[_0x5e8a('0x15')][_0x5e8a('0x16')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x25e4c0,_0xd7939e['error'][_0x5e8a('0x16')]);return _0x495800(_0xd7939e[_0x5e8a('0x15')]['message']);}else{logger[_0x5e8a('0xf')](_0x5e8a('0x10'),_0x25e4c0,'request\x20sent');_0x495800(_0xd7939e[_0x5e8a('0x17')]['message']);}})[_0x5e8a('0x18')](function(_0x156c56){logger[_0x5e8a('0x15')]('FaxTransferReport,\x20%s,\x20%s',_0x25e4c0,_0x156c56);_0x531066(_0x156c56);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 1f2097d..3880626 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 _0x8230=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2707ad,_0x15776c){var _0x4cce2a=function(_0x23ccd7){while(--_0x23ccd7){_0x2707ad['push'](_0x2707ad['shift']());}};_0x4cce2a(++_0x15776c);}(_0x8230,0x126));var _0x0823=function(_0x303383,_0x47b303){_0x303383=_0x303383-0x0;var _0x4b51c1=_0x8230[_0x303383];return _0x4b51c1;};'use strict';var multer=require(_0x0823('0x0'));var util=require(_0x0823('0x1'));var path=require(_0x0823('0x2'));var timeout=require(_0x0823('0x3'));var express=require(_0x0823('0x4'));var router=express[_0x0823('0x5')]();var fs_extra=require(_0x0823('0x6'));var auth=require(_0x0823('0x7'));var interaction=require(_0x0823('0x8'));var config=require(_0x0823('0x9'));var controller=require(_0x0823('0xa'));router['get']('/',auth[_0x0823('0xb')](),controller[_0x0823('0xc')]);router[_0x0823('0xd')]('/describe',auth[_0x0823('0xb')](),controller[_0x0823('0xe')]);router[_0x0823('0xd')](_0x0823('0xf'),auth[_0x0823('0xb')](),controller['show']);router[_0x0823('0x10')]('/',auth[_0x0823('0xb')](),controller[_0x0823('0x11')]);router[_0x0823('0x12')](_0x0823('0xf'),auth[_0x0823('0xb')](),controller[_0x0823('0x13')]);router[_0x0823('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x0823('0x15')]);module[_0x0823('0x16')]=router; \ No newline at end of file +var _0x5c85=['../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x192b7d,_0x3db1eb){var _0x57e19a=function(_0x15287d){while(--_0x15287d){_0x192b7d['push'](_0x192b7d['shift']());}};_0x57e19a(++_0x3db1eb);}(_0x5c85,0x12c));var _0x55c8=function(_0x45feba,_0x22ed20){_0x45feba=_0x45feba-0x0;var _0x2f42b3=_0x5c85[_0x45feba];return _0x2f42b3;};'use strict';var multer=require(_0x55c8('0x0'));var util=require(_0x55c8('0x1'));var path=require(_0x55c8('0x2'));var timeout=require(_0x55c8('0x3'));var express=require(_0x55c8('0x4'));var router=express[_0x55c8('0x5')]();var fs_extra=require(_0x55c8('0x6'));var auth=require(_0x55c8('0x7'));var interaction=require(_0x55c8('0x8'));var config=require(_0x55c8('0x9'));var controller=require(_0x55c8('0xa'));router[_0x55c8('0xb')]('/',auth[_0x55c8('0xc')](),controller[_0x55c8('0xd')]);router['get'](_0x55c8('0xe'),auth[_0x55c8('0xc')](),controller[_0x55c8('0xf')]);router[_0x55c8('0xb')](_0x55c8('0x10'),auth[_0x55c8('0xc')](),controller[_0x55c8('0x11')]);router[_0x55c8('0x12')]('/',auth[_0x55c8('0xc')](),controller['create']);router['put'](_0x55c8('0x10'),auth[_0x55c8('0xc')](),controller[_0x55c8('0x13')]);router[_0x55c8('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x55c8('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index a011ace..8b7b3a0 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 _0x4ed9=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','post','create','addConfiguration'];(function(_0x5b8df6,_0x3afca6){var _0x234e78=function(_0x25fc14){while(--_0x25fc14){_0x5b8df6['push'](_0x5b8df6['shift']());}};_0x234e78(++_0x3afca6);}(_0x4ed9,0x8f));var _0x94ed=function(_0x8cf087,_0x1afb6c){_0x8cf087=_0x8cf087-0x0;var _0x27657b=_0x4ed9[_0x8cf087];return _0x27657b;};'use strict';var multer=require(_0x94ed('0x0'));var util=require(_0x94ed('0x1'));var path=require('path');var timeout=require(_0x94ed('0x2'));var express=require(_0x94ed('0x3'));var router=express['Router']();var fs_extra=require(_0x94ed('0x4'));var auth=require(_0x94ed('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x94ed('0x6'));var controller=require(_0x94ed('0x7'));router['get']('/',auth[_0x94ed('0x8')](),controller[_0x94ed('0x9')]);router[_0x94ed('0xa')](_0x94ed('0xb'),auth['isAuthenticated'](),controller[_0x94ed('0xc')]);router[_0x94ed('0xa')](_0x94ed('0xd'),auth[_0x94ed('0x8')](),controller[_0x94ed('0xe')]);router['get']('/:id/fields',auth[_0x94ed('0x8')](),controller['getFields']);router[_0x94ed('0xf')]('/',auth['isAuthenticated'](),controller[_0x94ed('0x10')]);router[_0x94ed('0xf')](_0x94ed('0xd'),auth[_0x94ed('0x8')](),controller[_0x94ed('0x11')]);router[_0x94ed('0x12')](_0x94ed('0xb'),auth[_0x94ed('0x8')](),controller[_0x94ed('0x13')]);router[_0x94ed('0x14')](_0x94ed('0xb'),auth[_0x94ed('0x8')](),controller[_0x94ed('0x15')]);module[_0x94ed('0x16')]=router; \ No newline at end of file +var _0x92fa=['create','addConfiguration','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','post'];(function(_0x434c5e,_0x187980){var _0x37384b=function(_0x14ca58){while(--_0x14ca58){_0x434c5e['push'](_0x434c5e['shift']());}};_0x37384b(++_0x187980);}(_0x92fa,0xf6));var _0xa92f=function(_0x566314,_0x45bf04){_0x566314=_0x566314-0x0;var _0xdd2e3e=_0x92fa[_0x566314];return _0xdd2e3e;};'use strict';var multer=require(_0xa92f('0x0'));var util=require('util');var path=require(_0xa92f('0x1'));var timeout=require(_0xa92f('0x2'));var express=require(_0xa92f('0x3'));var router=express['Router']();var fs_extra=require(_0xa92f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa92f('0x5'));var controller=require(_0xa92f('0x6'));router[_0xa92f('0x7')]('/',auth[_0xa92f('0x8')](),controller[_0xa92f('0x9')]);router[_0xa92f('0x7')](_0xa92f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa92f('0x7')](_0xa92f('0xb'),auth[_0xa92f('0x8')](),controller[_0xa92f('0xc')]);router[_0xa92f('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xa92f('0xd')]('/',auth['isAuthenticated'](),controller[_0xa92f('0xe')]);router[_0xa92f('0xd')]('/:id/configurations',auth[_0xa92f('0x8')](),controller[_0xa92f('0xf')]);router['put'](_0xa92f('0xa'),auth[_0xa92f('0x8')](),controller[_0xa92f('0x10')]);router[_0xa92f('0x11')](_0xa92f('0xa'),auth['isAuthenticated'](),controller[_0xa92f('0x12')]);module[_0xa92f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 7c55455..2c0cb68 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 _0xac2a=['ENUM','basic','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x7bc7cc,_0x34f208){var _0x4f031d=function(_0x3948a7){while(--_0x3948a7){_0x7bc7cc['push'](_0x7bc7cc['shift']());}};_0x4f031d(++_0x34f208);}(_0xac2a,0x123));var _0xaac2=function(_0x58c151,_0xf5ef26){_0x58c151=_0x58c151-0x0;var _0x4b8cd2=_0xac2a[_0x58c151];return _0x4b8cd2;};'use strict';var Sequelize=require(_0xaac2('0x0'));module[_0xaac2('0x1')]={'name':{'type':Sequelize[_0xaac2('0x2')]},'description':{'type':Sequelize[_0xaac2('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xaac2('0x2')]},'authType':{'type':Sequelize[_0xaac2('0x3')](_0xaac2('0x4')),'defaultValue':_0xaac2('0x4')},'password':{'type':Sequelize[_0xaac2('0x2')]},'consumerKey':{'type':Sequelize[_0xaac2('0x2')]},'consumerSecret':{'type':Sequelize[_0xaac2('0x2')]},'token':{'type':Sequelize[_0xaac2('0x2')]},'tokenSecret':{'type':Sequelize[_0xaac2('0x2')]},'serverUrl':{'type':Sequelize[_0xaac2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaac2('0x3')]('integrationTab',_0xaac2('0x5')),'defaultValue':_0xaac2('0x6')}}; \ No newline at end of file +var _0x7246=['ENUM','basic','integrationTab','sequelize','STRING'];(function(_0x233de0,_0x543435){var _0x2dc5da=function(_0x507f5f){while(--_0x507f5f){_0x233de0['push'](_0x233de0['shift']());}};_0x2dc5da(++_0x543435);}(_0x7246,0x116));var _0x6724=function(_0x4989c7,_0x263d5c){_0x4989c7=_0x4989c7-0x0;var _0x380ad2=_0x7246[_0x4989c7];return _0x380ad2;};'use strict';var Sequelize=require(_0x6724('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6724('0x1')]},'username':{'type':Sequelize[_0x6724('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x6724('0x2')](_0x6724('0x3')),'defaultValue':_0x6724('0x3')},'password':{'type':Sequelize[_0x6724('0x1')]},'consumerKey':{'type':Sequelize[_0x6724('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6724('0x1')]},'tokenSecret':{'type':Sequelize[_0x6724('0x1')]},'serverUrl':{'type':Sequelize[_0x6724('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6724('0x2')](_0x6724('0x4'),'newTab'),'defaultValue':_0x6724('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 17f2340..5e67098 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 _0x5fd6=['attributes','fields','length','hasOwnProperty','sort','filter','where','merge','type','VIRTUAL','options','DeskAccount','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','getConfigurations','findOne','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','priority','authType','username','consumerKey','token','tokenSecret','remoteUri','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','toString','base64','_embedded','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','fieldName','key','model','query','keys','filters','intersection'];(function(_0x3c5ece,_0x582c45){var _0x4870fb=function(_0x19b62e){while(--_0x19b62e){_0x3c5ece['push'](_0x3c5ece['shift']());}};_0x4870fb(++_0x582c45);}(_0x5fd6,0x120));var _0x65fd=function(_0x2ba7fc,_0x50ee98){_0x2ba7fc=_0x2ba7fc-0x0;var _0x1a0efd=_0x5fd6[_0x2ba7fc];return _0x1a0efd;};'use strict';var emlformat=require(_0x65fd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x65fd('0x1'));var rp=require(_0x65fd('0x2'));var moment=require(_0x65fd('0x3'));var BPromise=require(_0x65fd('0x4'));var Mustache=require(_0x65fd('0x5'));var util=require(_0x65fd('0x6'));var path=require(_0x65fd('0x7'));var sox=require(_0x65fd('0x8'));var csv=require(_0x65fd('0x9'));var ejs=require(_0x65fd('0xa'));var fs=require('fs');var fs_extra=require(_0x65fd('0xb'));var _=require(_0x65fd('0xc'));var squel=require(_0x65fd('0xd'));var crypto=require(_0x65fd('0xe'));var jsforce=require(_0x65fd('0xf'));var deskjs=require(_0x65fd('0x10'));var toCsv=require(_0x65fd('0x9'));var querystring=require(_0x65fd('0x11'));var Papa=require('papaparse');var Redis=require(_0x65fd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x65fd('0x13'));var hardwareService=require(_0x65fd('0x14'));var logger=require(_0x65fd('0x15'))(_0x65fd('0x16'));var utils=require(_0x65fd('0x17'));var config=require(_0x65fd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x65fd('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x509140,_0x4a3287){_0x4a3287=_0x4a3287||0xcc;return function(_0x2514d1){if(_0x2514d1){return _0x509140[_0x65fd('0x1a')](_0x4a3287);}return _0x509140[_0x65fd('0x1b')](_0x4a3287)[_0x65fd('0x1c')]();};}function respondWithResult(_0x118a29,_0x32e5f6){_0x32e5f6=_0x32e5f6||0xc8;return function(_0x4fed46){if(_0x4fed46){return _0x118a29[_0x65fd('0x1b')](_0x32e5f6)['json'](_0x4fed46);}};}function respondWithFilteredResult(_0x174c76,_0x2492dd){return function(_0x391375){if(_0x391375){var _0x322bb4=typeof _0x2492dd[_0x65fd('0x1d')]==='undefined'&&typeof _0x2492dd[_0x65fd('0x1e')]===_0x65fd('0x1f');var _0xd4a5c0=_0x391375[_0x65fd('0x20')];var _0x1d2b7e=_0x322bb4?0x0:_0x2492dd[_0x65fd('0x1d')];var _0x173be1=_0x322bb4?_0x391375[_0x65fd('0x20')]:_0x2492dd[_0x65fd('0x1d')]+_0x2492dd[_0x65fd('0x1e')];var _0x14101d;if(_0x173be1>=_0xd4a5c0){_0x173be1=_0xd4a5c0;_0x14101d=0xc8;}else{_0x14101d=0xce;}_0x174c76[_0x65fd('0x1b')](_0x14101d);return _0x174c76[_0x65fd('0x21')](_0x65fd('0x22'),_0x1d2b7e+'-'+_0x173be1+'/'+_0xd4a5c0)[_0x65fd('0x23')](_0x391375);}return null;};}function patchUpdates(_0x40576c){return function(_0x5dcf87){try{jsonpatch[_0x65fd('0x24')](_0x5dcf87,_0x40576c,!![]);}catch(_0x3fa2ed){return BPromise[_0x65fd('0x25')](_0x3fa2ed);}return _0x5dcf87[_0x65fd('0x26')]();};}function saveUpdates(_0x3b2808,_0xff9059){return function(_0x515ea3){if(_0x515ea3){return _0x515ea3[_0x65fd('0x27')](_0x3b2808)[_0x65fd('0x28')](function(_0x443c14){return _0x443c14;});}return null;};}function removeEntity(_0x1714c9,_0x5cca06){return function(_0x359ede){if(_0x359ede){return _0x359ede[_0x65fd('0x29')]()[_0x65fd('0x28')](function(){_0x1714c9['status'](0xcc)[_0x65fd('0x1c')]();});}};}function handleEntityNotFound(_0x55676b,_0x148ed1){return function(_0x2ab495){if(!_0x2ab495){_0x55676b[_0x65fd('0x1a')](0x194);}return _0x2ab495;};}function handleError(_0x53d295,_0x2f5264){_0x2f5264=_0x2f5264||0x1f4;return function(_0x4cc7eb){logger[_0x65fd('0x2a')](_0x4cc7eb[_0x65fd('0x2b')]);if(_0x4cc7eb[_0x65fd('0x2c')]){delete _0x4cc7eb[_0x65fd('0x2c')];}_0x53d295[_0x65fd('0x1b')](_0x2f5264)['send'](_0x4cc7eb);};}exports[_0x65fd('0x2d')]=function(_0x37e198,_0x5264ae){var _0x2bc266={},_0x2b6490={},_0x28dd29={'count':0x0,'rows':[]};var _0x2b2fc6=_[_0x65fd('0x2e')](db['DeskAccount']['rawAttributes'],function(_0x35e103){return{'name':_0x35e103[_0x65fd('0x2f')],'type':_0x35e103['type'][_0x65fd('0x30')]};});_0x2b6490[_0x65fd('0x31')]=_[_0x65fd('0x2e')](_0x2b2fc6,_0x65fd('0x2c'));_0x2b6490[_0x65fd('0x32')]=_[_0x65fd('0x33')](_0x37e198['query']);_0x2b6490[_0x65fd('0x34')]=_[_0x65fd('0x35')](_0x2b6490[_0x65fd('0x31')],_0x2b6490[_0x65fd('0x32')]);_0x2bc266[_0x65fd('0x36')]=_[_0x65fd('0x35')](_0x2b6490['model'],qs[_0x65fd('0x37')](_0x37e198[_0x65fd('0x32')][_0x65fd('0x37')]));_0x2bc266[_0x65fd('0x36')]=_0x2bc266[_0x65fd('0x36')][_0x65fd('0x38')]?_0x2bc266[_0x65fd('0x36')]:_0x2b6490['model'];if(!_0x37e198[_0x65fd('0x32')][_0x65fd('0x39')]('nolimit')){_0x2bc266[_0x65fd('0x1e')]=qs['limit'](_0x37e198[_0x65fd('0x32')][_0x65fd('0x1e')]);_0x2bc266[_0x65fd('0x1d')]=qs[_0x65fd('0x1d')](_0x37e198[_0x65fd('0x32')][_0x65fd('0x1d')]);}_0x2bc266['order']=qs[_0x65fd('0x3a')](_0x37e198[_0x65fd('0x32')][_0x65fd('0x3a')]);_0x2bc266['where']=qs[_0x65fd('0x34')](_['pick'](_0x37e198['query'],_0x2b6490['filters']),_0x2b2fc6);if(_0x37e198[_0x65fd('0x32')][_0x65fd('0x3b')]){_0x2bc266[_0x65fd('0x3c')]=_[_0x65fd('0x3d')](_0x2bc266[_0x65fd('0x3c')],{'$or':_[_0x65fd('0x2e')](_0x2b2fc6,function(_0x10ed75){if(_0x10ed75[_0x65fd('0x3e')]!==_0x65fd('0x3f')){var _0x149e9e={};_0x149e9e[_0x10ed75[_0x65fd('0x2c')]]={'$like':'%'+_0x37e198['query']['filter']+'%'};return _0x149e9e;}})});}_0x2bc266=_[_0x65fd('0x3d')]({},_0x2bc266,_0x37e198[_0x65fd('0x40')]);var _0x10781c={'where':_0x2bc266[_0x65fd('0x3c')]};return db[_0x65fd('0x41')][_0x65fd('0x20')](_0x10781c)[_0x65fd('0x28')](function(_0x3b415a){_0x28dd29[_0x65fd('0x20')]=_0x3b415a;if(_0x37e198['query'][_0x65fd('0x42')]){_0x2bc266['include']=[{'all':!![]}];}return db['DeskAccount'][_0x65fd('0x43')](_0x2bc266);})[_0x65fd('0x28')](function(_0xf16473){_0x28dd29[_0x65fd('0x44')]=_0xf16473;return _0x28dd29;})[_0x65fd('0x28')](respondWithFilteredResult(_0x5264ae,_0x2bc266))[_0x65fd('0x45')](handleError(_0x5264ae,null));};exports[_0x65fd('0x46')]=function(_0x5a3faa,_0xd722a0){var _0x55c777={'raw':![],'where':{'id':_0x5a3faa[_0x65fd('0x47')]['id']}},_0x5c54c6={};_0x5c54c6[_0x65fd('0x31')]=_[_0x65fd('0x33')](db['DeskAccount'][_0x65fd('0x48')]);_0x5c54c6['query']=_[_0x65fd('0x33')](_0x5a3faa['query']);_0x5c54c6[_0x65fd('0x34')]=_[_0x65fd('0x35')](_0x5c54c6['model'],_0x5c54c6[_0x65fd('0x32')]);_0x55c777['attributes']=_['intersection'](_0x5c54c6['model'],qs['fields'](_0x5a3faa[_0x65fd('0x32')]['fields']));_0x55c777[_0x65fd('0x36')]=_0x55c777[_0x65fd('0x36')]['length']?_0x55c777[_0x65fd('0x36')]:_0x5c54c6[_0x65fd('0x31')];if(_0x5a3faa[_0x65fd('0x32')][_0x65fd('0x42')]){_0x55c777[_0x65fd('0x49')]=[{'all':!![]}];}_0x55c777=_[_0x65fd('0x3d')]({},_0x55c777,_0x5a3faa[_0x65fd('0x40')]);return db[_0x65fd('0x41')][_0x65fd('0x4a')](_0x55c777)[_0x65fd('0x28')](handleEntityNotFound(_0xd722a0,null))[_0x65fd('0x28')](respondWithResult(_0xd722a0,null))[_0x65fd('0x45')](handleError(_0xd722a0,null));};exports[_0x65fd('0x4b')]=function(_0x18b518,_0x23dc10){return db['DeskAccount']['create'](_0x18b518[_0x65fd('0x4c')],{})[_0x65fd('0x28')](respondWithResult(_0x23dc10,0xc9))['catch'](handleError(_0x23dc10,null));};exports[_0x65fd('0x27')]=function(_0x4057a2,_0x464080){if(_0x4057a2[_0x65fd('0x4c')]['id']){delete _0x4057a2['body']['id'];}return db[_0x65fd('0x41')][_0x65fd('0x4a')]({'where':{'id':_0x4057a2[_0x65fd('0x47')]['id']}})[_0x65fd('0x28')](handleEntityNotFound(_0x464080,null))['then'](saveUpdates(_0x4057a2[_0x65fd('0x4c')],null))[_0x65fd('0x28')](respondWithResult(_0x464080,null))[_0x65fd('0x45')](handleError(_0x464080,null));};exports[_0x65fd('0x29')]=function(_0x506c80,_0x3dc835){return db[_0x65fd('0x41')]['find']({'where':{'id':_0x506c80[_0x65fd('0x47')]['id']}})['then'](handleEntityNotFound(_0x3dc835,null))[_0x65fd('0x28')](removeEntity(_0x3dc835,null))[_0x65fd('0x45')](handleError(_0x3dc835,null));};exports[_0x65fd('0x4d')]=function(_0x45864a,_0x500e9f,_0x105b4f){var _0x45ecf2={};var _0x3653dc={};var _0x259777;var _0x4a4ba1;return db[_0x65fd('0x41')][_0x65fd('0x4e')]({'where':{'id':_0x45864a['params']['id']}})['then'](handleEntityNotFound(_0x500e9f,null))[_0x65fd('0x28')](function(_0x7e05c){if(_0x7e05c){_0x259777=_0x7e05c;_0x3653dc['model']=_[_0x65fd('0x33')](db['DeskConfiguration'][_0x65fd('0x48')]);_0x3653dc[_0x65fd('0x32')]=_[_0x65fd('0x33')](_0x45864a['query']);_0x3653dc[_0x65fd('0x34')]=_[_0x65fd('0x35')](_0x3653dc['model'],_0x3653dc[_0x65fd('0x32')]);_0x45ecf2[_0x65fd('0x36')]=_[_0x65fd('0x35')](_0x3653dc[_0x65fd('0x31')],qs[_0x65fd('0x37')](_0x45864a[_0x65fd('0x32')]['fields']));_0x45ecf2[_0x65fd('0x36')]=_0x45ecf2['attributes'][_0x65fd('0x38')]?_0x45ecf2[_0x65fd('0x36')]:_0x3653dc['model'];_0x45ecf2[_0x65fd('0x4f')]=qs[_0x65fd('0x3a')](_0x45864a[_0x65fd('0x32')][_0x65fd('0x3a')]);_0x45ecf2[_0x65fd('0x3c')]=qs['filters'](_['pick'](_0x45864a[_0x65fd('0x32')],_0x3653dc[_0x65fd('0x34')]));if(_0x45864a[_0x65fd('0x32')][_0x65fd('0x3b')]){_0x45ecf2[_0x65fd('0x3c')]=_[_0x65fd('0x3d')](_0x45ecf2[_0x65fd('0x3c')],{'$or':_[_0x65fd('0x2e')](_0x45ecf2['attributes'],function(_0x20e72d){var _0x4aa3d6={};_0x4aa3d6[_0x20e72d]={'$like':'%'+_0x45864a[_0x65fd('0x32')]['filter']+'%'};return _0x4aa3d6;})});}_0x45ecf2=_[_0x65fd('0x3d')]({},_0x45ecf2,_0x45864a[_0x65fd('0x40')]);return _0x259777[_0x65fd('0x4d')](_0x45ecf2);}})['then'](function(_0x4b0453){if(_0x4b0453){_0x4a4ba1=_0x4b0453[_0x65fd('0x38')];if(!_0x45864a['query'][_0x65fd('0x39')](_0x65fd('0x50'))){_0x45ecf2[_0x65fd('0x1e')]=qs[_0x65fd('0x1e')](_0x45864a['query'][_0x65fd('0x1e')]);_0x45ecf2[_0x65fd('0x1d')]=qs['offset'](_0x45864a[_0x65fd('0x32')][_0x65fd('0x1d')]);}return _0x259777[_0x65fd('0x4d')](_0x45ecf2);}})[_0x65fd('0x28')](function(_0x2d623b){if(_0x2d623b){return _0x2d623b?{'count':_0x4a4ba1,'rows':_0x2d623b}:null;}})[_0x65fd('0x28')](respondWithResult(_0x500e9f,null))[_0x65fd('0x45')](handleError(_0x500e9f,null));};exports[_0x65fd('0x51')]=function(_0x524c61,_0x270968,_0x206eb4){if(_0x524c61[_0x65fd('0x4c')]['id']){delete _0x524c61[_0x65fd('0x4c')]['id'];}return db[_0x65fd('0x41')][_0x65fd('0x4e')]({'where':{'id':_0x524c61[_0x65fd('0x47')]['id']}})[_0x65fd('0x28')](handleEntityNotFound(_0x270968,null))['then'](function(_0x36b88c){if(_0x36b88c){_0x524c61[_0x65fd('0x4c')][_0x65fd('0x52')]=_0x36b88c['id'];_0x524c61[_0x65fd('0x4c')][_0x65fd('0x53')]=integrations[_0x65fd('0x54')](_0x524c61[_0x65fd('0x4c')][_0x65fd('0x55')],_0x524c61[_0x65fd('0x4c')][_0x65fd('0x3e')]);_0x524c61[_0x65fd('0x4c')][_0x65fd('0x56')]=integrations[_0x65fd('0x57')](_0x524c61[_0x65fd('0x4c')][_0x65fd('0x55')],_0x524c61[_0x65fd('0x4c')]['type']);return db['DeskConfiguration'][_0x65fd('0x4b')](_0x524c61[_0x65fd('0x4c')],{'include':[{'model':db[_0x65fd('0x58')],'as':_0x65fd('0x53')},{'model':db['DeskField'],'as':_0x65fd('0x56')}]});}return null;})[_0x65fd('0x28')](respondWithResult(_0x270968,null))[_0x65fd('0x45')](handleError(_0x270968,null));};exports['getFields']=function(_0x4231b6,_0x417828,_0x5bad9a){var _0x4d90e8=[{'name':_0x65fd('0x59'),'label':_0x65fd('0x59'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x435c7d='';return db[_0x65fd('0x41')][_0x65fd('0x4e')]({'where':{'id':_0x4231b6[_0x65fd('0x47')]['id']},'attributes':['id','remoteUri',_0x65fd('0x5a'),_0x65fd('0x5b'),'password',_0x65fd('0x5c'),'consumerSecret',_0x65fd('0x5d'),_0x65fd('0x5e')]})['then'](handleEntityNotFound(_0x417828,null))[_0x65fd('0x28')](function(_0x524680){if(_0x524680){_0x435c7d=_0x524680[_0x65fd('0x5f')];var _0x3aadc4=_0x435c7d['slice'](-0x1);if(_0x3aadc4==='/'){_0x435c7d=_0x435c7d[_0x65fd('0x60')](0x0,_0x435c7d[_0x65fd('0x61')](_0x3aadc4));}var _0xb275b4={'method':_0x65fd('0x62'),'uri':util[_0x65fd('0x63')](_0x65fd('0x64'),_0x435c7d),'headers':{'Content-Type':_0x65fd('0x65'),'Accept':_0x65fd('0x65')},'json':!![]};if(_0x524680[_0x65fd('0x5a')]==='basic'){_0xb275b4[_0x65fd('0x66')][_0x65fd('0x67')]=util[_0x65fd('0x63')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x524680[_0x65fd('0x5b')],_0x524680['password']))[_0x65fd('0x68')](_0x65fd('0x69')));}return rp(_0xb275b4)[_0x65fd('0x28')](function(_0x18e9db){return _0x4d90e8['concat'](_[_0x65fd('0x2e')](_0x18e9db[_0x65fd('0x6a')]['entries'],function(_0x2577c5){return{'id':_0x2577c5['name'],'name':_0x2577c5[_0x65fd('0x2c')],'type':_0x2577c5[_0x65fd('0x3e')],'active':_0x2577c5['active'],'label':_0x2577c5[_0x65fd('0x6b')],'custom':!![]};}));});}})[_0x65fd('0x28')](function(_0x120e54){return{'count':_0x120e54[_0x65fd('0x38')],'rows':_0x120e54};})['then'](respondWithResult(_0x417828,null))[_0x65fd('0x45')](function(_0x4d5e4c){var _0x450a95=_0x4231b6[_0x65fd('0x32')][_0x65fd('0x6c')]?0x1f4:_0x4d5e4c[_0x65fd('0x6d')]||0x1f4;logger[_0x65fd('0x2a')](_0x65fd('0x6e'),_0x65fd('0x6f'),_0x450a95,JSON['stringify'](_0x4d5e4c));delete _0x4d5e4c['name'];if(_0x450a95===0x191){_0x450a95=0x190;}_0x417828[_0x65fd('0x1b')](_0x450a95)[_0x65fd('0x70')](_0x4231b6[_0x65fd('0x32')][_0x65fd('0x6c')]?{'message':_0x65fd('0x71'),'statusCode':_0x4d5e4c['statusCode']}:_0x4d5e4c);});}; \ No newline at end of file +var _0xea5c=['toString','base64','_embedded','entries','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','rimraf','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','apply','reject','update','destroy','error','stack','name','map','DeskAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','then','includeAll','include','catch','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','DeskConfiguration','order','Subjects','getSubjects','channel','Descriptions','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','basic','headers','Basic\x20%s','%s:%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xea5c,0xdb));var _0xcea5=function(_0x4ca4de,_0xec53eb){_0x4ca4de=_0x4ca4de-0x0;var _0x211dfc=_0xea5c[_0x4ca4de];return _0x211dfc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcea5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcea5('0x1'));var Mustache=require(_0xcea5('0x2'));var util=require(_0xcea5('0x3'));var path=require(_0xcea5('0x4'));var sox=require('sox');var csv=require(_0xcea5('0x5'));var ejs=require(_0xcea5('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcea5('0x7'));var squel=require(_0xcea5('0x8'));var crypto=require(_0xcea5('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xcea5('0xa'));var toCsv=require(_0xcea5('0x5'));var querystring=require(_0xcea5('0xb'));var Papa=require(_0xcea5('0xc'));var Redis=require('ioredis');var authService=require(_0xcea5('0xd'));var qs=require(_0xcea5('0xe'));var as=require(_0xcea5('0xf'));var hardwareService=require(_0xcea5('0x10'));var logger=require(_0xcea5('0x11'))(_0xcea5('0x12'));var utils=require(_0xcea5('0x13'));var config=require(_0xcea5('0x14'));var licenseUtil=require(_0xcea5('0x15'));var db=require(_0xcea5('0x16'))['db'];var integrations=require(_0xcea5('0x17'));function respondWithStatusCode(_0xb8965c,_0x3e44ac){_0x3e44ac=_0x3e44ac||0xcc;return function(_0x9f523c){if(_0x9f523c){return _0xb8965c[_0xcea5('0x18')](_0x3e44ac);}return _0xb8965c[_0xcea5('0x19')](_0x3e44ac)[_0xcea5('0x1a')]();};}function respondWithResult(_0x1d40c4,_0x52ed3a){_0x52ed3a=_0x52ed3a||0xc8;return function(_0x49f08f){if(_0x49f08f){return _0x1d40c4[_0xcea5('0x19')](_0x52ed3a)[_0xcea5('0x1b')](_0x49f08f);}};}function respondWithFilteredResult(_0x22df61,_0x550c39){return function(_0x87089b){if(_0x87089b){var _0x2db533=typeof _0x550c39[_0xcea5('0x1c')]==='undefined'&&typeof _0x550c39[_0xcea5('0x1d')]==='undefined';var _0x52f969=_0x87089b[_0xcea5('0x1e')];var _0x5702b3=_0x2db533?0x0:_0x550c39[_0xcea5('0x1c')];var _0x397c60=_0x2db533?_0x87089b['count']:_0x550c39[_0xcea5('0x1c')]+_0x550c39[_0xcea5('0x1d')];var _0x376be7;if(_0x397c60>=_0x52f969){_0x397c60=_0x52f969;_0x376be7=0xc8;}else{_0x376be7=0xce;}_0x22df61[_0xcea5('0x19')](_0x376be7);return _0x22df61['set']('Content-Range',_0x5702b3+'-'+_0x397c60+'/'+_0x52f969)[_0xcea5('0x1b')](_0x87089b);}return null;};}function patchUpdates(_0x5a1abf){return function(_0x37b67b){try{jsonpatch[_0xcea5('0x1f')](_0x37b67b,_0x5a1abf,!![]);}catch(_0x569118){return BPromise[_0xcea5('0x20')](_0x569118);}return _0x37b67b['save']();};}function saveUpdates(_0x55555c,_0x18e68a){return function(_0x1b6b07){if(_0x1b6b07){return _0x1b6b07[_0xcea5('0x21')](_0x55555c)['then'](function(_0x42415d){return _0x42415d;});}return null;};}function removeEntity(_0x2e7076,_0x3ed74d){return function(_0x4379cb){if(_0x4379cb){return _0x4379cb[_0xcea5('0x22')]()['then'](function(){_0x2e7076['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae545,_0x11e9ef){return function(_0x505a0e){if(!_0x505a0e){_0x1ae545[_0xcea5('0x18')](0x194);}return _0x505a0e;};}function handleError(_0x1c17b1,_0x4796d0){_0x4796d0=_0x4796d0||0x1f4;return function(_0x1c2a13){logger[_0xcea5('0x23')](_0x1c2a13[_0xcea5('0x24')]);if(_0x1c2a13[_0xcea5('0x25')]){delete _0x1c2a13['name'];}_0x1c17b1['status'](_0x4796d0)['send'](_0x1c2a13);};}exports['index']=function(_0x2e9a7d,_0x509401){var _0x2d071c={},_0x13b4a1={},_0x34a2e3={'count':0x0,'rows':[]};var _0x2236b4=_[_0xcea5('0x26')](db[_0xcea5('0x27')]['rawAttributes'],function(_0x4960df){return{'name':_0x4960df['fieldName'],'type':_0x4960df[_0xcea5('0x28')][_0xcea5('0x29')]};});_0x13b4a1[_0xcea5('0x2a')]=_[_0xcea5('0x26')](_0x2236b4,'name');_0x13b4a1[_0xcea5('0x2b')]=_[_0xcea5('0x2c')](_0x2e9a7d['query']);_0x13b4a1[_0xcea5('0x2d')]=_[_0xcea5('0x2e')](_0x13b4a1[_0xcea5('0x2a')],_0x13b4a1['query']);_0x2d071c[_0xcea5('0x2f')]=_['intersection'](_0x13b4a1['model'],qs[_0xcea5('0x30')](_0x2e9a7d[_0xcea5('0x2b')][_0xcea5('0x30')]));_0x2d071c['attributes']=_0x2d071c[_0xcea5('0x2f')][_0xcea5('0x31')]?_0x2d071c['attributes']:_0x13b4a1[_0xcea5('0x2a')];if(!_0x2e9a7d[_0xcea5('0x2b')][_0xcea5('0x32')](_0xcea5('0x33'))){_0x2d071c[_0xcea5('0x1d')]=qs['limit'](_0x2e9a7d[_0xcea5('0x2b')][_0xcea5('0x1d')]);_0x2d071c[_0xcea5('0x1c')]=qs[_0xcea5('0x1c')](_0x2e9a7d[_0xcea5('0x2b')][_0xcea5('0x1c')]);}_0x2d071c['order']=qs[_0xcea5('0x34')](_0x2e9a7d[_0xcea5('0x2b')][_0xcea5('0x34')]);_0x2d071c[_0xcea5('0x35')]=qs[_0xcea5('0x2d')](_[_0xcea5('0x36')](_0x2e9a7d[_0xcea5('0x2b')],_0x13b4a1[_0xcea5('0x2d')]),_0x2236b4);if(_0x2e9a7d[_0xcea5('0x2b')]['filter']){_0x2d071c[_0xcea5('0x35')]=_[_0xcea5('0x37')](_0x2d071c['where'],{'$or':_['map'](_0x2236b4,function(_0x445f77){if(_0x445f77[_0xcea5('0x28')]!==_0xcea5('0x38')){var _0x2fe108={};_0x2fe108[_0x445f77['name']]={'$like':'%'+_0x2e9a7d[_0xcea5('0x2b')][_0xcea5('0x39')]+'%'};return _0x2fe108;}})});}_0x2d071c=_[_0xcea5('0x37')]({},_0x2d071c,_0x2e9a7d['options']);var _0x4be035={'where':_0x2d071c[_0xcea5('0x35')]};return db[_0xcea5('0x27')]['count'](_0x4be035)[_0xcea5('0x3a')](function(_0x4ce31b){_0x34a2e3[_0xcea5('0x1e')]=_0x4ce31b;if(_0x2e9a7d['query'][_0xcea5('0x3b')]){_0x2d071c[_0xcea5('0x3c')]=[{'all':!![]}];}return db[_0xcea5('0x27')]['findAll'](_0x2d071c);})[_0xcea5('0x3a')](function(_0x5e5022){_0x34a2e3['rows']=_0x5e5022;return _0x34a2e3;})[_0xcea5('0x3a')](respondWithFilteredResult(_0x509401,_0x2d071c))[_0xcea5('0x3d')](handleError(_0x509401,null));};exports[_0xcea5('0x3e')]=function(_0x10f502,_0x4d9435){var _0xc87e57={'raw':![],'where':{'id':_0x10f502[_0xcea5('0x3f')]['id']}},_0x1c6d3e={};_0x1c6d3e['model']=_['keys'](db['DeskAccount'][_0xcea5('0x40')]);_0x1c6d3e['query']=_[_0xcea5('0x2c')](_0x10f502[_0xcea5('0x2b')]);_0x1c6d3e[_0xcea5('0x2d')]=_[_0xcea5('0x2e')](_0x1c6d3e[_0xcea5('0x2a')],_0x1c6d3e['query']);_0xc87e57['attributes']=_[_0xcea5('0x2e')](_0x1c6d3e['model'],qs[_0xcea5('0x30')](_0x10f502[_0xcea5('0x2b')]['fields']));_0xc87e57['attributes']=_0xc87e57['attributes'][_0xcea5('0x31')]?_0xc87e57['attributes']:_0x1c6d3e[_0xcea5('0x2a')];if(_0x10f502['query'][_0xcea5('0x3b')]){_0xc87e57['include']=[{'all':!![]}];}_0xc87e57=_[_0xcea5('0x37')]({},_0xc87e57,_0x10f502[_0xcea5('0x41')]);return db[_0xcea5('0x27')][_0xcea5('0x42')](_0xc87e57)[_0xcea5('0x3a')](handleEntityNotFound(_0x4d9435,null))[_0xcea5('0x3a')](respondWithResult(_0x4d9435,null))[_0xcea5('0x3d')](handleError(_0x4d9435,null));};exports[_0xcea5('0x43')]=function(_0x3deb24,_0x5c8fa1){return db[_0xcea5('0x27')][_0xcea5('0x43')](_0x3deb24['body'],{})[_0xcea5('0x3a')](respondWithResult(_0x5c8fa1,0xc9))[_0xcea5('0x3d')](handleError(_0x5c8fa1,null));};exports[_0xcea5('0x21')]=function(_0x21daaa,_0x4ef244){if(_0x21daaa['body']['id']){delete _0x21daaa[_0xcea5('0x44')]['id'];}return db[_0xcea5('0x27')][_0xcea5('0x42')]({'where':{'id':_0x21daaa[_0xcea5('0x3f')]['id']}})[_0xcea5('0x3a')](handleEntityNotFound(_0x4ef244,null))['then'](saveUpdates(_0x21daaa[_0xcea5('0x44')],null))[_0xcea5('0x3a')](respondWithResult(_0x4ef244,null))[_0xcea5('0x3d')](handleError(_0x4ef244,null));};exports['destroy']=function(_0x1b3662,_0x27e0bc){return db[_0xcea5('0x27')][_0xcea5('0x42')]({'where':{'id':_0x1b3662[_0xcea5('0x3f')]['id']}})[_0xcea5('0x3a')](handleEntityNotFound(_0x27e0bc,null))[_0xcea5('0x3a')](removeEntity(_0x27e0bc,null))[_0xcea5('0x3d')](handleError(_0x27e0bc,null));};exports[_0xcea5('0x45')]=function(_0x4b258c,_0x1905fa,_0x15004f){var _0x306142={};var _0x958b07={};var _0x247adf;var _0x40540c;return db[_0xcea5('0x27')][_0xcea5('0x46')]({'where':{'id':_0x4b258c['params']['id']}})['then'](handleEntityNotFound(_0x1905fa,null))[_0xcea5('0x3a')](function(_0x2b9f09){if(_0x2b9f09){_0x247adf=_0x2b9f09;_0x958b07[_0xcea5('0x2a')]=_[_0xcea5('0x2c')](db[_0xcea5('0x47')][_0xcea5('0x40')]);_0x958b07[_0xcea5('0x2b')]=_[_0xcea5('0x2c')](_0x4b258c['query']);_0x958b07[_0xcea5('0x2d')]=_[_0xcea5('0x2e')](_0x958b07[_0xcea5('0x2a')],_0x958b07[_0xcea5('0x2b')]);_0x306142[_0xcea5('0x2f')]=_[_0xcea5('0x2e')](_0x958b07[_0xcea5('0x2a')],qs['fields'](_0x4b258c[_0xcea5('0x2b')][_0xcea5('0x30')]));_0x306142['attributes']=_0x306142[_0xcea5('0x2f')][_0xcea5('0x31')]?_0x306142[_0xcea5('0x2f')]:_0x958b07['model'];_0x306142[_0xcea5('0x48')]=qs[_0xcea5('0x34')](_0x4b258c[_0xcea5('0x2b')][_0xcea5('0x34')]);_0x306142[_0xcea5('0x35')]=qs['filters'](_[_0xcea5('0x36')](_0x4b258c['query'],_0x958b07[_0xcea5('0x2d')]));if(_0x4b258c['query'][_0xcea5('0x39')]){_0x306142[_0xcea5('0x35')]=_[_0xcea5('0x37')](_0x306142[_0xcea5('0x35')],{'$or':_['map'](_0x306142[_0xcea5('0x2f')],function(_0x5e5bbc){var _0x103a90={};_0x103a90[_0x5e5bbc]={'$like':'%'+_0x4b258c[_0xcea5('0x2b')][_0xcea5('0x39')]+'%'};return _0x103a90;})});}_0x306142=_[_0xcea5('0x37')]({},_0x306142,_0x4b258c['options']);return _0x247adf[_0xcea5('0x45')](_0x306142);}})[_0xcea5('0x3a')](function(_0x1df15d){if(_0x1df15d){_0x40540c=_0x1df15d[_0xcea5('0x31')];if(!_0x4b258c[_0xcea5('0x2b')]['hasOwnProperty'](_0xcea5('0x33'))){_0x306142['limit']=qs[_0xcea5('0x1d')](_0x4b258c[_0xcea5('0x2b')][_0xcea5('0x1d')]);_0x306142[_0xcea5('0x1c')]=qs[_0xcea5('0x1c')](_0x4b258c['query'][_0xcea5('0x1c')]);}return _0x247adf[_0xcea5('0x45')](_0x306142);}})['then'](function(_0x1d89cd){if(_0x1d89cd){return _0x1d89cd?{'count':_0x40540c,'rows':_0x1d89cd}:null;}})['then'](respondWithResult(_0x1905fa,null))['catch'](handleError(_0x1905fa,null));};exports['addConfiguration']=function(_0x413fe0,_0x164f9a,_0x4b8619){if(_0x413fe0['body']['id']){delete _0x413fe0[_0xcea5('0x44')]['id'];}return db['DeskAccount'][_0xcea5('0x46')]({'where':{'id':_0x413fe0[_0xcea5('0x3f')]['id']}})[_0xcea5('0x3a')](handleEntityNotFound(_0x164f9a,null))[_0xcea5('0x3a')](function(_0x161eda){if(_0x161eda){_0x413fe0[_0xcea5('0x44')]['AccountId']=_0x161eda['id'];_0x413fe0[_0xcea5('0x44')][_0xcea5('0x49')]=integrations[_0xcea5('0x4a')](_0x413fe0[_0xcea5('0x44')][_0xcea5('0x4b')],_0x413fe0[_0xcea5('0x44')][_0xcea5('0x28')]);_0x413fe0['body'][_0xcea5('0x4c')]=integrations['getDescriptions'](_0x413fe0['body'][_0xcea5('0x4b')],_0x413fe0[_0xcea5('0x44')]['type']);return db[_0xcea5('0x47')][_0xcea5('0x43')](_0x413fe0[_0xcea5('0x44')],{'include':[{'model':db['DeskField'],'as':_0xcea5('0x49')},{'model':db['DeskField'],'as':_0xcea5('0x4c')}]});}return null;})['then'](respondWithResult(_0x164f9a,null))[_0xcea5('0x3d')](handleError(_0x164f9a,null));};exports[_0xcea5('0x4d')]=function(_0x4be7cb,_0x5d3c46,_0x5edd6c){var _0x103190=[{'name':_0xcea5('0x4e'),'label':_0xcea5('0x4e'),'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 _0x55cba5='';return db['DeskAccount'][_0xcea5('0x46')]({'where':{'id':_0x4be7cb[_0xcea5('0x3f')]['id']},'attributes':['id',_0xcea5('0x4f'),_0xcea5('0x50'),'username',_0xcea5('0x51'),_0xcea5('0x52'),_0xcea5('0x53'),_0xcea5('0x54'),_0xcea5('0x55')]})['then'](handleEntityNotFound(_0x5d3c46,null))['then'](function(_0x55f9ce){if(_0x55f9ce){_0x55cba5=_0x55f9ce[_0xcea5('0x4f')];var _0x13de1f=_0x55cba5[_0xcea5('0x56')](-0x1);if(_0x13de1f==='/'){_0x55cba5=_0x55cba5[_0xcea5('0x57')](0x0,_0x55cba5[_0xcea5('0x58')](_0x13de1f));}var _0x52ed82={'method':_0xcea5('0x59'),'uri':util[_0xcea5('0x5a')]('%s/custom_fields',_0x55cba5),'headers':{'Content-Type':_0xcea5('0x5b'),'Accept':_0xcea5('0x5b')},'json':!![]};if(_0x55f9ce[_0xcea5('0x50')]===_0xcea5('0x5c')){_0x52ed82[_0xcea5('0x5d')]['Authorization']=util[_0xcea5('0x5a')](_0xcea5('0x5e'),new Buffer(util['format'](_0xcea5('0x5f'),_0x55f9ce['username'],_0x55f9ce[_0xcea5('0x51')]))[_0xcea5('0x60')](_0xcea5('0x61')));}return rp(_0x52ed82)[_0xcea5('0x3a')](function(_0x430318){return _0x103190['concat'](_[_0xcea5('0x26')](_0x430318[_0xcea5('0x62')][_0xcea5('0x63')],function(_0x4f18e1){return{'id':_0x4f18e1[_0xcea5('0x25')],'name':_0x4f18e1[_0xcea5('0x25')],'type':_0x4f18e1['type'],'active':_0x4f18e1['active'],'label':_0x4f18e1['label'],'custom':!![]};}));});}})[_0xcea5('0x3a')](function(_0x1eaddd){return{'count':_0x1eaddd[_0xcea5('0x31')],'rows':_0x1eaddd};})[_0xcea5('0x3a')](respondWithResult(_0x5d3c46,null))[_0xcea5('0x3d')](function(_0x425882){var _0x109edd=_0x4be7cb[_0xcea5('0x2b')]['test']?0x1f4:_0x425882['statusCode']||0x1f4;logger[_0xcea5('0x23')](_0xcea5('0x64'),_0xcea5('0x4d'),_0x109edd,JSON[_0xcea5('0x65')](_0x425882));delete _0x425882[_0xcea5('0x25')];if(_0x109edd===0x191){_0x109edd=0x190;}_0x5d3c46[_0xcea5('0x19')](_0x109edd)[_0xcea5('0x66')](_0x4be7cb[_0xcea5('0x2b')]['test']?{'message':_0xcea5('0x67'),'statusCode':_0x425882[_0xcea5('0x68')]}:_0x425882);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index d019ebd..0ba6b06 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 _0xf7bd=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3003c7,_0x551d60){var _0x2ed54d=function(_0xb85ad3){while(--_0xb85ad3){_0x3003c7['push'](_0x3003c7['shift']());}};_0x2ed54d(++_0x551d60);}(_0xf7bd,0xc5));var _0xdf7b=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xf7bd[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0xdf7b('0x0'));var util=require('util');var logger=require(_0xdf7b('0x1'))(_0xdf7b('0x2'));var moment=require('moment');var BPromise=require(_0xdf7b('0x3'));var rp=require(_0xdf7b('0x4'));var fs=require('fs');var path=require(_0xdf7b('0x5'));var rimraf=require(_0xdf7b('0x6'));var config=require(_0xdf7b('0x7'));var attributes=require(_0xdf7b('0x8'));var integrations=require(_0xdf7b('0x9'));module['exports']=function(_0x157e4d,_0x4562e6){return _0x157e4d['define'](_0xdf7b('0xa'),attributes,{'tableName':_0xdf7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14fd=['int_desk_accounts','util','api','moment','rimraf','../../config/environment','../../components/integrations/configuration','exports','DeskAccount'];(function(_0x68d84d,_0x154588){var _0x191eb6=function(_0x1b837f){while(--_0x1b837f){_0x68d84d['push'](_0x68d84d['shift']());}};_0x191eb6(++_0x154588);}(_0x14fd,0x14e));var _0xd14f=function(_0xba0253,_0x3f6728){_0xba0253=_0xba0253-0x0;var _0x251c75=_0x14fd[_0xba0253];return _0x251c75;};'use strict';var _=require('lodash');var util=require(_0xd14f('0x0'));var logger=require('../../config/logger')(_0xd14f('0x1'));var moment=require(_0xd14f('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd14f('0x3'));var config=require(_0xd14f('0x4'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xd14f('0x5'));module[_0xd14f('0x6')]=function(_0xc201cf,_0x3ec41d){return _0xc201cf['define'](_0xd14f('0x7'),attributes,{'tableName':_0xd14f('0x8'),'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 07e24f3..ac579df 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 _0xac62=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll','options','where','attributes','include','map','model','GetDeskAccount','ShowDeskAccount','DeskAccount','find','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','DeskAccount,\x20%s,\x20%s'];(function(_0x1fff34,_0x126ad9){var _0x19e201=function(_0x115d1f){while(--_0x115d1f){_0x1fff34['push'](_0x1fff34['shift']());}};_0x19e201(++_0x126ad9);}(_0xac62,0x17e));var _0x2ac6=function(_0x19fd3f,_0x8adcfa){_0x19fd3f=_0x19fd3f-0x0;var _0x28ad05=_0xac62[_0x19fd3f];return _0x28ad05;};'use strict';var _=require(_0x2ac6('0x0'));var util=require(_0x2ac6('0x1'));var moment=require(_0x2ac6('0x2'));var BPromise=require(_0x2ac6('0x3'));var rs=require(_0x2ac6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ac6('0x5'))['db'];var utils=require(_0x2ac6('0x6'));var logger=require(_0x2ac6('0x7'))(_0x2ac6('0x8'));var config=require(_0x2ac6('0x9'));var jayson=require(_0x2ac6('0xa'));var client=jayson[_0x2ac6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54787c,_0x1a4281,_0x3c067f){return new BPromise(function(_0x64a364,_0xb2b72a){return client[_0x2ac6('0xc')](_0x54787c,_0x3c067f)['then'](function(_0x525705){logger['info'](_0x2ac6('0xd'),_0x1a4281,_0x2ac6('0xe'));logger[_0x2ac6('0xf')](_0x2ac6('0x10'),_0x1a4281,'request\x20sent',JSON[_0x2ac6('0x11')](_0x525705));if(_0x525705[_0x2ac6('0x12')]){if(_0x525705['error'][_0x2ac6('0x13')]===0x1f4){logger['error'](_0x2ac6('0xd'),_0x1a4281,_0x525705['error'][_0x2ac6('0x14')]);return _0xb2b72a(_0x525705[_0x2ac6('0x12')][_0x2ac6('0x14')]);}logger[_0x2ac6('0x12')](_0x2ac6('0xd'),_0x1a4281,_0x525705[_0x2ac6('0x12')][_0x2ac6('0x14')]);return _0x64a364(_0x525705['error'][_0x2ac6('0x14')]);}else{logger[_0x2ac6('0x15')](_0x2ac6('0xd'),_0x1a4281,_0x2ac6('0xe'));_0x64a364(_0x525705[_0x2ac6('0x16')]['message']);}})[_0x2ac6('0x17')](function(_0x50095e){logger[_0x2ac6('0x12')]('DeskAccount,\x20%s,\x20%s',_0x1a4281,_0x50095e);_0xb2b72a(_0x50095e);});});}exports['GetDeskAccount']=function(_0x443d19){var _0x2ef9f3=this;return new Promise(function(_0x423e30,_0x48819d){return db['DeskAccount'][_0x2ac6('0x18')]({'raw':_0x443d19['options']?_0x443d19[_0x2ac6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x443d19[_0x2ac6('0x19')]?_0x443d19[_0x2ac6('0x19')][_0x2ac6('0x1a')]||null:null,'attributes':_0x443d19[_0x2ac6('0x19')]?_0x443d19[_0x2ac6('0x19')][_0x2ac6('0x1b')]||null:null,'limit':_0x443d19[_0x2ac6('0x19')]?_0x443d19[_0x2ac6('0x19')]['limit']||null:null,'include':_0x443d19[_0x2ac6('0x19')]?_0x443d19[_0x2ac6('0x19')][_0x2ac6('0x1c')]?_[_0x2ac6('0x1d')](_0x443d19['options'][_0x2ac6('0x1c')],function(_0x45c3f1){return{'model':db[_0x45c3f1[_0x2ac6('0x1e')]],'as':_0x45c3f1['as'],'attributes':_0x45c3f1['attributes'],'include':_0x45c3f1[_0x2ac6('0x1c')]?_[_0x2ac6('0x1d')](_0x45c3f1['include'],function(_0x45c584){return{'model':db[_0x45c584[_0x2ac6('0x1e')]],'as':_0x45c584['as'],'attributes':_0x45c584['attributes'],'include':_0x45c584[_0x2ac6('0x1c')]?_['map'](_0x45c584[_0x2ac6('0x1c')],function(_0x30de89){return{'model':db[_0x30de89[_0x2ac6('0x1e')]],'as':_0x30de89['as'],'attributes':_0x30de89[_0x2ac6('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x806eeb){logger[_0x2ac6('0x15')](_0x2ac6('0x1f'),_0x443d19);logger['debug'](_0x2ac6('0x1f'),_0x443d19,JSON[_0x2ac6('0x11')](_0x806eeb));_0x423e30(_0x806eeb);})['catch'](function(_0x8b76c4){logger['error'](_0x2ac6('0x1f'),_0x8b76c4['message'],_0x443d19);_0x48819d(_0x2ef9f3['error'](0x1f4,_0x8b76c4['message']));});});};exports[_0x2ac6('0x20')]=function(_0xbe0233){var _0x36d019=this;return new Promise(function(_0x5a2b67,_0x20f6b5){return db[_0x2ac6('0x21')][_0x2ac6('0x22')]({'raw':_0xbe0233[_0x2ac6('0x19')]?_0xbe0233[_0x2ac6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xbe0233[_0x2ac6('0x19')]?_0xbe0233[_0x2ac6('0x19')][_0x2ac6('0x1a')]||null:null,'attributes':_0xbe0233[_0x2ac6('0x19')]?_0xbe0233['options']['attributes']||null:null,'include':_0xbe0233['options']?_0xbe0233[_0x2ac6('0x19')][_0x2ac6('0x1c')]?_['map'](_0xbe0233[_0x2ac6('0x19')]['include'],function(_0x51dd63){return{'model':db[_0x51dd63[_0x2ac6('0x1e')]],'as':_0x51dd63['as'],'attributes':_0x51dd63[_0x2ac6('0x1b')],'include':_0x51dd63[_0x2ac6('0x1c')]?_[_0x2ac6('0x1d')](_0x51dd63[_0x2ac6('0x1c')],function(_0xa44a5f){return{'model':db[_0xa44a5f[_0x2ac6('0x1e')]],'as':_0xa44a5f['as'],'attributes':_0xa44a5f[_0x2ac6('0x1b')],'include':_0xa44a5f['include']?_[_0x2ac6('0x1d')](_0xa44a5f[_0x2ac6('0x1c')],function(_0x473162){return{'model':db[_0x473162[_0x2ac6('0x1e')]],'as':_0x473162['as'],'attributes':_0x473162[_0x2ac6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2ac6('0x23')](function(_0x10b932){logger[_0x2ac6('0x15')](_0x2ac6('0x20'),_0xbe0233);logger[_0x2ac6('0xf')](_0x2ac6('0x20'),_0xbe0233,JSON[_0x2ac6('0x11')](_0x10b932));_0x5a2b67(_0x10b932);})[_0x2ac6('0x17')](function(_0x21635d){logger[_0x2ac6('0x12')]('ShowDeskAccount',_0x21635d['message'],_0xbe0233);_0x20f6b5(_0x36d019[_0x2ac6('0x12')](0x1f4,_0x21635d[_0x2ac6('0x14')]));});});}; \ No newline at end of file +var _0x19de=['catch','ShowDeskAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','model','attributes','include','map'];(function(_0x5bc1c8,_0x4bc72d){var _0x186384=function(_0x4d332c){while(--_0x4d332c){_0x5bc1c8['push'](_0x5bc1c8['shift']());}};_0x186384(++_0x4bc72d);}(_0x19de,0xf0));var _0xe19d=function(_0x237567,_0x22637d){_0x237567=_0x237567-0x0;var _0x6c81b=_0x19de[_0x237567];return _0x6c81b;};'use strict';var _=require(_0xe19d('0x0'));var util=require(_0xe19d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe19d('0x2'));var fs=require('fs');var Redis=require(_0xe19d('0x3'));var db=require(_0xe19d('0x4'))['db'];var utils=require(_0xe19d('0x5'));var logger=require(_0xe19d('0x6'))(_0xe19d('0x7'));var config=require(_0xe19d('0x8'));var jayson=require(_0xe19d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14f835,_0x1de443,_0x4c2e55){return new BPromise(function(_0x17db90,_0x2b1358){return client[_0xe19d('0xa')](_0x14f835,_0x4c2e55)[_0xe19d('0xb')](function(_0x5512ef){logger[_0xe19d('0xc')](_0xe19d('0xd'),_0x1de443,_0xe19d('0xe'));logger[_0xe19d('0xf')](_0xe19d('0x10'),_0x1de443,'request\x20sent',JSON[_0xe19d('0x11')](_0x5512ef));if(_0x5512ef[_0xe19d('0x12')]){if(_0x5512ef[_0xe19d('0x12')][_0xe19d('0x13')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x1de443,_0x5512ef[_0xe19d('0x12')][_0xe19d('0x14')]);return _0x2b1358(_0x5512ef[_0xe19d('0x12')][_0xe19d('0x14')]);}logger[_0xe19d('0x12')](_0xe19d('0xd'),_0x1de443,_0x5512ef[_0xe19d('0x12')][_0xe19d('0x14')]);return _0x17db90(_0x5512ef[_0xe19d('0x12')][_0xe19d('0x14')]);}else{logger[_0xe19d('0xc')]('DeskAccount,\x20%s,\x20%s',_0x1de443,'request\x20sent');_0x17db90(_0x5512ef['result'][_0xe19d('0x14')]);}})['catch'](function(_0x5c116a){logger['error'](_0xe19d('0xd'),_0x1de443,_0x5c116a);_0x2b1358(_0x5c116a);});});}exports[_0xe19d('0x15')]=function(_0x208a3a){var _0x4b7c88=this;return new Promise(function(_0x683f90,_0x506281){return db[_0xe19d('0x16')][_0xe19d('0x17')]({'raw':_0x208a3a[_0xe19d('0x18')]?_0x208a3a['options'][_0xe19d('0x19')]===undefined?!![]:![]:!![],'where':_0x208a3a[_0xe19d('0x18')]?_0x208a3a[_0xe19d('0x18')][_0xe19d('0x1a')]||null:null,'attributes':_0x208a3a['options']?_0x208a3a[_0xe19d('0x18')]['attributes']||null:null,'limit':_0x208a3a[_0xe19d('0x18')]?_0x208a3a[_0xe19d('0x18')][_0xe19d('0x1b')]||null:null,'include':_0x208a3a[_0xe19d('0x18')]?_0x208a3a[_0xe19d('0x18')]['include']?_['map'](_0x208a3a[_0xe19d('0x18')]['include'],function(_0x470fb8){return{'model':db[_0x470fb8[_0xe19d('0x1c')]],'as':_0x470fb8['as'],'attributes':_0x470fb8[_0xe19d('0x1d')],'include':_0x470fb8[_0xe19d('0x1e')]?_[_0xe19d('0x1f')](_0x470fb8[_0xe19d('0x1e')],function(_0x411159){return{'model':db[_0x411159['model']],'as':_0x411159['as'],'attributes':_0x411159[_0xe19d('0x1d')],'include':_0x411159[_0xe19d('0x1e')]?_[_0xe19d('0x1f')](_0x411159[_0xe19d('0x1e')],function(_0x3cf677){return{'model':db[_0x3cf677['model']],'as':_0x3cf677['as'],'attributes':_0x3cf677[_0xe19d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe19d('0xb')](function(_0x387a9d){logger[_0xe19d('0xc')](_0xe19d('0x15'),_0x208a3a);logger[_0xe19d('0xf')](_0xe19d('0x15'),_0x208a3a,JSON['stringify'](_0x387a9d));_0x683f90(_0x387a9d);})[_0xe19d('0x20')](function(_0x77338b){logger[_0xe19d('0x12')](_0xe19d('0x15'),_0x77338b[_0xe19d('0x14')],_0x208a3a);_0x506281(_0x4b7c88['error'](0x1f4,_0x77338b[_0xe19d('0x14')]));});});};exports[_0xe19d('0x21')]=function(_0x501d8c){var _0x3743aa=this;return new Promise(function(_0xcdcd38,_0x2b9ae0){return db[_0xe19d('0x16')]['find']({'raw':_0x501d8c[_0xe19d('0x18')]?_0x501d8c[_0xe19d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x501d8c[_0xe19d('0x18')]?_0x501d8c[_0xe19d('0x18')][_0xe19d('0x1a')]||null:null,'attributes':_0x501d8c['options']?_0x501d8c['options'][_0xe19d('0x1d')]||null:null,'include':_0x501d8c[_0xe19d('0x18')]?_0x501d8c[_0xe19d('0x18')][_0xe19d('0x1e')]?_[_0xe19d('0x1f')](_0x501d8c[_0xe19d('0x18')]['include'],function(_0x5d0e29){return{'model':db[_0x5d0e29['model']],'as':_0x5d0e29['as'],'attributes':_0x5d0e29[_0xe19d('0x1d')],'include':_0x5d0e29['include']?_['map'](_0x5d0e29[_0xe19d('0x1e')],function(_0x5310cc){return{'model':db[_0x5310cc[_0xe19d('0x1c')]],'as':_0x5310cc['as'],'attributes':_0x5310cc[_0xe19d('0x1d')],'include':_0x5310cc['include']?_[_0xe19d('0x1f')](_0x5310cc[_0xe19d('0x1e')],function(_0x6b8706){return{'model':db[_0x6b8706['model']],'as':_0x6b8706['as'],'attributes':_0x6b8706[_0xe19d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32be0c){logger[_0xe19d('0xc')](_0xe19d('0x21'),_0x501d8c);logger[_0xe19d('0xf')](_0xe19d('0x21'),_0x501d8c,JSON[_0xe19d('0x11')](_0x32be0c));_0xcdcd38(_0x32be0c);})['catch'](function(_0x4ac6e0){logger[_0xe19d('0x12')](_0xe19d('0x21'),_0x4ac6e0[_0xe19d('0x14')],_0x501d8c);_0x2b9ae0(_0x3743aa[_0xe19d('0x12')](0x1f4,_0x4ac6e0[_0xe19d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 0c69520..b00509b 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(_0x3466fe,_0x2642cd){var _0x595b5d=function(_0x3d871b){while(--_0x3d871b){_0x3466fe['push'](_0x3466fe['shift']());}};_0x595b5d(++_0x2642cd);}(_0x008c,0x188));var _0xc008=function(_0x36c3c7,_0x52f866){_0x36c3c7=_0x36c3c7-0x0;var _0x52bc17=_0x008c[_0x36c3c7];return _0x52bc17;};'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(_0x1a7e84,_0x4e373a){var _0x3ae481=function(_0x5ce21a){while(--_0x5ce21a){_0x1a7e84['push'](_0x1a7e84['shift']());}};_0x3ae481(++_0x4e373a);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'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 640fda8..f6b8886 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 _0x9ad0=['exports','STRING'];(function(_0x3cb5a3,_0x5b9d5f){var _0x44d5b7=function(_0x3ade07){while(--_0x3ade07){_0x3cb5a3['push'](_0x3cb5a3['shift']());}};_0x44d5b7(++_0x5b9d5f);}(_0x9ad0,0x1b6));var _0x09ad=function(_0x29e100,_0x333722){_0x29e100=_0x29e100-0x0;var _0x3d1f30=_0x9ad0[_0x29e100];return _0x3d1f30;};'use strict';var Sequelize=require('sequelize');module[_0x09ad('0x0')]={'name':{'type':Sequelize[_0x09ad('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xff73=['exports','STRING','sequelize'];(function(_0x5717ac,_0xbb31e7){var _0xfcf5e=function(_0x22a4da){while(--_0x22a4da){_0x5717ac['push'](_0x5717ac['shift']());}};_0xfcf5e(++_0xbb31e7);}(_0xff73,0xe0));var _0x3ff7=function(_0x2e4977,_0x214199){_0x2e4977=_0x2e4977-0x0;var _0x301ce2=_0xff73[_0x2e4977];return _0x301ce2;};'use strict';var Sequelize=require(_0x3ff7('0x0'));module[_0x3ff7('0x1')]={'name':{'type':Sequelize[_0x3ff7('0x2')]},'description':{'type':Sequelize[_0x3ff7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 20acbfd..7ba31bc 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 _0x21ba=['map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','includeAll','findAll','rows','catch','show','length','include','create','body','find','params','destroy','getFields','DeskField','getSubjects','findOne','options','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','DeskConfiguration','rawAttributes','fieldName','type','key'];(function(_0x18a81a,_0x4fc65b){var _0x114027=function(_0x1b7e0f){while(--_0x1b7e0f){_0x18a81a['push'](_0x18a81a['shift']());}};_0x114027(++_0x4fc65b);}(_0x21ba,0xca));var _0xa21b=function(_0x329888,_0x5865bf){_0x329888=_0x329888-0x0;var _0xd2061d=_0x21ba[_0x329888];return _0xd2061d;};'use strict';var emlformat=require(_0xa21b('0x0'));var rimraf=require(_0xa21b('0x1'));var zipdir=require(_0xa21b('0x2'));var jsonpatch=require(_0xa21b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa21b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa21b('0x5'));var sox=require(_0xa21b('0x6'));var csv=require('to-csv');var ejs=require(_0xa21b('0x7'));var fs=require('fs');var fs_extra=require(_0xa21b('0x8'));var _=require(_0xa21b('0x9'));var squel=require(_0xa21b('0xa'));var crypto=require(_0xa21b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa21b('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa21b('0xd'));var Papa=require(_0xa21b('0xe'));var Redis=require(_0xa21b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa21b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa21b('0x11'));var logger=require(_0xa21b('0x12'))('api');var utils=require(_0xa21b('0x13'));var config=require(_0xa21b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa21b('0x15'))['db'];function respondWithStatusCode(_0x1db561,_0x4e1a52){_0x4e1a52=_0x4e1a52||0xcc;return function(_0x2c13c0){if(_0x2c13c0){return _0x1db561['sendStatus'](_0x4e1a52);}return _0x1db561[_0xa21b('0x16')](_0x4e1a52)[_0xa21b('0x17')]();};}function respondWithResult(_0x1243bf,_0x3c1b2d){_0x3c1b2d=_0x3c1b2d||0xc8;return function(_0x5eecc3){if(_0x5eecc3){return _0x1243bf[_0xa21b('0x16')](_0x3c1b2d)[_0xa21b('0x18')](_0x5eecc3);}};}function respondWithFilteredResult(_0x10d821,_0x4e5381){return function(_0x4cc797){if(_0x4cc797){var _0x115712=typeof _0x4e5381[_0xa21b('0x19')]===_0xa21b('0x1a')&&typeof _0x4e5381[_0xa21b('0x1b')]==='undefined';var _0x223f53=_0x4cc797[_0xa21b('0x1c')];var _0x1cc789=_0x115712?0x0:_0x4e5381['offset'];var _0x4ba949=_0x115712?_0x4cc797[_0xa21b('0x1c')]:_0x4e5381[_0xa21b('0x19')]+_0x4e5381['limit'];var _0x48b2ea;if(_0x4ba949>=_0x223f53){_0x4ba949=_0x223f53;_0x48b2ea=0xc8;}else{_0x48b2ea=0xce;}_0x10d821[_0xa21b('0x16')](_0x48b2ea);return _0x10d821[_0xa21b('0x1d')](_0xa21b('0x1e'),_0x1cc789+'-'+_0x4ba949+'/'+_0x223f53)['json'](_0x4cc797);}return null;};}function patchUpdates(_0xa930b6){return function(_0x5d4afd){try{jsonpatch[_0xa21b('0x1f')](_0x5d4afd,_0xa930b6,!![]);}catch(_0x4c2fa4){return BPromise[_0xa21b('0x20')](_0x4c2fa4);}return _0x5d4afd['save']();};}function saveUpdates(_0x51b994,_0x378a27){return function(_0x48e627){if(_0x48e627){return _0x48e627[_0xa21b('0x21')](_0x51b994)[_0xa21b('0x22')](function(_0x1bbf50){return _0x1bbf50;});}return null;};}function removeEntity(_0x415858,_0xd05a81){return function(_0x54f84a){if(_0x54f84a){return _0x54f84a['destroy']()[_0xa21b('0x22')](function(){_0x415858[_0xa21b('0x16')](0xcc)[_0xa21b('0x17')]();});}};}function handleEntityNotFound(_0x1e075a,_0x681937){return function(_0x5cab90){if(!_0x5cab90){_0x1e075a['sendStatus'](0x194);}return _0x5cab90;};}function handleError(_0x3afd6a,_0x53f7ab){_0x53f7ab=_0x53f7ab||0x1f4;return function(_0x5abd65){logger[_0xa21b('0x23')](_0x5abd65[_0xa21b('0x24')]);if(_0x5abd65[_0xa21b('0x25')]){delete _0x5abd65[_0xa21b('0x25')];}_0x3afd6a[_0xa21b('0x16')](_0x53f7ab)[_0xa21b('0x26')](_0x5abd65);};}exports['index']=function(_0x5edfa3,_0x2945ed){var _0x15704a={},_0x41a1d7={},_0x102621={'count':0x0,'rows':[]};var _0x14fa5a=_['map'](db[_0xa21b('0x27')][_0xa21b('0x28')],function(_0x379a0b){return{'name':_0x379a0b[_0xa21b('0x29')],'type':_0x379a0b[_0xa21b('0x2a')][_0xa21b('0x2b')]};});_0x41a1d7['model']=_[_0xa21b('0x2c')](_0x14fa5a,_0xa21b('0x25'));_0x41a1d7[_0xa21b('0x2d')]=_[_0xa21b('0x2e')](_0x5edfa3[_0xa21b('0x2d')]);_0x41a1d7[_0xa21b('0x2f')]=_[_0xa21b('0x30')](_0x41a1d7[_0xa21b('0x31')],_0x41a1d7['query']);_0x15704a[_0xa21b('0x32')]=_['intersection'](_0x41a1d7['model'],qs[_0xa21b('0x33')](_0x5edfa3[_0xa21b('0x2d')]['fields']));_0x15704a[_0xa21b('0x32')]=_0x15704a[_0xa21b('0x32')]['length']?_0x15704a[_0xa21b('0x32')]:_0x41a1d7[_0xa21b('0x31')];if(!_0x5edfa3[_0xa21b('0x2d')][_0xa21b('0x34')](_0xa21b('0x35'))){_0x15704a['limit']=qs[_0xa21b('0x1b')](_0x5edfa3[_0xa21b('0x2d')]['limit']);_0x15704a[_0xa21b('0x19')]=qs['offset'](_0x5edfa3[_0xa21b('0x2d')][_0xa21b('0x19')]);}_0x15704a[_0xa21b('0x36')]=qs['sort'](_0x5edfa3[_0xa21b('0x2d')][_0xa21b('0x37')]);_0x15704a['where']=qs[_0xa21b('0x2f')](_[_0xa21b('0x38')](_0x5edfa3[_0xa21b('0x2d')],_0x41a1d7[_0xa21b('0x2f')]),_0x14fa5a);if(_0x5edfa3['query']['filter']){_0x15704a[_0xa21b('0x39')]=_[_0xa21b('0x3a')](_0x15704a[_0xa21b('0x39')],{'$or':_[_0xa21b('0x2c')](_0x14fa5a,function(_0x53dbb7){if(_0x53dbb7[_0xa21b('0x2a')]!=='VIRTUAL'){var _0x50cd61={};_0x50cd61[_0x53dbb7[_0xa21b('0x25')]]={'$like':'%'+_0x5edfa3[_0xa21b('0x2d')][_0xa21b('0x3b')]+'%'};return _0x50cd61;}})});}_0x15704a=_[_0xa21b('0x3a')]({},_0x15704a,_0x5edfa3['options']);var _0x147638={'where':_0x15704a[_0xa21b('0x39')]};return db[_0xa21b('0x27')][_0xa21b('0x1c')](_0x147638)[_0xa21b('0x22')](function(_0x162328){_0x102621[_0xa21b('0x1c')]=_0x162328;if(_0x5edfa3[_0xa21b('0x2d')][_0xa21b('0x3c')]){_0x15704a['include']=[{'all':!![]}];}return db[_0xa21b('0x27')][_0xa21b('0x3d')](_0x15704a);})['then'](function(_0x38799a){_0x102621[_0xa21b('0x3e')]=_0x38799a;return _0x102621;})[_0xa21b('0x22')](respondWithFilteredResult(_0x2945ed,_0x15704a))[_0xa21b('0x3f')](handleError(_0x2945ed,null));};exports[_0xa21b('0x40')]=function(_0x1f740f,_0x17b486){var _0x4a7ed1={'raw':![],'where':{'id':_0x1f740f['params']['id']}},_0x200bb8={};_0x200bb8['model']=_[_0xa21b('0x2e')](db[_0xa21b('0x27')][_0xa21b('0x28')]);_0x200bb8[_0xa21b('0x2d')]=_['keys'](_0x1f740f[_0xa21b('0x2d')]);_0x200bb8[_0xa21b('0x2f')]=_[_0xa21b('0x30')](_0x200bb8['model'],_0x200bb8[_0xa21b('0x2d')]);_0x4a7ed1[_0xa21b('0x32')]=_[_0xa21b('0x30')](_0x200bb8[_0xa21b('0x31')],qs[_0xa21b('0x33')](_0x1f740f['query']['fields']));_0x4a7ed1['attributes']=_0x4a7ed1[_0xa21b('0x32')][_0xa21b('0x41')]?_0x4a7ed1['attributes']:_0x200bb8['model'];if(_0x1f740f[_0xa21b('0x2d')]['includeAll']){_0x4a7ed1[_0xa21b('0x42')]=[{'all':!![]}];}_0x4a7ed1=_[_0xa21b('0x3a')]({},_0x4a7ed1,_0x1f740f['options']);return db[_0xa21b('0x27')]['find'](_0x4a7ed1)[_0xa21b('0x22')](handleEntityNotFound(_0x17b486,null))['then'](respondWithResult(_0x17b486,null))['catch'](handleError(_0x17b486,null));};exports[_0xa21b('0x43')]=function(_0x3e8f07,_0x89a6db){return db[_0xa21b('0x27')][_0xa21b('0x43')](_0x3e8f07[_0xa21b('0x44')],{})[_0xa21b('0x22')](respondWithResult(_0x89a6db,0xc9))[_0xa21b('0x3f')](handleError(_0x89a6db,null));};exports[_0xa21b('0x21')]=function(_0x2f7194,_0x5f66ed){if(_0x2f7194[_0xa21b('0x44')]['id']){delete _0x2f7194['body']['id'];}return db[_0xa21b('0x27')][_0xa21b('0x45')]({'where':{'id':_0x2f7194[_0xa21b('0x46')]['id']}})[_0xa21b('0x22')](handleEntityNotFound(_0x5f66ed,null))[_0xa21b('0x22')](saveUpdates(_0x2f7194[_0xa21b('0x44')],null))[_0xa21b('0x22')](respondWithResult(_0x5f66ed,null))[_0xa21b('0x3f')](handleError(_0x5f66ed,null));};exports[_0xa21b('0x47')]=function(_0xccf056,_0x3b390c){return db[_0xa21b('0x27')][_0xa21b('0x45')]({'where':{'id':_0xccf056['params']['id']}})[_0xa21b('0x22')](handleEntityNotFound(_0x3b390c,null))['then'](removeEntity(_0x3b390c,null))[_0xa21b('0x3f')](handleError(_0x3b390c,null));};exports[_0xa21b('0x48')]=function(_0x17c218,_0x1d9006,_0x80489f){var _0x154212={};var _0x15009c={};var _0x172544;var _0x4735a1;return db[_0xa21b('0x27')]['findOne']({'where':{'id':_0x17c218[_0xa21b('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d9006,null))[_0xa21b('0x22')](function(_0x3f5754){if(_0x3f5754){_0x172544=_0x3f5754;_0x15009c[_0xa21b('0x31')]=_[_0xa21b('0x2e')](db[_0xa21b('0x49')][_0xa21b('0x28')]);_0x15009c[_0xa21b('0x2d')]=_[_0xa21b('0x2e')](_0x17c218[_0xa21b('0x2d')]);_0x15009c[_0xa21b('0x2f')]=_[_0xa21b('0x30')](_0x15009c[_0xa21b('0x31')],_0x15009c['query']);_0x154212[_0xa21b('0x32')]=_[_0xa21b('0x30')](_0x15009c[_0xa21b('0x31')],qs[_0xa21b('0x33')](_0x17c218['query'][_0xa21b('0x33')]));_0x154212['attributes']=_0x154212['attributes'][_0xa21b('0x41')]?_0x154212[_0xa21b('0x32')]:_0x15009c[_0xa21b('0x31')];_0x154212[_0xa21b('0x36')]=qs['sort'](_0x17c218['query'][_0xa21b('0x37')]);_0x154212['where']=qs['filters'](_[_0xa21b('0x38')](_0x17c218[_0xa21b('0x2d')],_0x15009c[_0xa21b('0x2f')]));if(_0x17c218[_0xa21b('0x2d')]['filter']){_0x154212[_0xa21b('0x39')]=_[_0xa21b('0x3a')](_0x154212['where'],{'$or':_['map'](_0x154212[_0xa21b('0x32')],function(_0xe32c8f){var _0x50d86b={};_0x50d86b[_0xe32c8f]={'$like':'%'+_0x17c218[_0xa21b('0x2d')]['filter']+'%'};return _0x50d86b;})});}_0x154212=_['merge']({},_0x154212,_0x17c218['options']);return _0x172544[_0xa21b('0x48')](_0x154212);}})[_0xa21b('0x22')](function(_0x236a14){if(_0x236a14){_0x4735a1=_0x236a14[_0xa21b('0x41')];if(!_0x17c218[_0xa21b('0x2d')]['hasOwnProperty'](_0xa21b('0x35'))){_0x154212['limit']=qs[_0xa21b('0x1b')](_0x17c218[_0xa21b('0x2d')]['limit']);_0x154212[_0xa21b('0x19')]=qs[_0xa21b('0x19')](_0x17c218[_0xa21b('0x2d')][_0xa21b('0x19')]);}return _0x172544['getFields'](_0x154212);}})[_0xa21b('0x22')](function(_0x303cff){if(_0x303cff){return _0x303cff?{'count':_0x4735a1,'rows':_0x303cff}:null;}})['then'](respondWithResult(_0x1d9006,null))[_0xa21b('0x3f')](handleError(_0x1d9006,null));};exports[_0xa21b('0x4a')]=function(_0x4290ec,_0x6199e3,_0x2574ec){var _0x13beb7={};var _0x555a43={};var _0x3a260c;var _0x5a4f10;return db['DeskConfiguration'][_0xa21b('0x4b')]({'where':{'id':_0x4290ec[_0xa21b('0x46')]['id']}})[_0xa21b('0x22')](handleEntityNotFound(_0x6199e3,null))[_0xa21b('0x22')](function(_0x5376c4){if(_0x5376c4){_0x3a260c=_0x5376c4;_0x555a43[_0xa21b('0x31')]=_['keys'](db[_0xa21b('0x49')][_0xa21b('0x28')]);_0x555a43[_0xa21b('0x2d')]=_[_0xa21b('0x2e')](_0x4290ec[_0xa21b('0x2d')]);_0x555a43[_0xa21b('0x2f')]=_['intersection'](_0x555a43[_0xa21b('0x31')],_0x555a43[_0xa21b('0x2d')]);_0x13beb7['attributes']=_['intersection'](_0x555a43['model'],qs['fields'](_0x4290ec[_0xa21b('0x2d')][_0xa21b('0x33')]));_0x13beb7[_0xa21b('0x32')]=_0x13beb7[_0xa21b('0x32')][_0xa21b('0x41')]?_0x13beb7[_0xa21b('0x32')]:_0x555a43[_0xa21b('0x31')];_0x13beb7[_0xa21b('0x36')]=qs[_0xa21b('0x37')](_0x4290ec[_0xa21b('0x2d')][_0xa21b('0x37')]);_0x13beb7[_0xa21b('0x39')]=qs['filters'](_['pick'](_0x4290ec[_0xa21b('0x2d')],_0x555a43['filters']));if(_0x4290ec['query'][_0xa21b('0x3b')]){_0x13beb7[_0xa21b('0x39')]=_[_0xa21b('0x3a')](_0x13beb7[_0xa21b('0x39')],{'$or':_[_0xa21b('0x2c')](_0x13beb7[_0xa21b('0x32')],function(_0x9d8876){var _0x24cf66={};_0x24cf66[_0x9d8876]={'$like':'%'+_0x4290ec[_0xa21b('0x2d')][_0xa21b('0x3b')]+'%'};return _0x24cf66;})});}_0x13beb7=_['merge']({},_0x13beb7,_0x4290ec[_0xa21b('0x4c')]);return _0x3a260c[_0xa21b('0x4a')](_0x13beb7);}})['then'](function(_0x1a6146){if(_0x1a6146){_0x5a4f10=_0x1a6146[_0xa21b('0x41')];if(!_0x4290ec[_0xa21b('0x2d')]['hasOwnProperty'](_0xa21b('0x35'))){_0x13beb7[_0xa21b('0x1b')]=qs[_0xa21b('0x1b')](_0x4290ec[_0xa21b('0x2d')][_0xa21b('0x1b')]);_0x13beb7[_0xa21b('0x19')]=qs['offset'](_0x4290ec['query']['offset']);}return _0x3a260c['getSubjects'](_0x13beb7);}})[_0xa21b('0x22')](function(_0x93ddb1){if(_0x93ddb1){return _0x93ddb1?{'count':_0x5a4f10,'rows':_0x93ddb1}:null;}})[_0xa21b('0x22')](respondWithResult(_0x6199e3,null))[_0xa21b('0x3f')](handleError(_0x6199e3,null));};exports[_0xa21b('0x4d')]=function(_0x3617e6,_0xd53e15,_0x58c934){var _0xc064cc={};var _0x14430f={};var _0x5a2661;var _0x3b6bd3;return db[_0xa21b('0x27')][_0xa21b('0x4b')]({'where':{'id':_0x3617e6[_0xa21b('0x46')]['id']}})[_0xa21b('0x22')](handleEntityNotFound(_0xd53e15,null))[_0xa21b('0x22')](function(_0x14f544){if(_0x14f544){_0x5a2661=_0x14f544;_0x14430f[_0xa21b('0x31')]=_[_0xa21b('0x2e')](db[_0xa21b('0x49')][_0xa21b('0x28')]);_0x14430f[_0xa21b('0x2d')]=_['keys'](_0x3617e6[_0xa21b('0x2d')]);_0x14430f[_0xa21b('0x2f')]=_['intersection'](_0x14430f[_0xa21b('0x31')],_0x14430f[_0xa21b('0x2d')]);_0xc064cc[_0xa21b('0x32')]=_['intersection'](_0x14430f[_0xa21b('0x31')],qs[_0xa21b('0x33')](_0x3617e6[_0xa21b('0x2d')][_0xa21b('0x33')]));_0xc064cc['attributes']=_0xc064cc[_0xa21b('0x32')][_0xa21b('0x41')]?_0xc064cc[_0xa21b('0x32')]:_0x14430f[_0xa21b('0x31')];_0xc064cc[_0xa21b('0x36')]=qs[_0xa21b('0x37')](_0x3617e6['query'][_0xa21b('0x37')]);_0xc064cc['where']=qs[_0xa21b('0x2f')](_[_0xa21b('0x38')](_0x3617e6[_0xa21b('0x2d')],_0x14430f['filters']));if(_0x3617e6['query'][_0xa21b('0x3b')]){_0xc064cc[_0xa21b('0x39')]=_['merge'](_0xc064cc[_0xa21b('0x39')],{'$or':_[_0xa21b('0x2c')](_0xc064cc['attributes'],function(_0x5a0901){var _0x48b18f={};_0x48b18f[_0x5a0901]={'$like':'%'+_0x3617e6[_0xa21b('0x2d')][_0xa21b('0x3b')]+'%'};return _0x48b18f;})});}_0xc064cc=_[_0xa21b('0x3a')]({},_0xc064cc,_0x3617e6['options']);return _0x5a2661['getDescriptions'](_0xc064cc);}})['then'](function(_0x4ffa65){if(_0x4ffa65){_0x3b6bd3=_0x4ffa65[_0xa21b('0x41')];if(!_0x3617e6[_0xa21b('0x2d')]['hasOwnProperty'](_0xa21b('0x35'))){_0xc064cc['limit']=qs[_0xa21b('0x1b')](_0x3617e6['query'][_0xa21b('0x1b')]);_0xc064cc['offset']=qs[_0xa21b('0x19')](_0x3617e6[_0xa21b('0x2d')][_0xa21b('0x19')]);}return _0x5a2661[_0xa21b('0x4d')](_0xc064cc);}})[_0xa21b('0x22')](function(_0x56295e){if(_0x56295e){return _0x56295e?{'count':_0x3b6bd3,'rows':_0x56295e}:null;}})[_0xa21b('0x22')](respondWithResult(_0xd53e15,null))[_0xa21b('0x3f')](handleError(_0xd53e15,null));};exports[_0xa21b('0x4e')]=function(_0x889d81,_0x408151,_0x2f516a){var _0x541123={};var _0x521edb={};var _0x284e56;var _0x544b72;return db[_0xa21b('0x27')][_0xa21b('0x4b')]({'where':{'id':_0x889d81[_0xa21b('0x46')]['id']}})[_0xa21b('0x22')](handleEntityNotFound(_0x408151,null))[_0xa21b('0x22')](function(_0x4e7fcf){if(_0x4e7fcf){_0x284e56=_0x4e7fcf;_0x521edb[_0xa21b('0x31')]=_[_0xa21b('0x2e')](db[_0xa21b('0x4f')][_0xa21b('0x28')]);_0x521edb['query']=_[_0xa21b('0x2e')](_0x889d81[_0xa21b('0x2d')]);_0x521edb[_0xa21b('0x2f')]=_[_0xa21b('0x30')](_0x521edb['model'],_0x521edb[_0xa21b('0x2d')]);_0x541123[_0xa21b('0x32')]=_[_0xa21b('0x30')](_0x521edb[_0xa21b('0x31')],qs['fields'](_0x889d81['query']['fields']));_0x541123['attributes']=_0x541123['attributes'][_0xa21b('0x41')]?_0x541123[_0xa21b('0x32')]:_0x521edb[_0xa21b('0x31')];_0x541123[_0xa21b('0x36')]=qs[_0xa21b('0x37')](_0x889d81[_0xa21b('0x2d')][_0xa21b('0x37')]);_0x541123['where']=qs[_0xa21b('0x2f')](_[_0xa21b('0x38')](_0x889d81['query'],_0x521edb[_0xa21b('0x2f')]));if(_0x889d81[_0xa21b('0x2d')][_0xa21b('0x3b')]){_0x541123[_0xa21b('0x39')]=_['merge'](_0x541123[_0xa21b('0x39')],{'$or':_[_0xa21b('0x2c')](_0x541123[_0xa21b('0x32')],function(_0x28b51a){var _0x539727={};_0x539727[_0x28b51a]={'$like':'%'+_0x889d81[_0xa21b('0x2d')][_0xa21b('0x3b')]+'%'};return _0x539727;})});}_0x541123=_[_0xa21b('0x3a')]({},_0x541123,_0x889d81[_0xa21b('0x4c')]);return _0x284e56[_0xa21b('0x4e')](_0x541123);}})['then'](function(_0x3441f5){if(_0x3441f5){_0x544b72=_0x3441f5[_0xa21b('0x41')];if(!_0x889d81[_0xa21b('0x2d')][_0xa21b('0x34')](_0xa21b('0x35'))){_0x541123['limit']=qs['limit'](_0x889d81['query'][_0xa21b('0x1b')]);_0x541123['offset']=qs['offset'](_0x889d81[_0xa21b('0x2d')]['offset']);}return _0x284e56['getTags'](_0x541123);}})[_0xa21b('0x22')](function(_0x151f5e){if(_0x151f5e){return _0x151f5e?{'count':_0x544b72,'rows':_0x151f5e}:null;}})[_0xa21b('0x22')](respondWithResult(_0x408151,null))[_0xa21b('0x3f')](handleError(_0x408151,null));};exports['setTags']=function(_0x1fe8be,_0x23e0b5,_0x56b6b4){if(_0x1fe8be[_0xa21b('0x44')]['id']){delete _0x1fe8be['body']['id'];}return db[_0xa21b('0x27')]['findOne']({'where':{'id':_0x1fe8be[_0xa21b('0x46')]['id']}})[_0xa21b('0x22')](handleEntityNotFound(_0x23e0b5,null))['then'](function(_0x48b4ec){if(_0x48b4ec){return _0x48b4ec[_0xa21b('0x50')](_0x1fe8be[_0xa21b('0x44')][_0xa21b('0x51')]||[]);}return null;})[_0xa21b('0x22')](respondWithResult(_0x23e0b5,null))[_0xa21b('0x3f')](handleError(_0x23e0b5,null));}; \ No newline at end of file +var _0xf32c=['setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','DeskConfiguration','includeAll','rows','catch','show','params','intersection','include','find','create','body','findOne','DeskField','getFields','getSubjects','getDescriptions','getTags'];(function(_0x119d25,_0x588c8){var _0x39cf30=function(_0x31c68c){while(--_0x31c68c){_0x119d25['push'](_0x119d25['shift']());}};_0x39cf30(++_0x588c8);}(_0xf32c,0xfe));var _0xcf32=function(_0x3aae87,_0x1d9bed){_0x3aae87=_0x3aae87-0x0;var _0xfb334f=_0xf32c[_0x3aae87];return _0xfb334f;};'use strict';var emlformat=require(_0xcf32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf32('0x1'));var jsonpatch=require(_0xcf32('0x2'));var rp=require(_0xcf32('0x3'));var moment=require(_0xcf32('0x4'));var BPromise=require(_0xcf32('0x5'));var Mustache=require(_0xcf32('0x6'));var util=require('util');var path=require(_0xcf32('0x7'));var sox=require(_0xcf32('0x8'));var csv=require(_0xcf32('0x9'));var ejs=require(_0xcf32('0xa'));var fs=require('fs');var fs_extra=require(_0xcf32('0xb'));var _=require(_0xcf32('0xc'));var squel=require(_0xcf32('0xd'));var crypto=require(_0xcf32('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xcf32('0xf'));var toCsv=require(_0xcf32('0x9'));var querystring=require(_0xcf32('0x10'));var Papa=require(_0xcf32('0x11'));var Redis=require(_0xcf32('0x12'));var authService=require(_0xcf32('0x13'));var qs=require(_0xcf32('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf32('0x15'));var logger=require(_0xcf32('0x16'))(_0xcf32('0x17'));var utils=require(_0xcf32('0x18'));var config=require(_0xcf32('0x19'));var licenseUtil=require(_0xcf32('0x1a'));var db=require(_0xcf32('0x1b'))['db'];function respondWithStatusCode(_0x3248c3,_0x1e2c4c){_0x1e2c4c=_0x1e2c4c||0xcc;return function(_0x2728d8){if(_0x2728d8){return _0x3248c3[_0xcf32('0x1c')](_0x1e2c4c);}return _0x3248c3[_0xcf32('0x1d')](_0x1e2c4c)['end']();};}function respondWithResult(_0x11714e,_0x1d9f00){_0x1d9f00=_0x1d9f00||0xc8;return function(_0x509082){if(_0x509082){return _0x11714e[_0xcf32('0x1d')](_0x1d9f00)[_0xcf32('0x1e')](_0x509082);}};}function respondWithFilteredResult(_0x49d387,_0x303319){return function(_0x2fa49b){if(_0x2fa49b){var _0x2d2f58=typeof _0x303319['offset']===_0xcf32('0x1f')&&typeof _0x303319[_0xcf32('0x20')]===_0xcf32('0x1f');var _0xbec0aa=_0x2fa49b[_0xcf32('0x21')];var _0x56b861=_0x2d2f58?0x0:_0x303319[_0xcf32('0x22')];var _0x185b88=_0x2d2f58?_0x2fa49b['count']:_0x303319['offset']+_0x303319[_0xcf32('0x20')];var _0x463a8d;if(_0x185b88>=_0xbec0aa){_0x185b88=_0xbec0aa;_0x463a8d=0xc8;}else{_0x463a8d=0xce;}_0x49d387[_0xcf32('0x1d')](_0x463a8d);return _0x49d387['set'](_0xcf32('0x23'),_0x56b861+'-'+_0x185b88+'/'+_0xbec0aa)[_0xcf32('0x1e')](_0x2fa49b);}return null;};}function patchUpdates(_0x5ba90d){return function(_0x1e5d52){try{jsonpatch[_0xcf32('0x24')](_0x1e5d52,_0x5ba90d,!![]);}catch(_0x515ccb){return BPromise[_0xcf32('0x25')](_0x515ccb);}return _0x1e5d52[_0xcf32('0x26')]();};}function saveUpdates(_0x1ab52a,_0x2f299b){return function(_0x5bb8d4){if(_0x5bb8d4){return _0x5bb8d4[_0xcf32('0x27')](_0x1ab52a)[_0xcf32('0x28')](function(_0x320b88){return _0x320b88;});}return null;};}function removeEntity(_0x5b49fa,_0x586b3e){return function(_0x39903a){if(_0x39903a){return _0x39903a[_0xcf32('0x29')]()[_0xcf32('0x28')](function(){_0x5b49fa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d2c88,_0x11cea3){return function(_0x8890eb){if(!_0x8890eb){_0x3d2c88[_0xcf32('0x1c')](0x194);}return _0x8890eb;};}function handleError(_0x4bc250,_0x1e7575){_0x1e7575=_0x1e7575||0x1f4;return function(_0x34d2de){logger[_0xcf32('0x2a')](_0x34d2de['stack']);if(_0x34d2de['name']){delete _0x34d2de[_0xcf32('0x2b')];}_0x4bc250[_0xcf32('0x1d')](_0x1e7575)['send'](_0x34d2de);};}exports[_0xcf32('0x2c')]=function(_0x1aafe3,_0xcefbee){var _0x5ef8c9={},_0xd0b6db={},_0x2305c1={'count':0x0,'rows':[]};var _0x1dd1bf=_[_0xcf32('0x2d')](db['DeskConfiguration'][_0xcf32('0x2e')],function(_0x49bd3f){return{'name':_0x49bd3f[_0xcf32('0x2f')],'type':_0x49bd3f[_0xcf32('0x30')]['key']};});_0xd0b6db[_0xcf32('0x31')]=_['map'](_0x1dd1bf,_0xcf32('0x2b'));_0xd0b6db[_0xcf32('0x32')]=_[_0xcf32('0x33')](_0x1aafe3[_0xcf32('0x32')]);_0xd0b6db[_0xcf32('0x34')]=_['intersection'](_0xd0b6db[_0xcf32('0x31')],_0xd0b6db[_0xcf32('0x32')]);_0x5ef8c9[_0xcf32('0x35')]=_['intersection'](_0xd0b6db[_0xcf32('0x31')],qs[_0xcf32('0x36')](_0x1aafe3['query'][_0xcf32('0x36')]));_0x5ef8c9[_0xcf32('0x35')]=_0x5ef8c9[_0xcf32('0x35')][_0xcf32('0x37')]?_0x5ef8c9['attributes']:_0xd0b6db[_0xcf32('0x31')];if(!_0x1aafe3[_0xcf32('0x32')][_0xcf32('0x38')](_0xcf32('0x39'))){_0x5ef8c9[_0xcf32('0x20')]=qs[_0xcf32('0x20')](_0x1aafe3[_0xcf32('0x32')][_0xcf32('0x20')]);_0x5ef8c9[_0xcf32('0x22')]=qs[_0xcf32('0x22')](_0x1aafe3[_0xcf32('0x32')][_0xcf32('0x22')]);}_0x5ef8c9[_0xcf32('0x3a')]=qs[_0xcf32('0x3b')](_0x1aafe3['query'][_0xcf32('0x3b')]);_0x5ef8c9[_0xcf32('0x3c')]=qs[_0xcf32('0x34')](_[_0xcf32('0x3d')](_0x1aafe3[_0xcf32('0x32')],_0xd0b6db[_0xcf32('0x34')]),_0x1dd1bf);if(_0x1aafe3[_0xcf32('0x32')][_0xcf32('0x3e')]){_0x5ef8c9['where']=_['merge'](_0x5ef8c9[_0xcf32('0x3c')],{'$or':_[_0xcf32('0x2d')](_0x1dd1bf,function(_0x1eff7e){if(_0x1eff7e[_0xcf32('0x30')]!=='VIRTUAL'){var _0x5d7ee9={};_0x5d7ee9[_0x1eff7e['name']]={'$like':'%'+_0x1aafe3[_0xcf32('0x32')][_0xcf32('0x3e')]+'%'};return _0x5d7ee9;}})});}_0x5ef8c9=_[_0xcf32('0x3f')]({},_0x5ef8c9,_0x1aafe3[_0xcf32('0x40')]);var _0x41a1c4={'where':_0x5ef8c9[_0xcf32('0x3c')]};return db[_0xcf32('0x41')][_0xcf32('0x21')](_0x41a1c4)['then'](function(_0x283f0d){_0x2305c1[_0xcf32('0x21')]=_0x283f0d;if(_0x1aafe3[_0xcf32('0x32')][_0xcf32('0x42')]){_0x5ef8c9['include']=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x5ef8c9);})[_0xcf32('0x28')](function(_0x53b079){_0x2305c1[_0xcf32('0x43')]=_0x53b079;return _0x2305c1;})['then'](respondWithFilteredResult(_0xcefbee,_0x5ef8c9))[_0xcf32('0x44')](handleError(_0xcefbee,null));};exports[_0xcf32('0x45')]=function(_0x52adba,_0x2494a4){var _0x5ea982={'raw':![],'where':{'id':_0x52adba[_0xcf32('0x46')]['id']}},_0x1a47dc={};_0x1a47dc['model']=_[_0xcf32('0x33')](db[_0xcf32('0x41')]['rawAttributes']);_0x1a47dc['query']=_[_0xcf32('0x33')](_0x52adba[_0xcf32('0x32')]);_0x1a47dc[_0xcf32('0x34')]=_[_0xcf32('0x47')](_0x1a47dc[_0xcf32('0x31')],_0x1a47dc[_0xcf32('0x32')]);_0x5ea982['attributes']=_[_0xcf32('0x47')](_0x1a47dc['model'],qs[_0xcf32('0x36')](_0x52adba[_0xcf32('0x32')][_0xcf32('0x36')]));_0x5ea982[_0xcf32('0x35')]=_0x5ea982['attributes'][_0xcf32('0x37')]?_0x5ea982[_0xcf32('0x35')]:_0x1a47dc[_0xcf32('0x31')];if(_0x52adba[_0xcf32('0x32')][_0xcf32('0x42')]){_0x5ea982[_0xcf32('0x48')]=[{'all':!![]}];}_0x5ea982=_['merge']({},_0x5ea982,_0x52adba[_0xcf32('0x40')]);return db[_0xcf32('0x41')][_0xcf32('0x49')](_0x5ea982)['then'](handleEntityNotFound(_0x2494a4,null))[_0xcf32('0x28')](respondWithResult(_0x2494a4,null))['catch'](handleError(_0x2494a4,null));};exports[_0xcf32('0x4a')]=function(_0x56aa0a,_0x4e1c9c){return db['DeskConfiguration']['create'](_0x56aa0a['body'],{})[_0xcf32('0x28')](respondWithResult(_0x4e1c9c,0xc9))[_0xcf32('0x44')](handleError(_0x4e1c9c,null));};exports[_0xcf32('0x27')]=function(_0x4120ad,_0x5e21f1){if(_0x4120ad[_0xcf32('0x4b')]['id']){delete _0x4120ad[_0xcf32('0x4b')]['id'];}return db[_0xcf32('0x41')][_0xcf32('0x49')]({'where':{'id':_0x4120ad[_0xcf32('0x46')]['id']}})[_0xcf32('0x28')](handleEntityNotFound(_0x5e21f1,null))['then'](saveUpdates(_0x4120ad['body'],null))[_0xcf32('0x28')](respondWithResult(_0x5e21f1,null))[_0xcf32('0x44')](handleError(_0x5e21f1,null));};exports[_0xcf32('0x29')]=function(_0x13c6a1,_0x47f03d){return db[_0xcf32('0x41')][_0xcf32('0x49')]({'where':{'id':_0x13c6a1['params']['id']}})['then'](handleEntityNotFound(_0x47f03d,null))[_0xcf32('0x28')](removeEntity(_0x47f03d,null))[_0xcf32('0x44')](handleError(_0x47f03d,null));};exports['getFields']=function(_0x3ad0b4,_0x4a863f,_0x205430){var _0x282bb8={};var _0x47ef8a={};var _0x2c1b13;var _0x18926d;return db['DeskConfiguration'][_0xcf32('0x4c')]({'where':{'id':_0x3ad0b4[_0xcf32('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a863f,null))[_0xcf32('0x28')](function(_0x24d8d2){if(_0x24d8d2){_0x2c1b13=_0x24d8d2;_0x47ef8a[_0xcf32('0x31')]=_[_0xcf32('0x33')](db[_0xcf32('0x4d')][_0xcf32('0x2e')]);_0x47ef8a['query']=_['keys'](_0x3ad0b4[_0xcf32('0x32')]);_0x47ef8a['filters']=_[_0xcf32('0x47')](_0x47ef8a[_0xcf32('0x31')],_0x47ef8a[_0xcf32('0x32')]);_0x282bb8[_0xcf32('0x35')]=_[_0xcf32('0x47')](_0x47ef8a['model'],qs['fields'](_0x3ad0b4['query'][_0xcf32('0x36')]));_0x282bb8[_0xcf32('0x35')]=_0x282bb8[_0xcf32('0x35')][_0xcf32('0x37')]?_0x282bb8[_0xcf32('0x35')]:_0x47ef8a[_0xcf32('0x31')];_0x282bb8[_0xcf32('0x3a')]=qs[_0xcf32('0x3b')](_0x3ad0b4[_0xcf32('0x32')]['sort']);_0x282bb8[_0xcf32('0x3c')]=qs[_0xcf32('0x34')](_[_0xcf32('0x3d')](_0x3ad0b4[_0xcf32('0x32')],_0x47ef8a['filters']));if(_0x3ad0b4[_0xcf32('0x32')][_0xcf32('0x3e')]){_0x282bb8['where']=_[_0xcf32('0x3f')](_0x282bb8['where'],{'$or':_['map'](_0x282bb8['attributes'],function(_0xf489e5){var _0x3cbada={};_0x3cbada[_0xf489e5]={'$like':'%'+_0x3ad0b4[_0xcf32('0x32')][_0xcf32('0x3e')]+'%'};return _0x3cbada;})});}_0x282bb8=_[_0xcf32('0x3f')]({},_0x282bb8,_0x3ad0b4[_0xcf32('0x40')]);return _0x2c1b13[_0xcf32('0x4e')](_0x282bb8);}})[_0xcf32('0x28')](function(_0x3eb2e2){if(_0x3eb2e2){_0x18926d=_0x3eb2e2[_0xcf32('0x37')];if(!_0x3ad0b4[_0xcf32('0x32')][_0xcf32('0x38')](_0xcf32('0x39'))){_0x282bb8[_0xcf32('0x20')]=qs[_0xcf32('0x20')](_0x3ad0b4[_0xcf32('0x32')][_0xcf32('0x20')]);_0x282bb8[_0xcf32('0x22')]=qs[_0xcf32('0x22')](_0x3ad0b4[_0xcf32('0x32')][_0xcf32('0x22')]);}return _0x2c1b13[_0xcf32('0x4e')](_0x282bb8);}})[_0xcf32('0x28')](function(_0xab3884){if(_0xab3884){return _0xab3884?{'count':_0x18926d,'rows':_0xab3884}:null;}})[_0xcf32('0x28')](respondWithResult(_0x4a863f,null))[_0xcf32('0x44')](handleError(_0x4a863f,null));};exports[_0xcf32('0x4f')]=function(_0x8587c4,_0xf6ec3d,_0x59d0a4){var _0x4d8dc7={};var _0x5cf4f7={};var _0x1eeb72;var _0x3909b1;return db['DeskConfiguration'][_0xcf32('0x4c')]({'where':{'id':_0x8587c4[_0xcf32('0x46')]['id']}})['then'](handleEntityNotFound(_0xf6ec3d,null))[_0xcf32('0x28')](function(_0x591859){if(_0x591859){_0x1eeb72=_0x591859;_0x5cf4f7[_0xcf32('0x31')]=_[_0xcf32('0x33')](db['DeskField'][_0xcf32('0x2e')]);_0x5cf4f7[_0xcf32('0x32')]=_[_0xcf32('0x33')](_0x8587c4[_0xcf32('0x32')]);_0x5cf4f7[_0xcf32('0x34')]=_['intersection'](_0x5cf4f7['model'],_0x5cf4f7[_0xcf32('0x32')]);_0x4d8dc7[_0xcf32('0x35')]=_[_0xcf32('0x47')](_0x5cf4f7['model'],qs[_0xcf32('0x36')](_0x8587c4[_0xcf32('0x32')][_0xcf32('0x36')]));_0x4d8dc7[_0xcf32('0x35')]=_0x4d8dc7[_0xcf32('0x35')][_0xcf32('0x37')]?_0x4d8dc7[_0xcf32('0x35')]:_0x5cf4f7[_0xcf32('0x31')];_0x4d8dc7['order']=qs['sort'](_0x8587c4[_0xcf32('0x32')][_0xcf32('0x3b')]);_0x4d8dc7[_0xcf32('0x3c')]=qs['filters'](_['pick'](_0x8587c4[_0xcf32('0x32')],_0x5cf4f7['filters']));if(_0x8587c4[_0xcf32('0x32')][_0xcf32('0x3e')]){_0x4d8dc7[_0xcf32('0x3c')]=_['merge'](_0x4d8dc7[_0xcf32('0x3c')],{'$or':_[_0xcf32('0x2d')](_0x4d8dc7['attributes'],function(_0x2845cb){var _0x474fd4={};_0x474fd4[_0x2845cb]={'$like':'%'+_0x8587c4[_0xcf32('0x32')]['filter']+'%'};return _0x474fd4;})});}_0x4d8dc7=_[_0xcf32('0x3f')]({},_0x4d8dc7,_0x8587c4[_0xcf32('0x40')]);return _0x1eeb72[_0xcf32('0x4f')](_0x4d8dc7);}})[_0xcf32('0x28')](function(_0x268a96){if(_0x268a96){_0x3909b1=_0x268a96['length'];if(!_0x8587c4[_0xcf32('0x32')][_0xcf32('0x38')]('nolimit')){_0x4d8dc7[_0xcf32('0x20')]=qs['limit'](_0x8587c4[_0xcf32('0x32')][_0xcf32('0x20')]);_0x4d8dc7['offset']=qs['offset'](_0x8587c4[_0xcf32('0x32')]['offset']);}return _0x1eeb72[_0xcf32('0x4f')](_0x4d8dc7);}})['then'](function(_0x293e33){if(_0x293e33){return _0x293e33?{'count':_0x3909b1,'rows':_0x293e33}:null;}})[_0xcf32('0x28')](respondWithResult(_0xf6ec3d,null))[_0xcf32('0x44')](handleError(_0xf6ec3d,null));};exports[_0xcf32('0x50')]=function(_0x5afa36,_0x48466b,_0x36dda5){var _0x3ecc11={};var _0x4b42d9={};var _0x2674ca;var _0x61e75;return db[_0xcf32('0x41')][_0xcf32('0x4c')]({'where':{'id':_0x5afa36[_0xcf32('0x46')]['id']}})[_0xcf32('0x28')](handleEntityNotFound(_0x48466b,null))['then'](function(_0x120a6b){if(_0x120a6b){_0x2674ca=_0x120a6b;_0x4b42d9['model']=_[_0xcf32('0x33')](db['DeskField'][_0xcf32('0x2e')]);_0x4b42d9[_0xcf32('0x32')]=_['keys'](_0x5afa36[_0xcf32('0x32')]);_0x4b42d9['filters']=_[_0xcf32('0x47')](_0x4b42d9['model'],_0x4b42d9[_0xcf32('0x32')]);_0x3ecc11[_0xcf32('0x35')]=_['intersection'](_0x4b42d9[_0xcf32('0x31')],qs[_0xcf32('0x36')](_0x5afa36[_0xcf32('0x32')][_0xcf32('0x36')]));_0x3ecc11['attributes']=_0x3ecc11['attributes'][_0xcf32('0x37')]?_0x3ecc11['attributes']:_0x4b42d9[_0xcf32('0x31')];_0x3ecc11[_0xcf32('0x3a')]=qs[_0xcf32('0x3b')](_0x5afa36[_0xcf32('0x32')]['sort']);_0x3ecc11[_0xcf32('0x3c')]=qs[_0xcf32('0x34')](_['pick'](_0x5afa36[_0xcf32('0x32')],_0x4b42d9[_0xcf32('0x34')]));if(_0x5afa36['query'][_0xcf32('0x3e')]){_0x3ecc11[_0xcf32('0x3c')]=_[_0xcf32('0x3f')](_0x3ecc11[_0xcf32('0x3c')],{'$or':_[_0xcf32('0x2d')](_0x3ecc11[_0xcf32('0x35')],function(_0x540b8f){var _0x2f4324={};_0x2f4324[_0x540b8f]={'$like':'%'+_0x5afa36['query'][_0xcf32('0x3e')]+'%'};return _0x2f4324;})});}_0x3ecc11=_[_0xcf32('0x3f')]({},_0x3ecc11,_0x5afa36[_0xcf32('0x40')]);return _0x2674ca[_0xcf32('0x50')](_0x3ecc11);}})['then'](function(_0x1213a4){if(_0x1213a4){_0x61e75=_0x1213a4[_0xcf32('0x37')];if(!_0x5afa36[_0xcf32('0x32')][_0xcf32('0x38')](_0xcf32('0x39'))){_0x3ecc11[_0xcf32('0x20')]=qs[_0xcf32('0x20')](_0x5afa36[_0xcf32('0x32')][_0xcf32('0x20')]);_0x3ecc11[_0xcf32('0x22')]=qs['offset'](_0x5afa36[_0xcf32('0x32')][_0xcf32('0x22')]);}return _0x2674ca[_0xcf32('0x50')](_0x3ecc11);}})[_0xcf32('0x28')](function(_0x484181){if(_0x484181){return _0x484181?{'count':_0x61e75,'rows':_0x484181}:null;}})['then'](respondWithResult(_0x48466b,null))[_0xcf32('0x44')](handleError(_0x48466b,null));};exports[_0xcf32('0x51')]=function(_0x3c633f,_0xa3de18,_0x9395e0){var _0x13f8b4={};var _0x28ca2c={};var _0x3a5f93;var _0x324919;return db[_0xcf32('0x41')][_0xcf32('0x4c')]({'where':{'id':_0x3c633f[_0xcf32('0x46')]['id']}})['then'](handleEntityNotFound(_0xa3de18,null))[_0xcf32('0x28')](function(_0x5d7ed6){if(_0x5d7ed6){_0x3a5f93=_0x5d7ed6;_0x28ca2c[_0xcf32('0x31')]=_['keys'](db['Tag'][_0xcf32('0x2e')]);_0x28ca2c[_0xcf32('0x32')]=_[_0xcf32('0x33')](_0x3c633f['query']);_0x28ca2c[_0xcf32('0x34')]=_[_0xcf32('0x47')](_0x28ca2c[_0xcf32('0x31')],_0x28ca2c[_0xcf32('0x32')]);_0x13f8b4['attributes']=_[_0xcf32('0x47')](_0x28ca2c['model'],qs[_0xcf32('0x36')](_0x3c633f[_0xcf32('0x32')][_0xcf32('0x36')]));_0x13f8b4[_0xcf32('0x35')]=_0x13f8b4[_0xcf32('0x35')][_0xcf32('0x37')]?_0x13f8b4[_0xcf32('0x35')]:_0x28ca2c[_0xcf32('0x31')];_0x13f8b4[_0xcf32('0x3a')]=qs[_0xcf32('0x3b')](_0x3c633f[_0xcf32('0x32')][_0xcf32('0x3b')]);_0x13f8b4[_0xcf32('0x3c')]=qs[_0xcf32('0x34')](_[_0xcf32('0x3d')](_0x3c633f[_0xcf32('0x32')],_0x28ca2c[_0xcf32('0x34')]));if(_0x3c633f[_0xcf32('0x32')]['filter']){_0x13f8b4[_0xcf32('0x3c')]=_[_0xcf32('0x3f')](_0x13f8b4[_0xcf32('0x3c')],{'$or':_[_0xcf32('0x2d')](_0x13f8b4[_0xcf32('0x35')],function(_0x432917){var _0x1eba92={};_0x1eba92[_0x432917]={'$like':'%'+_0x3c633f[_0xcf32('0x32')][_0xcf32('0x3e')]+'%'};return _0x1eba92;})});}_0x13f8b4=_[_0xcf32('0x3f')]({},_0x13f8b4,_0x3c633f['options']);return _0x3a5f93[_0xcf32('0x51')](_0x13f8b4);}})[_0xcf32('0x28')](function(_0x23dfae){if(_0x23dfae){_0x324919=_0x23dfae[_0xcf32('0x37')];if(!_0x3c633f[_0xcf32('0x32')][_0xcf32('0x38')]('nolimit')){_0x13f8b4[_0xcf32('0x20')]=qs[_0xcf32('0x20')](_0x3c633f[_0xcf32('0x32')][_0xcf32('0x20')]);_0x13f8b4[_0xcf32('0x22')]=qs[_0xcf32('0x22')](_0x3c633f['query'][_0xcf32('0x22')]);}return _0x3a5f93[_0xcf32('0x51')](_0x13f8b4);}})[_0xcf32('0x28')](function(_0x167c6b){if(_0x167c6b){return _0x167c6b?{'count':_0x324919,'rows':_0x167c6b}:null;}})[_0xcf32('0x28')](respondWithResult(_0xa3de18,null))[_0xcf32('0x44')](handleError(_0xa3de18,null));};exports[_0xcf32('0x52')]=function(_0x16d4b4,_0x44ce1c,_0x379dd5){if(_0x16d4b4[_0xcf32('0x4b')]['id']){delete _0x16d4b4[_0xcf32('0x4b')]['id'];}return db['DeskConfiguration'][_0xcf32('0x4c')]({'where':{'id':_0x16d4b4[_0xcf32('0x46')]['id']}})[_0xcf32('0x28')](handleEntityNotFound(_0x44ce1c,null))[_0xcf32('0x28')](function(_0x22e947){if(_0x22e947){return _0x22e947['setTags'](_0x16d4b4[_0xcf32('0x4b')][_0xcf32('0x53')]||[]);}return null;})[_0xcf32('0x28')](respondWithResult(_0x44ce1c,null))[_0xcf32('0x44')](handleError(_0x44ce1c,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 21d6d55..bf6912c 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 _0xfab2=['exports','int_desk_configurations','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x31d6bf,_0x394c1b){var _0x1559ae=function(_0x22de37){while(--_0x22de37){_0x31d6bf['push'](_0x31d6bf['shift']());}};_0x1559ae(++_0x394c1b);}(_0xfab2,0xf2));var _0x2fab=function(_0x4a89ed,_0x1e5ca1){_0x4a89ed=_0x4a89ed-0x0;var _0x30ae09=_0xfab2[_0x4a89ed];return _0x30ae09;};'use strict';var _=require(_0x2fab('0x0'));var util=require('util');var logger=require(_0x2fab('0x1'))('api');var moment=require(_0x2fab('0x2'));var BPromise=require(_0x2fab('0x3'));var rp=require(_0x2fab('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fab('0x5'));var config=require(_0x2fab('0x6'));var attributes=require(_0x2fab('0x7'));module[_0x2fab('0x8')]=function(_0x15e79d,_0x48af42){return _0x15e79d['define']('DeskConfiguration',attributes,{'tableName':_0x2fab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc571=['rimraf','../../config/environment','define','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5c4f56,_0x3c12ad){var _0x4d917a=function(_0x43bee8){while(--_0x43bee8){_0x5c4f56['push'](_0x5c4f56['shift']());}};_0x4d917a(++_0x3c12ad);}(_0xc571,0x16c));var _0x1c57=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0xc571[_0x2ddfd9];return _0x2668f0;};'use strict';var _=require(_0x1c57('0x0'));var util=require(_0x1c57('0x1'));var logger=require(_0x1c57('0x2'))(_0x1c57('0x3'));var moment=require(_0x1c57('0x4'));var BPromise=require(_0x1c57('0x5'));var rp=require(_0x1c57('0x6'));var fs=require('fs');var path=require(_0x1c57('0x7'));var rimraf=require(_0x1c57('0x8'));var config=require(_0x1c57('0x9'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x2122d6,_0x427f9c){return _0x2122d6[_0x1c57('0xa')]('DeskConfiguration',attributes,{'tableName':_0x1c57('0xb'),'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 f5d07a1..1421a8a 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 _0xa1c4=['error','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x484783,_0x5adb3b){var _0x583af8=function(_0x46d5f2){while(--_0x46d5f2){_0x484783['push'](_0x484783['shift']());}};_0x583af8(++_0x5adb3b);}(_0xa1c4,0xdf));var _0x4a1c=function(_0x22a8c4,_0x51c09a){_0x22a8c4=_0x22a8c4-0x0;var _0x104c6d=_0xa1c4[_0x22a8c4];return _0x104c6d;};'use strict';var _=require(_0x4a1c('0x0'));var util=require(_0x4a1c('0x1'));var moment=require(_0x4a1c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a1c('0x3'));var db=require(_0x4a1c('0x4'))['db'];var utils=require(_0x4a1c('0x5'));var logger=require(_0x4a1c('0x6'))(_0x4a1c('0x7'));var config=require(_0x4a1c('0x8'));var jayson=require(_0x4a1c('0x9'));var client=jayson[_0x4a1c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7dcf22,_0x3f1d25,_0x140610){return new BPromise(function(_0x1194b1,_0x142466){return client[_0x4a1c('0xb')](_0x7dcf22,_0x140610)[_0x4a1c('0xc')](function(_0x3f15a6){logger[_0x4a1c('0xd')](_0x4a1c('0xe'),_0x3f1d25,_0x4a1c('0xf'));logger[_0x4a1c('0x10')](_0x4a1c('0x11'),_0x3f1d25,_0x4a1c('0xf'),JSON[_0x4a1c('0x12')](_0x3f15a6));if(_0x3f15a6[_0x4a1c('0x13')]){if(_0x3f15a6[_0x4a1c('0x13')]['code']===0x1f4){logger['error'](_0x4a1c('0xe'),_0x3f1d25,_0x3f15a6['error'][_0x4a1c('0x14')]);return _0x142466(_0x3f15a6[_0x4a1c('0x13')][_0x4a1c('0x14')]);}logger[_0x4a1c('0x13')](_0x4a1c('0xe'),_0x3f1d25,_0x3f15a6[_0x4a1c('0x13')][_0x4a1c('0x14')]);return _0x1194b1(_0x3f15a6['error'][_0x4a1c('0x14')]);}else{logger[_0x4a1c('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x3f1d25,'request\x20sent');_0x1194b1(_0x3f15a6['result'][_0x4a1c('0x14')]);}})[_0x4a1c('0x15')](function(_0x50eb1c){logger['error'](_0x4a1c('0xe'),_0x3f1d25,_0x50eb1c);_0x142466(_0x50eb1c);});});} \ No newline at end of file +var _0xd679=['request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xfb9251,_0x214527){var _0x34ec9c=function(_0x472794){while(--_0x472794){_0xfb9251['push'](_0xfb9251['shift']());}};_0x34ec9c(++_0x214527);}(_0xd679,0xcc));var _0x9d67=function(_0x680dfd,_0x167e3c){_0x680dfd=_0x680dfd-0x0;var _0x3d3b08=_0xd679[_0x680dfd];return _0x3d3b08;};'use strict';var _=require('lodash');var util=require(_0x9d67('0x0'));var moment=require(_0x9d67('0x1'));var BPromise=require(_0x9d67('0x2'));var rs=require(_0x9d67('0x3'));var fs=require('fs');var Redis=require(_0x9d67('0x4'));var db=require(_0x9d67('0x5'))['db'];var utils=require(_0x9d67('0x6'));var logger=require(_0x9d67('0x7'))(_0x9d67('0x8'));var config=require(_0x9d67('0x9'));var jayson=require(_0x9d67('0xa'));var client=jayson['client'][_0x9d67('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5865a9,_0x2d6f4b,_0x23d0ed){return new BPromise(function(_0x2b20e8,_0x59c445){return client[_0x9d67('0xc')](_0x5865a9,_0x23d0ed)[_0x9d67('0xd')](function(_0x20180f){logger[_0x9d67('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x2d6f4b,'request\x20sent');logger['debug'](_0x9d67('0xf'),_0x2d6f4b,_0x9d67('0x10'),JSON[_0x9d67('0x11')](_0x20180f));if(_0x20180f[_0x9d67('0x12')]){if(_0x20180f[_0x9d67('0x12')][_0x9d67('0x13')]===0x1f4){logger[_0x9d67('0x12')](_0x9d67('0x14'),_0x2d6f4b,_0x20180f[_0x9d67('0x12')][_0x9d67('0x15')]);return _0x59c445(_0x20180f[_0x9d67('0x12')][_0x9d67('0x15')]);}logger['error'](_0x9d67('0x14'),_0x2d6f4b,_0x20180f[_0x9d67('0x12')]['message']);return _0x2b20e8(_0x20180f[_0x9d67('0x12')][_0x9d67('0x15')]);}else{logger[_0x9d67('0xe')](_0x9d67('0x14'),_0x2d6f4b,'request\x20sent');_0x2b20e8(_0x20180f['result'][_0x9d67('0x15')]);}})['catch'](function(_0x59de80){logger[_0x9d67('0x12')](_0x9d67('0x14'),_0x2d6f4b,_0x59de80);_0x59c445(_0x59de80);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 7d2a57b..41ac717 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 _0x1a22=['put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskField.controller','get','isAuthenticated','index','post','create'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x1a22,0x125));var _0x21a2=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x1a22[_0x74892f];return _0x10ee61;};'use strict';var multer=require(_0x21a2('0x0'));var util=require(_0x21a2('0x1'));var path=require('path');var timeout=require(_0x21a2('0x2'));var express=require(_0x21a2('0x3'));var router=express[_0x21a2('0x4')]();var fs_extra=require(_0x21a2('0x5'));var auth=require(_0x21a2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x21a2('0x7'));router[_0x21a2('0x8')]('/',auth[_0x21a2('0x9')](),controller[_0x21a2('0xa')]);router[_0x21a2('0x8')]('/:id',auth[_0x21a2('0x9')](),controller['show']);router[_0x21a2('0xb')]('/',auth[_0x21a2('0x9')](),controller[_0x21a2('0xc')]);router[_0x21a2('0xd')]('/:id',auth[_0x21a2('0x9')](),controller[_0x21a2('0xe')]);router['delete']('/:id',auth[_0x21a2('0x9')](),controller[_0x21a2('0xf')]);module[_0x21a2('0x10')]=router; \ No newline at end of file +var _0xef35=['index','/:id','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../config/environment','get','isAuthenticated'];(function(_0x14465d,_0x5a7403){var _0x5be222=function(_0x2dfc28){while(--_0x2dfc28){_0x14465d['push'](_0x14465d['shift']());}};_0x5be222(++_0x5a7403);}(_0xef35,0xa8));var _0x5ef3=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0xef35[_0x235482];return _0x5f5bea;};'use strict';var multer=require(_0x5ef3('0x0'));var util=require(_0x5ef3('0x1'));var path=require(_0x5ef3('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ef3('0x3'));var router=express[_0x5ef3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5ef3('0x5'));var controller=require('./intDeskField.controller');router[_0x5ef3('0x6')]('/',auth[_0x5ef3('0x7')](),controller[_0x5ef3('0x8')]);router['get'](_0x5ef3('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x5ef3('0x7')](),controller[_0x5ef3('0xa')]);router[_0x5ef3('0xb')]('/:id',auth[_0x5ef3('0x7')](),controller[_0x5ef3('0xc')]);router[_0x5ef3('0xd')](_0x5ef3('0x9'),auth['isAuthenticated'](),controller[_0x5ef3('0xe')]);module[_0x5ef3('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 31ed171..c21da1b 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 _0x0747=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0747,0xfa));var _0x7074=function(_0x112f9f,_0x2dcc46){_0x112f9f=_0x112f9f-0x0;var _0x46eef9=_0x0747[_0x112f9f];return _0x46eef9;};'use strict';var Sequelize=require(_0x7074('0x0'));module[_0x7074('0x1')]={'type':{'type':Sequelize[_0x7074('0x2')](_0x7074('0x3'),_0x7074('0x4'),_0x7074('0x5'),_0x7074('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x7074('0x7')]},'key':{'type':Sequelize[_0x7074('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x7074('0x3'),_0x7074('0x4'),_0x7074('0x5'))},'keyContent':{'type':Sequelize[_0x7074('0x7')]},'idField':{'type':Sequelize[_0x7074('0x7')]},'nameField':{'type':Sequelize[_0x7074('0x7')]},'customField':{'type':Sequelize[_0x7074('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6e27=['STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable','picklist'];(function(_0x2c1b1c,_0x5e9c8e){var _0x1520fb=function(_0x313269){while(--_0x313269){_0x2c1b1c['push'](_0x2c1b1c['shift']());}};_0x1520fb(++_0x5e9c8e);}(_0x6e27,0x8a));var _0x76e2=function(_0x509880,_0x462c05){_0x509880=_0x509880-0x0;var _0x243e82=_0x6e27[_0x509880];return _0x243e82;};'use strict';var Sequelize=require(_0x76e2('0x0'));module[_0x76e2('0x1')]={'type':{'type':Sequelize[_0x76e2('0x2')](_0x76e2('0x3'),'variable',_0x76e2('0x4'),'keyValue',_0x76e2('0x5')),'defaultValue':_0x76e2('0x3')},'content':{'type':Sequelize[_0x76e2('0x6')]},'key':{'type':Sequelize[_0x76e2('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x76e2('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x76e2('0x6')]},'idField':{'type':Sequelize[_0x76e2('0x6')]},'nameField':{'type':Sequelize[_0x76e2('0x6')]},'customField':{'type':Sequelize[_0x76e2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x76e2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 11065a7..bc03168 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 _0x4128=['moment','bluebird','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','destroy','then','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','fields','include','options','DeskField','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x562120,_0x2524de){var _0x3b2744=function(_0x32af57){while(--_0x32af57){_0x562120['push'](_0x562120['shift']());}};_0x3b2744(++_0x2524de);}(_0x4128,0x1a5));var _0x8412=function(_0x5b9cfc,_0x27866e){_0x5b9cfc=_0x5b9cfc-0x0;var _0x5d5ac2=_0x4128[_0x5b9cfc];return _0x5d5ac2;};'use strict';var emlformat=require(_0x8412('0x0'));var rimraf=require(_0x8412('0x1'));var zipdir=require(_0x8412('0x2'));var jsonpatch=require(_0x8412('0x3'));var rp=require(_0x8412('0x4'));var moment=require(_0x8412('0x5'));var BPromise=require(_0x8412('0x6'));var Mustache=require('mustache');var util=require(_0x8412('0x7'));var path=require('path');var sox=require(_0x8412('0x8'));var csv=require(_0x8412('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8412('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8412('0xb'));var jsforce=require(_0x8412('0xc'));var deskjs=require(_0x8412('0xd'));var toCsv=require(_0x8412('0x9'));var querystring=require('querystring');var Papa=require(_0x8412('0xe'));var Redis=require(_0x8412('0xf'));var authService=require(_0x8412('0x10'));var qs=require(_0x8412('0x11'));var as=require(_0x8412('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8412('0x13'))(_0x8412('0x14'));var utils=require(_0x8412('0x15'));var config=require(_0x8412('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d4174,_0x308496){_0x308496=_0x308496||0xcc;return function(_0x2d0135){if(_0x2d0135){return _0x3d4174[_0x8412('0x17')](_0x308496);}return _0x3d4174['status'](_0x308496)[_0x8412('0x18')]();};}function respondWithResult(_0x4b6a0c,_0x124532){_0x124532=_0x124532||0xc8;return function(_0x1ff35f){if(_0x1ff35f){return _0x4b6a0c[_0x8412('0x19')](_0x124532)['json'](_0x1ff35f);}};}function respondWithFilteredResult(_0x5cf1a3,_0x29e079){return function(_0x2a2310){if(_0x2a2310){var _0x3e7f93=typeof _0x29e079['offset']===_0x8412('0x1a')&&typeof _0x29e079[_0x8412('0x1b')]===_0x8412('0x1a');var _0x1f82c7=_0x2a2310[_0x8412('0x1c')];var _0x55fabf=_0x3e7f93?0x0:_0x29e079[_0x8412('0x1d')];var _0x5eb565=_0x3e7f93?_0x2a2310[_0x8412('0x1c')]:_0x29e079[_0x8412('0x1d')]+_0x29e079[_0x8412('0x1b')];var _0x33afbb;if(_0x5eb565>=_0x1f82c7){_0x5eb565=_0x1f82c7;_0x33afbb=0xc8;}else{_0x33afbb=0xce;}_0x5cf1a3[_0x8412('0x19')](_0x33afbb);return _0x5cf1a3[_0x8412('0x1e')](_0x8412('0x1f'),_0x55fabf+'-'+_0x5eb565+'/'+_0x1f82c7)[_0x8412('0x20')](_0x2a2310);}return null;};}function patchUpdates(_0x2de1f1){return function(_0x20b054){try{jsonpatch['apply'](_0x20b054,_0x2de1f1,!![]);}catch(_0x48ed9c){return BPromise[_0x8412('0x21')](_0x48ed9c);}return _0x20b054[_0x8412('0x22')]();};}function saveUpdates(_0x5ef4f8,_0x505da3){return function(_0x5d030f){if(_0x5d030f){return _0x5d030f[_0x8412('0x23')](_0x5ef4f8)['then'](function(_0xea72d4){return _0xea72d4;});}return null;};}function removeEntity(_0x3a6adb,_0x4c512c){return function(_0x33b2f8){if(_0x33b2f8){return _0x33b2f8[_0x8412('0x24')]()[_0x8412('0x25')](function(){_0x3a6adb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x132065,_0x3b5f99){return function(_0xadc75b){if(!_0xadc75b){_0x132065[_0x8412('0x17')](0x194);}return _0xadc75b;};}function handleError(_0x5d0696,_0x28a117){_0x28a117=_0x28a117||0x1f4;return function(_0x2d32cf){logger['error'](_0x2d32cf['stack']);if(_0x2d32cf[_0x8412('0x26')]){delete _0x2d32cf[_0x8412('0x26')];}_0x5d0696['status'](_0x28a117)['send'](_0x2d32cf);};}exports[_0x8412('0x27')]=function(_0x34716f,_0x291e4b){var _0x43bbfb={},_0x19e3a6={},_0x2634e4={'count':0x0,'rows':[]};var _0x4d93f2=_[_0x8412('0x28')](db['DeskField'][_0x8412('0x29')],function(_0x4d7979){return{'name':_0x4d7979[_0x8412('0x2a')],'type':_0x4d7979[_0x8412('0x2b')][_0x8412('0x2c')]};});_0x19e3a6[_0x8412('0x2d')]=_[_0x8412('0x28')](_0x4d93f2,_0x8412('0x26'));_0x19e3a6[_0x8412('0x2e')]=_[_0x8412('0x2f')](_0x34716f[_0x8412('0x2e')]);_0x19e3a6[_0x8412('0x30')]=_[_0x8412('0x31')](_0x19e3a6[_0x8412('0x2d')],_0x19e3a6[_0x8412('0x2e')]);_0x43bbfb[_0x8412('0x32')]=_[_0x8412('0x31')](_0x19e3a6[_0x8412('0x2d')],qs['fields'](_0x34716f[_0x8412('0x2e')]['fields']));_0x43bbfb[_0x8412('0x32')]=_0x43bbfb[_0x8412('0x32')]['length']?_0x43bbfb[_0x8412('0x32')]:_0x19e3a6[_0x8412('0x2d')];if(!_0x34716f['query']['hasOwnProperty'](_0x8412('0x33'))){_0x43bbfb[_0x8412('0x1b')]=qs[_0x8412('0x1b')](_0x34716f[_0x8412('0x2e')]['limit']);_0x43bbfb[_0x8412('0x1d')]=qs['offset'](_0x34716f[_0x8412('0x2e')]['offset']);}_0x43bbfb['order']=qs[_0x8412('0x34')](_0x34716f['query'][_0x8412('0x34')]);_0x43bbfb[_0x8412('0x35')]=qs[_0x8412('0x30')](_[_0x8412('0x36')](_0x34716f['query'],_0x19e3a6[_0x8412('0x30')]),_0x4d93f2);if(_0x34716f[_0x8412('0x2e')][_0x8412('0x37')]){_0x43bbfb[_0x8412('0x35')]=_['merge'](_0x43bbfb['where'],{'$or':_[_0x8412('0x28')](_0x4d93f2,function(_0x28cf3e){if(_0x28cf3e[_0x8412('0x2b')]!==_0x8412('0x38')){var _0x2b2b94={};_0x2b2b94[_0x28cf3e['name']]={'$like':'%'+_0x34716f[_0x8412('0x2e')][_0x8412('0x37')]+'%'};return _0x2b2b94;}})});}_0x43bbfb=_[_0x8412('0x39')]({},_0x43bbfb,_0x34716f['options']);var _0x4ccea5={'where':_0x43bbfb['where']};return db['DeskField'][_0x8412('0x1c')](_0x4ccea5)[_0x8412('0x25')](function(_0x414c49){_0x2634e4[_0x8412('0x1c')]=_0x414c49;if(_0x34716f[_0x8412('0x2e')][_0x8412('0x3a')]){_0x43bbfb['include']=[{'all':!![]}];}return db['DeskField'][_0x8412('0x3b')](_0x43bbfb);})[_0x8412('0x25')](function(_0x1f8d3c){_0x2634e4[_0x8412('0x3c')]=_0x1f8d3c;return _0x2634e4;})[_0x8412('0x25')](respondWithFilteredResult(_0x291e4b,_0x43bbfb))[_0x8412('0x3d')](handleError(_0x291e4b,null));};exports[_0x8412('0x3e')]=function(_0x2ff7ca,_0x57039d){var _0x3d2bab={'raw':!![],'where':{'id':_0x2ff7ca[_0x8412('0x3f')]['id']}},_0x22febb={};_0x22febb[_0x8412('0x2d')]=_[_0x8412('0x2f')](db['DeskField'][_0x8412('0x29')]);_0x22febb['query']=_[_0x8412('0x2f')](_0x2ff7ca[_0x8412('0x2e')]);_0x22febb[_0x8412('0x30')]=_[_0x8412('0x31')](_0x22febb[_0x8412('0x2d')],_0x22febb[_0x8412('0x2e')]);_0x3d2bab['attributes']=_[_0x8412('0x31')](_0x22febb[_0x8412('0x2d')],qs[_0x8412('0x40')](_0x2ff7ca[_0x8412('0x2e')][_0x8412('0x40')]));_0x3d2bab[_0x8412('0x32')]=_0x3d2bab[_0x8412('0x32')]['length']?_0x3d2bab[_0x8412('0x32')]:_0x22febb[_0x8412('0x2d')];if(_0x2ff7ca[_0x8412('0x2e')][_0x8412('0x3a')]){_0x3d2bab[_0x8412('0x41')]=[{'all':!![]}];}_0x3d2bab=_['merge']({},_0x3d2bab,_0x2ff7ca[_0x8412('0x42')]);return db[_0x8412('0x43')][_0x8412('0x44')](_0x3d2bab)[_0x8412('0x25')](handleEntityNotFound(_0x57039d,null))[_0x8412('0x25')](respondWithResult(_0x57039d,null))[_0x8412('0x3d')](handleError(_0x57039d,null));};exports['create']=function(_0x46bb5e,_0x49262b){return db['DeskField'][_0x8412('0x45')](_0x46bb5e[_0x8412('0x46')],{})[_0x8412('0x25')](respondWithResult(_0x49262b,0xc9))[_0x8412('0x3d')](handleError(_0x49262b,null));};exports[_0x8412('0x23')]=function(_0x3ec581,_0x30abe1){if(_0x3ec581[_0x8412('0x46')]['id']){delete _0x3ec581[_0x8412('0x46')]['id'];}return db[_0x8412('0x43')]['find']({'where':{'id':_0x3ec581['params']['id']}})[_0x8412('0x25')](handleEntityNotFound(_0x30abe1,null))['then'](saveUpdates(_0x3ec581[_0x8412('0x46')],null))[_0x8412('0x25')](respondWithResult(_0x30abe1,null))[_0x8412('0x3d')](handleError(_0x30abe1,null));};exports[_0x8412('0x24')]=function(_0x2b9cd0,_0x2ad997){return db['DeskField'][_0x8412('0x44')]({'where':{'id':_0x2b9cd0[_0x8412('0x3f')]['id']}})[_0x8412('0x25')](handleEntityNotFound(_0x2ad997,null))['then'](removeEntity(_0x2ad997,null))[_0x8412('0x3d')](handleError(_0x2ad997,null));}; \ No newline at end of file +var _0x652a=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','catch','show','params','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x35b9ca,_0x5ef3ba){var _0x3b07cf=function(_0x4a6cdb){while(--_0x4a6cdb){_0x35b9ca['push'](_0x35b9ca['shift']());}};_0x3b07cf(++_0x5ef3ba);}(_0x652a,0x1ae));var _0xa652=function(_0xbcc7ad,_0x238ba8){_0xbcc7ad=_0xbcc7ad-0x0;var _0x17f649=_0x652a[_0xbcc7ad];return _0x17f649;};'use strict';var emlformat=require(_0xa652('0x0'));var rimraf=require(_0xa652('0x1'));var zipdir=require(_0xa652('0x2'));var jsonpatch=require(_0xa652('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa652('0x4'));var Mustache=require(_0xa652('0x5'));var util=require(_0xa652('0x6'));var path=require(_0xa652('0x7'));var sox=require(_0xa652('0x8'));var csv=require('to-csv');var ejs=require(_0xa652('0x9'));var fs=require('fs');var fs_extra=require(_0xa652('0xa'));var _=require(_0xa652('0xb'));var squel=require(_0xa652('0xc'));var crypto=require(_0xa652('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa652('0xe'));var querystring=require(_0xa652('0xf'));var Papa=require(_0xa652('0x10'));var Redis=require(_0xa652('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa652('0x12'));var hardwareService=require(_0xa652('0x13'));var logger=require(_0xa652('0x14'))(_0xa652('0x15'));var utils=require(_0xa652('0x16'));var config=require(_0xa652('0x17'));var licenseUtil=require(_0xa652('0x18'));var db=require(_0xa652('0x19'))['db'];function respondWithStatusCode(_0x229735,_0x2aba11){_0x2aba11=_0x2aba11||0xcc;return function(_0x6b50bb){if(_0x6b50bb){return _0x229735[_0xa652('0x1a')](_0x2aba11);}return _0x229735['status'](_0x2aba11)[_0xa652('0x1b')]();};}function respondWithResult(_0x537c68,_0x13cfd4){_0x13cfd4=_0x13cfd4||0xc8;return function(_0x14377b){if(_0x14377b){return _0x537c68[_0xa652('0x1c')](_0x13cfd4)[_0xa652('0x1d')](_0x14377b);}};}function respondWithFilteredResult(_0x3509d8,_0x507a8a){return function(_0x144b37){if(_0x144b37){var _0x1d7c4c=typeof _0x507a8a[_0xa652('0x1e')]===_0xa652('0x1f')&&typeof _0x507a8a[_0xa652('0x20')]===_0xa652('0x1f');var _0x212301=_0x144b37['count'];var _0xe096d=_0x1d7c4c?0x0:_0x507a8a[_0xa652('0x1e')];var _0x1155c7=_0x1d7c4c?_0x144b37[_0xa652('0x21')]:_0x507a8a[_0xa652('0x1e')]+_0x507a8a['limit'];var _0x5afcc9;if(_0x1155c7>=_0x212301){_0x1155c7=_0x212301;_0x5afcc9=0xc8;}else{_0x5afcc9=0xce;}_0x3509d8[_0xa652('0x1c')](_0x5afcc9);return _0x3509d8[_0xa652('0x22')]('Content-Range',_0xe096d+'-'+_0x1155c7+'/'+_0x212301)[_0xa652('0x1d')](_0x144b37);}return null;};}function patchUpdates(_0x2360f8){return function(_0x3a6323){try{jsonpatch[_0xa652('0x23')](_0x3a6323,_0x2360f8,!![]);}catch(_0x32302f){return BPromise[_0xa652('0x24')](_0x32302f);}return _0x3a6323['save']();};}function saveUpdates(_0x369700,_0x298d87){return function(_0x2402fc){if(_0x2402fc){return _0x2402fc['update'](_0x369700)[_0xa652('0x25')](function(_0x242ab7){return _0x242ab7;});}return null;};}function removeEntity(_0x18d09b,_0x3c6b76){return function(_0xb456f4){if(_0xb456f4){return _0xb456f4[_0xa652('0x26')]()['then'](function(){_0x18d09b[_0xa652('0x1c')](0xcc)[_0xa652('0x1b')]();});}};}function handleEntityNotFound(_0xcdd904,_0x5d647e){return function(_0x4fe328){if(!_0x4fe328){_0xcdd904['sendStatus'](0x194);}return _0x4fe328;};}function handleError(_0x505862,_0x5071da){_0x5071da=_0x5071da||0x1f4;return function(_0x4e908f){logger[_0xa652('0x27')](_0x4e908f['stack']);if(_0x4e908f[_0xa652('0x28')]){delete _0x4e908f[_0xa652('0x28')];}_0x505862['status'](_0x5071da)[_0xa652('0x29')](_0x4e908f);};}exports[_0xa652('0x2a')]=function(_0x3af686,_0x21d6e3){var _0xe9931={},_0x18e9cf={},_0x1fd1c7={'count':0x0,'rows':[]};var _0x2da108=_[_0xa652('0x2b')](db[_0xa652('0x2c')][_0xa652('0x2d')],function(_0x5d1b4c){return{'name':_0x5d1b4c[_0xa652('0x2e')],'type':_0x5d1b4c[_0xa652('0x2f')][_0xa652('0x30')]};});_0x18e9cf[_0xa652('0x31')]=_['map'](_0x2da108,_0xa652('0x28'));_0x18e9cf['query']=_[_0xa652('0x32')](_0x3af686[_0xa652('0x33')]);_0x18e9cf[_0xa652('0x34')]=_[_0xa652('0x35')](_0x18e9cf[_0xa652('0x31')],_0x18e9cf['query']);_0xe9931[_0xa652('0x36')]=_[_0xa652('0x35')](_0x18e9cf[_0xa652('0x31')],qs['fields'](_0x3af686[_0xa652('0x33')][_0xa652('0x37')]));_0xe9931['attributes']=_0xe9931[_0xa652('0x36')][_0xa652('0x38')]?_0xe9931[_0xa652('0x36')]:_0x18e9cf[_0xa652('0x31')];if(!_0x3af686[_0xa652('0x33')][_0xa652('0x39')](_0xa652('0x3a'))){_0xe9931[_0xa652('0x20')]=qs[_0xa652('0x20')](_0x3af686['query'][_0xa652('0x20')]);_0xe9931['offset']=qs[_0xa652('0x1e')](_0x3af686[_0xa652('0x33')][_0xa652('0x1e')]);}_0xe9931[_0xa652('0x3b')]=qs[_0xa652('0x3c')](_0x3af686['query'][_0xa652('0x3c')]);_0xe9931[_0xa652('0x3d')]=qs[_0xa652('0x34')](_[_0xa652('0x3e')](_0x3af686[_0xa652('0x33')],_0x18e9cf[_0xa652('0x34')]),_0x2da108);if(_0x3af686[_0xa652('0x33')][_0xa652('0x3f')]){_0xe9931[_0xa652('0x3d')]=_[_0xa652('0x40')](_0xe9931[_0xa652('0x3d')],{'$or':_['map'](_0x2da108,function(_0x33b7a8){if(_0x33b7a8[_0xa652('0x2f')]!=='VIRTUAL'){var _0x147cdd={};_0x147cdd[_0x33b7a8[_0xa652('0x28')]]={'$like':'%'+_0x3af686[_0xa652('0x33')][_0xa652('0x3f')]+'%'};return _0x147cdd;}})});}_0xe9931=_['merge']({},_0xe9931,_0x3af686[_0xa652('0x41')]);var _0x1c60c1={'where':_0xe9931[_0xa652('0x3d')]};return db['DeskField'][_0xa652('0x21')](_0x1c60c1)['then'](function(_0x35752a){_0x1fd1c7[_0xa652('0x21')]=_0x35752a;if(_0x3af686[_0xa652('0x33')][_0xa652('0x42')]){_0xe9931['include']=[{'all':!![]}];}return db[_0xa652('0x2c')]['findAll'](_0xe9931);})[_0xa652('0x25')](function(_0x824876){_0x1fd1c7['rows']=_0x824876;return _0x1fd1c7;})[_0xa652('0x25')](respondWithFilteredResult(_0x21d6e3,_0xe9931))[_0xa652('0x43')](handleError(_0x21d6e3,null));};exports[_0xa652('0x44')]=function(_0x40d794,_0x329b8d){var _0x1cc822={'raw':!![],'where':{'id':_0x40d794[_0xa652('0x45')]['id']}},_0x22b01c={};_0x22b01c['model']=_[_0xa652('0x32')](db[_0xa652('0x2c')][_0xa652('0x2d')]);_0x22b01c[_0xa652('0x33')]=_[_0xa652('0x32')](_0x40d794[_0xa652('0x33')]);_0x22b01c[_0xa652('0x34')]=_['intersection'](_0x22b01c[_0xa652('0x31')],_0x22b01c[_0xa652('0x33')]);_0x1cc822[_0xa652('0x36')]=_[_0xa652('0x35')](_0x22b01c[_0xa652('0x31')],qs[_0xa652('0x37')](_0x40d794[_0xa652('0x33')][_0xa652('0x37')]));_0x1cc822[_0xa652('0x36')]=_0x1cc822[_0xa652('0x36')][_0xa652('0x38')]?_0x1cc822[_0xa652('0x36')]:_0x22b01c[_0xa652('0x31')];if(_0x40d794['query'][_0xa652('0x42')]){_0x1cc822[_0xa652('0x46')]=[{'all':!![]}];}_0x1cc822=_['merge']({},_0x1cc822,_0x40d794['options']);return db[_0xa652('0x2c')][_0xa652('0x47')](_0x1cc822)[_0xa652('0x25')](handleEntityNotFound(_0x329b8d,null))['then'](respondWithResult(_0x329b8d,null))[_0xa652('0x43')](handleError(_0x329b8d,null));};exports[_0xa652('0x48')]=function(_0x322d5d,_0x189dd2){return db[_0xa652('0x2c')][_0xa652('0x48')](_0x322d5d[_0xa652('0x49')],{})[_0xa652('0x25')](respondWithResult(_0x189dd2,0xc9))[_0xa652('0x43')](handleError(_0x189dd2,null));};exports[_0xa652('0x4a')]=function(_0x39bd2e,_0x4bc3a4){if(_0x39bd2e[_0xa652('0x49')]['id']){delete _0x39bd2e[_0xa652('0x49')]['id'];}return db['DeskField'][_0xa652('0x47')]({'where':{'id':_0x39bd2e[_0xa652('0x45')]['id']}})[_0xa652('0x25')](handleEntityNotFound(_0x4bc3a4,null))['then'](saveUpdates(_0x39bd2e['body'],null))[_0xa652('0x25')](respondWithResult(_0x4bc3a4,null))[_0xa652('0x43')](handleError(_0x4bc3a4,null));};exports['destroy']=function(_0x1fe253,_0x245ecb){return db[_0xa652('0x2c')][_0xa652('0x47')]({'where':{'id':_0x1fe253[_0xa652('0x45')]['id']}})[_0xa652('0x25')](handleEntityNotFound(_0x245ecb,null))[_0xa652('0x25')](removeEntity(_0x245ecb,null))['catch'](handleError(_0x245ecb,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 665a1bf..bce8315 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 _0xcfc7=['lodash','util','../../config/logger','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','desk_unique_index','idField','FieldId'];(function(_0x2ef00b,_0xb0bd61){var _0x1303a6=function(_0x5ddc8e){while(--_0x5ddc8e){_0x2ef00b['push'](_0x2ef00b['shift']());}};_0x1303a6(++_0xb0bd61);}(_0xcfc7,0x84));var _0x7cfc=function(_0x1c61ad,_0x5d7792){_0x1c61ad=_0x1c61ad-0x0;var _0x5730d4=_0xcfc7[_0x1c61ad];return _0x5730d4;};'use strict';var _=require(_0x7cfc('0x0'));var util=require(_0x7cfc('0x1'));var logger=require(_0x7cfc('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cfc('0x3'));var rimraf=require(_0x7cfc('0x4'));var config=require(_0x7cfc('0x5'));var attributes=require(_0x7cfc('0x6'));module[_0x7cfc('0x7')]=function(_0x5c8336,_0x55c44f){return _0x5c8336[_0x7cfc('0x8')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x7cfc('0x9'),'fields':[_0x7cfc('0xa'),_0x7cfc('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x20d6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x20d6,0x130));var _0x620d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x20d6[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var logger=require(_0x620d('0x2'))(_0x620d('0x3'));var moment=require(_0x620d('0x4'));var BPromise=require(_0x620d('0x5'));var rp=require(_0x620d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x620d('0x7'));var config=require(_0x620d('0x8'));var attributes=require(_0x620d('0x9'));module[_0x620d('0xa')]=function(_0x3f8d28,_0x5776e3){return _0x3f8d28['define'](_0x620d('0xb'),attributes,{'tableName':_0x620d('0xc'),'paranoid':![],'indexes':[{'name':_0x620d('0xd'),'fields':[_0x620d('0xe'),_0x620d('0xf')],'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 0771f26..e6bbfcf 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 _0x565e=['moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','DeskField,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','util'];(function(_0x4e3cbc,_0x1b6aed){var _0xff56f3=function(_0x24cdef){while(--_0x24cdef){_0x4e3cbc['push'](_0x4e3cbc['shift']());}};_0xff56f3(++_0x1b6aed);}(_0x565e,0x98));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe565('0x0'));var moment=require(_0xe565('0x1'));var BPromise=require(_0xe565('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe565('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe565('0x4'));var logger=require(_0xe565('0x5'))('rpc');var config=require(_0xe565('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe565('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x42545e,_0x9d95d5,_0x4db963){return new BPromise(function(_0x481262,_0x3de797){return client[_0xe565('0x8')](_0x42545e,_0x4db963)[_0xe565('0x9')](function(_0x14be17){logger[_0xe565('0xa')](_0xe565('0xb'),_0x9d95d5,'request\x20sent');logger[_0xe565('0xc')]('DeskField,\x20%s,\x20%s,\x20%s',_0x9d95d5,_0xe565('0xd'),JSON['stringify'](_0x14be17));if(_0x14be17['error']){if(_0x14be17[_0xe565('0xe')]['code']===0x1f4){logger['error'](_0xe565('0xb'),_0x9d95d5,_0x14be17[_0xe565('0xe')][_0xe565('0xf')]);return _0x3de797(_0x14be17[_0xe565('0xe')][_0xe565('0xf')]);}logger[_0xe565('0xe')](_0xe565('0xb'),_0x9d95d5,_0x14be17['error']['message']);return _0x481262(_0x14be17[_0xe565('0xe')][_0xe565('0xf')]);}else{logger['info'](_0xe565('0xb'),_0x9d95d5,'request\x20sent');_0x481262(_0x14be17['result'][_0xe565('0xf')]);}})[_0xe565('0x10')](function(_0x45158e){logger['error'](_0xe565('0xb'),_0x9d95d5,_0x45158e);_0x3de797(_0x45158e);});});} \ No newline at end of file +var _0xff2a=['request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3e091e,_0x10d588){var _0x530b15=function(_0x229363){while(--_0x229363){_0x3e091e['push'](_0x3e091e['shift']());}};_0x530b15(++_0x10d588);}(_0xff2a,0x182));var _0xaff2=function(_0x1f530d,_0x18a19e){_0x1f530d=_0x1f530d-0x0;var _0x22103f=_0xff2a[_0x1f530d];return _0x22103f;};'use strict';var _=require(_0xaff2('0x0'));var util=require(_0xaff2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaff2('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xaff2('0x3'));var logger=require(_0xaff2('0x4'))(_0xaff2('0x5'));var config=require(_0xaff2('0x6'));var jayson=require(_0xaff2('0x7'));var client=jayson[_0xaff2('0x8')][_0xaff2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ae42a,_0xdd020d,_0x5f438b){return new BPromise(function(_0x2d6a3b,_0x1b4535){return client[_0xaff2('0xa')](_0x3ae42a,_0x5f438b)[_0xaff2('0xb')](function(_0x784558){logger[_0xaff2('0xc')]('DeskField,\x20%s,\x20%s',_0xdd020d,_0xaff2('0xd'));logger[_0xaff2('0xe')](_0xaff2('0xf'),_0xdd020d,_0xaff2('0xd'),JSON[_0xaff2('0x10')](_0x784558));if(_0x784558[_0xaff2('0x11')]){if(_0x784558[_0xaff2('0x11')][_0xaff2('0x12')]===0x1f4){logger[_0xaff2('0x11')](_0xaff2('0x13'),_0xdd020d,_0x784558[_0xaff2('0x11')][_0xaff2('0x14')]);return _0x1b4535(_0x784558[_0xaff2('0x11')][_0xaff2('0x14')]);}logger[_0xaff2('0x11')]('DeskField,\x20%s,\x20%s',_0xdd020d,_0x784558[_0xaff2('0x11')][_0xaff2('0x14')]);return _0x2d6a3b(_0x784558['error']['message']);}else{logger[_0xaff2('0xc')]('DeskField,\x20%s,\x20%s',_0xdd020d,_0xaff2('0xd'));_0x2d6a3b(_0x784558['result']['message']);}})[_0xaff2('0x15')](function(_0x538d2a){logger[_0xaff2('0x11')](_0xaff2('0x13'),_0xdd020d,_0x538d2a);_0x1b4535(_0x538d2a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 81cdd0c..1fb5848 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 _0xe9ee=['addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','getFields','post','create'];(function(_0x46390e,_0x39d20f){var _0x4db91c=function(_0x2bd91e){while(--_0x2bd91e){_0x46390e['push'](_0x46390e['shift']());}};_0x4db91c(++_0x39d20f);}(_0xe9ee,0x13f));var _0xee9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9ee[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee9e('0x0'));var util=require(_0xee9e('0x1'));var path=require(_0xee9e('0x2'));var timeout=require(_0xee9e('0x3'));var express=require('express');var router=express[_0xee9e('0x4')]();var fs_extra=require(_0xee9e('0x5'));var auth=require(_0xee9e('0x6'));var interaction=require(_0xee9e('0x7'));var config=require(_0xee9e('0x8'));var controller=require(_0xee9e('0x9'));router[_0xee9e('0xa')]('/',auth[_0xee9e('0xb')](),controller[_0xee9e('0xc')]);router[_0xee9e('0xa')]('/:id',auth[_0xee9e('0xb')](),controller[_0xee9e('0xd')]);router[_0xee9e('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xee9e('0xb')](),controller[_0xee9e('0xe')]);router[_0xee9e('0xf')]('/',auth[_0xee9e('0xb')](),controller[_0xee9e('0x10')]);router[_0xee9e('0xf')]('/:id/configurations',auth[_0xee9e('0xb')](),controller[_0xee9e('0x11')]);router[_0xee9e('0x12')](_0xee9e('0x13'),auth['isAuthenticated'](),controller[_0xee9e('0x14')]);router[_0xee9e('0x15')](_0xee9e('0x13'),auth['isAuthenticated'](),controller[_0xee9e('0x16')]);module[_0xee9e('0x17')]=router; \ No newline at end of file +var _0xc88d=['create','/:id/configurations','addConfiguration','put','/:id','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','isAuthenticated','index','get','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x4f37fa,_0x583f8b){var _0x43eba2=function(_0x94588b){while(--_0x94588b){_0x4f37fa['push'](_0x4f37fa['shift']());}};_0x43eba2(++_0x583f8b);}(_0xc88d,0x104));var _0xdc88=function(_0x5454b7,_0x207bbc){_0x5454b7=_0x5454b7-0x0;var _0x1e6750=_0xc88d[_0x5454b7];return _0x1e6750;};'use strict';var multer=require(_0xdc88('0x0'));var util=require(_0xdc88('0x1'));var path=require(_0xdc88('0x2'));var timeout=require('connect-timeout');var express=require(_0xdc88('0x3'));var router=express['Router']();var fs_extra=require(_0xdc88('0x4'));var auth=require(_0xdc88('0x5'));var interaction=require(_0xdc88('0x6'));var config=require('../../config/environment');var controller=require(_0xdc88('0x7'));router['get']('/',auth[_0xdc88('0x8')](),controller[_0xdc88('0x9')]);router[_0xdc88('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xdc88('0xb')]);router[_0xdc88('0xa')]('/:id/configurations',auth[_0xdc88('0x8')](),controller[_0xdc88('0xc')]);router[_0xdc88('0xa')](_0xdc88('0xd'),auth[_0xdc88('0x8')](),controller[_0xdc88('0xe')]);router[_0xdc88('0xf')]('/',auth[_0xdc88('0x8')](),controller[_0xdc88('0x10')]);router[_0xdc88('0xf')](_0xdc88('0x11'),auth[_0xdc88('0x8')](),controller[_0xdc88('0x12')]);router[_0xdc88('0x13')](_0xdc88('0x14'),auth[_0xdc88('0x8')](),controller['update']);router[_0xdc88('0x15')]('/:id',auth[_0xdc88('0x8')](),controller[_0xdc88('0x16')]);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 45fcf53..27700d3 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 _0x2087=['exports','STRING','BOOLEAN','sequelize'];(function(_0xdf7fb0,_0xf7ed3f){var _0x3096a4=function(_0x4d817b){while(--_0x4d817b){_0xdf7fb0['push'](_0xdf7fb0['shift']());}};_0x3096a4(++_0xf7ed3f);}(_0x2087,0xf3));var _0x7208=function(_0x22ac5b,_0x2ef85c){_0x22ac5b=_0x22ac5b-0x0;var _0x4b5cc4=_0x2087[_0x22ac5b];return _0x4b5cc4;};'use strict';var Sequelize=require(_0x7208('0x0'));module[_0x7208('0x1')]={'name':{'type':Sequelize[_0x7208('0x2')]},'username':{'type':Sequelize[_0x7208('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7208('0x2')]},'tenantId':{'type':Sequelize[_0x7208('0x2')]},'clientId':{'type':Sequelize[_0x7208('0x2')]},'clientSecret':{'type':Sequelize[_0x7208('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x7208('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4f5a=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1d0bd1,_0xb7e9d){var _0x2ecb04=function(_0x3f5146){while(--_0x3f5146){_0x1d0bd1['push'](_0x1d0bd1['shift']());}};_0x2ecb04(++_0xb7e9d);}(_0x4f5a,0xaa));var _0xa4f5=function(_0x1bc9de,_0x30aa82){_0x1bc9de=_0x1bc9de-0x0;var _0xeacad2=_0x4f5a[_0x1bc9de];return _0xeacad2;};'use strict';var Sequelize=require(_0xa4f5('0x0'));module[_0xa4f5('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa4f5('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xa4f5('0x2')]},'serverUrl':{'type':Sequelize[_0xa4f5('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xa4f5('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 1d78c2f..7ed770b 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 _0x426a=['slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','access_token','data5','data7','remoteUri','password','GET','Bearer\x20','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials','statusCode','EntityDefinitions(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Attributes(',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','json','offset','undefined','count','limit','status','set','Content-Range','update','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','then','includeAll','findAll','params','include','merge','find','catch','create','body','getConfigurations','Dynamics365Configuration','options','addConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','Dynamics365Field','Descriptions','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','resolveby','resolvebykpiidname','responseby','sentimentvalue'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0x426a,0x1c6));var _0xa426=function(_0x11f837,_0x101f94){_0x11f837=_0x11f837-0x0;var _0x510086=_0x426a[_0x11f837];return _0x510086;};'use strict';var rp=require(_0xa426('0x0'));var util=require(_0xa426('0x1'));var _=require(_0xa426('0x2'));var qs=require(_0xa426('0x3'));var logger=require(_0xa426('0x4'))(_0xa426('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa426('0x6'));function respondWithResult(_0x58d352,_0x487f1c){_0x487f1c=_0x487f1c||0xc8;return function(_0x4abd16){if(_0x4abd16){return _0x58d352['status'](_0x487f1c)[_0xa426('0x7')](_0x4abd16);}};}function respondWithFilteredResult(_0xb01bc7,_0x3c3295){return function(_0x47ee9f){if(_0x47ee9f){var _0xa67169=typeof _0x3c3295[_0xa426('0x8')]==='undefined'&&typeof _0x3c3295['limit']===_0xa426('0x9');var _0x141f0e=_0x47ee9f[_0xa426('0xa')];var _0x3a9143=_0xa67169?0x0:_0x3c3295[_0xa426('0x8')];var _0x190999=_0xa67169?_0x47ee9f[_0xa426('0xa')]:_0x3c3295[_0xa426('0x8')]+_0x3c3295[_0xa426('0xb')];var _0x566f43;if(_0x190999>=_0x141f0e){_0x190999=_0x141f0e;_0x566f43=0xc8;}else{_0x566f43=0xce;}_0xb01bc7[_0xa426('0xc')](_0x566f43);return _0xb01bc7[_0xa426('0xd')](_0xa426('0xe'),_0x3a9143+'-'+_0x190999+'/'+_0x141f0e)[_0xa426('0x7')](_0x47ee9f);}return null;};}function saveUpdates(_0x16bad8){return function(_0x1c7b94){if(_0x1c7b94){return _0x1c7b94[_0xa426('0xf')](_0x16bad8)['then'](function(_0x47cdca){return _0x47cdca;});}return null;};}function removeEntity(_0x35f9ca){return function(_0x490994){if(_0x490994){return _0x490994[_0xa426('0x10')]()['then'](function(){_0x35f9ca['status'](0xcc)[_0xa426('0x11')]();});}};}function handleEntityNotFound(_0x48431b){return function(_0x196c03){if(!_0x196c03){_0x48431b[_0xa426('0x12')](0x194);}return _0x196c03;};}function handleError(_0x13d649,_0x5c6da2){_0x5c6da2=_0x5c6da2||0x1f4;return function(_0x2ffea9){logger[_0xa426('0x13')](_0x2ffea9[_0xa426('0x14')]);if(_0x2ffea9[_0xa426('0x15')]){delete _0x2ffea9[_0xa426('0x15')];}_0x13d649['status'](_0x5c6da2)[_0xa426('0x16')](_0x2ffea9);};}exports[_0xa426('0x17')]=function(_0x5eb1de,_0x5d854e){var _0xae9e4f={},_0x10d1cd={},_0x346b53={'count':0x0,'rows':[]};var _0x7ff016=_[_0xa426('0x18')](db[_0xa426('0x19')][_0xa426('0x1a')],function(_0xfc6f55){return{'name':_0xfc6f55['fieldName'],'type':_0xfc6f55[_0xa426('0x1b')][_0xa426('0x1c')]};});_0x10d1cd['model']=_[_0xa426('0x18')](_0x7ff016,_0xa426('0x15'));_0x10d1cd[_0xa426('0x1d')]=_[_0xa426('0x1e')](_0x5eb1de[_0xa426('0x1d')]);_0x10d1cd['filters']=_[_0xa426('0x1f')](_0x10d1cd['model'],_0x10d1cd['query']);_0xae9e4f['attributes']=_['intersection'](_0x10d1cd[_0xa426('0x20')],qs[_0xa426('0x21')](_0x5eb1de[_0xa426('0x1d')]['fields']));_0xae9e4f[_0xa426('0x22')]=_0xae9e4f[_0xa426('0x22')][_0xa426('0x23')]?_0xae9e4f['attributes']:_0x10d1cd[_0xa426('0x20')];if(!_0x5eb1de['query'][_0xa426('0x24')](_0xa426('0x25'))){_0xae9e4f[_0xa426('0xb')]=qs['limit'](_0x5eb1de[_0xa426('0x1d')]['limit']);_0xae9e4f[_0xa426('0x8')]=qs['offset'](_0x5eb1de[_0xa426('0x1d')][_0xa426('0x8')]);}_0xae9e4f[_0xa426('0x26')]=qs[_0xa426('0x27')](_0x5eb1de['query']['sort']);_0xae9e4f[_0xa426('0x28')]=qs['filters'](_[_0xa426('0x29')](_0x5eb1de[_0xa426('0x1d')],_0x10d1cd[_0xa426('0x2a')]),_0x7ff016);if(_0x5eb1de[_0xa426('0x1d')][_0xa426('0x2b')]){_0xae9e4f[_0xa426('0x28')]=_['merge'](_0xae9e4f['where'],{'$or':_[_0xa426('0x18')](_0x7ff016,function(_0x36f643){if(_0x36f643['type']!==_0xa426('0x2c')){var _0x23306d={};_0x23306d[_0x36f643[_0xa426('0x15')]]={'$like':'%'+_0x5eb1de[_0xa426('0x1d')][_0xa426('0x2b')]+'%'};return _0x23306d;}})});}_0xae9e4f=_['merge']({},_0xae9e4f,_0x5eb1de['options']);var _0x1fe0cf={'where':_0xae9e4f['where']};return db[_0xa426('0x19')]['count'](_0x1fe0cf)[_0xa426('0x2d')](function(_0x92a2d3){_0x346b53[_0xa426('0xa')]=_0x92a2d3;if(_0x5eb1de[_0xa426('0x1d')][_0xa426('0x2e')]){_0xae9e4f['include']=[{'all':!![]}];}return db[_0xa426('0x19')][_0xa426('0x2f')](_0xae9e4f);})[_0xa426('0x2d')](function(_0x17eb2d){_0x346b53['rows']=_0x17eb2d;return _0x346b53;})[_0xa426('0x2d')](respondWithFilteredResult(_0x5d854e,_0xae9e4f))['catch'](handleError(_0x5d854e,null));};exports['show']=function(_0x404e9b,_0xa6a95c){var _0x5dea31={'raw':![],'where':{'id':_0x404e9b[_0xa426('0x30')]['id']}},_0x2e2860={};_0x2e2860[_0xa426('0x20')]=_[_0xa426('0x1e')](db[_0xa426('0x19')]['rawAttributes']);_0x2e2860[_0xa426('0x1d')]=_[_0xa426('0x1e')](_0x404e9b[_0xa426('0x1d')]);_0x2e2860[_0xa426('0x2a')]=_['intersection'](_0x2e2860[_0xa426('0x20')],_0x2e2860[_0xa426('0x1d')]);_0x5dea31[_0xa426('0x22')]=_['intersection'](_0x2e2860[_0xa426('0x20')],qs['fields'](_0x404e9b['query']['fields']));_0x5dea31['attributes']=_0x5dea31['attributes'][_0xa426('0x23')]?_0x5dea31['attributes']:_0x2e2860[_0xa426('0x20')];if(_0x404e9b['query'][_0xa426('0x2e')]){_0x5dea31[_0xa426('0x31')]=[{'all':!![]}];}_0x5dea31=_[_0xa426('0x32')]({},_0x5dea31,_0x404e9b['options']);return db[_0xa426('0x19')][_0xa426('0x33')](_0x5dea31)['then'](handleEntityNotFound(_0xa6a95c,null))[_0xa426('0x2d')](respondWithResult(_0xa6a95c,null))[_0xa426('0x34')](handleError(_0xa6a95c,null));};exports[_0xa426('0x35')]=function(_0x34ec50,_0x39c937){return db[_0xa426('0x19')][_0xa426('0x35')](_0x34ec50[_0xa426('0x36')],{})['then'](respondWithResult(_0x39c937,0xc9))[_0xa426('0x34')](handleError(_0x39c937,null));};exports['update']=function(_0x4ef1ee,_0x1aeb6a){if(_0x4ef1ee['body']['id']){delete _0x4ef1ee[_0xa426('0x36')]['id'];}return db[_0xa426('0x19')][_0xa426('0x33')]({'where':{'id':_0x4ef1ee[_0xa426('0x30')]['id']}})['then'](handleEntityNotFound(_0x1aeb6a,null))[_0xa426('0x2d')](saveUpdates(_0x4ef1ee[_0xa426('0x36')],null))[_0xa426('0x2d')](respondWithResult(_0x1aeb6a,null))[_0xa426('0x34')](handleError(_0x1aeb6a,null));};exports[_0xa426('0x10')]=function(_0x21ac30,_0x327f8b){return db[_0xa426('0x19')]['find']({'where':{'id':_0x21ac30[_0xa426('0x30')]['id']}})[_0xa426('0x2d')](handleEntityNotFound(_0x327f8b,null))['then'](removeEntity(_0x327f8b,null))[_0xa426('0x34')](handleError(_0x327f8b,null));};exports[_0xa426('0x37')]=function(_0x1f707b,_0x1b532b){var _0x41f0b8={};var _0x14b279={};var _0x73665d;var _0x4410bf;return db[_0xa426('0x19')]['findOne']({'where':{'id':_0x1f707b['params']['id']}})['then'](handleEntityNotFound(_0x1b532b,null))[_0xa426('0x2d')](function(_0x4e869d){if(_0x4e869d){_0x73665d=_0x4e869d;_0x14b279[_0xa426('0x20')]=_[_0xa426('0x1e')](db[_0xa426('0x38')]['rawAttributes']);_0x14b279['query']=_[_0xa426('0x1e')](_0x1f707b[_0xa426('0x1d')]);_0x14b279[_0xa426('0x2a')]=_['intersection'](_0x14b279['model'],_0x14b279[_0xa426('0x1d')]);_0x41f0b8['attributes']=_[_0xa426('0x1f')](_0x14b279['model'],qs[_0xa426('0x21')](_0x1f707b[_0xa426('0x1d')][_0xa426('0x21')]));_0x41f0b8['attributes']=_0x41f0b8['attributes'][_0xa426('0x23')]?_0x41f0b8['attributes']:_0x14b279[_0xa426('0x20')];_0x41f0b8[_0xa426('0x26')]=qs[_0xa426('0x27')](_0x1f707b[_0xa426('0x1d')]['sort']);_0x41f0b8['where']=qs[_0xa426('0x2a')](_['pick'](_0x1f707b[_0xa426('0x1d')],_0x14b279[_0xa426('0x2a')]));if(_0x1f707b[_0xa426('0x1d')][_0xa426('0x2b')]){_0x41f0b8[_0xa426('0x28')]=_['merge'](_0x41f0b8['where'],{'$or':_[_0xa426('0x18')](_0x41f0b8[_0xa426('0x22')],function(_0xce7e){var _0x5059aa={};_0x5059aa[_0xce7e]={'$like':'%'+_0x1f707b[_0xa426('0x1d')]['filter']+'%'};return _0x5059aa;})});}_0x41f0b8=_[_0xa426('0x32')]({},_0x41f0b8,_0x1f707b[_0xa426('0x39')]);return _0x73665d['getConfigurations'](_0x41f0b8);}})['then'](function(_0x51374b){if(_0x51374b){_0x4410bf=_0x51374b['length'];if(!_0x1f707b[_0xa426('0x1d')]['hasOwnProperty'](_0xa426('0x25'))){_0x41f0b8[_0xa426('0xb')]=qs['limit'](_0x1f707b[_0xa426('0x1d')][_0xa426('0xb')]);_0x41f0b8[_0xa426('0x8')]=qs[_0xa426('0x8')](_0x1f707b['query'][_0xa426('0x8')]);}return _0x73665d[_0xa426('0x37')](_0x41f0b8);}})[_0xa426('0x2d')](function(_0x3895de){if(_0x3895de){return _0x3895de?{'count':_0x4410bf,'rows':_0x3895de}:null;}})[_0xa426('0x2d')](respondWithResult(_0x1b532b,null))[_0xa426('0x34')](handleError(_0x1b532b,null));};exports[_0xa426('0x3a')]=function(_0x53ebb9,_0x17f8f3){if(_0x53ebb9[_0xa426('0x36')]['id']){delete _0x53ebb9['body']['id'];}return db[_0xa426('0x19')][_0xa426('0x3b')]({'where':{'id':_0x53ebb9[_0xa426('0x30')]['id']}})[_0xa426('0x2d')](handleEntityNotFound(_0x17f8f3,null))[_0xa426('0x2d')](function(_0x6f8248){if(_0x6f8248){_0x53ebb9[_0xa426('0x36')][_0xa426('0x3c')]=_0x6f8248['id'];_0x53ebb9['body'][_0xa426('0x3d')]=integrations[_0xa426('0x3e')](_0x53ebb9[_0xa426('0x36')]['channel'],_0x53ebb9['body'][_0xa426('0x1b')]);_0x53ebb9[_0xa426('0x36')]['Descriptions']=integrations[_0xa426('0x3f')](_0x53ebb9[_0xa426('0x36')][_0xa426('0x40')],_0x53ebb9[_0xa426('0x36')][_0xa426('0x1b')]);return db[_0xa426('0x38')][_0xa426('0x35')](_0x53ebb9['body'],{'include':[{'model':db[_0xa426('0x41')],'as':_0xa426('0x3d')},{'model':db[_0xa426('0x41')],'as':_0xa426('0x42')}]});}return null;})[_0xa426('0x2d')](respondWithResult(_0x17f8f3,null))[_0xa426('0x34')](handleError(_0x17f8f3,null));};function sanitizeRemoteUri(_0xff5b31){var _0x2a7467=_0xff5b31['slice'](-0x1);if(_0x2a7467==='/')return _0xff5b31[_0xa426('0x43')](0x0,_0xff5b31[_0xa426('0x44')](_0x2a7467));return _0xff5b31;}function getWebApiUrl(_0x19b7f3){return util[_0xa426('0x45')](_0xa426('0x46'),_0x19b7f3);}exports[_0xa426('0x47')]=function(_0x51d73f,_0x1ae78d){var _0x313003=_0x51d73f[_0xa426('0x1d')][_0xa426('0x48')];var _0x4ca73f=_0x313003===_0xa426('0x49')?_0xa426('0x4a'):_0xa426('0x4b');var _0x43aa7e='';var _0x24a661='';var _0x14dbc0='';var _0x529efc='';var _0x329979='';var _0x1043ed='';var _0x29ffff='';var _0x4b629f='';var _0x4280c2=[_0xa426('0x4c'),_0xa426('0x4d'),_0xa426('0x4e'),_0xa426('0x4f'),_0xa426('0x50'),_0xa426('0x51'),_0xa426('0x52'),_0xa426('0x53'),_0xa426('0x54'),_0xa426('0x55')];var _0x5f0e46=[_0xa426('0x56'),_0xa426('0x57'),_0xa426('0x58'),_0xa426('0x59'),_0xa426('0x5a'),_0xa426('0x5b'),_0xa426('0x5c'),'contractidname',_0xa426('0x5d'),_0xa426('0x5e'),_0xa426('0x5f'),_0xa426('0x60'),_0xa426('0x61'),_0xa426('0x62'),_0xa426('0x63'),_0xa426('0x64'),_0xa426('0x65'),_0xa426('0x66'),_0xa426('0x67'),_0xa426('0x68'),'entityimage_timestamp',_0xa426('0x69'),_0xa426('0x6a'),'exchangerate',_0xa426('0x6b'),_0xa426('0x6c'),'importsequencenumber','influencescore',_0xa426('0x6d'),_0xa426('0x6e'),_0xa426('0x6f'),_0xa426('0x70'),_0xa426('0x71'),_0xa426('0x72'),'modifiedbyyominame',_0xa426('0x73'),_0xa426('0x74'),_0xa426('0x75'),'msdyn_incidenttypename',_0xa426('0x76'),_0xa426('0x77'),'onholdtime',_0xa426('0x78'),_0xa426('0x79'),'owneridtype',_0xa426('0x7a'),_0xa426('0x7b'),_0xa426('0x7c'),_0xa426('0x7d'),'prioritycodename',_0xa426('0x7e'),'productserialnumber',_0xa426('0x7f'),_0xa426('0x80'),_0xa426('0x81'),'responsiblecontactidname','responsiblecontactidyominame',_0xa426('0x82'),_0xa426('0x83'),'slaname',_0xa426('0x84'),_0xa426('0x85'),_0xa426('0x86'),_0xa426('0x87'),_0xa426('0x88'),_0xa426('0x89'),_0xa426('0x8a'),_0xa426('0x8b'),_0xa426('0x8c'),'versionnumber'];var _0x3e9d42=_0x4280c2[_0xa426('0x8d')](_0x5f0e46);return db[_0xa426('0x19')][_0xa426('0x3b')]({'where':{'id':_0x51d73f['params']['id']},'attributes':['id',_0xa426('0x8e'),'password','remoteUri',_0xa426('0x8f'),_0xa426('0x90'),_0xa426('0x91'),_0xa426('0x92')],'include':[{'model':db[_0xa426('0x93')],'as':_0xa426('0x93'),'attributes':['id','data5','data7']}]})['then'](handleEntityNotFound(_0x1ae78d,null))[_0xa426('0x2d')](function(_0x34ba19){if(_0x34ba19){if(_0x34ba19['modernAuthentication']){_0x34ba19[_0xa426('0x94')]=_0x34ba19[_0xa426('0x93')][_0xa426('0x95')];_0x4b629f=sanitizeRemoteUri(_0x34ba19[_0xa426('0x93')][_0xa426('0x96')]);_0x29ffff=getWebApiUrl(_0x4b629f);return _0x34ba19;}_0x4b629f=sanitizeRemoteUri(_0x34ba19[_0xa426('0x97')]);_0x29ffff=getWebApiUrl(_0x4b629f);var _0x2576d6={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x34ba19[_0xa426('0x8f')]+'/oauth2/token','form':{'client_id':_0x34ba19['clientId'],'resource':_0x4b629f,'username':_0x34ba19[_0xa426('0x8e')],'password':_0x34ba19[_0xa426('0x98')],'grant_type':_0xa426('0x98'),'client_secret':_0x34ba19[_0xa426('0x91')]},'json':!![]};return rp(_0x2576d6);}})[_0xa426('0x2d')](function(_0x3e3904){_0x1043ed=_0x3e3904['access_token'];var _0x29e902={'method':_0xa426('0x99'),'uri':encodeURI(_0x29ffff+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4ca73f+'\x27'),'headers':{'Authorization':_0xa426('0x9a')+_0x1043ed,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x29e902);})[_0xa426('0x2d')](function(_0x32b6ed){var _0x11a8b0=_0x32b6ed['value'][0x0];var _0x2e507e=_0x11a8b0[_0xa426('0x9b')];var _0x33449d={'method':_0xa426('0x99'),'uri':_0x29ffff+'EntityDefinitions('+_0x2e507e+_0xa426('0x9c'),'headers':{'Authorization':_0xa426('0x9a')+_0x1043ed,'If-None-Match':null,'OData-Version':_0xa426('0x9d')},'json':!![]};return rp(_0x33449d);})[_0xa426('0x2d')](function(_0x463e87){_0x43aa7e=_0x463e87;_0x24a661=_0x43aa7e[_0xa426('0x9e')];_0x24a661=_[_0xa426('0x9f')](_0x24a661,function(_0x332253){return!_0x3e9d42[_0xa426('0xa0')](_0x332253[_0xa426('0xa1')]);});var _0x3147a5=[];var _0xd09c50=[];_0x24a661[_0xa426('0xa2')](function(_0x28dfa9){if(_0x28dfa9[_0xa426('0xa3')]){var _0x21d334=_0x28dfa9[_0xa426('0xa3')][_0xa426('0x43')](_0x28dfa9['@odata.type'][_0xa426('0x44')]('.')+0x1);if(_0x21d334===_0xa426('0xa4')){_0x3147a5[_0xa426('0xa5')](getSelectList(_0x29ffff,_0x313003,_0xd09c50,_0x43aa7e[_0xa426('0x9b')],_0x28dfa9[_0xa426('0x9b')],_0x1043ed));}}});return Promise[_0xa426('0xa6')](_0x3147a5);})['then'](function(_0x46727b){_0x14dbc0=_0x46727b[0x0];var _0x535cd1=[];var _0x41309f=[];_0x24a661['forEach'](function(_0x1cb0a7){if(!_[_0xa426('0xa7')](_0x1cb0a7[_0xa426('0xa3')])){var _0x522b32=_0x1cb0a7[_0xa426('0xa3')][_0xa426('0x43')](_0x1cb0a7[_0xa426('0xa3')]['lastIndexOf']('.')+0x1);if(_0x522b32==='BooleanAttributeMetadata'){_0x535cd1[_0xa426('0xa5')](getBooleanList(_0x29ffff,_0x313003,_0x41309f,_0x43aa7e['MetadataId'],_0x1cb0a7['MetadataId'],_0x1043ed));}}});return Promise['all'](_0x535cd1);})['then'](function(_0x5e5ba6){_0x529efc=_0x5e5ba6[0x0];var _0x343e55=[];var _0x5d409d=[];_0x24a661[_0xa426('0xa2')](function(_0x3075e0){if(_0x3075e0[_0xa426('0xa3')]){var _0x4273b2=_0x3075e0['@odata.type'][_0xa426('0x43')](_0x3075e0[_0xa426('0xa3')][_0xa426('0x44')]('.')+0x1);if(_0x4273b2===_0xa426('0xa8')||_0x4273b2===_0xa426('0xa9')||_0x4273b2===_0xa426('0xaa')||_0x4273b2==='IntegerAttributeMetadata'||_0x4273b2===_0xa426('0xab')||_0x4273b2===_0xa426('0xac')||_0x4273b2===_0xa426('0xad')||_0x4273b2===_0xa426('0xae')||_0x4273b2===_0xa426('0xaf')||_0x4273b2===_0xa426('0xb0')){_0x343e55[_0xa426('0xa5')](getInputList(_0x29ffff,_0x313003,_0x4273b2,_0x5d409d,_0x43aa7e[_0xa426('0x9b')],_0x3075e0[_0xa426('0x9b')],_0x1043ed));}}});return Promise['all'](_0x343e55);})[_0xa426('0x2d')](function(_0x3138e4){_0x329979=_0x3138e4[0x0];var _0x503fa9=_0x14dbc0[_0xa426('0x8d')](_0x529efc)[_0xa426('0x8d')](_0x329979);var _0x399c3d={'count':_0x503fa9[_0xa426('0x23')],'rows':_0x503fa9};return _0x399c3d;})[_0xa426('0x2d')](respondWithResult(_0x1ae78d,null))['catch'](function(_0x1240ed){var _0x2edb19=_0x51d73f[_0xa426('0x1d')][_0xa426('0xb1')]?0x1f4:_0x1240ed['statusCode']||0x1f4;logger['error'](_0x1240ed[_0xa426('0x14')]);delete _0x1240ed[_0xa426('0x15')];if(_0x2edb19===0x191){_0x2edb19=0x190;}_0x1ae78d[_0xa426('0xc')](_0x2edb19)[_0xa426('0x16')](_0x51d73f[_0xa426('0x1d')][_0xa426('0xb1')]?{'message':_0xa426('0xb2'),'statusCode':_0x1240ed[_0xa426('0xb3')]}:_0x1240ed);});};function getSelectList(_0x3bcc71,_0x23d002,_0xc5789c,_0x2812b1,_0x4eafa4,_0x2478ef){var _0x1c32d0={'method':_0xa426('0x99'),'uri':_0x3bcc71+_0xa426('0xb4')+_0x2812b1+')/Attributes('+_0x4eafa4+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xa426('0xb5'),'headers':{'Authorization':_0xa426('0x9a')+_0x2478ef,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1c32d0)[_0xa426('0x2d')](function(_0x30eaf2){var _0x40e36a=[];var _0x2a2f56=_0x30eaf2[_0xa426('0xb6')]['Options'];_0x2a2f56[_0xa426('0xa2')](function(_0x536269){_0x40e36a[_0xa426('0xa5')]({'name':_0x536269[_0xa426('0xb7')][_0xa426('0xb8')][_0xa426('0xb7')],'value':String(_0x536269[_0xa426('0xb9')])});});var _0x4fe257={'id':_0x23d002+'_'+_0x30eaf2[_0xa426('0xa1')],'name':_0x30eaf2[_0xa426('0xba')][_0xa426('0xb8')][_0xa426('0xb7')],'custom':![],'options':_0x40e36a};_0xc5789c[_0xa426('0xa5')](_0x4fe257);return _0xc5789c;});}function getBooleanList(_0x3563a9,_0x47a267,_0x32edd9,_0x5de9b5,_0x11915e,_0x50aa1b){var _0x4829b2={'method':'GET','uri':_0x3563a9+_0xa426('0xb4')+_0x5de9b5+')/Attributes('+_0x11915e+_0xa426('0xbb'),'headers':{'Authorization':_0xa426('0x9a')+_0x50aa1b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4829b2)[_0xa426('0x2d')](function(_0xb32818){var _0x26c73c=[];_0x26c73c[_0xa426('0xa5')]({'name':_0xb32818[_0xa426('0xb6')][_0xa426('0xbc')][_0xa426('0xb7')][_0xa426('0xb8')]['Label'],'value':_0xa426('0xbd')},{'name':_0xb32818[_0xa426('0xb6')][_0xa426('0xbe')][_0xa426('0xb7')][_0xa426('0xb8')]['Label'],'value':_0xa426('0xbf')});var _0x5448ae={'id':_0x47a267+'_'+_0xb32818[_0xa426('0xa1')],'name':_0xb32818[_0xa426('0xba')][_0xa426('0xb8')][_0xa426('0xb7')],'custom':![],'options':_0x26c73c};_0x32edd9[_0xa426('0xa5')](_0x5448ae);return _0x32edd9;});}function getInputList(_0x266f7d,_0xf09b24,_0x231538,_0x2f8fc3,_0x5e0922,_0x2d8442,_0x191dd2){var _0x5bb1cf={'method':_0xa426('0x99'),'uri':_0x266f7d+_0xa426('0xb4')+_0x5e0922+_0xa426('0xc0')+_0x2d8442+_0xa426('0xc1')+_0x231538+_0xa426('0xc2'),'headers':{'Authorization':_0xa426('0x9a')+_0x191dd2,'If-None-Match':null,'OData-Version':_0xa426('0x9d')},'json':!![]};return rp(_0x5bb1cf)[_0xa426('0x2d')](function(_0x10905d){var _0x4cafe6={'id':_0xf09b24+'_'+_0x10905d[_0xa426('0xa1')],'name':_0x10905d[_0xa426('0xba')]['UserLocalizedLabel']?_0x10905d['DisplayName']['UserLocalizedLabel'][_0xa426('0xb7')]:_0x10905d[_0xa426('0xa1')],'custom':![],'options':[]};_0x2f8fc3[_0xa426('0xa5')](_0x4cafe6);return _0x2f8fc3;});} \ No newline at end of file +var _0x5e49=['getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','accountidname','actualserviceunits','billedserviceunits','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','overriddencreatedon','owneridname','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','access_token','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','username','password','clientSecret','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','PicklistAttributeMetadata','all','isNil','@odata.type','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','stack','Wrong\x20credentials','GET',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','api','../../components/integrations/configuration','limit','undefined','count','offset','set','Content-Range','json','update','then','status','sendStatus','error','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','destroy'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x5e49,0x152));var _0x95e4=function(_0x558697,_0x41e242){_0x558697=_0x558697-0x0;var _0x4812d6=_0x5e49[_0x558697];return _0x4812d6;};'use strict';var rp=require(_0x95e4('0x0'));var util=require(_0x95e4('0x1'));var _=require(_0x95e4('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x95e4('0x3'));var db=require('../../mysqldb')['db'];var integrations=require(_0x95e4('0x4'));function respondWithResult(_0x8261c3,_0x5a9876){_0x5a9876=_0x5a9876||0xc8;return function(_0x33f4d9){if(_0x33f4d9){return _0x8261c3['status'](_0x5a9876)['json'](_0x33f4d9);}};}function respondWithFilteredResult(_0x515e57,_0x1c5ba0){return function(_0x1591e8){if(_0x1591e8){var _0x2d1074=typeof _0x1c5ba0['offset']==='undefined'&&typeof _0x1c5ba0[_0x95e4('0x5')]===_0x95e4('0x6');var _0x2b6e69=_0x1591e8[_0x95e4('0x7')];var _0xd68f67=_0x2d1074?0x0:_0x1c5ba0['offset'];var _0x25c584=_0x2d1074?_0x1591e8[_0x95e4('0x7')]:_0x1c5ba0[_0x95e4('0x8')]+_0x1c5ba0['limit'];var _0x475cf7;if(_0x25c584>=_0x2b6e69){_0x25c584=_0x2b6e69;_0x475cf7=0xc8;}else{_0x475cf7=0xce;}_0x515e57['status'](_0x475cf7);return _0x515e57[_0x95e4('0x9')](_0x95e4('0xa'),_0xd68f67+'-'+_0x25c584+'/'+_0x2b6e69)[_0x95e4('0xb')](_0x1591e8);}return null;};}function saveUpdates(_0x5cec3e){return function(_0x1c2faa){if(_0x1c2faa){return _0x1c2faa[_0x95e4('0xc')](_0x5cec3e)[_0x95e4('0xd')](function(_0x3eb23a){return _0x3eb23a;});}return null;};}function removeEntity(_0x471429){return function(_0x24d17c){if(_0x24d17c){return _0x24d17c['destroy']()['then'](function(){_0x471429[_0x95e4('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa70bb7){return function(_0x264d7e){if(!_0x264d7e){_0xa70bb7[_0x95e4('0xf')](0x194);}return _0x264d7e;};}function handleError(_0x2e6ec0,_0x5603b6){_0x5603b6=_0x5603b6||0x1f4;return function(_0xa515f0){logger[_0x95e4('0x10')](_0xa515f0['stack']);if(_0xa515f0[_0x95e4('0x11')]){delete _0xa515f0[_0x95e4('0x11')];}_0x2e6ec0[_0x95e4('0xe')](_0x5603b6)[_0x95e4('0x12')](_0xa515f0);};}exports[_0x95e4('0x13')]=function(_0x96f870,_0x5a007b){var _0x2369b3={},_0x5684b6={},_0x351047={'count':0x0,'rows':[]};var _0x1d34ac=_[_0x95e4('0x14')](db[_0x95e4('0x15')][_0x95e4('0x16')],function(_0x4ed47a){return{'name':_0x4ed47a[_0x95e4('0x17')],'type':_0x4ed47a[_0x95e4('0x18')]['key']};});_0x5684b6[_0x95e4('0x19')]=_[_0x95e4('0x14')](_0x1d34ac,'name');_0x5684b6[_0x95e4('0x1a')]=_['keys'](_0x96f870[_0x95e4('0x1a')]);_0x5684b6[_0x95e4('0x1b')]=_[_0x95e4('0x1c')](_0x5684b6[_0x95e4('0x19')],_0x5684b6['query']);_0x2369b3[_0x95e4('0x1d')]=_[_0x95e4('0x1c')](_0x5684b6[_0x95e4('0x19')],qs[_0x95e4('0x1e')](_0x96f870[_0x95e4('0x1a')][_0x95e4('0x1e')]));_0x2369b3[_0x95e4('0x1d')]=_0x2369b3['attributes'][_0x95e4('0x1f')]?_0x2369b3[_0x95e4('0x1d')]:_0x5684b6[_0x95e4('0x19')];if(!_0x96f870[_0x95e4('0x1a')][_0x95e4('0x20')](_0x95e4('0x21'))){_0x2369b3['limit']=qs[_0x95e4('0x5')](_0x96f870[_0x95e4('0x1a')][_0x95e4('0x5')]);_0x2369b3[_0x95e4('0x8')]=qs[_0x95e4('0x8')](_0x96f870[_0x95e4('0x1a')][_0x95e4('0x8')]);}_0x2369b3[_0x95e4('0x22')]=qs[_0x95e4('0x23')](_0x96f870[_0x95e4('0x1a')]['sort']);_0x2369b3[_0x95e4('0x24')]=qs[_0x95e4('0x1b')](_[_0x95e4('0x25')](_0x96f870['query'],_0x5684b6[_0x95e4('0x1b')]),_0x1d34ac);if(_0x96f870[_0x95e4('0x1a')][_0x95e4('0x26')]){_0x2369b3[_0x95e4('0x24')]=_[_0x95e4('0x27')](_0x2369b3[_0x95e4('0x24')],{'$or':_[_0x95e4('0x14')](_0x1d34ac,function(_0x5b6d52){if(_0x5b6d52[_0x95e4('0x18')]!==_0x95e4('0x28')){var _0x9f7f8f={};_0x9f7f8f[_0x5b6d52['name']]={'$like':'%'+_0x96f870[_0x95e4('0x1a')][_0x95e4('0x26')]+'%'};return _0x9f7f8f;}})});}_0x2369b3=_[_0x95e4('0x27')]({},_0x2369b3,_0x96f870[_0x95e4('0x29')]);var _0x3d2cfc={'where':_0x2369b3[_0x95e4('0x24')]};return db[_0x95e4('0x15')]['count'](_0x3d2cfc)[_0x95e4('0xd')](function(_0x3616fd){_0x351047[_0x95e4('0x7')]=_0x3616fd;if(_0x96f870[_0x95e4('0x1a')][_0x95e4('0x2a')]){_0x2369b3['include']=[{'all':!![]}];}return db[_0x95e4('0x15')][_0x95e4('0x2b')](_0x2369b3);})[_0x95e4('0xd')](function(_0x4eba93){_0x351047[_0x95e4('0x2c')]=_0x4eba93;return _0x351047;})[_0x95e4('0xd')](respondWithFilteredResult(_0x5a007b,_0x2369b3))['catch'](handleError(_0x5a007b,null));};exports[_0x95e4('0x2d')]=function(_0x5dc6fd,_0x56013a){var _0x474b62={'raw':![],'where':{'id':_0x5dc6fd[_0x95e4('0x2e')]['id']}},_0x2c0cf1={};_0x2c0cf1['model']=_[_0x95e4('0x2f')](db[_0x95e4('0x15')][_0x95e4('0x16')]);_0x2c0cf1[_0x95e4('0x1a')]=_[_0x95e4('0x2f')](_0x5dc6fd[_0x95e4('0x1a')]);_0x2c0cf1[_0x95e4('0x1b')]=_['intersection'](_0x2c0cf1[_0x95e4('0x19')],_0x2c0cf1['query']);_0x474b62['attributes']=_['intersection'](_0x2c0cf1[_0x95e4('0x19')],qs['fields'](_0x5dc6fd['query'][_0x95e4('0x1e')]));_0x474b62[_0x95e4('0x1d')]=_0x474b62['attributes']['length']?_0x474b62[_0x95e4('0x1d')]:_0x2c0cf1[_0x95e4('0x19')];if(_0x5dc6fd[_0x95e4('0x1a')][_0x95e4('0x2a')]){_0x474b62[_0x95e4('0x30')]=[{'all':!![]}];}_0x474b62=_['merge']({},_0x474b62,_0x5dc6fd[_0x95e4('0x29')]);return db[_0x95e4('0x15')][_0x95e4('0x31')](_0x474b62)[_0x95e4('0xd')](handleEntityNotFound(_0x56013a,null))[_0x95e4('0xd')](respondWithResult(_0x56013a,null))[_0x95e4('0x32')](handleError(_0x56013a,null));};exports[_0x95e4('0x33')]=function(_0x5d7004,_0x441e57){return db['Dynamics365Account'][_0x95e4('0x33')](_0x5d7004[_0x95e4('0x34')],{})['then'](respondWithResult(_0x441e57,0xc9))[_0x95e4('0x32')](handleError(_0x441e57,null));};exports[_0x95e4('0xc')]=function(_0x3ab107,_0x2fc136){if(_0x3ab107[_0x95e4('0x34')]['id']){delete _0x3ab107[_0x95e4('0x34')]['id'];}return db[_0x95e4('0x15')][_0x95e4('0x31')]({'where':{'id':_0x3ab107['params']['id']}})[_0x95e4('0xd')](handleEntityNotFound(_0x2fc136,null))[_0x95e4('0xd')](saveUpdates(_0x3ab107[_0x95e4('0x34')],null))[_0x95e4('0xd')](respondWithResult(_0x2fc136,null))['catch'](handleError(_0x2fc136,null));};exports[_0x95e4('0x35')]=function(_0x1722b6,_0x3eaed4){return db[_0x95e4('0x15')][_0x95e4('0x31')]({'where':{'id':_0x1722b6['params']['id']}})[_0x95e4('0xd')](handleEntityNotFound(_0x3eaed4,null))[_0x95e4('0xd')](removeEntity(_0x3eaed4,null))['catch'](handleError(_0x3eaed4,null));};exports[_0x95e4('0x36')]=function(_0x10c43b,_0x23134a){var _0x49f306={};var _0x56014c={};var _0x110b5c;var _0x4fdd95;return db['Dynamics365Account'][_0x95e4('0x37')]({'where':{'id':_0x10c43b['params']['id']}})[_0x95e4('0xd')](handleEntityNotFound(_0x23134a,null))['then'](function(_0x572758){if(_0x572758){_0x110b5c=_0x572758;_0x56014c[_0x95e4('0x19')]=_[_0x95e4('0x2f')](db[_0x95e4('0x38')]['rawAttributes']);_0x56014c['query']=_[_0x95e4('0x2f')](_0x10c43b[_0x95e4('0x1a')]);_0x56014c[_0x95e4('0x1b')]=_[_0x95e4('0x1c')](_0x56014c[_0x95e4('0x19')],_0x56014c['query']);_0x49f306[_0x95e4('0x1d')]=_[_0x95e4('0x1c')](_0x56014c[_0x95e4('0x19')],qs['fields'](_0x10c43b[_0x95e4('0x1a')][_0x95e4('0x1e')]));_0x49f306[_0x95e4('0x1d')]=_0x49f306[_0x95e4('0x1d')][_0x95e4('0x1f')]?_0x49f306[_0x95e4('0x1d')]:_0x56014c['model'];_0x49f306[_0x95e4('0x22')]=qs['sort'](_0x10c43b[_0x95e4('0x1a')]['sort']);_0x49f306[_0x95e4('0x24')]=qs['filters'](_[_0x95e4('0x25')](_0x10c43b[_0x95e4('0x1a')],_0x56014c[_0x95e4('0x1b')]));if(_0x10c43b['query'][_0x95e4('0x26')]){_0x49f306[_0x95e4('0x24')]=_['merge'](_0x49f306[_0x95e4('0x24')],{'$or':_['map'](_0x49f306[_0x95e4('0x1d')],function(_0x3b02a7){var _0x20a0fc={};_0x20a0fc[_0x3b02a7]={'$like':'%'+_0x10c43b[_0x95e4('0x1a')][_0x95e4('0x26')]+'%'};return _0x20a0fc;})});}_0x49f306=_['merge']({},_0x49f306,_0x10c43b[_0x95e4('0x29')]);return _0x110b5c[_0x95e4('0x36')](_0x49f306);}})[_0x95e4('0xd')](function(_0x275559){if(_0x275559){_0x4fdd95=_0x275559[_0x95e4('0x1f')];if(!_0x10c43b['query'][_0x95e4('0x20')]('nolimit')){_0x49f306['limit']=qs[_0x95e4('0x5')](_0x10c43b[_0x95e4('0x1a')][_0x95e4('0x5')]);_0x49f306[_0x95e4('0x8')]=qs[_0x95e4('0x8')](_0x10c43b[_0x95e4('0x1a')][_0x95e4('0x8')]);}return _0x110b5c['getConfigurations'](_0x49f306);}})[_0x95e4('0xd')](function(_0x5162ae){if(_0x5162ae){return _0x5162ae?{'count':_0x4fdd95,'rows':_0x5162ae}:null;}})[_0x95e4('0xd')](respondWithResult(_0x23134a,null))['catch'](handleError(_0x23134a,null));};exports[_0x95e4('0x39')]=function(_0x135eb6,_0xc01daf){if(_0x135eb6[_0x95e4('0x34')]['id']){delete _0x135eb6[_0x95e4('0x34')]['id'];}return db[_0x95e4('0x15')]['findOne']({'where':{'id':_0x135eb6[_0x95e4('0x2e')]['id']}})[_0x95e4('0xd')](handleEntityNotFound(_0xc01daf,null))['then'](function(_0x368e66){if(_0x368e66){_0x135eb6['body'][_0x95e4('0x3a')]=_0x368e66['id'];_0x135eb6[_0x95e4('0x34')][_0x95e4('0x3b')]=integrations[_0x95e4('0x3c')](_0x135eb6[_0x95e4('0x34')][_0x95e4('0x3d')],_0x135eb6[_0x95e4('0x34')]['type']);_0x135eb6[_0x95e4('0x34')][_0x95e4('0x3e')]=integrations[_0x95e4('0x3f')](_0x135eb6[_0x95e4('0x34')]['channel'],_0x135eb6['body'][_0x95e4('0x18')]);return db[_0x95e4('0x38')]['create'](_0x135eb6['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x95e4('0x3b')},{'model':db[_0x95e4('0x40')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xc01daf,null))[_0x95e4('0x32')](handleError(_0xc01daf,null));};function sanitizeRemoteUri(_0x3ef24b){var _0x10d200=_0x3ef24b[_0x95e4('0x41')](-0x1);if(_0x10d200==='/')return _0x3ef24b[_0x95e4('0x42')](0x0,_0x3ef24b[_0x95e4('0x43')](_0x10d200));return _0x3ef24b;}function getWebApiUrl(_0x4c980f){return util[_0x95e4('0x44')](_0x95e4('0x45'),_0x4c980f);}exports[_0x95e4('0x46')]=function(_0x1242c8,_0x5395a5){var _0x5c1d9a=_0x1242c8[_0x95e4('0x1a')][_0x95e4('0x47')];var _0x142f09=_0x5c1d9a===_0x95e4('0x48')?_0x95e4('0x49'):_0x95e4('0x4a');var _0x47b4d6='';var _0x25a8a6='';var _0xc21621='';var _0x39f405='';var _0x364a2c='';var _0x4dec53='';var _0x11051f='';var _0x3ee44c='';var _0x2b6f83=[_0x95e4('0x4b'),_0x95e4('0x4c'),_0x95e4('0x4d'),_0x95e4('0x4e'),'caseorigincode',_0x95e4('0x4f'),_0x95e4('0x50'),_0x95e4('0x51'),_0x95e4('0x52'),'phonecall_activity_parties'];var _0x4fab46=[_0x95e4('0x53'),'accountidyominame',_0x95e4('0x54'),_0x95e4('0x55'),'contactidname','contactidyominame',_0x95e4('0x56'),_0x95e4('0x57'),_0x95e4('0x58'),_0x95e4('0x59'),_0x95e4('0x5a'),_0x95e4('0x5b'),_0x95e4('0x5c'),_0x95e4('0x5d'),_0x95e4('0x5e'),_0x95e4('0x5f'),'customeridtype','customeridyominame',_0x95e4('0x60'),_0x95e4('0x61'),_0x95e4('0x62'),_0x95e4('0x63'),_0x95e4('0x64'),'exchangerate',_0x95e4('0x65'),_0x95e4('0x66'),_0x95e4('0x67'),_0x95e4('0x68'),'kbarticleidname',_0x95e4('0x69'),_0x95e4('0x6a'),_0x95e4('0x6b'),_0x95e4('0x6c'),_0x95e4('0x6d'),_0x95e4('0x6e'),_0x95e4('0x6f'),_0x95e4('0x70'),_0x95e4('0x71'),_0x95e4('0x72'),'msdyn_iotalertname',_0x95e4('0x73'),'onholdtime',_0x95e4('0x74'),_0x95e4('0x75'),'owneridtype',_0x95e4('0x76'),'parentcaseidname',_0x95e4('0x77'),_0x95e4('0x78'),_0x95e4('0x79'),_0x95e4('0x7a'),_0x95e4('0x7b'),_0x95e4('0x7c'),'resolvebykpiidname',_0x95e4('0x7d'),_0x95e4('0x7e'),_0x95e4('0x7f'),_0x95e4('0x80'),_0x95e4('0x81'),_0x95e4('0x82'),_0x95e4('0x83'),_0x95e4('0x84'),'statuscode',_0x95e4('0x85'),_0x95e4('0x86'),_0x95e4('0x87'),_0x95e4('0x88'),'traversedpath',_0x95e4('0x89'),'versionnumber'];var _0x54166e=_0x2b6f83['concat'](_0x4fab46);return db[_0x95e4('0x15')][_0x95e4('0x37')]({'where':{'id':_0x1242c8[_0x95e4('0x2e')]['id']},'attributes':['id','username','password',_0x95e4('0x8a'),_0x95e4('0x8b'),_0x95e4('0x8c'),'clientSecret',_0x95e4('0x8d')],'include':[{'model':db[_0x95e4('0x8e')],'as':_0x95e4('0x8e'),'attributes':['id','data5','data7']}]})[_0x95e4('0xd')](handleEntityNotFound(_0x5395a5,null))['then'](function(_0x552925){if(_0x552925){if(_0x552925[_0x95e4('0x8d')]){_0x552925[_0x95e4('0x8f')]=_0x552925[_0x95e4('0x8e')][_0x95e4('0x90')];_0x3ee44c=sanitizeRemoteUri(_0x552925[_0x95e4('0x8e')][_0x95e4('0x91')]);_0x11051f=getWebApiUrl(_0x3ee44c);return _0x552925;}_0x3ee44c=sanitizeRemoteUri(_0x552925[_0x95e4('0x8a')]);_0x11051f=getWebApiUrl(_0x3ee44c);var _0xa426a3={'method':_0x95e4('0x92'),'uri':_0x95e4('0x93')+_0x552925[_0x95e4('0x8b')]+_0x95e4('0x94'),'form':{'client_id':_0x552925[_0x95e4('0x8c')],'resource':_0x3ee44c,'username':_0x552925[_0x95e4('0x95')],'password':_0x552925[_0x95e4('0x96')],'grant_type':_0x95e4('0x96'),'client_secret':_0x552925[_0x95e4('0x97')]},'json':!![]};return rp(_0xa426a3);}})[_0x95e4('0xd')](function(_0x4a8b7f){_0x4dec53=_0x4a8b7f[_0x95e4('0x8f')];var _0x28544c={'method':'GET','uri':encodeURI(_0x11051f+_0x95e4('0x98')+_0x142f09+'\x27'),'headers':{'Authorization':_0x95e4('0x99')+_0x4dec53,'If-None-Match':null,'OData-Version':_0x95e4('0x9a')},'json':!![]};return rp(_0x28544c);})['then'](function(_0x298d09){var _0x180ccb=_0x298d09[_0x95e4('0x9b')][0x0];var _0x5263e6=_0x180ccb[_0x95e4('0x9c')];var _0x5ec299={'method':'GET','uri':_0x11051f+_0x95e4('0x9d')+_0x5263e6+_0x95e4('0x9e'),'headers':{'Authorization':_0x95e4('0x99')+_0x4dec53,'If-None-Match':null,'OData-Version':_0x95e4('0x9a')},'json':!![]};return rp(_0x5ec299);})[_0x95e4('0xd')](function(_0xd2ecf1){_0x47b4d6=_0xd2ecf1;_0x25a8a6=_0x47b4d6[_0x95e4('0x9f')];_0x25a8a6=_[_0x95e4('0xa0')](_0x25a8a6,function(_0xb3808c){return!_0x54166e[_0x95e4('0xa1')](_0xb3808c[_0x95e4('0xa2')]);});var _0x42aeda=[];var _0x51e7eb=[];_0x25a8a6[_0x95e4('0xa3')](function(_0x1055f6){if(_0x1055f6['@odata.type']){var _0x4a9634=_0x1055f6['@odata.type'][_0x95e4('0x42')](_0x1055f6['@odata.type'][_0x95e4('0x43')]('.')+0x1);if(_0x4a9634===_0x95e4('0xa4')){_0x42aeda['push'](getSelectList(_0x11051f,_0x5c1d9a,_0x51e7eb,_0x47b4d6[_0x95e4('0x9c')],_0x1055f6[_0x95e4('0x9c')],_0x4dec53));}}});return Promise[_0x95e4('0xa5')](_0x42aeda);})[_0x95e4('0xd')](function(_0x59fbcb){_0xc21621=_0x59fbcb[0x0];var _0x1df0b3=[];var _0x2f1581=[];_0x25a8a6[_0x95e4('0xa3')](function(_0x4ba759){if(!_[_0x95e4('0xa6')](_0x4ba759[_0x95e4('0xa7')])){var _0x4079e5=_0x4ba759[_0x95e4('0xa7')][_0x95e4('0x42')](_0x4ba759['@odata.type'][_0x95e4('0x43')]('.')+0x1);if(_0x4079e5==='BooleanAttributeMetadata'){_0x1df0b3[_0x95e4('0xa8')](getBooleanList(_0x11051f,_0x5c1d9a,_0x2f1581,_0x47b4d6[_0x95e4('0x9c')],_0x4ba759[_0x95e4('0x9c')],_0x4dec53));}}});return Promise['all'](_0x1df0b3);})[_0x95e4('0xd')](function(_0x3a22fb){_0x39f405=_0x3a22fb[0x0];var _0x511471=[];var _0x35b428=[];_0x25a8a6['forEach'](function(_0x72e4c7){if(_0x72e4c7[_0x95e4('0xa7')]){var _0x734e9f=_0x72e4c7[_0x95e4('0xa7')]['substring'](_0x72e4c7[_0x95e4('0xa7')]['lastIndexOf']('.')+0x1);if(_0x734e9f===_0x95e4('0xa9')||_0x734e9f===_0x95e4('0xaa')||_0x734e9f===_0x95e4('0xab')||_0x734e9f===_0x95e4('0xac')||_0x734e9f===_0x95e4('0xad')||_0x734e9f==='DateTimeAttributeMetadata'||_0x734e9f===_0x95e4('0xae')||_0x734e9f==='EntityNameAttributeMetadata'||_0x734e9f===_0x95e4('0xaf')||_0x734e9f===_0x95e4('0xb0')){_0x511471['push'](getInputList(_0x11051f,_0x5c1d9a,_0x734e9f,_0x35b428,_0x47b4d6[_0x95e4('0x9c')],_0x72e4c7['MetadataId'],_0x4dec53));}}});return Promise[_0x95e4('0xa5')](_0x511471);})['then'](function(_0x130197){_0x364a2c=_0x130197[0x0];var _0x3871c5=_0xc21621['concat'](_0x39f405)[_0x95e4('0xb1')](_0x364a2c);var _0x11a482={'count':_0x3871c5[_0x95e4('0x1f')],'rows':_0x3871c5};return _0x11a482;})[_0x95e4('0xd')](respondWithResult(_0x5395a5,null))[_0x95e4('0x32')](function(_0x25520a){var _0x4bdb40=_0x1242c8[_0x95e4('0x1a')][_0x95e4('0xb2')]?0x1f4:_0x25520a[_0x95e4('0xb3')]||0x1f4;logger[_0x95e4('0x10')](_0x25520a[_0x95e4('0xb4')]);delete _0x25520a[_0x95e4('0x11')];if(_0x4bdb40===0x191){_0x4bdb40=0x190;}_0x5395a5[_0x95e4('0xe')](_0x4bdb40)[_0x95e4('0x12')](_0x1242c8['query'][_0x95e4('0xb2')]?{'message':_0x95e4('0xb5'),'statusCode':_0x25520a[_0x95e4('0xb3')]}:_0x25520a);});};function getSelectList(_0x54726d,_0x1f9c6d,_0x1492fb,_0x41c7ad,_0x16df25,_0xd51d2){var _0x2ad13b={'method':_0x95e4('0xb6'),'uri':_0x54726d+_0x95e4('0x9d')+_0x41c7ad+_0x95e4('0xb7')+_0x16df25+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x95e4('0xb8'),'headers':{'Authorization':_0x95e4('0x99')+_0xd51d2,'If-None-Match':null,'OData-Version':_0x95e4('0x9a')},'json':!![]};return rp(_0x2ad13b)['then'](function(_0x5f3d8c){var _0x2fa21f=[];var _0x4c4633=_0x5f3d8c[_0x95e4('0xb9')][_0x95e4('0xba')];_0x4c4633[_0x95e4('0xa3')](function(_0x2527ef){_0x2fa21f[_0x95e4('0xa8')]({'name':_0x2527ef[_0x95e4('0xbb')][_0x95e4('0xbc')][_0x95e4('0xbb')],'value':String(_0x2527ef[_0x95e4('0xbd')])});});var _0x59a405={'id':_0x1f9c6d+'_'+_0x5f3d8c[_0x95e4('0xa2')],'name':_0x5f3d8c[_0x95e4('0xbe')]['UserLocalizedLabel'][_0x95e4('0xbb')],'custom':![],'options':_0x2fa21f};_0x1492fb[_0x95e4('0xa8')](_0x59a405);return _0x1492fb;});}function getBooleanList(_0x2c13fc,_0x384faa,_0x251950,_0x3784ab,_0x5b08ce,_0x414af7){var _0x45f5af={'method':_0x95e4('0xb6'),'uri':_0x2c13fc+_0x95e4('0x9d')+_0x3784ab+_0x95e4('0xb7')+_0x5b08ce+_0x95e4('0xbf'),'headers':{'Authorization':'Bearer\x20'+_0x414af7,'If-None-Match':null,'OData-Version':_0x95e4('0x9a')},'json':!![]};return rp(_0x45f5af)[_0x95e4('0xd')](function(_0x130697){var _0x47c4ef=[];_0x47c4ef[_0x95e4('0xa8')]({'name':_0x130697['OptionSet'][_0x95e4('0xc0')][_0x95e4('0xbb')]['UserLocalizedLabel'][_0x95e4('0xbb')],'value':_0x95e4('0xc1')},{'name':_0x130697[_0x95e4('0xb9')][_0x95e4('0xc2')]['Label'][_0x95e4('0xbc')][_0x95e4('0xbb')],'value':'false'});var _0x1e54b5={'id':_0x384faa+'_'+_0x130697[_0x95e4('0xa2')],'name':_0x130697[_0x95e4('0xbe')][_0x95e4('0xbc')][_0x95e4('0xbb')],'custom':![],'options':_0x47c4ef};_0x251950['push'](_0x1e54b5);return _0x251950;});}function getInputList(_0x4a84b1,_0x1ac8d3,_0x302d92,_0x53fbd4,_0x2876c7,_0x188a6c,_0x1d85f9){var _0x22a52f={'method':'GET','uri':_0x4a84b1+'EntityDefinitions('+_0x2876c7+_0x95e4('0xb7')+_0x188a6c+_0x95e4('0xc3')+_0x302d92+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x95e4('0x99')+_0x1d85f9,'If-None-Match':null,'OData-Version':_0x95e4('0x9a')},'json':!![]};return rp(_0x22a52f)[_0x95e4('0xd')](function(_0x1d8595){var _0x50800a={'id':_0x1ac8d3+'_'+_0x1d8595['LogicalName'],'name':_0x1d8595[_0x95e4('0xbe')][_0x95e4('0xbc')]?_0x1d8595['DisplayName']['UserLocalizedLabel'][_0x95e4('0xbb')]:_0x1d8595[_0x95e4('0xa2')],'custom':![],'options':[]};_0x53fbd4[_0x95e4('0xa8')](_0x50800a);return _0x53fbd4;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 6d46612..fcfa1f3 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x158be3,_0x3ab1bc){var _0x5027f2=function(_0x5d4b80){while(--_0x5d4b80){_0x158be3['push'](_0x158be3['shift']());}};_0x5027f2(++_0x3ab1bc);}(_0xe706,0xa3));var _0x6e70=function(_0x5e48f8,_0x54ea70){_0x5e48f8=_0x5e48f8-0x0;var _0x15f1da=_0xe706[_0x5e48f8];return _0x15f1da;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x30a366,_0x37a524){var _0x1d01dc=function(_0x475c9b){while(--_0x475c9b){_0x30a366['push'](_0x30a366['shift']());}};_0x1d01dc(++_0x37a524);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index e5c4b3f..9326b9a 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 _0xc015=['message','Dynamics365Account,\x20%s,\x20%s','result','catch','Dynamics365Account','findAll','options','where','attributes','include','map','model','GetDynamics365Account','ShowDynamics365Account','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0xc015,0xa8));var _0x5c01=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0xc015[_0x2fdf82];return _0x2382f5;};'use strict';var _=require(_0x5c01('0x0'));var util=require(_0x5c01('0x1'));var moment=require(_0x5c01('0x2'));var BPromise=require(_0x5c01('0x3'));var rs=require(_0x5c01('0x4'));var fs=require('fs');var Redis=require(_0x5c01('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c01('0x6'));var logger=require(_0x5c01('0x7'))(_0x5c01('0x8'));var config=require(_0x5c01('0x9'));var jayson=require(_0x5c01('0xa'));var client=jayson[_0x5c01('0xb')][_0x5c01('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56c44b,_0x5e6d6a,_0x59513c){return new BPromise(function(_0x1d86da,_0x283fdf){return client[_0x5c01('0xd')](_0x56c44b,_0x59513c)[_0x5c01('0xe')](function(_0xba5c75){logger[_0x5c01('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x5e6d6a,_0x5c01('0x10'));logger[_0x5c01('0x11')](_0x5c01('0x12'),_0x5e6d6a,'request\x20sent',JSON[_0x5c01('0x13')](_0xba5c75));if(_0xba5c75[_0x5c01('0x14')]){if(_0xba5c75['error'][_0x5c01('0x15')]===0x1f4){logger[_0x5c01('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x5e6d6a,_0xba5c75[_0x5c01('0x14')][_0x5c01('0x16')]);return _0x283fdf(_0xba5c75[_0x5c01('0x14')][_0x5c01('0x16')]);}logger[_0x5c01('0x14')](_0x5c01('0x17'),_0x5e6d6a,_0xba5c75[_0x5c01('0x14')][_0x5c01('0x16')]);return _0x1d86da(_0xba5c75[_0x5c01('0x14')]['message']);}else{logger['info'](_0x5c01('0x17'),_0x5e6d6a,_0x5c01('0x10'));_0x1d86da(_0xba5c75[_0x5c01('0x18')][_0x5c01('0x16')]);}})[_0x5c01('0x19')](function(_0x16c075){logger['error'](_0x5c01('0x17'),_0x5e6d6a,_0x16c075);_0x283fdf(_0x16c075);});});}exports['GetDynamics365Account']=function(_0x2abe81){var _0x40f189=this;return new Promise(function(_0x35dc12,_0x1afc98){return db[_0x5c01('0x1a')][_0x5c01('0x1b')]({'raw':_0x2abe81[_0x5c01('0x1c')]?_0x2abe81[_0x5c01('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2abe81['options']?_0x2abe81[_0x5c01('0x1c')][_0x5c01('0x1d')]||null:null,'attributes':_0x2abe81[_0x5c01('0x1c')]?_0x2abe81[_0x5c01('0x1c')][_0x5c01('0x1e')]||null:null,'limit':_0x2abe81[_0x5c01('0x1c')]?_0x2abe81['options']['limit']||null:null,'include':_0x2abe81[_0x5c01('0x1c')]?_0x2abe81[_0x5c01('0x1c')][_0x5c01('0x1f')]?_['map'](_0x2abe81[_0x5c01('0x1c')][_0x5c01('0x1f')],function(_0x97f853){return{'model':db[_0x97f853['model']],'as':_0x97f853['as'],'attributes':_0x97f853['attributes'],'include':_0x97f853[_0x5c01('0x1f')]?_[_0x5c01('0x20')](_0x97f853[_0x5c01('0x1f')],function(_0x78c564){return{'model':db[_0x78c564[_0x5c01('0x21')]],'as':_0x78c564['as'],'attributes':_0x78c564[_0x5c01('0x1e')],'include':_0x78c564[_0x5c01('0x1f')]?_[_0x5c01('0x20')](_0x78c564['include'],function(_0x39f071){return{'model':db[_0x39f071[_0x5c01('0x21')]],'as':_0x39f071['as'],'attributes':_0x39f071[_0x5c01('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5c01('0xe')](function(_0x5d7783){logger['info'](_0x5c01('0x22'),_0x2abe81);logger[_0x5c01('0x11')](_0x5c01('0x22'),_0x2abe81,JSON[_0x5c01('0x13')](_0x5d7783));_0x35dc12(_0x5d7783);})['catch'](function(_0x4d6bc3){logger[_0x5c01('0x14')]('GetDynamics365Account',_0x4d6bc3[_0x5c01('0x16')],_0x2abe81);_0x1afc98(_0x40f189[_0x5c01('0x14')](0x1f4,_0x4d6bc3[_0x5c01('0x16')]));});});};exports[_0x5c01('0x23')]=function(_0x583840){var _0x37048c=this;return new Promise(function(_0x35fe99,_0x3b30ac){return db[_0x5c01('0x1a')][_0x5c01('0x24')]({'raw':_0x583840[_0x5c01('0x1c')]?_0x583840['options'][_0x5c01('0x25')]===undefined?!![]:![]:!![],'where':_0x583840[_0x5c01('0x1c')]?_0x583840[_0x5c01('0x1c')][_0x5c01('0x1d')]||null:null,'attributes':_0x583840[_0x5c01('0x1c')]?_0x583840[_0x5c01('0x1c')][_0x5c01('0x1e')]||null:null,'include':_0x583840[_0x5c01('0x1c')]?_0x583840['options'][_0x5c01('0x1f')]?_[_0x5c01('0x20')](_0x583840[_0x5c01('0x1c')][_0x5c01('0x1f')],function(_0x3ab1d8){return{'model':db[_0x3ab1d8[_0x5c01('0x21')]],'as':_0x3ab1d8['as'],'attributes':_0x3ab1d8[_0x5c01('0x1e')],'include':_0x3ab1d8[_0x5c01('0x1f')]?_[_0x5c01('0x20')](_0x3ab1d8['include'],function(_0x4f1dc5){return{'model':db[_0x4f1dc5[_0x5c01('0x21')]],'as':_0x4f1dc5['as'],'attributes':_0x4f1dc5['attributes'],'include':_0x4f1dc5['include']?_[_0x5c01('0x20')](_0x4f1dc5[_0x5c01('0x1f')],function(_0x51b045){return{'model':db[_0x51b045[_0x5c01('0x21')]],'as':_0x51b045['as'],'attributes':_0x51b045[_0x5c01('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x85821d){logger[_0x5c01('0xf')](_0x5c01('0x23'),_0x583840);logger[_0x5c01('0x11')](_0x5c01('0x23'),_0x583840,JSON[_0x5c01('0x13')](_0x85821d));_0x35fe99(_0x85821d);})[_0x5c01('0x19')](function(_0x62fbde){logger['error'](_0x5c01('0x23'),_0x62fbde[_0x5c01('0x16')],_0x583840);_0x3b30ac(_0x37048c[_0x5c01('0x14')](0x1f4,_0x62fbde[_0x5c01('0x16')]));});});}; \ No newline at end of file +var _0xc388=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','attributes','map','model','include','ShowDynamics365Account','lodash','util','moment','bluebird'];(function(_0x5f42f1,_0x956be5){var _0x5534ee=function(_0x532333){while(--_0x532333){_0x5f42f1['push'](_0x5f42f1['shift']());}};_0x5534ee(++_0x956be5);}(_0xc388,0x1ca));var _0x8c38=function(_0x2b90cc,_0x175a02){_0x2b90cc=_0x2b90cc-0x0;var _0x135a1e=_0xc388[_0x2b90cc];return _0x135a1e;};'use strict';var _=require(_0x8c38('0x0'));var util=require(_0x8c38('0x1'));var moment=require(_0x8c38('0x2'));var BPromise=require(_0x8c38('0x3'));var rs=require(_0x8c38('0x4'));var fs=require('fs');var Redis=require(_0x8c38('0x5'));var db=require(_0x8c38('0x6'))['db'];var utils=require(_0x8c38('0x7'));var logger=require(_0x8c38('0x8'))(_0x8c38('0x9'));var config=require(_0x8c38('0xa'));var jayson=require(_0x8c38('0xb'));var client=jayson[_0x8c38('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x326375,_0x3ea48c,_0x53a40e){return new BPromise(function(_0x177235,_0x1aee3f){return client[_0x8c38('0xd')](_0x326375,_0x53a40e)['then'](function(_0x1f99d6){logger['info'](_0x8c38('0xe'),_0x3ea48c,_0x8c38('0xf'));logger[_0x8c38('0x10')](_0x8c38('0x11'),_0x3ea48c,_0x8c38('0xf'),JSON[_0x8c38('0x12')](_0x1f99d6));if(_0x1f99d6[_0x8c38('0x13')]){if(_0x1f99d6[_0x8c38('0x13')]['code']===0x1f4){logger['error'](_0x8c38('0xe'),_0x3ea48c,_0x1f99d6[_0x8c38('0x13')][_0x8c38('0x14')]);return _0x1aee3f(_0x1f99d6[_0x8c38('0x13')]['message']);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x3ea48c,_0x1f99d6[_0x8c38('0x13')][_0x8c38('0x14')]);return _0x177235(_0x1f99d6[_0x8c38('0x13')][_0x8c38('0x14')]);}else{logger[_0x8c38('0x15')](_0x8c38('0xe'),_0x3ea48c,'request\x20sent');_0x177235(_0x1f99d6[_0x8c38('0x16')]['message']);}})[_0x8c38('0x17')](function(_0x3d7264){logger[_0x8c38('0x13')](_0x8c38('0xe'),_0x3ea48c,_0x3d7264);_0x1aee3f(_0x3d7264);});});}exports[_0x8c38('0x18')]=function(_0x5e7922){var _0x1bf713=this;return new Promise(function(_0x483697,_0x2354ee){return db[_0x8c38('0x19')]['findAll']({'raw':_0x5e7922[_0x8c38('0x1a')]?_0x5e7922[_0x8c38('0x1a')][_0x8c38('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e7922[_0x8c38('0x1a')]?_0x5e7922['options']['where']||null:null,'attributes':_0x5e7922[_0x8c38('0x1a')]?_0x5e7922[_0x8c38('0x1a')][_0x8c38('0x1c')]||null:null,'limit':_0x5e7922[_0x8c38('0x1a')]?_0x5e7922[_0x8c38('0x1a')]['limit']||null:null,'include':_0x5e7922[_0x8c38('0x1a')]?_0x5e7922[_0x8c38('0x1a')]['include']?_[_0x8c38('0x1d')](_0x5e7922[_0x8c38('0x1a')]['include'],function(_0x1e01bb){return{'model':db[_0x1e01bb[_0x8c38('0x1e')]],'as':_0x1e01bb['as'],'attributes':_0x1e01bb[_0x8c38('0x1c')],'include':_0x1e01bb[_0x8c38('0x1f')]?_[_0x8c38('0x1d')](_0x1e01bb[_0x8c38('0x1f')],function(_0x51ac2b){return{'model':db[_0x51ac2b[_0x8c38('0x1e')]],'as':_0x51ac2b['as'],'attributes':_0x51ac2b[_0x8c38('0x1c')],'include':_0x51ac2b[_0x8c38('0x1f')]?_[_0x8c38('0x1d')](_0x51ac2b[_0x8c38('0x1f')],function(_0x5e1b45){return{'model':db[_0x5e1b45[_0x8c38('0x1e')]],'as':_0x5e1b45['as'],'attributes':_0x5e1b45[_0x8c38('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c09d6){logger['info'](_0x8c38('0x18'),_0x5e7922);logger['debug'](_0x8c38('0x18'),_0x5e7922,JSON[_0x8c38('0x12')](_0x3c09d6));_0x483697(_0x3c09d6);})['catch'](function(_0x498aa3){logger[_0x8c38('0x13')](_0x8c38('0x18'),_0x498aa3[_0x8c38('0x14')],_0x5e7922);_0x2354ee(_0x1bf713[_0x8c38('0x13')](0x1f4,_0x498aa3[_0x8c38('0x14')]));});});};exports[_0x8c38('0x20')]=function(_0x2cfc51){var _0xa8490b=this;return new Promise(function(_0x2c8bd6,_0x2676b9){return db['Dynamics365Account']['find']({'raw':_0x2cfc51['options']?_0x2cfc51[_0x8c38('0x1a')][_0x8c38('0x1b')]===undefined?!![]:![]:!![],'where':_0x2cfc51[_0x8c38('0x1a')]?_0x2cfc51['options']['where']||null:null,'attributes':_0x2cfc51[_0x8c38('0x1a')]?_0x2cfc51['options'][_0x8c38('0x1c')]||null:null,'include':_0x2cfc51[_0x8c38('0x1a')]?_0x2cfc51[_0x8c38('0x1a')][_0x8c38('0x1f')]?_[_0x8c38('0x1d')](_0x2cfc51[_0x8c38('0x1a')][_0x8c38('0x1f')],function(_0x100ce5){return{'model':db[_0x100ce5['model']],'as':_0x100ce5['as'],'attributes':_0x100ce5[_0x8c38('0x1c')],'include':_0x100ce5[_0x8c38('0x1f')]?_[_0x8c38('0x1d')](_0x100ce5['include'],function(_0x4e2a6f){return{'model':db[_0x4e2a6f[_0x8c38('0x1e')]],'as':_0x4e2a6f['as'],'attributes':_0x4e2a6f[_0x8c38('0x1c')],'include':_0x4e2a6f['include']?_[_0x8c38('0x1d')](_0x4e2a6f[_0x8c38('0x1f')],function(_0x485066){return{'model':db[_0x485066[_0x8c38('0x1e')]],'as':_0x485066['as'],'attributes':_0x485066[_0x8c38('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d8172){logger['info'](_0x8c38('0x20'),_0x2cfc51);logger['debug'](_0x8c38('0x20'),_0x2cfc51,JSON['stringify'](_0x5d8172));_0x2c8bd6(_0x5d8172);})[_0x8c38('0x17')](function(_0x2fe5f2){logger['error'](_0x8c38('0x20'),_0x2fe5f2['message'],_0x2cfc51);_0x2676b9(_0xa8490b['error'](0x1f4,_0x2fe5f2[_0x8c38('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index d002aeb..f11416a 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 _0xcf55=['/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','getFields'];(function(_0x25040a,_0x4d2fad){var _0x2b677b=function(_0x3a78b9){while(--_0x3a78b9){_0x25040a['push'](_0x25040a['shift']());}};_0x2b677b(++_0x4d2fad);}(_0xcf55,0x14b));var _0x5cf5=function(_0x2251c9,_0x2a2091){_0x2251c9=_0x2251c9-0x0;var _0x56d17b=_0xcf55[_0x2251c9];return _0x56d17b;};'use strict';var multer=require(_0x5cf5('0x0'));var util=require(_0x5cf5('0x1'));var path=require(_0x5cf5('0x2'));var timeout=require(_0x5cf5('0x3'));var express=require(_0x5cf5('0x4'));var router=express[_0x5cf5('0x5')]();var fs_extra=require(_0x5cf5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5cf5('0x7'));var config=require(_0x5cf5('0x8'));var controller=require(_0x5cf5('0x9'));router['get']('/',auth[_0x5cf5('0xa')](),controller[_0x5cf5('0xb')]);router[_0x5cf5('0xc')]('/:id',auth[_0x5cf5('0xa')](),controller['show']);router['get']('/:id/fields',auth[_0x5cf5('0xa')](),controller[_0x5cf5('0xd')]);router[_0x5cf5('0xc')](_0x5cf5('0xe'),auth[_0x5cf5('0xa')](),controller[_0x5cf5('0xf')]);router[_0x5cf5('0xc')](_0x5cf5('0x10'),auth[_0x5cf5('0xa')](),controller['getDescriptions']);router[_0x5cf5('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5cf5('0x12')]('/:id',auth[_0x5cf5('0xa')](),controller[_0x5cf5('0x13')]);router[_0x5cf5('0x14')](_0x5cf5('0x15'),auth[_0x5cf5('0xa')](),controller['destroy']);module[_0x5cf5('0x16')]=router; \ No newline at end of file +var _0x3f7c=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','delete'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x3f7c,0xaa));var _0xc3f7=function(_0x24e5c5,_0x3af80d){_0x24e5c5=_0x24e5c5-0x0;var _0x321838=_0x3f7c[_0x24e5c5];return _0x321838;};'use strict';var multer=require(_0xc3f7('0x0'));var util=require(_0xc3f7('0x1'));var path=require(_0xc3f7('0x2'));var timeout=require(_0xc3f7('0x3'));var express=require(_0xc3f7('0x4'));var router=express['Router']();var fs_extra=require(_0xc3f7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc3f7('0x6'));var config=require(_0xc3f7('0x7'));var controller=require(_0xc3f7('0x8'));router[_0xc3f7('0x9')]('/',auth[_0xc3f7('0xa')](),controller['index']);router[_0xc3f7('0x9')](_0xc3f7('0xb'),auth[_0xc3f7('0xa')](),controller[_0xc3f7('0xc')]);router[_0xc3f7('0x9')](_0xc3f7('0xd'),auth[_0xc3f7('0xa')](),controller[_0xc3f7('0xe')]);router[_0xc3f7('0x9')]('/:id/subjects',auth[_0xc3f7('0xa')](),controller[_0xc3f7('0xf')]);router['get'](_0xc3f7('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xc3f7('0x11')]('/',auth['isAuthenticated'](),controller[_0xc3f7('0x12')]);router[_0xc3f7('0x13')](_0xc3f7('0xb'),auth[_0xc3f7('0xa')](),controller[_0xc3f7('0x14')]);router[_0xc3f7('0x15')](_0xc3f7('0xb'),auth[_0xc3f7('0xa')](),controller[_0xc3f7('0x16')]);module[_0xc3f7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 9d0f5a1..4e3c2dd 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 _0x1e72=['phonecall','contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM','incident'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x1e72,0x70));var _0x21e7=function(_0x26f8b5,_0x139f8f){_0x26f8b5=_0x26f8b5-0x0;var _0x751f0=_0x1e72[_0x26f8b5];return _0x751f0;};'use strict';var Sequelize=require(_0x21e7('0x0'));module[_0x21e7('0x1')]={'name':{'type':Sequelize[_0x21e7('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x21e7('0x3')](_0x21e7('0x4'),_0x21e7('0x5')),'defaultValue':_0x21e7('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x21e7('0x6'),_0x21e7('0x7')),'defaultValue':_0x21e7('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x21e7('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xddd3=['nothing','STRING','incident','phonecall','contact'];(function(_0x3dddb9,_0x18204b){var _0x19994d=function(_0x3d3cfb){while(--_0x3d3cfb){_0x3dddb9['push'](_0x3dddb9['shift']());}};_0x19994d(++_0x18204b);}(_0xddd3,0x183));var _0x3ddd=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xddd3[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x3ddd('0x0'),_0x3ddd('0x1')),'defaultValue':_0x3ddd('0x0')},'moduleCreate':{'type':Sequelize['ENUM'](_0x3ddd('0x2'),_0x3ddd('0x3')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x3ddd('0x4')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 1798df0..c0d8ee2 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 _0xeddb=['end','error','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getFields','findOne','Dynamics365Field','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x54b396,_0x3612ee){var _0x532e6d=function(_0xc8286e){while(--_0xc8286e){_0x54b396['push'](_0x54b396['shift']());}};_0x532e6d(++_0x3612ee);}(_0xeddb,0x121));var _0xbedd=function(_0x4753b7,_0x2660d1){_0x4753b7=_0x4753b7-0x0;var _0x3e6fa9=_0xeddb[_0x4753b7];return _0x3e6fa9;};'use strict';var emlformat=require(_0xbedd('0x0'));var rimraf=require(_0xbedd('0x1'));var zipdir=require(_0xbedd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbedd('0x3'));var moment=require('moment');var BPromise=require(_0xbedd('0x4'));var Mustache=require('mustache');var util=require(_0xbedd('0x5'));var path=require(_0xbedd('0x6'));var sox=require(_0xbedd('0x7'));var csv=require(_0xbedd('0x8'));var ejs=require(_0xbedd('0x9'));var fs=require('fs');var fs_extra=require(_0xbedd('0xa'));var _=require(_0xbedd('0xb'));var squel=require('squel');var crypto=require(_0xbedd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbedd('0xd'));var toCsv=require(_0xbedd('0x8'));var querystring=require(_0xbedd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbedd('0xf'));var qs=require(_0xbedd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbedd('0x11'));var logger=require(_0xbedd('0x12'))(_0xbedd('0x13'));var utils=require(_0xbedd('0x14'));var config=require(_0xbedd('0x15'));var licenseUtil=require(_0xbedd('0x16'));var db=require(_0xbedd('0x17'))['db'];function respondWithStatusCode(_0x3e28fa,_0x2011d2){_0x2011d2=_0x2011d2||0xcc;return function(_0x1151ee){if(_0x1151ee){return _0x3e28fa[_0xbedd('0x18')](_0x2011d2);}return _0x3e28fa[_0xbedd('0x19')](_0x2011d2)['end']();};}function respondWithResult(_0x1229fa,_0x439e8c){_0x439e8c=_0x439e8c||0xc8;return function(_0x3aebac){if(_0x3aebac){return _0x1229fa[_0xbedd('0x19')](_0x439e8c)['json'](_0x3aebac);}};}function respondWithFilteredResult(_0x274527,_0x28377d){return function(_0x377466){if(_0x377466){var _0x45a82a=typeof _0x28377d[_0xbedd('0x1a')]===_0xbedd('0x1b')&&typeof _0x28377d[_0xbedd('0x1c')]==='undefined';var _0x48c041=_0x377466[_0xbedd('0x1d')];var _0x467db5=_0x45a82a?0x0:_0x28377d[_0xbedd('0x1a')];var _0x220216=_0x45a82a?_0x377466[_0xbedd('0x1d')]:_0x28377d[_0xbedd('0x1a')]+_0x28377d['limit'];var _0x1de9e7;if(_0x220216>=_0x48c041){_0x220216=_0x48c041;_0x1de9e7=0xc8;}else{_0x1de9e7=0xce;}_0x274527[_0xbedd('0x19')](_0x1de9e7);return _0x274527[_0xbedd('0x1e')](_0xbedd('0x1f'),_0x467db5+'-'+_0x220216+'/'+_0x48c041)[_0xbedd('0x20')](_0x377466);}return null;};}function patchUpdates(_0x5e6068){return function(_0x21f1d5){try{jsonpatch[_0xbedd('0x21')](_0x21f1d5,_0x5e6068,!![]);}catch(_0x325197){return BPromise[_0xbedd('0x22')](_0x325197);}return _0x21f1d5[_0xbedd('0x23')]();};}function saveUpdates(_0x3431bb,_0x2bc88a){return function(_0x486a0a){if(_0x486a0a){return _0x486a0a[_0xbedd('0x24')](_0x3431bb)[_0xbedd('0x25')](function(_0x4d9db4){return _0x4d9db4;});}return null;};}function removeEntity(_0x11582b,_0x2fcea1){return function(_0x2c82b6){if(_0x2c82b6){return _0x2c82b6[_0xbedd('0x26')]()[_0xbedd('0x25')](function(){_0x11582b['status'](0xcc)[_0xbedd('0x27')]();});}};}function handleEntityNotFound(_0x5aa18a,_0x5a65fe){return function(_0x5d32ca){if(!_0x5d32ca){_0x5aa18a[_0xbedd('0x18')](0x194);}return _0x5d32ca;};}function handleError(_0x193711,_0x4d71f4){_0x4d71f4=_0x4d71f4||0x1f4;return function(_0x471fea){logger[_0xbedd('0x28')](_0x471fea['stack']);if(_0x471fea[_0xbedd('0x29')]){delete _0x471fea[_0xbedd('0x29')];}_0x193711['status'](_0x4d71f4)['send'](_0x471fea);};}exports[_0xbedd('0x2a')]=function(_0x50297d,_0x2a460e){var _0x2972ea={},_0x109552={},_0x2a97cf={'count':0x0,'rows':[]};var _0x2b7d66=_[_0xbedd('0x2b')](db[_0xbedd('0x2c')][_0xbedd('0x2d')],function(_0x11f5d4){return{'name':_0x11f5d4[_0xbedd('0x2e')],'type':_0x11f5d4[_0xbedd('0x2f')][_0xbedd('0x30')]};});_0x109552[_0xbedd('0x31')]=_['map'](_0x2b7d66,_0xbedd('0x29'));_0x109552[_0xbedd('0x32')]=_[_0xbedd('0x33')](_0x50297d[_0xbedd('0x32')]);_0x109552[_0xbedd('0x34')]=_[_0xbedd('0x35')](_0x109552['model'],_0x109552[_0xbedd('0x32')]);_0x2972ea['attributes']=_[_0xbedd('0x35')](_0x109552[_0xbedd('0x31')],qs[_0xbedd('0x36')](_0x50297d[_0xbedd('0x32')][_0xbedd('0x36')]));_0x2972ea[_0xbedd('0x37')]=_0x2972ea[_0xbedd('0x37')][_0xbedd('0x38')]?_0x2972ea['attributes']:_0x109552[_0xbedd('0x31')];if(!_0x50297d[_0xbedd('0x32')][_0xbedd('0x39')](_0xbedd('0x3a'))){_0x2972ea[_0xbedd('0x1c')]=qs[_0xbedd('0x1c')](_0x50297d['query'][_0xbedd('0x1c')]);_0x2972ea[_0xbedd('0x1a')]=qs[_0xbedd('0x1a')](_0x50297d[_0xbedd('0x32')][_0xbedd('0x1a')]);}_0x2972ea[_0xbedd('0x3b')]=qs[_0xbedd('0x3c')](_0x50297d[_0xbedd('0x32')][_0xbedd('0x3c')]);_0x2972ea[_0xbedd('0x3d')]=qs[_0xbedd('0x34')](_[_0xbedd('0x3e')](_0x50297d[_0xbedd('0x32')],_0x109552['filters']),_0x2b7d66);if(_0x50297d[_0xbedd('0x32')]['filter']){_0x2972ea[_0xbedd('0x3d')]=_[_0xbedd('0x3f')](_0x2972ea[_0xbedd('0x3d')],{'$or':_[_0xbedd('0x2b')](_0x2b7d66,function(_0x3308f5){if(_0x3308f5[_0xbedd('0x2f')]!==_0xbedd('0x40')){var _0x3fb6f8={};_0x3fb6f8[_0x3308f5['name']]={'$like':'%'+_0x50297d['query']['filter']+'%'};return _0x3fb6f8;}})});}_0x2972ea=_[_0xbedd('0x3f')]({},_0x2972ea,_0x50297d[_0xbedd('0x41')]);var _0x12783b={'where':_0x2972ea[_0xbedd('0x3d')]};return db[_0xbedd('0x2c')][_0xbedd('0x1d')](_0x12783b)[_0xbedd('0x25')](function(_0x4ba289){_0x2a97cf[_0xbedd('0x1d')]=_0x4ba289;if(_0x50297d['query'][_0xbedd('0x42')]){_0x2972ea['include']=[{'all':!![]}];}return db[_0xbedd('0x2c')][_0xbedd('0x43')](_0x2972ea);})[_0xbedd('0x25')](function(_0x17e833){_0x2a97cf[_0xbedd('0x44')]=_0x17e833;return _0x2a97cf;})[_0xbedd('0x25')](respondWithFilteredResult(_0x2a460e,_0x2972ea))[_0xbedd('0x45')](handleError(_0x2a460e,null));};exports[_0xbedd('0x46')]=function(_0x2aad7a,_0x27dfa7){var _0x10f1ab={'raw':![],'where':{'id':_0x2aad7a[_0xbedd('0x47')]['id']}},_0x2a4052={};_0x2a4052[_0xbedd('0x31')]=_[_0xbedd('0x33')](db[_0xbedd('0x2c')][_0xbedd('0x2d')]);_0x2a4052[_0xbedd('0x32')]=_[_0xbedd('0x33')](_0x2aad7a[_0xbedd('0x32')]);_0x2a4052[_0xbedd('0x34')]=_['intersection'](_0x2a4052[_0xbedd('0x31')],_0x2a4052['query']);_0x10f1ab[_0xbedd('0x37')]=_[_0xbedd('0x35')](_0x2a4052[_0xbedd('0x31')],qs[_0xbedd('0x36')](_0x2aad7a['query'][_0xbedd('0x36')]));_0x10f1ab[_0xbedd('0x37')]=_0x10f1ab[_0xbedd('0x37')][_0xbedd('0x38')]?_0x10f1ab[_0xbedd('0x37')]:_0x2a4052[_0xbedd('0x31')];if(_0x2aad7a[_0xbedd('0x32')][_0xbedd('0x42')]){_0x10f1ab[_0xbedd('0x48')]=[{'all':!![]}];}_0x10f1ab=_['merge']({},_0x10f1ab,_0x2aad7a[_0xbedd('0x41')]);return db['Dynamics365Configuration'][_0xbedd('0x49')](_0x10f1ab)['then'](handleEntityNotFound(_0x27dfa7,null))[_0xbedd('0x25')](respondWithResult(_0x27dfa7,null))['catch'](handleError(_0x27dfa7,null));};exports[_0xbedd('0x4a')]=function(_0x84f244,_0x2faeb5){return db[_0xbedd('0x2c')]['create'](_0x84f244['body'],{})[_0xbedd('0x25')](respondWithResult(_0x2faeb5,0xc9))['catch'](handleError(_0x2faeb5,null));};exports[_0xbedd('0x24')]=function(_0x37b3c0,_0x14cbbb){if(_0x37b3c0[_0xbedd('0x4b')]['id']){delete _0x37b3c0['body']['id'];}return db[_0xbedd('0x2c')][_0xbedd('0x49')]({'where':{'id':_0x37b3c0[_0xbedd('0x47')]['id']}})[_0xbedd('0x25')](handleEntityNotFound(_0x14cbbb,null))[_0xbedd('0x25')](saveUpdates(_0x37b3c0['body'],null))[_0xbedd('0x25')](respondWithResult(_0x14cbbb,null))[_0xbedd('0x45')](handleError(_0x14cbbb,null));};exports['destroy']=function(_0x2ff897,_0x3d4714){return db[_0xbedd('0x2c')][_0xbedd('0x49')]({'where':{'id':_0x2ff897[_0xbedd('0x47')]['id']}})[_0xbedd('0x25')](handleEntityNotFound(_0x3d4714,null))[_0xbedd('0x25')](removeEntity(_0x3d4714,null))[_0xbedd('0x45')](handleError(_0x3d4714,null));};exports[_0xbedd('0x4c')]=function(_0x385228,_0x181565,_0x125fb7){var _0x486a61={};var _0x5c5319={};var _0x2badbc;var _0x1685e5;return db['Dynamics365Configuration'][_0xbedd('0x4d')]({'where':{'id':_0x385228[_0xbedd('0x47')]['id']}})[_0xbedd('0x25')](handleEntityNotFound(_0x181565,null))[_0xbedd('0x25')](function(_0x3cd859){if(_0x3cd859){_0x2badbc=_0x3cd859;_0x5c5319[_0xbedd('0x31')]=_[_0xbedd('0x33')](db[_0xbedd('0x4e')][_0xbedd('0x2d')]);_0x5c5319[_0xbedd('0x32')]=_[_0xbedd('0x33')](_0x385228['query']);_0x5c5319['filters']=_[_0xbedd('0x35')](_0x5c5319[_0xbedd('0x31')],_0x5c5319['query']);_0x486a61['attributes']=_['intersection'](_0x5c5319['model'],qs['fields'](_0x385228[_0xbedd('0x32')][_0xbedd('0x36')]));_0x486a61['attributes']=_0x486a61['attributes'][_0xbedd('0x38')]?_0x486a61[_0xbedd('0x37')]:_0x5c5319['model'];_0x486a61[_0xbedd('0x3b')]=qs[_0xbedd('0x3c')](_0x385228['query'][_0xbedd('0x3c')]);_0x486a61[_0xbedd('0x3d')]=qs[_0xbedd('0x34')](_[_0xbedd('0x3e')](_0x385228['query'],_0x5c5319[_0xbedd('0x34')]));if(_0x385228['query'][_0xbedd('0x4f')]){_0x486a61[_0xbedd('0x3d')]=_[_0xbedd('0x3f')](_0x486a61[_0xbedd('0x3d')],{'$or':_['map'](_0x486a61[_0xbedd('0x37')],function(_0x2cefaf){var _0xe723eb={};_0xe723eb[_0x2cefaf]={'$like':'%'+_0x385228[_0xbedd('0x32')][_0xbedd('0x4f')]+'%'};return _0xe723eb;})});}_0x486a61=_[_0xbedd('0x3f')]({},_0x486a61,_0x385228['options']);return _0x2badbc['getFields'](_0x486a61);}})['then'](function(_0x1e6be5){if(_0x1e6be5){_0x1685e5=_0x1e6be5[_0xbedd('0x38')];if(!_0x385228[_0xbedd('0x32')][_0xbedd('0x39')]('nolimit')){_0x486a61[_0xbedd('0x1c')]=qs[_0xbedd('0x1c')](_0x385228[_0xbedd('0x32')][_0xbedd('0x1c')]);_0x486a61[_0xbedd('0x1a')]=qs[_0xbedd('0x1a')](_0x385228[_0xbedd('0x32')]['offset']);}return _0x2badbc['getFields'](_0x486a61);}})['then'](function(_0x1256b6){if(_0x1256b6){return _0x1256b6?{'count':_0x1685e5,'rows':_0x1256b6}:null;}})[_0xbedd('0x25')](respondWithResult(_0x181565,null))['catch'](handleError(_0x181565,null));};exports['getSubjects']=function(_0x687ff1,_0x4ab65e,_0x23d507){var _0x3a0dff={};var _0x1cddac={};var _0xff9de1;var _0x226a50;return db[_0xbedd('0x2c')][_0xbedd('0x4d')]({'where':{'id':_0x687ff1['params']['id']}})[_0xbedd('0x25')](handleEntityNotFound(_0x4ab65e,null))['then'](function(_0x470ea5){if(_0x470ea5){_0xff9de1=_0x470ea5;_0x1cddac['model']=_[_0xbedd('0x33')](db[_0xbedd('0x4e')][_0xbedd('0x2d')]);_0x1cddac['query']=_[_0xbedd('0x33')](_0x687ff1[_0xbedd('0x32')]);_0x1cddac['filters']=_['intersection'](_0x1cddac[_0xbedd('0x31')],_0x1cddac[_0xbedd('0x32')]);_0x3a0dff[_0xbedd('0x37')]=_[_0xbedd('0x35')](_0x1cddac['model'],qs[_0xbedd('0x36')](_0x687ff1[_0xbedd('0x32')][_0xbedd('0x36')]));_0x3a0dff[_0xbedd('0x37')]=_0x3a0dff[_0xbedd('0x37')]['length']?_0x3a0dff['attributes']:_0x1cddac['model'];_0x3a0dff[_0xbedd('0x3b')]=qs[_0xbedd('0x3c')](_0x687ff1[_0xbedd('0x32')][_0xbedd('0x3c')]);_0x3a0dff['where']=qs[_0xbedd('0x34')](_[_0xbedd('0x3e')](_0x687ff1['query'],_0x1cddac[_0xbedd('0x34')]));if(_0x687ff1[_0xbedd('0x32')]['filter']){_0x3a0dff[_0xbedd('0x3d')]=_[_0xbedd('0x3f')](_0x3a0dff[_0xbedd('0x3d')],{'$or':_['map'](_0x3a0dff[_0xbedd('0x37')],function(_0x112582){var _0x173170={};_0x173170[_0x112582]={'$like':'%'+_0x687ff1[_0xbedd('0x32')][_0xbedd('0x4f')]+'%'};return _0x173170;})});}_0x3a0dff=_[_0xbedd('0x3f')]({},_0x3a0dff,_0x687ff1['options']);return _0xff9de1[_0xbedd('0x50')](_0x3a0dff);}})[_0xbedd('0x25')](function(_0x275bf8){if(_0x275bf8){_0x226a50=_0x275bf8[_0xbedd('0x38')];if(!_0x687ff1[_0xbedd('0x32')]['hasOwnProperty']('nolimit')){_0x3a0dff['limit']=qs[_0xbedd('0x1c')](_0x687ff1['query'][_0xbedd('0x1c')]);_0x3a0dff['offset']=qs[_0xbedd('0x1a')](_0x687ff1['query'][_0xbedd('0x1a')]);}return _0xff9de1[_0xbedd('0x50')](_0x3a0dff);}})[_0xbedd('0x25')](function(_0x269d7c){if(_0x269d7c){return _0x269d7c?{'count':_0x226a50,'rows':_0x269d7c}:null;}})['then'](respondWithResult(_0x4ab65e,null))[_0xbedd('0x45')](handleError(_0x4ab65e,null));};exports[_0xbedd('0x51')]=function(_0x2653f5,_0x3f5243,_0x451ae0){var _0x39a991={};var _0x1569f9={};var _0x5ec37;var _0x2f463f;return db[_0xbedd('0x2c')][_0xbedd('0x4d')]({'where':{'id':_0x2653f5[_0xbedd('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f5243,null))[_0xbedd('0x25')](function(_0x35c909){if(_0x35c909){_0x5ec37=_0x35c909;_0x1569f9[_0xbedd('0x31')]=_['keys'](db[_0xbedd('0x4e')][_0xbedd('0x2d')]);_0x1569f9[_0xbedd('0x32')]=_['keys'](_0x2653f5[_0xbedd('0x32')]);_0x1569f9[_0xbedd('0x34')]=_[_0xbedd('0x35')](_0x1569f9[_0xbedd('0x31')],_0x1569f9[_0xbedd('0x32')]);_0x39a991[_0xbedd('0x37')]=_[_0xbedd('0x35')](_0x1569f9[_0xbedd('0x31')],qs[_0xbedd('0x36')](_0x2653f5[_0xbedd('0x32')]['fields']));_0x39a991['attributes']=_0x39a991[_0xbedd('0x37')][_0xbedd('0x38')]?_0x39a991['attributes']:_0x1569f9[_0xbedd('0x31')];_0x39a991[_0xbedd('0x3b')]=qs[_0xbedd('0x3c')](_0x2653f5[_0xbedd('0x32')][_0xbedd('0x3c')]);_0x39a991[_0xbedd('0x3d')]=qs[_0xbedd('0x34')](_[_0xbedd('0x3e')](_0x2653f5[_0xbedd('0x32')],_0x1569f9[_0xbedd('0x34')]));if(_0x2653f5['query'][_0xbedd('0x4f')]){_0x39a991['where']=_[_0xbedd('0x3f')](_0x39a991[_0xbedd('0x3d')],{'$or':_[_0xbedd('0x2b')](_0x39a991[_0xbedd('0x37')],function(_0x17c81c){var _0x3407e5={};_0x3407e5[_0x17c81c]={'$like':'%'+_0x2653f5[_0xbedd('0x32')]['filter']+'%'};return _0x3407e5;})});}_0x39a991=_['merge']({},_0x39a991,_0x2653f5['options']);return _0x5ec37[_0xbedd('0x51')](_0x39a991);}})['then'](function(_0x2d1fec){if(_0x2d1fec){_0x2f463f=_0x2d1fec[_0xbedd('0x38')];if(!_0x2653f5['query'][_0xbedd('0x39')](_0xbedd('0x3a'))){_0x39a991[_0xbedd('0x1c')]=qs[_0xbedd('0x1c')](_0x2653f5[_0xbedd('0x32')]['limit']);_0x39a991['offset']=qs['offset'](_0x2653f5[_0xbedd('0x32')][_0xbedd('0x1a')]);}return _0x5ec37['getDescriptions'](_0x39a991);}})[_0xbedd('0x25')](function(_0x434a0f){if(_0x434a0f){return _0x434a0f?{'count':_0x2f463f,'rows':_0x434a0f}:null;}})['then'](respondWithResult(_0x3f5243,null))[_0xbedd('0x45')](handleError(_0x3f5243,null));}; \ No newline at end of file +var _0xd0d4=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','error','stack','name','Dynamics365Configuration','rawAttributes','fieldName','type','key','map','model','attributes','intersection','fields','query','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','keys','merge','create','body','catch','find','Dynamics365Field','length','order','getFields','getSubjects','findOne','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd0d4,0x134));var _0x4d0d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd0d4[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x4d0d('0x0'));var rimraf=require(_0x4d0d('0x1'));var zipdir=require(_0x4d0d('0x2'));var jsonpatch=require(_0x4d0d('0x3'));var rp=require(_0x4d0d('0x4'));var moment=require(_0x4d0d('0x5'));var BPromise=require(_0x4d0d('0x6'));var Mustache=require('mustache');var util=require(_0x4d0d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4d0d('0x8'));var ejs=require(_0x4d0d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d0d('0xa'));var squel=require(_0x4d0d('0xb'));var crypto=require(_0x4d0d('0xc'));var jsforce=require(_0x4d0d('0xd'));var deskjs=require(_0x4d0d('0xe'));var toCsv=require(_0x4d0d('0x8'));var querystring=require(_0x4d0d('0xf'));var Papa=require(_0x4d0d('0x10'));var Redis=require('ioredis');var authService=require(_0x4d0d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4d0d('0x12'));var hardwareService=require(_0x4d0d('0x13'));var logger=require(_0x4d0d('0x14'))('api');var utils=require(_0x4d0d('0x15'));var config=require(_0x4d0d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d0d('0x17'))['db'];function respondWithStatusCode(_0x5a1744,_0x1225e0){_0x1225e0=_0x1225e0||0xcc;return function(_0x12408e){if(_0x12408e){return _0x5a1744[_0x4d0d('0x18')](_0x1225e0);}return _0x5a1744[_0x4d0d('0x19')](_0x1225e0)[_0x4d0d('0x1a')]();};}function respondWithResult(_0x11ce50,_0x3efea2){_0x3efea2=_0x3efea2||0xc8;return function(_0x246179){if(_0x246179){return _0x11ce50[_0x4d0d('0x19')](_0x3efea2)['json'](_0x246179);}};}function respondWithFilteredResult(_0x476812,_0x2700af){return function(_0x3a0bfb){if(_0x3a0bfb){var _0x9f38a4=typeof _0x2700af[_0x4d0d('0x1b')]==='undefined'&&typeof _0x2700af[_0x4d0d('0x1c')]===_0x4d0d('0x1d');var _0x35a856=_0x3a0bfb[_0x4d0d('0x1e')];var _0x1cee80=_0x9f38a4?0x0:_0x2700af[_0x4d0d('0x1b')];var _0x1cac4a=_0x9f38a4?_0x3a0bfb['count']:_0x2700af[_0x4d0d('0x1b')]+_0x2700af[_0x4d0d('0x1c')];var _0x1d64e1;if(_0x1cac4a>=_0x35a856){_0x1cac4a=_0x35a856;_0x1d64e1=0xc8;}else{_0x1d64e1=0xce;}_0x476812[_0x4d0d('0x19')](_0x1d64e1);return _0x476812[_0x4d0d('0x1f')](_0x4d0d('0x20'),_0x1cee80+'-'+_0x1cac4a+'/'+_0x35a856)[_0x4d0d('0x21')](_0x3a0bfb);}return null;};}function patchUpdates(_0x289f9b){return function(_0x434293){try{jsonpatch[_0x4d0d('0x22')](_0x434293,_0x289f9b,!![]);}catch(_0x3790bf){return BPromise[_0x4d0d('0x23')](_0x3790bf);}return _0x434293['save']();};}function saveUpdates(_0xf1e17a,_0x2f8e53){return function(_0x379189){if(_0x379189){return _0x379189[_0x4d0d('0x24')](_0xf1e17a)['then'](function(_0x4c98da){return _0x4c98da;});}return null;};}function removeEntity(_0x44d9a4,_0xa0e180){return function(_0x51f439){if(_0x51f439){return _0x51f439[_0x4d0d('0x25')]()['then'](function(){_0x44d9a4[_0x4d0d('0x19')](0xcc)[_0x4d0d('0x1a')]();});}};}function handleEntityNotFound(_0x48594a,_0x1567bc){return function(_0x1ca6ca){if(!_0x1ca6ca){_0x48594a[_0x4d0d('0x18')](0x194);}return _0x1ca6ca;};}function handleError(_0x2633c2,_0x4815c1){_0x4815c1=_0x4815c1||0x1f4;return function(_0x3e0570){logger[_0x4d0d('0x26')](_0x3e0570[_0x4d0d('0x27')]);if(_0x3e0570[_0x4d0d('0x28')]){delete _0x3e0570[_0x4d0d('0x28')];}_0x2633c2['status'](_0x4815c1)['send'](_0x3e0570);};}exports['index']=function(_0x5e4bc3,_0x47e362){var _0x3e692b={},_0x395f1c={},_0x29ab40={'count':0x0,'rows':[]};var _0xda1299=_['map'](db[_0x4d0d('0x29')][_0x4d0d('0x2a')],function(_0xd857b3){return{'name':_0xd857b3[_0x4d0d('0x2b')],'type':_0xd857b3[_0x4d0d('0x2c')][_0x4d0d('0x2d')]};});_0x395f1c['model']=_[_0x4d0d('0x2e')](_0xda1299,_0x4d0d('0x28'));_0x395f1c['query']=_['keys'](_0x5e4bc3['query']);_0x395f1c['filters']=_['intersection'](_0x395f1c[_0x4d0d('0x2f')],_0x395f1c['query']);_0x3e692b[_0x4d0d('0x30')]=_[_0x4d0d('0x31')](_0x395f1c[_0x4d0d('0x2f')],qs[_0x4d0d('0x32')](_0x5e4bc3[_0x4d0d('0x33')]['fields']));_0x3e692b[_0x4d0d('0x30')]=_0x3e692b['attributes']['length']?_0x3e692b['attributes']:_0x395f1c['model'];if(!_0x5e4bc3['query'][_0x4d0d('0x34')](_0x4d0d('0x35'))){_0x3e692b[_0x4d0d('0x1c')]=qs[_0x4d0d('0x1c')](_0x5e4bc3[_0x4d0d('0x33')][_0x4d0d('0x1c')]);_0x3e692b[_0x4d0d('0x1b')]=qs[_0x4d0d('0x1b')](_0x5e4bc3['query'][_0x4d0d('0x1b')]);}_0x3e692b['order']=qs[_0x4d0d('0x36')](_0x5e4bc3[_0x4d0d('0x33')][_0x4d0d('0x36')]);_0x3e692b['where']=qs[_0x4d0d('0x37')](_['pick'](_0x5e4bc3[_0x4d0d('0x33')],_0x395f1c[_0x4d0d('0x37')]),_0xda1299);if(_0x5e4bc3[_0x4d0d('0x33')][_0x4d0d('0x38')]){_0x3e692b['where']=_['merge'](_0x3e692b[_0x4d0d('0x39')],{'$or':_[_0x4d0d('0x2e')](_0xda1299,function(_0x4ddd99){if(_0x4ddd99[_0x4d0d('0x2c')]!==_0x4d0d('0x3a')){var _0x30ca79={};_0x30ca79[_0x4ddd99['name']]={'$like':'%'+_0x5e4bc3['query']['filter']+'%'};return _0x30ca79;}})});}_0x3e692b=_['merge']({},_0x3e692b,_0x5e4bc3[_0x4d0d('0x3b')]);var _0x465940={'where':_0x3e692b[_0x4d0d('0x39')]};return db[_0x4d0d('0x29')][_0x4d0d('0x1e')](_0x465940)[_0x4d0d('0x3c')](function(_0x1afdbe){_0x29ab40[_0x4d0d('0x1e')]=_0x1afdbe;if(_0x5e4bc3[_0x4d0d('0x33')][_0x4d0d('0x3d')]){_0x3e692b[_0x4d0d('0x3e')]=[{'all':!![]}];}return db[_0x4d0d('0x29')][_0x4d0d('0x3f')](_0x3e692b);})[_0x4d0d('0x3c')](function(_0x1651cd){_0x29ab40[_0x4d0d('0x40')]=_0x1651cd;return _0x29ab40;})[_0x4d0d('0x3c')](respondWithFilteredResult(_0x47e362,_0x3e692b))['catch'](handleError(_0x47e362,null));};exports[_0x4d0d('0x41')]=function(_0x345fdc,_0x5591f6){var _0x52fb9d={'raw':![],'where':{'id':_0x345fdc[_0x4d0d('0x42')]['id']}},_0x2a6339={};_0x2a6339[_0x4d0d('0x2f')]=_[_0x4d0d('0x43')](db[_0x4d0d('0x29')]['rawAttributes']);_0x2a6339[_0x4d0d('0x33')]=_[_0x4d0d('0x43')](_0x345fdc['query']);_0x2a6339[_0x4d0d('0x37')]=_[_0x4d0d('0x31')](_0x2a6339[_0x4d0d('0x2f')],_0x2a6339['query']);_0x52fb9d['attributes']=_['intersection'](_0x2a6339[_0x4d0d('0x2f')],qs['fields'](_0x345fdc[_0x4d0d('0x33')][_0x4d0d('0x32')]));_0x52fb9d[_0x4d0d('0x30')]=_0x52fb9d[_0x4d0d('0x30')]['length']?_0x52fb9d[_0x4d0d('0x30')]:_0x2a6339['model'];if(_0x345fdc[_0x4d0d('0x33')][_0x4d0d('0x3d')]){_0x52fb9d['include']=[{'all':!![]}];}_0x52fb9d=_[_0x4d0d('0x44')]({},_0x52fb9d,_0x345fdc[_0x4d0d('0x3b')]);return db[_0x4d0d('0x29')]['find'](_0x52fb9d)['then'](handleEntityNotFound(_0x5591f6,null))[_0x4d0d('0x3c')](respondWithResult(_0x5591f6,null))['catch'](handleError(_0x5591f6,null));};exports['create']=function(_0x38439c,_0x571623){return db[_0x4d0d('0x29')][_0x4d0d('0x45')](_0x38439c[_0x4d0d('0x46')],{})['then'](respondWithResult(_0x571623,0xc9))[_0x4d0d('0x47')](handleError(_0x571623,null));};exports['update']=function(_0x8bb3a4,_0x3c04da){if(_0x8bb3a4[_0x4d0d('0x46')]['id']){delete _0x8bb3a4[_0x4d0d('0x46')]['id'];}return db['Dynamics365Configuration'][_0x4d0d('0x48')]({'where':{'id':_0x8bb3a4[_0x4d0d('0x42')]['id']}})['then'](handleEntityNotFound(_0x3c04da,null))[_0x4d0d('0x3c')](saveUpdates(_0x8bb3a4[_0x4d0d('0x46')],null))[_0x4d0d('0x3c')](respondWithResult(_0x3c04da,null))[_0x4d0d('0x47')](handleError(_0x3c04da,null));};exports['destroy']=function(_0x42dcf7,_0x45ad54){return db[_0x4d0d('0x29')][_0x4d0d('0x48')]({'where':{'id':_0x42dcf7[_0x4d0d('0x42')]['id']}})[_0x4d0d('0x3c')](handleEntityNotFound(_0x45ad54,null))['then'](removeEntity(_0x45ad54,null))[_0x4d0d('0x47')](handleError(_0x45ad54,null));};exports['getFields']=function(_0x25ff94,_0x4983aa,_0x42b474){var _0x42c182={};var _0x90cdd4={};var _0x3d46d7;var _0x87e4c7;return db[_0x4d0d('0x29')]['findOne']({'where':{'id':_0x25ff94['params']['id']}})[_0x4d0d('0x3c')](handleEntityNotFound(_0x4983aa,null))[_0x4d0d('0x3c')](function(_0x3e3ca1){if(_0x3e3ca1){_0x3d46d7=_0x3e3ca1;_0x90cdd4['model']=_[_0x4d0d('0x43')](db[_0x4d0d('0x49')][_0x4d0d('0x2a')]);_0x90cdd4[_0x4d0d('0x33')]=_['keys'](_0x25ff94[_0x4d0d('0x33')]);_0x90cdd4[_0x4d0d('0x37')]=_[_0x4d0d('0x31')](_0x90cdd4[_0x4d0d('0x2f')],_0x90cdd4['query']);_0x42c182[_0x4d0d('0x30')]=_[_0x4d0d('0x31')](_0x90cdd4[_0x4d0d('0x2f')],qs[_0x4d0d('0x32')](_0x25ff94['query'][_0x4d0d('0x32')]));_0x42c182[_0x4d0d('0x30')]=_0x42c182[_0x4d0d('0x30')][_0x4d0d('0x4a')]?_0x42c182[_0x4d0d('0x30')]:_0x90cdd4[_0x4d0d('0x2f')];_0x42c182[_0x4d0d('0x4b')]=qs[_0x4d0d('0x36')](_0x25ff94[_0x4d0d('0x33')][_0x4d0d('0x36')]);_0x42c182[_0x4d0d('0x39')]=qs[_0x4d0d('0x37')](_['pick'](_0x25ff94[_0x4d0d('0x33')],_0x90cdd4[_0x4d0d('0x37')]));if(_0x25ff94[_0x4d0d('0x33')][_0x4d0d('0x38')]){_0x42c182['where']=_[_0x4d0d('0x44')](_0x42c182[_0x4d0d('0x39')],{'$or':_[_0x4d0d('0x2e')](_0x42c182['attributes'],function(_0x262328){var _0x56ce1b={};_0x56ce1b[_0x262328]={'$like':'%'+_0x25ff94[_0x4d0d('0x33')][_0x4d0d('0x38')]+'%'};return _0x56ce1b;})});}_0x42c182=_[_0x4d0d('0x44')]({},_0x42c182,_0x25ff94[_0x4d0d('0x3b')]);return _0x3d46d7[_0x4d0d('0x4c')](_0x42c182);}})[_0x4d0d('0x3c')](function(_0x3bb594){if(_0x3bb594){_0x87e4c7=_0x3bb594[_0x4d0d('0x4a')];if(!_0x25ff94[_0x4d0d('0x33')][_0x4d0d('0x34')](_0x4d0d('0x35'))){_0x42c182[_0x4d0d('0x1c')]=qs[_0x4d0d('0x1c')](_0x25ff94[_0x4d0d('0x33')][_0x4d0d('0x1c')]);_0x42c182[_0x4d0d('0x1b')]=qs[_0x4d0d('0x1b')](_0x25ff94[_0x4d0d('0x33')][_0x4d0d('0x1b')]);}return _0x3d46d7[_0x4d0d('0x4c')](_0x42c182);}})['then'](function(_0xfabcff){if(_0xfabcff){return _0xfabcff?{'count':_0x87e4c7,'rows':_0xfabcff}:null;}})['then'](respondWithResult(_0x4983aa,null))[_0x4d0d('0x47')](handleError(_0x4983aa,null));};exports[_0x4d0d('0x4d')]=function(_0x541c5d,_0x47fefe,_0x176d22){var _0x3aeab5={};var _0x19e2ff={};var _0x105fed;var _0x7c8a35;return db[_0x4d0d('0x29')][_0x4d0d('0x4e')]({'where':{'id':_0x541c5d['params']['id']}})[_0x4d0d('0x3c')](handleEntityNotFound(_0x47fefe,null))[_0x4d0d('0x3c')](function(_0x3c9743){if(_0x3c9743){_0x105fed=_0x3c9743;_0x19e2ff[_0x4d0d('0x2f')]=_['keys'](db[_0x4d0d('0x49')][_0x4d0d('0x2a')]);_0x19e2ff[_0x4d0d('0x33')]=_[_0x4d0d('0x43')](_0x541c5d[_0x4d0d('0x33')]);_0x19e2ff[_0x4d0d('0x37')]=_[_0x4d0d('0x31')](_0x19e2ff[_0x4d0d('0x2f')],_0x19e2ff[_0x4d0d('0x33')]);_0x3aeab5['attributes']=_[_0x4d0d('0x31')](_0x19e2ff[_0x4d0d('0x2f')],qs['fields'](_0x541c5d['query'][_0x4d0d('0x32')]));_0x3aeab5[_0x4d0d('0x30')]=_0x3aeab5[_0x4d0d('0x30')][_0x4d0d('0x4a')]?_0x3aeab5['attributes']:_0x19e2ff[_0x4d0d('0x2f')];_0x3aeab5[_0x4d0d('0x4b')]=qs[_0x4d0d('0x36')](_0x541c5d[_0x4d0d('0x33')][_0x4d0d('0x36')]);_0x3aeab5[_0x4d0d('0x39')]=qs[_0x4d0d('0x37')](_[_0x4d0d('0x4f')](_0x541c5d[_0x4d0d('0x33')],_0x19e2ff[_0x4d0d('0x37')]));if(_0x541c5d[_0x4d0d('0x33')]['filter']){_0x3aeab5['where']=_['merge'](_0x3aeab5[_0x4d0d('0x39')],{'$or':_['map'](_0x3aeab5['attributes'],function(_0x2613a5){var _0x5782a7={};_0x5782a7[_0x2613a5]={'$like':'%'+_0x541c5d[_0x4d0d('0x33')][_0x4d0d('0x38')]+'%'};return _0x5782a7;})});}_0x3aeab5=_[_0x4d0d('0x44')]({},_0x3aeab5,_0x541c5d[_0x4d0d('0x3b')]);return _0x105fed[_0x4d0d('0x4d')](_0x3aeab5);}})[_0x4d0d('0x3c')](function(_0x38df90){if(_0x38df90){_0x7c8a35=_0x38df90[_0x4d0d('0x4a')];if(!_0x541c5d[_0x4d0d('0x33')]['hasOwnProperty']('nolimit')){_0x3aeab5[_0x4d0d('0x1c')]=qs[_0x4d0d('0x1c')](_0x541c5d[_0x4d0d('0x33')][_0x4d0d('0x1c')]);_0x3aeab5[_0x4d0d('0x1b')]=qs[_0x4d0d('0x1b')](_0x541c5d[_0x4d0d('0x33')][_0x4d0d('0x1b')]);}return _0x105fed[_0x4d0d('0x4d')](_0x3aeab5);}})[_0x4d0d('0x3c')](function(_0x50043f){if(_0x50043f){return _0x50043f?{'count':_0x7c8a35,'rows':_0x50043f}:null;}})[_0x4d0d('0x3c')](respondWithResult(_0x47fefe,null))[_0x4d0d('0x47')](handleError(_0x47fefe,null));};exports[_0x4d0d('0x50')]=function(_0x1ca3ed,_0x32e70a,_0x184226){var _0xe9b12a={};var _0xd5433e={};var _0x5072a2;var _0xdf7991;return db[_0x4d0d('0x29')][_0x4d0d('0x4e')]({'where':{'id':_0x1ca3ed['params']['id']}})[_0x4d0d('0x3c')](handleEntityNotFound(_0x32e70a,null))[_0x4d0d('0x3c')](function(_0x258c16){if(_0x258c16){_0x5072a2=_0x258c16;_0xd5433e['model']=_[_0x4d0d('0x43')](db[_0x4d0d('0x49')]['rawAttributes']);_0xd5433e[_0x4d0d('0x33')]=_['keys'](_0x1ca3ed['query']);_0xd5433e['filters']=_[_0x4d0d('0x31')](_0xd5433e[_0x4d0d('0x2f')],_0xd5433e[_0x4d0d('0x33')]);_0xe9b12a[_0x4d0d('0x30')]=_['intersection'](_0xd5433e['model'],qs[_0x4d0d('0x32')](_0x1ca3ed[_0x4d0d('0x33')]['fields']));_0xe9b12a[_0x4d0d('0x30')]=_0xe9b12a[_0x4d0d('0x30')][_0x4d0d('0x4a')]?_0xe9b12a['attributes']:_0xd5433e[_0x4d0d('0x2f')];_0xe9b12a['order']=qs[_0x4d0d('0x36')](_0x1ca3ed[_0x4d0d('0x33')]['sort']);_0xe9b12a[_0x4d0d('0x39')]=qs[_0x4d0d('0x37')](_[_0x4d0d('0x4f')](_0x1ca3ed[_0x4d0d('0x33')],_0xd5433e[_0x4d0d('0x37')]));if(_0x1ca3ed[_0x4d0d('0x33')][_0x4d0d('0x38')]){_0xe9b12a[_0x4d0d('0x39')]=_[_0x4d0d('0x44')](_0xe9b12a[_0x4d0d('0x39')],{'$or':_[_0x4d0d('0x2e')](_0xe9b12a[_0x4d0d('0x30')],function(_0x2c9856){var _0x5893f7={};_0x5893f7[_0x2c9856]={'$like':'%'+_0x1ca3ed['query'][_0x4d0d('0x38')]+'%'};return _0x5893f7;})});}_0xe9b12a=_['merge']({},_0xe9b12a,_0x1ca3ed[_0x4d0d('0x3b')]);return _0x5072a2[_0x4d0d('0x50')](_0xe9b12a);}})[_0x4d0d('0x3c')](function(_0x531ae6){if(_0x531ae6){_0xdf7991=_0x531ae6['length'];if(!_0x1ca3ed[_0x4d0d('0x33')][_0x4d0d('0x34')](_0x4d0d('0x35'))){_0xe9b12a[_0x4d0d('0x1c')]=qs[_0x4d0d('0x1c')](_0x1ca3ed[_0x4d0d('0x33')][_0x4d0d('0x1c')]);_0xe9b12a[_0x4d0d('0x1b')]=qs[_0x4d0d('0x1b')](_0x1ca3ed[_0x4d0d('0x33')][_0x4d0d('0x1b')]);}return _0x5072a2['getDescriptions'](_0xe9b12a);}})[_0x4d0d('0x3c')](function(_0x4136a8){if(_0x4136a8){return _0x4136a8?{'count':_0xdf7991,'rows':_0x4136a8}:null;}})[_0x4d0d('0x3c')](respondWithResult(_0x32e70a,null))[_0x4d0d('0x47')](handleError(_0x32e70a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index c5e4373..af093d3 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 _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x4fe42e,_0x572321){var _0x19e6f2=function(_0x104a8c){while(--_0x104a8c){_0x4fe42e['push'](_0x4fe42e['shift']());}};_0x19e6f2(++_0x572321);}(_0x84ab,0x12f));var _0xb84a=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0x84ab[_0x11e05d];return _0x335588;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x22f5ea,_0x3a6a30){var _0xe5955=function(_0x139704){while(--_0x139704){_0x22f5ea['push'](_0x22f5ea['shift']());}};_0xe5955(++_0x3a6a30);}(_0x008c,0x188));var _0xc008=function(_0x4338d1,_0x25f589){_0x4338d1=_0x4338d1-0x0;var _0x2b495e=_0x008c[_0x4338d1];return _0x2b495e;};'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')]('Dynamics365Configuration',attributes,{'tableName':_0xc008('0xc'),'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 8ec2c21..23095a3 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 _0x170a=['../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x170a,0x87));var _0xa170=function(_0x513fd7,_0x1d2004){_0x513fd7=_0x513fd7-0x0;var _0x1ede66=_0x170a[_0x513fd7];return _0x1ede66;};'use strict';var _=require(_0xa170('0x0'));var util=require(_0xa170('0x1'));var moment=require(_0xa170('0x2'));var BPromise=require(_0xa170('0x3'));var rs=require(_0xa170('0x4'));var fs=require('fs');var Redis=require(_0xa170('0x5'));var db=require(_0xa170('0x6'))['db'];var utils=require(_0xa170('0x7'));var logger=require('../../config/logger')(_0xa170('0x8'));var config=require(_0xa170('0x9'));var jayson=require(_0xa170('0xa'));var client=jayson[_0xa170('0xb')][_0xa170('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a3d64,_0x3c6493,_0x54d45f){return new BPromise(function(_0x1fc46d,_0x75f36d){return client[_0xa170('0xd')](_0x4a3d64,_0x54d45f)[_0xa170('0xe')](function(_0x4a15f2){logger[_0xa170('0xf')](_0xa170('0x10'),_0x3c6493,_0xa170('0x11'));logger[_0xa170('0x12')](_0xa170('0x13'),_0x3c6493,_0xa170('0x11'),JSON[_0xa170('0x14')](_0x4a15f2));if(_0x4a15f2[_0xa170('0x15')]){if(_0x4a15f2[_0xa170('0x15')][_0xa170('0x16')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x3c6493,_0x4a15f2[_0xa170('0x15')][_0xa170('0x17')]);return _0x75f36d(_0x4a15f2[_0xa170('0x15')]['message']);}logger[_0xa170('0x15')](_0xa170('0x10'),_0x3c6493,_0x4a15f2[_0xa170('0x15')][_0xa170('0x17')]);return _0x1fc46d(_0x4a15f2[_0xa170('0x15')][_0xa170('0x17')]);}else{logger['info'](_0xa170('0x10'),_0x3c6493,_0xa170('0x11'));_0x1fc46d(_0x4a15f2['result'][_0xa170('0x17')]);}})['catch'](function(_0x33833f){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x3c6493,_0x33833f);_0x75f36d(_0x33833f);});});} \ No newline at end of file +var _0x14a5=['error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5939d8,_0x29ed3a){var _0x10d2fc=function(_0x17fcd3){while(--_0x17fcd3){_0x5939d8['push'](_0x5939d8['shift']());}};_0x10d2fc(++_0x29ed3a);}(_0x14a5,0x166));var _0x514a=function(_0x49dc29,_0x28a799){_0x49dc29=_0x49dc29-0x0;var _0xf599db=_0x14a5[_0x49dc29];return _0xf599db;};'use strict';var _=require(_0x514a('0x0'));var util=require(_0x514a('0x1'));var moment=require(_0x514a('0x2'));var BPromise=require(_0x514a('0x3'));var rs=require(_0x514a('0x4'));var fs=require('fs');var Redis=require(_0x514a('0x5'));var db=require(_0x514a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x514a('0x7'))(_0x514a('0x8'));var config=require(_0x514a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x514a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a6437,_0x442dfd,_0x566775){return new BPromise(function(_0x2ecf09,_0x2569e7){return client[_0x514a('0xb')](_0x1a6437,_0x566775)[_0x514a('0xc')](function(_0x10ef1d){logger['info'](_0x514a('0xd'),_0x442dfd,_0x514a('0xe'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x442dfd,_0x514a('0xe'),JSON[_0x514a('0xf')](_0x10ef1d));if(_0x10ef1d[_0x514a('0x10')]){if(_0x10ef1d[_0x514a('0x10')][_0x514a('0x11')]===0x1f4){logger[_0x514a('0x10')](_0x514a('0xd'),_0x442dfd,_0x10ef1d['error']['message']);return _0x2569e7(_0x10ef1d[_0x514a('0x10')][_0x514a('0x12')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x442dfd,_0x10ef1d['error'][_0x514a('0x12')]);return _0x2ecf09(_0x10ef1d[_0x514a('0x10')][_0x514a('0x12')]);}else{logger[_0x514a('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x442dfd,'request\x20sent');_0x2ecf09(_0x10ef1d[_0x514a('0x14')]['message']);}})[_0x514a('0x15')](function(_0x35fc9b){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x442dfd,_0x35fc9b);_0x2569e7(_0x35fc9b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index ab84470..2d52385 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 _0x2452=['./intDynamics365Field.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x2452,0x147));var _0x2245=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x2452[_0x506172];return _0x2723c0;};'use strict';var multer=require(_0x2245('0x0'));var util=require(_0x2245('0x1'));var path=require(_0x2245('0x2'));var timeout=require('connect-timeout');var express=require(_0x2245('0x3'));var router=express[_0x2245('0x4')]();var fs_extra=require(_0x2245('0x5'));var auth=require(_0x2245('0x6'));var interaction=require(_0x2245('0x7'));var config=require(_0x2245('0x8'));var controller=require(_0x2245('0x9'));router[_0x2245('0xa')]('/',auth['isAuthenticated'](),controller[_0x2245('0xb')]);router[_0x2245('0xa')]('/:id',auth[_0x2245('0xc')](),controller[_0x2245('0xd')]);router[_0x2245('0xe')]('/',auth[_0x2245('0xc')](),controller[_0x2245('0xf')]);router['put'](_0x2245('0x10'),auth['isAuthenticated'](),controller[_0x2245('0x11')]);router[_0x2245('0x12')](_0x2245('0x10'),auth['isAuthenticated'](),controller[_0x2245('0x13')]);module[_0x2245('0x14')]=router; \ No newline at end of file +var _0x8653=['update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','put','/:id'];(function(_0x19042c,_0x247e48){var _0x55400f=function(_0x2902f4){while(--_0x2902f4){_0x19042c['push'](_0x19042c['shift']());}};_0x55400f(++_0x247e48);}(_0x8653,0x1a0));var _0x3865=function(_0x54447b,_0xe934ea){_0x54447b=_0x54447b-0x0;var _0x23663e=_0x8653[_0x54447b];return _0x23663e;};'use strict';var multer=require(_0x3865('0x0'));var util=require(_0x3865('0x1'));var path=require(_0x3865('0x2'));var timeout=require('connect-timeout');var express=require(_0x3865('0x3'));var router=express['Router']();var fs_extra=require(_0x3865('0x4'));var auth=require(_0x3865('0x5'));var interaction=require(_0x3865('0x6'));var config=require(_0x3865('0x7'));var controller=require(_0x3865('0x8'));router[_0x3865('0x9')]('/',auth[_0x3865('0xa')](),controller[_0x3865('0xb')]);router[_0x3865('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3865('0xc')]);router[_0x3865('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3865('0xe')](_0x3865('0xf'),auth[_0x3865('0xa')](),controller[_0x3865('0x10')]);router[_0x3865('0x11')](_0x3865('0xf'),auth[_0x3865('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 832964f..4425fe8 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 _0xc6cf=['sequelize','ENUM','string','variable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x1cdf61,_0x4c23d1){var _0x3376e1=function(_0x4e25f0){while(--_0x4e25f0){_0x1cdf61['push'](_0x1cdf61['shift']());}};_0x3376e1(++_0x4c23d1);}(_0xc6cf,0x68));var _0xfc6c=function(_0x518c60,_0x5a27a6){_0x518c60=_0x518c60-0x0;var _0x38c446=_0xc6cf[_0x518c60];return _0x38c446;};'use strict';var Sequelize=require(_0xfc6c('0x0'));module['exports']={'type':{'type':Sequelize[_0xfc6c('0x1')](_0xfc6c('0x2'),_0xfc6c('0x3'),'customVariable',_0xfc6c('0x4'),_0xfc6c('0x5')),'defaultValue':_0xfc6c('0x2')},'content':{'type':Sequelize[_0xfc6c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfc6c('0x1')](_0xfc6c('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xfc6c('0x6')]},'idField':{'type':Sequelize[_0xfc6c('0x6')]},'nameField':{'type':Sequelize[_0xfc6c('0x6')]},'customField':{'type':Sequelize[_0xfc6c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6315=['keyValue','picklist','variable','STRING','BOOLEAN','sequelize','ENUM','string','customVariable'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6315,0x191));var _0x5631=function(_0x36d15f,_0x35e2a0){_0x36d15f=_0x36d15f-0x0;var _0x20c8ea=_0x6315[_0x36d15f];return _0x20c8ea;};'use strict';var Sequelize=require(_0x5631('0x0'));module['exports']={'type':{'type':Sequelize[_0x5631('0x1')](_0x5631('0x2'),'variable',_0x5631('0x3'),_0x5631('0x4'),_0x5631('0x5')),'defaultValue':_0x5631('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5631('0x1')]('string',_0x5631('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x5631('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5631('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index ed6a5d7..5ef993b 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 _0x6040=['offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','Dynamics365Field','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x49712e,_0x4d19e5){var _0x24b4e0=function(_0x2ae927){while(--_0x2ae927){_0x49712e['push'](_0x49712e['shift']());}};_0x24b4e0(++_0x4d19e5);}(_0x6040,0x1b5));var _0x0604=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0x6040[_0x412e27];return _0x53da42;};'use strict';var emlformat=require(_0x0604('0x0'));var rimraf=require(_0x0604('0x1'));var zipdir=require(_0x0604('0x2'));var jsonpatch=require(_0x0604('0x3'));var rp=require(_0x0604('0x4'));var moment=require(_0x0604('0x5'));var BPromise=require(_0x0604('0x6'));var Mustache=require(_0x0604('0x7'));var util=require('util');var path=require(_0x0604('0x8'));var sox=require(_0x0604('0x9'));var csv=require(_0x0604('0xa'));var ejs=require(_0x0604('0xb'));var fs=require('fs');var fs_extra=require(_0x0604('0xc'));var _=require(_0x0604('0xd'));var squel=require(_0x0604('0xe'));var crypto=require(_0x0604('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0604('0xa'));var querystring=require(_0x0604('0x10'));var Papa=require('papaparse');var Redis=require(_0x0604('0x11'));var authService=require(_0x0604('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0604('0x13'));var hardwareService=require(_0x0604('0x14'));var logger=require(_0x0604('0x15'))(_0x0604('0x16'));var utils=require(_0x0604('0x17'));var config=require(_0x0604('0x18'));var licenseUtil=require(_0x0604('0x19'));var db=require(_0x0604('0x1a'))['db'];function respondWithStatusCode(_0x572411,_0x13bff9){_0x13bff9=_0x13bff9||0xcc;return function(_0x5e0ed7){if(_0x5e0ed7){return _0x572411[_0x0604('0x1b')](_0x13bff9);}return _0x572411[_0x0604('0x1c')](_0x13bff9)[_0x0604('0x1d')]();};}function respondWithResult(_0x59926c,_0x281e85){_0x281e85=_0x281e85||0xc8;return function(_0x24b16e){if(_0x24b16e){return _0x59926c['status'](_0x281e85)[_0x0604('0x1e')](_0x24b16e);}};}function respondWithFilteredResult(_0x3f6f44,_0x3a67db){return function(_0x339a0d){if(_0x339a0d){var _0x3acfc4=typeof _0x3a67db[_0x0604('0x1f')]===_0x0604('0x20')&&typeof _0x3a67db[_0x0604('0x21')]===_0x0604('0x20');var _0x1be0a2=_0x339a0d[_0x0604('0x22')];var _0x431108=_0x3acfc4?0x0:_0x3a67db[_0x0604('0x1f')];var _0x311d75=_0x3acfc4?_0x339a0d[_0x0604('0x22')]:_0x3a67db['offset']+_0x3a67db[_0x0604('0x21')];var _0x537396;if(_0x311d75>=_0x1be0a2){_0x311d75=_0x1be0a2;_0x537396=0xc8;}else{_0x537396=0xce;}_0x3f6f44[_0x0604('0x1c')](_0x537396);return _0x3f6f44['set'](_0x0604('0x23'),_0x431108+'-'+_0x311d75+'/'+_0x1be0a2)[_0x0604('0x1e')](_0x339a0d);}return null;};}function patchUpdates(_0x558b1a){return function(_0x12c6dd){try{jsonpatch[_0x0604('0x24')](_0x12c6dd,_0x558b1a,!![]);}catch(_0x345af1){return BPromise[_0x0604('0x25')](_0x345af1);}return _0x12c6dd[_0x0604('0x26')]();};}function saveUpdates(_0x2b353a,_0x39afd0){return function(_0x12515e){if(_0x12515e){return _0x12515e[_0x0604('0x27')](_0x2b353a)[_0x0604('0x28')](function(_0x483ce8){return _0x483ce8;});}return null;};}function removeEntity(_0x54773d,_0x66ea78){return function(_0x2905bd){if(_0x2905bd){return _0x2905bd['destroy']()['then'](function(){_0x54773d[_0x0604('0x1c')](0xcc)[_0x0604('0x1d')]();});}};}function handleEntityNotFound(_0x191e01,_0x1b7373){return function(_0x3432e0){if(!_0x3432e0){_0x191e01[_0x0604('0x1b')](0x194);}return _0x3432e0;};}function handleError(_0x193247,_0x5adda2){_0x5adda2=_0x5adda2||0x1f4;return function(_0x5c4df3){logger[_0x0604('0x29')](_0x5c4df3[_0x0604('0x2a')]);if(_0x5c4df3[_0x0604('0x2b')]){delete _0x5c4df3['name'];}_0x193247[_0x0604('0x1c')](_0x5adda2)['send'](_0x5c4df3);};}exports[_0x0604('0x2c')]=function(_0x2a0b93,_0x37ed00){var _0x708105={},_0x122786={},_0x5635e3={'count':0x0,'rows':[]};var _0x236ff4=_[_0x0604('0x2d')](db[_0x0604('0x2e')][_0x0604('0x2f')],function(_0x498ebe){return{'name':_0x498ebe['fieldName'],'type':_0x498ebe['type'][_0x0604('0x30')]};});_0x122786['model']=_[_0x0604('0x2d')](_0x236ff4,_0x0604('0x2b'));_0x122786[_0x0604('0x31')]=_[_0x0604('0x32')](_0x2a0b93[_0x0604('0x31')]);_0x122786[_0x0604('0x33')]=_[_0x0604('0x34')](_0x122786[_0x0604('0x35')],_0x122786[_0x0604('0x31')]);_0x708105['attributes']=_[_0x0604('0x34')](_0x122786['model'],qs[_0x0604('0x36')](_0x2a0b93[_0x0604('0x31')][_0x0604('0x36')]));_0x708105[_0x0604('0x37')]=_0x708105['attributes']['length']?_0x708105['attributes']:_0x122786[_0x0604('0x35')];if(!_0x2a0b93[_0x0604('0x31')]['hasOwnProperty'](_0x0604('0x38'))){_0x708105[_0x0604('0x21')]=qs[_0x0604('0x21')](_0x2a0b93[_0x0604('0x31')][_0x0604('0x21')]);_0x708105[_0x0604('0x1f')]=qs['offset'](_0x2a0b93['query'][_0x0604('0x1f')]);}_0x708105[_0x0604('0x39')]=qs[_0x0604('0x3a')](_0x2a0b93[_0x0604('0x31')][_0x0604('0x3a')]);_0x708105[_0x0604('0x3b')]=qs[_0x0604('0x33')](_[_0x0604('0x3c')](_0x2a0b93[_0x0604('0x31')],_0x122786[_0x0604('0x33')]),_0x236ff4);if(_0x2a0b93['query']['filter']){_0x708105[_0x0604('0x3b')]=_[_0x0604('0x3d')](_0x708105[_0x0604('0x3b')],{'$or':_['map'](_0x236ff4,function(_0x56ea5f){if(_0x56ea5f[_0x0604('0x3e')]!==_0x0604('0x3f')){var _0x20a5b5={};_0x20a5b5[_0x56ea5f[_0x0604('0x2b')]]={'$like':'%'+_0x2a0b93['query'][_0x0604('0x40')]+'%'};return _0x20a5b5;}})});}_0x708105=_[_0x0604('0x3d')]({},_0x708105,_0x2a0b93[_0x0604('0x41')]);var _0x1392cc={'where':_0x708105[_0x0604('0x3b')]};return db[_0x0604('0x2e')][_0x0604('0x22')](_0x1392cc)[_0x0604('0x28')](function(_0x541296){_0x5635e3[_0x0604('0x22')]=_0x541296;if(_0x2a0b93[_0x0604('0x31')][_0x0604('0x42')]){_0x708105[_0x0604('0x43')]=[{'all':!![]}];}return db[_0x0604('0x2e')][_0x0604('0x44')](_0x708105);})[_0x0604('0x28')](function(_0xe14e65){_0x5635e3[_0x0604('0x45')]=_0xe14e65;return _0x5635e3;})[_0x0604('0x28')](respondWithFilteredResult(_0x37ed00,_0x708105))[_0x0604('0x46')](handleError(_0x37ed00,null));};exports[_0x0604('0x47')]=function(_0x4d142,_0x5f133e){var _0x2475ad={'raw':!![],'where':{'id':_0x4d142[_0x0604('0x48')]['id']}},_0x2ecf5f={};_0x2ecf5f[_0x0604('0x35')]=_['keys'](db[_0x0604('0x2e')][_0x0604('0x2f')]);_0x2ecf5f[_0x0604('0x31')]=_[_0x0604('0x32')](_0x4d142[_0x0604('0x31')]);_0x2ecf5f['filters']=_[_0x0604('0x34')](_0x2ecf5f[_0x0604('0x35')],_0x2ecf5f['query']);_0x2475ad['attributes']=_[_0x0604('0x34')](_0x2ecf5f[_0x0604('0x35')],qs['fields'](_0x4d142['query'][_0x0604('0x36')]));_0x2475ad['attributes']=_0x2475ad['attributes'][_0x0604('0x49')]?_0x2475ad[_0x0604('0x37')]:_0x2ecf5f['model'];if(_0x4d142[_0x0604('0x31')][_0x0604('0x42')]){_0x2475ad['include']=[{'all':!![]}];}_0x2475ad=_[_0x0604('0x3d')]({},_0x2475ad,_0x4d142[_0x0604('0x41')]);return db[_0x0604('0x2e')]['find'](_0x2475ad)['then'](handleEntityNotFound(_0x5f133e,null))[_0x0604('0x28')](respondWithResult(_0x5f133e,null))[_0x0604('0x46')](handleError(_0x5f133e,null));};exports['create']=function(_0x36dc1a,_0x5c1bb9){return db[_0x0604('0x2e')][_0x0604('0x4a')](_0x36dc1a[_0x0604('0x4b')],{})[_0x0604('0x28')](respondWithResult(_0x5c1bb9,0xc9))[_0x0604('0x46')](handleError(_0x5c1bb9,null));};exports[_0x0604('0x27')]=function(_0x5f8418,_0x5b978a){if(_0x5f8418[_0x0604('0x4b')]['id']){delete _0x5f8418[_0x0604('0x4b')]['id'];}return db[_0x0604('0x2e')]['find']({'where':{'id':_0x5f8418[_0x0604('0x48')]['id']}})[_0x0604('0x28')](handleEntityNotFound(_0x5b978a,null))[_0x0604('0x28')](saveUpdates(_0x5f8418[_0x0604('0x4b')],null))[_0x0604('0x28')](respondWithResult(_0x5b978a,null))[_0x0604('0x46')](handleError(_0x5b978a,null));};exports[_0x0604('0x4c')]=function(_0xaead4b,_0x58d5ff){return db[_0x0604('0x2e')][_0x0604('0x4d')]({'where':{'id':_0xaead4b[_0x0604('0x48')]['id']}})[_0x0604('0x28')](handleEntityNotFound(_0x58d5ff,null))[_0x0604('0x28')](removeEntity(_0x58d5ff,null))[_0x0604('0x46')](handleError(_0x58d5ff,null));}; \ No newline at end of file +var _0x3d88=['model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','Dynamics365Field','fieldName','type','query','keys','filters','intersection'];(function(_0x1599bf,_0x3cc1fb){var _0x2470f2=function(_0x555023){while(--_0x555023){_0x1599bf['push'](_0x1599bf['shift']());}};_0x2470f2(++_0x3cc1fb);}(_0x3d88,0xee));var _0x83d8=function(_0x3f7878,_0x2a34a5){_0x3f7878=_0x3f7878-0x0;var _0x1233fd=_0x3d88[_0x3f7878];return _0x1233fd;};'use strict';var emlformat=require(_0x83d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x83d8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x83d8('0x2'));var BPromise=require(_0x83d8('0x3'));var Mustache=require(_0x83d8('0x4'));var util=require(_0x83d8('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x83d8('0x6'));var ejs=require(_0x83d8('0x7'));var fs=require('fs');var fs_extra=require(_0x83d8('0x8'));var _=require(_0x83d8('0x9'));var squel=require('squel');var crypto=require(_0x83d8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x83d8('0xb'));var toCsv=require(_0x83d8('0x6'));var querystring=require(_0x83d8('0xc'));var Papa=require('papaparse');var Redis=require(_0x83d8('0xd'));var authService=require(_0x83d8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x83d8('0xf'));var hardwareService=require(_0x83d8('0x10'));var logger=require(_0x83d8('0x11'))(_0x83d8('0x12'));var utils=require(_0x83d8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x83d8('0x14'));var db=require(_0x83d8('0x15'))['db'];function respondWithStatusCode(_0x191826,_0x3c9ea4){_0x3c9ea4=_0x3c9ea4||0xcc;return function(_0x8ddba4){if(_0x8ddba4){return _0x191826[_0x83d8('0x16')](_0x3c9ea4);}return _0x191826[_0x83d8('0x17')](_0x3c9ea4)[_0x83d8('0x18')]();};}function respondWithResult(_0xa5a666,_0x11cf22){_0x11cf22=_0x11cf22||0xc8;return function(_0x56196c){if(_0x56196c){return _0xa5a666[_0x83d8('0x17')](_0x11cf22)['json'](_0x56196c);}};}function respondWithFilteredResult(_0x249200,_0x14551c){return function(_0x2dab7e){if(_0x2dab7e){var _0x490cfb=typeof _0x14551c['offset']===_0x83d8('0x19')&&typeof _0x14551c[_0x83d8('0x1a')]===_0x83d8('0x19');var _0x2f112c=_0x2dab7e[_0x83d8('0x1b')];var _0x4c02d8=_0x490cfb?0x0:_0x14551c[_0x83d8('0x1c')];var _0x3c38a9=_0x490cfb?_0x2dab7e[_0x83d8('0x1b')]:_0x14551c[_0x83d8('0x1c')]+_0x14551c[_0x83d8('0x1a')];var _0x4ca7d0;if(_0x3c38a9>=_0x2f112c){_0x3c38a9=_0x2f112c;_0x4ca7d0=0xc8;}else{_0x4ca7d0=0xce;}_0x249200[_0x83d8('0x17')](_0x4ca7d0);return _0x249200[_0x83d8('0x1d')](_0x83d8('0x1e'),_0x4c02d8+'-'+_0x3c38a9+'/'+_0x2f112c)[_0x83d8('0x1f')](_0x2dab7e);}return null;};}function patchUpdates(_0xee58c){return function(_0x1fd22e){try{jsonpatch[_0x83d8('0x20')](_0x1fd22e,_0xee58c,!![]);}catch(_0x426966){return BPromise[_0x83d8('0x21')](_0x426966);}return _0x1fd22e[_0x83d8('0x22')]();};}function saveUpdates(_0x3ec253,_0x1e2800){return function(_0x2ea6a1){if(_0x2ea6a1){return _0x2ea6a1[_0x83d8('0x23')](_0x3ec253)[_0x83d8('0x24')](function(_0x1ec418){return _0x1ec418;});}return null;};}function removeEntity(_0xf54250,_0x1ef54b){return function(_0x2362bd){if(_0x2362bd){return _0x2362bd[_0x83d8('0x25')]()[_0x83d8('0x24')](function(){_0xf54250[_0x83d8('0x17')](0xcc)[_0x83d8('0x18')]();});}};}function handleEntityNotFound(_0x5b138b,_0x343aac){return function(_0x51affe){if(!_0x51affe){_0x5b138b[_0x83d8('0x16')](0x194);}return _0x51affe;};}function handleError(_0x4490b4,_0x306ec8){_0x306ec8=_0x306ec8||0x1f4;return function(_0x17a2d0){logger['error'](_0x17a2d0[_0x83d8('0x26')]);if(_0x17a2d0['name']){delete _0x17a2d0[_0x83d8('0x27')];}_0x4490b4['status'](_0x306ec8)[_0x83d8('0x28')](_0x17a2d0);};}exports[_0x83d8('0x29')]=function(_0x494be7,_0x556d9d){var _0x12ef0e={},_0x136cbb={},_0xa5c1fb={'count':0x0,'rows':[]};var _0x102b2b=_[_0x83d8('0x2a')](db[_0x83d8('0x2b')]['rawAttributes'],function(_0x2724ea){return{'name':_0x2724ea[_0x83d8('0x2c')],'type':_0x2724ea[_0x83d8('0x2d')]['key']};});_0x136cbb['model']=_[_0x83d8('0x2a')](_0x102b2b,_0x83d8('0x27'));_0x136cbb[_0x83d8('0x2e')]=_[_0x83d8('0x2f')](_0x494be7[_0x83d8('0x2e')]);_0x136cbb[_0x83d8('0x30')]=_[_0x83d8('0x31')](_0x136cbb[_0x83d8('0x32')],_0x136cbb['query']);_0x12ef0e[_0x83d8('0x33')]=_['intersection'](_0x136cbb[_0x83d8('0x32')],qs[_0x83d8('0x34')](_0x494be7['query'][_0x83d8('0x34')]));_0x12ef0e[_0x83d8('0x33')]=_0x12ef0e[_0x83d8('0x33')][_0x83d8('0x35')]?_0x12ef0e[_0x83d8('0x33')]:_0x136cbb[_0x83d8('0x32')];if(!_0x494be7[_0x83d8('0x2e')][_0x83d8('0x36')]('nolimit')){_0x12ef0e['limit']=qs['limit'](_0x494be7['query'][_0x83d8('0x1a')]);_0x12ef0e[_0x83d8('0x1c')]=qs[_0x83d8('0x1c')](_0x494be7[_0x83d8('0x2e')]['offset']);}_0x12ef0e[_0x83d8('0x37')]=qs[_0x83d8('0x38')](_0x494be7[_0x83d8('0x2e')][_0x83d8('0x38')]);_0x12ef0e[_0x83d8('0x39')]=qs['filters'](_['pick'](_0x494be7[_0x83d8('0x2e')],_0x136cbb['filters']),_0x102b2b);if(_0x494be7['query'][_0x83d8('0x3a')]){_0x12ef0e[_0x83d8('0x39')]=_[_0x83d8('0x3b')](_0x12ef0e['where'],{'$or':_['map'](_0x102b2b,function(_0x533fe4){if(_0x533fe4[_0x83d8('0x2d')]!==_0x83d8('0x3c')){var _0x2e8ef8={};_0x2e8ef8[_0x533fe4[_0x83d8('0x27')]]={'$like':'%'+_0x494be7[_0x83d8('0x2e')][_0x83d8('0x3a')]+'%'};return _0x2e8ef8;}})});}_0x12ef0e=_[_0x83d8('0x3b')]({},_0x12ef0e,_0x494be7[_0x83d8('0x3d')]);var _0x2e5588={'where':_0x12ef0e[_0x83d8('0x39')]};return db[_0x83d8('0x2b')][_0x83d8('0x1b')](_0x2e5588)['then'](function(_0x6c9c3d){_0xa5c1fb[_0x83d8('0x1b')]=_0x6c9c3d;if(_0x494be7[_0x83d8('0x2e')][_0x83d8('0x3e')]){_0x12ef0e[_0x83d8('0x3f')]=[{'all':!![]}];}return db[_0x83d8('0x2b')][_0x83d8('0x40')](_0x12ef0e);})[_0x83d8('0x24')](function(_0x31fee3){_0xa5c1fb[_0x83d8('0x41')]=_0x31fee3;return _0xa5c1fb;})[_0x83d8('0x24')](respondWithFilteredResult(_0x556d9d,_0x12ef0e))[_0x83d8('0x42')](handleError(_0x556d9d,null));};exports['show']=function(_0x475717,_0x111e3f){var _0x2d3ab8={'raw':!![],'where':{'id':_0x475717[_0x83d8('0x43')]['id']}},_0x2cd17f={};_0x2cd17f[_0x83d8('0x32')]=_[_0x83d8('0x2f')](db['Dynamics365Field'][_0x83d8('0x44')]);_0x2cd17f[_0x83d8('0x2e')]=_['keys'](_0x475717['query']);_0x2cd17f[_0x83d8('0x30')]=_[_0x83d8('0x31')](_0x2cd17f[_0x83d8('0x32')],_0x2cd17f[_0x83d8('0x2e')]);_0x2d3ab8[_0x83d8('0x33')]=_[_0x83d8('0x31')](_0x2cd17f[_0x83d8('0x32')],qs[_0x83d8('0x34')](_0x475717[_0x83d8('0x2e')][_0x83d8('0x34')]));_0x2d3ab8[_0x83d8('0x33')]=_0x2d3ab8[_0x83d8('0x33')]['length']?_0x2d3ab8[_0x83d8('0x33')]:_0x2cd17f[_0x83d8('0x32')];if(_0x475717[_0x83d8('0x2e')][_0x83d8('0x3e')]){_0x2d3ab8[_0x83d8('0x3f')]=[{'all':!![]}];}_0x2d3ab8=_[_0x83d8('0x3b')]({},_0x2d3ab8,_0x475717[_0x83d8('0x3d')]);return db[_0x83d8('0x2b')][_0x83d8('0x45')](_0x2d3ab8)[_0x83d8('0x24')](handleEntityNotFound(_0x111e3f,null))[_0x83d8('0x24')](respondWithResult(_0x111e3f,null))['catch'](handleError(_0x111e3f,null));};exports[_0x83d8('0x46')]=function(_0x245651,_0x3bee48){return db['Dynamics365Field'][_0x83d8('0x46')](_0x245651[_0x83d8('0x47')],{})['then'](respondWithResult(_0x3bee48,0xc9))[_0x83d8('0x42')](handleError(_0x3bee48,null));};exports[_0x83d8('0x23')]=function(_0x3abb84,_0x38d842){if(_0x3abb84['body']['id']){delete _0x3abb84[_0x83d8('0x47')]['id'];}return db[_0x83d8('0x2b')][_0x83d8('0x45')]({'where':{'id':_0x3abb84[_0x83d8('0x43')]['id']}})['then'](handleEntityNotFound(_0x38d842,null))[_0x83d8('0x24')](saveUpdates(_0x3abb84[_0x83d8('0x47')],null))[_0x83d8('0x24')](respondWithResult(_0x38d842,null))['catch'](handleError(_0x38d842,null));};exports[_0x83d8('0x25')]=function(_0x52902e,_0x5084f6){return db[_0x83d8('0x2b')]['find']({'where':{'id':_0x52902e[_0x83d8('0x43')]['id']}})[_0x83d8('0x24')](handleEntityNotFound(_0x5084f6,null))[_0x83d8('0x24')](removeEntity(_0x5084f6,null))['catch'](handleError(_0x5084f6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 839b872..9529e87 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 _0x4af2=['api','moment','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x5fce1a,_0x15010d){var _0x18c511=function(_0x566919){while(--_0x566919){_0x5fce1a['push'](_0x5fce1a['shift']());}};_0x18c511(++_0x15010d);}(_0x4af2,0xf9));var _0x24af=function(_0x36e3b2,_0x4f7521){_0x36e3b2=_0x36e3b2-0x0;var _0x16940f=_0x4af2[_0x36e3b2];return _0x16940f;};'use strict';var _=require(_0x24af('0x0'));var util=require(_0x24af('0x1'));var logger=require(_0x24af('0x2'))(_0x24af('0x3'));var moment=require(_0x24af('0x4'));var BPromise=require('bluebird');var rp=require(_0x24af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x24af('0x6'));var config=require(_0x24af('0x7'));var attributes=require(_0x24af('0x8'));module['exports']=function(_0x1d82ed,_0x34c45f){return _0x1d82ed[_0x24af('0x9')](_0x24af('0xa'),attributes,{'tableName':_0x24af('0xb'),'paranoid':![],'indexes':[{'name':_0x24af('0xc'),'fields':['idField',_0x24af('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x803c=['define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','path','./intDynamics365Field.attributes'];(function(_0x4ff3d1,_0x15c737){var _0x32af0c=function(_0x26acfe){while(--_0x26acfe){_0x4ff3d1['push'](_0x4ff3d1['shift']());}};_0x32af0c(++_0x15c737);}(_0x803c,0x72));var _0xc803=function(_0x515d05,_0x330f58){_0x515d05=_0x515d05-0x0;var _0x1ea212=_0x803c[_0x515d05];return _0x1ea212;};'use strict';var _=require(_0xc803('0x0'));var util=require('util');var logger=require(_0xc803('0x1'))(_0xc803('0x2'));var moment=require(_0xc803('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc803('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc803('0x5'));module['exports']=function(_0xdf6484,_0x234f62){return _0xdf6484[_0xc803('0x6')](_0xc803('0x7'),attributes,{'tableName':_0xc803('0x8'),'paranoid':![],'indexes':[{'name':_0xc803('0x9'),'fields':[_0xc803('0xa'),_0xc803('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 71c8b0d..2899c84 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 _0xa7ec=['../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x6560e0,_0x18c3ab){var _0xbbb576=function(_0x1a1d8c){while(--_0x1a1d8c){_0x6560e0['push'](_0x6560e0['shift']());}};_0xbbb576(++_0x18c3ab);}(_0xa7ec,0x13a));var _0xca7e=function(_0x33afd9,_0x37f679){_0x33afd9=_0x33afd9-0x0;var _0x4bc657=_0xa7ec[_0x33afd9];return _0x4bc657;};'use strict';var _=require(_0xca7e('0x0'));var util=require(_0xca7e('0x1'));var moment=require(_0xca7e('0x2'));var BPromise=require(_0xca7e('0x3'));var rs=require(_0xca7e('0x4'));var fs=require('fs');var Redis=require(_0xca7e('0x5'));var db=require(_0xca7e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xca7e('0x7'));var config=require(_0xca7e('0x8'));var jayson=require(_0xca7e('0x9'));var client=jayson[_0xca7e('0xa')][_0xca7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3789fc,_0x458935,_0x316c26){return new BPromise(function(_0x24ab20,_0x15e7c1){return client['request'](_0x3789fc,_0x316c26)[_0xca7e('0xc')](function(_0x45282b){logger[_0xca7e('0xd')](_0xca7e('0xe'),_0x458935,_0xca7e('0xf'));logger[_0xca7e('0x10')](_0xca7e('0x11'),_0x458935,_0xca7e('0xf'),JSON[_0xca7e('0x12')](_0x45282b));if(_0x45282b[_0xca7e('0x13')]){if(_0x45282b[_0xca7e('0x13')][_0xca7e('0x14')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x458935,_0x45282b[_0xca7e('0x13')][_0xca7e('0x15')]);return _0x15e7c1(_0x45282b[_0xca7e('0x13')]['message']);}logger[_0xca7e('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x458935,_0x45282b[_0xca7e('0x13')][_0xca7e('0x15')]);return _0x24ab20(_0x45282b[_0xca7e('0x13')][_0xca7e('0x15')]);}else{logger['info'](_0xca7e('0xe'),_0x458935,_0xca7e('0xf'));_0x24ab20(_0x45282b[_0xca7e('0x16')][_0xca7e('0x15')]);}})['catch'](function(_0x162009){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x458935,_0x162009);_0x15e7c1(_0x162009);});});} \ No newline at end of file +var _0x04e3=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x58b62c,_0x563a8e){var _0x471ade=function(_0x515dc7){while(--_0x515dc7){_0x58b62c['push'](_0x58b62c['shift']());}};_0x471ade(++_0x563a8e);}(_0x04e3,0x145));var _0x304e=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x04e3[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x304e('0x0'));var util=require(_0x304e('0x1'));var moment=require(_0x304e('0x2'));var BPromise=require(_0x304e('0x3'));var rs=require(_0x304e('0x4'));var fs=require('fs');var Redis=require(_0x304e('0x5'));var db=require(_0x304e('0x6'))['db'];var utils=require(_0x304e('0x7'));var logger=require(_0x304e('0x8'))('rpc');var config=require(_0x304e('0x9'));var jayson=require(_0x304e('0xa'));var client=jayson[_0x304e('0xb')][_0x304e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x175f2b,_0x273f73,_0x5af592){return new BPromise(function(_0x4c432e,_0x25b47d){return client[_0x304e('0xd')](_0x175f2b,_0x5af592)[_0x304e('0xe')](function(_0x51b883){logger[_0x304e('0xf')](_0x304e('0x10'),_0x273f73,_0x304e('0x11'));logger[_0x304e('0x12')](_0x304e('0x13'),_0x273f73,_0x304e('0x11'),JSON[_0x304e('0x14')](_0x51b883));if(_0x51b883[_0x304e('0x15')]){if(_0x51b883[_0x304e('0x15')][_0x304e('0x16')]===0x1f4){logger['error'](_0x304e('0x10'),_0x273f73,_0x51b883[_0x304e('0x15')]['message']);return _0x25b47d(_0x51b883[_0x304e('0x15')]['message']);}logger[_0x304e('0x15')](_0x304e('0x10'),_0x273f73,_0x51b883[_0x304e('0x15')][_0x304e('0x17')]);return _0x4c432e(_0x51b883[_0x304e('0x15')][_0x304e('0x17')]);}else{logger[_0x304e('0xf')](_0x304e('0x10'),_0x273f73,'request\x20sent');_0x4c432e(_0x51b883[_0x304e('0x18')][_0x304e('0x17')]);}})['catch'](function(_0x4e76e4){logger[_0x304e('0x15')](_0x304e('0x10'),_0x273f73,_0x4e76e4);_0x25b47d(_0x4e76e4);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index dbefe94..cc42e0d 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 _0x4fa0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x4fa0,0xeb));var _0x04fa=function(_0x1186ba,_0x421a86){_0x1186ba=_0x1186ba-0x0;var _0x13a347=_0x4fa0[_0x1186ba];return _0x13a347;};'use strict';var multer=require(_0x04fa('0x0'));var util=require(_0x04fa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x04fa('0x2'));var router=express[_0x04fa('0x3')]();var fs_extra=require(_0x04fa('0x4'));var auth=require(_0x04fa('0x5'));var interaction=require(_0x04fa('0x6'));var config=require(_0x04fa('0x7'));var controller=require(_0x04fa('0x8'));router[_0x04fa('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x04fa('0x9')](_0x04fa('0xa'),auth[_0x04fa('0xb')](),controller[_0x04fa('0xc')]);router[_0x04fa('0x9')]('/:id/configurations',auth[_0x04fa('0xb')](),controller[_0x04fa('0xd')]);router[_0x04fa('0x9')](_0x04fa('0xe'),auth[_0x04fa('0xb')](),controller[_0x04fa('0xf')]);router['post']('/',auth[_0x04fa('0xb')](),controller[_0x04fa('0x10')]);router[_0x04fa('0x11')](_0x04fa('0x12'),auth[_0x04fa('0xb')](),controller[_0x04fa('0x13')]);router[_0x04fa('0x14')](_0x04fa('0xa'),auth[_0x04fa('0xb')](),controller['update']);router[_0x04fa('0x15')](_0x04fa('0xa'),auth[_0x04fa('0xb')](),controller[_0x04fa('0x16')]);module[_0x04fa('0x17')]=router; \ No newline at end of file +var _0x5b21=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x310832,_0xe72c7e){var _0x103f74=function(_0x4a217c){while(--_0x4a217c){_0x310832['push'](_0x310832['shift']());}};_0x103f74(++_0xe72c7e);}(_0x5b21,0x1a8));var _0x15b2=function(_0x1835f4,_0x1447c5){_0x1835f4=_0x1835f4-0x0;var _0x4ec90d=_0x5b21[_0x1835f4];return _0x4ec90d;};'use strict';var multer=require(_0x15b2('0x0'));var util=require('util');var path=require(_0x15b2('0x1'));var timeout=require('connect-timeout');var express=require(_0x15b2('0x2'));var router=express['Router']();var fs_extra=require(_0x15b2('0x3'));var auth=require(_0x15b2('0x4'));var interaction=require(_0x15b2('0x5'));var config=require(_0x15b2('0x6'));var controller=require(_0x15b2('0x7'));router[_0x15b2('0x8')]('/',auth[_0x15b2('0x9')](),controller[_0x15b2('0xa')]);router[_0x15b2('0x8')](_0x15b2('0xb'),auth[_0x15b2('0x9')](),controller[_0x15b2('0xc')]);router[_0x15b2('0x8')](_0x15b2('0xd'),auth['isAuthenticated'](),controller[_0x15b2('0xe')]);router[_0x15b2('0x8')](_0x15b2('0xf'),auth[_0x15b2('0x9')](),controller[_0x15b2('0x10')]);router[_0x15b2('0x11')]('/',auth[_0x15b2('0x9')](),controller['create']);router[_0x15b2('0x11')](_0x15b2('0xd'),auth['isAuthenticated'](),controller[_0x15b2('0x12')]);router[_0x15b2('0x13')](_0x15b2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x15b2('0x14')](_0x15b2('0xb'),auth[_0x15b2('0x9')](),controller[_0x15b2('0x15')]);module[_0x15b2('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 b3d7e6f..ddf2dde 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 _0xcf2f=['exports','STRING','remoteUri','sequelize'];(function(_0x4ca828,_0x5292cb){var _0x5e27ee=function(_0x4aa9d7){while(--_0x4aa9d7){_0x4ca828['push'](_0x4ca828['shift']());}};_0x5e27ee(++_0x5292cb);}(_0xcf2f,0xa7));var _0xfcf2=function(_0xb7ab9,_0xd8c43){_0xb7ab9=_0xb7ab9-0x0;var _0xbfe691=_0xcf2f[_0xb7ab9];return _0xbfe691;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'name':{'type':Sequelize[_0xfcf2('0x2')]},'description':{'type':Sequelize[_0xfcf2('0x2')]},'username':{'type':Sequelize[_0xfcf2('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfcf2('0x2')]},'remoteUri':{'type':Sequelize[_0xfcf2('0x2')],'unique':_0xfcf2('0x3')},'serverUrl':{'type':Sequelize[_0xfcf2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7708=['sequelize','exports','STRING','remoteUri'];(function(_0x361e45,_0x57192d){var _0x25ecb9=function(_0x3d0ba2){while(--_0x3d0ba2){_0x361e45['push'](_0x361e45['shift']());}};_0x25ecb9(++_0x57192d);}(_0x7708,0x188));var _0x8770=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x7708[_0x18cd5b];return _0x5eaa52;};'use strict';var Sequelize=require(_0x8770('0x0'));module[_0x8770('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8770('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8770('0x3')},'serverUrl':{'type':Sequelize[_0x8770('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 21f59fb..623004e 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 _0x8eeb=['FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','requester','subject','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','FreshdeskAccount','includeAll','findAll','catch','show','find','create','body','params','destroy','getConfigurations','findOne'];(function(_0x3b2782,_0x2eca14){var _0x1a4e9a=function(_0x3cf463){while(--_0x3cf463){_0x3b2782['push'](_0x3b2782['shift']());}};_0x1a4e9a(++_0x2eca14);}(_0x8eeb,0x183));var _0xb8ee=function(_0x3a60bd,_0x11fea7){_0x3a60bd=_0x3a60bd-0x0;var _0x29cc43=_0x8eeb[_0x3a60bd];return _0x29cc43;};'use strict';var emlformat=require(_0xb8ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb8ee('0x1'));var jsonpatch=require(_0xb8ee('0x2'));var rp=require('request-promise');var moment=require(_0xb8ee('0x3'));var BPromise=require(_0xb8ee('0x4'));var Mustache=require(_0xb8ee('0x5'));var util=require(_0xb8ee('0x6'));var path=require(_0xb8ee('0x7'));var sox=require('sox');var csv=require(_0xb8ee('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb8ee('0x9'));var _=require(_0xb8ee('0xa'));var squel=require(_0xb8ee('0xb'));var crypto=require(_0xb8ee('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb8ee('0xd'));var toCsv=require(_0xb8ee('0x8'));var querystring=require(_0xb8ee('0xe'));var Papa=require('papaparse');var Redis=require(_0xb8ee('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb8ee('0x10'));var as=require(_0xb8ee('0x11'));var hardwareService=require(_0xb8ee('0x12'));var logger=require(_0xb8ee('0x13'))(_0xb8ee('0x14'));var utils=require(_0xb8ee('0x15'));var config=require(_0xb8ee('0x16'));var licenseUtil=require(_0xb8ee('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb8ee('0x18'));function respondWithStatusCode(_0x39ca81,_0x181283){_0x181283=_0x181283||0xcc;return function(_0x32ec40){if(_0x32ec40){return _0x39ca81[_0xb8ee('0x19')](_0x181283);}return _0x39ca81[_0xb8ee('0x1a')](_0x181283)['end']();};}function respondWithResult(_0x237f49,_0x28aaa7){_0x28aaa7=_0x28aaa7||0xc8;return function(_0x2af0c5){if(_0x2af0c5){return _0x237f49[_0xb8ee('0x1a')](_0x28aaa7)[_0xb8ee('0x1b')](_0x2af0c5);}};}function respondWithFilteredResult(_0x19f9c9,_0x22b97b){return function(_0x13b79c){if(_0x13b79c){var _0x40be2d=typeof _0x22b97b['offset']===_0xb8ee('0x1c')&&typeof _0x22b97b['limit']==='undefined';var _0x44c535=_0x13b79c[_0xb8ee('0x1d')];var _0x4d9a82=_0x40be2d?0x0:_0x22b97b[_0xb8ee('0x1e')];var _0x369e3e=_0x40be2d?_0x13b79c['count']:_0x22b97b[_0xb8ee('0x1e')]+_0x22b97b[_0xb8ee('0x1f')];var _0xcd3f98;if(_0x369e3e>=_0x44c535){_0x369e3e=_0x44c535;_0xcd3f98=0xc8;}else{_0xcd3f98=0xce;}_0x19f9c9['status'](_0xcd3f98);return _0x19f9c9[_0xb8ee('0x20')](_0xb8ee('0x21'),_0x4d9a82+'-'+_0x369e3e+'/'+_0x44c535)[_0xb8ee('0x1b')](_0x13b79c);}return null;};}function patchUpdates(_0x23a012){return function(_0x177d7a){try{jsonpatch['apply'](_0x177d7a,_0x23a012,!![]);}catch(_0x412035){return BPromise['reject'](_0x412035);}return _0x177d7a[_0xb8ee('0x22')]();};}function saveUpdates(_0x134ddb,_0x44c7c7){return function(_0xa9a4ee){if(_0xa9a4ee){return _0xa9a4ee[_0xb8ee('0x23')](_0x134ddb)[_0xb8ee('0x24')](function(_0x38e80b){return _0x38e80b;});}return null;};}function removeEntity(_0x2c179b,_0x25a972){return function(_0x2d868b){if(_0x2d868b){return _0x2d868b['destroy']()[_0xb8ee('0x24')](function(){_0x2c179b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52bfeb,_0x560160){return function(_0x2c5bd1){if(!_0x2c5bd1){_0x52bfeb[_0xb8ee('0x19')](0x194);}return _0x2c5bd1;};}function handleError(_0x23ecd3,_0x3fadb6){_0x3fadb6=_0x3fadb6||0x1f4;return function(_0x249811){logger[_0xb8ee('0x25')](_0x249811[_0xb8ee('0x26')]);if(_0x249811[_0xb8ee('0x27')]){delete _0x249811['name'];}_0x23ecd3[_0xb8ee('0x1a')](_0x3fadb6)[_0xb8ee('0x28')](_0x249811);};}exports[_0xb8ee('0x29')]=function(_0x1f58a3,_0x5af703){var _0x35e844={},_0x1a643f={},_0x5a50d8={'count':0x0,'rows':[]};var _0x33953a=_[_0xb8ee('0x2a')](db['FreshdeskAccount'][_0xb8ee('0x2b')],function(_0x14a320){return{'name':_0x14a320[_0xb8ee('0x2c')],'type':_0x14a320['type'][_0xb8ee('0x2d')]};});_0x1a643f[_0xb8ee('0x2e')]=_[_0xb8ee('0x2a')](_0x33953a,'name');_0x1a643f['query']=_[_0xb8ee('0x2f')](_0x1f58a3[_0xb8ee('0x30')]);_0x1a643f['filters']=_[_0xb8ee('0x31')](_0x1a643f['model'],_0x1a643f[_0xb8ee('0x30')]);_0x35e844['attributes']=_[_0xb8ee('0x31')](_0x1a643f[_0xb8ee('0x2e')],qs[_0xb8ee('0x32')](_0x1f58a3[_0xb8ee('0x30')][_0xb8ee('0x32')]));_0x35e844['attributes']=_0x35e844['attributes'][_0xb8ee('0x33')]?_0x35e844[_0xb8ee('0x34')]:_0x1a643f[_0xb8ee('0x2e')];if(!_0x1f58a3[_0xb8ee('0x30')][_0xb8ee('0x35')](_0xb8ee('0x36'))){_0x35e844[_0xb8ee('0x1f')]=qs[_0xb8ee('0x1f')](_0x1f58a3[_0xb8ee('0x30')][_0xb8ee('0x1f')]);_0x35e844[_0xb8ee('0x1e')]=qs[_0xb8ee('0x1e')](_0x1f58a3[_0xb8ee('0x30')][_0xb8ee('0x1e')]);}_0x35e844[_0xb8ee('0x37')]=qs[_0xb8ee('0x38')](_0x1f58a3[_0xb8ee('0x30')][_0xb8ee('0x38')]);_0x35e844[_0xb8ee('0x39')]=qs[_0xb8ee('0x3a')](_[_0xb8ee('0x3b')](_0x1f58a3[_0xb8ee('0x30')],_0x1a643f[_0xb8ee('0x3a')]),_0x33953a);if(_0x1f58a3[_0xb8ee('0x30')][_0xb8ee('0x3c')]){_0x35e844['where']=_[_0xb8ee('0x3d')](_0x35e844['where'],{'$or':_[_0xb8ee('0x2a')](_0x33953a,function(_0x1f4a1a){if(_0x1f4a1a[_0xb8ee('0x3e')]!==_0xb8ee('0x3f')){var _0x343bb1={};_0x343bb1[_0x1f4a1a['name']]={'$like':'%'+_0x1f58a3['query']['filter']+'%'};return _0x343bb1;}})});}_0x35e844=_[_0xb8ee('0x3d')]({},_0x35e844,_0x1f58a3[_0xb8ee('0x40')]);var _0x5f22c1={'where':_0x35e844[_0xb8ee('0x39')]};return db[_0xb8ee('0x41')]['count'](_0x5f22c1)[_0xb8ee('0x24')](function(_0x5a3587){_0x5a50d8[_0xb8ee('0x1d')]=_0x5a3587;if(_0x1f58a3[_0xb8ee('0x30')][_0xb8ee('0x42')]){_0x35e844['include']=[{'all':!![]}];}return db[_0xb8ee('0x41')][_0xb8ee('0x43')](_0x35e844);})[_0xb8ee('0x24')](function(_0x5d6c78){_0x5a50d8['rows']=_0x5d6c78;return _0x5a50d8;})['then'](respondWithFilteredResult(_0x5af703,_0x35e844))[_0xb8ee('0x44')](handleError(_0x5af703,null));};exports[_0xb8ee('0x45')]=function(_0x579862,_0x266b1d){var _0x24d948={'raw':![],'where':{'id':_0x579862['params']['id']}},_0x8ec870={};_0x8ec870[_0xb8ee('0x2e')]=_[_0xb8ee('0x2f')](db[_0xb8ee('0x41')][_0xb8ee('0x2b')]);_0x8ec870[_0xb8ee('0x30')]=_[_0xb8ee('0x2f')](_0x579862[_0xb8ee('0x30')]);_0x8ec870[_0xb8ee('0x3a')]=_[_0xb8ee('0x31')](_0x8ec870[_0xb8ee('0x2e')],_0x8ec870[_0xb8ee('0x30')]);_0x24d948[_0xb8ee('0x34')]=_['intersection'](_0x8ec870[_0xb8ee('0x2e')],qs[_0xb8ee('0x32')](_0x579862[_0xb8ee('0x30')][_0xb8ee('0x32')]));_0x24d948[_0xb8ee('0x34')]=_0x24d948[_0xb8ee('0x34')]['length']?_0x24d948[_0xb8ee('0x34')]:_0x8ec870[_0xb8ee('0x2e')];if(_0x579862['query'][_0xb8ee('0x42')]){_0x24d948['include']=[{'all':!![]}];}_0x24d948=_[_0xb8ee('0x3d')]({},_0x24d948,_0x579862[_0xb8ee('0x40')]);return db['FreshdeskAccount'][_0xb8ee('0x46')](_0x24d948)[_0xb8ee('0x24')](handleEntityNotFound(_0x266b1d,null))[_0xb8ee('0x24')](respondWithResult(_0x266b1d,null))[_0xb8ee('0x44')](handleError(_0x266b1d,null));};exports[_0xb8ee('0x47')]=function(_0x1e42d5,_0x5946e3){return db[_0xb8ee('0x41')][_0xb8ee('0x47')](_0x1e42d5[_0xb8ee('0x48')],{})[_0xb8ee('0x24')](respondWithResult(_0x5946e3,0xc9))[_0xb8ee('0x44')](handleError(_0x5946e3,null));};exports['update']=function(_0x398f7e,_0x338cfb){if(_0x398f7e[_0xb8ee('0x48')]['id']){delete _0x398f7e[_0xb8ee('0x48')]['id'];}return db[_0xb8ee('0x41')][_0xb8ee('0x46')]({'where':{'id':_0x398f7e[_0xb8ee('0x49')]['id']}})['then'](handleEntityNotFound(_0x338cfb,null))[_0xb8ee('0x24')](saveUpdates(_0x398f7e[_0xb8ee('0x48')],null))[_0xb8ee('0x24')](respondWithResult(_0x338cfb,null))[_0xb8ee('0x44')](handleError(_0x338cfb,null));};exports[_0xb8ee('0x4a')]=function(_0x299114,_0x55ac7c){return db[_0xb8ee('0x41')][_0xb8ee('0x46')]({'where':{'id':_0x299114[_0xb8ee('0x49')]['id']}})[_0xb8ee('0x24')](handleEntityNotFound(_0x55ac7c,null))[_0xb8ee('0x24')](removeEntity(_0x55ac7c,null))[_0xb8ee('0x44')](handleError(_0x55ac7c,null));};exports[_0xb8ee('0x4b')]=function(_0x237aad,_0xeb173b,_0x4d2341){var _0x591d0c={};var _0x2cb7cd={};var _0x592dfc;var _0x4ba434;return db['FreshdeskAccount'][_0xb8ee('0x4c')]({'where':{'id':_0x237aad[_0xb8ee('0x49')]['id']}})[_0xb8ee('0x24')](handleEntityNotFound(_0xeb173b,null))['then'](function(_0x1fb637){if(_0x1fb637){_0x592dfc=_0x1fb637;_0x2cb7cd[_0xb8ee('0x2e')]=_[_0xb8ee('0x2f')](db[_0xb8ee('0x4d')]['rawAttributes']);_0x2cb7cd[_0xb8ee('0x30')]=_['keys'](_0x237aad['query']);_0x2cb7cd[_0xb8ee('0x3a')]=_[_0xb8ee('0x31')](_0x2cb7cd[_0xb8ee('0x2e')],_0x2cb7cd[_0xb8ee('0x30')]);_0x591d0c['attributes']=_['intersection'](_0x2cb7cd[_0xb8ee('0x2e')],qs[_0xb8ee('0x32')](_0x237aad[_0xb8ee('0x30')][_0xb8ee('0x32')]));_0x591d0c[_0xb8ee('0x34')]=_0x591d0c[_0xb8ee('0x34')][_0xb8ee('0x33')]?_0x591d0c[_0xb8ee('0x34')]:_0x2cb7cd[_0xb8ee('0x2e')];_0x591d0c['order']=qs['sort'](_0x237aad['query'][_0xb8ee('0x38')]);_0x591d0c['where']=qs[_0xb8ee('0x3a')](_['pick'](_0x237aad[_0xb8ee('0x30')],_0x2cb7cd[_0xb8ee('0x3a')]));if(_0x237aad['query'][_0xb8ee('0x3c')]){_0x591d0c[_0xb8ee('0x39')]=_[_0xb8ee('0x3d')](_0x591d0c[_0xb8ee('0x39')],{'$or':_['map'](_0x591d0c[_0xb8ee('0x34')],function(_0x2b2e0a){var _0x4f6278={};_0x4f6278[_0x2b2e0a]={'$like':'%'+_0x237aad[_0xb8ee('0x30')][_0xb8ee('0x3c')]+'%'};return _0x4f6278;})});}_0x591d0c=_[_0xb8ee('0x3d')]({},_0x591d0c,_0x237aad[_0xb8ee('0x40')]);return _0x592dfc[_0xb8ee('0x4b')](_0x591d0c);}})['then'](function(_0xcb3c86){if(_0xcb3c86){_0x4ba434=_0xcb3c86['length'];if(!_0x237aad[_0xb8ee('0x30')][_0xb8ee('0x35')](_0xb8ee('0x36'))){_0x591d0c[_0xb8ee('0x1f')]=qs[_0xb8ee('0x1f')](_0x237aad['query'][_0xb8ee('0x1f')]);_0x591d0c[_0xb8ee('0x1e')]=qs[_0xb8ee('0x1e')](_0x237aad[_0xb8ee('0x30')][_0xb8ee('0x1e')]);}return _0x592dfc['getConfigurations'](_0x591d0c);}})[_0xb8ee('0x24')](function(_0x56ac3a){if(_0x56ac3a){return _0x56ac3a?{'count':_0x4ba434,'rows':_0x56ac3a}:null;}})[_0xb8ee('0x24')](respondWithResult(_0xeb173b,null))[_0xb8ee('0x44')](handleError(_0xeb173b,null));};exports[_0xb8ee('0x4e')]=function(_0x54f461,_0x363637,_0x4f6c5d){if(_0x54f461[_0xb8ee('0x48')]['id']){delete _0x54f461[_0xb8ee('0x48')]['id'];}return db[_0xb8ee('0x41')][_0xb8ee('0x4c')]({'where':{'id':_0x54f461[_0xb8ee('0x49')]['id']}})['then'](handleEntityNotFound(_0x363637,null))[_0xb8ee('0x24')](function(_0x14192d){if(_0x14192d){_0x54f461[_0xb8ee('0x48')][_0xb8ee('0x4f')]=_0x14192d['id'];_0x54f461[_0xb8ee('0x48')][_0xb8ee('0x50')]=integrations[_0xb8ee('0x51')](_0x54f461[_0xb8ee('0x48')][_0xb8ee('0x52')],_0x54f461['body'][_0xb8ee('0x3e')]);_0x54f461[_0xb8ee('0x48')][_0xb8ee('0x53')]=integrations[_0xb8ee('0x54')](_0x54f461['body']['channel'],_0x54f461['body'][_0xb8ee('0x3e')]);return db[_0xb8ee('0x4d')][_0xb8ee('0x47')](_0x54f461[_0xb8ee('0x48')],{'include':[{'model':db[_0xb8ee('0x55')],'as':'Subjects'},{'model':db[_0xb8ee('0x55')],'as':_0xb8ee('0x53')}]});}return null;})['then'](respondWithResult(_0x363637,null))['catch'](handleError(_0x363637,null));};exports[_0xb8ee('0x56')]=function(_0x28e95c,_0x40e81e,_0x1d5542){var _0x605c14='';return db['FreshdeskAccount'][_0xb8ee('0x4c')]({'where':{'id':_0x28e95c['params']['id']},'attributes':['id',_0xb8ee('0x57'),_0xb8ee('0x58')]})[_0xb8ee('0x24')](handleEntityNotFound(_0x40e81e,null))[_0xb8ee('0x24')](function(_0x152f4a){if(_0x152f4a){_0x605c14=_0x152f4a[_0xb8ee('0x57')];var _0x262282=_0x605c14[_0xb8ee('0x59')](-0x1);if(_0x262282==='/'){_0x605c14=_0x605c14['substring'](0x0,_0x605c14[_0xb8ee('0x5a')](_0x262282));}return rp({'method':_0xb8ee('0x5b'),'uri':util[_0xb8ee('0x5c')](_0xb8ee('0x5d'),_0x605c14,_0xb8ee('0x5e')),'headers':{'Authorization':util[_0xb8ee('0x5c')](_0xb8ee('0x5f'),new Buffer(util[_0xb8ee('0x5c')]('%s:X',_0x152f4a['apiKey']))[_0xb8ee('0x60')]('base64'))},'json':!![]});}})[_0xb8ee('0x24')](function(_0x475855){if(_0x475855){var _0xcc284c=[_0xb8ee('0x61'),_0xb8ee('0x62'),'agent',_0xb8ee('0x63'),_0xb8ee('0x1a'),_0xb8ee('0x64'),_0xb8ee('0x65'),_0xb8ee('0x66'),_0xb8ee('0x67'),_0xb8ee('0x65'),_0xb8ee('0x68')];_[_0xb8ee('0x69')](_0x475855,function(_0x3cd834){return _0xcc284c[_0xb8ee('0x6a')](_0x3cd834['name'])||!_0x3cd834[_0xb8ee('0x6b')]&&_0x3cd834[_0xb8ee('0x3e')]!==_0xb8ee('0x6c')&&_0x3cd834[_0xb8ee('0x3e')]!==_0xb8ee('0x6d');});return{'count':_0x475855[_0xb8ee('0x33')],'rows':_['map'](_0x475855,function(_0x16d3e9){return{'id':_0x16d3e9[_0xb8ee('0x27')],'name':_0x16d3e9['label'],'custom':!_0x16d3e9[_0xb8ee('0x6b')],'options':_0x16d3e9[_0xb8ee('0x6e')]?_[_0xb8ee('0x2a')](_0x16d3e9['choices'],function(_0x44c101){return{'name':_[_0xb8ee('0x6f')](_0x44c101),'value':_0x44c101};}):[]};})};}})[_0xb8ee('0x24')](respondWithResult(_0x40e81e,null))[_0xb8ee('0x44')](function(_0x37f9e4){var _0x47d230=_0x28e95c[_0xb8ee('0x30')][_0xb8ee('0x70')]?0x1f4:_0x37f9e4['statusCode']||0x1f4;logger[_0xb8ee('0x25')](_0xb8ee('0x71'),_0xb8ee('0x56'),_0x47d230,JSON[_0xb8ee('0x72')](_0x37f9e4));delete _0x37f9e4[_0xb8ee('0x27')];if(_0x47d230===0x191){_0x47d230=0x190;}_0x40e81e[_0xb8ee('0x1a')](_0x47d230)[_0xb8ee('0x28')](_0x28e95c[_0xb8ee('0x30')][_0xb8ee('0x70')]?{'message':_0xb8ee('0x73'),'statusCode':_0x37f9e4['statusCode']}:_0x37f9e4);});}; \ No newline at end of file +var _0x1948=['../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','FreshdeskAccount','rawAttributes','fieldName','key','map','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','FreshdeskConfiguration','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','format','api/v2/ticket_fields','Basic\x20%s','apiKey','toString','base64','requester','subject','agent','description','ticket_type','group','company','includes','type','custom_text','custom_dropdown','default','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x24b799,_0x167d1d){var _0x10d536=function(_0x42efd4){while(--_0x42efd4){_0x24b799['push'](_0x24b799['shift']());}};_0x10d536(++_0x167d1d);}(_0x1948,0x145));var _0x8194=function(_0x277969,_0x377f43){_0x277969=_0x277969-0x0;var _0x295c24=_0x1948[_0x277969];return _0x295c24;};'use strict';var emlformat=require(_0x8194('0x0'));var rimraf=require(_0x8194('0x1'));var zipdir=require(_0x8194('0x2'));var jsonpatch=require(_0x8194('0x3'));var rp=require(_0x8194('0x4'));var moment=require('moment');var BPromise=require(_0x8194('0x5'));var Mustache=require(_0x8194('0x6'));var util=require(_0x8194('0x7'));var path=require(_0x8194('0x8'));var sox=require(_0x8194('0x9'));var csv=require(_0x8194('0xa'));var ejs=require(_0x8194('0xb'));var fs=require('fs');var fs_extra=require(_0x8194('0xc'));var _=require('lodash');var squel=require(_0x8194('0xd'));var crypto=require(_0x8194('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8194('0xf'));var toCsv=require(_0x8194('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8194('0x10'));var authService=require(_0x8194('0x11'));var qs=require(_0x8194('0x12'));var as=require(_0x8194('0x13'));var hardwareService=require(_0x8194('0x14'));var logger=require('../../config/logger')(_0x8194('0x15'));var utils=require(_0x8194('0x16'));var config=require(_0x8194('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8194('0x18'))['db'];var integrations=require(_0x8194('0x19'));function respondWithStatusCode(_0x1aa698,_0xeba106){_0xeba106=_0xeba106||0xcc;return function(_0x3e9d1f){if(_0x3e9d1f){return _0x1aa698[_0x8194('0x1a')](_0xeba106);}return _0x1aa698['status'](_0xeba106)[_0x8194('0x1b')]();};}function respondWithResult(_0x215b95,_0xfd031c){_0xfd031c=_0xfd031c||0xc8;return function(_0x2ab425){if(_0x2ab425){return _0x215b95[_0x8194('0x1c')](_0xfd031c)[_0x8194('0x1d')](_0x2ab425);}};}function respondWithFilteredResult(_0x112d44,_0x13e166){return function(_0x19c23e){if(_0x19c23e){var _0x5abd09=typeof _0x13e166[_0x8194('0x1e')]===_0x8194('0x1f')&&typeof _0x13e166['limit']===_0x8194('0x1f');var _0x4afbe3=_0x19c23e['count'];var _0x5f2172=_0x5abd09?0x0:_0x13e166[_0x8194('0x1e')];var _0x43a192=_0x5abd09?_0x19c23e[_0x8194('0x20')]:_0x13e166[_0x8194('0x1e')]+_0x13e166[_0x8194('0x21')];var _0x1d7bcc;if(_0x43a192>=_0x4afbe3){_0x43a192=_0x4afbe3;_0x1d7bcc=0xc8;}else{_0x1d7bcc=0xce;}_0x112d44['status'](_0x1d7bcc);return _0x112d44['set'](_0x8194('0x22'),_0x5f2172+'-'+_0x43a192+'/'+_0x4afbe3)['json'](_0x19c23e);}return null;};}function patchUpdates(_0x43d763){return function(_0x24d1ff){try{jsonpatch[_0x8194('0x23')](_0x24d1ff,_0x43d763,!![]);}catch(_0x59a758){return BPromise[_0x8194('0x24')](_0x59a758);}return _0x24d1ff[_0x8194('0x25')]();};}function saveUpdates(_0x41641d,_0x28df4f){return function(_0x1babf1){if(_0x1babf1){return _0x1babf1[_0x8194('0x26')](_0x41641d)[_0x8194('0x27')](function(_0xe593e9){return _0xe593e9;});}return null;};}function removeEntity(_0x269a22,_0x263093){return function(_0xbb64b7){if(_0xbb64b7){return _0xbb64b7[_0x8194('0x28')]()['then'](function(){_0x269a22[_0x8194('0x1c')](0xcc)[_0x8194('0x1b')]();});}};}function handleEntityNotFound(_0x21e92d,_0x46a242){return function(_0x55b0d9){if(!_0x55b0d9){_0x21e92d[_0x8194('0x1a')](0x194);}return _0x55b0d9;};}function handleError(_0x381dec,_0x425a1d){_0x425a1d=_0x425a1d||0x1f4;return function(_0x42c3b0){logger[_0x8194('0x29')](_0x42c3b0['stack']);if(_0x42c3b0['name']){delete _0x42c3b0[_0x8194('0x2a')];}_0x381dec[_0x8194('0x1c')](_0x425a1d)[_0x8194('0x2b')](_0x42c3b0);};}exports[_0x8194('0x2c')]=function(_0x181b8e,_0x56c512){var _0x4af9cc={},_0x5624a0={},_0x1ea1f={'count':0x0,'rows':[]};var _0x56b5bc=_['map'](db[_0x8194('0x2d')][_0x8194('0x2e')],function(_0x4ee84e){return{'name':_0x4ee84e[_0x8194('0x2f')],'type':_0x4ee84e['type'][_0x8194('0x30')]};});_0x5624a0['model']=_[_0x8194('0x31')](_0x56b5bc,_0x8194('0x2a'));_0x5624a0[_0x8194('0x32')]=_[_0x8194('0x33')](_0x181b8e[_0x8194('0x32')]);_0x5624a0['filters']=_[_0x8194('0x34')](_0x5624a0['model'],_0x5624a0[_0x8194('0x32')]);_0x4af9cc['attributes']=_[_0x8194('0x34')](_0x5624a0[_0x8194('0x35')],qs[_0x8194('0x36')](_0x181b8e['query']['fields']));_0x4af9cc[_0x8194('0x37')]=_0x4af9cc[_0x8194('0x37')][_0x8194('0x38')]?_0x4af9cc[_0x8194('0x37')]:_0x5624a0['model'];if(!_0x181b8e['query']['hasOwnProperty'](_0x8194('0x39'))){_0x4af9cc[_0x8194('0x21')]=qs[_0x8194('0x21')](_0x181b8e[_0x8194('0x32')][_0x8194('0x21')]);_0x4af9cc[_0x8194('0x1e')]=qs['offset'](_0x181b8e[_0x8194('0x32')][_0x8194('0x1e')]);}_0x4af9cc[_0x8194('0x3a')]=qs[_0x8194('0x3b')](_0x181b8e[_0x8194('0x32')][_0x8194('0x3b')]);_0x4af9cc[_0x8194('0x3c')]=qs[_0x8194('0x3d')](_[_0x8194('0x3e')](_0x181b8e[_0x8194('0x32')],_0x5624a0[_0x8194('0x3d')]),_0x56b5bc);if(_0x181b8e[_0x8194('0x32')]['filter']){_0x4af9cc[_0x8194('0x3c')]=_['merge'](_0x4af9cc['where'],{'$or':_[_0x8194('0x31')](_0x56b5bc,function(_0x841b4c){if(_0x841b4c['type']!=='VIRTUAL'){var _0x568aa5={};_0x568aa5[_0x841b4c['name']]={'$like':'%'+_0x181b8e['query'][_0x8194('0x3f')]+'%'};return _0x568aa5;}})});}_0x4af9cc=_[_0x8194('0x40')]({},_0x4af9cc,_0x181b8e[_0x8194('0x41')]);var _0x4fea56={'where':_0x4af9cc['where']};return db['FreshdeskAccount'][_0x8194('0x20')](_0x4fea56)[_0x8194('0x27')](function(_0x2d5809){_0x1ea1f[_0x8194('0x20')]=_0x2d5809;if(_0x181b8e['query'][_0x8194('0x42')]){_0x4af9cc[_0x8194('0x43')]=[{'all':!![]}];}return db[_0x8194('0x2d')][_0x8194('0x44')](_0x4af9cc);})[_0x8194('0x27')](function(_0x4ba548){_0x1ea1f[_0x8194('0x45')]=_0x4ba548;return _0x1ea1f;})[_0x8194('0x27')](respondWithFilteredResult(_0x56c512,_0x4af9cc))[_0x8194('0x46')](handleError(_0x56c512,null));};exports[_0x8194('0x47')]=function(_0x32f215,_0xb3f9ec){var _0x36789b={'raw':![],'where':{'id':_0x32f215[_0x8194('0x48')]['id']}},_0x5be9a0={};_0x5be9a0[_0x8194('0x35')]=_[_0x8194('0x33')](db[_0x8194('0x2d')]['rawAttributes']);_0x5be9a0['query']=_[_0x8194('0x33')](_0x32f215['query']);_0x5be9a0[_0x8194('0x3d')]=_['intersection'](_0x5be9a0[_0x8194('0x35')],_0x5be9a0['query']);_0x36789b[_0x8194('0x37')]=_[_0x8194('0x34')](_0x5be9a0[_0x8194('0x35')],qs[_0x8194('0x36')](_0x32f215['query'][_0x8194('0x36')]));_0x36789b[_0x8194('0x37')]=_0x36789b[_0x8194('0x37')]['length']?_0x36789b[_0x8194('0x37')]:_0x5be9a0[_0x8194('0x35')];if(_0x32f215[_0x8194('0x32')][_0x8194('0x42')]){_0x36789b[_0x8194('0x43')]=[{'all':!![]}];}_0x36789b=_['merge']({},_0x36789b,_0x32f215[_0x8194('0x41')]);return db['FreshdeskAccount'][_0x8194('0x49')](_0x36789b)[_0x8194('0x27')](handleEntityNotFound(_0xb3f9ec,null))[_0x8194('0x27')](respondWithResult(_0xb3f9ec,null))[_0x8194('0x46')](handleError(_0xb3f9ec,null));};exports[_0x8194('0x4a')]=function(_0x32a1cd,_0x3c0a84){return db[_0x8194('0x2d')][_0x8194('0x4a')](_0x32a1cd[_0x8194('0x4b')],{})[_0x8194('0x27')](respondWithResult(_0x3c0a84,0xc9))[_0x8194('0x46')](handleError(_0x3c0a84,null));};exports[_0x8194('0x26')]=function(_0x349e27,_0x2f828c){if(_0x349e27[_0x8194('0x4b')]['id']){delete _0x349e27[_0x8194('0x4b')]['id'];}return db[_0x8194('0x2d')]['find']({'where':{'id':_0x349e27[_0x8194('0x48')]['id']}})[_0x8194('0x27')](handleEntityNotFound(_0x2f828c,null))['then'](saveUpdates(_0x349e27['body'],null))[_0x8194('0x27')](respondWithResult(_0x2f828c,null))[_0x8194('0x46')](handleError(_0x2f828c,null));};exports[_0x8194('0x28')]=function(_0x3029fe,_0x3f85af){return db[_0x8194('0x2d')][_0x8194('0x49')]({'where':{'id':_0x3029fe[_0x8194('0x48')]['id']}})[_0x8194('0x27')](handleEntityNotFound(_0x3f85af,null))[_0x8194('0x27')](removeEntity(_0x3f85af,null))['catch'](handleError(_0x3f85af,null));};exports['getConfigurations']=function(_0x510f6d,_0x5b6d09,_0x12354c){var _0x87d151={};var _0x899688={};var _0x40fe60;var _0x381091;return db[_0x8194('0x2d')][_0x8194('0x4c')]({'where':{'id':_0x510f6d[_0x8194('0x48')]['id']}})[_0x8194('0x27')](handleEntityNotFound(_0x5b6d09,null))['then'](function(_0x5ec3dd){if(_0x5ec3dd){_0x40fe60=_0x5ec3dd;_0x899688[_0x8194('0x35')]=_[_0x8194('0x33')](db[_0x8194('0x4d')][_0x8194('0x2e')]);_0x899688[_0x8194('0x32')]=_[_0x8194('0x33')](_0x510f6d['query']);_0x899688[_0x8194('0x3d')]=_[_0x8194('0x34')](_0x899688[_0x8194('0x35')],_0x899688[_0x8194('0x32')]);_0x87d151[_0x8194('0x37')]=_[_0x8194('0x34')](_0x899688[_0x8194('0x35')],qs[_0x8194('0x36')](_0x510f6d['query'][_0x8194('0x36')]));_0x87d151[_0x8194('0x37')]=_0x87d151[_0x8194('0x37')][_0x8194('0x38')]?_0x87d151[_0x8194('0x37')]:_0x899688[_0x8194('0x35')];_0x87d151[_0x8194('0x3a')]=qs[_0x8194('0x3b')](_0x510f6d[_0x8194('0x32')][_0x8194('0x3b')]);_0x87d151[_0x8194('0x3c')]=qs['filters'](_[_0x8194('0x3e')](_0x510f6d[_0x8194('0x32')],_0x899688[_0x8194('0x3d')]));if(_0x510f6d[_0x8194('0x32')]['filter']){_0x87d151['where']=_[_0x8194('0x40')](_0x87d151[_0x8194('0x3c')],{'$or':_[_0x8194('0x31')](_0x87d151[_0x8194('0x37')],function(_0x46136d){var _0x4cf5cc={};_0x4cf5cc[_0x46136d]={'$like':'%'+_0x510f6d[_0x8194('0x32')][_0x8194('0x3f')]+'%'};return _0x4cf5cc;})});}_0x87d151=_[_0x8194('0x40')]({},_0x87d151,_0x510f6d[_0x8194('0x41')]);return _0x40fe60[_0x8194('0x4e')](_0x87d151);}})[_0x8194('0x27')](function(_0x37a727){if(_0x37a727){_0x381091=_0x37a727[_0x8194('0x38')];if(!_0x510f6d[_0x8194('0x32')][_0x8194('0x4f')](_0x8194('0x39'))){_0x87d151[_0x8194('0x21')]=qs[_0x8194('0x21')](_0x510f6d['query']['limit']);_0x87d151['offset']=qs[_0x8194('0x1e')](_0x510f6d[_0x8194('0x32')][_0x8194('0x1e')]);}return _0x40fe60['getConfigurations'](_0x87d151);}})[_0x8194('0x27')](function(_0x19c7ee){if(_0x19c7ee){return _0x19c7ee?{'count':_0x381091,'rows':_0x19c7ee}:null;}})['then'](respondWithResult(_0x5b6d09,null))[_0x8194('0x46')](handleError(_0x5b6d09,null));};exports['addConfiguration']=function(_0x5ce807,_0x4f557f,_0x4866c5){if(_0x5ce807[_0x8194('0x4b')]['id']){delete _0x5ce807[_0x8194('0x4b')]['id'];}return db[_0x8194('0x2d')][_0x8194('0x4c')]({'where':{'id':_0x5ce807['params']['id']}})[_0x8194('0x27')](handleEntityNotFound(_0x4f557f,null))[_0x8194('0x27')](function(_0x5df7a2){if(_0x5df7a2){_0x5ce807[_0x8194('0x4b')][_0x8194('0x50')]=_0x5df7a2['id'];_0x5ce807[_0x8194('0x4b')][_0x8194('0x51')]=integrations[_0x8194('0x52')](_0x5ce807[_0x8194('0x4b')][_0x8194('0x53')],_0x5ce807['body']['type']);_0x5ce807['body'][_0x8194('0x54')]=integrations[_0x8194('0x55')](_0x5ce807['body'][_0x8194('0x53')],_0x5ce807[_0x8194('0x4b')]['type']);return db['FreshdeskConfiguration'][_0x8194('0x4a')](_0x5ce807[_0x8194('0x4b')],{'include':[{'model':db[_0x8194('0x56')],'as':_0x8194('0x51')},{'model':db[_0x8194('0x56')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x4f557f,null))['catch'](handleError(_0x4f557f,null));};exports[_0x8194('0x57')]=function(_0x1773d2,_0x13f881,_0x4ea859){var _0x24b6f9='';return db['FreshdeskAccount'][_0x8194('0x4c')]({'where':{'id':_0x1773d2[_0x8194('0x48')]['id']},'attributes':['id',_0x8194('0x58'),'apiKey']})[_0x8194('0x27')](handleEntityNotFound(_0x13f881,null))['then'](function(_0x5e0778){if(_0x5e0778){_0x24b6f9=_0x5e0778['remoteUri'];var _0x19d22a=_0x24b6f9[_0x8194('0x59')](-0x1);if(_0x19d22a==='/'){_0x24b6f9=_0x24b6f9[_0x8194('0x5a')](0x0,_0x24b6f9[_0x8194('0x5b')](_0x19d22a));}return rp({'method':'GET','uri':util[_0x8194('0x5c')]('%s/%s',_0x24b6f9,_0x8194('0x5d')),'headers':{'Authorization':util[_0x8194('0x5c')](_0x8194('0x5e'),new Buffer(util['format']('%s:X',_0x5e0778[_0x8194('0x5f')]))[_0x8194('0x60')](_0x8194('0x61')))},'json':!![]});}})[_0x8194('0x27')](function(_0x41d813){if(_0x41d813){var _0x221e7a=[_0x8194('0x62'),_0x8194('0x63'),_0x8194('0x64'),_0x8194('0x65'),_0x8194('0x1c'),'priority','group','source',_0x8194('0x66'),_0x8194('0x67'),_0x8194('0x68')];_['remove'](_0x41d813,function(_0xd8482b){return _0x221e7a[_0x8194('0x69')](_0xd8482b[_0x8194('0x2a')])||!_0xd8482b['default']&&_0xd8482b[_0x8194('0x6a')]!==_0x8194('0x6b')&&_0xd8482b[_0x8194('0x6a')]!==_0x8194('0x6c');});return{'count':_0x41d813[_0x8194('0x38')],'rows':_['map'](_0x41d813,function(_0x457d9f){return{'id':_0x457d9f[_0x8194('0x2a')],'name':_0x457d9f['label'],'custom':!_0x457d9f[_0x8194('0x6d')],'options':_0x457d9f['choices']?_[_0x8194('0x31')](_0x457d9f[_0x8194('0x6e')],function(_0x2e1a66){return{'name':_[_0x8194('0x6f')](_0x2e1a66),'value':_0x2e1a66};}):[]};})};}})[_0x8194('0x27')](respondWithResult(_0x13f881,null))[_0x8194('0x46')](function(_0x29aaa6){var _0x26e1e6=_0x1773d2['query'][_0x8194('0x70')]?0x1f4:_0x29aaa6[_0x8194('0x71')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8194('0x57'),_0x26e1e6,JSON[_0x8194('0x72')](_0x29aaa6));delete _0x29aaa6[_0x8194('0x2a')];if(_0x26e1e6===0x191){_0x26e1e6=0x190;}_0x13f881[_0x8194('0x1c')](_0x26e1e6)[_0x8194('0x2b')](_0x1773d2['query'][_0x8194('0x70')]?{'message':_0x8194('0x73'),'statusCode':_0x29aaa6['statusCode']}:_0x29aaa6);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 28d7e22..7992492 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 _0x0b24=['../../config/logger','bluebird','rimraf','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0b24,0xe8));var _0x40b2=function(_0x34dca3,_0x462eb2){_0x34dca3=_0x34dca3-0x0;var _0x345a3f=_0x0b24[_0x34dca3];return _0x345a3f;};'use strict';var _=require(_0x40b2('0x0'));var util=require(_0x40b2('0x1'));var logger=require(_0x40b2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x40b2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x40b2('0x4'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x40b2('0x5'));module[_0x40b2('0x6')]=function(_0x5beedb,_0x5102b8){return _0x5beedb[_0x40b2('0x7')](_0x40b2('0x8'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5834=['path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','request-promise'];(function(_0x4711e8,_0x4c105d){var _0x7c7538=function(_0x308227){while(--_0x308227){_0x4711e8['push'](_0x4711e8['shift']());}};_0x7c7538(++_0x4c105d);}(_0x5834,0x1f3));var _0x4583=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0x5834[_0x585d81];return _0x1aca0d;};'use strict';var _=require(_0x4583('0x0'));var util=require(_0x4583('0x1'));var logger=require(_0x4583('0x2'))(_0x4583('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4583('0x4'));var fs=require('fs');var path=require(_0x4583('0x5'));var rimraf=require('rimraf');var config=require(_0x4583('0x6'));var attributes=require(_0x4583('0x7'));var integrations=require(_0x4583('0x8'));module['exports']=function(_0x363db6,_0x324a66){return _0x363db6[_0x4583('0x9')](_0x4583('0xa'),attributes,{'tableName':_0x4583('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index d265171..d064c23 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 _0xd200=['then','info','request\x20sent','debug','error','FreshdeskAccount,\x20%s,\x20%s','message','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','map','include','model','attributes','ShowFreshdeskAccount','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd200,0x1d4));var _0x0d20=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xd200[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require(_0x0d20('0x0'));var moment=require(_0x0d20('0x1'));var BPromise=require(_0x0d20('0x2'));var rs=require(_0x0d20('0x3'));var fs=require('fs');var Redis=require(_0x0d20('0x4'));var db=require(_0x0d20('0x5'))['db'];var utils=require(_0x0d20('0x6'));var logger=require(_0x0d20('0x7'))('rpc');var config=require(_0x0d20('0x8'));var jayson=require(_0x0d20('0x9'));var client=jayson['client'][_0x0d20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5417d2,_0xea6bd1,_0x423704){return new BPromise(function(_0x3d4521,_0x3a112a){return client[_0x0d20('0xb')](_0x5417d2,_0x423704)[_0x0d20('0xc')](function(_0x137dd5){logger[_0x0d20('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0xea6bd1,_0x0d20('0xe'));logger[_0x0d20('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xea6bd1,_0x0d20('0xe'),JSON['stringify'](_0x137dd5));if(_0x137dd5[_0x0d20('0x10')]){if(_0x137dd5[_0x0d20('0x10')]['code']===0x1f4){logger[_0x0d20('0x10')](_0x0d20('0x11'),_0xea6bd1,_0x137dd5[_0x0d20('0x10')][_0x0d20('0x12')]);return _0x3a112a(_0x137dd5['error'][_0x0d20('0x12')]);}logger[_0x0d20('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0xea6bd1,_0x137dd5[_0x0d20('0x10')][_0x0d20('0x12')]);return _0x3d4521(_0x137dd5[_0x0d20('0x10')][_0x0d20('0x12')]);}else{logger[_0x0d20('0xd')](_0x0d20('0x11'),_0xea6bd1,_0x0d20('0xe'));_0x3d4521(_0x137dd5['result'][_0x0d20('0x12')]);}})['catch'](function(_0x6c4b28){logger['error'](_0x0d20('0x11'),_0xea6bd1,_0x6c4b28);_0x3a112a(_0x6c4b28);});});}exports[_0x0d20('0x13')]=function(_0x251701){var _0x4da9ba=this;return new Promise(function(_0x1a71cd,_0x2f5f80){return db[_0x0d20('0x14')][_0x0d20('0x15')]({'raw':_0x251701[_0x0d20('0x16')]?_0x251701['options']['raw']===undefined?!![]:![]:!![],'where':_0x251701[_0x0d20('0x16')]?_0x251701[_0x0d20('0x16')][_0x0d20('0x17')]||null:null,'attributes':_0x251701[_0x0d20('0x16')]?_0x251701[_0x0d20('0x16')]['attributes']||null:null,'limit':_0x251701[_0x0d20('0x16')]?_0x251701[_0x0d20('0x16')][_0x0d20('0x18')]||null:null,'include':_0x251701[_0x0d20('0x16')]?_0x251701[_0x0d20('0x16')]['include']?_[_0x0d20('0x19')](_0x251701['options'][_0x0d20('0x1a')],function(_0x3a53c4){return{'model':db[_0x3a53c4[_0x0d20('0x1b')]],'as':_0x3a53c4['as'],'attributes':_0x3a53c4['attributes'],'include':_0x3a53c4[_0x0d20('0x1a')]?_[_0x0d20('0x19')](_0x3a53c4[_0x0d20('0x1a')],function(_0x242a54){return{'model':db[_0x242a54[_0x0d20('0x1b')]],'as':_0x242a54['as'],'attributes':_0x242a54[_0x0d20('0x1c')],'include':_0x242a54[_0x0d20('0x1a')]?_['map'](_0x242a54['include'],function(_0x11ced0){return{'model':db[_0x11ced0[_0x0d20('0x1b')]],'as':_0x11ced0['as'],'attributes':_0x11ced0[_0x0d20('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ca47b){logger[_0x0d20('0xd')](_0x0d20('0x13'),_0x251701);logger['debug'](_0x0d20('0x13'),_0x251701,JSON['stringify'](_0x1ca47b));_0x1a71cd(_0x1ca47b);})['catch'](function(_0x434c74){logger[_0x0d20('0x10')](_0x0d20('0x13'),_0x434c74[_0x0d20('0x12')],_0x251701);_0x2f5f80(_0x4da9ba[_0x0d20('0x10')](0x1f4,_0x434c74[_0x0d20('0x12')]));});});};exports[_0x0d20('0x1d')]=function(_0x31f675){var _0x51e724=this;return new Promise(function(_0x4e2a5f,_0x5edf3a){return db[_0x0d20('0x14')]['find']({'raw':_0x31f675[_0x0d20('0x16')]?_0x31f675[_0x0d20('0x16')][_0x0d20('0x1e')]===undefined?!![]:![]:!![],'where':_0x31f675[_0x0d20('0x16')]?_0x31f675[_0x0d20('0x16')]['where']||null:null,'attributes':_0x31f675[_0x0d20('0x16')]?_0x31f675['options'][_0x0d20('0x1c')]||null:null,'include':_0x31f675[_0x0d20('0x16')]?_0x31f675[_0x0d20('0x16')][_0x0d20('0x1a')]?_['map'](_0x31f675[_0x0d20('0x16')][_0x0d20('0x1a')],function(_0x14d08e){return{'model':db[_0x14d08e[_0x0d20('0x1b')]],'as':_0x14d08e['as'],'attributes':_0x14d08e[_0x0d20('0x1c')],'include':_0x14d08e[_0x0d20('0x1a')]?_[_0x0d20('0x19')](_0x14d08e[_0x0d20('0x1a')],function(_0x13cf09){return{'model':db[_0x13cf09[_0x0d20('0x1b')]],'as':_0x13cf09['as'],'attributes':_0x13cf09[_0x0d20('0x1c')],'include':_0x13cf09[_0x0d20('0x1a')]?_[_0x0d20('0x19')](_0x13cf09[_0x0d20('0x1a')],function(_0x55f5e4){return{'model':db[_0x55f5e4[_0x0d20('0x1b')]],'as':_0x55f5e4['as'],'attributes':_0x55f5e4['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d20('0xc')](function(_0x882340){logger[_0x0d20('0xd')](_0x0d20('0x1d'),_0x31f675);logger[_0x0d20('0xf')]('ShowFreshdeskAccount',_0x31f675,JSON['stringify'](_0x882340));_0x4e2a5f(_0x882340);})[_0x0d20('0x1f')](function(_0x5675e0){logger[_0x0d20('0x10')](_0x0d20('0x1d'),_0x5675e0[_0x0d20('0x12')],_0x31f675);_0x5edf3a(_0x51e724['error'](0x1f4,_0x5675e0[_0x0d20('0x12')]));});});}; \ No newline at end of file +var _0x8410=['model','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','attributes','include','map','info','ShowFreshdeskAccount','find','raw','where'];(function(_0x2f7c13,_0xb80d48){var _0x5562ed=function(_0x5e25cd){while(--_0x5e25cd){_0x2f7c13['push'](_0x2f7c13['shift']());}};_0x5562ed(++_0xb80d48);}(_0x8410,0xb1));var _0x0841=function(_0x308055,_0x5ac5bf){_0x308055=_0x308055-0x0;var _0x24b3f9=_0x8410[_0x308055];return _0x24b3f9;};'use strict';var _=require('lodash');var util=require(_0x0841('0x0'));var moment=require(_0x0841('0x1'));var BPromise=require(_0x0841('0x2'));var rs=require(_0x0841('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0841('0x4'))['db'];var utils=require(_0x0841('0x5'));var logger=require(_0x0841('0x6'))('rpc');var config=require(_0x0841('0x7'));var jayson=require(_0x0841('0x8'));var client=jayson[_0x0841('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a7de5,_0x87557d,_0x2d1e86){return new BPromise(function(_0x2ca013,_0x5c6e2e){return client[_0x0841('0xa')](_0x3a7de5,_0x2d1e86)[_0x0841('0xb')](function(_0x5e5a4c){logger['info'](_0x0841('0xc'),_0x87557d,'request\x20sent');logger['debug'](_0x0841('0xd'),_0x87557d,_0x0841('0xe'),JSON[_0x0841('0xf')](_0x5e5a4c));if(_0x5e5a4c['error']){if(_0x5e5a4c['error'][_0x0841('0x10')]===0x1f4){logger[_0x0841('0x11')](_0x0841('0xc'),_0x87557d,_0x5e5a4c[_0x0841('0x11')]['message']);return _0x5c6e2e(_0x5e5a4c['error'][_0x0841('0x12')]);}logger['error'](_0x0841('0xc'),_0x87557d,_0x5e5a4c[_0x0841('0x11')][_0x0841('0x12')]);return _0x2ca013(_0x5e5a4c['error'][_0x0841('0x12')]);}else{logger['info'](_0x0841('0xc'),_0x87557d,_0x0841('0xe'));_0x2ca013(_0x5e5a4c[_0x0841('0x13')]['message']);}})[_0x0841('0x14')](function(_0x537153){logger[_0x0841('0x11')](_0x0841('0xc'),_0x87557d,_0x537153);_0x5c6e2e(_0x537153);});});}exports[_0x0841('0x15')]=function(_0x1cd85a){var _0x273b10=this;return new Promise(function(_0x5e01b2,_0x31174a){return db[_0x0841('0x16')][_0x0841('0x17')]({'raw':_0x1cd85a[_0x0841('0x18')]?_0x1cd85a[_0x0841('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1cd85a[_0x0841('0x18')]?_0x1cd85a[_0x0841('0x18')]['where']||null:null,'attributes':_0x1cd85a[_0x0841('0x18')]?_0x1cd85a[_0x0841('0x18')][_0x0841('0x19')]||null:null,'limit':_0x1cd85a[_0x0841('0x18')]?_0x1cd85a['options']['limit']||null:null,'include':_0x1cd85a[_0x0841('0x18')]?_0x1cd85a[_0x0841('0x18')][_0x0841('0x1a')]?_[_0x0841('0x1b')](_0x1cd85a[_0x0841('0x18')][_0x0841('0x1a')],function(_0x3f0ff5){return{'model':db[_0x3f0ff5['model']],'as':_0x3f0ff5['as'],'attributes':_0x3f0ff5[_0x0841('0x19')],'include':_0x3f0ff5[_0x0841('0x1a')]?_['map'](_0x3f0ff5[_0x0841('0x1a')],function(_0x5b99b3){return{'model':db[_0x5b99b3['model']],'as':_0x5b99b3['as'],'attributes':_0x5b99b3['attributes'],'include':_0x5b99b3[_0x0841('0x1a')]?_[_0x0841('0x1b')](_0x5b99b3['include'],function(_0x172e2a){return{'model':db[_0x172e2a['model']],'as':_0x172e2a['as'],'attributes':_0x172e2a[_0x0841('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0841('0xb')](function(_0x4a47bd){logger[_0x0841('0x1c')](_0x0841('0x15'),_0x1cd85a);logger['debug'](_0x0841('0x15'),_0x1cd85a,JSON[_0x0841('0xf')](_0x4a47bd));_0x5e01b2(_0x4a47bd);})[_0x0841('0x14')](function(_0x2d35b9){logger[_0x0841('0x11')](_0x0841('0x15'),_0x2d35b9[_0x0841('0x12')],_0x1cd85a);_0x31174a(_0x273b10[_0x0841('0x11')](0x1f4,_0x2d35b9['message']));});});};exports[_0x0841('0x1d')]=function(_0x23ad8d){var _0x2b5d67=this;return new Promise(function(_0x2ae5da,_0xd09333){return db['FreshdeskAccount'][_0x0841('0x1e')]({'raw':_0x23ad8d['options']?_0x23ad8d[_0x0841('0x18')][_0x0841('0x1f')]===undefined?!![]:![]:!![],'where':_0x23ad8d[_0x0841('0x18')]?_0x23ad8d[_0x0841('0x18')][_0x0841('0x20')]||null:null,'attributes':_0x23ad8d[_0x0841('0x18')]?_0x23ad8d[_0x0841('0x18')][_0x0841('0x19')]||null:null,'include':_0x23ad8d[_0x0841('0x18')]?_0x23ad8d['options'][_0x0841('0x1a')]?_['map'](_0x23ad8d[_0x0841('0x18')]['include'],function(_0x83b21b){return{'model':db[_0x83b21b[_0x0841('0x21')]],'as':_0x83b21b['as'],'attributes':_0x83b21b[_0x0841('0x19')],'include':_0x83b21b[_0x0841('0x1a')]?_[_0x0841('0x1b')](_0x83b21b[_0x0841('0x1a')],function(_0x31b824){return{'model':db[_0x31b824[_0x0841('0x21')]],'as':_0x31b824['as'],'attributes':_0x31b824[_0x0841('0x19')],'include':_0x31b824['include']?_[_0x0841('0x1b')](_0x31b824['include'],function(_0x456f49){return{'model':db[_0x456f49[_0x0841('0x21')]],'as':_0x456f49['as'],'attributes':_0x456f49[_0x0841('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0841('0xb')](function(_0x58d534){logger['info'](_0x0841('0x1d'),_0x23ad8d);logger[_0x0841('0x22')](_0x0841('0x1d'),_0x23ad8d,JSON[_0x0841('0xf')](_0x58d534));_0x2ae5da(_0x58d534);})[_0x0841('0x14')](function(_0x488453){logger[_0x0841('0x11')]('ShowFreshdeskAccount',_0x488453['message'],_0x23ad8d);_0xd09333(_0x2b5d67[_0x0841('0x11')](0x1f4,_0x488453[_0x0841('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 5fdba63..848b068 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 _0xb2d3=['util','path','express','Router','fs-extra','../../components/auth/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getTags','post','create','/:id/tags','setTags','put','delete','destroy','exports','multer'];(function(_0x3a9793,_0x4e8775){var _0x31fbe5=function(_0x28327b){while(--_0x28327b){_0x3a9793['push'](_0x3a9793['shift']());}};_0x31fbe5(++_0x4e8775);}(_0xb2d3,0xb5));var _0x3b2d=function(_0x36b400,_0x277ec5){_0x36b400=_0x36b400-0x0;var _0x4d47bf=_0xb2d3[_0x36b400];return _0x4d47bf;};'use strict';var multer=require(_0x3b2d('0x0'));var util=require(_0x3b2d('0x1'));var path=require(_0x3b2d('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b2d('0x3'));var router=express[_0x3b2d('0x4')]();var fs_extra=require(_0x3b2d('0x5'));var auth=require(_0x3b2d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3b2d('0x7'));router[_0x3b2d('0x8')]('/',auth[_0x3b2d('0x9')](),controller[_0x3b2d('0xa')]);router['get'](_0x3b2d('0xb'),auth[_0x3b2d('0x9')](),controller[_0x3b2d('0xc')]);router[_0x3b2d('0x8')](_0x3b2d('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x3b2d('0x8')](_0x3b2d('0xe'),auth['isAuthenticated'](),controller[_0x3b2d('0xf')]);router[_0x3b2d('0x8')](_0x3b2d('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3b2d('0x8')]('/:id/tags',auth[_0x3b2d('0x9')](),controller[_0x3b2d('0x11')]);router[_0x3b2d('0x12')]('/',auth[_0x3b2d('0x9')](),controller[_0x3b2d('0x13')]);router['post'](_0x3b2d('0x14'),auth[_0x3b2d('0x9')](),controller[_0x3b2d('0x15')]);router[_0x3b2d('0x16')](_0x3b2d('0xb'),auth[_0x3b2d('0x9')](),controller['update']);router[_0x3b2d('0x17')](_0x3b2d('0xb'),auth[_0x3b2d('0x9')](),controller[_0x3b2d('0x18')]);module[_0x3b2d('0x19')]=router; \ No newline at end of file +var _0x2ad2=['../../components/auth/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','getTags','post','put','update','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x311c69,_0x47ecbf){var _0x1a552e=function(_0x3d0cb2){while(--_0x3d0cb2){_0x311c69['push'](_0x311c69['shift']());}};_0x1a552e(++_0x47ecbf);}(_0x2ad2,0x1dd));var _0x22ad=function(_0x1f7909,_0x1aefbd){_0x1f7909=_0x1f7909-0x0;var _0x2cb51f=_0x2ad2[_0x1f7909];return _0x2cb51f;};'use strict';var multer=require(_0x22ad('0x0'));var util=require(_0x22ad('0x1'));var path=require(_0x22ad('0x2'));var timeout=require('connect-timeout');var express=require(_0x22ad('0x3'));var router=express[_0x22ad('0x4')]();var fs_extra=require(_0x22ad('0x5'));var auth=require(_0x22ad('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x22ad('0x7'));router[_0x22ad('0x8')]('/',auth[_0x22ad('0x9')](),controller['index']);router[_0x22ad('0x8')](_0x22ad('0xa'),auth[_0x22ad('0x9')](),controller[_0x22ad('0xb')]);router['get'](_0x22ad('0xc'),auth[_0x22ad('0x9')](),controller[_0x22ad('0xd')]);router[_0x22ad('0x8')]('/:id/subjects',auth[_0x22ad('0x9')](),controller[_0x22ad('0xe')]);router[_0x22ad('0x8')](_0x22ad('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x22ad('0x10'),auth[_0x22ad('0x9')](),controller[_0x22ad('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x22ad('0x12')](_0x22ad('0x10'),auth['isAuthenticated'](),controller['setTags']);router[_0x22ad('0x13')](_0x22ad('0xa'),auth[_0x22ad('0x9')](),controller[_0x22ad('0x14')]);router['delete']('/:id',auth[_0x22ad('0x9')](),controller[_0x22ad('0x15')]);module[_0x22ad('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 54a903a..704e896 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 _0x56e7=['STRING','exports'];(function(_0x1b1b33,_0x5b8e3f){var _0x1bedd4=function(_0x28c786){while(--_0x28c786){_0x1b1b33['push'](_0x1b1b33['shift']());}};_0x1bedd4(++_0x5b8e3f);}(_0x56e7,0x17d));var _0x756e=function(_0x151aa6,_0x448f1c){_0x151aa6=_0x151aa6-0x0;var _0x3b073b=_0x56e7[_0x151aa6];return _0x3b073b;};'use strict';var Sequelize=require('sequelize');module[_0x756e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x756e('0x1')]}}; \ No newline at end of file +var _0x9557=['sequelize','STRING'];(function(_0xd9c529,_0x19f8cc){var _0x146760=function(_0x1aa5e8){while(--_0x1aa5e8){_0xd9c529['push'](_0xd9c529['shift']());}};_0x146760(++_0x19f8cc);}(_0x9557,0x19e));var _0x7955=function(_0x3e7d2b,_0x3252f8){_0x3e7d2b=_0x3e7d2b-0x0;var _0x323522=_0x9557[_0x3e7d2b];return _0x323522;};'use strict';var Sequelize=require(_0x7955('0x0'));module['exports']={'name':{'type':Sequelize[_0x7955('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 486322e..954df92 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 _0x7e25=['ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','keys','find','body','getFields','FreshdeskField','order','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x59a964,_0x217e45){var _0x59719e=function(_0x371cb6){while(--_0x371cb6){_0x59a964['push'](_0x59a964['shift']());}};_0x59719e(++_0x217e45);}(_0x7e25,0x151));var _0x57e2=function(_0x1877e2,_0x2b76d4){_0x1877e2=_0x1877e2-0x0;var _0x44e96a=_0x7e25[_0x1877e2];return _0x44e96a;};'use strict';var emlformat=require(_0x57e2('0x0'));var rimraf=require(_0x57e2('0x1'));var zipdir=require(_0x57e2('0x2'));var jsonpatch=require(_0x57e2('0x3'));var rp=require(_0x57e2('0x4'));var moment=require(_0x57e2('0x5'));var BPromise=require(_0x57e2('0x6'));var Mustache=require(_0x57e2('0x7'));var util=require(_0x57e2('0x8'));var path=require(_0x57e2('0x9'));var sox=require('sox');var csv=require(_0x57e2('0xa'));var ejs=require(_0x57e2('0xb'));var fs=require('fs');var fs_extra=require(_0x57e2('0xc'));var _=require(_0x57e2('0xd'));var squel=require('squel');var crypto=require(_0x57e2('0xe'));var jsforce=require(_0x57e2('0xf'));var deskjs=require(_0x57e2('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57e2('0x11'));var Redis=require(_0x57e2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x57e2('0x13'));var as=require(_0x57e2('0x14'));var hardwareService=require(_0x57e2('0x15'));var logger=require(_0x57e2('0x16'))(_0x57e2('0x17'));var utils=require('../../config/utils');var config=require(_0x57e2('0x18'));var licenseUtil=require(_0x57e2('0x19'));var db=require(_0x57e2('0x1a'))['db'];function respondWithStatusCode(_0x9d3cdf,_0x57c4ca){_0x57c4ca=_0x57c4ca||0xcc;return function(_0x24954c){if(_0x24954c){return _0x9d3cdf[_0x57e2('0x1b')](_0x57c4ca);}return _0x9d3cdf[_0x57e2('0x1c')](_0x57c4ca)[_0x57e2('0x1d')]();};}function respondWithResult(_0xcab97c,_0x5a9954){_0x5a9954=_0x5a9954||0xc8;return function(_0x24b3f5){if(_0x24b3f5){return _0xcab97c[_0x57e2('0x1c')](_0x5a9954)['json'](_0x24b3f5);}};}function respondWithFilteredResult(_0x28b71e,_0x54372d){return function(_0x3464ed){if(_0x3464ed){var _0x3711f5=typeof _0x54372d['offset']==='undefined'&&typeof _0x54372d[_0x57e2('0x1e')]==='undefined';var _0x113b30=_0x3464ed[_0x57e2('0x1f')];var _0x3dcab0=_0x3711f5?0x0:_0x54372d[_0x57e2('0x20')];var _0x1a13bb=_0x3711f5?_0x3464ed[_0x57e2('0x1f')]:_0x54372d['offset']+_0x54372d[_0x57e2('0x1e')];var _0x576a73;if(_0x1a13bb>=_0x113b30){_0x1a13bb=_0x113b30;_0x576a73=0xc8;}else{_0x576a73=0xce;}_0x28b71e[_0x57e2('0x1c')](_0x576a73);return _0x28b71e[_0x57e2('0x21')]('Content-Range',_0x3dcab0+'-'+_0x1a13bb+'/'+_0x113b30)[_0x57e2('0x22')](_0x3464ed);}return null;};}function patchUpdates(_0x3b159f){return function(_0x296c2c){try{jsonpatch[_0x57e2('0x23')](_0x296c2c,_0x3b159f,!![]);}catch(_0x4a697d){return BPromise[_0x57e2('0x24')](_0x4a697d);}return _0x296c2c[_0x57e2('0x25')]();};}function saveUpdates(_0x2a76ae,_0x111e2d){return function(_0x28eaf3){if(_0x28eaf3){return _0x28eaf3[_0x57e2('0x26')](_0x2a76ae)[_0x57e2('0x27')](function(_0x27d329){return _0x27d329;});}return null;};}function removeEntity(_0x4a7027,_0x22b080){return function(_0x59086d){if(_0x59086d){return _0x59086d[_0x57e2('0x28')]()[_0x57e2('0x27')](function(){_0x4a7027[_0x57e2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ab795,_0x4a93bf){return function(_0xde2104){if(!_0xde2104){_0x5ab795[_0x57e2('0x1b')](0x194);}return _0xde2104;};}function handleError(_0x555baf,_0xa68043){_0xa68043=_0xa68043||0x1f4;return function(_0x5dfc7e){logger[_0x57e2('0x29')](_0x5dfc7e[_0x57e2('0x2a')]);if(_0x5dfc7e['name']){delete _0x5dfc7e[_0x57e2('0x2b')];}_0x555baf['status'](_0xa68043)[_0x57e2('0x2c')](_0x5dfc7e);};}exports[_0x57e2('0x2d')]=function(_0x5a6945,_0x402f17){var _0x66f228={},_0x460270={},_0x6c754f={'count':0x0,'rows':[]};var _0x2bbaec=_['map'](db[_0x57e2('0x2e')][_0x57e2('0x2f')],function(_0x456b24){return{'name':_0x456b24[_0x57e2('0x30')],'type':_0x456b24[_0x57e2('0x31')][_0x57e2('0x32')]};});_0x460270[_0x57e2('0x33')]=_[_0x57e2('0x34')](_0x2bbaec,_0x57e2('0x2b'));_0x460270[_0x57e2('0x35')]=_['keys'](_0x5a6945[_0x57e2('0x35')]);_0x460270[_0x57e2('0x36')]=_[_0x57e2('0x37')](_0x460270[_0x57e2('0x33')],_0x460270[_0x57e2('0x35')]);_0x66f228[_0x57e2('0x38')]=_[_0x57e2('0x37')](_0x460270[_0x57e2('0x33')],qs[_0x57e2('0x39')](_0x5a6945[_0x57e2('0x35')][_0x57e2('0x39')]));_0x66f228['attributes']=_0x66f228[_0x57e2('0x38')][_0x57e2('0x3a')]?_0x66f228['attributes']:_0x460270['model'];if(!_0x5a6945[_0x57e2('0x35')][_0x57e2('0x3b')](_0x57e2('0x3c'))){_0x66f228[_0x57e2('0x1e')]=qs[_0x57e2('0x1e')](_0x5a6945['query'][_0x57e2('0x1e')]);_0x66f228[_0x57e2('0x20')]=qs['offset'](_0x5a6945[_0x57e2('0x35')][_0x57e2('0x20')]);}_0x66f228['order']=qs[_0x57e2('0x3d')](_0x5a6945[_0x57e2('0x35')]['sort']);_0x66f228['where']=qs[_0x57e2('0x36')](_[_0x57e2('0x3e')](_0x5a6945[_0x57e2('0x35')],_0x460270['filters']),_0x2bbaec);if(_0x5a6945[_0x57e2('0x35')]['filter']){_0x66f228[_0x57e2('0x3f')]=_['merge'](_0x66f228[_0x57e2('0x3f')],{'$or':_[_0x57e2('0x34')](_0x2bbaec,function(_0x116eb1){if(_0x116eb1[_0x57e2('0x31')]!==_0x57e2('0x40')){var _0x5220f4={};_0x5220f4[_0x116eb1['name']]={'$like':'%'+_0x5a6945[_0x57e2('0x35')][_0x57e2('0x41')]+'%'};return _0x5220f4;}})});}_0x66f228=_[_0x57e2('0x42')]({},_0x66f228,_0x5a6945[_0x57e2('0x43')]);var _0x27895b={'where':_0x66f228[_0x57e2('0x3f')]};return db['FreshdeskConfiguration'][_0x57e2('0x1f')](_0x27895b)['then'](function(_0x37e5bf){_0x6c754f[_0x57e2('0x1f')]=_0x37e5bf;if(_0x5a6945[_0x57e2('0x35')]['includeAll']){_0x66f228[_0x57e2('0x44')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x57e2('0x45')](_0x66f228);})[_0x57e2('0x27')](function(_0x857073){_0x6c754f[_0x57e2('0x46')]=_0x857073;return _0x6c754f;})['then'](respondWithFilteredResult(_0x402f17,_0x66f228))[_0x57e2('0x47')](handleError(_0x402f17,null));};exports[_0x57e2('0x48')]=function(_0x2908ae,_0x1c3c79){var _0x18110e={'raw':![],'where':{'id':_0x2908ae[_0x57e2('0x49')]['id']}},_0x3efc03={};_0x3efc03[_0x57e2('0x33')]=_[_0x57e2('0x4a')](db[_0x57e2('0x2e')][_0x57e2('0x2f')]);_0x3efc03[_0x57e2('0x35')]=_[_0x57e2('0x4a')](_0x2908ae[_0x57e2('0x35')]);_0x3efc03[_0x57e2('0x36')]=_[_0x57e2('0x37')](_0x3efc03['model'],_0x3efc03['query']);_0x18110e[_0x57e2('0x38')]=_['intersection'](_0x3efc03[_0x57e2('0x33')],qs[_0x57e2('0x39')](_0x2908ae['query'][_0x57e2('0x39')]));_0x18110e[_0x57e2('0x38')]=_0x18110e[_0x57e2('0x38')][_0x57e2('0x3a')]?_0x18110e[_0x57e2('0x38')]:_0x3efc03[_0x57e2('0x33')];if(_0x2908ae[_0x57e2('0x35')]['includeAll']){_0x18110e[_0x57e2('0x44')]=[{'all':!![]}];}_0x18110e=_['merge']({},_0x18110e,_0x2908ae['options']);return db[_0x57e2('0x2e')][_0x57e2('0x4b')](_0x18110e)[_0x57e2('0x27')](handleEntityNotFound(_0x1c3c79,null))[_0x57e2('0x27')](respondWithResult(_0x1c3c79,null))['catch'](handleError(_0x1c3c79,null));};exports['create']=function(_0x597c37,_0xbee65b){return db[_0x57e2('0x2e')]['create'](_0x597c37['body'],{})[_0x57e2('0x27')](respondWithResult(_0xbee65b,0xc9))['catch'](handleError(_0xbee65b,null));};exports[_0x57e2('0x26')]=function(_0x3071e8,_0x3e9f09){if(_0x3071e8[_0x57e2('0x4c')]['id']){delete _0x3071e8['body']['id'];}return db[_0x57e2('0x2e')][_0x57e2('0x4b')]({'where':{'id':_0x3071e8['params']['id']}})[_0x57e2('0x27')](handleEntityNotFound(_0x3e9f09,null))[_0x57e2('0x27')](saveUpdates(_0x3071e8['body'],null))[_0x57e2('0x27')](respondWithResult(_0x3e9f09,null))[_0x57e2('0x47')](handleError(_0x3e9f09,null));};exports[_0x57e2('0x28')]=function(_0x1a3d39,_0x3e8cb9){return db[_0x57e2('0x2e')][_0x57e2('0x4b')]({'where':{'id':_0x1a3d39[_0x57e2('0x49')]['id']}})[_0x57e2('0x27')](handleEntityNotFound(_0x3e8cb9,null))[_0x57e2('0x27')](removeEntity(_0x3e8cb9,null))['catch'](handleError(_0x3e8cb9,null));};exports[_0x57e2('0x4d')]=function(_0x2a3e85,_0x37714f,_0x22053b){var _0x3cdc43={};var _0x2b06b6={};var _0x10f9d3;var _0x1d8050;return db[_0x57e2('0x2e')]['findOne']({'where':{'id':_0x2a3e85[_0x57e2('0x49')]['id']}})['then'](handleEntityNotFound(_0x37714f,null))[_0x57e2('0x27')](function(_0xcf8d48){if(_0xcf8d48){_0x10f9d3=_0xcf8d48;_0x2b06b6['model']=_[_0x57e2('0x4a')](db[_0x57e2('0x4e')][_0x57e2('0x2f')]);_0x2b06b6[_0x57e2('0x35')]=_[_0x57e2('0x4a')](_0x2a3e85[_0x57e2('0x35')]);_0x2b06b6[_0x57e2('0x36')]=_[_0x57e2('0x37')](_0x2b06b6['model'],_0x2b06b6['query']);_0x3cdc43[_0x57e2('0x38')]=_[_0x57e2('0x37')](_0x2b06b6[_0x57e2('0x33')],qs[_0x57e2('0x39')](_0x2a3e85[_0x57e2('0x35')]['fields']));_0x3cdc43['attributes']=_0x3cdc43['attributes'][_0x57e2('0x3a')]?_0x3cdc43[_0x57e2('0x38')]:_0x2b06b6[_0x57e2('0x33')];_0x3cdc43[_0x57e2('0x4f')]=qs[_0x57e2('0x3d')](_0x2a3e85[_0x57e2('0x35')]['sort']);_0x3cdc43['where']=qs[_0x57e2('0x36')](_['pick'](_0x2a3e85[_0x57e2('0x35')],_0x2b06b6[_0x57e2('0x36')]));if(_0x2a3e85[_0x57e2('0x35')][_0x57e2('0x41')]){_0x3cdc43[_0x57e2('0x3f')]=_[_0x57e2('0x42')](_0x3cdc43[_0x57e2('0x3f')],{'$or':_[_0x57e2('0x34')](_0x3cdc43[_0x57e2('0x38')],function(_0x4dd836){var _0x861cb5={};_0x861cb5[_0x4dd836]={'$like':'%'+_0x2a3e85[_0x57e2('0x35')][_0x57e2('0x41')]+'%'};return _0x861cb5;})});}_0x3cdc43=_[_0x57e2('0x42')]({},_0x3cdc43,_0x2a3e85[_0x57e2('0x43')]);return _0x10f9d3['getFields'](_0x3cdc43);}})[_0x57e2('0x27')](function(_0x376c6c){if(_0x376c6c){_0x1d8050=_0x376c6c['length'];if(!_0x2a3e85[_0x57e2('0x35')][_0x57e2('0x3b')]('nolimit')){_0x3cdc43[_0x57e2('0x1e')]=qs['limit'](_0x2a3e85[_0x57e2('0x35')][_0x57e2('0x1e')]);_0x3cdc43[_0x57e2('0x20')]=qs[_0x57e2('0x20')](_0x2a3e85['query']['offset']);}return _0x10f9d3[_0x57e2('0x4d')](_0x3cdc43);}})[_0x57e2('0x27')](function(_0x268471){if(_0x268471){return _0x268471?{'count':_0x1d8050,'rows':_0x268471}:null;}})[_0x57e2('0x27')](respondWithResult(_0x37714f,null))[_0x57e2('0x47')](handleError(_0x37714f,null));};exports[_0x57e2('0x50')]=function(_0x11e9bd,_0x1058d1,_0x18d708){var _0x195b57={};var _0x155b74={};var _0xc7cc77;var _0xe7884a;return db[_0x57e2('0x2e')][_0x57e2('0x51')]({'where':{'id':_0x11e9bd['params']['id']}})['then'](handleEntityNotFound(_0x1058d1,null))[_0x57e2('0x27')](function(_0x12a1f9){if(_0x12a1f9){_0xc7cc77=_0x12a1f9;_0x155b74[_0x57e2('0x33')]=_['keys'](db['FreshdeskField'][_0x57e2('0x2f')]);_0x155b74['query']=_[_0x57e2('0x4a')](_0x11e9bd[_0x57e2('0x35')]);_0x155b74[_0x57e2('0x36')]=_[_0x57e2('0x37')](_0x155b74[_0x57e2('0x33')],_0x155b74[_0x57e2('0x35')]);_0x195b57[_0x57e2('0x38')]=_[_0x57e2('0x37')](_0x155b74[_0x57e2('0x33')],qs[_0x57e2('0x39')](_0x11e9bd['query'][_0x57e2('0x39')]));_0x195b57[_0x57e2('0x38')]=_0x195b57[_0x57e2('0x38')]['length']?_0x195b57[_0x57e2('0x38')]:_0x155b74[_0x57e2('0x33')];_0x195b57['order']=qs['sort'](_0x11e9bd[_0x57e2('0x35')][_0x57e2('0x3d')]);_0x195b57[_0x57e2('0x3f')]=qs[_0x57e2('0x36')](_[_0x57e2('0x3e')](_0x11e9bd[_0x57e2('0x35')],_0x155b74[_0x57e2('0x36')]));if(_0x11e9bd['query'][_0x57e2('0x41')]){_0x195b57[_0x57e2('0x3f')]=_[_0x57e2('0x42')](_0x195b57['where'],{'$or':_[_0x57e2('0x34')](_0x195b57['attributes'],function(_0x2c18a1){var _0x4cf10e={};_0x4cf10e[_0x2c18a1]={'$like':'%'+_0x11e9bd[_0x57e2('0x35')]['filter']+'%'};return _0x4cf10e;})});}_0x195b57=_['merge']({},_0x195b57,_0x11e9bd[_0x57e2('0x43')]);return _0xc7cc77[_0x57e2('0x50')](_0x195b57);}})['then'](function(_0xc1ab90){if(_0xc1ab90){_0xe7884a=_0xc1ab90[_0x57e2('0x3a')];if(!_0x11e9bd[_0x57e2('0x35')][_0x57e2('0x3b')]('nolimit')){_0x195b57[_0x57e2('0x1e')]=qs[_0x57e2('0x1e')](_0x11e9bd[_0x57e2('0x35')]['limit']);_0x195b57[_0x57e2('0x20')]=qs[_0x57e2('0x20')](_0x11e9bd[_0x57e2('0x35')][_0x57e2('0x20')]);}return _0xc7cc77[_0x57e2('0x50')](_0x195b57);}})[_0x57e2('0x27')](function(_0x18542c){if(_0x18542c){return _0x18542c?{'count':_0xe7884a,'rows':_0x18542c}:null;}})[_0x57e2('0x27')](respondWithResult(_0x1058d1,null))[_0x57e2('0x47')](handleError(_0x1058d1,null));};exports['getDescriptions']=function(_0x4cbad5,_0x42c613,_0x1b434c){var _0x2b48d7={};var _0x35a1e1={};var _0x20527d;var _0x6dfd36;return db[_0x57e2('0x2e')][_0x57e2('0x51')]({'where':{'id':_0x4cbad5[_0x57e2('0x49')]['id']}})[_0x57e2('0x27')](handleEntityNotFound(_0x42c613,null))['then'](function(_0x11c8c5){if(_0x11c8c5){_0x20527d=_0x11c8c5;_0x35a1e1[_0x57e2('0x33')]=_[_0x57e2('0x4a')](db[_0x57e2('0x4e')][_0x57e2('0x2f')]);_0x35a1e1[_0x57e2('0x35')]=_[_0x57e2('0x4a')](_0x4cbad5[_0x57e2('0x35')]);_0x35a1e1['filters']=_[_0x57e2('0x37')](_0x35a1e1[_0x57e2('0x33')],_0x35a1e1[_0x57e2('0x35')]);_0x2b48d7[_0x57e2('0x38')]=_[_0x57e2('0x37')](_0x35a1e1[_0x57e2('0x33')],qs[_0x57e2('0x39')](_0x4cbad5['query']['fields']));_0x2b48d7['attributes']=_0x2b48d7[_0x57e2('0x38')][_0x57e2('0x3a')]?_0x2b48d7[_0x57e2('0x38')]:_0x35a1e1['model'];_0x2b48d7[_0x57e2('0x4f')]=qs['sort'](_0x4cbad5[_0x57e2('0x35')][_0x57e2('0x3d')]);_0x2b48d7[_0x57e2('0x3f')]=qs[_0x57e2('0x36')](_[_0x57e2('0x3e')](_0x4cbad5[_0x57e2('0x35')],_0x35a1e1['filters']));if(_0x4cbad5[_0x57e2('0x35')]['filter']){_0x2b48d7['where']=_['merge'](_0x2b48d7[_0x57e2('0x3f')],{'$or':_[_0x57e2('0x34')](_0x2b48d7['attributes'],function(_0x5f334d){var _0x120454={};_0x120454[_0x5f334d]={'$like':'%'+_0x4cbad5['query'][_0x57e2('0x41')]+'%'};return _0x120454;})});}_0x2b48d7=_['merge']({},_0x2b48d7,_0x4cbad5['options']);return _0x20527d[_0x57e2('0x52')](_0x2b48d7);}})['then'](function(_0x53c4f8){if(_0x53c4f8){_0x6dfd36=_0x53c4f8[_0x57e2('0x3a')];if(!_0x4cbad5['query'][_0x57e2('0x3b')](_0x57e2('0x3c'))){_0x2b48d7[_0x57e2('0x1e')]=qs['limit'](_0x4cbad5['query']['limit']);_0x2b48d7[_0x57e2('0x20')]=qs[_0x57e2('0x20')](_0x4cbad5[_0x57e2('0x35')]['offset']);}return _0x20527d[_0x57e2('0x52')](_0x2b48d7);}})[_0x57e2('0x27')](function(_0x4b8ae5){if(_0x4b8ae5){return _0x4b8ae5?{'count':_0x6dfd36,'rows':_0x4b8ae5}:null;}})[_0x57e2('0x27')](respondWithResult(_0x42c613,null))[_0x57e2('0x47')](handleError(_0x42c613,null));};exports[_0x57e2('0x53')]=function(_0x5e5967,_0x1cd975,_0x497278){var _0x4a6a54={};var _0x3baaa5={};var _0x2c7ca7;var _0x4915fb;return db[_0x57e2('0x2e')]['findOne']({'where':{'id':_0x5e5967['params']['id']}})[_0x57e2('0x27')](handleEntityNotFound(_0x1cd975,null))[_0x57e2('0x27')](function(_0x5d840c){if(_0x5d840c){_0x2c7ca7=_0x5d840c;_0x3baaa5[_0x57e2('0x33')]=_[_0x57e2('0x4a')](db[_0x57e2('0x54')][_0x57e2('0x2f')]);_0x3baaa5[_0x57e2('0x35')]=_[_0x57e2('0x4a')](_0x5e5967[_0x57e2('0x35')]);_0x3baaa5[_0x57e2('0x36')]=_[_0x57e2('0x37')](_0x3baaa5['model'],_0x3baaa5[_0x57e2('0x35')]);_0x4a6a54[_0x57e2('0x38')]=_[_0x57e2('0x37')](_0x3baaa5[_0x57e2('0x33')],qs['fields'](_0x5e5967[_0x57e2('0x35')][_0x57e2('0x39')]));_0x4a6a54[_0x57e2('0x38')]=_0x4a6a54[_0x57e2('0x38')][_0x57e2('0x3a')]?_0x4a6a54['attributes']:_0x3baaa5[_0x57e2('0x33')];_0x4a6a54[_0x57e2('0x4f')]=qs[_0x57e2('0x3d')](_0x5e5967[_0x57e2('0x35')][_0x57e2('0x3d')]);_0x4a6a54['where']=qs['filters'](_[_0x57e2('0x3e')](_0x5e5967[_0x57e2('0x35')],_0x3baaa5[_0x57e2('0x36')]));if(_0x5e5967[_0x57e2('0x35')][_0x57e2('0x41')]){_0x4a6a54[_0x57e2('0x3f')]=_['merge'](_0x4a6a54['where'],{'$or':_[_0x57e2('0x34')](_0x4a6a54['attributes'],function(_0x84e380){var _0xeceede={};_0xeceede[_0x84e380]={'$like':'%'+_0x5e5967[_0x57e2('0x35')][_0x57e2('0x41')]+'%'};return _0xeceede;})});}_0x4a6a54=_[_0x57e2('0x42')]({},_0x4a6a54,_0x5e5967[_0x57e2('0x43')]);return _0x2c7ca7[_0x57e2('0x53')](_0x4a6a54);}})[_0x57e2('0x27')](function(_0x2d9749){if(_0x2d9749){_0x4915fb=_0x2d9749[_0x57e2('0x3a')];if(!_0x5e5967[_0x57e2('0x35')][_0x57e2('0x3b')](_0x57e2('0x3c'))){_0x4a6a54[_0x57e2('0x1e')]=qs[_0x57e2('0x1e')](_0x5e5967['query'][_0x57e2('0x1e')]);_0x4a6a54[_0x57e2('0x20')]=qs[_0x57e2('0x20')](_0x5e5967[_0x57e2('0x35')][_0x57e2('0x20')]);}return _0x2c7ca7[_0x57e2('0x53')](_0x4a6a54);}})[_0x57e2('0x27')](function(_0x22dbdc){if(_0x22dbdc){return _0x22dbdc?{'count':_0x4915fb,'rows':_0x22dbdc}:null;}})['then'](respondWithResult(_0x1cd975,null))[_0x57e2('0x47')](handleError(_0x1cd975,null));};exports[_0x57e2('0x55')]=function(_0x54f38f,_0x5e7cd7,_0x145d3c){if(_0x54f38f[_0x57e2('0x4c')]['id']){delete _0x54f38f[_0x57e2('0x4c')]['id'];}return db[_0x57e2('0x2e')]['findOne']({'where':{'id':_0x54f38f[_0x57e2('0x49')]['id']}})[_0x57e2('0x27')](handleEntityNotFound(_0x5e7cd7,null))[_0x57e2('0x27')](function(_0x42b695){if(_0x42b695){return _0x42b695[_0x57e2('0x55')](_0x54f38f[_0x57e2('0x4c')][_0x57e2('0x56')]||[]);}return null;})['then'](respondWithResult(_0x5e7cd7,null))['catch'](handleError(_0x5e7cd7,null));}; \ No newline at end of file +var _0xbf50=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','create','body','find','destroy','findOne','getFields','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel'];(function(_0x209cd3,_0x56a336){var _0x4c75c3=function(_0x448593){while(--_0x448593){_0x209cd3['push'](_0x209cd3['shift']());}};_0x4c75c3(++_0x56a336);}(_0xbf50,0x1f1));var _0x0bf5=function(_0x5d6600,_0x9a9e9b){_0x5d6600=_0x5d6600-0x0;var _0x3c85cc=_0xbf50[_0x5d6600];return _0x3c85cc;};'use strict';var emlformat=require(_0x0bf5('0x0'));var rimraf=require(_0x0bf5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0bf5('0x2'));var rp=require(_0x0bf5('0x3'));var moment=require(_0x0bf5('0x4'));var BPromise=require(_0x0bf5('0x5'));var Mustache=require(_0x0bf5('0x6'));var util=require(_0x0bf5('0x7'));var path=require('path');var sox=require(_0x0bf5('0x8'));var csv=require('to-csv');var ejs=require(_0x0bf5('0x9'));var fs=require('fs');var fs_extra=require(_0x0bf5('0xa'));var _=require(_0x0bf5('0xb'));var squel=require(_0x0bf5('0xc'));var crypto=require(_0x0bf5('0xd'));var jsforce=require(_0x0bf5('0xe'));var deskjs=require(_0x0bf5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0bf5('0x10'));var Redis=require(_0x0bf5('0x11'));var authService=require(_0x0bf5('0x12'));var qs=require(_0x0bf5('0x13'));var as=require(_0x0bf5('0x14'));var hardwareService=require(_0x0bf5('0x15'));var logger=require(_0x0bf5('0x16'))(_0x0bf5('0x17'));var utils=require(_0x0bf5('0x18'));var config=require(_0x0bf5('0x19'));var licenseUtil=require(_0x0bf5('0x1a'));var db=require(_0x0bf5('0x1b'))['db'];function respondWithStatusCode(_0x38e1ae,_0x2fa0a6){_0x2fa0a6=_0x2fa0a6||0xcc;return function(_0x212b3a){if(_0x212b3a){return _0x38e1ae['sendStatus'](_0x2fa0a6);}return _0x38e1ae[_0x0bf5('0x1c')](_0x2fa0a6)[_0x0bf5('0x1d')]();};}function respondWithResult(_0x5ef7c5,_0x223a0c){_0x223a0c=_0x223a0c||0xc8;return function(_0x1cdd33){if(_0x1cdd33){return _0x5ef7c5[_0x0bf5('0x1c')](_0x223a0c)[_0x0bf5('0x1e')](_0x1cdd33);}};}function respondWithFilteredResult(_0x47f22b,_0x1368a6){return function(_0x5a9cc3){if(_0x5a9cc3){var _0x427e0c=typeof _0x1368a6[_0x0bf5('0x1f')]===_0x0bf5('0x20')&&typeof _0x1368a6['limit']===_0x0bf5('0x20');var _0x4a2eb7=_0x5a9cc3[_0x0bf5('0x21')];var _0x42b77a=_0x427e0c?0x0:_0x1368a6[_0x0bf5('0x1f')];var _0x179007=_0x427e0c?_0x5a9cc3['count']:_0x1368a6[_0x0bf5('0x1f')]+_0x1368a6[_0x0bf5('0x22')];var _0x615126;if(_0x179007>=_0x4a2eb7){_0x179007=_0x4a2eb7;_0x615126=0xc8;}else{_0x615126=0xce;}_0x47f22b[_0x0bf5('0x1c')](_0x615126);return _0x47f22b[_0x0bf5('0x23')](_0x0bf5('0x24'),_0x42b77a+'-'+_0x179007+'/'+_0x4a2eb7)['json'](_0x5a9cc3);}return null;};}function patchUpdates(_0xbf8c10){return function(_0xdc3685){try{jsonpatch['apply'](_0xdc3685,_0xbf8c10,!![]);}catch(_0x9b14eb){return BPromise['reject'](_0x9b14eb);}return _0xdc3685[_0x0bf5('0x25')]();};}function saveUpdates(_0x43f4ee,_0xf868a3){return function(_0x2ff41e){if(_0x2ff41e){return _0x2ff41e[_0x0bf5('0x26')](_0x43f4ee)[_0x0bf5('0x27')](function(_0x32cb5a){return _0x32cb5a;});}return null;};}function removeEntity(_0x5fe9b8,_0x508434){return function(_0x7c9e8b){if(_0x7c9e8b){return _0x7c9e8b['destroy']()['then'](function(){_0x5fe9b8[_0x0bf5('0x1c')](0xcc)[_0x0bf5('0x1d')]();});}};}function handleEntityNotFound(_0x7d9254,_0x4940ff){return function(_0x5abd1f){if(!_0x5abd1f){_0x7d9254['sendStatus'](0x194);}return _0x5abd1f;};}function handleError(_0x363e1a,_0x561274){_0x561274=_0x561274||0x1f4;return function(_0x2c8ec0){logger[_0x0bf5('0x28')](_0x2c8ec0[_0x0bf5('0x29')]);if(_0x2c8ec0[_0x0bf5('0x2a')]){delete _0x2c8ec0[_0x0bf5('0x2a')];}_0x363e1a['status'](_0x561274)[_0x0bf5('0x2b')](_0x2c8ec0);};}exports['index']=function(_0x145ffd,_0x38bc1c){var _0x59b68d={},_0x246388={},_0x300b65={'count':0x0,'rows':[]};var _0x863ac7=_[_0x0bf5('0x2c')](db[_0x0bf5('0x2d')][_0x0bf5('0x2e')],function(_0xdc3200){return{'name':_0xdc3200[_0x0bf5('0x2f')],'type':_0xdc3200[_0x0bf5('0x30')]['key']};});_0x246388[_0x0bf5('0x31')]=_[_0x0bf5('0x2c')](_0x863ac7,_0x0bf5('0x2a'));_0x246388[_0x0bf5('0x32')]=_[_0x0bf5('0x33')](_0x145ffd[_0x0bf5('0x32')]);_0x246388[_0x0bf5('0x34')]=_[_0x0bf5('0x35')](_0x246388['model'],_0x246388[_0x0bf5('0x32')]);_0x59b68d['attributes']=_[_0x0bf5('0x35')](_0x246388[_0x0bf5('0x31')],qs[_0x0bf5('0x36')](_0x145ffd[_0x0bf5('0x32')]['fields']));_0x59b68d[_0x0bf5('0x37')]=_0x59b68d[_0x0bf5('0x37')][_0x0bf5('0x38')]?_0x59b68d[_0x0bf5('0x37')]:_0x246388[_0x0bf5('0x31')];if(!_0x145ffd[_0x0bf5('0x32')][_0x0bf5('0x39')](_0x0bf5('0x3a'))){_0x59b68d['limit']=qs[_0x0bf5('0x22')](_0x145ffd[_0x0bf5('0x32')][_0x0bf5('0x22')]);_0x59b68d[_0x0bf5('0x1f')]=qs['offset'](_0x145ffd[_0x0bf5('0x32')][_0x0bf5('0x1f')]);}_0x59b68d[_0x0bf5('0x3b')]=qs[_0x0bf5('0x3c')](_0x145ffd[_0x0bf5('0x32')][_0x0bf5('0x3c')]);_0x59b68d[_0x0bf5('0x3d')]=qs[_0x0bf5('0x34')](_[_0x0bf5('0x3e')](_0x145ffd[_0x0bf5('0x32')],_0x246388['filters']),_0x863ac7);if(_0x145ffd[_0x0bf5('0x32')][_0x0bf5('0x3f')]){_0x59b68d[_0x0bf5('0x3d')]=_[_0x0bf5('0x40')](_0x59b68d[_0x0bf5('0x3d')],{'$or':_[_0x0bf5('0x2c')](_0x863ac7,function(_0x3ad4ea){if(_0x3ad4ea[_0x0bf5('0x30')]!==_0x0bf5('0x41')){var _0x3f9754={};_0x3f9754[_0x3ad4ea['name']]={'$like':'%'+_0x145ffd[_0x0bf5('0x32')]['filter']+'%'};return _0x3f9754;}})});}_0x59b68d=_['merge']({},_0x59b68d,_0x145ffd[_0x0bf5('0x42')]);var _0x68b9d1={'where':_0x59b68d[_0x0bf5('0x3d')]};return db[_0x0bf5('0x2d')][_0x0bf5('0x21')](_0x68b9d1)[_0x0bf5('0x27')](function(_0x56a4f4){_0x300b65['count']=_0x56a4f4;if(_0x145ffd['query'][_0x0bf5('0x43')]){_0x59b68d[_0x0bf5('0x44')]=[{'all':!![]}];}return db[_0x0bf5('0x2d')]['findAll'](_0x59b68d);})['then'](function(_0x50b141){_0x300b65['rows']=_0x50b141;return _0x300b65;})[_0x0bf5('0x27')](respondWithFilteredResult(_0x38bc1c,_0x59b68d))[_0x0bf5('0x45')](handleError(_0x38bc1c,null));};exports[_0x0bf5('0x46')]=function(_0x3e1aee,_0x30dc38){var _0x5544d3={'raw':![],'where':{'id':_0x3e1aee[_0x0bf5('0x47')]['id']}},_0x537da3={};_0x537da3[_0x0bf5('0x31')]=_[_0x0bf5('0x33')](db[_0x0bf5('0x2d')][_0x0bf5('0x2e')]);_0x537da3[_0x0bf5('0x32')]=_[_0x0bf5('0x33')](_0x3e1aee[_0x0bf5('0x32')]);_0x537da3[_0x0bf5('0x34')]=_[_0x0bf5('0x35')](_0x537da3[_0x0bf5('0x31')],_0x537da3[_0x0bf5('0x32')]);_0x5544d3['attributes']=_[_0x0bf5('0x35')](_0x537da3[_0x0bf5('0x31')],qs[_0x0bf5('0x36')](_0x3e1aee[_0x0bf5('0x32')]['fields']));_0x5544d3[_0x0bf5('0x37')]=_0x5544d3[_0x0bf5('0x37')][_0x0bf5('0x38')]?_0x5544d3[_0x0bf5('0x37')]:_0x537da3[_0x0bf5('0x31')];if(_0x3e1aee[_0x0bf5('0x32')][_0x0bf5('0x43')]){_0x5544d3[_0x0bf5('0x44')]=[{'all':!![]}];}_0x5544d3=_[_0x0bf5('0x40')]({},_0x5544d3,_0x3e1aee[_0x0bf5('0x42')]);return db['FreshdeskConfiguration']['find'](_0x5544d3)[_0x0bf5('0x27')](handleEntityNotFound(_0x30dc38,null))['then'](respondWithResult(_0x30dc38,null))[_0x0bf5('0x45')](handleError(_0x30dc38,null));};exports['create']=function(_0x40f4ac,_0x2050a2){return db[_0x0bf5('0x2d')][_0x0bf5('0x48')](_0x40f4ac[_0x0bf5('0x49')],{})[_0x0bf5('0x27')](respondWithResult(_0x2050a2,0xc9))[_0x0bf5('0x45')](handleError(_0x2050a2,null));};exports[_0x0bf5('0x26')]=function(_0x758a7a,_0x20d076){if(_0x758a7a[_0x0bf5('0x49')]['id']){delete _0x758a7a['body']['id'];}return db['FreshdeskConfiguration'][_0x0bf5('0x4a')]({'where':{'id':_0x758a7a[_0x0bf5('0x47')]['id']}})[_0x0bf5('0x27')](handleEntityNotFound(_0x20d076,null))[_0x0bf5('0x27')](saveUpdates(_0x758a7a[_0x0bf5('0x49')],null))['then'](respondWithResult(_0x20d076,null))[_0x0bf5('0x45')](handleError(_0x20d076,null));};exports[_0x0bf5('0x4b')]=function(_0x48f887,_0xc4a73b){return db[_0x0bf5('0x2d')][_0x0bf5('0x4a')]({'where':{'id':_0x48f887[_0x0bf5('0x47')]['id']}})['then'](handleEntityNotFound(_0xc4a73b,null))[_0x0bf5('0x27')](removeEntity(_0xc4a73b,null))[_0x0bf5('0x45')](handleError(_0xc4a73b,null));};exports['getFields']=function(_0x568629,_0x46e8a9,_0x35e3a5){var _0xb989c0={};var _0xaf9c87={};var _0x2b0a09;var _0x26f973;return db['FreshdeskConfiguration'][_0x0bf5('0x4c')]({'where':{'id':_0x568629[_0x0bf5('0x47')]['id']}})[_0x0bf5('0x27')](handleEntityNotFound(_0x46e8a9,null))[_0x0bf5('0x27')](function(_0x2b5fa2){if(_0x2b5fa2){_0x2b0a09=_0x2b5fa2;_0xaf9c87[_0x0bf5('0x31')]=_['keys'](db['FreshdeskField'][_0x0bf5('0x2e')]);_0xaf9c87[_0x0bf5('0x32')]=_[_0x0bf5('0x33')](_0x568629[_0x0bf5('0x32')]);_0xaf9c87[_0x0bf5('0x34')]=_['intersection'](_0xaf9c87[_0x0bf5('0x31')],_0xaf9c87[_0x0bf5('0x32')]);_0xb989c0[_0x0bf5('0x37')]=_[_0x0bf5('0x35')](_0xaf9c87[_0x0bf5('0x31')],qs[_0x0bf5('0x36')](_0x568629[_0x0bf5('0x32')][_0x0bf5('0x36')]));_0xb989c0[_0x0bf5('0x37')]=_0xb989c0[_0x0bf5('0x37')]['length']?_0xb989c0[_0x0bf5('0x37')]:_0xaf9c87['model'];_0xb989c0[_0x0bf5('0x3b')]=qs[_0x0bf5('0x3c')](_0x568629['query'][_0x0bf5('0x3c')]);_0xb989c0['where']=qs['filters'](_[_0x0bf5('0x3e')](_0x568629[_0x0bf5('0x32')],_0xaf9c87['filters']));if(_0x568629[_0x0bf5('0x32')][_0x0bf5('0x3f')]){_0xb989c0[_0x0bf5('0x3d')]=_[_0x0bf5('0x40')](_0xb989c0[_0x0bf5('0x3d')],{'$or':_['map'](_0xb989c0[_0x0bf5('0x37')],function(_0x204af3){var _0x346553={};_0x346553[_0x204af3]={'$like':'%'+_0x568629['query']['filter']+'%'};return _0x346553;})});}_0xb989c0=_[_0x0bf5('0x40')]({},_0xb989c0,_0x568629[_0x0bf5('0x42')]);return _0x2b0a09[_0x0bf5('0x4d')](_0xb989c0);}})['then'](function(_0x1efeb2){if(_0x1efeb2){_0x26f973=_0x1efeb2[_0x0bf5('0x38')];if(!_0x568629['query'][_0x0bf5('0x39')](_0x0bf5('0x3a'))){_0xb989c0[_0x0bf5('0x22')]=qs['limit'](_0x568629[_0x0bf5('0x32')][_0x0bf5('0x22')]);_0xb989c0[_0x0bf5('0x1f')]=qs[_0x0bf5('0x1f')](_0x568629[_0x0bf5('0x32')][_0x0bf5('0x1f')]);}return _0x2b0a09[_0x0bf5('0x4d')](_0xb989c0);}})[_0x0bf5('0x27')](function(_0x1d70e5){if(_0x1d70e5){return _0x1d70e5?{'count':_0x26f973,'rows':_0x1d70e5}:null;}})[_0x0bf5('0x27')](respondWithResult(_0x46e8a9,null))[_0x0bf5('0x45')](handleError(_0x46e8a9,null));};exports[_0x0bf5('0x4e')]=function(_0x580566,_0xae3a59,_0x4e9512){var _0x447782={};var _0x55f5e6={};var _0x20f9b9;var _0x1bd753;return db[_0x0bf5('0x2d')]['findOne']({'where':{'id':_0x580566[_0x0bf5('0x47')]['id']}})['then'](handleEntityNotFound(_0xae3a59,null))[_0x0bf5('0x27')](function(_0x1b305b){if(_0x1b305b){_0x20f9b9=_0x1b305b;_0x55f5e6[_0x0bf5('0x31')]=_[_0x0bf5('0x33')](db[_0x0bf5('0x4f')][_0x0bf5('0x2e')]);_0x55f5e6['query']=_[_0x0bf5('0x33')](_0x580566['query']);_0x55f5e6['filters']=_[_0x0bf5('0x35')](_0x55f5e6[_0x0bf5('0x31')],_0x55f5e6['query']);_0x447782[_0x0bf5('0x37')]=_[_0x0bf5('0x35')](_0x55f5e6[_0x0bf5('0x31')],qs['fields'](_0x580566['query'][_0x0bf5('0x36')]));_0x447782[_0x0bf5('0x37')]=_0x447782[_0x0bf5('0x37')]['length']?_0x447782[_0x0bf5('0x37')]:_0x55f5e6[_0x0bf5('0x31')];_0x447782['order']=qs[_0x0bf5('0x3c')](_0x580566[_0x0bf5('0x32')][_0x0bf5('0x3c')]);_0x447782[_0x0bf5('0x3d')]=qs[_0x0bf5('0x34')](_[_0x0bf5('0x3e')](_0x580566[_0x0bf5('0x32')],_0x55f5e6['filters']));if(_0x580566[_0x0bf5('0x32')][_0x0bf5('0x3f')]){_0x447782[_0x0bf5('0x3d')]=_[_0x0bf5('0x40')](_0x447782[_0x0bf5('0x3d')],{'$or':_[_0x0bf5('0x2c')](_0x447782[_0x0bf5('0x37')],function(_0x1fdbd8){var _0x4f861f={};_0x4f861f[_0x1fdbd8]={'$like':'%'+_0x580566[_0x0bf5('0x32')][_0x0bf5('0x3f')]+'%'};return _0x4f861f;})});}_0x447782=_[_0x0bf5('0x40')]({},_0x447782,_0x580566[_0x0bf5('0x42')]);return _0x20f9b9[_0x0bf5('0x4e')](_0x447782);}})[_0x0bf5('0x27')](function(_0x150560){if(_0x150560){_0x1bd753=_0x150560[_0x0bf5('0x38')];if(!_0x580566[_0x0bf5('0x32')][_0x0bf5('0x39')](_0x0bf5('0x3a'))){_0x447782[_0x0bf5('0x22')]=qs['limit'](_0x580566[_0x0bf5('0x32')][_0x0bf5('0x22')]);_0x447782[_0x0bf5('0x1f')]=qs[_0x0bf5('0x1f')](_0x580566[_0x0bf5('0x32')][_0x0bf5('0x1f')]);}return _0x20f9b9[_0x0bf5('0x4e')](_0x447782);}})[_0x0bf5('0x27')](function(_0x227b68){if(_0x227b68){return _0x227b68?{'count':_0x1bd753,'rows':_0x227b68}:null;}})[_0x0bf5('0x27')](respondWithResult(_0xae3a59,null))[_0x0bf5('0x45')](handleError(_0xae3a59,null));};exports['getDescriptions']=function(_0xacb65a,_0x58b8f8,_0x1ce3cf){var _0x9e59fb={};var _0x481711={};var _0x2ab67d;var _0x2402fd;return db[_0x0bf5('0x2d')][_0x0bf5('0x4c')]({'where':{'id':_0xacb65a[_0x0bf5('0x47')]['id']}})[_0x0bf5('0x27')](handleEntityNotFound(_0x58b8f8,null))['then'](function(_0xa56906){if(_0xa56906){_0x2ab67d=_0xa56906;_0x481711['model']=_[_0x0bf5('0x33')](db[_0x0bf5('0x4f')]['rawAttributes']);_0x481711[_0x0bf5('0x32')]=_[_0x0bf5('0x33')](_0xacb65a['query']);_0x481711[_0x0bf5('0x34')]=_[_0x0bf5('0x35')](_0x481711[_0x0bf5('0x31')],_0x481711[_0x0bf5('0x32')]);_0x9e59fb[_0x0bf5('0x37')]=_[_0x0bf5('0x35')](_0x481711[_0x0bf5('0x31')],qs[_0x0bf5('0x36')](_0xacb65a['query']['fields']));_0x9e59fb[_0x0bf5('0x37')]=_0x9e59fb[_0x0bf5('0x37')][_0x0bf5('0x38')]?_0x9e59fb[_0x0bf5('0x37')]:_0x481711[_0x0bf5('0x31')];_0x9e59fb[_0x0bf5('0x3b')]=qs[_0x0bf5('0x3c')](_0xacb65a[_0x0bf5('0x32')]['sort']);_0x9e59fb[_0x0bf5('0x3d')]=qs['filters'](_[_0x0bf5('0x3e')](_0xacb65a['query'],_0x481711[_0x0bf5('0x34')]));if(_0xacb65a[_0x0bf5('0x32')][_0x0bf5('0x3f')]){_0x9e59fb['where']=_[_0x0bf5('0x40')](_0x9e59fb[_0x0bf5('0x3d')],{'$or':_[_0x0bf5('0x2c')](_0x9e59fb['attributes'],function(_0x1ee457){var _0x2cdd21={};_0x2cdd21[_0x1ee457]={'$like':'%'+_0xacb65a[_0x0bf5('0x32')][_0x0bf5('0x3f')]+'%'};return _0x2cdd21;})});}_0x9e59fb=_[_0x0bf5('0x40')]({},_0x9e59fb,_0xacb65a[_0x0bf5('0x42')]);return _0x2ab67d[_0x0bf5('0x50')](_0x9e59fb);}})[_0x0bf5('0x27')](function(_0x386b98){if(_0x386b98){_0x2402fd=_0x386b98[_0x0bf5('0x38')];if(!_0xacb65a[_0x0bf5('0x32')]['hasOwnProperty'](_0x0bf5('0x3a'))){_0x9e59fb[_0x0bf5('0x22')]=qs[_0x0bf5('0x22')](_0xacb65a[_0x0bf5('0x32')][_0x0bf5('0x22')]);_0x9e59fb[_0x0bf5('0x1f')]=qs[_0x0bf5('0x1f')](_0xacb65a[_0x0bf5('0x32')]['offset']);}return _0x2ab67d[_0x0bf5('0x50')](_0x9e59fb);}})[_0x0bf5('0x27')](function(_0x31216a){if(_0x31216a){return _0x31216a?{'count':_0x2402fd,'rows':_0x31216a}:null;}})[_0x0bf5('0x27')](respondWithResult(_0x58b8f8,null))['catch'](handleError(_0x58b8f8,null));};exports[_0x0bf5('0x51')]=function(_0xe018c9,_0x468cd5,_0x548471){var _0x5d34bc={};var _0x181c89={};var _0x9e2c46;var _0x54a0ba;return db[_0x0bf5('0x2d')][_0x0bf5('0x4c')]({'where':{'id':_0xe018c9['params']['id']}})['then'](handleEntityNotFound(_0x468cd5,null))['then'](function(_0x5e0e1d){if(_0x5e0e1d){_0x9e2c46=_0x5e0e1d;_0x181c89[_0x0bf5('0x31')]=_[_0x0bf5('0x33')](db[_0x0bf5('0x52')][_0x0bf5('0x2e')]);_0x181c89['query']=_[_0x0bf5('0x33')](_0xe018c9[_0x0bf5('0x32')]);_0x181c89[_0x0bf5('0x34')]=_[_0x0bf5('0x35')](_0x181c89[_0x0bf5('0x31')],_0x181c89['query']);_0x5d34bc[_0x0bf5('0x37')]=_[_0x0bf5('0x35')](_0x181c89[_0x0bf5('0x31')],qs[_0x0bf5('0x36')](_0xe018c9[_0x0bf5('0x32')][_0x0bf5('0x36')]));_0x5d34bc[_0x0bf5('0x37')]=_0x5d34bc['attributes'][_0x0bf5('0x38')]?_0x5d34bc['attributes']:_0x181c89['model'];_0x5d34bc[_0x0bf5('0x3b')]=qs[_0x0bf5('0x3c')](_0xe018c9[_0x0bf5('0x32')][_0x0bf5('0x3c')]);_0x5d34bc[_0x0bf5('0x3d')]=qs[_0x0bf5('0x34')](_[_0x0bf5('0x3e')](_0xe018c9[_0x0bf5('0x32')],_0x181c89[_0x0bf5('0x34')]));if(_0xe018c9[_0x0bf5('0x32')][_0x0bf5('0x3f')]){_0x5d34bc['where']=_[_0x0bf5('0x40')](_0x5d34bc['where'],{'$or':_['map'](_0x5d34bc[_0x0bf5('0x37')],function(_0x53be05){var _0x1f3ae1={};_0x1f3ae1[_0x53be05]={'$like':'%'+_0xe018c9['query'][_0x0bf5('0x3f')]+'%'};return _0x1f3ae1;})});}_0x5d34bc=_['merge']({},_0x5d34bc,_0xe018c9[_0x0bf5('0x42')]);return _0x9e2c46[_0x0bf5('0x51')](_0x5d34bc);}})[_0x0bf5('0x27')](function(_0x41f677){if(_0x41f677){_0x54a0ba=_0x41f677['length'];if(!_0xe018c9[_0x0bf5('0x32')][_0x0bf5('0x39')]('nolimit')){_0x5d34bc[_0x0bf5('0x22')]=qs[_0x0bf5('0x22')](_0xe018c9['query'][_0x0bf5('0x22')]);_0x5d34bc[_0x0bf5('0x1f')]=qs['offset'](_0xe018c9[_0x0bf5('0x32')][_0x0bf5('0x1f')]);}return _0x9e2c46['getTags'](_0x5d34bc);}})[_0x0bf5('0x27')](function(_0x280c7e){if(_0x280c7e){return _0x280c7e?{'count':_0x54a0ba,'rows':_0x280c7e}:null;}})['then'](respondWithResult(_0x468cd5,null))[_0x0bf5('0x45')](handleError(_0x468cd5,null));};exports[_0x0bf5('0x53')]=function(_0x1b617a,_0x235b67,_0x5026e9){if(_0x1b617a[_0x0bf5('0x49')]['id']){delete _0x1b617a['body']['id'];}return db[_0x0bf5('0x2d')][_0x0bf5('0x4c')]({'where':{'id':_0x1b617a[_0x0bf5('0x47')]['id']}})[_0x0bf5('0x27')](handleEntityNotFound(_0x235b67,null))[_0x0bf5('0x27')](function(_0x139cc8){if(_0x139cc8){return _0x139cc8['setTags'](_0x1b617a[_0x0bf5('0x49')][_0x0bf5('0x54')]||[]);}return null;})[_0x0bf5('0x27')](respondWithResult(_0x235b67,null))[_0x0bf5('0x45')](handleError(_0x235b67,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 0870cd8..1ba1d81 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 _0x8ff9=['bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x46fbfc,_0x1d781a){var _0x27a199=function(_0x49bbd1){while(--_0x49bbd1){_0x46fbfc['push'](_0x46fbfc['shift']());}};_0x27a199(++_0x1d781a);}(_0x8ff9,0xa3));var _0x98ff=function(_0x4b73ed,_0x591cd6){_0x4b73ed=_0x4b73ed-0x0;var _0xca3c69=_0x8ff9[_0x4b73ed];return _0xca3c69;};'use strict';var _=require(_0x98ff('0x0'));var util=require(_0x98ff('0x1'));var logger=require(_0x98ff('0x2'))(_0x98ff('0x3'));var moment=require(_0x98ff('0x4'));var BPromise=require(_0x98ff('0x5'));var rp=require(_0x98ff('0x6'));var fs=require('fs');var path=require(_0x98ff('0x7'));var rimraf=require(_0x98ff('0x8'));var config=require('../../config/environment');var attributes=require(_0x98ff('0x9'));module[_0x98ff('0xa')]=function(_0x42d6a0,_0x3e7de4){return _0x42d6a0['define']('FreshdeskConfiguration',attributes,{'tableName':_0x98ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7f0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','int_freshdesk_configurations','lodash'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0xc7f0,0x9f));var _0x0c7f=function(_0x335dcc,_0x574dab){_0x335dcc=_0x335dcc-0x0;var _0x37cb0e=_0xc7f0[_0x335dcc];return _0x37cb0e;};'use strict';var _=require(_0x0c7f('0x0'));var util=require('util');var logger=require(_0x0c7f('0x1'))(_0x0c7f('0x2'));var moment=require(_0x0c7f('0x3'));var BPromise=require(_0x0c7f('0x4'));var rp=require(_0x0c7f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c7f('0x6'));var config=require(_0x0c7f('0x7'));var attributes=require(_0x0c7f('0x8'));module['exports']=function(_0x4ac345,_0x2e1c81){return _0x4ac345['define']('FreshdeskConfiguration',attributes,{'tableName':_0x0c7f('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 419ac45..b7fe03c 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 _0xdc71=['stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdc71,0x161));var _0x1dc7=function(_0x3f9c47,_0x3c00ad){_0x3f9c47=_0x3f9c47-0x0;var _0x430344=_0xdc71[_0x3f9c47];return _0x430344;};'use strict';var _=require(_0x1dc7('0x0'));var util=require(_0x1dc7('0x1'));var moment=require('moment');var BPromise=require(_0x1dc7('0x2'));var rs=require(_0x1dc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dc7('0x4'))['db'];var utils=require(_0x1dc7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1dc7('0x6'));var jayson=require(_0x1dc7('0x7'));var client=jayson[_0x1dc7('0x8')][_0x1dc7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cfeba,_0x355c46,_0x558a89){return new BPromise(function(_0xf05659,_0x11b741){return client[_0x1dc7('0xa')](_0x4cfeba,_0x558a89)[_0x1dc7('0xb')](function(_0x939ca5){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x355c46,_0x1dc7('0xc'));logger[_0x1dc7('0xd')](_0x1dc7('0xe'),_0x355c46,_0x1dc7('0xc'),JSON[_0x1dc7('0xf')](_0x939ca5));if(_0x939ca5[_0x1dc7('0x10')]){if(_0x939ca5['error'][_0x1dc7('0x11')]===0x1f4){logger['error'](_0x1dc7('0x12'),_0x355c46,_0x939ca5[_0x1dc7('0x10')][_0x1dc7('0x13')]);return _0x11b741(_0x939ca5['error'][_0x1dc7('0x13')]);}logger[_0x1dc7('0x10')](_0x1dc7('0x12'),_0x355c46,_0x939ca5[_0x1dc7('0x10')][_0x1dc7('0x13')]);return _0xf05659(_0x939ca5[_0x1dc7('0x10')][_0x1dc7('0x13')]);}else{logger[_0x1dc7('0x14')](_0x1dc7('0x12'),_0x355c46,_0x1dc7('0xc'));_0xf05659(_0x939ca5[_0x1dc7('0x15')]['message']);}})[_0x1dc7('0x16')](function(_0x3e7b07){logger[_0x1dc7('0x10')](_0x1dc7('0x12'),_0x355c46,_0x3e7b07);_0x11b741(_0x3e7b07);});});} \ No newline at end of file +var _0x0b1f=['result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x54e348,_0xc1f87f){var _0x21f143=function(_0x20365e){while(--_0x20365e){_0x54e348['push'](_0x54e348['shift']());}};_0x21f143(++_0xc1f87f);}(_0x0b1f,0x15b));var _0xf0b1=function(_0x3f7299,_0x138bfe){_0x3f7299=_0x3f7299-0x0;var _0x2eabdc=_0x0b1f[_0x3f7299];return _0x2eabdc;};'use strict';var _=require(_0xf0b1('0x0'));var util=require(_0xf0b1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf0b1('0x2'));var fs=require('fs');var Redis=require(_0xf0b1('0x3'));var db=require(_0xf0b1('0x4'))['db'];var utils=require(_0xf0b1('0x5'));var logger=require('../../config/logger')(_0xf0b1('0x6'));var config=require(_0xf0b1('0x7'));var jayson=require(_0xf0b1('0x8'));var client=jayson[_0xf0b1('0x9')][_0xf0b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1431d8,_0x1147e5,_0x39fa7d){return new BPromise(function(_0x2b6fec,_0x3e3d38){return client[_0xf0b1('0xb')](_0x1431d8,_0x39fa7d)[_0xf0b1('0xc')](function(_0x54f1ac){logger[_0xf0b1('0xd')](_0xf0b1('0xe'),_0x1147e5,'request\x20sent');logger[_0xf0b1('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1147e5,_0xf0b1('0x10'),JSON[_0xf0b1('0x11')](_0x54f1ac));if(_0x54f1ac[_0xf0b1('0x12')]){if(_0x54f1ac[_0xf0b1('0x12')][_0xf0b1('0x13')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1147e5,_0x54f1ac[_0xf0b1('0x12')][_0xf0b1('0x14')]);return _0x3e3d38(_0x54f1ac[_0xf0b1('0x12')][_0xf0b1('0x14')]);}logger[_0xf0b1('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1147e5,_0x54f1ac[_0xf0b1('0x12')][_0xf0b1('0x14')]);return _0x2b6fec(_0x54f1ac[_0xf0b1('0x12')]['message']);}else{logger[_0xf0b1('0xd')](_0xf0b1('0xe'),_0x1147e5,_0xf0b1('0x10'));_0x2b6fec(_0x54f1ac[_0xf0b1('0x15')][_0xf0b1('0x14')]);}})[_0xf0b1('0x16')](function(_0x43816e){logger[_0xf0b1('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1147e5,_0x43816e);_0x3e3d38(_0x43816e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 0c4e449..cbba946 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 _0x4507=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create'];(function(_0x898f3,_0x373900){var _0x57a0d4=function(_0x21a543){while(--_0x21a543){_0x898f3['push'](_0x898f3['shift']());}};_0x57a0d4(++_0x373900);}(_0x4507,0x180));var _0x7450=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x4507[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x7450('0x0'));var util=require(_0x7450('0x1'));var path=require(_0x7450('0x2'));var timeout=require(_0x7450('0x3'));var express=require(_0x7450('0x4'));var router=express[_0x7450('0x5')]();var fs_extra=require(_0x7450('0x6'));var auth=require(_0x7450('0x7'));var interaction=require(_0x7450('0x8'));var config=require(_0x7450('0x9'));var controller=require('./intFreshdeskField.controller');router[_0x7450('0xa')]('/',auth[_0x7450('0xb')](),controller['index']);router['get'](_0x7450('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7450('0xd')]('/',auth[_0x7450('0xb')](),controller[_0x7450('0xe')]);router[_0x7450('0xf')](_0x7450('0xc'),auth[_0x7450('0xb')](),controller['update']);router[_0x7450('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x7450('0x11')]);module[_0x7450('0x12')]=router; \ No newline at end of file +var _0x11bb=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x5b73b0,_0x5cc227){var _0x1b3484=function(_0x2d8bba){while(--_0x2d8bba){_0x5b73b0['push'](_0x5b73b0['shift']());}};_0x1b3484(++_0x5cc227);}(_0x11bb,0x1e0));var _0xb11b=function(_0x65397d,_0xf997ae){_0x65397d=_0x65397d-0x0;var _0x357509=_0x11bb[_0x65397d];return _0x357509;};'use strict';var multer=require(_0xb11b('0x0'));var util=require('util');var path=require(_0xb11b('0x1'));var timeout=require(_0xb11b('0x2'));var express=require(_0xb11b('0x3'));var router=express[_0xb11b('0x4')]();var fs_extra=require(_0xb11b('0x5'));var auth=require(_0xb11b('0x6'));var interaction=require(_0xb11b('0x7'));var config=require(_0xb11b('0x8'));var controller=require(_0xb11b('0x9'));router[_0xb11b('0xa')]('/',auth[_0xb11b('0xb')](),controller[_0xb11b('0xc')]);router[_0xb11b('0xa')](_0xb11b('0xd'),auth[_0xb11b('0xb')](),controller[_0xb11b('0xe')]);router[_0xb11b('0xf')]('/',auth[_0xb11b('0xb')](),controller[_0xb11b('0x10')]);router[_0xb11b('0x11')](_0xb11b('0xd'),auth[_0xb11b('0xb')](),controller[_0xb11b('0x12')]);router[_0xb11b('0x13')](_0xb11b('0xd'),auth[_0xb11b('0xb')](),controller['destroy']);module[_0xb11b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index f5ae48f..a166549 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 _0x4638=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x48599c,_0x154cca){var _0x2626b6=function(_0x3a5646){while(--_0x3a5646){_0x48599c['push'](_0x48599c['shift']());}};_0x2626b6(++_0x154cca);}(_0x4638,0x1df));var _0x8463=function(_0x498ec1,_0x89d0bb){_0x498ec1=_0x498ec1-0x0;var _0x1e28cd=_0x4638[_0x498ec1];return _0x1e28cd;};'use strict';var Sequelize=require(_0x8463('0x0'));module[_0x8463('0x1')]={'type':{'type':Sequelize[_0x8463('0x2')](_0x8463('0x3'),_0x8463('0x4'),_0x8463('0x5'),_0x8463('0x6'),_0x8463('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8463('0x2')](_0x8463('0x3'),'variable',_0x8463('0x5'))},'keyContent':{'type':Sequelize[_0x8463('0x8')]},'idField':{'type':Sequelize[_0x8463('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8463('0x8')]}}; \ No newline at end of file +var _0x90c0=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x542941,_0x4b02ec){var _0x43cb7a=function(_0xa7b715){while(--_0xa7b715){_0x542941['push'](_0x542941['shift']());}};_0x43cb7a(++_0x4b02ec);}(_0x90c0,0x131));var _0x090c=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0x90c0[_0xdaab62];return _0x13d767;};'use strict';var Sequelize=require(_0x090c('0x0'));module[_0x090c('0x1')]={'type':{'type':Sequelize[_0x090c('0x2')](_0x090c('0x3'),_0x090c('0x4'),_0x090c('0x5'),_0x090c('0x6'),_0x090c('0x7')),'defaultValue':_0x090c('0x3')},'content':{'type':Sequelize[_0x090c('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x090c('0x2')](_0x090c('0x3'),'variable',_0x090c('0x5'))},'keyContent':{'type':Sequelize[_0x090c('0x8')]},'idField':{'type':Sequelize[_0x090c('0x8')]},'nameField':{'type':Sequelize[_0x090c('0x8')]},'customField':{'type':Sequelize[_0x090c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index d2a19cd..2950e44 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 _0x9b87=['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','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','options','FreshdeskField','includeAll','include','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x9b87,0x8e));var _0x79b8=function(_0x3118fc,_0x9c0402){_0x3118fc=_0x3118fc-0x0;var _0x2fcfe6=_0x9b87[_0x3118fc];return _0x2fcfe6;};'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(){_0x28be4b[_0x79b8('0x1b')](0xcc)[_0x79b8('0x1c')]();});}};}function handleEntityNotFound(_0x9deb6c,_0x4cd38b){return function(_0x35db24){if(!_0x35db24){_0x9deb6c[_0x79b8('0x1a')](0x194);}return _0x35db24;};}function handleError(_0x1e84f3,_0x3ba5ac){_0x3ba5ac=_0x3ba5ac||0x1f4;return function(_0x4bbbf8){logger[_0x79b8('0x28')](_0x4bbbf8[_0x79b8('0x29')]);if(_0x4bbbf8[_0x79b8('0x2a')]){delete _0x4bbbf8['name'];}_0x1e84f3[_0x79b8('0x1b')](_0x3ba5ac)[_0x79b8('0x2b')](_0x4bbbf8);};}exports[_0x79b8('0x2c')]=function(_0x2942e9,_0x3662aa){var _0x23483f={},_0x4f51d1={},_0x434ecd={'count':0x0,'rows':[]};var _0x5a24fd=_[_0x79b8('0x2d')](db['FreshdeskField'][_0x79b8('0x2e')],function(_0x1090d2){return{'name':_0x1090d2[_0x79b8('0x2f')],'type':_0x1090d2['type'][_0x79b8('0x30')]};});_0x4f51d1[_0x79b8('0x31')]=_[_0x79b8('0x2d')](_0x5a24fd,_0x79b8('0x2a'));_0x4f51d1['query']=_[_0x79b8('0x32')](_0x2942e9['query']);_0x4f51d1['filters']=_[_0x79b8('0x33')](_0x4f51d1[_0x79b8('0x31')],_0x4f51d1['query']);_0x23483f[_0x79b8('0x34')]=_['intersection'](_0x4f51d1['model'],qs[_0x79b8('0x35')](_0x2942e9['query'][_0x79b8('0x35')]));_0x23483f[_0x79b8('0x34')]=_0x23483f['attributes'][_0x79b8('0x36')]?_0x23483f[_0x79b8('0x34')]:_0x4f51d1[_0x79b8('0x31')];if(!_0x2942e9[_0x79b8('0x37')][_0x79b8('0x38')](_0x79b8('0x39'))){_0x23483f['limit']=qs[_0x79b8('0x3a')](_0x2942e9[_0x79b8('0x37')][_0x79b8('0x3a')]);_0x23483f[_0x79b8('0x1d')]=qs[_0x79b8('0x1d')](_0x2942e9[_0x79b8('0x37')][_0x79b8('0x1d')]);}_0x23483f[_0x79b8('0x3b')]=qs[_0x79b8('0x3c')](_0x2942e9[_0x79b8('0x37')][_0x79b8('0x3c')]);_0x23483f['where']=qs[_0x79b8('0x3d')](_[_0x79b8('0x3e')](_0x2942e9[_0x79b8('0x37')],_0x4f51d1['filters']),_0x5a24fd);if(_0x2942e9[_0x79b8('0x37')][_0x79b8('0x3f')]){_0x23483f[_0x79b8('0x40')]=_[_0x79b8('0x41')](_0x23483f[_0x79b8('0x40')],{'$or':_[_0x79b8('0x2d')](_0x5a24fd,function(_0x4b6248){if(_0x4b6248[_0x79b8('0x42')]!=='VIRTUAL'){var _0x512d04={};_0x512d04[_0x4b6248[_0x79b8('0x2a')]]={'$like':'%'+_0x2942e9['query']['filter']+'%'};return _0x512d04;}})});}_0x23483f=_[_0x79b8('0x41')]({},_0x23483f,_0x2942e9[_0x79b8('0x43')]);var _0x422c56={'where':_0x23483f[_0x79b8('0x40')]};return db[_0x79b8('0x44')][_0x79b8('0x1f')](_0x422c56)[_0x79b8('0x26')](function(_0x2aac60){_0x434ecd[_0x79b8('0x1f')]=_0x2aac60;if(_0x2942e9[_0x79b8('0x37')][_0x79b8('0x45')]){_0x23483f[_0x79b8('0x46')]=[{'all':!![]}];}return db[_0x79b8('0x44')]['findAll'](_0x23483f);})[_0x79b8('0x26')](function(_0x13b041){_0x434ecd['rows']=_0x13b041;return _0x434ecd;})[_0x79b8('0x26')](respondWithFilteredResult(_0x3662aa,_0x23483f))[_0x79b8('0x47')](handleError(_0x3662aa,null));};exports['show']=function(_0x17dd9e,_0x62a011){var _0x2ddad8={'raw':!![],'where':{'id':_0x17dd9e[_0x79b8('0x48')]['id']}},_0x28d4e4={};_0x28d4e4[_0x79b8('0x31')]=_[_0x79b8('0x32')](db[_0x79b8('0x44')][_0x79b8('0x2e')]);_0x28d4e4[_0x79b8('0x37')]=_[_0x79b8('0x32')](_0x17dd9e[_0x79b8('0x37')]);_0x28d4e4['filters']=_['intersection'](_0x28d4e4[_0x79b8('0x31')],_0x28d4e4[_0x79b8('0x37')]);_0x2ddad8[_0x79b8('0x34')]=_[_0x79b8('0x33')](_0x28d4e4['model'],qs[_0x79b8('0x35')](_0x17dd9e[_0x79b8('0x37')][_0x79b8('0x35')]));_0x2ddad8[_0x79b8('0x34')]=_0x2ddad8['attributes'][_0x79b8('0x36')]?_0x2ddad8[_0x79b8('0x34')]:_0x28d4e4[_0x79b8('0x31')];if(_0x17dd9e[_0x79b8('0x37')]['includeAll']){_0x2ddad8[_0x79b8('0x46')]=[{'all':!![]}];}_0x2ddad8=_[_0x79b8('0x41')]({},_0x2ddad8,_0x17dd9e[_0x79b8('0x43')]);return db[_0x79b8('0x44')][_0x79b8('0x49')](_0x2ddad8)[_0x79b8('0x26')](handleEntityNotFound(_0x62a011,null))['then'](respondWithResult(_0x62a011,null))[_0x79b8('0x47')](handleError(_0x62a011,null));};exports[_0x79b8('0x4a')]=function(_0x330051,_0xc89e93){return db['FreshdeskField']['create'](_0x330051[_0x79b8('0x4b')],{})[_0x79b8('0x26')](respondWithResult(_0xc89e93,0xc9))[_0x79b8('0x47')](handleError(_0xc89e93,null));};exports[_0x79b8('0x25')]=function(_0x32e7ea,_0x19272d){if(_0x32e7ea[_0x79b8('0x4b')]['id']){delete _0x32e7ea[_0x79b8('0x4b')]['id'];}return db[_0x79b8('0x44')]['find']({'where':{'id':_0x32e7ea[_0x79b8('0x48')]['id']}})[_0x79b8('0x26')](handleEntityNotFound(_0x19272d,null))[_0x79b8('0x26')](saveUpdates(_0x32e7ea['body'],null))[_0x79b8('0x26')](respondWithResult(_0x19272d,null))['catch'](handleError(_0x19272d,null));};exports['destroy']=function(_0x24ebb2,_0x252c2c){return db[_0x79b8('0x44')][_0x79b8('0x49')]({'where':{'id':_0x24ebb2['params']['id']}})['then'](handleEntityNotFound(_0x252c2c,null))[_0x79b8('0x26')](removeEntity(_0x252c2c,null))[_0x79b8('0x47')](handleError(_0x252c2c,null));}; \ No newline at end of file +var _0x6282=['count','limit','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','FreshdeskField','includeAll','include','catch','show','params','keys','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','offset','undefined'];(function(_0x82536f,_0x34d356){var _0x246861=function(_0x496210){while(--_0x496210){_0x82536f['push'](_0x82536f['shift']());}};_0x246861(++_0x34d356);}(_0x6282,0x76));var _0x2628=function(_0x4f1946,_0x2d29f4){_0x4f1946=_0x4f1946-0x0;var _0xf6b11a=_0x6282[_0x4f1946];return _0xf6b11a;};'use strict';var emlformat=require(_0x2628('0x0'));var rimraf=require(_0x2628('0x1'));var zipdir=require(_0x2628('0x2'));var jsonpatch=require(_0x2628('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2628('0x4'));var Mustache=require(_0x2628('0x5'));var util=require('util');var path=require(_0x2628('0x6'));var sox=require(_0x2628('0x7'));var csv=require(_0x2628('0x8'));var ejs=require(_0x2628('0x9'));var fs=require('fs');var fs_extra=require(_0x2628('0xa'));var _=require('lodash');var squel=require(_0x2628('0xb'));var crypto=require(_0x2628('0xc'));var jsforce=require(_0x2628('0xd'));var deskjs=require(_0x2628('0xe'));var toCsv=require(_0x2628('0x8'));var querystring=require(_0x2628('0xf'));var Papa=require(_0x2628('0x10'));var Redis=require(_0x2628('0x11'));var authService=require(_0x2628('0x12'));var qs=require(_0x2628('0x13'));var as=require(_0x2628('0x14'));var hardwareService=require(_0x2628('0x15'));var logger=require(_0x2628('0x16'))(_0x2628('0x17'));var utils=require(_0x2628('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2628('0x19'))['db'];function respondWithStatusCode(_0x123b61,_0x340152){_0x340152=_0x340152||0xcc;return function(_0x3440a0){if(_0x3440a0){return _0x123b61['sendStatus'](_0x340152);}return _0x123b61['status'](_0x340152)[_0x2628('0x1a')]();};}function respondWithResult(_0x465a6f,_0x4d2cfb){_0x4d2cfb=_0x4d2cfb||0xc8;return function(_0x2395fe){if(_0x2395fe){return _0x465a6f[_0x2628('0x1b')](_0x4d2cfb)['json'](_0x2395fe);}};}function respondWithFilteredResult(_0x645884,_0x16e67a){return function(_0x457163){if(_0x457163){var _0x4f418d=typeof _0x16e67a[_0x2628('0x1c')]===_0x2628('0x1d')&&typeof _0x16e67a['limit']===_0x2628('0x1d');var _0x4c2a10=_0x457163[_0x2628('0x1e')];var _0x374501=_0x4f418d?0x0:_0x16e67a['offset'];var _0x2a6bed=_0x4f418d?_0x457163[_0x2628('0x1e')]:_0x16e67a['offset']+_0x16e67a[_0x2628('0x1f')];var _0x532d6d;if(_0x2a6bed>=_0x4c2a10){_0x2a6bed=_0x4c2a10;_0x532d6d=0xc8;}else{_0x532d6d=0xce;}_0x645884[_0x2628('0x1b')](_0x532d6d);return _0x645884['set']('Content-Range',_0x374501+'-'+_0x2a6bed+'/'+_0x4c2a10)[_0x2628('0x20')](_0x457163);}return null;};}function patchUpdates(_0xd4cec){return function(_0x31c1e6){try{jsonpatch[_0x2628('0x21')](_0x31c1e6,_0xd4cec,!![]);}catch(_0x1640b2){return BPromise[_0x2628('0x22')](_0x1640b2);}return _0x31c1e6[_0x2628('0x23')]();};}function saveUpdates(_0x41c2ba,_0x1746fe){return function(_0x57a799){if(_0x57a799){return _0x57a799[_0x2628('0x24')](_0x41c2ba)[_0x2628('0x25')](function(_0x91e79c){return _0x91e79c;});}return null;};}function removeEntity(_0x3904cb,_0x1abc7e){return function(_0x4bae60){if(_0x4bae60){return _0x4bae60[_0x2628('0x26')]()[_0x2628('0x25')](function(){_0x3904cb[_0x2628('0x1b')](0xcc)[_0x2628('0x1a')]();});}};}function handleEntityNotFound(_0x6070fd,_0x57455c){return function(_0x4a8768){if(!_0x4a8768){_0x6070fd[_0x2628('0x27')](0x194);}return _0x4a8768;};}function handleError(_0x254e1f,_0x221f07){_0x221f07=_0x221f07||0x1f4;return function(_0x41c18e){logger[_0x2628('0x28')](_0x41c18e['stack']);if(_0x41c18e[_0x2628('0x29')]){delete _0x41c18e[_0x2628('0x29')];}_0x254e1f[_0x2628('0x1b')](_0x221f07)[_0x2628('0x2a')](_0x41c18e);};}exports[_0x2628('0x2b')]=function(_0x118e75,_0x49480f){var _0x541eef={},_0x21c0ca={},_0x29ffee={'count':0x0,'rows':[]};var _0x3d98a7=_[_0x2628('0x2c')](db['FreshdeskField'][_0x2628('0x2d')],function(_0x292e24){return{'name':_0x292e24[_0x2628('0x2e')],'type':_0x292e24[_0x2628('0x2f')]['key']};});_0x21c0ca[_0x2628('0x30')]=_[_0x2628('0x2c')](_0x3d98a7,_0x2628('0x29'));_0x21c0ca[_0x2628('0x31')]=_['keys'](_0x118e75[_0x2628('0x31')]);_0x21c0ca[_0x2628('0x32')]=_[_0x2628('0x33')](_0x21c0ca[_0x2628('0x30')],_0x21c0ca[_0x2628('0x31')]);_0x541eef[_0x2628('0x34')]=_[_0x2628('0x33')](_0x21c0ca[_0x2628('0x30')],qs[_0x2628('0x35')](_0x118e75['query'][_0x2628('0x35')]));_0x541eef[_0x2628('0x34')]=_0x541eef[_0x2628('0x34')][_0x2628('0x36')]?_0x541eef[_0x2628('0x34')]:_0x21c0ca['model'];if(!_0x118e75['query'][_0x2628('0x37')](_0x2628('0x38'))){_0x541eef[_0x2628('0x1f')]=qs['limit'](_0x118e75[_0x2628('0x31')][_0x2628('0x1f')]);_0x541eef[_0x2628('0x1c')]=qs['offset'](_0x118e75[_0x2628('0x31')][_0x2628('0x1c')]);}_0x541eef[_0x2628('0x39')]=qs['sort'](_0x118e75['query']['sort']);_0x541eef['where']=qs[_0x2628('0x32')](_[_0x2628('0x3a')](_0x118e75[_0x2628('0x31')],_0x21c0ca['filters']),_0x3d98a7);if(_0x118e75[_0x2628('0x31')][_0x2628('0x3b')]){_0x541eef[_0x2628('0x3c')]=_['merge'](_0x541eef[_0x2628('0x3c')],{'$or':_[_0x2628('0x2c')](_0x3d98a7,function(_0x184c01){if(_0x184c01[_0x2628('0x2f')]!==_0x2628('0x3d')){var _0x3636dd={};_0x3636dd[_0x184c01[_0x2628('0x29')]]={'$like':'%'+_0x118e75['query'][_0x2628('0x3b')]+'%'};return _0x3636dd;}})});}_0x541eef=_[_0x2628('0x3e')]({},_0x541eef,_0x118e75[_0x2628('0x3f')]);var _0x3dd851={'where':_0x541eef[_0x2628('0x3c')]};return db[_0x2628('0x40')]['count'](_0x3dd851)[_0x2628('0x25')](function(_0x55ffda){_0x29ffee[_0x2628('0x1e')]=_0x55ffda;if(_0x118e75[_0x2628('0x31')][_0x2628('0x41')]){_0x541eef[_0x2628('0x42')]=[{'all':!![]}];}return db[_0x2628('0x40')]['findAll'](_0x541eef);})[_0x2628('0x25')](function(_0x5caec7){_0x29ffee['rows']=_0x5caec7;return _0x29ffee;})[_0x2628('0x25')](respondWithFilteredResult(_0x49480f,_0x541eef))[_0x2628('0x43')](handleError(_0x49480f,null));};exports[_0x2628('0x44')]=function(_0x2ccea5,_0x3328c6){var _0x55e9ff={'raw':!![],'where':{'id':_0x2ccea5[_0x2628('0x45')]['id']}},_0x116ffb={};_0x116ffb[_0x2628('0x30')]=_[_0x2628('0x46')](db[_0x2628('0x40')]['rawAttributes']);_0x116ffb[_0x2628('0x31')]=_['keys'](_0x2ccea5[_0x2628('0x31')]);_0x116ffb[_0x2628('0x32')]=_[_0x2628('0x33')](_0x116ffb[_0x2628('0x30')],_0x116ffb['query']);_0x55e9ff['attributes']=_[_0x2628('0x33')](_0x116ffb[_0x2628('0x30')],qs['fields'](_0x2ccea5[_0x2628('0x31')][_0x2628('0x35')]));_0x55e9ff[_0x2628('0x34')]=_0x55e9ff[_0x2628('0x34')]['length']?_0x55e9ff[_0x2628('0x34')]:_0x116ffb[_0x2628('0x30')];if(_0x2ccea5[_0x2628('0x31')][_0x2628('0x41')]){_0x55e9ff[_0x2628('0x42')]=[{'all':!![]}];}_0x55e9ff=_[_0x2628('0x3e')]({},_0x55e9ff,_0x2ccea5[_0x2628('0x3f')]);return db[_0x2628('0x40')]['find'](_0x55e9ff)[_0x2628('0x25')](handleEntityNotFound(_0x3328c6,null))['then'](respondWithResult(_0x3328c6,null))[_0x2628('0x43')](handleError(_0x3328c6,null));};exports['create']=function(_0x3cd5ab,_0x166340){return db[_0x2628('0x40')][_0x2628('0x47')](_0x3cd5ab[_0x2628('0x48')],{})['then'](respondWithResult(_0x166340,0xc9))[_0x2628('0x43')](handleError(_0x166340,null));};exports['update']=function(_0x2cb756,_0x3a7bd7){if(_0x2cb756[_0x2628('0x48')]['id']){delete _0x2cb756['body']['id'];}return db[_0x2628('0x40')][_0x2628('0x49')]({'where':{'id':_0x2cb756['params']['id']}})[_0x2628('0x25')](handleEntityNotFound(_0x3a7bd7,null))[_0x2628('0x25')](saveUpdates(_0x2cb756[_0x2628('0x48')],null))[_0x2628('0x25')](respondWithResult(_0x3a7bd7,null))[_0x2628('0x43')](handleError(_0x3a7bd7,null));};exports['destroy']=function(_0x405e07,_0x4b366c){return db[_0x2628('0x40')][_0x2628('0x49')]({'where':{'id':_0x405e07[_0x2628('0x45')]['id']}})[_0x2628('0x25')](handleEntityNotFound(_0x4b366c,null))[_0x2628('0x25')](removeEntity(_0x4b366c,null))[_0x2628('0x43')](handleError(_0x4b366c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 0d84bfe..169c288 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 _0xea03=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util'];(function(_0x1fbab3,_0x36e783){var _0x53d488=function(_0x1167e0){while(--_0x1167e0){_0x1fbab3['push'](_0x1fbab3['shift']());}};_0x53d488(++_0x36e783);}(_0xea03,0x15e));var _0x3ea0=function(_0x6b4f52,_0x4a17d1){_0x6b4f52=_0x6b4f52-0x0;var _0xa387e5=_0xea03[_0x6b4f52];return _0xa387e5;};'use strict';var _=require(_0x3ea0('0x0'));var util=require(_0x3ea0('0x1'));var logger=require(_0x3ea0('0x2'))(_0x3ea0('0x3'));var moment=require(_0x3ea0('0x4'));var BPromise=require(_0x3ea0('0x5'));var rp=require(_0x3ea0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ea0('0x7'));var config=require(_0x3ea0('0x8'));var attributes=require(_0x3ea0('0x9'));module[_0x3ea0('0xa')]=function(_0x25a130,_0x19f138){return _0x25a130[_0x3ea0('0xb')](_0x3ea0('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x3ea0('0xd'),'fields':[_0x3ea0('0xe'),_0x3ea0('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf9a2=['exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x333102,_0x5449cc){var _0x3cffba=function(_0x3962c4){while(--_0x3962c4){_0x333102['push'](_0x333102['shift']());}};_0x3cffba(++_0x5449cc);}(_0xf9a2,0xf4));var _0x2f9a=function(_0x167ea3,_0x2480e7){_0x167ea3=_0x167ea3-0x0;var _0x701272=_0xf9a2[_0x167ea3];return _0x701272;};'use strict';var _=require(_0x2f9a('0x0'));var util=require(_0x2f9a('0x1'));var logger=require(_0x2f9a('0x2'))(_0x2f9a('0x3'));var moment=require(_0x2f9a('0x4'));var BPromise=require(_0x2f9a('0x5'));var rp=require(_0x2f9a('0x6'));var fs=require('fs');var path=require(_0x2f9a('0x7'));var rimraf=require(_0x2f9a('0x8'));var config=require(_0x2f9a('0x9'));var attributes=require(_0x2f9a('0xa'));module[_0x2f9a('0xb')]=function(_0x90179e,_0x5c05eb){return _0x90179e['define'](_0x2f9a('0xc'),attributes,{'tableName':_0x2f9a('0xd'),'paranoid':![],'indexes':[{'name':_0x2f9a('0xe'),'fields':[_0x2f9a('0xf'),_0x2f9a('0x10')],'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 1cec133..2401639 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 _0xe064=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch'];(function(_0x2fb36a,_0x5e83a8){var _0xf24bf9=function(_0x285752){while(--_0x285752){_0x2fb36a['push'](_0x2fb36a['shift']());}};_0xf24bf9(++_0x5e83a8);}(_0xe064,0x156));var _0x4e06=function(_0xb1c5d5,_0x3a2038){_0xb1c5d5=_0xb1c5d5-0x0;var _0x3766dc=_0xe064[_0xb1c5d5];return _0x3766dc;};'use strict';var _=require(_0x4e06('0x0'));var util=require('util');var moment=require(_0x4e06('0x1'));var BPromise=require(_0x4e06('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e06('0x3'));var db=require(_0x4e06('0x4'))['db'];var utils=require(_0x4e06('0x5'));var logger=require('../../config/logger')(_0x4e06('0x6'));var config=require(_0x4e06('0x7'));var jayson=require(_0x4e06('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40d0b7,_0x51fa87,_0x1bcfa4){return new BPromise(function(_0x3183d0,_0x1cbe00){return client['request'](_0x40d0b7,_0x1bcfa4)[_0x4e06('0x9')](function(_0x3ecc88){logger[_0x4e06('0xa')](_0x4e06('0xb'),_0x51fa87,'request\x20sent');logger[_0x4e06('0xc')](_0x4e06('0xd'),_0x51fa87,'request\x20sent',JSON['stringify'](_0x3ecc88));if(_0x3ecc88[_0x4e06('0xe')]){if(_0x3ecc88[_0x4e06('0xe')][_0x4e06('0xf')]===0x1f4){logger[_0x4e06('0xe')](_0x4e06('0xb'),_0x51fa87,_0x3ecc88[_0x4e06('0xe')][_0x4e06('0x10')]);return _0x1cbe00(_0x3ecc88[_0x4e06('0xe')]['message']);}logger[_0x4e06('0xe')](_0x4e06('0xb'),_0x51fa87,_0x3ecc88[_0x4e06('0xe')][_0x4e06('0x10')]);return _0x3183d0(_0x3ecc88[_0x4e06('0xe')][_0x4e06('0x10')]);}else{logger[_0x4e06('0xa')](_0x4e06('0xb'),_0x51fa87,_0x4e06('0x11'));_0x3183d0(_0x3ecc88['result'][_0x4e06('0x10')]);}})[_0x4e06('0x12')](function(_0x367ff1){logger[_0x4e06('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x51fa87,_0x367ff1);_0x1cbe00(_0x367ff1);});});} \ No newline at end of file +var _0x33c7=['rpc','../../config/environment','client','http','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3c2d56,_0x1b47c8){var _0x1a9f64=function(_0x34105b){while(--_0x34105b){_0x3c2d56['push'](_0x3c2d56['shift']());}};_0x1a9f64(++_0x1b47c8);}(_0x33c7,0x86));var _0x733c=function(_0x5e2128,_0xe2107e){_0x5e2128=_0x5e2128-0x0;var _0x2bbc88=_0x33c7[_0x5e2128];return _0x2bbc88;};'use strict';var _=require(_0x733c('0x0'));var util=require('util');var moment=require(_0x733c('0x1'));var BPromise=require('bluebird');var rs=require(_0x733c('0x2'));var fs=require('fs');var Redis=require(_0x733c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x733c('0x4'));var logger=require(_0x733c('0x5'))(_0x733c('0x6'));var config=require(_0x733c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x733c('0x8')][_0x733c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c06ba,_0xd7430c,_0x3a27d6){return new BPromise(function(_0xed1c0f,_0x4d2eab){return client['request'](_0x4c06ba,_0x3a27d6)['then'](function(_0x2c9f73){logger[_0x733c('0xa')](_0x733c('0xb'),_0xd7430c,_0x733c('0xc'));logger[_0x733c('0xd')](_0x733c('0xe'),_0xd7430c,_0x733c('0xc'),JSON[_0x733c('0xf')](_0x2c9f73));if(_0x2c9f73[_0x733c('0x10')]){if(_0x2c9f73['error'][_0x733c('0x11')]===0x1f4){logger[_0x733c('0x10')](_0x733c('0xb'),_0xd7430c,_0x2c9f73['error'][_0x733c('0x12')]);return _0x4d2eab(_0x2c9f73[_0x733c('0x10')][_0x733c('0x12')]);}logger[_0x733c('0x10')](_0x733c('0xb'),_0xd7430c,_0x2c9f73['error'][_0x733c('0x12')]);return _0xed1c0f(_0x2c9f73['error'][_0x733c('0x12')]);}else{logger[_0x733c('0xa')]('FreshdeskField,\x20%s,\x20%s',_0xd7430c,_0x733c('0xc'));_0xed1c0f(_0x2c9f73[_0x733c('0x13')][_0x733c('0x12')]);}})['catch'](function(_0x22bf37){logger['error'](_0x733c('0xb'),_0xd7430c,_0x22bf37);_0x4d2eab(_0x22bf37);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 6ed37f4..93fe391 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 _0xcb91=['addConfiguration','update','delete','/:id','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create'];(function(_0x8d4581,_0x2ae516){var _0x5a0c60=function(_0x5850a1){while(--_0x5850a1){_0x8d4581['push'](_0x8d4581['shift']());}};_0x5a0c60(++_0x2ae516);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0xcb91[_0x4c1ec2];return _0x3f6f1c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/:id',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x1cb9('0x7')](_0x1cb9('0xc'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x12')](_0x1cb9('0x13'),auth[_0x1cb9('0x9')](),controller['destroy']);module[_0x1cb9('0x14')]=router; \ No newline at end of file +var _0x5c00=['isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','create','/:id/configurations','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x32bcb5,_0x398a36){var _0x54c66c=function(_0x38c859){while(--_0x38c859){_0x32bcb5['push'](_0x32bcb5['shift']());}};_0x54c66c(++_0x398a36);}(_0x5c00,0x17e));var _0x05c0=function(_0x29db14,_0x4fcd9f){_0x29db14=_0x29db14-0x0;var _0x5cfc55=_0x5c00[_0x29db14];return _0x5cfc55;};'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('./intFreshsalesAccount.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id/configurations',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x05c0('0xf')]);router['post'](_0x05c0('0x10'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x11')]);router['put'](_0x05c0('0x12'),auth['isAuthenticated'](),controller[_0x05c0('0x13')]);router[_0x05c0('0x14')](_0x05c0('0x12'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x15')]);module[_0x05c0('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index cd72f33..80dabd9 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 _0x3266=['remoteUri','sequelize','exports','STRING','username'];(function(_0x477358,_0x30f5b8){var _0x19bf04=function(_0x594182){while(--_0x594182){_0x477358['push'](_0x477358['shift']());}};_0x19bf04(++_0x30f5b8);}(_0x3266,0x6a));var _0x6326=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x3266[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'name':{'type':Sequelize[_0x6326('0x2')]},'description':{'type':Sequelize[_0x6326('0x2')]},'username':{'type':Sequelize[_0x6326('0x2')],'unique':_0x6326('0x3')},'apiKey':{'type':Sequelize[_0x6326('0x2')]},'remoteUri':{'type':Sequelize[_0x6326('0x2')],'unique':_0x6326('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x28f2=['exports','STRING','remoteUri','sequelize'];(function(_0x420b0c,_0xbb4ea3){var _0x3a0f8b=function(_0x238ac){while(--_0x238ac){_0x420b0c['push'](_0x420b0c['shift']());}};_0x3a0f8b(++_0xbb4ea3);}(_0x28f2,0x193));var _0x228f=function(_0x3d2ee7,_0x535d78){_0x3d2ee7=_0x3d2ee7-0x0;var _0x578188=_0x28f2[_0x3d2ee7];return _0x578188;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'name':{'type':Sequelize[_0x228f('0x2')]},'description':{'type':Sequelize[_0x228f('0x2')]},'username':{'type':Sequelize[_0x228f('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x228f('0x2')]},'remoteUri':{'type':Sequelize[_0x228f('0x2')],'unique':_0x228f('0x3')},'serverUrl':{'type':Sequelize[_0x228f('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 f05d303..84768a8 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 _0xc77d=['username','remoteUri','apiKey','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','name','send','index','map','rawAttributes','fieldName','model','keys','query','intersection','attributes','hasOwnProperty','order','sort','where','filters','filter','type','VIRTUAL','merge','options','FreshsalesAccount','then','includeAll','findAll','rows','catch','show','params','fields','length','include','create','body','find','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields'];(function(_0x30fdc8,_0x355ff6){var _0x218aef=function(_0x309770){while(--_0x309770){_0x30fdc8['push'](_0x30fdc8['shift']());}};_0x218aef(++_0x355ff6);}(_0xc77d,0x156));var _0xdc77=function(_0x28dd1a,_0x48ecb3){_0x28dd1a=_0x28dd1a-0x0;var _0x18d911=_0xc77d[_0x28dd1a];return _0x18d911;};'use strict';var emlformat=require(_0xdc77('0x0'));var rimraf=require(_0xdc77('0x1'));var zipdir=require(_0xdc77('0x2'));var jsonpatch=require(_0xdc77('0x3'));var rp=require(_0xdc77('0x4'));var moment=require('moment');var BPromise=require(_0xdc77('0x5'));var Mustache=require(_0xdc77('0x6'));var util=require(_0xdc77('0x7'));var path=require('path');var sox=require(_0xdc77('0x8'));var csv=require(_0xdc77('0x9'));var ejs=require(_0xdc77('0xa'));var fs=require('fs');var fs_extra=require(_0xdc77('0xb'));var _=require(_0xdc77('0xc'));var squel=require(_0xdc77('0xd'));var crypto=require(_0xdc77('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdc77('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdc77('0x10'));var Papa=require(_0xdc77('0x11'));var Redis=require(_0xdc77('0x12'));var authService=require(_0xdc77('0x13'));var qs=require(_0xdc77('0x14'));var as=require(_0xdc77('0x15'));var hardwareService=require(_0xdc77('0x16'));var logger=require(_0xdc77('0x17'))(_0xdc77('0x18'));var utils=require(_0xdc77('0x19'));var config=require(_0xdc77('0x1a'));var licenseUtil=require(_0xdc77('0x1b'));var db=require(_0xdc77('0x1c'))['db'];var integrations=require(_0xdc77('0x1d'));function respondWithStatusCode(_0x571d08,_0x89a394){_0x89a394=_0x89a394||0xcc;return function(_0x3b22eb){if(_0x3b22eb){return _0x571d08[_0xdc77('0x1e')](_0x89a394);}return _0x571d08['status'](_0x89a394)[_0xdc77('0x1f')]();};}function respondWithResult(_0x59b99d,_0x5b68a2){_0x5b68a2=_0x5b68a2||0xc8;return function(_0x175ff1){if(_0x175ff1){return _0x59b99d[_0xdc77('0x20')](_0x5b68a2)[_0xdc77('0x21')](_0x175ff1);}};}function respondWithFilteredResult(_0x133b75,_0x32996f){return function(_0x17901e){if(_0x17901e){var _0x2342ac=typeof _0x32996f[_0xdc77('0x22')]===_0xdc77('0x23')&&typeof _0x32996f[_0xdc77('0x24')]==='undefined';var _0x375147=_0x17901e[_0xdc77('0x25')];var _0x30faf1=_0x2342ac?0x0:_0x32996f[_0xdc77('0x22')];var _0x1a7323=_0x2342ac?_0x17901e[_0xdc77('0x25')]:_0x32996f[_0xdc77('0x22')]+_0x32996f[_0xdc77('0x24')];var _0x487c21;if(_0x1a7323>=_0x375147){_0x1a7323=_0x375147;_0x487c21=0xc8;}else{_0x487c21=0xce;}_0x133b75[_0xdc77('0x20')](_0x487c21);return _0x133b75[_0xdc77('0x26')]('Content-Range',_0x30faf1+'-'+_0x1a7323+'/'+_0x375147)[_0xdc77('0x21')](_0x17901e);}return null;};}function patchUpdates(_0x43157d){return function(_0x157ccc){try{jsonpatch[_0xdc77('0x27')](_0x157ccc,_0x43157d,!![]);}catch(_0x49859e){return BPromise[_0xdc77('0x28')](_0x49859e);}return _0x157ccc['save']();};}function saveUpdates(_0x54d591,_0xc39df5){return function(_0x448734){if(_0x448734){return _0x448734[_0xdc77('0x29')](_0x54d591)['then'](function(_0x1993db){return _0x1993db;});}return null;};}function removeEntity(_0x25fecf,_0x4c235b){return function(_0x2de886){if(_0x2de886){return _0x2de886[_0xdc77('0x2a')]()['then'](function(){_0x25fecf[_0xdc77('0x20')](0xcc)[_0xdc77('0x1f')]();});}};}function handleEntityNotFound(_0x367d4f,_0x44d625){return function(_0x4b556e){if(!_0x4b556e){_0x367d4f[_0xdc77('0x1e')](0x194);}return _0x4b556e;};}function handleError(_0x9c69a4,_0x3f0703){_0x3f0703=_0x3f0703||0x1f4;return function(_0x3aa089){logger['error'](_0x3aa089['stack']);if(_0x3aa089['name']){delete _0x3aa089[_0xdc77('0x2b')];}_0x9c69a4[_0xdc77('0x20')](_0x3f0703)[_0xdc77('0x2c')](_0x3aa089);};}exports[_0xdc77('0x2d')]=function(_0x848c0f,_0x2f26cd){var _0x8c34bb={},_0x11d7e5={},_0x18981b={'count':0x0,'rows':[]};var _0x40d7b8=_[_0xdc77('0x2e')](db['FreshsalesAccount'][_0xdc77('0x2f')],function(_0x9270cd){return{'name':_0x9270cd[_0xdc77('0x30')],'type':_0x9270cd['type']['key']};});_0x11d7e5[_0xdc77('0x31')]=_[_0xdc77('0x2e')](_0x40d7b8,_0xdc77('0x2b'));_0x11d7e5['query']=_[_0xdc77('0x32')](_0x848c0f[_0xdc77('0x33')]);_0x11d7e5['filters']=_[_0xdc77('0x34')](_0x11d7e5[_0xdc77('0x31')],_0x11d7e5['query']);_0x8c34bb[_0xdc77('0x35')]=_[_0xdc77('0x34')](_0x11d7e5[_0xdc77('0x31')],qs['fields'](_0x848c0f['query']['fields']));_0x8c34bb[_0xdc77('0x35')]=_0x8c34bb[_0xdc77('0x35')]['length']?_0x8c34bb[_0xdc77('0x35')]:_0x11d7e5[_0xdc77('0x31')];if(!_0x848c0f[_0xdc77('0x33')][_0xdc77('0x36')]('nolimit')){_0x8c34bb[_0xdc77('0x24')]=qs['limit'](_0x848c0f[_0xdc77('0x33')][_0xdc77('0x24')]);_0x8c34bb[_0xdc77('0x22')]=qs[_0xdc77('0x22')](_0x848c0f[_0xdc77('0x33')][_0xdc77('0x22')]);}_0x8c34bb[_0xdc77('0x37')]=qs[_0xdc77('0x38')](_0x848c0f[_0xdc77('0x33')][_0xdc77('0x38')]);_0x8c34bb[_0xdc77('0x39')]=qs[_0xdc77('0x3a')](_['pick'](_0x848c0f[_0xdc77('0x33')],_0x11d7e5['filters']),_0x40d7b8);if(_0x848c0f[_0xdc77('0x33')][_0xdc77('0x3b')]){_0x8c34bb[_0xdc77('0x39')]=_['merge'](_0x8c34bb[_0xdc77('0x39')],{'$or':_[_0xdc77('0x2e')](_0x40d7b8,function(_0x31a181){if(_0x31a181[_0xdc77('0x3c')]!==_0xdc77('0x3d')){var _0x27387a={};_0x27387a[_0x31a181[_0xdc77('0x2b')]]={'$like':'%'+_0x848c0f['query']['filter']+'%'};return _0x27387a;}})});}_0x8c34bb=_[_0xdc77('0x3e')]({},_0x8c34bb,_0x848c0f[_0xdc77('0x3f')]);var _0x38df1d={'where':_0x8c34bb[_0xdc77('0x39')]};return db[_0xdc77('0x40')][_0xdc77('0x25')](_0x38df1d)[_0xdc77('0x41')](function(_0x1a6db9){_0x18981b[_0xdc77('0x25')]=_0x1a6db9;if(_0x848c0f['query'][_0xdc77('0x42')]){_0x8c34bb['include']=[{'all':!![]}];}return db[_0xdc77('0x40')][_0xdc77('0x43')](_0x8c34bb);})[_0xdc77('0x41')](function(_0x2a6a2c){_0x18981b[_0xdc77('0x44')]=_0x2a6a2c;return _0x18981b;})['then'](respondWithFilteredResult(_0x2f26cd,_0x8c34bb))[_0xdc77('0x45')](handleError(_0x2f26cd,null));};exports[_0xdc77('0x46')]=function(_0x756d26,_0x79c6a1){var _0x352b9b={'raw':![],'where':{'id':_0x756d26[_0xdc77('0x47')]['id']}},_0x296469={};_0x296469[_0xdc77('0x31')]=_[_0xdc77('0x32')](db[_0xdc77('0x40')][_0xdc77('0x2f')]);_0x296469[_0xdc77('0x33')]=_[_0xdc77('0x32')](_0x756d26['query']);_0x296469[_0xdc77('0x3a')]=_[_0xdc77('0x34')](_0x296469[_0xdc77('0x31')],_0x296469[_0xdc77('0x33')]);_0x352b9b[_0xdc77('0x35')]=_[_0xdc77('0x34')](_0x296469['model'],qs['fields'](_0x756d26[_0xdc77('0x33')][_0xdc77('0x48')]));_0x352b9b[_0xdc77('0x35')]=_0x352b9b['attributes'][_0xdc77('0x49')]?_0x352b9b[_0xdc77('0x35')]:_0x296469[_0xdc77('0x31')];if(_0x756d26[_0xdc77('0x33')][_0xdc77('0x42')]){_0x352b9b[_0xdc77('0x4a')]=[{'all':!![]}];}_0x352b9b=_[_0xdc77('0x3e')]({},_0x352b9b,_0x756d26[_0xdc77('0x3f')]);return db[_0xdc77('0x40')]['find'](_0x352b9b)[_0xdc77('0x41')](handleEntityNotFound(_0x79c6a1,null))[_0xdc77('0x41')](respondWithResult(_0x79c6a1,null))['catch'](handleError(_0x79c6a1,null));};exports[_0xdc77('0x4b')]=function(_0x533b48,_0x436837){return db[_0xdc77('0x40')][_0xdc77('0x4b')](_0x533b48[_0xdc77('0x4c')],{})['then'](respondWithResult(_0x436837,0xc9))['catch'](handleError(_0x436837,null));};exports[_0xdc77('0x29')]=function(_0x1f2ee0,_0x542ccc){if(_0x1f2ee0[_0xdc77('0x4c')]['id']){delete _0x1f2ee0[_0xdc77('0x4c')]['id'];}return db[_0xdc77('0x40')]['find']({'where':{'id':_0x1f2ee0['params']['id']}})[_0xdc77('0x41')](handleEntityNotFound(_0x542ccc,null))[_0xdc77('0x41')](saveUpdates(_0x1f2ee0[_0xdc77('0x4c')],null))[_0xdc77('0x41')](respondWithResult(_0x542ccc,null))['catch'](handleError(_0x542ccc,null));};exports[_0xdc77('0x2a')]=function(_0x363021,_0x5f9ab1){return db['FreshsalesAccount'][_0xdc77('0x4d')]({'where':{'id':_0x363021[_0xdc77('0x47')]['id']}})[_0xdc77('0x41')](handleEntityNotFound(_0x5f9ab1,null))[_0xdc77('0x41')](removeEntity(_0x5f9ab1,null))[_0xdc77('0x45')](handleError(_0x5f9ab1,null));};exports[_0xdc77('0x4e')]=function(_0x2782ef,_0x219234,_0x5b62f9){var _0x49aabf={};var _0x53d23e={};var _0x42fac2;var _0x39a8f2;return db[_0xdc77('0x40')][_0xdc77('0x4f')]({'where':{'id':_0x2782ef['params']['id']}})[_0xdc77('0x41')](handleEntityNotFound(_0x219234,null))[_0xdc77('0x41')](function(_0x33c530){if(_0x33c530){_0x42fac2=_0x33c530;_0x53d23e[_0xdc77('0x31')]=_[_0xdc77('0x32')](db['FreshsalesConfiguration'][_0xdc77('0x2f')]);_0x53d23e[_0xdc77('0x33')]=_[_0xdc77('0x32')](_0x2782ef[_0xdc77('0x33')]);_0x53d23e[_0xdc77('0x3a')]=_[_0xdc77('0x34')](_0x53d23e['model'],_0x53d23e[_0xdc77('0x33')]);_0x49aabf[_0xdc77('0x35')]=_[_0xdc77('0x34')](_0x53d23e[_0xdc77('0x31')],qs[_0xdc77('0x48')](_0x2782ef['query'][_0xdc77('0x48')]));_0x49aabf[_0xdc77('0x35')]=_0x49aabf[_0xdc77('0x35')][_0xdc77('0x49')]?_0x49aabf[_0xdc77('0x35')]:_0x53d23e['model'];_0x49aabf[_0xdc77('0x37')]=qs[_0xdc77('0x38')](_0x2782ef['query'][_0xdc77('0x38')]);_0x49aabf[_0xdc77('0x39')]=qs['filters'](_[_0xdc77('0x50')](_0x2782ef[_0xdc77('0x33')],_0x53d23e[_0xdc77('0x3a')]));if(_0x2782ef['query'][_0xdc77('0x3b')]){_0x49aabf['where']=_['merge'](_0x49aabf['where'],{'$or':_['map'](_0x49aabf[_0xdc77('0x35')],function(_0x50005e){var _0x596d57={};_0x596d57[_0x50005e]={'$like':'%'+_0x2782ef[_0xdc77('0x33')]['filter']+'%'};return _0x596d57;})});}_0x49aabf=_[_0xdc77('0x3e')]({},_0x49aabf,_0x2782ef[_0xdc77('0x3f')]);return _0x42fac2['getConfigurations'](_0x49aabf);}})['then'](function(_0x1d19ed){if(_0x1d19ed){_0x39a8f2=_0x1d19ed[_0xdc77('0x49')];if(!_0x2782ef[_0xdc77('0x33')]['hasOwnProperty']('nolimit')){_0x49aabf[_0xdc77('0x24')]=qs[_0xdc77('0x24')](_0x2782ef[_0xdc77('0x33')]['limit']);_0x49aabf[_0xdc77('0x22')]=qs[_0xdc77('0x22')](_0x2782ef[_0xdc77('0x33')][_0xdc77('0x22')]);}return _0x42fac2['getConfigurations'](_0x49aabf);}})[_0xdc77('0x41')](function(_0x42697c){if(_0x42697c){return _0x42697c?{'count':_0x39a8f2,'rows':_0x42697c}:null;}})[_0xdc77('0x41')](respondWithResult(_0x219234,null))[_0xdc77('0x45')](handleError(_0x219234,null));};exports[_0xdc77('0x51')]=function(_0x3a04ac,_0x4e2152,_0x541eb4){if(_0x3a04ac[_0xdc77('0x4c')]['id']){delete _0x3a04ac[_0xdc77('0x4c')]['id'];}return db['FreshsalesAccount'][_0xdc77('0x4f')]({'where':{'id':_0x3a04ac[_0xdc77('0x47')]['id']}})[_0xdc77('0x41')](handleEntityNotFound(_0x4e2152,null))[_0xdc77('0x41')](function(_0x34929b){if(_0x34929b){_0x3a04ac['body'][_0xdc77('0x52')]=_0x34929b['id'];_0x3a04ac[_0xdc77('0x4c')][_0xdc77('0x53')]=integrations[_0xdc77('0x54')](_0x3a04ac[_0xdc77('0x4c')][_0xdc77('0x55')],_0x3a04ac['body'][_0xdc77('0x3c')]);_0x3a04ac[_0xdc77('0x4c')][_0xdc77('0x56')]=integrations['getDescriptions'](_0x3a04ac[_0xdc77('0x4c')][_0xdc77('0x55')],_0x3a04ac[_0xdc77('0x4c')][_0xdc77('0x3c')]);return db[_0xdc77('0x57')][_0xdc77('0x4b')](_0x3a04ac[_0xdc77('0x4c')],{'include':[{'model':db[_0xdc77('0x58')],'as':_0xdc77('0x53')},{'model':db[_0xdc77('0x58')],'as':_0xdc77('0x56')}]});}return null;})[_0xdc77('0x41')](respondWithResult(_0x4e2152,null))[_0xdc77('0x45')](handleError(_0x4e2152,null));};exports[_0xdc77('0x59')]=function(_0x4deabd,_0x5db18c,_0x2478a7){var _0x1a4324='';var _0x5979d5='';return db[_0xdc77('0x40')][_0xdc77('0x4f')]({'where':{'id':_0x4deabd[_0xdc77('0x47')]['id']},'attributes':['id',_0xdc77('0x5a'),_0xdc77('0x5b'),_0xdc77('0x5c')]})['then'](handleEntityNotFound(_0x5db18c,null))[_0xdc77('0x41')](function(_0x1ebb22){if(_0x1ebb22){_0x5979d5=_0x1ebb22[_0xdc77('0x5a')];_0x1a4324=_0x1ebb22['remoteUri'];var _0x410487=_0x1ebb22['remoteUri']['slice'](-0x1);if(_0x410487==='/'){_0x1a4324=_0x1a4324[_0xdc77('0x5d')](0x0,_0x1a4324[_0xdc77('0x5e')](_0x410487));}return rp({'method':_0xdc77('0x5f'),'uri':util['format'](_0xdc77('0x60'),_0x1a4324,_0xdc77('0x61')),'headers':{'Authorization':_0xdc77('0x62')+_0x1ebb22[_0xdc77('0x5c')]},'json':!![]});}})[_0xdc77('0x41')](function(_0x2a53cb){if(_0x2a53cb){var _0x431de9=_0x2a53cb[_0xdc77('0x63')];var _0x1761de=![];var _0x5ef545=null;for(_0x5ef545=0x0;_0x5ef545<_0x431de9[_0xdc77('0x49')];_0x5ef545++){if(_0x431de9[_0x5ef545][_0xdc77('0x64')]===_0x5979d5){_0x1761de=!![];}}if(_0x1761de){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xdc77('0x65')});}}})['then'](respondWithResult(_0x5db18c,null))[_0xdc77('0x45')](function(_0x430729){var _0x4803e2=_0x4deabd['query'][_0xdc77('0x66')]?0x1f4:_0x430729[_0xdc77('0x67')]||0x1f4;logger[_0xdc77('0x68')](_0xdc77('0x69'),_0xdc77('0x59'),_0x4803e2,JSON[_0xdc77('0x6a')](_0x430729));delete _0x430729[_0xdc77('0x2b')];if(_0x4803e2===0x191){_0x4803e2=0x190;}_0x5db18c['status'](_0x4803e2)[_0xdc77('0x2c')](_0x4deabd[_0xdc77('0x33')][_0xdc77('0x66')]?{'message':_0xdc77('0x6b'),'statusCode':_0x430729[_0xdc77('0x67')]}:_0x430729);});}; \ No newline at end of file +var _0x49e6=['apiKey','slice','substring','lastIndexOf','%s%s','Token\x20token=','users','email','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','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','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','FreshsalesAccount','includeAll','include','rows','catch','show','params','rawAttributes','create','update','body','find','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri'];(function(_0x550e65,_0x5af01e){var _0x49b344=function(_0x2d6952){while(--_0x2d6952){_0x550e65['push'](_0x550e65['shift']());}};_0x49b344(++_0x5af01e);}(_0x49e6,0x72));var _0x649e=function(_0x25ee79,_0x4274e5){_0x25ee79=_0x25ee79-0x0;var _0x5eb254=_0x49e6[_0x25ee79];return _0x5eb254;};'use strict';var emlformat=require(_0x649e('0x0'));var rimraf=require(_0x649e('0x1'));var zipdir=require(_0x649e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x649e('0x3'));var BPromise=require(_0x649e('0x4'));var Mustache=require(_0x649e('0x5'));var util=require(_0x649e('0x6'));var path=require('path');var sox=require(_0x649e('0x7'));var csv=require(_0x649e('0x8'));var ejs=require(_0x649e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x649e('0xa'));var squel=require(_0x649e('0xb'));var crypto=require(_0x649e('0xc'));var jsforce=require(_0x649e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x649e('0xe'));var Papa=require(_0x649e('0xf'));var Redis=require(_0x649e('0x10'));var authService=require(_0x649e('0x11'));var qs=require(_0x649e('0x12'));var as=require(_0x649e('0x13'));var hardwareService=require(_0x649e('0x14'));var logger=require(_0x649e('0x15'))('api');var utils=require(_0x649e('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x649e('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x355867,_0x2ae4a0){_0x2ae4a0=_0x2ae4a0||0xcc;return function(_0x291ab1){if(_0x291ab1){return _0x355867[_0x649e('0x18')](_0x2ae4a0);}return _0x355867[_0x649e('0x19')](_0x2ae4a0)[_0x649e('0x1a')]();};}function respondWithResult(_0x16b439,_0x4631ab){_0x4631ab=_0x4631ab||0xc8;return function(_0x288e62){if(_0x288e62){return _0x16b439[_0x649e('0x19')](_0x4631ab)[_0x649e('0x1b')](_0x288e62);}};}function respondWithFilteredResult(_0x1b1a84,_0x518c07){return function(_0x438c3f){if(_0x438c3f){var _0x40dc56=typeof _0x518c07[_0x649e('0x1c')]===_0x649e('0x1d')&&typeof _0x518c07['limit']===_0x649e('0x1d');var _0x18f1b2=_0x438c3f[_0x649e('0x1e')];var _0x41ac00=_0x40dc56?0x0:_0x518c07[_0x649e('0x1c')];var _0x263167=_0x40dc56?_0x438c3f[_0x649e('0x1e')]:_0x518c07['offset']+_0x518c07[_0x649e('0x1f')];var _0x4fc87a;if(_0x263167>=_0x18f1b2){_0x263167=_0x18f1b2;_0x4fc87a=0xc8;}else{_0x4fc87a=0xce;}_0x1b1a84[_0x649e('0x19')](_0x4fc87a);return _0x1b1a84[_0x649e('0x20')](_0x649e('0x21'),_0x41ac00+'-'+_0x263167+'/'+_0x18f1b2)[_0x649e('0x1b')](_0x438c3f);}return null;};}function patchUpdates(_0x27d909){return function(_0x2ffa75){try{jsonpatch[_0x649e('0x22')](_0x2ffa75,_0x27d909,!![]);}catch(_0x414d6d){return BPromise[_0x649e('0x23')](_0x414d6d);}return _0x2ffa75[_0x649e('0x24')]();};}function saveUpdates(_0x432582,_0x3c4392){return function(_0x5d76e6){if(_0x5d76e6){return _0x5d76e6['update'](_0x432582)[_0x649e('0x25')](function(_0x4ec40d){return _0x4ec40d;});}return null;};}function removeEntity(_0x22a984,_0x14f1ea){return function(_0x1bd600){if(_0x1bd600){return _0x1bd600[_0x649e('0x26')]()[_0x649e('0x25')](function(){_0x22a984[_0x649e('0x19')](0xcc)[_0x649e('0x1a')]();});}};}function handleEntityNotFound(_0x3933e0,_0x1a9db2){return function(_0x131296){if(!_0x131296){_0x3933e0[_0x649e('0x18')](0x194);}return _0x131296;};}function handleError(_0x2bfd7c,_0x549486){_0x549486=_0x549486||0x1f4;return function(_0x22d467){logger['error'](_0x22d467['stack']);if(_0x22d467[_0x649e('0x27')]){delete _0x22d467[_0x649e('0x27')];}_0x2bfd7c[_0x649e('0x19')](_0x549486)[_0x649e('0x28')](_0x22d467);};}exports[_0x649e('0x29')]=function(_0x333651,_0x2f3a24){var _0x3571e7={},_0x67e026={},_0x343da7={'count':0x0,'rows':[]};var _0x9abdaf=_[_0x649e('0x2a')](db['FreshsalesAccount']['rawAttributes'],function(_0x645c00){return{'name':_0x645c00[_0x649e('0x2b')],'type':_0x645c00['type'][_0x649e('0x2c')]};});_0x67e026['model']=_[_0x649e('0x2a')](_0x9abdaf,_0x649e('0x27'));_0x67e026[_0x649e('0x2d')]=_[_0x649e('0x2e')](_0x333651[_0x649e('0x2d')]);_0x67e026[_0x649e('0x2f')]=_[_0x649e('0x30')](_0x67e026[_0x649e('0x31')],_0x67e026[_0x649e('0x2d')]);_0x3571e7[_0x649e('0x32')]=_['intersection'](_0x67e026[_0x649e('0x31')],qs['fields'](_0x333651[_0x649e('0x2d')][_0x649e('0x33')]));_0x3571e7['attributes']=_0x3571e7[_0x649e('0x32')][_0x649e('0x34')]?_0x3571e7['attributes']:_0x67e026['model'];if(!_0x333651[_0x649e('0x2d')][_0x649e('0x35')](_0x649e('0x36'))){_0x3571e7[_0x649e('0x1f')]=qs['limit'](_0x333651[_0x649e('0x2d')][_0x649e('0x1f')]);_0x3571e7[_0x649e('0x1c')]=qs[_0x649e('0x1c')](_0x333651[_0x649e('0x2d')]['offset']);}_0x3571e7[_0x649e('0x37')]=qs[_0x649e('0x38')](_0x333651['query']['sort']);_0x3571e7['where']=qs[_0x649e('0x2f')](_[_0x649e('0x39')](_0x333651['query'],_0x67e026[_0x649e('0x2f')]),_0x9abdaf);if(_0x333651[_0x649e('0x2d')][_0x649e('0x3a')]){_0x3571e7[_0x649e('0x3b')]=_[_0x649e('0x3c')](_0x3571e7[_0x649e('0x3b')],{'$or':_['map'](_0x9abdaf,function(_0x46cc59){if(_0x46cc59[_0x649e('0x3d')]!==_0x649e('0x3e')){var _0x36c391={};_0x36c391[_0x46cc59['name']]={'$like':'%'+_0x333651[_0x649e('0x2d')]['filter']+'%'};return _0x36c391;}})});}_0x3571e7=_[_0x649e('0x3c')]({},_0x3571e7,_0x333651[_0x649e('0x3f')]);var _0x403316={'where':_0x3571e7[_0x649e('0x3b')]};return db[_0x649e('0x40')][_0x649e('0x1e')](_0x403316)[_0x649e('0x25')](function(_0x59e92d){_0x343da7['count']=_0x59e92d;if(_0x333651[_0x649e('0x2d')][_0x649e('0x41')]){_0x3571e7[_0x649e('0x42')]=[{'all':!![]}];}return db[_0x649e('0x40')]['findAll'](_0x3571e7);})['then'](function(_0x1234ae){_0x343da7[_0x649e('0x43')]=_0x1234ae;return _0x343da7;})[_0x649e('0x25')](respondWithFilteredResult(_0x2f3a24,_0x3571e7))[_0x649e('0x44')](handleError(_0x2f3a24,null));};exports[_0x649e('0x45')]=function(_0x25d6e0,_0x520e8c){var _0x4b0117={'raw':![],'where':{'id':_0x25d6e0[_0x649e('0x46')]['id']}},_0x39ec2d={};_0x39ec2d[_0x649e('0x31')]=_[_0x649e('0x2e')](db[_0x649e('0x40')][_0x649e('0x47')]);_0x39ec2d[_0x649e('0x2d')]=_['keys'](_0x25d6e0[_0x649e('0x2d')]);_0x39ec2d[_0x649e('0x2f')]=_[_0x649e('0x30')](_0x39ec2d['model'],_0x39ec2d['query']);_0x4b0117[_0x649e('0x32')]=_[_0x649e('0x30')](_0x39ec2d[_0x649e('0x31')],qs['fields'](_0x25d6e0[_0x649e('0x2d')][_0x649e('0x33')]));_0x4b0117['attributes']=_0x4b0117['attributes'][_0x649e('0x34')]?_0x4b0117[_0x649e('0x32')]:_0x39ec2d[_0x649e('0x31')];if(_0x25d6e0[_0x649e('0x2d')]['includeAll']){_0x4b0117[_0x649e('0x42')]=[{'all':!![]}];}_0x4b0117=_[_0x649e('0x3c')]({},_0x4b0117,_0x25d6e0[_0x649e('0x3f')]);return db[_0x649e('0x40')]['find'](_0x4b0117)[_0x649e('0x25')](handleEntityNotFound(_0x520e8c,null))[_0x649e('0x25')](respondWithResult(_0x520e8c,null))['catch'](handleError(_0x520e8c,null));};exports[_0x649e('0x48')]=function(_0x536130,_0x1c11a7){return db[_0x649e('0x40')][_0x649e('0x48')](_0x536130['body'],{})[_0x649e('0x25')](respondWithResult(_0x1c11a7,0xc9))['catch'](handleError(_0x1c11a7,null));};exports[_0x649e('0x49')]=function(_0x254f00,_0x5a7bf3){if(_0x254f00[_0x649e('0x4a')]['id']){delete _0x254f00[_0x649e('0x4a')]['id'];}return db[_0x649e('0x40')]['find']({'where':{'id':_0x254f00[_0x649e('0x46')]['id']}})[_0x649e('0x25')](handleEntityNotFound(_0x5a7bf3,null))['then'](saveUpdates(_0x254f00[_0x649e('0x4a')],null))['then'](respondWithResult(_0x5a7bf3,null))[_0x649e('0x44')](handleError(_0x5a7bf3,null));};exports[_0x649e('0x26')]=function(_0x19cd07,_0x4ac01c){return db[_0x649e('0x40')][_0x649e('0x4b')]({'where':{'id':_0x19cd07[_0x649e('0x46')]['id']}})[_0x649e('0x25')](handleEntityNotFound(_0x4ac01c,null))[_0x649e('0x25')](removeEntity(_0x4ac01c,null))[_0x649e('0x44')](handleError(_0x4ac01c,null));};exports[_0x649e('0x4c')]=function(_0x10c461,_0x5595bd,_0x5500b8){var _0x34be1d={};var _0x4e2e20={};var _0x13154c;var _0x23f37d;return db[_0x649e('0x40')][_0x649e('0x4d')]({'where':{'id':_0x10c461[_0x649e('0x46')]['id']}})[_0x649e('0x25')](handleEntityNotFound(_0x5595bd,null))[_0x649e('0x25')](function(_0x1f17e2){if(_0x1f17e2){_0x13154c=_0x1f17e2;_0x4e2e20[_0x649e('0x31')]=_['keys'](db['FreshsalesConfiguration'][_0x649e('0x47')]);_0x4e2e20['query']=_[_0x649e('0x2e')](_0x10c461['query']);_0x4e2e20['filters']=_[_0x649e('0x30')](_0x4e2e20[_0x649e('0x31')],_0x4e2e20['query']);_0x34be1d[_0x649e('0x32')]=_[_0x649e('0x30')](_0x4e2e20[_0x649e('0x31')],qs[_0x649e('0x33')](_0x10c461[_0x649e('0x2d')][_0x649e('0x33')]));_0x34be1d[_0x649e('0x32')]=_0x34be1d['attributes'][_0x649e('0x34')]?_0x34be1d[_0x649e('0x32')]:_0x4e2e20['model'];_0x34be1d[_0x649e('0x37')]=qs[_0x649e('0x38')](_0x10c461[_0x649e('0x2d')][_0x649e('0x38')]);_0x34be1d[_0x649e('0x3b')]=qs[_0x649e('0x2f')](_[_0x649e('0x39')](_0x10c461[_0x649e('0x2d')],_0x4e2e20[_0x649e('0x2f')]));if(_0x10c461[_0x649e('0x2d')]['filter']){_0x34be1d['where']=_['merge'](_0x34be1d[_0x649e('0x3b')],{'$or':_[_0x649e('0x2a')](_0x34be1d[_0x649e('0x32')],function(_0x19d780){var _0x47e861={};_0x47e861[_0x19d780]={'$like':'%'+_0x10c461[_0x649e('0x2d')][_0x649e('0x3a')]+'%'};return _0x47e861;})});}_0x34be1d=_[_0x649e('0x3c')]({},_0x34be1d,_0x10c461[_0x649e('0x3f')]);return _0x13154c['getConfigurations'](_0x34be1d);}})[_0x649e('0x25')](function(_0x56a54d){if(_0x56a54d){_0x23f37d=_0x56a54d[_0x649e('0x34')];if(!_0x10c461['query'][_0x649e('0x35')]('nolimit')){_0x34be1d[_0x649e('0x1f')]=qs[_0x649e('0x1f')](_0x10c461[_0x649e('0x2d')][_0x649e('0x1f')]);_0x34be1d[_0x649e('0x1c')]=qs['offset'](_0x10c461['query'][_0x649e('0x1c')]);}return _0x13154c[_0x649e('0x4c')](_0x34be1d);}})[_0x649e('0x25')](function(_0x3f9a51){if(_0x3f9a51){return _0x3f9a51?{'count':_0x23f37d,'rows':_0x3f9a51}:null;}})[_0x649e('0x25')](respondWithResult(_0x5595bd,null))[_0x649e('0x44')](handleError(_0x5595bd,null));};exports['addConfiguration']=function(_0x14e532,_0x40d245,_0x2a7902){if(_0x14e532['body']['id']){delete _0x14e532[_0x649e('0x4a')]['id'];}return db['FreshsalesAccount'][_0x649e('0x4d')]({'where':{'id':_0x14e532['params']['id']}})[_0x649e('0x25')](handleEntityNotFound(_0x40d245,null))[_0x649e('0x25')](function(_0x51204a){if(_0x51204a){_0x14e532['body'][_0x649e('0x4e')]=_0x51204a['id'];_0x14e532['body'][_0x649e('0x4f')]=integrations[_0x649e('0x50')](_0x14e532[_0x649e('0x4a')][_0x649e('0x51')],_0x14e532['body']['type']);_0x14e532[_0x649e('0x4a')]['Descriptions']=integrations[_0x649e('0x52')](_0x14e532[_0x649e('0x4a')][_0x649e('0x51')],_0x14e532[_0x649e('0x4a')][_0x649e('0x3d')]);return db['FreshsalesConfiguration'][_0x649e('0x48')](_0x14e532[_0x649e('0x4a')],{'include':[{'model':db[_0x649e('0x53')],'as':_0x649e('0x4f')},{'model':db[_0x649e('0x53')],'as':_0x649e('0x54')}]});}return null;})[_0x649e('0x25')](respondWithResult(_0x40d245,null))[_0x649e('0x44')](handleError(_0x40d245,null));};exports[_0x649e('0x55')]=function(_0x928882,_0x4e9304,_0x30d12c){var _0x22ac15='';var _0x26be61='';return db[_0x649e('0x40')]['findOne']({'where':{'id':_0x928882[_0x649e('0x46')]['id']},'attributes':['id',_0x649e('0x56'),_0x649e('0x57'),_0x649e('0x58')]})['then'](handleEntityNotFound(_0x4e9304,null))[_0x649e('0x25')](function(_0x5abcc9){if(_0x5abcc9){_0x26be61=_0x5abcc9['username'];_0x22ac15=_0x5abcc9[_0x649e('0x57')];var _0x5a4fe7=_0x5abcc9['remoteUri'][_0x649e('0x59')](-0x1);if(_0x5a4fe7==='/'){_0x22ac15=_0x22ac15[_0x649e('0x5a')](0x0,_0x22ac15[_0x649e('0x5b')](_0x5a4fe7));}return rp({'method':'GET','uri':util['format'](_0x649e('0x5c'),_0x22ac15,'/api/selector/owners'),'headers':{'Authorization':_0x649e('0x5d')+_0x5abcc9[_0x649e('0x58')]},'json':!![]});}})[_0x649e('0x25')](function(_0x1e434c){if(_0x1e434c){var _0x59fa6b=_0x1e434c[_0x649e('0x5e')];var _0x392fa9=![];var _0x1ca8d8=null;for(_0x1ca8d8=0x0;_0x1ca8d8<_0x59fa6b[_0x649e('0x34')];_0x1ca8d8++){if(_0x59fa6b[_0x1ca8d8][_0x649e('0x5f')]===_0x26be61){_0x392fa9=!![];}}if(_0x392fa9){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x649e('0x25')](respondWithResult(_0x4e9304,null))['catch'](function(_0x5ac9ad){var _0x12f319=_0x928882[_0x649e('0x2d')][_0x649e('0x60')]?0x1f4:_0x5ac9ad[_0x649e('0x61')]||0x1f4;logger[_0x649e('0x62')](_0x649e('0x63'),_0x649e('0x55'),_0x12f319,JSON[_0x649e('0x64')](_0x5ac9ad));delete _0x5ac9ad[_0x649e('0x27')];if(_0x12f319===0x191){_0x12f319=0x190;}_0x4e9304[_0x649e('0x19')](_0x12f319)[_0x649e('0x28')](_0x928882['query'][_0x649e('0x60')]?{'message':'Wrong\x20credentials','statusCode':_0x5ac9ad[_0x649e('0x61')]}:_0x5ac9ad);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 22e2904..acf0bcb 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 _0x0295=['exports','lodash','api','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x0295,0x1f0));var _0x5029=function(_0x2e2d89,_0x4bb615){_0x2e2d89=_0x2e2d89-0x0;var _0x3aba90=_0x0295[_0x2e2d89];return _0x3aba90;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));var integrations=require(_0x5029('0x7'));module[_0x5029('0x8')]=function(_0x215955,_0x5b3cd){return _0x215955['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./intFreshsalesAccount.attributes','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x53ec,0x192));var _0xc53e=function(_0x5a1cf3,_0x161eca){_0x5a1cf3=_0x5a1cf3-0x0;var _0x24d3cc=_0x53ec[_0x5a1cf3];return _0x24d3cc;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc53e('0x9')]=function(_0x4f989b,_0x41a9e8){return _0x4f989b[_0xc53e('0xa')]('FreshsalesAccount',attributes,{'tableName':_0xc53e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 5b206e1..973361f 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 _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(_0x4e2cae,_0x28b0f7){var _0x23b147=function(_0x5db252){while(--_0x5db252){_0x4e2cae['push'](_0x4e2cae['shift']());}};_0x23b147(++_0x28b0f7);}(_0xd117,0x182));var _0x7d11=function(_0x11d684,_0x4d4123){_0x11d684=_0x11d684-0x0;var _0x78a301=_0xd117[_0x11d684];return _0x78a301;};'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 +var _0xbff5=['attributes','limit','include','map','model','GetFreshsalesAccount','FreshsalesAccount','find','raw','ShowFreshsalesAccount','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','findAll','options','where'];(function(_0x3c7b62,_0x2283b9){var _0x58fc42=function(_0x18b7cc){while(--_0x18b7cc){_0x3c7b62['push'](_0x3c7b62['shift']());}};_0x58fc42(++_0x2283b9);}(_0xbff5,0x1bc));var _0x5bff=function(_0x1d1e91,_0x506415){_0x1d1e91=_0x1d1e91-0x0;var _0x337d48=_0xbff5[_0x1d1e91];return _0x337d48;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});}exports['GetFreshsalesAccount']=function(_0xc9fbc3){var _0x279c22=this;return new Promise(function(_0x36653b,_0x32cf60){return db['FreshsalesAccount'][_0x5bff('0x15')]({'raw':_0xc9fbc3['options']?_0xc9fbc3[_0x5bff('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x17')]||null:null,'attributes':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'limit':_0xc9fbc3[_0x5bff('0x16')]?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x19')]||null:null,'include':_0xc9fbc3['options']?_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0xc9fbc3[_0x5bff('0x16')][_0x5bff('0x1a')],function(_0x31d26b){return{'model':db[_0x31d26b[_0x5bff('0x1c')]],'as':_0x31d26b['as'],'attributes':_0x31d26b[_0x5bff('0x18')],'include':_0x31d26b['include']?_['map'](_0x31d26b[_0x5bff('0x1a')],function(_0x53bd97){return{'model':db[_0x53bd97[_0x5bff('0x1c')]],'as':_0x53bd97['as'],'attributes':_0x53bd97[_0x5bff('0x18')],'include':_0x53bd97[_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x53bd97[_0x5bff('0x1a')],function(_0x1140eb){return{'model':db[_0x1140eb[_0x5bff('0x1c')]],'as':_0x1140eb['as'],'attributes':_0x1140eb[_0x5bff('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4df57a){logger[_0x5bff('0x13')](_0x5bff('0x1d'),_0xc9fbc3);logger['debug'](_0x5bff('0x1d'),_0xc9fbc3,JSON['stringify'](_0x4df57a));_0x36653b(_0x4df57a);})['catch'](function(_0x3eda3a){logger['error'](_0x5bff('0x1d'),_0x3eda3a[_0x5bff('0x12')],_0xc9fbc3);_0x32cf60(_0x279c22[_0x5bff('0x10')](0x1f4,_0x3eda3a[_0x5bff('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x71783){var _0x4ee6f1=this;return new Promise(function(_0x3c1405,_0x5a7873){return db[_0x5bff('0x1e')][_0x5bff('0x1f')]({'raw':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x20')]===undefined?!![]:![]:!![],'where':_0x71783[_0x5bff('0x16')]?_0x71783['options'][_0x5bff('0x17')]||null:null,'attributes':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x18')]||null:null,'include':_0x71783[_0x5bff('0x16')]?_0x71783[_0x5bff('0x16')][_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x71783['options'][_0x5bff('0x1a')],function(_0x16042d){return{'model':db[_0x16042d[_0x5bff('0x1c')]],'as':_0x16042d['as'],'attributes':_0x16042d[_0x5bff('0x18')],'include':_0x16042d['include']?_[_0x5bff('0x1b')](_0x16042d[_0x5bff('0x1a')],function(_0x5a24be){return{'model':db[_0x5a24be[_0x5bff('0x1c')]],'as':_0x5a24be['as'],'attributes':_0x5a24be[_0x5bff('0x18')],'include':_0x5a24be[_0x5bff('0x1a')]?_[_0x5bff('0x1b')](_0x5a24be['include'],function(_0x38245d){return{'model':db[_0x38245d[_0x5bff('0x1c')]],'as':_0x38245d['as'],'attributes':_0x38245d[_0x5bff('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1065d1){logger['info'](_0x5bff('0x21'),_0x71783);logger[_0x5bff('0x22')](_0x5bff('0x21'),_0x71783,JSON['stringify'](_0x1065d1));_0x3c1405(_0x1065d1);})[_0x5bff('0x23')](function(_0x1ec079){logger[_0x5bff('0x10')]('ShowFreshsalesAccount',_0x1ec079[_0x5bff('0x12')],_0x71783);_0x5a7873(_0x4ee6f1[_0x5bff('0x10')](0x1f4,_0x1ec079['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index ecfd6d1..9e7f66c 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 _0xdc65=['/:id','show','isAuthenticated','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xdc65,0x97));var _0x5dc6=function(_0x980380,_0x454e83){_0x980380=_0x980380-0x0;var _0x5f023b=_0xdc65[_0x980380];return _0x5f023b;};'use strict';var multer=require(_0x5dc6('0x0'));var util=require(_0x5dc6('0x1'));var path=require('path');var timeout=require(_0x5dc6('0x2'));var express=require(_0x5dc6('0x3'));var router=express[_0x5dc6('0x4')]();var fs_extra=require(_0x5dc6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5dc6('0x6'));var config=require(_0x5dc6('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x5dc6('0x8')]('/',auth['isAuthenticated'](),controller[_0x5dc6('0x9')]);router[_0x5dc6('0x8')](_0x5dc6('0xa'),auth['isAuthenticated'](),controller[_0x5dc6('0xb')]);router['get']('/:id/subjects',auth[_0x5dc6('0xc')](),controller['getSubjects']);router[_0x5dc6('0x8')](_0x5dc6('0xd'),auth['isAuthenticated'](),controller[_0x5dc6('0xe')]);router[_0x5dc6('0x8')](_0x5dc6('0xf'),auth[_0x5dc6('0xc')](),controller[_0x5dc6('0x10')]);router[_0x5dc6('0x11')]('/',auth[_0x5dc6('0xc')](),controller[_0x5dc6('0x12')]);router[_0x5dc6('0x13')](_0x5dc6('0xa'),auth[_0x5dc6('0xc')](),controller[_0x5dc6('0x14')]);router[_0x5dc6('0x15')](_0x5dc6('0xa'),auth[_0x5dc6('0xc')](),controller[_0x5dc6('0x16')]);module['exports']=router; \ No newline at end of file +var _0xe48b=['create','put','update','delete','destroy','multer','util','path','express','Router','../../config/environment','./intFreshsalesConfiguration.controller','index','get','/:id','isAuthenticated','show','getSubjects','getDescriptions','/:id/fields','getFields','post'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xe48b,0x191));var _0xbe48=function(_0x5672d2,_0x346807){_0x5672d2=_0x5672d2-0x0;var _0x23bb3d=_0xe48b[_0x5672d2];return _0x23bb3d;};'use strict';var multer=require(_0xbe48('0x0'));var util=require(_0xbe48('0x1'));var path=require(_0xbe48('0x2'));var timeout=require('connect-timeout');var express=require(_0xbe48('0x3'));var router=express[_0xbe48('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbe48('0x5'));var controller=require(_0xbe48('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xbe48('0x7')]);router[_0xbe48('0x8')](_0xbe48('0x9'),auth[_0xbe48('0xa')](),controller[_0xbe48('0xb')]);router[_0xbe48('0x8')]('/:id/subjects',auth[_0xbe48('0xa')](),controller[_0xbe48('0xc')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xbe48('0xd')]);router[_0xbe48('0x8')](_0xbe48('0xe'),auth[_0xbe48('0xa')](),controller[_0xbe48('0xf')]);router[_0xbe48('0x10')]('/',auth[_0xbe48('0xa')](),controller[_0xbe48('0x11')]);router[_0xbe48('0x12')](_0xbe48('0x9'),auth[_0xbe48('0xa')](),controller[_0xbe48('0x13')]);router[_0xbe48('0x14')](_0xbe48('0x9'),auth[_0xbe48('0xa')](),controller[_0xbe48('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 848269c..4b9d581 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 _0x3414=['STRING'];(function(_0x187276,_0x4ae48c){var _0x2d98ca=function(_0x4be42f){while(--_0x4be42f){_0x187276['push'](_0x187276['shift']());}};_0x2d98ca(++_0x4ae48c);}(_0x3414,0x15f));var _0x4341=function(_0x26c762,_0x32a1b9){_0x26c762=_0x26c762-0x0;var _0x12c9da=_0x3414[_0x26c762];return _0x12c9da;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4341('0x0')]},'description':{'type':Sequelize[_0x4341('0x0')]}}; \ No newline at end of file +var _0x46e5=['sequelize','STRING'];(function(_0x2d9444,_0x2dfc58){var _0x3cf55f=function(_0x30f40d){while(--_0x30f40d){_0x2d9444['push'](_0x2d9444['shift']());}};_0x3cf55f(++_0x2dfc58);}(_0x46e5,0x1ac));var _0x546e=function(_0x404c6c,_0x475fda){_0x404c6c=_0x404c6c-0x0;var _0x2be4c2=_0x46e5[_0x404c6c];return _0x2be4c2;};'use strict';var Sequelize=require(_0x546e('0x0'));module['exports']={'name':{'type':Sequelize[_0x546e('0x1')]},'description':{'type':Sequelize[_0x546e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 614c9b4..6f6736d 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 _0xb3ef=['path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','reject','update','then','destroy','end','error','stack','name','send','map','FreshsalesConfiguration','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x23cc76,_0x9c756b){var _0x2f5c13=function(_0x57c44b){while(--_0x57c44b){_0x23cc76['push'](_0x23cc76['shift']());}};_0x2f5c13(++_0x9c756b);}(_0xb3ef,0x131));var _0xfb3e=function(_0xcaad14,_0x2e3219){_0xcaad14=_0xcaad14-0x0;var _0x24f7d4=_0xb3ef[_0xcaad14];return _0x24f7d4;};'use strict';var emlformat=require(_0xfb3e('0x0'));var rimraf=require(_0xfb3e('0x1'));var zipdir=require(_0xfb3e('0x2'));var jsonpatch=require(_0xfb3e('0x3'));var rp=require(_0xfb3e('0x4'));var moment=require('moment');var BPromise=require(_0xfb3e('0x5'));var Mustache=require('mustache');var util=require(_0xfb3e('0x6'));var path=require(_0xfb3e('0x7'));var sox=require(_0xfb3e('0x8'));var csv=require(_0xfb3e('0x9'));var ejs=require(_0xfb3e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfb3e('0xb'));var crypto=require(_0xfb3e('0xc'));var jsforce=require(_0xfb3e('0xd'));var deskjs=require(_0xfb3e('0xe'));var toCsv=require(_0xfb3e('0x9'));var querystring=require(_0xfb3e('0xf'));var Papa=require(_0xfb3e('0x10'));var Redis=require('ioredis');var authService=require(_0xfb3e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfb3e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb3e('0x13'))(_0xfb3e('0x14'));var utils=require(_0xfb3e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfb3e('0x16'));var db=require(_0xfb3e('0x17'))['db'];function respondWithStatusCode(_0x2d3d2c,_0x531c28){_0x531c28=_0x531c28||0xcc;return function(_0x13ec9b){if(_0x13ec9b){return _0x2d3d2c[_0xfb3e('0x18')](_0x531c28);}return _0x2d3d2c[_0xfb3e('0x19')](_0x531c28)['end']();};}function respondWithResult(_0x1d7fc0,_0x523716){_0x523716=_0x523716||0xc8;return function(_0x24f6af){if(_0x24f6af){return _0x1d7fc0['status'](_0x523716)['json'](_0x24f6af);}};}function respondWithFilteredResult(_0x2b0f74,_0x369462){return function(_0x176d80){if(_0x176d80){var _0xbc6185=typeof _0x369462[_0xfb3e('0x1a')]===_0xfb3e('0x1b')&&typeof _0x369462[_0xfb3e('0x1c')]===_0xfb3e('0x1b');var _0x31fe7b=_0x176d80[_0xfb3e('0x1d')];var _0x4fbfc5=_0xbc6185?0x0:_0x369462[_0xfb3e('0x1a')];var _0x5bd05a=_0xbc6185?_0x176d80[_0xfb3e('0x1d')]:_0x369462['offset']+_0x369462[_0xfb3e('0x1c')];var _0x5a435a;if(_0x5bd05a>=_0x31fe7b){_0x5bd05a=_0x31fe7b;_0x5a435a=0xc8;}else{_0x5a435a=0xce;}_0x2b0f74['status'](_0x5a435a);return _0x2b0f74[_0xfb3e('0x1e')]('Content-Range',_0x4fbfc5+'-'+_0x5bd05a+'/'+_0x31fe7b)['json'](_0x176d80);}return null;};}function patchUpdates(_0x112a56){return function(_0x1e261c){try{jsonpatch[_0xfb3e('0x1f')](_0x1e261c,_0x112a56,!![]);}catch(_0x2ca510){return BPromise[_0xfb3e('0x20')](_0x2ca510);}return _0x1e261c['save']();};}function saveUpdates(_0x16a376,_0x37ff1e){return function(_0x46fbed){if(_0x46fbed){return _0x46fbed[_0xfb3e('0x21')](_0x16a376)[_0xfb3e('0x22')](function(_0x1a7248){return _0x1a7248;});}return null;};}function removeEntity(_0x79ca8a,_0x7affea){return function(_0x2370e4){if(_0x2370e4){return _0x2370e4[_0xfb3e('0x23')]()[_0xfb3e('0x22')](function(){_0x79ca8a['status'](0xcc)[_0xfb3e('0x24')]();});}};}function handleEntityNotFound(_0x35f39e,_0x3c9746){return function(_0x24ed70){if(!_0x24ed70){_0x35f39e[_0xfb3e('0x18')](0x194);}return _0x24ed70;};}function handleError(_0x1178b0,_0x25932a){_0x25932a=_0x25932a||0x1f4;return function(_0x5b77e9){logger[_0xfb3e('0x25')](_0x5b77e9[_0xfb3e('0x26')]);if(_0x5b77e9[_0xfb3e('0x27')]){delete _0x5b77e9[_0xfb3e('0x27')];}_0x1178b0[_0xfb3e('0x19')](_0x25932a)[_0xfb3e('0x28')](_0x5b77e9);};}exports['index']=function(_0xc2377,_0x2afb81){var _0x29e3d7={},_0x5b7d9={},_0x2b0d33={'count':0x0,'rows':[]};var _0x291cef=_[_0xfb3e('0x29')](db[_0xfb3e('0x2a')][_0xfb3e('0x2b')],function(_0x4b8e7c){return{'name':_0x4b8e7c['fieldName'],'type':_0x4b8e7c[_0xfb3e('0x2c')][_0xfb3e('0x2d')]};});_0x5b7d9['model']=_[_0xfb3e('0x29')](_0x291cef,_0xfb3e('0x27'));_0x5b7d9['query']=_[_0xfb3e('0x2e')](_0xc2377[_0xfb3e('0x2f')]);_0x5b7d9[_0xfb3e('0x30')]=_[_0xfb3e('0x31')](_0x5b7d9[_0xfb3e('0x32')],_0x5b7d9[_0xfb3e('0x2f')]);_0x29e3d7['attributes']=_['intersection'](_0x5b7d9[_0xfb3e('0x32')],qs['fields'](_0xc2377[_0xfb3e('0x2f')][_0xfb3e('0x33')]));_0x29e3d7['attributes']=_0x29e3d7[_0xfb3e('0x34')][_0xfb3e('0x35')]?_0x29e3d7[_0xfb3e('0x34')]:_0x5b7d9[_0xfb3e('0x32')];if(!_0xc2377['query'][_0xfb3e('0x36')](_0xfb3e('0x37'))){_0x29e3d7[_0xfb3e('0x1c')]=qs[_0xfb3e('0x1c')](_0xc2377[_0xfb3e('0x2f')][_0xfb3e('0x1c')]);_0x29e3d7[_0xfb3e('0x1a')]=qs[_0xfb3e('0x1a')](_0xc2377[_0xfb3e('0x2f')][_0xfb3e('0x1a')]);}_0x29e3d7[_0xfb3e('0x38')]=qs['sort'](_0xc2377[_0xfb3e('0x2f')][_0xfb3e('0x39')]);_0x29e3d7['where']=qs[_0xfb3e('0x30')](_['pick'](_0xc2377[_0xfb3e('0x2f')],_0x5b7d9['filters']),_0x291cef);if(_0xc2377[_0xfb3e('0x2f')][_0xfb3e('0x3a')]){_0x29e3d7[_0xfb3e('0x3b')]=_[_0xfb3e('0x3c')](_0x29e3d7[_0xfb3e('0x3b')],{'$or':_[_0xfb3e('0x29')](_0x291cef,function(_0x5ea4ef){if(_0x5ea4ef['type']!==_0xfb3e('0x3d')){var _0x8b70ff={};_0x8b70ff[_0x5ea4ef['name']]={'$like':'%'+_0xc2377[_0xfb3e('0x2f')][_0xfb3e('0x3a')]+'%'};return _0x8b70ff;}})});}_0x29e3d7=_[_0xfb3e('0x3c')]({},_0x29e3d7,_0xc2377[_0xfb3e('0x3e')]);var _0x4a49c4={'where':_0x29e3d7[_0xfb3e('0x3b')]};return db[_0xfb3e('0x2a')]['count'](_0x4a49c4)[_0xfb3e('0x22')](function(_0x223104){_0x2b0d33[_0xfb3e('0x1d')]=_0x223104;if(_0xc2377[_0xfb3e('0x2f')][_0xfb3e('0x3f')]){_0x29e3d7[_0xfb3e('0x40')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x29e3d7);})[_0xfb3e('0x22')](function(_0x629726){_0x2b0d33[_0xfb3e('0x41')]=_0x629726;return _0x2b0d33;})['then'](respondWithFilteredResult(_0x2afb81,_0x29e3d7))[_0xfb3e('0x42')](handleError(_0x2afb81,null));};exports[_0xfb3e('0x43')]=function(_0x116958,_0xb70082){var _0xfddd99={'raw':![],'where':{'id':_0x116958['params']['id']}},_0x52a3d0={};_0x52a3d0['model']=_[_0xfb3e('0x2e')](db[_0xfb3e('0x2a')][_0xfb3e('0x2b')]);_0x52a3d0[_0xfb3e('0x2f')]=_[_0xfb3e('0x2e')](_0x116958[_0xfb3e('0x2f')]);_0x52a3d0['filters']=_[_0xfb3e('0x31')](_0x52a3d0['model'],_0x52a3d0['query']);_0xfddd99[_0xfb3e('0x34')]=_[_0xfb3e('0x31')](_0x52a3d0[_0xfb3e('0x32')],qs[_0xfb3e('0x33')](_0x116958[_0xfb3e('0x2f')][_0xfb3e('0x33')]));_0xfddd99[_0xfb3e('0x34')]=_0xfddd99['attributes'][_0xfb3e('0x35')]?_0xfddd99[_0xfb3e('0x34')]:_0x52a3d0[_0xfb3e('0x32')];if(_0x116958[_0xfb3e('0x2f')]['includeAll']){_0xfddd99['include']=[{'all':!![]}];}_0xfddd99=_['merge']({},_0xfddd99,_0x116958['options']);return db[_0xfb3e('0x2a')][_0xfb3e('0x44')](_0xfddd99)['then'](handleEntityNotFound(_0xb70082,null))[_0xfb3e('0x22')](respondWithResult(_0xb70082,null))[_0xfb3e('0x42')](handleError(_0xb70082,null));};exports[_0xfb3e('0x45')]=function(_0x275d02,_0xb31e28){return db[_0xfb3e('0x2a')]['create'](_0x275d02[_0xfb3e('0x46')],{})[_0xfb3e('0x22')](respondWithResult(_0xb31e28,0xc9))['catch'](handleError(_0xb31e28,null));};exports[_0xfb3e('0x21')]=function(_0x3d2c5c,_0x3b6943){if(_0x3d2c5c[_0xfb3e('0x46')]['id']){delete _0x3d2c5c['body']['id'];}return db['FreshsalesConfiguration'][_0xfb3e('0x44')]({'where':{'id':_0x3d2c5c[_0xfb3e('0x47')]['id']}})[_0xfb3e('0x22')](handleEntityNotFound(_0x3b6943,null))['then'](saveUpdates(_0x3d2c5c[_0xfb3e('0x46')],null))[_0xfb3e('0x22')](respondWithResult(_0x3b6943,null))[_0xfb3e('0x42')](handleError(_0x3b6943,null));};exports[_0xfb3e('0x23')]=function(_0x1be333,_0xa288cf){return db[_0xfb3e('0x2a')][_0xfb3e('0x44')]({'where':{'id':_0x1be333[_0xfb3e('0x47')]['id']}})[_0xfb3e('0x22')](handleEntityNotFound(_0xa288cf,null))[_0xfb3e('0x22')](removeEntity(_0xa288cf,null))[_0xfb3e('0x42')](handleError(_0xa288cf,null));};exports[_0xfb3e('0x48')]=function(_0x5e02ac,_0x35d33c,_0x289b76){var _0x4197e3={};var _0x229be8={};var _0x5676da;var _0x315ed9;return db['FreshsalesConfiguration'][_0xfb3e('0x49')]({'where':{'id':_0x5e02ac[_0xfb3e('0x47')]['id']}})['then'](handleEntityNotFound(_0x35d33c,null))[_0xfb3e('0x22')](function(_0x47628e){if(_0x47628e){_0x5676da=_0x47628e;_0x229be8[_0xfb3e('0x32')]=_[_0xfb3e('0x2e')](db[_0xfb3e('0x4a')][_0xfb3e('0x2b')]);_0x229be8[_0xfb3e('0x2f')]=_[_0xfb3e('0x2e')](_0x5e02ac[_0xfb3e('0x2f')]);_0x229be8[_0xfb3e('0x30')]=_[_0xfb3e('0x31')](_0x229be8[_0xfb3e('0x32')],_0x229be8[_0xfb3e('0x2f')]);_0x4197e3[_0xfb3e('0x34')]=_[_0xfb3e('0x31')](_0x229be8[_0xfb3e('0x32')],qs[_0xfb3e('0x33')](_0x5e02ac[_0xfb3e('0x2f')][_0xfb3e('0x33')]));_0x4197e3[_0xfb3e('0x34')]=_0x4197e3[_0xfb3e('0x34')][_0xfb3e('0x35')]?_0x4197e3[_0xfb3e('0x34')]:_0x229be8['model'];_0x4197e3[_0xfb3e('0x38')]=qs[_0xfb3e('0x39')](_0x5e02ac[_0xfb3e('0x2f')][_0xfb3e('0x39')]);_0x4197e3[_0xfb3e('0x3b')]=qs['filters'](_[_0xfb3e('0x4b')](_0x5e02ac[_0xfb3e('0x2f')],_0x229be8[_0xfb3e('0x30')]));if(_0x5e02ac[_0xfb3e('0x2f')][_0xfb3e('0x3a')]){_0x4197e3[_0xfb3e('0x3b')]=_[_0xfb3e('0x3c')](_0x4197e3[_0xfb3e('0x3b')],{'$or':_['map'](_0x4197e3[_0xfb3e('0x34')],function(_0x32938f){var _0x12758a={};_0x12758a[_0x32938f]={'$like':'%'+_0x5e02ac[_0xfb3e('0x2f')][_0xfb3e('0x3a')]+'%'};return _0x12758a;})});}_0x4197e3=_['merge']({},_0x4197e3,_0x5e02ac[_0xfb3e('0x3e')]);return _0x5676da[_0xfb3e('0x48')](_0x4197e3);}})[_0xfb3e('0x22')](function(_0x43b682){if(_0x43b682){_0x315ed9=_0x43b682[_0xfb3e('0x35')];if(!_0x5e02ac[_0xfb3e('0x2f')][_0xfb3e('0x36')](_0xfb3e('0x37'))){_0x4197e3[_0xfb3e('0x1c')]=qs[_0xfb3e('0x1c')](_0x5e02ac[_0xfb3e('0x2f')][_0xfb3e('0x1c')]);_0x4197e3[_0xfb3e('0x1a')]=qs['offset'](_0x5e02ac[_0xfb3e('0x2f')][_0xfb3e('0x1a')]);}return _0x5676da[_0xfb3e('0x48')](_0x4197e3);}})[_0xfb3e('0x22')](function(_0xd13e4){if(_0xd13e4){return _0xd13e4?{'count':_0x315ed9,'rows':_0xd13e4}:null;}})[_0xfb3e('0x22')](respondWithResult(_0x35d33c,null))[_0xfb3e('0x42')](handleError(_0x35d33c,null));};exports['getDescriptions']=function(_0x3df34d,_0x17c976,_0x48e51e){var _0x32cb17={};var _0x17d3ee={};var _0x29fa94;var _0x52f156;return db[_0xfb3e('0x2a')][_0xfb3e('0x49')]({'where':{'id':_0x3df34d[_0xfb3e('0x47')]['id']}})[_0xfb3e('0x22')](handleEntityNotFound(_0x17c976,null))['then'](function(_0x10940a){if(_0x10940a){_0x29fa94=_0x10940a;_0x17d3ee['model']=_[_0xfb3e('0x2e')](db[_0xfb3e('0x4a')][_0xfb3e('0x2b')]);_0x17d3ee[_0xfb3e('0x2f')]=_[_0xfb3e('0x2e')](_0x3df34d['query']);_0x17d3ee[_0xfb3e('0x30')]=_[_0xfb3e('0x31')](_0x17d3ee[_0xfb3e('0x32')],_0x17d3ee['query']);_0x32cb17['attributes']=_[_0xfb3e('0x31')](_0x17d3ee[_0xfb3e('0x32')],qs[_0xfb3e('0x33')](_0x3df34d[_0xfb3e('0x2f')][_0xfb3e('0x33')]));_0x32cb17[_0xfb3e('0x34')]=_0x32cb17[_0xfb3e('0x34')][_0xfb3e('0x35')]?_0x32cb17['attributes']:_0x17d3ee[_0xfb3e('0x32')];_0x32cb17['order']=qs['sort'](_0x3df34d[_0xfb3e('0x2f')][_0xfb3e('0x39')]);_0x32cb17[_0xfb3e('0x3b')]=qs['filters'](_[_0xfb3e('0x4b')](_0x3df34d[_0xfb3e('0x2f')],_0x17d3ee['filters']));if(_0x3df34d[_0xfb3e('0x2f')][_0xfb3e('0x3a')]){_0x32cb17[_0xfb3e('0x3b')]=_['merge'](_0x32cb17['where'],{'$or':_[_0xfb3e('0x29')](_0x32cb17[_0xfb3e('0x34')],function(_0x2cdb75){var _0x2a0f50={};_0x2a0f50[_0x2cdb75]={'$like':'%'+_0x3df34d[_0xfb3e('0x2f')]['filter']+'%'};return _0x2a0f50;})});}_0x32cb17=_[_0xfb3e('0x3c')]({},_0x32cb17,_0x3df34d[_0xfb3e('0x3e')]);return _0x29fa94[_0xfb3e('0x4c')](_0x32cb17);}})[_0xfb3e('0x22')](function(_0x49f9d6){if(_0x49f9d6){_0x52f156=_0x49f9d6[_0xfb3e('0x35')];if(!_0x3df34d['query'][_0xfb3e('0x36')](_0xfb3e('0x37'))){_0x32cb17[_0xfb3e('0x1c')]=qs[_0xfb3e('0x1c')](_0x3df34d[_0xfb3e('0x2f')][_0xfb3e('0x1c')]);_0x32cb17[_0xfb3e('0x1a')]=qs[_0xfb3e('0x1a')](_0x3df34d[_0xfb3e('0x2f')]['offset']);}return _0x29fa94[_0xfb3e('0x4c')](_0x32cb17);}})[_0xfb3e('0x22')](function(_0x208081){if(_0x208081){return _0x208081?{'count':_0x52f156,'rows':_0x208081}:null;}})[_0xfb3e('0x22')](respondWithResult(_0x17c976,null))['catch'](handleError(_0x17c976,null));};exports[_0xfb3e('0x4d')]=function(_0x3f85bd,_0x3a6614,_0x49bdf8){var _0x28cbac={};var _0x2f44fd={};var _0x4ddc9f;var _0x309235;return db[_0xfb3e('0x2a')][_0xfb3e('0x49')]({'where':{'id':_0x3f85bd['params']['id']}})[_0xfb3e('0x22')](handleEntityNotFound(_0x3a6614,null))[_0xfb3e('0x22')](function(_0x50310d){if(_0x50310d){_0x4ddc9f=_0x50310d;_0x2f44fd[_0xfb3e('0x32')]=_[_0xfb3e('0x2e')](db[_0xfb3e('0x4a')]['rawAttributes']);_0x2f44fd['query']=_[_0xfb3e('0x2e')](_0x3f85bd['query']);_0x2f44fd[_0xfb3e('0x30')]=_[_0xfb3e('0x31')](_0x2f44fd['model'],_0x2f44fd['query']);_0x28cbac[_0xfb3e('0x34')]=_[_0xfb3e('0x31')](_0x2f44fd['model'],qs[_0xfb3e('0x33')](_0x3f85bd[_0xfb3e('0x2f')][_0xfb3e('0x33')]));_0x28cbac[_0xfb3e('0x34')]=_0x28cbac['attributes'][_0xfb3e('0x35')]?_0x28cbac[_0xfb3e('0x34')]:_0x2f44fd['model'];_0x28cbac[_0xfb3e('0x38')]=qs['sort'](_0x3f85bd[_0xfb3e('0x2f')][_0xfb3e('0x39')]);_0x28cbac['where']=qs['filters'](_[_0xfb3e('0x4b')](_0x3f85bd[_0xfb3e('0x2f')],_0x2f44fd['filters']));if(_0x3f85bd[_0xfb3e('0x2f')]['filter']){_0x28cbac[_0xfb3e('0x3b')]=_[_0xfb3e('0x3c')](_0x28cbac[_0xfb3e('0x3b')],{'$or':_['map'](_0x28cbac[_0xfb3e('0x34')],function(_0x1faedd){var _0x15613d={};_0x15613d[_0x1faedd]={'$like':'%'+_0x3f85bd[_0xfb3e('0x2f')]['filter']+'%'};return _0x15613d;})});}_0x28cbac=_[_0xfb3e('0x3c')]({},_0x28cbac,_0x3f85bd[_0xfb3e('0x3e')]);return _0x4ddc9f['getFields'](_0x28cbac);}})['then'](function(_0x1f75e2){if(_0x1f75e2){_0x309235=_0x1f75e2['length'];if(!_0x3f85bd[_0xfb3e('0x2f')][_0xfb3e('0x36')]('nolimit')){_0x28cbac[_0xfb3e('0x1c')]=qs[_0xfb3e('0x1c')](_0x3f85bd[_0xfb3e('0x2f')][_0xfb3e('0x1c')]);_0x28cbac[_0xfb3e('0x1a')]=qs[_0xfb3e('0x1a')](_0x3f85bd[_0xfb3e('0x2f')][_0xfb3e('0x1a')]);}return _0x4ddc9f[_0xfb3e('0x4d')](_0x28cbac);}})[_0xfb3e('0x22')](function(_0x1f4a2c){if(_0x1f4a2c){return _0x1f4a2c?{'count':_0x309235,'rows':_0x1f4a2c}:null;}})[_0xfb3e('0x22')](respondWithResult(_0x3a6614,null))[_0xfb3e('0x42')](handleError(_0x3a6614,null));}; \ No newline at end of file +var _0xdd60=['find','create','body','params','getSubjects','FreshsalesField','hasOwnProperty','getDescriptions','findOne','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','keys','length','options'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xdd60,0x190));var _0x0dd6=function(_0x16dd52,_0x4ca5a7){_0x16dd52=_0x16dd52-0x0;var _0x2e3e1=_0xdd60[_0x16dd52];return _0x2e3e1;};'use strict';var emlformat=require(_0x0dd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0dd6('0x1'));var jsonpatch=require(_0x0dd6('0x2'));var rp=require(_0x0dd6('0x3'));var moment=require(_0x0dd6('0x4'));var BPromise=require(_0x0dd6('0x5'));var Mustache=require('mustache');var util=require(_0x0dd6('0x6'));var path=require(_0x0dd6('0x7'));var sox=require(_0x0dd6('0x8'));var csv=require('to-csv');var ejs=require(_0x0dd6('0x9'));var fs=require('fs');var fs_extra=require(_0x0dd6('0xa'));var _=require('lodash');var squel=require(_0x0dd6('0xb'));var crypto=require(_0x0dd6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0dd6('0xd'));var toCsv=require(_0x0dd6('0xe'));var querystring=require(_0x0dd6('0xf'));var Papa=require(_0x0dd6('0x10'));var Redis=require(_0x0dd6('0x11'));var authService=require(_0x0dd6('0x12'));var qs=require(_0x0dd6('0x13'));var as=require(_0x0dd6('0x14'));var hardwareService=require(_0x0dd6('0x15'));var logger=require(_0x0dd6('0x16'))(_0x0dd6('0x17'));var utils=require(_0x0dd6('0x18'));var config=require(_0x0dd6('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dd6('0x1a'))['db'];function respondWithStatusCode(_0x99e50c,_0x5f38bb){_0x5f38bb=_0x5f38bb||0xcc;return function(_0x10fd1d){if(_0x10fd1d){return _0x99e50c[_0x0dd6('0x1b')](_0x5f38bb);}return _0x99e50c[_0x0dd6('0x1c')](_0x5f38bb)['end']();};}function respondWithResult(_0x126226,_0x2f167){_0x2f167=_0x2f167||0xc8;return function(_0x5a2b33){if(_0x5a2b33){return _0x126226[_0x0dd6('0x1c')](_0x2f167)['json'](_0x5a2b33);}};}function respondWithFilteredResult(_0x3542b9,_0x3e689d){return function(_0x386291){if(_0x386291){var _0x30bfd0=typeof _0x3e689d[_0x0dd6('0x1d')]===_0x0dd6('0x1e')&&typeof _0x3e689d[_0x0dd6('0x1f')]===_0x0dd6('0x1e');var _0x3d3300=_0x386291[_0x0dd6('0x20')];var _0x2e35d7=_0x30bfd0?0x0:_0x3e689d[_0x0dd6('0x1d')];var _0x290825=_0x30bfd0?_0x386291[_0x0dd6('0x20')]:_0x3e689d[_0x0dd6('0x1d')]+_0x3e689d[_0x0dd6('0x1f')];var _0x1f8d68;if(_0x290825>=_0x3d3300){_0x290825=_0x3d3300;_0x1f8d68=0xc8;}else{_0x1f8d68=0xce;}_0x3542b9[_0x0dd6('0x1c')](_0x1f8d68);return _0x3542b9[_0x0dd6('0x21')](_0x0dd6('0x22'),_0x2e35d7+'-'+_0x290825+'/'+_0x3d3300)['json'](_0x386291);}return null;};}function patchUpdates(_0x1b0d58){return function(_0x54632f){try{jsonpatch['apply'](_0x54632f,_0x1b0d58,!![]);}catch(_0x3adc26){return BPromise['reject'](_0x3adc26);}return _0x54632f['save']();};}function saveUpdates(_0x162d58,_0x23ec12){return function(_0x2a2d8f){if(_0x2a2d8f){return _0x2a2d8f[_0x0dd6('0x23')](_0x162d58)[_0x0dd6('0x24')](function(_0x45c6fd){return _0x45c6fd;});}return null;};}function removeEntity(_0x4b5e00,_0x3d1580){return function(_0x4192ab){if(_0x4192ab){return _0x4192ab[_0x0dd6('0x25')]()[_0x0dd6('0x24')](function(){_0x4b5e00[_0x0dd6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19af9c,_0x42b00e){return function(_0x16285e){if(!_0x16285e){_0x19af9c[_0x0dd6('0x1b')](0x194);}return _0x16285e;};}function handleError(_0x8b158a,_0x30529a){_0x30529a=_0x30529a||0x1f4;return function(_0x41b1aa){logger['error'](_0x41b1aa[_0x0dd6('0x26')]);if(_0x41b1aa[_0x0dd6('0x27')]){delete _0x41b1aa['name'];}_0x8b158a['status'](_0x30529a)[_0x0dd6('0x28')](_0x41b1aa);};}exports[_0x0dd6('0x29')]=function(_0x254b3e,_0x359455){var _0x423d38={},_0x2bcf30={},_0x3bbbe3={'count':0x0,'rows':[]};var _0x45490f=_[_0x0dd6('0x2a')](db[_0x0dd6('0x2b')][_0x0dd6('0x2c')],function(_0x525558){return{'name':_0x525558['fieldName'],'type':_0x525558[_0x0dd6('0x2d')][_0x0dd6('0x2e')]};});_0x2bcf30[_0x0dd6('0x2f')]=_[_0x0dd6('0x2a')](_0x45490f,_0x0dd6('0x27'));_0x2bcf30['query']=_['keys'](_0x254b3e['query']);_0x2bcf30['filters']=_['intersection'](_0x2bcf30[_0x0dd6('0x2f')],_0x2bcf30[_0x0dd6('0x30')]);_0x423d38[_0x0dd6('0x31')]=_[_0x0dd6('0x32')](_0x2bcf30[_0x0dd6('0x2f')],qs[_0x0dd6('0x33')](_0x254b3e[_0x0dd6('0x30')][_0x0dd6('0x33')]));_0x423d38[_0x0dd6('0x31')]=_0x423d38[_0x0dd6('0x31')]['length']?_0x423d38[_0x0dd6('0x31')]:_0x2bcf30[_0x0dd6('0x2f')];if(!_0x254b3e['query']['hasOwnProperty'](_0x0dd6('0x34'))){_0x423d38[_0x0dd6('0x1f')]=qs[_0x0dd6('0x1f')](_0x254b3e[_0x0dd6('0x30')]['limit']);_0x423d38[_0x0dd6('0x1d')]=qs['offset'](_0x254b3e[_0x0dd6('0x30')]['offset']);}_0x423d38[_0x0dd6('0x35')]=qs[_0x0dd6('0x36')](_0x254b3e[_0x0dd6('0x30')][_0x0dd6('0x36')]);_0x423d38[_0x0dd6('0x37')]=qs[_0x0dd6('0x38')](_[_0x0dd6('0x39')](_0x254b3e[_0x0dd6('0x30')],_0x2bcf30[_0x0dd6('0x38')]),_0x45490f);if(_0x254b3e[_0x0dd6('0x30')][_0x0dd6('0x3a')]){_0x423d38[_0x0dd6('0x37')]=_['merge'](_0x423d38[_0x0dd6('0x37')],{'$or':_[_0x0dd6('0x2a')](_0x45490f,function(_0x5c7249){if(_0x5c7249[_0x0dd6('0x2d')]!=='VIRTUAL'){var _0x2c6d59={};_0x2c6d59[_0x5c7249[_0x0dd6('0x27')]]={'$like':'%'+_0x254b3e['query'][_0x0dd6('0x3a')]+'%'};return _0x2c6d59;}})});}_0x423d38=_[_0x0dd6('0x3b')]({},_0x423d38,_0x254b3e['options']);var _0x5e4a7f={'where':_0x423d38[_0x0dd6('0x37')]};return db[_0x0dd6('0x2b')][_0x0dd6('0x20')](_0x5e4a7f)[_0x0dd6('0x24')](function(_0x196e6b){_0x3bbbe3['count']=_0x196e6b;if(_0x254b3e[_0x0dd6('0x30')][_0x0dd6('0x3c')]){_0x423d38[_0x0dd6('0x3d')]=[{'all':!![]}];}return db[_0x0dd6('0x2b')][_0x0dd6('0x3e')](_0x423d38);})[_0x0dd6('0x24')](function(_0x9622d3){_0x3bbbe3[_0x0dd6('0x3f')]=_0x9622d3;return _0x3bbbe3;})['then'](respondWithFilteredResult(_0x359455,_0x423d38))[_0x0dd6('0x40')](handleError(_0x359455,null));};exports['show']=function(_0x47692b,_0x11e616){var _0x1323f4={'raw':![],'where':{'id':_0x47692b['params']['id']}},_0x4c243a={};_0x4c243a[_0x0dd6('0x2f')]=_['keys'](db['FreshsalesConfiguration'][_0x0dd6('0x2c')]);_0x4c243a[_0x0dd6('0x30')]=_[_0x0dd6('0x41')](_0x47692b[_0x0dd6('0x30')]);_0x4c243a[_0x0dd6('0x38')]=_['intersection'](_0x4c243a[_0x0dd6('0x2f')],_0x4c243a[_0x0dd6('0x30')]);_0x1323f4[_0x0dd6('0x31')]=_['intersection'](_0x4c243a[_0x0dd6('0x2f')],qs[_0x0dd6('0x33')](_0x47692b['query'][_0x0dd6('0x33')]));_0x1323f4['attributes']=_0x1323f4['attributes'][_0x0dd6('0x42')]?_0x1323f4[_0x0dd6('0x31')]:_0x4c243a[_0x0dd6('0x2f')];if(_0x47692b[_0x0dd6('0x30')]['includeAll']){_0x1323f4[_0x0dd6('0x3d')]=[{'all':!![]}];}_0x1323f4=_[_0x0dd6('0x3b')]({},_0x1323f4,_0x47692b[_0x0dd6('0x43')]);return db[_0x0dd6('0x2b')][_0x0dd6('0x44')](_0x1323f4)[_0x0dd6('0x24')](handleEntityNotFound(_0x11e616,null))['then'](respondWithResult(_0x11e616,null))[_0x0dd6('0x40')](handleError(_0x11e616,null));};exports[_0x0dd6('0x45')]=function(_0x200fab,_0xf24233){return db[_0x0dd6('0x2b')][_0x0dd6('0x45')](_0x200fab[_0x0dd6('0x46')],{})[_0x0dd6('0x24')](respondWithResult(_0xf24233,0xc9))[_0x0dd6('0x40')](handleError(_0xf24233,null));};exports['update']=function(_0x500817,_0x5532c2){if(_0x500817[_0x0dd6('0x46')]['id']){delete _0x500817['body']['id'];}return db['FreshsalesConfiguration'][_0x0dd6('0x44')]({'where':{'id':_0x500817[_0x0dd6('0x47')]['id']}})['then'](handleEntityNotFound(_0x5532c2,null))[_0x0dd6('0x24')](saveUpdates(_0x500817['body'],null))[_0x0dd6('0x24')](respondWithResult(_0x5532c2,null))[_0x0dd6('0x40')](handleError(_0x5532c2,null));};exports['destroy']=function(_0x21add6,_0x457b13){return db[_0x0dd6('0x2b')]['find']({'where':{'id':_0x21add6[_0x0dd6('0x47')]['id']}})[_0x0dd6('0x24')](handleEntityNotFound(_0x457b13,null))[_0x0dd6('0x24')](removeEntity(_0x457b13,null))[_0x0dd6('0x40')](handleError(_0x457b13,null));};exports[_0x0dd6('0x48')]=function(_0x3397fc,_0x7dafeb,_0x38b2e5){var _0x3dfaff={};var _0x35caa2={};var _0x4b55b3;var _0x51faa0;return db[_0x0dd6('0x2b')]['findOne']({'where':{'id':_0x3397fc[_0x0dd6('0x47')]['id']}})[_0x0dd6('0x24')](handleEntityNotFound(_0x7dafeb,null))[_0x0dd6('0x24')](function(_0x568f54){if(_0x568f54){_0x4b55b3=_0x568f54;_0x35caa2[_0x0dd6('0x2f')]=_[_0x0dd6('0x41')](db[_0x0dd6('0x49')][_0x0dd6('0x2c')]);_0x35caa2['query']=_['keys'](_0x3397fc[_0x0dd6('0x30')]);_0x35caa2[_0x0dd6('0x38')]=_[_0x0dd6('0x32')](_0x35caa2[_0x0dd6('0x2f')],_0x35caa2['query']);_0x3dfaff[_0x0dd6('0x31')]=_[_0x0dd6('0x32')](_0x35caa2[_0x0dd6('0x2f')],qs[_0x0dd6('0x33')](_0x3397fc['query'][_0x0dd6('0x33')]));_0x3dfaff[_0x0dd6('0x31')]=_0x3dfaff['attributes'][_0x0dd6('0x42')]?_0x3dfaff['attributes']:_0x35caa2[_0x0dd6('0x2f')];_0x3dfaff[_0x0dd6('0x35')]=qs[_0x0dd6('0x36')](_0x3397fc[_0x0dd6('0x30')][_0x0dd6('0x36')]);_0x3dfaff[_0x0dd6('0x37')]=qs['filters'](_[_0x0dd6('0x39')](_0x3397fc[_0x0dd6('0x30')],_0x35caa2[_0x0dd6('0x38')]));if(_0x3397fc['query']['filter']){_0x3dfaff[_0x0dd6('0x37')]=_[_0x0dd6('0x3b')](_0x3dfaff[_0x0dd6('0x37')],{'$or':_['map'](_0x3dfaff[_0x0dd6('0x31')],function(_0x307494){var _0xec3d8b={};_0xec3d8b[_0x307494]={'$like':'%'+_0x3397fc[_0x0dd6('0x30')][_0x0dd6('0x3a')]+'%'};return _0xec3d8b;})});}_0x3dfaff=_[_0x0dd6('0x3b')]({},_0x3dfaff,_0x3397fc['options']);return _0x4b55b3['getSubjects'](_0x3dfaff);}})['then'](function(_0x14cbf4){if(_0x14cbf4){_0x51faa0=_0x14cbf4[_0x0dd6('0x42')];if(!_0x3397fc[_0x0dd6('0x30')][_0x0dd6('0x4a')](_0x0dd6('0x34'))){_0x3dfaff[_0x0dd6('0x1f')]=qs[_0x0dd6('0x1f')](_0x3397fc[_0x0dd6('0x30')][_0x0dd6('0x1f')]);_0x3dfaff['offset']=qs[_0x0dd6('0x1d')](_0x3397fc[_0x0dd6('0x30')][_0x0dd6('0x1d')]);}return _0x4b55b3[_0x0dd6('0x48')](_0x3dfaff);}})[_0x0dd6('0x24')](function(_0x59ca5b){if(_0x59ca5b){return _0x59ca5b?{'count':_0x51faa0,'rows':_0x59ca5b}:null;}})[_0x0dd6('0x24')](respondWithResult(_0x7dafeb,null))['catch'](handleError(_0x7dafeb,null));};exports[_0x0dd6('0x4b')]=function(_0x61c0c9,_0x44e353,_0x1196fd){var _0xff74bc={};var _0x2abe7f={};var _0x343a52;var _0x3a8ca4;return db[_0x0dd6('0x2b')][_0x0dd6('0x4c')]({'where':{'id':_0x61c0c9['params']['id']}})[_0x0dd6('0x24')](handleEntityNotFound(_0x44e353,null))[_0x0dd6('0x24')](function(_0x1e165f){if(_0x1e165f){_0x343a52=_0x1e165f;_0x2abe7f[_0x0dd6('0x2f')]=_[_0x0dd6('0x41')](db[_0x0dd6('0x49')]['rawAttributes']);_0x2abe7f['query']=_['keys'](_0x61c0c9['query']);_0x2abe7f[_0x0dd6('0x38')]=_[_0x0dd6('0x32')](_0x2abe7f[_0x0dd6('0x2f')],_0x2abe7f['query']);_0xff74bc[_0x0dd6('0x31')]=_[_0x0dd6('0x32')](_0x2abe7f[_0x0dd6('0x2f')],qs['fields'](_0x61c0c9[_0x0dd6('0x30')][_0x0dd6('0x33')]));_0xff74bc[_0x0dd6('0x31')]=_0xff74bc[_0x0dd6('0x31')]['length']?_0xff74bc[_0x0dd6('0x31')]:_0x2abe7f[_0x0dd6('0x2f')];_0xff74bc['order']=qs[_0x0dd6('0x36')](_0x61c0c9[_0x0dd6('0x30')][_0x0dd6('0x36')]);_0xff74bc[_0x0dd6('0x37')]=qs[_0x0dd6('0x38')](_['pick'](_0x61c0c9[_0x0dd6('0x30')],_0x2abe7f[_0x0dd6('0x38')]));if(_0x61c0c9['query']['filter']){_0xff74bc[_0x0dd6('0x37')]=_[_0x0dd6('0x3b')](_0xff74bc[_0x0dd6('0x37')],{'$or':_[_0x0dd6('0x2a')](_0xff74bc[_0x0dd6('0x31')],function(_0x57e618){var _0xdb3deb={};_0xdb3deb[_0x57e618]={'$like':'%'+_0x61c0c9[_0x0dd6('0x30')]['filter']+'%'};return _0xdb3deb;})});}_0xff74bc=_[_0x0dd6('0x3b')]({},_0xff74bc,_0x61c0c9[_0x0dd6('0x43')]);return _0x343a52[_0x0dd6('0x4b')](_0xff74bc);}})[_0x0dd6('0x24')](function(_0x42137a){if(_0x42137a){_0x3a8ca4=_0x42137a[_0x0dd6('0x42')];if(!_0x61c0c9[_0x0dd6('0x30')][_0x0dd6('0x4a')]('nolimit')){_0xff74bc[_0x0dd6('0x1f')]=qs['limit'](_0x61c0c9[_0x0dd6('0x30')][_0x0dd6('0x1f')]);_0xff74bc[_0x0dd6('0x1d')]=qs['offset'](_0x61c0c9[_0x0dd6('0x30')][_0x0dd6('0x1d')]);}return _0x343a52[_0x0dd6('0x4b')](_0xff74bc);}})[_0x0dd6('0x24')](function(_0x4b6e6e){if(_0x4b6e6e){return _0x4b6e6e?{'count':_0x3a8ca4,'rows':_0x4b6e6e}:null;}})[_0x0dd6('0x24')](respondWithResult(_0x44e353,null))[_0x0dd6('0x40')](handleError(_0x44e353,null));};exports['getFields']=function(_0x4769fc,_0x30c7d4,_0x54930f){var _0x1a1574={};var _0xca0ef4={};var _0x1d4f89;var _0x2dfc2d;return db['FreshsalesConfiguration'][_0x0dd6('0x4c')]({'where':{'id':_0x4769fc[_0x0dd6('0x47')]['id']}})[_0x0dd6('0x24')](handleEntityNotFound(_0x30c7d4,null))[_0x0dd6('0x24')](function(_0x2b72f4){if(_0x2b72f4){_0x1d4f89=_0x2b72f4;_0xca0ef4[_0x0dd6('0x2f')]=_[_0x0dd6('0x41')](db[_0x0dd6('0x49')]['rawAttributes']);_0xca0ef4['query']=_[_0x0dd6('0x41')](_0x4769fc[_0x0dd6('0x30')]);_0xca0ef4['filters']=_['intersection'](_0xca0ef4['model'],_0xca0ef4[_0x0dd6('0x30')]);_0x1a1574[_0x0dd6('0x31')]=_['intersection'](_0xca0ef4[_0x0dd6('0x2f')],qs[_0x0dd6('0x33')](_0x4769fc[_0x0dd6('0x30')][_0x0dd6('0x33')]));_0x1a1574['attributes']=_0x1a1574[_0x0dd6('0x31')][_0x0dd6('0x42')]?_0x1a1574['attributes']:_0xca0ef4[_0x0dd6('0x2f')];_0x1a1574[_0x0dd6('0x35')]=qs[_0x0dd6('0x36')](_0x4769fc['query']['sort']);_0x1a1574['where']=qs['filters'](_[_0x0dd6('0x39')](_0x4769fc[_0x0dd6('0x30')],_0xca0ef4[_0x0dd6('0x38')]));if(_0x4769fc[_0x0dd6('0x30')][_0x0dd6('0x3a')]){_0x1a1574[_0x0dd6('0x37')]=_['merge'](_0x1a1574[_0x0dd6('0x37')],{'$or':_[_0x0dd6('0x2a')](_0x1a1574[_0x0dd6('0x31')],function(_0x511bb9){var _0x16ea85={};_0x16ea85[_0x511bb9]={'$like':'%'+_0x4769fc[_0x0dd6('0x30')][_0x0dd6('0x3a')]+'%'};return _0x16ea85;})});}_0x1a1574=_[_0x0dd6('0x3b')]({},_0x1a1574,_0x4769fc[_0x0dd6('0x43')]);return _0x1d4f89[_0x0dd6('0x4d')](_0x1a1574);}})[_0x0dd6('0x24')](function(_0x5cb03f){if(_0x5cb03f){_0x2dfc2d=_0x5cb03f['length'];if(!_0x4769fc[_0x0dd6('0x30')]['hasOwnProperty']('nolimit')){_0x1a1574[_0x0dd6('0x1f')]=qs[_0x0dd6('0x1f')](_0x4769fc['query'][_0x0dd6('0x1f')]);_0x1a1574[_0x0dd6('0x1d')]=qs[_0x0dd6('0x1d')](_0x4769fc[_0x0dd6('0x30')][_0x0dd6('0x1d')]);}return _0x1d4f89[_0x0dd6('0x4d')](_0x1a1574);}})[_0x0dd6('0x24')](function(_0xe93218){if(_0xe93218){return _0xe93218?{'count':_0x2dfc2d,'rows':_0xe93218}:null;}})[_0x0dd6('0x24')](respondWithResult(_0x30c7d4,null))[_0x0dd6('0x40')](handleError(_0x30c7d4,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index b340b59..73d17fa 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 _0x4e64=['lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','define','FreshsalesConfiguration'];(function(_0xb96a34,_0xad2226){var _0x30eb03=function(_0x3e016c){while(--_0x3e016c){_0xb96a34['push'](_0xb96a34['shift']());}};_0x30eb03(++_0xad2226);}(_0x4e64,0xa0));var _0x44e6=function(_0x34053b,_0x9098d6){_0x34053b=_0x34053b-0x0;var _0x18970d=_0x4e64[_0x34053b];return _0x18970d;};'use strict';var _=require(_0x44e6('0x0'));var util=require('util');var logger=require(_0x44e6('0x1'))(_0x44e6('0x2'));var moment=require('moment');var BPromise=require(_0x44e6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x44e6('0x4'));var config=require(_0x44e6('0x5'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x5662b3,_0x9de7ec){return _0x5662b3[_0x44e6('0x6')](_0x44e6('0x7'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2f9=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','int_freshsales_configurations','lodash'];(function(_0x3d3c6e,_0x47c588){var _0x19456f=function(_0x3a784c){while(--_0x3a784c){_0x3d3c6e['push'](_0x3d3c6e['shift']());}};_0x19456f(++_0x47c588);}(_0xf2f9,0x143));var _0x9f2f=function(_0x2f17e4,_0x1d4bc3){_0x2f17e4=_0x2f17e4-0x0;var _0x397e3a=_0xf2f9[_0x2f17e4];return _0x397e3a;};'use strict';var _=require(_0x9f2f('0x0'));var util=require(_0x9f2f('0x1'));var logger=require(_0x9f2f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9f2f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f2f('0x4'));var rimraf=require(_0x9f2f('0x5'));var config=require(_0x9f2f('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x9f2f('0x7')]=function(_0x12dc23,_0xeb9f38){return _0x12dc23['define']('FreshsalesConfiguration',attributes,{'tableName':_0x9f2f('0x8'),'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 7e1040c..ef1138a 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 _0xc797=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch','util'];(function(_0x17cb63,_0x4c0e90){var _0x4340bc=function(_0x364807){while(--_0x364807){_0x17cb63['push'](_0x17cb63['shift']());}};_0x4340bc(++_0x4c0e90);}(_0xc797,0xef));var _0x7c79=function(_0x893274,_0x58452b){_0x893274=_0x893274-0x0;var _0x1cfabb=_0xc797[_0x893274];return _0x1cfabb;};'use strict';var _=require('lodash');var util=require(_0x7c79('0x0'));var moment=require('moment');var BPromise=require(_0x7c79('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c79('0x2'));var db=require(_0x7c79('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c79('0x4'))(_0x7c79('0x5'));var config=require(_0x7c79('0x6'));var jayson=require(_0x7c79('0x7'));var client=jayson['client'][_0x7c79('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x571f1e,_0x1ee579,_0xd912cc){return new BPromise(function(_0x46279f,_0x17a6eb){return client[_0x7c79('0x9')](_0x571f1e,_0xd912cc)['then'](function(_0x22fd76){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1ee579,_0x7c79('0xa'));logger[_0x7c79('0xb')](_0x7c79('0xc'),_0x1ee579,_0x7c79('0xa'),JSON[_0x7c79('0xd')](_0x22fd76));if(_0x22fd76[_0x7c79('0xe')]){if(_0x22fd76[_0x7c79('0xe')]['code']===0x1f4){logger[_0x7c79('0xe')](_0x7c79('0xf'),_0x1ee579,_0x22fd76[_0x7c79('0xe')]['message']);return _0x17a6eb(_0x22fd76[_0x7c79('0xe')]['message']);}logger[_0x7c79('0xe')](_0x7c79('0xf'),_0x1ee579,_0x22fd76[_0x7c79('0xe')][_0x7c79('0x10')]);return _0x46279f(_0x22fd76[_0x7c79('0xe')]['message']);}else{logger[_0x7c79('0x11')](_0x7c79('0xf'),_0x1ee579,'request\x20sent');_0x46279f(_0x22fd76[_0x7c79('0x12')][_0x7c79('0x10')]);}})[_0x7c79('0x13')](function(_0x2b552d){logger[_0x7c79('0xe')](_0x7c79('0xf'),_0x1ee579,_0x2b552d);_0x17a6eb(_0x2b552d);});});} \ No newline at end of file +var _0x2870=['request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','randomstring','ioredis','../../config/utils','../../config/environment','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x1f7fb2,_0x116309){var _0x61fc27=function(_0x4b981c){while(--_0x4b981c){_0x1f7fb2['push'](_0x1f7fb2['shift']());}};_0x61fc27(++_0x116309);}(_0x2870,0x1d1));var _0x0287=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0x2870[_0x478414];return _0x5eb6b9;};'use strict';var _=require(_0x0287('0x0'));var util=require(_0x0287('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0287('0x2'));var fs=require('fs');var Redis=require(_0x0287('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0287('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x0287('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0287('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4e3dfe,_0x1bdb5d,_0x5e0b2a){return new BPromise(function(_0x17bbe6,_0x37fee6){return client[_0x0287('0x7')](_0x4e3dfe,_0x5e0b2a)[_0x0287('0x8')](function(_0x15a74c){logger[_0x0287('0x9')](_0x0287('0xa'),_0x1bdb5d,_0x0287('0xb'));logger[_0x0287('0xc')](_0x0287('0xd'),_0x1bdb5d,_0x0287('0xb'),JSON[_0x0287('0xe')](_0x15a74c));if(_0x15a74c['error']){if(_0x15a74c[_0x0287('0xf')]['code']===0x1f4){logger['error'](_0x0287('0xa'),_0x1bdb5d,_0x15a74c[_0x0287('0xf')][_0x0287('0x10')]);return _0x37fee6(_0x15a74c['error']['message']);}logger['error'](_0x0287('0xa'),_0x1bdb5d,_0x15a74c[_0x0287('0xf')]['message']);return _0x17bbe6(_0x15a74c['error']['message']);}else{logger['info'](_0x0287('0xa'),_0x1bdb5d,_0x0287('0xb'));_0x17bbe6(_0x15a74c['result'][_0x0287('0x10')]);}})['catch'](function(_0x6f4d53){logger[_0x0287('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1bdb5d,_0x6f4d53);_0x37fee6(_0x6f4d53);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 88cdd64..440f9dc 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 _0x8cfd=['post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x26cc16,_0x4c174f){_0x26cc16=_0x26cc16-0x0;var _0x345e3e=_0x8cfd[_0x26cc16];return _0x345e3e;};'use strict';var multer=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));var path=require(_0xd8cf('0x2'));var timeout=require(_0xd8cf('0x3'));var express=require(_0xd8cf('0x4'));var router=express[_0xd8cf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd8cf('0x6'));var interaction=require(_0xd8cf('0x7'));var config=require(_0xd8cf('0x8'));var controller=require(_0xd8cf('0x9'));router[_0xd8cf('0xa')]('/',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xc')]);router['get']('/:id',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xd')]);router[_0xd8cf('0xe')]('/',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xf')]);router[_0xd8cf('0x10')]('/:id',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0x11')]);router[_0xd8cf('0x12')](_0xd8cf('0x13'),auth[_0xd8cf('0xb')](),controller[_0xd8cf('0x14')]);module[_0xd8cf('0x15')]=router; \ No newline at end of file +var _0x2821=['index','get','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated'];(function(_0x520020,_0x7d31a1){var _0x4c96a4=function(_0x2c0b70){while(--_0x2c0b70){_0x520020['push'](_0x520020['shift']());}};_0x4c96a4(++_0x7d31a1);}(_0x2821,0x87));var _0x1282=function(_0x5a8287,_0x937bf1){_0x5a8287=_0x5a8287-0x0;var _0x26f712=_0x2821[_0x5a8287];return _0x26f712;};'use strict';var multer=require(_0x1282('0x0'));var util=require(_0x1282('0x1'));var path=require(_0x1282('0x2'));var timeout=require(_0x1282('0x3'));var express=require(_0x1282('0x4'));var router=express[_0x1282('0x5')]();var fs_extra=require(_0x1282('0x6'));var auth=require(_0x1282('0x7'));var interaction=require(_0x1282('0x8'));var config=require(_0x1282('0x9'));var controller=require(_0x1282('0xa'));router['get']('/',auth[_0x1282('0xb')](),controller[_0x1282('0xc')]);router[_0x1282('0xd')](_0x1282('0xe'),auth[_0x1282('0xb')](),controller[_0x1282('0xf')]);router[_0x1282('0x10')]('/',auth[_0x1282('0xb')](),controller['create']);router[_0x1282('0x11')](_0x1282('0xe'),auth[_0x1282('0xb')](),controller[_0x1282('0x12')]);router[_0x1282('0x13')]('/:id',auth[_0x1282('0xb')](),controller[_0x1282('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 03a003a..aaef9b6 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 _0xdccb=['keyValue','STRING','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x2dd0ce,_0x461f8c){var _0x1afdfa=function(_0x5336e6){while(--_0x5336e6){_0x2dd0ce['push'](_0x2dd0ce['shift']());}};_0x1afdfa(++_0x461f8c);}(_0xdccb,0x10b));var _0xbdcc=function(_0x118749,_0x50e848){_0x118749=_0x118749-0x0;var _0x20d489=_0xdccb[_0x118749];return _0x20d489;};'use strict';var Sequelize=require(_0xbdcc('0x0'));module[_0xbdcc('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbdcc('0x2'),_0xbdcc('0x3'),_0xbdcc('0x4'),_0xbdcc('0x5'),'picklist'),'defaultValue':_0xbdcc('0x2')},'content':{'type':Sequelize[_0xbdcc('0x6')]},'key':{'type':Sequelize[_0xbdcc('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xbdcc('0x2'),_0xbdcc('0x3'),_0xbdcc('0x4'))},'keyContent':{'type':Sequelize[_0xbdcc('0x6')]},'idField':{'type':Sequelize[_0xbdcc('0x6')]},'nameField':{'type':Sequelize[_0xbdcc('0x6')]},'customField':{'type':Sequelize[_0xbdcc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbdcc('0x6')]}}; \ No newline at end of file +var _0xb538=['exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize'];(function(_0x4f6d0e,_0x5d82af){var _0x4ddc07=function(_0x5f125e){while(--_0x5f125e){_0x4f6d0e['push'](_0x4f6d0e['shift']());}};_0x4ddc07(++_0x5d82af);}(_0xb538,0x143));var _0x8b53=function(_0xe36d7e,_0x7ade47){_0xe36d7e=_0xe36d7e-0x0;var _0x54b9eb=_0xb538[_0xe36d7e];return _0x54b9eb;};'use strict';var Sequelize=require(_0x8b53('0x0'));module[_0x8b53('0x1')]={'type':{'type':Sequelize[_0x8b53('0x2')]('string',_0x8b53('0x3'),_0x8b53('0x4'),_0x8b53('0x5'),'picklist'),'defaultValue':_0x8b53('0x6')},'content':{'type':Sequelize[_0x8b53('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8b53('0x2')]('string',_0x8b53('0x3'),_0x8b53('0x4'))},'keyContent':{'type':Sequelize[_0x8b53('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8b53('0x7')]},'customField':{'type':Sequelize[_0x8b53('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 23b0062..5a5d0d8 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 _0x2169=['squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x335820,_0xf25733){var _0x1c170e=function(_0x44273c){while(--_0x44273c){_0x335820['push'](_0x335820['shift']());}};_0x1c170e(++_0xf25733);}(_0x2169,0x1ed));var _0x9216=function(_0x2376d1,_0x38eec4){_0x2376d1=_0x2376d1-0x0;var _0x443759=_0x2169[_0x2376d1];return _0x443759;};'use strict';var emlformat=require(_0x9216('0x0'));var rimraf=require(_0x9216('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9216('0x2'));var rp=require('request-promise');var moment=require(_0x9216('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9216('0x4'));var util=require(_0x9216('0x5'));var path=require('path');var sox=require(_0x9216('0x6'));var csv=require(_0x9216('0x7'));var ejs=require(_0x9216('0x8'));var fs=require('fs');var fs_extra=require(_0x9216('0x9'));var _=require(_0x9216('0xa'));var squel=require(_0x9216('0xb'));var crypto=require('crypto');var jsforce=require(_0x9216('0xc'));var deskjs=require(_0x9216('0xd'));var toCsv=require(_0x9216('0x7'));var querystring=require(_0x9216('0xe'));var Papa=require(_0x9216('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9216('0x10'));var as=require(_0x9216('0x11'));var hardwareService=require(_0x9216('0x12'));var logger=require('../../config/logger')(_0x9216('0x13'));var utils=require(_0x9216('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9216('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x294b55,_0x412e32){_0x412e32=_0x412e32||0xcc;return function(_0x55b145){if(_0x55b145){return _0x294b55[_0x9216('0x16')](_0x412e32);}return _0x294b55[_0x9216('0x17')](_0x412e32)['end']();};}function respondWithResult(_0x175267,_0x325c1b){_0x325c1b=_0x325c1b||0xc8;return function(_0x7f0dd2){if(_0x7f0dd2){return _0x175267['status'](_0x325c1b)['json'](_0x7f0dd2);}};}function respondWithFilteredResult(_0x28522f,_0x396e30){return function(_0x116e7f){if(_0x116e7f){var _0x3b8b22=typeof _0x396e30[_0x9216('0x18')]===_0x9216('0x19')&&typeof _0x396e30[_0x9216('0x1a')]==='undefined';var _0x563546=_0x116e7f[_0x9216('0x1b')];var _0x4f1a58=_0x3b8b22?0x0:_0x396e30[_0x9216('0x18')];var _0x52b15c=_0x3b8b22?_0x116e7f['count']:_0x396e30['offset']+_0x396e30[_0x9216('0x1a')];var _0x3dc1ed;if(_0x52b15c>=_0x563546){_0x52b15c=_0x563546;_0x3dc1ed=0xc8;}else{_0x3dc1ed=0xce;}_0x28522f['status'](_0x3dc1ed);return _0x28522f[_0x9216('0x1c')](_0x9216('0x1d'),_0x4f1a58+'-'+_0x52b15c+'/'+_0x563546)['json'](_0x116e7f);}return null;};}function patchUpdates(_0x3df0f9){return function(_0x58433d){try{jsonpatch[_0x9216('0x1e')](_0x58433d,_0x3df0f9,!![]);}catch(_0x5eb910){return BPromise[_0x9216('0x1f')](_0x5eb910);}return _0x58433d[_0x9216('0x20')]();};}function saveUpdates(_0xe02749,_0x2319e7){return function(_0x3c9147){if(_0x3c9147){return _0x3c9147[_0x9216('0x21')](_0xe02749)[_0x9216('0x22')](function(_0x4fabff){return _0x4fabff;});}return null;};}function removeEntity(_0x186749,_0x66ed76){return function(_0x542bc0){if(_0x542bc0){return _0x542bc0[_0x9216('0x23')]()[_0x9216('0x22')](function(){_0x186749[_0x9216('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc58ba,_0x2db7b8){return function(_0x32f9f1){if(!_0x32f9f1){_0xcc58ba[_0x9216('0x16')](0x194);}return _0x32f9f1;};}function handleError(_0xfcc123,_0x234613){_0x234613=_0x234613||0x1f4;return function(_0x358b98){logger[_0x9216('0x24')](_0x358b98[_0x9216('0x25')]);if(_0x358b98[_0x9216('0x26')]){delete _0x358b98['name'];}_0xfcc123['status'](_0x234613)['send'](_0x358b98);};}exports[_0x9216('0x27')]=function(_0x457d36,_0x5c1928){var _0x9798fe={},_0x1ee223={},_0x5a37b0={'count':0x0,'rows':[]};var _0x2de8c2=_[_0x9216('0x28')](db[_0x9216('0x29')][_0x9216('0x2a')],function(_0x3d6ee2){return{'name':_0x3d6ee2[_0x9216('0x2b')],'type':_0x3d6ee2['type'][_0x9216('0x2c')]};});_0x1ee223[_0x9216('0x2d')]=_[_0x9216('0x28')](_0x2de8c2,_0x9216('0x26'));_0x1ee223[_0x9216('0x2e')]=_[_0x9216('0x2f')](_0x457d36[_0x9216('0x2e')]);_0x1ee223[_0x9216('0x30')]=_[_0x9216('0x31')](_0x1ee223[_0x9216('0x2d')],_0x1ee223['query']);_0x9798fe[_0x9216('0x32')]=_[_0x9216('0x31')](_0x1ee223[_0x9216('0x2d')],qs[_0x9216('0x33')](_0x457d36['query'][_0x9216('0x33')]));_0x9798fe[_0x9216('0x32')]=_0x9798fe[_0x9216('0x32')][_0x9216('0x34')]?_0x9798fe['attributes']:_0x1ee223['model'];if(!_0x457d36['query'][_0x9216('0x35')](_0x9216('0x36'))){_0x9798fe[_0x9216('0x1a')]=qs['limit'](_0x457d36[_0x9216('0x2e')][_0x9216('0x1a')]);_0x9798fe[_0x9216('0x18')]=qs['offset'](_0x457d36[_0x9216('0x2e')][_0x9216('0x18')]);}_0x9798fe[_0x9216('0x37')]=qs[_0x9216('0x38')](_0x457d36[_0x9216('0x2e')][_0x9216('0x38')]);_0x9798fe['where']=qs[_0x9216('0x30')](_[_0x9216('0x39')](_0x457d36[_0x9216('0x2e')],_0x1ee223['filters']),_0x2de8c2);if(_0x457d36['query']['filter']){_0x9798fe[_0x9216('0x3a')]=_[_0x9216('0x3b')](_0x9798fe[_0x9216('0x3a')],{'$or':_['map'](_0x2de8c2,function(_0x37ef92){if(_0x37ef92['type']!==_0x9216('0x3c')){var _0x40057f={};_0x40057f[_0x37ef92['name']]={'$like':'%'+_0x457d36[_0x9216('0x2e')][_0x9216('0x3d')]+'%'};return _0x40057f;}})});}_0x9798fe=_['merge']({},_0x9798fe,_0x457d36[_0x9216('0x3e')]);var _0x385d6e={'where':_0x9798fe[_0x9216('0x3a')]};return db[_0x9216('0x29')][_0x9216('0x1b')](_0x385d6e)[_0x9216('0x22')](function(_0x7f8574){_0x5a37b0[_0x9216('0x1b')]=_0x7f8574;if(_0x457d36[_0x9216('0x2e')]['includeAll']){_0x9798fe[_0x9216('0x3f')]=[{'all':!![]}];}return db[_0x9216('0x29')][_0x9216('0x40')](_0x9798fe);})['then'](function(_0x347283){_0x5a37b0[_0x9216('0x41')]=_0x347283;return _0x5a37b0;})[_0x9216('0x22')](respondWithFilteredResult(_0x5c1928,_0x9798fe))[_0x9216('0x42')](handleError(_0x5c1928,null));};exports['show']=function(_0x338061,_0xecb901){var _0x437a63={'raw':!![],'where':{'id':_0x338061[_0x9216('0x43')]['id']}},_0x1bbba7={};_0x1bbba7['model']=_[_0x9216('0x2f')](db[_0x9216('0x29')][_0x9216('0x2a')]);_0x1bbba7[_0x9216('0x2e')]=_['keys'](_0x338061[_0x9216('0x2e')]);_0x1bbba7[_0x9216('0x30')]=_['intersection'](_0x1bbba7[_0x9216('0x2d')],_0x1bbba7[_0x9216('0x2e')]);_0x437a63[_0x9216('0x32')]=_[_0x9216('0x31')](_0x1bbba7['model'],qs['fields'](_0x338061[_0x9216('0x2e')]['fields']));_0x437a63[_0x9216('0x32')]=_0x437a63[_0x9216('0x32')][_0x9216('0x34')]?_0x437a63[_0x9216('0x32')]:_0x1bbba7['model'];if(_0x338061[_0x9216('0x2e')][_0x9216('0x44')]){_0x437a63[_0x9216('0x3f')]=[{'all':!![]}];}_0x437a63=_[_0x9216('0x3b')]({},_0x437a63,_0x338061[_0x9216('0x3e')]);return db[_0x9216('0x29')][_0x9216('0x45')](_0x437a63)[_0x9216('0x22')](handleEntityNotFound(_0xecb901,null))['then'](respondWithResult(_0xecb901,null))[_0x9216('0x42')](handleError(_0xecb901,null));};exports[_0x9216('0x46')]=function(_0x49d6f9,_0x2e19f9){return db['FreshsalesField'][_0x9216('0x46')](_0x49d6f9['body'],{})[_0x9216('0x22')](respondWithResult(_0x2e19f9,0xc9))[_0x9216('0x42')](handleError(_0x2e19f9,null));};exports[_0x9216('0x21')]=function(_0x11ccb8,_0x43682a){if(_0x11ccb8[_0x9216('0x47')]['id']){delete _0x11ccb8[_0x9216('0x47')]['id'];}return db['FreshsalesField'][_0x9216('0x45')]({'where':{'id':_0x11ccb8['params']['id']}})[_0x9216('0x22')](handleEntityNotFound(_0x43682a,null))['then'](saveUpdates(_0x11ccb8[_0x9216('0x47')],null))[_0x9216('0x22')](respondWithResult(_0x43682a,null))[_0x9216('0x42')](handleError(_0x43682a,null));};exports[_0x9216('0x23')]=function(_0x4b4d98,_0x32718e){return db['FreshsalesField'][_0x9216('0x45')]({'where':{'id':_0x4b4d98[_0x9216('0x43')]['id']}})['then'](handleEntityNotFound(_0x32718e,null))[_0x9216('0x22')](removeEntity(_0x32718e,null))[_0x9216('0x42')](handleError(_0x32718e,null));}; \ No newline at end of file +var _0xfe64=['apply','reject','save','destroy','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesField','includeAll','include','rows','show','params','length','find','catch','create','update','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range'];(function(_0x279ab1,_0x527374){var _0x8ba87c=function(_0x2c0898){while(--_0x2c0898){_0x279ab1['push'](_0x279ab1['shift']());}};_0x8ba87c(++_0x527374);}(_0xfe64,0x1b2));var _0x4fe6=function(_0x1ac8b1,_0x3690ce){_0x1ac8b1=_0x1ac8b1-0x0;var _0x31412d=_0xfe64[_0x1ac8b1];return _0x31412d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4fe6('0x0'));var rp=require(_0x4fe6('0x1'));var moment=require(_0x4fe6('0x2'));var BPromise=require(_0x4fe6('0x3'));var Mustache=require(_0x4fe6('0x4'));var util=require(_0x4fe6('0x5'));var path=require(_0x4fe6('0x6'));var sox=require(_0x4fe6('0x7'));var csv=require(_0x4fe6('0x8'));var ejs=require(_0x4fe6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4fe6('0xa'));var squel=require(_0x4fe6('0xb'));var crypto=require(_0x4fe6('0xc'));var jsforce=require(_0x4fe6('0xd'));var deskjs=require(_0x4fe6('0xe'));var toCsv=require(_0x4fe6('0x8'));var querystring=require(_0x4fe6('0xf'));var Papa=require(_0x4fe6('0x10'));var Redis=require(_0x4fe6('0x11'));var authService=require(_0x4fe6('0x12'));var qs=require(_0x4fe6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fe6('0x14'));var logger=require(_0x4fe6('0x15'))('api');var utils=require(_0x4fe6('0x16'));var config=require(_0x4fe6('0x17'));var licenseUtil=require(_0x4fe6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x357d56,_0x408157){_0x408157=_0x408157||0xcc;return function(_0x294838){if(_0x294838){return _0x357d56[_0x4fe6('0x19')](_0x408157);}return _0x357d56['status'](_0x408157)['end']();};}function respondWithResult(_0xaafd4e,_0x2fd7b2){_0x2fd7b2=_0x2fd7b2||0xc8;return function(_0x42a60c){if(_0x42a60c){return _0xaafd4e['status'](_0x2fd7b2)[_0x4fe6('0x1a')](_0x42a60c);}};}function respondWithFilteredResult(_0x48daac,_0x20de44){return function(_0x1a6903){if(_0x1a6903){var _0x1f5ac8=typeof _0x20de44[_0x4fe6('0x1b')]==='undefined'&&typeof _0x20de44['limit']===_0x4fe6('0x1c');var _0x42e8d2=_0x1a6903[_0x4fe6('0x1d')];var _0x477ea6=_0x1f5ac8?0x0:_0x20de44[_0x4fe6('0x1b')];var _0xf40b5b=_0x1f5ac8?_0x1a6903[_0x4fe6('0x1d')]:_0x20de44[_0x4fe6('0x1b')]+_0x20de44[_0x4fe6('0x1e')];var _0x5a6026;if(_0xf40b5b>=_0x42e8d2){_0xf40b5b=_0x42e8d2;_0x5a6026=0xc8;}else{_0x5a6026=0xce;}_0x48daac[_0x4fe6('0x1f')](_0x5a6026);return _0x48daac[_0x4fe6('0x20')](_0x4fe6('0x21'),_0x477ea6+'-'+_0xf40b5b+'/'+_0x42e8d2)[_0x4fe6('0x1a')](_0x1a6903);}return null;};}function patchUpdates(_0x30c36f){return function(_0x40fac0){try{jsonpatch[_0x4fe6('0x22')](_0x40fac0,_0x30c36f,!![]);}catch(_0x9ac79f){return BPromise[_0x4fe6('0x23')](_0x9ac79f);}return _0x40fac0[_0x4fe6('0x24')]();};}function saveUpdates(_0x5df4fd,_0x266c01){return function(_0x299b7d){if(_0x299b7d){return _0x299b7d['update'](_0x5df4fd)['then'](function(_0x3ccd13){return _0x3ccd13;});}return null;};}function removeEntity(_0x1f03a5,_0x59930e){return function(_0x75b6a3){if(_0x75b6a3){return _0x75b6a3[_0x4fe6('0x25')]()[_0x4fe6('0x26')](function(){_0x1f03a5[_0x4fe6('0x1f')](0xcc)[_0x4fe6('0x27')]();});}};}function handleEntityNotFound(_0x23f2a3,_0x40a28b){return function(_0x565710){if(!_0x565710){_0x23f2a3['sendStatus'](0x194);}return _0x565710;};}function handleError(_0x556063,_0x273297){_0x273297=_0x273297||0x1f4;return function(_0x5e8d1c){logger[_0x4fe6('0x28')](_0x5e8d1c[_0x4fe6('0x29')]);if(_0x5e8d1c[_0x4fe6('0x2a')]){delete _0x5e8d1c['name'];}_0x556063['status'](_0x273297)['send'](_0x5e8d1c);};}exports[_0x4fe6('0x2b')]=function(_0x325ebf,_0xc77b7e){var _0x5be262={},_0x540709={},_0x5af6d8={'count':0x0,'rows':[]};var _0xafe70=_[_0x4fe6('0x2c')](db['FreshsalesField'][_0x4fe6('0x2d')],function(_0x40b9ad){return{'name':_0x40b9ad[_0x4fe6('0x2e')],'type':_0x40b9ad[_0x4fe6('0x2f')][_0x4fe6('0x30')]};});_0x540709[_0x4fe6('0x31')]=_[_0x4fe6('0x2c')](_0xafe70,_0x4fe6('0x2a'));_0x540709['query']=_[_0x4fe6('0x32')](_0x325ebf[_0x4fe6('0x33')]);_0x540709[_0x4fe6('0x34')]=_['intersection'](_0x540709[_0x4fe6('0x31')],_0x540709['query']);_0x5be262[_0x4fe6('0x35')]=_[_0x4fe6('0x36')](_0x540709['model'],qs[_0x4fe6('0x37')](_0x325ebf[_0x4fe6('0x33')]['fields']));_0x5be262[_0x4fe6('0x35')]=_0x5be262[_0x4fe6('0x35')]['length']?_0x5be262[_0x4fe6('0x35')]:_0x540709[_0x4fe6('0x31')];if(!_0x325ebf[_0x4fe6('0x33')][_0x4fe6('0x38')](_0x4fe6('0x39'))){_0x5be262[_0x4fe6('0x1e')]=qs[_0x4fe6('0x1e')](_0x325ebf['query'][_0x4fe6('0x1e')]);_0x5be262[_0x4fe6('0x1b')]=qs[_0x4fe6('0x1b')](_0x325ebf[_0x4fe6('0x33')][_0x4fe6('0x1b')]);}_0x5be262[_0x4fe6('0x3a')]=qs[_0x4fe6('0x3b')](_0x325ebf[_0x4fe6('0x33')]['sort']);_0x5be262[_0x4fe6('0x3c')]=qs['filters'](_[_0x4fe6('0x3d')](_0x325ebf[_0x4fe6('0x33')],_0x540709[_0x4fe6('0x34')]),_0xafe70);if(_0x325ebf[_0x4fe6('0x33')][_0x4fe6('0x3e')]){_0x5be262['where']=_[_0x4fe6('0x3f')](_0x5be262[_0x4fe6('0x3c')],{'$or':_['map'](_0xafe70,function(_0x1c429c){if(_0x1c429c['type']!==_0x4fe6('0x40')){var _0x563c23={};_0x563c23[_0x1c429c[_0x4fe6('0x2a')]]={'$like':'%'+_0x325ebf[_0x4fe6('0x33')][_0x4fe6('0x3e')]+'%'};return _0x563c23;}})});}_0x5be262=_[_0x4fe6('0x3f')]({},_0x5be262,_0x325ebf[_0x4fe6('0x41')]);var _0x375d87={'where':_0x5be262[_0x4fe6('0x3c')]};return db[_0x4fe6('0x42')][_0x4fe6('0x1d')](_0x375d87)[_0x4fe6('0x26')](function(_0x3b2821){_0x5af6d8[_0x4fe6('0x1d')]=_0x3b2821;if(_0x325ebf[_0x4fe6('0x33')][_0x4fe6('0x43')]){_0x5be262[_0x4fe6('0x44')]=[{'all':!![]}];}return db[_0x4fe6('0x42')]['findAll'](_0x5be262);})[_0x4fe6('0x26')](function(_0x54e30e){_0x5af6d8[_0x4fe6('0x45')]=_0x54e30e;return _0x5af6d8;})[_0x4fe6('0x26')](respondWithFilteredResult(_0xc77b7e,_0x5be262))['catch'](handleError(_0xc77b7e,null));};exports[_0x4fe6('0x46')]=function(_0x149cde,_0x281dee){var _0x7cf8ad={'raw':!![],'where':{'id':_0x149cde[_0x4fe6('0x47')]['id']}},_0x637507={};_0x637507['model']=_['keys'](db[_0x4fe6('0x42')][_0x4fe6('0x2d')]);_0x637507[_0x4fe6('0x33')]=_['keys'](_0x149cde[_0x4fe6('0x33')]);_0x637507[_0x4fe6('0x34')]=_['intersection'](_0x637507[_0x4fe6('0x31')],_0x637507[_0x4fe6('0x33')]);_0x7cf8ad[_0x4fe6('0x35')]=_['intersection'](_0x637507[_0x4fe6('0x31')],qs[_0x4fe6('0x37')](_0x149cde[_0x4fe6('0x33')][_0x4fe6('0x37')]));_0x7cf8ad[_0x4fe6('0x35')]=_0x7cf8ad[_0x4fe6('0x35')][_0x4fe6('0x48')]?_0x7cf8ad['attributes']:_0x637507[_0x4fe6('0x31')];if(_0x149cde['query'][_0x4fe6('0x43')]){_0x7cf8ad[_0x4fe6('0x44')]=[{'all':!![]}];}_0x7cf8ad=_[_0x4fe6('0x3f')]({},_0x7cf8ad,_0x149cde[_0x4fe6('0x41')]);return db[_0x4fe6('0x42')][_0x4fe6('0x49')](_0x7cf8ad)[_0x4fe6('0x26')](handleEntityNotFound(_0x281dee,null))[_0x4fe6('0x26')](respondWithResult(_0x281dee,null))[_0x4fe6('0x4a')](handleError(_0x281dee,null));};exports[_0x4fe6('0x4b')]=function(_0x37c41d,_0x160da9){return db[_0x4fe6('0x42')]['create'](_0x37c41d['body'],{})[_0x4fe6('0x26')](respondWithResult(_0x160da9,0xc9))[_0x4fe6('0x4a')](handleError(_0x160da9,null));};exports[_0x4fe6('0x4c')]=function(_0x2db82c,_0x4e0043){if(_0x2db82c[_0x4fe6('0x4d')]['id']){delete _0x2db82c['body']['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x2db82c['params']['id']}})['then'](handleEntityNotFound(_0x4e0043,null))['then'](saveUpdates(_0x2db82c[_0x4fe6('0x4d')],null))[_0x4fe6('0x26')](respondWithResult(_0x4e0043,null))['catch'](handleError(_0x4e0043,null));};exports[_0x4fe6('0x25')]=function(_0x4e71d0,_0x4202c4){return db['FreshsalesField']['find']({'where':{'id':_0x4e71d0['params']['id']}})[_0x4fe6('0x26')](handleEntityNotFound(_0x4202c4,null))[_0x4fe6('0x26')](removeEntity(_0x4202c4,null))['catch'](handleError(_0x4202c4,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index ac84df3..49ac0e0 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 _0x2ff5=['../../config/environment','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1694db,_0x589587){var _0x488a1f=function(_0x3247e3){while(--_0x3247e3){_0x1694db['push'](_0x1694db['shift']());}};_0x488a1f(++_0x589587);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x215950,_0x1378b1){_0x215950=_0x215950-0x0;var _0x2fea0d=_0x2ff5[_0x215950];return _0x2fea0d;};'use strict';var _=require('lodash');var util=require(_0x52ff('0x0'));var logger=require(_0x52ff('0x1'))('api');var moment=require(_0x52ff('0x2'));var BPromise=require(_0x52ff('0x3'));var rp=require(_0x52ff('0x4'));var fs=require('fs');var path=require(_0x52ff('0x5'));var rimraf=require(_0x52ff('0x6'));var config=require(_0x52ff('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0x52ff('0x8')]=function(_0x285f60,_0x26906c){return _0x285f60['define'](_0x52ff('0x9'),attributes,{'tableName':_0x52ff('0xa'),'paranoid':![],'indexes':[{'name':_0x52ff('0xb'),'fields':[_0x52ff('0xc'),_0x52ff('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xef0a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x44a1e9,_0x347c0c){var _0x3994d7=function(_0xf7a450){while(--_0xf7a450){_0x44a1e9['push'](_0x44a1e9['shift']());}};_0x3994d7(++_0x347c0c);}(_0xef0a,0xdd));var _0xaef0=function(_0x1e2163,_0xd42fd4){_0x1e2163=_0x1e2163-0x0;var _0x625b6d=_0xef0a[_0x1e2163];return _0x625b6d;};'use strict';var _=require(_0xaef0('0x0'));var util=require(_0xaef0('0x1'));var logger=require(_0xaef0('0x2'))(_0xaef0('0x3'));var moment=require(_0xaef0('0x4'));var BPromise=require(_0xaef0('0x5'));var rp=require(_0xaef0('0x6'));var fs=require('fs');var path=require(_0xaef0('0x7'));var rimraf=require(_0xaef0('0x8'));var config=require(_0xaef0('0x9'));var attributes=require(_0xaef0('0xa'));module['exports']=function(_0x32868a,_0x12dd17){return _0x32868a[_0xaef0('0xb')](_0xaef0('0xc'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xaef0('0xd'),_0xaef0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 8a09daa..4686c1c 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd51=['FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x2dc2be,_0x2ca201){_0x2dc2be=_0x2dc2be-0x0;var _0x464e97=_0xbd51[_0x2dc2be];return _0x464e97;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){return client['request'](_0x29abea,_0x19077c)[_0x1bd5('0x8')](function(_0x5c8e0d){logger[_0x1bd5('0x9')](_0x1bd5('0xa'),_0x30a385,_0x1bd5('0xb'));logger[_0x1bd5('0xc')](_0x1bd5('0xd'),_0x30a385,_0x1bd5('0xb'),JSON['stringify'](_0x5c8e0d));if(_0x5c8e0d[_0x1bd5('0xe')]){if(_0x5c8e0d['error'][_0x1bd5('0xf')]===0x1f4){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0xd8418f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0x27d58f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x1bd5('0xb'));_0x27d58f(_0x5c8e0d[_0x1bd5('0x11')][_0x1bd5('0x10')]);}})[_0x1bd5('0x12')](function(_0x43ea3e){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x43ea3e);_0xd8418f(_0x43ea3e);});});} \ No newline at end of file +var _0xbd51=['FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3b724b,_0x1b6bbc){_0x3b724b=_0x3b724b-0x0;var _0x446c69=_0xbd51[_0x3b724b];return _0x446c69;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var moment=require(_0x1bd5('0x1'));var BPromise=require(_0x1bd5('0x2'));var rs=require(_0x1bd5('0x3'));var fs=require('fs');var Redis=require(_0x1bd5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1bd5('0x5'));var jayson=require(_0x1bd5('0x6'));var client=jayson[_0x1bd5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29abea,_0x30a385,_0x19077c){return new BPromise(function(_0x27d58f,_0xd8418f){return client['request'](_0x29abea,_0x19077c)[_0x1bd5('0x8')](function(_0x5c8e0d){logger[_0x1bd5('0x9')](_0x1bd5('0xa'),_0x30a385,_0x1bd5('0xb'));logger[_0x1bd5('0xc')](_0x1bd5('0xd'),_0x30a385,_0x1bd5('0xb'),JSON['stringify'](_0x5c8e0d));if(_0x5c8e0d[_0x1bd5('0xe')]){if(_0x5c8e0d['error'][_0x1bd5('0xf')]===0x1f4){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0xd8418f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);return _0x27d58f(_0x5c8e0d[_0x1bd5('0xe')][_0x1bd5('0x10')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x30a385,_0x1bd5('0xb'));_0x27d58f(_0x5c8e0d[_0x1bd5('0x11')][_0x1bd5('0x10')]);}})[_0x1bd5('0x12')](function(_0x43ea3e){logger[_0x1bd5('0xe')](_0x1bd5('0xa'),_0x30a385,_0x43ea3e);_0xd8418f(_0x43ea3e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 9f0f092..93b3be6 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x2c40b1,_0xb58d65){var _0x596aa9=function(_0xf363cf){while(--_0xf363cf){_0x2c40b1['push'](_0x2c40b1['shift']());}};_0x596aa9(++_0xb58d65);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1446cb,_0x1f50e6){var _0x4778eb=function(_0x489532){while(--_0x489532){_0x1446cb['push'](_0x1446cb['shift']());}};_0x4778eb(++_0x1f50e6);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index a13d26b..9da3094 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 _0xb78e=['integrationTab','newTab','sequelize','exports','STRING','username','ENUM'];(function(_0x1452ac,_0x960b27){var _0x3d0060=function(_0x48de7b){while(--_0x48de7b){_0x1452ac['push'](_0x1452ac['shift']());}};_0x3d0060(++_0x960b27);}(_0xb78e,0x1c9));var _0xeb78=function(_0x5704d7,_0x5ef2c3){_0x5704d7=_0x5704d7-0x0;var _0x2f5331=_0xb78e[_0x5704d7];return _0x2f5331;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb78('0x2')]},'username':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x3')},'remoteUri':{'type':Sequelize[_0xeb78('0x2')]},'password':{'type':Sequelize[_0xeb78('0x2')]},'clientId':{'type':Sequelize[_0xeb78('0x2')]},'clientSecret':{'type':Sequelize[_0xeb78('0x2')]},'securityToken':{'type':Sequelize[_0xeb78('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xeb78('0x4')](_0xeb78('0x5'),_0xeb78('0x6')),'defaultValue':_0xeb78('0x5')}}; \ No newline at end of file +var _0x5f2f=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0xca65c1,_0x3c696e){var _0x3d6b12=function(_0x3c288d){while(--_0x3c288d){_0xca65c1['push'](_0xca65c1['shift']());}};_0x3d6b12(++_0x3c696e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5529b9,_0x38e5f6){_0x5529b9=_0x5529b9-0x0;var _0x21f543=_0x5f2f[_0x5529b9];return _0x21f543;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'name':{'type':Sequelize[_0xf5f2('0x2')]},'description':{'type':Sequelize[_0xf5f2('0x2')]},'username':{'type':Sequelize[_0xf5f2('0x2')],'unique':_0xf5f2('0x3')},'remoteUri':{'type':Sequelize[_0xf5f2('0x2')]},'password':{'type':Sequelize[_0xf5f2('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xf5f2('0x2')]},'serverUrl':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x4')](_0xf5f2('0x5'),_0xf5f2('0x6')),'defaultValue':_0xf5f2('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d5e7374..49e8b81 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 _0x48f4=['clientSecret','password','slice','substring','Connection','login','concat','securityToken','isNil','sobject','describe','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','includes','label','custom','picklistValues','value','True','true','False','false','statusCode','stringify','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','catch','create','body','update','find','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','Task','remoteUri','clientId'];(function(_0x267096,_0x549583){var _0x4c4847=function(_0x5a56f5){while(--_0x5a56f5){_0x267096['push'](_0x267096['shift']());}};_0x4c4847(++_0x549583);}(_0x48f4,0x9c));var _0x448f=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x48f4[_0x1602ef];return _0x5870ee;};'use strict';var emlformat=require(_0x448f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x448f('0x1'));var rp=require(_0x448f('0x2'));var moment=require(_0x448f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x448f('0x4'));var path=require(_0x448f('0x5'));var sox=require(_0x448f('0x6'));var csv=require(_0x448f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x448f('0x8'));var _=require('lodash');var squel=require(_0x448f('0x9'));var crypto=require('crypto');var jsforce=require(_0x448f('0xa'));var deskjs=require(_0x448f('0xb'));var toCsv=require(_0x448f('0x7'));var querystring=require('querystring');var Papa=require(_0x448f('0xc'));var Redis=require(_0x448f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x448f('0xe'));var as=require(_0x448f('0xf'));var hardwareService=require(_0x448f('0x10'));var logger=require(_0x448f('0x11'))(_0x448f('0x12'));var utils=require(_0x448f('0x13'));var config=require(_0x448f('0x14'));var licenseUtil=require(_0x448f('0x15'));var db=require(_0x448f('0x16'))['db'];var integrations=require(_0x448f('0x17'));function respondWithStatusCode(_0x16b942,_0x4bd142){_0x4bd142=_0x4bd142||0xcc;return function(_0x2cf3eb){if(_0x2cf3eb){return _0x16b942[_0x448f('0x18')](_0x4bd142);}return _0x16b942[_0x448f('0x19')](_0x4bd142)[_0x448f('0x1a')]();};}function respondWithResult(_0x5e7d88,_0x4bae0f){_0x4bae0f=_0x4bae0f||0xc8;return function(_0x1ae7ba){if(_0x1ae7ba){return _0x5e7d88[_0x448f('0x19')](_0x4bae0f)['json'](_0x1ae7ba);}};}function respondWithFilteredResult(_0x161d10,_0x37ff73){return function(_0x5a8443){if(_0x5a8443){var _0x11e2bf=typeof _0x37ff73['offset']==='undefined'&&typeof _0x37ff73[_0x448f('0x1b')]===_0x448f('0x1c');var _0x254b12=_0x5a8443[_0x448f('0x1d')];var _0x2382fe=_0x11e2bf?0x0:_0x37ff73[_0x448f('0x1e')];var _0x4b667e=_0x11e2bf?_0x5a8443[_0x448f('0x1d')]:_0x37ff73[_0x448f('0x1e')]+_0x37ff73['limit'];var _0x3e8d48;if(_0x4b667e>=_0x254b12){_0x4b667e=_0x254b12;_0x3e8d48=0xc8;}else{_0x3e8d48=0xce;}_0x161d10[_0x448f('0x19')](_0x3e8d48);return _0x161d10[_0x448f('0x1f')](_0x448f('0x20'),_0x2382fe+'-'+_0x4b667e+'/'+_0x254b12)[_0x448f('0x21')](_0x5a8443);}return null;};}function patchUpdates(_0x1205ae){return function(_0x1526bc){try{jsonpatch[_0x448f('0x22')](_0x1526bc,_0x1205ae,!![]);}catch(_0x2c6c1c){return BPromise['reject'](_0x2c6c1c);}return _0x1526bc[_0x448f('0x23')]();};}function saveUpdates(_0x1a0ed9,_0x5ea365){return function(_0x3d90eb){if(_0x3d90eb){return _0x3d90eb['update'](_0x1a0ed9)[_0x448f('0x24')](function(_0x4a06ba){return _0x4a06ba;});}return null;};}function removeEntity(_0x36142a,_0x417b64){return function(_0x2ac526){if(_0x2ac526){return _0x2ac526[_0x448f('0x25')]()[_0x448f('0x24')](function(){_0x36142a[_0x448f('0x19')](0xcc)[_0x448f('0x1a')]();});}};}function handleEntityNotFound(_0x24b062,_0xb8303d){return function(_0x30fd7a){if(!_0x30fd7a){_0x24b062['sendStatus'](0x194);}return _0x30fd7a;};}function handleError(_0x5a46f0,_0x57bee4){_0x57bee4=_0x57bee4||0x1f4;return function(_0xe1a418){logger[_0x448f('0x26')](_0xe1a418[_0x448f('0x27')]);if(_0xe1a418['name']){delete _0xe1a418[_0x448f('0x28')];}_0x5a46f0[_0x448f('0x19')](_0x57bee4)[_0x448f('0x29')](_0xe1a418);};}exports[_0x448f('0x2a')]=function(_0xe55692,_0x2c3958){var _0x220e8e={},_0x70a041={},_0x4475d8={'count':0x0,'rows':[]};var _0xd4662e=_[_0x448f('0x2b')](db[_0x448f('0x2c')][_0x448f('0x2d')],function(_0x130386){return{'name':_0x130386[_0x448f('0x2e')],'type':_0x130386['type'][_0x448f('0x2f')]};});_0x70a041[_0x448f('0x30')]=_[_0x448f('0x2b')](_0xd4662e,_0x448f('0x28'));_0x70a041[_0x448f('0x31')]=_[_0x448f('0x32')](_0xe55692[_0x448f('0x31')]);_0x70a041[_0x448f('0x33')]=_[_0x448f('0x34')](_0x70a041[_0x448f('0x30')],_0x70a041['query']);_0x220e8e['attributes']=_[_0x448f('0x34')](_0x70a041[_0x448f('0x30')],qs[_0x448f('0x35')](_0xe55692[_0x448f('0x31')]['fields']));_0x220e8e[_0x448f('0x36')]=_0x220e8e[_0x448f('0x36')][_0x448f('0x37')]?_0x220e8e[_0x448f('0x36')]:_0x70a041['model'];if(!_0xe55692[_0x448f('0x31')][_0x448f('0x38')](_0x448f('0x39'))){_0x220e8e[_0x448f('0x1b')]=qs[_0x448f('0x1b')](_0xe55692[_0x448f('0x31')][_0x448f('0x1b')]);_0x220e8e['offset']=qs[_0x448f('0x1e')](_0xe55692[_0x448f('0x31')][_0x448f('0x1e')]);}_0x220e8e[_0x448f('0x3a')]=qs[_0x448f('0x3b')](_0xe55692[_0x448f('0x31')][_0x448f('0x3b')]);_0x220e8e[_0x448f('0x3c')]=qs[_0x448f('0x33')](_[_0x448f('0x3d')](_0xe55692[_0x448f('0x31')],_0x70a041['filters']),_0xd4662e);if(_0xe55692[_0x448f('0x31')][_0x448f('0x3e')]){_0x220e8e[_0x448f('0x3c')]=_[_0x448f('0x3f')](_0x220e8e['where'],{'$or':_[_0x448f('0x2b')](_0xd4662e,function(_0x1886d0){if(_0x1886d0[_0x448f('0x40')]!==_0x448f('0x41')){var _0x5854e9={};_0x5854e9[_0x1886d0[_0x448f('0x28')]]={'$like':'%'+_0xe55692[_0x448f('0x31')][_0x448f('0x3e')]+'%'};return _0x5854e9;}})});}_0x220e8e=_[_0x448f('0x3f')]({},_0x220e8e,_0xe55692[_0x448f('0x42')]);var _0x38f208={'where':_0x220e8e['where']};return db[_0x448f('0x2c')][_0x448f('0x1d')](_0x38f208)[_0x448f('0x24')](function(_0x5f713b){_0x4475d8[_0x448f('0x1d')]=_0x5f713b;if(_0xe55692[_0x448f('0x31')][_0x448f('0x43')]){_0x220e8e[_0x448f('0x44')]=[{'all':!![]}];}return db[_0x448f('0x2c')]['findAll'](_0x220e8e);})[_0x448f('0x24')](function(_0x42e658){_0x4475d8[_0x448f('0x45')]=_0x42e658;return _0x4475d8;})[_0x448f('0x24')](respondWithFilteredResult(_0x2c3958,_0x220e8e))['catch'](handleError(_0x2c3958,null));};exports[_0x448f('0x46')]=function(_0x228204,_0x5d519e){var _0x1d1f98={'raw':![],'where':{'id':_0x228204[_0x448f('0x47')]['id']}},_0x4bff03={};_0x4bff03[_0x448f('0x30')]=_['keys'](db[_0x448f('0x2c')][_0x448f('0x2d')]);_0x4bff03[_0x448f('0x31')]=_[_0x448f('0x32')](_0x228204[_0x448f('0x31')]);_0x4bff03[_0x448f('0x33')]=_[_0x448f('0x34')](_0x4bff03[_0x448f('0x30')],_0x4bff03['query']);_0x1d1f98[_0x448f('0x36')]=_[_0x448f('0x34')](_0x4bff03[_0x448f('0x30')],qs[_0x448f('0x35')](_0x228204[_0x448f('0x31')]['fields']));_0x1d1f98[_0x448f('0x36')]=_0x1d1f98[_0x448f('0x36')][_0x448f('0x37')]?_0x1d1f98[_0x448f('0x36')]:_0x4bff03['model'];if(_0x228204[_0x448f('0x31')][_0x448f('0x43')]){_0x1d1f98[_0x448f('0x44')]=[{'all':!![]}];}_0x1d1f98=_[_0x448f('0x3f')]({},_0x1d1f98,_0x228204['options']);return db[_0x448f('0x2c')]['find'](_0x1d1f98)['then'](handleEntityNotFound(_0x5d519e,null))[_0x448f('0x24')](respondWithResult(_0x5d519e,null))[_0x448f('0x48')](handleError(_0x5d519e,null));};exports[_0x448f('0x49')]=function(_0x2aa7a8,_0x554939){return db[_0x448f('0x2c')][_0x448f('0x49')](_0x2aa7a8[_0x448f('0x4a')],{})[_0x448f('0x24')](respondWithResult(_0x554939,0xc9))['catch'](handleError(_0x554939,null));};exports[_0x448f('0x4b')]=function(_0xfc45a1,_0x56a966){if(_0xfc45a1[_0x448f('0x4a')]['id']){delete _0xfc45a1['body']['id'];}return db[_0x448f('0x2c')][_0x448f('0x4c')]({'where':{'id':_0xfc45a1[_0x448f('0x47')]['id']}})[_0x448f('0x24')](handleEntityNotFound(_0x56a966,null))[_0x448f('0x24')](saveUpdates(_0xfc45a1[_0x448f('0x4a')],null))[_0x448f('0x24')](respondWithResult(_0x56a966,null))[_0x448f('0x48')](handleError(_0x56a966,null));};exports[_0x448f('0x25')]=function(_0x5aed5b,_0x35534b){return db['SalesforceAccount'][_0x448f('0x4c')]({'where':{'id':_0x5aed5b[_0x448f('0x47')]['id']}})[_0x448f('0x24')](handleEntityNotFound(_0x35534b,null))['then'](removeEntity(_0x35534b,null))[_0x448f('0x48')](handleError(_0x35534b,null));};exports[_0x448f('0x4d')]=function(_0x169af3,_0x1d3dc0,_0x45e04b){var _0x51b06f={};var _0x2f807e={};var _0xaa36f4;var _0xdf7612;return db[_0x448f('0x2c')][_0x448f('0x4e')]({'where':{'id':_0x169af3[_0x448f('0x47')]['id']}})[_0x448f('0x24')](handleEntityNotFound(_0x1d3dc0,null))[_0x448f('0x24')](function(_0x16b065){if(_0x16b065){_0xaa36f4=_0x16b065;_0x2f807e[_0x448f('0x30')]=_[_0x448f('0x32')](db[_0x448f('0x4f')][_0x448f('0x2d')]);_0x2f807e[_0x448f('0x31')]=_[_0x448f('0x32')](_0x169af3['query']);_0x2f807e[_0x448f('0x33')]=_[_0x448f('0x34')](_0x2f807e[_0x448f('0x30')],_0x2f807e[_0x448f('0x31')]);_0x51b06f['attributes']=_['intersection'](_0x2f807e[_0x448f('0x30')],qs[_0x448f('0x35')](_0x169af3['query'][_0x448f('0x35')]));_0x51b06f[_0x448f('0x36')]=_0x51b06f[_0x448f('0x36')][_0x448f('0x37')]?_0x51b06f[_0x448f('0x36')]:_0x2f807e[_0x448f('0x30')];_0x51b06f['order']=qs[_0x448f('0x3b')](_0x169af3[_0x448f('0x31')][_0x448f('0x3b')]);_0x51b06f[_0x448f('0x3c')]=qs[_0x448f('0x33')](_[_0x448f('0x3d')](_0x169af3['query'],_0x2f807e[_0x448f('0x33')]));if(_0x169af3[_0x448f('0x31')]['filter']){_0x51b06f['where']=_[_0x448f('0x3f')](_0x51b06f[_0x448f('0x3c')],{'$or':_[_0x448f('0x2b')](_0x51b06f[_0x448f('0x36')],function(_0x59a02a){var _0x1447d5={};_0x1447d5[_0x59a02a]={'$like':'%'+_0x169af3['query'][_0x448f('0x3e')]+'%'};return _0x1447d5;})});}_0x51b06f=_[_0x448f('0x3f')]({},_0x51b06f,_0x169af3['options']);return _0xaa36f4[_0x448f('0x4d')](_0x51b06f);}})[_0x448f('0x24')](function(_0x4a8f68){if(_0x4a8f68){_0xdf7612=_0x4a8f68['length'];if(!_0x169af3['query']['hasOwnProperty'](_0x448f('0x39'))){_0x51b06f[_0x448f('0x1b')]=qs[_0x448f('0x1b')](_0x169af3['query'][_0x448f('0x1b')]);_0x51b06f[_0x448f('0x1e')]=qs[_0x448f('0x1e')](_0x169af3[_0x448f('0x31')][_0x448f('0x1e')]);}return _0xaa36f4[_0x448f('0x4d')](_0x51b06f);}})[_0x448f('0x24')](function(_0x49ed10){if(_0x49ed10){return _0x49ed10?{'count':_0xdf7612,'rows':_0x49ed10}:null;}})[_0x448f('0x24')](respondWithResult(_0x1d3dc0,null))[_0x448f('0x48')](handleError(_0x1d3dc0,null));};exports[_0x448f('0x50')]=function(_0x20d844,_0x3cf608,_0x3f429b){if(_0x20d844[_0x448f('0x4a')]['id']){delete _0x20d844['body']['id'];}return db[_0x448f('0x2c')][_0x448f('0x4e')]({'where':{'id':_0x20d844[_0x448f('0x47')]['id']}})[_0x448f('0x24')](handleEntityNotFound(_0x3cf608,null))[_0x448f('0x24')](function(_0x5d2528){if(_0x5d2528){_0x20d844[_0x448f('0x4a')][_0x448f('0x51')]=_0x5d2528['id'];_0x20d844[_0x448f('0x4a')][_0x448f('0x52')]=integrations[_0x448f('0x53')](_0x20d844['body'][_0x448f('0x54')],_0x20d844[_0x448f('0x4a')][_0x448f('0x40')]);_0x20d844['body'][_0x448f('0x55')]=integrations['getDescriptions'](_0x20d844[_0x448f('0x4a')][_0x448f('0x54')],_0x20d844[_0x448f('0x4a')][_0x448f('0x40')]);return db[_0x448f('0x4f')]['create'](_0x20d844[_0x448f('0x4a')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x448f('0x55')}]});}return null;})[_0x448f('0x24')](respondWithResult(_0x3cf608,null))[_0x448f('0x48')](handleError(_0x3cf608,null));};exports[_0x448f('0x56')]=function(_0x183934,_0x49eaa2,_0x123208){var _0x5327d0;var _0x5de917='';var _0x3ff22a=_0x448f('0x57');return db['SalesforceAccount'][_0x448f('0x4e')]({'where':{'id':_0x183934[_0x448f('0x47')]['id']},'attributes':['id',_0x448f('0x58'),_0x448f('0x59'),_0x448f('0x5a'),'username',_0x448f('0x5b'),'securityToken']})[_0x448f('0x24')](handleEntityNotFound(_0x49eaa2,null))['then'](function(_0x362c99){if(_0x362c99){_0x5de917=_0x362c99['remoteUri'];var _0x250720=_0x5de917[_0x448f('0x5c')](-0x1);if(_0x250720==='/'){_0x5de917=_0x5de917[_0x448f('0x5d')](0x0,_0x5de917['lastIndexOf'](_0x250720));}_0x5327d0=new jsforce[(_0x448f('0x5e'))]({'oauth2':{'loginUrl':_0x5de917,'clientId':_0x362c99[_0x448f('0x59')],'clientSecret':_0x362c99[_0x448f('0x5a')]}});return _0x5327d0[_0x448f('0x5f')](_0x362c99['username'],_0x362c99[_0x448f('0x5b')][_0x448f('0x60')](_0x362c99[_0x448f('0x61')]));}})[_0x448f('0x24')](function(_0x330418){if(_0x330418){if(!_[_0x448f('0x62')](_0x183934[_0x448f('0x31')]['ticketType'])){_0x3ff22a=_0x183934['query']['ticketType'];}return _0x5327d0[_0x448f('0x63')](_0x3ff22a)[_0x448f('0x64')]();}})[_0x448f('0x24')](function(_0x414313){var _0xf14e56=['OwnerId','ActivityDate',_0x448f('0x65'),_0x448f('0x66'),_0x448f('0x67'),_0x448f('0x68')];var _0x47e4ca=[_0x448f('0x69'),_0x448f('0x6a'),_0x448f('0x6b'),_0x448f('0x6c'),_0x448f('0x6d'),_0x448f('0x6e'),_0x448f('0x6f')];if(_0x414313){_['remove'](_0x414313[_0x448f('0x35')],function(_0x5a42f4){return _0xf14e56[_0x448f('0x70')](_0x5a42f4['name'])||!_0x47e4ca[_0x448f('0x70')](_0x5a42f4[_0x448f('0x40')]);});return{'count':_0x414313[_0x448f('0x35')][_0x448f('0x37')],'rows':_[_0x448f('0x2b')](_0x414313[_0x448f('0x35')],function(_0x4949a4){return{'id':_0x4949a4[_0x448f('0x28')],'name':_0x4949a4[_0x448f('0x71')],'custom':_0x4949a4[_0x448f('0x72')],'options':_0x4949a4[_0x448f('0x73')]['length']>0x0?_[_0x448f('0x2b')](_0x4949a4[_0x448f('0x73')],function(_0x2a0020){return{'name':_0x2a0020['label'],'value':_0x2a0020[_0x448f('0x74')]};}):_0x4949a4[_0x448f('0x40')]==_0x448f('0x6c')?[{'name':_0x448f('0x75'),'value':_0x448f('0x76')},{'name':_0x448f('0x77'),'value':_0x448f('0x78')}]:[]};})};}})[_0x448f('0x24')](respondWithResult(_0x49eaa2,null))[_0x448f('0x48')](function(_0x2e5c6c){var _0x16b221=_0x183934[_0x448f('0x31')]['test']?0x1f4:_0x2e5c6c[_0x448f('0x79')]||0x1f4;logger[_0x448f('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x448f('0x56'),_0x16b221,JSON[_0x448f('0x7a')](_0x2e5c6c));delete _0x2e5c6c['name'];if(_0x16b221===0x191){_0x16b221=0x190;}_0x49eaa2['status'](_0x16b221)['send'](_0x183934['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x2e5c6c[_0x448f('0x79')]}:_0x2e5c6c);});}; \ No newline at end of file +var _0x255c=['password','securityToken','slice','lastIndexOf','login','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','True','false','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','SalesforceField','remoteUri','clientId','clientSecret','username'];(function(_0xe0e4f,_0x3ee66f){var _0x1e9be9=function(_0x548c0e){while(--_0x548c0e){_0xe0e4f['push'](_0xe0e4f['shift']());}};_0x1e9be9(++_0x3ee66f);}(_0x255c,0x117));var _0xc255=function(_0x204222,_0xe3f561){_0x204222=_0x204222-0x0;var _0x41fd7b=_0x255c[_0x204222];return _0x41fd7b;};'use strict';var emlformat=require(_0xc255('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc255('0x1'));var rp=require(_0xc255('0x2'));var moment=require(_0xc255('0x3'));var BPromise=require(_0xc255('0x4'));var Mustache=require(_0xc255('0x5'));var util=require(_0xc255('0x6'));var path=require(_0xc255('0x7'));var sox=require(_0xc255('0x8'));var csv=require(_0xc255('0x9'));var ejs=require(_0xc255('0xa'));var fs=require('fs');var fs_extra=require(_0xc255('0xb'));var _=require('lodash');var squel=require(_0xc255('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc255('0xd'));var toCsv=require(_0xc255('0x9'));var querystring=require(_0xc255('0xe'));var Papa=require(_0xc255('0xf'));var Redis=require('ioredis');var authService=require(_0xc255('0x10'));var qs=require(_0xc255('0x11'));var as=require(_0xc255('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc255('0x13'))(_0xc255('0x14'));var utils=require(_0xc255('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xc255('0x16'));function respondWithStatusCode(_0x13ba3d,_0x4e6155){_0x4e6155=_0x4e6155||0xcc;return function(_0x31c119){if(_0x31c119){return _0x13ba3d['sendStatus'](_0x4e6155);}return _0x13ba3d[_0xc255('0x17')](_0x4e6155)[_0xc255('0x18')]();};}function respondWithResult(_0x4a5285,_0x42bb5b){_0x42bb5b=_0x42bb5b||0xc8;return function(_0x92f8aa){if(_0x92f8aa){return _0x4a5285[_0xc255('0x17')](_0x42bb5b)['json'](_0x92f8aa);}};}function respondWithFilteredResult(_0x1d580b,_0x2eda4f){return function(_0xb3c696){if(_0xb3c696){var _0x31e296=typeof _0x2eda4f[_0xc255('0x19')]===_0xc255('0x1a')&&typeof _0x2eda4f[_0xc255('0x1b')]===_0xc255('0x1a');var _0x236f78=_0xb3c696[_0xc255('0x1c')];var _0x2bcdd9=_0x31e296?0x0:_0x2eda4f['offset'];var _0x27fe9c=_0x31e296?_0xb3c696[_0xc255('0x1c')]:_0x2eda4f[_0xc255('0x19')]+_0x2eda4f[_0xc255('0x1b')];var _0x4c70cb;if(_0x27fe9c>=_0x236f78){_0x27fe9c=_0x236f78;_0x4c70cb=0xc8;}else{_0x4c70cb=0xce;}_0x1d580b[_0xc255('0x17')](_0x4c70cb);return _0x1d580b[_0xc255('0x1d')](_0xc255('0x1e'),_0x2bcdd9+'-'+_0x27fe9c+'/'+_0x236f78)['json'](_0xb3c696);}return null;};}function patchUpdates(_0xa2c9f1){return function(_0x7cc7e4){try{jsonpatch['apply'](_0x7cc7e4,_0xa2c9f1,!![]);}catch(_0xf854fc){return BPromise[_0xc255('0x1f')](_0xf854fc);}return _0x7cc7e4[_0xc255('0x20')]();};}function saveUpdates(_0x2c3af7,_0xdf6ca1){return function(_0x52dea9){if(_0x52dea9){return _0x52dea9[_0xc255('0x21')](_0x2c3af7)['then'](function(_0x44e21d){return _0x44e21d;});}return null;};}function removeEntity(_0x4d6fd2,_0x63ccf1){return function(_0x341d6d){if(_0x341d6d){return _0x341d6d[_0xc255('0x22')]()[_0xc255('0x23')](function(){_0x4d6fd2[_0xc255('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44b68d,_0x554e39){return function(_0x4dace4){if(!_0x4dace4){_0x44b68d[_0xc255('0x24')](0x194);}return _0x4dace4;};}function handleError(_0xb305c8,_0x4f60aa){_0x4f60aa=_0x4f60aa||0x1f4;return function(_0x212d59){logger[_0xc255('0x25')](_0x212d59[_0xc255('0x26')]);if(_0x212d59['name']){delete _0x212d59[_0xc255('0x27')];}_0xb305c8[_0xc255('0x17')](_0x4f60aa)[_0xc255('0x28')](_0x212d59);};}exports[_0xc255('0x29')]=function(_0x54cd1d,_0xcf4fde){var _0x363d7d={},_0x151fdf={},_0x2e1368={'count':0x0,'rows':[]};var _0x15e790=_['map'](db[_0xc255('0x2a')][_0xc255('0x2b')],function(_0x4ea5c1){return{'name':_0x4ea5c1[_0xc255('0x2c')],'type':_0x4ea5c1['type'][_0xc255('0x2d')]};});_0x151fdf['model']=_[_0xc255('0x2e')](_0x15e790,'name');_0x151fdf[_0xc255('0x2f')]=_[_0xc255('0x30')](_0x54cd1d[_0xc255('0x2f')]);_0x151fdf[_0xc255('0x31')]=_[_0xc255('0x32')](_0x151fdf[_0xc255('0x33')],_0x151fdf[_0xc255('0x2f')]);_0x363d7d[_0xc255('0x34')]=_[_0xc255('0x32')](_0x151fdf[_0xc255('0x33')],qs[_0xc255('0x35')](_0x54cd1d[_0xc255('0x2f')][_0xc255('0x35')]));_0x363d7d['attributes']=_0x363d7d[_0xc255('0x34')][_0xc255('0x36')]?_0x363d7d[_0xc255('0x34')]:_0x151fdf[_0xc255('0x33')];if(!_0x54cd1d[_0xc255('0x2f')][_0xc255('0x37')](_0xc255('0x38'))){_0x363d7d[_0xc255('0x1b')]=qs[_0xc255('0x1b')](_0x54cd1d[_0xc255('0x2f')][_0xc255('0x1b')]);_0x363d7d['offset']=qs[_0xc255('0x19')](_0x54cd1d['query'][_0xc255('0x19')]);}_0x363d7d[_0xc255('0x39')]=qs[_0xc255('0x3a')](_0x54cd1d[_0xc255('0x2f')][_0xc255('0x3a')]);_0x363d7d[_0xc255('0x3b')]=qs[_0xc255('0x31')](_['pick'](_0x54cd1d[_0xc255('0x2f')],_0x151fdf[_0xc255('0x31')]),_0x15e790);if(_0x54cd1d['query'][_0xc255('0x3c')]){_0x363d7d['where']=_[_0xc255('0x3d')](_0x363d7d[_0xc255('0x3b')],{'$or':_[_0xc255('0x2e')](_0x15e790,function(_0x413794){if(_0x413794[_0xc255('0x3e')]!==_0xc255('0x3f')){var _0x10a31c={};_0x10a31c[_0x413794['name']]={'$like':'%'+_0x54cd1d[_0xc255('0x2f')]['filter']+'%'};return _0x10a31c;}})});}_0x363d7d=_[_0xc255('0x3d')]({},_0x363d7d,_0x54cd1d[_0xc255('0x40')]);var _0x3a94ec={'where':_0x363d7d['where']};return db[_0xc255('0x2a')][_0xc255('0x1c')](_0x3a94ec)[_0xc255('0x23')](function(_0x42d8e5){_0x2e1368['count']=_0x42d8e5;if(_0x54cd1d[_0xc255('0x2f')][_0xc255('0x41')]){_0x363d7d[_0xc255('0x42')]=[{'all':!![]}];}return db[_0xc255('0x2a')][_0xc255('0x43')](_0x363d7d);})[_0xc255('0x23')](function(_0x258927){_0x2e1368[_0xc255('0x44')]=_0x258927;return _0x2e1368;})[_0xc255('0x23')](respondWithFilteredResult(_0xcf4fde,_0x363d7d))[_0xc255('0x45')](handleError(_0xcf4fde,null));};exports[_0xc255('0x46')]=function(_0x52b0ac,_0x58f87d){var _0xcb0a58={'raw':![],'where':{'id':_0x52b0ac[_0xc255('0x47')]['id']}},_0x3be0ac={};_0x3be0ac[_0xc255('0x33')]=_['keys'](db[_0xc255('0x2a')]['rawAttributes']);_0x3be0ac[_0xc255('0x2f')]=_['keys'](_0x52b0ac[_0xc255('0x2f')]);_0x3be0ac[_0xc255('0x31')]=_[_0xc255('0x32')](_0x3be0ac[_0xc255('0x33')],_0x3be0ac['query']);_0xcb0a58[_0xc255('0x34')]=_[_0xc255('0x32')](_0x3be0ac[_0xc255('0x33')],qs[_0xc255('0x35')](_0x52b0ac['query'][_0xc255('0x35')]));_0xcb0a58[_0xc255('0x34')]=_0xcb0a58[_0xc255('0x34')]['length']?_0xcb0a58[_0xc255('0x34')]:_0x3be0ac[_0xc255('0x33')];if(_0x52b0ac[_0xc255('0x2f')]['includeAll']){_0xcb0a58[_0xc255('0x42')]=[{'all':!![]}];}_0xcb0a58=_[_0xc255('0x3d')]({},_0xcb0a58,_0x52b0ac['options']);return db[_0xc255('0x2a')][_0xc255('0x48')](_0xcb0a58)[_0xc255('0x23')](handleEntityNotFound(_0x58f87d,null))[_0xc255('0x23')](respondWithResult(_0x58f87d,null))[_0xc255('0x45')](handleError(_0x58f87d,null));};exports[_0xc255('0x49')]=function(_0x2ecdcd,_0x5e1773){return db[_0xc255('0x2a')][_0xc255('0x49')](_0x2ecdcd['body'],{})[_0xc255('0x23')](respondWithResult(_0x5e1773,0xc9))[_0xc255('0x45')](handleError(_0x5e1773,null));};exports[_0xc255('0x21')]=function(_0x2ca1f2,_0x567b8a){if(_0x2ca1f2[_0xc255('0x4a')]['id']){delete _0x2ca1f2[_0xc255('0x4a')]['id'];}return db[_0xc255('0x2a')][_0xc255('0x48')]({'where':{'id':_0x2ca1f2[_0xc255('0x47')]['id']}})[_0xc255('0x23')](handleEntityNotFound(_0x567b8a,null))[_0xc255('0x23')](saveUpdates(_0x2ca1f2[_0xc255('0x4a')],null))[_0xc255('0x23')](respondWithResult(_0x567b8a,null))[_0xc255('0x45')](handleError(_0x567b8a,null));};exports[_0xc255('0x22')]=function(_0x428c47,_0x3cf634){return db['SalesforceAccount'][_0xc255('0x48')]({'where':{'id':_0x428c47[_0xc255('0x47')]['id']}})[_0xc255('0x23')](handleEntityNotFound(_0x3cf634,null))['then'](removeEntity(_0x3cf634,null))[_0xc255('0x45')](handleError(_0x3cf634,null));};exports[_0xc255('0x4b')]=function(_0x3bb6b2,_0x2d45db,_0x49b4be){var _0x12bf13={};var _0x4b2edb={};var _0x17b23c;var _0x4d61ae;return db[_0xc255('0x2a')][_0xc255('0x4c')]({'where':{'id':_0x3bb6b2['params']['id']}})[_0xc255('0x23')](handleEntityNotFound(_0x2d45db,null))[_0xc255('0x23')](function(_0x101b3f){if(_0x101b3f){_0x17b23c=_0x101b3f;_0x4b2edb[_0xc255('0x33')]=_[_0xc255('0x30')](db[_0xc255('0x4d')][_0xc255('0x2b')]);_0x4b2edb[_0xc255('0x2f')]=_[_0xc255('0x30')](_0x3bb6b2[_0xc255('0x2f')]);_0x4b2edb['filters']=_[_0xc255('0x32')](_0x4b2edb['model'],_0x4b2edb['query']);_0x12bf13[_0xc255('0x34')]=_['intersection'](_0x4b2edb[_0xc255('0x33')],qs[_0xc255('0x35')](_0x3bb6b2[_0xc255('0x2f')]['fields']));_0x12bf13[_0xc255('0x34')]=_0x12bf13['attributes']['length']?_0x12bf13['attributes']:_0x4b2edb[_0xc255('0x33')];_0x12bf13[_0xc255('0x39')]=qs[_0xc255('0x3a')](_0x3bb6b2[_0xc255('0x2f')][_0xc255('0x3a')]);_0x12bf13['where']=qs[_0xc255('0x31')](_[_0xc255('0x4e')](_0x3bb6b2[_0xc255('0x2f')],_0x4b2edb[_0xc255('0x31')]));if(_0x3bb6b2['query']['filter']){_0x12bf13['where']=_['merge'](_0x12bf13['where'],{'$or':_[_0xc255('0x2e')](_0x12bf13[_0xc255('0x34')],function(_0x3f5829){var _0x1e6ea2={};_0x1e6ea2[_0x3f5829]={'$like':'%'+_0x3bb6b2['query'][_0xc255('0x3c')]+'%'};return _0x1e6ea2;})});}_0x12bf13=_[_0xc255('0x3d')]({},_0x12bf13,_0x3bb6b2[_0xc255('0x40')]);return _0x17b23c[_0xc255('0x4b')](_0x12bf13);}})[_0xc255('0x23')](function(_0x64ee1a){if(_0x64ee1a){_0x4d61ae=_0x64ee1a[_0xc255('0x36')];if(!_0x3bb6b2[_0xc255('0x2f')][_0xc255('0x37')](_0xc255('0x38'))){_0x12bf13[_0xc255('0x1b')]=qs[_0xc255('0x1b')](_0x3bb6b2['query']['limit']);_0x12bf13[_0xc255('0x19')]=qs['offset'](_0x3bb6b2['query'][_0xc255('0x19')]);}return _0x17b23c[_0xc255('0x4b')](_0x12bf13);}})['then'](function(_0x85aae4){if(_0x85aae4){return _0x85aae4?{'count':_0x4d61ae,'rows':_0x85aae4}:null;}})[_0xc255('0x23')](respondWithResult(_0x2d45db,null))['catch'](handleError(_0x2d45db,null));};exports[_0xc255('0x4f')]=function(_0x5bc687,_0x591473,_0x18a097){if(_0x5bc687[_0xc255('0x4a')]['id']){delete _0x5bc687[_0xc255('0x4a')]['id'];}return db[_0xc255('0x2a')][_0xc255('0x4c')]({'where':{'id':_0x5bc687['params']['id']}})[_0xc255('0x23')](handleEntityNotFound(_0x591473,null))[_0xc255('0x23')](function(_0x5107e2){if(_0x5107e2){_0x5bc687[_0xc255('0x4a')][_0xc255('0x50')]=_0x5107e2['id'];_0x5bc687[_0xc255('0x4a')][_0xc255('0x51')]=integrations[_0xc255('0x52')](_0x5bc687[_0xc255('0x4a')]['channel'],_0x5bc687[_0xc255('0x4a')]['type']);_0x5bc687[_0xc255('0x4a')][_0xc255('0x53')]=integrations['getDescriptions'](_0x5bc687[_0xc255('0x4a')][_0xc255('0x54')],_0x5bc687['body'][_0xc255('0x3e')]);return db[_0xc255('0x4d')][_0xc255('0x49')](_0x5bc687['body'],{'include':[{'model':db[_0xc255('0x55')],'as':_0xc255('0x51')},{'model':db[_0xc255('0x55')],'as':'Descriptions'}]});}return null;})[_0xc255('0x23')](respondWithResult(_0x591473,null))[_0xc255('0x45')](handleError(_0x591473,null));};exports['getFields']=function(_0x443e62,_0x2ee884,_0x4b4338){var _0x2b2687;var _0x106a7e='';var _0x37a109='Task';return db[_0xc255('0x2a')][_0xc255('0x4c')]({'where':{'id':_0x443e62[_0xc255('0x47')]['id']},'attributes':['id',_0xc255('0x56'),_0xc255('0x57'),_0xc255('0x58'),_0xc255('0x59'),_0xc255('0x5a'),_0xc255('0x5b')]})[_0xc255('0x23')](handleEntityNotFound(_0x2ee884,null))[_0xc255('0x23')](function(_0x29f1e3){if(_0x29f1e3){_0x106a7e=_0x29f1e3[_0xc255('0x56')];var _0x490129=_0x106a7e[_0xc255('0x5c')](-0x1);if(_0x490129==='/'){_0x106a7e=_0x106a7e['substring'](0x0,_0x106a7e[_0xc255('0x5d')](_0x490129));}_0x2b2687=new jsforce['Connection']({'oauth2':{'loginUrl':_0x106a7e,'clientId':_0x29f1e3['clientId'],'clientSecret':_0x29f1e3[_0xc255('0x58')]}});return _0x2b2687[_0xc255('0x5e')](_0x29f1e3[_0xc255('0x59')],_0x29f1e3[_0xc255('0x5a')]['concat'](_0x29f1e3[_0xc255('0x5b')]));}})[_0xc255('0x23')](function(_0x569a7c){if(_0x569a7c){if(!_[_0xc255('0x5f')](_0x443e62[_0xc255('0x2f')][_0xc255('0x60')])){_0x37a109=_0x443e62['query'][_0xc255('0x60')];}return _0x2b2687[_0xc255('0x61')](_0x37a109)[_0xc255('0x62')]();}})[_0xc255('0x23')](function(_0x4d097f){var _0x1bfc73=[_0xc255('0x63'),_0xc255('0x64'),_0xc255('0x65'),_0xc255('0x66'),'Subject',_0xc255('0x67')];var _0x30ec52=[_0xc255('0x68'),_0xc255('0x69'),_0xc255('0x6a'),_0xc255('0x6b'),_0xc255('0x6c'),_0xc255('0x6d'),_0xc255('0x6e')];if(_0x4d097f){_[_0xc255('0x6f')](_0x4d097f['fields'],function(_0x5373b6){return _0x1bfc73[_0xc255('0x70')](_0x5373b6['name'])||!_0x30ec52[_0xc255('0x70')](_0x5373b6[_0xc255('0x3e')]);});return{'count':_0x4d097f['fields']['length'],'rows':_[_0xc255('0x2e')](_0x4d097f['fields'],function(_0x2f0ab4){return{'id':_0x2f0ab4[_0xc255('0x27')],'name':_0x2f0ab4[_0xc255('0x71')],'custom':_0x2f0ab4['custom'],'options':_0x2f0ab4[_0xc255('0x72')][_0xc255('0x36')]>0x0?_[_0xc255('0x2e')](_0x2f0ab4[_0xc255('0x72')],function(_0x99ed0a){return{'name':_0x99ed0a[_0xc255('0x71')],'value':_0x99ed0a[_0xc255('0x73')]};}):_0x2f0ab4[_0xc255('0x3e')]=='boolean'?[{'name':_0xc255('0x74'),'value':'true'},{'name':'False','value':_0xc255('0x75')}]:[]};})};}})['then'](respondWithResult(_0x2ee884,null))[_0xc255('0x45')](function(_0x4a6daf){var _0x5d56a7=_0x443e62[_0xc255('0x2f')]['test']?0x1f4:_0x4a6daf['statusCode']||0x1f4;logger['error'](_0xc255('0x76'),_0xc255('0x77'),_0x5d56a7,JSON['stringify'](_0x4a6daf));delete _0x4a6daf[_0xc255('0x27')];if(_0x5d56a7===0x191){_0x5d56a7=0x190;}_0x2ee884[_0xc255('0x17')](_0x5d56a7)[_0xc255('0x28')](_0x443e62[_0xc255('0x2f')][_0xc255('0x78')]?{'message':_0xc255('0x79'),'statusCode':_0x4a6daf[_0xc255('0x7a')]}:_0x4a6daf);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 5c0651d..d044d55 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 _0xfd8a=['rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','api','bluebird','request-promise','path'];(function(_0x5ecff9,_0x38378c){var _0x38a6f0=function(_0x51cca7){while(--_0x51cca7){_0x5ecff9['push'](_0x5ecff9['shift']());}};_0x38a6f0(++_0x38378c);}(_0xfd8a,0x7e));var _0xafd8=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0xfd8a[_0x3bab09];return _0x164376;};'use strict';var _=require(_0xafd8('0x0'));var util=require(_0xafd8('0x1'));var logger=require('../../config/logger')(_0xafd8('0x2'));var moment=require('moment');var BPromise=require(_0xafd8('0x3'));var rp=require(_0xafd8('0x4'));var fs=require('fs');var path=require(_0xafd8('0x5'));var rimraf=require(_0xafd8('0x6'));var config=require('../../config/environment');var attributes=require(_0xafd8('0x7'));var integrations=require(_0xafd8('0x8'));module[_0xafd8('0x9')]=function(_0x309008,_0x2f1989){return _0x309008[_0xafd8('0xa')](_0xafd8('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6127=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0x6127,0x165));var _0x7612=function(_0x285db,_0x4f4926){_0x285db=_0x285db-0x0;var _0x2ebec6=_0x6127[_0x285db];return _0x2ebec6;};'use strict';var _=require(_0x7612('0x0'));var util=require(_0x7612('0x1'));var logger=require(_0x7612('0x2'))(_0x7612('0x3'));var moment=require(_0x7612('0x4'));var BPromise=require(_0x7612('0x5'));var rp=require(_0x7612('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7612('0x7'));var attributes=require(_0x7612('0x8'));var integrations=require(_0x7612('0x9'));module[_0x7612('0xa')]=function(_0x3c8d5f,_0x553b48){return _0x3c8d5f[_0x7612('0xb')](_0x7612('0xc'),attributes,{'tableName':_0x7612('0xd'),'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 f815af3..aeabea4 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 _0x61f8=['util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','SalesforceAccount','options','where','attributes','include','map','model','then','GetSalesforceAccount','ShowSalesforceAccount','find','lodash'];(function(_0xaf8280,_0x5c1176){var _0x1b92a5=function(_0xd78685){while(--_0xd78685){_0xaf8280['push'](_0xaf8280['shift']());}};_0x1b92a5(++_0x5c1176);}(_0x61f8,0x83));var _0x861f=function(_0x35485a,_0x91cdd4){_0x35485a=_0x35485a-0x0;var _0x5148e6=_0x61f8[_0x35485a];return _0x5148e6;};'use strict';var _=require(_0x861f('0x0'));var util=require(_0x861f('0x1'));var moment=require(_0x861f('0x2'));var BPromise=require(_0x861f('0x3'));var rs=require(_0x861f('0x4'));var fs=require('fs');var Redis=require(_0x861f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x861f('0x6'));var config=require('../../config/environment');var jayson=require(_0x861f('0x7'));var client=jayson[_0x861f('0x8')][_0x861f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36e609,_0x29485a,_0x1079aa){return new BPromise(function(_0x4b6310,_0x254b8a){return client[_0x861f('0xa')](_0x36e609,_0x1079aa)['then'](function(_0x22f0e4){logger[_0x861f('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x29485a,_0x861f('0xc'));logger[_0x861f('0xd')](_0x861f('0xe'),_0x29485a,'request\x20sent',JSON[_0x861f('0xf')](_0x22f0e4));if(_0x22f0e4[_0x861f('0x10')]){if(_0x22f0e4[_0x861f('0x10')][_0x861f('0x11')]===0x1f4){logger[_0x861f('0x10')](_0x861f('0x12'),_0x29485a,_0x22f0e4[_0x861f('0x10')][_0x861f('0x13')]);return _0x254b8a(_0x22f0e4[_0x861f('0x10')][_0x861f('0x13')]);}logger[_0x861f('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x29485a,_0x22f0e4[_0x861f('0x10')][_0x861f('0x13')]);return _0x4b6310(_0x22f0e4['error']['message']);}else{logger[_0x861f('0xb')](_0x861f('0x12'),_0x29485a,_0x861f('0xc'));_0x4b6310(_0x22f0e4[_0x861f('0x14')][_0x861f('0x13')]);}})[_0x861f('0x15')](function(_0x31c8c4){logger[_0x861f('0x10')](_0x861f('0x12'),_0x29485a,_0x31c8c4);_0x254b8a(_0x31c8c4);});});}exports['GetSalesforceAccount']=function(_0x1f5b5a){var _0x636c6f=this;return new Promise(function(_0x40a87f,_0x13c0ef){return db[_0x861f('0x16')]['findAll']({'raw':_0x1f5b5a[_0x861f('0x17')]?_0x1f5b5a[_0x861f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1f5b5a['options']?_0x1f5b5a[_0x861f('0x17')][_0x861f('0x18')]||null:null,'attributes':_0x1f5b5a[_0x861f('0x17')]?_0x1f5b5a[_0x861f('0x17')][_0x861f('0x19')]||null:null,'limit':_0x1f5b5a[_0x861f('0x17')]?_0x1f5b5a[_0x861f('0x17')]['limit']||null:null,'include':_0x1f5b5a[_0x861f('0x17')]?_0x1f5b5a['options'][_0x861f('0x1a')]?_[_0x861f('0x1b')](_0x1f5b5a[_0x861f('0x17')][_0x861f('0x1a')],function(_0xd6aa55){return{'model':db[_0xd6aa55[_0x861f('0x1c')]],'as':_0xd6aa55['as'],'attributes':_0xd6aa55[_0x861f('0x19')],'include':_0xd6aa55[_0x861f('0x1a')]?_[_0x861f('0x1b')](_0xd6aa55[_0x861f('0x1a')],function(_0x2f2b1f){return{'model':db[_0x2f2b1f[_0x861f('0x1c')]],'as':_0x2f2b1f['as'],'attributes':_0x2f2b1f[_0x861f('0x19')],'include':_0x2f2b1f['include']?_[_0x861f('0x1b')](_0x2f2b1f[_0x861f('0x1a')],function(_0x27682b){return{'model':db[_0x27682b[_0x861f('0x1c')]],'as':_0x27682b['as'],'attributes':_0x27682b[_0x861f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x861f('0x1d')](function(_0x12d680){logger[_0x861f('0xb')](_0x861f('0x1e'),_0x1f5b5a);logger[_0x861f('0xd')]('GetSalesforceAccount',_0x1f5b5a,JSON[_0x861f('0xf')](_0x12d680));_0x40a87f(_0x12d680);})[_0x861f('0x15')](function(_0x4e7a5b){logger[_0x861f('0x10')](_0x861f('0x1e'),_0x4e7a5b[_0x861f('0x13')],_0x1f5b5a);_0x13c0ef(_0x636c6f[_0x861f('0x10')](0x1f4,_0x4e7a5b[_0x861f('0x13')]));});});};exports[_0x861f('0x1f')]=function(_0x48c3d2){var _0x78e698=this;return new Promise(function(_0x11e5ab,_0x4ab43b){return db['SalesforceAccount'][_0x861f('0x20')]({'raw':_0x48c3d2['options']?_0x48c3d2[_0x861f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x48c3d2[_0x861f('0x17')]?_0x48c3d2['options']['where']||null:null,'attributes':_0x48c3d2[_0x861f('0x17')]?_0x48c3d2[_0x861f('0x17')][_0x861f('0x19')]||null:null,'include':_0x48c3d2[_0x861f('0x17')]?_0x48c3d2[_0x861f('0x17')][_0x861f('0x1a')]?_['map'](_0x48c3d2[_0x861f('0x17')]['include'],function(_0x2f5ea0){return{'model':db[_0x2f5ea0[_0x861f('0x1c')]],'as':_0x2f5ea0['as'],'attributes':_0x2f5ea0[_0x861f('0x19')],'include':_0x2f5ea0['include']?_['map'](_0x2f5ea0[_0x861f('0x1a')],function(_0xe5a45b){return{'model':db[_0xe5a45b[_0x861f('0x1c')]],'as':_0xe5a45b['as'],'attributes':_0xe5a45b['attributes'],'include':_0xe5a45b[_0x861f('0x1a')]?_[_0x861f('0x1b')](_0xe5a45b[_0x861f('0x1a')],function(_0x12cd7a){return{'model':db[_0x12cd7a[_0x861f('0x1c')]],'as':_0x12cd7a['as'],'attributes':_0x12cd7a[_0x861f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x861f('0x1d')](function(_0x5476e2){logger[_0x861f('0xb')](_0x861f('0x1f'),_0x48c3d2);logger['debug']('ShowSalesforceAccount',_0x48c3d2,JSON[_0x861f('0xf')](_0x5476e2));_0x11e5ab(_0x5476e2);})[_0x861f('0x15')](function(_0x1047a6){logger[_0x861f('0x10')](_0x861f('0x1f'),_0x1047a6[_0x861f('0x13')],_0x48c3d2);_0x4ab43b(_0x78e698['error'](0x1f4,_0x1047a6[_0x861f('0x13')]));});});}; \ No newline at end of file +var _0xc376=['request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','SalesforceAccount,\x20%s,\x20%s','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','limit','model','attributes','map','then','stringify','ShowSalesforceAccount','find','include','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info'];(function(_0x5c1d2d,_0x23ab51){var _0x4e5906=function(_0x155fa0){while(--_0x155fa0){_0x5c1d2d['push'](_0x5c1d2d['shift']());}};_0x4e5906(++_0x23ab51);}(_0xc376,0x14b));var _0x6c37=function(_0x16051a,_0x5e4326){_0x16051a=_0x16051a-0x0;var _0x35d20d=_0xc376[_0x16051a];return _0x35d20d;};'use strict';var _=require('lodash');var util=require(_0x6c37('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6c37('0x1'));var fs=require('fs');var Redis=require(_0x6c37('0x2'));var db=require(_0x6c37('0x3'))['db'];var utils=require(_0x6c37('0x4'));var logger=require('../../config/logger')(_0x6c37('0x5'));var config=require('../../config/environment');var jayson=require(_0x6c37('0x6'));var client=jayson[_0x6c37('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fba50,_0x10fb48,_0x25a1ea){return new BPromise(function(_0x2d103f,_0x210506){return client[_0x6c37('0x8')](_0x2fba50,_0x25a1ea)['then'](function(_0x420671){logger[_0x6c37('0x9')]('SalesforceAccount,\x20%s,\x20%s',_0x10fb48,_0x6c37('0xa'));logger[_0x6c37('0xb')](_0x6c37('0xc'),_0x10fb48,_0x6c37('0xa'),JSON['stringify'](_0x420671));if(_0x420671[_0x6c37('0xd')]){if(_0x420671[_0x6c37('0xd')]['code']===0x1f4){logger[_0x6c37('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x10fb48,_0x420671[_0x6c37('0xd')]['message']);return _0x210506(_0x420671[_0x6c37('0xd')][_0x6c37('0xe')]);}logger[_0x6c37('0xd')](_0x6c37('0xf'),_0x10fb48,_0x420671[_0x6c37('0xd')]['message']);return _0x2d103f(_0x420671['error'][_0x6c37('0xe')]);}else{logger[_0x6c37('0x9')](_0x6c37('0xf'),_0x10fb48,_0x6c37('0xa'));_0x2d103f(_0x420671['result'][_0x6c37('0xe')]);}})['catch'](function(_0x359105){logger[_0x6c37('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x10fb48,_0x359105);_0x210506(_0x359105);});});}exports[_0x6c37('0x10')]=function(_0xb7902e){var _0x48795b=this;return new Promise(function(_0x5d04fe,_0x4b464e){return db[_0x6c37('0x11')][_0x6c37('0x12')]({'raw':_0xb7902e[_0x6c37('0x13')]?_0xb7902e[_0x6c37('0x13')][_0x6c37('0x14')]===undefined?!![]:![]:!![],'where':_0xb7902e[_0x6c37('0x13')]?_0xb7902e[_0x6c37('0x13')][_0x6c37('0x15')]||null:null,'attributes':_0xb7902e[_0x6c37('0x13')]?_0xb7902e[_0x6c37('0x13')]['attributes']||null:null,'limit':_0xb7902e[_0x6c37('0x13')]?_0xb7902e['options'][_0x6c37('0x16')]||null:null,'include':_0xb7902e[_0x6c37('0x13')]?_0xb7902e[_0x6c37('0x13')]['include']?_['map'](_0xb7902e[_0x6c37('0x13')]['include'],function(_0x4aea30){return{'model':db[_0x4aea30[_0x6c37('0x17')]],'as':_0x4aea30['as'],'attributes':_0x4aea30[_0x6c37('0x18')],'include':_0x4aea30['include']?_[_0x6c37('0x19')](_0x4aea30['include'],function(_0x2a2651){return{'model':db[_0x2a2651['model']],'as':_0x2a2651['as'],'attributes':_0x2a2651['attributes'],'include':_0x2a2651['include']?_[_0x6c37('0x19')](_0x2a2651['include'],function(_0x2138a9){return{'model':db[_0x2138a9['model']],'as':_0x2138a9['as'],'attributes':_0x2138a9[_0x6c37('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6c37('0x1a')](function(_0x45418a){logger['info']('GetSalesforceAccount',_0xb7902e);logger[_0x6c37('0xb')]('GetSalesforceAccount',_0xb7902e,JSON[_0x6c37('0x1b')](_0x45418a));_0x5d04fe(_0x45418a);})['catch'](function(_0xf3d00a){logger[_0x6c37('0xd')](_0x6c37('0x10'),_0xf3d00a[_0x6c37('0xe')],_0xb7902e);_0x4b464e(_0x48795b[_0x6c37('0xd')](0x1f4,_0xf3d00a['message']));});});};exports[_0x6c37('0x1c')]=function(_0x5bed3b){var _0x544594=this;return new Promise(function(_0x3d8fe3,_0x1f902f){return db[_0x6c37('0x11')][_0x6c37('0x1d')]({'raw':_0x5bed3b['options']?_0x5bed3b[_0x6c37('0x13')][_0x6c37('0x14')]===undefined?!![]:![]:!![],'where':_0x5bed3b['options']?_0x5bed3b[_0x6c37('0x13')][_0x6c37('0x15')]||null:null,'attributes':_0x5bed3b[_0x6c37('0x13')]?_0x5bed3b['options'][_0x6c37('0x18')]||null:null,'include':_0x5bed3b[_0x6c37('0x13')]?_0x5bed3b['options'][_0x6c37('0x1e')]?_[_0x6c37('0x19')](_0x5bed3b[_0x6c37('0x13')][_0x6c37('0x1e')],function(_0x50d5b3){return{'model':db[_0x50d5b3[_0x6c37('0x17')]],'as':_0x50d5b3['as'],'attributes':_0x50d5b3['attributes'],'include':_0x50d5b3[_0x6c37('0x1e')]?_[_0x6c37('0x19')](_0x50d5b3[_0x6c37('0x1e')],function(_0x387a64){return{'model':db[_0x387a64[_0x6c37('0x17')]],'as':_0x387a64['as'],'attributes':_0x387a64[_0x6c37('0x18')],'include':_0x387a64[_0x6c37('0x1e')]?_[_0x6c37('0x19')](_0x387a64[_0x6c37('0x1e')],function(_0x34ca5a){return{'model':db[_0x34ca5a[_0x6c37('0x17')]],'as':_0x34ca5a['as'],'attributes':_0x34ca5a[_0x6c37('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x590a83){logger[_0x6c37('0x9')]('ShowSalesforceAccount',_0x5bed3b);logger['debug'](_0x6c37('0x1c'),_0x5bed3b,JSON[_0x6c37('0x1b')](_0x590a83));_0x3d8fe3(_0x590a83);})['catch'](function(_0x5ad8a2){logger[_0x6c37('0xd')]('ShowSalesforceAccount',_0x5ad8a2['message'],_0x5bed3b);_0x1f902f(_0x544594[_0x6c37('0xd')](0x1f4,_0x5ad8a2[_0x6c37('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index b4a6775..0bd34c6 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 _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(_0x33b2ca,_0x1beb18){var _0x1a9e6b=function(_0x85ec8e){while(--_0x85ec8e){_0x33b2ca['push'](_0x33b2ca['shift']());}};_0x1a9e6b(++_0x1beb18);}(_0x2ef3,0xba));var _0x32ef=function(_0x3aba13,_0x39efd3){_0x3aba13=_0x3aba13-0x0;var _0x542a74=_0x2ef3[_0x3aba13];return _0x542a74;};'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 +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x34c9b6,_0x51ad7b){var _0x205393=function(_0x49cbe7){while(--_0x49cbe7){_0x34c9b6['push'](_0x34c9b6['shift']());}};_0x205393(++_0x51ad7b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 2626c24..ab76e93 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 _0x1943=['lead','account_contact_lead','account','contact_lead','ENUM','nothing','sequelize','exports','STRING','Task','contact'];(function(_0x29ede8,_0x5c1c20){var _0x4be249=function(_0x883186){while(--_0x883186){_0x29ede8['push'](_0x29ede8['shift']());}};_0x4be249(++_0x5c1c20);}(_0x1943,0x124));var _0x3194=function(_0x1720fa,_0xa61b09){_0x1720fa=_0x1720fa-0x0;var _0x3ed31a=_0x1943[_0x1720fa];return _0x3ed31a;};'use strict';var Sequelize=require(_0x3194('0x0'));module[_0x3194('0x1')]={'name':{'type':Sequelize[_0x3194('0x2')]},'description':{'type':Sequelize[_0x3194('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x3194('0x3'),'Case'),'defaultValue':_0x3194('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x3194('0x4'),_0x3194('0x5'),_0x3194('0x6'),_0x3194('0x7')),'defaultValue':_0x3194('0x8')},'moduleCreate':{'type':Sequelize[_0x3194('0x9')](_0x3194('0xa'),_0x3194('0x4'),_0x3194('0x5'),_0x3194('0x7')),'defaultValue':_0x3194('0x5')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x3194('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x3194('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x66b4=['sequelize','exports','STRING','ENUM','Case','contact_lead','account_contact_lead','account','nothing','contact','lead'];(function(_0x1a2d1c,_0x4a1873){var _0x56eb67=function(_0x295a7d){while(--_0x295a7d){_0x1a2d1c['push'](_0x1a2d1c['shift']());}};_0x56eb67(++_0x4a1873);}(_0x66b4,0x1ce));var _0x466b=function(_0x386a99,_0xfacb81){_0x386a99=_0x386a99-0x0;var _0x2abd55=_0x66b4[_0x386a99];return _0x2abd55;};'use strict';var Sequelize=require(_0x466b('0x0'));module[_0x466b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x466b('0x2')]},'ticketType':{'type':Sequelize[_0x466b('0x3')]('Task',_0x466b('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x466b('0x3')](_0x466b('0x5'),'contact','lead',_0x466b('0x6'),_0x466b('0x7')),'defaultValue':_0x466b('0x5')},'moduleCreate':{'type':Sequelize[_0x466b('0x3')](_0x466b('0x8'),_0x466b('0x9'),_0x466b('0xa'),'account'),'defaultValue':_0x466b('0xa')},'leadId':{'type':Sequelize[_0x466b('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x466b('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x466b('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index e5380c9..59c23b5 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 _0x20ad=['to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','set','Content-Range','json','save','update','then','destroy','error','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','offset','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','params','fields','length','includeAll','options','find','create','body','getFields','findOne','SalesforceField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x20ad,0x13a));var _0xd20a=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x20ad[_0x28d18d];return _0x470640;};'use strict';var emlformat=require(_0xd20a('0x0'));var rimraf=require(_0xd20a('0x1'));var zipdir=require(_0xd20a('0x2'));var jsonpatch=require(_0xd20a('0x3'));var rp=require('request-promise');var moment=require(_0xd20a('0x4'));var BPromise=require(_0xd20a('0x5'));var Mustache=require(_0xd20a('0x6'));var util=require(_0xd20a('0x7'));var path=require(_0xd20a('0x8'));var sox=require(_0xd20a('0x9'));var csv=require(_0xd20a('0xa'));var ejs=require(_0xd20a('0xb'));var fs=require('fs');var fs_extra=require(_0xd20a('0xc'));var _=require('lodash');var squel=require(_0xd20a('0xd'));var crypto=require(_0xd20a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd20a('0xf'));var toCsv=require(_0xd20a('0xa'));var querystring=require(_0xd20a('0x10'));var Papa=require(_0xd20a('0x11'));var Redis=require(_0xd20a('0x12'));var authService=require(_0xd20a('0x13'));var qs=require(_0xd20a('0x14'));var as=require(_0xd20a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd20a('0x16'))('api');var utils=require(_0xd20a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd20a('0x18'));var db=require(_0xd20a('0x19'))['db'];function respondWithStatusCode(_0x3d3c14,_0x27ef11){_0x27ef11=_0x27ef11||0xcc;return function(_0x21f3e4){if(_0x21f3e4){return _0x3d3c14[_0xd20a('0x1a')](_0x27ef11);}return _0x3d3c14[_0xd20a('0x1b')](_0x27ef11)[_0xd20a('0x1c')]();};}function respondWithResult(_0x5d7cef,_0x2a2d90){_0x2a2d90=_0x2a2d90||0xc8;return function(_0x211c75){if(_0x211c75){return _0x5d7cef[_0xd20a('0x1b')](_0x2a2d90)['json'](_0x211c75);}};}function respondWithFilteredResult(_0x112c2e,_0x194408){return function(_0x1286f1){if(_0x1286f1){var _0x1dde7d=typeof _0x194408['offset']===_0xd20a('0x1d')&&typeof _0x194408['limit']==='undefined';var _0x3f8181=_0x1286f1[_0xd20a('0x1e')];var _0x4c1dd4=_0x1dde7d?0x0:_0x194408['offset'];var _0x7a0268=_0x1dde7d?_0x1286f1[_0xd20a('0x1e')]:_0x194408['offset']+_0x194408['limit'];var _0x400bb8;if(_0x7a0268>=_0x3f8181){_0x7a0268=_0x3f8181;_0x400bb8=0xc8;}else{_0x400bb8=0xce;}_0x112c2e['status'](_0x400bb8);return _0x112c2e[_0xd20a('0x1f')](_0xd20a('0x20'),_0x4c1dd4+'-'+_0x7a0268+'/'+_0x3f8181)[_0xd20a('0x21')](_0x1286f1);}return null;};}function patchUpdates(_0x3f6c7e){return function(_0x36e2fa){try{jsonpatch['apply'](_0x36e2fa,_0x3f6c7e,!![]);}catch(_0x7945aa){return BPromise['reject'](_0x7945aa);}return _0x36e2fa[_0xd20a('0x22')]();};}function saveUpdates(_0x3d2558,_0x219655){return function(_0x1ffefd){if(_0x1ffefd){return _0x1ffefd[_0xd20a('0x23')](_0x3d2558)[_0xd20a('0x24')](function(_0x548733){return _0x548733;});}return null;};}function removeEntity(_0x52091e,_0x5af49e){return function(_0x2f1fbb){if(_0x2f1fbb){return _0x2f1fbb[_0xd20a('0x25')]()[_0xd20a('0x24')](function(){_0x52091e[_0xd20a('0x1b')](0xcc)[_0xd20a('0x1c')]();});}};}function handleEntityNotFound(_0x553c50,_0x27dba4){return function(_0x1b9cb0){if(!_0x1b9cb0){_0x553c50[_0xd20a('0x1a')](0x194);}return _0x1b9cb0;};}function handleError(_0x1afab7,_0x2a9bb3){_0x2a9bb3=_0x2a9bb3||0x1f4;return function(_0x5b1b84){logger[_0xd20a('0x26')](_0x5b1b84['stack']);if(_0x5b1b84[_0xd20a('0x27')]){delete _0x5b1b84[_0xd20a('0x27')];}_0x1afab7['status'](_0x2a9bb3)[_0xd20a('0x28')](_0x5b1b84);};}exports[_0xd20a('0x29')]=function(_0x44e745,_0x241e34){var _0x596c08={},_0x17112a={},_0x561596={'count':0x0,'rows':[]};var _0x177061=_[_0xd20a('0x2a')](db[_0xd20a('0x2b')][_0xd20a('0x2c')],function(_0x20fed1){return{'name':_0x20fed1[_0xd20a('0x2d')],'type':_0x20fed1[_0xd20a('0x2e')][_0xd20a('0x2f')]};});_0x17112a[_0xd20a('0x30')]=_[_0xd20a('0x2a')](_0x177061,_0xd20a('0x27'));_0x17112a[_0xd20a('0x31')]=_[_0xd20a('0x32')](_0x44e745[_0xd20a('0x31')]);_0x17112a[_0xd20a('0x33')]=_['intersection'](_0x17112a['model'],_0x17112a['query']);_0x596c08['attributes']=_[_0xd20a('0x34')](_0x17112a[_0xd20a('0x30')],qs['fields'](_0x44e745[_0xd20a('0x31')]['fields']));_0x596c08[_0xd20a('0x35')]=_0x596c08['attributes']['length']?_0x596c08[_0xd20a('0x35')]:_0x17112a['model'];if(!_0x44e745['query'][_0xd20a('0x36')](_0xd20a('0x37'))){_0x596c08['limit']=qs[_0xd20a('0x38')](_0x44e745[_0xd20a('0x31')][_0xd20a('0x38')]);_0x596c08[_0xd20a('0x39')]=qs[_0xd20a('0x39')](_0x44e745[_0xd20a('0x31')]['offset']);}_0x596c08['order']=qs['sort'](_0x44e745['query'][_0xd20a('0x3a')]);_0x596c08[_0xd20a('0x3b')]=qs[_0xd20a('0x33')](_[_0xd20a('0x3c')](_0x44e745[_0xd20a('0x31')],_0x17112a[_0xd20a('0x33')]),_0x177061);if(_0x44e745['query'][_0xd20a('0x3d')]){_0x596c08[_0xd20a('0x3b')]=_[_0xd20a('0x3e')](_0x596c08[_0xd20a('0x3b')],{'$or':_['map'](_0x177061,function(_0x396d01){if(_0x396d01[_0xd20a('0x2e')]!==_0xd20a('0x3f')){var _0x5ee073={};_0x5ee073[_0x396d01[_0xd20a('0x27')]]={'$like':'%'+_0x44e745[_0xd20a('0x31')]['filter']+'%'};return _0x5ee073;}})});}_0x596c08=_['merge']({},_0x596c08,_0x44e745['options']);var _0x3e0341={'where':_0x596c08[_0xd20a('0x3b')]};return db['SalesforceConfiguration'][_0xd20a('0x1e')](_0x3e0341)['then'](function(_0x3cd761){_0x561596[_0xd20a('0x1e')]=_0x3cd761;if(_0x44e745[_0xd20a('0x31')]['includeAll']){_0x596c08[_0xd20a('0x40')]=[{'all':!![]}];}return db[_0xd20a('0x2b')]['findAll'](_0x596c08);})[_0xd20a('0x24')](function(_0x17087e){_0x561596[_0xd20a('0x41')]=_0x17087e;return _0x561596;})[_0xd20a('0x24')](respondWithFilteredResult(_0x241e34,_0x596c08))[_0xd20a('0x42')](handleError(_0x241e34,null));};exports['show']=function(_0x43759a,_0x291d51){var _0x3c3db5={'raw':![],'where':{'id':_0x43759a[_0xd20a('0x43')]['id']}},_0x1eca59={};_0x1eca59[_0xd20a('0x30')]=_['keys'](db[_0xd20a('0x2b')][_0xd20a('0x2c')]);_0x1eca59[_0xd20a('0x31')]=_[_0xd20a('0x32')](_0x43759a[_0xd20a('0x31')]);_0x1eca59['filters']=_[_0xd20a('0x34')](_0x1eca59[_0xd20a('0x30')],_0x1eca59[_0xd20a('0x31')]);_0x3c3db5['attributes']=_[_0xd20a('0x34')](_0x1eca59['model'],qs[_0xd20a('0x44')](_0x43759a[_0xd20a('0x31')][_0xd20a('0x44')]));_0x3c3db5['attributes']=_0x3c3db5['attributes'][_0xd20a('0x45')]?_0x3c3db5[_0xd20a('0x35')]:_0x1eca59['model'];if(_0x43759a['query'][_0xd20a('0x46')]){_0x3c3db5[_0xd20a('0x40')]=[{'all':!![]}];}_0x3c3db5=_['merge']({},_0x3c3db5,_0x43759a[_0xd20a('0x47')]);return db['SalesforceConfiguration'][_0xd20a('0x48')](_0x3c3db5)[_0xd20a('0x24')](handleEntityNotFound(_0x291d51,null))[_0xd20a('0x24')](respondWithResult(_0x291d51,null))[_0xd20a('0x42')](handleError(_0x291d51,null));};exports['create']=function(_0x459771,_0x25454a){return db[_0xd20a('0x2b')][_0xd20a('0x49')](_0x459771[_0xd20a('0x4a')],{})[_0xd20a('0x24')](respondWithResult(_0x25454a,0xc9))[_0xd20a('0x42')](handleError(_0x25454a,null));};exports['update']=function(_0x3cbf6b,_0x13f821){if(_0x3cbf6b[_0xd20a('0x4a')]['id']){delete _0x3cbf6b['body']['id'];}return db[_0xd20a('0x2b')][_0xd20a('0x48')]({'where':{'id':_0x3cbf6b[_0xd20a('0x43')]['id']}})[_0xd20a('0x24')](handleEntityNotFound(_0x13f821,null))[_0xd20a('0x24')](saveUpdates(_0x3cbf6b[_0xd20a('0x4a')],null))[_0xd20a('0x24')](respondWithResult(_0x13f821,null))[_0xd20a('0x42')](handleError(_0x13f821,null));};exports[_0xd20a('0x25')]=function(_0x2f43db,_0x2d2c4f){return db['SalesforceConfiguration'][_0xd20a('0x48')]({'where':{'id':_0x2f43db[_0xd20a('0x43')]['id']}})[_0xd20a('0x24')](handleEntityNotFound(_0x2d2c4f,null))[_0xd20a('0x24')](removeEntity(_0x2d2c4f,null))[_0xd20a('0x42')](handleError(_0x2d2c4f,null));};exports[_0xd20a('0x4b')]=function(_0x3c5832,_0x545c5a,_0x2cbaa4){var _0xe12b54={};var _0x55e7c2={};var _0x26cd7b;var _0x31a4d1;return db[_0xd20a('0x2b')][_0xd20a('0x4c')]({'where':{'id':_0x3c5832[_0xd20a('0x43')]['id']}})[_0xd20a('0x24')](handleEntityNotFound(_0x545c5a,null))['then'](function(_0x423caf){if(_0x423caf){_0x26cd7b=_0x423caf;_0x55e7c2['model']=_[_0xd20a('0x32')](db['SalesforceField'][_0xd20a('0x2c')]);_0x55e7c2[_0xd20a('0x31')]=_[_0xd20a('0x32')](_0x3c5832[_0xd20a('0x31')]);_0x55e7c2[_0xd20a('0x33')]=_[_0xd20a('0x34')](_0x55e7c2[_0xd20a('0x30')],_0x55e7c2[_0xd20a('0x31')]);_0xe12b54[_0xd20a('0x35')]=_[_0xd20a('0x34')](_0x55e7c2[_0xd20a('0x30')],qs['fields'](_0x3c5832['query'][_0xd20a('0x44')]));_0xe12b54['attributes']=_0xe12b54['attributes'][_0xd20a('0x45')]?_0xe12b54['attributes']:_0x55e7c2[_0xd20a('0x30')];_0xe12b54['order']=qs[_0xd20a('0x3a')](_0x3c5832[_0xd20a('0x31')]['sort']);_0xe12b54['where']=qs[_0xd20a('0x33')](_['pick'](_0x3c5832['query'],_0x55e7c2[_0xd20a('0x33')]));if(_0x3c5832[_0xd20a('0x31')][_0xd20a('0x3d')]){_0xe12b54[_0xd20a('0x3b')]=_[_0xd20a('0x3e')](_0xe12b54[_0xd20a('0x3b')],{'$or':_[_0xd20a('0x2a')](_0xe12b54[_0xd20a('0x35')],function(_0x1bcd9e){var _0x482d94={};_0x482d94[_0x1bcd9e]={'$like':'%'+_0x3c5832['query']['filter']+'%'};return _0x482d94;})});}_0xe12b54=_[_0xd20a('0x3e')]({},_0xe12b54,_0x3c5832[_0xd20a('0x47')]);return _0x26cd7b[_0xd20a('0x4b')](_0xe12b54);}})[_0xd20a('0x24')](function(_0x1b72f5){if(_0x1b72f5){_0x31a4d1=_0x1b72f5['length'];if(!_0x3c5832['query'][_0xd20a('0x36')](_0xd20a('0x37'))){_0xe12b54[_0xd20a('0x38')]=qs[_0xd20a('0x38')](_0x3c5832[_0xd20a('0x31')]['limit']);_0xe12b54[_0xd20a('0x39')]=qs[_0xd20a('0x39')](_0x3c5832[_0xd20a('0x31')][_0xd20a('0x39')]);}return _0x26cd7b['getFields'](_0xe12b54);}})[_0xd20a('0x24')](function(_0x2c513f){if(_0x2c513f){return _0x2c513f?{'count':_0x31a4d1,'rows':_0x2c513f}:null;}})[_0xd20a('0x24')](respondWithResult(_0x545c5a,null))[_0xd20a('0x42')](handleError(_0x545c5a,null));};exports['getSubjects']=function(_0x1da9b0,_0xf24321,_0xb04769){var _0x29d3d5={};var _0x5b93e0={};var _0x42c1f3;var _0x14baa2;return db[_0xd20a('0x2b')][_0xd20a('0x4c')]({'where':{'id':_0x1da9b0[_0xd20a('0x43')]['id']}})['then'](handleEntityNotFound(_0xf24321,null))[_0xd20a('0x24')](function(_0x10b315){if(_0x10b315){_0x42c1f3=_0x10b315;_0x5b93e0[_0xd20a('0x30')]=_[_0xd20a('0x32')](db[_0xd20a('0x4d')][_0xd20a('0x2c')]);_0x5b93e0['query']=_['keys'](_0x1da9b0[_0xd20a('0x31')]);_0x5b93e0[_0xd20a('0x33')]=_[_0xd20a('0x34')](_0x5b93e0[_0xd20a('0x30')],_0x5b93e0[_0xd20a('0x31')]);_0x29d3d5[_0xd20a('0x35')]=_['intersection'](_0x5b93e0[_0xd20a('0x30')],qs[_0xd20a('0x44')](_0x1da9b0[_0xd20a('0x31')][_0xd20a('0x44')]));_0x29d3d5[_0xd20a('0x35')]=_0x29d3d5[_0xd20a('0x35')][_0xd20a('0x45')]?_0x29d3d5['attributes']:_0x5b93e0[_0xd20a('0x30')];_0x29d3d5[_0xd20a('0x4e')]=qs[_0xd20a('0x3a')](_0x1da9b0[_0xd20a('0x31')][_0xd20a('0x3a')]);_0x29d3d5['where']=qs['filters'](_[_0xd20a('0x3c')](_0x1da9b0[_0xd20a('0x31')],_0x5b93e0['filters']));if(_0x1da9b0['query'][_0xd20a('0x3d')]){_0x29d3d5[_0xd20a('0x3b')]=_['merge'](_0x29d3d5[_0xd20a('0x3b')],{'$or':_[_0xd20a('0x2a')](_0x29d3d5[_0xd20a('0x35')],function(_0x356be2){var _0x4e1ef3={};_0x4e1ef3[_0x356be2]={'$like':'%'+_0x1da9b0[_0xd20a('0x31')][_0xd20a('0x3d')]+'%'};return _0x4e1ef3;})});}_0x29d3d5=_[_0xd20a('0x3e')]({},_0x29d3d5,_0x1da9b0['options']);return _0x42c1f3[_0xd20a('0x4f')](_0x29d3d5);}})[_0xd20a('0x24')](function(_0x5c7959){if(_0x5c7959){_0x14baa2=_0x5c7959[_0xd20a('0x45')];if(!_0x1da9b0[_0xd20a('0x31')][_0xd20a('0x36')](_0xd20a('0x37'))){_0x29d3d5[_0xd20a('0x38')]=qs[_0xd20a('0x38')](_0x1da9b0[_0xd20a('0x31')][_0xd20a('0x38')]);_0x29d3d5[_0xd20a('0x39')]=qs[_0xd20a('0x39')](_0x1da9b0[_0xd20a('0x31')][_0xd20a('0x39')]);}return _0x42c1f3['getSubjects'](_0x29d3d5);}})[_0xd20a('0x24')](function(_0x454aef){if(_0x454aef){return _0x454aef?{'count':_0x14baa2,'rows':_0x454aef}:null;}})[_0xd20a('0x24')](respondWithResult(_0xf24321,null))['catch'](handleError(_0xf24321,null));};exports['getDescriptions']=function(_0x1e6540,_0x5c874a,_0x15db06){var _0x51d42f={};var _0x20c0b2={};var _0x1eec8a;var _0x42e42c;return db[_0xd20a('0x2b')][_0xd20a('0x4c')]({'where':{'id':_0x1e6540['params']['id']}})[_0xd20a('0x24')](handleEntityNotFound(_0x5c874a,null))[_0xd20a('0x24')](function(_0x243abb){if(_0x243abb){_0x1eec8a=_0x243abb;_0x20c0b2[_0xd20a('0x30')]=_[_0xd20a('0x32')](db['SalesforceField'][_0xd20a('0x2c')]);_0x20c0b2[_0xd20a('0x31')]=_[_0xd20a('0x32')](_0x1e6540['query']);_0x20c0b2[_0xd20a('0x33')]=_[_0xd20a('0x34')](_0x20c0b2['model'],_0x20c0b2[_0xd20a('0x31')]);_0x51d42f['attributes']=_[_0xd20a('0x34')](_0x20c0b2[_0xd20a('0x30')],qs[_0xd20a('0x44')](_0x1e6540['query'][_0xd20a('0x44')]));_0x51d42f[_0xd20a('0x35')]=_0x51d42f[_0xd20a('0x35')][_0xd20a('0x45')]?_0x51d42f[_0xd20a('0x35')]:_0x20c0b2[_0xd20a('0x30')];_0x51d42f['order']=qs[_0xd20a('0x3a')](_0x1e6540['query'][_0xd20a('0x3a')]);_0x51d42f['where']=qs['filters'](_['pick'](_0x1e6540['query'],_0x20c0b2[_0xd20a('0x33')]));if(_0x1e6540[_0xd20a('0x31')][_0xd20a('0x3d')]){_0x51d42f[_0xd20a('0x3b')]=_['merge'](_0x51d42f['where'],{'$or':_[_0xd20a('0x2a')](_0x51d42f[_0xd20a('0x35')],function(_0x11f739){var _0x1725ce={};_0x1725ce[_0x11f739]={'$like':'%'+_0x1e6540[_0xd20a('0x31')]['filter']+'%'};return _0x1725ce;})});}_0x51d42f=_[_0xd20a('0x3e')]({},_0x51d42f,_0x1e6540[_0xd20a('0x47')]);return _0x1eec8a[_0xd20a('0x50')](_0x51d42f);}})[_0xd20a('0x24')](function(_0x5db0af){if(_0x5db0af){_0x42e42c=_0x5db0af['length'];if(!_0x1e6540[_0xd20a('0x31')][_0xd20a('0x36')](_0xd20a('0x37'))){_0x51d42f[_0xd20a('0x38')]=qs['limit'](_0x1e6540['query']['limit']);_0x51d42f[_0xd20a('0x39')]=qs[_0xd20a('0x39')](_0x1e6540[_0xd20a('0x31')]['offset']);}return _0x1eec8a[_0xd20a('0x50')](_0x51d42f);}})[_0xd20a('0x24')](function(_0x8a29a1){if(_0x8a29a1){return _0x8a29a1?{'count':_0x42e42c,'rows':_0x8a29a1}:null;}})['then'](respondWithResult(_0x5c874a,null))[_0xd20a('0x42')](handleError(_0x5c874a,null));}; \ No newline at end of file +var _0x1404=['sort','where','pick','filters','filter','merge','options','count','include','rows','catch','show','rawAttributes','length','body','getFields','findOne','params','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../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','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','index','map','SalesforceConfiguration','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0x544a78,_0x11b0f2){var _0x4b7045=function(_0x550ef8){while(--_0x550ef8){_0x544a78['push'](_0x544a78['shift']());}};_0x4b7045(++_0x11b0f2);}(_0x1404,0x1e3));var _0x4140=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x1404[_0x4709c0];return _0x13348b;};'use strict';var emlformat=require(_0x4140('0x0'));var rimraf=require(_0x4140('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4140('0x2'));var moment=require(_0x4140('0x3'));var BPromise=require(_0x4140('0x4'));var Mustache=require(_0x4140('0x5'));var util=require(_0x4140('0x6'));var path=require(_0x4140('0x7'));var sox=require(_0x4140('0x8'));var csv=require(_0x4140('0x9'));var ejs=require(_0x4140('0xa'));var fs=require('fs');var fs_extra=require(_0x4140('0xb'));var _=require(_0x4140('0xc'));var squel=require('squel');var crypto=require(_0x4140('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4140('0x9'));var querystring=require('querystring');var Papa=require(_0x4140('0xe'));var Redis=require(_0x4140('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4140('0x10'));var as=require(_0x4140('0x11'));var hardwareService=require(_0x4140('0x12'));var logger=require(_0x4140('0x13'))(_0x4140('0x14'));var utils=require(_0x4140('0x15'));var config=require(_0x4140('0x16'));var licenseUtil=require(_0x4140('0x17'));var db=require(_0x4140('0x18'))['db'];function respondWithStatusCode(_0x1c83d3,_0x161f58){_0x161f58=_0x161f58||0xcc;return function(_0x1017ca){if(_0x1017ca){return _0x1c83d3['sendStatus'](_0x161f58);}return _0x1c83d3[_0x4140('0x19')](_0x161f58)[_0x4140('0x1a')]();};}function respondWithResult(_0x26dd67,_0xc6bc46){_0xc6bc46=_0xc6bc46||0xc8;return function(_0x2e50f9){if(_0x2e50f9){return _0x26dd67[_0x4140('0x19')](_0xc6bc46)[_0x4140('0x1b')](_0x2e50f9);}};}function respondWithFilteredResult(_0x4e74bb,_0x24727e){return function(_0x3f3527){if(_0x3f3527){var _0x49d91a=typeof _0x24727e[_0x4140('0x1c')]===_0x4140('0x1d')&&typeof _0x24727e[_0x4140('0x1e')]==='undefined';var _0x4011e1=_0x3f3527['count'];var _0x47b418=_0x49d91a?0x0:_0x24727e['offset'];var _0x359bf3=_0x49d91a?_0x3f3527['count']:_0x24727e[_0x4140('0x1c')]+_0x24727e['limit'];var _0x462e94;if(_0x359bf3>=_0x4011e1){_0x359bf3=_0x4011e1;_0x462e94=0xc8;}else{_0x462e94=0xce;}_0x4e74bb[_0x4140('0x19')](_0x462e94);return _0x4e74bb[_0x4140('0x1f')](_0x4140('0x20'),_0x47b418+'-'+_0x359bf3+'/'+_0x4011e1)[_0x4140('0x1b')](_0x3f3527);}return null;};}function patchUpdates(_0x5975e0){return function(_0x357d6c){try{jsonpatch['apply'](_0x357d6c,_0x5975e0,!![]);}catch(_0x236619){return BPromise[_0x4140('0x21')](_0x236619);}return _0x357d6c[_0x4140('0x22')]();};}function saveUpdates(_0x13e313,_0x46303a){return function(_0x278dde){if(_0x278dde){return _0x278dde[_0x4140('0x23')](_0x13e313)['then'](function(_0x592c87){return _0x592c87;});}return null;};}function removeEntity(_0x3b69ea,_0x5ae44b){return function(_0x54e0f1){if(_0x54e0f1){return _0x54e0f1[_0x4140('0x24')]()[_0x4140('0x25')](function(){_0x3b69ea[_0x4140('0x19')](0xcc)[_0x4140('0x1a')]();});}};}function handleEntityNotFound(_0xce140b,_0x2aa2fd){return function(_0x163695){if(!_0x163695){_0xce140b[_0x4140('0x26')](0x194);}return _0x163695;};}function handleError(_0x52f36d,_0x4d1880){_0x4d1880=_0x4d1880||0x1f4;return function(_0x32e372){logger[_0x4140('0x27')](_0x32e372[_0x4140('0x28')]);if(_0x32e372[_0x4140('0x29')]){delete _0x32e372[_0x4140('0x29')];}_0x52f36d[_0x4140('0x19')](_0x4d1880)['send'](_0x32e372);};}exports[_0x4140('0x2a')]=function(_0x1afd03,_0x2934bf){var _0x8adf20={},_0x170a2a={},_0x490fef={'count':0x0,'rows':[]};var _0x1cf728=_[_0x4140('0x2b')](db[_0x4140('0x2c')]['rawAttributes'],function(_0x72cd46){return{'name':_0x72cd46['fieldName'],'type':_0x72cd46[_0x4140('0x2d')][_0x4140('0x2e')]};});_0x170a2a['model']=_[_0x4140('0x2b')](_0x1cf728,_0x4140('0x29'));_0x170a2a[_0x4140('0x2f')]=_[_0x4140('0x30')](_0x1afd03[_0x4140('0x2f')]);_0x170a2a['filters']=_[_0x4140('0x31')](_0x170a2a[_0x4140('0x32')],_0x170a2a[_0x4140('0x2f')]);_0x8adf20['attributes']=_['intersection'](_0x170a2a['model'],qs[_0x4140('0x33')](_0x1afd03[_0x4140('0x2f')][_0x4140('0x33')]));_0x8adf20['attributes']=_0x8adf20[_0x4140('0x34')]['length']?_0x8adf20[_0x4140('0x34')]:_0x170a2a[_0x4140('0x32')];if(!_0x1afd03[_0x4140('0x2f')][_0x4140('0x35')](_0x4140('0x36'))){_0x8adf20[_0x4140('0x1e')]=qs[_0x4140('0x1e')](_0x1afd03['query'][_0x4140('0x1e')]);_0x8adf20[_0x4140('0x1c')]=qs[_0x4140('0x1c')](_0x1afd03[_0x4140('0x2f')][_0x4140('0x1c')]);}_0x8adf20[_0x4140('0x37')]=qs[_0x4140('0x38')](_0x1afd03['query']['sort']);_0x8adf20[_0x4140('0x39')]=qs['filters'](_[_0x4140('0x3a')](_0x1afd03['query'],_0x170a2a[_0x4140('0x3b')]),_0x1cf728);if(_0x1afd03[_0x4140('0x2f')][_0x4140('0x3c')]){_0x8adf20[_0x4140('0x39')]=_[_0x4140('0x3d')](_0x8adf20[_0x4140('0x39')],{'$or':_[_0x4140('0x2b')](_0x1cf728,function(_0x53243f){if(_0x53243f[_0x4140('0x2d')]!=='VIRTUAL'){var _0x119378={};_0x119378[_0x53243f[_0x4140('0x29')]]={'$like':'%'+_0x1afd03[_0x4140('0x2f')][_0x4140('0x3c')]+'%'};return _0x119378;}})});}_0x8adf20=_[_0x4140('0x3d')]({},_0x8adf20,_0x1afd03[_0x4140('0x3e')]);var _0x54dd7b={'where':_0x8adf20[_0x4140('0x39')]};return db[_0x4140('0x2c')][_0x4140('0x3f')](_0x54dd7b)['then'](function(_0x3d47f8){_0x490fef[_0x4140('0x3f')]=_0x3d47f8;if(_0x1afd03[_0x4140('0x2f')]['includeAll']){_0x8adf20[_0x4140('0x40')]=[{'all':!![]}];}return db[_0x4140('0x2c')]['findAll'](_0x8adf20);})[_0x4140('0x25')](function(_0x19270f){_0x490fef[_0x4140('0x41')]=_0x19270f;return _0x490fef;})['then'](respondWithFilteredResult(_0x2934bf,_0x8adf20))[_0x4140('0x42')](handleError(_0x2934bf,null));};exports[_0x4140('0x43')]=function(_0x2494ab,_0x5673b3){var _0x3bc3af={'raw':![],'where':{'id':_0x2494ab['params']['id']}},_0x3a549e={};_0x3a549e[_0x4140('0x32')]=_[_0x4140('0x30')](db['SalesforceConfiguration'][_0x4140('0x44')]);_0x3a549e['query']=_[_0x4140('0x30')](_0x2494ab['query']);_0x3a549e['filters']=_['intersection'](_0x3a549e['model'],_0x3a549e[_0x4140('0x2f')]);_0x3bc3af[_0x4140('0x34')]=_[_0x4140('0x31')](_0x3a549e[_0x4140('0x32')],qs[_0x4140('0x33')](_0x2494ab[_0x4140('0x2f')][_0x4140('0x33')]));_0x3bc3af[_0x4140('0x34')]=_0x3bc3af['attributes'][_0x4140('0x45')]?_0x3bc3af[_0x4140('0x34')]:_0x3a549e['model'];if(_0x2494ab[_0x4140('0x2f')]['includeAll']){_0x3bc3af[_0x4140('0x40')]=[{'all':!![]}];}_0x3bc3af=_[_0x4140('0x3d')]({},_0x3bc3af,_0x2494ab[_0x4140('0x3e')]);return db[_0x4140('0x2c')]['find'](_0x3bc3af)[_0x4140('0x25')](handleEntityNotFound(_0x5673b3,null))[_0x4140('0x25')](respondWithResult(_0x5673b3,null))['catch'](handleError(_0x5673b3,null));};exports['create']=function(_0x22ce8d,_0x4b108a){return db[_0x4140('0x2c')]['create'](_0x22ce8d[_0x4140('0x46')],{})[_0x4140('0x25')](respondWithResult(_0x4b108a,0xc9))[_0x4140('0x42')](handleError(_0x4b108a,null));};exports[_0x4140('0x23')]=function(_0xa33595,_0x34dfe2){if(_0xa33595[_0x4140('0x46')]['id']){delete _0xa33595[_0x4140('0x46')]['id'];}return db[_0x4140('0x2c')]['find']({'where':{'id':_0xa33595['params']['id']}})[_0x4140('0x25')](handleEntityNotFound(_0x34dfe2,null))['then'](saveUpdates(_0xa33595['body'],null))[_0x4140('0x25')](respondWithResult(_0x34dfe2,null))[_0x4140('0x42')](handleError(_0x34dfe2,null));};exports['destroy']=function(_0x5ddac1,_0x57152f){return db[_0x4140('0x2c')]['find']({'where':{'id':_0x5ddac1['params']['id']}})['then'](handleEntityNotFound(_0x57152f,null))['then'](removeEntity(_0x57152f,null))[_0x4140('0x42')](handleError(_0x57152f,null));};exports[_0x4140('0x47')]=function(_0x4fed96,_0x5e325d,_0x3503cc){var _0x2cf46c={};var _0x24c299={};var _0x202d56;var _0x22f8f9;return db['SalesforceConfiguration'][_0x4140('0x48')]({'where':{'id':_0x4fed96[_0x4140('0x49')]['id']}})[_0x4140('0x25')](handleEntityNotFound(_0x5e325d,null))['then'](function(_0x5e0ae9){if(_0x5e0ae9){_0x202d56=_0x5e0ae9;_0x24c299[_0x4140('0x32')]=_[_0x4140('0x30')](db[_0x4140('0x4a')][_0x4140('0x44')]);_0x24c299[_0x4140('0x2f')]=_[_0x4140('0x30')](_0x4fed96['query']);_0x24c299['filters']=_['intersection'](_0x24c299[_0x4140('0x32')],_0x24c299[_0x4140('0x2f')]);_0x2cf46c[_0x4140('0x34')]=_['intersection'](_0x24c299[_0x4140('0x32')],qs[_0x4140('0x33')](_0x4fed96[_0x4140('0x2f')][_0x4140('0x33')]));_0x2cf46c['attributes']=_0x2cf46c[_0x4140('0x34')]['length']?_0x2cf46c[_0x4140('0x34')]:_0x24c299[_0x4140('0x32')];_0x2cf46c[_0x4140('0x37')]=qs['sort'](_0x4fed96['query']['sort']);_0x2cf46c[_0x4140('0x39')]=qs[_0x4140('0x3b')](_[_0x4140('0x3a')](_0x4fed96[_0x4140('0x2f')],_0x24c299[_0x4140('0x3b')]));if(_0x4fed96[_0x4140('0x2f')][_0x4140('0x3c')]){_0x2cf46c[_0x4140('0x39')]=_[_0x4140('0x3d')](_0x2cf46c[_0x4140('0x39')],{'$or':_['map'](_0x2cf46c[_0x4140('0x34')],function(_0x3dba65){var _0x354bb1={};_0x354bb1[_0x3dba65]={'$like':'%'+_0x4fed96[_0x4140('0x2f')][_0x4140('0x3c')]+'%'};return _0x354bb1;})});}_0x2cf46c=_[_0x4140('0x3d')]({},_0x2cf46c,_0x4fed96[_0x4140('0x3e')]);return _0x202d56[_0x4140('0x47')](_0x2cf46c);}})[_0x4140('0x25')](function(_0x43b668){if(_0x43b668){_0x22f8f9=_0x43b668[_0x4140('0x45')];if(!_0x4fed96['query'][_0x4140('0x35')](_0x4140('0x36'))){_0x2cf46c[_0x4140('0x1e')]=qs[_0x4140('0x1e')](_0x4fed96['query']['limit']);_0x2cf46c[_0x4140('0x1c')]=qs[_0x4140('0x1c')](_0x4fed96[_0x4140('0x2f')][_0x4140('0x1c')]);}return _0x202d56[_0x4140('0x47')](_0x2cf46c);}})[_0x4140('0x25')](function(_0x5c7a06){if(_0x5c7a06){return _0x5c7a06?{'count':_0x22f8f9,'rows':_0x5c7a06}:null;}})[_0x4140('0x25')](respondWithResult(_0x5e325d,null))[_0x4140('0x42')](handleError(_0x5e325d,null));};exports[_0x4140('0x4b')]=function(_0x2e795c,_0x26e8fe,_0x330820){var _0x30020d={};var _0x3b104e={};var _0x12f817;var _0x36f17e;return db[_0x4140('0x2c')][_0x4140('0x48')]({'where':{'id':_0x2e795c[_0x4140('0x49')]['id']}})[_0x4140('0x25')](handleEntityNotFound(_0x26e8fe,null))[_0x4140('0x25')](function(_0x13f3d4){if(_0x13f3d4){_0x12f817=_0x13f3d4;_0x3b104e[_0x4140('0x32')]=_[_0x4140('0x30')](db['SalesforceField'][_0x4140('0x44')]);_0x3b104e[_0x4140('0x2f')]=_[_0x4140('0x30')](_0x2e795c[_0x4140('0x2f')]);_0x3b104e[_0x4140('0x3b')]=_[_0x4140('0x31')](_0x3b104e['model'],_0x3b104e['query']);_0x30020d['attributes']=_[_0x4140('0x31')](_0x3b104e[_0x4140('0x32')],qs['fields'](_0x2e795c['query'][_0x4140('0x33')]));_0x30020d[_0x4140('0x34')]=_0x30020d['attributes'][_0x4140('0x45')]?_0x30020d[_0x4140('0x34')]:_0x3b104e[_0x4140('0x32')];_0x30020d[_0x4140('0x37')]=qs[_0x4140('0x38')](_0x2e795c['query'][_0x4140('0x38')]);_0x30020d['where']=qs[_0x4140('0x3b')](_[_0x4140('0x3a')](_0x2e795c['query'],_0x3b104e[_0x4140('0x3b')]));if(_0x2e795c[_0x4140('0x2f')][_0x4140('0x3c')]){_0x30020d[_0x4140('0x39')]=_[_0x4140('0x3d')](_0x30020d['where'],{'$or':_[_0x4140('0x2b')](_0x30020d[_0x4140('0x34')],function(_0x1e2703){var _0x33ebe7={};_0x33ebe7[_0x1e2703]={'$like':'%'+_0x2e795c['query']['filter']+'%'};return _0x33ebe7;})});}_0x30020d=_[_0x4140('0x3d')]({},_0x30020d,_0x2e795c[_0x4140('0x3e')]);return _0x12f817['getSubjects'](_0x30020d);}})[_0x4140('0x25')](function(_0x548c1e){if(_0x548c1e){_0x36f17e=_0x548c1e['length'];if(!_0x2e795c['query'][_0x4140('0x35')]('nolimit')){_0x30020d[_0x4140('0x1e')]=qs[_0x4140('0x1e')](_0x2e795c['query']['limit']);_0x30020d['offset']=qs['offset'](_0x2e795c[_0x4140('0x2f')][_0x4140('0x1c')]);}return _0x12f817[_0x4140('0x4b')](_0x30020d);}})[_0x4140('0x25')](function(_0x273760){if(_0x273760){return _0x273760?{'count':_0x36f17e,'rows':_0x273760}:null;}})[_0x4140('0x25')](respondWithResult(_0x26e8fe,null))[_0x4140('0x42')](handleError(_0x26e8fe,null));};exports['getDescriptions']=function(_0x31d1b8,_0x405ccb,_0x23ab39){var _0x5394ff={};var _0x141423={};var _0x221bd2;var _0x579589;return db[_0x4140('0x2c')][_0x4140('0x48')]({'where':{'id':_0x31d1b8[_0x4140('0x49')]['id']}})[_0x4140('0x25')](handleEntityNotFound(_0x405ccb,null))[_0x4140('0x25')](function(_0x3b9245){if(_0x3b9245){_0x221bd2=_0x3b9245;_0x141423['model']=_['keys'](db[_0x4140('0x4a')][_0x4140('0x44')]);_0x141423[_0x4140('0x2f')]=_[_0x4140('0x30')](_0x31d1b8[_0x4140('0x2f')]);_0x141423['filters']=_[_0x4140('0x31')](_0x141423[_0x4140('0x32')],_0x141423['query']);_0x5394ff[_0x4140('0x34')]=_[_0x4140('0x31')](_0x141423[_0x4140('0x32')],qs[_0x4140('0x33')](_0x31d1b8['query'][_0x4140('0x33')]));_0x5394ff[_0x4140('0x34')]=_0x5394ff[_0x4140('0x34')]['length']?_0x5394ff['attributes']:_0x141423[_0x4140('0x32')];_0x5394ff[_0x4140('0x37')]=qs[_0x4140('0x38')](_0x31d1b8[_0x4140('0x2f')][_0x4140('0x38')]);_0x5394ff[_0x4140('0x39')]=qs[_0x4140('0x3b')](_['pick'](_0x31d1b8[_0x4140('0x2f')],_0x141423['filters']));if(_0x31d1b8['query'][_0x4140('0x3c')]){_0x5394ff[_0x4140('0x39')]=_[_0x4140('0x3d')](_0x5394ff[_0x4140('0x39')],{'$or':_['map'](_0x5394ff['attributes'],function(_0x59f454){var _0x2be22d={};_0x2be22d[_0x59f454]={'$like':'%'+_0x31d1b8[_0x4140('0x2f')][_0x4140('0x3c')]+'%'};return _0x2be22d;})});}_0x5394ff=_[_0x4140('0x3d')]({},_0x5394ff,_0x31d1b8['options']);return _0x221bd2[_0x4140('0x4c')](_0x5394ff);}})[_0x4140('0x25')](function(_0x185b11){if(_0x185b11){_0x579589=_0x185b11['length'];if(!_0x31d1b8[_0x4140('0x2f')][_0x4140('0x35')]('nolimit')){_0x5394ff[_0x4140('0x1e')]=qs[_0x4140('0x1e')](_0x31d1b8[_0x4140('0x2f')][_0x4140('0x1e')]);_0x5394ff[_0x4140('0x1c')]=qs['offset'](_0x31d1b8[_0x4140('0x2f')][_0x4140('0x1c')]);}return _0x221bd2[_0x4140('0x4c')](_0x5394ff);}})[_0x4140('0x25')](function(_0x43eadc){if(_0x43eadc){return _0x43eadc?{'count':_0x579589,'rows':_0x43eadc}:null;}})[_0x4140('0x25')](respondWithResult(_0x405ccb,null))[_0x4140('0x42')](handleError(_0x405ccb,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 65f6c3d..ceda132 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 _0x5ebb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api'];(function(_0x2315c1,_0x1c8ac0){var _0x4467a5=function(_0x140a98){while(--_0x140a98){_0x2315c1['push'](_0x2315c1['shift']());}};_0x4467a5(++_0x1c8ac0);}(_0x5ebb,0x189));var _0xb5eb=function(_0x4b9a1c,_0x76006b){_0x4b9a1c=_0x4b9a1c-0x0;var _0x4f0c6c=_0x5ebb[_0x4b9a1c];return _0x4f0c6c;};'use strict';var _=require(_0xb5eb('0x0'));var util=require('util');var logger=require(_0xb5eb('0x1'))(_0xb5eb('0x2'));var moment=require(_0xb5eb('0x3'));var BPromise=require(_0xb5eb('0x4'));var rp=require(_0xb5eb('0x5'));var fs=require('fs');var path=require(_0xb5eb('0x6'));var rimraf=require(_0xb5eb('0x7'));var config=require(_0xb5eb('0x8'));var attributes=require(_0xb5eb('0x9'));module['exports']=function(_0x50c327,_0x3b9429){return _0x50c327['define'](_0xb5eb('0xa'),attributes,{'tableName':_0xb5eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4885=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0x4885,0xcd));var _0x5488=function(_0x4a573d,_0x321e69){_0x4a573d=_0x4a573d-0x0;var _0x2d1a11=_0x4885[_0x4a573d];return _0x2d1a11;};'use strict';var _=require(_0x5488('0x0'));var util=require(_0x5488('0x1'));var logger=require(_0x5488('0x2'))(_0x5488('0x3'));var moment=require(_0x5488('0x4'));var BPromise=require(_0x5488('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5488('0x6'));var rimraf=require(_0x5488('0x7'));var config=require('../../config/environment');var attributes=require(_0x5488('0x8'));module['exports']=function(_0x34793e,_0x561298){return _0x34793e[_0x5488('0x9')](_0x5488('0xa'),attributes,{'tableName':_0x5488('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 55a4d95..28e533b 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 _0xb3e6=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb3e6,0xbd));var _0x6b3e=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0xb3e6[_0x13c70c];return _0x50f0f2;};'use strict';var _=require(_0x6b3e('0x0'));var util=require(_0x6b3e('0x1'));var moment=require(_0x6b3e('0x2'));var BPromise=require(_0x6b3e('0x3'));var rs=require(_0x6b3e('0x4'));var fs=require('fs');var Redis=require(_0x6b3e('0x5'));var db=require(_0x6b3e('0x6'))['db'];var utils=require(_0x6b3e('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6b3e('0x8'));var client=jayson[_0x6b3e('0x9')][_0x6b3e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14b0a3,_0x3eca46,_0x2a386e){return new BPromise(function(_0x156ac4,_0x2ca256){return client['request'](_0x14b0a3,_0x2a386e)[_0x6b3e('0xb')](function(_0x9abd1d){logger[_0x6b3e('0xc')](_0x6b3e('0xd'),_0x3eca46,'request\x20sent');logger[_0x6b3e('0xe')](_0x6b3e('0xf'),_0x3eca46,_0x6b3e('0x10'),JSON['stringify'](_0x9abd1d));if(_0x9abd1d['error']){if(_0x9abd1d[_0x6b3e('0x11')][_0x6b3e('0x12')]===0x1f4){logger[_0x6b3e('0x11')](_0x6b3e('0xd'),_0x3eca46,_0x9abd1d[_0x6b3e('0x11')][_0x6b3e('0x13')]);return _0x2ca256(_0x9abd1d[_0x6b3e('0x11')]['message']);}logger[_0x6b3e('0x11')](_0x6b3e('0xd'),_0x3eca46,_0x9abd1d[_0x6b3e('0x11')]['message']);return _0x156ac4(_0x9abd1d[_0x6b3e('0x11')][_0x6b3e('0x13')]);}else{logger[_0x6b3e('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3eca46,'request\x20sent');_0x156ac4(_0x9abd1d['result']['message']);}})[_0x6b3e('0x14')](function(_0x19ea4b){logger['error'](_0x6b3e('0xd'),_0x3eca46,_0x19ea4b);_0x2ca256(_0x19ea4b);});});} \ No newline at end of file +var _0x304a=['then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x304a,0x1ef));var _0xa304=function(_0x166014,_0x16eb11){_0x166014=_0x166014-0x0;var _0x722404=_0x304a[_0x166014];return _0x722404;};'use strict';var _=require(_0xa304('0x0'));var util=require('util');var moment=require(_0xa304('0x1'));var BPromise=require(_0xa304('0x2'));var rs=require(_0xa304('0x3'));var fs=require('fs');var Redis=require(_0xa304('0x4'));var db=require(_0xa304('0x5'))['db'];var utils=require(_0xa304('0x6'));var logger=require(_0xa304('0x7'))(_0xa304('0x8'));var config=require('../../config/environment');var jayson=require(_0xa304('0x9'));var client=jayson['client'][_0xa304('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd92177,_0x4e5d29,_0x4899c9){return new BPromise(function(_0x306ba1,_0x5eb5f5){return client['request'](_0xd92177,_0x4899c9)[_0xa304('0xb')](function(_0x2f5512){logger[_0xa304('0xc')](_0xa304('0xd'),_0x4e5d29,'request\x20sent');logger[_0xa304('0xe')](_0xa304('0xf'),_0x4e5d29,_0xa304('0x10'),JSON['stringify'](_0x2f5512));if(_0x2f5512[_0xa304('0x11')]){if(_0x2f5512['error'][_0xa304('0x12')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4e5d29,_0x2f5512['error']['message']);return _0x5eb5f5(_0x2f5512['error'][_0xa304('0x13')]);}logger[_0xa304('0x11')](_0xa304('0xd'),_0x4e5d29,_0x2f5512[_0xa304('0x11')]['message']);return _0x306ba1(_0x2f5512[_0xa304('0x11')][_0xa304('0x13')]);}else{logger[_0xa304('0xc')](_0xa304('0xd'),_0x4e5d29,_0xa304('0x10'));_0x306ba1(_0x2f5512[_0xa304('0x14')]['message']);}})[_0xa304('0x15')](function(_0x22f8b3){logger[_0xa304('0x11')](_0xa304('0xd'),_0x4e5d29,_0x22f8b3);_0x5eb5f5(_0x22f8b3);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index e89b5b2..3f82aee 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 _0x8663=['fs-extra','../../components/interaction/service','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0x8663,0x1aa));var _0x3866=function(_0x596b88,_0x9d8399){_0x596b88=_0x596b88-0x0;var _0x4a1bbb=_0x8663[_0x596b88];return _0x4a1bbb;};'use strict';var multer=require(_0x3866('0x0'));var util=require(_0x3866('0x1'));var path=require(_0x3866('0x2'));var timeout=require(_0x3866('0x3'));var express=require(_0x3866('0x4'));var router=express[_0x3866('0x5')]();var fs_extra=require(_0x3866('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3866('0x7'));var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3866('0x8')]);router['get'](_0x3866('0x9'),auth[_0x3866('0xa')](),controller[_0x3866('0xb')]);router[_0x3866('0xc')]('/',auth[_0x3866('0xa')](),controller[_0x3866('0xd')]);router['put'](_0x3866('0x9'),auth[_0x3866('0xa')](),controller[_0x3866('0xe')]);router[_0x3866('0xf')](_0x3866('0x9'),auth[_0x3866('0xa')](),controller[_0x3866('0x10')]);module[_0x3866('0x11')]=router; \ No newline at end of file +var _0xbaaa=['get','/:id','isAuthenticated','post','create','put','update','delete','multer','Router','../../components/interaction/service','../../config/environment'];(function(_0x46b021,_0x2cbb81){var _0x38b04e=function(_0x4ff0c1){while(--_0x4ff0c1){_0x46b021['push'](_0x46b021['shift']());}};_0x38b04e(++_0x2cbb81);}(_0xbaaa,0xb0));var _0xabaa=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xbaaa[_0x24f31b];return _0x488401;};'use strict';var multer=require(_0xabaa('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xabaa('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xabaa('0x2'));var config=require(_0xabaa('0x3'));var controller=require('./intSalesforceField.controller');router[_0xabaa('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0xabaa('0x4')](_0xabaa('0x5'),auth[_0xabaa('0x6')](),controller['show']);router[_0xabaa('0x7')]('/',auth['isAuthenticated'](),controller[_0xabaa('0x8')]);router[_0xabaa('0x9')]('/:id',auth[_0xabaa('0x6')](),controller[_0xabaa('0xa')]);router[_0xabaa('0xb')](_0xabaa('0x5'),auth[_0xabaa('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 740789c..f1f95b0 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 _0x7fe3=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0xce2274,_0xde39){var _0x148ecf=function(_0xf55b83){while(--_0xf55b83){_0xce2274['push'](_0xce2274['shift']());}};_0x148ecf(++_0xde39);}(_0x7fe3,0x130));var _0x37fe=function(_0x34e01b,_0x3792fd){_0x34e01b=_0x34e01b-0x0;var _0x3885ad=_0x7fe3[_0x34e01b];return _0x3885ad;};'use strict';var Sequelize=require('sequelize');module[_0x37fe('0x0')]={'type':{'type':Sequelize[_0x37fe('0x1')](_0x37fe('0x2'),_0x37fe('0x3'),_0x37fe('0x4'),_0x37fe('0x5'),_0x37fe('0x6')),'defaultValue':_0x37fe('0x2')},'content':{'type':Sequelize[_0x37fe('0x7')]},'key':{'type':Sequelize[_0x37fe('0x7')]},'keyType':{'type':Sequelize[_0x37fe('0x1')](_0x37fe('0x2'),_0x37fe('0x3'),_0x37fe('0x4'))},'keyContent':{'type':Sequelize[_0x37fe('0x7')]},'idField':{'type':Sequelize[_0x37fe('0x7')]},'variableName':{'type':Sequelize[_0x37fe('0x7')]}}; \ No newline at end of file +var _0x425d=['ENUM','string','customVariable','picklist','STRING','variable','sequelize','exports'];(function(_0x54e7a9,_0x1a79d7){var _0x4507a7=function(_0x1d6039){while(--_0x1d6039){_0x54e7a9['push'](_0x54e7a9['shift']());}};_0x4507a7(++_0x1a79d7);}(_0x425d,0xc6));var _0xd425=function(_0x2adbf8,_0x4afd45){_0x2adbf8=_0x2adbf8-0x0;var _0x4d8466=_0x425d[_0x2adbf8];return _0x4d8466;};'use strict';var Sequelize=require(_0xd425('0x0'));module[_0xd425('0x1')]={'type':{'type':Sequelize[_0xd425('0x2')](_0xd425('0x3'),'variable',_0xd425('0x4'),'keyValue',_0xd425('0x5')),'defaultValue':_0xd425('0x3')},'content':{'type':Sequelize[_0xd425('0x6')]},'key':{'type':Sequelize[_0xd425('0x6')]},'keyType':{'type':Sequelize[_0xd425('0x2')](_0xd425('0x3'),_0xd425('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xd425('0x6')]},'idField':{'type':Sequelize[_0xd425('0x6')]},'variableName':{'type':Sequelize[_0xd425('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 096d81e..0a44965 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 _0x3ef3=['include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','index','map','SalesforceField','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x1a8bbc,_0x17a086){var _0x212fc2=function(_0x55c718){while(--_0x55c718){_0x1a8bbc['push'](_0x1a8bbc['shift']());}};_0x212fc2(++_0x17a086);}(_0x3ef3,0xed));var _0x33ef=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x3ef3[_0x2e3545];return _0xcf18f;};'use strict';var emlformat=require(_0x33ef('0x0'));var rimraf=require(_0x33ef('0x1'));var zipdir=require(_0x33ef('0x2'));var jsonpatch=require(_0x33ef('0x3'));var rp=require('request-promise');var moment=require(_0x33ef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x33ef('0x5'));var util=require(_0x33ef('0x6'));var path=require(_0x33ef('0x7'));var sox=require(_0x33ef('0x8'));var csv=require(_0x33ef('0x9'));var ejs=require(_0x33ef('0xa'));var fs=require('fs');var fs_extra=require(_0x33ef('0xb'));var _=require(_0x33ef('0xc'));var squel=require(_0x33ef('0xd'));var crypto=require(_0x33ef('0xe'));var jsforce=require(_0x33ef('0xf'));var deskjs=require(_0x33ef('0x10'));var toCsv=require(_0x33ef('0x9'));var querystring=require(_0x33ef('0x11'));var Papa=require('papaparse');var Redis=require(_0x33ef('0x12'));var authService=require(_0x33ef('0x13'));var qs=require(_0x33ef('0x14'));var as=require(_0x33ef('0x15'));var hardwareService=require(_0x33ef('0x16'));var logger=require('../../config/logger')(_0x33ef('0x17'));var utils=require(_0x33ef('0x18'));var config=require(_0x33ef('0x19'));var licenseUtil=require(_0x33ef('0x1a'));var db=require(_0x33ef('0x1b'))['db'];function respondWithStatusCode(_0x3145b3,_0x3a637e){_0x3a637e=_0x3a637e||0xcc;return function(_0x50221f){if(_0x50221f){return _0x3145b3['sendStatus'](_0x3a637e);}return _0x3145b3[_0x33ef('0x1c')](_0x3a637e)[_0x33ef('0x1d')]();};}function respondWithResult(_0x128c5c,_0x45a688){_0x45a688=_0x45a688||0xc8;return function(_0x56ff21){if(_0x56ff21){return _0x128c5c[_0x33ef('0x1c')](_0x45a688)[_0x33ef('0x1e')](_0x56ff21);}};}function respondWithFilteredResult(_0x1a4897,_0x4a7cc4){return function(_0x16e04b){if(_0x16e04b){var _0x1e4e95=typeof _0x4a7cc4[_0x33ef('0x1f')]===_0x33ef('0x20')&&typeof _0x4a7cc4['limit']===_0x33ef('0x20');var _0x1e7e09=_0x16e04b[_0x33ef('0x21')];var _0x28f7c5=_0x1e4e95?0x0:_0x4a7cc4[_0x33ef('0x1f')];var _0x672a14=_0x1e4e95?_0x16e04b[_0x33ef('0x21')]:_0x4a7cc4[_0x33ef('0x1f')]+_0x4a7cc4[_0x33ef('0x22')];var _0x1cf8b0;if(_0x672a14>=_0x1e7e09){_0x672a14=_0x1e7e09;_0x1cf8b0=0xc8;}else{_0x1cf8b0=0xce;}_0x1a4897[_0x33ef('0x1c')](_0x1cf8b0);return _0x1a4897[_0x33ef('0x23')](_0x33ef('0x24'),_0x28f7c5+'-'+_0x672a14+'/'+_0x1e7e09)['json'](_0x16e04b);}return null;};}function patchUpdates(_0x5c26b2){return function(_0x25cf34){try{jsonpatch[_0x33ef('0x25')](_0x25cf34,_0x5c26b2,!![]);}catch(_0xae06fc){return BPromise[_0x33ef('0x26')](_0xae06fc);}return _0x25cf34[_0x33ef('0x27')]();};}function saveUpdates(_0x1b2d50,_0x460efd){return function(_0x4370ab){if(_0x4370ab){return _0x4370ab[_0x33ef('0x28')](_0x1b2d50)[_0x33ef('0x29')](function(_0x50513f){return _0x50513f;});}return null;};}function removeEntity(_0x24a62e,_0x23a1f7){return function(_0x20a2cd){if(_0x20a2cd){return _0x20a2cd['destroy']()[_0x33ef('0x29')](function(){_0x24a62e[_0x33ef('0x1c')](0xcc)[_0x33ef('0x1d')]();});}};}function handleEntityNotFound(_0x520c3a,_0x40feac){return function(_0x17014c){if(!_0x17014c){_0x520c3a[_0x33ef('0x2a')](0x194);}return _0x17014c;};}function handleError(_0x11fc78,_0xd62244){_0xd62244=_0xd62244||0x1f4;return function(_0x42c290){logger['error'](_0x42c290[_0x33ef('0x2b')]);if(_0x42c290[_0x33ef('0x2c')]){delete _0x42c290[_0x33ef('0x2c')];}_0x11fc78[_0x33ef('0x1c')](_0xd62244)['send'](_0x42c290);};}exports[_0x33ef('0x2d')]=function(_0xa984c4,_0x31ca8d){var _0x442fa2={},_0x404eed={},_0x5c9d25={'count':0x0,'rows':[]};var _0x14a9e8=_[_0x33ef('0x2e')](db[_0x33ef('0x2f')]['rawAttributes'],function(_0x5ac4ca){return{'name':_0x5ac4ca['fieldName'],'type':_0x5ac4ca[_0x33ef('0x30')][_0x33ef('0x31')]};});_0x404eed[_0x33ef('0x32')]=_[_0x33ef('0x2e')](_0x14a9e8,'name');_0x404eed[_0x33ef('0x33')]=_[_0x33ef('0x34')](_0xa984c4[_0x33ef('0x33')]);_0x404eed[_0x33ef('0x35')]=_['intersection'](_0x404eed[_0x33ef('0x32')],_0x404eed[_0x33ef('0x33')]);_0x442fa2[_0x33ef('0x36')]=_[_0x33ef('0x37')](_0x404eed[_0x33ef('0x32')],qs[_0x33ef('0x38')](_0xa984c4[_0x33ef('0x33')][_0x33ef('0x38')]));_0x442fa2[_0x33ef('0x36')]=_0x442fa2[_0x33ef('0x36')][_0x33ef('0x39')]?_0x442fa2[_0x33ef('0x36')]:_0x404eed[_0x33ef('0x32')];if(!_0xa984c4[_0x33ef('0x33')]['hasOwnProperty'](_0x33ef('0x3a'))){_0x442fa2[_0x33ef('0x22')]=qs[_0x33ef('0x22')](_0xa984c4[_0x33ef('0x33')]['limit']);_0x442fa2['offset']=qs[_0x33ef('0x1f')](_0xa984c4[_0x33ef('0x33')][_0x33ef('0x1f')]);}_0x442fa2['order']=qs['sort'](_0xa984c4[_0x33ef('0x33')][_0x33ef('0x3b')]);_0x442fa2[_0x33ef('0x3c')]=qs[_0x33ef('0x35')](_[_0x33ef('0x3d')](_0xa984c4['query'],_0x404eed[_0x33ef('0x35')]),_0x14a9e8);if(_0xa984c4['query'][_0x33ef('0x3e')]){_0x442fa2[_0x33ef('0x3c')]=_[_0x33ef('0x3f')](_0x442fa2[_0x33ef('0x3c')],{'$or':_[_0x33ef('0x2e')](_0x14a9e8,function(_0x9b6fd){if(_0x9b6fd[_0x33ef('0x30')]!==_0x33ef('0x40')){var _0xad57ff={};_0xad57ff[_0x9b6fd[_0x33ef('0x2c')]]={'$like':'%'+_0xa984c4[_0x33ef('0x33')][_0x33ef('0x3e')]+'%'};return _0xad57ff;}})});}_0x442fa2=_['merge']({},_0x442fa2,_0xa984c4[_0x33ef('0x41')]);var _0x2dfa9c={'where':_0x442fa2[_0x33ef('0x3c')]};return db[_0x33ef('0x2f')][_0x33ef('0x21')](_0x2dfa9c)[_0x33ef('0x29')](function(_0x13c20c){_0x5c9d25[_0x33ef('0x21')]=_0x13c20c;if(_0xa984c4[_0x33ef('0x33')][_0x33ef('0x42')]){_0x442fa2[_0x33ef('0x43')]=[{'all':!![]}];}return db[_0x33ef('0x2f')][_0x33ef('0x44')](_0x442fa2);})[_0x33ef('0x29')](function(_0x35a14a){_0x5c9d25['rows']=_0x35a14a;return _0x5c9d25;})[_0x33ef('0x29')](respondWithFilteredResult(_0x31ca8d,_0x442fa2))[_0x33ef('0x45')](handleError(_0x31ca8d,null));};exports[_0x33ef('0x46')]=function(_0x3d2687,_0x58ca17){var _0x58ecea={'raw':!![],'where':{'id':_0x3d2687[_0x33ef('0x47')]['id']}},_0x43afd4={};_0x43afd4[_0x33ef('0x32')]=_[_0x33ef('0x34')](db[_0x33ef('0x2f')][_0x33ef('0x48')]);_0x43afd4[_0x33ef('0x33')]=_[_0x33ef('0x34')](_0x3d2687['query']);_0x43afd4[_0x33ef('0x35')]=_[_0x33ef('0x37')](_0x43afd4['model'],_0x43afd4['query']);_0x58ecea[_0x33ef('0x36')]=_[_0x33ef('0x37')](_0x43afd4[_0x33ef('0x32')],qs['fields'](_0x3d2687['query'][_0x33ef('0x38')]));_0x58ecea[_0x33ef('0x36')]=_0x58ecea['attributes'][_0x33ef('0x39')]?_0x58ecea[_0x33ef('0x36')]:_0x43afd4[_0x33ef('0x32')];if(_0x3d2687[_0x33ef('0x33')][_0x33ef('0x42')]){_0x58ecea[_0x33ef('0x43')]=[{'all':!![]}];}_0x58ecea=_[_0x33ef('0x3f')]({},_0x58ecea,_0x3d2687[_0x33ef('0x41')]);return db[_0x33ef('0x2f')][_0x33ef('0x49')](_0x58ecea)[_0x33ef('0x29')](handleEntityNotFound(_0x58ca17,null))['then'](respondWithResult(_0x58ca17,null))[_0x33ef('0x45')](handleError(_0x58ca17,null));};exports['create']=function(_0x7afd26,_0x6f505c){return db[_0x33ef('0x2f')][_0x33ef('0x4a')](_0x7afd26[_0x33ef('0x4b')],{})[_0x33ef('0x29')](respondWithResult(_0x6f505c,0xc9))[_0x33ef('0x45')](handleError(_0x6f505c,null));};exports[_0x33ef('0x28')]=function(_0xb2dfd3,_0x3878bd){if(_0xb2dfd3['body']['id']){delete _0xb2dfd3[_0x33ef('0x4b')]['id'];}return db[_0x33ef('0x2f')]['find']({'where':{'id':_0xb2dfd3[_0x33ef('0x47')]['id']}})[_0x33ef('0x29')](handleEntityNotFound(_0x3878bd,null))[_0x33ef('0x29')](saveUpdates(_0xb2dfd3[_0x33ef('0x4b')],null))[_0x33ef('0x29')](respondWithResult(_0x3878bd,null))[_0x33ef('0x45')](handleError(_0x3878bd,null));};exports['destroy']=function(_0x2dc8c2,_0x2a9477){return db[_0x33ef('0x2f')]['find']({'where':{'id':_0x2dc8c2['params']['id']}})[_0x33ef('0x29')](handleEntityNotFound(_0x2a9477,null))[_0x33ef('0x29')](removeEntity(_0x2a9477,null))[_0x33ef('0x45')](handleError(_0x2a9477,null));}; \ No newline at end of file +var _0x9fe9=['crypto','jsforce','desk.js','../../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','limit','count','set','Content-Range','apply','reject','save','update','stack','index','map','SalesforceField','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','name','options','then','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x9fe9,0x1c6));var _0x99fe=function(_0x4e8100,_0xd7c46c){_0x4e8100=_0x4e8100-0x0;var _0x23fc87=_0x9fe9[_0x4e8100];return _0x23fc87;};'use strict';var emlformat=require(_0x99fe('0x0'));var rimraf=require(_0x99fe('0x1'));var zipdir=require(_0x99fe('0x2'));var jsonpatch=require(_0x99fe('0x3'));var rp=require('request-promise');var moment=require(_0x99fe('0x4'));var BPromise=require(_0x99fe('0x5'));var Mustache=require(_0x99fe('0x6'));var util=require(_0x99fe('0x7'));var path=require(_0x99fe('0x8'));var sox=require(_0x99fe('0x9'));var csv=require(_0x99fe('0xa'));var ejs=require(_0x99fe('0xb'));var fs=require('fs');var fs_extra=require(_0x99fe('0xc'));var _=require('lodash');var squel=require(_0x99fe('0xd'));var crypto=require(_0x99fe('0xe'));var jsforce=require(_0x99fe('0xf'));var deskjs=require(_0x99fe('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x99fe('0x11'));var qs=require(_0x99fe('0x12'));var as=require(_0x99fe('0x13'));var hardwareService=require(_0x99fe('0x14'));var logger=require('../../config/logger')(_0x99fe('0x15'));var utils=require(_0x99fe('0x16'));var config=require(_0x99fe('0x17'));var licenseUtil=require(_0x99fe('0x18'));var db=require(_0x99fe('0x19'))['db'];function respondWithStatusCode(_0xa9744d,_0x1b049e){_0x1b049e=_0x1b049e||0xcc;return function(_0x26bb3d){if(_0x26bb3d){return _0xa9744d[_0x99fe('0x1a')](_0x1b049e);}return _0xa9744d['status'](_0x1b049e)[_0x99fe('0x1b')]();};}function respondWithResult(_0x4f20b9,_0x1c5238){_0x1c5238=_0x1c5238||0xc8;return function(_0x507af7){if(_0x507af7){return _0x4f20b9[_0x99fe('0x1c')](_0x1c5238)[_0x99fe('0x1d')](_0x507af7);}};}function respondWithFilteredResult(_0x4c2c4e,_0x3748f7){return function(_0x2218ce){if(_0x2218ce){var _0x390447=typeof _0x3748f7[_0x99fe('0x1e')]===_0x99fe('0x1f')&&typeof _0x3748f7[_0x99fe('0x20')]==='undefined';var _0x1eedf1=_0x2218ce[_0x99fe('0x21')];var _0x17cb42=_0x390447?0x0:_0x3748f7[_0x99fe('0x1e')];var _0x33da4a=_0x390447?_0x2218ce[_0x99fe('0x21')]:_0x3748f7[_0x99fe('0x1e')]+_0x3748f7['limit'];var _0x42ef13;if(_0x33da4a>=_0x1eedf1){_0x33da4a=_0x1eedf1;_0x42ef13=0xc8;}else{_0x42ef13=0xce;}_0x4c2c4e[_0x99fe('0x1c')](_0x42ef13);return _0x4c2c4e[_0x99fe('0x22')](_0x99fe('0x23'),_0x17cb42+'-'+_0x33da4a+'/'+_0x1eedf1)[_0x99fe('0x1d')](_0x2218ce);}return null;};}function patchUpdates(_0x3b4e6e){return function(_0x441963){try{jsonpatch[_0x99fe('0x24')](_0x441963,_0x3b4e6e,!![]);}catch(_0x5bd1f4){return BPromise[_0x99fe('0x25')](_0x5bd1f4);}return _0x441963[_0x99fe('0x26')]();};}function saveUpdates(_0x29c2a2,_0x554577){return function(_0x34dc77){if(_0x34dc77){return _0x34dc77[_0x99fe('0x27')](_0x29c2a2)['then'](function(_0x4633d0){return _0x4633d0;});}return null;};}function removeEntity(_0x208ac7,_0xa75a0c){return function(_0x3f1e51){if(_0x3f1e51){return _0x3f1e51['destroy']()['then'](function(){_0x208ac7[_0x99fe('0x1c')](0xcc)[_0x99fe('0x1b')]();});}};}function handleEntityNotFound(_0x51b8d1,_0x3c9a69){return function(_0x5c8463){if(!_0x5c8463){_0x51b8d1[_0x99fe('0x1a')](0x194);}return _0x5c8463;};}function handleError(_0x45fde7,_0x4c2e76){_0x4c2e76=_0x4c2e76||0x1f4;return function(_0x5f8f28){logger['error'](_0x5f8f28[_0x99fe('0x28')]);if(_0x5f8f28['name']){delete _0x5f8f28['name'];}_0x45fde7['status'](_0x4c2e76)['send'](_0x5f8f28);};}exports[_0x99fe('0x29')]=function(_0x2ce49d,_0x265e15){var _0x1ca102={},_0x4a84cd={},_0x404c38={'count':0x0,'rows':[]};var _0x1298dc=_[_0x99fe('0x2a')](db[_0x99fe('0x2b')][_0x99fe('0x2c')],function(_0x1ae6d6){return{'name':_0x1ae6d6[_0x99fe('0x2d')],'type':_0x1ae6d6['type'][_0x99fe('0x2e')]};});_0x4a84cd['model']=_['map'](_0x1298dc,'name');_0x4a84cd[_0x99fe('0x2f')]=_['keys'](_0x2ce49d[_0x99fe('0x2f')]);_0x4a84cd[_0x99fe('0x30')]=_[_0x99fe('0x31')](_0x4a84cd[_0x99fe('0x32')],_0x4a84cd['query']);_0x1ca102[_0x99fe('0x33')]=_[_0x99fe('0x31')](_0x4a84cd[_0x99fe('0x32')],qs[_0x99fe('0x34')](_0x2ce49d[_0x99fe('0x2f')][_0x99fe('0x34')]));_0x1ca102[_0x99fe('0x33')]=_0x1ca102[_0x99fe('0x33')][_0x99fe('0x35')]?_0x1ca102[_0x99fe('0x33')]:_0x4a84cd['model'];if(!_0x2ce49d[_0x99fe('0x2f')][_0x99fe('0x36')](_0x99fe('0x37'))){_0x1ca102['limit']=qs['limit'](_0x2ce49d[_0x99fe('0x2f')][_0x99fe('0x20')]);_0x1ca102[_0x99fe('0x1e')]=qs['offset'](_0x2ce49d['query']['offset']);}_0x1ca102[_0x99fe('0x38')]=qs[_0x99fe('0x39')](_0x2ce49d[_0x99fe('0x2f')][_0x99fe('0x39')]);_0x1ca102['where']=qs[_0x99fe('0x30')](_[_0x99fe('0x3a')](_0x2ce49d['query'],_0x4a84cd[_0x99fe('0x30')]),_0x1298dc);if(_0x2ce49d[_0x99fe('0x2f')][_0x99fe('0x3b')]){_0x1ca102['where']=_[_0x99fe('0x3c')](_0x1ca102[_0x99fe('0x3d')],{'$or':_[_0x99fe('0x2a')](_0x1298dc,function(_0x37bb8c){if(_0x37bb8c['type']!==_0x99fe('0x3e')){var _0x5c4be6={};_0x5c4be6[_0x37bb8c[_0x99fe('0x3f')]]={'$like':'%'+_0x2ce49d[_0x99fe('0x2f')][_0x99fe('0x3b')]+'%'};return _0x5c4be6;}})});}_0x1ca102=_[_0x99fe('0x3c')]({},_0x1ca102,_0x2ce49d[_0x99fe('0x40')]);var _0x13404b={'where':_0x1ca102['where']};return db[_0x99fe('0x2b')][_0x99fe('0x21')](_0x13404b)[_0x99fe('0x41')](function(_0x1ad74e){_0x404c38[_0x99fe('0x21')]=_0x1ad74e;if(_0x2ce49d['query'][_0x99fe('0x42')]){_0x1ca102['include']=[{'all':!![]}];}return db[_0x99fe('0x2b')][_0x99fe('0x43')](_0x1ca102);})[_0x99fe('0x41')](function(_0x194449){_0x404c38[_0x99fe('0x44')]=_0x194449;return _0x404c38;})[_0x99fe('0x41')](respondWithFilteredResult(_0x265e15,_0x1ca102))['catch'](handleError(_0x265e15,null));};exports[_0x99fe('0x45')]=function(_0x1c88f4,_0x9ec056){var _0x363e22={'raw':!![],'where':{'id':_0x1c88f4[_0x99fe('0x46')]['id']}},_0x581995={};_0x581995[_0x99fe('0x32')]=_[_0x99fe('0x47')](db[_0x99fe('0x2b')][_0x99fe('0x2c')]);_0x581995['query']=_[_0x99fe('0x47')](_0x1c88f4[_0x99fe('0x2f')]);_0x581995[_0x99fe('0x30')]=_[_0x99fe('0x31')](_0x581995[_0x99fe('0x32')],_0x581995['query']);_0x363e22[_0x99fe('0x33')]=_[_0x99fe('0x31')](_0x581995['model'],qs[_0x99fe('0x34')](_0x1c88f4[_0x99fe('0x2f')][_0x99fe('0x34')]));_0x363e22[_0x99fe('0x33')]=_0x363e22['attributes'][_0x99fe('0x35')]?_0x363e22[_0x99fe('0x33')]:_0x581995[_0x99fe('0x32')];if(_0x1c88f4[_0x99fe('0x2f')]['includeAll']){_0x363e22[_0x99fe('0x48')]=[{'all':!![]}];}_0x363e22=_['merge']({},_0x363e22,_0x1c88f4[_0x99fe('0x40')]);return db[_0x99fe('0x2b')][_0x99fe('0x49')](_0x363e22)[_0x99fe('0x41')](handleEntityNotFound(_0x9ec056,null))['then'](respondWithResult(_0x9ec056,null))[_0x99fe('0x4a')](handleError(_0x9ec056,null));};exports[_0x99fe('0x4b')]=function(_0x1347c1,_0x3a5740){return db[_0x99fe('0x2b')][_0x99fe('0x4b')](_0x1347c1['body'],{})[_0x99fe('0x41')](respondWithResult(_0x3a5740,0xc9))['catch'](handleError(_0x3a5740,null));};exports[_0x99fe('0x27')]=function(_0x4627e3,_0x802000){if(_0x4627e3[_0x99fe('0x4c')]['id']){delete _0x4627e3[_0x99fe('0x4c')]['id'];}return db[_0x99fe('0x2b')][_0x99fe('0x49')]({'where':{'id':_0x4627e3['params']['id']}})['then'](handleEntityNotFound(_0x802000,null))['then'](saveUpdates(_0x4627e3['body'],null))[_0x99fe('0x41')](respondWithResult(_0x802000,null))['catch'](handleError(_0x802000,null));};exports[_0x99fe('0x4d')]=function(_0x18cdff,_0x158251){return db[_0x99fe('0x2b')][_0x99fe('0x49')]({'where':{'id':_0x18cdff[_0x99fe('0x46')]['id']}})['then'](handleEntityNotFound(_0x158251,null))['then'](removeEntity(_0x158251,null))[_0x99fe('0x4a')](handleError(_0x158251,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 9c37b52..d96c03b 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 _0x9e69=['bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','util','../../config/logger','api','moment'];(function(_0x1030aa,_0x2013cf){var _0x55bb14=function(_0x10bcf3){while(--_0x10bcf3){_0x1030aa['push'](_0x1030aa['shift']());}};_0x55bb14(++_0x2013cf);}(_0x9e69,0x1af));var _0x99e6=function(_0x596210,_0x4f80c7){_0x596210=_0x596210-0x0;var _0x10e57d=_0x9e69[_0x596210];return _0x10e57d;};'use strict';var _=require('lodash');var util=require(_0x99e6('0x0'));var logger=require(_0x99e6('0x1'))(_0x99e6('0x2'));var moment=require(_0x99e6('0x3'));var BPromise=require(_0x99e6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99e6('0x5'));var rimraf=require(_0x99e6('0x6'));var config=require(_0x99e6('0x7'));var attributes=require(_0x99e6('0x8'));module[_0x99e6('0x9')]=function(_0x1195f1,_0xf8377d){return _0x1195f1[_0x99e6('0xa')](_0x99e6('0xb'),attributes,{'tableName':_0x99e6('0xc'),'paranoid':![],'indexes':[{'name':_0x99e6('0xd'),'fields':['idField',_0x99e6('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x432c=['bluebird','request-promise','path','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','FieldId','lodash','../../config/logger','moment'];(function(_0x4e1926,_0x2415d6){var _0x85fa41=function(_0x3f3886){while(--_0x3f3886){_0x4e1926['push'](_0x4e1926['shift']());}};_0x85fa41(++_0x2415d6);}(_0x432c,0x15d));var _0xc432=function(_0x1776fe,_0x43b939){_0x1776fe=_0x1776fe-0x0;var _0x2dcc0c=_0x432c[_0x1776fe];return _0x2dcc0c;};'use strict';var _=require(_0xc432('0x0'));var util=require('util');var logger=require(_0xc432('0x1'))('api');var moment=require(_0xc432('0x2'));var BPromise=require(_0xc432('0x3'));var rp=require(_0xc432('0x4'));var fs=require('fs');var path=require(_0xc432('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc432('0x6'));module[_0xc432('0x7')]=function(_0x4e7c7f,_0x58be2e){return _0x4e7c7f['define'](_0xc432('0x8'),attributes,{'tableName':_0xc432('0x9'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0xc432('0xa')],'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 4d55dfc..2e0601e 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 _0x82ec=['stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug'];(function(_0x2e45fc,_0xcbd01a){var _0x3522e1=function(_0x41edd8){while(--_0x41edd8){_0x2e45fc['push'](_0x2e45fc['shift']());}};_0x3522e1(++_0xcbd01a);}(_0x82ec,0x118));var _0xc82e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x82ec[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc82e('0x0'));var util=require('util');var moment=require(_0xc82e('0x1'));var BPromise=require(_0xc82e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc82e('0x3'));var db=require(_0xc82e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc82e('0x5'))(_0xc82e('0x6'));var config=require(_0xc82e('0x7'));var jayson=require(_0xc82e('0x8'));var client=jayson[_0xc82e('0x9')][_0xc82e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17a5f0,_0x1466f2,_0x5f3080){return new BPromise(function(_0x25e257,_0x558268){return client['request'](_0x17a5f0,_0x5f3080)[_0xc82e('0xb')](function(_0x2f7809){logger['info']('SalesforceField,\x20%s,\x20%s',_0x1466f2,_0xc82e('0xc'));logger[_0xc82e('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1466f2,_0xc82e('0xc'),JSON[_0xc82e('0xe')](_0x2f7809));if(_0x2f7809['error']){if(_0x2f7809[_0xc82e('0xf')][_0xc82e('0x10')]===0x1f4){logger['error'](_0xc82e('0x11'),_0x1466f2,_0x2f7809['error'][_0xc82e('0x12')]);return _0x558268(_0x2f7809[_0xc82e('0xf')]['message']);}logger['error'](_0xc82e('0x11'),_0x1466f2,_0x2f7809[_0xc82e('0xf')][_0xc82e('0x12')]);return _0x25e257(_0x2f7809[_0xc82e('0xf')][_0xc82e('0x12')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x1466f2,_0xc82e('0xc'));_0x25e257(_0x2f7809[_0xc82e('0x13')][_0xc82e('0x12')]);}})[_0xc82e('0x14')](function(_0x46520b){logger[_0xc82e('0xf')](_0xc82e('0x11'),_0x1466f2,_0x46520b);_0x558268(_0x46520b);});});} \ No newline at end of file +var _0xc835=['message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','SalesforceField,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x9bfc94,_0x2c851a){var _0x202d9e=function(_0x338941){while(--_0x338941){_0x9bfc94['push'](_0x9bfc94['shift']());}};_0x202d9e(++_0x2c851a);}(_0xc835,0x15a));var _0x5c83=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0xc835[_0x295314];return _0x584b0c;};'use strict';var _=require(_0x5c83('0x0'));var util=require(_0x5c83('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c83('0x2'));var db=require(_0x5c83('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c83('0x4'))(_0x5c83('0x5'));var config=require(_0x5c83('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5c83('0x7')][_0x5c83('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e8441,_0x1dc182,_0x4280a5){return new BPromise(function(_0x14618e,_0x37ccd4){return client['request'](_0x3e8441,_0x4280a5)[_0x5c83('0x9')](function(_0x12f265){logger['info'](_0x5c83('0xa'),_0x1dc182,'request\x20sent');logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1dc182,_0x5c83('0xb'),JSON[_0x5c83('0xc')](_0x12f265));if(_0x12f265[_0x5c83('0xd')]){if(_0x12f265[_0x5c83('0xd')][_0x5c83('0xe')]===0x1f4){logger[_0x5c83('0xd')]('SalesforceField,\x20%s,\x20%s',_0x1dc182,_0x12f265['error'][_0x5c83('0xf')]);return _0x37ccd4(_0x12f265['error'][_0x5c83('0xf')]);}logger[_0x5c83('0xd')](_0x5c83('0xa'),_0x1dc182,_0x12f265['error'][_0x5c83('0xf')]);return _0x14618e(_0x12f265[_0x5c83('0xd')][_0x5c83('0xf')]);}else{logger[_0x5c83('0x10')](_0x5c83('0xa'),_0x1dc182,_0x5c83('0xb'));_0x14618e(_0x12f265[_0x5c83('0x11')][_0x5c83('0xf')]);}})[_0x5c83('0x12')](function(_0x26fcfb){logger[_0x5c83('0xd')](_0x5c83('0xa'),_0x1dc182,_0x26fcfb);_0x37ccd4(_0x26fcfb);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 230f13a..30295b0 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 _0xe829=['/:id','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get'];(function(_0x3b0912,_0x39d739){var _0xa8f339=function(_0x6a31ab){while(--_0x6a31ab){_0x3b0912['push'](_0x3b0912['shift']());}};_0xa8f339(++_0x39d739);}(_0xe829,0x1d8));var _0x9e82=function(_0x5abdfc,_0x385c27){_0x5abdfc=_0x5abdfc-0x0;var _0x124657=_0xe829[_0x5abdfc];return _0x124657;};'use strict';var multer=require(_0x9e82('0x0'));var util=require(_0x9e82('0x1'));var path=require(_0x9e82('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9e82('0x3')]();var fs_extra=require(_0x9e82('0x4'));var auth=require(_0x9e82('0x5'));var interaction=require(_0x9e82('0x6'));var config=require(_0x9e82('0x7'));var controller=require(_0x9e82('0x8'));router['get']('/',auth[_0x9e82('0x9')](),controller[_0x9e82('0xa')]);router[_0x9e82('0xb')](_0x9e82('0xc'),auth[_0x9e82('0x9')](),controller['show']);router[_0x9e82('0xb')]('/:id/configurations',auth[_0x9e82('0x9')](),controller[_0x9e82('0xd')]);router['get']('/:id/fields',auth[_0x9e82('0x9')](),controller[_0x9e82('0xe')]);router[_0x9e82('0xf')]('/',auth[_0x9e82('0x9')](),controller[_0x9e82('0x10')]);router[_0x9e82('0xf')](_0x9e82('0x11'),auth[_0x9e82('0x9')](),controller[_0x9e82('0x12')]);router[_0x9e82('0x13')](_0x9e82('0xc'),auth[_0x9e82('0x9')](),controller['update']);router['delete'](_0x9e82('0xc'),auth[_0x9e82('0x9')](),controller[_0x9e82('0x14')]);module[_0x9e82('0x15')]=router; \ No newline at end of file +var _0x0aaf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','update','exports','multer','util','path'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x0aaf,0x90));var _0xf0aa=function(_0x4911ed,_0x476941){_0x4911ed=_0x4911ed-0x0;var _0x230288=_0x0aaf[_0x4911ed];return _0x230288;};'use strict';var multer=require(_0xf0aa('0x0'));var util=require(_0xf0aa('0x1'));var path=require(_0xf0aa('0x2'));var timeout=require(_0xf0aa('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0aa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf0aa('0x5'));var config=require(_0xf0aa('0x6'));var controller=require(_0xf0aa('0x7'));router['get']('/',auth[_0xf0aa('0x8')](),controller[_0xf0aa('0x9')]);router['get'](_0xf0aa('0xa'),auth['isAuthenticated'](),controller[_0xf0aa('0xb')]);router['get'](_0xf0aa('0xc'),auth[_0xf0aa('0x8')](),controller[_0xf0aa('0xd')]);router['get'](_0xf0aa('0xe'),auth['isAuthenticated'](),controller[_0xf0aa('0xf')]);router['post']('/',auth[_0xf0aa('0x8')](),controller[_0xf0aa('0x10')]);router['post'](_0xf0aa('0xc'),auth[_0xf0aa('0x8')](),controller[_0xf0aa('0x11')]);router[_0xf0aa('0x12')](_0xf0aa('0xa'),auth['isAuthenticated'](),controller[_0xf0aa('0x13')]);router['delete']('/:id',auth[_0xf0aa('0x8')](),controller['destroy']);module[_0xf0aa('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 380f494..7a285dd 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 _0x60d6=['exports','STRING','username','remoteUri','sequelize'];(function(_0x20e581,_0xdd04f0){var _0x2d62d9=function(_0x237575){while(--_0x237575){_0x20e581['push'](_0x20e581['shift']());}};_0x2d62d9(++_0xdd04f0);}(_0x60d6,0x11c));var _0x660d=function(_0x56f87d,_0x5c999f){_0x56f87d=_0x56f87d-0x0;var _0x10d8c5=_0x60d6[_0x56f87d];return _0x10d8c5;};'use strict';var Sequelize=require(_0x660d('0x0'));module[_0x660d('0x1')]={'name':{'type':Sequelize[_0x660d('0x2')]},'description':{'type':Sequelize[_0x660d('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x660d('0x3')},'password':{'type':Sequelize[_0x660d('0x2')]},'email':{'type':Sequelize[_0x660d('0x2')]},'remoteUri':{'type':Sequelize[_0x660d('0x2')],'unique':_0x660d('0x4')},'serverUrl':{'type':Sequelize[_0x660d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xec1f=['STRING','remoteUri','sequelize','exports'];(function(_0x3f9bd1,_0x339cbb){var _0xd2bb6a=function(_0x25f67d){while(--_0x25f67d){_0x3f9bd1['push'](_0x3f9bd1['shift']());}};_0xd2bb6a(++_0x339cbb);}(_0xec1f,0xba));var _0xfec1=function(_0x3c50ce,_0x452573){_0x3c50ce=_0x3c50ce-0x0;var _0x12a852=_0xec1f[_0x3c50ce];return _0x12a852;};'use strict';var Sequelize=require(_0xfec1('0x0'));module[_0xfec1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfec1('0x2')]},'username':{'type':Sequelize[_0xfec1('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xfec1('0x2')]},'email':{'type':Sequelize[_0xfec1('0x2')]},'remoteUri':{'type':Sequelize[_0xfec1('0x2')],'unique':_0xfec1('0x3')},'serverUrl':{'type':Sequelize[_0xfec1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 7c30c7a..1c17e9f 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 _0x37a5=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','keys','model','intersection','fields','attributes','length','query','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','order','pick','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','knowledge','subcategory','notify','severity','category','watch_list','sys_updated_on','child_incidents','hold_reason','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','calendar_stc','closed_at','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','close_code','work_start','business_stc','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','reassignment_count','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','concat','ServiceNow\x20error:\x20','test','statusCode','error','send','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x389e20,_0x49a0bd){var _0x32b7ab=function(_0x2c0c63){while(--_0x2c0c63){_0x389e20['push'](_0x389e20['shift']());}};_0x32b7ab(++_0x49a0bd);}(_0x37a5,0x147));var _0x537a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x37a5[_0x1caf6a];return _0x1bf493;};'use strict';var emlformat=require(_0x537a('0x0'));var rimraf=require(_0x537a('0x1'));var zipdir=require(_0x537a('0x2'));var jsonpatch=require(_0x537a('0x3'));var rp=require('request-promise');var moment=require(_0x537a('0x4'));var BPromise=require(_0x537a('0x5'));var Mustache=require('mustache');var util=require(_0x537a('0x6'));var path=require(_0x537a('0x7'));var sox=require(_0x537a('0x8'));var csv=require(_0x537a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x537a('0xa'));var _=require(_0x537a('0xb'));var squel=require(_0x537a('0xc'));var crypto=require(_0x537a('0xd'));var jsforce=require(_0x537a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x537a('0x9'));var querystring=require(_0x537a('0xf'));var Papa=require(_0x537a('0x10'));var Redis=require('ioredis');var authService=require(_0x537a('0x11'));var qs=require(_0x537a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x537a('0x13'));var logger=require('../../config/logger')(_0x537a('0x14'));var utils=require(_0x537a('0x15'));var config=require(_0x537a('0x16'));var licenseUtil=require(_0x537a('0x17'));var db=require(_0x537a('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3b6e6c,_0xc9412c){_0xc9412c=_0xc9412c||0xcc;return function(_0x1cdd0f){if(_0x1cdd0f){return _0x3b6e6c[_0x537a('0x19')](_0xc9412c);}return _0x3b6e6c[_0x537a('0x1a')](_0xc9412c)[_0x537a('0x1b')]();};}function respondWithResult(_0x269397,_0x1ad7e7){_0x1ad7e7=_0x1ad7e7||0xc8;return function(_0x3d76f5){if(_0x3d76f5){return _0x269397[_0x537a('0x1a')](_0x1ad7e7)[_0x537a('0x1c')](_0x3d76f5);}};}function respondWithFilteredResult(_0x32eb90,_0x5508cb){return function(_0x24bc7f){if(_0x24bc7f){var _0x2c16aa=typeof _0x5508cb[_0x537a('0x1d')]===_0x537a('0x1e')&&typeof _0x5508cb[_0x537a('0x1f')]===_0x537a('0x1e');var _0x39f2e8=_0x24bc7f[_0x537a('0x20')];var _0x26445c=_0x2c16aa?0x0:_0x5508cb[_0x537a('0x1d')];var _0x4e52cf=_0x2c16aa?_0x24bc7f[_0x537a('0x20')]:_0x5508cb[_0x537a('0x1d')]+_0x5508cb[_0x537a('0x1f')];var _0x2b812d;if(_0x4e52cf>=_0x39f2e8){_0x4e52cf=_0x39f2e8;_0x2b812d=0xc8;}else{_0x2b812d=0xce;}_0x32eb90[_0x537a('0x1a')](_0x2b812d);return _0x32eb90[_0x537a('0x21')](_0x537a('0x22'),_0x26445c+'-'+_0x4e52cf+'/'+_0x39f2e8)[_0x537a('0x1c')](_0x24bc7f);}return null;};}function patchUpdates(_0x5b5212){return function(_0x1b1f39){try{jsonpatch['apply'](_0x1b1f39,_0x5b5212,!![]);}catch(_0x36df4d){return BPromise['reject'](_0x36df4d);}return _0x1b1f39[_0x537a('0x23')]();};}function saveUpdates(_0x5c6993,_0x12189b){return function(_0x554e2f){if(_0x554e2f){return _0x554e2f[_0x537a('0x24')](_0x5c6993)[_0x537a('0x25')](function(_0x23ffcd){return _0x23ffcd;});}return null;};}function removeEntity(_0x1dbcf0,_0x3414a0){return function(_0x1ca7b1){if(_0x1ca7b1){return _0x1ca7b1['destroy']()[_0x537a('0x25')](function(){_0x1dbcf0[_0x537a('0x1a')](0xcc)[_0x537a('0x1b')]();});}};}function handleEntityNotFound(_0x139262,_0x42c787){return function(_0x528c3c){if(!_0x528c3c){_0x139262[_0x537a('0x19')](0x194);}return _0x528c3c;};}function handleError(_0x1bcd03,_0xc8b08f){_0xc8b08f=_0xc8b08f||0x1f4;return function(_0x12f261){logger['error'](_0x12f261[_0x537a('0x26')]);if(_0x12f261[_0x537a('0x27')]){delete _0x12f261[_0x537a('0x27')];}_0x1bcd03['status'](_0xc8b08f)['send'](_0x12f261);};}exports[_0x537a('0x28')]=function(_0x30578b,_0x50ca2c){var _0x2ab114={},_0x3e62db={},_0x1c8688={'count':0x0,'rows':[]};var _0x45da9c=_[_0x537a('0x29')](db[_0x537a('0x2a')][_0x537a('0x2b')],function(_0x1b3390){return{'name':_0x1b3390[_0x537a('0x2c')],'type':_0x1b3390[_0x537a('0x2d')][_0x537a('0x2e')]};});_0x3e62db['model']=_[_0x537a('0x29')](_0x45da9c,_0x537a('0x27'));_0x3e62db['query']=_[_0x537a('0x2f')](_0x30578b['query']);_0x3e62db['filters']=_['intersection'](_0x3e62db[_0x537a('0x30')],_0x3e62db['query']);_0x2ab114['attributes']=_[_0x537a('0x31')](_0x3e62db[_0x537a('0x30')],qs[_0x537a('0x32')](_0x30578b['query'][_0x537a('0x32')]));_0x2ab114[_0x537a('0x33')]=_0x2ab114[_0x537a('0x33')][_0x537a('0x34')]?_0x2ab114[_0x537a('0x33')]:_0x3e62db['model'];if(!_0x30578b[_0x537a('0x35')][_0x537a('0x36')]('nolimit')){_0x2ab114[_0x537a('0x1f')]=qs['limit'](_0x30578b['query'][_0x537a('0x1f')]);_0x2ab114[_0x537a('0x1d')]=qs['offset'](_0x30578b['query'][_0x537a('0x1d')]);}_0x2ab114['order']=qs['sort'](_0x30578b[_0x537a('0x35')][_0x537a('0x37')]);_0x2ab114[_0x537a('0x38')]=qs[_0x537a('0x39')](_['pick'](_0x30578b[_0x537a('0x35')],_0x3e62db[_0x537a('0x39')]),_0x45da9c);if(_0x30578b[_0x537a('0x35')][_0x537a('0x3a')]){_0x2ab114[_0x537a('0x38')]=_[_0x537a('0x3b')](_0x2ab114[_0x537a('0x38')],{'$or':_[_0x537a('0x29')](_0x45da9c,function(_0x56aea3){if(_0x56aea3[_0x537a('0x2d')]!==_0x537a('0x3c')){var _0x33b830={};_0x33b830[_0x56aea3[_0x537a('0x27')]]={'$like':'%'+_0x30578b[_0x537a('0x35')][_0x537a('0x3a')]+'%'};return _0x33b830;}})});}_0x2ab114=_[_0x537a('0x3b')]({},_0x2ab114,_0x30578b[_0x537a('0x3d')]);var _0x509ff8={'where':_0x2ab114['where']};return db['ServicenowAccount'][_0x537a('0x20')](_0x509ff8)['then'](function(_0x1247c2){_0x1c8688[_0x537a('0x20')]=_0x1247c2;if(_0x30578b[_0x537a('0x35')][_0x537a('0x3e')]){_0x2ab114[_0x537a('0x3f')]=[{'all':!![]}];}return db[_0x537a('0x2a')][_0x537a('0x40')](_0x2ab114);})[_0x537a('0x25')](function(_0x104dd4){_0x1c8688['rows']=_0x104dd4;return _0x1c8688;})[_0x537a('0x25')](respondWithFilteredResult(_0x50ca2c,_0x2ab114))[_0x537a('0x41')](handleError(_0x50ca2c,null));};exports['show']=function(_0x4b5884,_0x342174){var _0x53c868={'raw':![],'where':{'id':_0x4b5884[_0x537a('0x42')]['id']}},_0x48d753={};_0x48d753[_0x537a('0x30')]=_[_0x537a('0x2f')](db[_0x537a('0x2a')]['rawAttributes']);_0x48d753[_0x537a('0x35')]=_[_0x537a('0x2f')](_0x4b5884[_0x537a('0x35')]);_0x48d753[_0x537a('0x39')]=_['intersection'](_0x48d753[_0x537a('0x30')],_0x48d753['query']);_0x53c868[_0x537a('0x33')]=_[_0x537a('0x31')](_0x48d753[_0x537a('0x30')],qs[_0x537a('0x32')](_0x4b5884[_0x537a('0x35')][_0x537a('0x32')]));_0x53c868[_0x537a('0x33')]=_0x53c868[_0x537a('0x33')][_0x537a('0x34')]?_0x53c868[_0x537a('0x33')]:_0x48d753['model'];if(_0x4b5884[_0x537a('0x35')][_0x537a('0x3e')]){_0x53c868[_0x537a('0x3f')]=[{'all':!![]}];}_0x53c868=_[_0x537a('0x3b')]({},_0x53c868,_0x4b5884[_0x537a('0x3d')]);return db[_0x537a('0x2a')][_0x537a('0x43')](_0x53c868)[_0x537a('0x25')](handleEntityNotFound(_0x342174,null))['then'](respondWithResult(_0x342174,null))[_0x537a('0x41')](handleError(_0x342174,null));};exports[_0x537a('0x44')]=function(_0x3bfd10,_0x1c6e76){return db[_0x537a('0x2a')][_0x537a('0x44')](_0x3bfd10[_0x537a('0x45')],{})[_0x537a('0x25')](respondWithResult(_0x1c6e76,0xc9))[_0x537a('0x41')](handleError(_0x1c6e76,null));};exports[_0x537a('0x24')]=function(_0xf503a7,_0x2ab0ff){if(_0xf503a7[_0x537a('0x45')]['id']){delete _0xf503a7[_0x537a('0x45')]['id'];}return db[_0x537a('0x2a')]['find']({'where':{'id':_0xf503a7[_0x537a('0x42')]['id']}})[_0x537a('0x25')](handleEntityNotFound(_0x2ab0ff,null))[_0x537a('0x25')](saveUpdates(_0xf503a7[_0x537a('0x45')],null))['then'](respondWithResult(_0x2ab0ff,null))[_0x537a('0x41')](handleError(_0x2ab0ff,null));};exports[_0x537a('0x46')]=function(_0x583527,_0x182a15){return db[_0x537a('0x2a')][_0x537a('0x43')]({'where':{'id':_0x583527['params']['id']}})['then'](handleEntityNotFound(_0x182a15,null))[_0x537a('0x25')](removeEntity(_0x182a15,null))[_0x537a('0x41')](handleError(_0x182a15,null));};exports[_0x537a('0x47')]=function(_0x2288b6,_0x3b8bcc,_0x2a1176){var _0x48acbd={};var _0x2449e1={};var _0x2cd0c6;var _0x33a340;return db[_0x537a('0x2a')][_0x537a('0x48')]({'where':{'id':_0x2288b6[_0x537a('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b8bcc,null))[_0x537a('0x25')](function(_0x578e85){if(_0x578e85){_0x2cd0c6=_0x578e85;_0x2449e1[_0x537a('0x30')]=_[_0x537a('0x2f')](db[_0x537a('0x49')]['rawAttributes']);_0x2449e1[_0x537a('0x35')]=_['keys'](_0x2288b6['query']);_0x2449e1[_0x537a('0x39')]=_[_0x537a('0x31')](_0x2449e1[_0x537a('0x30')],_0x2449e1[_0x537a('0x35')]);_0x48acbd['attributes']=_[_0x537a('0x31')](_0x2449e1['model'],qs['fields'](_0x2288b6[_0x537a('0x35')]['fields']));_0x48acbd[_0x537a('0x33')]=_0x48acbd[_0x537a('0x33')][_0x537a('0x34')]?_0x48acbd[_0x537a('0x33')]:_0x2449e1[_0x537a('0x30')];_0x48acbd[_0x537a('0x4a')]=qs[_0x537a('0x37')](_0x2288b6['query']['sort']);_0x48acbd[_0x537a('0x38')]=qs[_0x537a('0x39')](_[_0x537a('0x4b')](_0x2288b6[_0x537a('0x35')],_0x2449e1[_0x537a('0x39')]));if(_0x2288b6['query'][_0x537a('0x3a')]){_0x48acbd[_0x537a('0x38')]=_[_0x537a('0x3b')](_0x48acbd[_0x537a('0x38')],{'$or':_[_0x537a('0x29')](_0x48acbd['attributes'],function(_0x2bc09e){var _0x4fe924={};_0x4fe924[_0x2bc09e]={'$like':'%'+_0x2288b6[_0x537a('0x35')][_0x537a('0x3a')]+'%'};return _0x4fe924;})});}_0x48acbd=_['merge']({},_0x48acbd,_0x2288b6[_0x537a('0x3d')]);return _0x2cd0c6[_0x537a('0x47')](_0x48acbd);}})['then'](function(_0x3961ef){if(_0x3961ef){_0x33a340=_0x3961ef[_0x537a('0x34')];if(!_0x2288b6[_0x537a('0x35')][_0x537a('0x36')](_0x537a('0x4c'))){_0x48acbd[_0x537a('0x1f')]=qs[_0x537a('0x1f')](_0x2288b6[_0x537a('0x35')]['limit']);_0x48acbd[_0x537a('0x1d')]=qs[_0x537a('0x1d')](_0x2288b6[_0x537a('0x35')]['offset']);}return _0x2cd0c6['getConfigurations'](_0x48acbd);}})[_0x537a('0x25')](function(_0x67b2ea){if(_0x67b2ea){return _0x67b2ea?{'count':_0x33a340,'rows':_0x67b2ea}:null;}})['then'](respondWithResult(_0x3b8bcc,null))['catch'](handleError(_0x3b8bcc,null));};exports['addConfiguration']=function(_0x51b0ca,_0x58f075,_0x26c033){if(_0x51b0ca['body']['id']){delete _0x51b0ca[_0x537a('0x45')]['id'];}return db[_0x537a('0x2a')][_0x537a('0x48')]({'where':{'id':_0x51b0ca[_0x537a('0x42')]['id']}})['then'](handleEntityNotFound(_0x58f075,null))[_0x537a('0x25')](function(_0x225076){if(_0x225076){_0x51b0ca[_0x537a('0x45')][_0x537a('0x4d')]=_0x225076['id'];_0x51b0ca[_0x537a('0x45')][_0x537a('0x4e')]=integrations[_0x537a('0x4f')](_0x51b0ca['body'][_0x537a('0x50')],_0x51b0ca[_0x537a('0x45')][_0x537a('0x2d')]);_0x51b0ca['body'][_0x537a('0x51')]=integrations[_0x537a('0x52')](_0x51b0ca['body'][_0x537a('0x50')],_0x51b0ca['body']['type']);return db[_0x537a('0x49')][_0x537a('0x44')](_0x51b0ca[_0x537a('0x45')],{'include':[{'model':db[_0x537a('0x53')],'as':_0x537a('0x4e')},{'model':db[_0x537a('0x53')],'as':_0x537a('0x51')}]});}return null;})['then'](respondWithResult(_0x58f075,null))[_0x537a('0x41')](handleError(_0x58f075,null));};exports[_0x537a('0x54')]=function(_0x408888,_0x184329,_0x679bb8){var _0x2fca2f=[_0x537a('0x55'),'hold_reason',_0x537a('0x56'),_0x537a('0x57'),'close_code',_0x537a('0x58'),'incident_state',_0x537a('0x59'),_0x537a('0x5a')];var _0x3a288b=['parent','made_sla','caused_by',_0x537a('0x5b'),'upon_reject',_0x537a('0x5c'),_0x537a('0x5d'),_0x537a('0x5e'),'approval_history','number',_0x537a('0x5f'),_0x537a('0x60'),'opened_by',_0x537a('0x61'),_0x537a('0x62'),_0x537a('0x63'),'state','sys_created_by',_0x537a('0x56'),_0x537a('0x4a'),_0x537a('0x64'),_0x537a('0x65'),'cmdb_ci',_0x537a('0x66'),'impact',_0x537a('0x67'),_0x537a('0x68'),_0x537a('0x69'),_0x537a('0x6a'),_0x537a('0x6b'),'rfc','time_worked','expected_start',_0x537a('0x6c'),'business_duration',_0x537a('0x6d'),_0x537a('0x6e'),_0x537a('0x6f'),_0x537a('0x70'),_0x537a('0x71'),_0x537a('0x72'),_0x537a('0x57'),'work_notes',_0x537a('0x73'),_0x537a('0x74'),'correlation_display','delivery_task',_0x537a('0x75'),'assignment_group',_0x537a('0x76'),'additional_assignee_list',_0x537a('0x77'),_0x537a('0x78'),'notify','sys_class_name',_0x537a('0x79'),_0x537a('0x7a'),_0x537a('0x7b'),_0x537a('0x7c'),_0x537a('0x7d'),_0x537a('0x7e'),_0x537a('0x7f'),_0x537a('0x80'),_0x537a('0x81'),'problem_id','company',_0x537a('0x82'),_0x537a('0x83'),_0x537a('0x84'),'severity','comments',_0x537a('0x85'),_0x537a('0x86'),_0x537a('0x87'),_0x537a('0x88'),_0x537a('0x89'),_0x537a('0x8a'),_0x537a('0x8b'),_0x537a('0x8c'),'upon_approval',_0x537a('0x8d'),'location','category'];var _0x30feea='';var _0x548103='';var _0x264f07=[];var _0x4bb5c8='';var _0x588614='';var _0x50d998=[];var _0xad9d34='';var _0x42ffda='';var _0x102423={};var _0x4a106a='';return db[_0x537a('0x2a')][_0x537a('0x48')]({'where':{'id':_0x408888[_0x537a('0x42')]['id']},'attributes':['id',_0x537a('0x8e'),_0x537a('0x8f'),_0x537a('0x90'),_0x537a('0x91'),_0x537a('0x92')]})[_0x537a('0x25')](handleEntityNotFound(_0x184329,null))['then'](function(_0x26257a){if(_0x26257a){_0x4a106a=_0x26257a['remoteUri'];var _0x2b3761=_0x4a106a['slice'](-0x1);if(_0x2b3761==='/'){_0x4a106a=_0x4a106a[_0x537a('0x93')](0x0,_0x4a106a[_0x537a('0x94')](_0x2b3761));}_0x42ffda=util['format']('%s/api/now/doc/table/schema/',_0x4a106a);_0xad9d34=util['format']('%s/api/now/table/',_0x4a106a);_0x102423={'user':_0x26257a[_0x537a('0x8e')],'pass':_0x26257a[_0x537a('0x8f')]};var _0x4d1382={'method':_0x537a('0x95'),'uri':_0x42ffda+_0x537a('0x96'),'auth':_0x102423,'json':!![]};return rp(_0x4d1382);}})[_0x537a('0x25')](function(_0x3a0f8d){if(_0x3a0f8d['result'][_0x537a('0x34')]>0x0){_0x30feea=_0x3a0f8d['result'];}console[_0x537a('0x97')](_0x537a('0x98'),_0x30feea);_0x50d998=[];_0x548103=Object[_0x537a('0x99')]([],_0x30feea);_[_0x537a('0x9a')](_0x548103,function(_0x5d61d1){return!_0x2fca2f[_0x537a('0x9b')](_0x5d61d1[_0x537a('0x27')]);});_0x548103[_0x537a('0x9c')](function(_0x2059d7){var _0x3b6056=createFieldObject(_0xad9d34,_0x102423,_0x2059d7[_0x537a('0x9d')],_0x2059d7[_0x537a('0x27')],_0x2059d7[_0x537a('0x9e')],![]);_0x50d998[_0x537a('0x9f')](_0x3b6056);});return Promise[_0x537a('0xa0')](_0x50d998);})[_0x537a('0x25')](function(_0x15d168){_0x264f07=_0x15d168;_0x4bb5c8=Object['assign']([],_0x30feea);console[_0x537a('0x97')]('TCL:\x20_object',_0x30feea);_[_0x537a('0x9a')](_0x4bb5c8,function(_0x48fcb9){return _0x3a288b[_0x537a('0x9b')](_0x48fcb9['name']);});console[_0x537a('0x97')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x4bb5c8);_0x50d998=[];_0x4bb5c8[_0x537a('0x9c')](function(_0xadc27b){var _0x4a6699=createFieldObject(_0xad9d34,_0x102423,_0xadc27b[_0x537a('0x9d')],_0xadc27b[_0x537a('0x27')],_0xadc27b[_0x537a('0x9e')],!![]);_0x50d998['push'](_0x4a6699);});return Promise[_0x537a('0xa0')](_0x50d998);})[_0x537a('0x25')](function(_0x373910){_0x588614=_0x373910;var _0xc6b82a=_0x264f07[_0x537a('0xa1')](_0x588614);return{'count':_0xc6b82a['length'],'rows':_0xc6b82a};})[_0x537a('0x25')](respondWithResult(_0x184329,null))[_0x537a('0x41')](function(_0x618dd5){console[_0x537a('0x97')](_0x537a('0xa2')+_0x618dd5);var _0x4048ed=_0x408888['query'][_0x537a('0xa3')]?0x1f4:_0x618dd5[_0x537a('0xa4')]||0x1f4;logger[_0x537a('0xa5')](_0x618dd5[_0x537a('0x26')]);delete _0x618dd5[_0x537a('0x27')];if(_0x4048ed===0x191){_0x4048ed=0x190;}_0x184329['status'](_0x4048ed)[_0x537a('0xa6')](_0x408888[_0x537a('0x35')][_0x537a('0xa3')]?{'message':_0x537a('0xa7'),'statusCode':_0x618dd5[_0x537a('0xa4')]}:_0x618dd5);});};function createFieldObject(_0x17af2e,_0x429bd5,_0x100a86,_0x5d27c8,_0x35b2da,_0x111575){return new Promise(function(_0x163241,_0x5e03d5){var _0x49af4d={'id':_0x5d27c8,'name':_0x35b2da,'custom':_0x111575};if(_0x100a86==='boolean'){_0x49af4d[_0x537a('0x3d')]=[{'name':_0x537a('0xa8'),'value':_0x537a('0xa9')},{'name':_0x537a('0xaa'),'value':_0x537a('0xab')}];_0x163241(_0x49af4d);}else{var _0x4acd53={'method':_0x537a('0x95'),'uri':_0x17af2e+_0x537a('0xac')+_0x5d27c8,'auth':_0x429bd5,'json':!![]};return rp(_0x4acd53)['then'](function(_0x15ebdc){var _0x19b618=[];if(_0x15ebdc['result'][_0x537a('0x34')]>0x0){_0x15ebdc['result']['forEach'](function(_0x2ae9ff){if(_0x2ae9ff['inactive']===_0x537a('0xab')){var _0x413b93={'name':_0x2ae9ff['label'],'value':_0x2ae9ff[_0x537a('0xad')]};_0x19b618[_0x537a('0x9f')](_0x413b93);}});}_0x49af4d[_0x537a('0x3d')]=_0x19b618;if(_0x49af4d[_0x537a('0x3d')][_0x537a('0x34')]>0x0){_0x163241(_0x49af4d);}else{if(_0x111575==![]){_0x163241();}else{_0x163241(_0x49af4d);}}});}});} \ No newline at end of file +var _0xd29c=['../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','ServicenowAccount','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','subcategory','close_code','incident_state','category','caused_by','watch_list','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','sys_domain','state','sys_created_by','knowledge','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','opened_at','business_duration','work_end','resolved_at','caller_id','approval_set','short_description','work_start','assignment_group','business_stc','calendar_duration','notify','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','severity','comments','sla_due','reopen_count','sys_tags','upon_approval','correlation_id','username','password','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','label','concat','test','statusCode','stack','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x292ed8,_0x559b15){var _0x23ec52=function(_0x48d823){while(--_0x48d823){_0x292ed8['push'](_0x292ed8['shift']());}};_0x23ec52(++_0x559b15);}(_0xd29c,0x14e));var _0xcd29=function(_0x3065cf,_0x1297e5){_0x3065cf=_0x3065cf-0x0;var _0x16e4fa=_0xd29c[_0x3065cf];return _0x16e4fa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcd29('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd29('0x1'));var moment=require(_0xcd29('0x2'));var BPromise=require(_0xcd29('0x3'));var Mustache=require(_0xcd29('0x4'));var util=require(_0xcd29('0x5'));var path=require(_0xcd29('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcd29('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd29('0x8'));var squel=require(_0xcd29('0x9'));var crypto=require(_0xcd29('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcd29('0xb'));var toCsv=require(_0xcd29('0xc'));var querystring=require(_0xcd29('0xd'));var Papa=require(_0xcd29('0xe'));var Redis=require(_0xcd29('0xf'));var authService=require(_0xcd29('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcd29('0x11'));var hardwareService=require(_0xcd29('0x12'));var logger=require(_0xcd29('0x13'))(_0xcd29('0x14'));var utils=require(_0xcd29('0x15'));var config=require(_0xcd29('0x16'));var licenseUtil=require(_0xcd29('0x17'));var db=require(_0xcd29('0x18'))['db'];var integrations=require(_0xcd29('0x19'));function respondWithStatusCode(_0x15bb6f,_0x9d226b){_0x9d226b=_0x9d226b||0xcc;return function(_0x32ead1){if(_0x32ead1){return _0x15bb6f[_0xcd29('0x1a')](_0x9d226b);}return _0x15bb6f['status'](_0x9d226b)[_0xcd29('0x1b')]();};}function respondWithResult(_0x2e830a,_0x5d980c){_0x5d980c=_0x5d980c||0xc8;return function(_0x276695){if(_0x276695){return _0x2e830a['status'](_0x5d980c)[_0xcd29('0x1c')](_0x276695);}};}function respondWithFilteredResult(_0xdfb26,_0x3f6d35){return function(_0x1173fe){if(_0x1173fe){var _0x56c3fa=typeof _0x3f6d35[_0xcd29('0x1d')]===_0xcd29('0x1e')&&typeof _0x3f6d35[_0xcd29('0x1f')]==='undefined';var _0x4b01ed=_0x1173fe[_0xcd29('0x20')];var _0x5ba8c9=_0x56c3fa?0x0:_0x3f6d35['offset'];var _0x358103=_0x56c3fa?_0x1173fe['count']:_0x3f6d35[_0xcd29('0x1d')]+_0x3f6d35['limit'];var _0x3d5ec4;if(_0x358103>=_0x4b01ed){_0x358103=_0x4b01ed;_0x3d5ec4=0xc8;}else{_0x3d5ec4=0xce;}_0xdfb26[_0xcd29('0x21')](_0x3d5ec4);return _0xdfb26[_0xcd29('0x22')](_0xcd29('0x23'),_0x5ba8c9+'-'+_0x358103+'/'+_0x4b01ed)[_0xcd29('0x1c')](_0x1173fe);}return null;};}function patchUpdates(_0x58bbeb){return function(_0x323333){try{jsonpatch[_0xcd29('0x24')](_0x323333,_0x58bbeb,!![]);}catch(_0x4cadf0){return BPromise['reject'](_0x4cadf0);}return _0x323333[_0xcd29('0x25')]();};}function saveUpdates(_0x1807f4,_0x347597){return function(_0xade002){if(_0xade002){return _0xade002[_0xcd29('0x26')](_0x1807f4)[_0xcd29('0x27')](function(_0x2accc7){return _0x2accc7;});}return null;};}function removeEntity(_0x444162,_0x1cf4ff){return function(_0x553c3a){if(_0x553c3a){return _0x553c3a[_0xcd29('0x28')]()[_0xcd29('0x27')](function(){_0x444162[_0xcd29('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59107f,_0x2e688c){return function(_0x5a2abc){if(!_0x5a2abc){_0x59107f[_0xcd29('0x1a')](0x194);}return _0x5a2abc;};}function handleError(_0xc3abed,_0x414e28){_0x414e28=_0x414e28||0x1f4;return function(_0x2bd7ff){logger[_0xcd29('0x29')](_0x2bd7ff['stack']);if(_0x2bd7ff[_0xcd29('0x2a')]){delete _0x2bd7ff['name'];}_0xc3abed[_0xcd29('0x21')](_0x414e28)[_0xcd29('0x2b')](_0x2bd7ff);};}exports[_0xcd29('0x2c')]=function(_0x1788b3,_0xc2bb92){var _0x477531={},_0xda1ca3={},_0xe69d6d={'count':0x0,'rows':[]};var _0x5a1b7b=_[_0xcd29('0x2d')](db[_0xcd29('0x2e')][_0xcd29('0x2f')],function(_0x5656a8){return{'name':_0x5656a8['fieldName'],'type':_0x5656a8[_0xcd29('0x30')]['key']};});_0xda1ca3[_0xcd29('0x31')]=_[_0xcd29('0x2d')](_0x5a1b7b,_0xcd29('0x2a'));_0xda1ca3[_0xcd29('0x32')]=_['keys'](_0x1788b3[_0xcd29('0x32')]);_0xda1ca3[_0xcd29('0x33')]=_[_0xcd29('0x34')](_0xda1ca3[_0xcd29('0x31')],_0xda1ca3['query']);_0x477531['attributes']=_[_0xcd29('0x34')](_0xda1ca3[_0xcd29('0x31')],qs['fields'](_0x1788b3[_0xcd29('0x32')][_0xcd29('0x35')]));_0x477531[_0xcd29('0x36')]=_0x477531['attributes'][_0xcd29('0x37')]?_0x477531[_0xcd29('0x36')]:_0xda1ca3['model'];if(!_0x1788b3['query']['hasOwnProperty']('nolimit')){_0x477531['limit']=qs[_0xcd29('0x1f')](_0x1788b3[_0xcd29('0x32')][_0xcd29('0x1f')]);_0x477531[_0xcd29('0x1d')]=qs[_0xcd29('0x1d')](_0x1788b3['query'][_0xcd29('0x1d')]);}_0x477531[_0xcd29('0x38')]=qs[_0xcd29('0x39')](_0x1788b3[_0xcd29('0x32')][_0xcd29('0x39')]);_0x477531[_0xcd29('0x3a')]=qs[_0xcd29('0x33')](_[_0xcd29('0x3b')](_0x1788b3[_0xcd29('0x32')],_0xda1ca3[_0xcd29('0x33')]),_0x5a1b7b);if(_0x1788b3[_0xcd29('0x32')][_0xcd29('0x3c')]){_0x477531['where']=_[_0xcd29('0x3d')](_0x477531[_0xcd29('0x3a')],{'$or':_['map'](_0x5a1b7b,function(_0xe955a7){if(_0xe955a7[_0xcd29('0x30')]!==_0xcd29('0x3e')){var _0xc092a={};_0xc092a[_0xe955a7[_0xcd29('0x2a')]]={'$like':'%'+_0x1788b3[_0xcd29('0x32')][_0xcd29('0x3c')]+'%'};return _0xc092a;}})});}_0x477531=_[_0xcd29('0x3d')]({},_0x477531,_0x1788b3[_0xcd29('0x3f')]);var _0x4e3efc={'where':_0x477531[_0xcd29('0x3a')]};return db[_0xcd29('0x2e')]['count'](_0x4e3efc)[_0xcd29('0x27')](function(_0x126d6c){_0xe69d6d[_0xcd29('0x20')]=_0x126d6c;if(_0x1788b3[_0xcd29('0x32')][_0xcd29('0x40')]){_0x477531[_0xcd29('0x41')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xcd29('0x42')](_0x477531);})['then'](function(_0x282e9b){_0xe69d6d[_0xcd29('0x43')]=_0x282e9b;return _0xe69d6d;})[_0xcd29('0x27')](respondWithFilteredResult(_0xc2bb92,_0x477531))[_0xcd29('0x44')](handleError(_0xc2bb92,null));};exports[_0xcd29('0x45')]=function(_0x539d29,_0x474d79){var _0x1a73da={'raw':![],'where':{'id':_0x539d29[_0xcd29('0x46')]['id']}},_0xd5980a={};_0xd5980a[_0xcd29('0x31')]=_[_0xcd29('0x47')](db[_0xcd29('0x2e')][_0xcd29('0x2f')]);_0xd5980a[_0xcd29('0x32')]=_[_0xcd29('0x47')](_0x539d29['query']);_0xd5980a[_0xcd29('0x33')]=_['intersection'](_0xd5980a['model'],_0xd5980a[_0xcd29('0x32')]);_0x1a73da[_0xcd29('0x36')]=_[_0xcd29('0x34')](_0xd5980a[_0xcd29('0x31')],qs['fields'](_0x539d29[_0xcd29('0x32')][_0xcd29('0x35')]));_0x1a73da[_0xcd29('0x36')]=_0x1a73da[_0xcd29('0x36')][_0xcd29('0x37')]?_0x1a73da['attributes']:_0xd5980a[_0xcd29('0x31')];if(_0x539d29['query'][_0xcd29('0x40')]){_0x1a73da[_0xcd29('0x41')]=[{'all':!![]}];}_0x1a73da=_[_0xcd29('0x3d')]({},_0x1a73da,_0x539d29['options']);return db[_0xcd29('0x2e')][_0xcd29('0x48')](_0x1a73da)[_0xcd29('0x27')](handleEntityNotFound(_0x474d79,null))[_0xcd29('0x27')](respondWithResult(_0x474d79,null))['catch'](handleError(_0x474d79,null));};exports[_0xcd29('0x49')]=function(_0x5a9b46,_0x2956ac){return db[_0xcd29('0x2e')][_0xcd29('0x49')](_0x5a9b46[_0xcd29('0x4a')],{})[_0xcd29('0x27')](respondWithResult(_0x2956ac,0xc9))['catch'](handleError(_0x2956ac,null));};exports[_0xcd29('0x26')]=function(_0xe7bc8e,_0x58ef97){if(_0xe7bc8e[_0xcd29('0x4a')]['id']){delete _0xe7bc8e['body']['id'];}return db[_0xcd29('0x2e')][_0xcd29('0x48')]({'where':{'id':_0xe7bc8e['params']['id']}})[_0xcd29('0x27')](handleEntityNotFound(_0x58ef97,null))[_0xcd29('0x27')](saveUpdates(_0xe7bc8e[_0xcd29('0x4a')],null))[_0xcd29('0x27')](respondWithResult(_0x58ef97,null))[_0xcd29('0x44')](handleError(_0x58ef97,null));};exports[_0xcd29('0x28')]=function(_0x2f6efb,_0x57d236){return db['ServicenowAccount'][_0xcd29('0x48')]({'where':{'id':_0x2f6efb[_0xcd29('0x46')]['id']}})[_0xcd29('0x27')](handleEntityNotFound(_0x57d236,null))[_0xcd29('0x27')](removeEntity(_0x57d236,null))[_0xcd29('0x44')](handleError(_0x57d236,null));};exports[_0xcd29('0x4b')]=function(_0x1a6a97,_0x3153f6,_0x5c285d){var _0x3ae57b={};var _0x216b43={};var _0x4d7d10;var _0x572e07;return db[_0xcd29('0x2e')][_0xcd29('0x4c')]({'where':{'id':_0x1a6a97['params']['id']}})['then'](handleEntityNotFound(_0x3153f6,null))[_0xcd29('0x27')](function(_0x29635d){if(_0x29635d){_0x4d7d10=_0x29635d;_0x216b43[_0xcd29('0x31')]=_[_0xcd29('0x47')](db['ServicenowConfiguration'][_0xcd29('0x2f')]);_0x216b43[_0xcd29('0x32')]=_['keys'](_0x1a6a97[_0xcd29('0x32')]);_0x216b43[_0xcd29('0x33')]=_['intersection'](_0x216b43[_0xcd29('0x31')],_0x216b43[_0xcd29('0x32')]);_0x3ae57b[_0xcd29('0x36')]=_[_0xcd29('0x34')](_0x216b43[_0xcd29('0x31')],qs[_0xcd29('0x35')](_0x1a6a97[_0xcd29('0x32')][_0xcd29('0x35')]));_0x3ae57b[_0xcd29('0x36')]=_0x3ae57b[_0xcd29('0x36')][_0xcd29('0x37')]?_0x3ae57b[_0xcd29('0x36')]:_0x216b43[_0xcd29('0x31')];_0x3ae57b[_0xcd29('0x38')]=qs['sort'](_0x1a6a97[_0xcd29('0x32')][_0xcd29('0x39')]);_0x3ae57b['where']=qs[_0xcd29('0x33')](_[_0xcd29('0x3b')](_0x1a6a97['query'],_0x216b43[_0xcd29('0x33')]));if(_0x1a6a97[_0xcd29('0x32')]['filter']){_0x3ae57b[_0xcd29('0x3a')]=_[_0xcd29('0x3d')](_0x3ae57b[_0xcd29('0x3a')],{'$or':_[_0xcd29('0x2d')](_0x3ae57b[_0xcd29('0x36')],function(_0x24b06e){var _0x11857d={};_0x11857d[_0x24b06e]={'$like':'%'+_0x1a6a97['query']['filter']+'%'};return _0x11857d;})});}_0x3ae57b=_[_0xcd29('0x3d')]({},_0x3ae57b,_0x1a6a97[_0xcd29('0x3f')]);return _0x4d7d10['getConfigurations'](_0x3ae57b);}})[_0xcd29('0x27')](function(_0x5b32a1){if(_0x5b32a1){_0x572e07=_0x5b32a1['length'];if(!_0x1a6a97['query'][_0xcd29('0x4d')](_0xcd29('0x4e'))){_0x3ae57b[_0xcd29('0x1f')]=qs[_0xcd29('0x1f')](_0x1a6a97['query'][_0xcd29('0x1f')]);_0x3ae57b['offset']=qs[_0xcd29('0x1d')](_0x1a6a97[_0xcd29('0x32')][_0xcd29('0x1d')]);}return _0x4d7d10[_0xcd29('0x4b')](_0x3ae57b);}})[_0xcd29('0x27')](function(_0x48d2b6){if(_0x48d2b6){return _0x48d2b6?{'count':_0x572e07,'rows':_0x48d2b6}:null;}})[_0xcd29('0x27')](respondWithResult(_0x3153f6,null))[_0xcd29('0x44')](handleError(_0x3153f6,null));};exports['addConfiguration']=function(_0x408533,_0x24aaa7,_0x188c5d){if(_0x408533[_0xcd29('0x4a')]['id']){delete _0x408533[_0xcd29('0x4a')]['id'];}return db[_0xcd29('0x2e')]['findOne']({'where':{'id':_0x408533[_0xcd29('0x46')]['id']}})[_0xcd29('0x27')](handleEntityNotFound(_0x24aaa7,null))[_0xcd29('0x27')](function(_0x395197){if(_0x395197){_0x408533[_0xcd29('0x4a')][_0xcd29('0x4f')]=_0x395197['id'];_0x408533[_0xcd29('0x4a')][_0xcd29('0x50')]=integrations[_0xcd29('0x51')](_0x408533[_0xcd29('0x4a')][_0xcd29('0x52')],_0x408533['body']['type']);_0x408533['body'][_0xcd29('0x53')]=integrations[_0xcd29('0x54')](_0x408533[_0xcd29('0x4a')][_0xcd29('0x52')],_0x408533[_0xcd29('0x4a')][_0xcd29('0x30')]);return db[_0xcd29('0x55')][_0xcd29('0x49')](_0x408533[_0xcd29('0x4a')],{'include':[{'model':db['ServicenowField'],'as':_0xcd29('0x50')},{'model':db[_0xcd29('0x56')],'as':_0xcd29('0x53')}]});}return null;})[_0xcd29('0x27')](respondWithResult(_0x24aaa7,null))[_0xcd29('0x44')](handleError(_0x24aaa7,null));};exports[_0xcd29('0x57')]=function(_0x178557,_0x307524,_0x5570cc){var _0x4e8ecd=[_0xcd29('0x58'),_0xcd29('0x59'),'knowledge',_0xcd29('0x5a'),_0xcd29('0x5b'),'notify',_0xcd29('0x5c'),'severity',_0xcd29('0x5d')];var _0x407255=['parent',_0xcd29('0x58'),_0xcd29('0x5e'),_0xcd29('0x5f'),'upon_reject',_0xcd29('0x60'),_0xcd29('0x61'),_0xcd29('0x59'),'approval_history',_0xcd29('0x62'),_0xcd29('0x63'),_0xcd29('0x64'),'opened_by','user_input','sys_created_on',_0xcd29('0x65'),_0xcd29('0x66'),_0xcd29('0x67'),_0xcd29('0x68'),_0xcd29('0x38'),_0xcd29('0x69'),'closed_at',_0xcd29('0x6a'),_0xcd29('0x6b'),_0xcd29('0x6c'),_0xcd29('0x6d'),_0xcd29('0x6e'),_0xcd29('0x6f'),_0xcd29('0x70'),_0xcd29('0x71'),'rfc',_0xcd29('0x72'),'expected_start',_0xcd29('0x73'),_0xcd29('0x74'),'group_list',_0xcd29('0x75'),'reopened_time',_0xcd29('0x76'),_0xcd29('0x77'),_0xcd29('0x78'),'subcategory','work_notes',_0xcd29('0x79'),_0xcd29('0x5b'),'correlation_display','delivery_task',_0xcd29('0x7a'),_0xcd29('0x7b'),_0xcd29('0x7c'),'additional_assignee_list','description',_0xcd29('0x7d'),_0xcd29('0x7e'),'sys_class_name','close_notes',_0xcd29('0x7f'),_0xcd29('0x80'),_0xcd29('0x81'),_0xcd29('0x82'),_0xcd29('0x83'),_0xcd29('0x84'),'incident_state',_0xcd29('0x85'),'problem_id',_0xcd29('0x86'),_0xcd29('0x87'),_0xcd29('0x88'),'assigned_to',_0xcd29('0x89'),_0xcd29('0x8a'),_0xcd29('0x8b'),'approval','comments_and_work_notes','due_date','sys_mod_count',_0xcd29('0x8c'),_0xcd29('0x8d'),'escalation',_0xcd29('0x8e'),_0xcd29('0x8f'),'location',_0xcd29('0x5d')];var _0x243603='';var _0x510c37='';var _0x5a94dd=[];var _0x5a46cc='';var _0x478f9c='';var _0x531fd8=[];var _0x305395='';var _0x3dffbc='';var _0x475db9={};var _0x8b4575='';return db['ServicenowAccount'][_0xcd29('0x4c')]({'where':{'id':_0x178557['params']['id']},'attributes':['id',_0xcd29('0x90'),_0xcd29('0x91'),_0xcd29('0x92'),_0xcd29('0x93'),_0xcd29('0x94')]})[_0xcd29('0x27')](handleEntityNotFound(_0x307524,null))[_0xcd29('0x27')](function(_0x401af0){if(_0x401af0){_0x8b4575=_0x401af0[_0xcd29('0x93')];var _0x3f9e0d=_0x8b4575['slice'](-0x1);if(_0x3f9e0d==='/'){_0x8b4575=_0x8b4575[_0xcd29('0x95')](0x0,_0x8b4575[_0xcd29('0x96')](_0x3f9e0d));}_0x3dffbc=util[_0xcd29('0x97')](_0xcd29('0x98'),_0x8b4575);_0x305395=util['format'](_0xcd29('0x99'),_0x8b4575);_0x475db9={'user':_0x401af0[_0xcd29('0x90')],'pass':_0x401af0['password']};var _0x142df6={'method':_0xcd29('0x9a'),'uri':_0x3dffbc+_0xcd29('0x9b'),'auth':_0x475db9,'json':!![]};return rp(_0x142df6);}})[_0xcd29('0x27')](function(_0x52fdae){if(_0x52fdae['result'][_0xcd29('0x37')]>0x0){_0x243603=_0x52fdae[_0xcd29('0x9c')];}console[_0xcd29('0x9d')](_0xcd29('0x9e'),_0x243603);_0x531fd8=[];_0x510c37=Object[_0xcd29('0x9f')]([],_0x243603);_[_0xcd29('0xa0')](_0x510c37,function(_0x245a15){return!_0x4e8ecd[_0xcd29('0xa1')](_0x245a15['name']);});_0x510c37['forEach'](function(_0xf79af3){var _0x129119=createFieldObject(_0x305395,_0x475db9,_0xf79af3[_0xcd29('0xa2')],_0xf79af3[_0xcd29('0x2a')],_0xf79af3['label'],![]);_0x531fd8[_0xcd29('0xa3')](_0x129119);});return Promise[_0xcd29('0xa4')](_0x531fd8);})[_0xcd29('0x27')](function(_0xc980d2){_0x5a94dd=_0xc980d2;_0x5a46cc=Object[_0xcd29('0x9f')]([],_0x243603);console[_0xcd29('0x9d')](_0xcd29('0xa5'),_0x243603);_[_0xcd29('0xa0')](_0x5a46cc,function(_0x43e310){return _0x407255[_0xcd29('0xa1')](_0x43e310[_0xcd29('0x2a')]);});console[_0xcd29('0x9d')](_0xcd29('0xa6'),_0x5a46cc);_0x531fd8=[];_0x5a46cc[_0xcd29('0xa7')](function(_0x70d162){var _0x4e951f=createFieldObject(_0x305395,_0x475db9,_0x70d162[_0xcd29('0xa2')],_0x70d162[_0xcd29('0x2a')],_0x70d162[_0xcd29('0xa8')],!![]);_0x531fd8[_0xcd29('0xa3')](_0x4e951f);});return Promise[_0xcd29('0xa4')](_0x531fd8);})[_0xcd29('0x27')](function(_0xb1995c){_0x478f9c=_0xb1995c;var _0x55fecd=_0x5a94dd[_0xcd29('0xa9')](_0x478f9c);return{'count':_0x55fecd[_0xcd29('0x37')],'rows':_0x55fecd};})[_0xcd29('0x27')](respondWithResult(_0x307524,null))[_0xcd29('0x44')](function(_0x2a3932){console['log']('ServiceNow\x20error:\x20'+_0x2a3932);var _0x136032=_0x178557['query'][_0xcd29('0xaa')]?0x1f4:_0x2a3932[_0xcd29('0xab')]||0x1f4;logger[_0xcd29('0x29')](_0x2a3932[_0xcd29('0xac')]);delete _0x2a3932['name'];if(_0x136032===0x191){_0x136032=0x190;}_0x307524['status'](_0x136032)['send'](_0x178557[_0xcd29('0x32')][_0xcd29('0xaa')]?{'message':_0xcd29('0xad'),'statusCode':_0x2a3932[_0xcd29('0xab')]}:_0x2a3932);});};function createFieldObject(_0x3f2fdc,_0x5cc4e6,_0x14d7c0,_0x2d9071,_0x1a3a1a,_0xd201a2){return new Promise(function(_0x54a29f,_0x5a4dc6){var _0x38bf9c={'id':_0x2d9071,'name':_0x1a3a1a,'custom':_0xd201a2};if(_0x14d7c0===_0xcd29('0xae')){_0x38bf9c[_0xcd29('0x3f')]=[{'name':'True','value':_0xcd29('0xaf')},{'name':_0xcd29('0xb0'),'value':_0xcd29('0xb1')}];_0x54a29f(_0x38bf9c);}else{var _0x463a5f={'method':_0xcd29('0x9a'),'uri':_0x3f2fdc+_0xcd29('0xb2')+_0x2d9071,'auth':_0x5cc4e6,'json':!![]};return rp(_0x463a5f)['then'](function(_0x38467f){var _0x2decd8=[];if(_0x38467f[_0xcd29('0x9c')][_0xcd29('0x37')]>0x0){_0x38467f['result']['forEach'](function(_0x17f35d){if(_0x17f35d['inactive']===_0xcd29('0xb1')){var _0x468f7c={'name':_0x17f35d[_0xcd29('0xa8')],'value':_0x17f35d['value']};_0x2decd8['push'](_0x468f7c);}});}_0x38bf9c['options']=_0x2decd8;if(_0x38bf9c[_0xcd29('0x3f')]['length']>0x0){_0x54a29f(_0x38bf9c);}else{if(_0xd201a2==![]){_0x54a29f();}else{_0x54a29f(_0x38bf9c);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 84967c8..921bbfa 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','ServicenowAccount','int_servicenow_accounts'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2c0ded,_0x3de22c){_0x2c0ded=_0x2c0ded-0x0;var _0x4473e5=_0x5fc3[_0x2c0ded];return _0x4473e5;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));var integrations=require(_0x35fc('0x9'));module['exports']=function(_0x5754be,_0x19a0d1){return _0x5754be['define'](_0x35fc('0xa'),attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x53ec,0x192));var _0xc53e=function(_0x55b460,_0x497077){_0x55b460=_0x55b460-0x0;var _0x3ac537=_0x53ec[_0x55b460];return _0x3ac537;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc53e('0x9')]=function(_0x4f989b,_0x41a9e8){return _0x4f989b[_0xc53e('0xa')]('ServicenowAccount',attributes,{'tableName':_0xc53e('0xb'),'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 9756c6b..a1aca56 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 _0x5c34=['options','where','limit','include','map','model','ShowServicenowAccount','raw','attributes','lodash','util','moment','bluebird','randomstring','rpc','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x5c34,0x129));var _0x45c3=function(_0x3c2d05,_0x49017d){_0x3c2d05=_0x3c2d05-0x0;var _0xbcbea7=_0x5c34[_0x3c2d05];return _0xbcbea7;};'use strict';var _=require(_0x45c3('0x0'));var util=require(_0x45c3('0x1'));var moment=require(_0x45c3('0x2'));var BPromise=require(_0x45c3('0x3'));var rs=require(_0x45c3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x45c3('0x5'));var config=require('../../config/environment');var jayson=require(_0x45c3('0x6'));var client=jayson[_0x45c3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x370537,_0x3a8a48,_0x39ce31){return new BPromise(function(_0x3ff828,_0x37ab68){return client[_0x45c3('0x8')](_0x370537,_0x39ce31)[_0x45c3('0x9')](function(_0x954712){logger[_0x45c3('0xa')](_0x45c3('0xb'),_0x3a8a48,_0x45c3('0xc'));logger[_0x45c3('0xd')](_0x45c3('0xe'),_0x3a8a48,'request\x20sent',JSON[_0x45c3('0xf')](_0x954712));if(_0x954712['error']){if(_0x954712[_0x45c3('0x10')]['code']===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x3a8a48,_0x954712[_0x45c3('0x10')][_0x45c3('0x11')]);return _0x37ab68(_0x954712['error'][_0x45c3('0x11')]);}logger[_0x45c3('0x10')](_0x45c3('0xb'),_0x3a8a48,_0x954712['error']['message']);return _0x3ff828(_0x954712[_0x45c3('0x10')][_0x45c3('0x11')]);}else{logger[_0x45c3('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x3a8a48,_0x45c3('0xc'));_0x3ff828(_0x954712[_0x45c3('0x12')][_0x45c3('0x11')]);}})[_0x45c3('0x13')](function(_0x4ee4e5){logger[_0x45c3('0x10')](_0x45c3('0xb'),_0x3a8a48,_0x4ee4e5);_0x37ab68(_0x4ee4e5);});});}exports[_0x45c3('0x14')]=function(_0x2c593f){var _0x83c645=this;return new Promise(function(_0x358247,_0x31f53c){return db[_0x45c3('0x15')][_0x45c3('0x16')]({'raw':_0x2c593f['options']?_0x2c593f['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c593f[_0x45c3('0x17')]?_0x2c593f[_0x45c3('0x17')][_0x45c3('0x18')]||null:null,'attributes':_0x2c593f[_0x45c3('0x17')]?_0x2c593f[_0x45c3('0x17')]['attributes']||null:null,'limit':_0x2c593f[_0x45c3('0x17')]?_0x2c593f[_0x45c3('0x17')][_0x45c3('0x19')]||null:null,'include':_0x2c593f[_0x45c3('0x17')]?_0x2c593f[_0x45c3('0x17')][_0x45c3('0x1a')]?_[_0x45c3('0x1b')](_0x2c593f[_0x45c3('0x17')][_0x45c3('0x1a')],function(_0xdad278){return{'model':db[_0xdad278['model']],'as':_0xdad278['as'],'attributes':_0xdad278['attributes'],'include':_0xdad278[_0x45c3('0x1a')]?_['map'](_0xdad278[_0x45c3('0x1a')],function(_0xe58361){return{'model':db[_0xe58361[_0x45c3('0x1c')]],'as':_0xe58361['as'],'attributes':_0xe58361['attributes'],'include':_0xe58361['include']?_[_0x45c3('0x1b')](_0xe58361[_0x45c3('0x1a')],function(_0x357d50){return{'model':db[_0x357d50[_0x45c3('0x1c')]],'as':_0x357d50['as'],'attributes':_0x357d50['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x121dba){logger['info']('GetServicenowAccount',_0x2c593f);logger['debug'](_0x45c3('0x14'),_0x2c593f,JSON[_0x45c3('0xf')](_0x121dba));_0x358247(_0x121dba);})[_0x45c3('0x13')](function(_0x299929){logger[_0x45c3('0x10')]('GetServicenowAccount',_0x299929['message'],_0x2c593f);_0x31f53c(_0x83c645[_0x45c3('0x10')](0x1f4,_0x299929[_0x45c3('0x11')]));});});};exports[_0x45c3('0x1d')]=function(_0x3bc59d){var _0x50aa5e=this;return new Promise(function(_0x39fa81,_0x9184d6){return db[_0x45c3('0x15')]['find']({'raw':_0x3bc59d['options']?_0x3bc59d[_0x45c3('0x17')][_0x45c3('0x1e')]===undefined?!![]:![]:!![],'where':_0x3bc59d['options']?_0x3bc59d[_0x45c3('0x17')][_0x45c3('0x18')]||null:null,'attributes':_0x3bc59d[_0x45c3('0x17')]?_0x3bc59d[_0x45c3('0x17')][_0x45c3('0x1f')]||null:null,'include':_0x3bc59d[_0x45c3('0x17')]?_0x3bc59d[_0x45c3('0x17')][_0x45c3('0x1a')]?_[_0x45c3('0x1b')](_0x3bc59d[_0x45c3('0x17')]['include'],function(_0x3f71c0){return{'model':db[_0x3f71c0[_0x45c3('0x1c')]],'as':_0x3f71c0['as'],'attributes':_0x3f71c0['attributes'],'include':_0x3f71c0[_0x45c3('0x1a')]?_[_0x45c3('0x1b')](_0x3f71c0[_0x45c3('0x1a')],function(_0x121c03){return{'model':db[_0x121c03['model']],'as':_0x121c03['as'],'attributes':_0x121c03[_0x45c3('0x1f')],'include':_0x121c03[_0x45c3('0x1a')]?_[_0x45c3('0x1b')](_0x121c03['include'],function(_0x22b114){return{'model':db[_0x22b114[_0x45c3('0x1c')]],'as':_0x22b114['as'],'attributes':_0x22b114[_0x45c3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x45c3('0x9')](function(_0x43ba37){logger[_0x45c3('0xa')](_0x45c3('0x1d'),_0x3bc59d);logger['debug'](_0x45c3('0x1d'),_0x3bc59d,JSON[_0x45c3('0xf')](_0x43ba37));_0x39fa81(_0x43ba37);})[_0x45c3('0x13')](function(_0x5b63b0){logger[_0x45c3('0x10')]('ShowServicenowAccount',_0x5b63b0[_0x45c3('0x11')],_0x3bc59d);_0x9184d6(_0x50aa5e[_0x45c3('0x10')](0x1f4,_0x5b63b0[_0x45c3('0x11')]));});});}; \ No newline at end of file +var _0x2aad=['result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','find','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message'];(function(_0x25cfbb,_0x4a4740){var _0x2445b2=function(_0x461cf){while(--_0x461cf){_0x25cfbb['push'](_0x25cfbb['shift']());}};_0x2445b2(++_0x4a4740);}(_0x2aad,0xd4));var _0xd2aa=function(_0xcc04c2,_0x5d13cf){_0xcc04c2=_0xcc04c2-0x0;var _0x24c46b=_0x2aad[_0xcc04c2];return _0x24c46b;};'use strict';var _=require('lodash');var util=require(_0xd2aa('0x0'));var moment=require('moment');var BPromise=require(_0xd2aa('0x1'));var rs=require(_0xd2aa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2aa('0x3'))['db'];var utils=require(_0xd2aa('0x4'));var logger=require(_0xd2aa('0x5'))(_0xd2aa('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd2aa('0x7')][_0xd2aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26e9bd,_0x2cfea9,_0x5360f0){return new BPromise(function(_0x42212e,_0x24aeef){return client[_0xd2aa('0x9')](_0x26e9bd,_0x5360f0)[_0xd2aa('0xa')](function(_0x448aec){logger[_0xd2aa('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x2cfea9,_0xd2aa('0xc'));logger[_0xd2aa('0xd')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2cfea9,'request\x20sent',JSON[_0xd2aa('0xe')](_0x448aec));if(_0x448aec[_0xd2aa('0xf')]){if(_0x448aec['error'][_0xd2aa('0x10')]===0x1f4){logger[_0xd2aa('0xf')](_0xd2aa('0x11'),_0x2cfea9,_0x448aec[_0xd2aa('0xf')]['message']);return _0x24aeef(_0x448aec['error']['message']);}logger[_0xd2aa('0xf')](_0xd2aa('0x11'),_0x2cfea9,_0x448aec[_0xd2aa('0xf')][_0xd2aa('0x12')]);return _0x42212e(_0x448aec[_0xd2aa('0xf')][_0xd2aa('0x12')]);}else{logger[_0xd2aa('0xb')](_0xd2aa('0x11'),_0x2cfea9,_0xd2aa('0xc'));_0x42212e(_0x448aec[_0xd2aa('0x13')]['message']);}})[_0xd2aa('0x14')](function(_0x57fd9b){logger['error'](_0xd2aa('0x11'),_0x2cfea9,_0x57fd9b);_0x24aeef(_0x57fd9b);});});}exports[_0xd2aa('0x15')]=function(_0x283d38){var _0x17a82d=this;return new Promise(function(_0x2157d1,_0x1ae3ea){return db[_0xd2aa('0x16')]['findAll']({'raw':_0x283d38[_0xd2aa('0x17')]?_0x283d38['options'][_0xd2aa('0x18')]===undefined?!![]:![]:!![],'where':_0x283d38[_0xd2aa('0x17')]?_0x283d38[_0xd2aa('0x17')][_0xd2aa('0x19')]||null:null,'attributes':_0x283d38['options']?_0x283d38['options'][_0xd2aa('0x1a')]||null:null,'limit':_0x283d38[_0xd2aa('0x17')]?_0x283d38[_0xd2aa('0x17')][_0xd2aa('0x1b')]||null:null,'include':_0x283d38['options']?_0x283d38[_0xd2aa('0x17')][_0xd2aa('0x1c')]?_[_0xd2aa('0x1d')](_0x283d38['options'][_0xd2aa('0x1c')],function(_0x3df0f6){return{'model':db[_0x3df0f6['model']],'as':_0x3df0f6['as'],'attributes':_0x3df0f6[_0xd2aa('0x1a')],'include':_0x3df0f6[_0xd2aa('0x1c')]?_['map'](_0x3df0f6[_0xd2aa('0x1c')],function(_0x4eb95f){return{'model':db[_0x4eb95f[_0xd2aa('0x1e')]],'as':_0x4eb95f['as'],'attributes':_0x4eb95f[_0xd2aa('0x1a')],'include':_0x4eb95f[_0xd2aa('0x1c')]?_[_0xd2aa('0x1d')](_0x4eb95f['include'],function(_0x31c5b0){return{'model':db[_0x31c5b0[_0xd2aa('0x1e')]],'as':_0x31c5b0['as'],'attributes':_0x31c5b0[_0xd2aa('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd2aa('0xa')](function(_0x5c87c8){logger[_0xd2aa('0xb')](_0xd2aa('0x15'),_0x283d38);logger[_0xd2aa('0xd')]('GetServicenowAccount',_0x283d38,JSON[_0xd2aa('0xe')](_0x5c87c8));_0x2157d1(_0x5c87c8);})[_0xd2aa('0x14')](function(_0x48fe31){logger[_0xd2aa('0xf')]('GetServicenowAccount',_0x48fe31[_0xd2aa('0x12')],_0x283d38);_0x1ae3ea(_0x17a82d[_0xd2aa('0xf')](0x1f4,_0x48fe31[_0xd2aa('0x12')]));});});};exports[_0xd2aa('0x1f')]=function(_0x4b915f){var _0x780d65=this;return new Promise(function(_0x5037f7,_0x5023de){return db[_0xd2aa('0x16')][_0xd2aa('0x20')]({'raw':_0x4b915f[_0xd2aa('0x17')]?_0x4b915f[_0xd2aa('0x17')][_0xd2aa('0x18')]===undefined?!![]:![]:!![],'where':_0x4b915f[_0xd2aa('0x17')]?_0x4b915f[_0xd2aa('0x17')][_0xd2aa('0x19')]||null:null,'attributes':_0x4b915f['options']?_0x4b915f['options'][_0xd2aa('0x1a')]||null:null,'include':_0x4b915f[_0xd2aa('0x17')]?_0x4b915f[_0xd2aa('0x17')][_0xd2aa('0x1c')]?_[_0xd2aa('0x1d')](_0x4b915f[_0xd2aa('0x17')][_0xd2aa('0x1c')],function(_0x16180f){return{'model':db[_0x16180f[_0xd2aa('0x1e')]],'as':_0x16180f['as'],'attributes':_0x16180f[_0xd2aa('0x1a')],'include':_0x16180f['include']?_[_0xd2aa('0x1d')](_0x16180f[_0xd2aa('0x1c')],function(_0x29de2f){return{'model':db[_0x29de2f['model']],'as':_0x29de2f['as'],'attributes':_0x29de2f[_0xd2aa('0x1a')],'include':_0x29de2f[_0xd2aa('0x1c')]?_[_0xd2aa('0x1d')](_0x29de2f[_0xd2aa('0x1c')],function(_0x3dd0cd){return{'model':db[_0x3dd0cd[_0xd2aa('0x1e')]],'as':_0x3dd0cd['as'],'attributes':_0x3dd0cd[_0xd2aa('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cb141){logger[_0xd2aa('0xb')](_0xd2aa('0x1f'),_0x4b915f);logger['debug']('ShowServicenowAccount',_0x4b915f,JSON[_0xd2aa('0xe')](_0x3cb141));_0x5037f7(_0x3cb141);})[_0xd2aa('0x14')](function(_0x424be0){logger[_0xd2aa('0xf')]('ShowServicenowAccount',_0x424be0[_0xd2aa('0x12')],_0x4b915f);_0x5023de(_0x780d65[_0xd2aa('0xf')](0x1f4,_0x424be0[_0xd2aa('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ba9a9a0..5606f72 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 _0xfc1d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','multer','connect-timeout','express'];(function(_0x16b0fc,_0x4e445f){var _0x4e7db9=function(_0xe05cd5){while(--_0xe05cd5){_0x16b0fc['push'](_0x16b0fc['shift']());}};_0x4e7db9(++_0x4e445f);}(_0xfc1d,0x165));var _0xdfc1=function(_0x393af4,_0x1d9367){_0x393af4=_0x393af4-0x0;var _0x4b3efb=_0xfc1d[_0x393af4];return _0x4b3efb;};'use strict';var multer=require(_0xdfc1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdfc1('0x1'));var express=require(_0xdfc1('0x2'));var router=express[_0xdfc1('0x3')]();var fs_extra=require(_0xdfc1('0x4'));var auth=require(_0xdfc1('0x5'));var interaction=require(_0xdfc1('0x6'));var config=require(_0xdfc1('0x7'));var controller=require(_0xdfc1('0x8'));router[_0xdfc1('0x9')]('/',auth['isAuthenticated'](),controller[_0xdfc1('0xa')]);router['get'](_0xdfc1('0xb'),auth[_0xdfc1('0xc')](),controller[_0xdfc1('0xd')]);router[_0xdfc1('0x9')](_0xdfc1('0xe'),auth[_0xdfc1('0xc')](),controller[_0xdfc1('0xf')]);router[_0xdfc1('0x9')](_0xdfc1('0x10'),auth[_0xdfc1('0xc')](),controller[_0xdfc1('0x11')]);router['get'](_0xdfc1('0x12'),auth[_0xdfc1('0xc')](),controller[_0xdfc1('0x13')]);router[_0xdfc1('0x14')]('/',auth[_0xdfc1('0xc')](),controller[_0xdfc1('0x15')]);router['put'](_0xdfc1('0xb'),auth[_0xdfc1('0xc')](),controller[_0xdfc1('0x16')]);router[_0xdfc1('0x17')](_0xdfc1('0xb'),auth[_0xdfc1('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdd26=['/:id/subjects','getSubjects','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields'];(function(_0x2da4d0,_0x4f91b5){var _0x40c2f4=function(_0xba4159){while(--_0xba4159){_0x2da4d0['push'](_0x2da4d0['shift']());}};_0x40c2f4(++_0x4f91b5);}(_0xdd26,0x168));var _0x6dd2=function(_0x4a03c9,_0x2261b2){_0x4a03c9=_0x4a03c9-0x0;var _0x1741ec=_0xdd26[_0x4a03c9];return _0x1741ec;};'use strict';var multer=require(_0x6dd2('0x0'));var util=require('util');var path=require(_0x6dd2('0x1'));var timeout=require(_0x6dd2('0x2'));var express=require(_0x6dd2('0x3'));var router=express[_0x6dd2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6dd2('0x5'));var interaction=require(_0x6dd2('0x6'));var config=require('../../config/environment');var controller=require(_0x6dd2('0x7'));router['get']('/',auth[_0x6dd2('0x8')](),controller[_0x6dd2('0x9')]);router[_0x6dd2('0xa')](_0x6dd2('0xb'),auth[_0x6dd2('0x8')](),controller[_0x6dd2('0xc')]);router['get'](_0x6dd2('0xd'),auth[_0x6dd2('0x8')](),controller['getFields']);router['get'](_0x6dd2('0xe'),auth[_0x6dd2('0x8')](),controller[_0x6dd2('0xf')]);router[_0x6dd2('0xa')]('/:id/descriptions',auth[_0x6dd2('0x8')](),controller['getDescriptions']);router[_0x6dd2('0x10')]('/',auth[_0x6dd2('0x8')](),controller[_0x6dd2('0x11')]);router[_0x6dd2('0x12')](_0x6dd2('0xb'),auth['isAuthenticated'](),controller[_0x6dd2('0x13')]);router[_0x6dd2('0x14')](_0x6dd2('0xb'),auth[_0x6dd2('0x8')](),controller['destroy']);module[_0x6dd2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 0c37655..190b50a 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 _0x63e1=['STRING','sequelize','exports'];(function(_0x536c59,_0x334bb2){var _0x3a8329=function(_0x193c5b){while(--_0x193c5b){_0x536c59['push'](_0x536c59['shift']());}};_0x3a8329(++_0x334bb2);}(_0x63e1,0x181));var _0x163e=function(_0x1eae2f,_0x2dc244){_0x1eae2f=_0x1eae2f-0x0;var _0x299558=_0x63e1[_0x1eae2f];return _0x299558;};'use strict';var Sequelize=require(_0x163e('0x0'));module[_0x163e('0x1')]={'name':{'type':Sequelize[_0x163e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa1da=['STRING','exports'];(function(_0x4105ef,_0x2cb45f){var _0x3baffd=function(_0x28ea94){while(--_0x28ea94){_0x4105ef['push'](_0x4105ef['shift']());}};_0x3baffd(++_0x2cb45f);}(_0xa1da,0xef));var _0xaa1d=function(_0x4589fd,_0x4c6f26){_0x4589fd=_0x4589fd-0x0;var _0x44084b=_0xa1da[_0x4589fd];return _0x44084b;};'use strict';var Sequelize=require('sequelize');module[_0xaa1d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaa1d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index f9c5612..1d23420 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 _0x6db4=['options','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','length','find','create','body','getFields','findOne','ServicenowField','filter'];(function(_0x58f8d6,_0x3de6e9){var _0x249399=function(_0x5a2d88){while(--_0x5a2d88){_0x58f8d6['push'](_0x58f8d6['shift']());}};_0x249399(++_0x3de6e9);}(_0x6db4,0x18f));var _0x46db=function(_0x463e2e,_0x55774c){_0x463e2e=_0x463e2e-0x0;var _0x2e86db=_0x6db4[_0x463e2e];return _0x2e86db;};'use strict';var emlformat=require(_0x46db('0x0'));var rimraf=require(_0x46db('0x1'));var zipdir=require(_0x46db('0x2'));var jsonpatch=require(_0x46db('0x3'));var rp=require(_0x46db('0x4'));var moment=require(_0x46db('0x5'));var BPromise=require(_0x46db('0x6'));var Mustache=require(_0x46db('0x7'));var util=require(_0x46db('0x8'));var path=require('path');var sox=require(_0x46db('0x9'));var csv=require(_0x46db('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46db('0xb'));var _=require(_0x46db('0xc'));var squel=require(_0x46db('0xd'));var crypto=require(_0x46db('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x46db('0xf'));var toCsv=require(_0x46db('0xa'));var querystring=require('querystring');var Papa=require(_0x46db('0x10'));var Redis=require(_0x46db('0x11'));var authService=require(_0x46db('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46db('0x13'));var logger=require('../../config/logger')(_0x46db('0x14'));var utils=require(_0x46db('0x15'));var config=require(_0x46db('0x16'));var licenseUtil=require(_0x46db('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4586af,_0x49c196){_0x49c196=_0x49c196||0xcc;return function(_0x451122){if(_0x451122){return _0x4586af['sendStatus'](_0x49c196);}return _0x4586af[_0x46db('0x18')](_0x49c196)[_0x46db('0x19')]();};}function respondWithResult(_0x53bd0a,_0x34c084){_0x34c084=_0x34c084||0xc8;return function(_0x2a1894){if(_0x2a1894){return _0x53bd0a['status'](_0x34c084)[_0x46db('0x1a')](_0x2a1894);}};}function respondWithFilteredResult(_0x420b93,_0x33bd15){return function(_0x39c5ea){if(_0x39c5ea){var _0x40832f=typeof _0x33bd15[_0x46db('0x1b')]==='undefined'&&typeof _0x33bd15['limit']===_0x46db('0x1c');var _0x659201=_0x39c5ea[_0x46db('0x1d')];var _0x5f1fd4=_0x40832f?0x0:_0x33bd15[_0x46db('0x1b')];var _0x3956c9=_0x40832f?_0x39c5ea[_0x46db('0x1d')]:_0x33bd15['offset']+_0x33bd15[_0x46db('0x1e')];var _0x583371;if(_0x3956c9>=_0x659201){_0x3956c9=_0x659201;_0x583371=0xc8;}else{_0x583371=0xce;}_0x420b93[_0x46db('0x18')](_0x583371);return _0x420b93[_0x46db('0x1f')](_0x46db('0x20'),_0x5f1fd4+'-'+_0x3956c9+'/'+_0x659201)[_0x46db('0x1a')](_0x39c5ea);}return null;};}function patchUpdates(_0x2ab9db){return function(_0x321f33){try{jsonpatch[_0x46db('0x21')](_0x321f33,_0x2ab9db,!![]);}catch(_0x2e79c4){return BPromise[_0x46db('0x22')](_0x2e79c4);}return _0x321f33[_0x46db('0x23')]();};}function saveUpdates(_0x419f7e,_0x13c08d){return function(_0x126089){if(_0x126089){return _0x126089[_0x46db('0x24')](_0x419f7e)[_0x46db('0x25')](function(_0x2b5f9f){return _0x2b5f9f;});}return null;};}function removeEntity(_0x2ade43,_0x544ae7){return function(_0x287346){if(_0x287346){return _0x287346['destroy']()[_0x46db('0x25')](function(){_0x2ade43[_0x46db('0x18')](0xcc)[_0x46db('0x19')]();});}};}function handleEntityNotFound(_0x58852c,_0x2c2cb6){return function(_0x22c420){if(!_0x22c420){_0x58852c['sendStatus'](0x194);}return _0x22c420;};}function handleError(_0x3b4f20,_0x3d9b81){_0x3d9b81=_0x3d9b81||0x1f4;return function(_0x1cebb1){logger[_0x46db('0x26')](_0x1cebb1[_0x46db('0x27')]);if(_0x1cebb1['name']){delete _0x1cebb1[_0x46db('0x28')];}_0x3b4f20[_0x46db('0x18')](_0x3d9b81)['send'](_0x1cebb1);};}exports['index']=function(_0x2aee14,_0xbe9eb0){var _0xd3692f={},_0xe065bf={},_0x27b115={'count':0x0,'rows':[]};var _0x2c376e=_[_0x46db('0x29')](db[_0x46db('0x2a')][_0x46db('0x2b')],function(_0x46eda7){return{'name':_0x46eda7[_0x46db('0x2c')],'type':_0x46eda7[_0x46db('0x2d')][_0x46db('0x2e')]};});_0xe065bf[_0x46db('0x2f')]=_[_0x46db('0x29')](_0x2c376e,_0x46db('0x28'));_0xe065bf[_0x46db('0x30')]=_[_0x46db('0x31')](_0x2aee14[_0x46db('0x30')]);_0xe065bf[_0x46db('0x32')]=_[_0x46db('0x33')](_0xe065bf['model'],_0xe065bf['query']);_0xd3692f[_0x46db('0x34')]=_['intersection'](_0xe065bf[_0x46db('0x2f')],qs[_0x46db('0x35')](_0x2aee14[_0x46db('0x30')][_0x46db('0x35')]));_0xd3692f[_0x46db('0x34')]=_0xd3692f['attributes']['length']?_0xd3692f[_0x46db('0x34')]:_0xe065bf[_0x46db('0x2f')];if(!_0x2aee14[_0x46db('0x30')]['hasOwnProperty'](_0x46db('0x36'))){_0xd3692f['limit']=qs[_0x46db('0x1e')](_0x2aee14[_0x46db('0x30')][_0x46db('0x1e')]);_0xd3692f[_0x46db('0x1b')]=qs[_0x46db('0x1b')](_0x2aee14[_0x46db('0x30')][_0x46db('0x1b')]);}_0xd3692f[_0x46db('0x37')]=qs[_0x46db('0x38')](_0x2aee14[_0x46db('0x30')][_0x46db('0x38')]);_0xd3692f[_0x46db('0x39')]=qs[_0x46db('0x32')](_[_0x46db('0x3a')](_0x2aee14[_0x46db('0x30')],_0xe065bf['filters']),_0x2c376e);if(_0x2aee14[_0x46db('0x30')]['filter']){_0xd3692f[_0x46db('0x39')]=_[_0x46db('0x3b')](_0xd3692f[_0x46db('0x39')],{'$or':_[_0x46db('0x29')](_0x2c376e,function(_0x4a3a46){if(_0x4a3a46[_0x46db('0x2d')]!==_0x46db('0x3c')){var _0x5a635d={};_0x5a635d[_0x4a3a46[_0x46db('0x28')]]={'$like':'%'+_0x2aee14[_0x46db('0x30')]['filter']+'%'};return _0x5a635d;}})});}_0xd3692f=_['merge']({},_0xd3692f,_0x2aee14['options']);var _0x12d34c={'where':_0xd3692f[_0x46db('0x39')]};return db[_0x46db('0x2a')][_0x46db('0x1d')](_0x12d34c)[_0x46db('0x25')](function(_0x44f924){_0x27b115[_0x46db('0x1d')]=_0x44f924;if(_0x2aee14[_0x46db('0x30')][_0x46db('0x3d')]){_0xd3692f[_0x46db('0x3e')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x46db('0x3f')](_0xd3692f);})[_0x46db('0x25')](function(_0xdfd8f4){_0x27b115['rows']=_0xdfd8f4;return _0x27b115;})['then'](respondWithFilteredResult(_0xbe9eb0,_0xd3692f))[_0x46db('0x40')](handleError(_0xbe9eb0,null));};exports[_0x46db('0x41')]=function(_0x5a563f,_0x24e3c5){var _0x957bfc={'raw':![],'where':{'id':_0x5a563f[_0x46db('0x42')]['id']}},_0x96e6bc={};_0x96e6bc[_0x46db('0x2f')]=_['keys'](db[_0x46db('0x2a')][_0x46db('0x2b')]);_0x96e6bc[_0x46db('0x30')]=_[_0x46db('0x31')](_0x5a563f[_0x46db('0x30')]);_0x96e6bc[_0x46db('0x32')]=_['intersection'](_0x96e6bc[_0x46db('0x2f')],_0x96e6bc['query']);_0x957bfc[_0x46db('0x34')]=_[_0x46db('0x33')](_0x96e6bc[_0x46db('0x2f')],qs[_0x46db('0x35')](_0x5a563f['query'][_0x46db('0x35')]));_0x957bfc['attributes']=_0x957bfc[_0x46db('0x34')][_0x46db('0x43')]?_0x957bfc[_0x46db('0x34')]:_0x96e6bc['model'];if(_0x5a563f[_0x46db('0x30')][_0x46db('0x3d')]){_0x957bfc['include']=[{'all':!![]}];}_0x957bfc=_['merge']({},_0x957bfc,_0x5a563f['options']);return db[_0x46db('0x2a')][_0x46db('0x44')](_0x957bfc)[_0x46db('0x25')](handleEntityNotFound(_0x24e3c5,null))[_0x46db('0x25')](respondWithResult(_0x24e3c5,null))['catch'](handleError(_0x24e3c5,null));};exports['create']=function(_0x113b5a,_0x3c5ef1){return db[_0x46db('0x2a')][_0x46db('0x45')](_0x113b5a['body'],{})['then'](respondWithResult(_0x3c5ef1,0xc9))[_0x46db('0x40')](handleError(_0x3c5ef1,null));};exports[_0x46db('0x24')]=function(_0xcc8f0,_0x8fb4e){if(_0xcc8f0[_0x46db('0x46')]['id']){delete _0xcc8f0[_0x46db('0x46')]['id'];}return db[_0x46db('0x2a')][_0x46db('0x44')]({'where':{'id':_0xcc8f0[_0x46db('0x42')]['id']}})['then'](handleEntityNotFound(_0x8fb4e,null))[_0x46db('0x25')](saveUpdates(_0xcc8f0[_0x46db('0x46')],null))[_0x46db('0x25')](respondWithResult(_0x8fb4e,null))[_0x46db('0x40')](handleError(_0x8fb4e,null));};exports['destroy']=function(_0x42ac63,_0x48a64b){return db[_0x46db('0x2a')][_0x46db('0x44')]({'where':{'id':_0x42ac63[_0x46db('0x42')]['id']}})[_0x46db('0x25')](handleEntityNotFound(_0x48a64b,null))[_0x46db('0x25')](removeEntity(_0x48a64b,null))[_0x46db('0x40')](handleError(_0x48a64b,null));};exports[_0x46db('0x47')]=function(_0x36744e,_0x2ab6db,_0x3df650){var _0x3acd41={};var _0x45837f={};var _0x261892;var _0xd4e119;return db[_0x46db('0x2a')][_0x46db('0x48')]({'where':{'id':_0x36744e[_0x46db('0x42')]['id']}})['then'](handleEntityNotFound(_0x2ab6db,null))[_0x46db('0x25')](function(_0x3a793f){if(_0x3a793f){_0x261892=_0x3a793f;_0x45837f[_0x46db('0x2f')]=_[_0x46db('0x31')](db[_0x46db('0x49')][_0x46db('0x2b')]);_0x45837f[_0x46db('0x30')]=_[_0x46db('0x31')](_0x36744e[_0x46db('0x30')]);_0x45837f[_0x46db('0x32')]=_[_0x46db('0x33')](_0x45837f[_0x46db('0x2f')],_0x45837f['query']);_0x3acd41[_0x46db('0x34')]=_[_0x46db('0x33')](_0x45837f['model'],qs[_0x46db('0x35')](_0x36744e[_0x46db('0x30')][_0x46db('0x35')]));_0x3acd41[_0x46db('0x34')]=_0x3acd41['attributes'][_0x46db('0x43')]?_0x3acd41['attributes']:_0x45837f[_0x46db('0x2f')];_0x3acd41[_0x46db('0x37')]=qs[_0x46db('0x38')](_0x36744e[_0x46db('0x30')][_0x46db('0x38')]);_0x3acd41[_0x46db('0x39')]=qs[_0x46db('0x32')](_[_0x46db('0x3a')](_0x36744e[_0x46db('0x30')],_0x45837f[_0x46db('0x32')]));if(_0x36744e[_0x46db('0x30')][_0x46db('0x4a')]){_0x3acd41[_0x46db('0x39')]=_['merge'](_0x3acd41[_0x46db('0x39')],{'$or':_['map'](_0x3acd41['attributes'],function(_0x5c05a5){var _0x55559c={};_0x55559c[_0x5c05a5]={'$like':'%'+_0x36744e[_0x46db('0x30')][_0x46db('0x4a')]+'%'};return _0x55559c;})});}_0x3acd41=_[_0x46db('0x3b')]({},_0x3acd41,_0x36744e[_0x46db('0x4b')]);return _0x261892[_0x46db('0x47')](_0x3acd41);}})[_0x46db('0x25')](function(_0x24a56f){if(_0x24a56f){_0xd4e119=_0x24a56f[_0x46db('0x43')];if(!_0x36744e[_0x46db('0x30')][_0x46db('0x4c')](_0x46db('0x36'))){_0x3acd41['limit']=qs[_0x46db('0x1e')](_0x36744e[_0x46db('0x30')][_0x46db('0x1e')]);_0x3acd41[_0x46db('0x1b')]=qs[_0x46db('0x1b')](_0x36744e['query'][_0x46db('0x1b')]);}return _0x261892[_0x46db('0x47')](_0x3acd41);}})[_0x46db('0x25')](function(_0x79e46d){if(_0x79e46d){return _0x79e46d?{'count':_0xd4e119,'rows':_0x79e46d}:null;}})['then'](respondWithResult(_0x2ab6db,null))[_0x46db('0x40')](handleError(_0x2ab6db,null));};exports['getSubjects']=function(_0x121975,_0x1956c9,_0x14a7a2){var _0x35f5dd={};var _0x124eb7={};var _0x334220;var _0x11a511;return db[_0x46db('0x2a')][_0x46db('0x48')]({'where':{'id':_0x121975['params']['id']}})[_0x46db('0x25')](handleEntityNotFound(_0x1956c9,null))[_0x46db('0x25')](function(_0x3113d0){if(_0x3113d0){_0x334220=_0x3113d0;_0x124eb7[_0x46db('0x2f')]=_['keys'](db['ServicenowField'][_0x46db('0x2b')]);_0x124eb7[_0x46db('0x30')]=_['keys'](_0x121975[_0x46db('0x30')]);_0x124eb7[_0x46db('0x32')]=_['intersection'](_0x124eb7[_0x46db('0x2f')],_0x124eb7[_0x46db('0x30')]);_0x35f5dd[_0x46db('0x34')]=_['intersection'](_0x124eb7['model'],qs[_0x46db('0x35')](_0x121975[_0x46db('0x30')][_0x46db('0x35')]));_0x35f5dd['attributes']=_0x35f5dd[_0x46db('0x34')]['length']?_0x35f5dd[_0x46db('0x34')]:_0x124eb7[_0x46db('0x2f')];_0x35f5dd[_0x46db('0x37')]=qs[_0x46db('0x38')](_0x121975[_0x46db('0x30')][_0x46db('0x38')]);_0x35f5dd[_0x46db('0x39')]=qs[_0x46db('0x32')](_[_0x46db('0x3a')](_0x121975[_0x46db('0x30')],_0x124eb7[_0x46db('0x32')]));if(_0x121975[_0x46db('0x30')][_0x46db('0x4a')]){_0x35f5dd['where']=_[_0x46db('0x3b')](_0x35f5dd[_0x46db('0x39')],{'$or':_[_0x46db('0x29')](_0x35f5dd[_0x46db('0x34')],function(_0x4e588b){var _0x48dd20={};_0x48dd20[_0x4e588b]={'$like':'%'+_0x121975['query'][_0x46db('0x4a')]+'%'};return _0x48dd20;})});}_0x35f5dd=_[_0x46db('0x3b')]({},_0x35f5dd,_0x121975[_0x46db('0x4b')]);return _0x334220['getSubjects'](_0x35f5dd);}})[_0x46db('0x25')](function(_0x53c5d2){if(_0x53c5d2){_0x11a511=_0x53c5d2[_0x46db('0x43')];if(!_0x121975[_0x46db('0x30')][_0x46db('0x4c')](_0x46db('0x36'))){_0x35f5dd[_0x46db('0x1e')]=qs[_0x46db('0x1e')](_0x121975[_0x46db('0x30')]['limit']);_0x35f5dd[_0x46db('0x1b')]=qs[_0x46db('0x1b')](_0x121975[_0x46db('0x30')]['offset']);}return _0x334220[_0x46db('0x4d')](_0x35f5dd);}})[_0x46db('0x25')](function(_0x126447){if(_0x126447){return _0x126447?{'count':_0x11a511,'rows':_0x126447}:null;}})[_0x46db('0x25')](respondWithResult(_0x1956c9,null))['catch'](handleError(_0x1956c9,null));};exports[_0x46db('0x4e')]=function(_0x4887ba,_0x19f233,_0x19914b){var _0x3ce235={};var _0x2902f9={};var _0x253a82;var _0x512a8a;return db[_0x46db('0x2a')][_0x46db('0x48')]({'where':{'id':_0x4887ba[_0x46db('0x42')]['id']}})[_0x46db('0x25')](handleEntityNotFound(_0x19f233,null))[_0x46db('0x25')](function(_0x1bf1f9){if(_0x1bf1f9){_0x253a82=_0x1bf1f9;_0x2902f9['model']=_['keys'](db[_0x46db('0x49')][_0x46db('0x2b')]);_0x2902f9[_0x46db('0x30')]=_[_0x46db('0x31')](_0x4887ba[_0x46db('0x30')]);_0x2902f9[_0x46db('0x32')]=_['intersection'](_0x2902f9[_0x46db('0x2f')],_0x2902f9['query']);_0x3ce235[_0x46db('0x34')]=_[_0x46db('0x33')](_0x2902f9['model'],qs[_0x46db('0x35')](_0x4887ba[_0x46db('0x30')][_0x46db('0x35')]));_0x3ce235[_0x46db('0x34')]=_0x3ce235[_0x46db('0x34')][_0x46db('0x43')]?_0x3ce235[_0x46db('0x34')]:_0x2902f9['model'];_0x3ce235['order']=qs[_0x46db('0x38')](_0x4887ba[_0x46db('0x30')][_0x46db('0x38')]);_0x3ce235[_0x46db('0x39')]=qs[_0x46db('0x32')](_['pick'](_0x4887ba[_0x46db('0x30')],_0x2902f9[_0x46db('0x32')]));if(_0x4887ba['query']['filter']){_0x3ce235[_0x46db('0x39')]=_[_0x46db('0x3b')](_0x3ce235[_0x46db('0x39')],{'$or':_[_0x46db('0x29')](_0x3ce235[_0x46db('0x34')],function(_0x280843){var _0x370b08={};_0x370b08[_0x280843]={'$like':'%'+_0x4887ba['query'][_0x46db('0x4a')]+'%'};return _0x370b08;})});}_0x3ce235=_[_0x46db('0x3b')]({},_0x3ce235,_0x4887ba['options']);return _0x253a82[_0x46db('0x4e')](_0x3ce235);}})[_0x46db('0x25')](function(_0x4e7fe7){if(_0x4e7fe7){_0x512a8a=_0x4e7fe7['length'];if(!_0x4887ba['query'][_0x46db('0x4c')]('nolimit')){_0x3ce235[_0x46db('0x1e')]=qs[_0x46db('0x1e')](_0x4887ba[_0x46db('0x30')][_0x46db('0x1e')]);_0x3ce235[_0x46db('0x1b')]=qs[_0x46db('0x1b')](_0x4887ba[_0x46db('0x30')][_0x46db('0x1b')]);}return _0x253a82[_0x46db('0x4e')](_0x3ce235);}})['then'](function(_0x5d8c9a){if(_0x5d8c9a){return _0x5d8c9a?{'count':_0x512a8a,'rows':_0x5d8c9a}:null;}})[_0x46db('0x25')](respondWithResult(_0x19f233,null))[_0x46db('0x40')](handleError(_0x19f233,null));}; \ No newline at end of file +var _0xc0b6=['query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','options','find','create','body','catch','destroy','getFields','findOne','ServicenowField','filter','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','apply','reject','save','update','then','end','stack','name','send','ServicenowConfiguration','fieldName','type','key','model','map','keys','filters','intersection'];(function(_0x5780e2,_0x29b0e9){var _0x36fd0d=function(_0x576289){while(--_0x576289){_0x5780e2['push'](_0x5780e2['shift']());}};_0x36fd0d(++_0x29b0e9);}(_0xc0b6,0x10e));var _0x6c0b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc0b6[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x6c0b('0x0'));var rimraf=require(_0x6c0b('0x1'));var zipdir=require(_0x6c0b('0x2'));var jsonpatch=require(_0x6c0b('0x3'));var rp=require(_0x6c0b('0x4'));var moment=require(_0x6c0b('0x5'));var BPromise=require(_0x6c0b('0x6'));var Mustache=require('mustache');var util=require(_0x6c0b('0x7'));var path=require(_0x6c0b('0x8'));var sox=require(_0x6c0b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c0b('0xa'));var _=require(_0x6c0b('0xb'));var squel=require(_0x6c0b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6c0b('0xd'));var querystring=require(_0x6c0b('0xe'));var Papa=require(_0x6c0b('0xf'));var Redis=require('ioredis');var authService=require(_0x6c0b('0x10'));var qs=require(_0x6c0b('0x11'));var as=require(_0x6c0b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c0b('0x13'))('api');var utils=require(_0x6c0b('0x14'));var config=require(_0x6c0b('0x15'));var licenseUtil=require(_0x6c0b('0x16'));var db=require(_0x6c0b('0x17'))['db'];function respondWithStatusCode(_0x4a588b,_0x77203b){_0x77203b=_0x77203b||0xcc;return function(_0x4b727e){if(_0x4b727e){return _0x4a588b[_0x6c0b('0x18')](_0x77203b);}return _0x4a588b[_0x6c0b('0x19')](_0x77203b)['end']();};}function respondWithResult(_0x10822c,_0x3a1211){_0x3a1211=_0x3a1211||0xc8;return function(_0xbdd454){if(_0xbdd454){return _0x10822c[_0x6c0b('0x19')](_0x3a1211)[_0x6c0b('0x1a')](_0xbdd454);}};}function respondWithFilteredResult(_0x20e227,_0x5ec095){return function(_0x5ceccc){if(_0x5ceccc){var _0x29bb5c=typeof _0x5ec095['offset']===_0x6c0b('0x1b')&&typeof _0x5ec095[_0x6c0b('0x1c')]===_0x6c0b('0x1b');var _0x32ab5e=_0x5ceccc['count'];var _0x14a8f9=_0x29bb5c?0x0:_0x5ec095[_0x6c0b('0x1d')];var _0x18c306=_0x29bb5c?_0x5ceccc[_0x6c0b('0x1e')]:_0x5ec095[_0x6c0b('0x1d')]+_0x5ec095[_0x6c0b('0x1c')];var _0x41d952;if(_0x18c306>=_0x32ab5e){_0x18c306=_0x32ab5e;_0x41d952=0xc8;}else{_0x41d952=0xce;}_0x20e227[_0x6c0b('0x19')](_0x41d952);return _0x20e227[_0x6c0b('0x1f')]('Content-Range',_0x14a8f9+'-'+_0x18c306+'/'+_0x32ab5e)[_0x6c0b('0x1a')](_0x5ceccc);}return null;};}function patchUpdates(_0x33bf1e){return function(_0x593267){try{jsonpatch[_0x6c0b('0x20')](_0x593267,_0x33bf1e,!![]);}catch(_0x433adf){return BPromise[_0x6c0b('0x21')](_0x433adf);}return _0x593267[_0x6c0b('0x22')]();};}function saveUpdates(_0x9087bd,_0x2bfd6e){return function(_0x2e938f){if(_0x2e938f){return _0x2e938f[_0x6c0b('0x23')](_0x9087bd)[_0x6c0b('0x24')](function(_0xec4d53){return _0xec4d53;});}return null;};}function removeEntity(_0x5668ef,_0x19a9b9){return function(_0x55279c){if(_0x55279c){return _0x55279c['destroy']()[_0x6c0b('0x24')](function(){_0x5668ef[_0x6c0b('0x19')](0xcc)[_0x6c0b('0x25')]();});}};}function handleEntityNotFound(_0x1e565e,_0x21f2e7){return function(_0x199756){if(!_0x199756){_0x1e565e[_0x6c0b('0x18')](0x194);}return _0x199756;};}function handleError(_0xc54f11,_0x193f1a){_0x193f1a=_0x193f1a||0x1f4;return function(_0x33415e){logger['error'](_0x33415e[_0x6c0b('0x26')]);if(_0x33415e[_0x6c0b('0x27')]){delete _0x33415e[_0x6c0b('0x27')];}_0xc54f11[_0x6c0b('0x19')](_0x193f1a)[_0x6c0b('0x28')](_0x33415e);};}exports['index']=function(_0x59c89b,_0xcc032b){var _0x173541={},_0x3ce5e0={},_0x4aca3a={'count':0x0,'rows':[]};var _0x361807=_['map'](db[_0x6c0b('0x29')]['rawAttributes'],function(_0x28723c){return{'name':_0x28723c[_0x6c0b('0x2a')],'type':_0x28723c[_0x6c0b('0x2b')][_0x6c0b('0x2c')]};});_0x3ce5e0[_0x6c0b('0x2d')]=_[_0x6c0b('0x2e')](_0x361807,_0x6c0b('0x27'));_0x3ce5e0['query']=_[_0x6c0b('0x2f')](_0x59c89b['query']);_0x3ce5e0[_0x6c0b('0x30')]=_[_0x6c0b('0x31')](_0x3ce5e0[_0x6c0b('0x2d')],_0x3ce5e0[_0x6c0b('0x32')]);_0x173541[_0x6c0b('0x33')]=_[_0x6c0b('0x31')](_0x3ce5e0[_0x6c0b('0x2d')],qs[_0x6c0b('0x34')](_0x59c89b['query'][_0x6c0b('0x34')]));_0x173541['attributes']=_0x173541[_0x6c0b('0x33')][_0x6c0b('0x35')]?_0x173541[_0x6c0b('0x33')]:_0x3ce5e0[_0x6c0b('0x2d')];if(!_0x59c89b[_0x6c0b('0x32')][_0x6c0b('0x36')](_0x6c0b('0x37'))){_0x173541[_0x6c0b('0x1c')]=qs['limit'](_0x59c89b[_0x6c0b('0x32')][_0x6c0b('0x1c')]);_0x173541[_0x6c0b('0x1d')]=qs[_0x6c0b('0x1d')](_0x59c89b['query']['offset']);}_0x173541[_0x6c0b('0x38')]=qs[_0x6c0b('0x39')](_0x59c89b['query']['sort']);_0x173541[_0x6c0b('0x3a')]=qs[_0x6c0b('0x30')](_[_0x6c0b('0x3b')](_0x59c89b[_0x6c0b('0x32')],_0x3ce5e0['filters']),_0x361807);if(_0x59c89b[_0x6c0b('0x32')]['filter']){_0x173541[_0x6c0b('0x3a')]=_[_0x6c0b('0x3c')](_0x173541[_0x6c0b('0x3a')],{'$or':_[_0x6c0b('0x2e')](_0x361807,function(_0x17cc78){if(_0x17cc78[_0x6c0b('0x2b')]!==_0x6c0b('0x3d')){var _0x2b82cc={};_0x2b82cc[_0x17cc78[_0x6c0b('0x27')]]={'$like':'%'+_0x59c89b[_0x6c0b('0x32')]['filter']+'%'};return _0x2b82cc;}})});}_0x173541=_['merge']({},_0x173541,_0x59c89b['options']);var _0x1134c8={'where':_0x173541[_0x6c0b('0x3a')]};return db[_0x6c0b('0x29')][_0x6c0b('0x1e')](_0x1134c8)[_0x6c0b('0x24')](function(_0x5da99f){_0x4aca3a[_0x6c0b('0x1e')]=_0x5da99f;if(_0x59c89b[_0x6c0b('0x32')][_0x6c0b('0x3e')]){_0x173541[_0x6c0b('0x3f')]=[{'all':!![]}];}return db[_0x6c0b('0x29')][_0x6c0b('0x40')](_0x173541);})['then'](function(_0x44c082){_0x4aca3a['rows']=_0x44c082;return _0x4aca3a;})[_0x6c0b('0x24')](respondWithFilteredResult(_0xcc032b,_0x173541))['catch'](handleError(_0xcc032b,null));};exports[_0x6c0b('0x41')]=function(_0x3407c9,_0xf33499){var _0x3b5375={'raw':![],'where':{'id':_0x3407c9[_0x6c0b('0x42')]['id']}},_0x2fa64b={};_0x2fa64b[_0x6c0b('0x2d')]=_['keys'](db[_0x6c0b('0x29')][_0x6c0b('0x43')]);_0x2fa64b[_0x6c0b('0x32')]=_[_0x6c0b('0x2f')](_0x3407c9['query']);_0x2fa64b['filters']=_[_0x6c0b('0x31')](_0x2fa64b[_0x6c0b('0x2d')],_0x2fa64b[_0x6c0b('0x32')]);_0x3b5375['attributes']=_[_0x6c0b('0x31')](_0x2fa64b[_0x6c0b('0x2d')],qs[_0x6c0b('0x34')](_0x3407c9[_0x6c0b('0x32')][_0x6c0b('0x34')]));_0x3b5375[_0x6c0b('0x33')]=_0x3b5375[_0x6c0b('0x33')][_0x6c0b('0x35')]?_0x3b5375['attributes']:_0x2fa64b[_0x6c0b('0x2d')];if(_0x3407c9[_0x6c0b('0x32')][_0x6c0b('0x3e')]){_0x3b5375[_0x6c0b('0x3f')]=[{'all':!![]}];}_0x3b5375=_[_0x6c0b('0x3c')]({},_0x3b5375,_0x3407c9[_0x6c0b('0x44')]);return db[_0x6c0b('0x29')][_0x6c0b('0x45')](_0x3b5375)[_0x6c0b('0x24')](handleEntityNotFound(_0xf33499,null))[_0x6c0b('0x24')](respondWithResult(_0xf33499,null))['catch'](handleError(_0xf33499,null));};exports[_0x6c0b('0x46')]=function(_0x29c8d5,_0x2e3a87){return db[_0x6c0b('0x29')][_0x6c0b('0x46')](_0x29c8d5[_0x6c0b('0x47')],{})[_0x6c0b('0x24')](respondWithResult(_0x2e3a87,0xc9))['catch'](handleError(_0x2e3a87,null));};exports[_0x6c0b('0x23')]=function(_0x5f08ef,_0x48c383){if(_0x5f08ef[_0x6c0b('0x47')]['id']){delete _0x5f08ef[_0x6c0b('0x47')]['id'];}return db[_0x6c0b('0x29')][_0x6c0b('0x45')]({'where':{'id':_0x5f08ef['params']['id']}})[_0x6c0b('0x24')](handleEntityNotFound(_0x48c383,null))[_0x6c0b('0x24')](saveUpdates(_0x5f08ef[_0x6c0b('0x47')],null))[_0x6c0b('0x24')](respondWithResult(_0x48c383,null))[_0x6c0b('0x48')](handleError(_0x48c383,null));};exports[_0x6c0b('0x49')]=function(_0x4f2110,_0x2bf653){return db[_0x6c0b('0x29')][_0x6c0b('0x45')]({'where':{'id':_0x4f2110['params']['id']}})[_0x6c0b('0x24')](handleEntityNotFound(_0x2bf653,null))[_0x6c0b('0x24')](removeEntity(_0x2bf653,null))[_0x6c0b('0x48')](handleError(_0x2bf653,null));};exports[_0x6c0b('0x4a')]=function(_0x587498,_0x3bdb25,_0xed832f){var _0x52a554={};var _0x553938={};var _0x24734d;var _0x408346;return db[_0x6c0b('0x29')][_0x6c0b('0x4b')]({'where':{'id':_0x587498[_0x6c0b('0x42')]['id']}})[_0x6c0b('0x24')](handleEntityNotFound(_0x3bdb25,null))['then'](function(_0x498ca5){if(_0x498ca5){_0x24734d=_0x498ca5;_0x553938['model']=_['keys'](db[_0x6c0b('0x4c')]['rawAttributes']);_0x553938[_0x6c0b('0x32')]=_[_0x6c0b('0x2f')](_0x587498[_0x6c0b('0x32')]);_0x553938[_0x6c0b('0x30')]=_[_0x6c0b('0x31')](_0x553938[_0x6c0b('0x2d')],_0x553938[_0x6c0b('0x32')]);_0x52a554['attributes']=_[_0x6c0b('0x31')](_0x553938[_0x6c0b('0x2d')],qs['fields'](_0x587498['query'][_0x6c0b('0x34')]));_0x52a554[_0x6c0b('0x33')]=_0x52a554[_0x6c0b('0x33')]['length']?_0x52a554[_0x6c0b('0x33')]:_0x553938['model'];_0x52a554['order']=qs['sort'](_0x587498[_0x6c0b('0x32')]['sort']);_0x52a554[_0x6c0b('0x3a')]=qs[_0x6c0b('0x30')](_[_0x6c0b('0x3b')](_0x587498[_0x6c0b('0x32')],_0x553938[_0x6c0b('0x30')]));if(_0x587498[_0x6c0b('0x32')][_0x6c0b('0x4d')]){_0x52a554[_0x6c0b('0x3a')]=_['merge'](_0x52a554[_0x6c0b('0x3a')],{'$or':_['map'](_0x52a554[_0x6c0b('0x33')],function(_0x4ff962){var _0x549135={};_0x549135[_0x4ff962]={'$like':'%'+_0x587498[_0x6c0b('0x32')][_0x6c0b('0x4d')]+'%'};return _0x549135;})});}_0x52a554=_[_0x6c0b('0x3c')]({},_0x52a554,_0x587498[_0x6c0b('0x44')]);return _0x24734d[_0x6c0b('0x4a')](_0x52a554);}})[_0x6c0b('0x24')](function(_0xa04d6a){if(_0xa04d6a){_0x408346=_0xa04d6a['length'];if(!_0x587498[_0x6c0b('0x32')][_0x6c0b('0x36')]('nolimit')){_0x52a554[_0x6c0b('0x1c')]=qs['limit'](_0x587498[_0x6c0b('0x32')][_0x6c0b('0x1c')]);_0x52a554['offset']=qs[_0x6c0b('0x1d')](_0x587498[_0x6c0b('0x32')][_0x6c0b('0x1d')]);}return _0x24734d[_0x6c0b('0x4a')](_0x52a554);}})[_0x6c0b('0x24')](function(_0x4e040e){if(_0x4e040e){return _0x4e040e?{'count':_0x408346,'rows':_0x4e040e}:null;}})[_0x6c0b('0x24')](respondWithResult(_0x3bdb25,null))[_0x6c0b('0x48')](handleError(_0x3bdb25,null));};exports['getSubjects']=function(_0x2eddec,_0x4217e2,_0x3ec2cc){var _0x520768={};var _0x11aea3={};var _0x7088cd;var _0x282ab6;return db[_0x6c0b('0x29')][_0x6c0b('0x4b')]({'where':{'id':_0x2eddec['params']['id']}})[_0x6c0b('0x24')](handleEntityNotFound(_0x4217e2,null))[_0x6c0b('0x24')](function(_0x48fc11){if(_0x48fc11){_0x7088cd=_0x48fc11;_0x11aea3[_0x6c0b('0x2d')]=_[_0x6c0b('0x2f')](db[_0x6c0b('0x4c')][_0x6c0b('0x43')]);_0x11aea3[_0x6c0b('0x32')]=_[_0x6c0b('0x2f')](_0x2eddec[_0x6c0b('0x32')]);_0x11aea3[_0x6c0b('0x30')]=_['intersection'](_0x11aea3['model'],_0x11aea3[_0x6c0b('0x32')]);_0x520768['attributes']=_[_0x6c0b('0x31')](_0x11aea3[_0x6c0b('0x2d')],qs['fields'](_0x2eddec[_0x6c0b('0x32')][_0x6c0b('0x34')]));_0x520768['attributes']=_0x520768[_0x6c0b('0x33')][_0x6c0b('0x35')]?_0x520768[_0x6c0b('0x33')]:_0x11aea3[_0x6c0b('0x2d')];_0x520768[_0x6c0b('0x38')]=qs[_0x6c0b('0x39')](_0x2eddec[_0x6c0b('0x32')]['sort']);_0x520768[_0x6c0b('0x3a')]=qs[_0x6c0b('0x30')](_[_0x6c0b('0x3b')](_0x2eddec['query'],_0x11aea3[_0x6c0b('0x30')]));if(_0x2eddec[_0x6c0b('0x32')]['filter']){_0x520768[_0x6c0b('0x3a')]=_['merge'](_0x520768['where'],{'$or':_['map'](_0x520768[_0x6c0b('0x33')],function(_0x512a35){var _0x1efe64={};_0x1efe64[_0x512a35]={'$like':'%'+_0x2eddec[_0x6c0b('0x32')][_0x6c0b('0x4d')]+'%'};return _0x1efe64;})});}_0x520768=_[_0x6c0b('0x3c')]({},_0x520768,_0x2eddec[_0x6c0b('0x44')]);return _0x7088cd[_0x6c0b('0x4e')](_0x520768);}})[_0x6c0b('0x24')](function(_0x1e5fa1){if(_0x1e5fa1){_0x282ab6=_0x1e5fa1[_0x6c0b('0x35')];if(!_0x2eddec['query'][_0x6c0b('0x36')](_0x6c0b('0x37'))){_0x520768[_0x6c0b('0x1c')]=qs[_0x6c0b('0x1c')](_0x2eddec[_0x6c0b('0x32')][_0x6c0b('0x1c')]);_0x520768[_0x6c0b('0x1d')]=qs[_0x6c0b('0x1d')](_0x2eddec[_0x6c0b('0x32')]['offset']);}return _0x7088cd[_0x6c0b('0x4e')](_0x520768);}})['then'](function(_0x3f64e1){if(_0x3f64e1){return _0x3f64e1?{'count':_0x282ab6,'rows':_0x3f64e1}:null;}})['then'](respondWithResult(_0x4217e2,null))[_0x6c0b('0x48')](handleError(_0x4217e2,null));};exports['getDescriptions']=function(_0x3022d5,_0x4cf19f,_0x598bb6){var _0x558eb1={};var _0x6adf74={};var _0x474a4c;var _0x49854b;return db[_0x6c0b('0x29')][_0x6c0b('0x4b')]({'where':{'id':_0x3022d5[_0x6c0b('0x42')]['id']}})[_0x6c0b('0x24')](handleEntityNotFound(_0x4cf19f,null))['then'](function(_0x275767){if(_0x275767){_0x474a4c=_0x275767;_0x6adf74[_0x6c0b('0x2d')]=_[_0x6c0b('0x2f')](db[_0x6c0b('0x4c')][_0x6c0b('0x43')]);_0x6adf74[_0x6c0b('0x32')]=_['keys'](_0x3022d5[_0x6c0b('0x32')]);_0x6adf74['filters']=_[_0x6c0b('0x31')](_0x6adf74[_0x6c0b('0x2d')],_0x6adf74['query']);_0x558eb1[_0x6c0b('0x33')]=_[_0x6c0b('0x31')](_0x6adf74[_0x6c0b('0x2d')],qs[_0x6c0b('0x34')](_0x3022d5[_0x6c0b('0x32')][_0x6c0b('0x34')]));_0x558eb1['attributes']=_0x558eb1['attributes'][_0x6c0b('0x35')]?_0x558eb1[_0x6c0b('0x33')]:_0x6adf74['model'];_0x558eb1[_0x6c0b('0x38')]=qs[_0x6c0b('0x39')](_0x3022d5[_0x6c0b('0x32')]['sort']);_0x558eb1['where']=qs[_0x6c0b('0x30')](_[_0x6c0b('0x3b')](_0x3022d5[_0x6c0b('0x32')],_0x6adf74[_0x6c0b('0x30')]));if(_0x3022d5[_0x6c0b('0x32')][_0x6c0b('0x4d')]){_0x558eb1[_0x6c0b('0x3a')]=_[_0x6c0b('0x3c')](_0x558eb1[_0x6c0b('0x3a')],{'$or':_[_0x6c0b('0x2e')](_0x558eb1[_0x6c0b('0x33')],function(_0x14c57a){var _0x53c8b9={};_0x53c8b9[_0x14c57a]={'$like':'%'+_0x3022d5[_0x6c0b('0x32')]['filter']+'%'};return _0x53c8b9;})});}_0x558eb1=_[_0x6c0b('0x3c')]({},_0x558eb1,_0x3022d5[_0x6c0b('0x44')]);return _0x474a4c[_0x6c0b('0x4f')](_0x558eb1);}})[_0x6c0b('0x24')](function(_0x1f8130){if(_0x1f8130){_0x49854b=_0x1f8130[_0x6c0b('0x35')];if(!_0x3022d5[_0x6c0b('0x32')][_0x6c0b('0x36')](_0x6c0b('0x37'))){_0x558eb1[_0x6c0b('0x1c')]=qs[_0x6c0b('0x1c')](_0x3022d5['query'][_0x6c0b('0x1c')]);_0x558eb1[_0x6c0b('0x1d')]=qs['offset'](_0x3022d5['query'][_0x6c0b('0x1d')]);}return _0x474a4c[_0x6c0b('0x4f')](_0x558eb1);}})[_0x6c0b('0x24')](function(_0x48ecdd){if(_0x48ecdd){return _0x48ecdd?{'count':_0x49854b,'rows':_0x48ecdd}:null;}})['then'](respondWithResult(_0x4cf19f,null))[_0x6c0b('0x48')](handleError(_0x4cf19f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 8632ad8..0443cad 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 _0xe34f=['request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe34f,0xbc));var _0xfe34=function(_0x69969d,_0x54f2de){_0x69969d=_0x69969d-0x0;var _0x38f66c=_0xe34f[_0x69969d];return _0x38f66c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfe34('0x0'));var BPromise=require(_0xfe34('0x1'));var rp=require(_0xfe34('0x2'));var fs=require('fs');var path=require(_0xfe34('0x3'));var rimraf=require(_0xfe34('0x4'));var config=require(_0xfe34('0x5'));var attributes=require(_0xfe34('0x6'));module['exports']=function(_0x1a3c2b,_0x24e8cb){return _0x1a3c2b[_0xfe34('0x7')](_0xfe34('0x8'),attributes,{'tableName':_0xfe34('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x676c=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ServicenowConfiguration'];(function(_0x1bdd2d,_0x308db2){var _0x3f723a=function(_0xff0e6b){while(--_0xff0e6b){_0x1bdd2d['push'](_0x1bdd2d['shift']());}};_0x3f723a(++_0x308db2);}(_0x676c,0x198));var _0xc676=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x676c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc676('0x0'));var util=require(_0xc676('0x1'));var logger=require(_0xc676('0x2'))('api');var moment=require(_0xc676('0x3'));var BPromise=require(_0xc676('0x4'));var rp=require(_0xc676('0x5'));var fs=require('fs');var path=require(_0xc676('0x6'));var rimraf=require(_0xc676('0x7'));var config=require(_0xc676('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xc676('0x9')]=function(_0x228e07,_0x13c5a7){return _0x228e07[_0xc676('0xa')](_0xc676('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 5a0f695..6fcb218 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 _0x6ddb=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x60fa84,_0x32dbeb){var _0x5ca30b=function(_0x59431a){while(--_0x59431a){_0x60fa84['push'](_0x60fa84['shift']());}};_0x5ca30b(++_0x32dbeb);}(_0x6ddb,0x1a6));var _0xb6dd=function(_0x8b8add,_0x39b275){_0x8b8add=_0x8b8add-0x0;var _0x236778=_0x6ddb[_0x8b8add];return _0x236778;};'use strict';var _=require(_0xb6dd('0x0'));var util=require('util');var moment=require(_0xb6dd('0x1'));var BPromise=require(_0xb6dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6dd('0x3'));var db=require(_0xb6dd('0x4'))['db'];var utils=require(_0xb6dd('0x5'));var logger=require(_0xb6dd('0x6'))(_0xb6dd('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb6dd('0x8')][_0xb6dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x240088,_0x4059a3,_0xe75811){return new BPromise(function(_0x5dfc39,_0x4cc29e){return client[_0xb6dd('0xa')](_0x240088,_0xe75811)[_0xb6dd('0xb')](function(_0x380cfc){logger[_0xb6dd('0xc')](_0xb6dd('0xd'),_0x4059a3,_0xb6dd('0xe'));logger[_0xb6dd('0xf')](_0xb6dd('0x10'),_0x4059a3,'request\x20sent',JSON[_0xb6dd('0x11')](_0x380cfc));if(_0x380cfc['error']){if(_0x380cfc['error'][_0xb6dd('0x12')]===0x1f4){logger[_0xb6dd('0x13')](_0xb6dd('0xd'),_0x4059a3,_0x380cfc[_0xb6dd('0x13')][_0xb6dd('0x14')]);return _0x4cc29e(_0x380cfc[_0xb6dd('0x13')][_0xb6dd('0x14')]);}logger[_0xb6dd('0x13')](_0xb6dd('0xd'),_0x4059a3,_0x380cfc[_0xb6dd('0x13')][_0xb6dd('0x14')]);return _0x5dfc39(_0x380cfc['error'][_0xb6dd('0x14')]);}else{logger[_0xb6dd('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4059a3,_0xb6dd('0xe'));_0x5dfc39(_0x380cfc[_0xb6dd('0x15')]['message']);}})[_0xb6dd('0x16')](function(_0x3c55a4){logger[_0xb6dd('0x13')](_0xb6dd('0xd'),_0x4059a3,_0x3c55a4);_0x4cc29e(_0x3c55a4);});});} \ No newline at end of file +var _0xa5b8=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x44ca31,_0x59d706){var _0x301e99=function(_0x1ae2b1){while(--_0x1ae2b1){_0x44ca31['push'](_0x44ca31['shift']());}};_0x301e99(++_0x59d706);}(_0xa5b8,0x148));var _0x8a5b=function(_0x18d958,_0x3eb2c8){_0x18d958=_0x18d958-0x0;var _0x28640b=_0xa5b8[_0x18d958];return _0x28640b;};'use strict';var _=require(_0x8a5b('0x0'));var util=require(_0x8a5b('0x1'));var moment=require('moment');var BPromise=require(_0x8a5b('0x2'));var rs=require(_0x8a5b('0x3'));var fs=require('fs');var Redis=require(_0x8a5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a5b('0x5'));var logger=require(_0x8a5b('0x6'))(_0x8a5b('0x7'));var config=require(_0x8a5b('0x8'));var jayson=require(_0x8a5b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43673d,_0x165fe8,_0x4bb64d){return new BPromise(function(_0x1d7288,_0x3d2079){return client['request'](_0x43673d,_0x4bb64d)['then'](function(_0x12d848){logger[_0x8a5b('0xa')](_0x8a5b('0xb'),_0x165fe8,_0x8a5b('0xc'));logger[_0x8a5b('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x165fe8,_0x8a5b('0xc'),JSON[_0x8a5b('0xe')](_0x12d848));if(_0x12d848[_0x8a5b('0xf')]){if(_0x12d848[_0x8a5b('0xf')][_0x8a5b('0x10')]===0x1f4){logger[_0x8a5b('0xf')](_0x8a5b('0xb'),_0x165fe8,_0x12d848['error'][_0x8a5b('0x11')]);return _0x3d2079(_0x12d848[_0x8a5b('0xf')]['message']);}logger[_0x8a5b('0xf')](_0x8a5b('0xb'),_0x165fe8,_0x12d848[_0x8a5b('0xf')][_0x8a5b('0x11')]);return _0x1d7288(_0x12d848[_0x8a5b('0xf')][_0x8a5b('0x11')]);}else{logger['info'](_0x8a5b('0xb'),_0x165fe8,_0x8a5b('0xc'));_0x1d7288(_0x12d848[_0x8a5b('0x12')][_0x8a5b('0x11')]);}})[_0x8a5b('0x13')](function(_0x41c175){logger[_0x8a5b('0xf')](_0x8a5b('0xb'),_0x165fe8,_0x41c175);_0x3d2079(_0x41c175);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index cc3458e..650a1ee 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 _0xb196=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','show','post','create','update','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb196,0xeb));var _0x6b19=function(_0x4e1501,_0x3e77ac){_0x4e1501=_0x4e1501-0x0;var _0x1aa409=_0xb196[_0x4e1501];return _0x1aa409;};'use strict';var multer=require('multer');var util=require(_0x6b19('0x0'));var path=require('path');var timeout=require(_0x6b19('0x1'));var express=require('express');var router=express[_0x6b19('0x2')]();var fs_extra=require(_0x6b19('0x3'));var auth=require(_0x6b19('0x4'));var interaction=require(_0x6b19('0x5'));var config=require(_0x6b19('0x6'));var controller=require(_0x6b19('0x7'));router[_0x6b19('0x8')]('/',auth['isAuthenticated'](),controller[_0x6b19('0x9')]);router[_0x6b19('0x8')](_0x6b19('0xa'),auth[_0x6b19('0xb')](),controller[_0x6b19('0xc')]);router[_0x6b19('0xd')]('/',auth['isAuthenticated'](),controller[_0x6b19('0xe')]);router['put'](_0x6b19('0xa'),auth[_0x6b19('0xb')](),controller[_0x6b19('0xf')]);router['delete'](_0x6b19('0xa'),auth[_0x6b19('0xb')](),controller[_0x6b19('0x10')]);module[_0x6b19('0x11')]=router; \ No newline at end of file +var _0xf624=['isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get'];(function(_0x4347ec,_0x41c4b8){var _0x4c8314=function(_0x583acd){while(--_0x583acd){_0x4347ec['push'](_0x4347ec['shift']());}};_0x4c8314(++_0x41c4b8);}(_0xf624,0x184));var _0x4f62=function(_0x2bea6e,_0x3ea0bb){_0x2bea6e=_0x2bea6e-0x0;var _0xfc1e4a=_0xf624[_0x2bea6e];return _0xfc1e4a;};'use strict';var multer=require(_0x4f62('0x0'));var util=require('util');var path=require(_0x4f62('0x1'));var timeout=require(_0x4f62('0x2'));var express=require(_0x4f62('0x3'));var router=express[_0x4f62('0x4')]();var fs_extra=require(_0x4f62('0x5'));var auth=require(_0x4f62('0x6'));var interaction=require(_0x4f62('0x7'));var config=require(_0x4f62('0x8'));var controller=require(_0x4f62('0x9'));router[_0x4f62('0xa')]('/',auth[_0x4f62('0xb')](),controller[_0x4f62('0xc')]);router[_0x4f62('0xa')](_0x4f62('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4f62('0xe')]('/',auth['isAuthenticated'](),controller[_0x4f62('0xf')]);router[_0x4f62('0x10')](_0x4f62('0xd'),auth[_0x4f62('0xb')](),controller[_0x4f62('0x11')]);router[_0x4f62('0x12')](_0x4f62('0xd'),auth[_0x4f62('0xb')](),controller[_0x4f62('0x13')]);module[_0x4f62('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index c25b106..d106730 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 _0x5a54=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x498a12,_0x4a2122){var _0x27897e=function(_0x13fe8b){while(--_0x13fe8b){_0x498a12['push'](_0x498a12['shift']());}};_0x27897e(++_0x4a2122);}(_0x5a54,0x1cf));var _0x45a5=function(_0x49cb2a,_0x30f953){_0x49cb2a=_0x49cb2a-0x0;var _0xea8e0b=_0x5a54[_0x49cb2a];return _0xea8e0b;};'use strict';var Sequelize=require(_0x45a5('0x0'));module[_0x45a5('0x1')]={'type':{'type':Sequelize[_0x45a5('0x2')](_0x45a5('0x3'),_0x45a5('0x4'),_0x45a5('0x5'),_0x45a5('0x6'),_0x45a5('0x7')),'defaultValue':_0x45a5('0x3')},'content':{'type':Sequelize[_0x45a5('0x8')]},'key':{'type':Sequelize[_0x45a5('0x8')]},'keyType':{'type':Sequelize[_0x45a5('0x2')](_0x45a5('0x3'),_0x45a5('0x4'),_0x45a5('0x5'))},'keyContent':{'type':Sequelize[_0x45a5('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x45a5('0x8')]},'customField':{'type':Sequelize[_0x45a5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x45a5('0x8')]}}; \ No newline at end of file +var _0x365e=['customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x365e,0x12c));var _0xe365=function(_0x2cd810,_0x2a4839){_0x2cd810=_0x2cd810-0x0;var _0x30f767=_0x365e[_0x2cd810];return _0x30f767;};'use strict';var Sequelize=require(_0xe365('0x0'));module[_0xe365('0x1')]={'type':{'type':Sequelize[_0xe365('0x2')](_0xe365('0x3'),_0xe365('0x4'),'customVariable','keyValue',_0xe365('0x5')),'defaultValue':_0xe365('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe365('0x2')]('string',_0xe365('0x4'),_0xe365('0x6'))},'keyContent':{'type':Sequelize[_0xe365('0x7')]},'idField':{'type':Sequelize[_0xe365('0x7')]},'nameField':{'type':Sequelize[_0xe365('0x7')]},'customField':{'type':Sequelize[_0xe365('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe365('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index f41ce1f..7ef2b02 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 _0xeeca=['includeAll','include','rows','params','catch','create','body','find','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x1cdbca,_0x31fc9d){var _0x410f3b=function(_0x24cd4e){while(--_0x24cd4e){_0x1cdbca['push'](_0x1cdbca['shift']());}};_0x410f3b(++_0x31fc9d);}(_0xeeca,0x8c));var _0xaeec=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0xeeca[_0x318840];return _0x223da4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaeec('0x0'));var zipdir=require(_0xaeec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaeec('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaeec('0x3'));var util=require(_0xaeec('0x4'));var path=require('path');var sox=require(_0xaeec('0x5'));var csv=require(_0xaeec('0x6'));var ejs=require(_0xaeec('0x7'));var fs=require('fs');var fs_extra=require(_0xaeec('0x8'));var _=require(_0xaeec('0x9'));var squel=require(_0xaeec('0xa'));var crypto=require(_0xaeec('0xb'));var jsforce=require(_0xaeec('0xc'));var deskjs=require(_0xaeec('0xd'));var toCsv=require(_0xaeec('0x6'));var querystring=require('querystring');var Papa=require(_0xaeec('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaeec('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaeec('0x10'));var logger=require(_0xaeec('0x11'))(_0xaeec('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaeec('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b1aa8,_0x2b6890){_0x2b6890=_0x2b6890||0xcc;return function(_0x3b88d4){if(_0x3b88d4){return _0x1b1aa8[_0xaeec('0x14')](_0x2b6890);}return _0x1b1aa8[_0xaeec('0x15')](_0x2b6890)[_0xaeec('0x16')]();};}function respondWithResult(_0x3a8bea,_0x27ce80){_0x27ce80=_0x27ce80||0xc8;return function(_0xeee94f){if(_0xeee94f){return _0x3a8bea[_0xaeec('0x15')](_0x27ce80)[_0xaeec('0x17')](_0xeee94f);}};}function respondWithFilteredResult(_0x1c2e46,_0x17c61b){return function(_0x504dd0){if(_0x504dd0){var _0x550abc=typeof _0x17c61b[_0xaeec('0x18')]===_0xaeec('0x19')&&typeof _0x17c61b[_0xaeec('0x1a')]==='undefined';var _0x8def1=_0x504dd0[_0xaeec('0x1b')];var _0x38e343=_0x550abc?0x0:_0x17c61b[_0xaeec('0x18')];var _0x358472=_0x550abc?_0x504dd0[_0xaeec('0x1b')]:_0x17c61b[_0xaeec('0x18')]+_0x17c61b[_0xaeec('0x1a')];var _0x308d61;if(_0x358472>=_0x8def1){_0x358472=_0x8def1;_0x308d61=0xc8;}else{_0x308d61=0xce;}_0x1c2e46[_0xaeec('0x15')](_0x308d61);return _0x1c2e46[_0xaeec('0x1c')]('Content-Range',_0x38e343+'-'+_0x358472+'/'+_0x8def1)[_0xaeec('0x17')](_0x504dd0);}return null;};}function patchUpdates(_0x49a8d3){return function(_0x17bb7f){try{jsonpatch['apply'](_0x17bb7f,_0x49a8d3,!![]);}catch(_0xfe9001){return BPromise[_0xaeec('0x1d')](_0xfe9001);}return _0x17bb7f[_0xaeec('0x1e')]();};}function saveUpdates(_0x49958a,_0x47f75f){return function(_0x3e28d9){if(_0x3e28d9){return _0x3e28d9[_0xaeec('0x1f')](_0x49958a)[_0xaeec('0x20')](function(_0x3fca20){return _0x3fca20;});}return null;};}function removeEntity(_0xf863cd,_0x1ef6e7){return function(_0x5e595c){if(_0x5e595c){return _0x5e595c[_0xaeec('0x21')]()['then'](function(){_0xf863cd[_0xaeec('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35e085,_0x3e56c4){return function(_0x58c216){if(!_0x58c216){_0x35e085[_0xaeec('0x14')](0x194);}return _0x58c216;};}function handleError(_0x370617,_0x3acda5){_0x3acda5=_0x3acda5||0x1f4;return function(_0x4b4beb){logger[_0xaeec('0x22')](_0x4b4beb[_0xaeec('0x23')]);if(_0x4b4beb[_0xaeec('0x24')]){delete _0x4b4beb[_0xaeec('0x24')];}_0x370617[_0xaeec('0x15')](_0x3acda5)['send'](_0x4b4beb);};}exports[_0xaeec('0x25')]=function(_0x289eb6,_0x504e9a){var _0x572302={},_0x89652a={},_0x24a7d4={'count':0x0,'rows':[]};var _0x2cdfc6=_[_0xaeec('0x26')](db[_0xaeec('0x27')][_0xaeec('0x28')],function(_0x437c05){return{'name':_0x437c05[_0xaeec('0x29')],'type':_0x437c05['type']['key']};});_0x89652a[_0xaeec('0x2a')]=_['map'](_0x2cdfc6,_0xaeec('0x24'));_0x89652a[_0xaeec('0x2b')]=_[_0xaeec('0x2c')](_0x289eb6[_0xaeec('0x2b')]);_0x89652a[_0xaeec('0x2d')]=_[_0xaeec('0x2e')](_0x89652a[_0xaeec('0x2a')],_0x89652a[_0xaeec('0x2b')]);_0x572302['attributes']=_['intersection'](_0x89652a[_0xaeec('0x2a')],qs[_0xaeec('0x2f')](_0x289eb6['query'][_0xaeec('0x2f')]));_0x572302[_0xaeec('0x30')]=_0x572302[_0xaeec('0x30')][_0xaeec('0x31')]?_0x572302[_0xaeec('0x30')]:_0x89652a['model'];if(!_0x289eb6[_0xaeec('0x2b')]['hasOwnProperty'](_0xaeec('0x32'))){_0x572302[_0xaeec('0x1a')]=qs[_0xaeec('0x1a')](_0x289eb6[_0xaeec('0x2b')]['limit']);_0x572302[_0xaeec('0x18')]=qs[_0xaeec('0x18')](_0x289eb6[_0xaeec('0x2b')][_0xaeec('0x18')]);}_0x572302['order']=qs['sort'](_0x289eb6[_0xaeec('0x2b')][_0xaeec('0x33')]);_0x572302['where']=qs['filters'](_[_0xaeec('0x34')](_0x289eb6[_0xaeec('0x2b')],_0x89652a[_0xaeec('0x2d')]),_0x2cdfc6);if(_0x289eb6[_0xaeec('0x2b')][_0xaeec('0x35')]){_0x572302[_0xaeec('0x36')]=_[_0xaeec('0x37')](_0x572302[_0xaeec('0x36')],{'$or':_['map'](_0x2cdfc6,function(_0x2ce523){if(_0x2ce523['type']!==_0xaeec('0x38')){var _0x537841={};_0x537841[_0x2ce523['name']]={'$like':'%'+_0x289eb6[_0xaeec('0x2b')][_0xaeec('0x35')]+'%'};return _0x537841;}})});}_0x572302=_[_0xaeec('0x37')]({},_0x572302,_0x289eb6[_0xaeec('0x39')]);var _0x20f6d1={'where':_0x572302[_0xaeec('0x36')]};return db[_0xaeec('0x27')][_0xaeec('0x1b')](_0x20f6d1)[_0xaeec('0x20')](function(_0x208268){_0x24a7d4[_0xaeec('0x1b')]=_0x208268;if(_0x289eb6[_0xaeec('0x2b')][_0xaeec('0x3a')]){_0x572302[_0xaeec('0x3b')]=[{'all':!![]}];}return db[_0xaeec('0x27')]['findAll'](_0x572302);})[_0xaeec('0x20')](function(_0x25cdc2){_0x24a7d4[_0xaeec('0x3c')]=_0x25cdc2;return _0x24a7d4;})[_0xaeec('0x20')](respondWithFilteredResult(_0x504e9a,_0x572302))['catch'](handleError(_0x504e9a,null));};exports['show']=function(_0x2e96e7,_0x2cdcd7){var _0x4831ef={'raw':!![],'where':{'id':_0x2e96e7[_0xaeec('0x3d')]['id']}},_0x3630cd={};_0x3630cd[_0xaeec('0x2a')]=_[_0xaeec('0x2c')](db[_0xaeec('0x27')][_0xaeec('0x28')]);_0x3630cd['query']=_[_0xaeec('0x2c')](_0x2e96e7[_0xaeec('0x2b')]);_0x3630cd['filters']=_[_0xaeec('0x2e')](_0x3630cd[_0xaeec('0x2a')],_0x3630cd['query']);_0x4831ef[_0xaeec('0x30')]=_[_0xaeec('0x2e')](_0x3630cd['model'],qs[_0xaeec('0x2f')](_0x2e96e7[_0xaeec('0x2b')]['fields']));_0x4831ef[_0xaeec('0x30')]=_0x4831ef[_0xaeec('0x30')]['length']?_0x4831ef[_0xaeec('0x30')]:_0x3630cd['model'];if(_0x2e96e7[_0xaeec('0x2b')]['includeAll']){_0x4831ef[_0xaeec('0x3b')]=[{'all':!![]}];}_0x4831ef=_['merge']({},_0x4831ef,_0x2e96e7['options']);return db[_0xaeec('0x27')]['find'](_0x4831ef)['then'](handleEntityNotFound(_0x2cdcd7,null))['then'](respondWithResult(_0x2cdcd7,null))[_0xaeec('0x3e')](handleError(_0x2cdcd7,null));};exports[_0xaeec('0x3f')]=function(_0x52b691,_0x1da868){return db[_0xaeec('0x27')]['create'](_0x52b691[_0xaeec('0x40')],{})[_0xaeec('0x20')](respondWithResult(_0x1da868,0xc9))['catch'](handleError(_0x1da868,null));};exports[_0xaeec('0x1f')]=function(_0x652946,_0x31576){if(_0x652946['body']['id']){delete _0x652946[_0xaeec('0x40')]['id'];}return db[_0xaeec('0x27')][_0xaeec('0x41')]({'where':{'id':_0x652946[_0xaeec('0x3d')]['id']}})[_0xaeec('0x20')](handleEntityNotFound(_0x31576,null))[_0xaeec('0x20')](saveUpdates(_0x652946[_0xaeec('0x40')],null))[_0xaeec('0x20')](respondWithResult(_0x31576,null))[_0xaeec('0x3e')](handleError(_0x31576,null));};exports[_0xaeec('0x21')]=function(_0x2bfdfc,_0x2f2a89){return db[_0xaeec('0x27')][_0xaeec('0x41')]({'where':{'id':_0x2bfdfc['params']['id']}})[_0xaeec('0x20')](handleEntityNotFound(_0x2f2a89,null))[_0xaeec('0x20')](removeEntity(_0x2f2a89,null))[_0xaeec('0x3e')](handleError(_0x2f2a89,null));}; \ No newline at end of file +var _0x00ca=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','ServicenowField','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','catch','show','find','create','body','params','destroy','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x17165f,_0x59a71){var _0x2e3574=function(_0x2edc03){while(--_0x2edc03){_0x17165f['push'](_0x17165f['shift']());}};_0x2e3574(++_0x59a71);}(_0x00ca,0x1df));var _0xa00c=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x00ca[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa00c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa00c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa00c('0x2'));var Mustache=require(_0xa00c('0x3'));var util=require(_0xa00c('0x4'));var path=require(_0xa00c('0x5'));var sox=require(_0xa00c('0x6'));var csv=require(_0xa00c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa00c('0x8'));var squel=require('squel');var crypto=require(_0xa00c('0x9'));var jsforce=require(_0xa00c('0xa'));var deskjs=require(_0xa00c('0xb'));var toCsv=require(_0xa00c('0x7'));var querystring=require(_0xa00c('0xc'));var Papa=require(_0xa00c('0xd'));var Redis=require('ioredis');var authService=require(_0xa00c('0xe'));var qs=require(_0xa00c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa00c('0x10'));var logger=require(_0xa00c('0x11'))(_0xa00c('0x12'));var utils=require('../../config/utils');var config=require(_0xa00c('0x13'));var licenseUtil=require(_0xa00c('0x14'));var db=require(_0xa00c('0x15'))['db'];function respondWithStatusCode(_0x2a0546,_0x2b76b6){_0x2b76b6=_0x2b76b6||0xcc;return function(_0x52f274){if(_0x52f274){return _0x2a0546[_0xa00c('0x16')](_0x2b76b6);}return _0x2a0546[_0xa00c('0x17')](_0x2b76b6)['end']();};}function respondWithResult(_0x55a307,_0x41a02f){_0x41a02f=_0x41a02f||0xc8;return function(_0x45d232){if(_0x45d232){return _0x55a307[_0xa00c('0x17')](_0x41a02f)[_0xa00c('0x18')](_0x45d232);}};}function respondWithFilteredResult(_0xf25c0e,_0x62e905){return function(_0x3bf21e){if(_0x3bf21e){var _0x2c5834=typeof _0x62e905[_0xa00c('0x19')]===_0xa00c('0x1a')&&typeof _0x62e905[_0xa00c('0x1b')]===_0xa00c('0x1a');var _0x2776f7=_0x3bf21e[_0xa00c('0x1c')];var _0x5c65cd=_0x2c5834?0x0:_0x62e905[_0xa00c('0x19')];var _0x4ca99c=_0x2c5834?_0x3bf21e[_0xa00c('0x1c')]:_0x62e905[_0xa00c('0x19')]+_0x62e905[_0xa00c('0x1b')];var _0x3099ea;if(_0x4ca99c>=_0x2776f7){_0x4ca99c=_0x2776f7;_0x3099ea=0xc8;}else{_0x3099ea=0xce;}_0xf25c0e['status'](_0x3099ea);return _0xf25c0e[_0xa00c('0x1d')](_0xa00c('0x1e'),_0x5c65cd+'-'+_0x4ca99c+'/'+_0x2776f7)[_0xa00c('0x18')](_0x3bf21e);}return null;};}function patchUpdates(_0x55f318){return function(_0x25f373){try{jsonpatch[_0xa00c('0x1f')](_0x25f373,_0x55f318,!![]);}catch(_0x244c74){return BPromise[_0xa00c('0x20')](_0x244c74);}return _0x25f373[_0xa00c('0x21')]();};}function saveUpdates(_0x53240b,_0x441785){return function(_0x405482){if(_0x405482){return _0x405482[_0xa00c('0x22')](_0x53240b)[_0xa00c('0x23')](function(_0x4c4f8d){return _0x4c4f8d;});}return null;};}function removeEntity(_0x21366a,_0x502716){return function(_0x318da9){if(_0x318da9){return _0x318da9['destroy']()[_0xa00c('0x23')](function(){_0x21366a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f446e,_0x5ac26f){return function(_0x37474d){if(!_0x37474d){_0x4f446e[_0xa00c('0x16')](0x194);}return _0x37474d;};}function handleError(_0x9cf62f,_0x45c6d3){_0x45c6d3=_0x45c6d3||0x1f4;return function(_0x2cff8b){logger[_0xa00c('0x24')](_0x2cff8b[_0xa00c('0x25')]);if(_0x2cff8b[_0xa00c('0x26')]){delete _0x2cff8b['name'];}_0x9cf62f[_0xa00c('0x17')](_0x45c6d3)['send'](_0x2cff8b);};}exports['index']=function(_0x76d967,_0xc50aff){var _0xaa451={},_0x51e93f={},_0xd8fd71={'count':0x0,'rows':[]};var _0x43e434=_[_0xa00c('0x27')](db[_0xa00c('0x28')]['rawAttributes'],function(_0x5eee5b){return{'name':_0x5eee5b[_0xa00c('0x29')],'type':_0x5eee5b[_0xa00c('0x2a')][_0xa00c('0x2b')]};});_0x51e93f[_0xa00c('0x2c')]=_['map'](_0x43e434,_0xa00c('0x26'));_0x51e93f['query']=_[_0xa00c('0x2d')](_0x76d967[_0xa00c('0x2e')]);_0x51e93f['filters']=_[_0xa00c('0x2f')](_0x51e93f[_0xa00c('0x2c')],_0x51e93f[_0xa00c('0x2e')]);_0xaa451[_0xa00c('0x30')]=_[_0xa00c('0x2f')](_0x51e93f[_0xa00c('0x2c')],qs['fields'](_0x76d967[_0xa00c('0x2e')][_0xa00c('0x31')]));_0xaa451[_0xa00c('0x30')]=_0xaa451[_0xa00c('0x30')][_0xa00c('0x32')]?_0xaa451['attributes']:_0x51e93f[_0xa00c('0x2c')];if(!_0x76d967[_0xa00c('0x2e')][_0xa00c('0x33')](_0xa00c('0x34'))){_0xaa451[_0xa00c('0x1b')]=qs[_0xa00c('0x1b')](_0x76d967['query'][_0xa00c('0x1b')]);_0xaa451['offset']=qs[_0xa00c('0x19')](_0x76d967[_0xa00c('0x2e')][_0xa00c('0x19')]);}_0xaa451[_0xa00c('0x35')]=qs['sort'](_0x76d967[_0xa00c('0x2e')][_0xa00c('0x36')]);_0xaa451['where']=qs[_0xa00c('0x37')](_[_0xa00c('0x38')](_0x76d967[_0xa00c('0x2e')],_0x51e93f['filters']),_0x43e434);if(_0x76d967[_0xa00c('0x2e')][_0xa00c('0x39')]){_0xaa451[_0xa00c('0x3a')]=_['merge'](_0xaa451[_0xa00c('0x3a')],{'$or':_[_0xa00c('0x27')](_0x43e434,function(_0x13efa7){if(_0x13efa7[_0xa00c('0x2a')]!==_0xa00c('0x3b')){var _0x127f89={};_0x127f89[_0x13efa7[_0xa00c('0x26')]]={'$like':'%'+_0x76d967[_0xa00c('0x2e')][_0xa00c('0x39')]+'%'};return _0x127f89;}})});}_0xaa451=_[_0xa00c('0x3c')]({},_0xaa451,_0x76d967['options']);var _0x19c99f={'where':_0xaa451[_0xa00c('0x3a')]};return db[_0xa00c('0x28')]['count'](_0x19c99f)[_0xa00c('0x23')](function(_0x2b9b0b){_0xd8fd71[_0xa00c('0x1c')]=_0x2b9b0b;if(_0x76d967['query'][_0xa00c('0x3d')]){_0xaa451[_0xa00c('0x3e')]=[{'all':!![]}];}return db[_0xa00c('0x28')][_0xa00c('0x3f')](_0xaa451);})[_0xa00c('0x23')](function(_0x3de6c9){_0xd8fd71['rows']=_0x3de6c9;return _0xd8fd71;})[_0xa00c('0x23')](respondWithFilteredResult(_0xc50aff,_0xaa451))[_0xa00c('0x40')](handleError(_0xc50aff,null));};exports[_0xa00c('0x41')]=function(_0x5c6240,_0x5305bd){var _0x497dbf={'raw':!![],'where':{'id':_0x5c6240['params']['id']}},_0x545fff={};_0x545fff[_0xa00c('0x2c')]=_[_0xa00c('0x2d')](db['ServicenowField']['rawAttributes']);_0x545fff[_0xa00c('0x2e')]=_[_0xa00c('0x2d')](_0x5c6240[_0xa00c('0x2e')]);_0x545fff[_0xa00c('0x37')]=_['intersection'](_0x545fff[_0xa00c('0x2c')],_0x545fff['query']);_0x497dbf['attributes']=_['intersection'](_0x545fff['model'],qs['fields'](_0x5c6240[_0xa00c('0x2e')][_0xa00c('0x31')]));_0x497dbf[_0xa00c('0x30')]=_0x497dbf['attributes']['length']?_0x497dbf['attributes']:_0x545fff[_0xa00c('0x2c')];if(_0x5c6240['query'][_0xa00c('0x3d')]){_0x497dbf[_0xa00c('0x3e')]=[{'all':!![]}];}_0x497dbf=_['merge']({},_0x497dbf,_0x5c6240['options']);return db[_0xa00c('0x28')][_0xa00c('0x42')](_0x497dbf)['then'](handleEntityNotFound(_0x5305bd,null))[_0xa00c('0x23')](respondWithResult(_0x5305bd,null))['catch'](handleError(_0x5305bd,null));};exports[_0xa00c('0x43')]=function(_0x257d23,_0x2555b0){return db['ServicenowField'][_0xa00c('0x43')](_0x257d23['body'],{})[_0xa00c('0x23')](respondWithResult(_0x2555b0,0xc9))[_0xa00c('0x40')](handleError(_0x2555b0,null));};exports[_0xa00c('0x22')]=function(_0x4653f7,_0x814c8b){if(_0x4653f7[_0xa00c('0x44')]['id']){delete _0x4653f7[_0xa00c('0x44')]['id'];}return db[_0xa00c('0x28')][_0xa00c('0x42')]({'where':{'id':_0x4653f7[_0xa00c('0x45')]['id']}})[_0xa00c('0x23')](handleEntityNotFound(_0x814c8b,null))[_0xa00c('0x23')](saveUpdates(_0x4653f7['body'],null))[_0xa00c('0x23')](respondWithResult(_0x814c8b,null))[_0xa00c('0x40')](handleError(_0x814c8b,null));};exports[_0xa00c('0x46')]=function(_0x24303f,_0x34bb07){return db[_0xa00c('0x28')][_0xa00c('0x42')]({'where':{'id':_0x24303f[_0xa00c('0x45')]['id']}})[_0xa00c('0x23')](handleEntityNotFound(_0x34bb07,null))[_0xa00c('0x23')](removeEntity(_0x34bb07,null))[_0xa00c('0x40')](handleError(_0x34bb07,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 21f4417..960d83b 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 _0x28d3=['path','rimraf','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x36d7a6,_0x242da1){var _0x5a5c41=function(_0x104a43){while(--_0x104a43){_0x36d7a6['push'](_0x36d7a6['shift']());}};_0x5a5c41(++_0x242da1);}(_0x28d3,0x18e));var _0x328d=function(_0x3581dc,_0x57bf55){_0x3581dc=_0x3581dc-0x0;var _0x4eaef8=_0x28d3[_0x3581dc];return _0x4eaef8;};'use strict';var _=require('lodash');var util=require(_0x328d('0x0'));var logger=require(_0x328d('0x1'))('api');var moment=require(_0x328d('0x2'));var BPromise=require(_0x328d('0x3'));var rp=require(_0x328d('0x4'));var fs=require('fs');var path=require(_0x328d('0x5'));var rimraf=require(_0x328d('0x6'));var config=require('../../config/environment');var attributes=require(_0x328d('0x7'));module['exports']=function(_0x5791ce,_0x4b6768){return _0x5791ce[_0x328d('0x8')](_0x328d('0x9'),attributes,{'tableName':_0x328d('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x328d('0xb'),_0x328d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4045=['api','bluebird','request-promise','path','rimraf','../../config/environment','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x2b7312,_0x599b03){var _0x2a72c9=function(_0x94cc67){while(--_0x94cc67){_0x2b7312['push'](_0x2b7312['shift']());}};_0x2a72c9(++_0x599b03);}(_0x4045,0x186));var _0x5404=function(_0x37ac7b,_0xefd900){_0x37ac7b=_0x37ac7b-0x0;var _0x199f6f=_0x4045[_0x37ac7b];return _0x199f6f;};'use strict';var _=require('lodash');var util=require(_0x5404('0x0'));var logger=require(_0x5404('0x1'))(_0x5404('0x2'));var moment=require('moment');var BPromise=require(_0x5404('0x3'));var rp=require(_0x5404('0x4'));var fs=require('fs');var path=require(_0x5404('0x5'));var rimraf=require(_0x5404('0x6'));var config=require(_0x5404('0x7'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x56cd41,_0x3bb9f5){return _0x56cd41[_0x5404('0x8')](_0x5404('0x9'),attributes,{'tableName':_0x5404('0xa'),'paranoid':![],'indexes':[{'name':_0x5404('0xb'),'fields':[_0x5404('0xc'),_0x5404('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 9e4c1d9..2d4ec35 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 _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x5f02a6,_0x2ecf26){var _0x2a0b8f=function(_0x5bb998){while(--_0x5bb998){_0x5f02a6['push'](_0x5f02a6['shift']());}};_0x2a0b8f(++_0x2ecf26);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1aba2b,_0x474a5c){_0x1aba2b=_0x1aba2b-0x0;var _0x3e0bd3=_0x9ffd[_0x1aba2b];return _0x3e0bd3;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x476a0a,_0x31bd93){var _0x3c452b=function(_0x40b9ec){while(--_0x40b9ec){_0x476a0a['push'](_0x476a0a['shift']());}};_0x3c452b(++_0x31bd93);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0xcb91[_0x199c03];return _0x11a7d4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index ee0f28b..e1fa45a 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3339b2,_0x35b63b){var _0x1fd144=function(_0x21ca20){while(--_0x21ca20){_0x3339b2['push'](_0x3339b2['shift']());}};_0x1fd144(++_0x35b63b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2c73ee,_0x431501){var _0x1f476a=function(_0x35af04){while(--_0x35af04){_0x2c73ee['push'](_0x2c73ee['shift']());}};_0x1f476a(++_0x431501);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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 96779c0..b1a9d07 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(_0x5342f2,_0x1efd2d){var _0x1a5fac=function(_0x58bd6f){while(--_0x58bd6f){_0x5342f2['push'](_0x5342f2['shift']());}};_0x1a5fac(++_0x1efd2d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x6ca016,_0xc4c8c1){var _0x235d37=function(_0x49c08c){while(--_0x49c08c){_0x6ca016['push'](_0x6ca016['shift']());}};_0x235d37(++_0xc4c8c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 02a7a8c..0be87a8 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 _0xc362=['../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','destroy','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','duration_hours','duration_minutes','parent_id','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','Calls','values','module_fields','remove','includes','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xc362,0x149));var _0x2c36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc362[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2c36('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2c36('0x1'));var rp=require(_0x2c36('0x2'));var moment=require('moment');var BPromise=require(_0x2c36('0x3'));var Mustache=require(_0x2c36('0x4'));var util=require(_0x2c36('0x5'));var path=require(_0x2c36('0x6'));var sox=require(_0x2c36('0x7'));var csv=require('to-csv');var ejs=require(_0x2c36('0x8'));var fs=require('fs');var fs_extra=require(_0x2c36('0x9'));var _=require(_0x2c36('0xa'));var squel=require('squel');var crypto=require(_0x2c36('0xb'));var jsforce=require(_0x2c36('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2c36('0xd'));var qs=require(_0x2c36('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c36('0xf'));var logger=require(_0x2c36('0x10'))('api');var utils=require(_0x2c36('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2c36('0x12'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x361961,_0x4725e8){_0x4725e8=_0x4725e8||0xcc;return function(_0x4e23d5){if(_0x4e23d5){return _0x361961[_0x2c36('0x13')](_0x4725e8);}return _0x361961[_0x2c36('0x14')](_0x4725e8)[_0x2c36('0x15')]();};}function respondWithResult(_0x370720,_0x12d6a6){_0x12d6a6=_0x12d6a6||0xc8;return function(_0x4662dd){if(_0x4662dd){return _0x370720[_0x2c36('0x14')](_0x12d6a6)['json'](_0x4662dd);}};}function respondWithFilteredResult(_0x92cfad,_0x5a7b1d){return function(_0x45aa87){if(_0x45aa87){var _0x4b03f5=typeof _0x5a7b1d['offset']===_0x2c36('0x16')&&typeof _0x5a7b1d[_0x2c36('0x17')]===_0x2c36('0x16');var _0x572541=_0x45aa87[_0x2c36('0x18')];var _0x433253=_0x4b03f5?0x0:_0x5a7b1d[_0x2c36('0x19')];var _0xe6d7ed=_0x4b03f5?_0x45aa87[_0x2c36('0x18')]:_0x5a7b1d[_0x2c36('0x19')]+_0x5a7b1d[_0x2c36('0x17')];var _0x2a30d9;if(_0xe6d7ed>=_0x572541){_0xe6d7ed=_0x572541;_0x2a30d9=0xc8;}else{_0x2a30d9=0xce;}_0x92cfad[_0x2c36('0x14')](_0x2a30d9);return _0x92cfad[_0x2c36('0x1a')](_0x2c36('0x1b'),_0x433253+'-'+_0xe6d7ed+'/'+_0x572541)[_0x2c36('0x1c')](_0x45aa87);}return null;};}function patchUpdates(_0x249622){return function(_0x115a9f){try{jsonpatch[_0x2c36('0x1d')](_0x115a9f,_0x249622,!![]);}catch(_0x4fc7e0){return BPromise[_0x2c36('0x1e')](_0x4fc7e0);}return _0x115a9f['save']();};}function saveUpdates(_0x50526f,_0x5c5175){return function(_0x199380){if(_0x199380){return _0x199380[_0x2c36('0x1f')](_0x50526f)['then'](function(_0x47d9a2){return _0x47d9a2;});}return null;};}function removeEntity(_0x4bdab7,_0x1c11c4){return function(_0xd47f69){if(_0xd47f69){return _0xd47f69[_0x2c36('0x20')]()['then'](function(){_0x4bdab7[_0x2c36('0x14')](0xcc)[_0x2c36('0x15')]();});}};}function handleEntityNotFound(_0x1f0c58,_0x542155){return function(_0x230e83){if(!_0x230e83){_0x1f0c58[_0x2c36('0x13')](0x194);}return _0x230e83;};}function handleError(_0x115be9,_0x29c7fb){_0x29c7fb=_0x29c7fb||0x1f4;return function(_0x5b9e91){logger['error'](_0x5b9e91['stack']);if(_0x5b9e91[_0x2c36('0x21')]){delete _0x5b9e91[_0x2c36('0x21')];}_0x115be9[_0x2c36('0x14')](_0x29c7fb)[_0x2c36('0x22')](_0x5b9e91);};}exports[_0x2c36('0x23')]=function(_0x135bb0,_0x1698b4){var _0x281933={},_0x45613b={},_0x198a41={'count':0x0,'rows':[]};var _0x462446=_[_0x2c36('0x24')](db[_0x2c36('0x25')][_0x2c36('0x26')],function(_0x1b0bcd){return{'name':_0x1b0bcd[_0x2c36('0x27')],'type':_0x1b0bcd[_0x2c36('0x28')][_0x2c36('0x29')]};});_0x45613b['model']=_[_0x2c36('0x24')](_0x462446,_0x2c36('0x21'));_0x45613b['query']=_[_0x2c36('0x2a')](_0x135bb0[_0x2c36('0x2b')]);_0x45613b[_0x2c36('0x2c')]=_[_0x2c36('0x2d')](_0x45613b[_0x2c36('0x2e')],_0x45613b[_0x2c36('0x2b')]);_0x281933[_0x2c36('0x2f')]=_[_0x2c36('0x2d')](_0x45613b[_0x2c36('0x2e')],qs[_0x2c36('0x30')](_0x135bb0[_0x2c36('0x2b')][_0x2c36('0x30')]));_0x281933[_0x2c36('0x2f')]=_0x281933[_0x2c36('0x2f')][_0x2c36('0x31')]?_0x281933[_0x2c36('0x2f')]:_0x45613b['model'];if(!_0x135bb0[_0x2c36('0x2b')][_0x2c36('0x32')]('nolimit')){_0x281933['limit']=qs[_0x2c36('0x17')](_0x135bb0[_0x2c36('0x2b')]['limit']);_0x281933[_0x2c36('0x19')]=qs[_0x2c36('0x19')](_0x135bb0[_0x2c36('0x2b')][_0x2c36('0x19')]);}_0x281933[_0x2c36('0x33')]=qs[_0x2c36('0x34')](_0x135bb0['query'][_0x2c36('0x34')]);_0x281933[_0x2c36('0x35')]=qs[_0x2c36('0x2c')](_[_0x2c36('0x36')](_0x135bb0[_0x2c36('0x2b')],_0x45613b[_0x2c36('0x2c')]),_0x462446);if(_0x135bb0[_0x2c36('0x2b')][_0x2c36('0x37')]){_0x281933[_0x2c36('0x35')]=_[_0x2c36('0x38')](_0x281933[_0x2c36('0x35')],{'$or':_[_0x2c36('0x24')](_0x462446,function(_0x5bbf04){if(_0x5bbf04[_0x2c36('0x28')]!==_0x2c36('0x39')){var _0x4e278d={};_0x4e278d[_0x5bbf04[_0x2c36('0x21')]]={'$like':'%'+_0x135bb0[_0x2c36('0x2b')]['filter']+'%'};return _0x4e278d;}})});}_0x281933=_[_0x2c36('0x38')]({},_0x281933,_0x135bb0[_0x2c36('0x3a')]);var _0xb1cfb5={'where':_0x281933[_0x2c36('0x35')]};return db[_0x2c36('0x25')]['count'](_0xb1cfb5)[_0x2c36('0x3b')](function(_0x1e10fa){_0x198a41[_0x2c36('0x18')]=_0x1e10fa;if(_0x135bb0[_0x2c36('0x2b')]['includeAll']){_0x281933[_0x2c36('0x3c')]=[{'all':!![]}];}return db[_0x2c36('0x25')][_0x2c36('0x3d')](_0x281933);})[_0x2c36('0x3b')](function(_0x33126b){_0x198a41[_0x2c36('0x3e')]=_0x33126b;return _0x198a41;})['then'](respondWithFilteredResult(_0x1698b4,_0x281933))[_0x2c36('0x3f')](handleError(_0x1698b4,null));};exports[_0x2c36('0x40')]=function(_0x37374d,_0x13da58){var _0x1cd07d={'raw':![],'where':{'id':_0x37374d[_0x2c36('0x41')]['id']}},_0x562003={};_0x562003[_0x2c36('0x2e')]=_[_0x2c36('0x2a')](db[_0x2c36('0x25')][_0x2c36('0x26')]);_0x562003[_0x2c36('0x2b')]=_[_0x2c36('0x2a')](_0x37374d[_0x2c36('0x2b')]);_0x562003['filters']=_['intersection'](_0x562003[_0x2c36('0x2e')],_0x562003['query']);_0x1cd07d[_0x2c36('0x2f')]=_['intersection'](_0x562003[_0x2c36('0x2e')],qs['fields'](_0x37374d[_0x2c36('0x2b')][_0x2c36('0x30')]));_0x1cd07d[_0x2c36('0x2f')]=_0x1cd07d[_0x2c36('0x2f')][_0x2c36('0x31')]?_0x1cd07d[_0x2c36('0x2f')]:_0x562003[_0x2c36('0x2e')];if(_0x37374d['query'][_0x2c36('0x42')]){_0x1cd07d[_0x2c36('0x3c')]=[{'all':!![]}];}_0x1cd07d=_[_0x2c36('0x38')]({},_0x1cd07d,_0x37374d[_0x2c36('0x3a')]);return db[_0x2c36('0x25')][_0x2c36('0x43')](_0x1cd07d)[_0x2c36('0x3b')](handleEntityNotFound(_0x13da58,null))['then'](respondWithResult(_0x13da58,null))[_0x2c36('0x3f')](handleError(_0x13da58,null));};exports[_0x2c36('0x44')]=function(_0x5b0804,_0x12aee9){return db['SugarcrmAccount'][_0x2c36('0x44')](_0x5b0804[_0x2c36('0x45')],{})[_0x2c36('0x3b')](respondWithResult(_0x12aee9,0xc9))[_0x2c36('0x3f')](handleError(_0x12aee9,null));};exports[_0x2c36('0x1f')]=function(_0x57d5fd,_0x21b31f){if(_0x57d5fd[_0x2c36('0x45')]['id']){delete _0x57d5fd[_0x2c36('0x45')]['id'];}return db['SugarcrmAccount'][_0x2c36('0x43')]({'where':{'id':_0x57d5fd[_0x2c36('0x41')]['id']}})[_0x2c36('0x3b')](handleEntityNotFound(_0x21b31f,null))[_0x2c36('0x3b')](saveUpdates(_0x57d5fd[_0x2c36('0x45')],null))[_0x2c36('0x3b')](respondWithResult(_0x21b31f,null))[_0x2c36('0x3f')](handleError(_0x21b31f,null));};exports[_0x2c36('0x20')]=function(_0x3774c8,_0x11f9a0){return db[_0x2c36('0x25')][_0x2c36('0x43')]({'where':{'id':_0x3774c8[_0x2c36('0x41')]['id']}})[_0x2c36('0x3b')](handleEntityNotFound(_0x11f9a0,null))[_0x2c36('0x3b')](removeEntity(_0x11f9a0,null))['catch'](handleError(_0x11f9a0,null));};exports[_0x2c36('0x46')]=function(_0x1bae44,_0xef8ee7,_0x278df9){var _0x10cba3={};var _0x485456={};var _0x5258b7;var _0x759a6;return db['SugarcrmAccount'][_0x2c36('0x47')]({'where':{'id':_0x1bae44[_0x2c36('0x41')]['id']}})[_0x2c36('0x3b')](handleEntityNotFound(_0xef8ee7,null))[_0x2c36('0x3b')](function(_0x19c4a0){if(_0x19c4a0){_0x5258b7=_0x19c4a0;_0x485456[_0x2c36('0x2e')]=_[_0x2c36('0x2a')](db['SugarcrmConfiguration'][_0x2c36('0x26')]);_0x485456[_0x2c36('0x2b')]=_[_0x2c36('0x2a')](_0x1bae44['query']);_0x485456[_0x2c36('0x2c')]=_[_0x2c36('0x2d')](_0x485456['model'],_0x485456['query']);_0x10cba3[_0x2c36('0x2f')]=_[_0x2c36('0x2d')](_0x485456[_0x2c36('0x2e')],qs[_0x2c36('0x30')](_0x1bae44['query']['fields']));_0x10cba3[_0x2c36('0x2f')]=_0x10cba3[_0x2c36('0x2f')][_0x2c36('0x31')]?_0x10cba3[_0x2c36('0x2f')]:_0x485456['model'];_0x10cba3[_0x2c36('0x33')]=qs[_0x2c36('0x34')](_0x1bae44[_0x2c36('0x2b')][_0x2c36('0x34')]);_0x10cba3[_0x2c36('0x35')]=qs[_0x2c36('0x2c')](_['pick'](_0x1bae44[_0x2c36('0x2b')],_0x485456['filters']));if(_0x1bae44[_0x2c36('0x2b')][_0x2c36('0x37')]){_0x10cba3['where']=_[_0x2c36('0x38')](_0x10cba3[_0x2c36('0x35')],{'$or':_[_0x2c36('0x24')](_0x10cba3[_0x2c36('0x2f')],function(_0x2e2a9d){var _0x5add9f={};_0x5add9f[_0x2e2a9d]={'$like':'%'+_0x1bae44[_0x2c36('0x2b')]['filter']+'%'};return _0x5add9f;})});}_0x10cba3=_[_0x2c36('0x38')]({},_0x10cba3,_0x1bae44['options']);return _0x5258b7[_0x2c36('0x46')](_0x10cba3);}})[_0x2c36('0x3b')](function(_0x3b67c4){if(_0x3b67c4){_0x759a6=_0x3b67c4[_0x2c36('0x31')];if(!_0x1bae44['query'][_0x2c36('0x32')]('nolimit')){_0x10cba3[_0x2c36('0x17')]=qs[_0x2c36('0x17')](_0x1bae44[_0x2c36('0x2b')][_0x2c36('0x17')]);_0x10cba3[_0x2c36('0x19')]=qs[_0x2c36('0x19')](_0x1bae44[_0x2c36('0x2b')][_0x2c36('0x19')]);}return _0x5258b7['getConfigurations'](_0x10cba3);}})['then'](function(_0x3ebd84){if(_0x3ebd84){return _0x3ebd84?{'count':_0x759a6,'rows':_0x3ebd84}:null;}})[_0x2c36('0x3b')](respondWithResult(_0xef8ee7,null))[_0x2c36('0x3f')](handleError(_0xef8ee7,null));};exports[_0x2c36('0x48')]=function(_0x2e33c5,_0x3ca424,_0x249141){if(_0x2e33c5[_0x2c36('0x45')]['id']){delete _0x2e33c5[_0x2c36('0x45')]['id'];}return db['SugarcrmAccount'][_0x2c36('0x47')]({'where':{'id':_0x2e33c5['params']['id']}})['then'](handleEntityNotFound(_0x3ca424,null))[_0x2c36('0x3b')](function(_0x3b7ad1){if(_0x3b7ad1){_0x2e33c5[_0x2c36('0x45')]['AccountId']=_0x3b7ad1['id'];_0x2e33c5[_0x2c36('0x45')][_0x2c36('0x49')]=integrations[_0x2c36('0x4a')](_0x2e33c5['body']['channel'],_0x2e33c5[_0x2c36('0x45')][_0x2c36('0x28')]);_0x2e33c5[_0x2c36('0x45')][_0x2c36('0x4b')]=integrations[_0x2c36('0x4c')](_0x2e33c5[_0x2c36('0x45')][_0x2c36('0x4d')],_0x2e33c5[_0x2c36('0x45')][_0x2c36('0x28')]);return db[_0x2c36('0x4e')][_0x2c36('0x44')](_0x2e33c5[_0x2c36('0x45')],{'include':[{'model':db[_0x2c36('0x4f')],'as':'Subjects'},{'model':db[_0x2c36('0x4f')],'as':_0x2c36('0x4b')}]});}return null;})[_0x2c36('0x3b')](respondWithResult(_0x3ca424,null))[_0x2c36('0x3f')](handleError(_0x3ca424,null));};exports[_0x2c36('0x50')]=function(_0x14933c,_0x2c0741,_0x7a5c5a){var _0xd5fe62='';var _0x2d22ea=['id',_0x2c36('0x21'),_0x2c36('0x51'),_0x2c36('0x52'),'description','date_start',_0x2c36('0x53'),_0x2c36('0x54'),_0x2c36('0x55'),'parent_type','parent_name',_0x2c36('0x56')];return db[_0x2c36('0x25')][_0x2c36('0x47')]({'where':{'id':_0x14933c['params']['id']},'attributes':['id',_0x2c36('0x57'),_0x2c36('0x58'),_0x2c36('0x59')]})[_0x2c36('0x3b')](handleEntityNotFound(_0x2c0741,null))[_0x2c36('0x3b')](function(_0x5d0992){if(_0x5d0992){_0xd5fe62=_0x5d0992['remoteUri'];var _0x140b9c=_0xd5fe62[_0x2c36('0x5a')](-0x1);if(_0x140b9c==='/'){_0xd5fe62=_0xd5fe62[_0x2c36('0x5b')](0x0,_0xd5fe62[_0x2c36('0x5c')](_0x140b9c));}return rp({'method':'POST','uri':util[_0x2c36('0x5d')](_0x2c36('0x5e'),_0xd5fe62,_0x2c36('0x5f')),'json':!![],'form':{'method':_0x2c36('0x60'),'input_type':_0x2c36('0x61'),'response_type':'JSON','rest_data':JSON[_0x2c36('0x62')]({'user_auth':{'user_name':_0x5d0992[_0x2c36('0x57')],'password':_0x5d0992[_0x2c36('0x58')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x1b1413){if(_0x1b1413&&_0x1b1413[_0x2c36('0x21')]!==_0x2c36('0x63')&&_0x1b1413['name']!==_0x2c36('0x64')){return rp({'method':_0x2c36('0x65'),'uri':util[_0x2c36('0x5d')](_0x2c36('0x5e'),_0xd5fe62,_0x2c36('0x5f')),'json':!![],'form':{'method':_0x2c36('0x66'),'input_type':_0x2c36('0x61'),'response_type':_0x2c36('0x61'),'rest_data':JSON[_0x2c36('0x62')]({'session':_0x1b1413['id'],'module_name':_0x2c36('0x67')})}})[_0x2c36('0x3b')](function(_0x777bc7){if(_0x777bc7){var _0x597d25=_[_0x2c36('0x68')](_0x777bc7[_0x2c36('0x69')]);_[_0x2c36('0x6a')](_0x597d25,function(_0x44eb15){return _0x2d22ea[_0x2c36('0x6b')](_0x44eb15[_0x2c36('0x21')]);});return{'count':_0x597d25['length'],'rows':_[_0x2c36('0x24')](_0x597d25,function(_0x1bf87f){return{'id':_0x1bf87f[_0x2c36('0x21')],'name':_0x1bf87f['label'],'custom':_[_0x2c36('0x6c')](_0x1bf87f['name'],'_c')?!![]:![],'options':_0x1bf87f[_0x2c36('0x3a')]?_['map'](_['values'](_0x1bf87f[_0x2c36('0x3a')]),function(_0x20bdd7){return{'name':_0x20bdd7[_0x2c36('0x6d')],'value':_0x20bdd7[_0x2c36('0x21')]};}):[]};})};}})[_0x2c36('0x3b')](respondWithResult(_0x2c0741,null))['catch'](function(_0x4dc2ec){var _0x28ef9f=_0x14933c['query'][_0x2c36('0x6e')]?0x1f4:_0x4dc2ec[_0x2c36('0x6f')]||0x1f4;logger[_0x2c36('0x70')](_0x2c36('0x71'),_0x2c36('0x50'),_0x28ef9f,JSON[_0x2c36('0x62')](_0x4dc2ec));delete _0x4dc2ec[_0x2c36('0x21')];if(_0x28ef9f===0x191){_0x28ef9f=0x190;}_0x2c0741['status'](_0x28ef9f)[_0x2c36('0x22')](_0x14933c['query'][_0x2c36('0x6e')]?{'message':_0x2c36('0x72'),'statusCode':_0x4dc2ec[_0x2c36('0x6f')]}:_0x4dc2ec);});}else{var _0x5e658d=0x1f4;_0x2c0741[_0x2c36('0x14')](_0x5e658d)[_0x2c36('0x22')]({'message':_0x2c36('0x72'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xb9f9=['value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','index','SugarcrmAccount','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','nolimit','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','Invalid\x20Login','values','module_fields','remove','label','endsWith'];(function(_0x104f12,_0x2a9754){var _0x12b195=function(_0x3adf1a){while(--_0x3adf1a){_0x104f12['push'](_0x104f12['shift']());}};_0x12b195(++_0x2a9754);}(_0xb9f9,0xf0));var _0x9b9f=function(_0x37c9ea,_0x4421c8){_0x37c9ea=_0x37c9ea-0x0;var _0x186ae1=_0xb9f9[_0x37c9ea];return _0x186ae1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b9f('0x0'));var zipdir=require(_0x9b9f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b9f('0x2'));var moment=require(_0x9b9f('0x3'));var BPromise=require(_0x9b9f('0x4'));var Mustache=require(_0x9b9f('0x5'));var util=require(_0x9b9f('0x6'));var path=require(_0x9b9f('0x7'));var sox=require(_0x9b9f('0x8'));var csv=require(_0x9b9f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9b9f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9b9f('0xb'));var jsforce=require(_0x9b9f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9b9f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9b9f('0xd'));var authService=require(_0x9b9f('0xe'));var qs=require(_0x9b9f('0xf'));var as=require(_0x9b9f('0x10'));var hardwareService=require(_0x9b9f('0x11'));var logger=require('../../config/logger')(_0x9b9f('0x12'));var utils=require(_0x9b9f('0x13'));var config=require(_0x9b9f('0x14'));var licenseUtil=require(_0x9b9f('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5a0746,_0xa81e51){_0xa81e51=_0xa81e51||0xcc;return function(_0x19a66c){if(_0x19a66c){return _0x5a0746[_0x9b9f('0x16')](_0xa81e51);}return _0x5a0746[_0x9b9f('0x17')](_0xa81e51)['end']();};}function respondWithResult(_0x53ad4e,_0x49f79d){_0x49f79d=_0x49f79d||0xc8;return function(_0x2a9897){if(_0x2a9897){return _0x53ad4e[_0x9b9f('0x17')](_0x49f79d)[_0x9b9f('0x18')](_0x2a9897);}};}function respondWithFilteredResult(_0x2ed054,_0x152413){return function(_0x44f202){if(_0x44f202){var _0x358069=typeof _0x152413['offset']===_0x9b9f('0x19')&&typeof _0x152413['limit']==='undefined';var _0x488977=_0x44f202[_0x9b9f('0x1a')];var _0x25c8c5=_0x358069?0x0:_0x152413[_0x9b9f('0x1b')];var _0x22da6a=_0x358069?_0x44f202[_0x9b9f('0x1a')]:_0x152413[_0x9b9f('0x1b')]+_0x152413[_0x9b9f('0x1c')];var _0xa71b84;if(_0x22da6a>=_0x488977){_0x22da6a=_0x488977;_0xa71b84=0xc8;}else{_0xa71b84=0xce;}_0x2ed054['status'](_0xa71b84);return _0x2ed054[_0x9b9f('0x1d')]('Content-Range',_0x25c8c5+'-'+_0x22da6a+'/'+_0x488977)[_0x9b9f('0x18')](_0x44f202);}return null;};}function patchUpdates(_0x31048f){return function(_0x3ad2e2){try{jsonpatch[_0x9b9f('0x1e')](_0x3ad2e2,_0x31048f,!![]);}catch(_0x46ec67){return BPromise[_0x9b9f('0x1f')](_0x46ec67);}return _0x3ad2e2[_0x9b9f('0x20')]();};}function saveUpdates(_0x14847c,_0x9482b5){return function(_0x19b585){if(_0x19b585){return _0x19b585[_0x9b9f('0x21')](_0x14847c)[_0x9b9f('0x22')](function(_0x2f95ed){return _0x2f95ed;});}return null;};}function removeEntity(_0x132a76,_0x4f81bc){return function(_0x16627f){if(_0x16627f){return _0x16627f[_0x9b9f('0x23')]()[_0x9b9f('0x22')](function(){_0x132a76[_0x9b9f('0x17')](0xcc)[_0x9b9f('0x24')]();});}};}function handleEntityNotFound(_0x5c31c0,_0x5234d7){return function(_0x13db4b){if(!_0x13db4b){_0x5c31c0[_0x9b9f('0x16')](0x194);}return _0x13db4b;};}function handleError(_0x139072,_0x4f7546){_0x4f7546=_0x4f7546||0x1f4;return function(_0x1bf7f6){logger[_0x9b9f('0x25')](_0x1bf7f6['stack']);if(_0x1bf7f6[_0x9b9f('0x26')]){delete _0x1bf7f6['name'];}_0x139072[_0x9b9f('0x17')](_0x4f7546)[_0x9b9f('0x27')](_0x1bf7f6);};}exports[_0x9b9f('0x28')]=function(_0x32e0e5,_0x12f95d){var _0x353bd4={},_0x5ce03e={},_0x7034b1={'count':0x0,'rows':[]};var _0x37e70b=_['map'](db[_0x9b9f('0x29')]['rawAttributes'],function(_0x499979){return{'name':_0x499979[_0x9b9f('0x2a')],'type':_0x499979[_0x9b9f('0x2b')][_0x9b9f('0x2c')]};});_0x5ce03e['model']=_[_0x9b9f('0x2d')](_0x37e70b,_0x9b9f('0x26'));_0x5ce03e[_0x9b9f('0x2e')]=_[_0x9b9f('0x2f')](_0x32e0e5[_0x9b9f('0x2e')]);_0x5ce03e['filters']=_[_0x9b9f('0x30')](_0x5ce03e[_0x9b9f('0x31')],_0x5ce03e[_0x9b9f('0x2e')]);_0x353bd4[_0x9b9f('0x32')]=_[_0x9b9f('0x30')](_0x5ce03e['model'],qs[_0x9b9f('0x33')](_0x32e0e5['query'][_0x9b9f('0x33')]));_0x353bd4[_0x9b9f('0x32')]=_0x353bd4[_0x9b9f('0x32')][_0x9b9f('0x34')]?_0x353bd4[_0x9b9f('0x32')]:_0x5ce03e['model'];if(!_0x32e0e5[_0x9b9f('0x2e')]['hasOwnProperty']('nolimit')){_0x353bd4[_0x9b9f('0x1c')]=qs[_0x9b9f('0x1c')](_0x32e0e5[_0x9b9f('0x2e')][_0x9b9f('0x1c')]);_0x353bd4[_0x9b9f('0x1b')]=qs[_0x9b9f('0x1b')](_0x32e0e5[_0x9b9f('0x2e')]['offset']);}_0x353bd4[_0x9b9f('0x35')]=qs[_0x9b9f('0x36')](_0x32e0e5['query'][_0x9b9f('0x36')]);_0x353bd4[_0x9b9f('0x37')]=qs[_0x9b9f('0x38')](_[_0x9b9f('0x39')](_0x32e0e5['query'],_0x5ce03e['filters']),_0x37e70b);if(_0x32e0e5[_0x9b9f('0x2e')][_0x9b9f('0x3a')]){_0x353bd4[_0x9b9f('0x37')]=_[_0x9b9f('0x3b')](_0x353bd4[_0x9b9f('0x37')],{'$or':_[_0x9b9f('0x2d')](_0x37e70b,function(_0x185b06){if(_0x185b06[_0x9b9f('0x2b')]!==_0x9b9f('0x3c')){var _0x378958={};_0x378958[_0x185b06[_0x9b9f('0x26')]]={'$like':'%'+_0x32e0e5['query'][_0x9b9f('0x3a')]+'%'};return _0x378958;}})});}_0x353bd4=_[_0x9b9f('0x3b')]({},_0x353bd4,_0x32e0e5[_0x9b9f('0x3d')]);var _0x373b58={'where':_0x353bd4[_0x9b9f('0x37')]};return db[_0x9b9f('0x29')][_0x9b9f('0x1a')](_0x373b58)[_0x9b9f('0x22')](function(_0x48d03f){_0x7034b1['count']=_0x48d03f;if(_0x32e0e5[_0x9b9f('0x2e')][_0x9b9f('0x3e')]){_0x353bd4['include']=[{'all':!![]}];}return db[_0x9b9f('0x29')][_0x9b9f('0x3f')](_0x353bd4);})[_0x9b9f('0x22')](function(_0x59f2b3){_0x7034b1[_0x9b9f('0x40')]=_0x59f2b3;return _0x7034b1;})[_0x9b9f('0x22')](respondWithFilteredResult(_0x12f95d,_0x353bd4))[_0x9b9f('0x41')](handleError(_0x12f95d,null));};exports[_0x9b9f('0x42')]=function(_0x139678,_0x1cb52a){var _0x344564={'raw':![],'where':{'id':_0x139678[_0x9b9f('0x43')]['id']}},_0x23451d={};_0x23451d['model']=_[_0x9b9f('0x2f')](db['SugarcrmAccount']['rawAttributes']);_0x23451d[_0x9b9f('0x2e')]=_[_0x9b9f('0x2f')](_0x139678['query']);_0x23451d[_0x9b9f('0x38')]=_[_0x9b9f('0x30')](_0x23451d['model'],_0x23451d['query']);_0x344564[_0x9b9f('0x32')]=_[_0x9b9f('0x30')](_0x23451d[_0x9b9f('0x31')],qs[_0x9b9f('0x33')](_0x139678[_0x9b9f('0x2e')][_0x9b9f('0x33')]));_0x344564[_0x9b9f('0x32')]=_0x344564[_0x9b9f('0x32')]['length']?_0x344564[_0x9b9f('0x32')]:_0x23451d['model'];if(_0x139678[_0x9b9f('0x2e')][_0x9b9f('0x3e')]){_0x344564[_0x9b9f('0x44')]=[{'all':!![]}];}_0x344564=_[_0x9b9f('0x3b')]({},_0x344564,_0x139678[_0x9b9f('0x3d')]);return db['SugarcrmAccount'][_0x9b9f('0x45')](_0x344564)['then'](handleEntityNotFound(_0x1cb52a,null))['then'](respondWithResult(_0x1cb52a,null))[_0x9b9f('0x41')](handleError(_0x1cb52a,null));};exports[_0x9b9f('0x46')]=function(_0x4c095b,_0x5aca86){return db[_0x9b9f('0x29')][_0x9b9f('0x46')](_0x4c095b['body'],{})[_0x9b9f('0x22')](respondWithResult(_0x5aca86,0xc9))[_0x9b9f('0x41')](handleError(_0x5aca86,null));};exports['update']=function(_0x1d97da,_0x21fe1c){if(_0x1d97da[_0x9b9f('0x47')]['id']){delete _0x1d97da['body']['id'];}return db['SugarcrmAccount'][_0x9b9f('0x45')]({'where':{'id':_0x1d97da[_0x9b9f('0x43')]['id']}})[_0x9b9f('0x22')](handleEntityNotFound(_0x21fe1c,null))[_0x9b9f('0x22')](saveUpdates(_0x1d97da[_0x9b9f('0x47')],null))['then'](respondWithResult(_0x21fe1c,null))[_0x9b9f('0x41')](handleError(_0x21fe1c,null));};exports[_0x9b9f('0x23')]=function(_0x54a50d,_0x2a25c9){return db[_0x9b9f('0x29')][_0x9b9f('0x45')]({'where':{'id':_0x54a50d[_0x9b9f('0x43')]['id']}})[_0x9b9f('0x22')](handleEntityNotFound(_0x2a25c9,null))[_0x9b9f('0x22')](removeEntity(_0x2a25c9,null))[_0x9b9f('0x41')](handleError(_0x2a25c9,null));};exports[_0x9b9f('0x48')]=function(_0x3c7700,_0x29b923,_0x117da8){var _0x5eda9b={};var _0x2abc07={};var _0x28c63c;var _0x2923fa;return db['SugarcrmAccount'][_0x9b9f('0x49')]({'where':{'id':_0x3c7700['params']['id']}})['then'](handleEntityNotFound(_0x29b923,null))['then'](function(_0x1ab770){if(_0x1ab770){_0x28c63c=_0x1ab770;_0x2abc07[_0x9b9f('0x31')]=_[_0x9b9f('0x2f')](db[_0x9b9f('0x4a')]['rawAttributes']);_0x2abc07[_0x9b9f('0x2e')]=_[_0x9b9f('0x2f')](_0x3c7700[_0x9b9f('0x2e')]);_0x2abc07[_0x9b9f('0x38')]=_[_0x9b9f('0x30')](_0x2abc07['model'],_0x2abc07[_0x9b9f('0x2e')]);_0x5eda9b['attributes']=_[_0x9b9f('0x30')](_0x2abc07[_0x9b9f('0x31')],qs['fields'](_0x3c7700[_0x9b9f('0x2e')]['fields']));_0x5eda9b[_0x9b9f('0x32')]=_0x5eda9b['attributes'][_0x9b9f('0x34')]?_0x5eda9b[_0x9b9f('0x32')]:_0x2abc07['model'];_0x5eda9b[_0x9b9f('0x35')]=qs[_0x9b9f('0x36')](_0x3c7700[_0x9b9f('0x2e')]['sort']);_0x5eda9b[_0x9b9f('0x37')]=qs[_0x9b9f('0x38')](_[_0x9b9f('0x39')](_0x3c7700[_0x9b9f('0x2e')],_0x2abc07[_0x9b9f('0x38')]));if(_0x3c7700[_0x9b9f('0x2e')]['filter']){_0x5eda9b[_0x9b9f('0x37')]=_[_0x9b9f('0x3b')](_0x5eda9b['where'],{'$or':_[_0x9b9f('0x2d')](_0x5eda9b[_0x9b9f('0x32')],function(_0x1cdfff){var _0x3fcce3={};_0x3fcce3[_0x1cdfff]={'$like':'%'+_0x3c7700[_0x9b9f('0x2e')][_0x9b9f('0x3a')]+'%'};return _0x3fcce3;})});}_0x5eda9b=_[_0x9b9f('0x3b')]({},_0x5eda9b,_0x3c7700['options']);return _0x28c63c[_0x9b9f('0x48')](_0x5eda9b);}})[_0x9b9f('0x22')](function(_0xb7bd5b){if(_0xb7bd5b){_0x2923fa=_0xb7bd5b['length'];if(!_0x3c7700[_0x9b9f('0x2e')][_0x9b9f('0x4b')](_0x9b9f('0x4c'))){_0x5eda9b[_0x9b9f('0x1c')]=qs[_0x9b9f('0x1c')](_0x3c7700[_0x9b9f('0x2e')][_0x9b9f('0x1c')]);_0x5eda9b['offset']=qs[_0x9b9f('0x1b')](_0x3c7700[_0x9b9f('0x2e')][_0x9b9f('0x1b')]);}return _0x28c63c[_0x9b9f('0x48')](_0x5eda9b);}})['then'](function(_0x40b80b){if(_0x40b80b){return _0x40b80b?{'count':_0x2923fa,'rows':_0x40b80b}:null;}})[_0x9b9f('0x22')](respondWithResult(_0x29b923,null))[_0x9b9f('0x41')](handleError(_0x29b923,null));};exports['addConfiguration']=function(_0x412ff4,_0xd4c779,_0x278dcb){if(_0x412ff4[_0x9b9f('0x47')]['id']){delete _0x412ff4['body']['id'];}return db[_0x9b9f('0x29')][_0x9b9f('0x49')]({'where':{'id':_0x412ff4[_0x9b9f('0x43')]['id']}})[_0x9b9f('0x22')](handleEntityNotFound(_0xd4c779,null))['then'](function(_0xd46a7d){if(_0xd46a7d){_0x412ff4['body']['AccountId']=_0xd46a7d['id'];_0x412ff4[_0x9b9f('0x47')][_0x9b9f('0x4d')]=integrations[_0x9b9f('0x4e')](_0x412ff4['body'][_0x9b9f('0x4f')],_0x412ff4['body']['type']);_0x412ff4[_0x9b9f('0x47')][_0x9b9f('0x50')]=integrations[_0x9b9f('0x51')](_0x412ff4['body'][_0x9b9f('0x4f')],_0x412ff4[_0x9b9f('0x47')][_0x9b9f('0x2b')]);return db[_0x9b9f('0x4a')][_0x9b9f('0x46')](_0x412ff4[_0x9b9f('0x47')],{'include':[{'model':db[_0x9b9f('0x52')],'as':_0x9b9f('0x4d')},{'model':db[_0x9b9f('0x52')],'as':_0x9b9f('0x50')}]});}return null;})[_0x9b9f('0x22')](respondWithResult(_0xd4c779,null))[_0x9b9f('0x41')](handleError(_0xd4c779,null));};exports['getFields']=function(_0x1fc22d,_0x722475,_0x2d2e7f){var _0x652ae='';var _0x20e72d=['id',_0x9b9f('0x26'),_0x9b9f('0x53'),_0x9b9f('0x54'),_0x9b9f('0x55'),_0x9b9f('0x56'),_0x9b9f('0x57'),_0x9b9f('0x58'),_0x9b9f('0x59'),_0x9b9f('0x5a'),_0x9b9f('0x5b'),_0x9b9f('0x5c')];return db['SugarcrmAccount'][_0x9b9f('0x49')]({'where':{'id':_0x1fc22d[_0x9b9f('0x43')]['id']},'attributes':['id',_0x9b9f('0x5d'),_0x9b9f('0x5e'),_0x9b9f('0x5f')]})['then'](handleEntityNotFound(_0x722475,null))[_0x9b9f('0x22')](function(_0x1e6466){if(_0x1e6466){_0x652ae=_0x1e6466[_0x9b9f('0x5f')];var _0x5de0b4=_0x652ae[_0x9b9f('0x60')](-0x1);if(_0x5de0b4==='/'){_0x652ae=_0x652ae['substring'](0x0,_0x652ae[_0x9b9f('0x61')](_0x5de0b4));}return rp({'method':_0x9b9f('0x62'),'uri':util[_0x9b9f('0x63')](_0x9b9f('0x64'),_0x652ae,_0x9b9f('0x65')),'json':!![],'form':{'method':_0x9b9f('0x66'),'input_type':_0x9b9f('0x67'),'response_type':'JSON','rest_data':JSON[_0x9b9f('0x68')]({'user_auth':{'user_name':_0x1e6466[_0x9b9f('0x5d')],'password':_0x1e6466[_0x9b9f('0x5e')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x9b9f('0x22')](function(_0x33e02c){if(_0x33e02c&&_0x33e02c[_0x9b9f('0x26')]!==_0x9b9f('0x69')&&_0x33e02c['name']!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0x9b9f('0x63')]('%s%s',_0x652ae,_0x9b9f('0x65')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x9b9f('0x67'),'response_type':'JSON','rest_data':JSON[_0x9b9f('0x68')]({'session':_0x33e02c['id'],'module_name':'Calls'})}})['then'](function(_0x104812){if(_0x104812){var _0x14eb1c=_[_0x9b9f('0x6a')](_0x104812[_0x9b9f('0x6b')]);_[_0x9b9f('0x6c')](_0x14eb1c,function(_0x5b1c51){return _0x20e72d['includes'](_0x5b1c51[_0x9b9f('0x26')]);});return{'count':_0x14eb1c['length'],'rows':_[_0x9b9f('0x2d')](_0x14eb1c,function(_0x559c96){return{'id':_0x559c96['name'],'name':_0x559c96[_0x9b9f('0x6d')],'custom':_[_0x9b9f('0x6e')](_0x559c96[_0x9b9f('0x26')],'_c')?!![]:![],'options':_0x559c96['options']?_[_0x9b9f('0x2d')](_[_0x9b9f('0x6a')](_0x559c96[_0x9b9f('0x3d')]),function(_0x485e75){return{'name':_0x485e75[_0x9b9f('0x6f')],'value':_0x485e75['name']};}):[]};})};}})[_0x9b9f('0x22')](respondWithResult(_0x722475,null))['catch'](function(_0x4c5b2a){var _0xbe9e15=_0x1fc22d[_0x9b9f('0x2e')][_0x9b9f('0x70')]?0x1f4:_0x4c5b2a[_0x9b9f('0x71')]||0x1f4;logger[_0x9b9f('0x25')](_0x9b9f('0x72'),_0x9b9f('0x73'),_0xbe9e15,JSON['stringify'](_0x4c5b2a));delete _0x4c5b2a[_0x9b9f('0x26')];if(_0xbe9e15===0x191){_0xbe9e15=0x190;}_0x722475[_0x9b9f('0x17')](_0xbe9e15)['send'](_0x1fc22d[_0x9b9f('0x2e')][_0x9b9f('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x4c5b2a[_0x9b9f('0x71')]}:_0x4c5b2a);});}else{var _0x34e7d8=0x1f4;_0x722475[_0x9b9f('0x17')](_0x34e7d8)[_0x9b9f('0x27')]({'message':_0x9b9f('0x74'),'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 699a40d..6287167 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 _0xc935=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x304000,_0x343bbd){var _0x2ca031=function(_0x59d0c9){while(--_0x59d0c9){_0x304000['push'](_0x304000['shift']());}};_0x2ca031(++_0x343bbd);}(_0xc935,0x10a));var _0x5c93=function(_0x2b1fad,_0x307f8b){_0x2b1fad=_0x2b1fad-0x0;var _0x7249fa=_0xc935[_0x2b1fad];return _0x7249fa;};'use strict';var _=require(_0x5c93('0x0'));var util=require(_0x5c93('0x1'));var logger=require(_0x5c93('0x2'))(_0x5c93('0x3'));var moment=require(_0x5c93('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c93('0x5'));var rimraf=require(_0x5c93('0x6'));var config=require('../../config/environment');var attributes=require(_0x5c93('0x7'));var integrations=require(_0x5c93('0x8'));module[_0x5c93('0x9')]=function(_0x119948,_0x2f1826){return _0x119948[_0x5c93('0xa')](_0x5c93('0xb'),attributes,{'tableName':_0x5c93('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x832e=['path','rimraf','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2613fc,_0x24c5df){var _0x2e3cb9=function(_0x3b9c15){while(--_0x3b9c15){_0x2613fc['push'](_0x2613fc['shift']());}};_0x2e3cb9(++_0x24c5df);}(_0x832e,0x17b));var _0xe832=function(_0x33ff89,_0x3d6a2d){_0x33ff89=_0x33ff89-0x0;var _0x58d002=_0x832e[_0x33ff89];return _0x58d002;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe832('0x0'))(_0xe832('0x1'));var moment=require(_0xe832('0x2'));var BPromise=require(_0xe832('0x3'));var rp=require(_0xe832('0x4'));var fs=require('fs');var path=require(_0xe832('0x5'));var rimraf=require(_0xe832('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xe832('0x7'));module[_0xe832('0x8')]=function(_0x426a13,_0xa08e5c){return _0x426a13[_0xe832('0x9')](_0xe832('0xa'),attributes,{'tableName':_0xe832('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 0ad2283..14c2ee8 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 _0xf196=['findAll','options','raw','where','attributes','limit','include','model','map','then','ShowSugarcrmAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount'];(function(_0x47a61c,_0x1a6c20){var _0xc1478b=function(_0x3f3ff7){while(--_0x3f3ff7){_0x47a61c['push'](_0x47a61c['shift']());}};_0xc1478b(++_0x1a6c20);}(_0xf196,0xbb));var _0x6f19=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf196[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x6f19('0x0'));var util=require(_0x6f19('0x1'));var moment=require(_0x6f19('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f19('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f19('0x5'))('rpc');var config=require(_0x6f19('0x6'));var jayson=require(_0x6f19('0x7'));var client=jayson['client'][_0x6f19('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42f86a,_0x5b34fe,_0x3bce91){return new BPromise(function(_0x54fb67,_0x3a0173){return client[_0x6f19('0x9')](_0x42f86a,_0x3bce91)['then'](function(_0x590c4c){logger[_0x6f19('0xa')](_0x6f19('0xb'),_0x5b34fe,'request\x20sent');logger[_0x6f19('0xc')](_0x6f19('0xd'),_0x5b34fe,_0x6f19('0xe'),JSON[_0x6f19('0xf')](_0x590c4c));if(_0x590c4c['error']){if(_0x590c4c[_0x6f19('0x10')][_0x6f19('0x11')]===0x1f4){logger[_0x6f19('0x10')](_0x6f19('0xb'),_0x5b34fe,_0x590c4c[_0x6f19('0x10')][_0x6f19('0x12')]);return _0x3a0173(_0x590c4c['error'][_0x6f19('0x12')]);}logger[_0x6f19('0x10')](_0x6f19('0xb'),_0x5b34fe,_0x590c4c[_0x6f19('0x10')][_0x6f19('0x12')]);return _0x54fb67(_0x590c4c[_0x6f19('0x10')][_0x6f19('0x12')]);}else{logger[_0x6f19('0xa')](_0x6f19('0xb'),_0x5b34fe,_0x6f19('0xe'));_0x54fb67(_0x590c4c[_0x6f19('0x13')][_0x6f19('0x12')]);}})[_0x6f19('0x14')](function(_0x155056){logger[_0x6f19('0x10')](_0x6f19('0xb'),_0x5b34fe,_0x155056);_0x3a0173(_0x155056);});});}exports[_0x6f19('0x15')]=function(_0x4ade6b){var _0x6c3e8b=this;return new Promise(function(_0x54f0cb,_0x3ce3f7){return db[_0x6f19('0x16')][_0x6f19('0x17')]({'raw':_0x4ade6b[_0x6f19('0x18')]?_0x4ade6b[_0x6f19('0x18')][_0x6f19('0x19')]===undefined?!![]:![]:!![],'where':_0x4ade6b[_0x6f19('0x18')]?_0x4ade6b[_0x6f19('0x18')][_0x6f19('0x1a')]||null:null,'attributes':_0x4ade6b[_0x6f19('0x18')]?_0x4ade6b[_0x6f19('0x18')][_0x6f19('0x1b')]||null:null,'limit':_0x4ade6b[_0x6f19('0x18')]?_0x4ade6b[_0x6f19('0x18')][_0x6f19('0x1c')]||null:null,'include':_0x4ade6b[_0x6f19('0x18')]?_0x4ade6b[_0x6f19('0x18')]['include']?_['map'](_0x4ade6b[_0x6f19('0x18')][_0x6f19('0x1d')],function(_0x170e60){return{'model':db[_0x170e60[_0x6f19('0x1e')]],'as':_0x170e60['as'],'attributes':_0x170e60[_0x6f19('0x1b')],'include':_0x170e60['include']?_['map'](_0x170e60[_0x6f19('0x1d')],function(_0x50b951){return{'model':db[_0x50b951[_0x6f19('0x1e')]],'as':_0x50b951['as'],'attributes':_0x50b951[_0x6f19('0x1b')],'include':_0x50b951['include']?_[_0x6f19('0x1f')](_0x50b951[_0x6f19('0x1d')],function(_0x46950d){return{'model':db[_0x46950d[_0x6f19('0x1e')]],'as':_0x46950d['as'],'attributes':_0x46950d[_0x6f19('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6f19('0x20')](function(_0x376cc1){logger['info'](_0x6f19('0x15'),_0x4ade6b);logger['debug'](_0x6f19('0x15'),_0x4ade6b,JSON[_0x6f19('0xf')](_0x376cc1));_0x54f0cb(_0x376cc1);})['catch'](function(_0x2845b6){logger[_0x6f19('0x10')](_0x6f19('0x15'),_0x2845b6[_0x6f19('0x12')],_0x4ade6b);_0x3ce3f7(_0x6c3e8b[_0x6f19('0x10')](0x1f4,_0x2845b6[_0x6f19('0x12')]));});});};exports[_0x6f19('0x21')]=function(_0x82319){var _0x3de5eb=this;return new Promise(function(_0x446680,_0x3d9272){return db['SugarcrmAccount'][_0x6f19('0x22')]({'raw':_0x82319[_0x6f19('0x18')]?_0x82319['options']['raw']===undefined?!![]:![]:!![],'where':_0x82319[_0x6f19('0x18')]?_0x82319['options']['where']||null:null,'attributes':_0x82319[_0x6f19('0x18')]?_0x82319[_0x6f19('0x18')][_0x6f19('0x1b')]||null:null,'include':_0x82319[_0x6f19('0x18')]?_0x82319['options'][_0x6f19('0x1d')]?_['map'](_0x82319['options'][_0x6f19('0x1d')],function(_0x2796bc){return{'model':db[_0x2796bc[_0x6f19('0x1e')]],'as':_0x2796bc['as'],'attributes':_0x2796bc['attributes'],'include':_0x2796bc[_0x6f19('0x1d')]?_[_0x6f19('0x1f')](_0x2796bc[_0x6f19('0x1d')],function(_0x218748){return{'model':db[_0x218748[_0x6f19('0x1e')]],'as':_0x218748['as'],'attributes':_0x218748[_0x6f19('0x1b')],'include':_0x218748['include']?_['map'](_0x218748[_0x6f19('0x1d')],function(_0x237635){return{'model':db[_0x237635[_0x6f19('0x1e')]],'as':_0x237635['as'],'attributes':_0x237635[_0x6f19('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13ad91){logger[_0x6f19('0xa')](_0x6f19('0x21'),_0x82319);logger[_0x6f19('0xc')](_0x6f19('0x21'),_0x82319,JSON[_0x6f19('0xf')](_0x13ad91));_0x446680(_0x13ad91);})[_0x6f19('0x14')](function(_0x1a956b){logger[_0x6f19('0x10')](_0x6f19('0x21'),_0x1a956b[_0x6f19('0x12')],_0x82319);_0x3d9272(_0x3de5eb[_0x6f19('0x10')](0x1f4,_0x1a956b[_0x6f19('0x12')]));});});}; \ No newline at end of file +var _0x46ad=['limit','include','map','model','debug','GetSugarcrmAccount','find','where','ShowSugarcrmAccount','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','SugarcrmAccount,\x20%s,\x20%s','message','info','request\x20sent','result','catch','SugarcrmAccount','options','raw','attributes'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0x46ad,0x119));var _0xd46a=function(_0x3530b8,_0x42e894){_0x3530b8=_0x3530b8-0x0;var _0x59c8b4=_0x46ad[_0x3530b8];return _0x59c8b4;};'use strict';var _=require('lodash');var util=require(_0xd46a('0x0'));var moment=require('moment');var BPromise=require(_0xd46a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd46a('0x2'))['db'];var utils=require(_0xd46a('0x3'));var logger=require(_0xd46a('0x4'))(_0xd46a('0x5'));var config=require(_0xd46a('0x6'));var jayson=require(_0xd46a('0x7'));var client=jayson[_0xd46a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x368a32,_0x38981e,_0x5cae09){return new BPromise(function(_0x3f0e84,_0x4b996e){return client[_0xd46a('0x9')](_0x368a32,_0x5cae09)[_0xd46a('0xa')](function(_0x55e62e){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x38981e,'request\x20sent');logger['debug'](_0xd46a('0xb'),_0x38981e,'request\x20sent',JSON[_0xd46a('0xc')](_0x55e62e));if(_0x55e62e['error']){if(_0x55e62e['error'][_0xd46a('0xd')]===0x1f4){logger[_0xd46a('0xe')](_0xd46a('0xf'),_0x38981e,_0x55e62e[_0xd46a('0xe')]['message']);return _0x4b996e(_0x55e62e['error']['message']);}logger[_0xd46a('0xe')](_0xd46a('0xf'),_0x38981e,_0x55e62e[_0xd46a('0xe')]['message']);return _0x3f0e84(_0x55e62e[_0xd46a('0xe')][_0xd46a('0x10')]);}else{logger[_0xd46a('0x11')](_0xd46a('0xf'),_0x38981e,_0xd46a('0x12'));_0x3f0e84(_0x55e62e[_0xd46a('0x13')][_0xd46a('0x10')]);}})[_0xd46a('0x14')](function(_0x1a76f6){logger[_0xd46a('0xe')](_0xd46a('0xf'),_0x38981e,_0x1a76f6);_0x4b996e(_0x1a76f6);});});}exports['GetSugarcrmAccount']=function(_0x32fbc4){var _0x222fef=this;return new Promise(function(_0x185d7d,_0x31caa9){return db[_0xd46a('0x15')]['findAll']({'raw':_0x32fbc4[_0xd46a('0x16')]?_0x32fbc4[_0xd46a('0x16')][_0xd46a('0x17')]===undefined?!![]:![]:!![],'where':_0x32fbc4['options']?_0x32fbc4['options']['where']||null:null,'attributes':_0x32fbc4[_0xd46a('0x16')]?_0x32fbc4[_0xd46a('0x16')][_0xd46a('0x18')]||null:null,'limit':_0x32fbc4[_0xd46a('0x16')]?_0x32fbc4['options'][_0xd46a('0x19')]||null:null,'include':_0x32fbc4[_0xd46a('0x16')]?_0x32fbc4[_0xd46a('0x16')][_0xd46a('0x1a')]?_[_0xd46a('0x1b')](_0x32fbc4['options'][_0xd46a('0x1a')],function(_0x474acc){return{'model':db[_0x474acc[_0xd46a('0x1c')]],'as':_0x474acc['as'],'attributes':_0x474acc[_0xd46a('0x18')],'include':_0x474acc[_0xd46a('0x1a')]?_[_0xd46a('0x1b')](_0x474acc[_0xd46a('0x1a')],function(_0x4b9247){return{'model':db[_0x4b9247[_0xd46a('0x1c')]],'as':_0x4b9247['as'],'attributes':_0x4b9247['attributes'],'include':_0x4b9247[_0xd46a('0x1a')]?_[_0xd46a('0x1b')](_0x4b9247['include'],function(_0x524d3d){return{'model':db[_0x524d3d[_0xd46a('0x1c')]],'as':_0x524d3d['as'],'attributes':_0x524d3d['attributes']};}):[]};}):[]};}):[]:[]})[_0xd46a('0xa')](function(_0x385ab2){logger[_0xd46a('0x11')]('GetSugarcrmAccount',_0x32fbc4);logger[_0xd46a('0x1d')](_0xd46a('0x1e'),_0x32fbc4,JSON[_0xd46a('0xc')](_0x385ab2));_0x185d7d(_0x385ab2);})[_0xd46a('0x14')](function(_0x3f4e4f){logger[_0xd46a('0xe')](_0xd46a('0x1e'),_0x3f4e4f[_0xd46a('0x10')],_0x32fbc4);_0x31caa9(_0x222fef[_0xd46a('0xe')](0x1f4,_0x3f4e4f[_0xd46a('0x10')]));});});};exports['ShowSugarcrmAccount']=function(_0xebe4c7){var _0x47126a=this;return new Promise(function(_0x47d7ae,_0x4e7711){return db[_0xd46a('0x15')][_0xd46a('0x1f')]({'raw':_0xebe4c7[_0xd46a('0x16')]?_0xebe4c7['options'][_0xd46a('0x17')]===undefined?!![]:![]:!![],'where':_0xebe4c7['options']?_0xebe4c7[_0xd46a('0x16')][_0xd46a('0x20')]||null:null,'attributes':_0xebe4c7['options']?_0xebe4c7['options'][_0xd46a('0x18')]||null:null,'include':_0xebe4c7[_0xd46a('0x16')]?_0xebe4c7[_0xd46a('0x16')]['include']?_[_0xd46a('0x1b')](_0xebe4c7['options'][_0xd46a('0x1a')],function(_0x34283a){return{'model':db[_0x34283a['model']],'as':_0x34283a['as'],'attributes':_0x34283a[_0xd46a('0x18')],'include':_0x34283a['include']?_[_0xd46a('0x1b')](_0x34283a[_0xd46a('0x1a')],function(_0x2f2e1a){return{'model':db[_0x2f2e1a[_0xd46a('0x1c')]],'as':_0x2f2e1a['as'],'attributes':_0x2f2e1a[_0xd46a('0x18')],'include':_0x2f2e1a[_0xd46a('0x1a')]?_[_0xd46a('0x1b')](_0x2f2e1a[_0xd46a('0x1a')],function(_0x5b0d5c){return{'model':db[_0x5b0d5c[_0xd46a('0x1c')]],'as':_0x5b0d5c['as'],'attributes':_0x5b0d5c[_0xd46a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd46a('0xa')](function(_0x4c8e4e){logger[_0xd46a('0x11')](_0xd46a('0x21'),_0xebe4c7);logger['debug'](_0xd46a('0x21'),_0xebe4c7,JSON[_0xd46a('0xc')](_0x4c8e4e));_0x47d7ae(_0x4c8e4e);})[_0xd46a('0x14')](function(_0x3510cd){logger[_0xd46a('0xe')]('ShowSugarcrmAccount',_0x3510cd[_0xd46a('0x10')],_0xebe4c7);_0x4e7711(_0x47126a[_0xd46a('0xe')](0x1f4,_0x3510cd[_0xd46a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 4336db1..b6876d0 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 _0xa07e=['delete','destroy','multer','path','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x14925a,_0x3fbc1b){var _0x3a249e=function(_0x37db3c){while(--_0x37db3c){_0x14925a['push'](_0x14925a['shift']());}};_0x3a249e(++_0x3fbc1b);}(_0xa07e,0x16a));var _0xea07=function(_0x58688d,_0x1e56b6){_0x58688d=_0x58688d-0x0;var _0x2935a9=_0xa07e[_0x58688d];return _0x2935a9;};'use strict';var multer=require(_0xea07('0x0'));var util=require('util');var path=require(_0xea07('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xea07('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xea07('0x3'));var config=require(_0xea07('0x4'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xea07('0x5')]('/',auth[_0xea07('0x6')](),controller[_0xea07('0x7')]);router[_0xea07('0x5')](_0xea07('0x8'),auth[_0xea07('0x6')](),controller[_0xea07('0x9')]);router['get']('/:id/fields',auth[_0xea07('0x6')](),controller[_0xea07('0xa')]);router[_0xea07('0x5')](_0xea07('0xb'),auth[_0xea07('0x6')](),controller['getSubjects']);router[_0xea07('0x5')](_0xea07('0xc'),auth['isAuthenticated'](),controller[_0xea07('0xd')]);router[_0xea07('0xe')]('/',auth[_0xea07('0x6')](),controller[_0xea07('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xea07('0x10')](_0xea07('0x8'),auth[_0xea07('0x6')](),controller[_0xea07('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe96b=['isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x152136,_0x4f14f1){var _0x20df44=function(_0x362877){while(--_0x362877){_0x152136['push'](_0x152136['shift']());}};_0x20df44(++_0x4f14f1);}(_0xe96b,0xd4));var _0xbe96=function(_0x4a480e,_0x4e85eb){_0x4a480e=_0x4a480e-0x0;var _0x42f49c=_0xe96b[_0x4a480e];return _0x42f49c;};'use strict';var multer=require('multer');var util=require(_0xbe96('0x0'));var path=require('path');var timeout=require(_0xbe96('0x1'));var express=require(_0xbe96('0x2'));var router=express['Router']();var fs_extra=require(_0xbe96('0x3'));var auth=require(_0xbe96('0x4'));var interaction=require(_0xbe96('0x5'));var config=require(_0xbe96('0x6'));var controller=require(_0xbe96('0x7'));router['get']('/',auth[_0xbe96('0x8')](),controller[_0xbe96('0x9')]);router[_0xbe96('0xa')](_0xbe96('0xb'),auth[_0xbe96('0x8')](),controller[_0xbe96('0xc')]);router[_0xbe96('0xa')](_0xbe96('0xd'),auth[_0xbe96('0x8')](),controller['getFields']);router[_0xbe96('0xa')](_0xbe96('0xe'),auth[_0xbe96('0x8')](),controller[_0xbe96('0xf')]);router[_0xbe96('0xa')](_0xbe96('0x10'),auth[_0xbe96('0x8')](),controller[_0xbe96('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbe96('0x12')]);router[_0xbe96('0x13')](_0xbe96('0xb'),auth[_0xbe96('0x8')](),controller['update']);router['delete'](_0xbe96('0xb'),auth[_0xbe96('0x8')](),controller[_0xbe96('0x14')]);module[_0xbe96('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 a97231a..78c0719 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 _0xb417=['sequelize','exports','STRING'];(function(_0x46ee59,_0x3538f7){var _0x54d1df=function(_0x3839a9){while(--_0x3839a9){_0x46ee59['push'](_0x46ee59['shift']());}};_0x54d1df(++_0x3538f7);}(_0xb417,0x120));var _0x7b41=function(_0x3446ef,_0x27c320){_0x3446ef=_0x3446ef-0x0;var _0x438057=_0xb417[_0x3446ef];return _0x438057;};'use strict';var Sequelize=require(_0x7b41('0x0'));module[_0x7b41('0x1')]={'name':{'type':Sequelize[_0x7b41('0x2')]},'description':{'type':Sequelize[_0x7b41('0x2')]}}; \ No newline at end of file +var _0x00d0=['exports','STRING','sequelize'];(function(_0x5528c3,_0xb02821){var _0x58af2c=function(_0x5e34be){while(--_0x5e34be){_0x5528c3['push'](_0x5528c3['shift']());}};_0x58af2c(++_0xb02821);}(_0x00d0,0x1d6));var _0x000d=function(_0x52ce1a,_0x5eb910){_0x52ce1a=_0x52ce1a-0x0;var _0x570487=_0x00d0[_0x52ce1a];return _0x570487;};'use strict';var Sequelize=require(_0x000d('0x0'));module[_0x000d('0x1')]={'name':{'type':Sequelize[_0x000d('0x2')]},'description':{'type':Sequelize[_0x000d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index aefb519..f1f2268 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 _0xea27=['length','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','update','body','destroy','getFields','order','hasOwnProperty','getSubjects','findOne','SugarcrmField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','then','sendStatus','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','type','map','query','keys','model','attributes','intersection','fields'];(function(_0x47294b,_0x1796c5){var _0x350e9d=function(_0x1f2dee){while(--_0x1f2dee){_0x47294b['push'](_0x47294b['shift']());}};_0x350e9d(++_0x1796c5);}(_0xea27,0xcb));var _0x7ea2=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xea27[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0x7ea2('0x0'));var rimraf=require(_0x7ea2('0x1'));var zipdir=require(_0x7ea2('0x2'));var jsonpatch=require(_0x7ea2('0x3'));var rp=require(_0x7ea2('0x4'));var moment=require(_0x7ea2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7ea2('0x6'));var util=require(_0x7ea2('0x7'));var path=require(_0x7ea2('0x8'));var sox=require(_0x7ea2('0x9'));var csv=require(_0x7ea2('0xa'));var ejs=require(_0x7ea2('0xb'));var fs=require('fs');var fs_extra=require(_0x7ea2('0xc'));var _=require(_0x7ea2('0xd'));var squel=require(_0x7ea2('0xe'));var crypto=require(_0x7ea2('0xf'));var jsforce=require(_0x7ea2('0x10'));var deskjs=require(_0x7ea2('0x11'));var toCsv=require('to-csv');var querystring=require(_0x7ea2('0x12'));var Papa=require('papaparse');var Redis=require(_0x7ea2('0x13'));var authService=require(_0x7ea2('0x14'));var qs=require(_0x7ea2('0x15'));var as=require(_0x7ea2('0x16'));var hardwareService=require(_0x7ea2('0x17'));var logger=require('../../config/logger')(_0x7ea2('0x18'));var utils=require(_0x7ea2('0x19'));var config=require(_0x7ea2('0x1a'));var licenseUtil=require(_0x7ea2('0x1b'));var db=require(_0x7ea2('0x1c'))['db'];function respondWithStatusCode(_0x47bbae,_0x23a0fe){_0x23a0fe=_0x23a0fe||0xcc;return function(_0x22f071){if(_0x22f071){return _0x47bbae['sendStatus'](_0x23a0fe);}return _0x47bbae['status'](_0x23a0fe)[_0x7ea2('0x1d')]();};}function respondWithResult(_0x2a718,_0x4a313d){_0x4a313d=_0x4a313d||0xc8;return function(_0x337a94){if(_0x337a94){return _0x2a718['status'](_0x4a313d)[_0x7ea2('0x1e')](_0x337a94);}};}function respondWithFilteredResult(_0x325efd,_0x19c90d){return function(_0x5c33a6){if(_0x5c33a6){var _0x4882f7=typeof _0x19c90d[_0x7ea2('0x1f')]===_0x7ea2('0x20')&&typeof _0x19c90d[_0x7ea2('0x21')]==='undefined';var _0x3cfab3=_0x5c33a6[_0x7ea2('0x22')];var _0x48f3eb=_0x4882f7?0x0:_0x19c90d[_0x7ea2('0x1f')];var _0x2dac31=_0x4882f7?_0x5c33a6[_0x7ea2('0x22')]:_0x19c90d[_0x7ea2('0x1f')]+_0x19c90d[_0x7ea2('0x21')];var _0x53daa3;if(_0x2dac31>=_0x3cfab3){_0x2dac31=_0x3cfab3;_0x53daa3=0xc8;}else{_0x53daa3=0xce;}_0x325efd[_0x7ea2('0x23')](_0x53daa3);return _0x325efd[_0x7ea2('0x24')](_0x7ea2('0x25'),_0x48f3eb+'-'+_0x2dac31+'/'+_0x3cfab3)[_0x7ea2('0x1e')](_0x5c33a6);}return null;};}function patchUpdates(_0x298b5b){return function(_0x46cb61){try{jsonpatch[_0x7ea2('0x26')](_0x46cb61,_0x298b5b,!![]);}catch(_0x3a2119){return BPromise[_0x7ea2('0x27')](_0x3a2119);}return _0x46cb61['save']();};}function saveUpdates(_0x2f718b,_0x562332){return function(_0x481bbb){if(_0x481bbb){return _0x481bbb['update'](_0x2f718b)[_0x7ea2('0x28')](function(_0x10ddad){return _0x10ddad;});}return null;};}function removeEntity(_0x4ee101,_0x3c2bbc){return function(_0x4dacfb){if(_0x4dacfb){return _0x4dacfb['destroy']()[_0x7ea2('0x28')](function(){_0x4ee101['status'](0xcc)[_0x7ea2('0x1d')]();});}};}function handleEntityNotFound(_0x43d1bd,_0x443029){return function(_0x1429ac){if(!_0x1429ac){_0x43d1bd[_0x7ea2('0x29')](0x194);}return _0x1429ac;};}function handleError(_0x291959,_0x416c48){_0x416c48=_0x416c48||0x1f4;return function(_0x5559e0){logger[_0x7ea2('0x2a')](_0x5559e0[_0x7ea2('0x2b')]);if(_0x5559e0[_0x7ea2('0x2c')]){delete _0x5559e0[_0x7ea2('0x2c')];}_0x291959[_0x7ea2('0x23')](_0x416c48)[_0x7ea2('0x2d')](_0x5559e0);};}exports[_0x7ea2('0x2e')]=function(_0x1bb6c8,_0x54d66a){var _0x453604={},_0x150785={},_0x182289={'count':0x0,'rows':[]};var _0x2446dd=_['map'](db[_0x7ea2('0x2f')][_0x7ea2('0x30')],function(_0x36861b){return{'name':_0x36861b[_0x7ea2('0x31')],'type':_0x36861b[_0x7ea2('0x32')]['key']};});_0x150785['model']=_[_0x7ea2('0x33')](_0x2446dd,'name');_0x150785[_0x7ea2('0x34')]=_[_0x7ea2('0x35')](_0x1bb6c8[_0x7ea2('0x34')]);_0x150785['filters']=_['intersection'](_0x150785[_0x7ea2('0x36')],_0x150785[_0x7ea2('0x34')]);_0x453604[_0x7ea2('0x37')]=_[_0x7ea2('0x38')](_0x150785[_0x7ea2('0x36')],qs[_0x7ea2('0x39')](_0x1bb6c8[_0x7ea2('0x34')][_0x7ea2('0x39')]));_0x453604[_0x7ea2('0x37')]=_0x453604[_0x7ea2('0x37')][_0x7ea2('0x3a')]?_0x453604[_0x7ea2('0x37')]:_0x150785['model'];if(!_0x1bb6c8[_0x7ea2('0x34')]['hasOwnProperty'](_0x7ea2('0x3b'))){_0x453604[_0x7ea2('0x21')]=qs[_0x7ea2('0x21')](_0x1bb6c8[_0x7ea2('0x34')][_0x7ea2('0x21')]);_0x453604[_0x7ea2('0x1f')]=qs[_0x7ea2('0x1f')](_0x1bb6c8[_0x7ea2('0x34')]['offset']);}_0x453604['order']=qs[_0x7ea2('0x3c')](_0x1bb6c8[_0x7ea2('0x34')][_0x7ea2('0x3c')]);_0x453604['where']=qs[_0x7ea2('0x3d')](_[_0x7ea2('0x3e')](_0x1bb6c8['query'],_0x150785['filters']),_0x2446dd);if(_0x1bb6c8['query'][_0x7ea2('0x3f')]){_0x453604['where']=_[_0x7ea2('0x40')](_0x453604[_0x7ea2('0x41')],{'$or':_['map'](_0x2446dd,function(_0x24ca99){if(_0x24ca99['type']!==_0x7ea2('0x42')){var _0x413a46={};_0x413a46[_0x24ca99[_0x7ea2('0x2c')]]={'$like':'%'+_0x1bb6c8[_0x7ea2('0x34')][_0x7ea2('0x3f')]+'%'};return _0x413a46;}})});}_0x453604=_[_0x7ea2('0x40')]({},_0x453604,_0x1bb6c8[_0x7ea2('0x43')]);var _0x54a78f={'where':_0x453604[_0x7ea2('0x41')]};return db['SugarcrmConfiguration'][_0x7ea2('0x22')](_0x54a78f)[_0x7ea2('0x28')](function(_0x1bdfc9){_0x182289[_0x7ea2('0x22')]=_0x1bdfc9;if(_0x1bb6c8[_0x7ea2('0x34')]['includeAll']){_0x453604['include']=[{'all':!![]}];}return db[_0x7ea2('0x2f')][_0x7ea2('0x44')](_0x453604);})[_0x7ea2('0x28')](function(_0x27ccc2){_0x182289[_0x7ea2('0x45')]=_0x27ccc2;return _0x182289;})[_0x7ea2('0x28')](respondWithFilteredResult(_0x54d66a,_0x453604))[_0x7ea2('0x46')](handleError(_0x54d66a,null));};exports[_0x7ea2('0x47')]=function(_0x269624,_0xf0141a){var _0x16806f={'raw':![],'where':{'id':_0x269624[_0x7ea2('0x48')]['id']}},_0x525b39={};_0x525b39['model']=_[_0x7ea2('0x35')](db['SugarcrmConfiguration']['rawAttributes']);_0x525b39[_0x7ea2('0x34')]=_[_0x7ea2('0x35')](_0x269624[_0x7ea2('0x34')]);_0x525b39[_0x7ea2('0x3d')]=_['intersection'](_0x525b39[_0x7ea2('0x36')],_0x525b39[_0x7ea2('0x34')]);_0x16806f[_0x7ea2('0x37')]=_[_0x7ea2('0x38')](_0x525b39[_0x7ea2('0x36')],qs['fields'](_0x269624[_0x7ea2('0x34')][_0x7ea2('0x39')]));_0x16806f[_0x7ea2('0x37')]=_0x16806f[_0x7ea2('0x37')]['length']?_0x16806f['attributes']:_0x525b39[_0x7ea2('0x36')];if(_0x269624['query'][_0x7ea2('0x49')]){_0x16806f[_0x7ea2('0x4a')]=[{'all':!![]}];}_0x16806f=_[_0x7ea2('0x40')]({},_0x16806f,_0x269624[_0x7ea2('0x43')]);return db[_0x7ea2('0x2f')][_0x7ea2('0x4b')](_0x16806f)['then'](handleEntityNotFound(_0xf0141a,null))['then'](respondWithResult(_0xf0141a,null))[_0x7ea2('0x46')](handleError(_0xf0141a,null));};exports[_0x7ea2('0x4c')]=function(_0x2f80b6,_0x3603d5){return db[_0x7ea2('0x2f')][_0x7ea2('0x4c')](_0x2f80b6['body'],{})[_0x7ea2('0x28')](respondWithResult(_0x3603d5,0xc9))['catch'](handleError(_0x3603d5,null));};exports[_0x7ea2('0x4d')]=function(_0x1cd1de,_0x3a9eaa){if(_0x1cd1de[_0x7ea2('0x4e')]['id']){delete _0x1cd1de[_0x7ea2('0x4e')]['id'];}return db[_0x7ea2('0x2f')][_0x7ea2('0x4b')]({'where':{'id':_0x1cd1de[_0x7ea2('0x48')]['id']}})[_0x7ea2('0x28')](handleEntityNotFound(_0x3a9eaa,null))['then'](saveUpdates(_0x1cd1de[_0x7ea2('0x4e')],null))['then'](respondWithResult(_0x3a9eaa,null))[_0x7ea2('0x46')](handleError(_0x3a9eaa,null));};exports[_0x7ea2('0x4f')]=function(_0xee999a,_0x2677e6){return db[_0x7ea2('0x2f')]['find']({'where':{'id':_0xee999a['params']['id']}})['then'](handleEntityNotFound(_0x2677e6,null))[_0x7ea2('0x28')](removeEntity(_0x2677e6,null))[_0x7ea2('0x46')](handleError(_0x2677e6,null));};exports[_0x7ea2('0x50')]=function(_0x3e463f,_0x2613ee,_0x2513cd){var _0x30a554={};var _0x2038be={};var _0x1cc580;var _0x43bfb6;return db[_0x7ea2('0x2f')]['findOne']({'where':{'id':_0x3e463f[_0x7ea2('0x48')]['id']}})[_0x7ea2('0x28')](handleEntityNotFound(_0x2613ee,null))[_0x7ea2('0x28')](function(_0x4ad195){if(_0x4ad195){_0x1cc580=_0x4ad195;_0x2038be[_0x7ea2('0x36')]=_['keys'](db['SugarcrmField'][_0x7ea2('0x30')]);_0x2038be[_0x7ea2('0x34')]=_[_0x7ea2('0x35')](_0x3e463f[_0x7ea2('0x34')]);_0x2038be['filters']=_[_0x7ea2('0x38')](_0x2038be[_0x7ea2('0x36')],_0x2038be[_0x7ea2('0x34')]);_0x30a554[_0x7ea2('0x37')]=_[_0x7ea2('0x38')](_0x2038be['model'],qs['fields'](_0x3e463f[_0x7ea2('0x34')][_0x7ea2('0x39')]));_0x30a554[_0x7ea2('0x37')]=_0x30a554['attributes'][_0x7ea2('0x3a')]?_0x30a554[_0x7ea2('0x37')]:_0x2038be[_0x7ea2('0x36')];_0x30a554[_0x7ea2('0x51')]=qs[_0x7ea2('0x3c')](_0x3e463f[_0x7ea2('0x34')][_0x7ea2('0x3c')]);_0x30a554['where']=qs['filters'](_[_0x7ea2('0x3e')](_0x3e463f[_0x7ea2('0x34')],_0x2038be[_0x7ea2('0x3d')]));if(_0x3e463f['query'][_0x7ea2('0x3f')]){_0x30a554[_0x7ea2('0x41')]=_[_0x7ea2('0x40')](_0x30a554[_0x7ea2('0x41')],{'$or':_['map'](_0x30a554[_0x7ea2('0x37')],function(_0x37e32f){var _0x13ffa8={};_0x13ffa8[_0x37e32f]={'$like':'%'+_0x3e463f['query'][_0x7ea2('0x3f')]+'%'};return _0x13ffa8;})});}_0x30a554=_[_0x7ea2('0x40')]({},_0x30a554,_0x3e463f[_0x7ea2('0x43')]);return _0x1cc580[_0x7ea2('0x50')](_0x30a554);}})[_0x7ea2('0x28')](function(_0x5175da){if(_0x5175da){_0x43bfb6=_0x5175da['length'];if(!_0x3e463f[_0x7ea2('0x34')][_0x7ea2('0x52')](_0x7ea2('0x3b'))){_0x30a554[_0x7ea2('0x21')]=qs[_0x7ea2('0x21')](_0x3e463f[_0x7ea2('0x34')][_0x7ea2('0x21')]);_0x30a554[_0x7ea2('0x1f')]=qs[_0x7ea2('0x1f')](_0x3e463f[_0x7ea2('0x34')][_0x7ea2('0x1f')]);}return _0x1cc580[_0x7ea2('0x50')](_0x30a554);}})['then'](function(_0x16a5eb){if(_0x16a5eb){return _0x16a5eb?{'count':_0x43bfb6,'rows':_0x16a5eb}:null;}})['then'](respondWithResult(_0x2613ee,null))[_0x7ea2('0x46')](handleError(_0x2613ee,null));};exports[_0x7ea2('0x53')]=function(_0x225b3d,_0x47aee5,_0x3cbe90){var _0x5b55c8={};var _0x5e4325={};var _0x13a094;var _0x11aa51;return db['SugarcrmConfiguration'][_0x7ea2('0x54')]({'where':{'id':_0x225b3d[_0x7ea2('0x48')]['id']}})['then'](handleEntityNotFound(_0x47aee5,null))[_0x7ea2('0x28')](function(_0x4dfcd4){if(_0x4dfcd4){_0x13a094=_0x4dfcd4;_0x5e4325[_0x7ea2('0x36')]=_[_0x7ea2('0x35')](db[_0x7ea2('0x55')][_0x7ea2('0x30')]);_0x5e4325[_0x7ea2('0x34')]=_['keys'](_0x225b3d['query']);_0x5e4325['filters']=_['intersection'](_0x5e4325[_0x7ea2('0x36')],_0x5e4325['query']);_0x5b55c8[_0x7ea2('0x37')]=_['intersection'](_0x5e4325['model'],qs['fields'](_0x225b3d[_0x7ea2('0x34')][_0x7ea2('0x39')]));_0x5b55c8[_0x7ea2('0x37')]=_0x5b55c8[_0x7ea2('0x37')]['length']?_0x5b55c8[_0x7ea2('0x37')]:_0x5e4325[_0x7ea2('0x36')];_0x5b55c8[_0x7ea2('0x51')]=qs[_0x7ea2('0x3c')](_0x225b3d[_0x7ea2('0x34')][_0x7ea2('0x3c')]);_0x5b55c8[_0x7ea2('0x41')]=qs[_0x7ea2('0x3d')](_[_0x7ea2('0x3e')](_0x225b3d[_0x7ea2('0x34')],_0x5e4325[_0x7ea2('0x3d')]));if(_0x225b3d[_0x7ea2('0x34')][_0x7ea2('0x3f')]){_0x5b55c8[_0x7ea2('0x41')]=_[_0x7ea2('0x40')](_0x5b55c8[_0x7ea2('0x41')],{'$or':_[_0x7ea2('0x33')](_0x5b55c8['attributes'],function(_0x48a88a){var _0x446660={};_0x446660[_0x48a88a]={'$like':'%'+_0x225b3d[_0x7ea2('0x34')][_0x7ea2('0x3f')]+'%'};return _0x446660;})});}_0x5b55c8=_['merge']({},_0x5b55c8,_0x225b3d['options']);return _0x13a094[_0x7ea2('0x53')](_0x5b55c8);}})[_0x7ea2('0x28')](function(_0x54f4cb){if(_0x54f4cb){_0x11aa51=_0x54f4cb[_0x7ea2('0x3a')];if(!_0x225b3d[_0x7ea2('0x34')]['hasOwnProperty'](_0x7ea2('0x3b'))){_0x5b55c8[_0x7ea2('0x21')]=qs['limit'](_0x225b3d[_0x7ea2('0x34')][_0x7ea2('0x21')]);_0x5b55c8['offset']=qs[_0x7ea2('0x1f')](_0x225b3d[_0x7ea2('0x34')][_0x7ea2('0x1f')]);}return _0x13a094['getSubjects'](_0x5b55c8);}})[_0x7ea2('0x28')](function(_0x367fbc){if(_0x367fbc){return _0x367fbc?{'count':_0x11aa51,'rows':_0x367fbc}:null;}})[_0x7ea2('0x28')](respondWithResult(_0x47aee5,null))[_0x7ea2('0x46')](handleError(_0x47aee5,null));};exports['getDescriptions']=function(_0x26856d,_0x51cee3,_0xffa0e8){var _0x3947c5={};var _0xa3ed41={};var _0x445b6b;var _0xe422aa;return db[_0x7ea2('0x2f')][_0x7ea2('0x54')]({'where':{'id':_0x26856d[_0x7ea2('0x48')]['id']}})[_0x7ea2('0x28')](handleEntityNotFound(_0x51cee3,null))['then'](function(_0xfae0d0){if(_0xfae0d0){_0x445b6b=_0xfae0d0;_0xa3ed41['model']=_['keys'](db[_0x7ea2('0x55')][_0x7ea2('0x30')]);_0xa3ed41[_0x7ea2('0x34')]=_[_0x7ea2('0x35')](_0x26856d[_0x7ea2('0x34')]);_0xa3ed41[_0x7ea2('0x3d')]=_[_0x7ea2('0x38')](_0xa3ed41['model'],_0xa3ed41['query']);_0x3947c5[_0x7ea2('0x37')]=_[_0x7ea2('0x38')](_0xa3ed41[_0x7ea2('0x36')],qs[_0x7ea2('0x39')](_0x26856d[_0x7ea2('0x34')]['fields']));_0x3947c5['attributes']=_0x3947c5[_0x7ea2('0x37')][_0x7ea2('0x3a')]?_0x3947c5[_0x7ea2('0x37')]:_0xa3ed41[_0x7ea2('0x36')];_0x3947c5[_0x7ea2('0x51')]=qs[_0x7ea2('0x3c')](_0x26856d[_0x7ea2('0x34')]['sort']);_0x3947c5[_0x7ea2('0x41')]=qs[_0x7ea2('0x3d')](_[_0x7ea2('0x3e')](_0x26856d[_0x7ea2('0x34')],_0xa3ed41[_0x7ea2('0x3d')]));if(_0x26856d[_0x7ea2('0x34')][_0x7ea2('0x3f')]){_0x3947c5[_0x7ea2('0x41')]=_['merge'](_0x3947c5[_0x7ea2('0x41')],{'$or':_[_0x7ea2('0x33')](_0x3947c5['attributes'],function(_0x427d28){var _0x45fc89={};_0x45fc89[_0x427d28]={'$like':'%'+_0x26856d[_0x7ea2('0x34')][_0x7ea2('0x3f')]+'%'};return _0x45fc89;})});}_0x3947c5=_['merge']({},_0x3947c5,_0x26856d[_0x7ea2('0x43')]);return _0x445b6b[_0x7ea2('0x56')](_0x3947c5);}})[_0x7ea2('0x28')](function(_0x1b7a56){if(_0x1b7a56){_0xe422aa=_0x1b7a56[_0x7ea2('0x3a')];if(!_0x26856d['query'][_0x7ea2('0x52')](_0x7ea2('0x3b'))){_0x3947c5['limit']=qs[_0x7ea2('0x21')](_0x26856d[_0x7ea2('0x34')]['limit']);_0x3947c5[_0x7ea2('0x1f')]=qs[_0x7ea2('0x1f')](_0x26856d['query'][_0x7ea2('0x1f')]);}return _0x445b6b[_0x7ea2('0x56')](_0x3947c5);}})[_0x7ea2('0x28')](function(_0x3b5667){if(_0x3b5667){return _0x3b5667?{'count':_0xe422aa,'rows':_0x3b5667}:null;}})[_0x7ea2('0x28')](respondWithResult(_0x51cee3,null))[_0x7ea2('0x46')](handleError(_0x51cee3,null));}; \ No newline at end of file +var _0x756c=['../../mysqldb','end','json','offset','undefined','limit','count','status','set','save','destroy','then','sendStatus','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','SugarcrmConfiguration','include','findAll','rows','catch','show','length','find','create','body','update','params','findOne','SugarcrmField','getFields','getSubjects','getDescriptions','order','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0x756c,0x84));var _0xc756=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x756c[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xc756('0x0'));var rimraf=require(_0xc756('0x1'));var zipdir=require(_0xc756('0x2'));var jsonpatch=require(_0xc756('0x3'));var rp=require(_0xc756('0x4'));var moment=require(_0xc756('0x5'));var BPromise=require(_0xc756('0x6'));var Mustache=require(_0xc756('0x7'));var util=require(_0xc756('0x8'));var path=require(_0xc756('0x9'));var sox=require(_0xc756('0xa'));var csv=require(_0xc756('0xb'));var ejs=require(_0xc756('0xc'));var fs=require('fs');var fs_extra=require(_0xc756('0xd'));var _=require(_0xc756('0xe'));var squel=require(_0xc756('0xf'));var crypto=require('crypto');var jsforce=require(_0xc756('0x10'));var deskjs=require(_0xc756('0x11'));var toCsv=require(_0xc756('0xb'));var querystring=require(_0xc756('0x12'));var Papa=require(_0xc756('0x13'));var Redis=require(_0xc756('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc756('0x15'));var hardwareService=require(_0xc756('0x16'));var logger=require('../../config/logger')(_0xc756('0x17'));var utils=require(_0xc756('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc756('0x19'));var db=require(_0xc756('0x1a'))['db'];function respondWithStatusCode(_0x41cd8b,_0x5819af){_0x5819af=_0x5819af||0xcc;return function(_0x33c914){if(_0x33c914){return _0x41cd8b['sendStatus'](_0x5819af);}return _0x41cd8b['status'](_0x5819af)[_0xc756('0x1b')]();};}function respondWithResult(_0x5ea454,_0x3aeb11){_0x3aeb11=_0x3aeb11||0xc8;return function(_0x4144c0){if(_0x4144c0){return _0x5ea454['status'](_0x3aeb11)[_0xc756('0x1c')](_0x4144c0);}};}function respondWithFilteredResult(_0x57d0ce,_0x577bee){return function(_0x5a007c){if(_0x5a007c){var _0x34c624=typeof _0x577bee[_0xc756('0x1d')]===_0xc756('0x1e')&&typeof _0x577bee[_0xc756('0x1f')]===_0xc756('0x1e');var _0x63d75a=_0x5a007c[_0xc756('0x20')];var _0x11448c=_0x34c624?0x0:_0x577bee[_0xc756('0x1d')];var _0x59b29f=_0x34c624?_0x5a007c[_0xc756('0x20')]:_0x577bee[_0xc756('0x1d')]+_0x577bee[_0xc756('0x1f')];var _0x3f0875;if(_0x59b29f>=_0x63d75a){_0x59b29f=_0x63d75a;_0x3f0875=0xc8;}else{_0x3f0875=0xce;}_0x57d0ce[_0xc756('0x21')](_0x3f0875);return _0x57d0ce[_0xc756('0x22')]('Content-Range',_0x11448c+'-'+_0x59b29f+'/'+_0x63d75a)[_0xc756('0x1c')](_0x5a007c);}return null;};}function patchUpdates(_0x3b72e6){return function(_0x563c6c){try{jsonpatch['apply'](_0x563c6c,_0x3b72e6,!![]);}catch(_0x3af82e){return BPromise['reject'](_0x3af82e);}return _0x563c6c[_0xc756('0x23')]();};}function saveUpdates(_0x3d97a6,_0x5b2091){return function(_0x18a36b){if(_0x18a36b){return _0x18a36b['update'](_0x3d97a6)['then'](function(_0x339e79){return _0x339e79;});}return null;};}function removeEntity(_0x17d57c,_0x2755e1){return function(_0x3ea222){if(_0x3ea222){return _0x3ea222[_0xc756('0x24')]()[_0xc756('0x25')](function(){_0x17d57c['status'](0xcc)[_0xc756('0x1b')]();});}};}function handleEntityNotFound(_0x5c197d,_0x1bdf5d){return function(_0x10e102){if(!_0x10e102){_0x5c197d[_0xc756('0x26')](0x194);}return _0x10e102;};}function handleError(_0x11ff75,_0x4f877e){_0x4f877e=_0x4f877e||0x1f4;return function(_0x49d35e){logger['error'](_0x49d35e['stack']);if(_0x49d35e[_0xc756('0x27')]){delete _0x49d35e[_0xc756('0x27')];}_0x11ff75[_0xc756('0x21')](_0x4f877e)[_0xc756('0x28')](_0x49d35e);};}exports['index']=function(_0x39751e,_0x320aa0){var _0x42ff0a={},_0x2b20b1={},_0x19d0ee={'count':0x0,'rows':[]};var _0x175e05=_[_0xc756('0x29')](db['SugarcrmConfiguration'][_0xc756('0x2a')],function(_0x34a8b3){return{'name':_0x34a8b3[_0xc756('0x2b')],'type':_0x34a8b3[_0xc756('0x2c')][_0xc756('0x2d')]};});_0x2b20b1[_0xc756('0x2e')]=_[_0xc756('0x29')](_0x175e05,_0xc756('0x27'));_0x2b20b1[_0xc756('0x2f')]=_[_0xc756('0x30')](_0x39751e[_0xc756('0x2f')]);_0x2b20b1[_0xc756('0x31')]=_[_0xc756('0x32')](_0x2b20b1['model'],_0x2b20b1['query']);_0x42ff0a[_0xc756('0x33')]=_['intersection'](_0x2b20b1[_0xc756('0x2e')],qs[_0xc756('0x34')](_0x39751e[_0xc756('0x2f')][_0xc756('0x34')]));_0x42ff0a['attributes']=_0x42ff0a[_0xc756('0x33')]['length']?_0x42ff0a['attributes']:_0x2b20b1[_0xc756('0x2e')];if(!_0x39751e[_0xc756('0x2f')][_0xc756('0x35')](_0xc756('0x36'))){_0x42ff0a[_0xc756('0x1f')]=qs[_0xc756('0x1f')](_0x39751e['query'][_0xc756('0x1f')]);_0x42ff0a[_0xc756('0x1d')]=qs[_0xc756('0x1d')](_0x39751e['query'][_0xc756('0x1d')]);}_0x42ff0a['order']=qs[_0xc756('0x37')](_0x39751e['query'][_0xc756('0x37')]);_0x42ff0a[_0xc756('0x38')]=qs[_0xc756('0x31')](_['pick'](_0x39751e['query'],_0x2b20b1[_0xc756('0x31')]),_0x175e05);if(_0x39751e['query'][_0xc756('0x39')]){_0x42ff0a['where']=_[_0xc756('0x3a')](_0x42ff0a[_0xc756('0x38')],{'$or':_[_0xc756('0x29')](_0x175e05,function(_0x55ea12){if(_0x55ea12[_0xc756('0x2c')]!=='VIRTUAL'){var _0x1d5601={};_0x1d5601[_0x55ea12[_0xc756('0x27')]]={'$like':'%'+_0x39751e[_0xc756('0x2f')]['filter']+'%'};return _0x1d5601;}})});}_0x42ff0a=_[_0xc756('0x3a')]({},_0x42ff0a,_0x39751e[_0xc756('0x3b')]);var _0x4dc6b6={'where':_0x42ff0a['where']};return db[_0xc756('0x3c')][_0xc756('0x20')](_0x4dc6b6)[_0xc756('0x25')](function(_0x1a6f02){_0x19d0ee['count']=_0x1a6f02;if(_0x39751e[_0xc756('0x2f')]['includeAll']){_0x42ff0a[_0xc756('0x3d')]=[{'all':!![]}];}return db[_0xc756('0x3c')][_0xc756('0x3e')](_0x42ff0a);})['then'](function(_0x42ede9){_0x19d0ee[_0xc756('0x3f')]=_0x42ede9;return _0x19d0ee;})[_0xc756('0x25')](respondWithFilteredResult(_0x320aa0,_0x42ff0a))[_0xc756('0x40')](handleError(_0x320aa0,null));};exports[_0xc756('0x41')]=function(_0x36e7bc,_0x57ebc0){var _0x4e0154={'raw':![],'where':{'id':_0x36e7bc['params']['id']}},_0x159b05={};_0x159b05['model']=_[_0xc756('0x30')](db[_0xc756('0x3c')][_0xc756('0x2a')]);_0x159b05[_0xc756('0x2f')]=_[_0xc756('0x30')](_0x36e7bc[_0xc756('0x2f')]);_0x159b05['filters']=_[_0xc756('0x32')](_0x159b05[_0xc756('0x2e')],_0x159b05['query']);_0x4e0154[_0xc756('0x33')]=_[_0xc756('0x32')](_0x159b05['model'],qs['fields'](_0x36e7bc[_0xc756('0x2f')][_0xc756('0x34')]));_0x4e0154['attributes']=_0x4e0154[_0xc756('0x33')][_0xc756('0x42')]?_0x4e0154[_0xc756('0x33')]:_0x159b05['model'];if(_0x36e7bc[_0xc756('0x2f')]['includeAll']){_0x4e0154[_0xc756('0x3d')]=[{'all':!![]}];}_0x4e0154=_['merge']({},_0x4e0154,_0x36e7bc[_0xc756('0x3b')]);return db[_0xc756('0x3c')][_0xc756('0x43')](_0x4e0154)[_0xc756('0x25')](handleEntityNotFound(_0x57ebc0,null))[_0xc756('0x25')](respondWithResult(_0x57ebc0,null))[_0xc756('0x40')](handleError(_0x57ebc0,null));};exports[_0xc756('0x44')]=function(_0x5b51bc,_0xb9dda1){return db[_0xc756('0x3c')][_0xc756('0x44')](_0x5b51bc[_0xc756('0x45')],{})[_0xc756('0x25')](respondWithResult(_0xb9dda1,0xc9))[_0xc756('0x40')](handleError(_0xb9dda1,null));};exports[_0xc756('0x46')]=function(_0x5a5f83,_0x6aa17){if(_0x5a5f83[_0xc756('0x45')]['id']){delete _0x5a5f83[_0xc756('0x45')]['id'];}return db[_0xc756('0x3c')][_0xc756('0x43')]({'where':{'id':_0x5a5f83[_0xc756('0x47')]['id']}})['then'](handleEntityNotFound(_0x6aa17,null))[_0xc756('0x25')](saveUpdates(_0x5a5f83[_0xc756('0x45')],null))[_0xc756('0x25')](respondWithResult(_0x6aa17,null))[_0xc756('0x40')](handleError(_0x6aa17,null));};exports[_0xc756('0x24')]=function(_0x3afbdb,_0x24e133){return db[_0xc756('0x3c')][_0xc756('0x43')]({'where':{'id':_0x3afbdb[_0xc756('0x47')]['id']}})['then'](handleEntityNotFound(_0x24e133,null))[_0xc756('0x25')](removeEntity(_0x24e133,null))['catch'](handleError(_0x24e133,null));};exports['getFields']=function(_0x563f30,_0x52160a,_0x3612eb){var _0x38ac31={};var _0x387bd7={};var _0x200d96;var _0x4bd96b;return db[_0xc756('0x3c')][_0xc756('0x48')]({'where':{'id':_0x563f30[_0xc756('0x47')]['id']}})['then'](handleEntityNotFound(_0x52160a,null))['then'](function(_0x17f0ff){if(_0x17f0ff){_0x200d96=_0x17f0ff;_0x387bd7['model']=_[_0xc756('0x30')](db[_0xc756('0x49')]['rawAttributes']);_0x387bd7['query']=_[_0xc756('0x30')](_0x563f30[_0xc756('0x2f')]);_0x387bd7[_0xc756('0x31')]=_[_0xc756('0x32')](_0x387bd7[_0xc756('0x2e')],_0x387bd7[_0xc756('0x2f')]);_0x38ac31[_0xc756('0x33')]=_[_0xc756('0x32')](_0x387bd7[_0xc756('0x2e')],qs[_0xc756('0x34')](_0x563f30[_0xc756('0x2f')][_0xc756('0x34')]));_0x38ac31['attributes']=_0x38ac31[_0xc756('0x33')][_0xc756('0x42')]?_0x38ac31['attributes']:_0x387bd7[_0xc756('0x2e')];_0x38ac31['order']=qs[_0xc756('0x37')](_0x563f30['query'][_0xc756('0x37')]);_0x38ac31['where']=qs[_0xc756('0x31')](_['pick'](_0x563f30['query'],_0x387bd7[_0xc756('0x31')]));if(_0x563f30[_0xc756('0x2f')]['filter']){_0x38ac31[_0xc756('0x38')]=_['merge'](_0x38ac31[_0xc756('0x38')],{'$or':_[_0xc756('0x29')](_0x38ac31[_0xc756('0x33')],function(_0x3f4ab0){var _0x495c12={};_0x495c12[_0x3f4ab0]={'$like':'%'+_0x563f30[_0xc756('0x2f')][_0xc756('0x39')]+'%'};return _0x495c12;})});}_0x38ac31=_[_0xc756('0x3a')]({},_0x38ac31,_0x563f30['options']);return _0x200d96[_0xc756('0x4a')](_0x38ac31);}})['then'](function(_0x465025){if(_0x465025){_0x4bd96b=_0x465025[_0xc756('0x42')];if(!_0x563f30[_0xc756('0x2f')][_0xc756('0x35')]('nolimit')){_0x38ac31[_0xc756('0x1f')]=qs[_0xc756('0x1f')](_0x563f30[_0xc756('0x2f')]['limit']);_0x38ac31[_0xc756('0x1d')]=qs[_0xc756('0x1d')](_0x563f30[_0xc756('0x2f')][_0xc756('0x1d')]);}return _0x200d96['getFields'](_0x38ac31);}})[_0xc756('0x25')](function(_0x504ca6){if(_0x504ca6){return _0x504ca6?{'count':_0x4bd96b,'rows':_0x504ca6}:null;}})[_0xc756('0x25')](respondWithResult(_0x52160a,null))[_0xc756('0x40')](handleError(_0x52160a,null));};exports[_0xc756('0x4b')]=function(_0x314319,_0x1af32e,_0x19ffea){var _0x15622a={};var _0xca536b={};var _0x3ca822;var _0x212abf;return db[_0xc756('0x3c')][_0xc756('0x48')]({'where':{'id':_0x314319[_0xc756('0x47')]['id']}})[_0xc756('0x25')](handleEntityNotFound(_0x1af32e,null))[_0xc756('0x25')](function(_0x1bb47b){if(_0x1bb47b){_0x3ca822=_0x1bb47b;_0xca536b[_0xc756('0x2e')]=_[_0xc756('0x30')](db[_0xc756('0x49')][_0xc756('0x2a')]);_0xca536b[_0xc756('0x2f')]=_[_0xc756('0x30')](_0x314319[_0xc756('0x2f')]);_0xca536b[_0xc756('0x31')]=_[_0xc756('0x32')](_0xca536b[_0xc756('0x2e')],_0xca536b[_0xc756('0x2f')]);_0x15622a[_0xc756('0x33')]=_[_0xc756('0x32')](_0xca536b[_0xc756('0x2e')],qs[_0xc756('0x34')](_0x314319[_0xc756('0x2f')][_0xc756('0x34')]));_0x15622a['attributes']=_0x15622a['attributes'][_0xc756('0x42')]?_0x15622a[_0xc756('0x33')]:_0xca536b[_0xc756('0x2e')];_0x15622a['order']=qs[_0xc756('0x37')](_0x314319[_0xc756('0x2f')][_0xc756('0x37')]);_0x15622a[_0xc756('0x38')]=qs[_0xc756('0x31')](_['pick'](_0x314319['query'],_0xca536b['filters']));if(_0x314319[_0xc756('0x2f')][_0xc756('0x39')]){_0x15622a[_0xc756('0x38')]=_[_0xc756('0x3a')](_0x15622a[_0xc756('0x38')],{'$or':_['map'](_0x15622a[_0xc756('0x33')],function(_0xacc0ea){var _0x2ee07b={};_0x2ee07b[_0xacc0ea]={'$like':'%'+_0x314319[_0xc756('0x2f')][_0xc756('0x39')]+'%'};return _0x2ee07b;})});}_0x15622a=_[_0xc756('0x3a')]({},_0x15622a,_0x314319[_0xc756('0x3b')]);return _0x3ca822[_0xc756('0x4b')](_0x15622a);}})[_0xc756('0x25')](function(_0x5a5057){if(_0x5a5057){_0x212abf=_0x5a5057[_0xc756('0x42')];if(!_0x314319[_0xc756('0x2f')]['hasOwnProperty'](_0xc756('0x36'))){_0x15622a[_0xc756('0x1f')]=qs[_0xc756('0x1f')](_0x314319[_0xc756('0x2f')][_0xc756('0x1f')]);_0x15622a[_0xc756('0x1d')]=qs['offset'](_0x314319['query'][_0xc756('0x1d')]);}return _0x3ca822[_0xc756('0x4b')](_0x15622a);}})['then'](function(_0x436d08){if(_0x436d08){return _0x436d08?{'count':_0x212abf,'rows':_0x436d08}:null;}})['then'](respondWithResult(_0x1af32e,null))[_0xc756('0x40')](handleError(_0x1af32e,null));};exports[_0xc756('0x4c')]=function(_0x3f239d,_0x245355,_0x39854e){var _0xddf6c={};var _0x4313fc={};var _0x4a575d;var _0xf256be;return db[_0xc756('0x3c')]['findOne']({'where':{'id':_0x3f239d[_0xc756('0x47')]['id']}})[_0xc756('0x25')](handleEntityNotFound(_0x245355,null))[_0xc756('0x25')](function(_0x459bb4){if(_0x459bb4){_0x4a575d=_0x459bb4;_0x4313fc['model']=_[_0xc756('0x30')](db['SugarcrmField'][_0xc756('0x2a')]);_0x4313fc[_0xc756('0x2f')]=_[_0xc756('0x30')](_0x3f239d[_0xc756('0x2f')]);_0x4313fc[_0xc756('0x31')]=_[_0xc756('0x32')](_0x4313fc[_0xc756('0x2e')],_0x4313fc['query']);_0xddf6c[_0xc756('0x33')]=_[_0xc756('0x32')](_0x4313fc[_0xc756('0x2e')],qs[_0xc756('0x34')](_0x3f239d['query'][_0xc756('0x34')]));_0xddf6c['attributes']=_0xddf6c[_0xc756('0x33')][_0xc756('0x42')]?_0xddf6c['attributes']:_0x4313fc[_0xc756('0x2e')];_0xddf6c[_0xc756('0x4d')]=qs[_0xc756('0x37')](_0x3f239d[_0xc756('0x2f')]['sort']);_0xddf6c[_0xc756('0x38')]=qs[_0xc756('0x31')](_[_0xc756('0x4e')](_0x3f239d['query'],_0x4313fc[_0xc756('0x31')]));if(_0x3f239d[_0xc756('0x2f')][_0xc756('0x39')]){_0xddf6c[_0xc756('0x38')]=_['merge'](_0xddf6c[_0xc756('0x38')],{'$or':_[_0xc756('0x29')](_0xddf6c[_0xc756('0x33')],function(_0x109949){var _0x5e352a={};_0x5e352a[_0x109949]={'$like':'%'+_0x3f239d[_0xc756('0x2f')][_0xc756('0x39')]+'%'};return _0x5e352a;})});}_0xddf6c=_[_0xc756('0x3a')]({},_0xddf6c,_0x3f239d[_0xc756('0x3b')]);return _0x4a575d[_0xc756('0x4c')](_0xddf6c);}})[_0xc756('0x25')](function(_0x3ac7cb){if(_0x3ac7cb){_0xf256be=_0x3ac7cb['length'];if(!_0x3f239d[_0xc756('0x2f')]['hasOwnProperty']('nolimit')){_0xddf6c[_0xc756('0x1f')]=qs[_0xc756('0x1f')](_0x3f239d[_0xc756('0x2f')]['limit']);_0xddf6c[_0xc756('0x1d')]=qs[_0xc756('0x1d')](_0x3f239d['query']['offset']);}return _0x4a575d[_0xc756('0x4c')](_0xddf6c);}})[_0xc756('0x25')](function(_0x3a3bde){if(_0x3a3bde){return _0x3a3bde?{'count':_0xf256be,'rows':_0x3a3bde}:null;}})[_0xc756('0x25')](respondWithResult(_0x245355,null))['catch'](handleError(_0x245355,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ef35ce2..81eeb6b 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 _0x8e31=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x8e31,0x83));var _0x18e3=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x8e31[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0x18e3('0x0'));var util=require(_0x18e3('0x1'));var logger=require(_0x18e3('0x2'))('api');var moment=require(_0x18e3('0x3'));var BPromise=require(_0x18e3('0x4'));var rp=require(_0x18e3('0x5'));var fs=require('fs');var path=require(_0x18e3('0x6'));var rimraf=require('rimraf');var config=require(_0x18e3('0x7'));var attributes=require(_0x18e3('0x8'));module[_0x18e3('0x9')]=function(_0x1f2e4f,_0x343c19){return _0x1f2e4f[_0x18e3('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0x18e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24b2=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x33f96f,_0x1680b1){var _0x3156f2=function(_0x287639){while(--_0x287639){_0x33f96f['push'](_0x33f96f['shift']());}};_0x3156f2(++_0x1680b1);}(_0x24b2,0x1a5));var _0x224b=function(_0x5f1029,_0x3b8f0d){_0x5f1029=_0x5f1029-0x0;var _0x13f895=_0x24b2[_0x5f1029];return _0x13f895;};'use strict';var _=require(_0x224b('0x0'));var util=require(_0x224b('0x1'));var logger=require(_0x224b('0x2'))(_0x224b('0x3'));var moment=require('moment');var BPromise=require(_0x224b('0x4'));var rp=require(_0x224b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x224b('0x6'));var config=require(_0x224b('0x7'));var attributes=require(_0x224b('0x8'));module[_0x224b('0x9')]=function(_0x28d984,_0x4d7308){return _0x28d984[_0x224b('0xa')](_0x224b('0xb'),attributes,{'tableName':_0x224b('0xc'),'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 1c45c28..29c2f56 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 _0xd29a=['error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','stringify'];(function(_0x22e21f,_0x134f01){var _0x5be6c2=function(_0xea3884){while(--_0xea3884){_0x22e21f['push'](_0x22e21f['shift']());}};_0x5be6c2(++_0x134f01);}(_0xd29a,0x150));var _0xad29=function(_0x566aba,_0x5a79aa){_0x566aba=_0x566aba-0x0;var _0x4e5bcc=_0xd29a[_0x566aba];return _0x4e5bcc;};'use strict';var _=require(_0xad29('0x0'));var util=require('util');var moment=require(_0xad29('0x1'));var BPromise=require(_0xad29('0x2'));var rs=require(_0xad29('0x3'));var fs=require('fs');var Redis=require(_0xad29('0x4'));var db=require(_0xad29('0x5'))['db'];var utils=require(_0xad29('0x6'));var logger=require('../../config/logger')(_0xad29('0x7'));var config=require('../../config/environment');var jayson=require(_0xad29('0x8'));var client=jayson[_0xad29('0x9')][_0xad29('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30681e,_0x89f195,_0x1967bc){return new BPromise(function(_0x961f57,_0x23a94b){return client[_0xad29('0xb')](_0x30681e,_0x1967bc)[_0xad29('0xc')](function(_0x41f89c){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x89f195,_0xad29('0xd'));logger[_0xad29('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x89f195,_0xad29('0xd'),JSON[_0xad29('0xf')](_0x41f89c));if(_0x41f89c[_0xad29('0x10')]){if(_0x41f89c[_0xad29('0x10')][_0xad29('0x11')]===0x1f4){logger[_0xad29('0x10')](_0xad29('0x12'),_0x89f195,_0x41f89c[_0xad29('0x10')]['message']);return _0x23a94b(_0x41f89c['error'][_0xad29('0x13')]);}logger[_0xad29('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x89f195,_0x41f89c['error'][_0xad29('0x13')]);return _0x961f57(_0x41f89c[_0xad29('0x10')]['message']);}else{logger[_0xad29('0x14')](_0xad29('0x12'),_0x89f195,_0xad29('0xd'));_0x961f57(_0x41f89c['result']['message']);}})[_0xad29('0x15')](function(_0x36935a){logger[_0xad29('0x10')](_0xad29('0x12'),_0x89f195,_0x36935a);_0x23a94b(_0x36935a);});});} \ No newline at end of file +var _0xa7f7=['rpc','../../config/environment','jayson/promise','client','http','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x255866,_0x36e47a){var _0x5f490f=function(_0x52d504){while(--_0x52d504){_0x255866['push'](_0x255866['shift']());}};_0x5f490f(++_0x36e47a);}(_0xa7f7,0x199));var _0x7a7f=function(_0x11946c,_0x12152c){_0x11946c=_0x11946c-0x0;var _0x383935=_0xa7f7[_0x11946c];return _0x383935;};'use strict';var _=require('lodash');var util=require(_0x7a7f('0x0'));var moment=require('moment');var BPromise=require(_0x7a7f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a7f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a7f('0x3'));var logger=require(_0x7a7f('0x4'))(_0x7a7f('0x5'));var config=require(_0x7a7f('0x6'));var jayson=require(_0x7a7f('0x7'));var client=jayson[_0x7a7f('0x8')][_0x7a7f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x554cdb,_0x466885,_0xd22800){return new BPromise(function(_0x46c529,_0x25a84a){return client['request'](_0x554cdb,_0xd22800)['then'](function(_0x1150b6){logger[_0x7a7f('0xa')](_0x7a7f('0xb'),_0x466885,_0x7a7f('0xc'));logger['debug'](_0x7a7f('0xd'),_0x466885,_0x7a7f('0xc'),JSON[_0x7a7f('0xe')](_0x1150b6));if(_0x1150b6[_0x7a7f('0xf')]){if(_0x1150b6[_0x7a7f('0xf')]['code']===0x1f4){logger[_0x7a7f('0xf')](_0x7a7f('0xb'),_0x466885,_0x1150b6[_0x7a7f('0xf')][_0x7a7f('0x10')]);return _0x25a84a(_0x1150b6['error']['message']);}logger['error'](_0x7a7f('0xb'),_0x466885,_0x1150b6[_0x7a7f('0xf')][_0x7a7f('0x10')]);return _0x46c529(_0x1150b6[_0x7a7f('0xf')]['message']);}else{logger[_0x7a7f('0xa')](_0x7a7f('0xb'),_0x466885,_0x7a7f('0xc'));_0x46c529(_0x1150b6['result']['message']);}})[_0x7a7f('0x11')](function(_0x11b2c9){logger[_0x7a7f('0xf')](_0x7a7f('0xb'),_0x466885,_0x11b2c9);_0x25a84a(_0x11b2c9);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 4f8e420..4121b82 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 _0x0165=['../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','index','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x294047,_0x59e5ac){var _0x5cc4da=function(_0x5e0241){while(--_0x5e0241){_0x294047['push'](_0x294047['shift']());}};_0x5cc4da(++_0x59e5ac);}(_0x0165,0x10a));var _0x5016=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0165[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x5016('0x0'));var util=require(_0x5016('0x1'));var path=require(_0x5016('0x2'));var timeout=require(_0x5016('0x3'));var express=require(_0x5016('0x4'));var router=express[_0x5016('0x5')]();var fs_extra=require(_0x5016('0x6'));var auth=require(_0x5016('0x7'));var interaction=require(_0x5016('0x8'));var config=require('../../config/environment');var controller=require(_0x5016('0x9'));router[_0x5016('0xa')]('/',auth['isAuthenticated'](),controller[_0x5016('0xb')]);router[_0x5016('0xa')]('/:id',auth[_0x5016('0xc')](),controller[_0x5016('0xd')]);router[_0x5016('0xe')]('/',auth['isAuthenticated'](),controller[_0x5016('0xf')]);router[_0x5016('0x10')](_0x5016('0x11'),auth[_0x5016('0xc')](),controller['update']);router[_0x5016('0x12')](_0x5016('0x11'),auth[_0x5016('0xc')](),controller[_0x5016('0x13')]);module[_0x5016('0x14')]=router; \ No newline at end of file +var _0x92f2=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./intSugarcrmField.controller'];(function(_0x1a107e,_0x430590){var _0x1add76=function(_0x24bbbc){while(--_0x24bbbc){_0x1a107e['push'](_0x1a107e['shift']());}};_0x1add76(++_0x430590);}(_0x92f2,0xe7));var _0x292f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x92f2[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x292f('0x0'));var util=require(_0x292f('0x1'));var path=require('path');var timeout=require(_0x292f('0x2'));var express=require('express');var router=express[_0x292f('0x3')]();var fs_extra=require(_0x292f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x292f('0x5'));var controller=require(_0x292f('0x6'));router[_0x292f('0x7')]('/',auth[_0x292f('0x8')](),controller[_0x292f('0x9')]);router['get'](_0x292f('0xa'),auth[_0x292f('0x8')](),controller[_0x292f('0xb')]);router['post']('/',auth[_0x292f('0x8')](),controller[_0x292f('0xc')]);router[_0x292f('0xd')](_0x292f('0xa'),auth['isAuthenticated'](),controller[_0x292f('0xe')]);router[_0x292f('0xf')](_0x292f('0xa'),auth[_0x292f('0x8')](),controller[_0x292f('0x10')]);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 5e2116b..36fa116 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 _0x23bc=['exports','ENUM','string','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x5b5d1c,_0x396472){var _0x490569=function(_0x1be24c){while(--_0x1be24c){_0x5b5d1c['push'](_0x5b5d1c['shift']());}};_0x490569(++_0x396472);}(_0x23bc,0x1d7));var _0xc23b=function(_0x30acd7,_0xab14df){_0x30acd7=_0x30acd7-0x0;var _0x36f3a5=_0x23bc[_0x30acd7];return _0x36f3a5;};'use strict';var Sequelize=require(_0xc23b('0x0'));module[_0xc23b('0x1')]={'type':{'type':Sequelize[_0xc23b('0x2')](_0xc23b('0x3'),'variable',_0xc23b('0x4'),'keyValue',_0xc23b('0x5')),'defaultValue':_0xc23b('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc23b('0x6')]},'keyType':{'type':Sequelize[_0xc23b('0x2')](_0xc23b('0x3'),'variable',_0xc23b('0x4'))},'keyContent':{'type':Sequelize[_0xc23b('0x6')]},'idField':{'type':Sequelize[_0xc23b('0x6')]},'nameField':{'type':Sequelize[_0xc23b('0x6')]},'customField':{'type':Sequelize[_0xc23b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc23b('0x6')]}}; \ No newline at end of file +var _0x917c=['picklist','string','STRING','BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue'];(function(_0x3938d2,_0x8e9793){var _0x45513c=function(_0x2684ea){while(--_0x2684ea){_0x3938d2['push'](_0x3938d2['shift']());}};_0x45513c(++_0x8e9793);}(_0x917c,0x124));var _0xc917=function(_0x49fa19,_0x44026c){_0x49fa19=_0x49fa19-0x0;var _0x1ffd46=_0x917c[_0x49fa19];return _0x1ffd46;};'use strict';var Sequelize=require(_0xc917('0x0'));module['exports']={'type':{'type':Sequelize[_0xc917('0x1')]('string',_0xc917('0x2'),_0xc917('0x3'),_0xc917('0x4'),_0xc917('0x5')),'defaultValue':_0xc917('0x6')},'content':{'type':Sequelize[_0xc917('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xc917('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc917('0x7')]},'nameField':{'type':Sequelize[_0xc917('0x7')]},'customField':{'type':Sequelize[_0xc917('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc917('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 4f7b435..309bff5 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 _0x0a11=['undefined','limit','count','offset','Content-Range','json','apply','update','then','end','stack','send','map','SugarcrmField','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','name','merge','options','include','findAll','params','length','includeAll','find','body','catch','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x24d711,_0x3cdb28){var _0x3491b4=function(_0xd5957e){while(--_0xd5957e){_0x24d711['push'](_0x24d711['shift']());}};_0x3491b4(++_0x3cdb28);}(_0x0a11,0x6e));var _0x10a1=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0x0a11[_0x5c14f6];return _0x4949b3;};'use strict';var emlformat=require(_0x10a1('0x0'));var rimraf=require(_0x10a1('0x1'));var zipdir=require(_0x10a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x10a1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x10a1('0x4'));var util=require(_0x10a1('0x5'));var path=require(_0x10a1('0x6'));var sox=require(_0x10a1('0x7'));var csv=require(_0x10a1('0x8'));var ejs=require(_0x10a1('0x9'));var fs=require('fs');var fs_extra=require(_0x10a1('0xa'));var _=require(_0x10a1('0xb'));var squel=require(_0x10a1('0xc'));var crypto=require(_0x10a1('0xd'));var jsforce=require(_0x10a1('0xe'));var deskjs=require(_0x10a1('0xf'));var toCsv=require(_0x10a1('0x8'));var querystring=require(_0x10a1('0x10'));var Papa=require(_0x10a1('0x11'));var Redis=require('ioredis');var authService=require(_0x10a1('0x12'));var qs=require(_0x10a1('0x13'));var as=require(_0x10a1('0x14'));var hardwareService=require(_0x10a1('0x15'));var logger=require('../../config/logger')(_0x10a1('0x16'));var utils=require(_0x10a1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x10a1('0x18'));var db=require(_0x10a1('0x19'))['db'];function respondWithStatusCode(_0x4554fb,_0xf131a2){_0xf131a2=_0xf131a2||0xcc;return function(_0x9afee1){if(_0x9afee1){return _0x4554fb[_0x10a1('0x1a')](_0xf131a2);}return _0x4554fb['status'](_0xf131a2)['end']();};}function respondWithResult(_0x1f319b,_0x586d47){_0x586d47=_0x586d47||0xc8;return function(_0x4d5470){if(_0x4d5470){return _0x1f319b[_0x10a1('0x1b')](_0x586d47)['json'](_0x4d5470);}};}function respondWithFilteredResult(_0x5c30a5,_0x376fea){return function(_0x381d3a){if(_0x381d3a){var _0x159d32=typeof _0x376fea['offset']===_0x10a1('0x1c')&&typeof _0x376fea[_0x10a1('0x1d')]===_0x10a1('0x1c');var _0x502ae4=_0x381d3a[_0x10a1('0x1e')];var _0x2aaace=_0x159d32?0x0:_0x376fea[_0x10a1('0x1f')];var _0x1cd8a0=_0x159d32?_0x381d3a[_0x10a1('0x1e')]:_0x376fea[_0x10a1('0x1f')]+_0x376fea[_0x10a1('0x1d')];var _0x3f3f6b;if(_0x1cd8a0>=_0x502ae4){_0x1cd8a0=_0x502ae4;_0x3f3f6b=0xc8;}else{_0x3f3f6b=0xce;}_0x5c30a5['status'](_0x3f3f6b);return _0x5c30a5['set'](_0x10a1('0x20'),_0x2aaace+'-'+_0x1cd8a0+'/'+_0x502ae4)[_0x10a1('0x21')](_0x381d3a);}return null;};}function patchUpdates(_0x1d9ea2){return function(_0x1c37d6){try{jsonpatch[_0x10a1('0x22')](_0x1c37d6,_0x1d9ea2,!![]);}catch(_0xdd6d6b){return BPromise['reject'](_0xdd6d6b);}return _0x1c37d6['save']();};}function saveUpdates(_0x5f3c4b,_0x42da93){return function(_0x1dfadd){if(_0x1dfadd){return _0x1dfadd[_0x10a1('0x23')](_0x5f3c4b)[_0x10a1('0x24')](function(_0x43b47c){return _0x43b47c;});}return null;};}function removeEntity(_0x3a956c,_0xb442eb){return function(_0x38851c){if(_0x38851c){return _0x38851c['destroy']()[_0x10a1('0x24')](function(){_0x3a956c[_0x10a1('0x1b')](0xcc)[_0x10a1('0x25')]();});}};}function handleEntityNotFound(_0x3e6fef,_0x209ee8){return function(_0x1dd2c0){if(!_0x1dd2c0){_0x3e6fef[_0x10a1('0x1a')](0x194);}return _0x1dd2c0;};}function handleError(_0x17bf38,_0x26520a){_0x26520a=_0x26520a||0x1f4;return function(_0x35ab52){logger['error'](_0x35ab52[_0x10a1('0x26')]);if(_0x35ab52['name']){delete _0x35ab52['name'];}_0x17bf38[_0x10a1('0x1b')](_0x26520a)[_0x10a1('0x27')](_0x35ab52);};}exports['index']=function(_0x5ecb4c,_0x37498a){var _0x51101f={},_0x519464={},_0x375c05={'count':0x0,'rows':[]};var _0x39d33a=_[_0x10a1('0x28')](db[_0x10a1('0x29')][_0x10a1('0x2a')],function(_0x4fe473){return{'name':_0x4fe473[_0x10a1('0x2b')],'type':_0x4fe473[_0x10a1('0x2c')]['key']};});_0x519464[_0x10a1('0x2d')]=_[_0x10a1('0x28')](_0x39d33a,'name');_0x519464['query']=_[_0x10a1('0x2e')](_0x5ecb4c[_0x10a1('0x2f')]);_0x519464[_0x10a1('0x30')]=_[_0x10a1('0x31')](_0x519464[_0x10a1('0x2d')],_0x519464[_0x10a1('0x2f')]);_0x51101f[_0x10a1('0x32')]=_['intersection'](_0x519464[_0x10a1('0x2d')],qs[_0x10a1('0x33')](_0x5ecb4c['query']['fields']));_0x51101f['attributes']=_0x51101f['attributes']['length']?_0x51101f['attributes']:_0x519464[_0x10a1('0x2d')];if(!_0x5ecb4c[_0x10a1('0x2f')][_0x10a1('0x34')](_0x10a1('0x35'))){_0x51101f[_0x10a1('0x1d')]=qs[_0x10a1('0x1d')](_0x5ecb4c[_0x10a1('0x2f')][_0x10a1('0x1d')]);_0x51101f['offset']=qs['offset'](_0x5ecb4c[_0x10a1('0x2f')][_0x10a1('0x1f')]);}_0x51101f['order']=qs[_0x10a1('0x36')](_0x5ecb4c['query'][_0x10a1('0x36')]);_0x51101f[_0x10a1('0x37')]=qs[_0x10a1('0x30')](_[_0x10a1('0x38')](_0x5ecb4c[_0x10a1('0x2f')],_0x519464[_0x10a1('0x30')]),_0x39d33a);if(_0x5ecb4c[_0x10a1('0x2f')][_0x10a1('0x39')]){_0x51101f[_0x10a1('0x37')]=_['merge'](_0x51101f[_0x10a1('0x37')],{'$or':_[_0x10a1('0x28')](_0x39d33a,function(_0x4ff97c){if(_0x4ff97c['type']!=='VIRTUAL'){var _0x5c7477={};_0x5c7477[_0x4ff97c[_0x10a1('0x3a')]]={'$like':'%'+_0x5ecb4c[_0x10a1('0x2f')][_0x10a1('0x39')]+'%'};return _0x5c7477;}})});}_0x51101f=_[_0x10a1('0x3b')]({},_0x51101f,_0x5ecb4c[_0x10a1('0x3c')]);var _0x1cd0f8={'where':_0x51101f[_0x10a1('0x37')]};return db[_0x10a1('0x29')][_0x10a1('0x1e')](_0x1cd0f8)['then'](function(_0x261743){_0x375c05[_0x10a1('0x1e')]=_0x261743;if(_0x5ecb4c['query']['includeAll']){_0x51101f[_0x10a1('0x3d')]=[{'all':!![]}];}return db[_0x10a1('0x29')][_0x10a1('0x3e')](_0x51101f);})[_0x10a1('0x24')](function(_0x10c2ae){_0x375c05['rows']=_0x10c2ae;return _0x375c05;})[_0x10a1('0x24')](respondWithFilteredResult(_0x37498a,_0x51101f))['catch'](handleError(_0x37498a,null));};exports['show']=function(_0x20eff9,_0x2517d3){var _0x301ebd={'raw':!![],'where':{'id':_0x20eff9[_0x10a1('0x3f')]['id']}},_0x349a07={};_0x349a07[_0x10a1('0x2d')]=_['keys'](db[_0x10a1('0x29')]['rawAttributes']);_0x349a07[_0x10a1('0x2f')]=_['keys'](_0x20eff9['query']);_0x349a07['filters']=_[_0x10a1('0x31')](_0x349a07[_0x10a1('0x2d')],_0x349a07[_0x10a1('0x2f')]);_0x301ebd[_0x10a1('0x32')]=_['intersection'](_0x349a07[_0x10a1('0x2d')],qs[_0x10a1('0x33')](_0x20eff9[_0x10a1('0x2f')][_0x10a1('0x33')]));_0x301ebd[_0x10a1('0x32')]=_0x301ebd[_0x10a1('0x32')][_0x10a1('0x40')]?_0x301ebd[_0x10a1('0x32')]:_0x349a07['model'];if(_0x20eff9[_0x10a1('0x2f')][_0x10a1('0x41')]){_0x301ebd[_0x10a1('0x3d')]=[{'all':!![]}];}_0x301ebd=_[_0x10a1('0x3b')]({},_0x301ebd,_0x20eff9['options']);return db[_0x10a1('0x29')][_0x10a1('0x42')](_0x301ebd)[_0x10a1('0x24')](handleEntityNotFound(_0x2517d3,null))['then'](respondWithResult(_0x2517d3,null))['catch'](handleError(_0x2517d3,null));};exports['create']=function(_0xf266db,_0x432701){return db['SugarcrmField']['create'](_0xf266db[_0x10a1('0x43')],{})[_0x10a1('0x24')](respondWithResult(_0x432701,0xc9))[_0x10a1('0x44')](handleError(_0x432701,null));};exports[_0x10a1('0x23')]=function(_0x53e44a,_0x5358ab){if(_0x53e44a[_0x10a1('0x43')]['id']){delete _0x53e44a[_0x10a1('0x43')]['id'];}return db[_0x10a1('0x29')][_0x10a1('0x42')]({'where':{'id':_0x53e44a['params']['id']}})[_0x10a1('0x24')](handleEntityNotFound(_0x5358ab,null))[_0x10a1('0x24')](saveUpdates(_0x53e44a[_0x10a1('0x43')],null))[_0x10a1('0x24')](respondWithResult(_0x5358ab,null))[_0x10a1('0x44')](handleError(_0x5358ab,null));};exports['destroy']=function(_0x35dad8,_0x40fa7a){return db['SugarcrmField']['find']({'where':{'id':_0x35dad8[_0x10a1('0x3f')]['id']}})[_0x10a1('0x24')](handleEntityNotFound(_0x40fa7a,null))[_0x10a1('0x24')](removeEntity(_0x40fa7a,null))['catch'](handleError(_0x40fa7a,null));}; \ No newline at end of file +var _0xefca=['then','destroy','sendStatus','name','send','index','map','SugarcrmField','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','rawAttributes','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update'];(function(_0x570e00,_0x344263){var _0x5bc20c=function(_0x21ece2){while(--_0x21ece2){_0x570e00['push'](_0x570e00['shift']());}};_0x5bc20c(++_0x344263);}(_0xefca,0x152));var _0xaefc=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0xefca[_0x218972];return _0x1bb1a8;};'use strict';var emlformat=require(_0xaefc('0x0'));var rimraf=require(_0xaefc('0x1'));var zipdir=require(_0xaefc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaefc('0x3'));var moment=require(_0xaefc('0x4'));var BPromise=require(_0xaefc('0x5'));var Mustache=require(_0xaefc('0x6'));var util=require(_0xaefc('0x7'));var path=require(_0xaefc('0x8'));var sox=require(_0xaefc('0x9'));var csv=require(_0xaefc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaefc('0xb'));var jsforce=require(_0xaefc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xaefc('0xa'));var querystring=require(_0xaefc('0xd'));var Papa=require(_0xaefc('0xe'));var Redis=require(_0xaefc('0xf'));var authService=require(_0xaefc('0x10'));var qs=require(_0xaefc('0x11'));var as=require(_0xaefc('0x12'));var hardwareService=require(_0xaefc('0x13'));var logger=require(_0xaefc('0x14'))(_0xaefc('0x15'));var utils=require(_0xaefc('0x16'));var config=require(_0xaefc('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaefc('0x18'))['db'];function respondWithStatusCode(_0x4a6e11,_0x38bbec){_0x38bbec=_0x38bbec||0xcc;return function(_0x88b936){if(_0x88b936){return _0x4a6e11['sendStatus'](_0x38bbec);}return _0x4a6e11[_0xaefc('0x19')](_0x38bbec)[_0xaefc('0x1a')]();};}function respondWithResult(_0x578097,_0x39ffb0){_0x39ffb0=_0x39ffb0||0xc8;return function(_0x278bf3){if(_0x278bf3){return _0x578097[_0xaefc('0x19')](_0x39ffb0)['json'](_0x278bf3);}};}function respondWithFilteredResult(_0x5648ee,_0x5a06f7){return function(_0x5e89ec){if(_0x5e89ec){var _0x11fcb1=typeof _0x5a06f7[_0xaefc('0x1b')]==='undefined'&&typeof _0x5a06f7['limit']===_0xaefc('0x1c');var _0x4d7214=_0x5e89ec[_0xaefc('0x1d')];var _0x49b1fa=_0x11fcb1?0x0:_0x5a06f7['offset'];var _0x14c991=_0x11fcb1?_0x5e89ec[_0xaefc('0x1d')]:_0x5a06f7[_0xaefc('0x1b')]+_0x5a06f7[_0xaefc('0x1e')];var _0x4a5fab;if(_0x14c991>=_0x4d7214){_0x14c991=_0x4d7214;_0x4a5fab=0xc8;}else{_0x4a5fab=0xce;}_0x5648ee['status'](_0x4a5fab);return _0x5648ee[_0xaefc('0x1f')](_0xaefc('0x20'),_0x49b1fa+'-'+_0x14c991+'/'+_0x4d7214)[_0xaefc('0x21')](_0x5e89ec);}return null;};}function patchUpdates(_0x3253d7){return function(_0x5ce1f8){try{jsonpatch['apply'](_0x5ce1f8,_0x3253d7,!![]);}catch(_0x15b1f8){return BPromise[_0xaefc('0x22')](_0x15b1f8);}return _0x5ce1f8[_0xaefc('0x23')]();};}function saveUpdates(_0x2e456b,_0x21b7d3){return function(_0x1d262b){if(_0x1d262b){return _0x1d262b[_0xaefc('0x24')](_0x2e456b)[_0xaefc('0x25')](function(_0x347ecc){return _0x347ecc;});}return null;};}function removeEntity(_0x26ad7b,_0x2cce8d){return function(_0xe47f14){if(_0xe47f14){return _0xe47f14[_0xaefc('0x26')]()['then'](function(){_0x26ad7b[_0xaefc('0x19')](0xcc)[_0xaefc('0x1a')]();});}};}function handleEntityNotFound(_0x4de82d,_0xd7d787){return function(_0x553ce5){if(!_0x553ce5){_0x4de82d[_0xaefc('0x27')](0x194);}return _0x553ce5;};}function handleError(_0x524750,_0x2a9905){_0x2a9905=_0x2a9905||0x1f4;return function(_0x36ec8a){logger['error'](_0x36ec8a['stack']);if(_0x36ec8a[_0xaefc('0x28')]){delete _0x36ec8a[_0xaefc('0x28')];}_0x524750[_0xaefc('0x19')](_0x2a9905)[_0xaefc('0x29')](_0x36ec8a);};}exports[_0xaefc('0x2a')]=function(_0x46dda4,_0x2256a5){var _0xafe848={},_0xca6423={},_0x2625d3={'count':0x0,'rows':[]};var _0x4d02eb=_[_0xaefc('0x2b')](db[_0xaefc('0x2c')]['rawAttributes'],function(_0x32eafe){return{'name':_0x32eafe[_0xaefc('0x2d')],'type':_0x32eafe[_0xaefc('0x2e')]['key']};});_0xca6423[_0xaefc('0x2f')]=_[_0xaefc('0x2b')](_0x4d02eb,_0xaefc('0x28'));_0xca6423[_0xaefc('0x30')]=_['keys'](_0x46dda4[_0xaefc('0x30')]);_0xca6423[_0xaefc('0x31')]=_[_0xaefc('0x32')](_0xca6423[_0xaefc('0x2f')],_0xca6423[_0xaefc('0x30')]);_0xafe848['attributes']=_[_0xaefc('0x32')](_0xca6423[_0xaefc('0x2f')],qs[_0xaefc('0x33')](_0x46dda4[_0xaefc('0x30')][_0xaefc('0x33')]));_0xafe848['attributes']=_0xafe848[_0xaefc('0x34')][_0xaefc('0x35')]?_0xafe848['attributes']:_0xca6423['model'];if(!_0x46dda4[_0xaefc('0x30')][_0xaefc('0x36')](_0xaefc('0x37'))){_0xafe848[_0xaefc('0x1e')]=qs['limit'](_0x46dda4[_0xaefc('0x30')][_0xaefc('0x1e')]);_0xafe848[_0xaefc('0x1b')]=qs[_0xaefc('0x1b')](_0x46dda4['query'][_0xaefc('0x1b')]);}_0xafe848[_0xaefc('0x38')]=qs[_0xaefc('0x39')](_0x46dda4[_0xaefc('0x30')]['sort']);_0xafe848[_0xaefc('0x3a')]=qs['filters'](_[_0xaefc('0x3b')](_0x46dda4['query'],_0xca6423[_0xaefc('0x31')]),_0x4d02eb);if(_0x46dda4[_0xaefc('0x30')][_0xaefc('0x3c')]){_0xafe848[_0xaefc('0x3a')]=_['merge'](_0xafe848[_0xaefc('0x3a')],{'$or':_[_0xaefc('0x2b')](_0x4d02eb,function(_0x56c8a7){if(_0x56c8a7['type']!==_0xaefc('0x3d')){var _0x52aa36={};_0x52aa36[_0x56c8a7[_0xaefc('0x28')]]={'$like':'%'+_0x46dda4[_0xaefc('0x30')]['filter']+'%'};return _0x52aa36;}})});}_0xafe848=_[_0xaefc('0x3e')]({},_0xafe848,_0x46dda4[_0xaefc('0x3f')]);var _0x24ff6f={'where':_0xafe848[_0xaefc('0x3a')]};return db[_0xaefc('0x2c')][_0xaefc('0x1d')](_0x24ff6f)['then'](function(_0x54cfcc){_0x2625d3[_0xaefc('0x1d')]=_0x54cfcc;if(_0x46dda4['query'][_0xaefc('0x40')]){_0xafe848[_0xaefc('0x41')]=[{'all':!![]}];}return db[_0xaefc('0x2c')]['findAll'](_0xafe848);})['then'](function(_0x6cacbe){_0x2625d3[_0xaefc('0x42')]=_0x6cacbe;return _0x2625d3;})['then'](respondWithFilteredResult(_0x2256a5,_0xafe848))[_0xaefc('0x43')](handleError(_0x2256a5,null));};exports[_0xaefc('0x44')]=function(_0x9438ee,_0x359f21){var _0x1ec61e={'raw':!![],'where':{'id':_0x9438ee['params']['id']}},_0x291140={};_0x291140['model']=_[_0xaefc('0x45')](db[_0xaefc('0x2c')][_0xaefc('0x46')]);_0x291140[_0xaefc('0x30')]=_[_0xaefc('0x45')](_0x9438ee['query']);_0x291140[_0xaefc('0x31')]=_['intersection'](_0x291140[_0xaefc('0x2f')],_0x291140[_0xaefc('0x30')]);_0x1ec61e[_0xaefc('0x34')]=_[_0xaefc('0x32')](_0x291140[_0xaefc('0x2f')],qs[_0xaefc('0x33')](_0x9438ee[_0xaefc('0x30')]['fields']));_0x1ec61e[_0xaefc('0x34')]=_0x1ec61e[_0xaefc('0x34')]['length']?_0x1ec61e[_0xaefc('0x34')]:_0x291140[_0xaefc('0x2f')];if(_0x9438ee[_0xaefc('0x30')]['includeAll']){_0x1ec61e[_0xaefc('0x41')]=[{'all':!![]}];}_0x1ec61e=_[_0xaefc('0x3e')]({},_0x1ec61e,_0x9438ee[_0xaefc('0x3f')]);return db[_0xaefc('0x2c')][_0xaefc('0x47')](_0x1ec61e)[_0xaefc('0x25')](handleEntityNotFound(_0x359f21,null))['then'](respondWithResult(_0x359f21,null))[_0xaefc('0x43')](handleError(_0x359f21,null));};exports[_0xaefc('0x48')]=function(_0x239672,_0xc64d7c){return db[_0xaefc('0x2c')][_0xaefc('0x48')](_0x239672[_0xaefc('0x49')],{})['then'](respondWithResult(_0xc64d7c,0xc9))[_0xaefc('0x43')](handleError(_0xc64d7c,null));};exports['update']=function(_0x4fd027,_0x3995be){if(_0x4fd027[_0xaefc('0x49')]['id']){delete _0x4fd027[_0xaefc('0x49')]['id'];}return db[_0xaefc('0x2c')][_0xaefc('0x47')]({'where':{'id':_0x4fd027[_0xaefc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3995be,null))[_0xaefc('0x25')](saveUpdates(_0x4fd027[_0xaefc('0x49')],null))['then'](respondWithResult(_0x3995be,null))[_0xaefc('0x43')](handleError(_0x3995be,null));};exports[_0xaefc('0x26')]=function(_0x110ceb,_0x38b52a){return db[_0xaefc('0x2c')]['find']({'where':{'id':_0x110ceb[_0xaefc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x38b52a,null))[_0xaefc('0x25')](removeEntity(_0x38b52a,null))[_0xaefc('0x43')](handleError(_0x38b52a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6373159..1e1ac9c 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 _0xad5b=['api','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x5b82ad,_0x2fa626){var _0x30b7c7=function(_0x33009a){while(--_0x33009a){_0x5b82ad['push'](_0x5b82ad['shift']());}};_0x30b7c7(++_0x2fa626);}(_0xad5b,0x169));var _0xbad5=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xad5b[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0xbad5('0x0'));var util=require(_0xbad5('0x1'));var logger=require(_0xbad5('0x2'))(_0xbad5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbad5('0x4'));var fs=require('fs');var path=require(_0xbad5('0x5'));var rimraf=require(_0xbad5('0x6'));var config=require(_0xbad5('0x7'));var attributes=require(_0xbad5('0x8'));module[_0xbad5('0x9')]=function(_0x4bc814,_0x280683){return _0x4bc814[_0xbad5('0xa')](_0xbad5('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xbad5('0xc'),'fields':['idField',_0xbad5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe8bb=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','idField','FieldId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe8bb,0xa8));var _0xbe8b=function(_0x2e50bf,_0x329ed1){_0x2e50bf=_0x2e50bf-0x0;var _0x33ebd7=_0xe8bb[_0x2e50bf];return _0x33ebd7;};'use strict';var _=require(_0xbe8b('0x0'));var util=require(_0xbe8b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe8b('0x2'));var BPromise=require(_0xbe8b('0x3'));var rp=require(_0xbe8b('0x4'));var fs=require('fs');var path=require(_0xbe8b('0x5'));var rimraf=require(_0xbe8b('0x6'));var config=require(_0xbe8b('0x7'));var attributes=require(_0xbe8b('0x8'));module['exports']=function(_0x4f110d,_0x1fa955){return _0x4f110d[_0xbe8b('0x9')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xbe8b('0xa'),_0xbe8b('0xb')],'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 d89f11c..3d243ce 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 _0x4d16=['../../config/environment','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x590935,_0x2c29d9){var _0x1299f7=function(_0x48d224){while(--_0x48d224){_0x590935['push'](_0x590935['shift']());}};_0x1299f7(++_0x2c29d9);}(_0x4d16,0x16e));var _0x64d1=function(_0x2b4f1d,_0xf407c4){_0x2b4f1d=_0x2b4f1d-0x0;var _0xe25124=_0x4d16[_0x2b4f1d];return _0xe25124;};'use strict';var _=require(_0x64d1('0x0'));var util=require('util');var moment=require(_0x64d1('0x1'));var BPromise=require(_0x64d1('0x2'));var rs=require(_0x64d1('0x3'));var fs=require('fs');var Redis=require(_0x64d1('0x4'));var db=require(_0x64d1('0x5'))['db'];var utils=require(_0x64d1('0x6'));var logger=require(_0x64d1('0x7'))(_0x64d1('0x8'));var config=require(_0x64d1('0x9'));var jayson=require(_0x64d1('0xa'));var client=jayson[_0x64d1('0xb')][_0x64d1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58d734,_0x329f0c,_0x302c10){return new BPromise(function(_0x55a57b,_0x153f52){return client[_0x64d1('0xd')](_0x58d734,_0x302c10)[_0x64d1('0xe')](function(_0x57e9d8){logger['info'](_0x64d1('0xf'),_0x329f0c,_0x64d1('0x10'));logger[_0x64d1('0x11')](_0x64d1('0x12'),_0x329f0c,_0x64d1('0x10'),JSON[_0x64d1('0x13')](_0x57e9d8));if(_0x57e9d8[_0x64d1('0x14')]){if(_0x57e9d8[_0x64d1('0x14')][_0x64d1('0x15')]===0x1f4){logger[_0x64d1('0x14')](_0x64d1('0xf'),_0x329f0c,_0x57e9d8[_0x64d1('0x14')][_0x64d1('0x16')]);return _0x153f52(_0x57e9d8[_0x64d1('0x14')][_0x64d1('0x16')]);}logger[_0x64d1('0x14')](_0x64d1('0xf'),_0x329f0c,_0x57e9d8[_0x64d1('0x14')][_0x64d1('0x16')]);return _0x55a57b(_0x57e9d8[_0x64d1('0x14')][_0x64d1('0x16')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x329f0c,_0x64d1('0x10'));_0x55a57b(_0x57e9d8[_0x64d1('0x17')][_0x64d1('0x16')]);}})[_0x64d1('0x18')](function(_0x46e4e2){logger[_0x64d1('0x14')](_0x64d1('0xf'),_0x329f0c,_0x46e4e2);_0x153f52(_0x46e4e2);});});} \ No newline at end of file +var _0x4b4a=['debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x4b4a,0xe3));var _0xa4b4=function(_0x53785b,_0x14b386){_0x53785b=_0x53785b-0x0;var _0x2ae6da=_0x4b4a[_0x53785b];return _0x2ae6da;};'use strict';var _=require(_0xa4b4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa4b4('0x1'));var rs=require(_0xa4b4('0x2'));var fs=require('fs');var Redis=require(_0xa4b4('0x3'));var db=require(_0xa4b4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4b4('0x5'))(_0xa4b4('0x6'));var config=require(_0xa4b4('0x7'));var jayson=require(_0xa4b4('0x8'));var client=jayson[_0xa4b4('0x9')][_0xa4b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3da9ff,_0x20cf47,_0x15233a){return new BPromise(function(_0x3b449f,_0x3a0c70){return client[_0xa4b4('0xb')](_0x3da9ff,_0x15233a)['then'](function(_0x66ab7d){logger[_0xa4b4('0xc')](_0xa4b4('0xd'),_0x20cf47,_0xa4b4('0xe'));logger[_0xa4b4('0xf')](_0xa4b4('0x10'),_0x20cf47,'request\x20sent',JSON[_0xa4b4('0x11')](_0x66ab7d));if(_0x66ab7d[_0xa4b4('0x12')]){if(_0x66ab7d[_0xa4b4('0x12')][_0xa4b4('0x13')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x20cf47,_0x66ab7d[_0xa4b4('0x12')][_0xa4b4('0x14')]);return _0x3a0c70(_0x66ab7d['error'][_0xa4b4('0x14')]);}logger['error'](_0xa4b4('0xd'),_0x20cf47,_0x66ab7d[_0xa4b4('0x12')]['message']);return _0x3b449f(_0x66ab7d[_0xa4b4('0x12')][_0xa4b4('0x14')]);}else{logger[_0xa4b4('0xc')](_0xa4b4('0xd'),_0x20cf47,_0xa4b4('0xe'));_0x3b449f(_0x66ab7d[_0xa4b4('0x15')][_0xa4b4('0x14')]);}})['catch'](function(_0x140e2e){logger[_0xa4b4('0x12')](_0xa4b4('0xd'),_0x20cf47,_0x140e2e);_0x3a0c70(_0x140e2e);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 9780c2f..a5d953e 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 _0x24fe=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','exports'];(function(_0x5cd4aa,_0x57a6c8){var _0x4d10cf=function(_0x432b23){while(--_0x432b23){_0x5cd4aa['push'](_0x5cd4aa['shift']());}};_0x4d10cf(++_0x57a6c8);}(_0x24fe,0x1b8));var _0xe24f=function(_0x5b9147,_0x2232e9){_0x5b9147=_0x5b9147-0x0;var _0x682c88=_0x24fe[_0x5b9147];return _0x682c88;};'use strict';var multer=require(_0xe24f('0x0'));var util=require('util');var path=require(_0xe24f('0x1'));var timeout=require(_0xe24f('0x2'));var express=require(_0xe24f('0x3'));var router=express[_0xe24f('0x4')]();var fs_extra=require(_0xe24f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe24f('0x6'));var config=require(_0xe24f('0x7'));var controller=require('./intVtigerAccount.controller');router[_0xe24f('0x8')]('/',auth[_0xe24f('0x9')](),controller[_0xe24f('0xa')]);router[_0xe24f('0x8')](_0xe24f('0xb'),auth[_0xe24f('0x9')](),controller[_0xe24f('0xc')]);router[_0xe24f('0x8')](_0xe24f('0xd'),auth[_0xe24f('0x9')](),controller[_0xe24f('0xe')]);router['get'](_0xe24f('0xf'),auth[_0xe24f('0x9')](),controller['getFields']);router[_0xe24f('0x10')]('/',auth[_0xe24f('0x9')](),controller['create']);router['post'](_0xe24f('0xd'),auth[_0xe24f('0x9')](),controller[_0xe24f('0x11')]);router[_0xe24f('0x12')](_0xe24f('0xb'),auth[_0xe24f('0x9')](),controller[_0xe24f('0x13')]);router[_0xe24f('0x14')](_0xe24f('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xe24f('0x15')]=router; \ No newline at end of file +var _0x34f8=['express','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x34f8,0x80));var _0x834f=function(_0x5f47ae,_0x598e64){_0x5f47ae=_0x5f47ae-0x0;var _0x5d57fa=_0x34f8[_0x5f47ae];return _0x5d57fa;};'use strict';var multer=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var path=require(_0x834f('0x2'));var timeout=require(_0x834f('0x3'));var express=require(_0x834f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x834f('0x5'));var interaction=require(_0x834f('0x6'));var config=require('../../config/environment');var controller=require(_0x834f('0x7'));router[_0x834f('0x8')]('/',auth[_0x834f('0x9')](),controller[_0x834f('0xa')]);router['get']('/:id',auth[_0x834f('0x9')](),controller[_0x834f('0xb')]);router[_0x834f('0x8')](_0x834f('0xc'),auth['isAuthenticated'](),controller[_0x834f('0xd')]);router[_0x834f('0x8')]('/:id/fields',auth[_0x834f('0x9')](),controller[_0x834f('0xe')]);router[_0x834f('0xf')]('/',auth[_0x834f('0x9')](),controller[_0x834f('0x10')]);router[_0x834f('0xf')](_0x834f('0xc'),auth[_0x834f('0x9')](),controller['addConfiguration']);router[_0x834f('0x11')](_0x834f('0x12'),auth[_0x834f('0x9')](),controller[_0x834f('0x13')]);router[_0x834f('0x14')]('/:id',auth[_0x834f('0x9')](),controller[_0x834f('0x15')]);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 5556a2e..edf1748 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 _0x5806=['HelpDesk','sequelize','exports','STRING'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5806,0x1bd));var _0x6580=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0x5806[_0x2d982d];return _0x4f36b0;};'use strict';var Sequelize=require(_0x6580('0x0'));module[_0x6580('0x1')]={'name':{'type':Sequelize[_0x6580('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6580('0x2')]},'username':{'type':Sequelize[_0x6580('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6580('0x2')],'allowNull':![],'defaultValue':_0x6580('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa01b=['exports','STRING','HelpDesk','sequelize'];(function(_0x2dacb3,_0xc6e106){var _0x1fcdfb=function(_0x3bf2b3){while(--_0x3bf2b3){_0x2dacb3['push'](_0x2dacb3['shift']());}};_0x1fcdfb(++_0xc6e106);}(_0xa01b,0xe3));var _0xba01=function(_0x131294,_0x76d696){_0x131294=_0x131294-0x0;var _0x9f454a=_0xa01b[_0x131294];return _0x9f454a;};'use strict';var Sequelize=require(_0xba01('0x0'));module[_0xba01('0x1')]={'name':{'type':Sequelize[_0xba01('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xba01('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xba01('0x2')],'allowNull':![],'defaultValue':_0xba01('0x3')},'remoteUri':{'type':Sequelize[_0xba01('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xba01('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 6b9f909..b0497ef 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 _0xae8b=['editable','false','label','startsWith','cf_','picklist','picklistValues','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','save','then','error','stack','name','send','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','map','VIRTUAL','merge','options','include','VtigerAccount','findAll','rows','catch','params','find','create','body','update','destroy','getConfigurations','VtigerConfiguration','rawAttributes','order','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','VtigerField','md5','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','lastIndexOf','format','%s/webservice.php','success','login','result','token','GET','describe','sessionName','autogenerated','owner','remove','includes'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xae8b,0x100));var _0xbae8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xae8b[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xbae8('0x0'));var rimraf=require(_0xbae8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbae8('0x2'));var moment=require(_0xbae8('0x3'));var BPromise=require(_0xbae8('0x4'));var Mustache=require(_0xbae8('0x5'));var util=require('util');var path=require(_0xbae8('0x6'));var sox=require(_0xbae8('0x7'));var csv=require(_0xbae8('0x8'));var ejs=require(_0xbae8('0x9'));var fs=require('fs');var fs_extra=require(_0xbae8('0xa'));var _=require(_0xbae8('0xb'));var squel=require('squel');var crypto=require(_0xbae8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbae8('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbae8('0xe'));var Redis=require(_0xbae8('0xf'));var authService=require(_0xbae8('0x10'));var qs=require(_0xbae8('0x11'));var as=require(_0xbae8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbae8('0x13'));var utils=require(_0xbae8('0x14'));var config=require(_0xbae8('0x15'));var licenseUtil=require(_0xbae8('0x16'));var db=require(_0xbae8('0x17'))['db'];var integrations=require(_0xbae8('0x18'));function respondWithStatusCode(_0x1bb505,_0x13230a){_0x13230a=_0x13230a||0xcc;return function(_0x4c268f){if(_0x4c268f){return _0x1bb505[_0xbae8('0x19')](_0x13230a);}return _0x1bb505['status'](_0x13230a)[_0xbae8('0x1a')]();};}function respondWithResult(_0x1ae87f,_0x25f21e){_0x25f21e=_0x25f21e||0xc8;return function(_0x1b4b86){if(_0x1b4b86){return _0x1ae87f[_0xbae8('0x1b')](_0x25f21e)[_0xbae8('0x1c')](_0x1b4b86);}};}function respondWithFilteredResult(_0x13e5b9,_0x44e854){return function(_0x153ebb){if(_0x153ebb){var _0x4af275=typeof _0x44e854[_0xbae8('0x1d')]==='undefined'&&typeof _0x44e854['limit']===_0xbae8('0x1e');var _0x5e02e1=_0x153ebb[_0xbae8('0x1f')];var _0x38aceb=_0x4af275?0x0:_0x44e854[_0xbae8('0x1d')];var _0x5479cf=_0x4af275?_0x153ebb[_0xbae8('0x1f')]:_0x44e854[_0xbae8('0x1d')]+_0x44e854[_0xbae8('0x20')];var _0x4240ef;if(_0x5479cf>=_0x5e02e1){_0x5479cf=_0x5e02e1;_0x4240ef=0xc8;}else{_0x4240ef=0xce;}_0x13e5b9['status'](_0x4240ef);return _0x13e5b9[_0xbae8('0x21')](_0xbae8('0x22'),_0x38aceb+'-'+_0x5479cf+'/'+_0x5e02e1)[_0xbae8('0x1c')](_0x153ebb);}return null;};}function patchUpdates(_0x318412){return function(_0x5c8014){try{jsonpatch['apply'](_0x5c8014,_0x318412,!![]);}catch(_0x519ffb){return BPromise['reject'](_0x519ffb);}return _0x5c8014[_0xbae8('0x23')]();};}function saveUpdates(_0x449b2b,_0x2dd636){return function(_0x27dcf4){if(_0x27dcf4){return _0x27dcf4['update'](_0x449b2b)['then'](function(_0x678ec6){return _0x678ec6;});}return null;};}function removeEntity(_0x12b931,_0x2ad268){return function(_0x3428fd){if(_0x3428fd){return _0x3428fd['destroy']()[_0xbae8('0x24')](function(){_0x12b931['status'](0xcc)[_0xbae8('0x1a')]();});}};}function handleEntityNotFound(_0x584b47,_0x2f908a){return function(_0x91010f){if(!_0x91010f){_0x584b47['sendStatus'](0x194);}return _0x91010f;};}function handleError(_0x8fb501,_0x1dcb1a){_0x1dcb1a=_0x1dcb1a||0x1f4;return function(_0x314a7a){logger[_0xbae8('0x25')](_0x314a7a[_0xbae8('0x26')]);if(_0x314a7a[_0xbae8('0x27')]){delete _0x314a7a[_0xbae8('0x27')];}_0x8fb501[_0xbae8('0x1b')](_0x1dcb1a)[_0xbae8('0x28')](_0x314a7a);};}exports['index']=function(_0x218629,_0x33f144){var _0x254022={},_0x575d79={},_0x57a8f0={'count':0x0,'rows':[]};var _0x207990=_['map'](db['VtigerAccount']['rawAttributes'],function(_0x3a8969){return{'name':_0x3a8969[_0xbae8('0x29')],'type':_0x3a8969[_0xbae8('0x2a')][_0xbae8('0x2b')]};});_0x575d79[_0xbae8('0x2c')]=_['map'](_0x207990,'name');_0x575d79[_0xbae8('0x2d')]=_[_0xbae8('0x2e')](_0x218629['query']);_0x575d79['filters']=_[_0xbae8('0x2f')](_0x575d79[_0xbae8('0x2c')],_0x575d79[_0xbae8('0x2d')]);_0x254022[_0xbae8('0x30')]=_[_0xbae8('0x2f')](_0x575d79[_0xbae8('0x2c')],qs['fields'](_0x218629['query'][_0xbae8('0x31')]));_0x254022[_0xbae8('0x30')]=_0x254022[_0xbae8('0x30')][_0xbae8('0x32')]?_0x254022[_0xbae8('0x30')]:_0x575d79[_0xbae8('0x2c')];if(!_0x218629[_0xbae8('0x2d')][_0xbae8('0x33')](_0xbae8('0x34'))){_0x254022[_0xbae8('0x20')]=qs['limit'](_0x218629[_0xbae8('0x2d')][_0xbae8('0x20')]);_0x254022[_0xbae8('0x1d')]=qs[_0xbae8('0x1d')](_0x218629[_0xbae8('0x2d')][_0xbae8('0x1d')]);}_0x254022['order']=qs[_0xbae8('0x35')](_0x218629[_0xbae8('0x2d')][_0xbae8('0x35')]);_0x254022['where']=qs[_0xbae8('0x36')](_['pick'](_0x218629[_0xbae8('0x2d')],_0x575d79[_0xbae8('0x36')]),_0x207990);if(_0x218629[_0xbae8('0x2d')][_0xbae8('0x37')]){_0x254022[_0xbae8('0x38')]=_['merge'](_0x254022['where'],{'$or':_[_0xbae8('0x39')](_0x207990,function(_0x3142f8){if(_0x3142f8[_0xbae8('0x2a')]!==_0xbae8('0x3a')){var _0x5995ee={};_0x5995ee[_0x3142f8[_0xbae8('0x27')]]={'$like':'%'+_0x218629[_0xbae8('0x2d')][_0xbae8('0x37')]+'%'};return _0x5995ee;}})});}_0x254022=_[_0xbae8('0x3b')]({},_0x254022,_0x218629[_0xbae8('0x3c')]);var _0x5ef5e6={'where':_0x254022[_0xbae8('0x38')]};return db['VtigerAccount'][_0xbae8('0x1f')](_0x5ef5e6)[_0xbae8('0x24')](function(_0x4c408a){_0x57a8f0[_0xbae8('0x1f')]=_0x4c408a;if(_0x218629[_0xbae8('0x2d')]['includeAll']){_0x254022[_0xbae8('0x3d')]=[{'all':!![]}];}return db[_0xbae8('0x3e')][_0xbae8('0x3f')](_0x254022);})[_0xbae8('0x24')](function(_0x3bd363){_0x57a8f0[_0xbae8('0x40')]=_0x3bd363;return _0x57a8f0;})[_0xbae8('0x24')](respondWithFilteredResult(_0x33f144,_0x254022))[_0xbae8('0x41')](handleError(_0x33f144,null));};exports['show']=function(_0x396775,_0x112586){var _0x874310={'raw':![],'where':{'id':_0x396775[_0xbae8('0x42')]['id']}},_0x4379a3={};_0x4379a3[_0xbae8('0x2c')]=_[_0xbae8('0x2e')](db[_0xbae8('0x3e')]['rawAttributes']);_0x4379a3[_0xbae8('0x2d')]=_[_0xbae8('0x2e')](_0x396775['query']);_0x4379a3[_0xbae8('0x36')]=_[_0xbae8('0x2f')](_0x4379a3[_0xbae8('0x2c')],_0x4379a3['query']);_0x874310['attributes']=_[_0xbae8('0x2f')](_0x4379a3[_0xbae8('0x2c')],qs[_0xbae8('0x31')](_0x396775[_0xbae8('0x2d')][_0xbae8('0x31')]));_0x874310['attributes']=_0x874310['attributes'][_0xbae8('0x32')]?_0x874310[_0xbae8('0x30')]:_0x4379a3[_0xbae8('0x2c')];if(_0x396775[_0xbae8('0x2d')]['includeAll']){_0x874310['include']=[{'all':!![]}];}_0x874310=_[_0xbae8('0x3b')]({},_0x874310,_0x396775[_0xbae8('0x3c')]);return db[_0xbae8('0x3e')][_0xbae8('0x43')](_0x874310)[_0xbae8('0x24')](handleEntityNotFound(_0x112586,null))[_0xbae8('0x24')](respondWithResult(_0x112586,null))[_0xbae8('0x41')](handleError(_0x112586,null));};exports[_0xbae8('0x44')]=function(_0x47b0ce,_0x46919d){return db[_0xbae8('0x3e')][_0xbae8('0x44')](_0x47b0ce[_0xbae8('0x45')],{})['then'](respondWithResult(_0x46919d,0xc9))['catch'](handleError(_0x46919d,null));};exports[_0xbae8('0x46')]=function(_0x274bba,_0x2c778e){if(_0x274bba['body']['id']){delete _0x274bba[_0xbae8('0x45')]['id'];}return db[_0xbae8('0x3e')][_0xbae8('0x43')]({'where':{'id':_0x274bba[_0xbae8('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c778e,null))[_0xbae8('0x24')](saveUpdates(_0x274bba['body'],null))[_0xbae8('0x24')](respondWithResult(_0x2c778e,null))[_0xbae8('0x41')](handleError(_0x2c778e,null));};exports[_0xbae8('0x47')]=function(_0x68fe21,_0x1efd8b){return db[_0xbae8('0x3e')][_0xbae8('0x43')]({'where':{'id':_0x68fe21['params']['id']}})['then'](handleEntityNotFound(_0x1efd8b,null))['then'](removeEntity(_0x1efd8b,null))[_0xbae8('0x41')](handleError(_0x1efd8b,null));};exports[_0xbae8('0x48')]=function(_0x3c7087,_0x516d8d,_0x5307ae){var _0xdde05={};var _0x4d2903={};var _0x334481;var _0x21541e;return db[_0xbae8('0x3e')]['findOne']({'where':{'id':_0x3c7087[_0xbae8('0x42')]['id']}})[_0xbae8('0x24')](handleEntityNotFound(_0x516d8d,null))['then'](function(_0x18b430){if(_0x18b430){_0x334481=_0x18b430;_0x4d2903[_0xbae8('0x2c')]=_[_0xbae8('0x2e')](db[_0xbae8('0x49')][_0xbae8('0x4a')]);_0x4d2903[_0xbae8('0x2d')]=_['keys'](_0x3c7087['query']);_0x4d2903[_0xbae8('0x36')]=_[_0xbae8('0x2f')](_0x4d2903[_0xbae8('0x2c')],_0x4d2903['query']);_0xdde05['attributes']=_[_0xbae8('0x2f')](_0x4d2903[_0xbae8('0x2c')],qs[_0xbae8('0x31')](_0x3c7087[_0xbae8('0x2d')][_0xbae8('0x31')]));_0xdde05['attributes']=_0xdde05['attributes'][_0xbae8('0x32')]?_0xdde05[_0xbae8('0x30')]:_0x4d2903[_0xbae8('0x2c')];_0xdde05[_0xbae8('0x4b')]=qs[_0xbae8('0x35')](_0x3c7087['query']['sort']);_0xdde05[_0xbae8('0x38')]=qs['filters'](_[_0xbae8('0x4c')](_0x3c7087[_0xbae8('0x2d')],_0x4d2903[_0xbae8('0x36')]));if(_0x3c7087['query'][_0xbae8('0x37')]){_0xdde05['where']=_[_0xbae8('0x3b')](_0xdde05[_0xbae8('0x38')],{'$or':_[_0xbae8('0x39')](_0xdde05[_0xbae8('0x30')],function(_0x38095f){var _0x4f2232={};_0x4f2232[_0x38095f]={'$like':'%'+_0x3c7087[_0xbae8('0x2d')][_0xbae8('0x37')]+'%'};return _0x4f2232;})});}_0xdde05=_[_0xbae8('0x3b')]({},_0xdde05,_0x3c7087['options']);return _0x334481[_0xbae8('0x48')](_0xdde05);}})[_0xbae8('0x24')](function(_0x6ea060){if(_0x6ea060){_0x21541e=_0x6ea060['length'];if(!_0x3c7087['query'][_0xbae8('0x33')](_0xbae8('0x34'))){_0xdde05[_0xbae8('0x20')]=qs[_0xbae8('0x20')](_0x3c7087[_0xbae8('0x2d')][_0xbae8('0x20')]);_0xdde05[_0xbae8('0x1d')]=qs['offset'](_0x3c7087[_0xbae8('0x2d')][_0xbae8('0x1d')]);}return _0x334481[_0xbae8('0x48')](_0xdde05);}})['then'](function(_0x5bb279){if(_0x5bb279){return _0x5bb279?{'count':_0x21541e,'rows':_0x5bb279}:null;}})['then'](respondWithResult(_0x516d8d,null))[_0xbae8('0x41')](handleError(_0x516d8d,null));};exports[_0xbae8('0x4d')]=function(_0x37091a,_0x36042b,_0x391dd4){if(_0x37091a[_0xbae8('0x45')]['id']){delete _0x37091a[_0xbae8('0x45')]['id'];}return db[_0xbae8('0x3e')][_0xbae8('0x4e')]({'where':{'id':_0x37091a[_0xbae8('0x42')]['id']}})[_0xbae8('0x24')](handleEntityNotFound(_0x36042b,null))[_0xbae8('0x24')](function(_0x317519){if(_0x317519){_0x37091a[_0xbae8('0x45')][_0xbae8('0x4f')]=_0x317519['id'];_0x37091a[_0xbae8('0x45')][_0xbae8('0x50')]=integrations[_0xbae8('0x51')](_0x37091a[_0xbae8('0x45')]['channel'],_0x37091a[_0xbae8('0x45')]['type']);_0x37091a[_0xbae8('0x45')]['Descriptions']=integrations[_0xbae8('0x52')](_0x37091a[_0xbae8('0x45')][_0xbae8('0x53')],_0x37091a[_0xbae8('0x45')][_0xbae8('0x2a')]);return db['VtigerConfiguration'][_0xbae8('0x44')](_0x37091a['body'],{'include':[{'model':db['VtigerField'],'as':_0xbae8('0x50')},{'model':db[_0xbae8('0x54')],'as':'Descriptions'}]});}return null;})[_0xbae8('0x24')](respondWithResult(_0x36042b,null))[_0xbae8('0x41')](handleError(_0x36042b,null));};var md5=require(_0xbae8('0x55'));exports['getFields']=function(_0x1290a7,_0x19eb5e,_0x162ed6){var _0xff966a=null;var _0x107b30=null;var _0x44562d=null;var _0x20c450=null;var _0x13f025='';return db[_0xbae8('0x3e')][_0xbae8('0x4e')]({'where':{'id':_0x1290a7[_0xbae8('0x42')]['id']},'attributes':['id','name',_0xbae8('0x56'),_0xbae8('0x57'),_0xbae8('0x58'),'remoteUri',_0xbae8('0x59'),_0xbae8('0x5a')]})[_0xbae8('0x24')](handleEntityNotFound(_0x19eb5e,null))['then'](function(_0x3ed6a5){if(_0x3ed6a5){_0xff966a=_0x3ed6a5[_0xbae8('0x56')];_0x107b30=_0x3ed6a5[_0xbae8('0x5a')];_0x44562d=_0x3ed6a5[_0xbae8('0x58')];_0x13f025=_0x3ed6a5[_0xbae8('0x5b')];var _0x273ef6=_0x13f025[_0xbae8('0x5c')](-0x1);if(_0x273ef6==='/'){_0x13f025=_0x13f025['substring'](0x0,_0x13f025[_0xbae8('0x5d')](_0x273ef6));}_0x20c450=util[_0xbae8('0x5e')](_0xbae8('0x5f'),_0x13f025);var _0x16e192={'method':'GET','uri':_0x20c450,'qs':{'operation':'getchallenge','username':_0x3ed6a5[_0xbae8('0x56')]},'json':!![]};return rp(_0x16e192);}})[_0xbae8('0x24')](function(_0x18d8a1){if(_0x18d8a1[_0xbae8('0x60')]){var _0x146673={'method':'POST','uri':_0x20c450,'form':{'operation':_0xbae8('0x61'),'username':_0xff966a,'accessKey':md5(_0x18d8a1[_0xbae8('0x62')][_0xbae8('0x63')]+_0x107b30)},'json':!![]};return rp(_0x146673);}})[_0xbae8('0x24')](function(_0x18fe55){if(_0x18fe55['success']){var _0x276578={'method':_0xbae8('0x64'),'uri':_0x20c450,'qs':{'operation':_0xbae8('0x65'),'username':_0xff966a,'sessionName':_0x18fe55['result'][_0xbae8('0x66')],'elementType':_0x44562d},'json':!![]};return rp(_0x276578);}})[_0xbae8('0x24')](function(_0x143150){if(_0x143150[_0xbae8('0x60')]){var _0x5206b5=[_0xbae8('0x67'),'reference',_0xbae8('0x68')];_[_0xbae8('0x69')](_0x143150[_0xbae8('0x62')][_0xbae8('0x31')],function(_0x2087dd){return _0x5206b5[_0xbae8('0x6a')](_0x2087dd[_0xbae8('0x2a')][_0xbae8('0x27')]);});_[_0xbae8('0x69')](_0x143150['result'][_0xbae8('0x31')],function(_0x244cf0){return _0x244cf0[_0xbae8('0x6b')]===_0xbae8('0x6c');});return{'count':_0x143150['result'][_0xbae8('0x31')]['length'],'rows':_[_0xbae8('0x39')](_0x143150[_0xbae8('0x62')][_0xbae8('0x31')],function(_0x15e259){return{'id':_0x15e259[_0xbae8('0x27')],'name':_0x15e259[_0xbae8('0x6d')],'custom':_[_0xbae8('0x6e')](_0x15e259[_0xbae8('0x27')],_0xbae8('0x6f'))?!![]:![],'options':_0x15e259[_0xbae8('0x2a')]['name']===_0xbae8('0x70')&&_0x15e259[_0xbae8('0x2a')]['picklistValues'][_0xbae8('0x32')]>0x0?_['map'](_0x15e259[_0xbae8('0x2a')][_0xbae8('0x71')],function(_0x78bafe){return{'name':_0x78bafe['label'],'value':_0x78bafe['value']};}):[]};})};}})[_0xbae8('0x24')](respondWithResult(_0x19eb5e,null))[_0xbae8('0x41')](function(_0x54cd03){console['log'](_0xbae8('0x72')+_0x54cd03);var _0x5b050f=_0x1290a7[_0xbae8('0x2d')]['test']?0x1f4:_0x54cd03[_0xbae8('0x73')]||0x1f4;logger[_0xbae8('0x25')](_0xbae8('0x74'),_0xbae8('0x75'),_0x5b050f,JSON[_0xbae8('0x76')](_0x54cd03));delete _0x54cd03[_0xbae8('0x27')];if(_0x5b050f===0x191){_0x5b050f=0x190;}_0x19eb5e[_0xbae8('0x1b')](_0x5b050f)[_0xbae8('0x28')](_0x1290a7['query'][_0xbae8('0x77')]?{'message':_0xbae8('0x78'),'statusCode':_0x54cd03[_0xbae8('0x73')]}:_0x54cd03);});}; \ No newline at end of file +var _0xff49=['Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','%s/webservice.php','GET','success','POST','result','describe','sessionName','autogenerated','reference','owner','includes','editable','false','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','getConfigurations','findOne','VtigerConfiguration','channel'];(function(_0x1b5f71,_0x68739f){var _0x4833b5=function(_0x532755){while(--_0x532755){_0x1b5f71['push'](_0x1b5f71['shift']());}};_0x4833b5(++_0x68739f);}(_0xff49,0x194));var _0x9ff4=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xff49[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x9ff4('0x0'));var rimraf=require(_0x9ff4('0x1'));var zipdir=require(_0x9ff4('0x2'));var jsonpatch=require(_0x9ff4('0x3'));var rp=require(_0x9ff4('0x4'));var moment=require(_0x9ff4('0x5'));var BPromise=require(_0x9ff4('0x6'));var Mustache=require(_0x9ff4('0x7'));var util=require(_0x9ff4('0x8'));var path=require(_0x9ff4('0x9'));var sox=require(_0x9ff4('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ff4('0xb'));var squel=require(_0x9ff4('0xc'));var crypto=require('crypto');var jsforce=require(_0x9ff4('0xd'));var deskjs=require(_0x9ff4('0xe'));var toCsv=require(_0x9ff4('0xf'));var querystring=require(_0x9ff4('0x10'));var Papa=require(_0x9ff4('0x11'));var Redis=require(_0x9ff4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9ff4('0x13'));var as=require(_0x9ff4('0x14'));var hardwareService=require(_0x9ff4('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x9ff4('0x16'));var config=require(_0x9ff4('0x17'));var licenseUtil=require(_0x9ff4('0x18'));var db=require(_0x9ff4('0x19'))['db'];var integrations=require(_0x9ff4('0x1a'));function respondWithStatusCode(_0x4b08a2,_0x282526){_0x282526=_0x282526||0xcc;return function(_0xee17bc){if(_0xee17bc){return _0x4b08a2[_0x9ff4('0x1b')](_0x282526);}return _0x4b08a2[_0x9ff4('0x1c')](_0x282526)[_0x9ff4('0x1d')]();};}function respondWithResult(_0x55d6a8,_0x3b2237){_0x3b2237=_0x3b2237||0xc8;return function(_0xa68c8){if(_0xa68c8){return _0x55d6a8['status'](_0x3b2237)[_0x9ff4('0x1e')](_0xa68c8);}};}function respondWithFilteredResult(_0x18c6af,_0x2348e9){return function(_0x15b4a1){if(_0x15b4a1){var _0x1334f2=typeof _0x2348e9['offset']===_0x9ff4('0x1f')&&typeof _0x2348e9[_0x9ff4('0x20')]===_0x9ff4('0x1f');var _0x368f84=_0x15b4a1[_0x9ff4('0x21')];var _0xf1f17c=_0x1334f2?0x0:_0x2348e9[_0x9ff4('0x22')];var _0x579591=_0x1334f2?_0x15b4a1['count']:_0x2348e9['offset']+_0x2348e9['limit'];var _0xbfd542;if(_0x579591>=_0x368f84){_0x579591=_0x368f84;_0xbfd542=0xc8;}else{_0xbfd542=0xce;}_0x18c6af[_0x9ff4('0x1c')](_0xbfd542);return _0x18c6af[_0x9ff4('0x23')](_0x9ff4('0x24'),_0xf1f17c+'-'+_0x579591+'/'+_0x368f84)[_0x9ff4('0x1e')](_0x15b4a1);}return null;};}function patchUpdates(_0x3860d4){return function(_0x298251){try{jsonpatch[_0x9ff4('0x25')](_0x298251,_0x3860d4,!![]);}catch(_0x203ff0){return BPromise['reject'](_0x203ff0);}return _0x298251[_0x9ff4('0x26')]();};}function saveUpdates(_0x34e96f,_0x4963de){return function(_0x3c592d){if(_0x3c592d){return _0x3c592d[_0x9ff4('0x27')](_0x34e96f)[_0x9ff4('0x28')](function(_0x2a438e){return _0x2a438e;});}return null;};}function removeEntity(_0x279d06,_0x45a982){return function(_0x3380b4){if(_0x3380b4){return _0x3380b4[_0x9ff4('0x29')]()[_0x9ff4('0x28')](function(){_0x279d06[_0x9ff4('0x1c')](0xcc)[_0x9ff4('0x1d')]();});}};}function handleEntityNotFound(_0x23c3da,_0x384fed){return function(_0x3a9268){if(!_0x3a9268){_0x23c3da[_0x9ff4('0x1b')](0x194);}return _0x3a9268;};}function handleError(_0x422615,_0x4406cf){_0x4406cf=_0x4406cf||0x1f4;return function(_0x4464b3){logger[_0x9ff4('0x2a')](_0x4464b3[_0x9ff4('0x2b')]);if(_0x4464b3[_0x9ff4('0x2c')]){delete _0x4464b3[_0x9ff4('0x2c')];}_0x422615[_0x9ff4('0x1c')](_0x4406cf)[_0x9ff4('0x2d')](_0x4464b3);};}exports[_0x9ff4('0x2e')]=function(_0x8ee1d2,_0x23af58){var _0x578f43={},_0x3bc8ad={},_0x2395d6={'count':0x0,'rows':[]};var _0x1e74cb=_[_0x9ff4('0x2f')](db[_0x9ff4('0x30')][_0x9ff4('0x31')],function(_0x5b4190){return{'name':_0x5b4190[_0x9ff4('0x32')],'type':_0x5b4190[_0x9ff4('0x33')]['key']};});_0x3bc8ad['model']=_[_0x9ff4('0x2f')](_0x1e74cb,_0x9ff4('0x2c'));_0x3bc8ad[_0x9ff4('0x34')]=_[_0x9ff4('0x35')](_0x8ee1d2['query']);_0x3bc8ad[_0x9ff4('0x36')]=_[_0x9ff4('0x37')](_0x3bc8ad[_0x9ff4('0x38')],_0x3bc8ad[_0x9ff4('0x34')]);_0x578f43[_0x9ff4('0x39')]=_['intersection'](_0x3bc8ad[_0x9ff4('0x38')],qs[_0x9ff4('0x3a')](_0x8ee1d2['query'][_0x9ff4('0x3a')]));_0x578f43[_0x9ff4('0x39')]=_0x578f43[_0x9ff4('0x39')][_0x9ff4('0x3b')]?_0x578f43['attributes']:_0x3bc8ad['model'];if(!_0x8ee1d2[_0x9ff4('0x34')][_0x9ff4('0x3c')](_0x9ff4('0x3d'))){_0x578f43[_0x9ff4('0x20')]=qs[_0x9ff4('0x20')](_0x8ee1d2['query']['limit']);_0x578f43['offset']=qs[_0x9ff4('0x22')](_0x8ee1d2[_0x9ff4('0x34')][_0x9ff4('0x22')]);}_0x578f43[_0x9ff4('0x3e')]=qs[_0x9ff4('0x3f')](_0x8ee1d2['query'][_0x9ff4('0x3f')]);_0x578f43[_0x9ff4('0x40')]=qs[_0x9ff4('0x36')](_[_0x9ff4('0x41')](_0x8ee1d2[_0x9ff4('0x34')],_0x3bc8ad[_0x9ff4('0x36')]),_0x1e74cb);if(_0x8ee1d2[_0x9ff4('0x34')][_0x9ff4('0x42')]){_0x578f43[_0x9ff4('0x40')]=_[_0x9ff4('0x43')](_0x578f43['where'],{'$or':_['map'](_0x1e74cb,function(_0x3113a4){if(_0x3113a4['type']!==_0x9ff4('0x44')){var _0x2a5344={};_0x2a5344[_0x3113a4[_0x9ff4('0x2c')]]={'$like':'%'+_0x8ee1d2[_0x9ff4('0x34')]['filter']+'%'};return _0x2a5344;}})});}_0x578f43=_[_0x9ff4('0x43')]({},_0x578f43,_0x8ee1d2[_0x9ff4('0x45')]);var _0x317dcb={'where':_0x578f43[_0x9ff4('0x40')]};return db[_0x9ff4('0x30')]['count'](_0x317dcb)[_0x9ff4('0x28')](function(_0x387080){_0x2395d6[_0x9ff4('0x21')]=_0x387080;if(_0x8ee1d2[_0x9ff4('0x34')][_0x9ff4('0x46')]){_0x578f43[_0x9ff4('0x47')]=[{'all':!![]}];}return db[_0x9ff4('0x30')][_0x9ff4('0x48')](_0x578f43);})[_0x9ff4('0x28')](function(_0x14a981){_0x2395d6[_0x9ff4('0x49')]=_0x14a981;return _0x2395d6;})[_0x9ff4('0x28')](respondWithFilteredResult(_0x23af58,_0x578f43))['catch'](handleError(_0x23af58,null));};exports[_0x9ff4('0x4a')]=function(_0x464d64,_0x3802e4){var _0x6f05c9={'raw':![],'where':{'id':_0x464d64[_0x9ff4('0x4b')]['id']}},_0xc6fdac={};_0xc6fdac[_0x9ff4('0x38')]=_[_0x9ff4('0x35')](db['VtigerAccount'][_0x9ff4('0x31')]);_0xc6fdac['query']=_[_0x9ff4('0x35')](_0x464d64[_0x9ff4('0x34')]);_0xc6fdac[_0x9ff4('0x36')]=_['intersection'](_0xc6fdac['model'],_0xc6fdac[_0x9ff4('0x34')]);_0x6f05c9[_0x9ff4('0x39')]=_[_0x9ff4('0x37')](_0xc6fdac[_0x9ff4('0x38')],qs[_0x9ff4('0x3a')](_0x464d64['query'][_0x9ff4('0x3a')]));_0x6f05c9[_0x9ff4('0x39')]=_0x6f05c9[_0x9ff4('0x39')][_0x9ff4('0x3b')]?_0x6f05c9[_0x9ff4('0x39')]:_0xc6fdac[_0x9ff4('0x38')];if(_0x464d64[_0x9ff4('0x34')][_0x9ff4('0x46')]){_0x6f05c9[_0x9ff4('0x47')]=[{'all':!![]}];}_0x6f05c9=_[_0x9ff4('0x43')]({},_0x6f05c9,_0x464d64[_0x9ff4('0x45')]);return db[_0x9ff4('0x30')][_0x9ff4('0x4c')](_0x6f05c9)[_0x9ff4('0x28')](handleEntityNotFound(_0x3802e4,null))[_0x9ff4('0x28')](respondWithResult(_0x3802e4,null))['catch'](handleError(_0x3802e4,null));};exports[_0x9ff4('0x4d')]=function(_0x98f4ea,_0x3c384e){return db[_0x9ff4('0x30')]['create'](_0x98f4ea[_0x9ff4('0x4e')],{})['then'](respondWithResult(_0x3c384e,0xc9))[_0x9ff4('0x4f')](handleError(_0x3c384e,null));};exports[_0x9ff4('0x27')]=function(_0x50cf6b,_0x1e28ef){if(_0x50cf6b[_0x9ff4('0x4e')]['id']){delete _0x50cf6b[_0x9ff4('0x4e')]['id'];}return db['VtigerAccount'][_0x9ff4('0x4c')]({'where':{'id':_0x50cf6b[_0x9ff4('0x4b')]['id']}})[_0x9ff4('0x28')](handleEntityNotFound(_0x1e28ef,null))[_0x9ff4('0x28')](saveUpdates(_0x50cf6b[_0x9ff4('0x4e')],null))[_0x9ff4('0x28')](respondWithResult(_0x1e28ef,null))[_0x9ff4('0x4f')](handleError(_0x1e28ef,null));};exports[_0x9ff4('0x29')]=function(_0x56ee1d,_0x59d203){return db[_0x9ff4('0x30')][_0x9ff4('0x4c')]({'where':{'id':_0x56ee1d[_0x9ff4('0x4b')]['id']}})[_0x9ff4('0x28')](handleEntityNotFound(_0x59d203,null))[_0x9ff4('0x28')](removeEntity(_0x59d203,null))['catch'](handleError(_0x59d203,null));};exports[_0x9ff4('0x50')]=function(_0x54c7bb,_0x461d16,_0x4ea966){var _0x19eb24={};var _0x5157d={};var _0x18403f;var _0x320d0f;return db[_0x9ff4('0x30')][_0x9ff4('0x51')]({'where':{'id':_0x54c7bb['params']['id']}})[_0x9ff4('0x28')](handleEntityNotFound(_0x461d16,null))[_0x9ff4('0x28')](function(_0x25a623){if(_0x25a623){_0x18403f=_0x25a623;_0x5157d[_0x9ff4('0x38')]=_[_0x9ff4('0x35')](db[_0x9ff4('0x52')][_0x9ff4('0x31')]);_0x5157d[_0x9ff4('0x34')]=_[_0x9ff4('0x35')](_0x54c7bb['query']);_0x5157d[_0x9ff4('0x36')]=_[_0x9ff4('0x37')](_0x5157d['model'],_0x5157d[_0x9ff4('0x34')]);_0x19eb24[_0x9ff4('0x39')]=_['intersection'](_0x5157d[_0x9ff4('0x38')],qs[_0x9ff4('0x3a')](_0x54c7bb[_0x9ff4('0x34')]['fields']));_0x19eb24[_0x9ff4('0x39')]=_0x19eb24[_0x9ff4('0x39')][_0x9ff4('0x3b')]?_0x19eb24[_0x9ff4('0x39')]:_0x5157d[_0x9ff4('0x38')];_0x19eb24[_0x9ff4('0x3e')]=qs['sort'](_0x54c7bb[_0x9ff4('0x34')][_0x9ff4('0x3f')]);_0x19eb24[_0x9ff4('0x40')]=qs['filters'](_['pick'](_0x54c7bb[_0x9ff4('0x34')],_0x5157d[_0x9ff4('0x36')]));if(_0x54c7bb[_0x9ff4('0x34')][_0x9ff4('0x42')]){_0x19eb24['where']=_['merge'](_0x19eb24[_0x9ff4('0x40')],{'$or':_[_0x9ff4('0x2f')](_0x19eb24[_0x9ff4('0x39')],function(_0x2a2118){var _0x105f0e={};_0x105f0e[_0x2a2118]={'$like':'%'+_0x54c7bb[_0x9ff4('0x34')][_0x9ff4('0x42')]+'%'};return _0x105f0e;})});}_0x19eb24=_[_0x9ff4('0x43')]({},_0x19eb24,_0x54c7bb[_0x9ff4('0x45')]);return _0x18403f['getConfigurations'](_0x19eb24);}})[_0x9ff4('0x28')](function(_0x1e524b){if(_0x1e524b){_0x320d0f=_0x1e524b['length'];if(!_0x54c7bb[_0x9ff4('0x34')][_0x9ff4('0x3c')](_0x9ff4('0x3d'))){_0x19eb24[_0x9ff4('0x20')]=qs[_0x9ff4('0x20')](_0x54c7bb[_0x9ff4('0x34')][_0x9ff4('0x20')]);_0x19eb24[_0x9ff4('0x22')]=qs[_0x9ff4('0x22')](_0x54c7bb[_0x9ff4('0x34')]['offset']);}return _0x18403f['getConfigurations'](_0x19eb24);}})[_0x9ff4('0x28')](function(_0x45dddc){if(_0x45dddc){return _0x45dddc?{'count':_0x320d0f,'rows':_0x45dddc}:null;}})[_0x9ff4('0x28')](respondWithResult(_0x461d16,null))[_0x9ff4('0x4f')](handleError(_0x461d16,null));};exports['addConfiguration']=function(_0x503a0a,_0x5b5e38,_0x2a8607){if(_0x503a0a[_0x9ff4('0x4e')]['id']){delete _0x503a0a[_0x9ff4('0x4e')]['id'];}return db[_0x9ff4('0x30')]['findOne']({'where':{'id':_0x503a0a[_0x9ff4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b5e38,null))[_0x9ff4('0x28')](function(_0x493880){if(_0x493880){_0x503a0a[_0x9ff4('0x4e')]['AccountId']=_0x493880['id'];_0x503a0a[_0x9ff4('0x4e')]['Subjects']=integrations['getSubjects'](_0x503a0a[_0x9ff4('0x4e')][_0x9ff4('0x53')],_0x503a0a[_0x9ff4('0x4e')]['type']);_0x503a0a[_0x9ff4('0x4e')][_0x9ff4('0x54')]=integrations[_0x9ff4('0x55')](_0x503a0a['body']['channel'],_0x503a0a[_0x9ff4('0x4e')][_0x9ff4('0x33')]);return db['VtigerConfiguration'][_0x9ff4('0x4d')](_0x503a0a[_0x9ff4('0x4e')],{'include':[{'model':db[_0x9ff4('0x56')],'as':_0x9ff4('0x57')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x9ff4('0x28')](respondWithResult(_0x5b5e38,null))['catch'](handleError(_0x5b5e38,null));};var md5=require(_0x9ff4('0x58'));exports[_0x9ff4('0x59')]=function(_0x597d10,_0xfef46f,_0x36e417){var _0x1f3238=null;var _0x4aace8=null;var _0x81b886=null;var _0x107911=null;var _0x595bb7='';return db[_0x9ff4('0x30')]['findOne']({'where':{'id':_0x597d10['params']['id']},'attributes':['id',_0x9ff4('0x2c'),_0x9ff4('0x5a'),_0x9ff4('0x5b'),_0x9ff4('0x5c'),_0x9ff4('0x5d'),_0x9ff4('0x5e'),_0x9ff4('0x5f')]})[_0x9ff4('0x28')](handleEntityNotFound(_0xfef46f,null))[_0x9ff4('0x28')](function(_0x17a491){if(_0x17a491){_0x1f3238=_0x17a491['username'];_0x4aace8=_0x17a491[_0x9ff4('0x5f')];_0x81b886=_0x17a491[_0x9ff4('0x5c')];_0x595bb7=_0x17a491[_0x9ff4('0x5d')];var _0x4ea0b2=_0x595bb7[_0x9ff4('0x60')](-0x1);if(_0x4ea0b2==='/'){_0x595bb7=_0x595bb7[_0x9ff4('0x61')](0x0,_0x595bb7['lastIndexOf'](_0x4ea0b2));}_0x107911=util['format'](_0x9ff4('0x62'),_0x595bb7);var _0x4dcdbf={'method':_0x9ff4('0x63'),'uri':_0x107911,'qs':{'operation':'getchallenge','username':_0x17a491[_0x9ff4('0x5a')]},'json':!![]};return rp(_0x4dcdbf);}})['then'](function(_0x219e25){if(_0x219e25[_0x9ff4('0x64')]){var _0x590f64={'method':_0x9ff4('0x65'),'uri':_0x107911,'form':{'operation':'login','username':_0x1f3238,'accessKey':md5(_0x219e25[_0x9ff4('0x66')]['token']+_0x4aace8)},'json':!![]};return rp(_0x590f64);}})[_0x9ff4('0x28')](function(_0xf9fb02){if(_0xf9fb02[_0x9ff4('0x64')]){var _0x31c35f={'method':_0x9ff4('0x63'),'uri':_0x107911,'qs':{'operation':_0x9ff4('0x67'),'username':_0x1f3238,'sessionName':_0xf9fb02[_0x9ff4('0x66')][_0x9ff4('0x68')],'elementType':_0x81b886},'json':!![]};return rp(_0x31c35f);}})['then'](function(_0xd164c5){if(_0xd164c5[_0x9ff4('0x64')]){var _0x4c3769=[_0x9ff4('0x69'),_0x9ff4('0x6a'),_0x9ff4('0x6b')];_['remove'](_0xd164c5[_0x9ff4('0x66')][_0x9ff4('0x3a')],function(_0x2b1e0c){return _0x4c3769[_0x9ff4('0x6c')](_0x2b1e0c[_0x9ff4('0x33')]['name']);});_['remove'](_0xd164c5[_0x9ff4('0x66')][_0x9ff4('0x3a')],function(_0x24c02e){return _0x24c02e[_0x9ff4('0x6d')]===_0x9ff4('0x6e');});return{'count':_0xd164c5[_0x9ff4('0x66')][_0x9ff4('0x3a')][_0x9ff4('0x3b')],'rows':_[_0x9ff4('0x2f')](_0xd164c5['result'][_0x9ff4('0x3a')],function(_0x48f03b){return{'id':_0x48f03b[_0x9ff4('0x2c')],'name':_0x48f03b['label'],'custom':_[_0x9ff4('0x6f')](_0x48f03b[_0x9ff4('0x2c')],_0x9ff4('0x70'))?!![]:![],'options':_0x48f03b['type'][_0x9ff4('0x2c')]===_0x9ff4('0x71')&&_0x48f03b[_0x9ff4('0x33')][_0x9ff4('0x72')][_0x9ff4('0x3b')]>0x0?_[_0x9ff4('0x2f')](_0x48f03b[_0x9ff4('0x33')][_0x9ff4('0x72')],function(_0x3a3a6d){return{'name':_0x3a3a6d['label'],'value':_0x3a3a6d[_0x9ff4('0x73')]};}):[]};})};}})[_0x9ff4('0x28')](respondWithResult(_0xfef46f,null))['catch'](function(_0x4b4ac8){console[_0x9ff4('0x74')](_0x9ff4('0x75')+_0x4b4ac8);var _0x52c1b3=_0x597d10[_0x9ff4('0x34')][_0x9ff4('0x76')]?0x1f4:_0x4b4ac8[_0x9ff4('0x77')]||0x1f4;logger[_0x9ff4('0x2a')](_0x9ff4('0x78'),_0x9ff4('0x59'),_0x52c1b3,JSON['stringify'](_0x4b4ac8));delete _0x4b4ac8[_0x9ff4('0x2c')];if(_0x52c1b3===0x191){_0x52c1b3=0x190;}_0xfef46f['status'](_0x52c1b3)[_0x9ff4('0x2d')](_0x597d10[_0x9ff4('0x34')][_0x9ff4('0x76')]?{'message':_0x9ff4('0x79'),'statusCode':_0x4b4ac8[_0x9ff4('0x77')]}:_0x4b4ac8);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index ba265b7..ad640c2 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 _0x8eef=['int_vtiger_accounts','lodash','util','api','bluebird','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x5766fd,_0x3ee56c){var _0x3d5a01=function(_0x411759){while(--_0x411759){_0x5766fd['push'](_0x5766fd['shift']());}};_0x3d5a01(++_0x3ee56c);}(_0x8eef,0x15f));var _0xf8ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8eef[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf8ee('0x0'));var util=require(_0xf8ee('0x1'));var logger=require('../../config/logger')(_0xf8ee('0x2'));var moment=require('moment');var BPromise=require(_0xf8ee('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf8ee('0x4'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xf8ee('0x5'));module[_0xf8ee('0x6')]=function(_0x5dec00,_0x47cd9a){return _0x5dec00[_0xf8ee('0x7')](_0xf8ee('0x8'),attributes,{'tableName':_0xf8ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x728a=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0x1445bd,_0x2f9f08){var _0x52d18=function(_0x3819f8){while(--_0x3819f8){_0x1445bd['push'](_0x1445bd['shift']());}};_0x52d18(++_0x2f9f08);}(_0x728a,0x1a4));var _0xa728=function(_0x1e53bb,_0x5c2e29){_0x1e53bb=_0x1e53bb-0x0;var _0x10918a=_0x728a[_0x1e53bb];return _0x10918a;};'use strict';var _=require(_0xa728('0x0'));var util=require('util');var logger=require(_0xa728('0x1'))(_0xa728('0x2'));var moment=require(_0xa728('0x3'));var BPromise=require(_0xa728('0x4'));var rp=require(_0xa728('0x5'));var fs=require('fs');var path=require(_0xa728('0x6'));var rimraf=require(_0xa728('0x7'));var config=require(_0xa728('0x8'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xa728('0x9'));module[_0xa728('0xa')]=function(_0x367355,_0x25c0b2){return _0x367355[_0xa728('0xb')](_0xa728('0xc'),attributes,{'tableName':_0xa728('0xd'),'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 f7c07ef..b36c55f 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.rpc.js +++ b/server/api/intVtigerAccount/intVtigerAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','model','map','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x31bd8b,_0x56fa02){var _0x1506e4=function(_0x51e54d){while(--_0x51e54d){_0x31bd8b['push'](_0x31bd8b['shift']());}};_0x1506e4(++_0x56fa02);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetVtigerAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowVtigerAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0x44a3=['code','message','VtigerAccount,\x20%s,\x20%s','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error'];(function(_0x13c44d,_0x5e268a){var _0x41bbe5=function(_0x4144ea){while(--_0x4144ea){_0x13c44d['push'](_0x13c44d['shift']());}};_0x41bbe5(++_0x5e268a);}(_0x44a3,0x1a9));var _0x344a=function(_0xb31b62,_0x309405){_0xb31b62=_0xb31b62-0x0;var _0x3928ed=_0x44a3[_0xb31b62];return _0x3928ed;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});}exports[_0x344a('0x17')]=function(_0x277c06){var _0x49b55f=this;return new Promise(function(_0x9fe854,_0x274016){return db[_0x344a('0x18')][_0x344a('0x19')]({'raw':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1b')]===undefined?!![]:![]:!![],'where':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1c')]||null:null,'attributes':_0x277c06['options']?_0x277c06[_0x344a('0x1a')][_0x344a('0x1d')]||null:null,'limit':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1e')]||null:null,'include':_0x277c06[_0x344a('0x1a')]?_0x277c06[_0x344a('0x1a')][_0x344a('0x1f')]?_[_0x344a('0x20')](_0x277c06[_0x344a('0x1a')][_0x344a('0x1f')],function(_0x3b2ab9){return{'model':db[_0x3b2ab9[_0x344a('0x21')]],'as':_0x3b2ab9['as'],'attributes':_0x3b2ab9[_0x344a('0x1d')],'include':_0x3b2ab9['include']?_[_0x344a('0x20')](_0x3b2ab9['include'],function(_0x2a5e49){return{'model':db[_0x2a5e49['model']],'as':_0x2a5e49['as'],'attributes':_0x2a5e49[_0x344a('0x1d')],'include':_0x2a5e49[_0x344a('0x1f')]?_[_0x344a('0x20')](_0x2a5e49[_0x344a('0x1f')],function(_0x26f059){return{'model':db[_0x26f059[_0x344a('0x21')]],'as':_0x26f059['as'],'attributes':_0x26f059[_0x344a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x344a('0xe')](function(_0x4f2499){logger[_0x344a('0xf')](_0x344a('0x17'),_0x277c06);logger[_0x344a('0x11')](_0x344a('0x17'),_0x277c06,JSON[_0x344a('0x22')](_0x4f2499));_0x9fe854(_0x4f2499);})[_0x344a('0x16')](function(_0x5b877d){logger[_0x344a('0x12')]('GetVtigerAccount',_0x5b877d['message'],_0x277c06);_0x274016(_0x49b55f[_0x344a('0x12')](0x1f4,_0x5b877d[_0x344a('0x14')]));});});};exports[_0x344a('0x23')]=function(_0x4803db){var _0x5cd9c6=this;return new Promise(function(_0x5cafd2,_0x16f490){return db[_0x344a('0x18')][_0x344a('0x24')]({'raw':_0x4803db['options']?_0x4803db[_0x344a('0x1a')][_0x344a('0x1b')]===undefined?!![]:![]:!![],'where':_0x4803db[_0x344a('0x1a')]?_0x4803db[_0x344a('0x1a')][_0x344a('0x1c')]||null:null,'attributes':_0x4803db[_0x344a('0x1a')]?_0x4803db[_0x344a('0x1a')]['attributes']||null:null,'include':_0x4803db[_0x344a('0x1a')]?_0x4803db['options']['include']?_['map'](_0x4803db[_0x344a('0x1a')][_0x344a('0x1f')],function(_0x2b8e71){return{'model':db[_0x2b8e71[_0x344a('0x21')]],'as':_0x2b8e71['as'],'attributes':_0x2b8e71[_0x344a('0x1d')],'include':_0x2b8e71[_0x344a('0x1f')]?_['map'](_0x2b8e71[_0x344a('0x1f')],function(_0x1fbf64){return{'model':db[_0x1fbf64[_0x344a('0x21')]],'as':_0x1fbf64['as'],'attributes':_0x1fbf64['attributes'],'include':_0x1fbf64[_0x344a('0x1f')]?_[_0x344a('0x20')](_0x1fbf64[_0x344a('0x1f')],function(_0x487a9b){return{'model':db[_0x487a9b[_0x344a('0x21')]],'as':_0x487a9b['as'],'attributes':_0x487a9b['attributes']};}):[]};}):[]};}):[]:[]})[_0x344a('0xe')](function(_0xeabc7c){logger[_0x344a('0xf')](_0x344a('0x23'),_0x4803db);logger[_0x344a('0x11')]('ShowVtigerAccount',_0x4803db,JSON[_0x344a('0x22')](_0xeabc7c));_0x5cafd2(_0xeabc7c);})[_0x344a('0x16')](function(_0x11e81f){logger[_0x344a('0x12')](_0x344a('0x23'),_0x11e81f['message'],_0x4803db);_0x16f490(_0x5cd9c6[_0x344a('0x12')](0x1f4,_0x11e81f[_0x344a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index f41c826..0552580 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 _0xdbc0=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdbc0,0xdc));var _0x0dbc=function(_0x4b262d,_0x2a2240){_0x4b262d=_0x4b262d-0x0;var _0x2ca50f=_0xdbc0[_0x4b262d];return _0x2ca50f;};'use strict';var multer=require(_0x0dbc('0x0'));var util=require('util');var path=require(_0x0dbc('0x1'));var timeout=require(_0x0dbc('0x2'));var express=require(_0x0dbc('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0dbc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0dbc('0x5'));var controller=require(_0x0dbc('0x6'));router[_0x0dbc('0x7')]('/',auth[_0x0dbc('0x8')](),controller[_0x0dbc('0x9')]);router[_0x0dbc('0x7')](_0x0dbc('0xa'),auth['isAuthenticated'](),controller[_0x0dbc('0xb')]);router[_0x0dbc('0x7')](_0x0dbc('0xc'),auth[_0x0dbc('0x8')](),controller[_0x0dbc('0xd')]);router['get'](_0x0dbc('0xe'),auth[_0x0dbc('0x8')](),controller[_0x0dbc('0xf')]);router[_0x0dbc('0x7')]('/:id/descriptions',auth[_0x0dbc('0x8')](),controller[_0x0dbc('0x10')]);router[_0x0dbc('0x11')]('/',auth[_0x0dbc('0x8')](),controller[_0x0dbc('0x12')]);router['put'](_0x0dbc('0xa'),auth[_0x0dbc('0x8')](),controller[_0x0dbc('0x13')]);router[_0x0dbc('0x14')](_0x0dbc('0xa'),auth[_0x0dbc('0x8')](),controller[_0x0dbc('0x15')]);module[_0x0dbc('0x16')]=router; \ No newline at end of file +var _0x6d39=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','update'];(function(_0x20d9ff,_0x1bcc4b){var _0x1f78aa=function(_0x4ab48e){while(--_0x4ab48e){_0x20d9ff['push'](_0x20d9ff['shift']());}};_0x1f78aa(++_0x1bcc4b);}(_0x6d39,0x12e));var _0x96d3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6d39[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x96d3('0x0'));var util=require(_0x96d3('0x1'));var path=require(_0x96d3('0x2'));var timeout=require(_0x96d3('0x3'));var express=require(_0x96d3('0x4'));var router=express[_0x96d3('0x5')]();var fs_extra=require(_0x96d3('0x6'));var auth=require(_0x96d3('0x7'));var interaction=require(_0x96d3('0x8'));var config=require('../../config/environment');var controller=require(_0x96d3('0x9'));router[_0x96d3('0xa')]('/',auth[_0x96d3('0xb')](),controller[_0x96d3('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x96d3('0xa')](_0x96d3('0xd'),auth[_0x96d3('0xb')](),controller[_0x96d3('0xe')]);router['get'](_0x96d3('0xf'),auth['isAuthenticated'](),controller[_0x96d3('0x10')]);router['get'](_0x96d3('0x11'),auth['isAuthenticated'](),controller[_0x96d3('0x12')]);router['post']('/',auth[_0x96d3('0xb')](),controller[_0x96d3('0x13')]);router[_0x96d3('0x14')](_0x96d3('0x15'),auth[_0x96d3('0xb')](),controller[_0x96d3('0x16')]);router[_0x96d3('0x17')](_0x96d3('0x15'),auth[_0x96d3('0xb')](),controller['destroy']);module[_0x96d3('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index e7fc671..7ee6b0b 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 _0xc15b=['STRING','sequelize','exports'];(function(_0x2e75b5,_0x21f36d){var _0x225bb3=function(_0xe55f96){while(--_0xe55f96){_0x2e75b5['push'](_0x2e75b5['shift']());}};_0x225bb3(++_0x21f36d);}(_0xc15b,0x106));var _0xbc15=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xc15b[_0xd0b415];return _0x2bdf2c;};'use strict';var Sequelize=require(_0xbc15('0x0'));module[_0xbc15('0x1')]={'name':{'type':Sequelize[_0xbc15('0x2')]},'description':{'type':Sequelize[_0xbc15('0x2')]}}; \ No newline at end of file +var _0x890d=['sequelize','STRING'];(function(_0x9657be,_0x2a7995){var _0x267e2b=function(_0x467c27){while(--_0x467c27){_0x9657be['push'](_0x9657be['shift']());}};_0x267e2b(++_0x2a7995);}(_0x890d,0x14c));var _0xd890=function(_0x1a26d7,_0xb59032){_0x1a26d7=_0x1a26d7-0x0;var _0xa7c428=_0x890d[_0x1a26d7];return _0xa7c428;};'use strict';var Sequelize=require(_0xd890('0x0'));module['exports']={'name':{'type':Sequelize[_0xd890('0x1')]},'description':{'type':Sequelize[_0xd890('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index ddb5030..727a1e5 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 _0x55f7=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','stack','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','params','intersection','length','options','find','create','body','getFields','findOne','VtigerField','pick','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x48bcc2,_0x459a71){var _0x240728=function(_0x378f74){while(--_0x378f74){_0x48bcc2['push'](_0x48bcc2['shift']());}};_0x240728(++_0x459a71);}(_0x55f7,0xe1));var _0x755f=function(_0x78c164,_0x559f15){_0x78c164=_0x78c164-0x0;var _0x5c51e9=_0x55f7[_0x78c164];return _0x5c51e9;};'use strict';var emlformat=require(_0x755f('0x0'));var rimraf=require(_0x755f('0x1'));var zipdir=require(_0x755f('0x2'));var jsonpatch=require(_0x755f('0x3'));var rp=require(_0x755f('0x4'));var moment=require(_0x755f('0x5'));var BPromise=require(_0x755f('0x6'));var Mustache=require(_0x755f('0x7'));var util=require(_0x755f('0x8'));var path=require(_0x755f('0x9'));var sox=require('sox');var csv=require(_0x755f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x755f('0xb'));var _=require(_0x755f('0xc'));var squel=require(_0x755f('0xd'));var crypto=require(_0x755f('0xe'));var jsforce=require(_0x755f('0xf'));var deskjs=require(_0x755f('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x755f('0x11'));var Redis=require(_0x755f('0x12'));var authService=require(_0x755f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x755f('0x14'));var hardwareService=require(_0x755f('0x15'));var logger=require(_0x755f('0x16'))(_0x755f('0x17'));var utils=require('../../config/utils');var config=require(_0x755f('0x18'));var licenseUtil=require(_0x755f('0x19'));var db=require(_0x755f('0x1a'))['db'];function respondWithStatusCode(_0x41e847,_0x56c300){_0x56c300=_0x56c300||0xcc;return function(_0x46ca6f){if(_0x46ca6f){return _0x41e847[_0x755f('0x1b')](_0x56c300);}return _0x41e847['status'](_0x56c300)[_0x755f('0x1c')]();};}function respondWithResult(_0xe7e3c7,_0x840b5a){_0x840b5a=_0x840b5a||0xc8;return function(_0x1abe66){if(_0x1abe66){return _0xe7e3c7[_0x755f('0x1d')](_0x840b5a)[_0x755f('0x1e')](_0x1abe66);}};}function respondWithFilteredResult(_0x586de3,_0x1e3f35){return function(_0x567479){if(_0x567479){var _0x2cc330=typeof _0x1e3f35['offset']===_0x755f('0x1f')&&typeof _0x1e3f35[_0x755f('0x20')]==='undefined';var _0x3728d0=_0x567479['count'];var _0x45146b=_0x2cc330?0x0:_0x1e3f35[_0x755f('0x21')];var _0x2974c0=_0x2cc330?_0x567479[_0x755f('0x22')]:_0x1e3f35[_0x755f('0x21')]+_0x1e3f35[_0x755f('0x20')];var _0x3af357;if(_0x2974c0>=_0x3728d0){_0x2974c0=_0x3728d0;_0x3af357=0xc8;}else{_0x3af357=0xce;}_0x586de3['status'](_0x3af357);return _0x586de3[_0x755f('0x23')](_0x755f('0x24'),_0x45146b+'-'+_0x2974c0+'/'+_0x3728d0)['json'](_0x567479);}return null;};}function patchUpdates(_0x44ce77){return function(_0x253cc1){try{jsonpatch['apply'](_0x253cc1,_0x44ce77,!![]);}catch(_0x395cbd){return BPromise[_0x755f('0x25')](_0x395cbd);}return _0x253cc1[_0x755f('0x26')]();};}function saveUpdates(_0x48f4cb,_0x3a3440){return function(_0xb2d35a){if(_0xb2d35a){return _0xb2d35a[_0x755f('0x27')](_0x48f4cb)[_0x755f('0x28')](function(_0x22ef4a){return _0x22ef4a;});}return null;};}function removeEntity(_0x11a716,_0x472201){return function(_0x293ea4){if(_0x293ea4){return _0x293ea4[_0x755f('0x29')]()[_0x755f('0x28')](function(){_0x11a716[_0x755f('0x1d')](0xcc)[_0x755f('0x1c')]();});}};}function handleEntityNotFound(_0x5e167e,_0x452983){return function(_0x2c34eb){if(!_0x2c34eb){_0x5e167e[_0x755f('0x1b')](0x194);}return _0x2c34eb;};}function handleError(_0x8788be,_0x1d4100){_0x1d4100=_0x1d4100||0x1f4;return function(_0x356d77){logger['error'](_0x356d77[_0x755f('0x2a')]);if(_0x356d77['name']){delete _0x356d77['name'];}_0x8788be['status'](_0x1d4100)['send'](_0x356d77);};}exports[_0x755f('0x2b')]=function(_0xa39c45,_0x13af0f){var _0x3c8009={},_0x2a6419={},_0x43a283={'count':0x0,'rows':[]};var _0x270e1c=_['map'](db[_0x755f('0x2c')][_0x755f('0x2d')],function(_0x33b784){return{'name':_0x33b784[_0x755f('0x2e')],'type':_0x33b784[_0x755f('0x2f')][_0x755f('0x30')]};});_0x2a6419[_0x755f('0x31')]=_[_0x755f('0x32')](_0x270e1c,_0x755f('0x33'));_0x2a6419['query']=_[_0x755f('0x34')](_0xa39c45[_0x755f('0x35')]);_0x2a6419[_0x755f('0x36')]=_['intersection'](_0x2a6419[_0x755f('0x31')],_0x2a6419[_0x755f('0x35')]);_0x3c8009[_0x755f('0x37')]=_['intersection'](_0x2a6419['model'],qs[_0x755f('0x38')](_0xa39c45[_0x755f('0x35')][_0x755f('0x38')]));_0x3c8009[_0x755f('0x37')]=_0x3c8009[_0x755f('0x37')]['length']?_0x3c8009[_0x755f('0x37')]:_0x2a6419[_0x755f('0x31')];if(!_0xa39c45[_0x755f('0x35')][_0x755f('0x39')]('nolimit')){_0x3c8009[_0x755f('0x20')]=qs['limit'](_0xa39c45['query'][_0x755f('0x20')]);_0x3c8009['offset']=qs[_0x755f('0x21')](_0xa39c45[_0x755f('0x35')][_0x755f('0x21')]);}_0x3c8009[_0x755f('0x3a')]=qs['sort'](_0xa39c45[_0x755f('0x35')][_0x755f('0x3b')]);_0x3c8009[_0x755f('0x3c')]=qs['filters'](_['pick'](_0xa39c45['query'],_0x2a6419['filters']),_0x270e1c);if(_0xa39c45[_0x755f('0x35')][_0x755f('0x3d')]){_0x3c8009[_0x755f('0x3c')]=_[_0x755f('0x3e')](_0x3c8009[_0x755f('0x3c')],{'$or':_[_0x755f('0x32')](_0x270e1c,function(_0x37a9d9){if(_0x37a9d9[_0x755f('0x2f')]!==_0x755f('0x3f')){var _0x3fc50d={};_0x3fc50d[_0x37a9d9[_0x755f('0x33')]]={'$like':'%'+_0xa39c45[_0x755f('0x35')][_0x755f('0x3d')]+'%'};return _0x3fc50d;}})});}_0x3c8009=_[_0x755f('0x3e')]({},_0x3c8009,_0xa39c45['options']);var _0x472795={'where':_0x3c8009[_0x755f('0x3c')]};return db[_0x755f('0x2c')][_0x755f('0x22')](_0x472795)[_0x755f('0x28')](function(_0x4ef488){_0x43a283[_0x755f('0x22')]=_0x4ef488;if(_0xa39c45[_0x755f('0x35')]['includeAll']){_0x3c8009[_0x755f('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x755f('0x41')](_0x3c8009);})[_0x755f('0x28')](function(_0x46eb2c){_0x43a283[_0x755f('0x42')]=_0x46eb2c;return _0x43a283;})[_0x755f('0x28')](respondWithFilteredResult(_0x13af0f,_0x3c8009))[_0x755f('0x43')](handleError(_0x13af0f,null));};exports['show']=function(_0x584c41,_0x3f26f0){var _0x73a00d={'raw':![],'where':{'id':_0x584c41[_0x755f('0x44')]['id']}},_0x8bfd4a={};_0x8bfd4a[_0x755f('0x31')]=_[_0x755f('0x34')](db[_0x755f('0x2c')][_0x755f('0x2d')]);_0x8bfd4a[_0x755f('0x35')]=_[_0x755f('0x34')](_0x584c41[_0x755f('0x35')]);_0x8bfd4a['filters']=_[_0x755f('0x45')](_0x8bfd4a[_0x755f('0x31')],_0x8bfd4a['query']);_0x73a00d['attributes']=_[_0x755f('0x45')](_0x8bfd4a[_0x755f('0x31')],qs[_0x755f('0x38')](_0x584c41[_0x755f('0x35')][_0x755f('0x38')]));_0x73a00d[_0x755f('0x37')]=_0x73a00d[_0x755f('0x37')][_0x755f('0x46')]?_0x73a00d[_0x755f('0x37')]:_0x8bfd4a[_0x755f('0x31')];if(_0x584c41[_0x755f('0x35')]['includeAll']){_0x73a00d[_0x755f('0x40')]=[{'all':!![]}];}_0x73a00d=_['merge']({},_0x73a00d,_0x584c41[_0x755f('0x47')]);return db['VtigerConfiguration'][_0x755f('0x48')](_0x73a00d)[_0x755f('0x28')](handleEntityNotFound(_0x3f26f0,null))[_0x755f('0x28')](respondWithResult(_0x3f26f0,null))['catch'](handleError(_0x3f26f0,null));};exports[_0x755f('0x49')]=function(_0x4ca575,_0x311fde){return db[_0x755f('0x2c')][_0x755f('0x49')](_0x4ca575[_0x755f('0x4a')],{})[_0x755f('0x28')](respondWithResult(_0x311fde,0xc9))['catch'](handleError(_0x311fde,null));};exports[_0x755f('0x27')]=function(_0x4f5994,_0x1e0fd8){if(_0x4f5994[_0x755f('0x4a')]['id']){delete _0x4f5994[_0x755f('0x4a')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x4f5994[_0x755f('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e0fd8,null))[_0x755f('0x28')](saveUpdates(_0x4f5994[_0x755f('0x4a')],null))[_0x755f('0x28')](respondWithResult(_0x1e0fd8,null))[_0x755f('0x43')](handleError(_0x1e0fd8,null));};exports[_0x755f('0x29')]=function(_0x32a60a,_0x471881){return db[_0x755f('0x2c')]['find']({'where':{'id':_0x32a60a['params']['id']}})[_0x755f('0x28')](handleEntityNotFound(_0x471881,null))[_0x755f('0x28')](removeEntity(_0x471881,null))[_0x755f('0x43')](handleError(_0x471881,null));};exports[_0x755f('0x4b')]=function(_0x1e665e,_0x15c9fb,_0x437491){var _0x6ee804={};var _0xf369ce={};var _0x2c67f7;var _0x106478;return db[_0x755f('0x2c')][_0x755f('0x4c')]({'where':{'id':_0x1e665e[_0x755f('0x44')]['id']}})[_0x755f('0x28')](handleEntityNotFound(_0x15c9fb,null))[_0x755f('0x28')](function(_0x3a3c79){if(_0x3a3c79){_0x2c67f7=_0x3a3c79;_0xf369ce[_0x755f('0x31')]=_[_0x755f('0x34')](db[_0x755f('0x4d')][_0x755f('0x2d')]);_0xf369ce[_0x755f('0x35')]=_[_0x755f('0x34')](_0x1e665e[_0x755f('0x35')]);_0xf369ce[_0x755f('0x36')]=_[_0x755f('0x45')](_0xf369ce[_0x755f('0x31')],_0xf369ce[_0x755f('0x35')]);_0x6ee804[_0x755f('0x37')]=_[_0x755f('0x45')](_0xf369ce[_0x755f('0x31')],qs[_0x755f('0x38')](_0x1e665e[_0x755f('0x35')][_0x755f('0x38')]));_0x6ee804[_0x755f('0x37')]=_0x6ee804['attributes'][_0x755f('0x46')]?_0x6ee804['attributes']:_0xf369ce[_0x755f('0x31')];_0x6ee804[_0x755f('0x3a')]=qs[_0x755f('0x3b')](_0x1e665e[_0x755f('0x35')][_0x755f('0x3b')]);_0x6ee804[_0x755f('0x3c')]=qs[_0x755f('0x36')](_[_0x755f('0x4e')](_0x1e665e[_0x755f('0x35')],_0xf369ce[_0x755f('0x36')]));if(_0x1e665e['query'][_0x755f('0x3d')]){_0x6ee804[_0x755f('0x3c')]=_['merge'](_0x6ee804['where'],{'$or':_[_0x755f('0x32')](_0x6ee804[_0x755f('0x37')],function(_0x2f47ef){var _0x4989d5={};_0x4989d5[_0x2f47ef]={'$like':'%'+_0x1e665e[_0x755f('0x35')][_0x755f('0x3d')]+'%'};return _0x4989d5;})});}_0x6ee804=_[_0x755f('0x3e')]({},_0x6ee804,_0x1e665e[_0x755f('0x47')]);return _0x2c67f7[_0x755f('0x4b')](_0x6ee804);}})[_0x755f('0x28')](function(_0x2adfd3){if(_0x2adfd3){_0x106478=_0x2adfd3[_0x755f('0x46')];if(!_0x1e665e['query']['hasOwnProperty']('nolimit')){_0x6ee804[_0x755f('0x20')]=qs['limit'](_0x1e665e['query'][_0x755f('0x20')]);_0x6ee804['offset']=qs[_0x755f('0x21')](_0x1e665e[_0x755f('0x35')][_0x755f('0x21')]);}return _0x2c67f7[_0x755f('0x4b')](_0x6ee804);}})['then'](function(_0x472ae5){if(_0x472ae5){return _0x472ae5?{'count':_0x106478,'rows':_0x472ae5}:null;}})['then'](respondWithResult(_0x15c9fb,null))['catch'](handleError(_0x15c9fb,null));};exports[_0x755f('0x4f')]=function(_0x105ad6,_0x39358c,_0x3dc5f4){var _0x165ca0={};var _0x432d5a={};var _0x15d3a0;var _0x17f04c;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x105ad6['params']['id']}})['then'](handleEntityNotFound(_0x39358c,null))[_0x755f('0x28')](function(_0x1da9ba){if(_0x1da9ba){_0x15d3a0=_0x1da9ba;_0x432d5a[_0x755f('0x31')]=_['keys'](db[_0x755f('0x4d')][_0x755f('0x2d')]);_0x432d5a['query']=_[_0x755f('0x34')](_0x105ad6[_0x755f('0x35')]);_0x432d5a[_0x755f('0x36')]=_[_0x755f('0x45')](_0x432d5a[_0x755f('0x31')],_0x432d5a[_0x755f('0x35')]);_0x165ca0[_0x755f('0x37')]=_[_0x755f('0x45')](_0x432d5a[_0x755f('0x31')],qs['fields'](_0x105ad6[_0x755f('0x35')]['fields']));_0x165ca0['attributes']=_0x165ca0['attributes'][_0x755f('0x46')]?_0x165ca0['attributes']:_0x432d5a['model'];_0x165ca0[_0x755f('0x3a')]=qs['sort'](_0x105ad6[_0x755f('0x35')][_0x755f('0x3b')]);_0x165ca0['where']=qs[_0x755f('0x36')](_['pick'](_0x105ad6[_0x755f('0x35')],_0x432d5a[_0x755f('0x36')]));if(_0x105ad6[_0x755f('0x35')][_0x755f('0x3d')]){_0x165ca0[_0x755f('0x3c')]=_[_0x755f('0x3e')](_0x165ca0[_0x755f('0x3c')],{'$or':_[_0x755f('0x32')](_0x165ca0[_0x755f('0x37')],function(_0x7e6a01){var _0x383ba0={};_0x383ba0[_0x7e6a01]={'$like':'%'+_0x105ad6[_0x755f('0x35')][_0x755f('0x3d')]+'%'};return _0x383ba0;})});}_0x165ca0=_[_0x755f('0x3e')]({},_0x165ca0,_0x105ad6[_0x755f('0x47')]);return _0x15d3a0[_0x755f('0x4f')](_0x165ca0);}})[_0x755f('0x28')](function(_0x593fe3){if(_0x593fe3){_0x17f04c=_0x593fe3['length'];if(!_0x105ad6['query'][_0x755f('0x39')](_0x755f('0x50'))){_0x165ca0[_0x755f('0x20')]=qs[_0x755f('0x20')](_0x105ad6[_0x755f('0x35')][_0x755f('0x20')]);_0x165ca0[_0x755f('0x21')]=qs[_0x755f('0x21')](_0x105ad6['query']['offset']);}return _0x15d3a0[_0x755f('0x4f')](_0x165ca0);}})[_0x755f('0x28')](function(_0x2c3295){if(_0x2c3295){return _0x2c3295?{'count':_0x17f04c,'rows':_0x2c3295}:null;}})[_0x755f('0x28')](respondWithResult(_0x39358c,null))[_0x755f('0x43')](handleError(_0x39358c,null));};exports[_0x755f('0x51')]=function(_0x4b17e2,_0x21f53a,_0x470dd5){var _0x19217f={};var _0x1651c5={};var _0x228767;var _0x22fb3f;return db[_0x755f('0x2c')][_0x755f('0x4c')]({'where':{'id':_0x4b17e2['params']['id']}})[_0x755f('0x28')](handleEntityNotFound(_0x21f53a,null))['then'](function(_0x5b6b6d){if(_0x5b6b6d){_0x228767=_0x5b6b6d;_0x1651c5[_0x755f('0x31')]=_[_0x755f('0x34')](db[_0x755f('0x4d')]['rawAttributes']);_0x1651c5['query']=_['keys'](_0x4b17e2['query']);_0x1651c5[_0x755f('0x36')]=_[_0x755f('0x45')](_0x1651c5['model'],_0x1651c5[_0x755f('0x35')]);_0x19217f[_0x755f('0x37')]=_['intersection'](_0x1651c5[_0x755f('0x31')],qs[_0x755f('0x38')](_0x4b17e2['query'][_0x755f('0x38')]));_0x19217f[_0x755f('0x37')]=_0x19217f[_0x755f('0x37')]['length']?_0x19217f['attributes']:_0x1651c5[_0x755f('0x31')];_0x19217f[_0x755f('0x3a')]=qs[_0x755f('0x3b')](_0x4b17e2['query'][_0x755f('0x3b')]);_0x19217f[_0x755f('0x3c')]=qs[_0x755f('0x36')](_['pick'](_0x4b17e2[_0x755f('0x35')],_0x1651c5[_0x755f('0x36')]));if(_0x4b17e2[_0x755f('0x35')][_0x755f('0x3d')]){_0x19217f['where']=_[_0x755f('0x3e')](_0x19217f['where'],{'$or':_['map'](_0x19217f[_0x755f('0x37')],function(_0x2623fa){var _0x3c4d52={};_0x3c4d52[_0x2623fa]={'$like':'%'+_0x4b17e2['query'][_0x755f('0x3d')]+'%'};return _0x3c4d52;})});}_0x19217f=_[_0x755f('0x3e')]({},_0x19217f,_0x4b17e2[_0x755f('0x47')]);return _0x228767[_0x755f('0x51')](_0x19217f);}})['then'](function(_0x143d99){if(_0x143d99){_0x22fb3f=_0x143d99[_0x755f('0x46')];if(!_0x4b17e2[_0x755f('0x35')][_0x755f('0x39')](_0x755f('0x50'))){_0x19217f[_0x755f('0x20')]=qs['limit'](_0x4b17e2['query'][_0x755f('0x20')]);_0x19217f['offset']=qs[_0x755f('0x21')](_0x4b17e2['query'][_0x755f('0x21')]);}return _0x228767[_0x755f('0x51')](_0x19217f);}})[_0x755f('0x28')](function(_0x5bd33e){if(_0x5bd33e){return _0x5bd33e?{'count':_0x22fb3f,'rows':_0x5bd33e}:null;}})['then'](respondWithResult(_0x21f53a,null))['catch'](handleError(_0x21f53a,null));}; \ No newline at end of file +var _0x4b3e=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','where','pick','filter','VIRTUAL','merge','options','VtigerConfiguration','includeAll','include','catch','show','params','filters','find','create','body','getFields','findOne','VtigerField','sort','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x4b3e,0x1cc));var _0xe4b3=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x4b3e[_0x21353c];return _0xa99120;};'use strict';var emlformat=require(_0xe4b3('0x0'));var rimraf=require(_0xe4b3('0x1'));var zipdir=require(_0xe4b3('0x2'));var jsonpatch=require(_0xe4b3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe4b3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe4b3('0x5'));var sox=require(_0xe4b3('0x6'));var csv=require(_0xe4b3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4b3('0x8'));var _=require(_0xe4b3('0x9'));var squel=require(_0xe4b3('0xa'));var crypto=require(_0xe4b3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe4b3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe4b3('0xd'));var Redis=require(_0xe4b3('0xe'));var authService=require(_0xe4b3('0xf'));var qs=require(_0xe4b3('0x10'));var as=require(_0xe4b3('0x11'));var hardwareService=require(_0xe4b3('0x12'));var logger=require(_0xe4b3('0x13'))(_0xe4b3('0x14'));var utils=require(_0xe4b3('0x15'));var config=require(_0xe4b3('0x16'));var licenseUtil=require(_0xe4b3('0x17'));var db=require(_0xe4b3('0x18'))['db'];function respondWithStatusCode(_0x4bdf70,_0x3ee1fc){_0x3ee1fc=_0x3ee1fc||0xcc;return function(_0x3b1ad5){if(_0x3b1ad5){return _0x4bdf70['sendStatus'](_0x3ee1fc);}return _0x4bdf70[_0xe4b3('0x19')](_0x3ee1fc)[_0xe4b3('0x1a')]();};}function respondWithResult(_0x111dea,_0x157ae1){_0x157ae1=_0x157ae1||0xc8;return function(_0x2d7dce){if(_0x2d7dce){return _0x111dea['status'](_0x157ae1)['json'](_0x2d7dce);}};}function respondWithFilteredResult(_0x3b2fd7,_0x2a9cad){return function(_0x3a332d){if(_0x3a332d){var _0x2c2ee8=typeof _0x2a9cad[_0xe4b3('0x1b')]===_0xe4b3('0x1c')&&typeof _0x2a9cad[_0xe4b3('0x1d')]===_0xe4b3('0x1c');var _0x276524=_0x3a332d['count'];var _0x3cfdb1=_0x2c2ee8?0x0:_0x2a9cad['offset'];var _0x3ab11f=_0x2c2ee8?_0x3a332d[_0xe4b3('0x1e')]:_0x2a9cad[_0xe4b3('0x1b')]+_0x2a9cad[_0xe4b3('0x1d')];var _0x476897;if(_0x3ab11f>=_0x276524){_0x3ab11f=_0x276524;_0x476897=0xc8;}else{_0x476897=0xce;}_0x3b2fd7[_0xe4b3('0x19')](_0x476897);return _0x3b2fd7[_0xe4b3('0x1f')](_0xe4b3('0x20'),_0x3cfdb1+'-'+_0x3ab11f+'/'+_0x276524)[_0xe4b3('0x21')](_0x3a332d);}return null;};}function patchUpdates(_0x5e5d24){return function(_0x20aa57){try{jsonpatch[_0xe4b3('0x22')](_0x20aa57,_0x5e5d24,!![]);}catch(_0x3f52a5){return BPromise[_0xe4b3('0x23')](_0x3f52a5);}return _0x20aa57['save']();};}function saveUpdates(_0x3b502d,_0x52bd6d){return function(_0x38cfad){if(_0x38cfad){return _0x38cfad[_0xe4b3('0x24')](_0x3b502d)[_0xe4b3('0x25')](function(_0x3095a9){return _0x3095a9;});}return null;};}function removeEntity(_0x355e3c,_0xbc2402){return function(_0x4adf5c){if(_0x4adf5c){return _0x4adf5c[_0xe4b3('0x26')]()[_0xe4b3('0x25')](function(){_0x355e3c['status'](0xcc)[_0xe4b3('0x1a')]();});}};}function handleEntityNotFound(_0x2923b5,_0x2b76f3){return function(_0x17ab29){if(!_0x17ab29){_0x2923b5[_0xe4b3('0x27')](0x194);}return _0x17ab29;};}function handleError(_0x48884d,_0x267248){_0x267248=_0x267248||0x1f4;return function(_0x178a12){logger[_0xe4b3('0x28')](_0x178a12['stack']);if(_0x178a12[_0xe4b3('0x29')]){delete _0x178a12[_0xe4b3('0x29')];}_0x48884d['status'](_0x267248)[_0xe4b3('0x2a')](_0x178a12);};}exports[_0xe4b3('0x2b')]=function(_0x3f0635,_0x5bcc26){var _0x5b12bb={},_0x44d30c={},_0x246873={'count':0x0,'rows':[]};var _0x14a036=_[_0xe4b3('0x2c')](db['VtigerConfiguration'][_0xe4b3('0x2d')],function(_0x273372){return{'name':_0x273372[_0xe4b3('0x2e')],'type':_0x273372[_0xe4b3('0x2f')]['key']};});_0x44d30c[_0xe4b3('0x30')]=_[_0xe4b3('0x2c')](_0x14a036,_0xe4b3('0x29'));_0x44d30c['query']=_[_0xe4b3('0x31')](_0x3f0635['query']);_0x44d30c['filters']=_[_0xe4b3('0x32')](_0x44d30c[_0xe4b3('0x30')],_0x44d30c[_0xe4b3('0x33')]);_0x5b12bb[_0xe4b3('0x34')]=_['intersection'](_0x44d30c[_0xe4b3('0x30')],qs[_0xe4b3('0x35')](_0x3f0635['query'][_0xe4b3('0x35')]));_0x5b12bb[_0xe4b3('0x34')]=_0x5b12bb['attributes'][_0xe4b3('0x36')]?_0x5b12bb[_0xe4b3('0x34')]:_0x44d30c[_0xe4b3('0x30')];if(!_0x3f0635[_0xe4b3('0x33')][_0xe4b3('0x37')]('nolimit')){_0x5b12bb['limit']=qs[_0xe4b3('0x1d')](_0x3f0635[_0xe4b3('0x33')]['limit']);_0x5b12bb['offset']=qs[_0xe4b3('0x1b')](_0x3f0635[_0xe4b3('0x33')]['offset']);}_0x5b12bb[_0xe4b3('0x38')]=qs['sort'](_0x3f0635[_0xe4b3('0x33')]['sort']);_0x5b12bb[_0xe4b3('0x39')]=qs['filters'](_[_0xe4b3('0x3a')](_0x3f0635[_0xe4b3('0x33')],_0x44d30c['filters']),_0x14a036);if(_0x3f0635['query'][_0xe4b3('0x3b')]){_0x5b12bb[_0xe4b3('0x39')]=_['merge'](_0x5b12bb[_0xe4b3('0x39')],{'$or':_['map'](_0x14a036,function(_0x29e95e){if(_0x29e95e[_0xe4b3('0x2f')]!==_0xe4b3('0x3c')){var _0x17fdc5={};_0x17fdc5[_0x29e95e[_0xe4b3('0x29')]]={'$like':'%'+_0x3f0635[_0xe4b3('0x33')]['filter']+'%'};return _0x17fdc5;}})});}_0x5b12bb=_[_0xe4b3('0x3d')]({},_0x5b12bb,_0x3f0635[_0xe4b3('0x3e')]);var _0x1c018a={'where':_0x5b12bb[_0xe4b3('0x39')]};return db[_0xe4b3('0x3f')][_0xe4b3('0x1e')](_0x1c018a)[_0xe4b3('0x25')](function(_0x1edfa4){_0x246873[_0xe4b3('0x1e')]=_0x1edfa4;if(_0x3f0635[_0xe4b3('0x33')][_0xe4b3('0x40')]){_0x5b12bb[_0xe4b3('0x41')]=[{'all':!![]}];}return db[_0xe4b3('0x3f')]['findAll'](_0x5b12bb);})[_0xe4b3('0x25')](function(_0x53d78c){_0x246873['rows']=_0x53d78c;return _0x246873;})[_0xe4b3('0x25')](respondWithFilteredResult(_0x5bcc26,_0x5b12bb))[_0xe4b3('0x42')](handleError(_0x5bcc26,null));};exports[_0xe4b3('0x43')]=function(_0x405e2c,_0x3008b6){var _0x109ffb={'raw':![],'where':{'id':_0x405e2c[_0xe4b3('0x44')]['id']}},_0x12637c={};_0x12637c[_0xe4b3('0x30')]=_['keys'](db[_0xe4b3('0x3f')][_0xe4b3('0x2d')]);_0x12637c[_0xe4b3('0x33')]=_['keys'](_0x405e2c[_0xe4b3('0x33')]);_0x12637c[_0xe4b3('0x45')]=_[_0xe4b3('0x32')](_0x12637c[_0xe4b3('0x30')],_0x12637c['query']);_0x109ffb[_0xe4b3('0x34')]=_[_0xe4b3('0x32')](_0x12637c[_0xe4b3('0x30')],qs['fields'](_0x405e2c['query'][_0xe4b3('0x35')]));_0x109ffb['attributes']=_0x109ffb[_0xe4b3('0x34')][_0xe4b3('0x36')]?_0x109ffb[_0xe4b3('0x34')]:_0x12637c['model'];if(_0x405e2c[_0xe4b3('0x33')]['includeAll']){_0x109ffb[_0xe4b3('0x41')]=[{'all':!![]}];}_0x109ffb=_['merge']({},_0x109ffb,_0x405e2c['options']);return db['VtigerConfiguration'][_0xe4b3('0x46')](_0x109ffb)[_0xe4b3('0x25')](handleEntityNotFound(_0x3008b6,null))['then'](respondWithResult(_0x3008b6,null))[_0xe4b3('0x42')](handleError(_0x3008b6,null));};exports[_0xe4b3('0x47')]=function(_0x168c9d,_0x22b698){return db[_0xe4b3('0x3f')]['create'](_0x168c9d[_0xe4b3('0x48')],{})[_0xe4b3('0x25')](respondWithResult(_0x22b698,0xc9))[_0xe4b3('0x42')](handleError(_0x22b698,null));};exports[_0xe4b3('0x24')]=function(_0x43a39,_0x5d56b1){if(_0x43a39['body']['id']){delete _0x43a39[_0xe4b3('0x48')]['id'];}return db[_0xe4b3('0x3f')][_0xe4b3('0x46')]({'where':{'id':_0x43a39[_0xe4b3('0x44')]['id']}})[_0xe4b3('0x25')](handleEntityNotFound(_0x5d56b1,null))['then'](saveUpdates(_0x43a39['body'],null))[_0xe4b3('0x25')](respondWithResult(_0x5d56b1,null))[_0xe4b3('0x42')](handleError(_0x5d56b1,null));};exports['destroy']=function(_0x537d9f,_0x271e75){return db['VtigerConfiguration']['find']({'where':{'id':_0x537d9f['params']['id']}})['then'](handleEntityNotFound(_0x271e75,null))[_0xe4b3('0x25')](removeEntity(_0x271e75,null))[_0xe4b3('0x42')](handleError(_0x271e75,null));};exports[_0xe4b3('0x49')]=function(_0x12caa8,_0xd4a388,_0x5503af){var _0x7d5cb5={};var _0x9e53ae={};var _0x1bd96c;var _0x553f4a;return db['VtigerConfiguration'][_0xe4b3('0x4a')]({'where':{'id':_0x12caa8[_0xe4b3('0x44')]['id']}})[_0xe4b3('0x25')](handleEntityNotFound(_0xd4a388,null))[_0xe4b3('0x25')](function(_0x1149b3){if(_0x1149b3){_0x1bd96c=_0x1149b3;_0x9e53ae['model']=_['keys'](db[_0xe4b3('0x4b')]['rawAttributes']);_0x9e53ae[_0xe4b3('0x33')]=_[_0xe4b3('0x31')](_0x12caa8[_0xe4b3('0x33')]);_0x9e53ae[_0xe4b3('0x45')]=_[_0xe4b3('0x32')](_0x9e53ae[_0xe4b3('0x30')],_0x9e53ae[_0xe4b3('0x33')]);_0x7d5cb5[_0xe4b3('0x34')]=_[_0xe4b3('0x32')](_0x9e53ae[_0xe4b3('0x30')],qs['fields'](_0x12caa8[_0xe4b3('0x33')]['fields']));_0x7d5cb5[_0xe4b3('0x34')]=_0x7d5cb5[_0xe4b3('0x34')][_0xe4b3('0x36')]?_0x7d5cb5[_0xe4b3('0x34')]:_0x9e53ae['model'];_0x7d5cb5[_0xe4b3('0x38')]=qs[_0xe4b3('0x4c')](_0x12caa8[_0xe4b3('0x33')][_0xe4b3('0x4c')]);_0x7d5cb5[_0xe4b3('0x39')]=qs[_0xe4b3('0x45')](_['pick'](_0x12caa8[_0xe4b3('0x33')],_0x9e53ae[_0xe4b3('0x45')]));if(_0x12caa8[_0xe4b3('0x33')][_0xe4b3('0x3b')]){_0x7d5cb5['where']=_[_0xe4b3('0x3d')](_0x7d5cb5['where'],{'$or':_[_0xe4b3('0x2c')](_0x7d5cb5[_0xe4b3('0x34')],function(_0x4bbd3d){var _0x308ded={};_0x308ded[_0x4bbd3d]={'$like':'%'+_0x12caa8[_0xe4b3('0x33')]['filter']+'%'};return _0x308ded;})});}_0x7d5cb5=_[_0xe4b3('0x3d')]({},_0x7d5cb5,_0x12caa8['options']);return _0x1bd96c[_0xe4b3('0x49')](_0x7d5cb5);}})[_0xe4b3('0x25')](function(_0x41b074){if(_0x41b074){_0x553f4a=_0x41b074['length'];if(!_0x12caa8[_0xe4b3('0x33')]['hasOwnProperty']('nolimit')){_0x7d5cb5[_0xe4b3('0x1d')]=qs['limit'](_0x12caa8['query'][_0xe4b3('0x1d')]);_0x7d5cb5[_0xe4b3('0x1b')]=qs[_0xe4b3('0x1b')](_0x12caa8[_0xe4b3('0x33')][_0xe4b3('0x1b')]);}return _0x1bd96c['getFields'](_0x7d5cb5);}})['then'](function(_0x15eb17){if(_0x15eb17){return _0x15eb17?{'count':_0x553f4a,'rows':_0x15eb17}:null;}})[_0xe4b3('0x25')](respondWithResult(_0xd4a388,null))[_0xe4b3('0x42')](handleError(_0xd4a388,null));};exports[_0xe4b3('0x4d')]=function(_0x3cf351,_0x493ea7,_0x4d45f3){var _0x1e683c={};var _0x39d3c3={};var _0x5e3b1b;var _0x49bb9f;return db[_0xe4b3('0x3f')][_0xe4b3('0x4a')]({'where':{'id':_0x3cf351[_0xe4b3('0x44')]['id']}})[_0xe4b3('0x25')](handleEntityNotFound(_0x493ea7,null))[_0xe4b3('0x25')](function(_0x389e46){if(_0x389e46){_0x5e3b1b=_0x389e46;_0x39d3c3['model']=_['keys'](db[_0xe4b3('0x4b')][_0xe4b3('0x2d')]);_0x39d3c3[_0xe4b3('0x33')]=_[_0xe4b3('0x31')](_0x3cf351[_0xe4b3('0x33')]);_0x39d3c3[_0xe4b3('0x45')]=_['intersection'](_0x39d3c3['model'],_0x39d3c3[_0xe4b3('0x33')]);_0x1e683c['attributes']=_['intersection'](_0x39d3c3[_0xe4b3('0x30')],qs[_0xe4b3('0x35')](_0x3cf351[_0xe4b3('0x33')][_0xe4b3('0x35')]));_0x1e683c[_0xe4b3('0x34')]=_0x1e683c[_0xe4b3('0x34')][_0xe4b3('0x36')]?_0x1e683c['attributes']:_0x39d3c3[_0xe4b3('0x30')];_0x1e683c[_0xe4b3('0x38')]=qs[_0xe4b3('0x4c')](_0x3cf351[_0xe4b3('0x33')][_0xe4b3('0x4c')]);_0x1e683c[_0xe4b3('0x39')]=qs[_0xe4b3('0x45')](_['pick'](_0x3cf351['query'],_0x39d3c3[_0xe4b3('0x45')]));if(_0x3cf351[_0xe4b3('0x33')][_0xe4b3('0x3b')]){_0x1e683c[_0xe4b3('0x39')]=_[_0xe4b3('0x3d')](_0x1e683c[_0xe4b3('0x39')],{'$or':_[_0xe4b3('0x2c')](_0x1e683c['attributes'],function(_0x46fdba){var _0x2906e8={};_0x2906e8[_0x46fdba]={'$like':'%'+_0x3cf351[_0xe4b3('0x33')][_0xe4b3('0x3b')]+'%'};return _0x2906e8;})});}_0x1e683c=_[_0xe4b3('0x3d')]({},_0x1e683c,_0x3cf351[_0xe4b3('0x3e')]);return _0x5e3b1b[_0xe4b3('0x4d')](_0x1e683c);}})['then'](function(_0x4833a5){if(_0x4833a5){_0x49bb9f=_0x4833a5[_0xe4b3('0x36')];if(!_0x3cf351['query'][_0xe4b3('0x37')](_0xe4b3('0x4e'))){_0x1e683c[_0xe4b3('0x1d')]=qs[_0xe4b3('0x1d')](_0x3cf351[_0xe4b3('0x33')]['limit']);_0x1e683c[_0xe4b3('0x1b')]=qs['offset'](_0x3cf351[_0xe4b3('0x33')][_0xe4b3('0x1b')]);}return _0x5e3b1b[_0xe4b3('0x4d')](_0x1e683c);}})[_0xe4b3('0x25')](function(_0x95fa37){if(_0x95fa37){return _0x95fa37?{'count':_0x49bb9f,'rows':_0x95fa37}:null;}})[_0xe4b3('0x25')](respondWithResult(_0x493ea7,null))[_0xe4b3('0x42')](handleError(_0x493ea7,null));};exports[_0xe4b3('0x4f')]=function(_0x24686c,_0x21e7ad,_0x40c68d){var _0x29ce2e={};var _0x5a24d3={};var _0x4d44ea;var _0x4ee645;return db['VtigerConfiguration'][_0xe4b3('0x4a')]({'where':{'id':_0x24686c[_0xe4b3('0x44')]['id']}})[_0xe4b3('0x25')](handleEntityNotFound(_0x21e7ad,null))[_0xe4b3('0x25')](function(_0x1173e5){if(_0x1173e5){_0x4d44ea=_0x1173e5;_0x5a24d3['model']=_[_0xe4b3('0x31')](db[_0xe4b3('0x4b')][_0xe4b3('0x2d')]);_0x5a24d3[_0xe4b3('0x33')]=_['keys'](_0x24686c['query']);_0x5a24d3[_0xe4b3('0x45')]=_[_0xe4b3('0x32')](_0x5a24d3[_0xe4b3('0x30')],_0x5a24d3[_0xe4b3('0x33')]);_0x29ce2e[_0xe4b3('0x34')]=_[_0xe4b3('0x32')](_0x5a24d3[_0xe4b3('0x30')],qs[_0xe4b3('0x35')](_0x24686c[_0xe4b3('0x33')]['fields']));_0x29ce2e[_0xe4b3('0x34')]=_0x29ce2e[_0xe4b3('0x34')][_0xe4b3('0x36')]?_0x29ce2e['attributes']:_0x5a24d3['model'];_0x29ce2e[_0xe4b3('0x38')]=qs[_0xe4b3('0x4c')](_0x24686c[_0xe4b3('0x33')][_0xe4b3('0x4c')]);_0x29ce2e[_0xe4b3('0x39')]=qs[_0xe4b3('0x45')](_[_0xe4b3('0x3a')](_0x24686c[_0xe4b3('0x33')],_0x5a24d3[_0xe4b3('0x45')]));if(_0x24686c[_0xe4b3('0x33')][_0xe4b3('0x3b')]){_0x29ce2e[_0xe4b3('0x39')]=_['merge'](_0x29ce2e[_0xe4b3('0x39')],{'$or':_[_0xe4b3('0x2c')](_0x29ce2e['attributes'],function(_0x5a90c6){var _0x14267d={};_0x14267d[_0x5a90c6]={'$like':'%'+_0x24686c[_0xe4b3('0x33')][_0xe4b3('0x3b')]+'%'};return _0x14267d;})});}_0x29ce2e=_['merge']({},_0x29ce2e,_0x24686c[_0xe4b3('0x3e')]);return _0x4d44ea[_0xe4b3('0x4f')](_0x29ce2e);}})[_0xe4b3('0x25')](function(_0x3ab396){if(_0x3ab396){_0x4ee645=_0x3ab396[_0xe4b3('0x36')];if(!_0x24686c[_0xe4b3('0x33')][_0xe4b3('0x37')](_0xe4b3('0x4e'))){_0x29ce2e[_0xe4b3('0x1d')]=qs[_0xe4b3('0x1d')](_0x24686c[_0xe4b3('0x33')]['limit']);_0x29ce2e[_0xe4b3('0x1b')]=qs[_0xe4b3('0x1b')](_0x24686c[_0xe4b3('0x33')]['offset']);}return _0x4d44ea[_0xe4b3('0x4f')](_0x29ce2e);}})[_0xe4b3('0x25')](function(_0x2eed3d){if(_0x2eed3d){return _0x2eed3d?{'count':_0x4ee645,'rows':_0x2eed3d}:null;}})['then'](respondWithResult(_0x21e7ad,null))[_0xe4b3('0x42')](handleError(_0x21e7ad,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 798812d..7215fc9 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 _0xc5c1=['VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x53debd,_0x226fea){var _0x90d839=function(_0x4de4f6){while(--_0x4de4f6){_0x53debd['push'](_0x53debd['shift']());}};_0x90d839(++_0x226fea);}(_0xc5c1,0x17b));var _0x1c5c=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xc5c1[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x1c5c('0x0'));var util=require(_0x1c5c('0x1'));var logger=require('../../config/logger')(_0x1c5c('0x2'));var moment=require(_0x1c5c('0x3'));var BPromise=require('bluebird');var rp=require(_0x1c5c('0x4'));var fs=require('fs');var path=require(_0x1c5c('0x5'));var rimraf=require(_0x1c5c('0x6'));var config=require(_0x1c5c('0x7'));var attributes=require(_0x1c5c('0x8'));module[_0x1c5c('0x9')]=function(_0x27789b,_0x49993a){return _0x27789b[_0x1c5c('0xa')](_0x1c5c('0xb'),attributes,{'tableName':_0x1c5c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe801=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','lodash','util','../../config/logger','api'];(function(_0x331ce0,_0xe335b9){var _0x31c3c7=function(_0x2bf43c){while(--_0x2bf43c){_0x331ce0['push'](_0x331ce0['shift']());}};_0x31c3c7(++_0xe335b9);}(_0xe801,0xa4));var _0x1e80=function(_0x195857,_0x4a512b){_0x195857=_0x195857-0x0;var _0x2fe000=_0xe801[_0x195857];return _0x2fe000;};'use strict';var _=require(_0x1e80('0x0'));var util=require(_0x1e80('0x1'));var logger=require(_0x1e80('0x2'))(_0x1e80('0x3'));var moment=require('moment');var BPromise=require(_0x1e80('0x4'));var rp=require(_0x1e80('0x5'));var fs=require('fs');var path=require(_0x1e80('0x6'));var rimraf=require(_0x1e80('0x7'));var config=require(_0x1e80('0x8'));var attributes=require(_0x1e80('0x9'));module[_0x1e80('0xa')]=function(_0x599d90,_0x5b79be){return _0x599d90['define'](_0x1e80('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 72044c0..309d20f 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 _0x9e41=['then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x9e41,0x1a0));var _0x19e4=function(_0x2c2ffc,_0x3fbb40){_0x2c2ffc=_0x2c2ffc-0x0;var _0x12a921=_0x9e41[_0x2c2ffc];return _0x12a921;};'use strict';var _=require(_0x19e4('0x0'));var util=require(_0x19e4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x19e4('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x19e4('0x3'))(_0x19e4('0x4'));var config=require(_0x19e4('0x5'));var jayson=require(_0x19e4('0x6'));var client=jayson[_0x19e4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b8c8,_0x2bad95,_0x295d64){return new BPromise(function(_0x4d6429,_0x32e808){return client[_0x19e4('0x8')](_0x10b8c8,_0x295d64)[_0x19e4('0x9')](function(_0x1e7bc2){logger['info'](_0x19e4('0xa'),_0x2bad95,_0x19e4('0xb'));logger['debug'](_0x19e4('0xc'),_0x2bad95,_0x19e4('0xb'),JSON[_0x19e4('0xd')](_0x1e7bc2));if(_0x1e7bc2[_0x19e4('0xe')]){if(_0x1e7bc2[_0x19e4('0xe')]['code']===0x1f4){logger[_0x19e4('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x2bad95,_0x1e7bc2[_0x19e4('0xe')][_0x19e4('0xf')]);return _0x32e808(_0x1e7bc2[_0x19e4('0xe')][_0x19e4('0xf')]);}logger[_0x19e4('0xe')](_0x19e4('0xa'),_0x2bad95,_0x1e7bc2['error'][_0x19e4('0xf')]);return _0x4d6429(_0x1e7bc2[_0x19e4('0xe')][_0x19e4('0xf')]);}else{logger['info'](_0x19e4('0xa'),_0x2bad95,'request\x20sent');_0x4d6429(_0x1e7bc2['result']['message']);}})[_0x19e4('0x10')](function(_0x1bc2a9){logger[_0x19e4('0xe')](_0x19e4('0xa'),_0x2bad95,_0x1bc2a9);_0x32e808(_0x1bc2a9);});});} \ No newline at end of file +var _0x91e7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x91e7,0x18c));var _0x791e=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x91e7[_0x22e9fe];return _0x47cd19;};'use strict';var _=require(_0x791e('0x0'));var util=require(_0x791e('0x1'));var moment=require(_0x791e('0x2'));var BPromise=require(_0x791e('0x3'));var rs=require(_0x791e('0x4'));var fs=require('fs');var Redis=require(_0x791e('0x5'));var db=require(_0x791e('0x6'))['db'];var utils=require(_0x791e('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x791e('0x8'));var jayson=require(_0x791e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c9378,_0x12f86d,_0x1ef7b6){return new BPromise(function(_0x2bc315,_0x3c47ab){return client[_0x791e('0xa')](_0x1c9378,_0x1ef7b6)[_0x791e('0xb')](function(_0x223553){logger[_0x791e('0xc')](_0x791e('0xd'),_0x12f86d,_0x791e('0xe'));logger[_0x791e('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x12f86d,_0x791e('0xe'),JSON[_0x791e('0x10')](_0x223553));if(_0x223553[_0x791e('0x11')]){if(_0x223553[_0x791e('0x11')]['code']===0x1f4){logger['error'](_0x791e('0xd'),_0x12f86d,_0x223553[_0x791e('0x11')][_0x791e('0x12')]);return _0x3c47ab(_0x223553[_0x791e('0x11')][_0x791e('0x12')]);}logger[_0x791e('0x11')](_0x791e('0xd'),_0x12f86d,_0x223553['error'][_0x791e('0x12')]);return _0x2bc315(_0x223553[_0x791e('0x11')][_0x791e('0x12')]);}else{logger[_0x791e('0xc')](_0x791e('0xd'),_0x12f86d,_0x791e('0xe'));_0x2bc315(_0x223553[_0x791e('0x13')][_0x791e('0x12')]);}})['catch'](function(_0x9c6f9d){logger[_0x791e('0x11')](_0x791e('0xd'),_0x12f86d,_0x9c6f9d);_0x3c47ab(_0x9c6f9d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 32bdaf2..e5aefec 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 _0x6533=['get','show','post','put','/:id','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x455c2e,_0x442227){var _0x47080f=function(_0x5cb62f){while(--_0x5cb62f){_0x455c2e['push'](_0x455c2e['shift']());}};_0x47080f(++_0x442227);}(_0x6533,0x67));var _0x3653=function(_0x460dcf,_0x35bd15){_0x460dcf=_0x460dcf-0x0;var _0x37036e=_0x6533[_0x460dcf];return _0x37036e;};'use strict';var multer=require('multer');var util=require(_0x3653('0x0'));var path=require(_0x3653('0x1'));var timeout=require('connect-timeout');var express=require(_0x3653('0x2'));var router=express[_0x3653('0x3')]();var fs_extra=require(_0x3653('0x4'));var auth=require(_0x3653('0x5'));var interaction=require(_0x3653('0x6'));var config=require(_0x3653('0x7'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x3653('0x8')](),controller['index']);router[_0x3653('0x9')]('/:id',auth[_0x3653('0x8')](),controller[_0x3653('0xa')]);router[_0x3653('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3653('0xc')](_0x3653('0xd'),auth[_0x3653('0x8')](),controller['update']);router['delete'](_0x3653('0xd'),auth[_0x3653('0x8')](),controller[_0x3653('0xe')]);module[_0x3653('0xf')]=router; \ No newline at end of file +var _0xf042=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4cc9d3,_0x2fc525){var _0x518070=function(_0x558706){while(--_0x558706){_0x4cc9d3['push'](_0x4cc9d3['shift']());}};_0x518070(++_0x2fc525);}(_0xf042,0x17a));var _0x2f04=function(_0x3eaa3b,_0x2ba2a9){_0x3eaa3b=_0x3eaa3b-0x0;var _0x16480d=_0xf042[_0x3eaa3b];return _0x16480d;};'use strict';var multer=require(_0x2f04('0x0'));var util=require('util');var path=require(_0x2f04('0x1'));var timeout=require(_0x2f04('0x2'));var express=require('express');var router=express[_0x2f04('0x3')]();var fs_extra=require(_0x2f04('0x4'));var auth=require(_0x2f04('0x5'));var interaction=require(_0x2f04('0x6'));var config=require(_0x2f04('0x7'));var controller=require(_0x2f04('0x8'));router['get']('/',auth[_0x2f04('0x9')](),controller[_0x2f04('0xa')]);router[_0x2f04('0xb')](_0x2f04('0xc'),auth[_0x2f04('0x9')](),controller[_0x2f04('0xd')]);router[_0x2f04('0xe')]('/',auth[_0x2f04('0x9')](),controller[_0x2f04('0xf')]);router[_0x2f04('0x10')]('/:id',auth[_0x2f04('0x9')](),controller[_0x2f04('0x11')]);router[_0x2f04('0x12')]('/:id',auth[_0x2f04('0x9')](),controller[_0x2f04('0x13')]);module[_0x2f04('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 89ba7bb..8092d50 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 _0x59a6=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0xe2f574,_0x15b001){var _0x5bc903=function(_0x9f882d){while(--_0x9f882d){_0xe2f574['push'](_0xe2f574['shift']());}};_0x5bc903(++_0x15b001);}(_0x59a6,0x156));var _0x659a=function(_0x1c1e0c,_0x4692ee){_0x1c1e0c=_0x1c1e0c-0x0;var _0x5a7c27=_0x59a6[_0x1c1e0c];return _0x5a7c27;};'use strict';var Sequelize=require(_0x659a('0x0'));module[_0x659a('0x1')]={'type':{'type':Sequelize['ENUM'](_0x659a('0x2'),_0x659a('0x3'),_0x659a('0x4'),_0x659a('0x5'),_0x659a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x659a('0x7')]},'key':{'type':Sequelize[_0x659a('0x7')]},'keyType':{'type':Sequelize[_0x659a('0x8')](_0x659a('0x2'),_0x659a('0x3'),_0x659a('0x4'))},'keyContent':{'type':Sequelize[_0x659a('0x7')]},'idField':{'type':Sequelize[_0x659a('0x7')]},'nameField':{'type':Sequelize[_0x659a('0x7')]},'customField':{'type':Sequelize[_0x659a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x659a('0x7')]}}; \ No newline at end of file +var _0xdc9f=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x4b4165,_0x5afc79){var _0xf03a90=function(_0xdbc137){while(--_0xdbc137){_0x4b4165['push'](_0x4b4165['shift']());}};_0xf03a90(++_0x5afc79);}(_0xdc9f,0x14d));var _0xfdc9=function(_0x2394fd,_0x5e8f2b){_0x2394fd=_0x2394fd-0x0;var _0x4caa72=_0xdc9f[_0x2394fd];return _0x4caa72;};'use strict';var Sequelize=require(_0xfdc9('0x0'));module[_0xfdc9('0x1')]={'type':{'type':Sequelize[_0xfdc9('0x2')](_0xfdc9('0x3'),_0xfdc9('0x4'),_0xfdc9('0x5'),_0xfdc9('0x6'),_0xfdc9('0x7')),'defaultValue':_0xfdc9('0x3')},'content':{'type':Sequelize[_0xfdc9('0x8')]},'key':{'type':Sequelize[_0xfdc9('0x8')]},'keyType':{'type':Sequelize[_0xfdc9('0x2')](_0xfdc9('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xfdc9('0x8')]},'idField':{'type':Sequelize[_0xfdc9('0x8')]},'nameField':{'type':Sequelize[_0xfdc9('0x8')]},'customField':{'type':Sequelize[_0xfdc9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfdc9('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 74697e3..d8d8b4c 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 _0x8028=['nolimit','order','sort','where','filters','filter','merge','include','findAll','show','params','includeAll','options','create','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','sendStatus','error','stack','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x493cea,_0x144c6a){var _0x1c32ba=function(_0x47c0f9){while(--_0x47c0f9){_0x493cea['push'](_0x493cea['shift']());}};_0x1c32ba(++_0x144c6a);}(_0x8028,0x18d));var _0x8802=function(_0x9fc757,_0x379636){_0x9fc757=_0x9fc757-0x0;var _0x444841=_0x8028[_0x9fc757];return _0x444841;};'use strict';var emlformat=require(_0x8802('0x0'));var rimraf=require(_0x8802('0x1'));var zipdir=require(_0x8802('0x2'));var jsonpatch=require(_0x8802('0x3'));var rp=require(_0x8802('0x4'));var moment=require('moment');var BPromise=require(_0x8802('0x5'));var Mustache=require(_0x8802('0x6'));var util=require(_0x8802('0x7'));var path=require(_0x8802('0x8'));var sox=require(_0x8802('0x9'));var csv=require(_0x8802('0xa'));var ejs=require(_0x8802('0xb'));var fs=require('fs');var fs_extra=require(_0x8802('0xc'));var _=require(_0x8802('0xd'));var squel=require(_0x8802('0xe'));var crypto=require(_0x8802('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8802('0x10'));var toCsv=require(_0x8802('0xa'));var querystring=require(_0x8802('0x11'));var Papa=require(_0x8802('0x12'));var Redis=require(_0x8802('0x13'));var authService=require(_0x8802('0x14'));var qs=require(_0x8802('0x15'));var as=require(_0x8802('0x16'));var hardwareService=require(_0x8802('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x8802('0x18'));var config=require(_0x8802('0x19'));var licenseUtil=require(_0x8802('0x1a'));var db=require(_0x8802('0x1b'))['db'];function respondWithStatusCode(_0x29e35a,_0xcac2ee){_0xcac2ee=_0xcac2ee||0xcc;return function(_0x543266){if(_0x543266){return _0x29e35a['sendStatus'](_0xcac2ee);}return _0x29e35a[_0x8802('0x1c')](_0xcac2ee)[_0x8802('0x1d')]();};}function respondWithResult(_0x58f033,_0x3432e4){_0x3432e4=_0x3432e4||0xc8;return function(_0x3fb5a8){if(_0x3fb5a8){return _0x58f033[_0x8802('0x1c')](_0x3432e4)[_0x8802('0x1e')](_0x3fb5a8);}};}function respondWithFilteredResult(_0x1268c9,_0x469b29){return function(_0x1dd9ff){if(_0x1dd9ff){var _0x5dddf9=typeof _0x469b29[_0x8802('0x1f')]===_0x8802('0x20')&&typeof _0x469b29[_0x8802('0x21')]==='undefined';var _0x1c3cc3=_0x1dd9ff['count'];var _0x5161c8=_0x5dddf9?0x0:_0x469b29[_0x8802('0x1f')];var _0x25e344=_0x5dddf9?_0x1dd9ff[_0x8802('0x22')]:_0x469b29['offset']+_0x469b29[_0x8802('0x21')];var _0x540e77;if(_0x25e344>=_0x1c3cc3){_0x25e344=_0x1c3cc3;_0x540e77=0xc8;}else{_0x540e77=0xce;}_0x1268c9['status'](_0x540e77);return _0x1268c9['set'](_0x8802('0x23'),_0x5161c8+'-'+_0x25e344+'/'+_0x1c3cc3)[_0x8802('0x1e')](_0x1dd9ff);}return null;};}function patchUpdates(_0x1196af){return function(_0x4de0e9){try{jsonpatch[_0x8802('0x24')](_0x4de0e9,_0x1196af,!![]);}catch(_0x283d4f){return BPromise['reject'](_0x283d4f);}return _0x4de0e9['save']();};}function saveUpdates(_0x55de5e,_0x452baf){return function(_0x322d71){if(_0x322d71){return _0x322d71[_0x8802('0x25')](_0x55de5e)[_0x8802('0x26')](function(_0x49c1b2){return _0x49c1b2;});}return null;};}function removeEntity(_0x1d875c,_0x3b100f){return function(_0x326d86){if(_0x326d86){return _0x326d86[_0x8802('0x27')]()[_0x8802('0x26')](function(){_0x1d875c['status'](0xcc)[_0x8802('0x1d')]();});}};}function handleEntityNotFound(_0xb42e4,_0x136879){return function(_0x181735){if(!_0x181735){_0xb42e4[_0x8802('0x28')](0x194);}return _0x181735;};}function handleError(_0x46e145,_0x31599d){_0x31599d=_0x31599d||0x1f4;return function(_0x5cf818){logger[_0x8802('0x29')](_0x5cf818[_0x8802('0x2a')]);if(_0x5cf818['name']){delete _0x5cf818['name'];}_0x46e145[_0x8802('0x1c')](_0x31599d)[_0x8802('0x2b')](_0x5cf818);};}exports[_0x8802('0x2c')]=function(_0x7755c9,_0x48414b){var _0x499ebc={},_0x344ffd={},_0x2e0aff={'count':0x0,'rows':[]};var _0x6c0a18=_[_0x8802('0x2d')](db[_0x8802('0x2e')][_0x8802('0x2f')],function(_0x4b0b58){return{'name':_0x4b0b58[_0x8802('0x30')],'type':_0x4b0b58[_0x8802('0x31')][_0x8802('0x32')]};});_0x344ffd[_0x8802('0x33')]=_[_0x8802('0x2d')](_0x6c0a18,_0x8802('0x34'));_0x344ffd[_0x8802('0x35')]=_[_0x8802('0x36')](_0x7755c9[_0x8802('0x35')]);_0x344ffd['filters']=_[_0x8802('0x37')](_0x344ffd[_0x8802('0x33')],_0x344ffd[_0x8802('0x35')]);_0x499ebc[_0x8802('0x38')]=_[_0x8802('0x37')](_0x344ffd['model'],qs[_0x8802('0x39')](_0x7755c9[_0x8802('0x35')][_0x8802('0x39')]));_0x499ebc[_0x8802('0x38')]=_0x499ebc[_0x8802('0x38')]['length']?_0x499ebc[_0x8802('0x38')]:_0x344ffd[_0x8802('0x33')];if(!_0x7755c9[_0x8802('0x35')][_0x8802('0x3a')](_0x8802('0x3b'))){_0x499ebc['limit']=qs[_0x8802('0x21')](_0x7755c9[_0x8802('0x35')][_0x8802('0x21')]);_0x499ebc['offset']=qs['offset'](_0x7755c9[_0x8802('0x35')][_0x8802('0x1f')]);}_0x499ebc[_0x8802('0x3c')]=qs['sort'](_0x7755c9['query'][_0x8802('0x3d')]);_0x499ebc[_0x8802('0x3e')]=qs[_0x8802('0x3f')](_['pick'](_0x7755c9[_0x8802('0x35')],_0x344ffd[_0x8802('0x3f')]),_0x6c0a18);if(_0x7755c9[_0x8802('0x35')][_0x8802('0x40')]){_0x499ebc[_0x8802('0x3e')]=_[_0x8802('0x41')](_0x499ebc['where'],{'$or':_[_0x8802('0x2d')](_0x6c0a18,function(_0xd37f21){if(_0xd37f21[_0x8802('0x31')]!=='VIRTUAL'){var _0x103d1d={};_0x103d1d[_0xd37f21['name']]={'$like':'%'+_0x7755c9[_0x8802('0x35')][_0x8802('0x40')]+'%'};return _0x103d1d;}})});}_0x499ebc=_[_0x8802('0x41')]({},_0x499ebc,_0x7755c9['options']);var _0x48120a={'where':_0x499ebc['where']};return db['VtigerField'][_0x8802('0x22')](_0x48120a)['then'](function(_0x3f5f98){_0x2e0aff[_0x8802('0x22')]=_0x3f5f98;if(_0x7755c9['query']['includeAll']){_0x499ebc[_0x8802('0x42')]=[{'all':!![]}];}return db[_0x8802('0x2e')][_0x8802('0x43')](_0x499ebc);})[_0x8802('0x26')](function(_0x31d8fa){_0x2e0aff['rows']=_0x31d8fa;return _0x2e0aff;})[_0x8802('0x26')](respondWithFilteredResult(_0x48414b,_0x499ebc))['catch'](handleError(_0x48414b,null));};exports[_0x8802('0x44')]=function(_0x63ed7c,_0x44da6a){var _0x35cee1={'raw':!![],'where':{'id':_0x63ed7c[_0x8802('0x45')]['id']}},_0x4221eb={};_0x4221eb[_0x8802('0x33')]=_[_0x8802('0x36')](db[_0x8802('0x2e')]['rawAttributes']);_0x4221eb[_0x8802('0x35')]=_[_0x8802('0x36')](_0x63ed7c[_0x8802('0x35')]);_0x4221eb['filters']=_[_0x8802('0x37')](_0x4221eb[_0x8802('0x33')],_0x4221eb[_0x8802('0x35')]);_0x35cee1[_0x8802('0x38')]=_[_0x8802('0x37')](_0x4221eb[_0x8802('0x33')],qs['fields'](_0x63ed7c[_0x8802('0x35')][_0x8802('0x39')]));_0x35cee1[_0x8802('0x38')]=_0x35cee1['attributes']['length']?_0x35cee1['attributes']:_0x4221eb[_0x8802('0x33')];if(_0x63ed7c[_0x8802('0x35')][_0x8802('0x46')]){_0x35cee1[_0x8802('0x42')]=[{'all':!![]}];}_0x35cee1=_['merge']({},_0x35cee1,_0x63ed7c[_0x8802('0x47')]);return db[_0x8802('0x2e')]['find'](_0x35cee1)['then'](handleEntityNotFound(_0x44da6a,null))['then'](respondWithResult(_0x44da6a,null))['catch'](handleError(_0x44da6a,null));};exports[_0x8802('0x48')]=function(_0x333456,_0x493846){return db[_0x8802('0x2e')][_0x8802('0x48')](_0x333456['body'],{})['then'](respondWithResult(_0x493846,0xc9))[_0x8802('0x49')](handleError(_0x493846,null));};exports[_0x8802('0x25')]=function(_0x35de48,_0x77bd2){if(_0x35de48['body']['id']){delete _0x35de48[_0x8802('0x4a')]['id'];}return db[_0x8802('0x2e')][_0x8802('0x4b')]({'where':{'id':_0x35de48['params']['id']}})[_0x8802('0x26')](handleEntityNotFound(_0x77bd2,null))[_0x8802('0x26')](saveUpdates(_0x35de48['body'],null))[_0x8802('0x26')](respondWithResult(_0x77bd2,null))[_0x8802('0x49')](handleError(_0x77bd2,null));};exports[_0x8802('0x27')]=function(_0x2864d6,_0x4a08e1){return db[_0x8802('0x2e')][_0x8802('0x4b')]({'where':{'id':_0x2864d6[_0x8802('0x45')]['id']}})[_0x8802('0x26')](handleEntityNotFound(_0x4a08e1,null))[_0x8802('0x26')](removeEntity(_0x4a08e1,null))['catch'](handleError(_0x4a08e1,null));}; \ No newline at end of file +var _0x73a1=['then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','order','pick','filter','where','merge','VIRTUAL','options','VtigerField','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x1169a5,_0x45b862){var _0x3e9809=function(_0x5e4b7f){while(--_0x5e4b7f){_0x1169a5['push'](_0x1169a5['shift']());}};_0x3e9809(++_0x45b862);}(_0x73a1,0xfc));var _0x173a=function(_0x1a595a,_0x263824){_0x1a595a=_0x1a595a-0x0;var _0x33f008=_0x73a1[_0x1a595a];return _0x33f008;};'use strict';var emlformat=require(_0x173a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x173a('0x1'));var jsonpatch=require(_0x173a('0x2'));var rp=require('request-promise');var moment=require(_0x173a('0x3'));var BPromise=require(_0x173a('0x4'));var Mustache=require(_0x173a('0x5'));var util=require(_0x173a('0x6'));var path=require(_0x173a('0x7'));var sox=require('sox');var csv=require(_0x173a('0x8'));var ejs=require(_0x173a('0x9'));var fs=require('fs');var fs_extra=require(_0x173a('0xa'));var _=require(_0x173a('0xb'));var squel=require(_0x173a('0xc'));var crypto=require(_0x173a('0xd'));var jsforce=require(_0x173a('0xe'));var deskjs=require(_0x173a('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x173a('0x10'));var authService=require(_0x173a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x173a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x173a('0x13'))(_0x173a('0x14'));var utils=require('../../config/utils');var config=require(_0x173a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x173a('0x16'))['db'];function respondWithStatusCode(_0x51dfab,_0x4b9b12){_0x4b9b12=_0x4b9b12||0xcc;return function(_0x114252){if(_0x114252){return _0x51dfab['sendStatus'](_0x4b9b12);}return _0x51dfab[_0x173a('0x17')](_0x4b9b12)['end']();};}function respondWithResult(_0x2febfa,_0x4d0ef0){_0x4d0ef0=_0x4d0ef0||0xc8;return function(_0x2d3b11){if(_0x2d3b11){return _0x2febfa[_0x173a('0x17')](_0x4d0ef0)[_0x173a('0x18')](_0x2d3b11);}};}function respondWithFilteredResult(_0x127fc7,_0xc0494e){return function(_0x523e91){if(_0x523e91){var _0x364890=typeof _0xc0494e['offset']===_0x173a('0x19')&&typeof _0xc0494e['limit']===_0x173a('0x19');var _0x3bdfe9=_0x523e91[_0x173a('0x1a')];var _0x47aaf4=_0x364890?0x0:_0xc0494e[_0x173a('0x1b')];var _0x4c0eb9=_0x364890?_0x523e91[_0x173a('0x1a')]:_0xc0494e['offset']+_0xc0494e[_0x173a('0x1c')];var _0x27e382;if(_0x4c0eb9>=_0x3bdfe9){_0x4c0eb9=_0x3bdfe9;_0x27e382=0xc8;}else{_0x27e382=0xce;}_0x127fc7[_0x173a('0x17')](_0x27e382);return _0x127fc7[_0x173a('0x1d')](_0x173a('0x1e'),_0x47aaf4+'-'+_0x4c0eb9+'/'+_0x3bdfe9)[_0x173a('0x18')](_0x523e91);}return null;};}function patchUpdates(_0x73c962){return function(_0x344e22){try{jsonpatch[_0x173a('0x1f')](_0x344e22,_0x73c962,!![]);}catch(_0x238d1a){return BPromise[_0x173a('0x20')](_0x238d1a);}return _0x344e22[_0x173a('0x21')]();};}function saveUpdates(_0x2ef5db,_0x503916){return function(_0x3c5823){if(_0x3c5823){return _0x3c5823[_0x173a('0x22')](_0x2ef5db)['then'](function(_0x1edcad){return _0x1edcad;});}return null;};}function removeEntity(_0x2e0dda,_0x537b7c){return function(_0x1d2382){if(_0x1d2382){return _0x1d2382[_0x173a('0x23')]()[_0x173a('0x24')](function(){_0x2e0dda[_0x173a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c2bb1,_0x38ab6b){return function(_0x3cb06d){if(!_0x3cb06d){_0x1c2bb1[_0x173a('0x25')](0x194);}return _0x3cb06d;};}function handleError(_0x54f3e6,_0x2e0985){_0x2e0985=_0x2e0985||0x1f4;return function(_0x29f1ac){logger[_0x173a('0x26')](_0x29f1ac[_0x173a('0x27')]);if(_0x29f1ac[_0x173a('0x28')]){delete _0x29f1ac[_0x173a('0x28')];}_0x54f3e6['status'](_0x2e0985)[_0x173a('0x29')](_0x29f1ac);};}exports[_0x173a('0x2a')]=function(_0x2eb336,_0x442416){var _0x4ee496={},_0x5d9974={},_0x1ea531={'count':0x0,'rows':[]};var _0xcfc76c=_[_0x173a('0x2b')](db['VtigerField'][_0x173a('0x2c')],function(_0x41f328){return{'name':_0x41f328['fieldName'],'type':_0x41f328[_0x173a('0x2d')]['key']};});_0x5d9974[_0x173a('0x2e')]=_['map'](_0xcfc76c,_0x173a('0x28'));_0x5d9974[_0x173a('0x2f')]=_[_0x173a('0x30')](_0x2eb336[_0x173a('0x2f')]);_0x5d9974[_0x173a('0x31')]=_[_0x173a('0x32')](_0x5d9974['model'],_0x5d9974[_0x173a('0x2f')]);_0x4ee496['attributes']=_[_0x173a('0x32')](_0x5d9974[_0x173a('0x2e')],qs['fields'](_0x2eb336[_0x173a('0x2f')][_0x173a('0x33')]));_0x4ee496[_0x173a('0x34')]=_0x4ee496[_0x173a('0x34')][_0x173a('0x35')]?_0x4ee496[_0x173a('0x34')]:_0x5d9974[_0x173a('0x2e')];if(!_0x2eb336['query']['hasOwnProperty']('nolimit')){_0x4ee496[_0x173a('0x1c')]=qs[_0x173a('0x1c')](_0x2eb336[_0x173a('0x2f')][_0x173a('0x1c')]);_0x4ee496[_0x173a('0x1b')]=qs[_0x173a('0x1b')](_0x2eb336['query']['offset']);}_0x4ee496[_0x173a('0x36')]=qs['sort'](_0x2eb336[_0x173a('0x2f')]['sort']);_0x4ee496['where']=qs[_0x173a('0x31')](_[_0x173a('0x37')](_0x2eb336['query'],_0x5d9974['filters']),_0xcfc76c);if(_0x2eb336[_0x173a('0x2f')][_0x173a('0x38')]){_0x4ee496[_0x173a('0x39')]=_[_0x173a('0x3a')](_0x4ee496[_0x173a('0x39')],{'$or':_[_0x173a('0x2b')](_0xcfc76c,function(_0xe606e){if(_0xe606e[_0x173a('0x2d')]!==_0x173a('0x3b')){var _0x10d744={};_0x10d744[_0xe606e['name']]={'$like':'%'+_0x2eb336[_0x173a('0x2f')][_0x173a('0x38')]+'%'};return _0x10d744;}})});}_0x4ee496=_['merge']({},_0x4ee496,_0x2eb336[_0x173a('0x3c')]);var _0x51ea94={'where':_0x4ee496[_0x173a('0x39')]};return db[_0x173a('0x3d')][_0x173a('0x1a')](_0x51ea94)['then'](function(_0xf6fc17){_0x1ea531['count']=_0xf6fc17;if(_0x2eb336[_0x173a('0x2f')][_0x173a('0x3e')]){_0x4ee496[_0x173a('0x3f')]=[{'all':!![]}];}return db[_0x173a('0x3d')][_0x173a('0x40')](_0x4ee496);})[_0x173a('0x24')](function(_0x378402){_0x1ea531[_0x173a('0x41')]=_0x378402;return _0x1ea531;})['then'](respondWithFilteredResult(_0x442416,_0x4ee496))[_0x173a('0x42')](handleError(_0x442416,null));};exports[_0x173a('0x43')]=function(_0x10db9e,_0x4b6d17){var _0x2b4c7d={'raw':!![],'where':{'id':_0x10db9e['params']['id']}},_0x5ec48b={};_0x5ec48b[_0x173a('0x2e')]=_['keys'](db[_0x173a('0x3d')]['rawAttributes']);_0x5ec48b[_0x173a('0x2f')]=_[_0x173a('0x30')](_0x10db9e['query']);_0x5ec48b[_0x173a('0x31')]=_[_0x173a('0x32')](_0x5ec48b[_0x173a('0x2e')],_0x5ec48b['query']);_0x2b4c7d[_0x173a('0x34')]=_['intersection'](_0x5ec48b['model'],qs[_0x173a('0x33')](_0x10db9e['query']['fields']));_0x2b4c7d[_0x173a('0x34')]=_0x2b4c7d[_0x173a('0x34')]['length']?_0x2b4c7d['attributes']:_0x5ec48b['model'];if(_0x10db9e['query']['includeAll']){_0x2b4c7d[_0x173a('0x3f')]=[{'all':!![]}];}_0x2b4c7d=_[_0x173a('0x3a')]({},_0x2b4c7d,_0x10db9e[_0x173a('0x3c')]);return db[_0x173a('0x3d')][_0x173a('0x44')](_0x2b4c7d)[_0x173a('0x24')](handleEntityNotFound(_0x4b6d17,null))['then'](respondWithResult(_0x4b6d17,null))['catch'](handleError(_0x4b6d17,null));};exports[_0x173a('0x45')]=function(_0x5dfefc,_0x3585df){return db[_0x173a('0x3d')][_0x173a('0x45')](_0x5dfefc['body'],{})['then'](respondWithResult(_0x3585df,0xc9))[_0x173a('0x42')](handleError(_0x3585df,null));};exports[_0x173a('0x22')]=function(_0x2e5141,_0x377cc8){if(_0x2e5141[_0x173a('0x46')]['id']){delete _0x2e5141[_0x173a('0x46')]['id'];}return db[_0x173a('0x3d')]['find']({'where':{'id':_0x2e5141[_0x173a('0x47')]['id']}})[_0x173a('0x24')](handleEntityNotFound(_0x377cc8,null))[_0x173a('0x24')](saveUpdates(_0x2e5141[_0x173a('0x46')],null))['then'](respondWithResult(_0x377cc8,null))[_0x173a('0x42')](handleError(_0x377cc8,null));};exports[_0x173a('0x23')]=function(_0x3157af,_0x471461){return db[_0x173a('0x3d')][_0x173a('0x44')]({'where':{'id':_0x3157af[_0x173a('0x47')]['id']}})[_0x173a('0x24')](handleEntityNotFound(_0x471461,null))['then'](removeEntity(_0x471461,null))[_0x173a('0x42')](handleError(_0x471461,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 5f5b102..d1bb2c8 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 _0xcab9=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x585578,_0x30c1c5){var _0x12bfb7=function(_0x1c66c7){while(--_0x1c66c7){_0x585578['push'](_0x585578['shift']());}};_0x12bfb7(++_0x30c1c5);}(_0xcab9,0x75));var _0x9cab=function(_0x4ee897,_0x4ab877){_0x4ee897=_0x4ee897-0x0;var _0x7c5813=_0xcab9[_0x4ee897];return _0x7c5813;};'use strict';var _=require(_0x9cab('0x0'));var util=require(_0x9cab('0x1'));var logger=require(_0x9cab('0x2'))('api');var moment=require(_0x9cab('0x3'));var BPromise=require(_0x9cab('0x4'));var rp=require(_0x9cab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9cab('0x6'));var config=require(_0x9cab('0x7'));var attributes=require(_0x9cab('0x8'));module['exports']=function(_0x2bc06f,_0x20b63c){return _0x2bc06f['define']('VtigerField',attributes,{'tableName':_0x9cab('0x9'),'paranoid':![],'indexes':[{'name':_0x9cab('0xa'),'fields':[_0x9cab('0xb'),_0x9cab('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x427b=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId'];(function(_0x2872c2,_0x427e1f){var _0x18d3b7=function(_0x2c3a48){while(--_0x2c3a48){_0x2872c2['push'](_0x2872c2['shift']());}};_0x18d3b7(++_0x427e1f);}(_0x427b,0x78));var _0xb427=function(_0x1dec02,_0x218f2e){_0x1dec02=_0x1dec02-0x0;var _0x1ad4b0=_0x427b[_0x1dec02];return _0x1ad4b0;};'use strict';var _=require(_0xb427('0x0'));var util=require(_0xb427('0x1'));var logger=require('../../config/logger')(_0xb427('0x2'));var moment=require(_0xb427('0x3'));var BPromise=require(_0xb427('0x4'));var rp=require(_0xb427('0x5'));var fs=require('fs');var path=require(_0xb427('0x6'));var rimraf=require(_0xb427('0x7'));var config=require(_0xb427('0x8'));var attributes=require(_0xb427('0x9'));module['exports']=function(_0x34e6d1,_0x31ba35){return _0x34e6d1['define'](_0xb427('0xa'),attributes,{'tableName':_0xb427('0xb'),'paranoid':![],'indexes':[{'name':_0xb427('0xc'),'fields':[_0xb427('0xd'),_0xb427('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 1be4e58..4534f15 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 _0x631f=['VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1abae7,_0x33009d){var _0x264e7a=function(_0x556ce5){while(--_0x556ce5){_0x1abae7['push'](_0x1abae7['shift']());}};_0x264e7a(++_0x33009d);}(_0x631f,0xf0));var _0xf631=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x631f[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xf631('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf631('0x1'));var fs=require('fs');var Redis=require(_0xf631('0x2'));var db=require(_0xf631('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf631('0x4'));var config=require(_0xf631('0x5'));var jayson=require(_0xf631('0x6'));var client=jayson[_0xf631('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x309079,_0x10d618,_0x55d081){return new BPromise(function(_0x22672d,_0x399ed7){return client['request'](_0x309079,_0x55d081)[_0xf631('0x8')](function(_0x463fc4){logger['info'](_0xf631('0x9'),_0x10d618,_0xf631('0xa'));logger[_0xf631('0xb')](_0xf631('0xc'),_0x10d618,_0xf631('0xa'),JSON['stringify'](_0x463fc4));if(_0x463fc4[_0xf631('0xd')]){if(_0x463fc4['error'][_0xf631('0xe')]===0x1f4){logger[_0xf631('0xd')](_0xf631('0x9'),_0x10d618,_0x463fc4[_0xf631('0xd')][_0xf631('0xf')]);return _0x399ed7(_0x463fc4[_0xf631('0xd')]['message']);}logger[_0xf631('0xd')](_0xf631('0x9'),_0x10d618,_0x463fc4['error'][_0xf631('0xf')]);return _0x22672d(_0x463fc4['error'][_0xf631('0xf')]);}else{logger[_0xf631('0x10')](_0xf631('0x9'),_0x10d618,_0xf631('0xa'));_0x22672d(_0x463fc4[_0xf631('0x11')][_0xf631('0xf')]);}})['catch'](function(_0xce5ed8){logger[_0xf631('0xd')](_0xf631('0x9'),_0x10d618,_0xce5ed8);_0x399ed7(_0xce5ed8);});});} \ No newline at end of file +var _0xecb0=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerField,\x20%s,\x20%s','result','catch','lodash','bluebird'];(function(_0x349a9e,_0x473cb8){var _0x24c207=function(_0x22f148){while(--_0x22f148){_0x349a9e['push'](_0x349a9e['shift']());}};_0x24c207(++_0x473cb8);}(_0xecb0,0x157));var _0x0ecb=function(_0x48a59f,_0x265958){_0x48a59f=_0x48a59f-0x0;var _0xe3ec68=_0xecb0[_0x48a59f];return _0xe3ec68;};'use strict';var _=require(_0x0ecb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0ecb('0x1'));var rs=require(_0x0ecb('0x2'));var fs=require('fs');var Redis=require(_0x0ecb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ecb('0x4'));var logger=require(_0x0ecb('0x5'))(_0x0ecb('0x6'));var config=require(_0x0ecb('0x7'));var jayson=require(_0x0ecb('0x8'));var client=jayson[_0x0ecb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45c7a3,_0x3933cf,_0x418dcc){return new BPromise(function(_0x33f1a8,_0x4cea46){return client[_0x0ecb('0xa')](_0x45c7a3,_0x418dcc)[_0x0ecb('0xb')](function(_0x197521){logger[_0x0ecb('0xc')]('VtigerField,\x20%s,\x20%s',_0x3933cf,_0x0ecb('0xd'));logger[_0x0ecb('0xe')](_0x0ecb('0xf'),_0x3933cf,'request\x20sent',JSON[_0x0ecb('0x10')](_0x197521));if(_0x197521[_0x0ecb('0x11')]){if(_0x197521['error'][_0x0ecb('0x12')]===0x1f4){logger[_0x0ecb('0x11')]('VtigerField,\x20%s,\x20%s',_0x3933cf,_0x197521[_0x0ecb('0x11')][_0x0ecb('0x13')]);return _0x4cea46(_0x197521[_0x0ecb('0x11')][_0x0ecb('0x13')]);}logger[_0x0ecb('0x11')](_0x0ecb('0x14'),_0x3933cf,_0x197521['error'][_0x0ecb('0x13')]);return _0x33f1a8(_0x197521[_0x0ecb('0x11')][_0x0ecb('0x13')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x3933cf,_0x0ecb('0xd'));_0x33f1a8(_0x197521[_0x0ecb('0x15')][_0x0ecb('0x13')]);}})[_0x0ecb('0x16')](function(_0x44ca48){logger[_0x0ecb('0x11')](_0x0ecb('0x14'),_0x3933cf,_0x44ca48);_0x4cea46(_0x44ca48);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 2a161aa..e675863 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 _0xd02a=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','/:id/configurations','isAuthenticated','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy','multer'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0xd02a,0x1cb));var _0xad02=function(_0x359955,_0x5089e8){_0x359955=_0x359955-0x0;var _0xe5175f=_0xd02a[_0x359955];return _0xe5175f;};'use strict';var multer=require(_0xad02('0x0'));var util=require(_0xad02('0x1'));var path=require(_0xad02('0x2'));var timeout=require(_0xad02('0x3'));var express=require(_0xad02('0x4'));var router=express[_0xad02('0x5')]();var fs_extra=require(_0xad02('0x6'));var auth=require(_0xad02('0x7'));var interaction=require(_0xad02('0x8'));var config=require(_0xad02('0x9'));var controller=require(_0xad02('0xa'));router[_0xad02('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xad02('0xc'),auth[_0xad02('0xd')](),controller['getConfigurations']);router[_0xad02('0xb')](_0xad02('0xe'),auth[_0xad02('0xd')](),controller[_0xad02('0xf')]);router[_0xad02('0x10')]('/',auth[_0xad02('0xd')](),controller[_0xad02('0x11')]);router['post'](_0xad02('0xc'),auth[_0xad02('0xd')](),controller['addConfiguration']);router[_0xad02('0x12')](_0xad02('0x13'),auth[_0xad02('0xd')](),controller[_0xad02('0x14')]);router[_0xad02('0x15')]('/:id',auth[_0xad02('0xd')](),controller[_0xad02('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0e4e=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x32eb59,_0x42136a){var _0x134887=function(_0x355aff){while(--_0x355aff){_0x32eb59['push'](_0x32eb59['shift']());}};_0x134887(++_0x42136a);}(_0x0e4e,0xb8));var _0xe0e4=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x0e4e[_0x352e09];return _0x1b7094;};'use strict';var multer=require('multer');var util=require(_0xe0e4('0x0'));var path=require(_0xe0e4('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0e4('0x2'));var router=express[_0xe0e4('0x3')]();var fs_extra=require(_0xe0e4('0x4'));var auth=require(_0xe0e4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe0e4('0x6'));var controller=require(_0xe0e4('0x7'));router[_0xe0e4('0x8')]('/',auth[_0xe0e4('0x9')](),controller[_0xe0e4('0xa')]);router[_0xe0e4('0x8')]('/:id',auth[_0xe0e4('0x9')](),controller[_0xe0e4('0xb')]);router['get'](_0xe0e4('0xc'),auth[_0xe0e4('0x9')](),controller['getConfigurations']);router[_0xe0e4('0x8')](_0xe0e4('0xd'),auth[_0xe0e4('0x9')](),controller[_0xe0e4('0xe')]);router[_0xe0e4('0xf')]('/',auth[_0xe0e4('0x9')](),controller[_0xe0e4('0x10')]);router[_0xe0e4('0xf')](_0xe0e4('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xe0e4('0x11')](_0xe0e4('0x12'),auth[_0xe0e4('0x9')](),controller[_0xe0e4('0x13')]);router[_0xe0e4('0x14')](_0xe0e4('0x12'),auth['isAuthenticated'](),controller[_0xe0e4('0x15')]);module[_0xe0e4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 068b945..389bf66 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 _0x2bab=['integrationTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2bab,0x1ba));var _0xb2ba=function(_0x48ae31,_0x5c59be){_0x48ae31=_0x48ae31-0x0;var _0x328431=_0x2bab[_0x48ae31];return _0x328431;};'use strict';var Sequelize=require(_0xb2ba('0x0'));module[_0xb2ba('0x1')]={'name':{'type':Sequelize[_0xb2ba('0x2')]},'description':{'type':Sequelize[_0xb2ba('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xb2ba('0x3')},'password':{'type':Sequelize[_0xb2ba('0x2')]},'token':{'type':Sequelize[_0xb2ba('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xb2ba('0x4')},'authType':{'type':Sequelize[_0xb2ba('0x5')]('password','token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xb2ba('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb2ba('0x6'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x3d49=['integrationTab','exports','STRING','remoteUri','ENUM','password'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3d49,0x151));var _0x93d4=function(_0x2d3206,_0x434cf5){_0x2d3206=_0x2d3206-0x0;var _0x18702d=_0x3d49[_0x2d3206];return _0x18702d;};'use strict';var Sequelize=require('sequelize');module[_0x93d4('0x0')]={'name':{'type':Sequelize[_0x93d4('0x1')]},'description':{'type':Sequelize[_0x93d4('0x1')]},'username':{'type':Sequelize[_0x93d4('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x93d4('0x1')]},'token':{'type':Sequelize[_0x93d4('0x1')]},'remoteUri':{'type':Sequelize[_0x93d4('0x1')],'unique':_0x93d4('0x2')},'authType':{'type':Sequelize[_0x93d4('0x3')](_0x93d4('0x4'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x93d4('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index f0c9bed..26e63cf 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 _0xb7e7=['channel','getDescriptions','ZendeskField','Subjects','Descriptions','password','token','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','authType','headers','format','Basic\x20%s','%s:%s','username','base64','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','ZendeskAccount','findAll','rows','show','params','length','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','options','AccountId','getSubjects'];(function(_0x4a1ffd,_0x354029){var _0x528861=function(_0x5a943f){while(--_0x5a943f){_0x4a1ffd['push'](_0x4a1ffd['shift']());}};_0x528861(++_0x354029);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb7e7[_0xc67528];return _0x38e26d;};'use strict';var emlformat=require(_0x7b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b7e('0x2'));var moment=require('moment');var BPromise=require(_0x7b7e('0x3'));var Mustache=require('mustache');var util=require(_0x7b7e('0x4'));var path=require(_0x7b7e('0x5'));var sox=require(_0x7b7e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b7e('0x7'));var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var licenseUtil=require(_0x7b7e('0x17'));var db=require(_0x7b7e('0x18'))['db'];var integrations=require(_0x7b7e('0x19'));function respondWithStatusCode(_0x54d8ce,_0x267446){_0x267446=_0x267446||0xcc;return function(_0x430eab){if(_0x430eab){return _0x54d8ce['sendStatus'](_0x267446);}return _0x54d8ce[_0x7b7e('0x1a')](_0x267446)['end']();};}function respondWithResult(_0x4c6011,_0x2889ed){_0x2889ed=_0x2889ed||0xc8;return function(_0xd304f5){if(_0xd304f5){return _0x4c6011[_0x7b7e('0x1a')](_0x2889ed)[_0x7b7e('0x1b')](_0xd304f5);}};}function respondWithFilteredResult(_0x3d2fb2,_0x5703fd){return function(_0x51baf6){if(_0x51baf6){var _0xc7f087=typeof _0x5703fd[_0x7b7e('0x1c')]===_0x7b7e('0x1d')&&typeof _0x5703fd[_0x7b7e('0x1e')]===_0x7b7e('0x1d');var _0x3bf2f0=_0x51baf6[_0x7b7e('0x1f')];var _0x200ef7=_0xc7f087?0x0:_0x5703fd[_0x7b7e('0x1c')];var _0x429a0e=_0xc7f087?_0x51baf6[_0x7b7e('0x1f')]:_0x5703fd[_0x7b7e('0x1c')]+_0x5703fd[_0x7b7e('0x1e')];var _0x3bec7d;if(_0x429a0e>=_0x3bf2f0){_0x429a0e=_0x3bf2f0;_0x3bec7d=0xc8;}else{_0x3bec7d=0xce;}_0x3d2fb2[_0x7b7e('0x1a')](_0x3bec7d);return _0x3d2fb2[_0x7b7e('0x20')](_0x7b7e('0x21'),_0x200ef7+'-'+_0x429a0e+'/'+_0x3bf2f0)['json'](_0x51baf6);}return null;};}function patchUpdates(_0x69262b){return function(_0x43db4f){try{jsonpatch[_0x7b7e('0x22')](_0x43db4f,_0x69262b,!![]);}catch(_0x4c0647){return BPromise[_0x7b7e('0x23')](_0x4c0647);}return _0x43db4f[_0x7b7e('0x24')]();};}function saveUpdates(_0x14243b,_0x200156){return function(_0x2b7211){if(_0x2b7211){return _0x2b7211[_0x7b7e('0x25')](_0x14243b)[_0x7b7e('0x26')](function(_0x10a66a){return _0x10a66a;});}return null;};}function removeEntity(_0x53bbb3,_0x5d6215){return function(_0x4a836a){if(_0x4a836a){return _0x4a836a[_0x7b7e('0x27')]()[_0x7b7e('0x26')](function(){_0x53bbb3[_0x7b7e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d3b1,_0x5dadbb){return function(_0x182245){if(!_0x182245){_0x51d3b1[_0x7b7e('0x28')](0x194);}return _0x182245;};}function handleError(_0x16a3c7,_0x7aa71){_0x7aa71=_0x7aa71||0x1f4;return function(_0x3ceaf5){logger['error'](_0x3ceaf5[_0x7b7e('0x29')]);if(_0x3ceaf5[_0x7b7e('0x2a')]){delete _0x3ceaf5['name'];}_0x16a3c7['status'](_0x7aa71)['send'](_0x3ceaf5);};}exports[_0x7b7e('0x2b')]=function(_0x423832,_0x503625){var _0x3db8c4={},_0x51d4b5={},_0x1b4341={'count':0x0,'rows':[]};var _0xb9b6bf=_[_0x7b7e('0x2c')](db['ZendeskAccount'][_0x7b7e('0x2d')],function(_0xe31336){return{'name':_0xe31336[_0x7b7e('0x2e')],'type':_0xe31336[_0x7b7e('0x2f')][_0x7b7e('0x30')]};});_0x51d4b5['model']=_[_0x7b7e('0x2c')](_0xb9b6bf,'name');_0x51d4b5[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x423832[_0x7b7e('0x31')]);_0x51d4b5[_0x7b7e('0x33')]=_[_0x7b7e('0x34')](_0x51d4b5[_0x7b7e('0x35')],_0x51d4b5[_0x7b7e('0x31')]);_0x3db8c4['attributes']=_['intersection'](_0x51d4b5[_0x7b7e('0x35')],qs[_0x7b7e('0x36')](_0x423832['query'][_0x7b7e('0x36')]));_0x3db8c4[_0x7b7e('0x37')]=_0x3db8c4[_0x7b7e('0x37')]['length']?_0x3db8c4[_0x7b7e('0x37')]:_0x51d4b5[_0x7b7e('0x35')];if(!_0x423832[_0x7b7e('0x31')][_0x7b7e('0x38')](_0x7b7e('0x39'))){_0x3db8c4[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x423832[_0x7b7e('0x31')][_0x7b7e('0x1e')]);_0x3db8c4[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x423832[_0x7b7e('0x31')][_0x7b7e('0x1c')]);}_0x3db8c4[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x423832[_0x7b7e('0x31')]['sort']);_0x3db8c4[_0x7b7e('0x3c')]=qs[_0x7b7e('0x33')](_[_0x7b7e('0x3d')](_0x423832[_0x7b7e('0x31')],_0x51d4b5[_0x7b7e('0x33')]),_0xb9b6bf);if(_0x423832[_0x7b7e('0x31')][_0x7b7e('0x3e')]){_0x3db8c4[_0x7b7e('0x3c')]=_[_0x7b7e('0x3f')](_0x3db8c4[_0x7b7e('0x3c')],{'$or':_['map'](_0xb9b6bf,function(_0x3d6571){if(_0x3d6571[_0x7b7e('0x2f')]!==_0x7b7e('0x40')){var _0x1d43da={};_0x1d43da[_0x3d6571['name']]={'$like':'%'+_0x423832[_0x7b7e('0x31')][_0x7b7e('0x3e')]+'%'};return _0x1d43da;}})});}_0x3db8c4=_[_0x7b7e('0x3f')]({},_0x3db8c4,_0x423832['options']);var _0x4a2888={'where':_0x3db8c4[_0x7b7e('0x3c')]};return db['ZendeskAccount'][_0x7b7e('0x1f')](_0x4a2888)[_0x7b7e('0x26')](function(_0x4de331){_0x1b4341[_0x7b7e('0x1f')]=_0x4de331;if(_0x423832[_0x7b7e('0x31')][_0x7b7e('0x41')]){_0x3db8c4[_0x7b7e('0x42')]=[{'all':!![]}];}return db[_0x7b7e('0x43')][_0x7b7e('0x44')](_0x3db8c4);})[_0x7b7e('0x26')](function(_0x1d9bb9){_0x1b4341[_0x7b7e('0x45')]=_0x1d9bb9;return _0x1b4341;})['then'](respondWithFilteredResult(_0x503625,_0x3db8c4))['catch'](handleError(_0x503625,null));};exports[_0x7b7e('0x46')]=function(_0x550ea6,_0x41c8a6){var _0x5e8b5d={'raw':![],'where':{'id':_0x550ea6[_0x7b7e('0x47')]['id']}},_0x48dd74={};_0x48dd74['model']=_[_0x7b7e('0x32')](db['ZendeskAccount'][_0x7b7e('0x2d')]);_0x48dd74[_0x7b7e('0x31')]=_[_0x7b7e('0x32')](_0x550ea6[_0x7b7e('0x31')]);_0x48dd74['filters']=_[_0x7b7e('0x34')](_0x48dd74[_0x7b7e('0x35')],_0x48dd74[_0x7b7e('0x31')]);_0x5e8b5d[_0x7b7e('0x37')]=_[_0x7b7e('0x34')](_0x48dd74[_0x7b7e('0x35')],qs['fields'](_0x550ea6['query']['fields']));_0x5e8b5d[_0x7b7e('0x37')]=_0x5e8b5d[_0x7b7e('0x37')][_0x7b7e('0x48')]?_0x5e8b5d[_0x7b7e('0x37')]:_0x48dd74[_0x7b7e('0x35')];if(_0x550ea6[_0x7b7e('0x31')]['includeAll']){_0x5e8b5d[_0x7b7e('0x42')]=[{'all':!![]}];}_0x5e8b5d=_[_0x7b7e('0x3f')]({},_0x5e8b5d,_0x550ea6['options']);return db['ZendeskAccount'][_0x7b7e('0x49')](_0x5e8b5d)[_0x7b7e('0x26')](handleEntityNotFound(_0x41c8a6,null))[_0x7b7e('0x26')](respondWithResult(_0x41c8a6,null))[_0x7b7e('0x4a')](handleError(_0x41c8a6,null));};exports[_0x7b7e('0x4b')]=function(_0xb46776,_0x590154){return db[_0x7b7e('0x43')]['create'](_0xb46776[_0x7b7e('0x4c')],{})[_0x7b7e('0x26')](respondWithResult(_0x590154,0xc9))[_0x7b7e('0x4a')](handleError(_0x590154,null));};exports[_0x7b7e('0x25')]=function(_0x58e4e6,_0x3b649e){if(_0x58e4e6[_0x7b7e('0x4c')]['id']){delete _0x58e4e6[_0x7b7e('0x4c')]['id'];}return db[_0x7b7e('0x43')][_0x7b7e('0x49')]({'where':{'id':_0x58e4e6['params']['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x3b649e,null))[_0x7b7e('0x26')](saveUpdates(_0x58e4e6[_0x7b7e('0x4c')],null))[_0x7b7e('0x26')](respondWithResult(_0x3b649e,null))[_0x7b7e('0x4a')](handleError(_0x3b649e,null));};exports['destroy']=function(_0x1d6d18,_0x29024e){return db[_0x7b7e('0x43')][_0x7b7e('0x49')]({'where':{'id':_0x1d6d18[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x29024e,null))[_0x7b7e('0x26')](removeEntity(_0x29024e,null))['catch'](handleError(_0x29024e,null));};exports[_0x7b7e('0x4d')]=function(_0x5d7c89,_0x16730c,_0x766a54){var _0x570303={};var _0x36f1be={};var _0x44e3a0;var _0x16c81d;return db[_0x7b7e('0x43')][_0x7b7e('0x4e')]({'where':{'id':_0x5d7c89[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x16730c,null))['then'](function(_0xbf044d){if(_0xbf044d){_0x44e3a0=_0xbf044d;_0x36f1be[_0x7b7e('0x35')]=_[_0x7b7e('0x32')](db[_0x7b7e('0x4f')]['rawAttributes']);_0x36f1be['query']=_['keys'](_0x5d7c89[_0x7b7e('0x31')]);_0x36f1be[_0x7b7e('0x33')]=_[_0x7b7e('0x34')](_0x36f1be['model'],_0x36f1be['query']);_0x570303[_0x7b7e('0x37')]=_[_0x7b7e('0x34')](_0x36f1be['model'],qs[_0x7b7e('0x36')](_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x36')]));_0x570303['attributes']=_0x570303[_0x7b7e('0x37')][_0x7b7e('0x48')]?_0x570303['attributes']:_0x36f1be[_0x7b7e('0x35')];_0x570303[_0x7b7e('0x3a')]=qs[_0x7b7e('0x3b')](_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x3b')]);_0x570303[_0x7b7e('0x3c')]=qs[_0x7b7e('0x33')](_[_0x7b7e('0x3d')](_0x5d7c89[_0x7b7e('0x31')],_0x36f1be['filters']));if(_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x3e')]){_0x570303['where']=_[_0x7b7e('0x3f')](_0x570303[_0x7b7e('0x3c')],{'$or':_[_0x7b7e('0x2c')](_0x570303['attributes'],function(_0x1729e0){var _0x4fc349={};_0x4fc349[_0x1729e0]={'$like':'%'+_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x3e')]+'%'};return _0x4fc349;})});}_0x570303=_['merge']({},_0x570303,_0x5d7c89[_0x7b7e('0x50')]);return _0x44e3a0[_0x7b7e('0x4d')](_0x570303);}})['then'](function(_0x2dcb35){if(_0x2dcb35){_0x16c81d=_0x2dcb35[_0x7b7e('0x48')];if(!_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x38')]('nolimit')){_0x570303[_0x7b7e('0x1e')]=qs[_0x7b7e('0x1e')](_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x1e')]);_0x570303[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x5d7c89[_0x7b7e('0x31')][_0x7b7e('0x1c')]);}return _0x44e3a0[_0x7b7e('0x4d')](_0x570303);}})[_0x7b7e('0x26')](function(_0x5b9010){if(_0x5b9010){return _0x5b9010?{'count':_0x16c81d,'rows':_0x5b9010}:null;}})[_0x7b7e('0x26')](respondWithResult(_0x16730c,null))['catch'](handleError(_0x16730c,null));};exports['addConfiguration']=function(_0x2b105a,_0x7cbe6c,_0x1eb4b1){if(_0x2b105a[_0x7b7e('0x4c')]['id']){delete _0x2b105a['body']['id'];}return db[_0x7b7e('0x43')][_0x7b7e('0x4e')]({'where':{'id':_0x2b105a[_0x7b7e('0x47')]['id']}})[_0x7b7e('0x26')](handleEntityNotFound(_0x7cbe6c,null))[_0x7b7e('0x26')](function(_0x2b2afd){if(_0x2b2afd){_0x2b105a['body'][_0x7b7e('0x51')]=_0x2b2afd['id'];_0x2b105a['body']['Subjects']=integrations[_0x7b7e('0x52')](_0x2b105a['body'][_0x7b7e('0x53')],_0x2b105a['body'][_0x7b7e('0x2f')]);_0x2b105a[_0x7b7e('0x4c')]['Descriptions']=integrations[_0x7b7e('0x54')](_0x2b105a[_0x7b7e('0x4c')]['channel'],_0x2b105a[_0x7b7e('0x4c')][_0x7b7e('0x2f')]);return db[_0x7b7e('0x4f')][_0x7b7e('0x4b')](_0x2b105a[_0x7b7e('0x4c')],{'include':[{'model':db[_0x7b7e('0x55')],'as':_0x7b7e('0x56')},{'model':db[_0x7b7e('0x55')],'as':_0x7b7e('0x57')}]});}return null;})[_0x7b7e('0x26')](respondWithResult(_0x7cbe6c,null))['catch'](handleError(_0x7cbe6c,null));};exports['getFields']=function(_0x34e7df,_0x46ac1f,_0x2c6e3a){var _0x348c77='';return db[_0x7b7e('0x43')][_0x7b7e('0x4e')]({'where':{'id':_0x34e7df[_0x7b7e('0x47')]['id']},'attributes':['id','username',_0x7b7e('0x58'),_0x7b7e('0x59'),'authType',_0x7b7e('0x5a')]})[_0x7b7e('0x26')](handleEntityNotFound(_0x46ac1f,null))[_0x7b7e('0x26')](function(_0x271318){if(_0x271318){_0x348c77=_0x271318[_0x7b7e('0x5a')];var _0x40f65e=_0x348c77[_0x7b7e('0x5b')](-0x1);if(_0x40f65e==='/'){_0x348c77=_0x348c77[_0x7b7e('0x5c')](0x0,_0x348c77[_0x7b7e('0x5d')](_0x40f65e));}var _0x3b6bc6={'method':_0x7b7e('0x5e'),'uri':util['format'](_0x7b7e('0x5f'),_0x348c77,_0x7b7e('0x60')),'json':!![]};switch(_0x271318[_0x7b7e('0x61')]){case _0x7b7e('0x58'):_0x3b6bc6[_0x7b7e('0x62')]={'Authorization':util[_0x7b7e('0x63')](_0x7b7e('0x64'),new Buffer(util['format'](_0x7b7e('0x65'),_0x271318[_0x7b7e('0x66')],_0x271318[_0x7b7e('0x58')]))['toString'](_0x7b7e('0x67')))};break;case _0x7b7e('0x59'):_0x3b6bc6[_0x7b7e('0x62')]={'Authorization':util[_0x7b7e('0x63')](_0x7b7e('0x64'),new Buffer(util['format']('%s/token:%s',_0x271318['username'],_0x271318[_0x7b7e('0x59')]))[_0x7b7e('0x68')](_0x7b7e('0x67')))};break;default:throw new db['Sequelize'][(_0x7b7e('0x69'))](_0x7b7e('0x6a'));}return rp(_0x3b6bc6);}})[_0x7b7e('0x26')](function(_0x5bf4d1){if(_0x5bf4d1){var _0x2983bf=[_0x7b7e('0x6b'),_0x7b7e('0x6c'),_0x7b7e('0x6d'),'assignee'];_[_0x7b7e('0x6e')](_0x5bf4d1[_0x7b7e('0x60')],function(_0xa52b93){return _0x2983bf[_0x7b7e('0x6f')](_0xa52b93['type']);});return{'count':_0x5bf4d1['ticket_fields'][_0x7b7e('0x48')],'rows':_['map'](_0x5bf4d1[_0x7b7e('0x60')],function(_0x4215b5){return{'id':_0x4215b5['id'],'name':_0x4215b5[_0x7b7e('0x70')]>0x7?_0x4215b5[_0x7b7e('0x71')]:_0x4215b5['type'],'custom':_0x4215b5[_0x7b7e('0x70')]>0x7?!![]:![],'options':_0x4215b5[_0x7b7e('0x72')]?_0x4215b5[_0x7b7e('0x72')]:_0x4215b5[_0x7b7e('0x73')]?_0x4215b5[_0x7b7e('0x73')]:[]};})};}})[_0x7b7e('0x26')](respondWithResult(_0x46ac1f,null))[_0x7b7e('0x4a')](function(_0x372478){var _0x44d8c4=_0x34e7df[_0x7b7e('0x31')][_0x7b7e('0x74')]?0x1f4:_0x372478[_0x7b7e('0x75')]||0x1f4;logger[_0x7b7e('0x76')](_0x7b7e('0x77'),_0x7b7e('0x78'),_0x44d8c4,JSON[_0x7b7e('0x79')](_0x372478));delete _0x372478['name'];if(_0x44d8c4===0x191){_0x44d8c4=0x190;}_0x46ac1f[_0x7b7e('0x1a')](_0x44d8c4)[_0x7b7e('0x7a')](_0x34e7df[_0x7b7e('0x31')][_0x7b7e('0x74')]?{'message':_0x7b7e('0x7b'),'statusCode':_0x372478[_0x7b7e('0x75')]}:_0x372478);});}; \ No newline at end of file +var _0x6e6c=['name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','getConfigurations','ZendeskConfiguration','sort','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','stack'];(function(_0xac550f,_0x1c46d6){var _0x1314e5=function(_0x1f8a49){while(--_0x1f8a49){_0xac550f['push'](_0xac550f['shift']());}};_0x1314e5(++_0x1c46d6);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xc6e6('0x0'));var rimraf=require(_0xc6e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e6('0x2'));var rp=require(_0xc6e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6e6('0x4'));var util=require('util');var path=require(_0xc6e6('0x5'));var sox=require('sox');var csv=require(_0xc6e6('0x6'));var ejs=require(_0xc6e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6e6('0x8'));var squel=require(_0xc6e6('0x9'));var crypto=require('crypto');var jsforce=require(_0xc6e6('0xa'));var deskjs=require(_0xc6e6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6e6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require(_0xc6e6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6e6('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3a30ce,_0x314d0f){_0x314d0f=_0x314d0f||0xcc;return function(_0x33aea0){if(_0x33aea0){return _0x3a30ce[_0xc6e6('0x17')](_0x314d0f);}return _0x3a30ce['status'](_0x314d0f)[_0xc6e6('0x18')]();};}function respondWithResult(_0x2bfe7d,_0x13be73){_0x13be73=_0x13be73||0xc8;return function(_0x1b6ca9){if(_0x1b6ca9){return _0x2bfe7d[_0xc6e6('0x19')](_0x13be73)['json'](_0x1b6ca9);}};}function respondWithFilteredResult(_0x413cf8,_0x178b34){return function(_0x569474){if(_0x569474){var _0x2f11b0=typeof _0x178b34[_0xc6e6('0x1a')]===_0xc6e6('0x1b')&&typeof _0x178b34['limit']==='undefined';var _0x5867bf=_0x569474[_0xc6e6('0x1c')];var _0x554262=_0x2f11b0?0x0:_0x178b34[_0xc6e6('0x1a')];var _0x2069e4=_0x2f11b0?_0x569474[_0xc6e6('0x1c')]:_0x178b34[_0xc6e6('0x1a')]+_0x178b34[_0xc6e6('0x1d')];var _0x3a0d83;if(_0x2069e4>=_0x5867bf){_0x2069e4=_0x5867bf;_0x3a0d83=0xc8;}else{_0x3a0d83=0xce;}_0x413cf8[_0xc6e6('0x19')](_0x3a0d83);return _0x413cf8[_0xc6e6('0x1e')](_0xc6e6('0x1f'),_0x554262+'-'+_0x2069e4+'/'+_0x5867bf)[_0xc6e6('0x20')](_0x569474);}return null;};}function patchUpdates(_0x4a36b6){return function(_0x428401){try{jsonpatch['apply'](_0x428401,_0x4a36b6,!![]);}catch(_0x1c34cc){return BPromise[_0xc6e6('0x21')](_0x1c34cc);}return _0x428401[_0xc6e6('0x22')]();};}function saveUpdates(_0x2f69f1,_0x4f1d68){return function(_0x35253d){if(_0x35253d){return _0x35253d[_0xc6e6('0x23')](_0x2f69f1)[_0xc6e6('0x24')](function(_0x36ebfa){return _0x36ebfa;});}return null;};}function removeEntity(_0x107561,_0x4c35ae){return function(_0x41fe96){if(_0x41fe96){return _0x41fe96['destroy']()[_0xc6e6('0x24')](function(){_0x107561[_0xc6e6('0x19')](0xcc)[_0xc6e6('0x18')]();});}};}function handleEntityNotFound(_0x64e1dc,_0x53a1bf){return function(_0x3ff8a4){if(!_0x3ff8a4){_0x64e1dc['sendStatus'](0x194);}return _0x3ff8a4;};}function handleError(_0x28577b,_0x534745){_0x534745=_0x534745||0x1f4;return function(_0x267c6a){logger[_0xc6e6('0x25')](_0x267c6a[_0xc6e6('0x26')]);if(_0x267c6a[_0xc6e6('0x27')]){delete _0x267c6a[_0xc6e6('0x27')];}_0x28577b['status'](_0x534745)[_0xc6e6('0x28')](_0x267c6a);};}exports[_0xc6e6('0x29')]=function(_0x166313,_0x1af05c){var _0x4d1284={},_0x34ae96={},_0x50b735={'count':0x0,'rows':[]};var _0x29411c=_[_0xc6e6('0x2a')](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')],function(_0xd3b63){return{'name':_0xd3b63[_0xc6e6('0x2d')],'type':_0xd3b63[_0xc6e6('0x2e')][_0xc6e6('0x2f')]};});_0x34ae96[_0xc6e6('0x30')]=_[_0xc6e6('0x2a')](_0x29411c,_0xc6e6('0x27'));_0x34ae96[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x166313[_0xc6e6('0x31')]);_0x34ae96[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x34ae96[_0xc6e6('0x30')],_0x34ae96['query']);_0x4d1284[_0xc6e6('0x35')]=_[_0xc6e6('0x34')](_0x34ae96['model'],qs['fields'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x4d1284[_0xc6e6('0x35')]=_0x4d1284[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x4d1284[_0xc6e6('0x35')]:_0x34ae96['model'];if(!_0x166313[_0xc6e6('0x31')][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x4d1284['limit']=qs['limit'](_0x166313[_0xc6e6('0x31')][_0xc6e6('0x1d')]);_0x4d1284[_0xc6e6('0x1a')]=qs[_0xc6e6('0x1a')](_0x166313['query']['offset']);}_0x4d1284[_0xc6e6('0x3a')]=qs['sort'](_0x166313[_0xc6e6('0x31')]['sort']);_0x4d1284[_0xc6e6('0x3b')]=qs[_0xc6e6('0x33')](_[_0xc6e6('0x3c')](_0x166313[_0xc6e6('0x31')],_0x34ae96['filters']),_0x29411c);if(_0x166313['query'][_0xc6e6('0x3d')]){_0x4d1284[_0xc6e6('0x3b')]=_[_0xc6e6('0x3e')](_0x4d1284[_0xc6e6('0x3b')],{'$or':_['map'](_0x29411c,function(_0x4cbdcf){if(_0x4cbdcf[_0xc6e6('0x2e')]!==_0xc6e6('0x3f')){var _0x3a9104={};_0x3a9104[_0x4cbdcf[_0xc6e6('0x27')]]={'$like':'%'+_0x166313['query'][_0xc6e6('0x3d')]+'%'};return _0x3a9104;}})});}_0x4d1284=_[_0xc6e6('0x3e')]({},_0x4d1284,_0x166313['options']);var _0x500b7e={'where':_0x4d1284[_0xc6e6('0x3b')]};return db['ZendeskAccount'][_0xc6e6('0x1c')](_0x500b7e)[_0xc6e6('0x24')](function(_0x53d313){_0x50b735[_0xc6e6('0x1c')]=_0x53d313;if(_0x166313['query'][_0xc6e6('0x40')]){_0x4d1284['include']=[{'all':!![]}];}return db[_0xc6e6('0x2b')][_0xc6e6('0x41')](_0x4d1284);})[_0xc6e6('0x24')](function(_0x2f7af9){_0x50b735[_0xc6e6('0x42')]=_0x2f7af9;return _0x50b735;})[_0xc6e6('0x24')](respondWithFilteredResult(_0x1af05c,_0x4d1284))[_0xc6e6('0x43')](handleError(_0x1af05c,null));};exports[_0xc6e6('0x44')]=function(_0x5ecf6c,_0x5722db){var _0x3e3da6={'raw':![],'where':{'id':_0x5ecf6c[_0xc6e6('0x45')]['id']}},_0x2b494f={};_0x2b494f[_0xc6e6('0x30')]=_['keys'](db[_0xc6e6('0x2b')][_0xc6e6('0x2c')]);_0x2b494f[_0xc6e6('0x31')]=_[_0xc6e6('0x32')](_0x5ecf6c['query']);_0x2b494f[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x2b494f[_0xc6e6('0x30')],_0x2b494f[_0xc6e6('0x31')]);_0x3e3da6[_0xc6e6('0x35')]=_['intersection'](_0x2b494f[_0xc6e6('0x30')],qs['fields'](_0x5ecf6c[_0xc6e6('0x31')]['fields']));_0x3e3da6[_0xc6e6('0x35')]=_0x3e3da6[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x3e3da6[_0xc6e6('0x35')]:_0x2b494f[_0xc6e6('0x30')];if(_0x5ecf6c[_0xc6e6('0x31')][_0xc6e6('0x40')]){_0x3e3da6[_0xc6e6('0x46')]=[{'all':!![]}];}_0x3e3da6=_['merge']({},_0x3e3da6,_0x5ecf6c[_0xc6e6('0x47')]);return db[_0xc6e6('0x2b')][_0xc6e6('0x48')](_0x3e3da6)['then'](handleEntityNotFound(_0x5722db,null))[_0xc6e6('0x24')](respondWithResult(_0x5722db,null))[_0xc6e6('0x43')](handleError(_0x5722db,null));};exports[_0xc6e6('0x49')]=function(_0x42ed90,_0x7ba471){return db[_0xc6e6('0x2b')][_0xc6e6('0x49')](_0x42ed90[_0xc6e6('0x4a')],{})[_0xc6e6('0x24')](respondWithResult(_0x7ba471,0xc9))[_0xc6e6('0x43')](handleError(_0x7ba471,null));};exports[_0xc6e6('0x23')]=function(_0x470167,_0x3e0117){if(_0x470167[_0xc6e6('0x4a')]['id']){delete _0x470167['body']['id'];}return db[_0xc6e6('0x2b')]['find']({'where':{'id':_0x470167[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x3e0117,null))['then'](saveUpdates(_0x470167['body'],null))['then'](respondWithResult(_0x3e0117,null))['catch'](handleError(_0x3e0117,null));};exports['destroy']=function(_0x3edc16,_0x40bbe9){return db[_0xc6e6('0x2b')][_0xc6e6('0x48')]({'where':{'id':_0x3edc16[_0xc6e6('0x45')]['id']}})['then'](handleEntityNotFound(_0x40bbe9,null))['then'](removeEntity(_0x40bbe9,null))[_0xc6e6('0x43')](handleError(_0x40bbe9,null));};exports[_0xc6e6('0x4b')]=function(_0x1aa872,_0x48ba2e,_0x577840){var _0x120a00={};var _0x467e9b={};var _0x286dc1;var _0x286dcf;return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x1aa872[_0xc6e6('0x45')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x48ba2e,null))[_0xc6e6('0x24')](function(_0x5113e3){if(_0x5113e3){_0x286dc1=_0x5113e3;_0x467e9b[_0xc6e6('0x30')]=_[_0xc6e6('0x32')](db[_0xc6e6('0x4c')][_0xc6e6('0x2c')]);_0x467e9b[_0xc6e6('0x31')]=_['keys'](_0x1aa872[_0xc6e6('0x31')]);_0x467e9b[_0xc6e6('0x33')]=_[_0xc6e6('0x34')](_0x467e9b[_0xc6e6('0x30')],_0x467e9b[_0xc6e6('0x31')]);_0x120a00['attributes']=_['intersection'](_0x467e9b['model'],qs[_0xc6e6('0x36')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x36')]));_0x120a00[_0xc6e6('0x35')]=_0x120a00[_0xc6e6('0x35')][_0xc6e6('0x37')]?_0x120a00['attributes']:_0x467e9b[_0xc6e6('0x30')];_0x120a00['order']=qs[_0xc6e6('0x4d')](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x4d')]);_0x120a00['where']=qs[_0xc6e6('0x33')](_['pick'](_0x1aa872[_0xc6e6('0x31')],_0x467e9b['filters']));if(_0x1aa872['query'][_0xc6e6('0x3d')]){_0x120a00['where']=_['merge'](_0x120a00[_0xc6e6('0x3b')],{'$or':_[_0xc6e6('0x2a')](_0x120a00[_0xc6e6('0x35')],function(_0x20c4cf){var _0x414bc4={};_0x414bc4[_0x20c4cf]={'$like':'%'+_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x3d')]+'%'};return _0x414bc4;})});}_0x120a00=_[_0xc6e6('0x3e')]({},_0x120a00,_0x1aa872['options']);return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x35b43f){if(_0x35b43f){_0x286dcf=_0x35b43f[_0xc6e6('0x37')];if(!_0x1aa872['query'][_0xc6e6('0x38')](_0xc6e6('0x39'))){_0x120a00[_0xc6e6('0x1d')]=qs['limit'](_0x1aa872['query'][_0xc6e6('0x1d')]);_0x120a00['offset']=qs['offset'](_0x1aa872[_0xc6e6('0x31')][_0xc6e6('0x1a')]);}return _0x286dc1[_0xc6e6('0x4b')](_0x120a00);}})[_0xc6e6('0x24')](function(_0x269f63){if(_0x269f63){return _0x269f63?{'count':_0x286dcf,'rows':_0x269f63}:null;}})[_0xc6e6('0x24')](respondWithResult(_0x48ba2e,null))[_0xc6e6('0x43')](handleError(_0x48ba2e,null));};exports[_0xc6e6('0x4e')]=function(_0x8bfc70,_0x1956be,_0x15404a){if(_0x8bfc70['body']['id']){delete _0x8bfc70['body']['id'];}return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x8bfc70['params']['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x1956be,null))[_0xc6e6('0x24')](function(_0x27c5f0){if(_0x27c5f0){_0x8bfc70['body'][_0xc6e6('0x4f')]=_0x27c5f0['id'];_0x8bfc70[_0xc6e6('0x4a')]['Subjects']=integrations['getSubjects'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x51')]=integrations['getDescriptions'](_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x50')],_0x8bfc70[_0xc6e6('0x4a')][_0xc6e6('0x2e')]);return db[_0xc6e6('0x4c')]['create'](_0x8bfc70[_0xc6e6('0x4a')],{'include':[{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x53')},{'model':db[_0xc6e6('0x52')],'as':_0xc6e6('0x51')}]});}return null;})[_0xc6e6('0x24')](respondWithResult(_0x1956be,null))['catch'](handleError(_0x1956be,null));};exports[_0xc6e6('0x54')]=function(_0x4c4985,_0x46c3df,_0x5c2cfc){var _0x55cec5='';return db[_0xc6e6('0x2b')]['findOne']({'where':{'id':_0x4c4985[_0xc6e6('0x45')]['id']},'attributes':['id',_0xc6e6('0x55'),_0xc6e6('0x56'),_0xc6e6('0x57'),_0xc6e6('0x58'),'remoteUri']})[_0xc6e6('0x24')](handleEntityNotFound(_0x46c3df,null))['then'](function(_0x4bdac6){if(_0x4bdac6){_0x55cec5=_0x4bdac6[_0xc6e6('0x59')];var _0xc38c57=_0x55cec5[_0xc6e6('0x5a')](-0x1);if(_0xc38c57==='/'){_0x55cec5=_0x55cec5['substring'](0x0,_0x55cec5[_0xc6e6('0x5b')](_0xc38c57));}var _0x4ec143={'method':'GET','uri':util[_0xc6e6('0x5c')]('%s/%s',_0x55cec5,_0xc6e6('0x5d')),'json':!![]};switch(_0x4bdac6[_0xc6e6('0x58')]){case _0xc6e6('0x56'):_0x4ec143[_0xc6e6('0x5e')]={'Authorization':util['format'](_0xc6e6('0x5f'),new Buffer(util[_0xc6e6('0x5c')](_0xc6e6('0x60'),_0x4bdac6[_0xc6e6('0x55')],_0x4bdac6[_0xc6e6('0x56')]))['toString'](_0xc6e6('0x61')))};break;case _0xc6e6('0x57'):_0x4ec143[_0xc6e6('0x5e')]={'Authorization':util[_0xc6e6('0x5c')]('Basic\x20%s',new Buffer(util['format'](_0xc6e6('0x62'),_0x4bdac6[_0xc6e6('0x55')],_0x4bdac6[_0xc6e6('0x57')]))[_0xc6e6('0x63')](_0xc6e6('0x61')))};break;default:throw new db[(_0xc6e6('0x64'))][(_0xc6e6('0x65'))](_0xc6e6('0x66'));}return rp(_0x4ec143);}})[_0xc6e6('0x24')](function(_0x4bbe4c){if(_0x4bbe4c){var _0x506679=[_0xc6e6('0x67'),'description',_0xc6e6('0x68'),_0xc6e6('0x69')];_[_0xc6e6('0x6a')](_0x4bbe4c['ticket_fields'],function(_0x5b0c3b){return _0x506679[_0xc6e6('0x6b')](_0x5b0c3b['type']);});return{'count':_0x4bbe4c[_0xc6e6('0x5d')]['length'],'rows':_[_0xc6e6('0x2a')](_0x4bbe4c[_0xc6e6('0x5d')],function(_0x5d867e){return{'id':_0x5d867e['id'],'name':_0x5d867e[_0xc6e6('0x6c')]>0x7?_0x5d867e[_0xc6e6('0x6d')]:_0x5d867e[_0xc6e6('0x2e')],'custom':_0x5d867e['position']>0x7?!![]:![],'options':_0x5d867e[_0xc6e6('0x6e')]?_0x5d867e[_0xc6e6('0x6e')]:_0x5d867e[_0xc6e6('0x6f')]?_0x5d867e['custom_field_options']:[]};})};}})[_0xc6e6('0x24')](respondWithResult(_0x46c3df,null))[_0xc6e6('0x43')](function(_0x4e7b05){var _0x4e0add=_0x4c4985['query'][_0xc6e6('0x70')]?0x1f4:_0x4e7b05[_0xc6e6('0x71')]||0x1f4;logger[_0xc6e6('0x25')](_0xc6e6('0x72'),_0xc6e6('0x54'),_0x4e0add,JSON[_0xc6e6('0x73')](_0x4e7b05));delete _0x4e7b05['name'];if(_0x4e0add===0x191){_0x4e0add=0x190;}_0x46c3df[_0xc6e6('0x19')](_0x4e0add)['send'](_0x4c4985[_0xc6e6('0x31')][_0xc6e6('0x70')]?{'message':_0xc6e6('0x74'),'statusCode':_0x4e7b05['statusCode']}:_0x4e7b05);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 369f0e9..d33dbe1 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 _0x53bf=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x2caaef,_0x3c19ed){var _0xd011f8=function(_0x318656){while(--_0x318656){_0x2caaef['push'](_0x2caaef['shift']());}};_0xd011f8(++_0x3c19ed);}(_0x53bf,0xcc));var _0xf53b=function(_0x43b0c6,_0x343b4e){_0x43b0c6=_0x43b0c6-0x0;var _0x4c3430=_0x53bf[_0x43b0c6];return _0x4c3430;};'use strict';var _=require(_0xf53b('0x0'));var util=require(_0xf53b('0x1'));var logger=require(_0xf53b('0x2'))(_0xf53b('0x3'));var moment=require(_0xf53b('0x4'));var BPromise=require(_0xf53b('0x5'));var rp=require(_0xf53b('0x6'));var fs=require('fs');var path=require(_0xf53b('0x7'));var rimraf=require(_0xf53b('0x8'));var config=require(_0xf53b('0x9'));var attributes=require(_0xf53b('0xa'));var integrations=require(_0xf53b('0xb'));module[_0xf53b('0xc')]=function(_0x20d493,_0xcf21e){return _0x20d493[_0xf53b('0xd')](_0xf53b('0xe'),attributes,{'tableName':_0xf53b('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x227d=['path','rimraf','./intZendeskAccount.attributes','define','int_zendesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x227d,0x68));var _0xd227=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0x227d[_0x378b4];return _0x11d07b;};'use strict';var _=require('lodash');var util=require(_0xd227('0x0'));var logger=require(_0xd227('0x1'))(_0xd227('0x2'));var moment=require(_0xd227('0x3'));var BPromise=require(_0xd227('0x4'));var rp=require(_0xd227('0x5'));var fs=require('fs');var path=require(_0xd227('0x6'));var rimraf=require(_0xd227('0x7'));var config=require('../../config/environment');var attributes=require(_0xd227('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x14b19a,_0x30ecc1){return _0x14b19a[_0xd227('0x9')]('ZendeskAccount',attributes,{'tableName':_0xd227('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 2b88db2..cfa5a97 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 _0x96ef=['message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug','catch','ShowZendeskAccount','find','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x92be51,_0x5ddb72){var _0x1a56f3=function(_0x300981){while(--_0x300981){_0x92be51['push'](_0x92be51['shift']());}};_0x1a56f3(++_0x5ddb72);}(_0x96ef,0x1b5));var _0xf96e=function(_0x2a2b58,_0x26ffe1){_0x2a2b58=_0x2a2b58-0x0;var _0x487987=_0x96ef[_0x2a2b58];return _0x487987;};'use strict';var _=require(_0xf96e('0x0'));var util=require(_0xf96e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf96e('0x2'));var fs=require('fs');var Redis=require(_0xf96e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf96e('0x4'));var logger=require('../../config/logger')(_0xf96e('0x5'));var config=require(_0xf96e('0x6'));var jayson=require(_0xf96e('0x7'));var client=jayson[_0xf96e('0x8')][_0xf96e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xafd043,_0x41a7f2,_0x97e2e){return new BPromise(function(_0x53e549,_0x127f42){return client[_0xf96e('0xa')](_0xafd043,_0x97e2e)[_0xf96e('0xb')](function(_0x238b23){logger[_0xf96e('0xc')](_0xf96e('0xd'),_0x41a7f2,_0xf96e('0xe'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x41a7f2,_0xf96e('0xe'),JSON[_0xf96e('0xf')](_0x238b23));if(_0x238b23['error']){if(_0x238b23[_0xf96e('0x10')][_0xf96e('0x11')]===0x1f4){logger[_0xf96e('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x41a7f2,_0x238b23[_0xf96e('0x10')]['message']);return _0x127f42(_0x238b23[_0xf96e('0x10')][_0xf96e('0x12')]);}logger[_0xf96e('0x10')](_0xf96e('0xd'),_0x41a7f2,_0x238b23[_0xf96e('0x10')][_0xf96e('0x12')]);return _0x53e549(_0x238b23[_0xf96e('0x10')][_0xf96e('0x12')]);}else{logger['info'](_0xf96e('0xd'),_0x41a7f2,'request\x20sent');_0x53e549(_0x238b23[_0xf96e('0x13')]['message']);}})['catch'](function(_0x278742){logger[_0xf96e('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x41a7f2,_0x278742);_0x127f42(_0x278742);});});}exports[_0xf96e('0x14')]=function(_0x20445a){var _0x5bd0df=this;return new Promise(function(_0x1409a4,_0x4368f8){return db[_0xf96e('0x15')][_0xf96e('0x16')]({'raw':_0x20445a[_0xf96e('0x17')]?_0x20445a[_0xf96e('0x17')][_0xf96e('0x18')]===undefined?!![]:![]:!![],'where':_0x20445a[_0xf96e('0x17')]?_0x20445a[_0xf96e('0x17')][_0xf96e('0x19')]||null:null,'attributes':_0x20445a[_0xf96e('0x17')]?_0x20445a[_0xf96e('0x17')][_0xf96e('0x1a')]||null:null,'limit':_0x20445a[_0xf96e('0x17')]?_0x20445a[_0xf96e('0x17')][_0xf96e('0x1b')]||null:null,'include':_0x20445a['options']?_0x20445a[_0xf96e('0x17')]['include']?_[_0xf96e('0x1c')](_0x20445a[_0xf96e('0x17')][_0xf96e('0x1d')],function(_0x3074a3){return{'model':db[_0x3074a3['model']],'as':_0x3074a3['as'],'attributes':_0x3074a3[_0xf96e('0x1a')],'include':_0x3074a3[_0xf96e('0x1d')]?_[_0xf96e('0x1c')](_0x3074a3[_0xf96e('0x1d')],function(_0x45b27d){return{'model':db[_0x45b27d[_0xf96e('0x1e')]],'as':_0x45b27d['as'],'attributes':_0x45b27d[_0xf96e('0x1a')],'include':_0x45b27d[_0xf96e('0x1d')]?_[_0xf96e('0x1c')](_0x45b27d['include'],function(_0x4dfebc){return{'model':db[_0x4dfebc[_0xf96e('0x1e')]],'as':_0x4dfebc['as'],'attributes':_0x4dfebc[_0xf96e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf96e('0xb')](function(_0x30a61c){logger[_0xf96e('0xc')](_0xf96e('0x14'),_0x20445a);logger[_0xf96e('0x1f')](_0xf96e('0x14'),_0x20445a,JSON[_0xf96e('0xf')](_0x30a61c));_0x1409a4(_0x30a61c);})[_0xf96e('0x20')](function(_0x14dc6e){logger[_0xf96e('0x10')]('GetZendeskAccount',_0x14dc6e[_0xf96e('0x12')],_0x20445a);_0x4368f8(_0x5bd0df['error'](0x1f4,_0x14dc6e[_0xf96e('0x12')]));});});};exports[_0xf96e('0x21')]=function(_0x2b1f51){var _0x4d42da=this;return new Promise(function(_0x20b46b,_0x512b65){return db[_0xf96e('0x15')][_0xf96e('0x22')]({'raw':_0x2b1f51[_0xf96e('0x17')]?_0x2b1f51['options'][_0xf96e('0x18')]===undefined?!![]:![]:!![],'where':_0x2b1f51[_0xf96e('0x17')]?_0x2b1f51[_0xf96e('0x17')]['where']||null:null,'attributes':_0x2b1f51[_0xf96e('0x17')]?_0x2b1f51[_0xf96e('0x17')]['attributes']||null:null,'include':_0x2b1f51[_0xf96e('0x17')]?_0x2b1f51['options'][_0xf96e('0x1d')]?_[_0xf96e('0x1c')](_0x2b1f51[_0xf96e('0x17')][_0xf96e('0x1d')],function(_0x1dfb0b){return{'model':db[_0x1dfb0b['model']],'as':_0x1dfb0b['as'],'attributes':_0x1dfb0b[_0xf96e('0x1a')],'include':_0x1dfb0b[_0xf96e('0x1d')]?_[_0xf96e('0x1c')](_0x1dfb0b['include'],function(_0x1b74fb){return{'model':db[_0x1b74fb[_0xf96e('0x1e')]],'as':_0x1b74fb['as'],'attributes':_0x1b74fb[_0xf96e('0x1a')],'include':_0x1b74fb[_0xf96e('0x1d')]?_['map'](_0x1b74fb[_0xf96e('0x1d')],function(_0x24e30c){return{'model':db[_0x24e30c[_0xf96e('0x1e')]],'as':_0x24e30c['as'],'attributes':_0x24e30c[_0xf96e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37ce63){logger[_0xf96e('0xc')](_0xf96e('0x21'),_0x2b1f51);logger[_0xf96e('0x1f')](_0xf96e('0x21'),_0x2b1f51,JSON[_0xf96e('0xf')](_0x37ce63));_0x20b46b(_0x37ce63);})['catch'](function(_0x1bdbdb){logger[_0xf96e('0x10')]('ShowZendeskAccount',_0x1bdbdb[_0xf96e('0x12')],_0x2b1f51);_0x512b65(_0x4d42da[_0xf96e('0x10')](0x1f4,_0x1bdbdb[_0xf96e('0x12')]));});});}; \ No newline at end of file +var _0x15f8=['catch','GetZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','ZendeskAccount','find','where','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x15f8,0x149));var _0x815f=function(_0x5bed61,_0x349080){_0x5bed61=_0x5bed61-0x0;var _0x4df287=_0x15f8[_0x5bed61];return _0x4df287;};'use strict';var _=require(_0x815f('0x0'));var util=require('util');var moment=require(_0x815f('0x1'));var BPromise=require('bluebird');var rs=require(_0x815f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x815f('0x3'))['db'];var utils=require(_0x815f('0x4'));var logger=require(_0x815f('0x5'))(_0x815f('0x6'));var config=require(_0x815f('0x7'));var jayson=require(_0x815f('0x8'));var client=jayson[_0x815f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43b91e,_0x5ae99e,_0x5af0b0){return new BPromise(function(_0x50b3a4,_0xc7861c){return client[_0x815f('0xa')](_0x43b91e,_0x5af0b0)[_0x815f('0xb')](function(_0x4cbf2f){logger['info'](_0x815f('0xc'),_0x5ae99e,_0x815f('0xd'));logger[_0x815f('0xe')](_0x815f('0xf'),_0x5ae99e,_0x815f('0xd'),JSON['stringify'](_0x4cbf2f));if(_0x4cbf2f['error']){if(_0x4cbf2f[_0x815f('0x10')][_0x815f('0x11')]===0x1f4){logger[_0x815f('0x10')](_0x815f('0xc'),_0x5ae99e,_0x4cbf2f['error'][_0x815f('0x12')]);return _0xc7861c(_0x4cbf2f[_0x815f('0x10')][_0x815f('0x12')]);}logger['error'](_0x815f('0xc'),_0x5ae99e,_0x4cbf2f[_0x815f('0x10')][_0x815f('0x12')]);return _0x50b3a4(_0x4cbf2f[_0x815f('0x10')][_0x815f('0x12')]);}else{logger[_0x815f('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x5ae99e,_0x815f('0xd'));_0x50b3a4(_0x4cbf2f[_0x815f('0x14')]['message']);}})[_0x815f('0x15')](function(_0x396be7){logger['error'](_0x815f('0xc'),_0x5ae99e,_0x396be7);_0xc7861c(_0x396be7);});});}exports[_0x815f('0x16')]=function(_0x3b817e){var _0x4dcd03=this;return new Promise(function(_0x5265d3,_0x19f3d3){return db['ZendeskAccount'][_0x815f('0x17')]({'raw':_0x3b817e[_0x815f('0x18')]?_0x3b817e['options'][_0x815f('0x19')]===undefined?!![]:![]:!![],'where':_0x3b817e[_0x815f('0x18')]?_0x3b817e['options']['where']||null:null,'attributes':_0x3b817e[_0x815f('0x18')]?_0x3b817e[_0x815f('0x18')][_0x815f('0x1a')]||null:null,'limit':_0x3b817e[_0x815f('0x18')]?_0x3b817e[_0x815f('0x18')][_0x815f('0x1b')]||null:null,'include':_0x3b817e[_0x815f('0x18')]?_0x3b817e['options'][_0x815f('0x1c')]?_[_0x815f('0x1d')](_0x3b817e[_0x815f('0x18')]['include'],function(_0x4e04ab){return{'model':db[_0x4e04ab[_0x815f('0x1e')]],'as':_0x4e04ab['as'],'attributes':_0x4e04ab[_0x815f('0x1a')],'include':_0x4e04ab['include']?_['map'](_0x4e04ab[_0x815f('0x1c')],function(_0x10e17b){return{'model':db[_0x10e17b[_0x815f('0x1e')]],'as':_0x10e17b['as'],'attributes':_0x10e17b[_0x815f('0x1a')],'include':_0x10e17b[_0x815f('0x1c')]?_['map'](_0x10e17b[_0x815f('0x1c')],function(_0x3abb7e){return{'model':db[_0x3abb7e['model']],'as':_0x3abb7e['as'],'attributes':_0x3abb7e[_0x815f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x815f('0xb')](function(_0x3ed3e9){logger['info'](_0x815f('0x16'),_0x3b817e);logger[_0x815f('0xe')](_0x815f('0x16'),_0x3b817e,JSON['stringify'](_0x3ed3e9));_0x5265d3(_0x3ed3e9);})[_0x815f('0x15')](function(_0x2093ca){logger[_0x815f('0x10')](_0x815f('0x16'),_0x2093ca[_0x815f('0x12')],_0x3b817e);_0x19f3d3(_0x4dcd03[_0x815f('0x10')](0x1f4,_0x2093ca[_0x815f('0x12')]));});});};exports[_0x815f('0x1f')]=function(_0x438d48){var _0x1b5bec=this;return new Promise(function(_0x1df567,_0x2dc667){return db[_0x815f('0x20')][_0x815f('0x21')]({'raw':_0x438d48[_0x815f('0x18')]?_0x438d48[_0x815f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x438d48['options']?_0x438d48[_0x815f('0x18')][_0x815f('0x22')]||null:null,'attributes':_0x438d48[_0x815f('0x18')]?_0x438d48['options'][_0x815f('0x1a')]||null:null,'include':_0x438d48[_0x815f('0x18')]?_0x438d48[_0x815f('0x18')][_0x815f('0x1c')]?_[_0x815f('0x1d')](_0x438d48[_0x815f('0x18')][_0x815f('0x1c')],function(_0x41421e){return{'model':db[_0x41421e['model']],'as':_0x41421e['as'],'attributes':_0x41421e[_0x815f('0x1a')],'include':_0x41421e['include']?_[_0x815f('0x1d')](_0x41421e[_0x815f('0x1c')],function(_0x6f5241){return{'model':db[_0x6f5241[_0x815f('0x1e')]],'as':_0x6f5241['as'],'attributes':_0x6f5241['attributes'],'include':_0x6f5241['include']?_[_0x815f('0x1d')](_0x6f5241[_0x815f('0x1c')],function(_0x30e17a){return{'model':db[_0x30e17a[_0x815f('0x1e')]],'as':_0x30e17a['as'],'attributes':_0x30e17a[_0x815f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x815f('0xb')](function(_0x31d9d7){logger[_0x815f('0x13')](_0x815f('0x1f'),_0x438d48);logger['debug'](_0x815f('0x1f'),_0x438d48,JSON['stringify'](_0x31d9d7));_0x1df567(_0x31d9d7);})[_0x815f('0x15')](function(_0x4244ee){logger[_0x815f('0x10')](_0x815f('0x1f'),_0x4244ee['message'],_0x438d48);_0x2dc667(_0x1b5bec[_0x815f('0x10')](0x1f4,_0x4244ee[_0x815f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 671cb7b..96993df 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 _0xb7e7=['delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','put','update'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xb7e7[_0x1cb18a];return _0x22442e;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x8')](_0x7b7e('0x12'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router['post']('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x12'),auth['isAuthenticated'](),controller['setTags']);router[_0x7b7e('0x15')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x7b7e('0x18')]);module[_0x7b7e('0x19')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x41a93b,_0x2fc19d){var _0x220a7e=function(_0x5ecb05){while(--_0x5ecb05){_0x41a93b['push'](_0x41a93b['shift']());}};_0x220a7e(++_0x2fc19d);}(_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('./intZendeskConfiguration.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/descriptions',auth[_0x0d8b('0x7')](),controller['getDescriptions']);router[_0x0d8b('0x9')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller['update']);router[_0x0d8b('0x16')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x17')]);module[_0x0d8b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6ed363f..af44393 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 _0x6af9=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6af9,0x1cf));var _0x96af=function(_0x5b31da,_0x1714d2){_0x5b31da=_0x5b31da-0x0;var _0xd2754f=_0x6af9[_0x5b31da];return _0xd2754f;};'use strict';var Sequelize=require('sequelize');module[_0x96af('0x0')]={'name':{'type':Sequelize[_0x96af('0x1')]},'description':{'type':Sequelize[_0x96af('0x1')]}}; \ No newline at end of file +var _0x0456=['STRING','exports'];(function(_0x282d6f,_0x58d4cf){var _0x5cadf4=function(_0x5c2293){while(--_0x5c2293){_0x282d6f['push'](_0x282d6f['shift']());}};_0x5cadf4(++_0x58d4cf);}(_0x0456,0x1ad));var _0x6045=function(_0xd4c485,_0x562a78){_0xd4c485=_0xd4c485-0x0;var _0x470050=_0x0456[_0xd4c485];return _0x470050;};'use strict';var Sequelize=require('sequelize');module[_0x6045('0x0')]={'name':{'type':Sequelize[_0x6045('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index e7a0043..6a2a17b 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 _0xe9bd=['setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','apply','save','update','then','end','error','stack','name','map','ZendeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','getFields','ZendeskField','findOne','getSubjects','getDescriptions','getTags'];(function(_0xb9ea44,_0x3ea719){var _0x290425=function(_0x4181fc){while(--_0x4181fc){_0xb9ea44['push'](_0xb9ea44['shift']());}};_0x290425(++_0x3ea719);}(_0xe9bd,0x183));var _0xde9b=function(_0x2dc3b8,_0x3da0b5){_0x2dc3b8=_0x2dc3b8-0x0;var _0x33c437=_0xe9bd[_0x2dc3b8];return _0x33c437;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde9b('0x0'));var zipdir=require(_0xde9b('0x1'));var jsonpatch=require(_0xde9b('0x2'));var rp=require(_0xde9b('0x3'));var moment=require('moment');var BPromise=require(_0xde9b('0x4'));var Mustache=require(_0xde9b('0x5'));var util=require(_0xde9b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xde9b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xde9b('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xde9b('0x9'));var toCsv=require(_0xde9b('0x7'));var querystring=require(_0xde9b('0xa'));var Papa=require('papaparse');var Redis=require(_0xde9b('0xb'));var authService=require(_0xde9b('0xc'));var qs=require(_0xde9b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xde9b('0xe'))(_0xde9b('0xf'));var utils=require(_0xde9b('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xde9b('0x11'));var db=require(_0xde9b('0x12'))['db'];function respondWithStatusCode(_0x1f3794,_0x5bed9a){_0x5bed9a=_0x5bed9a||0xcc;return function(_0x53e53f){if(_0x53e53f){return _0x1f3794[_0xde9b('0x13')](_0x5bed9a);}return _0x1f3794[_0xde9b('0x14')](_0x5bed9a)['end']();};}function respondWithResult(_0x278682,_0x3da23e){_0x3da23e=_0x3da23e||0xc8;return function(_0x167cad){if(_0x167cad){return _0x278682[_0xde9b('0x14')](_0x3da23e)[_0xde9b('0x15')](_0x167cad);}};}function respondWithFilteredResult(_0x1d98f0,_0x566edb){return function(_0x364c9b){if(_0x364c9b){var _0x50f3cc=typeof _0x566edb['offset']==='undefined'&&typeof _0x566edb[_0xde9b('0x16')]===_0xde9b('0x17');var _0x5b9764=_0x364c9b['count'];var _0x1722f3=_0x50f3cc?0x0:_0x566edb[_0xde9b('0x18')];var _0x14f331=_0x50f3cc?_0x364c9b[_0xde9b('0x19')]:_0x566edb[_0xde9b('0x18')]+_0x566edb[_0xde9b('0x16')];var _0x19936e;if(_0x14f331>=_0x5b9764){_0x14f331=_0x5b9764;_0x19936e=0xc8;}else{_0x19936e=0xce;}_0x1d98f0[_0xde9b('0x14')](_0x19936e);return _0x1d98f0[_0xde9b('0x1a')]('Content-Range',_0x1722f3+'-'+_0x14f331+'/'+_0x5b9764)[_0xde9b('0x15')](_0x364c9b);}return null;};}function patchUpdates(_0x260f22){return function(_0x3f36aa){try{jsonpatch[_0xde9b('0x1b')](_0x3f36aa,_0x260f22,!![]);}catch(_0x5f1323){return BPromise['reject'](_0x5f1323);}return _0x3f36aa[_0xde9b('0x1c')]();};}function saveUpdates(_0x581467,_0x5a8cde){return function(_0xae06b7){if(_0xae06b7){return _0xae06b7[_0xde9b('0x1d')](_0x581467)[_0xde9b('0x1e')](function(_0xe0a201){return _0xe0a201;});}return null;};}function removeEntity(_0x96ac9c,_0x5bbd3e){return function(_0x3682e0){if(_0x3682e0){return _0x3682e0['destroy']()['then'](function(){_0x96ac9c[_0xde9b('0x14')](0xcc)[_0xde9b('0x1f')]();});}};}function handleEntityNotFound(_0x316e36,_0xf2a8d9){return function(_0x4ff521){if(!_0x4ff521){_0x316e36[_0xde9b('0x13')](0x194);}return _0x4ff521;};}function handleError(_0x2071cb,_0x219793){_0x219793=_0x219793||0x1f4;return function(_0x5a9ce4){logger[_0xde9b('0x20')](_0x5a9ce4[_0xde9b('0x21')]);if(_0x5a9ce4['name']){delete _0x5a9ce4[_0xde9b('0x22')];}_0x2071cb['status'](_0x219793)['send'](_0x5a9ce4);};}exports['index']=function(_0x5da166,_0x21ee79){var _0x4550bb={},_0x1e37d3={},_0x936628={'count':0x0,'rows':[]};var _0x262281=_[_0xde9b('0x23')](db[_0xde9b('0x24')][_0xde9b('0x25')],function(_0x10bd5a){return{'name':_0x10bd5a['fieldName'],'type':_0x10bd5a[_0xde9b('0x26')][_0xde9b('0x27')]};});_0x1e37d3[_0xde9b('0x28')]=_[_0xde9b('0x23')](_0x262281,_0xde9b('0x22'));_0x1e37d3[_0xde9b('0x29')]=_[_0xde9b('0x2a')](_0x5da166[_0xde9b('0x29')]);_0x1e37d3[_0xde9b('0x2b')]=_[_0xde9b('0x2c')](_0x1e37d3['model'],_0x1e37d3['query']);_0x4550bb['attributes']=_[_0xde9b('0x2c')](_0x1e37d3['model'],qs[_0xde9b('0x2d')](_0x5da166[_0xde9b('0x29')]['fields']));_0x4550bb[_0xde9b('0x2e')]=_0x4550bb['attributes'][_0xde9b('0x2f')]?_0x4550bb[_0xde9b('0x2e')]:_0x1e37d3['model'];if(!_0x5da166[_0xde9b('0x29')][_0xde9b('0x30')](_0xde9b('0x31'))){_0x4550bb['limit']=qs[_0xde9b('0x16')](_0x5da166['query'][_0xde9b('0x16')]);_0x4550bb[_0xde9b('0x18')]=qs[_0xde9b('0x18')](_0x5da166[_0xde9b('0x29')]['offset']);}_0x4550bb[_0xde9b('0x32')]=qs[_0xde9b('0x33')](_0x5da166[_0xde9b('0x29')]['sort']);_0x4550bb[_0xde9b('0x34')]=qs[_0xde9b('0x2b')](_[_0xde9b('0x35')](_0x5da166[_0xde9b('0x29')],_0x1e37d3[_0xde9b('0x2b')]),_0x262281);if(_0x5da166[_0xde9b('0x29')][_0xde9b('0x36')]){_0x4550bb[_0xde9b('0x34')]=_[_0xde9b('0x37')](_0x4550bb[_0xde9b('0x34')],{'$or':_[_0xde9b('0x23')](_0x262281,function(_0x48f32d){if(_0x48f32d['type']!==_0xde9b('0x38')){var _0x45cca4={};_0x45cca4[_0x48f32d[_0xde9b('0x22')]]={'$like':'%'+_0x5da166[_0xde9b('0x29')][_0xde9b('0x36')]+'%'};return _0x45cca4;}})});}_0x4550bb=_[_0xde9b('0x37')]({},_0x4550bb,_0x5da166[_0xde9b('0x39')]);var _0xea74d0={'where':_0x4550bb[_0xde9b('0x34')]};return db[_0xde9b('0x24')][_0xde9b('0x19')](_0xea74d0)[_0xde9b('0x1e')](function(_0x5b3b51){_0x936628[_0xde9b('0x19')]=_0x5b3b51;if(_0x5da166[_0xde9b('0x29')][_0xde9b('0x3a')]){_0x4550bb[_0xde9b('0x3b')]=[{'all':!![]}];}return db[_0xde9b('0x24')][_0xde9b('0x3c')](_0x4550bb);})[_0xde9b('0x1e')](function(_0x55fd84){_0x936628[_0xde9b('0x3d')]=_0x55fd84;return _0x936628;})[_0xde9b('0x1e')](respondWithFilteredResult(_0x21ee79,_0x4550bb))['catch'](handleError(_0x21ee79,null));};exports[_0xde9b('0x3e')]=function(_0x4df121,_0xcc3e08){var _0x35ea52={'raw':![],'where':{'id':_0x4df121[_0xde9b('0x3f')]['id']}},_0x41cf19={};_0x41cf19[_0xde9b('0x28')]=_[_0xde9b('0x2a')](db[_0xde9b('0x24')]['rawAttributes']);_0x41cf19[_0xde9b('0x29')]=_[_0xde9b('0x2a')](_0x4df121[_0xde9b('0x29')]);_0x41cf19[_0xde9b('0x2b')]=_[_0xde9b('0x2c')](_0x41cf19[_0xde9b('0x28')],_0x41cf19[_0xde9b('0x29')]);_0x35ea52[_0xde9b('0x2e')]=_[_0xde9b('0x2c')](_0x41cf19[_0xde9b('0x28')],qs[_0xde9b('0x2d')](_0x4df121[_0xde9b('0x29')][_0xde9b('0x2d')]));_0x35ea52['attributes']=_0x35ea52[_0xde9b('0x2e')][_0xde9b('0x2f')]?_0x35ea52['attributes']:_0x41cf19[_0xde9b('0x28')];if(_0x4df121['query']['includeAll']){_0x35ea52['include']=[{'all':!![]}];}_0x35ea52=_[_0xde9b('0x37')]({},_0x35ea52,_0x4df121[_0xde9b('0x39')]);return db['ZendeskConfiguration'][_0xde9b('0x40')](_0x35ea52)[_0xde9b('0x1e')](handleEntityNotFound(_0xcc3e08,null))[_0xde9b('0x1e')](respondWithResult(_0xcc3e08,null))[_0xde9b('0x41')](handleError(_0xcc3e08,null));};exports[_0xde9b('0x42')]=function(_0x5d379a,_0x4bb47d){return db[_0xde9b('0x24')][_0xde9b('0x42')](_0x5d379a[_0xde9b('0x43')],{})[_0xde9b('0x1e')](respondWithResult(_0x4bb47d,0xc9))['catch'](handleError(_0x4bb47d,null));};exports[_0xde9b('0x1d')]=function(_0x17a638,_0x5cadd0){if(_0x17a638[_0xde9b('0x43')]['id']){delete _0x17a638[_0xde9b('0x43')]['id'];}return db[_0xde9b('0x24')][_0xde9b('0x40')]({'where':{'id':_0x17a638[_0xde9b('0x3f')]['id']}})[_0xde9b('0x1e')](handleEntityNotFound(_0x5cadd0,null))[_0xde9b('0x1e')](saveUpdates(_0x17a638[_0xde9b('0x43')],null))['then'](respondWithResult(_0x5cadd0,null))[_0xde9b('0x41')](handleError(_0x5cadd0,null));};exports[_0xde9b('0x44')]=function(_0x99edad,_0x1ecf38){return db[_0xde9b('0x24')]['find']({'where':{'id':_0x99edad['params']['id']}})[_0xde9b('0x1e')](handleEntityNotFound(_0x1ecf38,null))['then'](removeEntity(_0x1ecf38,null))[_0xde9b('0x41')](handleError(_0x1ecf38,null));};exports[_0xde9b('0x45')]=function(_0x1d5ab3,_0x5043a7,_0x4e0fe5){var _0x46c851={};var _0x5e4dbe={};var _0x2ef1a8;var _0x3e0484;return db[_0xde9b('0x24')]['findOne']({'where':{'id':_0x1d5ab3[_0xde9b('0x3f')]['id']}})[_0xde9b('0x1e')](handleEntityNotFound(_0x5043a7,null))[_0xde9b('0x1e')](function(_0x11dc2f){if(_0x11dc2f){_0x2ef1a8=_0x11dc2f;_0x5e4dbe[_0xde9b('0x28')]=_[_0xde9b('0x2a')](db[_0xde9b('0x46')]['rawAttributes']);_0x5e4dbe['query']=_['keys'](_0x1d5ab3['query']);_0x5e4dbe[_0xde9b('0x2b')]=_[_0xde9b('0x2c')](_0x5e4dbe['model'],_0x5e4dbe[_0xde9b('0x29')]);_0x46c851[_0xde9b('0x2e')]=_[_0xde9b('0x2c')](_0x5e4dbe[_0xde9b('0x28')],qs['fields'](_0x1d5ab3[_0xde9b('0x29')]['fields']));_0x46c851[_0xde9b('0x2e')]=_0x46c851[_0xde9b('0x2e')][_0xde9b('0x2f')]?_0x46c851[_0xde9b('0x2e')]:_0x5e4dbe['model'];_0x46c851[_0xde9b('0x32')]=qs['sort'](_0x1d5ab3[_0xde9b('0x29')]['sort']);_0x46c851['where']=qs[_0xde9b('0x2b')](_[_0xde9b('0x35')](_0x1d5ab3[_0xde9b('0x29')],_0x5e4dbe[_0xde9b('0x2b')]));if(_0x1d5ab3[_0xde9b('0x29')][_0xde9b('0x36')]){_0x46c851[_0xde9b('0x34')]=_[_0xde9b('0x37')](_0x46c851[_0xde9b('0x34')],{'$or':_[_0xde9b('0x23')](_0x46c851[_0xde9b('0x2e')],function(_0x258cda){var _0x1ed98a={};_0x1ed98a[_0x258cda]={'$like':'%'+_0x1d5ab3[_0xde9b('0x29')][_0xde9b('0x36')]+'%'};return _0x1ed98a;})});}_0x46c851=_[_0xde9b('0x37')]({},_0x46c851,_0x1d5ab3[_0xde9b('0x39')]);return _0x2ef1a8['getFields'](_0x46c851);}})['then'](function(_0x4facab){if(_0x4facab){_0x3e0484=_0x4facab[_0xde9b('0x2f')];if(!_0x1d5ab3[_0xde9b('0x29')][_0xde9b('0x30')](_0xde9b('0x31'))){_0x46c851[_0xde9b('0x16')]=qs[_0xde9b('0x16')](_0x1d5ab3[_0xde9b('0x29')][_0xde9b('0x16')]);_0x46c851[_0xde9b('0x18')]=qs[_0xde9b('0x18')](_0x1d5ab3['query']['offset']);}return _0x2ef1a8['getFields'](_0x46c851);}})[_0xde9b('0x1e')](function(_0x43ec9b){if(_0x43ec9b){return _0x43ec9b?{'count':_0x3e0484,'rows':_0x43ec9b}:null;}})['then'](respondWithResult(_0x5043a7,null))[_0xde9b('0x41')](handleError(_0x5043a7,null));};exports['getSubjects']=function(_0x3b5c66,_0x57b6b3,_0x1b0a1d){var _0x3c6d80={};var _0x1bff68={};var _0x1eb427;var _0x4d5f97;return db['ZendeskConfiguration'][_0xde9b('0x47')]({'where':{'id':_0x3b5c66[_0xde9b('0x3f')]['id']}})[_0xde9b('0x1e')](handleEntityNotFound(_0x57b6b3,null))[_0xde9b('0x1e')](function(_0x1967bf){if(_0x1967bf){_0x1eb427=_0x1967bf;_0x1bff68[_0xde9b('0x28')]=_[_0xde9b('0x2a')](db['ZendeskField'][_0xde9b('0x25')]);_0x1bff68[_0xde9b('0x29')]=_[_0xde9b('0x2a')](_0x3b5c66['query']);_0x1bff68[_0xde9b('0x2b')]=_[_0xde9b('0x2c')](_0x1bff68[_0xde9b('0x28')],_0x1bff68['query']);_0x3c6d80['attributes']=_[_0xde9b('0x2c')](_0x1bff68[_0xde9b('0x28')],qs[_0xde9b('0x2d')](_0x3b5c66['query'][_0xde9b('0x2d')]));_0x3c6d80[_0xde9b('0x2e')]=_0x3c6d80[_0xde9b('0x2e')][_0xde9b('0x2f')]?_0x3c6d80['attributes']:_0x1bff68[_0xde9b('0x28')];_0x3c6d80['order']=qs['sort'](_0x3b5c66[_0xde9b('0x29')]['sort']);_0x3c6d80['where']=qs[_0xde9b('0x2b')](_[_0xde9b('0x35')](_0x3b5c66[_0xde9b('0x29')],_0x1bff68[_0xde9b('0x2b')]));if(_0x3b5c66[_0xde9b('0x29')][_0xde9b('0x36')]){_0x3c6d80['where']=_[_0xde9b('0x37')](_0x3c6d80['where'],{'$or':_['map'](_0x3c6d80['attributes'],function(_0x134f2e){var _0x4ef96e={};_0x4ef96e[_0x134f2e]={'$like':'%'+_0x3b5c66[_0xde9b('0x29')]['filter']+'%'};return _0x4ef96e;})});}_0x3c6d80=_[_0xde9b('0x37')]({},_0x3c6d80,_0x3b5c66[_0xde9b('0x39')]);return _0x1eb427[_0xde9b('0x48')](_0x3c6d80);}})[_0xde9b('0x1e')](function(_0x295ecb){if(_0x295ecb){_0x4d5f97=_0x295ecb[_0xde9b('0x2f')];if(!_0x3b5c66['query'][_0xde9b('0x30')](_0xde9b('0x31'))){_0x3c6d80[_0xde9b('0x16')]=qs['limit'](_0x3b5c66[_0xde9b('0x29')][_0xde9b('0x16')]);_0x3c6d80[_0xde9b('0x18')]=qs['offset'](_0x3b5c66[_0xde9b('0x29')][_0xde9b('0x18')]);}return _0x1eb427[_0xde9b('0x48')](_0x3c6d80);}})['then'](function(_0x3fa344){if(_0x3fa344){return _0x3fa344?{'count':_0x4d5f97,'rows':_0x3fa344}:null;}})[_0xde9b('0x1e')](respondWithResult(_0x57b6b3,null))['catch'](handleError(_0x57b6b3,null));};exports['getDescriptions']=function(_0x4d21c2,_0x48c879,_0x2bb35d){var _0x9ff7da={};var _0x10b70d={};var _0x3e0c9e;var _0x4d82a6;return db[_0xde9b('0x24')][_0xde9b('0x47')]({'where':{'id':_0x4d21c2[_0xde9b('0x3f')]['id']}})[_0xde9b('0x1e')](handleEntityNotFound(_0x48c879,null))['then'](function(_0x23cc3b){if(_0x23cc3b){_0x3e0c9e=_0x23cc3b;_0x10b70d[_0xde9b('0x28')]=_['keys'](db[_0xde9b('0x46')][_0xde9b('0x25')]);_0x10b70d[_0xde9b('0x29')]=_[_0xde9b('0x2a')](_0x4d21c2[_0xde9b('0x29')]);_0x10b70d[_0xde9b('0x2b')]=_[_0xde9b('0x2c')](_0x10b70d[_0xde9b('0x28')],_0x10b70d[_0xde9b('0x29')]);_0x9ff7da[_0xde9b('0x2e')]=_[_0xde9b('0x2c')](_0x10b70d[_0xde9b('0x28')],qs[_0xde9b('0x2d')](_0x4d21c2[_0xde9b('0x29')][_0xde9b('0x2d')]));_0x9ff7da[_0xde9b('0x2e')]=_0x9ff7da[_0xde9b('0x2e')][_0xde9b('0x2f')]?_0x9ff7da[_0xde9b('0x2e')]:_0x10b70d['model'];_0x9ff7da['order']=qs[_0xde9b('0x33')](_0x4d21c2['query'][_0xde9b('0x33')]);_0x9ff7da[_0xde9b('0x34')]=qs[_0xde9b('0x2b')](_['pick'](_0x4d21c2[_0xde9b('0x29')],_0x10b70d[_0xde9b('0x2b')]));if(_0x4d21c2[_0xde9b('0x29')][_0xde9b('0x36')]){_0x9ff7da[_0xde9b('0x34')]=_[_0xde9b('0x37')](_0x9ff7da['where'],{'$or':_['map'](_0x9ff7da[_0xde9b('0x2e')],function(_0x5799c6){var _0x3da5fe={};_0x3da5fe[_0x5799c6]={'$like':'%'+_0x4d21c2[_0xde9b('0x29')][_0xde9b('0x36')]+'%'};return _0x3da5fe;})});}_0x9ff7da=_[_0xde9b('0x37')]({},_0x9ff7da,_0x4d21c2[_0xde9b('0x39')]);return _0x3e0c9e[_0xde9b('0x49')](_0x9ff7da);}})[_0xde9b('0x1e')](function(_0x3d9529){if(_0x3d9529){_0x4d82a6=_0x3d9529[_0xde9b('0x2f')];if(!_0x4d21c2[_0xde9b('0x29')][_0xde9b('0x30')]('nolimit')){_0x9ff7da[_0xde9b('0x16')]=qs[_0xde9b('0x16')](_0x4d21c2[_0xde9b('0x29')][_0xde9b('0x16')]);_0x9ff7da[_0xde9b('0x18')]=qs[_0xde9b('0x18')](_0x4d21c2[_0xde9b('0x29')][_0xde9b('0x18')]);}return _0x3e0c9e[_0xde9b('0x49')](_0x9ff7da);}})[_0xde9b('0x1e')](function(_0x18dae6){if(_0x18dae6){return _0x18dae6?{'count':_0x4d82a6,'rows':_0x18dae6}:null;}})[_0xde9b('0x1e')](respondWithResult(_0x48c879,null))['catch'](handleError(_0x48c879,null));};exports[_0xde9b('0x4a')]=function(_0x12ad99,_0x2ccae5,_0x14f920){var _0x3cd472={};var _0x5aa37e={};var _0x3423c9;var _0x5271a5;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x12ad99[_0xde9b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2ccae5,null))[_0xde9b('0x1e')](function(_0x3c1c22){if(_0x3c1c22){_0x3423c9=_0x3c1c22;_0x5aa37e[_0xde9b('0x28')]=_['keys'](db['Tag'][_0xde9b('0x25')]);_0x5aa37e['query']=_['keys'](_0x12ad99['query']);_0x5aa37e['filters']=_[_0xde9b('0x2c')](_0x5aa37e[_0xde9b('0x28')],_0x5aa37e[_0xde9b('0x29')]);_0x3cd472[_0xde9b('0x2e')]=_[_0xde9b('0x2c')](_0x5aa37e[_0xde9b('0x28')],qs[_0xde9b('0x2d')](_0x12ad99[_0xde9b('0x29')][_0xde9b('0x2d')]));_0x3cd472[_0xde9b('0x2e')]=_0x3cd472[_0xde9b('0x2e')][_0xde9b('0x2f')]?_0x3cd472[_0xde9b('0x2e')]:_0x5aa37e['model'];_0x3cd472['order']=qs[_0xde9b('0x33')](_0x12ad99[_0xde9b('0x29')]['sort']);_0x3cd472[_0xde9b('0x34')]=qs[_0xde9b('0x2b')](_[_0xde9b('0x35')](_0x12ad99['query'],_0x5aa37e[_0xde9b('0x2b')]));if(_0x12ad99[_0xde9b('0x29')]['filter']){_0x3cd472[_0xde9b('0x34')]=_['merge'](_0x3cd472[_0xde9b('0x34')],{'$or':_[_0xde9b('0x23')](_0x3cd472[_0xde9b('0x2e')],function(_0x481a50){var _0x5e1a2f={};_0x5e1a2f[_0x481a50]={'$like':'%'+_0x12ad99[_0xde9b('0x29')][_0xde9b('0x36')]+'%'};return _0x5e1a2f;})});}_0x3cd472=_[_0xde9b('0x37')]({},_0x3cd472,_0x12ad99[_0xde9b('0x39')]);return _0x3423c9[_0xde9b('0x4a')](_0x3cd472);}})[_0xde9b('0x1e')](function(_0xbae2fc){if(_0xbae2fc){_0x5271a5=_0xbae2fc[_0xde9b('0x2f')];if(!_0x12ad99[_0xde9b('0x29')][_0xde9b('0x30')](_0xde9b('0x31'))){_0x3cd472[_0xde9b('0x16')]=qs[_0xde9b('0x16')](_0x12ad99[_0xde9b('0x29')][_0xde9b('0x16')]);_0x3cd472['offset']=qs['offset'](_0x12ad99[_0xde9b('0x29')][_0xde9b('0x18')]);}return _0x3423c9[_0xde9b('0x4a')](_0x3cd472);}})[_0xde9b('0x1e')](function(_0x42e387){if(_0x42e387){return _0x42e387?{'count':_0x5271a5,'rows':_0x42e387}:null;}})['then'](respondWithResult(_0x2ccae5,null))[_0xde9b('0x41')](handleError(_0x2ccae5,null));};exports[_0xde9b('0x4b')]=function(_0x57a0f2,_0x5d450b,_0x31de93){if(_0x57a0f2['body']['id']){delete _0x57a0f2['body']['id'];}return db[_0xde9b('0x24')][_0xde9b('0x47')]({'where':{'id':_0x57a0f2[_0xde9b('0x3f')]['id']}})[_0xde9b('0x1e')](handleEntityNotFound(_0x5d450b,null))[_0xde9b('0x1e')](function(_0x388f31){if(_0x388f31){return _0x388f31[_0xde9b('0x4b')](_0x57a0f2[_0xde9b('0x43')][_0xde9b('0x4c')]||[]);}return null;})[_0xde9b('0x1e')](respondWithResult(_0x5d450b,null))['catch'](handleError(_0x5d450b,null));}; \ No newline at end of file +var _0x67ee=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','status','set','Content-Range','json','apply','update','then','sendStatus','error','name','send','index','map','ZendeskConfiguration','fieldName','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','include','findAll','rows','catch','rawAttributes','includeAll','find','create','body','destroy','getFields','findOne','ZendeskField','getSubjects','params','pick','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0xbc81d4,_0x47bf28){var _0x55a08a=function(_0x1cbbfb){while(--_0x1cbbfb){_0xbc81d4['push'](_0xbc81d4['shift']());}};_0x55a08a(++_0x47bf28);}(_0x67ee,0x1a8));var _0xe67e=function(_0x28b0f3,_0x3bf5e5){_0x28b0f3=_0x28b0f3-0x0;var _0x48f147=_0x67ee[_0x28b0f3];return _0x48f147;};'use strict';var emlformat=require(_0xe67e('0x0'));var rimraf=require(_0xe67e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe67e('0x2'));var moment=require(_0xe67e('0x3'));var BPromise=require(_0xe67e('0x4'));var Mustache=require(_0xe67e('0x5'));var util=require(_0xe67e('0x6'));var path=require(_0xe67e('0x7'));var sox=require(_0xe67e('0x8'));var csv=require(_0xe67e('0x9'));var ejs=require(_0xe67e('0xa'));var fs=require('fs');var fs_extra=require(_0xe67e('0xb'));var _=require(_0xe67e('0xc'));var squel=require(_0xe67e('0xd'));var crypto=require(_0xe67e('0xe'));var jsforce=require(_0xe67e('0xf'));var deskjs=require(_0xe67e('0x10'));var toCsv=require(_0xe67e('0x9'));var querystring=require(_0xe67e('0x11'));var Papa=require(_0xe67e('0x12'));var Redis=require(_0xe67e('0x13'));var authService=require(_0xe67e('0x14'));var qs=require(_0xe67e('0x15'));var as=require(_0xe67e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe67e('0x17'));var utils=require(_0xe67e('0x18'));var config=require(_0xe67e('0x19'));var licenseUtil=require(_0xe67e('0x1a'));var db=require(_0xe67e('0x1b'))['db'];function respondWithStatusCode(_0x30abca,_0x379ed2){_0x379ed2=_0x379ed2||0xcc;return function(_0x2fc17c){if(_0x2fc17c){return _0x30abca['sendStatus'](_0x379ed2);}return _0x30abca['status'](_0x379ed2)[_0xe67e('0x1c')]();};}function respondWithResult(_0x5f2de3,_0x236626){_0x236626=_0x236626||0xc8;return function(_0x3e1a89){if(_0x3e1a89){return _0x5f2de3['status'](_0x236626)['json'](_0x3e1a89);}};}function respondWithFilteredResult(_0x48ca97,_0x2075de){return function(_0x4898a6){if(_0x4898a6){var _0x4554e0=typeof _0x2075de['offset']===_0xe67e('0x1d')&&typeof _0x2075de['limit']===_0xe67e('0x1d');var _0x5a82ff=_0x4898a6[_0xe67e('0x1e')];var _0x5f06df=_0x4554e0?0x0:_0x2075de[_0xe67e('0x1f')];var _0x2a0bee=_0x4554e0?_0x4898a6[_0xe67e('0x1e')]:_0x2075de[_0xe67e('0x1f')]+_0x2075de[_0xe67e('0x20')];var _0x5993e7;if(_0x2a0bee>=_0x5a82ff){_0x2a0bee=_0x5a82ff;_0x5993e7=0xc8;}else{_0x5993e7=0xce;}_0x48ca97[_0xe67e('0x21')](_0x5993e7);return _0x48ca97[_0xe67e('0x22')](_0xe67e('0x23'),_0x5f06df+'-'+_0x2a0bee+'/'+_0x5a82ff)[_0xe67e('0x24')](_0x4898a6);}return null;};}function patchUpdates(_0x42f7df){return function(_0x130dbe){try{jsonpatch[_0xe67e('0x25')](_0x130dbe,_0x42f7df,!![]);}catch(_0x3bfb44){return BPromise['reject'](_0x3bfb44);}return _0x130dbe['save']();};}function saveUpdates(_0xc5bbe,_0x1d616f){return function(_0x210e37){if(_0x210e37){return _0x210e37[_0xe67e('0x26')](_0xc5bbe)[_0xe67e('0x27')](function(_0x5a9011){return _0x5a9011;});}return null;};}function removeEntity(_0x242b03,_0x2b73a7){return function(_0x76cb32){if(_0x76cb32){return _0x76cb32['destroy']()[_0xe67e('0x27')](function(){_0x242b03[_0xe67e('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fbc0f,_0x2b9f1a){return function(_0x5735c4){if(!_0x5735c4){_0x2fbc0f[_0xe67e('0x28')](0x194);}return _0x5735c4;};}function handleError(_0x56bfe5,_0x4a13da){_0x4a13da=_0x4a13da||0x1f4;return function(_0x53aa01){logger[_0xe67e('0x29')](_0x53aa01['stack']);if(_0x53aa01[_0xe67e('0x2a')]){delete _0x53aa01[_0xe67e('0x2a')];}_0x56bfe5['status'](_0x4a13da)[_0xe67e('0x2b')](_0x53aa01);};}exports[_0xe67e('0x2c')]=function(_0x3983da,_0x4863a0){var _0x576b16={},_0x4778a7={},_0x2aaad1={'count':0x0,'rows':[]};var _0x2c1181=_[_0xe67e('0x2d')](db[_0xe67e('0x2e')]['rawAttributes'],function(_0x2dab64){return{'name':_0x2dab64[_0xe67e('0x2f')],'type':_0x2dab64['type'][_0xe67e('0x30')]};});_0x4778a7['model']=_[_0xe67e('0x2d')](_0x2c1181,_0xe67e('0x2a'));_0x4778a7[_0xe67e('0x31')]=_[_0xe67e('0x32')](_0x3983da['query']);_0x4778a7['filters']=_['intersection'](_0x4778a7[_0xe67e('0x33')],_0x4778a7[_0xe67e('0x31')]);_0x576b16['attributes']=_[_0xe67e('0x34')](_0x4778a7['model'],qs[_0xe67e('0x35')](_0x3983da[_0xe67e('0x31')][_0xe67e('0x35')]));_0x576b16[_0xe67e('0x36')]=_0x576b16[_0xe67e('0x36')][_0xe67e('0x37')]?_0x576b16[_0xe67e('0x36')]:_0x4778a7[_0xe67e('0x33')];if(!_0x3983da[_0xe67e('0x31')][_0xe67e('0x38')](_0xe67e('0x39'))){_0x576b16[_0xe67e('0x20')]=qs[_0xe67e('0x20')](_0x3983da[_0xe67e('0x31')][_0xe67e('0x20')]);_0x576b16[_0xe67e('0x1f')]=qs[_0xe67e('0x1f')](_0x3983da[_0xe67e('0x31')]['offset']);}_0x576b16[_0xe67e('0x3a')]=qs['sort'](_0x3983da['query'][_0xe67e('0x3b')]);_0x576b16[_0xe67e('0x3c')]=qs['filters'](_['pick'](_0x3983da[_0xe67e('0x31')],_0x4778a7[_0xe67e('0x3d')]),_0x2c1181);if(_0x3983da[_0xe67e('0x31')][_0xe67e('0x3e')]){_0x576b16[_0xe67e('0x3c')]=_[_0xe67e('0x3f')](_0x576b16[_0xe67e('0x3c')],{'$or':_['map'](_0x2c1181,function(_0x362e4d){if(_0x362e4d[_0xe67e('0x40')]!=='VIRTUAL'){var _0x44c314={};_0x44c314[_0x362e4d[_0xe67e('0x2a')]]={'$like':'%'+_0x3983da[_0xe67e('0x31')][_0xe67e('0x3e')]+'%'};return _0x44c314;}})});}_0x576b16=_[_0xe67e('0x3f')]({},_0x576b16,_0x3983da[_0xe67e('0x41')]);var _0x169baa={'where':_0x576b16[_0xe67e('0x3c')]};return db['ZendeskConfiguration'][_0xe67e('0x1e')](_0x169baa)[_0xe67e('0x27')](function(_0x3d6517){_0x2aaad1['count']=_0x3d6517;if(_0x3983da['query']['includeAll']){_0x576b16[_0xe67e('0x42')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xe67e('0x43')](_0x576b16);})[_0xe67e('0x27')](function(_0x2ee7c8){_0x2aaad1[_0xe67e('0x44')]=_0x2ee7c8;return _0x2aaad1;})[_0xe67e('0x27')](respondWithFilteredResult(_0x4863a0,_0x576b16))[_0xe67e('0x45')](handleError(_0x4863a0,null));};exports['show']=function(_0x273ad2,_0x1b210a){var _0x479335={'raw':![],'where':{'id':_0x273ad2['params']['id']}},_0x5e67b7={};_0x5e67b7['model']=_['keys'](db[_0xe67e('0x2e')][_0xe67e('0x46')]);_0x5e67b7[_0xe67e('0x31')]=_[_0xe67e('0x32')](_0x273ad2[_0xe67e('0x31')]);_0x5e67b7[_0xe67e('0x3d')]=_[_0xe67e('0x34')](_0x5e67b7[_0xe67e('0x33')],_0x5e67b7['query']);_0x479335['attributes']=_[_0xe67e('0x34')](_0x5e67b7[_0xe67e('0x33')],qs[_0xe67e('0x35')](_0x273ad2[_0xe67e('0x31')][_0xe67e('0x35')]));_0x479335['attributes']=_0x479335[_0xe67e('0x36')][_0xe67e('0x37')]?_0x479335[_0xe67e('0x36')]:_0x5e67b7[_0xe67e('0x33')];if(_0x273ad2['query'][_0xe67e('0x47')]){_0x479335['include']=[{'all':!![]}];}_0x479335=_[_0xe67e('0x3f')]({},_0x479335,_0x273ad2[_0xe67e('0x41')]);return db[_0xe67e('0x2e')][_0xe67e('0x48')](_0x479335)[_0xe67e('0x27')](handleEntityNotFound(_0x1b210a,null))[_0xe67e('0x27')](respondWithResult(_0x1b210a,null))[_0xe67e('0x45')](handleError(_0x1b210a,null));};exports['create']=function(_0x29fb8d,_0x128929){return db[_0xe67e('0x2e')][_0xe67e('0x49')](_0x29fb8d[_0xe67e('0x4a')],{})['then'](respondWithResult(_0x128929,0xc9))[_0xe67e('0x45')](handleError(_0x128929,null));};exports['update']=function(_0x36c146,_0x56efed){if(_0x36c146['body']['id']){delete _0x36c146[_0xe67e('0x4a')]['id'];}return db[_0xe67e('0x2e')][_0xe67e('0x48')]({'where':{'id':_0x36c146['params']['id']}})[_0xe67e('0x27')](handleEntityNotFound(_0x56efed,null))[_0xe67e('0x27')](saveUpdates(_0x36c146[_0xe67e('0x4a')],null))['then'](respondWithResult(_0x56efed,null))['catch'](handleError(_0x56efed,null));};exports[_0xe67e('0x4b')]=function(_0x3d6e45,_0x345f69){return db['ZendeskConfiguration']['find']({'where':{'id':_0x3d6e45['params']['id']}})[_0xe67e('0x27')](handleEntityNotFound(_0x345f69,null))[_0xe67e('0x27')](removeEntity(_0x345f69,null))[_0xe67e('0x45')](handleError(_0x345f69,null));};exports[_0xe67e('0x4c')]=function(_0x57c5fb,_0x13f935,_0x4e4081){var _0x6d0331={};var _0x1b9a50={};var _0x2e1d91;var _0x145869;return db[_0xe67e('0x2e')][_0xe67e('0x4d')]({'where':{'id':_0x57c5fb['params']['id']}})[_0xe67e('0x27')](handleEntityNotFound(_0x13f935,null))['then'](function(_0x49b921){if(_0x49b921){_0x2e1d91=_0x49b921;_0x1b9a50['model']=_[_0xe67e('0x32')](db[_0xe67e('0x4e')][_0xe67e('0x46')]);_0x1b9a50['query']=_[_0xe67e('0x32')](_0x57c5fb[_0xe67e('0x31')]);_0x1b9a50[_0xe67e('0x3d')]=_[_0xe67e('0x34')](_0x1b9a50[_0xe67e('0x33')],_0x1b9a50['query']);_0x6d0331[_0xe67e('0x36')]=_['intersection'](_0x1b9a50[_0xe67e('0x33')],qs[_0xe67e('0x35')](_0x57c5fb[_0xe67e('0x31')][_0xe67e('0x35')]));_0x6d0331[_0xe67e('0x36')]=_0x6d0331[_0xe67e('0x36')][_0xe67e('0x37')]?_0x6d0331['attributes']:_0x1b9a50[_0xe67e('0x33')];_0x6d0331[_0xe67e('0x3a')]=qs['sort'](_0x57c5fb[_0xe67e('0x31')]['sort']);_0x6d0331[_0xe67e('0x3c')]=qs[_0xe67e('0x3d')](_['pick'](_0x57c5fb[_0xe67e('0x31')],_0x1b9a50[_0xe67e('0x3d')]));if(_0x57c5fb[_0xe67e('0x31')][_0xe67e('0x3e')]){_0x6d0331[_0xe67e('0x3c')]=_[_0xe67e('0x3f')](_0x6d0331['where'],{'$or':_['map'](_0x6d0331[_0xe67e('0x36')],function(_0x20b05b){var _0x4d3615={};_0x4d3615[_0x20b05b]={'$like':'%'+_0x57c5fb[_0xe67e('0x31')]['filter']+'%'};return _0x4d3615;})});}_0x6d0331=_['merge']({},_0x6d0331,_0x57c5fb[_0xe67e('0x41')]);return _0x2e1d91[_0xe67e('0x4c')](_0x6d0331);}})[_0xe67e('0x27')](function(_0x54cd92){if(_0x54cd92){_0x145869=_0x54cd92[_0xe67e('0x37')];if(!_0x57c5fb[_0xe67e('0x31')][_0xe67e('0x38')](_0xe67e('0x39'))){_0x6d0331[_0xe67e('0x20')]=qs['limit'](_0x57c5fb[_0xe67e('0x31')][_0xe67e('0x20')]);_0x6d0331['offset']=qs['offset'](_0x57c5fb['query']['offset']);}return _0x2e1d91[_0xe67e('0x4c')](_0x6d0331);}})[_0xe67e('0x27')](function(_0x5a0b1c){if(_0x5a0b1c){return _0x5a0b1c?{'count':_0x145869,'rows':_0x5a0b1c}:null;}})[_0xe67e('0x27')](respondWithResult(_0x13f935,null))[_0xe67e('0x45')](handleError(_0x13f935,null));};exports[_0xe67e('0x4f')]=function(_0x1f8c70,_0x2383bf,_0x3e34a4){var _0x25f502={};var _0x313c22={};var _0x2cf8ec;var _0x4580e4;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1f8c70[_0xe67e('0x50')]['id']}})['then'](handleEntityNotFound(_0x2383bf,null))[_0xe67e('0x27')](function(_0x5d5112){if(_0x5d5112){_0x2cf8ec=_0x5d5112;_0x313c22[_0xe67e('0x33')]=_[_0xe67e('0x32')](db[_0xe67e('0x4e')]['rawAttributes']);_0x313c22[_0xe67e('0x31')]=_[_0xe67e('0x32')](_0x1f8c70[_0xe67e('0x31')]);_0x313c22['filters']=_[_0xe67e('0x34')](_0x313c22[_0xe67e('0x33')],_0x313c22[_0xe67e('0x31')]);_0x25f502[_0xe67e('0x36')]=_[_0xe67e('0x34')](_0x313c22[_0xe67e('0x33')],qs[_0xe67e('0x35')](_0x1f8c70[_0xe67e('0x31')][_0xe67e('0x35')]));_0x25f502[_0xe67e('0x36')]=_0x25f502[_0xe67e('0x36')][_0xe67e('0x37')]?_0x25f502['attributes']:_0x313c22[_0xe67e('0x33')];_0x25f502['order']=qs['sort'](_0x1f8c70[_0xe67e('0x31')][_0xe67e('0x3b')]);_0x25f502['where']=qs[_0xe67e('0x3d')](_[_0xe67e('0x51')](_0x1f8c70[_0xe67e('0x31')],_0x313c22[_0xe67e('0x3d')]));if(_0x1f8c70[_0xe67e('0x31')][_0xe67e('0x3e')]){_0x25f502[_0xe67e('0x3c')]=_[_0xe67e('0x3f')](_0x25f502[_0xe67e('0x3c')],{'$or':_[_0xe67e('0x2d')](_0x25f502['attributes'],function(_0x28c512){var _0x4ef568={};_0x4ef568[_0x28c512]={'$like':'%'+_0x1f8c70[_0xe67e('0x31')][_0xe67e('0x3e')]+'%'};return _0x4ef568;})});}_0x25f502=_[_0xe67e('0x3f')]({},_0x25f502,_0x1f8c70[_0xe67e('0x41')]);return _0x2cf8ec[_0xe67e('0x4f')](_0x25f502);}})[_0xe67e('0x27')](function(_0x32b05b){if(_0x32b05b){_0x4580e4=_0x32b05b['length'];if(!_0x1f8c70[_0xe67e('0x31')][_0xe67e('0x38')]('nolimit')){_0x25f502[_0xe67e('0x20')]=qs[_0xe67e('0x20')](_0x1f8c70[_0xe67e('0x31')][_0xe67e('0x20')]);_0x25f502['offset']=qs[_0xe67e('0x1f')](_0x1f8c70[_0xe67e('0x31')][_0xe67e('0x1f')]);}return _0x2cf8ec['getSubjects'](_0x25f502);}})[_0xe67e('0x27')](function(_0x5dcd76){if(_0x5dcd76){return _0x5dcd76?{'count':_0x4580e4,'rows':_0x5dcd76}:null;}})['then'](respondWithResult(_0x2383bf,null))[_0xe67e('0x45')](handleError(_0x2383bf,null));};exports[_0xe67e('0x52')]=function(_0x182b59,_0x51fbcf,_0x1e7fba){var _0x48bca7={};var _0x210b51={};var _0x565056;var _0x57c378;return db[_0xe67e('0x2e')][_0xe67e('0x4d')]({'where':{'id':_0x182b59['params']['id']}})[_0xe67e('0x27')](handleEntityNotFound(_0x51fbcf,null))[_0xe67e('0x27')](function(_0xf34b02){if(_0xf34b02){_0x565056=_0xf34b02;_0x210b51[_0xe67e('0x33')]=_[_0xe67e('0x32')](db[_0xe67e('0x4e')]['rawAttributes']);_0x210b51[_0xe67e('0x31')]=_[_0xe67e('0x32')](_0x182b59[_0xe67e('0x31')]);_0x210b51['filters']=_['intersection'](_0x210b51['model'],_0x210b51[_0xe67e('0x31')]);_0x48bca7[_0xe67e('0x36')]=_[_0xe67e('0x34')](_0x210b51['model'],qs[_0xe67e('0x35')](_0x182b59['query'][_0xe67e('0x35')]));_0x48bca7[_0xe67e('0x36')]=_0x48bca7['attributes'][_0xe67e('0x37')]?_0x48bca7[_0xe67e('0x36')]:_0x210b51['model'];_0x48bca7['order']=qs['sort'](_0x182b59['query']['sort']);_0x48bca7[_0xe67e('0x3c')]=qs[_0xe67e('0x3d')](_[_0xe67e('0x51')](_0x182b59['query'],_0x210b51['filters']));if(_0x182b59['query'][_0xe67e('0x3e')]){_0x48bca7[_0xe67e('0x3c')]=_[_0xe67e('0x3f')](_0x48bca7[_0xe67e('0x3c')],{'$or':_['map'](_0x48bca7[_0xe67e('0x36')],function(_0x2d0469){var _0x52b1bc={};_0x52b1bc[_0x2d0469]={'$like':'%'+_0x182b59[_0xe67e('0x31')][_0xe67e('0x3e')]+'%'};return _0x52b1bc;})});}_0x48bca7=_[_0xe67e('0x3f')]({},_0x48bca7,_0x182b59[_0xe67e('0x41')]);return _0x565056[_0xe67e('0x52')](_0x48bca7);}})[_0xe67e('0x27')](function(_0x34fa43){if(_0x34fa43){_0x57c378=_0x34fa43[_0xe67e('0x37')];if(!_0x182b59[_0xe67e('0x31')][_0xe67e('0x38')](_0xe67e('0x39'))){_0x48bca7[_0xe67e('0x20')]=qs[_0xe67e('0x20')](_0x182b59[_0xe67e('0x31')][_0xe67e('0x20')]);_0x48bca7[_0xe67e('0x1f')]=qs[_0xe67e('0x1f')](_0x182b59[_0xe67e('0x31')][_0xe67e('0x1f')]);}return _0x565056[_0xe67e('0x52')](_0x48bca7);}})['then'](function(_0x56c732){if(_0x56c732){return _0x56c732?{'count':_0x57c378,'rows':_0x56c732}:null;}})[_0xe67e('0x27')](respondWithResult(_0x51fbcf,null))[_0xe67e('0x45')](handleError(_0x51fbcf,null));};exports[_0xe67e('0x53')]=function(_0x23820e,_0x2dee9d,_0x154df5){var _0x3d0cc9={};var _0x3f6a2c={};var _0x530920;var _0x3c6478;return db[_0xe67e('0x2e')]['findOne']({'where':{'id':_0x23820e['params']['id']}})[_0xe67e('0x27')](handleEntityNotFound(_0x2dee9d,null))[_0xe67e('0x27')](function(_0x2f5e4c){if(_0x2f5e4c){_0x530920=_0x2f5e4c;_0x3f6a2c[_0xe67e('0x33')]=_[_0xe67e('0x32')](db[_0xe67e('0x54')][_0xe67e('0x46')]);_0x3f6a2c['query']=_['keys'](_0x23820e[_0xe67e('0x31')]);_0x3f6a2c[_0xe67e('0x3d')]=_[_0xe67e('0x34')](_0x3f6a2c[_0xe67e('0x33')],_0x3f6a2c[_0xe67e('0x31')]);_0x3d0cc9[_0xe67e('0x36')]=_[_0xe67e('0x34')](_0x3f6a2c[_0xe67e('0x33')],qs[_0xe67e('0x35')](_0x23820e[_0xe67e('0x31')][_0xe67e('0x35')]));_0x3d0cc9[_0xe67e('0x36')]=_0x3d0cc9[_0xe67e('0x36')][_0xe67e('0x37')]?_0x3d0cc9['attributes']:_0x3f6a2c['model'];_0x3d0cc9[_0xe67e('0x3a')]=qs[_0xe67e('0x3b')](_0x23820e[_0xe67e('0x31')][_0xe67e('0x3b')]);_0x3d0cc9['where']=qs[_0xe67e('0x3d')](_['pick'](_0x23820e['query'],_0x3f6a2c[_0xe67e('0x3d')]));if(_0x23820e[_0xe67e('0x31')][_0xe67e('0x3e')]){_0x3d0cc9[_0xe67e('0x3c')]=_[_0xe67e('0x3f')](_0x3d0cc9['where'],{'$or':_[_0xe67e('0x2d')](_0x3d0cc9[_0xe67e('0x36')],function(_0x15017e){var _0x5e9bbb={};_0x5e9bbb[_0x15017e]={'$like':'%'+_0x23820e[_0xe67e('0x31')]['filter']+'%'};return _0x5e9bbb;})});}_0x3d0cc9=_[_0xe67e('0x3f')]({},_0x3d0cc9,_0x23820e[_0xe67e('0x41')]);return _0x530920[_0xe67e('0x53')](_0x3d0cc9);}})[_0xe67e('0x27')](function(_0x3291b2){if(_0x3291b2){_0x3c6478=_0x3291b2['length'];if(!_0x23820e[_0xe67e('0x31')][_0xe67e('0x38')](_0xe67e('0x39'))){_0x3d0cc9['limit']=qs[_0xe67e('0x20')](_0x23820e['query'][_0xe67e('0x20')]);_0x3d0cc9[_0xe67e('0x1f')]=qs['offset'](_0x23820e[_0xe67e('0x31')][_0xe67e('0x1f')]);}return _0x530920[_0xe67e('0x53')](_0x3d0cc9);}})[_0xe67e('0x27')](function(_0x526c82){if(_0x526c82){return _0x526c82?{'count':_0x3c6478,'rows':_0x526c82}:null;}})[_0xe67e('0x27')](respondWithResult(_0x2dee9d,null))[_0xe67e('0x45')](handleError(_0x2dee9d,null));};exports[_0xe67e('0x55')]=function(_0x4d39f8,_0x9c640e,_0x591d03){if(_0x4d39f8['body']['id']){delete _0x4d39f8[_0xe67e('0x4a')]['id'];}return db['ZendeskConfiguration'][_0xe67e('0x4d')]({'where':{'id':_0x4d39f8['params']['id']}})['then'](handleEntityNotFound(_0x9c640e,null))[_0xe67e('0x27')](function(_0xd93c2){if(_0xd93c2){return _0xd93c2[_0xe67e('0x55')](_0x4d39f8[_0xe67e('0x4a')][_0xe67e('0x56')]||[]);}return null;})['then'](respondWithResult(_0x9c640e,null))[_0xe67e('0x45')](handleError(_0x9c640e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 1f730ec..0e8c16f 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 _0x282b=['moment','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x27e352,_0x2b4917){var _0x5de6f8=function(_0x591447){while(--_0x591447){_0x27e352['push'](_0x27e352['shift']());}};_0x5de6f8(++_0x2b4917);}(_0x282b,0xec));var _0xb282=function(_0x3f8fe6,_0x37eef9){_0x3f8fe6=_0x3f8fe6-0x0;var _0x3820f8=_0x282b[_0x3f8fe6];return _0x3820f8;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var logger=require(_0xb282('0x2'))(_0xb282('0x3'));var moment=require(_0xb282('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb282('0x5'));var rimraf=require('rimraf');var config=require(_0xb282('0x6'));var attributes=require(_0xb282('0x7'));module[_0xb282('0x8')]=function(_0x1dd19b,_0x3cad41){return _0x1dd19b[_0xb282('0x9')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32b6=['moment','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api'];(function(_0x220ae3,_0x2d744d){var _0x104725=function(_0x42da91){while(--_0x42da91){_0x220ae3['push'](_0x220ae3['shift']());}};_0x104725(++_0x2d744d);}(_0x32b6,0x1d1));var _0x632b=function(_0x47f586,_0xc00ac6){_0x47f586=_0x47f586-0x0;var _0x5ceef1=_0x32b6[_0x47f586];return _0x5ceef1;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var logger=require('../../config/logger')(_0x632b('0x2'));var moment=require(_0x632b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x4'));var rimraf=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var attributes=require(_0x632b('0x7'));module[_0x632b('0x8')]=function(_0x122768,_0x24ceab){return _0x122768[_0x632b('0x9')](_0x632b('0xa'),attributes,{'tableName':_0x632b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 0e149f4..0dd25e6 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 _0xf775=['util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4acf88,_0x4cb142){var _0x37e883=function(_0x71593d){while(--_0x71593d){_0x4acf88['push'](_0x4acf88['shift']());}};_0x37e883(++_0x4cb142);}(_0xf775,0x1cb));var _0x5f77=function(_0x23eac4,_0x58c14b){_0x23eac4=_0x23eac4-0x0;var _0x2afc36=_0xf775[_0x23eac4];return _0x2afc36;};'use strict';var _=require(_0x5f77('0x0'));var util=require(_0x5f77('0x1'));var moment=require(_0x5f77('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f77('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f77('0x4'));var logger=require(_0x5f77('0x5'))(_0x5f77('0x6'));var config=require('../../config/environment');var jayson=require(_0x5f77('0x7'));var client=jayson[_0x5f77('0x8')][_0x5f77('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a3d44,_0x3958cf,_0x2aa487){return new BPromise(function(_0x44ed65,_0x4f4dcc){return client[_0x5f77('0xa')](_0x2a3d44,_0x2aa487)[_0x5f77('0xb')](function(_0x34450e){logger[_0x5f77('0xc')](_0x5f77('0xd'),_0x3958cf,_0x5f77('0xe'));logger[_0x5f77('0xf')](_0x5f77('0x10'),_0x3958cf,_0x5f77('0xe'),JSON[_0x5f77('0x11')](_0x34450e));if(_0x34450e[_0x5f77('0x12')]){if(_0x34450e['error'][_0x5f77('0x13')]===0x1f4){logger['error'](_0x5f77('0xd'),_0x3958cf,_0x34450e[_0x5f77('0x12')][_0x5f77('0x14')]);return _0x4f4dcc(_0x34450e[_0x5f77('0x12')][_0x5f77('0x14')]);}logger['error'](_0x5f77('0xd'),_0x3958cf,_0x34450e[_0x5f77('0x12')][_0x5f77('0x14')]);return _0x44ed65(_0x34450e[_0x5f77('0x12')][_0x5f77('0x14')]);}else{logger[_0x5f77('0xc')](_0x5f77('0xd'),_0x3958cf,_0x5f77('0xe'));_0x44ed65(_0x34450e[_0x5f77('0x15')][_0x5f77('0x14')]);}})[_0x5f77('0x16')](function(_0x388cd1){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x3958cf,_0x388cd1);_0x4f4dcc(_0x388cd1);});});} \ No newline at end of file +var _0xa805=['client','http','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','error','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4431c5,_0x56130b){var _0x2823a6=function(_0x4c909f){while(--_0x4c909f){_0x4431c5['push'](_0x4431c5['shift']());}};_0x2823a6(++_0x56130b);}(_0xa805,0xb3));var _0x5a80=function(_0x62e840,_0xa63ba5){_0x62e840=_0x62e840-0x0;var _0x56f125=_0xa805[_0x62e840];return _0x56f125;};'use strict';var _=require(_0x5a80('0x0'));var util=require(_0x5a80('0x1'));var moment=require(_0x5a80('0x2'));var BPromise=require('bluebird');var rs=require(_0x5a80('0x3'));var fs=require('fs');var Redis=require(_0x5a80('0x4'));var db=require(_0x5a80('0x5'))['db'];var utils=require(_0x5a80('0x6'));var logger=require(_0x5a80('0x7'))(_0x5a80('0x8'));var config=require(_0x5a80('0x9'));var jayson=require(_0x5a80('0xa'));var client=jayson[_0x5a80('0xb')][_0x5a80('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34ae35,_0x4f23fe,_0x48a136){return new BPromise(function(_0xcf623e,_0x3ef344){return client['request'](_0x34ae35,_0x48a136)['then'](function(_0x41e9a0){logger['info'](_0x5a80('0xd'),_0x4f23fe,_0x5a80('0xe'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4f23fe,_0x5a80('0xe'),JSON['stringify'](_0x41e9a0));if(_0x41e9a0[_0x5a80('0xf')]){if(_0x41e9a0[_0x5a80('0xf')]['code']===0x1f4){logger[_0x5a80('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4f23fe,_0x41e9a0[_0x5a80('0xf')]['message']);return _0x3ef344(_0x41e9a0[_0x5a80('0xf')]['message']);}logger[_0x5a80('0xf')](_0x5a80('0xd'),_0x4f23fe,_0x41e9a0['error'][_0x5a80('0x10')]);return _0xcf623e(_0x41e9a0['error']['message']);}else{logger[_0x5a80('0x11')](_0x5a80('0xd'),_0x4f23fe,_0x5a80('0xe'));_0xcf623e(_0x41e9a0[_0x5a80('0x12')][_0x5a80('0x10')]);}})['catch'](function(_0x3bee90){logger[_0x5a80('0xf')](_0x5a80('0xd'),_0x4f23fe,_0x3bee90);_0x3ef344(_0x3bee90);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1c5bea4..37fb5c8 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 _0x7682=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','/:id','isAuthenticated','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x5933fb,_0x9115ad){var _0x44d988=function(_0x295228){while(--_0x295228){_0x5933fb['push'](_0x5933fb['shift']());}};_0x44d988(++_0x9115ad);}(_0x7682,0x186));var _0x2768=function(_0x154181,_0x12ad71){_0x154181=_0x154181-0x0;var _0x202371=_0x7682[_0x154181];return _0x202371;};'use strict';var multer=require(_0x2768('0x0'));var util=require(_0x2768('0x1'));var path=require(_0x2768('0x2'));var timeout=require(_0x2768('0x3'));var express=require(_0x2768('0x4'));var router=express[_0x2768('0x5')]();var fs_extra=require(_0x2768('0x6'));var auth=require(_0x2768('0x7'));var interaction=require(_0x2768('0x8'));var config=require(_0x2768('0x9'));var controller=require(_0x2768('0xa'));router[_0x2768('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2768('0xb')](_0x2768('0xc'),auth[_0x2768('0xd')](),controller['show']);router[_0x2768('0xe')]('/',auth[_0x2768('0xd')](),controller[_0x2768('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2768('0x10')](_0x2768('0xc'),auth[_0x2768('0xd')](),controller[_0x2768('0x11')]);module['exports']=router; \ No newline at end of file +var _0x65b7=['update','destroy','exports','multer','util','path','Router','../../components/auth/service','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x10083c,_0xe38610){var _0x164d40=function(_0x396b86){while(--_0x396b86){_0x10083c['push'](_0x10083c['shift']());}};_0x164d40(++_0xe38610);}(_0x65b7,0x102));var _0x765b=function(_0x49a32c,_0x3e7c01){_0x49a32c=_0x49a32c-0x0;var _0x3122c8=_0x65b7[_0x49a32c];return _0x3122c8;};'use strict';var multer=require(_0x765b('0x0'));var util=require(_0x765b('0x1'));var path=require(_0x765b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x765b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x765b('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x765b('0x5')]('/',auth[_0x765b('0x6')](),controller['index']);router[_0x765b('0x5')](_0x765b('0x7'),auth[_0x765b('0x6')](),controller[_0x765b('0x8')]);router[_0x765b('0x9')]('/',auth[_0x765b('0x6')](),controller[_0x765b('0xa')]);router[_0x765b('0xb')]('/:id',auth[_0x765b('0x6')](),controller[_0x765b('0xc')]);router['delete'](_0x765b('0x7'),auth[_0x765b('0x6')](),controller[_0x765b('0xd')]);module[_0x765b('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 4fbd9b4..a489801 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 _0xb4b1=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x4934ba,_0x1a7c33){var _0x6206c5=function(_0xccf85f){while(--_0xccf85f){_0x4934ba['push'](_0x4934ba['shift']());}};_0x6206c5(++_0x1a7c33);}(_0xb4b1,0xd5));var _0x1b4b=function(_0x49a73c,_0x3c0804){_0x49a73c=_0x49a73c-0x0;var _0x36c7d4=_0xb4b1[_0x49a73c];return _0x36c7d4;};'use strict';var Sequelize=require(_0x1b4b('0x0'));module[_0x1b4b('0x1')]={'type':{'type':Sequelize[_0x1b4b('0x2')](_0x1b4b('0x3'),_0x1b4b('0x4'),_0x1b4b('0x5'),_0x1b4b('0x6'),_0x1b4b('0x7')),'defaultValue':_0x1b4b('0x3')},'content':{'type':Sequelize[_0x1b4b('0x8')]},'key':{'type':Sequelize[_0x1b4b('0x8')]},'keyType':{'type':Sequelize[_0x1b4b('0x2')](_0x1b4b('0x3'),_0x1b4b('0x4'),_0x1b4b('0x5'))},'keyContent':{'type':Sequelize[_0x1b4b('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1b4b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1b4b('0x8')]}}; \ No newline at end of file +var _0x5ab9=['exports','ENUM','variable','keyValue','picklist','STRING','string','customVariable','BOOLEAN','sequelize'];(function(_0x56ea6f,_0x15535a){var _0x43ac31=function(_0x1b6d99){while(--_0x1b6d99){_0x56ea6f['push'](_0x56ea6f['shift']());}};_0x43ac31(++_0x15535a);}(_0x5ab9,0x1f3));var _0x95ab=function(_0x57b38f,_0xc26f33){_0x57b38f=_0x57b38f-0x0;var _0x6aa12c=_0x5ab9[_0x57b38f];return _0x6aa12c;};'use strict';var Sequelize=require(_0x95ab('0x0'));module[_0x95ab('0x1')]={'type':{'type':Sequelize[_0x95ab('0x2')]('string',_0x95ab('0x3'),'customVariable',_0x95ab('0x4'),_0x95ab('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x95ab('0x6')]},'key':{'type':Sequelize[_0x95ab('0x6')]},'keyType':{'type':Sequelize[_0x95ab('0x2')](_0x95ab('0x7'),_0x95ab('0x3'),_0x95ab('0x8'))},'keyContent':{'type':Sequelize[_0x95ab('0x6')]},'idField':{'type':Sequelize[_0x95ab('0x6')]},'nameField':{'type':Sequelize[_0x95ab('0x6')]},'customField':{'type':Sequelize[_0x95ab('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x95ab('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 6587c06..f27c38e 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 _0xceca=['rows','catch','show','params','merge','options','create','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll'];(function(_0x1546d7,_0x166019){var _0x2885c7=function(_0x46a5b){while(--_0x46a5b){_0x1546d7['push'](_0x1546d7['shift']());}};_0x2885c7(++_0x166019);}(_0xceca,0xf1));var _0xacec=function(_0x3ce42c,_0x108445){_0x3ce42c=_0x3ce42c-0x0;var _0x3cf610=_0xceca[_0x3ce42c];return _0x3cf610;};'use strict';var emlformat=require(_0xacec('0x0'));var rimraf=require(_0xacec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xacec('0x2'));var rp=require(_0xacec('0x3'));var moment=require(_0xacec('0x4'));var BPromise=require(_0xacec('0x5'));var Mustache=require(_0xacec('0x6'));var util=require(_0xacec('0x7'));var path=require(_0xacec('0x8'));var sox=require(_0xacec('0x9'));var csv=require(_0xacec('0xa'));var ejs=require(_0xacec('0xb'));var fs=require('fs');var fs_extra=require(_0xacec('0xc'));var _=require(_0xacec('0xd'));var squel=require('squel');var crypto=require(_0xacec('0xe'));var jsforce=require(_0xacec('0xf'));var deskjs=require(_0xacec('0x10'));var toCsv=require('to-csv');var querystring=require(_0xacec('0x11'));var Papa=require(_0xacec('0x12'));var Redis=require(_0xacec('0x13'));var authService=require(_0xacec('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xacec('0x15'));var hardwareService=require(_0xacec('0x16'));var logger=require(_0xacec('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xacec('0x18'));var licenseUtil=require(_0xacec('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1edd16,_0x4188fc){_0x4188fc=_0x4188fc||0xcc;return function(_0x23b41f){if(_0x23b41f){return _0x1edd16['sendStatus'](_0x4188fc);}return _0x1edd16[_0xacec('0x1a')](_0x4188fc)[_0xacec('0x1b')]();};}function respondWithResult(_0x3add35,_0xfb255){_0xfb255=_0xfb255||0xc8;return function(_0x474815){if(_0x474815){return _0x3add35[_0xacec('0x1a')](_0xfb255)[_0xacec('0x1c')](_0x474815);}};}function respondWithFilteredResult(_0x42c2be,_0x4c15f5){return function(_0x3748f4){if(_0x3748f4){var _0x55bab4=typeof _0x4c15f5['offset']===_0xacec('0x1d')&&typeof _0x4c15f5[_0xacec('0x1e')]==='undefined';var _0x42ece2=_0x3748f4[_0xacec('0x1f')];var _0xcd9fe4=_0x55bab4?0x0:_0x4c15f5['offset'];var _0x4928ee=_0x55bab4?_0x3748f4[_0xacec('0x1f')]:_0x4c15f5['offset']+_0x4c15f5[_0xacec('0x1e')];var _0x376f12;if(_0x4928ee>=_0x42ece2){_0x4928ee=_0x42ece2;_0x376f12=0xc8;}else{_0x376f12=0xce;}_0x42c2be[_0xacec('0x1a')](_0x376f12);return _0x42c2be[_0xacec('0x20')](_0xacec('0x21'),_0xcd9fe4+'-'+_0x4928ee+'/'+_0x42ece2)[_0xacec('0x1c')](_0x3748f4);}return null;};}function patchUpdates(_0x4e81ba){return function(_0xff2084){try{jsonpatch[_0xacec('0x22')](_0xff2084,_0x4e81ba,!![]);}catch(_0x519e3a){return BPromise[_0xacec('0x23')](_0x519e3a);}return _0xff2084[_0xacec('0x24')]();};}function saveUpdates(_0x226352,_0x1b515f){return function(_0x448862){if(_0x448862){return _0x448862[_0xacec('0x25')](_0x226352)[_0xacec('0x26')](function(_0x275880){return _0x275880;});}return null;};}function removeEntity(_0x375809,_0x15d37f){return function(_0xa98fcb){if(_0xa98fcb){return _0xa98fcb['destroy']()[_0xacec('0x26')](function(){_0x375809[_0xacec('0x1a')](0xcc)[_0xacec('0x1b')]();});}};}function handleEntityNotFound(_0x54c145,_0x5344ad){return function(_0x31109a){if(!_0x31109a){_0x54c145['sendStatus'](0x194);}return _0x31109a;};}function handleError(_0x370175,_0x1fdc56){_0x1fdc56=_0x1fdc56||0x1f4;return function(_0x5500c1){logger['error'](_0x5500c1[_0xacec('0x27')]);if(_0x5500c1['name']){delete _0x5500c1[_0xacec('0x28')];}_0x370175[_0xacec('0x1a')](_0x1fdc56)[_0xacec('0x29')](_0x5500c1);};}exports[_0xacec('0x2a')]=function(_0x52df7a,_0x8bc56e){var _0xdc901c={},_0x4ecb33={},_0x383de1={'count':0x0,'rows':[]};var _0x25ac78=_[_0xacec('0x2b')](db[_0xacec('0x2c')][_0xacec('0x2d')],function(_0x533198){return{'name':_0x533198[_0xacec('0x2e')],'type':_0x533198[_0xacec('0x2f')][_0xacec('0x30')]};});_0x4ecb33[_0xacec('0x31')]=_[_0xacec('0x2b')](_0x25ac78,_0xacec('0x28'));_0x4ecb33[_0xacec('0x32')]=_[_0xacec('0x33')](_0x52df7a[_0xacec('0x32')]);_0x4ecb33[_0xacec('0x34')]=_[_0xacec('0x35')](_0x4ecb33['model'],_0x4ecb33[_0xacec('0x32')]);_0xdc901c[_0xacec('0x36')]=_['intersection'](_0x4ecb33[_0xacec('0x31')],qs['fields'](_0x52df7a['query'][_0xacec('0x37')]));_0xdc901c[_0xacec('0x36')]=_0xdc901c[_0xacec('0x36')][_0xacec('0x38')]?_0xdc901c[_0xacec('0x36')]:_0x4ecb33[_0xacec('0x31')];if(!_0x52df7a[_0xacec('0x32')][_0xacec('0x39')]('nolimit')){_0xdc901c[_0xacec('0x1e')]=qs[_0xacec('0x1e')](_0x52df7a[_0xacec('0x32')][_0xacec('0x1e')]);_0xdc901c[_0xacec('0x3a')]=qs['offset'](_0x52df7a['query'][_0xacec('0x3a')]);}_0xdc901c['order']=qs[_0xacec('0x3b')](_0x52df7a[_0xacec('0x32')][_0xacec('0x3b')]);_0xdc901c[_0xacec('0x3c')]=qs['filters'](_[_0xacec('0x3d')](_0x52df7a[_0xacec('0x32')],_0x4ecb33['filters']),_0x25ac78);if(_0x52df7a['query'][_0xacec('0x3e')]){_0xdc901c[_0xacec('0x3c')]=_['merge'](_0xdc901c[_0xacec('0x3c')],{'$or':_[_0xacec('0x2b')](_0x25ac78,function(_0x3dbcd0){if(_0x3dbcd0[_0xacec('0x2f')]!==_0xacec('0x3f')){var _0x2581af={};_0x2581af[_0x3dbcd0['name']]={'$like':'%'+_0x52df7a[_0xacec('0x32')][_0xacec('0x3e')]+'%'};return _0x2581af;}})});}_0xdc901c=_['merge']({},_0xdc901c,_0x52df7a['options']);var _0x210b2b={'where':_0xdc901c[_0xacec('0x3c')]};return db[_0xacec('0x2c')][_0xacec('0x1f')](_0x210b2b)[_0xacec('0x26')](function(_0x29e78b){_0x383de1['count']=_0x29e78b;if(_0x52df7a[_0xacec('0x32')][_0xacec('0x40')]){_0xdc901c[_0xacec('0x41')]=[{'all':!![]}];}return db['ZendeskField'][_0xacec('0x42')](_0xdc901c);})[_0xacec('0x26')](function(_0x4ab425){_0x383de1[_0xacec('0x43')]=_0x4ab425;return _0x383de1;})['then'](respondWithFilteredResult(_0x8bc56e,_0xdc901c))[_0xacec('0x44')](handleError(_0x8bc56e,null));};exports[_0xacec('0x45')]=function(_0x30c6d7,_0x31a7f5){var _0x412712={'raw':!![],'where':{'id':_0x30c6d7[_0xacec('0x46')]['id']}},_0x4181e3={};_0x4181e3[_0xacec('0x31')]=_['keys'](db[_0xacec('0x2c')][_0xacec('0x2d')]);_0x4181e3[_0xacec('0x32')]=_[_0xacec('0x33')](_0x30c6d7[_0xacec('0x32')]);_0x4181e3[_0xacec('0x34')]=_['intersection'](_0x4181e3['model'],_0x4181e3[_0xacec('0x32')]);_0x412712[_0xacec('0x36')]=_[_0xacec('0x35')](_0x4181e3[_0xacec('0x31')],qs['fields'](_0x30c6d7[_0xacec('0x32')][_0xacec('0x37')]));_0x412712[_0xacec('0x36')]=_0x412712['attributes'][_0xacec('0x38')]?_0x412712[_0xacec('0x36')]:_0x4181e3[_0xacec('0x31')];if(_0x30c6d7[_0xacec('0x32')][_0xacec('0x40')]){_0x412712[_0xacec('0x41')]=[{'all':!![]}];}_0x412712=_[_0xacec('0x47')]({},_0x412712,_0x30c6d7[_0xacec('0x48')]);return db[_0xacec('0x2c')]['find'](_0x412712)[_0xacec('0x26')](handleEntityNotFound(_0x31a7f5,null))[_0xacec('0x26')](respondWithResult(_0x31a7f5,null))[_0xacec('0x44')](handleError(_0x31a7f5,null));};exports[_0xacec('0x49')]=function(_0x5bf6db,_0x540b05){return db[_0xacec('0x2c')][_0xacec('0x49')](_0x5bf6db[_0xacec('0x4a')],{})['then'](respondWithResult(_0x540b05,0xc9))[_0xacec('0x44')](handleError(_0x540b05,null));};exports[_0xacec('0x25')]=function(_0x1f19cc,_0x362ef1){if(_0x1f19cc['body']['id']){delete _0x1f19cc['body']['id'];}return db['ZendeskField'][_0xacec('0x4b')]({'where':{'id':_0x1f19cc[_0xacec('0x46')]['id']}})[_0xacec('0x26')](handleEntityNotFound(_0x362ef1,null))[_0xacec('0x26')](saveUpdates(_0x1f19cc['body'],null))[_0xacec('0x26')](respondWithResult(_0x362ef1,null))['catch'](handleError(_0x362ef1,null));};exports[_0xacec('0x4c')]=function(_0xa264a6,_0x391d17){return db[_0xacec('0x2c')]['find']({'where':{'id':_0xa264a6['params']['id']}})[_0xacec('0x26')](handleEntityNotFound(_0x391d17,null))[_0xacec('0x26')](removeEntity(_0x391d17,null))[_0xacec('0x44')](handleError(_0x391d17,null));}; \ No newline at end of file +var _0xa109=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','set','Content-Range','json','apply','update','then','error','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','options','where','count','include','findAll','rows','catch','params','keys','length','includeAll','merge','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x2ad061,_0x226d3b){var _0x2424b0=function(_0x32a1b4){while(--_0x32a1b4){_0x2ad061['push'](_0x2ad061['shift']());}};_0x2424b0(++_0x226d3b);}(_0xa109,0x1b9));var _0x9a10=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa109[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x9a10('0x0'));var rimraf=require(_0x9a10('0x1'));var zipdir=require(_0x9a10('0x2'));var jsonpatch=require(_0x9a10('0x3'));var rp=require(_0x9a10('0x4'));var moment=require('moment');var BPromise=require(_0x9a10('0x5'));var Mustache=require(_0x9a10('0x6'));var util=require(_0x9a10('0x7'));var path=require(_0x9a10('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9a10('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9a10('0xa'));var crypto=require(_0x9a10('0xb'));var jsforce=require(_0x9a10('0xc'));var deskjs=require(_0x9a10('0xd'));var toCsv=require(_0x9a10('0xe'));var querystring=require(_0x9a10('0xf'));var Papa=require(_0x9a10('0x10'));var Redis=require(_0x9a10('0x11'));var authService=require(_0x9a10('0x12'));var qs=require(_0x9a10('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a10('0x14'));var logger=require('../../config/logger')(_0x9a10('0x15'));var utils=require(_0x9a10('0x16'));var config=require(_0x9a10('0x17'));var licenseUtil=require(_0x9a10('0x18'));var db=require(_0x9a10('0x19'))['db'];function respondWithStatusCode(_0x45d54f,_0x4f3f48){_0x4f3f48=_0x4f3f48||0xcc;return function(_0x2c40c5){if(_0x2c40c5){return _0x45d54f[_0x9a10('0x1a')](_0x4f3f48);}return _0x45d54f[_0x9a10('0x1b')](_0x4f3f48)[_0x9a10('0x1c')]();};}function respondWithResult(_0x155fd9,_0xef2b6b){_0xef2b6b=_0xef2b6b||0xc8;return function(_0x54aea9){if(_0x54aea9){return _0x155fd9[_0x9a10('0x1b')](_0xef2b6b)['json'](_0x54aea9);}};}function respondWithFilteredResult(_0x5d9cce,_0x100465){return function(_0x496b4c){if(_0x496b4c){var _0x29ffb4=typeof _0x100465[_0x9a10('0x1d')]==='undefined'&&typeof _0x100465[_0x9a10('0x1e')]===_0x9a10('0x1f');var _0x2888fd=_0x496b4c['count'];var _0x186c94=_0x29ffb4?0x0:_0x100465[_0x9a10('0x1d')];var _0x59d72c=_0x29ffb4?_0x496b4c['count']:_0x100465[_0x9a10('0x1d')]+_0x100465['limit'];var _0x3e8169;if(_0x59d72c>=_0x2888fd){_0x59d72c=_0x2888fd;_0x3e8169=0xc8;}else{_0x3e8169=0xce;}_0x5d9cce[_0x9a10('0x1b')](_0x3e8169);return _0x5d9cce[_0x9a10('0x20')](_0x9a10('0x21'),_0x186c94+'-'+_0x59d72c+'/'+_0x2888fd)[_0x9a10('0x22')](_0x496b4c);}return null;};}function patchUpdates(_0x5bea4d){return function(_0x465c19){try{jsonpatch[_0x9a10('0x23')](_0x465c19,_0x5bea4d,!![]);}catch(_0x4b5f74){return BPromise['reject'](_0x4b5f74);}return _0x465c19['save']();};}function saveUpdates(_0x4158cb,_0x1790ce){return function(_0x2c1eab){if(_0x2c1eab){return _0x2c1eab[_0x9a10('0x24')](_0x4158cb)[_0x9a10('0x25')](function(_0x407df7){return _0x407df7;});}return null;};}function removeEntity(_0x175286,_0x5ec745){return function(_0x447da5){if(_0x447da5){return _0x447da5['destroy']()['then'](function(){_0x175286['status'](0xcc)[_0x9a10('0x1c')]();});}};}function handleEntityNotFound(_0x2b725f,_0x8f4dc3){return function(_0x377556){if(!_0x377556){_0x2b725f[_0x9a10('0x1a')](0x194);}return _0x377556;};}function handleError(_0x329772,_0x488caf){_0x488caf=_0x488caf||0x1f4;return function(_0xad4bf2){logger[_0x9a10('0x26')](_0xad4bf2[_0x9a10('0x27')]);if(_0xad4bf2[_0x9a10('0x28')]){delete _0xad4bf2[_0x9a10('0x28')];}_0x329772[_0x9a10('0x1b')](_0x488caf)[_0x9a10('0x29')](_0xad4bf2);};}exports[_0x9a10('0x2a')]=function(_0x1cddfc,_0x457cbe){var _0x19a03e={},_0x16a04e={},_0xe576e8={'count':0x0,'rows':[]};var _0x21e441=_[_0x9a10('0x2b')](db[_0x9a10('0x2c')][_0x9a10('0x2d')],function(_0x161bb9){return{'name':_0x161bb9['fieldName'],'type':_0x161bb9[_0x9a10('0x2e')][_0x9a10('0x2f')]};});_0x16a04e[_0x9a10('0x30')]=_[_0x9a10('0x2b')](_0x21e441,_0x9a10('0x28'));_0x16a04e[_0x9a10('0x31')]=_['keys'](_0x1cddfc['query']);_0x16a04e[_0x9a10('0x32')]=_[_0x9a10('0x33')](_0x16a04e['model'],_0x16a04e['query']);_0x19a03e[_0x9a10('0x34')]=_[_0x9a10('0x33')](_0x16a04e[_0x9a10('0x30')],qs[_0x9a10('0x35')](_0x1cddfc[_0x9a10('0x31')][_0x9a10('0x35')]));_0x19a03e[_0x9a10('0x34')]=_0x19a03e[_0x9a10('0x34')]['length']?_0x19a03e['attributes']:_0x16a04e[_0x9a10('0x30')];if(!_0x1cddfc['query'][_0x9a10('0x36')](_0x9a10('0x37'))){_0x19a03e[_0x9a10('0x1e')]=qs[_0x9a10('0x1e')](_0x1cddfc[_0x9a10('0x31')]['limit']);_0x19a03e['offset']=qs[_0x9a10('0x1d')](_0x1cddfc[_0x9a10('0x31')]['offset']);}_0x19a03e[_0x9a10('0x38')]=qs[_0x9a10('0x39')](_0x1cddfc['query'][_0x9a10('0x39')]);_0x19a03e['where']=qs[_0x9a10('0x32')](_[_0x9a10('0x3a')](_0x1cddfc['query'],_0x16a04e[_0x9a10('0x32')]),_0x21e441);if(_0x1cddfc[_0x9a10('0x31')][_0x9a10('0x3b')]){_0x19a03e['where']=_['merge'](_0x19a03e['where'],{'$or':_[_0x9a10('0x2b')](_0x21e441,function(_0x3e2b9a){if(_0x3e2b9a[_0x9a10('0x2e')]!==_0x9a10('0x3c')){var _0x544c19={};_0x544c19[_0x3e2b9a[_0x9a10('0x28')]]={'$like':'%'+_0x1cddfc[_0x9a10('0x31')][_0x9a10('0x3b')]+'%'};return _0x544c19;}})});}_0x19a03e=_['merge']({},_0x19a03e,_0x1cddfc[_0x9a10('0x3d')]);var _0x428ada={'where':_0x19a03e[_0x9a10('0x3e')]};return db[_0x9a10('0x2c')][_0x9a10('0x3f')](_0x428ada)[_0x9a10('0x25')](function(_0x7c2d38){_0xe576e8[_0x9a10('0x3f')]=_0x7c2d38;if(_0x1cddfc['query']['includeAll']){_0x19a03e[_0x9a10('0x40')]=[{'all':!![]}];}return db[_0x9a10('0x2c')][_0x9a10('0x41')](_0x19a03e);})[_0x9a10('0x25')](function(_0x3c35e7){_0xe576e8[_0x9a10('0x42')]=_0x3c35e7;return _0xe576e8;})[_0x9a10('0x25')](respondWithFilteredResult(_0x457cbe,_0x19a03e))[_0x9a10('0x43')](handleError(_0x457cbe,null));};exports['show']=function(_0xa2b24,_0xc93ad5){var _0x4cd276={'raw':!![],'where':{'id':_0xa2b24[_0x9a10('0x44')]['id']}},_0x500679={};_0x500679['model']=_[_0x9a10('0x45')](db[_0x9a10('0x2c')][_0x9a10('0x2d')]);_0x500679[_0x9a10('0x31')]=_['keys'](_0xa2b24[_0x9a10('0x31')]);_0x500679[_0x9a10('0x32')]=_[_0x9a10('0x33')](_0x500679[_0x9a10('0x30')],_0x500679[_0x9a10('0x31')]);_0x4cd276['attributes']=_[_0x9a10('0x33')](_0x500679[_0x9a10('0x30')],qs[_0x9a10('0x35')](_0xa2b24[_0x9a10('0x31')][_0x9a10('0x35')]));_0x4cd276['attributes']=_0x4cd276[_0x9a10('0x34')][_0x9a10('0x46')]?_0x4cd276['attributes']:_0x500679[_0x9a10('0x30')];if(_0xa2b24[_0x9a10('0x31')][_0x9a10('0x47')]){_0x4cd276[_0x9a10('0x40')]=[{'all':!![]}];}_0x4cd276=_[_0x9a10('0x48')]({},_0x4cd276,_0xa2b24[_0x9a10('0x3d')]);return db[_0x9a10('0x2c')][_0x9a10('0x49')](_0x4cd276)[_0x9a10('0x25')](handleEntityNotFound(_0xc93ad5,null))[_0x9a10('0x25')](respondWithResult(_0xc93ad5,null))['catch'](handleError(_0xc93ad5,null));};exports[_0x9a10('0x4a')]=function(_0x3a31b8,_0x1e18c8){return db['ZendeskField'][_0x9a10('0x4a')](_0x3a31b8[_0x9a10('0x4b')],{})[_0x9a10('0x25')](respondWithResult(_0x1e18c8,0xc9))[_0x9a10('0x43')](handleError(_0x1e18c8,null));};exports[_0x9a10('0x24')]=function(_0x26e124,_0x2fad99){if(_0x26e124['body']['id']){delete _0x26e124['body']['id'];}return db['ZendeskField'][_0x9a10('0x49')]({'where':{'id':_0x26e124[_0x9a10('0x44')]['id']}})[_0x9a10('0x25')](handleEntityNotFound(_0x2fad99,null))[_0x9a10('0x25')](saveUpdates(_0x26e124['body'],null))[_0x9a10('0x25')](respondWithResult(_0x2fad99,null))[_0x9a10('0x43')](handleError(_0x2fad99,null));};exports[_0x9a10('0x4c')]=function(_0x3570f7,_0xd029a3){return db['ZendeskField'][_0x9a10('0x49')]({'where':{'id':_0x3570f7[_0x9a10('0x44')]['id']}})[_0x9a10('0x25')](handleEntityNotFound(_0xd029a3,null))[_0x9a10('0x25')](removeEntity(_0xd029a3,null))[_0x9a10('0x43')](handleError(_0xd029a3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index f77aba7..fd6856e 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 _0xb702=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x524884,_0x2e6d71){var _0x440a44=function(_0x626e73){while(--_0x626e73){_0x524884['push'](_0x524884['shift']());}};_0x440a44(++_0x2e6d71);}(_0xb702,0xef));var _0x2b70=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0xb702[_0x412e27];return _0x53da42;};'use strict';var _=require(_0x2b70('0x0'));var util=require(_0x2b70('0x1'));var logger=require(_0x2b70('0x2'))(_0x2b70('0x3'));var moment=require(_0x2b70('0x4'));var BPromise=require(_0x2b70('0x5'));var rp=require(_0x2b70('0x6'));var fs=require('fs');var path=require(_0x2b70('0x7'));var rimraf=require(_0x2b70('0x8'));var config=require(_0x2b70('0x9'));var attributes=require('./intZendeskField.attributes');module[_0x2b70('0xa')]=function(_0x1b8f17,_0x409ac9){return _0x1b8f17[_0x2b70('0xb')](_0x2b70('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x2b70('0xd'),'fields':[_0x2b70('0xe'),_0x2b70('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc994=['idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','ZendeskField','zendesk_unique_index'];(function(_0xa09f1,_0x5ab612){var _0x4177df=function(_0x206dc8){while(--_0x206dc8){_0xa09f1['push'](_0xa09f1['shift']());}};_0x4177df(++_0x5ab612);}(_0xc994,0x16a));var _0x4c99=function(_0x188a41,_0x371f0c){_0x188a41=_0x188a41-0x0;var _0x470b76=_0xc994[_0x188a41];return _0x470b76;};'use strict';var _=require('lodash');var util=require(_0x4c99('0x0'));var logger=require(_0x4c99('0x1'))('api');var moment=require(_0x4c99('0x2'));var BPromise=require(_0x4c99('0x3'));var rp=require(_0x4c99('0x4'));var fs=require('fs');var path=require(_0x4c99('0x5'));var rimraf=require('rimraf');var config=require(_0x4c99('0x6'));var attributes=require('./intZendeskField.attributes');module[_0x4c99('0x7')]=function(_0x257734,_0x382609){return _0x257734['define'](_0x4c99('0x8'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x4c99('0x9'),'fields':[_0x4c99('0xa'),_0x4c99('0xb')],'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 5d9e69d..5e011ea 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 _0xf860=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xf860,0xc9));var _0x0f86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf860[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0f86('0x0'));var util=require(_0x0f86('0x1'));var moment=require('moment');var BPromise=require(_0x0f86('0x2'));var rs=require(_0x0f86('0x3'));var fs=require('fs');var Redis=require(_0x0f86('0x4'));var db=require(_0x0f86('0x5'))['db'];var utils=require(_0x0f86('0x6'));var logger=require(_0x0f86('0x7'))(_0x0f86('0x8'));var config=require(_0x0f86('0x9'));var jayson=require(_0x0f86('0xa'));var client=jayson[_0x0f86('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x84a840,_0xa29073,_0x13f78b){return new BPromise(function(_0x183d87,_0x396123){return client[_0x0f86('0xc')](_0x84a840,_0x13f78b)[_0x0f86('0xd')](function(_0x203c00){logger[_0x0f86('0xe')](_0x0f86('0xf'),_0xa29073,_0x0f86('0x10'));logger[_0x0f86('0x11')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0xa29073,_0x0f86('0x10'),JSON[_0x0f86('0x12')](_0x203c00));if(_0x203c00[_0x0f86('0x13')]){if(_0x203c00[_0x0f86('0x13')][_0x0f86('0x14')]===0x1f4){logger[_0x0f86('0x13')]('ZendeskField,\x20%s,\x20%s',_0xa29073,_0x203c00['error'][_0x0f86('0x15')]);return _0x396123(_0x203c00[_0x0f86('0x13')][_0x0f86('0x15')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0xa29073,_0x203c00[_0x0f86('0x13')][_0x0f86('0x15')]);return _0x183d87(_0x203c00[_0x0f86('0x13')]['message']);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0xa29073,_0x0f86('0x10'));_0x183d87(_0x203c00[_0x0f86('0x16')][_0x0f86('0x15')]);}})[_0x0f86('0x17')](function(_0x1cbc91){logger[_0x0f86('0x13')](_0x0f86('0xf'),_0xa29073,_0x1cbc91);_0x396123(_0x1cbc91);});});} \ No newline at end of file +var _0x3815=['request\x20sent','debug','code','message','error','result','catch','util','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3815,0x97));var _0x5381=function(_0x29283e,_0x3a2ad3){_0x29283e=_0x29283e-0x0;var _0x2f22fe=_0x3815[_0x29283e];return _0x2f22fe;};'use strict';var _=require('lodash');var util=require(_0x5381('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5381('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5381('0x2'));var logger=require('../../config/logger')(_0x5381('0x3'));var config=require(_0x5381('0x4'));var jayson=require(_0x5381('0x5'));var client=jayson['client'][_0x5381('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x187a38,_0x3ea6ae,_0x3fbcb3){return new BPromise(function(_0x4b0b00,_0x5ece13){return client[_0x5381('0x7')](_0x187a38,_0x3fbcb3)[_0x5381('0x8')](function(_0x385085){logger[_0x5381('0x9')](_0x5381('0xa'),_0x3ea6ae,_0x5381('0xb'));logger[_0x5381('0xc')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x3ea6ae,_0x5381('0xb'),JSON['stringify'](_0x385085));if(_0x385085['error']){if(_0x385085['error'][_0x5381('0xd')]===0x1f4){logger['error'](_0x5381('0xa'),_0x3ea6ae,_0x385085['error'][_0x5381('0xe')]);return _0x5ece13(_0x385085[_0x5381('0xf')][_0x5381('0xe')]);}logger[_0x5381('0xf')](_0x5381('0xa'),_0x3ea6ae,_0x385085[_0x5381('0xf')][_0x5381('0xe')]);return _0x4b0b00(_0x385085['error'][_0x5381('0xe')]);}else{logger[_0x5381('0x9')](_0x5381('0xa'),_0x3ea6ae,'request\x20sent');_0x4b0b00(_0x385085[_0x5381('0x10')][_0x5381('0xe')]);}})[_0x5381('0x11')](function(_0xc541cf){logger[_0x5381('0xf')](_0x5381('0xa'),_0x3ea6ae,_0xc541cf);_0x5ece13(_0xc541cf);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index c160276..49acbf3 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 _0xed0c=['addConfiguration','put','update','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','create','/:id/configurations'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xed0c,0x16c));var _0xced0=function(_0x27eaa1,_0x3e5b0f){_0x27eaa1=_0x27eaa1-0x0;var _0x21b5d4=_0xed0c[_0x27eaa1];return _0x21b5d4;};'use strict';var multer=require('multer');var util=require(_0xced0('0x0'));var path=require(_0xced0('0x1'));var timeout=require(_0xced0('0x2'));var express=require(_0xced0('0x3'));var router=express['Router']();var fs_extra=require(_0xced0('0x4'));var auth=require(_0xced0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced0('0x6'));router[_0xced0('0x7')]('/',auth[_0xced0('0x8')](),controller[_0xced0('0x9')]);router['get'](_0xced0('0xa'),auth[_0xced0('0x8')](),controller['show']);router['get']('/:id/configurations',auth[_0xced0('0x8')](),controller[_0xced0('0xb')]);router[_0xced0('0x7')](_0xced0('0xc'),auth[_0xced0('0x8')](),controller[_0xced0('0xd')]);router['post']('/',auth[_0xced0('0x8')](),controller[_0xced0('0xe')]);router['post'](_0xced0('0xf'),auth[_0xced0('0x8')](),controller[_0xced0('0x10')]);router[_0xced0('0x11')]('/:id',auth[_0xced0('0x8')](),controller[_0xced0('0x12')]);router['delete'](_0xced0('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xced0('0x13')]=router; \ No newline at end of file +var _0xaaea=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','express','Router'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0xaaea,0xc1));var _0xaaae=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xaaea[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xaaae('0x0'));var util=require(_0xaaae('0x1'));var path=require(_0xaaae('0x2'));var timeout=require('connect-timeout');var express=require(_0xaaae('0x3'));var router=express[_0xaaae('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaaae('0x5'));var interaction=require(_0xaaae('0x6'));var config=require(_0xaaae('0x7'));var controller=require('./intZohoAccount.controller');router[_0xaaae('0x8')]('/',auth[_0xaaae('0x9')](),controller[_0xaaae('0xa')]);router['get'](_0xaaae('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xaaae('0x8')](_0xaaae('0xc'),auth[_0xaaae('0x9')](),controller['getConfigurations']);router[_0xaaae('0x8')](_0xaaae('0xd'),auth[_0xaaae('0x9')](),controller[_0xaaae('0xe')]);router[_0xaaae('0xf')]('/',auth[_0xaaae('0x9')](),controller[_0xaaae('0x10')]);router['post'](_0xaaae('0xc'),auth[_0xaaae('0x9')](),controller[_0xaaae('0x11')]);router[_0xaaae('0x12')](_0xaaae('0xb'),auth[_0xaaae('0x9')](),controller[_0xaaae('0x13')]);router[_0xaaae('0x14')](_0xaaae('0xb'),auth[_0xaaae('0x9')](),controller[_0xaaae('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index be08a57..d602464 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 _0x99e9=['exports','STRING'];(function(_0xbaa16e,_0x1dbdcc){var _0x2074ca=function(_0x33e81a){while(--_0x33e81a){_0xbaa16e['push'](_0xbaa16e['shift']());}};_0x2074ca(++_0x1dbdcc);}(_0x99e9,0xb4));var _0x999e=function(_0x5b04a3,_0xfda4fd){_0x5b04a3=_0x5b04a3-0x0;var _0x1adf11=_0x99e9[_0x5b04a3];return _0x1adf11;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file +var _0x91a7=['STRING','exports'];(function(_0x1bd101,_0x1f9ce5){var _0x4623f0=function(_0x4c2dd5){while(--_0x4c2dd5){_0x1bd101['push'](_0x1bd101['shift']());}};_0x4623f0(++_0x1f9ce5);}(_0x91a7,0xe7));var _0x791a=function(_0x2b2a56,_0x11e8a5){_0x2b2a56=_0x2b2a56-0x0;var _0x4868a0=_0x91a7[_0x2b2a56];return _0x4868a0;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'name':{'type':Sequelize[_0x791a('0x1')]},'description':{'type':Sequelize[_0x791a('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x791a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x791a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x791a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a621a8b..6587d02 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 _0x9798=['sort','where','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','keys','intersection','find','create','body','catch','update','getConfigurations','findOne','pick','nolimit','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','zone','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','api_name','system_mandatory','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZohoAccount','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','order'];(function(_0x19a005,_0x13c096){var _0x511eaf=function(_0x47b70b){while(--_0x47b70b){_0x19a005['push'](_0x19a005['shift']());}};_0x511eaf(++_0x13c096);}(_0x9798,0xcb));var _0x8979=function(_0x54786c,_0x391f4f){_0x54786c=_0x54786c-0x0;var _0x26e59d=_0x9798[_0x54786c];return _0x26e59d;};'use strict';var emlformat=require(_0x8979('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8979('0x1'));var jsonpatch=require(_0x8979('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8979('0x3'));var Mustache=require(_0x8979('0x4'));var util=require(_0x8979('0x5'));var path=require(_0x8979('0x6'));var sox=require(_0x8979('0x7'));var csv=require(_0x8979('0x8'));var ejs=require(_0x8979('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8979('0xa'));var crypto=require(_0x8979('0xb'));var jsforce=require(_0x8979('0xc'));var deskjs=require(_0x8979('0xd'));var toCsv=require(_0x8979('0x8'));var querystring=require(_0x8979('0xe'));var Papa=require(_0x8979('0xf'));var Redis=require(_0x8979('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8979('0x11'));var as=require(_0x8979('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8979('0x13'));var utils=require(_0x8979('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x8979('0x15'));var db=require(_0x8979('0x16'))['db'];var integrations=require(_0x8979('0x17'));function respondWithStatusCode(_0x2c50cc,_0x3ecb66){_0x3ecb66=_0x3ecb66||0xcc;return function(_0x1d9061){if(_0x1d9061){return _0x2c50cc[_0x8979('0x18')](_0x3ecb66);}return _0x2c50cc[_0x8979('0x19')](_0x3ecb66)[_0x8979('0x1a')]();};}function respondWithResult(_0x321952,_0x48e277){_0x48e277=_0x48e277||0xc8;return function(_0xf68402){if(_0xf68402){return _0x321952[_0x8979('0x19')](_0x48e277)[_0x8979('0x1b')](_0xf68402);}};}function respondWithFilteredResult(_0x4703f9,_0x53c4af){return function(_0x5288c6){if(_0x5288c6){var _0x2c556b=typeof _0x53c4af[_0x8979('0x1c')]===_0x8979('0x1d')&&typeof _0x53c4af[_0x8979('0x1e')]==='undefined';var _0x1c782e=_0x5288c6[_0x8979('0x1f')];var _0x52831b=_0x2c556b?0x0:_0x53c4af[_0x8979('0x1c')];var _0x329e32=_0x2c556b?_0x5288c6['count']:_0x53c4af['offset']+_0x53c4af['limit'];var _0x1572fb;if(_0x329e32>=_0x1c782e){_0x329e32=_0x1c782e;_0x1572fb=0xc8;}else{_0x1572fb=0xce;}_0x4703f9[_0x8979('0x19')](_0x1572fb);return _0x4703f9[_0x8979('0x20')]('Content-Range',_0x52831b+'-'+_0x329e32+'/'+_0x1c782e)[_0x8979('0x1b')](_0x5288c6);}return null;};}function patchUpdates(_0x4b7bda){return function(_0x56a7d1){try{jsonpatch[_0x8979('0x21')](_0x56a7d1,_0x4b7bda,!![]);}catch(_0x147dbc){return BPromise[_0x8979('0x22')](_0x147dbc);}return _0x56a7d1[_0x8979('0x23')]();};}function saveUpdates(_0x14302d,_0x2d7d5a){return function(_0x2ac7bf){if(_0x2ac7bf){return _0x2ac7bf['update'](_0x14302d)[_0x8979('0x24')](function(_0x377c09){return _0x377c09;});}return null;};}function removeEntity(_0x53c0ea,_0xd2d151){return function(_0x3e6add){if(_0x3e6add){return _0x3e6add[_0x8979('0x25')]()['then'](function(){_0x53c0ea[_0x8979('0x19')](0xcc)[_0x8979('0x1a')]();});}};}function handleEntityNotFound(_0x589e13,_0x5b8c42){return function(_0x5ddba6){if(!_0x5ddba6){_0x589e13[_0x8979('0x18')](0x194);}return _0x5ddba6;};}function handleError(_0x5362d9,_0x44b4d8){_0x44b4d8=_0x44b4d8||0x1f4;return function(_0x24631d){logger[_0x8979('0x26')](_0x24631d[_0x8979('0x27')]);if(_0x24631d[_0x8979('0x28')]){delete _0x24631d[_0x8979('0x28')];}_0x5362d9[_0x8979('0x19')](_0x44b4d8)[_0x8979('0x29')](_0x24631d);};}exports[_0x8979('0x2a')]=function(_0x3c046f,_0x33bf21){var _0x17fd3b={},_0x1cec33={},_0x459916={'count':0x0,'rows':[]};var _0x29ee19=_[_0x8979('0x2b')](db[_0x8979('0x2c')]['rawAttributes'],function(_0x23ae04){return{'name':_0x23ae04['fieldName'],'type':_0x23ae04[_0x8979('0x2d')][_0x8979('0x2e')]};});_0x1cec33['model']=_[_0x8979('0x2b')](_0x29ee19,_0x8979('0x28'));_0x1cec33[_0x8979('0x2f')]=_['keys'](_0x3c046f[_0x8979('0x2f')]);_0x1cec33[_0x8979('0x30')]=_['intersection'](_0x1cec33[_0x8979('0x31')],_0x1cec33[_0x8979('0x2f')]);_0x17fd3b[_0x8979('0x32')]=_['intersection'](_0x1cec33['model'],qs['fields'](_0x3c046f[_0x8979('0x2f')][_0x8979('0x33')]));_0x17fd3b[_0x8979('0x32')]=_0x17fd3b['attributes'][_0x8979('0x34')]?_0x17fd3b[_0x8979('0x32')]:_0x1cec33[_0x8979('0x31')];if(!_0x3c046f[_0x8979('0x2f')][_0x8979('0x35')]('nolimit')){_0x17fd3b['limit']=qs[_0x8979('0x1e')](_0x3c046f[_0x8979('0x2f')]['limit']);_0x17fd3b[_0x8979('0x1c')]=qs[_0x8979('0x1c')](_0x3c046f[_0x8979('0x2f')][_0x8979('0x1c')]);}_0x17fd3b[_0x8979('0x36')]=qs[_0x8979('0x37')](_0x3c046f['query'][_0x8979('0x37')]);_0x17fd3b[_0x8979('0x38')]=qs[_0x8979('0x30')](_['pick'](_0x3c046f[_0x8979('0x2f')],_0x1cec33[_0x8979('0x30')]),_0x29ee19);if(_0x3c046f[_0x8979('0x2f')]['filter']){_0x17fd3b[_0x8979('0x38')]=_['merge'](_0x17fd3b['where'],{'$or':_[_0x8979('0x2b')](_0x29ee19,function(_0x43f82f){if(_0x43f82f[_0x8979('0x2d')]!==_0x8979('0x39')){var _0x3e1acf={};_0x3e1acf[_0x43f82f['name']]={'$like':'%'+_0x3c046f[_0x8979('0x2f')][_0x8979('0x3a')]+'%'};return _0x3e1acf;}})});}_0x17fd3b=_[_0x8979('0x3b')]({},_0x17fd3b,_0x3c046f[_0x8979('0x3c')]);var _0x159f66={'where':_0x17fd3b['where']};return db['ZohoAccount']['count'](_0x159f66)[_0x8979('0x24')](function(_0x480b0a){_0x459916['count']=_0x480b0a;if(_0x3c046f['query'][_0x8979('0x3d')]){_0x17fd3b[_0x8979('0x3e')]=[{'all':!![]}];}return db[_0x8979('0x2c')]['findAll'](_0x17fd3b);})[_0x8979('0x24')](function(_0x1d4c11){_0x459916[_0x8979('0x3f')]=_0x1d4c11;return _0x459916;})[_0x8979('0x24')](respondWithFilteredResult(_0x33bf21,_0x17fd3b))['catch'](handleError(_0x33bf21,null));};exports[_0x8979('0x40')]=function(_0x34b20e,_0x32e954){var _0x9285f0={'raw':![],'where':{'id':_0x34b20e[_0x8979('0x41')]['id']}},_0xd171f4={};_0xd171f4[_0x8979('0x31')]=_['keys'](db[_0x8979('0x2c')]['rawAttributes']);_0xd171f4[_0x8979('0x2f')]=_[_0x8979('0x42')](_0x34b20e[_0x8979('0x2f')]);_0xd171f4[_0x8979('0x30')]=_[_0x8979('0x43')](_0xd171f4['model'],_0xd171f4[_0x8979('0x2f')]);_0x9285f0['attributes']=_[_0x8979('0x43')](_0xd171f4[_0x8979('0x31')],qs[_0x8979('0x33')](_0x34b20e['query'][_0x8979('0x33')]));_0x9285f0[_0x8979('0x32')]=_0x9285f0[_0x8979('0x32')][_0x8979('0x34')]?_0x9285f0['attributes']:_0xd171f4[_0x8979('0x31')];if(_0x34b20e[_0x8979('0x2f')][_0x8979('0x3d')]){_0x9285f0[_0x8979('0x3e')]=[{'all':!![]}];}_0x9285f0=_[_0x8979('0x3b')]({},_0x9285f0,_0x34b20e[_0x8979('0x3c')]);return db['ZohoAccount'][_0x8979('0x44')](_0x9285f0)[_0x8979('0x24')](handleEntityNotFound(_0x32e954,null))[_0x8979('0x24')](respondWithResult(_0x32e954,null))['catch'](handleError(_0x32e954,null));};exports[_0x8979('0x45')]=function(_0x3f9a36,_0x585a6c){return db[_0x8979('0x2c')][_0x8979('0x45')](_0x3f9a36[_0x8979('0x46')],{})[_0x8979('0x24')](respondWithResult(_0x585a6c,0xc9))[_0x8979('0x47')](handleError(_0x585a6c,null));};exports[_0x8979('0x48')]=function(_0xcb935,_0x41f5f2){if(_0xcb935[_0x8979('0x46')]['id']){delete _0xcb935[_0x8979('0x46')]['id'];}return db['ZohoAccount'][_0x8979('0x44')]({'where':{'id':_0xcb935['params']['id']}})[_0x8979('0x24')](handleEntityNotFound(_0x41f5f2,null))[_0x8979('0x24')](saveUpdates(_0xcb935[_0x8979('0x46')],null))['then'](respondWithResult(_0x41f5f2,null))[_0x8979('0x47')](handleError(_0x41f5f2,null));};exports[_0x8979('0x25')]=function(_0x336a3d,_0x567e54){return db[_0x8979('0x2c')]['find']({'where':{'id':_0x336a3d[_0x8979('0x41')]['id']}})[_0x8979('0x24')](handleEntityNotFound(_0x567e54,null))[_0x8979('0x24')](removeEntity(_0x567e54,null))[_0x8979('0x47')](handleError(_0x567e54,null));};exports[_0x8979('0x49')]=function(_0x2dd2af,_0x201d35,_0x25d2a0){var _0x5de031={};var _0x432b0a={};var _0x4d6754;var _0x4fa156;return db['ZohoAccount'][_0x8979('0x4a')]({'where':{'id':_0x2dd2af['params']['id']}})['then'](handleEntityNotFound(_0x201d35,null))[_0x8979('0x24')](function(_0x2719f2){if(_0x2719f2){_0x4d6754=_0x2719f2;_0x432b0a['model']=_[_0x8979('0x42')](db['ZohoConfiguration']['rawAttributes']);_0x432b0a[_0x8979('0x2f')]=_[_0x8979('0x42')](_0x2dd2af['query']);_0x432b0a[_0x8979('0x30')]=_['intersection'](_0x432b0a[_0x8979('0x31')],_0x432b0a[_0x8979('0x2f')]);_0x5de031[_0x8979('0x32')]=_[_0x8979('0x43')](_0x432b0a['model'],qs[_0x8979('0x33')](_0x2dd2af['query'][_0x8979('0x33')]));_0x5de031[_0x8979('0x32')]=_0x5de031[_0x8979('0x32')]['length']?_0x5de031[_0x8979('0x32')]:_0x432b0a[_0x8979('0x31')];_0x5de031[_0x8979('0x36')]=qs[_0x8979('0x37')](_0x2dd2af[_0x8979('0x2f')][_0x8979('0x37')]);_0x5de031['where']=qs['filters'](_[_0x8979('0x4b')](_0x2dd2af[_0x8979('0x2f')],_0x432b0a[_0x8979('0x30')]));if(_0x2dd2af[_0x8979('0x2f')][_0x8979('0x3a')]){_0x5de031[_0x8979('0x38')]=_[_0x8979('0x3b')](_0x5de031[_0x8979('0x38')],{'$or':_[_0x8979('0x2b')](_0x5de031[_0x8979('0x32')],function(_0x17b96){var _0x16d5ac={};_0x16d5ac[_0x17b96]={'$like':'%'+_0x2dd2af[_0x8979('0x2f')][_0x8979('0x3a')]+'%'};return _0x16d5ac;})});}_0x5de031=_[_0x8979('0x3b')]({},_0x5de031,_0x2dd2af[_0x8979('0x3c')]);return _0x4d6754[_0x8979('0x49')](_0x5de031);}})['then'](function(_0x182ebf){if(_0x182ebf){_0x4fa156=_0x182ebf['length'];if(!_0x2dd2af[_0x8979('0x2f')][_0x8979('0x35')](_0x8979('0x4c'))){_0x5de031[_0x8979('0x1e')]=qs[_0x8979('0x1e')](_0x2dd2af['query'][_0x8979('0x1e')]);_0x5de031[_0x8979('0x1c')]=qs[_0x8979('0x1c')](_0x2dd2af[_0x8979('0x2f')][_0x8979('0x1c')]);}return _0x4d6754[_0x8979('0x49')](_0x5de031);}})[_0x8979('0x24')](function(_0x2ae34b){if(_0x2ae34b){return _0x2ae34b?{'count':_0x4fa156,'rows':_0x2ae34b}:null;}})[_0x8979('0x24')](respondWithResult(_0x201d35,null))['catch'](handleError(_0x201d35,null));};exports['addConfiguration']=function(_0x4662c3,_0x5c695a,_0x8d56cb){if(_0x4662c3['body']['id']){delete _0x4662c3[_0x8979('0x46')]['id'];}return db[_0x8979('0x2c')][_0x8979('0x4a')]({'where':{'id':_0x4662c3['params']['id']}})['then'](handleEntityNotFound(_0x5c695a,null))['then'](function(_0x147c27){if(_0x147c27){_0x4662c3[_0x8979('0x46')][_0x8979('0x4d')]=_0x147c27['id'];_0x4662c3[_0x8979('0x46')][_0x8979('0x4e')]=integrations['getSubjects'](_0x4662c3[_0x8979('0x46')][_0x8979('0x4f')],_0x4662c3['body']['type']);_0x4662c3['body'][_0x8979('0x50')]=integrations[_0x8979('0x51')](_0x4662c3['body'][_0x8979('0x4f')],_0x4662c3[_0x8979('0x46')][_0x8979('0x2d')]);return db['ZohoConfiguration'][_0x8979('0x45')](_0x4662c3[_0x8979('0x46')],{'include':[{'model':db[_0x8979('0x52')],'as':_0x8979('0x4e')},{'model':db['ZohoField'],'as':_0x8979('0x50')}]});}return null;})[_0x8979('0x24')](respondWithResult(_0x5c695a,null))[_0x8979('0x47')](handleError(_0x5c695a,null));};function getAccessToken(_0x423df3){return new Promise(function(_0x5dfba2,_0xeda620){var _0x2f8969;switch(_0x423df3['zone']){case'US':_0x2f8969='https://accounts.zoho.com';break;case'AU':_0x2f8969=_0x8979('0x53');break;case'EU':_0x2f8969=_0x8979('0x54');break;case'IN':_0x2f8969=_0x8979('0x55');break;case'CN':_0x2f8969=_0x8979('0x56');break;default:_0x2f8969=_0x8979('0x54');break;}var _0x591d6c={'method':_0x8979('0x57'),'uri':_0x2f8969+_0x8979('0x58'),'qs':{'refresh_token':_0x423df3[_0x8979('0x59')],'client_id':_0x423df3[_0x8979('0x5a')],'client_secret':_0x423df3[_0x8979('0x5b')],'grant_type':_0x8979('0x5c')},'json':!![]};return rp(_0x591d6c)['then'](function(_0x5660e7){if(_0x5660e7[_0x8979('0x5d')]){_0x5dfba2(_0x5660e7['access_token']);}else{_0xeda620('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x8979('0x47')](function(_0x40e189){_0xeda620(_0x40e189);});});}exports[_0x8979('0x5e')]=function(_0x397c69,_0x4465b1,_0x59407d){var _0x58c580,_0x3f229f,_0x41c07a,_0x221d06,_0x4b4ecb;return db[_0x8979('0x2c')][_0x8979('0x4a')]({'where':{'id':_0x397c69[_0x8979('0x41')]['id']},'attributes':['id',_0x8979('0x5f'),_0x8979('0x60'),'clientId',_0x8979('0x5b'),_0x8979('0x61'),_0x8979('0x62'),_0x8979('0x59')]})[_0x8979('0x24')](handleEntityNotFound(_0x4465b1,null))[_0x8979('0x24')](function(_0x4f449e){_0x4b4ecb=_0x4f449e;_0x58c580=_0x4b4ecb['host'];_0x3f229f=_0x58c580===_0x8979('0x63')?'eu':_0x8979('0x64');_0x41c07a=_0x4b4ecb['serverUrl'];var _0x3b0154=_0x41c07a[_0x8979('0x65')](-0x1);if(_0x3b0154==='/'||_0x3b0154==='\x5c'||_0x3b0154===':'){_0x41c07a=_0x41c07a[_0x8979('0x66')](0x0,_0x41c07a[_0x8979('0x67')](_0x3b0154));}if(!_0x4b4ecb[_0x8979('0x59')]){throw new Error(_0x8979('0x68'));}return getAccessToken(_0x4b4ecb);})['then'](function(_0x41a9ad){if(_0x41a9ad){return rp({'method':_0x8979('0x69'),'uri':util['format'](_0x8979('0x6a'),_0x3f229f),'qs':{'module':_0x8979('0x6b')},'headers':{'Authorization':_0x8979('0x6c')+_0x41a9ad},'json':!![]});}})[_0x8979('0x24')](function(_0x30fa2a){if(_0x30fa2a){if(_0x30fa2a[_0x8979('0x6d')]&&_0x30fa2a[_0x8979('0x6d')][_0x8979('0x26')]){throw new Error(_0x30fa2a[_0x8979('0x6d')][_0x8979('0x26')][_0x8979('0x6e')]);}var _0xa8c311=[];var _0x331800=[];var _0x5499ca=[_0x8979('0x6f'),_0x8979('0x70'),_0x8979('0x71'),_0x8979('0x72'),_0x8979('0x73'),_0x8979('0x74'),_0x8979('0x75'),'Call_Type'];_0x331800=_[_0x8979('0x76')](_0x30fa2a['fields'],function(_0x4b2129){return _0x5499ca['includes'](_0x4b2129[_0x8979('0x77')]);});for(var _0x419292=0x0;_0x419292<_0x331800['length'];_0x419292++){if(_0x331800[_0x419292][_0x8979('0x78')]===![]){_0xa8c311['push']({'id':_0x331800[_0x419292]['id'],'name':_0x331800[_0x419292]['display_label'],'custom':_0x331800[_0x419292]['custom_field'],'options':_0x331800[_0x419292][_0x8979('0x79')]===_0x8979('0x7a')&&_0x331800[_0x419292]['pick_list_values']['length']>-0x1?_[_0x8979('0x2b')](_0x331800[_0x419292][_0x8979('0x7b')],function(_0x4d7d67){return{'name':_0x4d7d67,'value':_0x4d7d67};}):[]});}}return{'count':_0xa8c311[_0x8979('0x34')],'rows':_0xa8c311};}else{return{'count':0x0,'rows':[]};}})[_0x8979('0x24')](respondWithResult(_0x4465b1,null))['catch'](function(_0x32f70a){var _0x3aba7e=_0x397c69[_0x8979('0x2f')][_0x8979('0x7c')]?0x1f4:_0x32f70a[_0x8979('0x7d')]||0x1f4;logger['error'](_0x8979('0x7e'),'getFields',_0x3aba7e,JSON[_0x8979('0x7f')](_0x32f70a));delete _0x32f70a[_0x8979('0x28')];if(_0x3aba7e===0x191){_0x3aba7e=0x190;}_0x4465b1[_0x8979('0x19')](_0x3aba7e)[_0x8979('0x29')](_0x397c69['query'][_0x8979('0x7c')]?{'message':_0x8979('0x80'),'statusCode':_0x32f70a[_0x8979('0x7d')]}:_0x32f70a);});}; \ No newline at end of file +var _0x86bb=['ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','create','body','find','params','getConfigurations','findOne','ZohoConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','host','clientId','serverUrl','code','com','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','data_type','pick_list_values','test','statusCode','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv'];(function(_0x5c2e76,_0x2d5bb0){var _0x2adbe2=function(_0x61496c){while(--_0x61496c){_0x5c2e76['push'](_0x5c2e76['shift']());}};_0x2adbe2(++_0x2d5bb0);}(_0x86bb,0xfb));var _0xb86b=function(_0x5562fe,_0x4e809c){_0x5562fe=_0x5562fe-0x0;var _0x1829c7=_0x86bb[_0x5562fe];return _0x1829c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb86b('0x0'));var zipdir=require(_0xb86b('0x1'));var jsonpatch=require(_0xb86b('0x2'));var rp=require('request-promise');var moment=require(_0xb86b('0x3'));var BPromise=require(_0xb86b('0x4'));var Mustache=require(_0xb86b('0x5'));var util=require(_0xb86b('0x6'));var path=require(_0xb86b('0x7'));var sox=require('sox');var csv=require(_0xb86b('0x8'));var ejs=require(_0xb86b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb86b('0xa'));var squel=require(_0xb86b('0xb'));var crypto=require('crypto');var jsforce=require(_0xb86b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb86b('0xd'));var Papa=require('papaparse');var Redis=require(_0xb86b('0xe'));var authService=require(_0xb86b('0xf'));var qs=require(_0xb86b('0x10'));var as=require(_0xb86b('0x11'));var hardwareService=require(_0xb86b('0x12'));var logger=require(_0xb86b('0x13'))(_0xb86b('0x14'));var utils=require('../../config/utils');var config=require(_0xb86b('0x15'));var licenseUtil=require(_0xb86b('0x16'));var db=require(_0xb86b('0x17'))['db'];var integrations=require(_0xb86b('0x18'));function respondWithStatusCode(_0x295167,_0x59e5a0){_0x59e5a0=_0x59e5a0||0xcc;return function(_0xe0863c){if(_0xe0863c){return _0x295167[_0xb86b('0x19')](_0x59e5a0);}return _0x295167[_0xb86b('0x1a')](_0x59e5a0)[_0xb86b('0x1b')]();};}function respondWithResult(_0x45dadb,_0x1a7282){_0x1a7282=_0x1a7282||0xc8;return function(_0x21d13c){if(_0x21d13c){return _0x45dadb['status'](_0x1a7282)['json'](_0x21d13c);}};}function respondWithFilteredResult(_0x346fa0,_0x1b8ef0){return function(_0x24c952){if(_0x24c952){var _0x4fa4a4=typeof _0x1b8ef0[_0xb86b('0x1c')]==='undefined'&&typeof _0x1b8ef0[_0xb86b('0x1d')]===_0xb86b('0x1e');var _0x3c95ad=_0x24c952[_0xb86b('0x1f')];var _0x33163d=_0x4fa4a4?0x0:_0x1b8ef0[_0xb86b('0x1c')];var _0x3d158a=_0x4fa4a4?_0x24c952[_0xb86b('0x1f')]:_0x1b8ef0[_0xb86b('0x1c')]+_0x1b8ef0[_0xb86b('0x1d')];var _0xaa2b05;if(_0x3d158a>=_0x3c95ad){_0x3d158a=_0x3c95ad;_0xaa2b05=0xc8;}else{_0xaa2b05=0xce;}_0x346fa0[_0xb86b('0x1a')](_0xaa2b05);return _0x346fa0[_0xb86b('0x20')](_0xb86b('0x21'),_0x33163d+'-'+_0x3d158a+'/'+_0x3c95ad)[_0xb86b('0x22')](_0x24c952);}return null;};}function patchUpdates(_0xadf479){return function(_0x299996){try{jsonpatch[_0xb86b('0x23')](_0x299996,_0xadf479,!![]);}catch(_0x230d2b){return BPromise[_0xb86b('0x24')](_0x230d2b);}return _0x299996[_0xb86b('0x25')]();};}function saveUpdates(_0x128414,_0x10cb37){return function(_0x2e256d){if(_0x2e256d){return _0x2e256d[_0xb86b('0x26')](_0x128414)['then'](function(_0x642720){return _0x642720;});}return null;};}function removeEntity(_0xd0154b,_0x4e66d4){return function(_0xdeb0dc){if(_0xdeb0dc){return _0xdeb0dc[_0xb86b('0x27')]()[_0xb86b('0x28')](function(){_0xd0154b[_0xb86b('0x1a')](0xcc)[_0xb86b('0x1b')]();});}};}function handleEntityNotFound(_0x271a85,_0xe3a0c9){return function(_0x5b35b7){if(!_0x5b35b7){_0x271a85[_0xb86b('0x19')](0x194);}return _0x5b35b7;};}function handleError(_0x56f1cb,_0x4964e8){_0x4964e8=_0x4964e8||0x1f4;return function(_0x35aee7){logger[_0xb86b('0x29')](_0x35aee7[_0xb86b('0x2a')]);if(_0x35aee7[_0xb86b('0x2b')]){delete _0x35aee7[_0xb86b('0x2b')];}_0x56f1cb[_0xb86b('0x1a')](_0x4964e8)[_0xb86b('0x2c')](_0x35aee7);};}exports[_0xb86b('0x2d')]=function(_0x30e685,_0x14b335){var _0x3e9f1e={},_0x5224fc={},_0x32d7ca={'count':0x0,'rows':[]};var _0x2b9573=_[_0xb86b('0x2e')](db[_0xb86b('0x2f')][_0xb86b('0x30')],function(_0x44167d){return{'name':_0x44167d[_0xb86b('0x31')],'type':_0x44167d[_0xb86b('0x32')]['key']};});_0x5224fc['model']=_[_0xb86b('0x2e')](_0x2b9573,'name');_0x5224fc[_0xb86b('0x33')]=_[_0xb86b('0x34')](_0x30e685[_0xb86b('0x33')]);_0x5224fc[_0xb86b('0x35')]=_[_0xb86b('0x36')](_0x5224fc['model'],_0x5224fc[_0xb86b('0x33')]);_0x3e9f1e[_0xb86b('0x37')]=_[_0xb86b('0x36')](_0x5224fc[_0xb86b('0x38')],qs[_0xb86b('0x39')](_0x30e685[_0xb86b('0x33')][_0xb86b('0x39')]));_0x3e9f1e[_0xb86b('0x37')]=_0x3e9f1e[_0xb86b('0x37')]['length']?_0x3e9f1e[_0xb86b('0x37')]:_0x5224fc[_0xb86b('0x38')];if(!_0x30e685[_0xb86b('0x33')][_0xb86b('0x3a')](_0xb86b('0x3b'))){_0x3e9f1e[_0xb86b('0x1d')]=qs['limit'](_0x30e685['query']['limit']);_0x3e9f1e[_0xb86b('0x1c')]=qs[_0xb86b('0x1c')](_0x30e685[_0xb86b('0x33')]['offset']);}_0x3e9f1e['order']=qs['sort'](_0x30e685['query'][_0xb86b('0x3c')]);_0x3e9f1e[_0xb86b('0x3d')]=qs[_0xb86b('0x35')](_[_0xb86b('0x3e')](_0x30e685[_0xb86b('0x33')],_0x5224fc[_0xb86b('0x35')]),_0x2b9573);if(_0x30e685['query'][_0xb86b('0x3f')]){_0x3e9f1e['where']=_[_0xb86b('0x40')](_0x3e9f1e[_0xb86b('0x3d')],{'$or':_[_0xb86b('0x2e')](_0x2b9573,function(_0x3a875b){if(_0x3a875b[_0xb86b('0x32')]!==_0xb86b('0x41')){var _0x2c733d={};_0x2c733d[_0x3a875b['name']]={'$like':'%'+_0x30e685[_0xb86b('0x33')][_0xb86b('0x3f')]+'%'};return _0x2c733d;}})});}_0x3e9f1e=_[_0xb86b('0x40')]({},_0x3e9f1e,_0x30e685[_0xb86b('0x42')]);var _0xbec67e={'where':_0x3e9f1e[_0xb86b('0x3d')]};return db['ZohoAccount'][_0xb86b('0x1f')](_0xbec67e)[_0xb86b('0x28')](function(_0x34de9b){_0x32d7ca[_0xb86b('0x1f')]=_0x34de9b;if(_0x30e685[_0xb86b('0x33')][_0xb86b('0x43')]){_0x3e9f1e[_0xb86b('0x44')]=[{'all':!![]}];}return db[_0xb86b('0x2f')][_0xb86b('0x45')](_0x3e9f1e);})[_0xb86b('0x28')](function(_0x5c8318){_0x32d7ca[_0xb86b('0x46')]=_0x5c8318;return _0x32d7ca;})[_0xb86b('0x28')](respondWithFilteredResult(_0x14b335,_0x3e9f1e))[_0xb86b('0x47')](handleError(_0x14b335,null));};exports[_0xb86b('0x48')]=function(_0x10f216,_0x18b9fe){var _0x2a11ac={'raw':![],'where':{'id':_0x10f216['params']['id']}},_0x11dfc3={};_0x11dfc3['model']=_[_0xb86b('0x34')](db[_0xb86b('0x2f')][_0xb86b('0x30')]);_0x11dfc3['query']=_[_0xb86b('0x34')](_0x10f216['query']);_0x11dfc3['filters']=_[_0xb86b('0x36')](_0x11dfc3[_0xb86b('0x38')],_0x11dfc3[_0xb86b('0x33')]);_0x2a11ac[_0xb86b('0x37')]=_['intersection'](_0x11dfc3[_0xb86b('0x38')],qs[_0xb86b('0x39')](_0x10f216[_0xb86b('0x33')][_0xb86b('0x39')]));_0x2a11ac[_0xb86b('0x37')]=_0x2a11ac[_0xb86b('0x37')][_0xb86b('0x49')]?_0x2a11ac[_0xb86b('0x37')]:_0x11dfc3['model'];if(_0x10f216['query'][_0xb86b('0x43')]){_0x2a11ac[_0xb86b('0x44')]=[{'all':!![]}];}_0x2a11ac=_[_0xb86b('0x40')]({},_0x2a11ac,_0x10f216[_0xb86b('0x42')]);return db['ZohoAccount']['find'](_0x2a11ac)[_0xb86b('0x28')](handleEntityNotFound(_0x18b9fe,null))['then'](respondWithResult(_0x18b9fe,null))[_0xb86b('0x47')](handleError(_0x18b9fe,null));};exports[_0xb86b('0x4a')]=function(_0x5a58f1,_0xbdd58a){return db[_0xb86b('0x2f')][_0xb86b('0x4a')](_0x5a58f1[_0xb86b('0x4b')],{})['then'](respondWithResult(_0xbdd58a,0xc9))[_0xb86b('0x47')](handleError(_0xbdd58a,null));};exports['update']=function(_0x126175,_0x10fd76){if(_0x126175[_0xb86b('0x4b')]['id']){delete _0x126175[_0xb86b('0x4b')]['id'];}return db['ZohoAccount'][_0xb86b('0x4c')]({'where':{'id':_0x126175['params']['id']}})[_0xb86b('0x28')](handleEntityNotFound(_0x10fd76,null))[_0xb86b('0x28')](saveUpdates(_0x126175[_0xb86b('0x4b')],null))[_0xb86b('0x28')](respondWithResult(_0x10fd76,null))[_0xb86b('0x47')](handleError(_0x10fd76,null));};exports['destroy']=function(_0x47afd6,_0x51b05c){return db[_0xb86b('0x2f')][_0xb86b('0x4c')]({'where':{'id':_0x47afd6[_0xb86b('0x4d')]['id']}})[_0xb86b('0x28')](handleEntityNotFound(_0x51b05c,null))['then'](removeEntity(_0x51b05c,null))[_0xb86b('0x47')](handleError(_0x51b05c,null));};exports[_0xb86b('0x4e')]=function(_0x499e04,_0x3bfa3b,_0x3cb117){var _0x423e2={};var _0x5eabfa={};var _0x504d88;var _0x5c1c1d;return db[_0xb86b('0x2f')][_0xb86b('0x4f')]({'where':{'id':_0x499e04[_0xb86b('0x4d')]['id']}})[_0xb86b('0x28')](handleEntityNotFound(_0x3bfa3b,null))['then'](function(_0x10b8b4){if(_0x10b8b4){_0x504d88=_0x10b8b4;_0x5eabfa[_0xb86b('0x38')]=_['keys'](db[_0xb86b('0x50')][_0xb86b('0x30')]);_0x5eabfa[_0xb86b('0x33')]=_['keys'](_0x499e04[_0xb86b('0x33')]);_0x5eabfa[_0xb86b('0x35')]=_[_0xb86b('0x36')](_0x5eabfa['model'],_0x5eabfa['query']);_0x423e2['attributes']=_[_0xb86b('0x36')](_0x5eabfa['model'],qs['fields'](_0x499e04['query'][_0xb86b('0x39')]));_0x423e2[_0xb86b('0x37')]=_0x423e2[_0xb86b('0x37')][_0xb86b('0x49')]?_0x423e2[_0xb86b('0x37')]:_0x5eabfa[_0xb86b('0x38')];_0x423e2[_0xb86b('0x51')]=qs[_0xb86b('0x3c')](_0x499e04['query']['sort']);_0x423e2[_0xb86b('0x3d')]=qs[_0xb86b('0x35')](_[_0xb86b('0x3e')](_0x499e04[_0xb86b('0x33')],_0x5eabfa[_0xb86b('0x35')]));if(_0x499e04[_0xb86b('0x33')]['filter']){_0x423e2[_0xb86b('0x3d')]=_[_0xb86b('0x40')](_0x423e2['where'],{'$or':_['map'](_0x423e2[_0xb86b('0x37')],function(_0x4c918b){var _0x20ab10={};_0x20ab10[_0x4c918b]={'$like':'%'+_0x499e04[_0xb86b('0x33')][_0xb86b('0x3f')]+'%'};return _0x20ab10;})});}_0x423e2=_[_0xb86b('0x40')]({},_0x423e2,_0x499e04['options']);return _0x504d88[_0xb86b('0x4e')](_0x423e2);}})['then'](function(_0x10b6f3){if(_0x10b6f3){_0x5c1c1d=_0x10b6f3[_0xb86b('0x49')];if(!_0x499e04[_0xb86b('0x33')][_0xb86b('0x3a')](_0xb86b('0x3b'))){_0x423e2['limit']=qs['limit'](_0x499e04[_0xb86b('0x33')][_0xb86b('0x1d')]);_0x423e2[_0xb86b('0x1c')]=qs[_0xb86b('0x1c')](_0x499e04['query']['offset']);}return _0x504d88[_0xb86b('0x4e')](_0x423e2);}})[_0xb86b('0x28')](function(_0x52ce9b){if(_0x52ce9b){return _0x52ce9b?{'count':_0x5c1c1d,'rows':_0x52ce9b}:null;}})[_0xb86b('0x28')](respondWithResult(_0x3bfa3b,null))[_0xb86b('0x47')](handleError(_0x3bfa3b,null));};exports[_0xb86b('0x52')]=function(_0x1b3139,_0x3de0ff,_0x335c9a){if(_0x1b3139['body']['id']){delete _0x1b3139[_0xb86b('0x4b')]['id'];}return db[_0xb86b('0x2f')][_0xb86b('0x4f')]({'where':{'id':_0x1b3139[_0xb86b('0x4d')]['id']}})[_0xb86b('0x28')](handleEntityNotFound(_0x3de0ff,null))[_0xb86b('0x28')](function(_0x3bbddf){if(_0x3bbddf){_0x1b3139[_0xb86b('0x4b')][_0xb86b('0x53')]=_0x3bbddf['id'];_0x1b3139[_0xb86b('0x4b')][_0xb86b('0x54')]=integrations[_0xb86b('0x55')](_0x1b3139['body'][_0xb86b('0x56')],_0x1b3139['body'][_0xb86b('0x32')]);_0x1b3139[_0xb86b('0x4b')][_0xb86b('0x57')]=integrations[_0xb86b('0x58')](_0x1b3139[_0xb86b('0x4b')][_0xb86b('0x56')],_0x1b3139[_0xb86b('0x4b')][_0xb86b('0x32')]);return db[_0xb86b('0x50')]['create'](_0x1b3139['body'],{'include':[{'model':db[_0xb86b('0x59')],'as':'Subjects'},{'model':db[_0xb86b('0x59')],'as':_0xb86b('0x57')}]});}return null;})[_0xb86b('0x28')](respondWithResult(_0x3de0ff,null))[_0xb86b('0x47')](handleError(_0x3de0ff,null));};function getAccessToken(_0x5d5feb){return new Promise(function(_0x3e9a94,_0x2bf035){var _0x16a51a;switch(_0x5d5feb[_0xb86b('0x5a')]){case'US':_0x16a51a=_0xb86b('0x5b');break;case'AU':_0x16a51a='https://accounts.zoho.com.au';break;case'EU':_0x16a51a=_0xb86b('0x5c');break;case'IN':_0x16a51a=_0xb86b('0x5d');break;case'CN':_0x16a51a='https://accounts.zoho.com.cn';break;default:_0x16a51a='https://accounts.zoho.eu';break;}var _0x339a4a={'method':'POST','uri':_0x16a51a+_0xb86b('0x5e'),'qs':{'refresh_token':_0x5d5feb[_0xb86b('0x5f')],'client_id':_0x5d5feb['clientId'],'client_secret':_0x5d5feb[_0xb86b('0x60')],'grant_type':_0xb86b('0x61')},'json':!![]};return rp(_0x339a4a)[_0xb86b('0x28')](function(_0x581a15){if(_0x581a15[_0xb86b('0x62')]){_0x3e9a94(_0x581a15['access_token']);}else{_0x2bf035('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x1afc1c){_0x2bf035(_0x1afc1c);});});}exports['getFields']=function(_0x9eccb9,_0x1823b3,_0x34c082){var _0x1d4922,_0x277c11,_0x38d12c,_0x25cb5e,_0x13b4c6;return db['ZohoAccount'][_0xb86b('0x4f')]({'where':{'id':_0x9eccb9[_0xb86b('0x4d')]['id']},'attributes':['id',_0xb86b('0x63'),_0xb86b('0x5a'),_0xb86b('0x64'),'clientSecret',_0xb86b('0x65'),_0xb86b('0x66'),_0xb86b('0x5f')]})['then'](handleEntityNotFound(_0x1823b3,null))[_0xb86b('0x28')](function(_0xd3aeda){_0x13b4c6=_0xd3aeda;_0x1d4922=_0x13b4c6[_0xb86b('0x63')];_0x277c11=_0x1d4922==='zoho.eu'?'eu':_0xb86b('0x67');_0x38d12c=_0x13b4c6[_0xb86b('0x65')];var _0x4f98a8=_0x38d12c['slice'](-0x1);if(_0x4f98a8==='/'||_0x4f98a8==='\x5c'||_0x4f98a8===':'){_0x38d12c=_0x38d12c[_0xb86b('0x68')](0x0,_0x38d12c[_0xb86b('0x69')](_0x4f98a8));}if(!_0x13b4c6[_0xb86b('0x5f')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x13b4c6);})[_0xb86b('0x28')](function(_0x97d16f){if(_0x97d16f){return rp({'method':_0xb86b('0x6a'),'uri':util[_0xb86b('0x6b')](_0xb86b('0x6c'),_0x277c11),'qs':{'module':_0xb86b('0x6d')},'headers':{'Authorization':_0xb86b('0x6e')+_0x97d16f},'json':!![]});}})[_0xb86b('0x28')](function(_0x4a568a){if(_0x4a568a){if(_0x4a568a[_0xb86b('0x6f')]&&_0x4a568a[_0xb86b('0x6f')][_0xb86b('0x29')]){throw new Error(_0x4a568a[_0xb86b('0x6f')]['error'][_0xb86b('0x70')]);}var _0x3849bd=[];var _0x19631a=[];var _0xe9b0bd=[_0xb86b('0x71'),_0xb86b('0x72'),_0xb86b('0x73'),_0xb86b('0x74'),'Call_Duration','Call_Result',_0xb86b('0x75'),_0xb86b('0x76')];_0x19631a=_[_0xb86b('0x77')](_0x4a568a[_0xb86b('0x39')],function(_0x23008e){return _0xe9b0bd[_0xb86b('0x78')](_0x23008e['api_name']);});for(var _0x168ef9=0x0;_0x168ef9<_0x19631a[_0xb86b('0x49')];_0x168ef9++){if(_0x19631a[_0x168ef9][_0xb86b('0x79')]===![]){_0x3849bd[_0xb86b('0x7a')]({'id':_0x19631a[_0x168ef9]['id'],'name':_0x19631a[_0x168ef9]['display_label'],'custom':_0x19631a[_0x168ef9]['custom_field'],'options':_0x19631a[_0x168ef9][_0xb86b('0x7b')]==='picklist'&&_0x19631a[_0x168ef9][_0xb86b('0x7c')][_0xb86b('0x49')]>-0x1?_[_0xb86b('0x2e')](_0x19631a[_0x168ef9][_0xb86b('0x7c')],function(_0x2173b3){return{'name':_0x2173b3,'value':_0x2173b3};}):[]});}}return{'count':_0x3849bd[_0xb86b('0x49')],'rows':_0x3849bd};}else{return{'count':0x0,'rows':[]};}})[_0xb86b('0x28')](respondWithResult(_0x1823b3,null))[_0xb86b('0x47')](function(_0x27b0e4){var _0x3c2f6b=_0x9eccb9[_0xb86b('0x33')][_0xb86b('0x7d')]?0x1f4:_0x27b0e4[_0xb86b('0x7e')]||0x1f4;logger[_0xb86b('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0xb86b('0x7f'),_0x3c2f6b,JSON[_0xb86b('0x80')](_0x27b0e4));delete _0x27b0e4[_0xb86b('0x2b')];if(_0x3c2f6b===0x191){_0x3c2f6b=0x190;}_0x1823b3['status'](_0x3c2f6b)[_0xb86b('0x2c')](_0x9eccb9[_0xb86b('0x33')][_0xb86b('0x7d')]?{'message':_0xb86b('0x81'),'statusCode':_0x27b0e4['statusCode']}:_0x27b0e4);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 94e3452..24c4634 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 _0x05aa=['authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','name','error','inspect','catch','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','slice','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token'];(function(_0x1c8a81,_0xb70ce7){var _0x183fa5=function(_0x58044f){while(--_0x58044f){_0x1c8a81['push'](_0x1c8a81['shift']());}};_0x183fa5(++_0xb70ce7);}(_0x05aa,0x18b));var _0xa05a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x05aa[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa05a('0x0'));var BPromise=require(_0xa05a('0x1'));var rp=require(_0xa05a('0x2'));var fs=require('fs');var path=require(_0xa05a('0x3'));var rimraf=require('rimraf');var config=require(_0xa05a('0x4'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xa05a('0x5'));module['exports']=function(_0x2cbf70,_0x26ee9a){return _0x2cbf70[_0xa05a('0x6')](_0xa05a('0x7'),attributes,{'tableName':_0xa05a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x241991,_0x4b4be4,_0x96b7e4){if(_0x241991[_0xa05a('0x9')](_0xa05a('0xa'))||_0x241991[_0xa05a('0x9')](_0xa05a('0xb'))||_0x241991['changed'](_0xa05a('0xc'))||_0x241991[_0xa05a('0x9')]('clientSecret')||_0x241991[_0xa05a('0x9')](_0xa05a('0xd'))||_0x241991['changed'](_0xa05a('0xe'))){var _0x2aa5db,_0x59e726;_0x2aa5db=_0x241991[_0xa05a('0xb')];var _0x4d2e26=_0x2aa5db['slice'](-0x1);if(_0x4d2e26==='/'||_0x4d2e26==='\x5c'||_0x4d2e26===':'){_0x2aa5db=_0x2aa5db[_0xa05a('0xf')](0x0,_0x2aa5db[_0xa05a('0x10')](_0x4d2e26));}switch(_0x241991[_0xa05a('0xa')]){case'US':_0x59e726=_0xa05a('0x11');break;case'AU':_0x59e726=_0xa05a('0x12');break;case'IN':_0x59e726=_0xa05a('0x13');break;case'CN':_0x59e726=_0xa05a('0x14');break;default:_0x59e726=_0xa05a('0x15');break;}var _0x40d2a2={'method':'POST','uri':_0x59e726+_0xa05a('0x16'),'form':{'grant_type':_0xa05a('0x17'),'client_id':_0x241991[_0xa05a('0xc')],'client_secret':_0x241991[_0xa05a('0x18')],'redirect_uri':_0x241991[_0xa05a('0xb')],'code':_0x241991['code']},'headers':{'Content-Type':_0xa05a('0x19')}};return rp(_0x40d2a2)[_0xa05a('0x1a')](function(_0x388a13){var _0x3f8640=JSON[_0xa05a('0x1b')](_0x388a13);if(_0x3f8640[_0xa05a('0x1c')]){_0x241991[_0xa05a('0x1d')]=_0x3f8640[_0xa05a('0x1c')];logger[_0xa05a('0x1e')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x241991[_0xa05a('0x1f')],_0x241991['id']));}else{logger[_0xa05a('0x20')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x241991[_0xa05a('0x1f')],_0x241991['id']),util[_0xa05a('0x21')](_0x3f8640,{'showHidden':![],'depth':null}));}return _0x96b7e4(null,_0x4b4be4);})[_0xa05a('0x22')](function(_0x240d05){logger['error'](util[_0xa05a('0x23')](_0xa05a('0x24'),_0x241991[_0xa05a('0x1f')],_0x241991['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x96b7e4(_0x240d05);});}else{return _0x96b7e4(null,_0x4b4be4);}},'beforeUpdate':function(_0x56fb1d,_0x181da7,_0x10eb9f){if(_0x56fb1d['changed'](_0xa05a('0xa'))||_0x56fb1d['changed']('serverUrl')||_0x56fb1d[_0xa05a('0x9')](_0xa05a('0xc'))||_0x56fb1d[_0xa05a('0x9')](_0xa05a('0x18'))||_0x56fb1d[_0xa05a('0x9')]('code')||_0x56fb1d[_0xa05a('0x9')]('host')){var _0x470c5b,_0x897ff;_0x470c5b=_0x56fb1d[_0xa05a('0xb')];var _0x202a6e=_0x470c5b[_0xa05a('0x25')](-0x1);if(_0x202a6e==='/'||_0x202a6e==='\x5c'||_0x202a6e===':'){_0x470c5b=_0x470c5b[_0xa05a('0xf')](0x0,_0x470c5b[_0xa05a('0x10')](_0x202a6e));}switch(_0x56fb1d[_0xa05a('0xa')]){case'US':_0x897ff=_0xa05a('0x11');break;case'AU':_0x897ff=_0xa05a('0x12');break;case'IN':_0x897ff=_0xa05a('0x13');break;case'CN':_0x897ff=_0xa05a('0x14');break;default:_0x897ff=_0xa05a('0x15');break;}var _0x4310b5={'method':'POST','uri':_0x897ff+_0xa05a('0x16'),'form':{'grant_type':_0xa05a('0x17'),'client_id':_0x56fb1d[_0xa05a('0xc')],'client_secret':_0x56fb1d[_0xa05a('0x18')],'redirect_uri':_0x56fb1d[_0xa05a('0xb')],'code':_0x56fb1d[_0xa05a('0xd')]},'headers':{'Content-Type':_0xa05a('0x19')}};return rp(_0x4310b5)[_0xa05a('0x1a')](function(_0x3a82b7){var _0x4f932c=JSON['parse'](_0x3a82b7);if(_0x4f932c[_0xa05a('0x1c')]){_0x56fb1d[_0xa05a('0x1d')]=_0x4f932c['refresh_token'];logger[_0xa05a('0x1e')](util[_0xa05a('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x56fb1d[_0xa05a('0x1f')],_0x56fb1d['id']));}else{logger[_0xa05a('0x20')](util[_0xa05a('0x23')](_0xa05a('0x24'),_0x56fb1d[_0xa05a('0x1f')],_0x56fb1d['id']),util[_0xa05a('0x21')](_0x4f932c,{'showHidden':![],'depth':null}));}return _0x10eb9f(null,_0x181da7);})['catch'](function(_0x3644a3){logger['error'](util[_0xa05a('0x23')](_0xa05a('0x24'),_0x56fb1d[_0xa05a('0x1f')],_0x56fb1d['id']),util[_0xa05a('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x10eb9f(_0x3644a3);});}else{return _0x10eb9f(null,_0x181da7);}}}});}; \ No newline at end of file +var _0x6c1c=['code','host','substring','lastIndexOf','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','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','slice','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','moment','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret'];(function(_0x49399a,_0x131644){var _0x34a766=function(_0x5a61ba){while(--_0x5a61ba){_0x49399a['push'](_0x49399a['shift']());}};_0x34a766(++_0x131644);}(_0x6c1c,0x110));var _0xc6c1=function(_0x219fa0,_0x18b239){_0x219fa0=_0x219fa0-0x0;var _0xc603fb=_0x6c1c[_0x219fa0];return _0xc603fb;};'use strict';var _=require(_0xc6c1('0x0'));var util=require('util');var logger=require(_0xc6c1('0x1'))('api');var moment=require(_0xc6c1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc6c1('0x3'));var config=require('../../config/environment');var attributes=require(_0xc6c1('0x4'));var integrations=require(_0xc6c1('0x5'));module[_0xc6c1('0x6')]=function(_0x49a14f,_0x149656){return _0x49a14f[_0xc6c1('0x7')](_0xc6c1('0x8'),attributes,{'tableName':_0xc6c1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5d192a,_0xadfc5b,_0x2382b9){if(_0x5d192a[_0xc6c1('0xa')](_0xc6c1('0xb'))||_0x5d192a['changed'](_0xc6c1('0xc'))||_0x5d192a[_0xc6c1('0xa')](_0xc6c1('0xd'))||_0x5d192a[_0xc6c1('0xa')](_0xc6c1('0xe'))||_0x5d192a[_0xc6c1('0xa')](_0xc6c1('0xf'))||_0x5d192a[_0xc6c1('0xa')](_0xc6c1('0x10'))){var _0x172990,_0x3465f4;_0x172990=_0x5d192a[_0xc6c1('0xc')];var _0x376948=_0x172990['slice'](-0x1);if(_0x376948==='/'||_0x376948==='\x5c'||_0x376948===':'){_0x172990=_0x172990[_0xc6c1('0x11')](0x0,_0x172990[_0xc6c1('0x12')](_0x376948));}switch(_0x5d192a['zone']){case'US':_0x3465f4=_0xc6c1('0x13');break;case'AU':_0x3465f4=_0xc6c1('0x14');break;case'IN':_0x3465f4=_0xc6c1('0x15');break;case'CN':_0x3465f4=_0xc6c1('0x16');break;default:_0x3465f4=_0xc6c1('0x17');break;}var _0x3ec973={'method':_0xc6c1('0x18'),'uri':_0x3465f4+_0xc6c1('0x19'),'form':{'grant_type':_0xc6c1('0x1a'),'client_id':_0x5d192a[_0xc6c1('0xd')],'client_secret':_0x5d192a[_0xc6c1('0xe')],'redirect_uri':_0x5d192a[_0xc6c1('0xc')],'code':_0x5d192a[_0xc6c1('0xf')]},'headers':{'Content-Type':_0xc6c1('0x1b')}};return rp(_0x3ec973)[_0xc6c1('0x1c')](function(_0x224ff3){var _0x3042d1=JSON[_0xc6c1('0x1d')](_0x224ff3);if(_0x3042d1[_0xc6c1('0x1e')]){_0x5d192a[_0xc6c1('0x1f')]=_0x3042d1[_0xc6c1('0x1e')];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5d192a['name'],_0x5d192a['id']));}else{logger[_0xc6c1('0x20')](util[_0xc6c1('0x21')](_0xc6c1('0x22'),_0x5d192a[_0xc6c1('0x23')],_0x5d192a['id']),util[_0xc6c1('0x24')](_0x3042d1,{'showHidden':![],'depth':null}));}return _0x2382b9(null,_0xadfc5b);})[_0xc6c1('0x25')](function(_0x1c6784){logger[_0xc6c1('0x20')](util[_0xc6c1('0x21')](_0xc6c1('0x22'),_0x5d192a[_0xc6c1('0x23')],_0x5d192a['id']),util[_0xc6c1('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x2382b9(_0x1c6784);});}else{return _0x2382b9(null,_0xadfc5b);}},'beforeUpdate':function(_0x258102,_0x4fb151,_0x3bf368){if(_0x258102['changed'](_0xc6c1('0xb'))||_0x258102[_0xc6c1('0xa')](_0xc6c1('0xc'))||_0x258102[_0xc6c1('0xa')]('clientId')||_0x258102[_0xc6c1('0xa')](_0xc6c1('0xe'))||_0x258102['changed']('code')||_0x258102['changed']('host')){var _0x4acad7,_0x3c4f49;_0x4acad7=_0x258102[_0xc6c1('0xc')];var _0x339e1f=_0x4acad7[_0xc6c1('0x26')](-0x1);if(_0x339e1f==='/'||_0x339e1f==='\x5c'||_0x339e1f===':'){_0x4acad7=_0x4acad7['substring'](0x0,_0x4acad7[_0xc6c1('0x12')](_0x339e1f));}switch(_0x258102['zone']){case'US':_0x3c4f49=_0xc6c1('0x13');break;case'AU':_0x3c4f49=_0xc6c1('0x14');break;case'IN':_0x3c4f49=_0xc6c1('0x15');break;case'CN':_0x3c4f49='https://accounts.zoho.com.cn';break;default:_0x3c4f49=_0xc6c1('0x17');break;}var _0x3aa5e3={'method':_0xc6c1('0x18'),'uri':_0x3c4f49+_0xc6c1('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x258102['clientId'],'client_secret':_0x258102['clientSecret'],'redirect_uri':_0x258102[_0xc6c1('0xc')],'code':_0x258102['code']},'headers':{'Content-Type':_0xc6c1('0x1b')}};return rp(_0x3aa5e3)[_0xc6c1('0x1c')](function(_0x2f3fc9){var _0x520ef0=JSON[_0xc6c1('0x1d')](_0x2f3fc9);if(_0x520ef0[_0xc6c1('0x1e')]){_0x258102['refreshToken']=_0x520ef0['refresh_token'];logger[_0xc6c1('0x27')](util[_0xc6c1('0x21')](_0xc6c1('0x28'),_0x258102[_0xc6c1('0x23')],_0x258102['id']));}else{logger[_0xc6c1('0x20')](util[_0xc6c1('0x21')](_0xc6c1('0x22'),_0x258102[_0xc6c1('0x23')],_0x258102['id']),util[_0xc6c1('0x24')](_0x520ef0,{'showHidden':![],'depth':null}));}return _0x3bf368(null,_0x4fb151);})[_0xc6c1('0x25')](function(_0x3f43f5){logger[_0xc6c1('0x20')](util[_0xc6c1('0x21')](_0xc6c1('0x22'),_0x258102['name'],_0x258102['id']),util[_0xc6c1('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x3bf368(_0x3f43f5);});}else{return _0x3bf368(null,_0x4fb151);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 1774941..b9ed3d3 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 _0xf0f4=['catch','GetZohoAccount','findAll','options','raw','attributes','include','map','model','ShowZohoAccount','ZohoAccount','find','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1b5fff,_0x21d5e5){var _0x1536a4=function(_0x1f5acb){while(--_0x1f5acb){_0x1b5fff['push'](_0x1b5fff['shift']());}};_0x1536a4(++_0x21d5e5);}(_0xf0f4,0x182));var _0x4f0f=function(_0x5e0ef5,_0x4cecfe){_0x5e0ef5=_0x5e0ef5-0x0;var _0x47ad63=_0xf0f4[_0x5e0ef5];return _0x47ad63;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f0f('0x1'));var fs=require('fs');var Redis=require(_0x4f0f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f0f('0x3'));var logger=require(_0x4f0f('0x4'))(_0x4f0f('0x5'));var config=require(_0x4f0f('0x6'));var jayson=require(_0x4f0f('0x7'));var client=jayson[_0x4f0f('0x8')][_0x4f0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47faf5,_0x39ad76,_0x1dd6bd){return new BPromise(function(_0x95b1cf,_0x5da92f){return client[_0x4f0f('0xa')](_0x47faf5,_0x1dd6bd)[_0x4f0f('0xb')](function(_0x19cecb){logger[_0x4f0f('0xc')](_0x4f0f('0xd'),_0x39ad76,_0x4f0f('0xe'));logger[_0x4f0f('0xf')](_0x4f0f('0x10'),_0x39ad76,'request\x20sent',JSON[_0x4f0f('0x11')](_0x19cecb));if(_0x19cecb[_0x4f0f('0x12')]){if(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x13')]===0x1f4){logger[_0x4f0f('0x12')](_0x4f0f('0xd'),_0x39ad76,_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);return _0x5da92f(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);}logger[_0x4f0f('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x39ad76,_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);return _0x95b1cf(_0x19cecb[_0x4f0f('0x12')][_0x4f0f('0x14')]);}else{logger['info'](_0x4f0f('0xd'),_0x39ad76,_0x4f0f('0xe'));_0x95b1cf(_0x19cecb[_0x4f0f('0x15')][_0x4f0f('0x14')]);}})[_0x4f0f('0x16')](function(_0x5f171b){logger[_0x4f0f('0x12')](_0x4f0f('0xd'),_0x39ad76,_0x5f171b);_0x5da92f(_0x5f171b);});});}exports[_0x4f0f('0x17')]=function(_0x566049){var _0x2ca0b3=this;return new Promise(function(_0x86186f,_0x15ba1f){return db['ZohoAccount'][_0x4f0f('0x18')]({'raw':_0x566049[_0x4f0f('0x19')]?_0x566049[_0x4f0f('0x19')][_0x4f0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x566049[_0x4f0f('0x19')]?_0x566049[_0x4f0f('0x19')]['where']||null:null,'attributes':_0x566049[_0x4f0f('0x19')]?_0x566049['options'][_0x4f0f('0x1b')]||null:null,'limit':_0x566049[_0x4f0f('0x19')]?_0x566049['options']['limit']||null:null,'include':_0x566049[_0x4f0f('0x19')]?_0x566049['options'][_0x4f0f('0x1c')]?_[_0x4f0f('0x1d')](_0x566049[_0x4f0f('0x19')][_0x4f0f('0x1c')],function(_0x454720){return{'model':db[_0x454720[_0x4f0f('0x1e')]],'as':_0x454720['as'],'attributes':_0x454720['attributes'],'include':_0x454720[_0x4f0f('0x1c')]?_[_0x4f0f('0x1d')](_0x454720[_0x4f0f('0x1c')],function(_0x3bc77d){return{'model':db[_0x3bc77d[_0x4f0f('0x1e')]],'as':_0x3bc77d['as'],'attributes':_0x3bc77d[_0x4f0f('0x1b')],'include':_0x3bc77d[_0x4f0f('0x1c')]?_[_0x4f0f('0x1d')](_0x3bc77d[_0x4f0f('0x1c')],function(_0xb20be9){return{'model':db[_0xb20be9[_0x4f0f('0x1e')]],'as':_0xb20be9['as'],'attributes':_0xb20be9[_0x4f0f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f0f('0xb')](function(_0x5c13d1){logger[_0x4f0f('0xc')](_0x4f0f('0x17'),_0x566049);logger[_0x4f0f('0xf')]('GetZohoAccount',_0x566049,JSON[_0x4f0f('0x11')](_0x5c13d1));_0x86186f(_0x5c13d1);})['catch'](function(_0x449788){logger[_0x4f0f('0x12')]('GetZohoAccount',_0x449788['message'],_0x566049);_0x15ba1f(_0x2ca0b3[_0x4f0f('0x12')](0x1f4,_0x449788['message']));});});};exports[_0x4f0f('0x1f')]=function(_0x9319c0){var _0x514a2c=this;return new Promise(function(_0x3d3762,_0xf7acac){return db[_0x4f0f('0x20')][_0x4f0f('0x21')]({'raw':_0x9319c0['options']?_0x9319c0[_0x4f0f('0x19')][_0x4f0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x9319c0[_0x4f0f('0x19')]?_0x9319c0[_0x4f0f('0x19')]['where']||null:null,'attributes':_0x9319c0[_0x4f0f('0x19')]?_0x9319c0[_0x4f0f('0x19')][_0x4f0f('0x1b')]||null:null,'include':_0x9319c0['options']?_0x9319c0[_0x4f0f('0x19')][_0x4f0f('0x1c')]?_['map'](_0x9319c0[_0x4f0f('0x19')][_0x4f0f('0x1c')],function(_0x507277){return{'model':db[_0x507277[_0x4f0f('0x1e')]],'as':_0x507277['as'],'attributes':_0x507277['attributes'],'include':_0x507277[_0x4f0f('0x1c')]?_[_0x4f0f('0x1d')](_0x507277[_0x4f0f('0x1c')],function(_0xa790fa){return{'model':db[_0xa790fa[_0x4f0f('0x1e')]],'as':_0xa790fa['as'],'attributes':_0xa790fa[_0x4f0f('0x1b')],'include':_0xa790fa[_0x4f0f('0x1c')]?_[_0x4f0f('0x1d')](_0xa790fa['include'],function(_0x156d22){return{'model':db[_0x156d22[_0x4f0f('0x1e')]],'as':_0x156d22['as'],'attributes':_0x156d22[_0x4f0f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f0f('0xb')](function(_0x122d51){logger[_0x4f0f('0xc')](_0x4f0f('0x1f'),_0x9319c0);logger['debug'](_0x4f0f('0x1f'),_0x9319c0,JSON[_0x4f0f('0x11')](_0x122d51));_0x3d3762(_0x122d51);})[_0x4f0f('0x16')](function(_0x563847){logger[_0x4f0f('0x12')]('ShowZohoAccount',_0x563847[_0x4f0f('0x14')],_0x9319c0);_0xf7acac(_0x514a2c['error'](0x1f4,_0x563847[_0x4f0f('0x14')]));});});}; \ No newline at end of file +var _0x59ac=['then','ZohoAccount','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','GetZohoAccount','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x1d7a65,_0x2baef4){var _0x365f65=function(_0x45189b){while(--_0x45189b){_0x1d7a65['push'](_0x1d7a65['shift']());}};_0x365f65(++_0x2baef4);}(_0x59ac,0x73));var _0xc59a=function(_0x157a54,_0x513884){_0x157a54=_0x157a54-0x0;var _0x2da92a=_0x59ac[_0x157a54];return _0x2da92a;};'use strict';var _=require(_0xc59a('0x0'));var util=require(_0xc59a('0x1'));var moment=require(_0xc59a('0x2'));var BPromise=require(_0xc59a('0x3'));var rs=require(_0xc59a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc59a('0x5'))['db'];var utils=require(_0xc59a('0x6'));var logger=require('../../config/logger')(_0xc59a('0x7'));var config=require(_0xc59a('0x8'));var jayson=require(_0xc59a('0x9'));var client=jayson[_0xc59a('0xa')][_0xc59a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5286c6,_0x364b03,_0x576a51){return new BPromise(function(_0x12806d,_0x5dc514){return client[_0xc59a('0xc')](_0x5286c6,_0x576a51)['then'](function(_0x3ba5c0){logger['info'](_0xc59a('0xd'),_0x364b03,'request\x20sent');logger[_0xc59a('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x364b03,_0xc59a('0xf'),JSON[_0xc59a('0x10')](_0x3ba5c0));if(_0x3ba5c0[_0xc59a('0x11')]){if(_0x3ba5c0['error'][_0xc59a('0x12')]===0x1f4){logger[_0xc59a('0x11')](_0xc59a('0xd'),_0x364b03,_0x3ba5c0['error'][_0xc59a('0x13')]);return _0x5dc514(_0x3ba5c0['error'][_0xc59a('0x13')]);}logger[_0xc59a('0x11')](_0xc59a('0xd'),_0x364b03,_0x3ba5c0[_0xc59a('0x11')][_0xc59a('0x13')]);return _0x12806d(_0x3ba5c0[_0xc59a('0x11')][_0xc59a('0x13')]);}else{logger[_0xc59a('0x14')](_0xc59a('0xd'),_0x364b03,_0xc59a('0xf'));_0x12806d(_0x3ba5c0[_0xc59a('0x15')][_0xc59a('0x13')]);}})[_0xc59a('0x16')](function(_0x16c9ef){logger[_0xc59a('0x11')](_0xc59a('0xd'),_0x364b03,_0x16c9ef);_0x5dc514(_0x16c9ef);});});}exports[_0xc59a('0x17')]=function(_0x3686f6){var _0x257a64=this;return new Promise(function(_0x17f477,_0x3be8b8){return db['ZohoAccount'][_0xc59a('0x18')]({'raw':_0x3686f6[_0xc59a('0x19')]?_0x3686f6['options'][_0xc59a('0x1a')]===undefined?!![]:![]:!![],'where':_0x3686f6[_0xc59a('0x19')]?_0x3686f6['options'][_0xc59a('0x1b')]||null:null,'attributes':_0x3686f6['options']?_0x3686f6[_0xc59a('0x19')]['attributes']||null:null,'limit':_0x3686f6[_0xc59a('0x19')]?_0x3686f6['options'][_0xc59a('0x1c')]||null:null,'include':_0x3686f6[_0xc59a('0x19')]?_0x3686f6[_0xc59a('0x19')][_0xc59a('0x1d')]?_[_0xc59a('0x1e')](_0x3686f6[_0xc59a('0x19')]['include'],function(_0x213709){return{'model':db[_0x213709[_0xc59a('0x1f')]],'as':_0x213709['as'],'attributes':_0x213709[_0xc59a('0x20')],'include':_0x213709[_0xc59a('0x1d')]?_[_0xc59a('0x1e')](_0x213709[_0xc59a('0x1d')],function(_0x5ae91d){return{'model':db[_0x5ae91d[_0xc59a('0x1f')]],'as':_0x5ae91d['as'],'attributes':_0x5ae91d[_0xc59a('0x20')],'include':_0x5ae91d[_0xc59a('0x1d')]?_[_0xc59a('0x1e')](_0x5ae91d[_0xc59a('0x1d')],function(_0xdea542){return{'model':db[_0xdea542['model']],'as':_0xdea542['as'],'attributes':_0xdea542[_0xc59a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc59a('0x21')](function(_0x28b8f4){logger['info'](_0xc59a('0x17'),_0x3686f6);logger[_0xc59a('0xe')](_0xc59a('0x17'),_0x3686f6,JSON[_0xc59a('0x10')](_0x28b8f4));_0x17f477(_0x28b8f4);})['catch'](function(_0x480144){logger['error'](_0xc59a('0x17'),_0x480144['message'],_0x3686f6);_0x3be8b8(_0x257a64[_0xc59a('0x11')](0x1f4,_0x480144[_0xc59a('0x13')]));});});};exports['ShowZohoAccount']=function(_0x34946b){var _0x4f5841=this;return new Promise(function(_0x102ce5,_0x5ce24b){return db[_0xc59a('0x22')][_0xc59a('0x23')]({'raw':_0x34946b[_0xc59a('0x19')]?_0x34946b[_0xc59a('0x19')][_0xc59a('0x1a')]===undefined?!![]:![]:!![],'where':_0x34946b['options']?_0x34946b[_0xc59a('0x19')][_0xc59a('0x1b')]||null:null,'attributes':_0x34946b['options']?_0x34946b[_0xc59a('0x19')][_0xc59a('0x20')]||null:null,'include':_0x34946b[_0xc59a('0x19')]?_0x34946b['options'][_0xc59a('0x1d')]?_[_0xc59a('0x1e')](_0x34946b[_0xc59a('0x19')][_0xc59a('0x1d')],function(_0x1bae6f){return{'model':db[_0x1bae6f['model']],'as':_0x1bae6f['as'],'attributes':_0x1bae6f['attributes'],'include':_0x1bae6f[_0xc59a('0x1d')]?_[_0xc59a('0x1e')](_0x1bae6f[_0xc59a('0x1d')],function(_0x4686e9){return{'model':db[_0x4686e9[_0xc59a('0x1f')]],'as':_0x4686e9['as'],'attributes':_0x4686e9[_0xc59a('0x20')],'include':_0x4686e9['include']?_['map'](_0x4686e9['include'],function(_0x521140){return{'model':db[_0x521140['model']],'as':_0x521140['as'],'attributes':_0x521140[_0xc59a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc59a('0x21')](function(_0x48b3a5){logger[_0xc59a('0x14')]('ShowZohoAccount',_0x34946b);logger['debug'](_0xc59a('0x24'),_0x34946b,JSON[_0xc59a('0x10')](_0x48b3a5));_0x102ce5(_0x48b3a5);})[_0xc59a('0x16')](function(_0x3b1a06){logger[_0xc59a('0x11')](_0xc59a('0x24'),_0x3b1a06['message'],_0x34946b);_0x5ce24b(_0x4f5841[_0xc59a('0x11')](0x1f4,_0x3b1a06[_0xc59a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index bdcbacd..d76acb4 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 _0xefeb=['express','../../components/auth/service','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x148aef,_0x23cebb){var _0x4f1e78=function(_0x59211c){while(--_0x59211c){_0x148aef['push'](_0x148aef['shift']());}};_0x4f1e78(++_0x23cebb);}(_0xefeb,0xb0));var _0xbefe=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xefeb[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xbefe('0x0'));var util=require(_0xbefe('0x1'));var path=require(_0xbefe('0x2'));var timeout=require(_0xbefe('0x3'));var express=require(_0xbefe('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbefe('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xbefe('0x6')]('/',auth[_0xbefe('0x7')](),controller['index']);router['get'](_0xbefe('0x8'),auth[_0xbefe('0x7')](),controller[_0xbefe('0x9')]);router['get'](_0xbefe('0xa'),auth[_0xbefe('0x7')](),controller[_0xbefe('0xb')]);router[_0xbefe('0x6')](_0xbefe('0xc'),auth[_0xbefe('0x7')](),controller[_0xbefe('0xd')]);router[_0xbefe('0x6')](_0xbefe('0xe'),auth[_0xbefe('0x7')](),controller[_0xbefe('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbefe('0x10')]);router['put'](_0xbefe('0x8'),auth[_0xbefe('0x7')](),controller[_0xbefe('0x11')]);router[_0xbefe('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xbefe('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9852=['isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id'];(function(_0x5401ae,_0x5e58ac){var _0x286068=function(_0x2cac88){while(--_0x2cac88){_0x5401ae['push'](_0x5401ae['shift']());}};_0x286068(++_0x5e58ac);}(_0x9852,0xe7));var _0x2985=function(_0x16a7d8,_0x326d5c){_0x16a7d8=_0x16a7d8-0x0;var _0xa4b589=_0x9852[_0x16a7d8];return _0xa4b589;};'use strict';var multer=require(_0x2985('0x0'));var util=require(_0x2985('0x1'));var path=require('path');var timeout=require(_0x2985('0x2'));var express=require(_0x2985('0x3'));var router=express[_0x2985('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2985('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2985('0x6'));var controller=require(_0x2985('0x7'));router[_0x2985('0x8')]('/',auth['isAuthenticated'](),controller[_0x2985('0x9')]);router[_0x2985('0x8')](_0x2985('0xa'),auth[_0x2985('0xb')](),controller['show']);router['get'](_0x2985('0xc'),auth[_0x2985('0xb')](),controller[_0x2985('0xd')]);router[_0x2985('0x8')](_0x2985('0xe'),auth['isAuthenticated'](),controller[_0x2985('0xf')]);router[_0x2985('0x8')]('/:id/descriptions',auth[_0x2985('0xb')](),controller['getDescriptions']);router[_0x2985('0x10')]('/',auth[_0x2985('0xb')](),controller[_0x2985('0x11')]);router[_0x2985('0x12')](_0x2985('0xa'),auth[_0x2985('0xb')](),controller['update']);router[_0x2985('0x13')]('/:id',auth[_0x2985('0xb')](),controller[_0x2985('0x14')]);module[_0x2985('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index d62a9a1..7d6a224 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 _0x5fa2=['nothing','contact_lead','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5fa2,0x1b2));var _0x25fa=function(_0x4a2660,_0x3b5bc5){_0x4a2660=_0x4a2660-0x0;var _0x182444=_0x5fa2[_0x4a2660];return _0x182444;};'use strict';var Sequelize=require(_0x25fa('0x0'));module[_0x25fa('0x1')]={'name':{'type':Sequelize[_0x25fa('0x2')]},'moduleCreate':{'type':Sequelize[_0x25fa('0x3')](_0x25fa('0x4'),_0x25fa('0x5'),_0x25fa('0x6')),'defaultValue':_0x25fa('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x25fa('0x7'),'contact',_0x25fa('0x4')),'defaultValue':_0x25fa('0x7')},'description':{'type':Sequelize[_0x25fa('0x2')]}}; \ No newline at end of file +var _0xdbcd=['exports','ENUM','lead','contact','contact_lead','STRING'];(function(_0x4f57f7,_0x3b55e1){var _0x358b66=function(_0x42da1d){while(--_0x42da1d){_0x4f57f7['push'](_0x4f57f7['shift']());}};_0x358b66(++_0x3b55e1);}(_0xdbcd,0x1bc));var _0xddbc=function(_0x23d09f,_0x5b4878){_0x23d09f=_0x23d09f-0x0;var _0x5615a8=_0xdbcd[_0x23d09f];return _0x5615a8;};'use strict';var Sequelize=require('sequelize');module[_0xddbc('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xddbc('0x1')](_0xddbc('0x2'),_0xddbc('0x3'),'nothing'),'defaultValue':_0xddbc('0x2')},'moduleSearch':{'type':Sequelize[_0xddbc('0x1')](_0xddbc('0x4'),'contact',_0xddbc('0x2')),'defaultValue':_0xddbc('0x4')},'description':{'type':Sequelize[_0xddbc('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 4f21afb..db40fb0 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 _0xb508=['filter','merge','VIRTUAL','ZohoConfiguration','includeAll','include','rows','catch','show','params','keys','options','create','body','find','getFields','findOne','ZohoField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x423d56,_0x309b37){var _0x5e38f1=function(_0x5efcbe){while(--_0x5efcbe){_0x423d56['push'](_0x423d56['shift']());}};_0x5e38f1(++_0x309b37);}(_0xb508,0x66));var _0x8b50=function(_0x5473ab,_0x1edd2a){_0x5473ab=_0x5473ab-0x0;var _0x12b00f=_0xb508[_0x5473ab];return _0x12b00f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b50('0x0'));var zipdir=require(_0x8b50('0x1'));var jsonpatch=require(_0x8b50('0x2'));var rp=require(_0x8b50('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8b50('0x4'));var util=require(_0x8b50('0x5'));var path=require(_0x8b50('0x6'));var sox=require(_0x8b50('0x7'));var csv=require(_0x8b50('0x8'));var ejs=require(_0x8b50('0x9'));var fs=require('fs');var fs_extra=require(_0x8b50('0xa'));var _=require(_0x8b50('0xb'));var squel=require(_0x8b50('0xc'));var crypto=require(_0x8b50('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8b50('0xe'));var toCsv=require(_0x8b50('0x8'));var querystring=require(_0x8b50('0xf'));var Papa=require(_0x8b50('0x10'));var Redis=require(_0x8b50('0x11'));var authService=require(_0x8b50('0x12'));var qs=require(_0x8b50('0x13'));var as=require(_0x8b50('0x14'));var hardwareService=require(_0x8b50('0x15'));var logger=require(_0x8b50('0x16'))(_0x8b50('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8b50('0x18'))['db'];function respondWithStatusCode(_0x2a4a6c,_0x334758){_0x334758=_0x334758||0xcc;return function(_0x92fc63){if(_0x92fc63){return _0x2a4a6c[_0x8b50('0x19')](_0x334758);}return _0x2a4a6c[_0x8b50('0x1a')](_0x334758)[_0x8b50('0x1b')]();};}function respondWithResult(_0x56ff93,_0x1fbf72){_0x1fbf72=_0x1fbf72||0xc8;return function(_0x38f6e9){if(_0x38f6e9){return _0x56ff93[_0x8b50('0x1a')](_0x1fbf72)['json'](_0x38f6e9);}};}function respondWithFilteredResult(_0x41764d,_0x2acb89){return function(_0x18281b){if(_0x18281b){var _0x36df32=typeof _0x2acb89[_0x8b50('0x1c')]===_0x8b50('0x1d')&&typeof _0x2acb89[_0x8b50('0x1e')]===_0x8b50('0x1d');var _0x1f3a24=_0x18281b[_0x8b50('0x1f')];var _0x159b61=_0x36df32?0x0:_0x2acb89['offset'];var _0x2ab593=_0x36df32?_0x18281b[_0x8b50('0x1f')]:_0x2acb89['offset']+_0x2acb89[_0x8b50('0x1e')];var _0x425fde;if(_0x2ab593>=_0x1f3a24){_0x2ab593=_0x1f3a24;_0x425fde=0xc8;}else{_0x425fde=0xce;}_0x41764d['status'](_0x425fde);return _0x41764d[_0x8b50('0x20')]('Content-Range',_0x159b61+'-'+_0x2ab593+'/'+_0x1f3a24)[_0x8b50('0x21')](_0x18281b);}return null;};}function patchUpdates(_0x5c263f){return function(_0x341563){try{jsonpatch[_0x8b50('0x22')](_0x341563,_0x5c263f,!![]);}catch(_0x183f67){return BPromise[_0x8b50('0x23')](_0x183f67);}return _0x341563['save']();};}function saveUpdates(_0x11a2fa,_0x16e735){return function(_0x6ae8c7){if(_0x6ae8c7){return _0x6ae8c7[_0x8b50('0x24')](_0x11a2fa)[_0x8b50('0x25')](function(_0x1d3a85){return _0x1d3a85;});}return null;};}function removeEntity(_0x1cc3ec,_0xc94731){return function(_0x50433e){if(_0x50433e){return _0x50433e[_0x8b50('0x26')]()[_0x8b50('0x25')](function(){_0x1cc3ec[_0x8b50('0x1a')](0xcc)[_0x8b50('0x1b')]();});}};}function handleEntityNotFound(_0x5e8c39,_0x274d8c){return function(_0x15b93c){if(!_0x15b93c){_0x5e8c39[_0x8b50('0x19')](0x194);}return _0x15b93c;};}function handleError(_0x229adc,_0x5c2d58){_0x5c2d58=_0x5c2d58||0x1f4;return function(_0x2a6f19){logger[_0x8b50('0x27')](_0x2a6f19[_0x8b50('0x28')]);if(_0x2a6f19[_0x8b50('0x29')]){delete _0x2a6f19[_0x8b50('0x29')];}_0x229adc[_0x8b50('0x1a')](_0x5c2d58)[_0x8b50('0x2a')](_0x2a6f19);};}exports[_0x8b50('0x2b')]=function(_0x10f294,_0x44fdcc){var _0x39eaee={},_0x1cee28={},_0x155262={'count':0x0,'rows':[]};var _0x3c8813=_[_0x8b50('0x2c')](db['ZohoConfiguration'][_0x8b50('0x2d')],function(_0x5656eb){return{'name':_0x5656eb[_0x8b50('0x2e')],'type':_0x5656eb[_0x8b50('0x2f')][_0x8b50('0x30')]};});_0x1cee28[_0x8b50('0x31')]=_[_0x8b50('0x2c')](_0x3c8813,_0x8b50('0x29'));_0x1cee28[_0x8b50('0x32')]=_['keys'](_0x10f294[_0x8b50('0x32')]);_0x1cee28[_0x8b50('0x33')]=_[_0x8b50('0x34')](_0x1cee28[_0x8b50('0x31')],_0x1cee28['query']);_0x39eaee['attributes']=_[_0x8b50('0x34')](_0x1cee28['model'],qs['fields'](_0x10f294[_0x8b50('0x32')][_0x8b50('0x35')]));_0x39eaee[_0x8b50('0x36')]=_0x39eaee[_0x8b50('0x36')][_0x8b50('0x37')]?_0x39eaee['attributes']:_0x1cee28[_0x8b50('0x31')];if(!_0x10f294['query'][_0x8b50('0x38')](_0x8b50('0x39'))){_0x39eaee[_0x8b50('0x1e')]=qs[_0x8b50('0x1e')](_0x10f294[_0x8b50('0x32')][_0x8b50('0x1e')]);_0x39eaee[_0x8b50('0x1c')]=qs[_0x8b50('0x1c')](_0x10f294[_0x8b50('0x32')][_0x8b50('0x1c')]);}_0x39eaee[_0x8b50('0x3a')]=qs['sort'](_0x10f294[_0x8b50('0x32')][_0x8b50('0x3b')]);_0x39eaee[_0x8b50('0x3c')]=qs[_0x8b50('0x33')](_[_0x8b50('0x3d')](_0x10f294['query'],_0x1cee28['filters']),_0x3c8813);if(_0x10f294[_0x8b50('0x32')][_0x8b50('0x3e')]){_0x39eaee['where']=_[_0x8b50('0x3f')](_0x39eaee['where'],{'$or':_[_0x8b50('0x2c')](_0x3c8813,function(_0x263204){if(_0x263204['type']!==_0x8b50('0x40')){var _0x28aab5={};_0x28aab5[_0x263204[_0x8b50('0x29')]]={'$like':'%'+_0x10f294[_0x8b50('0x32')][_0x8b50('0x3e')]+'%'};return _0x28aab5;}})});}_0x39eaee=_[_0x8b50('0x3f')]({},_0x39eaee,_0x10f294['options']);var _0x125ddb={'where':_0x39eaee['where']};return db[_0x8b50('0x41')][_0x8b50('0x1f')](_0x125ddb)[_0x8b50('0x25')](function(_0x361da7){_0x155262[_0x8b50('0x1f')]=_0x361da7;if(_0x10f294['query'][_0x8b50('0x42')]){_0x39eaee[_0x8b50('0x43')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x39eaee);})[_0x8b50('0x25')](function(_0x42d916){_0x155262[_0x8b50('0x44')]=_0x42d916;return _0x155262;})[_0x8b50('0x25')](respondWithFilteredResult(_0x44fdcc,_0x39eaee))[_0x8b50('0x45')](handleError(_0x44fdcc,null));};exports[_0x8b50('0x46')]=function(_0x554d89,_0xd9f955){var _0x163cd1={'raw':![],'where':{'id':_0x554d89[_0x8b50('0x47')]['id']}},_0x41f267={};_0x41f267['model']=_[_0x8b50('0x48')](db[_0x8b50('0x41')][_0x8b50('0x2d')]);_0x41f267[_0x8b50('0x32')]=_[_0x8b50('0x48')](_0x554d89['query']);_0x41f267[_0x8b50('0x33')]=_[_0x8b50('0x34')](_0x41f267['model'],_0x41f267[_0x8b50('0x32')]);_0x163cd1[_0x8b50('0x36')]=_[_0x8b50('0x34')](_0x41f267[_0x8b50('0x31')],qs[_0x8b50('0x35')](_0x554d89['query'][_0x8b50('0x35')]));_0x163cd1[_0x8b50('0x36')]=_0x163cd1[_0x8b50('0x36')][_0x8b50('0x37')]?_0x163cd1[_0x8b50('0x36')]:_0x41f267[_0x8b50('0x31')];if(_0x554d89[_0x8b50('0x32')]['includeAll']){_0x163cd1[_0x8b50('0x43')]=[{'all':!![]}];}_0x163cd1=_[_0x8b50('0x3f')]({},_0x163cd1,_0x554d89[_0x8b50('0x49')]);return db['ZohoConfiguration']['find'](_0x163cd1)[_0x8b50('0x25')](handleEntityNotFound(_0xd9f955,null))[_0x8b50('0x25')](respondWithResult(_0xd9f955,null))[_0x8b50('0x45')](handleError(_0xd9f955,null));};exports[_0x8b50('0x4a')]=function(_0x8c23d4,_0x541641){return db['ZohoConfiguration'][_0x8b50('0x4a')](_0x8c23d4['body'],{})[_0x8b50('0x25')](respondWithResult(_0x541641,0xc9))[_0x8b50('0x45')](handleError(_0x541641,null));};exports[_0x8b50('0x24')]=function(_0x399771,_0x43bb8c){if(_0x399771[_0x8b50('0x4b')]['id']){delete _0x399771['body']['id'];}return db[_0x8b50('0x41')][_0x8b50('0x4c')]({'where':{'id':_0x399771[_0x8b50('0x47')]['id']}})[_0x8b50('0x25')](handleEntityNotFound(_0x43bb8c,null))[_0x8b50('0x25')](saveUpdates(_0x399771[_0x8b50('0x4b')],null))[_0x8b50('0x25')](respondWithResult(_0x43bb8c,null))[_0x8b50('0x45')](handleError(_0x43bb8c,null));};exports[_0x8b50('0x26')]=function(_0x956a9c,_0x204455){return db[_0x8b50('0x41')][_0x8b50('0x4c')]({'where':{'id':_0x956a9c['params']['id']}})[_0x8b50('0x25')](handleEntityNotFound(_0x204455,null))['then'](removeEntity(_0x204455,null))['catch'](handleError(_0x204455,null));};exports[_0x8b50('0x4d')]=function(_0x5f5de4,_0x4a360f,_0x574d3c){var _0x216b1={};var _0x4a178c={};var _0x4bc020;var _0x3bfd10;return db[_0x8b50('0x41')][_0x8b50('0x4e')]({'where':{'id':_0x5f5de4[_0x8b50('0x47')]['id']}})[_0x8b50('0x25')](handleEntityNotFound(_0x4a360f,null))[_0x8b50('0x25')](function(_0x880573){if(_0x880573){_0x4bc020=_0x880573;_0x4a178c['model']=_['keys'](db[_0x8b50('0x4f')][_0x8b50('0x2d')]);_0x4a178c[_0x8b50('0x32')]=_[_0x8b50('0x48')](_0x5f5de4[_0x8b50('0x32')]);_0x4a178c['filters']=_[_0x8b50('0x34')](_0x4a178c[_0x8b50('0x31')],_0x4a178c[_0x8b50('0x32')]);_0x216b1[_0x8b50('0x36')]=_[_0x8b50('0x34')](_0x4a178c[_0x8b50('0x31')],qs['fields'](_0x5f5de4[_0x8b50('0x32')][_0x8b50('0x35')]));_0x216b1['attributes']=_0x216b1[_0x8b50('0x36')][_0x8b50('0x37')]?_0x216b1[_0x8b50('0x36')]:_0x4a178c[_0x8b50('0x31')];_0x216b1[_0x8b50('0x3a')]=qs[_0x8b50('0x3b')](_0x5f5de4[_0x8b50('0x32')][_0x8b50('0x3b')]);_0x216b1[_0x8b50('0x3c')]=qs[_0x8b50('0x33')](_['pick'](_0x5f5de4[_0x8b50('0x32')],_0x4a178c['filters']));if(_0x5f5de4[_0x8b50('0x32')][_0x8b50('0x3e')]){_0x216b1[_0x8b50('0x3c')]=_[_0x8b50('0x3f')](_0x216b1[_0x8b50('0x3c')],{'$or':_[_0x8b50('0x2c')](_0x216b1[_0x8b50('0x36')],function(_0x4c384d){var _0x5e3870={};_0x5e3870[_0x4c384d]={'$like':'%'+_0x5f5de4[_0x8b50('0x32')][_0x8b50('0x3e')]+'%'};return _0x5e3870;})});}_0x216b1=_[_0x8b50('0x3f')]({},_0x216b1,_0x5f5de4[_0x8b50('0x49')]);return _0x4bc020[_0x8b50('0x4d')](_0x216b1);}})[_0x8b50('0x25')](function(_0x44b3e6){if(_0x44b3e6){_0x3bfd10=_0x44b3e6[_0x8b50('0x37')];if(!_0x5f5de4['query']['hasOwnProperty'](_0x8b50('0x39'))){_0x216b1[_0x8b50('0x1e')]=qs['limit'](_0x5f5de4['query'][_0x8b50('0x1e')]);_0x216b1[_0x8b50('0x1c')]=qs[_0x8b50('0x1c')](_0x5f5de4[_0x8b50('0x32')]['offset']);}return _0x4bc020['getFields'](_0x216b1);}})[_0x8b50('0x25')](function(_0x3b74a1){if(_0x3b74a1){return _0x3b74a1?{'count':_0x3bfd10,'rows':_0x3b74a1}:null;}})[_0x8b50('0x25')](respondWithResult(_0x4a360f,null))[_0x8b50('0x45')](handleError(_0x4a360f,null));};exports[_0x8b50('0x50')]=function(_0x1adabf,_0x59c0cf,_0x1d923d){var _0x5d0f5e={};var _0x55805b={};var _0x54db93;var _0x43f78a;return db[_0x8b50('0x41')][_0x8b50('0x4e')]({'where':{'id':_0x1adabf['params']['id']}})['then'](handleEntityNotFound(_0x59c0cf,null))[_0x8b50('0x25')](function(_0x43977f){if(_0x43977f){_0x54db93=_0x43977f;_0x55805b[_0x8b50('0x31')]=_[_0x8b50('0x48')](db[_0x8b50('0x4f')][_0x8b50('0x2d')]);_0x55805b[_0x8b50('0x32')]=_[_0x8b50('0x48')](_0x1adabf['query']);_0x55805b[_0x8b50('0x33')]=_['intersection'](_0x55805b[_0x8b50('0x31')],_0x55805b[_0x8b50('0x32')]);_0x5d0f5e['attributes']=_['intersection'](_0x55805b['model'],qs[_0x8b50('0x35')](_0x1adabf[_0x8b50('0x32')][_0x8b50('0x35')]));_0x5d0f5e[_0x8b50('0x36')]=_0x5d0f5e[_0x8b50('0x36')][_0x8b50('0x37')]?_0x5d0f5e[_0x8b50('0x36')]:_0x55805b['model'];_0x5d0f5e[_0x8b50('0x3a')]=qs[_0x8b50('0x3b')](_0x1adabf[_0x8b50('0x32')][_0x8b50('0x3b')]);_0x5d0f5e['where']=qs['filters'](_[_0x8b50('0x3d')](_0x1adabf[_0x8b50('0x32')],_0x55805b[_0x8b50('0x33')]));if(_0x1adabf[_0x8b50('0x32')]['filter']){_0x5d0f5e['where']=_[_0x8b50('0x3f')](_0x5d0f5e[_0x8b50('0x3c')],{'$or':_['map'](_0x5d0f5e['attributes'],function(_0x585f29){var _0x30b8e2={};_0x30b8e2[_0x585f29]={'$like':'%'+_0x1adabf['query'][_0x8b50('0x3e')]+'%'};return _0x30b8e2;})});}_0x5d0f5e=_[_0x8b50('0x3f')]({},_0x5d0f5e,_0x1adabf[_0x8b50('0x49')]);return _0x54db93[_0x8b50('0x50')](_0x5d0f5e);}})[_0x8b50('0x25')](function(_0x1d0841){if(_0x1d0841){_0x43f78a=_0x1d0841['length'];if(!_0x1adabf[_0x8b50('0x32')][_0x8b50('0x38')](_0x8b50('0x39'))){_0x5d0f5e[_0x8b50('0x1e')]=qs[_0x8b50('0x1e')](_0x1adabf['query'][_0x8b50('0x1e')]);_0x5d0f5e[_0x8b50('0x1c')]=qs['offset'](_0x1adabf['query']['offset']);}return _0x54db93[_0x8b50('0x50')](_0x5d0f5e);}})['then'](function(_0xc8a93c){if(_0xc8a93c){return _0xc8a93c?{'count':_0x43f78a,'rows':_0xc8a93c}:null;}})['then'](respondWithResult(_0x59c0cf,null))[_0x8b50('0x45')](handleError(_0x59c0cf,null));};exports[_0x8b50('0x51')]=function(_0x95c100,_0x2a6485,_0x5ea7f2){var _0x348a81={};var _0x5e0134={};var _0x6e92b3;var _0x5aa157;return db[_0x8b50('0x41')][_0x8b50('0x4e')]({'where':{'id':_0x95c100[_0x8b50('0x47')]['id']}})[_0x8b50('0x25')](handleEntityNotFound(_0x2a6485,null))['then'](function(_0x5ad5f4){if(_0x5ad5f4){_0x6e92b3=_0x5ad5f4;_0x5e0134[_0x8b50('0x31')]=_['keys'](db[_0x8b50('0x4f')][_0x8b50('0x2d')]);_0x5e0134[_0x8b50('0x32')]=_[_0x8b50('0x48')](_0x95c100[_0x8b50('0x32')]);_0x5e0134[_0x8b50('0x33')]=_['intersection'](_0x5e0134['model'],_0x5e0134[_0x8b50('0x32')]);_0x348a81[_0x8b50('0x36')]=_[_0x8b50('0x34')](_0x5e0134[_0x8b50('0x31')],qs[_0x8b50('0x35')](_0x95c100['query'][_0x8b50('0x35')]));_0x348a81[_0x8b50('0x36')]=_0x348a81['attributes'][_0x8b50('0x37')]?_0x348a81[_0x8b50('0x36')]:_0x5e0134[_0x8b50('0x31')];_0x348a81['order']=qs[_0x8b50('0x3b')](_0x95c100[_0x8b50('0x32')][_0x8b50('0x3b')]);_0x348a81[_0x8b50('0x3c')]=qs['filters'](_[_0x8b50('0x3d')](_0x95c100[_0x8b50('0x32')],_0x5e0134[_0x8b50('0x33')]));if(_0x95c100[_0x8b50('0x32')][_0x8b50('0x3e')]){_0x348a81[_0x8b50('0x3c')]=_[_0x8b50('0x3f')](_0x348a81[_0x8b50('0x3c')],{'$or':_['map'](_0x348a81['attributes'],function(_0x53f279){var _0x10e869={};_0x10e869[_0x53f279]={'$like':'%'+_0x95c100[_0x8b50('0x32')][_0x8b50('0x3e')]+'%'};return _0x10e869;})});}_0x348a81=_[_0x8b50('0x3f')]({},_0x348a81,_0x95c100[_0x8b50('0x49')]);return _0x6e92b3[_0x8b50('0x51')](_0x348a81);}})[_0x8b50('0x25')](function(_0x49ee4e){if(_0x49ee4e){_0x5aa157=_0x49ee4e[_0x8b50('0x37')];if(!_0x95c100[_0x8b50('0x32')][_0x8b50('0x38')]('nolimit')){_0x348a81['limit']=qs['limit'](_0x95c100['query'][_0x8b50('0x1e')]);_0x348a81[_0x8b50('0x1c')]=qs['offset'](_0x95c100[_0x8b50('0x32')][_0x8b50('0x1c')]);}return _0x6e92b3[_0x8b50('0x51')](_0x348a81);}})[_0x8b50('0x25')](function(_0x138cde){if(_0x138cde){return _0x138cde?{'count':_0x5aa157,'rows':_0x138cde}:null;}})[_0x8b50('0x25')](respondWithResult(_0x2a6485,null))[_0x8b50('0x45')](handleError(_0x2a6485,null));}; \ No newline at end of file +var _0xd42b=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','error','name','send','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','ZohoConfiguration','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','destroy','getFields','findOne','ZohoField','filter','getSubjects','order','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','util','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus'];(function(_0x3c4062,_0x3767fc){var _0x3f5bf3=function(_0x105e55){while(--_0x105e55){_0x3c4062['push'](_0x3c4062['shift']());}};_0x3f5bf3(++_0x3767fc);}(_0xd42b,0xca));var _0xbd42=function(_0x4e0a03,_0x5eb6b0){_0x4e0a03=_0x4e0a03-0x0;var _0x2478fc=_0xd42b[_0x4e0a03];return _0x2478fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd42('0x0'));var zipdir=require(_0xbd42('0x1'));var jsonpatch=require(_0xbd42('0x2'));var rp=require(_0xbd42('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbd42('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xbd42('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd42('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbd42('0x7'));var deskjs=require(_0xbd42('0x8'));var toCsv=require(_0xbd42('0x5'));var querystring=require(_0xbd42('0x9'));var Papa=require(_0xbd42('0xa'));var Redis=require(_0xbd42('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbd42('0xc'));var hardwareService=require(_0xbd42('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0xbd42('0xe'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbd42('0xf'))['db'];function respondWithStatusCode(_0xa9be46,_0x517608){_0x517608=_0x517608||0xcc;return function(_0x10cf26){if(_0x10cf26){return _0xa9be46[_0xbd42('0x10')](_0x517608);}return _0xa9be46[_0xbd42('0x11')](_0x517608)[_0xbd42('0x12')]();};}function respondWithResult(_0x25ef46,_0x23f75b){_0x23f75b=_0x23f75b||0xc8;return function(_0x546c77){if(_0x546c77){return _0x25ef46[_0xbd42('0x11')](_0x23f75b)['json'](_0x546c77);}};}function respondWithFilteredResult(_0x237143,_0x425875){return function(_0x395ea3){if(_0x395ea3){var _0x23c7ce=typeof _0x425875[_0xbd42('0x13')]===_0xbd42('0x14')&&typeof _0x425875[_0xbd42('0x15')]===_0xbd42('0x14');var _0x3aba95=_0x395ea3[_0xbd42('0x16')];var _0x1d7e0e=_0x23c7ce?0x0:_0x425875[_0xbd42('0x13')];var _0x1bd4e1=_0x23c7ce?_0x395ea3[_0xbd42('0x16')]:_0x425875['offset']+_0x425875['limit'];var _0x384e74;if(_0x1bd4e1>=_0x3aba95){_0x1bd4e1=_0x3aba95;_0x384e74=0xc8;}else{_0x384e74=0xce;}_0x237143[_0xbd42('0x11')](_0x384e74);return _0x237143['set'](_0xbd42('0x17'),_0x1d7e0e+'-'+_0x1bd4e1+'/'+_0x3aba95)[_0xbd42('0x18')](_0x395ea3);}return null;};}function patchUpdates(_0x2c66a7){return function(_0x74b20a){try{jsonpatch[_0xbd42('0x19')](_0x74b20a,_0x2c66a7,!![]);}catch(_0x1f5cf6){return BPromise[_0xbd42('0x1a')](_0x1f5cf6);}return _0x74b20a[_0xbd42('0x1b')]();};}function saveUpdates(_0x385a96,_0x2b525c){return function(_0x24987e){if(_0x24987e){return _0x24987e['update'](_0x385a96)[_0xbd42('0x1c')](function(_0x558eb0){return _0x558eb0;});}return null;};}function removeEntity(_0x491fff,_0x547e2d){return function(_0x1a265d){if(_0x1a265d){return _0x1a265d['destroy']()[_0xbd42('0x1c')](function(){_0x491fff[_0xbd42('0x11')](0xcc)[_0xbd42('0x12')]();});}};}function handleEntityNotFound(_0xd6c75,_0x3364ea){return function(_0x23e23f){if(!_0x23e23f){_0xd6c75[_0xbd42('0x10')](0x194);}return _0x23e23f;};}function handleError(_0x565616,_0xc40722){_0xc40722=_0xc40722||0x1f4;return function(_0x25170f){logger[_0xbd42('0x1d')](_0x25170f['stack']);if(_0x25170f[_0xbd42('0x1e')]){delete _0x25170f[_0xbd42('0x1e')];}_0x565616[_0xbd42('0x11')](_0xc40722)[_0xbd42('0x1f')](_0x25170f);};}exports['index']=function(_0x229273,_0x5d84e5){var _0x3e4655={},_0x511405={},_0x2a3b1e={'count':0x0,'rows':[]};var _0x309fb3=_[_0xbd42('0x20')](db['ZohoConfiguration'][_0xbd42('0x21')],function(_0x252f33){return{'name':_0x252f33[_0xbd42('0x22')],'type':_0x252f33[_0xbd42('0x23')][_0xbd42('0x24')]};});_0x511405['model']=_[_0xbd42('0x20')](_0x309fb3,'name');_0x511405['query']=_[_0xbd42('0x25')](_0x229273[_0xbd42('0x26')]);_0x511405[_0xbd42('0x27')]=_[_0xbd42('0x28')](_0x511405[_0xbd42('0x29')],_0x511405['query']);_0x3e4655[_0xbd42('0x2a')]=_[_0xbd42('0x28')](_0x511405['model'],qs[_0xbd42('0x2b')](_0x229273[_0xbd42('0x26')][_0xbd42('0x2b')]));_0x3e4655[_0xbd42('0x2a')]=_0x3e4655[_0xbd42('0x2a')][_0xbd42('0x2c')]?_0x3e4655[_0xbd42('0x2a')]:_0x511405['model'];if(!_0x229273['query'][_0xbd42('0x2d')](_0xbd42('0x2e'))){_0x3e4655[_0xbd42('0x15')]=qs[_0xbd42('0x15')](_0x229273[_0xbd42('0x26')][_0xbd42('0x15')]);_0x3e4655[_0xbd42('0x13')]=qs[_0xbd42('0x13')](_0x229273[_0xbd42('0x26')][_0xbd42('0x13')]);}_0x3e4655['order']=qs[_0xbd42('0x2f')](_0x229273['query'][_0xbd42('0x2f')]);_0x3e4655['where']=qs['filters'](_[_0xbd42('0x30')](_0x229273[_0xbd42('0x26')],_0x511405[_0xbd42('0x27')]),_0x309fb3);if(_0x229273['query']['filter']){_0x3e4655[_0xbd42('0x31')]=_[_0xbd42('0x32')](_0x3e4655[_0xbd42('0x31')],{'$or':_[_0xbd42('0x20')](_0x309fb3,function(_0x26767c){if(_0x26767c['type']!==_0xbd42('0x33')){var _0x5458c7={};_0x5458c7[_0x26767c['name']]={'$like':'%'+_0x229273[_0xbd42('0x26')]['filter']+'%'};return _0x5458c7;}})});}_0x3e4655=_[_0xbd42('0x32')]({},_0x3e4655,_0x229273[_0xbd42('0x34')]);var _0x2a0009={'where':_0x3e4655[_0xbd42('0x31')]};return db[_0xbd42('0x35')]['count'](_0x2a0009)['then'](function(_0x23147a){_0x2a3b1e[_0xbd42('0x16')]=_0x23147a;if(_0x229273['query'][_0xbd42('0x36')]){_0x3e4655[_0xbd42('0x37')]=[{'all':!![]}];}return db[_0xbd42('0x35')][_0xbd42('0x38')](_0x3e4655);})['then'](function(_0x1a8d2f){_0x2a3b1e[_0xbd42('0x39')]=_0x1a8d2f;return _0x2a3b1e;})['then'](respondWithFilteredResult(_0x5d84e5,_0x3e4655))['catch'](handleError(_0x5d84e5,null));};exports[_0xbd42('0x3a')]=function(_0x1903d7,_0x568c95){var _0x1b52a0={'raw':![],'where':{'id':_0x1903d7['params']['id']}},_0x213ec0={};_0x213ec0[_0xbd42('0x29')]=_[_0xbd42('0x25')](db[_0xbd42('0x35')]['rawAttributes']);_0x213ec0[_0xbd42('0x26')]=_[_0xbd42('0x25')](_0x1903d7['query']);_0x213ec0[_0xbd42('0x27')]=_[_0xbd42('0x28')](_0x213ec0['model'],_0x213ec0[_0xbd42('0x26')]);_0x1b52a0[_0xbd42('0x2a')]=_[_0xbd42('0x28')](_0x213ec0[_0xbd42('0x29')],qs[_0xbd42('0x2b')](_0x1903d7[_0xbd42('0x26')][_0xbd42('0x2b')]));_0x1b52a0[_0xbd42('0x2a')]=_0x1b52a0[_0xbd42('0x2a')][_0xbd42('0x2c')]?_0x1b52a0[_0xbd42('0x2a')]:_0x213ec0['model'];if(_0x1903d7['query'][_0xbd42('0x36')]){_0x1b52a0['include']=[{'all':!![]}];}_0x1b52a0=_[_0xbd42('0x32')]({},_0x1b52a0,_0x1903d7[_0xbd42('0x34')]);return db[_0xbd42('0x35')][_0xbd42('0x3b')](_0x1b52a0)[_0xbd42('0x1c')](handleEntityNotFound(_0x568c95,null))[_0xbd42('0x1c')](respondWithResult(_0x568c95,null))[_0xbd42('0x3c')](handleError(_0x568c95,null));};exports[_0xbd42('0x3d')]=function(_0x16255f,_0x5d4fd1){return db[_0xbd42('0x35')][_0xbd42('0x3d')](_0x16255f[_0xbd42('0x3e')],{})[_0xbd42('0x1c')](respondWithResult(_0x5d4fd1,0xc9))[_0xbd42('0x3c')](handleError(_0x5d4fd1,null));};exports[_0xbd42('0x3f')]=function(_0x2cad6d,_0x5e6a77){if(_0x2cad6d['body']['id']){delete _0x2cad6d[_0xbd42('0x3e')]['id'];}return db[_0xbd42('0x35')][_0xbd42('0x3b')]({'where':{'id':_0x2cad6d[_0xbd42('0x40')]['id']}})[_0xbd42('0x1c')](handleEntityNotFound(_0x5e6a77,null))[_0xbd42('0x1c')](saveUpdates(_0x2cad6d['body'],null))['then'](respondWithResult(_0x5e6a77,null))[_0xbd42('0x3c')](handleError(_0x5e6a77,null));};exports[_0xbd42('0x41')]=function(_0x23fd1b,_0x394e54){return db['ZohoConfiguration']['find']({'where':{'id':_0x23fd1b[_0xbd42('0x40')]['id']}})[_0xbd42('0x1c')](handleEntityNotFound(_0x394e54,null))[_0xbd42('0x1c')](removeEntity(_0x394e54,null))[_0xbd42('0x3c')](handleError(_0x394e54,null));};exports[_0xbd42('0x42')]=function(_0xf0102b,_0x59f6f1,_0x3c1d92){var _0x315005={};var _0x19fe9b={};var _0x40a2e7;var _0x51f118;return db[_0xbd42('0x35')][_0xbd42('0x43')]({'where':{'id':_0xf0102b[_0xbd42('0x40')]['id']}})[_0xbd42('0x1c')](handleEntityNotFound(_0x59f6f1,null))[_0xbd42('0x1c')](function(_0xc68d92){if(_0xc68d92){_0x40a2e7=_0xc68d92;_0x19fe9b[_0xbd42('0x29')]=_[_0xbd42('0x25')](db[_0xbd42('0x44')]['rawAttributes']);_0x19fe9b[_0xbd42('0x26')]=_[_0xbd42('0x25')](_0xf0102b[_0xbd42('0x26')]);_0x19fe9b[_0xbd42('0x27')]=_[_0xbd42('0x28')](_0x19fe9b['model'],_0x19fe9b[_0xbd42('0x26')]);_0x315005[_0xbd42('0x2a')]=_[_0xbd42('0x28')](_0x19fe9b['model'],qs[_0xbd42('0x2b')](_0xf0102b['query'][_0xbd42('0x2b')]));_0x315005[_0xbd42('0x2a')]=_0x315005[_0xbd42('0x2a')][_0xbd42('0x2c')]?_0x315005[_0xbd42('0x2a')]:_0x19fe9b[_0xbd42('0x29')];_0x315005['order']=qs[_0xbd42('0x2f')](_0xf0102b[_0xbd42('0x26')][_0xbd42('0x2f')]);_0x315005[_0xbd42('0x31')]=qs[_0xbd42('0x27')](_['pick'](_0xf0102b[_0xbd42('0x26')],_0x19fe9b[_0xbd42('0x27')]));if(_0xf0102b[_0xbd42('0x26')]['filter']){_0x315005[_0xbd42('0x31')]=_[_0xbd42('0x32')](_0x315005[_0xbd42('0x31')],{'$or':_[_0xbd42('0x20')](_0x315005[_0xbd42('0x2a')],function(_0x5603ba){var _0x21d330={};_0x21d330[_0x5603ba]={'$like':'%'+_0xf0102b[_0xbd42('0x26')][_0xbd42('0x45')]+'%'};return _0x21d330;})});}_0x315005=_[_0xbd42('0x32')]({},_0x315005,_0xf0102b['options']);return _0x40a2e7['getFields'](_0x315005);}})[_0xbd42('0x1c')](function(_0x593fe5){if(_0x593fe5){_0x51f118=_0x593fe5[_0xbd42('0x2c')];if(!_0xf0102b['query'][_0xbd42('0x2d')](_0xbd42('0x2e'))){_0x315005[_0xbd42('0x15')]=qs['limit'](_0xf0102b[_0xbd42('0x26')][_0xbd42('0x15')]);_0x315005[_0xbd42('0x13')]=qs[_0xbd42('0x13')](_0xf0102b[_0xbd42('0x26')]['offset']);}return _0x40a2e7['getFields'](_0x315005);}})[_0xbd42('0x1c')](function(_0x52fe7a){if(_0x52fe7a){return _0x52fe7a?{'count':_0x51f118,'rows':_0x52fe7a}:null;}})[_0xbd42('0x1c')](respondWithResult(_0x59f6f1,null))[_0xbd42('0x3c')](handleError(_0x59f6f1,null));};exports[_0xbd42('0x46')]=function(_0x336e3b,_0x3f6bc,_0x5add38){var _0x5924f7={};var _0xcb1768={};var _0x35d844;var _0x1469bf;return db[_0xbd42('0x35')][_0xbd42('0x43')]({'where':{'id':_0x336e3b[_0xbd42('0x40')]['id']}})[_0xbd42('0x1c')](handleEntityNotFound(_0x3f6bc,null))[_0xbd42('0x1c')](function(_0x43ba08){if(_0x43ba08){_0x35d844=_0x43ba08;_0xcb1768[_0xbd42('0x29')]=_[_0xbd42('0x25')](db[_0xbd42('0x44')][_0xbd42('0x21')]);_0xcb1768[_0xbd42('0x26')]=_[_0xbd42('0x25')](_0x336e3b[_0xbd42('0x26')]);_0xcb1768[_0xbd42('0x27')]=_[_0xbd42('0x28')](_0xcb1768[_0xbd42('0x29')],_0xcb1768[_0xbd42('0x26')]);_0x5924f7[_0xbd42('0x2a')]=_['intersection'](_0xcb1768['model'],qs[_0xbd42('0x2b')](_0x336e3b[_0xbd42('0x26')][_0xbd42('0x2b')]));_0x5924f7[_0xbd42('0x2a')]=_0x5924f7[_0xbd42('0x2a')][_0xbd42('0x2c')]?_0x5924f7[_0xbd42('0x2a')]:_0xcb1768['model'];_0x5924f7[_0xbd42('0x47')]=qs[_0xbd42('0x2f')](_0x336e3b[_0xbd42('0x26')][_0xbd42('0x2f')]);_0x5924f7['where']=qs[_0xbd42('0x27')](_[_0xbd42('0x30')](_0x336e3b['query'],_0xcb1768[_0xbd42('0x27')]));if(_0x336e3b[_0xbd42('0x26')][_0xbd42('0x45')]){_0x5924f7['where']=_['merge'](_0x5924f7[_0xbd42('0x31')],{'$or':_[_0xbd42('0x20')](_0x5924f7['attributes'],function(_0x5852b3){var _0x5e8a5e={};_0x5e8a5e[_0x5852b3]={'$like':'%'+_0x336e3b[_0xbd42('0x26')]['filter']+'%'};return _0x5e8a5e;})});}_0x5924f7=_[_0xbd42('0x32')]({},_0x5924f7,_0x336e3b[_0xbd42('0x34')]);return _0x35d844[_0xbd42('0x46')](_0x5924f7);}})['then'](function(_0x35c67d){if(_0x35c67d){_0x1469bf=_0x35c67d['length'];if(!_0x336e3b[_0xbd42('0x26')]['hasOwnProperty'](_0xbd42('0x2e'))){_0x5924f7[_0xbd42('0x15')]=qs[_0xbd42('0x15')](_0x336e3b[_0xbd42('0x26')]['limit']);_0x5924f7['offset']=qs[_0xbd42('0x13')](_0x336e3b[_0xbd42('0x26')]['offset']);}return _0x35d844[_0xbd42('0x46')](_0x5924f7);}})[_0xbd42('0x1c')](function(_0x4d9626){if(_0x4d9626){return _0x4d9626?{'count':_0x1469bf,'rows':_0x4d9626}:null;}})[_0xbd42('0x1c')](respondWithResult(_0x3f6bc,null))[_0xbd42('0x3c')](handleError(_0x3f6bc,null));};exports[_0xbd42('0x48')]=function(_0x5e02a8,_0x3a9098,_0x117a3b){var _0x5f330e={};var _0x2d1142={};var _0x32b08e;var _0x40482b;return db[_0xbd42('0x35')]['findOne']({'where':{'id':_0x5e02a8['params']['id']}})[_0xbd42('0x1c')](handleEntityNotFound(_0x3a9098,null))[_0xbd42('0x1c')](function(_0x1de462){if(_0x1de462){_0x32b08e=_0x1de462;_0x2d1142[_0xbd42('0x29')]=_[_0xbd42('0x25')](db[_0xbd42('0x44')][_0xbd42('0x21')]);_0x2d1142[_0xbd42('0x26')]=_[_0xbd42('0x25')](_0x5e02a8[_0xbd42('0x26')]);_0x2d1142[_0xbd42('0x27')]=_[_0xbd42('0x28')](_0x2d1142[_0xbd42('0x29')],_0x2d1142[_0xbd42('0x26')]);_0x5f330e[_0xbd42('0x2a')]=_[_0xbd42('0x28')](_0x2d1142[_0xbd42('0x29')],qs[_0xbd42('0x2b')](_0x5e02a8[_0xbd42('0x26')][_0xbd42('0x2b')]));_0x5f330e[_0xbd42('0x2a')]=_0x5f330e['attributes'][_0xbd42('0x2c')]?_0x5f330e[_0xbd42('0x2a')]:_0x2d1142['model'];_0x5f330e[_0xbd42('0x47')]=qs['sort'](_0x5e02a8['query'][_0xbd42('0x2f')]);_0x5f330e[_0xbd42('0x31')]=qs[_0xbd42('0x27')](_[_0xbd42('0x30')](_0x5e02a8[_0xbd42('0x26')],_0x2d1142[_0xbd42('0x27')]));if(_0x5e02a8[_0xbd42('0x26')][_0xbd42('0x45')]){_0x5f330e[_0xbd42('0x31')]=_[_0xbd42('0x32')](_0x5f330e['where'],{'$or':_[_0xbd42('0x20')](_0x5f330e['attributes'],function(_0x95d17e){var _0x2ccfc8={};_0x2ccfc8[_0x95d17e]={'$like':'%'+_0x5e02a8[_0xbd42('0x26')][_0xbd42('0x45')]+'%'};return _0x2ccfc8;})});}_0x5f330e=_[_0xbd42('0x32')]({},_0x5f330e,_0x5e02a8[_0xbd42('0x34')]);return _0x32b08e[_0xbd42('0x48')](_0x5f330e);}})[_0xbd42('0x1c')](function(_0x5092ae){if(_0x5092ae){_0x40482b=_0x5092ae[_0xbd42('0x2c')];if(!_0x5e02a8[_0xbd42('0x26')][_0xbd42('0x2d')](_0xbd42('0x2e'))){_0x5f330e[_0xbd42('0x15')]=qs[_0xbd42('0x15')](_0x5e02a8[_0xbd42('0x26')][_0xbd42('0x15')]);_0x5f330e[_0xbd42('0x13')]=qs[_0xbd42('0x13')](_0x5e02a8['query'][_0xbd42('0x13')]);}return _0x32b08e['getDescriptions'](_0x5f330e);}})['then'](function(_0x7bf61f){if(_0x7bf61f){return _0x7bf61f?{'count':_0x40482b,'rows':_0x7bf61f}:null;}})[_0xbd42('0x1c')](respondWithResult(_0x3a9098,null))[_0xbd42('0x3c')](handleError(_0x3a9098,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 3d4462e..33535ba 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 _0x48f8=['./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3fbf81,_0x242d60){var _0x54fbd=function(_0x3fca83){while(--_0x3fca83){_0x3fbf81['push'](_0x3fbf81['shift']());}};_0x54fbd(++_0x242d60);}(_0x48f8,0xfb));var _0x848f=function(_0x3a8164,_0x222723){_0x3a8164=_0x3a8164-0x0;var _0x5e527c=_0x48f8[_0x3a8164];return _0x5e527c;};'use strict';var _=require(_0x848f('0x0'));var util=require(_0x848f('0x1'));var logger=require(_0x848f('0x2'))(_0x848f('0x3'));var moment=require(_0x848f('0x4'));var BPromise=require('bluebird');var rp=require(_0x848f('0x5'));var fs=require('fs');var path=require(_0x848f('0x6'));var rimraf=require(_0x848f('0x7'));var config=require(_0x848f('0x8'));var attributes=require(_0x848f('0x9'));module[_0x848f('0xa')]=function(_0x28af4d,_0x1d85c6){return _0x28af4d[_0x848f('0xb')]('ZohoConfiguration',attributes,{'tableName':_0x848f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff08=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','ZohoConfiguration','int_zoho_configurations','lodash','util'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0xff08,0xae));var _0x8ff0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xff08[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x8ff0('0x0'));var util=require(_0x8ff0('0x1'));var logger=require(_0x8ff0('0x2'))('api');var moment=require(_0x8ff0('0x3'));var BPromise=require(_0x8ff0('0x4'));var rp=require(_0x8ff0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ff0('0x6'));var config=require(_0x8ff0('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0x8ff0('0x8')]=function(_0x1baddd,_0x3b7487){return _0x1baddd['define'](_0x8ff0('0x9'),attributes,{'tableName':_0x8ff0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index e710dca..1702637 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 _0xd382=['error','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2653dc,_0xe5799c){var _0x152344=function(_0x55bc64){while(--_0x55bc64){_0x2653dc['push'](_0x2653dc['shift']());}};_0x152344(++_0xe5799c);}(_0xd382,0x98));var _0x2d38=function(_0x478311,_0x453373){_0x478311=_0x478311-0x0;var _0x30e6e7=_0xd382[_0x478311];return _0x30e6e7;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var moment=require('moment');var BPromise=require(_0x2d38('0x2'));var rs=require(_0x2d38('0x3'));var fs=require('fs');var Redis=require(_0x2d38('0x4'));var db=require(_0x2d38('0x5'))['db'];var utils=require(_0x2d38('0x6'));var logger=require(_0x2d38('0x7'))('rpc');var config=require(_0x2d38('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2d38('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x302395,_0x1c8903,_0x2ab977){return new BPromise(function(_0x26f2dc,_0x1fc3b3){return client[_0x2d38('0xa')](_0x302395,_0x2ab977)[_0x2d38('0xb')](function(_0x39c323){logger[_0x2d38('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x1c8903,'request\x20sent');logger[_0x2d38('0xd')](_0x2d38('0xe'),_0x1c8903,_0x2d38('0xf'),JSON['stringify'](_0x39c323));if(_0x39c323[_0x2d38('0x10')]){if(_0x39c323['error']['code']===0x1f4){logger[_0x2d38('0x10')](_0x2d38('0x11'),_0x1c8903,_0x39c323['error']['message']);return _0x1fc3b3(_0x39c323[_0x2d38('0x10')]['message']);}logger['error'](_0x2d38('0x11'),_0x1c8903,_0x39c323[_0x2d38('0x10')][_0x2d38('0x12')]);return _0x26f2dc(_0x39c323[_0x2d38('0x10')][_0x2d38('0x12')]);}else{logger[_0x2d38('0xc')](_0x2d38('0x11'),_0x1c8903,_0x2d38('0xf'));_0x26f2dc(_0x39c323[_0x2d38('0x13')][_0x2d38('0x12')]);}})[_0x2d38('0x14')](function(_0x5c83b7){logger[_0x2d38('0x10')](_0x2d38('0x11'),_0x1c8903,_0x5c83b7);_0x1fc3b3(_0x5c83b7);});});} \ No newline at end of file +var _0xbc22=['request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0xbc22,0x97));var _0x2bc2=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0xbc22[_0x510b98];return _0x45e775;};'use strict';var _=require(_0x2bc2('0x0'));var util=require(_0x2bc2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2bc2('0x2'));var fs=require('fs');var Redis=require(_0x2bc2('0x3'));var db=require(_0x2bc2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2bc2('0x5'))(_0x2bc2('0x6'));var config=require(_0x2bc2('0x7'));var jayson=require(_0x2bc2('0x8'));var client=jayson[_0x2bc2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e5a6a,_0x216ecf,_0x593f61){return new BPromise(function(_0x27581a,_0x26916c){return client[_0x2bc2('0xa')](_0x2e5a6a,_0x593f61)[_0x2bc2('0xb')](function(_0x251e4b){logger['info'](_0x2bc2('0xc'),_0x216ecf,_0x2bc2('0xd'));logger[_0x2bc2('0xe')](_0x2bc2('0xf'),_0x216ecf,_0x2bc2('0xd'),JSON[_0x2bc2('0x10')](_0x251e4b));if(_0x251e4b['error']){if(_0x251e4b[_0x2bc2('0x11')][_0x2bc2('0x12')]===0x1f4){logger['error'](_0x2bc2('0xc'),_0x216ecf,_0x251e4b[_0x2bc2('0x11')][_0x2bc2('0x13')]);return _0x26916c(_0x251e4b[_0x2bc2('0x11')][_0x2bc2('0x13')]);}logger[_0x2bc2('0x11')](_0x2bc2('0xc'),_0x216ecf,_0x251e4b[_0x2bc2('0x11')]['message']);return _0x27581a(_0x251e4b[_0x2bc2('0x11')][_0x2bc2('0x13')]);}else{logger[_0x2bc2('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x216ecf,_0x2bc2('0xd'));_0x27581a(_0x251e4b[_0x2bc2('0x15')][_0x2bc2('0x13')]);}})[_0x2bc2('0x16')](function(_0x46814b){logger['error'](_0x2bc2('0xc'),_0x216ecf,_0x46814b);_0x26916c(_0x46814b);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 0a70832..85f4a96 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 _0xe883=['update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x212c71,_0x28b89c){var _0x2c0c4c=function(_0x409ad3){while(--_0x409ad3){_0x212c71['push'](_0x212c71['shift']());}};_0x2c0c4c(++_0x28b89c);}(_0xe883,0x159));var _0x3e88=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xe883[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0x3e88('0x0'));var util=require(_0x3e88('0x1'));var path=require(_0x3e88('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e88('0x3'));var router=express[_0x3e88('0x4')]();var fs_extra=require(_0x3e88('0x5'));var auth=require(_0x3e88('0x6'));var interaction=require(_0x3e88('0x7'));var config=require('../../config/environment');var controller=require(_0x3e88('0x8'));router[_0x3e88('0x9')]('/',auth['isAuthenticated'](),controller[_0x3e88('0xa')]);router[_0x3e88('0x9')](_0x3e88('0xb'),auth[_0x3e88('0xc')](),controller[_0x3e88('0xd')]);router[_0x3e88('0xe')]('/',auth[_0x3e88('0xc')](),controller['create']);router[_0x3e88('0xf')](_0x3e88('0xb'),auth[_0x3e88('0xc')](),controller[_0x3e88('0x10')]);router[_0x3e88('0x11')](_0x3e88('0xb'),auth[_0x3e88('0xc')](),controller[_0x3e88('0x12')]);module['exports']=router; \ No newline at end of file +var _0x31df=['./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x1af0fc,_0x946357){var _0x59572a=function(_0x2bd5a2){while(--_0x2bd5a2){_0x1af0fc['push'](_0x1af0fc['shift']());}};_0x59572a(++_0x946357);}(_0x31df,0xf0));var _0xf31d=function(_0x28990d,_0x4791d5){_0x28990d=_0x28990d-0x0;var _0x6bf068=_0x31df[_0x28990d];return _0x6bf068;};'use strict';var multer=require(_0xf31d('0x0'));var util=require(_0xf31d('0x1'));var path=require('path');var timeout=require(_0xf31d('0x2'));var express=require(_0xf31d('0x3'));var router=express[_0xf31d('0x4')]();var fs_extra=require(_0xf31d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf31d('0x6'));var controller=require(_0xf31d('0x7'));router['get']('/',auth[_0xf31d('0x8')](),controller[_0xf31d('0x9')]);router[_0xf31d('0xa')](_0xf31d('0xb'),auth['isAuthenticated'](),controller[_0xf31d('0xc')]);router[_0xf31d('0xd')]('/',auth[_0xf31d('0x8')](),controller[_0xf31d('0xe')]);router[_0xf31d('0xf')](_0xf31d('0xb'),auth[_0xf31d('0x8')](),controller['update']);router[_0xf31d('0x10')](_0xf31d('0xb'),auth[_0xf31d('0x8')](),controller[_0xf31d('0x11')]);module[_0xf31d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 58c3d0d..c84633a 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 _0xe35c=['BOOLEAN','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x2c1e91,_0x55bf74){var _0xd36b44=function(_0x19917b){while(--_0x19917b){_0x2c1e91['push'](_0x2c1e91['shift']());}};_0xd36b44(++_0x55bf74);}(_0xe35c,0xa9));var _0xce35=function(_0x4a6388,_0x224e87){_0x4a6388=_0x4a6388-0x0;var _0x195f0c=_0xe35c[_0x4a6388];return _0x195f0c;};'use strict';var Sequelize=require('sequelize');module[_0xce35('0x0')]={'type':{'type':Sequelize[_0xce35('0x1')](_0xce35('0x2'),_0xce35('0x3'),'customVariable',_0xce35('0x4'),_0xce35('0x5')),'defaultValue':_0xce35('0x2')},'content':{'type':Sequelize[_0xce35('0x6')]},'key':{'type':Sequelize[_0xce35('0x6')]},'keyType':{'type':Sequelize[_0xce35('0x1')](_0xce35('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xce35('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xce35('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x884f=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x13c4a4,_0x33f20b){var _0x2dec06=function(_0x499a48){while(--_0x499a48){_0x13c4a4['push'](_0x13c4a4['shift']());}};_0x2dec06(++_0x33f20b);}(_0x884f,0xd8));var _0xf884=function(_0x22088d,_0x27deaa){_0x22088d=_0x22088d-0x0;var _0x1dab44=_0x884f[_0x22088d];return _0x1dab44;};'use strict';var Sequelize=require(_0xf884('0x0'));module[_0xf884('0x1')]={'type':{'type':Sequelize[_0xf884('0x2')](_0xf884('0x3'),_0xf884('0x4'),_0xf884('0x5'),'keyValue',_0xf884('0x6')),'defaultValue':_0xf884('0x3')},'content':{'type':Sequelize[_0xf884('0x7')]},'key':{'type':Sequelize[_0xf884('0x7')]},'keyType':{'type':Sequelize[_0xf884('0x2')](_0xf884('0x3'),_0xf884('0x4'),_0xf884('0x5'))},'keyContent':{'type':Sequelize[_0xf884('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf884('0x7')]},'customField':{'type':Sequelize[_0xf884('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf884('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 16b3f3f..929c0ca 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 _0xa301=['error','name','send','map','ZohoField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','update','destroy','then'];(function(_0x417852,_0x40250c){var _0x89146a=function(_0x3f9826){while(--_0x3f9826){_0x417852['push'](_0x417852['shift']());}};_0x89146a(++_0x40250c);}(_0xa301,0xfb));var _0x1a30=function(_0x4e1947,_0x23eb82){_0x4e1947=_0x4e1947-0x0;var _0xeee66e=_0xa301[_0x4e1947];return _0xeee66e;};'use strict';var emlformat=require(_0x1a30('0x0'));var rimraf=require(_0x1a30('0x1'));var zipdir=require(_0x1a30('0x2'));var jsonpatch=require(_0x1a30('0x3'));var rp=require(_0x1a30('0x4'));var moment=require(_0x1a30('0x5'));var BPromise=require(_0x1a30('0x6'));var Mustache=require(_0x1a30('0x7'));var util=require(_0x1a30('0x8'));var path=require(_0x1a30('0x9'));var sox=require(_0x1a30('0xa'));var csv=require(_0x1a30('0xb'));var ejs=require(_0x1a30('0xc'));var fs=require('fs');var fs_extra=require(_0x1a30('0xd'));var _=require(_0x1a30('0xe'));var squel=require(_0x1a30('0xf'));var crypto=require(_0x1a30('0x10'));var jsforce=require(_0x1a30('0x11'));var deskjs=require(_0x1a30('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a30('0x13'));var Redis=require('ioredis');var authService=require(_0x1a30('0x14'));var qs=require(_0x1a30('0x15'));var as=require(_0x1a30('0x16'));var hardwareService=require(_0x1a30('0x17'));var logger=require(_0x1a30('0x18'))('api');var utils=require(_0x1a30('0x19'));var config=require(_0x1a30('0x1a'));var licenseUtil=require(_0x1a30('0x1b'));var db=require(_0x1a30('0x1c'))['db'];function respondWithStatusCode(_0x205df5,_0x358724){_0x358724=_0x358724||0xcc;return function(_0x309df1){if(_0x309df1){return _0x205df5[_0x1a30('0x1d')](_0x358724);}return _0x205df5[_0x1a30('0x1e')](_0x358724)['end']();};}function respondWithResult(_0x5bae35,_0x46f58e){_0x46f58e=_0x46f58e||0xc8;return function(_0x5c9c93){if(_0x5c9c93){return _0x5bae35[_0x1a30('0x1e')](_0x46f58e)[_0x1a30('0x1f')](_0x5c9c93);}};}function respondWithFilteredResult(_0x1ebb09,_0x44cd70){return function(_0x26d5c7){if(_0x26d5c7){var _0x465c30=typeof _0x44cd70[_0x1a30('0x20')]==='undefined'&&typeof _0x44cd70[_0x1a30('0x21')]===_0x1a30('0x22');var _0x290ea7=_0x26d5c7[_0x1a30('0x23')];var _0x108940=_0x465c30?0x0:_0x44cd70[_0x1a30('0x20')];var _0x5766ca=_0x465c30?_0x26d5c7['count']:_0x44cd70[_0x1a30('0x20')]+_0x44cd70[_0x1a30('0x21')];var _0x129d21;if(_0x5766ca>=_0x290ea7){_0x5766ca=_0x290ea7;_0x129d21=0xc8;}else{_0x129d21=0xce;}_0x1ebb09['status'](_0x129d21);return _0x1ebb09[_0x1a30('0x24')]('Content-Range',_0x108940+'-'+_0x5766ca+'/'+_0x290ea7)['json'](_0x26d5c7);}return null;};}function patchUpdates(_0x35f27a){return function(_0xa31414){try{jsonpatch[_0x1a30('0x25')](_0xa31414,_0x35f27a,!![]);}catch(_0x58f6a8){return BPromise['reject'](_0x58f6a8);}return _0xa31414['save']();};}function saveUpdates(_0xbde46,_0x469f70){return function(_0x30e3c4){if(_0x30e3c4){return _0x30e3c4[_0x1a30('0x26')](_0xbde46)['then'](function(_0x354842){return _0x354842;});}return null;};}function removeEntity(_0x1c1c85,_0x4dad03){return function(_0x51d5b1){if(_0x51d5b1){return _0x51d5b1[_0x1a30('0x27')]()[_0x1a30('0x28')](function(){_0x1c1c85[_0x1a30('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c91b6,_0x293d63){return function(_0x108cb4){if(!_0x108cb4){_0x1c91b6[_0x1a30('0x1d')](0x194);}return _0x108cb4;};}function handleError(_0x486d6d,_0x5630ef){_0x5630ef=_0x5630ef||0x1f4;return function(_0x2ae99d){logger[_0x1a30('0x29')](_0x2ae99d['stack']);if(_0x2ae99d[_0x1a30('0x2a')]){delete _0x2ae99d['name'];}_0x486d6d[_0x1a30('0x1e')](_0x5630ef)[_0x1a30('0x2b')](_0x2ae99d);};}exports['index']=function(_0x580305,_0x3c04a8){var _0xcded8d={},_0x16b824={},_0x5f526b={'count':0x0,'rows':[]};var _0x4b72eb=_[_0x1a30('0x2c')](db[_0x1a30('0x2d')][_0x1a30('0x2e')],function(_0x1e6f83){return{'name':_0x1e6f83[_0x1a30('0x2f')],'type':_0x1e6f83['type'][_0x1a30('0x30')]};});_0x16b824[_0x1a30('0x31')]=_[_0x1a30('0x2c')](_0x4b72eb,_0x1a30('0x2a'));_0x16b824[_0x1a30('0x32')]=_[_0x1a30('0x33')](_0x580305[_0x1a30('0x32')]);_0x16b824[_0x1a30('0x34')]=_[_0x1a30('0x35')](_0x16b824[_0x1a30('0x31')],_0x16b824[_0x1a30('0x32')]);_0xcded8d['attributes']=_[_0x1a30('0x35')](_0x16b824[_0x1a30('0x31')],qs[_0x1a30('0x36')](_0x580305[_0x1a30('0x32')][_0x1a30('0x36')]));_0xcded8d['attributes']=_0xcded8d['attributes'][_0x1a30('0x37')]?_0xcded8d[_0x1a30('0x38')]:_0x16b824['model'];if(!_0x580305[_0x1a30('0x32')][_0x1a30('0x39')]('nolimit')){_0xcded8d[_0x1a30('0x21')]=qs[_0x1a30('0x21')](_0x580305[_0x1a30('0x32')]['limit']);_0xcded8d['offset']=qs[_0x1a30('0x20')](_0x580305[_0x1a30('0x32')][_0x1a30('0x20')]);}_0xcded8d[_0x1a30('0x3a')]=qs[_0x1a30('0x3b')](_0x580305[_0x1a30('0x32')][_0x1a30('0x3b')]);_0xcded8d[_0x1a30('0x3c')]=qs[_0x1a30('0x34')](_[_0x1a30('0x3d')](_0x580305[_0x1a30('0x32')],_0x16b824[_0x1a30('0x34')]),_0x4b72eb);if(_0x580305['query'][_0x1a30('0x3e')]){_0xcded8d['where']=_['merge'](_0xcded8d['where'],{'$or':_[_0x1a30('0x2c')](_0x4b72eb,function(_0x1d7095){if(_0x1d7095['type']!=='VIRTUAL'){var _0x1fc10c={};_0x1fc10c[_0x1d7095[_0x1a30('0x2a')]]={'$like':'%'+_0x580305[_0x1a30('0x32')][_0x1a30('0x3e')]+'%'};return _0x1fc10c;}})});}_0xcded8d=_[_0x1a30('0x3f')]({},_0xcded8d,_0x580305[_0x1a30('0x40')]);var _0x3964b4={'where':_0xcded8d['where']};return db[_0x1a30('0x2d')][_0x1a30('0x23')](_0x3964b4)[_0x1a30('0x28')](function(_0x5cc930){_0x5f526b[_0x1a30('0x23')]=_0x5cc930;if(_0x580305[_0x1a30('0x32')][_0x1a30('0x41')]){_0xcded8d[_0x1a30('0x42')]=[{'all':!![]}];}return db[_0x1a30('0x2d')]['findAll'](_0xcded8d);})['then'](function(_0x10a3a8){_0x5f526b[_0x1a30('0x43')]=_0x10a3a8;return _0x5f526b;})[_0x1a30('0x28')](respondWithFilteredResult(_0x3c04a8,_0xcded8d))[_0x1a30('0x44')](handleError(_0x3c04a8,null));};exports['show']=function(_0x540b10,_0x5b8237){var _0x3ac59c={'raw':!![],'where':{'id':_0x540b10['params']['id']}},_0x116f7a={};_0x116f7a[_0x1a30('0x31')]=_[_0x1a30('0x33')](db['ZohoField'][_0x1a30('0x2e')]);_0x116f7a[_0x1a30('0x32')]=_[_0x1a30('0x33')](_0x540b10[_0x1a30('0x32')]);_0x116f7a['filters']=_[_0x1a30('0x35')](_0x116f7a['model'],_0x116f7a[_0x1a30('0x32')]);_0x3ac59c[_0x1a30('0x38')]=_[_0x1a30('0x35')](_0x116f7a[_0x1a30('0x31')],qs['fields'](_0x540b10['query'][_0x1a30('0x36')]));_0x3ac59c[_0x1a30('0x38')]=_0x3ac59c['attributes'][_0x1a30('0x37')]?_0x3ac59c['attributes']:_0x116f7a[_0x1a30('0x31')];if(_0x540b10[_0x1a30('0x32')][_0x1a30('0x41')]){_0x3ac59c[_0x1a30('0x42')]=[{'all':!![]}];}_0x3ac59c=_[_0x1a30('0x3f')]({},_0x3ac59c,_0x540b10[_0x1a30('0x40')]);return db[_0x1a30('0x2d')][_0x1a30('0x45')](_0x3ac59c)[_0x1a30('0x28')](handleEntityNotFound(_0x5b8237,null))[_0x1a30('0x28')](respondWithResult(_0x5b8237,null))[_0x1a30('0x44')](handleError(_0x5b8237,null));};exports['create']=function(_0x97f748,_0x30da39){return db['ZohoField'][_0x1a30('0x46')](_0x97f748[_0x1a30('0x47')],{})['then'](respondWithResult(_0x30da39,0xc9))[_0x1a30('0x44')](handleError(_0x30da39,null));};exports[_0x1a30('0x26')]=function(_0x239e77,_0x13c062){if(_0x239e77[_0x1a30('0x47')]['id']){delete _0x239e77[_0x1a30('0x47')]['id'];}return db[_0x1a30('0x2d')]['find']({'where':{'id':_0x239e77[_0x1a30('0x48')]['id']}})[_0x1a30('0x28')](handleEntityNotFound(_0x13c062,null))['then'](saveUpdates(_0x239e77[_0x1a30('0x47')],null))[_0x1a30('0x28')](respondWithResult(_0x13c062,null))[_0x1a30('0x44')](handleError(_0x13c062,null));};exports['destroy']=function(_0x190d6f,_0x3e7fa2){return db['ZohoField'][_0x1a30('0x45')]({'where':{'id':_0x190d6f[_0x1a30('0x48')]['id']}})[_0x1a30('0x28')](handleEntityNotFound(_0x3e7fa2,null))[_0x1a30('0x28')](removeEntity(_0x3e7fa2,null))[_0x1a30('0x44')](handleError(_0x3e7fa2,null));}; \ No newline at end of file +var _0xf3b7=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','index','ZohoField','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','type','merge','options','includeAll','findAll','rows','catch','show','length','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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'];(function(_0x4486f3,_0x507a7d){var _0x3eaf83=function(_0x4e87ab){while(--_0x4e87ab){_0x4486f3['push'](_0x4486f3['shift']());}};_0x3eaf83(++_0x507a7d);}(_0xf3b7,0x119));var _0x7f3b=function(_0x114212,_0x11791b){_0x114212=_0x114212-0x0;var _0x56e928=_0xf3b7[_0x114212];return _0x56e928;};'use strict';var emlformat=require(_0x7f3b('0x0'));var rimraf=require(_0x7f3b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f3b('0x2'));var rp=require(_0x7f3b('0x3'));var moment=require(_0x7f3b('0x4'));var BPromise=require(_0x7f3b('0x5'));var Mustache=require('mustache');var util=require(_0x7f3b('0x6'));var path=require(_0x7f3b('0x7'));var sox=require(_0x7f3b('0x8'));var csv=require('to-csv');var ejs=require(_0x7f3b('0x9'));var fs=require('fs');var fs_extra=require(_0x7f3b('0xa'));var _=require(_0x7f3b('0xb'));var squel=require(_0x7f3b('0xc'));var crypto=require(_0x7f3b('0xd'));var jsforce=require(_0x7f3b('0xe'));var deskjs=require(_0x7f3b('0xf'));var toCsv=require(_0x7f3b('0x10'));var querystring=require(_0x7f3b('0x11'));var Papa=require(_0x7f3b('0x12'));var Redis=require(_0x7f3b('0x13'));var authService=require(_0x7f3b('0x14'));var qs=require(_0x7f3b('0x15'));var as=require(_0x7f3b('0x16'));var hardwareService=require(_0x7f3b('0x17'));var logger=require(_0x7f3b('0x18'))(_0x7f3b('0x19'));var utils=require(_0x7f3b('0x1a'));var config=require(_0x7f3b('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x193577,_0x560cf4){_0x560cf4=_0x560cf4||0xcc;return function(_0xbd9e61){if(_0xbd9e61){return _0x193577['sendStatus'](_0x560cf4);}return _0x193577[_0x7f3b('0x1c')](_0x560cf4)[_0x7f3b('0x1d')]();};}function respondWithResult(_0xb3fcc,_0x2ecef3){_0x2ecef3=_0x2ecef3||0xc8;return function(_0xef733a){if(_0xef733a){return _0xb3fcc[_0x7f3b('0x1c')](_0x2ecef3)[_0x7f3b('0x1e')](_0xef733a);}};}function respondWithFilteredResult(_0x51c227,_0x8c2469){return function(_0x163996){if(_0x163996){var _0x2bdbcb=typeof _0x8c2469[_0x7f3b('0x1f')]===_0x7f3b('0x20')&&typeof _0x8c2469['limit']===_0x7f3b('0x20');var _0x12cc03=_0x163996[_0x7f3b('0x21')];var _0x35f240=_0x2bdbcb?0x0:_0x8c2469[_0x7f3b('0x1f')];var _0x35fe15=_0x2bdbcb?_0x163996['count']:_0x8c2469[_0x7f3b('0x1f')]+_0x8c2469[_0x7f3b('0x22')];var _0x5f0769;if(_0x35fe15>=_0x12cc03){_0x35fe15=_0x12cc03;_0x5f0769=0xc8;}else{_0x5f0769=0xce;}_0x51c227['status'](_0x5f0769);return _0x51c227['set'](_0x7f3b('0x23'),_0x35f240+'-'+_0x35fe15+'/'+_0x12cc03)[_0x7f3b('0x1e')](_0x163996);}return null;};}function patchUpdates(_0x27111b){return function(_0x1c7c00){try{jsonpatch[_0x7f3b('0x24')](_0x1c7c00,_0x27111b,!![]);}catch(_0x4a939d){return BPromise['reject'](_0x4a939d);}return _0x1c7c00['save']();};}function saveUpdates(_0x4fc2f0,_0x50cf2f){return function(_0x5170f3){if(_0x5170f3){return _0x5170f3[_0x7f3b('0x25')](_0x4fc2f0)[_0x7f3b('0x26')](function(_0x3dcb71){return _0x3dcb71;});}return null;};}function removeEntity(_0x36d152,_0x440218){return function(_0x431d94){if(_0x431d94){return _0x431d94[_0x7f3b('0x27')]()[_0x7f3b('0x26')](function(){_0x36d152[_0x7f3b('0x1c')](0xcc)[_0x7f3b('0x1d')]();});}};}function handleEntityNotFound(_0x423648,_0xaa5e3){return function(_0x2e8e97){if(!_0x2e8e97){_0x423648[_0x7f3b('0x28')](0x194);}return _0x2e8e97;};}function handleError(_0x153d92,_0x252d32){_0x252d32=_0x252d32||0x1f4;return function(_0x3aaf4e){logger[_0x7f3b('0x29')](_0x3aaf4e[_0x7f3b('0x2a')]);if(_0x3aaf4e[_0x7f3b('0x2b')]){delete _0x3aaf4e[_0x7f3b('0x2b')];}_0x153d92['status'](_0x252d32)['send'](_0x3aaf4e);};}exports[_0x7f3b('0x2c')]=function(_0x416f2f,_0x2a2b1f){var _0x2f0c1d={},_0x5a51d6={},_0x2a125d={'count':0x0,'rows':[]};var _0x9bee51=_['map'](db[_0x7f3b('0x2d')][_0x7f3b('0x2e')],function(_0x368c35){return{'name':_0x368c35[_0x7f3b('0x2f')],'type':_0x368c35['type'][_0x7f3b('0x30')]};});_0x5a51d6[_0x7f3b('0x31')]=_[_0x7f3b('0x32')](_0x9bee51,_0x7f3b('0x2b'));_0x5a51d6[_0x7f3b('0x33')]=_[_0x7f3b('0x34')](_0x416f2f[_0x7f3b('0x33')]);_0x5a51d6[_0x7f3b('0x35')]=_[_0x7f3b('0x36')](_0x5a51d6[_0x7f3b('0x31')],_0x5a51d6[_0x7f3b('0x33')]);_0x2f0c1d[_0x7f3b('0x37')]=_['intersection'](_0x5a51d6[_0x7f3b('0x31')],qs[_0x7f3b('0x38')](_0x416f2f[_0x7f3b('0x33')]['fields']));_0x2f0c1d[_0x7f3b('0x37')]=_0x2f0c1d[_0x7f3b('0x37')]['length']?_0x2f0c1d['attributes']:_0x5a51d6[_0x7f3b('0x31')];if(!_0x416f2f[_0x7f3b('0x33')][_0x7f3b('0x39')]('nolimit')){_0x2f0c1d['limit']=qs['limit'](_0x416f2f['query']['limit']);_0x2f0c1d['offset']=qs[_0x7f3b('0x1f')](_0x416f2f[_0x7f3b('0x33')][_0x7f3b('0x1f')]);}_0x2f0c1d[_0x7f3b('0x3a')]=qs[_0x7f3b('0x3b')](_0x416f2f[_0x7f3b('0x33')][_0x7f3b('0x3b')]);_0x2f0c1d['where']=qs[_0x7f3b('0x35')](_[_0x7f3b('0x3c')](_0x416f2f[_0x7f3b('0x33')],_0x5a51d6[_0x7f3b('0x35')]),_0x9bee51);if(_0x416f2f['query'][_0x7f3b('0x3d')]){_0x2f0c1d[_0x7f3b('0x3e')]=_['merge'](_0x2f0c1d[_0x7f3b('0x3e')],{'$or':_[_0x7f3b('0x32')](_0x9bee51,function(_0x3e2b68){if(_0x3e2b68[_0x7f3b('0x3f')]!=='VIRTUAL'){var _0x54f565={};_0x54f565[_0x3e2b68[_0x7f3b('0x2b')]]={'$like':'%'+_0x416f2f[_0x7f3b('0x33')][_0x7f3b('0x3d')]+'%'};return _0x54f565;}})});}_0x2f0c1d=_[_0x7f3b('0x40')]({},_0x2f0c1d,_0x416f2f[_0x7f3b('0x41')]);var _0x4aa3f8={'where':_0x2f0c1d[_0x7f3b('0x3e')]};return db[_0x7f3b('0x2d')]['count'](_0x4aa3f8)['then'](function(_0x47f398){_0x2a125d['count']=_0x47f398;if(_0x416f2f[_0x7f3b('0x33')][_0x7f3b('0x42')]){_0x2f0c1d['include']=[{'all':!![]}];}return db[_0x7f3b('0x2d')][_0x7f3b('0x43')](_0x2f0c1d);})[_0x7f3b('0x26')](function(_0x459dc5){_0x2a125d[_0x7f3b('0x44')]=_0x459dc5;return _0x2a125d;})[_0x7f3b('0x26')](respondWithFilteredResult(_0x2a2b1f,_0x2f0c1d))[_0x7f3b('0x45')](handleError(_0x2a2b1f,null));};exports[_0x7f3b('0x46')]=function(_0x322fa6,_0x4ba17a){var _0x45ce52={'raw':!![],'where':{'id':_0x322fa6['params']['id']}},_0x1fb68e={};_0x1fb68e[_0x7f3b('0x31')]=_[_0x7f3b('0x34')](db[_0x7f3b('0x2d')][_0x7f3b('0x2e')]);_0x1fb68e[_0x7f3b('0x33')]=_[_0x7f3b('0x34')](_0x322fa6['query']);_0x1fb68e['filters']=_['intersection'](_0x1fb68e[_0x7f3b('0x31')],_0x1fb68e[_0x7f3b('0x33')]);_0x45ce52[_0x7f3b('0x37')]=_[_0x7f3b('0x36')](_0x1fb68e['model'],qs[_0x7f3b('0x38')](_0x322fa6[_0x7f3b('0x33')]['fields']));_0x45ce52[_0x7f3b('0x37')]=_0x45ce52[_0x7f3b('0x37')][_0x7f3b('0x47')]?_0x45ce52[_0x7f3b('0x37')]:_0x1fb68e[_0x7f3b('0x31')];if(_0x322fa6[_0x7f3b('0x33')][_0x7f3b('0x42')]){_0x45ce52['include']=[{'all':!![]}];}_0x45ce52=_[_0x7f3b('0x40')]({},_0x45ce52,_0x322fa6['options']);return db[_0x7f3b('0x2d')]['find'](_0x45ce52)[_0x7f3b('0x26')](handleEntityNotFound(_0x4ba17a,null))[_0x7f3b('0x26')](respondWithResult(_0x4ba17a,null))[_0x7f3b('0x45')](handleError(_0x4ba17a,null));};exports[_0x7f3b('0x48')]=function(_0x564913,_0x2835c7){return db[_0x7f3b('0x2d')][_0x7f3b('0x48')](_0x564913[_0x7f3b('0x49')],{})[_0x7f3b('0x26')](respondWithResult(_0x2835c7,0xc9))['catch'](handleError(_0x2835c7,null));};exports[_0x7f3b('0x25')]=function(_0x44a945,_0x2765fe){if(_0x44a945[_0x7f3b('0x49')]['id']){delete _0x44a945[_0x7f3b('0x49')]['id'];}return db['ZohoField'][_0x7f3b('0x4a')]({'where':{'id':_0x44a945[_0x7f3b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2765fe,null))[_0x7f3b('0x26')](saveUpdates(_0x44a945['body'],null))[_0x7f3b('0x26')](respondWithResult(_0x2765fe,null))[_0x7f3b('0x45')](handleError(_0x2765fe,null));};exports['destroy']=function(_0x357ae2,_0x5cebbc){return db[_0x7f3b('0x2d')][_0x7f3b('0x4a')]({'where':{'id':_0x357ae2[_0x7f3b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5cebbc,null))['then'](removeEntity(_0x5cebbc,null))[_0x7f3b('0x45')](handleError(_0x5cebbc,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index cb14ee1..b584f8b 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 _0xd046=['util','../../config/logger','api','bluebird','rimraf','./intZohoField.attributes','define','zoho_unique_index','idField'];(function(_0x43a983,_0x481cec){var _0xde9fca=function(_0x14a992){while(--_0x14a992){_0x43a983['push'](_0x43a983['shift']());}};_0xde9fca(++_0x481cec);}(_0xd046,0x129));var _0x6d04=function(_0x5e1e77,_0x2a8dc5){_0x5e1e77=_0x5e1e77-0x0;var _0x31d8f0=_0xd046[_0x5e1e77];return _0x31d8f0;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var logger=require(_0x6d04('0x1'))(_0x6d04('0x2'));var moment=require('moment');var BPromise=require(_0x6d04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d04('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d04('0x5'));module['exports']=function(_0x4bacb1,_0xf3b4e7){return _0x4bacb1[_0x6d04('0x6')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x6d04('0x7'),'fields':[_0x6d04('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe5af=['zoho_unique_index','idField','util','../../config/logger','moment','bluebird','request-promise','rimraf','exports','ZohoField','int_zoho_fields'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe5af,0x9c));var _0xfe5a=function(_0x2db906,_0x1796cb){_0x2db906=_0x2db906-0x0;var _0x4f796c=_0xe5af[_0x2db906];return _0x4f796c;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0xfe5a('0x6')]=function(_0x2039cd,_0x4e418f){return _0x2039cd['define'](_0xfe5a('0x7'),attributes,{'tableName':_0xfe5a('0x8'),'paranoid':![],'indexes':[{'name':_0xfe5a('0x9'),'fields':[_0xfe5a('0xa'),'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 b10592e..dee7534 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 _0x6a6a=['code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3638fa,_0x4bae8f){var _0xc818a7=function(_0x49fd1c){while(--_0x49fd1c){_0x3638fa['push'](_0x3638fa['shift']());}};_0xc818a7(++_0x4bae8f);}(_0x6a6a,0x1d1));var _0xa6a6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6a6a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa6a6('0x0'));var util=require(_0xa6a6('0x1'));var moment=require(_0xa6a6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6a6('0x3'));var db=require(_0xa6a6('0x4'))['db'];var utils=require(_0xa6a6('0x5'));var logger=require(_0xa6a6('0x6'))(_0xa6a6('0x7'));var config=require(_0xa6a6('0x8'));var jayson=require(_0xa6a6('0x9'));var client=jayson[_0xa6a6('0xa')][_0xa6a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2aa2,_0x385a11,_0x4dbf0f){return new BPromise(function(_0x213e68,_0x405856){return client[_0xa6a6('0xc')](_0x2f2aa2,_0x4dbf0f)['then'](function(_0x450cbe){logger[_0xa6a6('0xd')](_0xa6a6('0xe'),_0x385a11,_0xa6a6('0xf'));logger['debug'](_0xa6a6('0x10'),_0x385a11,_0xa6a6('0xf'),JSON[_0xa6a6('0x11')](_0x450cbe));if(_0x450cbe[_0xa6a6('0x12')]){if(_0x450cbe[_0xa6a6('0x12')][_0xa6a6('0x13')]===0x1f4){logger[_0xa6a6('0x12')](_0xa6a6('0xe'),_0x385a11,_0x450cbe[_0xa6a6('0x12')][_0xa6a6('0x14')]);return _0x405856(_0x450cbe[_0xa6a6('0x12')][_0xa6a6('0x14')]);}logger['error'](_0xa6a6('0xe'),_0x385a11,_0x450cbe[_0xa6a6('0x12')][_0xa6a6('0x14')]);return _0x213e68(_0x450cbe[_0xa6a6('0x12')][_0xa6a6('0x14')]);}else{logger[_0xa6a6('0xd')](_0xa6a6('0xe'),_0x385a11,_0xa6a6('0xf'));_0x213e68(_0x450cbe[_0xa6a6('0x15')]['message']);}})['catch'](function(_0xcc6f10){logger[_0xa6a6('0x12')](_0xa6a6('0xe'),_0x385a11,_0xcc6f10);_0x405856(_0xcc6f10);});});} \ No newline at end of file +var _0x41b9=['message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','info','debug','request\x20sent','error','code','ZohoField,\x20%s,\x20%s'];(function(_0x400d89,_0x19fc47){var _0x3b214b=function(_0x209f06){while(--_0x209f06){_0x400d89['push'](_0x400d89['shift']());}};_0x3b214b(++_0x19fc47);}(_0x41b9,0xa3));var _0x941b=function(_0x1a5721,_0x1e1ff1){_0x1a5721=_0x1a5721-0x0;var _0x16cb24=_0x41b9[_0x1a5721];return _0x16cb24;};'use strict';var _=require(_0x941b('0x0'));var util=require(_0x941b('0x1'));var moment=require(_0x941b('0x2'));var BPromise=require(_0x941b('0x3'));var rs=require(_0x941b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x941b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x941b('0x6'))(_0x941b('0x7'));var config=require('../../config/environment');var jayson=require(_0x941b('0x8'));var client=jayson[_0x941b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2929c4,_0x242eb4,_0x541274){return new BPromise(function(_0x56e168,_0x7d79e2){return client['request'](_0x2929c4,_0x541274)[_0x941b('0xa')](function(_0x593974){logger[_0x941b('0xb')]('ZohoField,\x20%s,\x20%s',_0x242eb4,'request\x20sent');logger[_0x941b('0xc')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x242eb4,_0x941b('0xd'),JSON['stringify'](_0x593974));if(_0x593974[_0x941b('0xe')]){if(_0x593974[_0x941b('0xe')][_0x941b('0xf')]===0x1f4){logger[_0x941b('0xe')](_0x941b('0x10'),_0x242eb4,_0x593974[_0x941b('0xe')]['message']);return _0x7d79e2(_0x593974[_0x941b('0xe')]['message']);}logger['error'](_0x941b('0x10'),_0x242eb4,_0x593974[_0x941b('0xe')]['message']);return _0x56e168(_0x593974[_0x941b('0xe')][_0x941b('0x11')]);}else{logger[_0x941b('0xb')](_0x941b('0x10'),_0x242eb4,_0x941b('0xd'));_0x56e168(_0x593974['result'][_0x941b('0x11')]);}})['catch'](function(_0x3d7ba8){logger[_0x941b('0xe')](_0x941b('0x10'),_0x242eb4,_0x3d7ba8);_0x7d79e2(_0x3d7ba8);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 16f6eab..50f59cf 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x7d029a,_0x8c1545){var _0x3d86f9=function(_0x547740){while(--_0x547740){_0x7d029a['push'](_0x7d029a['shift']());}};_0x3d86f9(++_0x8c1545);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0xcb91[_0x3cc9d9];return _0x1a425d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x28b482,_0x1dd3bb){var _0x2231eb=function(_0x57a505){while(--_0x57a505){_0x28b482['push'](_0x28b482['shift']());}};_0x2231eb(++_0x1dd3bb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0xcb91[_0x57e00e];return _0x415e60;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index a85321b..d783150 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 _0xc411=['BOOLEAN','state','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc411,0x1b4));var _0x1c41=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0xc411[_0x548200];return _0x1a6d74;};'use strict';var Sequelize=require('sequelize');module[_0x1c41('0x0')]={'name':{'type':Sequelize[_0x1c41('0x1')],'allowNull':![],'unique':_0x1c41('0x2')},'version':{'type':Sequelize[_0x1c41('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x1c41('0x1')],'defaultValue':_0x1c41('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x1c41('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x1c41('0x4')]},'active':{'type':Sequelize[_0x1c41('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x1c41('0x1')]},'logo':{'type':Sequelize[_0x1c41('0x1')]},'state':{'type':Sequelize[_0x1c41('0x1')],'unique':_0x1c41('0x6')},'description':{'type':Sequelize[_0x1c41('0x1')]},'title':{'type':Sequelize[_0x1c41('0x1')]},'remoteUri':{'type':Sequelize[_0x1c41('0x1')]},'link':{'type':Sequelize[_0x1c41('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xc3a1=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','exports','STRING'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xc3a1,0x11d));var _0x1c3a=function(_0x6e1cba,_0x104993){_0x6e1cba=_0x6e1cba-0x0;var _0x5b4611=_0xc3a1[_0x6e1cba];return _0x5b4611;};'use strict';var Sequelize=require('sequelize');module[_0x1c3a('0x0')]={'name':{'type':Sequelize[_0x1c3a('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1c3a('0x2')},'main':{'type':Sequelize[_0x1c3a('0x1')],'defaultValue':_0x1c3a('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x1c3a('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x1c3a('0x4')]},'active':{'type':Sequelize[_0x1c3a('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x1c3a('0x1')]},'logo':{'type':Sequelize[_0x1c3a('0x1')]},'state':{'type':Sequelize[_0x1c3a('0x1')],'unique':_0x1c3a('0x6')},'description':{'type':Sequelize[_0x1c3a('0x1')]},'title':{'type':Sequelize[_0x1c3a('0x1')]},'remoteUri':{'type':Sequelize[_0x1c3a('0x1')]},'link':{'type':Sequelize[_0x1c3a('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 f14856d..66f2767 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 _0x33af=['merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where'];(function(_0x5ba6a2,_0x1127e6){var _0x54e1ab=function(_0x2d0acd){while(--_0x2d0acd){_0x5ba6a2['push'](_0x5ba6a2['shift']());}};_0x54e1ab(++_0x1127e6);}(_0x33af,0xec));var _0xf33a=function(_0x2fad8a,_0x26de69){_0x2fad8a=_0x2fad8a-0x0;var _0x494d7d=_0x33af[_0x2fad8a];return _0x494d7d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf33a('0x1'));var rp=require(_0xf33a('0x2'));var moment=require(_0xf33a('0x3'));var BPromise=require(_0xf33a('0x4'));var Mustache=require(_0xf33a('0x5'));var util=require(_0xf33a('0x6'));var path=require('path');var sox=require(_0xf33a('0x7'));var csv=require(_0xf33a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf33a('0x9'));var _=require(_0xf33a('0xa'));var squel=require(_0xf33a('0xb'));var crypto=require(_0xf33a('0xc'));var jsforce=require(_0xf33a('0xd'));var deskjs=require(_0xf33a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf33a('0xf'));var Papa=require(_0xf33a('0x10'));var Redis=require(_0xf33a('0x11'));var authService=require(_0xf33a('0x12'));var qs=require(_0xf33a('0x13'));var as=require(_0xf33a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf33a('0x15'));var utils=require(_0xf33a('0x16'));var config=require(_0xf33a('0x17'));var licenseUtil=require(_0xf33a('0x18'));var db=require(_0xf33a('0x19'))['db'];function respondWithStatusCode(_0x5959c9,_0x9f87bc){_0x9f87bc=_0x9f87bc||0xcc;return function(_0x21b80e){if(_0x21b80e){return _0x5959c9['sendStatus'](_0x9f87bc);}return _0x5959c9['status'](_0x9f87bc)[_0xf33a('0x1a')]();};}function respondWithResult(_0x1b3bf0,_0x17043){_0x17043=_0x17043||0xc8;return function(_0x153bda){if(_0x153bda){return _0x1b3bf0[_0xf33a('0x1b')](_0x17043)[_0xf33a('0x1c')](_0x153bda);}};}function respondWithFilteredResult(_0x45e311,_0x1f2b1b){return function(_0x507cb9){if(_0x507cb9){var _0x441f59=typeof _0x1f2b1b['offset']===_0xf33a('0x1d')&&typeof _0x1f2b1b[_0xf33a('0x1e')]==='undefined';var _0x37e76c=_0x507cb9[_0xf33a('0x1f')];var _0x524109=_0x441f59?0x0:_0x1f2b1b[_0xf33a('0x20')];var _0x23d9e2=_0x441f59?_0x507cb9[_0xf33a('0x1f')]:_0x1f2b1b[_0xf33a('0x20')]+_0x1f2b1b['limit'];var _0x11efa0;if(_0x23d9e2>=_0x37e76c){_0x23d9e2=_0x37e76c;_0x11efa0=0xc8;}else{_0x11efa0=0xce;}_0x45e311[_0xf33a('0x1b')](_0x11efa0);return _0x45e311[_0xf33a('0x21')](_0xf33a('0x22'),_0x524109+'-'+_0x23d9e2+'/'+_0x37e76c)[_0xf33a('0x1c')](_0x507cb9);}return null;};}function patchUpdates(_0x6cdf7b){return function(_0x19986f){try{jsonpatch[_0xf33a('0x23')](_0x19986f,_0x6cdf7b,!![]);}catch(_0x19055e){return BPromise[_0xf33a('0x24')](_0x19055e);}return _0x19986f['save']();};}function saveUpdates(_0x3854b4,_0x272e60){return function(_0x1bf9bc){if(_0x1bf9bc){return _0x1bf9bc[_0xf33a('0x25')](_0x3854b4)[_0xf33a('0x26')](function(_0x51d3fd){return _0x51d3fd;});}return null;};}function removeEntity(_0x44654c,_0x5882ba){return function(_0x492986){if(_0x492986){return _0x492986[_0xf33a('0x27')]()[_0xf33a('0x26')](function(){_0x44654c[_0xf33a('0x1b')](0xcc)[_0xf33a('0x1a')]();});}};}function handleEntityNotFound(_0x4b9801,_0x57cb1d){return function(_0x393005){if(!_0x393005){_0x4b9801['sendStatus'](0x194);}return _0x393005;};}function handleError(_0x4af24a,_0x16ef31){_0x16ef31=_0x16ef31||0x1f4;return function(_0x5f0a53){logger['error'](_0x5f0a53[_0xf33a('0x28')]);if(_0x5f0a53['name']){delete _0x5f0a53[_0xf33a('0x29')];}_0x4af24a['status'](_0x16ef31)[_0xf33a('0x2a')](_0x5f0a53);};}exports[_0xf33a('0x2b')]=function(_0x469741,_0x729fca){var _0x4552c9={},_0x3068a9={},_0x1d19ee={'count':0x0,'rows':[]};var _0x1246ff=_[_0xf33a('0x2c')](db[_0xf33a('0x2d')][_0xf33a('0x2e')],function(_0x8f8ddc){return{'name':_0x8f8ddc[_0xf33a('0x2f')],'type':_0x8f8ddc[_0xf33a('0x30')][_0xf33a('0x31')]};});_0x3068a9['model']=_[_0xf33a('0x2c')](_0x1246ff,_0xf33a('0x29'));_0x3068a9[_0xf33a('0x32')]=_[_0xf33a('0x33')](_0x469741['query']);_0x3068a9[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x3068a9[_0xf33a('0x36')],_0x3068a9[_0xf33a('0x32')]);_0x4552c9[_0xf33a('0x37')]=_[_0xf33a('0x35')](_0x3068a9['model'],qs[_0xf33a('0x38')](_0x469741[_0xf33a('0x32')][_0xf33a('0x38')]));_0x4552c9[_0xf33a('0x37')]=_0x4552c9[_0xf33a('0x37')]['length']?_0x4552c9['attributes']:_0x3068a9[_0xf33a('0x36')];if(!_0x469741['query']['hasOwnProperty']('nolimit')){_0x4552c9[_0xf33a('0x1e')]=qs[_0xf33a('0x1e')](_0x469741['query'][_0xf33a('0x1e')]);_0x4552c9['offset']=qs[_0xf33a('0x20')](_0x469741[_0xf33a('0x32')][_0xf33a('0x20')]);}_0x4552c9[_0xf33a('0x39')]=qs[_0xf33a('0x3a')](_0x469741[_0xf33a('0x32')]['sort']);_0x4552c9[_0xf33a('0x3b')]=qs[_0xf33a('0x34')](_['pick'](_0x469741[_0xf33a('0x32')],_0x3068a9[_0xf33a('0x34')]),_0x1246ff);if(_0x469741[_0xf33a('0x32')]['filter']){_0x4552c9[_0xf33a('0x3b')]=_[_0xf33a('0x3c')](_0x4552c9[_0xf33a('0x3b')],{'$or':_[_0xf33a('0x2c')](_0x1246ff,function(_0x3ec562){if(_0x3ec562[_0xf33a('0x30')]!==_0xf33a('0x3d')){var _0x128baf={};_0x128baf[_0x3ec562[_0xf33a('0x29')]]={'$like':'%'+_0x469741['query'][_0xf33a('0x3e')]+'%'};return _0x128baf;}})});}_0x4552c9=_[_0xf33a('0x3c')]({},_0x4552c9,_0x469741['options']);var _0x1e8800={'where':_0x4552c9['where']};return db['Integration'][_0xf33a('0x1f')](_0x1e8800)[_0xf33a('0x26')](function(_0x4dada1){_0x1d19ee[_0xf33a('0x1f')]=_0x4dada1;if(_0x469741[_0xf33a('0x32')][_0xf33a('0x3f')]){_0x4552c9['include']=[{'all':!![]}];}return db[_0xf33a('0x2d')][_0xf33a('0x40')](_0x4552c9);})['then'](function(_0x1e9748){_0x1d19ee[_0xf33a('0x41')]=_0x1e9748;return _0x1d19ee;})[_0xf33a('0x26')](respondWithFilteredResult(_0x729fca,_0x4552c9))[_0xf33a('0x42')](handleError(_0x729fca,null));};exports[_0xf33a('0x43')]=function(_0x5044f9,_0x45ae15){var _0x1722e5={'raw':![],'where':{'id':_0x5044f9[_0xf33a('0x44')]['id']}},_0x2325eb={};_0x2325eb[_0xf33a('0x36')]=_['keys'](db[_0xf33a('0x2d')][_0xf33a('0x2e')]);_0x2325eb[_0xf33a('0x32')]=_['keys'](_0x5044f9[_0xf33a('0x32')]);_0x2325eb[_0xf33a('0x34')]=_[_0xf33a('0x35')](_0x2325eb[_0xf33a('0x36')],_0x2325eb[_0xf33a('0x32')]);_0x1722e5[_0xf33a('0x37')]=_['intersection'](_0x2325eb[_0xf33a('0x36')],qs[_0xf33a('0x38')](_0x5044f9[_0xf33a('0x32')][_0xf33a('0x38')]));_0x1722e5[_0xf33a('0x37')]=_0x1722e5['attributes'][_0xf33a('0x45')]?_0x1722e5[_0xf33a('0x37')]:_0x2325eb[_0xf33a('0x36')];if(_0x5044f9['query'][_0xf33a('0x3f')]){_0x1722e5[_0xf33a('0x46')]=[{'all':!![]}];}_0x1722e5=_['merge']({},_0x1722e5,_0x5044f9['options']);return db[_0xf33a('0x2d')]['find'](_0x1722e5)[_0xf33a('0x26')](handleEntityNotFound(_0x45ae15,null))[_0xf33a('0x26')](respondWithResult(_0x45ae15,null))[_0xf33a('0x42')](handleError(_0x45ae15,null));};exports[_0xf33a('0x47')]=function(_0xecc82f,_0x1a98f9){return db[_0xf33a('0x2d')][_0xf33a('0x47')](_0xecc82f[_0xf33a('0x48')],{})[_0xf33a('0x26')](respondWithResult(_0x1a98f9,0xc9))[_0xf33a('0x42')](handleError(_0x1a98f9,null));};exports[_0xf33a('0x25')]=function(_0x190a2b,_0x6b79da){if(_0x190a2b[_0xf33a('0x48')]['id']){delete _0x190a2b[_0xf33a('0x48')]['id'];}return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x190a2b[_0xf33a('0x44')]['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x6b79da,null))[_0xf33a('0x26')](saveUpdates(_0x190a2b[_0xf33a('0x48')],null))[_0xf33a('0x26')](respondWithResult(_0x6b79da,null))[_0xf33a('0x42')](handleError(_0x6b79da,null));};exports[_0xf33a('0x27')]=function(_0x1b15a1,_0x3bab07){return db[_0xf33a('0x2d')][_0xf33a('0x49')]({'where':{'id':_0x1b15a1['params']['id']}})[_0xf33a('0x26')](handleEntityNotFound(_0x3bab07,null))[_0xf33a('0x26')](removeEntity(_0x3bab07,null))['catch'](handleError(_0x3bab07,null));}; \ No newline at end of file +var _0x687b=['order','sort','where','filter','VIRTUAL','options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x5dcca6,_0x1672e8){var _0x178cae=function(_0x3f2ef0){while(--_0x3f2ef0){_0x5dcca6['push'](_0x5dcca6['shift']());}};_0x178cae(++_0x1672e8);}(_0x687b,0x14a));var _0xb687=function(_0x1d6b55,_0x43ab65){_0x1d6b55=_0x1d6b55-0x0;var _0x1751f9=_0x687b[_0x1d6b55];return _0x1751f9;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['Integration'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['Integration']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 20dd229..9395f32 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 _0x6695=['api','moment','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','Integration','integrations','util','../../config/logger'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6695,0x1de));var _0x5669=function(_0x5e06bc,_0x29e56f){_0x5e06bc=_0x5e06bc-0x0;var _0x54b56c=_0x6695[_0x5e06bc];return _0x54b56c;};'use strict';var _=require('lodash');var util=require(_0x5669('0x0'));var logger=require(_0x5669('0x1'))(_0x5669('0x2'));var moment=require(_0x5669('0x3'));var BPromise=require('bluebird');var rp=require(_0x5669('0x4'));var fs=require('fs');var path=require(_0x5669('0x5'));var rimraf=require(_0x5669('0x6'));var config=require(_0x5669('0x7'));var attributes=require(_0x5669('0x8'));module[_0x5669('0x9')]=function(_0x432a83,_0x2d0ee6){return _0x432a83['define'](_0x5669('0xa'),attributes,{'tableName':_0x5669('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ae9=['request-promise','path','rimraf','../../config/environment','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x501f77,_0x20a190){var _0x106983=function(_0xeab5ae){while(--_0xeab5ae){_0x501f77['push'](_0x501f77['shift']());}};_0x106983(++_0x20a190);}(_0x5ae9,0x12e));var _0x95ae=function(_0x3d9ba7,_0x1c8b5f){_0x3d9ba7=_0x3d9ba7-0x0;var _0x4621ce=_0x5ae9[_0x3d9ba7];return _0x4621ce;};'use strict';var _=require(_0x95ae('0x0'));var util=require(_0x95ae('0x1'));var logger=require(_0x95ae('0x2'))(_0x95ae('0x3'));var moment=require(_0x95ae('0x4'));var BPromise=require(_0x95ae('0x5'));var rp=require(_0x95ae('0x6'));var fs=require('fs');var path=require(_0x95ae('0x7'));var rimraf=require(_0x95ae('0x8'));var config=require(_0x95ae('0x9'));var attributes=require('./integration.attributes');module[_0x95ae('0xa')]=function(_0x432af0,_0x521275){return _0x432af0[_0x95ae('0xb')](_0x95ae('0xc'),attributes,{'tableName':_0x95ae('0xd'),'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 80d9e06..ae68c39 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x3c4e4c,_0x36ff70){var _0x144a87=function(_0x5efb4b){while(--_0x5efb4b){_0x3c4e4c['push'](_0x3c4e4c['shift']());}};_0x144a87(++_0x36ff70);}(_0x4137,0xf8));var _0x7413=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4137[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('Integration,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x5ab2a1,_0x43fb68){var _0x1dc11=function(_0x38e788){while(--_0x38e788){_0x5ab2a1['push'](_0x5ab2a1['shift']());}};_0x1dc11(++_0x43fb68);}(_0x66fa,0x117));var _0xa66f=function(_0x55bfa1,_0x4c850d){_0x55bfa1=_0x55bfa1-0x0;var _0x368f26=_0x66fa[_0x55bfa1];return _0x368f26;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('Integration,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('Integration,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 79f1538..9577477 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 _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x4e822a,_0x21f15e){var _0x5908df=function(_0x376724){while(--_0x376724){_0x4e822a['push'](_0x4e822a['shift']());}};_0x5908df(++_0x21f15e);}(_0x2ef3,0xba));var _0x32ef=function(_0x424a6f,_0x1d77d2){_0x424a6f=_0x424a6f-0x0;var _0x1d5350=_0x2ef3[_0x424a6f];return _0x1d5350;};'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('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file +var _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x3ace4f,_0x32ef5b){var _0x23b09b=function(_0xa81ada){while(--_0xa81ada){_0x3ace4f['push'](_0x3ace4f['shift']());}};_0x23b09b(++_0x32ef5b);}(_0x7a54,0x106));var _0x47a5=function(_0x2b30d4,_0x515a34){_0x2b30d4=_0x2b30d4-0x0;var _0x1c43e0=_0x7a54[_0x2b30d4];return _0x1c43e0;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('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 7cf95fa..bf923d0 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 _0x3d92=['BOOLEAN','TEXT','ENUM','RECEIVED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x21df03,_0x543518){var _0x2b2d42=function(_0x42d00e){while(--_0x42d00e){_0x21df03['push'](_0x21df03['shift']());}};_0x2b2d42(++_0x543518);}(_0x3d92,0xca));var _0x23d9=function(_0x54da5b,_0x12fd71){_0x54da5b=_0x54da5b-0x0;var _0x285d3b=_0x3d92[_0x54da5b];return _0x285d3b;};'use strict';var Sequelize=require(_0x23d9('0x0'));module[_0x23d9('0x1')]={'integration':{'type':Sequelize[_0x23d9('0x2')]},'eventChannel':{'type':Sequelize[_0x23d9('0x2')]},'exitStatus':{'type':Sequelize[_0x23d9('0x2')]},'ticketId':{'type':Sequelize[_0x23d9('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x23d9('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x23d9('0x2')]},'calleridname':{'type':Sequelize[_0x23d9('0x2')]},'queue':{'type':Sequelize[_0x23d9('0x2')]},'interface':{'type':Sequelize[_0x23d9('0x2')]},'membername':{'type':Sequelize[_0x23d9('0x2')]},'agentcalledAt':{'type':Sequelize[_0x23d9('0x3')]},'agentconnectAt':{'type':Sequelize[_0x23d9('0x3')]},'holdtime':{'type':Sequelize[_0x23d9('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x23d9('0x3')]},'talktime':{'type':Sequelize[_0x23d9('0x4')]},'agentacw':{'type':Sequelize[_0x23d9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x23d9('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x23d9('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x23d9('0x3')]},'agentdump':{'type':Sequelize[_0x23d9('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x23d9('0x2')]},'channel':{'type':Sequelize[_0x23d9('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x23d9('0x2')]},'connectedlinename':{'type':Sequelize[_0x23d9('0x2')]},'language':{'type':Sequelize[_0x23d9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x23d9('0x2')]},'priority':{'type':Sequelize[_0x23d9('0x2')]},'destchannel':{'type':Sequelize[_0x23d9('0x2')]},'destchannelstate':{'type':Sequelize[_0x23d9('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x23d9('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x23d9('0x2')]},'destpriority':{'type':Sequelize[_0x23d9('0x2')]},'destuniqueid':{'type':Sequelize[_0x23d9('0x2')]},'messageId':{'type':Sequelize[_0x23d9('0x2')]},'inReplyTo':{'type':Sequelize[_0x23d9('0x2')]},'subject':{'type':Sequelize[_0x23d9('0x2')]},'from':{'type':Sequelize[_0x23d9('0x2')]},'to':{'type':Sequelize[_0x23d9('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x23d9('0x6')]},'html':{'type':Sequelize[_0x23d9('0x6')]},'text':{'type':Sequelize[_0x23d9('0x6')]},'status':{'type':Sequelize[_0x23d9('0x7')]('SENT','SENDING',_0x23d9('0x8'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x23d9('0x2')]},'appdata':{'type':Sequelize[_0x23d9('0x2')]},'projectId':{'type':Sequelize[_0x23d9('0x4')]}}; \ No newline at end of file +var _0xe539=['sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED'];(function(_0x44a59b,_0x18f8a5){var _0x5382c5=function(_0x453223){while(--_0x453223){_0x44a59b['push'](_0x44a59b['shift']());}};_0x5382c5(++_0x18f8a5);}(_0xe539,0x134));var _0x9e53=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xe539[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0x9e53('0x0'));module[_0x9e53('0x1')]={'integration':{'type':Sequelize[_0x9e53('0x2')]},'eventChannel':{'type':Sequelize[_0x9e53('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x9e53('0x2')]},'integrationId':{'type':Sequelize[_0x9e53('0x3')]},'contacts':{'type':Sequelize[_0x9e53('0x2')]},'uniqueid':{'type':Sequelize[_0x9e53('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9e53('0x2')]},'queue':{'type':Sequelize[_0x9e53('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9e53('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9e53('0x4')]},'agentconnectAt':{'type':Sequelize[_0x9e53('0x4')]},'holdtime':{'type':Sequelize[_0x9e53('0x3')]},'agentcomplete':{'type':Sequelize[_0x9e53('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x9e53('0x4')]},'talktime':{'type':Sequelize[_0x9e53('0x3')]},'agentacw':{'type':Sequelize[_0x9e53('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x9e53('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x9e53('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x9e53('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x9e53('0x2')]},'channel':{'type':Sequelize[_0x9e53('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x9e53('0x2')]},'connectedlinename':{'type':Sequelize[_0x9e53('0x2')]},'language':{'type':Sequelize[_0x9e53('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9e53('0x2')]},'exten':{'type':Sequelize[_0x9e53('0x2')]},'priority':{'type':Sequelize[_0x9e53('0x2')]},'destchannel':{'type':Sequelize[_0x9e53('0x2')]},'destchannelstate':{'type':Sequelize[_0x9e53('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x9e53('0x2')]},'destcalleridname':{'type':Sequelize[_0x9e53('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x9e53('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9e53('0x2')]},'destlanguage':{'type':Sequelize[_0x9e53('0x2')]},'destaccountcode':{'type':Sequelize[_0x9e53('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x9e53('0x2')]},'messageId':{'type':Sequelize[_0x9e53('0x2')]},'inReplyTo':{'type':Sequelize[_0x9e53('0x2')]},'subject':{'type':Sequelize[_0x9e53('0x2')]},'from':{'type':Sequelize[_0x9e53('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x9e53('0x6')]},'html':{'type':Sequelize[_0x9e53('0x6')]},'text':{'type':Sequelize[_0x9e53('0x6')]},'status':{'type':Sequelize[_0x9e53('0x7')]('SENT',_0x9e53('0x8'),_0x9e53('0x9'),_0x9e53('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x9e53('0x2')]},'appdata':{'type':Sequelize[_0x9e53('0x2')]},'projectId':{'type':Sequelize[_0x9e53('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 3533af4..113ec71 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 _0xc62a=['query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','key','model'];(function(_0x7461dd,_0x3866b3){var _0x4f83bf=function(_0x2cc338){while(--_0x2cc338){_0x7461dd['push'](_0x7461dd['shift']());}};_0x4f83bf(++_0x3866b3);}(_0xc62a,0x1d8));var _0xac62=function(_0x566b73,_0x552629){_0x566b73=_0x566b73-0x0;var _0x4ebfcc=_0xc62a[_0x566b73];return _0x4ebfcc;};'use strict';var emlformat=require(_0xac62('0x0'));var rimraf=require(_0xac62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac62('0x2'));var rp=require(_0xac62('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xac62('0x4'));var util=require('util');var path=require(_0xac62('0x5'));var sox=require(_0xac62('0x6'));var csv=require(_0xac62('0x7'));var ejs=require(_0xac62('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac62('0x9'));var squel=require(_0xac62('0xa'));var crypto=require(_0xac62('0xb'));var jsforce=require(_0xac62('0xc'));var deskjs=require(_0xac62('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xac62('0xe'));var authService=require(_0xac62('0xf'));var qs=require(_0xac62('0x10'));var as=require(_0xac62('0x11'));var hardwareService=require(_0xac62('0x12'));var logger=require('../../config/logger')(_0xac62('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xac62('0x14'));var db=require(_0xac62('0x15'))['db'];function respondWithStatusCode(_0x1d8fcd,_0x2249c5){_0x2249c5=_0x2249c5||0xcc;return function(_0x2df659){if(_0x2df659){return _0x1d8fcd['sendStatus'](_0x2249c5);}return _0x1d8fcd[_0xac62('0x16')](_0x2249c5)[_0xac62('0x17')]();};}function respondWithResult(_0x2606a0,_0x571063){_0x571063=_0x571063||0xc8;return function(_0x42626f){if(_0x42626f){return _0x2606a0[_0xac62('0x16')](_0x571063)[_0xac62('0x18')](_0x42626f);}};}function respondWithFilteredResult(_0x49a84f,_0x275ffb){return function(_0xe0d787){if(_0xe0d787){var _0x324d7f=typeof _0x275ffb[_0xac62('0x19')]==='undefined'&&typeof _0x275ffb['limit']===_0xac62('0x1a');var _0x5e297d=_0xe0d787[_0xac62('0x1b')];var _0xd72af9=_0x324d7f?0x0:_0x275ffb[_0xac62('0x19')];var _0x5316e7=_0x324d7f?_0xe0d787['count']:_0x275ffb[_0xac62('0x19')]+_0x275ffb['limit'];var _0x278ca2;if(_0x5316e7>=_0x5e297d){_0x5316e7=_0x5e297d;_0x278ca2=0xc8;}else{_0x278ca2=0xce;}_0x49a84f[_0xac62('0x16')](_0x278ca2);return _0x49a84f[_0xac62('0x1c')](_0xac62('0x1d'),_0xd72af9+'-'+_0x5316e7+'/'+_0x5e297d)[_0xac62('0x18')](_0xe0d787);}return null;};}function patchUpdates(_0xbcd234){return function(_0x3aa416){try{jsonpatch[_0xac62('0x1e')](_0x3aa416,_0xbcd234,!![]);}catch(_0x273d47){return BPromise[_0xac62('0x1f')](_0x273d47);}return _0x3aa416[_0xac62('0x20')]();};}function saveUpdates(_0x502044,_0x5b9ffd){return function(_0x4d6aa5){if(_0x4d6aa5){return _0x4d6aa5['update'](_0x502044)[_0xac62('0x21')](function(_0x55c029){return _0x55c029;});}return null;};}function removeEntity(_0x12b3fd,_0xa268a6){return function(_0x34d226){if(_0x34d226){return _0x34d226[_0xac62('0x22')]()[_0xac62('0x21')](function(){_0x12b3fd[_0xac62('0x16')](0xcc)[_0xac62('0x17')]();});}};}function handleEntityNotFound(_0x5f0927,_0x4d4264){return function(_0xbb7385){if(!_0xbb7385){_0x5f0927[_0xac62('0x23')](0x194);}return _0xbb7385;};}function handleError(_0x1b8c0b,_0x3da940){_0x3da940=_0x3da940||0x1f4;return function(_0x18822e){logger[_0xac62('0x24')](_0x18822e[_0xac62('0x25')]);if(_0x18822e[_0xac62('0x26')]){delete _0x18822e['name'];}_0x1b8c0b[_0xac62('0x16')](_0x3da940)['send'](_0x18822e);};}exports[_0xac62('0x27')]=function(_0x59a641,_0x1f376b){var _0x343831={},_0x37ec83={},_0x2adf92={'count':0x0,'rows':[]};var _0x4e37a7=_[_0xac62('0x28')](db[_0xac62('0x29')][_0xac62('0x2a')],function(_0x24e5f6){return{'name':_0x24e5f6[_0xac62('0x2b')],'type':_0x24e5f6['type'][_0xac62('0x2c')]};});_0x37ec83[_0xac62('0x2d')]=_[_0xac62('0x28')](_0x4e37a7,'name');_0x37ec83[_0xac62('0x2e')]=_['keys'](_0x59a641['query']);_0x37ec83[_0xac62('0x2f')]=_[_0xac62('0x30')](_0x37ec83[_0xac62('0x2d')],_0x37ec83[_0xac62('0x2e')]);_0x343831[_0xac62('0x31')]=_[_0xac62('0x30')](_0x37ec83[_0xac62('0x2d')],qs[_0xac62('0x32')](_0x59a641[_0xac62('0x2e')][_0xac62('0x32')]));_0x343831[_0xac62('0x31')]=_0x343831[_0xac62('0x31')][_0xac62('0x33')]?_0x343831[_0xac62('0x31')]:_0x37ec83[_0xac62('0x2d')];if(!_0x59a641[_0xac62('0x2e')]['hasOwnProperty'](_0xac62('0x34'))){_0x343831[_0xac62('0x35')]=qs['limit'](_0x59a641[_0xac62('0x2e')][_0xac62('0x35')]);_0x343831[_0xac62('0x19')]=qs['offset'](_0x59a641[_0xac62('0x2e')]['offset']);}_0x343831[_0xac62('0x36')]=qs['sort'](_0x59a641[_0xac62('0x2e')][_0xac62('0x37')]);_0x343831[_0xac62('0x38')]=qs[_0xac62('0x2f')](_[_0xac62('0x39')](_0x59a641[_0xac62('0x2e')],_0x37ec83[_0xac62('0x2f')]),_0x4e37a7);if(_0x59a641[_0xac62('0x2e')][_0xac62('0x3a')]){_0x343831[_0xac62('0x38')]=_[_0xac62('0x3b')](_0x343831[_0xac62('0x38')],{'$or':_[_0xac62('0x28')](_0x4e37a7,function(_0x3f0d67){if(_0x3f0d67[_0xac62('0x3c')]!==_0xac62('0x3d')){var _0x2f1ab={};_0x2f1ab[_0x3f0d67[_0xac62('0x26')]]={'$like':'%'+_0x59a641['query'][_0xac62('0x3a')]+'%'};return _0x2f1ab;}})});}_0x343831=_[_0xac62('0x3b')]({},_0x343831,_0x59a641['options']);var _0xace0db={'where':_0x343831[_0xac62('0x38')]};return db['IntegrationReport'][_0xac62('0x1b')](_0xace0db)[_0xac62('0x21')](function(_0x556f5e){_0x2adf92[_0xac62('0x1b')]=_0x556f5e;if(_0x59a641[_0xac62('0x2e')]['includeAll']){_0x343831[_0xac62('0x3e')]=[{'all':!![]}];}return db['IntegrationReport'][_0xac62('0x3f')](_0x343831);})[_0xac62('0x21')](function(_0x16aab6){_0x2adf92[_0xac62('0x40')]=_0x16aab6;return _0x2adf92;})[_0xac62('0x21')](respondWithFilteredResult(_0x1f376b,_0x343831))[_0xac62('0x41')](handleError(_0x1f376b,null));};exports[_0xac62('0x42')]=function(_0x92e60b,_0x842091){var _0x548046={'raw':![],'where':{'id':_0x92e60b[_0xac62('0x43')]['id']}},_0x37dc3d={};_0x37dc3d[_0xac62('0x2d')]=_['keys'](db[_0xac62('0x29')][_0xac62('0x2a')]);_0x37dc3d[_0xac62('0x2e')]=_['keys'](_0x92e60b[_0xac62('0x2e')]);_0x37dc3d[_0xac62('0x2f')]=_[_0xac62('0x30')](_0x37dc3d['model'],_0x37dc3d[_0xac62('0x2e')]);_0x548046[_0xac62('0x31')]=_['intersection'](_0x37dc3d[_0xac62('0x2d')],qs[_0xac62('0x32')](_0x92e60b[_0xac62('0x2e')][_0xac62('0x32')]));_0x548046['attributes']=_0x548046[_0xac62('0x31')][_0xac62('0x33')]?_0x548046[_0xac62('0x31')]:_0x37dc3d[_0xac62('0x2d')];if(_0x92e60b[_0xac62('0x2e')]['includeAll']){_0x548046[_0xac62('0x3e')]=[{'all':!![]}];}_0x548046=_[_0xac62('0x3b')]({},_0x548046,_0x92e60b[_0xac62('0x44')]);return db[_0xac62('0x29')][_0xac62('0x45')](_0x548046)['then'](handleEntityNotFound(_0x842091,null))[_0xac62('0x21')](respondWithResult(_0x842091,null))[_0xac62('0x41')](handleError(_0x842091,null));};exports['create']=function(_0x397215,_0xf65835){return db[_0xac62('0x29')][_0xac62('0x46')](_0x397215[_0xac62('0x47')],{})[_0xac62('0x21')](respondWithResult(_0xf65835,0xc9))['catch'](handleError(_0xf65835,null));};exports[_0xac62('0x48')]=function(_0x386283,_0x17f72b){if(_0x386283[_0xac62('0x47')]['id']){delete _0x386283[_0xac62('0x47')]['id'];}return db['IntegrationReport'][_0xac62('0x45')]({'where':{'id':_0x386283[_0xac62('0x43')]['id']}})['then'](handleEntityNotFound(_0x17f72b,null))[_0xac62('0x21')](saveUpdates(_0x386283[_0xac62('0x47')],null))[_0xac62('0x21')](respondWithResult(_0x17f72b,null))[_0xac62('0x41')](handleError(_0x17f72b,null));};exports[_0xac62('0x22')]=function(_0x5dbc2e,_0x12e322){return db['IntegrationReport'][_0xac62('0x45')]({'where':{'id':_0x5dbc2e['params']['id']}})[_0xac62('0x21')](handleEntityNotFound(_0x12e322,null))[_0xac62('0x21')](removeEntity(_0x12e322,null))[_0xac62('0x41')](handleError(_0x12e322,null));};exports[_0xac62('0x49')]=function(_0x41b569,_0x2a63eb){return db[_0xac62('0x29')][_0xac62('0x49')]()[_0xac62('0x21')](respondWithResult(_0x2a63eb,null))[_0xac62('0x41')](handleError(_0x2a63eb,null));}; \ No newline at end of file +var _0x6544=['length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','rawAttributes','includeAll','create','body','find','params','describe','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','IntegrationReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6544,0x64));var _0x4654=function(_0x47a940,_0x50c7bc){_0x47a940=_0x47a940-0x0;var _0x408cc8=_0x6544[_0x47a940];return _0x408cc8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4654('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4654('0x1'));var moment=require('moment');var BPromise=require(_0x4654('0x2'));var Mustache=require('mustache');var util=require(_0x4654('0x3'));var path=require(_0x4654('0x4'));var sox=require(_0x4654('0x5'));var csv=require(_0x4654('0x6'));var ejs=require(_0x4654('0x7'));var fs=require('fs');var fs_extra=require(_0x4654('0x8'));var _=require(_0x4654('0x9'));var squel=require(_0x4654('0xa'));var crypto=require('crypto');var jsforce=require(_0x4654('0xb'));var deskjs=require(_0x4654('0xc'));var toCsv=require(_0x4654('0x6'));var querystring=require(_0x4654('0xd'));var Papa=require(_0x4654('0xe'));var Redis=require(_0x4654('0xf'));var authService=require(_0x4654('0x10'));var qs=require(_0x4654('0x11'));var as=require(_0x4654('0x12'));var hardwareService=require(_0x4654('0x13'));var logger=require(_0x4654('0x14'))(_0x4654('0x15'));var utils=require(_0x4654('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4654('0x17'));var db=require(_0x4654('0x18'))['db'];function respondWithStatusCode(_0xa34cfe,_0x198735){_0x198735=_0x198735||0xcc;return function(_0x67f248){if(_0x67f248){return _0xa34cfe[_0x4654('0x19')](_0x198735);}return _0xa34cfe[_0x4654('0x1a')](_0x198735)[_0x4654('0x1b')]();};}function respondWithResult(_0x50945d,_0x50c115){_0x50c115=_0x50c115||0xc8;return function(_0x2d59a7){if(_0x2d59a7){return _0x50945d[_0x4654('0x1a')](_0x50c115)[_0x4654('0x1c')](_0x2d59a7);}};}function respondWithFilteredResult(_0x309d7d,_0x1913b5){return function(_0x1d25de){if(_0x1d25de){var _0x5b2203=typeof _0x1913b5[_0x4654('0x1d')]===_0x4654('0x1e')&&typeof _0x1913b5[_0x4654('0x1f')]===_0x4654('0x1e');var _0x11dada=_0x1d25de[_0x4654('0x20')];var _0x5bc2e7=_0x5b2203?0x0:_0x1913b5[_0x4654('0x1d')];var _0x141ba3=_0x5b2203?_0x1d25de[_0x4654('0x20')]:_0x1913b5['offset']+_0x1913b5[_0x4654('0x1f')];var _0xdc5023;if(_0x141ba3>=_0x11dada){_0x141ba3=_0x11dada;_0xdc5023=0xc8;}else{_0xdc5023=0xce;}_0x309d7d[_0x4654('0x1a')](_0xdc5023);return _0x309d7d[_0x4654('0x21')](_0x4654('0x22'),_0x5bc2e7+'-'+_0x141ba3+'/'+_0x11dada)[_0x4654('0x1c')](_0x1d25de);}return null;};}function patchUpdates(_0x266195){return function(_0x58f38a){try{jsonpatch[_0x4654('0x23')](_0x58f38a,_0x266195,!![]);}catch(_0x96192a){return BPromise[_0x4654('0x24')](_0x96192a);}return _0x58f38a[_0x4654('0x25')]();};}function saveUpdates(_0x376c36,_0x4eb51c){return function(_0x2c2387){if(_0x2c2387){return _0x2c2387[_0x4654('0x26')](_0x376c36)['then'](function(_0x208cd1){return _0x208cd1;});}return null;};}function removeEntity(_0x51a90c,_0x5113e7){return function(_0x3b9ef3){if(_0x3b9ef3){return _0x3b9ef3[_0x4654('0x27')]()[_0x4654('0x28')](function(){_0x51a90c[_0x4654('0x1a')](0xcc)[_0x4654('0x1b')]();});}};}function handleEntityNotFound(_0x2133d7,_0x4fba26){return function(_0x46c7c3){if(!_0x46c7c3){_0x2133d7['sendStatus'](0x194);}return _0x46c7c3;};}function handleError(_0x1fb6aa,_0x409fe8){_0x409fe8=_0x409fe8||0x1f4;return function(_0x4730e2){logger[_0x4654('0x29')](_0x4730e2[_0x4654('0x2a')]);if(_0x4730e2[_0x4654('0x2b')]){delete _0x4730e2[_0x4654('0x2b')];}_0x1fb6aa['status'](_0x409fe8)[_0x4654('0x2c')](_0x4730e2);};}exports['index']=function(_0x31847a,_0x270e6a){var _0x484fad={},_0xe5ab0a={},_0x1cf9b1={'count':0x0,'rows':[]};var _0x2d5c99=_[_0x4654('0x2d')](db[_0x4654('0x2e')]['rawAttributes'],function(_0x4d1e54){return{'name':_0x4d1e54[_0x4654('0x2f')],'type':_0x4d1e54['type'][_0x4654('0x30')]};});_0xe5ab0a[_0x4654('0x31')]=_[_0x4654('0x2d')](_0x2d5c99,_0x4654('0x2b'));_0xe5ab0a[_0x4654('0x32')]=_[_0x4654('0x33')](_0x31847a['query']);_0xe5ab0a[_0x4654('0x34')]=_[_0x4654('0x35')](_0xe5ab0a['model'],_0xe5ab0a[_0x4654('0x32')]);_0x484fad[_0x4654('0x36')]=_[_0x4654('0x35')](_0xe5ab0a['model'],qs[_0x4654('0x37')](_0x31847a['query'][_0x4654('0x37')]));_0x484fad[_0x4654('0x36')]=_0x484fad[_0x4654('0x36')][_0x4654('0x38')]?_0x484fad['attributes']:_0xe5ab0a[_0x4654('0x31')];if(!_0x31847a[_0x4654('0x32')][_0x4654('0x39')](_0x4654('0x3a'))){_0x484fad[_0x4654('0x1f')]=qs['limit'](_0x31847a[_0x4654('0x32')]['limit']);_0x484fad[_0x4654('0x1d')]=qs[_0x4654('0x1d')](_0x31847a[_0x4654('0x32')]['offset']);}_0x484fad[_0x4654('0x3b')]=qs[_0x4654('0x3c')](_0x31847a[_0x4654('0x32')][_0x4654('0x3c')]);_0x484fad[_0x4654('0x3d')]=qs[_0x4654('0x34')](_[_0x4654('0x3e')](_0x31847a['query'],_0xe5ab0a['filters']),_0x2d5c99);if(_0x31847a[_0x4654('0x32')]['filter']){_0x484fad[_0x4654('0x3d')]=_[_0x4654('0x3f')](_0x484fad[_0x4654('0x3d')],{'$or':_['map'](_0x2d5c99,function(_0x598ffa){if(_0x598ffa['type']!=='VIRTUAL'){var _0x296b74={};_0x296b74[_0x598ffa[_0x4654('0x2b')]]={'$like':'%'+_0x31847a[_0x4654('0x32')][_0x4654('0x40')]+'%'};return _0x296b74;}})});}_0x484fad=_[_0x4654('0x3f')]({},_0x484fad,_0x31847a[_0x4654('0x41')]);var _0x4a8b42={'where':_0x484fad['where']};return db[_0x4654('0x2e')][_0x4654('0x20')](_0x4a8b42)['then'](function(_0x49321d){_0x1cf9b1[_0x4654('0x20')]=_0x49321d;if(_0x31847a[_0x4654('0x32')]['includeAll']){_0x484fad[_0x4654('0x42')]=[{'all':!![]}];}return db[_0x4654('0x2e')][_0x4654('0x43')](_0x484fad);})[_0x4654('0x28')](function(_0x27a31e){_0x1cf9b1[_0x4654('0x44')]=_0x27a31e;return _0x1cf9b1;})[_0x4654('0x28')](respondWithFilteredResult(_0x270e6a,_0x484fad))[_0x4654('0x45')](handleError(_0x270e6a,null));};exports[_0x4654('0x46')]=function(_0x35ce59,_0x4f0101){var _0x593997={'raw':![],'where':{'id':_0x35ce59['params']['id']}},_0x312d68={};_0x312d68['model']=_['keys'](db[_0x4654('0x2e')][_0x4654('0x47')]);_0x312d68[_0x4654('0x32')]=_['keys'](_0x35ce59[_0x4654('0x32')]);_0x312d68[_0x4654('0x34')]=_[_0x4654('0x35')](_0x312d68[_0x4654('0x31')],_0x312d68[_0x4654('0x32')]);_0x593997[_0x4654('0x36')]=_[_0x4654('0x35')](_0x312d68[_0x4654('0x31')],qs[_0x4654('0x37')](_0x35ce59[_0x4654('0x32')][_0x4654('0x37')]));_0x593997[_0x4654('0x36')]=_0x593997['attributes'][_0x4654('0x38')]?_0x593997[_0x4654('0x36')]:_0x312d68[_0x4654('0x31')];if(_0x35ce59[_0x4654('0x32')][_0x4654('0x48')]){_0x593997[_0x4654('0x42')]=[{'all':!![]}];}_0x593997=_['merge']({},_0x593997,_0x35ce59[_0x4654('0x41')]);return db[_0x4654('0x2e')]['find'](_0x593997)[_0x4654('0x28')](handleEntityNotFound(_0x4f0101,null))['then'](respondWithResult(_0x4f0101,null))[_0x4654('0x45')](handleError(_0x4f0101,null));};exports[_0x4654('0x49')]=function(_0x1f4941,_0x1b7194){return db[_0x4654('0x2e')]['create'](_0x1f4941[_0x4654('0x4a')],{})[_0x4654('0x28')](respondWithResult(_0x1b7194,0xc9))[_0x4654('0x45')](handleError(_0x1b7194,null));};exports['update']=function(_0x4c2903,_0x4bbbdf){if(_0x4c2903[_0x4654('0x4a')]['id']){delete _0x4c2903[_0x4654('0x4a')]['id'];}return db['IntegrationReport'][_0x4654('0x4b')]({'where':{'id':_0x4c2903[_0x4654('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4bbbdf,null))['then'](saveUpdates(_0x4c2903[_0x4654('0x4a')],null))[_0x4654('0x28')](respondWithResult(_0x4bbbdf,null))[_0x4654('0x45')](handleError(_0x4bbbdf,null));};exports['destroy']=function(_0x1b04d0,_0x5e2092){return db[_0x4654('0x2e')][_0x4654('0x4b')]({'where':{'id':_0x1b04d0[_0x4654('0x4c')]['id']}})[_0x4654('0x28')](handleEntityNotFound(_0x5e2092,null))[_0x4654('0x28')](removeEntity(_0x5e2092,null))[_0x4654('0x45')](handleError(_0x5e2092,null));};exports['describe']=function(_0x3ceb97,_0x1bc482){return db[_0x4654('0x2e')][_0x4654('0x4d')]()[_0x4654('0x28')](respondWithResult(_0x1bc482,null))[_0x4654('0x45')](handleError(_0x1bc482,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 08fb82c..aece9f2 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 _0xd505=['exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd505,0x13a));var _0x5d50=function(_0x1ba107,_0x4e3636){_0x1ba107=_0x1ba107-0x0;var _0x320711=_0xd505[_0x1ba107];return _0x320711;};'use strict';var _=require('lodash');var util=require(_0x5d50('0x0'));var logger=require(_0x5d50('0x1'))(_0x5d50('0x2'));var moment=require(_0x5d50('0x3'));var BPromise=require(_0x5d50('0x4'));var rp=require(_0x5d50('0x5'));var fs=require('fs');var path=require(_0x5d50('0x6'));var rimraf=require(_0x5d50('0x7'));var config=require(_0x5d50('0x8'));var attributes=require(_0x5d50('0x9'));module[_0x5d50('0xa')]=function(_0x4e3a78,_0x30b04f){return _0x4e3a78[_0x5d50('0xb')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd006=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','report_integration','lodash','util','../../config/logger'];(function(_0x119d46,_0x35b083){var _0x1b2abe=function(_0x275db8){while(--_0x275db8){_0x119d46['push'](_0x119d46['shift']());}};_0x1b2abe(++_0x35b083);}(_0xd006,0x1c5));var _0x6d00=function(_0x529abc,_0x17b97e){_0x529abc=_0x529abc-0x0;var _0x453afa=_0xd006[_0x529abc];return _0x453afa;};'use strict';var _=require(_0x6d00('0x0'));var util=require(_0x6d00('0x1'));var logger=require(_0x6d00('0x2'))('api');var moment=require(_0x6d00('0x3'));var BPromise=require(_0x6d00('0x4'));var rp=require(_0x6d00('0x5'));var fs=require('fs');var path=require(_0x6d00('0x6'));var rimraf=require(_0x6d00('0x7'));var config=require(_0x6d00('0x8'));var attributes=require(_0x6d00('0x9'));module[_0x6d00('0xa')]=function(_0x2e5f0a,_0x433060){return _0x2e5f0a['define']('IntegrationReport',attributes,{'tableName':_0x6d00('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 2ee962e..b56a5b4 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x814b,0x1a2));var _0xb814=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0x814b[_0x1857c6];return _0x51011c;};'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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','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','../../mysqldb','../../config/utils'];(function(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0x687b,0x14a));var _0xb687=function(_0x58712a,_0x1d88a9){_0x58712a=_0x58712a-0x0;var _0x342032=_0x687b[_0x58712a];return _0x342032;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 65016c6..d7bbe5e 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 _0xcd40=['../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','getIntervals','post','create','/:id/sub_intervals','addIntervals','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3feb1e,_0x4009db){var _0x1020f3=function(_0x5f1037){while(--_0x5f1037){_0x3feb1e['push'](_0x3feb1e['shift']());}};_0x1020f3(++_0x4009db);}(_0xcd40,0x101));var _0x0cd4=function(_0xc4e62c,_0x5b226e){_0xc4e62c=_0xc4e62c-0x0;var _0x44c950=_0xcd40[_0xc4e62c];return _0x44c950;};'use strict';var multer=require(_0x0cd4('0x0'));var util=require(_0x0cd4('0x1'));var path=require(_0x0cd4('0x2'));var timeout=require('connect-timeout');var express=require(_0x0cd4('0x3'));var router=express[_0x0cd4('0x4')]();var fs_extra=require(_0x0cd4('0x5'));var auth=require(_0x0cd4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0cd4('0x7'));var controller=require(_0x0cd4('0x8'));router[_0x0cd4('0x9')]('/',auth['isAuthenticated'](),controller[_0x0cd4('0xa')]);router['get'](_0x0cd4('0xb'),auth[_0x0cd4('0xc')](),controller['show']);router[_0x0cd4('0x9')]('/:id/sub_intervals',auth[_0x0cd4('0xc')](),controller[_0x0cd4('0xd')]);router[_0x0cd4('0xe')]('/',auth[_0x0cd4('0xc')](),controller[_0x0cd4('0xf')]);router[_0x0cd4('0xe')](_0x0cd4('0x10'),auth['isAuthenticated'](),controller['addInterval']);router['post']('/:id/sub_intervals/create_many',auth[_0x0cd4('0xc')](),controller[_0x0cd4('0x11')]);router[_0x0cd4('0x12')](_0x0cd4('0xb'),auth[_0x0cd4('0xc')](),controller['update']);router[_0x0cd4('0x13')]('/:id',auth[_0x0cd4('0xc')](),controller[_0x0cd4('0x14')]);module[_0x0cd4('0x15')]=router; \ No newline at end of file +var _0x8a87=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','/:id/sub_intervals/create_many','addIntervals','update','destroy','exports','multer','path','connect-timeout'];(function(_0x480744,_0x58202c){var _0x2a197c=function(_0x1615c8){while(--_0x1615c8){_0x480744['push'](_0x480744['shift']());}};_0x2a197c(++_0x58202c);}(_0x8a87,0xa5));var _0x78a8=function(_0x5555c6,_0x3b388f){_0x5555c6=_0x5555c6-0x0;var _0x5e8dc5=_0x8a87[_0x5555c6];return _0x5e8dc5;};'use strict';var multer=require(_0x78a8('0x0'));var util=require('util');var path=require(_0x78a8('0x1'));var timeout=require(_0x78a8('0x2'));var express=require('express');var router=express[_0x78a8('0x3')]();var fs_extra=require(_0x78a8('0x4'));var auth=require(_0x78a8('0x5'));var interaction=require(_0x78a8('0x6'));var config=require(_0x78a8('0x7'));var controller=require(_0x78a8('0x8'));router[_0x78a8('0x9')]('/',auth[_0x78a8('0xa')](),controller[_0x78a8('0xb')]);router[_0x78a8('0x9')](_0x78a8('0xc'),auth[_0x78a8('0xa')](),controller['show']);router[_0x78a8('0x9')](_0x78a8('0xd'),auth[_0x78a8('0xa')](),controller[_0x78a8('0xe')]);router[_0x78a8('0xf')]('/',auth[_0x78a8('0xa')](),controller['create']);router['post'](_0x78a8('0xd'),auth[_0x78a8('0xa')](),controller['addInterval']);router[_0x78a8('0xf')](_0x78a8('0x10'),auth[_0x78a8('0xa')](),controller[_0x78a8('0x11')]);router['put'](_0x78a8('0xc'),auth[_0x78a8('0xa')](),controller[_0x78a8('0x12')]);router['delete']('/:id',auth[_0x78a8('0xa')](),controller[_0x78a8('0x13')]);module[_0x78a8('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index ee21c03..860c3dc 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 _0xb01a=['exports','STRING','sequelize'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xb01a,0x107));var _0xab01=function(_0x3439b4,_0x3c235c){_0x3439b4=_0x3439b4-0x0;var _0x38d9f8=_0xb01a[_0x3439b4];return _0x38d9f8;};'use strict';var Sequelize=require(_0xab01('0x0'));module[_0xab01('0x1')]={'name':{'type':Sequelize[_0xab01('0x2')]},'description':{'type':Sequelize[_0xab01('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x55f8=['STRING','sequelize','exports'];(function(_0x2e2ef3,_0x2a3d50){var _0x27973b=function(_0x153f5a){while(--_0x153f5a){_0x2e2ef3['push'](_0x2e2ef3['shift']());}};_0x27973b(++_0x2a3d50);}(_0x55f8,0x1e7));var _0x855f=function(_0x54884a,_0x3f6b9d){_0x54884a=_0x54884a-0x0;var _0x3a06f6=_0x55f8[_0x54884a];return _0x3a06f6;};'use strict';var Sequelize=require(_0x855f('0x0'));module[_0x855f('0x1')]={'name':{'type':Sequelize[_0x855f('0x2')]},'description':{'type':Sequelize[_0x855f('0x2')]},'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 94ce8b0..5a96cf4 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 _0x7d3f=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addInterval','IntervalId','filter','getIntervals','addIntervals','sequelize','transaction','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','end','status','json','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','sendStatus','stack','name','send','map','Interval','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','include','findAll','rows','catch','show','rawAttributes','find','create','user','UserProfileSection','error'];(function(_0x3ff0f0,_0x5523bf){var _0x5dc82a=function(_0x14d26d){while(--_0x14d26d){_0x3ff0f0['push'](_0x3ff0f0['shift']());}};_0x5dc82a(++_0x5523bf);}(_0x7d3f,0x16e));var _0xf7d3=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0x7d3f[_0x2984d0];return _0x2885f2;};'use strict';var emlformat=require(_0xf7d3('0x0'));var rimraf=require(_0xf7d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7d3('0x2'));var rp=require(_0xf7d3('0x3'));var moment=require(_0xf7d3('0x4'));var BPromise=require(_0xf7d3('0x5'));var Mustache=require(_0xf7d3('0x6'));var util=require(_0xf7d3('0x7'));var path=require(_0xf7d3('0x8'));var sox=require(_0xf7d3('0x9'));var csv=require(_0xf7d3('0xa'));var ejs=require(_0xf7d3('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf7d3('0xc'));var crypto=require('crypto');var jsforce=require(_0xf7d3('0xd'));var deskjs=require(_0xf7d3('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf7d3('0xf'));var authService=require(_0xf7d3('0x10'));var qs=require(_0xf7d3('0x11'));var as=require(_0xf7d3('0x12'));var hardwareService=require(_0xf7d3('0x13'));var logger=require(_0xf7d3('0x14'))(_0xf7d3('0x15'));var utils=require(_0xf7d3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf7d3('0x17'));var db=require(_0xf7d3('0x18'))['db'];var extensions=require(_0xf7d3('0x19'));function respondWithStatusCode(_0x15b1d6,_0x508a2c){_0x508a2c=_0x508a2c||0xcc;return function(_0x1494a2){if(_0x1494a2){return _0x15b1d6['sendStatus'](_0x508a2c);}return _0x15b1d6['status'](_0x508a2c)[_0xf7d3('0x1a')]();};}function respondWithResult(_0x52df94,_0x20954c){_0x20954c=_0x20954c||0xc8;return function(_0x239b45){if(_0x239b45){return _0x52df94[_0xf7d3('0x1b')](_0x20954c)[_0xf7d3('0x1c')](_0x239b45);}};}function respondWithFilteredResult(_0x524e5c,_0x5d9e55){return function(_0x460f44){if(_0x460f44){var _0x3a105f=typeof _0x5d9e55['offset']==='undefined'&&typeof _0x5d9e55[_0xf7d3('0x1d')]==='undefined';var _0x24ea78=_0x460f44['count'];var _0x285613=_0x3a105f?0x0:_0x5d9e55[_0xf7d3('0x1e')];var _0x3a5821=_0x3a105f?_0x460f44[_0xf7d3('0x1f')]:_0x5d9e55['offset']+_0x5d9e55['limit'];var _0x5738ee;if(_0x3a5821>=_0x24ea78){_0x3a5821=_0x24ea78;_0x5738ee=0xc8;}else{_0x5738ee=0xce;}_0x524e5c[_0xf7d3('0x1b')](_0x5738ee);return _0x524e5c[_0xf7d3('0x20')](_0xf7d3('0x21'),_0x285613+'-'+_0x3a5821+'/'+_0x24ea78)[_0xf7d3('0x1c')](_0x460f44);}return null;};}function patchUpdates(_0x99e228){return function(_0x33917b){try{jsonpatch[_0xf7d3('0x22')](_0x33917b,_0x99e228,!![]);}catch(_0x42c211){return BPromise[_0xf7d3('0x23')](_0x42c211);}return _0x33917b[_0xf7d3('0x24')]();};}function saveUpdates(_0x207b59,_0x414e4b){return function(_0x33a012){if(_0x33a012){return _0x33a012[_0xf7d3('0x25')](_0x207b59)[_0xf7d3('0x26')](function(_0x22dcf8){return _0x22dcf8;});}return null;};}function removeEntity(_0x33222f,_0x405223){return function(_0x3abf1a){if(_0x3abf1a){return _0x3abf1a[_0xf7d3('0x27')]()[_0xf7d3('0x26')](function(){var _0x5edb4d=_0x3abf1a[_0xf7d3('0x28')]({'plain':!![]});var _0x73e439=_0xf7d3('0x29');return db[_0xf7d3('0x2a')]['destroy']({'where':{'type':_0x73e439,'resourceId':_0x5edb4d['id']}})['then'](function(){return _0x3abf1a;});})['then'](function(){_0x33222f[_0xf7d3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18a2f9,_0x4a6d45){return function(_0x4bf518){if(!_0x4bf518){_0x18a2f9[_0xf7d3('0x2b')](0x194);}return _0x4bf518;};}function handleError(_0x23404f,_0x29fcbb){_0x29fcbb=_0x29fcbb||0x1f4;return function(_0x3d5bd3){logger['error'](_0x3d5bd3[_0xf7d3('0x2c')]);if(_0x3d5bd3[_0xf7d3('0x2d')]){delete _0x3d5bd3[_0xf7d3('0x2d')];}_0x23404f[_0xf7d3('0x1b')](_0x29fcbb)[_0xf7d3('0x2e')](_0x3d5bd3);};}exports['index']=function(_0x45285f,_0x1f5e2d){var _0x1548a9={},_0x2a8ef0={},_0x53b0ee={'count':0x0,'rows':[]};var _0x3881a8=_[_0xf7d3('0x2f')](db[_0xf7d3('0x30')]['rawAttributes'],function(_0xcf1a1e){return{'name':_0xcf1a1e[_0xf7d3('0x31')],'type':_0xcf1a1e[_0xf7d3('0x32')][_0xf7d3('0x33')]};});_0x2a8ef0[_0xf7d3('0x34')]=_[_0xf7d3('0x2f')](_0x3881a8,_0xf7d3('0x2d'));_0x2a8ef0[_0xf7d3('0x35')]=_[_0xf7d3('0x36')](_0x45285f['query']);_0x2a8ef0[_0xf7d3('0x37')]=_[_0xf7d3('0x38')](_0x2a8ef0['model'],_0x2a8ef0[_0xf7d3('0x35')]);_0x1548a9[_0xf7d3('0x39')]=_[_0xf7d3('0x38')](_0x2a8ef0[_0xf7d3('0x34')],qs[_0xf7d3('0x3a')](_0x45285f[_0xf7d3('0x35')]['fields']));_0x1548a9[_0xf7d3('0x39')]=_0x1548a9[_0xf7d3('0x39')][_0xf7d3('0x3b')]?_0x1548a9['attributes']:_0x2a8ef0[_0xf7d3('0x34')];if(!_0x45285f[_0xf7d3('0x35')][_0xf7d3('0x3c')](_0xf7d3('0x3d'))){_0x1548a9[_0xf7d3('0x1d')]=qs[_0xf7d3('0x1d')](_0x45285f['query'][_0xf7d3('0x1d')]);_0x1548a9[_0xf7d3('0x1e')]=qs[_0xf7d3('0x1e')](_0x45285f[_0xf7d3('0x35')][_0xf7d3('0x1e')]);}_0x1548a9['order']=qs[_0xf7d3('0x3e')](_0x45285f[_0xf7d3('0x35')][_0xf7d3('0x3e')]);_0x1548a9[_0xf7d3('0x3f')]=qs[_0xf7d3('0x37')](_[_0xf7d3('0x40')](_0x45285f[_0xf7d3('0x35')],_0x2a8ef0[_0xf7d3('0x37')]),_0x3881a8);if(_0x45285f[_0xf7d3('0x35')]['filter']){_0x1548a9['where']=_['merge'](_0x1548a9['where'],{'$or':_[_0xf7d3('0x2f')](_0x3881a8,function(_0x16e58f){if(_0x16e58f[_0xf7d3('0x32')]!==_0xf7d3('0x41')){var _0x39bbd2={};_0x39bbd2[_0x16e58f[_0xf7d3('0x2d')]]={'$like':'%'+_0x45285f['query']['filter']+'%'};return _0x39bbd2;}})});}_0x1548a9=_[_0xf7d3('0x42')]({},_0x1548a9,_0x45285f[_0xf7d3('0x43')]);var _0x3773ca={'where':_0x1548a9['where']};return db[_0xf7d3('0x30')][_0xf7d3('0x1f')](_0x3773ca)[_0xf7d3('0x26')](function(_0x38938d){_0x53b0ee[_0xf7d3('0x1f')]=_0x38938d;if(_0x45285f[_0xf7d3('0x35')]['includeAll']){_0x1548a9[_0xf7d3('0x44')]=[{'all':!![]}];}return db['Interval'][_0xf7d3('0x45')](_0x1548a9);})['then'](function(_0x394f08){_0x53b0ee[_0xf7d3('0x46')]=_0x394f08;return _0x53b0ee;})['then'](respondWithFilteredResult(_0x1f5e2d,_0x1548a9))[_0xf7d3('0x47')](handleError(_0x1f5e2d,null));};exports[_0xf7d3('0x48')]=function(_0xcfb551,_0x1da9c2){var _0x1771f8={'raw':!![],'where':{'id':_0xcfb551['params']['id']}},_0x35a242={};_0x35a242[_0xf7d3('0x34')]=_[_0xf7d3('0x36')](db['Interval'][_0xf7d3('0x49')]);_0x35a242[_0xf7d3('0x35')]=_[_0xf7d3('0x36')](_0xcfb551[_0xf7d3('0x35')]);_0x35a242[_0xf7d3('0x37')]=_[_0xf7d3('0x38')](_0x35a242[_0xf7d3('0x34')],_0x35a242[_0xf7d3('0x35')]);_0x1771f8[_0xf7d3('0x39')]=_[_0xf7d3('0x38')](_0x35a242['model'],qs[_0xf7d3('0x3a')](_0xcfb551['query']['fields']));_0x1771f8[_0xf7d3('0x39')]=_0x1771f8[_0xf7d3('0x39')][_0xf7d3('0x3b')]?_0x1771f8[_0xf7d3('0x39')]:_0x35a242[_0xf7d3('0x34')];if(_0xcfb551['query']['includeAll']){_0x1771f8[_0xf7d3('0x44')]=[{'all':!![]}];}_0x1771f8=_[_0xf7d3('0x42')]({},_0x1771f8,_0xcfb551['options']);return db['Interval'][_0xf7d3('0x4a')](_0x1771f8)[_0xf7d3('0x26')](handleEntityNotFound(_0x1da9c2,null))[_0xf7d3('0x26')](respondWithResult(_0x1da9c2,null))[_0xf7d3('0x47')](handleError(_0x1da9c2,null));};exports[_0xf7d3('0x4b')]=function(_0x226eb6,_0xda9d73){return db[_0xf7d3('0x30')][_0xf7d3('0x4b')](_0x226eb6['body'],{})[_0xf7d3('0x26')](function(_0x4a4058){var _0x29a09c=_0x226eb6[_0xf7d3('0x4c')][_0xf7d3('0x28')]({'plain':!![]});if(!_0x29a09c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29a09c['role']===_0xf7d3('0x4c')){var _0x44b788=_0x4a4058[_0xf7d3('0x28')]({'plain':!![]});var _0x3f7539=_0xf7d3('0x29');return db[_0xf7d3('0x4d')][_0xf7d3('0x4a')]({'where':{'name':_0x3f7539,'userProfileId':_0x29a09c['userProfileId']},'raw':!![]})[_0xf7d3('0x26')](function(_0x20f0de){if(_0x20f0de&&_0x20f0de['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x44b788['name'],'resourceId':_0x44b788['id'],'type':_0x20f0de[_0xf7d3('0x2d')],'sectionId':_0x20f0de['id']},{})[_0xf7d3('0x26')](function(){return _0x4a4058;});}else{return _0x4a4058;}})[_0xf7d3('0x47')](function(_0x559d8d){logger[_0xf7d3('0x4e')](_0xf7d3('0x4f'),_0x559d8d);throw _0x559d8d;});}return _0x4a4058;})['then'](respondWithResult(_0xda9d73,0xc9))[_0xf7d3('0x47')](handleError(_0xda9d73,null));};exports[_0xf7d3('0x25')]=function(_0x47a148,_0x5098ca){if(_0x47a148[_0xf7d3('0x50')]['id']){delete _0x47a148[_0xf7d3('0x50')]['id'];}return db[_0xf7d3('0x30')][_0xf7d3('0x4a')]({'where':{'id':_0x47a148[_0xf7d3('0x51')]['id']}})[_0xf7d3('0x26')](handleEntityNotFound(_0x5098ca,null))[_0xf7d3('0x26')](saveUpdates(_0x47a148['body'],null))[_0xf7d3('0x26')](respondWithResult(_0x5098ca,null))[_0xf7d3('0x47')](handleError(_0x5098ca,null));};exports['destroy']=function(_0x25c3b3,_0x190389){return db[_0xf7d3('0x30')][_0xf7d3('0x4a')]({'where':{'id':_0x25c3b3[_0xf7d3('0x51')]['id']}})[_0xf7d3('0x26')](handleEntityNotFound(_0x190389,null))['then'](removeEntity(_0x190389,null))[_0xf7d3('0x47')](handleError(_0x190389,null));};exports[_0xf7d3('0x52')]=function(_0xe1c19a,_0x415393,_0x58e8b5){if(_0xe1c19a['body']['id']){delete _0xe1c19a[_0xf7d3('0x50')]['id'];}return db['Interval']['find']({'where':{'id':_0xe1c19a[_0xf7d3('0x51')]['id']}})[_0xf7d3('0x26')](handleEntityNotFound(_0x415393,null))[_0xf7d3('0x26')](function(_0x35f9a1){if(_0x35f9a1){_0xe1c19a['body'][_0xf7d3('0x53')]=_0x35f9a1['id'];return db[_0xf7d3('0x30')]['create'](_0xe1c19a[_0xf7d3('0x50')]);}})[_0xf7d3('0x26')](respondWithResult(_0x415393,null))['catch'](handleError(_0x415393,null));};exports['getIntervals']=function(_0x856b9d,_0x55c988,_0x2fcb72){var _0xc2a135={};var _0x1924a5={};var _0x56ca49;var _0x50198c;return db['Interval']['findOne']({'where':{'id':_0x856b9d[_0xf7d3('0x51')]['id']}})[_0xf7d3('0x26')](handleEntityNotFound(_0x55c988,null))[_0xf7d3('0x26')](function(_0x43ab59){if(_0x43ab59){_0x56ca49=_0x43ab59;_0x1924a5[_0xf7d3('0x34')]=_['keys'](db[_0xf7d3('0x30')][_0xf7d3('0x49')]);_0x1924a5[_0xf7d3('0x35')]=_['keys'](_0x856b9d['query']);_0x1924a5[_0xf7d3('0x37')]=_[_0xf7d3('0x38')](_0x1924a5['model'],_0x1924a5[_0xf7d3('0x35')]);_0xc2a135['attributes']=_['intersection'](_0x1924a5[_0xf7d3('0x34')],qs[_0xf7d3('0x3a')](_0x856b9d['query'][_0xf7d3('0x3a')]));_0xc2a135[_0xf7d3('0x39')]=_0xc2a135[_0xf7d3('0x39')][_0xf7d3('0x3b')]?_0xc2a135[_0xf7d3('0x39')]:_0x1924a5[_0xf7d3('0x34')];_0xc2a135['order']=qs['sort'](_0x856b9d[_0xf7d3('0x35')][_0xf7d3('0x3e')]);_0xc2a135[_0xf7d3('0x3f')]=qs['filters'](_[_0xf7d3('0x40')](_0x856b9d[_0xf7d3('0x35')],_0x1924a5[_0xf7d3('0x37')]));if(_0x856b9d[_0xf7d3('0x35')][_0xf7d3('0x54')]){_0xc2a135[_0xf7d3('0x3f')]=_['merge'](_0xc2a135[_0xf7d3('0x3f')],{'$or':_['map'](_0xc2a135[_0xf7d3('0x39')],function(_0x404420){var _0x35588c={};_0x35588c[_0x404420]={'$like':'%'+_0x856b9d['query'][_0xf7d3('0x54')]+'%'};return _0x35588c;})});}_0xc2a135=_[_0xf7d3('0x42')]({},_0xc2a135,_0x856b9d[_0xf7d3('0x43')]);return _0x56ca49[_0xf7d3('0x55')](_0xc2a135);}})['then'](function(_0x597223){if(_0x597223){_0x50198c=_0x597223[_0xf7d3('0x3b')];if(!_0x856b9d[_0xf7d3('0x35')][_0xf7d3('0x3c')](_0xf7d3('0x3d'))){_0xc2a135['limit']=qs[_0xf7d3('0x1d')](_0x856b9d['query'][_0xf7d3('0x1d')]);_0xc2a135[_0xf7d3('0x1e')]=qs[_0xf7d3('0x1e')](_0x856b9d[_0xf7d3('0x35')][_0xf7d3('0x1e')]);}return _0x56ca49[_0xf7d3('0x55')](_0xc2a135);}})[_0xf7d3('0x26')](function(_0x27d1c6){if(_0x27d1c6){return _0x27d1c6?{'count':_0x50198c,'rows':_0x27d1c6}:null;}})[_0xf7d3('0x26')](respondWithResult(_0x55c988,null))[_0xf7d3('0x47')](handleError(_0x55c988,null));};exports[_0xf7d3('0x56')]=function(_0x383be5,_0x35ad1a,_0x3a3865){return db[_0xf7d3('0x30')]['findOne']({'where':{'id':_0x383be5[_0xf7d3('0x51')]['id']}})[_0xf7d3('0x26')](handleEntityNotFound(_0x35ad1a,null))['then'](function(_0x439d47){if(_0x439d47){return db[_0xf7d3('0x57')][_0xf7d3('0x58')](function(_0x936802){return db['Interval'][_0xf7d3('0x27')]({'where':{'IntervalId':_0x383be5[_0xf7d3('0x51')]['id']},'transaction':_0x936802})[_0xf7d3('0x26')](function(_0x95e6bc){var _0x28a7bc=_['map'](_0x383be5['body'],function(_0x116191){delete _0x116191['id'];_0x116191[_0xf7d3('0x53')]=_0x383be5[_0xf7d3('0x51')]['id'];return _0x116191;});return db[_0xf7d3('0x30')]['bulkCreate'](_0x28a7bc,{'transaction':_0x936802});});})[_0xf7d3('0x26')](function(){return db['Interval'][_0xf7d3('0x45')]({'where':{'IntervalId':_0x383be5['params']['id']}});});}})[_0xf7d3('0x26')](respondWithResult(_0x35ad1a,null))[_0xf7d3('0x47')](handleError(_0x35ad1a,null));}; \ No newline at end of file +var _0x747f=['desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','json','reject','save','update','destroy','get','Intervals','then','error','name','send','index','map','Interval','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getIntervals','findOne','sort','sequelize','transaction','IntervalId','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x35031a,_0x1c8c62){var _0x44ec8f=function(_0x4390fd){while(--_0x4390fd){_0x35031a['push'](_0x35031a['shift']());}};_0x44ec8f(++_0x1c8c62);}(_0x747f,0x1a7));var _0xf747=function(_0x272857,_0x27077a){_0x272857=_0x272857-0x0;var _0x24afcc=_0x747f[_0x272857];return _0x24afcc;};'use strict';var emlformat=require(_0xf747('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf747('0x1'));var rp=require(_0xf747('0x2'));var moment=require(_0xf747('0x3'));var BPromise=require(_0xf747('0x4'));var Mustache=require('mustache');var util=require(_0xf747('0x5'));var path=require(_0xf747('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf747('0x7'));var fs=require('fs');var fs_extra=require(_0xf747('0x8'));var _=require(_0xf747('0x9'));var squel=require(_0xf747('0xa'));var crypto=require('crypto');var jsforce=require(_0xf747('0xb'));var deskjs=require(_0xf747('0xc'));var toCsv=require(_0xf747('0xd'));var querystring=require(_0xf747('0xe'));var Papa=require('papaparse');var Redis=require(_0xf747('0xf'));var authService=require(_0xf747('0x10'));var qs=require(_0xf747('0x11'));var as=require(_0xf747('0x12'));var hardwareService=require(_0xf747('0x13'));var logger=require(_0xf747('0x14'))(_0xf747('0x15'));var utils=require(_0xf747('0x16'));var config=require(_0xf747('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf747('0x18'))['db'];var extensions=require(_0xf747('0x19'));function respondWithStatusCode(_0x28164b,_0x36fa9e){_0x36fa9e=_0x36fa9e||0xcc;return function(_0x5d25f6){if(_0x5d25f6){return _0x28164b[_0xf747('0x1a')](_0x36fa9e);}return _0x28164b[_0xf747('0x1b')](_0x36fa9e)[_0xf747('0x1c')]();};}function respondWithResult(_0x99098,_0x4db7f1){_0x4db7f1=_0x4db7f1||0xc8;return function(_0x42ab6a){if(_0x42ab6a){return _0x99098[_0xf747('0x1b')](_0x4db7f1)['json'](_0x42ab6a);}};}function respondWithFilteredResult(_0x25ce09,_0x359950){return function(_0x5a91cd){if(_0x5a91cd){var _0x4fc951=typeof _0x359950[_0xf747('0x1d')]===_0xf747('0x1e')&&typeof _0x359950[_0xf747('0x1f')]===_0xf747('0x1e');var _0x3ee6e4=_0x5a91cd[_0xf747('0x20')];var _0x33a3c8=_0x4fc951?0x0:_0x359950[_0xf747('0x1d')];var _0x18ecc6=_0x4fc951?_0x5a91cd[_0xf747('0x20')]:_0x359950[_0xf747('0x1d')]+_0x359950['limit'];var _0x2271a3;if(_0x18ecc6>=_0x3ee6e4){_0x18ecc6=_0x3ee6e4;_0x2271a3=0xc8;}else{_0x2271a3=0xce;}_0x25ce09['status'](_0x2271a3);return _0x25ce09['set']('Content-Range',_0x33a3c8+'-'+_0x18ecc6+'/'+_0x3ee6e4)[_0xf747('0x21')](_0x5a91cd);}return null;};}function patchUpdates(_0x289b8b){return function(_0x55a8be){try{jsonpatch['apply'](_0x55a8be,_0x289b8b,!![]);}catch(_0xae3c3){return BPromise[_0xf747('0x22')](_0xae3c3);}return _0x55a8be[_0xf747('0x23')]();};}function saveUpdates(_0x3994a8,_0x154d61){return function(_0x3343b6){if(_0x3343b6){return _0x3343b6[_0xf747('0x24')](_0x3994a8)['then'](function(_0x3503aa){return _0x3503aa;});}return null;};}function removeEntity(_0xab791a,_0x58c1a4){return function(_0xbd6738){if(_0xbd6738){return _0xbd6738[_0xf747('0x25')]()['then'](function(){var _0x4688c0=_0xbd6738[_0xf747('0x26')]({'plain':!![]});var _0x2c4aea=_0xf747('0x27');return db['UserProfileResource'][_0xf747('0x25')]({'where':{'type':_0x2c4aea,'resourceId':_0x4688c0['id']}})['then'](function(){return _0xbd6738;});})[_0xf747('0x28')](function(){_0xab791a[_0xf747('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25f709,_0x28a6c9){return function(_0x59a129){if(!_0x59a129){_0x25f709['sendStatus'](0x194);}return _0x59a129;};}function handleError(_0x38ac16,_0x5a46d1){_0x5a46d1=_0x5a46d1||0x1f4;return function(_0x158cde){logger[_0xf747('0x29')](_0x158cde['stack']);if(_0x158cde[_0xf747('0x2a')]){delete _0x158cde['name'];}_0x38ac16['status'](_0x5a46d1)[_0xf747('0x2b')](_0x158cde);};}exports[_0xf747('0x2c')]=function(_0x430048,_0xcee6f6){var _0x1cb758={},_0x4151df={},_0x563e99={'count':0x0,'rows':[]};var _0xf6bd1c=_[_0xf747('0x2d')](db[_0xf747('0x2e')][_0xf747('0x2f')],function(_0x5b39dd){return{'name':_0x5b39dd['fieldName'],'type':_0x5b39dd[_0xf747('0x30')][_0xf747('0x31')]};});_0x4151df['model']=_[_0xf747('0x2d')](_0xf6bd1c,_0xf747('0x2a'));_0x4151df[_0xf747('0x32')]=_[_0xf747('0x33')](_0x430048[_0xf747('0x32')]);_0x4151df[_0xf747('0x34')]=_['intersection'](_0x4151df[_0xf747('0x35')],_0x4151df[_0xf747('0x32')]);_0x1cb758[_0xf747('0x36')]=_[_0xf747('0x37')](_0x4151df[_0xf747('0x35')],qs[_0xf747('0x38')](_0x430048['query'][_0xf747('0x38')]));_0x1cb758[_0xf747('0x36')]=_0x1cb758[_0xf747('0x36')][_0xf747('0x39')]?_0x1cb758[_0xf747('0x36')]:_0x4151df['model'];if(!_0x430048[_0xf747('0x32')][_0xf747('0x3a')](_0xf747('0x3b'))){_0x1cb758[_0xf747('0x1f')]=qs['limit'](_0x430048[_0xf747('0x32')]['limit']);_0x1cb758[_0xf747('0x1d')]=qs['offset'](_0x430048[_0xf747('0x32')][_0xf747('0x1d')]);}_0x1cb758[_0xf747('0x3c')]=qs['sort'](_0x430048[_0xf747('0x32')]['sort']);_0x1cb758['where']=qs[_0xf747('0x34')](_[_0xf747('0x3d')](_0x430048[_0xf747('0x32')],_0x4151df[_0xf747('0x34')]),_0xf6bd1c);if(_0x430048['query']['filter']){_0x1cb758[_0xf747('0x3e')]=_[_0xf747('0x3f')](_0x1cb758['where'],{'$or':_[_0xf747('0x2d')](_0xf6bd1c,function(_0x5851c0){if(_0x5851c0[_0xf747('0x30')]!=='VIRTUAL'){var _0x4ce9ce={};_0x4ce9ce[_0x5851c0[_0xf747('0x2a')]]={'$like':'%'+_0x430048['query'][_0xf747('0x40')]+'%'};return _0x4ce9ce;}})});}_0x1cb758=_[_0xf747('0x3f')]({},_0x1cb758,_0x430048[_0xf747('0x41')]);var _0x3a2a73={'where':_0x1cb758[_0xf747('0x3e')]};return db['Interval'][_0xf747('0x20')](_0x3a2a73)[_0xf747('0x28')](function(_0x338ed4){_0x563e99[_0xf747('0x20')]=_0x338ed4;if(_0x430048['query'][_0xf747('0x42')]){_0x1cb758[_0xf747('0x43')]=[{'all':!![]}];}return db['Interval'][_0xf747('0x44')](_0x1cb758);})[_0xf747('0x28')](function(_0x78487a){_0x563e99[_0xf747('0x45')]=_0x78487a;return _0x563e99;})[_0xf747('0x28')](respondWithFilteredResult(_0xcee6f6,_0x1cb758))['catch'](handleError(_0xcee6f6,null));};exports[_0xf747('0x46')]=function(_0x478e3a,_0x4cf7ac){var _0x2586de={'raw':!![],'where':{'id':_0x478e3a[_0xf747('0x47')]['id']}},_0x32b04c={};_0x32b04c[_0xf747('0x35')]=_[_0xf747('0x33')](db[_0xf747('0x2e')][_0xf747('0x2f')]);_0x32b04c[_0xf747('0x32')]=_[_0xf747('0x33')](_0x478e3a['query']);_0x32b04c[_0xf747('0x34')]=_[_0xf747('0x37')](_0x32b04c[_0xf747('0x35')],_0x32b04c[_0xf747('0x32')]);_0x2586de[_0xf747('0x36')]=_[_0xf747('0x37')](_0x32b04c['model'],qs['fields'](_0x478e3a['query'][_0xf747('0x38')]));_0x2586de['attributes']=_0x2586de[_0xf747('0x36')]['length']?_0x2586de[_0xf747('0x36')]:_0x32b04c[_0xf747('0x35')];if(_0x478e3a[_0xf747('0x32')][_0xf747('0x42')]){_0x2586de[_0xf747('0x43')]=[{'all':!![]}];}_0x2586de=_[_0xf747('0x3f')]({},_0x2586de,_0x478e3a[_0xf747('0x41')]);return db['Interval'][_0xf747('0x48')](_0x2586de)['then'](handleEntityNotFound(_0x4cf7ac,null))[_0xf747('0x28')](respondWithResult(_0x4cf7ac,null))[_0xf747('0x49')](handleError(_0x4cf7ac,null));};exports['create']=function(_0x4d527d,_0x34ad7d){return db[_0xf747('0x2e')][_0xf747('0x4a')](_0x4d527d[_0xf747('0x4b')],{})['then'](function(_0x111752){var _0xc334d1=_0x4d527d['user'][_0xf747('0x26')]({'plain':!![]});if(!_0xc334d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc334d1[_0xf747('0x4c')]==='user'){var _0x39f85d=_0x111752[_0xf747('0x26')]({'plain':!![]});var _0x51108b=_0xf747('0x27');return db[_0xf747('0x4d')][_0xf747('0x48')]({'where':{'name':_0x51108b,'userProfileId':_0xc334d1[_0xf747('0x4e')]},'raw':!![]})[_0xf747('0x28')](function(_0x88fdd9){if(_0x88fdd9&&_0x88fdd9[_0xf747('0x4f')]===0x0){return db['UserProfileResource'][_0xf747('0x4a')]({'name':_0x39f85d[_0xf747('0x2a')],'resourceId':_0x39f85d['id'],'type':_0x88fdd9['name'],'sectionId':_0x88fdd9['id']},{})[_0xf747('0x28')](function(){return _0x111752;});}else{return _0x111752;}})[_0xf747('0x49')](function(_0x4ce68e){logger['error'](_0xf747('0x50'),_0x4ce68e);throw _0x4ce68e;});}return _0x111752;})[_0xf747('0x28')](respondWithResult(_0x34ad7d,0xc9))[_0xf747('0x49')](handleError(_0x34ad7d,null));};exports['update']=function(_0xc731b6,_0x2f9bcf){if(_0xc731b6[_0xf747('0x4b')]['id']){delete _0xc731b6[_0xf747('0x4b')]['id'];}return db[_0xf747('0x2e')][_0xf747('0x48')]({'where':{'id':_0xc731b6[_0xf747('0x47')]['id']}})[_0xf747('0x28')](handleEntityNotFound(_0x2f9bcf,null))['then'](saveUpdates(_0xc731b6[_0xf747('0x4b')],null))[_0xf747('0x28')](respondWithResult(_0x2f9bcf,null))['catch'](handleError(_0x2f9bcf,null));};exports[_0xf747('0x25')]=function(_0x4179f8,_0x58f2c7){return db[_0xf747('0x2e')][_0xf747('0x48')]({'where':{'id':_0x4179f8[_0xf747('0x47')]['id']}})[_0xf747('0x28')](handleEntityNotFound(_0x58f2c7,null))[_0xf747('0x28')](removeEntity(_0x58f2c7,null))['catch'](handleError(_0x58f2c7,null));};exports['addInterval']=function(_0x57ae5a,_0x5313d8,_0x5355b8){if(_0x57ae5a[_0xf747('0x4b')]['id']){delete _0x57ae5a['body']['id'];}return db[_0xf747('0x2e')][_0xf747('0x48')]({'where':{'id':_0x57ae5a[_0xf747('0x47')]['id']}})[_0xf747('0x28')](handleEntityNotFound(_0x5313d8,null))[_0xf747('0x28')](function(_0x46ced5){if(_0x46ced5){_0x57ae5a[_0xf747('0x4b')]['IntervalId']=_0x46ced5['id'];return db[_0xf747('0x2e')][_0xf747('0x4a')](_0x57ae5a['body']);}})[_0xf747('0x28')](respondWithResult(_0x5313d8,null))['catch'](handleError(_0x5313d8,null));};exports[_0xf747('0x51')]=function(_0x3e43e6,_0x222f0a,_0x348dc1){var _0x750243={};var _0x2e5715={};var _0x334539;var _0x5039a0;return db[_0xf747('0x2e')][_0xf747('0x52')]({'where':{'id':_0x3e43e6[_0xf747('0x47')]['id']}})[_0xf747('0x28')](handleEntityNotFound(_0x222f0a,null))['then'](function(_0xeaa2f1){if(_0xeaa2f1){_0x334539=_0xeaa2f1;_0x2e5715[_0xf747('0x35')]=_[_0xf747('0x33')](db['Interval']['rawAttributes']);_0x2e5715[_0xf747('0x32')]=_[_0xf747('0x33')](_0x3e43e6[_0xf747('0x32')]);_0x2e5715[_0xf747('0x34')]=_[_0xf747('0x37')](_0x2e5715[_0xf747('0x35')],_0x2e5715[_0xf747('0x32')]);_0x750243['attributes']=_[_0xf747('0x37')](_0x2e5715[_0xf747('0x35')],qs[_0xf747('0x38')](_0x3e43e6[_0xf747('0x32')]['fields']));_0x750243[_0xf747('0x36')]=_0x750243[_0xf747('0x36')]['length']?_0x750243[_0xf747('0x36')]:_0x2e5715[_0xf747('0x35')];_0x750243[_0xf747('0x3c')]=qs['sort'](_0x3e43e6['query'][_0xf747('0x53')]);_0x750243['where']=qs[_0xf747('0x34')](_[_0xf747('0x3d')](_0x3e43e6[_0xf747('0x32')],_0x2e5715[_0xf747('0x34')]));if(_0x3e43e6['query']['filter']){_0x750243[_0xf747('0x3e')]=_['merge'](_0x750243[_0xf747('0x3e')],{'$or':_[_0xf747('0x2d')](_0x750243[_0xf747('0x36')],function(_0x22d12c){var _0x48ce6b={};_0x48ce6b[_0x22d12c]={'$like':'%'+_0x3e43e6[_0xf747('0x32')]['filter']+'%'};return _0x48ce6b;})});}_0x750243=_[_0xf747('0x3f')]({},_0x750243,_0x3e43e6[_0xf747('0x41')]);return _0x334539[_0xf747('0x51')](_0x750243);}})['then'](function(_0x2e0d44){if(_0x2e0d44){_0x5039a0=_0x2e0d44[_0xf747('0x39')];if(!_0x3e43e6[_0xf747('0x32')]['hasOwnProperty'](_0xf747('0x3b'))){_0x750243[_0xf747('0x1f')]=qs['limit'](_0x3e43e6[_0xf747('0x32')][_0xf747('0x1f')]);_0x750243[_0xf747('0x1d')]=qs['offset'](_0x3e43e6[_0xf747('0x32')][_0xf747('0x1d')]);}return _0x334539[_0xf747('0x51')](_0x750243);}})[_0xf747('0x28')](function(_0x29e38d){if(_0x29e38d){return _0x29e38d?{'count':_0x5039a0,'rows':_0x29e38d}:null;}})[_0xf747('0x28')](respondWithResult(_0x222f0a,null))[_0xf747('0x49')](handleError(_0x222f0a,null));};exports['addIntervals']=function(_0x8e2825,_0x747875,_0x1f23ae){return db[_0xf747('0x2e')]['findOne']({'where':{'id':_0x8e2825['params']['id']}})[_0xf747('0x28')](handleEntityNotFound(_0x747875,null))[_0xf747('0x28')](function(_0x2716ed){if(_0x2716ed){return db[_0xf747('0x54')][_0xf747('0x55')](function(_0x406849){return db['Interval'][_0xf747('0x25')]({'where':{'IntervalId':_0x8e2825[_0xf747('0x47')]['id']},'transaction':_0x406849})[_0xf747('0x28')](function(_0xc6210e){var _0x10f484=_[_0xf747('0x2d')](_0x8e2825['body'],function(_0x16f27a){delete _0x16f27a['id'];_0x16f27a[_0xf747('0x56')]=_0x8e2825[_0xf747('0x47')]['id'];return _0x16f27a;});return db[_0xf747('0x2e')]['bulkCreate'](_0x10f484,{'transaction':_0x406849});});})[_0xf747('0x28')](function(){return db['Interval'][_0xf747('0x44')]({'where':{'IntervalId':_0x8e2825[_0xf747('0x47')]['id']}});});}})[_0xf747('0x28')](respondWithResult(_0x747875,null))[_0xf747('0x49')](handleError(_0x747875,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 4c0228b..1038ed3 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 _0xd3c4=['interval','string','getIntervals','then','all','map','ifTime','../../components/extensions/rewrite','../../utils/iftime','Interval','tools_intervals','rewrite'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd3c4,0x17b));var _0x4d3c=function(_0x23203e,_0x2ca853){_0x23203e=_0x23203e-0x0;var _0x3b2e81=_0xd3c4[_0x23203e];return _0x3b2e81;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x4d3c('0x0'));var iftime=require(_0x4d3c('0x1'))['iftime'];module['exports']=function(_0x299eb4){return _0x299eb4['define'](_0x4d3c('0x2'),attributes,{'tableName':_0x4d3c('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e7617){extensions[_0x4d3c('0x4')](_0x299eb4,_0x1e7617);},'afterBulkCreate':function(_0x7554b5,_0x483207,_0x55de6c){_0x55de6c();extensions[_0x4d3c('0x4')](_0x299eb4,_0x7554b5[0x0]);},'afterUpdate':function(_0x205773){extensions[_0x4d3c('0x4')](_0x299eb4,_0x205773);},'afterDestroy':function(_0x2a604d){extensions[_0x4d3c('0x4')](_0x299eb4,_0x2a604d);}},'instanceMethods':{'ifTime':function(_0x7647e2=undefined,_0x582b21=new Date()){if(typeof this[_0x4d3c('0x5')]===_0x4d3c('0x6')){return iftime(this[_0x4d3c('0x5')],_0x7647e2,_0x582b21);}else{return this[_0x4d3c('0x7')]()[_0x4d3c('0x8')](function(_0x3702b4){return Promise[_0x4d3c('0x9')](_0x3702b4[_0x4d3c('0xa')](function(_0x25c7ab){return _0x25c7ab[_0x4d3c('0xb')](_0x7647e2,_0x582b21);}));})['then'](function(_0x169903){return _0x169903['reduce'](function(_0x6768d6,_0x3097e7){return _0x6768d6||_0x3097e7;},![]);});}}}});}; \ No newline at end of file +var _0x5fc2=['all','map','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','Interval','tools_intervals','rewrite','string','interval','getIntervals'];(function(_0x5d1a34,_0x4e86de){var _0x4672e5=function(_0x31c6aa){while(--_0x31c6aa){_0x5d1a34['push'](_0x5d1a34['shift']());}};_0x4672e5(++_0x4e86de);}(_0x5fc2,0x125));var _0x25fc=function(_0x55e58c,_0x5278e9){_0x55e58c=_0x55e58c-0x0;var _0x32ce31=_0x5fc2[_0x55e58c];return _0x32ce31;};'use strict';var attributes=require(_0x25fc('0x0'));var extensions=require(_0x25fc('0x1'));var iftime=require(_0x25fc('0x2'))[_0x25fc('0x3')];module[_0x25fc('0x4')]=function(_0x4085f8){return _0x4085f8['define'](_0x25fc('0x5'),attributes,{'tableName':_0x25fc('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x46ee10){extensions['rewrite'](_0x4085f8,_0x46ee10);},'afterBulkCreate':function(_0x4cbfd7,_0x4fd03a,_0x32848c){_0x32848c();extensions[_0x25fc('0x7')](_0x4085f8,_0x4cbfd7[0x0]);},'afterUpdate':function(_0x2531fe){extensions[_0x25fc('0x7')](_0x4085f8,_0x2531fe);},'afterDestroy':function(_0x538720){extensions[_0x25fc('0x7')](_0x4085f8,_0x538720);}},'instanceMethods':{'ifTime':function(_0x2a9be9=undefined,_0x58d6e2=new Date()){if(typeof this['interval']===_0x25fc('0x8')){return iftime(this[_0x25fc('0x9')],_0x2a9be9,_0x58d6e2);}else{return this[_0x25fc('0xa')]()['then'](function(_0x544ef5){return Promise[_0x25fc('0xb')](_0x544ef5[_0x25fc('0xc')](function(_0x5596ec){return _0x5596ec[_0x25fc('0xd')](_0x2a9be9,_0x58d6e2);}));})[_0x25fc('0xe')](function(_0x3a655d){return _0x3a655d[_0x25fc('0xf')](function(_0x331f01,_0x44abcf){return _0x331f01||_0x44abcf;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 48b676f..31f31e8 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 _0xdd88=['format','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','resolve','reduce','lodash','util','../../mysqldb','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','include','map','model','attributes','stringify','catch','error','message','raw','where','then','info','ShowInterval','debug','all','ifTime'];(function(_0x5ac4b6,_0x4d9360){var _0x29ced8=function(_0x4fdcb6){while(--_0x4fdcb6){_0x5ac4b6['push'](_0x5ac4b6['shift']());}};_0x29ced8(++_0x4d9360);}(_0xdd88,0x193));var _0x8dd8=function(_0x50149b,_0x1a47fd){_0x50149b=_0x50149b-0x0;var _0x15d11c=_0xdd88[_0x50149b];return _0x15d11c;};'use strict';var _=require(_0x8dd8('0x0'));var util=require(_0x8dd8('0x1'));var db=require(_0x8dd8('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x8dd8('0x3')];var logger=require(_0x8dd8('0x4'))(_0x8dd8('0x5'));exports[_0x8dd8('0x6')]=function(_0x1be24a){var _0x24cc3f=this;return new Promise(function(_0x49138b,_0x33416c){return db[_0x8dd8('0x7')][_0x8dd8('0x8')]({'raw':_0x1be24a[_0x8dd8('0x9')]?_0x1be24a[_0x8dd8('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x1be24a[_0x8dd8('0x9')]?_0x1be24a[_0x8dd8('0x9')]['where']||null:null,'attributes':_0x1be24a['options']?_0x1be24a[_0x8dd8('0x9')]['attributes']||null:null,'limit':_0x1be24a[_0x8dd8('0x9')]?_0x1be24a[_0x8dd8('0x9')]['limit']||null:null,'include':_0x1be24a[_0x8dd8('0x9')]?_0x1be24a[_0x8dd8('0x9')][_0x8dd8('0xa')]?_[_0x8dd8('0xb')](_0x1be24a[_0x8dd8('0x9')][_0x8dd8('0xa')],function(_0x721435){return{'model':db[_0x721435[_0x8dd8('0xc')]],'as':_0x721435['as'],'attributes':_0x721435[_0x8dd8('0xd')],'include':_0x721435[_0x8dd8('0xa')]?_[_0x8dd8('0xb')](_0x721435['include'],function(_0x404bd3){return{'model':db[_0x404bd3[_0x8dd8('0xc')]],'as':_0x404bd3['as'],'attributes':_0x404bd3['attributes'],'include':_0x404bd3[_0x8dd8('0xa')]?_['map'](_0x404bd3[_0x8dd8('0xa')],function(_0x290154){return{'model':db[_0x290154[_0x8dd8('0xc')]],'as':_0x290154['as'],'attributes':_0x290154[_0x8dd8('0xd')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x310b9f){logger['info'](_0x8dd8('0x6'),_0x1be24a);logger['debug']('GetInterval',_0x1be24a,JSON[_0x8dd8('0xe')](_0x310b9f));_0x49138b(_0x310b9f);})[_0x8dd8('0xf')](function(_0x2a943b){logger[_0x8dd8('0x10')](_0x8dd8('0x6'),_0x2a943b[_0x8dd8('0x11')],_0x1be24a);_0x33416c(_0x24cc3f['error'](0x1f4,_0x2a943b[_0x8dd8('0x11')]));});});};exports['ShowInterval']=function(_0x362262){var _0x1705d4=this;return new Promise(function(_0x82fd6d,_0x22608b){return db[_0x8dd8('0x7')]['find']({'raw':_0x362262[_0x8dd8('0x9')]?_0x362262[_0x8dd8('0x9')][_0x8dd8('0x12')]===undefined?!![]:![]:!![],'where':_0x362262[_0x8dd8('0x9')]?_0x362262[_0x8dd8('0x9')][_0x8dd8('0x13')]||null:null,'attributes':_0x362262[_0x8dd8('0x9')]?_0x362262[_0x8dd8('0x9')][_0x8dd8('0xd')]||null:null,'include':_0x362262['options']?_0x362262[_0x8dd8('0x9')][_0x8dd8('0xa')]?_['map'](_0x362262[_0x8dd8('0x9')][_0x8dd8('0xa')],function(_0x564002){return{'model':db[_0x564002['model']],'as':_0x564002['as'],'attributes':_0x564002[_0x8dd8('0xd')],'include':_0x564002['include']?_[_0x8dd8('0xb')](_0x564002[_0x8dd8('0xa')],function(_0x5947c0){return{'model':db[_0x5947c0[_0x8dd8('0xc')]],'as':_0x5947c0['as'],'attributes':_0x5947c0[_0x8dd8('0xd')],'include':_0x5947c0[_0x8dd8('0xa')]?_[_0x8dd8('0xb')](_0x5947c0[_0x8dd8('0xa')],function(_0x5447d0){return{'model':db[_0x5447d0[_0x8dd8('0xc')]],'as':_0x5447d0['as'],'attributes':_0x5447d0[_0x8dd8('0xd')]};}):[]};}):[]};}):[]:[]})[_0x8dd8('0x14')](function(_0x14881d){logger[_0x8dd8('0x15')](_0x8dd8('0x16'),_0x362262);logger[_0x8dd8('0x17')]('ShowInterval',_0x362262,JSON[_0x8dd8('0xe')](_0x14881d));_0x82fd6d(_0x14881d);})[_0x8dd8('0xf')](function(_0x4ef440){logger['error'](_0x8dd8('0x16'),_0x4ef440[_0x8dd8('0x11')],_0x362262);_0x22608b(_0x1705d4[_0x8dd8('0x10')](0x1f4,_0x4ef440[_0x8dd8('0x11')]));});});};function checkArrayOfIntervals(_0x20be3d,_0x175567){var _0x4f3d52=[];return db[_0x8dd8('0x7')][_0x8dd8('0x8')]({'where':{'id':_0x20be3d}})['then'](function(_0x3369fd){_0x4f3d52=_0x3369fd;return Promise[_0x8dd8('0x18')](_0x4f3d52[_0x8dd8('0xb')](function(_0x25346b){return _0x25346b[_0x8dd8('0x19')](_0x175567);}));})[_0x8dd8('0x14')](function(_0x154d82){var _0x405ed8=_0x154d82['reduce'](function(_0x186f28,_0x313dae){return _0x186f28||_0x313dae;},![]);logger[_0x8dd8('0x15')](util[_0x8dd8('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x4f3d52['map'](function(_0x3e558c){return _0x3e558c[_0x8dd8('0x1b')];})[_0x8dd8('0x1c')](',\x20'),_0x4f3d52['map'](function(_0x46e2ac){return _0x46e2ac['id'];})[_0x8dd8('0x1c')](',\x20')));return _0x405ed8;});}function checkSingleInterval(_0x5265a6,_0x2a629f){return db['Interval'][_0x8dd8('0x1d')](_0x5265a6)[_0x8dd8('0x14')](function(_0x53004b){if(_0x53004b){logger[_0x8dd8('0x15')](util[_0x8dd8('0x1a')](_0x8dd8('0x1e'),_0x53004b[_0x8dd8('0x1b')],_0x53004b['id']));return _0x53004b['ifTime'](_0x2a629f);}});}exports['IntervalIftime']=function(_0x2dcae4){var _0x5aaffc=_0x2dcae4[_0x8dd8('0x1f')];var _0x1a92bf=Array[_0x8dd8('0x20')](_0x2dcae4[_0x8dd8('0x21')])?_0x2dcae4[_0x8dd8('0x21')]:typeof _0x2dcae4[_0x8dd8('0x21')]==='string'?[_0x2dcae4['intervals']]:[];var _0x1a6352=_0x2dcae4['timezone']||undefined;var _0x1c6ddd=![];if(_0x1a92bf[_0x8dd8('0x22')]){logger[_0x8dd8('0x15')](util[_0x8dd8('0x1a')](_0x8dd8('0x23'),_0x1a92bf[_0x8dd8('0x1c')](';\x20')));}if(_0x1a6352){logger['info'](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x1a6352));}logger[_0x8dd8('0x17')](_0x8dd8('0x24'),_0x1c6ddd);logger['silly']('IntervalIftime',_0x2dcae4);return Promise[_0x8dd8('0x25')]()[_0x8dd8('0x14')](function(){if(Array[_0x8dd8('0x20')](_0x5aaffc)){return checkArrayOfIntervals(_0x5aaffc,_0x1a6352);}else if(_0x5aaffc){return checkSingleInterval(_0x5aaffc,_0x1a6352);}})[_0x8dd8('0x14')](function(_0x2e5819){var _0x3e6701=_0x1a92bf[_0x8dd8('0x26')](function(_0x57ed44,_0x2a2e4e){return _0x57ed44||iftime(_0x2a2e4e,_0x1a6352);},![]);_0x1c6ddd=_0x2e5819||_0x3e6701;return _0x1c6ddd;})[_0x8dd8('0xf')](function(_0x3dda04){logger[_0x8dd8('0x10')]('IntervalIftime',_0x2dcae4,_0x3dda04);throw this[_0x8dd8('0x10')](0x1f4,_0x3dda04[_0x8dd8('0x11')]);});}; \ No newline at end of file +var _0xc73d=['include','map','model','attributes','then','info','debug','GetInterval','stringify','catch','error','message','Interval','ShowInterval','findAll','ifTime','reduce','format','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','util','../../utils/iftime','iftime','../../config/logger','options','raw','where','limit'];(function(_0x495977,_0x107906){var _0x2105f8=function(_0x4af937){while(--_0x4af937){_0x495977['push'](_0x495977['shift']());}};_0x2105f8(++_0x107906);}(_0xc73d,0x6d));var _0xdc73=function(_0x1e1ce0,_0x19931f){_0x1e1ce0=_0x1e1ce0-0x0;var _0x45ff68=_0xc73d[_0x1e1ce0];return _0x45ff68;};'use strict';var _=require('lodash');var util=require(_0xdc73('0x0'));var db=require('../../mysqldb')['db'];var iftime=require(_0xdc73('0x1'))[_0xdc73('0x2')];var logger=require(_0xdc73('0x3'))('rpc');exports['GetInterval']=function(_0x59150d){var _0x49775e=this;return new Promise(function(_0x32efcb,_0x140fe6){return db['Interval']['findAll']({'raw':_0x59150d[_0xdc73('0x4')]?_0x59150d[_0xdc73('0x4')][_0xdc73('0x5')]===undefined?!![]:![]:!![],'where':_0x59150d[_0xdc73('0x4')]?_0x59150d['options'][_0xdc73('0x6')]||null:null,'attributes':_0x59150d['options']?_0x59150d[_0xdc73('0x4')]['attributes']||null:null,'limit':_0x59150d[_0xdc73('0x4')]?_0x59150d['options'][_0xdc73('0x7')]||null:null,'include':_0x59150d[_0xdc73('0x4')]?_0x59150d[_0xdc73('0x4')][_0xdc73('0x8')]?_[_0xdc73('0x9')](_0x59150d['options'][_0xdc73('0x8')],function(_0x3e6be9){return{'model':db[_0x3e6be9[_0xdc73('0xa')]],'as':_0x3e6be9['as'],'attributes':_0x3e6be9['attributes'],'include':_0x3e6be9[_0xdc73('0x8')]?_[_0xdc73('0x9')](_0x3e6be9[_0xdc73('0x8')],function(_0x127d10){return{'model':db[_0x127d10[_0xdc73('0xa')]],'as':_0x127d10['as'],'attributes':_0x127d10[_0xdc73('0xb')],'include':_0x127d10[_0xdc73('0x8')]?_[_0xdc73('0x9')](_0x127d10[_0xdc73('0x8')],function(_0x1ce36b){return{'model':db[_0x1ce36b[_0xdc73('0xa')]],'as':_0x1ce36b['as'],'attributes':_0x1ce36b[_0xdc73('0xb')]};}):[]};}):[]};}):[]:[]})[_0xdc73('0xc')](function(_0x112042){logger[_0xdc73('0xd')]('GetInterval',_0x59150d);logger[_0xdc73('0xe')](_0xdc73('0xf'),_0x59150d,JSON[_0xdc73('0x10')](_0x112042));_0x32efcb(_0x112042);})[_0xdc73('0x11')](function(_0x3300e2){logger[_0xdc73('0x12')](_0xdc73('0xf'),_0x3300e2[_0xdc73('0x13')],_0x59150d);_0x140fe6(_0x49775e[_0xdc73('0x12')](0x1f4,_0x3300e2[_0xdc73('0x13')]));});});};exports['ShowInterval']=function(_0x559813){var _0x97bf93=this;return new Promise(function(_0x519ffd,_0x2bd123){return db[_0xdc73('0x14')]['find']({'raw':_0x559813['options']?_0x559813[_0xdc73('0x4')]['raw']===undefined?!![]:![]:!![],'where':_0x559813['options']?_0x559813['options'][_0xdc73('0x6')]||null:null,'attributes':_0x559813['options']?_0x559813[_0xdc73('0x4')][_0xdc73('0xb')]||null:null,'include':_0x559813['options']?_0x559813[_0xdc73('0x4')]['include']?_[_0xdc73('0x9')](_0x559813[_0xdc73('0x4')][_0xdc73('0x8')],function(_0x3d6425){return{'model':db[_0x3d6425[_0xdc73('0xa')]],'as':_0x3d6425['as'],'attributes':_0x3d6425['attributes'],'include':_0x3d6425[_0xdc73('0x8')]?_[_0xdc73('0x9')](_0x3d6425[_0xdc73('0x8')],function(_0x28d498){return{'model':db[_0x28d498[_0xdc73('0xa')]],'as':_0x28d498['as'],'attributes':_0x28d498[_0xdc73('0xb')],'include':_0x28d498[_0xdc73('0x8')]?_[_0xdc73('0x9')](_0x28d498[_0xdc73('0x8')],function(_0x5782d2){return{'model':db[_0x5782d2[_0xdc73('0xa')]],'as':_0x5782d2['as'],'attributes':_0x5782d2[_0xdc73('0xb')]};}):[]};}):[]};}):[]:[]})[_0xdc73('0xc')](function(_0x36cc50){logger[_0xdc73('0xd')](_0xdc73('0x15'),_0x559813);logger[_0xdc73('0xe')](_0xdc73('0x15'),_0x559813,JSON[_0xdc73('0x10')](_0x36cc50));_0x519ffd(_0x36cc50);})[_0xdc73('0x11')](function(_0x50987e){logger[_0xdc73('0x12')](_0xdc73('0x15'),_0x50987e[_0xdc73('0x13')],_0x559813);_0x2bd123(_0x97bf93[_0xdc73('0x12')](0x1f4,_0x50987e[_0xdc73('0x13')]));});});};function checkArrayOfIntervals(_0x4a2669,_0x1bd399){var _0x337fef=[];return db[_0xdc73('0x14')][_0xdc73('0x16')]({'where':{'id':_0x4a2669}})[_0xdc73('0xc')](function(_0x3b40c0){_0x337fef=_0x3b40c0;return Promise['all'](_0x337fef[_0xdc73('0x9')](function(_0x37d064){return _0x37d064[_0xdc73('0x17')](_0x1bd399);}));})[_0xdc73('0xc')](function(_0x4c0d21){var _0x55e0ea=_0x4c0d21[_0xdc73('0x18')](function(_0x5ab904,_0x240e7b){return _0x5ab904||_0x240e7b;},![]);logger['info'](util[_0xdc73('0x19')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x337fef[_0xdc73('0x9')](function(_0x4367f8){return _0x4367f8[_0xdc73('0x1a')];})[_0xdc73('0x1b')](',\x20'),_0x337fef[_0xdc73('0x9')](function(_0x29f0b8){return _0x29f0b8['id'];})[_0xdc73('0x1b')](',\x20')));return _0x55e0ea;});}function checkSingleInterval(_0x21bae7,_0x807f53){return db[_0xdc73('0x14')][_0xdc73('0x1c')](_0x21bae7)[_0xdc73('0xc')](function(_0x810d10){if(_0x810d10){logger[_0xdc73('0xd')](util['format'](_0xdc73('0x1d'),_0x810d10[_0xdc73('0x1a')],_0x810d10['id']));return _0x810d10[_0xdc73('0x17')](_0x807f53);}});}exports[_0xdc73('0x1e')]=function(_0x45746b){var _0x3b3b80=_0x45746b[_0xdc73('0x1f')];var _0xe7b93f=Array['isArray'](_0x45746b[_0xdc73('0x20')])?_0x45746b[_0xdc73('0x20')]:typeof _0x45746b[_0xdc73('0x20')]==='string'?[_0x45746b[_0xdc73('0x20')]]:[];var _0xa1c0a5=_0x45746b[_0xdc73('0x21')]||undefined;var _0x520098=![];if(_0xe7b93f[_0xdc73('0x22')]){logger[_0xdc73('0xd')](util[_0xdc73('0x19')](_0xdc73('0x23'),_0xe7b93f['join'](';\x20')));}if(_0xa1c0a5){logger[_0xdc73('0xd')](util['format'](_0xdc73('0x24'),_0xa1c0a5));}logger[_0xdc73('0xe')](_0xdc73('0x25'),_0x520098);logger['silly'](_0xdc73('0x1e'),_0x45746b);return Promise[_0xdc73('0x26')]()['then'](function(){if(Array['isArray'](_0x3b3b80)){return checkArrayOfIntervals(_0x3b3b80,_0xa1c0a5);}else if(_0x3b3b80){return checkSingleInterval(_0x3b3b80,_0xa1c0a5);}})['then'](function(_0x58b7dc){var _0x4aafb1=_0xe7b93f[_0xdc73('0x18')](function(_0x3f392e,_0x3def71){return _0x3f392e||iftime(_0x3def71,_0xa1c0a5);},![]);_0x520098=_0x58b7dc||_0x4aafb1;return _0x520098;})[_0xdc73('0x11')](function(_0x2a67c3){logger[_0xdc73('0x12')]('IntervalIftime',_0x45746b,_0x2a67c3);throw this[_0xdc73('0x12')](0x1f4,_0x2a67c3[_0xdc73('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index b1eb546..4819c9a 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 _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x5d9371,_0x4a5e41){var _0x5e8612=function(_0x1b2f24){while(--_0x1b2f24){_0x5d9371['push'](_0x5d9371['shift']());}};_0x5e8612(++_0x4a5e41);}(_0x2032,0xd9));var _0x2203=function(_0x20bce5,_0x3bfaa2){_0x20bce5=_0x20bce5-0x0;var _0xb1098f=_0x2032[_0x20bce5];return _0xb1098f;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xb10b,0x12a));var _0xbb10=function(_0x37d718,_0x4b5779){_0x37d718=_0x37d718-0x0;var _0x1b650a=_0xb10b[_0x37d718];return _0x1b650a;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index e24e38c..168a704 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 _0xce05=['/rest/api/2/issue','Basic\x20','toString','request','setEncoding','utf8','data','end','status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','api','support','key','summary','\x20from\x20','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com'];(function(_0x1111ac,_0x27f3d9){var _0x2b30c6=function(_0xaa7256){while(--_0xaa7256){_0x1111ac['push'](_0x1111ac['shift']());}};_0x2b30c6(++_0x27f3d9);}(_0xce05,0x143));var _0x5ce0=function(_0x38985f,_0x27bf8a){_0x38985f=_0x38985f-0x0;var _0x722076=_0xce05[_0x38985f];return _0x722076;};'use strict';var BPromise=require(_0x5ce0('0x0'));var https=require(_0x5ce0('0x1'));var logger=require('../../config/logger')(_0x5ce0('0x2'));var USERNAME=_0x5ce0('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x20092e,_0x293fb1){var _0xb7cb85={'fields':{'project':{'key':_0x20092e[_0x5ce0('0x4')]||'MOTGUI'},'summary':(_0x20092e[_0x5ce0('0x5')]||'Report')+_0x5ce0('0x6')+_0x20092e['ip'],'description':_0x20092e[_0x5ce0('0x7')]||JSON[_0x5ce0('0x8')](_0x20092e),'issuetype':{'name':_0x20092e['issuetype']||_0x5ce0('0x9')}}};_0xb7cb85[_0x5ce0('0xa')][_0x5ce0('0xb')]=_0x20092e[_0x5ce0('0xc')];_0xb7cb85[_0x5ce0('0xa')][_0x5ce0('0xd')]=_0x20092e['oldToken'];_0xb7cb85['fields'][_0x5ce0('0xe')]=_0x20092e[_0x5ce0('0xf')];_0xb7cb85[_0x5ce0('0xa')][_0x5ce0('0x10')]=_0x20092e[_0x5ce0('0x11')];_0xb7cb85[_0x5ce0('0xa')][_0x5ce0('0x12')]=_0x20092e[_0x5ce0('0x13')];_0xb7cb85[_0x5ce0('0xa')]['customfield_10102']=_0x20092e['ip'];var _0x125815={'host':_0x5ce0('0x14'),'port':0x1bb,'path':_0x5ce0('0x15'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x5ce0('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x5ce0('0x17')]('base64')}};var _0x1c6844=JSON[_0x5ce0('0x8')](_0xb7cb85);var _0x20c899=https[_0x5ce0('0x18')](_0x125815,function(_0x4d7f81){_0x4d7f81[_0x5ce0('0x19')](_0x5ce0('0x1a'));var _0x596bf7='';_0x4d7f81['on'](_0x5ce0('0x1b'),function(_0x38ffa8){_0x596bf7+=_0x38ffa8;});_0x4d7f81['on'](_0x5ce0('0x1c'),function(){if(_0x293fb1){return _0x293fb1[_0x5ce0('0x1d')](_0x4d7f81[_0x5ce0('0x1e')])[_0x5ce0('0x1f')](JSON['parse'](_0x596bf7));}});});_0x20c899['on']('error',function(_0x2489ed){if(_0x293fb1){return _0x293fb1['status'](0x1f4)[_0x5ce0('0x1f')]({'errors':[{'message':_0x5ce0('0x20'),'type':_0x5ce0('0x21')}]});}});_0x20c899[_0x5ce0('0x22')](_0x1c6844);_0x20c899[_0x5ce0('0x1c')]();}exports[_0x5ce0('0x23')]=openIssue;exports[_0x5ce0('0x24')]=function(_0x1562ee,_0xe73b86){_0x1562ee['body']['ip']=_0x1562ee[_0x5ce0('0x25')][_0x5ce0('0x26')]||_0x1562ee[_0x5ce0('0x27')][_0x5ce0('0x28')]||_0x1562ee['socket']['remoteAddress']||_0x1562ee[_0x5ce0('0x27')][_0x5ce0('0x29')][_0x5ce0('0x28')];return openIssue(_0x1562ee[_0x5ce0('0x2a')],_0xe73b86);}; \ No newline at end of file +var _0x3196=['api.jira','write','end','openIssue','send','headers','socket','remoteAddress','connection','body','https','api','3eAmWpBVP0','key','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','setEncoding','utf8','status','statusCode','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x3196,0xdc));var _0x6319=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3196[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var https=require(_0x6319('0x0'));var logger=require('../../config/logger')(_0x6319('0x1'));var USERNAME='support';var PASSWORD=_0x6319('0x2');function openIssue(_0xd53e16,_0x3e52a9){var _0x17bac6={'fields':{'project':{'key':_0xd53e16[_0x6319('0x3')]||'MOTGUI'},'summary':(_0xd53e16['summary']||_0x6319('0x4'))+_0x6319('0x5')+_0xd53e16['ip'],'description':_0xd53e16[_0x6319('0x6')]||JSON[_0x6319('0x7')](_0xd53e16),'issuetype':{'name':_0xd53e16[_0x6319('0x8')]||_0x6319('0x9')}}};_0x17bac6[_0x6319('0xa')][_0x6319('0xb')]=_0xd53e16[_0x6319('0xc')];_0x17bac6[_0x6319('0xa')][_0x6319('0xd')]=_0xd53e16['oldToken'];_0x17bac6[_0x6319('0xa')][_0x6319('0xe')]=_0xd53e16[_0x6319('0xf')];_0x17bac6[_0x6319('0xa')][_0x6319('0x10')]=_0xd53e16[_0x6319('0x11')];_0x17bac6[_0x6319('0xa')][_0x6319('0x12')]=_0xd53e16['reason'];_0x17bac6[_0x6319('0xa')][_0x6319('0x13')]=_0xd53e16['ip'];var _0x1045f6={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x6319('0x14'),'method':_0x6319('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x6319('0x16'),'Authorization':_0x6319('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x6319('0x18')]('base64')}};var _0x114ca5=JSON['stringify'](_0x17bac6);var _0x409233=https['request'](_0x1045f6,function(_0x3dc88a){_0x3dc88a[_0x6319('0x19')](_0x6319('0x1a'));var _0x420785='';_0x3dc88a['on']('data',function(_0x29ffad){_0x420785+=_0x29ffad;});_0x3dc88a['on']('end',function(){if(_0x3e52a9){return _0x3e52a9[_0x6319('0x1b')](_0x3dc88a[_0x6319('0x1c')])['json'](JSON['parse'](_0x420785));}});});_0x409233['on'](_0x6319('0x1d'),function(_0x16830a){if(_0x3e52a9){return _0x3e52a9[_0x6319('0x1b')](0x1f4)[_0x6319('0x1e')]({'errors':[{'message':_0x6319('0x1f'),'type':_0x6319('0x20')}]});}});_0x409233[_0x6319('0x21')](_0x114ca5);_0x409233[_0x6319('0x22')]();}exports[_0x6319('0x23')]=openIssue;exports[_0x6319('0x24')]=function(_0x4f859f,_0x536f94){_0x4f859f['body']['ip']=_0x4f859f[_0x6319('0x25')]['x-forwarded-for']||_0x4f859f['connection']['remoteAddress']||_0x4f859f[_0x6319('0x26')][_0x6319('0x27')]||_0x4f859f[_0x6319('0x28')][_0x6319('0x26')][_0x6319('0x27')];return openIssue(_0x4f859f[_0x6319('0x29')],_0x536f94);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 8a0eb84..49672b3 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 _0x4483=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x4483,0x1a3));var _0x3448=function(_0xa7597e,_0x120dac){_0xa7597e=_0xa7597e-0x0;var _0xa0e8da=_0x4483[_0xa7597e];return _0xa0e8da;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0xf')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x11')](_0x3448('0x12'),auth[_0x3448('0xa')](),controller[_0x3448('0x13')]);router[_0x3448('0x14')](_0x3448('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x3448('0x15')]=router; \ No newline at end of file +var _0x54ef=['/describe','describe','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','index','get'];(function(_0x33ba3f,_0x2db275){var _0x2cc797=function(_0x452824){while(--_0x452824){_0x33ba3f['push'](_0x33ba3f['shift']());}};_0x2cc797(++_0x2db275);}(_0x54ef,0x112));var _0xf54e=function(_0x110da7,_0x15be7c){_0x110da7=_0x110da7-0x0;var _0x38c42a=_0x54ef[_0x110da7];return _0x38c42a;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var fs_extra=require(_0xf54e('0x5'));var auth=require(_0xf54e('0x6'));var interaction=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var controller=require(_0xf54e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf54e('0xa')]);router[_0xf54e('0xb')](_0xf54e('0xc'),auth['isAuthenticated'](),controller[_0xf54e('0xd')]);router['get'](_0xf54e('0xe'),auth[_0xf54e('0xf')](),controller['show']);router[_0xf54e('0x10')]('/',auth[_0xf54e('0xf')](),controller[_0xf54e('0x11')]);router[_0xf54e('0x12')]('/:id',auth[_0xf54e('0xf')](),controller[_0xf54e('0x13')]);router[_0xf54e('0x14')](_0xf54e('0xe'),auth['isAuthenticated'](),controller[_0xf54e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 61ca550..6233cab 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(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x7a54,0x106));var _0x47a5=function(_0x155c77,_0x59f8b4){_0x155c77=_0x155c77-0x0;var _0x575380=_0x7a54[_0x155c77];return _0x575380;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0x595c86,_0x10b417){_0x595c86=_0x595c86-0x0;var _0x2506db=_0x7a54[_0x595c86];return _0x2506db;};'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 22e1a67..0b8140e 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 _0x1115=['crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyAnswerReport','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1115,0x1b6));var _0x5111=function(_0x4bb4ea,_0x2e6458){_0x4bb4ea=_0x4bb4ea-0x0;var _0x122682=_0x1115[_0x4bb4ea];return _0x122682;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5111('0x0'));var zipdir=require(_0x5111('0x1'));var jsonpatch=require(_0x5111('0x2'));var rp=require(_0x5111('0x3'));var moment=require(_0x5111('0x4'));var BPromise=require(_0x5111('0x5'));var Mustache=require(_0x5111('0x6'));var util=require(_0x5111('0x7'));var path=require(_0x5111('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5111('0x9'));var fs=require('fs');var fs_extra=require(_0x5111('0xa'));var _=require('lodash');var squel=require(_0x5111('0xb'));var crypto=require(_0x5111('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5111('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5111('0xe'));var Papa=require(_0x5111('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5111('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5111('0x11'));var logger=require('../../config/logger')(_0x5111('0x12'));var utils=require(_0x5111('0x13'));var config=require(_0x5111('0x14'));var licenseUtil=require(_0x5111('0x15'));var db=require(_0x5111('0x16'))['db'];function respondWithStatusCode(_0x54f83a,_0x266625){_0x266625=_0x266625||0xcc;return function(_0x14b4e3){if(_0x14b4e3){return _0x54f83a[_0x5111('0x17')](_0x266625);}return _0x54f83a[_0x5111('0x18')](_0x266625)[_0x5111('0x19')]();};}function respondWithResult(_0x62ce44,_0x264703){_0x264703=_0x264703||0xc8;return function(_0x3e60b5){if(_0x3e60b5){return _0x62ce44[_0x5111('0x18')](_0x264703)[_0x5111('0x1a')](_0x3e60b5);}};}function respondWithFilteredResult(_0x77ddfd,_0x45052e){return function(_0x478b68){if(_0x478b68){var _0x1ac606=typeof _0x45052e['offset']==='undefined'&&typeof _0x45052e[_0x5111('0x1b')]===_0x5111('0x1c');var _0x638470=_0x478b68['count'];var _0x367f8d=_0x1ac606?0x0:_0x45052e[_0x5111('0x1d')];var _0x52c614=_0x1ac606?_0x478b68[_0x5111('0x1e')]:_0x45052e[_0x5111('0x1d')]+_0x45052e[_0x5111('0x1b')];var _0x1b3b45;if(_0x52c614>=_0x638470){_0x52c614=_0x638470;_0x1b3b45=0xc8;}else{_0x1b3b45=0xce;}_0x77ddfd['status'](_0x1b3b45);return _0x77ddfd[_0x5111('0x1f')](_0x5111('0x20'),_0x367f8d+'-'+_0x52c614+'/'+_0x638470)[_0x5111('0x1a')](_0x478b68);}return null;};}function patchUpdates(_0x1b3136){return function(_0x22c7cd){try{jsonpatch[_0x5111('0x21')](_0x22c7cd,_0x1b3136,!![]);}catch(_0x3e8de1){return BPromise[_0x5111('0x22')](_0x3e8de1);}return _0x22c7cd[_0x5111('0x23')]();};}function saveUpdates(_0x3a3fae,_0x4b73ce){return function(_0x3f462d){if(_0x3f462d){return _0x3f462d[_0x5111('0x24')](_0x3a3fae)[_0x5111('0x25')](function(_0x5bf534){return _0x5bf534;});}return null;};}function removeEntity(_0x28cc87,_0x20a4f7){return function(_0x2d9446){if(_0x2d9446){return _0x2d9446[_0x5111('0x26')]()[_0x5111('0x25')](function(){_0x28cc87[_0x5111('0x18')](0xcc)[_0x5111('0x19')]();});}};}function handleEntityNotFound(_0x316b39,_0x382bd0){return function(_0x1a5793){if(!_0x1a5793){_0x316b39['sendStatus'](0x194);}return _0x1a5793;};}function handleError(_0x1bdd54,_0x3d6825){_0x3d6825=_0x3d6825||0x1f4;return function(_0x151b67){logger[_0x5111('0x27')](_0x151b67[_0x5111('0x28')]);if(_0x151b67[_0x5111('0x29')]){delete _0x151b67[_0x5111('0x29')];}_0x1bdd54['status'](_0x3d6825)[_0x5111('0x2a')](_0x151b67);};}exports[_0x5111('0x2b')]=function(_0x25a75a,_0x5efec6){var _0xdf9031={},_0x28efc1={},_0x16107a={'count':0x0,'rows':[]};var _0x48379a=_['map'](db[_0x5111('0x2c')]['rawAttributes'],function(_0xbacf9e){return{'name':_0xbacf9e['fieldName'],'type':_0xbacf9e[_0x5111('0x2d')]['key']};});_0x28efc1['model']=_['map'](_0x48379a,_0x5111('0x29'));_0x28efc1[_0x5111('0x2e')]=_[_0x5111('0x2f')](_0x25a75a[_0x5111('0x2e')]);_0x28efc1[_0x5111('0x30')]=_[_0x5111('0x31')](_0x28efc1[_0x5111('0x32')],_0x28efc1['query']);_0xdf9031[_0x5111('0x33')]=_[_0x5111('0x31')](_0x28efc1[_0x5111('0x32')],qs[_0x5111('0x34')](_0x25a75a['query']['fields']));_0xdf9031[_0x5111('0x33')]=_0xdf9031[_0x5111('0x33')][_0x5111('0x35')]?_0xdf9031[_0x5111('0x33')]:_0x28efc1[_0x5111('0x32')];if(!_0x25a75a[_0x5111('0x2e')][_0x5111('0x36')](_0x5111('0x37'))){_0xdf9031['limit']=qs[_0x5111('0x1b')](_0x25a75a[_0x5111('0x2e')][_0x5111('0x1b')]);_0xdf9031['offset']=qs[_0x5111('0x1d')](_0x25a75a[_0x5111('0x2e')][_0x5111('0x1d')]);}_0xdf9031['order']=qs['sort'](_0x25a75a['query'][_0x5111('0x38')]);_0xdf9031[_0x5111('0x39')]=qs[_0x5111('0x30')](_[_0x5111('0x3a')](_0x25a75a[_0x5111('0x2e')],_0x28efc1['filters']),_0x48379a);if(_0x25a75a[_0x5111('0x2e')][_0x5111('0x3b')]){_0xdf9031[_0x5111('0x39')]=_[_0x5111('0x3c')](_0xdf9031['where'],{'$or':_[_0x5111('0x3d')](_0x48379a,function(_0x444d82){if(_0x444d82[_0x5111('0x2d')]!==_0x5111('0x3e')){var _0x2f0224={};_0x2f0224[_0x444d82[_0x5111('0x29')]]={'$like':'%'+_0x25a75a[_0x5111('0x2e')][_0x5111('0x3b')]+'%'};return _0x2f0224;}})});}_0xdf9031=_[_0x5111('0x3c')]({},_0xdf9031,_0x25a75a[_0x5111('0x3f')]);var _0x35c3b5={'where':_0xdf9031[_0x5111('0x39')]};return db[_0x5111('0x2c')]['count'](_0x35c3b5)[_0x5111('0x25')](function(_0xf00f9){_0x16107a['count']=_0xf00f9;if(_0x25a75a[_0x5111('0x2e')][_0x5111('0x40')]){_0xdf9031[_0x5111('0x41')]=[{'all':!![]}];}return db[_0x5111('0x2c')][_0x5111('0x42')](_0xdf9031);})[_0x5111('0x25')](function(_0x1f1534){_0x16107a['rows']=_0x1f1534;return _0x16107a;})[_0x5111('0x25')](respondWithFilteredResult(_0x5efec6,_0xdf9031))[_0x5111('0x43')](handleError(_0x5efec6,null));};exports[_0x5111('0x44')]=function(_0x1c2e17,_0x96893c){var _0x49307f={'raw':!![],'where':{'id':_0x1c2e17[_0x5111('0x45')]['id']}},_0x50a293={};_0x50a293[_0x5111('0x32')]=_['keys'](db[_0x5111('0x2c')][_0x5111('0x46')]);_0x50a293[_0x5111('0x2e')]=_[_0x5111('0x2f')](_0x1c2e17[_0x5111('0x2e')]);_0x50a293[_0x5111('0x30')]=_[_0x5111('0x31')](_0x50a293[_0x5111('0x32')],_0x50a293[_0x5111('0x2e')]);_0x49307f[_0x5111('0x33')]=_['intersection'](_0x50a293['model'],qs[_0x5111('0x34')](_0x1c2e17[_0x5111('0x2e')][_0x5111('0x34')]));_0x49307f[_0x5111('0x33')]=_0x49307f[_0x5111('0x33')][_0x5111('0x35')]?_0x49307f['attributes']:_0x50a293[_0x5111('0x32')];if(_0x1c2e17[_0x5111('0x2e')][_0x5111('0x40')]){_0x49307f[_0x5111('0x41')]=[{'all':!![]}];}_0x49307f=_['merge']({},_0x49307f,_0x1c2e17[_0x5111('0x3f')]);return db[_0x5111('0x2c')][_0x5111('0x47')](_0x49307f)['then'](handleEntityNotFound(_0x96893c,null))[_0x5111('0x25')](respondWithResult(_0x96893c,null))[_0x5111('0x43')](handleError(_0x96893c,null));};exports[_0x5111('0x48')]=function(_0x2d64de,_0x5cd7a5){return db['JscriptyAnswerReport'][_0x5111('0x48')](_0x2d64de['body'],{})['then'](respondWithResult(_0x5cd7a5,0xc9))[_0x5111('0x43')](handleError(_0x5cd7a5,null));};exports[_0x5111('0x24')]=function(_0x4aa934,_0x296f87){if(_0x4aa934[_0x5111('0x49')]['id']){delete _0x4aa934[_0x5111('0x49')]['id'];}return db[_0x5111('0x2c')][_0x5111('0x47')]({'where':{'id':_0x4aa934[_0x5111('0x45')]['id']}})[_0x5111('0x25')](handleEntityNotFound(_0x296f87,null))[_0x5111('0x25')](saveUpdates(_0x4aa934[_0x5111('0x49')],null))[_0x5111('0x25')](respondWithResult(_0x296f87,null))[_0x5111('0x43')](handleError(_0x296f87,null));};exports[_0x5111('0x26')]=function(_0x53d631,_0x79427d){return db[_0x5111('0x2c')][_0x5111('0x47')]({'where':{'id':_0x53d631[_0x5111('0x45')]['id']}})[_0x5111('0x25')](handleEntityNotFound(_0x79427d,null))[_0x5111('0x25')](removeEntity(_0x79427d,null))[_0x5111('0x43')](handleError(_0x79427d,null));};exports['describe']=function(_0x55cba5,_0x13fe1b){return db['JscriptyAnswerReport'][_0x5111('0x4a')]()[_0x5111('0x25')](respondWithResult(_0x13fe1b,null))[_0x5111('0x43')](handleError(_0x13fe1b,null));}; \ No newline at end of file +var _0x5b20=['json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','JscriptyAnswerReport','rawAttributes','fieldName','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0xd4ae22,_0x29d3df){var _0x25cda2=function(_0x38676b){while(--_0x38676b){_0xd4ae22['push'](_0xd4ae22['shift']());}};_0x25cda2(++_0x29d3df);}(_0x5b20,0x86));var _0x05b2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5b20[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x05b2('0x0'));var rimraf=require(_0x05b2('0x1'));var zipdir=require(_0x05b2('0x2'));var jsonpatch=require(_0x05b2('0x3'));var rp=require(_0x05b2('0x4'));var moment=require(_0x05b2('0x5'));var BPromise=require(_0x05b2('0x6'));var Mustache=require(_0x05b2('0x7'));var util=require(_0x05b2('0x8'));var path=require(_0x05b2('0x9'));var sox=require(_0x05b2('0xa'));var csv=require('to-csv');var ejs=require(_0x05b2('0xb'));var fs=require('fs');var fs_extra=require(_0x05b2('0xc'));var _=require('lodash');var squel=require(_0x05b2('0xd'));var crypto=require(_0x05b2('0xe'));var jsforce=require(_0x05b2('0xf'));var deskjs=require(_0x05b2('0x10'));var toCsv=require(_0x05b2('0x11'));var querystring=require(_0x05b2('0x12'));var Papa=require(_0x05b2('0x13'));var Redis=require(_0x05b2('0x14'));var authService=require(_0x05b2('0x15'));var qs=require(_0x05b2('0x16'));var as=require(_0x05b2('0x17'));var hardwareService=require(_0x05b2('0x18'));var logger=require(_0x05b2('0x19'))(_0x05b2('0x1a'));var utils=require(_0x05b2('0x1b'));var config=require(_0x05b2('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x05b2('0x1d'))['db'];function respondWithStatusCode(_0x12ca67,_0x30eb0a){_0x30eb0a=_0x30eb0a||0xcc;return function(_0x40b8b8){if(_0x40b8b8){return _0x12ca67['sendStatus'](_0x30eb0a);}return _0x12ca67[_0x05b2('0x1e')](_0x30eb0a)[_0x05b2('0x1f')]();};}function respondWithResult(_0x33d532,_0x5a12d4){_0x5a12d4=_0x5a12d4||0xc8;return function(_0x4e5c5d){if(_0x4e5c5d){return _0x33d532[_0x05b2('0x1e')](_0x5a12d4)[_0x05b2('0x20')](_0x4e5c5d);}};}function respondWithFilteredResult(_0x4d6d7e,_0x4c2ee4){return function(_0x3d3664){if(_0x3d3664){var _0x3fe466=typeof _0x4c2ee4[_0x05b2('0x21')]===_0x05b2('0x22')&&typeof _0x4c2ee4[_0x05b2('0x23')]===_0x05b2('0x22');var _0x290cce=_0x3d3664[_0x05b2('0x24')];var _0x468f42=_0x3fe466?0x0:_0x4c2ee4[_0x05b2('0x21')];var _0x8c390d=_0x3fe466?_0x3d3664[_0x05b2('0x24')]:_0x4c2ee4[_0x05b2('0x21')]+_0x4c2ee4[_0x05b2('0x23')];var _0xb3e12e;if(_0x8c390d>=_0x290cce){_0x8c390d=_0x290cce;_0xb3e12e=0xc8;}else{_0xb3e12e=0xce;}_0x4d6d7e[_0x05b2('0x1e')](_0xb3e12e);return _0x4d6d7e['set'](_0x05b2('0x25'),_0x468f42+'-'+_0x8c390d+'/'+_0x290cce)[_0x05b2('0x20')](_0x3d3664);}return null;};}function patchUpdates(_0xd1a576){return function(_0x41bea5){try{jsonpatch[_0x05b2('0x26')](_0x41bea5,_0xd1a576,!![]);}catch(_0x113b6c){return BPromise[_0x05b2('0x27')](_0x113b6c);}return _0x41bea5['save']();};}function saveUpdates(_0x1e76f1,_0x4b14ec){return function(_0x2874e8){if(_0x2874e8){return _0x2874e8[_0x05b2('0x28')](_0x1e76f1)['then'](function(_0x2cccea){return _0x2cccea;});}return null;};}function removeEntity(_0x1a7d84,_0x3bc5a3){return function(_0x4221f5){if(_0x4221f5){return _0x4221f5[_0x05b2('0x29')]()[_0x05b2('0x2a')](function(){_0x1a7d84[_0x05b2('0x1e')](0xcc)[_0x05b2('0x1f')]();});}};}function handleEntityNotFound(_0x4f1e20,_0x4a2d66){return function(_0x5434bd){if(!_0x5434bd){_0x4f1e20[_0x05b2('0x2b')](0x194);}return _0x5434bd;};}function handleError(_0x4f0b2b,_0x5d79a2){_0x5d79a2=_0x5d79a2||0x1f4;return function(_0x35b6ba){logger[_0x05b2('0x2c')](_0x35b6ba[_0x05b2('0x2d')]);if(_0x35b6ba[_0x05b2('0x2e')]){delete _0x35b6ba[_0x05b2('0x2e')];}_0x4f0b2b[_0x05b2('0x1e')](_0x5d79a2)[_0x05b2('0x2f')](_0x35b6ba);};}exports['index']=function(_0x14ebf8,_0x1c7e8a){var _0x717140={},_0x121ada={},_0x50fffd={'count':0x0,'rows':[]};var _0x1d2ea1=_['map'](db[_0x05b2('0x30')][_0x05b2('0x31')],function(_0x3a4ea9){return{'name':_0x3a4ea9[_0x05b2('0x32')],'type':_0x3a4ea9['type'][_0x05b2('0x33')]};});_0x121ada['model']=_[_0x05b2('0x34')](_0x1d2ea1,'name');_0x121ada[_0x05b2('0x35')]=_[_0x05b2('0x36')](_0x14ebf8[_0x05b2('0x35')]);_0x121ada['filters']=_['intersection'](_0x121ada[_0x05b2('0x37')],_0x121ada[_0x05b2('0x35')]);_0x717140[_0x05b2('0x38')]=_[_0x05b2('0x39')](_0x121ada['model'],qs[_0x05b2('0x3a')](_0x14ebf8['query'][_0x05b2('0x3a')]));_0x717140[_0x05b2('0x38')]=_0x717140['attributes'][_0x05b2('0x3b')]?_0x717140[_0x05b2('0x38')]:_0x121ada['model'];if(!_0x14ebf8['query'][_0x05b2('0x3c')](_0x05b2('0x3d'))){_0x717140['limit']=qs[_0x05b2('0x23')](_0x14ebf8[_0x05b2('0x35')][_0x05b2('0x23')]);_0x717140[_0x05b2('0x21')]=qs['offset'](_0x14ebf8['query']['offset']);}_0x717140[_0x05b2('0x3e')]=qs[_0x05b2('0x3f')](_0x14ebf8['query'][_0x05b2('0x3f')]);_0x717140[_0x05b2('0x40')]=qs[_0x05b2('0x41')](_[_0x05b2('0x42')](_0x14ebf8[_0x05b2('0x35')],_0x121ada[_0x05b2('0x41')]),_0x1d2ea1);if(_0x14ebf8[_0x05b2('0x35')]['filter']){_0x717140[_0x05b2('0x40')]=_[_0x05b2('0x43')](_0x717140[_0x05b2('0x40')],{'$or':_[_0x05b2('0x34')](_0x1d2ea1,function(_0x486990){if(_0x486990[_0x05b2('0x44')]!==_0x05b2('0x45')){var _0x5b6ad7={};_0x5b6ad7[_0x486990['name']]={'$like':'%'+_0x14ebf8[_0x05b2('0x35')][_0x05b2('0x46')]+'%'};return _0x5b6ad7;}})});}_0x717140=_[_0x05b2('0x43')]({},_0x717140,_0x14ebf8[_0x05b2('0x47')]);var _0xbf443={'where':_0x717140[_0x05b2('0x40')]};return db[_0x05b2('0x30')][_0x05b2('0x24')](_0xbf443)['then'](function(_0x524964){_0x50fffd[_0x05b2('0x24')]=_0x524964;if(_0x14ebf8[_0x05b2('0x35')]['includeAll']){_0x717140[_0x05b2('0x48')]=[{'all':!![]}];}return db[_0x05b2('0x30')][_0x05b2('0x49')](_0x717140);})[_0x05b2('0x2a')](function(_0x3c526c){_0x50fffd[_0x05b2('0x4a')]=_0x3c526c;return _0x50fffd;})[_0x05b2('0x2a')](respondWithFilteredResult(_0x1c7e8a,_0x717140))['catch'](handleError(_0x1c7e8a,null));};exports[_0x05b2('0x4b')]=function(_0x48bf3b,_0x1e955b){var _0x89a455={'raw':!![],'where':{'id':_0x48bf3b[_0x05b2('0x4c')]['id']}},_0x4a8c3d={};_0x4a8c3d[_0x05b2('0x37')]=_['keys'](db[_0x05b2('0x30')][_0x05b2('0x31')]);_0x4a8c3d[_0x05b2('0x35')]=_[_0x05b2('0x36')](_0x48bf3b[_0x05b2('0x35')]);_0x4a8c3d[_0x05b2('0x41')]=_[_0x05b2('0x39')](_0x4a8c3d[_0x05b2('0x37')],_0x4a8c3d['query']);_0x89a455['attributes']=_[_0x05b2('0x39')](_0x4a8c3d[_0x05b2('0x37')],qs['fields'](_0x48bf3b['query']['fields']));_0x89a455[_0x05b2('0x38')]=_0x89a455['attributes'][_0x05b2('0x3b')]?_0x89a455['attributes']:_0x4a8c3d[_0x05b2('0x37')];if(_0x48bf3b[_0x05b2('0x35')][_0x05b2('0x4d')]){_0x89a455[_0x05b2('0x48')]=[{'all':!![]}];}_0x89a455=_[_0x05b2('0x43')]({},_0x89a455,_0x48bf3b[_0x05b2('0x47')]);return db[_0x05b2('0x30')][_0x05b2('0x4e')](_0x89a455)[_0x05b2('0x2a')](handleEntityNotFound(_0x1e955b,null))['then'](respondWithResult(_0x1e955b,null))[_0x05b2('0x4f')](handleError(_0x1e955b,null));};exports[_0x05b2('0x50')]=function(_0x174c17,_0x4870){return db[_0x05b2('0x30')]['create'](_0x174c17['body'],{})[_0x05b2('0x2a')](respondWithResult(_0x4870,0xc9))[_0x05b2('0x4f')](handleError(_0x4870,null));};exports[_0x05b2('0x28')]=function(_0x1b6973,_0xb7ab8e){if(_0x1b6973[_0x05b2('0x51')]['id']){delete _0x1b6973['body']['id'];}return db[_0x05b2('0x30')][_0x05b2('0x4e')]({'where':{'id':_0x1b6973[_0x05b2('0x4c')]['id']}})[_0x05b2('0x2a')](handleEntityNotFound(_0xb7ab8e,null))[_0x05b2('0x2a')](saveUpdates(_0x1b6973[_0x05b2('0x51')],null))['then'](respondWithResult(_0xb7ab8e,null))[_0x05b2('0x4f')](handleError(_0xb7ab8e,null));};exports[_0x05b2('0x29')]=function(_0x1ef89c,_0x1c3169){return db[_0x05b2('0x30')][_0x05b2('0x4e')]({'where':{'id':_0x1ef89c[_0x05b2('0x4c')]['id']}})[_0x05b2('0x2a')](handleEntityNotFound(_0x1c3169,null))[_0x05b2('0x2a')](removeEntity(_0x1c3169,null))['catch'](handleError(_0x1c3169,null));};exports[_0x05b2('0x52')]=function(_0x35f2bb,_0x2be4e2){return db[_0x05b2('0x30')][_0x05b2('0x52')]()[_0x05b2('0x2a')](respondWithResult(_0x2be4e2,null))[_0x05b2('0x4f')](handleError(_0x2be4e2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index ce8d8f4..21973e2 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 _0x8d99=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x5b6a93,_0x5961d2){var _0x3bb67f=function(_0x2ba18b){while(--_0x2ba18b){_0x5b6a93['push'](_0x5b6a93['shift']());}};_0x3bb67f(++_0x5961d2);}(_0x8d99,0x150));var _0x98d9=function(_0x485acf,_0x2ee516){_0x485acf=_0x485acf-0x0;var _0x33187d=_0x8d99[_0x485acf];return _0x33187d;};'use strict';var _=require(_0x98d9('0x0'));var util=require(_0x98d9('0x1'));var logger=require('../../config/logger')(_0x98d9('0x2'));var moment=require(_0x98d9('0x3'));var BPromise=require(_0x98d9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98d9('0x5'));var rimraf=require(_0x98d9('0x6'));var config=require(_0x98d9('0x7'));var attributes=require(_0x98d9('0x8'));module[_0x98d9('0x9')]=function(_0x2f77a2,_0x899b3b){return _0x2f77a2['define'](_0x98d9('0xa'),attributes,{'tableName':_0x98d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0aaa=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0aaa,0x1b5));var _0xa0aa=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0x0aaa[_0x296809];return _0x18c0d3;};'use strict';var _=require(_0xa0aa('0x0'));var util=require(_0xa0aa('0x1'));var logger=require(_0xa0aa('0x2'))(_0xa0aa('0x3'));var moment=require(_0xa0aa('0x4'));var BPromise=require('bluebird');var rp=require(_0xa0aa('0x5'));var fs=require('fs');var path=require(_0xa0aa('0x6'));var rimraf=require(_0xa0aa('0x7'));var config=require(_0xa0aa('0x8'));var attributes=require(_0xa0aa('0x9'));module[_0xa0aa('0xa')]=function(_0x29b6e8,_0x128aeb){return _0x29b6e8[_0xa0aa('0xb')](_0xa0aa('0xc'),attributes,{'tableName':_0xa0aa('0xd'),'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 0dab609..21cdb79 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 _0xfaee=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird'];(function(_0x9f9015,_0x4c9fea){var _0x590d76=function(_0x488919){while(--_0x488919){_0x9f9015['push'](_0x9f9015['shift']());}};_0x590d76(++_0x4c9fea);}(_0xfaee,0x15d));var _0xefae=function(_0x1f73c3,_0xa8af11){_0x1f73c3=_0x1f73c3-0x0;var _0x20450e=_0xfaee[_0x1f73c3];return _0x20450e;};'use strict';var _=require(_0xefae('0x0'));var util=require(_0xefae('0x1'));var moment=require('moment');var BPromise=require(_0xefae('0x2'));var rs=require(_0xefae('0x3'));var fs=require('fs');var Redis=require(_0xefae('0x4'));var db=require(_0xefae('0x5'))['db'];var utils=require(_0xefae('0x6'));var logger=require(_0xefae('0x7'))(_0xefae('0x8'));var config=require(_0xefae('0x9'));var jayson=require(_0xefae('0xa'));var client=jayson[_0xefae('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cbf4c,_0x147fb0,_0x33fca6){return new BPromise(function(_0x16879f,_0x5dfcbd){return client['request'](_0x3cbf4c,_0x33fca6)[_0xefae('0xc')](function(_0x3bccad){logger[_0xefae('0xd')](_0xefae('0xe'),_0x147fb0,'request\x20sent');logger['debug'](_0xefae('0xf'),_0x147fb0,_0xefae('0x10'),JSON[_0xefae('0x11')](_0x3bccad));if(_0x3bccad[_0xefae('0x12')]){if(_0x3bccad[_0xefae('0x12')]['code']===0x1f4){logger[_0xefae('0x12')](_0xefae('0xe'),_0x147fb0,_0x3bccad[_0xefae('0x12')][_0xefae('0x13')]);return _0x5dfcbd(_0x3bccad['error'][_0xefae('0x13')]);}logger[_0xefae('0x12')](_0xefae('0xe'),_0x147fb0,_0x3bccad['error'][_0xefae('0x13')]);return _0x16879f(_0x3bccad[_0xefae('0x12')][_0xefae('0x13')]);}else{logger[_0xefae('0xd')](_0xefae('0xe'),_0x147fb0,_0xefae('0x10'));_0x16879f(_0x3bccad[_0xefae('0x14')]['message']);}})[_0xefae('0x15')](function(_0x3cc483){logger['error'](_0xefae('0xe'),_0x147fb0,_0x3cc483);_0x5dfcbd(_0x3cc483);});});} \ No newline at end of file +var _0x2574=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2574,0x1a1));var _0x4257=function(_0x2efe39,_0x3ccee8){_0x2efe39=_0x2efe39-0x0;var _0x54b958=_0x2574[_0x2efe39];return _0x54b958;};'use strict';var _=require(_0x4257('0x0'));var util=require(_0x4257('0x1'));var moment=require(_0x4257('0x2'));var BPromise=require(_0x4257('0x3'));var rs=require(_0x4257('0x4'));var fs=require('fs');var Redis=require(_0x4257('0x5'));var db=require(_0x4257('0x6'))['db'];var utils=require(_0x4257('0x7'));var logger=require(_0x4257('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4257('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f0497,_0x4408a2,_0x3ce5ae){return new BPromise(function(_0x337a62,_0xc501f6){return client[_0x4257('0xa')](_0x2f0497,_0x3ce5ae)[_0x4257('0xb')](function(_0x281e45){logger[_0x4257('0xc')](_0x4257('0xd'),_0x4408a2,_0x4257('0xe'));logger[_0x4257('0xf')](_0x4257('0x10'),_0x4408a2,_0x4257('0xe'),JSON[_0x4257('0x11')](_0x281e45));if(_0x281e45['error']){if(_0x281e45[_0x4257('0x12')][_0x4257('0x13')]===0x1f4){logger[_0x4257('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4408a2,_0x281e45[_0x4257('0x12')][_0x4257('0x14')]);return _0xc501f6(_0x281e45[_0x4257('0x12')][_0x4257('0x14')]);}logger[_0x4257('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4408a2,_0x281e45['error']['message']);return _0x337a62(_0x281e45[_0x4257('0x12')]['message']);}else{logger[_0x4257('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4408a2,_0x4257('0xe'));_0x337a62(_0x281e45[_0x4257('0x15')][_0x4257('0x14')]);}})[_0x4257('0x16')](function(_0x2d9871){logger[_0x4257('0x12')](_0x4257('0xd'),_0x4408a2,_0x2d9871);_0xc501f6(_0x2d9871);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 5079efb..2570615 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 _0x859d=['getSessions','/:id/answers','getAnswers','getSummary','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id'];(function(_0x1618dc,_0x1ab89f){var _0x217609=function(_0x9fe1b2){while(--_0x9fe1b2){_0x1618dc['push'](_0x1618dc['shift']());}};_0x217609(++_0x1ab89f);}(_0x859d,0x191));var _0xd859=function(_0xfb42e6,_0x5f5d4b){_0xfb42e6=_0xfb42e6-0x0;var _0x27265b=_0x859d[_0xfb42e6];return _0x27265b;};'use strict';var multer=require(_0xd859('0x0'));var util=require(_0xd859('0x1'));var path=require(_0xd859('0x2'));var timeout=require(_0xd859('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd859('0x4'));var auth=require(_0xd859('0x5'));var interaction=require(_0xd859('0x6'));var config=require(_0xd859('0x7'));var controller=require(_0xd859('0x8'));router[_0xd859('0x9')]('/',auth[_0xd859('0xa')](),controller[_0xd859('0xb')]);router[_0xd859('0x9')](_0xd859('0xc'),auth[_0xd859('0xa')](),controller['show']);router['get']('/:id/sessions',auth[_0xd859('0xa')](),controller[_0xd859('0xd')]);router[_0xd859('0x9')](_0xd859('0xe'),auth[_0xd859('0xa')](),controller[_0xd859('0xf')]);router[_0xd859('0x9')]('/:id/summary',auth[_0xd859('0xa')](),timeout('30s'),controller[_0xd859('0x10')]);router[_0xd859('0x11')]('/',auth[_0xd859('0xa')](),controller[_0xd859('0x12')]);router['post']('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0xd859('0x13')](_0xd859('0xc'),auth[_0xd859('0xa')](),controller['update']);router[_0xd859('0x14')](_0xd859('0xc'),auth[_0xd859('0xa')](),controller[_0xd859('0x15')]);module[_0xd859('0x16')]=router; \ No newline at end of file +var _0xce13=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','getSessions','/:id/answers','getAnswers','getSummary','post','/:id/clone','put','update','delete','destroy','exports','multer'];(function(_0x5c6cf4,_0x35b93b){var _0xf1fb8c=function(_0x1cdee1){while(--_0x1cdee1){_0x5c6cf4['push'](_0x5c6cf4['shift']());}};_0xf1fb8c(++_0x35b93b);}(_0xce13,0x1f3));var _0x3ce1=function(_0x1b2d12,_0x38aafd){_0x1b2d12=_0x1b2d12-0x0;var _0x517ad1=_0xce13[_0x1b2d12];return _0x517ad1;};'use strict';var multer=require(_0x3ce1('0x0'));var util=require(_0x3ce1('0x1'));var path=require(_0x3ce1('0x2'));var timeout=require(_0x3ce1('0x3'));var express=require(_0x3ce1('0x4'));var router=express['Router']();var fs_extra=require(_0x3ce1('0x5'));var auth=require(_0x3ce1('0x6'));var interaction=require(_0x3ce1('0x7'));var config=require(_0x3ce1('0x8'));var controller=require(_0x3ce1('0x9'));router[_0x3ce1('0xa')]('/',auth[_0x3ce1('0xb')](),controller['index']);router['get'](_0x3ce1('0xc'),auth[_0x3ce1('0xb')](),controller[_0x3ce1('0xd')]);router[_0x3ce1('0xa')]('/:id/sessions',auth[_0x3ce1('0xb')](),controller[_0x3ce1('0xe')]);router[_0x3ce1('0xa')](_0x3ce1('0xf'),auth[_0x3ce1('0xb')](),controller[_0x3ce1('0x10')]);router[_0x3ce1('0xa')]('/:id/summary',auth['isAuthenticated'](),timeout('30s'),controller[_0x3ce1('0x11')]);router[_0x3ce1('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3ce1('0x12')](_0x3ce1('0x13'),auth[_0x3ce1('0xb')](),controller['clone']);router[_0x3ce1('0x14')]('/:id',auth[_0x3ce1('0xb')](),controller[_0x3ce1('0x15')]);router[_0x3ce1('0x16')](_0x3ce1('0xc'),auth['isAuthenticated'](),controller[_0x3ce1('0x17')]);module[_0x3ce1('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index fcbd705..aec7c3b 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 _0x25bd=['formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','BOOLEAN','sequelize','util','exports','STRING','long','setDataValue'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x25bd,0x1ac));var _0xd25b=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x25bd[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0xd25b('0x0'));var _=require('lodash');var util=require(_0xd25b('0x1'));module[_0xd25b('0x2')]={'name':{'type':Sequelize[_0xd25b('0x3')],'unique':'name'},'description':{'type':Sequelize[_0xd25b('0x3')]},'formData':{'type':Sequelize['TEXT'](_0xd25b('0x4')),'set':function(_0xb67482){if(_['isObjectLike'](_0xb67482)){this[_0xd25b('0x5')](_0xd25b('0x6'),JSON[_0xd25b('0x7')](_0xb67482));}else if(_[_0xd25b('0x8')](_0xb67482)){this[_0xd25b('0x5')](_0xd25b('0x6'),_0xb67482);}else{this[_0xd25b('0x5')](_0xd25b('0x6'),util[_0xd25b('0x9')](_0xd25b('0xa'),this[_0xd25b('0xb')](_0xd25b('0xc'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd25b('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd25b('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xab51=['stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','util','STRING','name','TEXT','long','isObjectLike','setDataValue','formData'];(function(_0x3a738a,_0x15280a){var _0x4fd6af=function(_0xaa1df5){while(--_0xaa1df5){_0x3a738a['push'](_0x3a738a['shift']());}};_0x4fd6af(++_0x15280a);}(_0xab51,0xd7));var _0x1ab5=function(_0x32d3fb,_0x22f578){_0x32d3fb=_0x32d3fb-0x0;var _0x56c809=_0xab51[_0x32d3fb];return _0x56c809;};'use strict';var Sequelize=require(_0x1ab5('0x0'));var _=require('lodash');var util=require(_0x1ab5('0x1'));module['exports']={'name':{'type':Sequelize[_0x1ab5('0x2')],'unique':_0x1ab5('0x3')},'description':{'type':Sequelize[_0x1ab5('0x2')]},'formData':{'type':Sequelize[_0x1ab5('0x4')](_0x1ab5('0x5')),'set':function(_0x5f5aa2){if(_[_0x1ab5('0x6')](_0x5f5aa2)){this[_0x1ab5('0x7')](_0x1ab5('0x8'),JSON[_0x1ab5('0x9')](_0x5f5aa2));}else if(_[_0x1ab5('0xa')](_0x5f5aa2)){this['setDataValue'](_0x1ab5('0x8'),_0x5f5aa2);}else{this[_0x1ab5('0x7')](_0x1ab5('0x8'),util['format'](_0x1ab5('0xb'),this[_0x1ab5('0xc')](_0x1ab5('0x3'))||'',this[_0x1ab5('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1ab5('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x1ab5('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index a642554..60ce68e 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 _0x0999=['replace','getSummary','starttime','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Projects','UserProfileResource','end','error','stack','name','send','map','rawAttributes','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','options','JscriptyProject','includeAll','include','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','body','omit','update','getSessions','findOne','JscriptySessionReport','pick','ProjectId','findAll','rows','JscriptyAnswerReport','nolimit','number','fromCharCode','indexOf','toString'];(function(_0x237202,_0x51ea1e){var _0x539765=function(_0x2c47d5){while(--_0x2c47d5){_0x237202['push'](_0x237202['shift']());}};_0x539765(++_0x51ea1e);}(_0x0999,0x85));var _0x9099=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0x0999[_0x1526e1];return _0x249a1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9099('0x0'));var zipdir=require(_0x9099('0x1'));var jsonpatch=require(_0x9099('0x2'));var rp=require(_0x9099('0x3'));var moment=require(_0x9099('0x4'));var BPromise=require(_0x9099('0x5'));var Mustache=require(_0x9099('0x6'));var util=require(_0x9099('0x7'));var path=require(_0x9099('0x8'));var sox=require(_0x9099('0x9'));var csv=require(_0x9099('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9099('0xb'));var _=require(_0x9099('0xc'));var squel=require('squel');var crypto=require(_0x9099('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9099('0xa'));var querystring=require(_0x9099('0xe'));var Papa=require('papaparse');var Redis=require(_0x9099('0xf'));var authService=require(_0x9099('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9099('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9099('0x12'))(_0x9099('0x13'));var utils=require(_0x9099('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9099('0x15'));var db=require(_0x9099('0x16'))['db'];function respondWithStatusCode(_0xaf38f0,_0x59e806){_0x59e806=_0x59e806||0xcc;return function(_0x159346){if(_0x159346){return _0xaf38f0[_0x9099('0x17')](_0x59e806);}return _0xaf38f0[_0x9099('0x18')](_0x59e806)['end']();};}function respondWithResult(_0x5bb453,_0x298d04){_0x298d04=_0x298d04||0xc8;return function(_0x4d3233){if(_0x4d3233){return _0x5bb453[_0x9099('0x18')](_0x298d04)['json'](_0x4d3233);}};}function respondWithFilteredResult(_0x359cc4,_0x4c55dc){return function(_0x3548e8){if(_0x3548e8){var _0x1867a0=typeof _0x4c55dc[_0x9099('0x19')]===_0x9099('0x1a')&&typeof _0x4c55dc[_0x9099('0x1b')]===_0x9099('0x1a');var _0xc2094a=_0x3548e8[_0x9099('0x1c')];var _0x993bb9=_0x1867a0?0x0:_0x4c55dc[_0x9099('0x19')];var _0x563325=_0x1867a0?_0x3548e8['count']:_0x4c55dc[_0x9099('0x19')]+_0x4c55dc[_0x9099('0x1b')];var _0x490f05;if(_0x563325>=_0xc2094a){_0x563325=_0xc2094a;_0x490f05=0xc8;}else{_0x490f05=0xce;}_0x359cc4[_0x9099('0x18')](_0x490f05);return _0x359cc4[_0x9099('0x1d')](_0x9099('0x1e'),_0x993bb9+'-'+_0x563325+'/'+_0xc2094a)['json'](_0x3548e8);}return null;};}function patchUpdates(_0x5e962d){return function(_0x23c1b6){try{jsonpatch[_0x9099('0x1f')](_0x23c1b6,_0x5e962d,!![]);}catch(_0xbb444d){return BPromise[_0x9099('0x20')](_0xbb444d);}return _0x23c1b6[_0x9099('0x21')]();};}function saveUpdates(_0x305826,_0x23e12){return function(_0x53aa89){if(_0x53aa89){return _0x53aa89['update'](_0x305826)[_0x9099('0x22')](function(_0x5a2b7f){return _0x5a2b7f;});}return null;};}function removeEntity(_0xe12a3c,_0x22f4b3){return function(_0x281cb0){if(_0x281cb0){return _0x281cb0[_0x9099('0x23')]()[_0x9099('0x22')](function(){var _0x34c616=_0x281cb0[_0x9099('0x24')]({'plain':!![]});var _0x387688=_0x9099('0x25');return db[_0x9099('0x26')]['destroy']({'where':{'type':_0x387688,'resourceId':_0x34c616['id']}})['then'](function(){return _0x281cb0;});})[_0x9099('0x22')](function(){_0xe12a3c[_0x9099('0x18')](0xcc)[_0x9099('0x27')]();});}};}function handleEntityNotFound(_0x28777f,_0x22a652){return function(_0x326cd1){if(!_0x326cd1){_0x28777f[_0x9099('0x17')](0x194);}return _0x326cd1;};}function handleError(_0xf1eae6,_0x49e9c0){_0x49e9c0=_0x49e9c0||0x1f4;return function(_0xe677c0){logger[_0x9099('0x28')](_0xe677c0[_0x9099('0x29')]);if(_0xe677c0['name']){delete _0xe677c0[_0x9099('0x2a')];}_0xf1eae6[_0x9099('0x18')](_0x49e9c0)[_0x9099('0x2b')](_0xe677c0);};}exports['index']=function(_0x4c7e93,_0x33b831){var _0x165092={},_0x4cc428={},_0xdc3c9c={'count':0x0,'rows':[]};var _0x77e9d8=_[_0x9099('0x2c')](db['JscriptyProject'][_0x9099('0x2d')],function(_0x11f38a){return{'name':_0x11f38a['fieldName'],'type':_0x11f38a['type'][_0x9099('0x2e')]};});_0x4cc428['model']=_[_0x9099('0x2c')](_0x77e9d8,_0x9099('0x2a'));_0x4cc428[_0x9099('0x2f')]=_[_0x9099('0x30')](_0x4c7e93[_0x9099('0x2f')]);_0x4cc428['filters']=_[_0x9099('0x31')](_0x4cc428[_0x9099('0x32')],_0x4cc428[_0x9099('0x2f')]);_0x165092[_0x9099('0x33')]=_['intersection'](_0x4cc428[_0x9099('0x32')],qs[_0x9099('0x34')](_0x4c7e93[_0x9099('0x2f')][_0x9099('0x34')]));_0x165092[_0x9099('0x33')]=_0x165092[_0x9099('0x33')]['length']?_0x165092['attributes']:_0x4cc428[_0x9099('0x32')];if(!_0x4c7e93[_0x9099('0x2f')][_0x9099('0x35')]('nolimit')){_0x165092['limit']=qs['limit'](_0x4c7e93[_0x9099('0x2f')][_0x9099('0x1b')]);_0x165092[_0x9099('0x19')]=qs['offset'](_0x4c7e93[_0x9099('0x2f')]['offset']);}_0x165092[_0x9099('0x36')]=qs[_0x9099('0x37')](_0x4c7e93[_0x9099('0x2f')][_0x9099('0x37')]);_0x165092[_0x9099('0x38')]=qs[_0x9099('0x39')](_['pick'](_0x4c7e93[_0x9099('0x2f')],_0x4cc428[_0x9099('0x39')]),_0x77e9d8);if(_0x4c7e93[_0x9099('0x2f')]['filter']){_0x165092['where']=_[_0x9099('0x3a')](_0x165092['where'],{'$or':_[_0x9099('0x2c')](_0x77e9d8,function(_0x477d06){if(_0x477d06['type']!==_0x9099('0x3b')){var _0x35ae8b={};_0x35ae8b[_0x477d06[_0x9099('0x2a')]]={'$like':'%'+_0x4c7e93['query'][_0x9099('0x3c')]+'%'};return _0x35ae8b;}})});}_0x165092=_[_0x9099('0x3a')]({},_0x165092,_0x4c7e93[_0x9099('0x3d')]);var _0x342e9a={'where':_0x165092['where']};return db[_0x9099('0x3e')]['count'](_0x342e9a)[_0x9099('0x22')](function(_0x52244c){_0xdc3c9c['count']=_0x52244c;if(_0x4c7e93[_0x9099('0x2f')][_0x9099('0x3f')]){_0x165092[_0x9099('0x40')]=[{'all':!![]}];}return db[_0x9099('0x3e')]['findAll'](_0x165092);})[_0x9099('0x22')](function(_0x1918ca){_0xdc3c9c['rows']=_0x1918ca;return _0xdc3c9c;})[_0x9099('0x22')](respondWithFilteredResult(_0x33b831,_0x165092))['catch'](handleError(_0x33b831,null));};exports['show']=function(_0x143dff,_0x512c8b){var _0x4f7429={'raw':![],'where':{'id':_0x143dff[_0x9099('0x41')]['id']}},_0x1b63ef={};_0x1b63ef['model']=_[_0x9099('0x30')](db[_0x9099('0x3e')][_0x9099('0x2d')]);_0x1b63ef['query']=_[_0x9099('0x30')](_0x143dff['query']);_0x1b63ef[_0x9099('0x39')]=_[_0x9099('0x31')](_0x1b63ef[_0x9099('0x32')],_0x1b63ef[_0x9099('0x2f')]);_0x4f7429[_0x9099('0x33')]=_[_0x9099('0x31')](_0x1b63ef[_0x9099('0x32')],qs[_0x9099('0x34')](_0x143dff['query'][_0x9099('0x34')]));_0x4f7429[_0x9099('0x33')]=_0x4f7429['attributes'][_0x9099('0x42')]?_0x4f7429[_0x9099('0x33')]:_0x1b63ef['model'];if(_0x143dff[_0x9099('0x2f')][_0x9099('0x3f')]){_0x4f7429[_0x9099('0x40')]=[{'all':!![]}];}_0x4f7429=_[_0x9099('0x3a')]({},_0x4f7429,_0x143dff['options']);return db['JscriptyProject'][_0x9099('0x43')](_0x4f7429)['then'](handleEntityNotFound(_0x512c8b,null))[_0x9099('0x22')](respondWithResult(_0x512c8b,null))['catch'](handleError(_0x512c8b,null));};exports[_0x9099('0x44')]=function(_0xbe9cbc,_0x234da5){return db[_0x9099('0x3e')][_0x9099('0x44')](_0xbe9cbc['body'],{})['then'](function(_0x5086c1){var _0x2b15ed=_0xbe9cbc[_0x9099('0x45')][_0x9099('0x24')]({'plain':!![]});if(!_0x2b15ed)throw new Error(_0x9099('0x46'));if(_0x2b15ed[_0x9099('0x47')]===_0x9099('0x45')){var _0x3de0c1=_0x5086c1[_0x9099('0x24')]({'plain':!![]});var _0x383db5='Projects';return db[_0x9099('0x48')]['find']({'where':{'name':_0x383db5,'userProfileId':_0x2b15ed[_0x9099('0x49')]},'raw':!![]})[_0x9099('0x22')](function(_0x51688f){if(_0x51688f&&_0x51688f[_0x9099('0x4a')]===0x0){return db['UserProfileResource'][_0x9099('0x44')]({'name':_0x3de0c1[_0x9099('0x2a')],'resourceId':_0x3de0c1['id'],'type':_0x51688f[_0x9099('0x2a')],'sectionId':_0x51688f['id']},{})[_0x9099('0x22')](function(){return _0x5086c1;});}else{return _0x5086c1;}})[_0x9099('0x4b')](function(_0x181088){logger[_0x9099('0x28')](_0x9099('0x4c'),_0x181088);throw _0x181088;});}return _0x5086c1;})[_0x9099('0x22')](respondWithResult(_0x234da5,0xc9))[_0x9099('0x4b')](handleError(_0x234da5,null));};exports[_0x9099('0x4d')]=function(_0x42cc30,_0x263412){var _0x4ac885={'where':{'id':_0x42cc30[_0x9099('0x41')]['id']}},_0x49ffb8={};_0x49ffb8['model']=_[_0x9099('0x30')](db[_0x9099('0x3e')][_0x9099('0x2d')]);_0x4ac885[_0x9099('0x33')]=_[_0x9099('0x31')](_0x49ffb8[_0x9099('0x32')],qs[_0x9099('0x34')](_0x42cc30['query'][_0x9099('0x34')]));_0x4ac885['attributes']=_0x4ac885['attributes'][_0x9099('0x42')]?_0x4ac885[_0x9099('0x33')]:_0x49ffb8['model'];if(_0x42cc30[_0x9099('0x2f')][_0x9099('0x3f')]){_0x4ac885[_0x9099('0x40')]=[{'all':!![]}];}_0x4ac885=_[_0x9099('0x3a')]({},_0x4ac885,_0x42cc30[_0x9099('0x3d')]);return db[_0x9099('0x3e')][_0x9099('0x43')](_0x4ac885)[_0x9099('0x22')](handleEntityNotFound(_0x263412,null))[_0x9099('0x22')](function(_0x2fce16){if(_0x2fce16){var _0x425105=_0x2fce16[_0x9099('0x24')]({'plain':!![]});_0x425105=qs['omit'](_0x425105,['id',_0x9099('0x4e'),'updatedAt']);_0x42cc30[_0x9099('0x4f')]=_[_0x9099('0x50')](_0x42cc30[_0x9099('0x4f')],['id',_0x9099('0x4e'),'updatedAt']);return db['JscriptyProject'][_0x9099('0x44')](_[_0x9099('0x3a')](_0x425105,_0x42cc30[_0x9099('0x4f')]),{'include':_0x42cc30['query'][_0x9099('0x3f')]?[{'all':!![]}]:undefined})['then'](function(_0x429773){var _0x396f39=_0x42cc30[_0x9099('0x45')]['get']({'plain':!![]});if(!_0x396f39)throw new Error(_0x9099('0x46'));if(_0x396f39['role']===_0x9099('0x45')){var _0x53bb97=_0x429773[_0x9099('0x24')]({'plain':!![]});var _0x6f09f3=_0x9099('0x25');return db[_0x9099('0x48')][_0x9099('0x43')]({'where':{'name':_0x6f09f3,'userProfileId':_0x396f39[_0x9099('0x49')]},'raw':!![]})['then'](function(_0x3d2096){if(_0x3d2096&&_0x3d2096[_0x9099('0x4a')]===0x0){return db[_0x9099('0x26')][_0x9099('0x44')]({'name':_0x53bb97[_0x9099('0x2a')],'resourceId':_0x53bb97['id'],'type':_0x3d2096[_0x9099('0x2a')],'sectionId':_0x3d2096['id']},{})[_0x9099('0x22')](function(){return _0x429773;});}else{return _0x429773;}})[_0x9099('0x4b')](function(_0x2cb696){logger[_0x9099('0x28')](_0x9099('0x4c'),_0x2cb696);throw _0x2cb696;});}return _0x429773;});}})['then'](respondWithResult(_0x263412,0xc9))[_0x9099('0x4b')](handleError(_0x263412,null));};exports[_0x9099('0x51')]=function(_0x2a4b95,_0x4e852c){if(_0x2a4b95['body']['id']){delete _0x2a4b95[_0x9099('0x4f')]['id'];}return db[_0x9099('0x3e')]['find']({'where':{'id':_0x2a4b95[_0x9099('0x41')]['id']}})['then'](handleEntityNotFound(_0x4e852c,null))[_0x9099('0x22')](saveUpdates(_0x2a4b95['body'],null))[_0x9099('0x22')](respondWithResult(_0x4e852c,null))[_0x9099('0x4b')](handleError(_0x4e852c,null));};exports[_0x9099('0x23')]=function(_0x285b1a,_0x3b2668){return db['JscriptyProject'][_0x9099('0x43')]({'where':{'id':_0x285b1a[_0x9099('0x41')]['id']}})[_0x9099('0x22')](handleEntityNotFound(_0x3b2668,null))[_0x9099('0x22')](removeEntity(_0x3b2668,null))['catch'](handleError(_0x3b2668,null));};exports[_0x9099('0x52')]=function(_0x4c2503,_0x3c7a1e,_0x563c9a){var _0x352d77={'raw':!![],'where':{}};var _0x48b0fa={};var _0x5bf674={'count':0x0,'rows':[]};return db[_0x9099('0x3e')][_0x9099('0x53')]({'where':{'id':_0x4c2503[_0x9099('0x41')]['id']}})[_0x9099('0x22')](handleEntityNotFound(_0x3c7a1e,null))['then'](function(_0x5fbbee){if(_0x5fbbee){_0x48b0fa[_0x9099('0x32')]=_[_0x9099('0x30')](db[_0x9099('0x54')][_0x9099('0x2d')]);_0x48b0fa[_0x9099('0x2f')]=_[_0x9099('0x30')](_0x4c2503[_0x9099('0x2f')]);_0x48b0fa[_0x9099('0x39')]=_[_0x9099('0x31')](_0x48b0fa[_0x9099('0x32')],_0x48b0fa[_0x9099('0x2f')]);_0x352d77['attributes']=_[_0x9099('0x31')](_0x48b0fa[_0x9099('0x32')],qs[_0x9099('0x34')](_0x4c2503[_0x9099('0x2f')]['fields']));_0x352d77[_0x9099('0x33')]=_0x352d77[_0x9099('0x33')][_0x9099('0x42')]?_0x352d77[_0x9099('0x33')]:_0x48b0fa['model'];if(!_0x4c2503[_0x9099('0x2f')][_0x9099('0x35')]('nolimit')){_0x352d77[_0x9099('0x1b')]=qs[_0x9099('0x1b')](_0x4c2503['query'][_0x9099('0x1b')]);_0x352d77[_0x9099('0x19')]=qs[_0x9099('0x19')](_0x4c2503[_0x9099('0x2f')][_0x9099('0x19')]);}_0x352d77[_0x9099('0x36')]=qs[_0x9099('0x37')](_0x4c2503[_0x9099('0x2f')][_0x9099('0x37')]);_0x352d77['where']=qs['filters'](_[_0x9099('0x55')](_0x4c2503[_0x9099('0x2f')],_0x48b0fa['filters']));_0x352d77[_0x9099('0x38')][_0x9099('0x56')]=_0x5fbbee['id'];if(_0x4c2503['query']['filter']){_0x352d77[_0x9099('0x38')]=_[_0x9099('0x3a')](_0x352d77[_0x9099('0x38')],{'$or':_[_0x9099('0x2c')](_0x352d77['attributes'],function(_0x9b5f85){var _0x2e6e27={};_0x2e6e27[_0x9b5f85]={'$like':'%'+_0x4c2503[_0x9099('0x2f')][_0x9099('0x3c')]+'%'};return _0x2e6e27;})});}_0x352d77=_[_0x9099('0x3a')]({},_0x352d77,_0x4c2503[_0x9099('0x3d')]);return db[_0x9099('0x54')][_0x9099('0x1c')]({'where':_0x352d77[_0x9099('0x38')]})['then'](function(_0x1e31ab){_0x5bf674[_0x9099('0x1c')]=_0x1e31ab;if(_0x4c2503[_0x9099('0x2f')][_0x9099('0x3f')]){_0x352d77['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x9099('0x57')](_0x352d77);})[_0x9099('0x22')](function(_0x429106){_0x5bf674[_0x9099('0x58')]=_0x429106;return _0x5bf674;});}})[_0x9099('0x22')](respondWithFilteredResult(_0x3c7a1e,_0x352d77))[_0x9099('0x4b')](handleError(_0x3c7a1e,null));};exports['getAnswers']=function(_0x24b984,_0x549a49,_0x2c7d78){var _0xc0002c={'raw':!![],'where':{}};var _0x51d217={};var _0x3c3c94={'count':0x0,'rows':[]};return db[_0x9099('0x3e')][_0x9099('0x53')]({'where':{'id':_0x24b984['params']['id']}})[_0x9099('0x22')](handleEntityNotFound(_0x549a49,null))['then'](function(_0x2a38ac){if(_0x2a38ac){_0x51d217[_0x9099('0x32')]=_[_0x9099('0x30')](db[_0x9099('0x59')]['rawAttributes']);_0x51d217[_0x9099('0x2f')]=_['keys'](_0x24b984[_0x9099('0x2f')]);_0x51d217[_0x9099('0x39')]=_['intersection'](_0x51d217[_0x9099('0x32')],_0x51d217['query']);_0xc0002c['attributes']=_[_0x9099('0x31')](_0x51d217[_0x9099('0x32')],qs['fields'](_0x24b984['query'][_0x9099('0x34')]));_0xc0002c[_0x9099('0x33')]=_0xc0002c[_0x9099('0x33')][_0x9099('0x42')]?_0xc0002c[_0x9099('0x33')]:_0x51d217[_0x9099('0x32')];if(!_0x24b984[_0x9099('0x2f')][_0x9099('0x35')](_0x9099('0x5a'))){_0xc0002c[_0x9099('0x1b')]=qs[_0x9099('0x1b')](_0x24b984[_0x9099('0x2f')]['limit']);_0xc0002c[_0x9099('0x19')]=qs[_0x9099('0x19')](_0x24b984[_0x9099('0x2f')][_0x9099('0x19')]);}_0xc0002c[_0x9099('0x36')]=qs['sort'](_0x24b984[_0x9099('0x2f')][_0x9099('0x37')]);_0xc0002c[_0x9099('0x38')]=qs[_0x9099('0x39')](_[_0x9099('0x55')](_0x24b984[_0x9099('0x2f')],_0x51d217[_0x9099('0x39')]));_0xc0002c[_0x9099('0x38')][_0x9099('0x56')]=_0x2a38ac['id'];if(_0x24b984[_0x9099('0x2f')][_0x9099('0x3c')]){_0xc0002c[_0x9099('0x38')]=_[_0x9099('0x3a')](_0xc0002c[_0x9099('0x38')],{'$or':_[_0x9099('0x2c')](_0xc0002c[_0x9099('0x33')],function(_0x5c230a){var _0x256896={};_0x256896[_0x5c230a]={'$like':'%'+_0x24b984[_0x9099('0x2f')][_0x9099('0x3c')]+'%'};return _0x256896;})});}_0xc0002c=_['merge']({},_0xc0002c,_0x24b984['options']);return db[_0x9099('0x59')][_0x9099('0x1c')]({'where':_0xc0002c[_0x9099('0x38')]})[_0x9099('0x22')](function(_0x165ee5){_0x3c3c94[_0x9099('0x1c')]=_0x165ee5;if(_0x24b984['query'][_0x9099('0x3f')]){_0xc0002c[_0x9099('0x40')]=[{'all':!![]}];}return db[_0x9099('0x59')][_0x9099('0x57')](_0xc0002c);})['then'](function(_0x154406){_0x3c3c94['rows']=_0x154406;return _0x3c3c94;});}})[_0x9099('0x22')](respondWithFilteredResult(_0x549a49,_0xc0002c))[_0x9099('0x4b')](handleError(_0x549a49,null));};function char(_0x144c52){return _0x9099('0x5b')===typeof _0x144c52?String[_0x9099('0x5c')][_0x9099('0x1f')](null,arguments):_0x144c52;}function needsEncapsulation(_0x2f1285){return!!_0x2f1285&&(_0x2f1285['toString']()[_0x9099('0x5d')](char(0xd))>=0x0||_0x2f1285[_0x9099('0x5e')]()[_0x9099('0x5d')](char(0xa))>=0x0||_0x2f1285[_0x9099('0x5e')]()[_0x9099('0x5d')](char(0x2c))>=0x0||_0x2f1285[_0x9099('0x5e')]()[_0x9099('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x508114){var _0x59421e=char(0x22),_0x25f3ab='\x5c'+char(0x22),_0x4cd168=_0x508114[_0x9099('0x5e')]()[_0x9099('0x5f')](new RegExp(_0x59421e,'g'),_0x25f3ab);return _0x59421e+_0x4cd168+_0x59421e;}exports[_0x9099('0x60')]=function(_0x2d5ef7,_0x55b162,_0x484a1e){var _0x87e61,_0xc15e1f;var _0x4cd330={'where':{'ProjectId':_0x2d5ef7[_0x9099('0x41')]['id']}};if(_0x2d5ef7[_0x9099('0x2f')]['startTime']){_0x4cd330[_0x9099('0x38')][_0x9099('0x61')]=JSON['parse'](_0x2d5ef7[_0x9099('0x2f')][_0x9099('0x62')]);}return db['JscriptySessionReport'][_0x9099('0x57')](_0x4cd330)[_0x9099('0x22')](handleEntityNotFound(_0x55b162,null))[_0x9099('0x22')](function(_0x56cadb){if(_0x56cadb){_0x87e61=_0x56cadb;return db[_0x9099('0x63')][_0x9099('0x57')]({'where':{'SessionId':{'$in':_['map'](_0x87e61,'id')},'ProjectId':_0x2d5ef7[_0x9099('0x41')]['id']},'order':_0x9099('0x64')});}})[_0x9099('0x22')](handleEntityNotFound(_0x55b162,null))['then'](function(_0x425a6c){if(_0x425a6c){_0xc15e1f=_0x425a6c;var _0x3de194={};for(var _0x59381a=0x0,_0x39625e=_0xc15e1f[_0x9099('0x42')];_0x59381a<_0x39625e;_0x59381a++){if(!_0x3de194[_0x9099('0x35')](_0xc15e1f[_0x59381a][_0x9099('0x65')])){_0x3de194[_0xc15e1f[_0x59381a][_0x9099('0x65')]]=needsEncapsulation(_0xc15e1f[_0x59381a][_0x9099('0x66')])?encapsulate(_0xc15e1f[_0x59381a][_0x9099('0x66')]):_0xc15e1f[_0x59381a]['question'];}}var _0x3fe8a8=[],_0x42f375={};for(var _0x40647f=0x0,_0xac6290=_0x87e61[_0x9099('0x42')];_0x40647f<_0xac6290;_0x40647f++){_0x42f375={'ProjectId':_0x2d5ef7['params']['id'],'SessionId':_0x87e61[_0x40647f]['id'],'StartTime':moment(_0x87e61[_0x40647f]['starttime'])[_0x9099('0x67')](_0x9099('0x68'))};for(var _0x49e55b=0x0,_0x29fe46=_0xc15e1f['length'];_0x49e55b<_0x29fe46;_0x49e55b++){if(_0xc15e1f[_0x49e55b][_0x9099('0x69')]==_0x87e61[_0x40647f]['id']&&_0x3de194['hasOwnProperty'](_0xc15e1f[_0x49e55b][_0x9099('0x65')])){_0x42f375[_0x3de194[_0xc15e1f[_0x49e55b]['questionId']]]=_0xc15e1f[_0x49e55b]['answer'];}}for(var _0xb01fd7 in _0x3de194){if(!_0x42f375['hasOwnProperty'](_0x3de194[_0xb01fd7])){_0x42f375[_0x3de194[_0xb01fd7]]=null;}}_0x3fe8a8[_0x9099('0x6a')](_0x42f375);}return _0x3fe8a8;}})['then'](function(_0x136f46){if(!_[_0x9099('0x6b')](_0x136f46)){var _0x285ef2=toCsv(_0x136f46);var _0x2715e1=Date['now']();fs[_0x9099('0x6c')](util[_0x9099('0x67')](_0x9099('0x6d'),_0x2d5ef7[_0x9099('0x41')]['id'],_0x2715e1),_0x285ef2);_0x55b162[_0x9099('0x6e')](_0x9099('0x6f'),'attachment;\x20filename='+util[_0x9099('0x67')](_0x9099('0x70'),_0x2d5ef7[_0x9099('0x41')]['id'],_0x2715e1));_0x55b162['setHeader']('Content-type',_0x9099('0x71'));return _0x55b162['download'](util[_0x9099('0x67')](_0x9099('0x6d'),_0x2d5ef7[_0x9099('0x41')]['id'],_0x2715e1));}else{return _0x55b162[_0x9099('0x17')](0xcc);}})[_0x9099('0x4b')](handleError(_0x55b162,null));}; \ No newline at end of file +var _0x4060=['replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','SessionId','answer','push','isEmpty','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','get','Projects','destroy','stack','name','map','JscriptyProject','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','fields','include','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','create','error','omit','updatedAt','body','createdAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','order','number','fromCharCode','toString','indexOf'];(function(_0x48a20f,_0x143d42){var _0x509bd9=function(_0x31bb08){while(--_0x31bb08){_0x48a20f['push'](_0x48a20f['shift']());}};_0x509bd9(++_0x143d42);}(_0x4060,0x89));var _0x0406=function(_0x291de6,_0x397b6b){_0x291de6=_0x291de6-0x0;var _0x467011=_0x4060[_0x291de6];return _0x467011;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0406('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0406('0x1'));var rp=require(_0x0406('0x2'));var moment=require(_0x0406('0x3'));var BPromise=require(_0x0406('0x4'));var Mustache=require(_0x0406('0x5'));var util=require(_0x0406('0x6'));var path=require('path');var sox=require(_0x0406('0x7'));var csv=require(_0x0406('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0406('0x9'));var _=require(_0x0406('0xa'));var squel=require('squel');var crypto=require(_0x0406('0xb'));var jsforce=require(_0x0406('0xc'));var deskjs=require(_0x0406('0xd'));var toCsv=require(_0x0406('0x8'));var querystring=require(_0x0406('0xe'));var Papa=require(_0x0406('0xf'));var Redis=require(_0x0406('0x10'));var authService=require(_0x0406('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0406('0x12'));var hardwareService=require(_0x0406('0x13'));var logger=require(_0x0406('0x14'))(_0x0406('0x15'));var utils=require(_0x0406('0x16'));var config=require(_0x0406('0x17'));var licenseUtil=require(_0x0406('0x18'));var db=require(_0x0406('0x19'))['db'];function respondWithStatusCode(_0x495ac7,_0x42f512){_0x42f512=_0x42f512||0xcc;return function(_0x26564d){if(_0x26564d){return _0x495ac7[_0x0406('0x1a')](_0x42f512);}return _0x495ac7['status'](_0x42f512)['end']();};}function respondWithResult(_0xf33530,_0x27d60c){_0x27d60c=_0x27d60c||0xc8;return function(_0x8c4e55){if(_0x8c4e55){return _0xf33530[_0x0406('0x1b')](_0x27d60c)[_0x0406('0x1c')](_0x8c4e55);}};}function respondWithFilteredResult(_0xa4cb79,_0x9dcf69){return function(_0x3bf5d5){if(_0x3bf5d5){var _0x3ba062=typeof _0x9dcf69[_0x0406('0x1d')]===_0x0406('0x1e')&&typeof _0x9dcf69[_0x0406('0x1f')]===_0x0406('0x1e');var _0x48e384=_0x3bf5d5[_0x0406('0x20')];var _0x13e3e8=_0x3ba062?0x0:_0x9dcf69[_0x0406('0x1d')];var _0x5ad615=_0x3ba062?_0x3bf5d5['count']:_0x9dcf69[_0x0406('0x1d')]+_0x9dcf69['limit'];var _0x4f46f9;if(_0x5ad615>=_0x48e384){_0x5ad615=_0x48e384;_0x4f46f9=0xc8;}else{_0x4f46f9=0xce;}_0xa4cb79[_0x0406('0x1b')](_0x4f46f9);return _0xa4cb79['set'](_0x0406('0x21'),_0x13e3e8+'-'+_0x5ad615+'/'+_0x48e384)[_0x0406('0x1c')](_0x3bf5d5);}return null;};}function patchUpdates(_0x3696b3){return function(_0x12691d){try{jsonpatch[_0x0406('0x22')](_0x12691d,_0x3696b3,!![]);}catch(_0x2ca574){return BPromise[_0x0406('0x23')](_0x2ca574);}return _0x12691d['save']();};}function saveUpdates(_0xc5dc4e,_0x3db44e){return function(_0x4f1e1a){if(_0x4f1e1a){return _0x4f1e1a[_0x0406('0x24')](_0xc5dc4e)[_0x0406('0x25')](function(_0x2b2519){return _0x2b2519;});}return null;};}function removeEntity(_0x473c2f,_0x2750d4){return function(_0x22140f){if(_0x22140f){return _0x22140f['destroy']()['then'](function(){var _0x25d29d=_0x22140f[_0x0406('0x26')]({'plain':!![]});var _0x3fc6ad=_0x0406('0x27');return db['UserProfileResource'][_0x0406('0x28')]({'where':{'type':_0x3fc6ad,'resourceId':_0x25d29d['id']}})[_0x0406('0x25')](function(){return _0x22140f;});})[_0x0406('0x25')](function(){_0x473c2f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eb69c,_0x4e0c83){return function(_0x5394ff){if(!_0x5394ff){_0x5eb69c[_0x0406('0x1a')](0x194);}return _0x5394ff;};}function handleError(_0x4eadd6,_0x400a0b){_0x400a0b=_0x400a0b||0x1f4;return function(_0x59a683){logger['error'](_0x59a683[_0x0406('0x29')]);if(_0x59a683[_0x0406('0x2a')]){delete _0x59a683[_0x0406('0x2a')];}_0x4eadd6[_0x0406('0x1b')](_0x400a0b)['send'](_0x59a683);};}exports['index']=function(_0x5baa09,_0x50d2c2){var _0xcc67a4={},_0x2ebed6={},_0x1b305c={'count':0x0,'rows':[]};var _0xa744fd=_[_0x0406('0x2b')](db[_0x0406('0x2c')]['rawAttributes'],function(_0x3645bd){return{'name':_0x3645bd['fieldName'],'type':_0x3645bd[_0x0406('0x2d')][_0x0406('0x2e')]};});_0x2ebed6[_0x0406('0x2f')]=_[_0x0406('0x2b')](_0xa744fd,_0x0406('0x2a'));_0x2ebed6[_0x0406('0x30')]=_['keys'](_0x5baa09[_0x0406('0x30')]);_0x2ebed6[_0x0406('0x31')]=_[_0x0406('0x32')](_0x2ebed6[_0x0406('0x2f')],_0x2ebed6[_0x0406('0x30')]);_0xcc67a4['attributes']=_[_0x0406('0x32')](_0x2ebed6['model'],qs['fields'](_0x5baa09['query']['fields']));_0xcc67a4[_0x0406('0x33')]=_0xcc67a4[_0x0406('0x33')][_0x0406('0x34')]?_0xcc67a4[_0x0406('0x33')]:_0x2ebed6['model'];if(!_0x5baa09['query'][_0x0406('0x35')](_0x0406('0x36'))){_0xcc67a4['limit']=qs[_0x0406('0x1f')](_0x5baa09['query'][_0x0406('0x1f')]);_0xcc67a4[_0x0406('0x1d')]=qs[_0x0406('0x1d')](_0x5baa09[_0x0406('0x30')][_0x0406('0x1d')]);}_0xcc67a4['order']=qs[_0x0406('0x37')](_0x5baa09[_0x0406('0x30')]['sort']);_0xcc67a4[_0x0406('0x38')]=qs[_0x0406('0x31')](_[_0x0406('0x39')](_0x5baa09[_0x0406('0x30')],_0x2ebed6['filters']),_0xa744fd);if(_0x5baa09[_0x0406('0x30')][_0x0406('0x3a')]){_0xcc67a4['where']=_[_0x0406('0x3b')](_0xcc67a4[_0x0406('0x38')],{'$or':_[_0x0406('0x2b')](_0xa744fd,function(_0xa14540){if(_0xa14540[_0x0406('0x2d')]!=='VIRTUAL'){var _0x5dd108={};_0x5dd108[_0xa14540[_0x0406('0x2a')]]={'$like':'%'+_0x5baa09[_0x0406('0x30')][_0x0406('0x3a')]+'%'};return _0x5dd108;}})});}_0xcc67a4=_[_0x0406('0x3b')]({},_0xcc67a4,_0x5baa09[_0x0406('0x3c')]);var _0x394305={'where':_0xcc67a4['where']};return db[_0x0406('0x2c')][_0x0406('0x20')](_0x394305)[_0x0406('0x25')](function(_0x1ef114){_0x1b305c[_0x0406('0x20')]=_0x1ef114;if(_0x5baa09[_0x0406('0x30')][_0x0406('0x3d')]){_0xcc67a4['include']=[{'all':!![]}];}return db[_0x0406('0x2c')][_0x0406('0x3e')](_0xcc67a4);})[_0x0406('0x25')](function(_0x1b9ace){_0x1b305c[_0x0406('0x3f')]=_0x1b9ace;return _0x1b305c;})[_0x0406('0x25')](respondWithFilteredResult(_0x50d2c2,_0xcc67a4))[_0x0406('0x40')](handleError(_0x50d2c2,null));};exports[_0x0406('0x41')]=function(_0x429528,_0x2d193e){var _0x203d36={'raw':![],'where':{'id':_0x429528[_0x0406('0x42')]['id']}},_0x52bac4={};_0x52bac4[_0x0406('0x2f')]=_[_0x0406('0x43')](db[_0x0406('0x2c')][_0x0406('0x44')]);_0x52bac4['query']=_[_0x0406('0x43')](_0x429528['query']);_0x52bac4[_0x0406('0x31')]=_[_0x0406('0x32')](_0x52bac4['model'],_0x52bac4[_0x0406('0x30')]);_0x203d36[_0x0406('0x33')]=_['intersection'](_0x52bac4[_0x0406('0x2f')],qs[_0x0406('0x45')](_0x429528['query']['fields']));_0x203d36[_0x0406('0x33')]=_0x203d36[_0x0406('0x33')][_0x0406('0x34')]?_0x203d36['attributes']:_0x52bac4[_0x0406('0x2f')];if(_0x429528[_0x0406('0x30')][_0x0406('0x3d')]){_0x203d36[_0x0406('0x46')]=[{'all':!![]}];}_0x203d36=_[_0x0406('0x3b')]({},_0x203d36,_0x429528[_0x0406('0x3c')]);return db[_0x0406('0x2c')]['find'](_0x203d36)[_0x0406('0x25')](handleEntityNotFound(_0x2d193e,null))[_0x0406('0x25')](respondWithResult(_0x2d193e,null))['catch'](handleError(_0x2d193e,null));};exports['create']=function(_0x56f1cf,_0x937367){return db[_0x0406('0x2c')]['create'](_0x56f1cf['body'],{})[_0x0406('0x25')](function(_0x8fbb24){var _0x56966b=_0x56f1cf[_0x0406('0x47')][_0x0406('0x26')]({'plain':!![]});if(!_0x56966b)throw new Error(_0x0406('0x48'));if(_0x56966b['role']===_0x0406('0x47')){var _0x5b9c35=_0x8fbb24[_0x0406('0x26')]({'plain':!![]});var _0x134d24='Projects';return db[_0x0406('0x49')][_0x0406('0x4a')]({'where':{'name':_0x134d24,'userProfileId':_0x56966b[_0x0406('0x4b')]},'raw':!![]})['then'](function(_0x416a56){if(_0x416a56&&_0x416a56[_0x0406('0x4c')]===0x0){return db[_0x0406('0x4d')][_0x0406('0x4e')]({'name':_0x5b9c35[_0x0406('0x2a')],'resourceId':_0x5b9c35['id'],'type':_0x416a56['name'],'sectionId':_0x416a56['id']},{})[_0x0406('0x25')](function(){return _0x8fbb24;});}else{return _0x8fbb24;}})[_0x0406('0x40')](function(_0x3485e1){logger[_0x0406('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3485e1);throw _0x3485e1;});}return _0x8fbb24;})[_0x0406('0x25')](respondWithResult(_0x937367,0xc9))[_0x0406('0x40')](handleError(_0x937367,null));};exports['clone']=function(_0x5bbe96,_0x4b0eb5){var _0x43a239={'where':{'id':_0x5bbe96[_0x0406('0x42')]['id']}},_0x5bb41a={};_0x5bb41a['model']=_[_0x0406('0x43')](db['JscriptyProject']['rawAttributes']);_0x43a239['attributes']=_[_0x0406('0x32')](_0x5bb41a[_0x0406('0x2f')],qs[_0x0406('0x45')](_0x5bbe96['query'][_0x0406('0x45')]));_0x43a239[_0x0406('0x33')]=_0x43a239[_0x0406('0x33')]['length']?_0x43a239['attributes']:_0x5bb41a[_0x0406('0x2f')];if(_0x5bbe96[_0x0406('0x30')]['includeAll']){_0x43a239[_0x0406('0x46')]=[{'all':!![]}];}_0x43a239=_[_0x0406('0x3b')]({},_0x43a239,_0x5bbe96[_0x0406('0x3c')]);return db[_0x0406('0x2c')][_0x0406('0x4a')](_0x43a239)[_0x0406('0x25')](handleEntityNotFound(_0x4b0eb5,null))[_0x0406('0x25')](function(_0x5d2529){if(_0x5d2529){var _0x9533c0=_0x5d2529[_0x0406('0x26')]({'plain':!![]});_0x9533c0=qs[_0x0406('0x50')](_0x9533c0,['id','createdAt',_0x0406('0x51')]);_0x5bbe96[_0x0406('0x52')]=_[_0x0406('0x50')](_0x5bbe96['body'],['id',_0x0406('0x53'),_0x0406('0x51')]);return db['JscriptyProject']['create'](_[_0x0406('0x3b')](_0x9533c0,_0x5bbe96['body']),{'include':_0x5bbe96[_0x0406('0x30')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x69f30b){var _0x59f5c6=_0x5bbe96['user'][_0x0406('0x26')]({'plain':!![]});if(!_0x59f5c6)throw new Error(_0x0406('0x48'));if(_0x59f5c6[_0x0406('0x54')]===_0x0406('0x47')){var _0x2ca149=_0x69f30b[_0x0406('0x26')]({'plain':!![]});var _0x4c695d='Projects';return db[_0x0406('0x49')]['find']({'where':{'name':_0x4c695d,'userProfileId':_0x59f5c6[_0x0406('0x4b')]},'raw':!![]})[_0x0406('0x25')](function(_0x41f710){if(_0x41f710&&_0x41f710[_0x0406('0x4c')]===0x0){return db[_0x0406('0x4d')][_0x0406('0x4e')]({'name':_0x2ca149[_0x0406('0x2a')],'resourceId':_0x2ca149['id'],'type':_0x41f710[_0x0406('0x2a')],'sectionId':_0x41f710['id']},{})[_0x0406('0x25')](function(){return _0x69f30b;});}else{return _0x69f30b;}})['catch'](function(_0x3fe68f){logger['error'](_0x0406('0x55'),_0x3fe68f);throw _0x3fe68f;});}return _0x69f30b;});}})[_0x0406('0x25')](respondWithResult(_0x4b0eb5,0xc9))[_0x0406('0x40')](handleError(_0x4b0eb5,null));};exports[_0x0406('0x24')]=function(_0x276d97,_0x1f047e){if(_0x276d97[_0x0406('0x52')]['id']){delete _0x276d97['body']['id'];}return db[_0x0406('0x2c')][_0x0406('0x4a')]({'where':{'id':_0x276d97[_0x0406('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f047e,null))[_0x0406('0x25')](saveUpdates(_0x276d97[_0x0406('0x52')],null))['then'](respondWithResult(_0x1f047e,null))['catch'](handleError(_0x1f047e,null));};exports['destroy']=function(_0x3fb3ed,_0x1ab382){return db[_0x0406('0x2c')]['find']({'where':{'id':_0x3fb3ed[_0x0406('0x42')]['id']}})[_0x0406('0x25')](handleEntityNotFound(_0x1ab382,null))[_0x0406('0x25')](removeEntity(_0x1ab382,null))[_0x0406('0x40')](handleError(_0x1ab382,null));};exports[_0x0406('0x56')]=function(_0x1a2a78,_0x19ac3b,_0x5cb4be){var _0x24aada={'raw':!![],'where':{}};var _0xbc2254={};var _0x1655b1={'count':0x0,'rows':[]};return db[_0x0406('0x2c')][_0x0406('0x57')]({'where':{'id':_0x1a2a78[_0x0406('0x42')]['id']}})[_0x0406('0x25')](handleEntityNotFound(_0x19ac3b,null))['then'](function(_0x2665a0){if(_0x2665a0){_0xbc2254[_0x0406('0x2f')]=_[_0x0406('0x43')](db['JscriptySessionReport'][_0x0406('0x44')]);_0xbc2254['query']=_[_0x0406('0x43')](_0x1a2a78[_0x0406('0x30')]);_0xbc2254[_0x0406('0x31')]=_['intersection'](_0xbc2254[_0x0406('0x2f')],_0xbc2254[_0x0406('0x30')]);_0x24aada[_0x0406('0x33')]=_[_0x0406('0x32')](_0xbc2254[_0x0406('0x2f')],qs[_0x0406('0x45')](_0x1a2a78['query'][_0x0406('0x45')]));_0x24aada[_0x0406('0x33')]=_0x24aada[_0x0406('0x33')][_0x0406('0x34')]?_0x24aada[_0x0406('0x33')]:_0xbc2254[_0x0406('0x2f')];if(!_0x1a2a78[_0x0406('0x30')][_0x0406('0x35')](_0x0406('0x36'))){_0x24aada['limit']=qs[_0x0406('0x1f')](_0x1a2a78['query'][_0x0406('0x1f')]);_0x24aada['offset']=qs[_0x0406('0x1d')](_0x1a2a78['query']['offset']);}_0x24aada['order']=qs[_0x0406('0x37')](_0x1a2a78[_0x0406('0x30')][_0x0406('0x37')]);_0x24aada[_0x0406('0x38')]=qs[_0x0406('0x31')](_['pick'](_0x1a2a78['query'],_0xbc2254[_0x0406('0x31')]));_0x24aada[_0x0406('0x38')][_0x0406('0x58')]=_0x2665a0['id'];if(_0x1a2a78[_0x0406('0x30')][_0x0406('0x3a')]){_0x24aada[_0x0406('0x38')]=_[_0x0406('0x3b')](_0x24aada[_0x0406('0x38')],{'$or':_[_0x0406('0x2b')](_0x24aada[_0x0406('0x33')],function(_0x5007a3){var _0x5459dd={};_0x5459dd[_0x5007a3]={'$like':'%'+_0x1a2a78['query'][_0x0406('0x3a')]+'%'};return _0x5459dd;})});}_0x24aada=_[_0x0406('0x3b')]({},_0x24aada,_0x1a2a78[_0x0406('0x3c')]);return db[_0x0406('0x59')][_0x0406('0x20')]({'where':_0x24aada[_0x0406('0x38')]})[_0x0406('0x25')](function(_0x81d541){_0x1655b1[_0x0406('0x20')]=_0x81d541;if(_0x1a2a78[_0x0406('0x30')]['includeAll']){_0x24aada[_0x0406('0x46')]=[{'all':!![]}];}return db[_0x0406('0x59')][_0x0406('0x3e')](_0x24aada);})[_0x0406('0x25')](function(_0x3e06b0){_0x1655b1[_0x0406('0x3f')]=_0x3e06b0;return _0x1655b1;});}})[_0x0406('0x25')](respondWithFilteredResult(_0x19ac3b,_0x24aada))[_0x0406('0x40')](handleError(_0x19ac3b,null));};exports[_0x0406('0x5a')]=function(_0x1d9a02,_0x39d654,_0x568240){var _0x12729c={'raw':!![],'where':{}};var _0x3171bf={};var _0x36030a={'count':0x0,'rows':[]};return db[_0x0406('0x2c')][_0x0406('0x57')]({'where':{'id':_0x1d9a02['params']['id']}})[_0x0406('0x25')](handleEntityNotFound(_0x39d654,null))[_0x0406('0x25')](function(_0x30d8b2){if(_0x30d8b2){_0x3171bf[_0x0406('0x2f')]=_[_0x0406('0x43')](db[_0x0406('0x5b')][_0x0406('0x44')]);_0x3171bf['query']=_[_0x0406('0x43')](_0x1d9a02['query']);_0x3171bf[_0x0406('0x31')]=_[_0x0406('0x32')](_0x3171bf[_0x0406('0x2f')],_0x3171bf[_0x0406('0x30')]);_0x12729c['attributes']=_[_0x0406('0x32')](_0x3171bf['model'],qs[_0x0406('0x45')](_0x1d9a02[_0x0406('0x30')]['fields']));_0x12729c[_0x0406('0x33')]=_0x12729c[_0x0406('0x33')]['length']?_0x12729c[_0x0406('0x33')]:_0x3171bf[_0x0406('0x2f')];if(!_0x1d9a02[_0x0406('0x30')]['hasOwnProperty']('nolimit')){_0x12729c[_0x0406('0x1f')]=qs['limit'](_0x1d9a02['query']['limit']);_0x12729c['offset']=qs[_0x0406('0x1d')](_0x1d9a02['query'][_0x0406('0x1d')]);}_0x12729c[_0x0406('0x5c')]=qs['sort'](_0x1d9a02[_0x0406('0x30')][_0x0406('0x37')]);_0x12729c[_0x0406('0x38')]=qs[_0x0406('0x31')](_[_0x0406('0x39')](_0x1d9a02['query'],_0x3171bf['filters']));_0x12729c[_0x0406('0x38')]['ProjectId']=_0x30d8b2['id'];if(_0x1d9a02[_0x0406('0x30')]['filter']){_0x12729c[_0x0406('0x38')]=_[_0x0406('0x3b')](_0x12729c[_0x0406('0x38')],{'$or':_['map'](_0x12729c['attributes'],function(_0x2cdb2c){var _0x4aea25={};_0x4aea25[_0x2cdb2c]={'$like':'%'+_0x1d9a02[_0x0406('0x30')][_0x0406('0x3a')]+'%'};return _0x4aea25;})});}_0x12729c=_[_0x0406('0x3b')]({},_0x12729c,_0x1d9a02[_0x0406('0x3c')]);return db[_0x0406('0x5b')][_0x0406('0x20')]({'where':_0x12729c[_0x0406('0x38')]})[_0x0406('0x25')](function(_0x4dcae3){_0x36030a[_0x0406('0x20')]=_0x4dcae3;if(_0x1d9a02[_0x0406('0x30')]['includeAll']){_0x12729c[_0x0406('0x46')]=[{'all':!![]}];}return db[_0x0406('0x5b')][_0x0406('0x3e')](_0x12729c);})[_0x0406('0x25')](function(_0x596172){_0x36030a['rows']=_0x596172;return _0x36030a;});}})[_0x0406('0x25')](respondWithFilteredResult(_0x39d654,_0x12729c))[_0x0406('0x40')](handleError(_0x39d654,null));};function char(_0xa6b4c7){return _0x0406('0x5d')===typeof _0xa6b4c7?String[_0x0406('0x5e')][_0x0406('0x22')](null,arguments):_0xa6b4c7;}function needsEncapsulation(_0x3d84e4){return!!_0x3d84e4&&(_0x3d84e4[_0x0406('0x5f')]()[_0x0406('0x60')](char(0xd))>=0x0||_0x3d84e4[_0x0406('0x5f')]()[_0x0406('0x60')](char(0xa))>=0x0||_0x3d84e4[_0x0406('0x5f')]()['indexOf'](char(0x2c))>=0x0||_0x3d84e4[_0x0406('0x5f')]()[_0x0406('0x60')](char(0x22))>=0x0);}function encapsulate(_0x3a972c){var _0x3eb22b=char(0x22),_0xaccf0b='\x5c'+char(0x22),_0x422994=_0x3a972c[_0x0406('0x5f')]()[_0x0406('0x61')](new RegExp(_0x3eb22b,'g'),_0xaccf0b);return _0x3eb22b+_0x422994+_0x3eb22b;}exports[_0x0406('0x62')]=function(_0x2e61c6,_0x21aa83,_0x4f2b88){var _0x216c26,_0x34c256;var _0x357b52={'where':{'ProjectId':_0x2e61c6[_0x0406('0x42')]['id']}};if(_0x2e61c6[_0x0406('0x30')][_0x0406('0x63')]){_0x357b52[_0x0406('0x38')][_0x0406('0x64')]=JSON[_0x0406('0x65')](_0x2e61c6[_0x0406('0x30')][_0x0406('0x63')]);}return db[_0x0406('0x59')][_0x0406('0x3e')](_0x357b52)[_0x0406('0x25')](handleEntityNotFound(_0x21aa83,null))[_0x0406('0x25')](function(_0x24f7fd){if(_0x24f7fd){_0x216c26=_0x24f7fd;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x0406('0x2b')](_0x216c26,'id')},'ProjectId':_0x2e61c6[_0x0406('0x42')]['id']},'order':_0x0406('0x66')});}})['then'](handleEntityNotFound(_0x21aa83,null))[_0x0406('0x25')](function(_0x53169b){if(_0x53169b){_0x34c256=_0x53169b;var _0x330ac5={};for(var _0x3374e5=0x0,_0xdad763=_0x34c256[_0x0406('0x34')];_0x3374e5<_0xdad763;_0x3374e5++){if(!_0x330ac5[_0x0406('0x35')](_0x34c256[_0x3374e5][_0x0406('0x67')])){_0x330ac5[_0x34c256[_0x3374e5]['questionId']]=needsEncapsulation(_0x34c256[_0x3374e5][_0x0406('0x68')])?encapsulate(_0x34c256[_0x3374e5][_0x0406('0x68')]):_0x34c256[_0x3374e5]['question'];}}var _0x44584d=[],_0x19f8d3={};for(var _0x5b24c5=0x0,_0x41db86=_0x216c26[_0x0406('0x34')];_0x5b24c5<_0x41db86;_0x5b24c5++){_0x19f8d3={'ProjectId':_0x2e61c6['params']['id'],'SessionId':_0x216c26[_0x5b24c5]['id'],'StartTime':moment(_0x216c26[_0x5b24c5][_0x0406('0x64')])[_0x0406('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x284a14=0x0,_0x9ba178=_0x34c256[_0x0406('0x34')];_0x284a14<_0x9ba178;_0x284a14++){if(_0x34c256[_0x284a14][_0x0406('0x6a')]==_0x216c26[_0x5b24c5]['id']&&_0x330ac5[_0x0406('0x35')](_0x34c256[_0x284a14]['questionId'])){_0x19f8d3[_0x330ac5[_0x34c256[_0x284a14][_0x0406('0x67')]]]=_0x34c256[_0x284a14][_0x0406('0x6b')];}}for(var _0x740eb3 in _0x330ac5){if(!_0x19f8d3[_0x0406('0x35')](_0x330ac5[_0x740eb3])){_0x19f8d3[_0x330ac5[_0x740eb3]]=null;}}_0x44584d[_0x0406('0x6c')](_0x19f8d3);}return _0x44584d;}})[_0x0406('0x25')](function(_0x53eccb){if(!_[_0x0406('0x6d')](_0x53eccb)){var _0x442432=toCsv(_0x53eccb);var _0x5a7b87=Date['now']();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2e61c6[_0x0406('0x42')]['id'],_0x5a7b87),_0x442432);_0x21aa83[_0x0406('0x6e')](_0x0406('0x6f'),_0x0406('0x70')+util[_0x0406('0x69')](_0x0406('0x71'),_0x2e61c6[_0x0406('0x42')]['id'],_0x5a7b87));_0x21aa83['setHeader'](_0x0406('0x72'),_0x0406('0x73'));return _0x21aa83['download'](util['format'](_0x0406('0x74'),_0x2e61c6[_0x0406('0x42')]['id'],_0x5a7b87));}else{return _0x21aa83[_0x0406('0x1a')](0xcc);}})[_0x0406('0x40')](handleError(_0x21aa83,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index a31a92f..1fdfde0 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 _0xbf4e=['moment','bluebird','path','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util','../../config/logger','api'];(function(_0x4f0b37,_0xa15e94){var _0xe20fa4=function(_0xc9edb4){while(--_0xc9edb4){_0x4f0b37['push'](_0x4f0b37['shift']());}};_0xe20fa4(++_0xa15e94);}(_0xbf4e,0x172));var _0xebf4=function(_0x1baf2f,_0x211945){_0x1baf2f=_0x1baf2f-0x0;var _0x4e1b=_0xbf4e[_0x1baf2f];return _0x4e1b;};'use strict';var _=require(_0xebf4('0x0'));var util=require(_0xebf4('0x1'));var logger=require(_0xebf4('0x2'))(_0xebf4('0x3'));var moment=require(_0xebf4('0x4'));var BPromise=require(_0xebf4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xebf4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xebf4('0x7'));module[_0xebf4('0x8')]=function(_0x5adea8,_0x412bbe){return _0x5adea8[_0xebf4('0x9')](_0xebf4('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa786=['moment','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','../../config/logger','api'];(function(_0x3a6d48,_0x1fb34c){var _0x3446b4=function(_0x2e197d){while(--_0x2e197d){_0x3a6d48['push'](_0x3a6d48['shift']());}};_0x3446b4(++_0x1fb34c);}(_0xa786,0x1d2));var _0x6a78=function(_0x250e6c,_0x5f260a){_0x250e6c=_0x250e6c-0x0;var _0x2aa11e=_0xa786[_0x250e6c];return _0x2aa11e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a78('0x0'))(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var BPromise=require(_0x6a78('0x3'));var rp=require(_0x6a78('0x4'));var fs=require('fs');var path=require(_0x6a78('0x5'));var rimraf=require(_0x6a78('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a78('0x7'));module[_0x6a78('0x8')]=function(_0xc0be8b,_0x45470e){return _0xc0be8b[_0x6a78('0x9')](_0x6a78('0xa'),attributes,{'tableName':_0x6a78('0xb'),'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 903d78e..5c80396 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 _0x9bde=['code','message','JscriptyProject,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5c03b3,_0x3e1b06){var _0x3b976c=function(_0x14dbaf){while(--_0x14dbaf){_0x5c03b3['push'](_0x5c03b3['shift']());}};_0x3b976c(++_0x3e1b06);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4a012c,_0x2d3eac){_0x4a012c=_0x4a012c-0x0;var _0x45488e=_0x9bde[_0x4a012c];return _0x45488e;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3d219f,_0x224c01){var _0x1fb3fd=function(_0x506223){while(--_0x506223){_0x3d219f['push'](_0x3d219f['shift']());}};_0x1fb3fd(++_0x224c01);}(_0xe706,0xa3));var _0x6e70=function(_0x2fbb21,_0x1f3785){_0x2fbb21=_0x2fbb21-0x0;var _0x1caa91=_0xe706[_0x2fbb21];return _0x1caa91;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index c3acf41..7b7cc1f 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 _0x16ac=['exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x16ac,0x105));var _0xc16a=function(_0x1499c4,_0x57c5c3){_0x1499c4=_0x1499c4-0x0;var _0x3cf45a=_0x16ac[_0x1499c4];return _0x3cf45a;};'use strict';var multer=require('multer');var util=require(_0xc16a('0x0'));var path=require(_0xc16a('0x1'));var timeout=require('connect-timeout');var express=require(_0xc16a('0x2'));var router=express[_0xc16a('0x3')]();var fs_extra=require(_0xc16a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc16a('0x5'));var config=require(_0xc16a('0x6'));var controller=require(_0xc16a('0x7'));router[_0xc16a('0x8')]('/',auth[_0xc16a('0x9')](),controller[_0xc16a('0xa')]);router[_0xc16a('0x8')](_0xc16a('0xb'),auth['isAuthenticated'](),controller[_0xc16a('0xc')]);router[_0xc16a('0x8')](_0xc16a('0xd'),auth[_0xc16a('0x9')](),controller[_0xc16a('0xe')]);router[_0xc16a('0xf')]('/',auth['isAuthenticated'](),controller[_0xc16a('0x10')]);router[_0xc16a('0x11')](_0xc16a('0xd'),auth['isAuthenticated'](),controller[_0xc16a('0x12')]);router['delete'](_0xc16a('0xd'),auth[_0xc16a('0x9')](),controller['destroy']);module[_0xc16a('0x13')]=router; \ No newline at end of file +var _0xe276=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','exports','multer','util','path'];(function(_0x20334c,_0x10399e){var _0x19109a=function(_0x63d43f){while(--_0x63d43f){_0x20334c['push'](_0x20334c['shift']());}};_0x19109a(++_0x10399e);}(_0xe276,0xe1));var _0x6e27=function(_0x2fd540,_0x2cdc12){_0x2fd540=_0x2fd540-0x0;var _0x105ae0=_0xe276[_0x2fd540];return _0x105ae0;};'use strict';var multer=require(_0x6e27('0x0'));var util=require(_0x6e27('0x1'));var path=require(_0x6e27('0x2'));var timeout=require(_0x6e27('0x3'));var express=require('express');var router=express[_0x6e27('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6e27('0x5'));var interaction=require(_0x6e27('0x6'));var config=require('../../config/environment');var controller=require(_0x6e27('0x7'));router[_0x6e27('0x8')]('/',auth[_0x6e27('0x9')](),controller[_0x6e27('0xa')]);router[_0x6e27('0x8')](_0x6e27('0xb'),auth[_0x6e27('0x9')](),controller[_0x6e27('0xc')]);router[_0x6e27('0x8')](_0x6e27('0xd'),auth[_0x6e27('0x9')](),controller[_0x6e27('0xe')]);router[_0x6e27('0xf')]('/',auth[_0x6e27('0x9')](),controller['create']);router['put'](_0x6e27('0xd'),auth[_0x6e27('0x9')](),controller[_0x6e27('0x10')]);router[_0x6e27('0x11')](_0x6e27('0xd'),auth[_0x6e27('0x9')](),controller['destroy']);module[_0x6e27('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index ab719f9..25fc065 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0x4fcc5c,_0x50d811){_0x4fcc5c=_0x4fcc5c-0x0;var _0x23c301=_0x7a54[_0x4fcc5c];return _0x23c301;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x5bfb96,_0x4bf844){_0x5bfb96=_0x5bfb96-0x0;var _0x3c8fcf=_0x7a54[_0x5bfb96];return _0x3c8fcf;};'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 1c8e4c7..eb6cd2f 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 _0xf00a=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1e146c,_0x4c2bb4){var _0x414a6c=function(_0x4e577c){while(--_0x4e577c){_0x1e146c['push'](_0x1e146c['shift']());}};_0x414a6c(++_0x4c2bb4);}(_0xf00a,0x17a));var _0xaf00=function(_0x29e314,_0x19d592){_0x29e314=_0x29e314-0x0;var _0x4c9fcb=_0xf00a[_0x29e314];return _0x4c9fcb;};'use strict';var emlformat=require(_0xaf00('0x0'));var rimraf=require(_0xaf00('0x1'));var zipdir=require(_0xaf00('0x2'));var jsonpatch=require(_0xaf00('0x3'));var rp=require(_0xaf00('0x4'));var moment=require(_0xaf00('0x5'));var BPromise=require(_0xaf00('0x6'));var Mustache=require(_0xaf00('0x7'));var util=require(_0xaf00('0x8'));var path=require(_0xaf00('0x9'));var sox=require(_0xaf00('0xa'));var csv=require(_0xaf00('0xb'));var ejs=require(_0xaf00('0xc'));var fs=require('fs');var fs_extra=require(_0xaf00('0xd'));var _=require(_0xaf00('0xe'));var squel=require('squel');var crypto=require(_0xaf00('0xf'));var jsforce=require(_0xaf00('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaf00('0x11'));var Redis=require(_0xaf00('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xaf00('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaf00('0x14'));var utils=require(_0xaf00('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xaf00('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18e920,_0x746751){_0x746751=_0x746751||0xcc;return function(_0x5f5056){if(_0x5f5056){return _0x18e920[_0xaf00('0x17')](_0x746751);}return _0x18e920[_0xaf00('0x18')](_0x746751)[_0xaf00('0x19')]();};}function respondWithResult(_0x36009d,_0x3cabb3){_0x3cabb3=_0x3cabb3||0xc8;return function(_0xc056f0){if(_0xc056f0){return _0x36009d[_0xaf00('0x18')](_0x3cabb3)[_0xaf00('0x1a')](_0xc056f0);}};}function respondWithFilteredResult(_0x2b5e14,_0xad18c9){return function(_0x59d1e6){if(_0x59d1e6){var _0x3c45f4=typeof _0xad18c9['offset']==='undefined'&&typeof _0xad18c9[_0xaf00('0x1b')]===_0xaf00('0x1c');var _0x5bb6aa=_0x59d1e6[_0xaf00('0x1d')];var _0x3c57e1=_0x3c45f4?0x0:_0xad18c9[_0xaf00('0x1e')];var _0x55b6eb=_0x3c45f4?_0x59d1e6[_0xaf00('0x1d')]:_0xad18c9[_0xaf00('0x1e')]+_0xad18c9[_0xaf00('0x1b')];var _0x3344e3;if(_0x55b6eb>=_0x5bb6aa){_0x55b6eb=_0x5bb6aa;_0x3344e3=0xc8;}else{_0x3344e3=0xce;}_0x2b5e14[_0xaf00('0x18')](_0x3344e3);return _0x2b5e14[_0xaf00('0x1f')](_0xaf00('0x20'),_0x3c57e1+'-'+_0x55b6eb+'/'+_0x5bb6aa)[_0xaf00('0x1a')](_0x59d1e6);}return null;};}function patchUpdates(_0x3d9db3){return function(_0x143f70){try{jsonpatch[_0xaf00('0x21')](_0x143f70,_0x3d9db3,!![]);}catch(_0x45c6f6){return BPromise[_0xaf00('0x22')](_0x45c6f6);}return _0x143f70['save']();};}function saveUpdates(_0x103ebc,_0x3ed9c4){return function(_0x373893){if(_0x373893){return _0x373893[_0xaf00('0x23')](_0x103ebc)[_0xaf00('0x24')](function(_0x4d6177){return _0x4d6177;});}return null;};}function removeEntity(_0x2b7c35,_0x10bfb6){return function(_0x45b59a){if(_0x45b59a){return _0x45b59a[_0xaf00('0x25')]()[_0xaf00('0x24')](function(){_0x2b7c35['status'](0xcc)[_0xaf00('0x19')]();});}};}function handleEntityNotFound(_0xe87873,_0x53f6f3){return function(_0x18fe5e){if(!_0x18fe5e){_0xe87873[_0xaf00('0x17')](0x194);}return _0x18fe5e;};}function handleError(_0x2eb0d5,_0x1fd011){_0x1fd011=_0x1fd011||0x1f4;return function(_0x53ca43){logger[_0xaf00('0x26')](_0x53ca43[_0xaf00('0x27')]);if(_0x53ca43[_0xaf00('0x28')]){delete _0x53ca43[_0xaf00('0x28')];}_0x2eb0d5[_0xaf00('0x18')](_0x1fd011)[_0xaf00('0x29')](_0x53ca43);};}exports[_0xaf00('0x2a')]=function(_0x39b514,_0x139c3c){var _0x549ace={},_0x256a11={},_0x77b2a={'count':0x0,'rows':[]};var _0x390453=_[_0xaf00('0x2b')](db[_0xaf00('0x2c')][_0xaf00('0x2d')],function(_0x49f3d){return{'name':_0x49f3d[_0xaf00('0x2e')],'type':_0x49f3d['type']['key']};});_0x256a11[_0xaf00('0x2f')]=_[_0xaf00('0x2b')](_0x390453,_0xaf00('0x28'));_0x256a11[_0xaf00('0x30')]=_['keys'](_0x39b514['query']);_0x256a11[_0xaf00('0x31')]=_['intersection'](_0x256a11[_0xaf00('0x2f')],_0x256a11['query']);_0x549ace[_0xaf00('0x32')]=_[_0xaf00('0x33')](_0x256a11[_0xaf00('0x2f')],qs[_0xaf00('0x34')](_0x39b514[_0xaf00('0x30')][_0xaf00('0x34')]));_0x549ace[_0xaf00('0x32')]=_0x549ace[_0xaf00('0x32')][_0xaf00('0x35')]?_0x549ace['attributes']:_0x256a11[_0xaf00('0x2f')];if(!_0x39b514[_0xaf00('0x30')][_0xaf00('0x36')](_0xaf00('0x37'))){_0x549ace['limit']=qs[_0xaf00('0x1b')](_0x39b514[_0xaf00('0x30')][_0xaf00('0x1b')]);_0x549ace[_0xaf00('0x1e')]=qs['offset'](_0x39b514[_0xaf00('0x30')]['offset']);}_0x549ace[_0xaf00('0x38')]=qs[_0xaf00('0x39')](_0x39b514[_0xaf00('0x30')][_0xaf00('0x39')]);_0x549ace[_0xaf00('0x3a')]=qs[_0xaf00('0x31')](_[_0xaf00('0x3b')](_0x39b514[_0xaf00('0x30')],_0x256a11['filters']),_0x390453);if(_0x39b514[_0xaf00('0x30')]['filter']){_0x549ace[_0xaf00('0x3a')]=_[_0xaf00('0x3c')](_0x549ace[_0xaf00('0x3a')],{'$or':_[_0xaf00('0x2b')](_0x390453,function(_0x47eb88){if(_0x47eb88[_0xaf00('0x3d')]!==_0xaf00('0x3e')){var _0x40ef9b={};_0x40ef9b[_0x47eb88['name']]={'$like':'%'+_0x39b514[_0xaf00('0x30')][_0xaf00('0x3f')]+'%'};return _0x40ef9b;}})});}_0x549ace=_[_0xaf00('0x3c')]({},_0x549ace,_0x39b514[_0xaf00('0x40')]);var _0x262488={'where':_0x549ace[_0xaf00('0x3a')]};return db['JscriptyQuestionReport']['count'](_0x262488)[_0xaf00('0x24')](function(_0x2a3cf8){_0x77b2a['count']=_0x2a3cf8;if(_0x39b514[_0xaf00('0x30')][_0xaf00('0x41')]){_0x549ace[_0xaf00('0x42')]=[{'all':!![]}];}return db[_0xaf00('0x2c')][_0xaf00('0x43')](_0x549ace);})[_0xaf00('0x24')](function(_0x434d63){_0x77b2a[_0xaf00('0x44')]=_0x434d63;return _0x77b2a;})[_0xaf00('0x24')](respondWithFilteredResult(_0x139c3c,_0x549ace))['catch'](handleError(_0x139c3c,null));};exports[_0xaf00('0x45')]=function(_0xeae2fa,_0x599290){var _0x179872={'raw':!![],'where':{'id':_0xeae2fa['params']['id']}},_0x1982bc={};_0x1982bc[_0xaf00('0x2f')]=_['keys'](db[_0xaf00('0x2c')][_0xaf00('0x2d')]);_0x1982bc['query']=_[_0xaf00('0x46')](_0xeae2fa[_0xaf00('0x30')]);_0x1982bc[_0xaf00('0x31')]=_['intersection'](_0x1982bc['model'],_0x1982bc[_0xaf00('0x30')]);_0x179872[_0xaf00('0x32')]=_[_0xaf00('0x33')](_0x1982bc[_0xaf00('0x2f')],qs[_0xaf00('0x34')](_0xeae2fa[_0xaf00('0x30')][_0xaf00('0x34')]));_0x179872[_0xaf00('0x32')]=_0x179872[_0xaf00('0x32')]['length']?_0x179872[_0xaf00('0x32')]:_0x1982bc[_0xaf00('0x2f')];if(_0xeae2fa['query'][_0xaf00('0x41')]){_0x179872[_0xaf00('0x42')]=[{'all':!![]}];}_0x179872=_[_0xaf00('0x3c')]({},_0x179872,_0xeae2fa['options']);return db[_0xaf00('0x2c')]['find'](_0x179872)['then'](handleEntityNotFound(_0x599290,null))[_0xaf00('0x24')](respondWithResult(_0x599290,null))[_0xaf00('0x47')](handleError(_0x599290,null));};exports[_0xaf00('0x48')]=function(_0x49efb4,_0x3466dd){return db[_0xaf00('0x2c')][_0xaf00('0x48')](_0x49efb4['body'],{})['then'](respondWithResult(_0x3466dd,0xc9))['catch'](handleError(_0x3466dd,null));};exports['update']=function(_0x52975e,_0x5ef42c){if(_0x52975e['body']['id']){delete _0x52975e[_0xaf00('0x49')]['id'];}return db[_0xaf00('0x2c')][_0xaf00('0x4a')]({'where':{'id':_0x52975e['params']['id']}})[_0xaf00('0x24')](handleEntityNotFound(_0x5ef42c,null))[_0xaf00('0x24')](saveUpdates(_0x52975e[_0xaf00('0x49')],null))['then'](respondWithResult(_0x5ef42c,null))[_0xaf00('0x47')](handleError(_0x5ef42c,null));};exports['destroy']=function(_0x54463f,_0x5b993f){return db['JscriptyQuestionReport'][_0xaf00('0x4a')]({'where':{'id':_0x54463f[_0xaf00('0x4b')]['id']}})[_0xaf00('0x24')](handleEntityNotFound(_0x5b993f,null))[_0xaf00('0x24')](removeEntity(_0x5b993f,null))[_0xaf00('0x47')](handleError(_0x5b993f,null));};exports[_0xaf00('0x4c')]=function(_0xac8b2e,_0x1ce55b){return db[_0xaf00('0x2c')][_0xaf00('0x4c')]()[_0xaf00('0x24')](respondWithResult(_0x1ce55b,null))[_0xaf00('0x47')](handleError(_0x1ce55b,null));}; \ No newline at end of file +var _0xfb16=['pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','show','params','length','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters'];(function(_0x224067,_0xe73c38){var _0x4af627=function(_0x25acc5){while(--_0x25acc5){_0x224067['push'](_0x224067['shift']());}};_0x4af627(++_0xe73c38);}(_0xfb16,0xf5));var _0x6fb1=function(_0x4638ec,_0x106345){_0x4638ec=_0x4638ec-0x0;var _0x133a29=_0xfb16[_0x4638ec];return _0x133a29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6fb1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6fb1('0x1'));var rp=require(_0x6fb1('0x2'));var moment=require(_0x6fb1('0x3'));var BPromise=require(_0x6fb1('0x4'));var Mustache=require(_0x6fb1('0x5'));var util=require(_0x6fb1('0x6'));var path=require(_0x6fb1('0x7'));var sox=require(_0x6fb1('0x8'));var csv=require('to-csv');var ejs=require(_0x6fb1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6fb1('0xa'));var squel=require(_0x6fb1('0xb'));var crypto=require(_0x6fb1('0xc'));var jsforce=require(_0x6fb1('0xd'));var deskjs=require(_0x6fb1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6fb1('0xf'));var authService=require(_0x6fb1('0x10'));var qs=require(_0x6fb1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fb1('0x12'));var logger=require(_0x6fb1('0x13'))(_0x6fb1('0x14'));var utils=require(_0x6fb1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6fb1('0x16'));var db=require(_0x6fb1('0x17'))['db'];function respondWithStatusCode(_0x1c2e70,_0x3c6298){_0x3c6298=_0x3c6298||0xcc;return function(_0x346c3b){if(_0x346c3b){return _0x1c2e70[_0x6fb1('0x18')](_0x3c6298);}return _0x1c2e70[_0x6fb1('0x19')](_0x3c6298)[_0x6fb1('0x1a')]();};}function respondWithResult(_0x5cca79,_0x4bd33d){_0x4bd33d=_0x4bd33d||0xc8;return function(_0x46ba73){if(_0x46ba73){return _0x5cca79[_0x6fb1('0x19')](_0x4bd33d)[_0x6fb1('0x1b')](_0x46ba73);}};}function respondWithFilteredResult(_0x1600b9,_0x2c5229){return function(_0x5d65e0){if(_0x5d65e0){var _0x511e3d=typeof _0x2c5229[_0x6fb1('0x1c')]===_0x6fb1('0x1d')&&typeof _0x2c5229[_0x6fb1('0x1e')]===_0x6fb1('0x1d');var _0x1125e3=_0x5d65e0['count'];var _0x22f4b5=_0x511e3d?0x0:_0x2c5229['offset'];var _0x18a99c=_0x511e3d?_0x5d65e0[_0x6fb1('0x1f')]:_0x2c5229[_0x6fb1('0x1c')]+_0x2c5229[_0x6fb1('0x1e')];var _0x439481;if(_0x18a99c>=_0x1125e3){_0x18a99c=_0x1125e3;_0x439481=0xc8;}else{_0x439481=0xce;}_0x1600b9['status'](_0x439481);return _0x1600b9[_0x6fb1('0x20')]('Content-Range',_0x22f4b5+'-'+_0x18a99c+'/'+_0x1125e3)[_0x6fb1('0x1b')](_0x5d65e0);}return null;};}function patchUpdates(_0x2ddf46){return function(_0x52fafd){try{jsonpatch[_0x6fb1('0x21')](_0x52fafd,_0x2ddf46,!![]);}catch(_0x2ab3f1){return BPromise['reject'](_0x2ab3f1);}return _0x52fafd['save']();};}function saveUpdates(_0x51e8b6,_0x299c91){return function(_0x1f61b4){if(_0x1f61b4){return _0x1f61b4[_0x6fb1('0x22')](_0x51e8b6)[_0x6fb1('0x23')](function(_0x1facf3){return _0x1facf3;});}return null;};}function removeEntity(_0x4f2559,_0x469d6a){return function(_0x1d5c66){if(_0x1d5c66){return _0x1d5c66[_0x6fb1('0x24')]()[_0x6fb1('0x23')](function(){_0x4f2559['status'](0xcc)[_0x6fb1('0x1a')]();});}};}function handleEntityNotFound(_0x2db351,_0x12f935){return function(_0x53b992){if(!_0x53b992){_0x2db351[_0x6fb1('0x18')](0x194);}return _0x53b992;};}function handleError(_0x272f3f,_0x161ce3){_0x161ce3=_0x161ce3||0x1f4;return function(_0x2f512e){logger[_0x6fb1('0x25')](_0x2f512e[_0x6fb1('0x26')]);if(_0x2f512e[_0x6fb1('0x27')]){delete _0x2f512e[_0x6fb1('0x27')];}_0x272f3f[_0x6fb1('0x19')](_0x161ce3)[_0x6fb1('0x28')](_0x2f512e);};}exports[_0x6fb1('0x29')]=function(_0x36fcde,_0x57eb5f){var _0x80869c={},_0x31261c={},_0x2c26e1={'count':0x0,'rows':[]};var _0x255f98=_[_0x6fb1('0x2a')](db[_0x6fb1('0x2b')][_0x6fb1('0x2c')],function(_0x5166a6){return{'name':_0x5166a6[_0x6fb1('0x2d')],'type':_0x5166a6[_0x6fb1('0x2e')][_0x6fb1('0x2f')]};});_0x31261c[_0x6fb1('0x30')]=_[_0x6fb1('0x2a')](_0x255f98,_0x6fb1('0x27'));_0x31261c[_0x6fb1('0x31')]=_[_0x6fb1('0x32')](_0x36fcde[_0x6fb1('0x31')]);_0x31261c['filters']=_[_0x6fb1('0x33')](_0x31261c['model'],_0x31261c['query']);_0x80869c['attributes']=_[_0x6fb1('0x33')](_0x31261c[_0x6fb1('0x30')],qs[_0x6fb1('0x34')](_0x36fcde[_0x6fb1('0x31')]['fields']));_0x80869c[_0x6fb1('0x35')]=_0x80869c[_0x6fb1('0x35')]['length']?_0x80869c[_0x6fb1('0x35')]:_0x31261c[_0x6fb1('0x30')];if(!_0x36fcde['query'][_0x6fb1('0x36')](_0x6fb1('0x37'))){_0x80869c[_0x6fb1('0x1e')]=qs[_0x6fb1('0x1e')](_0x36fcde[_0x6fb1('0x31')][_0x6fb1('0x1e')]);_0x80869c['offset']=qs['offset'](_0x36fcde[_0x6fb1('0x31')][_0x6fb1('0x1c')]);}_0x80869c[_0x6fb1('0x38')]=qs[_0x6fb1('0x39')](_0x36fcde[_0x6fb1('0x31')][_0x6fb1('0x39')]);_0x80869c['where']=qs[_0x6fb1('0x3a')](_[_0x6fb1('0x3b')](_0x36fcde['query'],_0x31261c[_0x6fb1('0x3a')]),_0x255f98);if(_0x36fcde[_0x6fb1('0x31')][_0x6fb1('0x3c')]){_0x80869c[_0x6fb1('0x3d')]=_['merge'](_0x80869c[_0x6fb1('0x3d')],{'$or':_['map'](_0x255f98,function(_0x2c1340){if(_0x2c1340['type']!==_0x6fb1('0x3e')){var _0xf65443={};_0xf65443[_0x2c1340[_0x6fb1('0x27')]]={'$like':'%'+_0x36fcde[_0x6fb1('0x31')][_0x6fb1('0x3c')]+'%'};return _0xf65443;}})});}_0x80869c=_[_0x6fb1('0x3f')]({},_0x80869c,_0x36fcde[_0x6fb1('0x40')]);var _0x3fa2c4={'where':_0x80869c[_0x6fb1('0x3d')]};return db[_0x6fb1('0x2b')][_0x6fb1('0x1f')](_0x3fa2c4)[_0x6fb1('0x23')](function(_0x2eb551){_0x2c26e1[_0x6fb1('0x1f')]=_0x2eb551;if(_0x36fcde[_0x6fb1('0x31')][_0x6fb1('0x41')]){_0x80869c[_0x6fb1('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x80869c);})[_0x6fb1('0x23')](function(_0x4aba75){_0x2c26e1[_0x6fb1('0x43')]=_0x4aba75;return _0x2c26e1;})[_0x6fb1('0x23')](respondWithFilteredResult(_0x57eb5f,_0x80869c))['catch'](handleError(_0x57eb5f,null));};exports[_0x6fb1('0x44')]=function(_0x59ec18,_0x31c52a){var _0x6a1ec4={'raw':!![],'where':{'id':_0x59ec18[_0x6fb1('0x45')]['id']}},_0x5eb0b4={};_0x5eb0b4[_0x6fb1('0x30')]=_[_0x6fb1('0x32')](db[_0x6fb1('0x2b')][_0x6fb1('0x2c')]);_0x5eb0b4[_0x6fb1('0x31')]=_['keys'](_0x59ec18[_0x6fb1('0x31')]);_0x5eb0b4['filters']=_[_0x6fb1('0x33')](_0x5eb0b4[_0x6fb1('0x30')],_0x5eb0b4[_0x6fb1('0x31')]);_0x6a1ec4[_0x6fb1('0x35')]=_[_0x6fb1('0x33')](_0x5eb0b4[_0x6fb1('0x30')],qs[_0x6fb1('0x34')](_0x59ec18[_0x6fb1('0x31')][_0x6fb1('0x34')]));_0x6a1ec4[_0x6fb1('0x35')]=_0x6a1ec4['attributes'][_0x6fb1('0x46')]?_0x6a1ec4[_0x6fb1('0x35')]:_0x5eb0b4[_0x6fb1('0x30')];if(_0x59ec18[_0x6fb1('0x31')][_0x6fb1('0x41')]){_0x6a1ec4[_0x6fb1('0x42')]=[{'all':!![]}];}_0x6a1ec4=_[_0x6fb1('0x3f')]({},_0x6a1ec4,_0x59ec18[_0x6fb1('0x40')]);return db[_0x6fb1('0x2b')][_0x6fb1('0x47')](_0x6a1ec4)[_0x6fb1('0x23')](handleEntityNotFound(_0x31c52a,null))[_0x6fb1('0x23')](respondWithResult(_0x31c52a,null))[_0x6fb1('0x48')](handleError(_0x31c52a,null));};exports[_0x6fb1('0x49')]=function(_0x1eceec,_0x46576f){return db[_0x6fb1('0x2b')][_0x6fb1('0x49')](_0x1eceec[_0x6fb1('0x4a')],{})['then'](respondWithResult(_0x46576f,0xc9))['catch'](handleError(_0x46576f,null));};exports[_0x6fb1('0x22')]=function(_0x509750,_0x2cde21){if(_0x509750[_0x6fb1('0x4a')]['id']){delete _0x509750['body']['id'];}return db[_0x6fb1('0x2b')]['find']({'where':{'id':_0x509750['params']['id']}})[_0x6fb1('0x23')](handleEntityNotFound(_0x2cde21,null))[_0x6fb1('0x23')](saveUpdates(_0x509750[_0x6fb1('0x4a')],null))['then'](respondWithResult(_0x2cde21,null))[_0x6fb1('0x48')](handleError(_0x2cde21,null));};exports[_0x6fb1('0x24')]=function(_0x24c916,_0x56e461){return db[_0x6fb1('0x2b')]['find']({'where':{'id':_0x24c916['params']['id']}})[_0x6fb1('0x23')](handleEntityNotFound(_0x56e461,null))['then'](removeEntity(_0x56e461,null))[_0x6fb1('0x48')](handleError(_0x56e461,null));};exports[_0x6fb1('0x4b')]=function(_0x11598a,_0xaaf8fb){return db[_0x6fb1('0x2b')][_0x6fb1('0x4b')]()[_0x6fb1('0x23')](respondWithResult(_0xaaf8fb,null))[_0x6fb1('0x48')](handleError(_0xaaf8fb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index b2d4c68..712e345 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 _0x2e38=['api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0xe00385,_0x466bc5){var _0x155837=function(_0x42f8e9){while(--_0x42f8e9){_0xe00385['push'](_0xe00385['shift']());}};_0x155837(++_0x466bc5);}(_0x2e38,0x11b));var _0x82e3=function(_0x254bca,_0x2c0698){_0x254bca=_0x254bca-0x0;var _0x118fff=_0x2e38[_0x254bca];return _0x118fff;};'use strict';var _=require(_0x82e3('0x0'));var util=require(_0x82e3('0x1'));var logger=require(_0x82e3('0x2'))(_0x82e3('0x3'));var moment=require('moment');var BPromise=require(_0x82e3('0x4'));var rp=require(_0x82e3('0x5'));var fs=require('fs');var path=require(_0x82e3('0x6'));var rimraf=require(_0x82e3('0x7'));var config=require(_0x82e3('0x8'));var attributes=require(_0x82e3('0x9'));module[_0x82e3('0xa')]=function(_0x39171c,_0xcbe154){return _0x39171c[_0x82e3('0xb')]('JscriptyQuestionReport',attributes,{'tableName':_0x82e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc541=['JscriptyQuestionReport','report_jscripty_questions','util','api','moment','bluebird','request-promise','path','./jscriptyQuestionReport.attributes','exports'];(function(_0x3826ea,_0x20e17a){var _0x4aed54=function(_0x33bc5c){while(--_0x33bc5c){_0x3826ea['push'](_0x3826ea['shift']());}};_0x4aed54(++_0x20e17a);}(_0xc541,0x1c4));var _0x1c54=function(_0x4a94b1,_0x4f2518){_0x4a94b1=_0x4a94b1-0x0;var _0x20949f=_0xc541[_0x4a94b1];return _0x20949f;};'use strict';var _=require('lodash');var util=require(_0x1c54('0x0'));var logger=require('../../config/logger')(_0x1c54('0x1'));var moment=require(_0x1c54('0x2'));var BPromise=require(_0x1c54('0x3'));var rp=require(_0x1c54('0x4'));var fs=require('fs');var path=require(_0x1c54('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1c54('0x6'));module[_0x1c54('0x7')]=function(_0x1a7cb8,_0xa9ad31){return _0x1a7cb8['define'](_0x1c54('0x8'),attributes,{'tableName':_0x1c54('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 5371820..7edeb33 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 _0x14c3=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','info','result','catch'];(function(_0x5de9f2,_0x4dc559){var _0x106f3b=function(_0x2060d9){while(--_0x2060d9){_0x5de9f2['push'](_0x5de9f2['shift']());}};_0x106f3b(++_0x4dc559);}(_0x14c3,0x1ce));var _0x314c=function(_0x4904d2,_0x424244){_0x4904d2=_0x4904d2-0x0;var _0xe90a61=_0x14c3[_0x4904d2];return _0xe90a61;};'use strict';var _=require(_0x314c('0x0'));var util=require(_0x314c('0x1'));var moment=require('moment');var BPromise=require(_0x314c('0x2'));var rs=require(_0x314c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x314c('0x4'))['db'];var utils=require(_0x314c('0x5'));var logger=require('../../config/logger')(_0x314c('0x6'));var config=require(_0x314c('0x7'));var jayson=require(_0x314c('0x8'));var client=jayson[_0x314c('0x9')][_0x314c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36f261,_0x4da881,_0x102a94){return new BPromise(function(_0xfb4cb4,_0x1be9b1){return client['request'](_0x36f261,_0x102a94)['then'](function(_0x43f146){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x4da881,_0x314c('0xb'));logger[_0x314c('0xc')](_0x314c('0xd'),_0x4da881,_0x314c('0xb'),JSON[_0x314c('0xe')](_0x43f146));if(_0x43f146[_0x314c('0xf')]){if(_0x43f146[_0x314c('0xf')][_0x314c('0x10')]===0x1f4){logger[_0x314c('0xf')](_0x314c('0x11'),_0x4da881,_0x43f146['error'][_0x314c('0x12')]);return _0x1be9b1(_0x43f146['error'][_0x314c('0x12')]);}logger[_0x314c('0xf')](_0x314c('0x11'),_0x4da881,_0x43f146[_0x314c('0xf')]['message']);return _0xfb4cb4(_0x43f146[_0x314c('0xf')][_0x314c('0x12')]);}else{logger[_0x314c('0x13')](_0x314c('0x11'),_0x4da881,_0x314c('0xb'));_0xfb4cb4(_0x43f146[_0x314c('0x14')]['message']);}})[_0x314c('0x15')](function(_0x157594){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x4da881,_0x157594);_0x1be9b1(_0x157594);});});} \ No newline at end of file +var _0xca93=['code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x56dbbd,_0x53a898){var _0x26012c=function(_0x558b27){while(--_0x558b27){_0x56dbbd['push'](_0x56dbbd['shift']());}};_0x26012c(++_0x53a898);}(_0xca93,0x112));var _0x3ca9=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xca93[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3ca9('0x0'));var rs=require(_0x3ca9('0x1'));var fs=require('fs');var Redis=require(_0x3ca9('0x2'));var db=require(_0x3ca9('0x3'))['db'];var utils=require(_0x3ca9('0x4'));var logger=require(_0x3ca9('0x5'))(_0x3ca9('0x6'));var config=require('../../config/environment');var jayson=require(_0x3ca9('0x7'));var client=jayson[_0x3ca9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x88b443,_0x1ad601,_0x2272af){return new BPromise(function(_0x33ad90,_0xbc8b2d){return client['request'](_0x88b443,_0x2272af)[_0x3ca9('0x9')](function(_0x57d5fd){logger['info'](_0x3ca9('0xa'),_0x1ad601,_0x3ca9('0xb'));logger['debug'](_0x3ca9('0xc'),_0x1ad601,_0x3ca9('0xb'),JSON['stringify'](_0x57d5fd));if(_0x57d5fd['error']){if(_0x57d5fd[_0x3ca9('0xd')][_0x3ca9('0xe')]===0x1f4){logger[_0x3ca9('0xd')](_0x3ca9('0xa'),_0x1ad601,_0x57d5fd['error'][_0x3ca9('0xf')]);return _0xbc8b2d(_0x57d5fd[_0x3ca9('0xd')][_0x3ca9('0xf')]);}logger[_0x3ca9('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1ad601,_0x57d5fd['error']['message']);return _0x33ad90(_0x57d5fd[_0x3ca9('0xd')][_0x3ca9('0xf')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1ad601,_0x3ca9('0xb'));_0x33ad90(_0x57d5fd[_0x3ca9('0x10')][_0x3ca9('0xf')]);}})[_0x3ca9('0x11')](function(_0x683b80){logger[_0x3ca9('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1ad601,_0x683b80);_0xbc8b2d(_0x683b80);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index a6c92a1..fd219b0 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 _0xcf21=['Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xcf21,0x15a));var _0x1cf2=function(_0x497f9d,_0x235b89){_0x497f9d=_0x497f9d-0x0;var _0x224769=_0xcf21[_0x497f9d];return _0x224769;};'use strict';var multer=require(_0x1cf2('0x0'));var util=require(_0x1cf2('0x1'));var path=require(_0x1cf2('0x2'));var timeout=require(_0x1cf2('0x3'));var express=require('express');var router=express[_0x1cf2('0x4')]();var fs_extra=require(_0x1cf2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1cf2('0x6'));var config=require(_0x1cf2('0x7'));var controller=require(_0x1cf2('0x8'));router[_0x1cf2('0x9')]('/',auth[_0x1cf2('0xa')](),controller[_0x1cf2('0xb')]);router[_0x1cf2('0x9')](_0x1cf2('0xc'),auth[_0x1cf2('0xa')](),controller[_0x1cf2('0xd')]);router['get'](_0x1cf2('0xe'),auth[_0x1cf2('0xa')](),controller[_0x1cf2('0xf')]);router['get'](_0x1cf2('0x10'),auth[_0x1cf2('0xa')](),controller[_0x1cf2('0x11')]);router[_0x1cf2('0x12')]('/',auth[_0x1cf2('0xa')](),controller[_0x1cf2('0x13')]);router[_0x1cf2('0x14')](_0x1cf2('0xe'),auth['isAuthenticated'](),controller[_0x1cf2('0x15')]);router[_0x1cf2('0x16')](_0x1cf2('0xe'),auth[_0x1cf2('0xa')](),controller[_0x1cf2('0x17')]);module[_0x1cf2('0x18')]=router; \ No newline at end of file +var _0xef09=['post','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','/describe','describe','/:id','/:id/questions'];(function(_0x2ef33d,_0x40a0b7){var _0x231821=function(_0x59474f){while(--_0x59474f){_0x2ef33d['push'](_0x2ef33d['shift']());}};_0x231821(++_0x40a0b7);}(_0xef09,0x1ba));var _0x9ef0=function(_0x50b0e5,_0x535bcf){_0x50b0e5=_0x50b0e5-0x0;var _0x5340d9=_0xef09[_0x50b0e5];return _0x5340d9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9ef0('0x0'));var timeout=require(_0x9ef0('0x1'));var express=require(_0x9ef0('0x2'));var router=express[_0x9ef0('0x3')]();var fs_extra=require(_0x9ef0('0x4'));var auth=require(_0x9ef0('0x5'));var interaction=require(_0x9ef0('0x6'));var config=require('../../config/environment');var controller=require(_0x9ef0('0x7'));router[_0x9ef0('0x8')]('/',auth[_0x9ef0('0x9')](),controller['index']);router[_0x9ef0('0x8')](_0x9ef0('0xa'),auth['isAuthenticated'](),controller[_0x9ef0('0xb')]);router['get'](_0x9ef0('0xc'),auth[_0x9ef0('0x9')](),controller['show']);router['get'](_0x9ef0('0xd'),auth[_0x9ef0('0x9')](),controller['getQuestions']);router[_0x9ef0('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9ef0('0xf')](_0x9ef0('0xc'),auth[_0x9ef0('0x9')](),controller[_0x9ef0('0x10')]);router[_0x9ef0('0x11')]('/:id',auth[_0x9ef0('0x9')](),controller[_0x9ef0('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 4c4f18e..ba6256d 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 _0x9048=['exports','starttime','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment'];(function(_0x4028d7,_0x363967){var _0x4941b1=function(_0x19002f){while(--_0x19002f){_0x4028d7['push'](_0x4028d7['shift']());}};_0x4941b1(++_0x363967);}(_0x9048,0xf2));var _0x8904=function(_0x1abdaa,_0x133781){_0x1abdaa=_0x1abdaa-0x0;var _0x37221a=_0x9048[_0x1abdaa];return _0x37221a;};'use strict';var moment=require(_0x8904('0x0'));var Sequelize=require('sequelize');module[_0x8904('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x4a7a99){this['setDataValue'](_0x8904('0x2'),_0x4a7a99);this[_0x8904('0x3')]('endtime',moment()[_0x8904('0x4')](_0x8904('0x5')));}},'endtime':{'type':Sequelize[_0x8904('0x6')]},'membername':{'type':Sequelize[_0x8904('0x7')]},'projectname':{'type':Sequelize[_0x8904('0x7')]},'queue':{'type':Sequelize[_0x8904('0x7')]},'uniqueid':{'type':Sequelize[_0x8904('0x7')]},'calleridname':{'type':Sequelize[_0x8904('0x7')]},'calleridnum':{'type':Sequelize[_0x8904('0x7')]},'completed':{'type':Sequelize[_0x8904('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x6f83=['YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','sequelize','exports','setDataValue','starttime','endtime','format'];(function(_0x51aafe,_0x9cfe8d){var _0x3cba73=function(_0x8692af){while(--_0x8692af){_0x51aafe['push'](_0x51aafe['shift']());}};_0x3cba73(++_0x9cfe8d);}(_0x6f83,0x72));var _0x36f8=function(_0x5621d9,_0x430f03){_0x5621d9=_0x5621d9-0x0;var _0x4e0ba2=_0x6f83[_0x5621d9];return _0x4e0ba2;};'use strict';var moment=require('moment');var Sequelize=require(_0x36f8('0x0'));module[_0x36f8('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x20a656){this[_0x36f8('0x2')](_0x36f8('0x3'),_0x20a656);this[_0x36f8('0x2')](_0x36f8('0x4'),moment()[_0x36f8('0x5')](_0x36f8('0x6')));}},'endtime':{'type':Sequelize[_0x36f8('0x7')]},'membername':{'type':Sequelize[_0x36f8('0x8')]},'projectname':{'type':Sequelize[_0x36f8('0x8')]},'queue':{'type':Sequelize[_0x36f8('0x8')]},'uniqueid':{'type':Sequelize[_0x36f8('0x8')]},'calleridname':{'type':Sequelize[_0x36f8('0x8')]},'calleridnum':{'type':Sequelize[_0x36f8('0x8')]},'completed':{'type':Sequelize[_0x36f8('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index cf101cb..41c20d8 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 _0x02fd=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','body','params','destroy','find','describe','getQuestions','findOne','JscriptyQuestionReport','options','zip-dir','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','name','JscriptySessionReport','rawAttributes','type','key','query','keys','filters','intersection','model','fields','length','attributes'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0x02fd,0xfd));var _0xd02f=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x02fd[_0x4a747d];return _0x3a5b5c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd02f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd02f('0x1'));var moment=require(_0xd02f('0x2'));var BPromise=require(_0xd02f('0x3'));var Mustache=require('mustache');var util=require(_0xd02f('0x4'));var path=require('path');var sox=require(_0xd02f('0x5'));var csv=require('to-csv');var ejs=require(_0xd02f('0x6'));var fs=require('fs');var fs_extra=require(_0xd02f('0x7'));var _=require(_0xd02f('0x8'));var squel=require('squel');var crypto=require(_0xd02f('0x9'));var jsforce=require(_0xd02f('0xa'));var deskjs=require(_0xd02f('0xb'));var toCsv=require(_0xd02f('0xc'));var querystring=require('querystring');var Papa=require(_0xd02f('0xd'));var Redis=require(_0xd02f('0xe'));var authService=require(_0xd02f('0xf'));var qs=require(_0xd02f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd02f('0x11'));var logger=require(_0xd02f('0x12'))(_0xd02f('0x13'));var utils=require(_0xd02f('0x14'));var config=require(_0xd02f('0x15'));var licenseUtil=require(_0xd02f('0x16'));var db=require(_0xd02f('0x17'))['db'];function respondWithStatusCode(_0x2b5753,_0x2de802){_0x2de802=_0x2de802||0xcc;return function(_0x1d67b1){if(_0x1d67b1){return _0x2b5753[_0xd02f('0x18')](_0x2de802);}return _0x2b5753[_0xd02f('0x19')](_0x2de802)[_0xd02f('0x1a')]();};}function respondWithResult(_0x2bc69c,_0x558d18){_0x558d18=_0x558d18||0xc8;return function(_0x5731c5){if(_0x5731c5){return _0x2bc69c[_0xd02f('0x19')](_0x558d18)[_0xd02f('0x1b')](_0x5731c5);}};}function respondWithFilteredResult(_0x56f6b9,_0x2e2846){return function(_0x5dfed4){if(_0x5dfed4){var _0x53b1ba=typeof _0x2e2846[_0xd02f('0x1c')]===_0xd02f('0x1d')&&typeof _0x2e2846[_0xd02f('0x1e')]===_0xd02f('0x1d');var _0xf05aa=_0x5dfed4[_0xd02f('0x1f')];var _0x53ba8e=_0x53b1ba?0x0:_0x2e2846[_0xd02f('0x1c')];var _0x4612f0=_0x53b1ba?_0x5dfed4[_0xd02f('0x1f')]:_0x2e2846['offset']+_0x2e2846['limit'];var _0x47f2ac;if(_0x4612f0>=_0xf05aa){_0x4612f0=_0xf05aa;_0x47f2ac=0xc8;}else{_0x47f2ac=0xce;}_0x56f6b9['status'](_0x47f2ac);return _0x56f6b9[_0xd02f('0x20')](_0xd02f('0x21'),_0x53ba8e+'-'+_0x4612f0+'/'+_0xf05aa)[_0xd02f('0x1b')](_0x5dfed4);}return null;};}function patchUpdates(_0x17f03c){return function(_0x318744){try{jsonpatch[_0xd02f('0x22')](_0x318744,_0x17f03c,!![]);}catch(_0x511e22){return BPromise['reject'](_0x511e22);}return _0x318744[_0xd02f('0x23')]();};}function saveUpdates(_0x599068,_0xb64697){return function(_0x3acea6){if(_0x3acea6){return _0x3acea6[_0xd02f('0x24')](_0x599068)['then'](function(_0xc1c9bb){return _0xc1c9bb;});}return null;};}function removeEntity(_0x56527b,_0x3e3040){return function(_0x589d72){if(_0x589d72){return _0x589d72['destroy']()[_0xd02f('0x25')](function(){_0x56527b['status'](0xcc)[_0xd02f('0x1a')]();});}};}function handleEntityNotFound(_0xd2587f,_0x3b19ac){return function(_0x1c5634){if(!_0x1c5634){_0xd2587f[_0xd02f('0x18')](0x194);}return _0x1c5634;};}function handleError(_0x4a7a15,_0x35ff1c){_0x35ff1c=_0x35ff1c||0x1f4;return function(_0x2be96b){logger['error'](_0x2be96b['stack']);if(_0x2be96b[_0xd02f('0x26')]){delete _0x2be96b[_0xd02f('0x26')];}_0x4a7a15[_0xd02f('0x19')](_0x35ff1c)['send'](_0x2be96b);};}exports['index']=function(_0x1955f2,_0x5cbfeb){var _0x1981a1={},_0x4eb4c0={},_0xd717a4={'count':0x0,'rows':[]};var _0x262c31=_['map'](db[_0xd02f('0x27')][_0xd02f('0x28')],function(_0x4f31db){return{'name':_0x4f31db['fieldName'],'type':_0x4f31db[_0xd02f('0x29')][_0xd02f('0x2a')]};});_0x4eb4c0['model']=_['map'](_0x262c31,_0xd02f('0x26'));_0x4eb4c0[_0xd02f('0x2b')]=_[_0xd02f('0x2c')](_0x1955f2[_0xd02f('0x2b')]);_0x4eb4c0[_0xd02f('0x2d')]=_['intersection'](_0x4eb4c0['model'],_0x4eb4c0[_0xd02f('0x2b')]);_0x1981a1['attributes']=_[_0xd02f('0x2e')](_0x4eb4c0[_0xd02f('0x2f')],qs[_0xd02f('0x30')](_0x1955f2[_0xd02f('0x2b')][_0xd02f('0x30')]));_0x1981a1['attributes']=_0x1981a1['attributes'][_0xd02f('0x31')]?_0x1981a1[_0xd02f('0x32')]:_0x4eb4c0[_0xd02f('0x2f')];if(!_0x1955f2[_0xd02f('0x2b')][_0xd02f('0x33')](_0xd02f('0x34'))){_0x1981a1[_0xd02f('0x1e')]=qs[_0xd02f('0x1e')](_0x1955f2[_0xd02f('0x2b')][_0xd02f('0x1e')]);_0x1981a1[_0xd02f('0x1c')]=qs['offset'](_0x1955f2[_0xd02f('0x2b')][_0xd02f('0x1c')]);}_0x1981a1[_0xd02f('0x35')]=qs[_0xd02f('0x36')](_0x1955f2['query'][_0xd02f('0x36')]);_0x1981a1[_0xd02f('0x37')]=qs[_0xd02f('0x2d')](_[_0xd02f('0x38')](_0x1955f2['query'],_0x4eb4c0[_0xd02f('0x2d')]),_0x262c31);if(_0x1955f2[_0xd02f('0x2b')][_0xd02f('0x39')]){_0x1981a1[_0xd02f('0x37')]=_[_0xd02f('0x3a')](_0x1981a1['where'],{'$or':_[_0xd02f('0x3b')](_0x262c31,function(_0x626627){if(_0x626627[_0xd02f('0x29')]!==_0xd02f('0x3c')){var _0x26e6e5={};_0x26e6e5[_0x626627[_0xd02f('0x26')]]={'$like':'%'+_0x1955f2[_0xd02f('0x2b')][_0xd02f('0x39')]+'%'};return _0x26e6e5;}})});}_0x1981a1=_['merge']({},_0x1981a1,_0x1955f2['options']);var _0x56c932={'where':_0x1981a1[_0xd02f('0x37')]};return db[_0xd02f('0x27')][_0xd02f('0x1f')](_0x56c932)[_0xd02f('0x25')](function(_0x2d4fd1){_0xd717a4[_0xd02f('0x1f')]=_0x2d4fd1;if(_0x1955f2[_0xd02f('0x2b')][_0xd02f('0x3d')]){_0x1981a1[_0xd02f('0x3e')]=[{'all':!![]}];}return db[_0xd02f('0x27')][_0xd02f('0x3f')](_0x1981a1);})[_0xd02f('0x25')](function(_0x3b710){_0xd717a4[_0xd02f('0x40')]=_0x3b710;return _0xd717a4;})[_0xd02f('0x25')](respondWithFilteredResult(_0x5cbfeb,_0x1981a1))[_0xd02f('0x41')](handleError(_0x5cbfeb,null));};exports[_0xd02f('0x42')]=function(_0x4ee3ec,_0xabb174){var _0x501693={'raw':!![],'where':{'id':_0x4ee3ec['params']['id']}},_0x10ada3={};_0x10ada3[_0xd02f('0x2f')]=_[_0xd02f('0x2c')](db[_0xd02f('0x27')][_0xd02f('0x28')]);_0x10ada3[_0xd02f('0x2b')]=_['keys'](_0x4ee3ec[_0xd02f('0x2b')]);_0x10ada3['filters']=_[_0xd02f('0x2e')](_0x10ada3[_0xd02f('0x2f')],_0x10ada3[_0xd02f('0x2b')]);_0x501693['attributes']=_[_0xd02f('0x2e')](_0x10ada3[_0xd02f('0x2f')],qs[_0xd02f('0x30')](_0x4ee3ec[_0xd02f('0x2b')]['fields']));_0x501693['attributes']=_0x501693['attributes'][_0xd02f('0x31')]?_0x501693['attributes']:_0x10ada3[_0xd02f('0x2f')];if(_0x4ee3ec['query']['includeAll']){_0x501693[_0xd02f('0x3e')]=[{'all':!![]}];}_0x501693=_[_0xd02f('0x3a')]({},_0x501693,_0x4ee3ec['options']);return db[_0xd02f('0x27')]['find'](_0x501693)[_0xd02f('0x25')](handleEntityNotFound(_0xabb174,null))[_0xd02f('0x25')](respondWithResult(_0xabb174,null))[_0xd02f('0x41')](handleError(_0xabb174,null));};exports['create']=function(_0x3967bd,_0x116319){return db[_0xd02f('0x27')]['create'](_0x3967bd[_0xd02f('0x43')],{})[_0xd02f('0x25')](respondWithResult(_0x116319,0xc9))[_0xd02f('0x41')](handleError(_0x116319,null));};exports['update']=function(_0x4c9c38,_0x48f369){if(_0x4c9c38[_0xd02f('0x43')]['id']){delete _0x4c9c38[_0xd02f('0x43')]['id'];}return db[_0xd02f('0x27')]['find']({'where':{'id':_0x4c9c38[_0xd02f('0x44')]['id']}})[_0xd02f('0x25')](handleEntityNotFound(_0x48f369,null))[_0xd02f('0x25')](saveUpdates(_0x4c9c38[_0xd02f('0x43')],null))['then'](respondWithResult(_0x48f369,null))['catch'](handleError(_0x48f369,null));};exports[_0xd02f('0x45')]=function(_0x3ddf89,_0x4c8baf){return db[_0xd02f('0x27')][_0xd02f('0x46')]({'where':{'id':_0x3ddf89[_0xd02f('0x44')]['id']}})[_0xd02f('0x25')](handleEntityNotFound(_0x4c8baf,null))[_0xd02f('0x25')](removeEntity(_0x4c8baf,null))['catch'](handleError(_0x4c8baf,null));};exports[_0xd02f('0x47')]=function(_0x599083,_0x37014d){return db[_0xd02f('0x27')][_0xd02f('0x47')]()['then'](respondWithResult(_0x37014d,null))[_0xd02f('0x41')](handleError(_0x37014d,null));};exports[_0xd02f('0x48')]=function(_0x25e172,_0x218a69,_0x8391d5){var _0x561090={'raw':!![],'where':{}};var _0xf22b91={};var _0x277c1a={'count':0x0,'rows':[]};return db[_0xd02f('0x27')][_0xd02f('0x49')]({'where':{'id':_0x25e172[_0xd02f('0x44')]['id']}})[_0xd02f('0x25')](handleEntityNotFound(_0x218a69,null))[_0xd02f('0x25')](function(_0x2530fd){if(_0x2530fd){_0xf22b91['model']=_[_0xd02f('0x2c')](db[_0xd02f('0x4a')][_0xd02f('0x28')]);_0xf22b91['query']=_[_0xd02f('0x2c')](_0x25e172[_0xd02f('0x2b')]);_0xf22b91[_0xd02f('0x2d')]=_['intersection'](_0xf22b91[_0xd02f('0x2f')],_0xf22b91[_0xd02f('0x2b')]);_0x561090[_0xd02f('0x32')]=_[_0xd02f('0x2e')](_0xf22b91[_0xd02f('0x2f')],qs[_0xd02f('0x30')](_0x25e172[_0xd02f('0x2b')]['fields']));_0x561090[_0xd02f('0x32')]=_0x561090[_0xd02f('0x32')][_0xd02f('0x31')]?_0x561090['attributes']:_0xf22b91[_0xd02f('0x2f')];if(!_0x25e172[_0xd02f('0x2b')][_0xd02f('0x33')](_0xd02f('0x34'))){_0x561090[_0xd02f('0x1e')]=qs[_0xd02f('0x1e')](_0x25e172[_0xd02f('0x2b')][_0xd02f('0x1e')]);_0x561090[_0xd02f('0x1c')]=qs[_0xd02f('0x1c')](_0x25e172['query']['offset']);}_0x561090[_0xd02f('0x35')]=qs[_0xd02f('0x36')](_0x25e172['query'][_0xd02f('0x36')]);_0x561090[_0xd02f('0x37')]=qs['filters'](_[_0xd02f('0x38')](_0x25e172[_0xd02f('0x2b')],_0xf22b91[_0xd02f('0x2d')]));_0x561090[_0xd02f('0x37')]['SessionId']=_0x2530fd['id'];if(_0x25e172[_0xd02f('0x2b')][_0xd02f('0x39')]){_0x561090[_0xd02f('0x37')]=_['merge'](_0x561090[_0xd02f('0x37')],{'$or':_[_0xd02f('0x3b')](_0x561090[_0xd02f('0x32')],function(_0x21b4f3){var _0x2968cf={};_0x2968cf[_0x21b4f3]={'$like':'%'+_0x25e172[_0xd02f('0x2b')][_0xd02f('0x39')]+'%'};return _0x2968cf;})});}_0x561090=_['merge']({},_0x561090,_0x25e172[_0xd02f('0x4b')]);return db[_0xd02f('0x4a')][_0xd02f('0x1f')]({'where':_0x561090[_0xd02f('0x37')]})[_0xd02f('0x25')](function(_0x11602e){_0x277c1a[_0xd02f('0x1f')]=_0x11602e;if(_0x25e172['query']['includeAll']){_0x561090['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xd02f('0x3f')](_0x561090);})['then'](function(_0x3a167f){_0x277c1a[_0xd02f('0x40')]=_0x3a167f;return _0x277c1a;});}})[_0xd02f('0x25')](respondWithFilteredResult(_0x218a69,_0x561090))[_0xd02f('0x41')](handleError(_0x218a69,null));}; \ No newline at end of file +var _0x28f6=['end','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','merge','where','type','filter','includeAll','include','rows','catch','show','params','rawAttributes','fields','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','findAll','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x175196,_0x4bfaa0){var _0x3540db=function(_0x487ceb){while(--_0x487ceb){_0x175196['push'](_0x175196['shift']());}};_0x3540db(++_0x4bfaa0);}(_0x28f6,0x17a));var _0x628f=function(_0x31dd78,_0x229701){_0x31dd78=_0x31dd78-0x0;var _0x12cfae=_0x28f6[_0x31dd78];return _0x12cfae;};'use strict';var emlformat=require(_0x628f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x628f('0x1'));var rp=require(_0x628f('0x2'));var moment=require(_0x628f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x628f('0x4'));var util=require(_0x628f('0x5'));var path=require(_0x628f('0x6'));var sox=require(_0x628f('0x7'));var csv=require(_0x628f('0x8'));var ejs=require(_0x628f('0x9'));var fs=require('fs');var fs_extra=require(_0x628f('0xa'));var _=require(_0x628f('0xb'));var squel=require(_0x628f('0xc'));var crypto=require(_0x628f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x628f('0xe'));var toCsv=require(_0x628f('0x8'));var querystring=require(_0x628f('0xf'));var Papa=require(_0x628f('0x10'));var Redis=require(_0x628f('0x11'));var authService=require(_0x628f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x628f('0x13'));var logger=require(_0x628f('0x14'))(_0x628f('0x15'));var utils=require(_0x628f('0x16'));var config=require(_0x628f('0x17'));var licenseUtil=require(_0x628f('0x18'));var db=require(_0x628f('0x19'))['db'];function respondWithStatusCode(_0x52f964,_0x5eda8b){_0x5eda8b=_0x5eda8b||0xcc;return function(_0x1036c3){if(_0x1036c3){return _0x52f964['sendStatus'](_0x5eda8b);}return _0x52f964[_0x628f('0x1a')](_0x5eda8b)[_0x628f('0x1b')]();};}function respondWithResult(_0x4eefb0,_0x3af900){_0x3af900=_0x3af900||0xc8;return function(_0xb581cd){if(_0xb581cd){return _0x4eefb0[_0x628f('0x1a')](_0x3af900)[_0x628f('0x1c')](_0xb581cd);}};}function respondWithFilteredResult(_0x268797,_0x1a054e){return function(_0x20012a){if(_0x20012a){var _0x385f08=typeof _0x1a054e[_0x628f('0x1d')]==='undefined'&&typeof _0x1a054e[_0x628f('0x1e')]===_0x628f('0x1f');var _0x264ae3=_0x20012a[_0x628f('0x20')];var _0xd71259=_0x385f08?0x0:_0x1a054e['offset'];var _0x2328a9=_0x385f08?_0x20012a[_0x628f('0x20')]:_0x1a054e['offset']+_0x1a054e[_0x628f('0x1e')];var _0x4ef8f8;if(_0x2328a9>=_0x264ae3){_0x2328a9=_0x264ae3;_0x4ef8f8=0xc8;}else{_0x4ef8f8=0xce;}_0x268797[_0x628f('0x1a')](_0x4ef8f8);return _0x268797['set'](_0x628f('0x21'),_0xd71259+'-'+_0x2328a9+'/'+_0x264ae3)[_0x628f('0x1c')](_0x20012a);}return null;};}function patchUpdates(_0x3fbcd2){return function(_0x5307a8){try{jsonpatch[_0x628f('0x22')](_0x5307a8,_0x3fbcd2,!![]);}catch(_0x3c1aa6){return BPromise['reject'](_0x3c1aa6);}return _0x5307a8[_0x628f('0x23')]();};}function saveUpdates(_0x256ef1,_0x3e12bc){return function(_0x2b48db){if(_0x2b48db){return _0x2b48db[_0x628f('0x24')](_0x256ef1)['then'](function(_0x346eab){return _0x346eab;});}return null;};}function removeEntity(_0x4252a7,_0x38c093){return function(_0x1ec995){if(_0x1ec995){return _0x1ec995[_0x628f('0x25')]()[_0x628f('0x26')](function(){_0x4252a7['status'](0xcc)[_0x628f('0x1b')]();});}};}function handleEntityNotFound(_0xf1aa97,_0xef1bc2){return function(_0x22fbdb){if(!_0x22fbdb){_0xf1aa97[_0x628f('0x27')](0x194);}return _0x22fbdb;};}function handleError(_0x55bb83,_0x107ce8){_0x107ce8=_0x107ce8||0x1f4;return function(_0x4d6d52){logger[_0x628f('0x28')](_0x4d6d52[_0x628f('0x29')]);if(_0x4d6d52['name']){delete _0x4d6d52[_0x628f('0x2a')];}_0x55bb83[_0x628f('0x1a')](_0x107ce8)[_0x628f('0x2b')](_0x4d6d52);};}exports[_0x628f('0x2c')]=function(_0xe7ec14,_0x5c42f9){var _0x218266={},_0x23fee5={},_0x5d1bed={'count':0x0,'rows':[]};var _0x424263=_[_0x628f('0x2d')](db[_0x628f('0x2e')]['rawAttributes'],function(_0x29e64a){return{'name':_0x29e64a[_0x628f('0x2f')],'type':_0x29e64a['type'][_0x628f('0x30')]};});_0x23fee5[_0x628f('0x31')]=_[_0x628f('0x2d')](_0x424263,'name');_0x23fee5[_0x628f('0x32')]=_[_0x628f('0x33')](_0xe7ec14['query']);_0x23fee5['filters']=_[_0x628f('0x34')](_0x23fee5[_0x628f('0x31')],_0x23fee5[_0x628f('0x32')]);_0x218266[_0x628f('0x35')]=_[_0x628f('0x34')](_0x23fee5[_0x628f('0x31')],qs['fields'](_0xe7ec14['query']['fields']));_0x218266[_0x628f('0x35')]=_0x218266[_0x628f('0x35')][_0x628f('0x36')]?_0x218266[_0x628f('0x35')]:_0x23fee5['model'];if(!_0xe7ec14[_0x628f('0x32')][_0x628f('0x37')](_0x628f('0x38'))){_0x218266[_0x628f('0x1e')]=qs[_0x628f('0x1e')](_0xe7ec14[_0x628f('0x32')][_0x628f('0x1e')]);_0x218266['offset']=qs[_0x628f('0x1d')](_0xe7ec14[_0x628f('0x32')][_0x628f('0x1d')]);}_0x218266['order']=qs['sort'](_0xe7ec14[_0x628f('0x32')][_0x628f('0x39')]);_0x218266['where']=qs[_0x628f('0x3a')](_[_0x628f('0x3b')](_0xe7ec14[_0x628f('0x32')],_0x23fee5[_0x628f('0x3a')]),_0x424263);if(_0xe7ec14['query']['filter']){_0x218266['where']=_[_0x628f('0x3c')](_0x218266[_0x628f('0x3d')],{'$or':_[_0x628f('0x2d')](_0x424263,function(_0xc3265e){if(_0xc3265e[_0x628f('0x3e')]!=='VIRTUAL'){var _0x3b186a={};_0x3b186a[_0xc3265e[_0x628f('0x2a')]]={'$like':'%'+_0xe7ec14['query'][_0x628f('0x3f')]+'%'};return _0x3b186a;}})});}_0x218266=_[_0x628f('0x3c')]({},_0x218266,_0xe7ec14['options']);var _0x233726={'where':_0x218266[_0x628f('0x3d')]};return db[_0x628f('0x2e')][_0x628f('0x20')](_0x233726)[_0x628f('0x26')](function(_0x4c72ba){_0x5d1bed[_0x628f('0x20')]=_0x4c72ba;if(_0xe7ec14['query'][_0x628f('0x40')]){_0x218266[_0x628f('0x41')]=[{'all':!![]}];}return db[_0x628f('0x2e')]['findAll'](_0x218266);})[_0x628f('0x26')](function(_0x43ecd8){_0x5d1bed[_0x628f('0x42')]=_0x43ecd8;return _0x5d1bed;})['then'](respondWithFilteredResult(_0x5c42f9,_0x218266))[_0x628f('0x43')](handleError(_0x5c42f9,null));};exports[_0x628f('0x44')]=function(_0x23f800,_0x461038){var _0xce8890={'raw':!![],'where':{'id':_0x23f800[_0x628f('0x45')]['id']}},_0x30c228={};_0x30c228[_0x628f('0x31')]=_[_0x628f('0x33')](db[_0x628f('0x2e')][_0x628f('0x46')]);_0x30c228['query']=_['keys'](_0x23f800['query']);_0x30c228[_0x628f('0x3a')]=_[_0x628f('0x34')](_0x30c228[_0x628f('0x31')],_0x30c228['query']);_0xce8890[_0x628f('0x35')]=_[_0x628f('0x34')](_0x30c228[_0x628f('0x31')],qs['fields'](_0x23f800[_0x628f('0x32')][_0x628f('0x47')]));_0xce8890[_0x628f('0x35')]=_0xce8890[_0x628f('0x35')][_0x628f('0x36')]?_0xce8890[_0x628f('0x35')]:_0x30c228[_0x628f('0x31')];if(_0x23f800[_0x628f('0x32')]['includeAll']){_0xce8890[_0x628f('0x41')]=[{'all':!![]}];}_0xce8890=_[_0x628f('0x3c')]({},_0xce8890,_0x23f800['options']);return db[_0x628f('0x2e')][_0x628f('0x48')](_0xce8890)[_0x628f('0x26')](handleEntityNotFound(_0x461038,null))[_0x628f('0x26')](respondWithResult(_0x461038,null))[_0x628f('0x43')](handleError(_0x461038,null));};exports[_0x628f('0x49')]=function(_0x26b468,_0x2ddf5f){return db[_0x628f('0x2e')][_0x628f('0x49')](_0x26b468[_0x628f('0x4a')],{})[_0x628f('0x26')](respondWithResult(_0x2ddf5f,0xc9))['catch'](handleError(_0x2ddf5f,null));};exports[_0x628f('0x24')]=function(_0x142657,_0x1289dc){if(_0x142657[_0x628f('0x4a')]['id']){delete _0x142657['body']['id'];}return db['JscriptySessionReport'][_0x628f('0x48')]({'where':{'id':_0x142657[_0x628f('0x45')]['id']}})[_0x628f('0x26')](handleEntityNotFound(_0x1289dc,null))[_0x628f('0x26')](saveUpdates(_0x142657[_0x628f('0x4a')],null))[_0x628f('0x26')](respondWithResult(_0x1289dc,null))[_0x628f('0x43')](handleError(_0x1289dc,null));};exports[_0x628f('0x25')]=function(_0x42fa97,_0x5d5f48){return db['JscriptySessionReport']['find']({'where':{'id':_0x42fa97['params']['id']}})['then'](handleEntityNotFound(_0x5d5f48,null))['then'](removeEntity(_0x5d5f48,null))[_0x628f('0x43')](handleError(_0x5d5f48,null));};exports[_0x628f('0x4b')]=function(_0x3470ef,_0x2832c7){return db[_0x628f('0x2e')][_0x628f('0x4b')]()[_0x628f('0x26')](respondWithResult(_0x2832c7,null))[_0x628f('0x43')](handleError(_0x2832c7,null));};exports[_0x628f('0x4c')]=function(_0x136c65,_0x143732,_0x2b2d75){var _0x5e469e={'raw':!![],'where':{}};var _0x4f9960={};var _0x194eb0={'count':0x0,'rows':[]};return db[_0x628f('0x2e')][_0x628f('0x4d')]({'where':{'id':_0x136c65['params']['id']}})[_0x628f('0x26')](handleEntityNotFound(_0x143732,null))[_0x628f('0x26')](function(_0x48d556){if(_0x48d556){_0x4f9960[_0x628f('0x31')]=_[_0x628f('0x33')](db[_0x628f('0x4e')][_0x628f('0x46')]);_0x4f9960['query']=_[_0x628f('0x33')](_0x136c65['query']);_0x4f9960['filters']=_[_0x628f('0x34')](_0x4f9960[_0x628f('0x31')],_0x4f9960['query']);_0x5e469e[_0x628f('0x35')]=_['intersection'](_0x4f9960[_0x628f('0x31')],qs['fields'](_0x136c65[_0x628f('0x32')][_0x628f('0x47')]));_0x5e469e[_0x628f('0x35')]=_0x5e469e['attributes']['length']?_0x5e469e[_0x628f('0x35')]:_0x4f9960[_0x628f('0x31')];if(!_0x136c65['query'][_0x628f('0x37')](_0x628f('0x38'))){_0x5e469e[_0x628f('0x1e')]=qs['limit'](_0x136c65[_0x628f('0x32')][_0x628f('0x1e')]);_0x5e469e[_0x628f('0x1d')]=qs[_0x628f('0x1d')](_0x136c65[_0x628f('0x32')]['offset']);}_0x5e469e['order']=qs[_0x628f('0x39')](_0x136c65[_0x628f('0x32')][_0x628f('0x39')]);_0x5e469e[_0x628f('0x3d')]=qs[_0x628f('0x3a')](_[_0x628f('0x3b')](_0x136c65[_0x628f('0x32')],_0x4f9960[_0x628f('0x3a')]));_0x5e469e[_0x628f('0x3d')][_0x628f('0x4f')]=_0x48d556['id'];if(_0x136c65['query'][_0x628f('0x3f')]){_0x5e469e[_0x628f('0x3d')]=_[_0x628f('0x3c')](_0x5e469e[_0x628f('0x3d')],{'$or':_[_0x628f('0x2d')](_0x5e469e[_0x628f('0x35')],function(_0x3d3439){var _0x5d25e1={};_0x5d25e1[_0x3d3439]={'$like':'%'+_0x136c65[_0x628f('0x32')][_0x628f('0x3f')]+'%'};return _0x5d25e1;})});}_0x5e469e=_[_0x628f('0x3c')]({},_0x5e469e,_0x136c65['options']);return db[_0x628f('0x4e')]['count']({'where':_0x5e469e['where']})[_0x628f('0x26')](function(_0x4a5f1b){_0x194eb0[_0x628f('0x20')]=_0x4a5f1b;if(_0x136c65['query'][_0x628f('0x40')]){_0x5e469e[_0x628f('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x628f('0x50')](_0x5e469e);})[_0x628f('0x26')](function(_0x5bd89d){_0x194eb0[_0x628f('0x42')]=_0x5bd89d;return _0x194eb0;});}})[_0x628f('0x26')](respondWithFilteredResult(_0x143732,_0x5e469e))[_0x628f('0x43')](handleError(_0x143732,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 978a5be..4e7b8a0 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 _0x0309=['rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x0309,0x165));var _0x9030=function(_0x2326f1,_0xad74c2){_0x2326f1=_0x2326f1-0x0;var _0x20d096=_0x0309[_0x2326f1];return _0x20d096;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var fs=require('fs');var path=require(_0x9030('0x5'));var rimraf=require(_0x9030('0x6'));var config=require(_0x9030('0x7'));var attributes=require(_0x9030('0x8'));module['exports']=function(_0x5a3334,_0x1c9c7b){return _0x5a3334[_0x9030('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x9030('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['exports','define','JscriptySessionReport','report_jscripty_sessions','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0xa92626,_0x17aa05){var _0x11b8a2=function(_0x4fd188){while(--_0x4fd188){_0xa92626['push'](_0xa92626['shift']());}};_0x11b8a2(++_0x17aa05);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 93a6285..37c2b80 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1c9f84,_0x12db77){var _0x250013=function(_0x48ec8f){while(--_0x48ec8f){_0x1c9f84['push'](_0x1c9f84['shift']());}};_0x250013(++_0x12db77);}(_0xadb5,0xad));var _0x5adb=function(_0x3d1808,_0x11d16d){_0x3d1808=_0x3d1808-0x0;var _0x2e8b6b=_0xadb5[_0x3d1808];return _0x2e8b6b;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0xbff5=['message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbff5,0x1bc));var _0x5bff=function(_0x7c3dd3,_0x50705e){_0x7c3dd3=_0x7c3dd3-0x0;var _0x11039e=_0xbff5[_0x7c3dd3];return _0x11039e;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var moment=require(_0x5bff('0x2'));var BPromise=require(_0x5bff('0x3'));var rs=require(_0x5bff('0x4'));var fs=require('fs');var Redis=require(_0x5bff('0x5'));var db=require(_0x5bff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5bff('0x8'));var client=jayson[_0x5bff('0x9')][_0x5bff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa54c57,_0x43605a,_0xd4b9dc){return new BPromise(function(_0x1acb49,_0x139c99){return client[_0x5bff('0xb')](_0xa54c57,_0xd4b9dc)['then'](function(_0x20e26f){logger['info'](_0x5bff('0xc'),_0x43605a,_0x5bff('0xd'));logger['debug'](_0x5bff('0xe'),_0x43605a,'request\x20sent',JSON[_0x5bff('0xf')](_0x20e26f));if(_0x20e26f['error']){if(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x11')]===0x1f4){logger['error'](_0x5bff('0xc'),_0x43605a,_0x20e26f['error'][_0x5bff('0x12')]);return _0x139c99(_0x20e26f[_0x5bff('0x10')]['message']);}logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x20e26f['error']['message']);return _0x1acb49(_0x20e26f[_0x5bff('0x10')][_0x5bff('0x12')]);}else{logger[_0x5bff('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x43605a,_0x5bff('0xd'));_0x1acb49(_0x20e26f[_0x5bff('0x14')][_0x5bff('0x12')]);}})['catch'](function(_0x3ffbbc){logger[_0x5bff('0x10')](_0x5bff('0xc'),_0x43605a,_0x3ffbbc);_0x139c99(_0x3ffbbc);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 72f2389..63a684f 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 _0x5bf0=['get','index','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x412435,_0x2cd920){var _0x26cdf1=function(_0x2c235e){while(--_0x2c235e){_0x412435['push'](_0x412435['shift']());}};_0x26cdf1(++_0x2cd920);}(_0x5bf0,0xe7));var _0x05bf=function(_0x292867,_0x21016d){_0x292867=_0x292867-0x0;var _0x1c2d39=_0x5bf0[_0x292867];return _0x1c2d39;};'use strict';var multer=require(_0x05bf('0x0'));var util=require(_0x05bf('0x1'));var path=require(_0x05bf('0x2'));var timeout=require(_0x05bf('0x3'));var express=require(_0x05bf('0x4'));var router=express[_0x05bf('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x05bf('0x6'));var config=require(_0x05bf('0x7'));var controller=require(_0x05bf('0x8'));router[_0x05bf('0x9')]('/',controller[_0x05bf('0xa')]);router['put'](_0x05bf('0xb'),auth[_0x05bf('0xc')](),controller[_0x05bf('0xd')]);router[_0x05bf('0x9')]('/download_log_file',auth[_0x05bf('0xc')](),controller['downloadLogFile']);module[_0x05bf('0xe')]=router; \ No newline at end of file +var _0x317e=['../../components/interaction/service','./license.controller','get','index','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x12c07a,_0x59e67b){var _0x503939=function(_0xd21b9d){while(--_0xd21b9d){_0x12c07a['push'](_0x12c07a['shift']());}};_0x503939(++_0x59e67b);}(_0x317e,0x1c9));var _0xe317=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x317e[_0xc67528];return _0x38e26d;};'use strict';var multer=require(_0xe317('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe317('0x1'));var express=require(_0xe317('0x2'));var router=express[_0xe317('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe317('0x4'));var interaction=require(_0xe317('0x5'));var config=require('../../config/environment');var controller=require(_0xe317('0x6'));router[_0xe317('0x7')]('/',controller[_0xe317('0x8')]);router['put']('/:id',auth[_0xe317('0x9')](),controller[_0xe317('0xa')]);router[_0xe317('0x7')](_0xe317('0xb'),auth['isAuthenticated'](),controller[_0xe317('0xc')]);module[_0xe317('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index d1231a2..a68203a 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 _0x5218=['STRING','INTEGER','exports','TEXT'];(function(_0x1d310f,_0x51525){var _0x2bdd33=function(_0x17a953){while(--_0x17a953){_0x1d310f['push'](_0x1d310f['shift']());}};_0x2bdd33(++_0x51525);}(_0x5218,0x19a));var _0x8521=function(_0x24084b,_0x2bdf36){_0x24084b=_0x24084b-0x0;var _0x3cafdb=_0x5218[_0x24084b];return _0x3cafdb;};'use strict';var Sequelize=require('sequelize');module[_0x8521('0x0')]={'license':{'type':Sequelize[_0x8521('0x1')]},'data1':{'type':Sequelize[_0x8521('0x2')]},'data2':{'type':Sequelize[_0x8521('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x8521('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x379d=['sequelize','TEXT','STRING'];(function(_0x49158f,_0x231e20){var _0x54a1fc=function(_0x4439d5){while(--_0x4439d5){_0x49158f['push'](_0x49158f['shift']());}};_0x54a1fc(++_0x231e20);}(_0x379d,0x8a));var _0xd379=function(_0xd08c13,_0x28de8e){_0xd08c13=_0xd08c13-0x0;var _0x3f12e1=_0x379d[_0xd08c13];return _0x3f12e1;};'use strict';var Sequelize=require(_0xd379('0x0'));module['exports']={'license':{'type':Sequelize[_0xd379('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xd379('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 af664d4..42a4739 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 _0xa809=['../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','keys','License','rawAttributes','query','model','attributes','intersection','fields','length','merge','catch','body','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x5447aa,_0x3afc00){var _0xb21e53=function(_0x2d05f6){while(--_0x2d05f6){_0x5447aa['push'](_0x5447aa['shift']());}};_0xb21e53(++_0x3afc00);}(_0xa809,0x16e));var _0x9a80=function(_0x250426,_0x2dbe36){_0x250426=_0x250426-0x0;var _0x5f9d95=_0xa809[_0x250426];return _0x5f9d95;};'use strict';var emlformat=require(_0x9a80('0x0'));var rimraf=require(_0x9a80('0x1'));var zipdir=require(_0x9a80('0x2'));var jsonpatch=require(_0x9a80('0x3'));var rp=require(_0x9a80('0x4'));var moment=require(_0x9a80('0x5'));var BPromise=require(_0x9a80('0x6'));var Mustache=require(_0x9a80('0x7'));var util=require('util');var path=require(_0x9a80('0x8'));var sox=require('sox');var csv=require(_0x9a80('0x9'));var ejs=require(_0x9a80('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9a80('0xb'));var crypto=require(_0x9a80('0xc'));var jsforce=require(_0x9a80('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9a80('0x9'));var querystring=require(_0x9a80('0xe'));var Papa=require(_0x9a80('0xf'));var Redis=require('ioredis');var authService=require(_0x9a80('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9a80('0x11'));var hardwareService=require(_0x9a80('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9a80('0x13'));var licenseUtil=require(_0x9a80('0x14'));var db=require(_0x9a80('0x15'))['db'];function respondWithStatusCode(_0x1af8c7,_0x11bdc3){_0x11bdc3=_0x11bdc3||0xcc;return function(_0xb12d3b){if(_0xb12d3b){return _0x1af8c7[_0x9a80('0x16')](_0x11bdc3);}return _0x1af8c7[_0x9a80('0x17')](_0x11bdc3)[_0x9a80('0x18')]();};}function respondWithResult(_0x41432c,_0x500d73){_0x500d73=_0x500d73||0xc8;return function(_0x329d14){if(_0x329d14){return _0x41432c['status'](_0x500d73)[_0x9a80('0x19')](_0x329d14);}};}function respondWithFilteredResult(_0x55860d,_0x15bacf){return function(_0x556d91){if(_0x556d91){var _0x176584=typeof _0x15bacf[_0x9a80('0x1a')]===_0x9a80('0x1b')&&typeof _0x15bacf[_0x9a80('0x1c')]===_0x9a80('0x1b');var _0x13da53=_0x556d91[_0x9a80('0x1d')];var _0x207b96=_0x176584?0x0:_0x15bacf[_0x9a80('0x1a')];var _0x5167aa=_0x176584?_0x556d91['count']:_0x15bacf[_0x9a80('0x1a')]+_0x15bacf[_0x9a80('0x1c')];var _0x5148b6;if(_0x5167aa>=_0x13da53){_0x5167aa=_0x13da53;_0x5148b6=0xc8;}else{_0x5148b6=0xce;}_0x55860d[_0x9a80('0x17')](_0x5148b6);return _0x55860d['set'](_0x9a80('0x1e'),_0x207b96+'-'+_0x5167aa+'/'+_0x13da53)['json'](_0x556d91);}return null;};}function patchUpdates(_0x52cc10){return function(_0x563425){try{jsonpatch['apply'](_0x563425,_0x52cc10,!![]);}catch(_0x2fdab6){return BPromise[_0x9a80('0x1f')](_0x2fdab6);}return _0x563425[_0x9a80('0x20')]();};}function saveUpdates(_0xc4d220,_0x402768){return function(_0xd7e671){if(_0xd7e671){return _0xd7e671[_0x9a80('0x21')](_0xc4d220)[_0x9a80('0x22')](function(_0x5ada8e){return _0x5ada8e;});}return null;};}function removeEntity(_0x588f12,_0xd62795){return function(_0x2e7180){if(_0x2e7180){return _0x2e7180[_0x9a80('0x23')]()[_0x9a80('0x22')](function(){_0x588f12[_0x9a80('0x17')](0xcc)[_0x9a80('0x18')]();});}};}function handleEntityNotFound(_0x21543f,_0x1f97bc){return function(_0x3ffd46){if(!_0x3ffd46){_0x21543f['sendStatus'](0x194);}return _0x3ffd46;};}function handleError(_0x1f7ab8,_0x4072fb){_0x4072fb=_0x4072fb||0x1f4;return function(_0x51b003){logger[_0x9a80('0x24')](_0x51b003[_0x9a80('0x25')]);if(_0x51b003[_0x9a80('0x26')]){delete _0x51b003['name'];}_0x1f7ab8[_0x9a80('0x17')](_0x4072fb)[_0x9a80('0x27')](_0x51b003);};}var utilLicense=require(_0x9a80('0x14'));exports['index']=function(_0x15584a,_0x29e923){var _0x6bccea={'raw':!![],'where':{'id':0x1}},_0x7be8f3={};_0x7be8f3['model']=_[_0x9a80('0x28')](db[_0x9a80('0x29')][_0x9a80('0x2a')]);_0x7be8f3[_0x9a80('0x2b')]=_[_0x9a80('0x28')](_0x15584a[_0x9a80('0x2b')]);_0x7be8f3['filters']=_['intersection'](_0x7be8f3[_0x9a80('0x2c')],_0x7be8f3[_0x9a80('0x2b')]);_0x6bccea[_0x9a80('0x2d')]=_[_0x9a80('0x2e')](_0x7be8f3[_0x9a80('0x2c')],qs[_0x9a80('0x2f')](_0x15584a[_0x9a80('0x2b')][_0x9a80('0x2f')]));_0x6bccea['attributes']=_0x6bccea[_0x9a80('0x2d')][_0x9a80('0x30')]?_0x6bccea[_0x9a80('0x2d')]:_0x7be8f3[_0x9a80('0x2c')];_0x6bccea=_[_0x9a80('0x31')]({},_0x6bccea,_0x15584a['options']);return utilLicense['getLicense'](_0x6bccea)[_0x9a80('0x22')](respondWithResult(_0x29e923,null))[_0x9a80('0x32')](handleError(_0x29e923,null));};exports[_0x9a80('0x21')]=function(_0x399eac,_0x472483){if(_0x399eac['body']['id']){delete _0x399eac['body']['id'];}return db['License']['find']({'where':{'id':_0x399eac['params']['id']}})[_0x9a80('0x22')](handleEntityNotFound(_0x472483,null))[_0x9a80('0x22')](function(_0x254239){var _0x7226a3=_0x254239['get']({'plain':!![]});return utilLicense['checkLicense'](_0x7226a3,_0x399eac[_0x9a80('0x33')]['key']);})[_0x9a80('0x22')](function(_0xc07aed){if(!_0xc07aed[_0x9a80('0x34')]){return saveUpdates(_0x399eac['body'],null);}return _0xc07aed;})[_0x9a80('0x22')](respondWithResult(_0x472483,null))['catch'](handleError(_0x472483,null));};exports[_0x9a80('0x35')]=function(_0x225564,_0x193d85){var _0xe3f0b8=_0x9a80('0x36');var _0x456201=path[_0x9a80('0x37')](_0x9a80('0x38'),_0x9a80('0x39'),_0x9a80('0x3a'),_0xe3f0b8);_0x193d85[_0x9a80('0x3b')](_0x9a80('0x3c'),_0x9a80('0x3d')+_0xe3f0b8);_0x193d85[_0x9a80('0x3e')]('Content-Type','text/plain');_0x193d85[_0x9a80('0x3f')](_0x456201);}; \ No newline at end of file +var _0xe7f7=['download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','model','keys','License','rawAttributes','query','intersection','fields','attributes','length','merge','catch','body','find','checkLicense','key','downloadLogFile','license-info.log','log','setHeader','Content-disposition','attachment;\x20filename=','text/plain'];(function(_0x58ebab,_0x50c528){var _0xd0cb0a=function(_0x3f5e13){while(--_0x3f5e13){_0x58ebab['push'](_0x58ebab['shift']());}};_0xd0cb0a(++_0x50c528);}(_0xe7f7,0x1a5));var _0x7e7f=function(_0x1bd230,_0x1da01e){_0x1bd230=_0x1bd230-0x0;var _0x19a3e3=_0xe7f7[_0x1bd230];return _0x19a3e3;};'use strict';var emlformat=require(_0x7e7f('0x0'));var rimraf=require(_0x7e7f('0x1'));var zipdir=require(_0x7e7f('0x2'));var jsonpatch=require(_0x7e7f('0x3'));var rp=require(_0x7e7f('0x4'));var moment=require(_0x7e7f('0x5'));var BPromise=require(_0x7e7f('0x6'));var Mustache=require('mustache');var util=require(_0x7e7f('0x7'));var path=require(_0x7e7f('0x8'));var sox=require(_0x7e7f('0x9'));var csv=require('to-csv');var ejs=require(_0x7e7f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e7f('0xb'));var squel=require(_0x7e7f('0xc'));var crypto=require(_0x7e7f('0xd'));var jsforce=require(_0x7e7f('0xe'));var deskjs=require(_0x7e7f('0xf'));var toCsv=require(_0x7e7f('0x10'));var querystring=require(_0x7e7f('0x11'));var Papa=require(_0x7e7f('0x12'));var Redis=require(_0x7e7f('0x13'));var authService=require(_0x7e7f('0x14'));var qs=require(_0x7e7f('0x15'));var as=require(_0x7e7f('0x16'));var hardwareService=require(_0x7e7f('0x17'));var logger=require('../../config/logger')(_0x7e7f('0x18'));var utils=require(_0x7e7f('0x19'));var config=require(_0x7e7f('0x1a'));var licenseUtil=require(_0x7e7f('0x1b'));var db=require(_0x7e7f('0x1c'))['db'];function respondWithStatusCode(_0x573752,_0x3fa085){_0x3fa085=_0x3fa085||0xcc;return function(_0x5d304f){if(_0x5d304f){return _0x573752[_0x7e7f('0x1d')](_0x3fa085);}return _0x573752[_0x7e7f('0x1e')](_0x3fa085)[_0x7e7f('0x1f')]();};}function respondWithResult(_0x3b4cba,_0x2da7b5){_0x2da7b5=_0x2da7b5||0xc8;return function(_0x188095){if(_0x188095){return _0x3b4cba[_0x7e7f('0x1e')](_0x2da7b5)[_0x7e7f('0x20')](_0x188095);}};}function respondWithFilteredResult(_0x2ec91d,_0xcdabee){return function(_0x34cde6){if(_0x34cde6){var _0x2e2a95=typeof _0xcdabee[_0x7e7f('0x21')]===_0x7e7f('0x22')&&typeof _0xcdabee[_0x7e7f('0x23')]===_0x7e7f('0x22');var _0x336cbc=_0x34cde6['count'];var _0x138be5=_0x2e2a95?0x0:_0xcdabee[_0x7e7f('0x21')];var _0x53c45f=_0x2e2a95?_0x34cde6[_0x7e7f('0x24')]:_0xcdabee[_0x7e7f('0x21')]+_0xcdabee[_0x7e7f('0x23')];var _0x213615;if(_0x53c45f>=_0x336cbc){_0x53c45f=_0x336cbc;_0x213615=0xc8;}else{_0x213615=0xce;}_0x2ec91d['status'](_0x213615);return _0x2ec91d[_0x7e7f('0x25')]('Content-Range',_0x138be5+'-'+_0x53c45f+'/'+_0x336cbc)[_0x7e7f('0x20')](_0x34cde6);}return null;};}function patchUpdates(_0x52eb5e){return function(_0x58b524){try{jsonpatch[_0x7e7f('0x26')](_0x58b524,_0x52eb5e,!![]);}catch(_0xe4978b){return BPromise[_0x7e7f('0x27')](_0xe4978b);}return _0x58b524['save']();};}function saveUpdates(_0x3d9bf8,_0x52c2a8){return function(_0x5afbc9){if(_0x5afbc9){return _0x5afbc9[_0x7e7f('0x28')](_0x3d9bf8)[_0x7e7f('0x29')](function(_0x5e0104){return _0x5e0104;});}return null;};}function removeEntity(_0x2df0d1,_0x49a001){return function(_0x30f63b){if(_0x30f63b){return _0x30f63b[_0x7e7f('0x2a')]()[_0x7e7f('0x29')](function(){_0x2df0d1[_0x7e7f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18842e,_0x312267){return function(_0xe84ac0){if(!_0xe84ac0){_0x18842e[_0x7e7f('0x1d')](0x194);}return _0xe84ac0;};}function handleError(_0x56fe80,_0x46e991){_0x46e991=_0x46e991||0x1f4;return function(_0x2e5f52){logger[_0x7e7f('0x2b')](_0x2e5f52[_0x7e7f('0x2c')]);if(_0x2e5f52['name']){delete _0x2e5f52[_0x7e7f('0x2d')];}_0x56fe80[_0x7e7f('0x1e')](_0x46e991)[_0x7e7f('0x2e')](_0x2e5f52);};}var utilLicense=require(_0x7e7f('0x1b'));exports['index']=function(_0x417ae4,_0x3cef4f){var _0x5d31a2={'raw':!![],'where':{'id':0x1}},_0xf2d264={};_0xf2d264[_0x7e7f('0x2f')]=_[_0x7e7f('0x30')](db[_0x7e7f('0x31')][_0x7e7f('0x32')]);_0xf2d264[_0x7e7f('0x33')]=_[_0x7e7f('0x30')](_0x417ae4['query']);_0xf2d264['filters']=_[_0x7e7f('0x34')](_0xf2d264[_0x7e7f('0x2f')],_0xf2d264[_0x7e7f('0x33')]);_0x5d31a2['attributes']=_[_0x7e7f('0x34')](_0xf2d264[_0x7e7f('0x2f')],qs['fields'](_0x417ae4[_0x7e7f('0x33')][_0x7e7f('0x35')]));_0x5d31a2['attributes']=_0x5d31a2[_0x7e7f('0x36')][_0x7e7f('0x37')]?_0x5d31a2['attributes']:_0xf2d264['model'];_0x5d31a2=_[_0x7e7f('0x38')]({},_0x5d31a2,_0x417ae4['options']);return utilLicense['getLicense'](_0x5d31a2)[_0x7e7f('0x29')](respondWithResult(_0x3cef4f,null))[_0x7e7f('0x39')](handleError(_0x3cef4f,null));};exports[_0x7e7f('0x28')]=function(_0x14c593,_0x1e623d){if(_0x14c593[_0x7e7f('0x3a')]['id']){delete _0x14c593[_0x7e7f('0x3a')]['id'];}return db[_0x7e7f('0x31')][_0x7e7f('0x3b')]({'where':{'id':_0x14c593['params']['id']}})[_0x7e7f('0x29')](handleEntityNotFound(_0x1e623d,null))[_0x7e7f('0x29')](function(_0x67fb1){var _0x1210a6=_0x67fb1['get']({'plain':!![]});return utilLicense[_0x7e7f('0x3c')](_0x1210a6,_0x14c593[_0x7e7f('0x3a')][_0x7e7f('0x3d')]);})[_0x7e7f('0x29')](function(_0x440e8a){if(!_0x440e8a['demo']){return saveUpdates(_0x14c593[_0x7e7f('0x3a')],null);}return _0x440e8a;})['then'](respondWithResult(_0x1e623d,null))[_0x7e7f('0x39')](handleError(_0x1e623d,null));};exports[_0x7e7f('0x3e')]=function(_0x4a7889,_0x508c53){var _0x1b89f8=_0x7e7f('0x3f');var _0x5e4b99=path['join']('/var',_0x7e7f('0x40'),'xcally',_0x1b89f8);_0x508c53[_0x7e7f('0x41')](_0x7e7f('0x42'),_0x7e7f('0x43')+_0x1b89f8);_0x508c53[_0x7e7f('0x25')]('Content-Type',_0x7e7f('0x44'));_0x508c53[_0x7e7f('0x45')](_0x5e4b99);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 2552862..01ca696 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 _0x3931=['./license.attributes','define','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3ce0d5,_0x203024){var _0x2e5731=function(_0x4be620){while(--_0x4be620){_0x3ce0d5['push'](_0x3ce0d5['shift']());}};_0x2e5731(++_0x203024);}(_0x3931,0x14b));var _0x1393=function(_0x8e86ad,_0x439bde){_0x8e86ad=_0x8e86ad-0x0;var _0x12a306=_0x3931[_0x8e86ad];return _0x12a306;};'use strict';var _=require('lodash');var util=require(_0x1393('0x0'));var logger=require(_0x1393('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1393('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1393('0x3'));var rimraf=require(_0x1393('0x4'));var config=require('../../config/environment');var attributes=require(_0x1393('0x5'));module['exports']=function(_0x25ba7f,_0x82a95a){return _0x25ba7f[_0x1393('0x6')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19ad=['./license.attributes','exports','License','license','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x11eb76,_0x30612c){var _0xec8c6e=function(_0x33961d){while(--_0x33961d){_0x11eb76['push'](_0x11eb76['shift']());}};_0xec8c6e(++_0x30612c);}(_0x19ad,0x9e));var _0xd19a=function(_0x51f3a2,_0x3368c7){_0x51f3a2=_0x51f3a2-0x0;var _0x4ba8f7=_0x19ad[_0x51f3a2];return _0x4ba8f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd19a('0x0'))('api');var moment=require(_0xd19a('0x1'));var BPromise=require(_0xd19a('0x2'));var rp=require(_0xd19a('0x3'));var fs=require('fs');var path=require(_0xd19a('0x4'));var rimraf=require(_0xd19a('0x5'));var config=require(_0xd19a('0x6'));var attributes=require(_0xd19a('0x7'));module[_0xd19a('0x8')]=function(_0x1f7cbe,_0x135fdd){return _0x1f7cbe['define'](_0xd19a('0x9'),attributes,{'tableName':_0xd19a('0xa'),'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 0bc68ff..df33c9a 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 _0x558e=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x52edfd,_0x4844ce){var _0x58b9e5=function(_0x502a1){while(--_0x502a1){_0x52edfd['push'](_0x52edfd['shift']());}};_0x58b9e5(++_0x4844ce);}(_0x558e,0x193));var _0xe558=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x558e[_0x118139];return _0x2fece9;};'use strict';var _=require(_0xe558('0x0'));var util=require(_0xe558('0x1'));var moment=require(_0xe558('0x2'));var BPromise=require(_0xe558('0x3'));var rs=require(_0xe558('0x4'));var fs=require('fs');var Redis=require(_0xe558('0x5'));var db=require(_0xe558('0x6'))['db'];var utils=require(_0xe558('0x7'));var logger=require('../../config/logger')(_0xe558('0x8'));var config=require(_0xe558('0x9'));var jayson=require(_0xe558('0xa'));var client=jayson[_0xe558('0xb')][_0xe558('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b5b68,_0x28006b,_0x5ce096){return new BPromise(function(_0x235be5,_0x23e0a5){return client[_0xe558('0xd')](_0x5b5b68,_0x5ce096)[_0xe558('0xe')](function(_0xe374b8){logger[_0xe558('0xf')](_0xe558('0x10'),_0x28006b,_0xe558('0x11'));logger['debug'](_0xe558('0x12'),_0x28006b,_0xe558('0x11'),JSON[_0xe558('0x13')](_0xe374b8));if(_0xe374b8['error']){if(_0xe374b8[_0xe558('0x14')]['code']===0x1f4){logger[_0xe558('0x14')](_0xe558('0x10'),_0x28006b,_0xe374b8[_0xe558('0x14')][_0xe558('0x15')]);return _0x23e0a5(_0xe374b8[_0xe558('0x14')][_0xe558('0x15')]);}logger[_0xe558('0x14')](_0xe558('0x10'),_0x28006b,_0xe374b8[_0xe558('0x14')][_0xe558('0x15')]);return _0x235be5(_0xe374b8[_0xe558('0x14')][_0xe558('0x15')]);}else{logger[_0xe558('0xf')](_0xe558('0x10'),_0x28006b,_0xe558('0x11'));_0x235be5(_0xe374b8[_0xe558('0x16')][_0xe558('0x15')]);}})[_0xe558('0x17')](function(_0x39e5ba){logger[_0xe558('0x14')](_0xe558('0x10'),_0x28006b,_0x39e5ba);_0x23e0a5(_0x39e5ba);});});} \ No newline at end of file +var _0x8a7c=['License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','then','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0x41e895,_0x2cc950){var _0x19eca6=function(_0x56ba49){while(--_0x56ba49){_0x41e895['push'](_0x41e895['shift']());}};_0x19eca6(++_0x2cc950);}(_0x8a7c,0x1eb));var _0xc8a7=function(_0xb28bbb,_0x135cc2){_0xb28bbb=_0xb28bbb-0x0;var _0xd133cd=_0x8a7c[_0xb28bbb];return _0xd133cd;};'use strict';var _=require(_0xc8a7('0x0'));var util=require('util');var moment=require(_0xc8a7('0x1'));var BPromise=require(_0xc8a7('0x2'));var rs=require(_0xc8a7('0x3'));var fs=require('fs');var Redis=require(_0xc8a7('0x4'));var db=require(_0xc8a7('0x5'))['db'];var utils=require(_0xc8a7('0x6'));var logger=require(_0xc8a7('0x7'))(_0xc8a7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47d80b,_0x2b9018,_0x406c1c){return new BPromise(function(_0x278397,_0x762cb2){return client['request'](_0x47d80b,_0x406c1c)[_0xc8a7('0x9')](function(_0x37cec0){logger[_0xc8a7('0xa')](_0xc8a7('0xb'),_0x2b9018,_0xc8a7('0xc'));logger['debug'](_0xc8a7('0xd'),_0x2b9018,'request\x20sent',JSON[_0xc8a7('0xe')](_0x37cec0));if(_0x37cec0[_0xc8a7('0xf')]){if(_0x37cec0[_0xc8a7('0xf')][_0xc8a7('0x10')]===0x1f4){logger[_0xc8a7('0xf')](_0xc8a7('0xb'),_0x2b9018,_0x37cec0[_0xc8a7('0xf')][_0xc8a7('0x11')]);return _0x762cb2(_0x37cec0[_0xc8a7('0xf')][_0xc8a7('0x11')]);}logger['error']('License,\x20%s,\x20%s',_0x2b9018,_0x37cec0[_0xc8a7('0xf')]['message']);return _0x278397(_0x37cec0[_0xc8a7('0xf')][_0xc8a7('0x11')]);}else{logger[_0xc8a7('0xa')](_0xc8a7('0xb'),_0x2b9018,_0xc8a7('0xc'));_0x278397(_0x37cec0['result']['message']);}})['catch'](function(_0x4240d8){logger[_0xc8a7('0xf')]('License,\x20%s,\x20%s',_0x2b9018,_0x4240d8);_0x762cb2(_0x4240d8);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index ac1fdc6..fd2f5a0 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 _0x9cef=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','/:id/out_servers','addApplications','/:id/send','send','addAgents','put','update','removeDispositions','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path'];(function(_0x332133,_0x5286b1){var _0x266d85=function(_0x29183e){while(--_0x29183e){_0x332133['push'](_0x332133['shift']());}};_0x266d85(++_0x5286b1);}(_0x9cef,0x14d));var _0xf9ce=function(_0x19b709,_0x373b44){_0x19b709=_0x19b709-0x0;var _0x29eb28=_0x9cef[_0x19b709];return _0x29eb28;};'use strict';var multer=require(_0xf9ce('0x0'));var util=require(_0xf9ce('0x1'));var path=require(_0xf9ce('0x2'));var timeout=require('connect-timeout');var express=require(_0xf9ce('0x3'));var router=express[_0xf9ce('0x4')]();var fs_extra=require(_0xf9ce('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf9ce('0x6'));var config=require(_0xf9ce('0x7'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x9')]);router[_0xf9ce('0xa')](_0xf9ce('0xb'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0xc')]);router[_0xf9ce('0xa')](_0xf9ce('0xd'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0xe')]);router[_0xf9ce('0xa')](_0xf9ce('0xf'),auth[_0xf9ce('0x8')](),controller['getDispositions']);router[_0xf9ce('0xa')](_0xf9ce('0x10'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x11')]);router[_0xf9ce('0xa')](_0xf9ce('0x12'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x13')]);router[_0xf9ce('0xa')]('/:id/out_servers',auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x14')]);router[_0xf9ce('0xa')](_0xf9ce('0x15'),auth['isAuthenticated'](),controller[_0xf9ce('0x16')]);router[_0xf9ce('0xa')](_0xf9ce('0x17'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0xf9ce('0x18'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x19')]);router[_0xf9ce('0xa')](_0xf9ce('0x1a'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x1b')]);router['get'](_0xf9ce('0x1c'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x1d')]);router[_0xf9ce('0x1e')]('/:id/dispositions',auth[_0xf9ce('0x8')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf9ce('0x1f')]);router[_0xf9ce('0x1e')]('/',auth['isAuthenticated'](),controller[_0xf9ce('0x20')]);router[_0xf9ce('0x1e')]('/:id/in_servers',auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x21')]);router[_0xf9ce('0x1e')](_0xf9ce('0x22'),auth[_0xf9ce('0x8')](),controller['addSmtp']);router[_0xf9ce('0x1e')]('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0xf9ce('0x17'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x23')]);router[_0xf9ce('0x1e')](_0xf9ce('0x24'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x25')]);router[_0xf9ce('0x1e')](_0xf9ce('0x1c'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x26')]);router[_0xf9ce('0x27')](_0xf9ce('0xd'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x28')]);router['delete'](_0xf9ce('0xf'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x29')]);router['delete'](_0xf9ce('0x10'),auth[_0xf9ce('0x8')](),controller['removeAnswers']);router[_0xf9ce('0x2a')](_0xf9ce('0x12'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x2b')]);router['delete']('/:id/out_servers',auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x2c')]);router[_0xf9ce('0x2a')]('/:id',auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x2d')]);router[_0xf9ce('0x2a')](_0xf9ce('0x1c'),auth[_0xf9ce('0x8')](),controller[_0xf9ce('0x2e')]);module[_0xf9ce('0x2f')]=router; \ No newline at end of file +var _0xe3b8=['/:id/users','getAgents','post','/:id/canned_answers','addAnswer','create','addSmtp','/:id/send','send','addAgents','put','update','removeDispositions','removeImap','delete','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0xe3b8,0x163));var _0x8e3b=function(_0x2ffd6f,_0x485551){_0x2ffd6f=_0x2ffd6f-0x0;var _0x49b01b=_0xe3b8[_0x2ffd6f];return _0x49b01b;};'use strict';var multer=require(_0x8e3b('0x0'));var util=require(_0x8e3b('0x1'));var path=require(_0x8e3b('0x2'));var timeout=require(_0x8e3b('0x3'));var express=require(_0x8e3b('0x4'));var router=express[_0x8e3b('0x5')]();var fs_extra=require(_0x8e3b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e3b('0x7'));var controller=require('./mailAccount.controller');router[_0x8e3b('0x8')]('/',auth[_0x8e3b('0x9')](),controller[_0x8e3b('0xa')]);router[_0x8e3b('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x8e3b('0xb')]);router[_0x8e3b('0x8')](_0x8e3b('0xc'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0xd')]);router[_0x8e3b('0x8')](_0x8e3b('0xe'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0xf')]);router[_0x8e3b('0x8')]('/:id/canned_answers',auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x10')]);router['get'](_0x8e3b('0x11'),auth['isAuthenticated'](),controller[_0x8e3b('0x12')]);router[_0x8e3b('0x8')](_0x8e3b('0x13'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x14')]);router[_0x8e3b('0x8')](_0x8e3b('0x15'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x16')]);router[_0x8e3b('0x8')](_0x8e3b('0x17'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x18')]);router[_0x8e3b('0x8')](_0x8e3b('0x19'),auth['isAuthenticated'](),controller[_0x8e3b('0x1a')]);router[_0x8e3b('0x8')](_0x8e3b('0x1b'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x1c')]);router[_0x8e3b('0x8')](_0x8e3b('0x1d'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x1e')]);router[_0x8e3b('0x1f')](_0x8e3b('0xe'),auth[_0x8e3b('0x9')](),controller['addDisposition']);router[_0x8e3b('0x1f')](_0x8e3b('0x20'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x21')]);router[_0x8e3b('0x1f')]('/',auth['isAuthenticated'](),controller[_0x8e3b('0x22')]);router[_0x8e3b('0x1f')]('/:id/in_servers',auth[_0x8e3b('0x9')](),controller['addImap']);router['post'](_0x8e3b('0x13'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x23')]);router[_0x8e3b('0x1f')](_0x8e3b('0x15'),auth[_0x8e3b('0x9')](),controller['addInteraction']);router['post'](_0x8e3b('0x17'),auth[_0x8e3b('0x9')](),controller['addApplications']);router[_0x8e3b('0x1f')](_0x8e3b('0x24'),auth['isAuthenticated'](),controller[_0x8e3b('0x25')]);router[_0x8e3b('0x1f')](_0x8e3b('0x1d'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x26')]);router[_0x8e3b('0x27')](_0x8e3b('0xc'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x28')]);router['delete'](_0x8e3b('0xe'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x29')]);router['delete'](_0x8e3b('0x20'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x8e3b('0x11'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x2a')]);router[_0x8e3b('0x2b')](_0x8e3b('0x13'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x2c')]);router[_0x8e3b('0x2b')](_0x8e3b('0xc'),auth['isAuthenticated'](),controller[_0x8e3b('0x2d')]);router[_0x8e3b('0x2b')](_0x8e3b('0x1d'),auth[_0x8e3b('0x9')](),controller[_0x8e3b('0x2e')]);module[_0x8e3b('0x2f')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 5f98532..705fb3c 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 _0x5270=['BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','custom','provider','sequelize','exports','STRING','TEXT'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x5270,0x12c));var _0x0527=function(_0x255390,_0xae9c62){_0x255390=_0x255390-0x0;var _0x5173eb=_0x5270[_0x255390];return _0x5173eb;};'use strict';var Sequelize=require(_0x0527('0x0'));module[_0x0527('0x1')]={'description':{'type':Sequelize[_0x0527('0x2')]},'name':{'type':Sequelize[_0x0527('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x0527('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x0527('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x0527('0x3')]},'markAsUnread':{'type':Sequelize[_0x0527('0x4')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x0527('0x2')],'allowNull':![],'defaultValue':_0x0527('0x5')},'fontSize':{'type':Sequelize[_0x0527('0x6')](0x2)[_0x0527('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x0527('0x3')],'defaultValue':function(){return _0x0527('0x8');}},'notificationSound':{'type':Sequelize[_0x0527('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0527('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0527('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0527('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0527('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0527('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0527('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0527('0x4')],'defaultValue':![],'comment':_0x0527('0x9'),'set':function(_0x315c74){if(!_0x315c74)this[_0x0527('0xa')](_0x0527('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x315c74);}},'provider':{'type':Sequelize[_0x0527('0xc')](_0x0527('0xd'),'hotmail','yahoo','outlook365'),'defaultValue':null,'get':function(){var _0x57b46a=this['getDataValue']('provider');return _0x57b46a||'custom';},'set':function(_0x281465){if(_0x281465===_0x0527('0xe')){_0x281465=null;}return this[_0x0527('0xa')](_0x0527('0xf'),_0x281465);}}}; \ No newline at end of file +var _0x79cd=['mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','hotmail','outlook365','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79cd,0x1ca));var _0xd79c=function(_0x4f4a2e,_0x2d1c33){_0x4f4a2e=_0x4f4a2e-0x0;var _0x135abc=_0x79cd[_0x4f4a2e];return _0x135abc;};'use strict';var Sequelize=require(_0xd79c('0x0'));module[_0xd79c('0x1')]={'description':{'type':Sequelize[_0xd79c('0x2')]},'name':{'type':Sequelize[_0xd79c('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xd79c('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xd79c('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xd79c('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xd79c('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xd79c('0x4')]},'markAsUnread':{'type':Sequelize[_0xd79c('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd79c('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xd79c('0x5')](0x2)[_0xd79c('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd79c('0x4')],'defaultValue':function(){return _0xd79c('0x7');}},'notificationSound':{'type':Sequelize[_0xd79c('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd79c('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd79c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd79c('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd79c('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd79c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd79c('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xd79c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xd79c('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1ea4cb){if(!_0x1ea4cb)this[_0xd79c('0x9')](_0xd79c('0xa'),null);this[_0xd79c('0x9')](_0xd79c('0xb'),_0x1ea4cb);}},'provider':{'type':Sequelize[_0xd79c('0xc')](_0xd79c('0xd'),_0xd79c('0xe'),'yahoo',_0xd79c('0xf')),'defaultValue':null,'get':function(){var _0x3cb17f=this['getDataValue'](_0xd79c('0x10'));return _0x3cb17f||_0xd79c('0x11');},'set':function(_0x44e9c2){if(_0x44e9c2===_0xd79c('0x11')){_0x44e9c2=null;}return this[_0xd79c('0x9')]('provider',_0x44e9c2);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index ec51be1..4731821 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 _0x9049=['pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Smtp','index','Imap','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','name','filters','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','MailServerOut','keys','body','custom','provider','find','MailServerIn','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','create','pick','removeAnswers','email','ListId','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','List','Contacts','updatedAt','DESC','CloudProvider','isNil','from','%s\x20<%s>','attachments','join','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','User','moment','bluebird','util','path','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','error','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','get','MailAccounts','UserProfileResource','send','yahoo','hotmail','outlook365','gmail','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password'];(function(_0x123627,_0x1b4bdf){var _0x1f65e8=function(_0x30f5c6){while(--_0x30f5c6){_0x123627['push'](_0x123627['shift']());}};_0x1f65e8(++_0x1b4bdf);}(_0x9049,0x14d));var _0x9904=function(_0x44d0ff,_0x33a442){_0x44d0ff=_0x44d0ff-0x0;var _0x133e9b=_0x9049[_0x44d0ff];return _0x133e9b;};'use strict';var moment=require(_0x9904('0x0'));var BPromise=require(_0x9904('0x1'));var util=require(_0x9904('0x2'));var path=require(_0x9904('0x3'));var _=require(_0x9904('0x4'));var juice=require('juice');var Redis=require(_0x9904('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x9904('0x6'))(_0x9904('0x7'));var config=require(_0x9904('0x8'));var db=require(_0x9904('0x9'))['db'];config[_0x9904('0xa')]=_[_0x9904('0xb')](config[_0x9904('0xa')],{'host':_0x9904('0xc'),'port':0x18eb});var socket=require(_0x9904('0xd'))(new Redis(config[_0x9904('0xa')]));require(_0x9904('0xe'))[_0x9904('0xf')](socket);var jayson=require(_0x9904('0x10'));var client=jayson[_0x9904('0x11')]['http']({'port':0x232b});function respondWithRpcPromise(_0x414661,_0x4fca13,_0x29be83,_0x3b8134){return new BPromise(function(_0x264c7a,_0x404ed0){var _0x4b330c=_0x3b8134||client;return _0x4b330c[_0x9904('0x12')](_0x414661,_0x29be83)[_0x9904('0x13')](function(_0x132511){logger[_0x9904('0x14')](_0x9904('0x15'),_0x4fca13,_0x9904('0x16'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x4fca13,'request\x20sent',JSON['stringify'](_0x132511));if(_0x132511['error']){if(_0x132511[_0x9904('0x17')]['code']===0x1f4){logger[_0x9904('0x17')](_0x9904('0x15'),_0x4fca13,_0x132511[_0x9904('0x17')][_0x9904('0x18')]);return _0x404ed0(_0x132511[_0x9904('0x17')][_0x9904('0x18')]);}logger['error'](_0x9904('0x15'),_0x4fca13,_0x132511[_0x9904('0x17')][_0x9904('0x18')]);return _0x264c7a(_0x132511[_0x9904('0x17')][_0x9904('0x18')]);}else{logger[_0x9904('0x14')](_0x9904('0x15'),_0x4fca13,_0x9904('0x16'));_0x264c7a(_0x132511['result'][_0x9904('0x18')]);}})[_0x9904('0x19')](function(_0x170e39){logger[_0x9904('0x17')](_0x9904('0x15'),_0x4fca13,_0x170e39);_0x404ed0(_0x170e39);});});}function respondWithStatusCode(_0x16ebb2,_0x20242b){_0x20242b=_0x20242b||0xcc;return function(_0x388efb){if(_0x388efb){return _0x16ebb2[_0x9904('0x1a')](_0x20242b);}return _0x16ebb2[_0x9904('0x1b')](_0x20242b)[_0x9904('0x1c')]();};}function respondWithResult(_0x3577be,_0x533965){_0x533965=_0x533965||0xc8;return function(_0x5e0aa1){if(_0x5e0aa1){return _0x3577be[_0x9904('0x1b')](_0x533965)['json'](_0x5e0aa1);}};}function respondWithFilteredResult(_0x3f78db,_0x1fb2af){return function(_0x1ee61c){if(_0x1ee61c){var _0x4ceba0=typeof _0x1fb2af[_0x9904('0x1d')]===_0x9904('0x1e')&&typeof _0x1fb2af[_0x9904('0x1f')]===_0x9904('0x1e');var _0x2b5797=_0x1ee61c[_0x9904('0x20')];var _0x5b1a23=_0x4ceba0?0x0:_0x1fb2af[_0x9904('0x1d')];var _0x41c239=_0x4ceba0?_0x1ee61c['count']:_0x1fb2af[_0x9904('0x1d')]+_0x1fb2af['limit'];var _0x3d8c34;if(_0x41c239>=_0x2b5797){_0x41c239=_0x2b5797;_0x3d8c34=0xc8;}else{_0x3d8c34=0xce;}_0x3f78db[_0x9904('0x1b')](_0x3d8c34);return _0x3f78db[_0x9904('0x21')](_0x9904('0x22'),_0x5b1a23+'-'+_0x41c239+'/'+_0x2b5797)[_0x9904('0x23')](_0x1ee61c);}return null;};}function saveUpdates(_0x4a6fa5){return function(_0x13286f){if(_0x13286f){return _0x13286f[_0x9904('0x24')](_0x4a6fa5)[_0x9904('0x13')](function(_0x5ca48e){return _0x5ca48e;});}return null;};}function removeEntity(_0x4fb520){return function(_0x37e723){if(_0x37e723){return _0x37e723[_0x9904('0x25')]()[_0x9904('0x13')](function(){var _0x51491c=_0x37e723[_0x9904('0x26')]({'plain':!![]});var _0x1fca9c=_0x9904('0x27');return db[_0x9904('0x28')][_0x9904('0x25')]({'where':{'type':_0x1fca9c,'resourceId':_0x51491c['id']}})[_0x9904('0x13')](function(){return _0x37e723;});})[_0x9904('0x13')](function(){_0x4fb520[_0x9904('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32afbc){return function(_0xda2aa4){if(!_0xda2aa4){_0x32afbc['sendStatus'](0x194);}return _0xda2aa4;};}function handleError(_0x193ccb,_0x484143){_0x484143=_0x484143||0x1f4;return function(_0x16e558){logger[_0x9904('0x17')](_0x16e558['stack']);if(_0x16e558['name']){delete _0x16e558['name'];}_0x193ccb[_0x9904('0x1b')](_0x484143)[_0x9904('0x29')](_0x16e558);};}function getImapHost(_0x3834c6){switch(_0x3834c6){case'gmail':return'imap.gmail.com';case _0x9904('0x2a'):return'imap.mail.yahoo.com';case _0x9904('0x2b'):return'imap-mail.outlook.com';case _0x9904('0x2c'):return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x3834c6);}function getSmtpHost(_0x25a9c2){switch(_0x25a9c2){case _0x9904('0x2d'):return'smtp.gmail.com';case'yahoo':return _0x9904('0x2e');case'hotmail':return _0x9904('0x2f');case _0x9904('0x2c'):return _0x9904('0x30');}throw new Error(_0x9904('0x31'),_0x25a9c2);}function getAuthenticationOptions(_0x12eac6,_0x176a0f){var _0x4d5856={};var _0x224e04={};if(_0x12eac6){_0x4d5856['user']=_0x224e04[_0x9904('0x32')]=_0x176a0f[_0x9904('0x33')];_0x4d5856[_0x9904('0x34')]=_0x224e04[_0x9904('0x35')]=_0x176a0f[_0x9904('0x34')];if(_0x176a0f[_0x9904('0x36')]){_0x4d5856[_0x9904('0x36')]=_0x224e04[_0x9904('0x36')]=!![];_0x4d5856[_0x9904('0x37')]=_0x224e04[_0x9904('0x37')]=_0x176a0f[_0x9904('0x37')];_0x4d5856[_0x9904('0x34')]=_0x224e04[_0x9904('0x35')]=null;}else{_0x4d5856[_0x9904('0x37')]=_0x224e04[_0x9904('0x37')]=null;}_0x4d5856[_0x9904('0x38')]=getImapHost(_0x12eac6);_0x4d5856['port']=0x3e1;_0x224e04[_0x9904('0x38')]=getSmtpHost(_0x12eac6);_0x224e04[_0x9904('0x39')]=0x24b;_0x224e04[_0x9904('0x3a')]=![];_0x4d5856[_0x9904('0x3b')]=_0x224e04[_0x9904('0x3b')]=null;}else{if(_0x176a0f[_0x9904('0x3c')]){_0x4d5856[_0x9904('0x32')]=_0x224e04[_0x9904('0x32')]=_0x176a0f[_0x9904('0x33')];_0x4d5856[_0x9904('0x34')]=_0x224e04[_0x9904('0x35')]=_0x176a0f[_0x9904('0x34')];}else{_0x4d5856[_0x9904('0x3c')]=_0x224e04[_0x9904('0x3c')]=![];_0x4d5856[_0x9904('0x32')]=_0x224e04[_0x9904('0x32')]=null;_0x4d5856['password']=_0x224e04[_0x9904('0x35')]=null;}_0x4d5856[_0x9904('0x38')]=_0x176a0f['Imap'][_0x9904('0x38')];_0x4d5856[_0x9904('0x39')]=_0x176a0f['Imap'][_0x9904('0x39')];_0x224e04[_0x9904('0x38')]=_0x176a0f['Smtp'][_0x9904('0x38')];_0x224e04[_0x9904('0x39')]=_0x176a0f[_0x9904('0x3d')]['port'];}return{'Imap':_0x4d5856,'Smtp':_0x224e04};}exports[_0x9904('0x3e')]=function(_0x1f75e2,_0x4e058c){var _0x266f07={'include':[{'model':db['MailServerIn'],'as':_0x9904('0x3f')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x9904('0x40')],'as':_0x9904('0x41')}]},_0x4f2a9b={},_0x5b2f02={'count':0x0,'rows':[]};var _0x19a13a=_[_0x9904('0x42')](db[_0x9904('0x43')][_0x9904('0x44')],function(_0x54081c){return{'name':_0x54081c['fieldName'],'type':_0x54081c[_0x9904('0x45')]['key']};});_0x4f2a9b['model']=_[_0x9904('0x42')](_0x19a13a,_0x9904('0x46'));_0x4f2a9b['query']=_['keys'](_0x1f75e2['query']);_0x4f2a9b[_0x9904('0x47')]=_['intersection'](_0x4f2a9b[_0x9904('0x48')],_0x4f2a9b[_0x9904('0x49')]);_0x266f07[_0x9904('0x4a')]=_[_0x9904('0x4b')](_0x4f2a9b[_0x9904('0x48')],qs[_0x9904('0x4c')](_0x1f75e2[_0x9904('0x49')]['fields']));_0x266f07[_0x9904('0x4a')]=_0x266f07[_0x9904('0x4a')][_0x9904('0x4d')]?_0x266f07[_0x9904('0x4a')]:_0x4f2a9b[_0x9904('0x48')];if(!_0x1f75e2[_0x9904('0x49')]['hasOwnProperty'](_0x9904('0x4e'))){_0x266f07['limit']=qs[_0x9904('0x1f')](_0x1f75e2[_0x9904('0x49')][_0x9904('0x1f')]);_0x266f07[_0x9904('0x1d')]=qs[_0x9904('0x1d')](_0x1f75e2['query'][_0x9904('0x1d')]);}_0x266f07[_0x9904('0x4f')]=qs[_0x9904('0x50')](_0x1f75e2['query'][_0x9904('0x50')]);_0x266f07[_0x9904('0x51')]=qs['filters'](_['pick'](_0x1f75e2[_0x9904('0x49')],_0x4f2a9b['filters']),_0x19a13a);if(_0x1f75e2['query'][_0x9904('0x52')]){_0x266f07[_0x9904('0x51')]=_[_0x9904('0x53')](_0x266f07[_0x9904('0x51')],{'$or':_['map'](_0x19a13a,function(_0xe10671){if(_0xe10671[_0x9904('0x45')]!==_0x9904('0x54')){var _0x5ba8ce={};_0x5ba8ce[_0xe10671[_0x9904('0x46')]]={'$like':'%'+_0x1f75e2[_0x9904('0x49')][_0x9904('0x52')]+'%'};return _0x5ba8ce;}})});}_0x266f07=_[_0x9904('0x53')]({},_0x266f07,_0x1f75e2[_0x9904('0x55')]);var _0x5e9540={'where':_0x266f07[_0x9904('0x51')]};return db[_0x9904('0x43')][_0x9904('0x20')](_0x5e9540)[_0x9904('0x13')](function(_0x399a48){_0x5b2f02[_0x9904('0x20')]=_0x399a48;if(_0x1f75e2[_0x9904('0x49')][_0x9904('0x56')]){_0x266f07[_0x9904('0x57')]=[{'all':!![]}];}return db[_0x9904('0x43')][_0x9904('0x58')](_0x266f07);})[_0x9904('0x13')](function(_0x5dde77){_0x5b2f02[_0x9904('0x59')]=_0x5dde77;return _0x5b2f02;})[_0x9904('0x13')](respondWithFilteredResult(_0x4e058c,_0x266f07))['catch'](handleError(_0x4e058c,null));};exports[_0x9904('0x5a')]=function(_0x1fbe97,_0x34bef7){var _0x5de2c2={'raw':![],'where':{'id':_0x1fbe97[_0x9904('0x5b')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x9904('0x3f')},{'model':db[_0x9904('0x5c')],'as':_0x9904('0x3d')},{'model':db[_0x9904('0x40')],'as':_0x9904('0x41')}]},_0x57065f={};_0x57065f[_0x9904('0x48')]=_[_0x9904('0x5d')](db[_0x9904('0x43')]['rawAttributes']);_0x57065f[_0x9904('0x49')]=_[_0x9904('0x5d')](_0x1fbe97[_0x9904('0x49')]);_0x57065f[_0x9904('0x47')]=_['intersection'](_0x57065f[_0x9904('0x48')],_0x57065f[_0x9904('0x49')]);_0x5de2c2[_0x9904('0x4a')]=_['intersection'](_0x57065f[_0x9904('0x48')],qs[_0x9904('0x4c')](_0x1fbe97['query'][_0x9904('0x4c')]));_0x5de2c2[_0x9904('0x4a')]=_0x5de2c2[_0x9904('0x4a')][_0x9904('0x4d')]?_0x5de2c2[_0x9904('0x4a')]:_0x57065f[_0x9904('0x48')];if(_0x1fbe97['query'][_0x9904('0x56')]){_0x5de2c2[_0x9904('0x57')]=[{'all':!![]}];}_0x5de2c2=_[_0x9904('0x53')]({},_0x5de2c2,_0x1fbe97['options']);return db[_0x9904('0x43')]['find'](_0x5de2c2)[_0x9904('0x13')](handleEntityNotFound(_0x34bef7,null))[_0x9904('0x13')](respondWithResult(_0x34bef7,null))['catch'](handleError(_0x34bef7,null));};exports[_0x9904('0x24')]=function(_0xc4cdae,_0x172abe){if(_0xc4cdae[_0x9904('0x5e')]['id']){delete _0xc4cdae['body']['id'];}var _0x2412c6=_0xc4cdae[_0x9904('0x5e')]['provider']===_0x9904('0x5f')?null:_0xc4cdae['body'][_0x9904('0x60')];var _0x55652d=_0xc4cdae[_0x9904('0x5e')][_0x9904('0x3f')]||{};var _0x3c6580=_0xc4cdae[_0x9904('0x5e')]['Smtp']||{};if(_0x2412c6){_0x55652d[_0x9904('0x38')]=getImapHost(_0x2412c6);_0x55652d['port']=0x3e1;_0x3c6580[_0x9904('0x38')]=getSmtpHost(_0x2412c6);_0x3c6580['port']=0x24b;_0x3c6580[_0x9904('0x3a')]=![];}if(_0x3c6580['modernAuthentication']){_0x3c6580[_0x9904('0x3a')]=![];}else{_0x3c6580[_0x9904('0x37')]=null;}if(!_0x55652d[_0x9904('0x36')])_0x55652d['CloudProviderId']=null;_0xc4cdae[_0x9904('0x5e')][_0x9904('0x3f')]=_0x55652d;_0xc4cdae[_0x9904('0x5e')]['Smtp']=_0x3c6580;return db['MailAccount'][_0x9904('0x61')]({'where':{'id':_0xc4cdae[_0x9904('0x5b')]['id']},'include':[{'model':db[_0x9904('0x62')],'as':_0x9904('0x3f')},{'model':db[_0x9904('0x5c')],'as':_0x9904('0x3d')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x172abe,null))[_0x9904('0x13')](function(_0x53679b){if(!_0x53679b)throw new Error(_0x9904('0x63'));if(_0x53679b['service'])delete _0xc4cdae[_0x9904('0x5e')][_0x9904('0x3f')];return _0x53679b;})[_0x9904('0x13')](saveUpdates(_0xc4cdae[_0x9904('0x5e')],null))['then'](function(_0x5b813b){if(!_0xc4cdae[_0x9904('0x5e')]['Imap'])return _0x5b813b;return db[_0x9904('0x62')][_0x9904('0x24')](_0xc4cdae[_0x9904('0x5e')][_0x9904('0x3f')],{'where':{'MailAccountId':_0x5b813b['id']}})[_0x9904('0x13')](function(){return _0x5b813b;});})[_0x9904('0x13')](function(_0x4540ac){if(!_0xc4cdae['body']['Smtp'])return _0x4540ac;return db[_0x9904('0x5c')]['update'](_0xc4cdae['body'][_0x9904('0x3d')],{'where':{'MailAccountId':_0x4540ac['id']}})['then'](function(){return _0x4540ac;});})[_0x9904('0x13')](respondWithResult(_0x172abe,null))['catch'](handleError(_0x172abe,null));};exports[_0x9904('0x64')]=function(_0x54ee6f,_0x2d6bc5){return db[_0x9904('0x43')][_0x9904('0x64')]()[_0x9904('0x13')](respondWithResult(_0x2d6bc5,null))[_0x9904('0x19')](handleError(_0x2d6bc5,null));};exports[_0x9904('0x65')]=function(_0x3102ba,_0x73893b){if(_0x3102ba[_0x9904('0x5e')]['id']){delete _0x3102ba[_0x9904('0x5e')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x3102ba[_0x9904('0x5b')]['id']}})[_0x9904('0x13')](handleEntityNotFound(_0x73893b,null))[_0x9904('0x13')](function(_0x5d1405){if(_0x5d1405){_0x3102ba[_0x9904('0x5e')]['MailAccountId']=_0x5d1405['id'];return db[_0x9904('0x66')]['create'](_0x3102ba[_0x9904('0x5e')]);}})[_0x9904('0x13')](respondWithResult(_0x73893b,null))[_0x9904('0x19')](handleError(_0x73893b,null));};exports[_0x9904('0x67')]=function(_0x42bf61,_0x2fb108){var _0x559a2c={'raw':![],'where':{}};var _0x25fa3e={};var _0x5f0b0b={'count':0x0,'rows':[]};return db[_0x9904('0x43')][_0x9904('0x68')]({'where':{'id':_0x42bf61[_0x9904('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2fb108,null))[_0x9904('0x13')](function(_0x807c0a){if(_0x807c0a){_0x25fa3e[_0x9904('0x48')]=_[_0x9904('0x5d')](db[_0x9904('0x66')][_0x9904('0x44')]);_0x25fa3e[_0x9904('0x49')]=_[_0x9904('0x5d')](_0x42bf61[_0x9904('0x49')]);_0x25fa3e[_0x9904('0x47')]=_[_0x9904('0x4b')](_0x25fa3e[_0x9904('0x48')],_0x25fa3e[_0x9904('0x49')]);_0x559a2c[_0x9904('0x4a')]=_[_0x9904('0x4b')](_0x25fa3e[_0x9904('0x48')],qs[_0x9904('0x4c')](_0x42bf61[_0x9904('0x49')][_0x9904('0x4c')]));_0x559a2c[_0x9904('0x4a')]=_0x559a2c[_0x9904('0x4a')][_0x9904('0x4d')]?_0x559a2c['attributes']:_0x25fa3e[_0x9904('0x48')];if(!_0x42bf61[_0x9904('0x49')][_0x9904('0x69')](_0x9904('0x4e'))){_0x559a2c[_0x9904('0x1f')]=qs[_0x9904('0x1f')](_0x42bf61[_0x9904('0x49')][_0x9904('0x1f')]);_0x559a2c[_0x9904('0x1d')]=qs[_0x9904('0x1d')](_0x42bf61[_0x9904('0x49')][_0x9904('0x1d')]);}_0x559a2c[_0x9904('0x4f')]=qs[_0x9904('0x50')](_0x42bf61[_0x9904('0x49')][_0x9904('0x50')]);_0x559a2c[_0x9904('0x51')]=qs[_0x9904('0x47')](_['pick'](_0x42bf61['query'],_0x25fa3e[_0x9904('0x47')]));_0x559a2c[_0x9904('0x51')][_0x9904('0x6a')]=_0x807c0a['id'];if(_0x42bf61['query'][_0x9904('0x52')]){_0x559a2c['where']=_['merge'](_0x559a2c[_0x9904('0x51')],{'$or':_[_0x9904('0x42')](_0x559a2c['attributes'],function(_0x1737ee){var _0x3feebb={};_0x3feebb[_0x1737ee]={'$like':'%'+_0x42bf61['query']['filter']+'%'};return _0x3feebb;})});}_0x559a2c=_[_0x9904('0x53')]({},_0x559a2c,_0x42bf61['options']);return db[_0x9904('0x66')][_0x9904('0x20')]({'where':_0x559a2c['where']})[_0x9904('0x13')](function(_0x1e1535){_0x5f0b0b['count']=_0x1e1535;if(_0x42bf61[_0x9904('0x49')][_0x9904('0x56')]){_0x559a2c[_0x9904('0x57')]=[{'all':!![]}];}return db[_0x9904('0x66')]['findAll'](_0x559a2c);})[_0x9904('0x13')](function(_0xed5438){_0x5f0b0b[_0x9904('0x59')]=_0xed5438;return _0x5f0b0b;});}})[_0x9904('0x13')](respondWithFilteredResult(_0x2fb108,_0x559a2c))[_0x9904('0x19')](handleError(_0x2fb108,null));};exports[_0x9904('0x6b')]=function(_0x3ecf8b,_0x3094bf){return db[_0x9904('0x43')][_0x9904('0x61')]({'where':{'id':_0x3ecf8b[_0x9904('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3094bf,null))[_0x9904('0x13')](function(_0x2dd437){if(_0x2dd437){return _0x2dd437[_0x9904('0x6b')](_0x3ecf8b[_0x9904('0x49')][_0x9904('0x6c')]);}})['then'](respondWithStatusCode(_0x3094bf,null))[_0x9904('0x19')](handleError(_0x3094bf,null));};exports[_0x9904('0x6d')]=function(_0x1ecaf7,_0x2a9f95){if(_0x1ecaf7[_0x9904('0x5e')]['id']){delete _0x1ecaf7[_0x9904('0x5e')]['id'];}return db['MailAccount'][_0x9904('0x61')]({'where':{'id':_0x1ecaf7[_0x9904('0x5b')]['id']}})[_0x9904('0x13')](handleEntityNotFound(_0x2a9f95,null))[_0x9904('0x13')](function(_0x181d7e){if(_0x181d7e){_0x1ecaf7[_0x9904('0x5e')][_0x9904('0x6a')]=_0x181d7e['id'];return db[_0x9904('0x6e')][_0x9904('0x6f')](_0x1ecaf7['body']);}})[_0x9904('0x13')](respondWithResult(_0x2a9f95,null))[_0x9904('0x19')](handleError(_0x2a9f95,null));};exports['getAnswers']=function(_0x2cba1d,_0x17384a){var _0x4d8de2={'raw':![],'where':{}};var _0x47a599={};var _0x3472ce={'count':0x0,'rows':[]};return db[_0x9904('0x43')]['findOne']({'where':{'id':_0x2cba1d[_0x9904('0x5b')]['id']}})[_0x9904('0x13')](handleEntityNotFound(_0x17384a,null))['then'](function(_0x4de279){if(_0x4de279){_0x47a599[_0x9904('0x48')]=_[_0x9904('0x5d')](db['CannedAnswer']['rawAttributes']);_0x47a599[_0x9904('0x49')]=_['keys'](_0x2cba1d[_0x9904('0x49')]);_0x47a599[_0x9904('0x47')]=_[_0x9904('0x4b')](_0x47a599[_0x9904('0x48')],_0x47a599['query']);_0x4d8de2[_0x9904('0x4a')]=_['intersection'](_0x47a599[_0x9904('0x48')],qs[_0x9904('0x4c')](_0x2cba1d[_0x9904('0x49')][_0x9904('0x4c')]));_0x4d8de2[_0x9904('0x4a')]=_0x4d8de2[_0x9904('0x4a')]['length']?_0x4d8de2[_0x9904('0x4a')]:_0x47a599[_0x9904('0x48')];if(!_0x2cba1d[_0x9904('0x49')][_0x9904('0x69')](_0x9904('0x4e'))){_0x4d8de2['limit']=qs[_0x9904('0x1f')](_0x2cba1d[_0x9904('0x49')][_0x9904('0x1f')]);_0x4d8de2[_0x9904('0x1d')]=qs[_0x9904('0x1d')](_0x2cba1d[_0x9904('0x49')]['offset']);}_0x4d8de2[_0x9904('0x4f')]=qs[_0x9904('0x50')](_0x2cba1d[_0x9904('0x49')]['sort']);_0x4d8de2[_0x9904('0x51')]=qs[_0x9904('0x47')](_[_0x9904('0x70')](_0x2cba1d[_0x9904('0x49')],_0x47a599[_0x9904('0x47')]));_0x4d8de2['where'][_0x9904('0x6a')]=_0x4de279['id'];if(_0x2cba1d[_0x9904('0x49')][_0x9904('0x52')]){_0x4d8de2[_0x9904('0x51')]=_[_0x9904('0x53')](_0x4d8de2[_0x9904('0x51')],{'$or':_[_0x9904('0x42')](_0x4d8de2[_0x9904('0x4a')],function(_0x55431b){var _0x5b8515={};_0x5b8515[_0x55431b]={'$like':'%'+_0x2cba1d[_0x9904('0x49')][_0x9904('0x52')]+'%'};return _0x5b8515;})});}_0x4d8de2=_[_0x9904('0x53')]({},_0x4d8de2,_0x2cba1d['options']);return db['CannedAnswer'][_0x9904('0x20')]({'where':_0x4d8de2[_0x9904('0x51')]})[_0x9904('0x13')](function(_0x552199){_0x3472ce['count']=_0x552199;if(_0x2cba1d['query'][_0x9904('0x56')]){_0x4d8de2[_0x9904('0x57')]=[{'all':!![]}];}return db[_0x9904('0x6e')][_0x9904('0x58')](_0x4d8de2);})[_0x9904('0x13')](function(_0xd8ebc8){_0x3472ce[_0x9904('0x59')]=_0xd8ebc8;return _0x3472ce;});}})['then'](respondWithFilteredResult(_0x17384a,_0x4d8de2))[_0x9904('0x19')](handleError(_0x17384a,null));};exports[_0x9904('0x71')]=function(_0x3454ef,_0x5c1b13){return db[_0x9904('0x43')]['find']({'where':{'id':_0x3454ef[_0x9904('0x5b')]['id']}})[_0x9904('0x13')](handleEntityNotFound(_0x5c1b13,null))[_0x9904('0x13')](function(_0x36d9d7){if(_0x36d9d7){return _0x36d9d7[_0x9904('0x71')](_0x3454ef[_0x9904('0x49')][_0x9904('0x6c')]);}})[_0x9904('0x13')](respondWithStatusCode(_0x5c1b13,null))[_0x9904('0x19')](handleError(_0x5c1b13,null));};exports['create']=function(_0x2f7dba,_0x5169a6){var _0x1075c7={'name':_0x2f7dba[_0x9904('0x5e')][_0x9904('0x46')],'key':_0x2f7dba[_0x9904('0x5e')]['key'],'provider':_0x2f7dba[_0x9904('0x5e')]['provider']===_0x9904('0x5f')?null:_0x2f7dba[_0x9904('0x5e')][_0x9904('0x60')],'email':_0x2f7dba[_0x9904('0x5e')][_0x9904('0x72')],'ListId':_0x2f7dba[_0x9904('0x5e')][_0x9904('0x73')],'active':!_['isNil'](_0x2f7dba[_0x9904('0x5e')]['active'])?_0x2f7dba[_0x9904('0x5e')][_0x9904('0x74')]:!![],'description':_0x2f7dba[_0x9904('0x5e')][_0x9904('0x75')]||null};var _0x17aa97=getAuthenticationOptions(_0x1075c7['provider'],_0x2f7dba[_0x9904('0x5e')]);_0x1075c7[_0x9904('0x3f')]=_0x17aa97['Imap'];_0x1075c7[_0x9904('0x3d')]=_0x17aa97['Smtp'];return db[_0x9904('0x43')][_0x9904('0x6f')](_0x1075c7,{'include':[{'model':db[_0x9904('0x5c')],'as':_0x9904('0x3d')},{'model':db[_0x9904('0x62')],'as':_0x9904('0x3f')}]})[_0x9904('0x13')](function(_0x15e99c){var _0x50d98f=_0x2f7dba['user'][_0x9904('0x26')]({'plain':!![]});if(!_0x50d98f)throw new Error(_0x9904('0x76'));if(_0x50d98f[_0x9904('0x77')]===_0x9904('0x32')){var _0x5d1d9d=_0x15e99c[_0x9904('0x26')]({'plain':!![]});return db[_0x9904('0x78')][_0x9904('0x61')]({'where':{'name':_0x9904('0x27'),'userProfileId':_0x50d98f[_0x9904('0x79')]},'raw':!![]})[_0x9904('0x13')](function(_0x3b4331){if(_0x3b4331&&_0x3b4331[_0x9904('0x7a')]===0x0){return db[_0x9904('0x28')][_0x9904('0x6f')]({'name':_0x5d1d9d[_0x9904('0x46')],'resourceId':_0x5d1d9d['id'],'type':_0x3b4331['name'],'sectionId':_0x3b4331['id']},{})[_0x9904('0x13')](function(){return _0x15e99c;});}else{return _0x15e99c;}})[_0x9904('0x19')](function(_0x1ca53e){logger[_0x9904('0x17')](_0x9904('0x7b'),_0x1ca53e);throw _0x1ca53e;});}return _0x15e99c;})[_0x9904('0x13')](respondWithResult(_0x5169a6,0xc9))[_0x9904('0x19')](handleError(_0x5169a6,null));};exports[_0x9904('0x7c')]=function(_0xfe8b64,_0x4cf9ee){return db[_0x9904('0x43')][_0x9904('0x68')]({'where':{'id':_0xfe8b64[_0x9904('0x5b')]['id']}})[_0x9904('0x13')](handleEntityNotFound(_0x4cf9ee,null))[_0x9904('0x13')](function(_0x3f8d94){if(_0x3f8d94){return _0x3f8d94['getImap']();}return null;})[_0x9904('0x13')](respondWithResult(_0x4cf9ee,null))[_0x9904('0x19')](handleError(_0x4cf9ee,null));};exports['addImap']=function(_0x16d92b,_0x4548e6){if(_0x16d92b[_0x9904('0x5e')]['id']){delete _0x16d92b['body']['id'];}return db[_0x9904('0x43')][_0x9904('0x61')]({'where':{'id':_0x16d92b['params']['id']}})['then'](handleEntityNotFound(_0x4548e6,null))[_0x9904('0x13')](function(_0x2ed907){if(_0x2ed907){_0x16d92b['body'][_0x9904('0x6a')]=_0x2ed907['id'];return db['MailServerIn'][_0x9904('0x6f')](_0x16d92b[_0x9904('0x5e')]);}})[_0x9904('0x13')](respondWithResult(_0x4548e6,null))[_0x9904('0x19')](handleError(_0x4548e6,null));};exports['removeImap']=function(_0x1694c3,_0x3f2e9a){return db[_0x9904('0x43')][_0x9904('0x68')]({'where':{'id':_0x1694c3[_0x9904('0x5b')]['id']}})[_0x9904('0x13')](handleEntityNotFound(_0x3f2e9a,null))[_0x9904('0x13')](function(_0x214754){if(_0x214754){return _0x214754[_0x9904('0x7d')](null);}return null;})['then'](respondWithStatusCode(_0x3f2e9a,null))[_0x9904('0x19')](handleError(_0x3f2e9a,null));};exports[_0x9904('0x7e')]=function(_0x11c324,_0x19cf92){return db[_0x9904('0x43')][_0x9904('0x68')]({'where':{'id':_0x11c324[_0x9904('0x5b')]['id']}})['then'](handleEntityNotFound(_0x19cf92,null))[_0x9904('0x13')](function(_0x24c03c){if(_0x24c03c){return _0x24c03c[_0x9904('0x7e')]();}return null;})[_0x9904('0x13')](respondWithResult(_0x19cf92,null))[_0x9904('0x19')](handleError(_0x19cf92,null));};exports[_0x9904('0x7f')]=function(_0x5b31cb,_0xb57573){if(_0x5b31cb[_0x9904('0x5e')]['id']){delete _0x5b31cb[_0x9904('0x5e')]['id'];}return db[_0x9904('0x43')][_0x9904('0x61')]({'where':{'id':_0x5b31cb['params']['id']}})[_0x9904('0x13')](handleEntityNotFound(_0xb57573,null))[_0x9904('0x13')](function(_0x1c5641){if(_0x1c5641){_0x5b31cb[_0x9904('0x5e')][_0x9904('0x6a')]=_0x1c5641['id'];return db[_0x9904('0x5c')][_0x9904('0x6f')](_0x5b31cb[_0x9904('0x5e')]);}})['then'](respondWithResult(_0xb57573,null))['catch'](handleError(_0xb57573,null));};exports[_0x9904('0x80')]=function(_0x3a933e,_0xa61100){return db[_0x9904('0x43')]['findOne']({'where':{'id':_0x3a933e[_0x9904('0x5b')]['id']}})[_0x9904('0x13')](handleEntityNotFound(_0xa61100,null))[_0x9904('0x13')](function(_0x21fa4c){if(_0x21fa4c){return _0x21fa4c[_0x9904('0x81')](null);}return null;})['then'](respondWithStatusCode(_0xa61100,null))[_0x9904('0x19')](handleError(_0xa61100,null));};exports[_0x9904('0x82')]=function(_0x4ee121,_0x2bbec7){return db[_0x9904('0x83')][_0x9904('0x61')]({'where':{'id':_0x4ee121['params']['id']}})['then'](handleEntityNotFound(_0x2bbec7,null))[_0x9904('0x13')](function(_0x4f3219){if(_0x4f3219){return _0x4f3219[_0x9904('0x82')](_0x4ee121[_0x9904('0x5e')][_0x9904('0x6c')],_[_0x9904('0x84')](_0x4ee121[_0x9904('0x5e')],[_0x9904('0x6c'),'id'])||{});}})[_0x9904('0x13')](respondWithResult(_0x2bbec7,null))[_0x9904('0x19')](handleError(_0x2bbec7,null));};exports['getInteractions']=function(_0x3e4262,_0x460a69){var _0x123c77={'raw':![],'where':{}};var _0xbbae8f={};var _0x27ab93={'count':0x0,'rows':[]};return db[_0x9904('0x43')][_0x9904('0x68')]({'where':{'id':_0x3e4262[_0x9904('0x5b')]['id']}})[_0x9904('0x13')](handleEntityNotFound(_0x460a69,null))[_0x9904('0x13')](function(_0x5b0898){if(_0x5b0898){_0xbbae8f[_0x9904('0x48')]=_[_0x9904('0x5d')](db[_0x9904('0x83')]['rawAttributes']);_0xbbae8f['query']=_[_0x9904('0x5d')](_0x3e4262[_0x9904('0x49')]);_0xbbae8f[_0x9904('0x47')]=_[_0x9904('0x4b')](_0xbbae8f[_0x9904('0x48')],_0xbbae8f[_0x9904('0x49')]);_0x123c77[_0x9904('0x4a')]=_[_0x9904('0x4b')](_0xbbae8f['model'],qs[_0x9904('0x4c')](_0x3e4262[_0x9904('0x49')][_0x9904('0x4c')]));_0x123c77[_0x9904('0x4a')]=_0x123c77[_0x9904('0x4a')][_0x9904('0x4d')]?_0x123c77[_0x9904('0x4a')]:_0xbbae8f[_0x9904('0x48')];if(!_0x3e4262['query'][_0x9904('0x69')]('nolimit')){_0x123c77[_0x9904('0x1f')]=qs[_0x9904('0x1f')](_0x3e4262[_0x9904('0x49')]['limit']);_0x123c77[_0x9904('0x1d')]=qs['offset'](_0x3e4262['query'][_0x9904('0x1d')]);}_0x123c77[_0x9904('0x4f')]=qs[_0x9904('0x50')](_0x3e4262['query'][_0x9904('0x50')]);_0x123c77['where']=qs[_0x9904('0x47')](_['pick'](_0x3e4262[_0x9904('0x49')],_0xbbae8f[_0x9904('0x47')]));_0x123c77['where'][_0x9904('0x6a')]=_0x5b0898['id'];if(_0x3e4262[_0x9904('0x49')][_0x9904('0x52')]){_0x123c77[_0x9904('0x51')]=_[_0x9904('0x53')](_0x123c77[_0x9904('0x51')],{'$or':_['map'](_0x123c77[_0x9904('0x4a')],function(_0x126eb1){var _0x161494={};_0x161494[_0x126eb1]={'$like':'%'+_0x3e4262[_0x9904('0x49')]['filter']+'%'};return _0x161494;})});}_0x123c77=_['merge']({},_0x123c77,_0x3e4262['options']);return db[_0x9904('0x83')]['count']({'where':_0x123c77['where']})[_0x9904('0x13')](function(_0x1e95e4){_0x27ab93[_0x9904('0x20')]=_0x1e95e4;if(_0x3e4262[_0x9904('0x49')]['includeAll']){_0x123c77['include']=[{'model':db[_0x9904('0x85')],'as':_0x9904('0x86'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x9904('0x87'),_0x9904('0x88')],'required':![]},{'model':db['Tag'],'as':_0x9904('0x89'),'attributes':['id',_0x9904('0x46'),_0x9904('0x8a')],'where':_0x3e4262[_0x9904('0x49')][_0x9904('0x8b')]?{'id':_0x3e4262[_0x9904('0x49')]['tag']}:undefined,'required':_0x3e4262[_0x9904('0x49')][_0x9904('0x8b')]?!![]:![]}];}return db[_0x9904('0x83')][_0x9904('0x58')](_0x123c77);})[_0x9904('0x13')](function(_0x7a09fe){_0x27ab93[_0x9904('0x59')]=_0x7a09fe;return _0x27ab93;});}})[_0x9904('0x13')](respondWithFilteredResult(_0x460a69,_0x123c77))[_0x9904('0x19')](handleError(_0x460a69,null));};exports[_0x9904('0x8c')]=function addApplications(_0xea0f3b,_0x562723){var _0x4b1e20=_0xea0f3b[_0x9904('0x5b')]['id'];var _0x2495cb=_0xea0f3b['body'];var _0x3d7465=0xc8;var _0x3b3854=null;return db[_0x9904('0x8d')][_0x9904('0x8e')]({'isolationLevel':db['sequelize'][_0x9904('0x8f')][_0x9904('0x90')][_0x9904('0x91')]},function(_0x13ea09){return db[_0x9904('0x43')]['findOne']({'where':{'id':_0x4b1e20},'transaction':_0x13ea09})[_0x9904('0x13')](function(_0x3691bd){if(_0x3691bd){return db[_0x9904('0x92')][_0x9904('0x25')]({'where':{'MailAccountId':_0x4b1e20},'transaction':_0x13ea09})[_0x9904('0x13')](function(){var _0x486293=_[_0x9904('0x42')](_0x2495cb,function(_0x3a8434){_0x3a8434[_0x9904('0x6a')]=_0x4b1e20;return _0x3a8434;});return db[_0x9904('0x92')][_0x9904('0x93')](_0x486293,{'transaction':_0x13ea09});});}else{_0x3d7465=0x194;_0x3b3854=[];}});})[_0x9904('0x13')](function(){if(_0x3d7465!==0x194){return db[_0x9904('0x92')][_0x9904('0x94')]({'where':{'MailAccountId':_0x4b1e20},'order':'priority'})[_0x9904('0x13')](function(_0x4c6689){_0x3b3854=_0x4c6689;});}})[_0x9904('0x19')](function(_0x2e9168){_0x3d7465=0x1f4;logger[_0x9904('0x17')](_0x2e9168[_0x9904('0x95')]);if(_0x2e9168[_0x9904('0x46')]){delete _0x2e9168[_0x9904('0x46')];}_0x3b3854=_0x2e9168;})[_0x9904('0x96')](function(){if(_0x3b3854===null){_0x562723[_0x9904('0x1a')](_0x3d7465);}else{if(_0x3d7465===0x1f4){_0x562723[_0x9904('0x1b')](_0x3d7465)[_0x9904('0x29')](_0x3b3854);}else{_0x562723[_0x9904('0x1b')](_0x3d7465)[_0x9904('0x23')](_0x3b3854);}}});};exports[_0x9904('0x97')]=function(_0x2e2557,_0x42b415){var _0x22f451={};var _0x468ec9={};var _0x341cab;var _0x35f743;return db[_0x9904('0x43')]['findOne']({'where':{'id':_0x2e2557['params']['id']}})[_0x9904('0x13')](handleEntityNotFound(_0x42b415,null))[_0x9904('0x13')](function(_0x435be3){if(_0x435be3){_0x341cab=_0x435be3;_0x468ec9['model']=_[_0x9904('0x5d')](db[_0x9904('0x92')][_0x9904('0x44')]);_0x468ec9[_0x9904('0x49')]=_[_0x9904('0x5d')](_0x2e2557[_0x9904('0x49')]);_0x468ec9[_0x9904('0x47')]=_['intersection'](_0x468ec9[_0x9904('0x48')],_0x468ec9[_0x9904('0x49')]);_0x22f451[_0x9904('0x4a')]=_['intersection'](_0x468ec9[_0x9904('0x48')],qs['fields'](_0x2e2557[_0x9904('0x49')]['fields']));_0x22f451[_0x9904('0x4a')]=_0x22f451[_0x9904('0x4a')]['length']?_0x22f451[_0x9904('0x4a')]:_0x468ec9[_0x9904('0x48')];_0x22f451[_0x9904('0x4f')]=qs[_0x9904('0x50')](_0x2e2557[_0x9904('0x49')][_0x9904('0x50')]);_0x22f451[_0x9904('0x51')]=qs[_0x9904('0x47')](_[_0x9904('0x70')](_0x2e2557['query'],_0x468ec9[_0x9904('0x47')]));if(_0x2e2557[_0x9904('0x49')][_0x9904('0x52')]){_0x22f451[_0x9904('0x51')]=_[_0x9904('0x53')](_0x22f451[_0x9904('0x51')],{'$or':_[_0x9904('0x42')](_0x22f451['attributes'],function(_0x1b75e5){var _0x2f5467={};_0x2f5467[_0x1b75e5]={'$like':'%'+_0x2e2557['query'][_0x9904('0x52')]+'%'};return _0x2f5467;})});}_0x22f451=_[_0x9904('0x53')]({},_0x22f451,_0x2e2557['options']);return _0x341cab[_0x9904('0x97')](_0x22f451);}})['then'](function(_0x3390bc){if(_0x3390bc){_0x35f743=_0x3390bc[_0x9904('0x4d')];if(!_0x2e2557[_0x9904('0x49')][_0x9904('0x69')](_0x9904('0x4e'))){_0x22f451['limit']=qs[_0x9904('0x1f')](_0x2e2557[_0x9904('0x49')]['limit']);_0x22f451['offset']=qs['offset'](_0x2e2557[_0x9904('0x49')][_0x9904('0x1d')]);}return _0x341cab[_0x9904('0x97')](_0x22f451);}})[_0x9904('0x13')](function(_0x395bf4){if(_0x395bf4){return _0x395bf4?{'count':_0x35f743,'rows':_0x395bf4}:null;}})['then'](respondWithResult(_0x42b415,null))['catch'](handleError(_0x42b415,null));};exports[_0x9904('0x98')]=function(_0x2610bb,_0x48990c){var _0x23420b={'raw':!![],'where':{}};var _0x22f54e={};var _0x36f1e9={'count':0x0,'rows':[]};return db['MailAccount'][_0x9904('0x68')]({'where':{'id':_0x2610bb[_0x9904('0x5b')]['id']}})[_0x9904('0x13')](handleEntityNotFound(_0x48990c,null))[_0x9904('0x13')](function(_0x1b7f5f){if(_0x1b7f5f){_0x22f54e[_0x9904('0x48')]=_[_0x9904('0x5d')](db[_0x9904('0x99')][_0x9904('0x44')]);_0x22f54e[_0x9904('0x49')]=_[_0x9904('0x5d')](_0x2610bb['query']);_0x22f54e['filters']=_['intersection'](_0x22f54e[_0x9904('0x48')],_0x22f54e[_0x9904('0x49')]);_0x23420b['attributes']=_[_0x9904('0x4b')](_0x22f54e[_0x9904('0x48')],qs[_0x9904('0x4c')](_0x2610bb[_0x9904('0x49')][_0x9904('0x4c')]));_0x23420b[_0x9904('0x4a')]=_0x23420b[_0x9904('0x4a')][_0x9904('0x4d')]?_0x23420b[_0x9904('0x4a')]:_0x22f54e[_0x9904('0x48')];if(!_0x2610bb[_0x9904('0x49')][_0x9904('0x69')]('nolimit')){_0x23420b['limit']=qs[_0x9904('0x1f')](_0x2610bb[_0x9904('0x49')]['limit']);_0x23420b[_0x9904('0x1d')]=qs[_0x9904('0x1d')](_0x2610bb['query'][_0x9904('0x1d')]);}_0x23420b[_0x9904('0x4f')]=qs[_0x9904('0x50')](_0x2610bb[_0x9904('0x49')][_0x9904('0x50')]);_0x23420b[_0x9904('0x51')]=qs[_0x9904('0x47')](_[_0x9904('0x70')](_0x2610bb[_0x9904('0x49')],_0x22f54e['filters']));_0x23420b[_0x9904('0x51')][_0x9904('0x6a')]=_0x1b7f5f['id'];if(_0x2610bb[_0x9904('0x49')][_0x9904('0x52')]){_0x23420b['where']=_['merge'](_0x23420b[_0x9904('0x51')],{'$or':_['map'](_0x23420b['attributes'],function(_0x5bdd72){var _0x341105={};_0x341105[_0x5bdd72]={'$like':'%'+_0x2610bb[_0x9904('0x49')]['filter']+'%'};return _0x341105;})});}if(_0x2610bb[_0x9904('0x49')][_0x9904('0x9a')]){var _0x3aff13=_0x2610bb['query'][_0x9904('0x9a')][_0x9904('0x9b')](',');var _0x26cdfc={};_0x26cdfc[_0x3aff13[0x0]]={'$gte':moment(_0x3aff13[0x1])[_0x9904('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x23420b[_0x9904('0x51')]=_[_0x9904('0x53')](_0x23420b[_0x9904('0x51')],_0x26cdfc);}_0x23420b=_[_0x9904('0x53')]({},_0x23420b,_0x2610bb['options']);return db[_0x9904('0x99')][_0x9904('0x20')]({'where':_0x23420b[_0x9904('0x51')]})[_0x9904('0x13')](function(_0x1298d4){_0x36f1e9['count']=_0x1298d4;if(_0x2610bb['query'][_0x9904('0x56')]){_0x23420b[_0x9904('0x57')]=[{'all':!![]}];}return db[_0x9904('0x99')]['findAll'](_0x23420b);})['then'](function(_0x5d21d6){if(_0x2610bb[_0x9904('0x49')][_0x9904('0x9d')]===_0x9904('0x9e')){for(var _0x19c4b9=0x0;_0x19c4b9<_0x5d21d6[_0x9904('0x4d')];_0x19c4b9++){_0x5d21d6[_0x19c4b9][_0x9904('0x5e')]=juice(_0x5d21d6[_0x19c4b9][_0x9904('0x5e')]);}}_0x36f1e9['rows']=_0x5d21d6;return _0x36f1e9;});}})[_0x9904('0x13')](respondWithFilteredResult(_0x48990c,_0x23420b))[_0x9904('0x19')](handleError(_0x48990c,null));};exports['send']=function(_0x25b76e,_0x53e682){var _0x4b82ea,_0x5671b4={},_0x1df982;if(_0x25b76e['body']['to']){_0x1df982=_0x25b76e[_0x9904('0x5e')]['to'][_0x9904('0x9b')](',')[0x0];}return db[_0x9904('0x43')][_0x9904('0x61')]({'where':{'id':_0x25b76e[_0x9904('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x9904('0x9f'),'include':[{'model':db[_0x9904('0x85')],'as':_0x9904('0xa0'),'where':{'email':_0x1df982},'limit':0x1,'order':[[_0x9904('0xa1'),_0x9904('0xa2')]]}]},{'model':db[_0x9904('0x5c')],'as':_0x9904('0x3d'),'raw':!![],'include':[{'model':db[_0x9904('0xa3')],'as':_0x9904('0xa3'),'raw':!![]}]}]})[_0x9904('0x13')](handleEntityNotFound(_0x53e682,null))[_0x9904('0x13')](function(_0x5e3673){if(!_0x5e3673)return;_0x4b82ea=_0x5e3673;if(!_0x5e3673[_0x9904('0x3d')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x9904('0xa4')](_0x25b76e[_0x9904('0x5e')][_0x9904('0xa5')])){_0x25b76e[_0x9904('0x5e')][_0x9904('0xa5')]=util['format'](_0x9904('0xa6'),_0x5e3673['name'],_0x5e3673[_0x9904('0x72')]||_0x5e3673[_0x9904('0x3d')]['user']);}if(_0x25b76e[_0x9904('0x5e')][_0x9904('0xa7')]&&_0x25b76e[_0x9904('0x5e')][_0x9904('0xa7')][_0x9904('0x4d')]){for(var _0x38f7cc=0x0;_0x38f7cc<_0x25b76e['body']['attachments'][_0x9904('0x4d')];_0x38f7cc+=0x1){_0x25b76e[_0x9904('0x5e')][_0x9904('0xa7')][_0x38f7cc]={'filename':_0x25b76e[_0x9904('0x5e')][_0x9904('0xa7')][_0x38f7cc][_0x9904('0x46')],'path':path[_0x9904('0xa8')](config['root'],'server/files/attachments',_0x25b76e['body'][_0x9904('0xa7')][_0x38f7cc][_0x9904('0xa9')])};}}var _0x5163a6=_0x5e3673[_0x9904('0xaa')]();return respondWithRpcPromise(_0x9904('0xab'),_0x9904('0xac'),{'account':_0x5163a6,'message':_0x25b76e[_0x9904('0x5e')]});})[_0x9904('0x13')](function(_0x1e951a){if(!_0x1e951a)return;_0x5671b4=_0x1e951a;if(!_0x4b82ea[_0x9904('0x9f')])throw new Error(_0x9904('0xad'));if(_0x4b82ea[_0x9904('0x9f')][_0x9904('0xa0')]['length'])return _0x4b82ea[_0x9904('0x9f')][_0x9904('0xa0')][0x0];return db[_0x9904('0x85')]['create'](_[_0x9904('0xb')](_0x25b76e[_0x9904('0x5e')],{'firstName':_0x25b76e[_0x9904('0x5e')]['to'],'email':_0x25b76e[_0x9904('0x5e')]['to'],'phone':_0x25b76e['body']['to'],'ListId':_0x4b82ea['ListId']}));})[_0x9904('0x13')](function(_0x130b03){if(!_0x130b03)return;var _0x514c6={'UserId':_0x25b76e[_0x9904('0x32')]['id'],'ContactId':_0x130b03['id'],'MailAccountId':_0x4b82ea['id'],'inReplyTo':_0x5671b4[_0x9904('0xae')],'to':_0x25b76e[_0x9904('0x5e')]['from'],'cc':_0x25b76e[_0x9904('0x5e')]['cc'],'subject':_0x25b76e['body'][_0x9904('0xaf')],'attach':_0x25b76e[_0x9904('0x5e')][_0x9904('0xb0')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x9904('0x9c')](_0x9904('0xb1')),'lastMsgDirection':_0x9904('0xb2'),'Messages':[_[_0x9904('0x53')](_0x25b76e[_0x9904('0x5e')],{'messageId':_0x5671b4[_0x9904('0xae')],'sentAt':moment()[_0x9904('0x9c')](_0x9904('0xb1')),'read':!![],'MailAccountId':_0x4b82ea['id'],'UserId':_0x25b76e[_0x9904('0x32')]['id'],'ContactId':_0x130b03['id']})]};if(_0x25b76e['body'][_0x9904('0xb3')]){_0x514c6=_['merge'](_0x514c6,_0x25b76e[_0x9904('0x5e')][_0x9904('0xb3')]);}return db[_0x9904('0x83')]['create'](_0x514c6,{'include':[{'model':db[_0x9904('0x99')],'as':_0x9904('0xb4')}]});})[_0x9904('0x13')](respondWithResult(_0x53e682,null))[_0x9904('0x19')](handleError(_0x53e682,null));};exports['verifySmtp']=function(_0x19fdc9,_0x22a9bb){return db['MailAccount'][_0x9904('0x61')]({'where':{'id':_0x19fdc9[_0x9904('0x5b')]['id']},'include':[{'model':db[_0x9904('0x5c')],'as':_0x9904('0x3d'),'raw':!![],'include':[{'model':db[_0x9904('0xa3')],'as':'CloudProvider','raw':!![]}]}]})[_0x9904('0x13')](handleEntityNotFound(_0x22a9bb,null))['then'](function(_0x2b8188){if(!_0x2b8188[_0x9904('0x3d')])return;var _0x319f1c=_0x2b8188['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp',_0x9904('0xb5'),{'account':_0x319f1c});})[_0x9904('0x13')](respondWithResult(_0x22a9bb,null))[_0x9904('0x19')](handleError(_0x22a9bb,null));};exports[_0x9904('0x25')]=function(_0x167dd4,_0x301c4c){return db[_0x9904('0x43')][_0x9904('0x61')]({'where':{'id':_0x167dd4[_0x9904('0x5b')]['id']}})[_0x9904('0x13')](handleEntityNotFound(_0x301c4c,null))[_0x9904('0x13')](function(_0x3870bd){if(_0x3870bd&&_0x3870bd[_0x9904('0x3b')]){throw new db[(_0x9904('0xb6'))][(_0x9904('0xb7'))](_0x9904('0xb8'));}return _0x3870bd;})[_0x9904('0x13')](removeEntity(_0x301c4c,null))[_0x9904('0x19')](handleError(_0x301c4c,null));};exports[_0x9904('0xb9')]=function(_0x59a6b7,_0x4f1bb5){return db[_0x9904('0x43')][_0x9904('0x61')]({'where':{'id':_0x59a6b7[_0x9904('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4f1bb5,null))[_0x9904('0x13')](function(_0x41bb62){if(_0x41bb62){return _0x41bb62[_0x9904('0xb9')](_0x59a6b7['body']['ids'],_['omit'](_0x59a6b7[_0x9904('0x5e')],[_0x9904('0x6c'),'id'])||{})[_0x9904('0xba')](function(_0x294dfb){for(var _0x521000=0x0;_0x521000<_0x59a6b7[_0x9904('0x5e')]['ids']['length'];_0x521000+=0x1){socket[_0x9904('0xbb')](_0x9904('0xbc'),{'UserId':Number(_0x59a6b7['body']['ids'][_0x521000]),'MailAccountId':Number(_0x59a6b7['params']['id'])});}return _0x294dfb;});}})[_0x9904('0x13')](respondWithResult(_0x4f1bb5,null))[_0x9904('0x19')](handleError(_0x4f1bb5,null));};exports['removeAgents']=function(_0x173c39,_0x2a074d){return db[_0x9904('0x43')][_0x9904('0x61')]({'where':{'id':_0x173c39[_0x9904('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2a074d,null))[_0x9904('0x13')](function(_0xa7e5f4){if(_0xa7e5f4){return _0xa7e5f4[_0x9904('0xbd')](_0x173c39[_0x9904('0x49')][_0x9904('0x6c')])[_0x9904('0x13')](function(){if(_[_0x9904('0xbe')](_0x173c39[_0x9904('0x49')][_0x9904('0x6c')])){for(var _0x1279fd=0x0;_0x1279fd<_0x173c39[_0x9904('0x49')][_0x9904('0x6c')]['length'];_0x1279fd+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x173c39['query'][_0x9904('0x6c')][_0x1279fd]),'MailAccountId':Number(_0x173c39[_0x9904('0x5b')]['id'])});}}else{socket[_0x9904('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x173c39[_0x9904('0x49')][_0x9904('0x6c')]),'MailAccountId':Number(_0x173c39[_0x9904('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a074d,null))[_0x9904('0x19')](handleError(_0x2a074d,null));};exports[_0x9904('0xbf')]=function(_0x3909ee,_0xf0a0e7){var _0x1aa514={};var _0x20347b={};var _0x58ea79;var _0x330cba;return db[_0x9904('0x43')]['findOne']({'where':{'id':_0x3909ee[_0x9904('0x5b')]['id']}})[_0x9904('0x13')](handleEntityNotFound(_0xf0a0e7,null))[_0x9904('0x13')](function(_0x157ae){if(_0x157ae){_0x58ea79=_0x157ae;_0x20347b[_0x9904('0x48')]=_[_0x9904('0x5d')](db[_0x9904('0xc0')]['rawAttributes']);_0x20347b[_0x9904('0x49')]=_[_0x9904('0x5d')](_0x3909ee['query']);_0x20347b[_0x9904('0x47')]=_['intersection'](_0x20347b[_0x9904('0x48')],_0x20347b[_0x9904('0x49')]);_0x1aa514[_0x9904('0x4a')]=_[_0x9904('0x4b')](_0x20347b['model'],qs['fields'](_0x3909ee[_0x9904('0x49')]['fields']));_0x1aa514['attributes']=_0x1aa514['attributes'][_0x9904('0x4d')]?_0x1aa514['attributes']:_0x20347b[_0x9904('0x48')];_0x1aa514[_0x9904('0x4f')]=qs[_0x9904('0x50')](_0x3909ee[_0x9904('0x49')][_0x9904('0x50')]);_0x1aa514['where']=qs[_0x9904('0x47')](_[_0x9904('0x70')](_0x3909ee['query'],_0x20347b[_0x9904('0x47')]));if(_0x3909ee[_0x9904('0x49')][_0x9904('0x52')]){_0x1aa514[_0x9904('0x51')]=_[_0x9904('0x53')](_0x1aa514[_0x9904('0x51')],{'$or':_[_0x9904('0x42')](_0x1aa514[_0x9904('0x4a')],function(_0x46adf0){var _0x3c196b={};_0x3c196b[_0x46adf0]={'$like':'%'+_0x3909ee[_0x9904('0x49')]['filter']+'%'};return _0x3c196b;})});}_0x1aa514=_[_0x9904('0x53')]({},_0x1aa514,_0x3909ee[_0x9904('0x55')]);return _0x58ea79[_0x9904('0xbf')](_0x1aa514);}})[_0x9904('0x13')](function(_0xe797f0){if(_0xe797f0){_0x330cba=_0xe797f0['length'];if(!_0x3909ee['query'][_0x9904('0x69')]('nolimit')){_0x1aa514[_0x9904('0x1f')]=qs[_0x9904('0x1f')](_0x3909ee[_0x9904('0x49')][_0x9904('0x1f')]);_0x1aa514[_0x9904('0x1d')]=qs[_0x9904('0x1d')](_0x3909ee['query'][_0x9904('0x1d')]);}return _0x58ea79[_0x9904('0xbf')](_0x1aa514);}})[_0x9904('0x13')](function(_0xde2b27){if(_0xde2b27){return _0xde2b27?{'count':_0x330cba,'rows':_0xde2b27}:null;}})[_0x9904('0x13')](respondWithResult(_0xf0a0e7,null))[_0x9904('0x19')](handleError(_0xf0a0e7,null));}; \ No newline at end of file +var _0xbfd2=['CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','subject','messageId','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','then','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','yahoo','imap.mail.yahoo.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','show','params','Pause','includeAll','options','find','body','provider','Mail\x20Account\x20not\x20found','update','describe','addDisposition','Disposition','create','getDispositions','findOne','MailAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','email','isNil','active','description','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','omit','User','Owner','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','CmContact','Contacts','updatedAt'];(function(_0x558cfe,_0x28b212){var _0x277aca=function(_0x130031){while(--_0x130031){_0x558cfe['push'](_0x558cfe['shift']());}};_0x277aca(++_0x28b212);}(_0xbfd2,0x198));var _0x2bfd=function(_0x21fc1b,_0xd60f22){_0x21fc1b=_0x21fc1b-0x0;var _0x296cf6=_0xbfd2[_0x21fc1b];return _0x296cf6;};'use strict';var moment=require(_0x2bfd('0x0'));var BPromise=require(_0x2bfd('0x1'));var util=require(_0x2bfd('0x2'));var path=require(_0x2bfd('0x3'));var _=require(_0x2bfd('0x4'));var juice=require(_0x2bfd('0x5'));var Redis=require(_0x2bfd('0x6'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x2bfd('0x7'));var config=require(_0x2bfd('0x8'));var db=require(_0x2bfd('0x9'))['db'];config[_0x2bfd('0xa')]=_[_0x2bfd('0xb')](config[_0x2bfd('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2bfd('0xa')]));require(_0x2bfd('0xc'))[_0x2bfd('0xd')](socket);var jayson=require(_0x2bfd('0xe'));var client=jayson[_0x2bfd('0xf')][_0x2bfd('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x50ea19,_0x251e07,_0x1be920,_0x174304){return new BPromise(function(_0x4f723c,_0x3318b8){var _0xedb1ad=_0x174304||client;return _0xedb1ad[_0x2bfd('0x11')](_0x50ea19,_0x1be920)['then'](function(_0x382831){logger[_0x2bfd('0x12')](_0x2bfd('0x13'),_0x251e07,'request\x20sent');logger[_0x2bfd('0x14')](_0x2bfd('0x15'),_0x251e07,_0x2bfd('0x16'),JSON[_0x2bfd('0x17')](_0x382831));if(_0x382831[_0x2bfd('0x18')]){if(_0x382831[_0x2bfd('0x18')][_0x2bfd('0x19')]===0x1f4){logger[_0x2bfd('0x18')](_0x2bfd('0x13'),_0x251e07,_0x382831[_0x2bfd('0x18')][_0x2bfd('0x1a')]);return _0x3318b8(_0x382831[_0x2bfd('0x18')][_0x2bfd('0x1a')]);}logger[_0x2bfd('0x18')]('MailAccount,\x20%s,\x20%s',_0x251e07,_0x382831[_0x2bfd('0x18')]['message']);return _0x4f723c(_0x382831[_0x2bfd('0x18')]['message']);}else{logger[_0x2bfd('0x12')](_0x2bfd('0x13'),_0x251e07,_0x2bfd('0x16'));_0x4f723c(_0x382831['result'][_0x2bfd('0x1a')]);}})[_0x2bfd('0x1b')](function(_0x583636){logger[_0x2bfd('0x18')](_0x2bfd('0x13'),_0x251e07,_0x583636);_0x3318b8(_0x583636);});});}function respondWithStatusCode(_0x4d33bd,_0x2103d3){_0x2103d3=_0x2103d3||0xcc;return function(_0x2c6d38){if(_0x2c6d38){return _0x4d33bd[_0x2bfd('0x1c')](_0x2103d3);}return _0x4d33bd[_0x2bfd('0x1d')](_0x2103d3)[_0x2bfd('0x1e')]();};}function respondWithResult(_0x5efa98,_0x4a970c){_0x4a970c=_0x4a970c||0xc8;return function(_0x23c153){if(_0x23c153){return _0x5efa98[_0x2bfd('0x1d')](_0x4a970c)[_0x2bfd('0x1f')](_0x23c153);}};}function respondWithFilteredResult(_0x50257b,_0x1debad){return function(_0x42b36d){if(_0x42b36d){var _0x26dab0=typeof _0x1debad[_0x2bfd('0x20')]===_0x2bfd('0x21')&&typeof _0x1debad[_0x2bfd('0x22')]===_0x2bfd('0x21');var _0x591de1=_0x42b36d[_0x2bfd('0x23')];var _0x1b8437=_0x26dab0?0x0:_0x1debad[_0x2bfd('0x20')];var _0x1f736d=_0x26dab0?_0x42b36d[_0x2bfd('0x23')]:_0x1debad[_0x2bfd('0x20')]+_0x1debad[_0x2bfd('0x22')];var _0x22724c;if(_0x1f736d>=_0x591de1){_0x1f736d=_0x591de1;_0x22724c=0xc8;}else{_0x22724c=0xce;}_0x50257b[_0x2bfd('0x1d')](_0x22724c);return _0x50257b[_0x2bfd('0x24')]('Content-Range',_0x1b8437+'-'+_0x1f736d+'/'+_0x591de1)['json'](_0x42b36d);}return null;};}function saveUpdates(_0x2442a6){return function(_0x29761e){if(_0x29761e){return _0x29761e['update'](_0x2442a6)[_0x2bfd('0x25')](function(_0x4a3c43){return _0x4a3c43;});}return null;};}function removeEntity(_0x285d41){return function(_0x2a70c0){if(_0x2a70c0){return _0x2a70c0[_0x2bfd('0x26')]()['then'](function(){var _0x27cf1e=_0x2a70c0[_0x2bfd('0x27')]({'plain':!![]});var _0x37a9c5=_0x2bfd('0x28');return db[_0x2bfd('0x29')]['destroy']({'where':{'type':_0x37a9c5,'resourceId':_0x27cf1e['id']}})[_0x2bfd('0x25')](function(){return _0x2a70c0;});})[_0x2bfd('0x25')](function(){_0x285d41['status'](0xcc)[_0x2bfd('0x1e')]();});}};}function handleEntityNotFound(_0x10c9dd){return function(_0x4fedd1){if(!_0x4fedd1){_0x10c9dd['sendStatus'](0x194);}return _0x4fedd1;};}function handleError(_0x329945,_0x40f214){_0x40f214=_0x40f214||0x1f4;return function(_0x1daa12){logger[_0x2bfd('0x18')](_0x1daa12[_0x2bfd('0x2a')]);if(_0x1daa12[_0x2bfd('0x2b')]){delete _0x1daa12['name'];}_0x329945[_0x2bfd('0x1d')](_0x40f214)[_0x2bfd('0x2c')](_0x1daa12);};}function getImapHost(_0x222bff){switch(_0x222bff){case _0x2bfd('0x2d'):return'imap.gmail.com';case _0x2bfd('0x2e'):return _0x2bfd('0x2f');case'hotmail':return'imap-mail.outlook.com';case _0x2bfd('0x30'):return _0x2bfd('0x31');}throw new Error(_0x2bfd('0x32'),_0x222bff);}function getSmtpHost(_0x3e4e19){switch(_0x3e4e19){case _0x2bfd('0x2d'):return _0x2bfd('0x33');case _0x2bfd('0x2e'):return _0x2bfd('0x34');case _0x2bfd('0x35'):return _0x2bfd('0x36');case _0x2bfd('0x30'):return'smtp.office365.com';}throw new Error(_0x2bfd('0x32'),_0x3e4e19);}function getAuthenticationOptions(_0x2ca0bc,_0x42e1c0){var _0x38c5b8={};var _0x39287f={};if(_0x2ca0bc){_0x38c5b8[_0x2bfd('0x37')]=_0x39287f[_0x2bfd('0x37')]=_0x42e1c0[_0x2bfd('0x38')];_0x38c5b8[_0x2bfd('0x39')]=_0x39287f[_0x2bfd('0x3a')]=_0x42e1c0[_0x2bfd('0x39')];if(_0x42e1c0[_0x2bfd('0x3b')]){_0x38c5b8[_0x2bfd('0x3b')]=_0x39287f['modernAuthentication']=!![];_0x38c5b8[_0x2bfd('0x3c')]=_0x39287f[_0x2bfd('0x3c')]=_0x42e1c0[_0x2bfd('0x3c')];_0x38c5b8['password']=_0x39287f[_0x2bfd('0x3a')]=null;}else{_0x38c5b8[_0x2bfd('0x3c')]=_0x39287f['CloudProviderId']=null;}_0x38c5b8['host']=getImapHost(_0x2ca0bc);_0x38c5b8[_0x2bfd('0x3d')]=0x3e1;_0x39287f[_0x2bfd('0x3e')]=getSmtpHost(_0x2ca0bc);_0x39287f[_0x2bfd('0x3d')]=0x24b;_0x39287f[_0x2bfd('0x3f')]=![];_0x38c5b8[_0x2bfd('0x40')]=_0x39287f[_0x2bfd('0x40')]=null;}else{if(_0x42e1c0[_0x2bfd('0x41')]){_0x38c5b8[_0x2bfd('0x37')]=_0x39287f[_0x2bfd('0x37')]=_0x42e1c0['username'];_0x38c5b8[_0x2bfd('0x39')]=_0x39287f[_0x2bfd('0x3a')]=_0x42e1c0[_0x2bfd('0x39')];}else{_0x38c5b8[_0x2bfd('0x41')]=_0x39287f['authentication']=![];_0x38c5b8[_0x2bfd('0x37')]=_0x39287f[_0x2bfd('0x37')]=null;_0x38c5b8[_0x2bfd('0x39')]=_0x39287f[_0x2bfd('0x3a')]=null;}_0x38c5b8[_0x2bfd('0x3e')]=_0x42e1c0[_0x2bfd('0x42')][_0x2bfd('0x3e')];_0x38c5b8[_0x2bfd('0x3d')]=_0x42e1c0[_0x2bfd('0x42')][_0x2bfd('0x3d')];_0x39287f[_0x2bfd('0x3e')]=_0x42e1c0['Smtp'][_0x2bfd('0x3e')];_0x39287f['port']=_0x42e1c0[_0x2bfd('0x43')][_0x2bfd('0x3d')];}return{'Imap':_0x38c5b8,'Smtp':_0x39287f};}exports[_0x2bfd('0x44')]=function(_0x546ab4,_0x2622ad){var _0x5d00a9={'include':[{'model':db[_0x2bfd('0x45')],'as':_0x2bfd('0x42')},{'model':db[_0x2bfd('0x46')],'as':_0x2bfd('0x43')},{'model':db['Pause'],'as':_0x2bfd('0x47')}]},_0x117fca={},_0x234f0c={'count':0x0,'rows':[]};var _0x3c2fac=_[_0x2bfd('0x48')](db[_0x2bfd('0x49')][_0x2bfd('0x4a')],function(_0x93a78e){return{'name':_0x93a78e[_0x2bfd('0x4b')],'type':_0x93a78e[_0x2bfd('0x4c')]['key']};});_0x117fca[_0x2bfd('0x4d')]=_[_0x2bfd('0x48')](_0x3c2fac,'name');_0x117fca['query']=_[_0x2bfd('0x4e')](_0x546ab4[_0x2bfd('0x4f')]);_0x117fca[_0x2bfd('0x50')]=_[_0x2bfd('0x51')](_0x117fca[_0x2bfd('0x4d')],_0x117fca['query']);_0x5d00a9[_0x2bfd('0x52')]=_[_0x2bfd('0x51')](_0x117fca[_0x2bfd('0x4d')],qs[_0x2bfd('0x53')](_0x546ab4[_0x2bfd('0x4f')][_0x2bfd('0x53')]));_0x5d00a9['attributes']=_0x5d00a9['attributes'][_0x2bfd('0x54')]?_0x5d00a9[_0x2bfd('0x52')]:_0x117fca[_0x2bfd('0x4d')];if(!_0x546ab4[_0x2bfd('0x4f')][_0x2bfd('0x55')](_0x2bfd('0x56'))){_0x5d00a9[_0x2bfd('0x22')]=qs[_0x2bfd('0x22')](_0x546ab4[_0x2bfd('0x4f')]['limit']);_0x5d00a9[_0x2bfd('0x20')]=qs[_0x2bfd('0x20')](_0x546ab4[_0x2bfd('0x4f')][_0x2bfd('0x20')]);}_0x5d00a9[_0x2bfd('0x57')]=qs[_0x2bfd('0x58')](_0x546ab4[_0x2bfd('0x4f')][_0x2bfd('0x58')]);_0x5d00a9['where']=qs[_0x2bfd('0x50')](_[_0x2bfd('0x59')](_0x546ab4['query'],_0x117fca[_0x2bfd('0x50')]),_0x3c2fac);if(_0x546ab4[_0x2bfd('0x4f')][_0x2bfd('0x5a')]){_0x5d00a9[_0x2bfd('0x5b')]=_[_0x2bfd('0x5c')](_0x5d00a9[_0x2bfd('0x5b')],{'$or':_[_0x2bfd('0x48')](_0x3c2fac,function(_0x13f00c){if(_0x13f00c[_0x2bfd('0x4c')]!==_0x2bfd('0x5d')){var _0x3cf5c5={};_0x3cf5c5[_0x13f00c['name']]={'$like':'%'+_0x546ab4['query'][_0x2bfd('0x5a')]+'%'};return _0x3cf5c5;}})});}_0x5d00a9=_['merge']({},_0x5d00a9,_0x546ab4['options']);var _0x554d61={'where':_0x5d00a9[_0x2bfd('0x5b')]};return db[_0x2bfd('0x49')][_0x2bfd('0x23')](_0x554d61)[_0x2bfd('0x25')](function(_0x2cdf8a){_0x234f0c['count']=_0x2cdf8a;if(_0x546ab4['query']['includeAll']){_0x5d00a9[_0x2bfd('0x5e')]=[{'all':!![]}];}return db['MailAccount'][_0x2bfd('0x5f')](_0x5d00a9);})['then'](function(_0x40dde2){_0x234f0c[_0x2bfd('0x60')]=_0x40dde2;return _0x234f0c;})[_0x2bfd('0x25')](respondWithFilteredResult(_0x2622ad,_0x5d00a9))['catch'](handleError(_0x2622ad,null));};exports[_0x2bfd('0x61')]=function(_0x43b244,_0x179fa8){var _0x6cb529={'raw':![],'where':{'id':_0x43b244[_0x2bfd('0x62')]['id']},'include':[{'model':db[_0x2bfd('0x45')],'as':_0x2bfd('0x42')},{'model':db[_0x2bfd('0x46')],'as':'Smtp'},{'model':db[_0x2bfd('0x63')],'as':_0x2bfd('0x47')}]},_0x519ba8={};_0x519ba8[_0x2bfd('0x4d')]=_[_0x2bfd('0x4e')](db[_0x2bfd('0x49')][_0x2bfd('0x4a')]);_0x519ba8['query']=_[_0x2bfd('0x4e')](_0x43b244[_0x2bfd('0x4f')]);_0x519ba8[_0x2bfd('0x50')]=_['intersection'](_0x519ba8['model'],_0x519ba8[_0x2bfd('0x4f')]);_0x6cb529[_0x2bfd('0x52')]=_[_0x2bfd('0x51')](_0x519ba8['model'],qs[_0x2bfd('0x53')](_0x43b244[_0x2bfd('0x4f')][_0x2bfd('0x53')]));_0x6cb529['attributes']=_0x6cb529[_0x2bfd('0x52')][_0x2bfd('0x54')]?_0x6cb529[_0x2bfd('0x52')]:_0x519ba8[_0x2bfd('0x4d')];if(_0x43b244[_0x2bfd('0x4f')][_0x2bfd('0x64')]){_0x6cb529[_0x2bfd('0x5e')]=[{'all':!![]}];}_0x6cb529=_['merge']({},_0x6cb529,_0x43b244[_0x2bfd('0x65')]);return db[_0x2bfd('0x49')][_0x2bfd('0x66')](_0x6cb529)[_0x2bfd('0x25')](handleEntityNotFound(_0x179fa8,null))['then'](respondWithResult(_0x179fa8,null))[_0x2bfd('0x1b')](handleError(_0x179fa8,null));};exports['update']=function(_0x2d36da,_0x19d6b8){if(_0x2d36da[_0x2bfd('0x67')]['id']){delete _0x2d36da[_0x2bfd('0x67')]['id'];}var _0x19d82f=_0x2d36da[_0x2bfd('0x67')][_0x2bfd('0x68')]==='custom'?null:_0x2d36da[_0x2bfd('0x67')][_0x2bfd('0x68')];var _0x550a02=_0x2d36da['body']['Imap']||{};var _0x1dcbb9=_0x2d36da[_0x2bfd('0x67')][_0x2bfd('0x43')]||{};if(_0x19d82f){_0x550a02[_0x2bfd('0x3e')]=getImapHost(_0x19d82f);_0x550a02[_0x2bfd('0x3d')]=0x3e1;_0x1dcbb9[_0x2bfd('0x3e')]=getSmtpHost(_0x19d82f);_0x1dcbb9[_0x2bfd('0x3d')]=0x24b;_0x1dcbb9['secure']=![];}if(_0x1dcbb9[_0x2bfd('0x3b')]){_0x1dcbb9[_0x2bfd('0x3f')]=![];}else{_0x1dcbb9['CloudProviderId']=null;}if(!_0x550a02[_0x2bfd('0x3b')])_0x550a02[_0x2bfd('0x3c')]=null;_0x2d36da[_0x2bfd('0x67')][_0x2bfd('0x42')]=_0x550a02;_0x2d36da['body'][_0x2bfd('0x43')]=_0x1dcbb9;return db[_0x2bfd('0x49')][_0x2bfd('0x66')]({'where':{'id':_0x2d36da[_0x2bfd('0x62')]['id']},'include':[{'model':db[_0x2bfd('0x45')],'as':_0x2bfd('0x42')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x2bfd('0x63')],'as':_0x2bfd('0x47')}]})[_0x2bfd('0x25')](handleEntityNotFound(_0x19d6b8,null))[_0x2bfd('0x25')](function(_0x3c0d9a){if(!_0x3c0d9a)throw new Error(_0x2bfd('0x69'));if(_0x3c0d9a[_0x2bfd('0x40')])delete _0x2d36da[_0x2bfd('0x67')]['Imap'];return _0x3c0d9a;})[_0x2bfd('0x25')](saveUpdates(_0x2d36da[_0x2bfd('0x67')],null))['then'](function(_0xf66954){if(!_0x2d36da[_0x2bfd('0x67')][_0x2bfd('0x42')])return _0xf66954;return db[_0x2bfd('0x45')][_0x2bfd('0x6a')](_0x2d36da[_0x2bfd('0x67')][_0x2bfd('0x42')],{'where':{'MailAccountId':_0xf66954['id']}})[_0x2bfd('0x25')](function(){return _0xf66954;});})[_0x2bfd('0x25')](function(_0x271f76){if(!_0x2d36da['body'][_0x2bfd('0x43')])return _0x271f76;return db['MailServerOut'][_0x2bfd('0x6a')](_0x2d36da['body'][_0x2bfd('0x43')],{'where':{'MailAccountId':_0x271f76['id']}})[_0x2bfd('0x25')](function(){return _0x271f76;});})[_0x2bfd('0x25')](respondWithResult(_0x19d6b8,null))['catch'](handleError(_0x19d6b8,null));};exports[_0x2bfd('0x6b')]=function(_0x33af0d,_0x165da0){return db['MailAccount']['describe']()[_0x2bfd('0x25')](respondWithResult(_0x165da0,null))['catch'](handleError(_0x165da0,null));};exports[_0x2bfd('0x6c')]=function(_0x185053,_0x53eb37){if(_0x185053[_0x2bfd('0x67')]['id']){delete _0x185053[_0x2bfd('0x67')]['id'];}return db[_0x2bfd('0x49')][_0x2bfd('0x66')]({'where':{'id':_0x185053[_0x2bfd('0x62')]['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x53eb37,null))[_0x2bfd('0x25')](function(_0x4aaa41){if(_0x4aaa41){_0x185053['body']['MailAccountId']=_0x4aaa41['id'];return db[_0x2bfd('0x6d')][_0x2bfd('0x6e')](_0x185053['body']);}})[_0x2bfd('0x25')](respondWithResult(_0x53eb37,null))[_0x2bfd('0x1b')](handleError(_0x53eb37,null));};exports[_0x2bfd('0x6f')]=function(_0x38fb57,_0x39274d){var _0x5455a4={'raw':![],'where':{}};var _0x3655de={};var _0x109c2c={'count':0x0,'rows':[]};return db[_0x2bfd('0x49')][_0x2bfd('0x70')]({'where':{'id':_0x38fb57['params']['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x39274d,null))[_0x2bfd('0x25')](function(_0x8bbb3f){if(_0x8bbb3f){_0x3655de['model']=_[_0x2bfd('0x4e')](db['Disposition'][_0x2bfd('0x4a')]);_0x3655de[_0x2bfd('0x4f')]=_[_0x2bfd('0x4e')](_0x38fb57[_0x2bfd('0x4f')]);_0x3655de[_0x2bfd('0x50')]=_[_0x2bfd('0x51')](_0x3655de[_0x2bfd('0x4d')],_0x3655de[_0x2bfd('0x4f')]);_0x5455a4[_0x2bfd('0x52')]=_[_0x2bfd('0x51')](_0x3655de['model'],qs[_0x2bfd('0x53')](_0x38fb57['query'][_0x2bfd('0x53')]));_0x5455a4[_0x2bfd('0x52')]=_0x5455a4[_0x2bfd('0x52')][_0x2bfd('0x54')]?_0x5455a4[_0x2bfd('0x52')]:_0x3655de[_0x2bfd('0x4d')];if(!_0x38fb57[_0x2bfd('0x4f')][_0x2bfd('0x55')](_0x2bfd('0x56'))){_0x5455a4[_0x2bfd('0x22')]=qs['limit'](_0x38fb57[_0x2bfd('0x4f')][_0x2bfd('0x22')]);_0x5455a4['offset']=qs['offset'](_0x38fb57[_0x2bfd('0x4f')][_0x2bfd('0x20')]);}_0x5455a4[_0x2bfd('0x57')]=qs['sort'](_0x38fb57[_0x2bfd('0x4f')][_0x2bfd('0x58')]);_0x5455a4[_0x2bfd('0x5b')]=qs[_0x2bfd('0x50')](_[_0x2bfd('0x59')](_0x38fb57[_0x2bfd('0x4f')],_0x3655de['filters']));_0x5455a4[_0x2bfd('0x5b')][_0x2bfd('0x71')]=_0x8bbb3f['id'];if(_0x38fb57[_0x2bfd('0x4f')][_0x2bfd('0x5a')]){_0x5455a4[_0x2bfd('0x5b')]=_['merge'](_0x5455a4[_0x2bfd('0x5b')],{'$or':_['map'](_0x5455a4[_0x2bfd('0x52')],function(_0x5638f5){var _0x396c6d={};_0x396c6d[_0x5638f5]={'$like':'%'+_0x38fb57[_0x2bfd('0x4f')]['filter']+'%'};return _0x396c6d;})});}_0x5455a4=_[_0x2bfd('0x5c')]({},_0x5455a4,_0x38fb57[_0x2bfd('0x65')]);return db[_0x2bfd('0x6d')][_0x2bfd('0x23')]({'where':_0x5455a4[_0x2bfd('0x5b')]})[_0x2bfd('0x25')](function(_0x4a41fc){_0x109c2c[_0x2bfd('0x23')]=_0x4a41fc;if(_0x38fb57['query'][_0x2bfd('0x64')]){_0x5455a4[_0x2bfd('0x5e')]=[{'all':!![]}];}return db[_0x2bfd('0x6d')][_0x2bfd('0x5f')](_0x5455a4);})[_0x2bfd('0x25')](function(_0x9e66fb){_0x109c2c['rows']=_0x9e66fb;return _0x109c2c;});}})['then'](respondWithFilteredResult(_0x39274d,_0x5455a4))[_0x2bfd('0x1b')](handleError(_0x39274d,null));};exports['removeDispositions']=function(_0x245ca3,_0x526f55){return db[_0x2bfd('0x49')][_0x2bfd('0x66')]({'where':{'id':_0x245ca3[_0x2bfd('0x62')]['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x526f55,null))['then'](function(_0x568113){if(_0x568113){return _0x568113[_0x2bfd('0x72')](_0x245ca3[_0x2bfd('0x4f')][_0x2bfd('0x73')]);}})['then'](respondWithStatusCode(_0x526f55,null))['catch'](handleError(_0x526f55,null));};exports[_0x2bfd('0x74')]=function(_0x217a68,_0x29a76d){if(_0x217a68[_0x2bfd('0x67')]['id']){delete _0x217a68['body']['id'];}return db['MailAccount'][_0x2bfd('0x66')]({'where':{'id':_0x217a68[_0x2bfd('0x62')]['id']}})['then'](handleEntityNotFound(_0x29a76d,null))[_0x2bfd('0x25')](function(_0x34465d){if(_0x34465d){_0x217a68[_0x2bfd('0x67')]['MailAccountId']=_0x34465d['id'];return db['CannedAnswer'][_0x2bfd('0x6e')](_0x217a68[_0x2bfd('0x67')]);}})[_0x2bfd('0x25')](respondWithResult(_0x29a76d,null))['catch'](handleError(_0x29a76d,null));};exports[_0x2bfd('0x75')]=function(_0x16f392,_0x40fe0e){var _0x386860={'raw':![],'where':{}};var _0x48d09b={};var _0x33b8d8={'count':0x0,'rows':[]};return db[_0x2bfd('0x49')][_0x2bfd('0x70')]({'where':{'id':_0x16f392[_0x2bfd('0x62')]['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x40fe0e,null))[_0x2bfd('0x25')](function(_0x1a5431){if(_0x1a5431){_0x48d09b[_0x2bfd('0x4d')]=_[_0x2bfd('0x4e')](db[_0x2bfd('0x76')][_0x2bfd('0x4a')]);_0x48d09b[_0x2bfd('0x4f')]=_[_0x2bfd('0x4e')](_0x16f392[_0x2bfd('0x4f')]);_0x48d09b['filters']=_['intersection'](_0x48d09b[_0x2bfd('0x4d')],_0x48d09b[_0x2bfd('0x4f')]);_0x386860[_0x2bfd('0x52')]=_[_0x2bfd('0x51')](_0x48d09b['model'],qs['fields'](_0x16f392[_0x2bfd('0x4f')][_0x2bfd('0x53')]));_0x386860[_0x2bfd('0x52')]=_0x386860[_0x2bfd('0x52')][_0x2bfd('0x54')]?_0x386860[_0x2bfd('0x52')]:_0x48d09b[_0x2bfd('0x4d')];if(!_0x16f392['query']['hasOwnProperty'](_0x2bfd('0x56'))){_0x386860[_0x2bfd('0x22')]=qs['limit'](_0x16f392[_0x2bfd('0x4f')][_0x2bfd('0x22')]);_0x386860[_0x2bfd('0x20')]=qs[_0x2bfd('0x20')](_0x16f392[_0x2bfd('0x4f')][_0x2bfd('0x20')]);}_0x386860[_0x2bfd('0x57')]=qs[_0x2bfd('0x58')](_0x16f392[_0x2bfd('0x4f')]['sort']);_0x386860[_0x2bfd('0x5b')]=qs[_0x2bfd('0x50')](_['pick'](_0x16f392['query'],_0x48d09b[_0x2bfd('0x50')]));_0x386860[_0x2bfd('0x5b')]['MailAccountId']=_0x1a5431['id'];if(_0x16f392[_0x2bfd('0x4f')]['filter']){_0x386860[_0x2bfd('0x5b')]=_['merge'](_0x386860['where'],{'$or':_['map'](_0x386860[_0x2bfd('0x52')],function(_0x55b9e0){var _0x1d7dbc={};_0x1d7dbc[_0x55b9e0]={'$like':'%'+_0x16f392[_0x2bfd('0x4f')][_0x2bfd('0x5a')]+'%'};return _0x1d7dbc;})});}_0x386860=_['merge']({},_0x386860,_0x16f392[_0x2bfd('0x65')]);return db[_0x2bfd('0x76')][_0x2bfd('0x23')]({'where':_0x386860['where']})[_0x2bfd('0x25')](function(_0x3fb741){_0x33b8d8[_0x2bfd('0x23')]=_0x3fb741;if(_0x16f392[_0x2bfd('0x4f')][_0x2bfd('0x64')]){_0x386860[_0x2bfd('0x5e')]=[{'all':!![]}];}return db[_0x2bfd('0x76')]['findAll'](_0x386860);})[_0x2bfd('0x25')](function(_0x4cf43a){_0x33b8d8['rows']=_0x4cf43a;return _0x33b8d8;});}})[_0x2bfd('0x25')](respondWithFilteredResult(_0x40fe0e,_0x386860))[_0x2bfd('0x1b')](handleError(_0x40fe0e,null));};exports[_0x2bfd('0x77')]=function(_0x3231fa,_0x21a0ab){return db['MailAccount'][_0x2bfd('0x66')]({'where':{'id':_0x3231fa['params']['id']}})['then'](handleEntityNotFound(_0x21a0ab,null))[_0x2bfd('0x25')](function(_0x405572){if(_0x405572){return _0x405572[_0x2bfd('0x77')](_0x3231fa[_0x2bfd('0x4f')][_0x2bfd('0x73')]);}})['then'](respondWithStatusCode(_0x21a0ab,null))[_0x2bfd('0x1b')](handleError(_0x21a0ab,null));};exports[_0x2bfd('0x6e')]=function(_0x575c30,_0x17a205){var _0x5e9b3c={'name':_0x575c30[_0x2bfd('0x67')][_0x2bfd('0x2b')],'key':_0x575c30[_0x2bfd('0x67')]['key'],'provider':_0x575c30[_0x2bfd('0x67')][_0x2bfd('0x68')]==='custom'?null:_0x575c30['body']['provider'],'email':_0x575c30[_0x2bfd('0x67')][_0x2bfd('0x78')],'ListId':_0x575c30[_0x2bfd('0x67')]['ListId'],'active':!_[_0x2bfd('0x79')](_0x575c30[_0x2bfd('0x67')][_0x2bfd('0x7a')])?_0x575c30[_0x2bfd('0x67')][_0x2bfd('0x7a')]:!![],'description':_0x575c30[_0x2bfd('0x67')][_0x2bfd('0x7b')]||null};var _0x1766da=getAuthenticationOptions(_0x5e9b3c[_0x2bfd('0x68')],_0x575c30[_0x2bfd('0x67')]);_0x5e9b3c[_0x2bfd('0x42')]=_0x1766da['Imap'];_0x5e9b3c[_0x2bfd('0x43')]=_0x1766da[_0x2bfd('0x43')];return db[_0x2bfd('0x49')][_0x2bfd('0x6e')](_0x5e9b3c,{'include':[{'model':db['MailServerOut'],'as':_0x2bfd('0x43')},{'model':db['MailServerIn'],'as':_0x2bfd('0x42')}]})['then'](function(_0x1fb892){var _0x16f2d2=_0x575c30[_0x2bfd('0x37')][_0x2bfd('0x27')]({'plain':!![]});if(!_0x16f2d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16f2d2[_0x2bfd('0x7c')]===_0x2bfd('0x37')){var _0x558063=_0x1fb892[_0x2bfd('0x27')]({'plain':!![]});return db[_0x2bfd('0x7d')]['find']({'where':{'name':_0x2bfd('0x28'),'userProfileId':_0x16f2d2[_0x2bfd('0x7e')]},'raw':!![]})[_0x2bfd('0x25')](function(_0x34fbdf){if(_0x34fbdf&&_0x34fbdf[_0x2bfd('0x7f')]===0x0){return db[_0x2bfd('0x29')][_0x2bfd('0x6e')]({'name':_0x558063[_0x2bfd('0x2b')],'resourceId':_0x558063['id'],'type':_0x34fbdf[_0x2bfd('0x2b')],'sectionId':_0x34fbdf['id']},{})[_0x2bfd('0x25')](function(){return _0x1fb892;});}else{return _0x1fb892;}})[_0x2bfd('0x1b')](function(_0x3c5e7a){logger[_0x2bfd('0x18')](_0x2bfd('0x80'),_0x3c5e7a);throw _0x3c5e7a;});}return _0x1fb892;})[_0x2bfd('0x25')](respondWithResult(_0x17a205,0xc9))['catch'](handleError(_0x17a205,null));};exports[_0x2bfd('0x81')]=function(_0x2a6bb9,_0x546282){return db[_0x2bfd('0x49')][_0x2bfd('0x70')]({'where':{'id':_0x2a6bb9[_0x2bfd('0x62')]['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x546282,null))[_0x2bfd('0x25')](function(_0x179f66){if(_0x179f66){return _0x179f66[_0x2bfd('0x81')]();}return null;})['then'](respondWithResult(_0x546282,null))[_0x2bfd('0x1b')](handleError(_0x546282,null));};exports[_0x2bfd('0x82')]=function(_0x51d3ec,_0x6b40f9){if(_0x51d3ec[_0x2bfd('0x67')]['id']){delete _0x51d3ec[_0x2bfd('0x67')]['id'];}return db['MailAccount'][_0x2bfd('0x66')]({'where':{'id':_0x51d3ec['params']['id']}})['then'](handleEntityNotFound(_0x6b40f9,null))[_0x2bfd('0x25')](function(_0x159820){if(_0x159820){_0x51d3ec['body']['MailAccountId']=_0x159820['id'];return db[_0x2bfd('0x45')][_0x2bfd('0x6e')](_0x51d3ec[_0x2bfd('0x67')]);}})[_0x2bfd('0x25')](respondWithResult(_0x6b40f9,null))['catch'](handleError(_0x6b40f9,null));};exports['removeImap']=function(_0x57c7de,_0x4aeec9){return db[_0x2bfd('0x49')][_0x2bfd('0x70')]({'where':{'id':_0x57c7de[_0x2bfd('0x62')]['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x4aeec9,null))[_0x2bfd('0x25')](function(_0x191847){if(_0x191847){return _0x191847[_0x2bfd('0x83')](null);}return null;})[_0x2bfd('0x25')](respondWithStatusCode(_0x4aeec9,null))[_0x2bfd('0x1b')](handleError(_0x4aeec9,null));};exports[_0x2bfd('0x84')]=function(_0x5be898,_0x57c6c9){return db[_0x2bfd('0x49')][_0x2bfd('0x70')]({'where':{'id':_0x5be898[_0x2bfd('0x62')]['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x57c6c9,null))[_0x2bfd('0x25')](function(_0x3d1d18){if(_0x3d1d18){return _0x3d1d18[_0x2bfd('0x84')]();}return null;})[_0x2bfd('0x25')](respondWithResult(_0x57c6c9,null))['catch'](handleError(_0x57c6c9,null));};exports['addSmtp']=function(_0x147e04,_0x586acc){if(_0x147e04[_0x2bfd('0x67')]['id']){delete _0x147e04[_0x2bfd('0x67')]['id'];}return db[_0x2bfd('0x49')][_0x2bfd('0x66')]({'where':{'id':_0x147e04[_0x2bfd('0x62')]['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x586acc,null))[_0x2bfd('0x25')](function(_0x555018){if(_0x555018){_0x147e04['body'][_0x2bfd('0x71')]=_0x555018['id'];return db[_0x2bfd('0x46')][_0x2bfd('0x6e')](_0x147e04['body']);}})[_0x2bfd('0x25')](respondWithResult(_0x586acc,null))[_0x2bfd('0x1b')](handleError(_0x586acc,null));};exports[_0x2bfd('0x85')]=function(_0x540024,_0xb5f295){return db['MailAccount']['findOne']({'where':{'id':_0x540024[_0x2bfd('0x62')]['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0xb5f295,null))[_0x2bfd('0x25')](function(_0x1106d5){if(_0x1106d5){return _0x1106d5[_0x2bfd('0x86')](null);}return null;})[_0x2bfd('0x25')](respondWithStatusCode(_0xb5f295,null))['catch'](handleError(_0xb5f295,null));};exports['addInteraction']=function(_0x4c258d,_0x8dc28){return db[_0x2bfd('0x87')][_0x2bfd('0x66')]({'where':{'id':_0x4c258d[_0x2bfd('0x62')]['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x8dc28,null))[_0x2bfd('0x25')](function(_0x568852){if(_0x568852){return _0x568852['addInteraction'](_0x4c258d['body'][_0x2bfd('0x73')],_[_0x2bfd('0x88')](_0x4c258d['body'],['ids','id'])||{});}})[_0x2bfd('0x25')](respondWithResult(_0x8dc28,null))[_0x2bfd('0x1b')](handleError(_0x8dc28,null));};exports['getInteractions']=function(_0x2c37b4,_0x647a6c){var _0x21ac6d={'raw':![],'where':{}};var _0x557c3e={};var _0x2a07d0={'count':0x0,'rows':[]};return db[_0x2bfd('0x49')]['findOne']({'where':{'id':_0x2c37b4['params']['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x647a6c,null))[_0x2bfd('0x25')](function(_0x526036){if(_0x526036){_0x557c3e[_0x2bfd('0x4d')]=_[_0x2bfd('0x4e')](db[_0x2bfd('0x87')][_0x2bfd('0x4a')]);_0x557c3e[_0x2bfd('0x4f')]=_[_0x2bfd('0x4e')](_0x2c37b4[_0x2bfd('0x4f')]);_0x557c3e[_0x2bfd('0x50')]=_['intersection'](_0x557c3e[_0x2bfd('0x4d')],_0x557c3e[_0x2bfd('0x4f')]);_0x21ac6d[_0x2bfd('0x52')]=_[_0x2bfd('0x51')](_0x557c3e[_0x2bfd('0x4d')],qs[_0x2bfd('0x53')](_0x2c37b4['query'][_0x2bfd('0x53')]));_0x21ac6d['attributes']=_0x21ac6d['attributes'][_0x2bfd('0x54')]?_0x21ac6d[_0x2bfd('0x52')]:_0x557c3e[_0x2bfd('0x4d')];if(!_0x2c37b4[_0x2bfd('0x4f')][_0x2bfd('0x55')]('nolimit')){_0x21ac6d[_0x2bfd('0x22')]=qs[_0x2bfd('0x22')](_0x2c37b4[_0x2bfd('0x4f')][_0x2bfd('0x22')]);_0x21ac6d[_0x2bfd('0x20')]=qs['offset'](_0x2c37b4[_0x2bfd('0x4f')][_0x2bfd('0x20')]);}_0x21ac6d[_0x2bfd('0x57')]=qs[_0x2bfd('0x58')](_0x2c37b4['query']['sort']);_0x21ac6d[_0x2bfd('0x5b')]=qs[_0x2bfd('0x50')](_[_0x2bfd('0x59')](_0x2c37b4[_0x2bfd('0x4f')],_0x557c3e[_0x2bfd('0x50')]));_0x21ac6d[_0x2bfd('0x5b')][_0x2bfd('0x71')]=_0x526036['id'];if(_0x2c37b4[_0x2bfd('0x4f')][_0x2bfd('0x5a')]){_0x21ac6d[_0x2bfd('0x5b')]=_[_0x2bfd('0x5c')](_0x21ac6d[_0x2bfd('0x5b')],{'$or':_[_0x2bfd('0x48')](_0x21ac6d[_0x2bfd('0x52')],function(_0x42e81a){var _0x7adb44={};_0x7adb44[_0x42e81a]={'$like':'%'+_0x2c37b4[_0x2bfd('0x4f')][_0x2bfd('0x5a')]+'%'};return _0x7adb44;})});}_0x21ac6d=_[_0x2bfd('0x5c')]({},_0x21ac6d,_0x2c37b4['options']);return db['MailInteraction'][_0x2bfd('0x23')]({'where':_0x21ac6d[_0x2bfd('0x5b')]})[_0x2bfd('0x25')](function(_0x332df3){_0x2a07d0[_0x2bfd('0x23')]=_0x332df3;if(_0x2c37b4['query'][_0x2bfd('0x64')]){_0x21ac6d['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x2bfd('0x89')],'as':_0x2bfd('0x8a'),'attributes':[_0x2bfd('0x2b'),'fullname',_0x2bfd('0x8b')],'required':![]},{'model':db['Tag'],'as':_0x2bfd('0x8c'),'attributes':['id',_0x2bfd('0x2b'),_0x2bfd('0x8d')],'where':_0x2c37b4[_0x2bfd('0x4f')][_0x2bfd('0x8e')]?{'id':_0x2c37b4[_0x2bfd('0x4f')][_0x2bfd('0x8e')]}:undefined,'required':_0x2c37b4['query'][_0x2bfd('0x8e')]?!![]:![]}];}return db[_0x2bfd('0x87')][_0x2bfd('0x5f')](_0x21ac6d);})[_0x2bfd('0x25')](function(_0x3e713f){_0x2a07d0[_0x2bfd('0x60')]=_0x3e713f;return _0x2a07d0;});}})[_0x2bfd('0x25')](respondWithFilteredResult(_0x647a6c,_0x21ac6d))[_0x2bfd('0x1b')](handleError(_0x647a6c,null));};exports[_0x2bfd('0x8f')]=function addApplications(_0x1f6bfb,_0x4c8ba7){var _0x2df316=_0x1f6bfb['params']['id'];var _0x4b9ee0=_0x1f6bfb[_0x2bfd('0x67')];var _0x476769=0xc8;var _0x16c796=null;return db[_0x2bfd('0x90')][_0x2bfd('0x91')]({'isolationLevel':db['sequelize'][_0x2bfd('0x92')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x2424be){return db[_0x2bfd('0x49')][_0x2bfd('0x70')]({'where':{'id':_0x2df316},'transaction':_0x2424be})['then'](function(_0x4f8622){if(_0x4f8622){return db[_0x2bfd('0x93')][_0x2bfd('0x26')]({'where':{'MailAccountId':_0x2df316},'transaction':_0x2424be})['then'](function(){var _0x4eec3f=_['map'](_0x4b9ee0,function(_0x11fb8a){_0x11fb8a[_0x2bfd('0x71')]=_0x2df316;return _0x11fb8a;});return db[_0x2bfd('0x93')][_0x2bfd('0x94')](_0x4eec3f,{'transaction':_0x2424be});});}else{_0x476769=0x194;_0x16c796=[];}});})[_0x2bfd('0x25')](function(){if(_0x476769!==0x194){return db['MailApplication'][_0x2bfd('0x95')]({'where':{'MailAccountId':_0x2df316},'order':'priority'})[_0x2bfd('0x25')](function(_0x48ef46){_0x16c796=_0x48ef46;});}})[_0x2bfd('0x1b')](function(_0x165537){_0x476769=0x1f4;logger[_0x2bfd('0x18')](_0x165537[_0x2bfd('0x2a')]);if(_0x165537[_0x2bfd('0x2b')]){delete _0x165537['name'];}_0x16c796=_0x165537;})[_0x2bfd('0x96')](function(){if(_0x16c796===null){_0x4c8ba7[_0x2bfd('0x1c')](_0x476769);}else{if(_0x476769===0x1f4){_0x4c8ba7[_0x2bfd('0x1d')](_0x476769)['send'](_0x16c796);}else{_0x4c8ba7[_0x2bfd('0x1d')](_0x476769)[_0x2bfd('0x1f')](_0x16c796);}}});};exports[_0x2bfd('0x97')]=function(_0x47ba20,_0x351180){var _0x339ae4={};var _0x30bb1d={};var _0x48d350;var _0x4401f2;return db[_0x2bfd('0x49')][_0x2bfd('0x70')]({'where':{'id':_0x47ba20[_0x2bfd('0x62')]['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x351180,null))['then'](function(_0x23d6d7){if(_0x23d6d7){_0x48d350=_0x23d6d7;_0x30bb1d['model']=_['keys'](db['MailApplication'][_0x2bfd('0x4a')]);_0x30bb1d[_0x2bfd('0x4f')]=_['keys'](_0x47ba20[_0x2bfd('0x4f')]);_0x30bb1d[_0x2bfd('0x50')]=_[_0x2bfd('0x51')](_0x30bb1d['model'],_0x30bb1d['query']);_0x339ae4[_0x2bfd('0x52')]=_['intersection'](_0x30bb1d[_0x2bfd('0x4d')],qs[_0x2bfd('0x53')](_0x47ba20[_0x2bfd('0x4f')][_0x2bfd('0x53')]));_0x339ae4[_0x2bfd('0x52')]=_0x339ae4[_0x2bfd('0x52')]['length']?_0x339ae4[_0x2bfd('0x52')]:_0x30bb1d[_0x2bfd('0x4d')];_0x339ae4['order']=qs[_0x2bfd('0x58')](_0x47ba20[_0x2bfd('0x4f')][_0x2bfd('0x58')]);_0x339ae4[_0x2bfd('0x5b')]=qs[_0x2bfd('0x50')](_[_0x2bfd('0x59')](_0x47ba20[_0x2bfd('0x4f')],_0x30bb1d[_0x2bfd('0x50')]));if(_0x47ba20['query']['filter']){_0x339ae4[_0x2bfd('0x5b')]=_[_0x2bfd('0x5c')](_0x339ae4['where'],{'$or':_[_0x2bfd('0x48')](_0x339ae4[_0x2bfd('0x52')],function(_0x243c69){var _0x3a9d0b={};_0x3a9d0b[_0x243c69]={'$like':'%'+_0x47ba20[_0x2bfd('0x4f')]['filter']+'%'};return _0x3a9d0b;})});}_0x339ae4=_[_0x2bfd('0x5c')]({},_0x339ae4,_0x47ba20['options']);return _0x48d350[_0x2bfd('0x97')](_0x339ae4);}})['then'](function(_0x52aa19){if(_0x52aa19){_0x4401f2=_0x52aa19['length'];if(!_0x47ba20['query']['hasOwnProperty'](_0x2bfd('0x56'))){_0x339ae4[_0x2bfd('0x22')]=qs[_0x2bfd('0x22')](_0x47ba20[_0x2bfd('0x4f')][_0x2bfd('0x22')]);_0x339ae4[_0x2bfd('0x20')]=qs['offset'](_0x47ba20[_0x2bfd('0x4f')]['offset']);}return _0x48d350[_0x2bfd('0x97')](_0x339ae4);}})[_0x2bfd('0x25')](function(_0x979c9d){if(_0x979c9d){return _0x979c9d?{'count':_0x4401f2,'rows':_0x979c9d}:null;}})[_0x2bfd('0x25')](respondWithResult(_0x351180,null))[_0x2bfd('0x1b')](handleError(_0x351180,null));};exports[_0x2bfd('0x98')]=function(_0x36d650,_0x351bec){var _0xf4bbed={'raw':!![],'where':{}};var _0x122dd5={};var _0xd628e1={'count':0x0,'rows':[]};return db['MailAccount'][_0x2bfd('0x70')]({'where':{'id':_0x36d650[_0x2bfd('0x62')]['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x351bec,null))[_0x2bfd('0x25')](function(_0x4af571){if(_0x4af571){_0x122dd5[_0x2bfd('0x4d')]=_[_0x2bfd('0x4e')](db[_0x2bfd('0x99')][_0x2bfd('0x4a')]);_0x122dd5['query']=_[_0x2bfd('0x4e')](_0x36d650[_0x2bfd('0x4f')]);_0x122dd5['filters']=_[_0x2bfd('0x51')](_0x122dd5[_0x2bfd('0x4d')],_0x122dd5['query']);_0xf4bbed[_0x2bfd('0x52')]=_[_0x2bfd('0x51')](_0x122dd5[_0x2bfd('0x4d')],qs[_0x2bfd('0x53')](_0x36d650[_0x2bfd('0x4f')][_0x2bfd('0x53')]));_0xf4bbed['attributes']=_0xf4bbed['attributes'][_0x2bfd('0x54')]?_0xf4bbed[_0x2bfd('0x52')]:_0x122dd5['model'];if(!_0x36d650[_0x2bfd('0x4f')][_0x2bfd('0x55')](_0x2bfd('0x56'))){_0xf4bbed[_0x2bfd('0x22')]=qs[_0x2bfd('0x22')](_0x36d650[_0x2bfd('0x4f')][_0x2bfd('0x22')]);_0xf4bbed[_0x2bfd('0x20')]=qs[_0x2bfd('0x20')](_0x36d650[_0x2bfd('0x4f')][_0x2bfd('0x20')]);}_0xf4bbed['order']=qs[_0x2bfd('0x58')](_0x36d650[_0x2bfd('0x4f')][_0x2bfd('0x58')]);_0xf4bbed[_0x2bfd('0x5b')]=qs[_0x2bfd('0x50')](_[_0x2bfd('0x59')](_0x36d650[_0x2bfd('0x4f')],_0x122dd5['filters']));_0xf4bbed['where'][_0x2bfd('0x71')]=_0x4af571['id'];if(_0x36d650[_0x2bfd('0x4f')][_0x2bfd('0x5a')]){_0xf4bbed[_0x2bfd('0x5b')]=_[_0x2bfd('0x5c')](_0xf4bbed[_0x2bfd('0x5b')],{'$or':_[_0x2bfd('0x48')](_0xf4bbed[_0x2bfd('0x52')],function(_0x55792d){var _0x1524ca={};_0x1524ca[_0x55792d]={'$like':'%'+_0x36d650[_0x2bfd('0x4f')][_0x2bfd('0x5a')]+'%'};return _0x1524ca;})});}if(_0x36d650[_0x2bfd('0x4f')][_0x2bfd('0x9a')]){var _0x228750=_0x36d650[_0x2bfd('0x4f')][_0x2bfd('0x9a')][_0x2bfd('0x9b')](',');var _0x448a2e={};_0x448a2e[_0x228750[0x0]]={'$gte':moment(_0x228750[0x1])[_0x2bfd('0x9c')](_0x2bfd('0x9d'))};_0xf4bbed[_0x2bfd('0x5b')]=_['merge'](_0xf4bbed[_0x2bfd('0x5b')],_0x448a2e);}_0xf4bbed=_[_0x2bfd('0x5c')]({},_0xf4bbed,_0x36d650[_0x2bfd('0x65')]);return db[_0x2bfd('0x99')][_0x2bfd('0x23')]({'where':_0xf4bbed[_0x2bfd('0x5b')]})[_0x2bfd('0x25')](function(_0x57ac71){_0xd628e1['count']=_0x57ac71;if(_0x36d650['query']['includeAll']){_0xf4bbed[_0x2bfd('0x5e')]=[{'all':!![]}];}return db[_0x2bfd('0x99')]['findAll'](_0xf4bbed);})[_0x2bfd('0x25')](function(_0x4739c5){if(_0x36d650[_0x2bfd('0x4f')][_0x2bfd('0x9e')]===_0x2bfd('0x9f')){for(var _0x2f2b0b=0x0;_0x2f2b0b<_0x4739c5[_0x2bfd('0x54')];_0x2f2b0b++){_0x4739c5[_0x2f2b0b][_0x2bfd('0x67')]=juice(_0x4739c5[_0x2f2b0b][_0x2bfd('0x67')]);}}_0xd628e1[_0x2bfd('0x60')]=_0x4739c5;return _0xd628e1;});}})[_0x2bfd('0x25')](respondWithFilteredResult(_0x351bec,_0xf4bbed))[_0x2bfd('0x1b')](handleError(_0x351bec,null));};exports['send']=function(_0x212f35,_0x5df99f){var _0x4f2a1e,_0x3d83d8={},_0x1514e1;if(_0x212f35[_0x2bfd('0x67')]['to']){_0x1514e1=_0x212f35[_0x2bfd('0x67')]['to'][_0x2bfd('0x9b')](',')[0x0];}return db['MailAccount'][_0x2bfd('0x66')]({'where':{'id':_0x212f35[_0x2bfd('0x62')]['id']},'include':[{'model':db[_0x2bfd('0xa0')],'as':_0x2bfd('0xa1'),'include':[{'model':db[_0x2bfd('0xa2')],'as':_0x2bfd('0xa3'),'where':{'email':_0x1514e1},'limit':0x1,'order':[[_0x2bfd('0xa4'),'DESC']]}]},{'model':db[_0x2bfd('0x46')],'as':_0x2bfd('0x43'),'raw':!![],'include':[{'model':db[_0x2bfd('0xa5')],'as':'CloudProvider','raw':!![]}]}]})[_0x2bfd('0x25')](handleEntityNotFound(_0x5df99f,null))[_0x2bfd('0x25')](function(_0x11b650){if(!_0x11b650)return;_0x4f2a1e=_0x11b650;if(!_0x11b650['Smtp'])throw new Error(_0x2bfd('0xa6'));if(_['isNil'](_0x212f35[_0x2bfd('0x67')][_0x2bfd('0xa7')])){_0x212f35[_0x2bfd('0x67')]['from']=util['format'](_0x2bfd('0xa8'),_0x11b650[_0x2bfd('0x2b')],_0x11b650['email']||_0x11b650[_0x2bfd('0x43')][_0x2bfd('0x37')]);}if(_0x212f35[_0x2bfd('0x67')][_0x2bfd('0xa9')]&&_0x212f35[_0x2bfd('0x67')][_0x2bfd('0xa9')][_0x2bfd('0x54')]){for(var _0x1f21e7=0x0;_0x1f21e7<_0x212f35[_0x2bfd('0x67')][_0x2bfd('0xa9')][_0x2bfd('0x54')];_0x1f21e7+=0x1){_0x212f35[_0x2bfd('0x67')]['attachments'][_0x1f21e7]={'filename':_0x212f35[_0x2bfd('0x67')][_0x2bfd('0xa9')][_0x1f21e7][_0x2bfd('0x2b')],'path':path[_0x2bfd('0xaa')](config[_0x2bfd('0xab')],_0x2bfd('0xac'),_0x212f35['body'][_0x2bfd('0xa9')][_0x1f21e7][_0x2bfd('0xad')])};}}var _0x25425b=_0x11b650[_0x2bfd('0xae')]();return respondWithRpcPromise(_0x2bfd('0xaf'),'sendMail',{'account':_0x25425b,'message':_0x212f35[_0x2bfd('0x67')]});})[_0x2bfd('0x25')](function(_0x3308c1){if(!_0x3308c1)return;_0x3d83d8=_0x3308c1;if(!_0x4f2a1e[_0x2bfd('0xa1')])throw new Error(_0x2bfd('0xb0'));if(_0x4f2a1e[_0x2bfd('0xa1')]['Contacts'][_0x2bfd('0x54')])return _0x4f2a1e['List'][_0x2bfd('0xa3')][0x0];return db[_0x2bfd('0xa2')][_0x2bfd('0x6e')](_[_0x2bfd('0xb')](_0x212f35[_0x2bfd('0x67')],{'firstName':_0x212f35[_0x2bfd('0x67')]['to'],'email':_0x212f35[_0x2bfd('0x67')]['to'],'phone':_0x212f35[_0x2bfd('0x67')]['to'],'ListId':_0x4f2a1e['ListId']}));})[_0x2bfd('0x25')](function(_0x52ac5a){if(!_0x52ac5a)return;var _0x456f39={'UserId':_0x212f35[_0x2bfd('0x37')]['id'],'ContactId':_0x52ac5a['id'],'MailAccountId':_0x4f2a1e['id'],'inReplyTo':_0x3d83d8['messageId'],'to':_0x212f35[_0x2bfd('0x67')][_0x2bfd('0xa7')],'cc':_0x212f35[_0x2bfd('0x67')]['cc'],'subject':_0x212f35[_0x2bfd('0x67')][_0x2bfd('0xb1')],'attach':_0x212f35[_0x2bfd('0x67')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x2bfd('0x9c')](_0x2bfd('0x9d')),'lastMsgDirection':'out','Messages':[_[_0x2bfd('0x5c')](_0x212f35['body'],{'messageId':_0x3d83d8[_0x2bfd('0xb2')],'sentAt':moment()[_0x2bfd('0x9c')](_0x2bfd('0x9d')),'read':!![],'MailAccountId':_0x4f2a1e['id'],'UserId':_0x212f35[_0x2bfd('0x37')]['id'],'ContactId':_0x52ac5a['id']})]};if(_0x212f35[_0x2bfd('0x67')][_0x2bfd('0xb3')]){_0x456f39=_['merge'](_0x456f39,_0x212f35[_0x2bfd('0x67')]['Interaction']);}return db[_0x2bfd('0x87')][_0x2bfd('0x6e')](_0x456f39,{'include':[{'model':db[_0x2bfd('0x99')],'as':_0x2bfd('0xb4')}]});})[_0x2bfd('0x25')](respondWithResult(_0x5df99f,null))[_0x2bfd('0x1b')](handleError(_0x5df99f,null));};exports[_0x2bfd('0xb5')]=function(_0x2d34ee,_0x46e582){return db['MailAccount'][_0x2bfd('0x66')]({'where':{'id':_0x2d34ee[_0x2bfd('0x62')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x2bfd('0x43'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x2bfd('0xa5'),'raw':!![]}]}]})[_0x2bfd('0x25')](handleEntityNotFound(_0x46e582,null))[_0x2bfd('0x25')](function(_0x4e217a){if(!_0x4e217a[_0x2bfd('0x43')])return;var _0x31da87=_0x4e217a['getSmtpOptions']();return respondWithRpcPromise(_0x2bfd('0xb6'),'verifySmtp',{'account':_0x31da87});})[_0x2bfd('0x25')](respondWithResult(_0x46e582,null))[_0x2bfd('0x1b')](handleError(_0x46e582,null));};exports['destroy']=function(_0x3d3b51,_0x47c180){return db[_0x2bfd('0x49')][_0x2bfd('0x66')]({'where':{'id':_0x3d3b51['params']['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x47c180,null))['then'](function(_0x57fbd9){if(_0x57fbd9&&_0x57fbd9[_0x2bfd('0x40')]){throw new db[(_0x2bfd('0xb7'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x57fbd9;})[_0x2bfd('0x25')](removeEntity(_0x47c180,null))[_0x2bfd('0x1b')](handleError(_0x47c180,null));};exports[_0x2bfd('0xb8')]=function(_0x597fe8,_0xd0574b){return db[_0x2bfd('0x49')][_0x2bfd('0x66')]({'where':{'id':_0x597fe8[_0x2bfd('0x62')]['id']}})['then'](handleEntityNotFound(_0xd0574b,null))[_0x2bfd('0x25')](function(_0x268425){if(_0x268425){return _0x268425['addAgents'](_0x597fe8[_0x2bfd('0x67')][_0x2bfd('0x73')],_[_0x2bfd('0x88')](_0x597fe8[_0x2bfd('0x67')],[_0x2bfd('0x73'),'id'])||{})[_0x2bfd('0xb9')](function(_0x4e25b5){for(var _0x5a50e0=0x0;_0x5a50e0<_0x597fe8['body']['ids']['length'];_0x5a50e0+=0x1){socket[_0x2bfd('0xba')](_0x2bfd('0xbb'),{'UserId':Number(_0x597fe8[_0x2bfd('0x67')][_0x2bfd('0x73')][_0x5a50e0]),'MailAccountId':Number(_0x597fe8[_0x2bfd('0x62')]['id'])});}return _0x4e25b5;});}})[_0x2bfd('0x25')](respondWithResult(_0xd0574b,null))[_0x2bfd('0x1b')](handleError(_0xd0574b,null));};exports[_0x2bfd('0xbc')]=function(_0x527241,_0x12e46c){return db['MailAccount']['find']({'where':{'id':_0x527241[_0x2bfd('0x62')]['id']}})[_0x2bfd('0x25')](handleEntityNotFound(_0x12e46c,null))['then'](function(_0x184f8f){if(_0x184f8f){return _0x184f8f[_0x2bfd('0xbc')](_0x527241[_0x2bfd('0x4f')][_0x2bfd('0x73')])[_0x2bfd('0x25')](function(){if(_['isArray'](_0x527241['query'][_0x2bfd('0x73')])){for(var _0x45d792=0x0;_0x45d792<_0x527241[_0x2bfd('0x4f')][_0x2bfd('0x73')][_0x2bfd('0x54')];_0x45d792+=0x1){socket[_0x2bfd('0xba')]('userMailAccount:remove',{'UserId':Number(_0x527241[_0x2bfd('0x4f')][_0x2bfd('0x73')][_0x45d792]),'MailAccountId':Number(_0x527241[_0x2bfd('0x62')]['id'])});}}else{socket[_0x2bfd('0xba')](_0x2bfd('0xbd'),{'UserId':Number(_0x527241[_0x2bfd('0x4f')][_0x2bfd('0x73')]),'MailAccountId':Number(_0x527241['params']['id'])});}});}})[_0x2bfd('0x25')](respondWithStatusCode(_0x12e46c,null))[_0x2bfd('0x1b')](handleError(_0x12e46c,null));};exports['getAgents']=function(_0x21e4ac,_0x2e3b06){var _0x7f977b={};var _0x2910dd={};var _0xbf8e68;var _0x119f76;return db[_0x2bfd('0x49')]['findOne']({'where':{'id':_0x21e4ac['params']['id']}})['then'](handleEntityNotFound(_0x2e3b06,null))[_0x2bfd('0x25')](function(_0x45baf7){if(_0x45baf7){_0xbf8e68=_0x45baf7;_0x2910dd['model']=_[_0x2bfd('0x4e')](db['User'][_0x2bfd('0x4a')]);_0x2910dd[_0x2bfd('0x4f')]=_[_0x2bfd('0x4e')](_0x21e4ac[_0x2bfd('0x4f')]);_0x2910dd[_0x2bfd('0x50')]=_[_0x2bfd('0x51')](_0x2910dd['model'],_0x2910dd[_0x2bfd('0x4f')]);_0x7f977b['attributes']=_['intersection'](_0x2910dd[_0x2bfd('0x4d')],qs[_0x2bfd('0x53')](_0x21e4ac[_0x2bfd('0x4f')][_0x2bfd('0x53')]));_0x7f977b[_0x2bfd('0x52')]=_0x7f977b[_0x2bfd('0x52')]['length']?_0x7f977b[_0x2bfd('0x52')]:_0x2910dd['model'];_0x7f977b['order']=qs[_0x2bfd('0x58')](_0x21e4ac['query'][_0x2bfd('0x58')]);_0x7f977b[_0x2bfd('0x5b')]=qs[_0x2bfd('0x50')](_[_0x2bfd('0x59')](_0x21e4ac['query'],_0x2910dd[_0x2bfd('0x50')]));if(_0x21e4ac[_0x2bfd('0x4f')][_0x2bfd('0x5a')]){_0x7f977b['where']=_['merge'](_0x7f977b[_0x2bfd('0x5b')],{'$or':_[_0x2bfd('0x48')](_0x7f977b[_0x2bfd('0x52')],function(_0xae31d6){var _0x9bd23c={};_0x9bd23c[_0xae31d6]={'$like':'%'+_0x21e4ac[_0x2bfd('0x4f')]['filter']+'%'};return _0x9bd23c;})});}_0x7f977b=_[_0x2bfd('0x5c')]({},_0x7f977b,_0x21e4ac[_0x2bfd('0x65')]);return _0xbf8e68[_0x2bfd('0xbe')](_0x7f977b);}})['then'](function(_0x123482){if(_0x123482){_0x119f76=_0x123482[_0x2bfd('0x54')];if(!_0x21e4ac[_0x2bfd('0x4f')][_0x2bfd('0x55')](_0x2bfd('0x56'))){_0x7f977b[_0x2bfd('0x22')]=qs[_0x2bfd('0x22')](_0x21e4ac[_0x2bfd('0x4f')][_0x2bfd('0x22')]);_0x7f977b['offset']=qs[_0x2bfd('0x20')](_0x21e4ac[_0x2bfd('0x4f')][_0x2bfd('0x20')]);}return _0xbf8e68[_0x2bfd('0xbe')](_0x7f977b);}})[_0x2bfd('0x25')](function(_0x21f4af){if(_0x21f4af){return _0x21f4af?{'count':_0x119f76,'rows':_0x21f4af}:null;}})[_0x2bfd('0x25')](respondWithResult(_0x2e3b06,null))[_0x2bfd('0x1b')](handleError(_0x2e3b06,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 9d2132e..a325e0b 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 _0x727a=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x5a8547,_0x39e81b){var _0x25b106=function(_0x2651b3){while(--_0x2651b3){_0x5a8547['push'](_0x5a8547['shift']());}};_0x25b106(++_0x39e81b);}(_0x727a,0x95));var _0xa727=function(_0x2304ca,_0xac6ef3){_0x2304ca=_0x2304ca-0x0;var _0xd6417f=_0x727a[_0x2304ca];return _0xd6417f;};'use strict';var EventEmitter=require(_0xa727('0x0'));var MailAccount=require(_0xa727('0x1'))['db'][_0xa727('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa727('0x3')](0x0);var events={'afterCreate':_0xa727('0x4'),'afterUpdate':_0xa727('0x5'),'afterDestroy':_0xa727('0x6')};function emitEvent(_0x57d9c0){return function(_0x21bcf9,_0x12465b,_0xcdb46c){MailAccountEvents[_0xa727('0x7')](_0x57d9c0+':'+_0x21bcf9['id'],_0x21bcf9);MailAccountEvents[_0xa727('0x7')](_0x57d9c0,_0x21bcf9);_0xcdb46c(null);};}for(var e in events){if(events[_0xa727('0x8')](e)){var event=events[e];MailAccount[_0xa727('0x9')](e,emitEvent(event));}}module[_0xa727('0xa')]=MailAccountEvents; \ No newline at end of file +var _0xeac1=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','../../mysqldb','MailAccount'];(function(_0xfe8617,_0x25baa9){var _0x3219a1=function(_0x1fa93e){while(--_0x1fa93e){_0xfe8617['push'](_0xfe8617['shift']());}};_0x3219a1(++_0x25baa9);}(_0xeac1,0x146));var _0x1eac=function(_0x52cfa9,_0x8f39d9){_0x52cfa9=_0x52cfa9-0x0;var _0x7406b5=_0xeac1[_0x52cfa9];return _0x7406b5;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x1eac('0x0'))['db'][_0x1eac('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1eac('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1eac('0x3'),'afterDestroy':'remove'};function emitEvent(_0x537541){return function(_0x1f9293,_0x28ec00,_0x12ef0e){MailAccountEvents[_0x1eac('0x4')](_0x537541+':'+_0x1f9293['id'],_0x1f9293);MailAccountEvents[_0x1eac('0x4')](_0x537541,_0x1f9293);_0x12ef0e(null);};}for(var e in events){if(events[_0x1eac('0x5')](e)){var event=events[e];MailAccount[_0x1eac('0x6')](e,emitEvent(event));}}module[_0x1eac('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 49943c7..49c7781 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 _0x01a5=['CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','exports','define','MailAccount','provider','custom','service','host','Smtp','port','secure','modernAuthentication'];(function(_0xa0e2a9,_0xa6f027){var _0x1c7896=function(_0x18f5a6){while(--_0x18f5a6){_0xa0e2a9['push'](_0xa0e2a9['shift']());}};_0x1c7896(++_0xa6f027);}(_0x01a5,0x17c));var _0x501a=function(_0x2539b7,_0x4f9f50){_0x2539b7=_0x2539b7-0x0;var _0x1a2456=_0x01a5[_0x2539b7];return _0x1a2456;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x501a('0x0')]=function(_0x5633b0){return _0x5633b0[_0x501a('0x1')](_0x501a('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x419681=this;var _0x32ded9={'id':_0x419681['id'],'tls':{'rejectUnauthorized':![]}};if(_0x419681[_0x501a('0x3')]!==_0x501a('0x4')){_0x32ded9[_0x501a('0x5')]=_0x419681[_0x501a('0x3')];}else{_0x32ded9[_0x501a('0x6')]=_0x419681[_0x501a('0x7')][_0x501a('0x6')];_0x32ded9[_0x501a('0x8')]=_0x419681[_0x501a('0x7')][_0x501a('0x8')];_0x32ded9[_0x501a('0x9')]=_0x419681[_0x501a('0x7')]['secure'];}if(_0x419681[_0x501a('0x7')]['authentication']){if(_0x419681[_0x501a('0x7')][_0x501a('0xa')]){if(!_0x419681[_0x501a('0x7')][_0x501a('0xb')])throw new Error(_0x501a('0xc'));_0x32ded9[_0x501a('0xd')]={'type':'OAuth2','user':_0x419681[_0x501a('0x7')][_0x501a('0xe')],'accessToken':_0x419681['Smtp']['CloudProvider'][_0x501a('0xf')]};}else{_0x32ded9[_0x501a('0xd')]={'user':_0x419681[_0x501a('0x7')][_0x501a('0xe')],'pass':_0x419681[_0x501a('0x7')][_0x501a('0x10')]};}}return _0x32ded9;}}});}; \ No newline at end of file +var _0x60c1=['data5','./mailAccount.attributes','define','mail_accounts','custom','service','provider','host','port','Smtp','secure','modernAuthentication','CloudProvider','auth','user'];(function(_0x5deb52,_0x3d267b){var _0x51b405=function(_0x2c145a){while(--_0x2c145a){_0x5deb52['push'](_0x5deb52['shift']());}};_0x51b405(++_0x3d267b);}(_0x60c1,0x13c));var _0x160c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x60c1[_0x59ee6f];return _0x4c0979;};'use strict';var attributes=require(_0x160c('0x0'));module['exports']=function(_0x135597){return _0x135597[_0x160c('0x1')]('MailAccount',attributes,{'tableName':_0x160c('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x49ab6d=this;var _0x2a7149={'id':_0x49ab6d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x49ab6d['provider']!==_0x160c('0x3')){_0x2a7149[_0x160c('0x4')]=_0x49ab6d[_0x160c('0x5')];}else{_0x2a7149[_0x160c('0x6')]=_0x49ab6d['Smtp'][_0x160c('0x6')];_0x2a7149[_0x160c('0x7')]=_0x49ab6d[_0x160c('0x8')]['port'];_0x2a7149[_0x160c('0x9')]=_0x49ab6d['Smtp'][_0x160c('0x9')];}if(_0x49ab6d[_0x160c('0x8')]['authentication']){if(_0x49ab6d[_0x160c('0x8')][_0x160c('0xa')]){if(!_0x49ab6d[_0x160c('0x8')][_0x160c('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x2a7149[_0x160c('0xc')]={'type':'OAuth2','user':_0x49ab6d[_0x160c('0x8')][_0x160c('0xd')],'accessToken':_0x49ab6d['Smtp']['CloudProvider'][_0x160c('0xe')]};}else{_0x2a7149[_0x160c('0xc')]={'user':_0x49ab6d[_0x160c('0x8')]['user'],'pass':_0x49ab6d['Smtp']['pass']};}}return _0x2a7149;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index b34c856..1d09798 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 _0x4300=['then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','options','raw','where','attributes','include','map','model','GetMailAccount','ShowMailAccount','MailAccount','smtp','setDataValue','smtpOptions','getSmtpOptions','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','find','MailMessage','Messages','spread','update','interaction','created','attachments','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','name','UserId','unshift','agent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./mailAccount.socket','register','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4300,0x1a6));var _0x0430=function(_0x2d7ad1,_0x228b2e){_0x2d7ad1=_0x2d7ad1-0x0;var _0x2a7214=_0x4300[_0x2d7ad1];return _0x2a7214;};'use strict';var _=require(_0x0430('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require('ioredis');var db=require(_0x0430('0x1'))['db'];var logger=require(_0x0430('0x2'))(_0x0430('0x3'));var config=require(_0x0430('0x4'));var jayson=require(_0x0430('0x5'));var client=jayson['client'][_0x0430('0x6')]({'port':0x232c});config['redis']=_[_0x0430('0x7')](config['redis'],{'host':_0x0430('0x8'),'port':0x18eb});var socket=require(_0x0430('0x9'))(new Redis(config[_0x0430('0xa')]));require(_0x0430('0xb'))[_0x0430('0xc')](socket);function respondWithRpcPromise(_0x108a08,_0x3a9dc1,_0x3af75c){return new BPromise(function(_0x26bd9d,_0x4972da){return client[_0x0430('0xd')](_0x108a08,_0x3af75c)[_0x0430('0xe')](function(_0x384324){logger[_0x0430('0xf')](_0x0430('0x10'),_0x3a9dc1,_0x0430('0x11'));logger[_0x0430('0x12')](_0x0430('0x13'),_0x3a9dc1,'request\x20sent',JSON['stringify'](_0x384324));if(_0x384324[_0x0430('0x14')]){if(_0x384324[_0x0430('0x14')][_0x0430('0x15')]===0x1f4){logger[_0x0430('0x14')](_0x0430('0x10'),_0x3a9dc1,_0x384324[_0x0430('0x14')][_0x0430('0x16')]);return _0x4972da(_0x384324['error'][_0x0430('0x16')]);}logger[_0x0430('0x14')](_0x0430('0x10'),_0x3a9dc1,_0x384324[_0x0430('0x14')]['message']);return _0x26bd9d(_0x384324['error']['message']);}else{logger[_0x0430('0xf')]('MailAccount,\x20%s,\x20%s',_0x3a9dc1,'request\x20sent');_0x26bd9d(_0x384324[_0x0430('0x17')][_0x0430('0x16')]);}})[_0x0430('0x18')](function(_0xd33c3c){logger[_0x0430('0x14')]('MailAccount,\x20%s,\x20%s',_0x3a9dc1,_0xd33c3c);_0x4972da(_0xd33c3c);});});}exports['GetMailAccount']=function(_0xf11cda){var _0x3de7ab=this;return new Promise(function(_0x35ffdb,_0x39fd58){return db['MailAccount']['findAll']({'raw':_0xf11cda[_0x0430('0x19')]?_0xf11cda[_0x0430('0x19')][_0x0430('0x1a')]===undefined?!![]:![]:!![],'where':_0xf11cda[_0x0430('0x19')]?_0xf11cda[_0x0430('0x19')][_0x0430('0x1b')]||null:null,'attributes':_0xf11cda['options']?_0xf11cda[_0x0430('0x19')][_0x0430('0x1c')]||null:null,'limit':_0xf11cda[_0x0430('0x19')]?_0xf11cda[_0x0430('0x19')]['limit']||null:null,'include':_0xf11cda[_0x0430('0x19')]?_0xf11cda[_0x0430('0x19')][_0x0430('0x1d')]?_[_0x0430('0x1e')](_0xf11cda[_0x0430('0x19')][_0x0430('0x1d')],function(_0x345b8c){return{'model':db[_0x345b8c[_0x0430('0x1f')]],'as':_0x345b8c['as'],'attributes':_0x345b8c[_0x0430('0x1c')],'include':_0x345b8c['include']?_[_0x0430('0x1e')](_0x345b8c['include'],function(_0x5a79d6){return{'model':db[_0x5a79d6[_0x0430('0x1f')]],'as':_0x5a79d6['as'],'attributes':_0x5a79d6[_0x0430('0x1c')],'include':_0x5a79d6['include']?_[_0x0430('0x1e')](_0x5a79d6[_0x0430('0x1d')],function(_0x3c0f13){return{'model':db[_0x3c0f13[_0x0430('0x1f')]],'as':_0x3c0f13['as'],'attributes':_0x3c0f13[_0x0430('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0430('0xe')](function(_0x1df9ec){logger[_0x0430('0xf')](_0x0430('0x20'),_0xf11cda);logger['debug']('GetMailAccount',_0xf11cda,JSON['stringify'](_0x1df9ec));_0x35ffdb(_0x1df9ec);})[_0x0430('0x18')](function(_0x47e1f3){logger[_0x0430('0x14')]('GetMailAccount',_0x47e1f3['message'],_0xf11cda);_0x39fd58(_0x3de7ab[_0x0430('0x14')](0x1f4,_0x47e1f3[_0x0430('0x16')]));});});};exports[_0x0430('0x21')]=function(_0x2be726){var _0x5c2310=this;return new Promise(function(_0x4b8311,_0x1b2b7c){return db[_0x0430('0x22')]['find']({'raw':_0x2be726['options']?_0x2be726[_0x0430('0x19')][_0x0430('0x1a')]===undefined?!![]:![]:!![],'where':_0x2be726[_0x0430('0x19')]?_0x2be726[_0x0430('0x19')][_0x0430('0x1b')]||null:null,'attributes':_0x2be726[_0x0430('0x19')]?_0x2be726[_0x0430('0x19')][_0x0430('0x1c')]||null:null,'include':_0x2be726[_0x0430('0x19')]?_0x2be726['options'][_0x0430('0x1d')]?_[_0x0430('0x1e')](_0x2be726[_0x0430('0x19')]['include'],function(_0x3bd146){return{'model':db[_0x3bd146['model']],'as':_0x3bd146['as'],'attributes':_0x3bd146[_0x0430('0x1c')],'include':_0x3bd146['include']?_['map'](_0x3bd146[_0x0430('0x1d')],function(_0x38e33b){return{'model':db[_0x38e33b[_0x0430('0x1f')]],'as':_0x38e33b['as'],'attributes':_0x38e33b[_0x0430('0x1c')],'include':_0x38e33b[_0x0430('0x1d')]?_[_0x0430('0x1e')](_0x38e33b['include'],function(_0x659aca){return{'model':db[_0x659aca[_0x0430('0x1f')]],'as':_0x659aca['as'],'attributes':_0x659aca[_0x0430('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0430('0xe')](function(_0x4224e4){if(_0x2be726[_0x0430('0x19')][_0x0430('0x23')]===!![])_0x4224e4[_0x0430('0x24')](_0x0430('0x25'),_0x4224e4[_0x0430('0x26')]());logger['info'](_0x0430('0x21'),_0x2be726);logger[_0x0430('0x12')](_0x0430('0x21'),_0x2be726,JSON[_0x0430('0x27')](_0x4224e4));_0x4b8311(_0x4224e4);})[_0x0430('0x18')](function(_0x29854f){logger['error'](_0x0430('0x21'),_0x29854f[_0x0430('0x16')],_0x2be726);_0x1b2b7c(_0x5c2310['error'](0x1f4,_0x29854f[_0x0430('0x16')]));});});};exports[_0x0430('0x28')]=function(_0x25ce76){var _0x2ef408=this;return new Promise(function(_0x2d6345,_0x8b32c2){var _0x390e38={'body':_0x25ce76[_0x0430('0x29')],'channel':_0x0430('0x2a')};var _0x59bb7b=_[_0x0430('0x2b')](_[_0x0430('0x2c')](db[_0x0430('0x2d')][_0x0430('0x2e')]),['createdAt',_0x0430('0x2f'),_0x0430('0x30'),_0x0430('0x31')]);var _0x435028=![];if(_0x25ce76[_0x0430('0x29')]['id']){delete _0x25ce76[_0x0430('0x29')]['id'];}if(_[_0x0430('0x32')](_0x25ce76[_0x0430('0x29')][_0x0430('0x33')])){return _0x8b32c2(_0x2ef408[_0x0430('0x14')](0x1f4,_0x0430('0x34')));}if(_['isNil'](_0x25ce76[_0x0430('0x29')]['body'])||_0x25ce76['body'][_0x0430('0x29')]===''){return _0x8b32c2(_0x2ef408['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0430('0x32')](_0x25ce76['body']['mapKey'])){return _0x8b32c2(_0x2ef408[_0x0430('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x59bb7b));}if(!_['includes'](_0x59bb7b,_0x25ce76[_0x0430('0x29')]['mapKey'])){return _0x8b32c2(_0x2ef408['error'](0x1f4,_0x0430('0x35')+_0x59bb7b));}var _0x175c07={};_0x175c07[_0x25ce76[_0x0430('0x29')]['mapKey']]=_0x25ce76[_0x0430('0x29')][_0x0430('0x33')];return db[_0x0430('0x22')]['find']({'where':{'id':_0x25ce76['account']['id']},'include':[{'model':db[_0x0430('0x36')],'as':_0x0430('0x37'),'include':[{'model':db[_0x0430('0x2d')],'as':_0x0430('0x38'),'where':_0x175c07,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailApplication'],'as':_0x0430('0x39')},{'model':db[_0x0430('0x3a')],'as':_0x0430('0x3b'),'include':[{'model':db[_0x0430('0x3c')],'as':_0x0430('0x3c')}]}]})[_0x0430('0xe')](function(_0x5c3184){if(_0x5c3184&&_0x5c3184['List']){var _0x29ed30=_0x5c3184[_0x0430('0x3d')]({'plain':!![]});_0x390e38[_0x0430('0x3e')]=_[_0x0430('0x3f')](_0x29ed30,[_0x0430('0x39'),_0x0430('0x37')]);_0x390e38[_0x0430('0x3e')][_0x0430('0x25')]=_0x5c3184[_0x0430('0x26')]();_0x390e38[_0x0430('0x40')]=_0x29ed30[_0x0430('0x39')];_0x390e38[_0x0430('0x41')]=_0x29ed30['List'];_0x390e38['applications']=_[_0x0430('0x42')](_0x390e38[_0x0430('0x40')],[_0x0430('0x43')],[_0x0430('0x44')]);if(_0x390e38[_0x0430('0x3e')]&&_0x390e38[_0x0430('0x3e')][_0x0430('0x45')]){_0x390e38[_0x0430('0x40')][_0x0430('0x46')]({'id':0x0,'priority':_0x390e38[_0x0430('0x40')][_0x0430('0x47')]+0x1,'app':_0x0430('0x48'),'appdata':_0x0430('0x45'),'interval':_0x0430('0x49')});}if(_0x390e38[_0x0430('0x3e')][_0x0430('0x39')]){delete _0x390e38[_0x0430('0x3e')][_0x0430('0x39')];}if(_0x390e38['account'][_0x0430('0x37')]){delete _0x390e38[_0x0430('0x3e')][_0x0430('0x37')];}if(_0x29ed30[_0x0430('0x37')][_0x0430('0x38')][_0x0430('0x47')]){return _0x29ed30[_0x0430('0x37')][_0x0430('0x38')][0x0];}var _0x3f282a=_['defaults'](_0x25ce76[_0x0430('0x29')],{'firstName':_0x25ce76[_0x0430('0x29')][_0x0430('0x33')],'ListId':_0x29ed30['ListId']});_0x3f282a[_0x25ce76[_0x0430('0x29')]['mapKey']]=_0x25ce76[_0x0430('0x29')][_0x0430('0x33')];return db[_0x0430('0x2d')][_0x0430('0x4a')](_0x3f282a);}else{throw new Error(_0x0430('0x4b'));}})[_0x0430('0xe')](function(_0x4d40c4){_0x390e38[_0x0430('0x4c')]=_0x4d40c4;if(_0x4d40c4){if(!_0x25ce76[_0x0430('0x29')][_0x0430('0x16')][_0x0430('0x4d')]){_0x25ce76[_0x0430('0x29')][_0x0430('0x16')][_0x0430('0x4d')]=rs[_0x0430('0x4e')]()+'\x20'+_0x25ce76[_0x0430('0x29')][_0x0430('0x16')][_0x0430('0x33')];}var _0x150718={'ContactId':_0x4d40c4['id'],'MailAccountId':_0x25ce76['account']['id'],'inReplyTo':_0x25ce76[_0x0430('0x29')][_0x0430('0x16')][_0x0430('0x4d')],'to':_0x25ce76[_0x0430('0x29')][_0x0430('0x16')][_0x0430('0x33')],'cc':_0x25ce76[_0x0430('0x29')][_0x0430('0x16')]['cc'],'subject':_0x25ce76[_0x0430('0x29')]['message'][_0x0430('0x4f')],'attach':_0x25ce76[_0x0430('0x29')][_0x0430('0x16')][_0x0430('0x50')],'lastMsgAt':moment()[_0x0430('0x51')](_0x0430('0x52')),'lastMsgDirection':'in'};return db[_0x0430('0x53')][_0x0430('0x54')]({'where':{'closed':![],'MailAccountId':_0x25ce76[_0x0430('0x3e')]['id']},'include':[{'model':db[_0x0430('0x55')],'as':_0x0430('0x56'),'attributes':[_0x0430('0x4d')],'where':{'messageId':_0x25ce76[_0x0430('0x29')][_0x0430('0x16')]['inReplyTo']}}]})[_0x0430('0xe')](function(_0x27a256){if(_0x27a256){return[_0x27a256,![]];}return db[_0x0430('0x53')][_0x0430('0x4a')](_0x150718)[_0x0430('0xe')](function(_0x5982cf){return[_0x5982cf,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x0430('0x57')](function(_0xdf733d,_0x37a8ca){if(_0xdf733d){_0x435028=_0x37a8ca;if(!_0x37a8ca){return _0xdf733d[_0x0430('0x58')]({'inReplyTo':_0x25ce76[_0x0430('0x29')]['message'][_0x0430('0x4d')],'to':_0x25ce76[_0x0430('0x29')]['message'][_0x0430('0x33')],'cc':_0x25ce76[_0x0430('0x29')][_0x0430('0x16')]['cc'],'subject':_0x25ce76['body'][_0x0430('0x16')][_0x0430('0x4f')],'attach':_0xdf733d[_0x0430('0x50')]?_0xdf733d[_0x0430('0x50')]:_0x25ce76[_0x0430('0x29')][_0x0430('0x16')][_0x0430('0x50')],'substatus':null,'substatusAt':moment()[_0x0430('0x51')](_0x0430('0x52')),'lastMsgAt':moment()[_0x0430('0x51')](_0x0430('0x52')),'lastMsgDirection':'in'});}else{return _0xdf733d;}}})['then'](function(_0xc2546e){_0x390e38[_0x0430('0x59')]=_0xc2546e[_0x0430('0x3d')]({'plain':!![]});_0x390e38['interaction'][_0x0430('0x5a')]=_0x435028;return db[_0x0430('0x55')][_0x0430('0x4a')]({'body':_0x25ce76[_0x0430('0x29')][_0x0430('0x29')],'MailAccountId':_0x25ce76[_0x0430('0x3e')]['id'],'MailInteractionId':_0xc2546e['id'],'direction':'in','ContactId':_0x390e38[_0x0430('0x4c')]['id'],'messageId':_0x25ce76[_0x0430('0x29')][_0x0430('0x16')][_0x0430('0x4d')],'from':_0x25ce76[_0x0430('0x29')][_0x0430('0x16')][_0x0430('0x33')],'to':_0x25ce76[_0x0430('0x29')][_0x0430('0x16')]['to'],'cc':_0x25ce76[_0x0430('0x29')]['message']['cc'],'subject':_0x25ce76['body'][_0x0430('0x16')][_0x0430('0x4f')],'attach':_0x25ce76[_0x0430('0x29')]['message'][_0x0430('0x50')],'Attachments':_0x25ce76['body'][_0x0430('0x16')][_0x0430('0x5b')],'originTo':_0x25ce76[_0x0430('0x29')][_0x0430('0x16')]['originTo'],'originCc':_0x25ce76[_0x0430('0x29')]['message'][_0x0430('0x5c')],'bcc':_0x25ce76[_0x0430('0x29')][_0x0430('0x16')][_0x0430('0x5d')],'ChatWebsiteId':_0x25ce76[_0x0430('0x29')][_0x0430('0x16')][_0x0430('0x5e')]||null,'originChannel':_0x25ce76['body']['message'][_0x0430('0x5f')]||_0x0430('0x60'),'ChatOfflineMessageId':_0x25ce76[_0x0430('0x29')][_0x0430('0x16')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x0430('0x61')],'as':_0x0430('0x62')}]});})[_0x0430('0xe')](function(_0x4fd3ae){_0x390e38[_0x0430('0x16')]=_0x4fd3ae;if(!_0x390e38[_0x0430('0x59')]['UserId']){return;}return db['User']['find']({'attributes':['id',_0x0430('0x63')],'where':{'id':_0x390e38[_0x0430('0x59')][_0x0430('0x64')]}});})[_0x0430('0xe')](function(_0x153163){if(_0x153163){_0x390e38[_0x0430('0x40')][_0x0430('0x65')]({'id':0x0,'priority':0x0,'app':_0x0430('0x66'),'appdata':_0x153163[_0x0430('0x63')]+','+(_0x390e38['account']['waitForTheAssignedAgent']||0xa),'interval':_0x0430('0x49')});}if(!_0x390e38[_0x0430('0x59')][_0x0430('0x67')]){return;}return db[_0x0430('0x68')]['find']({'attributes':['id',_0x0430('0x63')],'where':{'id':_0x390e38[_0x0430('0x59')][_0x0430('0x67')]}});})['then'](function(_0x51b52b){if(_0x51b52b){_0x390e38[_0x0430('0x40')][_0x0430('0x65')]({'id':0x0,'priority':0x1,'app':_0x0430('0x69'),'appdata':_0x51b52b[_0x0430('0x63')]+','+(_0x390e38[_0x0430('0x3e')][_0x0430('0x6a')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0430('0x6b'),_0x0430('0x6c'),_0x390e38);})[_0x0430('0xe')](function(_0xb51729){_0x2d6345(_0xb51729);})[_0x0430('0x18')](function(_0x50c406){_0x8b32c2(_0x2ef408['error'](0x1f4,_0x50c406[_0x0430('0x16')]));});});}; \ No newline at end of file +var _0x36c3=['options','raw','where','limit','include','map','model','attributes','catch','find','smtp','setDataValue','getSmtpOptions','ShowMailAccount','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','smtpOptions','list','applications','orderBy','priority','asc','push','length','create','List\x20not\x20found','contact','messageId','generate','subject','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','attach','format','YYYY-MM-DD\x20HH:mm:ss','get','interaction','created','attachments','originTo','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','User','UserId','unshift','agent','name','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','*,*,*,*','Start','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetMailAccount'];(function(_0x20cc29,_0x30a46d){var _0x28d513=function(_0x179b06){while(--_0x179b06){_0x20cc29['push'](_0x20cc29['shift']());}};_0x28d513(++_0x30a46d);}(_0x36c3,0x1a6));var _0x336c=function(_0x54332e,_0x286092){_0x54332e=_0x54332e-0x0;var _0x44d685=_0x36c3[_0x54332e];return _0x44d685;};'use strict';var _=require(_0x336c('0x0'));var moment=require(_0x336c('0x1'));var BPromise=require('bluebird');var rs=require(_0x336c('0x2'));var Redis=require(_0x336c('0x3'));var db=require(_0x336c('0x4'))['db'];var logger=require(_0x336c('0x5'))(_0x336c('0x6'));var config=require(_0x336c('0x7'));var jayson=require(_0x336c('0x8'));var client=jayson['client'][_0x336c('0x9')]({'port':0x232c});config[_0x336c('0xa')]=_[_0x336c('0xb')](config[_0x336c('0xa')],{'host':_0x336c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x336c('0xa')]));require(_0x336c('0xd'))[_0x336c('0xe')](socket);function respondWithRpcPromise(_0x5e7830,_0x8b3722,_0x243984){return new BPromise(function(_0x33ced0,_0x1a4503){return client[_0x336c('0xf')](_0x5e7830,_0x243984)[_0x336c('0x10')](function(_0x174acc){logger[_0x336c('0x11')](_0x336c('0x12'),_0x8b3722,_0x336c('0x13'));logger[_0x336c('0x14')](_0x336c('0x15'),_0x8b3722,_0x336c('0x13'),JSON['stringify'](_0x174acc));if(_0x174acc['error']){if(_0x174acc[_0x336c('0x16')]['code']===0x1f4){logger[_0x336c('0x16')](_0x336c('0x12'),_0x8b3722,_0x174acc[_0x336c('0x16')][_0x336c('0x17')]);return _0x1a4503(_0x174acc['error'][_0x336c('0x17')]);}logger[_0x336c('0x16')]('MailAccount,\x20%s,\x20%s',_0x8b3722,_0x174acc[_0x336c('0x16')]['message']);return _0x33ced0(_0x174acc[_0x336c('0x16')]['message']);}else{logger[_0x336c('0x11')]('MailAccount,\x20%s,\x20%s',_0x8b3722,_0x336c('0x13'));_0x33ced0(_0x174acc[_0x336c('0x18')]['message']);}})['catch'](function(_0x13db87){logger[_0x336c('0x16')](_0x336c('0x12'),_0x8b3722,_0x13db87);_0x1a4503(_0x13db87);});});}exports[_0x336c('0x19')]=function(_0x366182){var _0x4fde93=this;return new Promise(function(_0x327e10,_0x532e12){return db['MailAccount']['findAll']({'raw':_0x366182[_0x336c('0x1a')]?_0x366182[_0x336c('0x1a')][_0x336c('0x1b')]===undefined?!![]:![]:!![],'where':_0x366182['options']?_0x366182['options'][_0x336c('0x1c')]||null:null,'attributes':_0x366182[_0x336c('0x1a')]?_0x366182[_0x336c('0x1a')]['attributes']||null:null,'limit':_0x366182[_0x336c('0x1a')]?_0x366182[_0x336c('0x1a')][_0x336c('0x1d')]||null:null,'include':_0x366182['options']?_0x366182[_0x336c('0x1a')][_0x336c('0x1e')]?_[_0x336c('0x1f')](_0x366182[_0x336c('0x1a')]['include'],function(_0x401660){return{'model':db[_0x401660[_0x336c('0x20')]],'as':_0x401660['as'],'attributes':_0x401660[_0x336c('0x21')],'include':_0x401660[_0x336c('0x1e')]?_[_0x336c('0x1f')](_0x401660[_0x336c('0x1e')],function(_0x567bfa){return{'model':db[_0x567bfa[_0x336c('0x20')]],'as':_0x567bfa['as'],'attributes':_0x567bfa[_0x336c('0x21')],'include':_0x567bfa[_0x336c('0x1e')]?_[_0x336c('0x1f')](_0x567bfa['include'],function(_0x637e87){return{'model':db[_0x637e87[_0x336c('0x20')]],'as':_0x637e87['as'],'attributes':_0x637e87['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x562043){logger[_0x336c('0x11')](_0x336c('0x19'),_0x366182);logger['debug']('GetMailAccount',_0x366182,JSON['stringify'](_0x562043));_0x327e10(_0x562043);})[_0x336c('0x22')](function(_0x37782a){logger[_0x336c('0x16')](_0x336c('0x19'),_0x37782a[_0x336c('0x17')],_0x366182);_0x532e12(_0x4fde93[_0x336c('0x16')](0x1f4,_0x37782a[_0x336c('0x17')]));});});};exports['ShowMailAccount']=function(_0x90d7de){var _0x21f671=this;return new Promise(function(_0x2b1af7,_0x34bcbe){return db['MailAccount'][_0x336c('0x23')]({'raw':_0x90d7de[_0x336c('0x1a')]?_0x90d7de['options'][_0x336c('0x1b')]===undefined?!![]:![]:!![],'where':_0x90d7de[_0x336c('0x1a')]?_0x90d7de['options'][_0x336c('0x1c')]||null:null,'attributes':_0x90d7de[_0x336c('0x1a')]?_0x90d7de[_0x336c('0x1a')][_0x336c('0x21')]||null:null,'include':_0x90d7de[_0x336c('0x1a')]?_0x90d7de[_0x336c('0x1a')][_0x336c('0x1e')]?_[_0x336c('0x1f')](_0x90d7de['options'][_0x336c('0x1e')],function(_0x351d13){return{'model':db[_0x351d13[_0x336c('0x20')]],'as':_0x351d13['as'],'attributes':_0x351d13[_0x336c('0x21')],'include':_0x351d13[_0x336c('0x1e')]?_[_0x336c('0x1f')](_0x351d13[_0x336c('0x1e')],function(_0x223c86){return{'model':db[_0x223c86[_0x336c('0x20')]],'as':_0x223c86['as'],'attributes':_0x223c86[_0x336c('0x21')],'include':_0x223c86['include']?_[_0x336c('0x1f')](_0x223c86[_0x336c('0x1e')],function(_0x4690c3){return{'model':db[_0x4690c3[_0x336c('0x20')]],'as':_0x4690c3['as'],'attributes':_0x4690c3[_0x336c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x336c('0x10')](function(_0x853b2d){if(_0x90d7de[_0x336c('0x1a')][_0x336c('0x24')]===!![])_0x853b2d[_0x336c('0x25')]('smtpOptions',_0x853b2d[_0x336c('0x26')]());logger[_0x336c('0x11')](_0x336c('0x27'),_0x90d7de);logger['debug'](_0x336c('0x27'),_0x90d7de,JSON[_0x336c('0x28')](_0x853b2d));_0x2b1af7(_0x853b2d);})[_0x336c('0x22')](function(_0x36a46f){logger['error'](_0x336c('0x27'),_0x36a46f[_0x336c('0x17')],_0x90d7de);_0x34bcbe(_0x21f671['error'](0x1f4,_0x36a46f[_0x336c('0x17')]));});});};exports[_0x336c('0x29')]=function(_0x1d30ac){var _0x4e75fc=this;return new Promise(function(_0x16c6c6,_0x2af458){var _0xdd7677={'body':_0x1d30ac[_0x336c('0x2a')],'channel':_0x336c('0x2b')};var _0x437170=_[_0x336c('0x2c')](_[_0x336c('0x2d')](db[_0x336c('0x2e')][_0x336c('0x2f')]),['createdAt',_0x336c('0x30'),_0x336c('0x31'),_0x336c('0x32')]);var _0x5b2f25=![];if(_0x1d30ac[_0x336c('0x2a')]['id']){delete _0x1d30ac[_0x336c('0x2a')]['id'];}if(_['isNil'](_0x1d30ac[_0x336c('0x2a')][_0x336c('0x33')])){return _0x2af458(_0x4e75fc[_0x336c('0x16')](0x1f4,_0x336c('0x34')));}if(_['isNil'](_0x1d30ac[_0x336c('0x2a')][_0x336c('0x2a')])||_0x1d30ac['body'][_0x336c('0x2a')]===''){return _0x2af458(_0x4e75fc[_0x336c('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x336c('0x35')](_0x1d30ac[_0x336c('0x2a')][_0x336c('0x36')])){return _0x2af458(_0x4e75fc[_0x336c('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x437170));}if(!_[_0x336c('0x37')](_0x437170,_0x1d30ac[_0x336c('0x2a')][_0x336c('0x36')])){return _0x2af458(_0x4e75fc[_0x336c('0x16')](0x1f4,_0x336c('0x38')+_0x437170));}var _0x3b68c4={};_0x3b68c4[_0x1d30ac[_0x336c('0x2a')][_0x336c('0x36')]]=_0x1d30ac[_0x336c('0x2a')]['from'];return db[_0x336c('0x39')][_0x336c('0x23')]({'where':{'id':_0x1d30ac[_0x336c('0x3a')]['id']},'include':[{'model':db[_0x336c('0x3b')],'as':_0x336c('0x3c'),'include':[{'model':db[_0x336c('0x2e')],'as':_0x336c('0x3d'),'where':_0x3b68c4,'limit':0x1,'order':[[_0x336c('0x30'),_0x336c('0x3e')]]}]},{'model':db[_0x336c('0x3f')],'as':_0x336c('0x40')},{'model':db[_0x336c('0x41')],'as':_0x336c('0x42'),'include':[{'model':db['CloudProvider'],'as':_0x336c('0x43')}]}]})['then'](function(_0x4f4e12){if(_0x4f4e12&&_0x4f4e12[_0x336c('0x3c')]){var _0x4f717e=_0x4f4e12['get']({'plain':!![]});_0xdd7677[_0x336c('0x3a')]=_['omit'](_0x4f717e,[_0x336c('0x40'),_0x336c('0x3c')]);_0xdd7677[_0x336c('0x3a')][_0x336c('0x44')]=_0x4f4e12['getSmtpOptions']();_0xdd7677['applications']=_0x4f717e[_0x336c('0x40')];_0xdd7677[_0x336c('0x45')]=_0x4f717e['List'];_0xdd7677[_0x336c('0x46')]=_[_0x336c('0x47')](_0xdd7677['applications'],[_0x336c('0x48')],[_0x336c('0x49')]);if(_0xdd7677[_0x336c('0x3a')]&&_0xdd7677[_0x336c('0x3a')]['autoclose']){_0xdd7677[_0x336c('0x46')][_0x336c('0x4a')]({'id':0x0,'priority':_0xdd7677['applications']['length']+0x1,'app':'close','appdata':'autoclose','interval':'*,*,*,*'});}if(_0xdd7677[_0x336c('0x3a')][_0x336c('0x40')]){delete _0xdd7677[_0x336c('0x3a')][_0x336c('0x40')];}if(_0xdd7677['account'][_0x336c('0x3c')]){delete _0xdd7677[_0x336c('0x3a')][_0x336c('0x3c')];}if(_0x4f717e[_0x336c('0x3c')]['Contacts'][_0x336c('0x4b')]){return _0x4f717e['List'][_0x336c('0x3d')][0x0];}var _0x3dc6ee=_[_0x336c('0xb')](_0x1d30ac[_0x336c('0x2a')],{'firstName':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x33')],'ListId':_0x4f717e['ListId']});_0x3dc6ee[_0x1d30ac['body'][_0x336c('0x36')]]=_0x1d30ac[_0x336c('0x2a')]['from'];return db[_0x336c('0x2e')][_0x336c('0x4c')](_0x3dc6ee);}else{throw new Error(_0x336c('0x4d'));}})['then'](function(_0x5bacb9){_0xdd7677[_0x336c('0x4e')]=_0x5bacb9;if(_0x5bacb9){if(!_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x4f')]){_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')]['messageId']=rs[_0x336c('0x50')]()+'\x20'+_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')]['from'];}var _0x58f63f={'ContactId':_0x5bacb9['id'],'MailAccountId':_0x1d30ac[_0x336c('0x3a')]['id'],'inReplyTo':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x4f')],'to':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x33')],'cc':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')]['cc'],'subject':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x51')],'attach':_0x1d30ac[_0x336c('0x2a')]['message']['attach'],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x336c('0x52')][_0x336c('0x23')]({'where':{'closed':![],'MailAccountId':_0x1d30ac['account']['id']},'include':[{'model':db[_0x336c('0x53')],'as':_0x336c('0x54'),'attributes':[_0x336c('0x4f')],'where':{'messageId':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x55')]}}]})['then'](function(_0x2086a4){if(_0x2086a4){return[_0x2086a4,![]];}return db['MailInteraction'][_0x336c('0x4c')](_0x58f63f)[_0x336c('0x10')](function(_0x2d4c48){return[_0x2d4c48,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x336c('0x56')](function(_0x39697d,_0x579607){if(_0x39697d){_0x5b2f25=_0x579607;if(!_0x579607){return _0x39697d[_0x336c('0x57')]({'inReplyTo':_0x1d30ac['body'][_0x336c('0x17')][_0x336c('0x4f')],'to':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x33')],'cc':_0x1d30ac[_0x336c('0x2a')]['message']['cc'],'subject':_0x1d30ac[_0x336c('0x2a')]['message']['subject'],'attach':_0x39697d['attach']?_0x39697d['attach']:_0x1d30ac['body']['message'][_0x336c('0x58')],'substatus':null,'substatusAt':moment()[_0x336c('0x59')](_0x336c('0x5a')),'lastMsgAt':moment()[_0x336c('0x59')](_0x336c('0x5a')),'lastMsgDirection':'in'});}else{return _0x39697d;}}})[_0x336c('0x10')](function(_0x338106){_0xdd7677['interaction']=_0x338106[_0x336c('0x5b')]({'plain':!![]});_0xdd7677[_0x336c('0x5c')][_0x336c('0x5d')]=_0x5b2f25;return db[_0x336c('0x53')]['create']({'body':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x2a')],'MailAccountId':_0x1d30ac[_0x336c('0x3a')]['id'],'MailInteractionId':_0x338106['id'],'direction':'in','ContactId':_0xdd7677['contact']['id'],'messageId':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x4f')],'from':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x33')],'to':_0x1d30ac[_0x336c('0x2a')]['message']['to'],'cc':_0x1d30ac['body'][_0x336c('0x17')]['cc'],'subject':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x51')],'attach':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x58')],'Attachments':_0x1d30ac[_0x336c('0x2a')]['message'][_0x336c('0x5e')],'originTo':_0x1d30ac[_0x336c('0x2a')]['message'][_0x336c('0x5f')],'originCc':_0x1d30ac[_0x336c('0x2a')]['message']['originCc'],'bcc':_0x1d30ac[_0x336c('0x2a')]['message'][_0x336c('0x60')],'ChatWebsiteId':_0x1d30ac[_0x336c('0x2a')]['message'][_0x336c('0x61')]||null,'originChannel':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x62')]||'Email','ChatOfflineMessageId':_0x1d30ac[_0x336c('0x2a')][_0x336c('0x17')][_0x336c('0x63')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})['then'](function(_0x553f66){_0xdd7677['message']=_0x553f66;if(!_0xdd7677[_0x336c('0x5c')]['UserId']){return;}return db[_0x336c('0x64')]['find']({'attributes':['id','name'],'where':{'id':_0xdd7677[_0x336c('0x5c')][_0x336c('0x65')]}});})['then'](function(_0x34e9c8){if(_0x34e9c8){_0xdd7677['applications'][_0x336c('0x66')]({'id':0x0,'priority':0x0,'app':_0x336c('0x67'),'appdata':_0x34e9c8[_0x336c('0x68')]+','+(_0xdd7677[_0x336c('0x3a')][_0x336c('0x69')]||0xa),'interval':'*,*,*,*'});}if(!_0xdd7677[_0x336c('0x5c')][_0x336c('0x6a')]){return;}return db[_0x336c('0x6b')]['find']({'attributes':['id',_0x336c('0x68')],'where':{'id':_0xdd7677[_0x336c('0x5c')][_0x336c('0x6a')]}});})[_0x336c('0x10')](function(_0x444c4f){if(_0x444c4f){_0xdd7677[_0x336c('0x46')][_0x336c('0x66')]({'id':0x0,'priority':0x1,'app':_0x336c('0x6c'),'appdata':_0x444c4f['name']+','+(_0xdd7677[_0x336c('0x3a')][_0x336c('0x6d')]||0x12c),'interval':_0x336c('0x6e')});}return respondWithRpcPromise(_0x336c('0x6f'),'startRouting',_0xdd7677);})[_0x336c('0x10')](function(_0x57de54){_0x16c6c6(_0x57de54);})[_0x336c('0x22')](function(_0x364e89){_0x2af458(_0x4e75fc[_0x336c('0x16')](0x1f4,_0x364e89[_0x336c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 6deb015..947bae1 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 _0x56fc=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','remove'];(function(_0x98db33,_0x397f20){var _0x5ae63a=function(_0x411f1c){while(--_0x411f1c){_0x98db33['push'](_0x98db33['shift']());}};_0x5ae63a(++_0x397f20);}(_0x56fc,0x13e));var _0xc56f=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x56fc[_0x42245d];return _0x4b211a;};'use strict';var MailAccountEvents=require(_0xc56f('0x0'));var events=['save',_0xc56f('0x1'),_0xc56f('0x2')];function createListener(_0x2fe616,_0x2eaef7){return function(_0x2c2077){_0x2eaef7[_0xc56f('0x3')](_0x2fe616,_0x2c2077);};}function removeListener(_0x4e3a6b,_0x2284f9){return function(){MailAccountEvents[_0xc56f('0x4')](_0x4e3a6b,_0x2284f9);};}exports[_0xc56f('0x5')]=function(_0x2d65c6){for(var _0x2bccdd=0x0,_0x4e2ffa=events[_0xc56f('0x6')];_0x2bccdd<_0x4e2ffa;_0x2bccdd++){var _0x12e9ba=events[_0x2bccdd];var _0x53ed7d=createListener(_0xc56f('0x7')+_0x12e9ba,_0x2d65c6);MailAccountEvents['on'](_0x12e9ba,_0x53ed7d);}}; \ No newline at end of file +var _0xdace=['update','emit','removeListener','register','length','./mailAccount.events','save','remove'];(function(_0x49e495,_0xfa976b){var _0x4d1456=function(_0x9c593d){while(--_0x9c593d){_0x49e495['push'](_0x49e495['shift']());}};_0x4d1456(++_0xfa976b);}(_0xdace,0xad));var _0xedac=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xdace[_0x138f59];return _0x3d114d;};'use strict';var MailAccountEvents=require(_0xedac('0x0'));var events=[_0xedac('0x1'),_0xedac('0x2'),_0xedac('0x3')];function createListener(_0x28dfab,_0x3980f3){return function(_0x133dca){_0x3980f3[_0xedac('0x4')](_0x28dfab,_0x133dca);};}function removeListener(_0x2bcfa3,_0x2d7e3a){return function(){MailAccountEvents[_0xedac('0x5')](_0x2bcfa3,_0x2d7e3a);};}exports[_0xedac('0x6')]=function(_0x59639f){for(var _0x6041e1=0x0,_0x13581f=events[_0xedac('0x7')];_0x6041e1<_0x13581f;_0x6041e1++){var _0x4d3154=events[_0x6041e1];var _0x1fd085=createListener('mailAccount:'+_0x4d3154,_0x59639f);MailAccountEvents['on'](_0x4d3154,_0x1fd085);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index ee64eb6..adba728 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 _0xb63c=['./mailApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1f7420,_0x46922d){var _0x5574ac=function(_0x48f0e4){while(--_0x48f0e4){_0x1f7420['push'](_0x1f7420['shift']());}};_0x5574ac(++_0x46922d);}(_0xb63c,0x138));var _0xcb63=function(_0x19c09b,_0xf5b872){_0x19c09b=_0x19c09b-0x0;var _0xbef694=_0xb63c[_0x19c09b];return _0xbef694;};'use strict';var multer=require(_0xcb63('0x0'));var util=require('util');var path=require(_0xcb63('0x1'));var timeout=require(_0xcb63('0x2'));var express=require(_0xcb63('0x3'));var router=express[_0xcb63('0x4')]();var fs_extra=require(_0xcb63('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcb63('0x6'));var config=require(_0xcb63('0x7'));var controller=require(_0xcb63('0x8'));router[_0xcb63('0x9')](_0xcb63('0xa'),auth[_0xcb63('0xb')](),controller[_0xcb63('0xc')]);router['put'](_0xcb63('0xa'),auth[_0xcb63('0xb')](),controller[_0xcb63('0xd')]);router[_0xcb63('0xe')](_0xcb63('0xa'),auth[_0xcb63('0xb')](),controller[_0xcb63('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7ba9=['put','update','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x2467b0,_0x4861bf){var _0x3fd2c6=function(_0x4ff4ba){while(--_0x4ff4ba){_0x2467b0['push'](_0x2467b0['shift']());}};_0x3fd2c6(++_0x4861bf);}(_0x7ba9,0x12e));var _0x97ba=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x7ba9[_0x3c4737];return _0x2bb926;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x97ba('0x0'));var timeout=require('connect-timeout');var express=require(_0x97ba('0x1'));var router=express[_0x97ba('0x2')]();var fs_extra=require(_0x97ba('0x3'));var auth=require(_0x97ba('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x97ba('0x5'));var controller=require(_0x97ba('0x6'));router[_0x97ba('0x7')](_0x97ba('0x8'),auth[_0x97ba('0x9')](),controller['show']);router[_0x97ba('0xa')](_0x97ba('0x8'),auth[_0x97ba('0x9')](),controller[_0x97ba('0xb')]);router['delete'](_0x97ba('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x97ba('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 1a84ea3..4515c4a 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 _0x590f=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x590f,0x70));var _0xf590=function(_0x5a9719,_0x407862){_0x5a9719=_0x5a9719-0x0;var _0x28b25d=_0x590f[_0x5a9719];return _0x28b25d;};'use strict';var Sequelize=require('sequelize');module[_0xf590('0x0')]={'priority':{'type':Sequelize[_0xf590('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf590('0x2')],'allowNull':![],'defaultValue':_0xf590('0x3')},'appdata':{'type':Sequelize[_0xf590('0x4')]()},'description':{'type':Sequelize[_0xf590('0x2')]},'interval':{'type':Sequelize[_0xf590('0x2')],'defaultValue':_0xf590('0x5')}}; \ No newline at end of file +var _0x3fef=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x4d2abc,_0x29b228){var _0x5c4540=function(_0x2c7dd5){while(--_0x2c7dd5){_0x4d2abc['push'](_0x4d2abc['shift']());}};_0x5c4540(++_0x29b228);}(_0x3fef,0x1a5));var _0xf3fe=function(_0x75203d,_0x4d7270){_0x75203d=_0x75203d-0x0;var _0x5c01d3=_0x3fef[_0x75203d];return _0x5c01d3;};'use strict';var Sequelize=require(_0xf3fe('0x0'));module[_0xf3fe('0x1')]={'priority':{'type':Sequelize[_0xf3fe('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf3fe('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf3fe('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf3fe('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index c755176..c72e17d 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 _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x576434,_0x2d592b){var _0x471c8f=function(_0x3a9acb){while(--_0x3a9acb){_0x576434['push'](_0x576434['shift']());}};_0x471c8f(++_0x2d592b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file +var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0xf8eaec,_0x1f5b7f){var _0x594e80=function(_0x29ac93){while(--_0x29ac93){_0xf8eaec['push'](_0xf8eaec['shift']());}};_0x594e80(++_0x1f5b7f);}(_0xf4eb,0xec));var _0xbf4e=function(_0x285cf1,_0x5457d4){_0x285cf1=_0x285cf1-0x0;var _0x161a25=_0xf4eb[_0x285cf1];return _0x161a25;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5e5a3e2..77697ee 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 _0x7620=['exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','../../config/environment','./mailApplication.attributes'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7620,0x148));var _0x0762=function(_0x463f91,_0x26ec38){_0x463f91=_0x463f91-0x0;var _0x552e15=_0x7620[_0x463f91];return _0x552e15;};'use strict';var _=require(_0x0762('0x0'));var util=require(_0x0762('0x1'));var logger=require(_0x0762('0x2'))(_0x0762('0x3'));var moment=require(_0x0762('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0762('0x5'));var rimraf=require('rimraf');var config=require(_0x0762('0x6'));var attributes=require(_0x0762('0x7'));module[_0x0762('0x8')]=function(_0x9e1289,_0x7184ae){return _0x9e1289[_0x0762('0x9')](_0x0762('0xa'),attributes,{'tableName':_0x0762('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0762('0xc'),'collate':_0x0762('0xd')});}; \ No newline at end of file +var _0x97cb=['exports','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x4b1d6f,_0x492359){var _0x99ad87=function(_0x5d6700){while(--_0x5d6700){_0x4b1d6f['push'](_0x4b1d6f['shift']());}};_0x99ad87(++_0x492359);}(_0x97cb,0x12b));var _0xb97c=function(_0x130531,_0x36d286){_0x130531=_0x130531-0x0;var _0x40b159=_0x97cb[_0x130531];return _0x40b159;};'use strict';var _=require(_0xb97c('0x0'));var util=require(_0xb97c('0x1'));var logger=require(_0xb97c('0x2'))(_0xb97c('0x3'));var moment=require('moment');var BPromise=require(_0xb97c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb97c('0x5'));var config=require(_0xb97c('0x6'));var attributes=require('./mailApplication.attributes');module[_0xb97c('0x7')]=function(_0x32c798,_0x3974a6){return _0x32c798['define']('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb97c('0x8')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 46e32aa..197744a 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 _0xf43c=['debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','MailApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xf43c,0x1f0));var _0xcf43=function(_0x2d1cc6,_0x36e44f){_0x2d1cc6=_0x2d1cc6-0x0;var _0x2f3507=_0xf43c[_0x2d1cc6];return _0x2f3507;};'use strict';var _=require(_0xcf43('0x0'));var util=require(_0xcf43('0x1'));var moment=require('moment');var BPromise=require(_0xcf43('0x2'));var rs=require(_0xcf43('0x3'));var fs=require('fs');var Redis=require(_0xcf43('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcf43('0x5'))(_0xcf43('0x6'));var config=require(_0xcf43('0x7'));var jayson=require(_0xcf43('0x8'));var client=jayson[_0xcf43('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d41f8,_0x12ae6c,_0x221fb9){return new BPromise(function(_0x50d846,_0x2e7cfe){return client[_0xcf43('0xa')](_0x5d41f8,_0x221fb9)['then'](function(_0x595b17){logger[_0xcf43('0xb')](_0xcf43('0xc'),_0x12ae6c,_0xcf43('0xd'));logger[_0xcf43('0xe')](_0xcf43('0xf'),_0x12ae6c,_0xcf43('0xd'),JSON[_0xcf43('0x10')](_0x595b17));if(_0x595b17[_0xcf43('0x11')]){if(_0x595b17[_0xcf43('0x11')][_0xcf43('0x12')]===0x1f4){logger[_0xcf43('0x11')](_0xcf43('0xc'),_0x12ae6c,_0x595b17[_0xcf43('0x11')][_0xcf43('0x13')]);return _0x2e7cfe(_0x595b17[_0xcf43('0x11')][_0xcf43('0x13')]);}logger[_0xcf43('0x11')](_0xcf43('0xc'),_0x12ae6c,_0x595b17[_0xcf43('0x11')]['message']);return _0x50d846(_0x595b17[_0xcf43('0x11')][_0xcf43('0x13')]);}else{logger['info'](_0xcf43('0xc'),_0x12ae6c,_0xcf43('0xd'));_0x50d846(_0x595b17[_0xcf43('0x14')][_0xcf43('0x13')]);}})[_0xcf43('0x15')](function(_0x3defdf){logger['error'](_0xcf43('0xc'),_0x12ae6c,_0x3defdf);_0x2e7cfe(_0x3defdf);});});}exports[_0xcf43('0x16')]=function(_0x1d907d){var _0x2e050a=this;return new Promise(function(_0x35e122,_0x50d286){return db[_0xcf43('0x17')][_0xcf43('0x18')](_0x1d907d[_0xcf43('0x19')],{'raw':_0x1d907d[_0xcf43('0x1a')]?_0x1d907d[_0xcf43('0x1a')][_0xcf43('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d907d['options']?_0x1d907d[_0xcf43('0x1a')]['where']||null:null,'attributes':_0x1d907d[_0xcf43('0x1a')]?_0x1d907d['options'][_0xcf43('0x1c')]||null:null,'limit':_0x1d907d[_0xcf43('0x1a')]?_0x1d907d['options']['limit']||null:null})[_0xcf43('0x1d')](function(_0x5ee242){logger[_0xcf43('0xb')](_0xcf43('0x16'),_0x1d907d);logger['debug'](_0xcf43('0x16'),_0x1d907d,JSON[_0xcf43('0x10')](_0x5ee242));_0x35e122(_0x5ee242);})[_0xcf43('0x15')](function(_0x1fc831){logger['error']('UpdateMailApplication',_0x1fc831['message'],_0x1d907d);_0x50d286(_0x2e050a[_0xcf43('0x11')](0x1f4,_0x1fc831['message']));});});}; \ No newline at end of file +var _0x838a=['MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateMailApplication','MailApplication','update','body','options','raw','where','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4f818b,_0x58a3e6){var _0x30cb2d=function(_0x42099f){while(--_0x42099f){_0x4f818b['push'](_0x4f818b['shift']());}};_0x30cb2d(++_0x58a3e6);}(_0x838a,0xb4));var _0xa838=function(_0x292423,_0x1759b7){_0x292423=_0x292423-0x0;var _0x2801cb=_0x838a[_0x292423];return _0x2801cb;};'use strict';var _=require(_0xa838('0x0'));var util=require(_0xa838('0x1'));var moment=require(_0xa838('0x2'));var BPromise=require(_0xa838('0x3'));var rs=require(_0xa838('0x4'));var fs=require('fs');var Redis=require(_0xa838('0x5'));var db=require(_0xa838('0x6'))['db'];var utils=require(_0xa838('0x7'));var logger=require(_0xa838('0x8'))('rpc');var config=require(_0xa838('0x9'));var jayson=require(_0xa838('0xa'));var client=jayson[_0xa838('0xb')][_0xa838('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x579eb3,_0x26459b,_0xaf3e0){return new BPromise(function(_0x3f65c2,_0x119f9d){return client[_0xa838('0xd')](_0x579eb3,_0xaf3e0)[_0xa838('0xe')](function(_0x166d27){logger['info'](_0xa838('0xf'),_0x26459b,_0xa838('0x10'));logger[_0xa838('0x11')](_0xa838('0x12'),_0x26459b,_0xa838('0x10'),JSON[_0xa838('0x13')](_0x166d27));if(_0x166d27[_0xa838('0x14')]){if(_0x166d27[_0xa838('0x14')][_0xa838('0x15')]===0x1f4){logger['error'](_0xa838('0xf'),_0x26459b,_0x166d27[_0xa838('0x14')][_0xa838('0x16')]);return _0x119f9d(_0x166d27[_0xa838('0x14')]['message']);}logger[_0xa838('0x14')](_0xa838('0xf'),_0x26459b,_0x166d27[_0xa838('0x14')]['message']);return _0x3f65c2(_0x166d27['error']['message']);}else{logger[_0xa838('0x17')](_0xa838('0xf'),_0x26459b,'request\x20sent');_0x3f65c2(_0x166d27[_0xa838('0x18')][_0xa838('0x16')]);}})['catch'](function(_0x32537b){logger['error'](_0xa838('0xf'),_0x26459b,_0x32537b);_0x119f9d(_0x32537b);});});}exports[_0xa838('0x19')]=function(_0x552dbb){var _0x565a32=this;return new Promise(function(_0x3233c4,_0x54ee29){return db[_0xa838('0x1a')][_0xa838('0x1b')](_0x552dbb[_0xa838('0x1c')],{'raw':_0x552dbb[_0xa838('0x1d')]?_0x552dbb[_0xa838('0x1d')][_0xa838('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x552dbb[_0xa838('0x1d')]?_0x552dbb[_0xa838('0x1d')][_0xa838('0x1f')]||null:null,'attributes':_0x552dbb[_0xa838('0x1d')]?_0x552dbb[_0xa838('0x1d')]['attributes']||null:null,'limit':_0x552dbb[_0xa838('0x1d')]?_0x552dbb['options']['limit']||null:null})[_0xa838('0xe')](function(_0x7a24e9){logger[_0xa838('0x17')](_0xa838('0x19'),_0x552dbb);logger[_0xa838('0x11')](_0xa838('0x19'),_0x552dbb,JSON[_0xa838('0x13')](_0x7a24e9));_0x3233c4(_0x7a24e9);})[_0xa838('0x20')](function(_0x3f0a85){logger[_0xa838('0x14')](_0xa838('0x19'),_0x3f0a85[_0xa838('0x16')],_0x552dbb);_0x54ee29(_0x565a32[_0xa838('0x14')](0x1f4,_0x3f0a85['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 4716c19..0e0a6a9 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 _0xf64b=['addTags','mailinteraction:update','update','delete','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf64b,0x1ab));var _0xbf64=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0xf64b[_0x310504];return _0x5b36d0;};'use strict';var express=require(_0xbf64('0x0'));var router=express[_0xbf64('0x1')]();var auth=require(_0xbf64('0x2'));var interaction=require(_0xbf64('0x3'));var controller=require(_0xbf64('0x4'));router['get']('/',auth[_0xbf64('0x5')](),controller[_0xbf64('0x6')]);router[_0xbf64('0x7')](_0xbf64('0x8'),auth[_0xbf64('0x5')](),controller['describe']);router[_0xbf64('0x7')](_0xbf64('0x9'),auth[_0xbf64('0x5')](),controller[_0xbf64('0xa')]);router[_0xbf64('0x7')](_0xbf64('0xb'),auth[_0xbf64('0x5')](),controller['getMessages']);router['get'](_0xbf64('0xc'),auth[_0xbf64('0x5')](),controller[_0xbf64('0xd')]);router[_0xbf64('0xe')]('/',auth[_0xbf64('0x5')](),controller[_0xbf64('0xf')]);router[_0xbf64('0xe')](_0xbf64('0xb'),auth[_0xbf64('0x5')](),controller[_0xbf64('0x10')]);router[_0xbf64('0xe')](_0xbf64('0x11'),auth[_0xbf64('0x5')](),interaction[_0xbf64('0x12')](_0xbf64('0x13'),_0xbf64('0x14')),controller[_0xbf64('0x15')]);router['put'](_0xbf64('0x9'),auth[_0xbf64('0x5')](),interaction['tracked']('mail',_0xbf64('0x16')),controller[_0xbf64('0x17')]);router[_0xbf64('0x18')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xbf64('0x13'),'mailinteraction:destroy'),controller[_0xbf64('0x19')]);router['delete'](_0xbf64('0x11'),auth[_0xbf64('0x5')](),controller[_0xbf64('0x1a')]);module[_0xbf64('0x1b')]=router; \ No newline at end of file +var _0x9a05=['show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x9a05,0x16f));var _0x59a0=function(_0x4a24e5,_0x57c965){_0x4a24e5=_0x4a24e5-0x0;var _0xde9a5a=_0x9a05[_0x4a24e5];return _0xde9a5a;};'use strict';var express=require(_0x59a0('0x0'));var router=express[_0x59a0('0x1')]();var auth=require(_0x59a0('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0x59a0('0x3'));router[_0x59a0('0x4')]('/',auth[_0x59a0('0x5')](),controller[_0x59a0('0x6')]);router[_0x59a0('0x4')](_0x59a0('0x7'),auth[_0x59a0('0x5')](),controller['describe']);router[_0x59a0('0x4')]('/:id',auth[_0x59a0('0x5')](),controller[_0x59a0('0x8')]);router[_0x59a0('0x4')](_0x59a0('0x9'),auth[_0x59a0('0x5')](),controller[_0x59a0('0xa')]);router['get'](_0x59a0('0xb'),auth['isAuthenticated'](),controller[_0x59a0('0xc')]);router[_0x59a0('0xd')]('/',auth[_0x59a0('0x5')](),controller['create']);router[_0x59a0('0xd')](_0x59a0('0x9'),auth['isAuthenticated'](),controller[_0x59a0('0xe')]);router['post'](_0x59a0('0xf'),auth[_0x59a0('0x5')](),interaction[_0x59a0('0x10')](_0x59a0('0x11'),_0x59a0('0x12')),controller[_0x59a0('0x13')]);router[_0x59a0('0x14')]('/:id',auth['isAuthenticated'](),interaction[_0x59a0('0x10')]('mail','mailinteraction:update'),controller[_0x59a0('0x15')]);router[_0x59a0('0x16')]('/:id',auth[_0x59a0('0x5')](),interaction[_0x59a0('0x10')]('mail','mailinteraction:destroy'),controller[_0x59a0('0x17')]);router[_0x59a0('0x16')](_0x59a0('0xf'),auth['isAuthenticated'](),controller['removeTags']);module[_0x59a0('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index f3a92e5..fd2bd3c 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 _0x026f=['sequelize','exports','BOOLEAN','STRING','TEXT','DATE','out','ENUM','INTEGER'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0x026f,0x129));var _0xf026=function(_0x5f159a,_0x22553f){_0x5f159a=_0x5f159a-0x0;var _0x38945c=_0x026f[_0x5f159a];return _0x38945c;};'use strict';var Sequelize=require(_0xf026('0x0'));var iconv=require('iconv');module[_0xf026('0x1')]={'closed':{'type':Sequelize[_0xf026('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf026('0x3')]},'secondDisposition':{'type':Sequelize[_0xf026('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf026('0x3')]},'note':{'type':Sequelize[_0xf026('0x3')]},'inReplyTo':{'type':Sequelize[_0xf026('0x3')](0x1fe)},'to':{'type':Sequelize[_0xf026('0x3')]},'cc':{'type':Sequelize[_0xf026('0x4')]('long')},'subject':{'type':Sequelize[_0xf026('0x4')]()},'attach':{'type':Sequelize[_0xf026('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf026('0x5')]},'substatus':{'type':Sequelize[_0xf026('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xf026('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xf026('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf026('0x5')]},'lastMsgDirection':{'type':Sequelize[_0xf026('0x7')]('in',_0xf026('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf026('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf026('0x8')]}}; \ No newline at end of file +var _0x50a2=['iconv','exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM','out','INTEGER','sequelize'];(function(_0xb889ac,_0x305522){var _0x445000=function(_0x5df341){while(--_0x5df341){_0xb889ac['push'](_0xb889ac['shift']());}};_0x445000(++_0x305522);}(_0x50a2,0x18b));var _0x250a=function(_0x102e43,_0x191c56){_0x102e43=_0x102e43-0x0;var _0x37c5df=_0x50a2[_0x102e43];return _0x37c5df;};'use strict';var Sequelize=require(_0x250a('0x0'));var iconv=require(_0x250a('0x1'));module[_0x250a('0x2')]={'closed':{'type':Sequelize[_0x250a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x250a('0x4')]},'secondDisposition':{'type':Sequelize[_0x250a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x250a('0x4')]},'note':{'type':Sequelize[_0x250a('0x4')]},'inReplyTo':{'type':Sequelize[_0x250a('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x250a('0x5')](_0x250a('0x6'))},'subject':{'type':Sequelize[_0x250a('0x5')]()},'attach':{'type':Sequelize[_0x250a('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x250a('0x7')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x250a('0x7')]},'firstMsgDirection':{'type':Sequelize[_0x250a('0x8')]('in',_0x250a('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x250a('0x8')]('in',_0x250a('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x250a('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x250a('0xa')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index f218857..2cb1d48 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 _0xf13a=['create','body','destroy','describe','MailMessage','addMessage','findOne','nolimit','sort','where','pick','MailInteractionId','filter','$gte','split','format','options','inlineCss','true','rows','setTags','ids','omit','spread','color','emit','mailInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Messages','bcc','subject','get','mkdirSync','from','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','existsSync','readFileSync','build','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','offset','limit','undefined','count','Content-Range','json','update','then','end','error','stack','name','send','map','MailInteraction','rawAttributes','fieldName','type','getOptions','findAll','mail','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','find'];(function(_0x34dff9,_0x1321ae){var _0x171636=function(_0x1dcd69){while(--_0x1dcd69){_0x34dff9['push'](_0x34dff9['shift']());}};_0x171636(++_0x1321ae);}(_0xf13a,0x118));var _0xaf13=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0xf13a[_0x5a7d41];return _0x98d8fa;};'use strict';var emlformat=require(_0xaf13('0x0'));var rimraf=require(_0xaf13('0x1'));var zipdir=require(_0xaf13('0x2'));var moment=require(_0xaf13('0x3'));var BPromise=require(_0xaf13('0x4'));var util=require(_0xaf13('0x5'));var path=require(_0xaf13('0x6'));var fs=require('fs');var _=require(_0xaf13('0x7'));var juice=require(_0xaf13('0x8'));var Redis=require(_0xaf13('0x9'));var interaction=require(_0xaf13('0xa'));var qs=require(_0xaf13('0xb'));var logger=require('../../config/logger')(_0xaf13('0xc'));var config=require('../../config/environment');var db=require(_0xaf13('0xd'))['db'];var htmlEntities=require('html-entities');config[_0xaf13('0xe')]=_[_0xaf13('0xf')](config['redis'],{'host':_0xaf13('0x10'),'port':0x18eb});var socket=require(_0xaf13('0x11'))(new Redis(config['redis']));require(_0xaf13('0x12'))[_0xaf13('0x13')](socket);function respondWithStatusCode(_0x2f7d91,_0xdb7367){_0xdb7367=_0xdb7367||0xcc;return function(_0x36871b){if(_0x36871b){return _0x2f7d91[_0xaf13('0x14')](_0xdb7367);}return _0x2f7d91[_0xaf13('0x15')](_0xdb7367)['end']();};}function respondWithResult(_0x14c261,_0x402170){_0x402170=_0x402170||0xc8;return function(_0xc77805){if(_0xc77805){return _0x14c261['status'](_0x402170)['json'](_0xc77805);}};}function respondWithFilteredResult(_0x4f6b70,_0x11c130){return function(_0x1844c9){if(_0x1844c9){var _0x2667b7=typeof _0x11c130[_0xaf13('0x16')]==='undefined'&&typeof _0x11c130[_0xaf13('0x17')]===_0xaf13('0x18');var _0x1b45a1=_0x1844c9[_0xaf13('0x19')];var _0x1626f8=_0x2667b7?0x0:_0x11c130['offset'];var _0x4fd39d=_0x2667b7?_0x1844c9[_0xaf13('0x19')]:_0x11c130[_0xaf13('0x16')]+_0x11c130[_0xaf13('0x17')];var _0x3883b3;if(_0x4fd39d>=_0x1b45a1){_0x4fd39d=_0x1b45a1;_0x3883b3=0xc8;}else{_0x3883b3=0xce;}_0x4f6b70[_0xaf13('0x15')](_0x3883b3);return _0x4f6b70['set'](_0xaf13('0x1a'),_0x1626f8+'-'+_0x4fd39d+'/'+_0x1b45a1)[_0xaf13('0x1b')](_0x1844c9);}return null;};}function saveUpdates(_0x3b2773){return function(_0xd1289e){if(_0xd1289e){return _0xd1289e[_0xaf13('0x1c')](_0x3b2773)['then'](function(_0x4aa415){return _0x4aa415;});}return null;};}function removeEntity(_0x2787fb){return function(_0x20848f){if(_0x20848f){return _0x20848f['destroy']()[_0xaf13('0x1d')](function(){_0x2787fb[_0xaf13('0x15')](0xcc)[_0xaf13('0x1e')]();});}};}function handleEntityNotFound(_0x10e84d){return function(_0x5955e4){if(!_0x5955e4){_0x10e84d[_0xaf13('0x14')](0x194);}return _0x5955e4;};}function handleError(_0x22958e,_0x14a0b9){_0x14a0b9=_0x14a0b9||0x1f4;return function(_0xa78d89){logger[_0xaf13('0x1f')](_0xa78d89[_0xaf13('0x20')]);if(_0xa78d89[_0xaf13('0x21')]){delete _0xa78d89[_0xaf13('0x21')];}_0x22958e['status'](_0x14a0b9)[_0xaf13('0x22')](_0xa78d89);};}exports['index']=function(_0x31cda8,_0x49d794){var _0x278386={};var _0x2c2181=_[_0xaf13('0x23')](db[_0xaf13('0x24')][_0xaf13('0x25')],function(_0x40fd24){return{'name':_0x40fd24[_0xaf13('0x26')],'type':_0x40fd24[_0xaf13('0x27')]['key']};});_0x278386=qs[_0xaf13('0x28')](_0x2c2181,_0x31cda8);return interaction[_0xaf13('0x29')](_0xaf13('0x2a'),_0x31cda8[_0xaf13('0x2b')],_0x31cda8[_0xaf13('0x2c')],_0x278386,_0x2c2181)['then'](respondWithFilteredResult(_0x49d794,_0x278386))[_0xaf13('0x2d')](handleError(_0x49d794,null));};exports[_0xaf13('0x2e')]=function(_0x3908d9,_0x372f46){var _0x3a2a64={'raw':![],'where':{'id':_0x3908d9[_0xaf13('0x2f')]['id']}},_0x63d6eb={};_0x63d6eb[_0xaf13('0x30')]=_[_0xaf13('0x31')](db[_0xaf13('0x24')][_0xaf13('0x25')]);_0x63d6eb['query']=_[_0xaf13('0x31')](_0x3908d9[_0xaf13('0x2b')]);_0x63d6eb[_0xaf13('0x32')]=_[_0xaf13('0x33')](_0x63d6eb[_0xaf13('0x30')],_0x63d6eb[_0xaf13('0x2b')]);_0x3a2a64[_0xaf13('0x34')]=_[_0xaf13('0x33')](_0x63d6eb[_0xaf13('0x30')],qs['fields'](_0x3908d9[_0xaf13('0x2b')][_0xaf13('0x35')]));_0x3a2a64[_0xaf13('0x34')]=_0x3a2a64['attributes'][_0xaf13('0x36')]?_0x3a2a64[_0xaf13('0x34')]:_0x63d6eb['model'];if(_0x3908d9['query'][_0xaf13('0x37')]){_0x3a2a64[_0xaf13('0x38')]=[{'all':!![]}];}_0x3a2a64=_[_0xaf13('0x39')]({},_0x3a2a64,_0x3908d9['options']);return db[_0xaf13('0x24')][_0xaf13('0x3a')](_0x3a2a64)['then'](handleEntityNotFound(_0x372f46,null))[_0xaf13('0x1d')](respondWithResult(_0x372f46,null))[_0xaf13('0x2d')](handleError(_0x372f46,null));};exports[_0xaf13('0x3b')]=function(_0x499e87,_0x29135c){return db[_0xaf13('0x24')]['create'](_0x499e87[_0xaf13('0x3c')],{})[_0xaf13('0x1d')](respondWithResult(_0x29135c,0xc9))[_0xaf13('0x2d')](handleError(_0x29135c,null));};exports[_0xaf13('0x1c')]=function(_0x59839c,_0x282137){if(_0x59839c[_0xaf13('0x3c')]['id']){delete _0x59839c[_0xaf13('0x3c')]['id'];}return db[_0xaf13('0x24')]['find']({'where':{'id':_0x59839c[_0xaf13('0x2f')]['id']}})[_0xaf13('0x1d')](handleEntityNotFound(_0x282137,null))[_0xaf13('0x1d')](saveUpdates(_0x59839c['body'],null))[_0xaf13('0x1d')](respondWithResult(_0x282137,null))[_0xaf13('0x2d')](handleError(_0x282137,null));};exports[_0xaf13('0x3d')]=function(_0x28de0e,_0x4aafee){return db[_0xaf13('0x24')][_0xaf13('0x3a')]({'where':{'id':_0x28de0e[_0xaf13('0x2f')]['id']}})[_0xaf13('0x1d')](handleEntityNotFound(_0x4aafee,null))[_0xaf13('0x1d')](removeEntity(_0x4aafee,null))[_0xaf13('0x2d')](handleError(_0x4aafee,null));};exports[_0xaf13('0x3e')]=function(_0x84c424,_0xc4387d){return db[_0xaf13('0x24')][_0xaf13('0x3e')]()[_0xaf13('0x1d')](respondWithResult(_0xc4387d,null))[_0xaf13('0x2d')](handleError(_0xc4387d,null));};exports['addMessage']=function(_0x522073,_0x2ba822){return db[_0xaf13('0x3f')][_0xaf13('0x3a')]({'where':{'id':_0x522073[_0xaf13('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2ba822,null))['then'](function(_0x434317){if(_0x434317){return _0x434317[_0xaf13('0x40')](_0x522073['body']['ids'],_['omit'](_0x522073[_0xaf13('0x3c')],['ids','id'])||{});}})[_0xaf13('0x1d')](respondWithResult(_0x2ba822,null))[_0xaf13('0x2d')](handleError(_0x2ba822,null));};exports['getMessages']=function(_0x3804e5,_0x3349da){var _0x268767={'raw':![],'where':{}};var _0x148fb7={};var _0x4c6975={'count':0x0,'rows':[]};return db[_0xaf13('0x24')][_0xaf13('0x41')]({'where':{'id':_0x3804e5[_0xaf13('0x2f')]['id']}})[_0xaf13('0x1d')](handleEntityNotFound(_0x3349da,null))[_0xaf13('0x1d')](function(_0x29799e){if(_0x29799e){_0x148fb7['model']=_[_0xaf13('0x31')](db[_0xaf13('0x3f')][_0xaf13('0x25')]);_0x148fb7[_0xaf13('0x2b')]=_[_0xaf13('0x31')](_0x3804e5['query']);_0x148fb7[_0xaf13('0x32')]=_[_0xaf13('0x33')](_0x148fb7['model'],_0x148fb7[_0xaf13('0x2b')]);_0x268767[_0xaf13('0x34')]=_['intersection'](_0x148fb7[_0xaf13('0x30')],qs['fields'](_0x3804e5[_0xaf13('0x2b')]['fields']));_0x268767['attributes']=_0x268767[_0xaf13('0x34')]['length']?_0x268767[_0xaf13('0x34')]:_0x148fb7['model'];if(!_0x3804e5[_0xaf13('0x2b')]['hasOwnProperty'](_0xaf13('0x42'))){_0x268767['limit']=qs['limit'](_0x3804e5[_0xaf13('0x2b')][_0xaf13('0x17')]);_0x268767[_0xaf13('0x16')]=qs[_0xaf13('0x16')](_0x3804e5['query'][_0xaf13('0x16')]);}_0x268767['order']=qs[_0xaf13('0x43')](_0x3804e5[_0xaf13('0x2b')][_0xaf13('0x43')]);_0x268767[_0xaf13('0x44')]=qs['filters'](_[_0xaf13('0x45')](_0x3804e5[_0xaf13('0x2b')],_0x148fb7[_0xaf13('0x32')]));_0x268767[_0xaf13('0x44')][_0xaf13('0x46')]=_0x29799e['id'];if(_0x3804e5[_0xaf13('0x2b')][_0xaf13('0x47')]){_0x268767[_0xaf13('0x44')]=_['merge'](_0x268767['where'],{'$or':_[_0xaf13('0x23')](_0x268767[_0xaf13('0x34')],function(_0x1401fc){var _0x40e8a4={};_0x40e8a4[_0x1401fc]={'$like':'%'+_0x3804e5['query'][_0xaf13('0x47')]+'%'};return _0x40e8a4;})});}if(_0x3804e5[_0xaf13('0x2b')][_0xaf13('0x48')]){var _0x299852=_0x3804e5[_0xaf13('0x2b')][_0xaf13('0x48')][_0xaf13('0x49')](',');var _0x5e949d={};_0x5e949d[_0x299852[0x0]]={'$gte':moment(_0x299852[0x1])[_0xaf13('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x268767[_0xaf13('0x44')]=_[_0xaf13('0x39')](_0x268767[_0xaf13('0x44')],_0x5e949d);}_0x268767=_[_0xaf13('0x39')]({},_0x268767,_0x3804e5[_0xaf13('0x4b')]);return db[_0xaf13('0x3f')]['count']({'where':_0x268767[_0xaf13('0x44')]})[_0xaf13('0x1d')](function(_0x26a3a5){_0x4c6975[_0xaf13('0x19')]=_0x26a3a5;if(_0x3804e5[_0xaf13('0x2b')][_0xaf13('0x37')]){_0x268767[_0xaf13('0x38')]=[{'all':!![]}];}return db[_0xaf13('0x3f')]['findAll'](_0x268767);})[_0xaf13('0x1d')](function(_0xa941f5){if(_0x3804e5[_0xaf13('0x2b')][_0xaf13('0x4c')]===_0xaf13('0x4d')){for(var _0x161c61=0x0;_0x161c61<_0xa941f5[_0xaf13('0x36')];_0x161c61++){_0xa941f5[_0x161c61][_0xaf13('0x3c')]=juice(_0xa941f5[_0x161c61]['body']);}}_0x4c6975[_0xaf13('0x4e')]=_0xa941f5;return _0x4c6975;});}})[_0xaf13('0x1d')](respondWithFilteredResult(_0x3349da,_0x268767))['catch'](handleError(_0x3349da,null));};exports['addTags']=function(_0x315c5d,_0x4eeb17){return db[_0xaf13('0x24')][_0xaf13('0x3a')]({'where':{'id':_0x315c5d[_0xaf13('0x2f')]['id']}})[_0xaf13('0x1d')](handleEntityNotFound(_0x4eeb17,null))['then'](function(_0x24fe9e){if(_0x24fe9e){return _0x24fe9e[_0xaf13('0x4f')](_0x315c5d[_0xaf13('0x3c')][_0xaf13('0x50')],_[_0xaf13('0x51')](_0x315c5d[_0xaf13('0x3c')],[_0xaf13('0x50'),'id'])||{})[_0xaf13('0x52')](function(){return db['Tag'][_0xaf13('0x29')]({'attributes':['id','name',_0xaf13('0x53')],'where':{'id':_0x315c5d[_0xaf13('0x3c')][_0xaf13('0x50')]}});})[_0xaf13('0x1d')](function(_0x4ceaba){socket[_0xaf13('0x54')](_0xaf13('0x55'),{'id':Number(_0x315c5d[_0xaf13('0x2f')]['id']),'tags':_0x4ceaba||[]});return{'id':Number(_0x315c5d[_0xaf13('0x2f')]['id']),'tags':_0x4ceaba||[]};});}})[_0xaf13('0x1d')](respondWithResult(_0x4eeb17,null))[_0xaf13('0x2d')](handleError(_0x4eeb17,null));};exports[_0xaf13('0x56')]=function(_0x3e9f2e,_0x2c9f51){return db[_0xaf13('0x24')][_0xaf13('0x3a')]({'where':{'id':_0x3e9f2e['params']['id']}})[_0xaf13('0x1d')](handleEntityNotFound(_0x2c9f51,null))[_0xaf13('0x1d')](function(_0x2e1ba1){if(_0x2e1ba1){return _0x2e1ba1['removeTags'](_0x3e9f2e['query']['ids']);}})[_0xaf13('0x1d')](respondWithStatusCode(_0x2c9f51,null))[_0xaf13('0x2d')](handleError(_0x2c9f51,null));};exports['download']=function(_0x512194,_0x2662e3){var _0x4c3a67=moment()[_0xaf13('0x57')]()[_0xaf13('0x58')]();var _0x430558=path['join'](config[_0xaf13('0x59')],_0xaf13('0x5a'),_0xaf13('0x5b'),_0xaf13('0x5c'));var _0x26fe7e=path[_0xaf13('0x5d')](config[_0xaf13('0x59')],_0xaf13('0x5a'),_0xaf13('0x5b'),_0xaf13('0x5e'));var _0x5e6fcf=path[_0xaf13('0x5d')](_0x430558,_0x4c3a67);var _0x5594e1=util[_0xaf13('0x4a')](_0xaf13('0x5f'),_0x512194['params']['id'],_0x4c3a67);var _0xeb86f6=path[_0xaf13('0x5d')](_0x430558,_0x5594e1);var _0x11f4ba=[];if(_0x512194['query'][_0xaf13('0x5e')]){_0x11f4ba[_0xaf13('0x60')]({'model':db[_0xaf13('0x61')],'as':'Attachments','raw':!![]});}var _0x56d93b=[{'model':db['MailMessage'],'as':_0xaf13('0x62'),'attributes':['id',_0xaf13('0x3c'),'from','to','cc',_0xaf13('0x63'),_0xaf13('0x64'),'createdAt'],'where':{'secret':![]},'order':qs[_0xaf13('0x43')]('id'),'include':_0x11f4ba}];return db[_0xaf13('0x24')]['find']({'where':{'id':_0x512194[_0xaf13('0x2f')]['id']},'include':_0x56d93b})['then'](handleEntityNotFound(_0x2662e3,null))[_0xaf13('0x1d')](function(_0x3aef63){if(_0x3aef63&&_0x3aef63[_0xaf13('0x62')]){var _0x5575a5=_0x3aef63[_0xaf13('0x65')]({'plain':!![]});fs[_0xaf13('0x66')](_0x5e6fcf);return BPromise['each'](_0x5575a5[_0xaf13('0x62')],function(_0x559184,_0x5f390c){var _0x2c4db1={'from':_0x559184[_0xaf13('0x67')],'to':_0x559184['to']||'missing.recipient@your.company.com','subject':_0x559184[_0xaf13('0x64')],'html':htmlEntities['decode'](_0x559184[_0xaf13('0x3c')]),'headers':{'Date':moment(_0x559184[_0xaf13('0x68')])[_0xaf13('0x4a')](_0xaf13('0x69'))},'attachments':[]};if(_0x559184['cc']){_0x2c4db1[_0xaf13('0x6a')]['Cc']=_0x559184['cc'];}if(_0x559184[_0xaf13('0x63')]){_0x2c4db1[_0xaf13('0x6a')]['Bcc']=_0x559184['bcc'];}return new BPromise(function(_0x3d1e98,_0x2a3755){if(_0x559184[_0xaf13('0x6b')]){for(var _0x54787b=0x0;_0x54787b<_0x559184[_0xaf13('0x6b')]['length'];_0x54787b++){var _0x339e80=_0x559184[_0xaf13('0x6b')][_0x54787b];var _0x67c4e5=path[_0xaf13('0x5d')](_0x26fe7e,_0x339e80['basename']);if(fs[_0xaf13('0x6c')](_0x67c4e5)){_0x2c4db1[_0xaf13('0x5e')]['push']({'name':_0x339e80[_0xaf13('0x21')],'contentType':_0x339e80[_0xaf13('0x27')],'data':fs[_0xaf13('0x6d')](_0x67c4e5)});}}}emlformat[_0xaf13('0x6e')](_0x2c4db1,function(_0x5111d8,_0x13f829){if(_0x5111d8)return _0x2a3755(_0x5111d8);fs['writeFileSync'](path[_0xaf13('0x5d')](_0x5e6fcf,util[_0xaf13('0x4a')](_0xaf13('0x6f'),_0x5f390c)),_0x13f829);return _0x3d1e98(_0x13f829);});});})[_0xaf13('0x1d')](function(){return new BPromise(function(_0x23827d,_0x58e022){zipdir(_0x5e6fcf,{'saveTo':_0xeb86f6},function(_0x399ec1,_0x7dd291){if(_0x399ec1)return _0x58e022(_0x399ec1);return _0x23827d(_0x7dd291);});})['then'](function(){return new BPromise(function(_0x276425,_0x534aa1){rimraf(_0x5e6fcf,function(_0x4c86df){if(_0x4c86df)_0x534aa1(_0x4c86df);return _0x276425();});});})['then'](function(){return _0x2662e3['download'](_0xeb86f6,_0x5594e1,function(_0x4c82c5){if(!_0x4c82c5)fs[_0xaf13('0x70')](_0xeb86f6);});});});}else{return _0x2662e3['sendStatus'](0xc8);}})[_0xaf13('0x2d')](handleError(_0x2662e3,null));}; \ No newline at end of file +var _0x5dc6=['set','Content-Range','then','error','stack','name','send','index','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','user','keys','filters','intersection','model','attributes','fields','length','includeAll','options','find','create','catch','update','body','params','destroy','describe','MailMessage','addMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','$gte','format','merge','include','inlineCss','true','rows','addTags','setTags','Tag','emit','removeTags','download','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachments','Messages','bcc','get','mkdirSync','each','from','missing.recipient@your.company.com','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','limit','undefined','count','offset'];(function(_0x5b9206,_0x6dd88b){var _0x4bea8a=function(_0x540d17){while(--_0x540d17){_0x5b9206['push'](_0x5b9206['shift']());}};_0x4bea8a(++_0x6dd88b);}(_0x5dc6,0x1bf));var _0x65dc=function(_0x24f09e,_0x19a571){_0x24f09e=_0x24f09e-0x0;var _0x4f014c=_0x5dc6[_0x24f09e];return _0x4f014c;};'use strict';var emlformat=require(_0x65dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65dc('0x1'));var moment=require(_0x65dc('0x2'));var BPromise=require(_0x65dc('0x3'));var util=require(_0x65dc('0x4'));var path=require(_0x65dc('0x5'));var fs=require('fs');var _=require(_0x65dc('0x6'));var juice=require(_0x65dc('0x7'));var Redis=require(_0x65dc('0x8'));var interaction=require(_0x65dc('0x9'));var qs=require(_0x65dc('0xa'));var logger=require(_0x65dc('0xb'))(_0x65dc('0xc'));var config=require(_0x65dc('0xd'));var db=require(_0x65dc('0xe'))['db'];var htmlEntities=require(_0x65dc('0xf'));config['redis']=_['defaults'](config[_0x65dc('0x10')],{'host':_0x65dc('0x11'),'port':0x18eb});var socket=require(_0x65dc('0x12'))(new Redis(config[_0x65dc('0x10')]));require(_0x65dc('0x13'))[_0x65dc('0x14')](socket);function respondWithStatusCode(_0x263082,_0x551c25){_0x551c25=_0x551c25||0xcc;return function(_0x217053){if(_0x217053){return _0x263082[_0x65dc('0x15')](_0x551c25);}return _0x263082[_0x65dc('0x16')](_0x551c25)[_0x65dc('0x17')]();};}function respondWithResult(_0x37c011,_0x58e90a){_0x58e90a=_0x58e90a||0xc8;return function(_0x44d3d4){if(_0x44d3d4){return _0x37c011[_0x65dc('0x16')](_0x58e90a)[_0x65dc('0x18')](_0x44d3d4);}};}function respondWithFilteredResult(_0x30c06d,_0x25321a){return function(_0x2481d1){if(_0x2481d1){var _0x60537b=typeof _0x25321a['offset']==='undefined'&&typeof _0x25321a[_0x65dc('0x19')]===_0x65dc('0x1a');var _0xb834ac=_0x2481d1[_0x65dc('0x1b')];var _0x502305=_0x60537b?0x0:_0x25321a[_0x65dc('0x1c')];var _0x2a532b=_0x60537b?_0x2481d1['count']:_0x25321a['offset']+_0x25321a[_0x65dc('0x19')];var _0x585801;if(_0x2a532b>=_0xb834ac){_0x2a532b=_0xb834ac;_0x585801=0xc8;}else{_0x585801=0xce;}_0x30c06d[_0x65dc('0x16')](_0x585801);return _0x30c06d[_0x65dc('0x1d')](_0x65dc('0x1e'),_0x502305+'-'+_0x2a532b+'/'+_0xb834ac)[_0x65dc('0x18')](_0x2481d1);}return null;};}function saveUpdates(_0x2f757b){return function(_0x240a95){if(_0x240a95){return _0x240a95['update'](_0x2f757b)[_0x65dc('0x1f')](function(_0x23347c){return _0x23347c;});}return null;};}function removeEntity(_0x3f4e8e){return function(_0x43baa2){if(_0x43baa2){return _0x43baa2['destroy']()[_0x65dc('0x1f')](function(){_0x3f4e8e[_0x65dc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x403e95){return function(_0x2cf358){if(!_0x2cf358){_0x403e95[_0x65dc('0x15')](0x194);}return _0x2cf358;};}function handleError(_0x444a53,_0x42ad78){_0x42ad78=_0x42ad78||0x1f4;return function(_0x160c1d){logger[_0x65dc('0x20')](_0x160c1d[_0x65dc('0x21')]);if(_0x160c1d[_0x65dc('0x22')]){delete _0x160c1d[_0x65dc('0x22')];}_0x444a53[_0x65dc('0x16')](_0x42ad78)[_0x65dc('0x23')](_0x160c1d);};}exports[_0x65dc('0x24')]=function(_0x282681,_0x40355f){var _0x2f45ad={};var _0x2002b7=_['map'](db[_0x65dc('0x25')][_0x65dc('0x26')],function(_0x4bdead){return{'name':_0x4bdead[_0x65dc('0x27')],'type':_0x4bdead[_0x65dc('0x28')][_0x65dc('0x29')]};});_0x2f45ad=qs[_0x65dc('0x2a')](_0x2002b7,_0x282681);return interaction[_0x65dc('0x2b')](_0x65dc('0x2c'),_0x282681[_0x65dc('0x2d')],_0x282681[_0x65dc('0x2e')],_0x2f45ad,_0x2002b7)[_0x65dc('0x1f')](respondWithFilteredResult(_0x40355f,_0x2f45ad))['catch'](handleError(_0x40355f,null));};exports['show']=function(_0x2bb2fe,_0x3cfbaa){var _0x3e72f2={'raw':![],'where':{'id':_0x2bb2fe['params']['id']}},_0x1c9cd5={};_0x1c9cd5['model']=_[_0x65dc('0x2f')](db[_0x65dc('0x25')][_0x65dc('0x26')]);_0x1c9cd5[_0x65dc('0x2d')]=_['keys'](_0x2bb2fe['query']);_0x1c9cd5[_0x65dc('0x30')]=_[_0x65dc('0x31')](_0x1c9cd5[_0x65dc('0x32')],_0x1c9cd5[_0x65dc('0x2d')]);_0x3e72f2[_0x65dc('0x33')]=_[_0x65dc('0x31')](_0x1c9cd5[_0x65dc('0x32')],qs['fields'](_0x2bb2fe['query'][_0x65dc('0x34')]));_0x3e72f2['attributes']=_0x3e72f2[_0x65dc('0x33')][_0x65dc('0x35')]?_0x3e72f2[_0x65dc('0x33')]:_0x1c9cd5[_0x65dc('0x32')];if(_0x2bb2fe[_0x65dc('0x2d')][_0x65dc('0x36')]){_0x3e72f2['include']=[{'all':!![]}];}_0x3e72f2=_['merge']({},_0x3e72f2,_0x2bb2fe[_0x65dc('0x37')]);return db['MailInteraction'][_0x65dc('0x38')](_0x3e72f2)['then'](handleEntityNotFound(_0x3cfbaa,null))[_0x65dc('0x1f')](respondWithResult(_0x3cfbaa,null))['catch'](handleError(_0x3cfbaa,null));};exports[_0x65dc('0x39')]=function(_0x338a80,_0x52612a){return db['MailInteraction'][_0x65dc('0x39')](_0x338a80['body'],{})[_0x65dc('0x1f')](respondWithResult(_0x52612a,0xc9))[_0x65dc('0x3a')](handleError(_0x52612a,null));};exports[_0x65dc('0x3b')]=function(_0xc93385,_0x19da91){if(_0xc93385[_0x65dc('0x3c')]['id']){delete _0xc93385['body']['id'];}return db['MailInteraction'][_0x65dc('0x38')]({'where':{'id':_0xc93385[_0x65dc('0x3d')]['id']}})[_0x65dc('0x1f')](handleEntityNotFound(_0x19da91,null))['then'](saveUpdates(_0xc93385[_0x65dc('0x3c')],null))[_0x65dc('0x1f')](respondWithResult(_0x19da91,null))[_0x65dc('0x3a')](handleError(_0x19da91,null));};exports[_0x65dc('0x3e')]=function(_0x174691,_0x5a4c70){return db[_0x65dc('0x25')][_0x65dc('0x38')]({'where':{'id':_0x174691['params']['id']}})[_0x65dc('0x1f')](handleEntityNotFound(_0x5a4c70,null))[_0x65dc('0x1f')](removeEntity(_0x5a4c70,null))[_0x65dc('0x3a')](handleError(_0x5a4c70,null));};exports['describe']=function(_0x3e80b2,_0x29ffb7){return db[_0x65dc('0x25')][_0x65dc('0x3f')]()[_0x65dc('0x1f')](respondWithResult(_0x29ffb7,null))[_0x65dc('0x3a')](handleError(_0x29ffb7,null));};exports['addMessage']=function(_0x1a7527,_0x200be5){return db[_0x65dc('0x40')]['find']({'where':{'id':_0x1a7527[_0x65dc('0x3d')]['id']}})[_0x65dc('0x1f')](handleEntityNotFound(_0x200be5,null))[_0x65dc('0x1f')](function(_0x78a9ea){if(_0x78a9ea){return _0x78a9ea[_0x65dc('0x41')](_0x1a7527['body']['ids'],_[_0x65dc('0x42')](_0x1a7527[_0x65dc('0x3c')],[_0x65dc('0x43'),'id'])||{});}})['then'](respondWithResult(_0x200be5,null))[_0x65dc('0x3a')](handleError(_0x200be5,null));};exports[_0x65dc('0x44')]=function(_0x125e54,_0x3948c7){var _0x2bfaf1={'raw':![],'where':{}};var _0x1621fc={};var _0x3eb394={'count':0x0,'rows':[]};return db['MailInteraction'][_0x65dc('0x45')]({'where':{'id':_0x125e54['params']['id']}})[_0x65dc('0x1f')](handleEntityNotFound(_0x3948c7,null))[_0x65dc('0x1f')](function(_0x252ef2){if(_0x252ef2){_0x1621fc[_0x65dc('0x32')]=_[_0x65dc('0x2f')](db[_0x65dc('0x40')][_0x65dc('0x26')]);_0x1621fc[_0x65dc('0x2d')]=_[_0x65dc('0x2f')](_0x125e54['query']);_0x1621fc[_0x65dc('0x30')]=_[_0x65dc('0x31')](_0x1621fc[_0x65dc('0x32')],_0x1621fc[_0x65dc('0x2d')]);_0x2bfaf1[_0x65dc('0x33')]=_['intersection'](_0x1621fc[_0x65dc('0x32')],qs[_0x65dc('0x34')](_0x125e54['query']['fields']));_0x2bfaf1['attributes']=_0x2bfaf1[_0x65dc('0x33')][_0x65dc('0x35')]?_0x2bfaf1[_0x65dc('0x33')]:_0x1621fc[_0x65dc('0x32')];if(!_0x125e54[_0x65dc('0x2d')][_0x65dc('0x46')](_0x65dc('0x47'))){_0x2bfaf1['limit']=qs[_0x65dc('0x19')](_0x125e54[_0x65dc('0x2d')][_0x65dc('0x19')]);_0x2bfaf1[_0x65dc('0x1c')]=qs[_0x65dc('0x1c')](_0x125e54[_0x65dc('0x2d')][_0x65dc('0x1c')]);}_0x2bfaf1[_0x65dc('0x48')]=qs[_0x65dc('0x49')](_0x125e54[_0x65dc('0x2d')][_0x65dc('0x49')]);_0x2bfaf1[_0x65dc('0x4a')]=qs['filters'](_[_0x65dc('0x4b')](_0x125e54[_0x65dc('0x2d')],_0x1621fc['filters']));_0x2bfaf1[_0x65dc('0x4a')]['MailInteractionId']=_0x252ef2['id'];if(_0x125e54[_0x65dc('0x2d')][_0x65dc('0x4c')]){_0x2bfaf1[_0x65dc('0x4a')]=_['merge'](_0x2bfaf1['where'],{'$or':_[_0x65dc('0x4d')](_0x2bfaf1['attributes'],function(_0x56ab02){var _0x30ead6={};_0x30ead6[_0x56ab02]={'$like':'%'+_0x125e54[_0x65dc('0x2d')][_0x65dc('0x4c')]+'%'};return _0x30ead6;})});}if(_0x125e54['query']['$gte']){var _0x22d313=_0x125e54['query'][_0x65dc('0x4e')]['split'](',');var _0x5c789c={};_0x5c789c[_0x22d313[0x0]]={'$gte':moment(_0x22d313[0x1])[_0x65dc('0x4f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2bfaf1[_0x65dc('0x4a')]=_[_0x65dc('0x50')](_0x2bfaf1[_0x65dc('0x4a')],_0x5c789c);}_0x2bfaf1=_[_0x65dc('0x50')]({},_0x2bfaf1,_0x125e54[_0x65dc('0x37')]);return db['MailMessage'][_0x65dc('0x1b')]({'where':_0x2bfaf1[_0x65dc('0x4a')]})['then'](function(_0x13a3a9){_0x3eb394[_0x65dc('0x1b')]=_0x13a3a9;if(_0x125e54[_0x65dc('0x2d')]['includeAll']){_0x2bfaf1[_0x65dc('0x51')]=[{'all':!![]}];}return db['MailMessage'][_0x65dc('0x2b')](_0x2bfaf1);})[_0x65dc('0x1f')](function(_0x197386){if(_0x125e54[_0x65dc('0x2d')][_0x65dc('0x52')]===_0x65dc('0x53')){for(var _0x5c0baf=0x0;_0x5c0baf<_0x197386['length'];_0x5c0baf++){_0x197386[_0x5c0baf][_0x65dc('0x3c')]=juice(_0x197386[_0x5c0baf][_0x65dc('0x3c')]);}}_0x3eb394[_0x65dc('0x54')]=_0x197386;return _0x3eb394;});}})[_0x65dc('0x1f')](respondWithFilteredResult(_0x3948c7,_0x2bfaf1))[_0x65dc('0x3a')](handleError(_0x3948c7,null));};exports[_0x65dc('0x55')]=function(_0x1d6562,_0x309b84){return db[_0x65dc('0x25')][_0x65dc('0x38')]({'where':{'id':_0x1d6562[_0x65dc('0x3d')]['id']}})[_0x65dc('0x1f')](handleEntityNotFound(_0x309b84,null))[_0x65dc('0x1f')](function(_0x564070){if(_0x564070){return _0x564070[_0x65dc('0x56')](_0x1d6562[_0x65dc('0x3c')][_0x65dc('0x43')],_[_0x65dc('0x42')](_0x1d6562[_0x65dc('0x3c')],['ids','id'])||{})['spread'](function(){return db[_0x65dc('0x57')][_0x65dc('0x2b')]({'attributes':['id','name','color'],'where':{'id':_0x1d6562[_0x65dc('0x3c')][_0x65dc('0x43')]}});})[_0x65dc('0x1f')](function(_0x1fdd25){socket[_0x65dc('0x58')]('mailInteractionTags:save',{'id':Number(_0x1d6562['params']['id']),'tags':_0x1fdd25||[]});return{'id':Number(_0x1d6562[_0x65dc('0x3d')]['id']),'tags':_0x1fdd25||[]};});}})[_0x65dc('0x1f')](respondWithResult(_0x309b84,null))[_0x65dc('0x3a')](handleError(_0x309b84,null));};exports[_0x65dc('0x59')]=function(_0x5b25e2,_0x44689f){return db[_0x65dc('0x25')][_0x65dc('0x38')]({'where':{'id':_0x5b25e2[_0x65dc('0x3d')]['id']}})[_0x65dc('0x1f')](handleEntityNotFound(_0x44689f,null))['then'](function(_0x14b7ae){if(_0x14b7ae){return _0x14b7ae[_0x65dc('0x59')](_0x5b25e2[_0x65dc('0x2d')][_0x65dc('0x43')]);}})[_0x65dc('0x1f')](respondWithStatusCode(_0x44689f,null))['catch'](handleError(_0x44689f,null));};exports[_0x65dc('0x5a')]=function(_0x30fe45,_0x588185){var _0x3857fe=moment()[_0x65dc('0x5b')]()[_0x65dc('0x5c')]();var _0x3da3e7=path[_0x65dc('0x5d')](config[_0x65dc('0x5e')],'server',_0x65dc('0x5f'),_0x65dc('0x60'));var _0x1142f6=path[_0x65dc('0x5d')](config['root'],_0x65dc('0x61'),'files',_0x65dc('0x62'));var _0x3f4457=path[_0x65dc('0x5d')](_0x3da3e7,_0x3857fe);var _0x2059b3=util[_0x65dc('0x4f')](_0x65dc('0x63'),_0x30fe45[_0x65dc('0x3d')]['id'],_0x3857fe);var _0x4bf969=path[_0x65dc('0x5d')](_0x3da3e7,_0x2059b3);var _0x50bda2=[];if(_0x30fe45[_0x65dc('0x2d')][_0x65dc('0x62')]){_0x50bda2['push']({'model':db['Attachment'],'as':_0x65dc('0x64'),'raw':!![]});}var _0x171ac6=[{'model':db['MailMessage'],'as':_0x65dc('0x65'),'attributes':['id',_0x65dc('0x3c'),'from','to','cc',_0x65dc('0x66'),'subject','createdAt'],'where':{'secret':![]},'order':qs[_0x65dc('0x49')]('id'),'include':_0x50bda2}];return db['MailInteraction'][_0x65dc('0x38')]({'where':{'id':_0x30fe45['params']['id']},'include':_0x171ac6})[_0x65dc('0x1f')](handleEntityNotFound(_0x588185,null))['then'](function(_0x9c1521){if(_0x9c1521&&_0x9c1521[_0x65dc('0x65')]){var _0x245c74=_0x9c1521[_0x65dc('0x67')]({'plain':!![]});fs[_0x65dc('0x68')](_0x3f4457);return BPromise[_0x65dc('0x69')](_0x245c74[_0x65dc('0x65')],function(_0x1277bc,_0x4d737a){var _0xa77042={'from':_0x1277bc[_0x65dc('0x6a')],'to':_0x1277bc['to']||_0x65dc('0x6b'),'subject':_0x1277bc[_0x65dc('0x6c')],'html':htmlEntities['decode'](_0x1277bc[_0x65dc('0x3c')]),'headers':{'Date':moment(_0x1277bc[_0x65dc('0x6d')])[_0x65dc('0x4f')](_0x65dc('0x6e'))},'attachments':[]};if(_0x1277bc['cc']){_0xa77042['headers']['Cc']=_0x1277bc['cc'];}if(_0x1277bc['bcc']){_0xa77042[_0x65dc('0x6f')]['Bcc']=_0x1277bc['bcc'];}return new BPromise(function(_0x31b012,_0x31846e){if(_0x1277bc[_0x65dc('0x64')]){for(var _0x377028=0x0;_0x377028<_0x1277bc[_0x65dc('0x64')]['length'];_0x377028++){var _0x49913b=_0x1277bc[_0x65dc('0x64')][_0x377028];var _0x2c9346=path[_0x65dc('0x5d')](_0x1142f6,_0x49913b[_0x65dc('0x70')]);if(fs[_0x65dc('0x71')](_0x2c9346)){_0xa77042[_0x65dc('0x62')]['push']({'name':_0x49913b['name'],'contentType':_0x49913b[_0x65dc('0x28')],'data':fs[_0x65dc('0x72')](_0x2c9346)});}}}emlformat[_0x65dc('0x73')](_0xa77042,function(_0x28151c,_0x24e46f){if(_0x28151c)return _0x31846e(_0x28151c);fs[_0x65dc('0x74')](path[_0x65dc('0x5d')](_0x3f4457,util['format'](_0x65dc('0x75'),_0x4d737a)),_0x24e46f);return _0x31b012(_0x24e46f);});});})[_0x65dc('0x1f')](function(){return new BPromise(function(_0x2f6898,_0x5a9b0d){zipdir(_0x3f4457,{'saveTo':_0x4bf969},function(_0x57fbec,_0x5428ff){if(_0x57fbec)return _0x5a9b0d(_0x57fbec);return _0x2f6898(_0x5428ff);});})[_0x65dc('0x1f')](function(){return new BPromise(function(_0x310bb9,_0x997a72){rimraf(_0x3f4457,function(_0xd33363){if(_0xd33363)_0x997a72(_0xd33363);return _0x310bb9();});});})['then'](function(){return _0x588185[_0x65dc('0x5a')](_0x4bf969,_0x2059b3,function(_0x38a247){if(!_0x38a247)fs[_0x65dc('0x76')](_0x4bf969);});});});}else{return _0x588185[_0x65dc('0x15')](0xc8);}})[_0x65dc('0x3a')](handleError(_0x588185,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index be0487b..b14cf2d 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 _0x0f61=['then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x59bd39,_0x63c2a5){var _0xf2bc65=function(_0x589710){while(--_0x589710){_0x59bd39['push'](_0x59bd39['shift']());}};_0xf2bc65(++_0x63c2a5);}(_0x0f61,0x1eb));var _0x10f6=function(_0x41c63e,_0x18a959){_0x41c63e=_0x41c63e-0x0;var _0x337e7f=_0x0f61[_0x41c63e];return _0x337e7f;};'use strict';var EventEmitter=require(_0x10f6('0x0'));var MailInteraction=require(_0x10f6('0x1'))['db'][_0x10f6('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x10f6('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x10f6('0x4')](0x0);var events={'afterCreate':_0x10f6('0x5'),'afterUpdate':_0x10f6('0x6'),'afterDestroy':_0x10f6('0x7')};function emitEvent(_0x549dac){return function(_0x101dc9,_0x100e97,_0x3283f6){_0x101dc9[_0x10f6('0x8')]({'attributes':['id'],'raw':!![]})[_0x10f6('0x9')](function(_0x36b311){_0x101dc9[_0x10f6('0xa')](_0x10f6('0xb'),_0x36b311[_0x10f6('0xc')](function(_0x37af60){return{'id':_0x37af60['id']};}));return MailMessage[_0x10f6('0xd')]({'where':{'MailInteractionId':_0x101dc9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x10f6('0x9')](function(_0x73cfbc){_0x101dc9['setDataValue']('unreadMessages',_0x73cfbc[_0x10f6('0xe')]);MailInteractionEvents[_0x10f6('0xf')](_0x549dac+':'+_0x101dc9['id'],_0x101dc9);MailInteractionEvents['emit'](_0x549dac,_0x101dc9);_0x3283f6(null);})[_0x10f6('0x10')](_0x3283f6(null));};}for(var e in events){if(events[_0x10f6('0x11')](e)){var event=events[e];MailInteraction[_0x10f6('0x12')](e,emitEvent(event));}}module[_0x10f6('0x13')]=MailInteractionEvents; \ No newline at end of file +var _0xa10c=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','unreadMessages'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xa10c,0x116));var _0xca10=function(_0x35f676,_0x57d50e){_0x35f676=_0x35f676-0x0;var _0x440491=_0xa10c[_0x35f676];return _0x440491;};'use strict';var EventEmitter=require(_0xca10('0x0'));var MailInteraction=require(_0xca10('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xca10('0x2')](0x0);var events={'afterCreate':_0xca10('0x3'),'afterUpdate':_0xca10('0x4'),'afterDestroy':_0xca10('0x5')};function emitEvent(_0x1b4771){return function(_0x44a99b,_0xa03c08,_0x24c12f){_0x44a99b[_0xca10('0x6')]({'attributes':['id'],'raw':!![]})[_0xca10('0x7')](function(_0x3f2b82){_0x44a99b[_0xca10('0x8')](_0xca10('0x9'),_0x3f2b82['map'](function(_0x252525){return{'id':_0x252525['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x44a99b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x58f5c8){_0x44a99b[_0xca10('0x8')](_0xca10('0xa'),_0x58f5c8[_0xca10('0xb')]);MailInteractionEvents[_0xca10('0xc')](_0x1b4771+':'+_0x44a99b['id'],_0x44a99b);MailInteractionEvents['emit'](_0x1b4771,_0x44a99b);_0x24c12f(null);})[_0xca10('0xd')](_0x24c12f(null));};}for(var e in events){if(events[_0xca10('0xe')](e)){var event=events[e];MailInteraction[_0xca10('0xf')](e,emitEvent(event));}}module[_0xca10('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index c48e9bf..263905f 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 _0x503c=['./mailInteraction.attributes','exports','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','models','get','then','utf8mb4','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x503c,0xb9));var _0xc503=function(_0x23faab,_0xa1862a){_0x23faab=_0x23faab-0x0;var _0x54a717=_0x503c[_0x23faab];return _0x54a717;};'use strict';var _=require(_0xc503('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc503('0x1'));var moment=require('moment');var BPromise=require(_0xc503('0x2'));var rp=require(_0xc503('0x3'));var fs=require('fs');var path=require(_0xc503('0x4'));var rimraf=require(_0xc503('0x5'));var config=require(_0xc503('0x6'));var attributes=require(_0xc503('0x7'));module[_0xc503('0x8')]=function(_0x20571e,_0x116abc){return _0x20571e['define'](_0xc503('0x9'),attributes,{'tableName':_0xc503('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xc503('0xb'),'to'],'type':_0xc503('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x13897e,_0x7e3023,_0x4181f6){if(_0x13897e[_0xc503('0xd')]){_0x13897e[_0xc503('0xe')]=moment()[_0xc503('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x13897e[_0xc503('0x10')]){_0x13897e[_0xc503('0x11')]=moment()[_0xc503('0xf')](_0xc503('0x12'));}_0x4181f6(null,_0x7e3023);},'beforeUpdate':function(_0x284cad,_0x30a959,_0x50dc36){if(_0x284cad[_0xc503('0x13')]('substatus')){_0x284cad[_0xc503('0xe')]=_0x284cad[_0xc503('0xd')]?moment()[_0xc503('0xf')](_0xc503('0x12')):null;}if(_0x284cad[_0xc503('0x13')]('closed')){_0x284cad[_0xc503('0x11')]=moment()['format'](_0xc503('0x12'));_0x284cad[_0xc503('0xd')]=null;_0x284cad[_0xc503('0xe')]=null;}_0x50dc36(null,_0x284cad);},'afterUpdate':function(_0x3d5d30,_0x267412,_0x2a8dab){var _0x56efaf=_0x20571e[_0xc503('0x14')];var _0x5e814e=_0x3d5d30[_0xc503('0x15')]({'plain':!![]});if(_0x5e814e[_0xc503('0x10')]){return _0x56efaf['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x5e814e['id']}})[_0xc503('0x16')](function(){_0x2a8dab();})['catch'](function(_0x293e7e){_0x2a8dab(_0x293e7e);});}else{_0x2a8dab();}}},'charset':_0xc503('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3d80=['moment','bluebird','request-promise','path','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','update','catch','util','../../config/logger'];(function(_0x17dcfb,_0x4bf978){var _0x3f6f27=function(_0x174ef1){while(--_0x174ef1){_0x17dcfb['push'](_0x17dcfb['shift']());}};_0x3f6f27(++_0x4bf978);}(_0x3d80,0x16e));var _0x03d8=function(_0x2e9f92,_0x5cfbb8){_0x2e9f92=_0x2e9f92-0x0;var _0x2e5c5a=_0x3d80[_0x2e9f92];return _0x2e5c5a;};'use strict';var _=require('lodash');var util=require(_0x03d8('0x0'));var logger=require(_0x03d8('0x1'))('api');var moment=require(_0x03d8('0x2'));var BPromise=require(_0x03d8('0x3'));var rp=require(_0x03d8('0x4'));var fs=require('fs');var path=require(_0x03d8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x03d8('0x6'));module[_0x03d8('0x7')]=function(_0x44d9e3,_0x4fa4dd){return _0x44d9e3['define'](_0x03d8('0x8'),attributes,{'tableName':_0x03d8('0x9'),'paranoid':![],'indexes':[{'name':_0x03d8('0xa'),'fields':[_0x03d8('0xb'),'to'],'type':_0x03d8('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x374b7f,_0x364e00,_0x1a74c9){if(_0x374b7f[_0x03d8('0xd')]){_0x374b7f['substatusAt']=moment()[_0x03d8('0xe')](_0x03d8('0xf'));}if(_0x374b7f[_0x03d8('0x10')]){_0x374b7f[_0x03d8('0x11')]=moment()[_0x03d8('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1a74c9(null,_0x364e00);},'beforeUpdate':function(_0x4c0df4,_0x41ed91,_0x440ebd){if(_0x4c0df4['changed']('substatus')){_0x4c0df4['substatusAt']=_0x4c0df4[_0x03d8('0xd')]?moment()[_0x03d8('0xe')](_0x03d8('0xf')):null;}if(_0x4c0df4[_0x03d8('0x12')](_0x03d8('0x10'))){_0x4c0df4[_0x03d8('0x11')]=moment()[_0x03d8('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c0df4['substatus']=null;_0x4c0df4['substatusAt']=null;}_0x440ebd(null,_0x4c0df4);},'afterUpdate':function(_0x395b81,_0x173274,_0x2d0347){var _0x351d4e=_0x44d9e3[_0x03d8('0x13')];var _0x1602b6=_0x395b81[_0x03d8('0x14')]({'plain':!![]});if(_0x1602b6[_0x03d8('0x10')]){return _0x351d4e['MailMessage'][_0x03d8('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x1602b6['id']}})['then'](function(){_0x2d0347();})[_0x03d8('0x16')](function(_0x4ea6a9){_0x2d0347(_0x4ea6a9);});}else{_0x2d0347();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ec0235b..2f5a30d 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 _0x4cc7=['debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','AddTagsToMailInteraction','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x52655c,_0x1a81c3){var _0x50c440=function(_0x20573d){while(--_0x20573d){_0x52655c['push'](_0x52655c['shift']());}};_0x50c440(++_0x1a81c3);}(_0x4cc7,0x1b6));var _0x74cc=function(_0x3bbd0e,_0x54966f){_0x3bbd0e=_0x3bbd0e-0x0;var _0x1075e3=_0x4cc7[_0x3bbd0e];return _0x1075e3;};'use strict';var _=require(_0x74cc('0x0'));var util=require(_0x74cc('0x1'));var moment=require(_0x74cc('0x2'));var BPromise=require(_0x74cc('0x3'));var rs=require(_0x74cc('0x4'));var fs=require('fs');var Redis=require(_0x74cc('0x5'));var db=require(_0x74cc('0x6'))['db'];var utils=require(_0x74cc('0x7'));var logger=require('../../config/logger')(_0x74cc('0x8'));var config=require(_0x74cc('0x9'));var jayson=require(_0x74cc('0xa'));var client=jayson[_0x74cc('0xb')][_0x74cc('0xc')]({'port':0x232a});config[_0x74cc('0xd')]=_[_0x74cc('0xe')](config[_0x74cc('0xd')],{'host':_0x74cc('0xf'),'port':0x18eb});var socket=require(_0x74cc('0x10'))(new Redis(config[_0x74cc('0xd')]));require(_0x74cc('0x11'))[_0x74cc('0x12')](socket);function respondWithRpcPromise(_0x493be4,_0x2b10f5,_0x19d928){return new BPromise(function(_0x21e3a5,_0x20fb78){return client[_0x74cc('0x13')](_0x493be4,_0x19d928)[_0x74cc('0x14')](function(_0x2d2d17){logger[_0x74cc('0x15')](_0x74cc('0x16'),_0x2b10f5,_0x74cc('0x17'));logger[_0x74cc('0x18')](_0x74cc('0x19'),_0x2b10f5,'request\x20sent',JSON[_0x74cc('0x1a')](_0x2d2d17));if(_0x2d2d17[_0x74cc('0x1b')]){if(_0x2d2d17[_0x74cc('0x1b')]['code']===0x1f4){logger[_0x74cc('0x1b')](_0x74cc('0x16'),_0x2b10f5,_0x2d2d17[_0x74cc('0x1b')][_0x74cc('0x1c')]);return _0x20fb78(_0x2d2d17[_0x74cc('0x1b')][_0x74cc('0x1c')]);}logger[_0x74cc('0x1b')](_0x74cc('0x16'),_0x2b10f5,_0x2d2d17[_0x74cc('0x1b')]['message']);return _0x21e3a5(_0x2d2d17['error'][_0x74cc('0x1c')]);}else{logger[_0x74cc('0x15')](_0x74cc('0x16'),_0x2b10f5,_0x74cc('0x17'));_0x21e3a5(_0x2d2d17[_0x74cc('0x1d')]['message']);}})[_0x74cc('0x1e')](function(_0x1bd301){logger[_0x74cc('0x1b')](_0x74cc('0x16'),_0x2b10f5,_0x1bd301);_0x20fb78(_0x1bd301);});});}exports[_0x74cc('0x1f')]=function(_0x744ea2){var _0x3dc1c1=this;return new Promise(function(_0x261bf7,_0x477605){return db[_0x74cc('0x20')]['update'](_0x744ea2[_0x74cc('0x21')],{'raw':_0x744ea2[_0x74cc('0x22')]?_0x744ea2[_0x74cc('0x22')][_0x74cc('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x744ea2[_0x74cc('0x22')]?_0x744ea2[_0x74cc('0x22')][_0x74cc('0x24')]||null:null,'attributes':_0x744ea2[_0x74cc('0x22')]?_0x744ea2[_0x74cc('0x22')]['attributes']||null:null,'limit':_0x744ea2[_0x74cc('0x22')]?_0x744ea2[_0x74cc('0x22')]['limit']||null:null})[_0x74cc('0x14')](function(_0x1a2707){logger[_0x74cc('0x15')](_0x74cc('0x1f'),_0x744ea2);logger[_0x74cc('0x18')]('UpdateMailInteraction',_0x744ea2,JSON[_0x74cc('0x1a')](_0x1a2707));_0x261bf7(_0x1a2707);})[_0x74cc('0x1e')](function(_0x47c32f){logger[_0x74cc('0x1b')](_0x74cc('0x1f'),_0x47c32f[_0x74cc('0x1c')],_0x744ea2);_0x477605(_0x3dc1c1[_0x74cc('0x1b')](0x1f4,_0x47c32f[_0x74cc('0x1c')]));});});};exports[_0x74cc('0x25')]=function(_0x581872){return new Promise(function(_0x2c671c,_0x42a856){return db['MailInteraction']['find']({'where':_0x581872[_0x74cc('0x22')]?_0x581872[_0x74cc('0x22')][_0x74cc('0x24')]||null:null})[_0x74cc('0x14')](function(_0x24e26a){if(_0x24e26a){return _0x24e26a[_0x74cc('0x26')](_0x581872[_0x74cc('0x21')]['ids'],_[_0x74cc('0x27')](_0x581872[_0x74cc('0x21')],[_0x74cc('0x28'),'id'])||{});}})['spread'](function(_0x2d87c2){logger[_0x74cc('0x15')](_0x74cc('0x29'),_0x581872);logger[_0x74cc('0x18')](_0x74cc('0x29'),_0x581872,JSON[_0x74cc('0x1a')](_0x2d87c2));_0x2c671c(_0x2d87c2);})[_0x74cc('0x1e')](function(_0x12b72a){logger[_0x74cc('0x1b')](_0x74cc('0x29'),_0x12b72a[_0x74cc('0x1c')],_0x581872);_0x42a856(_this[_0x74cc('0x1b')](0x1f4,_0x12b72a[_0x74cc('0x1c')]));});});}; \ No newline at end of file +var _0xcff7=['result','catch','body','options','where','limit','then','UpdateMailInteraction','AddTagsToMailInteraction','MailInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','request','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x418549,_0x11b13d){var _0x288826=function(_0x3c0411){while(--_0x3c0411){_0x418549['push'](_0x418549['shift']());}};_0x288826(++_0x11b13d);}(_0xcff7,0xc8));var _0x7cff=function(_0x48612f,_0x226fbd){_0x48612f=_0x48612f-0x0;var _0x4515eb=_0xcff7[_0x48612f];return _0x4515eb;};'use strict';var _=require(_0x7cff('0x0'));var util=require(_0x7cff('0x1'));var moment=require(_0x7cff('0x2'));var BPromise=require(_0x7cff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7cff('0x4'));var db=require(_0x7cff('0x5'))['db'];var utils=require(_0x7cff('0x6'));var logger=require(_0x7cff('0x7'))(_0x7cff('0x8'));var config=require('../../config/environment');var jayson=require(_0x7cff('0x9'));var client=jayson[_0x7cff('0xa')][_0x7cff('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7cff('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7cff('0xc')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x46d711,_0x3e111e,_0x5bc816){return new BPromise(function(_0x5f1010,_0x369a70){return client[_0x7cff('0xd')](_0x46d711,_0x5bc816)['then'](function(_0x11df85){logger['info'](_0x7cff('0xe'),_0x3e111e,'request\x20sent');logger[_0x7cff('0xf')](_0x7cff('0x10'),_0x3e111e,_0x7cff('0x11'),JSON[_0x7cff('0x12')](_0x11df85));if(_0x11df85[_0x7cff('0x13')]){if(_0x11df85[_0x7cff('0x13')][_0x7cff('0x14')]===0x1f4){logger[_0x7cff('0x13')]('MailInteraction,\x20%s,\x20%s',_0x3e111e,_0x11df85['error'][_0x7cff('0x15')]);return _0x369a70(_0x11df85[_0x7cff('0x13')][_0x7cff('0x15')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x3e111e,_0x11df85[_0x7cff('0x13')]['message']);return _0x5f1010(_0x11df85[_0x7cff('0x13')][_0x7cff('0x15')]);}else{logger['info'](_0x7cff('0xe'),_0x3e111e,_0x7cff('0x11'));_0x5f1010(_0x11df85[_0x7cff('0x16')][_0x7cff('0x15')]);}})[_0x7cff('0x17')](function(_0x37270f){logger[_0x7cff('0x13')](_0x7cff('0xe'),_0x3e111e,_0x37270f);_0x369a70(_0x37270f);});});}exports['UpdateMailInteraction']=function(_0x1914cd){var _0x4ab9f7=this;return new Promise(function(_0x3d40f2,_0x2a62e6){return db['MailInteraction']['update'](_0x1914cd[_0x7cff('0x18')],{'raw':_0x1914cd['options']?_0x1914cd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1914cd[_0x7cff('0x19')]?_0x1914cd['options'][_0x7cff('0x1a')]||null:null,'attributes':_0x1914cd['options']?_0x1914cd[_0x7cff('0x19')]['attributes']||null:null,'limit':_0x1914cd['options']?_0x1914cd[_0x7cff('0x19')][_0x7cff('0x1b')]||null:null})[_0x7cff('0x1c')](function(_0x218688){logger['info']('UpdateMailInteraction',_0x1914cd);logger[_0x7cff('0xf')](_0x7cff('0x1d'),_0x1914cd,JSON[_0x7cff('0x12')](_0x218688));_0x3d40f2(_0x218688);})['catch'](function(_0x329ce1){logger[_0x7cff('0x13')](_0x7cff('0x1d'),_0x329ce1[_0x7cff('0x15')],_0x1914cd);_0x2a62e6(_0x4ab9f7[_0x7cff('0x13')](0x1f4,_0x329ce1[_0x7cff('0x15')]));});});};exports[_0x7cff('0x1e')]=function(_0x570c74){return new Promise(function(_0xdf3f37,_0x256ad6){return db[_0x7cff('0x1f')][_0x7cff('0x20')]({'where':_0x570c74['options']?_0x570c74[_0x7cff('0x19')]['where']||null:null})['then'](function(_0x5e19b2){if(_0x5e19b2){return _0x5e19b2[_0x7cff('0x21')](_0x570c74[_0x7cff('0x18')][_0x7cff('0x22')],_['omit'](_0x570c74[_0x7cff('0x18')],[_0x7cff('0x22'),'id'])||{});}})[_0x7cff('0x23')](function(_0x159dbd){logger['info']('AddTags',_0x570c74);logger[_0x7cff('0xf')](_0x7cff('0x24'),_0x570c74,JSON[_0x7cff('0x12')](_0x159dbd));_0xdf3f37(_0x159dbd);})[_0x7cff('0x17')](function(_0x24ac70){logger['error'](_0x7cff('0x24'),_0x24ac70[_0x7cff('0x15')],_0x570c74);_0x256ad6(_this[_0x7cff('0x13')](0x1f4,_0x24ac70['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index ca19d0b..4ab7e0e 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 _0x29dc=['remove','update','emit','removeListener','register','length','./mailInteraction.events','save'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x29dc,0x1e6));var _0xc29d=function(_0x4dd571,_0x18b238){_0x4dd571=_0x4dd571-0x0;var _0x9000e0=_0x29dc[_0x4dd571];return _0x9000e0;};'use strict';var MailInteractionEvents=require(_0xc29d('0x0'));var events=[_0xc29d('0x1'),_0xc29d('0x2'),_0xc29d('0x3')];function createListener(_0xd3409,_0x62fe0f){return function(_0x3a405c){_0x62fe0f[_0xc29d('0x4')](_0xd3409,_0x3a405c);};}function removeListener(_0x426d22,_0x1bca8a){return function(){MailInteractionEvents[_0xc29d('0x5')](_0x426d22,_0x1bca8a);};}exports[_0xc29d('0x6')]=function(_0x2cea9c){for(var _0x52f6b7=0x0,_0x517abe=events[_0xc29d('0x7')];_0x52f6b7<_0x517abe;_0x52f6b7++){var _0x12cb38=events[_0x52f6b7];var _0x101b94=createListener('mailInteraction:'+_0x12cb38,_0x2cea9c);MailInteractionEvents['on'](_0x12cb38,_0x101b94);}}; \ No newline at end of file +var _0xe352=['./mailInteraction.events','remove','update','removeListener','length','mailInteraction:'];(function(_0xf51c06,_0x388e5b){var _0x1d5420=function(_0x5e077b){while(--_0x5e077b){_0xf51c06['push'](_0xf51c06['shift']());}};_0x1d5420(++_0x388e5b);}(_0xe352,0xae));var _0x2e35=function(_0x5e0e15,_0xb04cf9){_0x5e0e15=_0x5e0e15-0x0;var _0x11bff5=_0xe352[_0x5e0e15];return _0x11bff5;};'use strict';var MailInteractionEvents=require(_0x2e35('0x0'));var events=['save',_0x2e35('0x1'),_0x2e35('0x2')];function createListener(_0x53344d,_0x28799a){return function(_0x3340b0){_0x28799a['emit'](_0x53344d,_0x3340b0);};}function removeListener(_0x37aecd,_0x508a8f){return function(){MailInteractionEvents[_0x2e35('0x3')](_0x37aecd,_0x508a8f);};}exports['register']=function(_0x2bca49){for(var _0x5c10a9=0x0,_0x3e9710=events[_0x2e35('0x4')];_0x5c10a9<_0x3e9710;_0x5c10a9++){var _0x372e1d=events[_0x5c10a9];var _0x57d3ab=createListener(_0x2e35('0x5')+_0x372e1d,_0x2bca49);MailInteractionEvents['on'](_0x372e1d,_0x57d3ab);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 485c768..f746889 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bae=['Router','../../components/auth/service','./mailInteractionHasTag.controller','get','/describe','describe','express'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x2bae,0x164));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xe2ba('0x0'));var router=express[_0xe2ba('0x1')]();var auth=require(_0xe2ba('0x2'));var controller=require(_0xe2ba('0x3'));router[_0xe2ba('0x4')](_0xe2ba('0x5'),auth['isAuthenticated'](),controller[_0xe2ba('0x6')]);module['exports']=router; \ No newline at end of file +var _0xe5a6=['get','/describe','describe','exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0xe5a6,0x104));var _0x6e5a=function(_0x32ce61,_0x2ba733){_0x32ce61=_0x32ce61-0x0;var _0x28eded=_0xe5a6[_0x32ce61];return _0x28eded;};'use strict';var express=require(_0x6e5a('0x0'));var router=express[_0x6e5a('0x1')]();var auth=require(_0x6e5a('0x2'));var controller=require(_0x6e5a('0x3'));router[_0x6e5a('0x4')](_0x6e5a('0x5'),auth['isAuthenticated'](),controller[_0x6e5a('0x6')]);module[_0x6e5a('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index ad28f6f..9dacbe3 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x52d44c,_0x556472){var _0x457947=function(_0x5b40d3){while(--_0x5b40d3){_0x52d44c['push'](_0x52d44c['shift']());}};_0x457947(++_0x556472);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x2e0eeb,_0x44cbc5){var _0x466172=function(_0x49a636){while(--_0x49a636){_0x2e0eeb['push'](_0x2e0eeb['shift']());}};_0x466172(++_0x44cbc5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 3e20e6a..3f87ea2 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x09f7=['INTEGER','sequelize','exports'];(function(_0x498c78,_0x2eab48){var _0xb7697f=function(_0x1f6da7){while(--_0x1f6da7){_0x498c78['push'](_0x498c78['shift']());}};_0xb7697f(++_0x2eab48);}(_0x09f7,0x9a));var _0x709f=function(_0x15ae1a,_0x131b9d){_0x15ae1a=_0x15ae1a-0x0;var _0x3f84a9=_0x09f7[_0x15ae1a];return _0x3f84a9;};'use strict';var Sequelize=require(_0x709f('0x0'));module[_0x709f('0x1')]={'MailInteractionId':{'type':Sequelize[_0x709f('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x0706=['sequelize','INTEGER'];(function(_0x50667f,_0x27419c){var _0x45112f=function(_0xfd66e0){while(--_0xfd66e0){_0x50667f['push'](_0x50667f['shift']());}};_0x45112f(++_0x27419c);}(_0x0706,0x8c));var _0x6070=function(_0x2897d3,_0x137ec2){_0x2897d3=_0x2897d3-0x0;var _0x4416bf=_0x0706[_0x2897d3];return _0x4416bf;};'use strict';var Sequelize=require(_0x6070('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize[_0x6070('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x6070('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index bfa719b..0921ac9 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfda=['mail_interaction_has_tags','./mailInteractionHasTag','define','MailInteractionHasTag'];(function(_0x229fbf,_0x22dbf4){var _0x168f24=function(_0x406f83){while(--_0x406f83){_0x229fbf['push'](_0x229fbf['shift']());}};_0x168f24(++_0x22dbf4);}(_0xbfda,0x169));var _0xabfd=function(_0x24a737,_0x3ff299){_0x24a737=_0x24a737-0x0;var _0x37b618=_0xbfda[_0x24a737];return _0x37b618;};'use strict';var attributes=require(_0xabfd('0x0'));module['exports']=function(_0x49fa25){return _0x49fa25[_0xabfd('0x1')](_0xabfd('0x2'),attributes,{'tableName':_0xabfd('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80b5=['exports'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x80b5,0x13a));var _0x580b=function(_0x5c1449,_0x2af4b4){_0x5c1449=_0x5c1449-0x0;var _0x270473=_0x80b5[_0x5c1449];return _0x270473;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0x580b('0x0')]=function(_0x4bc50e){return _0x4bc50e['define']('MailInteractionHasTag',attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index eeba1b3..247057b 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 _0x3c60=['create','put','update','accept','reject','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','./mailMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x3c60,0x14c));var _0x03c6=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x3c60[_0x496333];return _0x44256e;};'use strict';var multer=require('multer');var util=require(_0x03c6('0x0'));var path=require(_0x03c6('0x1'));var timeout=require(_0x03c6('0x2'));var express=require(_0x03c6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x03c6('0x4'));var config=require('../../config/environment');var controller=require(_0x03c6('0x5'));router[_0x03c6('0x6')]('/',auth['isAuthenticated'](),controller[_0x03c6('0x7')]);router['get'](_0x03c6('0x8'),auth[_0x03c6('0x9')](),controller[_0x03c6('0xa')]);router['get'](_0x03c6('0xb'),auth['isAuthenticated'](),controller[_0x03c6('0xc')]);router['get'](_0x03c6('0xd'),auth[_0x03c6('0x9')](),controller[_0x03c6('0xe')]);router[_0x03c6('0xf')]('/',auth[_0x03c6('0x9')](),interaction[_0x03c6('0x10')](_0x03c6('0x11'),_0x03c6('0x12')),controller[_0x03c6('0x13')]);router[_0x03c6('0x14')](_0x03c6('0xb'),auth[_0x03c6('0x9')](),controller[_0x03c6('0x15')]);router[_0x03c6('0x14')]('/:id/accept',auth[_0x03c6('0x9')](),controller[_0x03c6('0x16')]);router[_0x03c6('0x14')]('/:id/reject',auth[_0x03c6('0x9')](),controller[_0x03c6('0x17')]);router[_0x03c6('0x18')](_0x03c6('0xb'),auth[_0x03c6('0x9')](),controller[_0x03c6('0x19')]);module[_0x03c6('0x1a')]=router; \ No newline at end of file +var _0x24dd=['./mailMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','accept','/:id/reject','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x26e318,_0x1b476b){var _0x4ff613=function(_0x50024e){while(--_0x50024e){_0x26e318['push'](_0x26e318['shift']());}};_0x4ff613(++_0x1b476b);}(_0x24dd,0x84));var _0xd24d=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x24dd[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require(_0xd24d('0x0'));var util=require(_0xd24d('0x1'));var path=require('path');var timeout=require(_0xd24d('0x2'));var express=require(_0xd24d('0x3'));var router=express[_0xd24d('0x4')]();var fs_extra=require(_0xd24d('0x5'));var auth=require(_0xd24d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd24d('0x7'));var controller=require(_0xd24d('0x8'));router['get']('/',auth[_0xd24d('0x9')](),controller['index']);router[_0xd24d('0xa')](_0xd24d('0xb'),auth['isAuthenticated'](),controller[_0xd24d('0xc')]);router[_0xd24d('0xa')](_0xd24d('0xd'),auth[_0xd24d('0x9')](),controller[_0xd24d('0xe')]);router[_0xd24d('0xa')](_0xd24d('0xf'),auth[_0xd24d('0x9')](),controller[_0xd24d('0x10')]);router[_0xd24d('0x11')]('/',auth['isAuthenticated'](),interaction[_0xd24d('0x12')](_0xd24d('0x13'),_0xd24d('0x14')),controller[_0xd24d('0x15')]);router[_0xd24d('0x16')](_0xd24d('0xd'),auth[_0xd24d('0x9')](),controller[_0xd24d('0x17')]);router[_0xd24d('0x16')]('/:id/accept',auth['isAuthenticated'](),controller[_0xd24d('0x18')]);router[_0xd24d('0x16')](_0xd24d('0x19'),auth[_0xd24d('0x9')](),controller['reject']);router['delete'](_0xd24d('0xd'),auth[_0xd24d('0x9')](),controller[_0xd24d('0x1a')]);module[_0xd24d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index aadaef7..94494e1 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 _0xf5a8=['lodash','TEXT','medium','ENUM','out','STRING','long','DATE','BOOLEAN','Email','Chat'];(function(_0x327653,_0x1b3e89){var _0xf9733d=function(_0x4b568d){while(--_0x4b568d){_0x327653['push'](_0x327653['shift']());}};_0xf9733d(++_0x1b3e89);}(_0xf5a8,0x79));var _0x8f5a=function(_0x56039b,_0x3de8d8){_0x56039b=_0x56039b-0x0;var _0xc90792=_0xf5a8[_0x56039b];return _0xc90792;};'use strict';var Sequelize=require('sequelize');var _=require(_0x8f5a('0x0'));module['exports']={'body':{'type':Sequelize[_0x8f5a('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x8f5a('0x1')](_0x8f5a('0x2'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8f5a('0x3')]('in',_0x8f5a('0x4')),'defaultValue':_0x8f5a('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8f5a('0x5')](0x1fe)},'from':{'type':Sequelize[_0x8f5a('0x5')]},'to':{'type':Sequelize[_0x8f5a('0x1')](_0x8f5a('0x6'))},'cc':{'type':Sequelize[_0x8f5a('0x1')](_0x8f5a('0x6'))},'bcc':{'type':Sequelize[_0x8f5a('0x1')]('long')},'subject':{'type':Sequelize[_0x8f5a('0x1')]},'sentAt':{'type':Sequelize[_0x8f5a('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x8f5a('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x8f5a('0x7')]},'originTo':{'type':Sequelize[_0x8f5a('0x1')](_0x8f5a('0x6'))},'originCc':{'type':Sequelize[_0x8f5a('0x1')](_0x8f5a('0x6'))},'originChannel':{'type':Sequelize['ENUM'](_0x8f5a('0x9'),_0x8f5a('0xa')),'defaultValue':_0x8f5a('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0x09ae=['STRING','DATE','INTEGER','Email','Chat','sequelize','TEXT','long','medium','BOOLEAN','ENUM','out'];(function(_0x43f2ae,_0x174a36){var _0x404e13=function(_0x1c776c){while(--_0x1c776c){_0x43f2ae['push'](_0x43f2ae['shift']());}};_0x404e13(++_0x174a36);}(_0x09ae,0x131));var _0xe09a=function(_0x53c172,_0x642cbd){_0x53c172=_0x53c172-0x0;var _0x2652fe=_0x09ae[_0x53c172];return _0x2652fe;};'use strict';var Sequelize=require(_0xe09a('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0xe09a('0x1')](_0xe09a('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe09a('0x1')](_0xe09a('0x3'))},'read':{'type':Sequelize[_0xe09a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe09a('0x5')]('in',_0xe09a('0x6')),'defaultValue':_0xe09a('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe09a('0x7')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xe09a('0x1')](_0xe09a('0x2'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0xe09a('0x1')](_0xe09a('0x2'))},'subject':{'type':Sequelize[_0xe09a('0x1')]},'sentAt':{'type':Sequelize[_0xe09a('0x8')]},'attach':{'type':Sequelize[_0xe09a('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xe09a('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xe09a('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xe09a('0x2'))},'originCc':{'type':Sequelize[_0xe09a('0x1')](_0xe09a('0x2'))},'originChannel':{'type':Sequelize[_0xe09a('0x5')](_0xe09a('0xa'),_0xe09a('0xb')),'defaultValue':_0xe09a('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index bf71207..e28b6a8 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 _0x4324=['Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','internal','SIP/%s','rejectmessage','download','unix','toString','server','files','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','bcc','headers','Bcc','basename','existsSync','push','readFileSync','unlinkSync','moment','bluebird','util','lodash','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','find','body','params','describe','create','direction','secret','split','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','CloudProvider','Smtp','attachments','join','root','server/files/attachments','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize'];(function(_0x472ae1,_0x315eb3){var _0x388128=function(_0x11acdc){while(--_0x11acdc){_0x472ae1['push'](_0x472ae1['shift']());}};_0x388128(++_0x315eb3);}(_0x4324,0x167));var _0x4432=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0x4324[_0x37e886];return _0x57c5cd;};'use strict';var emlformat=require('eml-format');var moment=require(_0x4432('0x0'));var BPromise=require(_0x4432('0x1'));var util=require(_0x4432('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x4432('0x3'));var Redis=require('ioredis');var htmlToText=require(_0x4432('0x4'));var qs=require(_0x4432('0x5'));var logger=require('../../config/logger')(_0x4432('0x6'));var interaction_log=require(_0x4432('0x7'))(_0x4432('0x8'));var config=require(_0x4432('0x9'));var db=require(_0x4432('0xa'))['db'];config[_0x4432('0xb')]=_[_0x4432('0xc')](config[_0x4432('0xb')],{'host':_0x4432('0xd'),'port':0x18eb});var socket=require(_0x4432('0xe'))(new Redis(config[_0x4432('0xb')]));var htmlEntities=require(_0x4432('0xf'));require('./mailMessage.socket')[_0x4432('0x10')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4432('0x11')]['http']({'port':0x232c});var client9003=jayson[_0x4432('0x11')][_0x4432('0x12')]({'port':0x232b});var client9002=jayson[_0x4432('0x11')][_0x4432('0x12')]({'port':0x232a});function respondWithRpcPromise(_0xe1fc0b,_0x42209d,_0x123e4f,_0x399c2e){return new BPromise(function(_0x2cd3e5,_0x21e839){var _0xaae406=_0x399c2e||client;return _0xaae406[_0x4432('0x13')](_0xe1fc0b,_0x123e4f)[_0x4432('0x14')](function(_0x240631){logger[_0x4432('0x15')](_0x4432('0x16'),_0x42209d,_0x4432('0x17'));logger[_0x4432('0x18')](_0x4432('0x19'),_0x42209d,_0x4432('0x17'),JSON[_0x4432('0x1a')](_0x240631));if(_0x240631['error']){if(_0x240631[_0x4432('0x1b')][_0x4432('0x1c')]===0x1f4){logger[_0x4432('0x1b')](_0x4432('0x16'),_0x42209d,_0x240631[_0x4432('0x1b')][_0x4432('0x1d')]);return _0x21e839(_0x240631['error'][_0x4432('0x1d')]);}logger[_0x4432('0x1b')](_0x4432('0x16'),_0x42209d,_0x240631[_0x4432('0x1b')][_0x4432('0x1d')]);return _0x2cd3e5(_0x240631[_0x4432('0x1b')]['message']);}else{logger[_0x4432('0x15')]('MailMessage,\x20%s,\x20%s',_0x42209d,_0x4432('0x17'));_0x2cd3e5(_0x240631['result']['message']);}})['catch'](function(_0x1ac6d6){logger[_0x4432('0x1b')](_0x4432('0x16'),_0x42209d,_0x1ac6d6);_0x21e839(_0x1ac6d6);});});}function respondWithResult(_0x1424a6,_0x1075b9){_0x1075b9=_0x1075b9||0xc8;return function(_0x46d1e5){if(_0x46d1e5){return _0x1424a6[_0x4432('0x1e')](_0x1075b9)[_0x4432('0x1f')](_0x46d1e5);}};}function respondWithFilteredResult(_0x384195,_0x2989ea){return function(_0x451da2){if(_0x451da2){var _0x1e977d=typeof _0x2989ea[_0x4432('0x20')]===_0x4432('0x21')&&typeof _0x2989ea['limit']===_0x4432('0x21');var _0x2f6177=_0x451da2[_0x4432('0x22')];var _0x41aef7=_0x1e977d?0x0:_0x2989ea[_0x4432('0x20')];var _0x2dea63=_0x1e977d?_0x451da2[_0x4432('0x22')]:_0x2989ea[_0x4432('0x20')]+_0x2989ea[_0x4432('0x23')];var _0x5c1f4;if(_0x2dea63>=_0x2f6177){_0x2dea63=_0x2f6177;_0x5c1f4=0xc8;}else{_0x5c1f4=0xce;}_0x384195['status'](_0x5c1f4);return _0x384195[_0x4432('0x24')](_0x4432('0x25'),_0x41aef7+'-'+_0x2dea63+'/'+_0x2f6177)['json'](_0x451da2);}return null;};}function saveUpdates(_0x235a92){return function(_0x1cabe8){if(_0x1cabe8){return _0x1cabe8[_0x4432('0x26')](_0x235a92)[_0x4432('0x14')](function(_0x54eb3f){return _0x54eb3f;});}return null;};}function removeEntity(_0x15a234){return function(_0xd9b7fd){if(_0xd9b7fd){return _0xd9b7fd[_0x4432('0x27')]()[_0x4432('0x14')](function(){_0x15a234[_0x4432('0x1e')](0xcc)[_0x4432('0x28')]();});}};}function handleEntityNotFound(_0x415a91){return function(_0x5bbe8b){if(!_0x5bbe8b){_0x415a91[_0x4432('0x29')](0x194);}return _0x5bbe8b;};}function handleError(_0x2a7960,_0x168a7b){_0x168a7b=_0x168a7b||0x1f4;return function(_0x427da9){logger['error'](_0x427da9[_0x4432('0x2a')]);if(_0x427da9[_0x4432('0x2b')]){delete _0x427da9[_0x4432('0x2b')];}_0x2a7960['status'](_0x168a7b)[_0x4432('0x2c')](_0x427da9);};}exports[_0x4432('0x2d')]=function(_0x4b6038,_0xa4f95){var _0x5a77e3={},_0x42bed8={},_0x451df6={'count':0x0,'rows':[]};var _0x649aea=_[_0x4432('0x2e')](db[_0x4432('0x2f')][_0x4432('0x30')],function(_0x1b7430){return{'name':_0x1b7430[_0x4432('0x31')],'type':_0x1b7430[_0x4432('0x32')][_0x4432('0x33')]};});_0x42bed8['model']=_['map'](_0x649aea,_0x4432('0x2b'));_0x42bed8[_0x4432('0x34')]=_[_0x4432('0x35')](_0x4b6038[_0x4432('0x34')]);_0x42bed8[_0x4432('0x36')]=_['intersection'](_0x42bed8['model'],_0x42bed8[_0x4432('0x34')]);_0x5a77e3['attributes']=_[_0x4432('0x37')](_0x42bed8[_0x4432('0x38')],qs[_0x4432('0x39')](_0x4b6038['query'][_0x4432('0x39')]));_0x5a77e3['attributes']=_0x5a77e3[_0x4432('0x3a')][_0x4432('0x3b')]?_0x5a77e3['attributes']:_0x42bed8[_0x4432('0x38')];if(!_0x4b6038[_0x4432('0x34')][_0x4432('0x3c')](_0x4432('0x3d'))){_0x5a77e3[_0x4432('0x23')]=qs[_0x4432('0x23')](_0x4b6038[_0x4432('0x34')]['limit']);_0x5a77e3[_0x4432('0x20')]=qs[_0x4432('0x20')](_0x4b6038[_0x4432('0x34')][_0x4432('0x20')]);}_0x5a77e3[_0x4432('0x3e')]=qs['sort'](_0x4b6038[_0x4432('0x34')][_0x4432('0x3f')]);_0x5a77e3[_0x4432('0x40')]=qs['filters'](_['pick'](_0x4b6038['query'],_0x42bed8[_0x4432('0x36')]),_0x649aea);if(_0x4b6038[_0x4432('0x34')]['filter']){_0x5a77e3[_0x4432('0x40')]=_[_0x4432('0x41')](_0x5a77e3[_0x4432('0x40')],{'$or':_[_0x4432('0x2e')](_0x649aea,function(_0x5252f6){if(_0x5252f6[_0x4432('0x32')]!==_0x4432('0x42')){var _0x3ef8f7={};_0x3ef8f7[_0x5252f6['name']]={'$like':'%'+_0x4b6038['query'][_0x4432('0x43')]+'%'};return _0x3ef8f7;}})});}_0x5a77e3=_[_0x4432('0x41')]({},_0x5a77e3,_0x4b6038[_0x4432('0x44')]);var _0x58dd43={'where':_0x5a77e3[_0x4432('0x40')]};return db[_0x4432('0x2f')][_0x4432('0x22')](_0x58dd43)[_0x4432('0x14')](function(_0x2399ef){_0x451df6['count']=_0x2399ef;if(_0x4b6038[_0x4432('0x34')][_0x4432('0x45')]){_0x5a77e3[_0x4432('0x46')]=[{'all':!![]}];}return db[_0x4432('0x2f')][_0x4432('0x47')](_0x5a77e3);})[_0x4432('0x14')](function(_0x19c03e){_0x451df6[_0x4432('0x48')]=_0x19c03e;return _0x451df6;})['then'](respondWithFilteredResult(_0xa4f95,_0x5a77e3))[_0x4432('0x49')](handleError(_0xa4f95,null));};exports['show']=function(_0x2f6914,_0x4582d2){var _0xe2ac1c={'raw':!![],'where':{'id':_0x2f6914['params']['id']}},_0x1b2186={};_0x1b2186[_0x4432('0x38')]=_[_0x4432('0x35')](db[_0x4432('0x2f')]['rawAttributes']);_0x1b2186[_0x4432('0x34')]=_['keys'](_0x2f6914[_0x4432('0x34')]);_0x1b2186[_0x4432('0x36')]=_[_0x4432('0x37')](_0x1b2186['model'],_0x1b2186[_0x4432('0x34')]);_0xe2ac1c[_0x4432('0x3a')]=_['intersection'](_0x1b2186['model'],qs[_0x4432('0x39')](_0x2f6914[_0x4432('0x34')][_0x4432('0x39')]));_0xe2ac1c[_0x4432('0x3a')]=_0xe2ac1c[_0x4432('0x3a')][_0x4432('0x3b')]?_0xe2ac1c['attributes']:_0x1b2186[_0x4432('0x38')];if(_0x2f6914[_0x4432('0x34')][_0x4432('0x45')]){_0xe2ac1c['include']=[{'all':!![]}];}_0xe2ac1c=_[_0x4432('0x41')]({},_0xe2ac1c,_0x2f6914[_0x4432('0x44')]);return db[_0x4432('0x2f')][_0x4432('0x4a')](_0xe2ac1c)['then'](handleEntityNotFound(_0x4582d2,null))[_0x4432('0x14')](respondWithResult(_0x4582d2,null))[_0x4432('0x49')](handleError(_0x4582d2,null));};exports[_0x4432('0x26')]=function(_0x19905d,_0x49d7dd){if(_0x19905d[_0x4432('0x4b')]['id']){delete _0x19905d[_0x4432('0x4b')]['id'];}return db[_0x4432('0x2f')][_0x4432('0x4a')]({'where':{'id':_0x19905d[_0x4432('0x4c')]['id']}})[_0x4432('0x14')](handleEntityNotFound(_0x49d7dd,null))[_0x4432('0x14')](saveUpdates(_0x19905d['body'],null))[_0x4432('0x14')](respondWithResult(_0x49d7dd,null))[_0x4432('0x49')](handleError(_0x49d7dd,null));};exports[_0x4432('0x27')]=function(_0x5acb28,_0x367387){return db[_0x4432('0x2f')][_0x4432('0x4a')]({'where':{'id':_0x5acb28[_0x4432('0x4c')]['id']}})['then'](handleEntityNotFound(_0x367387,null))[_0x4432('0x14')](removeEntity(_0x367387,null))[_0x4432('0x49')](handleError(_0x367387,null));};exports[_0x4432('0x4d')]=function(_0x552cb5,_0xd7da72){return db[_0x4432('0x2f')][_0x4432('0x4d')]()[_0x4432('0x14')](respondWithResult(_0xd7da72,null))[_0x4432('0x49')](handleError(_0xd7da72,null));};exports[_0x4432('0x4e')]=function(_0x2a18fe,_0x35ce35){return db[_0x4432('0x2f')][_0x4432('0x4e')](_0x2a18fe[_0x4432('0x4b')])['then'](function(_0x299e21){if(_0x299e21){if(_0x299e21[_0x4432('0x4f')]==='out'&&!_0x299e21[_0x4432('0x50')]){var _0xc42d17,_0x5c45ca,_0x4fbca3;if(_0x2a18fe[_0x4432('0x4b')]['to']){_0x5c45ca=_0x2a18fe[_0x4432('0x4b')]['to'][_0x4432('0x51')](',')[0x0];}return db[_0x4432('0x52')]['findOne']({'where':{'id':_0x299e21[_0x4432('0x53')]},'include':[{'model':db[_0x4432('0x54')],'as':_0x4432('0x55'),'include':[{'model':db['CmContact'],'as':_0x4432('0x56'),'where':{'email':_0x5c45ca},'limit':0x1,'order':[[_0x4432('0x57'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x4432('0x58')],'as':_0x4432('0x58'),'raw':!![]}]}]})[_0x4432('0x14')](function(_0x5e952d){_0xc42d17=_0x5e952d;if(!_0xc42d17||!_0xc42d17[_0x4432('0x59')])return;var _0x302c8c=_0xc42d17['getSmtpOptions']();if(_0x2a18fe[_0x4432('0x4b')][_0x4432('0x5a')]&&_0x2a18fe[_0x4432('0x4b')]['attachments'][_0x4432('0x3b')]){for(var _0x29a97e=0x0;_0x29a97e<_0x2a18fe[_0x4432('0x4b')][_0x4432('0x5a')][_0x4432('0x3b')];_0x29a97e+=0x1){_0x2a18fe[_0x4432('0x4b')][_0x4432('0x5a')][_0x29a97e]={'filename':_0x2a18fe[_0x4432('0x4b')][_0x4432('0x5a')][_0x29a97e][_0x4432('0x2b')],'path':path[_0x4432('0x5b')](config[_0x4432('0x5c')],_0x4432('0x5d'),_0x2a18fe[_0x4432('0x4b')][_0x4432('0x5a')][_0x29a97e]['basename'])};}}_0x4fbca3={'account':_0x302c8c,'message':_0x2a18fe['body']};return;})[_0x4432('0x14')](function(){if(_0xc42d17[_0x4432('0x55')]){if(_0xc42d17[_0x4432('0x55')]['Contacts'][_0x4432('0x3b')]){return _0xc42d17[_0x4432('0x55')][_0x4432('0x56')][0x0];}else{return db['CmContact'][_0x4432('0x4e')](_[_0x4432('0xc')](_0x2a18fe[_0x4432('0x4b')],{'firstName':_0x2a18fe[_0x4432('0x4b')]['to'],'email':_0x2a18fe['body']['to'],'phone':_0x2a18fe[_0x4432('0x4b')]['to'],'ListId':_0xc42d17['ListId']}));}}else{throw new Error(_0x4432('0x5e'));}})[_0x4432('0x14')](function(){if(_0x4fbca3){return respondWithRpcPromise(_0x4432('0x5f'),'sendMail',_0x4fbca3,client9003)['then'](function(_0x506135){return _0x299e21[_0x4432('0x26')]({'read':!![],'messageId':_0x506135[_0x4432('0x60')],'sentAt':moment()[_0x4432('0x61')](_0x4432('0x62'))});})[_0x4432('0x49')](function(_0x426095){logger['error']('%s',JSON[_0x4432('0x1a')](_0x426095));return _0x299e21;});}return _0x299e21;});}return _0x299e21;}})[_0x4432('0x14')](respondWithResult(_0x35ce35,0xc9))[_0x4432('0x49')](handleError(_0x35ce35,null));};exports[_0x4432('0x63')]=function(_0x96d9fc,_0x58affc){var _0x46dfc8={'agent':{},'channel':_0x4432('0x64')};if(_0x96d9fc['body']['id']){delete _0x96d9fc[_0x4432('0x4b')]['id'];}_0x96d9fc['body'][_0x4432('0x65')]=!![];_0x96d9fc[_0x4432('0x4b')][_0x4432('0x66')]=moment()['format'](_0x4432('0x62'));_0x96d9fc['body'][_0x4432('0x67')]=_0x96d9fc[_0x4432('0x4b')][_0x4432('0x67')]||_0x96d9fc[_0x4432('0x68')]['id'];_0x46dfc8[_0x4432('0x69')]['id']=_0x96d9fc['body'][_0x4432('0x67')];return db[_0x4432('0x2f')][_0x4432('0x4a')]({'where':{'id':_0x96d9fc['params']['id'],'UserId':null}})[_0x4432('0x14')](handleEntityNotFound(_0x58affc,null))['then'](saveUpdates(_0x96d9fc[_0x4432('0x4b')],null))[_0x4432('0x14')](function(_0x186118){if(_0x186118){_0x46dfc8[_0x4432('0x1d')]=_0x186118[_0x4432('0x6a')]({'plain':!![]});return db['MailInteraction'][_0x4432('0x4a')]({'where':{'id':_0x186118[_0x4432('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x58affc,null))[_0x4432('0x14')](function(_0x40d2e0){if(_0x40d2e0){return _0x40d2e0[_0x4432('0x26')]({'UserId':_0x96d9fc['body']['UserId'],'read1stAt':_[_0x4432('0x6c')](_0x40d2e0[_0x4432('0x6d')])?moment()[_0x4432('0x61')](_0x4432('0x62')):undefined});}return null;})[_0x4432('0x14')](function(_0x959cb6){if(_0x959cb6){_0x46dfc8[_0x4432('0x6e')]=_0x959cb6['get']({'plain':!![]});interaction_log['info'](_0x4432('0x6f'),_0x96d9fc[_0x4432('0x68')]['id'],_0x96d9fc[_0x4432('0x68')][_0x4432('0x2b')],_0x96d9fc['user']['role'],_0x46dfc8[_0x4432('0x6e')]['id'],_0x96d9fc[_0x4432('0x4b')]?JSON[_0x4432('0x1a')](_0x96d9fc[_0x4432('0x4b')]):_0x4432('0x70'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x46dfc8);}return null;})[_0x4432('0x14')](function(_0x2955e8){var _0x186082=_0x4432('0x71')+_0x2955e8[_0x4432('0x1d')]['ContactId'];return db[_0x4432('0x72')][_0x4432('0x34')](_0x186082,{'type':db[_0x4432('0x73')][_0x4432('0x74')][_0x4432('0x75')],'raw':!![]})[_0x4432('0x14')](function(_0x161d6a){return _0x161d6a;});})['then'](function(_0xfabf5e){if(_0xfabf5e){_0x46dfc8[_0x4432('0x1d')][_0x4432('0x76')]=_0xfabf5e[0x0];if(!_0x96d9fc[_0x4432('0x4b')]['UserId'])return;return db[_0x4432('0x77')][_0x4432('0x4a')]({'where':{'id':_0x96d9fc[_0x4432('0x4b')][_0x4432('0x67')],'role':_0x4432('0x69')},'attributes':['id',_0x4432('0x2b'),_0x4432('0x78'),_0x4432('0x79'),'internal'],'raw':!![]});}return null;})[_0x4432('0x14')](function(_0x1b6e7b){if(!_0x1b6e7b)return null;_0x46dfc8[_0x4432('0x1d')]['agent']=_0x1b6e7b;return _0x46dfc8;})[_0x4432('0x14')](function(_0x37d284){if(_0x37d284){if(_0x96d9fc[_0x4432('0x4b')][_0x4432('0x7a')]){_0x46dfc8['message']['interface']=util[_0x4432('0x61')]('SIP/%s',_0x96d9fc[_0x4432('0x68')][_0x4432('0x2b')]);_0x46dfc8[_0x4432('0x1d')][_0x4432('0x7b')]=_0x46dfc8['channel'];_0x46dfc8[_0x4432('0x1d')][_0x4432('0x7c')]=_0x46dfc8[_0x4432('0x7b')];_0x46dfc8[_0x4432('0x1d')][_0x4432('0x7d')]=_0x4432('0x63');_0x46dfc8[_0x4432('0x1d')][_0x4432('0x4b')]=htmlToText[_0x4432('0x7e')](_0x46dfc8[_0x4432('0x1d')][_0x4432('0x4b')]);return respondWithRpcPromise(_0x4432('0x7f'),_0x4432('0x7f'),{'event':_0x4432('0x80'),'message':_0x46dfc8['message']},client9002)[_0x4432('0x14')](function(){return _0x46dfc8;});}return _0x46dfc8;}return null;})[_0x4432('0x14')](respondWithResult(_0x58affc,null))[_0x4432('0x49')](handleError(_0x58affc,null));};exports[_0x4432('0x81')]=function(_0x386e73,_0x223dbd){var _0x46a66e={'agent':{},'channel':_0x4432('0x64')};if(_0x386e73[_0x4432('0x4b')]['id']){delete _0x386e73[_0x4432('0x4b')]['id'];}_0x386e73[_0x4432('0x4b')]['UserId']=_0x386e73[_0x4432('0x4b')]['UserId']||_0x386e73[_0x4432('0x68')]['id'];_0x46a66e[_0x4432('0x69')]['id']=_0x386e73[_0x4432('0x4b')][_0x4432('0x67')];return db['MailMessage'][_0x4432('0x4a')]({'where':{'id':_0x386e73['params']['id'],'UserId':null}})[_0x4432('0x14')](handleEntityNotFound(_0x223dbd,null))[_0x4432('0x14')](function(_0x5a4020){if(_0x5a4020){_0x46a66e[_0x4432('0x1d')]=_0x5a4020[_0x4432('0x6a')]({'plain':!![]});return db[_0x4432('0x82')]['find']({'where':{'id':_0x5a4020[_0x4432('0x6b')]}});}return null;})[_0x4432('0x14')](handleEntityNotFound(_0x223dbd,null))[_0x4432('0x14')](function(_0x8e5083){if(_0x8e5083){_0x46a66e[_0x4432('0x6e')]=_0x8e5083[_0x4432('0x6a')]({'plain':!![]});interaction_log[_0x4432('0x15')](_0x4432('0x83'),_0x386e73[_0x4432('0x68')]['id'],_0x386e73[_0x4432('0x68')][_0x4432('0x2b')],_0x386e73[_0x4432('0x68')][_0x4432('0x84')],_0x46a66e[_0x4432('0x6e')]['id'],_0x386e73[_0x4432('0x4b')]?JSON['stringify'](_0x386e73['body']):'null');return respondWithRpcPromise(_0x4432('0x85'),_0x4432('0x86'),_0x46a66e);}return null;})[_0x4432('0x14')](function(_0x58dde5){var _0x2b7cdb=_0x4432('0x71')+_0x58dde5[_0x4432('0x1d')]['ContactId'];return db[_0x4432('0x72')][_0x4432('0x34')](_0x2b7cdb,{'type':db[_0x4432('0x73')][_0x4432('0x74')][_0x4432('0x75')],'raw':!![]})['then'](function(_0x1fb607){return _0x1fb607;});})[_0x4432('0x14')](function(_0x4f33d5){if(_0x4f33d5){_0x46a66e[_0x4432('0x1d')][_0x4432('0x76')]=_0x4f33d5[0x0];if(!_0x386e73[_0x4432('0x4b')]['UserId'])return;return db[_0x4432('0x77')]['find']({'where':{'id':_0x386e73[_0x4432('0x4b')][_0x4432('0x67')],'role':_0x4432('0x69')},'attributes':['id',_0x4432('0x2b'),_0x4432('0x78'),_0x4432('0x79'),_0x4432('0x87')],'raw':!![]});}return null;})['then'](function(_0x5898b8){if(!_0x5898b8)return null;_0x46a66e['message']['agent']=_0x5898b8;return _0x46a66e;})[_0x4432('0x14')](function(_0x541360){if(_0x541360){_0x541360['message']['interface']=util[_0x4432('0x61')](_0x4432('0x88'),_0x386e73[_0x4432('0x68')][_0x4432('0x2b')]);_0x541360[_0x4432('0x1d')][_0x4432('0x7b')]=_0x46a66e[_0x4432('0x7b')];_0x541360[_0x4432('0x1d')][_0x4432('0x7c')]=_0x46a66e[_0x4432('0x7b')];_0x541360[_0x4432('0x1d')]['event']='reject';_0x541360['message'][_0x4432('0x4b')]=htmlToText[_0x4432('0x7e')](_0x46a66e[_0x4432('0x1d')][_0x4432('0x4b')]);respondWithRpcPromise('EventManager',_0x4432('0x7f'),{'event':_0x4432('0x89'),'message':_0x541360[_0x4432('0x1d')]},client9002);return _0x46a66e;}return null;})['then'](respondWithResult(_0x223dbd,null))[_0x4432('0x49')](handleError(_0x223dbd,null));};exports[_0x4432('0x8a')]=function(_0xec15b2,_0x106f98){var _0x5f3f3c=moment()[_0x4432('0x8b')]()[_0x4432('0x8c')]();var _0x409e4a=path[_0x4432('0x5b')](config[_0x4432('0x5c')],_0x4432('0x8d'),_0x4432('0x8e'),'tmp');var _0x203836=path['join'](config['root'],_0x4432('0x8d'),_0x4432('0x8e'),'attachments');var _0x2adf4c=util['format'](_0x4432('0x8f'),_0x5f3f3c);return db['MailMessage'][_0x4432('0x4a')]({'where':{'id':_0xec15b2[_0x4432('0x4c')]['id']},'attributes':['id','body',_0x4432('0x90'),'to','cc','bcc',_0x4432('0x91'),_0x4432('0x92')],'include':_0xec15b2[_0x4432('0x34')][_0x4432('0x5a')]?[{'model':db[_0x4432('0x93')],'as':_0x4432('0x94')}]:undefined})['then'](handleEntityNotFound(_0x106f98,null))[_0x4432('0x14')](function(_0x11525e){if(_0x11525e){var _0x2f6b85=_0x11525e;var _0x265cc3={'from':_0x2f6b85[_0x4432('0x90')],'to':_0x2f6b85['to'],'subject':_0x2f6b85['subject'],'html':htmlEntities[_0x4432('0x95')](_0x2f6b85['body']),'headers':{'Date':moment(_0x2f6b85[_0x4432('0x92')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x11525e['cc']){_0x265cc3['headers']['Cc']=_0x11525e['cc'];}if(_0x11525e[_0x4432('0x96')]){_0x265cc3[_0x4432('0x97')][_0x4432('0x98')]=_0x11525e[_0x4432('0x96')];}return new BPromise(function(_0x3d8b43,_0x438e56){if(_0x11525e[_0x4432('0x94')]){for(var _0x9fd359=0x0;_0x9fd359<_0x11525e[_0x4432('0x94')][_0x4432('0x3b')];_0x9fd359++){var _0x1f9424=_0x11525e[_0x4432('0x94')][_0x9fd359];var _0x598944=path[_0x4432('0x5b')](_0x203836,_0x1f9424[_0x4432('0x99')]);if(fs[_0x4432('0x9a')](_0x598944)){_0x265cc3[_0x4432('0x5a')][_0x4432('0x9b')]({'name':_0x1f9424[_0x4432('0x2b')],'contentType':_0x1f9424['type'],'data':fs[_0x4432('0x9c')](_0x598944)});}}}emlformat['build'](_0x265cc3,function(_0x3ec361,_0x4a095b){if(_0x3ec361)return _0x438e56(_0x3ec361);fs['writeFileSync'](path[_0x4432('0x5b')](_0x409e4a,_0x2adf4c),_0x4a095b);return _0x3d8b43(_0x4a095b);});});}})['then'](function(_0x11be8a){if(_0x11be8a){return _0x106f98[_0x4432('0x8a')](path['join'](_0x409e4a,_0x2adf4c),_0x2adf4c,function(_0x206dd3){if(!_0x206dd3)fs[_0x4432('0x9d')](path[_0x4432('0x5b')](_0x409e4a,_0x2adf4c));});}})[_0x4432('0x49')](handleError(_0x106f98,null));}; \ No newline at end of file +var _0xdf17=['request\x20sent','stringify','error','message','info','result','catch','status','json','offset','undefined','count','Content-Range','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','fields','nolimit','limit','order','sort','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','intersection','length','options','find','body','params','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','server/files/attachments','List','CmContact','ListId','List\x20not\x20found','update','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','user','agent','UserId','get','MailInteraction','MailInteractionId','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','reject','rejectmessage','unix','toString','join','root','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','writeFileSync','download','unlinkSync','moment','util','path','lodash','ioredis','html-to-text','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x55f549,_0x4f90ac){var _0x589a78=function(_0x4b2cc3){while(--_0x4b2cc3){_0x55f549['push'](_0x55f549['shift']());}};_0x589a78(++_0x4f90ac);}(_0xdf17,0x126));var _0x7df1=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xdf17[_0x37c22c];return _0x119d79;};'use strict';var emlformat=require('eml-format');var moment=require(_0x7df1('0x0'));var BPromise=require('bluebird');var util=require(_0x7df1('0x1'));var path=require(_0x7df1('0x2'));var fs=require('fs');var _=require(_0x7df1('0x3'));var Redis=require(_0x7df1('0x4'));var htmlToText=require(_0x7df1('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x7df1('0x6'))('api');var interaction_log=require(_0x7df1('0x6'))('mail-interactions');var config=require(_0x7df1('0x7'));var db=require(_0x7df1('0x8'))['db'];config['redis']=_[_0x7df1('0x9')](config[_0x7df1('0xa')],{'host':_0x7df1('0xb'),'port':0x18eb});var socket=require(_0x7df1('0xc'))(new Redis(config[_0x7df1('0xa')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x7df1('0xd')](socket);var jayson=require(_0x7df1('0xe'));var client=jayson[_0x7df1('0xf')][_0x7df1('0x10')]({'port':0x232c});var client9003=jayson[_0x7df1('0xf')][_0x7df1('0x10')]({'port':0x232b});var client9002=jayson['client'][_0x7df1('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x23740d,_0x56b47b,_0x426683,_0x43955a){return new BPromise(function(_0x2218fb,_0x2e9dfa){var _0x16a526=_0x43955a||client;return _0x16a526[_0x7df1('0x11')](_0x23740d,_0x426683)[_0x7df1('0x12')](function(_0x259523){logger['info'](_0x7df1('0x13'),_0x56b47b,'request\x20sent');logger[_0x7df1('0x14')](_0x7df1('0x15'),_0x56b47b,_0x7df1('0x16'),JSON[_0x7df1('0x17')](_0x259523));if(_0x259523['error']){if(_0x259523[_0x7df1('0x18')]['code']===0x1f4){logger[_0x7df1('0x18')](_0x7df1('0x13'),_0x56b47b,_0x259523[_0x7df1('0x18')][_0x7df1('0x19')]);return _0x2e9dfa(_0x259523[_0x7df1('0x18')][_0x7df1('0x19')]);}logger[_0x7df1('0x18')]('MailMessage,\x20%s,\x20%s',_0x56b47b,_0x259523[_0x7df1('0x18')][_0x7df1('0x19')]);return _0x2218fb(_0x259523[_0x7df1('0x18')]['message']);}else{logger[_0x7df1('0x1a')](_0x7df1('0x13'),_0x56b47b,_0x7df1('0x16'));_0x2218fb(_0x259523[_0x7df1('0x1b')][_0x7df1('0x19')]);}})[_0x7df1('0x1c')](function(_0xcd6f74){logger[_0x7df1('0x18')](_0x7df1('0x13'),_0x56b47b,_0xcd6f74);_0x2e9dfa(_0xcd6f74);});});}function respondWithResult(_0x39b1be,_0x132a50){_0x132a50=_0x132a50||0xc8;return function(_0x4e818e){if(_0x4e818e){return _0x39b1be[_0x7df1('0x1d')](_0x132a50)[_0x7df1('0x1e')](_0x4e818e);}};}function respondWithFilteredResult(_0x564e96,_0x368554){return function(_0x5c766d){if(_0x5c766d){var _0x3ec7c1=typeof _0x368554[_0x7df1('0x1f')]===_0x7df1('0x20')&&typeof _0x368554['limit']===_0x7df1('0x20');var _0x3cc756=_0x5c766d['count'];var _0x24744d=_0x3ec7c1?0x0:_0x368554[_0x7df1('0x1f')];var _0x2fc29b=_0x3ec7c1?_0x5c766d[_0x7df1('0x21')]:_0x368554[_0x7df1('0x1f')]+_0x368554['limit'];var _0x1abedc;if(_0x2fc29b>=_0x3cc756){_0x2fc29b=_0x3cc756;_0x1abedc=0xc8;}else{_0x1abedc=0xce;}_0x564e96[_0x7df1('0x1d')](_0x1abedc);return _0x564e96['set'](_0x7df1('0x22'),_0x24744d+'-'+_0x2fc29b+'/'+_0x3cc756)[_0x7df1('0x1e')](_0x5c766d);}return null;};}function saveUpdates(_0x24287c){return function(_0x1e781b){if(_0x1e781b){return _0x1e781b['update'](_0x24287c)[_0x7df1('0x12')](function(_0x16b486){return _0x16b486;});}return null;};}function removeEntity(_0x4cfd48){return function(_0x474a25){if(_0x474a25){return _0x474a25[_0x7df1('0x23')]()['then'](function(){_0x4cfd48[_0x7df1('0x1d')](0xcc)[_0x7df1('0x24')]();});}};}function handleEntityNotFound(_0x3c5b69){return function(_0x145056){if(!_0x145056){_0x3c5b69[_0x7df1('0x25')](0x194);}return _0x145056;};}function handleError(_0x4b7bb5,_0x53ef5b){_0x53ef5b=_0x53ef5b||0x1f4;return function(_0x52a62c){logger[_0x7df1('0x18')](_0x52a62c[_0x7df1('0x26')]);if(_0x52a62c[_0x7df1('0x27')]){delete _0x52a62c[_0x7df1('0x27')];}_0x4b7bb5[_0x7df1('0x1d')](_0x53ef5b)[_0x7df1('0x28')](_0x52a62c);};}exports[_0x7df1('0x29')]=function(_0x13f134,_0x4b03d5){var _0x2312da={},_0x5977a7={},_0xe48038={'count':0x0,'rows':[]};var _0x1e42bd=_['map'](db[_0x7df1('0x2a')][_0x7df1('0x2b')],function(_0xed3e46){return{'name':_0xed3e46[_0x7df1('0x2c')],'type':_0xed3e46[_0x7df1('0x2d')][_0x7df1('0x2e')]};});_0x5977a7[_0x7df1('0x2f')]=_[_0x7df1('0x30')](_0x1e42bd,'name');_0x5977a7['query']=_[_0x7df1('0x31')](_0x13f134[_0x7df1('0x32')]);_0x5977a7[_0x7df1('0x33')]=_['intersection'](_0x5977a7['model'],_0x5977a7[_0x7df1('0x32')]);_0x2312da[_0x7df1('0x34')]=_['intersection'](_0x5977a7['model'],qs[_0x7df1('0x35')](_0x13f134[_0x7df1('0x32')][_0x7df1('0x35')]));_0x2312da[_0x7df1('0x34')]=_0x2312da[_0x7df1('0x34')]['length']?_0x2312da[_0x7df1('0x34')]:_0x5977a7[_0x7df1('0x2f')];if(!_0x13f134['query']['hasOwnProperty'](_0x7df1('0x36'))){_0x2312da[_0x7df1('0x37')]=qs['limit'](_0x13f134['query']['limit']);_0x2312da[_0x7df1('0x1f')]=qs[_0x7df1('0x1f')](_0x13f134[_0x7df1('0x32')][_0x7df1('0x1f')]);}_0x2312da[_0x7df1('0x38')]=qs[_0x7df1('0x39')](_0x13f134[_0x7df1('0x32')]['sort']);_0x2312da['where']=qs[_0x7df1('0x33')](_['pick'](_0x13f134['query'],_0x5977a7[_0x7df1('0x33')]),_0x1e42bd);if(_0x13f134[_0x7df1('0x32')][_0x7df1('0x3a')]){_0x2312da['where']=_[_0x7df1('0x3b')](_0x2312da['where'],{'$or':_[_0x7df1('0x30')](_0x1e42bd,function(_0xbb6324){if(_0xbb6324[_0x7df1('0x2d')]!==_0x7df1('0x3c')){var _0x38e5b5={};_0x38e5b5[_0xbb6324[_0x7df1('0x27')]]={'$like':'%'+_0x13f134[_0x7df1('0x32')]['filter']+'%'};return _0x38e5b5;}})});}_0x2312da=_[_0x7df1('0x3b')]({},_0x2312da,_0x13f134['options']);var _0x352b26={'where':_0x2312da['where']};return db[_0x7df1('0x2a')][_0x7df1('0x21')](_0x352b26)[_0x7df1('0x12')](function(_0x1cb989){_0xe48038['count']=_0x1cb989;if(_0x13f134['query'][_0x7df1('0x3d')]){_0x2312da[_0x7df1('0x3e')]=[{'all':!![]}];}return db[_0x7df1('0x2a')][_0x7df1('0x3f')](_0x2312da);})[_0x7df1('0x12')](function(_0x2b3fa0){_0xe48038[_0x7df1('0x40')]=_0x2b3fa0;return _0xe48038;})[_0x7df1('0x12')](respondWithFilteredResult(_0x4b03d5,_0x2312da))['catch'](handleError(_0x4b03d5,null));};exports[_0x7df1('0x41')]=function(_0x5b8f9e,_0x2f9d3f){var _0x11ced9={'raw':!![],'where':{'id':_0x5b8f9e['params']['id']}},_0x4af56c={};_0x4af56c[_0x7df1('0x2f')]=_[_0x7df1('0x31')](db[_0x7df1('0x2a')][_0x7df1('0x2b')]);_0x4af56c[_0x7df1('0x32')]=_[_0x7df1('0x31')](_0x5b8f9e['query']);_0x4af56c[_0x7df1('0x33')]=_[_0x7df1('0x42')](_0x4af56c[_0x7df1('0x2f')],_0x4af56c[_0x7df1('0x32')]);_0x11ced9[_0x7df1('0x34')]=_[_0x7df1('0x42')](_0x4af56c['model'],qs[_0x7df1('0x35')](_0x5b8f9e[_0x7df1('0x32')][_0x7df1('0x35')]));_0x11ced9[_0x7df1('0x34')]=_0x11ced9[_0x7df1('0x34')][_0x7df1('0x43')]?_0x11ced9['attributes']:_0x4af56c['model'];if(_0x5b8f9e[_0x7df1('0x32')][_0x7df1('0x3d')]){_0x11ced9['include']=[{'all':!![]}];}_0x11ced9=_['merge']({},_0x11ced9,_0x5b8f9e[_0x7df1('0x44')]);return db[_0x7df1('0x2a')][_0x7df1('0x45')](_0x11ced9)[_0x7df1('0x12')](handleEntityNotFound(_0x2f9d3f,null))[_0x7df1('0x12')](respondWithResult(_0x2f9d3f,null))[_0x7df1('0x1c')](handleError(_0x2f9d3f,null));};exports['update']=function(_0x495d95,_0x481ed1){if(_0x495d95[_0x7df1('0x46')]['id']){delete _0x495d95[_0x7df1('0x46')]['id'];}return db[_0x7df1('0x2a')][_0x7df1('0x45')]({'where':{'id':_0x495d95[_0x7df1('0x47')]['id']}})[_0x7df1('0x12')](handleEntityNotFound(_0x481ed1,null))[_0x7df1('0x12')](saveUpdates(_0x495d95[_0x7df1('0x46')],null))['then'](respondWithResult(_0x481ed1,null))[_0x7df1('0x1c')](handleError(_0x481ed1,null));};exports['destroy']=function(_0x3c595b,_0x49a5e1){return db[_0x7df1('0x2a')]['find']({'where':{'id':_0x3c595b[_0x7df1('0x47')]['id']}})['then'](handleEntityNotFound(_0x49a5e1,null))[_0x7df1('0x12')](removeEntity(_0x49a5e1,null))[_0x7df1('0x1c')](handleError(_0x49a5e1,null));};exports[_0x7df1('0x48')]=function(_0x2d99b8,_0x17dedf){return db[_0x7df1('0x2a')][_0x7df1('0x48')]()['then'](respondWithResult(_0x17dedf,null))[_0x7df1('0x1c')](handleError(_0x17dedf,null));};exports[_0x7df1('0x49')]=function(_0x257c3a,_0x456a61){return db['MailMessage']['create'](_0x257c3a[_0x7df1('0x46')])[_0x7df1('0x12')](function(_0x103a32){if(_0x103a32){if(_0x103a32[_0x7df1('0x4a')]===_0x7df1('0x4b')&&!_0x103a32[_0x7df1('0x4c')]){var _0x3bef2e,_0x4160b2,_0x327953;if(_0x257c3a[_0x7df1('0x46')]['to']){_0x4160b2=_0x257c3a[_0x7df1('0x46')]['to'][_0x7df1('0x4d')](',')[0x0];}return db[_0x7df1('0x4e')][_0x7df1('0x4f')]({'where':{'id':_0x103a32[_0x7df1('0x50')]},'include':[{'model':db[_0x7df1('0x51')],'as':'List','include':[{'model':db['CmContact'],'as':_0x7df1('0x52'),'where':{'email':_0x4160b2},'limit':0x1,'order':[[_0x7df1('0x53'),_0x7df1('0x54')]]}]},{'model':db[_0x7df1('0x55')],'as':_0x7df1('0x56'),'raw':!![],'include':[{'model':db[_0x7df1('0x57')],'as':_0x7df1('0x57'),'raw':!![]}]}]})[_0x7df1('0x12')](function(_0x82534a){_0x3bef2e=_0x82534a;if(!_0x3bef2e||!_0x3bef2e[_0x7df1('0x56')])return;var _0x2545ed=_0x3bef2e[_0x7df1('0x58')]();if(_0x257c3a[_0x7df1('0x46')][_0x7df1('0x59')]&&_0x257c3a[_0x7df1('0x46')][_0x7df1('0x59')][_0x7df1('0x43')]){for(var _0x2a4463=0x0;_0x2a4463<_0x257c3a[_0x7df1('0x46')][_0x7df1('0x59')]['length'];_0x2a4463+=0x1){_0x257c3a[_0x7df1('0x46')][_0x7df1('0x59')][_0x2a4463]={'filename':_0x257c3a[_0x7df1('0x46')][_0x7df1('0x59')][_0x2a4463][_0x7df1('0x27')],'path':path['join'](config['root'],_0x7df1('0x5a'),_0x257c3a[_0x7df1('0x46')]['attachments'][_0x2a4463]['basename'])};}}_0x327953={'account':_0x2545ed,'message':_0x257c3a[_0x7df1('0x46')]};return;})[_0x7df1('0x12')](function(){if(_0x3bef2e[_0x7df1('0x5b')]){if(_0x3bef2e[_0x7df1('0x5b')][_0x7df1('0x52')][_0x7df1('0x43')]){return _0x3bef2e['List'][_0x7df1('0x52')][0x0];}else{return db[_0x7df1('0x5c')][_0x7df1('0x49')](_['defaults'](_0x257c3a[_0x7df1('0x46')],{'firstName':_0x257c3a[_0x7df1('0x46')]['to'],'email':_0x257c3a['body']['to'],'phone':_0x257c3a[_0x7df1('0x46')]['to'],'ListId':_0x3bef2e[_0x7df1('0x5d')]}));}}else{throw new Error(_0x7df1('0x5e'));}})[_0x7df1('0x12')](function(){if(_0x327953){return respondWithRpcPromise('SendMail','sendMail',_0x327953,client9003)[_0x7df1('0x12')](function(_0x29ccfc){return _0x103a32[_0x7df1('0x5f')]({'read':!![],'messageId':_0x29ccfc[_0x7df1('0x60')],'sentAt':moment()[_0x7df1('0x61')](_0x7df1('0x62'))});})[_0x7df1('0x1c')](function(_0x1b350e){logger[_0x7df1('0x18')]('%s',JSON[_0x7df1('0x17')](_0x1b350e));return _0x103a32;});}return _0x103a32;});}return _0x103a32;}})['then'](respondWithResult(_0x456a61,0xc9))['catch'](handleError(_0x456a61,null));};exports[_0x7df1('0x63')]=function(_0x55d493,_0x7e8e3d){var _0x1198de={'agent':{},'channel':_0x7df1('0x64')};if(_0x55d493['body']['id']){delete _0x55d493[_0x7df1('0x46')]['id'];}_0x55d493[_0x7df1('0x46')][_0x7df1('0x65')]=!![];_0x55d493[_0x7df1('0x46')][_0x7df1('0x66')]=moment()[_0x7df1('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x55d493[_0x7df1('0x46')]['UserId']=_0x55d493[_0x7df1('0x46')]['UserId']||_0x55d493[_0x7df1('0x67')]['id'];_0x1198de[_0x7df1('0x68')]['id']=_0x55d493['body'][_0x7df1('0x69')];return db[_0x7df1('0x2a')][_0x7df1('0x45')]({'where':{'id':_0x55d493[_0x7df1('0x47')]['id'],'UserId':null}})[_0x7df1('0x12')](handleEntityNotFound(_0x7e8e3d,null))[_0x7df1('0x12')](saveUpdates(_0x55d493[_0x7df1('0x46')],null))[_0x7df1('0x12')](function(_0x15ef8c){if(_0x15ef8c){_0x1198de[_0x7df1('0x19')]=_0x15ef8c[_0x7df1('0x6a')]({'plain':!![]});return db[_0x7df1('0x6b')][_0x7df1('0x45')]({'where':{'id':_0x15ef8c[_0x7df1('0x6c')]}});}return null;})[_0x7df1('0x12')](handleEntityNotFound(_0x7e8e3d,null))[_0x7df1('0x12')](function(_0x132e60){if(_0x132e60){return _0x132e60[_0x7df1('0x5f')]({'UserId':_0x55d493[_0x7df1('0x46')]['UserId'],'read1stAt':_['isNil'](_0x132e60['read1stAt'])?moment()[_0x7df1('0x61')](_0x7df1('0x62')):undefined});}return null;})['then'](function(_0x5055d7){if(_0x5055d7){_0x1198de[_0x7df1('0x6d')]=_0x5055d7['get']({'plain':!![]});interaction_log[_0x7df1('0x1a')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x55d493['user']['id'],_0x55d493['user']['name'],_0x55d493['user'][_0x7df1('0x6e')],_0x1198de[_0x7df1('0x6d')]['id'],_0x55d493[_0x7df1('0x46')]?JSON[_0x7df1('0x17')](_0x55d493[_0x7df1('0x46')]):_0x7df1('0x6f'));return respondWithRpcPromise(_0x7df1('0x70'),_0x7df1('0x71'),_0x1198de);}return null;})[_0x7df1('0x12')](function(_0x43c953){var _0x53d127=_0x7df1('0x72')+_0x43c953[_0x7df1('0x19')]['ContactId'];return db[_0x7df1('0x73')][_0x7df1('0x32')](_0x53d127,{'type':db[_0x7df1('0x74')][_0x7df1('0x75')][_0x7df1('0x76')],'raw':!![]})['then'](function(_0x1a0971){return _0x1a0971;});})[_0x7df1('0x12')](function(_0x1546d2){if(_0x1546d2){_0x1198de[_0x7df1('0x19')][_0x7df1('0x77')]=_0x1546d2[0x0];if(!_0x55d493[_0x7df1('0x46')][_0x7df1('0x69')])return;return db[_0x7df1('0x78')][_0x7df1('0x45')]({'where':{'id':_0x55d493[_0x7df1('0x46')][_0x7df1('0x69')],'role':_0x7df1('0x68')},'attributes':['id',_0x7df1('0x27'),_0x7df1('0x79'),_0x7df1('0x7a'),'internal'],'raw':!![]});}return null;})[_0x7df1('0x12')](function(_0x157562){if(!_0x157562)return null;_0x1198de[_0x7df1('0x19')][_0x7df1('0x68')]=_0x157562;return _0x1198de;})[_0x7df1('0x12')](function(_0x582089){if(_0x582089){if(_0x55d493[_0x7df1('0x46')][_0x7df1('0x7b')]){_0x1198de['message'][_0x7df1('0x7c')]=util[_0x7df1('0x61')](_0x7df1('0x7d'),_0x55d493[_0x7df1('0x67')][_0x7df1('0x27')]);_0x1198de[_0x7df1('0x19')][_0x7df1('0x7e')]=_0x1198de[_0x7df1('0x7e')];_0x1198de['message']['motionChannel']=_0x1198de[_0x7df1('0x7e')];_0x1198de[_0x7df1('0x19')]['event']=_0x7df1('0x63');_0x1198de[_0x7df1('0x19')][_0x7df1('0x46')]=htmlToText[_0x7df1('0x7f')](_0x1198de['message'][_0x7df1('0x46')]);return respondWithRpcPromise(_0x7df1('0x80'),_0x7df1('0x80'),{'event':_0x7df1('0x81'),'message':_0x1198de[_0x7df1('0x19')]},client9002)[_0x7df1('0x12')](function(){return _0x1198de;});}return _0x1198de;}return null;})[_0x7df1('0x12')](respondWithResult(_0x7e8e3d,null))[_0x7df1('0x1c')](handleError(_0x7e8e3d,null));};exports['reject']=function(_0xdafebd,_0x4969d4){var _0x15bb98={'agent':{},'channel':'mail'};if(_0xdafebd[_0x7df1('0x46')]['id']){delete _0xdafebd[_0x7df1('0x46')]['id'];}_0xdafebd['body'][_0x7df1('0x69')]=_0xdafebd[_0x7df1('0x46')]['UserId']||_0xdafebd[_0x7df1('0x67')]['id'];_0x15bb98[_0x7df1('0x68')]['id']=_0xdafebd['body'][_0x7df1('0x69')];return db[_0x7df1('0x2a')]['find']({'where':{'id':_0xdafebd[_0x7df1('0x47')]['id'],'UserId':null}})[_0x7df1('0x12')](handleEntityNotFound(_0x4969d4,null))[_0x7df1('0x12')](function(_0x2ef26a){if(_0x2ef26a){_0x15bb98['message']=_0x2ef26a['get']({'plain':!![]});return db['MailInteraction'][_0x7df1('0x45')]({'where':{'id':_0x2ef26a[_0x7df1('0x6c')]}});}return null;})[_0x7df1('0x12')](handleEntityNotFound(_0x4969d4,null))['then'](function(_0x2ad9d8){if(_0x2ad9d8){_0x15bb98[_0x7df1('0x6d')]=_0x2ad9d8[_0x7df1('0x6a')]({'plain':!![]});interaction_log[_0x7df1('0x1a')](_0x7df1('0x82'),_0xdafebd['user']['id'],_0xdafebd['user'][_0x7df1('0x27')],_0xdafebd[_0x7df1('0x67')][_0x7df1('0x6e')],_0x15bb98[_0x7df1('0x6d')]['id'],_0xdafebd[_0x7df1('0x46')]?JSON['stringify'](_0xdafebd['body']):_0x7df1('0x6f'));return respondWithRpcPromise(_0x7df1('0x83'),'rejectMessage',_0x15bb98);}return null;})[_0x7df1('0x12')](function(_0x7bf37a){var _0x2f9ab6=_0x7df1('0x72')+_0x7bf37a['message'][_0x7df1('0x84')];return db[_0x7df1('0x73')][_0x7df1('0x32')](_0x2f9ab6,{'type':db['Sequelize'][_0x7df1('0x75')]['SELECT'],'raw':!![]})['then'](function(_0x46983e){return _0x46983e;});})[_0x7df1('0x12')](function(_0x10f277){if(_0x10f277){_0x15bb98[_0x7df1('0x19')][_0x7df1('0x77')]=_0x10f277[0x0];if(!_0xdafebd['body'][_0x7df1('0x69')])return;return db[_0x7df1('0x78')][_0x7df1('0x45')]({'where':{'id':_0xdafebd[_0x7df1('0x46')]['UserId'],'role':_0x7df1('0x68')},'attributes':['id','name',_0x7df1('0x79'),_0x7df1('0x7a'),'internal'],'raw':!![]});}return null;})['then'](function(_0x517d3c){if(!_0x517d3c)return null;_0x15bb98['message'][_0x7df1('0x68')]=_0x517d3c;return _0x15bb98;})[_0x7df1('0x12')](function(_0x5c0168){if(_0x5c0168){_0x5c0168[_0x7df1('0x19')][_0x7df1('0x7c')]=util[_0x7df1('0x61')](_0x7df1('0x7d'),_0xdafebd[_0x7df1('0x67')][_0x7df1('0x27')]);_0x5c0168[_0x7df1('0x19')][_0x7df1('0x7e')]=_0x15bb98['channel'];_0x5c0168[_0x7df1('0x19')]['motionChannel']=_0x15bb98[_0x7df1('0x7e')];_0x5c0168[_0x7df1('0x19')]['event']=_0x7df1('0x85');_0x5c0168[_0x7df1('0x19')]['body']=htmlToText['fromString'](_0x15bb98[_0x7df1('0x19')][_0x7df1('0x46')]);respondWithRpcPromise(_0x7df1('0x80'),_0x7df1('0x80'),{'event':_0x7df1('0x86'),'message':_0x5c0168[_0x7df1('0x19')]},client9002);return _0x15bb98;}return null;})[_0x7df1('0x12')](respondWithResult(_0x4969d4,null))[_0x7df1('0x1c')](handleError(_0x4969d4,null));};exports['download']=function(_0x3b7c01,_0x10e2f3){var _0x3265f4=moment()[_0x7df1('0x87')]()[_0x7df1('0x88')]();var _0x105726=path[_0x7df1('0x89')](config[_0x7df1('0x8a')],_0x7df1('0x8b'),_0x7df1('0x8c'),_0x7df1('0x8d'));var _0x3db1cf=path[_0x7df1('0x89')](config[_0x7df1('0x8a')],_0x7df1('0x8b'),_0x7df1('0x8c'),_0x7df1('0x59'));var _0x490b3b=util['format'](_0x7df1('0x8e'),_0x3265f4);return db[_0x7df1('0x2a')][_0x7df1('0x45')]({'where':{'id':_0x3b7c01[_0x7df1('0x47')]['id']},'attributes':['id',_0x7df1('0x46'),_0x7df1('0x8f'),'to','cc',_0x7df1('0x90'),_0x7df1('0x91'),_0x7df1('0x92')],'include':_0x3b7c01[_0x7df1('0x32')]['attachments']?[{'model':db[_0x7df1('0x93')],'as':_0x7df1('0x94')}]:undefined})['then'](handleEntityNotFound(_0x10e2f3,null))[_0x7df1('0x12')](function(_0x39e569){if(_0x39e569){var _0x4bfc66=_0x39e569;var _0xb932d5={'from':_0x4bfc66[_0x7df1('0x8f')],'to':_0x4bfc66['to'],'subject':_0x4bfc66[_0x7df1('0x91')],'html':htmlEntities[_0x7df1('0x95')](_0x4bfc66[_0x7df1('0x46')]),'headers':{'Date':moment(_0x4bfc66['createdAt'])['format'](_0x7df1('0x96'))},'attachments':[]};if(_0x39e569['cc']){_0xb932d5[_0x7df1('0x97')]['Cc']=_0x39e569['cc'];}if(_0x39e569['bcc']){_0xb932d5[_0x7df1('0x97')][_0x7df1('0x98')]=_0x39e569[_0x7df1('0x90')];}return new BPromise(function(_0x47536a,_0x4e3200){if(_0x39e569[_0x7df1('0x94')]){for(var _0x2817ff=0x0;_0x2817ff<_0x39e569['Attachments'][_0x7df1('0x43')];_0x2817ff++){var _0x6f1366=_0x39e569[_0x7df1('0x94')][_0x2817ff];var _0xb7dacd=path[_0x7df1('0x89')](_0x3db1cf,_0x6f1366['basename']);if(fs[_0x7df1('0x99')](_0xb7dacd)){_0xb932d5[_0x7df1('0x59')]['push']({'name':_0x6f1366['name'],'contentType':_0x6f1366[_0x7df1('0x2d')],'data':fs[_0x7df1('0x9a')](_0xb7dacd)});}}}emlformat['build'](_0xb932d5,function(_0x1e1c70,_0x18fd43){if(_0x1e1c70)return _0x4e3200(_0x1e1c70);fs[_0x7df1('0x9b')](path[_0x7df1('0x89')](_0x105726,_0x490b3b),_0x18fd43);return _0x47536a(_0x18fd43);});});}})[_0x7df1('0x12')](function(_0x3789b3){if(_0x3789b3){return _0x10e2f3[_0x7df1('0x9c')](path[_0x7df1('0x89')](_0x105726,_0x490b3b),_0x490b3b,function(_0x37716b){if(!_0x37716b)fs[_0x7df1('0x9d')](path[_0x7df1('0x89')](_0x105726,_0x490b3b));});}})[_0x7df1('0x1c')](handleError(_0x10e2f3,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index e00f920..ba23a77 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 _0xe7bb=['../../mysqldb','MailMessage','setMaxListeners','remove','emit','hook','exports'];(function(_0x210210,_0x5b947f){var _0x4f6445=function(_0x4d2228){while(--_0x4d2228){_0x210210['push'](_0x210210['shift']());}};_0x4f6445(++_0x5b947f);}(_0xe7bb,0x17a));var _0xbe7b=function(_0x36be2d,_0x49893a){_0x36be2d=_0x36be2d-0x0;var _0x1f9224=_0xe7bb[_0x36be2d];return _0x1f9224;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xbe7b('0x0'))['db'][_0xbe7b('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xbe7b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbe7b('0x3')};function emitEvent(_0x5811f2){return function(_0x3b542b,_0x202185,_0x14ccbf){MailMessageEvents[_0xbe7b('0x4')](_0x5811f2+':'+_0x3b542b['id'],_0x3b542b);MailMessageEvents[_0xbe7b('0x4')](_0x5811f2,_0x3b542b);_0x14ccbf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xbe7b('0x5')](e,emitEvent(event));}}module[_0xbe7b('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x1156=['emit','hasOwnProperty','hook','events','MailMessage','setMaxListeners'];(function(_0x580793,_0x7b89c3){var _0x57fe1d=function(_0x2ef8fb){while(--_0x2ef8fb){_0x580793['push'](_0x580793['shift']());}};_0x57fe1d(++_0x7b89c3);}(_0x1156,0x1bf));var _0x6115=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x1156[_0xb0f7c3];return _0x28ea68;};'use strict';var EventEmitter=require(_0x6115('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x6115('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x6115('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x38cce9){return function(_0x511e91,_0x5a9536,_0x514c76){MailMessageEvents[_0x6115('0x3')](_0x38cce9+':'+_0x511e91['id'],_0x511e91);MailMessageEvents['emit'](_0x38cce9,_0x511e91);_0x514c76(null);};}for(var e in events){if(events[_0x6115('0x4')](e)){var event=events[e];MailMessage[_0x6115('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index e809391..49c22d3 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 _0xb7f7=['get','toLowerCase','direction','out','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models'];(function(_0x4fed2d,_0x67d543){var _0x5725d7=function(_0x4af489){while(--_0x4af489){_0x4fed2d['push'](_0x4fed2d['shift']());}};_0x5725d7(++_0x67d543);}(_0xb7f7,0xbd));var _0x7b7f=function(_0x4976f6,_0x2f1ba8){_0x4976f6=_0x4976f6-0x0;var _0x38924a=_0xb7f7[_0x4976f6];return _0x38924a;};'use strict';var _=require(_0x7b7f('0x0'));var util=require(_0x7b7f('0x1'));var logger=require('../../config/logger')(_0x7b7f('0x2'));var moment=require(_0x7b7f('0x3'));var BPromise=require('bluebird');var rp=require(_0x7b7f('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x7b7f('0x5'));var rimraf=require(_0x7b7f('0x6'));var config=require(_0x7b7f('0x7'));var attributes=require(_0x7b7f('0x8'));module[_0x7b7f('0x9')]=function(_0xe13ae4,_0x49ad8b){return _0xe13ae4[_0x7b7f('0xa')](_0x7b7f('0xb'),attributes,{'tableName':_0x7b7f('0xc'),'paranoid':![],'indexes':[{'name':_0x7b7f('0xd'),'fields':[_0x7b7f('0xd')]},{'name':_0x7b7f('0xe'),'fields':[_0x7b7f('0xf'),_0x7b7f('0x10')],'type':_0x7b7f('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x45284d,_0x285880,_0x1ec00a){if(_0x45284d[_0x7b7f('0x12')]){_0x45284d[_0x7b7f('0xf')]=htmlToText[_0x7b7f('0x13')](_0x45284d[_0x7b7f('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1ec00a(null,_0x285880);},'afterCreate':function(_0x5694a5,_0x588a9e,_0x33fce5){var _0x49f40a=_0xe13ae4[_0x7b7f('0x14')];var _0x277039=_0x5694a5[_0x7b7f('0x15')]({'plain':!![]});if(_0x277039['direction'][_0x7b7f('0x16')]()==='in'||_0x277039[_0x7b7f('0x17')][_0x7b7f('0x16')]()===_0x7b7f('0x18')&&!_0x277039['secret']&&!_[_0x7b7f('0x19')](_0x277039[_0x7b7f('0x1a')])){_0x49f40a[_0x7b7f('0x1b')][_0x7b7f('0x1c')]({'where':{'id':_0x277039[_0x7b7f('0x1d')]}})[_0x7b7f('0x1e')](function(_0x2b0f57){if(_0x2b0f57){_0x2b0f57[_0x7b7f('0x1f')]({'lastMsgAt':_0x277039['createdAt'],'lastMsgDirection':_0x277039[_0x7b7f('0x17')]['toLowerCase']()});}})[_0x7b7f('0x20')](function(_0x5e283a){console['error'](_0x5e283a);});}_0x33fce5();}},'charset':_0x7b7f('0x21'),'collate':_0x7b7f('0x22')});}; \ No newline at end of file +var _0x3b18=['messageId','fti_mail_messages','subject','FULLTEXT','plainBody','fromString','body','models','get','direction','toLowerCase','out','isNil','MailInteraction','MailInteractionId','then','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0x3b18,0xfb));var _0x83b1=function(_0x59abd1,_0x4279cb){_0x59abd1=_0x59abd1-0x0;var _0x10b80e=_0x3b18[_0x59abd1];return _0x10b80e;};'use strict';var _=require('lodash');var util=require(_0x83b1('0x0'));var logger=require(_0x83b1('0x1'))(_0x83b1('0x2'));var moment=require(_0x83b1('0x3'));var BPromise=require(_0x83b1('0x4'));var rp=require('request-promise');var htmlToText=require(_0x83b1('0x5'));var fs=require('fs');var path=require(_0x83b1('0x6'));var rimraf=require(_0x83b1('0x7'));var config=require(_0x83b1('0x8'));var attributes=require(_0x83b1('0x9'));module['exports']=function(_0x56e7d6,_0x3d928b){return _0x56e7d6[_0x83b1('0xa')](_0x83b1('0xb'),attributes,{'tableName':_0x83b1('0xc'),'paranoid':![],'indexes':[{'name':_0x83b1('0xd'),'fields':[_0x83b1('0xd')]},{'name':_0x83b1('0xe'),'fields':['plainBody',_0x83b1('0xf')],'type':_0x83b1('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2995a9,_0x202292,_0x38e47e){if(_0x2995a9['body']){_0x2995a9[_0x83b1('0x11')]=htmlToText[_0x83b1('0x12')](_0x2995a9[_0x83b1('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x38e47e(null,_0x202292);},'afterCreate':function(_0x439217,_0x2826b4,_0x302ec4){var _0x4e3bf3=_0x56e7d6[_0x83b1('0x14')];var _0x508135=_0x439217[_0x83b1('0x15')]({'plain':!![]});if(_0x508135[_0x83b1('0x16')][_0x83b1('0x17')]()==='in'||_0x508135[_0x83b1('0x16')][_0x83b1('0x17')]()===_0x83b1('0x18')&&!_0x508135['secret']&&!_[_0x83b1('0x19')](_0x508135['UserId'])){_0x4e3bf3[_0x83b1('0x1a')]['findOne']({'where':{'id':_0x508135[_0x83b1('0x1b')]}})[_0x83b1('0x1c')](function(_0x263c95){if(_0x263c95){_0x263c95['update']({'lastMsgAt':_0x508135[_0x83b1('0x1d')],'lastMsgDirection':_0x508135['direction'][_0x83b1('0x17')]()});}})[_0x83b1('0x1e')](function(_0x4513c3){console[_0x83b1('0x1f')](_0x4513c3);});}_0x302ec4();}},'charset':'utf8mb4','collate':_0x83b1('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 72408e9..9cf1169 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 _0x4213=['request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4213,0x77));var _0x3421=function(_0x1e395e,_0x23bf1f){_0x1e395e=_0x1e395e-0x0;var _0x3881ee=_0x4213[_0x1e395e];return _0x3881ee;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var moment=require(_0x3421('0x2'));var BPromise=require(_0x3421('0x3'));var rs=require(_0x3421('0x4'));var fs=require('fs');var Redis=require(_0x3421('0x5'));var db=require(_0x3421('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3421('0x7'))('rpc');var config=require(_0x3421('0x8'));var jayson=require(_0x3421('0x9'));var client=jayson[_0x3421('0xa')][_0x3421('0xb')]({'port':0x232a});config['redis']=_[_0x3421('0xc')](config[_0x3421('0xd')],{'host':_0x3421('0xe'),'port':0x18eb});var socket=require(_0x3421('0xf'))(new Redis(config[_0x3421('0xd')]));require('./mailMessage.socket')[_0x3421('0x10')](socket);function respondWithRpcPromise(_0x58d511,_0x4ff986,_0x12eee0){return new BPromise(function(_0x4b9d24,_0x2d8676){return client[_0x3421('0x11')](_0x58d511,_0x12eee0)[_0x3421('0x12')](function(_0x38b521){logger[_0x3421('0x13')](_0x3421('0x14'),_0x4ff986,_0x3421('0x15'));logger['debug'](_0x3421('0x16'),_0x4ff986,_0x3421('0x15'),JSON[_0x3421('0x17')](_0x38b521));if(_0x38b521[_0x3421('0x18')]){if(_0x38b521[_0x3421('0x18')][_0x3421('0x19')]===0x1f4){logger[_0x3421('0x18')]('MailMessage,\x20%s,\x20%s',_0x4ff986,_0x38b521[_0x3421('0x18')]['message']);return _0x2d8676(_0x38b521[_0x3421('0x18')][_0x3421('0x1a')]);}logger['error'](_0x3421('0x14'),_0x4ff986,_0x38b521['error'][_0x3421('0x1a')]);return _0x4b9d24(_0x38b521[_0x3421('0x18')]['message']);}else{logger[_0x3421('0x13')](_0x3421('0x14'),_0x4ff986,_0x3421('0x15'));_0x4b9d24(_0x38b521[_0x3421('0x1b')][_0x3421('0x1a')]);}})[_0x3421('0x1c')](function(_0x3f1b1d){logger[_0x3421('0x18')](_0x3421('0x14'),_0x4ff986,_0x3f1b1d);_0x2d8676(_0x3f1b1d);});});}exports[_0x3421('0x1d')]=function(_0x538a8b){var _0x50d9a5=this;return new Promise(function(_0x420114,_0x4b59a5){return db['MailMessage']['create'](_0x538a8b[_0x3421('0x1e')],{'raw':_0x538a8b[_0x3421('0x1f')]?_0x538a8b[_0x3421('0x1f')][_0x3421('0x20')]===undefined?!![]:![]:!![]})[_0x3421('0x12')](function(_0x39bed4){logger[_0x3421('0x13')](_0x3421('0x1d'),_0x538a8b);logger[_0x3421('0x21')](_0x3421('0x1d'),_0x538a8b,JSON['stringify'](_0x39bed4));_0x420114(_0x39bed4);})['catch'](function(_0x494423){logger[_0x3421('0x18')](_0x3421('0x1d'),_0x494423[_0x3421('0x1a')],_0x538a8b);_0x4b59a5(_0x50d9a5['error'](0x1f4,_0x494423['message']));});});}; \ No newline at end of file +var _0xd4f4=['CreateMailMessage','create','body','options','raw','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x41e3e5,_0x441240){var _0x4b5b5c=function(_0x5b988a){while(--_0x5b988a){_0x41e3e5['push'](_0x41e3e5['shift']());}};_0x4b5b5c(++_0x441240);}(_0xd4f4,0x8b));var _0x4d4f=function(_0xf3ee14,_0x17699a){_0xf3ee14=_0xf3ee14-0x0;var _0x4aebbb=_0xd4f4[_0xf3ee14];return _0x4aebbb;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4d4f('0xb')]=_[_0x4d4f('0xc')](config[_0x4d4f('0xb')],{'host':_0x4d4f('0xd'),'port':0x18eb});var socket=require(_0x4d4f('0xe'))(new Redis(config[_0x4d4f('0xb')]));require(_0x4d4f('0xf'))[_0x4d4f('0x10')](socket);function respondWithRpcPromise(_0x385597,_0xba5200,_0x20db50){return new BPromise(function(_0x88b592,_0x128d39){return client[_0x4d4f('0x11')](_0x385597,_0x20db50)[_0x4d4f('0x12')](function(_0x28fb3e){logger[_0x4d4f('0x13')](_0x4d4f('0x14'),_0xba5200,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0xba5200,_0x4d4f('0x15'),JSON[_0x4d4f('0x16')](_0x28fb3e));if(_0x28fb3e['error']){if(_0x28fb3e[_0x4d4f('0x17')][_0x4d4f('0x18')]===0x1f4){logger[_0x4d4f('0x17')]('MailMessage,\x20%s,\x20%s',_0xba5200,_0x28fb3e[_0x4d4f('0x17')][_0x4d4f('0x19')]);return _0x128d39(_0x28fb3e[_0x4d4f('0x17')]['message']);}logger[_0x4d4f('0x17')]('MailMessage,\x20%s,\x20%s',_0xba5200,_0x28fb3e[_0x4d4f('0x17')][_0x4d4f('0x19')]);return _0x88b592(_0x28fb3e[_0x4d4f('0x17')]['message']);}else{logger[_0x4d4f('0x13')](_0x4d4f('0x14'),_0xba5200,'request\x20sent');_0x88b592(_0x28fb3e['result']['message']);}})['catch'](function(_0x5eebec){logger[_0x4d4f('0x17')](_0x4d4f('0x14'),_0xba5200,_0x5eebec);_0x128d39(_0x5eebec);});});}exports[_0x4d4f('0x1a')]=function(_0x3566a5){var _0x5d7b1f=this;return new Promise(function(_0x5b2863,_0x1e1ae2){return db['MailMessage'][_0x4d4f('0x1b')](_0x3566a5[_0x4d4f('0x1c')],{'raw':_0x3566a5[_0x4d4f('0x1d')]?_0x3566a5[_0x4d4f('0x1d')][_0x4d4f('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x570520){logger[_0x4d4f('0x13')]('CreateMailMessage',_0x3566a5);logger[_0x4d4f('0x1f')](_0x4d4f('0x1a'),_0x3566a5,JSON[_0x4d4f('0x16')](_0x570520));_0x5b2863(_0x570520);})[_0x4d4f('0x20')](function(_0xf3f7a4){logger['error'](_0x4d4f('0x1a'),_0xf3f7a4[_0x4d4f('0x19')],_0x3566a5);_0x1e1ae2(_0x5d7b1f[_0x4d4f('0x17')](0x1f4,_0xf3f7a4[_0x4d4f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 3227ca9..a5d70d1 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 _0x7216=['removeListener','register','length','./mailMessage.events','save','remove','update','emit'];(function(_0x43e3f1,_0xbb0bfa){var _0x220cc5=function(_0x314092){while(--_0x314092){_0x43e3f1['push'](_0x43e3f1['shift']());}};_0x220cc5(++_0xbb0bfa);}(_0x7216,0xa3));var _0x6721=function(_0x3d81ed,_0x3aa355){_0x3d81ed=_0x3d81ed-0x0;var _0x12d894=_0x7216[_0x3d81ed];return _0x12d894;};'use strict';var MailMessageEvents=require(_0x6721('0x0'));var events=[_0x6721('0x1'),_0x6721('0x2'),_0x6721('0x3')];function createListener(_0x24353b,_0x22f583){return function(_0x319307){_0x22f583[_0x6721('0x4')](_0x24353b,_0x319307);};}function removeListener(_0x48d160,_0x16d253){return function(){MailMessageEvents[_0x6721('0x5')](_0x48d160,_0x16d253);};}exports[_0x6721('0x6')]=function(_0x9de1a){for(var _0x22d1b5=0x0,_0x4c9a7e=events[_0x6721('0x7')];_0x22d1b5<_0x4c9a7e;_0x22d1b5++){var _0x4cb334=events[_0x22d1b5];var _0x2af2e5=createListener('mailMessage:'+_0x4cb334,_0x9de1a);MailMessageEvents['on'](_0x4cb334,_0x2af2e5);}}; \ No newline at end of file +var _0x7e14=['./mailMessage.events','save','remove','update','emit','removeListener','register','length','mailMessage:'];(function(_0x40cacf,_0x324f5c){var _0x3d0566=function(_0x116fd2){while(--_0x116fd2){_0x40cacf['push'](_0x40cacf['shift']());}};_0x3d0566(++_0x324f5c);}(_0x7e14,0x99));var _0x47e1=function(_0x5aad8a,_0x445723){_0x5aad8a=_0x5aad8a-0x0;var _0x5c3148=_0x7e14[_0x5aad8a];return _0x5c3148;};'use strict';var MailMessageEvents=require(_0x47e1('0x0'));var events=[_0x47e1('0x1'),_0x47e1('0x2'),_0x47e1('0x3')];function createListener(_0x38207d,_0x40a3d6){return function(_0x4cd807){_0x40a3d6[_0x47e1('0x4')](_0x38207d,_0x4cd807);};}function removeListener(_0x2cb969,_0x3a8e11){return function(){MailMessageEvents[_0x47e1('0x5')](_0x2cb969,_0x3a8e11);};}exports[_0x47e1('0x6')]=function(_0xeb39da){for(var _0x81cadf=0x0,_0x5ef2d1=events[_0x47e1('0x7')];_0x81cadf<_0x5ef2d1;_0x81cadf++){var _0x5a5876=events[_0x81cadf];var _0x573026=createListener(_0x47e1('0x8')+_0x5a5876,_0xeb39da);MailMessageEvents['on'](_0x5a5876,_0x573026);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 98fee68..b509802 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 _0x6db5=['/:id','show','/:id/members','getMembers','getTeams','/:id/users','post','addTeams','addAgents','put','update','destroy','delete','/:id/teams','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x4c9cd5,_0x2f1033){var _0x6c1d39=function(_0x5066c6){while(--_0x5066c6){_0x4c9cd5['push'](_0x4c9cd5['shift']());}};_0x6c1d39(++_0x2f1033);}(_0x6db5,0x189));var _0x56db=function(_0x4dc852,_0x54bf25){_0x4dc852=_0x4dc852-0x0;var _0x5eeda2=_0x6db5[_0x4dc852];return _0x5eeda2;};'use strict';var multer=require(_0x56db('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x56db('0x1'));var express=require(_0x56db('0x2'));var router=express[_0x56db('0x3')]();var fs_extra=require(_0x56db('0x4'));var auth=require(_0x56db('0x5'));var interaction=require(_0x56db('0x6'));var config=require('../../config/environment');var controller=require(_0x56db('0x7'));router[_0x56db('0x8')]('/',auth[_0x56db('0x9')](),controller[_0x56db('0xa')]);router[_0x56db('0x8')](_0x56db('0xb'),auth[_0x56db('0x9')](),controller[_0x56db('0xc')]);router[_0x56db('0x8')](_0x56db('0xd'),auth['isAuthenticated'](),controller[_0x56db('0xe')]);router[_0x56db('0x8')](_0x56db('0xf'),auth[_0x56db('0x9')](),controller[_0x56db('0x10')]);router[_0x56db('0x8')]('/:id/teams',auth[_0x56db('0x9')](),controller[_0x56db('0x11')]);router['get'](_0x56db('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x56db('0x13')]('/',auth[_0x56db('0x9')](),controller['create']);router['post']('/:id/teams',auth[_0x56db('0x9')](),controller[_0x56db('0x14')]);router[_0x56db('0x13')](_0x56db('0x12'),auth[_0x56db('0x9')](),controller[_0x56db('0x15')]);router[_0x56db('0x16')](_0x56db('0xd'),auth[_0x56db('0x9')](),controller[_0x56db('0x17')]);router['delete'](_0x56db('0xd'),auth[_0x56db('0x9')](),controller[_0x56db('0x18')]);router[_0x56db('0x19')](_0x56db('0x1a'),auth[_0x56db('0x9')](),controller[_0x56db('0x1b')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x56db('0x1c')]=router; \ No newline at end of file +var _0xba28=['create','/:id/teams','addTeams','addAgents','put','update','destroy','removeTeams','delete','/:id/users','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','index','/describe','describe','/:id','isAuthenticated','getTeams','getAgents','post'];(function(_0x517a16,_0x1a612a){var _0x4b6b63=function(_0x5c9b1f){while(--_0x5c9b1f){_0x517a16['push'](_0x517a16['shift']());}};_0x4b6b63(++_0x1a612a);}(_0xba28,0x110));var _0x8ba2=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0xba28[_0x271060];return _0x40540b;};'use strict';var multer=require(_0x8ba2('0x0'));var util=require('util');var path=require(_0x8ba2('0x1'));var timeout=require(_0x8ba2('0x2'));var express=require(_0x8ba2('0x3'));var router=express[_0x8ba2('0x4')]();var fs_extra=require(_0x8ba2('0x5'));var auth=require(_0x8ba2('0x6'));var interaction=require(_0x8ba2('0x7'));var config=require('../../config/environment');var controller=require(_0x8ba2('0x8'));router[_0x8ba2('0x9')]('/',auth['isAuthenticated'](),controller[_0x8ba2('0xa')]);router['get'](_0x8ba2('0xb'),auth['isAuthenticated'](),controller[_0x8ba2('0xc')]);router[_0x8ba2('0x9')](_0x8ba2('0xd'),auth[_0x8ba2('0xe')](),controller['show']);router[_0x8ba2('0x9')]('/:id/members',auth[_0x8ba2('0xe')](),controller['getMembers']);router[_0x8ba2('0x9')]('/:id/teams',auth[_0x8ba2('0xe')](),controller[_0x8ba2('0xf')]);router['get']('/:id/users',auth[_0x8ba2('0xe')](),controller[_0x8ba2('0x10')]);router[_0x8ba2('0x11')]('/',auth[_0x8ba2('0xe')](),controller[_0x8ba2('0x12')]);router[_0x8ba2('0x11')](_0x8ba2('0x13'),auth[_0x8ba2('0xe')](),controller[_0x8ba2('0x14')]);router[_0x8ba2('0x11')]('/:id/users',auth[_0x8ba2('0xe')](),controller[_0x8ba2('0x15')]);router[_0x8ba2('0x16')](_0x8ba2('0xd'),auth[_0x8ba2('0xe')](),controller[_0x8ba2('0x17')]);router['delete']('/:id',auth[_0x8ba2('0xe')](),controller[_0x8ba2('0x18')]);router['delete'](_0x8ba2('0x13'),auth['isAuthenticated'](),controller[_0x8ba2('0x19')]);router[_0x8ba2('0x1a')](_0x8ba2('0x1b'),auth[_0x8ba2('0xe')](),controller[_0x8ba2('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 2654444..93dcd76 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 _0xa8fa=['STRING','INTEGER','rrmemory','roundrobin','sequelize'];(function(_0x6b514a,_0x519483){var _0x2dc542=function(_0x380c00){while(--_0x380c00){_0x6b514a['push'](_0x6b514a['shift']());}};_0x2dc542(++_0x519483);}(_0xa8fa,0x185));var _0xaa8f=function(_0x4800d3,_0x1fb329){_0x4800d3=_0x4800d3-0x0;var _0x488e2f=_0xa8fa[_0x4800d3];return _0x488e2f;};'use strict';var Sequelize=require(_0xaa8f('0x0'));module['exports']={'name':{'type':Sequelize[_0xaa8f('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xaa8f('0x1')]},'timeout':{'type':Sequelize[_0xaa8f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xaa8f('0x3'),'beepall',_0xaa8f('0x4'))}}; \ No newline at end of file +var _0x05f4=['name','STRING','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x4ec9a9,_0x1bd24f){var _0x5a19bf=function(_0x4aae8b){while(--_0x4aae8b){_0x4ec9a9['push'](_0x4ec9a9['shift']());}};_0x5a19bf(++_0x1bd24f);}(_0x05f4,0x1a3));var _0x405f=function(_0x56b429,_0x4750eb){_0x56b429=_0x56b429-0x0;var _0x11c33f=_0x05f4[_0x56b429];return _0x11c33f;};'use strict';var Sequelize=require(_0x405f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x405f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x405f('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x405f('0x3')](_0x405f('0x4'),_0x405f('0x5'),_0x405f('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 74a26c1..b8931a8 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 _0x6ebf=['getTeams','Team','order','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','isEmpty','userMailQueue:remove','addAgents','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','get','UserProfileResource','destroy','end','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','type','key','where','findAll','rows','catch','show','keys','query','intersection','model','attributes','fields','length','include','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MailQueues','UserProfileSection','autoAssociation','params','describe','getMembers','findOne','filters','hasOwnProperty','nolimit','sort','pick','MailQueueId','filter','UserMailQueue','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','%s/%s','SIP'];(function(_0x119a2a,_0x52a94f){var _0x22d268=function(_0x40714c){while(--_0x40714c){_0x119a2a['push'](_0x119a2a['shift']());}};_0x22d268(++_0x52a94f);}(_0x6ebf,0x197));var _0xf6eb=function(_0x5090d4,_0x1950a7){_0x5090d4=_0x5090d4-0x0;var _0x56c310=_0x6ebf[_0x5090d4];return _0x56c310;};'use strict';var BPromise=require('bluebird');var util=require(_0xf6eb('0x0'));var _=require(_0xf6eb('0x1'));var squel=require(_0xf6eb('0x2'));var Redis=require('ioredis');var qs=require(_0xf6eb('0x3'));var logger=require(_0xf6eb('0x4'))(_0xf6eb('0x5'));var config=require(_0xf6eb('0x6'));var db=require(_0xf6eb('0x7'))['db'];config[_0xf6eb('0x8')]=_[_0xf6eb('0x9')](config[_0xf6eb('0x8')],{'host':_0xf6eb('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6eb('0x8')]));require(_0xf6eb('0xb'))[_0xf6eb('0xc')](socket);function respondWithStatusCode(_0x3eac84,_0x44701f){_0x44701f=_0x44701f||0xcc;return function(_0x235047){if(_0x235047){return _0x3eac84[_0xf6eb('0xd')](_0x44701f);}return _0x3eac84[_0xf6eb('0xe')](_0x44701f)['end']();};}function respondWithResult(_0x3163d5,_0x267f8d){_0x267f8d=_0x267f8d||0xc8;return function(_0x42e10b){if(_0x42e10b){return _0x3163d5['status'](_0x267f8d)[_0xf6eb('0xf')](_0x42e10b);}};}function respondWithFilteredResult(_0x1d028a,_0xd4f8d5){return function(_0x8c165c){if(_0x8c165c){var _0x4cb2e9=typeof _0xd4f8d5[_0xf6eb('0x10')]===_0xf6eb('0x11')&&typeof _0xd4f8d5[_0xf6eb('0x12')]==='undefined';var _0x298aa3=_0x8c165c[_0xf6eb('0x13')];var _0x32f866=_0x4cb2e9?0x0:_0xd4f8d5[_0xf6eb('0x10')];var _0x14fae4=_0x4cb2e9?_0x8c165c[_0xf6eb('0x13')]:_0xd4f8d5[_0xf6eb('0x10')]+_0xd4f8d5[_0xf6eb('0x12')];var _0x52aab2;if(_0x14fae4>=_0x298aa3){_0x14fae4=_0x298aa3;_0x52aab2=0xc8;}else{_0x52aab2=0xce;}_0x1d028a['status'](_0x52aab2);return _0x1d028a['set'](_0xf6eb('0x14'),_0x32f866+'-'+_0x14fae4+'/'+_0x298aa3)[_0xf6eb('0xf')](_0x8c165c);}return null;};}function saveUpdates(_0x1fccdf){return function(_0x129969){if(_0x129969){return _0x129969[_0xf6eb('0x15')](_0x1fccdf)['then'](function(_0x2acba9){return _0x2acba9;});}return null;};}function removeEntity(_0xbb8174){return function(_0x2f97f1){if(_0x2f97f1){return _0x2f97f1['destroy']()[_0xf6eb('0x16')](function(){var _0xb24680=_0x2f97f1[_0xf6eb('0x17')]({'plain':!![]});var _0x159c48='MailQueues';return db[_0xf6eb('0x18')][_0xf6eb('0x19')]({'where':{'type':_0x159c48,'resourceId':_0xb24680['id']}})[_0xf6eb('0x16')](function(){return _0x2f97f1;});})['then'](function(){_0xbb8174['status'](0xcc)[_0xf6eb('0x1a')]();});}};}function handleEntityNotFound(_0x2aac87){return function(_0x56943c){if(!_0x56943c){_0x2aac87[_0xf6eb('0xd')](0x194);}return _0x56943c;};}function handleError(_0x2a1f70,_0x30cedc){_0x30cedc=_0x30cedc||0x1f4;return function(_0x1afc47){logger[_0xf6eb('0x1b')](_0x1afc47[_0xf6eb('0x1c')]);if(_0x1afc47[_0xf6eb('0x1d')]){delete _0x1afc47[_0xf6eb('0x1d')];}_0x2a1f70[_0xf6eb('0xe')](_0x30cedc)['send'](_0x1afc47);};}exports[_0xf6eb('0x1e')]=function(_0x55f58e,_0x479c0e){var _0xc255f2={};var _0x39fdd9={'count':0x0,'rows':[]};var _0x6049bf=_[_0xf6eb('0x1f')](db[_0xf6eb('0x20')][_0xf6eb('0x21')],function(_0x52432e){return{'name':_0x52432e[_0xf6eb('0x22')],'type':_0x52432e[_0xf6eb('0x23')][_0xf6eb('0x24')]};});_0xc255f2=qs['getOptions'](_0x6049bf,_0x55f58e);var _0x148321={'where':_0xc255f2[_0xf6eb('0x25')]};return db['MailQueue'][_0xf6eb('0x13')](_0x148321)[_0xf6eb('0x16')](function(_0x11ed4b){_0x39fdd9[_0xf6eb('0x13')]=_0x11ed4b;_0xc255f2['include']=qs['include'](_0x55f58e['query']);return db['MailQueue'][_0xf6eb('0x26')](_0xc255f2);})[_0xf6eb('0x16')](function(_0x1d6f06){_0x39fdd9[_0xf6eb('0x27')]=_0x1d6f06;return _0x39fdd9;})[_0xf6eb('0x16')](respondWithFilteredResult(_0x479c0e,_0xc255f2))[_0xf6eb('0x28')](handleError(_0x479c0e,null));};exports[_0xf6eb('0x29')]=function(_0x51b8ce,_0x493862){var _0x52766b={'raw':!![],'where':{'id':_0x51b8ce['params']['id']}},_0x515611={};_0x515611['model']=_[_0xf6eb('0x2a')](db['MailQueue'][_0xf6eb('0x21')]);_0x515611['query']=_['keys'](_0x51b8ce[_0xf6eb('0x2b')]);_0x515611['filters']=_[_0xf6eb('0x2c')](_0x515611[_0xf6eb('0x2d')],_0x515611[_0xf6eb('0x2b')]);_0x52766b[_0xf6eb('0x2e')]=_[_0xf6eb('0x2c')](_0x515611['model'],qs['fields'](_0x51b8ce[_0xf6eb('0x2b')][_0xf6eb('0x2f')]));_0x52766b[_0xf6eb('0x2e')]=_0x52766b['attributes'][_0xf6eb('0x30')]?_0x52766b[_0xf6eb('0x2e')]:_0x515611[_0xf6eb('0x2d')];if(_0x51b8ce[_0xf6eb('0x2b')]['includeAll']){_0x52766b[_0xf6eb('0x31')]=[{'all':!![]}];}_0x52766b=_[_0xf6eb('0x32')]({},_0x52766b,_0x51b8ce[_0xf6eb('0x33')]);return db[_0xf6eb('0x20')][_0xf6eb('0x34')](_0x52766b)[_0xf6eb('0x16')](handleEntityNotFound(_0x493862,null))['then'](respondWithResult(_0x493862,null))['catch'](handleError(_0x493862,null));};exports['create']=function(_0x29a5e5,_0x131414){return db[_0xf6eb('0x20')][_0xf6eb('0x35')](_0x29a5e5[_0xf6eb('0x36')],{})[_0xf6eb('0x16')](function(_0x2eee0e){var _0x21e586=_0x29a5e5['user']['get']({'plain':!![]});if(!_0x21e586)throw new Error(_0xf6eb('0x37'));if(_0x21e586[_0xf6eb('0x38')]===_0xf6eb('0x39')){var _0x194a0a=_0x2eee0e[_0xf6eb('0x17')]({'plain':!![]});var _0x466f8e=_0xf6eb('0x3a');return db[_0xf6eb('0x3b')][_0xf6eb('0x34')]({'where':{'name':_0x466f8e,'userProfileId':_0x21e586['userProfileId']},'raw':!![]})[_0xf6eb('0x16')](function(_0x29757f){if(_0x29757f&&_0x29757f[_0xf6eb('0x3c')]===0x0){return db[_0xf6eb('0x18')]['create']({'name':_0x194a0a['name'],'resourceId':_0x194a0a['id'],'type':_0x29757f[_0xf6eb('0x1d')],'sectionId':_0x29757f['id']},{})[_0xf6eb('0x16')](function(){return _0x2eee0e;});}else{return _0x2eee0e;}})[_0xf6eb('0x28')](function(_0x170411){logger[_0xf6eb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x170411);throw _0x170411;});}return _0x2eee0e;})[_0xf6eb('0x16')](respondWithResult(_0x131414,0xc9))[_0xf6eb('0x28')](handleError(_0x131414,null));};exports[_0xf6eb('0x15')]=function(_0x5da8fa,_0x3f6e6f){if(_0x5da8fa['body']['id']){delete _0x5da8fa[_0xf6eb('0x36')]['id'];}return db[_0xf6eb('0x20')][_0xf6eb('0x34')]({'where':{'id':_0x5da8fa[_0xf6eb('0x3d')]['id']}})[_0xf6eb('0x16')](handleEntityNotFound(_0x3f6e6f,null))['then'](saveUpdates(_0x5da8fa[_0xf6eb('0x36')],null))[_0xf6eb('0x16')](respondWithResult(_0x3f6e6f,null))[_0xf6eb('0x28')](handleError(_0x3f6e6f,null));};exports[_0xf6eb('0x19')]=function(_0x54c815,_0x14739a){return db[_0xf6eb('0x20')][_0xf6eb('0x34')]({'where':{'id':_0x54c815[_0xf6eb('0x3d')]['id']}})[_0xf6eb('0x16')](handleEntityNotFound(_0x14739a,null))[_0xf6eb('0x16')](removeEntity(_0x14739a,null))[_0xf6eb('0x28')](handleError(_0x14739a,null));};exports[_0xf6eb('0x3e')]=function(_0x2b7337,_0x581649){return db[_0xf6eb('0x20')][_0xf6eb('0x3e')]()[_0xf6eb('0x16')](respondWithResult(_0x581649,null))[_0xf6eb('0x28')](handleError(_0x581649,null));};exports[_0xf6eb('0x3f')]=function(_0xa0bb2b,_0x508476){var _0x468dde={'raw':!![],'where':{}},_0x3900df={},_0x150697;return db[_0xf6eb('0x20')][_0xf6eb('0x40')]({'where':{'id':_0xa0bb2b[_0xf6eb('0x3d')]['id']}})[_0xf6eb('0x16')](handleEntityNotFound(_0x508476,null))[_0xf6eb('0x16')](function(_0x3eead2){if(_0x3eead2){_0x150697=_0x3eead2[_0xf6eb('0x17')]({'plain':!![]});_0x3900df[_0xf6eb('0x2d')]=_[_0xf6eb('0x2a')](db['UserMailQueue'][_0xf6eb('0x21')]);_0x3900df[_0xf6eb('0x2b')]=_[_0xf6eb('0x2a')](_0xa0bb2b[_0xf6eb('0x2b')]);_0x3900df[_0xf6eb('0x41')]=_['intersection'](_0x3900df[_0xf6eb('0x2d')],_0x3900df['query']);_0x468dde[_0xf6eb('0x2e')]=_[_0xf6eb('0x2c')](_0x3900df[_0xf6eb('0x2d')],qs['fields'](_0xa0bb2b[_0xf6eb('0x2b')][_0xf6eb('0x2f')]));_0x468dde['attributes']=_0x468dde[_0xf6eb('0x2e')]['length']?_0x468dde[_0xf6eb('0x2e')]:_0x3900df[_0xf6eb('0x2d')];if(!_0xa0bb2b['query'][_0xf6eb('0x42')](_0xf6eb('0x43'))){_0x468dde[_0xf6eb('0x12')]=qs[_0xf6eb('0x12')](_0xa0bb2b[_0xf6eb('0x2b')][_0xf6eb('0x12')]);_0x468dde[_0xf6eb('0x10')]=qs[_0xf6eb('0x10')](_0xa0bb2b[_0xf6eb('0x2b')][_0xf6eb('0x10')]);}_0x468dde['order']=qs[_0xf6eb('0x44')](_0xa0bb2b[_0xf6eb('0x2b')][_0xf6eb('0x44')]);_0x468dde[_0xf6eb('0x25')]=qs['filters'](_[_0xf6eb('0x45')](_0xa0bb2b[_0xf6eb('0x2b')],_0x3900df['filters']));_0x468dde[_0xf6eb('0x25')][_0xf6eb('0x46')]=_0x3eead2['id'];if(_0xa0bb2b[_0xf6eb('0x2b')][_0xf6eb('0x47')]){_0x468dde[_0xf6eb('0x25')]=_[_0xf6eb('0x32')](_0x468dde[_0xf6eb('0x25')],{'$or':_[_0xf6eb('0x1f')](_0x468dde[_0xf6eb('0x2e')],function(_0x516377){var _0x169471={};_0x169471[_0x516377]={'$like':'%'+_0xa0bb2b['query'][_0xf6eb('0x47')]+'%'};return _0x169471;})});}_0x468dde=_[_0xf6eb('0x32')]({},_0x468dde,_0xa0bb2b[_0xf6eb('0x33')]);return db[_0xf6eb('0x48')]['findAll'](_0x468dde);}})[_0xf6eb('0x16')](function(_0xdeb0e5){if(_0xdeb0e5){return db[_0xf6eb('0x49')][_0xf6eb('0x4a')]({'where':{'id':_[_0xf6eb('0x1f')](_0xdeb0e5,'UserId'),'role':_0xf6eb('0x4b')},'attributes':['id','name',_0xf6eb('0x4c'),_0xf6eb('0x4d'),_0xf6eb('0x4e')]});}})[_0xf6eb('0x16')](function(_0x158096){if(_0x158096){return{'count':_0x158096[_0xf6eb('0x13')],'rows':_[_0xf6eb('0x1f')](_0x158096['rows'],function(_0x1d1237){return{'membername':_0x1d1237['name'],'UserId':_0x1d1237['id'],'queue_name':_0x150697[_0xf6eb('0x1d')],'MailQueueId':_0x150697['id'],'interface':util['format'](_0xf6eb('0x4f'),_0xf6eb('0x50'),_0x1d1237[_0xf6eb('0x1d')]),'penalty':0x0,'paused':_0x1d1237[_0xf6eb('0x4c')],'createdAt':_0x1d1237[_0xf6eb('0x4e')],'updatedAt':_0x1d1237[_0xf6eb('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf6eb('0x16')](respondWithFilteredResult(_0x508476,_0x468dde))[_0xf6eb('0x28')](handleError(_0x508476,null));};exports[_0xf6eb('0x51')]=function(_0x2b6fa0,_0x4e0659){var _0x27b486={};var _0x3094e9={};var _0x3a70e5;var _0x411f14;return db[_0xf6eb('0x20')]['findOne']({'where':{'id':_0x2b6fa0['params']['id']}})[_0xf6eb('0x16')](handleEntityNotFound(_0x4e0659,null))[_0xf6eb('0x16')](function(_0x3a5a08){if(_0x3a5a08){_0x3a70e5=_0x3a5a08;_0x3094e9[_0xf6eb('0x2d')]=_['keys'](db[_0xf6eb('0x52')][_0xf6eb('0x21')]);_0x3094e9[_0xf6eb('0x2b')]=_[_0xf6eb('0x2a')](_0x2b6fa0[_0xf6eb('0x2b')]);_0x3094e9[_0xf6eb('0x41')]=_[_0xf6eb('0x2c')](_0x3094e9[_0xf6eb('0x2d')],_0x3094e9[_0xf6eb('0x2b')]);_0x27b486[_0xf6eb('0x2e')]=_[_0xf6eb('0x2c')](_0x3094e9[_0xf6eb('0x2d')],qs[_0xf6eb('0x2f')](_0x2b6fa0['query'][_0xf6eb('0x2f')]));_0x27b486['attributes']=_0x27b486[_0xf6eb('0x2e')][_0xf6eb('0x30')]?_0x27b486[_0xf6eb('0x2e')]:_0x3094e9[_0xf6eb('0x2d')];_0x27b486[_0xf6eb('0x53')]=qs[_0xf6eb('0x44')](_0x2b6fa0[_0xf6eb('0x2b')][_0xf6eb('0x44')]);_0x27b486[_0xf6eb('0x25')]=qs[_0xf6eb('0x41')](_[_0xf6eb('0x45')](_0x2b6fa0[_0xf6eb('0x2b')],_0x3094e9[_0xf6eb('0x41')]));if(_0x2b6fa0['query'][_0xf6eb('0x47')]){_0x27b486[_0xf6eb('0x25')]=_['merge'](_0x27b486[_0xf6eb('0x25')],{'$or':_[_0xf6eb('0x1f')](_0x27b486['attributes'],function(_0x34fce2){var _0x2129b0={};_0x2129b0[_0x34fce2]={'$like':'%'+_0x2b6fa0[_0xf6eb('0x2b')][_0xf6eb('0x47')]+'%'};return _0x2129b0;})});}_0x27b486=_['merge']({},_0x27b486,_0x2b6fa0[_0xf6eb('0x33')]);return _0x3a70e5[_0xf6eb('0x51')](_0x27b486);}})[_0xf6eb('0x16')](function(_0xe3a490){if(_0xe3a490){_0x411f14=_0xe3a490[_0xf6eb('0x30')];if(!_0x2b6fa0[_0xf6eb('0x2b')][_0xf6eb('0x42')](_0xf6eb('0x43'))){_0x27b486[_0xf6eb('0x12')]=qs['limit'](_0x2b6fa0[_0xf6eb('0x2b')][_0xf6eb('0x12')]);_0x27b486[_0xf6eb('0x10')]=qs[_0xf6eb('0x10')](_0x2b6fa0['query']['offset']);}return _0x3a70e5[_0xf6eb('0x51')](_0x27b486);}})[_0xf6eb('0x16')](function(_0x30f850){if(_0x30f850){return _0x30f850?{'count':_0x411f14,'rows':_0x30f850}:null;}})[_0xf6eb('0x16')](respondWithResult(_0x4e0659,null))[_0xf6eb('0x28')](handleError(_0x4e0659,null));};exports[_0xf6eb('0x54')]=function(_0x19a675,_0xd7736a){var _0x37a439=_0x19a675[_0xf6eb('0x36')]['ids'];return db[_0xf6eb('0x52')][_0xf6eb('0x26')]({'where':{'id':_0x37a439},'attributes':['id'],'include':[{'model':db[_0xf6eb('0x49')],'as':_0xf6eb('0x55'),'attributes':['id',_0xf6eb('0x1d'),_0xf6eb('0x56'),_0xf6eb('0x57'),_0xf6eb('0x58')],'raw':!![]}]})[_0xf6eb('0x16')](function(_0x3ba0ff){if(_0x3ba0ff){var _0x13b46=_[_0xf6eb('0x59')](_0x3ba0ff,function(_0x71dd01){var _0x2eecba=_0x71dd01['get']({'plain':!![]});return _0x2eecba[_0xf6eb('0x55')];});return db['MailQueue']['find']({'where':{'id':_0x19a675[_0xf6eb('0x3d')]['id']}})[_0xf6eb('0x16')](function(_0x5a28f5){return db[_0xf6eb('0x5a')][_0xf6eb('0x5b')](function(_0x36e367){return _0x5a28f5[_0xf6eb('0x54')](_0x37a439,{'transaction':_0x36e367})['then'](function(){return BPromise['each'](_0x13b46,function(_0x37a0ad){return db[_0xf6eb('0x48')][_0xf6eb('0x5c')]({'where':{'UserId':_0x37a0ad['id'],'MailQueueId':_0x19a675['params']['id']},'transaction':_0x36e367});});})['then'](function(){_0x13b46[_0xf6eb('0x5d')](function(_0x17945f){socket[_0xf6eb('0x5e')](_0xf6eb('0x5f'),{'UserId':_0x17945f['id'],'MailQueueId':_0x5a28f5['id']});});});});});}})[_0xf6eb('0x16')](respondWithStatusCode(_0xd7736a,null))[_0xf6eb('0x28')](handleError(_0xd7736a,null));};exports[_0xf6eb('0x60')]=function(_0x29f675,_0x30666d){return db[_0xf6eb('0x52')]['findAll']({'where':{'id':_0x29f675[_0xf6eb('0x2b')][_0xf6eb('0x61')]},'attributes':['id'],'include':[{'model':db[_0xf6eb('0x49')],'as':_0xf6eb('0x55'),'attributes':['id'],'raw':!![]}]})[_0xf6eb('0x16')](handleEntityNotFound(_0x30666d,null))[_0xf6eb('0x16')](function(_0x3fc340){var _0x177787=_[_0xf6eb('0x1f')](_0x3fc340,'id');var _0x200171=[];var _0x2b252d=[];var _0x2b0b9e=squel[_0xf6eb('0x62')]();_0x2b0b9e[_0xf6eb('0x63')](_0xf6eb('0x64'))[_0xf6eb('0x65')](_0xf6eb('0x66'),'tq')[_0xf6eb('0x67')](_0xf6eb('0x68'),'ut',_0xf6eb('0x69'))[_0xf6eb('0x25')](_0xf6eb('0x6a'),_0x29f675[_0xf6eb('0x3d')]['id']);for(var _0x1c6ecd=0x0;_0x1c6ecd<_0x3fc340[_0xf6eb('0x30')];_0x1c6ecd+=0x1){let _0x2a825d=_0x3fc340[_0x1c6ecd];for(var _0x2810d5=0x0;_0x2810d5<_0x2a825d[_0xf6eb('0x55')][_0xf6eb('0x30')];_0x2810d5+=0x1){let _0x1e87ce=_0x2a825d[_0xf6eb('0x55')][_0x2810d5];var _0x408a37=_0x2b0b9e[_0xf6eb('0x6b')]();_0x408a37[_0xf6eb('0x25')]('ut.UserId\x20=\x20?',_0x1e87ce['id']);_0x2b252d['push'](db[_0xf6eb('0x5a')]['query'](_0x408a37[_0xf6eb('0x6c')](),{'type':db[_0xf6eb('0x5a')][_0xf6eb('0x6d')][_0xf6eb('0x6e')]})[_0xf6eb('0x16')](function(_0x1b302f){if(_0x1b302f[_0xf6eb('0x30')]===0x1){return _0x1e87ce['id'];}else{var _0x28d1eb=_['every'](_[_0xf6eb('0x1f')](_0x1b302f,_0xf6eb('0x6f')),function(_0x343ff0){return _['includes'](_0x177787,_0x343ff0);});if(_0x28d1eb){return _0x1e87ce['id'];}}}));}}return BPromise[_0xf6eb('0x70')](_0x2b252d)[_0xf6eb('0x16')](function(_0x41a53d){_0x200171=_(_0x200171)[_0xf6eb('0x71')](_0x41a53d)[_0xf6eb('0x72')]()[_0xf6eb('0x73')]();return db[_0xf6eb('0x20')][_0xf6eb('0x34')]({'where':{'id':_0x29f675[_0xf6eb('0x3d')]['id']}})[_0xf6eb('0x16')](function(_0x37b805){return db[_0xf6eb('0x5a')][_0xf6eb('0x5b')](function(_0x1603e8){return _0x37b805[_0xf6eb('0x60')](_0x29f675[_0xf6eb('0x2b')]['ids'],{'transaction':_0x1603e8})[_0xf6eb('0x16')](function(){if(!_[_0xf6eb('0x74')](_0x200171)){return _0x37b805['removeAgents'](_0x200171,{'transaction':_0x1603e8});}})['then'](function(){_0x200171[_0xf6eb('0x5d')](function(_0x18c963){socket[_0xf6eb('0x5e')](_0xf6eb('0x75'),{'UserId':_0x18c963,'MailQueueId':_0x37b805['id']});});});});});});})[_0xf6eb('0x16')](respondWithStatusCode(_0x30666d,null))['catch'](handleError(_0x30666d,null));};exports[_0xf6eb('0x76')]=function(_0x5a450e,_0x593475){return db[_0xf6eb('0x20')][_0xf6eb('0x34')]({'where':{'id':_0x5a450e['params']['id']}})[_0xf6eb('0x16')](handleEntityNotFound(_0x593475,null))[_0xf6eb('0x16')](function(_0x73fa9d){if(_0x73fa9d){return _0x73fa9d['addAgents'](_0x5a450e[_0xf6eb('0x36')]['ids'],_['omit'](_0x5a450e['body'],[_0xf6eb('0x61'),'id'])||{})['spread'](function(_0xa69b5b){for(var _0x40c779=0x0;_0x40c779<_0x5a450e[_0xf6eb('0x36')][_0xf6eb('0x61')][_0xf6eb('0x30')];_0x40c779+=0x1){socket[_0xf6eb('0x5e')]('userMailQueue:save',{'UserId':Number(_0x5a450e['body']['ids'][_0x40c779]),'MailQueueId':Number(_0x5a450e[_0xf6eb('0x3d')]['id'])});}return _0xa69b5b;});}})[_0xf6eb('0x16')](respondWithResult(_0x593475,null))['catch'](handleError(_0x593475,null));};exports[_0xf6eb('0x77')]=function(_0x33396a,_0x3c7514){return db['MailQueue'][_0xf6eb('0x34')]({'where':{'id':_0x33396a[_0xf6eb('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c7514,null))[_0xf6eb('0x16')](function(_0x10569d){if(_0x10569d){return _0x10569d['removeAgents'](_0x33396a['query'][_0xf6eb('0x61')])[_0xf6eb('0x16')](function(){if(_[_0xf6eb('0x78')](_0x33396a[_0xf6eb('0x2b')][_0xf6eb('0x61')])){for(var _0x58f1ee=0x0;_0x58f1ee<_0x33396a[_0xf6eb('0x2b')][_0xf6eb('0x61')][_0xf6eb('0x30')];_0x58f1ee+=0x1){socket[_0xf6eb('0x5e')](_0xf6eb('0x75'),{'UserId':Number(_0x33396a[_0xf6eb('0x2b')][_0xf6eb('0x61')][_0x58f1ee]),'MailQueueId':Number(_0x33396a[_0xf6eb('0x3d')]['id'])});}}else{socket[_0xf6eb('0x5e')](_0xf6eb('0x75'),{'UserId':Number(_0x33396a[_0xf6eb('0x2b')][_0xf6eb('0x61')]),'MailQueueId':Number(_0x33396a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3c7514,null))[_0xf6eb('0x28')](handleError(_0x3c7514,null));};exports['getAgents']=function(_0x3305b4,_0x513ca3){var _0x49bf4f={};var _0x5161ca={};var _0x3bdf69;var _0x2e4bf;return db[_0xf6eb('0x20')][_0xf6eb('0x40')]({'where':{'id':_0x3305b4[_0xf6eb('0x3d')]['id']}})[_0xf6eb('0x16')](handleEntityNotFound(_0x513ca3,null))[_0xf6eb('0x16')](function(_0x1dd061){if(_0x1dd061){_0x3bdf69=_0x1dd061;_0x5161ca['model']=_[_0xf6eb('0x2a')](db[_0xf6eb('0x49')][_0xf6eb('0x21')]);_0x5161ca[_0xf6eb('0x2b')]=_[_0xf6eb('0x2a')](_0x3305b4[_0xf6eb('0x2b')]);_0x5161ca[_0xf6eb('0x41')]=_[_0xf6eb('0x2c')](_0x5161ca[_0xf6eb('0x2d')],_0x5161ca[_0xf6eb('0x2b')]);_0x49bf4f[_0xf6eb('0x2e')]=_[_0xf6eb('0x2c')](_0x5161ca[_0xf6eb('0x2d')],qs[_0xf6eb('0x2f')](_0x3305b4[_0xf6eb('0x2b')][_0xf6eb('0x2f')]));_0x49bf4f[_0xf6eb('0x2e')]=_0x49bf4f[_0xf6eb('0x2e')][_0xf6eb('0x30')]?_0x49bf4f[_0xf6eb('0x2e')]:_0x5161ca[_0xf6eb('0x2d')];_0x49bf4f[_0xf6eb('0x53')]=qs[_0xf6eb('0x44')](_0x3305b4[_0xf6eb('0x2b')][_0xf6eb('0x44')]);_0x49bf4f['where']=qs[_0xf6eb('0x41')](_[_0xf6eb('0x45')](_0x3305b4[_0xf6eb('0x2b')],_0x5161ca['filters']));if(_0x3305b4[_0xf6eb('0x2b')][_0xf6eb('0x47')]){_0x49bf4f['where']=_[_0xf6eb('0x32')](_0x49bf4f[_0xf6eb('0x25')],{'$or':_['map'](_0x49bf4f[_0xf6eb('0x2e')],function(_0x22f9dc){var _0xfd1c11={};_0xfd1c11[_0x22f9dc]={'$like':'%'+_0x3305b4['query']['filter']+'%'};return _0xfd1c11;})});}_0x49bf4f=_[_0xf6eb('0x32')]({},_0x49bf4f,_0x3305b4[_0xf6eb('0x33')]);return _0x3bdf69[_0xf6eb('0x79')](_0x49bf4f);}})['then'](function(_0x1a8219){if(_0x1a8219){_0x2e4bf=_0x1a8219[_0xf6eb('0x30')];if(!_0x3305b4[_0xf6eb('0x2b')][_0xf6eb('0x42')](_0xf6eb('0x43'))){_0x49bf4f[_0xf6eb('0x12')]=qs[_0xf6eb('0x12')](_0x3305b4[_0xf6eb('0x2b')]['limit']);_0x49bf4f[_0xf6eb('0x10')]=qs['offset'](_0x3305b4['query'][_0xf6eb('0x10')]);}return _0x3bdf69[_0xf6eb('0x79')](_0x49bf4f);}})[_0xf6eb('0x16')](function(_0x1797ee){if(_0x1797ee){return _0x1797ee?{'count':_0x2e4bf,'rows':_0x1797ee}:null;}})[_0xf6eb('0x16')](respondWithResult(_0x513ca3,null))[_0xf6eb('0x28')](handleError(_0x513ca3,null));}; \ No newline at end of file +var _0xc391=['emit','isArray','userMailQueue:remove','getAgents','bluebird','util','lodash','ioredis','../../config/logger','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','getOptions','include','query','findAll','rows','catch','show','params','keys','filters','intersection','model','fields','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','describe','getMembers','UserMailQueue','hasOwnProperty','order','sort','where','pick','MailQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','nolimit','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','each','removeTeams','ids','select','from','team_has_mail_queues','join','clone','push','toString','QueryTypes','SELECT','every','includes','transaction','isEmpty','removeAgents','forEach','omit','spread'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0xc391,0xe2));var _0x1c39=function(_0x5e050c,_0x1b610d){_0x5e050c=_0x5e050c-0x0;var _0x54b30e=_0xc391[_0x5e050c];return _0x54b30e;};'use strict';var BPromise=require(_0x1c39('0x0'));var util=require(_0x1c39('0x1'));var _=require(_0x1c39('0x2'));var squel=require('squel');var Redis=require(_0x1c39('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x1c39('0x4'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1c39('0x5')]=_[_0x1c39('0x6')](config[_0x1c39('0x5')],{'host':_0x1c39('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c39('0x5')]));require(_0x1c39('0x8'))[_0x1c39('0x9')](socket);function respondWithStatusCode(_0x46632b,_0x21bb45){_0x21bb45=_0x21bb45||0xcc;return function(_0x3aa4d){if(_0x3aa4d){return _0x46632b[_0x1c39('0xa')](_0x21bb45);}return _0x46632b[_0x1c39('0xb')](_0x21bb45)[_0x1c39('0xc')]();};}function respondWithResult(_0x1d8f68,_0x341d7b){_0x341d7b=_0x341d7b||0xc8;return function(_0x1f73de){if(_0x1f73de){return _0x1d8f68['status'](_0x341d7b)[_0x1c39('0xd')](_0x1f73de);}};}function respondWithFilteredResult(_0x34db5f,_0x23c1b6){return function(_0x54ef75){if(_0x54ef75){var _0x128d3d=typeof _0x23c1b6[_0x1c39('0xe')]===_0x1c39('0xf')&&typeof _0x23c1b6[_0x1c39('0x10')]===_0x1c39('0xf');var _0x226826=_0x54ef75[_0x1c39('0x11')];var _0x39fb24=_0x128d3d?0x0:_0x23c1b6[_0x1c39('0xe')];var _0x58f3ca=_0x128d3d?_0x54ef75[_0x1c39('0x11')]:_0x23c1b6[_0x1c39('0xe')]+_0x23c1b6['limit'];var _0x47db6d;if(_0x58f3ca>=_0x226826){_0x58f3ca=_0x226826;_0x47db6d=0xc8;}else{_0x47db6d=0xce;}_0x34db5f[_0x1c39('0xb')](_0x47db6d);return _0x34db5f[_0x1c39('0x12')]('Content-Range',_0x39fb24+'-'+_0x58f3ca+'/'+_0x226826)[_0x1c39('0xd')](_0x54ef75);}return null;};}function saveUpdates(_0xa7f55){return function(_0x3caea3){if(_0x3caea3){return _0x3caea3[_0x1c39('0x13')](_0xa7f55)[_0x1c39('0x14')](function(_0x16bb9f){return _0x16bb9f;});}return null;};}function removeEntity(_0x3c3a32){return function(_0x34c5f7){if(_0x34c5f7){return _0x34c5f7[_0x1c39('0x15')]()['then'](function(){var _0x196a9f=_0x34c5f7[_0x1c39('0x16')]({'plain':!![]});var _0x5883cb='MailQueues';return db[_0x1c39('0x17')][_0x1c39('0x15')]({'where':{'type':_0x5883cb,'resourceId':_0x196a9f['id']}})[_0x1c39('0x14')](function(){return _0x34c5f7;});})[_0x1c39('0x14')](function(){_0x3c3a32['status'](0xcc)[_0x1c39('0xc')]();});}};}function handleEntityNotFound(_0x286cd9){return function(_0x35a172){if(!_0x35a172){_0x286cd9[_0x1c39('0xa')](0x194);}return _0x35a172;};}function handleError(_0xc6e5f7,_0x100be9){_0x100be9=_0x100be9||0x1f4;return function(_0x5dc7e4){logger['error'](_0x5dc7e4[_0x1c39('0x18')]);if(_0x5dc7e4[_0x1c39('0x19')]){delete _0x5dc7e4[_0x1c39('0x19')];}_0xc6e5f7[_0x1c39('0xb')](_0x100be9)[_0x1c39('0x1a')](_0x5dc7e4);};}exports[_0x1c39('0x1b')]=function(_0x1b3da3,_0x37a1c8){var _0x47cd15={};var _0x4a6e64={'count':0x0,'rows':[]};var _0x55b250=_[_0x1c39('0x1c')](db[_0x1c39('0x1d')][_0x1c39('0x1e')],function(_0x598053){return{'name':_0x598053[_0x1c39('0x1f')],'type':_0x598053[_0x1c39('0x20')]['key']};});_0x47cd15=qs[_0x1c39('0x21')](_0x55b250,_0x1b3da3);var _0x474c4f={'where':_0x47cd15['where']};return db[_0x1c39('0x1d')][_0x1c39('0x11')](_0x474c4f)[_0x1c39('0x14')](function(_0x59b256){_0x4a6e64[_0x1c39('0x11')]=_0x59b256;_0x47cd15[_0x1c39('0x22')]=qs['include'](_0x1b3da3[_0x1c39('0x23')]);return db['MailQueue'][_0x1c39('0x24')](_0x47cd15);})[_0x1c39('0x14')](function(_0x131a90){_0x4a6e64[_0x1c39('0x25')]=_0x131a90;return _0x4a6e64;})['then'](respondWithFilteredResult(_0x37a1c8,_0x47cd15))[_0x1c39('0x26')](handleError(_0x37a1c8,null));};exports[_0x1c39('0x27')]=function(_0x10e932,_0x51291b){var _0x55affd={'raw':!![],'where':{'id':_0x10e932[_0x1c39('0x28')]['id']}},_0x24234c={};_0x24234c['model']=_['keys'](db[_0x1c39('0x1d')][_0x1c39('0x1e')]);_0x24234c[_0x1c39('0x23')]=_[_0x1c39('0x29')](_0x10e932[_0x1c39('0x23')]);_0x24234c[_0x1c39('0x2a')]=_[_0x1c39('0x2b')](_0x24234c[_0x1c39('0x2c')],_0x24234c[_0x1c39('0x23')]);_0x55affd['attributes']=_[_0x1c39('0x2b')](_0x24234c['model'],qs[_0x1c39('0x2d')](_0x10e932[_0x1c39('0x23')][_0x1c39('0x2d')]));_0x55affd[_0x1c39('0x2e')]=_0x55affd[_0x1c39('0x2e')][_0x1c39('0x2f')]?_0x55affd[_0x1c39('0x2e')]:_0x24234c[_0x1c39('0x2c')];if(_0x10e932['query'][_0x1c39('0x30')]){_0x55affd[_0x1c39('0x22')]=[{'all':!![]}];}_0x55affd=_[_0x1c39('0x31')]({},_0x55affd,_0x10e932[_0x1c39('0x32')]);return db[_0x1c39('0x1d')]['find'](_0x55affd)[_0x1c39('0x14')](handleEntityNotFound(_0x51291b,null))[_0x1c39('0x14')](respondWithResult(_0x51291b,null))['catch'](handleError(_0x51291b,null));};exports[_0x1c39('0x33')]=function(_0x2ff574,_0x1467e7){return db['MailQueue'][_0x1c39('0x33')](_0x2ff574[_0x1c39('0x34')],{})['then'](function(_0x80bb40){var _0xf2e2e6=_0x2ff574[_0x1c39('0x35')][_0x1c39('0x16')]({'plain':!![]});if(!_0xf2e2e6)throw new Error(_0x1c39('0x36'));if(_0xf2e2e6[_0x1c39('0x37')]===_0x1c39('0x35')){var _0x31dc88=_0x80bb40[_0x1c39('0x16')]({'plain':!![]});var _0x12dadf='MailQueues';return db[_0x1c39('0x38')]['find']({'where':{'name':_0x12dadf,'userProfileId':_0xf2e2e6['userProfileId']},'raw':!![]})[_0x1c39('0x14')](function(_0x165d08){if(_0x165d08&&_0x165d08['autoAssociation']===0x0){return db[_0x1c39('0x17')]['create']({'name':_0x31dc88[_0x1c39('0x19')],'resourceId':_0x31dc88['id'],'type':_0x165d08[_0x1c39('0x19')],'sectionId':_0x165d08['id']},{})['then'](function(){return _0x80bb40;});}else{return _0x80bb40;}})[_0x1c39('0x26')](function(_0x1ab916){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ab916);throw _0x1ab916;});}return _0x80bb40;})['then'](respondWithResult(_0x1467e7,0xc9))['catch'](handleError(_0x1467e7,null));};exports[_0x1c39('0x13')]=function(_0x1910a,_0x3822a6){if(_0x1910a[_0x1c39('0x34')]['id']){delete _0x1910a[_0x1c39('0x34')]['id'];}return db['MailQueue'][_0x1c39('0x39')]({'where':{'id':_0x1910a[_0x1c39('0x28')]['id']}})[_0x1c39('0x14')](handleEntityNotFound(_0x3822a6,null))[_0x1c39('0x14')](saveUpdates(_0x1910a['body'],null))['then'](respondWithResult(_0x3822a6,null))[_0x1c39('0x26')](handleError(_0x3822a6,null));};exports[_0x1c39('0x15')]=function(_0x110a99,_0x2fcdd9){return db['MailQueue'][_0x1c39('0x39')]({'where':{'id':_0x110a99[_0x1c39('0x28')]['id']}})[_0x1c39('0x14')](handleEntityNotFound(_0x2fcdd9,null))[_0x1c39('0x14')](removeEntity(_0x2fcdd9,null))[_0x1c39('0x26')](handleError(_0x2fcdd9,null));};exports[_0x1c39('0x3a')]=function(_0x299425,_0x1858f2){return db['MailQueue'][_0x1c39('0x3a')]()[_0x1c39('0x14')](respondWithResult(_0x1858f2,null))[_0x1c39('0x26')](handleError(_0x1858f2,null));};exports[_0x1c39('0x3b')]=function(_0x1034fc,_0x20ef1b){var _0x1302a3={'raw':!![],'where':{}},_0x31364e={},_0x526bb6;return db['MailQueue']['findOne']({'where':{'id':_0x1034fc[_0x1c39('0x28')]['id']}})['then'](handleEntityNotFound(_0x20ef1b,null))[_0x1c39('0x14')](function(_0x23506c){if(_0x23506c){_0x526bb6=_0x23506c[_0x1c39('0x16')]({'plain':!![]});_0x31364e['model']=_[_0x1c39('0x29')](db[_0x1c39('0x3c')][_0x1c39('0x1e')]);_0x31364e[_0x1c39('0x23')]=_['keys'](_0x1034fc[_0x1c39('0x23')]);_0x31364e[_0x1c39('0x2a')]=_[_0x1c39('0x2b')](_0x31364e[_0x1c39('0x2c')],_0x31364e[_0x1c39('0x23')]);_0x1302a3[_0x1c39('0x2e')]=_[_0x1c39('0x2b')](_0x31364e[_0x1c39('0x2c')],qs[_0x1c39('0x2d')](_0x1034fc[_0x1c39('0x23')][_0x1c39('0x2d')]));_0x1302a3['attributes']=_0x1302a3[_0x1c39('0x2e')]['length']?_0x1302a3[_0x1c39('0x2e')]:_0x31364e['model'];if(!_0x1034fc['query'][_0x1c39('0x3d')]('nolimit')){_0x1302a3['limit']=qs[_0x1c39('0x10')](_0x1034fc[_0x1c39('0x23')][_0x1c39('0x10')]);_0x1302a3['offset']=qs[_0x1c39('0xe')](_0x1034fc[_0x1c39('0x23')][_0x1c39('0xe')]);}_0x1302a3[_0x1c39('0x3e')]=qs['sort'](_0x1034fc[_0x1c39('0x23')][_0x1c39('0x3f')]);_0x1302a3[_0x1c39('0x40')]=qs['filters'](_[_0x1c39('0x41')](_0x1034fc[_0x1c39('0x23')],_0x31364e['filters']));_0x1302a3[_0x1c39('0x40')][_0x1c39('0x42')]=_0x23506c['id'];if(_0x1034fc[_0x1c39('0x23')][_0x1c39('0x43')]){_0x1302a3[_0x1c39('0x40')]=_[_0x1c39('0x31')](_0x1302a3[_0x1c39('0x40')],{'$or':_[_0x1c39('0x1c')](_0x1302a3[_0x1c39('0x2e')],function(_0x35a9b1){var _0x48a308={};_0x48a308[_0x35a9b1]={'$like':'%'+_0x1034fc[_0x1c39('0x23')][_0x1c39('0x43')]+'%'};return _0x48a308;})});}_0x1302a3=_[_0x1c39('0x31')]({},_0x1302a3,_0x1034fc[_0x1c39('0x32')]);return db[_0x1c39('0x3c')]['findAll'](_0x1302a3);}})[_0x1c39('0x14')](function(_0x17b1df){if(_0x17b1df){return db[_0x1c39('0x44')][_0x1c39('0x45')]({'where':{'id':_[_0x1c39('0x1c')](_0x17b1df,'UserId'),'role':_0x1c39('0x46')},'attributes':['id',_0x1c39('0x19'),'mailPause',_0x1c39('0x47'),_0x1c39('0x48')]});}})[_0x1c39('0x14')](function(_0x28e2fa){if(_0x28e2fa){return{'count':_0x28e2fa[_0x1c39('0x11')],'rows':_[_0x1c39('0x1c')](_0x28e2fa[_0x1c39('0x25')],function(_0x99ddc9){return{'membername':_0x99ddc9[_0x1c39('0x19')],'UserId':_0x99ddc9['id'],'queue_name':_0x526bb6[_0x1c39('0x19')],'MailQueueId':_0x526bb6['id'],'interface':util[_0x1c39('0x49')](_0x1c39('0x4a'),_0x1c39('0x4b'),_0x99ddc9[_0x1c39('0x19')]),'penalty':0x0,'paused':_0x99ddc9['mailPause'],'createdAt':_0x99ddc9[_0x1c39('0x48')],'updatedAt':_0x99ddc9[_0x1c39('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1c39('0x14')](respondWithFilteredResult(_0x20ef1b,_0x1302a3))['catch'](handleError(_0x20ef1b,null));};exports[_0x1c39('0x4c')]=function(_0x3b9e0f,_0x4b0cb4){var _0x38e6c4={};var _0x16bb4f={};var _0x441410;var _0xb40ed6;return db[_0x1c39('0x1d')][_0x1c39('0x4d')]({'where':{'id':_0x3b9e0f[_0x1c39('0x28')]['id']}})[_0x1c39('0x14')](handleEntityNotFound(_0x4b0cb4,null))[_0x1c39('0x14')](function(_0x5bae21){if(_0x5bae21){_0x441410=_0x5bae21;_0x16bb4f[_0x1c39('0x2c')]=_['keys'](db[_0x1c39('0x4e')][_0x1c39('0x1e')]);_0x16bb4f[_0x1c39('0x23')]=_[_0x1c39('0x29')](_0x3b9e0f['query']);_0x16bb4f[_0x1c39('0x2a')]=_[_0x1c39('0x2b')](_0x16bb4f[_0x1c39('0x2c')],_0x16bb4f[_0x1c39('0x23')]);_0x38e6c4[_0x1c39('0x2e')]=_[_0x1c39('0x2b')](_0x16bb4f[_0x1c39('0x2c')],qs[_0x1c39('0x2d')](_0x3b9e0f[_0x1c39('0x23')][_0x1c39('0x2d')]));_0x38e6c4[_0x1c39('0x2e')]=_0x38e6c4[_0x1c39('0x2e')][_0x1c39('0x2f')]?_0x38e6c4[_0x1c39('0x2e')]:_0x16bb4f[_0x1c39('0x2c')];_0x38e6c4['order']=qs[_0x1c39('0x3f')](_0x3b9e0f['query'][_0x1c39('0x3f')]);_0x38e6c4['where']=qs[_0x1c39('0x2a')](_[_0x1c39('0x41')](_0x3b9e0f[_0x1c39('0x23')],_0x16bb4f[_0x1c39('0x2a')]));if(_0x3b9e0f[_0x1c39('0x23')][_0x1c39('0x43')]){_0x38e6c4['where']=_[_0x1c39('0x31')](_0x38e6c4[_0x1c39('0x40')],{'$or':_[_0x1c39('0x1c')](_0x38e6c4[_0x1c39('0x2e')],function(_0x1c79e8){var _0x16ad9f={};_0x16ad9f[_0x1c79e8]={'$like':'%'+_0x3b9e0f[_0x1c39('0x23')][_0x1c39('0x43')]+'%'};return _0x16ad9f;})});}_0x38e6c4=_[_0x1c39('0x31')]({},_0x38e6c4,_0x3b9e0f[_0x1c39('0x32')]);return _0x441410[_0x1c39('0x4c')](_0x38e6c4);}})['then'](function(_0x5ac40a){if(_0x5ac40a){_0xb40ed6=_0x5ac40a[_0x1c39('0x2f')];if(!_0x3b9e0f['query'][_0x1c39('0x3d')](_0x1c39('0x4f'))){_0x38e6c4[_0x1c39('0x10')]=qs[_0x1c39('0x10')](_0x3b9e0f[_0x1c39('0x23')]['limit']);_0x38e6c4[_0x1c39('0xe')]=qs[_0x1c39('0xe')](_0x3b9e0f[_0x1c39('0x23')][_0x1c39('0xe')]);}return _0x441410[_0x1c39('0x4c')](_0x38e6c4);}})[_0x1c39('0x14')](function(_0x4b902a){if(_0x4b902a){return _0x4b902a?{'count':_0xb40ed6,'rows':_0x4b902a}:null;}})['then'](respondWithResult(_0x4b0cb4,null))['catch'](handleError(_0x4b0cb4,null));};exports[_0x1c39('0x50')]=function(_0x5c5a2c,_0x535f36){var _0x178453=_0x5c5a2c[_0x1c39('0x34')]['ids'];return db[_0x1c39('0x4e')]['findAll']({'where':{'id':_0x178453},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1c39('0x51'),'attributes':['id',_0x1c39('0x19'),_0x1c39('0x52'),_0x1c39('0x53'),_0x1c39('0x54')],'raw':!![]}]})[_0x1c39('0x14')](function(_0x4ce5c2){if(_0x4ce5c2){var _0x2742a2=_[_0x1c39('0x55')](_0x4ce5c2,function(_0x5a0c20){var _0x5bc2fc=_0x5a0c20['get']({'plain':!![]});return _0x5bc2fc[_0x1c39('0x51')];});return db[_0x1c39('0x1d')]['find']({'where':{'id':_0x5c5a2c['params']['id']}})[_0x1c39('0x14')](function(_0x264de9){return db[_0x1c39('0x56')]['transaction'](function(_0x21f69e){return _0x264de9[_0x1c39('0x50')](_0x178453,{'transaction':_0x21f69e})[_0x1c39('0x14')](function(){return BPromise[_0x1c39('0x57')](_0x2742a2,function(_0x569c7c){return db[_0x1c39('0x3c')]['findOrCreate']({'where':{'UserId':_0x569c7c['id'],'MailQueueId':_0x5c5a2c[_0x1c39('0x28')]['id']},'transaction':_0x21f69e});});})[_0x1c39('0x14')](function(){_0x2742a2['forEach'](function(_0x356160){socket['emit']('userMailQueue:save',{'UserId':_0x356160['id'],'MailQueueId':_0x264de9['id']});});});});});}})[_0x1c39('0x14')](respondWithStatusCode(_0x535f36,null))[_0x1c39('0x26')](handleError(_0x535f36,null));};exports[_0x1c39('0x58')]=function(_0x57cc2b,_0x5c6367){return db[_0x1c39('0x4e')][_0x1c39('0x24')]({'where':{'id':_0x57cc2b[_0x1c39('0x23')][_0x1c39('0x59')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1c39('0x51'),'attributes':['id'],'raw':!![]}]})[_0x1c39('0x14')](handleEntityNotFound(_0x5c6367,null))['then'](function(_0x34f583){var _0x426e75=_[_0x1c39('0x1c')](_0x34f583,'id');var _0x1f8852=[];var _0x5250d3=[];var _0x220295=squel[_0x1c39('0x5a')]();_0x220295['field']('tq.TeamId')[_0x1c39('0x5b')](_0x1c39('0x5c'),'tq')[_0x1c39('0x5d')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('MailQueueId\x20=\x20?',_0x57cc2b[_0x1c39('0x28')]['id']);for(var _0x3f42d0=0x0;_0x3f42d0<_0x34f583['length'];_0x3f42d0+=0x1){let _0x57a303=_0x34f583[_0x3f42d0];for(var _0x2c9210=0x0;_0x2c9210<_0x57a303[_0x1c39('0x51')]['length'];_0x2c9210+=0x1){let _0x491382=_0x57a303[_0x1c39('0x51')][_0x2c9210];var _0x1bbd35=_0x220295[_0x1c39('0x5e')]();_0x1bbd35[_0x1c39('0x40')]('ut.UserId\x20=\x20?',_0x491382['id']);_0x5250d3[_0x1c39('0x5f')](db[_0x1c39('0x56')][_0x1c39('0x23')](_0x1bbd35[_0x1c39('0x60')](),{'type':db[_0x1c39('0x56')][_0x1c39('0x61')][_0x1c39('0x62')]})[_0x1c39('0x14')](function(_0x2520c0){if(_0x2520c0[_0x1c39('0x2f')]===0x1){return _0x491382['id'];}else{var _0x321879=_[_0x1c39('0x63')](_[_0x1c39('0x1c')](_0x2520c0,'TeamId'),function(_0x25b784){return _[_0x1c39('0x64')](_0x426e75,_0x25b784);});if(_0x321879){return _0x491382['id'];}}}));}}return BPromise['all'](_0x5250d3)[_0x1c39('0x14')](function(_0xa55d13){_0x1f8852=_(_0x1f8852)['union'](_0xa55d13)['compact']()['value']();return db['MailQueue'][_0x1c39('0x39')]({'where':{'id':_0x57cc2b[_0x1c39('0x28')]['id']}})[_0x1c39('0x14')](function(_0x48c4d9){return db[_0x1c39('0x56')][_0x1c39('0x65')](function(_0x312c49){return _0x48c4d9[_0x1c39('0x58')](_0x57cc2b[_0x1c39('0x23')][_0x1c39('0x59')],{'transaction':_0x312c49})[_0x1c39('0x14')](function(){if(!_[_0x1c39('0x66')](_0x1f8852)){return _0x48c4d9[_0x1c39('0x67')](_0x1f8852,{'transaction':_0x312c49});}})['then'](function(){_0x1f8852[_0x1c39('0x68')](function(_0x4bf7a8){socket['emit']('userMailQueue:remove',{'UserId':_0x4bf7a8,'MailQueueId':_0x48c4d9['id']});});});});});});})[_0x1c39('0x14')](respondWithStatusCode(_0x5c6367,null))[_0x1c39('0x26')](handleError(_0x5c6367,null));};exports['addAgents']=function(_0xca433a,_0x2a656f){return db[_0x1c39('0x1d')][_0x1c39('0x39')]({'where':{'id':_0xca433a['params']['id']}})['then'](handleEntityNotFound(_0x2a656f,null))[_0x1c39('0x14')](function(_0x57e670){if(_0x57e670){return _0x57e670['addAgents'](_0xca433a[_0x1c39('0x34')][_0x1c39('0x59')],_[_0x1c39('0x69')](_0xca433a[_0x1c39('0x34')],[_0x1c39('0x59'),'id'])||{})[_0x1c39('0x6a')](function(_0x218207){for(var _0x241558=0x0;_0x241558<_0xca433a[_0x1c39('0x34')][_0x1c39('0x59')][_0x1c39('0x2f')];_0x241558+=0x1){socket[_0x1c39('0x6b')]('userMailQueue:save',{'UserId':Number(_0xca433a['body'][_0x1c39('0x59')][_0x241558]),'MailQueueId':Number(_0xca433a['params']['id'])});}return _0x218207;});}})[_0x1c39('0x14')](respondWithResult(_0x2a656f,null))[_0x1c39('0x26')](handleError(_0x2a656f,null));};exports[_0x1c39('0x67')]=function(_0x511cfc,_0x1f5828){return db[_0x1c39('0x1d')][_0x1c39('0x39')]({'where':{'id':_0x511cfc[_0x1c39('0x28')]['id']}})['then'](handleEntityNotFound(_0x1f5828,null))[_0x1c39('0x14')](function(_0x3fd9ff){if(_0x3fd9ff){return _0x3fd9ff[_0x1c39('0x67')](_0x511cfc[_0x1c39('0x23')]['ids'])[_0x1c39('0x14')](function(){if(_[_0x1c39('0x6c')](_0x511cfc[_0x1c39('0x23')]['ids'])){for(var _0x5bd8df=0x0;_0x5bd8df<_0x511cfc[_0x1c39('0x23')][_0x1c39('0x59')]['length'];_0x5bd8df+=0x1){socket[_0x1c39('0x6b')]('userMailQueue:remove',{'UserId':Number(_0x511cfc[_0x1c39('0x23')][_0x1c39('0x59')][_0x5bd8df]),'MailQueueId':Number(_0x511cfc['params']['id'])});}}else{socket['emit'](_0x1c39('0x6d'),{'UserId':Number(_0x511cfc[_0x1c39('0x23')][_0x1c39('0x59')]),'MailQueueId':Number(_0x511cfc['params']['id'])});}});}})[_0x1c39('0x14')](respondWithStatusCode(_0x1f5828,null))[_0x1c39('0x26')](handleError(_0x1f5828,null));};exports[_0x1c39('0x6e')]=function(_0x35547b,_0x22b51c){var _0x450e5f={};var _0x24015f={};var _0x322980;var _0x207ac0;return db['MailQueue']['findOne']({'where':{'id':_0x35547b[_0x1c39('0x28')]['id']}})['then'](handleEntityNotFound(_0x22b51c,null))[_0x1c39('0x14')](function(_0x32167c){if(_0x32167c){_0x322980=_0x32167c;_0x24015f[_0x1c39('0x2c')]=_[_0x1c39('0x29')](db[_0x1c39('0x44')][_0x1c39('0x1e')]);_0x24015f[_0x1c39('0x23')]=_[_0x1c39('0x29')](_0x35547b[_0x1c39('0x23')]);_0x24015f[_0x1c39('0x2a')]=_['intersection'](_0x24015f['model'],_0x24015f[_0x1c39('0x23')]);_0x450e5f['attributes']=_[_0x1c39('0x2b')](_0x24015f['model'],qs[_0x1c39('0x2d')](_0x35547b['query'][_0x1c39('0x2d')]));_0x450e5f['attributes']=_0x450e5f[_0x1c39('0x2e')][_0x1c39('0x2f')]?_0x450e5f[_0x1c39('0x2e')]:_0x24015f[_0x1c39('0x2c')];_0x450e5f[_0x1c39('0x3e')]=qs[_0x1c39('0x3f')](_0x35547b[_0x1c39('0x23')]['sort']);_0x450e5f[_0x1c39('0x40')]=qs[_0x1c39('0x2a')](_['pick'](_0x35547b[_0x1c39('0x23')],_0x24015f[_0x1c39('0x2a')]));if(_0x35547b[_0x1c39('0x23')][_0x1c39('0x43')]){_0x450e5f[_0x1c39('0x40')]=_[_0x1c39('0x31')](_0x450e5f['where'],{'$or':_['map'](_0x450e5f['attributes'],function(_0x3e6b38){var _0x39615f={};_0x39615f[_0x3e6b38]={'$like':'%'+_0x35547b[_0x1c39('0x23')][_0x1c39('0x43')]+'%'};return _0x39615f;})});}_0x450e5f=_[_0x1c39('0x31')]({},_0x450e5f,_0x35547b['options']);return _0x322980[_0x1c39('0x6e')](_0x450e5f);}})[_0x1c39('0x14')](function(_0x2b864f){if(_0x2b864f){_0x207ac0=_0x2b864f[_0x1c39('0x2f')];if(!_0x35547b['query'][_0x1c39('0x3d')](_0x1c39('0x4f'))){_0x450e5f['limit']=qs[_0x1c39('0x10')](_0x35547b[_0x1c39('0x23')][_0x1c39('0x10')]);_0x450e5f[_0x1c39('0xe')]=qs[_0x1c39('0xe')](_0x35547b[_0x1c39('0x23')][_0x1c39('0xe')]);}return _0x322980[_0x1c39('0x6e')](_0x450e5f);}})[_0x1c39('0x14')](function(_0x102886){if(_0x102886){return _0x102886?{'count':_0x207ac0,'rows':_0x102886}:null;}})[_0x1c39('0x14')](respondWithResult(_0x22b51c,null))[_0x1c39('0x26')](handleError(_0x22b51c,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7ce2900..91ba917 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 _0xf01a=['hasOwnProperty','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xf01a,0xd2));var _0xaf01=function(_0x589432,_0x4d6430){_0x589432=_0x589432-0x0;var _0x2ae435=_0xf01a[_0x589432];return _0x2ae435;};'use strict';var EventEmitter=require(_0xaf01('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xaf01('0x1')](0x0);var events={'afterCreate':_0xaf01('0x2'),'afterUpdate':_0xaf01('0x3'),'afterDestroy':_0xaf01('0x4')};function emitEvent(_0x33ec1c){return function(_0x1517bb,_0x3a0f55,_0x17d44f){MailQueueEvents[_0xaf01('0x5')](_0x33ec1c+':'+_0x1517bb['id'],_0x1517bb);MailQueueEvents[_0xaf01('0x5')](_0x33ec1c,_0x1517bb);_0x17d44f(null);};}for(var e in events){if(events[_0xaf01('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xaf01('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x4ac5=['../../mysqldb','MailQueue','update','remove','hook','exports','events'];(function(_0x4b3a07,_0x5f22bc){var _0x417941=function(_0x369d58){while(--_0x369d58){_0x4b3a07['push'](_0x4b3a07['shift']());}};_0x417941(++_0x5f22bc);}(_0x4ac5,0x110));var _0x54ac=function(_0x535963,_0x326515){_0x535963=_0x535963-0x0;var _0x3975f6=_0x4ac5[_0x535963];return _0x3975f6;};'use strict';var EventEmitter=require(_0x54ac('0x0'));var MailQueue=require(_0x54ac('0x1'))['db'][_0x54ac('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x54ac('0x3'),'afterDestroy':_0x54ac('0x4')};function emitEvent(_0xe6e683){return function(_0x1117f5,_0x176ae8,_0x566d05){MailQueueEvents['emit'](_0xe6e683+':'+_0x1117f5['id'],_0x1117f5);MailQueueEvents['emit'](_0xe6e683,_0x1117f5);_0x566d05(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x54ac('0x5')](e,emitEvent(event));}}module[_0x54ac('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 12c3b4b..98dae59 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 _0x6a69=['./mailQueue.attributes','mail_queues','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6a69,0xd1));var _0x96a6=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x6a69[_0x409353];return _0x4f4b59;};'use strict';var _=require('lodash');var util=require(_0x96a6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x96a6('0x1'));var BPromise=require(_0x96a6('0x2'));var rp=require(_0x96a6('0x3'));var fs=require('fs');var path=require(_0x96a6('0x4'));var rimraf=require(_0x96a6('0x5'));var config=require(_0x96a6('0x6'));var attributes=require(_0x96a6('0x7'));module['exports']=function(_0x46c104,_0x2b8753){return _0x46c104['define']('MailQueue',attributes,{'tableName':_0x96a6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x266a=['exports','define','MailQueue','mail_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x266a,0xac));var _0xa266=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x266a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa266('0x0'));var util=require(_0xa266('0x1'));var logger=require('../../config/logger')(_0xa266('0x2'));var moment=require(_0xa266('0x3'));var BPromise=require(_0xa266('0x4'));var rp=require(_0xa266('0x5'));var fs=require('fs');var path=require(_0xa266('0x6'));var rimraf=require(_0xa266('0x7'));var config=require(_0xa266('0x8'));var attributes=require(_0xa266('0x9'));module[_0xa266('0xa')]=function(_0x39ee3a,_0x437288){return _0x39ee3a[_0xa266('0xb')](_0xa266('0xc'),attributes,{'tableName':_0xa266('0xd'),'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 a990099..abc6e1c 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 _0xe222=['request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetMailQueue','MailQueue','options','where','attributes','limit','include','map','model','stringify','ShowMailQueue','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s'];(function(_0x46665c,_0x158229){var _0x4a9f2c=function(_0x6516ea){while(--_0x6516ea){_0x46665c['push'](_0x46665c['shift']());}};_0x4a9f2c(++_0x158229);}(_0xe222,0x18e));var _0x2e22=function(_0x53361f,_0x3b2cb6){_0x53361f=_0x53361f-0x0;var _0x279237=_0xe222[_0x53361f];return _0x279237;};'use strict';var _=require(_0x2e22('0x0'));var util=require('util');var moment=require(_0x2e22('0x1'));var BPromise=require(_0x2e22('0x2'));var rs=require(_0x2e22('0x3'));var fs=require('fs');var Redis=require(_0x2e22('0x4'));var db=require(_0x2e22('0x5'))['db'];var utils=require(_0x2e22('0x6'));var logger=require(_0x2e22('0x7'))(_0x2e22('0x8'));var config=require(_0x2e22('0x9'));var jayson=require(_0x2e22('0xa'));var client=jayson[_0x2e22('0xb')][_0x2e22('0xc')]({'port':0x232a});config[_0x2e22('0xd')]=_[_0x2e22('0xe')](config[_0x2e22('0xd')],{'host':_0x2e22('0xf'),'port':0x18eb});var socket=require(_0x2e22('0x10'))(new Redis(config['redis']));require(_0x2e22('0x11'))[_0x2e22('0x12')](socket);function respondWithRpcPromise(_0x96f97,_0x20d49e,_0x50db05){return new BPromise(function(_0x31c8e7,_0x15b2bf){return client[_0x2e22('0x13')](_0x96f97,_0x50db05)[_0x2e22('0x14')](function(_0x2511ce){logger['info'](_0x2e22('0x15'),_0x20d49e,_0x2e22('0x16'));logger[_0x2e22('0x17')](_0x2e22('0x18'),_0x20d49e,_0x2e22('0x16'),JSON['stringify'](_0x2511ce));if(_0x2511ce[_0x2e22('0x19')]){if(_0x2511ce[_0x2e22('0x19')][_0x2e22('0x1a')]===0x1f4){logger[_0x2e22('0x19')](_0x2e22('0x15'),_0x20d49e,_0x2511ce[_0x2e22('0x19')][_0x2e22('0x1b')]);return _0x15b2bf(_0x2511ce[_0x2e22('0x19')][_0x2e22('0x1b')]);}logger[_0x2e22('0x19')](_0x2e22('0x15'),_0x20d49e,_0x2511ce[_0x2e22('0x19')]['message']);return _0x31c8e7(_0x2511ce[_0x2e22('0x19')][_0x2e22('0x1b')]);}else{logger[_0x2e22('0x1c')](_0x2e22('0x15'),_0x20d49e,_0x2e22('0x16'));_0x31c8e7(_0x2511ce['result'][_0x2e22('0x1b')]);}})[_0x2e22('0x1d')](function(_0x16a8e8){logger['error'](_0x2e22('0x15'),_0x20d49e,_0x16a8e8);_0x15b2bf(_0x16a8e8);});});}exports[_0x2e22('0x1e')]=function(_0x32b7f5){var _0x16227e=this;return new Promise(function(_0x3764bb,_0x5def2b){return db[_0x2e22('0x1f')]['findAll']({'raw':_0x32b7f5[_0x2e22('0x20')]?_0x32b7f5[_0x2e22('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x32b7f5[_0x2e22('0x20')]?_0x32b7f5[_0x2e22('0x20')][_0x2e22('0x21')]||null:null,'attributes':_0x32b7f5[_0x2e22('0x20')]?_0x32b7f5[_0x2e22('0x20')][_0x2e22('0x22')]||null:null,'limit':_0x32b7f5['options']?_0x32b7f5[_0x2e22('0x20')][_0x2e22('0x23')]||null:null,'include':_0x32b7f5['options']?_0x32b7f5[_0x2e22('0x20')][_0x2e22('0x24')]?_[_0x2e22('0x25')](_0x32b7f5[_0x2e22('0x20')][_0x2e22('0x24')],function(_0x469f62){return{'model':db[_0x469f62['model']],'as':_0x469f62['as'],'attributes':_0x469f62['attributes'],'include':_0x469f62[_0x2e22('0x24')]?_[_0x2e22('0x25')](_0x469f62[_0x2e22('0x24')],function(_0x210739){return{'model':db[_0x210739[_0x2e22('0x26')]],'as':_0x210739['as'],'attributes':_0x210739['attributes'],'include':_0x210739[_0x2e22('0x24')]?_[_0x2e22('0x25')](_0x210739[_0x2e22('0x24')],function(_0x2a95d1){return{'model':db[_0x2a95d1[_0x2e22('0x26')]],'as':_0x2a95d1['as'],'attributes':_0x2a95d1[_0x2e22('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d815a){logger['info'](_0x2e22('0x1e'),_0x32b7f5);logger[_0x2e22('0x17')](_0x2e22('0x1e'),_0x32b7f5,JSON[_0x2e22('0x27')](_0x5d815a));_0x3764bb(_0x5d815a);})[_0x2e22('0x1d')](function(_0x174a26){logger[_0x2e22('0x19')](_0x2e22('0x1e'),_0x174a26[_0x2e22('0x1b')],_0x32b7f5);_0x5def2b(_0x16227e[_0x2e22('0x19')](0x1f4,_0x174a26[_0x2e22('0x1b')]));});});};exports[_0x2e22('0x28')]=function(_0x4d717b){var _0x288fc7=this;return new Promise(function(_0x313698,_0x33af86){return db[_0x2e22('0x1f')]['find']({'raw':_0x4d717b[_0x2e22('0x20')]?_0x4d717b[_0x2e22('0x20')][_0x2e22('0x29')]===undefined?!![]:![]:!![],'where':_0x4d717b[_0x2e22('0x20')]?_0x4d717b['options'][_0x2e22('0x21')]||null:null,'attributes':_0x4d717b[_0x2e22('0x20')]?_0x4d717b[_0x2e22('0x20')][_0x2e22('0x22')]||null:null,'include':_0x4d717b[_0x2e22('0x20')]?_0x4d717b['options'][_0x2e22('0x24')]?_[_0x2e22('0x25')](_0x4d717b['options']['include'],function(_0x2e3b0b){return{'model':db[_0x2e3b0b[_0x2e22('0x26')]],'as':_0x2e3b0b['as'],'attributes':_0x2e3b0b['attributes'],'include':_0x2e3b0b[_0x2e22('0x24')]?_[_0x2e22('0x25')](_0x2e3b0b[_0x2e22('0x24')],function(_0x8ade61){return{'model':db[_0x8ade61[_0x2e22('0x26')]],'as':_0x8ade61['as'],'attributes':_0x8ade61[_0x2e22('0x22')],'include':_0x8ade61[_0x2e22('0x24')]?_[_0x2e22('0x25')](_0x8ade61[_0x2e22('0x24')],function(_0xf37b8f){return{'model':db[_0xf37b8f[_0x2e22('0x26')]],'as':_0xf37b8f['as'],'attributes':_0xf37b8f[_0x2e22('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2e22('0x14')](function(_0x54bf5b){logger[_0x2e22('0x1c')](_0x2e22('0x28'),_0x4d717b);logger[_0x2e22('0x17')](_0x2e22('0x28'),_0x4d717b,JSON['stringify'](_0x54bf5b));_0x313698(_0x54bf5b);})[_0x2e22('0x1d')](function(_0x205f35){logger[_0x2e22('0x19')](_0x2e22('0x28'),_0x205f35[_0x2e22('0x1b')],_0x4d717b);_0x33af86(_0x288fc7[_0x2e22('0x19')](0x1f4,_0x205f35['message']));});});}; \ No newline at end of file +var _0xe1fb=['limit','map','model','include','then','debug','ShowMailQueue','MailQueue','find','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','MailQueue,\x20%s,\x20%s','result','catch','GetMailQueue','findAll','options','raw','where','attributes'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xe1fb,0xe1));var _0xbe1f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe1fb[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xbe1f('0x0'));var util=require('util');var moment=require(_0xbe1f('0x1'));var BPromise=require(_0xbe1f('0x2'));var rs=require(_0xbe1f('0x3'));var fs=require('fs');var Redis=require(_0xbe1f('0x4'));var db=require(_0xbe1f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe1f('0x6'))('rpc');var config=require(_0xbe1f('0x7'));var jayson=require(_0xbe1f('0x8'));var client=jayson[_0xbe1f('0x9')][_0xbe1f('0xa')]({'port':0x232a});config[_0xbe1f('0xb')]=_[_0xbe1f('0xc')](config[_0xbe1f('0xb')],{'host':_0xbe1f('0xd'),'port':0x18eb});var socket=require(_0xbe1f('0xe'))(new Redis(config[_0xbe1f('0xb')]));require(_0xbe1f('0xf'))[_0xbe1f('0x10')](socket);function respondWithRpcPromise(_0x470e88,_0x45e7ce,_0xf75bdf){return new BPromise(function(_0x50d335,_0x34d66a){return client[_0xbe1f('0x11')](_0x470e88,_0xf75bdf)['then'](function(_0x388f10){logger[_0xbe1f('0x12')]('MailQueue,\x20%s,\x20%s',_0x45e7ce,_0xbe1f('0x13'));logger['debug'](_0xbe1f('0x14'),_0x45e7ce,_0xbe1f('0x13'),JSON['stringify'](_0x388f10));if(_0x388f10[_0xbe1f('0x15')]){if(_0x388f10[_0xbe1f('0x15')][_0xbe1f('0x16')]===0x1f4){logger[_0xbe1f('0x15')]('MailQueue,\x20%s,\x20%s',_0x45e7ce,_0x388f10[_0xbe1f('0x15')][_0xbe1f('0x17')]);return _0x34d66a(_0x388f10[_0xbe1f('0x15')][_0xbe1f('0x17')]);}logger[_0xbe1f('0x15')](_0xbe1f('0x18'),_0x45e7ce,_0x388f10[_0xbe1f('0x15')][_0xbe1f('0x17')]);return _0x50d335(_0x388f10[_0xbe1f('0x15')]['message']);}else{logger['info'](_0xbe1f('0x18'),_0x45e7ce,_0xbe1f('0x13'));_0x50d335(_0x388f10[_0xbe1f('0x19')][_0xbe1f('0x17')]);}})[_0xbe1f('0x1a')](function(_0x53b0b8){logger[_0xbe1f('0x15')](_0xbe1f('0x18'),_0x45e7ce,_0x53b0b8);_0x34d66a(_0x53b0b8);});});}exports[_0xbe1f('0x1b')]=function(_0x57278a){var _0x222cf9=this;return new Promise(function(_0x4f1961,_0x3ccb21){return db['MailQueue'][_0xbe1f('0x1c')]({'raw':_0x57278a['options']?_0x57278a[_0xbe1f('0x1d')][_0xbe1f('0x1e')]===undefined?!![]:![]:!![],'where':_0x57278a[_0xbe1f('0x1d')]?_0x57278a[_0xbe1f('0x1d')][_0xbe1f('0x1f')]||null:null,'attributes':_0x57278a[_0xbe1f('0x1d')]?_0x57278a[_0xbe1f('0x1d')][_0xbe1f('0x20')]||null:null,'limit':_0x57278a[_0xbe1f('0x1d')]?_0x57278a[_0xbe1f('0x1d')][_0xbe1f('0x21')]||null:null,'include':_0x57278a['options']?_0x57278a['options']['include']?_[_0xbe1f('0x22')](_0x57278a[_0xbe1f('0x1d')]['include'],function(_0x2c2d96){return{'model':db[_0x2c2d96[_0xbe1f('0x23')]],'as':_0x2c2d96['as'],'attributes':_0x2c2d96[_0xbe1f('0x20')],'include':_0x2c2d96[_0xbe1f('0x24')]?_[_0xbe1f('0x22')](_0x2c2d96[_0xbe1f('0x24')],function(_0x4a1519){return{'model':db[_0x4a1519[_0xbe1f('0x23')]],'as':_0x4a1519['as'],'attributes':_0x4a1519[_0xbe1f('0x20')],'include':_0x4a1519[_0xbe1f('0x24')]?_[_0xbe1f('0x22')](_0x4a1519['include'],function(_0x4ab40c){return{'model':db[_0x4ab40c['model']],'as':_0x4ab40c['as'],'attributes':_0x4ab40c[_0xbe1f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbe1f('0x25')](function(_0x4e8989){logger[_0xbe1f('0x12')](_0xbe1f('0x1b'),_0x57278a);logger[_0xbe1f('0x26')]('GetMailQueue',_0x57278a,JSON['stringify'](_0x4e8989));_0x4f1961(_0x4e8989);})['catch'](function(_0x517632){logger[_0xbe1f('0x15')]('GetMailQueue',_0x517632[_0xbe1f('0x17')],_0x57278a);_0x3ccb21(_0x222cf9[_0xbe1f('0x15')](0x1f4,_0x517632[_0xbe1f('0x17')]));});});};exports[_0xbe1f('0x27')]=function(_0x2abbb6){var _0x2d5116=this;return new Promise(function(_0x4f0726,_0x1a3ff7){return db[_0xbe1f('0x28')][_0xbe1f('0x29')]({'raw':_0x2abbb6[_0xbe1f('0x1d')]?_0x2abbb6['options']['raw']===undefined?!![]:![]:!![],'where':_0x2abbb6[_0xbe1f('0x1d')]?_0x2abbb6['options'][_0xbe1f('0x1f')]||null:null,'attributes':_0x2abbb6[_0xbe1f('0x1d')]?_0x2abbb6[_0xbe1f('0x1d')][_0xbe1f('0x20')]||null:null,'include':_0x2abbb6[_0xbe1f('0x1d')]?_0x2abbb6[_0xbe1f('0x1d')][_0xbe1f('0x24')]?_['map'](_0x2abbb6[_0xbe1f('0x1d')][_0xbe1f('0x24')],function(_0x34863d){return{'model':db[_0x34863d['model']],'as':_0x34863d['as'],'attributes':_0x34863d['attributes'],'include':_0x34863d[_0xbe1f('0x24')]?_[_0xbe1f('0x22')](_0x34863d[_0xbe1f('0x24')],function(_0x93e793){return{'model':db[_0x93e793[_0xbe1f('0x23')]],'as':_0x93e793['as'],'attributes':_0x93e793[_0xbe1f('0x20')],'include':_0x93e793[_0xbe1f('0x24')]?_[_0xbe1f('0x22')](_0x93e793[_0xbe1f('0x24')],function(_0x3e3ab3){return{'model':db[_0x3e3ab3[_0xbe1f('0x23')]],'as':_0x3e3ab3['as'],'attributes':_0x3e3ab3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x464277){logger[_0xbe1f('0x12')](_0xbe1f('0x27'),_0x2abbb6);logger[_0xbe1f('0x26')](_0xbe1f('0x27'),_0x2abbb6,JSON[_0xbe1f('0x2a')](_0x464277));_0x4f0726(_0x464277);})['catch'](function(_0x379598){logger[_0xbe1f('0x15')]('ShowMailQueue',_0x379598[_0xbe1f('0x17')],_0x2abbb6);_0x1a3ff7(_0x2d5116['error'](0x1f4,_0x379598['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0c0a715..308eaec 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 _0x50ab=['register','length','mailQueue:','remove','update','emit','removeListener'];(function(_0x227c59,_0x575c83){var _0x35aeac=function(_0x477179){while(--_0x477179){_0x227c59['push'](_0x227c59['shift']());}};_0x35aeac(++_0x575c83);}(_0x50ab,0x130));var _0xb50a=function(_0x3de4c5,_0x43c1c2){_0x3de4c5=_0x3de4c5-0x0;var _0x1bcc83=_0x50ab[_0x3de4c5];return _0x1bcc83;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0xb50a('0x0'),_0xb50a('0x1')];function createListener(_0x297a66,_0x1ecd1e){return function(_0x177952){_0x1ecd1e[_0xb50a('0x2')](_0x297a66,_0x177952);};}function removeListener(_0x5aa772,_0x478a3e){return function(){MailQueueEvents[_0xb50a('0x3')](_0x5aa772,_0x478a3e);};}exports[_0xb50a('0x4')]=function(_0x5b170c){for(var _0x51932a=0x0,_0x5c6637=events[_0xb50a('0x5')];_0x51932a<_0x5c6637;_0x51932a++){var _0x4179a6=events[_0x51932a];var _0x2a5696=createListener(_0xb50a('0x6')+_0x4179a6,_0x5b170c);MailQueueEvents['on'](_0x4179a6,_0x2a5696);}}; \ No newline at end of file +var _0xc13c=['remove','update','removeListener','length','mailQueue:','./mailQueue.events','save'];(function(_0xd58823,_0x15c483){var _0x249c0a=function(_0x4b8b67){while(--_0x4b8b67){_0xd58823['push'](_0xd58823['shift']());}};_0x249c0a(++_0x15c483);}(_0xc13c,0x155));var _0xcc13=function(_0x1d669e,_0x4921c9){_0x1d669e=_0x1d669e-0x0;var _0x1d1ec7=_0xc13c[_0x1d669e];return _0x1d1ec7;};'use strict';var MailQueueEvents=require(_0xcc13('0x0'));var events=[_0xcc13('0x1'),_0xcc13('0x2'),_0xcc13('0x3')];function createListener(_0x1fd08d,_0x48afbc){return function(_0x445cc8){_0x48afbc['emit'](_0x1fd08d,_0x445cc8);};}function removeListener(_0x46c3d2,_0x37fa92){return function(){MailQueueEvents[_0xcc13('0x4')](_0x46c3d2,_0x37fa92);};}exports['register']=function(_0x5439d9){for(var _0x240d6e=0x0,_0x4fd488=events[_0xcc13('0x5')];_0x240d6e<_0x4fd488;_0x240d6e++){var _0x1adeb7=events[_0x240d6e];var _0x33c1fa=createListener(_0xcc13('0x6')+_0x1adeb7,_0x5439d9);MailQueueEvents['on'](_0x1adeb7,_0x33c1fa);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d4d6168..3f2c702 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 _0x01ad=['../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','delete','destroy','util','connect-timeout','express'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x01ad,0x15d));var _0xd01a=function(_0x4362d5,_0x1c20a6){_0x4362d5=_0x4362d5-0x0;var _0x5daade=_0x01ad[_0x4362d5];return _0x5daade;};'use strict';var multer=require('multer');var util=require(_0xd01a('0x0'));var path=require('path');var timeout=require(_0xd01a('0x1'));var express=require(_0xd01a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd01a('0x3'));var config=require(_0xd01a('0x4'));var controller=require(_0xd01a('0x5'));router[_0xd01a('0x6')]('/',auth[_0xd01a('0x7')](),controller['index']);router['get'](_0xd01a('0x8'),auth[_0xd01a('0x7')](),controller[_0xd01a('0x9')]);router[_0xd01a('0x6')](_0xd01a('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd01a('0xb')]('/',auth[_0xd01a('0x7')](),controller[_0xd01a('0xc')]);router[_0xd01a('0xd')](_0xd01a('0xa'),auth[_0xd01a('0x7')](),controller['update']);router[_0xd01a('0xe')]('/:id',auth[_0xd01a('0x7')](),controller[_0xd01a('0xf')]);module['exports']=router; \ No newline at end of file +var _0xbece=['../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x12da0d,_0x2d7048){var _0x28143f=function(_0x378c46){while(--_0x378c46){_0x12da0d['push'](_0x12da0d['shift']());}};_0x28143f(++_0x2d7048);}(_0xbece,0x66));var _0xebec=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xbece[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xebec('0x0'));var util=require(_0xebec('0x1'));var path=require(_0xebec('0x2'));var timeout=require('connect-timeout');var express=require(_0xebec('0x3'));var router=express[_0xebec('0x4')]();var fs_extra=require(_0xebec('0x5'));var auth=require(_0xebec('0x6'));var interaction=require(_0xebec('0x7'));var config=require(_0xebec('0x8'));var controller=require(_0xebec('0x9'));router['get']('/',auth[_0xebec('0xa')](),controller[_0xebec('0xb')]);router[_0xebec('0xc')]('/describe',auth[_0xebec('0xa')](),controller['describe']);router[_0xebec('0xc')](_0xebec('0xd'),auth[_0xebec('0xa')](),controller[_0xebec('0xe')]);router[_0xebec('0xf')]('/',auth[_0xebec('0xa')](),controller[_0xebec('0x10')]);router[_0xebec('0x11')](_0xebec('0xd'),auth['isAuthenticated'](),controller[_0xebec('0x12')]);router[_0xebec('0x13')](_0xebec('0xd'),auth[_0xebec('0xa')](),controller[_0xebec('0x14')]);module[_0xebec('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 9ad3fca..f7d07f0 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 _0x59e4=['DATE','exports','STRING'];(function(_0x1e92a6,_0x5184dc){var _0x14a496=function(_0x66e264){while(--_0x66e264){_0x1e92a6['push'](_0x1e92a6['shift']());}};_0x14a496(++_0x5184dc);}(_0x59e4,0x1a8));var _0x459e=function(_0x5ad771,_0x34186f){_0x5ad771=_0x5ad771-0x0;var _0x5b5dce=_0x59e4[_0x5ad771];return _0x5b5dce;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x459e('0x0')]={'uniqueid':{'type':Sequelize[_0x459e('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x459e('0x1')]},'joinAt':{'type':Sequelize[_0x459e('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x459e('0x2')]},'reason':{'type':Sequelize[_0x459e('0x1')]}}; \ No newline at end of file +var _0x09eb=['DATE','moment','sequelize','STRING'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x09eb,0x1d9));var _0xb09e=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0x09eb[_0x4322c6];return _0x4e7537;};'use strict';var moment=require(_0xb09e('0x0'));var Sequelize=require(_0xb09e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xb09e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb09e('0x2')]},'joinAt':{'type':Sequelize[_0xb09e('0x3')]},'leaveAt':{'type':Sequelize[_0xb09e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb09e('0x3')]},'reason':{'type':Sequelize[_0xb09e('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 63dc1c0..be8f19c 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 _0x5204=['fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','error','stack','name','send','map','MailQueueReport','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','findAll','then','rows','params','keys','rawAttributes','catch','create','body','find','describe','eml-format','rimraf'];(function(_0x478fcc,_0x4fadcf){var _0x431be5=function(_0x1b0edc){while(--_0x1b0edc){_0x478fcc['push'](_0x478fcc['shift']());}};_0x431be5(++_0x4fadcf);}(_0x5204,0xdf));var _0x4520=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x5204[_0x155c64];return _0x1f154a;};'use strict';var emlformat=require(_0x4520('0x0'));var rimraf=require(_0x4520('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4520('0x2'));var rp=require(_0x4520('0x3'));var moment=require(_0x4520('0x4'));var BPromise=require(_0x4520('0x5'));var Mustache=require(_0x4520('0x6'));var util=require('util');var path=require(_0x4520('0x7'));var sox=require('sox');var csv=require(_0x4520('0x8'));var ejs=require(_0x4520('0x9'));var fs=require('fs');var fs_extra=require(_0x4520('0xa'));var _=require(_0x4520('0xb'));var squel=require(_0x4520('0xc'));var crypto=require(_0x4520('0xd'));var jsforce=require(_0x4520('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4520('0x8'));var querystring=require('querystring');var Papa=require(_0x4520('0xf'));var Redis=require(_0x4520('0x10'));var authService=require(_0x4520('0x11'));var qs=require(_0x4520('0x12'));var as=require(_0x4520('0x13'));var hardwareService=require(_0x4520('0x14'));var logger=require(_0x4520('0x15'))(_0x4520('0x16'));var utils=require(_0x4520('0x17'));var config=require(_0x4520('0x18'));var licenseUtil=require(_0x4520('0x19'));var db=require(_0x4520('0x1a'))['db'];function respondWithStatusCode(_0x3c7a5d,_0x508ea6){_0x508ea6=_0x508ea6||0xcc;return function(_0x2e3c64){if(_0x2e3c64){return _0x3c7a5d[_0x4520('0x1b')](_0x508ea6);}return _0x3c7a5d[_0x4520('0x1c')](_0x508ea6)[_0x4520('0x1d')]();};}function respondWithResult(_0x426836,_0x34d383){_0x34d383=_0x34d383||0xc8;return function(_0x32950a){if(_0x32950a){return _0x426836['status'](_0x34d383)[_0x4520('0x1e')](_0x32950a);}};}function respondWithFilteredResult(_0x20de6b,_0x1ab841){return function(_0x15a31f){if(_0x15a31f){var _0x32d8aa=typeof _0x1ab841['offset']===_0x4520('0x1f')&&typeof _0x1ab841[_0x4520('0x20')]===_0x4520('0x1f');var _0x283ad4=_0x15a31f[_0x4520('0x21')];var _0x2e00f4=_0x32d8aa?0x0:_0x1ab841[_0x4520('0x22')];var _0x4ba69f=_0x32d8aa?_0x15a31f[_0x4520('0x21')]:_0x1ab841[_0x4520('0x22')]+_0x1ab841[_0x4520('0x20')];var _0x460521;if(_0x4ba69f>=_0x283ad4){_0x4ba69f=_0x283ad4;_0x460521=0xc8;}else{_0x460521=0xce;}_0x20de6b['status'](_0x460521);return _0x20de6b[_0x4520('0x23')]('Content-Range',_0x2e00f4+'-'+_0x4ba69f+'/'+_0x283ad4)['json'](_0x15a31f);}return null;};}function patchUpdates(_0x4c46c5){return function(_0x2b9456){try{jsonpatch['apply'](_0x2b9456,_0x4c46c5,!![]);}catch(_0x39e196){return BPromise[_0x4520('0x24')](_0x39e196);}return _0x2b9456[_0x4520('0x25')]();};}function saveUpdates(_0x534b15,_0x3199a9){return function(_0x4000d4){if(_0x4000d4){return _0x4000d4[_0x4520('0x26')](_0x534b15)['then'](function(_0x198c34){return _0x198c34;});}return null;};}function removeEntity(_0x847d15,_0x24eacd){return function(_0x3a4680){if(_0x3a4680){return _0x3a4680[_0x4520('0x27')]()['then'](function(){_0x847d15[_0x4520('0x1c')](0xcc)[_0x4520('0x1d')]();});}};}function handleEntityNotFound(_0x3532aa,_0x3e2906){return function(_0x57306b){if(!_0x57306b){_0x3532aa[_0x4520('0x1b')](0x194);}return _0x57306b;};}function handleError(_0x4602a4,_0x92168b){_0x92168b=_0x92168b||0x1f4;return function(_0x21e1f3){logger[_0x4520('0x28')](_0x21e1f3[_0x4520('0x29')]);if(_0x21e1f3[_0x4520('0x2a')]){delete _0x21e1f3[_0x4520('0x2a')];}_0x4602a4[_0x4520('0x1c')](_0x92168b)[_0x4520('0x2b')](_0x21e1f3);};}exports['index']=function(_0x222dbd,_0x5c1a0b){var _0x7ce8d2={},_0x14778a={},_0x43b4a2={'count':0x0,'rows':[]};var _0x157293=_[_0x4520('0x2c')](db[_0x4520('0x2d')]['rawAttributes'],function(_0x2c32ce){return{'name':_0x2c32ce['fieldName'],'type':_0x2c32ce[_0x4520('0x2e')]['key']};});_0x14778a[_0x4520('0x2f')]=_['map'](_0x157293,_0x4520('0x2a'));_0x14778a['query']=_['keys'](_0x222dbd[_0x4520('0x30')]);_0x14778a[_0x4520('0x31')]=_[_0x4520('0x32')](_0x14778a['model'],_0x14778a[_0x4520('0x30')]);_0x7ce8d2[_0x4520('0x33')]=_[_0x4520('0x32')](_0x14778a[_0x4520('0x2f')],qs['fields'](_0x222dbd['query'][_0x4520('0x34')]));_0x7ce8d2[_0x4520('0x33')]=_0x7ce8d2['attributes'][_0x4520('0x35')]?_0x7ce8d2[_0x4520('0x33')]:_0x14778a[_0x4520('0x2f')];if(!_0x222dbd[_0x4520('0x30')][_0x4520('0x36')](_0x4520('0x37'))){_0x7ce8d2['limit']=qs[_0x4520('0x20')](_0x222dbd[_0x4520('0x30')]['limit']);_0x7ce8d2[_0x4520('0x22')]=qs['offset'](_0x222dbd[_0x4520('0x30')][_0x4520('0x22')]);}_0x7ce8d2['order']=qs['sort'](_0x222dbd['query'][_0x4520('0x38')]);_0x7ce8d2[_0x4520('0x39')]=qs[_0x4520('0x31')](_[_0x4520('0x3a')](_0x222dbd[_0x4520('0x30')],_0x14778a[_0x4520('0x31')]),_0x157293);if(_0x222dbd[_0x4520('0x30')]['filter']){_0x7ce8d2[_0x4520('0x39')]=_[_0x4520('0x3b')](_0x7ce8d2[_0x4520('0x39')],{'$or':_['map'](_0x157293,function(_0x16d489){if(_0x16d489[_0x4520('0x2e')]!=='VIRTUAL'){var _0x57b155={};_0x57b155[_0x16d489[_0x4520('0x2a')]]={'$like':'%'+_0x222dbd[_0x4520('0x30')][_0x4520('0x3c')]+'%'};return _0x57b155;}})});}_0x7ce8d2=_[_0x4520('0x3b')]({},_0x7ce8d2,_0x222dbd[_0x4520('0x3d')]);var _0x5ca832={'where':_0x7ce8d2['where']};return db['MailQueueReport'][_0x4520('0x21')](_0x5ca832)['then'](function(_0x43dc36){_0x43b4a2['count']=_0x43dc36;if(_0x222dbd['query'][_0x4520('0x3e')]){_0x7ce8d2[_0x4520('0x3f')]=[{'all':!![]}];}return db[_0x4520('0x2d')][_0x4520('0x40')](_0x7ce8d2);})[_0x4520('0x41')](function(_0x59d646){_0x43b4a2[_0x4520('0x42')]=_0x59d646;return _0x43b4a2;})[_0x4520('0x41')](respondWithFilteredResult(_0x5c1a0b,_0x7ce8d2))['catch'](handleError(_0x5c1a0b,null));};exports['show']=function(_0x3780e4,_0x2ff306){var _0x500c45={'raw':!![],'where':{'id':_0x3780e4[_0x4520('0x43')]['id']}},_0x2978d5={};_0x2978d5[_0x4520('0x2f')]=_[_0x4520('0x44')](db['MailQueueReport'][_0x4520('0x45')]);_0x2978d5[_0x4520('0x30')]=_[_0x4520('0x44')](_0x3780e4[_0x4520('0x30')]);_0x2978d5[_0x4520('0x31')]=_[_0x4520('0x32')](_0x2978d5[_0x4520('0x2f')],_0x2978d5[_0x4520('0x30')]);_0x500c45[_0x4520('0x33')]=_[_0x4520('0x32')](_0x2978d5[_0x4520('0x2f')],qs[_0x4520('0x34')](_0x3780e4[_0x4520('0x30')][_0x4520('0x34')]));_0x500c45[_0x4520('0x33')]=_0x500c45[_0x4520('0x33')][_0x4520('0x35')]?_0x500c45['attributes']:_0x2978d5[_0x4520('0x2f')];if(_0x3780e4[_0x4520('0x30')]['includeAll']){_0x500c45['include']=[{'all':!![]}];}_0x500c45=_['merge']({},_0x500c45,_0x3780e4['options']);return db[_0x4520('0x2d')]['find'](_0x500c45)[_0x4520('0x41')](handleEntityNotFound(_0x2ff306,null))[_0x4520('0x41')](respondWithResult(_0x2ff306,null))[_0x4520('0x46')](handleError(_0x2ff306,null));};exports[_0x4520('0x47')]=function(_0x177c4e,_0x5e3eef){return db[_0x4520('0x2d')][_0x4520('0x47')](_0x177c4e[_0x4520('0x48')],{})[_0x4520('0x41')](respondWithResult(_0x5e3eef,0xc9))[_0x4520('0x46')](handleError(_0x5e3eef,null));};exports[_0x4520('0x26')]=function(_0x737ba4,_0x1e4821){if(_0x737ba4[_0x4520('0x48')]['id']){delete _0x737ba4[_0x4520('0x48')]['id'];}return db[_0x4520('0x2d')][_0x4520('0x49')]({'where':{'id':_0x737ba4['params']['id']}})['then'](handleEntityNotFound(_0x1e4821,null))[_0x4520('0x41')](saveUpdates(_0x737ba4[_0x4520('0x48')],null))[_0x4520('0x41')](respondWithResult(_0x1e4821,null))['catch'](handleError(_0x1e4821,null));};exports[_0x4520('0x27')]=function(_0x2288a7,_0x3f9a4c){return db['MailQueueReport'][_0x4520('0x49')]({'where':{'id':_0x2288a7[_0x4520('0x43')]['id']}})[_0x4520('0x41')](handleEntityNotFound(_0x3f9a4c,null))['then'](removeEntity(_0x3f9a4c,null))['catch'](handleError(_0x3f9a4c,null));};exports[_0x4520('0x4a')]=function(_0x24a6a4,_0x24269e){return db[_0x4520('0x2d')][_0x4520('0x4a')]()[_0x4520('0x41')](respondWithResult(_0x24269e,null))[_0x4520('0x46')](handleError(_0x24269e,null));}; \ No newline at end of file +var _0x47c5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x39ebbf,_0x7fce85){var _0x5d5d71=function(_0x1132e1){while(--_0x1132e1){_0x39ebbf['push'](_0x39ebbf['shift']());}};_0x5d5d71(++_0x7fce85);}(_0x47c5,0x165));var _0x547c=function(_0x1af3db,_0x369209){_0x1af3db=_0x1af3db-0x0;var _0x5da06a=_0x47c5[_0x1af3db];return _0x5da06a;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['MailQueueReport'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':!![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['MailQueueReport']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['MailQueueReport'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['MailQueueReport'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x2f')][_0x547c('0x51')]()[_0x547c('0x2a')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8c70bd8..a7da018 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 _0x323d=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailQueueReport'];(function(_0xe34ce5,_0x1a08c7){var _0x3067ec=function(_0x511e3b){while(--_0x511e3b){_0xe34ce5['push'](_0xe34ce5['shift']());}};_0x3067ec(++_0x1a08c7);}(_0x323d,0x1e2));var _0xd323=function(_0x2f5c7d,_0x1476bb){_0x2f5c7d=_0x2f5c7d-0x0;var _0x33686d=_0x323d[_0x2f5c7d];return _0x33686d;};'use strict';var _=require(_0xd323('0x0'));var util=require(_0xd323('0x1'));var logger=require(_0xd323('0x2'))(_0xd323('0x3'));var moment=require(_0xd323('0x4'));var BPromise=require(_0xd323('0x5'));var rp=require(_0xd323('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd323('0x7'));var config=require(_0xd323('0x8'));var attributes=require('./mailQueueReport.attributes');module[_0xd323('0x9')]=function(_0x28f5b7,_0x3f589b){return _0x28f5b7[_0xd323('0xa')](_0xd323('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xd323('0xc'),'fields':[_0xd323('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfdd=['bluebird','path','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4dad63,_0x479fe6){var _0x21ab95=function(_0x43f6c6){while(--_0x43f6c6){_0x4dad63['push'](_0x4dad63['shift']());}};_0x21ab95(++_0x479fe6);}(_0xdfdd,0x104));var _0xddfd=function(_0x55431d,_0x31cbe1){_0x55431d=_0x55431d-0x0;var _0x4dd5fe=_0xdfdd[_0x55431d];return _0x4dd5fe;};'use strict';var _=require(_0xddfd('0x0'));var util=require(_0xddfd('0x1'));var logger=require(_0xddfd('0x2'))(_0xddfd('0x3'));var moment=require('moment');var BPromise=require(_0xddfd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddfd('0x5'));var rimraf=require('rimraf');var config=require(_0xddfd('0x6'));var attributes=require(_0xddfd('0x7'));module[_0xddfd('0x8')]=function(_0x2c0d38,_0x48546c){return _0x2c0d38[_0xddfd('0x9')]('MailQueueReport',attributes,{'tableName':_0xddfd('0xa'),'paranoid':![],'indexes':[{'name':_0xddfd('0xb'),'fields':[_0xddfd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index c9ba156..7512b9f 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(_0x466acb,_0xc92fc9){var _0x157fb9=function(_0x401e53){while(--_0x401e53){_0x466acb['push'](_0x466acb['shift']());}};_0x157fb9(++_0xc92fc9);}(_0x326f,0xd1));var _0xf326=function(_0x35b8fd,_0x3283f3){_0x35b8fd=_0x35b8fd-0x0;var _0x189e80=_0x326f[_0x35b8fd];return _0x189e80;};'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(_0x439eae,_0xc770b6){var _0x422363=function(_0x413e1f){while(--_0x413e1f){_0x439eae['push'](_0x439eae['shift']());}};_0x422363(++_0xc770b6);}(_0x1261,0x144));var _0x1126=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0x1261[_0x2d1971];return _0x4d7759;};'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 2782441..6d73d51 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1e7517,_0x4b03c9){var _0x522f4c=function(_0x4b056b){while(--_0x4b056b){_0x1e7517['push'](_0x1e7517['shift']());}};_0x522f4c(++_0x4b03c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x320415,_0x1c3ced){var _0x3b0628=function(_0x4c9bca){while(--_0x4c9bca){_0x320415['push'](_0x320415['shift']());}};_0x3b0628(++_0x1c3ced);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 4a64848..b26fe05 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 _0xcc4f=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0xdb2aad,_0x34ea9e){var _0xf204bf=function(_0x253d47){while(--_0x253d47){_0xdb2aad['push'](_0xdb2aad['shift']());}};_0xf204bf(++_0x34ea9e);}(_0xcc4f,0x82));var _0xfcc4=function(_0x3cf7b0,_0x4ee980){_0x3cf7b0=_0x3cf7b0-0x0;var _0x4e7994=_0xcc4f[_0x3cf7b0];return _0x4e7994;};'use strict';var Sequelize=require(_0xfcc4('0x0'));module[_0xfcc4('0x1')]={'description':{'type':Sequelize[_0xfcc4('0x2')]},'host':{'type':Sequelize[_0xfcc4('0x2')]},'authentication':{'type':Sequelize[_0xfcc4('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfcc4('0x2')]},'port':{'type':Sequelize[_0xfcc4('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xfcc4('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xfcc4('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xfcc4('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x38a6=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x38a6,0x1d9));var _0x638a=function(_0xa46d99,_0x16c39a){_0xa46d99=_0xa46d99-0x0;var _0x3e24a4=_0x38a6[_0xa46d99];return _0x3e24a4;};'use strict';var Sequelize=require(_0x638a('0x0'));module[_0x638a('0x1')]={'description':{'type':Sequelize[_0x638a('0x2')]},'host':{'type':Sequelize[_0x638a('0x2')]},'authentication':{'type':Sequelize[_0x638a('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x638a('0x2')]},'port':{'type':Sequelize[_0x638a('0x4')]},'tls':{'type':Sequelize[_0x638a('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x638a('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x638a('0x2')]},'modernAuthentication':{'type':Sequelize[_0x638a('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 56cd3fa..5178a03 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 _0xc6ce=['./mailServerIn.attributes','exports','define','mail_servers_in','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x780e9,_0x292723){var _0x4231f2=function(_0xc648c8){while(--_0xc648c8){_0x780e9['push'](_0x780e9['shift']());}};_0x4231f2(++_0x292723);}(_0xc6ce,0x122));var _0xec6c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc6ce[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xec6c('0x0'));var logger=require(_0xec6c('0x1'))(_0xec6c('0x2'));var moment=require(_0xec6c('0x3'));var BPromise=require(_0xec6c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec6c('0x5'));var rimraf=require('rimraf');var config=require(_0xec6c('0x6'));var attributes=require(_0xec6c('0x7'));module[_0xec6c('0x8')]=function(_0x3219e2,_0x52f843){return _0x3219e2[_0xec6c('0x9')]('MailServerIn',attributes,{'tableName':_0xec6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bf1=['../../config/logger','bluebird','path','../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash','util'];(function(_0x4c64fb,_0x16f007){var _0x1145ea=function(_0x3d0ebc){while(--_0x3d0ebc){_0x4c64fb['push'](_0x4c64fb['shift']());}};_0x1145ea(++_0x16f007);}(_0x6bf1,0x80));var _0x16bf=function(_0x3f78b0,_0x3e102f){_0x3f78b0=_0x3f78b0-0x0;var _0x226432=_0x6bf1[_0x3f78b0];return _0x226432;};'use strict';var _=require(_0x16bf('0x0'));var util=require(_0x16bf('0x1'));var logger=require(_0x16bf('0x2'))('api');var moment=require('moment');var BPromise=require(_0x16bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x16bf('0x4'));var rimraf=require('rimraf');var config=require(_0x16bf('0x5'));var attributes=require('./mailServerIn.attributes');module[_0x16bf('0x6')]=function(_0x22ce2c,_0x5ee46a){return _0x22ce2c[_0x16bf('0x7')](_0x16bf('0x8'),attributes,{'tableName':_0x16bf('0x9'),'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 80f8ac6..abbe95e 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 _0x4c0e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','limit','map','include','model','attributes','lodash'];(function(_0x567b1e,_0x5c5f62){var _0x30a32d=function(_0x3ab6e9){while(--_0x3ab6e9){_0x567b1e['push'](_0x567b1e['shift']());}};_0x30a32d(++_0x5c5f62);}(_0x4c0e,0x128));var _0xe4c0=function(_0x260ce2,_0x2e22b8){_0x260ce2=_0x260ce2-0x0;var _0x16b105=_0x4c0e[_0x260ce2];return _0x16b105;};'use strict';var _=require(_0xe4c0('0x0'));var util=require(_0xe4c0('0x1'));var moment=require(_0xe4c0('0x2'));var BPromise=require(_0xe4c0('0x3'));var rs=require(_0xe4c0('0x4'));var fs=require('fs');var Redis=require(_0xe4c0('0x5'));var db=require(_0xe4c0('0x6'))['db'];var utils=require(_0xe4c0('0x7'));var logger=require(_0xe4c0('0x8'))('rpc');var config=require(_0xe4c0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe4c0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4488b0,_0x503cd9,_0x5dee9f){return new BPromise(function(_0x46fcfa,_0x3ab99d){return client['request'](_0x4488b0,_0x5dee9f)[_0xe4c0('0xb')](function(_0x15b3d0){logger[_0xe4c0('0xc')](_0xe4c0('0xd'),_0x503cd9,'request\x20sent');logger[_0xe4c0('0xe')](_0xe4c0('0xf'),_0x503cd9,_0xe4c0('0x10'),JSON[_0xe4c0('0x11')](_0x15b3d0));if(_0x15b3d0[_0xe4c0('0x12')]){if(_0x15b3d0[_0xe4c0('0x12')][_0xe4c0('0x13')]===0x1f4){logger[_0xe4c0('0x12')](_0xe4c0('0xd'),_0x503cd9,_0x15b3d0[_0xe4c0('0x12')][_0xe4c0('0x14')]);return _0x3ab99d(_0x15b3d0['error'][_0xe4c0('0x14')]);}logger[_0xe4c0('0x12')](_0xe4c0('0xd'),_0x503cd9,_0x15b3d0[_0xe4c0('0x12')]['message']);return _0x46fcfa(_0x15b3d0[_0xe4c0('0x12')][_0xe4c0('0x14')]);}else{logger[_0xe4c0('0xc')](_0xe4c0('0xd'),_0x503cd9,'request\x20sent');_0x46fcfa(_0x15b3d0[_0xe4c0('0x15')]['message']);}})[_0xe4c0('0x16')](function(_0x3d3bcf){logger[_0xe4c0('0x12')]('MailServerIn,\x20%s,\x20%s',_0x503cd9,_0x3d3bcf);_0x3ab99d(_0x3d3bcf);});});}exports[_0xe4c0('0x17')]=function(_0x4acbc0){var _0x2a2e43=this;return new Promise(function(_0x1af64b,_0x5ad150){return db[_0xe4c0('0x18')]['findAll']({'raw':_0x4acbc0[_0xe4c0('0x19')]?_0x4acbc0[_0xe4c0('0x19')][_0xe4c0('0x1a')]===undefined?!![]:![]:!![],'where':_0x4acbc0[_0xe4c0('0x19')]?_0x4acbc0[_0xe4c0('0x19')][_0xe4c0('0x1b')]||null:null,'attributes':_0x4acbc0[_0xe4c0('0x19')]?_0x4acbc0['options']['attributes']||null:null,'limit':_0x4acbc0[_0xe4c0('0x19')]?_0x4acbc0[_0xe4c0('0x19')][_0xe4c0('0x1c')]||null:null,'include':_0x4acbc0['options']?_0x4acbc0[_0xe4c0('0x19')]['include']?_[_0xe4c0('0x1d')](_0x4acbc0['options'][_0xe4c0('0x1e')],function(_0x34254a){return{'model':db[_0x34254a[_0xe4c0('0x1f')]],'as':_0x34254a['as'],'attributes':_0x34254a[_0xe4c0('0x20')],'include':_0x34254a['include']?_[_0xe4c0('0x1d')](_0x34254a[_0xe4c0('0x1e')],function(_0x306f59){return{'model':db[_0x306f59[_0xe4c0('0x1f')]],'as':_0x306f59['as'],'attributes':_0x306f59['attributes'],'include':_0x306f59[_0xe4c0('0x1e')]?_[_0xe4c0('0x1d')](_0x306f59[_0xe4c0('0x1e')],function(_0x3bd747){return{'model':db[_0x3bd747[_0xe4c0('0x1f')]],'as':_0x3bd747['as'],'attributes':_0x3bd747[_0xe4c0('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe4c0('0xb')](function(_0x592a1a){logger[_0xe4c0('0xc')](_0xe4c0('0x17'),_0x4acbc0);logger[_0xe4c0('0xe')](_0xe4c0('0x17'),_0x4acbc0,JSON[_0xe4c0('0x11')](_0x592a1a));_0x1af64b(_0x592a1a);})[_0xe4c0('0x16')](function(_0x3cf407){logger['error'](_0xe4c0('0x17'),_0x3cf407[_0xe4c0('0x14')],_0x4acbc0);_0x5ad150(_0x2a2e43[_0xe4c0('0x12')](0x1f4,_0x3cf407[_0xe4c0('0x14')]));});});}; \ No newline at end of file +var _0xd452=['include','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','options','where','attributes','limit'];(function(_0x292b13,_0xeb7b87){var _0x21ab12=function(_0x7887ac){while(--_0x7887ac){_0x292b13['push'](_0x292b13['shift']());}};_0x21ab12(++_0xeb7b87);}(_0xd452,0x98));var _0x2d45=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0xd452[_0x3438cf];return _0x278698;};'use strict';var _=require(_0x2d45('0x0'));var util=require(_0x2d45('0x1'));var moment=require('moment');var BPromise=require(_0x2d45('0x2'));var rs=require(_0x2d45('0x3'));var fs=require('fs');var Redis=require(_0x2d45('0x4'));var db=require(_0x2d45('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2d45('0x6'));var config=require(_0x2d45('0x7'));var jayson=require(_0x2d45('0x8'));var client=jayson[_0x2d45('0x9')][_0x2d45('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x344ee2,_0x4e82ca,_0x464933){return new BPromise(function(_0x202a12,_0x1d7c79){return client['request'](_0x344ee2,_0x464933)[_0x2d45('0xb')](function(_0x3135f1){logger[_0x2d45('0xc')]('MailServerIn,\x20%s,\x20%s',_0x4e82ca,_0x2d45('0xd'));logger[_0x2d45('0xe')](_0x2d45('0xf'),_0x4e82ca,_0x2d45('0xd'),JSON[_0x2d45('0x10')](_0x3135f1));if(_0x3135f1['error']){if(_0x3135f1[_0x2d45('0x11')]['code']===0x1f4){logger[_0x2d45('0x11')](_0x2d45('0x12'),_0x4e82ca,_0x3135f1[_0x2d45('0x11')][_0x2d45('0x13')]);return _0x1d7c79(_0x3135f1[_0x2d45('0x11')]['message']);}logger[_0x2d45('0x11')](_0x2d45('0x12'),_0x4e82ca,_0x3135f1[_0x2d45('0x11')]['message']);return _0x202a12(_0x3135f1[_0x2d45('0x11')][_0x2d45('0x13')]);}else{logger['info'](_0x2d45('0x12'),_0x4e82ca,_0x2d45('0xd'));_0x202a12(_0x3135f1[_0x2d45('0x14')][_0x2d45('0x13')]);}})[_0x2d45('0x15')](function(_0x50753a){logger[_0x2d45('0x11')](_0x2d45('0x12'),_0x4e82ca,_0x50753a);_0x1d7c79(_0x50753a);});});}exports[_0x2d45('0x16')]=function(_0x1d15d9){var _0x227cab=this;return new Promise(function(_0x1a33e1,_0x33d3eb){return db[_0x2d45('0x17')]['findAll']({'raw':_0x1d15d9[_0x2d45('0x18')]?_0x1d15d9[_0x2d45('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1d15d9[_0x2d45('0x18')]?_0x1d15d9[_0x2d45('0x18')][_0x2d45('0x19')]||null:null,'attributes':_0x1d15d9[_0x2d45('0x18')]?_0x1d15d9['options'][_0x2d45('0x1a')]||null:null,'limit':_0x1d15d9[_0x2d45('0x18')]?_0x1d15d9['options'][_0x2d45('0x1b')]||null:null,'include':_0x1d15d9[_0x2d45('0x18')]?_0x1d15d9[_0x2d45('0x18')][_0x2d45('0x1c')]?_['map'](_0x1d15d9['options'][_0x2d45('0x1c')],function(_0x744c9e){return{'model':db[_0x744c9e[_0x2d45('0x1d')]],'as':_0x744c9e['as'],'attributes':_0x744c9e['attributes'],'include':_0x744c9e[_0x2d45('0x1c')]?_['map'](_0x744c9e[_0x2d45('0x1c')],function(_0x2313ea){return{'model':db[_0x2313ea[_0x2d45('0x1d')]],'as':_0x2313ea['as'],'attributes':_0x2313ea[_0x2d45('0x1a')],'include':_0x2313ea[_0x2d45('0x1c')]?_['map'](_0x2313ea[_0x2d45('0x1c')],function(_0x212acf){return{'model':db[_0x212acf['model']],'as':_0x212acf['as'],'attributes':_0x212acf['attributes']};}):[]};}):[]};}):[]:[]})[_0x2d45('0xb')](function(_0x141ce5){logger['info'](_0x2d45('0x16'),_0x1d15d9);logger[_0x2d45('0xe')](_0x2d45('0x16'),_0x1d15d9,JSON[_0x2d45('0x10')](_0x141ce5));_0x1a33e1(_0x141ce5);})[_0x2d45('0x15')](function(_0x59a37f){logger[_0x2d45('0x11')](_0x2d45('0x16'),_0x59a37f['message'],_0x1d15d9);_0x33d3eb(_0x227cab['error'](0x1f4,_0x59a37f[_0x2d45('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4f4fd08..77703ce 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(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_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('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 013a590..b93c018 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 _0x6f7a=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x2cba61,_0xc22039){_0x2cba61=_0x2cba61-0x0;var _0x3c1c85=_0x6f7a[_0x2cba61];return _0x3c1c85;};'use strict';var Sequelize=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]={'description':{'type':Sequelize[_0xa6f7('0x2')]},'host':{'type':Sequelize[_0xa6f7('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xa6f7('0x2')]},'port':{'type':Sequelize[_0xa6f7('0x3')]},'secure':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xa6f7('0x2')]},'authentication':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x3c81=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3c81,0x102));var _0x13c8=function(_0x22ab71,_0x706099){_0x22ab71=_0x22ab71-0x0;var _0x113c17=_0x3c81[_0x22ab71];return _0x113c17;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x13c8('0x2')]},'user':{'type':Sequelize[_0x13c8('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 6312b1f..08b8dd0 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 _0x5941=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','offset','count','limit','set','Content-Range','apply','save','then','destroy','end','sendStatus','stack','name','send','index','map','MailServerOut','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0xbcaa47,_0x211e6a){var _0x329904=function(_0x24c474){while(--_0x24c474){_0xbcaa47['push'](_0xbcaa47['shift']());}};_0x329904(++_0x211e6a);}(_0x5941,0xd3));var _0x1594=function(_0x21c810,_0x474430){_0x21c810=_0x21c810-0x0;var _0x35b1fc=_0x5941[_0x21c810];return _0x35b1fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1594('0x0'));var zipdir=require(_0x1594('0x1'));var jsonpatch=require(_0x1594('0x2'));var rp=require(_0x1594('0x3'));var moment=require(_0x1594('0x4'));var BPromise=require(_0x1594('0x5'));var Mustache=require(_0x1594('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1594('0x7'));var csv=require(_0x1594('0x8'));var ejs=require(_0x1594('0x9'));var fs=require('fs');var fs_extra=require(_0x1594('0xa'));var _=require(_0x1594('0xb'));var squel=require(_0x1594('0xc'));var crypto=require('crypto');var jsforce=require(_0x1594('0xd'));var deskjs=require(_0x1594('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1594('0xf'));var Papa=require(_0x1594('0x10'));var Redis=require(_0x1594('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1594('0x12'));var as=require(_0x1594('0x13'));var hardwareService=require(_0x1594('0x14'));var logger=require(_0x1594('0x15'))('api');var utils=require(_0x1594('0x16'));var config=require(_0x1594('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1594('0x18'))['db'];function respondWithStatusCode(_0x582f3d,_0x21e3d3){_0x21e3d3=_0x21e3d3||0xcc;return function(_0x202a42){if(_0x202a42){return _0x582f3d['sendStatus'](_0x21e3d3);}return _0x582f3d[_0x1594('0x19')](_0x21e3d3)['end']();};}function respondWithResult(_0x24917c,_0x5a0f7b){_0x5a0f7b=_0x5a0f7b||0xc8;return function(_0x1bcdac){if(_0x1bcdac){return _0x24917c[_0x1594('0x19')](_0x5a0f7b)[_0x1594('0x1a')](_0x1bcdac);}};}function respondWithFilteredResult(_0xf75f9e,_0x332c5b){return function(_0x51296e){if(_0x51296e){var _0x55ef94=typeof _0x332c5b['offset']===_0x1594('0x1b')&&typeof _0x332c5b['limit']===_0x1594('0x1b');var _0x5a903c=_0x51296e['count'];var _0x12324c=_0x55ef94?0x0:_0x332c5b[_0x1594('0x1c')];var _0x1f08b3=_0x55ef94?_0x51296e[_0x1594('0x1d')]:_0x332c5b[_0x1594('0x1c')]+_0x332c5b[_0x1594('0x1e')];var _0x2e69ac;if(_0x1f08b3>=_0x5a903c){_0x1f08b3=_0x5a903c;_0x2e69ac=0xc8;}else{_0x2e69ac=0xce;}_0xf75f9e[_0x1594('0x19')](_0x2e69ac);return _0xf75f9e[_0x1594('0x1f')](_0x1594('0x20'),_0x12324c+'-'+_0x1f08b3+'/'+_0x5a903c)['json'](_0x51296e);}return null;};}function patchUpdates(_0x3e0c70){return function(_0x232c63){try{jsonpatch[_0x1594('0x21')](_0x232c63,_0x3e0c70,!![]);}catch(_0x3ebde1){return BPromise['reject'](_0x3ebde1);}return _0x232c63[_0x1594('0x22')]();};}function saveUpdates(_0x459355,_0x314453){return function(_0x3260eb){if(_0x3260eb){return _0x3260eb['update'](_0x459355)[_0x1594('0x23')](function(_0x12d166){return _0x12d166;});}return null;};}function removeEntity(_0xb7348c,_0x38dfb5){return function(_0x24643d){if(_0x24643d){return _0x24643d[_0x1594('0x24')]()[_0x1594('0x23')](function(){_0xb7348c[_0x1594('0x19')](0xcc)[_0x1594('0x25')]();});}};}function handleEntityNotFound(_0x21e4cb,_0x3db99d){return function(_0x5583a4){if(!_0x5583a4){_0x21e4cb[_0x1594('0x26')](0x194);}return _0x5583a4;};}function handleError(_0x46a558,_0x236b54){_0x236b54=_0x236b54||0x1f4;return function(_0x380be5){logger['error'](_0x380be5[_0x1594('0x27')]);if(_0x380be5[_0x1594('0x28')]){delete _0x380be5[_0x1594('0x28')];}_0x46a558[_0x1594('0x19')](_0x236b54)[_0x1594('0x29')](_0x380be5);};}exports[_0x1594('0x2a')]=function(_0x9d18ce,_0x51c4d3){var _0x5490e3={},_0x41233e={},_0xf60d9b={'count':0x0,'rows':[]};var _0x156d62=_[_0x1594('0x2b')](db[_0x1594('0x2c')]['rawAttributes'],function(_0xf1e120){return{'name':_0xf1e120[_0x1594('0x2d')],'type':_0xf1e120[_0x1594('0x2e')][_0x1594('0x2f')]};});_0x41233e['model']=_['map'](_0x156d62,_0x1594('0x28'));_0x41233e[_0x1594('0x30')]=_[_0x1594('0x31')](_0x9d18ce[_0x1594('0x30')]);_0x41233e[_0x1594('0x32')]=_[_0x1594('0x33')](_0x41233e['model'],_0x41233e[_0x1594('0x30')]);_0x5490e3[_0x1594('0x34')]=_[_0x1594('0x33')](_0x41233e[_0x1594('0x35')],qs['fields'](_0x9d18ce[_0x1594('0x30')][_0x1594('0x36')]));_0x5490e3[_0x1594('0x34')]=_0x5490e3['attributes'][_0x1594('0x37')]?_0x5490e3[_0x1594('0x34')]:_0x41233e['model'];if(!_0x9d18ce['query'][_0x1594('0x38')](_0x1594('0x39'))){_0x5490e3[_0x1594('0x1e')]=qs['limit'](_0x9d18ce[_0x1594('0x30')]['limit']);_0x5490e3[_0x1594('0x1c')]=qs[_0x1594('0x1c')](_0x9d18ce['query'][_0x1594('0x1c')]);}_0x5490e3['order']=qs[_0x1594('0x3a')](_0x9d18ce[_0x1594('0x30')][_0x1594('0x3a')]);_0x5490e3[_0x1594('0x3b')]=qs['filters'](_[_0x1594('0x3c')](_0x9d18ce[_0x1594('0x30')],_0x41233e[_0x1594('0x32')]),_0x156d62);if(_0x9d18ce['query'][_0x1594('0x3d')]){_0x5490e3['where']=_[_0x1594('0x3e')](_0x5490e3[_0x1594('0x3b')],{'$or':_['map'](_0x156d62,function(_0x244468){if(_0x244468[_0x1594('0x2e')]!==_0x1594('0x3f')){var _0x5c8f79={};_0x5c8f79[_0x244468[_0x1594('0x28')]]={'$like':'%'+_0x9d18ce[_0x1594('0x30')][_0x1594('0x3d')]+'%'};return _0x5c8f79;}})});}_0x5490e3=_['merge']({},_0x5490e3,_0x9d18ce[_0x1594('0x40')]);var _0x25ecdf={'where':_0x5490e3['where']};return db[_0x1594('0x2c')][_0x1594('0x1d')](_0x25ecdf)['then'](function(_0x4da583){_0xf60d9b[_0x1594('0x1d')]=_0x4da583;if(_0x9d18ce[_0x1594('0x30')][_0x1594('0x41')]){_0x5490e3[_0x1594('0x42')]=[{'all':!![]}];}return db['MailServerOut'][_0x1594('0x43')](_0x5490e3);})[_0x1594('0x23')](function(_0x452ccd){_0xf60d9b[_0x1594('0x44')]=_0x452ccd;return _0xf60d9b;})[_0x1594('0x23')](respondWithFilteredResult(_0x51c4d3,_0x5490e3))[_0x1594('0x45')](handleError(_0x51c4d3,null));};exports[_0x1594('0x46')]=function(_0x2569fd,_0x274070){var _0x1296ab={'raw':!![],'where':{'id':_0x2569fd[_0x1594('0x47')]['id']}},_0xf9458d={};_0xf9458d[_0x1594('0x35')]=_['keys'](db[_0x1594('0x2c')]['rawAttributes']);_0xf9458d[_0x1594('0x30')]=_[_0x1594('0x31')](_0x2569fd[_0x1594('0x30')]);_0xf9458d['filters']=_['intersection'](_0xf9458d[_0x1594('0x35')],_0xf9458d[_0x1594('0x30')]);_0x1296ab[_0x1594('0x34')]=_['intersection'](_0xf9458d['model'],qs[_0x1594('0x36')](_0x2569fd['query'][_0x1594('0x36')]));_0x1296ab[_0x1594('0x34')]=_0x1296ab[_0x1594('0x34')]['length']?_0x1296ab[_0x1594('0x34')]:_0xf9458d['model'];if(_0x2569fd[_0x1594('0x30')][_0x1594('0x41')]){_0x1296ab['include']=[{'all':!![]}];}_0x1296ab=_['merge']({},_0x1296ab,_0x2569fd[_0x1594('0x40')]);return db[_0x1594('0x2c')]['find'](_0x1296ab)[_0x1594('0x23')](handleEntityNotFound(_0x274070,null))[_0x1594('0x23')](respondWithResult(_0x274070,null))[_0x1594('0x45')](handleError(_0x274070,null));};exports[_0x1594('0x48')]=function(_0x5efdcc,_0x4f1af4){return db[_0x1594('0x2c')][_0x1594('0x48')](_0x5efdcc[_0x1594('0x49')],{})[_0x1594('0x23')](respondWithResult(_0x4f1af4,0xc9))[_0x1594('0x45')](handleError(_0x4f1af4,null));};exports[_0x1594('0x4a')]=function(_0x556db8,_0x49969a){if(_0x556db8['body']['id']){delete _0x556db8[_0x1594('0x49')]['id'];}return db[_0x1594('0x2c')][_0x1594('0x4b')]({'where':{'id':_0x556db8[_0x1594('0x47')]['id']}})[_0x1594('0x23')](handleEntityNotFound(_0x49969a,null))[_0x1594('0x23')](saveUpdates(_0x556db8[_0x1594('0x49')],null))[_0x1594('0x23')](respondWithResult(_0x49969a,null))['catch'](handleError(_0x49969a,null));};exports['destroy']=function(_0xb1e9ee,_0x44499f){return db['MailServerOut'][_0x1594('0x4b')]({'where':{'id':_0xb1e9ee[_0x1594('0x47')]['id']}})[_0x1594('0x23')](handleEntityNotFound(_0x44499f,null))[_0x1594('0x23')](removeEntity(_0x44499f,null))[_0x1594('0x45')](handleError(_0x44499f,null));}; \ No newline at end of file +var _0x0cb3=['show','rawAttributes','include','create','body','find','params','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','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','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailServerOut','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch'];(function(_0x2fd3d7,_0x52ca3d){var _0x790c8f=function(_0x23f264){while(--_0x23f264){_0x2fd3d7['push'](_0x2fd3d7['shift']());}};_0x790c8f(++_0x52ca3d);}(_0x0cb3,0x95));var _0x30cb=function(_0x191b69,_0x1d174e){_0x191b69=_0x191b69-0x0;var _0xd9657c=_0x0cb3[_0x191b69];return _0xd9657c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30cb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x30cb('0x1'));var moment=require(_0x30cb('0x2'));var BPromise=require(_0x30cb('0x3'));var Mustache=require(_0x30cb('0x4'));var util=require('util');var path=require(_0x30cb('0x5'));var sox=require('sox');var csv=require(_0x30cb('0x6'));var ejs=require(_0x30cb('0x7'));var fs=require('fs');var fs_extra=require(_0x30cb('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x30cb('0x9'));var jsforce=require(_0x30cb('0xa'));var deskjs=require(_0x30cb('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x30cb('0xc'));var Redis=require(_0x30cb('0xd'));var authService=require(_0x30cb('0xe'));var qs=require(_0x30cb('0xf'));var as=require(_0x30cb('0x10'));var hardwareService=require(_0x30cb('0x11'));var logger=require(_0x30cb('0x12'))(_0x30cb('0x13'));var utils=require(_0x30cb('0x14'));var config=require(_0x30cb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49d3f6,_0x4e86eb){_0x4e86eb=_0x4e86eb||0xcc;return function(_0x57a9f5){if(_0x57a9f5){return _0x49d3f6[_0x30cb('0x16')](_0x4e86eb);}return _0x49d3f6['status'](_0x4e86eb)[_0x30cb('0x17')]();};}function respondWithResult(_0x6bdac,_0x5a2951){_0x5a2951=_0x5a2951||0xc8;return function(_0x1e6af0){if(_0x1e6af0){return _0x6bdac[_0x30cb('0x18')](_0x5a2951)[_0x30cb('0x19')](_0x1e6af0);}};}function respondWithFilteredResult(_0x4c88af,_0x57ca20){return function(_0xc3bfce){if(_0xc3bfce){var _0x1f651e=typeof _0x57ca20[_0x30cb('0x1a')]===_0x30cb('0x1b')&&typeof _0x57ca20[_0x30cb('0x1c')]===_0x30cb('0x1b');var _0x2f67ac=_0xc3bfce[_0x30cb('0x1d')];var _0x45092d=_0x1f651e?0x0:_0x57ca20[_0x30cb('0x1a')];var _0x3dec06=_0x1f651e?_0xc3bfce[_0x30cb('0x1d')]:_0x57ca20[_0x30cb('0x1a')]+_0x57ca20[_0x30cb('0x1c')];var _0x1756a2;if(_0x3dec06>=_0x2f67ac){_0x3dec06=_0x2f67ac;_0x1756a2=0xc8;}else{_0x1756a2=0xce;}_0x4c88af['status'](_0x1756a2);return _0x4c88af['set']('Content-Range',_0x45092d+'-'+_0x3dec06+'/'+_0x2f67ac)[_0x30cb('0x19')](_0xc3bfce);}return null;};}function patchUpdates(_0x2ff5f1){return function(_0x347a93){try{jsonpatch[_0x30cb('0x1e')](_0x347a93,_0x2ff5f1,!![]);}catch(_0x280879){return BPromise[_0x30cb('0x1f')](_0x280879);}return _0x347a93[_0x30cb('0x20')]();};}function saveUpdates(_0x2930c8,_0x5f548b){return function(_0x2aa94f){if(_0x2aa94f){return _0x2aa94f[_0x30cb('0x21')](_0x2930c8)[_0x30cb('0x22')](function(_0x40b820){return _0x40b820;});}return null;};}function removeEntity(_0x17037f,_0x6407f7){return function(_0x25b6e1){if(_0x25b6e1){return _0x25b6e1[_0x30cb('0x23')]()[_0x30cb('0x22')](function(){_0x17037f['status'](0xcc)[_0x30cb('0x17')]();});}};}function handleEntityNotFound(_0x128502,_0x2f8d62){return function(_0x2292af){if(!_0x2292af){_0x128502[_0x30cb('0x16')](0x194);}return _0x2292af;};}function handleError(_0x2aee8d,_0x39c25f){_0x39c25f=_0x39c25f||0x1f4;return function(_0x57f438){logger[_0x30cb('0x24')](_0x57f438[_0x30cb('0x25')]);if(_0x57f438[_0x30cb('0x26')]){delete _0x57f438[_0x30cb('0x26')];}_0x2aee8d[_0x30cb('0x18')](_0x39c25f)[_0x30cb('0x27')](_0x57f438);};}exports[_0x30cb('0x28')]=function(_0x3c266a,_0x44e416){var _0x19e28b={},_0x20dbf8={},_0x19f978={'count':0x0,'rows':[]};var _0x43ec44=_[_0x30cb('0x29')](db[_0x30cb('0x2a')]['rawAttributes'],function(_0x1f5f79){return{'name':_0x1f5f79['fieldName'],'type':_0x1f5f79[_0x30cb('0x2b')][_0x30cb('0x2c')]};});_0x20dbf8[_0x30cb('0x2d')]=_[_0x30cb('0x29')](_0x43ec44,_0x30cb('0x26'));_0x20dbf8[_0x30cb('0x2e')]=_[_0x30cb('0x2f')](_0x3c266a[_0x30cb('0x2e')]);_0x20dbf8[_0x30cb('0x30')]=_[_0x30cb('0x31')](_0x20dbf8['model'],_0x20dbf8[_0x30cb('0x2e')]);_0x19e28b[_0x30cb('0x32')]=_[_0x30cb('0x31')](_0x20dbf8[_0x30cb('0x2d')],qs[_0x30cb('0x33')](_0x3c266a[_0x30cb('0x2e')]['fields']));_0x19e28b[_0x30cb('0x32')]=_0x19e28b['attributes'][_0x30cb('0x34')]?_0x19e28b[_0x30cb('0x32')]:_0x20dbf8[_0x30cb('0x2d')];if(!_0x3c266a[_0x30cb('0x2e')][_0x30cb('0x35')]('nolimit')){_0x19e28b[_0x30cb('0x1c')]=qs['limit'](_0x3c266a[_0x30cb('0x2e')][_0x30cb('0x1c')]);_0x19e28b[_0x30cb('0x1a')]=qs[_0x30cb('0x1a')](_0x3c266a[_0x30cb('0x2e')][_0x30cb('0x1a')]);}_0x19e28b[_0x30cb('0x36')]=qs[_0x30cb('0x37')](_0x3c266a[_0x30cb('0x2e')][_0x30cb('0x37')]);_0x19e28b[_0x30cb('0x38')]=qs[_0x30cb('0x30')](_[_0x30cb('0x39')](_0x3c266a['query'],_0x20dbf8[_0x30cb('0x30')]),_0x43ec44);if(_0x3c266a[_0x30cb('0x2e')][_0x30cb('0x3a')]){_0x19e28b[_0x30cb('0x38')]=_[_0x30cb('0x3b')](_0x19e28b[_0x30cb('0x38')],{'$or':_[_0x30cb('0x29')](_0x43ec44,function(_0x56bc5e){if(_0x56bc5e['type']!==_0x30cb('0x3c')){var _0x35432b={};_0x35432b[_0x56bc5e['name']]={'$like':'%'+_0x3c266a[_0x30cb('0x2e')][_0x30cb('0x3a')]+'%'};return _0x35432b;}})});}_0x19e28b=_[_0x30cb('0x3b')]({},_0x19e28b,_0x3c266a[_0x30cb('0x3d')]);var _0x5e867b={'where':_0x19e28b[_0x30cb('0x38')]};return db[_0x30cb('0x2a')]['count'](_0x5e867b)[_0x30cb('0x22')](function(_0x3887bd){_0x19f978[_0x30cb('0x1d')]=_0x3887bd;if(_0x3c266a[_0x30cb('0x2e')][_0x30cb('0x3e')]){_0x19e28b['include']=[{'all':!![]}];}return db[_0x30cb('0x2a')]['findAll'](_0x19e28b);})[_0x30cb('0x22')](function(_0xd2615){_0x19f978['rows']=_0xd2615;return _0x19f978;})[_0x30cb('0x22')](respondWithFilteredResult(_0x44e416,_0x19e28b))[_0x30cb('0x3f')](handleError(_0x44e416,null));};exports[_0x30cb('0x40')]=function(_0x44d0cf,_0x1f7fa1){var _0x5e22ab={'raw':!![],'where':{'id':_0x44d0cf['params']['id']}},_0x7cf839={};_0x7cf839[_0x30cb('0x2d')]=_['keys'](db[_0x30cb('0x2a')][_0x30cb('0x41')]);_0x7cf839[_0x30cb('0x2e')]=_[_0x30cb('0x2f')](_0x44d0cf[_0x30cb('0x2e')]);_0x7cf839['filters']=_[_0x30cb('0x31')](_0x7cf839['model'],_0x7cf839[_0x30cb('0x2e')]);_0x5e22ab[_0x30cb('0x32')]=_[_0x30cb('0x31')](_0x7cf839[_0x30cb('0x2d')],qs[_0x30cb('0x33')](_0x44d0cf['query'][_0x30cb('0x33')]));_0x5e22ab[_0x30cb('0x32')]=_0x5e22ab[_0x30cb('0x32')][_0x30cb('0x34')]?_0x5e22ab[_0x30cb('0x32')]:_0x7cf839[_0x30cb('0x2d')];if(_0x44d0cf['query']['includeAll']){_0x5e22ab[_0x30cb('0x42')]=[{'all':!![]}];}_0x5e22ab=_['merge']({},_0x5e22ab,_0x44d0cf[_0x30cb('0x3d')]);return db[_0x30cb('0x2a')]['find'](_0x5e22ab)[_0x30cb('0x22')](handleEntityNotFound(_0x1f7fa1,null))[_0x30cb('0x22')](respondWithResult(_0x1f7fa1,null))[_0x30cb('0x3f')](handleError(_0x1f7fa1,null));};exports[_0x30cb('0x43')]=function(_0x37e3db,_0x5d80c1){return db['MailServerOut'][_0x30cb('0x43')](_0x37e3db['body'],{})['then'](respondWithResult(_0x5d80c1,0xc9))[_0x30cb('0x3f')](handleError(_0x5d80c1,null));};exports[_0x30cb('0x21')]=function(_0x504ee4,_0x49a4c8){if(_0x504ee4[_0x30cb('0x44')]['id']){delete _0x504ee4[_0x30cb('0x44')]['id'];}return db[_0x30cb('0x2a')][_0x30cb('0x45')]({'where':{'id':_0x504ee4[_0x30cb('0x46')]['id']}})[_0x30cb('0x22')](handleEntityNotFound(_0x49a4c8,null))[_0x30cb('0x22')](saveUpdates(_0x504ee4['body'],null))[_0x30cb('0x22')](respondWithResult(_0x49a4c8,null))[_0x30cb('0x3f')](handleError(_0x49a4c8,null));};exports['destroy']=function(_0x321ae5,_0xb9edd1){return db[_0x30cb('0x2a')]['find']({'where':{'id':_0x321ae5[_0x30cb('0x46')]['id']}})[_0x30cb('0x22')](handleEntityNotFound(_0xb9edd1,null))['then'](removeEntity(_0xb9edd1,null))[_0x30cb('0x3f')](handleError(_0xb9edd1,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index d0584e8..dc727cb 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 _0xdbaf=['moment','bluebird','path','rimraf','./mailServerOut.attributes','exports','define','../../config/logger','api'];(function(_0x2fc76c,_0x564b9b){var _0x22a1d6=function(_0x4689bc){while(--_0x4689bc){_0x2fc76c['push'](_0x2fc76c['shift']());}};_0x22a1d6(++_0x564b9b);}(_0xdbaf,0x11e));var _0xfdba=function(_0x46ee78,_0x56d2f0){_0x46ee78=_0x46ee78-0x0;var _0x19a6a5=_0xdbaf[_0x46ee78];return _0x19a6a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfdba('0x0'))(_0xfdba('0x1'));var moment=require(_0xfdba('0x2'));var BPromise=require(_0xfdba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdba('0x4'));var rimraf=require(_0xfdba('0x5'));var config=require('../../config/environment');var attributes=require(_0xfdba('0x6'));module[_0xfdba('0x7')]=function(_0x98e380,_0x4ed219){return _0x98e380[_0xfdba('0x8')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1a2=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','MailServerOut','mail_servers_out'];(function(_0x5d792b,_0x4a41de){var _0x219de9=function(_0x2e27b8){while(--_0x2e27b8){_0x5d792b['push'](_0x5d792b['shift']());}};_0x219de9(++_0x4a41de);}(_0xd1a2,0x1c8));var _0x2d1a=function(_0x9b503e,_0x1718ee){_0x9b503e=_0x9b503e-0x0;var _0x4e0b68=_0xd1a2[_0x9b503e];return _0x4e0b68;};'use strict';var _=require(_0x2d1a('0x0'));var util=require(_0x2d1a('0x1'));var logger=require('../../config/logger')(_0x2d1a('0x2'));var moment=require(_0x2d1a('0x3'));var BPromise=require(_0x2d1a('0x4'));var rp=require(_0x2d1a('0x5'));var fs=require('fs');var path=require(_0x2d1a('0x6'));var rimraf=require('rimraf');var config=require(_0x2d1a('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x2d1a('0x8')]=function(_0x569e63,_0x534739){return _0x569e63[_0x2d1a('0x9')](_0x2d1a('0xa'),attributes,{'tableName':_0x2d1a('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 db0c292..a3b09bc 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(_0x54342d,_0x50b787){var _0x5b8d7f=function(_0x54322f){while(--_0x54322f){_0x54342d['push'](_0x54342d['shift']());}};_0x5b8d7f(++_0x50b787);}(_0x1261,0x144));var _0x1126=function(_0x3bae28,_0x5ca4f5){_0x3bae28=_0x3bae28-0x0;var _0xb431b=_0x1261[_0x3bae28];return _0xb431b;};'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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x21721f,_0x1e5d13){var _0x59494a=function(_0x4464e2){while(--_0x4464e2){_0x21721f['push'](_0x21721f['shift']());}};_0x59494a(++_0x1e5d13);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1fc7aa,_0x1b6aae){_0x1fc7aa=_0x1fc7aa-0x0;var _0x2aabae=_0x5f2f[_0x1fc7aa];return _0x2aabae;};'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')]('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 4c8a09a..54cb8b2 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 _0xefcd=['./mailSubstatus.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x591d93,_0x234770){var _0x46312a=function(_0x1df1f7){while(--_0x1df1f7){_0x591d93['push'](_0x591d93['shift']());}};_0x46312a(++_0x234770);}(_0xefcd,0x1f1));var _0xdefc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xefcd[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xdefc('0x0'));var util=require(_0xdefc('0x1'));var path=require(_0xdefc('0x2'));var timeout=require('connect-timeout');var express=require(_0xdefc('0x3'));var router=express[_0xdefc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdefc('0x5'));var interaction=require(_0xdefc('0x6'));var config=require('../../config/environment');var controller=require(_0xdefc('0x7'));router['get']('/',auth[_0xdefc('0x8')](),controller[_0xdefc('0x9')]);router[_0xdefc('0xa')](_0xdefc('0xb'),auth['isAuthenticated'](),controller[_0xdefc('0xc')]);router[_0xdefc('0xa')]('/:id',auth[_0xdefc('0x8')](),controller[_0xdefc('0xd')]);router[_0xdefc('0xe')]('/',auth['isAuthenticated'](),controller[_0xdefc('0xf')]);router[_0xdefc('0x10')](_0xdefc('0x11'),auth['isAuthenticated'](),controller[_0xdefc('0x12')]);router[_0xdefc('0x13')](_0xdefc('0x11'),auth[_0xdefc('0x8')](),controller[_0xdefc('0x14')]);module['exports']=router; \ No newline at end of file +var _0xea24=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','multer','util'];(function(_0x5460df,_0x33d87b){var _0x246990=function(_0x39d846){while(--_0x39d846){_0x5460df['push'](_0x5460df['shift']());}};_0x246990(++_0x33d87b);}(_0xea24,0x12e));var _0x4ea2=function(_0x371993,_0x429fc1){_0x371993=_0x371993-0x0;var _0x540e4a=_0xea24[_0x371993];return _0x540e4a;};'use strict';var multer=require(_0x4ea2('0x0'));var util=require(_0x4ea2('0x1'));var path=require(_0x4ea2('0x2'));var timeout=require(_0x4ea2('0x3'));var express=require(_0x4ea2('0x4'));var router=express[_0x4ea2('0x5')]();var fs_extra=require(_0x4ea2('0x6'));var auth=require(_0x4ea2('0x7'));var interaction=require(_0x4ea2('0x8'));var config=require('../../config/environment');var controller=require(_0x4ea2('0x9'));router[_0x4ea2('0xa')]('/',auth[_0x4ea2('0xb')](),controller[_0x4ea2('0xc')]);router[_0x4ea2('0xa')](_0x4ea2('0xd'),auth[_0x4ea2('0xb')](),controller['describe']);router[_0x4ea2('0xa')](_0x4ea2('0xe'),auth[_0x4ea2('0xb')](),controller[_0x4ea2('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4ea2('0x10')]);router[_0x4ea2('0x11')](_0x4ea2('0xe'),auth['isAuthenticated'](),controller[_0x4ea2('0x12')]);router['delete'](_0x4ea2('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 79f7cb2..90f58a2 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 _0xa23f=['STRING','sequelize','exports'];(function(_0x3634ac,_0x1733e7){var _0x48e212=function(_0x5848e0){while(--_0x5848e0){_0x3634ac['push'](_0x3634ac['shift']());}};_0x48e212(++_0x1733e7);}(_0xa23f,0x7c));var _0xfa23=function(_0x54fa98,_0x262fe2){_0x54fa98=_0x54fa98-0x0;var _0x26a3b6=_0xa23f[_0x54fa98];return _0x26a3b6;};'use strict';var Sequelize=require(_0xfa23('0x0'));module[_0xfa23('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfa23('0x2')]}}; \ No newline at end of file +var _0xfc17=['sequelize','exports','STRING','name'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x5d41d4,_0x1e1722){_0x5d41d4=_0x5d41d4-0x0;var _0x79e9ea=_0xfc17[_0x5d41d4];return _0x79e9ea;};'use strict';var Sequelize=require(_0x7fc1('0x0'));module[_0x7fc1('0x1')]={'name':{'type':Sequelize[_0x7fc1('0x2')],'unique':_0x7fc1('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 84a1f67..7c73d44 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 _0x4b75=['request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','MailSubstatus','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0x4b75,0x16a));var _0x54b7=function(_0x4258c5,_0x3e0e0f){_0x4258c5=_0x4258c5-0x0;var _0x23f528=_0x4b75[_0x4258c5];return _0x23f528;};'use strict';var emlformat=require(_0x54b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x54b7('0x1'));var jsonpatch=require(_0x54b7('0x2'));var rp=require(_0x54b7('0x3'));var moment=require(_0x54b7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x54b7('0x5'));var util=require(_0x54b7('0x6'));var path=require(_0x54b7('0x7'));var sox=require('sox');var csv=require(_0x54b7('0x8'));var ejs=require(_0x54b7('0x9'));var fs=require('fs');var fs_extra=require(_0x54b7('0xa'));var _=require(_0x54b7('0xb'));var squel=require(_0x54b7('0xc'));var crypto=require(_0x54b7('0xd'));var jsforce=require(_0x54b7('0xe'));var deskjs=require(_0x54b7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x54b7('0x10'));var Papa=require(_0x54b7('0x11'));var Redis=require(_0x54b7('0x12'));var authService=require(_0x54b7('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54b7('0x14'));var logger=require(_0x54b7('0x15'))(_0x54b7('0x16'));var utils=require(_0x54b7('0x17'));var config=require(_0x54b7('0x18'));var licenseUtil=require(_0x54b7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x75395d,_0x1f83f9){_0x1f83f9=_0x1f83f9||0xcc;return function(_0x5a5875){if(_0x5a5875){return _0x75395d['sendStatus'](_0x1f83f9);}return _0x75395d[_0x54b7('0x1a')](_0x1f83f9)[_0x54b7('0x1b')]();};}function respondWithResult(_0x122048,_0x33808f){_0x33808f=_0x33808f||0xc8;return function(_0xa37bf7){if(_0xa37bf7){return _0x122048[_0x54b7('0x1a')](_0x33808f)[_0x54b7('0x1c')](_0xa37bf7);}};}function respondWithFilteredResult(_0x638216,_0x3ff913){return function(_0x328ce9){if(_0x328ce9){var _0x12de65=typeof _0x3ff913[_0x54b7('0x1d')]==='undefined'&&typeof _0x3ff913[_0x54b7('0x1e')]==='undefined';var _0x491633=_0x328ce9[_0x54b7('0x1f')];var _0x2d885c=_0x12de65?0x0:_0x3ff913[_0x54b7('0x1d')];var _0x2c17c5=_0x12de65?_0x328ce9[_0x54b7('0x1f')]:_0x3ff913['offset']+_0x3ff913['limit'];var _0x44e432;if(_0x2c17c5>=_0x491633){_0x2c17c5=_0x491633;_0x44e432=0xc8;}else{_0x44e432=0xce;}_0x638216['status'](_0x44e432);return _0x638216[_0x54b7('0x20')](_0x54b7('0x21'),_0x2d885c+'-'+_0x2c17c5+'/'+_0x491633)['json'](_0x328ce9);}return null;};}function patchUpdates(_0x18c4d4){return function(_0x20f86b){try{jsonpatch[_0x54b7('0x22')](_0x20f86b,_0x18c4d4,!![]);}catch(_0x19dca){return BPromise[_0x54b7('0x23')](_0x19dca);}return _0x20f86b[_0x54b7('0x24')]();};}function saveUpdates(_0xdcce42,_0x5316c1){return function(_0x18f806){if(_0x18f806){return _0x18f806[_0x54b7('0x25')](_0xdcce42)[_0x54b7('0x26')](function(_0x1427a9){return _0x1427a9;});}return null;};}function removeEntity(_0x20204b,_0x3ac5c0){return function(_0x1b3aaf){if(_0x1b3aaf){return _0x1b3aaf['destroy']()[_0x54b7('0x26')](function(){_0x20204b[_0x54b7('0x1a')](0xcc)[_0x54b7('0x1b')]();});}};}function handleEntityNotFound(_0xececf1,_0x42f8f3){return function(_0x14e3b4){if(!_0x14e3b4){_0xececf1['sendStatus'](0x194);}return _0x14e3b4;};}function handleError(_0x55e283,_0x409d2d){_0x409d2d=_0x409d2d||0x1f4;return function(_0x10c763){logger['error'](_0x10c763[_0x54b7('0x27')]);if(_0x10c763[_0x54b7('0x28')]){delete _0x10c763[_0x54b7('0x28')];}_0x55e283[_0x54b7('0x1a')](_0x409d2d)['send'](_0x10c763);};}exports[_0x54b7('0x29')]=function(_0x5e8e15,_0x3b0898){var _0x2ed633={},_0x8aeaaa={},_0x54e2fa={'count':0x0,'rows':[]};var _0x38d2a0=_[_0x54b7('0x2a')](db[_0x54b7('0x2b')][_0x54b7('0x2c')],function(_0x1658ab){return{'name':_0x1658ab['fieldName'],'type':_0x1658ab['type']['key']};});_0x8aeaaa[_0x54b7('0x2d')]=_['map'](_0x38d2a0,_0x54b7('0x28'));_0x8aeaaa[_0x54b7('0x2e')]=_['keys'](_0x5e8e15[_0x54b7('0x2e')]);_0x8aeaaa[_0x54b7('0x2f')]=_['intersection'](_0x8aeaaa['model'],_0x8aeaaa[_0x54b7('0x2e')]);_0x2ed633['attributes']=_[_0x54b7('0x30')](_0x8aeaaa[_0x54b7('0x2d')],qs['fields'](_0x5e8e15[_0x54b7('0x2e')][_0x54b7('0x31')]));_0x2ed633[_0x54b7('0x32')]=_0x2ed633[_0x54b7('0x32')][_0x54b7('0x33')]?_0x2ed633['attributes']:_0x8aeaaa[_0x54b7('0x2d')];if(!_0x5e8e15[_0x54b7('0x2e')][_0x54b7('0x34')](_0x54b7('0x35'))){_0x2ed633[_0x54b7('0x1e')]=qs[_0x54b7('0x1e')](_0x5e8e15['query'][_0x54b7('0x1e')]);_0x2ed633[_0x54b7('0x1d')]=qs[_0x54b7('0x1d')](_0x5e8e15[_0x54b7('0x2e')][_0x54b7('0x1d')]);}_0x2ed633[_0x54b7('0x36')]=qs[_0x54b7('0x37')](_0x5e8e15['query'][_0x54b7('0x37')]);_0x2ed633[_0x54b7('0x38')]=qs[_0x54b7('0x2f')](_['pick'](_0x5e8e15[_0x54b7('0x2e')],_0x8aeaaa[_0x54b7('0x2f')]),_0x38d2a0);if(_0x5e8e15[_0x54b7('0x2e')][_0x54b7('0x39')]){_0x2ed633['where']=_[_0x54b7('0x3a')](_0x2ed633[_0x54b7('0x38')],{'$or':_[_0x54b7('0x2a')](_0x38d2a0,function(_0x320862){if(_0x320862[_0x54b7('0x3b')]!==_0x54b7('0x3c')){var _0x2b709c={};_0x2b709c[_0x320862[_0x54b7('0x28')]]={'$like':'%'+_0x5e8e15[_0x54b7('0x2e')][_0x54b7('0x39')]+'%'};return _0x2b709c;}})});}_0x2ed633=_['merge']({},_0x2ed633,_0x5e8e15['options']);var _0x1ff8d8={'where':_0x2ed633[_0x54b7('0x38')]};return db[_0x54b7('0x2b')]['count'](_0x1ff8d8)['then'](function(_0x458eeb){_0x54e2fa[_0x54b7('0x1f')]=_0x458eeb;if(_0x5e8e15[_0x54b7('0x2e')][_0x54b7('0x3d')]){_0x2ed633[_0x54b7('0x3e')]=[{'all':!![]}];}return db[_0x54b7('0x2b')][_0x54b7('0x3f')](_0x2ed633);})[_0x54b7('0x26')](function(_0x4973a3){_0x54e2fa[_0x54b7('0x40')]=_0x4973a3;return _0x54e2fa;})[_0x54b7('0x26')](respondWithFilteredResult(_0x3b0898,_0x2ed633))[_0x54b7('0x41')](handleError(_0x3b0898,null));};exports['show']=function(_0x153cb6,_0x4a152b){var _0x2f7d8d={'raw':!![],'where':{'id':_0x153cb6[_0x54b7('0x42')]['id']}},_0x43a9fe={};_0x43a9fe[_0x54b7('0x2d')]=_[_0x54b7('0x43')](db[_0x54b7('0x2b')][_0x54b7('0x2c')]);_0x43a9fe[_0x54b7('0x2e')]=_['keys'](_0x153cb6[_0x54b7('0x2e')]);_0x43a9fe['filters']=_[_0x54b7('0x30')](_0x43a9fe[_0x54b7('0x2d')],_0x43a9fe[_0x54b7('0x2e')]);_0x2f7d8d[_0x54b7('0x32')]=_[_0x54b7('0x30')](_0x43a9fe[_0x54b7('0x2d')],qs[_0x54b7('0x31')](_0x153cb6['query'][_0x54b7('0x31')]));_0x2f7d8d[_0x54b7('0x32')]=_0x2f7d8d['attributes'][_0x54b7('0x33')]?_0x2f7d8d[_0x54b7('0x32')]:_0x43a9fe[_0x54b7('0x2d')];if(_0x153cb6['query'][_0x54b7('0x3d')]){_0x2f7d8d[_0x54b7('0x3e')]=[{'all':!![]}];}_0x2f7d8d=_[_0x54b7('0x3a')]({},_0x2f7d8d,_0x153cb6['options']);return db[_0x54b7('0x2b')][_0x54b7('0x44')](_0x2f7d8d)[_0x54b7('0x26')](handleEntityNotFound(_0x4a152b,null))[_0x54b7('0x26')](respondWithResult(_0x4a152b,null))[_0x54b7('0x41')](handleError(_0x4a152b,null));};exports[_0x54b7('0x45')]=function(_0x567f76,_0x9fce5c){return db[_0x54b7('0x2b')][_0x54b7('0x45')](_0x567f76[_0x54b7('0x46')],{})[_0x54b7('0x26')](respondWithResult(_0x9fce5c,0xc9))[_0x54b7('0x41')](handleError(_0x9fce5c,null));};exports['update']=function(_0x28fa06,_0x13448b){if(_0x28fa06[_0x54b7('0x46')]['id']){delete _0x28fa06[_0x54b7('0x46')]['id'];}return db[_0x54b7('0x2b')][_0x54b7('0x44')]({'where':{'id':_0x28fa06[_0x54b7('0x42')]['id']}})['then'](handleEntityNotFound(_0x13448b,null))[_0x54b7('0x26')](saveUpdates(_0x28fa06[_0x54b7('0x46')],null))[_0x54b7('0x26')](respondWithResult(_0x13448b,null))['catch'](handleError(_0x13448b,null));};exports[_0x54b7('0x47')]=function(_0x49487f,_0x1ffe8e){return db[_0x54b7('0x2b')][_0x54b7('0x44')]({'where':{'id':_0x49487f[_0x54b7('0x42')]['id']}})[_0x54b7('0x26')](handleEntityNotFound(_0x1ffe8e,null))['then'](removeEntity(_0x1ffe8e,null))[_0x54b7('0x41')](handleError(_0x1ffe8e,null));};exports[_0x54b7('0x48')]=function(_0x566b9f,_0x57e25d){return db[_0x54b7('0x2b')][_0x54b7('0x48')]()['then'](respondWithResult(_0x57e25d,null))['catch'](handleError(_0x57e25d,null));}; \ No newline at end of file +var _0xabe5=['show','includeAll','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x1862d6,_0x2756dd){var _0x4cf2de=function(_0x22f4ea){while(--_0x22f4ea){_0x1862d6['push'](_0x1862d6['shift']());}};_0x4cf2de(++_0x2756dd);}(_0xabe5,0x1c3));var _0x5abe=function(_0x243c86,_0xccc38c){_0x243c86=_0x243c86-0x0;var _0x13ef3c=_0xabe5[_0x243c86];return _0x13ef3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5abe('0x0'));var zipdir=require(_0x5abe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5abe('0x2'));var moment=require(_0x5abe('0x3'));var BPromise=require(_0x5abe('0x4'));var Mustache=require(_0x5abe('0x5'));var util=require(_0x5abe('0x6'));var path=require(_0x5abe('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5abe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5abe('0x9'));var crypto=require(_0x5abe('0xa'));var jsforce=require(_0x5abe('0xb'));var deskjs=require(_0x5abe('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5abe('0xd'));var Papa=require('papaparse');var Redis=require(_0x5abe('0xe'));var authService=require(_0x5abe('0xf'));var qs=require(_0x5abe('0x10'));var as=require(_0x5abe('0x11'));var hardwareService=require(_0x5abe('0x12'));var logger=require('../../config/logger')(_0x5abe('0x13'));var utils=require(_0x5abe('0x14'));var config=require(_0x5abe('0x15'));var licenseUtil=require(_0x5abe('0x16'));var db=require(_0x5abe('0x17'))['db'];function respondWithStatusCode(_0x5acc27,_0x4310fb){_0x4310fb=_0x4310fb||0xcc;return function(_0x526ac6){if(_0x526ac6){return _0x5acc27['sendStatus'](_0x4310fb);}return _0x5acc27['status'](_0x4310fb)[_0x5abe('0x18')]();};}function respondWithResult(_0x5960dc,_0x467951){_0x467951=_0x467951||0xc8;return function(_0x1f6940){if(_0x1f6940){return _0x5960dc[_0x5abe('0x19')](_0x467951)[_0x5abe('0x1a')](_0x1f6940);}};}function respondWithFilteredResult(_0x2d072b,_0x42bc5f){return function(_0x42697d){if(_0x42697d){var _0x361dfe=typeof _0x42bc5f[_0x5abe('0x1b')]===_0x5abe('0x1c')&&typeof _0x42bc5f['limit']===_0x5abe('0x1c');var _0x1e2886=_0x42697d[_0x5abe('0x1d')];var _0x44b1e0=_0x361dfe?0x0:_0x42bc5f[_0x5abe('0x1b')];var _0x479063=_0x361dfe?_0x42697d[_0x5abe('0x1d')]:_0x42bc5f['offset']+_0x42bc5f[_0x5abe('0x1e')];var _0xc58ac4;if(_0x479063>=_0x1e2886){_0x479063=_0x1e2886;_0xc58ac4=0xc8;}else{_0xc58ac4=0xce;}_0x2d072b[_0x5abe('0x19')](_0xc58ac4);return _0x2d072b[_0x5abe('0x1f')](_0x5abe('0x20'),_0x44b1e0+'-'+_0x479063+'/'+_0x1e2886)[_0x5abe('0x1a')](_0x42697d);}return null;};}function patchUpdates(_0xd01040){return function(_0x1a428c){try{jsonpatch[_0x5abe('0x21')](_0x1a428c,_0xd01040,!![]);}catch(_0x5eb676){return BPromise[_0x5abe('0x22')](_0x5eb676);}return _0x1a428c[_0x5abe('0x23')]();};}function saveUpdates(_0x27edc7,_0x1530cd){return function(_0x1708d3){if(_0x1708d3){return _0x1708d3[_0x5abe('0x24')](_0x27edc7)[_0x5abe('0x25')](function(_0xadc24b){return _0xadc24b;});}return null;};}function removeEntity(_0x5a03c4,_0x78229b){return function(_0x665493){if(_0x665493){return _0x665493[_0x5abe('0x26')]()[_0x5abe('0x25')](function(){_0x5a03c4[_0x5abe('0x19')](0xcc)[_0x5abe('0x18')]();});}};}function handleEntityNotFound(_0x153ec2,_0x1403cc){return function(_0x35daa5){if(!_0x35daa5){_0x153ec2['sendStatus'](0x194);}return _0x35daa5;};}function handleError(_0x362833,_0x265400){_0x265400=_0x265400||0x1f4;return function(_0xcdae36){logger[_0x5abe('0x27')](_0xcdae36[_0x5abe('0x28')]);if(_0xcdae36['name']){delete _0xcdae36[_0x5abe('0x29')];}_0x362833['status'](_0x265400)[_0x5abe('0x2a')](_0xcdae36);};}exports[_0x5abe('0x2b')]=function(_0x5f3248,_0x3fc08){var _0x242584={},_0x4e25a9={},_0x3019a7={'count':0x0,'rows':[]};var _0x4476c6=_[_0x5abe('0x2c')](db[_0x5abe('0x2d')][_0x5abe('0x2e')],function(_0x401a6e){return{'name':_0x401a6e['fieldName'],'type':_0x401a6e[_0x5abe('0x2f')][_0x5abe('0x30')]};});_0x4e25a9[_0x5abe('0x31')]=_['map'](_0x4476c6,_0x5abe('0x29'));_0x4e25a9[_0x5abe('0x32')]=_[_0x5abe('0x33')](_0x5f3248[_0x5abe('0x32')]);_0x4e25a9[_0x5abe('0x34')]=_[_0x5abe('0x35')](_0x4e25a9[_0x5abe('0x31')],_0x4e25a9['query']);_0x242584[_0x5abe('0x36')]=_['intersection'](_0x4e25a9[_0x5abe('0x31')],qs[_0x5abe('0x37')](_0x5f3248[_0x5abe('0x32')][_0x5abe('0x37')]));_0x242584[_0x5abe('0x36')]=_0x242584[_0x5abe('0x36')]['length']?_0x242584[_0x5abe('0x36')]:_0x4e25a9[_0x5abe('0x31')];if(!_0x5f3248[_0x5abe('0x32')][_0x5abe('0x38')]('nolimit')){_0x242584[_0x5abe('0x1e')]=qs[_0x5abe('0x1e')](_0x5f3248[_0x5abe('0x32')][_0x5abe('0x1e')]);_0x242584[_0x5abe('0x1b')]=qs[_0x5abe('0x1b')](_0x5f3248[_0x5abe('0x32')][_0x5abe('0x1b')]);}_0x242584[_0x5abe('0x39')]=qs['sort'](_0x5f3248['query']['sort']);_0x242584['where']=qs['filters'](_['pick'](_0x5f3248[_0x5abe('0x32')],_0x4e25a9['filters']),_0x4476c6);if(_0x5f3248['query'][_0x5abe('0x3a')]){_0x242584['where']=_[_0x5abe('0x3b')](_0x242584[_0x5abe('0x3c')],{'$or':_['map'](_0x4476c6,function(_0x27fcb2){if(_0x27fcb2[_0x5abe('0x2f')]!==_0x5abe('0x3d')){var _0x551174={};_0x551174[_0x27fcb2['name']]={'$like':'%'+_0x5f3248[_0x5abe('0x32')]['filter']+'%'};return _0x551174;}})});}_0x242584=_[_0x5abe('0x3b')]({},_0x242584,_0x5f3248[_0x5abe('0x3e')]);var _0x4932ba={'where':_0x242584[_0x5abe('0x3c')]};return db[_0x5abe('0x2d')][_0x5abe('0x1d')](_0x4932ba)['then'](function(_0x5967be){_0x3019a7[_0x5abe('0x1d')]=_0x5967be;if(_0x5f3248[_0x5abe('0x32')]['includeAll']){_0x242584[_0x5abe('0x3f')]=[{'all':!![]}];}return db['MailSubstatus'][_0x5abe('0x40')](_0x242584);})[_0x5abe('0x25')](function(_0x3e029d){_0x3019a7[_0x5abe('0x41')]=_0x3e029d;return _0x3019a7;})[_0x5abe('0x25')](respondWithFilteredResult(_0x3fc08,_0x242584))[_0x5abe('0x42')](handleError(_0x3fc08,null));};exports[_0x5abe('0x43')]=function(_0x85facd,_0x4669fa){var _0x11b755={'raw':!![],'where':{'id':_0x85facd['params']['id']}},_0x2b1ec8={};_0x2b1ec8['model']=_[_0x5abe('0x33')](db[_0x5abe('0x2d')][_0x5abe('0x2e')]);_0x2b1ec8[_0x5abe('0x32')]=_[_0x5abe('0x33')](_0x85facd[_0x5abe('0x32')]);_0x2b1ec8['filters']=_[_0x5abe('0x35')](_0x2b1ec8['model'],_0x2b1ec8[_0x5abe('0x32')]);_0x11b755[_0x5abe('0x36')]=_[_0x5abe('0x35')](_0x2b1ec8[_0x5abe('0x31')],qs['fields'](_0x85facd[_0x5abe('0x32')][_0x5abe('0x37')]));_0x11b755[_0x5abe('0x36')]=_0x11b755[_0x5abe('0x36')]['length']?_0x11b755[_0x5abe('0x36')]:_0x2b1ec8['model'];if(_0x85facd[_0x5abe('0x32')][_0x5abe('0x44')]){_0x11b755['include']=[{'all':!![]}];}_0x11b755=_[_0x5abe('0x3b')]({},_0x11b755,_0x85facd[_0x5abe('0x3e')]);return db[_0x5abe('0x2d')][_0x5abe('0x45')](_0x11b755)['then'](handleEntityNotFound(_0x4669fa,null))['then'](respondWithResult(_0x4669fa,null))[_0x5abe('0x42')](handleError(_0x4669fa,null));};exports[_0x5abe('0x46')]=function(_0x459e0a,_0x1be986){return db[_0x5abe('0x2d')][_0x5abe('0x46')](_0x459e0a[_0x5abe('0x47')],{})[_0x5abe('0x25')](respondWithResult(_0x1be986,0xc9))[_0x5abe('0x42')](handleError(_0x1be986,null));};exports['update']=function(_0x4fd48f,_0x2098ec){if(_0x4fd48f[_0x5abe('0x47')]['id']){delete _0x4fd48f[_0x5abe('0x47')]['id'];}return db[_0x5abe('0x2d')]['find']({'where':{'id':_0x4fd48f['params']['id']}})['then'](handleEntityNotFound(_0x2098ec,null))[_0x5abe('0x25')](saveUpdates(_0x4fd48f['body'],null))[_0x5abe('0x25')](respondWithResult(_0x2098ec,null))[_0x5abe('0x42')](handleError(_0x2098ec,null));};exports[_0x5abe('0x26')]=function(_0xd90109,_0x3a4deb){return db[_0x5abe('0x2d')][_0x5abe('0x45')]({'where':{'id':_0xd90109[_0x5abe('0x48')]['id']}})[_0x5abe('0x25')](handleEntityNotFound(_0x3a4deb,null))[_0x5abe('0x25')](removeEntity(_0x3a4deb,null))[_0x5abe('0x42')](handleError(_0x3a4deb,null));};exports[_0x5abe('0x49')]=function(_0x298fee,_0x571477){return db[_0x5abe('0x2d')]['describe']()[_0x5abe('0x25')](respondWithResult(_0x571477,null))[_0x5abe('0x42')](handleError(_0x571477,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index d391cb6..20f742c 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9b96=['hook','exports','../../mysqldb','MailSubstatus','emit'];(function(_0x2d642d,_0x35b9e3){var _0x1a0cfd=function(_0x3a9ad1){while(--_0x3a9ad1){_0x2d642d['push'](_0x2d642d['shift']());}};_0x1a0cfd(++_0x35b9e3);}(_0x9b96,0xa7));var _0x69b9=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9b96[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x69b9('0x0'))['db'][_0x69b9('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x4aa531){return function(_0x7fad0e,_0x3fc293,_0x38ac6f){MailSubstatusEvents[_0x69b9('0x2')](_0x4aa531+':'+_0x7fad0e['id'],_0x7fad0e);MailSubstatusEvents[_0x69b9('0x2')](_0x4aa531,_0x7fad0e);_0x38ac6f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x69b9('0x3')](e,emitEvent(event));}}module[_0x69b9('0x4')]=MailSubstatusEvents; \ No newline at end of file +var _0xf235=['setMaxListeners','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0xf235,0x95));var _0x5f23=function(_0x21384d,_0xca16){_0x21384d=_0x21384d-0x0;var _0x118772=_0xf235[_0x21384d];return _0x118772;};'use strict';var EventEmitter=require(_0x5f23('0x0'));var MailSubstatus=require(_0x5f23('0x1'))['db'][_0x5f23('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x5f23('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x9a6c24){return function(_0x2c3ae7,_0x6eb046,_0x2188f0){MailSubstatusEvents[_0x5f23('0x4')](_0x9a6c24+':'+_0x2c3ae7['id'],_0x2c3ae7);MailSubstatusEvents[_0x5f23('0x4')](_0x9a6c24,_0x2c3ae7);_0x2188f0(null);};}for(var e in events){if(events[_0x5f23('0x5')](e)){var event=events[e];MailSubstatus[_0x5f23('0x6')](e,emitEvent(event));}}module[_0x5f23('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 95fb0fd..bd9f3fe 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 _0x4eb3=['MailSubstatus','mail_substatuses','Condition','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','models','define'];(function(_0x436849,_0x430b00){var _0x5c5f73=function(_0x5bdf78){while(--_0x5bdf78){_0x436849['push'](_0x436849['shift']());}};_0x5c5f73(++_0x430b00);}(_0x4eb3,0x101));var _0x34eb=function(_0x1e4d7e,_0x45e3ba){_0x1e4d7e=_0x1e4d7e-0x0;var _0x275eb3=_0x4eb3[_0x1e4d7e];return _0x275eb3;};'use strict';var attributes=require(_0x34eb('0x0'));module['exports']=function(_0x1a3af4){var _0x275e45=_0x1a3af4[_0x34eb('0x1')];return _0x1a3af4[_0x34eb('0x2')](_0x34eb('0x3'),attributes,{'tableName':_0x34eb('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x192a02,_0x14d9cd,_0x4b15c5){return _0x275e45[_0x34eb('0x5')]['update']({'value':_0x192a02['name']},{'where':{'field':_0x34eb('0x6'),'value':_0x192a02[_0x34eb('0x7')]['name']}})[_0x34eb('0x8')](function(){_0x4b15c5();})[_0x34eb('0x9')](function(_0x303781){_0x4b15c5(_0x303781);});}}});}; \ No newline at end of file +var _0x66e8=['models','define','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','./mailSubstatus.attributes','exports'];(function(_0x5bc10d,_0x4f4e24){var _0x4d1a99=function(_0x3ec69a){while(--_0x3ec69a){_0x5bc10d['push'](_0x5bc10d['shift']());}};_0x4d1a99(++_0x4f4e24);}(_0x66e8,0xc4));var _0x866e=function(_0x5d38fb,_0x48ace2){_0x5d38fb=_0x5d38fb-0x0;var _0x2101cd=_0x66e8[_0x5d38fb];return _0x2101cd;};'use strict';var attributes=require(_0x866e('0x0'));module[_0x866e('0x1')]=function(_0xf3ad0c){var _0x37f62c=_0xf3ad0c[_0x866e('0x2')];return _0xf3ad0c[_0x866e('0x3')](_0x866e('0x4'),attributes,{'tableName':_0x866e('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xdc9e7d,_0x514552,_0x10d29d){return _0x37f62c[_0x866e('0x6')][_0x866e('0x7')]({'value':_0xdc9e7d[_0x866e('0x8')]},{'where':{'field':_0x866e('0x9'),'value':_0xdc9e7d[_0x866e('0xa')][_0x866e('0x8')]}})['then'](function(){_0x10d29d();})['catch'](function(_0x4e9324){_0x10d29d(_0x4e9324);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 8ad518c..dd641de 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 _0xc7a4=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0xc7a4,0x1df));var _0x4c7a=function(_0x492958,_0x5b33dc){_0x492958=_0x492958-0x0;var _0x16c5cf=_0xc7a4[_0x492958];return _0x16c5cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4c7a('0x0'));var rs=require(_0x4c7a('0x1'));var fs=require('fs');var Redis=require(_0x4c7a('0x2'));var db=require(_0x4c7a('0x3'))['db'];var utils=require(_0x4c7a('0x4'));var logger=require(_0x4c7a('0x5'))(_0x4c7a('0x6'));var config=require(_0x4c7a('0x7'));var jayson=require(_0x4c7a('0x8'));var client=jayson[_0x4c7a('0x9')][_0x4c7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x400caf,_0x14d7fd,_0x56ae0d){return new BPromise(function(_0x44938d,_0x429af5){return client[_0x4c7a('0xb')](_0x400caf,_0x56ae0d)['then'](function(_0x3a2273){logger['info'](_0x4c7a('0xc'),_0x14d7fd,'request\x20sent');logger[_0x4c7a('0xd')](_0x4c7a('0xe'),_0x14d7fd,_0x4c7a('0xf'),JSON['stringify'](_0x3a2273));if(_0x3a2273[_0x4c7a('0x10')]){if(_0x3a2273[_0x4c7a('0x10')]['code']===0x1f4){logger[_0x4c7a('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x14d7fd,_0x3a2273['error'][_0x4c7a('0x11')]);return _0x429af5(_0x3a2273['error'][_0x4c7a('0x11')]);}logger[_0x4c7a('0x10')](_0x4c7a('0xc'),_0x14d7fd,_0x3a2273[_0x4c7a('0x10')][_0x4c7a('0x11')]);return _0x44938d(_0x3a2273[_0x4c7a('0x10')][_0x4c7a('0x11')]);}else{logger[_0x4c7a('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x14d7fd,_0x4c7a('0xf'));_0x44938d(_0x3a2273[_0x4c7a('0x13')][_0x4c7a('0x11')]);}})[_0x4c7a('0x14')](function(_0x319673){logger['error'](_0x4c7a('0xc'),_0x14d7fd,_0x319673);_0x429af5(_0x319673);});});} \ No newline at end of file +var _0xb9bc=['code','MailSubstatus,\x20%s,\x20%s','message','info','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x10d315,_0x5442ac){var _0x172ae4=function(_0x443042){while(--_0x443042){_0x10d315['push'](_0x10d315['shift']());}};_0x172ae4(++_0x5442ac);}(_0xb9bc,0x144));var _0xcb9b=function(_0x1c4409,_0x3b2e8f){_0x1c4409=_0x1c4409-0x0;var _0x356d8f=_0xb9bc[_0x1c4409];return _0x356d8f;};'use strict';var _=require(_0xcb9b('0x0'));var util=require(_0xcb9b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb9b('0x2'));var fs=require('fs');var Redis=require(_0xcb9b('0x3'));var db=require(_0xcb9b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb9b('0x5'))(_0xcb9b('0x6'));var config=require('../../config/environment');var jayson=require(_0xcb9b('0x7'));var client=jayson[_0xcb9b('0x8')][_0xcb9b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x260760,_0x50a344,_0x476e11){return new BPromise(function(_0x388177,_0x482c34){return client[_0xcb9b('0xa')](_0x260760,_0x476e11)[_0xcb9b('0xb')](function(_0x20af9c){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x50a344,'request\x20sent');logger[_0xcb9b('0xc')](_0xcb9b('0xd'),_0x50a344,'request\x20sent',JSON[_0xcb9b('0xe')](_0x20af9c));if(_0x20af9c[_0xcb9b('0xf')]){if(_0x20af9c['error'][_0xcb9b('0x10')]===0x1f4){logger[_0xcb9b('0xf')](_0xcb9b('0x11'),_0x50a344,_0x20af9c[_0xcb9b('0xf')][_0xcb9b('0x12')]);return _0x482c34(_0x20af9c[_0xcb9b('0xf')]['message']);}logger[_0xcb9b('0xf')](_0xcb9b('0x11'),_0x50a344,_0x20af9c[_0xcb9b('0xf')][_0xcb9b('0x12')]);return _0x388177(_0x20af9c[_0xcb9b('0xf')][_0xcb9b('0x12')]);}else{logger[_0xcb9b('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x50a344,'request\x20sent');_0x388177(_0x20af9c['result'][_0xcb9b('0x12')]);}})['catch'](function(_0x4cb0a2){logger[_0xcb9b('0xf')](_0xcb9b('0x11'),_0x50a344,_0x4cb0a2);_0x482c34(_0x4cb0a2);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index e3ac7a0..fe68e01 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 _0x72f9=['show','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x232cb8,_0x4c0fc9){var _0x47b363=function(_0x60ce06){while(--_0x60ce06){_0x232cb8['push'](_0x232cb8['shift']());}};_0x47b363(++_0x4c0fc9);}(_0x72f9,0x182));var _0x972f=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0x72f9[_0x3f7598];return _0x51fb16;};'use strict';var multer=require(_0x972f('0x0'));var util=require(_0x972f('0x1'));var path=require(_0x972f('0x2'));var timeout=require(_0x972f('0x3'));var express=require('express');var router=express[_0x972f('0x4')]();var fs_extra=require(_0x972f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x972f('0x6'));var controller=require(_0x972f('0x7'));router[_0x972f('0x8')]('/',auth[_0x972f('0x9')](),controller[_0x972f('0xa')]);router['get'](_0x972f('0xb'),auth[_0x972f('0x9')](),controller[_0x972f('0xc')]);router[_0x972f('0x8')](_0x972f('0xd'),auth[_0x972f('0x9')](),controller[_0x972f('0xe')]);router[_0x972f('0xf')]('/',auth[_0x972f('0x9')](),controller[_0x972f('0x10')]);router[_0x972f('0x11')](_0x972f('0xd'),auth[_0x972f('0x9')](),controller[_0x972f('0x12')]);router['delete'](_0x972f('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x972f('0x13')]=router; \ No newline at end of file +var _0xad99=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailTransferReport.controller','get','index','/describe','describe','/:id','show','post','put','isAuthenticated','destroy','exports'];(function(_0x8b7e12,_0xfb25df){var _0x1b2e40=function(_0x5a3a98){while(--_0x5a3a98){_0x8b7e12['push'](_0x8b7e12['shift']());}};_0x1b2e40(++_0xfb25df);}(_0xad99,0x72));var _0x9ad9=function(_0x2b9ace,_0x53e7e2){_0x2b9ace=_0x2b9ace-0x0;var _0x480f81=_0xad99[_0x2b9ace];return _0x480f81;};'use strict';var multer=require(_0x9ad9('0x0'));var util=require('util');var path=require(_0x9ad9('0x1'));var timeout=require(_0x9ad9('0x2'));var express=require(_0x9ad9('0x3'));var router=express[_0x9ad9('0x4')]();var fs_extra=require(_0x9ad9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9ad9('0x6'));var config=require('../../config/environment');var controller=require(_0x9ad9('0x7'));router[_0x9ad9('0x8')]('/',auth['isAuthenticated'](),controller[_0x9ad9('0x9')]);router[_0x9ad9('0x8')](_0x9ad9('0xa'),auth['isAuthenticated'](),controller[_0x9ad9('0xb')]);router['get'](_0x9ad9('0xc'),auth['isAuthenticated'](),controller[_0x9ad9('0xd')]);router[_0x9ad9('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9ad9('0xf')](_0x9ad9('0xc'),auth[_0x9ad9('0x10')](),controller['update']);router['delete'](_0x9ad9('0xc'),auth['isAuthenticated'](),controller[_0x9ad9('0x11')]);module[_0x9ad9('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 3b60a40..97b7993 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(_0x41f6d4,_0x255693){var _0x42a2a9=function(_0x1d0a8){while(--_0x1d0a8){_0x41f6d4['push'](_0x41f6d4['shift']());}};_0x42a2a9(++_0x255693);}(_0x008c,0x188));var _0xc008=function(_0x20b9d5,_0xa6a6cd){_0x20b9d5=_0x20b9d5-0x0;var _0x4d7464=_0x008c[_0x20b9d5];return _0x4d7464;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x255a6e,_0x2be4a8){var _0x1338d2=function(_0x28c3ac){while(--_0x28c3ac){_0x255a6e['push'](_0x255a6e['shift']());}};_0x1338d2(++_0x2be4a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 65945e2..902d3e4 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 _0xc322=['model','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','fields','options','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','type','query','filters','intersection'];(function(_0x47032a,_0x3750d3){var _0x5609ba=function(_0x4428ce){while(--_0x4428ce){_0x47032a['push'](_0x47032a['shift']());}};_0x5609ba(++_0x3750d3);}(_0xc322,0x1b1));var _0x2c32=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xc322[_0x2df507];return _0x1f7167;};'use strict';var emlformat=require(_0x2c32('0x0'));var rimraf=require(_0x2c32('0x1'));var zipdir=require(_0x2c32('0x2'));var jsonpatch=require(_0x2c32('0x3'));var rp=require(_0x2c32('0x4'));var moment=require(_0x2c32('0x5'));var BPromise=require(_0x2c32('0x6'));var Mustache=require(_0x2c32('0x7'));var util=require(_0x2c32('0x8'));var path=require(_0x2c32('0x9'));var sox=require(_0x2c32('0xa'));var csv=require(_0x2c32('0xb'));var ejs=require(_0x2c32('0xc'));var fs=require('fs');var fs_extra=require(_0x2c32('0xd'));var _=require(_0x2c32('0xe'));var squel=require(_0x2c32('0xf'));var crypto=require(_0x2c32('0x10'));var jsforce=require(_0x2c32('0x11'));var deskjs=require(_0x2c32('0x12'));var toCsv=require(_0x2c32('0xb'));var querystring=require(_0x2c32('0x13'));var Papa=require(_0x2c32('0x14'));var Redis=require(_0x2c32('0x15'));var authService=require(_0x2c32('0x16'));var qs=require(_0x2c32('0x17'));var as=require(_0x2c32('0x18'));var hardwareService=require(_0x2c32('0x19'));var logger=require(_0x2c32('0x1a'))(_0x2c32('0x1b'));var utils=require(_0x2c32('0x1c'));var config=require(_0x2c32('0x1d'));var licenseUtil=require(_0x2c32('0x1e'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3617d0,_0x3f5dfb){_0x3f5dfb=_0x3f5dfb||0xcc;return function(_0x1b8ed1){if(_0x1b8ed1){return _0x3617d0[_0x2c32('0x1f')](_0x3f5dfb);}return _0x3617d0[_0x2c32('0x20')](_0x3f5dfb)[_0x2c32('0x21')]();};}function respondWithResult(_0x1cfe70,_0xd8960){_0xd8960=_0xd8960||0xc8;return function(_0x48b87a){if(_0x48b87a){return _0x1cfe70[_0x2c32('0x20')](_0xd8960)[_0x2c32('0x22')](_0x48b87a);}};}function respondWithFilteredResult(_0x5bf727,_0x106a40){return function(_0xab7f0){if(_0xab7f0){var _0x29f2cc=typeof _0x106a40['offset']==='undefined'&&typeof _0x106a40[_0x2c32('0x23')]===_0x2c32('0x24');var _0x45bede=_0xab7f0[_0x2c32('0x25')];var _0x5af0d7=_0x29f2cc?0x0:_0x106a40[_0x2c32('0x26')];var _0x4f786a=_0x29f2cc?_0xab7f0['count']:_0x106a40[_0x2c32('0x26')]+_0x106a40[_0x2c32('0x23')];var _0x4fae88;if(_0x4f786a>=_0x45bede){_0x4f786a=_0x45bede;_0x4fae88=0xc8;}else{_0x4fae88=0xce;}_0x5bf727[_0x2c32('0x20')](_0x4fae88);return _0x5bf727[_0x2c32('0x27')](_0x2c32('0x28'),_0x5af0d7+'-'+_0x4f786a+'/'+_0x45bede)[_0x2c32('0x22')](_0xab7f0);}return null;};}function patchUpdates(_0xb921f7){return function(_0x265a95){try{jsonpatch[_0x2c32('0x29')](_0x265a95,_0xb921f7,!![]);}catch(_0xf125e1){return BPromise[_0x2c32('0x2a')](_0xf125e1);}return _0x265a95[_0x2c32('0x2b')]();};}function saveUpdates(_0x5887b9,_0x34b1e5){return function(_0x237bb9){if(_0x237bb9){return _0x237bb9[_0x2c32('0x2c')](_0x5887b9)[_0x2c32('0x2d')](function(_0x4f3be3){return _0x4f3be3;});}return null;};}function removeEntity(_0x2b905b,_0x19cb07){return function(_0x1c061b){if(_0x1c061b){return _0x1c061b[_0x2c32('0x2e')]()['then'](function(){_0x2b905b[_0x2c32('0x20')](0xcc)[_0x2c32('0x21')]();});}};}function handleEntityNotFound(_0x2ebca8,_0x5dcd43){return function(_0xb3a583){if(!_0xb3a583){_0x2ebca8[_0x2c32('0x1f')](0x194);}return _0xb3a583;};}function handleError(_0x197548,_0x4e4fc4){_0x4e4fc4=_0x4e4fc4||0x1f4;return function(_0x3340d0){logger[_0x2c32('0x2f')](_0x3340d0[_0x2c32('0x30')]);if(_0x3340d0[_0x2c32('0x31')]){delete _0x3340d0[_0x2c32('0x31')];}_0x197548[_0x2c32('0x20')](_0x4e4fc4)[_0x2c32('0x32')](_0x3340d0);};}exports[_0x2c32('0x33')]=function(_0x3275e6,_0x9221f3){var _0x1ed759={},_0x57425e={},_0x2b0d02={'count':0x0,'rows':[]};var _0x335369=_[_0x2c32('0x34')](db[_0x2c32('0x35')][_0x2c32('0x36')],function(_0x44797b){return{'name':_0x44797b['fieldName'],'type':_0x44797b[_0x2c32('0x37')]['key']};});_0x57425e['model']=_[_0x2c32('0x34')](_0x335369,_0x2c32('0x31'));_0x57425e[_0x2c32('0x38')]=_['keys'](_0x3275e6[_0x2c32('0x38')]);_0x57425e[_0x2c32('0x39')]=_[_0x2c32('0x3a')](_0x57425e[_0x2c32('0x3b')],_0x57425e[_0x2c32('0x38')]);_0x1ed759[_0x2c32('0x3c')]=_[_0x2c32('0x3a')](_0x57425e[_0x2c32('0x3b')],qs['fields'](_0x3275e6[_0x2c32('0x38')]['fields']));_0x1ed759[_0x2c32('0x3c')]=_0x1ed759[_0x2c32('0x3c')][_0x2c32('0x3d')]?_0x1ed759[_0x2c32('0x3c')]:_0x57425e[_0x2c32('0x3b')];if(!_0x3275e6[_0x2c32('0x38')][_0x2c32('0x3e')](_0x2c32('0x3f'))){_0x1ed759[_0x2c32('0x23')]=qs[_0x2c32('0x23')](_0x3275e6['query'][_0x2c32('0x23')]);_0x1ed759[_0x2c32('0x26')]=qs[_0x2c32('0x26')](_0x3275e6[_0x2c32('0x38')][_0x2c32('0x26')]);}_0x1ed759[_0x2c32('0x40')]=qs['sort'](_0x3275e6['query'][_0x2c32('0x41')]);_0x1ed759[_0x2c32('0x42')]=qs[_0x2c32('0x39')](_['pick'](_0x3275e6[_0x2c32('0x38')],_0x57425e[_0x2c32('0x39')]),_0x335369);if(_0x3275e6[_0x2c32('0x38')]['filter']){_0x1ed759[_0x2c32('0x42')]=_[_0x2c32('0x43')](_0x1ed759[_0x2c32('0x42')],{'$or':_[_0x2c32('0x34')](_0x335369,function(_0x3f0ce1){if(_0x3f0ce1[_0x2c32('0x37')]!==_0x2c32('0x44')){var _0x4eae27={};_0x4eae27[_0x3f0ce1['name']]={'$like':'%'+_0x3275e6[_0x2c32('0x38')]['filter']+'%'};return _0x4eae27;}})});}_0x1ed759=_[_0x2c32('0x43')]({},_0x1ed759,_0x3275e6['options']);var _0x382c33={'where':_0x1ed759[_0x2c32('0x42')]};return db[_0x2c32('0x35')][_0x2c32('0x25')](_0x382c33)['then'](function(_0x24228){_0x2b0d02[_0x2c32('0x25')]=_0x24228;if(_0x3275e6[_0x2c32('0x38')][_0x2c32('0x45')]){_0x1ed759[_0x2c32('0x46')]=[{'all':!![]}];}return db[_0x2c32('0x35')][_0x2c32('0x47')](_0x1ed759);})[_0x2c32('0x2d')](function(_0x1c65f9){_0x2b0d02[_0x2c32('0x48')]=_0x1c65f9;return _0x2b0d02;})[_0x2c32('0x2d')](respondWithFilteredResult(_0x9221f3,_0x1ed759))[_0x2c32('0x49')](handleError(_0x9221f3,null));};exports[_0x2c32('0x4a')]=function(_0x6ffaed,_0x19c65a){var _0x35dd59={'raw':!![],'where':{'id':_0x6ffaed[_0x2c32('0x4b')]['id']}},_0x2e6afc={};_0x2e6afc['model']=_[_0x2c32('0x4c')](db[_0x2c32('0x35')][_0x2c32('0x36')]);_0x2e6afc[_0x2c32('0x38')]=_[_0x2c32('0x4c')](_0x6ffaed[_0x2c32('0x38')]);_0x2e6afc[_0x2c32('0x39')]=_[_0x2c32('0x3a')](_0x2e6afc[_0x2c32('0x3b')],_0x2e6afc['query']);_0x35dd59[_0x2c32('0x3c')]=_['intersection'](_0x2e6afc['model'],qs[_0x2c32('0x4d')](_0x6ffaed['query'][_0x2c32('0x4d')]));_0x35dd59['attributes']=_0x35dd59[_0x2c32('0x3c')][_0x2c32('0x3d')]?_0x35dd59[_0x2c32('0x3c')]:_0x2e6afc[_0x2c32('0x3b')];if(_0x6ffaed[_0x2c32('0x38')][_0x2c32('0x45')]){_0x35dd59[_0x2c32('0x46')]=[{'all':!![]}];}_0x35dd59=_[_0x2c32('0x43')]({},_0x35dd59,_0x6ffaed[_0x2c32('0x4e')]);return db[_0x2c32('0x35')]['find'](_0x35dd59)[_0x2c32('0x2d')](handleEntityNotFound(_0x19c65a,null))[_0x2c32('0x2d')](respondWithResult(_0x19c65a,null))[_0x2c32('0x49')](handleError(_0x19c65a,null));};exports['create']=function(_0x37652b,_0x43529b){return db[_0x2c32('0x35')]['create'](_0x37652b['body'],{})['then'](respondWithResult(_0x43529b,0xc9))[_0x2c32('0x49')](handleError(_0x43529b,null));};exports[_0x2c32('0x2c')]=function(_0x465095,_0x5241cf){if(_0x465095['body']['id']){delete _0x465095[_0x2c32('0x4f')]['id'];}return db[_0x2c32('0x35')][_0x2c32('0x50')]({'where':{'id':_0x465095['params']['id']}})[_0x2c32('0x2d')](handleEntityNotFound(_0x5241cf,null))[_0x2c32('0x2d')](saveUpdates(_0x465095[_0x2c32('0x4f')],null))[_0x2c32('0x2d')](respondWithResult(_0x5241cf,null))[_0x2c32('0x49')](handleError(_0x5241cf,null));};exports[_0x2c32('0x2e')]=function(_0x2cf7f3,_0x4a6da5){return db[_0x2c32('0x35')][_0x2c32('0x50')]({'where':{'id':_0x2cf7f3[_0x2c32('0x4b')]['id']}})[_0x2c32('0x2d')](handleEntityNotFound(_0x4a6da5,null))['then'](removeEntity(_0x4a6da5,null))['catch'](handleError(_0x4a6da5,null));};exports[_0x2c32('0x51')]=function(_0x19cac9,_0x8523de){return db['MailTransferReport']['describe']()[_0x2c32('0x2d')](respondWithResult(_0x8523de,null))[_0x2c32('0x49')](handleError(_0x8523de,null));}; \ No newline at end of file +var _0xa380=['jsforce','desk.js','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','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x575e50,_0xa1c92d){var _0x1057b1=function(_0x12ac8d){while(--_0x12ac8d){_0x575e50['push'](_0x575e50['shift']());}};_0x1057b1(++_0xa1c92d);}(_0xa380,0x1ca));var _0x0a38=function(_0x4ce55e,_0x2b5476){_0x4ce55e=_0x4ce55e-0x0;var _0x5d691f=_0xa380[_0x4ce55e];return _0x5d691f;};'use strict';var emlformat=require(_0x0a38('0x0'));var rimraf=require(_0x0a38('0x1'));var zipdir=require(_0x0a38('0x2'));var jsonpatch=require(_0x0a38('0x3'));var rp=require(_0x0a38('0x4'));var moment=require(_0x0a38('0x5'));var BPromise=require(_0x0a38('0x6'));var Mustache=require(_0x0a38('0x7'));var util=require(_0x0a38('0x8'));var path=require(_0x0a38('0x9'));var sox=require(_0x0a38('0xa'));var csv=require(_0x0a38('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a38('0xc'));var _=require(_0x0a38('0xd'));var squel=require(_0x0a38('0xe'));var crypto=require(_0x0a38('0xf'));var jsforce=require(_0x0a38('0x10'));var deskjs=require(_0x0a38('0x11'));var toCsv=require(_0x0a38('0xb'));var querystring=require(_0x0a38('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0a38('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0a38('0x14'));var hardwareService=require(_0x0a38('0x15'));var logger=require(_0x0a38('0x16'))(_0x0a38('0x17'));var utils=require(_0x0a38('0x18'));var config=require(_0x0a38('0x19'));var licenseUtil=require(_0x0a38('0x1a'));var db=require(_0x0a38('0x1b'))['db'];function respondWithStatusCode(_0x5e4452,_0x4a4971){_0x4a4971=_0x4a4971||0xcc;return function(_0x5076aa){if(_0x5076aa){return _0x5e4452[_0x0a38('0x1c')](_0x4a4971);}return _0x5e4452[_0x0a38('0x1d')](_0x4a4971)[_0x0a38('0x1e')]();};}function respondWithResult(_0x16c6f7,_0x5b5a0a){_0x5b5a0a=_0x5b5a0a||0xc8;return function(_0x2944b6){if(_0x2944b6){return _0x16c6f7[_0x0a38('0x1d')](_0x5b5a0a)[_0x0a38('0x1f')](_0x2944b6);}};}function respondWithFilteredResult(_0xb91df5,_0x5376bc){return function(_0x1378ea){if(_0x1378ea){var _0x4d8662=typeof _0x5376bc[_0x0a38('0x20')]==='undefined'&&typeof _0x5376bc[_0x0a38('0x21')]==='undefined';var _0x37a0c6=_0x1378ea[_0x0a38('0x22')];var _0x59dd46=_0x4d8662?0x0:_0x5376bc[_0x0a38('0x20')];var _0x38910b=_0x4d8662?_0x1378ea[_0x0a38('0x22')]:_0x5376bc[_0x0a38('0x20')]+_0x5376bc[_0x0a38('0x21')];var _0x8a152f;if(_0x38910b>=_0x37a0c6){_0x38910b=_0x37a0c6;_0x8a152f=0xc8;}else{_0x8a152f=0xce;}_0xb91df5[_0x0a38('0x1d')](_0x8a152f);return _0xb91df5[_0x0a38('0x23')](_0x0a38('0x24'),_0x59dd46+'-'+_0x38910b+'/'+_0x37a0c6)[_0x0a38('0x1f')](_0x1378ea);}return null;};}function patchUpdates(_0x49c34d){return function(_0x554107){try{jsonpatch[_0x0a38('0x25')](_0x554107,_0x49c34d,!![]);}catch(_0x5932ae){return BPromise['reject'](_0x5932ae);}return _0x554107[_0x0a38('0x26')]();};}function saveUpdates(_0x211e60,_0x45446e){return function(_0x391555){if(_0x391555){return _0x391555[_0x0a38('0x27')](_0x211e60)[_0x0a38('0x28')](function(_0x5aef8e){return _0x5aef8e;});}return null;};}function removeEntity(_0x2950e8,_0x39bc9d){return function(_0x409f38){if(_0x409f38){return _0x409f38[_0x0a38('0x29')]()[_0x0a38('0x28')](function(){_0x2950e8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20dbba,_0x588fcf){return function(_0x344ad9){if(!_0x344ad9){_0x20dbba[_0x0a38('0x1c')](0x194);}return _0x344ad9;};}function handleError(_0x486032,_0x49ec5b){_0x49ec5b=_0x49ec5b||0x1f4;return function(_0xbf3fc8){logger['error'](_0xbf3fc8[_0x0a38('0x2a')]);if(_0xbf3fc8[_0x0a38('0x2b')]){delete _0xbf3fc8[_0x0a38('0x2b')];}_0x486032[_0x0a38('0x1d')](_0x49ec5b)[_0x0a38('0x2c')](_0xbf3fc8);};}exports[_0x0a38('0x2d')]=function(_0x5a7874,_0x477492){var _0x3687e9={},_0x499e18={},_0x1134ed={'count':0x0,'rows':[]};var _0x5b4418=_[_0x0a38('0x2e')](db[_0x0a38('0x2f')][_0x0a38('0x30')],function(_0xe92e4f){return{'name':_0xe92e4f[_0x0a38('0x31')],'type':_0xe92e4f[_0x0a38('0x32')][_0x0a38('0x33')]};});_0x499e18['model']=_[_0x0a38('0x2e')](_0x5b4418,'name');_0x499e18[_0x0a38('0x34')]=_['keys'](_0x5a7874[_0x0a38('0x34')]);_0x499e18[_0x0a38('0x35')]=_[_0x0a38('0x36')](_0x499e18[_0x0a38('0x37')],_0x499e18[_0x0a38('0x34')]);_0x3687e9[_0x0a38('0x38')]=_[_0x0a38('0x36')](_0x499e18[_0x0a38('0x37')],qs['fields'](_0x5a7874[_0x0a38('0x34')][_0x0a38('0x39')]));_0x3687e9['attributes']=_0x3687e9[_0x0a38('0x38')][_0x0a38('0x3a')]?_0x3687e9[_0x0a38('0x38')]:_0x499e18[_0x0a38('0x37')];if(!_0x5a7874[_0x0a38('0x34')][_0x0a38('0x3b')](_0x0a38('0x3c'))){_0x3687e9[_0x0a38('0x21')]=qs[_0x0a38('0x21')](_0x5a7874['query'][_0x0a38('0x21')]);_0x3687e9[_0x0a38('0x20')]=qs['offset'](_0x5a7874[_0x0a38('0x34')][_0x0a38('0x20')]);}_0x3687e9['order']=qs[_0x0a38('0x3d')](_0x5a7874['query'][_0x0a38('0x3d')]);_0x3687e9[_0x0a38('0x3e')]=qs['filters'](_[_0x0a38('0x3f')](_0x5a7874[_0x0a38('0x34')],_0x499e18[_0x0a38('0x35')]),_0x5b4418);if(_0x5a7874[_0x0a38('0x34')][_0x0a38('0x40')]){_0x3687e9[_0x0a38('0x3e')]=_['merge'](_0x3687e9[_0x0a38('0x3e')],{'$or':_[_0x0a38('0x2e')](_0x5b4418,function(_0x4b3d37){if(_0x4b3d37[_0x0a38('0x32')]!==_0x0a38('0x41')){var _0x4414d0={};_0x4414d0[_0x4b3d37[_0x0a38('0x2b')]]={'$like':'%'+_0x5a7874[_0x0a38('0x34')][_0x0a38('0x40')]+'%'};return _0x4414d0;}})});}_0x3687e9=_[_0x0a38('0x42')]({},_0x3687e9,_0x5a7874[_0x0a38('0x43')]);var _0x227a64={'where':_0x3687e9[_0x0a38('0x3e')]};return db[_0x0a38('0x2f')][_0x0a38('0x22')](_0x227a64)[_0x0a38('0x28')](function(_0x42387f){_0x1134ed[_0x0a38('0x22')]=_0x42387f;if(_0x5a7874[_0x0a38('0x34')][_0x0a38('0x44')]){_0x3687e9[_0x0a38('0x45')]=[{'all':!![]}];}return db[_0x0a38('0x2f')]['findAll'](_0x3687e9);})[_0x0a38('0x28')](function(_0x3ce9f2){_0x1134ed[_0x0a38('0x46')]=_0x3ce9f2;return _0x1134ed;})['then'](respondWithFilteredResult(_0x477492,_0x3687e9))['catch'](handleError(_0x477492,null));};exports[_0x0a38('0x47')]=function(_0x86ff14,_0x44ba48){var _0x61a4ee={'raw':!![],'where':{'id':_0x86ff14[_0x0a38('0x48')]['id']}},_0x262ac3={};_0x262ac3['model']=_[_0x0a38('0x49')](db[_0x0a38('0x2f')][_0x0a38('0x30')]);_0x262ac3[_0x0a38('0x34')]=_[_0x0a38('0x49')](_0x86ff14[_0x0a38('0x34')]);_0x262ac3[_0x0a38('0x35')]=_[_0x0a38('0x36')](_0x262ac3['model'],_0x262ac3[_0x0a38('0x34')]);_0x61a4ee[_0x0a38('0x38')]=_[_0x0a38('0x36')](_0x262ac3['model'],qs['fields'](_0x86ff14['query'][_0x0a38('0x39')]));_0x61a4ee[_0x0a38('0x38')]=_0x61a4ee[_0x0a38('0x38')][_0x0a38('0x3a')]?_0x61a4ee[_0x0a38('0x38')]:_0x262ac3[_0x0a38('0x37')];if(_0x86ff14[_0x0a38('0x34')][_0x0a38('0x44')]){_0x61a4ee[_0x0a38('0x45')]=[{'all':!![]}];}_0x61a4ee=_[_0x0a38('0x42')]({},_0x61a4ee,_0x86ff14['options']);return db[_0x0a38('0x2f')][_0x0a38('0x4a')](_0x61a4ee)[_0x0a38('0x28')](handleEntityNotFound(_0x44ba48,null))[_0x0a38('0x28')](respondWithResult(_0x44ba48,null))[_0x0a38('0x4b')](handleError(_0x44ba48,null));};exports['create']=function(_0x1fd177,_0x48f776){return db[_0x0a38('0x2f')][_0x0a38('0x4c')](_0x1fd177[_0x0a38('0x4d')],{})[_0x0a38('0x28')](respondWithResult(_0x48f776,0xc9))[_0x0a38('0x4b')](handleError(_0x48f776,null));};exports[_0x0a38('0x27')]=function(_0x245587,_0x58386e){if(_0x245587[_0x0a38('0x4d')]['id']){delete _0x245587[_0x0a38('0x4d')]['id'];}return db[_0x0a38('0x2f')][_0x0a38('0x4a')]({'where':{'id':_0x245587[_0x0a38('0x48')]['id']}})[_0x0a38('0x28')](handleEntityNotFound(_0x58386e,null))['then'](saveUpdates(_0x245587[_0x0a38('0x4d')],null))[_0x0a38('0x28')](respondWithResult(_0x58386e,null))[_0x0a38('0x4b')](handleError(_0x58386e,null));};exports[_0x0a38('0x29')]=function(_0x403e90,_0x3fc5c8){return db['MailTransferReport'][_0x0a38('0x4a')]({'where':{'id':_0x403e90[_0x0a38('0x48')]['id']}})[_0x0a38('0x28')](handleEntityNotFound(_0x3fc5c8,null))[_0x0a38('0x28')](removeEntity(_0x3fc5c8,null))['catch'](handleError(_0x3fc5c8,null));};exports[_0x0a38('0x4e')]=function(_0x44d91f,_0x3897b2){return db[_0x0a38('0x2f')][_0x0a38('0x4e')]()[_0x0a38('0x28')](respondWithResult(_0x3897b2,null))[_0x0a38('0x4b')](handleError(_0x3897b2,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index fa8a64a..312f3e6 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 _0xea09=['uniqueid','../../config/logger','request-promise','path','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer'];(function(_0x541c07,_0x141050){var _0x8c1011=function(_0x4e837d){while(--_0x4e837d){_0x541c07['push'](_0x541c07['shift']());}};_0x8c1011(++_0x141050);}(_0xea09,0xd0));var _0x9ea0=function(_0xf13951,_0x33842b){_0xf13951=_0xf13951-0x0;var _0x4fa337=_0xea09[_0xf13951];return _0x4fa337;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9ea0('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9ea0('0x1'));var fs=require('fs');var path=require(_0x9ea0('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9ea0('0x3'));module[_0x9ea0('0x4')]=function(_0x53dd70,_0x37dd11){return _0x53dd70[_0x9ea0('0x5')](_0x9ea0('0x6'),attributes,{'tableName':_0x9ea0('0x7'),'paranoid':![],'indexes':[{'name':_0x9ea0('0x8'),'fields':[_0x9ea0('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xca8d=['report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport'];(function(_0x538a06,_0x4964cc){var _0x35c42e=function(_0x3d944c){while(--_0x3d944c){_0x538a06['push'](_0x538a06['shift']());}};_0x35c42e(++_0x4964cc);}(_0xca8d,0x172));var _0xdca8=function(_0x3af7b7,_0x208014){_0x3af7b7=_0x3af7b7-0x0;var _0x8408b5=_0xca8d[_0x3af7b7];return _0x8408b5;};'use strict';var _=require(_0xdca8('0x0'));var util=require(_0xdca8('0x1'));var logger=require(_0xdca8('0x2'))(_0xdca8('0x3'));var moment=require(_0xdca8('0x4'));var BPromise=require(_0xdca8('0x5'));var rp=require(_0xdca8('0x6'));var fs=require('fs');var path=require(_0xdca8('0x7'));var rimraf=require(_0xdca8('0x8'));var config=require(_0xdca8('0x9'));var attributes=require(_0xdca8('0xa'));module[_0xdca8('0xb')]=function(_0x4d6383,_0x3366d5){return _0x4d6383[_0xdca8('0xc')](_0xdca8('0xd'),attributes,{'tableName':_0xdca8('0xe'),'paranoid':![],'indexes':[{'name':_0xdca8('0xf'),'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 ef4e1bf..372b866 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 _0x86e3=['info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x86e3,0xf1));var _0x386e=function(_0x279f32,_0x19a015){_0x279f32=_0x279f32-0x0;var _0x42e7d1=_0x86e3[_0x279f32];return _0x42e7d1;};'use strict';var _=require(_0x386e('0x0'));var util=require(_0x386e('0x1'));var moment=require(_0x386e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x386e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x386e('0x4'));var logger=require(_0x386e('0x5'))(_0x386e('0x6'));var config=require(_0x386e('0x7'));var jayson=require(_0x386e('0x8'));var client=jayson[_0x386e('0x9')][_0x386e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35c687,_0x4ace72,_0x412bff){return new BPromise(function(_0x1792f4,_0x59410d){return client['request'](_0x35c687,_0x412bff)[_0x386e('0xb')](function(_0x1dc824){logger[_0x386e('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x4ace72,'request\x20sent');logger[_0x386e('0xd')](_0x386e('0xe'),_0x4ace72,_0x386e('0xf'),JSON[_0x386e('0x10')](_0x1dc824));if(_0x1dc824['error']){if(_0x1dc824[_0x386e('0x11')][_0x386e('0x12')]===0x1f4){logger[_0x386e('0x11')](_0x386e('0x13'),_0x4ace72,_0x1dc824['error'][_0x386e('0x14')]);return _0x59410d(_0x1dc824[_0x386e('0x11')][_0x386e('0x14')]);}logger[_0x386e('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x4ace72,_0x1dc824['error']['message']);return _0x1792f4(_0x1dc824['error'][_0x386e('0x14')]);}else{logger[_0x386e('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x4ace72,_0x386e('0xf'));_0x1792f4(_0x1dc824[_0x386e('0x15')]['message']);}})[_0x386e('0x16')](function(_0x31f377){logger[_0x386e('0x11')](_0x386e('0x13'),_0x4ace72,_0x31f377);_0x59410d(_0x31f377);});});} \ No newline at end of file +var _0x3b13=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b13,0x189));var _0x33b1=function(_0x563188,_0x157c4d){_0x563188=_0x563188-0x0;var _0x211dde=_0x3b13[_0x563188];return _0x211dde;};'use strict';var _=require(_0x33b1('0x0'));var util=require(_0x33b1('0x1'));var moment=require(_0x33b1('0x2'));var BPromise=require(_0x33b1('0x3'));var rs=require(_0x33b1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33b1('0x5'))['db'];var utils=require(_0x33b1('0x6'));var logger=require(_0x33b1('0x7'))('rpc');var config=require(_0x33b1('0x8'));var jayson=require(_0x33b1('0x9'));var client=jayson['client'][_0x33b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x246ebd,_0x560e07,_0x2905ae){return new BPromise(function(_0x33e010,_0x1fb561){return client['request'](_0x246ebd,_0x2905ae)[_0x33b1('0xb')](function(_0x4e7136){logger['info'](_0x33b1('0xc'),_0x560e07,_0x33b1('0xd'));logger[_0x33b1('0xe')](_0x33b1('0xf'),_0x560e07,'request\x20sent',JSON[_0x33b1('0x10')](_0x4e7136));if(_0x4e7136[_0x33b1('0x11')]){if(_0x4e7136[_0x33b1('0x11')]['code']===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x560e07,_0x4e7136[_0x33b1('0x11')][_0x33b1('0x12')]);return _0x1fb561(_0x4e7136['error'][_0x33b1('0x12')]);}logger[_0x33b1('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x560e07,_0x4e7136[_0x33b1('0x11')]['message']);return _0x33e010(_0x4e7136[_0x33b1('0x11')][_0x33b1('0x12')]);}else{logger[_0x33b1('0x13')](_0x33b1('0xc'),_0x560e07,_0x33b1('0xd'));_0x33e010(_0x4e7136[_0x33b1('0x14')][_0x33b1('0x12')]);}})[_0x33b1('0x15')](function(_0x34e6e4){logger[_0x33b1('0x11')](_0x33b1('0xc'),_0x560e07,_0x34e6e4);_0x1fb561(_0x34e6e4);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 9566858..3732331 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 _0x6163=['../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','/describe','show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x50e69b,_0x58ec1b){var _0x102809=function(_0x2a8b86){while(--_0x2a8b86){_0x50e69b['push'](_0x50e69b['shift']());}};_0x102809(++_0x58ec1b);}(_0x6163,0x13a));var _0x3616=function(_0x1c6ee7,_0x2f93fe){_0x1c6ee7=_0x1c6ee7-0x0;var _0x5c3740=_0x6163[_0x1c6ee7];return _0x5c3740;};'use strict';var multer=require(_0x3616('0x0'));var util=require(_0x3616('0x1'));var path=require(_0x3616('0x2'));var timeout=require(_0x3616('0x3'));var express=require(_0x3616('0x4'));var router=express[_0x3616('0x5')]();var fs_extra=require(_0x3616('0x6'));var auth=require(_0x3616('0x7'));var interaction=require(_0x3616('0x8'));var config=require(_0x3616('0x9'));var controller=require(_0x3616('0xa'));router['get']('/',auth[_0x3616('0xb')](),controller[_0x3616('0xc')]);router[_0x3616('0xd')](_0x3616('0xe'),auth['isAuthenticated'](),controller['describe']);router[_0x3616('0xd')]('/:id',auth[_0x3616('0xb')](),controller[_0x3616('0xf')]);router[_0x3616('0x10')]('/',auth[_0x3616('0xb')](),controller[_0x3616('0x11')]);router[_0x3616('0x12')](_0x3616('0x13'),auth[_0x3616('0xb')](),controller[_0x3616('0x14')]);router[_0x3616('0x15')](_0x3616('0x13'),auth[_0x3616('0xb')](),controller['destroy']);module[_0x3616('0x16')]=router; \ No newline at end of file +var _0x1ba0=['get','describe','/:id','show','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','isAuthenticated'];(function(_0x17cb7d,_0x36a9f1){var _0x2e22cd=function(_0x296357){while(--_0x296357){_0x17cb7d['push'](_0x17cb7d['shift']());}};_0x2e22cd(++_0x36a9f1);}(_0x1ba0,0x1d2));var _0x01ba=function(_0x364048,_0x34dea3){_0x364048=_0x364048-0x0;var _0x591678=_0x1ba0[_0x364048];return _0x591678;};'use strict';var multer=require('multer');var util=require(_0x01ba('0x0'));var path=require('path');var timeout=require(_0x01ba('0x1'));var express=require(_0x01ba('0x2'));var router=express[_0x01ba('0x3')]();var fs_extra=require(_0x01ba('0x4'));var auth=require(_0x01ba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x01ba('0x6'));var controller=require(_0x01ba('0x7'));router['get']('/',auth[_0x01ba('0x8')](),controller['index']);router[_0x01ba('0x9')]('/describe',auth[_0x01ba('0x8')](),controller[_0x01ba('0xa')]);router['get'](_0x01ba('0xb'),auth['isAuthenticated'](),controller[_0x01ba('0xc')]);router[_0x01ba('0xd')]('/',auth[_0x01ba('0x8')](),controller['create']);router[_0x01ba('0xe')](_0x01ba('0xb'),auth[_0x01ba('0x8')](),controller[_0x01ba('0xf')]);router[_0x01ba('0x10')](_0x01ba('0xb'),auth['isAuthenticated'](),controller[_0x01ba('0x11')]);module[_0x01ba('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index dabdc6b..29ef94b 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 _0x4bbe=['talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]'];(function(_0x10b4f2,_0x2d4ec8){var _0x1d9640=function(_0x5a55ab){while(--_0x5a55ab){_0x10b4f2['push'](_0x10b4f2['shift']());}};_0x1d9640(++_0x2d4ec8);}(_0x4bbe,0x8e));var _0xe4bb=function(_0x53ced3,_0x41e53f){_0x53ced3=_0x53ced3-0x0;var _0x4983b4=_0x4bbe[_0x53ced3];return _0x4983b4;};'use strict';var Sequelize=require(_0xe4bb('0x0'));var moment=require(_0xe4bb('0x1'));module['exports']={'channel':{'type':Sequelize[_0xe4bb('0x2')]},'membername':{'type':Sequelize[_0xe4bb('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe4bb('0x2')],'defaultValue':_0xe4bb('0x3'),'comment':_0xe4bb('0x4')},'duration':{'type':Sequelize[_0xe4bb('0x5')]},'enterAt':{'type':Sequelize[_0xe4bb('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x954b69){var _0x4aded9=moment(_0x954b69);var _0x11aabb=moment(this['getDataValue']('enterAt'));var _0x3d2377=_0x4aded9['diff'](_0x11aabb,_0xe4bb('0x7'));this['setDataValue'](_0xe4bb('0x8'),_0x954b69);this[_0xe4bb('0x9')](_0xe4bb('0xa'),_0x3d2377>=0x0?_0x3d2377:null);}},'data1':{'type':Sequelize[_0xe4bb('0x2')],'comment':_0xe4bb('0xb')},'data2':{'type':Sequelize[_0xe4bb('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xe4bb('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xe4bb('0x2')],'comment':_0xe4bb('0xc')},'data5':{'type':Sequelize[_0xe4bb('0x2')],'comment':_0xe4bb('0xd')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xe4bb('0x2')]}}; \ No newline at end of file +var _0x55f5=['exitAt','talk:[destination]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x55f5,0x1d0));var _0x555f=function(_0x14aad1,_0x106154){_0x14aad1=_0x14aad1-0x0;var _0x36c3a9=_0x55f5[_0x14aad1];return _0x36c3a9;};'use strict';var Sequelize=require(_0x555f('0x0'));var moment=require(_0x555f('0x1'));module[_0x555f('0x2')]={'channel':{'type':Sequelize[_0x555f('0x3')]},'membername':{'type':Sequelize[_0x555f('0x3')]},'interface':{'type':Sequelize[_0x555f('0x3')]},'type':{'type':Sequelize[_0x555f('0x3')],'defaultValue':_0x555f('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x555f('0x5')]},'enterAt':{'type':Sequelize[_0x555f('0x6')]},'exitAt':{'type':Sequelize[_0x555f('0x6')],'set':function(_0x2efcf4){var _0xafdd0e=moment(_0x2efcf4);var _0x5962cc=moment(this[_0x555f('0x7')](_0x555f('0x8')));var _0x19faec=_0xafdd0e[_0x555f('0x9')](_0x5962cc,_0x555f('0xa'));this[_0x555f('0xb')](_0x555f('0xc'),_0x2efcf4);this[_0x555f('0xb')]('duration',_0x19faec>=0x0?_0x19faec:null);}},'data1':{'type':Sequelize[_0x555f('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x555f('0x3')],'comment':_0x555f('0xd')},'data4':{'type':Sequelize[_0x555f('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x555f('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x555f('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x555f('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 1971134..840485b 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x3fa642,_0x3dda0b){var _0x38bd42=function(_0x577df5){while(--_0x577df5){_0x3fa642['push'](_0x3fa642['shift']());}};_0x38bd42(++_0x3dda0b);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x510940,_0x3eacec){var _0x205cea=function(_0x4158ab){while(--_0x4158ab){_0x510940['push'](_0x510940['shift']());}};_0x205cea(++_0x3eacec);}(_0x7217,0x19e));var _0x7721=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7217[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d9f4b92..ce84c7b 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 _0x3de9=['path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','request-promise'];(function(_0x32def6,_0x358ee3){var _0x22c9ba=function(_0x1e327e){while(--_0x1e327e){_0x32def6['push'](_0x32def6['shift']());}};_0x22c9ba(++_0x358ee3);}(_0x3de9,0x192));var _0x93de=function(_0x3359c4,_0x54a2da){_0x3359c4=_0x3359c4-0x0;var _0x796652=_0x3de9[_0x3359c4];return _0x796652;};'use strict';var _=require(_0x93de('0x0'));var util=require(_0x93de('0x1'));var logger=require(_0x93de('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x93de('0x3'));var fs=require('fs');var path=require(_0x93de('0x4'));var rimraf=require(_0x93de('0x5'));var config=require(_0x93de('0x6'));var attributes=require(_0x93de('0x7'));module[_0x93de('0x8')]=function(_0x13e6ea,_0xbe8f62){return _0x13e6ea['define'](_0x93de('0x9'),attributes,{'tableName':_0x93de('0xa'),'paranoid':![],'indexes':[{'name':_0x93de('0xb'),'fields':[_0x93de('0xc'),_0x93de('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc20=['rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','lodash','util','../../config/logger','api','bluebird'];(function(_0x5bf555,_0x4978b5){var _0x314099=function(_0x13988f){while(--_0x13988f){_0x5bf555['push'](_0x5bf555['shift']());}};_0x314099(++_0x4978b5);}(_0xbc20,0x181));var _0x0bc2=function(_0x13647c,_0x4822a7){_0x13647c=_0x13647c-0x0;var _0x341ecb=_0xbc20[_0x13647c];return _0x341ecb;};'use strict';var _=require(_0x0bc2('0x0'));var util=require(_0x0bc2('0x1'));var logger=require(_0x0bc2('0x2'))(_0x0bc2('0x3'));var moment=require('moment');var BPromise=require(_0x0bc2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0bc2('0x5'));var config=require(_0x0bc2('0x6'));var attributes=require(_0x0bc2('0x7'));module[_0x0bc2('0x8')]=function(_0x5884d0,_0x283ad6){return _0x5884d0[_0x0bc2('0x9')](_0x0bc2('0xa'),attributes,{'tableName':_0x0bc2('0xb'),'paranoid':![],'indexes':[{'name':_0x0bc2('0xc'),'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 6173201..a521b82 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 _0x47a1=['body','CreateMemberReport','update','UpdateMemberReport','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','MemberReport','create'];(function(_0x1b5a5a,_0x1c3b75){var _0x42b32d=function(_0x3d35ab){while(--_0x3d35ab){_0x1b5a5a['push'](_0x1b5a5a['shift']());}};_0x42b32d(++_0x1c3b75);}(_0x47a1,0xbd));var _0x147a=function(_0x34faee,_0x1a2f9a){_0x34faee=_0x34faee-0x0;var _0x4d6e45=_0x47a1[_0x34faee];return _0x4d6e45;};'use strict';var _=require(_0x147a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x147a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x147a('0x2'));var db=require(_0x147a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x147a('0x4'))(_0x147a('0x5'));var config=require(_0x147a('0x6'));var jayson=require(_0x147a('0x7'));var client=jayson[_0x147a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a0a85,_0x312654,_0x130a3b){return new BPromise(function(_0x28a263,_0x375c68){return client[_0x147a('0x9')](_0x2a0a85,_0x130a3b)[_0x147a('0xa')](function(_0x5c80cf){logger[_0x147a('0xb')](_0x147a('0xc'),_0x312654,'request\x20sent');logger[_0x147a('0xd')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x312654,_0x147a('0xe'),JSON[_0x147a('0xf')](_0x5c80cf));if(_0x5c80cf[_0x147a('0x10')]){if(_0x5c80cf['error'][_0x147a('0x11')]===0x1f4){logger[_0x147a('0x10')](_0x147a('0xc'),_0x312654,_0x5c80cf['error'][_0x147a('0x12')]);return _0x375c68(_0x5c80cf[_0x147a('0x10')][_0x147a('0x12')]);}logger[_0x147a('0x10')](_0x147a('0xc'),_0x312654,_0x5c80cf[_0x147a('0x10')][_0x147a('0x12')]);return _0x28a263(_0x5c80cf[_0x147a('0x10')][_0x147a('0x12')]);}else{logger['info'](_0x147a('0xc'),_0x312654,'request\x20sent');_0x28a263(_0x5c80cf[_0x147a('0x13')][_0x147a('0x12')]);}})[_0x147a('0x14')](function(_0xac7ef5){logger[_0x147a('0x10')](_0x147a('0xc'),_0x312654,_0xac7ef5);_0x375c68(_0xac7ef5);});});}exports['GetMemberReport']=function(_0x51fd3a){var _0x590a79=this;return new Promise(function(_0x427ffd,_0x19848e){return db['MemberReport'][_0x147a('0x15')]({'raw':_0x51fd3a['options']?_0x51fd3a[_0x147a('0x16')][_0x147a('0x17')]===undefined?!![]:![]:!![],'where':_0x51fd3a[_0x147a('0x16')]?_0x51fd3a[_0x147a('0x16')][_0x147a('0x18')]||null:null,'attributes':_0x51fd3a[_0x147a('0x16')]?_0x51fd3a[_0x147a('0x16')][_0x147a('0x19')]||null:null,'limit':_0x51fd3a[_0x147a('0x16')]?_0x51fd3a[_0x147a('0x16')][_0x147a('0x1a')]||null:null,'include':_0x51fd3a['options']?_0x51fd3a[_0x147a('0x16')][_0x147a('0x1b')]?_[_0x147a('0x1c')](_0x51fd3a[_0x147a('0x16')][_0x147a('0x1b')],function(_0x5059f7){return{'model':db[_0x5059f7[_0x147a('0x1d')]],'as':_0x5059f7['as'],'attributes':_0x5059f7['attributes'],'include':_0x5059f7['include']?_['map'](_0x5059f7[_0x147a('0x1b')],function(_0x5774cb){return{'model':db[_0x5774cb[_0x147a('0x1d')]],'as':_0x5774cb['as'],'attributes':_0x5774cb['attributes'],'include':_0x5774cb[_0x147a('0x1b')]?_[_0x147a('0x1c')](_0x5774cb[_0x147a('0x1b')],function(_0x534e3a){return{'model':db[_0x534e3a['model']],'as':_0x534e3a['as'],'attributes':_0x534e3a[_0x147a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x147a('0xa')](function(_0x3131e9){logger[_0x147a('0xb')](_0x147a('0x1e'),_0x51fd3a);logger[_0x147a('0xd')](_0x147a('0x1e'),_0x51fd3a,JSON[_0x147a('0xf')](_0x3131e9));_0x427ffd(_0x3131e9);})['catch'](function(_0x346c78){logger[_0x147a('0x10')](_0x147a('0x1e'),_0x346c78[_0x147a('0x12')],_0x51fd3a);_0x19848e(_0x590a79['error'](0x1f4,_0x346c78['message']));});});};exports['CreateMemberReport']=function(_0x3a7189){var _0x2f5bc7=this;return new Promise(function(_0x59ccf5,_0x45c3d3){return db[_0x147a('0x1f')][_0x147a('0x20')](_0x3a7189[_0x147a('0x21')],{'raw':_0x3a7189[_0x147a('0x16')]?_0x3a7189[_0x147a('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4dc980){logger[_0x147a('0xb')](_0x147a('0x22'),_0x3a7189);logger['debug'](_0x147a('0x22'),_0x3a7189,JSON[_0x147a('0xf')](_0x4dc980));_0x59ccf5(_0x4dc980);})['catch'](function(_0x2fe729){logger[_0x147a('0x10')](_0x147a('0x22'),_0x2fe729['message'],_0x3a7189);_0x45c3d3(_0x2f5bc7['error'](0x1f4,_0x2fe729[_0x147a('0x12')]));});});};exports['UpdateMemberReport']=function(_0x27bd61){var _0x3caeff=this;return new Promise(function(_0x2a7a6f,_0xffd83a){return db[_0x147a('0x1f')][_0x147a('0x23')](_0x27bd61[_0x147a('0x21')],{'raw':_0x27bd61[_0x147a('0x16')]?_0x27bd61[_0x147a('0x16')][_0x147a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27bd61[_0x147a('0x16')]?_0x27bd61[_0x147a('0x16')][_0x147a('0x18')]||null:null,'attributes':_0x27bd61[_0x147a('0x16')]?_0x27bd61['options']['attributes']||null:null,'limit':_0x27bd61[_0x147a('0x16')]?_0x27bd61[_0x147a('0x16')][_0x147a('0x1a')]||null:null})[_0x147a('0xa')](function(_0x1f94c2){logger[_0x147a('0xb')](_0x147a('0x24'),_0x27bd61);logger[_0x147a('0xd')](_0x147a('0x24'),_0x27bd61,JSON[_0x147a('0xf')](_0x1f94c2));_0x2a7a6f(_0x1f94c2);})[_0x147a('0x14')](function(_0x5f26be){logger[_0x147a('0x10')](_0x147a('0x24'),_0x5f26be['message'],_0x27bd61);_0xffd83a(_0x3caeff[_0x147a('0x10')](0x1f4,_0x5f26be[_0x147a('0x12')]));});});}; \ No newline at end of file +var _0x1561=['raw','where','attributes','limit','include','map','model','then','info','stringify','body','CreateMemberReport','UpdateMemberReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','debug','error','code','message','result','catch','MemberReport,\x20%s,\x20%s','GetMemberReport','MemberReport','findAll','options'];(function(_0x52deb8,_0x37975f){var _0x38e230=function(_0xe546ce){while(--_0xe546ce){_0x52deb8['push'](_0x52deb8['shift']());}};_0x38e230(++_0x37975f);}(_0x1561,0x1bd));var _0x1156=function(_0x5a4602,_0xfac443){_0x5a4602=_0x5a4602-0x0;var _0x321e66=_0x1561[_0x5a4602];return _0x321e66;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1156('0x0'));var BPromise=require(_0x1156('0x1'));var rs=require(_0x1156('0x2'));var fs=require('fs');var Redis=require(_0x1156('0x3'));var db=require(_0x1156('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1156('0x5'))(_0x1156('0x6'));var config=require(_0x1156('0x7'));var jayson=require(_0x1156('0x8'));var client=jayson['client'][_0x1156('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a7048,_0x372fe0,_0x6c3476){return new BPromise(function(_0x273b53,_0x2a7693){return client[_0x1156('0xa')](_0x4a7048,_0x6c3476)['then'](function(_0x2a5914){logger['info']('MemberReport,\x20%s,\x20%s',_0x372fe0,_0x1156('0xb'));logger[_0x1156('0xc')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x372fe0,_0x1156('0xb'),JSON['stringify'](_0x2a5914));if(_0x2a5914[_0x1156('0xd')]){if(_0x2a5914['error'][_0x1156('0xe')]===0x1f4){logger[_0x1156('0xd')]('MemberReport,\x20%s,\x20%s',_0x372fe0,_0x2a5914['error'][_0x1156('0xf')]);return _0x2a7693(_0x2a5914['error'][_0x1156('0xf')]);}logger[_0x1156('0xd')]('MemberReport,\x20%s,\x20%s',_0x372fe0,_0x2a5914['error'][_0x1156('0xf')]);return _0x273b53(_0x2a5914[_0x1156('0xd')][_0x1156('0xf')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x372fe0,_0x1156('0xb'));_0x273b53(_0x2a5914[_0x1156('0x10')][_0x1156('0xf')]);}})[_0x1156('0x11')](function(_0x6889c9){logger[_0x1156('0xd')](_0x1156('0x12'),_0x372fe0,_0x6889c9);_0x2a7693(_0x6889c9);});});}exports[_0x1156('0x13')]=function(_0x2d820d){var _0x211e6b=this;return new Promise(function(_0x2582cb,_0x4ab172){return db[_0x1156('0x14')][_0x1156('0x15')]({'raw':_0x2d820d[_0x1156('0x16')]?_0x2d820d['options'][_0x1156('0x17')]===undefined?!![]:![]:!![],'where':_0x2d820d[_0x1156('0x16')]?_0x2d820d[_0x1156('0x16')][_0x1156('0x18')]||null:null,'attributes':_0x2d820d[_0x1156('0x16')]?_0x2d820d[_0x1156('0x16')][_0x1156('0x19')]||null:null,'limit':_0x2d820d[_0x1156('0x16')]?_0x2d820d['options'][_0x1156('0x1a')]||null:null,'include':_0x2d820d['options']?_0x2d820d[_0x1156('0x16')][_0x1156('0x1b')]?_[_0x1156('0x1c')](_0x2d820d['options'][_0x1156('0x1b')],function(_0x3af43f){return{'model':db[_0x3af43f[_0x1156('0x1d')]],'as':_0x3af43f['as'],'attributes':_0x3af43f[_0x1156('0x19')],'include':_0x3af43f[_0x1156('0x1b')]?_[_0x1156('0x1c')](_0x3af43f['include'],function(_0xa5ffd7){return{'model':db[_0xa5ffd7[_0x1156('0x1d')]],'as':_0xa5ffd7['as'],'attributes':_0xa5ffd7[_0x1156('0x19')],'include':_0xa5ffd7[_0x1156('0x1b')]?_[_0x1156('0x1c')](_0xa5ffd7[_0x1156('0x1b')],function(_0x1b66f9){return{'model':db[_0x1b66f9[_0x1156('0x1d')]],'as':_0x1b66f9['as'],'attributes':_0x1b66f9[_0x1156('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1156('0x1e')](function(_0x225502){logger[_0x1156('0x1f')](_0x1156('0x13'),_0x2d820d);logger[_0x1156('0xc')]('GetMemberReport',_0x2d820d,JSON[_0x1156('0x20')](_0x225502));_0x2582cb(_0x225502);})[_0x1156('0x11')](function(_0x4c44b3){logger[_0x1156('0xd')](_0x1156('0x13'),_0x4c44b3['message'],_0x2d820d);_0x4ab172(_0x211e6b[_0x1156('0xd')](0x1f4,_0x4c44b3[_0x1156('0xf')]));});});};exports['CreateMemberReport']=function(_0x12a68e){var _0x265406=this;return new Promise(function(_0x577957,_0x2c5759){return db[_0x1156('0x14')]['create'](_0x12a68e[_0x1156('0x21')],{'raw':_0x12a68e[_0x1156('0x16')]?_0x12a68e['options'][_0x1156('0x17')]===undefined?!![]:![]:!![]})[_0x1156('0x1e')](function(_0x1e7558){logger[_0x1156('0x1f')]('CreateMemberReport',_0x12a68e);logger['debug'](_0x1156('0x22'),_0x12a68e,JSON[_0x1156('0x20')](_0x1e7558));_0x577957(_0x1e7558);})[_0x1156('0x11')](function(_0x26a0bf){logger[_0x1156('0xd')](_0x1156('0x22'),_0x26a0bf[_0x1156('0xf')],_0x12a68e);_0x2c5759(_0x265406[_0x1156('0xd')](0x1f4,_0x26a0bf[_0x1156('0xf')]));});});};exports['UpdateMemberReport']=function(_0x592ae3){var _0x1d1c44=this;return new Promise(function(_0x48a527,_0x7918f1){return db[_0x1156('0x14')]['update'](_0x592ae3[_0x1156('0x21')],{'raw':_0x592ae3[_0x1156('0x16')]?_0x592ae3[_0x1156('0x16')][_0x1156('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x592ae3['options']?_0x592ae3[_0x1156('0x16')][_0x1156('0x18')]||null:null,'attributes':_0x592ae3['options']?_0x592ae3[_0x1156('0x16')][_0x1156('0x19')]||null:null,'limit':_0x592ae3[_0x1156('0x16')]?_0x592ae3[_0x1156('0x16')]['limit']||null:null})[_0x1156('0x1e')](function(_0x538d1b){logger['info'](_0x1156('0x23'),_0x592ae3);logger['debug'](_0x1156('0x23'),_0x592ae3,JSON['stringify'](_0x538d1b));_0x48a527(_0x538d1b);})['catch'](function(_0x405afb){logger[_0x1156('0xd')](_0x1156('0x23'),_0x405afb[_0x1156('0xf')],_0x592ae3);_0x7918f1(_0x1d1c44[_0x1156('0xd')](0x1f4,_0x405afb[_0x1156('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d95bce5..a0c5f71 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 _0x2094=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x2094,0x10d));var _0x4209=function(_0x573afc,_0x2d96b9){_0x573afc=_0x573afc-0x0;var _0x20df04=_0x2094[_0x573afc];return _0x20df04;};'use strict';var multer=require(_0x4209('0x0'));var util=require('util');var path=require(_0x4209('0x1'));var timeout=require(_0x4209('0x2'));var express=require(_0x4209('0x3'));var router=express[_0x4209('0x4')]();var fs_extra=require(_0x4209('0x5'));var auth=require(_0x4209('0x6'));var interaction=require(_0x4209('0x7'));var config=require(_0x4209('0x8'));var controller=require(_0x4209('0x9'));router[_0x4209('0xa')]('/',controller[_0x4209('0xb')]);module['exports']=router; \ No newline at end of file +var _0xf481=['./migration.controller','get','index','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xf481,0x18a));var _0x1f48=function(_0x507f9e,_0x308d20){_0x507f9e=_0x507f9e-0x0;var _0x250f7e=_0xf481[_0x507f9e];return _0x250f7e;};'use strict';var multer=require(_0x1f48('0x0'));var util=require(_0x1f48('0x1'));var path=require(_0x1f48('0x2'));var timeout=require(_0x1f48('0x3'));var express=require('express');var router=express[_0x1f48('0x4')]();var fs_extra=require(_0x1f48('0x5'));var auth=require(_0x1f48('0x6'));var interaction=require(_0x1f48('0x7'));var config=require(_0x1f48('0x8'));var controller=require(_0x1f48('0x9'));router[_0x1f48('0xa')]('/',controller[_0x1f48('0xb')]);module[_0x1f48('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index b596777..28262a7 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 _0x4bfa=['exports','STRING','version'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4bfa,0x186));var _0xa4bf=function(_0x13c5a9,_0x547d90){_0x13c5a9=_0x13c5a9-0x0;var _0x25f7dc=_0x4bfa[_0x13c5a9];return _0x25f7dc;};'use strict';var Sequelize=require('sequelize');module[_0xa4bf('0x0')]={'version':{'type':Sequelize[_0xa4bf('0x1')],'unique':_0xa4bf('0x2')}}; \ No newline at end of file +var _0x18a7=['STRING','exports'];(function(_0x373fa2,_0x5121ef){var _0x4bf1f5=function(_0x568600){while(--_0x568600){_0x373fa2['push'](_0x373fa2['shift']());}};_0x4bf1f5(++_0x5121ef);}(_0x18a7,0x1eb));var _0x718a=function(_0x1059fa,_0x32f9ad){_0x1059fa=_0x1059fa-0x0;var _0x257b61=_0x18a7[_0x1059fa];return _0x257b61;};'use strict';var Sequelize=require('sequelize');module[_0x718a('0x0')]={'version':{'type':Sequelize[_0x718a('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 04ffbce..dadaeb7 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 _0x70f2=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','index','Migration','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','include','rows','catch','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x21a2b3,_0x5d6564){var _0x4651a7=function(_0x285f59){while(--_0x285f59){_0x21a2b3['push'](_0x21a2b3['shift']());}};_0x4651a7(++_0x5d6564);}(_0x70f2,0xb1));var _0x270f=function(_0x48e9d3,_0xe6b58){_0x48e9d3=_0x48e9d3-0x0;var _0x2ede1f=_0x70f2[_0x48e9d3];return _0x2ede1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x270f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x270f('0x1'));var moment=require('moment');var BPromise=require(_0x270f('0x2'));var Mustache=require(_0x270f('0x3'));var util=require('util');var path=require(_0x270f('0x4'));var sox=require(_0x270f('0x5'));var csv=require(_0x270f('0x6'));var ejs=require(_0x270f('0x7'));var fs=require('fs');var fs_extra=require(_0x270f('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x270f('0x9'));var Papa=require(_0x270f('0xa'));var Redis=require('ioredis');var authService=require(_0x270f('0xb'));var qs=require(_0x270f('0xc'));var as=require(_0x270f('0xd'));var hardwareService=require(_0x270f('0xe'));var logger=require('../../config/logger')(_0x270f('0xf'));var utils=require(_0x270f('0x10'));var config=require(_0x270f('0x11'));var licenseUtil=require(_0x270f('0x12'));var db=require(_0x270f('0x13'))['db'];function respondWithStatusCode(_0x138991,_0x401ed7){_0x401ed7=_0x401ed7||0xcc;return function(_0x39b2bc){if(_0x39b2bc){return _0x138991[_0x270f('0x14')](_0x401ed7);}return _0x138991[_0x270f('0x15')](_0x401ed7)[_0x270f('0x16')]();};}function respondWithResult(_0x280db2,_0x36115b){_0x36115b=_0x36115b||0xc8;return function(_0x3c055d){if(_0x3c055d){return _0x280db2['status'](_0x36115b)[_0x270f('0x17')](_0x3c055d);}};}function respondWithFilteredResult(_0x27d452,_0x282e88){return function(_0x1608f5){if(_0x1608f5){var _0x2f5601=typeof _0x282e88['offset']===_0x270f('0x18')&&typeof _0x282e88[_0x270f('0x19')]===_0x270f('0x18');var _0x4fddc6=_0x1608f5[_0x270f('0x1a')];var _0x2f8395=_0x2f5601?0x0:_0x282e88[_0x270f('0x1b')];var _0xd547d4=_0x2f5601?_0x1608f5[_0x270f('0x1a')]:_0x282e88[_0x270f('0x1b')]+_0x282e88[_0x270f('0x19')];var _0x1c14c3;if(_0xd547d4>=_0x4fddc6){_0xd547d4=_0x4fddc6;_0x1c14c3=0xc8;}else{_0x1c14c3=0xce;}_0x27d452[_0x270f('0x15')](_0x1c14c3);return _0x27d452[_0x270f('0x1c')](_0x270f('0x1d'),_0x2f8395+'-'+_0xd547d4+'/'+_0x4fddc6)['json'](_0x1608f5);}return null;};}function patchUpdates(_0x19b3d2){return function(_0x158b3e){try{jsonpatch[_0x270f('0x1e')](_0x158b3e,_0x19b3d2,!![]);}catch(_0x50d023){return BPromise[_0x270f('0x1f')](_0x50d023);}return _0x158b3e[_0x270f('0x20')]();};}function saveUpdates(_0x40485b,_0xb2f41){return function(_0x7d9e7d){if(_0x7d9e7d){return _0x7d9e7d[_0x270f('0x21')](_0x40485b)[_0x270f('0x22')](function(_0x4a955a){return _0x4a955a;});}return null;};}function removeEntity(_0x3ef96e,_0x2c72d2){return function(_0x2b9bdf){if(_0x2b9bdf){return _0x2b9bdf['destroy']()['then'](function(){_0x3ef96e['status'](0xcc)[_0x270f('0x16')]();});}};}function handleEntityNotFound(_0xd18b3e,_0x4cfa57){return function(_0x3fc489){if(!_0x3fc489){_0xd18b3e[_0x270f('0x14')](0x194);}return _0x3fc489;};}function handleError(_0x433b55,_0x2fe3af){_0x2fe3af=_0x2fe3af||0x1f4;return function(_0x332304){logger['error'](_0x332304[_0x270f('0x23')]);if(_0x332304['name']){delete _0x332304[_0x270f('0x24')];}_0x433b55[_0x270f('0x15')](_0x2fe3af)['send'](_0x332304);};}exports[_0x270f('0x25')]=function(_0x241322,_0x1442a3){var _0x202cf0={},_0x41ad81={},_0x537573={'count':0x0,'rows':[]};var _0x132130=_['map'](db[_0x270f('0x26')]['rawAttributes'],function(_0x5df94c){return{'name':_0x5df94c[_0x270f('0x27')],'type':_0x5df94c[_0x270f('0x28')][_0x270f('0x29')]};});_0x41ad81[_0x270f('0x2a')]=_[_0x270f('0x2b')](_0x132130,_0x270f('0x24'));_0x41ad81[_0x270f('0x2c')]=_[_0x270f('0x2d')](_0x241322[_0x270f('0x2c')]);_0x41ad81[_0x270f('0x2e')]=_[_0x270f('0x2f')](_0x41ad81[_0x270f('0x2a')],_0x41ad81['query']);_0x202cf0[_0x270f('0x30')]=_[_0x270f('0x2f')](_0x41ad81[_0x270f('0x2a')],qs[_0x270f('0x31')](_0x241322[_0x270f('0x2c')][_0x270f('0x31')]));_0x202cf0[_0x270f('0x30')]=_0x202cf0[_0x270f('0x30')][_0x270f('0x32')]?_0x202cf0[_0x270f('0x30')]:_0x41ad81['model'];if(!_0x241322[_0x270f('0x2c')][_0x270f('0x33')](_0x270f('0x34'))){_0x202cf0[_0x270f('0x19')]=qs[_0x270f('0x19')](_0x241322[_0x270f('0x2c')][_0x270f('0x19')]);_0x202cf0[_0x270f('0x1b')]=qs[_0x270f('0x1b')](_0x241322['query']['offset']);}_0x202cf0[_0x270f('0x35')]=qs[_0x270f('0x36')](_0x241322[_0x270f('0x2c')]['sort']);_0x202cf0[_0x270f('0x37')]=qs[_0x270f('0x2e')](_[_0x270f('0x38')](_0x241322[_0x270f('0x2c')],_0x41ad81[_0x270f('0x2e')]),_0x132130);if(_0x241322[_0x270f('0x2c')]['filter']){_0x202cf0['where']=_[_0x270f('0x39')](_0x202cf0[_0x270f('0x37')],{'$or':_['map'](_0x132130,function(_0x1bf918){if(_0x1bf918[_0x270f('0x28')]!==_0x270f('0x3a')){var _0x5f5200={};_0x5f5200[_0x1bf918[_0x270f('0x24')]]={'$like':'%'+_0x241322[_0x270f('0x2c')]['filter']+'%'};return _0x5f5200;}})});}_0x202cf0=_['merge']({},_0x202cf0,_0x241322['options']);var _0x4019b6={'where':_0x202cf0['where']};return db['Migration'][_0x270f('0x1a')](_0x4019b6)['then'](function(_0x3f2be){_0x537573[_0x270f('0x1a')]=_0x3f2be;if(_0x241322[_0x270f('0x2c')]['includeAll']){_0x202cf0[_0x270f('0x3b')]=[{'all':!![]}];}return db[_0x270f('0x26')]['findAll'](_0x202cf0);})[_0x270f('0x22')](function(_0x217ef8){_0x537573[_0x270f('0x3c')]=_0x217ef8;return _0x537573;})['then'](respondWithFilteredResult(_0x1442a3,_0x202cf0))[_0x270f('0x3d')](handleError(_0x1442a3,null));}; \ No newline at end of file +var _0x28fa=['error','stack','name','Migration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','then'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x28fa,0x12e));var _0xa28f=function(_0x167f1e,_0x4d1c46){_0x167f1e=_0x167f1e-0x0;var _0x10bc6f=_0x28fa[_0x167f1e];return _0x10bc6f;};'use strict';var emlformat=require(_0xa28f('0x0'));var rimraf=require(_0xa28f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa28f('0x2'));var rp=require(_0xa28f('0x3'));var moment=require(_0xa28f('0x4'));var BPromise=require(_0xa28f('0x5'));var Mustache=require(_0xa28f('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa28f('0x7'));var csv=require(_0xa28f('0x8'));var ejs=require(_0xa28f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa28f('0xa'));var squel=require('squel');var crypto=require(_0xa28f('0xb'));var jsforce=require(_0xa28f('0xc'));var deskjs=require(_0xa28f('0xd'));var toCsv=require(_0xa28f('0x8'));var querystring=require(_0xa28f('0xe'));var Papa=require(_0xa28f('0xf'));var Redis=require(_0xa28f('0x10'));var authService=require(_0xa28f('0x11'));var qs=require(_0xa28f('0x12'));var as=require(_0xa28f('0x13'));var hardwareService=require(_0xa28f('0x14'));var logger=require(_0xa28f('0x15'))(_0xa28f('0x16'));var utils=require(_0xa28f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa28f('0x18'));var db=require(_0xa28f('0x19'))['db'];function respondWithStatusCode(_0x2cdd33,_0x514f8a){_0x514f8a=_0x514f8a||0xcc;return function(_0x128fa4){if(_0x128fa4){return _0x2cdd33[_0xa28f('0x1a')](_0x514f8a);}return _0x2cdd33[_0xa28f('0x1b')](_0x514f8a)[_0xa28f('0x1c')]();};}function respondWithResult(_0x2c9b6a,_0x3603ec){_0x3603ec=_0x3603ec||0xc8;return function(_0xb8c4de){if(_0xb8c4de){return _0x2c9b6a[_0xa28f('0x1b')](_0x3603ec)['json'](_0xb8c4de);}};}function respondWithFilteredResult(_0x417bf9,_0x3230fc){return function(_0x3bc46d){if(_0x3bc46d){var _0x32312c=typeof _0x3230fc[_0xa28f('0x1d')]===_0xa28f('0x1e')&&typeof _0x3230fc[_0xa28f('0x1f')]===_0xa28f('0x1e');var _0x5b913a=_0x3bc46d['count'];var _0x3bf5fd=_0x32312c?0x0:_0x3230fc['offset'];var _0x1fac00=_0x32312c?_0x3bc46d[_0xa28f('0x20')]:_0x3230fc[_0xa28f('0x1d')]+_0x3230fc[_0xa28f('0x1f')];var _0x4b4fa9;if(_0x1fac00>=_0x5b913a){_0x1fac00=_0x5b913a;_0x4b4fa9=0xc8;}else{_0x4b4fa9=0xce;}_0x417bf9[_0xa28f('0x1b')](_0x4b4fa9);return _0x417bf9['set'](_0xa28f('0x21'),_0x3bf5fd+'-'+_0x1fac00+'/'+_0x5b913a)[_0xa28f('0x22')](_0x3bc46d);}return null;};}function patchUpdates(_0x5e9a13){return function(_0xe69e2c){try{jsonpatch['apply'](_0xe69e2c,_0x5e9a13,!![]);}catch(_0xa8c2df){return BPromise[_0xa28f('0x23')](_0xa8c2df);}return _0xe69e2c[_0xa28f('0x24')]();};}function saveUpdates(_0x26bac9,_0x34f498){return function(_0x17e9a8){if(_0x17e9a8){return _0x17e9a8['update'](_0x26bac9)[_0xa28f('0x25')](function(_0x287b7f){return _0x287b7f;});}return null;};}function removeEntity(_0x499bc3,_0x3466d4){return function(_0x411aab){if(_0x411aab){return _0x411aab['destroy']()['then'](function(){_0x499bc3['status'](0xcc)[_0xa28f('0x1c')]();});}};}function handleEntityNotFound(_0x9f3123,_0x3a9a43){return function(_0x3d152a){if(!_0x3d152a){_0x9f3123['sendStatus'](0x194);}return _0x3d152a;};}function handleError(_0x3f29ec,_0x2e0bfa){_0x2e0bfa=_0x2e0bfa||0x1f4;return function(_0x1e68cd){logger[_0xa28f('0x26')](_0x1e68cd[_0xa28f('0x27')]);if(_0x1e68cd['name']){delete _0x1e68cd[_0xa28f('0x28')];}_0x3f29ec[_0xa28f('0x1b')](_0x2e0bfa)['send'](_0x1e68cd);};}exports['index']=function(_0x4c206f,_0x7475e0){var _0x5af461={},_0x16bed4={},_0x18d285={'count':0x0,'rows':[]};var _0x3811c9=_['map'](db[_0xa28f('0x29')][_0xa28f('0x2a')],function(_0x28fc98){return{'name':_0x28fc98[_0xa28f('0x2b')],'type':_0x28fc98[_0xa28f('0x2c')][_0xa28f('0x2d')]};});_0x16bed4[_0xa28f('0x2e')]=_['map'](_0x3811c9,_0xa28f('0x28'));_0x16bed4['query']=_[_0xa28f('0x2f')](_0x4c206f[_0xa28f('0x30')]);_0x16bed4[_0xa28f('0x31')]=_[_0xa28f('0x32')](_0x16bed4[_0xa28f('0x2e')],_0x16bed4[_0xa28f('0x30')]);_0x5af461[_0xa28f('0x33')]=_[_0xa28f('0x32')](_0x16bed4['model'],qs[_0xa28f('0x34')](_0x4c206f[_0xa28f('0x30')][_0xa28f('0x34')]));_0x5af461[_0xa28f('0x33')]=_0x5af461[_0xa28f('0x33')]['length']?_0x5af461[_0xa28f('0x33')]:_0x16bed4[_0xa28f('0x2e')];if(!_0x4c206f['query'][_0xa28f('0x35')](_0xa28f('0x36'))){_0x5af461['limit']=qs[_0xa28f('0x1f')](_0x4c206f['query']['limit']);_0x5af461['offset']=qs[_0xa28f('0x1d')](_0x4c206f[_0xa28f('0x30')][_0xa28f('0x1d')]);}_0x5af461[_0xa28f('0x37')]=qs['sort'](_0x4c206f[_0xa28f('0x30')][_0xa28f('0x38')]);_0x5af461[_0xa28f('0x39')]=qs['filters'](_[_0xa28f('0x3a')](_0x4c206f[_0xa28f('0x30')],_0x16bed4[_0xa28f('0x31')]),_0x3811c9);if(_0x4c206f[_0xa28f('0x30')][_0xa28f('0x3b')]){_0x5af461[_0xa28f('0x39')]=_[_0xa28f('0x3c')](_0x5af461['where'],{'$or':_[_0xa28f('0x3d')](_0x3811c9,function(_0x36253b){if(_0x36253b[_0xa28f('0x2c')]!==_0xa28f('0x3e')){var _0x27c602={};_0x27c602[_0x36253b[_0xa28f('0x28')]]={'$like':'%'+_0x4c206f[_0xa28f('0x30')][_0xa28f('0x3b')]+'%'};return _0x27c602;}})});}_0x5af461=_[_0xa28f('0x3c')]({},_0x5af461,_0x4c206f[_0xa28f('0x3f')]);var _0xdf634c={'where':_0x5af461['where']};return db[_0xa28f('0x29')]['count'](_0xdf634c)[_0xa28f('0x25')](function(_0x425cde){_0x18d285['count']=_0x425cde;if(_0x4c206f['query']['includeAll']){_0x5af461[_0xa28f('0x40')]=[{'all':!![]}];}return db[_0xa28f('0x29')][_0xa28f('0x41')](_0x5af461);})[_0xa28f('0x25')](function(_0x175991){_0x18d285[_0xa28f('0x42')]=_0x175991;return _0x18d285;})[_0xa28f('0x25')](respondWithFilteredResult(_0x7475e0,_0x5af461))[_0xa28f('0x43')](handleError(_0x7475e0,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index fca0087..e2e7d7a 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 _0x64fa=['moment','rimraf','./migration.attributes','exports','Migration','lodash','util','../../config/logger'];(function(_0x4cdc7c,_0x522a62){var _0x54d7f6=function(_0x243ee8){while(--_0x243ee8){_0x4cdc7c['push'](_0x4cdc7c['shift']());}};_0x54d7f6(++_0x522a62);}(_0x64fa,0x15d));var _0xa64f=function(_0x5f59eb,_0x5af101){_0x5f59eb=_0x5f59eb-0x0;var _0xa2f58f=_0x64fa[_0x5f59eb];return _0xa2f58f;};'use strict';var _=require(_0xa64f('0x0'));var util=require(_0xa64f('0x1'));var logger=require(_0xa64f('0x2'))('api');var moment=require(_0xa64f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa64f('0x4'));var config=require('../../config/environment');var attributes=require(_0xa64f('0x5'));module[_0xa64f('0x6')]=function(_0x12e8cf,_0x5948e3){return _0x12e8cf['define'](_0xa64f('0x7'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70b1=['Migration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports'];(function(_0x169c9b,_0x413a54){var _0x5315dc=function(_0x40c827){while(--_0x40c827){_0x169c9b['push'](_0x169c9b['shift']());}};_0x5315dc(++_0x413a54);}(_0x70b1,0x175));var _0x170b=function(_0x2bbd7c,_0x40c3ca){_0x2bbd7c=_0x2bbd7c-0x0;var _0x389621=_0x70b1[_0x2bbd7c];return _0x389621;};'use strict';var _=require('lodash');var util=require(_0x170b('0x0'));var logger=require(_0x170b('0x1'))(_0x170b('0x2'));var moment=require(_0x170b('0x3'));var BPromise=require(_0x170b('0x4'));var rp=require(_0x170b('0x5'));var fs=require('fs');var path=require(_0x170b('0x6'));var rimraf=require(_0x170b('0x7'));var config=require(_0x170b('0x8'));var attributes=require(_0x170b('0x9'));module[_0x170b('0xa')]=function(_0x4eb4f6,_0x2ffd9f){return _0x4eb4f6['define'](_0x170b('0xb'),attributes,{'tableName':'migrations','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 bcda81b..db74fd5 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 _0x6931=['info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x10df1e,_0xf56f85){var _0x3e24fb=function(_0x5cdb59){while(--_0x5cdb59){_0x10df1e['push'](_0x10df1e['shift']());}};_0x3e24fb(++_0xf56f85);}(_0x6931,0xa5));var _0x1693=function(_0x2fa0b,_0x12626f){_0x2fa0b=_0x2fa0b-0x0;var _0x5e37ec=_0x6931[_0x2fa0b];return _0x5e37ec;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1693('0x2'));var fs=require('fs');var Redis=require(_0x1693('0x3'));var db=require(_0x1693('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1693('0x5'))(_0x1693('0x6'));var config=require(_0x1693('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1693('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3594e0,_0x45aa35,_0x328cfc){return new BPromise(function(_0x2ab0a0,_0x31bff8){return client[_0x1693('0x9')](_0x3594e0,_0x328cfc)[_0x1693('0xa')](function(_0x391134){logger[_0x1693('0xb')](_0x1693('0xc'),_0x45aa35,_0x1693('0xd'));logger[_0x1693('0xe')](_0x1693('0xf'),_0x45aa35,_0x1693('0xd'),JSON[_0x1693('0x10')](_0x391134));if(_0x391134[_0x1693('0x11')]){if(_0x391134['error'][_0x1693('0x12')]===0x1f4){logger['error'](_0x1693('0xc'),_0x45aa35,_0x391134[_0x1693('0x11')]['message']);return _0x31bff8(_0x391134[_0x1693('0x11')][_0x1693('0x13')]);}logger[_0x1693('0x11')]('Migration,\x20%s,\x20%s',_0x45aa35,_0x391134[_0x1693('0x11')][_0x1693('0x13')]);return _0x2ab0a0(_0x391134[_0x1693('0x11')][_0x1693('0x13')]);}else{logger[_0x1693('0xb')](_0x1693('0xc'),_0x45aa35,_0x1693('0xd'));_0x2ab0a0(_0x391134[_0x1693('0x14')][_0x1693('0x13')]);}})[_0x1693('0x15')](function(_0x59cbff){logger[_0x1693('0x11')]('Migration,\x20%s,\x20%s',_0x45aa35,_0x59cbff);_0x31bff8(_0x59cbff);});});} \ No newline at end of file +var _0xac4a=['Migration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xac4a,0x13f));var _0xaac4=function(_0x2786ce,_0x469db0){_0x2786ce=_0x2786ce-0x0;var _0x2f0cbb=_0xac4a[_0x2786ce];return _0x2f0cbb;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('Migration,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('Migration,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 8d85a41..0820813 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 _0xac6a=['../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2486f5,_0x22f747){var _0xea7ef4=function(_0x1918e8){while(--_0x1918e8){_0x2486f5['push'](_0x2486f5['shift']());}};_0xea7ef4(++_0x22f747);}(_0xac6a,0xc2));var _0xaac6=function(_0x171336,_0x363aea){_0x171336=_0x171336-0x0;var _0x3c50bb=_0xac6a[_0x171336];return _0x3c50bb;};'use strict';var multer=require(_0xaac6('0x0'));var util=require(_0xaac6('0x1'));var path=require(_0xaac6('0x2'));var timeout=require(_0xaac6('0x3'));var express=require(_0xaac6('0x4'));var router=express['Router']();var fs_extra=require(_0xaac6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaac6('0x6'));var config=require(_0xaac6('0x7'));var controller=require(_0xaac6('0x8'));router[_0xaac6('0x9')]('/',auth[_0xaac6('0xa')](),controller[_0xaac6('0xb')]);router[_0xaac6('0x9')](_0xaac6('0xc'),auth[_0xaac6('0xa')](),controller[_0xaac6('0xd')]);router[_0xaac6('0xe')]('/',auth[_0xaac6('0xa')](),controller['create']);router[_0xaac6('0xf')](_0xaac6('0xc'),auth[_0xaac6('0xa')](),controller[_0xaac6('0x10')]);router[_0xaac6('0x11')](_0xaac6('0xc'),auth['isAuthenticated'](),controller[_0xaac6('0x12')]);module[_0xaac6('0x13')]=router; \ No newline at end of file +var _0xd065=['isAuthenticated','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./network.controller','index','get','/:id'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0xd065,0xba));var _0x5d06=function(_0x407999,_0x26ed30){_0x407999=_0x407999-0x0;var _0x25c83d=_0xd065[_0x407999];return _0x25c83d;};'use strict';var multer=require(_0x5d06('0x0'));var util=require(_0x5d06('0x1'));var path=require(_0x5d06('0x2'));var timeout=require(_0x5d06('0x3'));var express=require(_0x5d06('0x4'));var router=express[_0x5d06('0x5')]();var fs_extra=require(_0x5d06('0x6'));var auth=require(_0x5d06('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5d06('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5d06('0x9')]);router[_0x5d06('0xa')](_0x5d06('0xb'),auth[_0x5d06('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5d06('0xd')]);router[_0x5d06('0xe')](_0x5d06('0xb'),auth[_0x5d06('0xc')](),controller[_0x5d06('0xf')]);router['delete'](_0x5d06('0xb'),auth[_0x5d06('0xc')](),controller[_0x5d06('0x10')]);module[_0x5d06('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 962e654..75f1a95 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 _0x4774=['localnet','externip','stun','turn','STRING','sequelize','exports','ENUM'];(function(_0x49a36e,_0x3636ba){var _0x3ce2f4=function(_0x254893){while(--_0x254893){_0x49a36e['push'](_0x49a36e['shift']());}};_0x3ce2f4(++_0x3636ba);}(_0x4774,0x15d));var _0x4477=function(_0x1a2304,_0x1603fd){_0x1a2304=_0x1a2304-0x0;var _0x4f9bc9=_0x4774[_0x1a2304];return _0x4f9bc9;};'use strict';var Sequelize=require(_0x4477('0x0'));module[_0x4477('0x1')]={'type':{'type':Sequelize[_0x4477('0x2')](_0x4477('0x3'),_0x4477('0x4'),_0x4477('0x5'),_0x4477('0x6'))},'value':{'type':Sequelize[_0x4477('0x7')]},'username':{'type':Sequelize[_0x4477('0x7')]},'password':{'type':Sequelize[_0x4477('0x7')]}}; \ No newline at end of file +var _0x2287=['stun','turn','STRING','sequelize','exports'];(function(_0x43ca97,_0x1ffb45){var _0xe16e1b=function(_0x5c66e7){while(--_0x5c66e7){_0x43ca97['push'](_0x43ca97['shift']());}};_0xe16e1b(++_0x1ffb45);}(_0x2287,0x120));var _0x7228=function(_0x2699d7,_0x41d731){_0x2699d7=_0x2699d7-0x0;var _0x350f71=_0x2287[_0x2699d7];return _0x350f71;};'use strict';var Sequelize=require(_0x7228('0x0'));module[_0x7228('0x1')]={'type':{'type':Sequelize['ENUM']('localnet','externip',_0x7228('0x2'),_0x7228('0x3'))},'value':{'type':Sequelize[_0x7228('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x7228('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 1c7a81b..11af58a 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 _0xe607=['utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','body','toLowerCase','chan_sip.so','TURN','destroy','util','path','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','info','result','status','limit','undefined','count','offset','set','update','end','sendStatus','stack','name','map','Network','fieldName','key','model','keys','query','intersection','fields','length','attributes','nolimit','order','sort','where','filters','pick','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','find','create','type','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','server/files/templates/turn_multiple.ejs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe607,0x106));var _0x7e60=function(_0x3ee8bf,_0x38d216){_0x3ee8bf=_0x3ee8bf-0x0;var _0x163629=_0xe607[_0x3ee8bf];return _0x163629;};'use strict';var util=require(_0x7e60('0x0'));var path=require(_0x7e60('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7e60('0x2'));var qs=require(_0x7e60('0x3'));var logger=require(_0x7e60('0x4'))('api');var config=require(_0x7e60('0x5'));var db=require(_0x7e60('0x6'))['db'];var jayson=require(_0x7e60('0x7'));var client=jayson[_0x7e60('0x8')][_0x7e60('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26a932,_0x519d2f,_0x61913b,_0x50eb7c){return new Promise(function(_0xf11d2d,_0x426c83){var _0x20ba50=_0x50eb7c||client;return _0x20ba50['request'](_0x26a932,_0x61913b)[_0x7e60('0xa')](function(_0x431009){logger['info'](_0x7e60('0xb'),_0x519d2f,_0x7e60('0xc'));logger[_0x7e60('0xd')](_0x7e60('0xe'),_0x519d2f,_0x7e60('0xc'),JSON['stringify'](_0x431009));if(_0x431009[_0x7e60('0xf')]){if(_0x431009[_0x7e60('0xf')][_0x7e60('0x10')]===0x1f4){logger[_0x7e60('0xf')]('Network,\x20%s,\x20%s',_0x519d2f,_0x431009['error'][_0x7e60('0x11')]);return _0x426c83(_0x431009[_0x7e60('0xf')]['message']);}logger[_0x7e60('0xf')](_0x7e60('0xb'),_0x519d2f,_0x431009['error'][_0x7e60('0x11')]);return _0xf11d2d(_0x431009[_0x7e60('0xf')][_0x7e60('0x11')]);}else{logger[_0x7e60('0x12')](_0x7e60('0xb'),_0x519d2f,'request\x20sent');_0xf11d2d(_0x431009[_0x7e60('0x13')][_0x7e60('0x11')]);}})['catch'](function(_0x22e0dc){logger[_0x7e60('0xf')]('Network,\x20%s,\x20%s',_0x519d2f,_0x22e0dc);_0x426c83(_0x22e0dc);});});}function respondWithResult(_0x1a3ddc,_0x1b470a){_0x1b470a=_0x1b470a||0xc8;return function(_0x26ff13){if(_0x26ff13){return _0x1a3ddc[_0x7e60('0x14')](_0x1b470a)['json'](_0x26ff13);}};}function respondWithFilteredResult(_0x24dcae,_0x4da7dd){return function(_0x4c4cf5){if(_0x4c4cf5){var _0x13a4c5=typeof _0x4da7dd['offset']==='undefined'&&typeof _0x4da7dd[_0x7e60('0x15')]===_0x7e60('0x16');var _0x1e9a1a=_0x4c4cf5[_0x7e60('0x17')];var _0x424e3d=_0x13a4c5?0x0:_0x4da7dd[_0x7e60('0x18')];var _0x440973=_0x13a4c5?_0x4c4cf5['count']:_0x4da7dd[_0x7e60('0x18')]+_0x4da7dd[_0x7e60('0x15')];var _0x248da7;if(_0x440973>=_0x1e9a1a){_0x440973=_0x1e9a1a;_0x248da7=0xc8;}else{_0x248da7=0xce;}_0x24dcae[_0x7e60('0x14')](_0x248da7);return _0x24dcae[_0x7e60('0x19')]('Content-Range',_0x424e3d+'-'+_0x440973+'/'+_0x1e9a1a)['json'](_0x4c4cf5);}return null;};}function saveUpdates(_0x4de9dd){return function(_0x592fcc){if(_0x592fcc){return _0x592fcc[_0x7e60('0x1a')](_0x4de9dd)['then'](function(_0x354ee1){return _0x354ee1;});}return null;};}function removeEntity(_0x3e4cbd){return function(_0x29166e){if(_0x29166e){return _0x29166e['destroy']()[_0x7e60('0xa')](function(){_0x3e4cbd[_0x7e60('0x14')](0xcc)[_0x7e60('0x1b')]();});}};}function handleEntityNotFound(_0x3d03ad){return function(_0xc82231){if(!_0xc82231){_0x3d03ad[_0x7e60('0x1c')](0x194);}return _0xc82231;};}function handleError(_0x3d05a6,_0x2449bf){_0x2449bf=_0x2449bf||0x1f4;return function(_0x561987){logger[_0x7e60('0xf')](_0x561987[_0x7e60('0x1d')]);if(_0x561987[_0x7e60('0x1e')]){delete _0x561987[_0x7e60('0x1e')];}_0x3d05a6['status'](_0x2449bf)['send'](_0x561987);};}exports['index']=function(_0x367f8f,_0x20ac16){var _0x2bee1f={},_0x3e7727={},_0x57d6e0={'count':0x0,'rows':[]};var _0x48e36d=_[_0x7e60('0x1f')](db[_0x7e60('0x20')]['rawAttributes'],function(_0x55e133){return{'name':_0x55e133[_0x7e60('0x21')],'type':_0x55e133['type'][_0x7e60('0x22')]};});_0x3e7727[_0x7e60('0x23')]=_['map'](_0x48e36d,_0x7e60('0x1e'));_0x3e7727['query']=_[_0x7e60('0x24')](_0x367f8f[_0x7e60('0x25')]);_0x3e7727['filters']=_[_0x7e60('0x26')](_0x3e7727[_0x7e60('0x23')],_0x3e7727[_0x7e60('0x25')]);_0x2bee1f['attributes']=_[_0x7e60('0x26')](_0x3e7727[_0x7e60('0x23')],qs[_0x7e60('0x27')](_0x367f8f['query'][_0x7e60('0x27')]));_0x2bee1f['attributes']=_0x2bee1f['attributes'][_0x7e60('0x28')]?_0x2bee1f[_0x7e60('0x29')]:_0x3e7727[_0x7e60('0x23')];if(!_0x367f8f[_0x7e60('0x25')]['hasOwnProperty'](_0x7e60('0x2a'))){_0x2bee1f[_0x7e60('0x15')]=qs[_0x7e60('0x15')](_0x367f8f[_0x7e60('0x25')]['limit']);_0x2bee1f[_0x7e60('0x18')]=qs[_0x7e60('0x18')](_0x367f8f[_0x7e60('0x25')][_0x7e60('0x18')]);}_0x2bee1f[_0x7e60('0x2b')]=qs[_0x7e60('0x2c')](_0x367f8f[_0x7e60('0x25')][_0x7e60('0x2c')]);_0x2bee1f[_0x7e60('0x2d')]=qs[_0x7e60('0x2e')](_[_0x7e60('0x2f')](_0x367f8f['query'],_0x3e7727[_0x7e60('0x2e')]),_0x48e36d);if(_0x367f8f['query']['filter']){_0x2bee1f[_0x7e60('0x2d')]=_['merge'](_0x2bee1f[_0x7e60('0x2d')],{'$or':_[_0x7e60('0x1f')](_0x48e36d,function(_0x53842b){if(_0x53842b['type']!==_0x7e60('0x30')){var _0x26c1ab={};_0x26c1ab[_0x53842b[_0x7e60('0x1e')]]={'$like':'%'+_0x367f8f['query']['filter']+'%'};return _0x26c1ab;}})});}_0x2bee1f=_['merge']({},_0x2bee1f,_0x367f8f[_0x7e60('0x31')]);var _0x253274={'where':_0x2bee1f[_0x7e60('0x2d')]};return db[_0x7e60('0x20')][_0x7e60('0x17')](_0x253274)[_0x7e60('0xa')](function(_0x34763d){_0x57d6e0['count']=_0x34763d;if(_0x367f8f[_0x7e60('0x25')][_0x7e60('0x32')]){_0x2bee1f[_0x7e60('0x33')]=[{'all':!![]}];}return db['Network'][_0x7e60('0x34')](_0x2bee1f);})['then'](function(_0x4d519f){_0x57d6e0[_0x7e60('0x35')]=_0x4d519f;return _0x57d6e0;})[_0x7e60('0xa')](respondWithFilteredResult(_0x20ac16,_0x2bee1f))[_0x7e60('0x36')](handleError(_0x20ac16,null));};exports[_0x7e60('0x37')]=function(_0x3ab049,_0x28618d){var _0x257381={'raw':!![],'where':{'id':_0x3ab049[_0x7e60('0x38')]['id']}},_0xd1394f={};_0xd1394f[_0x7e60('0x23')]=_['keys'](db[_0x7e60('0x20')][_0x7e60('0x39')]);_0xd1394f['query']=_[_0x7e60('0x24')](_0x3ab049[_0x7e60('0x25')]);_0xd1394f[_0x7e60('0x2e')]=_['intersection'](_0xd1394f[_0x7e60('0x23')],_0xd1394f[_0x7e60('0x25')]);_0x257381[_0x7e60('0x29')]=_['intersection'](_0xd1394f[_0x7e60('0x23')],qs['fields'](_0x3ab049[_0x7e60('0x25')][_0x7e60('0x27')]));_0x257381['attributes']=_0x257381[_0x7e60('0x29')][_0x7e60('0x28')]?_0x257381[_0x7e60('0x29')]:_0xd1394f[_0x7e60('0x23')];if(_0x3ab049[_0x7e60('0x25')][_0x7e60('0x32')]){_0x257381[_0x7e60('0x33')]=[{'all':!![]}];}_0x257381=_[_0x7e60('0x3a')]({},_0x257381,_0x3ab049[_0x7e60('0x31')]);return db[_0x7e60('0x20')][_0x7e60('0x3b')](_0x257381)[_0x7e60('0xa')](handleEntityNotFound(_0x28618d,null))['then'](respondWithResult(_0x28618d,null))[_0x7e60('0x36')](handleError(_0x28618d,null));};exports[_0x7e60('0x3c')]=function(_0x4330ba,_0x44f5a4){var _0x4019b9;return db[_0x7e60('0x20')]['create'](_0x4330ba['body'],{'raw':!![]})[_0x7e60('0xa')](function(_0x1e3b38){_0x4019b9=_0x1e3b38;return db[_0x7e60('0x20')][_0x7e60('0x34')]({'where':{'type':_0x4330ba['body'][_0x7e60('0x3d')]},'raw':!![]});})[_0x7e60('0xa')](function(_0x1a3bb4){if(_0x4019b9['type']['toUpperCase']()==_0x7e60('0x3e')){var _0xbde01d=fs[_0x7e60('0x3f')](path[_0x7e60('0x40')](config[_0x7e60('0x41')],_0x7e60('0x42')),'utf8');var _0x44a7e5=ejs[_0x7e60('0x43')](_0xbde01d,{'networks':_0x1a3bb4||[]});fs[_0x7e60('0x44')](_0x7e60('0x45'),_0x44a7e5);return respondWithRpcPromise(_0x7e60('0x46'),_0x7e60('0x3c'),{'module':_0x7e60('0x47')});}else if(_0x4019b9[_0x7e60('0x3d')][_0x7e60('0x48')]()=='TURN'){var _0x558aeb=fs[_0x7e60('0x3f')](path[_0x7e60('0x40')](config[_0x7e60('0x41')],_0x7e60('0x49')),_0x7e60('0x4a'));var _0x51cedd=ejs[_0x7e60('0x43')](_0x558aeb,{'networks':_0x1a3bb4||[]});fs[_0x7e60('0x44')](_0x7e60('0x4b'),_0x51cedd);return respondWithRpcPromise(_0x7e60('0x46'),'create',{'module':'res_stun_monitor.so'});}else{var _0x46ec84=fs[_0x7e60('0x3f')](path[_0x7e60('0x40')](config[_0x7e60('0x41')],_0x7e60('0x4c')),'utf8');var _0x298dba=ejs['render'](_0x46ec84,{'networks':_0x1a3bb4||[]});fs['writeFileSync'](util[_0x7e60('0x4d')](_0x7e60('0x4e'),_0x4330ba[_0x7e60('0x4f')][_0x7e60('0x3d')][_0x7e60('0x50')]()),_0x298dba);return respondWithRpcPromise(_0x7e60('0x46'),_0x7e60('0x3c'),{'module':_0x7e60('0x51')});}})[_0x7e60('0xa')](function(){return _0x4019b9;})[_0x7e60('0xa')](respondWithResult(_0x44f5a4,0xc9))[_0x7e60('0x36')](handleError(_0x44f5a4,null));};exports[_0x7e60('0x1a')]=function(_0xedf0de,_0x18bdae){var _0x4ba404;return db[_0x7e60('0x20')]['find']({'where':{'id':_0xedf0de[_0x7e60('0x38')]['id']}})[_0x7e60('0xa')](handleEntityNotFound(_0x18bdae,null))['then'](saveUpdates(_0xedf0de[_0x7e60('0x4f')],null))[_0x7e60('0xa')](function(_0x2ef46b){if(_0x2ef46b){_0x4ba404=_0x2ef46b;return db[_0x7e60('0x20')][_0x7e60('0x34')]({'where':{'type':_0x4ba404['type']},'raw':!![]});}return null;})[_0x7e60('0xa')](function(_0x1c4b9c){if(_0x4ba404[_0x7e60('0x3d')][_0x7e60('0x48')]()==_0x7e60('0x3e')){var _0x5943a3=fs[_0x7e60('0x3f')](path[_0x7e60('0x40')](config[_0x7e60('0x41')],'server/files/templates/stun_multiple.ejs'),_0x7e60('0x4a'));var _0x1a3657=ejs[_0x7e60('0x43')](_0x5943a3,{'networks':_0x1c4b9c||[]});fs[_0x7e60('0x44')](_0x7e60('0x45'),_0x1a3657);return respondWithRpcPromise(_0x7e60('0x46'),_0x7e60('0x1a'),{'module':_0x7e60('0x47')});}else if(_0x4ba404[_0x7e60('0x3d')][_0x7e60('0x48')]()==_0x7e60('0x52')){var _0x1a0375=fs[_0x7e60('0x3f')](path['join'](config[_0x7e60('0x41')],_0x7e60('0x49')),_0x7e60('0x4a'));var _0x4c733c=ejs['render'](_0x1a0375,{'networks':_0x1c4b9c||[]});fs[_0x7e60('0x44')]('/etc/asterisk/turn_xcally.conf',_0x4c733c);return respondWithRpcPromise(_0x7e60('0x46'),'update',{'module':_0x7e60('0x47')});}else{var _0x2d118d=fs[_0x7e60('0x3f')](path['join'](config[_0x7e60('0x41')],'server/files/templates/network.ejs'),_0x7e60('0x4a'));var _0x391a99=ejs[_0x7e60('0x43')](_0x2d118d,{'networks':_0x1c4b9c||[]});fs[_0x7e60('0x44')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0xedf0de[_0x7e60('0x4f')][_0x7e60('0x3d')][_0x7e60('0x50')]()),_0x391a99);return respondWithRpcPromise('Reload',_0x7e60('0x1a'),{'module':_0x7e60('0x51')});}})[_0x7e60('0xa')](function(_0x3071ca){if(_0x3071ca){return _0x4ba404;}return null;})[_0x7e60('0xa')](respondWithResult(_0x18bdae,null))[_0x7e60('0x36')](handleError(_0x18bdae,null));};exports[_0x7e60('0x53')]=function(_0x546687,_0x29f22c){var _0x3e3311;return db[_0x7e60('0x20')][_0x7e60('0x3b')]({'where':{'id':_0x546687['params']['id']}})[_0x7e60('0xa')](function(_0x39f67b){_0x3e3311=_0x39f67b;return _0x39f67b;})[_0x7e60('0xa')](handleEntityNotFound(_0x29f22c,null))[_0x7e60('0xa')](removeEntity(_0x29f22c,null))[_0x7e60('0xa')](function(){if(_0x3e3311){return db[_0x7e60('0x20')][_0x7e60('0x34')]({'where':{'type':_0x3e3311[_0x7e60('0x3d')]},'raw':!![]});}})[_0x7e60('0xa')](function(_0xd47c6){if(_0x3e3311['type'][_0x7e60('0x48')]()==_0x7e60('0x3e')){var _0x3d5416=fs[_0x7e60('0x3f')](path[_0x7e60('0x40')](config['root'],_0x7e60('0x42')),_0x7e60('0x4a'));var _0x4f2e27=ejs[_0x7e60('0x43')](_0x3d5416,{'networks':_0xd47c6||[]});fs['writeFileSync'](_0x7e60('0x45'),_0x4f2e27);return respondWithRpcPromise(_0x7e60('0x46'),'destroy',{'module':_0x7e60('0x47')});}else if(_0x3e3311[_0x7e60('0x3d')]['toUpperCase']()==_0x7e60('0x52')){var _0x4efece=fs['readFileSync'](path[_0x7e60('0x40')](config[_0x7e60('0x41')],_0x7e60('0x49')),_0x7e60('0x4a'));var _0x51cc1b=ejs[_0x7e60('0x43')](_0x4efece,{'networks':_0xd47c6||[]});fs[_0x7e60('0x44')](_0x7e60('0x4b'),_0x51cc1b);return respondWithRpcPromise('Reload',_0x7e60('0x53'),{'module':'res_stun_monitor.so'});}else{var _0x3c9737=fs[_0x7e60('0x3f')](path[_0x7e60('0x40')](config['root'],_0x7e60('0x4c')),_0x7e60('0x4a'));var _0x15819b=ejs[_0x7e60('0x43')](_0x3c9737,{'networks':_0xd47c6||[]});fs[_0x7e60('0x44')](util[_0x7e60('0x4d')](_0x7e60('0x4e'),_0x3e3311['type'][_0x7e60('0x50')]()),_0x15819b);return respondWithRpcPromise(_0x7e60('0x46'),_0x7e60('0x53'),{'module':_0x7e60('0x51')});}})[_0x7e60('0x36')](handleError(_0x29f22c,null));}; \ No newline at end of file +var _0x074b=['index','map','Network','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','params','keys','find','create','body','toUpperCase','join','root','utf8','render','writeFileSync','Reload','TURN','readFileSync','server/files/templates/turn_multiple.ejs','res_stun_monitor.so','server/files/templates/network.ejs','toLowerCase','STUN','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','/etc/asterisk/turn_xcally.conf','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','format','path','ejs','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','client','http','request','then','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','offset','undefined','count','limit','Content-Range','json','update','destroy','status','sendStatus','stack','name','send'];(function(_0x3f6254,_0x57d818){var _0x2b4626=function(_0x225002){while(--_0x225002){_0x3f6254['push'](_0x3f6254['shift']());}};_0x2b4626(++_0x57d818);}(_0x074b,0x1cc));var _0xb074=function(_0x48807d,_0x57b994){_0x48807d=_0x48807d-0x0;var _0x255499=_0x074b[_0x48807d];return _0x255499;};'use strict';var util=require('util');var path=require(_0xb074('0x0'));var ejs=require(_0xb074('0x1'));var fs=require('fs');var _=require(_0xb074('0x2'));var qs=require(_0xb074('0x3'));var logger=require(_0xb074('0x4'))('api');var config=require('../../config/environment');var db=require(_0xb074('0x5'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb074('0x6')][_0xb074('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x310a75,_0x45dce9,_0x41712d,_0xed0054){return new Promise(function(_0x57a63d,_0x346a7b){var _0x1c76e9=_0xed0054||client;return _0x1c76e9[_0xb074('0x8')](_0x310a75,_0x41712d)[_0xb074('0x9')](function(_0x563a63){logger['info'](_0xb074('0xa'),_0x45dce9,'request\x20sent');logger[_0xb074('0xb')](_0xb074('0xc'),_0x45dce9,_0xb074('0xd'),JSON['stringify'](_0x563a63));if(_0x563a63[_0xb074('0xe')]){if(_0x563a63[_0xb074('0xe')]['code']===0x1f4){logger[_0xb074('0xe')](_0xb074('0xa'),_0x45dce9,_0x563a63[_0xb074('0xe')]['message']);return _0x346a7b(_0x563a63[_0xb074('0xe')][_0xb074('0xf')]);}logger[_0xb074('0xe')](_0xb074('0xa'),_0x45dce9,_0x563a63['error'][_0xb074('0xf')]);return _0x57a63d(_0x563a63[_0xb074('0xe')][_0xb074('0xf')]);}else{logger[_0xb074('0x10')](_0xb074('0xa'),_0x45dce9,_0xb074('0xd'));_0x57a63d(_0x563a63[_0xb074('0x11')][_0xb074('0xf')]);}})[_0xb074('0x12')](function(_0x31ae9b){logger[_0xb074('0xe')](_0xb074('0xa'),_0x45dce9,_0x31ae9b);_0x346a7b(_0x31ae9b);});});}function respondWithResult(_0x504482,_0x1c2361){_0x1c2361=_0x1c2361||0xc8;return function(_0x4d65b5){if(_0x4d65b5){return _0x504482['status'](_0x1c2361)['json'](_0x4d65b5);}};}function respondWithFilteredResult(_0x2ceca0,_0x8d6fcd){return function(_0x2fb288){if(_0x2fb288){var _0x37746a=typeof _0x8d6fcd[_0xb074('0x13')]===_0xb074('0x14')&&typeof _0x8d6fcd['limit']==='undefined';var _0x23c4dc=_0x2fb288[_0xb074('0x15')];var _0x3de040=_0x37746a?0x0:_0x8d6fcd[_0xb074('0x13')];var _0x501cf5=_0x37746a?_0x2fb288[_0xb074('0x15')]:_0x8d6fcd[_0xb074('0x13')]+_0x8d6fcd[_0xb074('0x16')];var _0x4c6c8d;if(_0x501cf5>=_0x23c4dc){_0x501cf5=_0x23c4dc;_0x4c6c8d=0xc8;}else{_0x4c6c8d=0xce;}_0x2ceca0['status'](_0x4c6c8d);return _0x2ceca0['set'](_0xb074('0x17'),_0x3de040+'-'+_0x501cf5+'/'+_0x23c4dc)[_0xb074('0x18')](_0x2fb288);}return null;};}function saveUpdates(_0x2b5787){return function(_0x27d306){if(_0x27d306){return _0x27d306[_0xb074('0x19')](_0x2b5787)[_0xb074('0x9')](function(_0xffb1c7){return _0xffb1c7;});}return null;};}function removeEntity(_0x21090e){return function(_0x4dc34f){if(_0x4dc34f){return _0x4dc34f[_0xb074('0x1a')]()[_0xb074('0x9')](function(){_0x21090e[_0xb074('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a5029){return function(_0x34a5ba){if(!_0x34a5ba){_0x5a5029[_0xb074('0x1c')](0x194);}return _0x34a5ba;};}function handleError(_0xe8f165,_0x4ee580){_0x4ee580=_0x4ee580||0x1f4;return function(_0x29e52d){logger[_0xb074('0xe')](_0x29e52d[_0xb074('0x1d')]);if(_0x29e52d[_0xb074('0x1e')]){delete _0x29e52d[_0xb074('0x1e')];}_0xe8f165[_0xb074('0x1b')](_0x4ee580)[_0xb074('0x1f')](_0x29e52d);};}exports[_0xb074('0x20')]=function(_0x4c34a8,_0x553387){var _0x11a8c7={},_0x14cd7c={},_0x4af43a={'count':0x0,'rows':[]};var _0x590f0b=_[_0xb074('0x21')](db[_0xb074('0x22')][_0xb074('0x23')],function(_0x4c65c6){return{'name':_0x4c65c6['fieldName'],'type':_0x4c65c6['type'][_0xb074('0x24')]};});_0x14cd7c[_0xb074('0x25')]=_[_0xb074('0x21')](_0x590f0b,_0xb074('0x1e'));_0x14cd7c['query']=_['keys'](_0x4c34a8[_0xb074('0x26')]);_0x14cd7c[_0xb074('0x27')]=_[_0xb074('0x28')](_0x14cd7c[_0xb074('0x25')],_0x14cd7c[_0xb074('0x26')]);_0x11a8c7[_0xb074('0x29')]=_[_0xb074('0x28')](_0x14cd7c['model'],qs[_0xb074('0x2a')](_0x4c34a8[_0xb074('0x26')][_0xb074('0x2a')]));_0x11a8c7['attributes']=_0x11a8c7[_0xb074('0x29')][_0xb074('0x2b')]?_0x11a8c7[_0xb074('0x29')]:_0x14cd7c[_0xb074('0x25')];if(!_0x4c34a8[_0xb074('0x26')][_0xb074('0x2c')](_0xb074('0x2d'))){_0x11a8c7[_0xb074('0x16')]=qs[_0xb074('0x16')](_0x4c34a8[_0xb074('0x26')]['limit']);_0x11a8c7[_0xb074('0x13')]=qs[_0xb074('0x13')](_0x4c34a8[_0xb074('0x26')]['offset']);}_0x11a8c7[_0xb074('0x2e')]=qs[_0xb074('0x2f')](_0x4c34a8[_0xb074('0x26')][_0xb074('0x2f')]);_0x11a8c7[_0xb074('0x30')]=qs['filters'](_[_0xb074('0x31')](_0x4c34a8[_0xb074('0x26')],_0x14cd7c[_0xb074('0x27')]),_0x590f0b);if(_0x4c34a8[_0xb074('0x26')][_0xb074('0x32')]){_0x11a8c7[_0xb074('0x30')]=_[_0xb074('0x33')](_0x11a8c7[_0xb074('0x30')],{'$or':_[_0xb074('0x21')](_0x590f0b,function(_0x5cb487){if(_0x5cb487[_0xb074('0x34')]!==_0xb074('0x35')){var _0x341f36={};_0x341f36[_0x5cb487[_0xb074('0x1e')]]={'$like':'%'+_0x4c34a8[_0xb074('0x26')][_0xb074('0x32')]+'%'};return _0x341f36;}})});}_0x11a8c7=_[_0xb074('0x33')]({},_0x11a8c7,_0x4c34a8[_0xb074('0x36')]);var _0x45caa0={'where':_0x11a8c7[_0xb074('0x30')]};return db['Network'][_0xb074('0x15')](_0x45caa0)[_0xb074('0x9')](function(_0x294b85){_0x4af43a[_0xb074('0x15')]=_0x294b85;if(_0x4c34a8[_0xb074('0x26')]['includeAll']){_0x11a8c7[_0xb074('0x37')]=[{'all':!![]}];}return db[_0xb074('0x22')][_0xb074('0x38')](_0x11a8c7);})[_0xb074('0x9')](function(_0x51769d){_0x4af43a['rows']=_0x51769d;return _0x4af43a;})[_0xb074('0x9')](respondWithFilteredResult(_0x553387,_0x11a8c7))[_0xb074('0x12')](handleError(_0x553387,null));};exports['show']=function(_0x53709d,_0x35be7b){var _0x2f3a67={'raw':!![],'where':{'id':_0x53709d[_0xb074('0x39')]['id']}},_0x1064f5={};_0x1064f5[_0xb074('0x25')]=_[_0xb074('0x3a')](db['Network']['rawAttributes']);_0x1064f5['query']=_[_0xb074('0x3a')](_0x53709d[_0xb074('0x26')]);_0x1064f5[_0xb074('0x27')]=_[_0xb074('0x28')](_0x1064f5[_0xb074('0x25')],_0x1064f5[_0xb074('0x26')]);_0x2f3a67['attributes']=_[_0xb074('0x28')](_0x1064f5[_0xb074('0x25')],qs[_0xb074('0x2a')](_0x53709d[_0xb074('0x26')][_0xb074('0x2a')]));_0x2f3a67[_0xb074('0x29')]=_0x2f3a67[_0xb074('0x29')][_0xb074('0x2b')]?_0x2f3a67[_0xb074('0x29')]:_0x1064f5[_0xb074('0x25')];if(_0x53709d[_0xb074('0x26')]['includeAll']){_0x2f3a67['include']=[{'all':!![]}];}_0x2f3a67=_[_0xb074('0x33')]({},_0x2f3a67,_0x53709d[_0xb074('0x36')]);return db[_0xb074('0x22')][_0xb074('0x3b')](_0x2f3a67)[_0xb074('0x9')](handleEntityNotFound(_0x35be7b,null))[_0xb074('0x9')](respondWithResult(_0x35be7b,null))[_0xb074('0x12')](handleError(_0x35be7b,null));};exports['create']=function(_0x47ac8a,_0x929aef){var _0x523940;return db['Network'][_0xb074('0x3c')](_0x47ac8a['body'],{'raw':!![]})[_0xb074('0x9')](function(_0x25eecc){_0x523940=_0x25eecc;return db['Network']['findAll']({'where':{'type':_0x47ac8a[_0xb074('0x3d')]['type']},'raw':!![]});})[_0xb074('0x9')](function(_0x42ab92){if(_0x523940[_0xb074('0x34')][_0xb074('0x3e')]()=='STUN'){var _0x77bf20=fs['readFileSync'](path[_0xb074('0x3f')](config[_0xb074('0x40')],'server/files/templates/stun_multiple.ejs'),_0xb074('0x41'));var _0xca6f20=ejs[_0xb074('0x42')](_0x77bf20,{'networks':_0x42ab92||[]});fs[_0xb074('0x43')]('/etc/asterisk/stun_xcally.conf',_0xca6f20);return respondWithRpcPromise(_0xb074('0x44'),'create',{'module':'res_stun_monitor.so'});}else if(_0x523940['type'][_0xb074('0x3e')]()==_0xb074('0x45')){var _0x15922d=fs[_0xb074('0x46')](path['join'](config[_0xb074('0x40')],_0xb074('0x47')),_0xb074('0x41'));var _0x505169=ejs[_0xb074('0x42')](_0x15922d,{'networks':_0x42ab92||[]});fs[_0xb074('0x43')]('/etc/asterisk/turn_xcally.conf',_0x505169);return respondWithRpcPromise(_0xb074('0x44'),_0xb074('0x3c'),{'module':_0xb074('0x48')});}else{var _0x423ae5=fs[_0xb074('0x46')](path['join'](config['root'],_0xb074('0x49')),'utf8');var _0x235ad2=ejs['render'](_0x423ae5,{'networks':_0x42ab92||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x47ac8a[_0xb074('0x3d')][_0xb074('0x34')][_0xb074('0x4a')]()),_0x235ad2);return respondWithRpcPromise(_0xb074('0x44'),_0xb074('0x3c'),{'module':'chan_sip.so'});}})[_0xb074('0x9')](function(){return _0x523940;})[_0xb074('0x9')](respondWithResult(_0x929aef,0xc9))[_0xb074('0x12')](handleError(_0x929aef,null));};exports['update']=function(_0x3349e8,_0x271139){var _0x5b3a67;return db[_0xb074('0x22')][_0xb074('0x3b')]({'where':{'id':_0x3349e8[_0xb074('0x39')]['id']}})[_0xb074('0x9')](handleEntityNotFound(_0x271139,null))[_0xb074('0x9')](saveUpdates(_0x3349e8[_0xb074('0x3d')],null))['then'](function(_0x56ec76){if(_0x56ec76){_0x5b3a67=_0x56ec76;return db[_0xb074('0x22')][_0xb074('0x38')]({'where':{'type':_0x5b3a67[_0xb074('0x34')]},'raw':!![]});}return null;})[_0xb074('0x9')](function(_0x2fa091){if(_0x5b3a67[_0xb074('0x34')][_0xb074('0x3e')]()==_0xb074('0x4b')){var _0xc56fff=fs[_0xb074('0x46')](path[_0xb074('0x3f')](config['root'],_0xb074('0x4c')),_0xb074('0x41'));var _0x24042d=ejs[_0xb074('0x42')](_0xc56fff,{'networks':_0x2fa091||[]});fs['writeFileSync'](_0xb074('0x4d'),_0x24042d);return respondWithRpcPromise(_0xb074('0x44'),_0xb074('0x19'),{'module':_0xb074('0x48')});}else if(_0x5b3a67['type'][_0xb074('0x3e')]()=='TURN'){var _0x172597=fs['readFileSync'](path[_0xb074('0x3f')](config['root'],_0xb074('0x47')),_0xb074('0x41'));var _0x5ab405=ejs[_0xb074('0x42')](_0x172597,{'networks':_0x2fa091||[]});fs[_0xb074('0x43')](_0xb074('0x4e'),_0x5ab405);return respondWithRpcPromise(_0xb074('0x44'),_0xb074('0x19'),{'module':'res_stun_monitor.so'});}else{var _0x312dd7=fs[_0xb074('0x46')](path[_0xb074('0x3f')](config['root'],_0xb074('0x49')),'utf8');var _0x3c3ea4=ejs[_0xb074('0x42')](_0x312dd7,{'networks':_0x2fa091||[]});fs[_0xb074('0x43')](util['format'](_0xb074('0x4f'),_0x3349e8[_0xb074('0x3d')][_0xb074('0x34')][_0xb074('0x4a')]()),_0x3c3ea4);return respondWithRpcPromise(_0xb074('0x44'),'update',{'module':_0xb074('0x50')});}})[_0xb074('0x9')](function(_0x23faa0){if(_0x23faa0){return _0x5b3a67;}return null;})['then'](respondWithResult(_0x271139,null))[_0xb074('0x12')](handleError(_0x271139,null));};exports['destroy']=function(_0x542edc,_0x33464e){var _0x341ecb;return db[_0xb074('0x22')][_0xb074('0x3b')]({'where':{'id':_0x542edc[_0xb074('0x39')]['id']}})[_0xb074('0x9')](function(_0x593460){_0x341ecb=_0x593460;return _0x593460;})[_0xb074('0x9')](handleEntityNotFound(_0x33464e,null))[_0xb074('0x9')](removeEntity(_0x33464e,null))['then'](function(){if(_0x341ecb){return db[_0xb074('0x22')][_0xb074('0x38')]({'where':{'type':_0x341ecb[_0xb074('0x34')]},'raw':!![]});}})[_0xb074('0x9')](function(_0x2c4a01){if(_0x341ecb[_0xb074('0x34')]['toUpperCase']()==_0xb074('0x4b')){var _0x5881ef=fs[_0xb074('0x46')](path[_0xb074('0x3f')](config[_0xb074('0x40')],_0xb074('0x4c')),_0xb074('0x41'));var _0x4db37b=ejs[_0xb074('0x42')](_0x5881ef,{'networks':_0x2c4a01||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x4db37b);return respondWithRpcPromise(_0xb074('0x44'),_0xb074('0x1a'),{'module':_0xb074('0x48')});}else if(_0x341ecb['type'][_0xb074('0x3e')]()==_0xb074('0x45')){var _0x4aefe2=fs[_0xb074('0x46')](path[_0xb074('0x3f')](config[_0xb074('0x40')],'server/files/templates/turn_multiple.ejs'),_0xb074('0x41'));var _0x2297e4=ejs[_0xb074('0x42')](_0x4aefe2,{'networks':_0x2c4a01||[]});fs[_0xb074('0x43')](_0xb074('0x4e'),_0x2297e4);return respondWithRpcPromise(_0xb074('0x44'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0xa9f380=fs[_0xb074('0x46')](path[_0xb074('0x3f')](config['root'],_0xb074('0x49')),_0xb074('0x41'));var _0x50a9db=ejs[_0xb074('0x42')](_0xa9f380,{'networks':_0x2c4a01||[]});fs['writeFileSync'](util[_0xb074('0x51')](_0xb074('0x4f'),_0x341ecb[_0xb074('0x34')][_0xb074('0x4a')]()),_0x50a9db);return respondWithRpcPromise('Reload','destroy',{'module':_0xb074('0x50')});}})[_0xb074('0x12')](handleError(_0x33464e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index fbd6d53..fa61ac4 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 _0x9aea=['Network','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./network.attributes','exports','define'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x9aea,0xdd));var _0xa9ae=function(_0x4c00f7,_0x385cb0){_0x4c00f7=_0x4c00f7-0x0;var _0xc5d495=_0x9aea[_0x4c00f7];return _0xc5d495;};'use strict';var _=require(_0xa9ae('0x0'));var util=require('util');var logger=require(_0xa9ae('0x1'))('api');var moment=require(_0xa9ae('0x2'));var BPromise=require(_0xa9ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9ae('0x4'));var rimraf=require(_0xa9ae('0x5'));var config=require(_0xa9ae('0x6'));var attributes=require(_0xa9ae('0x7'));module[_0xa9ae('0x8')]=function(_0x56f942,_0x1aa3b9){return _0x56f942[_0xa9ae('0x9')](_0xa9ae('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57f8=['Network','network','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0x57f8,0x198));var _0x857f=function(_0x50f92b,_0x32fab3){_0x50f92b=_0x50f92b-0x0;var _0x5cedbc=_0x57f8[_0x50f92b];return _0x5cedbc;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var logger=require(_0x857f('0x1'))(_0x857f('0x2'));var moment=require(_0x857f('0x3'));var BPromise=require(_0x857f('0x4'));var rp=require(_0x857f('0x5'));var fs=require('fs');var path=require(_0x857f('0x6'));var rimraf=require(_0x857f('0x7'));var config=require(_0x857f('0x8'));var attributes=require(_0x857f('0x9'));module[_0x857f('0xa')]=function(_0x369c40,_0x5d22e4){return _0x369c40[_0x857f('0xb')](_0x857f('0xc'),attributes,{'tableName':_0x857f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index dc21f1c..b3d52e2 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(_0x2d8d09,_0x9a8422){var _0x1d7689=function(_0x4e647b){while(--_0x4e647b){_0x2d8d09['push'](_0x2d8d09['shift']());}};_0x1d7689(++_0x9a8422);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x1a76ee,_0x4f125e){_0x1a76ee=_0x1a76ee-0x0;var _0x2125fe=_0x7a54[_0x1a76ee];return _0x2125fe;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 11eb0d2..fa619de 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 _0x4137=['/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','/:id/users','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','/:id','show','getDispositions'];(function(_0x41d705,_0x1a52af){var _0x23f6a6=function(_0xdbe6ed){while(--_0xdbe6ed){_0x41d705['push'](_0x41d705['shift']());}};_0x23f6a6(++_0x1a52af);}(_0x4137,0xf8));var _0x7413=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4137[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0xb')]('/:id/dispositions',auth[_0x7413('0xe')](),controller[_0x7413('0x11')]);router[_0x7413('0xb')](_0x7413('0x12'),auth[_0x7413('0xe')](),controller['getAnswers']);router[_0x7413('0xb')](_0x7413('0x13'),auth['isAuthenticated'](),controller[_0x7413('0x14')]);router[_0x7413('0xb')](_0x7413('0x15'),auth['isAuthenticated'](),controller['getInteractions']);router['get'](_0x7413('0x16'),auth[_0x7413('0xe')](),controller['getAgents']);router[_0x7413('0x17')]('/',auth[_0x7413('0xe')](),controller['create']);router[_0x7413('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7413('0x18')]);router['post'](_0x7413('0x12'),auth['isAuthenticated'](),controller[_0x7413('0x19')]);router[_0x7413('0x17')](_0x7413('0x1a'),controller[_0x7413('0x1b')]);router[_0x7413('0x17')](_0x7413('0x13'),auth['isAuthenticated'](),controller[_0x7413('0x1c')]);router[_0x7413('0x17')](_0x7413('0x16'),auth[_0x7413('0xe')](),controller['addAgents']);router[_0x7413('0x17')](_0x7413('0x1d'),auth[_0x7413('0xe')](),controller[_0x7413('0x1e')]);router[_0x7413('0x1f')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x20')]);router['delete']('/:id',auth[_0x7413('0xe')](),controller['destroy']);router[_0x7413('0x21')](_0x7413('0x22'),auth[_0x7413('0xe')](),controller[_0x7413('0x23')]);router[_0x7413('0x21')](_0x7413('0x12'),auth[_0x7413('0xe')](),controller[_0x7413('0x24')]);router[_0x7413('0x21')]('/:id/users',auth['isAuthenticated'](),controller[_0x7413('0x25')]);module['exports']=router; \ No newline at end of file +var _0xb78e=['index','get','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition','/:id/notify','/:id/send','send','put','/:id','update','delete','removeDispositions','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated'];(function(_0x359a51,_0x3fbc94){var _0x111f17=function(_0x1bdd44){while(--_0x1bdd44){_0x359a51['push'](_0x359a51['shift']());}};_0x111f17(++_0x3fbc94);}(_0xb78e,0x1c9));var _0xeb78=function(_0xd3a447,_0x38205a){_0xd3a447=_0xd3a447-0x0;var _0x358853=_0xb78e[_0xd3a447];return _0x358853;};'use strict';var multer=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var path=require('path');var timeout=require(_0xeb78('0x2'));var express=require(_0xeb78('0x3'));var router=express[_0xeb78('0x4')]();var fs_extra=require(_0xeb78('0x5'));var auth=require(_0xeb78('0x6'));var interaction=require(_0xeb78('0x7'));var config=require(_0xeb78('0x8'));var controller=require(_0xeb78('0x9'));router['get']('/',auth[_0xeb78('0xa')](),controller[_0xeb78('0xb')]);router[_0xeb78('0xc')](_0xeb78('0xd'),auth[_0xeb78('0xa')](),controller[_0xeb78('0xe')]);router[_0xeb78('0xc')]('/:id',auth[_0xeb78('0xa')](),controller[_0xeb78('0xf')]);router[_0xeb78('0xc')](_0xeb78('0x10'),auth[_0xeb78('0xa')](),controller[_0xeb78('0x11')]);router[_0xeb78('0xc')](_0xeb78('0x12'),auth[_0xeb78('0xa')](),controller['getAnswers']);router[_0xeb78('0xc')](_0xeb78('0x13'),auth[_0xeb78('0xa')](),controller[_0xeb78('0x14')]);router[_0xeb78('0xc')](_0xeb78('0x15'),auth[_0xeb78('0xa')](),controller[_0xeb78('0x16')]);router[_0xeb78('0xc')](_0xeb78('0x17'),auth['isAuthenticated'](),controller[_0xeb78('0x18')]);router[_0xeb78('0x19')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xeb78('0x10'),auth['isAuthenticated'](),controller[_0xeb78('0x1a')]);router[_0xeb78('0x19')]('/:id/canned_answers',auth[_0xeb78('0xa')](),controller['addAnswer']);router[_0xeb78('0x19')](_0xeb78('0x1b'),controller['notify']);router[_0xeb78('0x19')](_0xeb78('0x13'),auth[_0xeb78('0xa')](),controller['addApplications']);router[_0xeb78('0x19')](_0xeb78('0x17'),auth['isAuthenticated'](),controller['addAgents']);router[_0xeb78('0x19')](_0xeb78('0x1c'),auth[_0xeb78('0xa')](),controller[_0xeb78('0x1d')]);router[_0xeb78('0x1e')](_0xeb78('0x1f'),auth[_0xeb78('0xa')](),controller[_0xeb78('0x20')]);router[_0xeb78('0x21')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xeb78('0x10'),auth['isAuthenticated'](),controller[_0xeb78('0x22')]);router[_0xeb78('0x21')]('/:id/canned_answers',auth[_0xeb78('0xa')](),controller['removeAnswers']);router[_0xeb78('0x21')](_0xeb78('0x17'),auth[_0xeb78('0xa')](),controller[_0xeb78('0x23')]);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 c15c8de..1b82820 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 _0xad5d=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate'];(function(_0x9b58de,_0x112666){var _0x5d4637=function(_0x508d4d){while(--_0x508d4d){_0x9b58de['push'](_0x9b58de['shift']());}};_0x5d4637(++_0x112666);}(_0xad5d,0xbb));var _0xdad5=function(_0x4a16c7,_0x3fce36){_0x4a16c7=_0x4a16c7-0x0;var _0x850c78=_0xad5d[_0x4a16c7];return _0x850c78;};'use strict';var Sequelize=require(_0xdad5('0x0'));var rs=require(_0xdad5('0x1'));module[_0xdad5('0x2')]={'name':{'type':Sequelize[_0xdad5('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xdad5('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xdad5('0x4')]();}},'replyUri':{'type':Sequelize[_0xdad5('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xdad5('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdad5('0x5');}},'notificationSound':{'type':Sequelize[_0xdad5('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdad5('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdad5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdad5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xdad5('0x3')]},'queueTransfer':{'type':Sequelize[_0xdad5('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdad5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdad5('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdad5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdad5('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xdad5('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xdad5('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x17132f){if(!_0x17132f)this['setDataValue'](_0xdad5('0x9'),null);this[_0xdad5('0xa')](_0xdad5('0xb'),_0x17132f);}}}; \ No newline at end of file +var _0x30c9=['setDataValue','mandatoryDisposition','randomstring','exports','name','STRING','generate','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(_0x2ae78b,_0x2b4f73){var _0xc0e963=function(_0x3341b0){while(--_0x3341b0){_0x2ae78b['push'](_0x2ae78b['shift']());}};_0xc0e963(++_0x2b4f73);}(_0x30c9,0x116));var _0x930c=function(_0x1715c4,_0x47e693){_0x1715c4=_0x1715c4-0x0;var _0x9a84ea=_0x30c9[_0x1715c4];return _0x9a84ea;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x930c('0x0'));module[_0x930c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x930c('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x930c('0x3')],'defaultValue':function(){return rs[_0x930c('0x4')]();}},'replyUri':{'type':Sequelize[_0x930c('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x930c('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x930c('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x930c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x930c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x930c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x930c('0x3')]},'queueTransfer':{'type':Sequelize[_0x930c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x930c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x930c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x930c('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x930c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x930c('0x6')],'defaultValue':![],'comment':_0x930c('0x9'),'set':function(_0x4d093b){if(!_0x4d093b)this[_0x930c('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x930c('0xb'),_0x4d093b);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f474f9c..b95ce48 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 _0x0619=['json','limit','undefined','count','offset','set','Content-Range','apply','save','then','destroy','get','stack','name','index','OpenchannelAccount','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','show','params','Pause','rawAttributes','include','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','mandatoryDispositionPause','describe','OpenchannelAccountId','Disposition','findOne','nolimit','findAll','rows','removeDispositions','CannedAnswer','removeAnswers','ids','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','unshift','queue','Start','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Contact','User','Owner','fullname','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./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','end'];(function(_0x525209,_0x4293b7){var _0x5241b3=function(_0x27940b){while(--_0x27940b){_0x525209['push'](_0x525209['shift']());}};_0x5241b3(++_0x4293b7);}(_0x0619,0x90));var _0x9061=function(_0x20fca2,_0x5ee553){_0x20fca2=_0x20fca2-0x0;var _0x46378f=_0x0619[_0x20fca2];return _0x46378f;};'use strict';var emlformat=require(_0x9061('0x0'));var rimraf=require(_0x9061('0x1'));var zipdir=require(_0x9061('0x2'));var jsonpatch=require(_0x9061('0x3'));var rp=require('request-promise');var moment=require(_0x9061('0x4'));var BPromise=require(_0x9061('0x5'));var Mustache=require(_0x9061('0x6'));var util=require(_0x9061('0x7'));var path=require(_0x9061('0x8'));var sox=require(_0x9061('0x9'));var csv=require(_0x9061('0xa'));var ejs=require(_0x9061('0xb'));var fs=require('fs');var fs_extra=require(_0x9061('0xc'));var _=require(_0x9061('0xd'));var squel=require(_0x9061('0xe'));var crypto=require('crypto');var jsforce=require(_0x9061('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9061('0x10'));var Papa=require(_0x9061('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9061('0x12'));var as=require(_0x9061('0x13'));var hardwareService=require(_0x9061('0x14'));var logger=require(_0x9061('0x15'))(_0x9061('0x16'));var utils=require(_0x9061('0x17'));var config=require(_0x9061('0x18'));var licenseUtil=require(_0x9061('0x19'));var db=require(_0x9061('0x1a'))['db'];config[_0x9061('0x1b')]=_[_0x9061('0x1c')](config[_0x9061('0x1b')],{'host':_0x9061('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9061('0x1e'))[_0x9061('0x1f')](socket);var jayson=require(_0x9061('0x20'));var client=jayson[_0x9061('0x21')][_0x9061('0x22')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d8b2b,_0x4181ef,_0x4db624,_0x278016){return new BPromise(function(_0x4f2ea6,_0x1ea714){var _0x55e903=_0x278016||client;return _0x55e903[_0x9061('0x23')](_0x2d8b2b,_0x4db624)['then'](function(_0xe89ff2){logger[_0x9061('0x24')](_0x9061('0x25'),_0x4181ef,_0x9061('0x26'));logger[_0x9061('0x27')](_0x9061('0x28'),_0x4181ef,_0x9061('0x26'),JSON[_0x9061('0x29')](_0xe89ff2));if(_0xe89ff2['error']){if(_0xe89ff2[_0x9061('0x2a')][_0x9061('0x2b')]===0x1f4){logger[_0x9061('0x2a')](_0x9061('0x25'),_0x4181ef,_0xe89ff2['error'][_0x9061('0x2c')]);return _0x1ea714(_0xe89ff2[_0x9061('0x2a')]['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4181ef,_0xe89ff2[_0x9061('0x2a')][_0x9061('0x2c')]);return _0x4f2ea6(_0xe89ff2['error']['message']);}else{logger[_0x9061('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x4181ef,'request\x20sent');_0x4f2ea6(_0xe89ff2[_0x9061('0x2d')][_0x9061('0x2c')]);}})[_0x9061('0x2e')](function(_0x17825b){logger[_0x9061('0x2a')](_0x9061('0x25'),_0x4181ef,_0x17825b);_0x1ea714(_0x17825b);});});}function respondWithStatusCode(_0x445d8b,_0x2cbb4f){_0x2cbb4f=_0x2cbb4f||0xcc;return function(_0x2b57bb){if(_0x2b57bb){return _0x445d8b[_0x9061('0x2f')](_0x2cbb4f);}return _0x445d8b[_0x9061('0x30')](_0x2cbb4f)[_0x9061('0x31')]();};}function respondWithResult(_0x5aac14,_0x5bf4f4){_0x5bf4f4=_0x5bf4f4||0xc8;return function(_0x1aad05){if(_0x1aad05){return _0x5aac14[_0x9061('0x30')](_0x5bf4f4)[_0x9061('0x32')](_0x1aad05);}};}function respondWithFilteredResult(_0x163ff2,_0x4231ed){return function(_0x5981c2){if(_0x5981c2){var _0x2355d3=typeof _0x4231ed['offset']==='undefined'&&typeof _0x4231ed[_0x9061('0x33')]===_0x9061('0x34');var _0x9a8304=_0x5981c2[_0x9061('0x35')];var _0x230a29=_0x2355d3?0x0:_0x4231ed[_0x9061('0x36')];var _0x3c29d1=_0x2355d3?_0x5981c2[_0x9061('0x35')]:_0x4231ed[_0x9061('0x36')]+_0x4231ed[_0x9061('0x33')];var _0x29804f;if(_0x3c29d1>=_0x9a8304){_0x3c29d1=_0x9a8304;_0x29804f=0xc8;}else{_0x29804f=0xce;}_0x163ff2['status'](_0x29804f);return _0x163ff2[_0x9061('0x37')](_0x9061('0x38'),_0x230a29+'-'+_0x3c29d1+'/'+_0x9a8304)['json'](_0x5981c2);}return null;};}function patchUpdates(_0x70754f){return function(_0x4b8e2f){try{jsonpatch[_0x9061('0x39')](_0x4b8e2f,_0x70754f,!![]);}catch(_0x58a1f3){return BPromise['reject'](_0x58a1f3);}return _0x4b8e2f[_0x9061('0x3a')]();};}function saveUpdates(_0x46eda3,_0x49672b){return function(_0x464674){if(_0x464674){return _0x464674['update'](_0x46eda3)[_0x9061('0x3b')](function(_0x3e8c34){return _0x3e8c34;});}return null;};}function removeEntity(_0x5e2db9,_0x47d883){return function(_0x1ee5d4){if(_0x1ee5d4){return _0x1ee5d4[_0x9061('0x3c')]()[_0x9061('0x3b')](function(){var _0x53672b=_0x1ee5d4[_0x9061('0x3d')]({'plain':!![]});var _0x308678='OpenchannelAccounts';return db['UserProfileResource'][_0x9061('0x3c')]({'where':{'type':_0x308678,'resourceId':_0x53672b['id']}})[_0x9061('0x3b')](function(){return _0x1ee5d4;});})['then'](function(){_0x5e2db9[_0x9061('0x30')](0xcc)[_0x9061('0x31')]();});}};}function handleEntityNotFound(_0x5f0476,_0x471238){return function(_0x170191){if(!_0x170191){_0x5f0476[_0x9061('0x2f')](0x194);}return _0x170191;};}function handleError(_0x2124de,_0x3e1580){_0x3e1580=_0x3e1580||0x1f4;return function(_0x382b39){logger[_0x9061('0x2a')](_0x382b39[_0x9061('0x3e')]);if(_0x382b39[_0x9061('0x3f')]){delete _0x382b39['name'];}_0x2124de[_0x9061('0x30')](_0x3e1580)['send'](_0x382b39);};}exports[_0x9061('0x40')]=function(_0x4e5228,_0x1696a7){var _0x12646a={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x177440={},_0x44384a={'count':0x0,'rows':[]};var _0x1f7428=_['map'](db[_0x9061('0x41')]['rawAttributes'],function(_0x134fa9){return{'name':_0x134fa9[_0x9061('0x42')],'type':_0x134fa9[_0x9061('0x43')][_0x9061('0x44')]};});_0x177440['model']=_[_0x9061('0x45')](_0x1f7428,_0x9061('0x3f'));_0x177440[_0x9061('0x46')]=_[_0x9061('0x47')](_0x4e5228[_0x9061('0x46')]);_0x177440[_0x9061('0x48')]=_[_0x9061('0x49')](_0x177440[_0x9061('0x4a')],_0x177440[_0x9061('0x46')]);_0x12646a[_0x9061('0x4b')]=_[_0x9061('0x49')](_0x177440[_0x9061('0x4a')],qs['fields'](_0x4e5228[_0x9061('0x46')][_0x9061('0x4c')]));_0x12646a[_0x9061('0x4b')]=_0x12646a[_0x9061('0x4b')][_0x9061('0x4d')]?_0x12646a['attributes']:_0x177440[_0x9061('0x4a')];if(!_0x4e5228[_0x9061('0x46')][_0x9061('0x4e')]('nolimit')){_0x12646a['limit']=qs[_0x9061('0x33')](_0x4e5228[_0x9061('0x46')]['limit']);_0x12646a['offset']=qs[_0x9061('0x36')](_0x4e5228[_0x9061('0x46')]['offset']);}_0x12646a[_0x9061('0x4f')]=qs[_0x9061('0x50')](_0x4e5228[_0x9061('0x46')][_0x9061('0x50')]);_0x12646a['where']=qs[_0x9061('0x48')](_[_0x9061('0x51')](_0x4e5228['query'],_0x177440[_0x9061('0x48')]),_0x1f7428);if(_0x4e5228[_0x9061('0x46')]['filter']){_0x12646a[_0x9061('0x52')]=_[_0x9061('0x53')](_0x12646a[_0x9061('0x52')],{'$or':_[_0x9061('0x45')](_0x1f7428,function(_0x36c0e6){if(_0x36c0e6['type']!==_0x9061('0x54')){var _0x4e215e={};_0x4e215e[_0x36c0e6[_0x9061('0x3f')]]={'$like':'%'+_0x4e5228[_0x9061('0x46')][_0x9061('0x55')]+'%'};return _0x4e215e;}})});}_0x12646a=_[_0x9061('0x53')]({},_0x12646a,_0x4e5228['options']);var _0x37bc8f={'where':_0x12646a[_0x9061('0x52')]};return db[_0x9061('0x41')][_0x9061('0x35')](_0x37bc8f)[_0x9061('0x3b')](function(_0x323f05){_0x44384a['count']=_0x323f05;if(_0x4e5228['query'][_0x9061('0x56')]){_0x12646a['include']=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x12646a);})[_0x9061('0x3b')](function(_0x33fab4){_0x44384a['rows']=_0x33fab4;return _0x44384a;})[_0x9061('0x3b')](respondWithFilteredResult(_0x1696a7,_0x12646a))[_0x9061('0x2e')](handleError(_0x1696a7,null));};exports[_0x9061('0x57')]=function(_0x6e67ad,_0x54be12){var _0x390c53={'raw':![],'where':{'id':_0x6e67ad[_0x9061('0x58')]['id']},'include':[{'model':db[_0x9061('0x59')],'as':'mandatoryDispositionPause'}]},_0x3d7d1d={};_0x3d7d1d[_0x9061('0x4a')]=_[_0x9061('0x47')](db[_0x9061('0x41')][_0x9061('0x5a')]);_0x3d7d1d[_0x9061('0x46')]=_[_0x9061('0x47')](_0x6e67ad[_0x9061('0x46')]);_0x3d7d1d[_0x9061('0x48')]=_[_0x9061('0x49')](_0x3d7d1d['model'],_0x3d7d1d[_0x9061('0x46')]);_0x390c53[_0x9061('0x4b')]=_[_0x9061('0x49')](_0x3d7d1d['model'],qs[_0x9061('0x4c')](_0x6e67ad['query'][_0x9061('0x4c')]));_0x390c53[_0x9061('0x4b')]=_0x390c53[_0x9061('0x4b')][_0x9061('0x4d')]?_0x390c53[_0x9061('0x4b')]:_0x3d7d1d[_0x9061('0x4a')];if(_0x6e67ad[_0x9061('0x46')][_0x9061('0x56')]){_0x390c53[_0x9061('0x5b')]=[{'all':!![]}];}_0x390c53=_[_0x9061('0x53')]({},_0x390c53,_0x6e67ad[_0x9061('0x5c')]);return db['OpenchannelAccount'][_0x9061('0x5d')](_0x390c53)[_0x9061('0x3b')](handleEntityNotFound(_0x54be12,null))[_0x9061('0x3b')](respondWithResult(_0x54be12,null))[_0x9061('0x2e')](handleError(_0x54be12,null));};exports[_0x9061('0x5e')]=function(_0x181c34,_0x12dc79){return db[_0x9061('0x41')][_0x9061('0x5e')](_0x181c34[_0x9061('0x5f')],{})[_0x9061('0x3b')](function(_0x22d676){var _0x289cd9=_0x181c34['user'][_0x9061('0x3d')]({'plain':!![]});if(!_0x289cd9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x289cd9[_0x9061('0x60')]===_0x9061('0x61')){var _0x24a84c=_0x22d676['get']({'plain':!![]});var _0x22ed72='OpenchannelAccounts';return db[_0x9061('0x62')][_0x9061('0x5d')]({'where':{'name':_0x22ed72,'userProfileId':_0x289cd9[_0x9061('0x63')]},'raw':!![]})[_0x9061('0x3b')](function(_0x8e8ce5){if(_0x8e8ce5&&_0x8e8ce5[_0x9061('0x64')]===0x0){return db[_0x9061('0x65')]['create']({'name':_0x24a84c[_0x9061('0x3f')],'resourceId':_0x24a84c['id'],'type':_0x8e8ce5['name'],'sectionId':_0x8e8ce5['id']},{})['then'](function(){return _0x22d676;});}else{return _0x22d676;}})[_0x9061('0x2e')](function(_0x4de06c){logger[_0x9061('0x2a')](_0x9061('0x66'),_0x4de06c);throw _0x4de06c;});}return _0x22d676;})[_0x9061('0x3b')](respondWithResult(_0x12dc79,0xc9))[_0x9061('0x2e')](handleError(_0x12dc79,null));};exports[_0x9061('0x67')]=function(_0x4ced00,_0x4bc3e5){if(_0x4ced00['body']['id']){delete _0x4ced00[_0x9061('0x5f')]['id'];}return db['OpenchannelAccount'][_0x9061('0x5d')]({'where':{'id':_0x4ced00[_0x9061('0x58')]['id']},'include':[{'model':db[_0x9061('0x59')],'as':_0x9061('0x68')}]})[_0x9061('0x3b')](handleEntityNotFound(_0x4bc3e5,null))[_0x9061('0x3b')](saveUpdates(_0x4ced00[_0x9061('0x5f')],null))[_0x9061('0x3b')](respondWithResult(_0x4bc3e5,null))[_0x9061('0x2e')](handleError(_0x4bc3e5,null));};exports[_0x9061('0x3c')]=function(_0x51de0e,_0x57c7d8){return db['OpenchannelAccount']['find']({'where':{'id':_0x51de0e[_0x9061('0x58')]['id']}})[_0x9061('0x3b')](handleEntityNotFound(_0x57c7d8,null))['then'](removeEntity(_0x57c7d8,null))['catch'](handleError(_0x57c7d8,null));};exports[_0x9061('0x69')]=function(_0x3704f0,_0x4519d2){return db['OpenchannelAccount'][_0x9061('0x69')]()[_0x9061('0x3b')](respondWithResult(_0x4519d2,null))['catch'](handleError(_0x4519d2,null));};exports['addDisposition']=function(_0x3f6917,_0x59330e,_0x2ed4c5){if(_0x3f6917[_0x9061('0x5f')]['id']){delete _0x3f6917[_0x9061('0x5f')]['id'];}return db[_0x9061('0x41')][_0x9061('0x5d')]({'where':{'id':_0x3f6917[_0x9061('0x58')]['id']}})[_0x9061('0x3b')](handleEntityNotFound(_0x59330e,null))[_0x9061('0x3b')](function(_0x1e2d0d){if(_0x1e2d0d){_0x3f6917['body'][_0x9061('0x6a')]=_0x1e2d0d['id'];return db[_0x9061('0x6b')][_0x9061('0x5e')](_0x3f6917[_0x9061('0x5f')]);}})[_0x9061('0x3b')](respondWithResult(_0x59330e,null))[_0x9061('0x2e')](handleError(_0x59330e,null));};exports['getDispositions']=function(_0x5a8077,_0x13f64b,_0x1a0887){var _0x3d323e={'raw':![],'where':{}};var _0x4323d3={};var _0x418277={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x9061('0x6c')]({'where':{'id':_0x5a8077['params']['id']}})[_0x9061('0x3b')](handleEntityNotFound(_0x13f64b,null))['then'](function(_0x594280){if(_0x594280){_0x4323d3[_0x9061('0x4a')]=_[_0x9061('0x47')](db[_0x9061('0x6b')][_0x9061('0x5a')]);_0x4323d3[_0x9061('0x46')]=_[_0x9061('0x47')](_0x5a8077['query']);_0x4323d3[_0x9061('0x48')]=_['intersection'](_0x4323d3[_0x9061('0x4a')],_0x4323d3[_0x9061('0x46')]);_0x3d323e[_0x9061('0x4b')]=_[_0x9061('0x49')](_0x4323d3[_0x9061('0x4a')],qs[_0x9061('0x4c')](_0x5a8077[_0x9061('0x46')][_0x9061('0x4c')]));_0x3d323e['attributes']=_0x3d323e[_0x9061('0x4b')][_0x9061('0x4d')]?_0x3d323e['attributes']:_0x4323d3['model'];if(!_0x5a8077[_0x9061('0x46')][_0x9061('0x4e')](_0x9061('0x6d'))){_0x3d323e['limit']=qs[_0x9061('0x33')](_0x5a8077[_0x9061('0x46')][_0x9061('0x33')]);_0x3d323e['offset']=qs[_0x9061('0x36')](_0x5a8077[_0x9061('0x46')][_0x9061('0x36')]);}_0x3d323e[_0x9061('0x4f')]=qs[_0x9061('0x50')](_0x5a8077[_0x9061('0x46')][_0x9061('0x50')]);_0x3d323e[_0x9061('0x52')]=qs[_0x9061('0x48')](_[_0x9061('0x51')](_0x5a8077['query'],_0x4323d3[_0x9061('0x48')]));_0x3d323e[_0x9061('0x52')]['OpenchannelAccountId']=_0x594280['id'];if(_0x5a8077[_0x9061('0x46')][_0x9061('0x55')]){_0x3d323e['where']=_[_0x9061('0x53')](_0x3d323e[_0x9061('0x52')],{'$or':_['map'](_0x3d323e[_0x9061('0x4b')],function(_0x30c31a){var _0x58b399={};_0x58b399[_0x30c31a]={'$like':'%'+_0x5a8077[_0x9061('0x46')]['filter']+'%'};return _0x58b399;})});}_0x3d323e=_[_0x9061('0x53')]({},_0x3d323e,_0x5a8077[_0x9061('0x5c')]);return db[_0x9061('0x6b')][_0x9061('0x35')]({'where':_0x3d323e['where']})[_0x9061('0x3b')](function(_0x3eaf03){_0x418277[_0x9061('0x35')]=_0x3eaf03;if(_0x5a8077[_0x9061('0x46')][_0x9061('0x56')]){_0x3d323e['include']=[{'all':!![]}];}return db[_0x9061('0x6b')][_0x9061('0x6e')](_0x3d323e);})['then'](function(_0x495727){_0x418277[_0x9061('0x6f')]=_0x495727;return _0x418277;});}})[_0x9061('0x3b')](respondWithFilteredResult(_0x13f64b,_0x3d323e))['catch'](handleError(_0x13f64b,null));};exports[_0x9061('0x70')]=function(_0x2fab0f,_0x125a0b,_0x121103){return db[_0x9061('0x41')][_0x9061('0x5d')]({'where':{'id':_0x2fab0f[_0x9061('0x58')]['id']}})[_0x9061('0x3b')](handleEntityNotFound(_0x125a0b,null))[_0x9061('0x3b')](function(_0x1242fe){if(_0x1242fe){return _0x1242fe[_0x9061('0x70')](_0x2fab0f[_0x9061('0x46')]['ids']);}})[_0x9061('0x3b')](respondWithStatusCode(_0x125a0b,null))[_0x9061('0x2e')](handleError(_0x125a0b,null));};exports['addAnswer']=function(_0x1bf0b3,_0x1019e4,_0x3cefdd){if(_0x1bf0b3[_0x9061('0x5f')]['id']){delete _0x1bf0b3['body']['id'];}return db[_0x9061('0x41')][_0x9061('0x5d')]({'where':{'id':_0x1bf0b3[_0x9061('0x58')]['id']}})[_0x9061('0x3b')](handleEntityNotFound(_0x1019e4,null))[_0x9061('0x3b')](function(_0x52cb76){if(_0x52cb76){_0x1bf0b3[_0x9061('0x5f')][_0x9061('0x6a')]=_0x52cb76['id'];return db[_0x9061('0x71')]['create'](_0x1bf0b3[_0x9061('0x5f')]);}})[_0x9061('0x3b')](respondWithResult(_0x1019e4,null))[_0x9061('0x2e')](handleError(_0x1019e4,null));};exports['getAnswers']=function(_0x486166,_0x27f1a0,_0x26f219){var _0x17c49e={'raw':![],'where':{}};var _0x193f58={};var _0x93c2ef={'count':0x0,'rows':[]};return db[_0x9061('0x41')][_0x9061('0x6c')]({'where':{'id':_0x486166['params']['id']}})[_0x9061('0x3b')](handleEntityNotFound(_0x27f1a0,null))[_0x9061('0x3b')](function(_0x5a145e){if(_0x5a145e){_0x193f58['model']=_[_0x9061('0x47')](db['CannedAnswer'][_0x9061('0x5a')]);_0x193f58[_0x9061('0x46')]=_[_0x9061('0x47')](_0x486166[_0x9061('0x46')]);_0x193f58[_0x9061('0x48')]=_[_0x9061('0x49')](_0x193f58[_0x9061('0x4a')],_0x193f58[_0x9061('0x46')]);_0x17c49e[_0x9061('0x4b')]=_[_0x9061('0x49')](_0x193f58[_0x9061('0x4a')],qs[_0x9061('0x4c')](_0x486166[_0x9061('0x46')][_0x9061('0x4c')]));_0x17c49e['attributes']=_0x17c49e[_0x9061('0x4b')][_0x9061('0x4d')]?_0x17c49e[_0x9061('0x4b')]:_0x193f58[_0x9061('0x4a')];if(!_0x486166['query'][_0x9061('0x4e')]('nolimit')){_0x17c49e[_0x9061('0x33')]=qs['limit'](_0x486166[_0x9061('0x46')][_0x9061('0x33')]);_0x17c49e[_0x9061('0x36')]=qs[_0x9061('0x36')](_0x486166[_0x9061('0x46')]['offset']);}_0x17c49e[_0x9061('0x4f')]=qs[_0x9061('0x50')](_0x486166[_0x9061('0x46')][_0x9061('0x50')]);_0x17c49e['where']=qs['filters'](_[_0x9061('0x51')](_0x486166['query'],_0x193f58[_0x9061('0x48')]));_0x17c49e[_0x9061('0x52')]['OpenchannelAccountId']=_0x5a145e['id'];if(_0x486166[_0x9061('0x46')][_0x9061('0x55')]){_0x17c49e[_0x9061('0x52')]=_['merge'](_0x17c49e[_0x9061('0x52')],{'$or':_[_0x9061('0x45')](_0x17c49e[_0x9061('0x4b')],function(_0x46aa02){var _0x2509de={};_0x2509de[_0x46aa02]={'$like':'%'+_0x486166[_0x9061('0x46')][_0x9061('0x55')]+'%'};return _0x2509de;})});}_0x17c49e=_[_0x9061('0x53')]({},_0x17c49e,_0x486166[_0x9061('0x5c')]);return db['CannedAnswer'][_0x9061('0x35')]({'where':_0x17c49e[_0x9061('0x52')]})['then'](function(_0x262199){_0x93c2ef[_0x9061('0x35')]=_0x262199;if(_0x486166[_0x9061('0x46')][_0x9061('0x56')]){_0x17c49e['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x9061('0x6e')](_0x17c49e);})[_0x9061('0x3b')](function(_0x563acd){_0x93c2ef[_0x9061('0x6f')]=_0x563acd;return _0x93c2ef;});}})[_0x9061('0x3b')](respondWithFilteredResult(_0x27f1a0,_0x17c49e))[_0x9061('0x2e')](handleError(_0x27f1a0,null));};exports[_0x9061('0x72')]=function(_0x4f52e4,_0x256f83,_0x1c3fc4){return db[_0x9061('0x41')][_0x9061('0x5d')]({'where':{'id':_0x4f52e4['params']['id']}})[_0x9061('0x3b')](handleEntityNotFound(_0x256f83,null))[_0x9061('0x3b')](function(_0x123eb0){if(_0x123eb0){return _0x123eb0['removeAnswers'](_0x4f52e4[_0x9061('0x46')][_0x9061('0x73')]);}})[_0x9061('0x3b')](respondWithStatusCode(_0x256f83,null))[_0x9061('0x2e')](handleError(_0x256f83,null));};exports['notify']=function(_0x527cc9,_0x599934,_0x58d5ef){var _0x370e2e={'body':_0x527cc9[_0x9061('0x5f')],'channel':'openchannel'};var _0x83678=[];var _0x36b572=[];var _0x384ea0={};var _0x5ce176=![];return db[_0x9061('0x74')][_0x9061('0x69')]()[_0x9061('0x3b')](function(_0xe71e24){if(!_0xe71e24){throw new db['Sequelize'][(_0x9061('0x75'))](_0x9061('0x76'));}_0x83678=_[_0x9061('0x77')](_[_0x9061('0x47')](_0xe71e24),[_0x9061('0x78'),_0x9061('0x79')]);_0x36b572=_[_0x9061('0x77')](_[_0x9061('0x47')](_0xe71e24),[_0x9061('0x78'),'updatedAt','CompanyId',_0x9061('0x7a')]);if(_0x527cc9[_0x9061('0x5f')]['id']){delete _0x527cc9[_0x9061('0x5f')]['id'];}if(_['isNil'](_0x527cc9[_0x9061('0x5f')][_0x9061('0x7b')])){throw new db[(_0x9061('0x7c'))][(_0x9061('0x75'))](_0x9061('0x7d'));}if(_[_0x9061('0x7e')](_0x527cc9[_0x9061('0x5f')][_0x9061('0x5f')])||_0x527cc9[_0x9061('0x5f')][_0x9061('0x5f')]===''){throw new db[(_0x9061('0x7c'))][(_0x9061('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9061('0x7e')](_0x527cc9[_0x9061('0x5f')][_0x9061('0x7f')])){throw new db[(_0x9061('0x7c'))][(_0x9061('0x75'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x36b572);}if(!_[_0x9061('0x80')](_0x36b572,_0x527cc9['body']['mapKey'])){throw new db[(_0x9061('0x7c'))][(_0x9061('0x75'))](_0x9061('0x81')+_0x36b572);}_0x384ea0[_0x527cc9[_0x9061('0x5f')]['mapKey']]=_0x527cc9[_0x9061('0x5f')][_0x9061('0x7b')];})[_0x9061('0x3b')](function(){return db[_0x9061('0x41')][_0x9061('0x5d')]({'where':{'id':_0x527cc9[_0x9061('0x58')]['id']},'include':[{'model':db[_0x9061('0x82')],'as':_0x9061('0x83'),'include':[{'model':db[_0x9061('0x74')],'as':_0x9061('0x84'),'where':_0x384ea0,'limit':0x1,'order':[[_0x9061('0x79'),_0x9061('0x85')]]}]},{'model':db[_0x9061('0x86')],'as':_0x9061('0x87')}]});})[_0x9061('0x3b')](handleEntityNotFound(_0x599934,null))[_0x9061('0x3b')](function(_0x8c6b81){if(_0x8c6b81&&_0x8c6b81[_0x9061('0x83')]){_0x370e2e[_0x9061('0x88')]=_0x8c6b81;_0x370e2e[_0x9061('0x89')]=_0x8c6b81[_0x9061('0x87')];_0x370e2e['list']=_0x8c6b81[_0x9061('0x83')];_0x370e2e['applications']=_[_0x9061('0x8a')](_0x370e2e[_0x9061('0x89')],[_0x9061('0x8b')],[_0x9061('0x8c')]);if(_0x370e2e['account'][_0x9061('0x87')]){delete _0x370e2e[_0x9061('0x88')]['Applications'];}if(_0x370e2e[_0x9061('0x88')][_0x9061('0x83')]&&_0x370e2e[_0x9061('0x88')][_0x9061('0x83')][_0x9061('0x84')]['length']){return _0x370e2e[_0x9061('0x88')][_0x9061('0x83')][_0x9061('0x84')][0x0];}var _0x2e6d39=_['defaults'](_0x527cc9[_0x9061('0x5f')],{'firstName':_0x527cc9['body'][_0x9061('0x7b')],'ListId':_0x8c6b81[_0x9061('0x7a')]});_0x2e6d39[_0x527cc9[_0x9061('0x5f')][_0x9061('0x7f')]]=_0x527cc9[_0x9061('0x5f')]['from'];return db['CmContact'][_0x9061('0x5e')](_0x2e6d39,{'fields':_0x83678,'raw':!![]});}})[_0x9061('0x3b')](handleEntityNotFound(_0x599934,null))[_0x9061('0x3b')](function(_0x590294){_0x370e2e[_0x9061('0x8d')]=_0x590294;if(_0x590294){var _0x46ea21={'ContactId':_0x590294['id'],'OpenchannelAccountId':_0x527cc9[_0x9061('0x58')]['id'],'from':(_0x590294[_0x9061('0x8e')]||'')+'\x20'+(_0x590294[_0x9061('0x8f')]||'')};var _0x45502b={'OpenchannelAccountId':_0x527cc9[_0x9061('0x58')]['id'],'closed':![]};if(_0x527cc9['body'][_0x9061('0x90')]){_0x45502b[_0x9061('0x90')]=_0x527cc9['body'][_0x9061('0x90')];return db['OpenchannelInteraction']['find']({'where':_0x45502b})['then'](function(_0x262570){if(_0x262570){return[_0x262570,![]];}_0x46ea21[_0x9061('0x90')]=_0x527cc9[_0x9061('0x5f')]['threadId'];_0x46ea21[_0x9061('0x91')]=_0x527cc9[_0x9061('0x5f')]['externalUrl'];return db[_0x9061('0x92')][_0x9061('0x5e')](_0x46ea21)[_0x9061('0x3b')](function(_0x31f687){return[_0x31f687,!![]];});});}else{_0x45502b[_0x9061('0x90')]=null;}_0x45502b[_0x9061('0x93')]=_0x590294['id'];return db[_0x9061('0x92')][_0x9061('0x5d')]({'where':_0x45502b})['then'](function(_0x45d2c8){if(_0x45d2c8){return[_0x45d2c8,![]];}return db[_0x9061('0x92')][_0x9061('0x5e')](_0x46ea21)[_0x9061('0x3b')](function(_0x4fcc2f){return[_0x4fcc2f,!![]];});});}})[_0x9061('0x94')](function(_0x42375b,_0x4d1ff2){if(_0x42375b){_0x5ce176=_0x4d1ff2;if(!_0x4d1ff2){var _0x2f6173={'from':(_0x370e2e[_0x9061('0x8d')][_0x9061('0x8e')]||'')+'\x20'+(_0x370e2e[_0x9061('0x8d')][_0x9061('0x8f')]||'')};if(_0x527cc9['body'][_0x9061('0x90')]&&_0x527cc9[_0x9061('0x5f')]['messageId']&&_0x527cc9[_0x9061('0x5f')]['threadId']!=_0x527cc9['body']['messageId']){_0x2f6173[_0x9061('0x90')]=_0x527cc9[_0x9061('0x5f')][_0x9061('0x95')];}return _0x42375b[_0x9061('0x67')](_0x2f6173);}else{return _0x42375b;}}})[_0x9061('0x3b')](function(_0x113335){_0x370e2e[_0x9061('0x96')]=_0x113335[_0x9061('0x3d')]({'plain':!![]});_0x370e2e[_0x9061('0x96')][_0x9061('0x97')]=_0x5ce176;if(_0x370e2e[_0x9061('0x96')][_0x9061('0x97')]){if(_0x370e2e[_0x9061('0x88')]['autoclose']){_0x370e2e[_0x9061('0x89')][_0x9061('0x98')]({'id':0x0,'priority':_0x370e2e['applications'][_0x9061('0x4d')]+0x1,'app':'close','appdata':_0x9061('0x99'),'interval':_0x9061('0x9a')});}}return db[_0x9061('0x9b')][_0x9061('0x5e')]({'body':_0x527cc9['body'][_0x9061('0x5f')],'OpenchannelAccountId':_0x527cc9[_0x9061('0x58')]['id'],'OpenchannelInteractionId':_0x113335['id'],'direction':'in','ContactId':_0x370e2e[_0x9061('0x8d')]['id'],'AttachmentId':_0x527cc9[_0x9061('0x5f')][_0x9061('0x9c')]});})[_0x9061('0x3b')](function(_0x9dc375){_0x370e2e['message']=_0x9dc375;if(!_0x370e2e[_0x9061('0x96')][_0x9061('0x9d')])return;return db['User'][_0x9061('0x5d')]({'attributes':['id','name'],'where':{'id':_0x370e2e[_0x9061('0x96')]['UserId']}});})[_0x9061('0x3b')](function(_0x58c6ca){if(_0x58c6ca){_0x370e2e[_0x9061('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0x9061('0x9e'),'appdata':_0x58c6ca[_0x9061('0x3f')]+','+(_0x370e2e[_0x9061('0x88')][_0x9061('0x9f')]||0xa),'interval':_0x9061('0x9a')});}if(!_0x370e2e[_0x9061('0x96')][_0x9061('0xa0')])return;return db[_0x9061('0xa1')]['find']({'attributes':['id',_0x9061('0x3f')],'where':{'id':_0x370e2e[_0x9061('0x96')][_0x9061('0xa0')]}});})[_0x9061('0x3b')](function(_0x26fb96){if(_0x26fb96){_0x370e2e['applications'][_0x9061('0xa2')]({'id':0x0,'priority':0x1,'app':_0x9061('0xa3'),'appdata':_0x26fb96['name']+','+(_0x370e2e[_0x9061('0x88')]['waitForTheAssignedQueue']||0x12c),'interval':_0x9061('0x9a')});}return respondWithRpcPromise(_0x9061('0xa4'),_0x9061('0xa5'),_0x370e2e);})['then'](function(_0x44d567){respondWithRpcPromise(_0x9061('0xa6'),'EventManager',{'event':'notify','message':_0x44d567},client9002);return _0x44d567;})[_0x9061('0x3b')](respondWithResult(_0x599934,null))[_0x9061('0x2e')](handleError(_0x599934,null));};exports['addApplications']=function(_0x23c74f,_0x4a1d80){var _0x47fc4a=_0x23c74f[_0x9061('0x58')]['id'];var _0x4aa46c=_0x23c74f[_0x9061('0x5f')];var _0x58ace9=0xc8;var _0xe22d78=null;return db[_0x9061('0xa7')][_0x9061('0xa8')]({'isolationLevel':db[_0x9061('0xa7')][_0x9061('0xa9')][_0x9061('0xaa')]['READ_COMMITTED']},function(_0x497ea7){return db[_0x9061('0x41')][_0x9061('0x6c')]({'where':{'id':_0x47fc4a},'transaction':_0x497ea7})[_0x9061('0x3b')](function(_0x5292b8){if(_0x5292b8){return db[_0x9061('0x86')][_0x9061('0x3c')]({'where':{'OpenchannelAccountId':_0x47fc4a},'transaction':_0x497ea7})['then'](function(){var _0x4c2a10=_[_0x9061('0x45')](_0x4aa46c,function(_0x55e03f){_0x55e03f[_0x9061('0x6a')]=_0x47fc4a;return _0x55e03f;});return db[_0x9061('0x86')][_0x9061('0xab')](_0x4c2a10,{'transaction':_0x497ea7});});}else{_0x58ace9=0x194;_0xe22d78=[];}});})[_0x9061('0x3b')](function(){if(_0x58ace9!==0x194){return db[_0x9061('0x86')][_0x9061('0xac')]({'where':{'OpenchannelAccountId':_0x47fc4a},'order':_0x9061('0x8b')})['then'](function(_0x3b926f){_0xe22d78=_0x3b926f;});}})['catch'](function(_0x384dcd){_0x58ace9=0x1f4;logger[_0x9061('0x2a')](_0x384dcd[_0x9061('0x3e')]);if(_0x384dcd[_0x9061('0x3f')]){delete _0x384dcd[_0x9061('0x3f')];}_0xe22d78=_0x384dcd;})[_0x9061('0xad')](function(){if(_0xe22d78===null){_0x4a1d80[_0x9061('0x2f')](_0x58ace9);}else{if(_0x58ace9===0x1f4){_0x4a1d80['status'](_0x58ace9)[_0x9061('0xae')](_0xe22d78);}else{_0x4a1d80[_0x9061('0x30')](_0x58ace9)[_0x9061('0x32')](_0xe22d78);}}});};exports['getApplications']=function(_0x389502,_0x57465f,_0x27e2a8){var _0x268879={};var _0x139a96={};var _0x16d5c4;var _0x1f95a7;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x389502['params']['id']}})['then'](handleEntityNotFound(_0x57465f,null))[_0x9061('0x3b')](function(_0x25234d){if(_0x25234d){_0x16d5c4=_0x25234d;_0x139a96[_0x9061('0x4a')]=_[_0x9061('0x47')](db[_0x9061('0x86')][_0x9061('0x5a')]);_0x139a96['query']=_['keys'](_0x389502[_0x9061('0x46')]);_0x139a96[_0x9061('0x48')]=_[_0x9061('0x49')](_0x139a96[_0x9061('0x4a')],_0x139a96[_0x9061('0x46')]);_0x268879[_0x9061('0x4b')]=_[_0x9061('0x49')](_0x139a96[_0x9061('0x4a')],qs[_0x9061('0x4c')](_0x389502[_0x9061('0x46')][_0x9061('0x4c')]));_0x268879[_0x9061('0x4b')]=_0x268879[_0x9061('0x4b')]['length']?_0x268879['attributes']:_0x139a96[_0x9061('0x4a')];_0x268879[_0x9061('0x4f')]=qs['sort'](_0x389502['query'][_0x9061('0x50')]);_0x268879[_0x9061('0x52')]=qs[_0x9061('0x48')](_[_0x9061('0x51')](_0x389502[_0x9061('0x46')],_0x139a96['filters']));if(_0x389502[_0x9061('0x46')]['filter']){_0x268879[_0x9061('0x52')]=_['merge'](_0x268879['where'],{'$or':_[_0x9061('0x45')](_0x268879['attributes'],function(_0x170177){var _0x3413d1={};_0x3413d1[_0x170177]={'$like':'%'+_0x389502[_0x9061('0x46')]['filter']+'%'};return _0x3413d1;})});}_0x268879=_[_0x9061('0x53')]({},_0x268879,_0x389502[_0x9061('0x5c')]);return _0x16d5c4['getApplications'](_0x268879);}})['then'](function(_0x258369){if(_0x258369){_0x1f95a7=_0x258369[_0x9061('0x4d')];if(!_0x389502[_0x9061('0x46')]['hasOwnProperty'](_0x9061('0x6d'))){_0x268879[_0x9061('0x33')]=qs['limit'](_0x389502[_0x9061('0x46')][_0x9061('0x33')]);_0x268879['offset']=qs[_0x9061('0x36')](_0x389502[_0x9061('0x46')][_0x9061('0x36')]);}return _0x16d5c4[_0x9061('0xaf')](_0x268879);}})[_0x9061('0x3b')](function(_0x561b69){if(_0x561b69){return _0x561b69?{'count':_0x1f95a7,'rows':_0x561b69}:null;}})['then'](respondWithResult(_0x57465f,null))[_0x9061('0x2e')](handleError(_0x57465f,null));};exports[_0x9061('0xb0')]=function(_0x4d3518,_0x395357,_0x1c1e24){var _0x533ea6={'raw':![],'where':{}};var _0x252cf0={};var _0x4da264={'count':0x0,'rows':[]};return db[_0x9061('0x41')]['findOne']({'where':{'id':_0x4d3518['params']['id']}})[_0x9061('0x3b')](handleEntityNotFound(_0x395357,null))[_0x9061('0x3b')](function(_0x521d1d){if(_0x521d1d){_0x252cf0[_0x9061('0x4a')]=_[_0x9061('0x47')](db[_0x9061('0x92')]['rawAttributes']);_0x252cf0[_0x9061('0x46')]=_[_0x9061('0x47')](_0x4d3518[_0x9061('0x46')]);_0x252cf0[_0x9061('0x48')]=_[_0x9061('0x49')](_0x252cf0[_0x9061('0x4a')],_0x252cf0[_0x9061('0x46')]);_0x533ea6[_0x9061('0x4b')]=_[_0x9061('0x49')](_0x252cf0['model'],qs['fields'](_0x4d3518[_0x9061('0x46')][_0x9061('0x4c')]));_0x533ea6[_0x9061('0x4b')]=_0x533ea6[_0x9061('0x4b')][_0x9061('0x4d')]?_0x533ea6['attributes']:_0x252cf0[_0x9061('0x4a')];if(!_0x4d3518['query']['hasOwnProperty'](_0x9061('0x6d'))){_0x533ea6[_0x9061('0x33')]=qs[_0x9061('0x33')](_0x4d3518['query'][_0x9061('0x33')]);_0x533ea6['offset']=qs[_0x9061('0x36')](_0x4d3518[_0x9061('0x46')][_0x9061('0x36')]);}_0x533ea6['order']=qs[_0x9061('0x50')](_0x4d3518[_0x9061('0x46')][_0x9061('0x50')]);_0x533ea6[_0x9061('0x52')]=qs['filters'](_[_0x9061('0x51')](_0x4d3518['query'],_0x252cf0[_0x9061('0x48')]));_0x533ea6['where'][_0x9061('0x6a')]=_0x521d1d['id'];if(_0x4d3518[_0x9061('0x46')][_0x9061('0x55')]){_0x533ea6[_0x9061('0x52')]=_[_0x9061('0x53')](_0x533ea6[_0x9061('0x52')],{'$or':_[_0x9061('0x45')](_0x533ea6[_0x9061('0x4b')],function(_0x471eda){var _0x243fba={};_0x243fba[_0x471eda]={'$like':'%'+_0x4d3518['query']['filter']+'%'};return _0x243fba;})});}_0x533ea6=_[_0x9061('0x53')]({},_0x533ea6,_0x4d3518['options']);return db[_0x9061('0x92')][_0x9061('0x35')]({'where':_0x533ea6[_0x9061('0x52')]})['then'](function(_0x50f669){_0x4da264[_0x9061('0x35')]=_0x50f669;if(_0x4d3518[_0x9061('0x46')][_0x9061('0x56')]){_0x533ea6[_0x9061('0x5b')]=[{'model':db[_0x9061('0x74')],'as':_0x9061('0xb1'),'required':![]},{'model':db[_0x9061('0xb2')],'as':_0x9061('0xb3'),'attributes':[_0x9061('0x3f'),_0x9061('0xb4'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x9061('0xb5'),'attributes':['id','name',_0x9061('0xb6')],'where':_0x4d3518[_0x9061('0x46')]['tag']?{'id':_0x4d3518[_0x9061('0x46')][_0x9061('0xb7')]}:undefined,'required':_0x4d3518[_0x9061('0x46')]['tag']?!![]:![]}];}return db[_0x9061('0x92')]['findAll'](_0x533ea6);})['then'](function(_0xf4d092){_0x4da264[_0x9061('0x6f')]=_0xf4d092;return _0x4da264;});}})[_0x9061('0x3b')](respondWithFilteredResult(_0x395357,_0x533ea6))['catch'](handleError(_0x395357,null));};exports[_0x9061('0xb8')]=function(_0x39ddeb,_0x5c29b1,_0x102b58){return db[_0x9061('0x41')][_0x9061('0x5d')]({'where':{'id':_0x39ddeb[_0x9061('0x58')]['id']}})[_0x9061('0x3b')](handleEntityNotFound(_0x5c29b1,null))['then'](function(_0x41e745){if(_0x41e745){return _0x41e745[_0x9061('0xb8')](_0x39ddeb[_0x9061('0x5f')][_0x9061('0x73')],_[_0x9061('0xb9')](_0x39ddeb[_0x9061('0x5f')],[_0x9061('0x73'),'id'])||{})[_0x9061('0x94')](function(_0x3fd047){for(var _0x2908ab=0x0;_0x2908ab<_0x39ddeb['body'][_0x9061('0x73')][_0x9061('0x4d')];_0x2908ab+=0x1){socket[_0x9061('0xba')]('userOpenchannelAccount:save',{'UserId':Number(_0x39ddeb[_0x9061('0x5f')]['ids'][_0x2908ab]),'OpenchannelAccountId':Number(_0x39ddeb[_0x9061('0x58')]['id'])});}return _0x3fd047;});}})['then'](respondWithResult(_0x5c29b1,null))[_0x9061('0x2e')](handleError(_0x5c29b1,null));};exports['removeAgents']=function(_0x411ce2,_0x5e481d,_0x5211bf){return db['OpenchannelAccount'][_0x9061('0x5d')]({'where':{'id':_0x411ce2[_0x9061('0x58')]['id']}})['then'](handleEntityNotFound(_0x5e481d,null))[_0x9061('0x3b')](function(_0x1a9f1e){if(_0x1a9f1e){return _0x1a9f1e[_0x9061('0xbb')](_0x411ce2[_0x9061('0x46')]['ids'])[_0x9061('0x3b')](function(){if(_[_0x9061('0xbc')](_0x411ce2[_0x9061('0x46')][_0x9061('0x73')])){for(var _0x22f2b6=0x0;_0x22f2b6<_0x411ce2[_0x9061('0x46')][_0x9061('0x73')][_0x9061('0x4d')];_0x22f2b6+=0x1){socket[_0x9061('0xba')](_0x9061('0xbd'),{'UserId':Number(_0x411ce2['query'][_0x9061('0x73')][_0x22f2b6]),'OpenchannelAccountId':Number(_0x411ce2[_0x9061('0x58')]['id'])});}}else{socket[_0x9061('0xba')](_0x9061('0xbd'),{'UserId':Number(_0x411ce2[_0x9061('0x46')]['ids']),'OpenchannelAccountId':Number(_0x411ce2['params']['id'])});}});}})[_0x9061('0x3b')](respondWithStatusCode(_0x5e481d,null))[_0x9061('0x2e')](handleError(_0x5e481d,null));};exports['getAgents']=function(_0x19784c,_0x4fec5f,_0x808da5){var _0x399542={};var _0x2f9c4b={};var _0x39e6fd;var _0x5e8272;return db[_0x9061('0x41')][_0x9061('0x6c')]({'where':{'id':_0x19784c['params']['id']}})[_0x9061('0x3b')](handleEntityNotFound(_0x4fec5f,null))[_0x9061('0x3b')](function(_0x5b8da7){if(_0x5b8da7){_0x39e6fd=_0x5b8da7;_0x2f9c4b[_0x9061('0x4a')]=_[_0x9061('0x47')](db['User'][_0x9061('0x5a')]);_0x2f9c4b[_0x9061('0x46')]=_[_0x9061('0x47')](_0x19784c[_0x9061('0x46')]);_0x2f9c4b[_0x9061('0x48')]=_[_0x9061('0x49')](_0x2f9c4b[_0x9061('0x4a')],_0x2f9c4b[_0x9061('0x46')]);_0x399542['attributes']=_[_0x9061('0x49')](_0x2f9c4b[_0x9061('0x4a')],qs[_0x9061('0x4c')](_0x19784c[_0x9061('0x46')][_0x9061('0x4c')]));_0x399542[_0x9061('0x4b')]=_0x399542[_0x9061('0x4b')][_0x9061('0x4d')]?_0x399542[_0x9061('0x4b')]:_0x2f9c4b[_0x9061('0x4a')];_0x399542[_0x9061('0x4f')]=qs[_0x9061('0x50')](_0x19784c['query']['sort']);_0x399542[_0x9061('0x52')]=qs[_0x9061('0x48')](_[_0x9061('0x51')](_0x19784c[_0x9061('0x46')],_0x2f9c4b[_0x9061('0x48')]));if(_0x19784c['query']['filter']){_0x399542['where']=_[_0x9061('0x53')](_0x399542['where'],{'$or':_['map'](_0x399542[_0x9061('0x4b')],function(_0x1dae18){var _0x5ab88d={};_0x5ab88d[_0x1dae18]={'$like':'%'+_0x19784c[_0x9061('0x46')][_0x9061('0x55')]+'%'};return _0x5ab88d;})});}_0x399542=_['merge']({},_0x399542,_0x19784c[_0x9061('0x5c')]);return _0x39e6fd[_0x9061('0xbe')](_0x399542);}})['then'](function(_0x3b8fbf){if(_0x3b8fbf){_0x5e8272=_0x3b8fbf['length'];if(!_0x19784c[_0x9061('0x46')][_0x9061('0x4e')](_0x9061('0x6d'))){_0x399542[_0x9061('0x33')]=qs[_0x9061('0x33')](_0x19784c[_0x9061('0x46')][_0x9061('0x33')]);_0x399542['offset']=qs['offset'](_0x19784c['query'][_0x9061('0x36')]);}return _0x39e6fd[_0x9061('0xbe')](_0x399542);}})[_0x9061('0x3b')](function(_0x55ee71){if(_0x55ee71){return _0x55ee71?{'count':_0x5e8272,'rows':_0x55ee71}:null;}})[_0x9061('0x3b')](respondWithResult(_0x4fec5f,null))[_0x9061('0x2e')](handleError(_0x4fec5f,null));};exports[_0x9061('0xae')]=function(_0x529bd7,_0x8af959,_0x162f07){var _0x25aa60,_0x75a0d2,_0x50d830;if(_[_0x9061('0x7e')](_0x529bd7[_0x9061('0x5f')][_0x9061('0x5f')])||_0x529bd7[_0x9061('0x5f')]['body']===''){throw new db[(_0x9061('0x7c'))][(_0x9061('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9061('0x7e')](_0x529bd7[_0x9061('0x5f')]['to'])){}_0x25aa60=_0x529bd7[_0x9061('0x5f')]['to'];return db[_0x9061('0x41')][_0x9061('0x6c')]({'where':{'id':_0x529bd7[_0x9061('0x58')]['id']}})[_0x9061('0x3b')](handleEntityNotFound(_0x8af959,null))[_0x9061('0x3b')](function(_0x7f2e8){if(_0x7f2e8){return db[_0x9061('0x41')][_0x9061('0x5d')]({'where':{'id':_0x7f2e8['id']},'include':[{'model':db['CmList'],'as':_0x9061('0x83'),'include':[{'model':db['CmContact'],'as':_0x9061('0x84'),'where':{[_0x7f2e8[_0x9061('0x7f')]]:_0x25aa60},'limit':0x1,'order':[[_0x9061('0x79'),_0x9061('0x85')]]}]}]})[_0x9061('0x3b')](handleEntityNotFound(_0x8af959,null))['then'](function(_0x1c480b){if(_0x1c480b&&_0x1c480b[_0x9061('0x83')]){_0x75a0d2=_0x1c480b['get']({'plain':!![]});if(_0x75a0d2['List']&&_0x75a0d2[_0x9061('0x83')][_0x9061('0x84')]['length']){return _0x75a0d2['List']['Contacts'][0x0];}return db[_0x9061('0x74')][_0x9061('0x5e')](_[_0x9061('0x1c')](_0x529bd7[_0x9061('0x5f')],{'firstName':_0x25aa60,[_0x1c480b[_0x9061('0x7f')]]:_0x25aa60,'phone':_0x25aa60,'ListId':_0x75a0d2[_0x9061('0x7a')]}));}})[_0x9061('0x3b')](handleEntityNotFound(_0x8af959,null))[_0x9061('0x3b')](function(_0xdc92e6){if(_0xdc92e6){_0x50d830=_0xdc92e6;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x50d830['id'],'closed':![],'OpenchannelAccountId':_0x75a0d2['id']}})[_0x9061('0x3b')](function(_0x5db0a2){if(_0x5db0a2){return[_0x5db0a2,![]];}return db[_0x9061('0x92')]['create']({'UserId':_0x529bd7['user']['id'],'ContactId':_0x50d830['id'],'OpenchannelAccountId':_0x75a0d2['id'],'lastMsgDirection':_0x9061('0xbf'),'firstMsgDirection':_0x9061('0xbf'),'Messages':[_[_0x9061('0x53')](_0x529bd7['body'],{'read':![],'body':_0x529bd7[_0x9061('0x5f')][_0x9061('0x5f')],'OpenchannelAccountId':_0x75a0d2['id'],'UserId':_0x529bd7[_0x9061('0x61')]['id'],'ContactId':_0x50d830['id']})]},{'include':[{'model':db[_0x9061('0x9b')],'as':_0x9061('0xc0')}]})[_0x9061('0x3b')](function(_0x5bef84){return[_0x5bef84,!![]];});});}})[_0x9061('0x94')](function(_0x4e0307,_0x1a7980){if(_0x1a7980){return _0x4e0307;}return db[_0x9061('0x9b')]['create'](_[_0x9061('0x53')](_0x529bd7['body'],{'read':![],'body':_0x529bd7[_0x9061('0x5f')][_0x9061('0x5f')],'OpenchannelAccountId':_0x75a0d2['id'],'OpenchannelInteractionId':_0x4e0307['id'],'UserId':_0x529bd7[_0x9061('0x61')]['id'],'ContactId':_0x50d830['id']}))['then'](function(_0x3fcfc6){_0x4e0307[_0x9061('0xc1')][_0x9061('0xc0')]=[];_0x4e0307[_0x9061('0xc1')][_0x9061('0xc0')][_0x9061('0x98')](_0x3fcfc6[_0x9061('0xc1')]);return _0x4e0307;});});}})[_0x9061('0x3b')](respondWithResult(_0x8af959,null))['catch'](handleError(_0x8af959,null));}; \ No newline at end of file +var _0x8173=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','OpenchannelAccountId','getDispositions','Disposition','pick','removeDispositions','CannedAnswer','getAnswers','findOne','removeAnswers','ids','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','OpenchannelApplication','Applications','applications','List','orderBy','asc','account','CmContact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','firstName','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','defaults','redis','localhost','register','jayson/promise','client','http','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','findAll','rows','mandatoryDispositionPause','keys','include','find','create','body','user'];(function(_0x4a7a9,_0x3d85d8){var _0x1f4e07=function(_0x4451d7){while(--_0x4451d7){_0x4a7a9['push'](_0x4a7a9['shift']());}};_0x1f4e07(++_0x3d85d8);}(_0x8173,0x1db));var _0x3817=function(_0x211cf5,_0xecb344){_0x211cf5=_0x211cf5-0x0;var _0x1d82bf=_0x8173[_0x211cf5];return _0x1d82bf;};'use strict';var emlformat=require(_0x3817('0x0'));var rimraf=require(_0x3817('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3817('0x2'));var rp=require(_0x3817('0x3'));var moment=require(_0x3817('0x4'));var BPromise=require(_0x3817('0x5'));var Mustache=require('mustache');var util=require(_0x3817('0x6'));var path=require('path');var sox=require(_0x3817('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3817('0x8'));var _=require(_0x3817('0x9'));var squel=require(_0x3817('0xa'));var crypto=require('crypto');var jsforce=require(_0x3817('0xb'));var deskjs=require(_0x3817('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3817('0xd'));var Redis=require(_0x3817('0xe'));var authService=require(_0x3817('0xf'));var qs=require(_0x3817('0x10'));var as=require(_0x3817('0x11'));var hardwareService=require(_0x3817('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3817('0x13'));var config=require(_0x3817('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x3817('0x15')](config[_0x3817('0x16')],{'host':_0x3817('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3817('0x16')]));require('./openchannelAccount.socket')[_0x3817('0x18')](socket);var jayson=require(_0x3817('0x19'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x3817('0x1a')][_0x3817('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4d9509,_0x155075,_0x32b14f,_0x313caf){return new BPromise(function(_0x3293fd,_0x2c8a19){var _0x347771=_0x313caf||client;return _0x347771['request'](_0x4d9509,_0x32b14f)[_0x3817('0x1c')](function(_0x5da442){logger['info'](_0x3817('0x1d'),_0x155075,_0x3817('0x1e'));logger[_0x3817('0x1f')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x155075,'request\x20sent',JSON[_0x3817('0x20')](_0x5da442));if(_0x5da442[_0x3817('0x21')]){if(_0x5da442['error'][_0x3817('0x22')]===0x1f4){logger[_0x3817('0x21')](_0x3817('0x1d'),_0x155075,_0x5da442[_0x3817('0x21')][_0x3817('0x23')]);return _0x2c8a19(_0x5da442[_0x3817('0x21')][_0x3817('0x23')]);}logger[_0x3817('0x21')](_0x3817('0x1d'),_0x155075,_0x5da442[_0x3817('0x21')][_0x3817('0x23')]);return _0x3293fd(_0x5da442[_0x3817('0x21')]['message']);}else{logger['info'](_0x3817('0x1d'),_0x155075,_0x3817('0x1e'));_0x3293fd(_0x5da442[_0x3817('0x24')][_0x3817('0x23')]);}})[_0x3817('0x25')](function(_0x251cd7){logger[_0x3817('0x21')](_0x3817('0x1d'),_0x155075,_0x251cd7);_0x2c8a19(_0x251cd7);});});}function respondWithStatusCode(_0x1a40b5,_0x492e08){_0x492e08=_0x492e08||0xcc;return function(_0x43bb80){if(_0x43bb80){return _0x1a40b5[_0x3817('0x26')](_0x492e08);}return _0x1a40b5[_0x3817('0x27')](_0x492e08)[_0x3817('0x28')]();};}function respondWithResult(_0x2c6a1f,_0x54ccb6){_0x54ccb6=_0x54ccb6||0xc8;return function(_0x3f2a44){if(_0x3f2a44){return _0x2c6a1f['status'](_0x54ccb6)[_0x3817('0x29')](_0x3f2a44);}};}function respondWithFilteredResult(_0x3d0cc9,_0x1b60dc){return function(_0x1ea007){if(_0x1ea007){var _0x4eab1b=typeof _0x1b60dc['offset']===_0x3817('0x2a')&&typeof _0x1b60dc['limit']===_0x3817('0x2a');var _0x237220=_0x1ea007[_0x3817('0x2b')];var _0x41d19d=_0x4eab1b?0x0:_0x1b60dc[_0x3817('0x2c')];var _0x2bf98b=_0x4eab1b?_0x1ea007[_0x3817('0x2b')]:_0x1b60dc[_0x3817('0x2c')]+_0x1b60dc['limit'];var _0xad678c;if(_0x2bf98b>=_0x237220){_0x2bf98b=_0x237220;_0xad678c=0xc8;}else{_0xad678c=0xce;}_0x3d0cc9['status'](_0xad678c);return _0x3d0cc9[_0x3817('0x2d')](_0x3817('0x2e'),_0x41d19d+'-'+_0x2bf98b+'/'+_0x237220)[_0x3817('0x29')](_0x1ea007);}return null;};}function patchUpdates(_0x5d9a32){return function(_0x385c3d){try{jsonpatch[_0x3817('0x2f')](_0x385c3d,_0x5d9a32,!![]);}catch(_0x375b22){return BPromise[_0x3817('0x30')](_0x375b22);}return _0x385c3d[_0x3817('0x31')]();};}function saveUpdates(_0x4fc714,_0x4cc609){return function(_0x91afee){if(_0x91afee){return _0x91afee[_0x3817('0x32')](_0x4fc714)[_0x3817('0x1c')](function(_0x96321e){return _0x96321e;});}return null;};}function removeEntity(_0x1ed82c,_0x5a8a93){return function(_0x1d29c8){if(_0x1d29c8){return _0x1d29c8[_0x3817('0x33')]()[_0x3817('0x1c')](function(){var _0x48e824=_0x1d29c8[_0x3817('0x34')]({'plain':!![]});var _0x1711b4=_0x3817('0x35');return db[_0x3817('0x36')]['destroy']({'where':{'type':_0x1711b4,'resourceId':_0x48e824['id']}})[_0x3817('0x1c')](function(){return _0x1d29c8;});})[_0x3817('0x1c')](function(){_0x1ed82c[_0x3817('0x27')](0xcc)[_0x3817('0x28')]();});}};}function handleEntityNotFound(_0x3100be,_0x454cf3){return function(_0x28ac7a){if(!_0x28ac7a){_0x3100be[_0x3817('0x26')](0x194);}return _0x28ac7a;};}function handleError(_0x3e7b83,_0x234a7a){_0x234a7a=_0x234a7a||0x1f4;return function(_0x24e2f3){logger[_0x3817('0x21')](_0x24e2f3[_0x3817('0x37')]);if(_0x24e2f3[_0x3817('0x38')]){delete _0x24e2f3[_0x3817('0x38')];}_0x3e7b83[_0x3817('0x27')](_0x234a7a)[_0x3817('0x39')](_0x24e2f3);};}exports[_0x3817('0x3a')]=function(_0x4c589d,_0x46201c){var _0x5a1c48={'include':[{'model':db[_0x3817('0x3b')],'as':'mandatoryDispositionPause'}]},_0x14a401={},_0x458437={'count':0x0,'rows':[]};var _0x192563=_['map'](db[_0x3817('0x3c')][_0x3817('0x3d')],function(_0x18018f){return{'name':_0x18018f[_0x3817('0x3e')],'type':_0x18018f[_0x3817('0x3f')][_0x3817('0x40')]};});_0x14a401[_0x3817('0x41')]=_[_0x3817('0x42')](_0x192563,_0x3817('0x38'));_0x14a401[_0x3817('0x43')]=_['keys'](_0x4c589d[_0x3817('0x43')]);_0x14a401[_0x3817('0x44')]=_[_0x3817('0x45')](_0x14a401[_0x3817('0x41')],_0x14a401['query']);_0x5a1c48[_0x3817('0x46')]=_[_0x3817('0x45')](_0x14a401[_0x3817('0x41')],qs[_0x3817('0x47')](_0x4c589d[_0x3817('0x43')][_0x3817('0x47')]));_0x5a1c48[_0x3817('0x46')]=_0x5a1c48[_0x3817('0x46')][_0x3817('0x48')]?_0x5a1c48[_0x3817('0x46')]:_0x14a401[_0x3817('0x41')];if(!_0x4c589d['query'][_0x3817('0x49')](_0x3817('0x4a'))){_0x5a1c48['limit']=qs[_0x3817('0x4b')](_0x4c589d[_0x3817('0x43')][_0x3817('0x4b')]);_0x5a1c48['offset']=qs['offset'](_0x4c589d[_0x3817('0x43')][_0x3817('0x2c')]);}_0x5a1c48[_0x3817('0x4c')]=qs[_0x3817('0x4d')](_0x4c589d['query']['sort']);_0x5a1c48[_0x3817('0x4e')]=qs[_0x3817('0x44')](_['pick'](_0x4c589d[_0x3817('0x43')],_0x14a401[_0x3817('0x44')]),_0x192563);if(_0x4c589d['query'][_0x3817('0x4f')]){_0x5a1c48[_0x3817('0x4e')]=_[_0x3817('0x50')](_0x5a1c48[_0x3817('0x4e')],{'$or':_['map'](_0x192563,function(_0x5c6ca0){if(_0x5c6ca0[_0x3817('0x3f')]!=='VIRTUAL'){var _0xd2614f={};_0xd2614f[_0x5c6ca0[_0x3817('0x38')]]={'$like':'%'+_0x4c589d[_0x3817('0x43')][_0x3817('0x4f')]+'%'};return _0xd2614f;}})});}_0x5a1c48=_[_0x3817('0x50')]({},_0x5a1c48,_0x4c589d[_0x3817('0x51')]);var _0x3680d2={'where':_0x5a1c48[_0x3817('0x4e')]};return db[_0x3817('0x3c')][_0x3817('0x2b')](_0x3680d2)[_0x3817('0x1c')](function(_0x1321de){_0x458437[_0x3817('0x2b')]=_0x1321de;if(_0x4c589d['query'][_0x3817('0x52')]){_0x5a1c48['include']=[{'all':!![]}];}return db[_0x3817('0x3c')][_0x3817('0x53')](_0x5a1c48);})[_0x3817('0x1c')](function(_0x47871e){_0x458437[_0x3817('0x54')]=_0x47871e;return _0x458437;})[_0x3817('0x1c')](respondWithFilteredResult(_0x46201c,_0x5a1c48))[_0x3817('0x25')](handleError(_0x46201c,null));};exports['show']=function(_0x4988e1,_0x258066){var _0x191957={'raw':![],'where':{'id':_0x4988e1['params']['id']},'include':[{'model':db[_0x3817('0x3b')],'as':_0x3817('0x55')}]},_0x426482={};_0x426482[_0x3817('0x41')]=_[_0x3817('0x56')](db['OpenchannelAccount']['rawAttributes']);_0x426482[_0x3817('0x43')]=_[_0x3817('0x56')](_0x4988e1['query']);_0x426482[_0x3817('0x44')]=_['intersection'](_0x426482[_0x3817('0x41')],_0x426482[_0x3817('0x43')]);_0x191957['attributes']=_[_0x3817('0x45')](_0x426482[_0x3817('0x41')],qs['fields'](_0x4988e1[_0x3817('0x43')]['fields']));_0x191957[_0x3817('0x46')]=_0x191957[_0x3817('0x46')]['length']?_0x191957[_0x3817('0x46')]:_0x426482[_0x3817('0x41')];if(_0x4988e1[_0x3817('0x43')][_0x3817('0x52')]){_0x191957[_0x3817('0x57')]=[{'all':!![]}];}_0x191957=_['merge']({},_0x191957,_0x4988e1[_0x3817('0x51')]);return db[_0x3817('0x3c')][_0x3817('0x58')](_0x191957)[_0x3817('0x1c')](handleEntityNotFound(_0x258066,null))[_0x3817('0x1c')](respondWithResult(_0x258066,null))['catch'](handleError(_0x258066,null));};exports[_0x3817('0x59')]=function(_0x291732,_0x222522){return db[_0x3817('0x3c')][_0x3817('0x59')](_0x291732[_0x3817('0x5a')],{})[_0x3817('0x1c')](function(_0x45f7b0){var _0xbadc28=_0x291732[_0x3817('0x5b')]['get']({'plain':!![]});if(!_0xbadc28)throw new Error(_0x3817('0x5c'));if(_0xbadc28[_0x3817('0x5d')]===_0x3817('0x5b')){var _0x3b97d=_0x45f7b0[_0x3817('0x34')]({'plain':!![]});var _0x180d23=_0x3817('0x35');return db[_0x3817('0x5e')][_0x3817('0x58')]({'where':{'name':_0x180d23,'userProfileId':_0xbadc28[_0x3817('0x5f')]},'raw':!![]})['then'](function(_0x2b1141){if(_0x2b1141&&_0x2b1141['autoAssociation']===0x0){return db['UserProfileResource'][_0x3817('0x59')]({'name':_0x3b97d['name'],'resourceId':_0x3b97d['id'],'type':_0x2b1141[_0x3817('0x38')],'sectionId':_0x2b1141['id']},{})['then'](function(){return _0x45f7b0;});}else{return _0x45f7b0;}})[_0x3817('0x25')](function(_0x392479){logger[_0x3817('0x21')](_0x3817('0x60'),_0x392479);throw _0x392479;});}return _0x45f7b0;})['then'](respondWithResult(_0x222522,0xc9))[_0x3817('0x25')](handleError(_0x222522,null));};exports['update']=function(_0x3f100f,_0x5216f8){if(_0x3f100f[_0x3817('0x5a')]['id']){delete _0x3f100f[_0x3817('0x5a')]['id'];}return db[_0x3817('0x3c')]['find']({'where':{'id':_0x3f100f[_0x3817('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0x3817('0x55')}]})[_0x3817('0x1c')](handleEntityNotFound(_0x5216f8,null))[_0x3817('0x1c')](saveUpdates(_0x3f100f['body'],null))[_0x3817('0x1c')](respondWithResult(_0x5216f8,null))[_0x3817('0x25')](handleError(_0x5216f8,null));};exports[_0x3817('0x33')]=function(_0x5c64ce,_0x5950e0){return db[_0x3817('0x3c')][_0x3817('0x58')]({'where':{'id':_0x5c64ce[_0x3817('0x61')]['id']}})['then'](handleEntityNotFound(_0x5950e0,null))['then'](removeEntity(_0x5950e0,null))['catch'](handleError(_0x5950e0,null));};exports[_0x3817('0x62')]=function(_0x9b9524,_0x5ab852){return db[_0x3817('0x3c')]['describe']()['then'](respondWithResult(_0x5ab852,null))[_0x3817('0x25')](handleError(_0x5ab852,null));};exports[_0x3817('0x63')]=function(_0xf39a4f,_0x316031,_0x58cdb0){if(_0xf39a4f['body']['id']){delete _0xf39a4f[_0x3817('0x5a')]['id'];}return db[_0x3817('0x3c')]['find']({'where':{'id':_0xf39a4f[_0x3817('0x61')]['id']}})[_0x3817('0x1c')](handleEntityNotFound(_0x316031,null))[_0x3817('0x1c')](function(_0x41cc6e){if(_0x41cc6e){_0xf39a4f[_0x3817('0x5a')][_0x3817('0x64')]=_0x41cc6e['id'];return db['Disposition'][_0x3817('0x59')](_0xf39a4f[_0x3817('0x5a')]);}})[_0x3817('0x1c')](respondWithResult(_0x316031,null))[_0x3817('0x25')](handleError(_0x316031,null));};exports[_0x3817('0x65')]=function(_0x4e26ac,_0x514267,_0x51e438){var _0x2618d9={'raw':![],'where':{}};var _0x10af8e={};var _0x2564b7={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4e26ac[_0x3817('0x61')]['id']}})[_0x3817('0x1c')](handleEntityNotFound(_0x514267,null))[_0x3817('0x1c')](function(_0x2cbe24){if(_0x2cbe24){_0x10af8e[_0x3817('0x41')]=_[_0x3817('0x56')](db[_0x3817('0x66')][_0x3817('0x3d')]);_0x10af8e[_0x3817('0x43')]=_[_0x3817('0x56')](_0x4e26ac[_0x3817('0x43')]);_0x10af8e[_0x3817('0x44')]=_[_0x3817('0x45')](_0x10af8e[_0x3817('0x41')],_0x10af8e[_0x3817('0x43')]);_0x2618d9[_0x3817('0x46')]=_['intersection'](_0x10af8e[_0x3817('0x41')],qs[_0x3817('0x47')](_0x4e26ac[_0x3817('0x43')][_0x3817('0x47')]));_0x2618d9[_0x3817('0x46')]=_0x2618d9[_0x3817('0x46')][_0x3817('0x48')]?_0x2618d9[_0x3817('0x46')]:_0x10af8e[_0x3817('0x41')];if(!_0x4e26ac[_0x3817('0x43')][_0x3817('0x49')](_0x3817('0x4a'))){_0x2618d9[_0x3817('0x4b')]=qs['limit'](_0x4e26ac[_0x3817('0x43')][_0x3817('0x4b')]);_0x2618d9['offset']=qs['offset'](_0x4e26ac[_0x3817('0x43')]['offset']);}_0x2618d9[_0x3817('0x4c')]=qs[_0x3817('0x4d')](_0x4e26ac['query']['sort']);_0x2618d9[_0x3817('0x4e')]=qs[_0x3817('0x44')](_[_0x3817('0x67')](_0x4e26ac[_0x3817('0x43')],_0x10af8e[_0x3817('0x44')]));_0x2618d9[_0x3817('0x4e')][_0x3817('0x64')]=_0x2cbe24['id'];if(_0x4e26ac[_0x3817('0x43')][_0x3817('0x4f')]){_0x2618d9[_0x3817('0x4e')]=_['merge'](_0x2618d9[_0x3817('0x4e')],{'$or':_[_0x3817('0x42')](_0x2618d9[_0x3817('0x46')],function(_0x1e97d5){var _0x2b6d53={};_0x2b6d53[_0x1e97d5]={'$like':'%'+_0x4e26ac[_0x3817('0x43')][_0x3817('0x4f')]+'%'};return _0x2b6d53;})});}_0x2618d9=_[_0x3817('0x50')]({},_0x2618d9,_0x4e26ac[_0x3817('0x51')]);return db[_0x3817('0x66')][_0x3817('0x2b')]({'where':_0x2618d9[_0x3817('0x4e')]})['then'](function(_0x5846d7){_0x2564b7[_0x3817('0x2b')]=_0x5846d7;if(_0x4e26ac['query'][_0x3817('0x52')]){_0x2618d9[_0x3817('0x57')]=[{'all':!![]}];}return db[_0x3817('0x66')]['findAll'](_0x2618d9);})[_0x3817('0x1c')](function(_0x5b7fe8){_0x2564b7['rows']=_0x5b7fe8;return _0x2564b7;});}})[_0x3817('0x1c')](respondWithFilteredResult(_0x514267,_0x2618d9))[_0x3817('0x25')](handleError(_0x514267,null));};exports['removeDispositions']=function(_0x1b1aac,_0x109f13,_0x5877f8){return db[_0x3817('0x3c')][_0x3817('0x58')]({'where':{'id':_0x1b1aac[_0x3817('0x61')]['id']}})[_0x3817('0x1c')](handleEntityNotFound(_0x109f13,null))[_0x3817('0x1c')](function(_0x17056f){if(_0x17056f){return _0x17056f[_0x3817('0x68')](_0x1b1aac[_0x3817('0x43')]['ids']);}})[_0x3817('0x1c')](respondWithStatusCode(_0x109f13,null))[_0x3817('0x25')](handleError(_0x109f13,null));};exports['addAnswer']=function(_0x57bd73,_0x1a5fcc,_0x1e4190){if(_0x57bd73['body']['id']){delete _0x57bd73['body']['id'];}return db[_0x3817('0x3c')][_0x3817('0x58')]({'where':{'id':_0x57bd73[_0x3817('0x61')]['id']}})['then'](handleEntityNotFound(_0x1a5fcc,null))[_0x3817('0x1c')](function(_0x12f311){if(_0x12f311){_0x57bd73['body'][_0x3817('0x64')]=_0x12f311['id'];return db[_0x3817('0x69')][_0x3817('0x59')](_0x57bd73['body']);}})[_0x3817('0x1c')](respondWithResult(_0x1a5fcc,null))[_0x3817('0x25')](handleError(_0x1a5fcc,null));};exports[_0x3817('0x6a')]=function(_0x21c92c,_0x5ee543,_0x5a6adb){var _0x57fe15={'raw':![],'where':{}};var _0x46503b={};var _0x58d774={'count':0x0,'rows':[]};return db[_0x3817('0x3c')][_0x3817('0x6b')]({'where':{'id':_0x21c92c[_0x3817('0x61')]['id']}})[_0x3817('0x1c')](handleEntityNotFound(_0x5ee543,null))['then'](function(_0x2b2dae){if(_0x2b2dae){_0x46503b[_0x3817('0x41')]=_[_0x3817('0x56')](db['CannedAnswer'][_0x3817('0x3d')]);_0x46503b[_0x3817('0x43')]=_[_0x3817('0x56')](_0x21c92c[_0x3817('0x43')]);_0x46503b[_0x3817('0x44')]=_[_0x3817('0x45')](_0x46503b[_0x3817('0x41')],_0x46503b[_0x3817('0x43')]);_0x57fe15[_0x3817('0x46')]=_[_0x3817('0x45')](_0x46503b[_0x3817('0x41')],qs['fields'](_0x21c92c['query'][_0x3817('0x47')]));_0x57fe15[_0x3817('0x46')]=_0x57fe15[_0x3817('0x46')][_0x3817('0x48')]?_0x57fe15['attributes']:_0x46503b[_0x3817('0x41')];if(!_0x21c92c[_0x3817('0x43')][_0x3817('0x49')]('nolimit')){_0x57fe15['limit']=qs[_0x3817('0x4b')](_0x21c92c[_0x3817('0x43')][_0x3817('0x4b')]);_0x57fe15[_0x3817('0x2c')]=qs['offset'](_0x21c92c[_0x3817('0x43')][_0x3817('0x2c')]);}_0x57fe15['order']=qs[_0x3817('0x4d')](_0x21c92c['query'][_0x3817('0x4d')]);_0x57fe15[_0x3817('0x4e')]=qs[_0x3817('0x44')](_['pick'](_0x21c92c[_0x3817('0x43')],_0x46503b[_0x3817('0x44')]));_0x57fe15[_0x3817('0x4e')][_0x3817('0x64')]=_0x2b2dae['id'];if(_0x21c92c[_0x3817('0x43')][_0x3817('0x4f')]){_0x57fe15[_0x3817('0x4e')]=_[_0x3817('0x50')](_0x57fe15[_0x3817('0x4e')],{'$or':_[_0x3817('0x42')](_0x57fe15[_0x3817('0x46')],function(_0x22bd34){var _0x257ac7={};_0x257ac7[_0x22bd34]={'$like':'%'+_0x21c92c[_0x3817('0x43')]['filter']+'%'};return _0x257ac7;})});}_0x57fe15=_[_0x3817('0x50')]({},_0x57fe15,_0x21c92c[_0x3817('0x51')]);return db[_0x3817('0x69')][_0x3817('0x2b')]({'where':_0x57fe15[_0x3817('0x4e')]})[_0x3817('0x1c')](function(_0x37b9f5){_0x58d774[_0x3817('0x2b')]=_0x37b9f5;if(_0x21c92c['query'][_0x3817('0x52')]){_0x57fe15[_0x3817('0x57')]=[{'all':!![]}];}return db[_0x3817('0x69')]['findAll'](_0x57fe15);})[_0x3817('0x1c')](function(_0x52ec7d){_0x58d774[_0x3817('0x54')]=_0x52ec7d;return _0x58d774;});}})[_0x3817('0x1c')](respondWithFilteredResult(_0x5ee543,_0x57fe15))[_0x3817('0x25')](handleError(_0x5ee543,null));};exports[_0x3817('0x6c')]=function(_0x2b6ada,_0x481746,_0x1da02b){return db['OpenchannelAccount'][_0x3817('0x58')]({'where':{'id':_0x2b6ada[_0x3817('0x61')]['id']}})['then'](handleEntityNotFound(_0x481746,null))['then'](function(_0x5e4be0){if(_0x5e4be0){return _0x5e4be0['removeAnswers'](_0x2b6ada[_0x3817('0x43')][_0x3817('0x6d')]);}})['then'](respondWithStatusCode(_0x481746,null))[_0x3817('0x25')](handleError(_0x481746,null));};exports['notify']=function(_0x38d9d0,_0x2d631e,_0x362f7a){var _0x221c5a={'body':_0x38d9d0[_0x3817('0x5a')],'channel':_0x3817('0x6e')};var _0x18e605=[];var _0x4d3ab2=[];var _0xbf4e17={};var _0x40c1b2=![];return db['CmContact']['describe']()[_0x3817('0x1c')](function(_0x496721){if(!_0x496721){throw new db[(_0x3817('0x6f'))][(_0x3817('0x70'))](_0x3817('0x71'));}_0x18e605=_['difference'](_['keys'](_0x496721),[_0x3817('0x72'),_0x3817('0x73')]);_0x4d3ab2=_['difference'](_[_0x3817('0x56')](_0x496721),[_0x3817('0x72'),_0x3817('0x73'),_0x3817('0x74'),_0x3817('0x75')]);if(_0x38d9d0[_0x3817('0x5a')]['id']){delete _0x38d9d0[_0x3817('0x5a')]['id'];}if(_[_0x3817('0x76')](_0x38d9d0[_0x3817('0x5a')][_0x3817('0x77')])){throw new db[(_0x3817('0x6f'))][(_0x3817('0x70'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x38d9d0[_0x3817('0x5a')][_0x3817('0x5a')])||_0x38d9d0[_0x3817('0x5a')][_0x3817('0x5a')]===''){throw new db['Sequelize'][(_0x3817('0x70'))](_0x3817('0x78'));}if(_[_0x3817('0x76')](_0x38d9d0[_0x3817('0x5a')][_0x3817('0x79')])){throw new db[(_0x3817('0x6f'))][(_0x3817('0x70'))](_0x3817('0x7a')+_0x4d3ab2);}if(!_[_0x3817('0x7b')](_0x4d3ab2,_0x38d9d0[_0x3817('0x5a')]['mapKey'])){throw new db[(_0x3817('0x6f'))][(_0x3817('0x70'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d3ab2);}_0xbf4e17[_0x38d9d0[_0x3817('0x5a')]['mapKey']]=_0x38d9d0[_0x3817('0x5a')]['from'];})[_0x3817('0x1c')](function(){return db[_0x3817('0x3c')][_0x3817('0x58')]({'where':{'id':_0x38d9d0[_0x3817('0x61')]['id']},'include':[{'model':db[_0x3817('0x7c')],'as':'List','include':[{'model':db['CmContact'],'as':_0x3817('0x7d'),'where':_0xbf4e17,'limit':0x1,'order':[[_0x3817('0x73'),'DESC']]}]},{'model':db[_0x3817('0x7e')],'as':_0x3817('0x7f')}]});})[_0x3817('0x1c')](handleEntityNotFound(_0x2d631e,null))[_0x3817('0x1c')](function(_0x2aa983){if(_0x2aa983&&_0x2aa983['List']){_0x221c5a['account']=_0x2aa983;_0x221c5a[_0x3817('0x80')]=_0x2aa983[_0x3817('0x7f')];_0x221c5a['list']=_0x2aa983[_0x3817('0x81')];_0x221c5a[_0x3817('0x80')]=_[_0x3817('0x82')](_0x221c5a['applications'],['priority'],[_0x3817('0x83')]);if(_0x221c5a[_0x3817('0x84')][_0x3817('0x7f')]){delete _0x221c5a[_0x3817('0x84')]['Applications'];}if(_0x221c5a[_0x3817('0x84')][_0x3817('0x81')]&&_0x221c5a[_0x3817('0x84')][_0x3817('0x81')]['Contacts'][_0x3817('0x48')]){return _0x221c5a[_0x3817('0x84')][_0x3817('0x81')][_0x3817('0x7d')][0x0];}var _0x254080=_[_0x3817('0x15')](_0x38d9d0[_0x3817('0x5a')],{'firstName':_0x38d9d0[_0x3817('0x5a')]['from'],'ListId':_0x2aa983['ListId']});_0x254080[_0x38d9d0[_0x3817('0x5a')][_0x3817('0x79')]]=_0x38d9d0['body'][_0x3817('0x77')];return db[_0x3817('0x85')]['create'](_0x254080,{'fields':_0x18e605,'raw':!![]});}})['then'](handleEntityNotFound(_0x2d631e,null))[_0x3817('0x1c')](function(_0x413bc0){_0x221c5a['contact']=_0x413bc0;if(_0x413bc0){var _0x344a9b={'ContactId':_0x413bc0['id'],'OpenchannelAccountId':_0x38d9d0[_0x3817('0x61')]['id'],'from':(_0x413bc0['firstName']||'')+'\x20'+(_0x413bc0[_0x3817('0x86')]||'')};var _0x588902={'OpenchannelAccountId':_0x38d9d0[_0x3817('0x61')]['id'],'closed':![]};if(_0x38d9d0[_0x3817('0x5a')][_0x3817('0x87')]){_0x588902[_0x3817('0x87')]=_0x38d9d0[_0x3817('0x5a')][_0x3817('0x87')];return db[_0x3817('0x88')][_0x3817('0x58')]({'where':_0x588902})[_0x3817('0x1c')](function(_0x3f5424){if(_0x3f5424){return[_0x3f5424,![]];}_0x344a9b['threadId']=_0x38d9d0[_0x3817('0x5a')][_0x3817('0x87')];_0x344a9b[_0x3817('0x89')]=_0x38d9d0[_0x3817('0x5a')][_0x3817('0x89')];return db[_0x3817('0x88')]['create'](_0x344a9b)[_0x3817('0x1c')](function(_0x119847){return[_0x119847,!![]];});});}else{_0x588902['threadId']=null;}_0x588902[_0x3817('0x8a')]=_0x413bc0['id'];return db[_0x3817('0x88')][_0x3817('0x58')]({'where':_0x588902})['then'](function(_0x32c749){if(_0x32c749){return[_0x32c749,![]];}return db[_0x3817('0x88')][_0x3817('0x59')](_0x344a9b)[_0x3817('0x1c')](function(_0x30e3cd){return[_0x30e3cd,!![]];});});}})[_0x3817('0x8b')](function(_0x322fa9,_0x1cd2aa){if(_0x322fa9){_0x40c1b2=_0x1cd2aa;if(!_0x1cd2aa){var _0xbc9efb={'from':(_0x221c5a[_0x3817('0x8c')][_0x3817('0x8d')]||'')+'\x20'+(_0x221c5a[_0x3817('0x8c')][_0x3817('0x86')]||'')};if(_0x38d9d0['body']['threadId']&&_0x38d9d0[_0x3817('0x5a')][_0x3817('0x8e')]&&_0x38d9d0[_0x3817('0x5a')][_0x3817('0x87')]!=_0x38d9d0[_0x3817('0x5a')][_0x3817('0x8e')]){_0xbc9efb[_0x3817('0x87')]=_0x38d9d0[_0x3817('0x5a')]['messageId'];}return _0x322fa9['update'](_0xbc9efb);}else{return _0x322fa9;}}})[_0x3817('0x1c')](function(_0x1826f4){_0x221c5a['interaction']=_0x1826f4['get']({'plain':!![]});_0x221c5a[_0x3817('0x8f')][_0x3817('0x90')]=_0x40c1b2;if(_0x221c5a[_0x3817('0x8f')][_0x3817('0x90')]){if(_0x221c5a[_0x3817('0x84')][_0x3817('0x91')]){_0x221c5a[_0x3817('0x80')][_0x3817('0x92')]({'id':0x0,'priority':_0x221c5a[_0x3817('0x80')][_0x3817('0x48')]+0x1,'app':'close','appdata':_0x3817('0x93'),'interval':_0x3817('0x94')});}}return db['OpenchannelMessage'][_0x3817('0x59')]({'body':_0x38d9d0[_0x3817('0x5a')][_0x3817('0x5a')],'OpenchannelAccountId':_0x38d9d0['params']['id'],'OpenchannelInteractionId':_0x1826f4['id'],'direction':'in','ContactId':_0x221c5a[_0x3817('0x8c')]['id'],'AttachmentId':_0x38d9d0[_0x3817('0x5a')][_0x3817('0x95')]});})[_0x3817('0x1c')](function(_0x43a6d3){_0x221c5a[_0x3817('0x23')]=_0x43a6d3;if(!_0x221c5a['interaction']['UserId'])return;return db[_0x3817('0x96')][_0x3817('0x58')]({'attributes':['id',_0x3817('0x38')],'where':{'id':_0x221c5a[_0x3817('0x8f')][_0x3817('0x97')]}});})[_0x3817('0x1c')](function(_0x4515be){if(_0x4515be){_0x221c5a['applications'][_0x3817('0x98')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4515be[_0x3817('0x38')]+','+(_0x221c5a[_0x3817('0x84')][_0x3817('0x99')]||0xa),'interval':_0x3817('0x94')});}if(!_0x221c5a['interaction'][_0x3817('0x9a')])return;return db[_0x3817('0x9b')][_0x3817('0x58')]({'attributes':['id',_0x3817('0x38')],'where':{'id':_0x221c5a[_0x3817('0x8f')][_0x3817('0x9a')]}});})['then'](function(_0x880c1b){if(_0x880c1b){_0x221c5a[_0x3817('0x80')]['unshift']({'id':0x0,'priority':0x1,'app':_0x3817('0x9c'),'appdata':_0x880c1b[_0x3817('0x38')]+','+(_0x221c5a[_0x3817('0x84')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3817('0x9d'),_0x3817('0x9e'),_0x221c5a);})[_0x3817('0x1c')](function(_0x2c5471){respondWithRpcPromise(_0x3817('0x9f'),_0x3817('0x9f'),{'event':'notify','message':_0x2c5471},client9002);return _0x2c5471;})['then'](respondWithResult(_0x2d631e,null))['catch'](handleError(_0x2d631e,null));};exports[_0x3817('0xa0')]=function(_0x5216be,_0x416694){var _0x4d3569=_0x5216be['params']['id'];var _0x150da0=_0x5216be['body'];var _0x421037=0xc8;var _0x3d2ae0=null;return db[_0x3817('0xa1')][_0x3817('0xa2')]({'isolationLevel':db[_0x3817('0xa1')][_0x3817('0xa3')][_0x3817('0xa4')]['READ_COMMITTED']},function(_0x5d3e19){return db[_0x3817('0x3c')][_0x3817('0x6b')]({'where':{'id':_0x4d3569},'transaction':_0x5d3e19})[_0x3817('0x1c')](function(_0x21f329){if(_0x21f329){return db['OpenchannelApplication'][_0x3817('0x33')]({'where':{'OpenchannelAccountId':_0x4d3569},'transaction':_0x5d3e19})[_0x3817('0x1c')](function(){var _0x290d82=_[_0x3817('0x42')](_0x150da0,function(_0x51d86e){_0x51d86e[_0x3817('0x64')]=_0x4d3569;return _0x51d86e;});return db[_0x3817('0x7e')][_0x3817('0xa5')](_0x290d82,{'transaction':_0x5d3e19});});}else{_0x421037=0x194;_0x3d2ae0=[];}});})[_0x3817('0x1c')](function(){if(_0x421037!==0x194){return db[_0x3817('0x7e')][_0x3817('0xa6')]({'where':{'OpenchannelAccountId':_0x4d3569},'order':_0x3817('0xa7')})['then'](function(_0x55c652){_0x3d2ae0=_0x55c652;});}})['catch'](function(_0x3bcd22){_0x421037=0x1f4;logger[_0x3817('0x21')](_0x3bcd22['stack']);if(_0x3bcd22[_0x3817('0x38')]){delete _0x3bcd22['name'];}_0x3d2ae0=_0x3bcd22;})[_0x3817('0xa8')](function(){if(_0x3d2ae0===null){_0x416694['sendStatus'](_0x421037);}else{if(_0x421037===0x1f4){_0x416694[_0x3817('0x27')](_0x421037)[_0x3817('0x39')](_0x3d2ae0);}else{_0x416694['status'](_0x421037)[_0x3817('0x29')](_0x3d2ae0);}}});};exports[_0x3817('0xa9')]=function(_0x14cd92,_0x421de7,_0x5d7d90){var _0x5b3b2b={};var _0x113c28={};var _0x13d476;var _0x2bd20b;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x14cd92[_0x3817('0x61')]['id']}})[_0x3817('0x1c')](handleEntityNotFound(_0x421de7,null))[_0x3817('0x1c')](function(_0x5ac894){if(_0x5ac894){_0x13d476=_0x5ac894;_0x113c28['model']=_[_0x3817('0x56')](db['OpenchannelApplication'][_0x3817('0x3d')]);_0x113c28[_0x3817('0x43')]=_[_0x3817('0x56')](_0x14cd92[_0x3817('0x43')]);_0x113c28['filters']=_[_0x3817('0x45')](_0x113c28[_0x3817('0x41')],_0x113c28[_0x3817('0x43')]);_0x5b3b2b['attributes']=_[_0x3817('0x45')](_0x113c28[_0x3817('0x41')],qs[_0x3817('0x47')](_0x14cd92[_0x3817('0x43')][_0x3817('0x47')]));_0x5b3b2b[_0x3817('0x46')]=_0x5b3b2b[_0x3817('0x46')]['length']?_0x5b3b2b[_0x3817('0x46')]:_0x113c28[_0x3817('0x41')];_0x5b3b2b[_0x3817('0x4c')]=qs[_0x3817('0x4d')](_0x14cd92[_0x3817('0x43')]['sort']);_0x5b3b2b[_0x3817('0x4e')]=qs['filters'](_['pick'](_0x14cd92[_0x3817('0x43')],_0x113c28[_0x3817('0x44')]));if(_0x14cd92[_0x3817('0x43')]['filter']){_0x5b3b2b['where']=_['merge'](_0x5b3b2b['where'],{'$or':_[_0x3817('0x42')](_0x5b3b2b[_0x3817('0x46')],function(_0x609208){var _0x5447b1={};_0x5447b1[_0x609208]={'$like':'%'+_0x14cd92[_0x3817('0x43')][_0x3817('0x4f')]+'%'};return _0x5447b1;})});}_0x5b3b2b=_[_0x3817('0x50')]({},_0x5b3b2b,_0x14cd92[_0x3817('0x51')]);return _0x13d476[_0x3817('0xa9')](_0x5b3b2b);}})[_0x3817('0x1c')](function(_0x39d202){if(_0x39d202){_0x2bd20b=_0x39d202['length'];if(!_0x14cd92[_0x3817('0x43')][_0x3817('0x49')](_0x3817('0x4a'))){_0x5b3b2b[_0x3817('0x4b')]=qs[_0x3817('0x4b')](_0x14cd92['query'][_0x3817('0x4b')]);_0x5b3b2b[_0x3817('0x2c')]=qs['offset'](_0x14cd92[_0x3817('0x43')][_0x3817('0x2c')]);}return _0x13d476['getApplications'](_0x5b3b2b);}})[_0x3817('0x1c')](function(_0x47f245){if(_0x47f245){return _0x47f245?{'count':_0x2bd20b,'rows':_0x47f245}:null;}})[_0x3817('0x1c')](respondWithResult(_0x421de7,null))[_0x3817('0x25')](handleError(_0x421de7,null));};exports[_0x3817('0xaa')]=function(_0x54fa4d,_0x1be646,_0x15b2ae){var _0x12a2ad={'raw':![],'where':{}};var _0x230a8c={};var _0x5c7c0a={'count':0x0,'rows':[]};return db[_0x3817('0x3c')][_0x3817('0x6b')]({'where':{'id':_0x54fa4d[_0x3817('0x61')]['id']}})['then'](handleEntityNotFound(_0x1be646,null))[_0x3817('0x1c')](function(_0x3697a0){if(_0x3697a0){_0x230a8c['model']=_[_0x3817('0x56')](db['OpenchannelInteraction']['rawAttributes']);_0x230a8c[_0x3817('0x43')]=_[_0x3817('0x56')](_0x54fa4d[_0x3817('0x43')]);_0x230a8c[_0x3817('0x44')]=_[_0x3817('0x45')](_0x230a8c[_0x3817('0x41')],_0x230a8c[_0x3817('0x43')]);_0x12a2ad[_0x3817('0x46')]=_[_0x3817('0x45')](_0x230a8c[_0x3817('0x41')],qs[_0x3817('0x47')](_0x54fa4d[_0x3817('0x43')]['fields']));_0x12a2ad[_0x3817('0x46')]=_0x12a2ad[_0x3817('0x46')][_0x3817('0x48')]?_0x12a2ad[_0x3817('0x46')]:_0x230a8c[_0x3817('0x41')];if(!_0x54fa4d[_0x3817('0x43')]['hasOwnProperty'](_0x3817('0x4a'))){_0x12a2ad[_0x3817('0x4b')]=qs['limit'](_0x54fa4d[_0x3817('0x43')]['limit']);_0x12a2ad['offset']=qs[_0x3817('0x2c')](_0x54fa4d[_0x3817('0x43')][_0x3817('0x2c')]);}_0x12a2ad[_0x3817('0x4c')]=qs[_0x3817('0x4d')](_0x54fa4d[_0x3817('0x43')]['sort']);_0x12a2ad[_0x3817('0x4e')]=qs[_0x3817('0x44')](_[_0x3817('0x67')](_0x54fa4d[_0x3817('0x43')],_0x230a8c[_0x3817('0x44')]));_0x12a2ad['where'][_0x3817('0x64')]=_0x3697a0['id'];if(_0x54fa4d['query'][_0x3817('0x4f')]){_0x12a2ad['where']=_[_0x3817('0x50')](_0x12a2ad['where'],{'$or':_['map'](_0x12a2ad[_0x3817('0x46')],function(_0x374b4b){var _0x3f24c6={};_0x3f24c6[_0x374b4b]={'$like':'%'+_0x54fa4d['query'][_0x3817('0x4f')]+'%'};return _0x3f24c6;})});}_0x12a2ad=_[_0x3817('0x50')]({},_0x12a2ad,_0x54fa4d[_0x3817('0x51')]);return db[_0x3817('0x88')][_0x3817('0x2b')]({'where':_0x12a2ad[_0x3817('0x4e')]})[_0x3817('0x1c')](function(_0x2711cb){_0x5c7c0a[_0x3817('0x2b')]=_0x2711cb;if(_0x54fa4d[_0x3817('0x43')][_0x3817('0x52')]){_0x12a2ad['include']=[{'model':db['CmContact'],'as':_0x3817('0xab'),'required':![]},{'model':db[_0x3817('0x96')],'as':_0x3817('0xac'),'attributes':[_0x3817('0x38'),_0x3817('0xad'),'internal'],'required':![]},{'model':db[_0x3817('0xae')],'as':_0x3817('0xaf'),'attributes':['id','name','color'],'where':_0x54fa4d[_0x3817('0x43')][_0x3817('0xb0')]?{'id':_0x54fa4d[_0x3817('0x43')][_0x3817('0xb0')]}:undefined,'required':_0x54fa4d[_0x3817('0x43')][_0x3817('0xb0')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x12a2ad);})['then'](function(_0x188011){_0x5c7c0a[_0x3817('0x54')]=_0x188011;return _0x5c7c0a;});}})['then'](respondWithFilteredResult(_0x1be646,_0x12a2ad))[_0x3817('0x25')](handleError(_0x1be646,null));};exports[_0x3817('0xb1')]=function(_0xfb9963,_0x28f8d1,_0x2b0e44){return db['OpenchannelAccount'][_0x3817('0x58')]({'where':{'id':_0xfb9963['params']['id']}})[_0x3817('0x1c')](handleEntityNotFound(_0x28f8d1,null))[_0x3817('0x1c')](function(_0xf563c7){if(_0xf563c7){return _0xf563c7['addAgents'](_0xfb9963['body'][_0x3817('0x6d')],_[_0x3817('0xb2')](_0xfb9963['body'],['ids','id'])||{})['spread'](function(_0x5c1dab){for(var _0x4ddbde=0x0;_0x4ddbde<_0xfb9963[_0x3817('0x5a')][_0x3817('0x6d')][_0x3817('0x48')];_0x4ddbde+=0x1){socket['emit'](_0x3817('0xb3'),{'UserId':Number(_0xfb9963[_0x3817('0x5a')][_0x3817('0x6d')][_0x4ddbde]),'OpenchannelAccountId':Number(_0xfb9963[_0x3817('0x61')]['id'])});}return _0x5c1dab;});}})[_0x3817('0x1c')](respondWithResult(_0x28f8d1,null))[_0x3817('0x25')](handleError(_0x28f8d1,null));};exports[_0x3817('0xb4')]=function(_0x49df59,_0x1ba49e,_0x5437fe){return db[_0x3817('0x3c')][_0x3817('0x58')]({'where':{'id':_0x49df59[_0x3817('0x61')]['id']}})[_0x3817('0x1c')](handleEntityNotFound(_0x1ba49e,null))['then'](function(_0x4bc434){if(_0x4bc434){return _0x4bc434[_0x3817('0xb4')](_0x49df59['query']['ids'])[_0x3817('0x1c')](function(){if(_[_0x3817('0xb5')](_0x49df59[_0x3817('0x43')][_0x3817('0x6d')])){for(var _0x489a79=0x0;_0x489a79<_0x49df59[_0x3817('0x43')][_0x3817('0x6d')][_0x3817('0x48')];_0x489a79+=0x1){socket[_0x3817('0xb6')](_0x3817('0xb7'),{'UserId':Number(_0x49df59[_0x3817('0x43')][_0x3817('0x6d')][_0x489a79]),'OpenchannelAccountId':Number(_0x49df59[_0x3817('0x61')]['id'])});}}else{socket['emit'](_0x3817('0xb7'),{'UserId':Number(_0x49df59['query'][_0x3817('0x6d')]),'OpenchannelAccountId':Number(_0x49df59[_0x3817('0x61')]['id'])});}});}})[_0x3817('0x1c')](respondWithStatusCode(_0x1ba49e,null))[_0x3817('0x25')](handleError(_0x1ba49e,null));};exports[_0x3817('0xb8')]=function(_0x305a46,_0x3902cc,_0x45952f){var _0x3dd940={};var _0x406fe5={};var _0x6569b5;var _0x599eb2;return db[_0x3817('0x3c')][_0x3817('0x6b')]({'where':{'id':_0x305a46[_0x3817('0x61')]['id']}})[_0x3817('0x1c')](handleEntityNotFound(_0x3902cc,null))[_0x3817('0x1c')](function(_0x1b38b4){if(_0x1b38b4){_0x6569b5=_0x1b38b4;_0x406fe5[_0x3817('0x41')]=_[_0x3817('0x56')](db[_0x3817('0x96')][_0x3817('0x3d')]);_0x406fe5[_0x3817('0x43')]=_['keys'](_0x305a46['query']);_0x406fe5[_0x3817('0x44')]=_[_0x3817('0x45')](_0x406fe5[_0x3817('0x41')],_0x406fe5[_0x3817('0x43')]);_0x3dd940['attributes']=_[_0x3817('0x45')](_0x406fe5[_0x3817('0x41')],qs[_0x3817('0x47')](_0x305a46[_0x3817('0x43')][_0x3817('0x47')]));_0x3dd940[_0x3817('0x46')]=_0x3dd940[_0x3817('0x46')][_0x3817('0x48')]?_0x3dd940[_0x3817('0x46')]:_0x406fe5[_0x3817('0x41')];_0x3dd940[_0x3817('0x4c')]=qs[_0x3817('0x4d')](_0x305a46[_0x3817('0x43')][_0x3817('0x4d')]);_0x3dd940['where']=qs[_0x3817('0x44')](_['pick'](_0x305a46[_0x3817('0x43')],_0x406fe5[_0x3817('0x44')]));if(_0x305a46[_0x3817('0x43')][_0x3817('0x4f')]){_0x3dd940[_0x3817('0x4e')]=_['merge'](_0x3dd940['where'],{'$or':_[_0x3817('0x42')](_0x3dd940[_0x3817('0x46')],function(_0x1f0c51){var _0x6215e2={};_0x6215e2[_0x1f0c51]={'$like':'%'+_0x305a46[_0x3817('0x43')][_0x3817('0x4f')]+'%'};return _0x6215e2;})});}_0x3dd940=_['merge']({},_0x3dd940,_0x305a46[_0x3817('0x51')]);return _0x6569b5[_0x3817('0xb8')](_0x3dd940);}})['then'](function(_0xf70079){if(_0xf70079){_0x599eb2=_0xf70079[_0x3817('0x48')];if(!_0x305a46[_0x3817('0x43')][_0x3817('0x49')](_0x3817('0x4a'))){_0x3dd940[_0x3817('0x4b')]=qs[_0x3817('0x4b')](_0x305a46[_0x3817('0x43')][_0x3817('0x4b')]);_0x3dd940['offset']=qs[_0x3817('0x2c')](_0x305a46['query']['offset']);}return _0x6569b5[_0x3817('0xb8')](_0x3dd940);}})[_0x3817('0x1c')](function(_0x1dcd7f){if(_0x1dcd7f){return _0x1dcd7f?{'count':_0x599eb2,'rows':_0x1dcd7f}:null;}})[_0x3817('0x1c')](respondWithResult(_0x3902cc,null))['catch'](handleError(_0x3902cc,null));};exports[_0x3817('0x39')]=function(_0x19e8db,_0xf45f05,_0x2662de){var _0x1a94d5,_0x1b7055,_0x4366fc;if(_[_0x3817('0x76')](_0x19e8db[_0x3817('0x5a')][_0x3817('0x5a')])||_0x19e8db[_0x3817('0x5a')][_0x3817('0x5a')]===''){throw new db[(_0x3817('0x6f'))][(_0x3817('0x70'))](_0x3817('0x78'));}if(_[_0x3817('0x76')](_0x19e8db[_0x3817('0x5a')]['to'])){}_0x1a94d5=_0x19e8db[_0x3817('0x5a')]['to'];return db[_0x3817('0x3c')][_0x3817('0x6b')]({'where':{'id':_0x19e8db[_0x3817('0x61')]['id']}})[_0x3817('0x1c')](handleEntityNotFound(_0xf45f05,null))['then'](function(_0x40efc2){if(_0x40efc2){return db[_0x3817('0x3c')][_0x3817('0x58')]({'where':{'id':_0x40efc2['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x3817('0x85')],'as':_0x3817('0x7d'),'where':{[_0x40efc2['mapKey']]:_0x1a94d5},'limit':0x1,'order':[[_0x3817('0x73'),'DESC']]}]}]})['then'](handleEntityNotFound(_0xf45f05,null))[_0x3817('0x1c')](function(_0x30bfee){if(_0x30bfee&&_0x30bfee[_0x3817('0x81')]){_0x1b7055=_0x30bfee[_0x3817('0x34')]({'plain':!![]});if(_0x1b7055['List']&&_0x1b7055[_0x3817('0x81')]['Contacts']['length']){return _0x1b7055[_0x3817('0x81')][_0x3817('0x7d')][0x0];}return db['CmContact']['create'](_[_0x3817('0x15')](_0x19e8db[_0x3817('0x5a')],{'firstName':_0x1a94d5,[_0x30bfee[_0x3817('0x79')]]:_0x1a94d5,'phone':_0x1a94d5,'ListId':_0x1b7055['ListId']}));}})[_0x3817('0x1c')](handleEntityNotFound(_0xf45f05,null))[_0x3817('0x1c')](function(_0x342892){if(_0x342892){_0x4366fc=_0x342892;return db[_0x3817('0x88')][_0x3817('0x58')]({'where':{'ContactId':_0x4366fc['id'],'closed':![],'OpenchannelAccountId':_0x1b7055['id']}})[_0x3817('0x1c')](function(_0x475deb){if(_0x475deb){return[_0x475deb,![]];}return db[_0x3817('0x88')][_0x3817('0x59')]({'UserId':_0x19e8db[_0x3817('0x5b')]['id'],'ContactId':_0x4366fc['id'],'OpenchannelAccountId':_0x1b7055['id'],'lastMsgDirection':_0x3817('0xb9'),'firstMsgDirection':_0x3817('0xb9'),'Messages':[_['merge'](_0x19e8db[_0x3817('0x5a')],{'read':![],'body':_0x19e8db[_0x3817('0x5a')][_0x3817('0x5a')],'OpenchannelAccountId':_0x1b7055['id'],'UserId':_0x19e8db['user']['id'],'ContactId':_0x4366fc['id']})]},{'include':[{'model':db[_0x3817('0xba')],'as':_0x3817('0xbb')}]})[_0x3817('0x1c')](function(_0x4b858b){return[_0x4b858b,!![]];});});}})[_0x3817('0x8b')](function(_0x538561,_0x525e3c){if(_0x525e3c){return _0x538561;}return db['OpenchannelMessage']['create'](_[_0x3817('0x50')](_0x19e8db[_0x3817('0x5a')],{'read':![],'body':_0x19e8db['body']['body'],'OpenchannelAccountId':_0x1b7055['id'],'OpenchannelInteractionId':_0x538561['id'],'UserId':_0x19e8db[_0x3817('0x5b')]['id'],'ContactId':_0x4366fc['id']}))[_0x3817('0x1c')](function(_0x5ea05f){_0x538561[_0x3817('0xbc')][_0x3817('0xbb')]=[];_0x538561[_0x3817('0xbc')][_0x3817('0xbb')][_0x3817('0x92')](_0x5ea05f[_0x3817('0xbc')]);return _0x538561;});});}})[_0x3817('0x1c')](respondWithResult(_0xf45f05,null))['catch'](handleError(_0xf45f05,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 8d30b38..aa738c8 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 _0x4483=['../../mysqldb','OpenchannelAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4483,0x1a3));var _0x3448=function(_0x57aad0,_0x21065c){_0x57aad0=_0x57aad0-0x0;var _0x35cea3=_0x4483[_0x57aad0];return _0x35cea3;};'use strict';var EventEmitter=require(_0x3448('0x0'));var OpenchannelAccount=require(_0x3448('0x1'))['db'][_0x3448('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3448('0x3'),'afterUpdate':_0x3448('0x4'),'afterDestroy':_0x3448('0x5')};function emitEvent(_0x3a7178){return function(_0xef1a93,_0x5f5163,_0xeb5b8){OpenchannelAccountEvents[_0x3448('0x6')](_0x3a7178+':'+_0xef1a93['id'],_0xef1a93);OpenchannelAccountEvents[_0x3448('0x6')](_0x3a7178,_0xef1a93);_0xeb5b8(null);};}for(var e in events){if(events[_0x3448('0x7')](e)){var event=events[e];OpenchannelAccount[_0x3448('0x8')](e,emitEvent(event));}}module[_0x3448('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x41bb=['../../mysqldb','setMaxListeners','update','remove','emit','events'];(function(_0x448a94,_0x130e5d){var _0x59c377=function(_0x5af117){while(--_0x5af117){_0x448a94['push'](_0x448a94['shift']());}};_0x59c377(++_0x130e5d);}(_0x41bb,0xc5));var _0xb41b=function(_0x2a3a50,_0x1d7cab){_0x2a3a50=_0x2a3a50-0x0;var _0x33ae6c=_0x41bb[_0x2a3a50];return _0x33ae6c;};'use strict';var EventEmitter=require(_0xb41b('0x0'));var OpenchannelAccount=require(_0xb41b('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb41b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb41b('0x3'),'afterDestroy':_0xb41b('0x4')};function emitEvent(_0x148333){return function(_0x448c8e,_0x4ee21b,_0x12cea3){OpenchannelAccountEvents[_0xb41b('0x5')](_0x148333+':'+_0x448c8e['id'],_0x448c8e);OpenchannelAccountEvents[_0xb41b('0x5')](_0x148333,_0x448c8e);_0x12cea3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 6e42f87..bd38365 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(_0x59a344,_0x594632){var _0x330933=function(_0x3822d5){while(--_0x3822d5){_0x59a344['push'](_0x59a344['shift']());}};_0x330933(++_0x594632);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x181d19,_0x15914c){var _0x51aa83=function(_0x17d0aa){while(--_0x17d0aa){_0x181d19['push'](_0x181d19['shift']());}};_0x51aa83(++_0x15914c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 78832f7..04a46b8 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 _0x2504=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x413068,_0x1bb925){var _0x1ae172=function(_0x338006){while(--_0x338006){_0x413068['push'](_0x413068['shift']());}};_0x1ae172(++_0x1bb925);}(_0x2504,0xee));var _0x4250=function(_0xc14862,_0x16c15d){_0xc14862=_0xc14862-0x0;var _0x12b334=_0x2504[_0xc14862];return _0x12b334;};'use strict';var _=require(_0x4250('0x0'));var util=require(_0x4250('0x1'));var moment=require(_0x4250('0x2'));var BPromise=require(_0x4250('0x3'));var rs=require(_0x4250('0x4'));var fs=require('fs');var Redis=require(_0x4250('0x5'));var db=require(_0x4250('0x6'))['db'];var utils=require(_0x4250('0x7'));var logger=require(_0x4250('0x8'))(_0x4250('0x9'));var config=require(_0x4250('0xa'));var jayson=require(_0x4250('0xb'));var client=jayson['client'][_0x4250('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4250('0xd')],{'host':_0x4250('0xe'),'port':0x18eb});var socket=require(_0x4250('0xf'))(new Redis(config[_0x4250('0xd')]));require(_0x4250('0x10'))['register'](socket);function respondWithRpcPromise(_0x1016b9,_0x49bf26,_0x2de8a7){return new BPromise(function(_0x2ff5ca,_0x55a792){return client[_0x4250('0x11')](_0x1016b9,_0x2de8a7)['then'](function(_0x535015){logger[_0x4250('0x12')](_0x4250('0x13'),_0x49bf26,_0x4250('0x14'));logger[_0x4250('0x15')](_0x4250('0x16'),_0x49bf26,'request\x20sent',JSON[_0x4250('0x17')](_0x535015));if(_0x535015[_0x4250('0x18')]){if(_0x535015[_0x4250('0x18')][_0x4250('0x19')]===0x1f4){logger[_0x4250('0x18')](_0x4250('0x13'),_0x49bf26,_0x535015['error'][_0x4250('0x1a')]);return _0x55a792(_0x535015[_0x4250('0x18')][_0x4250('0x1a')]);}logger[_0x4250('0x18')](_0x4250('0x13'),_0x49bf26,_0x535015[_0x4250('0x18')][_0x4250('0x1a')]);return _0x2ff5ca(_0x535015['error'][_0x4250('0x1a')]);}else{logger[_0x4250('0x12')](_0x4250('0x13'),_0x49bf26,_0x4250('0x14'));_0x2ff5ca(_0x535015[_0x4250('0x1b')][_0x4250('0x1a')]);}})[_0x4250('0x1c')](function(_0x508bc3){logger[_0x4250('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x49bf26,_0x508bc3);_0x55a792(_0x508bc3);});});} \ No newline at end of file +var _0xefda=['socket.io-emitter','./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x552bfc,_0x22f202){var _0x3f996e=function(_0x610b81){while(--_0x610b81){_0x552bfc['push'](_0x552bfc['shift']());}};_0x3f996e(++_0x22f202);}(_0xefda,0x96));var _0xaefd=function(_0x56c2cb,_0x2ac564){_0x56c2cb=_0x56c2cb-0x0;var _0x372b58=_0xefda[_0x56c2cb];return _0x372b58;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaefd('0x1'));var rs=require(_0xaefd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefd('0x3'))['db'];var utils=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));var config=require(_0xaefd('0x7'));var jayson=require(_0xaefd('0x8'));var client=jayson['client'][_0xaefd('0x9')]({'port':0x232a});config[_0xaefd('0xa')]=_[_0xaefd('0xb')](config[_0xaefd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xaefd('0xc'))(new Redis(config[_0xaefd('0xa')]));require(_0xaefd('0xd'))['register'](socket);function respondWithRpcPromise(_0x48a255,_0x54a3b1,_0xa6239d){return new BPromise(function(_0x16b36e,_0x20135c){return client[_0xaefd('0xe')](_0x48a255,_0xa6239d)[_0xaefd('0xf')](function(_0x1e00fb){logger[_0xaefd('0x10')](_0xaefd('0x11'),_0x54a3b1,_0xaefd('0x12'));logger[_0xaefd('0x13')](_0xaefd('0x14'),_0x54a3b1,'request\x20sent',JSON[_0xaefd('0x15')](_0x1e00fb));if(_0x1e00fb['error']){if(_0x1e00fb[_0xaefd('0x16')][_0xaefd('0x17')]===0x1f4){logger[_0xaefd('0x16')](_0xaefd('0x11'),_0x54a3b1,_0x1e00fb['error'][_0xaefd('0x18')]);return _0x20135c(_0x1e00fb[_0xaefd('0x16')][_0xaefd('0x18')]);}logger[_0xaefd('0x16')](_0xaefd('0x11'),_0x54a3b1,_0x1e00fb[_0xaefd('0x16')][_0xaefd('0x18')]);return _0x16b36e(_0x1e00fb[_0xaefd('0x16')]['message']);}else{logger[_0xaefd('0x10')](_0xaefd('0x11'),_0x54a3b1,_0xaefd('0x12'));_0x16b36e(_0x1e00fb[_0xaefd('0x19')][_0xaefd('0x18')]);}})[_0xaefd('0x1a')](function(_0x516e84){logger[_0xaefd('0x16')](_0xaefd('0x11'),_0x54a3b1,_0x516e84);_0x20135c(_0x516e84);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 05cd571..c74bb4e 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 _0x2bdb=['openchannelAccount:','./openchannelAccount.events','remove','removeListener','register'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0x2bdb,0x105));var _0xb2bd=function(_0x22b824,_0x54e2cb){_0x22b824=_0x22b824-0x0;var _0x573452=_0x2bdb[_0x22b824];return _0x573452;};'use strict';var OpenchannelAccountEvents=require(_0xb2bd('0x0'));var events=['save',_0xb2bd('0x1'),'update'];function createListener(_0x3b40de,_0x1d3ddb){return function(_0xab9a35){_0x1d3ddb['emit'](_0x3b40de,_0xab9a35);};}function removeListener(_0x438ced,_0x2be356){return function(){OpenchannelAccountEvents[_0xb2bd('0x2')](_0x438ced,_0x2be356);};}exports[_0xb2bd('0x3')]=function(_0x461137){for(var _0x2ef40b=0x0,_0x3bff5b=events['length'];_0x2ef40b<_0x3bff5b;_0x2ef40b++){var _0x21462b=events[_0x2ef40b];var _0x4d9d3f=createListener(_0xb2bd('0x4')+_0x21462b,_0x461137);OpenchannelAccountEvents['on'](_0x21462b,_0x4d9d3f);}}; \ No newline at end of file +var _0x3715=['removeListener','register','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit'];(function(_0x120d4d,_0x45e308){var _0x3af307=function(_0x3577bb){while(--_0x3577bb){_0x120d4d['push'](_0x120d4d['shift']());}};_0x3af307(++_0x45e308);}(_0x3715,0xc3));var _0x5371=function(_0x245cf0,_0x56bfb0){_0x245cf0=_0x245cf0-0x0;var _0x4be6b2=_0x3715[_0x245cf0];return _0x4be6b2;};'use strict';var OpenchannelAccountEvents=require(_0x5371('0x0'));var events=[_0x5371('0x1'),_0x5371('0x2'),_0x5371('0x3')];function createListener(_0x7304fb,_0x2f9a2c){return function(_0x132ef3){_0x2f9a2c[_0x5371('0x4')](_0x7304fb,_0x132ef3);};}function removeListener(_0x3ff067,_0x355d6a){return function(){OpenchannelAccountEvents[_0x5371('0x5')](_0x3ff067,_0x355d6a);};}exports[_0x5371('0x6')]=function(_0x50a759){for(var _0x1ffdcb=0x0,_0x340e44=events['length'];_0x1ffdcb<_0x340e44;_0x1ffdcb++){var _0x426a2a=events[_0x1ffdcb];var _0x16c64a=createListener(_0x5371('0x7')+_0x426a2a,_0x50a759);OpenchannelAccountEvents['on'](_0x426a2a,_0x16c64a);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 7450934..d8931b6 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 _0xc06f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5de83e,_0x58dc33){var _0x20559a=function(_0x15af49){while(--_0x15af49){_0x5de83e['push'](_0x5de83e['shift']());}};_0x20559a(++_0x58dc33);}(_0xc06f,0xd5));var _0xfc06=function(_0x2271dd,_0x5a7e61){_0x2271dd=_0x2271dd-0x0;var _0x7dd33b=_0xc06f[_0x2271dd];return _0x7dd33b;};'use strict';var multer=require(_0xfc06('0x0'));var util=require(_0xfc06('0x1'));var path=require(_0xfc06('0x2'));var timeout=require(_0xfc06('0x3'));var express=require(_0xfc06('0x4'));var router=express[_0xfc06('0x5')]();var fs_extra=require(_0xfc06('0x6'));var auth=require(_0xfc06('0x7'));var interaction=require(_0xfc06('0x8'));var config=require(_0xfc06('0x9'));var controller=require(_0xfc06('0xa'));router[_0xfc06('0xb')]('/',auth[_0xfc06('0xc')](),controller[_0xfc06('0xd')]);router[_0xfc06('0xb')](_0xfc06('0xe'),auth[_0xfc06('0xc')](),controller[_0xfc06('0xf')]);router[_0xfc06('0x10')]('/',auth[_0xfc06('0xc')](),controller[_0xfc06('0x11')]);router[_0xfc06('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xfc06('0x13')]);router[_0xfc06('0x14')](_0xfc06('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xfc06('0x15')]=router; \ No newline at end of file +var _0xd5ab=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./openchannelApplication.controller','get','/:id','isAuthenticated','show','create','put','update'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd5ab,0x162));var _0xbd5a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd5ab[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xbd5a('0x0'));var util=require('util');var path=require(_0xbd5a('0x1'));var timeout=require(_0xbd5a('0x2'));var express=require(_0xbd5a('0x3'));var router=express['Router']();var fs_extra=require(_0xbd5a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbd5a('0x5'));var controller=require(_0xbd5a('0x6'));router[_0xbd5a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xbd5a('0x8'),auth[_0xbd5a('0x9')](),controller[_0xbd5a('0xa')]);router['post']('/',auth[_0xbd5a('0x9')](),controller[_0xbd5a('0xb')]);router[_0xbd5a('0xc')]('/:id',auth[_0xbd5a('0x9')](),controller[_0xbd5a('0xd')]);router['delete'](_0xbd5a('0x8'),auth[_0xbd5a('0x9')](),controller[_0xbd5a('0xe')]);module[_0xbd5a('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 9666b15..fcdb115 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 _0x835e=['STRING','*,*,*,*','exports','INTEGER'];(function(_0x3574b7,_0x14381e){var _0x242cc3=function(_0x12d283){while(--_0x12d283){_0x3574b7['push'](_0x3574b7['shift']());}};_0x242cc3(++_0x14381e);}(_0x835e,0x19e));var _0xe835=function(_0x5d1da5,_0x17ee56){_0x5d1da5=_0x5d1da5-0x0;var _0x31ca28=_0x835e[_0x5d1da5];return _0x31ca28;};'use strict';var Sequelize=require('sequelize');module[_0xe835('0x0')]={'priority':{'type':Sequelize[_0xe835('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe835('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe835('0x2')]},'interval':{'type':Sequelize[_0xe835('0x2')],'defaultValue':_0xe835('0x3')}}; \ No newline at end of file +var _0xaddd=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaddd,0x175));var _0xdadd=function(_0x8cb2f9,_0x2b8706){_0x8cb2f9=_0x8cb2f9-0x0;var _0x164887=_0xaddd[_0x8cb2f9];return _0x164887;};'use strict';var Sequelize=require('sequelize');module[_0xdadd('0x0')]={'priority':{'type':Sequelize[_0xdadd('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xdadd('0x2')],'allowNull':![],'defaultValue':_0xdadd('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xdadd('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xdadd('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 51eac9b..8c15623 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 _0x6d78=['show','include','find','create','body','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelApplication','includeAll','findAll','rows','catch'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6d78,0xa0));var _0x86d7=function(_0x58f074,_0x1d9f08){_0x58f074=_0x58f074-0x0;var _0x2978d2=_0x6d78[_0x58f074];return _0x2978d2;};'use strict';var emlformat=require(_0x86d7('0x0'));var rimraf=require(_0x86d7('0x1'));var zipdir=require(_0x86d7('0x2'));var jsonpatch=require(_0x86d7('0x3'));var rp=require(_0x86d7('0x4'));var moment=require('moment');var BPromise=require(_0x86d7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x86d7('0x6'));var csv=require(_0x86d7('0x7'));var ejs=require(_0x86d7('0x8'));var fs=require('fs');var fs_extra=require(_0x86d7('0x9'));var _=require(_0x86d7('0xa'));var squel=require(_0x86d7('0xb'));var crypto=require(_0x86d7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x86d7('0xd'));var toCsv=require(_0x86d7('0x7'));var querystring=require(_0x86d7('0xe'));var Papa=require(_0x86d7('0xf'));var Redis=require(_0x86d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x86d7('0x11'));var as=require(_0x86d7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d7('0x13'))(_0x86d7('0x14'));var utils=require(_0x86d7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x86d7('0x16'));var db=require(_0x86d7('0x17'))['db'];function respondWithStatusCode(_0x5a27ad,_0x388ca9){_0x388ca9=_0x388ca9||0xcc;return function(_0x3e7a41){if(_0x3e7a41){return _0x5a27ad[_0x86d7('0x18')](_0x388ca9);}return _0x5a27ad['status'](_0x388ca9)[_0x86d7('0x19')]();};}function respondWithResult(_0x39e963,_0x39ebab){_0x39ebab=_0x39ebab||0xc8;return function(_0x5b91c8){if(_0x5b91c8){return _0x39e963[_0x86d7('0x1a')](_0x39ebab)['json'](_0x5b91c8);}};}function respondWithFilteredResult(_0x1b4f96,_0xeb2ff9){return function(_0x34651f){if(_0x34651f){var _0x7ad8c5=typeof _0xeb2ff9[_0x86d7('0x1b')]==='undefined'&&typeof _0xeb2ff9[_0x86d7('0x1c')]===_0x86d7('0x1d');var _0x5d1e4b=_0x34651f[_0x86d7('0x1e')];var _0x4d28b6=_0x7ad8c5?0x0:_0xeb2ff9[_0x86d7('0x1b')];var _0x362bde=_0x7ad8c5?_0x34651f[_0x86d7('0x1e')]:_0xeb2ff9[_0x86d7('0x1b')]+_0xeb2ff9[_0x86d7('0x1c')];var _0xb2c8ed;if(_0x362bde>=_0x5d1e4b){_0x362bde=_0x5d1e4b;_0xb2c8ed=0xc8;}else{_0xb2c8ed=0xce;}_0x1b4f96['status'](_0xb2c8ed);return _0x1b4f96[_0x86d7('0x1f')](_0x86d7('0x20'),_0x4d28b6+'-'+_0x362bde+'/'+_0x5d1e4b)[_0x86d7('0x21')](_0x34651f);}return null;};}function patchUpdates(_0x5835be){return function(_0x25716c){try{jsonpatch[_0x86d7('0x22')](_0x25716c,_0x5835be,!![]);}catch(_0x25101d){return BPromise[_0x86d7('0x23')](_0x25101d);}return _0x25716c['save']();};}function saveUpdates(_0x5ecc18,_0x15221e){return function(_0x8238a8){if(_0x8238a8){return _0x8238a8['update'](_0x5ecc18)[_0x86d7('0x24')](function(_0x1b80d8){return _0x1b80d8;});}return null;};}function removeEntity(_0x4a5385,_0x4465d6){return function(_0x408d65){if(_0x408d65){return _0x408d65['destroy']()[_0x86d7('0x24')](function(){_0x4a5385[_0x86d7('0x1a')](0xcc)[_0x86d7('0x19')]();});}};}function handleEntityNotFound(_0x38261e,_0x4a3285){return function(_0x1d33b4){if(!_0x1d33b4){_0x38261e[_0x86d7('0x18')](0x194);}return _0x1d33b4;};}function handleError(_0x17c7f8,_0x2541a7){_0x2541a7=_0x2541a7||0x1f4;return function(_0x594153){logger[_0x86d7('0x25')](_0x594153[_0x86d7('0x26')]);if(_0x594153[_0x86d7('0x27')]){delete _0x594153[_0x86d7('0x27')];}_0x17c7f8[_0x86d7('0x1a')](_0x2541a7)['send'](_0x594153);};}exports[_0x86d7('0x28')]=function(_0x15b5fb,_0x162186){var _0x241db1={},_0x189cf2={},_0x4051d6={'count':0x0,'rows':[]};var _0x3b10da=_[_0x86d7('0x29')](db['OpenchannelApplication'][_0x86d7('0x2a')],function(_0x3ce5e4){return{'name':_0x3ce5e4[_0x86d7('0x2b')],'type':_0x3ce5e4[_0x86d7('0x2c')][_0x86d7('0x2d')]};});_0x189cf2[_0x86d7('0x2e')]=_[_0x86d7('0x29')](_0x3b10da,_0x86d7('0x27'));_0x189cf2['query']=_[_0x86d7('0x2f')](_0x15b5fb[_0x86d7('0x30')]);_0x189cf2[_0x86d7('0x31')]=_[_0x86d7('0x32')](_0x189cf2['model'],_0x189cf2[_0x86d7('0x30')]);_0x241db1[_0x86d7('0x33')]=_[_0x86d7('0x32')](_0x189cf2['model'],qs[_0x86d7('0x34')](_0x15b5fb['query']['fields']));_0x241db1[_0x86d7('0x33')]=_0x241db1[_0x86d7('0x33')][_0x86d7('0x35')]?_0x241db1[_0x86d7('0x33')]:_0x189cf2['model'];if(!_0x15b5fb[_0x86d7('0x30')][_0x86d7('0x36')](_0x86d7('0x37'))){_0x241db1[_0x86d7('0x1c')]=qs['limit'](_0x15b5fb[_0x86d7('0x30')][_0x86d7('0x1c')]);_0x241db1[_0x86d7('0x1b')]=qs[_0x86d7('0x1b')](_0x15b5fb['query'][_0x86d7('0x1b')]);}_0x241db1[_0x86d7('0x38')]=qs[_0x86d7('0x39')](_0x15b5fb[_0x86d7('0x30')][_0x86d7('0x39')]);_0x241db1[_0x86d7('0x3a')]=qs[_0x86d7('0x31')](_['pick'](_0x15b5fb[_0x86d7('0x30')],_0x189cf2[_0x86d7('0x31')]),_0x3b10da);if(_0x15b5fb[_0x86d7('0x30')][_0x86d7('0x3b')]){_0x241db1[_0x86d7('0x3a')]=_[_0x86d7('0x3c')](_0x241db1['where'],{'$or':_[_0x86d7('0x29')](_0x3b10da,function(_0x1496f7){if(_0x1496f7[_0x86d7('0x2c')]!==_0x86d7('0x3d')){var _0x16234b={};_0x16234b[_0x1496f7[_0x86d7('0x27')]]={'$like':'%'+_0x15b5fb[_0x86d7('0x30')][_0x86d7('0x3b')]+'%'};return _0x16234b;}})});}_0x241db1=_['merge']({},_0x241db1,_0x15b5fb[_0x86d7('0x3e')]);var _0x1b71c0={'where':_0x241db1['where']};return db[_0x86d7('0x3f')][_0x86d7('0x1e')](_0x1b71c0)['then'](function(_0x5db5de){_0x4051d6['count']=_0x5db5de;if(_0x15b5fb[_0x86d7('0x30')][_0x86d7('0x40')]){_0x241db1['include']=[{'all':!![]}];}return db[_0x86d7('0x3f')][_0x86d7('0x41')](_0x241db1);})[_0x86d7('0x24')](function(_0xe680e5){_0x4051d6[_0x86d7('0x42')]=_0xe680e5;return _0x4051d6;})[_0x86d7('0x24')](respondWithFilteredResult(_0x162186,_0x241db1))[_0x86d7('0x43')](handleError(_0x162186,null));};exports[_0x86d7('0x44')]=function(_0x6f3f5d,_0x509be7){var _0x1330f8={'raw':!![],'where':{'id':_0x6f3f5d['params']['id']}},_0x28bae8={};_0x28bae8[_0x86d7('0x2e')]=_[_0x86d7('0x2f')](db['OpenchannelApplication'][_0x86d7('0x2a')]);_0x28bae8[_0x86d7('0x30')]=_[_0x86d7('0x2f')](_0x6f3f5d[_0x86d7('0x30')]);_0x28bae8[_0x86d7('0x31')]=_[_0x86d7('0x32')](_0x28bae8[_0x86d7('0x2e')],_0x28bae8[_0x86d7('0x30')]);_0x1330f8[_0x86d7('0x33')]=_[_0x86d7('0x32')](_0x28bae8[_0x86d7('0x2e')],qs[_0x86d7('0x34')](_0x6f3f5d[_0x86d7('0x30')][_0x86d7('0x34')]));_0x1330f8['attributes']=_0x1330f8[_0x86d7('0x33')][_0x86d7('0x35')]?_0x1330f8[_0x86d7('0x33')]:_0x28bae8[_0x86d7('0x2e')];if(_0x6f3f5d[_0x86d7('0x30')]['includeAll']){_0x1330f8[_0x86d7('0x45')]=[{'all':!![]}];}_0x1330f8=_[_0x86d7('0x3c')]({},_0x1330f8,_0x6f3f5d['options']);return db[_0x86d7('0x3f')][_0x86d7('0x46')](_0x1330f8)[_0x86d7('0x24')](handleEntityNotFound(_0x509be7,null))[_0x86d7('0x24')](respondWithResult(_0x509be7,null))['catch'](handleError(_0x509be7,null));};exports[_0x86d7('0x47')]=function(_0x5185b1,_0x18f6ae){return db[_0x86d7('0x3f')]['create'](_0x5185b1[_0x86d7('0x48')],{})[_0x86d7('0x24')](respondWithResult(_0x18f6ae,0xc9))['catch'](handleError(_0x18f6ae,null));};exports[_0x86d7('0x49')]=function(_0x5364e7,_0x404f5a){if(_0x5364e7[_0x86d7('0x48')]['id']){delete _0x5364e7[_0x86d7('0x48')]['id'];}return db[_0x86d7('0x3f')][_0x86d7('0x46')]({'where':{'id':_0x5364e7[_0x86d7('0x4a')]['id']}})[_0x86d7('0x24')](handleEntityNotFound(_0x404f5a,null))[_0x86d7('0x24')](saveUpdates(_0x5364e7[_0x86d7('0x48')],null))[_0x86d7('0x24')](respondWithResult(_0x404f5a,null))[_0x86d7('0x43')](handleError(_0x404f5a,null));};exports[_0x86d7('0x4b')]=function(_0x1d5ecf,_0x590120){return db[_0x86d7('0x3f')][_0x86d7('0x46')]({'where':{'id':_0x1d5ecf[_0x86d7('0x4a')]['id']}})[_0x86d7('0x24')](handleEntityNotFound(_0x590120,null))[_0x86d7('0x24')](removeEntity(_0x590120,null))['catch'](handleError(_0x590120,null));}; \ No newline at end of file +var _0x4a65=['../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','update','then','destroy','end','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','show','params','find','catch','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'];(function(_0x1a1b1d,_0x1f1c56){var _0x3ae8ba=function(_0x3a1147){while(--_0x3a1147){_0x1a1b1d['push'](_0x1a1b1d['shift']());}};_0x3ae8ba(++_0x1f1c56);}(_0x4a65,0xc0));var _0x54a6=function(_0x2014bc,_0x168035){_0x2014bc=_0x2014bc-0x0;var _0x2ddb82=_0x4a65[_0x2014bc];return _0x2ddb82;};'use strict';var emlformat=require(_0x54a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x54a6('0x1'));var jsonpatch=require(_0x54a6('0x2'));var rp=require(_0x54a6('0x3'));var moment=require(_0x54a6('0x4'));var BPromise=require(_0x54a6('0x5'));var Mustache=require(_0x54a6('0x6'));var util=require(_0x54a6('0x7'));var path=require(_0x54a6('0x8'));var sox=require('sox');var csv=require(_0x54a6('0x9'));var ejs=require(_0x54a6('0xa'));var fs=require('fs');var fs_extra=require(_0x54a6('0xb'));var _=require(_0x54a6('0xc'));var squel=require(_0x54a6('0xd'));var crypto=require(_0x54a6('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x54a6('0x9'));var querystring=require(_0x54a6('0xf'));var Papa=require('papaparse');var Redis=require(_0x54a6('0x10'));var authService=require(_0x54a6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x54a6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x54a6('0x13'))('api');var utils=require(_0x54a6('0x14'));var config=require(_0x54a6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x54a6('0x16'))['db'];function respondWithStatusCode(_0x47697f,_0x35593a){_0x35593a=_0x35593a||0xcc;return function(_0x1b8dbf){if(_0x1b8dbf){return _0x47697f[_0x54a6('0x17')](_0x35593a);}return _0x47697f[_0x54a6('0x18')](_0x35593a)['end']();};}function respondWithResult(_0x801165,_0x1bf0c1){_0x1bf0c1=_0x1bf0c1||0xc8;return function(_0x203775){if(_0x203775){return _0x801165[_0x54a6('0x18')](_0x1bf0c1)[_0x54a6('0x19')](_0x203775);}};}function respondWithFilteredResult(_0x27734c,_0x4610b1){return function(_0x3034e6){if(_0x3034e6){var _0x142063=typeof _0x4610b1[_0x54a6('0x1a')]===_0x54a6('0x1b')&&typeof _0x4610b1['limit']===_0x54a6('0x1b');var _0xf2a515=_0x3034e6[_0x54a6('0x1c')];var _0x1b3b0c=_0x142063?0x0:_0x4610b1[_0x54a6('0x1a')];var _0x5c1783=_0x142063?_0x3034e6[_0x54a6('0x1c')]:_0x4610b1[_0x54a6('0x1a')]+_0x4610b1['limit'];var _0x41a833;if(_0x5c1783>=_0xf2a515){_0x5c1783=_0xf2a515;_0x41a833=0xc8;}else{_0x41a833=0xce;}_0x27734c[_0x54a6('0x18')](_0x41a833);return _0x27734c['set'](_0x54a6('0x1d'),_0x1b3b0c+'-'+_0x5c1783+'/'+_0xf2a515)['json'](_0x3034e6);}return null;};}function patchUpdates(_0x31373d){return function(_0x306c06){try{jsonpatch[_0x54a6('0x1e')](_0x306c06,_0x31373d,!![]);}catch(_0x4ff8f9){return BPromise[_0x54a6('0x1f')](_0x4ff8f9);}return _0x306c06['save']();};}function saveUpdates(_0x428e77,_0x16584a){return function(_0x1802ac){if(_0x1802ac){return _0x1802ac[_0x54a6('0x20')](_0x428e77)[_0x54a6('0x21')](function(_0x1ce8ce){return _0x1ce8ce;});}return null;};}function removeEntity(_0x370f41,_0x4c30c8){return function(_0x1728c8){if(_0x1728c8){return _0x1728c8[_0x54a6('0x22')]()['then'](function(){_0x370f41[_0x54a6('0x18')](0xcc)[_0x54a6('0x23')]();});}};}function handleEntityNotFound(_0x195bac,_0x38728f){return function(_0xdc03e8){if(!_0xdc03e8){_0x195bac[_0x54a6('0x17')](0x194);}return _0xdc03e8;};}function handleError(_0x2c0c7c,_0x1ecaed){_0x1ecaed=_0x1ecaed||0x1f4;return function(_0x39bbde){logger['error'](_0x39bbde[_0x54a6('0x24')]);if(_0x39bbde[_0x54a6('0x25')]){delete _0x39bbde['name'];}_0x2c0c7c[_0x54a6('0x18')](_0x1ecaed)['send'](_0x39bbde);};}exports[_0x54a6('0x26')]=function(_0x1a1a40,_0x55b672){var _0x2514d0={},_0x418156={},_0x4295e0={'count':0x0,'rows':[]};var _0x23a4a5=_[_0x54a6('0x27')](db[_0x54a6('0x28')][_0x54a6('0x29')],function(_0x30beaf){return{'name':_0x30beaf[_0x54a6('0x2a')],'type':_0x30beaf[_0x54a6('0x2b')]['key']};});_0x418156[_0x54a6('0x2c')]=_[_0x54a6('0x27')](_0x23a4a5,_0x54a6('0x25'));_0x418156[_0x54a6('0x2d')]=_[_0x54a6('0x2e')](_0x1a1a40['query']);_0x418156[_0x54a6('0x2f')]=_[_0x54a6('0x30')](_0x418156[_0x54a6('0x2c')],_0x418156[_0x54a6('0x2d')]);_0x2514d0[_0x54a6('0x31')]=_[_0x54a6('0x30')](_0x418156[_0x54a6('0x2c')],qs['fields'](_0x1a1a40['query'][_0x54a6('0x32')]));_0x2514d0[_0x54a6('0x31')]=_0x2514d0[_0x54a6('0x31')][_0x54a6('0x33')]?_0x2514d0[_0x54a6('0x31')]:_0x418156[_0x54a6('0x2c')];if(!_0x1a1a40[_0x54a6('0x2d')][_0x54a6('0x34')](_0x54a6('0x35'))){_0x2514d0[_0x54a6('0x36')]=qs['limit'](_0x1a1a40[_0x54a6('0x2d')][_0x54a6('0x36')]);_0x2514d0[_0x54a6('0x1a')]=qs['offset'](_0x1a1a40[_0x54a6('0x2d')][_0x54a6('0x1a')]);}_0x2514d0[_0x54a6('0x37')]=qs[_0x54a6('0x38')](_0x1a1a40[_0x54a6('0x2d')][_0x54a6('0x38')]);_0x2514d0[_0x54a6('0x39')]=qs[_0x54a6('0x2f')](_[_0x54a6('0x3a')](_0x1a1a40['query'],_0x418156['filters']),_0x23a4a5);if(_0x1a1a40['query'][_0x54a6('0x3b')]){_0x2514d0[_0x54a6('0x39')]=_[_0x54a6('0x3c')](_0x2514d0[_0x54a6('0x39')],{'$or':_[_0x54a6('0x27')](_0x23a4a5,function(_0x502be8){if(_0x502be8[_0x54a6('0x2b')]!=='VIRTUAL'){var _0x345061={};_0x345061[_0x502be8['name']]={'$like':'%'+_0x1a1a40[_0x54a6('0x2d')][_0x54a6('0x3b')]+'%'};return _0x345061;}})});}_0x2514d0=_[_0x54a6('0x3c')]({},_0x2514d0,_0x1a1a40[_0x54a6('0x3d')]);var _0x5c6ec9={'where':_0x2514d0[_0x54a6('0x39')]};return db[_0x54a6('0x28')][_0x54a6('0x1c')](_0x5c6ec9)['then'](function(_0x1c1b4d){_0x4295e0[_0x54a6('0x1c')]=_0x1c1b4d;if(_0x1a1a40[_0x54a6('0x2d')]['includeAll']){_0x2514d0[_0x54a6('0x3e')]=[{'all':!![]}];}return db[_0x54a6('0x28')][_0x54a6('0x3f')](_0x2514d0);})[_0x54a6('0x21')](function(_0x3f2190){_0x4295e0['rows']=_0x3f2190;return _0x4295e0;})[_0x54a6('0x21')](respondWithFilteredResult(_0x55b672,_0x2514d0))['catch'](handleError(_0x55b672,null));};exports[_0x54a6('0x40')]=function(_0x581e1f,_0x44e726){var _0x1a279b={'raw':!![],'where':{'id':_0x581e1f[_0x54a6('0x41')]['id']}},_0xf44a3d={};_0xf44a3d['model']=_['keys'](db[_0x54a6('0x28')][_0x54a6('0x29')]);_0xf44a3d[_0x54a6('0x2d')]=_[_0x54a6('0x2e')](_0x581e1f['query']);_0xf44a3d[_0x54a6('0x2f')]=_['intersection'](_0xf44a3d[_0x54a6('0x2c')],_0xf44a3d[_0x54a6('0x2d')]);_0x1a279b[_0x54a6('0x31')]=_['intersection'](_0xf44a3d['model'],qs[_0x54a6('0x32')](_0x581e1f[_0x54a6('0x2d')]['fields']));_0x1a279b[_0x54a6('0x31')]=_0x1a279b[_0x54a6('0x31')][_0x54a6('0x33')]?_0x1a279b[_0x54a6('0x31')]:_0xf44a3d[_0x54a6('0x2c')];if(_0x581e1f[_0x54a6('0x2d')]['includeAll']){_0x1a279b[_0x54a6('0x3e')]=[{'all':!![]}];}_0x1a279b=_[_0x54a6('0x3c')]({},_0x1a279b,_0x581e1f[_0x54a6('0x3d')]);return db['OpenchannelApplication'][_0x54a6('0x42')](_0x1a279b)[_0x54a6('0x21')](handleEntityNotFound(_0x44e726,null))[_0x54a6('0x21')](respondWithResult(_0x44e726,null))[_0x54a6('0x43')](handleError(_0x44e726,null));};exports[_0x54a6('0x44')]=function(_0x924677,_0x3b34dc){return db[_0x54a6('0x28')]['create'](_0x924677[_0x54a6('0x45')],{})[_0x54a6('0x21')](respondWithResult(_0x3b34dc,0xc9))['catch'](handleError(_0x3b34dc,null));};exports['update']=function(_0x166081,_0x517220){if(_0x166081[_0x54a6('0x45')]['id']){delete _0x166081['body']['id'];}return db[_0x54a6('0x28')][_0x54a6('0x42')]({'where':{'id':_0x166081[_0x54a6('0x41')]['id']}})[_0x54a6('0x21')](handleEntityNotFound(_0x517220,null))[_0x54a6('0x21')](saveUpdates(_0x166081[_0x54a6('0x45')],null))[_0x54a6('0x21')](respondWithResult(_0x517220,null))[_0x54a6('0x43')](handleError(_0x517220,null));};exports[_0x54a6('0x22')]=function(_0x41fbfb,_0x1f206b){return db[_0x54a6('0x28')]['find']({'where':{'id':_0x41fbfb[_0x54a6('0x41')]['id']}})[_0x54a6('0x21')](handleEntityNotFound(_0x1f206b,null))['then'](removeEntity(_0x1f206b,null))[_0x54a6('0x43')](handleError(_0x1f206b,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index ad030ae..65079f4 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 _0x85f3=['OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define'];(function(_0x47899b,_0x3a9171){var _0x3cf890=function(_0x1a4574){while(--_0x1a4574){_0x47899b['push'](_0x47899b['shift']());}};_0x3cf890(++_0x3a9171);}(_0x85f3,0x13c));var _0x385f=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0x85f3[_0x234ae1];return _0x227ba0;};'use strict';var _=require('lodash');var util=require(_0x385f('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x385f('0x1'));var rp=require(_0x385f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x385f('0x3'));var config=require(_0x385f('0x4'));var attributes=require(_0x385f('0x5'));module[_0x385f('0x6')]=function(_0x4b315c,_0x57277d){return _0x4b315c[_0x385f('0x7')](_0x385f('0x8'),attributes,{'tableName':_0x385f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x385f('0xa'),'collate':_0x385f('0xb')});}; \ No newline at end of file +var _0x63d5=['utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x63d5,0xf8));var _0x563d=function(_0x3adde2,_0x3062c3){_0x3adde2=_0x3adde2-0x0;var _0xd3726d=_0x63d5[_0x3adde2];return _0xd3726d;};'use strict';var _=require(_0x563d('0x0'));var util=require('util');var logger=require(_0x563d('0x1'))(_0x563d('0x2'));var moment=require('moment');var BPromise=require(_0x563d('0x3'));var rp=require(_0x563d('0x4'));var fs=require('fs');var path=require(_0x563d('0x5'));var rimraf=require(_0x563d('0x6'));var config=require(_0x563d('0x7'));var attributes=require(_0x563d('0x8'));module[_0x563d('0x9')]=function(_0x4349e,_0x5a2a91){return _0x4349e[_0x563d('0xa')](_0x563d('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x563d('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 0f36054..1666cd4 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 _0x385d=['code','error','message','UpdateOpenchannelApplication','OpenchannelApplication','options','raw','where','attributes','limit','then','stringify','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s'];(function(_0x256b2a,_0x5bbb98){var _0x25e7e2=function(_0x10c1c9){while(--_0x10c1c9){_0x256b2a['push'](_0x256b2a['shift']());}};_0x25e7e2(++_0x5bbb98);}(_0x385d,0x1a3));var _0xd385=function(_0x3b624d,_0x36391f){_0x3b624d=_0x3b624d-0x0;var _0x53cf35=_0x385d[_0x3b624d];return _0x53cf35;};'use strict';var _=require(_0xd385('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd385('0x1'));var rs=require(_0xd385('0x2'));var fs=require('fs');var Redis=require(_0xd385('0x3'));var db=require(_0xd385('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd385('0x5'))(_0xd385('0x6'));var config=require(_0xd385('0x7'));var jayson=require(_0xd385('0x8'));var client=jayson[_0xd385('0x9')][_0xd385('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbd5f3e,_0x10a052,_0x306612){return new BPromise(function(_0x2423b6,_0x1ddf4f){return client['request'](_0xbd5f3e,_0x306612)['then'](function(_0x28d3b0){logger[_0xd385('0xb')](_0xd385('0xc'),_0x10a052,_0xd385('0xd'));logger[_0xd385('0xe')](_0xd385('0xf'),_0x10a052,_0xd385('0xd'),JSON['stringify'](_0x28d3b0));if(_0x28d3b0['error']){if(_0x28d3b0['error'][_0xd385('0x10')]===0x1f4){logger[_0xd385('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x10a052,_0x28d3b0[_0xd385('0x11')][_0xd385('0x12')]);return _0x1ddf4f(_0x28d3b0['error'][_0xd385('0x12')]);}logger[_0xd385('0x11')](_0xd385('0xc'),_0x10a052,_0x28d3b0[_0xd385('0x11')][_0xd385('0x12')]);return _0x2423b6(_0x28d3b0['error'][_0xd385('0x12')]);}else{logger['info'](_0xd385('0xc'),_0x10a052,_0xd385('0xd'));_0x2423b6(_0x28d3b0['result'][_0xd385('0x12')]);}})['catch'](function(_0x589a09){logger[_0xd385('0x11')](_0xd385('0xc'),_0x10a052,_0x589a09);_0x1ddf4f(_0x589a09);});});}exports[_0xd385('0x13')]=function(_0x278f78){var _0x4059d2=this;return new Promise(function(_0x5d4f1f,_0x4c960e){return db[_0xd385('0x14')]['update'](_0x278f78['body'],{'raw':_0x278f78[_0xd385('0x15')]?_0x278f78['options'][_0xd385('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x278f78[_0xd385('0x15')]?_0x278f78['options'][_0xd385('0x17')]||null:null,'attributes':_0x278f78[_0xd385('0x15')]?_0x278f78['options'][_0xd385('0x18')]||null:null,'limit':_0x278f78['options']?_0x278f78[_0xd385('0x15')][_0xd385('0x19')]||null:null})[_0xd385('0x1a')](function(_0x308b4e){logger[_0xd385('0xb')](_0xd385('0x13'),_0x278f78);logger[_0xd385('0xe')]('UpdateOpenchannelApplication',_0x278f78,JSON[_0xd385('0x1b')](_0x308b4e));_0x5d4f1f(_0x308b4e);})[_0xd385('0x1c')](function(_0x5c4bee){logger['error'](_0xd385('0x13'),_0x5c4bee['message'],_0x278f78);_0x4c960e(_0x4059d2[_0xd385('0x11')](0x1f4,_0x5c4bee[_0xd385('0x12')]));});});}; \ No newline at end of file +var _0xc70e=['request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','debug','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x2b00d7,_0x1e64c2){var _0x338743=function(_0x32df18){while(--_0x32df18){_0x2b00d7['push'](_0x2b00d7['shift']());}};_0x338743(++_0x1e64c2);}(_0xc70e,0xdc));var _0xec70=function(_0x2a417f,_0x45b6cf){_0x2a417f=_0x2a417f-0x0;var _0xf1a226=_0xc70e[_0x2a417f];return _0xf1a226;};'use strict';var _=require(_0xec70('0x0'));var util=require(_0xec70('0x1'));var moment=require('moment');var BPromise=require(_0xec70('0x2'));var rs=require(_0xec70('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec70('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xec70('0x5'));var config=require(_0xec70('0x6'));var jayson=require(_0xec70('0x7'));var client=jayson[_0xec70('0x8')][_0xec70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28e9aa,_0x1b05bf,_0x11ad5c){return new BPromise(function(_0x3a2d4a,_0xe3eee9){return client['request'](_0x28e9aa,_0x11ad5c)[_0xec70('0xa')](function(_0x109853){logger[_0xec70('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x1b05bf,_0xec70('0xc'));logger['debug'](_0xec70('0xd'),_0x1b05bf,_0xec70('0xc'),JSON[_0xec70('0xe')](_0x109853));if(_0x109853[_0xec70('0xf')]){if(_0x109853['error']['code']===0x1f4){logger[_0xec70('0xf')](_0xec70('0x10'),_0x1b05bf,_0x109853[_0xec70('0xf')][_0xec70('0x11')]);return _0xe3eee9(_0x109853[_0xec70('0xf')]['message']);}logger[_0xec70('0xf')](_0xec70('0x10'),_0x1b05bf,_0x109853[_0xec70('0xf')][_0xec70('0x11')]);return _0x3a2d4a(_0x109853['error'][_0xec70('0x11')]);}else{logger[_0xec70('0xb')](_0xec70('0x10'),_0x1b05bf,'request\x20sent');_0x3a2d4a(_0x109853[_0xec70('0x12')][_0xec70('0x11')]);}})[_0xec70('0x13')](function(_0x2d33d3){logger[_0xec70('0xf')](_0xec70('0x10'),_0x1b05bf,_0x2d33d3);_0xe3eee9(_0x2d33d3);});});}exports[_0xec70('0x14')]=function(_0x366f2d){var _0x20387b=this;return new Promise(function(_0x5b9c60,_0x1aecbb){return db[_0xec70('0x15')][_0xec70('0x16')](_0x366f2d[_0xec70('0x17')],{'raw':_0x366f2d[_0xec70('0x18')]?_0x366f2d['options'][_0xec70('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x366f2d[_0xec70('0x18')]?_0x366f2d[_0xec70('0x18')][_0xec70('0x1a')]||null:null,'attributes':_0x366f2d[_0xec70('0x18')]?_0x366f2d[_0xec70('0x18')][_0xec70('0x1b')]||null:null,'limit':_0x366f2d['options']?_0x366f2d[_0xec70('0x18')]['limit']||null:null})[_0xec70('0xa')](function(_0x3331df){logger[_0xec70('0xb')]('UpdateOpenchannelApplication',_0x366f2d);logger[_0xec70('0x1c')](_0xec70('0x14'),_0x366f2d,JSON[_0xec70('0xe')](_0x3331df));_0x5b9c60(_0x3331df);})[_0xec70('0x13')](function(_0x410354){logger[_0xec70('0xf')]('UpdateOpenchannelApplication',_0x410354['message'],_0x366f2d);_0x1aecbb(_0x20387b['error'](0x1f4,_0x410354['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index ec35ddb..77039d5 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 _0xd82e=['fs-extra','../../components/auth/service','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x15eaaf,_0x1cce42){var _0x28eaf9=function(_0x19d1d4){while(--_0x19d1d4){_0x15eaaf['push'](_0x15eaaf['shift']());}};_0x28eaf9(++_0x1cce42);}(_0xd82e,0x126));var _0xed82=function(_0x58d762,_0x23f1ab){_0x58d762=_0x58d762-0x0;var _0x4b8c67=_0xd82e[_0x58d762];return _0x4b8c67;};'use strict';var multer=require(_0xed82('0x0'));var util=require(_0xed82('0x1'));var path=require(_0xed82('0x2'));var timeout=require(_0xed82('0x3'));var express=require(_0xed82('0x4'));var router=express[_0xed82('0x5')]();var fs_extra=require(_0xed82('0x6'));var auth=require(_0xed82('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xed82('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xed82('0x9')](_0xed82('0xa'),auth[_0xed82('0xb')](),controller[_0xed82('0xc')]);router['get'](_0xed82('0xd'),auth['isAuthenticated'](),controller[_0xed82('0xe')]);router['get']('/:id/messages',auth[_0xed82('0xb')](),controller[_0xed82('0xf')]);router[_0xed82('0x9')](_0xed82('0x10'),auth[_0xed82('0xb')](),controller['download']);router[_0xed82('0x11')]('/',auth[_0xed82('0xb')](),controller['create']);router['post'](_0xed82('0x12'),auth[_0xed82('0xb')](),controller[_0xed82('0x13')]);router[_0xed82('0x11')](_0xed82('0x14'),auth['isAuthenticated'](),interaction[_0xed82('0x15')](_0xed82('0x16'),_0xed82('0x17')),controller[_0xed82('0x18')]);router[_0xed82('0x19')](_0xed82('0xd'),auth['isAuthenticated'](),interaction[_0xed82('0x15')]('openchannel','openchannelinteraction:update'),controller[_0xed82('0x1a')]);router[_0xed82('0x1b')](_0xed82('0xd'),auth[_0xed82('0xb')](),interaction['tracked'](_0xed82('0x16'),'openchannelinteraction:destroy'),controller[_0xed82('0x1c')]);router[_0xed82('0x1b')](_0xed82('0x14'),auth[_0xed82('0xb')](),controller['removeTags']);module[_0xed82('0x1d')]=router; \ No newline at end of file +var _0x65be=['openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannel','destroy','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x65be,0xbd));var _0xe65b=function(_0x496da8,_0xa1f334){_0x496da8=_0x496da8-0x0;var _0x476b35=_0x65be[_0x496da8];return _0x476b35;};'use strict';var multer=require('multer');var util=require(_0xe65b('0x0'));var path=require('path');var timeout=require(_0xe65b('0x1'));var express=require(_0xe65b('0x2'));var router=express[_0xe65b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe65b('0x4'));var interaction=require(_0xe65b('0x5'));var config=require(_0xe65b('0x6'));var controller=require(_0xe65b('0x7'));router[_0xe65b('0x8')]('/',auth[_0xe65b('0x9')](),controller['index']);router[_0xe65b('0x8')]('/describe',auth[_0xe65b('0x9')](),controller[_0xe65b('0xa')]);router['get'](_0xe65b('0xb'),auth[_0xe65b('0x9')](),controller[_0xe65b('0xc')]);router[_0xe65b('0x8')](_0xe65b('0xd'),auth[_0xe65b('0x9')](),controller[_0xe65b('0xe')]);router[_0xe65b('0x8')]('/:id/download',auth[_0xe65b('0x9')](),controller[_0xe65b('0xf')]);router[_0xe65b('0x10')]('/',auth[_0xe65b('0x9')](),controller[_0xe65b('0x11')]);router[_0xe65b('0x10')]('/:id/messages',auth[_0xe65b('0x9')](),controller[_0xe65b('0x12')]);router[_0xe65b('0x10')](_0xe65b('0x13'),auth[_0xe65b('0x9')](),interaction[_0xe65b('0x14')]('openchannel',_0xe65b('0x15')),controller[_0xe65b('0x16')]);router[_0xe65b('0x17')](_0xe65b('0xb'),auth[_0xe65b('0x9')](),interaction[_0xe65b('0x14')]('openchannel',_0xe65b('0x18')),controller[_0xe65b('0x19')]);router['delete'](_0xe65b('0xb'),auth[_0xe65b('0x9')](),interaction[_0xe65b('0x14')](_0xe65b('0x1a'),'openchannelinteraction:destroy'),controller[_0xe65b('0x1b')]);router[_0xe65b('0x1c')](_0xe65b('0x13'),auth[_0xe65b('0x9')](),controller['removeTags']);module[_0xe65b('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 10393d8..4b0adab 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 _0xd547=['DATE','STRING','ENUM','out','INTEGER','BOOLEAN'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0xd547,0x1c1));var _0x7d54=function(_0x5efe28,_0x410eb8){_0x5efe28=_0x5efe28-0x0;var _0x260c7a=_0xd547[_0x5efe28];return _0x260c7a;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x7d54('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7d54('0x1')]},'disposition':{'type':Sequelize[_0x7d54('0x2')]},'secondDisposition':{'type':Sequelize[_0x7d54('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7d54('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x7d54('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x7d54('0x3')]('in',_0x7d54('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7d54('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7d54('0x5')]}}; \ No newline at end of file +var _0x9651=['INTEGER','exports','DATE','STRING','out','ENUM','BOOLEAN'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9651,0x166));var _0x1965=function(_0x598109,_0x2232c7){_0x598109=_0x598109-0x0;var _0x498f43=_0x9651[_0x598109];return _0x498f43;};'use strict';var Sequelize=require('sequelize');module[_0x1965('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1965('0x1')]},'disposition':{'type':Sequelize[_0x1965('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1965('0x2')]},'note':{'type':Sequelize[_0x1965('0x2')]},'read1stAt':{'type':Sequelize[_0x1965('0x1')]},'threadId':{'type':Sequelize[_0x1965('0x2')]},'externalUrl':{'type':Sequelize[_0x1965('0x2')]},'lastMsgAt':{'type':Sequelize[_0x1965('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1965('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x1965('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x1965('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1965('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index daa28b5..033a667 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 _0x5881=['describe','addMessage','OpenchannelMessage','ids','omit','getMessages','length','sort','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','where','options','includeAll','include','rows','addTags','setTags','Tag','color','emit','openchannelInteractionTags:save','removeTags','toString','join','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','pipe','out','value','renderFile','views','downloadInteraction.ejs','transcript-','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','error','name','index','map','rawAttributes','fieldName','findAll','user','catch','show','query','type','from','params','model','keys','OpenchannelInteraction','filters','intersection','fields','attributes','merge','create','body','find'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0x5881,0xc1));var _0x1588=function(_0x2a5c0b,_0x41065d){_0x2a5c0b=_0x2a5c0b-0x0;var _0x3261a8=_0x5881[_0x2a5c0b];return _0x3261a8;};'use strict';var rimraf=require(_0x1588('0x0'));var zipdir=require(_0x1588('0x1'));var moment=require('moment');var util=require('util');var path=require(_0x1588('0x2'));var ejs=require(_0x1588('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x1588('0x4'));var interaction=require(_0x1588('0x5'));var qs=require(_0x1588('0x6'));var pdf=require(_0x1588('0x7'));var logger=require(_0x1588('0x8'))(_0x1588('0x9'));var config=require(_0x1588('0xa'));var db=require(_0x1588('0xb'))['db'];config[_0x1588('0xc')]=_['defaults'](config[_0x1588('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1588('0xc')]));require('./openchannelInteraction.socket')[_0x1588('0xd')](socket);function respondWithStatusCode(_0x565ff9,_0x200577){_0x200577=_0x200577||0xcc;return function(_0x54966e){if(_0x54966e){return _0x565ff9[_0x1588('0xe')](_0x200577);}return _0x565ff9[_0x1588('0xf')](_0x200577)[_0x1588('0x10')]();};}function respondWithResult(_0x4b254b,_0x1be971){_0x1be971=_0x1be971||0xc8;return function(_0x5b14e7){if(_0x5b14e7){return _0x4b254b[_0x1588('0xf')](_0x1be971)[_0x1588('0x11')](_0x5b14e7);}};}function respondWithFilteredResult(_0x523113,_0x21720f){return function(_0x3bc7b5){if(_0x3bc7b5){var _0x9fc473=typeof _0x21720f[_0x1588('0x12')]===_0x1588('0x13')&&typeof _0x21720f[_0x1588('0x14')]===_0x1588('0x13');var _0x427807=_0x3bc7b5['count'];var _0x4f545c=_0x9fc473?0x0:_0x21720f['offset'];var _0x4f4fe2=_0x9fc473?_0x3bc7b5[_0x1588('0x15')]:_0x21720f[_0x1588('0x12')]+_0x21720f[_0x1588('0x14')];var _0x2f3e71;if(_0x4f4fe2>=_0x427807){_0x4f4fe2=_0x427807;_0x2f3e71=0xc8;}else{_0x2f3e71=0xce;}_0x523113[_0x1588('0xf')](_0x2f3e71);return _0x523113[_0x1588('0x16')]('Content-Range',_0x4f545c+'-'+_0x4f4fe2+'/'+_0x427807)[_0x1588('0x11')](_0x3bc7b5);}return null;};}function saveUpdates(_0x223619){return function(_0x49194c){if(_0x49194c){return _0x49194c[_0x1588('0x17')](_0x223619)[_0x1588('0x18')](function(_0x1b400e){return _0x1b400e;});}return null;};}function removeEntity(_0x1a38f3){return function(_0xe4aab2){if(_0xe4aab2){return _0xe4aab2[_0x1588('0x19')]()[_0x1588('0x18')](function(){_0x1a38f3['status'](0xcc)[_0x1588('0x10')]();});}};}function handleEntityNotFound(_0x1503b9){return function(_0x44c213){if(!_0x44c213){_0x1503b9['sendStatus'](0x194);}return _0x44c213;};}function handleError(_0x3f1566,_0x700077){_0x700077=_0x700077||0x1f4;return function(_0x34fa97){logger[_0x1588('0x1a')](_0x34fa97['stack']);if(_0x34fa97['name']){delete _0x34fa97[_0x1588('0x1b')];}_0x3f1566[_0x1588('0xf')](_0x700077)['send'](_0x34fa97);};}exports[_0x1588('0x1c')]=function(_0x1f5021,_0x97da9e){var _0x26fb7c={};var _0x152bd2=_[_0x1588('0x1d')](db['OpenchannelInteraction'][_0x1588('0x1e')],function(_0x5df0e7){return{'name':_0x5df0e7[_0x1588('0x1f')],'type':_0x5df0e7['type']['key']};});_0x26fb7c=qs['getOptions'](_0x152bd2,_0x1f5021);return interaction[_0x1588('0x20')]('openchannel',_0x1f5021['query'],_0x1f5021[_0x1588('0x21')],_0x26fb7c,_0x152bd2)[_0x1588('0x18')](respondWithFilteredResult(_0x97da9e,_0x26fb7c))[_0x1588('0x22')](handleError(_0x97da9e,null));};exports[_0x1588('0x23')]=function(_0x2767ff,_0x3865f0){var _0x233809={};if(_0x2767ff[_0x1588('0x24')][_0x1588('0x25')]&&_0x2767ff[_0x1588('0x24')][_0x1588('0x25')]==='from'){_0x233809[_0x1588('0x26')]=_0x2767ff[_0x1588('0x27')]['id'];}else{_0x233809['id']=_0x2767ff[_0x1588('0x27')]['id'];}var _0x566781={'raw':![],'where':_0x233809},_0xbffa62={};_0xbffa62[_0x1588('0x28')]=_[_0x1588('0x29')](db[_0x1588('0x2a')][_0x1588('0x1e')]);_0xbffa62['query']=_[_0x1588('0x29')](_0x2767ff[_0x1588('0x24')]);_0xbffa62[_0x1588('0x2b')]=_['intersection'](_0xbffa62['model'],_0xbffa62[_0x1588('0x24')]);_0x566781['attributes']=_[_0x1588('0x2c')](_0xbffa62['model'],qs[_0x1588('0x2d')](_0x2767ff['query']['fields']));_0x566781[_0x1588('0x2e')]=_0x566781[_0x1588('0x2e')]['length']?_0x566781['attributes']:_0xbffa62[_0x1588('0x28')];if(_0x2767ff[_0x1588('0x24')]['includeAll']){_0x566781['include']=[{'all':!![]}];}_0x566781=_[_0x1588('0x2f')]({},_0x566781,_0x2767ff['options']);return db[_0x1588('0x2a')]['find'](_0x566781)['then'](handleEntityNotFound(_0x3865f0,null))[_0x1588('0x18')](respondWithResult(_0x3865f0,null))['catch'](handleError(_0x3865f0,null));};exports[_0x1588('0x30')]=function(_0x3cc07c,_0xfcdfbf){return db[_0x1588('0x2a')][_0x1588('0x30')](_0x3cc07c[_0x1588('0x31')],{})[_0x1588('0x18')](respondWithResult(_0xfcdfbf,0xc9))[_0x1588('0x22')](handleError(_0xfcdfbf,null));};exports['update']=function(_0x6f1377,_0x3ba3d4){if(_0x6f1377[_0x1588('0x31')]['id']){delete _0x6f1377[_0x1588('0x31')]['id'];}return db['OpenchannelInteraction'][_0x1588('0x32')]({'where':{'id':_0x6f1377['params']['id']}})[_0x1588('0x18')](handleEntityNotFound(_0x3ba3d4,null))[_0x1588('0x18')](saveUpdates(_0x6f1377[_0x1588('0x31')],null))[_0x1588('0x18')](respondWithResult(_0x3ba3d4,null))[_0x1588('0x22')](handleError(_0x3ba3d4,null));};exports[_0x1588('0x19')]=function(_0x5b1636,_0x16c027){return db[_0x1588('0x2a')][_0x1588('0x32')]({'where':{'id':_0x5b1636[_0x1588('0x27')]['id']}})[_0x1588('0x18')](handleEntityNotFound(_0x16c027,null))['then'](removeEntity(_0x16c027,null))['catch'](handleError(_0x16c027,null));};exports[_0x1588('0x33')]=function(_0x1aec5e,_0x296445){return db[_0x1588('0x2a')][_0x1588('0x33')]()[_0x1588('0x18')](respondWithResult(_0x296445,null))['catch'](handleError(_0x296445,null));};exports[_0x1588('0x34')]=function(_0x24e563,_0x293acc){return db[_0x1588('0x35')][_0x1588('0x32')]({'where':{'id':_0x24e563[_0x1588('0x27')]['id']}})[_0x1588('0x18')](handleEntityNotFound(_0x293acc,null))[_0x1588('0x18')](function(_0x515994){if(_0x515994){return _0x515994[_0x1588('0x34')](_0x24e563[_0x1588('0x31')][_0x1588('0x36')],_[_0x1588('0x37')](_0x24e563[_0x1588('0x31')],['ids','id'])||{});}})[_0x1588('0x18')](respondWithResult(_0x293acc,null))['catch'](handleError(_0x293acc,null));};exports[_0x1588('0x38')]=function(_0x15a9ef,_0x2ed451){var _0x28e624={'raw':![],'where':{}};var _0x398994={};var _0x41fb51={'count':0x0,'rows':[]};return db[_0x1588('0x2a')]['findOne']({'where':{'id':_0x15a9ef['params']['id']}})[_0x1588('0x18')](handleEntityNotFound(_0x2ed451,null))[_0x1588('0x18')](function(_0x7fad7c){if(_0x7fad7c){_0x398994[_0x1588('0x28')]=_[_0x1588('0x29')](db[_0x1588('0x35')][_0x1588('0x1e')]);_0x398994[_0x1588('0x24')]=_[_0x1588('0x29')](_0x15a9ef[_0x1588('0x24')]);_0x398994[_0x1588('0x2b')]=_[_0x1588('0x2c')](_0x398994[_0x1588('0x28')],_0x398994['query']);_0x28e624[_0x1588('0x2e')]=_['intersection'](_0x398994['model'],qs[_0x1588('0x2d')](_0x15a9ef[_0x1588('0x24')]['fields']));_0x28e624[_0x1588('0x2e')]=_0x28e624[_0x1588('0x2e')][_0x1588('0x39')]?_0x28e624[_0x1588('0x2e')]:_0x398994['model'];if(!_0x15a9ef[_0x1588('0x24')]['hasOwnProperty']('nolimit')){_0x28e624[_0x1588('0x14')]=qs['limit'](_0x15a9ef[_0x1588('0x24')][_0x1588('0x14')]);_0x28e624[_0x1588('0x12')]=qs[_0x1588('0x12')](_0x15a9ef['query'][_0x1588('0x12')]);}_0x28e624['order']=qs[_0x1588('0x3a')](_0x15a9ef[_0x1588('0x24')]['sort']);_0x28e624['where']=qs[_0x1588('0x2b')](_[_0x1588('0x3b')](_0x15a9ef[_0x1588('0x24')],_0x398994[_0x1588('0x2b')]));_0x28e624['where']['OpenchannelInteractionId']=_0x7fad7c['id'];if(_0x15a9ef[_0x1588('0x24')][_0x1588('0x3c')]){_0x28e624['where']=_[_0x1588('0x2f')](_0x28e624['where'],{'$or':_[_0x1588('0x1d')](_0x28e624[_0x1588('0x2e')],function(_0x27540a){var _0x4d2996={};_0x4d2996[_0x27540a]={'$like':'%'+_0x15a9ef['query'][_0x1588('0x3c')]+'%'};return _0x4d2996;})});}if(_0x15a9ef[_0x1588('0x24')][_0x1588('0x3d')]){var _0x1eab00=_0x15a9ef['query']['$gte'][_0x1588('0x3e')](',');var _0x164465={};_0x164465[_0x1eab00[0x0]]={'$gte':moment(_0x1eab00[0x1])[_0x1588('0x3f')](_0x1588('0x40'))};_0x28e624[_0x1588('0x41')]=_['merge'](_0x28e624[_0x1588('0x41')],_0x164465);}_0x28e624=_[_0x1588('0x2f')]({},_0x28e624,_0x15a9ef[_0x1588('0x42')]);return db[_0x1588('0x35')][_0x1588('0x15')]({'where':_0x28e624[_0x1588('0x41')]})[_0x1588('0x18')](function(_0x5dd320){_0x41fb51[_0x1588('0x15')]=_0x5dd320;if(_0x15a9ef[_0x1588('0x24')][_0x1588('0x43')]){_0x28e624[_0x1588('0x44')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x1588('0x20')](_0x28e624);})[_0x1588('0x18')](function(_0x2f577f){_0x41fb51[_0x1588('0x45')]=_0x2f577f;return _0x41fb51;});}})[_0x1588('0x18')](respondWithFilteredResult(_0x2ed451,_0x28e624))[_0x1588('0x22')](handleError(_0x2ed451,null));};exports[_0x1588('0x46')]=function(_0x4aa0a8,_0x91cc43){return db[_0x1588('0x2a')][_0x1588('0x32')]({'where':{'id':_0x4aa0a8[_0x1588('0x27')]['id']}})['then'](handleEntityNotFound(_0x91cc43,null))[_0x1588('0x18')](function(_0x5733ec){if(_0x5733ec){return _0x5733ec[_0x1588('0x47')](_0x4aa0a8[_0x1588('0x31')]['ids'],_['omit'](_0x4aa0a8[_0x1588('0x31')],[_0x1588('0x36'),'id'])||{})['spread'](function(){return db[_0x1588('0x48')]['findAll']({'attributes':['id',_0x1588('0x1b'),_0x1588('0x49')],'where':{'id':_0x4aa0a8[_0x1588('0x31')][_0x1588('0x36')]}});})[_0x1588('0x18')](function(_0x3f6b8c){socket[_0x1588('0x4a')](_0x1588('0x4b'),{'id':Number(_0x4aa0a8[_0x1588('0x27')]['id']),'tags':_0x3f6b8c||[]});return{'id':Number(_0x4aa0a8[_0x1588('0x27')]['id']),'tags':_0x3f6b8c||[]};});}})[_0x1588('0x18')](respondWithResult(_0x91cc43,null))[_0x1588('0x22')](handleError(_0x91cc43,null));};exports[_0x1588('0x4c')]=function(_0x4cb6ef,_0x88cd53){return db[_0x1588('0x2a')][_0x1588('0x32')]({'where':{'id':_0x4cb6ef[_0x1588('0x27')]['id']}})[_0x1588('0x18')](handleEntityNotFound(_0x88cd53,null))['then'](function(_0x5969d1){if(_0x5969d1){return _0x5969d1['removeTags'](_0x4cb6ef[_0x1588('0x24')]['ids']);}})[_0x1588('0x18')](respondWithStatusCode(_0x88cd53,null))['catch'](handleError(_0x88cd53,null));};exports['download']=function(_0x316c91,_0x1d3eb2){var _0x69575c=moment()['unix']()[_0x1588('0x4d')]();var _0x20c0cd=path[_0x1588('0x4e')](config[_0x1588('0x4f')],_0x1588('0x50'),_0x1588('0x51'),_0x1588('0x52'));var _0x3c0de9=path[_0x1588('0x4e')](config[_0x1588('0x4f')],_0x1588('0x50'),_0x1588('0x51'),'attachments');var _0x378562=path[_0x1588('0x4e')](_0x20c0cd,_0x69575c);var _0xe0f78d=util['format'](_0x1588('0x53'),_0x316c91[_0x1588('0x27')]['id'],_0x69575c);var _0x1bdc74=path[_0x1588('0x4e')](_0x20c0cd,_0xe0f78d);var _0x187dd0=[];_0x187dd0['push']({'model':db[_0x1588('0x54')],'as':_0x1588('0x54'),'attributes':['id',_0x1588('0x55')],'raw':!![]});_0x187dd0[_0x1588('0x56')]({'model':db['CmContact'],'as':_0x1588('0x57'),'attributes':['id',_0x1588('0x58'),_0x1588('0x59')],'raw':!![]});if(_0x316c91[_0x1588('0x24')][_0x1588('0x5a')]){_0x187dd0[_0x1588('0x56')]({'model':db[_0x1588('0x5b')],'as':'Attachment','raw':!![]});}var _0x1557cc=[{'model':db[_0x1588('0x35')],'as':_0x1588('0x5c'),'attributes':['id',_0x1588('0x31'),_0x1588('0x5d'),_0x1588('0x5e'),_0x1588('0x5f'),_0x1588('0x60')],'include':_0x187dd0}];_0x1557cc[_0x1588('0x56')]({'model':db[_0x1588('0x61')],'as':_0x1588('0x62'),'attributes':['id',_0x1588('0x1b')]});_0x1557cc[_0x1588('0x56')]({'model':db[_0x1588('0x54')],'as':_0x1588('0x63'),'attributes':['id','fullname']});return db[_0x1588('0x2a')][_0x1588('0x32')]({'where':{'id':_0x316c91[_0x1588('0x27')]['id']},'include':_0x1557cc})[_0x1588('0x18')](handleEntityNotFound(_0x1d3eb2,null))[_0x1588('0x18')](function(_0x39364e){if(_0x39364e){var _0x33e06a=_0x39364e[_0x1588('0x64')]({'plain':!![]});fs[_0x1588('0x65')](_0x378562);var _0x266f5d={'channel':_0x1588('0x66'),'account':_0x33e06a[_0x1588('0x62')][_0x1588('0x1b')],'agent':_0x33e06a[_0x1588('0x63')]?_0x33e06a[_0x1588('0x63')][_0x1588('0x55')]:_0x1588('0x67'),'createdAt':moment(_0x33e06a[_0x1588('0x5d')])[_0x1588('0x3f')](_0x1588('0x40'))[_0x1588('0x4d')](),'closedAt':_0x33e06a[_0x1588('0x68')]?moment(_0x33e06a[_0x1588('0x69')])[_0x1588('0x3f')](_0x1588('0x40'))['toString']():'','disposition':_0x33e06a[_0x1588('0x6a')],'visibility':_0x33e06a['threadId']?_0x1588('0x6b'):_0x1588('0x6c'),'messages':_(_0x33e06a[_0x1588('0x5c')])[_0x1588('0x3c')]({'secret':![]})[_0x1588('0x1d')](function(_0x4d74ab){if(_0x4d74ab[_0x1588('0x5b')]){var _0xbd1732=path[_0x1588('0x4e')](_0x3c0de9,_0x4d74ab['Attachment'][_0x1588('0x6d')]);if(fs[_0x1588('0x6e')](_0xbd1732)){fs[_0x1588('0x6f')](_0xbd1732)[_0x1588('0x70')](fs['createWriteStream'](path['join'](_0x378562,_0x4d74ab['Attachment']['basename'])));}}return{'date':moment(_0x4d74ab[_0x1588('0x5d')])[_0x1588('0x3f')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4d74ab[_0x1588('0x5e')]==='out'?_0x4d74ab[_0x1588('0x54')]?_0x4d74ab['User'][_0x1588('0x55')]:'System':_0x4d74ab[_0x1588('0x57')]['firstName']+(_0x4d74ab[_0x1588('0x57')][_0x1588('0x59')]?'\x20'+_0x4d74ab['Contact']['lastName']:''),'body':_0x4d74ab['Attachment']?_0x4d74ab['Attachment']['basename']:_0x4d74ab['body'],'direction':_0x4d74ab[_0x1588('0x5e')]===_0x1588('0x71')?'A':'C','secret':_0x4d74ab['secret'],'read':_0x4d74ab['read'],'attachment':_0x4d74ab[_0x1588('0x5b')]};})[_0x1588('0x72')]()};return ejs[_0x1588('0x73')](path[_0x1588('0x4e')](config[_0x1588('0x4f')],_0x1588('0x50'),_0x1588('0x74'),_0x1588('0x75')),{'interaction':_0x266f5d})[_0x1588('0x18')](function(_0x5acc9b){var _0x219f3=path[_0x1588('0x4e')](_0x378562,_0x1588('0x76')+_0x33e06a['id']+'-'+_0x69575c+'.pdf');var _0x521bf4={'path':_0x219f3,'channel':'Openchannel','interactionId':_0x33e06a['id']};return pdf['createPdfFromHTML'](_0x5acc9b,_0x521bf4);})['then'](function(){return new Promise(function(_0x1ff8ce,_0x57dd29){zipdir(_0x378562,{'saveTo':_0x1bdc74},function(_0x2e31ad,_0x3ded43){if(_0x2e31ad)return _0x57dd29(_0x2e31ad);return _0x1ff8ce(_0x3ded43);});})[_0x1588('0x18')](function(){return new Promise(function(_0x8af1d,_0x239c05){rimraf(_0x378562,function(_0x4a9ee1){if(_0x4a9ee1)_0x239c05(_0x4a9ee1);return _0x8af1d();});});})[_0x1588('0x18')](function(){return _0x1d3eb2[_0x1588('0x77')](_0x1bdc74,_0xe0f78d,function(_0x1ccc96){if(_0x1ccc96){logger[_0x1588('0x1a')](_0x1588('0x78'),_0x1ccc96);}else{fs[_0x1588('0x79')](_0x1bdc74);}});});});}else{return _0x1d3eb2['sendStatus'](0xc8);}})[_0x1588('0x22')](handleError(_0x1d3eb2,null));}; \ No newline at end of file +var _0x4357=['Private','existsSync','createReadStream','basename','out','secret','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','getOptions','openchannel','query','user','catch','show','from','params','model','keys','OpenchannelInteraction','filters','attributes','intersection','fields','includeAll','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','length','hasOwnProperty','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x4357,0x94));var _0x7435=function(_0x2fc69b,_0x55537d){_0x2fc69b=_0x2fc69b-0x0;var _0x25e3c9=_0x4357[_0x2fc69b];return _0x25e3c9;};'use strict';var rimraf=require(_0x7435('0x0'));var zipdir=require(_0x7435('0x1'));var moment=require(_0x7435('0x2'));var util=require('util');var path=require(_0x7435('0x3'));var ejs=require(_0x7435('0x4'));var fs=require('fs');var _=require(_0x7435('0x5'));var Redis=require(_0x7435('0x6'));var interaction=require(_0x7435('0x7'));var qs=require(_0x7435('0x8'));var pdf=require(_0x7435('0x9'));var logger=require(_0x7435('0xa'))(_0x7435('0xb'));var config=require(_0x7435('0xc'));var db=require(_0x7435('0xd'))['db'];config[_0x7435('0xe')]=_[_0x7435('0xf')](config[_0x7435('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x7435('0x10'))(new Redis(config[_0x7435('0xe')]));require(_0x7435('0x11'))[_0x7435('0x12')](socket);function respondWithStatusCode(_0x42d4df,_0x1b69fa){_0x1b69fa=_0x1b69fa||0xcc;return function(_0x2e64f8){if(_0x2e64f8){return _0x42d4df[_0x7435('0x13')](_0x1b69fa);}return _0x42d4df[_0x7435('0x14')](_0x1b69fa)[_0x7435('0x15')]();};}function respondWithResult(_0x481534,_0x1835f2){_0x1835f2=_0x1835f2||0xc8;return function(_0x57db29){if(_0x57db29){return _0x481534[_0x7435('0x14')](_0x1835f2)[_0x7435('0x16')](_0x57db29);}};}function respondWithFilteredResult(_0x1fbb64,_0x129aa5){return function(_0x3059ff){if(_0x3059ff){var _0x3aa51e=typeof _0x129aa5[_0x7435('0x17')]===_0x7435('0x18')&&typeof _0x129aa5[_0x7435('0x19')]===_0x7435('0x18');var _0x4b18f9=_0x3059ff[_0x7435('0x1a')];var _0x464e39=_0x3aa51e?0x0:_0x129aa5['offset'];var _0x48fbf9=_0x3aa51e?_0x3059ff[_0x7435('0x1a')]:_0x129aa5[_0x7435('0x17')]+_0x129aa5[_0x7435('0x19')];var _0xdf760;if(_0x48fbf9>=_0x4b18f9){_0x48fbf9=_0x4b18f9;_0xdf760=0xc8;}else{_0xdf760=0xce;}_0x1fbb64['status'](_0xdf760);return _0x1fbb64['set']('Content-Range',_0x464e39+'-'+_0x48fbf9+'/'+_0x4b18f9)[_0x7435('0x16')](_0x3059ff);}return null;};}function saveUpdates(_0x2d7054){return function(_0x1eda6e){if(_0x1eda6e){return _0x1eda6e[_0x7435('0x1b')](_0x2d7054)[_0x7435('0x1c')](function(_0x69d9a6){return _0x69d9a6;});}return null;};}function removeEntity(_0x3808e5){return function(_0x56d7d2){if(_0x56d7d2){return _0x56d7d2[_0x7435('0x1d')]()[_0x7435('0x1c')](function(){_0x3808e5[_0x7435('0x14')](0xcc)[_0x7435('0x15')]();});}};}function handleEntityNotFound(_0x21c337){return function(_0x355fb3){if(!_0x355fb3){_0x21c337[_0x7435('0x13')](0x194);}return _0x355fb3;};}function handleError(_0x3bd599,_0x395b69){_0x395b69=_0x395b69||0x1f4;return function(_0x21869e){logger[_0x7435('0x1e')](_0x21869e[_0x7435('0x1f')]);if(_0x21869e[_0x7435('0x20')]){delete _0x21869e['name'];}_0x3bd599['status'](_0x395b69)[_0x7435('0x21')](_0x21869e);};}exports['index']=function(_0x19b3c4,_0x22131a){var _0x53e818={};var _0x3f4f11=_[_0x7435('0x22')](db['OpenchannelInteraction'][_0x7435('0x23')],function(_0x30208e){return{'name':_0x30208e[_0x7435('0x24')],'type':_0x30208e[_0x7435('0x25')][_0x7435('0x26')]};});_0x53e818=qs[_0x7435('0x27')](_0x3f4f11,_0x19b3c4);return interaction['findAll'](_0x7435('0x28'),_0x19b3c4[_0x7435('0x29')],_0x19b3c4[_0x7435('0x2a')],_0x53e818,_0x3f4f11)[_0x7435('0x1c')](respondWithFilteredResult(_0x22131a,_0x53e818))[_0x7435('0x2b')](handleError(_0x22131a,null));};exports[_0x7435('0x2c')]=function(_0x131b6f,_0x553b61){var _0x3386c4={};if(_0x131b6f[_0x7435('0x29')][_0x7435('0x25')]&&_0x131b6f[_0x7435('0x29')][_0x7435('0x25')]==='from'){_0x3386c4[_0x7435('0x2d')]=_0x131b6f[_0x7435('0x2e')]['id'];}else{_0x3386c4['id']=_0x131b6f['params']['id'];}var _0x203272={'raw':![],'where':_0x3386c4},_0x1cc6fe={};_0x1cc6fe[_0x7435('0x2f')]=_[_0x7435('0x30')](db[_0x7435('0x31')][_0x7435('0x23')]);_0x1cc6fe['query']=_[_0x7435('0x30')](_0x131b6f['query']);_0x1cc6fe[_0x7435('0x32')]=_['intersection'](_0x1cc6fe[_0x7435('0x2f')],_0x1cc6fe[_0x7435('0x29')]);_0x203272[_0x7435('0x33')]=_[_0x7435('0x34')](_0x1cc6fe[_0x7435('0x2f')],qs['fields'](_0x131b6f['query'][_0x7435('0x35')]));_0x203272[_0x7435('0x33')]=_0x203272[_0x7435('0x33')]['length']?_0x203272['attributes']:_0x1cc6fe[_0x7435('0x2f')];if(_0x131b6f[_0x7435('0x29')][_0x7435('0x36')]){_0x203272[_0x7435('0x37')]=[{'all':!![]}];}_0x203272=_[_0x7435('0x38')]({},_0x203272,_0x131b6f[_0x7435('0x39')]);return db[_0x7435('0x31')][_0x7435('0x3a')](_0x203272)[_0x7435('0x1c')](handleEntityNotFound(_0x553b61,null))[_0x7435('0x1c')](respondWithResult(_0x553b61,null))[_0x7435('0x2b')](handleError(_0x553b61,null));};exports[_0x7435('0x3b')]=function(_0x7cc838,_0x48cacd){return db[_0x7435('0x31')][_0x7435('0x3b')](_0x7cc838['body'],{})[_0x7435('0x1c')](respondWithResult(_0x48cacd,0xc9))[_0x7435('0x2b')](handleError(_0x48cacd,null));};exports[_0x7435('0x1b')]=function(_0x2c2b22,_0x46854f){if(_0x2c2b22['body']['id']){delete _0x2c2b22[_0x7435('0x3c')]['id'];}return db[_0x7435('0x31')][_0x7435('0x3a')]({'where':{'id':_0x2c2b22[_0x7435('0x2e')]['id']}})[_0x7435('0x1c')](handleEntityNotFound(_0x46854f,null))[_0x7435('0x1c')](saveUpdates(_0x2c2b22['body'],null))[_0x7435('0x1c')](respondWithResult(_0x46854f,null))[_0x7435('0x2b')](handleError(_0x46854f,null));};exports[_0x7435('0x1d')]=function(_0x9866d1,_0x23de49){return db[_0x7435('0x31')][_0x7435('0x3a')]({'where':{'id':_0x9866d1[_0x7435('0x2e')]['id']}})[_0x7435('0x1c')](handleEntityNotFound(_0x23de49,null))[_0x7435('0x1c')](removeEntity(_0x23de49,null))['catch'](handleError(_0x23de49,null));};exports[_0x7435('0x3d')]=function(_0x46bfb3,_0x3a5b27){return db['OpenchannelInteraction'][_0x7435('0x3d')]()[_0x7435('0x1c')](respondWithResult(_0x3a5b27,null))['catch'](handleError(_0x3a5b27,null));};exports[_0x7435('0x3e')]=function(_0x239f83,_0x4a3143){return db[_0x7435('0x3f')][_0x7435('0x3a')]({'where':{'id':_0x239f83[_0x7435('0x2e')]['id']}})[_0x7435('0x1c')](handleEntityNotFound(_0x4a3143,null))[_0x7435('0x1c')](function(_0x391fad){if(_0x391fad){return _0x391fad[_0x7435('0x3e')](_0x239f83['body'][_0x7435('0x40')],_[_0x7435('0x41')](_0x239f83[_0x7435('0x3c')],[_0x7435('0x40'),'id'])||{});}})[_0x7435('0x1c')](respondWithResult(_0x4a3143,null))[_0x7435('0x2b')](handleError(_0x4a3143,null));};exports[_0x7435('0x42')]=function(_0x3f8473,_0x564771){var _0x164734={'raw':![],'where':{}};var _0x1d2d64={};var _0x3f6707={'count':0x0,'rows':[]};return db[_0x7435('0x31')]['findOne']({'where':{'id':_0x3f8473[_0x7435('0x2e')]['id']}})[_0x7435('0x1c')](handleEntityNotFound(_0x564771,null))['then'](function(_0x37c70b){if(_0x37c70b){_0x1d2d64[_0x7435('0x2f')]=_[_0x7435('0x30')](db[_0x7435('0x3f')]['rawAttributes']);_0x1d2d64[_0x7435('0x29')]=_[_0x7435('0x30')](_0x3f8473[_0x7435('0x29')]);_0x1d2d64[_0x7435('0x32')]=_['intersection'](_0x1d2d64[_0x7435('0x2f')],_0x1d2d64['query']);_0x164734[_0x7435('0x33')]=_[_0x7435('0x34')](_0x1d2d64['model'],qs[_0x7435('0x35')](_0x3f8473[_0x7435('0x29')][_0x7435('0x35')]));_0x164734[_0x7435('0x33')]=_0x164734[_0x7435('0x33')][_0x7435('0x43')]?_0x164734[_0x7435('0x33')]:_0x1d2d64[_0x7435('0x2f')];if(!_0x3f8473['query'][_0x7435('0x44')]('nolimit')){_0x164734['limit']=qs[_0x7435('0x19')](_0x3f8473[_0x7435('0x29')][_0x7435('0x19')]);_0x164734[_0x7435('0x17')]=qs[_0x7435('0x17')](_0x3f8473[_0x7435('0x29')][_0x7435('0x17')]);}_0x164734[_0x7435('0x45')]=qs[_0x7435('0x46')](_0x3f8473[_0x7435('0x29')][_0x7435('0x46')]);_0x164734[_0x7435('0x47')]=qs['filters'](_[_0x7435('0x48')](_0x3f8473[_0x7435('0x29')],_0x1d2d64[_0x7435('0x32')]));_0x164734[_0x7435('0x47')][_0x7435('0x49')]=_0x37c70b['id'];if(_0x3f8473['query'][_0x7435('0x4a')]){_0x164734[_0x7435('0x47')]=_[_0x7435('0x38')](_0x164734[_0x7435('0x47')],{'$or':_['map'](_0x164734[_0x7435('0x33')],function(_0xf81bd1){var _0x98d3dc={};_0x98d3dc[_0xf81bd1]={'$like':'%'+_0x3f8473[_0x7435('0x29')]['filter']+'%'};return _0x98d3dc;})});}if(_0x3f8473[_0x7435('0x29')][_0x7435('0x4b')]){var _0x1d8a3a=_0x3f8473[_0x7435('0x29')]['$gte'][_0x7435('0x4c')](',');var _0x46e297={};_0x46e297[_0x1d8a3a[0x0]]={'$gte':moment(_0x1d8a3a[0x1])[_0x7435('0x4d')](_0x7435('0x4e'))};_0x164734[_0x7435('0x47')]=_[_0x7435('0x38')](_0x164734[_0x7435('0x47')],_0x46e297);}_0x164734=_['merge']({},_0x164734,_0x3f8473[_0x7435('0x39')]);return db['OpenchannelMessage']['count']({'where':_0x164734[_0x7435('0x47')]})[_0x7435('0x1c')](function(_0x86bb1e){_0x3f6707[_0x7435('0x1a')]=_0x86bb1e;if(_0x3f8473['query'][_0x7435('0x36')]){_0x164734['include']=[{'all':!![]}];}return db[_0x7435('0x3f')][_0x7435('0x4f')](_0x164734);})[_0x7435('0x1c')](function(_0x22cee3){_0x3f6707[_0x7435('0x50')]=_0x22cee3;return _0x3f6707;});}})[_0x7435('0x1c')](respondWithFilteredResult(_0x564771,_0x164734))[_0x7435('0x2b')](handleError(_0x564771,null));};exports[_0x7435('0x51')]=function(_0x4c7239,_0x16b8db){return db[_0x7435('0x31')]['find']({'where':{'id':_0x4c7239[_0x7435('0x2e')]['id']}})['then'](handleEntityNotFound(_0x16b8db,null))['then'](function(_0x22d7a5){if(_0x22d7a5){return _0x22d7a5[_0x7435('0x52')](_0x4c7239[_0x7435('0x3c')][_0x7435('0x40')],_[_0x7435('0x41')](_0x4c7239[_0x7435('0x3c')],['ids','id'])||{})[_0x7435('0x53')](function(){return db['Tag'][_0x7435('0x4f')]({'attributes':['id',_0x7435('0x20'),_0x7435('0x54')],'where':{'id':_0x4c7239['body'][_0x7435('0x40')]}});})[_0x7435('0x1c')](function(_0x38fa9a){socket[_0x7435('0x55')](_0x7435('0x56'),{'id':Number(_0x4c7239[_0x7435('0x2e')]['id']),'tags':_0x38fa9a||[]});return{'id':Number(_0x4c7239[_0x7435('0x2e')]['id']),'tags':_0x38fa9a||[]};});}})[_0x7435('0x1c')](respondWithResult(_0x16b8db,null))[_0x7435('0x2b')](handleError(_0x16b8db,null));};exports[_0x7435('0x57')]=function(_0x3665ee,_0x22362f){return db[_0x7435('0x31')][_0x7435('0x3a')]({'where':{'id':_0x3665ee['params']['id']}})['then'](handleEntityNotFound(_0x22362f,null))['then'](function(_0x3230bf){if(_0x3230bf){return _0x3230bf[_0x7435('0x57')](_0x3665ee['query'][_0x7435('0x40')]);}})[_0x7435('0x1c')](respondWithStatusCode(_0x22362f,null))['catch'](handleError(_0x22362f,null));};exports[_0x7435('0x58')]=function(_0x551e61,_0x3d953e){var _0x189f45=moment()[_0x7435('0x59')]()[_0x7435('0x5a')]();var _0x1e2147=path['join'](config[_0x7435('0x5b')],_0x7435('0x5c'),_0x7435('0x5d'),_0x7435('0x5e'));var _0x5a5375=path[_0x7435('0x5f')](config[_0x7435('0x5b')],_0x7435('0x5c'),_0x7435('0x5d'),_0x7435('0x60'));var _0x462fa2=path[_0x7435('0x5f')](_0x1e2147,_0x189f45);var _0x234571=util[_0x7435('0x4d')](_0x7435('0x61'),_0x551e61['params']['id'],_0x189f45);var _0x117ab1=path[_0x7435('0x5f')](_0x1e2147,_0x234571);var _0xddd4be=[];_0xddd4be[_0x7435('0x62')]({'model':db[_0x7435('0x63')],'as':_0x7435('0x63'),'attributes':['id',_0x7435('0x64')],'raw':!![]});_0xddd4be[_0x7435('0x62')]({'model':db[_0x7435('0x65')],'as':_0x7435('0x66'),'attributes':['id',_0x7435('0x67'),_0x7435('0x68')],'raw':!![]});if(_0x551e61[_0x7435('0x29')][_0x7435('0x60')]){_0xddd4be[_0x7435('0x62')]({'model':db['Attachment'],'as':_0x7435('0x69'),'raw':!![]});}var _0x113245=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0x7435('0x3c'),_0x7435('0x6a'),_0x7435('0x6b'),'secret',_0x7435('0x6c')],'include':_0xddd4be}];_0x113245['push']({'model':db[_0x7435('0x6d')],'as':_0x7435('0x6e'),'attributes':['id',_0x7435('0x20')]});_0x113245['push']({'model':db[_0x7435('0x63')],'as':_0x7435('0x6f'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x7435('0x3a')]({'where':{'id':_0x551e61[_0x7435('0x2e')]['id']},'include':_0x113245})[_0x7435('0x1c')](handleEntityNotFound(_0x3d953e,null))[_0x7435('0x1c')](function(_0x19492e){if(_0x19492e){var _0x32aec4=_0x19492e[_0x7435('0x70')]({'plain':!![]});fs[_0x7435('0x71')](_0x462fa2);var _0x3a0418={'channel':_0x7435('0x72'),'account':_0x32aec4[_0x7435('0x6e')]['name'],'agent':_0x32aec4[_0x7435('0x6f')]?_0x32aec4[_0x7435('0x6f')][_0x7435('0x64')]:_0x7435('0x73'),'createdAt':moment(_0x32aec4[_0x7435('0x6a')])[_0x7435('0x4d')](_0x7435('0x4e'))[_0x7435('0x5a')](),'closedAt':_0x32aec4['closed']?moment(_0x32aec4[_0x7435('0x74')])[_0x7435('0x4d')](_0x7435('0x4e'))[_0x7435('0x5a')]():'','disposition':_0x32aec4[_0x7435('0x75')],'visibility':_0x32aec4[_0x7435('0x76')]?_0x7435('0x77'):_0x7435('0x78'),'messages':_(_0x32aec4['Messages'])['filter']({'secret':![]})['map'](function(_0x3e4dd3){if(_0x3e4dd3[_0x7435('0x69')]){var _0x10db4d=path[_0x7435('0x5f')](_0x5a5375,_0x3e4dd3['Attachment']['basename']);if(fs[_0x7435('0x79')](_0x10db4d)){fs[_0x7435('0x7a')](_0x10db4d)['pipe'](fs['createWriteStream'](path[_0x7435('0x5f')](_0x462fa2,_0x3e4dd3[_0x7435('0x69')][_0x7435('0x7b')])));}}return{'date':moment(_0x3e4dd3[_0x7435('0x6a')])[_0x7435('0x4d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7435('0x5a')](),'sender':_0x3e4dd3[_0x7435('0x6b')]===_0x7435('0x7c')?_0x3e4dd3[_0x7435('0x63')]?_0x3e4dd3['User']['fullname']:'System':_0x3e4dd3['Contact'][_0x7435('0x67')]+(_0x3e4dd3[_0x7435('0x66')]['lastName']?'\x20'+_0x3e4dd3['Contact'][_0x7435('0x68')]:''),'body':_0x3e4dd3['Attachment']?_0x3e4dd3[_0x7435('0x69')][_0x7435('0x7b')]:_0x3e4dd3[_0x7435('0x3c')],'direction':_0x3e4dd3[_0x7435('0x6b')]==='out'?'A':'C','secret':_0x3e4dd3[_0x7435('0x7d')],'read':_0x3e4dd3[_0x7435('0x6c')],'attachment':_0x3e4dd3[_0x7435('0x69')]};})[_0x7435('0x7e')]()};return ejs[_0x7435('0x7f')](path['join'](config[_0x7435('0x5b')],_0x7435('0x5c'),'views',_0x7435('0x80')),{'interaction':_0x3a0418})[_0x7435('0x1c')](function(_0x231b33){var _0x33801e=path[_0x7435('0x5f')](_0x462fa2,_0x7435('0x81')+_0x32aec4['id']+'-'+_0x189f45+_0x7435('0x82'));var _0x33f616={'path':_0x33801e,'channel':_0x7435('0x72'),'interactionId':_0x32aec4['id']};return pdf[_0x7435('0x83')](_0x231b33,_0x33f616);})[_0x7435('0x1c')](function(){return new Promise(function(_0x519854,_0x333d1a){zipdir(_0x462fa2,{'saveTo':_0x117ab1},function(_0x3c763c,_0x4f0bf1){if(_0x3c763c)return _0x333d1a(_0x3c763c);return _0x519854(_0x4f0bf1);});})[_0x7435('0x1c')](function(){return new Promise(function(_0x14ec09,_0x480d07){rimraf(_0x462fa2,function(_0x221f6d){if(_0x221f6d)_0x480d07(_0x221f6d);return _0x14ec09();});});})[_0x7435('0x1c')](function(){return _0x3d953e[_0x7435('0x58')](_0x117ab1,_0x234571,function(_0x21505b){if(_0x21505b){logger[_0x7435('0x1e')](_0x7435('0x84'),_0x21505b);}else{fs[_0x7435('0x85')](_0x117ab1);}});});});}else{return _0x3d953e[_0x7435('0x13')](0xc8);}})['catch'](handleError(_0x3d953e,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b7c2eac..c7f9170 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 _0xa205=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x3d0091,_0x14683e){var _0x2d457f=function(_0x60a227){while(--_0x60a227){_0x3d0091['push'](_0x3d0091['shift']());}};_0x2d457f(++_0x14683e);}(_0xa205,0x8f));var _0x5a20=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0xa205[_0x25662e];return _0x59b7bc;};'use strict';var EventEmitter=require(_0x5a20('0x0'));var OpenchannelInteraction=require(_0x5a20('0x1'))['db'][_0x5a20('0x2')];var OpenchannelMessage=require(_0x5a20('0x1'))['db'][_0x5a20('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5a20('0x4')](0x0);var events={'afterCreate':_0x5a20('0x5'),'afterUpdate':'update','afterDestroy':_0x5a20('0x6')};function emitEvent(_0x34dfb9){return function(_0x19b63a,_0x2a313c,_0x4d9b13){_0x19b63a['getUsers']({'attributes':['id'],'raw':!![]})[_0x5a20('0x7')](function(_0x2cff1a){_0x19b63a[_0x5a20('0x8')](_0x5a20('0x9'),_0x2cff1a[_0x5a20('0xa')](function(_0x4bd469){return{'id':_0x4bd469['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x19b63a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5a20('0x7')](function(_0x574db9){_0x19b63a['setDataValue'](_0x5a20('0xb'),_0x574db9[_0x5a20('0xc')]);OpenchannelInteractionEvents[_0x5a20('0xd')](_0x34dfb9+':'+_0x19b63a['id'],_0x19b63a);OpenchannelInteractionEvents[_0x5a20('0xd')](_0x34dfb9,_0x19b63a);_0x4d9b13(null);})[_0x5a20('0xe')](_0x4d9b13(null));};}for(var e in events){if(events[_0x5a20('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x5a20('0x10')](e,emitEvent(event));}}module[_0x5a20('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xa117=['then','Users','map','setDataValue','emit','catch','hasOwnProperty','hook','events','OpenchannelMessage','setMaxListeners','remove','getUsers'];(function(_0x190cfe,_0x16f92e){var _0x22716e=function(_0x52a77a){while(--_0x52a77a){_0x190cfe['push'](_0x190cfe['shift']());}};_0x22716e(++_0x16f92e);}(_0xa117,0x126));var _0x7a11=function(_0xfc15eb,_0x4e9f86){_0xfc15eb=_0xfc15eb-0x0;var _0x1c0ec6=_0xa117[_0xfc15eb];return _0x1c0ec6;};'use strict';var EventEmitter=require(_0x7a11('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0x7a11('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7a11('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7a11('0x3')};function emitEvent(_0xc29ad9){return function(_0x325e38,_0x18a779,_0x41ffc1){_0x325e38[_0x7a11('0x4')]({'attributes':['id'],'raw':!![]})[_0x7a11('0x5')](function(_0x3d15f3){_0x325e38['setDataValue'](_0x7a11('0x6'),_0x3d15f3[_0x7a11('0x7')](function(_0x29b6cd){return{'id':_0x29b6cd['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x325e38['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x427d56){_0x325e38[_0x7a11('0x8')]('unreadMessages',_0x427d56['length']);OpenchannelInteractionEvents[_0x7a11('0x9')](_0xc29ad9+':'+_0x325e38['id'],_0x325e38);OpenchannelInteractionEvents[_0x7a11('0x9')](_0xc29ad9,_0x325e38);_0x41ffc1(null);})[_0x7a11('0xa')](_0x41ffc1(null));};}for(var e in events){if(events[_0x7a11('0xb')](e)){var event=events[e];OpenchannelInteraction[_0x7a11('0xc')](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 6be3cab..d0c83e5 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 _0xf40f=['closed','format','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf40f,0x17c));var _0xff40=function(_0xd69ad0,_0x3fdda3){_0xd69ad0=_0xd69ad0-0x0;var _0x7be14b=_0xf40f[_0xd69ad0];return _0x7be14b;};'use strict';var _=require(_0xff40('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xff40('0x1'));var moment=require(_0xff40('0x2'));var BPromise=require(_0xff40('0x3'));var rp=require(_0xff40('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff40('0x5'));var config=require(_0xff40('0x6'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x46c81d,_0x27f81b){return _0x46c81d[_0xff40('0x7')](_0xff40('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xff40('0x9'),'collate':_0xff40('0xa'),'hooks':{'beforeUpdate':function(_0x5d0a37,_0xf130bd,_0x4b9694){if(_0x5d0a37[_0xff40('0xb')](_0xff40('0xc'))){_0x5d0a37['closedAt']=moment()[_0xff40('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4b9694(null,_0x5d0a37);}}});}; \ No newline at end of file +var _0xfb6e=['YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format'];(function(_0xbaa779,_0x116e12){var _0x4356e7=function(_0x340cd1){while(--_0x340cd1){_0xbaa779['push'](_0xbaa779['shift']());}};_0x4356e7(++_0x116e12);}(_0xfb6e,0x177));var _0xefb6=function(_0x21164d,_0x104418){_0x21164d=_0x21164d-0x0;var _0x25f19d=_0xfb6e[_0x21164d];return _0x25f19d;};'use strict';var _=require('lodash');var util=require(_0xefb6('0x0'));var logger=require(_0xefb6('0x1'))(_0xefb6('0x2'));var moment=require(_0xefb6('0x3'));var BPromise=require(_0xefb6('0x4'));var rp=require(_0xefb6('0x5'));var fs=require('fs');var path=require(_0xefb6('0x6'));var rimraf=require(_0xefb6('0x7'));var config=require('../../config/environment');var attributes=require(_0xefb6('0x8'));module[_0xefb6('0x9')]=function(_0x5ccd16,_0x125a0d){return _0x5ccd16['define']('OpenchannelInteraction',attributes,{'tableName':_0xefb6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xefb6('0xb'),'hooks':{'beforeUpdate':function(_0x5bf176,_0x4c45a8,_0x21138b){if(_0x5bf176[_0xefb6('0xc')](_0xefb6('0xd'))){_0x5bf176[_0xefb6('0xe')]=moment()[_0xefb6('0xf')](_0xefb6('0x10'));}_0x21138b(null,_0x5bf176);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e896703..e7e8817 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 _0x0053=['error','code','message','catch','update','body','options','raw','where','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','OpenchannelInteraction','then','addTags','ids','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x14f8d7,_0x1a944e){var _0x334c9c=function(_0x117817){while(--_0x117817){_0x14f8d7['push'](_0x14f8d7['shift']());}};_0x334c9c(++_0x1a944e);}(_0x0053,0x67));var _0x3005=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0053[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3005('0x0'));var util=require(_0x3005('0x1'));var moment=require(_0x3005('0x2'));var BPromise=require(_0x3005('0x3'));var rs=require(_0x3005('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3005('0x5'))['db'];var utils=require(_0x3005('0x6'));var logger=require(_0x3005('0x7'))(_0x3005('0x8'));var config=require(_0x3005('0x9'));var jayson=require(_0x3005('0xa'));var client=jayson[_0x3005('0xb')][_0x3005('0xc')]({'port':0x232a});config[_0x3005('0xd')]=_[_0x3005('0xe')](config[_0x3005('0xd')],{'host':_0x3005('0xf'),'port':0x18eb});var socket=require(_0x3005('0x10'))(new Redis(config[_0x3005('0xd')]));require(_0x3005('0x11'))[_0x3005('0x12')](socket);function respondWithRpcPromise(_0x4ff9a5,_0x2385e0,_0x4d3986){return new BPromise(function(_0x4b7739,_0x511765){return client[_0x3005('0x13')](_0x4ff9a5,_0x4d3986)['then'](function(_0x456d80){logger[_0x3005('0x14')](_0x3005('0x15'),_0x2385e0,_0x3005('0x16'));logger[_0x3005('0x17')](_0x3005('0x18'),_0x2385e0,_0x3005('0x16'),JSON[_0x3005('0x19')](_0x456d80));if(_0x456d80[_0x3005('0x1a')]){if(_0x456d80['error'][_0x3005('0x1b')]===0x1f4){logger[_0x3005('0x1a')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2385e0,_0x456d80[_0x3005('0x1a')][_0x3005('0x1c')]);return _0x511765(_0x456d80[_0x3005('0x1a')][_0x3005('0x1c')]);}logger[_0x3005('0x1a')](_0x3005('0x15'),_0x2385e0,_0x456d80[_0x3005('0x1a')][_0x3005('0x1c')]);return _0x4b7739(_0x456d80[_0x3005('0x1a')][_0x3005('0x1c')]);}else{logger[_0x3005('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2385e0,_0x3005('0x16'));_0x4b7739(_0x456d80['result'][_0x3005('0x1c')]);}})[_0x3005('0x1d')](function(_0x45dc44){logger['error'](_0x3005('0x15'),_0x2385e0,_0x45dc44);_0x511765(_0x45dc44);});});}exports['UpdateOpenchannelInteraction']=function(_0x36bab7){var _0x4afc42=this;return new Promise(function(_0xaa291d,_0x50100e){return db['OpenchannelInteraction'][_0x3005('0x1e')](_0x36bab7[_0x3005('0x1f')],{'raw':_0x36bab7[_0x3005('0x20')]?_0x36bab7[_0x3005('0x20')][_0x3005('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36bab7[_0x3005('0x20')]?_0x36bab7[_0x3005('0x20')][_0x3005('0x22')]||null:null,'attributes':_0x36bab7[_0x3005('0x20')]?_0x36bab7['options']['attributes']||null:null,'limit':_0x36bab7['options']?_0x36bab7[_0x3005('0x20')][_0x3005('0x23')]||null:null})['then'](function(_0x403acd){logger[_0x3005('0x14')](_0x3005('0x24'),_0x36bab7);logger[_0x3005('0x17')]('UpdateOpenchannelInteraction',_0x36bab7,JSON['stringify'](_0x403acd));_0xaa291d(_0x403acd);})['catch'](function(_0xfcff12){logger[_0x3005('0x1a')](_0x3005('0x24'),_0xfcff12[_0x3005('0x1c')],_0x36bab7);_0x50100e(_0x4afc42[_0x3005('0x1a')](0x1f4,_0xfcff12[_0x3005('0x1c')]));});});};exports[_0x3005('0x25')]=function(_0x510449){return new Promise(function(_0x1130a9,_0x42a2fc){return db[_0x3005('0x26')]['find']({'where':_0x510449[_0x3005('0x20')]?_0x510449[_0x3005('0x20')][_0x3005('0x22')]||null:null})[_0x3005('0x27')](function(_0xf3c871){if(_0xf3c871){return _0xf3c871[_0x3005('0x28')](_0x510449['body'][_0x3005('0x29')],_['omit'](_0x510449['body'],['ids','id'])||{});}})['spread'](function(_0x5bbd7e){logger[_0x3005('0x14')](_0x3005('0x2a'),_0x510449);logger[_0x3005('0x17')](_0x3005('0x2a'),_0x510449,JSON[_0x3005('0x19')](_0x5bbd7e));_0x1130a9(_0x5bbd7e);})[_0x3005('0x1d')](function(_0x5a1727){logger[_0x3005('0x1a')](_0x3005('0x2a'),_0x5a1727['message'],_0x510449);_0x42a2fc(_this[_0x3005('0x1a')](0x1f4,_0x5a1727[_0x3005('0x1c')]));});});}; \ No newline at end of file +var _0xfb81=['request','then','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','AddTagsToOpenchannelInteraction','find','where','addTags','ids','spread','AddTags','lodash','moment','ioredis','../../mysqldb','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfb81,0x8d));var _0x1fb8=function(_0x329935,_0x24b29f){_0x329935=_0x329935-0x0;var _0x26d30a=_0xfb81[_0x329935];return _0x26d30a;};'use strict';var _=require(_0x1fb8('0x0'));var util=require('util');var moment=require(_0x1fb8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb8('0x2'));var db=require(_0x1fb8('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1fb8('0x4'));var config=require('../../config/environment');var jayson=require(_0x1fb8('0x5'));var client=jayson['client'][_0x1fb8('0x6')]({'port':0x232a});config['redis']=_[_0x1fb8('0x7')](config[_0x1fb8('0x8')],{'host':_0x1fb8('0x9'),'port':0x18eb});var socket=require(_0x1fb8('0xa'))(new Redis(config[_0x1fb8('0x8')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x4a27a2,_0x1ac3ef,_0x53d5d9){return new BPromise(function(_0x254f00,_0x5ae4b3){return client[_0x1fb8('0xb')](_0x4a27a2,_0x53d5d9)[_0x1fb8('0xc')](function(_0x548c61){logger[_0x1fb8('0xd')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1ac3ef,'request\x20sent');logger[_0x1fb8('0xe')](_0x1fb8('0xf'),_0x1ac3ef,_0x1fb8('0x10'),JSON[_0x1fb8('0x11')](_0x548c61));if(_0x548c61[_0x1fb8('0x12')]){if(_0x548c61['error'][_0x1fb8('0x13')]===0x1f4){logger['error'](_0x1fb8('0x14'),_0x1ac3ef,_0x548c61[_0x1fb8('0x12')][_0x1fb8('0x15')]);return _0x5ae4b3(_0x548c61['error']['message']);}logger[_0x1fb8('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1ac3ef,_0x548c61[_0x1fb8('0x12')][_0x1fb8('0x15')]);return _0x254f00(_0x548c61[_0x1fb8('0x12')][_0x1fb8('0x15')]);}else{logger[_0x1fb8('0xd')](_0x1fb8('0x14'),_0x1ac3ef,_0x1fb8('0x10'));_0x254f00(_0x548c61[_0x1fb8('0x16')][_0x1fb8('0x15')]);}})[_0x1fb8('0x17')](function(_0x126728){logger['error'](_0x1fb8('0x14'),_0x1ac3ef,_0x126728);_0x5ae4b3(_0x126728);});});}exports[_0x1fb8('0x18')]=function(_0x31e80f){var _0x401819=this;return new Promise(function(_0x5dde72,_0x1dea9a){return db[_0x1fb8('0x19')][_0x1fb8('0x1a')](_0x31e80f[_0x1fb8('0x1b')],{'raw':_0x31e80f[_0x1fb8('0x1c')]?_0x31e80f[_0x1fb8('0x1c')][_0x1fb8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31e80f['options']?_0x31e80f['options']['where']||null:null,'attributes':_0x31e80f[_0x1fb8('0x1c')]?_0x31e80f[_0x1fb8('0x1c')][_0x1fb8('0x1e')]||null:null,'limit':_0x31e80f['options']?_0x31e80f['options']['limit']||null:null})[_0x1fb8('0xc')](function(_0x223683){logger['info'](_0x1fb8('0x18'),_0x31e80f);logger[_0x1fb8('0xe')](_0x1fb8('0x18'),_0x31e80f,JSON[_0x1fb8('0x11')](_0x223683));_0x5dde72(_0x223683);})[_0x1fb8('0x17')](function(_0x16afd4){logger[_0x1fb8('0x12')](_0x1fb8('0x18'),_0x16afd4[_0x1fb8('0x15')],_0x31e80f);_0x1dea9a(_0x401819['error'](0x1f4,_0x16afd4[_0x1fb8('0x15')]));});});};exports[_0x1fb8('0x1f')]=function(_0x39b373){return new Promise(function(_0x4c0bec,_0x239a79){return db[_0x1fb8('0x19')][_0x1fb8('0x20')]({'where':_0x39b373['options']?_0x39b373[_0x1fb8('0x1c')][_0x1fb8('0x21')]||null:null})[_0x1fb8('0xc')](function(_0xa268c){if(_0xa268c){return _0xa268c[_0x1fb8('0x22')](_0x39b373[_0x1fb8('0x1b')][_0x1fb8('0x23')],_['omit'](_0x39b373[_0x1fb8('0x1b')],[_0x1fb8('0x23'),'id'])||{});}})[_0x1fb8('0x24')](function(_0x5f1275){logger[_0x1fb8('0xd')](_0x1fb8('0x25'),_0x39b373);logger[_0x1fb8('0xe')](_0x1fb8('0x25'),_0x39b373,JSON[_0x1fb8('0x11')](_0x5f1275));_0x4c0bec(_0x5f1275);})[_0x1fb8('0x17')](function(_0x165cc1){logger['error']('AddTags',_0x165cc1['message'],_0x39b373);_0x239a79(_this['error'](0x1f4,_0x165cc1[_0x1fb8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 756aeb5..63dfeae 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 _0xbd76=['remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x510117,_0x370cfd){var _0x1ed086=function(_0x5c9d13){while(--_0x5c9d13){_0x510117['push'](_0x510117['shift']());}};_0x1ed086(++_0x370cfd);}(_0xbd76,0x130));var _0x6bd7=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xbd76[_0x5f0089];return _0x193892;};'use strict';var OpenchannelInteractionEvents=require(_0x6bd7('0x0'));var events=[_0x6bd7('0x1'),_0x6bd7('0x2'),_0x6bd7('0x3')];function createListener(_0xe3355b,_0x50ad14){return function(_0x348151){_0x50ad14[_0x6bd7('0x4')](_0xe3355b,_0x348151);};}function removeListener(_0x511d69,_0x3e6c2e){return function(){OpenchannelInteractionEvents[_0x6bd7('0x5')](_0x511d69,_0x3e6c2e);};}exports[_0x6bd7('0x6')]=function(_0x5c0f15){for(var _0x1cb693=0x0,_0x311ffd=events[_0x6bd7('0x7')];_0x1cb693<_0x311ffd;_0x1cb693++){var _0xaf543a=events[_0x1cb693];var _0x1a7184=createListener(_0x6bd7('0x8')+_0xaf543a,_0x5c0f15);OpenchannelInteractionEvents['on'](_0xaf543a,_0x1a7184);}}; \ No newline at end of file +var _0xad38=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x19a207,_0x2308e6){var _0x1c9578=function(_0x1171a1){while(--_0x1171a1){_0x19a207['push'](_0x19a207['shift']());}};_0x1c9578(++_0x2308e6);}(_0xad38,0x173));var _0x8ad3=function(_0x4036d9,_0x2804ee){_0x4036d9=_0x4036d9-0x0;var _0x2d0bf1=_0xad38[_0x4036d9];return _0x2d0bf1;};'use strict';var OpenchannelInteractionEvents=require(_0x8ad3('0x0'));var events=[_0x8ad3('0x1'),_0x8ad3('0x2'),_0x8ad3('0x3')];function createListener(_0x40ed0c,_0xa61883){return function(_0x8497b4){_0xa61883[_0x8ad3('0x4')](_0x40ed0c,_0x8497b4);};}function removeListener(_0xce94e9,_0x2fa800){return function(){OpenchannelInteractionEvents[_0x8ad3('0x5')](_0xce94e9,_0x2fa800);};}exports[_0x8ad3('0x6')]=function(_0x1fa953){for(var _0x2ebd5b=0x0,_0x268e6c=events[_0x8ad3('0x7')];_0x2ebd5b<_0x268e6c;_0x2ebd5b++){var _0x59e841=events[_0x2ebd5b];var _0x5b6352=createListener(_0x8ad3('0x8')+_0x59e841,_0x1fa953);OpenchannelInteractionEvents['on'](_0x59e841,_0x5b6352);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 5749ef6..95e51ce 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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x2105d9,_0x48ea4b){var _0x2b6567=function(_0x11e2c0){while(--_0x11e2c0){_0x2105d9['push'](_0x2105d9['shift']());}};_0x2b6567(++_0x48ea4b);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x4cd2aa,_0x19a600){var _0x2c2c7e=function(_0x4ebfc5){while(--_0x4ebfc5){_0x4cd2aa['push'](_0x4cd2aa['shift']());}};_0x2c2c7e(++_0x19a600);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 98981f2..a4f6d73 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 _0x4fad=['out','DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x4648f1,_0x4d3643){var _0x514c00=function(_0x4a0031){while(--_0x4a0031){_0x4648f1['push'](_0x4648f1['shift']());}};_0x514c00(++_0x4d3643);}(_0x4fad,0xcb));var _0xd4fa=function(_0x386cfd,_0x86631a){_0x386cfd=_0x386cfd-0x0;var _0x4faef0=_0x4fad[_0x386cfd];return _0x4faef0;};'use strict';var Sequelize=require(_0xd4fa('0x0'));module[_0xd4fa('0x1')]={'body':{'type':Sequelize[_0xd4fa('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd4fa('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd4fa('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd4fa('0x4')]('in',_0xd4fa('0x5')),'defaultValue':_0xd4fa('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd4fa('0x6')]},'providerName':{'type':Sequelize[_0xd4fa('0x7')]},'providerResponse':{'type':Sequelize[_0xd4fa('0x2')]}}; \ No newline at end of file +var _0xccde=['STRING','sequelize','TEXT','BOOLEAN','out','DATE'];(function(_0x232984,_0x2b0e75){var _0xbac9e6=function(_0x43c898){while(--_0x43c898){_0x232984['push'](_0x232984['shift']());}};_0xbac9e6(++_0x2b0e75);}(_0xccde,0x1e1));var _0xeccd=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0xccde[_0x2ddfd9];return _0x2668f0;};'use strict';var Sequelize=require(_0xeccd('0x0'));module['exports']={'body':{'type':Sequelize[_0xeccd('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xeccd('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xeccd('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xeccd('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeccd('0x4')]},'providerName':{'type':Sequelize[_0xeccd('0x5')]},'providerResponse':{'type':Sequelize[_0xeccd('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 0e8fb1a..23234bb 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 _0x2e88=['motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','email','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','end','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','findAll','rows','show','length','find','create','body','destroy','params','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','SIP/%s','channel'];(function(_0x22bce9,_0x9c0bc2){var _0x4ce257=function(_0xfec91d){while(--_0xfec91d){_0x22bce9['push'](_0x22bce9['shift']());}};_0x4ce257(++_0x9c0bc2);}(_0x2e88,0x95));var _0x82e8=function(_0x5805d7,_0x3d584a){_0x5805d7=_0x5805d7-0x0;var _0x170fe4=_0x2e88[_0x5805d7];return _0x170fe4;};'use strict';var emlformat=require(_0x82e8('0x0'));var rimraf=require(_0x82e8('0x1'));var zipdir=require(_0x82e8('0x2'));var jsonpatch=require(_0x82e8('0x3'));var rp=require(_0x82e8('0x4'));var moment=require(_0x82e8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x82e8('0x6'));var util=require(_0x82e8('0x7'));var path=require('path');var sox=require(_0x82e8('0x8'));var csv=require(_0x82e8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82e8('0xa'));var _=require(_0x82e8('0xb'));var squel=require(_0x82e8('0xc'));var crypto=require(_0x82e8('0xd'));var jsforce=require(_0x82e8('0xe'));var deskjs=require(_0x82e8('0xf'));var toCsv=require(_0x82e8('0x9'));var querystring=require(_0x82e8('0x10'));var Papa=require(_0x82e8('0x11'));var Redis=require(_0x82e8('0x12'));var authService=require(_0x82e8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x82e8('0x14'));var hardwareService=require(_0x82e8('0x15'));var logger=require(_0x82e8('0x16'))(_0x82e8('0x17'));var utils=require(_0x82e8('0x18'));var config=require(_0x82e8('0x19'));var licenseUtil=require(_0x82e8('0x1a'));var db=require('../../mysqldb')['db'];config[_0x82e8('0x1b')]=_[_0x82e8('0x1c')](config[_0x82e8('0x1b')],{'host':_0x82e8('0x1d'),'port':0x18eb});var socket=require(_0x82e8('0x1e'))(new Redis(config['redis']));require(_0x82e8('0x1f'))[_0x82e8('0x20')](socket);var jayson=require(_0x82e8('0x21'));var client=jayson[_0x82e8('0x22')]['http']({'port':0x232c});var client9002=jayson[_0x82e8('0x22')][_0x82e8('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x3253d2,_0xf53214,_0x17a2e2,_0x541c58){return new BPromise(function(_0x39e7bc,_0x64e4fa){var _0x574ba2=_0x541c58||client;return _0x574ba2[_0x82e8('0x24')](_0x3253d2,_0x17a2e2)[_0x82e8('0x25')](function(_0x16cb41){logger[_0x82e8('0x26')](_0x82e8('0x27'),_0xf53214,_0x82e8('0x28'));logger[_0x82e8('0x29')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xf53214,_0x82e8('0x28'),JSON[_0x82e8('0x2a')](_0x16cb41));if(_0x16cb41[_0x82e8('0x2b')]){if(_0x16cb41[_0x82e8('0x2b')][_0x82e8('0x2c')]===0x1f4){logger['error'](_0x82e8('0x27'),_0xf53214,_0x16cb41['error'][_0x82e8('0x2d')]);return _0x64e4fa(_0x16cb41[_0x82e8('0x2b')][_0x82e8('0x2d')]);}logger[_0x82e8('0x2b')](_0x82e8('0x27'),_0xf53214,_0x16cb41[_0x82e8('0x2b')][_0x82e8('0x2d')]);return _0x39e7bc(_0x16cb41['error'][_0x82e8('0x2d')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xf53214,'request\x20sent');_0x39e7bc(_0x16cb41[_0x82e8('0x2e')]['message']);}})[_0x82e8('0x2f')](function(_0x305710){logger[_0x82e8('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0xf53214,_0x305710);_0x64e4fa(_0x305710);});});}function respondWithStatusCode(_0x2751e1,_0x476602){_0x476602=_0x476602||0xcc;return function(_0x336015){if(_0x336015){return _0x2751e1[_0x82e8('0x30')](_0x476602);}return _0x2751e1[_0x82e8('0x31')](_0x476602)['end']();};}function respondWithResult(_0x55c0d0,_0x220d51){_0x220d51=_0x220d51||0xc8;return function(_0xe5ea6f){if(_0xe5ea6f){return _0x55c0d0[_0x82e8('0x31')](_0x220d51)[_0x82e8('0x32')](_0xe5ea6f);}};}function respondWithFilteredResult(_0x1c2160,_0x4756ac){return function(_0x14450e){if(_0x14450e){var _0x1e9eee=typeof _0x4756ac[_0x82e8('0x33')]===_0x82e8('0x34')&&typeof _0x4756ac[_0x82e8('0x35')]===_0x82e8('0x34');var _0x7d089d=_0x14450e['count'];var _0x435b62=_0x1e9eee?0x0:_0x4756ac[_0x82e8('0x33')];var _0x215f19=_0x1e9eee?_0x14450e[_0x82e8('0x36')]:_0x4756ac[_0x82e8('0x33')]+_0x4756ac[_0x82e8('0x35')];var _0x289f08;if(_0x215f19>=_0x7d089d){_0x215f19=_0x7d089d;_0x289f08=0xc8;}else{_0x289f08=0xce;}_0x1c2160[_0x82e8('0x31')](_0x289f08);return _0x1c2160[_0x82e8('0x37')](_0x82e8('0x38'),_0x435b62+'-'+_0x215f19+'/'+_0x7d089d)[_0x82e8('0x32')](_0x14450e);}return null;};}function patchUpdates(_0x579308){return function(_0x3e4548){try{jsonpatch[_0x82e8('0x39')](_0x3e4548,_0x579308,!![]);}catch(_0x19ed65){return BPromise[_0x82e8('0x3a')](_0x19ed65);}return _0x3e4548[_0x82e8('0x3b')]();};}function saveUpdates(_0x18ee10,_0xa88631){return function(_0x25a944){if(_0x25a944){return _0x25a944['update'](_0x18ee10)[_0x82e8('0x25')](function(_0x4aa077){return _0x4aa077;});}return null;};}function removeEntity(_0x406c8d,_0x43c60a){return function(_0x5e81e2){if(_0x5e81e2){return _0x5e81e2['destroy']()[_0x82e8('0x25')](function(){_0x406c8d['status'](0xcc)[_0x82e8('0x3c')]();});}};}function handleEntityNotFound(_0x1a35a8,_0x303889){return function(_0x1c95a3){if(!_0x1c95a3){_0x1a35a8[_0x82e8('0x30')](0x194);}return _0x1c95a3;};}function handleError(_0x14f4b5,_0x391d94){_0x391d94=_0x391d94||0x1f4;return function(_0x125e73){logger[_0x82e8('0x2b')](_0x125e73[_0x82e8('0x3d')]);if(_0x125e73[_0x82e8('0x3e')]){delete _0x125e73[_0x82e8('0x3e')];}_0x14f4b5['status'](_0x391d94)[_0x82e8('0x3f')](_0x125e73);};}exports[_0x82e8('0x40')]=function(_0x7ebf5f,_0x4cc61e){var _0x7c03bd={},_0xf072cc={},_0xdd51a6={'count':0x0,'rows':[]};var _0x4e67ac=_[_0x82e8('0x41')](db[_0x82e8('0x42')][_0x82e8('0x43')],function(_0x1eceef){return{'name':_0x1eceef[_0x82e8('0x44')],'type':_0x1eceef[_0x82e8('0x45')][_0x82e8('0x46')]};});_0xf072cc['model']=_[_0x82e8('0x41')](_0x4e67ac,_0x82e8('0x3e'));_0xf072cc[_0x82e8('0x47')]=_[_0x82e8('0x48')](_0x7ebf5f[_0x82e8('0x47')]);_0xf072cc[_0x82e8('0x49')]=_[_0x82e8('0x4a')](_0xf072cc[_0x82e8('0x4b')],_0xf072cc[_0x82e8('0x47')]);_0x7c03bd[_0x82e8('0x4c')]=_[_0x82e8('0x4a')](_0xf072cc[_0x82e8('0x4b')],qs[_0x82e8('0x4d')](_0x7ebf5f[_0x82e8('0x47')][_0x82e8('0x4d')]));_0x7c03bd['attributes']=_0x7c03bd[_0x82e8('0x4c')]['length']?_0x7c03bd[_0x82e8('0x4c')]:_0xf072cc[_0x82e8('0x4b')];if(!_0x7ebf5f[_0x82e8('0x47')][_0x82e8('0x4e')](_0x82e8('0x4f'))){_0x7c03bd[_0x82e8('0x35')]=qs['limit'](_0x7ebf5f[_0x82e8('0x47')]['limit']);_0x7c03bd[_0x82e8('0x33')]=qs[_0x82e8('0x33')](_0x7ebf5f[_0x82e8('0x47')][_0x82e8('0x33')]);}_0x7c03bd[_0x82e8('0x50')]=qs['sort'](_0x7ebf5f['query'][_0x82e8('0x51')]);_0x7c03bd['where']=qs[_0x82e8('0x49')](_['pick'](_0x7ebf5f['query'],_0xf072cc['filters']),_0x4e67ac);if(_0x7ebf5f['query'][_0x82e8('0x52')]){_0x7c03bd[_0x82e8('0x53')]=_['merge'](_0x7c03bd[_0x82e8('0x53')],{'$or':_[_0x82e8('0x41')](_0x4e67ac,function(_0x52333d){if(_0x52333d[_0x82e8('0x45')]!=='VIRTUAL'){var _0x3382c3={};_0x3382c3[_0x52333d[_0x82e8('0x3e')]]={'$like':'%'+_0x7ebf5f[_0x82e8('0x47')][_0x82e8('0x52')]+'%'};return _0x3382c3;}})});}_0x7c03bd=_[_0x82e8('0x54')]({},_0x7c03bd,_0x7ebf5f[_0x82e8('0x55')]);var _0x4d6898={'where':_0x7c03bd[_0x82e8('0x53')]};return db[_0x82e8('0x42')][_0x82e8('0x36')](_0x4d6898)[_0x82e8('0x25')](function(_0x4c2747){_0xdd51a6[_0x82e8('0x36')]=_0x4c2747;if(_0x7ebf5f['query'][_0x82e8('0x56')]){_0x7c03bd['include']=[{'all':!![]}];}return db[_0x82e8('0x42')][_0x82e8('0x57')](_0x7c03bd);})[_0x82e8('0x25')](function(_0x57b216){_0xdd51a6[_0x82e8('0x58')]=_0x57b216;return _0xdd51a6;})['then'](respondWithFilteredResult(_0x4cc61e,_0x7c03bd))['catch'](handleError(_0x4cc61e,null));};exports[_0x82e8('0x59')]=function(_0x381a5e,_0x443002){var _0x4f0d19={'raw':!![],'where':{'id':_0x381a5e['params']['id']}},_0x407b3b={};_0x407b3b['model']=_['keys'](db['OpenchannelMessage'][_0x82e8('0x43')]);_0x407b3b[_0x82e8('0x47')]=_[_0x82e8('0x48')](_0x381a5e[_0x82e8('0x47')]);_0x407b3b['filters']=_[_0x82e8('0x4a')](_0x407b3b[_0x82e8('0x4b')],_0x407b3b[_0x82e8('0x47')]);_0x4f0d19[_0x82e8('0x4c')]=_[_0x82e8('0x4a')](_0x407b3b[_0x82e8('0x4b')],qs['fields'](_0x381a5e[_0x82e8('0x47')][_0x82e8('0x4d')]));_0x4f0d19['attributes']=_0x4f0d19['attributes'][_0x82e8('0x5a')]?_0x4f0d19[_0x82e8('0x4c')]:_0x407b3b['model'];if(_0x381a5e[_0x82e8('0x47')][_0x82e8('0x56')]){_0x4f0d19['include']=[{'all':!![]}];}_0x4f0d19=_[_0x82e8('0x54')]({},_0x4f0d19,_0x381a5e[_0x82e8('0x55')]);return db['OpenchannelMessage'][_0x82e8('0x5b')](_0x4f0d19)['then'](handleEntityNotFound(_0x443002,null))[_0x82e8('0x25')](respondWithResult(_0x443002,null))['catch'](handleError(_0x443002,null));};exports[_0x82e8('0x5c')]=function(_0x107222,_0x5974a0){return db[_0x82e8('0x42')]['create'](_0x107222[_0x82e8('0x5d')],{})['then'](respondWithResult(_0x5974a0,0xc9))[_0x82e8('0x2f')](handleError(_0x5974a0,null));};exports['update']=function(_0x41e64c,_0x19d645){if(_0x41e64c['body']['id']){delete _0x41e64c[_0x82e8('0x5d')]['id'];}return db[_0x82e8('0x42')]['find']({'where':{'id':_0x41e64c['params']['id']}})[_0x82e8('0x25')](handleEntityNotFound(_0x19d645,null))['then'](saveUpdates(_0x41e64c[_0x82e8('0x5d')],null))[_0x82e8('0x25')](respondWithResult(_0x19d645,null))[_0x82e8('0x2f')](handleError(_0x19d645,null));};exports[_0x82e8('0x5e')]=function(_0x1823b8,_0x3f340b){return db[_0x82e8('0x42')][_0x82e8('0x5b')]({'where':{'id':_0x1823b8[_0x82e8('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3f340b,null))[_0x82e8('0x25')](removeEntity(_0x3f340b,null))['catch'](handleError(_0x3f340b,null));};exports['describe']=function(_0x2e4f09,_0x398174){return db[_0x82e8('0x42')][_0x82e8('0x60')]()['then'](respondWithResult(_0x398174,null))[_0x82e8('0x2f')](handleError(_0x398174,null));};var interaction_log=require(_0x82e8('0x16'))(_0x82e8('0x61'));exports[_0x82e8('0x62')]=function(_0x31c307,_0x3ad68e,_0x28e78e){var _0x131a1c={'agent':{},'channel':_0x82e8('0x63')};if(_0x31c307[_0x82e8('0x5d')]['id']){delete _0x31c307[_0x82e8('0x5d')]['id'];}_0x31c307[_0x82e8('0x5d')][_0x82e8('0x64')]=!![];_0x31c307[_0x82e8('0x5d')][_0x82e8('0x65')]=moment()[_0x82e8('0x66')]('YYYY-MM-DD\x20HH:mm:ss');_0x31c307[_0x82e8('0x5d')][_0x82e8('0x67')]=_0x31c307[_0x82e8('0x5d')][_0x82e8('0x67')]||_0x31c307[_0x82e8('0x68')]['id'];_0x131a1c[_0x82e8('0x69')]['id']=_0x31c307[_0x82e8('0x5d')][_0x82e8('0x67')];return db[_0x82e8('0x42')][_0x82e8('0x5b')]({'where':{'id':_0x31c307[_0x82e8('0x5f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ad68e,null))[_0x82e8('0x25')](saveUpdates(_0x31c307[_0x82e8('0x5d')],null))[_0x82e8('0x25')](function(_0x8a9cd5){if(_0x8a9cd5){_0x131a1c[_0x82e8('0x2d')]=_0x8a9cd5[_0x82e8('0x6a')]({'plain':!![]});return db[_0x82e8('0x6b')][_0x82e8('0x5b')]({'where':{'id':_0x8a9cd5[_0x82e8('0x6c')]}});}return null;})[_0x82e8('0x25')](handleEntityNotFound(_0x3ad68e,null))[_0x82e8('0x25')](function(_0x2ba04f){if(_0x2ba04f){return _0x2ba04f[_0x82e8('0x6d')]({'UserId':_0x31c307[_0x82e8('0x5d')][_0x82e8('0x67')],'read1stAt':_[_0x82e8('0x6e')](_0x2ba04f[_0x82e8('0x6f')])?moment()['format'](_0x82e8('0x70')):undefined});}return null;})[_0x82e8('0x25')](function(_0x136653){if(_0x136653){_0x131a1c[_0x82e8('0x71')]=_0x136653[_0x82e8('0x6a')]({'plain':!![]});interaction_log[_0x82e8('0x26')](_0x82e8('0x72'),_0x31c307['user']['id'],_0x31c307[_0x82e8('0x68')][_0x82e8('0x3e')],_0x31c307['user']['role'],_0x131a1c[_0x82e8('0x71')]['id'],_0x31c307['body']?JSON['stringify'](_0x31c307[_0x82e8('0x5d')]):_0x82e8('0x73'));return respondWithRpcPromise('AcceptMessage',_0x82e8('0x74'),_0x131a1c);}return null;})['then'](function(_0x3abf22){var _0x57691b=_0x82e8('0x75')+_0x3abf22['message']['ContactId'];return db[_0x82e8('0x76')]['query'](_0x57691b,{'type':db[_0x82e8('0x77')][_0x82e8('0x78')][_0x82e8('0x79')],'raw':!![]})[_0x82e8('0x25')](function(_0x3f0ffe){return _0x3f0ffe;});})[_0x82e8('0x25')](function(_0x41d921){if(_0x41d921){_0x131a1c[_0x82e8('0x2d')][_0x82e8('0x7a')]=_0x41d921[0x0];if(!_0x31c307[_0x82e8('0x5d')][_0x82e8('0x67')])return;return db[_0x82e8('0x7b')][_0x82e8('0x5b')]({'where':{'id':_0x31c307[_0x82e8('0x5d')][_0x82e8('0x67')],'role':_0x82e8('0x69')},'attributes':['id',_0x82e8('0x3e'),_0x82e8('0x7c'),'email','internal'],'raw':!![]});}return null;})[_0x82e8('0x25')](function(_0x55bbff){if(!_0x55bbff)return null;_0x131a1c['message'][_0x82e8('0x69')]=_0x55bbff;return _0x131a1c;})['then'](function(_0x5b07b6){if(_0x5b07b6){if(_0x31c307[_0x82e8('0x5d')]['manual']){_0x131a1c[_0x82e8('0x2d')]['interface']=util[_0x82e8('0x66')](_0x82e8('0x7d'),_0x31c307[_0x82e8('0x68')][_0x82e8('0x3e')]);_0x131a1c[_0x82e8('0x2d')][_0x82e8('0x7e')]=_0x131a1c['channel'];_0x131a1c['message'][_0x82e8('0x7f')]=_0x131a1c[_0x82e8('0x7e')];_0x131a1c[_0x82e8('0x2d')][_0x82e8('0x80')]=_0x82e8('0x62');return respondWithRpcPromise(_0x82e8('0x81'),_0x82e8('0x81'),{'event':_0x82e8('0x82'),'message':_0x131a1c[_0x82e8('0x2d')]},client9002)[_0x82e8('0x25')](function(){return _0x131a1c;});}return _0x131a1c;}return null;})[_0x82e8('0x25')](respondWithResult(_0x3ad68e,null))['catch'](handleError(_0x3ad68e,null));};var interaction_log=require(_0x82e8('0x16'))(_0x82e8('0x61'));exports[_0x82e8('0x3a')]=function(_0x1c2c99,_0xc72e47,_0x479930){var _0x56adff={'agent':{},'channel':_0x82e8('0x63')};if(_0x1c2c99[_0x82e8('0x5d')]['id']){delete _0x1c2c99['body']['id'];}_0x1c2c99[_0x82e8('0x5d')][_0x82e8('0x67')]=_0x1c2c99[_0x82e8('0x5d')][_0x82e8('0x67')]||_0x1c2c99[_0x82e8('0x68')]['id'];_0x56adff[_0x82e8('0x69')]['id']=_0x1c2c99[_0x82e8('0x5d')]['UserId'];return db['OpenchannelMessage'][_0x82e8('0x5b')]({'where':{'id':_0x1c2c99[_0x82e8('0x5f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xc72e47,null))['then'](function(_0x104a77){if(_0x104a77){_0x56adff[_0x82e8('0x2d')]=_0x104a77[_0x82e8('0x6a')]({'plain':!![]});return db[_0x82e8('0x6b')][_0x82e8('0x5b')]({'where':{'id':_0x104a77[_0x82e8('0x6c')]}});}return null;})[_0x82e8('0x25')](handleEntityNotFound(_0xc72e47,null))[_0x82e8('0x25')](function(_0x282f88){if(_0x282f88){_0x56adff[_0x82e8('0x71')]=_0x282f88[_0x82e8('0x6a')]({'plain':!![]});interaction_log[_0x82e8('0x26')](_0x82e8('0x83'),_0x1c2c99[_0x82e8('0x68')]['id'],_0x1c2c99['user'][_0x82e8('0x3e')],_0x1c2c99[_0x82e8('0x68')][_0x82e8('0x84')],_0x56adff[_0x82e8('0x71')]['id'],_0x1c2c99[_0x82e8('0x5d')]?JSON[_0x82e8('0x2a')](_0x1c2c99[_0x82e8('0x5d')]):_0x82e8('0x73'));return respondWithRpcPromise(_0x82e8('0x85'),_0x82e8('0x86'),_0x56adff);}return null;})['then'](function(_0x30bacf){var _0x376bf2=_0x82e8('0x75')+_0x30bacf['message'][_0x82e8('0x87')];return db['sequelize'][_0x82e8('0x47')](_0x376bf2,{'type':db[_0x82e8('0x77')]['QueryTypes'][_0x82e8('0x79')],'raw':!![]})['then'](function(_0x4dc2b4){return _0x4dc2b4;});})[_0x82e8('0x25')](function(_0x3637f1){if(_0x3637f1){_0x56adff['message'][_0x82e8('0x7a')]=_0x3637f1[0x0];if(!_0x1c2c99[_0x82e8('0x5d')][_0x82e8('0x67')])return;return db[_0x82e8('0x7b')][_0x82e8('0x5b')]({'where':{'id':_0x1c2c99['body']['UserId'],'role':'agent'},'attributes':['id','name',_0x82e8('0x7c'),_0x82e8('0x88'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2179af){if(!_0x2179af)return null;_0x56adff['message'][_0x82e8('0x69')]=_0x2179af;return _0x56adff;})[_0x82e8('0x25')](function(_0x12aece){if(_0x12aece){_0x12aece[_0x82e8('0x2d')]['interface']=util[_0x82e8('0x66')](_0x82e8('0x7d'),_0x1c2c99['user'][_0x82e8('0x3e')]);_0x12aece[_0x82e8('0x2d')][_0x82e8('0x7e')]=_0x56adff[_0x82e8('0x7e')];_0x12aece[_0x82e8('0x2d')][_0x82e8('0x7f')]=_0x56adff[_0x82e8('0x7e')];_0x12aece['message'][_0x82e8('0x80')]=_0x82e8('0x3a');respondWithRpcPromise(_0x82e8('0x81'),_0x82e8('0x81'),{'event':_0x82e8('0x89'),'message':_0x12aece[_0x82e8('0x2d')]},client9002);return _0x56adff;}return null;})['then'](respondWithResult(_0xc72e47,null))['catch'](handleError(_0xc72e47,null));}; \ No newline at end of file +var _0x090a=['keys','find','create','body','describe','openchannel-interactions','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','interface','SIP/%s','motionChannel','event','EventManager','acceptmessage','../../config/logger','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SELECT','contact','channel','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params'];(function(_0x3daab5,_0x4c82c0){var _0x5c9961=function(_0xd26f32){while(--_0xd26f32){_0x3daab5['push'](_0x3daab5['shift']());}};_0x5c9961(++_0x4c82c0);}(_0x090a,0x133));var _0xa090=function(_0x2cd684,_0x48d8ce){_0x2cd684=_0x2cd684-0x0;var _0x53ad6e=_0x090a[_0x2cd684];return _0x53ad6e;};'use strict';var emlformat=require(_0xa090('0x0'));var rimraf=require(_0xa090('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa090('0x2'));var rp=require(_0xa090('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa090('0x4'));var util=require('util');var path=require(_0xa090('0x5'));var sox=require(_0xa090('0x6'));var csv=require(_0xa090('0x7'));var ejs=require(_0xa090('0x8'));var fs=require('fs');var fs_extra=require(_0xa090('0x9'));var _=require(_0xa090('0xa'));var squel=require(_0xa090('0xb'));var crypto=require(_0xa090('0xc'));var jsforce=require(_0xa090('0xd'));var deskjs=require(_0xa090('0xe'));var toCsv=require(_0xa090('0x7'));var querystring=require(_0xa090('0xf'));var Papa=require(_0xa090('0x10'));var Redis=require(_0xa090('0x11'));var authService=require(_0xa090('0x12'));var qs=require(_0xa090('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa090('0x14'));var logger=require('../../config/logger')(_0xa090('0x15'));var utils=require(_0xa090('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa090('0x17'));var db=require(_0xa090('0x18'))['db'];config[_0xa090('0x19')]=_[_0xa090('0x1a')](config[_0xa090('0x19')],{'host':_0xa090('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa090('0x19')]));require(_0xa090('0x1c'))[_0xa090('0x1d')](socket);var jayson=require(_0xa090('0x1e'));var client=jayson[_0xa090('0x1f')][_0xa090('0x20')]({'port':0x232c});var client9002=jayson[_0xa090('0x1f')][_0xa090('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1a7314,_0x48c5b2,_0x4da1f3,_0x40b53f){return new BPromise(function(_0x1e95ea,_0x33955e){var _0xd3983=_0x40b53f||client;return _0xd3983['request'](_0x1a7314,_0x4da1f3)[_0xa090('0x21')](function(_0x133842){logger[_0xa090('0x22')](_0xa090('0x23'),_0x48c5b2,'request\x20sent');logger['debug'](_0xa090('0x24'),_0x48c5b2,_0xa090('0x25'),JSON[_0xa090('0x26')](_0x133842));if(_0x133842[_0xa090('0x27')]){if(_0x133842[_0xa090('0x27')]['code']===0x1f4){logger['error'](_0xa090('0x23'),_0x48c5b2,_0x133842['error']['message']);return _0x33955e(_0x133842[_0xa090('0x27')][_0xa090('0x28')]);}logger[_0xa090('0x27')](_0xa090('0x23'),_0x48c5b2,_0x133842[_0xa090('0x27')][_0xa090('0x28')]);return _0x1e95ea(_0x133842[_0xa090('0x27')][_0xa090('0x28')]);}else{logger[_0xa090('0x22')](_0xa090('0x23'),_0x48c5b2,_0xa090('0x25'));_0x1e95ea(_0x133842[_0xa090('0x29')][_0xa090('0x28')]);}})['catch'](function(_0x55a954){logger[_0xa090('0x27')](_0xa090('0x23'),_0x48c5b2,_0x55a954);_0x33955e(_0x55a954);});});}function respondWithStatusCode(_0x100db3,_0x3f8af2){_0x3f8af2=_0x3f8af2||0xcc;return function(_0x365f35){if(_0x365f35){return _0x100db3[_0xa090('0x2a')](_0x3f8af2);}return _0x100db3[_0xa090('0x2b')](_0x3f8af2)[_0xa090('0x2c')]();};}function respondWithResult(_0x112ebd,_0x91d866){_0x91d866=_0x91d866||0xc8;return function(_0x2c644c){if(_0x2c644c){return _0x112ebd[_0xa090('0x2b')](_0x91d866)[_0xa090('0x2d')](_0x2c644c);}};}function respondWithFilteredResult(_0x2f36da,_0x512f0d){return function(_0xae6cc1){if(_0xae6cc1){var _0x3e69f8=typeof _0x512f0d[_0xa090('0x2e')]===_0xa090('0x2f')&&typeof _0x512f0d[_0xa090('0x30')]===_0xa090('0x2f');var _0xb875dd=_0xae6cc1[_0xa090('0x31')];var _0x284640=_0x3e69f8?0x0:_0x512f0d[_0xa090('0x2e')];var _0x53201a=_0x3e69f8?_0xae6cc1['count']:_0x512f0d[_0xa090('0x2e')]+_0x512f0d[_0xa090('0x30')];var _0x2bfcd9;if(_0x53201a>=_0xb875dd){_0x53201a=_0xb875dd;_0x2bfcd9=0xc8;}else{_0x2bfcd9=0xce;}_0x2f36da[_0xa090('0x2b')](_0x2bfcd9);return _0x2f36da[_0xa090('0x32')](_0xa090('0x33'),_0x284640+'-'+_0x53201a+'/'+_0xb875dd)[_0xa090('0x2d')](_0xae6cc1);}return null;};}function patchUpdates(_0x24a782){return function(_0x359bf9){try{jsonpatch[_0xa090('0x34')](_0x359bf9,_0x24a782,!![]);}catch(_0x11f1a2){return BPromise[_0xa090('0x35')](_0x11f1a2);}return _0x359bf9[_0xa090('0x36')]();};}function saveUpdates(_0x541f74,_0x30cd71){return function(_0x5c163d){if(_0x5c163d){return _0x5c163d[_0xa090('0x37')](_0x541f74)[_0xa090('0x21')](function(_0x42836a){return _0x42836a;});}return null;};}function removeEntity(_0x50ed38,_0x12d495){return function(_0x59bc9b){if(_0x59bc9b){return _0x59bc9b[_0xa090('0x38')]()['then'](function(){_0x50ed38['status'](0xcc)[_0xa090('0x2c')]();});}};}function handleEntityNotFound(_0x41632c,_0x3bfae0){return function(_0x5ad490){if(!_0x5ad490){_0x41632c[_0xa090('0x2a')](0x194);}return _0x5ad490;};}function handleError(_0x4f836f,_0x341d14){_0x341d14=_0x341d14||0x1f4;return function(_0x1f9479){logger[_0xa090('0x27')](_0x1f9479[_0xa090('0x39')]);if(_0x1f9479[_0xa090('0x3a')]){delete _0x1f9479[_0xa090('0x3a')];}_0x4f836f[_0xa090('0x2b')](_0x341d14)[_0xa090('0x3b')](_0x1f9479);};}exports[_0xa090('0x3c')]=function(_0x221489,_0x30963c){var _0x3ed360={},_0x1a41a4={},_0x5f4885={'count':0x0,'rows':[]};var _0x20fe2d=_[_0xa090('0x3d')](db[_0xa090('0x3e')][_0xa090('0x3f')],function(_0x4cb5cc){return{'name':_0x4cb5cc['fieldName'],'type':_0x4cb5cc[_0xa090('0x40')][_0xa090('0x41')]};});_0x1a41a4['model']=_[_0xa090('0x3d')](_0x20fe2d,_0xa090('0x3a'));_0x1a41a4[_0xa090('0x42')]=_['keys'](_0x221489['query']);_0x1a41a4[_0xa090('0x43')]=_[_0xa090('0x44')](_0x1a41a4[_0xa090('0x45')],_0x1a41a4[_0xa090('0x42')]);_0x3ed360['attributes']=_[_0xa090('0x44')](_0x1a41a4[_0xa090('0x45')],qs['fields'](_0x221489[_0xa090('0x42')][_0xa090('0x46')]));_0x3ed360[_0xa090('0x47')]=_0x3ed360['attributes'][_0xa090('0x48')]?_0x3ed360[_0xa090('0x47')]:_0x1a41a4['model'];if(!_0x221489[_0xa090('0x42')][_0xa090('0x49')](_0xa090('0x4a'))){_0x3ed360[_0xa090('0x30')]=qs[_0xa090('0x30')](_0x221489[_0xa090('0x42')][_0xa090('0x30')]);_0x3ed360['offset']=qs['offset'](_0x221489[_0xa090('0x42')][_0xa090('0x2e')]);}_0x3ed360[_0xa090('0x4b')]=qs[_0xa090('0x4c')](_0x221489[_0xa090('0x42')]['sort']);_0x3ed360[_0xa090('0x4d')]=qs[_0xa090('0x43')](_[_0xa090('0x4e')](_0x221489['query'],_0x1a41a4[_0xa090('0x43')]),_0x20fe2d);if(_0x221489[_0xa090('0x42')][_0xa090('0x4f')]){_0x3ed360[_0xa090('0x4d')]=_[_0xa090('0x50')](_0x3ed360['where'],{'$or':_[_0xa090('0x3d')](_0x20fe2d,function(_0x18c0e1){if(_0x18c0e1[_0xa090('0x40')]!==_0xa090('0x51')){var _0x370b98={};_0x370b98[_0x18c0e1[_0xa090('0x3a')]]={'$like':'%'+_0x221489[_0xa090('0x42')][_0xa090('0x4f')]+'%'};return _0x370b98;}})});}_0x3ed360=_[_0xa090('0x50')]({},_0x3ed360,_0x221489['options']);var _0x452375={'where':_0x3ed360['where']};return db[_0xa090('0x3e')][_0xa090('0x31')](_0x452375)[_0xa090('0x21')](function(_0x4f9207){_0x5f4885[_0xa090('0x31')]=_0x4f9207;if(_0x221489[_0xa090('0x42')][_0xa090('0x52')]){_0x3ed360[_0xa090('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xa090('0x54')](_0x3ed360);})[_0xa090('0x21')](function(_0x313102){_0x5f4885[_0xa090('0x55')]=_0x313102;return _0x5f4885;})['then'](respondWithFilteredResult(_0x30963c,_0x3ed360))[_0xa090('0x56')](handleError(_0x30963c,null));};exports[_0xa090('0x57')]=function(_0x368b2c,_0x4cf6e7){var _0x94099c={'raw':!![],'where':{'id':_0x368b2c[_0xa090('0x58')]['id']}},_0x39d9e1={};_0x39d9e1[_0xa090('0x45')]=_[_0xa090('0x59')](db[_0xa090('0x3e')]['rawAttributes']);_0x39d9e1[_0xa090('0x42')]=_['keys'](_0x368b2c[_0xa090('0x42')]);_0x39d9e1['filters']=_['intersection'](_0x39d9e1[_0xa090('0x45')],_0x39d9e1[_0xa090('0x42')]);_0x94099c[_0xa090('0x47')]=_[_0xa090('0x44')](_0x39d9e1[_0xa090('0x45')],qs[_0xa090('0x46')](_0x368b2c[_0xa090('0x42')][_0xa090('0x46')]));_0x94099c[_0xa090('0x47')]=_0x94099c[_0xa090('0x47')][_0xa090('0x48')]?_0x94099c[_0xa090('0x47')]:_0x39d9e1[_0xa090('0x45')];if(_0x368b2c[_0xa090('0x42')][_0xa090('0x52')]){_0x94099c[_0xa090('0x53')]=[{'all':!![]}];}_0x94099c=_[_0xa090('0x50')]({},_0x94099c,_0x368b2c['options']);return db['OpenchannelMessage'][_0xa090('0x5a')](_0x94099c)[_0xa090('0x21')](handleEntityNotFound(_0x4cf6e7,null))['then'](respondWithResult(_0x4cf6e7,null))[_0xa090('0x56')](handleError(_0x4cf6e7,null));};exports['create']=function(_0x244b17,_0x3f4e72){return db[_0xa090('0x3e')][_0xa090('0x5b')](_0x244b17['body'],{})[_0xa090('0x21')](respondWithResult(_0x3f4e72,0xc9))[_0xa090('0x56')](handleError(_0x3f4e72,null));};exports[_0xa090('0x37')]=function(_0x50431e,_0x135614){if(_0x50431e[_0xa090('0x5c')]['id']){delete _0x50431e['body']['id'];}return db[_0xa090('0x3e')][_0xa090('0x5a')]({'where':{'id':_0x50431e[_0xa090('0x58')]['id']}})['then'](handleEntityNotFound(_0x135614,null))[_0xa090('0x21')](saveUpdates(_0x50431e['body'],null))[_0xa090('0x21')](respondWithResult(_0x135614,null))[_0xa090('0x56')](handleError(_0x135614,null));};exports[_0xa090('0x38')]=function(_0x1793fb,_0x5b38ce){return db[_0xa090('0x3e')]['find']({'where':{'id':_0x1793fb['params']['id']}})[_0xa090('0x21')](handleEntityNotFound(_0x5b38ce,null))[_0xa090('0x21')](removeEntity(_0x5b38ce,null))[_0xa090('0x56')](handleError(_0x5b38ce,null));};exports[_0xa090('0x5d')]=function(_0x4d531b,_0x467676){return db[_0xa090('0x3e')][_0xa090('0x5d')]()[_0xa090('0x21')](respondWithResult(_0x467676,null))[_0xa090('0x56')](handleError(_0x467676,null));};var interaction_log=require('../../config/logger')(_0xa090('0x5e'));exports[_0xa090('0x5f')]=function(_0x3a685d,_0x4b608c,_0x3a54ec){var _0x2b4681={'agent':{},'channel':'openchannel'};if(_0x3a685d['body']['id']){delete _0x3a685d[_0xa090('0x5c')]['id'];}_0x3a685d[_0xa090('0x5c')]['read']=!![];_0x3a685d[_0xa090('0x5c')][_0xa090('0x60')]=moment()['format'](_0xa090('0x61'));_0x3a685d['body'][_0xa090('0x62')]=_0x3a685d[_0xa090('0x5c')][_0xa090('0x62')]||_0x3a685d['user']['id'];_0x2b4681[_0xa090('0x63')]['id']=_0x3a685d['body'][_0xa090('0x62')];return db[_0xa090('0x3e')][_0xa090('0x5a')]({'where':{'id':_0x3a685d[_0xa090('0x58')]['id'],'UserId':null}})[_0xa090('0x21')](handleEntityNotFound(_0x4b608c,null))['then'](saveUpdates(_0x3a685d[_0xa090('0x5c')],null))[_0xa090('0x21')](function(_0x348c8c){if(_0x348c8c){_0x2b4681[_0xa090('0x28')]=_0x348c8c[_0xa090('0x64')]({'plain':!![]});return db[_0xa090('0x65')][_0xa090('0x5a')]({'where':{'id':_0x348c8c[_0xa090('0x66')]}});}return null;})[_0xa090('0x21')](handleEntityNotFound(_0x4b608c,null))[_0xa090('0x21')](function(_0x29bb82){if(_0x29bb82){return _0x29bb82['update']({'UserId':_0x3a685d['body'][_0xa090('0x62')],'read1stAt':_['isNil'](_0x29bb82[_0xa090('0x67')])?moment()[_0xa090('0x68')](_0xa090('0x61')):undefined});}return null;})[_0xa090('0x21')](function(_0x3a3bf5){if(_0x3a3bf5){_0x2b4681[_0xa090('0x69')]=_0x3a3bf5[_0xa090('0x64')]({'plain':!![]});interaction_log[_0xa090('0x22')](_0xa090('0x6a'),_0x3a685d['user']['id'],_0x3a685d[_0xa090('0x6b')][_0xa090('0x3a')],_0x3a685d['user'][_0xa090('0x6c')],_0x2b4681[_0xa090('0x69')]['id'],_0x3a685d[_0xa090('0x5c')]?JSON[_0xa090('0x26')](_0x3a685d[_0xa090('0x5c')]):_0xa090('0x6d'));return respondWithRpcPromise(_0xa090('0x6e'),'acceptMessage',_0x2b4681);}return null;})[_0xa090('0x21')](function(_0x2096fb){var _0xbdf79f=_0xa090('0x6f')+_0x2096fb[_0xa090('0x28')][_0xa090('0x70')];return db[_0xa090('0x71')]['query'](_0xbdf79f,{'type':db[_0xa090('0x72')][_0xa090('0x73')]['SELECT'],'raw':!![]})['then'](function(_0x5dd096){return _0x5dd096;});})['then'](function(_0x1442d1){if(_0x1442d1){_0x2b4681[_0xa090('0x28')]['contact']=_0x1442d1[0x0];if(!_0x3a685d['body']['UserId'])return;return db[_0xa090('0x74')][_0xa090('0x5a')]({'where':{'id':_0x3a685d[_0xa090('0x5c')][_0xa090('0x62')],'role':_0xa090('0x63')},'attributes':['id','name',_0xa090('0x75'),_0xa090('0x76'),_0xa090('0x77')],'raw':!![]});}return null;})['then'](function(_0x4adb4e){if(!_0x4adb4e)return null;_0x2b4681[_0xa090('0x28')]['agent']=_0x4adb4e;return _0x2b4681;})[_0xa090('0x21')](function(_0x260467){if(_0x260467){if(_0x3a685d['body']['manual']){_0x2b4681[_0xa090('0x28')][_0xa090('0x78')]=util['format'](_0xa090('0x79'),_0x3a685d['user'][_0xa090('0x3a')]);_0x2b4681[_0xa090('0x28')]['channel']=_0x2b4681['channel'];_0x2b4681[_0xa090('0x28')][_0xa090('0x7a')]=_0x2b4681['channel'];_0x2b4681['message'][_0xa090('0x7b')]=_0xa090('0x5f');return respondWithRpcPromise(_0xa090('0x7c'),_0xa090('0x7c'),{'event':_0xa090('0x7d'),'message':_0x2b4681[_0xa090('0x28')]},client9002)[_0xa090('0x21')](function(){return _0x2b4681;});}return _0x2b4681;}return null;})[_0xa090('0x21')](respondWithResult(_0x4b608c,null))[_0xa090('0x56')](handleError(_0x4b608c,null));};var interaction_log=require(_0xa090('0x7e'))('openchannel-interactions');exports[_0xa090('0x35')]=function(_0x1b9ef0,_0x12a046,_0x243b80){var _0x1b8ab={'agent':{},'channel':_0xa090('0x7f')};if(_0x1b9ef0[_0xa090('0x5c')]['id']){delete _0x1b9ef0[_0xa090('0x5c')]['id'];}_0x1b9ef0[_0xa090('0x5c')][_0xa090('0x62')]=_0x1b9ef0['body'][_0xa090('0x62')]||_0x1b9ef0['user']['id'];_0x1b8ab[_0xa090('0x63')]['id']=_0x1b9ef0['body']['UserId'];return db['OpenchannelMessage'][_0xa090('0x5a')]({'where':{'id':_0x1b9ef0[_0xa090('0x58')]['id'],'UserId':null}})[_0xa090('0x21')](handleEntityNotFound(_0x12a046,null))[_0xa090('0x21')](function(_0x68f8e5){if(_0x68f8e5){_0x1b8ab[_0xa090('0x28')]=_0x68f8e5[_0xa090('0x64')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x68f8e5[_0xa090('0x66')]}});}return null;})[_0xa090('0x21')](handleEntityNotFound(_0x12a046,null))[_0xa090('0x21')](function(_0x3817c7){if(_0x3817c7){_0x1b8ab[_0xa090('0x69')]=_0x3817c7[_0xa090('0x64')]({'plain':!![]});interaction_log['info'](_0xa090('0x80'),_0x1b9ef0[_0xa090('0x6b')]['id'],_0x1b9ef0['user'][_0xa090('0x3a')],_0x1b9ef0[_0xa090('0x6b')]['role'],_0x1b8ab[_0xa090('0x69')]['id'],_0x1b9ef0[_0xa090('0x5c')]?JSON[_0xa090('0x26')](_0x1b9ef0[_0xa090('0x5c')]):_0xa090('0x6d'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1b8ab);}return null;})[_0xa090('0x21')](function(_0x86b46c){var _0x2609b9=_0xa090('0x6f')+_0x86b46c['message'][_0xa090('0x70')];return db[_0xa090('0x71')][_0xa090('0x42')](_0x2609b9,{'type':db[_0xa090('0x72')]['QueryTypes'][_0xa090('0x81')],'raw':!![]})[_0xa090('0x21')](function(_0xbd80af){return _0xbd80af;});})['then'](function(_0x1f6834){if(_0x1f6834){_0x1b8ab['message'][_0xa090('0x82')]=_0x1f6834[0x0];if(!_0x1b9ef0[_0xa090('0x5c')]['UserId'])return;return db[_0xa090('0x74')]['find']({'where':{'id':_0x1b9ef0[_0xa090('0x5c')][_0xa090('0x62')],'role':_0xa090('0x63')},'attributes':['id',_0xa090('0x3a'),_0xa090('0x75'),_0xa090('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x5eac44){if(!_0x5eac44)return null;_0x1b8ab[_0xa090('0x28')][_0xa090('0x63')]=_0x5eac44;return _0x1b8ab;})['then'](function(_0x4894bf){if(_0x4894bf){_0x4894bf[_0xa090('0x28')]['interface']=util[_0xa090('0x68')](_0xa090('0x79'),_0x1b9ef0['user'][_0xa090('0x3a')]);_0x4894bf[_0xa090('0x28')][_0xa090('0x83')]=_0x1b8ab[_0xa090('0x83')];_0x4894bf['message'][_0xa090('0x7a')]=_0x1b8ab[_0xa090('0x83')];_0x4894bf[_0xa090('0x28')][_0xa090('0x7b')]=_0xa090('0x35');respondWithRpcPromise(_0xa090('0x7c'),'EventManager',{'event':'rejectmessage','message':_0x4894bf[_0xa090('0x28')]},client9002);return _0x1b8ab;}return null;})[_0xa090('0x21')](respondWithResult(_0x12a046,null))['catch'](handleError(_0x12a046,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 38c7031..de7b676 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 _0x62b1=['remove','emit','hasOwnProperty','OpenchannelMessage','save','update'];(function(_0x3236f7,_0x2646e8){var _0x3a544f=function(_0x177942){while(--_0x177942){_0x3236f7['push'](_0x3236f7['shift']());}};_0x3a544f(++_0x2646e8);}(_0x62b1,0x1e3));var _0x162b=function(_0x28f32f,_0x22c627){_0x28f32f=_0x28f32f-0x0;var _0x416f4b=_0x62b1[_0x28f32f];return _0x416f4b;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0x162b('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x162b('0x1'),'afterUpdate':_0x162b('0x2'),'afterDestroy':_0x162b('0x3')};function emitEvent(_0x3b5a82){return function(_0x42725c,_0x5eea07,_0x58f922){OpenchannelMessageEvents[_0x162b('0x4')](_0x3b5a82+':'+_0x42725c['id'],_0x42725c);OpenchannelMessageEvents[_0x162b('0x4')](_0x3b5a82,_0x42725c);_0x58f922(null);};}for(var e in events){if(events[_0x162b('0x5')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x032b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xcec917,_0x5e17d2){var _0x349b7a=function(_0x1b50e2){while(--_0x1b50e2){_0xcec917['push'](_0xcec917['shift']());}};_0x349b7a(++_0x5e17d2);}(_0x032b,0x14c));var _0xb032=function(_0x19cf1f,_0x4105e3){_0x19cf1f=_0x19cf1f-0x0;var _0x234028=_0x032b[_0x19cf1f];return _0x234028;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xb032('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb032('0x1')](0x0);var events={'afterCreate':_0xb032('0x2'),'afterUpdate':_0xb032('0x3'),'afterDestroy':_0xb032('0x4')};function emitEvent(_0x3b6d84){return function(_0x1bcc68,_0x57bf78,_0x3dceb5){OpenchannelMessageEvents[_0xb032('0x5')](_0x3b6d84+':'+_0x1bcc68['id'],_0x1bcc68);OpenchannelMessageEvents[_0xb032('0x5')](_0x3b6d84,_0x1bcc68);_0x3dceb5(null);};}for(var e in events){if(events[_0xb032('0x6')](e)){var event=events[e];OpenchannelMessage[_0xb032('0x7')](e,emitEvent(event));}}module[_0xb032('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 b06caed..9bc4ca5 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 _0x93de=['Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interactions','Interaction','omit','method','POST','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','OpenchannelInteraction','findOne','then','createdAt','catch','error','CmContact','OpenchannelInteractionId'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0x93de,0xf4));var _0xe93d=function(_0xb7e087,_0x449a56){_0xb7e087=_0xb7e087-0x0;var _0xed959=_0x93de[_0xb7e087];return _0xed959;};'use strict';var _=require(_0xe93d('0x0'));var util=require('util');var logger=require(_0xe93d('0x1'))('api');var moment=require(_0xe93d('0x2'));var BPromise=require('bluebird');var rp=require(_0xe93d('0x3'));var fs=require('fs');var path=require(_0xe93d('0x4'));var rimraf=require(_0xe93d('0x5'));var config=require(_0xe93d('0x6'));var attributes=require(_0xe93d('0x7'));module['exports']=function(_0x2eb8f2,_0x4de58b){return _0x2eb8f2['define'](_0xe93d('0x8'),attributes,{'tableName':_0xe93d('0x9'),'paranoid':![],'indexes':[{'name':_0xe93d('0xa'),'fields':[_0xe93d('0xb')],'type':_0xe93d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a70df,_0x34aae3,_0x6add7f){var _0x4f8784=_0x2eb8f2['models'];var _0x48aeb1=_0x4a70df[_0xe93d('0xd')]({'plain':!![]});if(_0x48aeb1[_0xe93d('0xe')][_0xe93d('0xf')]()==='in'||_0x48aeb1[_0xe93d('0xe')]['toLowerCase']()===_0xe93d('0x10')&&!_0x48aeb1[_0xe93d('0x11')]&&!_['isNil'](_0x48aeb1['UserId'])){_0x4f8784[_0xe93d('0x12')][_0xe93d('0x13')]({'where':{'id':_0x48aeb1['OpenchannelInteractionId']}})[_0xe93d('0x14')](function(_0x37407f){if(_0x37407f){_0x37407f['update']({'lastMsgAt':_0x48aeb1[_0xe93d('0x15')],'lastMsgDirection':_0x48aeb1[_0xe93d('0xe')][_0xe93d('0xf')]()});}})[_0xe93d('0x16')](function(_0x455074){console[_0xe93d('0x17')](_0x455074);});}if(_0x48aeb1[_0xe93d('0xe')]===_0xe93d('0x10')&&!_0x48aeb1[_0xe93d('0x11')]){var _0x39a199;_0x4f8784[_0xe93d('0x18')]['describe']()[_0xe93d('0x14')](function(_0x3b2e03){return _0x4f8784['OpenchannelAccount']['find']({'where':{'id':_0x48aeb1['OpenchannelAccountId']},'include':[{'model':_0x4f8784[_0xe93d('0x12')],'as':'Interactions','where':{'id':_0x48aeb1[_0xe93d('0x19')]},'limit':0x1,'include':[{'model':_0x4f8784[_0xe93d('0x18')],'as':_0xe93d('0x1a'),'attributes':_[_0xe93d('0x1b')](_0x3b2e03)}]}]});})['then'](function(_0x403768){_0x39a199=_0x403768[_0xe93d('0xd')]({'plain':!![]});if(_0x39a199&&_0x39a199['replyUri']){logger[_0xe93d('0x1c')](_0xe93d('0x1d'),_0xe93d('0x1e'),util[_0xe93d('0x1f')](_0xe93d('0x20'),_0x48aeb1['id'],_0x39a199[_0xe93d('0x21')]));if(_0x39a199[_0xe93d('0x22')]&&_0x39a199[_0xe93d('0x22')]['length']){_0x48aeb1[_0xe93d('0x23')]=_[_0xe93d('0x24')](_0x39a199[_0xe93d('0x22')][0x0],_0xe93d('0x1a'));_0x48aeb1['Contact']=_0x39a199[_0xe93d('0x22')][0x0][_0xe93d('0x1a')];}var _0x34aae3={'method':'POST','uri':encodeURI(_0x39a199['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x34aae3[_0xe93d('0x25')]){case'GET':_0x34aae3['qs']=_0x48aeb1;break;case _0xe93d('0x26'):_0x34aae3[_0xe93d('0xb')]=_0x48aeb1;break;}return rp(_0x34aae3)['then'](function(_0x5a47eb){logger[_0xe93d('0x1c')](_0xe93d('0x1d'),_0xe93d('0x1e'),util[_0xe93d('0x1f')](_0xe93d('0x27'),_0x48aeb1['id'],_0x39a199[_0xe93d('0x21')]));if(_0x5a47eb[_0xe93d('0xb')][_0xe93d('0x28')]&&_0x5a47eb['body'][_0xe93d('0x28')]!=_0x48aeb1[_0xe93d('0x23')]['threadId']){return _0x4f8784[_0xe93d('0x12')][_0xe93d('0x29')]({'threadId':_0x5a47eb[_0xe93d('0xb')][_0xe93d('0x28')]},{'where':{'id':_0x48aeb1[_0xe93d('0x23')]['id']}});}else{return;}})[_0xe93d('0x14')](function(){return _0x4a70df[_0xe93d('0x29')]({'read':!![]});})[_0xe93d('0x16')](function(_0x6f18b1){logger[_0xe93d('0x17')](_0xe93d('0x1d'),_0xe93d('0x1e'),util[_0xe93d('0x2a')](_0x6f18b1,{'showHidden':![],'depth':null}));_0x6add7f();});}else{_0x6add7f();}})[_0xe93d('0x2b')](function(){_0x6add7f();});}else{_0x6add7f();}}},'charset':'utf8mb4','collate':_0xe93d('0x2c')});}; \ No newline at end of file +var _0xa120=['OpenchannelInteractionId','then','update','createdAt','error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method','GET','threadId','Interaction','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','moment','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction'];(function(_0x26924d,_0x3f8894){var _0x4a776b=function(_0xbd6222){while(--_0xbd6222){_0x26924d['push'](_0x26924d['shift']());}};_0x4a776b(++_0x3f8894);}(_0xa120,0x1e8));var _0x0a12=function(_0x3cf298,_0x102d9c){_0x3cf298=_0x3cf298-0x0;var _0x4cc6e7=_0xa120[_0x3cf298];return _0x4cc6e7;};'use strict';var _=require(_0x0a12('0x0'));var util=require(_0x0a12('0x1'));var logger=require(_0x0a12('0x2'))(_0x0a12('0x3'));var moment=require(_0x0a12('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a12('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0a12('0x6'));module[_0x0a12('0x7')]=function(_0x344c89,_0x81d51f){return _0x344c89[_0x0a12('0x8')](_0x0a12('0x9'),attributes,{'tableName':_0x0a12('0xa'),'paranoid':![],'indexes':[{'name':_0x0a12('0xb'),'fields':[_0x0a12('0xc')],'type':_0x0a12('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ebee1,_0x38c315,_0x2b7f96){var _0x208218=_0x344c89[_0x0a12('0xe')];var _0x4e88ef=_0x5ebee1['get']({'plain':!![]});if(_0x4e88ef[_0x0a12('0xf')][_0x0a12('0x10')]()==='in'||_0x4e88ef[_0x0a12('0xf')]['toLowerCase']()===_0x0a12('0x11')&&!_0x4e88ef[_0x0a12('0x12')]&&!_[_0x0a12('0x13')](_0x4e88ef[_0x0a12('0x14')])){_0x208218[_0x0a12('0x15')]['findOne']({'where':{'id':_0x4e88ef[_0x0a12('0x16')]}})[_0x0a12('0x17')](function(_0x30354f){if(_0x30354f){_0x30354f[_0x0a12('0x18')]({'lastMsgAt':_0x4e88ef[_0x0a12('0x19')],'lastMsgDirection':_0x4e88ef[_0x0a12('0xf')][_0x0a12('0x10')]()});}})['catch'](function(_0x5aa00a){console[_0x0a12('0x1a')](_0x5aa00a);});}if(_0x4e88ef[_0x0a12('0xf')]==='out'&&!_0x4e88ef[_0x0a12('0x12')]){var _0x537178;_0x208218['CmContact'][_0x0a12('0x1b')]()['then'](function(_0x269890){return _0x208218[_0x0a12('0x1c')][_0x0a12('0x1d')]({'where':{'id':_0x4e88ef[_0x0a12('0x1e')]},'include':[{'model':_0x208218[_0x0a12('0x15')],'as':_0x0a12('0x1f'),'where':{'id':_0x4e88ef[_0x0a12('0x16')]},'limit':0x1,'include':[{'model':_0x208218['CmContact'],'as':_0x0a12('0x20'),'attributes':_[_0x0a12('0x21')](_0x269890)}]}]});})[_0x0a12('0x17')](function(_0x3d4967){_0x537178=_0x3d4967[_0x0a12('0x22')]({'plain':!![]});if(_0x537178&&_0x537178[_0x0a12('0x23')]){logger[_0x0a12('0x24')](_0x0a12('0x25'),_0x0a12('0x26'),util[_0x0a12('0x27')](_0x0a12('0x28'),_0x4e88ef['id'],_0x537178['replyUri']));if(_0x537178[_0x0a12('0x1f')]&&_0x537178[_0x0a12('0x1f')][_0x0a12('0x29')]){_0x4e88ef['Interaction']=_[_0x0a12('0x2a')](_0x537178[_0x0a12('0x1f')][0x0],_0x0a12('0x20'));_0x4e88ef[_0x0a12('0x20')]=_0x537178[_0x0a12('0x1f')][0x0][_0x0a12('0x20')];}var _0x38c315={'method':_0x0a12('0x2b'),'uri':encodeURI(_0x537178[_0x0a12('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x38c315[_0x0a12('0x2c')]){case _0x0a12('0x2d'):_0x38c315['qs']=_0x4e88ef;break;case _0x0a12('0x2b'):_0x38c315[_0x0a12('0xc')]=_0x4e88ef;break;}return rp(_0x38c315)['then'](function(_0x5d78e9){logger[_0x0a12('0x24')](_0x0a12('0x25'),_0x0a12('0x26'),util[_0x0a12('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x4e88ef['id'],_0x537178[_0x0a12('0x23')]));if(_0x5d78e9[_0x0a12('0xc')][_0x0a12('0x2e')]&&_0x5d78e9[_0x0a12('0xc')][_0x0a12('0x2e')]!=_0x4e88ef[_0x0a12('0x2f')][_0x0a12('0x2e')]){return _0x208218[_0x0a12('0x15')][_0x0a12('0x18')]({'threadId':_0x5d78e9[_0x0a12('0xc')][_0x0a12('0x2e')]},{'where':{'id':_0x4e88ef[_0x0a12('0x2f')]['id']}});}else{return;}})[_0x0a12('0x17')](function(){return _0x5ebee1['update']({'read':!![]});})['catch'](function(_0x321244){logger[_0x0a12('0x1a')](_0x0a12('0x25'),_0x0a12('0x26'),util[_0x0a12('0x30')](_0x321244,{'showHidden':![],'depth':null}));_0x2b7f96();});}else{_0x2b7f96();}})[_0x0a12('0x31')](function(){_0x2b7f96();});}else{_0x2b7f96();}}},'charset':_0x0a12('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 9747966..79e6e63 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x16f790,_0x2f6d8c){var _0x503510=function(_0x342f16){while(--_0x342f16){_0x16f790['push'](_0x16f790['shift']());}};_0x503510(++_0x2f6d8c);}(_0x2ef3,0xba));var _0x32ef=function(_0x12f5a1,_0xa8818){_0x12f5a1=_0x12f5a1-0x0;var _0x513a85=_0x2ef3[_0x12f5a1];return _0x513a85;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0xdb28=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request'];(function(_0x536380,_0x3f79d5){var _0xd2229d=function(_0x1daa83){while(--_0x1daa83){_0x536380['push'](_0x536380['shift']());}};_0xd2229d(++_0x3f79d5);}(_0xdb28,0x106));var _0x8db2=function(_0x8ba8c5,_0x4d842e){_0x8ba8c5=_0x8ba8c5-0x0;var _0x183f41=_0xdb28[_0x8ba8c5];return _0x183f41;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8db2('0xb')](config[_0x8db2('0xc')],{'host':_0x8db2('0xd'),'port':0x18eb});var socket=require(_0x8db2('0xe'))(new Redis(config[_0x8db2('0xc')]));require(_0x8db2('0xf'))[_0x8db2('0x10')](socket);function respondWithRpcPromise(_0x4ba340,_0x30dc90,_0x476216){return new BPromise(function(_0x1f62af,_0x57015f){return client[_0x8db2('0x11')](_0x4ba340,_0x476216)[_0x8db2('0x12')](function(_0x576475){logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));logger[_0x8db2('0x16')](_0x8db2('0x17'),_0x30dc90,'request\x20sent',JSON['stringify'](_0x576475));if(_0x576475[_0x8db2('0x18')]){if(_0x576475[_0x8db2('0x18')][_0x8db2('0x19')]===0x1f4){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x57015f(_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);}logger[_0x8db2('0x18')]('OpenchannelMessage,\x20%s,\x20%s',_0x30dc90,_0x576475[_0x8db2('0x18')][_0x8db2('0x1a')]);return _0x1f62af(_0x576475['error'][_0x8db2('0x1a')]);}else{logger[_0x8db2('0x13')](_0x8db2('0x14'),_0x30dc90,_0x8db2('0x15'));_0x1f62af(_0x576475[_0x8db2('0x1b')][_0x8db2('0x1a')]);}})['catch'](function(_0x5df464){logger[_0x8db2('0x18')](_0x8db2('0x14'),_0x30dc90,_0x5df464);_0x57015f(_0x5df464);});});}exports[_0x8db2('0x1c')]=function(_0x1b64e4){var _0x58562e=this;return new Promise(function(_0x431d60,_0x36a9ff){return db[_0x8db2('0x1d')][_0x8db2('0x1e')](_0x1b64e4[_0x8db2('0x1f')],{'raw':_0x1b64e4['options']?_0x1b64e4[_0x8db2('0x20')][_0x8db2('0x21')]===undefined?!![]:![]:!![]})[_0x8db2('0x12')](function(_0x125be2){logger[_0x8db2('0x13')](_0x8db2('0x1c'),_0x1b64e4);logger[_0x8db2('0x16')]('CreateOpenchannelMessage',_0x1b64e4,JSON[_0x8db2('0x22')](_0x125be2));_0x431d60(_0x125be2);})['catch'](function(_0x5725f0){logger['error']('CreateOpenchannelMessage',_0x5725f0[_0x8db2('0x1a')],_0x1b64e4);_0x36a9ff(_0x58562e[_0x8db2('0x18')](0x1f4,_0x5725f0[_0x8db2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 1051329..736ce9d 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 _0x416d=['update','emit','removeListener','register','length','./openchannelMessage.events','save'];(function(_0x34584b,_0x36741a){var _0x18cca0=function(_0x3b79e9){while(--_0x3b79e9){_0x34584b['push'](_0x34584b['shift']());}};_0x18cca0(++_0x36741a);}(_0x416d,0x1b7));var _0xd416=function(_0x557404,_0x1f162){_0x557404=_0x557404-0x0;var _0x2fdec8=_0x416d[_0x557404];return _0x2fdec8;};'use strict';var OpenchannelMessageEvents=require(_0xd416('0x0'));var events=[_0xd416('0x1'),'remove',_0xd416('0x2')];function createListener(_0x327e00,_0x14f397){return function(_0x2cd039){_0x14f397[_0xd416('0x3')](_0x327e00,_0x2cd039);};}function removeListener(_0x39eff2,_0x3983c9){return function(){OpenchannelMessageEvents[_0xd416('0x4')](_0x39eff2,_0x3983c9);};}exports[_0xd416('0x5')]=function(_0x21dce9){for(var _0x4d8bd7=0x0,_0x49801a=events[_0xd416('0x6')];_0x4d8bd7<_0x49801a;_0x4d8bd7++){var _0x1b960e=events[_0x4d8bd7];var _0x387fb7=createListener('openchannelMessage:'+_0x1b960e,_0x21dce9);OpenchannelMessageEvents['on'](_0x1b960e,_0x387fb7);}}; \ No newline at end of file +var _0x4f80=['save','remove','emit','register','openchannelMessage:','./openchannelMessage.events'];(function(_0x3cd451,_0x26e81a){var _0x571ce6=function(_0x27af9e){while(--_0x27af9e){_0x3cd451['push'](_0x3cd451['shift']());}};_0x571ce6(++_0x26e81a);}(_0x4f80,0xcb));var _0x04f8=function(_0x3df3c6,_0x496e1a){_0x3df3c6=_0x3df3c6-0x0;var _0x254c43=_0x4f80[_0x3df3c6];return _0x254c43;};'use strict';var OpenchannelMessageEvents=require(_0x04f8('0x0'));var events=[_0x04f8('0x1'),_0x04f8('0x2'),'update'];function createListener(_0x3e61d0,_0xaccb55){return function(_0x252ef1){_0xaccb55[_0x04f8('0x3')](_0x3e61d0,_0x252ef1);};}function removeListener(_0x3a4eab,_0x37dd7c){return function(){OpenchannelMessageEvents['removeListener'](_0x3a4eab,_0x37dd7c);};}exports[_0x04f8('0x4')]=function(_0x520bd8){for(var _0x56b3ad=0x0,_0x255cd0=events['length'];_0x56b3ad<_0x255cd0;_0x56b3ad++){var _0x201be1=events[_0x56b3ad];var _0x3a77d6=createListener(_0x04f8('0x5')+_0x201be1,_0x520bd8);OpenchannelMessageEvents['on'](_0x201be1,_0x3a77d6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 21371fc..a57f9f6 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 _0xc21e=['connect-timeout','express','Router','../../components/auth/service','./openchannelQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/users','getAgents','post','create','/:id/teams','addTeams','update','delete','destroy','exports','util','path'];(function(_0x43b6e7,_0x2df8d3){var _0x211643=function(_0x40a3e1){while(--_0x40a3e1){_0x43b6e7['push'](_0x43b6e7['shift']());}};_0x211643(++_0x2df8d3);}(_0xc21e,0x12a));var _0xec21=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc21e[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0xec21('0x0'));var path=require(_0xec21('0x1'));var timeout=require(_0xec21('0x2'));var express=require(_0xec21('0x3'));var router=express[_0xec21('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xec21('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xec21('0x6'));router[_0xec21('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xec21('0x7')](_0xec21('0x8'),auth[_0xec21('0x9')](),controller[_0xec21('0xa')]);router[_0xec21('0x7')](_0xec21('0xb'),auth['isAuthenticated'](),controller[_0xec21('0xc')]);router['get'](_0xec21('0xd'),auth[_0xec21('0x9')](),controller[_0xec21('0xe')]);router[_0xec21('0x7')]('/:id/teams',auth[_0xec21('0x9')](),controller['getTeams']);router[_0xec21('0x7')](_0xec21('0xf'),auth[_0xec21('0x9')](),controller[_0xec21('0x10')]);router[_0xec21('0x11')]('/',auth[_0xec21('0x9')](),controller[_0xec21('0x12')]);router[_0xec21('0x11')](_0xec21('0x13'),auth[_0xec21('0x9')](),controller[_0xec21('0x14')]);router[_0xec21('0x11')]('/:id/users',auth[_0xec21('0x9')](),controller['addAgents']);router['put'](_0xec21('0xb'),auth[_0xec21('0x9')](),controller[_0xec21('0x15')]);router[_0xec21('0x16')]('/:id',auth[_0xec21('0x9')](),controller[_0xec21('0x17')]);router[_0xec21('0x16')](_0xec21('0x13'),auth[_0xec21('0x9')](),controller['removeTeams']);router[_0xec21('0x16')](_0xec21('0xf'),auth[_0xec21('0x9')](),controller['removeAgents']);module[_0xec21('0x18')]=router; \ No newline at end of file +var _0x06e5=['isAuthenticated','index','get','/describe','/:id','show','/:id/teams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./openchannelQueue.controller'];(function(_0x220d2a,_0x5334f4){var _0x28aa6b=function(_0x48f3d0){while(--_0x48f3d0){_0x220d2a['push'](_0x220d2a['shift']());}};_0x28aa6b(++_0x5334f4);}(_0x06e5,0xc8));var _0x506e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06e5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x506e('0x0'));var util=require(_0x506e('0x1'));var path=require(_0x506e('0x2'));var timeout=require('connect-timeout');var express=require(_0x506e('0x3'));var router=express[_0x506e('0x4')]();var fs_extra=require(_0x506e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x506e('0x6'));var controller=require(_0x506e('0x7'));router['get']('/',auth[_0x506e('0x8')](),controller[_0x506e('0x9')]);router[_0x506e('0xa')](_0x506e('0xb'),auth[_0x506e('0x8')](),controller['describe']);router['get'](_0x506e('0xc'),auth[_0x506e('0x8')](),controller[_0x506e('0xd')]);router['get']('/:id/members',auth[_0x506e('0x8')](),controller['getMembers']);router[_0x506e('0xa')](_0x506e('0xe'),auth[_0x506e('0x8')](),controller['getTeams']);router[_0x506e('0xa')](_0x506e('0xf'),auth[_0x506e('0x8')](),controller['getAgents']);router[_0x506e('0x10')]('/',auth[_0x506e('0x8')](),controller[_0x506e('0x11')]);router[_0x506e('0x10')](_0x506e('0xe'),auth[_0x506e('0x8')](),controller[_0x506e('0x12')]);router[_0x506e('0x10')](_0x506e('0xf'),auth[_0x506e('0x8')](),controller[_0x506e('0x13')]);router[_0x506e('0x14')](_0x506e('0xc'),auth[_0x506e('0x8')](),controller[_0x506e('0x15')]);router[_0x506e('0x16')](_0x506e('0xc'),auth['isAuthenticated'](),controller[_0x506e('0x17')]);router[_0x506e('0x16')](_0x506e('0xe'),auth[_0x506e('0x8')](),controller['removeTeams']);router[_0x506e('0x16')](_0x506e('0xf'),auth[_0x506e('0x8')](),controller[_0x506e('0x18')]);module[_0x506e('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 93d9d36..c406d81 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 _0x012a=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x5c5ee5,_0x39b9f9){var _0x2e1754=function(_0x1c4c05){while(--_0x1c4c05){_0x5c5ee5['push'](_0x5c5ee5['shift']());}};_0x2e1754(++_0x39b9f9);}(_0x012a,0x154));var _0xa012=function(_0x10a65d,_0x5f2230){_0x10a65d=_0x10a65d-0x0;var _0x30552a=_0x012a[_0x10a65d];return _0x30552a;};'use strict';var Sequelize=require(_0xa012('0x0'));module[_0xa012('0x1')]={'name':{'type':Sequelize[_0xa012('0x2')],'unique':_0xa012('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa012('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa012('0x4')](_0xa012('0x5'),_0xa012('0x6'),_0xa012('0x7'))}}; \ No newline at end of file +var _0xde2c=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0xbecbda,_0x28d171){var _0x531d89=function(_0x43153b){while(--_0x43153b){_0xbecbda['push'](_0xbecbda['shift']());}};_0x531d89(++_0x28d171);}(_0xde2c,0x184));var _0xcde2=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0xde2c[_0x189305];return _0xea3406;};'use strict';var Sequelize=require(_0xcde2('0x0'));module[_0xcde2('0x1')]={'name':{'type':Sequelize[_0xcde2('0x2')],'unique':_0xcde2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcde2('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcde2('0x4')](_0xcde2('0x5'),_0xcde2('0x6'),_0xcde2('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 4643520..2140d15 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 _0xb348=['from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','pick','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','then','destroy','OpenchannelQueues','error','name','send','index','map','OpenchannelQueue','fieldName','type','key','where','query','findAll','rows','show','params','model','rawAttributes','keys','filters','intersection','attributes','fields','include','merge','options','find','catch','create','body','user','role','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','length','hasOwnProperty','nolimit','order','sort','OpenchannelQueueId','filter','User','UserId','agent','updatedAt','%s/%s','openchannelPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','UserOpenchannelQueue','findOrCreate','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId'];(function(_0x254a19,_0x7b092b){var _0xba020a=function(_0x231bb3){while(--_0x231bb3){_0x254a19['push'](_0x254a19['shift']());}};_0xba020a(++_0x7b092b);}(_0xb348,0x1f1));var _0x8b34=function(_0x56954f,_0x2232e1){_0x56954f=_0x56954f-0x0;var _0x3173f0=_0xb348[_0x56954f];return _0x3173f0;};'use strict';var BPromise=require(_0x8b34('0x0'));var util=require(_0x8b34('0x1'));var _=require(_0x8b34('0x2'));var squel=require(_0x8b34('0x3'));var Redis=require(_0x8b34('0x4'));var qs=require(_0x8b34('0x5'));var logger=require(_0x8b34('0x6'))(_0x8b34('0x7'));var config=require(_0x8b34('0x8'));var db=require('../../mysqldb')['db'];config[_0x8b34('0x9')]=_['defaults'](config[_0x8b34('0x9')],{'host':_0x8b34('0xa'),'port':0x18eb});var socket=require(_0x8b34('0xb'))(new Redis(config[_0x8b34('0x9')]));require(_0x8b34('0xc'))[_0x8b34('0xd')](socket);function respondWithStatusCode(_0x512157,_0x24d259){_0x24d259=_0x24d259||0xcc;return function(_0x32a04b){if(_0x32a04b){return _0x512157[_0x8b34('0xe')](_0x24d259);}return _0x512157[_0x8b34('0xf')](_0x24d259)[_0x8b34('0x10')]();};}function respondWithResult(_0x59a5bc,_0x3205fd){_0x3205fd=_0x3205fd||0xc8;return function(_0x2e53b1){if(_0x2e53b1){return _0x59a5bc['status'](_0x3205fd)['json'](_0x2e53b1);}};}function respondWithFilteredResult(_0x2e3ee8,_0x47596a){return function(_0x59ad69){if(_0x59ad69){var _0x58eee6=typeof _0x47596a[_0x8b34('0x11')]===_0x8b34('0x12')&&typeof _0x47596a[_0x8b34('0x13')]===_0x8b34('0x12');var _0x23f4f8=_0x59ad69[_0x8b34('0x14')];var _0x459781=_0x58eee6?0x0:_0x47596a['offset'];var _0x1340ca=_0x58eee6?_0x59ad69[_0x8b34('0x14')]:_0x47596a['offset']+_0x47596a[_0x8b34('0x13')];var _0x48ee99;if(_0x1340ca>=_0x23f4f8){_0x1340ca=_0x23f4f8;_0x48ee99=0xc8;}else{_0x48ee99=0xce;}_0x2e3ee8['status'](_0x48ee99);return _0x2e3ee8[_0x8b34('0x15')](_0x8b34('0x16'),_0x459781+'-'+_0x1340ca+'/'+_0x23f4f8)[_0x8b34('0x17')](_0x59ad69);}return null;};}function saveUpdates(_0x2800b5){return function(_0x78a310){if(_0x78a310){return _0x78a310['update'](_0x2800b5)[_0x8b34('0x18')](function(_0x9e0107){return _0x9e0107;});}return null;};}function removeEntity(_0x3672cd){return function(_0xae2bce){if(_0xae2bce){return _0xae2bce[_0x8b34('0x19')]()[_0x8b34('0x18')](function(){var _0x10680a=_0xae2bce['get']({'plain':!![]});var _0x2e1785=_0x8b34('0x1a');return db['UserProfileResource'][_0x8b34('0x19')]({'where':{'type':_0x2e1785,'resourceId':_0x10680a['id']}})[_0x8b34('0x18')](function(){return _0xae2bce;});})['then'](function(){_0x3672cd[_0x8b34('0xf')](0xcc)[_0x8b34('0x10')]();});}};}function handleEntityNotFound(_0x62e23d){return function(_0xab968b){if(!_0xab968b){_0x62e23d[_0x8b34('0xe')](0x194);}return _0xab968b;};}function handleError(_0x321a28,_0x43e96a){_0x43e96a=_0x43e96a||0x1f4;return function(_0xec13d1){logger[_0x8b34('0x1b')](_0xec13d1['stack']);if(_0xec13d1[_0x8b34('0x1c')]){delete _0xec13d1[_0x8b34('0x1c')];}_0x321a28[_0x8b34('0xf')](_0x43e96a)[_0x8b34('0x1d')](_0xec13d1);};}exports[_0x8b34('0x1e')]=function(_0x21d92a,_0x5896ae){var _0x866253={};var _0x9ddc17={'count':0x0,'rows':[]};var _0x3ac8c0=_[_0x8b34('0x1f')](db[_0x8b34('0x20')]['rawAttributes'],function(_0x41226e){return{'name':_0x41226e[_0x8b34('0x21')],'type':_0x41226e[_0x8b34('0x22')][_0x8b34('0x23')]};});_0x866253=qs['getOptions'](_0x3ac8c0,_0x21d92a);var _0x50e464={'where':_0x866253[_0x8b34('0x24')]};return db[_0x8b34('0x20')]['count'](_0x50e464)[_0x8b34('0x18')](function(_0x496a8b){_0x9ddc17[_0x8b34('0x14')]=_0x496a8b;_0x866253['include']=qs['include'](_0x21d92a[_0x8b34('0x25')]);return db[_0x8b34('0x20')][_0x8b34('0x26')](_0x866253);})[_0x8b34('0x18')](function(_0x2c2372){_0x9ddc17[_0x8b34('0x27')]=_0x2c2372;return _0x9ddc17;})[_0x8b34('0x18')](respondWithFilteredResult(_0x5896ae,_0x866253))['catch'](handleError(_0x5896ae,null));};exports[_0x8b34('0x28')]=function(_0x478522,_0x49a4ac){var _0x25e277={'raw':!![],'where':{'id':_0x478522[_0x8b34('0x29')]['id']}},_0x32422f={};_0x32422f[_0x8b34('0x2a')]=_['keys'](db[_0x8b34('0x20')][_0x8b34('0x2b')]);_0x32422f['query']=_[_0x8b34('0x2c')](_0x478522[_0x8b34('0x25')]);_0x32422f[_0x8b34('0x2d')]=_[_0x8b34('0x2e')](_0x32422f['model'],_0x32422f['query']);_0x25e277[_0x8b34('0x2f')]=_[_0x8b34('0x2e')](_0x32422f[_0x8b34('0x2a')],qs[_0x8b34('0x30')](_0x478522['query'][_0x8b34('0x30')]));_0x25e277['attributes']=_0x25e277[_0x8b34('0x2f')]['length']?_0x25e277[_0x8b34('0x2f')]:_0x32422f[_0x8b34('0x2a')];if(_0x478522['query']['includeAll']){_0x25e277[_0x8b34('0x31')]=[{'all':!![]}];}_0x25e277=_[_0x8b34('0x32')]({},_0x25e277,_0x478522[_0x8b34('0x33')]);return db['OpenchannelQueue'][_0x8b34('0x34')](_0x25e277)['then'](handleEntityNotFound(_0x49a4ac,null))[_0x8b34('0x18')](respondWithResult(_0x49a4ac,null))[_0x8b34('0x35')](handleError(_0x49a4ac,null));};exports[_0x8b34('0x36')]=function(_0x180ef9,_0x425816){return db[_0x8b34('0x20')]['create'](_0x180ef9[_0x8b34('0x37')],{})['then'](function(_0x581e94){var _0x5c287c=_0x180ef9[_0x8b34('0x38')]['get']({'plain':!![]});if(!_0x5c287c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c287c[_0x8b34('0x39')]===_0x8b34('0x38')){var _0x3eafbb=_0x581e94[_0x8b34('0x3a')]({'plain':!![]});var _0x1e4923=_0x8b34('0x1a');return db[_0x8b34('0x3b')][_0x8b34('0x34')]({'where':{'name':_0x1e4923,'userProfileId':_0x5c287c['userProfileId']},'raw':!![]})[_0x8b34('0x18')](function(_0x3cc33d){if(_0x3cc33d&&_0x3cc33d[_0x8b34('0x3c')]===0x0){return db[_0x8b34('0x3d')][_0x8b34('0x36')]({'name':_0x3eafbb[_0x8b34('0x1c')],'resourceId':_0x3eafbb['id'],'type':_0x3cc33d[_0x8b34('0x1c')],'sectionId':_0x3cc33d['id']},{})[_0x8b34('0x18')](function(){return _0x581e94;});}else{return _0x581e94;}})[_0x8b34('0x35')](function(_0x383caf){logger[_0x8b34('0x1b')](_0x8b34('0x3e'),_0x383caf);throw _0x383caf;});}return _0x581e94;})['then'](respondWithResult(_0x425816,0xc9))[_0x8b34('0x35')](handleError(_0x425816,null));};exports[_0x8b34('0x3f')]=function(_0x32ef75,_0x3c4076){if(_0x32ef75[_0x8b34('0x37')]['id']){delete _0x32ef75['body']['id'];}return db['OpenchannelQueue'][_0x8b34('0x34')]({'where':{'id':_0x32ef75[_0x8b34('0x29')]['id']}})[_0x8b34('0x18')](handleEntityNotFound(_0x3c4076,null))['then'](saveUpdates(_0x32ef75[_0x8b34('0x37')],null))[_0x8b34('0x18')](respondWithResult(_0x3c4076,null))['catch'](handleError(_0x3c4076,null));};exports[_0x8b34('0x19')]=function(_0x22df4d,_0x592111){return db[_0x8b34('0x20')][_0x8b34('0x34')]({'where':{'id':_0x22df4d[_0x8b34('0x29')]['id']}})[_0x8b34('0x18')](handleEntityNotFound(_0x592111,null))[_0x8b34('0x18')](removeEntity(_0x592111,null))[_0x8b34('0x35')](handleError(_0x592111,null));};exports[_0x8b34('0x40')]=function(_0xf45130,_0x1bd78f){return db['OpenchannelQueue'][_0x8b34('0x40')]()['then'](respondWithResult(_0x1bd78f,null))[_0x8b34('0x35')](handleError(_0x1bd78f,null));};exports[_0x8b34('0x41')]=function(_0x564bf9,_0x312102){var _0x1030e6={'raw':!![],'where':{}},_0x50cbd7={},_0x53e9d0;return db[_0x8b34('0x20')][_0x8b34('0x42')]({'where':{'id':_0x564bf9[_0x8b34('0x29')]['id']}})[_0x8b34('0x18')](handleEntityNotFound(_0x312102,null))[_0x8b34('0x18')](function(_0x2c741d){if(_0x2c741d){_0x53e9d0=_0x2c741d[_0x8b34('0x3a')]({'plain':!![]});_0x50cbd7[_0x8b34('0x2a')]=_[_0x8b34('0x2c')](db['UserOpenchannelQueue'][_0x8b34('0x2b')]);_0x50cbd7[_0x8b34('0x25')]=_['keys'](_0x564bf9['query']);_0x50cbd7['filters']=_['intersection'](_0x50cbd7[_0x8b34('0x2a')],_0x50cbd7[_0x8b34('0x25')]);_0x1030e6[_0x8b34('0x2f')]=_['intersection'](_0x50cbd7[_0x8b34('0x2a')],qs[_0x8b34('0x30')](_0x564bf9['query'][_0x8b34('0x30')]));_0x1030e6[_0x8b34('0x2f')]=_0x1030e6[_0x8b34('0x2f')][_0x8b34('0x43')]?_0x1030e6[_0x8b34('0x2f')]:_0x50cbd7[_0x8b34('0x2a')];if(!_0x564bf9[_0x8b34('0x25')][_0x8b34('0x44')](_0x8b34('0x45'))){_0x1030e6['limit']=qs['limit'](_0x564bf9[_0x8b34('0x25')]['limit']);_0x1030e6['offset']=qs[_0x8b34('0x11')](_0x564bf9[_0x8b34('0x25')][_0x8b34('0x11')]);}_0x1030e6[_0x8b34('0x46')]=qs[_0x8b34('0x47')](_0x564bf9[_0x8b34('0x25')]['sort']);_0x1030e6[_0x8b34('0x24')]=qs[_0x8b34('0x2d')](_['pick'](_0x564bf9[_0x8b34('0x25')],_0x50cbd7['filters']));_0x1030e6[_0x8b34('0x24')][_0x8b34('0x48')]=_0x2c741d['id'];if(_0x564bf9[_0x8b34('0x25')][_0x8b34('0x49')]){_0x1030e6[_0x8b34('0x24')]=_[_0x8b34('0x32')](_0x1030e6[_0x8b34('0x24')],{'$or':_[_0x8b34('0x1f')](_0x1030e6[_0x8b34('0x2f')],function(_0x7e374b){var _0x55a86d={};_0x55a86d[_0x7e374b]={'$like':'%'+_0x564bf9[_0x8b34('0x25')]['filter']+'%'};return _0x55a86d;})});}_0x1030e6=_[_0x8b34('0x32')]({},_0x1030e6,_0x564bf9[_0x8b34('0x33')]);return db['UserOpenchannelQueue']['findAll'](_0x1030e6);}})[_0x8b34('0x18')](function(_0x2ed6a5){if(_0x2ed6a5){return db[_0x8b34('0x4a')]['findAndCountAll']({'where':{'id':_[_0x8b34('0x1f')](_0x2ed6a5,_0x8b34('0x4b')),'role':_0x8b34('0x4c')},'attributes':['id',_0x8b34('0x1c'),'openchannelPause',_0x8b34('0x4d'),'createdAt']});}})[_0x8b34('0x18')](function(_0xcead94){if(_0xcead94){return{'count':_0xcead94[_0x8b34('0x14')],'rows':_[_0x8b34('0x1f')](_0xcead94[_0x8b34('0x27')],function(_0x2bb43e){return{'membername':_0x2bb43e[_0x8b34('0x1c')],'UserId':_0x2bb43e['id'],'queue_name':_0x53e9d0[_0x8b34('0x1c')],'OpenchannelQueueId':_0x53e9d0['id'],'interface':util['format'](_0x8b34('0x4e'),'SIP',_0x2bb43e['name']),'penalty':0x0,'paused':_0x2bb43e[_0x8b34('0x4f')],'createdAt':_0x2bb43e['createdAt'],'updatedAt':_0x2bb43e[_0x8b34('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8b34('0x18')](respondWithFilteredResult(_0x312102,_0x1030e6))[_0x8b34('0x35')](handleError(_0x312102,null));};exports[_0x8b34('0x50')]=function(_0x117e80,_0x882eea){var _0x44a2a5={};var _0x2e996c={};var _0x12793f;var _0x3864bf;return db[_0x8b34('0x20')][_0x8b34('0x42')]({'where':{'id':_0x117e80[_0x8b34('0x29')]['id']}})['then'](handleEntityNotFound(_0x882eea,null))['then'](function(_0x10adc4){if(_0x10adc4){_0x12793f=_0x10adc4;_0x2e996c['model']=_['keys'](db[_0x8b34('0x51')][_0x8b34('0x2b')]);_0x2e996c[_0x8b34('0x25')]=_['keys'](_0x117e80[_0x8b34('0x25')]);_0x2e996c[_0x8b34('0x2d')]=_[_0x8b34('0x2e')](_0x2e996c['model'],_0x2e996c[_0x8b34('0x25')]);_0x44a2a5[_0x8b34('0x2f')]=_[_0x8b34('0x2e')](_0x2e996c[_0x8b34('0x2a')],qs[_0x8b34('0x30')](_0x117e80[_0x8b34('0x25')][_0x8b34('0x30')]));_0x44a2a5[_0x8b34('0x2f')]=_0x44a2a5[_0x8b34('0x2f')][_0x8b34('0x43')]?_0x44a2a5['attributes']:_0x2e996c[_0x8b34('0x2a')];_0x44a2a5['order']=qs[_0x8b34('0x47')](_0x117e80[_0x8b34('0x25')][_0x8b34('0x47')]);_0x44a2a5[_0x8b34('0x24')]=qs[_0x8b34('0x2d')](_['pick'](_0x117e80[_0x8b34('0x25')],_0x2e996c[_0x8b34('0x2d')]));if(_0x117e80[_0x8b34('0x25')][_0x8b34('0x49')]){_0x44a2a5[_0x8b34('0x24')]=_[_0x8b34('0x32')](_0x44a2a5['where'],{'$or':_[_0x8b34('0x1f')](_0x44a2a5[_0x8b34('0x2f')],function(_0x5a410c){var _0x38566c={};_0x38566c[_0x5a410c]={'$like':'%'+_0x117e80[_0x8b34('0x25')][_0x8b34('0x49')]+'%'};return _0x38566c;})});}_0x44a2a5=_[_0x8b34('0x32')]({},_0x44a2a5,_0x117e80[_0x8b34('0x33')]);return _0x12793f[_0x8b34('0x50')](_0x44a2a5);}})[_0x8b34('0x18')](function(_0x3096b2){if(_0x3096b2){_0x3864bf=_0x3096b2[_0x8b34('0x43')];if(!_0x117e80[_0x8b34('0x25')][_0x8b34('0x44')](_0x8b34('0x45'))){_0x44a2a5[_0x8b34('0x13')]=qs['limit'](_0x117e80[_0x8b34('0x25')][_0x8b34('0x13')]);_0x44a2a5['offset']=qs[_0x8b34('0x11')](_0x117e80['query'][_0x8b34('0x11')]);}return _0x12793f[_0x8b34('0x50')](_0x44a2a5);}})[_0x8b34('0x18')](function(_0x4defcb){if(_0x4defcb){return _0x4defcb?{'count':_0x3864bf,'rows':_0x4defcb}:null;}})[_0x8b34('0x18')](respondWithResult(_0x882eea,null))[_0x8b34('0x35')](handleError(_0x882eea,null));};exports[_0x8b34('0x52')]=function(_0x132d4f,_0x1489ea){var _0x2df166=_0x132d4f['body'][_0x8b34('0x53')];return db[_0x8b34('0x51')][_0x8b34('0x26')]({'where':{'id':_0x2df166},'attributes':['id'],'include':[{'model':db[_0x8b34('0x4a')],'as':_0x8b34('0x54'),'attributes':['id',_0x8b34('0x1c'),_0x8b34('0x55'),_0x8b34('0x56'),_0x8b34('0x57')],'raw':!![]}]})[_0x8b34('0x18')](function(_0x486dab){if(_0x486dab){var _0xb00bc8=_[_0x8b34('0x58')](_0x486dab,function(_0x3c491f){var _0x5f3823=_0x3c491f[_0x8b34('0x3a')]({'plain':!![]});return _0x5f3823['Agents'];});return db[_0x8b34('0x20')][_0x8b34('0x34')]({'where':{'id':_0x132d4f[_0x8b34('0x29')]['id']}})[_0x8b34('0x18')](function(_0x40938a){return db[_0x8b34('0x59')][_0x8b34('0x5a')](function(_0x7f32f0){return _0x40938a['addTeams'](_0x2df166,{'transaction':_0x7f32f0})[_0x8b34('0x18')](function(){return BPromise['each'](_0xb00bc8,function(_0x378626){return db[_0x8b34('0x5b')][_0x8b34('0x5c')]({'where':{'UserId':_0x378626['id'],'OpenchannelQueueId':_0x132d4f[_0x8b34('0x29')]['id']},'transaction':_0x7f32f0});});})[_0x8b34('0x18')](function(){_0xb00bc8['forEach'](function(_0x3d1688){socket['emit'](_0x8b34('0x5d'),{'UserId':_0x3d1688['id'],'OpenchannelQueueId':_0x40938a['id']});});});});});}})['then'](respondWithStatusCode(_0x1489ea,null))[_0x8b34('0x35')](handleError(_0x1489ea,null));};exports[_0x8b34('0x5e')]=function(_0x292849,_0x1deaa0){return db[_0x8b34('0x51')][_0x8b34('0x26')]({'where':{'id':_0x292849[_0x8b34('0x25')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8b34('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8b34('0x18')](handleEntityNotFound(_0x1deaa0,null))[_0x8b34('0x18')](function(_0x1fa09a){var _0x5be15b=_['map'](_0x1fa09a,'id');var _0x25d067=[];var _0x39095f=[];var _0x1beb52=squel[_0x8b34('0x5f')]();_0x1beb52[_0x8b34('0x60')](_0x8b34('0x61'))[_0x8b34('0x62')](_0x8b34('0x63'),'tq')['join'](_0x8b34('0x64'),'ut',_0x8b34('0x65'))[_0x8b34('0x24')](_0x8b34('0x66'),_0x292849[_0x8b34('0x29')]['id']);for(var _0x2f33e7=0x0;_0x2f33e7<_0x1fa09a[_0x8b34('0x43')];_0x2f33e7+=0x1){let _0x2469ae=_0x1fa09a[_0x2f33e7];for(var _0xc56266=0x0;_0xc56266<_0x2469ae['Agents'][_0x8b34('0x43')];_0xc56266+=0x1){let _0x8466ac=_0x2469ae['Agents'][_0xc56266];var _0x49e2bd=_0x1beb52[_0x8b34('0x67')]();_0x49e2bd[_0x8b34('0x24')](_0x8b34('0x68'),_0x8466ac['id']);_0x39095f[_0x8b34('0x69')](db[_0x8b34('0x59')][_0x8b34('0x25')](_0x49e2bd[_0x8b34('0x6a')](),{'type':db['sequelize'][_0x8b34('0x6b')]['SELECT']})[_0x8b34('0x18')](function(_0x3b29af){if(_0x3b29af[_0x8b34('0x43')]===0x1){return _0x8466ac['id'];}else{var _0x446997=_[_0x8b34('0x6c')](_[_0x8b34('0x1f')](_0x3b29af,'TeamId'),function(_0x2259fc){return _[_0x8b34('0x6d')](_0x5be15b,_0x2259fc);});if(_0x446997){return _0x8466ac['id'];}}}));}}return BPromise[_0x8b34('0x6e')](_0x39095f)[_0x8b34('0x18')](function(_0x26a8e2){_0x25d067=_(_0x25d067)['union'](_0x26a8e2)['compact']()['value']();return db['OpenchannelQueue'][_0x8b34('0x34')]({'where':{'id':_0x292849[_0x8b34('0x29')]['id']}})[_0x8b34('0x18')](function(_0x56d2e2){return db['sequelize'][_0x8b34('0x5a')](function(_0x1bc9bb){return _0x56d2e2[_0x8b34('0x5e')](_0x292849['query'][_0x8b34('0x53')],{'transaction':_0x1bc9bb})[_0x8b34('0x18')](function(){if(!_['isEmpty'](_0x25d067)){return _0x56d2e2[_0x8b34('0x6f')](_0x25d067,{'transaction':_0x1bc9bb});}})[_0x8b34('0x18')](function(){_0x25d067['forEach'](function(_0x2e73a3){socket[_0x8b34('0x70')](_0x8b34('0x71'),{'UserId':_0x2e73a3,'OpenchannelQueueId':_0x56d2e2['id']});});});});});});})[_0x8b34('0x18')](respondWithStatusCode(_0x1deaa0,null))['catch'](handleError(_0x1deaa0,null));};exports[_0x8b34('0x72')]=function(_0x1bf15f,_0x485c05){return db[_0x8b34('0x20')][_0x8b34('0x34')]({'where':{'id':_0x1bf15f[_0x8b34('0x29')]['id']}})['then'](handleEntityNotFound(_0x485c05,null))[_0x8b34('0x18')](function(_0x37a083){if(_0x37a083){return _0x37a083[_0x8b34('0x72')](_0x1bf15f['body'][_0x8b34('0x53')],_[_0x8b34('0x73')](_0x1bf15f[_0x8b34('0x37')],[_0x8b34('0x53'),'id'])||{})[_0x8b34('0x74')](function(_0x2cee9b){for(var _0x2234eb=0x0;_0x2234eb<_0x1bf15f[_0x8b34('0x37')][_0x8b34('0x53')][_0x8b34('0x43')];_0x2234eb+=0x1){socket['emit'](_0x8b34('0x5d'),{'UserId':Number(_0x1bf15f[_0x8b34('0x37')][_0x8b34('0x53')][_0x2234eb]),'OpenchannelQueueId':Number(_0x1bf15f[_0x8b34('0x29')]['id'])});}return _0x2cee9b;});}})['then'](respondWithResult(_0x485c05,null))[_0x8b34('0x35')](handleError(_0x485c05,null));};exports[_0x8b34('0x6f')]=function(_0x35a11d,_0x404c3f){return db['OpenchannelQueue'][_0x8b34('0x34')]({'where':{'id':_0x35a11d[_0x8b34('0x29')]['id']}})[_0x8b34('0x18')](handleEntityNotFound(_0x404c3f,null))[_0x8b34('0x18')](function(_0x5ce8e4){if(_0x5ce8e4){return _0x5ce8e4[_0x8b34('0x6f')](_0x35a11d[_0x8b34('0x25')][_0x8b34('0x53')])[_0x8b34('0x18')](function(){if(_['isArray'](_0x35a11d[_0x8b34('0x25')][_0x8b34('0x53')])){for(var _0x440c63=0x0;_0x440c63<_0x35a11d['query'][_0x8b34('0x53')][_0x8b34('0x43')];_0x440c63+=0x1){socket['emit'](_0x8b34('0x71'),{'UserId':Number(_0x35a11d[_0x8b34('0x25')][_0x8b34('0x53')][_0x440c63]),'OpenchannelQueueId':Number(_0x35a11d[_0x8b34('0x29')]['id'])});}}else{socket[_0x8b34('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x35a11d['query'][_0x8b34('0x53')]),'OpenchannelQueueId':Number(_0x35a11d['params']['id'])});}});}})[_0x8b34('0x18')](respondWithStatusCode(_0x404c3f,null))[_0x8b34('0x35')](handleError(_0x404c3f,null));};exports[_0x8b34('0x75')]=function(_0x2b857e,_0x351560){var _0x32f5ec={};var _0x3d6705={};var _0x1ae587;var _0xf54992;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x2b857e['params']['id']}})[_0x8b34('0x18')](handleEntityNotFound(_0x351560,null))['then'](function(_0xcc700d){if(_0xcc700d){_0x1ae587=_0xcc700d;_0x3d6705['model']=_['keys'](db['User']['rawAttributes']);_0x3d6705[_0x8b34('0x25')]=_[_0x8b34('0x2c')](_0x2b857e[_0x8b34('0x25')]);_0x3d6705['filters']=_[_0x8b34('0x2e')](_0x3d6705[_0x8b34('0x2a')],_0x3d6705[_0x8b34('0x25')]);_0x32f5ec['attributes']=_['intersection'](_0x3d6705[_0x8b34('0x2a')],qs['fields'](_0x2b857e[_0x8b34('0x25')][_0x8b34('0x30')]));_0x32f5ec[_0x8b34('0x2f')]=_0x32f5ec[_0x8b34('0x2f')][_0x8b34('0x43')]?_0x32f5ec[_0x8b34('0x2f')]:_0x3d6705[_0x8b34('0x2a')];_0x32f5ec[_0x8b34('0x46')]=qs[_0x8b34('0x47')](_0x2b857e['query']['sort']);_0x32f5ec['where']=qs[_0x8b34('0x2d')](_[_0x8b34('0x76')](_0x2b857e[_0x8b34('0x25')],_0x3d6705[_0x8b34('0x2d')]));if(_0x2b857e[_0x8b34('0x25')][_0x8b34('0x49')]){_0x32f5ec[_0x8b34('0x24')]=_[_0x8b34('0x32')](_0x32f5ec[_0x8b34('0x24')],{'$or':_['map'](_0x32f5ec[_0x8b34('0x2f')],function(_0x55a7c4){var _0x465b63={};_0x465b63[_0x55a7c4]={'$like':'%'+_0x2b857e[_0x8b34('0x25')][_0x8b34('0x49')]+'%'};return _0x465b63;})});}_0x32f5ec=_[_0x8b34('0x32')]({},_0x32f5ec,_0x2b857e[_0x8b34('0x33')]);return _0x1ae587[_0x8b34('0x75')](_0x32f5ec);}})['then'](function(_0xc6fc14){if(_0xc6fc14){_0xf54992=_0xc6fc14['length'];if(!_0x2b857e[_0x8b34('0x25')][_0x8b34('0x44')](_0x8b34('0x45'))){_0x32f5ec[_0x8b34('0x13')]=qs['limit'](_0x2b857e[_0x8b34('0x25')]['limit']);_0x32f5ec[_0x8b34('0x11')]=qs[_0x8b34('0x11')](_0x2b857e['query'][_0x8b34('0x11')]);}return _0x1ae587[_0x8b34('0x75')](_0x32f5ec);}})[_0x8b34('0x18')](function(_0x255ea0){if(_0x255ea0){return _0x255ea0?{'count':_0xf54992,'rows':_0x255ea0}:null;}})['then'](respondWithResult(_0x351560,null))[_0x8b34('0x35')](handleError(_0x351560,null));}; \ No newline at end of file +var _0xf367=['json','update','then','destroy','get','OpenchannelQueues','error','stack','name','index','map','OpenchannelQueue','rawAttributes','type','key','getOptions','where','query','findAll','rows','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','hasOwnProperty','nolimit','order','sort','filters','pick','OpenchannelQueueId','filter','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','options','addTeams','Agents','interface','sequelize','transaction','each','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','./openchannelQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x2dc1e3,_0x3d3c68){var _0x14b567=function(_0x4b63e3){while(--_0x4b63e3){_0x2dc1e3['push'](_0x2dc1e3['shift']());}};_0x14b567(++_0x3d3c68);}(_0xf367,0x1d0));var _0x7f36=function(_0x340763,_0x59c92b){_0x340763=_0x340763-0x0;var _0x230091=_0xf367[_0x340763];return _0x230091;};'use strict';var BPromise=require(_0x7f36('0x0'));var util=require(_0x7f36('0x1'));var _=require(_0x7f36('0x2'));var squel=require(_0x7f36('0x3'));var Redis=require(_0x7f36('0x4'));var qs=require(_0x7f36('0x5'));var logger=require(_0x7f36('0x6'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x7f36('0x7')]=_[_0x7f36('0x8')](config[_0x7f36('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f36('0x7')]));require(_0x7f36('0x9'))[_0x7f36('0xa')](socket);function respondWithStatusCode(_0x9a5451,_0x8a3f23){_0x8a3f23=_0x8a3f23||0xcc;return function(_0x2dd1b8){if(_0x2dd1b8){return _0x9a5451[_0x7f36('0xb')](_0x8a3f23);}return _0x9a5451['status'](_0x8a3f23)[_0x7f36('0xc')]();};}function respondWithResult(_0x173a32,_0xaa2af0){_0xaa2af0=_0xaa2af0||0xc8;return function(_0x414bbb){if(_0x414bbb){return _0x173a32[_0x7f36('0xd')](_0xaa2af0)['json'](_0x414bbb);}};}function respondWithFilteredResult(_0x1c7fe1,_0x3da5a4){return function(_0x19ca18){if(_0x19ca18){var _0x570cd6=typeof _0x3da5a4[_0x7f36('0xe')]===_0x7f36('0xf')&&typeof _0x3da5a4[_0x7f36('0x10')]===_0x7f36('0xf');var _0x144720=_0x19ca18[_0x7f36('0x11')];var _0x1ccd71=_0x570cd6?0x0:_0x3da5a4[_0x7f36('0xe')];var _0x438269=_0x570cd6?_0x19ca18[_0x7f36('0x11')]:_0x3da5a4['offset']+_0x3da5a4['limit'];var _0xe86dd;if(_0x438269>=_0x144720){_0x438269=_0x144720;_0xe86dd=0xc8;}else{_0xe86dd=0xce;}_0x1c7fe1[_0x7f36('0xd')](_0xe86dd);return _0x1c7fe1[_0x7f36('0x12')](_0x7f36('0x13'),_0x1ccd71+'-'+_0x438269+'/'+_0x144720)[_0x7f36('0x14')](_0x19ca18);}return null;};}function saveUpdates(_0x16fe5f){return function(_0xf9b3b0){if(_0xf9b3b0){return _0xf9b3b0[_0x7f36('0x15')](_0x16fe5f)[_0x7f36('0x16')](function(_0xd9d35c){return _0xd9d35c;});}return null;};}function removeEntity(_0x23bfb8){return function(_0x4dc67c){if(_0x4dc67c){return _0x4dc67c[_0x7f36('0x17')]()['then'](function(){var _0x117642=_0x4dc67c[_0x7f36('0x18')]({'plain':!![]});var _0x20600e=_0x7f36('0x19');return db['UserProfileResource'][_0x7f36('0x17')]({'where':{'type':_0x20600e,'resourceId':_0x117642['id']}})[_0x7f36('0x16')](function(){return _0x4dc67c;});})[_0x7f36('0x16')](function(){_0x23bfb8[_0x7f36('0xd')](0xcc)[_0x7f36('0xc')]();});}};}function handleEntityNotFound(_0x41c9ae){return function(_0x5550c3){if(!_0x5550c3){_0x41c9ae['sendStatus'](0x194);}return _0x5550c3;};}function handleError(_0x7d314a,_0x279c55){_0x279c55=_0x279c55||0x1f4;return function(_0x5f1b81){logger[_0x7f36('0x1a')](_0x5f1b81[_0x7f36('0x1b')]);if(_0x5f1b81[_0x7f36('0x1c')]){delete _0x5f1b81[_0x7f36('0x1c')];}_0x7d314a['status'](_0x279c55)['send'](_0x5f1b81);};}exports[_0x7f36('0x1d')]=function(_0x2be69d,_0x131404){var _0x40c337={};var _0x7d2207={'count':0x0,'rows':[]};var _0x7b2d07=_[_0x7f36('0x1e')](db[_0x7f36('0x1f')][_0x7f36('0x20')],function(_0x1fb2be){return{'name':_0x1fb2be['fieldName'],'type':_0x1fb2be[_0x7f36('0x21')][_0x7f36('0x22')]};});_0x40c337=qs[_0x7f36('0x23')](_0x7b2d07,_0x2be69d);var _0x5de8e3={'where':_0x40c337[_0x7f36('0x24')]};return db[_0x7f36('0x1f')][_0x7f36('0x11')](_0x5de8e3)[_0x7f36('0x16')](function(_0x507e2c){_0x7d2207[_0x7f36('0x11')]=_0x507e2c;_0x40c337['include']=qs['include'](_0x2be69d[_0x7f36('0x25')]);return db['OpenchannelQueue'][_0x7f36('0x26')](_0x40c337);})[_0x7f36('0x16')](function(_0x298f58){_0x7d2207[_0x7f36('0x27')]=_0x298f58;return _0x7d2207;})[_0x7f36('0x16')](respondWithFilteredResult(_0x131404,_0x40c337))[_0x7f36('0x28')](handleError(_0x131404,null));};exports[_0x7f36('0x29')]=function(_0x435b09,_0x58658b){var _0x158562={'raw':!![],'where':{'id':_0x435b09[_0x7f36('0x2a')]['id']}},_0x2af351={};_0x2af351[_0x7f36('0x2b')]=_[_0x7f36('0x2c')](db['OpenchannelQueue'][_0x7f36('0x20')]);_0x2af351['query']=_['keys'](_0x435b09[_0x7f36('0x25')]);_0x2af351['filters']=_[_0x7f36('0x2d')](_0x2af351[_0x7f36('0x2b')],_0x2af351[_0x7f36('0x25')]);_0x158562[_0x7f36('0x2e')]=_[_0x7f36('0x2d')](_0x2af351[_0x7f36('0x2b')],qs[_0x7f36('0x2f')](_0x435b09[_0x7f36('0x25')][_0x7f36('0x2f')]));_0x158562[_0x7f36('0x2e')]=_0x158562[_0x7f36('0x2e')][_0x7f36('0x30')]?_0x158562[_0x7f36('0x2e')]:_0x2af351['model'];if(_0x435b09[_0x7f36('0x25')][_0x7f36('0x31')]){_0x158562['include']=[{'all':!![]}];}_0x158562=_[_0x7f36('0x32')]({},_0x158562,_0x435b09['options']);return db['OpenchannelQueue']['find'](_0x158562)[_0x7f36('0x16')](handleEntityNotFound(_0x58658b,null))[_0x7f36('0x16')](respondWithResult(_0x58658b,null))['catch'](handleError(_0x58658b,null));};exports[_0x7f36('0x33')]=function(_0x1badf2,_0x3956fc){return db[_0x7f36('0x1f')]['create'](_0x1badf2['body'],{})[_0x7f36('0x16')](function(_0x2d3e2c){var _0x2357de=_0x1badf2[_0x7f36('0x34')][_0x7f36('0x18')]({'plain':!![]});if(!_0x2357de)throw new Error(_0x7f36('0x35'));if(_0x2357de['role']==='user'){var _0x9da675=_0x2d3e2c['get']({'plain':!![]});var _0x4c30bb=_0x7f36('0x19');return db[_0x7f36('0x36')][_0x7f36('0x37')]({'where':{'name':_0x4c30bb,'userProfileId':_0x2357de['userProfileId']},'raw':!![]})['then'](function(_0x3730f1){if(_0x3730f1&&_0x3730f1[_0x7f36('0x38')]===0x0){return db[_0x7f36('0x39')][_0x7f36('0x33')]({'name':_0x9da675[_0x7f36('0x1c')],'resourceId':_0x9da675['id'],'type':_0x3730f1[_0x7f36('0x1c')],'sectionId':_0x3730f1['id']},{})['then'](function(){return _0x2d3e2c;});}else{return _0x2d3e2c;}})[_0x7f36('0x28')](function(_0x15a1aa){logger[_0x7f36('0x1a')](_0x7f36('0x3a'),_0x15a1aa);throw _0x15a1aa;});}return _0x2d3e2c;})['then'](respondWithResult(_0x3956fc,0xc9))[_0x7f36('0x28')](handleError(_0x3956fc,null));};exports[_0x7f36('0x15')]=function(_0x2810a0,_0x1c9a55){if(_0x2810a0[_0x7f36('0x3b')]['id']){delete _0x2810a0[_0x7f36('0x3b')]['id'];}return db[_0x7f36('0x1f')]['find']({'where':{'id':_0x2810a0[_0x7f36('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1c9a55,null))[_0x7f36('0x16')](saveUpdates(_0x2810a0['body'],null))[_0x7f36('0x16')](respondWithResult(_0x1c9a55,null))[_0x7f36('0x28')](handleError(_0x1c9a55,null));};exports['destroy']=function(_0x47520a,_0xaafbb3){return db[_0x7f36('0x1f')][_0x7f36('0x37')]({'where':{'id':_0x47520a[_0x7f36('0x2a')]['id']}})[_0x7f36('0x16')](handleEntityNotFound(_0xaafbb3,null))[_0x7f36('0x16')](removeEntity(_0xaafbb3,null))[_0x7f36('0x28')](handleError(_0xaafbb3,null));};exports[_0x7f36('0x3c')]=function(_0x20b727,_0x36affa){return db['OpenchannelQueue'][_0x7f36('0x3c')]()[_0x7f36('0x16')](respondWithResult(_0x36affa,null))[_0x7f36('0x28')](handleError(_0x36affa,null));};exports['getMembers']=function(_0x13347,_0x3228de){var _0x2e3315={'raw':!![],'where':{}},_0x268e56={},_0x23e4ef;return db[_0x7f36('0x1f')][_0x7f36('0x3d')]({'where':{'id':_0x13347[_0x7f36('0x2a')]['id']}})[_0x7f36('0x16')](handleEntityNotFound(_0x3228de,null))[_0x7f36('0x16')](function(_0x234d44){if(_0x234d44){_0x23e4ef=_0x234d44['get']({'plain':!![]});_0x268e56['model']=_[_0x7f36('0x2c')](db['UserOpenchannelQueue'][_0x7f36('0x20')]);_0x268e56[_0x7f36('0x25')]=_[_0x7f36('0x2c')](_0x13347[_0x7f36('0x25')]);_0x268e56['filters']=_[_0x7f36('0x2d')](_0x268e56['model'],_0x268e56[_0x7f36('0x25')]);_0x2e3315['attributes']=_[_0x7f36('0x2d')](_0x268e56[_0x7f36('0x2b')],qs[_0x7f36('0x2f')](_0x13347['query'][_0x7f36('0x2f')]));_0x2e3315[_0x7f36('0x2e')]=_0x2e3315[_0x7f36('0x2e')][_0x7f36('0x30')]?_0x2e3315[_0x7f36('0x2e')]:_0x268e56[_0x7f36('0x2b')];if(!_0x13347[_0x7f36('0x25')][_0x7f36('0x3e')](_0x7f36('0x3f'))){_0x2e3315[_0x7f36('0x10')]=qs[_0x7f36('0x10')](_0x13347['query'][_0x7f36('0x10')]);_0x2e3315[_0x7f36('0xe')]=qs[_0x7f36('0xe')](_0x13347['query'][_0x7f36('0xe')]);}_0x2e3315[_0x7f36('0x40')]=qs[_0x7f36('0x41')](_0x13347[_0x7f36('0x25')][_0x7f36('0x41')]);_0x2e3315[_0x7f36('0x24')]=qs[_0x7f36('0x42')](_[_0x7f36('0x43')](_0x13347[_0x7f36('0x25')],_0x268e56[_0x7f36('0x42')]));_0x2e3315[_0x7f36('0x24')][_0x7f36('0x44')]=_0x234d44['id'];if(_0x13347[_0x7f36('0x25')][_0x7f36('0x45')]){_0x2e3315[_0x7f36('0x24')]=_[_0x7f36('0x32')](_0x2e3315[_0x7f36('0x24')],{'$or':_[_0x7f36('0x1e')](_0x2e3315[_0x7f36('0x2e')],function(_0xb1ba24){var _0x122d67={};_0x122d67[_0xb1ba24]={'$like':'%'+_0x13347[_0x7f36('0x25')][_0x7f36('0x45')]+'%'};return _0x122d67;})});}_0x2e3315=_[_0x7f36('0x32')]({},_0x2e3315,_0x13347['options']);return db[_0x7f36('0x46')][_0x7f36('0x26')](_0x2e3315);}})[_0x7f36('0x16')](function(_0x56cf9e){if(_0x56cf9e){return db[_0x7f36('0x47')][_0x7f36('0x48')]({'where':{'id':_[_0x7f36('0x1e')](_0x56cf9e,_0x7f36('0x49')),'role':_0x7f36('0x4a')},'attributes':['id','name',_0x7f36('0x4b'),'updatedAt',_0x7f36('0x4c')]});}})['then'](function(_0xc7adb6){if(_0xc7adb6){return{'count':_0xc7adb6[_0x7f36('0x11')],'rows':_[_0x7f36('0x1e')](_0xc7adb6[_0x7f36('0x27')],function(_0x14d8ad){return{'membername':_0x14d8ad[_0x7f36('0x1c')],'UserId':_0x14d8ad['id'],'queue_name':_0x23e4ef[_0x7f36('0x1c')],'OpenchannelQueueId':_0x23e4ef['id'],'interface':util[_0x7f36('0x4d')](_0x7f36('0x4e'),_0x7f36('0x4f'),_0x14d8ad[_0x7f36('0x1c')]),'penalty':0x0,'paused':_0x14d8ad['openchannelPause'],'createdAt':_0x14d8ad[_0x7f36('0x4c')],'updatedAt':_0x14d8ad[_0x7f36('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7f36('0x16')](respondWithFilteredResult(_0x3228de,_0x2e3315))['catch'](handleError(_0x3228de,null));};exports[_0x7f36('0x51')]=function(_0xa131f5,_0x2067a2){var _0x2ad4e6={};var _0x1a8e71={};var _0x3902ef;var _0x33001d;return db[_0x7f36('0x1f')][_0x7f36('0x3d')]({'where':{'id':_0xa131f5[_0x7f36('0x2a')]['id']}})['then'](handleEntityNotFound(_0x2067a2,null))[_0x7f36('0x16')](function(_0x40338d){if(_0x40338d){_0x3902ef=_0x40338d;_0x1a8e71[_0x7f36('0x2b')]=_[_0x7f36('0x2c')](db[_0x7f36('0x52')]['rawAttributes']);_0x1a8e71['query']=_['keys'](_0xa131f5[_0x7f36('0x25')]);_0x1a8e71[_0x7f36('0x42')]=_[_0x7f36('0x2d')](_0x1a8e71[_0x7f36('0x2b')],_0x1a8e71['query']);_0x2ad4e6['attributes']=_[_0x7f36('0x2d')](_0x1a8e71[_0x7f36('0x2b')],qs[_0x7f36('0x2f')](_0xa131f5[_0x7f36('0x25')][_0x7f36('0x2f')]));_0x2ad4e6[_0x7f36('0x2e')]=_0x2ad4e6[_0x7f36('0x2e')][_0x7f36('0x30')]?_0x2ad4e6[_0x7f36('0x2e')]:_0x1a8e71[_0x7f36('0x2b')];_0x2ad4e6[_0x7f36('0x40')]=qs[_0x7f36('0x41')](_0xa131f5[_0x7f36('0x25')]['sort']);_0x2ad4e6[_0x7f36('0x24')]=qs[_0x7f36('0x42')](_[_0x7f36('0x43')](_0xa131f5[_0x7f36('0x25')],_0x1a8e71[_0x7f36('0x42')]));if(_0xa131f5['query'][_0x7f36('0x45')]){_0x2ad4e6[_0x7f36('0x24')]=_[_0x7f36('0x32')](_0x2ad4e6[_0x7f36('0x24')],{'$or':_[_0x7f36('0x1e')](_0x2ad4e6['attributes'],function(_0x386a27){var _0x29b882={};_0x29b882[_0x386a27]={'$like':'%'+_0xa131f5['query'][_0x7f36('0x45')]+'%'};return _0x29b882;})});}_0x2ad4e6=_[_0x7f36('0x32')]({},_0x2ad4e6,_0xa131f5[_0x7f36('0x53')]);return _0x3902ef[_0x7f36('0x51')](_0x2ad4e6);}})[_0x7f36('0x16')](function(_0x519995){if(_0x519995){_0x33001d=_0x519995[_0x7f36('0x30')];if(!_0xa131f5['query'][_0x7f36('0x3e')]('nolimit')){_0x2ad4e6[_0x7f36('0x10')]=qs['limit'](_0xa131f5[_0x7f36('0x25')]['limit']);_0x2ad4e6['offset']=qs[_0x7f36('0xe')](_0xa131f5[_0x7f36('0x25')][_0x7f36('0xe')]);}return _0x3902ef[_0x7f36('0x51')](_0x2ad4e6);}})[_0x7f36('0x16')](function(_0x3805ee){if(_0x3805ee){return _0x3805ee?{'count':_0x33001d,'rows':_0x3805ee}:null;}})[_0x7f36('0x16')](respondWithResult(_0x2067a2,null))[_0x7f36('0x28')](handleError(_0x2067a2,null));};exports[_0x7f36('0x54')]=function(_0x2206dd,_0x4df01a){var _0x2a089d=_0x2206dd[_0x7f36('0x3b')]['ids'];return db[_0x7f36('0x52')][_0x7f36('0x26')]({'where':{'id':_0x2a089d},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7f36('0x55'),'attributes':['id',_0x7f36('0x1c'),'online','voicePause',_0x7f36('0x56')],'raw':!![]}]})['then'](function(_0x4fa0c7){if(_0x4fa0c7){var _0x4c0fa8=_['flatMap'](_0x4fa0c7,function(_0x1d26d3){var _0x2a7177=_0x1d26d3['get']({'plain':!![]});return _0x2a7177[_0x7f36('0x55')];});return db[_0x7f36('0x1f')][_0x7f36('0x37')]({'where':{'id':_0x2206dd[_0x7f36('0x2a')]['id']}})[_0x7f36('0x16')](function(_0x571226){return db[_0x7f36('0x57')][_0x7f36('0x58')](function(_0x2cd719){return _0x571226[_0x7f36('0x54')](_0x2a089d,{'transaction':_0x2cd719})[_0x7f36('0x16')](function(){return BPromise[_0x7f36('0x59')](_0x4c0fa8,function(_0x388818){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x388818['id'],'OpenchannelQueueId':_0x2206dd[_0x7f36('0x2a')]['id']},'transaction':_0x2cd719});});})[_0x7f36('0x16')](function(){_0x4c0fa8['forEach'](function(_0x2a5a1e){socket[_0x7f36('0x5a')](_0x7f36('0x5b'),{'UserId':_0x2a5a1e['id'],'OpenchannelQueueId':_0x571226['id']});});});});});}})['then'](respondWithStatusCode(_0x4df01a,null))['catch'](handleError(_0x4df01a,null));};exports[_0x7f36('0x5c')]=function(_0x467174,_0x568c24){return db[_0x7f36('0x52')][_0x7f36('0x26')]({'where':{'id':_0x467174['query'][_0x7f36('0x5d')]},'attributes':['id'],'include':[{'model':db[_0x7f36('0x47')],'as':_0x7f36('0x55'),'attributes':['id'],'raw':!![]}]})[_0x7f36('0x16')](handleEntityNotFound(_0x568c24,null))[_0x7f36('0x16')](function(_0x1ef135){var _0x208fa3=_[_0x7f36('0x1e')](_0x1ef135,'id');var _0x52e93a=[];var _0x542b5b=[];var _0x47eb3f=squel[_0x7f36('0x5e')]();_0x47eb3f[_0x7f36('0x5f')](_0x7f36('0x60'))[_0x7f36('0x61')](_0x7f36('0x62'),'tq')['join'](_0x7f36('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x7f36('0x64'),_0x467174[_0x7f36('0x2a')]['id']);for(var _0x11b7bb=0x0;_0x11b7bb<_0x1ef135['length'];_0x11b7bb+=0x1){let _0x169da4=_0x1ef135[_0x11b7bb];for(var _0x1c3986=0x0;_0x1c3986<_0x169da4['Agents'][_0x7f36('0x30')];_0x1c3986+=0x1){let _0x310271=_0x169da4[_0x7f36('0x55')][_0x1c3986];var _0x5364b0=_0x47eb3f[_0x7f36('0x65')]();_0x5364b0[_0x7f36('0x24')]('ut.UserId\x20=\x20?',_0x310271['id']);_0x542b5b[_0x7f36('0x66')](db['sequelize'][_0x7f36('0x25')](_0x5364b0[_0x7f36('0x67')](),{'type':db[_0x7f36('0x57')][_0x7f36('0x68')][_0x7f36('0x69')]})[_0x7f36('0x16')](function(_0x577cd5){if(_0x577cd5[_0x7f36('0x30')]===0x1){return _0x310271['id'];}else{var _0x23494b=_[_0x7f36('0x6a')](_[_0x7f36('0x1e')](_0x577cd5,_0x7f36('0x6b')),function(_0x217380){return _[_0x7f36('0x6c')](_0x208fa3,_0x217380);});if(_0x23494b){return _0x310271['id'];}}}));}}return BPromise[_0x7f36('0x6d')](_0x542b5b)['then'](function(_0x2dc920){_0x52e93a=_(_0x52e93a)[_0x7f36('0x6e')](_0x2dc920)['compact']()[_0x7f36('0x6f')]();return db[_0x7f36('0x1f')][_0x7f36('0x37')]({'where':{'id':_0x467174[_0x7f36('0x2a')]['id']}})[_0x7f36('0x16')](function(_0x29c333){return db[_0x7f36('0x57')][_0x7f36('0x58')](function(_0x374aa0){return _0x29c333[_0x7f36('0x5c')](_0x467174[_0x7f36('0x25')][_0x7f36('0x5d')],{'transaction':_0x374aa0})[_0x7f36('0x16')](function(){if(!_[_0x7f36('0x70')](_0x52e93a)){return _0x29c333[_0x7f36('0x71')](_0x52e93a,{'transaction':_0x374aa0});}})[_0x7f36('0x16')](function(){_0x52e93a[_0x7f36('0x72')](function(_0x5e9959){socket[_0x7f36('0x5a')](_0x7f36('0x73'),{'UserId':_0x5e9959,'OpenchannelQueueId':_0x29c333['id']});});});});});});})[_0x7f36('0x16')](respondWithStatusCode(_0x568c24,null))[_0x7f36('0x28')](handleError(_0x568c24,null));};exports[_0x7f36('0x74')]=function(_0x249057,_0x4ff1d0){return db['OpenchannelQueue'][_0x7f36('0x37')]({'where':{'id':_0x249057[_0x7f36('0x2a')]['id']}})[_0x7f36('0x16')](handleEntityNotFound(_0x4ff1d0,null))[_0x7f36('0x16')](function(_0xced7b9){if(_0xced7b9){return _0xced7b9[_0x7f36('0x74')](_0x249057[_0x7f36('0x3b')]['ids'],_[_0x7f36('0x75')](_0x249057['body'],['ids','id'])||{})[_0x7f36('0x76')](function(_0x919114){for(var _0x1d1645=0x0;_0x1d1645<_0x249057[_0x7f36('0x3b')]['ids'][_0x7f36('0x30')];_0x1d1645+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x249057['body'][_0x7f36('0x5d')][_0x1d1645]),'OpenchannelQueueId':Number(_0x249057[_0x7f36('0x2a')]['id'])});}return _0x919114;});}})[_0x7f36('0x16')](respondWithResult(_0x4ff1d0,null))[_0x7f36('0x28')](handleError(_0x4ff1d0,null));};exports['removeAgents']=function(_0x523400,_0x59e0f7){return db[_0x7f36('0x1f')][_0x7f36('0x37')]({'where':{'id':_0x523400[_0x7f36('0x2a')]['id']}})[_0x7f36('0x16')](handleEntityNotFound(_0x59e0f7,null))[_0x7f36('0x16')](function(_0x385181){if(_0x385181){return _0x385181[_0x7f36('0x71')](_0x523400[_0x7f36('0x25')][_0x7f36('0x5d')])['then'](function(){if(_[_0x7f36('0x77')](_0x523400[_0x7f36('0x25')]['ids'])){for(var _0x56fb26=0x0;_0x56fb26<_0x523400['query'][_0x7f36('0x5d')][_0x7f36('0x30')];_0x56fb26+=0x1){socket[_0x7f36('0x5a')](_0x7f36('0x73'),{'UserId':Number(_0x523400[_0x7f36('0x25')][_0x7f36('0x5d')][_0x56fb26]),'OpenchannelQueueId':Number(_0x523400[_0x7f36('0x2a')]['id'])});}}else{socket[_0x7f36('0x5a')](_0x7f36('0x73'),{'UserId':Number(_0x523400[_0x7f36('0x25')][_0x7f36('0x5d')]),'OpenchannelQueueId':Number(_0x523400[_0x7f36('0x2a')]['id'])});}});}})[_0x7f36('0x16')](respondWithStatusCode(_0x59e0f7,null))[_0x7f36('0x28')](handleError(_0x59e0f7,null));};exports[_0x7f36('0x78')]=function(_0x29f092,_0x4ee50a){var _0x587a66={};var _0xd37a53={};var _0xde1922;var _0xbcfecc;return db['OpenchannelQueue'][_0x7f36('0x3d')]({'where':{'id':_0x29f092['params']['id']}})[_0x7f36('0x16')](handleEntityNotFound(_0x4ee50a,null))[_0x7f36('0x16')](function(_0x1275fe){if(_0x1275fe){_0xde1922=_0x1275fe;_0xd37a53[_0x7f36('0x2b')]=_[_0x7f36('0x2c')](db[_0x7f36('0x47')][_0x7f36('0x20')]);_0xd37a53[_0x7f36('0x25')]=_[_0x7f36('0x2c')](_0x29f092['query']);_0xd37a53[_0x7f36('0x42')]=_[_0x7f36('0x2d')](_0xd37a53[_0x7f36('0x2b')],_0xd37a53[_0x7f36('0x25')]);_0x587a66['attributes']=_[_0x7f36('0x2d')](_0xd37a53[_0x7f36('0x2b')],qs[_0x7f36('0x2f')](_0x29f092[_0x7f36('0x25')]['fields']));_0x587a66[_0x7f36('0x2e')]=_0x587a66[_0x7f36('0x2e')]['length']?_0x587a66[_0x7f36('0x2e')]:_0xd37a53['model'];_0x587a66['order']=qs[_0x7f36('0x41')](_0x29f092[_0x7f36('0x25')][_0x7f36('0x41')]);_0x587a66['where']=qs[_0x7f36('0x42')](_['pick'](_0x29f092['query'],_0xd37a53[_0x7f36('0x42')]));if(_0x29f092[_0x7f36('0x25')][_0x7f36('0x45')]){_0x587a66[_0x7f36('0x24')]=_['merge'](_0x587a66['where'],{'$or':_[_0x7f36('0x1e')](_0x587a66[_0x7f36('0x2e')],function(_0x3c28b3){var _0x451f6f={};_0x451f6f[_0x3c28b3]={'$like':'%'+_0x29f092[_0x7f36('0x25')][_0x7f36('0x45')]+'%'};return _0x451f6f;})});}_0x587a66=_[_0x7f36('0x32')]({},_0x587a66,_0x29f092[_0x7f36('0x53')]);return _0xde1922[_0x7f36('0x78')](_0x587a66);}})[_0x7f36('0x16')](function(_0x11e495){if(_0x11e495){_0xbcfecc=_0x11e495[_0x7f36('0x30')];if(!_0x29f092[_0x7f36('0x25')][_0x7f36('0x3e')](_0x7f36('0x3f'))){_0x587a66[_0x7f36('0x10')]=qs['limit'](_0x29f092[_0x7f36('0x25')]['limit']);_0x587a66[_0x7f36('0xe')]=qs[_0x7f36('0xe')](_0x29f092[_0x7f36('0x25')]['offset']);}return _0xde1922[_0x7f36('0x78')](_0x587a66);}})['then'](function(_0x16c709){if(_0x16c709){return _0x16c709?{'count':_0xbcfecc,'rows':_0x16c709}:null;}})[_0x7f36('0x16')](respondWithResult(_0x4ee50a,null))[_0x7f36('0x28')](handleError(_0x4ee50a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index eebb119..a07c539 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 _0xd056=['hasOwnProperty','hook','events','OpenchannelQueue','setMaxListeners','save','update','remove','emit'];(function(_0x47c540,_0x223bfe){var _0x314478=function(_0x1f5066){while(--_0x1f5066){_0x47c540['push'](_0x47c540['shift']());}};_0x314478(++_0x223bfe);}(_0xd056,0xb6));var _0x6d05=function(_0x10521f,_0x1a2e8d){_0x10521f=_0x10521f-0x0;var _0x5db207=_0xd056[_0x10521f];return _0x5db207;};'use strict';var EventEmitter=require(_0x6d05('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x6d05('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x6d05('0x2')](0x0);var events={'afterCreate':_0x6d05('0x3'),'afterUpdate':_0x6d05('0x4'),'afterDestroy':_0x6d05('0x5')};function emitEvent(_0x66614){return function(_0x520ec9,_0x5f08ed,_0x19a2b2){OpenchannelQueueEvents['emit'](_0x66614+':'+_0x520ec9['id'],_0x520ec9);OpenchannelQueueEvents[_0x6d05('0x6')](_0x66614,_0x520ec9);_0x19a2b2(null);};}for(var e in events){if(events[_0x6d05('0x7')](e)){var event=events[e];OpenchannelQueue[_0x6d05('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x0447=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x2f10d2,_0x53c9c3){var _0x113f48=function(_0x18bd5a){while(--_0x18bd5a){_0x2f10d2['push'](_0x2f10d2['shift']());}};_0x113f48(++_0x53c9c3);}(_0x0447,0x1f0));var _0x7044=function(_0x201d8e,_0x46f74b){_0x201d8e=_0x201d8e-0x0;var _0x403d73=_0x0447[_0x201d8e];return _0x403d73;};'use strict';var EventEmitter=require(_0x7044('0x0'));var OpenchannelQueue=require(_0x7044('0x1'))['db'][_0x7044('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x7044('0x3')](0x0);var events={'afterCreate':_0x7044('0x4'),'afterUpdate':_0x7044('0x5'),'afterDestroy':_0x7044('0x6')};function emitEvent(_0x7b9a5c){return function(_0x4c1179,_0x2e88e0,_0xce1320){OpenchannelQueueEvents['emit'](_0x7b9a5c+':'+_0x4c1179['id'],_0x4c1179);OpenchannelQueueEvents[_0x7044('0x7')](_0x7b9a5c,_0x4c1179);_0xce1320(null);};}for(var e in events){if(events[_0x7044('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x7044('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 2172a56..7181957 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 _0x09b2=['request-promise','path','rimraf','../../config/environment','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5730da,_0x888aca){var _0x2d39e4=function(_0x29e4c0){while(--_0x29e4c0){_0x5730da['push'](_0x5730da['shift']());}};_0x2d39e4(++_0x888aca);}(_0x09b2,0x130));var _0x209b=function(_0xf53592,_0x3dc16b){_0xf53592=_0xf53592-0x0;var _0x1ed713=_0x09b2[_0xf53592];return _0x1ed713;};'use strict';var _=require(_0x209b('0x0'));var util=require(_0x209b('0x1'));var logger=require(_0x209b('0x2'))(_0x209b('0x3'));var moment=require(_0x209b('0x4'));var BPromise=require(_0x209b('0x5'));var rp=require(_0x209b('0x6'));var fs=require('fs');var path=require(_0x209b('0x7'));var rimraf=require(_0x209b('0x8'));var config=require(_0x209b('0x9'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0xe74a2d,_0x2dbfe0){return _0xe74a2d['define']('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0706=['rimraf','./openchannelQueue.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x47be0c,_0x44a438){var _0x40bf94=function(_0x2aea7d){while(--_0x2aea7d){_0x47be0c['push'](_0x47be0c['shift']());}};_0x40bf94(++_0x44a438);}(_0x0706,0x1d9));var _0x6070=function(_0x466ca5,_0x4d0eab){_0x466ca5=_0x466ca5-0x0;var _0x5207c5=_0x0706[_0x466ca5];return _0x5207c5;};'use strict';var _=require(_0x6070('0x0'));var util=require(_0x6070('0x1'));var logger=require(_0x6070('0x2'))(_0x6070('0x3'));var moment=require(_0x6070('0x4'));var BPromise=require(_0x6070('0x5'));var rp=require(_0x6070('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6070('0x7'));var config=require('../../config/environment');var attributes=require(_0x6070('0x8'));module[_0x6070('0x9')]=function(_0x51dfdf,_0x1455dc){return _0x51dfdf['define']('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','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 8c58c93..34e6760 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 _0xd9ba=['info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowOpenchannelQueue','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','register','request','then'];(function(_0x108715,_0x3d57ce){var _0x32a07e=function(_0x27f85d){while(--_0x27f85d){_0x108715['push'](_0x108715['shift']());}};_0x32a07e(++_0x3d57ce);}(_0xd9ba,0x1de));var _0xad9b=function(_0x375945,_0x20768d){_0x375945=_0x375945-0x0;var _0x4b2287=_0xd9ba[_0x375945];return _0x4b2287;};'use strict';var _=require('lodash');var util=require(_0xad9b('0x0'));var moment=require(_0xad9b('0x1'));var BPromise=require('bluebird');var rs=require(_0xad9b('0x2'));var fs=require('fs');var Redis=require(_0xad9b('0x3'));var db=require(_0xad9b('0x4'))['db'];var utils=require(_0xad9b('0x5'));var logger=require(_0xad9b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad9b('0x7'));var client=jayson[_0xad9b('0x8')][_0xad9b('0x9')]({'port':0x232a});config[_0xad9b('0xa')]=_[_0xad9b('0xb')](config[_0xad9b('0xa')],{'host':_0xad9b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0xad9b('0xd')](socket);function respondWithRpcPromise(_0x22f445,_0x28f161,_0x438a1){return new BPromise(function(_0x4d3505,_0x4cdd04){return client[_0xad9b('0xe')](_0x22f445,_0x438a1)[_0xad9b('0xf')](function(_0x2aa37e){logger[_0xad9b('0x10')](_0xad9b('0x11'),_0x28f161,_0xad9b('0x12'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x28f161,'request\x20sent',JSON[_0xad9b('0x13')](_0x2aa37e));if(_0x2aa37e[_0xad9b('0x14')]){if(_0x2aa37e[_0xad9b('0x14')][_0xad9b('0x15')]===0x1f4){logger[_0xad9b('0x14')](_0xad9b('0x11'),_0x28f161,_0x2aa37e[_0xad9b('0x14')][_0xad9b('0x16')]);return _0x4cdd04(_0x2aa37e['error'][_0xad9b('0x16')]);}logger[_0xad9b('0x14')](_0xad9b('0x11'),_0x28f161,_0x2aa37e[_0xad9b('0x14')][_0xad9b('0x16')]);return _0x4d3505(_0x2aa37e[_0xad9b('0x14')][_0xad9b('0x16')]);}else{logger[_0xad9b('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x28f161,_0xad9b('0x12'));_0x4d3505(_0x2aa37e['result']['message']);}})[_0xad9b('0x17')](function(_0xafd8d2){logger[_0xad9b('0x14')](_0xad9b('0x11'),_0x28f161,_0xafd8d2);_0x4cdd04(_0xafd8d2);});});}exports[_0xad9b('0x18')]=function(_0x29b39d){var _0x5c44d4=this;return new Promise(function(_0x1bf73c,_0xf98f3b){return db[_0xad9b('0x19')][_0xad9b('0x1a')]({'raw':_0x29b39d[_0xad9b('0x1b')]?_0x29b39d[_0xad9b('0x1b')][_0xad9b('0x1c')]===undefined?!![]:![]:!![],'where':_0x29b39d[_0xad9b('0x1b')]?_0x29b39d[_0xad9b('0x1b')][_0xad9b('0x1d')]||null:null,'attributes':_0x29b39d[_0xad9b('0x1b')]?_0x29b39d[_0xad9b('0x1b')]['attributes']||null:null,'limit':_0x29b39d[_0xad9b('0x1b')]?_0x29b39d['options'][_0xad9b('0x1e')]||null:null,'include':_0x29b39d['options']?_0x29b39d[_0xad9b('0x1b')][_0xad9b('0x1f')]?_[_0xad9b('0x20')](_0x29b39d[_0xad9b('0x1b')]['include'],function(_0x44fdba){return{'model':db[_0x44fdba[_0xad9b('0x21')]],'as':_0x44fdba['as'],'attributes':_0x44fdba['attributes'],'include':_0x44fdba[_0xad9b('0x1f')]?_[_0xad9b('0x20')](_0x44fdba['include'],function(_0x46d36c){return{'model':db[_0x46d36c[_0xad9b('0x21')]],'as':_0x46d36c['as'],'attributes':_0x46d36c['attributes'],'include':_0x46d36c['include']?_[_0xad9b('0x20')](_0x46d36c['include'],function(_0x3c9002){return{'model':db[_0x3c9002[_0xad9b('0x21')]],'as':_0x3c9002['as'],'attributes':_0x3c9002[_0xad9b('0x22')]};}):[]};}):[]};}):[]:[]})[_0xad9b('0xf')](function(_0x5752b5){logger[_0xad9b('0x10')](_0xad9b('0x18'),_0x29b39d);logger['debug']('GetOpenchannelQueue',_0x29b39d,JSON[_0xad9b('0x13')](_0x5752b5));_0x1bf73c(_0x5752b5);})[_0xad9b('0x17')](function(_0x2f559f){logger['error']('GetOpenchannelQueue',_0x2f559f['message'],_0x29b39d);_0xf98f3b(_0x5c44d4[_0xad9b('0x14')](0x1f4,_0x2f559f[_0xad9b('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x43e7d2){var _0x2b06e7=this;return new Promise(function(_0x157e9d,_0x5373b9){return db[_0xad9b('0x19')][_0xad9b('0x23')]({'raw':_0x43e7d2[_0xad9b('0x1b')]?_0x43e7d2['options'][_0xad9b('0x1c')]===undefined?!![]:![]:!![],'where':_0x43e7d2['options']?_0x43e7d2['options']['where']||null:null,'attributes':_0x43e7d2['options']?_0x43e7d2[_0xad9b('0x1b')]['attributes']||null:null,'include':_0x43e7d2[_0xad9b('0x1b')]?_0x43e7d2[_0xad9b('0x1b')][_0xad9b('0x1f')]?_[_0xad9b('0x20')](_0x43e7d2[_0xad9b('0x1b')]['include'],function(_0x1079b8){return{'model':db[_0x1079b8['model']],'as':_0x1079b8['as'],'attributes':_0x1079b8[_0xad9b('0x22')],'include':_0x1079b8[_0xad9b('0x1f')]?_[_0xad9b('0x20')](_0x1079b8[_0xad9b('0x1f')],function(_0x589ce2){return{'model':db[_0x589ce2[_0xad9b('0x21')]],'as':_0x589ce2['as'],'attributes':_0x589ce2[_0xad9b('0x22')],'include':_0x589ce2[_0xad9b('0x1f')]?_['map'](_0x589ce2[_0xad9b('0x1f')],function(_0x4f07c1){return{'model':db[_0x4f07c1[_0xad9b('0x21')]],'as':_0x4f07c1['as'],'attributes':_0x4f07c1[_0xad9b('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f606b){logger[_0xad9b('0x10')](_0xad9b('0x24'),_0x43e7d2);logger[_0xad9b('0x25')]('ShowOpenchannelQueue',_0x43e7d2,JSON['stringify'](_0x1f606b));_0x157e9d(_0x1f606b);})[_0xad9b('0x17')](function(_0x108902){logger[_0xad9b('0x14')](_0xad9b('0x24'),_0x108902[_0xad9b('0x16')],_0x43e7d2);_0x5373b9(_0x2b06e7[_0xad9b('0x14')](0x1f4,_0x108902[_0xad9b('0x16')]));});});}; \ No newline at end of file +var _0xcf4b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','OpenchannelQueue','findAll','options','raw','where','limit','include','model','attributes','map','GetOpenchannelQueue','ShowOpenchannelQueue','lodash','util','moment','randomstring'];(function(_0xbce261,_0x5bf87e){var _0x23848f=function(_0x582169){while(--_0x582169){_0xbce261['push'](_0xbce261['shift']());}};_0x23848f(++_0x5bf87e);}(_0xcf4b,0x1a0));var _0xbcf4=function(_0x5b398f,_0x26bc95){_0x5b398f=_0x5b398f-0x0;var _0x27dbad=_0xcf4b[_0x5b398f];return _0x27dbad;};'use strict';var _=require(_0xbcf4('0x0'));var util=require(_0xbcf4('0x1'));var moment=require(_0xbcf4('0x2'));var BPromise=require('bluebird');var rs=require(_0xbcf4('0x3'));var fs=require('fs');var Redis=require(_0xbcf4('0x4'));var db=require(_0xbcf4('0x5'))['db'];var utils=require(_0xbcf4('0x6'));var logger=require(_0xbcf4('0x7'))('rpc');var config=require(_0xbcf4('0x8'));var jayson=require(_0xbcf4('0x9'));var client=jayson[_0xbcf4('0xa')]['http']({'port':0x232a});config[_0xbcf4('0xb')]=_[_0xbcf4('0xc')](config[_0xbcf4('0xb')],{'host':_0xbcf4('0xd'),'port':0x18eb});var socket=require(_0xbcf4('0xe'))(new Redis(config[_0xbcf4('0xb')]));require(_0xbcf4('0xf'))[_0xbcf4('0x10')](socket);function respondWithRpcPromise(_0x1a84d4,_0xa7a988,_0x56c1b8){return new BPromise(function(_0x4e4f6b,_0x42310f){return client[_0xbcf4('0x11')](_0x1a84d4,_0x56c1b8)[_0xbcf4('0x12')](function(_0x153add){logger[_0xbcf4('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0xa7a988,'request\x20sent');logger[_0xbcf4('0x14')](_0xbcf4('0x15'),_0xa7a988,_0xbcf4('0x16'),JSON[_0xbcf4('0x17')](_0x153add));if(_0x153add[_0xbcf4('0x18')]){if(_0x153add[_0xbcf4('0x18')][_0xbcf4('0x19')]===0x1f4){logger[_0xbcf4('0x18')](_0xbcf4('0x1a'),_0xa7a988,_0x153add['error'][_0xbcf4('0x1b')]);return _0x42310f(_0x153add[_0xbcf4('0x18')][_0xbcf4('0x1b')]);}logger['error'](_0xbcf4('0x1a'),_0xa7a988,_0x153add[_0xbcf4('0x18')]['message']);return _0x4e4f6b(_0x153add['error'][_0xbcf4('0x1b')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0xa7a988,_0xbcf4('0x16'));_0x4e4f6b(_0x153add[_0xbcf4('0x1c')]['message']);}})[_0xbcf4('0x1d')](function(_0xd92e9a){logger[_0xbcf4('0x18')](_0xbcf4('0x1a'),_0xa7a988,_0xd92e9a);_0x42310f(_0xd92e9a);});});}exports['GetOpenchannelQueue']=function(_0x38fa96){var _0xa1468d=this;return new Promise(function(_0xe279a0,_0x2e5a79){return db[_0xbcf4('0x1e')][_0xbcf4('0x1f')]({'raw':_0x38fa96[_0xbcf4('0x20')]?_0x38fa96[_0xbcf4('0x20')][_0xbcf4('0x21')]===undefined?!![]:![]:!![],'where':_0x38fa96[_0xbcf4('0x20')]?_0x38fa96[_0xbcf4('0x20')][_0xbcf4('0x22')]||null:null,'attributes':_0x38fa96[_0xbcf4('0x20')]?_0x38fa96['options']['attributes']||null:null,'limit':_0x38fa96['options']?_0x38fa96[_0xbcf4('0x20')][_0xbcf4('0x23')]||null:null,'include':_0x38fa96[_0xbcf4('0x20')]?_0x38fa96['options'][_0xbcf4('0x24')]?_['map'](_0x38fa96[_0xbcf4('0x20')][_0xbcf4('0x24')],function(_0x22d742){return{'model':db[_0x22d742[_0xbcf4('0x25')]],'as':_0x22d742['as'],'attributes':_0x22d742['attributes'],'include':_0x22d742[_0xbcf4('0x24')]?_['map'](_0x22d742[_0xbcf4('0x24')],function(_0x69249b){return{'model':db[_0x69249b['model']],'as':_0x69249b['as'],'attributes':_0x69249b[_0xbcf4('0x26')],'include':_0x69249b[_0xbcf4('0x24')]?_[_0xbcf4('0x27')](_0x69249b[_0xbcf4('0x24')],function(_0x2f5390){return{'model':db[_0x2f5390[_0xbcf4('0x25')]],'as':_0x2f5390['as'],'attributes':_0x2f5390[_0xbcf4('0x26')]};}):[]};}):[]};}):[]:[]})[_0xbcf4('0x12')](function(_0x5c7843){logger[_0xbcf4('0x13')](_0xbcf4('0x28'),_0x38fa96);logger[_0xbcf4('0x14')](_0xbcf4('0x28'),_0x38fa96,JSON[_0xbcf4('0x17')](_0x5c7843));_0xe279a0(_0x5c7843);})[_0xbcf4('0x1d')](function(_0x5a6994){logger['error']('GetOpenchannelQueue',_0x5a6994[_0xbcf4('0x1b')],_0x38fa96);_0x2e5a79(_0xa1468d[_0xbcf4('0x18')](0x1f4,_0x5a6994['message']));});});};exports['ShowOpenchannelQueue']=function(_0x538c0b){var _0x520b40=this;return new Promise(function(_0x4789d8,_0x3bf7b9){return db[_0xbcf4('0x1e')]['find']({'raw':_0x538c0b[_0xbcf4('0x20')]?_0x538c0b[_0xbcf4('0x20')][_0xbcf4('0x21')]===undefined?!![]:![]:!![],'where':_0x538c0b['options']?_0x538c0b['options'][_0xbcf4('0x22')]||null:null,'attributes':_0x538c0b[_0xbcf4('0x20')]?_0x538c0b[_0xbcf4('0x20')][_0xbcf4('0x26')]||null:null,'include':_0x538c0b[_0xbcf4('0x20')]?_0x538c0b['options'][_0xbcf4('0x24')]?_[_0xbcf4('0x27')](_0x538c0b['options'][_0xbcf4('0x24')],function(_0x49160e){return{'model':db[_0x49160e['model']],'as':_0x49160e['as'],'attributes':_0x49160e['attributes'],'include':_0x49160e[_0xbcf4('0x24')]?_[_0xbcf4('0x27')](_0x49160e[_0xbcf4('0x24')],function(_0x49099c){return{'model':db[_0x49099c[_0xbcf4('0x25')]],'as':_0x49099c['as'],'attributes':_0x49099c[_0xbcf4('0x26')],'include':_0x49099c[_0xbcf4('0x24')]?_[_0xbcf4('0x27')](_0x49099c['include'],function(_0x46790f){return{'model':db[_0x46790f['model']],'as':_0x46790f['as'],'attributes':_0x46790f[_0xbcf4('0x26')]};}):[]};}):[]};}):[]:[]})[_0xbcf4('0x12')](function(_0x5c4ac3){logger[_0xbcf4('0x13')](_0xbcf4('0x29'),_0x538c0b);logger[_0xbcf4('0x14')](_0xbcf4('0x29'),_0x538c0b,JSON['stringify'](_0x5c4ac3));_0x4789d8(_0x5c4ac3);})[_0xbcf4('0x1d')](function(_0xe841c0){logger[_0xbcf4('0x18')]('ShowOpenchannelQueue',_0xe841c0['message'],_0x538c0b);_0x3bf7b9(_0x520b40[_0xbcf4('0x18')](0x1f4,_0xe841c0[_0xbcf4('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 0c9e7e4..a637eaf 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 _0x0ffb=['length','./openchannelQueue.events','save','remove','update','emit','register'];(function(_0x3763da,_0x58158b){var _0x5d192f=function(_0x329668){while(--_0x329668){_0x3763da['push'](_0x3763da['shift']());}};_0x5d192f(++_0x58158b);}(_0x0ffb,0x151));var _0xb0ff=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0ffb[_0xa464c9];return _0x3d73c4;};'use strict';var OpenchannelQueueEvents=require(_0xb0ff('0x0'));var events=[_0xb0ff('0x1'),_0xb0ff('0x2'),_0xb0ff('0x3')];function createListener(_0x27c25c,_0x83aa4a){return function(_0x769a0){_0x83aa4a[_0xb0ff('0x4')](_0x27c25c,_0x769a0);};}function removeListener(_0x46740e,_0x44d7f1){return function(){OpenchannelQueueEvents['removeListener'](_0x46740e,_0x44d7f1);};}exports[_0xb0ff('0x5')]=function(_0x2ae961){for(var _0x2ffef0=0x0,_0x58b431=events[_0xb0ff('0x6')];_0x2ffef0<_0x58b431;_0x2ffef0++){var _0xa516bd=events[_0x2ffef0];var _0x4bff97=createListener('openchannelQueue:'+_0xa516bd,_0x2ae961);OpenchannelQueueEvents['on'](_0xa516bd,_0x4bff97);}}; \ No newline at end of file +var _0xd81d=['./openchannelQueue.events','remove','update','removeListener','register'];(function(_0x458e33,_0x4f8045){var _0x5109b0=function(_0x3fdf6f){while(--_0x3fdf6f){_0x458e33['push'](_0x458e33['shift']());}};_0x5109b0(++_0x4f8045);}(_0xd81d,0x9b));var _0xdd81=function(_0x1d40f4,_0x25a15d){_0x1d40f4=_0x1d40f4-0x0;var _0x36b59e=_0xd81d[_0x1d40f4];return _0x36b59e;};'use strict';var OpenchannelQueueEvents=require(_0xdd81('0x0'));var events=['save',_0xdd81('0x1'),_0xdd81('0x2')];function createListener(_0x496dac,_0x59bffa){return function(_0x151c0f){_0x59bffa['emit'](_0x496dac,_0x151c0f);};}function removeListener(_0x1970ac,_0x1e0603){return function(){OpenchannelQueueEvents[_0xdd81('0x3')](_0x1970ac,_0x1e0603);};}exports[_0xdd81('0x4')]=function(_0x27d9f6){for(var _0x41b308=0x0,_0x56b8e1=events['length'];_0x41b308<_0x56b8e1;_0x41b308++){var _0x25cb87=events[_0x41b308];var _0x1a3ece=createListener('openchannelQueue:'+_0x25cb87,_0x27d9f6);OpenchannelQueueEvents['on'](_0x25cb87,_0x1a3ece);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index c132260..22e9ccf 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 _0xafa7=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post','put','destroy','exports','multer','path'];(function(_0x495374,_0x2f7e8e){var _0x6dd711=function(_0x188f9d){while(--_0x188f9d){_0x495374['push'](_0x495374['shift']());}};_0x6dd711(++_0x2f7e8e);}(_0xafa7,0x17a));var _0x7afa=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0xafa7[_0xcd0918];return _0x250704;};'use strict';var multer=require(_0x7afa('0x0'));var util=require('util');var path=require(_0x7afa('0x1'));var timeout=require(_0x7afa('0x2'));var express=require(_0x7afa('0x3'));var router=express['Router']();var fs_extra=require(_0x7afa('0x4'));var auth=require(_0x7afa('0x5'));var interaction=require(_0x7afa('0x6'));var config=require(_0x7afa('0x7'));var controller=require(_0x7afa('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7afa('0x9')]);router[_0x7afa('0xa')](_0x7afa('0xb'),auth[_0x7afa('0xc')](),controller[_0x7afa('0xd')]);router[_0x7afa('0xa')](_0x7afa('0xe'),auth[_0x7afa('0xc')](),controller['show']);router[_0x7afa('0xf')]('/',auth[_0x7afa('0xc')](),controller['create']);router[_0x7afa('0x10')](_0x7afa('0xe'),auth[_0x7afa('0xc')](),controller['update']);router['delete'](_0x7afa('0xe'),auth[_0x7afa('0xc')](),controller[_0x7afa('0x11')]);module[_0x7afa('0x12')]=router; \ No newline at end of file +var _0xa9c6=['../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1bd11c,_0x1b761a){var _0x4c287b=function(_0x29aa88){while(--_0x29aa88){_0x1bd11c['push'](_0x1bd11c['shift']());}};_0x4c287b(++_0x1b761a);}(_0xa9c6,0x1c6));var _0x6a9c=function(_0x5ebad6,_0x4495a6){_0x5ebad6=_0x5ebad6-0x0;var _0x5ea13b=_0xa9c6[_0x5ebad6];return _0x5ea13b;};'use strict';var multer=require(_0x6a9c('0x0'));var util=require(_0x6a9c('0x1'));var path=require(_0x6a9c('0x2'));var timeout=require(_0x6a9c('0x3'));var express=require('express');var router=express[_0x6a9c('0x4')]();var fs_extra=require(_0x6a9c('0x5'));var auth=require(_0x6a9c('0x6'));var interaction=require(_0x6a9c('0x7'));var config=require(_0x6a9c('0x8'));var controller=require(_0x6a9c('0x9'));router[_0x6a9c('0xa')]('/',auth[_0x6a9c('0xb')](),controller[_0x6a9c('0xc')]);router[_0x6a9c('0xa')](_0x6a9c('0xd'),auth[_0x6a9c('0xb')](),controller[_0x6a9c('0xe')]);router[_0x6a9c('0xa')](_0x6a9c('0xf'),auth[_0x6a9c('0xb')](),controller[_0x6a9c('0x10')]);router[_0x6a9c('0x11')]('/',auth[_0x6a9c('0xb')](),controller[_0x6a9c('0x12')]);router[_0x6a9c('0x13')](_0x6a9c('0xf'),auth[_0x6a9c('0xb')](),controller['update']);router['delete'](_0x6a9c('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6a9c('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 94a1675..dcc99ab 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 _0x5df9=['STRING','DATE','sequelize','exports'];(function(_0x47bc34,_0x5c3923){var _0x1f75ac=function(_0x40ec4a){while(--_0x40ec4a){_0x47bc34['push'](_0x47bc34['shift']());}};_0x1f75ac(++_0x5c3923);}(_0x5df9,0xea));var _0x95df=function(_0x45555d,_0x3f82db){_0x45555d=_0x45555d-0x0;var _0x5971c9=_0x5df9[_0x45555d];return _0x5971c9;};'use strict';var moment=require('moment');var Sequelize=require(_0x95df('0x0'));module[_0x95df('0x1')]={'uniqueid':{'type':Sequelize[_0x95df('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x95df('0x3')]},'acceptAt':{'type':Sequelize[_0x95df('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x95df('0x2')]}}; \ No newline at end of file +var _0x87fc=['STRING','DATE'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x87fc,0xaa));var _0xc87f=function(_0x4aa7f4,_0x4bb0dc){_0x4aa7f4=_0x4aa7f4-0x0;var _0xa87ac0=_0x87fc[_0x4aa7f4];return _0xa87ac0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xc87f('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xc87f('0x0')]},'joinAt':{'type':Sequelize[_0xc87f('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc87f('0x1')]},'exitAt':{'type':Sequelize[_0xc87f('0x1')]},'reason':{'type':Sequelize[_0xc87f('0x0')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a280a81..ef9ca67 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 _0xeeec=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filters','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','params','keys','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x2f43cc,_0x55932d){var _0x2432b5=function(_0x16a706){while(--_0x16a706){_0x2f43cc['push'](_0x2f43cc['shift']());}};_0x2432b5(++_0x55932d);}(_0xeeec,0x1ef));var _0xceee=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xeeec[_0x1a72f3];return _0x57ef47;};'use strict';var emlformat=require(_0xceee('0x0'));var rimraf=require(_0xceee('0x1'));var zipdir=require(_0xceee('0x2'));var jsonpatch=require(_0xceee('0x3'));var rp=require(_0xceee('0x4'));var moment=require('moment');var BPromise=require(_0xceee('0x5'));var Mustache=require(_0xceee('0x6'));var util=require(_0xceee('0x7'));var path=require(_0xceee('0x8'));var sox=require(_0xceee('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xceee('0xa'));var squel=require(_0xceee('0xb'));var crypto=require(_0xceee('0xc'));var jsforce=require(_0xceee('0xd'));var deskjs=require(_0xceee('0xe'));var toCsv=require('to-csv');var querystring=require(_0xceee('0xf'));var Papa=require(_0xceee('0x10'));var Redis=require('ioredis');var authService=require(_0xceee('0x11'));var qs=require(_0xceee('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xceee('0x13'));var logger=require(_0xceee('0x14'))(_0xceee('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xceee('0x16'));var db=require(_0xceee('0x17'))['db'];function respondWithStatusCode(_0x323e6e,_0x339676){_0x339676=_0x339676||0xcc;return function(_0x1889dd){if(_0x1889dd){return _0x323e6e[_0xceee('0x18')](_0x339676);}return _0x323e6e[_0xceee('0x19')](_0x339676)[_0xceee('0x1a')]();};}function respondWithResult(_0xa2079e,_0x3a611b){_0x3a611b=_0x3a611b||0xc8;return function(_0x298b3a){if(_0x298b3a){return _0xa2079e[_0xceee('0x19')](_0x3a611b)[_0xceee('0x1b')](_0x298b3a);}};}function respondWithFilteredResult(_0x87a3b6,_0x42304e){return function(_0x10b942){if(_0x10b942){var _0x3015ca=typeof _0x42304e[_0xceee('0x1c')]===_0xceee('0x1d')&&typeof _0x42304e['limit']===_0xceee('0x1d');var _0x2ac89a=_0x10b942[_0xceee('0x1e')];var _0x388160=_0x3015ca?0x0:_0x42304e[_0xceee('0x1c')];var _0x3b8294=_0x3015ca?_0x10b942[_0xceee('0x1e')]:_0x42304e[_0xceee('0x1c')]+_0x42304e['limit'];var _0x209b4d;if(_0x3b8294>=_0x2ac89a){_0x3b8294=_0x2ac89a;_0x209b4d=0xc8;}else{_0x209b4d=0xce;}_0x87a3b6[_0xceee('0x19')](_0x209b4d);return _0x87a3b6[_0xceee('0x1f')](_0xceee('0x20'),_0x388160+'-'+_0x3b8294+'/'+_0x2ac89a)[_0xceee('0x1b')](_0x10b942);}return null;};}function patchUpdates(_0x685244){return function(_0x53ed8e){try{jsonpatch[_0xceee('0x21')](_0x53ed8e,_0x685244,!![]);}catch(_0x5c23d4){return BPromise[_0xceee('0x22')](_0x5c23d4);}return _0x53ed8e[_0xceee('0x23')]();};}function saveUpdates(_0x4d0662,_0x2b8b44){return function(_0x5b6e0b){if(_0x5b6e0b){return _0x5b6e0b[_0xceee('0x24')](_0x4d0662)[_0xceee('0x25')](function(_0x52a3e3){return _0x52a3e3;});}return null;};}function removeEntity(_0x2035e2,_0x163de7){return function(_0x32eebe){if(_0x32eebe){return _0x32eebe[_0xceee('0x26')]()[_0xceee('0x25')](function(){_0x2035e2[_0xceee('0x19')](0xcc)[_0xceee('0x1a')]();});}};}function handleEntityNotFound(_0x29233f,_0x243b53){return function(_0x19d2e7){if(!_0x19d2e7){_0x29233f[_0xceee('0x18')](0x194);}return _0x19d2e7;};}function handleError(_0x380225,_0x569e41){_0x569e41=_0x569e41||0x1f4;return function(_0x214bde){logger[_0xceee('0x27')](_0x214bde['stack']);if(_0x214bde[_0xceee('0x28')]){delete _0x214bde['name'];}_0x380225['status'](_0x569e41)['send'](_0x214bde);};}exports['index']=function(_0x2ba051,_0x973681){var _0x2d434d={},_0x55a461={},_0x29b46f={'count':0x0,'rows':[]};var _0x4a3bdb=_[_0xceee('0x29')](db[_0xceee('0x2a')][_0xceee('0x2b')],function(_0x315fbe){return{'name':_0x315fbe[_0xceee('0x2c')],'type':_0x315fbe[_0xceee('0x2d')][_0xceee('0x2e')]};});_0x55a461[_0xceee('0x2f')]=_[_0xceee('0x29')](_0x4a3bdb,_0xceee('0x28'));_0x55a461[_0xceee('0x30')]=_['keys'](_0x2ba051[_0xceee('0x30')]);_0x55a461['filters']=_[_0xceee('0x31')](_0x55a461['model'],_0x55a461[_0xceee('0x30')]);_0x2d434d['attributes']=_[_0xceee('0x31')](_0x55a461[_0xceee('0x2f')],qs[_0xceee('0x32')](_0x2ba051[_0xceee('0x30')][_0xceee('0x32')]));_0x2d434d[_0xceee('0x33')]=_0x2d434d['attributes'][_0xceee('0x34')]?_0x2d434d[_0xceee('0x33')]:_0x55a461['model'];if(!_0x2ba051[_0xceee('0x30')][_0xceee('0x35')](_0xceee('0x36'))){_0x2d434d[_0xceee('0x37')]=qs[_0xceee('0x37')](_0x2ba051[_0xceee('0x30')][_0xceee('0x37')]);_0x2d434d[_0xceee('0x1c')]=qs[_0xceee('0x1c')](_0x2ba051[_0xceee('0x30')][_0xceee('0x1c')]);}_0x2d434d['order']=qs[_0xceee('0x38')](_0x2ba051[_0xceee('0x30')][_0xceee('0x38')]);_0x2d434d['where']=qs[_0xceee('0x39')](_['pick'](_0x2ba051[_0xceee('0x30')],_0x55a461[_0xceee('0x39')]),_0x4a3bdb);if(_0x2ba051[_0xceee('0x30')][_0xceee('0x3a')]){_0x2d434d[_0xceee('0x3b')]=_[_0xceee('0x3c')](_0x2d434d[_0xceee('0x3b')],{'$or':_[_0xceee('0x29')](_0x4a3bdb,function(_0x27e147){if(_0x27e147[_0xceee('0x2d')]!==_0xceee('0x3d')){var _0x257c6e={};_0x257c6e[_0x27e147[_0xceee('0x28')]]={'$like':'%'+_0x2ba051[_0xceee('0x30')][_0xceee('0x3a')]+'%'};return _0x257c6e;}})});}_0x2d434d=_[_0xceee('0x3c')]({},_0x2d434d,_0x2ba051['options']);var _0x5c5dcd={'where':_0x2d434d[_0xceee('0x3b')]};return db[_0xceee('0x2a')][_0xceee('0x1e')](_0x5c5dcd)[_0xceee('0x25')](function(_0x46e2fc){_0x29b46f[_0xceee('0x1e')]=_0x46e2fc;if(_0x2ba051[_0xceee('0x30')][_0xceee('0x3e')]){_0x2d434d['include']=[{'all':!![]}];}return db[_0xceee('0x2a')][_0xceee('0x3f')](_0x2d434d);})['then'](function(_0xa8510a){_0x29b46f[_0xceee('0x40')]=_0xa8510a;return _0x29b46f;})[_0xceee('0x25')](respondWithFilteredResult(_0x973681,_0x2d434d))[_0xceee('0x41')](handleError(_0x973681,null));};exports['show']=function(_0x46292c,_0x50cd8a){var _0x5c2ddb={'raw':!![],'where':{'id':_0x46292c[_0xceee('0x42')]['id']}},_0x5c2137={};_0x5c2137[_0xceee('0x2f')]=_[_0xceee('0x43')](db[_0xceee('0x2a')][_0xceee('0x2b')]);_0x5c2137['query']=_[_0xceee('0x43')](_0x46292c[_0xceee('0x30')]);_0x5c2137[_0xceee('0x39')]=_[_0xceee('0x31')](_0x5c2137[_0xceee('0x2f')],_0x5c2137[_0xceee('0x30')]);_0x5c2ddb[_0xceee('0x33')]=_['intersection'](_0x5c2137[_0xceee('0x2f')],qs['fields'](_0x46292c[_0xceee('0x30')][_0xceee('0x32')]));_0x5c2ddb[_0xceee('0x33')]=_0x5c2ddb['attributes'][_0xceee('0x34')]?_0x5c2ddb[_0xceee('0x33')]:_0x5c2137[_0xceee('0x2f')];if(_0x46292c[_0xceee('0x30')][_0xceee('0x3e')]){_0x5c2ddb[_0xceee('0x44')]=[{'all':!![]}];}_0x5c2ddb=_[_0xceee('0x3c')]({},_0x5c2ddb,_0x46292c[_0xceee('0x45')]);return db['OpenchannelQueueReport'][_0xceee('0x46')](_0x5c2ddb)[_0xceee('0x25')](handleEntityNotFound(_0x50cd8a,null))[_0xceee('0x25')](respondWithResult(_0x50cd8a,null))[_0xceee('0x41')](handleError(_0x50cd8a,null));};exports[_0xceee('0x47')]=function(_0x727ac0,_0x5c1b6c){return db['OpenchannelQueueReport'][_0xceee('0x47')](_0x727ac0[_0xceee('0x48')],{})[_0xceee('0x25')](respondWithResult(_0x5c1b6c,0xc9))[_0xceee('0x41')](handleError(_0x5c1b6c,null));};exports[_0xceee('0x24')]=function(_0x4cb941,_0x47bf5e){if(_0x4cb941[_0xceee('0x48')]['id']){delete _0x4cb941[_0xceee('0x48')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x4cb941['params']['id']}})[_0xceee('0x25')](handleEntityNotFound(_0x47bf5e,null))[_0xceee('0x25')](saveUpdates(_0x4cb941[_0xceee('0x48')],null))[_0xceee('0x25')](respondWithResult(_0x47bf5e,null))[_0xceee('0x41')](handleError(_0x47bf5e,null));};exports[_0xceee('0x26')]=function(_0x2527d7,_0x2be915){return db[_0xceee('0x2a')][_0xceee('0x46')]({'where':{'id':_0x2527d7[_0xceee('0x42')]['id']}})['then'](handleEntityNotFound(_0x2be915,null))[_0xceee('0x25')](removeEntity(_0x2be915,null))[_0xceee('0x41')](handleError(_0x2be915,null));};exports['describe']=function(_0x1a7ffc,_0x7f43cb){return db['OpenchannelQueueReport']['describe']()[_0xceee('0x25')](respondWithResult(_0x7f43cb,null))['catch'](handleError(_0x7f43cb,null));}; \ No newline at end of file +var _0xa2fd=['api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','OpenchannelQueueReport','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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'];(function(_0x95f2e1,_0x20396){var _0x269cda=function(_0x82af7){while(--_0x82af7){_0x95f2e1['push'](_0x95f2e1['shift']());}};_0x269cda(++_0x20396);}(_0xa2fd,0x83));var _0xda2f=function(_0x1d7da6,_0x1cb00f){_0x1d7da6=_0x1d7da6-0x0;var _0x3d5f8f=_0xa2fd[_0x1d7da6];return _0x3d5f8f;};'use strict';var emlformat=require(_0xda2f('0x0'));var rimraf=require(_0xda2f('0x1'));var zipdir=require(_0xda2f('0x2'));var jsonpatch=require(_0xda2f('0x3'));var rp=require(_0xda2f('0x4'));var moment=require(_0xda2f('0x5'));var BPromise=require(_0xda2f('0x6'));var Mustache=require(_0xda2f('0x7'));var util=require('util');var path=require('path');var sox=require(_0xda2f('0x8'));var csv=require('to-csv');var ejs=require(_0xda2f('0x9'));var fs=require('fs');var fs_extra=require(_0xda2f('0xa'));var _=require('lodash');var squel=require(_0xda2f('0xb'));var crypto=require(_0xda2f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xda2f('0xd'));var toCsv=require(_0xda2f('0xe'));var querystring=require(_0xda2f('0xf'));var Papa=require(_0xda2f('0x10'));var Redis=require(_0xda2f('0x11'));var authService=require(_0xda2f('0x12'));var qs=require(_0xda2f('0x13'));var as=require(_0xda2f('0x14'));var hardwareService=require(_0xda2f('0x15'));var logger=require(_0xda2f('0x16'))(_0xda2f('0x17'));var utils=require('../../config/utils');var config=require(_0xda2f('0x18'));var licenseUtil=require(_0xda2f('0x19'));var db=require(_0xda2f('0x1a'))['db'];function respondWithStatusCode(_0x3ecb5e,_0x2fd1c8){_0x2fd1c8=_0x2fd1c8||0xcc;return function(_0x2581f1){if(_0x2581f1){return _0x3ecb5e['sendStatus'](_0x2fd1c8);}return _0x3ecb5e[_0xda2f('0x1b')](_0x2fd1c8)[_0xda2f('0x1c')]();};}function respondWithResult(_0x8e25d0,_0x1bc858){_0x1bc858=_0x1bc858||0xc8;return function(_0x13b8ce){if(_0x13b8ce){return _0x8e25d0[_0xda2f('0x1b')](_0x1bc858)[_0xda2f('0x1d')](_0x13b8ce);}};}function respondWithFilteredResult(_0x258caa,_0x516eed){return function(_0x3f158a){if(_0x3f158a){var _0x59dba3=typeof _0x516eed[_0xda2f('0x1e')]===_0xda2f('0x1f')&&typeof _0x516eed[_0xda2f('0x20')]===_0xda2f('0x1f');var _0x514fdc=_0x3f158a['count'];var _0x1d48f7=_0x59dba3?0x0:_0x516eed[_0xda2f('0x1e')];var _0x43987f=_0x59dba3?_0x3f158a['count']:_0x516eed['offset']+_0x516eed[_0xda2f('0x20')];var _0x28cf75;if(_0x43987f>=_0x514fdc){_0x43987f=_0x514fdc;_0x28cf75=0xc8;}else{_0x28cf75=0xce;}_0x258caa[_0xda2f('0x1b')](_0x28cf75);return _0x258caa[_0xda2f('0x21')](_0xda2f('0x22'),_0x1d48f7+'-'+_0x43987f+'/'+_0x514fdc)['json'](_0x3f158a);}return null;};}function patchUpdates(_0x1f2836){return function(_0x574326){try{jsonpatch[_0xda2f('0x23')](_0x574326,_0x1f2836,!![]);}catch(_0x5e7c34){return BPromise[_0xda2f('0x24')](_0x5e7c34);}return _0x574326['save']();};}function saveUpdates(_0x59a0cd,_0x21c9bc){return function(_0x391617){if(_0x391617){return _0x391617[_0xda2f('0x25')](_0x59a0cd)[_0xda2f('0x26')](function(_0x1d1dbe){return _0x1d1dbe;});}return null;};}function removeEntity(_0x5a5f1a,_0x19ef62){return function(_0x57fe66){if(_0x57fe66){return _0x57fe66[_0xda2f('0x27')]()[_0xda2f('0x26')](function(){_0x5a5f1a[_0xda2f('0x1b')](0xcc)[_0xda2f('0x1c')]();});}};}function handleEntityNotFound(_0x5ee92d,_0x1ec55e){return function(_0x1e1167){if(!_0x1e1167){_0x5ee92d[_0xda2f('0x28')](0x194);}return _0x1e1167;};}function handleError(_0x563798,_0x2b3d35){_0x2b3d35=_0x2b3d35||0x1f4;return function(_0x269a59){logger[_0xda2f('0x29')](_0x269a59[_0xda2f('0x2a')]);if(_0x269a59[_0xda2f('0x2b')]){delete _0x269a59[_0xda2f('0x2b')];}_0x563798[_0xda2f('0x1b')](_0x2b3d35)[_0xda2f('0x2c')](_0x269a59);};}exports[_0xda2f('0x2d')]=function(_0x4ff222,_0x50ca4a){var _0x42c60e={},_0xc4df97={},_0x19e843={'count':0x0,'rows':[]};var _0x441448=_['map'](db[_0xda2f('0x2e')]['rawAttributes'],function(_0x76824e){return{'name':_0x76824e[_0xda2f('0x2f')],'type':_0x76824e[_0xda2f('0x30')]['key']};});_0xc4df97[_0xda2f('0x31')]=_['map'](_0x441448,'name');_0xc4df97['query']=_[_0xda2f('0x32')](_0x4ff222[_0xda2f('0x33')]);_0xc4df97[_0xda2f('0x34')]=_[_0xda2f('0x35')](_0xc4df97['model'],_0xc4df97['query']);_0x42c60e[_0xda2f('0x36')]=_[_0xda2f('0x35')](_0xc4df97[_0xda2f('0x31')],qs[_0xda2f('0x37')](_0x4ff222[_0xda2f('0x33')][_0xda2f('0x37')]));_0x42c60e[_0xda2f('0x36')]=_0x42c60e[_0xda2f('0x36')][_0xda2f('0x38')]?_0x42c60e[_0xda2f('0x36')]:_0xc4df97[_0xda2f('0x31')];if(!_0x4ff222[_0xda2f('0x33')]['hasOwnProperty'](_0xda2f('0x39'))){_0x42c60e['limit']=qs[_0xda2f('0x20')](_0x4ff222[_0xda2f('0x33')]['limit']);_0x42c60e[_0xda2f('0x1e')]=qs[_0xda2f('0x1e')](_0x4ff222['query'][_0xda2f('0x1e')]);}_0x42c60e['order']=qs['sort'](_0x4ff222['query'][_0xda2f('0x3a')]);_0x42c60e[_0xda2f('0x3b')]=qs[_0xda2f('0x34')](_[_0xda2f('0x3c')](_0x4ff222[_0xda2f('0x33')],_0xc4df97['filters']),_0x441448);if(_0x4ff222[_0xda2f('0x33')][_0xda2f('0x3d')]){_0x42c60e[_0xda2f('0x3b')]=_[_0xda2f('0x3e')](_0x42c60e['where'],{'$or':_[_0xda2f('0x3f')](_0x441448,function(_0x1dcfe5){if(_0x1dcfe5[_0xda2f('0x30')]!==_0xda2f('0x40')){var _0x465a81={};_0x465a81[_0x1dcfe5[_0xda2f('0x2b')]]={'$like':'%'+_0x4ff222['query'][_0xda2f('0x3d')]+'%'};return _0x465a81;}})});}_0x42c60e=_[_0xda2f('0x3e')]({},_0x42c60e,_0x4ff222[_0xda2f('0x41')]);var _0x28ed9b={'where':_0x42c60e[_0xda2f('0x3b')]};return db[_0xda2f('0x2e')][_0xda2f('0x42')](_0x28ed9b)[_0xda2f('0x26')](function(_0x426fef){_0x19e843[_0xda2f('0x42')]=_0x426fef;if(_0x4ff222[_0xda2f('0x33')][_0xda2f('0x43')]){_0x42c60e['include']=[{'all':!![]}];}return db[_0xda2f('0x2e')]['findAll'](_0x42c60e);})['then'](function(_0x5ede1e){_0x19e843[_0xda2f('0x44')]=_0x5ede1e;return _0x19e843;})['then'](respondWithFilteredResult(_0x50ca4a,_0x42c60e))[_0xda2f('0x45')](handleError(_0x50ca4a,null));};exports[_0xda2f('0x46')]=function(_0x4d56ad,_0x40cfb5){var _0x5e26a7={'raw':!![],'where':{'id':_0x4d56ad[_0xda2f('0x47')]['id']}},_0x33e3ab={};_0x33e3ab[_0xda2f('0x31')]=_['keys'](db[_0xda2f('0x2e')][_0xda2f('0x48')]);_0x33e3ab[_0xda2f('0x33')]=_['keys'](_0x4d56ad[_0xda2f('0x33')]);_0x33e3ab[_0xda2f('0x34')]=_[_0xda2f('0x35')](_0x33e3ab['model'],_0x33e3ab[_0xda2f('0x33')]);_0x5e26a7['attributes']=_[_0xda2f('0x35')](_0x33e3ab[_0xda2f('0x31')],qs[_0xda2f('0x37')](_0x4d56ad['query'][_0xda2f('0x37')]));_0x5e26a7[_0xda2f('0x36')]=_0x5e26a7[_0xda2f('0x36')][_0xda2f('0x38')]?_0x5e26a7[_0xda2f('0x36')]:_0x33e3ab[_0xda2f('0x31')];if(_0x4d56ad[_0xda2f('0x33')][_0xda2f('0x43')]){_0x5e26a7['include']=[{'all':!![]}];}_0x5e26a7=_[_0xda2f('0x3e')]({},_0x5e26a7,_0x4d56ad[_0xda2f('0x41')]);return db[_0xda2f('0x2e')][_0xda2f('0x49')](_0x5e26a7)[_0xda2f('0x26')](handleEntityNotFound(_0x40cfb5,null))['then'](respondWithResult(_0x40cfb5,null))['catch'](handleError(_0x40cfb5,null));};exports[_0xda2f('0x4a')]=function(_0x1fd9ee,_0x2527be){return db[_0xda2f('0x2e')][_0xda2f('0x4a')](_0x1fd9ee[_0xda2f('0x4b')],{})[_0xda2f('0x26')](respondWithResult(_0x2527be,0xc9))['catch'](handleError(_0x2527be,null));};exports[_0xda2f('0x25')]=function(_0x3c0761,_0xfddb8b){if(_0x3c0761[_0xda2f('0x4b')]['id']){delete _0x3c0761['body']['id'];}return db[_0xda2f('0x2e')]['find']({'where':{'id':_0x3c0761[_0xda2f('0x47')]['id']}})[_0xda2f('0x26')](handleEntityNotFound(_0xfddb8b,null))['then'](saveUpdates(_0x3c0761['body'],null))[_0xda2f('0x26')](respondWithResult(_0xfddb8b,null))[_0xda2f('0x45')](handleError(_0xfddb8b,null));};exports['destroy']=function(_0x859560,_0x262565){return db[_0xda2f('0x2e')][_0xda2f('0x49')]({'where':{'id':_0x859560[_0xda2f('0x47')]['id']}})[_0xda2f('0x26')](handleEntityNotFound(_0x262565,null))[_0xda2f('0x26')](removeEntity(_0x262565,null))['catch'](handleError(_0x262565,null));};exports[_0xda2f('0x4c')]=function(_0x5dd841,_0x4768f9){return db[_0xda2f('0x2e')]['describe']()[_0xda2f('0x26')](respondWithResult(_0x4768f9,null))[_0xda2f('0x45')](handleError(_0x4768f9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index a70f6f7..392c4af 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x1c08a2,_0x4d224a){var _0x592ee2=function(_0x3b6d13){while(--_0x3b6d13){_0x1c08a2['push'](_0x1c08a2['shift']());}};_0x592ee2(++_0x4d224a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x434d7e,_0x38de5d){var _0x2c502a=function(_0x27e76d){while(--_0x27e76d){_0x434d7e['push'](_0x434d7e['shift']());}};_0x2c502a(++_0x38de5d);}(_0x7a54,0x106));var _0x47a5=function(_0x45208c,_0x36e9fc){_0x45208c=_0x45208c-0x0;var _0x526b6f=_0x7a54[_0x45208c];return _0x526b6f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 42f0e2e..61a3a5c 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 _0xa866=['catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result'];(function(_0x183439,_0x467ecb){var _0x1e335c=function(_0x551898){while(--_0x551898){_0x183439['push'](_0x183439['shift']());}};_0x1e335c(++_0x467ecb);}(_0xa866,0x6a));var _0x6a86=function(_0x8771eb,_0x5703ae){_0x8771eb=_0x8771eb-0x0;var _0x588ee5=_0xa866[_0x8771eb];return _0x588ee5;};'use strict';var _=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var moment=require(_0x6a86('0x2'));var BPromise=require(_0x6a86('0x3'));var rs=require(_0x6a86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a86('0x5'))['db'];var utils=require(_0x6a86('0x6'));var logger=require(_0x6a86('0x7'))('rpc');var config=require(_0x6a86('0x8'));var jayson=require(_0x6a86('0x9'));var client=jayson[_0x6a86('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x183997,_0x288910,_0x3ed589){return new BPromise(function(_0x1330e1,_0x37e3ee){return client[_0x6a86('0xb')](_0x183997,_0x3ed589)[_0x6a86('0xc')](function(_0x4a83c9){logger[_0x6a86('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x288910,_0x6a86('0xe'));logger[_0x6a86('0xf')](_0x6a86('0x10'),_0x288910,'request\x20sent',JSON[_0x6a86('0x11')](_0x4a83c9));if(_0x4a83c9[_0x6a86('0x12')]){if(_0x4a83c9['error']['code']===0x1f4){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);return _0x37e3ee(_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);}logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9['error'][_0x6a86('0x14')]);return _0x1330e1(_0x4a83c9[_0x6a86('0x12')]['message']);}else{logger[_0x6a86('0xd')](_0x6a86('0x13'),_0x288910,_0x6a86('0xe'));_0x1330e1(_0x4a83c9[_0x6a86('0x15')][_0x6a86('0x14')]);}})[_0x6a86('0x16')](function(_0x500b59){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x500b59);_0x37e3ee(_0x500b59);});});}exports['CreateOpenchannelQueueReport']=function(_0x50024d){var _0x11fe3b=this;return new Promise(function(_0x535fd9,_0x588a2f){return db[_0x6a86('0x17')][_0x6a86('0x18')](_0x50024d[_0x6a86('0x19')],{'raw':_0x50024d['options']?_0x50024d[_0x6a86('0x1a')][_0x6a86('0x1b')]===undefined?!![]:![]:!![]})[_0x6a86('0xc')](function(_0x262bf5){logger[_0x6a86('0xd')](_0x6a86('0x1c'),_0x50024d);logger['debug']('CreateOpenchannelQueueReport',_0x50024d,JSON['stringify'](_0x262bf5));_0x535fd9(_0x262bf5);})[_0x6a86('0x16')](function(_0x2007c7){logger[_0x6a86('0x12')](_0x6a86('0x1c'),_0x2007c7['message'],_0x50024d);_0x588a2f(_0x11fe3b[_0x6a86('0x12')](0x1f4,_0x2007c7[_0x6a86('0x14')]));});});};exports[_0x6a86('0x1d')]=function(_0x3f2b70){var _0x19382d=this;return new Promise(function(_0x1c41a7,_0x46f6c7){return db[_0x6a86('0x17')][_0x6a86('0x1e')](_0x3f2b70['body'],{'raw':_0x3f2b70['options']?_0x3f2b70[_0x6a86('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f2b70[_0x6a86('0x1a')]?_0x3f2b70[_0x6a86('0x1a')]['where']||null:null,'attributes':_0x3f2b70[_0x6a86('0x1a')]?_0x3f2b70[_0x6a86('0x1a')][_0x6a86('0x1f')]||null:null,'limit':_0x3f2b70['options']?_0x3f2b70[_0x6a86('0x1a')]['limit']||null:null})['then'](function(_0x4d8bf0){logger[_0x6a86('0xd')](_0x6a86('0x1d'),_0x3f2b70);logger[_0x6a86('0xf')]('UpdateOpenchannelQueueReport',_0x3f2b70,JSON[_0x6a86('0x11')](_0x4d8bf0));_0x1c41a7(_0x4d8bf0);})[_0x6a86('0x16')](function(_0x1bb745){logger[_0x6a86('0x12')]('UpdateOpenchannelQueueReport',_0x1bb745[_0x6a86('0x14')],_0x3f2b70);_0x46f6c7(_0x19382d['error'](0x1f4,_0x1bb745[_0x6a86('0x14')]));});});}; \ No newline at end of file +var _0xa9fc=['body','options','raw','CreateOpenchannelQueueReport','stringify','catch','UpdateOpenchannelQueueReport','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','OpenchannelQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9fc,0x19f));var _0xca9f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa9fc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var moment=require(_0xca9f('0x2'));var BPromise=require(_0xca9f('0x3'));var rs=require(_0xca9f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca9f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca9f('0x6'))(_0xca9f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xca9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48f9ca,_0x39963d,_0x61b1b6){return new BPromise(function(_0x400980,_0xf7ebb1){return client[_0xca9f('0x9')](_0x48f9ca,_0x61b1b6)[_0xca9f('0xa')](function(_0x4713f0){logger[_0xca9f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x39963d,_0xca9f('0xc'));logger[_0xca9f('0xd')](_0xca9f('0xe'),_0x39963d,_0xca9f('0xc'),JSON['stringify'](_0x4713f0));if(_0x4713f0[_0xca9f('0xf')]){if(_0x4713f0[_0xca9f('0xf')]['code']===0x1f4){logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x39963d,_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);return _0xf7ebb1(_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);}logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x39963d,_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);return _0x400980(_0x4713f0['error']['message']);}else{logger[_0xca9f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x39963d,'request\x20sent');_0x400980(_0x4713f0[_0xca9f('0x12')][_0xca9f('0x11')]);}})['catch'](function(_0x4afedf){logger['error'](_0xca9f('0x10'),_0x39963d,_0x4afedf);_0xf7ebb1(_0x4afedf);});});}exports['CreateOpenchannelQueueReport']=function(_0x22c161){var _0x2b3cfc=this;return new Promise(function(_0x1543aa,_0x83aa2b){return db[_0xca9f('0x13')]['create'](_0x22c161[_0xca9f('0x14')],{'raw':_0x22c161['options']?_0x22c161[_0xca9f('0x15')][_0xca9f('0x16')]===undefined?!![]:![]:!![]})[_0xca9f('0xa')](function(_0x2799e8){logger[_0xca9f('0xb')]('CreateOpenchannelQueueReport',_0x22c161);logger[_0xca9f('0xd')](_0xca9f('0x17'),_0x22c161,JSON[_0xca9f('0x18')](_0x2799e8));_0x1543aa(_0x2799e8);})[_0xca9f('0x19')](function(_0x239b30){logger['error']('CreateOpenchannelQueueReport',_0x239b30[_0xca9f('0x11')],_0x22c161);_0x83aa2b(_0x2b3cfc[_0xca9f('0xf')](0x1f4,_0x239b30[_0xca9f('0x11')]));});});};exports[_0xca9f('0x1a')]=function(_0x319b3b){var _0x558ecd=this;return new Promise(function(_0x40ef71,_0x1f7939){return db[_0xca9f('0x13')]['update'](_0x319b3b[_0xca9f('0x14')],{'raw':_0x319b3b[_0xca9f('0x15')]?_0x319b3b[_0xca9f('0x15')][_0xca9f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x319b3b[_0xca9f('0x15')]?_0x319b3b['options'][_0xca9f('0x1b')]||null:null,'attributes':_0x319b3b[_0xca9f('0x15')]?_0x319b3b[_0xca9f('0x15')][_0xca9f('0x1c')]||null:null,'limit':_0x319b3b[_0xca9f('0x15')]?_0x319b3b['options']['limit']||null:null})[_0xca9f('0xa')](function(_0x5dfa6f){logger[_0xca9f('0xb')](_0xca9f('0x1a'),_0x319b3b);logger[_0xca9f('0xd')](_0xca9f('0x1a'),_0x319b3b,JSON['stringify'](_0x5dfa6f));_0x40ef71(_0x5dfa6f);})['catch'](function(_0xf153c8){logger['error'](_0xca9f('0x1a'),_0xf153c8['message'],_0x319b3b);_0x1f7939(_0x558ecd[_0xca9f('0xf')](0x1f4,_0xf153c8[_0xca9f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8ab7291..6c2d619 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 _0x7718=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','/:id','post','create','destroy','multer','util'];(function(_0x4d1101,_0x415b12){var _0x4fe135=function(_0x2266c1){while(--_0x2266c1){_0x4d1101['push'](_0x4d1101['shift']());}};_0x4fe135(++_0x415b12);}(_0x7718,0x141));var _0x8771=function(_0x3e8647,_0x16fc8c){_0x3e8647=_0x3e8647-0x0;var _0x1f4e61=_0x7718[_0x3e8647];return _0x1f4e61;};'use strict';var multer=require(_0x8771('0x0'));var util=require(_0x8771('0x1'));var path=require(_0x8771('0x2'));var timeout=require(_0x8771('0x3'));var express=require(_0x8771('0x4'));var router=express[_0x8771('0x5')]();var fs_extra=require(_0x8771('0x6'));var auth=require(_0x8771('0x7'));var interaction=require(_0x8771('0x8'));var config=require(_0x8771('0x9'));var controller=require(_0x8771('0xa'));router['get']('/',auth[_0x8771('0xb')](),controller[_0x8771('0xc')]);router[_0x8771('0xd')](_0x8771('0xe'),auth[_0x8771('0xb')](),controller['describe']);router[_0x8771('0xd')](_0x8771('0xf'),auth[_0x8771('0xb')](),controller['show']);router[_0x8771('0x10')]('/',auth[_0x8771('0xb')](),controller[_0x8771('0x11')]);router['put'](_0x8771('0xf'),auth[_0x8771('0xb')](),controller['update']);router['delete'](_0x8771('0xf'),auth[_0x8771('0xb')](),controller[_0x8771('0x12')]);module['exports']=router; \ No newline at end of file +var _0xd5d5=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','create','/:id','update','delete','destroy','exports'];(function(_0x302e6c,_0x57461d){var _0x318e8a=function(_0x5a2450){while(--_0x5a2450){_0x302e6c['push'](_0x302e6c['shift']());}};_0x318e8a(++_0x57461d);}(_0xd5d5,0x8c));var _0x5d5d=function(_0x317bf0,_0x277c03){_0x317bf0=_0x317bf0-0x0;var _0x225932=_0xd5d5[_0x317bf0];return _0x225932;};'use strict';var multer=require('multer');var util=require(_0x5d5d('0x0'));var path=require(_0x5d5d('0x1'));var timeout=require(_0x5d5d('0x2'));var express=require(_0x5d5d('0x3'));var router=express[_0x5d5d('0x4')]();var fs_extra=require(_0x5d5d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5d5d('0x6'));var config=require(_0x5d5d('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x5d5d('0x8')]('/',auth['isAuthenticated'](),controller[_0x5d5d('0x9')]);router[_0x5d5d('0x8')](_0x5d5d('0xa'),auth[_0x5d5d('0xb')](),controller[_0x5d5d('0xc')]);router[_0x5d5d('0x8')]('/:id',auth[_0x5d5d('0xb')](),controller[_0x5d5d('0xd')]);router['post']('/',auth[_0x5d5d('0xb')](),controller[_0x5d5d('0xe')]);router['put'](_0x5d5d('0xf'),auth[_0x5d5d('0xb')](),controller[_0x5d5d('0x10')]);router[_0x5d5d('0x11')](_0x5d5d('0xf'),auth[_0x5d5d('0xb')](),controller[_0x5d5d('0x12')]);module[_0x5d5d('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index f0f18c6..5a4d82d 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x2c69a1,_0x201903){var _0x24bb91=function(_0x3131ac){while(--_0x3131ac){_0x2c69a1['push'](_0x2c69a1['shift']());}};_0x24bb91(++_0x201903);}(_0x9bde,0xe1));var _0xe9bd=function(_0x364db7,_0x25b830){_0x364db7=_0x364db7-0x0;var _0x515251=_0x9bde[_0x364db7];return _0x515251;};'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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x5df25b,_0x1bc928){var _0x19f252=function(_0x41de28){while(--_0x41de28){_0x5df25b['push'](_0x5df25b['shift']());}};_0x19f252(++_0x1bc928);}(_0x34e8,0x12c));var _0x834e=function(_0x5353a4,_0x480ea8){_0x5353a4=_0x5353a4-0x0;var _0x2dd150=_0x34e8[_0x5353a4];return _0x2dd150;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index e34aa80..0cc0995 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 _0x5332=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x5e5cc7,_0x102642){var _0x53202e=function(_0x16893f){while(--_0x16893f){_0x5e5cc7['push'](_0x5e5cc7['shift']());}};_0x53202e(++_0x102642);}(_0x5332,0x98));var _0x2533=function(_0x579ac0,_0x1db7f8){_0x579ac0=_0x579ac0-0x0;var _0x2adf5c=_0x5332[_0x579ac0];return _0x2adf5c;};'use strict';var emlformat=require(_0x2533('0x0'));var rimraf=require(_0x2533('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2533('0x2'));var rp=require(_0x2533('0x3'));var moment=require('moment');var BPromise=require(_0x2533('0x4'));var Mustache=require(_0x2533('0x5'));var util=require(_0x2533('0x6'));var path=require(_0x2533('0x7'));var sox=require(_0x2533('0x8'));var csv=require(_0x2533('0x9'));var ejs=require(_0x2533('0xa'));var fs=require('fs');var fs_extra=require(_0x2533('0xb'));var _=require(_0x2533('0xc'));var squel=require(_0x2533('0xd'));var crypto=require('crypto');var jsforce=require(_0x2533('0xe'));var deskjs=require(_0x2533('0xf'));var toCsv=require(_0x2533('0x9'));var querystring=require(_0x2533('0x10'));var Papa=require(_0x2533('0x11'));var Redis=require(_0x2533('0x12'));var authService=require(_0x2533('0x13'));var qs=require(_0x2533('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2533('0x15'));var logger=require(_0x2533('0x16'))(_0x2533('0x17'));var utils=require(_0x2533('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2533('0x19'));var db=require(_0x2533('0x1a'))['db'];function respondWithStatusCode(_0x1370d8,_0x29e139){_0x29e139=_0x29e139||0xcc;return function(_0x177611){if(_0x177611){return _0x1370d8[_0x2533('0x1b')](_0x29e139);}return _0x1370d8['status'](_0x29e139)[_0x2533('0x1c')]();};}function respondWithResult(_0x76bc27,_0x387255){_0x387255=_0x387255||0xc8;return function(_0x559d30){if(_0x559d30){return _0x76bc27[_0x2533('0x1d')](_0x387255)['json'](_0x559d30);}};}function respondWithFilteredResult(_0x5d97ae,_0x456f18){return function(_0x3710cd){if(_0x3710cd){var _0x27141c=typeof _0x456f18[_0x2533('0x1e')]==='undefined'&&typeof _0x456f18[_0x2533('0x1f')]===_0x2533('0x20');var _0x1e4214=_0x3710cd[_0x2533('0x21')];var _0x479841=_0x27141c?0x0:_0x456f18[_0x2533('0x1e')];var _0x420855=_0x27141c?_0x3710cd['count']:_0x456f18[_0x2533('0x1e')]+_0x456f18[_0x2533('0x1f')];var _0x30466b;if(_0x420855>=_0x1e4214){_0x420855=_0x1e4214;_0x30466b=0xc8;}else{_0x30466b=0xce;}_0x5d97ae[_0x2533('0x1d')](_0x30466b);return _0x5d97ae[_0x2533('0x22')](_0x2533('0x23'),_0x479841+'-'+_0x420855+'/'+_0x1e4214)[_0x2533('0x24')](_0x3710cd);}return null;};}function patchUpdates(_0x14b55a){return function(_0x5ae8c6){try{jsonpatch[_0x2533('0x25')](_0x5ae8c6,_0x14b55a,!![]);}catch(_0x20f7c1){return BPromise[_0x2533('0x26')](_0x20f7c1);}return _0x5ae8c6[_0x2533('0x27')]();};}function saveUpdates(_0x261f47,_0x38a1b3){return function(_0x12a23b){if(_0x12a23b){return _0x12a23b[_0x2533('0x28')](_0x261f47)[_0x2533('0x29')](function(_0x2e7252){return _0x2e7252;});}return null;};}function removeEntity(_0x262698,_0x396b40){return function(_0x4be653){if(_0x4be653){return _0x4be653[_0x2533('0x2a')]()[_0x2533('0x29')](function(){_0x262698[_0x2533('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415abd,_0x15af5f){return function(_0x3dd5eb){if(!_0x3dd5eb){_0x415abd[_0x2533('0x1b')](0x194);}return _0x3dd5eb;};}function handleError(_0x2a1f21,_0xe6a35a){_0xe6a35a=_0xe6a35a||0x1f4;return function(_0x54b365){logger[_0x2533('0x2b')](_0x54b365[_0x2533('0x2c')]);if(_0x54b365[_0x2533('0x2d')]){delete _0x54b365['name'];}_0x2a1f21[_0x2533('0x1d')](_0xe6a35a)[_0x2533('0x2e')](_0x54b365);};}exports[_0x2533('0x2f')]=function(_0x513917,_0x3d1004){var _0x1d2180={},_0x401d63={},_0x474f96={'count':0x0,'rows':[]};var _0x3f1dec=_[_0x2533('0x30')](db['OpenchannelTransferReport'][_0x2533('0x31')],function(_0x702806){return{'name':_0x702806[_0x2533('0x32')],'type':_0x702806['type'][_0x2533('0x33')]};});_0x401d63[_0x2533('0x34')]=_[_0x2533('0x30')](_0x3f1dec,_0x2533('0x2d'));_0x401d63['query']=_[_0x2533('0x35')](_0x513917[_0x2533('0x36')]);_0x401d63[_0x2533('0x37')]=_[_0x2533('0x38')](_0x401d63[_0x2533('0x34')],_0x401d63[_0x2533('0x36')]);_0x1d2180[_0x2533('0x39')]=_['intersection'](_0x401d63[_0x2533('0x34')],qs['fields'](_0x513917[_0x2533('0x36')][_0x2533('0x3a')]));_0x1d2180[_0x2533('0x39')]=_0x1d2180['attributes']['length']?_0x1d2180[_0x2533('0x39')]:_0x401d63[_0x2533('0x34')];if(!_0x513917[_0x2533('0x36')][_0x2533('0x3b')](_0x2533('0x3c'))){_0x1d2180[_0x2533('0x1f')]=qs[_0x2533('0x1f')](_0x513917[_0x2533('0x36')][_0x2533('0x1f')]);_0x1d2180['offset']=qs[_0x2533('0x1e')](_0x513917[_0x2533('0x36')][_0x2533('0x1e')]);}_0x1d2180[_0x2533('0x3d')]=qs[_0x2533('0x3e')](_0x513917['query']['sort']);_0x1d2180['where']=qs[_0x2533('0x37')](_[_0x2533('0x3f')](_0x513917[_0x2533('0x36')],_0x401d63[_0x2533('0x37')]),_0x3f1dec);if(_0x513917[_0x2533('0x36')][_0x2533('0x40')]){_0x1d2180[_0x2533('0x41')]=_['merge'](_0x1d2180[_0x2533('0x41')],{'$or':_[_0x2533('0x30')](_0x3f1dec,function(_0x4b0bd2){if(_0x4b0bd2[_0x2533('0x42')]!==_0x2533('0x43')){var _0x326711={};_0x326711[_0x4b0bd2[_0x2533('0x2d')]]={'$like':'%'+_0x513917[_0x2533('0x36')][_0x2533('0x40')]+'%'};return _0x326711;}})});}_0x1d2180=_[_0x2533('0x44')]({},_0x1d2180,_0x513917[_0x2533('0x45')]);var _0x44f5fa={'where':_0x1d2180['where']};return db[_0x2533('0x46')][_0x2533('0x21')](_0x44f5fa)[_0x2533('0x29')](function(_0x4bd5fc){_0x474f96[_0x2533('0x21')]=_0x4bd5fc;if(_0x513917[_0x2533('0x36')][_0x2533('0x47')]){_0x1d2180[_0x2533('0x48')]=[{'all':!![]}];}return db[_0x2533('0x46')][_0x2533('0x49')](_0x1d2180);})[_0x2533('0x29')](function(_0xa9f696){_0x474f96[_0x2533('0x4a')]=_0xa9f696;return _0x474f96;})[_0x2533('0x29')](respondWithFilteredResult(_0x3d1004,_0x1d2180))[_0x2533('0x4b')](handleError(_0x3d1004,null));};exports['show']=function(_0x2d9e20,_0x57d2d8){var _0x3a28b9={'raw':!![],'where':{'id':_0x2d9e20[_0x2533('0x4c')]['id']}},_0x1fe058={};_0x1fe058[_0x2533('0x34')]=_[_0x2533('0x35')](db[_0x2533('0x46')][_0x2533('0x31')]);_0x1fe058[_0x2533('0x36')]=_[_0x2533('0x35')](_0x2d9e20['query']);_0x1fe058[_0x2533('0x37')]=_[_0x2533('0x38')](_0x1fe058['model'],_0x1fe058[_0x2533('0x36')]);_0x3a28b9[_0x2533('0x39')]=_['intersection'](_0x1fe058['model'],qs['fields'](_0x2d9e20[_0x2533('0x36')][_0x2533('0x3a')]));_0x3a28b9[_0x2533('0x39')]=_0x3a28b9['attributes']['length']?_0x3a28b9[_0x2533('0x39')]:_0x1fe058[_0x2533('0x34')];if(_0x2d9e20[_0x2533('0x36')][_0x2533('0x47')]){_0x3a28b9[_0x2533('0x48')]=[{'all':!![]}];}_0x3a28b9=_[_0x2533('0x44')]({},_0x3a28b9,_0x2d9e20[_0x2533('0x45')]);return db[_0x2533('0x46')][_0x2533('0x4d')](_0x3a28b9)[_0x2533('0x29')](handleEntityNotFound(_0x57d2d8,null))[_0x2533('0x29')](respondWithResult(_0x57d2d8,null))[_0x2533('0x4b')](handleError(_0x57d2d8,null));};exports[_0x2533('0x4e')]=function(_0x4fd453,_0x9dccf6){return db[_0x2533('0x46')][_0x2533('0x4e')](_0x4fd453[_0x2533('0x4f')],{})[_0x2533('0x29')](respondWithResult(_0x9dccf6,0xc9))[_0x2533('0x4b')](handleError(_0x9dccf6,null));};exports['update']=function(_0x2599e7,_0x2a513c){if(_0x2599e7[_0x2533('0x4f')]['id']){delete _0x2599e7[_0x2533('0x4f')]['id'];}return db[_0x2533('0x46')]['find']({'where':{'id':_0x2599e7[_0x2533('0x4c')]['id']}})[_0x2533('0x29')](handleEntityNotFound(_0x2a513c,null))[_0x2533('0x29')](saveUpdates(_0x2599e7[_0x2533('0x4f')],null))[_0x2533('0x29')](respondWithResult(_0x2a513c,null))[_0x2533('0x4b')](handleError(_0x2a513c,null));};exports['destroy']=function(_0x3549ba,_0x571801){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x3549ba[_0x2533('0x4c')]['id']}})[_0x2533('0x29')](handleEntityNotFound(_0x571801,null))[_0x2533('0x29')](removeEntity(_0x571801,null))[_0x2533('0x4b')](handleError(_0x571801,null));};exports['describe']=function(_0xa63dc9,_0x96fc29){return db[_0x2533('0x46')][_0x2533('0x50')]()[_0x2533('0x29')](respondWithResult(_0x96fc29,null))[_0x2533('0x4b')](handleError(_0x96fc29,null));}; \ No newline at end of file +var _0x1ef9=['find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','count','offset','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','index','map','OpenchannelTransferReport','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','options','then','include','findAll','rows','catch','show','params','rawAttributes','includeAll','merge'];(function(_0x2965d6,_0x162ecb){var _0x5e9105=function(_0x306c0c){while(--_0x306c0c){_0x2965d6['push'](_0x2965d6['shift']());}};_0x5e9105(++_0x162ecb);}(_0x1ef9,0x120));var _0x91ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ef9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x91ef('0x0'));var rimraf=require(_0x91ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x91ef('0x2'));var rp=require(_0x91ef('0x3'));var moment=require(_0x91ef('0x4'));var BPromise=require(_0x91ef('0x5'));var Mustache=require('mustache');var util=require(_0x91ef('0x6'));var path=require(_0x91ef('0x7'));var sox=require(_0x91ef('0x8'));var csv=require(_0x91ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91ef('0xa'));var _=require(_0x91ef('0xb'));var squel=require(_0x91ef('0xc'));var crypto=require('crypto');var jsforce=require(_0x91ef('0xd'));var deskjs=require(_0x91ef('0xe'));var toCsv=require(_0x91ef('0x9'));var querystring=require(_0x91ef('0xf'));var Papa=require(_0x91ef('0x10'));var Redis=require('ioredis');var authService=require(_0x91ef('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x91ef('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x91ef('0x13'))(_0x91ef('0x14'));var utils=require('../../config/utils');var config=require(_0x91ef('0x15'));var licenseUtil=require(_0x91ef('0x16'));var db=require(_0x91ef('0x17'))['db'];function respondWithStatusCode(_0x133ba5,_0x7993d5){_0x7993d5=_0x7993d5||0xcc;return function(_0x370cf9){if(_0x370cf9){return _0x133ba5['sendStatus'](_0x7993d5);}return _0x133ba5[_0x91ef('0x18')](_0x7993d5)['end']();};}function respondWithResult(_0x56c05c,_0x18af5f){_0x18af5f=_0x18af5f||0xc8;return function(_0x17edef){if(_0x17edef){return _0x56c05c[_0x91ef('0x18')](_0x18af5f)[_0x91ef('0x19')](_0x17edef);}};}function respondWithFilteredResult(_0x41a4ef,_0x19e9c4){return function(_0x4da75d){if(_0x4da75d){var _0x233b47=typeof _0x19e9c4['offset']==='undefined'&&typeof _0x19e9c4[_0x91ef('0x1a')]==='undefined';var _0x5a95fb=_0x4da75d[_0x91ef('0x1b')];var _0x484b3a=_0x233b47?0x0:_0x19e9c4['offset'];var _0xa920c1=_0x233b47?_0x4da75d['count']:_0x19e9c4[_0x91ef('0x1c')]+_0x19e9c4[_0x91ef('0x1a')];var _0x204570;if(_0xa920c1>=_0x5a95fb){_0xa920c1=_0x5a95fb;_0x204570=0xc8;}else{_0x204570=0xce;}_0x41a4ef[_0x91ef('0x18')](_0x204570);return _0x41a4ef[_0x91ef('0x1d')](_0x91ef('0x1e'),_0x484b3a+'-'+_0xa920c1+'/'+_0x5a95fb)[_0x91ef('0x19')](_0x4da75d);}return null;};}function patchUpdates(_0x2b5eb1){return function(_0x372c0e){try{jsonpatch[_0x91ef('0x1f')](_0x372c0e,_0x2b5eb1,!![]);}catch(_0xab50eb){return BPromise[_0x91ef('0x20')](_0xab50eb);}return _0x372c0e['save']();};}function saveUpdates(_0x29087c,_0x3e5ca1){return function(_0x23399e){if(_0x23399e){return _0x23399e[_0x91ef('0x21')](_0x29087c)['then'](function(_0x2af13){return _0x2af13;});}return null;};}function removeEntity(_0x1c4393,_0x2fef67){return function(_0x1188c5){if(_0x1188c5){return _0x1188c5[_0x91ef('0x22')]()['then'](function(){_0x1c4393['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ba43c,_0x4be6d9){return function(_0x28218f){if(!_0x28218f){_0x3ba43c[_0x91ef('0x23')](0x194);}return _0x28218f;};}function handleError(_0x236a60,_0x19a218){_0x19a218=_0x19a218||0x1f4;return function(_0x5f44ca){logger['error'](_0x5f44ca[_0x91ef('0x24')]);if(_0x5f44ca['name']){delete _0x5f44ca[_0x91ef('0x25')];}_0x236a60['status'](_0x19a218)['send'](_0x5f44ca);};}exports[_0x91ef('0x26')]=function(_0x1cf14a,_0x4fc465){var _0xcfe2af={},_0x3c0b80={},_0x34e573={'count':0x0,'rows':[]};var _0x37bda5=_[_0x91ef('0x27')](db[_0x91ef('0x28')]['rawAttributes'],function(_0x4c0e70){return{'name':_0x4c0e70[_0x91ef('0x29')],'type':_0x4c0e70['type']['key']};});_0x3c0b80[_0x91ef('0x2a')]=_[_0x91ef('0x27')](_0x37bda5,_0x91ef('0x25'));_0x3c0b80[_0x91ef('0x2b')]=_[_0x91ef('0x2c')](_0x1cf14a[_0x91ef('0x2b')]);_0x3c0b80[_0x91ef('0x2d')]=_[_0x91ef('0x2e')](_0x3c0b80[_0x91ef('0x2a')],_0x3c0b80[_0x91ef('0x2b')]);_0xcfe2af[_0x91ef('0x2f')]=_[_0x91ef('0x2e')](_0x3c0b80[_0x91ef('0x2a')],qs[_0x91ef('0x30')](_0x1cf14a[_0x91ef('0x2b')][_0x91ef('0x30')]));_0xcfe2af[_0x91ef('0x2f')]=_0xcfe2af['attributes'][_0x91ef('0x31')]?_0xcfe2af[_0x91ef('0x2f')]:_0x3c0b80[_0x91ef('0x2a')];if(!_0x1cf14a[_0x91ef('0x2b')][_0x91ef('0x32')]('nolimit')){_0xcfe2af[_0x91ef('0x1a')]=qs[_0x91ef('0x1a')](_0x1cf14a[_0x91ef('0x2b')][_0x91ef('0x1a')]);_0xcfe2af['offset']=qs[_0x91ef('0x1c')](_0x1cf14a[_0x91ef('0x2b')][_0x91ef('0x1c')]);}_0xcfe2af['order']=qs[_0x91ef('0x33')](_0x1cf14a[_0x91ef('0x2b')][_0x91ef('0x33')]);_0xcfe2af[_0x91ef('0x34')]=qs[_0x91ef('0x2d')](_[_0x91ef('0x35')](_0x1cf14a[_0x91ef('0x2b')],_0x3c0b80['filters']),_0x37bda5);if(_0x1cf14a[_0x91ef('0x2b')][_0x91ef('0x36')]){_0xcfe2af[_0x91ef('0x34')]=_['merge'](_0xcfe2af[_0x91ef('0x34')],{'$or':_[_0x91ef('0x27')](_0x37bda5,function(_0x367ac8){if(_0x367ac8[_0x91ef('0x37')]!=='VIRTUAL'){var _0x24eec5={};_0x24eec5[_0x367ac8[_0x91ef('0x25')]]={'$like':'%'+_0x1cf14a[_0x91ef('0x2b')][_0x91ef('0x36')]+'%'};return _0x24eec5;}})});}_0xcfe2af=_['merge']({},_0xcfe2af,_0x1cf14a[_0x91ef('0x38')]);var _0x8bc78c={'where':_0xcfe2af[_0x91ef('0x34')]};return db['OpenchannelTransferReport'][_0x91ef('0x1b')](_0x8bc78c)[_0x91ef('0x39')](function(_0x1ac5af){_0x34e573['count']=_0x1ac5af;if(_0x1cf14a['query']['includeAll']){_0xcfe2af[_0x91ef('0x3a')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x91ef('0x3b')](_0xcfe2af);})[_0x91ef('0x39')](function(_0x8ece71){_0x34e573[_0x91ef('0x3c')]=_0x8ece71;return _0x34e573;})[_0x91ef('0x39')](respondWithFilteredResult(_0x4fc465,_0xcfe2af))[_0x91ef('0x3d')](handleError(_0x4fc465,null));};exports[_0x91ef('0x3e')]=function(_0x4ea3e1,_0x21c876){var _0x10aaec={'raw':!![],'where':{'id':_0x4ea3e1[_0x91ef('0x3f')]['id']}},_0x5f54fd={};_0x5f54fd['model']=_[_0x91ef('0x2c')](db[_0x91ef('0x28')][_0x91ef('0x40')]);_0x5f54fd[_0x91ef('0x2b')]=_['keys'](_0x4ea3e1[_0x91ef('0x2b')]);_0x5f54fd[_0x91ef('0x2d')]=_[_0x91ef('0x2e')](_0x5f54fd['model'],_0x5f54fd['query']);_0x10aaec[_0x91ef('0x2f')]=_[_0x91ef('0x2e')](_0x5f54fd[_0x91ef('0x2a')],qs[_0x91ef('0x30')](_0x4ea3e1[_0x91ef('0x2b')][_0x91ef('0x30')]));_0x10aaec[_0x91ef('0x2f')]=_0x10aaec[_0x91ef('0x2f')][_0x91ef('0x31')]?_0x10aaec[_0x91ef('0x2f')]:_0x5f54fd[_0x91ef('0x2a')];if(_0x4ea3e1[_0x91ef('0x2b')][_0x91ef('0x41')]){_0x10aaec[_0x91ef('0x3a')]=[{'all':!![]}];}_0x10aaec=_[_0x91ef('0x42')]({},_0x10aaec,_0x4ea3e1[_0x91ef('0x38')]);return db[_0x91ef('0x28')][_0x91ef('0x43')](_0x10aaec)[_0x91ef('0x39')](handleEntityNotFound(_0x21c876,null))[_0x91ef('0x39')](respondWithResult(_0x21c876,null))['catch'](handleError(_0x21c876,null));};exports[_0x91ef('0x44')]=function(_0x23a782,_0x6973a7){return db['OpenchannelTransferReport'][_0x91ef('0x44')](_0x23a782[_0x91ef('0x45')],{})[_0x91ef('0x39')](respondWithResult(_0x6973a7,0xc9))['catch'](handleError(_0x6973a7,null));};exports[_0x91ef('0x21')]=function(_0x2bc03e,_0x843d07){if(_0x2bc03e[_0x91ef('0x45')]['id']){delete _0x2bc03e[_0x91ef('0x45')]['id'];}return db['OpenchannelTransferReport'][_0x91ef('0x43')]({'where':{'id':_0x2bc03e[_0x91ef('0x3f')]['id']}})[_0x91ef('0x39')](handleEntityNotFound(_0x843d07,null))[_0x91ef('0x39')](saveUpdates(_0x2bc03e['body'],null))[_0x91ef('0x39')](respondWithResult(_0x843d07,null))['catch'](handleError(_0x843d07,null));};exports['destroy']=function(_0x8211cb,_0x812c69){return db[_0x91ef('0x28')][_0x91ef('0x43')]({'where':{'id':_0x8211cb[_0x91ef('0x3f')]['id']}})[_0x91ef('0x39')](handleEntityNotFound(_0x812c69,null))[_0x91ef('0x39')](removeEntity(_0x812c69,null))[_0x91ef('0x3d')](handleError(_0x812c69,null));};exports[_0x91ef('0x46')]=function(_0x287fb4,_0x4bff9d){return db['OpenchannelTransferReport']['describe']()[_0x91ef('0x39')](respondWithResult(_0x4bff9d,null))[_0x91ef('0x3d')](handleError(_0x4bff9d,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 55709c1..b14c51a 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 _0xf588=['../../config/logger','api','moment','bluebird','request-promise','./openchannelTransferReport.attributes','define','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xf588,0x1c1));var _0x8f58=function(_0x3584c0,_0x1b6d7c){_0x3584c0=_0x3584c0-0x0;var _0x2970c6=_0xf588[_0x3584c0];return _0x2970c6;};'use strict';var _=require(_0x8f58('0x0'));var util=require(_0x8f58('0x1'));var logger=require(_0x8f58('0x2'))(_0x8f58('0x3'));var moment=require(_0x8f58('0x4'));var BPromise=require(_0x8f58('0x5'));var rp=require(_0x8f58('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8f58('0x7'));module['exports']=function(_0x399a0c,_0x458a4b){return _0x399a0c[_0x8f58('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0x8f58('0x9'),'paranoid':![],'indexes':[{'name':_0x8f58('0xa'),'fields':[_0x8f58('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc077=['../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xc077,0x123));var _0x7c07=function(_0x4ee89a,_0x56d642){_0x4ee89a=_0x4ee89a-0x0;var _0x42aca9=_0xc077[_0x4ee89a];return _0x42aca9;};'use strict';var _=require(_0x7c07('0x0'));var util=require(_0x7c07('0x1'));var logger=require(_0x7c07('0x2'))(_0x7c07('0x3'));var moment=require(_0x7c07('0x4'));var BPromise=require(_0x7c07('0x5'));var rp=require(_0x7c07('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c07('0x7'));var config=require(_0x7c07('0x8'));var attributes=require(_0x7c07('0x9'));module[_0x7c07('0xa')]=function(_0x18f79d,_0xfd3876){return _0x18f79d['define'](_0x7c07('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x7c07('0xc'),'fields':[_0x7c07('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index cf87db6..29fe2a3 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 _0xd2bb=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x2fabbd,_0x5ac720){var _0x467c2d=function(_0x10884a){while(--_0x10884a){_0x2fabbd['push'](_0x2fabbd['shift']());}};_0x467c2d(++_0x5ac720);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x1aa53c,_0x548b73){_0x1aa53c=_0x1aa53c-0x0;var _0x148d6e=_0xd2bb[_0x1aa53c];return _0x148d6e;};'use strict';var _=require('lodash');var util=require(_0xbd2b('0x0'));var moment=require('moment');var BPromise=require(_0xbd2b('0x1'));var rs=require(_0xbd2b('0x2'));var fs=require('fs');var Redis=require(_0xbd2b('0x3'));var db=require(_0xbd2b('0x4'))['db'];var utils=require(_0xbd2b('0x5'));var logger=require(_0xbd2b('0x6'))('rpc');var config=require(_0xbd2b('0x7'));var jayson=require(_0xbd2b('0x8'));var client=jayson[_0xbd2b('0x9')][_0xbd2b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x296d68,_0x3751df,_0x42fee1){return new BPromise(function(_0x30cd3f,_0x259bca){return client[_0xbd2b('0xb')](_0x296d68,_0x42fee1)['then'](function(_0x172aef){logger['info'](_0xbd2b('0xc'),_0x3751df,_0xbd2b('0xd'));logger['debug'](_0xbd2b('0xe'),_0x3751df,_0xbd2b('0xd'),JSON[_0xbd2b('0xf')](_0x172aef));if(_0x172aef[_0xbd2b('0x10')]){if(_0x172aef[_0xbd2b('0x10')][_0xbd2b('0x11')]===0x1f4){logger[_0xbd2b('0x10')](_0xbd2b('0xc'),_0x3751df,_0x172aef['error'][_0xbd2b('0x12')]);return _0x259bca(_0x172aef[_0xbd2b('0x10')][_0xbd2b('0x12')]);}logger[_0xbd2b('0x10')](_0xbd2b('0xc'),_0x3751df,_0x172aef['error'][_0xbd2b('0x12')]);return _0x30cd3f(_0x172aef[_0xbd2b('0x10')][_0xbd2b('0x12')]);}else{logger[_0xbd2b('0x13')](_0xbd2b('0xc'),_0x3751df,_0xbd2b('0xd'));_0x30cd3f(_0x172aef[_0xbd2b('0x14')][_0xbd2b('0x12')]);}})[_0xbd2b('0x15')](function(_0x571596){logger[_0xbd2b('0x10')](_0xbd2b('0xc'),_0x3751df,_0x571596);_0x259bca(_0x571596);});});} \ No newline at end of file +var _0x9f7a=['../../config/environment','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','rpc'];(function(_0x194677,_0x1d6503){var _0x21ca2d=function(_0x587fc8){while(--_0x587fc8){_0x194677['push'](_0x194677['shift']());}};_0x21ca2d(++_0x1d6503);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x9f7a[_0x369151];return _0x4292d5;};'use strict';var _=require(_0xa9f7('0x0'));var util=require(_0xa9f7('0x1'));var moment=require(_0xa9f7('0x2'));var BPromise=require(_0xa9f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa9f7('0x5'));var config=require(_0xa9f7('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa9f7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5497c8,_0x48e791,_0x5bf7ca){return new BPromise(function(_0x21010f,_0x58a3f3){return client[_0xa9f7('0x8')](_0x5497c8,_0x5bf7ca)[_0xa9f7('0x9')](function(_0x287478){logger['info'](_0xa9f7('0xa'),_0x48e791,_0xa9f7('0xb'));logger['debug'](_0xa9f7('0xc'),_0x48e791,_0xa9f7('0xb'),JSON[_0xa9f7('0xd')](_0x287478));if(_0x287478[_0xa9f7('0xe')]){if(_0x287478[_0xa9f7('0xe')][_0xa9f7('0xf')]===0x1f4){logger[_0xa9f7('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x48e791,_0x287478[_0xa9f7('0xe')]['message']);return _0x58a3f3(_0x287478[_0xa9f7('0xe')][_0xa9f7('0x10')]);}logger[_0xa9f7('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x48e791,_0x287478['error'][_0xa9f7('0x10')]);return _0x21010f(_0x287478['error']['message']);}else{logger[_0xa9f7('0x11')](_0xa9f7('0xa'),_0x48e791,_0xa9f7('0xb'));_0x21010f(_0x287478['result'][_0xa9f7('0x10')]);}})[_0xa9f7('0x12')](function(_0x2aeadd){logger['error'](_0xa9f7('0xa'),_0x48e791,_0x2aeadd);_0x58a3f3(_0x2aeadd);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1ff9c46..6be9319 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 _0x4e48=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1029ef,_0x200678){var _0x2aacd5=function(_0x2e768e){while(--_0x2e768e){_0x1029ef['push'](_0x1029ef['shift']());}};_0x2aacd5(++_0x200678);}(_0x4e48,0x9c));var _0x84e4=function(_0x3630a2,_0x4d08df){_0x3630a2=_0x3630a2-0x0;var _0x28d078=_0x4e48[_0x3630a2];return _0x28d078;};'use strict';var multer=require(_0x84e4('0x0'));var util=require(_0x84e4('0x1'));var path=require(_0x84e4('0x2'));var timeout=require(_0x84e4('0x3'));var express=require('express');var router=express[_0x84e4('0x4')]();var fs_extra=require(_0x84e4('0x5'));var auth=require(_0x84e4('0x6'));var interaction=require(_0x84e4('0x7'));var config=require(_0x84e4('0x8'));var controller=require(_0x84e4('0x9'));router[_0x84e4('0xa')]('/',auth[_0x84e4('0xb')](),controller[_0x84e4('0xc')]);router[_0x84e4('0xa')](_0x84e4('0xd'),auth[_0x84e4('0xb')](),controller[_0x84e4('0xe')]);router[_0x84e4('0xf')]('/',auth[_0x84e4('0xb')](),controller['create']);router['put'](_0x84e4('0xd'),auth['isAuthenticated'](),controller[_0x84e4('0x10')]);router[_0x84e4('0x11')](_0x84e4('0xd'),auth[_0x84e4('0xb')](),controller[_0x84e4('0x12')]);module[_0x84e4('0x13')]=router; \ No newline at end of file +var _0xc979=['../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xc979,0x1af));var _0x9c97=function(_0x1807ce,_0x6ca9ee){_0x1807ce=_0x1807ce-0x0;var _0x369184=_0xc979[_0x1807ce];return _0x369184;};'use strict';var multer=require('multer');var util=require(_0x9c97('0x0'));var path=require(_0x9c97('0x1'));var timeout=require(_0x9c97('0x2'));var express=require('express');var router=express[_0x9c97('0x3')]();var fs_extra=require(_0x9c97('0x4'));var auth=require(_0x9c97('0x5'));var interaction=require(_0x9c97('0x6'));var config=require(_0x9c97('0x7'));var controller=require(_0x9c97('0x8'));router[_0x9c97('0x9')]('/',auth[_0x9c97('0xa')](),controller[_0x9c97('0xb')]);router[_0x9c97('0x9')](_0x9c97('0xc'),auth[_0x9c97('0xa')](),controller[_0x9c97('0xd')]);router[_0x9c97('0xe')]('/',auth[_0x9c97('0xa')](),controller['create']);router['put'](_0x9c97('0xc'),auth[_0x9c97('0xa')](),controller[_0x9c97('0xf')]);router[_0x9c97('0x10')]('/:id',auth[_0x9c97('0xa')](),controller[_0x9c97('0x11')]);module[_0x9c97('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 2d54d0b..4799afc 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 _0x4913=['STRING','name','sequelize','exports'];(function(_0x16231a,_0x44ae2e){var _0x3c459d=function(_0x399664){while(--_0x399664){_0x16231a['push'](_0x16231a['shift']());}};_0x3c459d(++_0x44ae2e);}(_0x4913,0xfe));var _0x3491=function(_0x5be550,_0x54eeff){_0x5be550=_0x5be550-0x0;var _0x1408b1=_0x4913[_0x5be550];return _0x1408b1;};'use strict';var Sequelize=require(_0x3491('0x0'));module[_0x3491('0x1')]={'name':{'type':Sequelize[_0x3491('0x2')],'unique':_0x3491('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3491('0x2')]}}; \ No newline at end of file +var _0x5f71=['STRING','sequelize','exports','name'];(function(_0x3d9661,_0x4b539e){var _0x224135=function(_0x5a1f26){while(--_0x5a1f26){_0x3d9661['push'](_0x3d9661['shift']());}};_0x224135(++_0x4b539e);}(_0x5f71,0x71));var _0x15f7=function(_0x271487,_0x3a9078){_0x271487=_0x271487-0x0;var _0x9f868b=_0x5f71[_0x271487];return _0x9f868b;};'use strict';var Sequelize=require(_0x15f7('0x0'));module[_0x15f7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x15f7('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x15f7('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 0a7649e..71b68d6 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 _0x0026=['send','index','map','Pause','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','length','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','sendStatus','error','stack','name'];(function(_0x32865b,_0x4a9e1a){var _0x3991db=function(_0x169b6c){while(--_0x169b6c){_0x32865b['push'](_0x32865b['shift']());}};_0x3991db(++_0x4a9e1a);}(_0x0026,0x1d4));var _0x6002=function(_0x15a192,_0x333263){_0x15a192=_0x15a192-0x0;var _0x45af9c=_0x0026[_0x15a192];return _0x45af9c;};'use strict';var emlformat=require(_0x6002('0x0'));var rimraf=require(_0x6002('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6002('0x2'));var rp=require(_0x6002('0x3'));var moment=require(_0x6002('0x4'));var BPromise=require(_0x6002('0x5'));var Mustache=require(_0x6002('0x6'));var util=require('util');var path=require(_0x6002('0x7'));var sox=require(_0x6002('0x8'));var csv=require('to-csv');var ejs=require(_0x6002('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6002('0xa'));var squel=require(_0x6002('0xb'));var crypto=require(_0x6002('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6002('0xd'));var toCsv=require(_0x6002('0xe'));var querystring=require(_0x6002('0xf'));var Papa=require('papaparse');var Redis=require(_0x6002('0x10'));var authService=require(_0x6002('0x11'));var qs=require(_0x6002('0x12'));var as=require(_0x6002('0x13'));var hardwareService=require(_0x6002('0x14'));var logger=require(_0x6002('0x15'))(_0x6002('0x16'));var utils=require(_0x6002('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6002('0x18'));var db=require(_0x6002('0x19'))['db'];function respondWithStatusCode(_0x1ef779,_0x1cb48f){_0x1cb48f=_0x1cb48f||0xcc;return function(_0x472e63){if(_0x472e63){return _0x1ef779['sendStatus'](_0x1cb48f);}return _0x1ef779[_0x6002('0x1a')](_0x1cb48f)[_0x6002('0x1b')]();};}function respondWithResult(_0x59fb3c,_0x1d5dca){_0x1d5dca=_0x1d5dca||0xc8;return function(_0x268c11){if(_0x268c11){return _0x59fb3c['status'](_0x1d5dca)[_0x6002('0x1c')](_0x268c11);}};}function respondWithFilteredResult(_0x23b213,_0x2ed50c){return function(_0x1eb543){if(_0x1eb543){var _0x4dd91d=typeof _0x2ed50c[_0x6002('0x1d')]==='undefined'&&typeof _0x2ed50c[_0x6002('0x1e')]===_0x6002('0x1f');var _0x178001=_0x1eb543[_0x6002('0x20')];var _0x59f9f8=_0x4dd91d?0x0:_0x2ed50c[_0x6002('0x1d')];var _0x118a47=_0x4dd91d?_0x1eb543[_0x6002('0x20')]:_0x2ed50c['offset']+_0x2ed50c['limit'];var _0x359249;if(_0x118a47>=_0x178001){_0x118a47=_0x178001;_0x359249=0xc8;}else{_0x359249=0xce;}_0x23b213[_0x6002('0x1a')](_0x359249);return _0x23b213[_0x6002('0x21')](_0x6002('0x22'),_0x59f9f8+'-'+_0x118a47+'/'+_0x178001)['json'](_0x1eb543);}return null;};}function patchUpdates(_0x3c18b9){return function(_0x1b2dc4){try{jsonpatch[_0x6002('0x23')](_0x1b2dc4,_0x3c18b9,!![]);}catch(_0x64d506){return BPromise[_0x6002('0x24')](_0x64d506);}return _0x1b2dc4[_0x6002('0x25')]();};}function saveUpdates(_0x53707f,_0x2ac108){return function(_0x4aebbb){if(_0x4aebbb){return _0x4aebbb[_0x6002('0x26')](_0x53707f)[_0x6002('0x27')](function(_0x1e3bc5){return _0x1e3bc5;});}return null;};}function removeEntity(_0x27a115,_0x3a8eda){return function(_0x39326c){if(_0x39326c){return _0x39326c[_0x6002('0x28')]()[_0x6002('0x27')](function(){var _0x5813=_0x39326c[_0x6002('0x29')]({'plain':!![]});var _0x4bbeda=_0x6002('0x2a');return db[_0x6002('0x2b')][_0x6002('0x28')]({'where':{'type':_0x4bbeda,'resourceId':_0x5813['id']}})[_0x6002('0x27')](function(){return _0x39326c;});})[_0x6002('0x27')](function(){_0x27a115[_0x6002('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18a5ce,_0x39207d){return function(_0x508c8e){if(!_0x508c8e){_0x18a5ce[_0x6002('0x2c')](0x194);}return _0x508c8e;};}function handleError(_0x331e5d,_0xe3f6c7){_0xe3f6c7=_0xe3f6c7||0x1f4;return function(_0x5e9aa8){logger[_0x6002('0x2d')](_0x5e9aa8[_0x6002('0x2e')]);if(_0x5e9aa8[_0x6002('0x2f')]){delete _0x5e9aa8[_0x6002('0x2f')];}_0x331e5d[_0x6002('0x1a')](_0xe3f6c7)[_0x6002('0x30')](_0x5e9aa8);};}exports[_0x6002('0x31')]=function(_0xf6d4b0,_0x4e40f0){var _0x4e3e91={},_0x2aeeca={},_0x5381f9={'count':0x0,'rows':[]};var _0xaa43e0=_[_0x6002('0x32')](db[_0x6002('0x33')][_0x6002('0x34')],function(_0x132d9c){return{'name':_0x132d9c[_0x6002('0x35')],'type':_0x132d9c[_0x6002('0x36')]['key']};});_0x2aeeca[_0x6002('0x37')]=_['map'](_0xaa43e0,'name');_0x2aeeca[_0x6002('0x38')]=_['keys'](_0xf6d4b0[_0x6002('0x38')]);_0x2aeeca[_0x6002('0x39')]=_[_0x6002('0x3a')](_0x2aeeca['model'],_0x2aeeca[_0x6002('0x38')]);_0x4e3e91[_0x6002('0x3b')]=_['intersection'](_0x2aeeca[_0x6002('0x37')],qs['fields'](_0xf6d4b0[_0x6002('0x38')][_0x6002('0x3c')]));_0x4e3e91[_0x6002('0x3b')]=_0x4e3e91[_0x6002('0x3b')]['length']?_0x4e3e91[_0x6002('0x3b')]:_0x2aeeca[_0x6002('0x37')];if(!_0xf6d4b0[_0x6002('0x38')][_0x6002('0x3d')](_0x6002('0x3e'))){_0x4e3e91['limit']=qs['limit'](_0xf6d4b0['query']['limit']);_0x4e3e91[_0x6002('0x1d')]=qs[_0x6002('0x1d')](_0xf6d4b0[_0x6002('0x38')][_0x6002('0x1d')]);}_0x4e3e91[_0x6002('0x3f')]=qs[_0x6002('0x40')](_0xf6d4b0[_0x6002('0x38')]['sort']);_0x4e3e91[_0x6002('0x41')]=qs[_0x6002('0x39')](_[_0x6002('0x42')](_0xf6d4b0['query'],_0x2aeeca['filters']),_0xaa43e0);if(_0xf6d4b0['query'][_0x6002('0x43')]){_0x4e3e91[_0x6002('0x41')]=_[_0x6002('0x44')](_0x4e3e91[_0x6002('0x41')],{'$or':_['map'](_0xaa43e0,function(_0x155323){if(_0x155323[_0x6002('0x36')]!==_0x6002('0x45')){var _0x4c564e={};_0x4c564e[_0x155323['name']]={'$like':'%'+_0xf6d4b0['query'][_0x6002('0x43')]+'%'};return _0x4c564e;}})});}_0x4e3e91=_['merge']({},_0x4e3e91,_0xf6d4b0[_0x6002('0x46')]);var _0x36d115={'where':_0x4e3e91[_0x6002('0x41')]};return db['Pause'][_0x6002('0x20')](_0x36d115)['then'](function(_0x55d89d){_0x5381f9['count']=_0x55d89d;if(_0xf6d4b0[_0x6002('0x38')][_0x6002('0x47')]){_0x4e3e91[_0x6002('0x48')]=[{'all':!![]}];}return db[_0x6002('0x33')]['findAll'](_0x4e3e91);})[_0x6002('0x27')](function(_0xbf3c12){_0x5381f9[_0x6002('0x49')]=_0xbf3c12;return _0x5381f9;})['then'](respondWithFilteredResult(_0x4e40f0,_0x4e3e91))[_0x6002('0x4a')](handleError(_0x4e40f0,null));};exports['show']=function(_0x314797,_0x403139){var _0x1b75d5={'raw':!![],'where':{'id':_0x314797[_0x6002('0x4b')]['id']}},_0xce6322={};_0xce6322[_0x6002('0x37')]=_[_0x6002('0x4c')](db[_0x6002('0x33')][_0x6002('0x34')]);_0xce6322[_0x6002('0x38')]=_[_0x6002('0x4c')](_0x314797[_0x6002('0x38')]);_0xce6322[_0x6002('0x39')]=_[_0x6002('0x3a')](_0xce6322[_0x6002('0x37')],_0xce6322['query']);_0x1b75d5[_0x6002('0x3b')]=_['intersection'](_0xce6322[_0x6002('0x37')],qs[_0x6002('0x3c')](_0x314797[_0x6002('0x38')]['fields']));_0x1b75d5[_0x6002('0x3b')]=_0x1b75d5[_0x6002('0x3b')][_0x6002('0x4d')]?_0x1b75d5[_0x6002('0x3b')]:_0xce6322[_0x6002('0x37')];if(_0x314797['query'][_0x6002('0x47')]){_0x1b75d5[_0x6002('0x48')]=[{'all':!![]}];}_0x1b75d5=_[_0x6002('0x44')]({},_0x1b75d5,_0x314797[_0x6002('0x46')]);return db[_0x6002('0x33')][_0x6002('0x4e')](_0x1b75d5)['then'](handleEntityNotFound(_0x403139,null))[_0x6002('0x27')](respondWithResult(_0x403139,null))[_0x6002('0x4a')](handleError(_0x403139,null));};exports[_0x6002('0x4f')]=function(_0x4575e1,_0x571cc8){return db['Pause'][_0x6002('0x4f')](_0x4575e1[_0x6002('0x50')],{})['then'](function(_0x289f82){var _0x5e810f=_0x4575e1[_0x6002('0x51')][_0x6002('0x29')]({'plain':!![]});if(!_0x5e810f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e810f[_0x6002('0x52')]===_0x6002('0x51')){var _0xc676d8=_0x289f82[_0x6002('0x29')]({'plain':!![]});var _0x1b0705=_0x6002('0x2a');return db['UserProfileSection'][_0x6002('0x4e')]({'where':{'name':_0x1b0705,'userProfileId':_0x5e810f[_0x6002('0x53')]},'raw':!![]})[_0x6002('0x27')](function(_0x3e52d7){if(_0x3e52d7&&_0x3e52d7[_0x6002('0x54')]===0x0){return db['UserProfileResource'][_0x6002('0x4f')]({'name':_0xc676d8[_0x6002('0x2f')],'resourceId':_0xc676d8['id'],'type':_0x3e52d7[_0x6002('0x2f')],'sectionId':_0x3e52d7['id']},{})['then'](function(){return _0x289f82;});}else{return _0x289f82;}})[_0x6002('0x4a')](function(_0x47aaf3){logger['error'](_0x6002('0x55'),_0x47aaf3);throw _0x47aaf3;});}return _0x289f82;})[_0x6002('0x27')](respondWithResult(_0x571cc8,0xc9))[_0x6002('0x4a')](handleError(_0x571cc8,null));};exports[_0x6002('0x26')]=function(_0x5430bd,_0x551aa1){if(_0x5430bd[_0x6002('0x50')]['id']){delete _0x5430bd[_0x6002('0x50')]['id'];}return db[_0x6002('0x33')][_0x6002('0x4e')]({'where':{'id':_0x5430bd[_0x6002('0x4b')]['id']}})['then'](handleEntityNotFound(_0x551aa1,null))[_0x6002('0x27')](saveUpdates(_0x5430bd['body'],null))[_0x6002('0x27')](respondWithResult(_0x551aa1,null))[_0x6002('0x4a')](handleError(_0x551aa1,null));};exports[_0x6002('0x28')]=function(_0x29b020,_0x220268){return db['Pause'][_0x6002('0x4e')]({'where':{'id':_0x29b020['params']['id']}})['then'](handleEntityNotFound(_0x220268,null))[_0x6002('0x27')](removeEntity(_0x220268,null))['catch'](handleError(_0x220268,null));}; \ No newline at end of file +var _0x38c1=['keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','merge','options','where','includeAll','include','Pause','findAll','rows','catch','params','find','create','body','role','user','UserProfileSection','UserProfileResource','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x2ab78d,_0x42edda){var _0x58ec25=function(_0x2013f5){while(--_0x2013f5){_0x2ab78d['push'](_0x2ab78d['shift']());}};_0x58ec25(++_0x42edda);}(_0x38c1,0x1e6));var _0x138c=function(_0xd0f42d,_0x5beaab){_0xd0f42d=_0xd0f42d-0x0;var _0x26534c=_0x38c1[_0xd0f42d];return _0x26534c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x138c('0x0'));var jsonpatch=require(_0x138c('0x1'));var rp=require(_0x138c('0x2'));var moment=require(_0x138c('0x3'));var BPromise=require(_0x138c('0x4'));var Mustache=require('mustache');var util=require(_0x138c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x138c('0x6'));var ejs=require(_0x138c('0x7'));var fs=require('fs');var fs_extra=require(_0x138c('0x8'));var _=require(_0x138c('0x9'));var squel=require('squel');var crypto=require(_0x138c('0xa'));var jsforce=require(_0x138c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x138c('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x138c('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x138c('0xd'));var logger=require('../../config/logger')(_0x138c('0xe'));var utils=require(_0x138c('0xf'));var config=require(_0x138c('0x10'));var licenseUtil=require(_0x138c('0x11'));var db=require(_0x138c('0x12'))['db'];function respondWithStatusCode(_0x4bfa99,_0x5e36e4){_0x5e36e4=_0x5e36e4||0xcc;return function(_0x2fa847){if(_0x2fa847){return _0x4bfa99[_0x138c('0x13')](_0x5e36e4);}return _0x4bfa99[_0x138c('0x14')](_0x5e36e4)[_0x138c('0x15')]();};}function respondWithResult(_0x2244a0,_0x59381a){_0x59381a=_0x59381a||0xc8;return function(_0x2be2b8){if(_0x2be2b8){return _0x2244a0[_0x138c('0x14')](_0x59381a)[_0x138c('0x16')](_0x2be2b8);}};}function respondWithFilteredResult(_0x326909,_0xd99042){return function(_0x59b01e){if(_0x59b01e){var _0x1f0671=typeof _0xd99042[_0x138c('0x17')]===_0x138c('0x18')&&typeof _0xd99042[_0x138c('0x19')]===_0x138c('0x18');var _0x87e62=_0x59b01e['count'];var _0x1d9538=_0x1f0671?0x0:_0xd99042['offset'];var _0x1fb507=_0x1f0671?_0x59b01e[_0x138c('0x1a')]:_0xd99042[_0x138c('0x17')]+_0xd99042[_0x138c('0x19')];var _0x6ed3fe;if(_0x1fb507>=_0x87e62){_0x1fb507=_0x87e62;_0x6ed3fe=0xc8;}else{_0x6ed3fe=0xce;}_0x326909[_0x138c('0x14')](_0x6ed3fe);return _0x326909[_0x138c('0x1b')](_0x138c('0x1c'),_0x1d9538+'-'+_0x1fb507+'/'+_0x87e62)[_0x138c('0x16')](_0x59b01e);}return null;};}function patchUpdates(_0x3adddd){return function(_0x57aa20){try{jsonpatch[_0x138c('0x1d')](_0x57aa20,_0x3adddd,!![]);}catch(_0x2424ad){return BPromise[_0x138c('0x1e')](_0x2424ad);}return _0x57aa20[_0x138c('0x1f')]();};}function saveUpdates(_0x40da58,_0x12a922){return function(_0x1a35a2){if(_0x1a35a2){return _0x1a35a2[_0x138c('0x20')](_0x40da58)[_0x138c('0x21')](function(_0x387eff){return _0x387eff;});}return null;};}function removeEntity(_0x1fcd12,_0x1bb5e8){return function(_0x1f4650){if(_0x1f4650){return _0x1f4650[_0x138c('0x22')]()['then'](function(){var _0x1407e2=_0x1f4650[_0x138c('0x23')]({'plain':!![]});var _0x5a2c87=_0x138c('0x24');return db['UserProfileResource'][_0x138c('0x22')]({'where':{'type':_0x5a2c87,'resourceId':_0x1407e2['id']}})['then'](function(){return _0x1f4650;});})[_0x138c('0x21')](function(){_0x1fcd12[_0x138c('0x14')](0xcc)[_0x138c('0x15')]();});}};}function handleEntityNotFound(_0x205347,_0x71c428){return function(_0x59c143){if(!_0x59c143){_0x205347[_0x138c('0x13')](0x194);}return _0x59c143;};}function handleError(_0xbc20ba,_0x347fb8){_0x347fb8=_0x347fb8||0x1f4;return function(_0x3c4355){logger['error'](_0x3c4355['stack']);if(_0x3c4355['name']){delete _0x3c4355['name'];}_0xbc20ba['status'](_0x347fb8)[_0x138c('0x25')](_0x3c4355);};}exports[_0x138c('0x26')]=function(_0x4b3f03,_0x5140b0){var _0x372aaa={},_0x4fab9c={},_0x5f1b9c={'count':0x0,'rows':[]};var _0xe14f82=_[_0x138c('0x27')](db['Pause'][_0x138c('0x28')],function(_0xa701b){return{'name':_0xa701b[_0x138c('0x29')],'type':_0xa701b[_0x138c('0x2a')][_0x138c('0x2b')]};});_0x4fab9c[_0x138c('0x2c')]=_['map'](_0xe14f82,'name');_0x4fab9c[_0x138c('0x2d')]=_[_0x138c('0x2e')](_0x4b3f03['query']);_0x4fab9c['filters']=_[_0x138c('0x2f')](_0x4fab9c[_0x138c('0x2c')],_0x4fab9c[_0x138c('0x2d')]);_0x372aaa[_0x138c('0x30')]=_[_0x138c('0x2f')](_0x4fab9c[_0x138c('0x2c')],qs['fields'](_0x4b3f03[_0x138c('0x2d')][_0x138c('0x31')]));_0x372aaa[_0x138c('0x30')]=_0x372aaa[_0x138c('0x30')]['length']?_0x372aaa[_0x138c('0x30')]:_0x4fab9c[_0x138c('0x2c')];if(!_0x4b3f03[_0x138c('0x2d')][_0x138c('0x32')]('nolimit')){_0x372aaa['limit']=qs[_0x138c('0x19')](_0x4b3f03[_0x138c('0x2d')][_0x138c('0x19')]);_0x372aaa[_0x138c('0x17')]=qs['offset'](_0x4b3f03[_0x138c('0x2d')][_0x138c('0x17')]);}_0x372aaa[_0x138c('0x33')]=qs[_0x138c('0x34')](_0x4b3f03[_0x138c('0x2d')][_0x138c('0x34')]);_0x372aaa['where']=qs[_0x138c('0x35')](_[_0x138c('0x36')](_0x4b3f03[_0x138c('0x2d')],_0x4fab9c[_0x138c('0x35')]),_0xe14f82);if(_0x4b3f03[_0x138c('0x2d')][_0x138c('0x37')]){_0x372aaa['where']=_['merge'](_0x372aaa['where'],{'$or':_[_0x138c('0x27')](_0xe14f82,function(_0x525dc1){if(_0x525dc1[_0x138c('0x2a')]!=='VIRTUAL'){var _0x1110a9={};_0x1110a9[_0x525dc1['name']]={'$like':'%'+_0x4b3f03['query'][_0x138c('0x37')]+'%'};return _0x1110a9;}})});}_0x372aaa=_[_0x138c('0x38')]({},_0x372aaa,_0x4b3f03[_0x138c('0x39')]);var _0x31cf0f={'where':_0x372aaa[_0x138c('0x3a')]};return db['Pause'][_0x138c('0x1a')](_0x31cf0f)[_0x138c('0x21')](function(_0x1f15c6){_0x5f1b9c['count']=_0x1f15c6;if(_0x4b3f03[_0x138c('0x2d')][_0x138c('0x3b')]){_0x372aaa[_0x138c('0x3c')]=[{'all':!![]}];}return db[_0x138c('0x3d')][_0x138c('0x3e')](_0x372aaa);})[_0x138c('0x21')](function(_0x44090f){_0x5f1b9c[_0x138c('0x3f')]=_0x44090f;return _0x5f1b9c;})[_0x138c('0x21')](respondWithFilteredResult(_0x5140b0,_0x372aaa))[_0x138c('0x40')](handleError(_0x5140b0,null));};exports['show']=function(_0x49d23e,_0x4b1cc2){var _0x538ab7={'raw':!![],'where':{'id':_0x49d23e[_0x138c('0x41')]['id']}},_0x1a3667={};_0x1a3667[_0x138c('0x2c')]=_['keys'](db[_0x138c('0x3d')][_0x138c('0x28')]);_0x1a3667[_0x138c('0x2d')]=_[_0x138c('0x2e')](_0x49d23e[_0x138c('0x2d')]);_0x1a3667[_0x138c('0x35')]=_['intersection'](_0x1a3667['model'],_0x1a3667['query']);_0x538ab7[_0x138c('0x30')]=_[_0x138c('0x2f')](_0x1a3667[_0x138c('0x2c')],qs[_0x138c('0x31')](_0x49d23e[_0x138c('0x2d')][_0x138c('0x31')]));_0x538ab7[_0x138c('0x30')]=_0x538ab7['attributes']['length']?_0x538ab7[_0x138c('0x30')]:_0x1a3667[_0x138c('0x2c')];if(_0x49d23e['query']['includeAll']){_0x538ab7['include']=[{'all':!![]}];}_0x538ab7=_[_0x138c('0x38')]({},_0x538ab7,_0x49d23e[_0x138c('0x39')]);return db['Pause'][_0x138c('0x42')](_0x538ab7)[_0x138c('0x21')](handleEntityNotFound(_0x4b1cc2,null))['then'](respondWithResult(_0x4b1cc2,null))[_0x138c('0x40')](handleError(_0x4b1cc2,null));};exports['create']=function(_0x1c9b31,_0x53e276){return db['Pause'][_0x138c('0x43')](_0x1c9b31[_0x138c('0x44')],{})[_0x138c('0x21')](function(_0x28a227){var _0x123e69=_0x1c9b31['user']['get']({'plain':!![]});if(!_0x123e69)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x123e69[_0x138c('0x45')]===_0x138c('0x46')){var _0x19f9c6=_0x28a227[_0x138c('0x23')]({'plain':!![]});var _0x4f6961=_0x138c('0x24');return db[_0x138c('0x47')]['find']({'where':{'name':_0x4f6961,'userProfileId':_0x123e69['userProfileId']},'raw':!![]})[_0x138c('0x21')](function(_0x42fd5f){if(_0x42fd5f&&_0x42fd5f['autoAssociation']===0x0){return db[_0x138c('0x48')][_0x138c('0x43')]({'name':_0x19f9c6[_0x138c('0x49')],'resourceId':_0x19f9c6['id'],'type':_0x42fd5f[_0x138c('0x49')],'sectionId':_0x42fd5f['id']},{})[_0x138c('0x21')](function(){return _0x28a227;});}else{return _0x28a227;}})[_0x138c('0x40')](function(_0x1483d3){logger[_0x138c('0x4a')](_0x138c('0x4b'),_0x1483d3);throw _0x1483d3;});}return _0x28a227;})[_0x138c('0x21')](respondWithResult(_0x53e276,0xc9))['catch'](handleError(_0x53e276,null));};exports['update']=function(_0x13b66b,_0x42679c){if(_0x13b66b[_0x138c('0x44')]['id']){delete _0x13b66b[_0x138c('0x44')]['id'];}return db[_0x138c('0x3d')]['find']({'where':{'id':_0x13b66b[_0x138c('0x41')]['id']}})[_0x138c('0x21')](handleEntityNotFound(_0x42679c,null))['then'](saveUpdates(_0x13b66b[_0x138c('0x44')],null))[_0x138c('0x21')](respondWithResult(_0x42679c,null))['catch'](handleError(_0x42679c,null));};exports[_0x138c('0x22')]=function(_0x2ad8a4,_0x2c5053){return db[_0x138c('0x3d')][_0x138c('0x42')]({'where':{'id':_0x2ad8a4[_0x138c('0x41')]['id']}})[_0x138c('0x21')](handleEntityNotFound(_0x2c5053,null))['then'](removeEntity(_0x2c5053,null))[_0x138c('0x40')](handleError(_0x2c5053,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 226da7e..b5f3013 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0xb4aac7,_0x4934cc){var _0x538775=function(_0x1e518d){while(--_0x1e518d){_0xb4aac7['push'](_0xb4aac7['shift']());}};_0x538775(++_0x4934cc);}(_0xabce,0x103));var _0xeabc=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xabce[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x15bbf1,_0x40ef96){var _0x5c4b47=function(_0x303b4f){while(--_0x303b4f){_0x15bbf1['push'](_0x15bbf1['shift']());}};_0x5c4b47(++_0x40ef96);}(_0x7217,0x19e));var _0x7721=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7217[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 576251d..5ba025d 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x2a3357,_0x5e0e46){var _0x225809=function(_0x1d8bce){while(--_0x1d8bce){_0x2a3357['push'](_0x2a3357['shift']());}};_0x225809(++_0x5e0e46);}(_0xb10b,0x12a));var _0xbb10=function(_0x4ec65f,_0x871c26){_0x4ec65f=_0x4ec65f-0x0;var _0x5d1143=_0xb10b[_0x4ec65f];return _0x5d1143;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0xf0185d,_0x3d365c){var _0x344406=function(_0x1feed3){while(--_0x1feed3){_0xf0185d['push'](_0xf0185d['shift']());}};_0x344406(++_0x3d365c);}(_0x7a54,0x106));var _0x47a5=function(_0x57aff1,_0x446b42){_0x57aff1=_0x57aff1-0x0;var _0x4aabf6=_0x7a54[_0x57aff1];return _0x4aabf6;};'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 75e67a8..d4768f0 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 _0xcea2=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','get','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','extname','post','single','file','upload','put','update','delete','multer','path'];(function(_0x34cc02,_0x57a129){var _0x160864=function(_0x21076c){while(--_0x21076c){_0x34cc02['push'](_0x34cc02['shift']());}};_0x160864(++_0x57a129);}(_0xcea2,0x15a));var _0x2cea=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xcea2[_0x1f9f37];return _0x21c080;};'use strict';var multer=require(_0x2cea('0x0'));var util=require('util');var path=require(_0x2cea('0x1'));var timeout=require('connect-timeout');var express=require(_0x2cea('0x2'));var router=express[_0x2cea('0x3')]();var fs_extra=require(_0x2cea('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var controller=require(_0x2cea('0x7'));router['get']('/',auth[_0x2cea('0x8')](),controller['index']);router[_0x2cea('0x9')](_0x2cea('0xa'),controller[_0x2cea('0xb')]);router[_0x2cea('0x9')](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller['show']);router[_0x2cea('0x9')](_0x2cea('0xd'),auth[_0x2cea('0x8')](),controller[_0x2cea('0xe')]);var upload=multer({'storage':multer[_0x2cea('0xf')]({'destination':function(_0x439c4d,_0x4298a4,_0x1c9142){_0x1c9142(null,path['join'](config['root'],_0x2cea('0x10')));},'filename':function(_0x2db0ff,_0x528c1d,_0x4bd265){_0x528c1d[_0x2cea('0x11')]=_0x528c1d['originalname'][_0x2cea('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bd265(null,util[_0x2cea('0x13')](_0x2cea('0x14'),path['basename'](_0x528c1d['originalname'],path['extname'](_0x528c1d[_0x2cea('0x11')])),Date['now'](),path[_0x2cea('0x15')](_0x528c1d[_0x2cea('0x11')])));}})});router[_0x2cea('0x16')]('/',upload[_0x2cea('0x17')](_0x2cea('0x18')),controller[_0x2cea('0x19')]);router[_0x2cea('0x16')](_0x2cea('0xa'),controller['webhookPost']);router[_0x2cea('0x1a')](_0x2cea('0xc'),auth[_0x2cea('0x8')](),controller[_0x2cea('0x1b')]);router[_0x2cea('0x1c')](_0x2cea('0xc'),auth['isAuthenticated'](),controller[_0x2cea('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x3e74=['originalname','format','%s-%s%s','basename','now','extname','file','upload','post','put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','download','diskStorage','join','root'];(function(_0x290da3,_0x11cbaf){var _0xd39ce7=function(_0x54c0ef){while(--_0x54c0ef){_0x290da3['push'](_0x290da3['shift']());}};_0xd39ce7(++_0x11cbaf);}(_0x3e74,0x175));var _0x43e7=function(_0x5c4286,_0x481407){_0x5c4286=_0x5c4286-0x0;var _0x3a236c=_0x3e74[_0x5c4286];return _0x3a236c;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['show']);router[_0x43e7('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0x43e7('0xd')]);var upload=multer({'storage':multer[_0x43e7('0xe')]({'destination':function(_0x5c34f4,_0x2803d9,_0x513707){_0x513707(null,path[_0x43e7('0xf')](config[_0x43e7('0x10')],'server/files/plugins'));},'filename':function(_0x3eb206,_0xc960ea,_0x2718d3){_0xc960ea[_0x43e7('0x11')]=_0xc960ea['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2718d3(null,util[_0x43e7('0x12')](_0x43e7('0x13'),path[_0x43e7('0x14')](_0xc960ea['originalname'],path['extname'](_0xc960ea[_0x43e7('0x11')])),Date[_0x43e7('0x15')](),path[_0x43e7('0x16')](_0xc960ea[_0x43e7('0x11')])));}})});router['post']('/',upload['single'](_0x43e7('0x17')),controller[_0x43e7('0x18')]);router[_0x43e7('0x19')]('/webhook',controller['webhookPost']);router[_0x43e7('0x1a')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x1b')]);router[_0x43e7('0x1c')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x1c')]);module[_0x43e7('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 165381b..25e82e5 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 _0x293a=['exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x32f144,_0x374f95){var _0x4c9fad=function(_0x4112a9){while(--_0x4112a9){_0x32f144['push'](_0x32f144['shift']());}};_0x4c9fad(++_0x374f95);}(_0x293a,0x16c));var _0xa293=function(_0x7e918f,_0x48cf10){_0x7e918f=_0x7e918f-0x0;var _0x5b35ab=_0x293a[_0x7e918f];return _0x5b35ab;};'use strict';var Sequelize=require('sequelize');module[_0xa293('0x0')]={'name':{'type':Sequelize[_0xa293('0x1')]},'type':{'type':Sequelize[_0xa293('0x2')](_0xa293('0x3'),_0xa293('0x4'))},'description':{'type':Sequelize[_0xa293('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xa293('0x1')],'comment':_0xa293('0x6')},'active':{'type':Sequelize[_0xa293('0x7')],'defaultValue':0x0,'comment':_0xa293('0x8')},'sidebar':{'type':Sequelize[_0xa293('0x2')](_0xa293('0x9'),_0xa293('0xa'),_0xa293('0xb'),'never'),'defaultValue':_0xa293('0xb'),'comment':_0xa293('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xa293('0x1')]},'agentUrl':{'type':Sequelize[_0xa293('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2d97=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','exports','ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x2e9104,_0x133225){var _0x494749=function(_0x228a86){while(--_0x228a86){_0x2e9104['push'](_0x2e9104['shift']());}};_0x494749(++_0x133225);}(_0x2d97,0x1f1));var _0x72d9=function(_0x1da42f,_0x23dc53){_0x1da42f=_0x1da42f-0x0;var _0x458c83=_0x2d97[_0x1da42f];return _0x458c83;};'use strict';var Sequelize=require('sequelize');module[_0x72d9('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x72d9('0x1')](_0x72d9('0x2'),'script')},'description':{'type':Sequelize[_0x72d9('0x3')]},'version':{'type':Sequelize[_0x72d9('0x3')]},'path':{'type':Sequelize[_0x72d9('0x4')],'comment':_0x72d9('0x5')},'active':{'type':Sequelize[_0x72d9('0x6')],'defaultValue':0x0,'comment':_0x72d9('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x72d9('0x8'),_0x72d9('0x9'),_0x72d9('0xa'),_0x72d9('0xb')),'defaultValue':_0x72d9('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x72d9('0x4')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x72d9('0x4')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f8e7ed8..c0c4256 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 _0x91f1=['length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','include','findAll','rows','keys','options','find','catch','download','params','format','%s.zip','zip','warning','code','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','join','root','server/files/plugins','dirname','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','unlinkSync','Download\x20completed','info','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','role','userProfileId','user','Plugins','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','json','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','error','name','send','index','map','Plugin','rawAttributes','type','key','query','filters','intersection','model','fields','attributes'];(function(_0x292b2c,_0x5cfd18){var _0x3eda0b=function(_0x2610fb){while(--_0x2610fb){_0x292b2c['push'](_0x292b2c['shift']());}};_0x3eda0b(++_0x5cfd18);}(_0x91f1,0x11a));var _0x191f=function(_0x59ff38,_0x415ba5){_0x59ff38=_0x59ff38-0x0;var _0x5dcbf9=_0x91f1[_0x59ff38];return _0x5dcbf9;};'use strict';var emlformat=require(_0x191f('0x0'));var rimraf=require(_0x191f('0x1'));var zipdir=require(_0x191f('0x2'));var jsonpatch=require(_0x191f('0x3'));var rp=require(_0x191f('0x4'));var moment=require(_0x191f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x191f('0x6'));var path=require(_0x191f('0x7'));var sox=require(_0x191f('0x8'));var csv=require('to-csv');var ejs=require(_0x191f('0x9'));var fs=require('fs');var fs_extra=require(_0x191f('0xa'));var _=require(_0x191f('0xb'));var squel=require(_0x191f('0xc'));var crypto=require(_0x191f('0xd'));var jsforce=require(_0x191f('0xe'));var deskjs=require(_0x191f('0xf'));var toCsv=require(_0x191f('0x10'));var querystring=require(_0x191f('0x11'));var Papa=require(_0x191f('0x12'));var extract=require(_0x191f('0x13'));var rimraf=require(_0x191f('0x1'));var archiver=require(_0x191f('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x191f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x191f('0x16'))(_0x191f('0x17'));var utils=require(_0x191f('0x18'));var config=require(_0x191f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x191f('0x1a'))['db'];config[_0x191f('0x1b')]=_[_0x191f('0x1c')](config[_0x191f('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x191f('0x1d'))(new Redis(config[_0x191f('0x1b')]));require('./plugin.socket')[_0x191f('0x1e')](socket);function respondWithStatusCode(_0x4e0de1,_0x4717f5){_0x4717f5=_0x4717f5||0xcc;return function(_0x274e7b){if(_0x274e7b){return _0x4e0de1[_0x191f('0x1f')](_0x4717f5);}return _0x4e0de1[_0x191f('0x20')](_0x4717f5)[_0x191f('0x21')]();};}function respondWithResult(_0x286bb5,_0x44b1e4){_0x44b1e4=_0x44b1e4||0xc8;return function(_0x5aa48d){if(_0x5aa48d){return _0x286bb5['status'](_0x44b1e4)['json'](_0x5aa48d);}};}function respondWithFilteredResult(_0x40be18,_0x19ccc0){return function(_0x507efe){if(_0x507efe){var _0x154a21=typeof _0x19ccc0[_0x191f('0x22')]===_0x191f('0x23')&&typeof _0x19ccc0[_0x191f('0x24')]==='undefined';var _0x2e7d0c=_0x507efe[_0x191f('0x25')];var _0x25e950=_0x154a21?0x0:_0x19ccc0[_0x191f('0x22')];var _0x8cfce3=_0x154a21?_0x507efe['count']:_0x19ccc0['offset']+_0x19ccc0['limit'];var _0x191087;if(_0x8cfce3>=_0x2e7d0c){_0x8cfce3=_0x2e7d0c;_0x191087=0xc8;}else{_0x191087=0xce;}_0x40be18['status'](_0x191087);return _0x40be18[_0x191f('0x26')](_0x191f('0x27'),_0x25e950+'-'+_0x8cfce3+'/'+_0x2e7d0c)['json'](_0x507efe);}return null;};}function patchUpdates(_0x342be8){return function(_0x3e72d9){try{jsonpatch[_0x191f('0x28')](_0x3e72d9,_0x342be8,!![]);}catch(_0x463945){return BPromise['reject'](_0x463945);}return _0x3e72d9[_0x191f('0x29')]();};}function saveUpdates(_0x580934,_0x282437){return function(_0x3630b0){if(_0x3630b0){return _0x3630b0['update'](_0x580934)[_0x191f('0x2a')](function(_0x3ba1b3){return _0x3ba1b3;});}return null;};}function removeEntity(_0x29fbd0,_0x1318e0){return function(_0x5aa827){if(_0x5aa827){return _0x5aa827[_0x191f('0x2b')]()[_0x191f('0x2a')](function(){var _0x4b75be=_0x5aa827[_0x191f('0x2c')]({'plain':!![]});var _0x254f93='Plugins';return db['UserProfileResource'][_0x191f('0x2b')]({'where':{'type':_0x254f93,'resourceId':_0x4b75be['id']}})[_0x191f('0x2a')](function(){return _0x5aa827;});})[_0x191f('0x2a')](function(){_0x29fbd0[_0x191f('0x20')](0xcc)[_0x191f('0x21')]();});}};}function handleEntityNotFound(_0x2a64c5,_0x237f56){return function(_0x35415a){if(!_0x35415a){_0x2a64c5[_0x191f('0x1f')](0x194);}return _0x35415a;};}function handleError(_0x25fae8,_0x3057b0){_0x3057b0=_0x3057b0||0x1f4;return function(_0x7fe803){logger[_0x191f('0x2d')](_0x7fe803['stack']);if(_0x7fe803[_0x191f('0x2e')]){delete _0x7fe803['name'];}_0x25fae8[_0x191f('0x20')](_0x3057b0)[_0x191f('0x2f')](_0x7fe803);};}exports[_0x191f('0x30')]=function(_0x165d64,_0x19c193){var _0x6ffa10={},_0x1f4fdf={},_0x586f69={'count':0x0,'rows':[]};var _0x491d15=_[_0x191f('0x31')](db[_0x191f('0x32')][_0x191f('0x33')],function(_0x27b819){return{'name':_0x27b819['fieldName'],'type':_0x27b819[_0x191f('0x34')][_0x191f('0x35')]};});_0x1f4fdf['model']=_['map'](_0x491d15,_0x191f('0x2e'));_0x1f4fdf[_0x191f('0x36')]=_['keys'](_0x165d64[_0x191f('0x36')]);_0x1f4fdf[_0x191f('0x37')]=_[_0x191f('0x38')](_0x1f4fdf[_0x191f('0x39')],_0x1f4fdf['query']);_0x6ffa10['attributes']=_['intersection'](_0x1f4fdf['model'],qs[_0x191f('0x3a')](_0x165d64['query'][_0x191f('0x3a')]));_0x6ffa10[_0x191f('0x3b')]=_0x6ffa10[_0x191f('0x3b')][_0x191f('0x3c')]?_0x6ffa10['attributes']:_0x1f4fdf[_0x191f('0x39')];if(!_0x165d64[_0x191f('0x36')][_0x191f('0x3d')](_0x191f('0x3e'))){_0x6ffa10['limit']=qs[_0x191f('0x24')](_0x165d64['query'][_0x191f('0x24')]);_0x6ffa10['offset']=qs[_0x191f('0x22')](_0x165d64[_0x191f('0x36')][_0x191f('0x22')]);}_0x6ffa10['order']=qs[_0x191f('0x3f')](_0x165d64[_0x191f('0x36')]['sort']);_0x6ffa10[_0x191f('0x40')]=qs[_0x191f('0x37')](_[_0x191f('0x41')](_0x165d64['query'],_0x1f4fdf['filters']),_0x491d15);if(_0x165d64['query']['filter']){_0x6ffa10[_0x191f('0x40')]=_[_0x191f('0x42')](_0x6ffa10[_0x191f('0x40')],{'$or':_[_0x191f('0x31')](_0x491d15,function(_0x4df6ff){if(_0x4df6ff[_0x191f('0x34')]!=='VIRTUAL'){var _0x186993={};_0x186993[_0x4df6ff[_0x191f('0x2e')]]={'$like':'%'+_0x165d64[_0x191f('0x36')][_0x191f('0x43')]+'%'};return _0x186993;}})});}_0x6ffa10=_['merge']({},_0x6ffa10,_0x165d64['options']);var _0x5d6ead={'where':_0x6ffa10[_0x191f('0x40')]};return db[_0x191f('0x32')][_0x191f('0x25')](_0x5d6ead)[_0x191f('0x2a')](function(_0x2f14c6){_0x586f69[_0x191f('0x25')]=_0x2f14c6;if(_0x165d64[_0x191f('0x36')]['includeAll']){_0x6ffa10[_0x191f('0x44')]=[{'all':!![]}];}return db[_0x191f('0x32')][_0x191f('0x45')](_0x6ffa10);})['then'](function(_0x29563c){_0x586f69[_0x191f('0x46')]=_0x29563c;return _0x586f69;})[_0x191f('0x2a')](respondWithFilteredResult(_0x19c193,_0x6ffa10))['catch'](handleError(_0x19c193,null));};exports['show']=function(_0xa1f008,_0x3aa4d2){var _0x30cf37={'raw':!![],'where':{'id':_0xa1f008['params']['id']}},_0x3b63ef={};_0x3b63ef[_0x191f('0x39')]=_[_0x191f('0x47')](db[_0x191f('0x32')]['rawAttributes']);_0x3b63ef[_0x191f('0x36')]=_[_0x191f('0x47')](_0xa1f008[_0x191f('0x36')]);_0x3b63ef['filters']=_[_0x191f('0x38')](_0x3b63ef[_0x191f('0x39')],_0x3b63ef[_0x191f('0x36')]);_0x30cf37['attributes']=_['intersection'](_0x3b63ef[_0x191f('0x39')],qs[_0x191f('0x3a')](_0xa1f008['query'][_0x191f('0x3a')]));_0x30cf37[_0x191f('0x3b')]=_0x30cf37[_0x191f('0x3b')][_0x191f('0x3c')]?_0x30cf37[_0x191f('0x3b')]:_0x3b63ef[_0x191f('0x39')];if(_0xa1f008[_0x191f('0x36')]['includeAll']){_0x30cf37[_0x191f('0x44')]=[{'all':!![]}];}_0x30cf37=_['merge']({},_0x30cf37,_0xa1f008[_0x191f('0x48')]);return db[_0x191f('0x32')][_0x191f('0x49')](_0x30cf37)[_0x191f('0x2a')](handleEntityNotFound(_0x3aa4d2,null))['then'](respondWithResult(_0x3aa4d2,null))[_0x191f('0x4a')](handleError(_0x3aa4d2,null));};exports[_0x191f('0x4b')]=function(_0x4ed5c6,_0x1ae52a,_0x206aee){return db['Plugin']['find']({'where':{'id':_0x4ed5c6[_0x191f('0x4c')]['id']},'attributes':[_0x191f('0x2e'),_0x191f('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x1ae52a,null))[_0x191f('0x2a')](function(_0x8f3e61){if(_0x8f3e61){var _0x58e000=path['join'](config['root'],'server/files/plugins',util[_0x191f('0x4d')](_0x191f('0x4e'),path['basename'](_0x8f3e61[_0x191f('0x7')])));var _0x352ee0=fs['createWriteStream'](_0x58e000);var _0x1630e6=archiver(_0x191f('0x4f'),{'zlib':{'level':0x9}});_0x1630e6['on'](_0x191f('0x50'),function(_0x4271d0){if(_0x4271d0[_0x191f('0x51')]==='ENOENT'){logger[_0x191f('0x2d')](_0x4271d0);}else{throw new db[(_0x191f('0x52'))]['Error'](_0x191f('0x53'));}});_0x1630e6['on']('error',function(_0x1b8823){throw new db[(_0x191f('0x52'))][(_0x191f('0x54'))](_0x191f('0x53'));});_0x1630e6[_0x191f('0x55')](_0x352ee0);_0x1630e6[_0x191f('0x56')](_0x191f('0x57'),{'cwd':path[_0x191f('0x58')](config[_0x191f('0x59')],_0x191f('0x5a'),path[_0x191f('0x5b')](_0x8f3e61[_0x191f('0x7')])),'ignore':[path['join'](path[_0x191f('0x5c')](_0x8f3e61['path']),'node_modules/**/*'),path['join'](path[_0x191f('0x5c')](_0x8f3e61[_0x191f('0x7')]),_0x191f('0x5d'))],'nodir':!![]})[_0x191f('0x5e')]();_0x352ee0['on'](_0x191f('0x5f'),function(){if(!fs[_0x191f('0x60')](_0x58e000)){throw new db[(_0x191f('0x52'))][(_0x191f('0x54'))](_0x191f('0x61'));}return _0x1ae52a['download'](_0x58e000,util[_0x191f('0x4d')](_0x191f('0x4e'),path[_0x191f('0x5c')](_0x8f3e61['path'])),function(_0x184126){if(_0x184126){throw new db[(_0x191f('0x52'))][(_0x191f('0x54'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x191f('0x62')](_0x58e000);logger['info'](_0x191f('0x63'));logger[_0x191f('0x64')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x1ae52a,null));};exports[_0x191f('0x65')]=function(_0x5a4f24,_0x2246be,_0x462870){var _0x38bed2=path[_0x191f('0x5c')](_0x5a4f24[_0x191f('0x66')][_0x191f('0x67')],path['extname'](_0x5a4f24[_0x191f('0x66')][_0x191f('0x67')]));var _0xc394aa=path[_0x191f('0x58')](config['root'],_0x191f('0x5a'),_0x5a4f24['file'][_0x191f('0x67')]);var _0x51a8e4=path[_0x191f('0x58')](config['root'],'server/files/plugins',_0x38bed2);logger[_0x191f('0x64')](_0x191f('0x68'),_0xc394aa);logger['info'](_0x191f('0x69'),_0x51a8e4);try{fs['chmodSync'](_0xc394aa,parseInt(_0x191f('0x6a'),0x8));extract(_0xc394aa,{'dir':_0x51a8e4},function(_0x4d4346){if(_0x4d4346){logger[_0x191f('0x2d')](_0x4d4346);handleError(_0x4d4346,!![]);};var _0x23a172=fs['readdirSync'](_0x51a8e4);if(_0x23a172[_0x191f('0x3c')]>0x1){removeReferences(_0xc394aa,_0x51a8e4);logger[_0x191f('0x2d')](_0x191f('0x6b'));return _0x462870(new Error(_0x191f('0x6b')));}var _0x51e04a=fs[_0x191f('0x6c')](path[_0x191f('0x58')](_0x51a8e4,_0x23a172[0x0]));if(_0x51e04a[_0x191f('0x6d')]()){removeReferences(_0xc394aa,_0x51a8e4);logger[_0x191f('0x2d')]('Invalid\x20plugin\x20structure');return _0x462870(new Error(_0x191f('0x6b')));}if(_0x51e04a['isDirectory']()){var _0x2d8d45=fs[_0x191f('0x6e')](path[_0x191f('0x58')](_0x51a8e4,_0x23a172[0x0]));if(_0x2d8d45[_0x191f('0x3c')]===0x0){removeReferences(_0xc394aa,_0x51a8e4);logger[_0x191f('0x2d')]('Invalid\x20plugin\x20structure');return _0x462870(new Error('Invalid\x20plugin\x20structure'));}var _0x34d59a=_0x2d8d45[_0x191f('0x6f')](function(_0x4af2ba){return _0x4af2ba===_0x191f('0x70');});if(!_0x34d59a){return _0x462870(new Error(_0x191f('0x71')));}var _0xd65abe=fs['readFileSync'](path[_0x191f('0x58')](_0x51a8e4,_0x23a172[0x0],_0x191f('0x70')));var _0x261e3a=JSON[_0x191f('0x72')](_0xd65abe);if(_0x191f('0x23')==typeof _0x261e3a[_0x191f('0x2e')]){return _0x462870(new Error(_0x191f('0x73')));}if(_0x191f('0x23')==typeof _0x261e3a[_0x191f('0x34')]){return _0x462870(new Error(_0x191f('0x74')));}if(_0x191f('0x23')==typeof _0x261e3a[_0x191f('0x75')]){return _0x462870(new Error(_0x191f('0x76')));}if(_0x191f('0x23')==typeof _0x261e3a[_0x191f('0x77')]){return _0x462870(new Error(_0x191f('0x78')));}if(_0x261e3a[_0x191f('0x34')]===_0x191f('0x79')){if(_0x191f('0x23')==typeof _0x261e3a[_0x191f('0x77')]['views']){return _0x462870(new Error(_0x191f('0x7a')));}if(_0x191f('0x23')==typeof _0x261e3a[_0x191f('0x77')][_0x191f('0x7b')][_0x191f('0x7c')]&&_0x191f('0x23')==typeof _0x261e3a[_0x191f('0x77')][_0x191f('0x7b')]['agent']){return _0x462870(new Error(_0x191f('0x7d')));}}else if(_0x261e3a[_0x191f('0x34')]===_0x191f('0x7e')){if(_0x191f('0x23')==typeof _0x261e3a['parameters']['scriptName']){return _0x462870(new Error(_0x191f('0x7f')));}if(_0x191f('0x23')==typeof _0x261e3a[_0x191f('0x77')]['scriptPath']){return _0x462870(new Error(_0x191f('0x80')));}}else{return _0x462870(new Error(_0x191f('0x81')));}var _0x4194e1=_0x261e3a[_0x191f('0x2e')];var _0x4ea8c5=_0x261e3a[_0x191f('0x82')];var _0x364165=_0x261e3a[_0x191f('0x34')];var _0x39856a=_0x261e3a[_0x191f('0x83')]?_0x261e3a[_0x191f('0x83')]:_0x191f('0x84');var _0x202966=_0x261e3a[_0x191f('0x85')]?_0x261e3a[_0x191f('0x85')]:_0x191f('0x86');var _0x3099ac='';var _0x49aad8='';var _0x4fd5fe='';var _0x912eba='';var _0xec8706=_0x261e3a['version'];if(_0x364165===_0x191f('0x79')){if(_0x191f('0x23')!=typeof _0x261e3a[_0x191f('0x77')]['views'][_0x191f('0x7c')]){var _0x122fbc=_0x261e3a[_0x191f('0x77')][_0x191f('0x7b')][_0x191f('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x191f('0x87')](_0x122fbc)){_0x3099ac=path[_0x191f('0x58')](_0x191f('0x88'),_0x38bed2,_0x23a172[0x0],_0x122fbc);}else{_0x3099ac=_0x122fbc;}}else{logger[_0x191f('0x64')](_0x191f('0x89'));}if(_0x191f('0x23')!=typeof _0x261e3a['parameters'][_0x191f('0x7b')][_0x191f('0x8a')]){var _0x3ffa44=_0x261e3a[_0x191f('0x77')][_0x191f('0x7b')][_0x191f('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0x191f('0x87')](_0x3ffa44)){_0x49aad8=path[_0x191f('0x58')](_0x191f('0x88'),_0x38bed2,_0x23a172[0x0],_0x3ffa44);}else{_0x49aad8=_0x3ffa44;}}else{logger[_0x191f('0x64')](_0x191f('0x8b'));}}else if(_0x364165===_0x191f('0x7e')){_0x4fd5fe=_0x261e3a[_0x191f('0x77')]['scriptName'];_0x912eba=_0x261e3a[_0x191f('0x77')][_0x191f('0x8c')];if('undefined'!=typeof _0x261e3a[_0x191f('0x77')][_0x191f('0x7b')]){if(_0x191f('0x23')!=typeof _0x261e3a['parameters'][_0x191f('0x7b')][_0x191f('0x7c')]){var _0x122fbc=_0x261e3a['parameters'][_0x191f('0x7b')][_0x191f('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0x191f('0x87')](_0x122fbc)){_0x3099ac=path[_0x191f('0x58')](_0x191f('0x88'),_0x38bed2,_0x23a172[0x0],_0x122fbc);}else{_0x3099ac=_0x122fbc;}}if('undefined'!=typeof _0x261e3a[_0x191f('0x77')]['views']['agent']){var _0x3ffa44=_0x261e3a[_0x191f('0x77')][_0x191f('0x7b')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x3ffa44)){_0x49aad8=path[_0x191f('0x58')](_0x191f('0x88'),_0x38bed2,_0x23a172[0x0],_0x3ffa44);}else{_0x49aad8=_0x3ffa44;}}}}var _0x188bb0={'name':_0x4194e1,'description':_0x4ea8c5,'path':path[_0x191f('0x58')](_0x38bed2,_0x23a172[0x0]),'type':_0x364165,'sidebar':_0x39856a,'icon':_0x202966,'adminUrl':_0x3099ac,'agentUrl':_0x49aad8,'scriptName':_0x4fd5fe,'scriptPath':_0x912eba,'version':_0xec8706};removeReferences(_0xc394aa,null);return db[_0x191f('0x32')][_0x191f('0x8d')](_0x188bb0)[_0x191f('0x2a')](function(_0xf79326){var _0x4eb7ee={'role':_0x5a4f24[_0x191f('0x8e')][_0x191f('0x8f')],'userProfileId':_0x5a4f24[_0x191f('0x8e')][_0x191f('0x90')]};if(!_0x4eb7ee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4eb7ee[_0x191f('0x8f')]===_0x191f('0x91')){var _0x16434f=_0xf79326[_0x191f('0x2c')]({'plain':!![]});return db['UserProfileSection'][_0x191f('0x49')]({'where':{'name':_0x191f('0x92'),'userProfileId':_0x4eb7ee['userProfileId']},'raw':!![]})[_0x191f('0x2a')](function(_0xd60190){if(_0xd60190&&_0xd60190[_0x191f('0x93')]===0x0){return db[_0x191f('0x94')]['create']({'name':_0x16434f[_0x191f('0x2e')],'resourceId':_0x16434f['id'],'type':_0xd60190[_0x191f('0x2e')],'sectionId':_0xd60190['id']},{})[_0x191f('0x2a')](function(){return _0xf79326;});}else{return _0xf79326;}})['catch'](function(_0x38ae25){logger[_0x191f('0x2d')](_0x191f('0x95'),_0x38ae25);throw _0x38ae25;});}return _0xf79326;})[_0x191f('0x2a')](respondWithResult(_0x2246be,null))[_0x191f('0x4a')](handleError(_0x2246be,null));}});}catch(_0x309b40){_0x2246be[_0x191f('0x20')](0x1f4)[_0x191f('0x2f')](_0x309b40);}};function removeReferences(_0x36f15f,_0xa8fb05){try{if(_0x36f15f){fs['unlinkSync'](_0x36f15f);logger[_0x191f('0x64')](_0x191f('0x96'));}if(_0xa8fb05){rimraf(_0xa8fb05,function(){});logger[_0x191f('0x64')](_0x191f('0x97'));}}catch(_0x16621b){logger[_0x191f('0x2d')](_0x16621b);}}exports[_0x191f('0x98')]=function(_0x150e60,_0x323779,_0x1ab340){return db[_0x191f('0x32')][_0x191f('0x49')]({'where':{'id':_0x150e60[_0x191f('0x4c')]['id']}})[_0x191f('0x2a')](handleEntityNotFound(_0x323779,null))[_0x191f('0x2a')](saveUpdates(_0x150e60[_0x191f('0x8e')],null))[_0x191f('0x2a')](respondWithResult(_0x323779,null))[_0x191f('0x4a')](handleError(_0x323779,null));};exports[_0x191f('0x99')]=function(_0xb4b255,_0x165f7a,_0x164404){return db[_0x191f('0x32')][_0x191f('0x49')]({'where':{'id':_0xb4b255['params']['id']}})[_0x191f('0x2a')](function(_0x496824){if(_0x496824){return _0x496824[_0x191f('0x2b')]();}})[_0x191f('0x2a')](function(_0xfee3e8){rimraf(path[_0x191f('0x58')](config[_0x191f('0x59')],'server/files/plugins',path[_0x191f('0x5b')](_0xfee3e8[_0x191f('0x7')])),function(){});return _0xfee3e8;})[_0x191f('0x2a')](handleEntityNotFound(_0x165f7a,null))[_0x191f('0x2a')](respondWithStatusCode(_0x165f7a,null))['catch'](handleError(_0x165f7a,null));};exports[_0x191f('0x9a')]=function(_0x53a247,_0x2aa9b5,_0x1ba2fe){return BPromise[_0x191f('0x9b')]()['then'](function(){if(!_0x53a247[_0x191f('0x36')][_0x191f('0x7')]){throw new Error(_0x191f('0x9c'));}if(!_0x53a247['query']['port']){throw new Error(_0x191f('0x9d'));}var _0x4470f8=_0x53a247[_0x191f('0x36')][_0x191f('0x9e')]?_0x53a247['query'][_0x191f('0x9e')]+':'+_0x53a247[_0x191f('0x36')][_0x191f('0x9f')]:_0x191f('0xa0')+_0x53a247[_0x191f('0x36')][_0x191f('0x9f')];var _0x2cff85=_0x53a247['query']['json']?_0x53a247[_0x191f('0x36')][_0x191f('0xa1')]:!![];var _0x523478=_0x53a247['query'][_0x191f('0xa2')]?_0x53a247[_0x191f('0x36')][_0x191f('0xa2')]:null;var _0x269e9f={'method':_0x53a247[_0x191f('0xa3')],'uri':util[_0x191f('0x4d')](_0x191f('0xa4'),_0x4470f8,_0x53a247[_0x191f('0x36')]['path']),'json':_0x2cff85,'resolveWithFullResponse':!![],'encoding':_0x523478,'qs':_0x53a247[_0x191f('0x36')]};if(_0x53a247['headers']){_0x269e9f[_0x191f('0xa5')]=_0x53a247[_0x191f('0xa5')];if(_0x269e9f[_0x191f('0xa5')][_0x191f('0xa6')]){delete _0x269e9f[_0x191f('0xa5')][_0x191f('0xa6')];}}if(_0x269e9f[_0x191f('0xa5')][_0x191f('0xa7')]){delete _0x269e9f['headers'][_0x191f('0xa7')];}return rp(_0x269e9f);})[_0x191f('0x2a')](function(_0x4d1b0c){if(_0x4d1b0c){_0x2aa9b5[_0x191f('0x26')](_0x4d1b0c[_0x191f('0xa5')]);logger['info'](_0x4d1b0c[_0x191f('0x8e')]);if(_[_0x191f('0xa8')](_0x53a247[_0x191f('0x36')]['path'],_0x191f('0x4b'))&&_0x4d1b0c[_0x191f('0xa9')]==0x1f4){return _0x2aa9b5[_0x191f('0x1f')](_0x4d1b0c[_0x191f('0xa9')]);}else{return _0x2aa9b5['status'](_0x4d1b0c['statusCode'])['send'](_0x4d1b0c[_0x191f('0x8e')]);}}else{return _0x2aa9b5[_0x191f('0x1f')](0xc8);}})[_0x191f('0x4a')](handleError(_0x2aa9b5,null));};exports[_0x191f('0xaa')]=function(_0x3fca30,_0x5e7a36,_0x4438c7){return BPromise[_0x191f('0x9b')]()[_0x191f('0x2a')](function(){if(!_0x3fca30[_0x191f('0x36')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3fca30[_0x191f('0x36')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xf0eeba=_0x3fca30[_0x191f('0x36')][_0x191f('0x9e')]?_0x3fca30['query'][_0x191f('0x9e')]+':'+_0x3fca30[_0x191f('0x36')]['port']:'http://localhost:'+_0x3fca30[_0x191f('0x36')]['port'];var _0x260d87=_0x3fca30[_0x191f('0x36')]['json']?_0x3fca30[_0x191f('0x36')][_0x191f('0xa1')]:!![];var _0x281edf=_0x3fca30[_0x191f('0x36')][_0x191f('0xa2')]?_0x3fca30[_0x191f('0x36')][_0x191f('0xa2')]:null;var _0x130f9b={'method':_0x3fca30['method'],'uri':util[_0x191f('0x4d')](_0x191f('0xa4'),_0xf0eeba,_0x3fca30[_0x191f('0x36')][_0x191f('0x7')]),'json':_0x260d87,'resolveWithFullResponse':!![],'encoding':_0x281edf,'body':_0x3fca30[_0x191f('0x8e')]};if(_0x3fca30[_0x191f('0xa5')]){_0x130f9b[_0x191f('0xa5')]=_0x3fca30[_0x191f('0xa5')];if(_0x130f9b[_0x191f('0xa5')][_0x191f('0xa6')]){delete _0x130f9b[_0x191f('0xa5')][_0x191f('0xa6')];}}if(_0x130f9b['headers']['content-type']){delete _0x130f9b[_0x191f('0xa5')][_0x191f('0xa7')];}return rp(_0x130f9b);})['then'](function(_0x2651dd){if(_0x2651dd){_0x5e7a36[_0x191f('0x26')](_0x2651dd[_0x191f('0xa5')]);logger['info'](_0x2651dd[_0x191f('0x8e')]);return _0x5e7a36[_0x191f('0x20')](_0x2651dd[_0x191f('0xa9')])[_0x191f('0x2f')](_0x2651dd[_0x191f('0x8e')]);}else{return _0x5e7a36[_0x191f('0x1f')](0xc8);}})[_0x191f('0x4a')](handleError(_0x5e7a36,null));}; \ No newline at end of file +var _0x7000=['desk.js','querystring','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','type','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','download','find','path','root','server/files/plugins','format','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','join','basename','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','info','Temporary\x20file\x20removed','upload','file','filename','extname','0777','readdirSync','Invalid\x20plugin\x20structure','isDirectory','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','method','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x152aa9,_0x4cd512){var _0x39ff72=function(_0x2a604a){while(--_0x2a604a){_0x152aa9['push'](_0x152aa9['shift']());}};_0x39ff72(++_0x4cd512);}(_0x7000,0xa0));var _0x0700=function(_0x5b734b,_0x486a7f){_0x5b734b=_0x5b734b-0x0;var _0x2a15a3=_0x7000[_0x5b734b];return _0x2a15a3;};'use strict';var emlformat=require(_0x0700('0x0'));var rimraf=require(_0x0700('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0700('0x2'));var rp=require(_0x0700('0x3'));var moment=require(_0x0700('0x4'));var BPromise=require(_0x0700('0x5'));var Mustache=require(_0x0700('0x6'));var util=require(_0x0700('0x7'));var path=require('path');var sox=require(_0x0700('0x8'));var csv=require(_0x0700('0x9'));var ejs=require(_0x0700('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0700('0xb'));var squel=require(_0x0700('0xc'));var crypto=require(_0x0700('0xd'));var jsforce=require(_0x0700('0xe'));var deskjs=require(_0x0700('0xf'));var toCsv=require(_0x0700('0x9'));var querystring=require(_0x0700('0x10'));var Papa=require(_0x0700('0x11'));var extract=require(_0x0700('0x12'));var rimraf=require(_0x0700('0x1'));var archiver=require(_0x0700('0x13'));var Redis=require('ioredis');var authService=require(_0x0700('0x14'));var qs=require(_0x0700('0x15'));var as=require(_0x0700('0x16'));var hardwareService=require(_0x0700('0x17'));var logger=require(_0x0700('0x18'))(_0x0700('0x19'));var utils=require(_0x0700('0x1a'));var config=require(_0x0700('0x1b'));var licenseUtil=require(_0x0700('0x1c'));var db=require(_0x0700('0x1d'))['db'];config[_0x0700('0x1e')]=_[_0x0700('0x1f')](config[_0x0700('0x1e')],{'host':_0x0700('0x20'),'port':0x18eb});var socket=require(_0x0700('0x21'))(new Redis(config[_0x0700('0x1e')]));require(_0x0700('0x22'))[_0x0700('0x23')](socket);function respondWithStatusCode(_0x2f4b91,_0x4186a0){_0x4186a0=_0x4186a0||0xcc;return function(_0x39b9c3){if(_0x39b9c3){return _0x2f4b91[_0x0700('0x24')](_0x4186a0);}return _0x2f4b91[_0x0700('0x25')](_0x4186a0)[_0x0700('0x26')]();};}function respondWithResult(_0x288b04,_0x187126){_0x187126=_0x187126||0xc8;return function(_0xbb478a){if(_0xbb478a){return _0x288b04['status'](_0x187126)[_0x0700('0x27')](_0xbb478a);}};}function respondWithFilteredResult(_0x80b4df,_0x2c61a7){return function(_0x32ef83){if(_0x32ef83){var _0x3eddf9=typeof _0x2c61a7[_0x0700('0x28')]===_0x0700('0x29')&&typeof _0x2c61a7['limit']===_0x0700('0x29');var _0x372adb=_0x32ef83['count'];var _0x334921=_0x3eddf9?0x0:_0x2c61a7[_0x0700('0x28')];var _0x1a5733=_0x3eddf9?_0x32ef83['count']:_0x2c61a7[_0x0700('0x28')]+_0x2c61a7[_0x0700('0x2a')];var _0x5a9078;if(_0x1a5733>=_0x372adb){_0x1a5733=_0x372adb;_0x5a9078=0xc8;}else{_0x5a9078=0xce;}_0x80b4df[_0x0700('0x25')](_0x5a9078);return _0x80b4df[_0x0700('0x2b')](_0x0700('0x2c'),_0x334921+'-'+_0x1a5733+'/'+_0x372adb)[_0x0700('0x27')](_0x32ef83);}return null;};}function patchUpdates(_0x49ed2f){return function(_0x2d8968){try{jsonpatch['apply'](_0x2d8968,_0x49ed2f,!![]);}catch(_0x591fe7){return BPromise[_0x0700('0x2d')](_0x591fe7);}return _0x2d8968['save']();};}function saveUpdates(_0x5b2625,_0x54895a){return function(_0xe0a2d3){if(_0xe0a2d3){return _0xe0a2d3[_0x0700('0x2e')](_0x5b2625)[_0x0700('0x2f')](function(_0x2514b5){return _0x2514b5;});}return null;};}function removeEntity(_0x591387,_0xc28300){return function(_0x50bad6){if(_0x50bad6){return _0x50bad6[_0x0700('0x30')]()['then'](function(){var _0x2f6d2a=_0x50bad6[_0x0700('0x31')]({'plain':!![]});var _0x3d5996=_0x0700('0x32');return db[_0x0700('0x33')]['destroy']({'where':{'type':_0x3d5996,'resourceId':_0x2f6d2a['id']}})[_0x0700('0x2f')](function(){return _0x50bad6;});})['then'](function(){_0x591387[_0x0700('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f2a3,_0x1a5682){return function(_0x5a73c8){if(!_0x5a73c8){_0x22f2a3[_0x0700('0x24')](0x194);}return _0x5a73c8;};}function handleError(_0x3ad1f0,_0x5c547b){_0x5c547b=_0x5c547b||0x1f4;return function(_0x20a905){logger[_0x0700('0x34')](_0x20a905[_0x0700('0x35')]);if(_0x20a905[_0x0700('0x36')]){delete _0x20a905[_0x0700('0x36')];}_0x3ad1f0[_0x0700('0x25')](_0x5c547b)[_0x0700('0x37')](_0x20a905);};}exports[_0x0700('0x38')]=function(_0xe5cb53,_0x7d37e7){var _0x55f418={},_0x5c76bb={},_0x7bd86d={'count':0x0,'rows':[]};var _0x54a5a3=_[_0x0700('0x39')](db[_0x0700('0x3a')]['rawAttributes'],function(_0x4dff9c){return{'name':_0x4dff9c[_0x0700('0x3b')],'type':_0x4dff9c['type'][_0x0700('0x3c')]};});_0x5c76bb[_0x0700('0x3d')]=_[_0x0700('0x39')](_0x54a5a3,_0x0700('0x36'));_0x5c76bb[_0x0700('0x3e')]=_[_0x0700('0x3f')](_0xe5cb53[_0x0700('0x3e')]);_0x5c76bb[_0x0700('0x40')]=_['intersection'](_0x5c76bb[_0x0700('0x3d')],_0x5c76bb['query']);_0x55f418['attributes']=_[_0x0700('0x41')](_0x5c76bb[_0x0700('0x3d')],qs[_0x0700('0x42')](_0xe5cb53['query'][_0x0700('0x42')]));_0x55f418[_0x0700('0x43')]=_0x55f418[_0x0700('0x43')][_0x0700('0x44')]?_0x55f418[_0x0700('0x43')]:_0x5c76bb['model'];if(!_0xe5cb53[_0x0700('0x3e')][_0x0700('0x45')](_0x0700('0x46'))){_0x55f418[_0x0700('0x2a')]=qs[_0x0700('0x2a')](_0xe5cb53[_0x0700('0x3e')][_0x0700('0x2a')]);_0x55f418[_0x0700('0x28')]=qs[_0x0700('0x28')](_0xe5cb53['query']['offset']);}_0x55f418[_0x0700('0x47')]=qs[_0x0700('0x48')](_0xe5cb53[_0x0700('0x3e')]['sort']);_0x55f418['where']=qs[_0x0700('0x40')](_['pick'](_0xe5cb53[_0x0700('0x3e')],_0x5c76bb[_0x0700('0x40')]),_0x54a5a3);if(_0xe5cb53[_0x0700('0x3e')][_0x0700('0x49')]){_0x55f418[_0x0700('0x4a')]=_['merge'](_0x55f418['where'],{'$or':_['map'](_0x54a5a3,function(_0x32ebdb){if(_0x32ebdb[_0x0700('0x4b')]!=='VIRTUAL'){var _0x52356f={};_0x52356f[_0x32ebdb['name']]={'$like':'%'+_0xe5cb53[_0x0700('0x3e')][_0x0700('0x49')]+'%'};return _0x52356f;}})});}_0x55f418=_[_0x0700('0x4c')]({},_0x55f418,_0xe5cb53[_0x0700('0x4d')]);var _0x18caf2={'where':_0x55f418[_0x0700('0x4a')]};return db['Plugin'][_0x0700('0x4e')](_0x18caf2)['then'](function(_0x10082b){_0x7bd86d[_0x0700('0x4e')]=_0x10082b;if(_0xe5cb53[_0x0700('0x3e')][_0x0700('0x4f')]){_0x55f418[_0x0700('0x50')]=[{'all':!![]}];}return db[_0x0700('0x3a')][_0x0700('0x51')](_0x55f418);})[_0x0700('0x2f')](function(_0x579622){_0x7bd86d[_0x0700('0x52')]=_0x579622;return _0x7bd86d;})[_0x0700('0x2f')](respondWithFilteredResult(_0x7d37e7,_0x55f418))[_0x0700('0x53')](handleError(_0x7d37e7,null));};exports[_0x0700('0x54')]=function(_0x279c50,_0x357581){var _0x1d4402={'raw':!![],'where':{'id':_0x279c50[_0x0700('0x55')]['id']}},_0x2eeb08={};_0x2eeb08[_0x0700('0x3d')]=_[_0x0700('0x3f')](db[_0x0700('0x3a')][_0x0700('0x56')]);_0x2eeb08[_0x0700('0x3e')]=_[_0x0700('0x3f')](_0x279c50[_0x0700('0x3e')]);_0x2eeb08[_0x0700('0x40')]=_['intersection'](_0x2eeb08[_0x0700('0x3d')],_0x2eeb08[_0x0700('0x3e')]);_0x1d4402[_0x0700('0x43')]=_[_0x0700('0x41')](_0x2eeb08[_0x0700('0x3d')],qs[_0x0700('0x42')](_0x279c50[_0x0700('0x3e')]['fields']));_0x1d4402['attributes']=_0x1d4402[_0x0700('0x43')][_0x0700('0x44')]?_0x1d4402['attributes']:_0x2eeb08[_0x0700('0x3d')];if(_0x279c50[_0x0700('0x3e')][_0x0700('0x4f')]){_0x1d4402[_0x0700('0x50')]=[{'all':!![]}];}_0x1d4402=_['merge']({},_0x1d4402,_0x279c50[_0x0700('0x4d')]);return db[_0x0700('0x3a')]['find'](_0x1d4402)[_0x0700('0x2f')](handleEntityNotFound(_0x357581,null))[_0x0700('0x2f')](respondWithResult(_0x357581,null))[_0x0700('0x53')](handleError(_0x357581,null));};exports[_0x0700('0x57')]=function(_0x23bd4e,_0x2c86bf,_0x147e91){return db[_0x0700('0x3a')][_0x0700('0x58')]({'where':{'id':_0x23bd4e[_0x0700('0x55')]['id']},'attributes':[_0x0700('0x36'),_0x0700('0x59')],'raw':!![]})[_0x0700('0x2f')](handleEntityNotFound(_0x2c86bf,null))[_0x0700('0x2f')](function(_0x480aaf){if(_0x480aaf){var _0x270877=path['join'](config[_0x0700('0x5a')],_0x0700('0x5b'),util[_0x0700('0x5c')]('%s.zip',path['basename'](_0x480aaf[_0x0700('0x59')])));var _0x156155=fs[_0x0700('0x5d')](_0x270877);var _0x198cee=archiver(_0x0700('0x5e'),{'zlib':{'level':0x9}});_0x198cee['on'](_0x0700('0x5f'),function(_0x3e4ec4){if(_0x3e4ec4[_0x0700('0x60')]===_0x0700('0x61')){logger[_0x0700('0x34')](_0x3e4ec4);}else{throw new db[(_0x0700('0x62'))][(_0x0700('0x63'))](_0x0700('0x64'));}});_0x198cee['on'](_0x0700('0x34'),function(_0x481532){throw new db['Sequelize'][(_0x0700('0x63'))](_0x0700('0x64'));});_0x198cee[_0x0700('0x65')](_0x156155);_0x198cee['glob'](_0x0700('0x66'),{'cwd':path['join'](config[_0x0700('0x5a')],'server/files/plugins',path[_0x0700('0x67')](_0x480aaf[_0x0700('0x59')])),'ignore':[path[_0x0700('0x68')](path[_0x0700('0x69')](_0x480aaf[_0x0700('0x59')]),_0x0700('0x6a')),path[_0x0700('0x68')](path[_0x0700('0x69')](_0x480aaf[_0x0700('0x59')]),_0x0700('0x6b'))],'nodir':!![]})['finalize']();_0x156155['on'](_0x0700('0x6c'),function(){if(!fs[_0x0700('0x6d')](_0x270877)){throw new db[(_0x0700('0x62'))][(_0x0700('0x63'))](_0x0700('0x6e'));}return _0x2c86bf[_0x0700('0x57')](_0x270877,util[_0x0700('0x5c')]('%s.zip',path[_0x0700('0x69')](_0x480aaf[_0x0700('0x59')])),function(_0x2ca681){if(_0x2ca681){throw new db[(_0x0700('0x62'))][(_0x0700('0x63'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x270877);logger[_0x0700('0x6f')]('Download\x20completed');logger['info'](_0x0700('0x70'));});});}return null;})[_0x0700('0x53')](handleError(_0x2c86bf,null));};exports[_0x0700('0x71')]=function(_0x226125,_0x23a864,_0x16a8b0){var _0x291eac=path[_0x0700('0x69')](_0x226125[_0x0700('0x72')][_0x0700('0x73')],path[_0x0700('0x74')](_0x226125[_0x0700('0x72')][_0x0700('0x73')]));var _0x2cd048=path[_0x0700('0x68')](config[_0x0700('0x5a')],'server/files/plugins',_0x226125[_0x0700('0x72')]['filename']);var _0xa5929b=path[_0x0700('0x68')](config['root'],_0x0700('0x5b'),_0x291eac);logger[_0x0700('0x6f')]('Plugin\x20upload\x20filepath:\x20%s',_0x2cd048);logger[_0x0700('0x6f')]('Plugin\x20upload\x20destination:\x20%s',_0xa5929b);try{fs['chmodSync'](_0x2cd048,parseInt(_0x0700('0x75'),0x8));extract(_0x2cd048,{'dir':_0xa5929b},function(_0x1c4b08){if(_0x1c4b08){logger[_0x0700('0x34')](_0x1c4b08);handleError(_0x1c4b08,!![]);};var _0x1494ae=fs[_0x0700('0x76')](_0xa5929b);if(_0x1494ae[_0x0700('0x44')]>0x1){removeReferences(_0x2cd048,_0xa5929b);logger['error'](_0x0700('0x77'));return _0x16a8b0(new Error(_0x0700('0x77')));}var _0x35440d=fs['lstatSync'](path[_0x0700('0x68')](_0xa5929b,_0x1494ae[0x0]));if(_0x35440d['isFile']()){removeReferences(_0x2cd048,_0xa5929b);logger[_0x0700('0x34')]('Invalid\x20plugin\x20structure');return _0x16a8b0(new Error('Invalid\x20plugin\x20structure'));}if(_0x35440d[_0x0700('0x78')]()){var _0x3fe8d5=fs[_0x0700('0x76')](path['join'](_0xa5929b,_0x1494ae[0x0]));if(_0x3fe8d5['length']===0x0){removeReferences(_0x2cd048,_0xa5929b);logger['error']('Invalid\x20plugin\x20structure');return _0x16a8b0(new Error('Invalid\x20plugin\x20structure'));}var _0x132523=_0x3fe8d5['some'](function(_0x1a9e1f){return _0x1a9e1f==='manifest.json';});if(!_0x132523){return _0x16a8b0(new Error(_0x0700('0x79')));}var _0x21aa12=fs[_0x0700('0x7a')](path[_0x0700('0x68')](_0xa5929b,_0x1494ae[0x0],_0x0700('0x7b')));var _0x49dd7f=JSON[_0x0700('0x7c')](_0x21aa12);if(_0x0700('0x29')==typeof _0x49dd7f[_0x0700('0x36')]){return _0x16a8b0(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x0700('0x29')==typeof _0x49dd7f[_0x0700('0x4b')]){return _0x16a8b0(new Error(_0x0700('0x7d')));}if(_0x0700('0x29')==typeof _0x49dd7f[_0x0700('0x7e')]){return _0x16a8b0(new Error(_0x0700('0x7f')));}if('undefined'==typeof _0x49dd7f[_0x0700('0x80')]){return _0x16a8b0(new Error(_0x0700('0x81')));}if(_0x49dd7f['type']===_0x0700('0x82')){if('undefined'==typeof _0x49dd7f[_0x0700('0x80')][_0x0700('0x83')]){return _0x16a8b0(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x49dd7f[_0x0700('0x80')][_0x0700('0x83')]['admin']&&_0x0700('0x29')==typeof _0x49dd7f[_0x0700('0x80')][_0x0700('0x83')][_0x0700('0x84')]){return _0x16a8b0(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x49dd7f[_0x0700('0x4b')]===_0x0700('0x85')){if('undefined'==typeof _0x49dd7f['parameters'][_0x0700('0x86')]){return _0x16a8b0(new Error(_0x0700('0x87')));}if(_0x0700('0x29')==typeof _0x49dd7f[_0x0700('0x80')][_0x0700('0x88')]){return _0x16a8b0(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x16a8b0(new Error(_0x0700('0x89')));}var _0x3c62ab=_0x49dd7f[_0x0700('0x36')];var _0x39238d=_0x49dd7f[_0x0700('0x8a')];var _0xfe5c0d=_0x49dd7f[_0x0700('0x4b')];var _0x4e20af=_0x49dd7f[_0x0700('0x8b')]?_0x49dd7f[_0x0700('0x8b')]:_0x0700('0x8c');var _0x261065=_0x49dd7f['icon']?_0x49dd7f[_0x0700('0x8d')]:_0x0700('0x8e');var _0x2650a1='';var _0x5b9925='';var _0x1db249='';var _0x2a41cd='';var _0x3a0352=_0x49dd7f[_0x0700('0x7e')];if(_0xfe5c0d===_0x0700('0x82')){if(_0x0700('0x29')!=typeof _0x49dd7f[_0x0700('0x80')]['views'][_0x0700('0x8f')]){var _0x1c5527=_0x49dd7f['parameters'][_0x0700('0x83')][_0x0700('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x0700('0x90')](_0x1c5527)){_0x2650a1=path[_0x0700('0x68')](_0x0700('0x91'),_0x291eac,_0x1494ae[0x0],_0x1c5527);}else{_0x2650a1=_0x1c5527;}}else{logger[_0x0700('0x6f')](_0x0700('0x92'));}if(_0x0700('0x29')!=typeof _0x49dd7f['parameters']['views']['agent']){var _0x36d07d=_0x49dd7f[_0x0700('0x80')][_0x0700('0x83')][_0x0700('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x0700('0x90')](_0x36d07d)){_0x5b9925=path[_0x0700('0x68')](_0x0700('0x91'),_0x291eac,_0x1494ae[0x0],_0x36d07d);}else{_0x5b9925=_0x36d07d;}}else{logger[_0x0700('0x6f')](_0x0700('0x93'));}}else if(_0xfe5c0d===_0x0700('0x85')){_0x1db249=_0x49dd7f[_0x0700('0x80')][_0x0700('0x86')];_0x2a41cd=_0x49dd7f['parameters']['scriptPath'];if('undefined'!=typeof _0x49dd7f[_0x0700('0x80')][_0x0700('0x83')]){if(_0x0700('0x29')!=typeof _0x49dd7f['parameters'][_0x0700('0x83')][_0x0700('0x8f')]){var _0x1c5527=_0x49dd7f[_0x0700('0x80')][_0x0700('0x83')][_0x0700('0x8f')];if(!/^(f|ht)tps?:\/\//i[_0x0700('0x90')](_0x1c5527)){_0x2650a1=path[_0x0700('0x68')](_0x0700('0x91'),_0x291eac,_0x1494ae[0x0],_0x1c5527);}else{_0x2650a1=_0x1c5527;}}if(_0x0700('0x29')!=typeof _0x49dd7f[_0x0700('0x80')][_0x0700('0x83')][_0x0700('0x84')]){var _0x36d07d=_0x49dd7f['parameters']['views'][_0x0700('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x0700('0x90')](_0x36d07d)){_0x5b9925=path[_0x0700('0x68')](_0x0700('0x91'),_0x291eac,_0x1494ae[0x0],_0x36d07d);}else{_0x5b9925=_0x36d07d;}}}}var _0x5506f6={'name':_0x3c62ab,'description':_0x39238d,'path':path[_0x0700('0x68')](_0x291eac,_0x1494ae[0x0]),'type':_0xfe5c0d,'sidebar':_0x4e20af,'icon':_0x261065,'adminUrl':_0x2650a1,'agentUrl':_0x5b9925,'scriptName':_0x1db249,'scriptPath':_0x2a41cd,'version':_0x3a0352};removeReferences(_0x2cd048,null);return db[_0x0700('0x3a')][_0x0700('0x94')](_0x5506f6)[_0x0700('0x2f')](function(_0x2c0595){var _0x16b0af={'role':_0x226125[_0x0700('0x95')]['role'],'userProfileId':_0x226125['body']['userProfileId']};if(!_0x16b0af)throw new Error(_0x0700('0x96'));if(_0x16b0af[_0x0700('0x97')]==='user'){var _0x41057a=_0x2c0595[_0x0700('0x31')]({'plain':!![]});return db[_0x0700('0x98')][_0x0700('0x58')]({'where':{'name':'Plugins','userProfileId':_0x16b0af[_0x0700('0x99')]},'raw':!![]})[_0x0700('0x2f')](function(_0x538eba){if(_0x538eba&&_0x538eba[_0x0700('0x9a')]===0x0){return db[_0x0700('0x33')][_0x0700('0x94')]({'name':_0x41057a['name'],'resourceId':_0x41057a['id'],'type':_0x538eba[_0x0700('0x36')],'sectionId':_0x538eba['id']},{})[_0x0700('0x2f')](function(){return _0x2c0595;});}else{return _0x2c0595;}})['catch'](function(_0x188f0c){logger[_0x0700('0x34')](_0x0700('0x9b'),_0x188f0c);throw _0x188f0c;});}return _0x2c0595;})[_0x0700('0x2f')](respondWithResult(_0x23a864,null))[_0x0700('0x53')](handleError(_0x23a864,null));}});}catch(_0x5f1c20){_0x23a864['status'](0x1f4)[_0x0700('0x37')](_0x5f1c20);}};function removeReferences(_0x337ccf,_0x51079b){try{if(_0x337ccf){fs[_0x0700('0x9c')](_0x337ccf);logger[_0x0700('0x6f')](_0x0700('0x9d'));}if(_0x51079b){rimraf(_0x51079b,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x23ddea){logger[_0x0700('0x34')](_0x23ddea);}}exports['update']=function(_0x4d53dc,_0x53f4aa,_0x3d7f86){return db['Plugin'][_0x0700('0x58')]({'where':{'id':_0x4d53dc[_0x0700('0x55')]['id']}})[_0x0700('0x2f')](handleEntityNotFound(_0x53f4aa,null))['then'](saveUpdates(_0x4d53dc[_0x0700('0x95')],null))['then'](respondWithResult(_0x53f4aa,null))[_0x0700('0x53')](handleError(_0x53f4aa,null));};exports[_0x0700('0x9e')]=function(_0x370459,_0x31707f,_0x506650){return db[_0x0700('0x3a')][_0x0700('0x58')]({'where':{'id':_0x370459['params']['id']}})[_0x0700('0x2f')](function(_0x2ac2aa){if(_0x2ac2aa){return _0x2ac2aa[_0x0700('0x30')]();}})['then'](function(_0x23e4f9){rimraf(path['join'](config[_0x0700('0x5a')],'server/files/plugins',path[_0x0700('0x67')](_0x23e4f9[_0x0700('0x59')])),function(){});return _0x23e4f9;})['then'](handleEntityNotFound(_0x31707f,null))[_0x0700('0x2f')](respondWithStatusCode(_0x31707f,null))['catch'](handleError(_0x31707f,null));};exports[_0x0700('0x9f')]=function(_0x32cb97,_0xf12b2d,_0x34164e){return BPromise[_0x0700('0xa0')]()[_0x0700('0x2f')](function(){if(!_0x32cb97[_0x0700('0x3e')][_0x0700('0x59')]){throw new Error(_0x0700('0xa1'));}if(!_0x32cb97[_0x0700('0x3e')][_0x0700('0xa2')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x33bc71=_0x32cb97['query'][_0x0700('0xa3')]?_0x32cb97[_0x0700('0x3e')]['hostname']+':'+_0x32cb97['query'][_0x0700('0xa2')]:_0x0700('0xa4')+_0x32cb97[_0x0700('0x3e')][_0x0700('0xa2')];var _0x5e8acf=_0x32cb97['query'][_0x0700('0x27')]?_0x32cb97[_0x0700('0x3e')][_0x0700('0x27')]:!![];var _0x2577ce=_0x32cb97[_0x0700('0x3e')][_0x0700('0xa5')]?_0x32cb97[_0x0700('0x3e')]['encoding']:null;var _0x103c7b={'method':_0x32cb97['method'],'uri':util[_0x0700('0x5c')](_0x0700('0xa6'),_0x33bc71,_0x32cb97[_0x0700('0x3e')][_0x0700('0x59')]),'json':_0x5e8acf,'resolveWithFullResponse':!![],'encoding':_0x2577ce,'qs':_0x32cb97['query']};if(_0x32cb97[_0x0700('0xa7')]){_0x103c7b[_0x0700('0xa7')]=_0x32cb97[_0x0700('0xa7')];if(_0x103c7b[_0x0700('0xa7')][_0x0700('0xa8')]){delete _0x103c7b[_0x0700('0xa7')][_0x0700('0xa8')];}}if(_0x103c7b[_0x0700('0xa7')]['content-type']){delete _0x103c7b[_0x0700('0xa7')][_0x0700('0xa9')];}return rp(_0x103c7b);})[_0x0700('0x2f')](function(_0x2695ec){if(_0x2695ec){_0xf12b2d['set'](_0x2695ec[_0x0700('0xa7')]);logger[_0x0700('0x6f')](_0x2695ec[_0x0700('0x95')]);if(_[_0x0700('0xaa')](_0x32cb97['query'][_0x0700('0x59')],_0x0700('0x57'))&&_0x2695ec['statusCode']==0x1f4){return _0xf12b2d[_0x0700('0x24')](_0x2695ec[_0x0700('0xab')]);}else{return _0xf12b2d[_0x0700('0x25')](_0x2695ec[_0x0700('0xab')])[_0x0700('0x37')](_0x2695ec[_0x0700('0x95')]);}}else{return _0xf12b2d[_0x0700('0x24')](0xc8);}})[_0x0700('0x53')](handleError(_0xf12b2d,null));};exports[_0x0700('0xac')]=function(_0x23b0f7,_0x42f693,_0x4c3e8b){return BPromise[_0x0700('0xa0')]()[_0x0700('0x2f')](function(){if(!_0x23b0f7[_0x0700('0x3e')][_0x0700('0x59')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x23b0f7[_0x0700('0x3e')][_0x0700('0xa2')]){throw new Error(_0x0700('0xad'));}var _0x5a73a1=_0x23b0f7[_0x0700('0x3e')][_0x0700('0xa3')]?_0x23b0f7['query'][_0x0700('0xa3')]+':'+_0x23b0f7['query']['port']:'http://localhost:'+_0x23b0f7[_0x0700('0x3e')][_0x0700('0xa2')];var _0x1749e4=_0x23b0f7[_0x0700('0x3e')][_0x0700('0x27')]?_0x23b0f7['query'][_0x0700('0x27')]:!![];var _0x3e1157=_0x23b0f7['query'][_0x0700('0xa5')]?_0x23b0f7[_0x0700('0x3e')]['encoding']:null;var _0x2c5190={'method':_0x23b0f7[_0x0700('0xae')],'uri':util[_0x0700('0x5c')](_0x0700('0xa6'),_0x5a73a1,_0x23b0f7[_0x0700('0x3e')]['path']),'json':_0x1749e4,'resolveWithFullResponse':!![],'encoding':_0x3e1157,'body':_0x23b0f7[_0x0700('0x95')]};if(_0x23b0f7[_0x0700('0xa7')]){_0x2c5190[_0x0700('0xa7')]=_0x23b0f7[_0x0700('0xa7')];if(_0x2c5190['headers'][_0x0700('0xa8')]){delete _0x2c5190[_0x0700('0xa7')][_0x0700('0xa8')];}}if(_0x2c5190[_0x0700('0xa7')][_0x0700('0xa9')]){delete _0x2c5190['headers'][_0x0700('0xa9')];}return rp(_0x2c5190);})[_0x0700('0x2f')](function(_0xdc722f){if(_0xdc722f){_0x42f693[_0x0700('0x2b')](_0xdc722f[_0x0700('0xa7')]);logger['info'](_0xdc722f['body']);return _0x42f693[_0x0700('0x25')](_0xdc722f[_0x0700('0xab')])[_0x0700('0x37')](_0xdc722f['body']);}else{return _0x42f693[_0x0700('0x24')](0xc8);}})[_0x0700('0x53')](handleError(_0x42f693,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 93aba05..da8ec34 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 _0x3c94=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x4adff1,_0x4a8cbe){var _0x318759=function(_0x32faef){while(--_0x32faef){_0x4adff1['push'](_0x4adff1['shift']());}};_0x318759(++_0x4a8cbe);}(_0x3c94,0xcd));var _0x43c9=function(_0x33080e,_0x1c600a){_0x33080e=_0x33080e-0x0;var _0x407395=_0x3c94[_0x33080e];return _0x407395;};'use strict';var EventEmitter=require(_0x43c9('0x0'));var Plugin=require(_0x43c9('0x1'))['db'][_0x43c9('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x43c9('0x3')](0x0);var events={'afterCreate':_0x43c9('0x4'),'afterUpdate':_0x43c9('0x5'),'afterDestroy':_0x43c9('0x6')};function emitEvent(_0x18159f){return function(_0x170a0d,_0x44fc3,_0x15ef71){PluginEvents[_0x43c9('0x7')](_0x18159f+':'+_0x170a0d['id'],_0x170a0d);PluginEvents['emit'](_0x18159f,_0x170a0d);_0x15ef71(null);};}for(var e in events){if(events[_0x43c9('0x8')](e)){var event=events[e];Plugin[_0x43c9('0x9')](e,emitEvent(event));}}module[_0x43c9('0xa')]=PluginEvents; \ No newline at end of file +var _0x5398=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0x5398,0xe2));var _0x8539=function(_0x1b455f,_0x4cfd39){_0x1b455f=_0x1b455f-0x0;var _0xe59ed5=_0x5398[_0x1b455f];return _0xe59ed5;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x8539('0x0'))['db'][_0x8539('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x8539('0x2')](0x0);var events={'afterCreate':_0x8539('0x3'),'afterUpdate':_0x8539('0x4'),'afterDestroy':_0x8539('0x5')};function emitEvent(_0x27751){return function(_0x4e7787,_0x5ed870,_0x82ad80){PluginEvents[_0x8539('0x6')](_0x27751+':'+_0x4e7787['id'],_0x4e7787);PluginEvents[_0x8539('0x6')](_0x27751,_0x4e7787);_0x82ad80(null);};}for(var e in events){if(events[_0x8539('0x7')](e)){var event=events[e];Plugin[_0x8539('0x8')](e,emitEvent(event));}}module[_0x8539('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 7cb4f07..bcd8df7 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 _0x3713=['define','Plugin','plugins','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./plugin.attributes','exports'];(function(_0x598804,_0x119474){var _0x46906c=function(_0x2c8545){while(--_0x2c8545){_0x598804['push'](_0x598804['shift']());}};_0x46906c(++_0x119474);}(_0x3713,0xe7));var _0x3371=function(_0x602096,_0x37efbd){_0x602096=_0x602096-0x0;var _0x277084=_0x3713[_0x602096];return _0x277084;};'use strict';var _=require(_0x3371('0x0'));var util=require('util');var logger=require(_0x3371('0x1'))(_0x3371('0x2'));var moment=require(_0x3371('0x3'));var BPromise=require(_0x3371('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3371('0x5'));var rimraf=require(_0x3371('0x6'));var config=require('../../config/environment');var attributes=require(_0x3371('0x7'));module[_0x3371('0x8')]=function(_0xa6837,_0x32b780){return _0xa6837[_0x3371('0x9')](_0x3371('0xa'),attributes,{'tableName':_0x3371('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97b6=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0x97b6,0x1e4));var _0x697b=function(_0x6f3945,_0x3f1a6d){_0x6f3945=_0x6f3945-0x0;var _0x2bf1dd=_0x97b6[_0x6f3945];return _0x2bf1dd;};'use strict';var _=require(_0x697b('0x0'));var util=require(_0x697b('0x1'));var logger=require(_0x697b('0x2'))(_0x697b('0x3'));var moment=require(_0x697b('0x4'));var BPromise=require('bluebird');var rp=require(_0x697b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x697b('0x6'));var config=require(_0x697b('0x7'));var attributes=require(_0x697b('0x8'));module[_0x697b('0x9')]=function(_0x2fc438,_0x4bef70){return _0x2fc438[_0x697b('0xa')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 0736632..7b7527d 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 _0x91e9=['request','then','info','Plugin,\x20%s,\x20%s','debug','request\x20sent','code','error','message','result','catch','CreatePlugin','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0x91e9,0x192));var _0x991e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x91e9[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x991e('0x0'));var util=require(_0x991e('0x1'));var moment=require(_0x991e('0x2'));var BPromise=require(_0x991e('0x3'));var rs=require(_0x991e('0x4'));var fs=require('fs');var Redis=require(_0x991e('0x5'));var db=require(_0x991e('0x6'))['db'];var utils=require(_0x991e('0x7'));var logger=require(_0x991e('0x8'))('rpc');var config=require(_0x991e('0x9'));var jayson=require(_0x991e('0xa'));var client=jayson['client'][_0x991e('0xb')]({'port':0x232a});config['redis']=_[_0x991e('0xc')](config[_0x991e('0xd')],{'host':_0x991e('0xe'),'port':0x18eb});var socket=require(_0x991e('0xf'))(new Redis(config[_0x991e('0xd')]));require(_0x991e('0x10'))[_0x991e('0x11')](socket);function respondWithRpcPromise(_0x114031,_0x11b54a,_0x564388){return new BPromise(function(_0x2fd795,_0x222448){return client[_0x991e('0x12')](_0x114031,_0x564388)[_0x991e('0x13')](function(_0x48e283){logger[_0x991e('0x14')](_0x991e('0x15'),_0x11b54a,'request\x20sent');logger[_0x991e('0x16')]('Plugin,\x20%s,\x20%s,\x20%s',_0x11b54a,_0x991e('0x17'),JSON['stringify'](_0x48e283));if(_0x48e283['error']){if(_0x48e283['error'][_0x991e('0x18')]===0x1f4){logger[_0x991e('0x19')](_0x991e('0x15'),_0x11b54a,_0x48e283[_0x991e('0x19')][_0x991e('0x1a')]);return _0x222448(_0x48e283[_0x991e('0x19')][_0x991e('0x1a')]);}logger[_0x991e('0x19')](_0x991e('0x15'),_0x11b54a,_0x48e283[_0x991e('0x19')][_0x991e('0x1a')]);return _0x2fd795(_0x48e283[_0x991e('0x19')]['message']);}else{logger[_0x991e('0x14')]('Plugin,\x20%s,\x20%s',_0x11b54a,_0x991e('0x17'));_0x2fd795(_0x48e283[_0x991e('0x1b')][_0x991e('0x1a')]);}})[_0x991e('0x1c')](function(_0x114d37){logger[_0x991e('0x19')](_0x991e('0x15'),_0x11b54a,_0x114d37);_0x222448(_0x114d37);});});}exports[_0x991e('0x1d')]=function(_0x9b1ba1){var _0xa88ed6=this;return new Promise(function(_0x37d2c7,_0x2ca95e){return db['Plugin'][_0x991e('0x1e')](_0x9b1ba1[_0x991e('0x1f')],{'raw':_0x9b1ba1[_0x991e('0x20')]?_0x9b1ba1[_0x991e('0x20')][_0x991e('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x45cfa6){logger[_0x991e('0x14')](_0x991e('0x1d'),_0x9b1ba1);logger[_0x991e('0x16')](_0x991e('0x1d'),_0x9b1ba1,JSON[_0x991e('0x22')](_0x45cfa6));_0x37d2c7(_0x45cfa6);})[_0x991e('0x1c')](function(_0x2c86e1){logger[_0x991e('0x19')](_0x991e('0x1d'),_0x2c86e1[_0x991e('0x1a')],_0x9b1ba1);_0x2ca95e(_0xa88ed6[_0x991e('0x19')](0x1f4,_0x2c86e1['message']));});});}; \ No newline at end of file +var _0x7f3c=['defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis'];(function(_0x31999e,_0x4b5429){var _0x2e5260=function(_0x3822fe){while(--_0x3822fe){_0x31999e['push'](_0x31999e['shift']());}};_0x2e5260(++_0x4b5429);}(_0x7f3c,0x1d7));var _0xc7f3=function(_0x4f11cb,_0x14e174){_0x4f11cb=_0x4f11cb-0x0;var _0x491488=_0x7f3c[_0x4f11cb];return _0x491488;};'use strict';var _=require(_0xc7f3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc7f3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7f3('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7f3('0x3'));var logger=require(_0xc7f3('0x4'))(_0xc7f3('0x5'));var config=require(_0xc7f3('0x6'));var jayson=require(_0xc7f3('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xc7f3('0x8')]=_[_0xc7f3('0x9')](config[_0xc7f3('0x8')],{'host':_0xc7f3('0xa'),'port':0x18eb});var socket=require(_0xc7f3('0xb'))(new Redis(config[_0xc7f3('0x8')]));require('./plugin.socket')[_0xc7f3('0xc')](socket);function respondWithRpcPromise(_0x243548,_0x5accf3,_0x29bac3){return new BPromise(function(_0x213701,_0x15b694){return client[_0xc7f3('0xd')](_0x243548,_0x29bac3)[_0xc7f3('0xe')](function(_0x34d1fe){logger[_0xc7f3('0xf')](_0xc7f3('0x10'),_0x5accf3,'request\x20sent');logger[_0xc7f3('0x11')](_0xc7f3('0x12'),_0x5accf3,_0xc7f3('0x13'),JSON[_0xc7f3('0x14')](_0x34d1fe));if(_0x34d1fe[_0xc7f3('0x15')]){if(_0x34d1fe[_0xc7f3('0x15')][_0xc7f3('0x16')]===0x1f4){logger['error'](_0xc7f3('0x10'),_0x5accf3,_0x34d1fe[_0xc7f3('0x15')][_0xc7f3('0x17')]);return _0x15b694(_0x34d1fe['error'][_0xc7f3('0x17')]);}logger[_0xc7f3('0x15')](_0xc7f3('0x10'),_0x5accf3,_0x34d1fe[_0xc7f3('0x15')]['message']);return _0x213701(_0x34d1fe['error'][_0xc7f3('0x17')]);}else{logger[_0xc7f3('0xf')](_0xc7f3('0x10'),_0x5accf3,'request\x20sent');_0x213701(_0x34d1fe[_0xc7f3('0x18')][_0xc7f3('0x17')]);}})[_0xc7f3('0x19')](function(_0x4035f3){logger[_0xc7f3('0x15')](_0xc7f3('0x10'),_0x5accf3,_0x4035f3);_0x15b694(_0x4035f3);});});}exports[_0xc7f3('0x1a')]=function(_0x45e8c1){var _0x36dda3=this;return new Promise(function(_0x19f422,_0xac4d53){return db[_0xc7f3('0x1b')][_0xc7f3('0x1c')](_0x45e8c1[_0xc7f3('0x1d')],{'raw':_0x45e8c1[_0xc7f3('0x1e')]?_0x45e8c1[_0xc7f3('0x1e')][_0xc7f3('0x1f')]===undefined?!![]:![]:!![]})[_0xc7f3('0xe')](function(_0x3b7102){logger[_0xc7f3('0xf')]('CreatePlugin',_0x45e8c1);logger[_0xc7f3('0x11')]('CreatePlugin',_0x45e8c1,JSON[_0xc7f3('0x14')](_0x3b7102));_0x19f422(_0x3b7102);})['catch'](function(_0x1c9c20){logger[_0xc7f3('0x15')]('CreatePlugin',_0x1c9c20[_0xc7f3('0x17')],_0x45e8c1);_0xac4d53(_0x36dda3[_0xc7f3('0x15')](0x1f4,_0x1c9c20['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 0ddeb5c..e2478a0 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 _0x293c=['length','remove','update','emit','register'];(function(_0x1865cd,_0x2d9adb){var _0x395fac=function(_0x261750){while(--_0x261750){_0x1865cd['push'](_0x1865cd['shift']());}};_0x395fac(++_0x2d9adb);}(_0x293c,0x6a));var _0xc293=function(_0x211223,_0x2e0d1d){_0x211223=_0x211223-0x0;var _0x21c720=_0x293c[_0x211223];return _0x21c720;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0xc293('0x0'),_0xc293('0x1')];function createListener(_0x1f6d92,_0x4ff0c3){return function(_0x28de0f){_0x4ff0c3[_0xc293('0x2')](_0x1f6d92,_0x28de0f);};}function removeListener(_0x2dfa49,_0x5c2e89){return function(){PluginEvents['removeListener'](_0x2dfa49,_0x5c2e89);};}exports[_0xc293('0x3')]=function(_0x92a169){for(var _0x10870a=0x0,_0x13278a=events[_0xc293('0x4')];_0x10870a<_0x13278a;_0x10870a++){var _0x52301b=events[_0x10870a];var _0x24f674=createListener('plugin:'+_0x52301b,_0x92a169);PluginEvents['on'](_0x52301b,_0x24f674);}}; \ No newline at end of file +var _0x5015=['emit','removeListener','register','length','plugin:','./plugin.events','save','remove'];(function(_0x5d6f58,_0x7b1a63){var _0x45b865=function(_0x5f4933){while(--_0x5f4933){_0x5d6f58['push'](_0x5d6f58['shift']());}};_0x45b865(++_0x7b1a63);}(_0x5015,0xd5));var _0x5501=function(_0x3bd875,_0x4d851f){_0x3bd875=_0x3bd875-0x0;var _0x4c1977=_0x5015[_0x3bd875];return _0x4c1977;};'use strict';var PluginEvents=require(_0x5501('0x0'));var events=[_0x5501('0x1'),_0x5501('0x2'),'update'];function createListener(_0x28f23b,_0x26c33f){return function(_0xde5126){_0x26c33f[_0x5501('0x3')](_0x28f23b,_0xde5126);};}function removeListener(_0x55a6fb,_0x68f61c){return function(){PluginEvents[_0x5501('0x4')](_0x55a6fb,_0x68f61c);};}exports[_0x5501('0x5')]=function(_0x44b463){for(var _0x2186f6=0x0,_0x1567b9=events[_0x5501('0x6')];_0x2186f6<_0x1567b9;_0x2186f6++){var _0x1cb97e=events[_0x2186f6];var _0x6a6d97=createListener(_0x5501('0x7')+_0x1cb97e,_0x44b463);PluginEvents['on'](_0x1cb97e,_0x6a6d97);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 2b6c97d..7048257 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(_0x33d534,_0x13aa85){var _0xb07093=function(_0x36cccd){while(--_0x36cccd){_0x33d534['push'](_0x33d534['shift']());}};_0xb07093(++_0x13aa85);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x4f4841,_0x1d5d16){var _0x1d4706=function(_0x16d698){while(--_0x16d698){_0x4f4841['push'](_0x4f4841['shift']());}};_0x1d4706(++_0x1d5d16);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 a22d82c..b181b4c 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 _0xf290=['reject','express','length','catch','show','params','create','body','script','join','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','stop','hasOwnProperty','Unknown\x20id','../../config/pm2','api','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','index','list','then'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0xf290,0xde));var _0x0f29=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0xf290[_0x39872b];return _0x55fa18;};'use strict';var _=require('lodash');var pm2=require(_0x0f29('0x0'));var logger=require('../../config/logger')(_0x0f29('0x1'));var path=require('path');var exec=require(_0x0f29('0x2'))[_0x0f29('0x3')];var BPromise=require(_0x0f29('0x4'));function handleEntityNotFound(_0x28b644,_0xfdab92){return function(_0x5984ba){if(!_0x5984ba){_0x28b644[_0x0f29('0x5')](0x194);;}return _0x5984ba;};}function respondWithResult(_0x4911fb,_0x2d5350){_0x2d5350=_0x2d5350||0xc8;return function(_0x1c45ec){if(_0x1c45ec){return _0x4911fb[_0x0f29('0x6')](_0x2d5350)[_0x0f29('0x7')](_0x1c45ec);}return null;};}function handleError(_0xc78ca2,_0x45350b){_0x45350b=_0x45350b||0x1f4;return function(_0x2be26e){logger[_0x0f29('0x8')](_0x2be26e[_0x0f29('0x9')]);if(_0x2be26e[_0x0f29('0xa')]){delete _0x2be26e[_0x0f29('0xa')];}_0xc78ca2[_0x0f29('0x6')](_0x45350b)[_0x0f29('0xb')](_0x2be26e);};}function execChildProcess(){return new BPromise(function(_0xbcdea8,_0x5cc052){exec('npm\x20install',function(_0x38eb8f,_0x5f4796,_0xc11f21){logger[_0x0f29('0xc')](_0x5f4796);logger[_0x0f29('0xc')](_0xc11f21);if(_0x38eb8f){logger[_0x0f29('0x8')](_0x38eb8f);return _0x5cc052(_0x38eb8f);}return _0xbcdea8(_0x5f4796);});});}exports[_0x0f29('0xd')]=function(_0x2d2573,_0x5519cf){return pm2[_0x0f29('0xe')]()[_0x0f29('0xf')](function(_0x2bb7b8){if(_0x2bb7b8){var _0x368984=_[_0x0f29('0x10')](_0x2bb7b8,function(_0x2ed9c5){return _0x2ed9c5[_0x0f29('0xa')]===_0x0f29('0x11')||_0x2ed9c5['name']==='motion2';});return{'rows':_0x368984,'count':_0x368984[_0x0f29('0x12')]};}return null;})[_0x0f29('0xf')](respondWithResult(_0x5519cf,null))[_0x0f29('0x13')](handleError(_0x5519cf,null));};exports[_0x0f29('0x14')]=function(_0x4b3f0b,_0x122bfa){return pm2['describe'](_0x4b3f0b[_0x0f29('0x15')]['id'])['then'](respondWithResult(_0x122bfa,null))['then'](handleEntityNotFound(_0x122bfa,null))['catch'](handleError(_0x122bfa,null));};exports[_0x0f29('0x16')]=function(_0x8fc03f,_0x13e8ff){if(_0x8fc03f[_0x0f29('0x17')][_0x0f29('0xa')]&&_0x8fc03f[_0x0f29('0x17')][_0x0f29('0x18')]){var _0x4888b6=path[_0x0f29('0x19')](__dirname,'../../files/plugins',_0x8fc03f['body']['script']);var _0x5d94b9=process[_0x0f29('0x1a')]();process[_0x0f29('0x1b')](path['dirname'](_0x4888b6));return execChildProcess()[_0x0f29('0xf')](function(_0x1840e0){process[_0x0f29('0x1b')](_0x5d94b9);return pm2[_0x0f29('0x1c')]({'name':_0x8fc03f[_0x0f29('0x17')]['name'],'script':_0x4888b6});})[_0x0f29('0xf')](function(_0x5a440f){pm2[_0x0f29('0x1d')]();return _0x5a440f[0x0];})[_0x0f29('0xf')](respondWithResult(_0x13e8ff,0xc9))[_0x0f29('0x13')](handleError(_0x13e8ff,null));}else{return _0x13e8ff[_0x0f29('0x6')](0x1f4)['send']({'message':_0x0f29('0x1e')});}};exports['update']=function(_0x58b201,_0x92876){if(_0x58b201['body']['id']){delete _0x58b201['body']['id'];}var _0x57dcc7={'online':'restart','stopped':_0x0f29('0x1f')};if(_0x57dcc7[_0x0f29('0x20')](_0x58b201['body'][_0x0f29('0x6')])){return pm2[_0x57dcc7[_0x58b201[_0x0f29('0x17')][_0x0f29('0x6')]]](_0x58b201['params']['id'])['then'](respondWithResult(_0x92876,0xc8))[_0x0f29('0x13')](handleError(_0x92876,null));}else{return _0x92876['status'](0x1f4)[_0x0f29('0xb')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x7b10f,_0x409b19){if(_0x7b10f[_0x0f29('0x17')]['id']){delete _0x7b10f[_0x0f29('0x17')]['id'];}if(_0x7b10f['params']['id']){return pm2['delete'](_0x7b10f[_0x0f29('0x15')]['id'])['then'](function(_0x4a4cf2){pm2[_0x0f29('0x1d')]();return _0x4a4cf2[0x0];})['then'](respondWithResult(_0x409b19,null))[_0x0f29('0x13')](handleError(_0x409b19,null));}else{return _0x409b19['status'](0x1f4)['send']({'message':_0x0f29('0x21')});}}; \ No newline at end of file +var _0x6e6c=['script','join','cwd','dirname','chdir','start','dump','update','restart','hasOwnProperty','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','api','path','bluebird','sendStatus','status','error','name','send','npm\x20install','info','index','then','reject','express','length','catch','describe','create','body'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc6e6('0x0'));var pm2=require(_0xc6e6('0x1'));var logger=require('../../config/logger')(_0xc6e6('0x2'));var path=require(_0xc6e6('0x3'));var exec=require('child_process')['exec'];var BPromise=require(_0xc6e6('0x4'));function handleEntityNotFound(_0x5a9e2b,_0x40b7e1){return function(_0x4b13f0){if(!_0x4b13f0){_0x5a9e2b[_0xc6e6('0x5')](0x194);;}return _0x4b13f0;};}function respondWithResult(_0x1182c7,_0x4bf906){_0x4bf906=_0x4bf906||0xc8;return function(_0x301f55){if(_0x301f55){return _0x1182c7[_0xc6e6('0x6')](_0x4bf906)['json'](_0x301f55);}return null;};}function handleError(_0x324706,_0x15d268){_0x15d268=_0x15d268||0x1f4;return function(_0x5a7ef3){logger[_0xc6e6('0x7')](_0x5a7ef3['stack']);if(_0x5a7ef3[_0xc6e6('0x8')]){delete _0x5a7ef3[_0xc6e6('0x8')];}_0x324706[_0xc6e6('0x6')](_0x15d268)[_0xc6e6('0x9')](_0x5a7ef3);};}function execChildProcess(){return new BPromise(function(_0x12596b,_0xbf9ffc){exec(_0xc6e6('0xa'),function(_0x10aae5,_0x2c205d,_0x58540d){logger[_0xc6e6('0xb')](_0x2c205d);logger['info'](_0x58540d);if(_0x10aae5){logger[_0xc6e6('0x7')](_0x10aae5);return _0xbf9ffc(_0x10aae5);}return _0x12596b(_0x2c205d);});});}exports[_0xc6e6('0xc')]=function(_0x33aea0,_0x13c8d5){return pm2['list']()[_0xc6e6('0xd')](function(_0x2bfe7d){if(_0x2bfe7d){var _0x13be73=_[_0xc6e6('0xe')](_0x2bfe7d,function(_0x102673){return _0x102673['name']===_0xc6e6('0xf')||_0x102673[_0xc6e6('0x8')]==='motion2';});return{'rows':_0x13be73,'count':_0x13be73[_0xc6e6('0x10')]};}return null;})[_0xc6e6('0xd')](respondWithResult(_0x13c8d5,null))[_0xc6e6('0x11')](handleError(_0x13c8d5,null));};exports['show']=function(_0x51fd7c,_0x5867bf){return pm2[_0xc6e6('0x12')](_0x51fd7c['params']['id'])[_0xc6e6('0xd')](respondWithResult(_0x5867bf,null))[_0xc6e6('0xd')](handleEntityNotFound(_0x5867bf,null))[_0xc6e6('0x11')](handleError(_0x5867bf,null));};exports[_0xc6e6('0x13')]=function(_0x19e1e4,_0x3a0d83){if(_0x19e1e4[_0xc6e6('0x14')][_0xc6e6('0x8')]&&_0x19e1e4[_0xc6e6('0x14')][_0xc6e6('0x15')]){var _0x4a36b6=path[_0xc6e6('0x16')](__dirname,'../../files/plugins',_0x19e1e4[_0xc6e6('0x14')][_0xc6e6('0x15')]);var _0x2be6fc=process[_0xc6e6('0x17')]();process['chdir'](path[_0xc6e6('0x18')](_0x4a36b6));return execChildProcess()[_0xc6e6('0xd')](function(_0x3a96df){process[_0xc6e6('0x19')](_0x2be6fc);return pm2[_0xc6e6('0x1a')]({'name':_0x19e1e4['body'][_0xc6e6('0x8')],'script':_0x4a36b6});})['then'](function(_0x266786){pm2[_0xc6e6('0x1b')]();return _0x266786[0x0];})[_0xc6e6('0xd')](respondWithResult(_0x3a0d83,0xc9))[_0xc6e6('0x11')](handleError(_0x3a0d83,null));}else{return _0x3a0d83['status'](0x1f4)[_0xc6e6('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xc6e6('0x1c')]=function(_0x534745,_0x267c6a){if(_0x534745[_0xc6e6('0x14')]['id']){delete _0x534745[_0xc6e6('0x14')]['id'];}var _0x41e7c2={'online':_0xc6e6('0x1d'),'stopped':'stop'};if(_0x41e7c2[_0xc6e6('0x1e')](_0x534745[_0xc6e6('0x14')][_0xc6e6('0x6')])){return pm2[_0x41e7c2[_0x534745[_0xc6e6('0x14')]['status']]](_0x534745[_0xc6e6('0x1f')]['id'])['then'](respondWithResult(_0x267c6a,0xc8))[_0xc6e6('0x11')](handleError(_0x267c6a,null));}else{return _0x267c6a[_0xc6e6('0x6')](0x1f4)[_0xc6e6('0x9')]({'message':_0xc6e6('0x20')});}};exports[_0xc6e6('0x21')]=function(_0x402598,_0x43ff9c){if(_0x402598[_0xc6e6('0x14')]['id']){delete _0x402598[_0xc6e6('0x14')]['id'];}if(_0x402598[_0xc6e6('0x1f')]['id']){return pm2[_0xc6e6('0x22')](_0x402598[_0xc6e6('0x1f')]['id'])[_0xc6e6('0xd')](function(_0x410ba5){pm2[_0xc6e6('0x1b')]();return _0x410ba5[0x0];})[_0xc6e6('0xd')](respondWithResult(_0x43ff9c,null))[_0xc6e6('0x11')](handleError(_0x43ff9c,null));}else{return _0x43ff9c['status'](0x1f4)[_0xc6e6('0x9')]({'message':_0xc6e6('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 1ef444b..f6d2d4c 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 _0xed94=['get','/agents','isAuthenticated','/queues','getQueues','exports','./realtime.controller'];(function(_0x39d150,_0x516547){var _0x14f49a=function(_0x527fc2){while(--_0x527fc2){_0x39d150['push'](_0x39d150['shift']());}};_0x14f49a(++_0x516547);}(_0xed94,0x172));var _0x4ed9=function(_0x2336ea,_0x46e872){_0x2336ea=_0x2336ea-0x0;var _0x216bf9=_0xed94[_0x2336ea];return _0x216bf9;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x4ed9('0x0'));router[_0x4ed9('0x1')](_0x4ed9('0x2'),auth[_0x4ed9('0x3')](),controller['getAgents']);router['get'](_0x4ed9('0x4'),auth[_0x4ed9('0x3')](),controller[_0x4ed9('0x5')]);module[_0x4ed9('0x6')]=router; \ No newline at end of file +var _0xccc7=['getAgents','exports','express','Router','../../components/auth/service','./realtime.controller','get','isAuthenticated'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xccc7,0x72));var _0x7ccc=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xccc7[_0x26f702];return _0x11417d;};'use strict';var express=require(_0x7ccc('0x0'));var router=express[_0x7ccc('0x1')]();var auth=require(_0x7ccc('0x2'));var controller=require(_0x7ccc('0x3'));router[_0x7ccc('0x4')]('/agents',auth[_0x7ccc('0x5')](),controller[_0x7ccc('0x6')]);router[_0x7ccc('0x4')]('/queues',auth[_0x7ccc('0x5')](),controller['getQueues']);module[_0x7ccc('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 2aa6d3f..2d60ab5 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 _0xe728=['APIBadRequestError','handleError','offset','limit','undefined','count','status','set','Content-Range','json','getAgents','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','getOptions','raw','push','literal','forEach','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','getResources','filterAgentAttributes','globalStatus','getAgentStatus','voice','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','fields','name','dialActive','dialMethod','outbound','QueueCampaigns','Queues','filter','findAndCountAll','getRealtimeQueues','lodash','util','../../components/realtime/queues','../../config/utils','../../mysqldb','../../errors/api'];(function(_0x22a9dc,_0x48c957){var _0x192737=function(_0x36766c){while(--_0x36766c){_0x22a9dc['push'](_0x22a9dc['shift']());}};_0x192737(++_0x48c957);}(_0xe728,0xa2));var _0x8e72=function(_0x5817b3,_0x277666){_0x5817b3=_0x5817b3-0x0;var _0x3707f1=_0xe728[_0x5817b3];return _0x3707f1;};'use strict';var _=require(_0x8e72('0x0'));var util=require(_0x8e72('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x8e72('0x2'));var qs=require('../../components/parsers/qs');var utils=require(_0x8e72('0x3'));var db=require(_0x8e72('0x4'))['db'];var APIBadRequestError=require(_0x8e72('0x5'))[_0x8e72('0x6')];var APIHandleError=require('../../errors/api')[_0x8e72('0x7')];function respondWithFilteredResult(_0xbbd59,_0x3d2a0a){return function(_0x176bad){if(_0x176bad){var _0x59a6f7=typeof _0x3d2a0a[_0x8e72('0x8')]==='undefined'&&typeof _0x3d2a0a[_0x8e72('0x9')]===_0x8e72('0xa');var _0x424160=_0x176bad['count'];var _0x1aa2ea=_0x59a6f7?0x0:_0x3d2a0a[_0x8e72('0x8')];var _0x2a413a=_0x59a6f7?_0x176bad[_0x8e72('0xb')]:_0x3d2a0a[_0x8e72('0x8')]+_0x3d2a0a[_0x8e72('0x9')];var _0x1522f9;if(_0x2a413a>=_0x424160){_0x2a413a=_0x424160;_0x1522f9=0xc8;}else{_0x1522f9=0xce;}_0xbbd59[_0x8e72('0xc')](_0x1522f9);return _0xbbd59[_0x8e72('0xd')](_0x8e72('0xe'),_0x1aa2ea+'-'+_0x2a413a+'/'+_0x424160)[_0x8e72('0xf')](_0x176bad);}return null;};}exports[_0x8e72('0x10')]=function(_0x4ff7e7,_0x7c5e3d){var _0x1dc428={'count':0x0,'rows':[]};var _0x18232d={};var _0x78d5cd;var _0x2508ea=utils[_0x8e72('0x11')]();var _0x5466a4;var _0x555998;var _0x4befb1=_0x4ff7e7['query'][_0x8e72('0x12')];var _0x494013=_0x4ff7e7[_0x8e72('0x13')][_0x8e72('0x14')];var _0x1c819f=_0x4ff7e7[_0x8e72('0x13')][_0x8e72('0x15')];var _0x22deef=_0x494013===_0x8e72('0x16')||_0x494013==='*pause'?!![]:![];var _0x19a3e4=[];var _0x3ff35e;var _0x503f0e;Promise[_0x8e72('0x17')]()[_0x8e72('0x18')](function(){if(_0x4ff7e7[_0x8e72('0x13')][_0x8e72('0x19')]){if(!utils[_0x8e72('0x1a')](_0x4ff7e7[_0x8e72('0x13')]['channel'])){throw new APIBadRequestError(util[_0x8e72('0x1b')](_0x8e72('0x1c'),_0x4ff7e7['query']['channel']));}_0x78d5cd=_0x4ff7e7[_0x8e72('0x13')][_0x8e72('0x19')][_0x8e72('0x1d')]();}if(!_0x4ff7e7[_0x8e72('0x13')][_0x8e72('0x1e')]||!_0x4ff7e7['query'][_0x8e72('0x1e')][_0x8e72('0x1f')]('globalStatus')){_0x4ff7e7[_0x8e72('0x13')][_0x8e72('0x1e')]=rta['validateSortParameter'](_0x4ff7e7[_0x8e72('0x13')]['sort']);return;}var _0x1a814a=rta['getUpdatedSortOptions'](_0x4ff7e7[_0x8e72('0x13')][_0x8e72('0x1e')]);_0x4ff7e7['query'][_0x8e72('0x1e')]=_0x1a814a['fields'][_0x8e72('0x20')](',');_0x3ff35e=_0x1a814a[_0x8e72('0x21')];})['then'](function(){if(!_0x4befb1){return[];}return rta[_0x8e72('0x22')](_0x4befb1,_0x78d5cd);})[_0x8e72('0x18')](function(_0x13bd39){_0x19a3e4=_0x13bd39;return rta['getRealtimeAgents']();})['then'](function(_0x467c88){_0x555998=_0x467c88[_0x8e72('0x23')];if((!_0x494013||_0x22deef)&&!_0x3ff35e){return _0x19a3e4;}if(_0x3ff35e&&!_0x494013){return rta[_0x8e72('0x24')](_0x555998,_0x19a3e4,_0x3ff35e);}else{return rta[_0x8e72('0x25')](_0x555998,_0x19a3e4,_0x494013);}})[_0x8e72('0x18')](function(_0x55f9a5){_0x19a3e4=_0x55f9a5;var _0x1797d0=![];if(_0x19a3e4[_0x8e72('0x26')]===0x0){if(_0x4befb1||_0x494013){_0x1797d0=!![];}if(_0x22deef){_0x1797d0=![];}}if(_0x1797d0){return _0x1dc428;}var _0x51b168=_[_0x8e72('0x27')](db[_0x8e72('0x28')][_0x8e72('0x29')],function(_0x585077){return{'name':_0x585077[_0x8e72('0x2a')],'type':_0x585077[_0x8e72('0x2b')][_0x8e72('0x2c')]};});_0x4ff7e7['query'][_0x8e72('0x2d')]='agent';_0x18232d=qs[_0x8e72('0x2e')](_0x51b168,_0x4ff7e7);_0x18232d[_0x8e72('0x2f')]=!![];var _0x33fb9c=[];if(_0x19a3e4[_0x8e72('0x26')]>0x0){_0x33fb9c[_0x8e72('0x30')]({'id':{'$in':_0x19a3e4}});if(_0x3ff35e&&!_0x494013){_0x503f0e=[db['sequelize'][_0x8e72('0x31')]('FIELD(id,'+_0x19a3e4+')')];_0x18232d[_0x8e72('0x21')]=_0x503f0e;}}if(_0x22deef){_0x2508ea[_0x8e72('0x32')](function(_0x2537c6){var _0x302a4a=!![];if(_0x494013==='*pause'&&_0x78d5cd!==_0x2537c6){_0x302a4a=![];}_0x33fb9c[_0x8e72('0x30')]({[_0x2537c6+_0x8e72('0x33')]:_0x302a4a});});if(_0x1c819f){_0x33fb9c['push']({'pauseType':_0x1c819f});}}else if(_0x494013){_0x2508ea[_0x8e72('0x32')](function(_0x8fbb1d){_0x33fb9c['push']({[_0x8fbb1d+_0x8e72('0x33')]:![]});});}_0x18232d[_0x8e72('0x34')]=_[_0x8e72('0x35')](_0x18232d['where'],{'$and':_0x33fb9c});if(_0x4ff7e7[_0x8e72('0x36')][_0x8e72('0x2d')]===_0x8e72('0x36')){var _0x144ef5={'params':{'id':_0x4ff7e7[_0x8e72('0x36')][_0x8e72('0x37')]},'query':{'section':_0x8e72('0x38'),'role':'agent','raw':!![],'ids':_0x19a3e4,'customSorting':_0x503f0e}};if(_0x4ff7e7[_0x8e72('0x13')][_0x8e72('0x39')]){_0x144ef5[_0x8e72('0x13')][_0x8e72('0x39')]=!![];}if(_0x22deef){_0x144ef5[_0x8e72('0x13')][_0x8e72('0x3a')]=_0x33fb9c;}_0x144ef5[_0x8e72('0x13')]=Object[_0x8e72('0x3b')](_0x144ef5['query'],_0x4ff7e7[_0x8e72('0x13')]);return db[_0x8e72('0x3c')][_0x8e72('0x3d')](_0x144ef5);}return db['User']['findAndCountAll'](_0x18232d);})[_0x8e72('0x18')](function(_0x155bff){_0x1dc428[_0x8e72('0xb')]=_0x155bff[_0x8e72('0xb')];_0x5466a4=_0x155bff[_0x8e72('0x23')];return _0x5466a4['map'](function(_0x5030df){var _0x44a143=_['find'](_0x555998,['id',_0x5030df['id']]);if(_0x44a143){var _0x13b994=rta[_0x8e72('0x3e')](_0x44a143);_['merge'](_0x5030df,_0x13b994);}_0x5030df[_0x8e72('0x3f')]=rta[_0x8e72('0x40')](_0x5030df);if(_0x5030df[_0x8e72('0x3f')][_0x8e72('0x1f')]('pause')){_0x2508ea[_0x8e72('0x32')](function(_0x2b6c6f){if(_0x5030df[_0x2b6c6f+_0x8e72('0x33')]){if(_0x2b6c6f===_0x8e72('0x41')){if(_0x5030df[_0x8e72('0x42')]!=='talking'){_0x5030df[_0x8e72('0x42')]=_0x8e72('0x16');}}else{_0x5030df[_0x2b6c6f+_0x8e72('0x43')]=_0x8e72('0x16');}}});}return _0x5030df;});})[_0x8e72('0x18')](function(_0x1a15db){if(!_0x3ff35e||_0x503f0e){return _0x1a15db;}return rta[_0x8e72('0x44')](_0x1a15db,_0x3ff35e);})[_0x8e72('0x18')](function(_0x2e301d){var _0x2c2b84=rta['getRealtimeAgentsQueryFields']();_0x1dc428[_0x8e72('0x23')]=_0x2e301d[_0x8e72('0x27')](function(_0x1cbf2b){return _[_0x8e72('0x45')](_0x1cbf2b,_0x2c2b84);});return _0x1dc428;})[_0x8e72('0x18')](respondWithFilteredResult(_0x7c5e3d,_0x18232d))[_0x8e72('0x46')](APIHandleError(_0x7c5e3d));};exports[_0x8e72('0x47')]=function(_0x3e56f0,_0x47445d){var _0x5074e5={'count':0x0,'rows':[]};var _0x4d1518={};var _0x2c528d;var _0x38e78d;var _0x1943a3;Promise['resolve']()[_0x8e72('0x18')](function(){if(_0x3e56f0[_0x8e72('0x13')][_0x8e72('0x19')]){if(!utils[_0x8e72('0x1a')](_0x3e56f0[_0x8e72('0x13')][_0x8e72('0x19')])){throw new APIBadRequestError(util[_0x8e72('0x1b')](_0x8e72('0x1c'),_0x3e56f0[_0x8e72('0x13')][_0x8e72('0x19')]));}_0x2c528d=_0x3e56f0[_0x8e72('0x13')][_0x8e72('0x19')][_0x8e72('0x1d')]();}var _0x27123e=_[_0x8e72('0x48')](_0x2c528d)+_0x8e72('0x49');var _0x472e75=_[_0x8e72('0x27')](db[_0x27123e][_0x8e72('0x29')],function(_0x3c17b2){return{'name':_0x3c17b2[_0x8e72('0x2a')],'type':_0x3c17b2[_0x8e72('0x2b')][_0x8e72('0x2c')]};});if(!_0x3e56f0[_0x8e72('0x13')][_0x8e72('0x4a')]){var _0x8cef4d=['id',_0x8e72('0x4b')];if(_0x2c528d==='voice'){_0x8cef4d[_0x8e72('0x30')]('type');if(_0x3e56f0[_0x8e72('0x13')]['type']==='outbound'){_0x8cef4d[_0x8e72('0x30')]([_0x8e72('0x4c'),_0x8e72('0x4d')]);}}_0x3e56f0['query'][_0x8e72('0x4a')]=_0x8cef4d[_0x8e72('0x20')](',');}_0x4d1518=qs[_0x8e72('0x2e')](_0x472e75,_0x3e56f0);if(_0x3e56f0[_0x8e72('0x36')][_0x8e72('0x2d')]===_0x8e72('0x36')){var _0x36a334={'params':{'id':_0x3e56f0['user'][_0x8e72('0x37')]},'query':{'section':_0x2c528d===_0x8e72('0x41')&&_0x3e56f0['query'][_0x8e72('0x2b')]===_0x8e72('0x4e')?_0x8e72('0x4f'):_[_0x8e72('0x48')](_0x2c528d)+_0x8e72('0x50'),'type':_0x3e56f0['query']['type'],'nolimit':!![],'sort':_0x8e72('0x4b'),'filter':_0x3e56f0[_0x8e72('0x13')][_0x8e72('0x51')]}};_0x36a334[_0x8e72('0x13')]=Object['assign'](_0x36a334[_0x8e72('0x13')],_0x3e56f0['query']);delete _0x36a334[_0x8e72('0x13')]['id'];return db['UserProfile'][_0x8e72('0x3d')](_0x36a334);}return db[_0x27123e][_0x8e72('0x52')](_0x4d1518);})[_0x8e72('0x18')](function(_0x24a5c4){_0x5074e5['count']=_0x24a5c4['count'];_0x38e78d=_0x24a5c4[_0x8e72('0x23')];return rtq[_0x8e72('0x53')](_0x3e56f0,_0x2c528d);})['then'](function(_0xd6d6f8){_0x1943a3=_0xd6d6f8[_0x8e72('0x23')];return rtq['initializeQueues'](_0x38e78d,_0x1943a3,_0x2c528d,_0x3e56f0[_0x8e72('0x13')]['type']);})[_0x8e72('0x18')](function(_0x1123a6){_0x5074e5[_0x8e72('0x23')]=_0x1123a6;return _0x5074e5;})[_0x8e72('0x18')](respondWithFilteredResult(_0x47445d,_0x4d1518))[_0x8e72('0x46')](APIHandleError(_0x47445d));}; \ No newline at end of file +var _0x4bd9=['userProfileId','Agents','online','extraQueryConditions','UserProfile','getResources','User','findAndCountAll','find','filterAgentAttributes','getAgentStatus','voice','voiceStatus','talking','sortAgentsByStatus','pick','catch','getQueues','startCase','outbound','dialActive','dialMethod','fields','QueueCampaigns','Queues','name','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','APIBadRequestError','../../errors/api','handleError','offset','limit','undefined','count','status','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','join','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','rawAttributes','fieldName','type','key','agent','getOptions','raw','push','literal','FIELD(id,','order','Pause','forEach','where','merge','role','user'];(function(_0x1aa9ef,_0x137e88){var _0x148566=function(_0x5d5b1c){while(--_0x5d5b1c){_0x1aa9ef['push'](_0x1aa9ef['shift']());}};_0x148566(++_0x137e88);}(_0x4bd9,0x74));var _0x94bd=function(_0x2b9f06,_0x5daef7){_0x2b9f06=_0x2b9f06-0x0;var _0x2ce344=_0x4bd9[_0x2b9f06];return _0x2ce344;};'use strict';var _=require(_0x94bd('0x0'));var util=require(_0x94bd('0x1'));var rta=require(_0x94bd('0x2'));var rtq=require('../../components/realtime/queues');var qs=require(_0x94bd('0x3'));var utils=require(_0x94bd('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require('../../errors/api')[_0x94bd('0x5')];var APIHandleError=require(_0x94bd('0x6'))[_0x94bd('0x7')];function respondWithFilteredResult(_0x1a60bd,_0xcf276){return function(_0x2720bc){if(_0x2720bc){var _0x2bdacd=typeof _0xcf276[_0x94bd('0x8')]==='undefined'&&typeof _0xcf276[_0x94bd('0x9')]===_0x94bd('0xa');var _0x11516c=_0x2720bc[_0x94bd('0xb')];var _0x1ffe4f=_0x2bdacd?0x0:_0xcf276[_0x94bd('0x8')];var _0x71155c=_0x2bdacd?_0x2720bc['count']:_0xcf276[_0x94bd('0x8')]+_0xcf276['limit'];var _0x4a722b;if(_0x71155c>=_0x11516c){_0x71155c=_0x11516c;_0x4a722b=0xc8;}else{_0x4a722b=0xce;}_0x1a60bd[_0x94bd('0xc')](_0x4a722b);return _0x1a60bd['set'](_0x94bd('0xd'),_0x1ffe4f+'-'+_0x71155c+'/'+_0x11516c)[_0x94bd('0xe')](_0x2720bc);}return null;};}exports[_0x94bd('0xf')]=function(_0x12982b,_0x2ec2f4){var _0x3e415f={'count':0x0,'rows':[]};var _0x1e7dab={};var _0x4d0e13;var _0x4e2c5c=utils[_0x94bd('0x10')]();var _0x4fc421;var _0x2cc562;var _0x14bb77=_0x12982b[_0x94bd('0x11')][_0x94bd('0x12')];var _0x3cce2c=_0x12982b['query'][_0x94bd('0x13')];var _0x2b92d0=_0x12982b[_0x94bd('0x11')][_0x94bd('0x14')];var _0x5b5056=_0x3cce2c===_0x94bd('0x15')||_0x3cce2c===_0x94bd('0x16')?!![]:![];var _0x5006a1=[];var _0x46ced3;var _0x12cc41;Promise[_0x94bd('0x17')]()[_0x94bd('0x18')](function(){if(_0x12982b[_0x94bd('0x11')][_0x94bd('0x19')]){if(!utils['isValidChannel'](_0x12982b[_0x94bd('0x11')][_0x94bd('0x19')])){throw new APIBadRequestError(util[_0x94bd('0x1a')](_0x94bd('0x1b'),_0x12982b[_0x94bd('0x11')][_0x94bd('0x19')]));}_0x4d0e13=_0x12982b[_0x94bd('0x11')][_0x94bd('0x19')][_0x94bd('0x1c')]();}if(!_0x12982b[_0x94bd('0x11')]['sort']||!_0x12982b[_0x94bd('0x11')][_0x94bd('0x1d')][_0x94bd('0x1e')](_0x94bd('0x1f'))){_0x12982b[_0x94bd('0x11')][_0x94bd('0x1d')]=rta[_0x94bd('0x20')](_0x12982b[_0x94bd('0x11')][_0x94bd('0x1d')]);return;}var _0xbd7099=rta[_0x94bd('0x21')](_0x12982b[_0x94bd('0x11')]['sort']);_0x12982b[_0x94bd('0x11')][_0x94bd('0x1d')]=_0xbd7099['fields'][_0x94bd('0x22')](',');_0x46ced3=_0xbd7099['order'];})[_0x94bd('0x18')](function(){if(!_0x14bb77){return[];}return rta['getAgentIdsByQueues'](_0x14bb77,_0x4d0e13);})['then'](function(_0x33a825){_0x5006a1=_0x33a825;return rta[_0x94bd('0x23')]();})['then'](function(_0x50bf5b){_0x2cc562=_0x50bf5b[_0x94bd('0x24')];if((!_0x3cce2c||_0x5b5056)&&!_0x46ced3){return _0x5006a1;}if(_0x46ced3&&!_0x3cce2c){return rta[_0x94bd('0x25')](_0x2cc562,_0x5006a1,_0x46ced3);}else{return rta[_0x94bd('0x26')](_0x2cc562,_0x5006a1,_0x3cce2c);}})[_0x94bd('0x18')](function(_0xeddb29){_0x5006a1=_0xeddb29;var _0x3e3046=![];if(_0x5006a1[_0x94bd('0x27')]===0x0){if(_0x14bb77||_0x3cce2c){_0x3e3046=!![];}if(_0x5b5056){_0x3e3046=![];}}if(_0x3e3046){return _0x3e415f;}var _0x3ff91e=_[_0x94bd('0x28')](db['User'][_0x94bd('0x29')],function(_0x48225e){return{'name':_0x48225e[_0x94bd('0x2a')],'type':_0x48225e[_0x94bd('0x2b')][_0x94bd('0x2c')]};});_0x12982b[_0x94bd('0x11')]['role']=_0x94bd('0x2d');_0x1e7dab=qs[_0x94bd('0x2e')](_0x3ff91e,_0x12982b);_0x1e7dab[_0x94bd('0x2f')]=!![];var _0x3381e8=[];if(_0x5006a1[_0x94bd('0x27')]>0x0){_0x3381e8[_0x94bd('0x30')]({'id':{'$in':_0x5006a1}});if(_0x46ced3&&!_0x3cce2c){_0x12cc41=[db['sequelize'][_0x94bd('0x31')](_0x94bd('0x32')+_0x5006a1+')')];_0x1e7dab[_0x94bd('0x33')]=_0x12cc41;}}if(_0x5b5056){_0x4e2c5c['forEach'](function(_0x30e265){var _0x38c6b2=!![];if(_0x3cce2c===_0x94bd('0x16')&&_0x4d0e13!==_0x30e265){_0x38c6b2=![];}_0x3381e8[_0x94bd('0x30')]({[_0x30e265+_0x94bd('0x34')]:_0x38c6b2});});if(_0x2b92d0){_0x3381e8[_0x94bd('0x30')]({'pauseType':_0x2b92d0});}}else if(_0x3cce2c){_0x4e2c5c[_0x94bd('0x35')](function(_0xcbb7d7){_0x3381e8[_0x94bd('0x30')]({[_0xcbb7d7+_0x94bd('0x34')]:![]});});}_0x1e7dab[_0x94bd('0x36')]=_[_0x94bd('0x37')](_0x1e7dab[_0x94bd('0x36')],{'$and':_0x3381e8});if(_0x12982b['user'][_0x94bd('0x38')]===_0x94bd('0x39')){var _0xbf269e={'params':{'id':_0x12982b['user'][_0x94bd('0x3a')]},'query':{'section':_0x94bd('0x3b'),'role':_0x94bd('0x2d'),'raw':!![],'ids':_0x5006a1,'customSorting':_0x12cc41}};if(_0x12982b[_0x94bd('0x11')][_0x94bd('0x3c')]){_0xbf269e['query'][_0x94bd('0x3c')]=!![];}if(_0x5b5056){_0xbf269e[_0x94bd('0x11')][_0x94bd('0x3d')]=_0x3381e8;}_0xbf269e[_0x94bd('0x11')]=Object['assign'](_0xbf269e[_0x94bd('0x11')],_0x12982b['query']);return db[_0x94bd('0x3e')][_0x94bd('0x3f')](_0xbf269e);}return db[_0x94bd('0x40')][_0x94bd('0x41')](_0x1e7dab);})[_0x94bd('0x18')](function(_0x33d285){_0x3e415f[_0x94bd('0xb')]=_0x33d285[_0x94bd('0xb')];_0x4fc421=_0x33d285[_0x94bd('0x24')];return _0x4fc421[_0x94bd('0x28')](function(_0x4fe9b5){var _0x27d876=_[_0x94bd('0x42')](_0x2cc562,['id',_0x4fe9b5['id']]);if(_0x27d876){var _0x4bf78b=rta[_0x94bd('0x43')](_0x27d876);_[_0x94bd('0x37')](_0x4fe9b5,_0x4bf78b);}_0x4fe9b5[_0x94bd('0x1f')]=rta[_0x94bd('0x44')](_0x4fe9b5);if(_0x4fe9b5['globalStatus']['includes'](_0x94bd('0x15'))){_0x4e2c5c[_0x94bd('0x35')](function(_0x390a64){if(_0x4fe9b5[_0x390a64+_0x94bd('0x34')]){if(_0x390a64===_0x94bd('0x45')){if(_0x4fe9b5[_0x94bd('0x46')]!==_0x94bd('0x47')){_0x4fe9b5[_0x94bd('0x46')]=_0x94bd('0x15');}}else{_0x4fe9b5[_0x390a64+'Status']=_0x94bd('0x15');}}});}return _0x4fe9b5;});})['then'](function(_0x206491){if(!_0x46ced3||_0x12cc41){return _0x206491;}return rta[_0x94bd('0x48')](_0x206491,_0x46ced3);})[_0x94bd('0x18')](function(_0x4523e1){var _0x4b98ff=rta['getRealtimeAgentsQueryFields']();_0x3e415f[_0x94bd('0x24')]=_0x4523e1[_0x94bd('0x28')](function(_0x42045b){return _[_0x94bd('0x49')](_0x42045b,_0x4b98ff);});return _0x3e415f;})[_0x94bd('0x18')](respondWithFilteredResult(_0x2ec2f4,_0x1e7dab))[_0x94bd('0x4a')](APIHandleError(_0x2ec2f4));};exports[_0x94bd('0x4b')]=function(_0x4d7dad,_0x903903){var _0x599c50={'count':0x0,'rows':[]};var _0x520623={};var _0x2625e5;var _0x12fe5b;var _0x55360f;Promise['resolve']()[_0x94bd('0x18')](function(){if(_0x4d7dad['query'][_0x94bd('0x19')]){if(!utils['isValidChannel'](_0x4d7dad[_0x94bd('0x11')][_0x94bd('0x19')])){throw new APIBadRequestError(util[_0x94bd('0x1a')](_0x94bd('0x1b'),_0x4d7dad[_0x94bd('0x11')][_0x94bd('0x19')]));}_0x2625e5=_0x4d7dad['query'][_0x94bd('0x19')]['toLowerCase']();}var _0x51ba5e=_[_0x94bd('0x4c')](_0x2625e5)+'Queue';var _0x3f5e20=_[_0x94bd('0x28')](db[_0x51ba5e][_0x94bd('0x29')],function(_0x128fe8){return{'name':_0x128fe8[_0x94bd('0x2a')],'type':_0x128fe8[_0x94bd('0x2b')][_0x94bd('0x2c')]};});if(!_0x4d7dad[_0x94bd('0x11')]['fields']){var _0x26531e=['id','name'];if(_0x2625e5===_0x94bd('0x45')){_0x26531e[_0x94bd('0x30')](_0x94bd('0x2b'));if(_0x4d7dad['query']['type']===_0x94bd('0x4d')){_0x26531e[_0x94bd('0x30')]([_0x94bd('0x4e'),_0x94bd('0x4f')]);}}_0x4d7dad[_0x94bd('0x11')][_0x94bd('0x50')]=_0x26531e[_0x94bd('0x22')](',');}_0x520623=qs['getOptions'](_0x3f5e20,_0x4d7dad);if(_0x4d7dad['user']['role']===_0x94bd('0x39')){var _0x266524={'params':{'id':_0x4d7dad[_0x94bd('0x39')]['userProfileId']},'query':{'section':_0x2625e5===_0x94bd('0x45')&&_0x4d7dad[_0x94bd('0x11')][_0x94bd('0x2b')]==='outbound'?_0x94bd('0x51'):_['startCase'](_0x2625e5)+_0x94bd('0x52'),'type':_0x4d7dad['query'][_0x94bd('0x2b')],'nolimit':!![],'sort':_0x94bd('0x53'),'filter':_0x4d7dad[_0x94bd('0x11')][_0x94bd('0x54')]}};_0x266524[_0x94bd('0x11')]=Object['assign'](_0x266524[_0x94bd('0x11')],_0x4d7dad[_0x94bd('0x11')]);delete _0x266524[_0x94bd('0x11')]['id'];return db[_0x94bd('0x3e')][_0x94bd('0x3f')](_0x266524);}return db[_0x51ba5e][_0x94bd('0x41')](_0x520623);})[_0x94bd('0x18')](function(_0x5410e8){_0x599c50[_0x94bd('0xb')]=_0x5410e8['count'];_0x12fe5b=_0x5410e8[_0x94bd('0x24')];return rtq[_0x94bd('0x55')](_0x4d7dad,_0x2625e5);})[_0x94bd('0x18')](function(_0x2d8cf8){_0x55360f=_0x2d8cf8['rows'];return rtq[_0x94bd('0x56')](_0x12fe5b,_0x55360f,_0x2625e5,_0x4d7dad[_0x94bd('0x11')][_0x94bd('0x2b')]);})[_0x94bd('0x18')](function(_0x4e7020){_0x599c50[_0x94bd('0x24')]=_0x4e7020;return _0x599c50;})[_0x94bd('0x18')](respondWithFilteredResult(_0x903903,_0x520623))[_0x94bd('0x4a')](APIHandleError(_0x903903));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 0fe65b0..d3df2f5 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x16f2c0,_0x339497){var _0xab9ddf=function(_0x1781d5){while(--_0x1781d5){_0x16f2c0['push'](_0x16f2c0['shift']());}};_0xab9ddf(++_0x339497);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x46800d,_0x588500){_0x46800d=_0x46800d-0x0;var _0x3824cd=_0xcb91[_0x46800d];return _0x3824cd;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4fcc09,_0x534dda){var _0x28486a=function(_0x4790de){while(--_0x4790de){_0x4fcc09['push'](_0x4fcc09['shift']());}};_0x28486a(++_0x534dda);}(_0x70e0,0x17b));var _0x070e=function(_0x322f6e,_0xec561){_0x322f6e=_0x322f6e-0x0;var _0xc0a61c=_0x70e0[_0x322f6e];return _0xc0a61c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 67e9a9d..8c80d96 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 _0x2070=['DATE','INTEGER','STRING'];(function(_0x1a735a,_0x1839ee){var _0x532cb8=function(_0x8373b9){while(--_0x8373b9){_0x1a735a['push'](_0x1a735a['shift']());}};_0x532cb8(++_0x1839ee);}(_0x2070,0x1a2));var _0x0207=function(_0x268e12,_0x5cfc4c){_0x268e12=_0x268e12-0x0;var _0x36f201=_0x2070[_0x268e12];return _0x36f201;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x0207('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x0207('0x1')]},'scheduledat':{'type':Sequelize[_0x0207('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0207('0x2')]},'responsetime':{'type':Sequelize[_0x0207('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0207('0x1')]},'campaigntype':{'type':Sequelize[_0x0207('0x1')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5a4f=['STRING','sequelize','INTEGER','DATE'];(function(_0x36bf8e,_0xc065a2){var _0x567be4=function(_0xbb7002){while(--_0xbb7002){_0x36bf8e['push'](_0x36bf8e['shift']());}};_0x567be4(++_0xc065a2);}(_0x5a4f,0x10d));var _0xf5a4=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x5a4f[_0xc67528];return _0x38e26d;};'use strict';var Sequelize=require(_0xf5a4('0x0'));module['exports']={'state':{'type':Sequelize[_0xf5a4('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf5a4('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf5a4('0x2')]},'responsetime':{'type':Sequelize[_0xf5a4('0x2')]},'ringtime':{'type':Sequelize[_0xf5a4('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf5a4('0x3')]},'campaigntype':{'type':Sequelize[_0xf5a4('0x3')]},'membername':{'type':Sequelize[_0xf5a4('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index c9893b7..fbe43cc 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 _0x0bb4=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0bb4,0x109));var _0x40bb=function(_0x3a28bd,_0x931e88){_0x3a28bd=_0x3a28bd-0x0;var _0xd344db=_0x0bb4[_0x3a28bd];return _0xd344db;};'use strict';var _=require(_0x40bb('0x0'));var util=require('util');var logger=require(_0x40bb('0x1'))(_0x40bb('0x2'));var moment=require(_0x40bb('0x3'));var BPromise=require(_0x40bb('0x4'));var rp=require(_0x40bb('0x5'));var fs=require('fs');var path=require(_0x40bb('0x6'));var rimraf=require(_0x40bb('0x7'));var config=require('../../config/environment');var attributes=require(_0x40bb('0x8'));module[_0x40bb('0x9')]=function(_0x393b8c,_0xea4d25){return _0x393b8c[_0x40bb('0xa')](_0x40bb('0xb'),attributes,{'tableName':_0x40bb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60e8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview'];(function(_0x2dbe9a,_0x1c8e18){var _0x1da014=function(_0x1d721e){while(--_0x1d721e){_0x2dbe9a['push'](_0x2dbe9a['shift']());}};_0x1da014(++_0x1c8e18);}(_0x60e8,0x196));var _0x860e=function(_0xf5eeb2,_0x104886){_0xf5eeb2=_0xf5eeb2-0x0;var _0x58fd8e=_0x60e8[_0xf5eeb2];return _0x58fd8e;};'use strict';var _=require(_0x860e('0x0'));var util=require(_0x860e('0x1'));var logger=require(_0x860e('0x2'))(_0x860e('0x3'));var moment=require('moment');var BPromise=require(_0x860e('0x4'));var rp=require(_0x860e('0x5'));var fs=require('fs');var path=require(_0x860e('0x6'));var rimraf=require(_0x860e('0x7'));var config=require(_0x860e('0x8'));var attributes=require(_0x860e('0x9'));module[_0x860e('0xa')]=function(_0x33f57a,_0x211ab9){return _0x33f57a[_0x860e('0xb')](_0x860e('0xc'),attributes,{'tableName':_0x860e('0xd'),'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 f500ad9..fc1f080 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 _0x5d46=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../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','ReportAgentPreview','create','body','options','raw','then','lodash','util'];(function(_0x244c92,_0x7a8ecb){var _0x56066b=function(_0x5c1b82){while(--_0x5c1b82){_0x244c92['push'](_0x244c92['shift']());}};_0x56066b(++_0x7a8ecb);}(_0x5d46,0xf6));var _0x65d4=function(_0x48bb56,_0x244bec){_0x48bb56=_0x48bb56-0x0;var _0x243801=_0x5d46[_0x48bb56];return _0x243801;};'use strict';var _=require(_0x65d4('0x0'));var util=require(_0x65d4('0x1'));var moment=require(_0x65d4('0x2'));var BPromise=require(_0x65d4('0x3'));var rs=require(_0x65d4('0x4'));var fs=require('fs');var Redis=require(_0x65d4('0x5'));var db=require(_0x65d4('0x6'))['db'];var utils=require(_0x65d4('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x65d4('0x8'));var jayson=require(_0x65d4('0x9'));var client=jayson[_0x65d4('0xa')][_0x65d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e15b4,_0xa885e4,_0x17dcea){return new BPromise(function(_0x43e6bb,_0x4a847c){return client[_0x65d4('0xc')](_0x5e15b4,_0x17dcea)['then'](function(_0x2c3248){logger[_0x65d4('0xd')](_0x65d4('0xe'),_0xa885e4,_0x65d4('0xf'));logger[_0x65d4('0x10')](_0x65d4('0x11'),_0xa885e4,_0x65d4('0xf'),JSON[_0x65d4('0x12')](_0x2c3248));if(_0x2c3248[_0x65d4('0x13')]){if(_0x2c3248[_0x65d4('0x13')][_0x65d4('0x14')]===0x1f4){logger['error'](_0x65d4('0xe'),_0xa885e4,_0x2c3248[_0x65d4('0x13')][_0x65d4('0x15')]);return _0x4a847c(_0x2c3248[_0x65d4('0x13')][_0x65d4('0x15')]);}logger['error'](_0x65d4('0xe'),_0xa885e4,_0x2c3248['error'][_0x65d4('0x15')]);return _0x43e6bb(_0x2c3248[_0x65d4('0x13')][_0x65d4('0x15')]);}else{logger[_0x65d4('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0xa885e4,_0x65d4('0xf'));_0x43e6bb(_0x2c3248[_0x65d4('0x16')][_0x65d4('0x15')]);}})[_0x65d4('0x17')](function(_0x2570c4){logger[_0x65d4('0x13')](_0x65d4('0xe'),_0xa885e4,_0x2570c4);_0x4a847c(_0x2570c4);});});}exports[_0x65d4('0x18')]=function(_0x16d329){var _0x3cc389=this;return new Promise(function(_0x12bbd1,_0x48c513){return db[_0x65d4('0x19')][_0x65d4('0x1a')](_0x16d329[_0x65d4('0x1b')],{'raw':_0x16d329[_0x65d4('0x1c')]?_0x16d329[_0x65d4('0x1c')][_0x65d4('0x1d')]===undefined?!![]:![]:!![]})[_0x65d4('0x1e')](function(_0x247fb2){logger['info'](_0x65d4('0x18'),_0x16d329);logger[_0x65d4('0x10')]('CreateReportAgentPreview',_0x16d329,JSON[_0x65d4('0x12')](_0x247fb2));_0x12bbd1(_0x247fb2);})[_0x65d4('0x17')](function(_0x16443b){logger[_0x65d4('0x13')]('CreateReportAgentPreview',_0x16443b[_0x65d4('0x15')],_0x16d329);_0x48c513(_0x3cc389[_0x65d4('0x13')](0x1f4,_0x16443b[_0x65d4('0x15')]));});});}; \ No newline at end of file +var _0xa235=['util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xa235,0x13e));var _0x5a23=function(_0x1c101f,_0x52141d){_0x1c101f=_0x1c101f-0x0;var _0xe02ee4=_0xa235[_0x1c101f];return _0xe02ee4;};'use strict';var _=require(_0x5a23('0x0'));var util=require(_0x5a23('0x1'));var moment=require('moment');var BPromise=require(_0x5a23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a23('0x3'));var db=require(_0x5a23('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a23('0x5'))('rpc');var config=require(_0x5a23('0x6'));var jayson=require(_0x5a23('0x7'));var client=jayson[_0x5a23('0x8')][_0x5a23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x367ae7,_0x5380c5,_0x4fc761){return new BPromise(function(_0x42e524,_0x2b4b09){return client[_0x5a23('0xa')](_0x367ae7,_0x4fc761)[_0x5a23('0xb')](function(_0x4c9adc){logger[_0x5a23('0xc')](_0x5a23('0xd'),_0x5380c5,_0x5a23('0xe'));logger[_0x5a23('0xf')](_0x5a23('0x10'),_0x5380c5,_0x5a23('0xe'),JSON[_0x5a23('0x11')](_0x4c9adc));if(_0x4c9adc[_0x5a23('0x12')]){if(_0x4c9adc[_0x5a23('0x12')][_0x5a23('0x13')]===0x1f4){logger[_0x5a23('0x12')](_0x5a23('0xd'),_0x5380c5,_0x4c9adc[_0x5a23('0x12')][_0x5a23('0x14')]);return _0x2b4b09(_0x4c9adc['error'][_0x5a23('0x14')]);}logger[_0x5a23('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x5380c5,_0x4c9adc[_0x5a23('0x12')]['message']);return _0x42e524(_0x4c9adc[_0x5a23('0x12')][_0x5a23('0x14')]);}else{logger['info'](_0x5a23('0xd'),_0x5380c5,_0x5a23('0xe'));_0x42e524(_0x4c9adc[_0x5a23('0x15')][_0x5a23('0x14')]);}})[_0x5a23('0x16')](function(_0x6d6986){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x5380c5,_0x6d6986);_0x2b4b09(_0x6d6986);});});}exports[_0x5a23('0x17')]=function(_0x3a8746){var _0x22beeb=this;return new Promise(function(_0x29292d,_0x118cb1){return db[_0x5a23('0x18')][_0x5a23('0x19')](_0x3a8746[_0x5a23('0x1a')],{'raw':_0x3a8746['options']?_0x3a8746[_0x5a23('0x1b')][_0x5a23('0x1c')]===undefined?!![]:![]:!![]})[_0x5a23('0xb')](function(_0x1700fb){logger[_0x5a23('0xc')](_0x5a23('0x17'),_0x3a8746);logger[_0x5a23('0xf')](_0x5a23('0x17'),_0x3a8746,JSON['stringify'](_0x1700fb));_0x29292d(_0x1700fb);})[_0x5a23('0x16')](function(_0x54b05f){logger[_0x5a23('0x12')](_0x5a23('0x17'),_0x54b05f['message'],_0x3a8746);_0x118cb1(_0x22beeb[_0x5a23('0x12')](0x1f4,_0x54b05f[_0x5a23('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 423152d..3f8d5db 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 _0xd00b=['put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','util','path','express','../../components/auth/service','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','/mail/accounts','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues'];(function(_0xbc762b,_0x322e2c){var _0x5574d2=function(_0x3083bb){while(--_0x3083bb){_0xbc762b['push'](_0xbc762b['shift']());}};_0x5574d2(++_0x322e2c);}(_0xd00b,0xc0));var _0xbd00=function(_0x33b314,_0x2685b9){_0x33b314=_0x33b314-0x0;var _0x4e875b=_0xd00b[_0x33b314];return _0x4e875b;};'use strict';var multer=require('multer');var util=require(_0xbd00('0x0'));var path=require(_0xbd00('0x1'));var express=require(_0xbd00('0x2'));var router=express['Router']();var auth=require(_0xbd00('0x3'));var controller=require('./rpc.controller');router[_0xbd00('0x4')]('/voice/channels',auth[_0xbd00('0x5')](),controller[_0xbd00('0x6')]);router[_0xbd00('0x4')](_0xbd00('0x7'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x8')]);router[_0xbd00('0x4')](_0xbd00('0x9'),auth[_0xbd00('0x5')](),controller[_0xbd00('0xa')]);router['get'](_0xbd00('0xb'),auth['isAuthenticated'](),controller[_0xbd00('0xc')]);router[_0xbd00('0x4')]('/chat/queues',auth[_0xbd00('0x5')](),controller[_0xbd00('0xd')]);router[_0xbd00('0x4')](_0xbd00('0xe'),auth[_0xbd00('0x5')](),controller['mailQueues']);router[_0xbd00('0x4')](_0xbd00('0xf'),auth['isAuthenticated'](),controller['mailAccounts']);router['get']('/openchannel/queues',auth[_0xbd00('0x5')](),controller[_0xbd00('0x10')]);router[_0xbd00('0x4')]('/sms/queues',auth[_0xbd00('0x5')](),controller[_0xbd00('0x11')]);router[_0xbd00('0x4')](_0xbd00('0x12'),auth['isAuthenticated'](),controller[_0xbd00('0x13')]);router[_0xbd00('0x4')](_0xbd00('0x14'),auth['isAuthenticated'](),controller[_0xbd00('0x15')]);router[_0xbd00('0x4')]('/voice/queues/preview/:id',auth[_0xbd00('0x5')](),controller[_0xbd00('0x16')]);router[_0xbd00('0x4')](_0xbd00('0x17'),auth[_0xbd00('0x5')](),controller['voiceQueuesChannels']);router['get'](_0xbd00('0x18'),auth[_0xbd00('0x5')](),controller['voiceQueuesChannel']);router[_0xbd00('0x4')](_0xbd00('0x19'),auth[_0xbd00('0x5')](),controller['voiceQueuesChannelHangup']);router[_0xbd00('0x4')](_0xbd00('0x1a'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x1b')]);router[_0xbd00('0x4')](_0xbd00('0x1c'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x1d')]);router[_0xbd00('0x1e')](_0xbd00('0x1c'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x1f')]);router[_0xbd00('0x4')]('/outbound',auth[_0xbd00('0x5')](),controller[_0xbd00('0x20')]);router['get'](_0xbd00('0x21'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x22')]);router[_0xbd00('0x4')](_0xbd00('0x23'),auth['isAuthenticated'](),controller[_0xbd00('0x24')]);router[_0xbd00('0x1e')]('/agents/:id/capacity',auth[_0xbd00('0x5')](),controller[_0xbd00('0x25')]);router[_0xbd00('0x4')](_0xbd00('0x26'),auth['isAuthenticated'](),controller[_0xbd00('0x27')]);router['get']('/trunks',auth[_0xbd00('0x5')](),controller[_0xbd00('0x28')]);router[_0xbd00('0x4')](_0xbd00('0x29'),auth[_0xbd00('0x5')](),controller['campaigns']);router[_0xbd00('0x4')]('/fax/accounts',auth[_0xbd00('0x5')](),controller[_0xbd00('0x2a')]);router[_0xbd00('0x4')](_0xbd00('0x2b'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x2c')]);router[_0xbd00('0x4')](_0xbd00('0x2d'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x2e')]);router[_0xbd00('0x4')]('/openchannel/queues/waitinginteractions',auth[_0xbd00('0x5')](),controller[_0xbd00('0x2f')]);router[_0xbd00('0x4')](_0xbd00('0x30'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x31')]);router[_0xbd00('0x4')]('/sms/queues/waitinginteractions',auth[_0xbd00('0x5')](),controller[_0xbd00('0x32')]);router[_0xbd00('0x4')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xbd00('0x33')]);router[_0xbd00('0x4')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xbd00('0x34')]);router['post'](_0xbd00('0x35'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x36')](_0xbd00('0x37')));router[_0xbd00('0x4')](_0xbd00('0x38'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x39')]);router[_0xbd00('0x3a')](_0xbd00('0x3b'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x36')]('chat'));router[_0xbd00('0x4')]('/chat/queues/:id',auth[_0xbd00('0x5')](),controller[_0xbd00('0x3c')]);router[_0xbd00('0x3a')](_0xbd00('0x3d'),auth['isAuthenticated'](),controller[_0xbd00('0x36')]('fax'));router[_0xbd00('0x4')](_0xbd00('0x3e'),auth[_0xbd00('0x5')](),controller['showFaxQueues']);router[_0xbd00('0x3a')]('/openchannel/queues/:id/notify',auth[_0xbd00('0x5')](),controller[_0xbd00('0x36')](_0xbd00('0x3f')));router[_0xbd00('0x4')](_0xbd00('0x40'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x41')]);router[_0xbd00('0x3a')](_0xbd00('0x42'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x36')]('sms'));router[_0xbd00('0x3a')]('/whatsapp/queues/:id/notify',auth[_0xbd00('0x5')](),controller[_0xbd00('0x36')](_0xbd00('0x43')));router[_0xbd00('0x4')](_0xbd00('0x44'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x45')]);router[_0xbd00('0x4')](_0xbd00('0x46'),auth[_0xbd00('0x5')](),controller[_0xbd00('0x47')]);router[_0xbd00('0x3a')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0xbd00('0x48')]);module[_0xbd00('0x49')]=router; \ No newline at end of file +var _0x5ff9=['/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agentCapacity','/telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail'];(function(_0x181dc3,_0x427d8f){var _0x3141af=function(_0x555f86){while(--_0x555f86){_0x181dc3['push'](_0x181dc3['shift']());}};_0x3141af(++_0x427d8f);}(_0x5ff9,0xb4));var _0x95ff=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0x5ff9[_0x44dba1];return _0x2fbd3f;};'use strict';var multer=require('multer');var util=require(_0x95ff('0x0'));var path=require(_0x95ff('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x95ff('0x2'));var controller=require('./rpc.controller');router[_0x95ff('0x3')](_0x95ff('0x4'),auth[_0x95ff('0x5')](),controller['voiceChannels']);router[_0x95ff('0x3')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x95ff('0x5')](),controller[_0x95ff('0x6')]);router[_0x95ff('0x3')](_0x95ff('0x7'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0x95ff('0x3')](_0x95ff('0x8'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x9')]);router[_0x95ff('0x3')](_0x95ff('0xa'),auth[_0x95ff('0x5')](),controller['chatQueues']);router[_0x95ff('0x3')](_0x95ff('0xb'),auth[_0x95ff('0x5')](),controller[_0x95ff('0xc')]);router[_0x95ff('0x3')](_0x95ff('0xd'),auth[_0x95ff('0x5')](),controller['mailAccounts']);router[_0x95ff('0x3')]('/openchannel/queues',auth[_0x95ff('0x5')](),controller[_0x95ff('0xe')]);router['get'](_0x95ff('0xf'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x10')]);router[_0x95ff('0x3')](_0x95ff('0x11'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x12')]);router[_0x95ff('0x3')](_0x95ff('0x13'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x14')]);router[_0x95ff('0x3')](_0x95ff('0x15'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x16')]);router[_0x95ff('0x3')](_0x95ff('0x17'),auth['isAuthenticated'](),controller[_0x95ff('0x18')]);router[_0x95ff('0x3')](_0x95ff('0x19'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x1a')]);router[_0x95ff('0x3')](_0x95ff('0x1b'),auth['isAuthenticated'](),controller[_0x95ff('0x1c')]);router['get'](_0x95ff('0x1d'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x1e')]);router[_0x95ff('0x3')](_0x95ff('0x1f'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x20')]);router[_0x95ff('0x21')](_0x95ff('0x1f'),auth[_0x95ff('0x5')](),controller['updateVoiceQueue']);router[_0x95ff('0x3')](_0x95ff('0x22'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x23')]);router['get'](_0x95ff('0x24'),auth['isAuthenticated'](),controller[_0x95ff('0x25')]);router[_0x95ff('0x3')](_0x95ff('0x26'),auth[_0x95ff('0x5')](),controller['agents']);router['put']('/agents/:id/capacity',auth[_0x95ff('0x5')](),controller[_0x95ff('0x27')]);router['get'](_0x95ff('0x28'),auth[_0x95ff('0x5')](),controller['telephones']);router[_0x95ff('0x3')](_0x95ff('0x29'),auth['isAuthenticated'](),controller[_0x95ff('0x2a')]);router[_0x95ff('0x3')](_0x95ff('0x2b'),auth[_0x95ff('0x5')](),controller['campaigns']);router[_0x95ff('0x3')](_0x95ff('0x2c'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x2d')]);router['get']('/chat/queues/waitinginteractions',auth[_0x95ff('0x5')](),controller[_0x95ff('0x2e')]);router[_0x95ff('0x3')](_0x95ff('0x2f'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x30')]);router['get'](_0x95ff('0x31'),auth[_0x95ff('0x5')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x95ff('0x32'),auth['isAuthenticated'](),controller[_0x95ff('0x33')]);router[_0x95ff('0x3')](_0x95ff('0x34'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x35')]);router[_0x95ff('0x3')](_0x95ff('0x36'),auth[_0x95ff('0x5')](),controller['whatsappQueuesWaitingInteractions']);router[_0x95ff('0x3')](_0x95ff('0x37'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x38')]);router[_0x95ff('0x39')]('/mail/queues/:id/notify',auth[_0x95ff('0x5')](),controller[_0x95ff('0x3a')](_0x95ff('0x3b')));router[_0x95ff('0x3')](_0x95ff('0x3c'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x3d')]);router[_0x95ff('0x39')](_0x95ff('0x3e'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x3a')](_0x95ff('0x3f')));router[_0x95ff('0x3')](_0x95ff('0x40'),auth[_0x95ff('0x5')](),controller['showChatQueues']);router[_0x95ff('0x39')](_0x95ff('0x41'),auth[_0x95ff('0x5')](),controller['queueNotify']('fax'));router[_0x95ff('0x3')](_0x95ff('0x42'),auth[_0x95ff('0x5')](),controller['showFaxQueues']);router[_0x95ff('0x39')](_0x95ff('0x43'),auth[_0x95ff('0x5')](),controller['queueNotify'](_0x95ff('0x44')));router[_0x95ff('0x3')](_0x95ff('0x45'),auth[_0x95ff('0x5')](),controller['showOpenchannelQueues']);router[_0x95ff('0x39')](_0x95ff('0x46'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x3a')](_0x95ff('0x47')));router['post'](_0x95ff('0x48'),auth['isAuthenticated'](),controller[_0x95ff('0x3a')]('whatsapp'));router[_0x95ff('0x3')](_0x95ff('0x49'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x4a')]);router[_0x95ff('0x3')](_0x95ff('0x4b'),auth[_0x95ff('0x5')](),controller[_0x95ff('0x4c')]);router[_0x95ff('0x39')](_0x95ff('0x4d'),auth['isAuthenticated'](),controller[_0x95ff('0x4e')]);module[_0x95ff('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 6515a96..d8920e1 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 _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x520220,_0x748780){var _0x5c8459=function(_0x31c3dc){while(--_0x31c3dc){_0x520220['push'](_0x520220['shift']());}};_0x5c8459(++_0x748780);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x4d1714,_0x546222){var _0x3f3560=function(_0x5ba3ed){while(--_0x5ba3ed){_0x4d1714['push'](_0x4d1714['shift']());}};_0x3f3560(++_0x546222);}(_0xe706,0xa3));var _0x6e70=function(_0x480f72,_0xe80949){_0x480f72=_0x480f72-0x0;var _0x26578d=_0xe706[_0x480f72];return _0x26578d;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 01491a8..ae691d4 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 _0x743b=['update','destroy','exports','util','connect-timeout','express','../../components/auth/service','../../config/environment','./schedule.controller','isAuthenticated','get','/:id','show','run','post','create','put'];(function(_0x4567db,_0x13a6da){var _0x31aed4=function(_0x541ea9){while(--_0x541ea9){_0x4567db['push'](_0x4567db['shift']());}};_0x31aed4(++_0x13a6da);}(_0x743b,0x168));var _0xb743=function(_0x25bfba,_0x414330){_0x25bfba=_0x25bfba-0x0;var _0x1778f2=_0x743b[_0x25bfba];return _0x1778f2;};'use strict';var multer=require('multer');var util=require(_0xb743('0x0'));var path=require('path');var timeout=require(_0xb743('0x1'));var express=require(_0xb743('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb743('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb743('0x4'));var controller=require(_0xb743('0x5'));router['get']('/',auth[_0xb743('0x6')](),controller['index']);router[_0xb743('0x7')](_0xb743('0x8'),auth[_0xb743('0x6')](),controller[_0xb743('0x9')]);router[_0xb743('0x7')]('/:id/run',auth[_0xb743('0x6')](),controller[_0xb743('0xa')]);router[_0xb743('0xb')]('/',auth[_0xb743('0x6')](),controller[_0xb743('0xc')]);router[_0xb743('0xd')]('/:id',auth[_0xb743('0x6')](),controller[_0xb743('0xe')]);router['delete'](_0xb743('0x8'),auth[_0xb743('0x6')](),controller[_0xb743('0xf')]);module[_0xb743('0x10')]=router; \ No newline at end of file +var _0x81d5=['exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id','show','/:id/run','run','post','create','put','update','delete'];(function(_0x249d99,_0x16b584){var _0x5bfb05=function(_0x4f4d67){while(--_0x4f4d67){_0x249d99['push'](_0x249d99['shift']());}};_0x5bfb05(++_0x16b584);}(_0x81d5,0x1dc));var _0x581d=function(_0x1db700,_0xa227a){_0x1db700=_0x1db700-0x0;var _0x28c56c=_0x81d5[_0x1db700];return _0x28c56c;};'use strict';var multer=require(_0x581d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x581d('0x1'));var express=require(_0x581d('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x581d('0x3'));var interaction=require(_0x581d('0x4'));var config=require(_0x581d('0x5'));var controller=require(_0x581d('0x6'));router[_0x581d('0x7')]('/',auth[_0x581d('0x8')](),controller['index']);router[_0x581d('0x7')](_0x581d('0x9'),auth['isAuthenticated'](),controller[_0x581d('0xa')]);router['get'](_0x581d('0xb'),auth[_0x581d('0x8')](),controller[_0x581d('0xc')]);router[_0x581d('0xd')]('/',auth[_0x581d('0x8')](),controller[_0x581d('0xe')]);router[_0x581d('0xf')]('/:id',auth[_0x581d('0x8')](),controller[_0x581d('0x10')]);router[_0x581d('0x11')]('/:id',auth[_0x581d('0x8')](),controller['destroy']);module[_0x581d('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 1a03423..f2c56b8 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 _0x4aa8=['STRING','0\x200\x20*\x20*\x20*','INTEGER','ENUM','years','quarters','months','weeks','days','hours','pdf','xlsx','csv','TEXT','BOOLEAN','sequelize','exports'];(function(_0x2e3d63,_0xb43a9b){var _0x105946=function(_0x466785){while(--_0x466785){_0x2e3d63['push'](_0x2e3d63['shift']());}};_0x105946(++_0xb43a9b);}(_0x4aa8,0xfd));var _0x84aa=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x4aa8[_0x62c958];return _0x57ec61;};'use strict';var Sequelize=require(_0x84aa('0x0'));module[_0x84aa('0x1')]={'name':{'type':Sequelize[_0x84aa('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x84aa('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x84aa('0x2')],'allowNull':![],'defaultValue':_0x84aa('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x84aa('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x84aa('0x5')](_0x84aa('0x6'),_0x84aa('0x7'),_0x84aa('0x8'),_0x84aa('0x9'),_0x84aa('0xa'),_0x84aa('0xb'),'minutes'),'allowNull':![],'defaultValue':_0x84aa('0xa')},'output':{'type':Sequelize['ENUM']('csv',_0x84aa('0xc'),_0x84aa('0xd')),'allowNull':![],'defaultValue':_0x84aa('0xe')},'type':{'type':Sequelize[_0x84aa('0x5')]('custom','default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x84aa('0x2')]},'cc':{'type':Sequelize[_0x84aa('0xf')]},'bcc':{'type':Sequelize[_0x84aa('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x84aa('0x10')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0bca=['hours','minutes','csv','pdf','xlsx','ENUM','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','days'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0bca,0x117));var _0xa0bc=function(_0x327d6e,_0x5923bd){_0x327d6e=_0x327d6e-0x0;var _0x4dc5d3=_0x0bca[_0x327d6e];return _0x4dc5d3;};'use strict';var Sequelize=require(_0xa0bc('0x0'));module['exports']={'name':{'type':Sequelize[_0xa0bc('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xa0bc('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa0bc('0x1')],'allowNull':![],'defaultValue':_0xa0bc('0x3')},'startAt':{'type':Sequelize[_0xa0bc('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa0bc('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xa0bc('0x6'),_0xa0bc('0x7'),'months','weeks',_0xa0bc('0x8'),_0xa0bc('0x9'),_0xa0bc('0xa')),'allowNull':![],'defaultValue':_0xa0bc('0x8')},'output':{'type':Sequelize['ENUM'](_0xa0bc('0xb'),_0xa0bc('0xc'),_0xa0bc('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xa0bc('0xe')](_0xa0bc('0xf'),_0xa0bc('0x10')),'allowNull':![],'defaultValue':_0xa0bc('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xa0bc('0x1')]},'cc':{'type':Sequelize[_0xa0bc('0x11')]},'bcc':{'type':Sequelize[_0xa0bc('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xa0bc('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 4556cbb..ca479d5 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 _0xf16d=['set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','Schedule','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status'];(function(_0xc1af5b,_0x396ee0){var _0x2a5d00=function(_0x52db0f){while(--_0x52db0f){_0xc1af5b['push'](_0xc1af5b['shift']());}};_0x2a5d00(++_0x396ee0);}(_0xf16d,0x197));var _0xdf16=function(_0x3b8da2,_0xcbce7a){_0x3b8da2=_0x3b8da2-0x0;var _0x45f819=_0xf16d[_0x3b8da2];return _0x45f819;};'use strict';var emlformat=require(_0xdf16('0x0'));var rimraf=require(_0xdf16('0x1'));var zipdir=require(_0xdf16('0x2'));var jsonpatch=require(_0xdf16('0x3'));var rp=require('request-promise');var moment=require(_0xdf16('0x4'));var BPromise=require(_0xdf16('0x5'));var Mustache=require(_0xdf16('0x6'));var util=require('util');var path=require(_0xdf16('0x7'));var sox=require(_0xdf16('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf16('0x9'));var _=require('lodash');var squel=require(_0xdf16('0xa'));var crypto=require(_0xdf16('0xb'));var jsforce=require(_0xdf16('0xc'));var deskjs=require(_0xdf16('0xd'));var toCsv=require(_0xdf16('0xe'));var querystring=require(_0xdf16('0xf'));var Papa=require(_0xdf16('0x10'));var Redis=require(_0xdf16('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf16('0x12'));var as=require(_0xdf16('0x13'));var hardwareService=require(_0xdf16('0x14'));var logger=require(_0xdf16('0x15'))(_0xdf16('0x16'));var utils=require(_0xdf16('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdf16('0x18'))['db'];function respondWithStatusCode(_0x341655,_0x12f701){_0x12f701=_0x12f701||0xcc;return function(_0x1417d6){if(_0x1417d6){return _0x341655[_0xdf16('0x19')](_0x12f701);}return _0x341655['status'](_0x12f701)[_0xdf16('0x1a')]();};}function respondWithResult(_0x581614,_0x8ce6db){_0x8ce6db=_0x8ce6db||0xc8;return function(_0x4c6b99){if(_0x4c6b99){return _0x581614['status'](_0x8ce6db)[_0xdf16('0x1b')](_0x4c6b99);}};}function respondWithFilteredResult(_0x156582,_0x2cd521){return function(_0x19aeba){if(_0x19aeba){var _0x57f321=typeof _0x2cd521[_0xdf16('0x1c')]===_0xdf16('0x1d')&&typeof _0x2cd521[_0xdf16('0x1e')]===_0xdf16('0x1d');var _0x523c32=_0x19aeba['count'];var _0x38881c=_0x57f321?0x0:_0x2cd521[_0xdf16('0x1c')];var _0x558625=_0x57f321?_0x19aeba[_0xdf16('0x1f')]:_0x2cd521['offset']+_0x2cd521['limit'];var _0x14da4e;if(_0x558625>=_0x523c32){_0x558625=_0x523c32;_0x14da4e=0xc8;}else{_0x14da4e=0xce;}_0x156582[_0xdf16('0x20')](_0x14da4e);return _0x156582[_0xdf16('0x21')](_0xdf16('0x22'),_0x38881c+'-'+_0x558625+'/'+_0x523c32)['json'](_0x19aeba);}return null;};}function patchUpdates(_0x209d74){return function(_0x20f112){try{jsonpatch[_0xdf16('0x23')](_0x20f112,_0x209d74,!![]);}catch(_0x2997a3){return BPromise[_0xdf16('0x24')](_0x2997a3);}return _0x20f112[_0xdf16('0x25')]();};}function saveUpdates(_0x449420,_0xaf4179){return function(_0x1f5cb2){if(_0x1f5cb2){return _0x1f5cb2[_0xdf16('0x26')](_0x449420)[_0xdf16('0x27')](function(_0x1d3f65){return _0x1d3f65;});}return null;};}function removeEntity(_0x5f1628,_0x230968){return function(_0x3825a4){if(_0x3825a4){return _0x3825a4[_0xdf16('0x28')]()['then'](function(){var _0x4652d1=_0x3825a4[_0xdf16('0x29')]({'plain':!![]});var _0x17bcee=_0xdf16('0x2a');return db[_0xdf16('0x2b')][_0xdf16('0x28')]({'where':{'type':_0x17bcee,'resourceId':_0x4652d1['id']}})['then'](function(){return _0x3825a4;});})[_0xdf16('0x27')](function(){_0x5f1628[_0xdf16('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c0393,_0x2fb15f){return function(_0x35f98b){if(!_0x35f98b){_0x1c0393[_0xdf16('0x19')](0x194);}return _0x35f98b;};}function handleError(_0x1e7418,_0x3161f0){_0x3161f0=_0x3161f0||0x1f4;return function(_0xabd65d){logger[_0xdf16('0x2c')](_0xabd65d[_0xdf16('0x2d')]);if(_0xabd65d['name']){delete _0xabd65d[_0xdf16('0x2e')];}_0x1e7418[_0xdf16('0x20')](_0x3161f0)[_0xdf16('0x2f')](_0xabd65d);};}exports['index']=function(_0x1e978a,_0x842441){var _0x277292={},_0x413f2b={},_0x1bec8d={'count':0x0,'rows':[]};var _0x169c98=_['map'](db[_0xdf16('0x30')][_0xdf16('0x31')],function(_0x2f6edf){return{'name':_0x2f6edf[_0xdf16('0x32')],'type':_0x2f6edf['type'][_0xdf16('0x33')]};});_0x413f2b[_0xdf16('0x34')]=_[_0xdf16('0x35')](_0x169c98,_0xdf16('0x2e'));_0x413f2b[_0xdf16('0x36')]=_[_0xdf16('0x37')](_0x1e978a['query']);_0x413f2b[_0xdf16('0x38')]=_[_0xdf16('0x39')](_0x413f2b[_0xdf16('0x34')],_0x413f2b['query']);_0x277292[_0xdf16('0x3a')]=_[_0xdf16('0x39')](_0x413f2b[_0xdf16('0x34')],qs[_0xdf16('0x3b')](_0x1e978a['query'][_0xdf16('0x3b')]));_0x277292[_0xdf16('0x3a')]=_0x277292[_0xdf16('0x3a')][_0xdf16('0x3c')]?_0x277292['attributes']:_0x413f2b[_0xdf16('0x34')];if(!_0x1e978a['query'][_0xdf16('0x3d')](_0xdf16('0x3e'))){_0x277292[_0xdf16('0x1e')]=qs['limit'](_0x1e978a[_0xdf16('0x36')][_0xdf16('0x1e')]);_0x277292[_0xdf16('0x1c')]=qs['offset'](_0x1e978a[_0xdf16('0x36')][_0xdf16('0x1c')]);}_0x277292['order']=qs[_0xdf16('0x3f')](_0x1e978a[_0xdf16('0x36')][_0xdf16('0x3f')]);_0x277292[_0xdf16('0x40')]=qs[_0xdf16('0x38')](_['pick'](_0x1e978a[_0xdf16('0x36')],_0x413f2b['filters']),_0x169c98);if(_0x1e978a[_0xdf16('0x36')][_0xdf16('0x41')]){_0x277292[_0xdf16('0x40')]=_[_0xdf16('0x42')](_0x277292[_0xdf16('0x40')],{'$or':_['map'](_0x169c98,function(_0x2bb5ff){if(_0x2bb5ff[_0xdf16('0x43')]!==_0xdf16('0x44')){var _0x3a251d={};_0x3a251d[_0x2bb5ff[_0xdf16('0x2e')]]={'$like':'%'+_0x1e978a[_0xdf16('0x36')]['filter']+'%'};return _0x3a251d;}})});}_0x277292=_[_0xdf16('0x42')]({},_0x277292,_0x1e978a[_0xdf16('0x45')]);var _0x2b7e6f={'where':_0x277292[_0xdf16('0x40')]};return db[_0xdf16('0x30')][_0xdf16('0x1f')](_0x2b7e6f)[_0xdf16('0x27')](function(_0x551127){_0x1bec8d[_0xdf16('0x1f')]=_0x551127;if(_0x1e978a[_0xdf16('0x36')][_0xdf16('0x46')]){_0x277292['include']=[{'all':!![]}];}return db[_0xdf16('0x30')][_0xdf16('0x47')](_0x277292);})[_0xdf16('0x27')](function(_0x55666c){_0x1bec8d[_0xdf16('0x48')]=_0x55666c;return _0x1bec8d;})[_0xdf16('0x27')](respondWithFilteredResult(_0x842441,_0x277292))['catch'](handleError(_0x842441,null));};exports[_0xdf16('0x49')]=function(_0x4215eb,_0x4896dd){var _0x324176={'raw':![],'where':{'id':_0x4215eb[_0xdf16('0x4a')]['id']}},_0x407453={};_0x407453[_0xdf16('0x34')]=_[_0xdf16('0x37')](db[_0xdf16('0x30')][_0xdf16('0x31')]);_0x407453[_0xdf16('0x36')]=_['keys'](_0x4215eb[_0xdf16('0x36')]);_0x407453[_0xdf16('0x38')]=_[_0xdf16('0x39')](_0x407453[_0xdf16('0x34')],_0x407453[_0xdf16('0x36')]);_0x324176[_0xdf16('0x3a')]=_[_0xdf16('0x39')](_0x407453[_0xdf16('0x34')],qs['fields'](_0x4215eb['query'][_0xdf16('0x3b')]));_0x324176[_0xdf16('0x3a')]=_0x324176[_0xdf16('0x3a')][_0xdf16('0x3c')]?_0x324176[_0xdf16('0x3a')]:_0x407453['model'];if(_0x4215eb[_0xdf16('0x36')][_0xdf16('0x46')]){_0x324176[_0xdf16('0x4b')]=[{'all':!![]}];}_0x324176=_['merge']({},_0x324176,_0x4215eb[_0xdf16('0x45')]);return db[_0xdf16('0x30')][_0xdf16('0x4c')](_0x324176)[_0xdf16('0x27')](handleEntityNotFound(_0x4896dd,null))[_0xdf16('0x27')](respondWithResult(_0x4896dd,null))['catch'](handleError(_0x4896dd,null));};exports[_0xdf16('0x4d')]=function(_0x37275f,_0x195b3c){return db[_0xdf16('0x30')][_0xdf16('0x4d')](_0x37275f[_0xdf16('0x4e')],{})[_0xdf16('0x27')](function(_0x1b2425){var _0x180685=_0x37275f[_0xdf16('0x4f')][_0xdf16('0x29')]({'plain':!![]});if(!_0x180685)throw new Error(_0xdf16('0x50'));if(_0x180685[_0xdf16('0x51')]===_0xdf16('0x4f')){var _0x4abcee=_0x1b2425[_0xdf16('0x29')]({'plain':!![]});var _0x49f8ff=_0xdf16('0x2a');return db[_0xdf16('0x52')]['find']({'where':{'name':_0x49f8ff,'userProfileId':_0x180685['userProfileId']},'raw':!![]})['then'](function(_0x1344f3){if(_0x1344f3&&_0x1344f3[_0xdf16('0x53')]===0x0){return db['UserProfileResource'][_0xdf16('0x4d')]({'name':_0x4abcee[_0xdf16('0x2e')],'resourceId':_0x4abcee['id'],'type':_0x1344f3['name'],'sectionId':_0x1344f3['id']},{})[_0xdf16('0x27')](function(){return _0x1b2425;});}else{return _0x1b2425;}})['catch'](function(_0x3de511){logger[_0xdf16('0x2c')](_0xdf16('0x54'),_0x3de511);throw _0x3de511;});}return _0x1b2425;})[_0xdf16('0x27')](respondWithResult(_0x195b3c,0xc9))[_0xdf16('0x55')](handleError(_0x195b3c,null));};exports[_0xdf16('0x26')]=function(_0x1e41a5,_0x4e45fd){if(_0x1e41a5['body']['id']){delete _0x1e41a5[_0xdf16('0x4e')]['id'];}return db[_0xdf16('0x30')][_0xdf16('0x4c')]({'where':{'id':_0x1e41a5[_0xdf16('0x4a')]['id']}})[_0xdf16('0x27')](handleEntityNotFound(_0x4e45fd,null))[_0xdf16('0x27')](saveUpdates(_0x1e41a5[_0xdf16('0x4e')],null))[_0xdf16('0x27')](respondWithResult(_0x4e45fd,null))['catch'](handleError(_0x4e45fd,null));};exports[_0xdf16('0x28')]=function(_0x1ab4bf,_0x1ae705){return db['Schedule']['find']({'where':{'id':_0x1ab4bf[_0xdf16('0x4a')]['id']}})[_0xdf16('0x27')](handleEntityNotFound(_0x1ae705,null))[_0xdf16('0x27')](removeEntity(_0x1ae705,null))['catch'](handleError(_0x1ae705,null));};exports[_0xdf16('0x56')]=function(_0x41a415,_0x78582c,_0x3d6701){var _0x334a6e=require(_0xdf16('0x57'));return db[_0xdf16('0x30')]['find']({'where':{'id':_0x41a415['params']['id']},'raw':!![]})[_0xdf16('0x27')](handleEntityNotFound(_0x78582c,null))['then'](function(){_0x334a6e['run'](_0x41a415[_0xdf16('0x4a')]['id']);})[_0xdf16('0x27')](respondWithStatusCode(_0x78582c,null))[_0xdf16('0x55')](handleError(_0x78582c,null));}; \ No newline at end of file +var _0x9ac8=['run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','name','index','map','Schedule','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Scheduler','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ac8,0xab));var _0x89ac=function(_0xaa0719,_0xe2c8ba){_0xaa0719=_0xaa0719-0x0;var _0xc253a4=_0x9ac8[_0xaa0719];return _0xc253a4;};'use strict';var emlformat=require(_0x89ac('0x0'));var rimraf=require(_0x89ac('0x1'));var zipdir=require(_0x89ac('0x2'));var jsonpatch=require(_0x89ac('0x3'));var rp=require(_0x89ac('0x4'));var moment=require(_0x89ac('0x5'));var BPromise=require(_0x89ac('0x6'));var Mustache=require(_0x89ac('0x7'));var util=require(_0x89ac('0x8'));var path=require('path');var sox=require(_0x89ac('0x9'));var csv=require(_0x89ac('0xa'));var ejs=require(_0x89ac('0xb'));var fs=require('fs');var fs_extra=require(_0x89ac('0xc'));var _=require(_0x89ac('0xd'));var squel=require(_0x89ac('0xe'));var crypto=require(_0x89ac('0xf'));var jsforce=require(_0x89ac('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x89ac('0xa'));var querystring=require(_0x89ac('0x11'));var Papa=require('papaparse');var Redis=require(_0x89ac('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x89ac('0x13'));var as=require(_0x89ac('0x14'));var hardwareService=require(_0x89ac('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x89ac('0x16'));var licenseUtil=require(_0x89ac('0x17'));var db=require(_0x89ac('0x18'))['db'];function respondWithStatusCode(_0x1a72a1,_0x541f5e){_0x541f5e=_0x541f5e||0xcc;return function(_0x31dcfb){if(_0x31dcfb){return _0x1a72a1[_0x89ac('0x19')](_0x541f5e);}return _0x1a72a1[_0x89ac('0x1a')](_0x541f5e)['end']();};}function respondWithResult(_0x361ad0,_0x187c67){_0x187c67=_0x187c67||0xc8;return function(_0x4eabcc){if(_0x4eabcc){return _0x361ad0[_0x89ac('0x1a')](_0x187c67)['json'](_0x4eabcc);}};}function respondWithFilteredResult(_0x2b2f81,_0x2a1c01){return function(_0x32c923){if(_0x32c923){var _0x41742b=typeof _0x2a1c01['offset']===_0x89ac('0x1b')&&typeof _0x2a1c01['limit']===_0x89ac('0x1b');var _0x58abc2=_0x32c923[_0x89ac('0x1c')];var _0x4aac53=_0x41742b?0x0:_0x2a1c01['offset'];var _0x45303a=_0x41742b?_0x32c923['count']:_0x2a1c01[_0x89ac('0x1d')]+_0x2a1c01[_0x89ac('0x1e')];var _0x15f769;if(_0x45303a>=_0x58abc2){_0x45303a=_0x58abc2;_0x15f769=0xc8;}else{_0x15f769=0xce;}_0x2b2f81[_0x89ac('0x1a')](_0x15f769);return _0x2b2f81[_0x89ac('0x1f')](_0x89ac('0x20'),_0x4aac53+'-'+_0x45303a+'/'+_0x58abc2)[_0x89ac('0x21')](_0x32c923);}return null;};}function patchUpdates(_0x5a6450){return function(_0x18ab4a){try{jsonpatch[_0x89ac('0x22')](_0x18ab4a,_0x5a6450,!![]);}catch(_0x5c5c8c){return BPromise[_0x89ac('0x23')](_0x5c5c8c);}return _0x18ab4a[_0x89ac('0x24')]();};}function saveUpdates(_0x1eb708,_0x28f338){return function(_0x165705){if(_0x165705){return _0x165705['update'](_0x1eb708)[_0x89ac('0x25')](function(_0x49cb1c){return _0x49cb1c;});}return null;};}function removeEntity(_0x644135,_0x845082){return function(_0x1aca4b){if(_0x1aca4b){return _0x1aca4b[_0x89ac('0x26')]()[_0x89ac('0x25')](function(){var _0x264b06=_0x1aca4b['get']({'plain':!![]});var _0x247a3d='Scheduler';return db['UserProfileResource']['destroy']({'where':{'type':_0x247a3d,'resourceId':_0x264b06['id']}})[_0x89ac('0x25')](function(){return _0x1aca4b;});})[_0x89ac('0x25')](function(){_0x644135['status'](0xcc)[_0x89ac('0x27')]();});}};}function handleEntityNotFound(_0x5ba625,_0x2bfe6b){return function(_0x5c83bd){if(!_0x5c83bd){_0x5ba625[_0x89ac('0x19')](0x194);}return _0x5c83bd;};}function handleError(_0x116377,_0x38908e){_0x38908e=_0x38908e||0x1f4;return function(_0x460f80){logger[_0x89ac('0x28')](_0x460f80['stack']);if(_0x460f80['name']){delete _0x460f80[_0x89ac('0x29')];}_0x116377[_0x89ac('0x1a')](_0x38908e)['send'](_0x460f80);};}exports[_0x89ac('0x2a')]=function(_0x41c495,_0x498653){var _0x263ef9={},_0x321039={},_0x1a58c8={'count':0x0,'rows':[]};var _0x2c9087=_[_0x89ac('0x2b')](db[_0x89ac('0x2c')]['rawAttributes'],function(_0x4721fb){return{'name':_0x4721fb[_0x89ac('0x2d')],'type':_0x4721fb[_0x89ac('0x2e')][_0x89ac('0x2f')]};});_0x321039[_0x89ac('0x30')]=_[_0x89ac('0x2b')](_0x2c9087,'name');_0x321039[_0x89ac('0x31')]=_[_0x89ac('0x32')](_0x41c495[_0x89ac('0x31')]);_0x321039[_0x89ac('0x33')]=_[_0x89ac('0x34')](_0x321039[_0x89ac('0x30')],_0x321039[_0x89ac('0x31')]);_0x263ef9[_0x89ac('0x35')]=_['intersection'](_0x321039[_0x89ac('0x30')],qs[_0x89ac('0x36')](_0x41c495[_0x89ac('0x31')]['fields']));_0x263ef9[_0x89ac('0x35')]=_0x263ef9[_0x89ac('0x35')][_0x89ac('0x37')]?_0x263ef9[_0x89ac('0x35')]:_0x321039[_0x89ac('0x30')];if(!_0x41c495[_0x89ac('0x31')][_0x89ac('0x38')](_0x89ac('0x39'))){_0x263ef9['limit']=qs[_0x89ac('0x1e')](_0x41c495[_0x89ac('0x31')][_0x89ac('0x1e')]);_0x263ef9[_0x89ac('0x1d')]=qs[_0x89ac('0x1d')](_0x41c495[_0x89ac('0x31')]['offset']);}_0x263ef9[_0x89ac('0x3a')]=qs['sort'](_0x41c495[_0x89ac('0x31')][_0x89ac('0x3b')]);_0x263ef9['where']=qs[_0x89ac('0x33')](_[_0x89ac('0x3c')](_0x41c495[_0x89ac('0x31')],_0x321039['filters']),_0x2c9087);if(_0x41c495[_0x89ac('0x31')][_0x89ac('0x3d')]){_0x263ef9['where']=_[_0x89ac('0x3e')](_0x263ef9[_0x89ac('0x3f')],{'$or':_['map'](_0x2c9087,function(_0xa4dde0){if(_0xa4dde0['type']!==_0x89ac('0x40')){var _0x58b063={};_0x58b063[_0xa4dde0[_0x89ac('0x29')]]={'$like':'%'+_0x41c495[_0x89ac('0x31')][_0x89ac('0x3d')]+'%'};return _0x58b063;}})});}_0x263ef9=_[_0x89ac('0x3e')]({},_0x263ef9,_0x41c495[_0x89ac('0x41')]);var _0x4cbf83={'where':_0x263ef9['where']};return db[_0x89ac('0x2c')][_0x89ac('0x1c')](_0x4cbf83)[_0x89ac('0x25')](function(_0x59d00f){_0x1a58c8[_0x89ac('0x1c')]=_0x59d00f;if(_0x41c495[_0x89ac('0x31')][_0x89ac('0x42')]){_0x263ef9[_0x89ac('0x43')]=[{'all':!![]}];}return db[_0x89ac('0x2c')]['findAll'](_0x263ef9);})[_0x89ac('0x25')](function(_0x3db4c5){_0x1a58c8['rows']=_0x3db4c5;return _0x1a58c8;})[_0x89ac('0x25')](respondWithFilteredResult(_0x498653,_0x263ef9))[_0x89ac('0x44')](handleError(_0x498653,null));};exports['show']=function(_0x17fd04,_0x555cb9){var _0x3c3941={'raw':![],'where':{'id':_0x17fd04[_0x89ac('0x45')]['id']}},_0x34a8fe={};_0x34a8fe[_0x89ac('0x30')]=_[_0x89ac('0x32')](db[_0x89ac('0x2c')][_0x89ac('0x46')]);_0x34a8fe[_0x89ac('0x31')]=_[_0x89ac('0x32')](_0x17fd04['query']);_0x34a8fe[_0x89ac('0x33')]=_[_0x89ac('0x34')](_0x34a8fe['model'],_0x34a8fe['query']);_0x3c3941[_0x89ac('0x35')]=_['intersection'](_0x34a8fe[_0x89ac('0x30')],qs[_0x89ac('0x36')](_0x17fd04[_0x89ac('0x31')][_0x89ac('0x36')]));_0x3c3941[_0x89ac('0x35')]=_0x3c3941[_0x89ac('0x35')][_0x89ac('0x37')]?_0x3c3941[_0x89ac('0x35')]:_0x34a8fe['model'];if(_0x17fd04[_0x89ac('0x31')][_0x89ac('0x42')]){_0x3c3941[_0x89ac('0x43')]=[{'all':!![]}];}_0x3c3941=_['merge']({},_0x3c3941,_0x17fd04[_0x89ac('0x41')]);return db[_0x89ac('0x2c')][_0x89ac('0x47')](_0x3c3941)[_0x89ac('0x25')](handleEntityNotFound(_0x555cb9,null))[_0x89ac('0x25')](respondWithResult(_0x555cb9,null))[_0x89ac('0x44')](handleError(_0x555cb9,null));};exports[_0x89ac('0x48')]=function(_0x33b1db,_0xe2b51c){return db[_0x89ac('0x2c')]['create'](_0x33b1db[_0x89ac('0x49')],{})[_0x89ac('0x25')](function(_0x4d0261){var _0x266198=_0x33b1db[_0x89ac('0x4a')]['get']({'plain':!![]});if(!_0x266198)throw new Error(_0x89ac('0x4b'));if(_0x266198[_0x89ac('0x4c')]==='user'){var _0x105d71=_0x4d0261[_0x89ac('0x4d')]({'plain':!![]});var _0x47908b=_0x89ac('0x4e');return db[_0x89ac('0x4f')][_0x89ac('0x47')]({'where':{'name':_0x47908b,'userProfileId':_0x266198[_0x89ac('0x50')]},'raw':!![]})[_0x89ac('0x25')](function(_0x546f4f){if(_0x546f4f&&_0x546f4f[_0x89ac('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x105d71[_0x89ac('0x29')],'resourceId':_0x105d71['id'],'type':_0x546f4f[_0x89ac('0x29')],'sectionId':_0x546f4f['id']},{})[_0x89ac('0x25')](function(){return _0x4d0261;});}else{return _0x4d0261;}})[_0x89ac('0x44')](function(_0xe07837){logger[_0x89ac('0x28')](_0x89ac('0x52'),_0xe07837);throw _0xe07837;});}return _0x4d0261;})[_0x89ac('0x25')](respondWithResult(_0xe2b51c,0xc9))[_0x89ac('0x44')](handleError(_0xe2b51c,null));};exports[_0x89ac('0x53')]=function(_0x306358,_0x19ee8b){if(_0x306358[_0x89ac('0x49')]['id']){delete _0x306358[_0x89ac('0x49')]['id'];}return db[_0x89ac('0x2c')][_0x89ac('0x47')]({'where':{'id':_0x306358[_0x89ac('0x45')]['id']}})[_0x89ac('0x25')](handleEntityNotFound(_0x19ee8b,null))[_0x89ac('0x25')](saveUpdates(_0x306358[_0x89ac('0x49')],null))[_0x89ac('0x25')](respondWithResult(_0x19ee8b,null))[_0x89ac('0x44')](handleError(_0x19ee8b,null));};exports[_0x89ac('0x26')]=function(_0x33b989,_0x5f0301){return db[_0x89ac('0x2c')][_0x89ac('0x47')]({'where':{'id':_0x33b989[_0x89ac('0x45')]['id']}})[_0x89ac('0x25')](handleEntityNotFound(_0x5f0301,null))[_0x89ac('0x25')](removeEntity(_0x5f0301,null))[_0x89ac('0x44')](handleError(_0x5f0301,null));};exports[_0x89ac('0x54')]=function(_0x339754,_0x2e16b1,_0xf7c51d){var _0x4c5209=require('../../config/schedule');return db[_0x89ac('0x2c')][_0x89ac('0x47')]({'where':{'id':_0x339754['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2e16b1,null))[_0x89ac('0x25')](function(){_0x4c5209[_0x89ac('0x54')](_0x339754[_0x89ac('0x45')]['id']);})[_0x89ac('0x25')](respondWithStatusCode(_0x2e16b1,null))[_0x89ac('0x44')](handleError(_0x2e16b1,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c3c9ad8..befd68d 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 _0xb267=['../../config/environment','exports','define','Schedule','tools_schedules','lodash','api','request-promise','path','rimraf'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0xb267,0x131));var _0x7b26=function(_0x1b96f1,_0x1dbda4){_0x1b96f1=_0x1b96f1-0x0;var _0x41dcb4=_0xb267[_0x1b96f1];return _0x41dcb4;};'use strict';var _=require(_0x7b26('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7b26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7b26('0x2'));var fs=require('fs');var path=require(_0x7b26('0x3'));var rimraf=require(_0x7b26('0x4'));var config=require(_0x7b26('0x5'));var attributes=require('./schedule.attributes');module[_0x7b26('0x6')]=function(_0x4c7733,_0x3ad6a8){return _0x4c7733[_0x7b26('0x7')](_0x7b26('0x8'),attributes,{'tableName':_0x7b26('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4d1=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','Schedule','tools_schedules','lodash','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb4d1,0x18a));var _0x1b4d=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xb4d1[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x1b4d('0x0'));var util=require(_0x1b4d('0x1'));var logger=require(_0x1b4d('0x2'))(_0x1b4d('0x3'));var moment=require(_0x1b4d('0x4'));var BPromise=require(_0x1b4d('0x5'));var rp=require(_0x1b4d('0x6'));var fs=require('fs');var path=require(_0x1b4d('0x7'));var rimraf=require('rimraf');var config=require(_0x1b4d('0x8'));var attributes=require('./schedule.attributes');module[_0x1b4d('0x9')]=function(_0x14be25,_0x1f7552){return _0x14be25['define'](_0x1b4d('0xa'),attributes,{'tableName':_0x1b4d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 1b78c11..ac37fcc 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 _0x0af9=['../../config/environment','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0af9,0x152));var _0x90af=function(_0x5cf7b4,_0x1b924b){_0x5cf7b4=_0x5cf7b4-0x0;var _0x4de774=_0x0af9[_0x5cf7b4];return _0x4de774;};'use strict';var _=require(_0x90af('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x90af('0x1'));var rs=require(_0x90af('0x2'));var fs=require('fs');var Redis=require(_0x90af('0x3'));var db=require(_0x90af('0x4'))['db'];var utils=require(_0x90af('0x5'));var logger=require('../../config/logger')(_0x90af('0x6'));var config=require(_0x90af('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x90af('0x8')][_0x90af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbabdc0,_0x17adfc,_0x1f3f73){return new BPromise(function(_0x13ae85,_0x4552ff){return client[_0x90af('0xa')](_0xbabdc0,_0x1f3f73)[_0x90af('0xb')](function(_0x281eee){logger[_0x90af('0xc')]('Schedule,\x20%s,\x20%s',_0x17adfc,_0x90af('0xd'));logger[_0x90af('0xe')](_0x90af('0xf'),_0x17adfc,_0x90af('0xd'),JSON[_0x90af('0x10')](_0x281eee));if(_0x281eee[_0x90af('0x11')]){if(_0x281eee[_0x90af('0x11')][_0x90af('0x12')]===0x1f4){logger[_0x90af('0x11')](_0x90af('0x13'),_0x17adfc,_0x281eee[_0x90af('0x11')][_0x90af('0x14')]);return _0x4552ff(_0x281eee[_0x90af('0x11')][_0x90af('0x14')]);}logger[_0x90af('0x11')](_0x90af('0x13'),_0x17adfc,_0x281eee[_0x90af('0x11')]['message']);return _0x13ae85(_0x281eee[_0x90af('0x11')][_0x90af('0x14')]);}else{logger['info'](_0x90af('0x13'),_0x17adfc,_0x90af('0xd'));_0x13ae85(_0x281eee[_0x90af('0x15')]['message']);}})[_0x90af('0x16')](function(_0x3b61ce){logger[_0x90af('0x11')]('Schedule,\x20%s,\x20%s',_0x17adfc,_0x3b61ce);_0x4552ff(_0x3b61ce);});});} \ No newline at end of file +var _0xa9dc=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','Schedule,\x20%s,\x20%s','result','catch','util','ioredis','../../mysqldb'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9dc,0x1b2));var _0xca9d=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0xa9dc[_0x43aee5];return _0x76d1d0;};'use strict';var _=require('lodash');var util=require(_0xca9d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca9d('0x1'));var db=require(_0xca9d('0x2'))['db'];var utils=require(_0xca9d('0x3'));var logger=require(_0xca9d('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xca9d('0x5'));var client=jayson[_0xca9d('0x6')][_0xca9d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x47d399,_0x3250d8,_0x272c80){return new BPromise(function(_0x35da80,_0x558a11){return client[_0xca9d('0x8')](_0x47d399,_0x272c80)[_0xca9d('0x9')](function(_0x508361){logger[_0xca9d('0xa')]('Schedule,\x20%s,\x20%s',_0x3250d8,_0xca9d('0xb'));logger['debug'](_0xca9d('0xc'),_0x3250d8,_0xca9d('0xb'),JSON[_0xca9d('0xd')](_0x508361));if(_0x508361[_0xca9d('0xe')]){if(_0x508361[_0xca9d('0xe')]['code']===0x1f4){logger[_0xca9d('0xe')]('Schedule,\x20%s,\x20%s',_0x3250d8,_0x508361[_0xca9d('0xe')][_0xca9d('0xf')]);return _0x558a11(_0x508361[_0xca9d('0xe')][_0xca9d('0xf')]);}logger[_0xca9d('0xe')]('Schedule,\x20%s,\x20%s',_0x3250d8,_0x508361[_0xca9d('0xe')]['message']);return _0x35da80(_0x508361[_0xca9d('0xe')]['message']);}else{logger[_0xca9d('0xa')](_0xca9d('0x10'),_0x3250d8,_0xca9d('0xb'));_0x35da80(_0x508361[_0xca9d('0x11')]['message']);}})[_0xca9d('0x12')](function(_0x57fc1d){logger[_0xca9d('0xe')](_0xca9d('0x10'),_0x3250d8,_0x57fc1d);_0x558a11(_0x57fc1d);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c919133..f286dbd 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 _0x6af4=['fs-extra','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6af4,0xd9));var _0x46af=function(_0x2db617,_0x58c620){_0x2db617=_0x2db617-0x0;var _0x3264f0=_0x6af4[_0x2db617];return _0x3264f0;};'use strict';var multer=require(_0x46af('0x0'));var util=require('util');var path=require(_0x46af('0x1'));var timeout=require(_0x46af('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x46af('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x46af('0x4'));var config=require('../../config/environment');var controller=require(_0x46af('0x5'));router[_0x46af('0x6')]('/',auth[_0x46af('0x7')](),controller['index']);router['get'](_0x46af('0x8'),auth[_0x46af('0x7')](),controller[_0x46af('0x9')]);router[_0x46af('0x6')](_0x46af('0xa'),auth[_0x46af('0x7')](),controller[_0x46af('0xb')]);router[_0x46af('0x6')](_0x46af('0xc'),auth[_0x46af('0x7')](),controller[_0x46af('0xd')]);router[_0x46af('0xe')]('/',auth[_0x46af('0x7')](),controller[_0x46af('0xf')]);router[_0x46af('0x10')](_0x46af('0xa'),auth[_0x46af('0x7')](),controller[_0x46af('0x11')]);router[_0x46af('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x46af('0x13')]);module['exports']=router; \ No newline at end of file +var _0x872b=['put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe','show','/:id/download'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x872b,0x11d));var _0xb872=function(_0x105fd0,_0x3cda09){_0x105fd0=_0x105fd0-0x0;var _0x3e067e=_0x872b[_0x105fd0];return _0x3e067e;};'use strict';var multer=require(_0xb872('0x0'));var util=require(_0xb872('0x1'));var path=require(_0xb872('0x2'));var timeout=require(_0xb872('0x3'));var express=require('express');var router=express[_0xb872('0x4')]();var fs_extra=require(_0xb872('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb872('0x6'));var config=require(_0xb872('0x7'));var controller=require(_0xb872('0x8'));router[_0xb872('0x9')]('/',auth[_0xb872('0xa')](),controller[_0xb872('0xb')]);router[_0xb872('0x9')]('/describe',auth[_0xb872('0xa')](),controller[_0xb872('0xc')]);router['get']('/:id',auth[_0xb872('0xa')](),controller[_0xb872('0xd')]);router['get'](_0xb872('0xe'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xb872('0xa')](),controller['create']);router[_0xb872('0xf')](_0xb872('0x10'),auth[_0xb872('0xa')](),controller[_0xb872('0x11')]);router['delete'](_0xb872('0x10'),auth[_0xb872('0xa')](),controller[_0xb872('0x12')]);module[_0xb872('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index c527cdb..563aa95 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 _0xfa94=['path','exports','VIRTUAL','value','extname','getDataValue','STRING','replace','INTEGER','setDataValue','startedAt','duration','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','DATE','createdAt','updatedAt','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa94,0xef));var _0x4fa9=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0xfa94[_0x12ca5f];return _0xfc3ae9;};'use strict';var Sequelize=require(_0x4fa9('0x0'));var moment=require('moment');var path=require(_0x4fa9('0x1'));var config=require('../../config/environment');module[_0x4fa9('0x2')]={'format':{'type':Sequelize[_0x4fa9('0x3')],'get':function(){return this['getDataValue'](_0x4fa9('0x4'))?path[_0x4fa9('0x5')](this[_0x4fa9('0x6')](_0x4fa9('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x4fa9('0x7')]},'channel':{'type':Sequelize[_0x4fa9('0x7')]},'value':{'type':Sequelize[_0x4fa9('0x7')],'set':function(_0x56faa9){var _0xd4dcad=_0x56faa9[_0x4fa9('0x8')](/\\/g,'/');this['setDataValue']('value',_0xd4dcad);}},'rating':{'type':Sequelize[_0x4fa9('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x2049ea){this[_0x4fa9('0xa')](_0x4fa9('0xb'),moment()['subtract'](_0x2049ea,'ms'));this[_0x4fa9('0xa')]('closedAt',moment());this[_0x4fa9('0xa')](_0x4fa9('0xc'),_0x2049ea);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4fa9('0x6')](_0x4fa9('0xb')))[_0x4fa9('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x4fa9('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4fa9('0x6')](_0x4fa9('0xf')))['format'](_0x4fa9('0x10'))[_0x4fa9('0xe')]();}},'createdAt':{'type':Sequelize[_0x4fa9('0x11')],'get':function(){return moment(this[_0x4fa9('0x6')](_0x4fa9('0x12')))[_0x4fa9('0xd')](_0x4fa9('0x10'))[_0x4fa9('0xe')]();}},'updatedAt':{'type':Sequelize[_0x4fa9('0x11')],'get':function(){return moment(this['getDataValue'](_0x4fa9('0x13')))[_0x4fa9('0xd')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x8227=['closedAt','createdAt','updatedAt','moment','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','setDataValue','INTEGER','startedAt','subtract','DATE','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x46c41f,_0x186749){var _0x2afba5=function(_0x282f2d){while(--_0x282f2d){_0x46c41f['push'](_0x46c41f['shift']());}};_0x2afba5(++_0x186749);}(_0x8227,0x146));var _0x7822=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8227[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7822('0x0'));var path=require('path');var config=require(_0x7822('0x1'));module[_0x7822('0x2')]={'format':{'type':Sequelize[_0x7822('0x3')],'get':function(){return this[_0x7822('0x4')]('value')?path[_0x7822('0x5')](this[_0x7822('0x4')](_0x7822('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x7822('0x7')]},'channel':{'type':Sequelize[_0x7822('0x7')]},'value':{'type':Sequelize[_0x7822('0x7')],'set':function(_0x3fdb55){var _0x23d59f=_0x3fdb55['replace'](/\\/g,'/');this[_0x7822('0x8')]('value',_0x23d59f);}},'rating':{'type':Sequelize[_0x7822('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7822('0x9')],'set':function(_0x3ba7cb){this[_0x7822('0x8')](_0x7822('0xa'),moment()[_0x7822('0xb')](_0x3ba7cb,'ms'));this['setDataValue']('closedAt',moment());this[_0x7822('0x8')]('duration',_0x3ba7cb);}},'startedAt':{'type':Sequelize[_0x7822('0xc')],'get':function(){return moment(this[_0x7822('0x4')](_0x7822('0xa')))[_0x7822('0xd')](_0x7822('0xe'))[_0x7822('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x7822('0x10')))[_0x7822('0xd')]('MM-DD-YYYY\x20HH:mm')[_0x7822('0xf')]();}},'createdAt':{'type':Sequelize[_0x7822('0xc')],'get':function(){return moment(this[_0x7822('0x4')](_0x7822('0x11')))[_0x7822('0xd')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x7822('0xc')],'get':function(){return moment(this[_0x7822('0x4')](_0x7822('0x12')))[_0x7822('0xd')](_0x7822('0xe'))[_0x7822('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index d5e2971..af2971a 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 _0xa630=['squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','intersection','fields','attributes','length','order','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','createdAt','value','describe','../../components/encryptor','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','ScreenRecording\x20not\x20found','filename','extname','download','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xa630,0xbe));var _0x0a63=function(_0xd6ac84,_0x2d201d){_0xd6ac84=_0xd6ac84-0x0;var _0x35bcc6=_0xa630[_0xd6ac84];return _0x35bcc6;};'use strict';var emlformat=require(_0x0a63('0x0'));var rimraf=require(_0x0a63('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a63('0x2'));var moment=require('moment');var BPromise=require(_0x0a63('0x3'));var Mustache=require('mustache');var util=require(_0x0a63('0x4'));var path=require(_0x0a63('0x5'));var sox=require(_0x0a63('0x6'));var csv=require(_0x0a63('0x7'));var ejs=require(_0x0a63('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a63('0x9'));var squel=require(_0x0a63('0xa'));var crypto=require(_0x0a63('0xb'));var jsforce=require(_0x0a63('0xc'));var deskjs=require(_0x0a63('0xd'));var toCsv=require(_0x0a63('0x7'));var querystring=require('querystring');var Papa=require(_0x0a63('0xe'));var Redis=require(_0x0a63('0xf'));var authService=require(_0x0a63('0x10'));var qs=require(_0x0a63('0x11'));var as=require(_0x0a63('0x12'));var hardwareService=require(_0x0a63('0x13'));var logger=require(_0x0a63('0x14'))(_0x0a63('0x15'));var utils=require(_0x0a63('0x16'));var config=require(_0x0a63('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a63('0x18'))['db'];function respondWithStatusCode(_0x420043,_0x2fce86){_0x2fce86=_0x2fce86||0xcc;return function(_0x3d6323){if(_0x3d6323){return _0x420043['sendStatus'](_0x2fce86);}return _0x420043[_0x0a63('0x19')](_0x2fce86)['end']();};}function respondWithResult(_0x331e99,_0x19e922){_0x19e922=_0x19e922||0xc8;return function(_0x26b2bc){if(_0x26b2bc){return _0x331e99[_0x0a63('0x19')](_0x19e922)[_0x0a63('0x1a')](_0x26b2bc);}};}function respondWithFilteredResult(_0x23b49d,_0x552b1f){return function(_0x1e3251){if(_0x1e3251){var _0x524a98=typeof _0x552b1f[_0x0a63('0x1b')]==='undefined'&&typeof _0x552b1f[_0x0a63('0x1c')]===_0x0a63('0x1d');var _0x36a9e8=_0x1e3251[_0x0a63('0x1e')];var _0x1f7481=_0x524a98?0x0:_0x552b1f[_0x0a63('0x1b')];var _0x30f292=_0x524a98?_0x1e3251[_0x0a63('0x1e')]:_0x552b1f[_0x0a63('0x1b')]+_0x552b1f[_0x0a63('0x1c')];var _0x2ad167;if(_0x30f292>=_0x36a9e8){_0x30f292=_0x36a9e8;_0x2ad167=0xc8;}else{_0x2ad167=0xce;}_0x23b49d['status'](_0x2ad167);return _0x23b49d['set'](_0x0a63('0x1f'),_0x1f7481+'-'+_0x30f292+'/'+_0x36a9e8)['json'](_0x1e3251);}return null;};}function patchUpdates(_0x2fc87c){return function(_0x5937df){try{jsonpatch[_0x0a63('0x20')](_0x5937df,_0x2fc87c,!![]);}catch(_0x41d6b8){return BPromise[_0x0a63('0x21')](_0x41d6b8);}return _0x5937df[_0x0a63('0x22')]();};}function saveUpdates(_0x5da46b,_0x398a16){return function(_0x4c225a){if(_0x4c225a){return _0x4c225a[_0x0a63('0x23')](_0x5da46b)[_0x0a63('0x24')](function(_0x1bf64a){return _0x1bf64a;});}return null;};}function removeEntity(_0x20c114,_0x343273){return function(_0x1f929f){if(_0x1f929f){return _0x1f929f[_0x0a63('0x25')]()[_0x0a63('0x24')](function(){_0x20c114['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55fb70,_0x4c8637){return function(_0xeacfc9){if(!_0xeacfc9){_0x55fb70['sendStatus'](0x194);}return _0xeacfc9;};}function handleError(_0x496c93,_0x2133cf){_0x2133cf=_0x2133cf||0x1f4;return function(_0x1d5448){logger[_0x0a63('0x26')](_0x1d5448[_0x0a63('0x27')]);if(_0x1d5448['name']){delete _0x1d5448[_0x0a63('0x28')];}_0x496c93[_0x0a63('0x19')](_0x2133cf)[_0x0a63('0x29')](_0x1d5448);};}exports['index']=function(_0x34239b,_0xcf409){var _0x1b7bdb={},_0x145090={},_0x32a52b={'count':0x0,'rows':[]};var _0x4577b6=_[_0x0a63('0x2a')](db[_0x0a63('0x2b')]['rawAttributes'],function(_0x58cc71){return{'name':_0x58cc71['fieldName'],'type':_0x58cc71[_0x0a63('0x2c')][_0x0a63('0x2d')]};});_0x145090[_0x0a63('0x2e')]=_[_0x0a63('0x2f')](_[_0x0a63('0x2a')](_0x4577b6,'name'),[_0x0a63('0x30')]);_0x145090[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x34239b[_0x0a63('0x31')]);_0x145090['filters']=_[_0x0a63('0x33')](_0x145090[_0x0a63('0x2e')],_0x145090['query']);_0x1b7bdb['attributes']=_[_0x0a63('0x33')](_0x145090['model'],qs['fields'](_0x34239b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x1b7bdb['attributes']=_0x1b7bdb[_0x0a63('0x35')][_0x0a63('0x36')]?_0x1b7bdb[_0x0a63('0x35')]:_0x145090[_0x0a63('0x2e')];if(!_0x34239b[_0x0a63('0x31')]['hasOwnProperty']('nolimit')){_0x1b7bdb[_0x0a63('0x1c')]=qs[_0x0a63('0x1c')](_0x34239b[_0x0a63('0x31')][_0x0a63('0x1c')]);_0x1b7bdb[_0x0a63('0x1b')]=qs[_0x0a63('0x1b')](_0x34239b['query'][_0x0a63('0x1b')]);}_0x1b7bdb[_0x0a63('0x37')]=qs['sort'](_0x34239b[_0x0a63('0x31')]['sort']);_0x1b7bdb['where']=qs[_0x0a63('0x38')](_[_0x0a63('0x39')](_0x34239b[_0x0a63('0x31')],_0x145090['filters']),_0x4577b6);if(_0x34239b[_0x0a63('0x31')][_0x0a63('0x3a')]){_0x1b7bdb[_0x0a63('0x3b')]=_[_0x0a63('0x3c')](_0x1b7bdb[_0x0a63('0x3b')],{'$or':_[_0x0a63('0x2a')](_0x4577b6,function(_0x604a45){if(_0x604a45['type']!==_0x0a63('0x3d')){var _0x1c7e67={};_0x1c7e67[_0x604a45[_0x0a63('0x28')]]={'$like':'%'+_0x34239b['query']['filter']+'%'};return _0x1c7e67;}})});}_0x1b7bdb=_[_0x0a63('0x3c')]({},_0x1b7bdb,_0x34239b['options']);var _0x1a01f4={'where':_0x1b7bdb[_0x0a63('0x3b')]};return db[_0x0a63('0x2b')]['count'](_0x1a01f4)[_0x0a63('0x24')](function(_0x14c737){_0x32a52b[_0x0a63('0x1e')]=_0x14c737;if(_0x34239b[_0x0a63('0x31')]['includeAll']){_0x1b7bdb[_0x0a63('0x3e')]=[{'all':!![]}];}return db[_0x0a63('0x2b')][_0x0a63('0x3f')](_0x1b7bdb);})[_0x0a63('0x24')](function(_0xf18ace){_0x32a52b[_0x0a63('0x40')]=_0xf18ace;return _0x32a52b;})['then'](respondWithFilteredResult(_0xcf409,_0x1b7bdb))[_0x0a63('0x41')](handleError(_0xcf409,null));};exports[_0x0a63('0x42')]=function(_0x347a0b,_0x793502){var _0x20fa0d={'raw':![],'where':{'id':_0x347a0b[_0x0a63('0x43')]['id']}},_0x2482ca={};_0x2482ca[_0x0a63('0x2e')]=_[_0x0a63('0x32')](db[_0x0a63('0x2b')][_0x0a63('0x44')]);_0x2482ca[_0x0a63('0x31')]=_[_0x0a63('0x32')](_0x347a0b[_0x0a63('0x31')]);_0x2482ca[_0x0a63('0x38')]=_[_0x0a63('0x33')](_0x2482ca[_0x0a63('0x2e')],_0x2482ca[_0x0a63('0x31')]);_0x20fa0d['attributes']=_[_0x0a63('0x33')](_0x2482ca['model'],qs['fields'](_0x347a0b[_0x0a63('0x31')][_0x0a63('0x34')]));_0x20fa0d[_0x0a63('0x35')]=_0x20fa0d[_0x0a63('0x35')][_0x0a63('0x36')]?_0x20fa0d[_0x0a63('0x35')]:_0x2482ca[_0x0a63('0x2e')];if(_0x347a0b[_0x0a63('0x31')][_0x0a63('0x45')]){_0x20fa0d[_0x0a63('0x3e')]=[{'all':!![]}];}_0x20fa0d=_[_0x0a63('0x3c')]({},_0x20fa0d,_0x347a0b[_0x0a63('0x46')]);return db[_0x0a63('0x2b')][_0x0a63('0x47')](_0x20fa0d)[_0x0a63('0x24')](handleEntityNotFound(_0x793502,null))[_0x0a63('0x24')](respondWithResult(_0x793502,null))[_0x0a63('0x41')](handleError(_0x793502,null));};exports[_0x0a63('0x48')]=function(_0x366887,_0x148e0a){return db['ScreenRecording'][_0x0a63('0x48')](_0x366887[_0x0a63('0x49')],{})['then'](respondWithResult(_0x148e0a,0xc9))['catch'](handleError(_0x148e0a,null));};exports['update']=function(_0x485f20,_0x36d066){if(_0x485f20[_0x0a63('0x49')]['id']){delete _0x485f20['body']['id'];}delete _0x485f20[_0x0a63('0x49')]['duration'];delete _0x485f20[_0x0a63('0x49')][_0x0a63('0x4a')];delete _0x485f20['body']['closedAt'];delete _0x485f20['body'][_0x0a63('0x4b')];return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':{'id':_0x485f20[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](handleEntityNotFound(_0x36d066,null))['then'](saveUpdates(_0x485f20[_0x0a63('0x49')],null))[_0x0a63('0x24')](respondWithResult(_0x36d066,null))[_0x0a63('0x41')](handleError(_0x36d066,null));};exports[_0x0a63('0x4c')]=function(_0x3575ae,_0x4a5b6e){return db[_0x0a63('0x2b')][_0x0a63('0x4c')]()[_0x0a63('0x24')](respondWithResult(_0x4a5b6e,null))[_0x0a63('0x41')](handleError(_0x4a5b6e,null));};exports['download']=function(_0x35b688,_0x3bd10c,_0x337bef){var _0x330550=require(_0x0a63('0x4d'));var _0x258ed3=![];var _0x4d4e20={};if(_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]&&_0x35b688[_0x0a63('0x31')][_0x0a63('0x2c')]==='uniqueid'){_0x4d4e20['uniqueid']=_0x35b688[_0x0a63('0x43')]['id'];}else{_0x4d4e20['id']=_0x35b688[_0x0a63('0x43')]['id'];}return db[_0x0a63('0x2b')][_0x0a63('0x47')]({'where':_0x4d4e20,'attributes':['id',_0x0a63('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x3bd10c,null))['then'](function(_0x58b3a8){if(_0x58b3a8){var _0x42c1bb=path['join'](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x58b3a8[_0x0a63('0x4b')]);var _0x5d77e3=util['format'](_0x0a63('0x50'),_0x42c1bb);if(fs[_0x0a63('0x51')](_0x5d77e3)){_0x258ed3=!![];return _0x330550[_0x0a63('0x52')](_0x5d77e3,_0x42c1bb,config[_0x0a63('0x53')][_0x0a63('0x54')])[_0x0a63('0x24')](function(){return _0x58b3a8;});}return _0x58b3a8;}})[_0x0a63('0x24')](function(_0xc3415c){if(_0xc3415c){var _0xe454ef=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0xc3415c[_0x0a63('0x4b')]);if(!fs[_0x0a63('0x51')](_0xe454ef)){throw new db['Sequelize']['ValidationError'](_0x0a63('0x56'));}if(_0xc3415c[_0x0a63('0x57')]){return _0x3bd10c['download'](_0xe454ef,_0xc3415c[_0x0a63('0x57')]+path[_0x0a63('0x58')](_0xe454ef),function(){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}else{return _0x3bd10c[_0x0a63('0x59')](_0xe454ef,function(_0x3053e4){if(_0x258ed3){fs['unlink'](_0xe454ef);}});}}})['catch'](function(_0x3b395a){if(_0x3b395a[_0x0a63('0x5a')]===_0x0a63('0x56')){_0x3bd10c['status'](0x194)[_0x0a63('0x29')](_0x0a63('0x5b'));}else{return handleError(_0x3bd10c,null);}});};exports[_0x0a63('0x25')]=function(_0x284dca,_0x15fc2e){return db['ScreenRecording'][_0x0a63('0x47')]({'where':{'id':_0x284dca[_0x0a63('0x43')]['id']}})[_0x0a63('0x24')](function(_0x1fa9cd){if(_[_0x0a63('0x5c')](_0x1fa9cd)){throw new ReferenceError(_0x0a63('0x5d'));}return _0x1fa9cd;})[_0x0a63('0x24')](function(_0x57313b){var _0x4571e7=path[_0x0a63('0x55')](config[_0x0a63('0x4e')],_0x0a63('0x4f'),_0x57313b[_0x0a63('0x4b')]);logger[_0x0a63('0x5e')](_0x0a63('0x5f'),_0x4571e7);if(!_[_0x0a63('0x5c')](_0x57313b['value'])&&fs['existsSync'](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}_0x4571e7=_0x4571e7+_0x0a63('0x63');if(!_['isNil'](_0x57313b[_0x0a63('0x4b')])&&fs[_0x0a63('0x51')](_0x4571e7)){logger[_0x0a63('0x5e')](_0x0a63('0x60')+_0x4571e7+_0x0a63('0x61'));fs[_0x0a63('0x62')](_0x4571e7);}return _0x57313b;})[_0x0a63('0x24')](function(_0xe52dfd){if(!_0xe52dfd)throw new InternalError();return _0xe52dfd[_0x0a63('0x25')]();})[_0x0a63('0x24')](function(){_0x15fc2e[_0x0a63('0x19')](0xcc)['end']();})[_0x0a63('0x41')](handleError(_0x15fc2e,null));}; \ No newline at end of file +var _0x0e85=['duration','createdAt','closedAt','params','describe','download','uniqueid','join','root','value','existsSync','secrets','recording','server/files/screen_recordings','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','key','model','format','query','filters','intersection','attributes','length','nolimit','sort','filter','where','merge','type','options','include','findAll','rows','catch','keys','fields','find','create','body'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0x0e85,0x7c));var _0x50e8=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x0e85[_0x1a72f3];return _0x57ef47;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['differenceBy'](_['map'](_0x126c99,_0x50e8('0x26')),[_0x50e8('0x2e')]);_0x4f0b88[_0x50e8('0x2f')]=_['keys'](_0x30fedf['query']);_0x4f0b88[_0x50e8('0x30')]=_[_0x50e8('0x31')](_0x4f0b88['model'],_0x4f0b88[_0x50e8('0x2f')]);_0x42bbef[_0x50e8('0x32')]=_[_0x50e8('0x31')](_0x4f0b88[_0x50e8('0x2d')],qs['fields'](_0x30fedf[_0x50e8('0x2f')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef[_0x50e8('0x32')][_0x50e8('0x33')]?_0x42bbef['attributes']:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf[_0x50e8('0x2f')]['hasOwnProperty'](_0x50e8('0x34'))){_0x42bbef[_0x50e8('0x1d')]=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2f')]['limit']);_0x42bbef[_0x50e8('0x1b')]=qs[_0x50e8('0x1b')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x1b')]);}_0x42bbef['order']=qs[_0x50e8('0x35')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x35')]);_0x42bbef['where']=qs['filters'](_['pick'](_0x30fedf[_0x50e8('0x2f')],_0x4f0b88[_0x50e8('0x30')]),_0x126c99);if(_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]){_0x42bbef[_0x50e8('0x37')]=_[_0x50e8('0x38')](_0x42bbef[_0x50e8('0x37')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0x35f802){if(_0x35f802[_0x50e8('0x39')]!=='VIRTUAL'){var _0x3371a4={};_0x3371a4[_0x35f802[_0x50e8('0x26')]]={'$like':'%'+_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]+'%'};return _0x3371a4;}})});}_0x42bbef=_['merge']({},_0x42bbef,_0x30fedf[_0x50e8('0x3a')]);var _0x944e46={'where':_0x42bbef[_0x50e8('0x37')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x944e46)['then'](function(_0x53b198){_0x1041b9[_0x50e8('0x1e')]=_0x53b198;if(_0x30fedf[_0x50e8('0x2f')]['includeAll']){_0x42bbef[_0x50e8('0x3b')]=[{'all':!![]}];}return db[_0x50e8('0x29')][_0x50e8('0x3c')](_0x42bbef);})[_0x50e8('0x23')](function(_0x251e1c){_0x1041b9[_0x50e8('0x3d')]=_0x251e1c;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x3e')](handleError(_0x39c0c6,null));};exports['show']=function(_0x3d26bd,_0x44e0ca){var _0x3ea251={'raw':![],'where':{'id':_0x3d26bd['params']['id']}},_0x2adae0={};_0x2adae0[_0x50e8('0x2d')]=_[_0x50e8('0x3f')](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x2adae0['query']=_[_0x50e8('0x3f')](_0x3d26bd['query']);_0x2adae0['filters']=_['intersection'](_0x2adae0[_0x50e8('0x2d')],_0x2adae0[_0x50e8('0x2f')]);_0x3ea251['attributes']=_[_0x50e8('0x31')](_0x2adae0[_0x50e8('0x2d')],qs[_0x50e8('0x40')](_0x3d26bd[_0x50e8('0x2f')][_0x50e8('0x40')]));_0x3ea251[_0x50e8('0x32')]=_0x3ea251['attributes'][_0x50e8('0x33')]?_0x3ea251['attributes']:_0x2adae0[_0x50e8('0x2d')];if(_0x3d26bd[_0x50e8('0x2f')]['includeAll']){_0x3ea251[_0x50e8('0x3b')]=[{'all':!![]}];}_0x3ea251=_['merge']({},_0x3ea251,_0x3d26bd[_0x50e8('0x3a')]);return db[_0x50e8('0x29')][_0x50e8('0x41')](_0x3ea251)[_0x50e8('0x23')](handleEntityNotFound(_0x44e0ca,null))[_0x50e8('0x23')](respondWithResult(_0x44e0ca,null))[_0x50e8('0x3e')](handleError(_0x44e0ca,null));};exports[_0x50e8('0x42')]=function(_0x3e52b3,_0x141bd4){return db[_0x50e8('0x29')][_0x50e8('0x42')](_0x3e52b3['body'],{})[_0x50e8('0x23')](respondWithResult(_0x141bd4,0xc9))[_0x50e8('0x3e')](handleError(_0x141bd4,null));};exports['update']=function(_0x3692ba,_0x58f14e){if(_0x3692ba[_0x50e8('0x43')]['id']){delete _0x3692ba['body']['id'];}delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x44')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x45')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x46')];delete _0x3692ba[_0x50e8('0x43')]['value'];return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x3692ba[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x58f14e,null))[_0x50e8('0x23')](saveUpdates(_0x3692ba[_0x50e8('0x43')],null))['then'](respondWithResult(_0x58f14e,null))[_0x50e8('0x3e')](handleError(_0x58f14e,null));};exports[_0x50e8('0x48')]=function(_0xff2e24,_0x27c80a){return db['ScreenRecording'][_0x50e8('0x48')]()[_0x50e8('0x23')](respondWithResult(_0x27c80a,null))[_0x50e8('0x3e')](handleError(_0x27c80a,null));};exports[_0x50e8('0x49')]=function(_0x207f06,_0x1372e3,_0x320b00){var _0x5f5220=require('../../components/encryptor');var _0x55083e=![];var _0x2b54ad={};if(_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]&&_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]===_0x50e8('0x4a')){_0x2b54ad['uniqueid']=_0x207f06[_0x50e8('0x47')]['id'];}else{_0x2b54ad['id']=_0x207f06[_0x50e8('0x47')]['id'];}return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':_0x2b54ad,'attributes':['id','value'],'raw':!![]})[_0x50e8('0x23')](handleEntityNotFound(_0x1372e3,null))[_0x50e8('0x23')](function(_0x373b41){if(_0x373b41){var _0x1cc5ba=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],'server/files/screen_recordings',_0x373b41[_0x50e8('0x4d')]);var _0x5d0d54=util['format']('%s.cypher',_0x1cc5ba);if(fs[_0x50e8('0x4e')](_0x5d0d54)){_0x55083e=!![];return _0x5f5220['decryptFile'](_0x5d0d54,_0x1cc5ba,config[_0x50e8('0x4f')][_0x50e8('0x50')])[_0x50e8('0x23')](function(){return _0x373b41;});}return _0x373b41;}})[_0x50e8('0x23')](function(_0x279cf4){if(_0x279cf4){var _0x12224d=path[_0x50e8('0x4b')](config['root'],_0x50e8('0x51'),_0x279cf4[_0x50e8('0x4d')]);if(!fs[_0x50e8('0x4e')](_0x12224d)){throw new db['Sequelize']['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x279cf4[_0x50e8('0x52')]){return _0x1372e3[_0x50e8('0x49')](_0x12224d,_0x279cf4[_0x50e8('0x52')]+path[_0x50e8('0x53')](_0x12224d),function(){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}else{return _0x1372e3[_0x50e8('0x49')](_0x12224d,function(_0x583d6a){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}}})['catch'](function(_0x255b48){if(_0x255b48[_0x50e8('0x55')]==='ScreenRecording\x20not\x20found'){_0x1372e3['status'](0x194)['send'](_0x50e8('0x56'));}else{return handleError(_0x1372e3,null);}});};exports[_0x50e8('0x57')]=function(_0x5d1fc8,_0x351047){return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x5d1fc8[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](function(_0x47b428){if(_[_0x50e8('0x58')](_0x47b428)){throw new ReferenceError(_0x50e8('0x59'));}return _0x47b428;})[_0x50e8('0x23')](function(_0x4b80ac){var _0x583e58=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],_0x50e8('0x51'),_0x4b80ac[_0x50e8('0x4d')]);logger[_0x50e8('0x5a')](_0x50e8('0x5b'),_0x583e58);if(!_['isNil'](_0x4b80ac['value'])&&fs[_0x50e8('0x4e')](_0x583e58)){logger['info'](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs['unlinkSync'](_0x583e58);}_0x583e58=_0x583e58+_0x50e8('0x5e');if(!_['isNil'](_0x4b80ac['value'])&&fs['existsSync'](_0x583e58)){logger[_0x50e8('0x5a')](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs[_0x50e8('0x5f')](_0x583e58);}return _0x4b80ac;})['then'](function(_0x480362){if(!_0x480362)throw new InternalError();return _0x480362[_0x50e8('0x57')]();})[_0x50e8('0x23')](function(){_0x351047[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();})[_0x50e8('0x3e')](handleError(_0x351047,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index ba93704..d1ed97d 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 _0x9201=['screen_recordings','interactionid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','define','ScreenRecording'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x9201,0xec));var _0x1920=function(_0x3ce355,_0x1dabc5){_0x3ce355=_0x3ce355-0x0;var _0xad0e69=_0x9201[_0x3ce355];return _0xad0e69;};'use strict';var _=require(_0x1920('0x0'));var util=require(_0x1920('0x1'));var logger=require(_0x1920('0x2'))('api');var moment=require(_0x1920('0x3'));var BPromise=require(_0x1920('0x4'));var rp=require(_0x1920('0x5'));var fs=require('fs');var path=require(_0x1920('0x6'));var rimraf=require('rimraf');var config=require(_0x1920('0x7'));var attributes=require(_0x1920('0x8'));module['exports']=function(_0x18e6e5,_0x2dee18){return _0x18e6e5[_0x1920('0x9')](_0x1920('0xa'),attributes,{'tableName':_0x1920('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x1920('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd2=['define','ScreenRecording','screen_recordings','interactionid','../../config/logger','api','request-promise','path','rimraf','./screenRecording.attributes','exports'];(function(_0x2d960b,_0x287c0c){var _0x54f8f5=function(_0x5d4455){while(--_0x5d4455){_0x2d960b['push'](_0x2d960b['shift']());}};_0x54f8f5(++_0x287c0c);}(_0x9fd2,0xca));var _0x29fd=function(_0x29dc33,_0x5616a8){_0x29dc33=_0x29dc33-0x0;var _0x21b696=_0x9fd2[_0x29dc33];return _0x21b696;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x29fd('0x0'))(_0x29fd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x29fd('0x2'));var fs=require('fs');var path=require(_0x29fd('0x3'));var rimraf=require(_0x29fd('0x4'));var config=require('../../config/environment');var attributes=require(_0x29fd('0x5'));module[_0x29fd('0x6')]=function(_0x5c4fa7,_0x2a42e9){return _0x5c4fa7[_0x29fd('0x7')](_0x29fd('0x8'),attributes,{'tableName':_0x29fd('0x9'),'paranoid':![],'indexes':[{'name':_0x29fd('0xa'),'fields':[_0x29fd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 972906e..e50798e 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 _0xe0b5=['error','code','message','ScreenRecording,\x20%s,\x20%s','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2c51cc,_0x441d16){var _0x3cf6f7=function(_0x6c263f){while(--_0x6c263f){_0x2c51cc['push'](_0x2c51cc['shift']());}};_0x3cf6f7(++_0x441d16);}(_0xe0b5,0xe1));var _0x5e0b=function(_0x5dcb24,_0xbc4ba5){_0x5dcb24=_0x5dcb24-0x0;var _0x16c575=_0xe0b5[_0x5dcb24];return _0x16c575;};'use strict';var _=require(_0x5e0b('0x0'));var util=require(_0x5e0b('0x1'));var moment=require(_0x5e0b('0x2'));var BPromise=require('bluebird');var rs=require(_0x5e0b('0x3'));var fs=require('fs');var Redis=require(_0x5e0b('0x4'));var db=require(_0x5e0b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e0b('0x6'))('rpc');var config=require(_0x5e0b('0x7'));var jayson=require(_0x5e0b('0x8'));var client=jayson[_0x5e0b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x138457,_0x2bb651,_0x47777d){return new BPromise(function(_0x2ba544,_0x514e9e){return client[_0x5e0b('0xa')](_0x138457,_0x47777d)[_0x5e0b('0xb')](function(_0x2f1c9d){logger[_0x5e0b('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x2bb651,_0x5e0b('0xd'));logger[_0x5e0b('0xe')](_0x5e0b('0xf'),_0x2bb651,_0x5e0b('0xd'),JSON[_0x5e0b('0x10')](_0x2f1c9d));if(_0x2f1c9d[_0x5e0b('0x11')]){if(_0x2f1c9d[_0x5e0b('0x11')][_0x5e0b('0x12')]===0x1f4){logger[_0x5e0b('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x2bb651,_0x2f1c9d[_0x5e0b('0x11')][_0x5e0b('0x13')]);return _0x514e9e(_0x2f1c9d[_0x5e0b('0x11')]['message']);}logger[_0x5e0b('0x11')](_0x5e0b('0x14'),_0x2bb651,_0x2f1c9d[_0x5e0b('0x11')][_0x5e0b('0x13')]);return _0x2ba544(_0x2f1c9d[_0x5e0b('0x11')][_0x5e0b('0x13')]);}else{logger[_0x5e0b('0xc')](_0x5e0b('0x14'),_0x2bb651,_0x5e0b('0xd'));_0x2ba544(_0x2f1c9d[_0x5e0b('0x15')][_0x5e0b('0x13')]);}})['catch'](function(_0x3a39f8){logger[_0x5e0b('0x11')](_0x5e0b('0x14'),_0x2bb651,_0x3a39f8);_0x514e9e(_0x3a39f8);});});} \ No newline at end of file +var _0xce35=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','ScreenRecording,\x20%s,\x20%s','message','result','catch'];(function(_0x1f4a40,_0x3e88f3){var _0x2af469=function(_0x13e8d1){while(--_0x13e8d1){_0x1f4a40['push'](_0x1f4a40['shift']());}};_0x2af469(++_0x3e88f3);}(_0xce35,0xfd));var _0x5ce3=function(_0x21432a,_0x51cf66){_0x21432a=_0x21432a-0x0;var _0x58ab5e=_0xce35[_0x21432a];return _0x58ab5e;};'use strict';var _=require(_0x5ce3('0x0'));var util=require(_0x5ce3('0x1'));var moment=require(_0x5ce3('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ce3('0x3'));var fs=require('fs');var Redis=require(_0x5ce3('0x4'));var db=require(_0x5ce3('0x5'))['db'];var utils=require(_0x5ce3('0x6'));var logger=require('../../config/logger')(_0x5ce3('0x7'));var config=require(_0x5ce3('0x8'));var jayson=require(_0x5ce3('0x9'));var client=jayson[_0x5ce3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19b7b1,_0x59f973,_0x47ffad){return new BPromise(function(_0x5b1388,_0x3e8141){return client[_0x5ce3('0xb')](_0x19b7b1,_0x47ffad)[_0x5ce3('0xc')](function(_0x586d73){logger[_0x5ce3('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x59f973,_0x5ce3('0xe'));logger['debug'](_0x5ce3('0xf'),_0x59f973,_0x5ce3('0xe'),JSON[_0x5ce3('0x10')](_0x586d73));if(_0x586d73['error']){if(_0x586d73['error'][_0x5ce3('0x11')]===0x1f4){logger[_0x5ce3('0x12')](_0x5ce3('0x13'),_0x59f973,_0x586d73[_0x5ce3('0x12')][_0x5ce3('0x14')]);return _0x3e8141(_0x586d73['error']['message']);}logger[_0x5ce3('0x12')](_0x5ce3('0x13'),_0x59f973,_0x586d73[_0x5ce3('0x12')][_0x5ce3('0x14')]);return _0x5b1388(_0x586d73[_0x5ce3('0x12')]['message']);}else{logger[_0x5ce3('0xd')](_0x5ce3('0x13'),_0x59f973,_0x5ce3('0xe'));_0x5b1388(_0x586d73[_0x5ce3('0x15')]['message']);}})[_0x5ce3('0x16')](function(_0x2b11b1){logger[_0x5ce3('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x59f973,_0x2b11b1);_0x3e8141(_0x2b11b1);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 6c1b980..6db16ff 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 _0x7934=['./setting.controller','get','isAuthenticated','/now','getDate','/:id','show','/:id/logo','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','addLogo','join','root','logologin','single','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x20a14b,_0x16ded2){var _0x375585=function(_0x330a4d){while(--_0x330a4d){_0x20a14b['push'](_0x20a14b['shift']());}};_0x375585(++_0x16ded2);}(_0x7934,0xcb));var _0x4793=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7934[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4793('0x0'));var util=require('util');var path=require(_0x4793('0x1'));var timeout=require(_0x4793('0x2'));var express=require(_0x4793('0x3'));var router=express[_0x4793('0x4')]();var fs_extra=require(_0x4793('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4793('0x6'));var config=require('../../config/environment');var controller=require(_0x4793('0x7'));router[_0x4793('0x8')]('/',auth[_0x4793('0x9')](),controller['index']);router[_0x4793('0x8')](_0x4793('0xa'),controller[_0x4793('0xb')]);router[_0x4793('0x8')](_0x4793('0xc'),controller[_0x4793('0xd')]);router[_0x4793('0x8')](_0x4793('0xe'),controller['getLogo']);router[_0x4793('0x8')]('/:id/logo_login',controller['getLogoLogin']);router['get'](_0x4793('0xf'),controller['gdpr']);router[_0x4793('0x8')](_0x4793('0x10'),controller[_0x4793('0x11')]);router[_0x4793('0x8')](_0x4793('0x12'),controller[_0x4793('0x13')]);var upload=multer({'storage':multer[_0x4793('0x14')]({'destination':function(_0x50a617,_0x3f31b3,_0x5da98b){_0x5da98b(null,path['join'](config['root'],_0x4793('0x15')));},'filename':function(_0x5266be,_0x3d1545,_0x46914f){_0x46914f(null,util[_0x4793('0x16')](_0x4793('0x17'),_0x4793('0x18'),path[_0x4793('0x19')](_0x3d1545[_0x4793('0x1a')])));}})});router[_0x4793('0x1b')](_0x4793('0xe'),upload['single'](_0x4793('0x1c')),controller[_0x4793('0x1d')]);var upload=multer({'storage':multer[_0x4793('0x14')]({'destination':function(_0x27f0fd,_0x287da0,_0x131c89){_0x131c89(null,path[_0x4793('0x1e')](config[_0x4793('0x1f')],'server/files/images/logos/'));},'filename':function(_0x469d56,_0x3098da,_0x467a19){_0x467a19(null,util['format'](_0x4793('0x17'),_0x4793('0x20'),path[_0x4793('0x19')](_0x3098da[_0x4793('0x1a')])));}})});router[_0x4793('0x1b')]('/:id/logo_login',upload[_0x4793('0x21')](_0x4793('0x1c')),controller[_0x4793('0x22')]);var upload=multer({'storage':multer[_0x4793('0x14')]({'destination':function(_0x2968ec,_0x23f877,_0x384415){_0x384415(null,path[_0x4793('0x1e')](config[_0x4793('0x1f')],_0x4793('0x15')));},'filename':function(_0xfda0f8,_0x676c94,_0x2aee9c){_0x2aee9c(null,util[_0x4793('0x16')]('%s%s',_0x4793('0x23'),path[_0x4793('0x19')](_0x676c94[_0x4793('0x1a')])));}})});router[_0x4793('0x1b')](_0x4793('0x10'),upload[_0x4793('0x21')](_0x4793('0x1c')),controller[_0x4793('0x24')]);var upload=multer({'storage':multer[_0x4793('0x14')]({'destination':function(_0x3bcc59,_0x4e4fee,_0x4620a7){_0x4620a7(null,path[_0x4793('0x1e')](config[_0x4793('0x1f')],'server/files/images/logos/'));},'filename':function(_0x196527,_0x380978,_0x4b1cab){_0x4b1cab(null,util[_0x4793('0x16')]('%s%s',_0x4793('0x25'),path[_0x4793('0x19')](_0x380978['originalname'])));}})});router[_0x4793('0x1b')](_0x4793('0x12'),upload[_0x4793('0x21')](_0x4793('0x1c')),controller[_0x4793('0x26')]);router[_0x4793('0x27')](_0x4793('0xc'),auth['isAuthenticated'](),controller[_0x4793('0x28')]);module[_0x4793('0x29')]=router; \ No newline at end of file +var _0xc280=['logo','post','single','file','addLogo','join','logologin','extname','originalname','/:id/logo_login','addLogoLogin','preferred','addPreferred','favicon','addFavicon','update','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','getDate','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','root','server/files/images/logos/','format','%s%s'];(function(_0x10e7bd,_0x314eb6){var _0x54845c=function(_0x152082){while(--_0x152082){_0x10e7bd['push'](_0x10e7bd['shift']());}};_0x54845c(++_0x314eb6);}(_0xc280,0xfa));var _0x0c28=function(_0x17c41a,_0x3f1f65){_0x17c41a=_0x17c41a-0x0;var _0x3fae40=_0xc280[_0x17c41a];return _0x3fae40;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c28('0x0'));var timeout=require(_0x0c28('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0c28('0x2'));var auth=require(_0x0c28('0x3'));var interaction=require(_0x0c28('0x4'));var config=require(_0x0c28('0x5'));var controller=require('./setting.controller');router[_0x0c28('0x6')]('/',auth['isAuthenticated'](),controller[_0x0c28('0x7')]);router['get']('/now',controller[_0x0c28('0x8')]);router[_0x0c28('0x6')]('/:id',controller[_0x0c28('0x9')]);router[_0x0c28('0x6')](_0x0c28('0xa'),controller[_0x0c28('0xb')]);router['get']('/:id/logo_login',controller[_0x0c28('0xc')]);router[_0x0c28('0x6')](_0x0c28('0xd'),controller[_0x0c28('0xe')]);router[_0x0c28('0x6')](_0x0c28('0xf'),controller[_0x0c28('0x10')]);router[_0x0c28('0x6')](_0x0c28('0x11'),controller['getFavicon']);var upload=multer({'storage':multer[_0x0c28('0x12')]({'destination':function(_0x2b66b2,_0x38024f,_0x27ab62){_0x27ab62(null,path['join'](config[_0x0c28('0x13')],_0x0c28('0x14')));},'filename':function(_0x320723,_0x1d0c50,_0xc8a618){_0xc8a618(null,util[_0x0c28('0x15')](_0x0c28('0x16'),_0x0c28('0x17'),path['extname'](_0x1d0c50['originalname'])));}})});router[_0x0c28('0x18')](_0x0c28('0xa'),upload[_0x0c28('0x19')](_0x0c28('0x1a')),controller[_0x0c28('0x1b')]);var upload=multer({'storage':multer[_0x0c28('0x12')]({'destination':function(_0x2205e4,_0x1d041d,_0x59bd0f){_0x59bd0f(null,path[_0x0c28('0x1c')](config['root'],_0x0c28('0x14')));},'filename':function(_0x3d37ee,_0x225b91,_0x4945c){_0x4945c(null,util[_0x0c28('0x15')](_0x0c28('0x16'),_0x0c28('0x1d'),path[_0x0c28('0x1e')](_0x225b91[_0x0c28('0x1f')])));}})});router[_0x0c28('0x18')](_0x0c28('0x20'),upload['single']('file'),controller[_0x0c28('0x21')]);var upload=multer({'storage':multer[_0x0c28('0x12')]({'destination':function(_0x5a4088,_0x157968,_0x48b5a6){_0x48b5a6(null,path[_0x0c28('0x1c')](config['root'],_0x0c28('0x14')));},'filename':function(_0x42db27,_0x179157,_0x27fc11){_0x27fc11(null,util[_0x0c28('0x15')]('%s%s',_0x0c28('0x22'),path[_0x0c28('0x1e')](_0x179157[_0x0c28('0x1f')])));}})});router[_0x0c28('0x18')](_0x0c28('0xf'),upload['single']('file'),controller[_0x0c28('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1883e4,_0x2d3b67,_0x5676a0){_0x5676a0(null,path[_0x0c28('0x1c')](config[_0x0c28('0x13')],'server/files/images/logos/'));},'filename':function(_0x397b1f,_0x899e2a,_0x34d1da){_0x34d1da(null,util[_0x0c28('0x15')](_0x0c28('0x16'),_0x0c28('0x24'),path['extname'](_0x899e2a[_0x0c28('0x1f')])));}})});router[_0x0c28('0x18')](_0x0c28('0x11'),upload[_0x0c28('0x19')](_0x0c28('0x1a')),controller[_0x0c28('0x25')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0c28('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 79965c8..1314f7d 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 _0x29c1=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','STRING'];(function(_0xd92ec8,_0x4d292b){var _0x281058=function(_0xf23ea){while(--_0xf23ea){_0xd92ec8['push'](_0xd92ec8['shift']());}};_0x281058(++_0x4d292b);}(_0x29c1,0x157));var _0x129c=function(_0x52420d,_0x2fdc98){_0x52420d=_0x52420d-0x0;var _0x16193c=_0x29c1[_0x52420d];return _0x16193c;};'use strict';var Sequelize=require('sequelize');module[_0x129c('0x0')]={'min_internal':{'type':Sequelize[_0x129c('0x1')](0xb),'unique':_0x129c('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x129c('0x1')](0xb),'unique':_0x129c('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x129c('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x129c('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x129c('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x129c('0x6')]},'defaultLoginLogo':{'type':Sequelize[_0x129c('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x129c('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x129c('0x6')]},'turnusername':{'type':Sequelize[_0x129c('0x6')]},'turnpassword':{'type':Sequelize[_0x129c('0x6')]},'pageTitle':{'type':Sequelize[_0x129c('0x6')]},'defaultPageTitle':{'type':Sequelize[_0x129c('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x129c('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x129c('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x129c('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x129c('0x6')],'defaultValue':_0x129c('0x7')},'enableEmailPreview':{'type':Sequelize[_0x129c('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x129c('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x129c('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x129c('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x129c('0x6')],'defaultValue':_0x129c('0x8')},'chatTimeout':{'type':Sequelize[_0x129c('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x129c('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x129c('0x6')]},'defaultPreferred':{'type':Sequelize[_0x129c('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x129c('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x129c('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x129c('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x129c('0x6')]},'defaultFavicon':{'type':Sequelize[_0x129c('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x129c('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x129c('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x129c('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x129c('0x1')]},'transcribeRegion':{'type':Sequelize[_0x129c('0x6')]},'sentiment':{'type':Sequelize[_0x129c('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x129c('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x129c('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x129c('0x6')]},'bucket':{'type':Sequelize[_0x129c('0x6')]},'googleSsoEnabled':{'type':Sequelize[_0x129c('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x129c('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x129c('0x1')](0x2)[_0x129c('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x129c('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x129c('0x1')](0x2)[_0x129c('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x129c('0x1')](0x2)[_0x129c('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x129c('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x129c('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x129c('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x129c('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x129c('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x129c('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x129c('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x129c('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x129c('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x129c('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x129c('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x4f0a=['alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN'];(function(_0x593b6a,_0x4c3a3d){var _0x3f1c5a=function(_0x6b9153){while(--_0x6b9153){_0x593b6a['push'](_0x593b6a['shift']());}};_0x3f1c5a(++_0x4c3a3d);}(_0x4f0a,0x66));var _0xa4f0=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0x4f0a[_0x20aadb];return _0x520018;};'use strict';var Sequelize=require(_0xa4f0('0x0'));module[_0xa4f0('0x1')]={'min_internal':{'type':Sequelize[_0xa4f0('0x2')](0xb),'unique':_0xa4f0('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xa4f0('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xa4f0('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xa4f0('0x5')},'logo':{'type':Sequelize[_0xa4f0('0x6')]},'defaultLogo':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xa4f0('0x6')]},'turnusername':{'type':Sequelize[_0xa4f0('0x6')]},'turnpassword':{'type':Sequelize[_0xa4f0('0x6')]},'pageTitle':{'type':Sequelize[_0xa4f0('0x6')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xa4f0('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xa4f0('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xa4f0('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xa4f0('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xa4f0('0x8')},'chatTimeout':{'type':Sequelize[_0xa4f0('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xa4f0('0x6')]},'defaultPreferred':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xa4f0('0x6')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xa4f0('0x6')]},'defaultFavicon':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xa4f0('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xa4f0('0x2')]},'transcribeRegion':{'type':Sequelize[_0xa4f0('0x6')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xa4f0('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa4f0('0x6')]},'bucket':{'type':Sequelize[_0xa4f0('0x6')]},'googleSsoEnabled':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xa4f0('0x2')](0x2)[_0xa4f0('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xa4f0('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xa4f0('0x2')](0x2)[_0xa4f0('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xa4f0('0x2')](0x2)[_0xa4f0('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xa4f0('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xa4f0('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xa4f0('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xa4f0('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xa4f0('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xa4f0('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xa4f0('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xa4f0('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 237fa82..3c0f33a 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 _0x2551=['addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','join','root','toLower','default','upperFirst','custom','default_logo.svg','existsSync','Sequelize','ValidationError','download','getLogoLogin','loginLogo','defaultFavicon','default_loginLogo.svg','\x20not\x20found','securePassword','addPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','attributes','fields','order','where','filter','merge','VIRTUAL','options','Setting','includeAll','rows','show','params','keys','length','include','find','body'];(function(_0x53aa2a,_0x2d1da6){var _0xa7a36b=function(_0x59f5e8){while(--_0x59f5e8){_0x53aa2a['push'](_0x53aa2a['shift']());}};_0xa7a36b(++_0x2d1da6);}(_0x2551,0x9d));var _0x1255=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0x2551[_0x523adf];return _0x283870;};'use strict';var emlformat=require(_0x1255('0x0'));var rimraf=require(_0x1255('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1255('0x2'));var rp=require('request-promise');var moment=require(_0x1255('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1255('0x4'));var util=require(_0x1255('0x5'));var path=require('path');var sox=require(_0x1255('0x6'));var csv=require(_0x1255('0x7'));var ejs=require(_0x1255('0x8'));var fs=require('fs');var fs_extra=require(_0x1255('0x9'));var _=require('lodash');var squel=require(_0x1255('0xa'));var crypto=require(_0x1255('0xb'));var jsforce=require(_0x1255('0xc'));var deskjs=require(_0x1255('0xd'));var toCsv=require(_0x1255('0x7'));var querystring=require(_0x1255('0xe'));var Papa=require(_0x1255('0xf'));var Redis=require(_0x1255('0x10'));var authService=require(_0x1255('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1255('0x12'));var logger=require(_0x1255('0x13'))('api');var utils=require(_0x1255('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1255('0x15'));var db=require(_0x1255('0x16'))['db'];var jayson=require(_0x1255('0x17'));var client=jayson['client'][_0x1255('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x140f34,_0x4a147b,_0x2d5de5,_0x572b88){return new BPromise(function(_0x34fd28,_0x1a7efd){var _0x27d238=_0x572b88||client;return _0x27d238['request'](_0x140f34,_0x2d5de5)[_0x1255('0x19')](function(_0x333b72){logger[_0x1255('0x1a')](_0x1255('0x1b'),_0x4a147b,'request\x20sent');logger[_0x1255('0x1c')](_0x1255('0x1d'),_0x4a147b,_0x1255('0x1e'),JSON[_0x1255('0x1f')](_0x333b72));if(_0x333b72[_0x1255('0x20')]){if(_0x333b72[_0x1255('0x20')][_0x1255('0x21')]===0x1f4){logger[_0x1255('0x20')](_0x1255('0x1b'),_0x4a147b,_0x333b72[_0x1255('0x20')]['message']);return _0x1a7efd(_0x333b72['error']['message']);}logger['error'](_0x1255('0x1b'),_0x4a147b,_0x333b72[_0x1255('0x20')][_0x1255('0x22')]);return _0x34fd28(_0x333b72[_0x1255('0x20')][_0x1255('0x22')]);}else{logger[_0x1255('0x1a')]('Setting,\x20%s,\x20%s',_0x4a147b,_0x1255('0x1e'));_0x34fd28(_0x333b72['result'][_0x1255('0x22')]);}})[_0x1255('0x23')](function(_0x1e4f3d){logger['error'](_0x1255('0x1b'),_0x4a147b,_0x1e4f3d);_0x1a7efd(_0x1e4f3d);});});}function respondWithStatusCode(_0x4e5a1e,_0x49222a){_0x49222a=_0x49222a||0xcc;return function(_0x31b07f){if(_0x31b07f){return _0x4e5a1e[_0x1255('0x24')](_0x49222a);}return _0x4e5a1e['status'](_0x49222a)[_0x1255('0x25')]();};}function respondWithResult(_0x2eaf61,_0x4e5817){_0x4e5817=_0x4e5817||0xc8;return function(_0x3fa53a){if(_0x3fa53a){return _0x2eaf61['status'](_0x4e5817)['json'](_0x3fa53a);}};}function respondWithFilteredResult(_0x58f282,_0x4dbce9){return function(_0x1e5a9d){if(_0x1e5a9d){var _0x1b93de=typeof _0x4dbce9[_0x1255('0x26')]===_0x1255('0x27')&&typeof _0x4dbce9[_0x1255('0x28')]===_0x1255('0x27');var _0x2e2cc3=_0x1e5a9d[_0x1255('0x29')];var _0x1d9485=_0x1b93de?0x0:_0x4dbce9[_0x1255('0x26')];var _0x10db4a=_0x1b93de?_0x1e5a9d[_0x1255('0x29')]:_0x4dbce9[_0x1255('0x26')]+_0x4dbce9[_0x1255('0x28')];var _0x3a5c44;if(_0x10db4a>=_0x2e2cc3){_0x10db4a=_0x2e2cc3;_0x3a5c44=0xc8;}else{_0x3a5c44=0xce;}_0x58f282[_0x1255('0x2a')](_0x3a5c44);return _0x58f282[_0x1255('0x2b')](_0x1255('0x2c'),_0x1d9485+'-'+_0x10db4a+'/'+_0x2e2cc3)[_0x1255('0x2d')](_0x1e5a9d);}return null;};}function patchUpdates(_0x331739){return function(_0x29c002){try{jsonpatch['apply'](_0x29c002,_0x331739,!![]);}catch(_0x14368e){return BPromise[_0x1255('0x2e')](_0x14368e);}return _0x29c002[_0x1255('0x2f')]();};}function saveUpdates(_0x230dd0,_0xbeba3a){return function(_0x1b3222){if(_0x1b3222){return _0x1b3222[_0x1255('0x30')](_0x230dd0)[_0x1255('0x19')](function(_0x3373c1){return _0x3373c1;});}return null;};}function removeEntity(_0x2f945d,_0xfb301){return function(_0x3e08b1){if(_0x3e08b1){return _0x3e08b1[_0x1255('0x31')]()['then'](function(){_0x2f945d[_0x1255('0x2a')](0xcc)[_0x1255('0x25')]();});}};}function handleEntityNotFound(_0x1a5829,_0x44bc4e){return function(_0x28d338){if(!_0x28d338){_0x1a5829[_0x1255('0x24')](0x194);}return _0x28d338;};}function handleError(_0x55b147,_0x55cff9){_0x55cff9=_0x55cff9||0x1f4;return function(_0x4720cd){logger[_0x1255('0x20')](_0x4720cd[_0x1255('0x32')]);if(_0x4720cd[_0x1255('0x33')]){delete _0x4720cd[_0x1255('0x33')];}_0x55b147['status'](_0x55cff9)[_0x1255('0x34')](_0x4720cd);};}exports[_0x1255('0x35')]=function(_0xedeff0,_0x2441c3){var _0x5ca5ac={},_0x32c909={},_0x2276f0={'count':0x0,'rows':[]};var _0x54d4ba=_[_0x1255('0x36')](db['Setting'][_0x1255('0x37')],function(_0x23e339){return{'name':_0x23e339['fieldName'],'type':_0x23e339[_0x1255('0x38')][_0x1255('0x39')]};});_0x32c909[_0x1255('0x3a')]=_[_0x1255('0x36')](_0x54d4ba,_0x1255('0x33'));_0x32c909[_0x1255('0x3b')]=_['keys'](_0xedeff0[_0x1255('0x3b')]);_0x32c909[_0x1255('0x3c')]=_['intersection'](_0x32c909[_0x1255('0x3a')],_0x32c909[_0x1255('0x3b')]);_0x5ca5ac[_0x1255('0x3d')]=_['intersection'](_0x32c909[_0x1255('0x3a')],qs[_0x1255('0x3e')](_0xedeff0[_0x1255('0x3b')][_0x1255('0x3e')]));_0x5ca5ac[_0x1255('0x3d')]=_0x5ca5ac[_0x1255('0x3d')]['length']?_0x5ca5ac[_0x1255('0x3d')]:_0x32c909[_0x1255('0x3a')];if(!_0xedeff0[_0x1255('0x3b')]['hasOwnProperty']('nolimit')){_0x5ca5ac[_0x1255('0x28')]=qs[_0x1255('0x28')](_0xedeff0[_0x1255('0x3b')][_0x1255('0x28')]);_0x5ca5ac['offset']=qs[_0x1255('0x26')](_0xedeff0[_0x1255('0x3b')][_0x1255('0x26')]);}_0x5ca5ac[_0x1255('0x3f')]=qs['sort'](_0xedeff0[_0x1255('0x3b')]['sort']);_0x5ca5ac[_0x1255('0x40')]=qs['filters'](_['pick'](_0xedeff0['query'],_0x32c909[_0x1255('0x3c')]),_0x54d4ba);if(_0xedeff0[_0x1255('0x3b')][_0x1255('0x41')]){_0x5ca5ac[_0x1255('0x40')]=_[_0x1255('0x42')](_0x5ca5ac[_0x1255('0x40')],{'$or':_[_0x1255('0x36')](_0x54d4ba,function(_0x18ed08){if(_0x18ed08[_0x1255('0x38')]!==_0x1255('0x43')){var _0x285dc7={};_0x285dc7[_0x18ed08[_0x1255('0x33')]]={'$like':'%'+_0xedeff0[_0x1255('0x3b')][_0x1255('0x41')]+'%'};return _0x285dc7;}})});}_0x5ca5ac=_['merge']({},_0x5ca5ac,_0xedeff0[_0x1255('0x44')]);var _0x1ffc82={'where':_0x5ca5ac[_0x1255('0x40')]};return db[_0x1255('0x45')][_0x1255('0x29')](_0x1ffc82)[_0x1255('0x19')](function(_0x4d170d){_0x2276f0[_0x1255('0x29')]=_0x4d170d;if(_0xedeff0[_0x1255('0x3b')][_0x1255('0x46')]){_0x5ca5ac['include']=[{'all':!![]}];}return db[_0x1255('0x45')]['findAll'](_0x5ca5ac);})[_0x1255('0x19')](function(_0x34f914){_0x2276f0[_0x1255('0x47')]=_0x34f914;return _0x2276f0;})[_0x1255('0x19')](respondWithFilteredResult(_0x2441c3,_0x5ca5ac))[_0x1255('0x23')](handleError(_0x2441c3,null));};exports[_0x1255('0x48')]=function(_0x14d817,_0x359f6a){var _0x203e95={'raw':![],'where':{'id':_0x14d817[_0x1255('0x49')]['id']}},_0x51d87b={};_0x51d87b['model']=_[_0x1255('0x4a')](db['Setting'][_0x1255('0x37')]);_0x51d87b['query']=_[_0x1255('0x4a')](_0x14d817[_0x1255('0x3b')]);_0x51d87b['filters']=_['intersection'](_0x51d87b[_0x1255('0x3a')],_0x51d87b['query']);_0x203e95[_0x1255('0x3d')]=_['intersection'](_0x51d87b['model'],qs['fields'](_0x14d817[_0x1255('0x3b')][_0x1255('0x3e')]));_0x203e95['attributes']=_0x203e95[_0x1255('0x3d')][_0x1255('0x4b')]?_0x203e95[_0x1255('0x3d')]:_0x51d87b[_0x1255('0x3a')];if(_0x14d817['query'][_0x1255('0x46')]){_0x203e95[_0x1255('0x4c')]=[{'all':!![]}];}_0x203e95=_[_0x1255('0x42')]({},_0x203e95,_0x14d817[_0x1255('0x44')]);return db[_0x1255('0x45')][_0x1255('0x4d')](_0x203e95)[_0x1255('0x19')](handleEntityNotFound(_0x359f6a,null))[_0x1255('0x19')](respondWithResult(_0x359f6a,null))[_0x1255('0x23')](handleError(_0x359f6a,null));};exports[_0x1255('0x30')]=function(_0x1a043c,_0x40601e){if(_0x1a043c[_0x1255('0x4e')]['id']){delete _0x1a043c[_0x1255('0x4e')]['id'];}return db[_0x1255('0x45')][_0x1255('0x4d')]({'where':{'id':_0x1a043c[_0x1255('0x49')]['id']}})[_0x1255('0x19')](handleEntityNotFound(_0x40601e,null))[_0x1255('0x19')](saveUpdates(_0x1a043c['body'],null))[_0x1255('0x19')](respondWithResult(_0x40601e,null))['catch'](handleError(_0x40601e,null));};exports[_0x1255('0x4f')]=function(_0x470139,_0x97652b,_0x194eb9){if(_0x470139['file']&&_0x470139[_0x1255('0x50')][_0x1255('0x51')]){_0x470139[_0x1255('0x4e')][_0x1255('0x52')]=_0x470139[_0x1255('0x50')][_0x1255('0x51')];}return db[_0x1255('0x45')][_0x1255('0x4d')]({'where':{'id':_0x470139[_0x1255('0x49')]['id']}})[_0x1255('0x19')](handleEntityNotFound(_0x97652b,null))[_0x1255('0x19')](saveUpdates(_0x470139['body'],null))[_0x1255('0x19')](respondWithResult(_0x97652b,null))[_0x1255('0x23')](handleError(_0x97652b,null));};exports[_0x1255('0x53')]=function(_0x39568b,_0x4f2d5a,_0x194fd7){if(_0x39568b[_0x1255('0x50')]&&_0x39568b[_0x1255('0x50')][_0x1255('0x51')]){_0x39568b[_0x1255('0x4e')]['loginLogo']=_0x39568b[_0x1255('0x50')]['filename'];}return db['Setting']['find']({'where':{'id':_0x39568b['params']['id']}})['then'](handleEntityNotFound(_0x4f2d5a,null))[_0x1255('0x19')](saveUpdates(_0x39568b[_0x1255('0x4e')],null))['then'](respondWithResult(_0x4f2d5a,null))[_0x1255('0x23')](handleError(_0x4f2d5a,null));};var utilLicense=require(_0x1255('0x15'));exports[_0x1255('0x54')]=function(_0x3a329f,_0x4ed393,_0x285147){var _0x1ee1c2=_0x1255('0x55');var _0x2196ff={'custom':![]};return utilLicense[_0x1255('0x56')]()['then'](function(_0x31c2ad){if(_0x31c2ad){_0x2196ff=_0x31c2ad;}return db[_0x1255('0x45')]['find']({'where':{'id':_0x3a329f['params']['id']},'attributes':[_0x1255('0x52'),'loginLogo',_0x1255('0x57'),_0x1255('0x58'),_0x1255('0x59'),_0x1255('0x5a'),_0x1255('0x5b'),'defaultFavicon'],'raw':!![]});})[_0x1255('0x19')](handleEntityNotFound(_0x4ed393,null))['then'](function(_0x1165e6){if(_0x1165e6){var _0x16e762=_0x1165e6['logo']&&fs['existsSync'](path[_0x1255('0x5c')](config[_0x1255('0x5d')],_0x1ee1c2,_[_0x1255('0x5e')](_0x1165e6['logo'])))?path[_0x1255('0x5c')](config[_0x1255('0x5d')],_0x1ee1c2,_[_0x1255('0x5e')](_0x1165e6[_0x1255('0x52')])):path['join'](config[_0x1255('0x5d')],_0x1ee1c2,_[_0x1255('0x5e')]('default_logo.svg'));var _0x2a76a4=_0x1255('0x5f')+_[_0x1255('0x60')]('logo');if(_0x1165e6[_0x2a76a4]||!_0x2196ff[_0x1255('0x61')]){_0x16e762=path[_0x1255('0x5c')](config[_0x1255('0x5d')],_0x1ee1c2,_[_0x1255('0x5e')](_0x1255('0x62')));}if(!fs[_0x1255('0x63')](_0x16e762)){throw new db[(_0x1255('0x64'))][(_0x1255('0x65'))](_[_0x1255('0x60')](_0x1255('0x52'))+'\x20not\x20found');}return _0x4ed393[_0x1255('0x66')](_0x16e762);}})[_0x1255('0x23')](handleError(_0x4ed393,null));};var utilLicense=require(_0x1255('0x15'));exports[_0x1255('0x67')]=function(_0x409ae0,_0x5e0496,_0x26d4ea){var _0x3491e0=_0x1255('0x55');var _0x5037e2={'custom':![]};return utilLicense[_0x1255('0x56')]()['then'](function(_0x2438a6){if(_0x2438a6){_0x5037e2=_0x2438a6;}return db[_0x1255('0x45')][_0x1255('0x4d')]({'where':{'id':_0x409ae0['params']['id']},'attributes':[_0x1255('0x52'),_0x1255('0x68'),_0x1255('0x57'),_0x1255('0x58'),_0x1255('0x59'),'defaultLoginLogo','defaultPreferred',_0x1255('0x69')],'raw':!![]});})['then'](handleEntityNotFound(_0x5e0496,null))[_0x1255('0x19')](function(_0x3d3e72){if(_0x3d3e72){var _0x1eec94=_0x3d3e72['loginLogo']&&fs[_0x1255('0x63')](path[_0x1255('0x5c')](config[_0x1255('0x5d')],_0x3491e0,_['toLower'](_0x3d3e72[_0x1255('0x68')])))?path[_0x1255('0x5c')](config[_0x1255('0x5d')],_0x3491e0,_[_0x1255('0x5e')](_0x3d3e72[_0x1255('0x68')])):path[_0x1255('0x5c')](config['root'],_0x3491e0,_[_0x1255('0x5e')](_0x1255('0x6a')));var _0x468ae9=_0x1255('0x5f')+_[_0x1255('0x60')](_0x1255('0x68'));if(_0x3d3e72[_0x468ae9]||!_0x5037e2['custom']){_0x1eec94=path[_0x1255('0x5c')](config['root'],_0x3491e0,_['toLower']('default_loginLogo.svg'));}if(!fs[_0x1255('0x63')](_0x1eec94)){throw new db[(_0x1255('0x64'))][(_0x1255('0x65'))](_[_0x1255('0x60')](_0x1255('0x68'))+_0x1255('0x6b'));}return _0x5e0496['download'](_0x1eec94);}})[_0x1255('0x23')](handleError(_0x5e0496,null));};exports['gdpr']=function(_0x2047e2,_0x124953){return db['Setting'][_0x1255('0x4d')]({'where':{'id':_0x2047e2['params']['id']},'attributes':[_0x1255('0x6c')]})[_0x1255('0x19')](respondWithResult(_0x124953,null))[_0x1255('0x23')](handleError(_0x124953,null));};exports[_0x1255('0x6d')]=function(_0x34b7a8,_0x10c623,_0x3752f1){if(_0x34b7a8[_0x1255('0x50')]&&_0x34b7a8['file'][_0x1255('0x51')]){_0x34b7a8[_0x1255('0x4e')]['preferred']=_0x34b7a8[_0x1255('0x50')]['filename'];}return db[_0x1255('0x45')][_0x1255('0x4d')]({'where':{'id':_0x34b7a8['params']['id']}})['then'](handleEntityNotFound(_0x10c623,null))[_0x1255('0x19')](saveUpdates(_0x34b7a8[_0x1255('0x4e')],null))['then'](respondWithResult(_0x10c623,null))[_0x1255('0x23')](handleError(_0x10c623,null));};var utilLicense=require(_0x1255('0x15'));exports['getPreferred']=function(_0x2bbcce,_0xf0f064,_0xe40374){var _0x50109a='server/files/images/logos';var _0x473d21={'custom':![]};return utilLicense[_0x1255('0x56')]()['then'](function(_0xcf48cd){if(_0xcf48cd){_0x473d21=_0xcf48cd;}return db[_0x1255('0x45')][_0x1255('0x4d')]({'where':{'id':_0x2bbcce[_0x1255('0x49')]['id']},'attributes':[_0x1255('0x52'),_0x1255('0x68'),_0x1255('0x57'),_0x1255('0x58'),_0x1255('0x59'),_0x1255('0x5a'),_0x1255('0x5b'),_0x1255('0x69')],'raw':!![]});})[_0x1255('0x19')](handleEntityNotFound(_0xf0f064,null))[_0x1255('0x19')](function(_0x36c0f5){if(_0x36c0f5){var _0x345d44=_0x36c0f5['preferred']&&fs[_0x1255('0x63')](path[_0x1255('0x5c')](config[_0x1255('0x5d')],_0x50109a,_[_0x1255('0x5e')](_0x36c0f5[_0x1255('0x57')])))?path['join'](config[_0x1255('0x5d')],_0x50109a,_['toLower'](_0x36c0f5[_0x1255('0x57')])):path[_0x1255('0x5c')](config[_0x1255('0x5d')],_0x50109a,_['toLower'](_0x1255('0x6e')));var _0x492823=_0x1255('0x5f')+_[_0x1255('0x60')]('preferred');if(_0x36c0f5[_0x492823]||!_0x473d21[_0x1255('0x61')]||!_0x473d21['preferred']){_0x345d44=path[_0x1255('0x5c')](config[_0x1255('0x5d')],_0x50109a,_['toLower'](_0x1255('0x6e')));}if(!fs['existsSync'](_0x345d44)){throw new db[(_0x1255('0x64'))]['ValidationError'](_[_0x1255('0x60')](_0x1255('0x57'))+_0x1255('0x6b'));}return _0xf0f064[_0x1255('0x66')](_0x345d44);}})[_0x1255('0x23')](handleError(_0xf0f064,null));};exports[_0x1255('0x6f')]=function(_0x86f1a0,_0x49f170,_0x58a061){if(_0x86f1a0[_0x1255('0x50')]&&_0x86f1a0[_0x1255('0x50')][_0x1255('0x51')]){_0x86f1a0[_0x1255('0x4e')][_0x1255('0x58')]=_0x86f1a0[_0x1255('0x50')][_0x1255('0x51')];}return db['Setting']['find']({'where':{'id':_0x86f1a0[_0x1255('0x49')]['id']}})['then'](handleEntityNotFound(_0x49f170,null))[_0x1255('0x19')](saveUpdates(_0x86f1a0[_0x1255('0x4e')],null))['then'](respondWithResult(_0x49f170,null))[_0x1255('0x23')](handleError(_0x49f170,null));};var utilLicense=require(_0x1255('0x15'));exports['getFavicon']=function(_0x53f139,_0x760933,_0x4bbe01){var _0x596495=_0x1255('0x55');var _0x16db68={'custom':![]};return utilLicense[_0x1255('0x56')]()[_0x1255('0x19')](function(_0x5b0255){if(_0x5b0255){_0x16db68=_0x5b0255;}return db['Setting'][_0x1255('0x4d')]({'where':{'id':_0x53f139[_0x1255('0x49')]['id']},'attributes':['logo',_0x1255('0x68'),_0x1255('0x57'),'favicon',_0x1255('0x59'),_0x1255('0x5a'),_0x1255('0x5b'),'defaultFavicon'],'raw':!![]});})[_0x1255('0x19')](handleEntityNotFound(_0x760933,null))['then'](function(_0x2a6bb7){if(_0x2a6bb7){var _0x39dd5f=_0x2a6bb7[_0x1255('0x58')]&&fs['existsSync'](path[_0x1255('0x5c')](config[_0x1255('0x5d')],_0x596495,_[_0x1255('0x5e')](_0x2a6bb7['favicon'])))?path[_0x1255('0x5c')](config['root'],_0x596495,_['toLower'](_0x2a6bb7[_0x1255('0x58')])):path[_0x1255('0x5c')](config[_0x1255('0x5d')],_0x596495,_['toLower'](_0x1255('0x70')));var _0x1a799f=_0x1255('0x5f')+_[_0x1255('0x60')](_0x1255('0x58'));if(_0x2a6bb7[_0x1a799f]||!_0x16db68[_0x1255('0x61')]){_0x39dd5f=path[_0x1255('0x5c')](config['root'],_0x596495,_[_0x1255('0x5e')]('default_favicon.ico'));}if(!fs['existsSync'](_0x39dd5f)){throw new db[(_0x1255('0x64'))][(_0x1255('0x65'))](_[_0x1255('0x60')]('favicon')+_0x1255('0x6b'));}return _0x760933[_0x1255('0x66')](_0x39dd5f);}})[_0x1255('0x23')](handleError(_0x760933,null));};exports[_0x1255('0x71')]=function(_0xfb577b,_0x46d45b){var _0x41018e={'offset':moment()[_0x1255('0x72')]()};_0x41018e[_0x1255('0x73')]=moment()[_0x1255('0x72')](_0x41018e['offset'])[_0x1255('0x74')](_0x1255('0x75'));return _0x46d45b[_0x1255('0x2a')](0xc8)[_0x1255('0x34')](_0x41018e);}; \ No newline at end of file +var _0x6c50=['../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','Setting','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','fields','length','model','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','body','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','logo','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','\x20not\x20found','download','getLogoLogin','defaultLogo','default_loginLogo.svg','Sequelize','ValidationError','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0x6c50,0xe2));var _0x06c5=function(_0x51b496,_0x2f6fd4){_0x51b496=_0x51b496-0x0;var _0x2ce7a5=_0x6c50[_0x51b496];return _0x2ce7a5;};'use strict';var emlformat=require(_0x06c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x06c5('0x1'));var jsonpatch=require(_0x06c5('0x2'));var rp=require(_0x06c5('0x3'));var moment=require(_0x06c5('0x4'));var BPromise=require(_0x06c5('0x5'));var Mustache=require('mustache');var util=require(_0x06c5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x06c5('0x7'));var ejs=require(_0x06c5('0x8'));var fs=require('fs');var fs_extra=require(_0x06c5('0x9'));var _=require(_0x06c5('0xa'));var squel=require(_0x06c5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x06c5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x06c5('0xd'));var Redis=require(_0x06c5('0xe'));var authService=require(_0x06c5('0xf'));var qs=require(_0x06c5('0x10'));var as=require(_0x06c5('0x11'));var hardwareService=require(_0x06c5('0x12'));var logger=require(_0x06c5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x06c5('0x14'));var licenseUtil=require(_0x06c5('0x15'));var db=require(_0x06c5('0x16'))['db'];var jayson=require(_0x06c5('0x17'));var client=jayson[_0x06c5('0x18')][_0x06c5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x51711f,_0x5dc3f3,_0x1da54a,_0xe6b8a4){return new BPromise(function(_0x1dfd94,_0x4f563a){var _0x5bca66=_0xe6b8a4||client;return _0x5bca66[_0x06c5('0x1a')](_0x51711f,_0x1da54a)[_0x06c5('0x1b')](function(_0x5eb3db){logger[_0x06c5('0x1c')](_0x06c5('0x1d'),_0x5dc3f3,_0x06c5('0x1e'));logger[_0x06c5('0x1f')](_0x06c5('0x20'),_0x5dc3f3,_0x06c5('0x1e'),JSON[_0x06c5('0x21')](_0x5eb3db));if(_0x5eb3db[_0x06c5('0x22')]){if(_0x5eb3db[_0x06c5('0x22')][_0x06c5('0x23')]===0x1f4){logger[_0x06c5('0x22')](_0x06c5('0x1d'),_0x5dc3f3,_0x5eb3db[_0x06c5('0x22')][_0x06c5('0x24')]);return _0x4f563a(_0x5eb3db['error'][_0x06c5('0x24')]);}logger[_0x06c5('0x22')]('Setting,\x20%s,\x20%s',_0x5dc3f3,_0x5eb3db[_0x06c5('0x22')]['message']);return _0x1dfd94(_0x5eb3db[_0x06c5('0x22')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x5dc3f3,_0x06c5('0x1e'));_0x1dfd94(_0x5eb3db[_0x06c5('0x25')][_0x06c5('0x24')]);}})[_0x06c5('0x26')](function(_0xe50cc8){logger[_0x06c5('0x22')](_0x06c5('0x1d'),_0x5dc3f3,_0xe50cc8);_0x4f563a(_0xe50cc8);});});}function respondWithStatusCode(_0x1bc8f0,_0x4b7e83){_0x4b7e83=_0x4b7e83||0xcc;return function(_0x345dc6){if(_0x345dc6){return _0x1bc8f0[_0x06c5('0x27')](_0x4b7e83);}return _0x1bc8f0['status'](_0x4b7e83)[_0x06c5('0x28')]();};}function respondWithResult(_0x563d61,_0x2fe735){_0x2fe735=_0x2fe735||0xc8;return function(_0x4fa80d){if(_0x4fa80d){return _0x563d61['status'](_0x2fe735)[_0x06c5('0x29')](_0x4fa80d);}};}function respondWithFilteredResult(_0x41c486,_0x1222f8){return function(_0x2b38f7){if(_0x2b38f7){var _0x576040=typeof _0x1222f8[_0x06c5('0x2a')]===_0x06c5('0x2b')&&typeof _0x1222f8['limit']===_0x06c5('0x2b');var _0x1862cc=_0x2b38f7['count'];var _0x461f5b=_0x576040?0x0:_0x1222f8['offset'];var _0x18c960=_0x576040?_0x2b38f7[_0x06c5('0x2c')]:_0x1222f8[_0x06c5('0x2a')]+_0x1222f8[_0x06c5('0x2d')];var _0x2bdea8;if(_0x18c960>=_0x1862cc){_0x18c960=_0x1862cc;_0x2bdea8=0xc8;}else{_0x2bdea8=0xce;}_0x41c486[_0x06c5('0x2e')](_0x2bdea8);return _0x41c486[_0x06c5('0x2f')](_0x06c5('0x30'),_0x461f5b+'-'+_0x18c960+'/'+_0x1862cc)['json'](_0x2b38f7);}return null;};}function patchUpdates(_0x597dbf){return function(_0x1bfa56){try{jsonpatch[_0x06c5('0x31')](_0x1bfa56,_0x597dbf,!![]);}catch(_0x22c12e){return BPromise[_0x06c5('0x32')](_0x22c12e);}return _0x1bfa56['save']();};}function saveUpdates(_0x11c1b7,_0x76cd5b){return function(_0x533e72){if(_0x533e72){return _0x533e72[_0x06c5('0x33')](_0x11c1b7)[_0x06c5('0x1b')](function(_0x1fbcb3){return _0x1fbcb3;});}return null;};}function removeEntity(_0x1d55c6,_0x5970e1){return function(_0xc44722){if(_0xc44722){return _0xc44722[_0x06c5('0x34')]()[_0x06c5('0x1b')](function(){_0x1d55c6[_0x06c5('0x2e')](0xcc)[_0x06c5('0x28')]();});}};}function handleEntityNotFound(_0x4573e0,_0x4c484c){return function(_0x483480){if(!_0x483480){_0x4573e0[_0x06c5('0x27')](0x194);}return _0x483480;};}function handleError(_0x5cf4be,_0xcf48b6){_0xcf48b6=_0xcf48b6||0x1f4;return function(_0x4cc659){logger[_0x06c5('0x22')](_0x4cc659[_0x06c5('0x35')]);if(_0x4cc659[_0x06c5('0x36')]){delete _0x4cc659[_0x06c5('0x36')];}_0x5cf4be[_0x06c5('0x2e')](_0xcf48b6)[_0x06c5('0x37')](_0x4cc659);};}exports[_0x06c5('0x38')]=function(_0x1d2a7f,_0x4f37e7){var _0x245b5c={},_0x5df179={},_0x147962={'count':0x0,'rows':[]};var _0x8337b5=_['map'](db[_0x06c5('0x39')][_0x06c5('0x3a')],function(_0x1b96a6){return{'name':_0x1b96a6[_0x06c5('0x3b')],'type':_0x1b96a6[_0x06c5('0x3c')]['key']};});_0x5df179['model']=_[_0x06c5('0x3d')](_0x8337b5,_0x06c5('0x36'));_0x5df179[_0x06c5('0x3e')]=_[_0x06c5('0x3f')](_0x1d2a7f[_0x06c5('0x3e')]);_0x5df179[_0x06c5('0x40')]=_[_0x06c5('0x41')](_0x5df179['model'],_0x5df179['query']);_0x245b5c[_0x06c5('0x42')]=_[_0x06c5('0x41')](_0x5df179['model'],qs['fields'](_0x1d2a7f['query'][_0x06c5('0x43')]));_0x245b5c['attributes']=_0x245b5c[_0x06c5('0x42')][_0x06c5('0x44')]?_0x245b5c['attributes']:_0x5df179[_0x06c5('0x45')];if(!_0x1d2a7f[_0x06c5('0x3e')]['hasOwnProperty'](_0x06c5('0x46'))){_0x245b5c[_0x06c5('0x2d')]=qs[_0x06c5('0x2d')](_0x1d2a7f[_0x06c5('0x3e')]['limit']);_0x245b5c[_0x06c5('0x2a')]=qs[_0x06c5('0x2a')](_0x1d2a7f[_0x06c5('0x3e')]['offset']);}_0x245b5c['order']=qs[_0x06c5('0x47')](_0x1d2a7f['query'][_0x06c5('0x47')]);_0x245b5c[_0x06c5('0x48')]=qs[_0x06c5('0x40')](_[_0x06c5('0x49')](_0x1d2a7f[_0x06c5('0x3e')],_0x5df179[_0x06c5('0x40')]),_0x8337b5);if(_0x1d2a7f[_0x06c5('0x3e')]['filter']){_0x245b5c[_0x06c5('0x48')]=_['merge'](_0x245b5c[_0x06c5('0x48')],{'$or':_[_0x06c5('0x3d')](_0x8337b5,function(_0x6e7383){if(_0x6e7383[_0x06c5('0x3c')]!==_0x06c5('0x4a')){var _0x5b05c5={};_0x5b05c5[_0x6e7383[_0x06c5('0x36')]]={'$like':'%'+_0x1d2a7f[_0x06c5('0x3e')][_0x06c5('0x4b')]+'%'};return _0x5b05c5;}})});}_0x245b5c=_['merge']({},_0x245b5c,_0x1d2a7f[_0x06c5('0x4c')]);var _0x2803ed={'where':_0x245b5c['where']};return db[_0x06c5('0x39')][_0x06c5('0x2c')](_0x2803ed)[_0x06c5('0x1b')](function(_0x3cff70){_0x147962[_0x06c5('0x2c')]=_0x3cff70;if(_0x1d2a7f['query'][_0x06c5('0x4d')]){_0x245b5c[_0x06c5('0x4e')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x245b5c);})['then'](function(_0x295eb3){_0x147962[_0x06c5('0x4f')]=_0x295eb3;return _0x147962;})[_0x06c5('0x1b')](respondWithFilteredResult(_0x4f37e7,_0x245b5c))[_0x06c5('0x26')](handleError(_0x4f37e7,null));};exports[_0x06c5('0x50')]=function(_0x301260,_0x3cf136){var _0x2d41c3={'raw':![],'where':{'id':_0x301260[_0x06c5('0x51')]['id']}},_0x423c3f={};_0x423c3f[_0x06c5('0x45')]=_[_0x06c5('0x3f')](db[_0x06c5('0x39')][_0x06c5('0x3a')]);_0x423c3f[_0x06c5('0x3e')]=_['keys'](_0x301260[_0x06c5('0x3e')]);_0x423c3f['filters']=_['intersection'](_0x423c3f[_0x06c5('0x45')],_0x423c3f['query']);_0x2d41c3[_0x06c5('0x42')]=_[_0x06c5('0x41')](_0x423c3f[_0x06c5('0x45')],qs[_0x06c5('0x43')](_0x301260[_0x06c5('0x3e')][_0x06c5('0x43')]));_0x2d41c3[_0x06c5('0x42')]=_0x2d41c3[_0x06c5('0x42')][_0x06c5('0x44')]?_0x2d41c3[_0x06c5('0x42')]:_0x423c3f[_0x06c5('0x45')];if(_0x301260['query'][_0x06c5('0x4d')]){_0x2d41c3['include']=[{'all':!![]}];}_0x2d41c3=_['merge']({},_0x2d41c3,_0x301260['options']);return db['Setting'][_0x06c5('0x52')](_0x2d41c3)['then'](handleEntityNotFound(_0x3cf136,null))[_0x06c5('0x1b')](respondWithResult(_0x3cf136,null))[_0x06c5('0x26')](handleError(_0x3cf136,null));};exports[_0x06c5('0x33')]=function(_0x47cd75,_0x51ce86){if(_0x47cd75['body']['id']){delete _0x47cd75[_0x06c5('0x53')]['id'];}return db[_0x06c5('0x39')][_0x06c5('0x52')]({'where':{'id':_0x47cd75[_0x06c5('0x51')]['id']}})[_0x06c5('0x1b')](handleEntityNotFound(_0x51ce86,null))[_0x06c5('0x1b')](saveUpdates(_0x47cd75[_0x06c5('0x53')],null))[_0x06c5('0x1b')](respondWithResult(_0x51ce86,null))[_0x06c5('0x26')](handleError(_0x51ce86,null));};exports['addLogo']=function(_0x2cb49a,_0x33e8d0,_0x44e7ad){if(_0x2cb49a[_0x06c5('0x54')]&&_0x2cb49a[_0x06c5('0x54')][_0x06c5('0x55')]){_0x2cb49a[_0x06c5('0x53')]['logo']=_0x2cb49a[_0x06c5('0x54')]['filename'];}return db['Setting'][_0x06c5('0x52')]({'where':{'id':_0x2cb49a[_0x06c5('0x51')]['id']}})[_0x06c5('0x1b')](handleEntityNotFound(_0x33e8d0,null))[_0x06c5('0x1b')](saveUpdates(_0x2cb49a[_0x06c5('0x53')],null))[_0x06c5('0x1b')](respondWithResult(_0x33e8d0,null))[_0x06c5('0x26')](handleError(_0x33e8d0,null));};exports[_0x06c5('0x56')]=function(_0x53ef9c,_0x1c15da,_0x1ca2bd){if(_0x53ef9c[_0x06c5('0x54')]&&_0x53ef9c[_0x06c5('0x54')]['filename']){_0x53ef9c[_0x06c5('0x53')][_0x06c5('0x57')]=_0x53ef9c[_0x06c5('0x54')]['filename'];}return db[_0x06c5('0x39')][_0x06c5('0x52')]({'where':{'id':_0x53ef9c[_0x06c5('0x51')]['id']}})[_0x06c5('0x1b')](handleEntityNotFound(_0x1c15da,null))[_0x06c5('0x1b')](saveUpdates(_0x53ef9c[_0x06c5('0x53')],null))[_0x06c5('0x1b')](respondWithResult(_0x1c15da,null))['catch'](handleError(_0x1c15da,null));};var utilLicense=require(_0x06c5('0x15'));exports[_0x06c5('0x58')]=function(_0xe64251,_0xc2980a,_0xae5471){var _0x422cff=_0x06c5('0x59');var _0x1ba985={'custom':![]};return utilLicense[_0x06c5('0x5a')]()[_0x06c5('0x1b')](function(_0x14568d){if(_0x14568d){_0x1ba985=_0x14568d;}return db[_0x06c5('0x39')][_0x06c5('0x52')]({'where':{'id':_0xe64251['params']['id']},'attributes':['logo',_0x06c5('0x57'),_0x06c5('0x5b'),_0x06c5('0x5c'),'defaultLogo',_0x06c5('0x5d'),_0x06c5('0x5e'),_0x06c5('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0xc2980a,null))[_0x06c5('0x1b')](function(_0x50c466){if(_0x50c466){var _0x454491=_0x50c466[_0x06c5('0x60')]&&fs[_0x06c5('0x61')](path[_0x06c5('0x62')](config[_0x06c5('0x63')],_0x422cff,_['toLower'](_0x50c466['logo'])))?path['join'](config[_0x06c5('0x63')],_0x422cff,_[_0x06c5('0x64')](_0x50c466[_0x06c5('0x60')])):path[_0x06c5('0x62')](config[_0x06c5('0x63')],_0x422cff,_['toLower'](_0x06c5('0x65')));var _0xe04ffe=_0x06c5('0x66')+_[_0x06c5('0x67')](_0x06c5('0x60'));if(_0x50c466[_0xe04ffe]||!_0x1ba985[_0x06c5('0x68')]){_0x454491=path['join'](config[_0x06c5('0x63')],_0x422cff,_[_0x06c5('0x64')]('default_logo.svg'));}if(!fs['existsSync'](_0x454491)){throw new db['Sequelize']['ValidationError'](_[_0x06c5('0x67')]('logo')+_0x06c5('0x69'));}return _0xc2980a[_0x06c5('0x6a')](_0x454491);}})['catch'](handleError(_0xc2980a,null));};var utilLicense=require(_0x06c5('0x15'));exports[_0x06c5('0x6b')]=function(_0x299340,_0x448b0e,_0x302601){var _0x59ed70=_0x06c5('0x59');var _0x18107e={'custom':![]};return utilLicense[_0x06c5('0x5a')]()[_0x06c5('0x1b')](function(_0x4f4a42){if(_0x4f4a42){_0x18107e=_0x4f4a42;}return db[_0x06c5('0x39')]['find']({'where':{'id':_0x299340['params']['id']},'attributes':[_0x06c5('0x60'),_0x06c5('0x57'),_0x06c5('0x5b'),_0x06c5('0x5c'),_0x06c5('0x6c'),_0x06c5('0x5d'),_0x06c5('0x5e'),_0x06c5('0x5f')],'raw':!![]});})[_0x06c5('0x1b')](handleEntityNotFound(_0x448b0e,null))[_0x06c5('0x1b')](function(_0x19a463){if(_0x19a463){var _0x365569=_0x19a463[_0x06c5('0x57')]&&fs[_0x06c5('0x61')](path['join'](config[_0x06c5('0x63')],_0x59ed70,_['toLower'](_0x19a463['loginLogo'])))?path[_0x06c5('0x62')](config[_0x06c5('0x63')],_0x59ed70,_[_0x06c5('0x64')](_0x19a463[_0x06c5('0x57')])):path[_0x06c5('0x62')](config[_0x06c5('0x63')],_0x59ed70,_[_0x06c5('0x64')](_0x06c5('0x6d')));var _0x10ba5d=_0x06c5('0x66')+_[_0x06c5('0x67')]('loginLogo');if(_0x19a463[_0x10ba5d]||!_0x18107e[_0x06c5('0x68')]){_0x365569=path[_0x06c5('0x62')](config['root'],_0x59ed70,_[_0x06c5('0x64')](_0x06c5('0x6d')));}if(!fs[_0x06c5('0x61')](_0x365569)){throw new db[(_0x06c5('0x6e'))][(_0x06c5('0x6f'))](_[_0x06c5('0x67')]('loginLogo')+_0x06c5('0x69'));}return _0x448b0e[_0x06c5('0x6a')](_0x365569);}})[_0x06c5('0x26')](handleError(_0x448b0e,null));};exports[_0x06c5('0x70')]=function(_0x2c47c9,_0x35f9fd){return db[_0x06c5('0x39')][_0x06c5('0x52')]({'where':{'id':_0x2c47c9[_0x06c5('0x51')]['id']},'attributes':[_0x06c5('0x71')]})[_0x06c5('0x1b')](respondWithResult(_0x35f9fd,null))[_0x06c5('0x26')](handleError(_0x35f9fd,null));};exports[_0x06c5('0x72')]=function(_0x3d6d6c,_0x1e7e43,_0x4b7fe9){if(_0x3d6d6c[_0x06c5('0x54')]&&_0x3d6d6c[_0x06c5('0x54')][_0x06c5('0x55')]){_0x3d6d6c[_0x06c5('0x53')]['preferred']=_0x3d6d6c[_0x06c5('0x54')][_0x06c5('0x55')];}return db[_0x06c5('0x39')][_0x06c5('0x52')]({'where':{'id':_0x3d6d6c[_0x06c5('0x51')]['id']}})['then'](handleEntityNotFound(_0x1e7e43,null))[_0x06c5('0x1b')](saveUpdates(_0x3d6d6c[_0x06c5('0x53')],null))[_0x06c5('0x1b')](respondWithResult(_0x1e7e43,null))[_0x06c5('0x26')](handleError(_0x1e7e43,null));};var utilLicense=require(_0x06c5('0x15'));exports[_0x06c5('0x73')]=function(_0x304cfb,_0x570670,_0x154578){var _0x438923=_0x06c5('0x59');var _0x34d5dc={'custom':![]};return utilLicense[_0x06c5('0x5a')]()[_0x06c5('0x1b')](function(_0x2613e7){if(_0x2613e7){_0x34d5dc=_0x2613e7;}return db[_0x06c5('0x39')]['find']({'where':{'id':_0x304cfb[_0x06c5('0x51')]['id']},'attributes':[_0x06c5('0x60'),_0x06c5('0x57'),_0x06c5('0x5b'),'favicon',_0x06c5('0x6c'),'defaultLoginLogo','defaultPreferred',_0x06c5('0x5f')],'raw':!![]});})[_0x06c5('0x1b')](handleEntityNotFound(_0x570670,null))[_0x06c5('0x1b')](function(_0x3bf5e1){if(_0x3bf5e1){var _0x3f87a7=_0x3bf5e1[_0x06c5('0x5b')]&&fs[_0x06c5('0x61')](path[_0x06c5('0x62')](config[_0x06c5('0x63')],_0x438923,_[_0x06c5('0x64')](_0x3bf5e1[_0x06c5('0x5b')])))?path[_0x06c5('0x62')](config[_0x06c5('0x63')],_0x438923,_[_0x06c5('0x64')](_0x3bf5e1[_0x06c5('0x5b')])):path['join'](config[_0x06c5('0x63')],_0x438923,_[_0x06c5('0x64')](_0x06c5('0x74')));var _0x28b8ae=_0x06c5('0x66')+_[_0x06c5('0x67')](_0x06c5('0x5b'));if(_0x3bf5e1[_0x28b8ae]||!_0x34d5dc['custom']||!_0x34d5dc[_0x06c5('0x5b')]){_0x3f87a7=path[_0x06c5('0x62')](config[_0x06c5('0x63')],_0x438923,_['toLower'](_0x06c5('0x74')));}if(!fs['existsSync'](_0x3f87a7)){throw new db['Sequelize'][(_0x06c5('0x6f'))](_[_0x06c5('0x67')](_0x06c5('0x5b'))+_0x06c5('0x69'));}return _0x570670[_0x06c5('0x6a')](_0x3f87a7);}})['catch'](handleError(_0x570670,null));};exports[_0x06c5('0x75')]=function(_0x405e7d,_0x5938b2,_0x50cfad){if(_0x405e7d[_0x06c5('0x54')]&&_0x405e7d[_0x06c5('0x54')][_0x06c5('0x55')]){_0x405e7d['body'][_0x06c5('0x5c')]=_0x405e7d[_0x06c5('0x54')]['filename'];}return db[_0x06c5('0x39')][_0x06c5('0x52')]({'where':{'id':_0x405e7d[_0x06c5('0x51')]['id']}})['then'](handleEntityNotFound(_0x5938b2,null))[_0x06c5('0x1b')](saveUpdates(_0x405e7d[_0x06c5('0x53')],null))[_0x06c5('0x1b')](respondWithResult(_0x5938b2,null))[_0x06c5('0x26')](handleError(_0x5938b2,null));};var utilLicense=require(_0x06c5('0x15'));exports[_0x06c5('0x76')]=function(_0x2f90be,_0xfa8ce4,_0x10a481){var _0x1f1abf='server/files/images/logos';var _0x46fbfd={'custom':![]};return utilLicense['getLicense']()[_0x06c5('0x1b')](function(_0x5c20d3){if(_0x5c20d3){_0x46fbfd=_0x5c20d3;}return db[_0x06c5('0x39')][_0x06c5('0x52')]({'where':{'id':_0x2f90be[_0x06c5('0x51')]['id']},'attributes':[_0x06c5('0x60'),_0x06c5('0x57'),_0x06c5('0x5b'),_0x06c5('0x5c'),_0x06c5('0x6c'),_0x06c5('0x5d'),'defaultPreferred',_0x06c5('0x5f')],'raw':!![]});})[_0x06c5('0x1b')](handleEntityNotFound(_0xfa8ce4,null))['then'](function(_0x2c6cb1){if(_0x2c6cb1){var _0x123340=_0x2c6cb1[_0x06c5('0x5c')]&&fs[_0x06c5('0x61')](path[_0x06c5('0x62')](config[_0x06c5('0x63')],_0x1f1abf,_[_0x06c5('0x64')](_0x2c6cb1['favicon'])))?path['join'](config['root'],_0x1f1abf,_[_0x06c5('0x64')](_0x2c6cb1[_0x06c5('0x5c')])):path['join'](config[_0x06c5('0x63')],_0x1f1abf,_[_0x06c5('0x64')](_0x06c5('0x77')));var _0x4a02e8=_0x06c5('0x66')+_[_0x06c5('0x67')](_0x06c5('0x5c'));if(_0x2c6cb1[_0x4a02e8]||!_0x46fbfd['custom']){_0x123340=path[_0x06c5('0x62')](config[_0x06c5('0x63')],_0x1f1abf,_[_0x06c5('0x64')](_0x06c5('0x77')));}if(!fs[_0x06c5('0x61')](_0x123340)){throw new db[(_0x06c5('0x6e'))][(_0x06c5('0x6f'))](_[_0x06c5('0x67')](_0x06c5('0x5c'))+_0x06c5('0x69'));}return _0xfa8ce4[_0x06c5('0x6a')](_0x123340);}})[_0x06c5('0x26')](handleError(_0xfa8ce4,null));};exports['getDate']=function(_0x2cd7fd,_0x1c351f){var _0x405fe6={'offset':moment()[_0x06c5('0x78')]()};_0x405fe6['now']=moment()[_0x06c5('0x78')](_0x405fe6['offset'])['format'](_0x06c5('0x79'));return _0x1c351f['status'](0xc8)[_0x06c5('0x37')](_0x405fe6);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index b381b1c..8ae5e04 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x7217,0x19e));var _0x7721=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x7217[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_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 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 101579e..58d38db 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 _0xef4f=['../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSetting','Setting','find','options','raw','attributes','map','include','model','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x48b79e,_0x17eeed){var _0x4b3bdd=function(_0x5af3d7){while(--_0x5af3d7){_0x48b79e['push'](_0x48b79e['shift']());}};_0x4b3bdd(++_0x17eeed);}(_0xef4f,0x1cb));var _0xfef4=function(_0xb095e4,_0x46029a){_0xb095e4=_0xb095e4-0x0;var _0x2d50bf=_0xef4f[_0xb095e4];return _0x2d50bf;};'use strict';var _=require(_0xfef4('0x0'));var util=require(_0xfef4('0x1'));var moment=require('moment');var BPromise=require(_0xfef4('0x2'));var rs=require(_0xfef4('0x3'));var fs=require('fs');var Redis=require(_0xfef4('0x4'));var db=require(_0xfef4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfef4('0x6'))('rpc');var config=require(_0xfef4('0x7'));var jayson=require(_0xfef4('0x8'));var client=jayson['client'][_0xfef4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4072e4,_0x2c4779,_0x1c2a7c){return new BPromise(function(_0x33dbcd,_0x27611d){return client[_0xfef4('0xa')](_0x4072e4,_0x1c2a7c)[_0xfef4('0xb')](function(_0x49068){logger[_0xfef4('0xc')](_0xfef4('0xd'),_0x2c4779,_0xfef4('0xe'));logger[_0xfef4('0xf')](_0xfef4('0x10'),_0x2c4779,'request\x20sent',JSON[_0xfef4('0x11')](_0x49068));if(_0x49068[_0xfef4('0x12')]){if(_0x49068[_0xfef4('0x12')][_0xfef4('0x13')]===0x1f4){logger[_0xfef4('0x12')](_0xfef4('0xd'),_0x2c4779,_0x49068['error'][_0xfef4('0x14')]);return _0x27611d(_0x49068['error'][_0xfef4('0x14')]);}logger[_0xfef4('0x12')](_0xfef4('0xd'),_0x2c4779,_0x49068[_0xfef4('0x12')][_0xfef4('0x14')]);return _0x33dbcd(_0x49068['error'][_0xfef4('0x14')]);}else{logger[_0xfef4('0xc')](_0xfef4('0xd'),_0x2c4779,_0xfef4('0xe'));_0x33dbcd(_0x49068['result']['message']);}})['catch'](function(_0x4e025c){logger[_0xfef4('0x12')](_0xfef4('0xd'),_0x2c4779,_0x4e025c);_0x27611d(_0x4e025c);});});}exports[_0xfef4('0x15')]=function(_0x2bf9ec){var _0x1ad6e8=this;return new Promise(function(_0x205d73,_0x253281){return db[_0xfef4('0x16')][_0xfef4('0x17')]({'raw':_0x2bf9ec['options']?_0x2bf9ec[_0xfef4('0x18')][_0xfef4('0x19')]===undefined?!![]:![]:!![],'where':_0x2bf9ec[_0xfef4('0x18')]?_0x2bf9ec[_0xfef4('0x18')]['where']||null:null,'attributes':_0x2bf9ec[_0xfef4('0x18')]?_0x2bf9ec[_0xfef4('0x18')][_0xfef4('0x1a')]||null:null,'include':_0x2bf9ec[_0xfef4('0x18')]?_0x2bf9ec[_0xfef4('0x18')]['include']?_[_0xfef4('0x1b')](_0x2bf9ec[_0xfef4('0x18')][_0xfef4('0x1c')],function(_0x4a671b){return{'model':db[_0x4a671b[_0xfef4('0x1d')]],'as':_0x4a671b['as'],'attributes':_0x4a671b[_0xfef4('0x1a')],'include':_0x4a671b[_0xfef4('0x1c')]?_[_0xfef4('0x1b')](_0x4a671b['include'],function(_0x3281b6){return{'model':db[_0x3281b6[_0xfef4('0x1d')]],'as':_0x3281b6['as'],'attributes':_0x3281b6[_0xfef4('0x1a')],'include':_0x3281b6['include']?_['map'](_0x3281b6['include'],function(_0x4cf6ce){return{'model':db[_0x4cf6ce[_0xfef4('0x1d')]],'as':_0x4cf6ce['as'],'attributes':_0x4cf6ce['attributes']};}):[]};}):[]};}):[]:[]})[_0xfef4('0xb')](function(_0x539432){logger['info'](_0xfef4('0x15'),_0x2bf9ec);logger[_0xfef4('0xf')](_0xfef4('0x15'),_0x2bf9ec,JSON['stringify'](_0x539432));_0x205d73(_0x539432);})[_0xfef4('0x1e')](function(_0x496d9e){logger[_0xfef4('0x12')](_0xfef4('0x15'),_0x496d9e[_0xfef4('0x14')],_0x2bf9ec);_0x253281(_0x1ad6e8['error'](0x1f4,_0x496d9e[_0xfef4('0x14')]));});});}; \ No newline at end of file +var _0xec21=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Setting','options','raw','attributes','map','include','model','then','ShowSetting','lodash','bluebird'];(function(_0xec722a,_0x354472){var _0xbb0f9e=function(_0x2a017b){while(--_0x2a017b){_0xec722a['push'](_0xec722a['shift']());}};_0xbb0f9e(++_0x354472);}(_0xec21,0x1da));var _0x1ec2=function(_0x5e32f3,_0x3386c1){_0x5e32f3=_0x5e32f3-0x0;var _0x4d4e03=_0xec21[_0x5e32f3];return _0x4d4e03;};'use strict';var _=require(_0x1ec2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1ec2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ec2('0x2'))['db'];var utils=require(_0x1ec2('0x3'));var logger=require('../../config/logger')(_0x1ec2('0x4'));var config=require('../../config/environment');var jayson=require(_0x1ec2('0x5'));var client=jayson[_0x1ec2('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31f5c2,_0x13e0c3,_0x5687bd){return new BPromise(function(_0x444020,_0x42223c){return client[_0x1ec2('0x7')](_0x31f5c2,_0x5687bd)['then'](function(_0x36e0f5){logger['info'](_0x1ec2('0x8'),_0x13e0c3,_0x1ec2('0x9'));logger[_0x1ec2('0xa')](_0x1ec2('0xb'),_0x13e0c3,_0x1ec2('0x9'),JSON[_0x1ec2('0xc')](_0x36e0f5));if(_0x36e0f5['error']){if(_0x36e0f5[_0x1ec2('0xd')][_0x1ec2('0xe')]===0x1f4){logger[_0x1ec2('0xd')](_0x1ec2('0x8'),_0x13e0c3,_0x36e0f5[_0x1ec2('0xd')]['message']);return _0x42223c(_0x36e0f5[_0x1ec2('0xd')][_0x1ec2('0xf')]);}logger[_0x1ec2('0xd')](_0x1ec2('0x8'),_0x13e0c3,_0x36e0f5['error'][_0x1ec2('0xf')]);return _0x444020(_0x36e0f5[_0x1ec2('0xd')][_0x1ec2('0xf')]);}else{logger[_0x1ec2('0x10')](_0x1ec2('0x8'),_0x13e0c3,_0x1ec2('0x9'));_0x444020(_0x36e0f5[_0x1ec2('0x11')]['message']);}})[_0x1ec2('0x12')](function(_0x582200){logger['error']('Setting,\x20%s,\x20%s',_0x13e0c3,_0x582200);_0x42223c(_0x582200);});});}exports['ShowSetting']=function(_0x29f144){var _0x5be4fd=this;return new Promise(function(_0x577f58,_0x4f52d4){return db[_0x1ec2('0x13')]['find']({'raw':_0x29f144[_0x1ec2('0x14')]?_0x29f144[_0x1ec2('0x14')][_0x1ec2('0x15')]===undefined?!![]:![]:!![],'where':_0x29f144[_0x1ec2('0x14')]?_0x29f144['options']['where']||null:null,'attributes':_0x29f144['options']?_0x29f144['options'][_0x1ec2('0x16')]||null:null,'include':_0x29f144[_0x1ec2('0x14')]?_0x29f144[_0x1ec2('0x14')]['include']?_[_0x1ec2('0x17')](_0x29f144['options'][_0x1ec2('0x18')],function(_0x4e3f99){return{'model':db[_0x4e3f99['model']],'as':_0x4e3f99['as'],'attributes':_0x4e3f99[_0x1ec2('0x16')],'include':_0x4e3f99['include']?_[_0x1ec2('0x17')](_0x4e3f99[_0x1ec2('0x18')],function(_0x25148d){return{'model':db[_0x25148d[_0x1ec2('0x19')]],'as':_0x25148d['as'],'attributes':_0x25148d[_0x1ec2('0x16')],'include':_0x25148d[_0x1ec2('0x18')]?_[_0x1ec2('0x17')](_0x25148d[_0x1ec2('0x18')],function(_0x5c77ba){return{'model':db[_0x5c77ba[_0x1ec2('0x19')]],'as':_0x5c77ba['as'],'attributes':_0x5c77ba[_0x1ec2('0x16')]};}):[]};}):[]};}):[]:[]})[_0x1ec2('0x1a')](function(_0x41cd10){logger['info'](_0x1ec2('0x1b'),_0x29f144);logger[_0x1ec2('0xa')](_0x1ec2('0x1b'),_0x29f144,JSON[_0x1ec2('0xc')](_0x41cd10));_0x577f58(_0x41cd10);})[_0x1ec2('0x12')](function(_0x588b85){logger['error'](_0x1ec2('0x1b'),_0x588b85[_0x1ec2('0xf')],_0x29f144);_0x4f52d4(_0x5be4fd[_0x1ec2('0xd')](0x1f4,_0x588b85[_0x1ec2('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 05c79c2..aaf906e 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x3bf0f8,_0x3a8e51){var _0x5264d7=function(_0x5e4826){while(--_0x5e4826){_0x3bf0f8['push'](_0x3bf0f8['shift']());}};_0x5264d7(++_0x3a8e51);}(_0x7a54,0x106));var _0x47a5=function(_0x2c6409,_0xc9a842){_0x2c6409=_0x2c6409-0x0;var _0x3f1d22=_0x7a54[_0x2c6409];return _0x3f1d22;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x110e09,_0x4e5a2e){var _0x4280f5=function(_0x52e809){while(--_0x52e809){_0x110e09['push'](_0x110e09['shift']());}};_0x4280f5(++_0x4e5a2e);}(_0x7a54,0x106));var _0x47a5=function(_0x23d8b1,_0x535b11){_0x23d8b1=_0x23d8b1-0x0;var _0xb70039=_0x7a54[_0x23d8b1];return _0xb70039;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 31db420..86d2fbc 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 _0x8885=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','ENUM','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8885,0x1bb));var _0x5888=function(_0xad2ab5,_0x488485){_0xad2ab5=_0xad2ab5-0x0;var _0x2ab966=_0x8885[_0xad2ab5];return _0x2ab966;};'use strict';var Sequelize=require(_0x5888('0x0'));var rs=require(_0x5888('0x1'));module[_0x5888('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x5888('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x5888('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x5888('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5888('0x4')]('twilio',_0x5888('0x5'),_0x5888('0x6'),_0x5888('0x7'),_0x5888('0x8'),_0x5888('0x9'),'bandwidth',_0x5888('0xa'),_0x5888('0xb'),_0x5888('0xc'))},'accountSid':{'type':Sequelize[_0x5888('0x3')]},'authId':{'type':Sequelize[_0x5888('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x5888('0x3')]},'password':{'type':Sequelize[_0x5888('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x5888('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x5888('0x3')]},'deliveryReport':{'type':Sequelize[_0x5888('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x5888('0xe')],'defaultValue':function(){return _0x5888('0xf');}},'notificationSound':{'type':Sequelize[_0x5888('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5888('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5888('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5888('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5888('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5888('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5888('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5888('0x10')],'comment':_0x5888('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5888('0x12'),'set':function(_0x4efc6e){if(!_0x4efc6e)this[_0x5888('0x13')](_0x5888('0x14'),null);this[_0x5888('0x13')](_0x5888('0x15'),_0x4efc6e);}}}; \ No newline at end of file +var _0xb061=['clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','skebby','connectel','clicksend','plivo'];(function(_0x3bcf2f,_0x2b3938){var _0x4030a2=function(_0x295613){while(--_0x295613){_0x3bcf2f['push'](_0x3bcf2f['shift']());}};_0x4030a2(++_0x2b3938);}(_0xb061,0xe5));var _0x1b06=function(_0x26a2bd,_0x26eba2){_0x26a2bd=_0x26a2bd-0x0;var _0x40410e=_0xb061[_0x26a2bd];return _0x40410e;};'use strict';var Sequelize=require(_0x1b06('0x0'));var rs=require(_0x1b06('0x1'));module[_0x1b06('0x2')]={'name':{'type':Sequelize[_0x1b06('0x3')],'unique':_0x1b06('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x1b06('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x1b06('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x1b06('0x3')],'defaultValue':function(){return rs[_0x1b06('0x5')]();}},'phone':{'type':Sequelize[_0x1b06('0x3')]},'type':{'type':Sequelize[_0x1b06('0x6')]('twilio',_0x1b06('0x7'),_0x1b06('0x8'),_0x1b06('0x9'),_0x1b06('0xa'),_0x1b06('0xb'),_0x1b06('0xc'),_0x1b06('0xd'),_0x1b06('0xe'),_0x1b06('0xf'))},'accountSid':{'type':Sequelize[_0x1b06('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x1b06('0x3')]},'smsMethod':{'type':Sequelize[_0x1b06('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x1b06('0x3')]},'password':{'type':Sequelize[_0x1b06('0x3')]},'apiKey':{'type':Sequelize[_0x1b06('0x3')]},'applicationId':{'type':Sequelize[_0x1b06('0x3')]},'accountId':{'type':Sequelize[_0x1b06('0x3')]},'senderString':{'type':Sequelize[_0x1b06('0x3')]},'deliveryReport':{'type':Sequelize[_0x1b06('0x10')],'defaultValue':![]},'description':{'type':Sequelize[_0x1b06('0x3')]},'notificationTemplate':{'type':Sequelize[_0x1b06('0x11')],'defaultValue':function(){return _0x1b06('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1b06('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1b06('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'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[_0x1b06('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1b06('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1b06('0x13')],'comment':_0x1b06('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1b06('0x15'),'set':function(_0x28793a){if(!_0x28793a)this[_0x1b06('0x16')](_0x1b06('0x17'),null);this[_0x1b06('0x16')]('mandatoryDisposition',_0x28793a);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 80655b8..9fb2673 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 _0x4c53=['from','From','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','replyMessageId','bandwidth','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','ContactId','AttachmentId','UserId','User','agent','SmsQueue','queueId','unshift','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','info','entity\x20found','Content-Type','send','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','SmsApplication','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','SmsMessage','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','DELIVERED','clickatell','error_code','message-delivered','intelepeer','DELIVRD','ACCEPTD','statusGet','message-id','addAgents','omit','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','SmsAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','SmsAccount','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','rawAttributes','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','addDisposition','SmsAccountId','Disposition','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','Applications','account','applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio'];(function(_0x5b2a15,_0xd200ec){var _0x33038d=function(_0x4150a2){while(--_0x4150a2){_0x5b2a15['push'](_0x5b2a15['shift']());}};_0x33038d(++_0xd200ec);}(_0x4c53,0x68));var _0x34c5=function(_0x40a20b,_0x45f82d){_0x40a20b=_0x40a20b-0x0;var _0x27897c=_0x4c53[_0x40a20b];return _0x27897c;};'use strict';var emlformat=require(_0x34c5('0x0'));var rimraf=require(_0x34c5('0x1'));var zipdir=require(_0x34c5('0x2'));var jsonpatch=require(_0x34c5('0x3'));var rp=require(_0x34c5('0x4'));var moment=require(_0x34c5('0x5'));var BPromise=require(_0x34c5('0x6'));var Mustache=require('mustache');var util=require(_0x34c5('0x7'));var path=require(_0x34c5('0x8'));var sox=require(_0x34c5('0x9'));var csv=require(_0x34c5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x34c5('0xb'));var _=require('lodash');var squel=require(_0x34c5('0xc'));var crypto=require('crypto');var jsforce=require(_0x34c5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x34c5('0xa'));var querystring=require(_0x34c5('0xe'));var Papa=require(_0x34c5('0xf'));var Redis=require(_0x34c5('0x10'));var authService=require(_0x34c5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34c5('0x12'));var logger=require(_0x34c5('0x13'))(_0x34c5('0x14'));var utils=require('../../config/utils');var config=require(_0x34c5('0x15'));var licenseUtil=require(_0x34c5('0x16'));var db=require(_0x34c5('0x17'))['db'];config[_0x34c5('0x18')]=_['defaults'](config[_0x34c5('0x18')],{'host':_0x34c5('0x19'),'port':0x18eb});var socket=require(_0x34c5('0x1a'))(new Redis(config['redis']));require(_0x34c5('0x1b'))[_0x34c5('0x1c')](socket);var jayson=require(_0x34c5('0x1d'));var client=jayson[_0x34c5('0x1e')][_0x34c5('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x32f814,_0x3dda46,_0x54e5c8,_0x29f37b){return new BPromise(function(_0x1a842d,_0x97b28a){var _0x171bc5=_0x29f37b||client;return _0x171bc5[_0x34c5('0x20')](_0x32f814,_0x54e5c8)[_0x34c5('0x21')](function(_0x3e1388){logger['info'](_0x34c5('0x22'),_0x3dda46,'request\x20sent');logger[_0x34c5('0x23')](_0x34c5('0x24'),_0x3dda46,_0x34c5('0x25'),JSON[_0x34c5('0x26')](_0x3e1388));if(_0x3e1388['error']){if(_0x3e1388[_0x34c5('0x27')]['code']===0x1f4){logger['error'](_0x34c5('0x22'),_0x3dda46,_0x3e1388[_0x34c5('0x27')][_0x34c5('0x28')]);return _0x97b28a(_0x3e1388[_0x34c5('0x27')][_0x34c5('0x28')]);}logger['error'](_0x34c5('0x22'),_0x3dda46,_0x3e1388[_0x34c5('0x27')][_0x34c5('0x28')]);return _0x1a842d(_0x3e1388['error'][_0x34c5('0x28')]);}else{logger['info'](_0x34c5('0x22'),_0x3dda46,_0x34c5('0x25'));_0x1a842d(_0x3e1388['result'][_0x34c5('0x28')]);}})[_0x34c5('0x29')](function(_0x5a1c7a){logger[_0x34c5('0x27')]('SmsAccount,\x20%s,\x20%s',_0x3dda46,_0x5a1c7a);_0x97b28a(_0x5a1c7a);});});}function respondWithStatusCode(_0x349c6f,_0x200e47){_0x200e47=_0x200e47||0xcc;return function(_0x269ca9){if(_0x269ca9){return _0x349c6f[_0x34c5('0x2a')](_0x200e47);}return _0x349c6f[_0x34c5('0x2b')](_0x200e47)[_0x34c5('0x2c')]();};}function respondWithResult(_0x144cb3,_0x19b8d3){_0x19b8d3=_0x19b8d3||0xc8;return function(_0x4d63d2){if(_0x4d63d2){return _0x144cb3['status'](_0x19b8d3)[_0x34c5('0x2d')](_0x4d63d2);}};}function respondWithFilteredResult(_0x1b5f50,_0x46d70c){return function(_0x106ec9){if(_0x106ec9){var _0x4c37e4=typeof _0x46d70c[_0x34c5('0x2e')]===_0x34c5('0x2f')&&typeof _0x46d70c[_0x34c5('0x30')]==='undefined';var _0x14e3e8=_0x106ec9[_0x34c5('0x31')];var _0x1446f0=_0x4c37e4?0x0:_0x46d70c[_0x34c5('0x2e')];var _0x373193=_0x4c37e4?_0x106ec9[_0x34c5('0x31')]:_0x46d70c[_0x34c5('0x2e')]+_0x46d70c[_0x34c5('0x30')];var _0x535858;if(_0x373193>=_0x14e3e8){_0x373193=_0x14e3e8;_0x535858=0xc8;}else{_0x535858=0xce;}_0x1b5f50[_0x34c5('0x2b')](_0x535858);return _0x1b5f50[_0x34c5('0x32')](_0x34c5('0x33'),_0x1446f0+'-'+_0x373193+'/'+_0x14e3e8)[_0x34c5('0x2d')](_0x106ec9);}return null;};}function patchUpdates(_0x2c951b){return function(_0x2f558d){try{jsonpatch['apply'](_0x2f558d,_0x2c951b,!![]);}catch(_0x542d00){return BPromise[_0x34c5('0x34')](_0x542d00);}return _0x2f558d['save']();};}function saveUpdates(_0x18924a,_0x56b50a){return function(_0x2a7a9f){if(_0x2a7a9f){return _0x2a7a9f[_0x34c5('0x35')](_0x18924a)[_0x34c5('0x21')](function(_0x1dc6de){return _0x1dc6de;});}return null;};}function removeEntity(_0xc130f8,_0x448e0a){return function(_0x5ab58b){if(_0x5ab58b){return _0x5ab58b[_0x34c5('0x36')]()[_0x34c5('0x21')](function(){var _0xd6102c=_0x5ab58b['get']({'plain':!![]});var _0x58355c=_0x34c5('0x37');return db[_0x34c5('0x38')][_0x34c5('0x36')]({'where':{'type':_0x58355c,'resourceId':_0xd6102c['id']}})[_0x34c5('0x21')](function(){return _0x5ab58b;});})[_0x34c5('0x21')](function(){_0xc130f8[_0x34c5('0x2b')](0xcc)[_0x34c5('0x2c')]();});}};}function handleEntityNotFound(_0x164386,_0x4e1034){return function(_0x487260){if(!_0x487260){_0x164386[_0x34c5('0x2a')](0x194);}return _0x487260;};}function handleError(_0x4445d5,_0x5365c3){_0x5365c3=_0x5365c3||0x1f4;return function(_0x51c253){logger[_0x34c5('0x27')](_0x51c253['stack']);if(_0x51c253[_0x34c5('0x39')]){delete _0x51c253[_0x34c5('0x39')];}_0x4445d5[_0x34c5('0x2b')](_0x5365c3)['send'](_0x51c253);};}exports[_0x34c5('0x3a')]=function(_0x144269,_0x55c495){var _0x14f352={'include':[{'model':db[_0x34c5('0x3b')],'as':_0x34c5('0x3c')}]},_0x4d9c40={},_0x79dcf4={'count':0x0,'rows':[]};var _0x231ee3=_['map'](db[_0x34c5('0x3d')]['rawAttributes'],function(_0x21e1ec){return{'name':_0x21e1ec[_0x34c5('0x3e')],'type':_0x21e1ec[_0x34c5('0x3f')]['key']};});_0x4d9c40['model']=_[_0x34c5('0x40')](_0x231ee3,_0x34c5('0x39'));_0x4d9c40[_0x34c5('0x41')]=_[_0x34c5('0x42')](_0x144269[_0x34c5('0x41')]);_0x4d9c40[_0x34c5('0x43')]=_[_0x34c5('0x44')](_0x4d9c40[_0x34c5('0x45')],_0x4d9c40['query']);_0x14f352[_0x34c5('0x46')]=_['intersection'](_0x4d9c40['model'],qs[_0x34c5('0x47')](_0x144269[_0x34c5('0x41')]['fields']));_0x14f352['attributes']=_0x14f352[_0x34c5('0x46')][_0x34c5('0x48')]?_0x14f352['attributes']:_0x4d9c40['model'];if(!_0x144269[_0x34c5('0x41')][_0x34c5('0x49')](_0x34c5('0x4a'))){_0x14f352['limit']=qs[_0x34c5('0x30')](_0x144269[_0x34c5('0x41')][_0x34c5('0x30')]);_0x14f352[_0x34c5('0x2e')]=qs['offset'](_0x144269['query'][_0x34c5('0x2e')]);}_0x14f352[_0x34c5('0x4b')]=qs[_0x34c5('0x4c')](_0x144269['query'][_0x34c5('0x4c')]);_0x14f352[_0x34c5('0x4d')]=qs[_0x34c5('0x43')](_['pick'](_0x144269[_0x34c5('0x41')],_0x4d9c40[_0x34c5('0x43')]),_0x231ee3);if(_0x144269[_0x34c5('0x41')][_0x34c5('0x4e')]){_0x14f352[_0x34c5('0x4d')]=_['merge'](_0x14f352[_0x34c5('0x4d')],{'$or':_[_0x34c5('0x40')](_0x231ee3,function(_0x1895bd){if(_0x1895bd[_0x34c5('0x3f')]!==_0x34c5('0x4f')){var _0x269599={};_0x269599[_0x1895bd['name']]={'$like':'%'+_0x144269[_0x34c5('0x41')]['filter']+'%'};return _0x269599;}})});}_0x14f352=_[_0x34c5('0x50')]({},_0x14f352,_0x144269[_0x34c5('0x51')]);var _0x347571={'where':_0x14f352['where']};return db[_0x34c5('0x3d')][_0x34c5('0x31')](_0x347571)[_0x34c5('0x21')](function(_0x1584f9){_0x79dcf4['count']=_0x1584f9;if(_0x144269[_0x34c5('0x41')][_0x34c5('0x52')]){_0x14f352['include']=[{'all':!![]}];}return db[_0x34c5('0x3d')][_0x34c5('0x53')](_0x14f352);})['then'](function(_0x2d17e5){_0x79dcf4[_0x34c5('0x54')]=_0x2d17e5;return _0x79dcf4;})['then'](respondWithFilteredResult(_0x55c495,_0x14f352))[_0x34c5('0x29')](handleError(_0x55c495,null));};exports[_0x34c5('0x55')]=function(_0x5b9d82,_0x1d9841){var _0x2549d4={'raw':![],'where':{'id':_0x5b9d82['params']['id']},'include':[{'model':db[_0x34c5('0x3b')],'as':_0x34c5('0x3c')}]},_0x534922={};_0x534922[_0x34c5('0x45')]=_[_0x34c5('0x42')](db[_0x34c5('0x3d')][_0x34c5('0x56')]);_0x534922[_0x34c5('0x41')]=_[_0x34c5('0x42')](_0x5b9d82[_0x34c5('0x41')]);_0x534922[_0x34c5('0x43')]=_[_0x34c5('0x44')](_0x534922[_0x34c5('0x45')],_0x534922[_0x34c5('0x41')]);_0x2549d4[_0x34c5('0x46')]=_[_0x34c5('0x44')](_0x534922['model'],qs[_0x34c5('0x47')](_0x5b9d82['query'][_0x34c5('0x47')]));_0x2549d4[_0x34c5('0x46')]=_0x2549d4[_0x34c5('0x46')]['length']?_0x2549d4[_0x34c5('0x46')]:_0x534922[_0x34c5('0x45')];if(_0x5b9d82[_0x34c5('0x41')][_0x34c5('0x52')]){_0x2549d4[_0x34c5('0x57')]=[{'all':!![]}];}_0x2549d4=_[_0x34c5('0x50')]({},_0x2549d4,_0x5b9d82[_0x34c5('0x51')]);return db[_0x34c5('0x3d')]['find'](_0x2549d4)['then'](handleEntityNotFound(_0x1d9841,null))[_0x34c5('0x21')](respondWithResult(_0x1d9841,null))['catch'](handleError(_0x1d9841,null));};exports[_0x34c5('0x58')]=function(_0x19599,_0x3c53a7){return db[_0x34c5('0x3d')][_0x34c5('0x58')](_0x19599[_0x34c5('0x59')],{})[_0x34c5('0x21')](function(_0x4fc451){var _0x299488=_0x19599['user'][_0x34c5('0x5a')]({'plain':!![]});if(!_0x299488)throw new Error(_0x34c5('0x5b'));if(_0x299488[_0x34c5('0x5c')]===_0x34c5('0x5d')){var _0x18bd9b=_0x4fc451[_0x34c5('0x5a')]({'plain':!![]});var _0x207d0d=_0x34c5('0x37');return db[_0x34c5('0x5e')]['find']({'where':{'name':_0x207d0d,'userProfileId':_0x299488[_0x34c5('0x5f')]},'raw':!![]})['then'](function(_0x3dc109){if(_0x3dc109&&_0x3dc109[_0x34c5('0x60')]===0x0){return db['UserProfileResource'][_0x34c5('0x58')]({'name':_0x18bd9b['name'],'resourceId':_0x18bd9b['id'],'type':_0x3dc109[_0x34c5('0x39')],'sectionId':_0x3dc109['id']},{})[_0x34c5('0x21')](function(){return _0x4fc451;});}else{return _0x4fc451;}})[_0x34c5('0x29')](function(_0x56124d){logger[_0x34c5('0x27')](_0x34c5('0x61'),_0x56124d);throw _0x56124d;});}return _0x4fc451;})[_0x34c5('0x21')](respondWithResult(_0x3c53a7,0xc9))[_0x34c5('0x29')](handleError(_0x3c53a7,null));};exports[_0x34c5('0x35')]=function(_0x4fb8be,_0x1cfa6c){if(_0x4fb8be['body']['id']){delete _0x4fb8be[_0x34c5('0x59')]['id'];}return db['SmsAccount'][_0x34c5('0x62')]({'where':{'id':_0x4fb8be[_0x34c5('0x63')]['id']},'include':[{'model':db[_0x34c5('0x3b')],'as':_0x34c5('0x3c')}]})[_0x34c5('0x21')](handleEntityNotFound(_0x1cfa6c,null))['then'](saveUpdates(_0x4fb8be[_0x34c5('0x59')],null))[_0x34c5('0x21')](respondWithResult(_0x1cfa6c,null))[_0x34c5('0x29')](handleError(_0x1cfa6c,null));};exports[_0x34c5('0x36')]=function(_0x59e19a,_0x27990e){return db[_0x34c5('0x3d')][_0x34c5('0x62')]({'where':{'id':_0x59e19a[_0x34c5('0x63')]['id']}})[_0x34c5('0x21')](handleEntityNotFound(_0x27990e,null))[_0x34c5('0x21')](removeEntity(_0x27990e,null))[_0x34c5('0x29')](handleError(_0x27990e,null));};exports['describe']=function(_0x120fca,_0x5ad24a){return db['SmsAccount'][_0x34c5('0x64')]()[_0x34c5('0x21')](respondWithResult(_0x5ad24a,null))[_0x34c5('0x29')](handleError(_0x5ad24a,null));};exports[_0x34c5('0x65')]=function(_0x272aa0,_0xf71c79,_0x1d176f){if(_0x272aa0[_0x34c5('0x59')]['id']){delete _0x272aa0['body']['id'];}return db[_0x34c5('0x3d')]['find']({'where':{'id':_0x272aa0['params']['id']}})[_0x34c5('0x21')](handleEntityNotFound(_0xf71c79,null))['then'](function(_0xd79860){if(_0xd79860){_0x272aa0[_0x34c5('0x59')][_0x34c5('0x66')]=_0xd79860['id'];return db[_0x34c5('0x67')][_0x34c5('0x58')](_0x272aa0[_0x34c5('0x59')]);}})[_0x34c5('0x21')](respondWithResult(_0xf71c79,null))[_0x34c5('0x29')](handleError(_0xf71c79,null));};exports['getDispositions']=function(_0x15fd24,_0x1700f0,_0x24157e){var _0x99fe41={'raw':![],'where':{}};var _0x4a2d4f={};var _0x2b42bd={'count':0x0,'rows':[]};return db['SmsAccount'][_0x34c5('0x68')]({'where':{'id':_0x15fd24[_0x34c5('0x63')]['id']}})[_0x34c5('0x21')](handleEntityNotFound(_0x1700f0,null))[_0x34c5('0x21')](function(_0xcff6f9){if(_0xcff6f9){_0x4a2d4f[_0x34c5('0x45')]=_[_0x34c5('0x42')](db['Disposition'][_0x34c5('0x56')]);_0x4a2d4f[_0x34c5('0x41')]=_[_0x34c5('0x42')](_0x15fd24[_0x34c5('0x41')]);_0x4a2d4f[_0x34c5('0x43')]=_[_0x34c5('0x44')](_0x4a2d4f[_0x34c5('0x45')],_0x4a2d4f['query']);_0x99fe41[_0x34c5('0x46')]=_[_0x34c5('0x44')](_0x4a2d4f['model'],qs['fields'](_0x15fd24[_0x34c5('0x41')][_0x34c5('0x47')]));_0x99fe41['attributes']=_0x99fe41[_0x34c5('0x46')][_0x34c5('0x48')]?_0x99fe41[_0x34c5('0x46')]:_0x4a2d4f['model'];if(!_0x15fd24[_0x34c5('0x41')][_0x34c5('0x49')](_0x34c5('0x4a'))){_0x99fe41[_0x34c5('0x30')]=qs[_0x34c5('0x30')](_0x15fd24[_0x34c5('0x41')][_0x34c5('0x30')]);_0x99fe41[_0x34c5('0x2e')]=qs['offset'](_0x15fd24[_0x34c5('0x41')][_0x34c5('0x2e')]);}_0x99fe41[_0x34c5('0x4b')]=qs['sort'](_0x15fd24[_0x34c5('0x41')]['sort']);_0x99fe41['where']=qs[_0x34c5('0x43')](_[_0x34c5('0x69')](_0x15fd24[_0x34c5('0x41')],_0x4a2d4f[_0x34c5('0x43')]));_0x99fe41[_0x34c5('0x4d')][_0x34c5('0x66')]=_0xcff6f9['id'];if(_0x15fd24[_0x34c5('0x41')][_0x34c5('0x4e')]){_0x99fe41[_0x34c5('0x4d')]=_[_0x34c5('0x50')](_0x99fe41[_0x34c5('0x4d')],{'$or':_[_0x34c5('0x40')](_0x99fe41[_0x34c5('0x46')],function(_0x56879a){var _0x1044c3={};_0x1044c3[_0x56879a]={'$like':'%'+_0x15fd24[_0x34c5('0x41')][_0x34c5('0x4e')]+'%'};return _0x1044c3;})});}_0x99fe41=_[_0x34c5('0x50')]({},_0x99fe41,_0x15fd24[_0x34c5('0x51')]);return db[_0x34c5('0x67')]['count']({'where':_0x99fe41[_0x34c5('0x4d')]})['then'](function(_0x2f3670){_0x2b42bd[_0x34c5('0x31')]=_0x2f3670;if(_0x15fd24['query'][_0x34c5('0x52')]){_0x99fe41[_0x34c5('0x57')]=[{'all':!![]}];}return db[_0x34c5('0x67')][_0x34c5('0x53')](_0x99fe41);})[_0x34c5('0x21')](function(_0x4ac5df){_0x2b42bd[_0x34c5('0x54')]=_0x4ac5df;return _0x2b42bd;});}})[_0x34c5('0x21')](respondWithFilteredResult(_0x1700f0,_0x99fe41))[_0x34c5('0x29')](handleError(_0x1700f0,null));};exports[_0x34c5('0x6a')]=function(_0x2fd569,_0x25d300,_0x58d6ea){return db[_0x34c5('0x3d')]['find']({'where':{'id':_0x2fd569[_0x34c5('0x63')]['id']}})['then'](handleEntityNotFound(_0x25d300,null))[_0x34c5('0x21')](function(_0x3410d7){if(_0x3410d7){return _0x3410d7[_0x34c5('0x6a')](_0x2fd569[_0x34c5('0x41')][_0x34c5('0x6b')]);}})[_0x34c5('0x21')](respondWithStatusCode(_0x25d300,null))[_0x34c5('0x29')](handleError(_0x25d300,null));};exports[_0x34c5('0x6c')]=function(_0x123264,_0x44dc02,_0x5dfa7f){if(_0x123264[_0x34c5('0x59')]['id']){delete _0x123264[_0x34c5('0x59')]['id'];}return db[_0x34c5('0x3d')][_0x34c5('0x62')]({'where':{'id':_0x123264[_0x34c5('0x63')]['id']}})[_0x34c5('0x21')](handleEntityNotFound(_0x44dc02,null))[_0x34c5('0x21')](function(_0x597dd8){if(_0x597dd8){_0x123264[_0x34c5('0x59')][_0x34c5('0x66')]=_0x597dd8['id'];return db[_0x34c5('0x6d')][_0x34c5('0x58')](_0x123264[_0x34c5('0x59')]);}})[_0x34c5('0x21')](respondWithResult(_0x44dc02,null))[_0x34c5('0x29')](handleError(_0x44dc02,null));};exports[_0x34c5('0x6e')]=function(_0x535ea7,_0x5d1ec3,_0xe4771e){var _0x16fa96={'raw':![],'where':{}};var _0x22a3b8={};var _0xdd7299={'count':0x0,'rows':[]};return db[_0x34c5('0x3d')][_0x34c5('0x68')]({'where':{'id':_0x535ea7[_0x34c5('0x63')]['id']}})[_0x34c5('0x21')](handleEntityNotFound(_0x5d1ec3,null))[_0x34c5('0x21')](function(_0x1a68ed){if(_0x1a68ed){_0x22a3b8['model']=_[_0x34c5('0x42')](db[_0x34c5('0x6d')][_0x34c5('0x56')]);_0x22a3b8['query']=_[_0x34c5('0x42')](_0x535ea7[_0x34c5('0x41')]);_0x22a3b8['filters']=_[_0x34c5('0x44')](_0x22a3b8[_0x34c5('0x45')],_0x22a3b8[_0x34c5('0x41')]);_0x16fa96[_0x34c5('0x46')]=_['intersection'](_0x22a3b8[_0x34c5('0x45')],qs[_0x34c5('0x47')](_0x535ea7[_0x34c5('0x41')][_0x34c5('0x47')]));_0x16fa96[_0x34c5('0x46')]=_0x16fa96[_0x34c5('0x46')][_0x34c5('0x48')]?_0x16fa96[_0x34c5('0x46')]:_0x22a3b8[_0x34c5('0x45')];if(!_0x535ea7[_0x34c5('0x41')][_0x34c5('0x49')](_0x34c5('0x4a'))){_0x16fa96[_0x34c5('0x30')]=qs[_0x34c5('0x30')](_0x535ea7['query'][_0x34c5('0x30')]);_0x16fa96[_0x34c5('0x2e')]=qs['offset'](_0x535ea7[_0x34c5('0x41')]['offset']);}_0x16fa96['order']=qs[_0x34c5('0x4c')](_0x535ea7[_0x34c5('0x41')][_0x34c5('0x4c')]);_0x16fa96[_0x34c5('0x4d')]=qs['filters'](_['pick'](_0x535ea7[_0x34c5('0x41')],_0x22a3b8['filters']));_0x16fa96['where'][_0x34c5('0x66')]=_0x1a68ed['id'];if(_0x535ea7[_0x34c5('0x41')][_0x34c5('0x4e')]){_0x16fa96[_0x34c5('0x4d')]=_[_0x34c5('0x50')](_0x16fa96['where'],{'$or':_[_0x34c5('0x40')](_0x16fa96[_0x34c5('0x46')],function(_0x5e2dbc){var _0x4f36db={};_0x4f36db[_0x5e2dbc]={'$like':'%'+_0x535ea7[_0x34c5('0x41')][_0x34c5('0x4e')]+'%'};return _0x4f36db;})});}_0x16fa96=_[_0x34c5('0x50')]({},_0x16fa96,_0x535ea7[_0x34c5('0x51')]);return db[_0x34c5('0x6d')][_0x34c5('0x31')]({'where':_0x16fa96[_0x34c5('0x4d')]})[_0x34c5('0x21')](function(_0xdd490c){_0xdd7299[_0x34c5('0x31')]=_0xdd490c;if(_0x535ea7[_0x34c5('0x41')][_0x34c5('0x52')]){_0x16fa96[_0x34c5('0x57')]=[{'all':!![]}];}return db[_0x34c5('0x6d')][_0x34c5('0x53')](_0x16fa96);})['then'](function(_0x4fdf09){_0xdd7299[_0x34c5('0x54')]=_0x4fdf09;return _0xdd7299;});}})[_0x34c5('0x21')](respondWithFilteredResult(_0x5d1ec3,_0x16fa96))['catch'](handleError(_0x5d1ec3,null));};exports[_0x34c5('0x6f')]=function(_0xfda319,_0x27e83f,_0x2823b1){return db[_0x34c5('0x3d')][_0x34c5('0x62')]({'where':{'id':_0xfda319[_0x34c5('0x63')]['id']}})[_0x34c5('0x21')](handleEntityNotFound(_0x27e83f,null))[_0x34c5('0x21')](function(_0x56047e){if(_0x56047e){return _0x56047e[_0x34c5('0x6f')](_0xfda319[_0x34c5('0x41')]['ids']);}})[_0x34c5('0x21')](respondWithStatusCode(_0x27e83f,null))[_0x34c5('0x29')](handleError(_0x27e83f,null));};exports['notify']=function(_0x3a7276,_0x28a9b6,_0x5afc3e){var _0x2e396a={'channel':'sms'};var _0x2e99ea=[];var _0x4d4452=[];var _0x5a8c35={};return db[_0x34c5('0x3d')][_0x34c5('0x62')]({'where':{'id':_0x3a7276['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x34c5('0x70')}]})[_0x34c5('0x21')](handleEntityNotFound(_0x28a9b6,null))['then'](function(_0x4929a5){_0x2e396a[_0x34c5('0x71')]=_0x4929a5;_0x2e396a[_0x34c5('0x72')]=_['orderBy'](_0x4929a5['Applications'],[_0x34c5('0x73')],[_0x34c5('0x74')]);if(_0x2e396a[_0x34c5('0x71')][_0x34c5('0x70')]){delete _0x2e396a[_0x34c5('0x71')][_0x34c5('0x70')];}return db[_0x34c5('0x75')]['describe']();})['then'](function(_0x56f616){if(!_0x56f616){throw new db[(_0x34c5('0x76'))][(_0x34c5('0x77'))](_0x34c5('0x78'));}_0x2e99ea=_[_0x34c5('0x79')](_[_0x34c5('0x42')](_0x56f616),[_0x34c5('0x7a'),_0x34c5('0x7b')]);_0x4d4452=_[_0x34c5('0x79')](_[_0x34c5('0x42')](_0x56f616),['createdAt',_0x34c5('0x7b'),_0x34c5('0x7c'),_0x34c5('0x7d')]);_0x2e396a[_0x34c5('0x59')]={'mapKey':_0x34c5('0x7e')};if(_0x2e396a['account'][_0x34c5('0x3f')]){switch(_0x2e396a[_0x34c5('0x71')][_0x34c5('0x3f')]){case _0x34c5('0x7f'):_0x2e396a[_0x34c5('0x59')][_0x34c5('0x80')]=_0x3a7276[_0x34c5('0x59')][_0x34c5('0x81')];_0x2e396a[_0x34c5('0x59')][_0x34c5('0x59')]=_0x3a7276[_0x34c5('0x59')]['Body'];_0x2e396a['body'][_0x34c5('0x82')]=_0x3a7276['body'][_0x34c5('0x83')];break;case _0x34c5('0x84'):_0x2e396a[_0x34c5('0x59')][_0x34c5('0x80')]='+'+_0x3a7276[_0x34c5('0x59')][_0x34c5('0x85')];_0x2e396a['body'][_0x34c5('0x59')]=_0x3a7276[_0x34c5('0x59')][_0x34c5('0x86')];break;case _0x34c5('0x87'):_0x2e396a[_0x34c5('0x59')][_0x34c5('0x80')]=_0x3a7276[_0x34c5('0x59')][_0x34c5('0x80')];_0x2e396a[_0x34c5('0x59')][_0x34c5('0x59')]=_0x3a7276[_0x34c5('0x59')][_0x34c5('0x28')];break;case _0x34c5('0x88'):_0x2e396a['body'][_0x34c5('0x80')]=_0x3a7276[_0x34c5('0x59')][_0x34c5('0x80')];_0x2e396a[_0x34c5('0x59')][_0x34c5('0x59')]=_0x3a7276['body'][_0x34c5('0x59')];_0x2e396a['body'][_0x34c5('0x82')]=_0x3a7276['body'][_0x34c5('0x89')];break;case _0x34c5('0x8a'):_0x2e396a['body'][_0x34c5('0x80')]=_0x3a7276[_0x34c5('0x59')]['From'];_0x2e396a['body'][_0x34c5('0x59')]=_0x3a7276[_0x34c5('0x59')][_0x34c5('0x8b')];_0x2e396a[_0x34c5('0x59')][_0x34c5('0x82')]=_0x3a7276[_0x34c5('0x59')][_0x34c5('0x8c')];break;case _0x34c5('0x8d'):_0x2e396a['body']['from']='+'+_0x3a7276[_0x34c5('0x59')][_0x34c5('0x8e')][0x0][_0x34c5('0x80')];_0x2e396a[_0x34c5('0x59')][_0x34c5('0x59')]=_0x3a7276[_0x34c5('0x59')]['results'][0x0][_0x34c5('0x86')];_0x2e396a['body']['messageId']=_0x3a7276[_0x34c5('0x59')]['results'][0x0][_0x34c5('0x82')];break;case _0x34c5('0x8f'):_0x2e396a[_0x34c5('0x59')]['from']=_0x3a7276[_0x34c5('0x59')]['originatingAddress'];_0x2e396a[_0x34c5('0x59')][_0x34c5('0x59')]=_0x3a7276['body']['segmentedMessage'][_0x34c5('0x28')];break;case'clickatell':_0x2e396a[_0x34c5('0x59')][_0x34c5('0x80')]=_0x3a7276['body']['fromNumber'];_0x2e396a[_0x34c5('0x59')][_0x34c5('0x59')]=_0x3a7276[_0x34c5('0x59')][_0x34c5('0x86')];_0x2e396a[_0x34c5('0x59')][_0x34c5('0x82')]=_0x3a7276['body'][_0x34c5('0x90')];break;case _0x34c5('0x91'):_0x2e396a[_0x34c5('0x59')]['messageId']=_0x3a7276[_0x34c5('0x59')][0x0][_0x34c5('0x28')]['id'];_0x2e396a[_0x34c5('0x59')][_0x34c5('0x80')]=_0x3a7276['body'][0x0]['message'][_0x34c5('0x80')];_0x2e396a[_0x34c5('0x59')]['body']=_0x3a7276['body'][0x0]['message'][_0x34c5('0x86')];break;case'intelepeer':_0x2e396a[_0x34c5('0x59')][_0x34c5('0x80')]=_0x3a7276[_0x34c5('0x59')][_0x34c5('0x80')];_0x2e396a[_0x34c5('0x59')][_0x34c5('0x59')]=_0x3a7276[_0x34c5('0x59')][_0x34c5('0x28')];_0x2e396a[_0x34c5('0x59')][_0x34c5('0x82')]=_0x3a7276[_0x34c5('0x59')]['refid'];break;}}if(_0x2e396a[_0x34c5('0x59')]['id']){delete _0x2e396a[_0x34c5('0x59')]['id'];}if(_[_0x34c5('0x92')](_0x2e396a[_0x34c5('0x59')]['from'])){throw new db[(_0x34c5('0x76'))][(_0x34c5('0x77'))](_0x34c5('0x93'));}if(_[_0x34c5('0x92')](_0x2e396a[_0x34c5('0x59')][_0x34c5('0x59')])||_0x2e396a[_0x34c5('0x59')][_0x34c5('0x59')]===''){throw new db[(_0x34c5('0x76'))]['ValidationError'](_0x34c5('0x94'));}if(_[_0x34c5('0x92')](_0x2e396a[_0x34c5('0x59')][_0x34c5('0x95')])){throw new db[(_0x34c5('0x76'))]['ValidationError'](_0x34c5('0x96')+_0x4d4452);}if(!_[_0x34c5('0x97')](_0x4d4452,_0x2e396a[_0x34c5('0x59')][_0x34c5('0x95')])){throw new db[(_0x34c5('0x76'))]['ValidationError'](_0x34c5('0x98')+_0x4d4452);}_0x5a8c35[_0x2e396a[_0x34c5('0x59')][_0x34c5('0x95')]]=_0x2e396a[_0x34c5('0x59')][_0x34c5('0x80')];return db[_0x34c5('0x99')][_0x34c5('0x62')]({'where':{'id':_0x2e396a[_0x34c5('0x71')]['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5a8c35,'limit':0x1,'order':[[_0x34c5('0x7b'),_0x34c5('0x9a')]]}]});})[_0x34c5('0x21')](handleEntityNotFound(_0x28a9b6,null))[_0x34c5('0x21')](function(_0x413c3e){if(_0x413c3e){_0x2e396a[_0x34c5('0x9b')]=_['omit'](_0x413c3e,[_0x34c5('0x9c')]);if(_0x413c3e[_0x34c5('0x9c')]['length']){return _0x413c3e['Contacts'][0x0];}var _0x39555a=_[_0x34c5('0x9d')](_0x2e396a['body'],{'firstName':_0x2e396a['body'][_0x34c5('0x80')],'ListId':_0x413c3e['id']});_0x39555a[_0x2e396a[_0x34c5('0x59')][_0x34c5('0x95')]]=_0x2e396a[_0x34c5('0x59')][_0x34c5('0x80')];return db[_0x34c5('0x75')]['create'](_0x39555a,{'fields':_0x2e99ea,'raw':!![]});}})[_0x34c5('0x21')](handleEntityNotFound(_0x28a9b6,null))[_0x34c5('0x21')](function(_0x3326db){if(_0x3326db){_0x2e396a[_0x34c5('0x9e')]=_0x3326db;var _0x3c48b8={'ContactId':_0x3326db['id'],'phone':_0x2e396a[_0x34c5('0x59')][_0x34c5('0x80')],'SmsAccountId':_0x3a7276[_0x34c5('0x63')]['id']};var _0x442f9f={'ContactId':_0x3326db['id'],'SmsAccountId':_0x3a7276[_0x34c5('0x63')]['id'],'closed':![]};return db[_0x34c5('0x9f')][_0x34c5('0x62')]({'where':_0x442f9f})[_0x34c5('0x21')](function(_0x474b53){if(_0x474b53){return[_0x474b53,![]];}return db[_0x34c5('0x9f')][_0x34c5('0x58')](_0x3c48b8)[_0x34c5('0x21')](function(_0x5d16c0){return[_0x5d16c0,!![]];});});}})[_0x34c5('0xa0')](function(_0x8f32ff,_0x410fe5){_0x2e396a[_0x34c5('0xa1')]=_0x8f32ff[_0x34c5('0x5a')]({'plain':!![]});_0x2e396a[_0x34c5('0xa1')][_0x34c5('0xa2')]=![];if(_0x410fe5){if(_0x2e396a[_0x34c5('0x71')][_0x34c5('0xa3')]){_0x2e396a[_0x34c5('0x72')][_0x34c5('0xa4')]({'id':0x0,'priority':_0x2e396a[_0x34c5('0x72')][_0x34c5('0x48')]+0x1,'app':_0x34c5('0xa5'),'appdata':_0x34c5('0xa6'),'interval':'*,*,*,*'});}_0x2e396a[_0x34c5('0xa1')]['created']=!![];}return db['SmsMessage'][_0x34c5('0x58')]({'phone':_0x2e396a[_0x34c5('0x59')][_0x34c5('0x80')],'messageId':_0x2e396a[_0x34c5('0x59')]['messageId'],'body':_0x2e396a[_0x34c5('0x59')][_0x34c5('0x59')],'SmsAccountId':_0x3a7276['params']['id'],'SmsInteractionId':_0x8f32ff['id'],'direction':'in','ContactId':_0x8f32ff[_0x34c5('0xa7')],'AttachmentId':_0x2e396a[_0x34c5('0x59')][_0x34c5('0xa8')]});})[_0x34c5('0x21')](function(_0x4aa563){_0x2e396a[_0x34c5('0x28')]=_0x4aa563;if(!_0x2e396a[_0x34c5('0xa1')][_0x34c5('0xa9')])return;return db[_0x34c5('0xaa')][_0x34c5('0x62')]({'attributes':['id','name'],'where':{'id':_0x2e396a[_0x34c5('0xa1')][_0x34c5('0xa9')]}});})[_0x34c5('0x21')](function(_0x1067e5){if(_0x1067e5){_0x2e396a[_0x34c5('0x72')]['unshift']({'id':0x0,'priority':0x0,'app':_0x34c5('0xab'),'appdata':_0x1067e5[_0x34c5('0x39')]+','+(_0x2e396a[_0x34c5('0x71')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x2e396a[_0x34c5('0xa1')]['queueId'])return;return db[_0x34c5('0xac')]['find']({'attributes':['id',_0x34c5('0x39')],'where':{'id':_0x2e396a['interaction'][_0x34c5('0xad')]}});})[_0x34c5('0x21')](function(_0x22a190){if(_0x22a190){_0x2e396a['applications'][_0x34c5('0xae')]({'id':0x0,'priority':0x1,'app':_0x34c5('0xaf'),'appdata':_0x22a190['name']+','+(_0x2e396a['account'][_0x34c5('0xb0')]||0x12c),'interval':_0x34c5('0xb1')});}return respondWithRpcPromise(_0x34c5('0xb2'),_0x34c5('0xb3'),_0x2e396a);})[_0x34c5('0x21')](function(_0xedc435){if(_0xedc435){var _0x5179cd=0xc8;var _0xb705ed='receiveMessage';logger[_0x34c5('0xb4')](_0x34c5('0x24'),_0xb705ed,_0x5179cd,_0x34c5('0xb5'));logger[_0x34c5('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xb705ed,_0x5179cd,_0x34c5('0xb5'),JSON[_0x34c5('0x26')](_0xedc435));if(_0x2e396a[_0x34c5('0x71')][_0x34c5('0x3f')]===_0x34c5('0x7f')){return _0x28a9b6[_0x34c5('0x2b')](_0x5179cd)[_0x34c5('0x32')](_0x34c5('0xb6'),'text/xml')[_0x34c5('0xb7')](_0x34c5('0xb8'));}else{return _0x28a9b6[_0x34c5('0x2b')](_0x5179cd)[_0x34c5('0x2d')](_0xedc435);}}})['catch'](handleError(_0x28a9b6,null));};exports[_0x34c5('0xb9')]=function(_0x431b4c,_0x5c4e01){var _0x138481=_0x431b4c['params']['id'];var _0x5cd02e=_0x431b4c[_0x34c5('0x59')];var _0x738ab4=0xc8;var _0x1e2d67=null;return db[_0x34c5('0xba')][_0x34c5('0xbb')]({'isolationLevel':db[_0x34c5('0xba')][_0x34c5('0xbc')][_0x34c5('0xbd')]['READ_COMMITTED']},function(_0x3f8ab5){return db[_0x34c5('0x3d')][_0x34c5('0x68')]({'where':{'id':_0x138481},'transaction':_0x3f8ab5})['then'](function(_0x1bb725){if(_0x1bb725){return db[_0x34c5('0xbe')][_0x34c5('0x36')]({'where':{'SmsAccountId':_0x138481},'transaction':_0x3f8ab5})['then'](function(){var _0x2e6857=_[_0x34c5('0x40')](_0x5cd02e,function(_0x13ce00){_0x13ce00[_0x34c5('0x66')]=_0x138481;return _0x13ce00;});return db['SmsApplication'][_0x34c5('0xbf')](_0x2e6857,{'transaction':_0x3f8ab5});});}else{_0x738ab4=0x194;_0x1e2d67=[];}});})['then'](function(){if(_0x738ab4!==0x194){return db[_0x34c5('0xbe')][_0x34c5('0xc0')]({'where':{'SmsAccountId':_0x138481},'order':_0x34c5('0x73')})[_0x34c5('0x21')](function(_0x3497e8){_0x1e2d67=_0x3497e8;});}})[_0x34c5('0x29')](function(_0x64634c){_0x738ab4=0x1f4;logger[_0x34c5('0x27')](_0x64634c[_0x34c5('0xc1')]);if(_0x64634c[_0x34c5('0x39')]){delete _0x64634c[_0x34c5('0x39')];}_0x1e2d67=_0x64634c;})[_0x34c5('0xc2')](function(){if(_0x1e2d67===null){_0x5c4e01[_0x34c5('0x2a')](_0x738ab4);}else{if(_0x738ab4===0x1f4){_0x5c4e01[_0x34c5('0x2b')](_0x738ab4)[_0x34c5('0xb7')](_0x1e2d67);}else{_0x5c4e01[_0x34c5('0x2b')](_0x738ab4)[_0x34c5('0x2d')](_0x1e2d67);}}});};exports[_0x34c5('0xc3')]=function(_0x320427,_0x902b8b,_0xd9c9ad){var _0x589f8c={};var _0x1c2cde={};var _0x3bb2c4;var _0x25e688;return db[_0x34c5('0x3d')][_0x34c5('0x68')]({'where':{'id':_0x320427['params']['id']}})[_0x34c5('0x21')](handleEntityNotFound(_0x902b8b,null))['then'](function(_0x5bd45e){if(_0x5bd45e){_0x3bb2c4=_0x5bd45e;_0x1c2cde[_0x34c5('0x45')]=_[_0x34c5('0x42')](db[_0x34c5('0xbe')][_0x34c5('0x56')]);_0x1c2cde['query']=_['keys'](_0x320427['query']);_0x1c2cde[_0x34c5('0x43')]=_[_0x34c5('0x44')](_0x1c2cde['model'],_0x1c2cde[_0x34c5('0x41')]);_0x589f8c[_0x34c5('0x46')]=_[_0x34c5('0x44')](_0x1c2cde[_0x34c5('0x45')],qs[_0x34c5('0x47')](_0x320427[_0x34c5('0x41')][_0x34c5('0x47')]));_0x589f8c[_0x34c5('0x46')]=_0x589f8c[_0x34c5('0x46')][_0x34c5('0x48')]?_0x589f8c[_0x34c5('0x46')]:_0x1c2cde[_0x34c5('0x45')];_0x589f8c[_0x34c5('0x4b')]=qs[_0x34c5('0x4c')](_0x320427[_0x34c5('0x41')][_0x34c5('0x4c')]);_0x589f8c[_0x34c5('0x4d')]=qs[_0x34c5('0x43')](_[_0x34c5('0x69')](_0x320427['query'],_0x1c2cde[_0x34c5('0x43')]));if(_0x320427['query'][_0x34c5('0x4e')]){_0x589f8c[_0x34c5('0x4d')]=_[_0x34c5('0x50')](_0x589f8c[_0x34c5('0x4d')],{'$or':_[_0x34c5('0x40')](_0x589f8c['attributes'],function(_0x2502db){var _0xa0ac65={};_0xa0ac65[_0x2502db]={'$like':'%'+_0x320427[_0x34c5('0x41')][_0x34c5('0x4e')]+'%'};return _0xa0ac65;})});}_0x589f8c=_[_0x34c5('0x50')]({},_0x589f8c,_0x320427[_0x34c5('0x51')]);return _0x3bb2c4['getApplications'](_0x589f8c);}})['then'](function(_0x101f66){if(_0x101f66){_0x25e688=_0x101f66[_0x34c5('0x48')];if(!_0x320427[_0x34c5('0x41')][_0x34c5('0x49')](_0x34c5('0x4a'))){_0x589f8c[_0x34c5('0x30')]=qs[_0x34c5('0x30')](_0x320427[_0x34c5('0x41')][_0x34c5('0x30')]);_0x589f8c[_0x34c5('0x2e')]=qs['offset'](_0x320427[_0x34c5('0x41')][_0x34c5('0x2e')]);}return _0x3bb2c4[_0x34c5('0xc3')](_0x589f8c);}})[_0x34c5('0x21')](function(_0x248f21){if(_0x248f21){return _0x248f21?{'count':_0x25e688,'rows':_0x248f21}:null;}})[_0x34c5('0x21')](respondWithResult(_0x902b8b,null))[_0x34c5('0x29')](handleError(_0x902b8b,null));};exports[_0x34c5('0xc4')]=function(_0x5b899f,_0x514a2e,_0x5df023){var _0x5d2445={'raw':![],'where':{}};var _0xfca46b={};var _0x34fe9e={'count':0x0,'rows':[]};return db[_0x34c5('0x3d')][_0x34c5('0x68')]({'where':{'id':_0x5b899f['params']['id']}})['then'](handleEntityNotFound(_0x514a2e,null))[_0x34c5('0x21')](function(_0x21080e){if(_0x21080e){_0xfca46b[_0x34c5('0x45')]=_[_0x34c5('0x42')](db[_0x34c5('0x9f')][_0x34c5('0x56')]);_0xfca46b[_0x34c5('0x41')]=_[_0x34c5('0x42')](_0x5b899f[_0x34c5('0x41')]);_0xfca46b['filters']=_[_0x34c5('0x44')](_0xfca46b['model'],_0xfca46b[_0x34c5('0x41')]);_0x5d2445[_0x34c5('0x46')]=_[_0x34c5('0x44')](_0xfca46b[_0x34c5('0x45')],qs[_0x34c5('0x47')](_0x5b899f[_0x34c5('0x41')][_0x34c5('0x47')]));_0x5d2445['attributes']=_0x5d2445[_0x34c5('0x46')][_0x34c5('0x48')]?_0x5d2445[_0x34c5('0x46')]:_0xfca46b[_0x34c5('0x45')];if(!_0x5b899f[_0x34c5('0x41')][_0x34c5('0x49')]('nolimit')){_0x5d2445[_0x34c5('0x30')]=qs[_0x34c5('0x30')](_0x5b899f[_0x34c5('0x41')][_0x34c5('0x30')]);_0x5d2445[_0x34c5('0x2e')]=qs[_0x34c5('0x2e')](_0x5b899f[_0x34c5('0x41')][_0x34c5('0x2e')]);}_0x5d2445[_0x34c5('0x4b')]=qs[_0x34c5('0x4c')](_0x5b899f[_0x34c5('0x41')][_0x34c5('0x4c')]);_0x5d2445[_0x34c5('0x4d')]=qs[_0x34c5('0x43')](_[_0x34c5('0x69')](_0x5b899f[_0x34c5('0x41')],_0xfca46b[_0x34c5('0x43')]));_0x5d2445[_0x34c5('0x4d')]['SmsAccountId']=_0x21080e['id'];if(_0x5b899f[_0x34c5('0x41')][_0x34c5('0x4e')]){_0x5d2445['where']=_[_0x34c5('0x50')](_0x5d2445[_0x34c5('0x4d')],{'$or':_[_0x34c5('0x40')](_0x5d2445[_0x34c5('0x46')],function(_0x167028){var _0x42edd3={};_0x42edd3[_0x167028]={'$like':'%'+_0x5b899f['query']['filter']+'%'};return _0x42edd3;})});}_0x5d2445=_[_0x34c5('0x50')]({},_0x5d2445,_0x5b899f[_0x34c5('0x51')]);return db['SmsInteraction'][_0x34c5('0x31')]({'where':_0x5d2445[_0x34c5('0x4d')]})[_0x34c5('0x21')](function(_0x14276d){_0x34fe9e[_0x34c5('0x31')]=_0x14276d;if(_0x5b899f[_0x34c5('0x41')][_0x34c5('0x52')]){_0x5d2445[_0x34c5('0x57')]=[{'model':db['CmContact'],'as':_0x34c5('0xc5'),'required':![]},{'model':db[_0x34c5('0xaa')],'as':'Owner','attributes':['name',_0x34c5('0xc6'),_0x34c5('0xc7')],'required':![]},{'model':db[_0x34c5('0xc8')],'as':_0x34c5('0xc9'),'attributes':['id',_0x34c5('0x39'),_0x34c5('0xca')],'where':_0x5b899f[_0x34c5('0x41')][_0x34c5('0xcb')]?{'id':_0x5b899f[_0x34c5('0x41')][_0x34c5('0xcb')]}:undefined,'required':_0x5b899f['query'][_0x34c5('0xcb')]?!![]:![]}];}return db[_0x34c5('0x9f')]['findAll'](_0x5d2445);})['then'](function(_0xa14e83){_0x34fe9e[_0x34c5('0x54')]=_0xa14e83;return _0x34fe9e;});}})[_0x34c5('0x21')](respondWithFilteredResult(_0x514a2e,_0x5d2445))[_0x34c5('0x29')](handleError(_0x514a2e,null));};exports[_0x34c5('0xb7')]=function(_0x130d73,_0x3b3099,_0x2893b9){var _0x155136,_0x2fddea,_0x44df0d;if(_['isNil'](_0x130d73[_0x34c5('0x59')][_0x34c5('0x59')])||_0x130d73[_0x34c5('0x59')][_0x34c5('0x59')]===''){throw new db['Sequelize'][(_0x34c5('0x77'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x130d73[_0x34c5('0x59')]['to'])){throw new db['Sequelize'][(_0x34c5('0x77'))](_0x34c5('0xcc'));}_0x155136=_0x130d73[_0x34c5('0x59')]['to'];return db[_0x34c5('0x3d')][_0x34c5('0x62')]({'where':{'id':_0x130d73[_0x34c5('0x63')]['id']},'include':[{'model':db[_0x34c5('0x99')],'as':_0x34c5('0xcd'),'include':[{'model':db[_0x34c5('0x75')],'as':'Contacts','where':{'mobile':_0x155136},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x34c5('0x21')](handleEntityNotFound(_0x3b3099,null))['then'](function(_0x15f6f1){if(_0x15f6f1&&_0x15f6f1[_0x34c5('0xcd')]){_0x2fddea=_0x15f6f1[_0x34c5('0x5a')]({'plain':!![]});if(_0x2fddea['List']&&_0x2fddea[_0x34c5('0xcd')][_0x34c5('0x9c')]['length']){return _0x2fddea[_0x34c5('0xcd')]['Contacts'][0x0];}return db['CmContact'][_0x34c5('0x58')](_[_0x34c5('0x9d')](_0x130d73['body'],{'firstName':_0x155136,'mobile':_0x155136,'phone':_0x155136,'ListId':_0x2fddea[_0x34c5('0x7d')]}));}})[_0x34c5('0x21')](handleEntityNotFound(_0x3b3099,null))['then'](function(_0x302acd){if(_0x302acd){_0x44df0d=_0x302acd;return db[_0x34c5('0x9f')][_0x34c5('0x62')]({'where':{'ContactId':_0x44df0d['id'],'closed':![],'SmsAccountId':_0x2fddea['id']}})[_0x34c5('0x21')](function(_0xf22c3e){if(_0xf22c3e){return[_0xf22c3e,![]];}return db[_0x34c5('0x9f')]['create']({'UserId':_0x130d73[_0x34c5('0x5d')]['id'],'ContactId':_0x44df0d['id'],'SmsAccountId':_0x2fddea['id'],'phone':_0x155136,'firstMsgDirection':'out','Messages':[_['merge'](_0x130d73[_0x34c5('0x59')],{'read':![],'body':_0x130d73[_0x34c5('0x59')]['body'],'phone':_0x155136,'SmsAccountId':_0x2fddea['id'],'UserId':_0x130d73[_0x34c5('0x5d')]['id'],'ContactId':_0x44df0d['id']})]},{'include':[{'model':db[_0x34c5('0xce')],'as':'Messages'}]})['then'](function(_0x5bf6b8){return[_0x5bf6b8,!![]];});});}})[_0x34c5('0xa0')](function(_0x53dd43,_0x24194f){if(_0x24194f){return _0x53dd43;}return db[_0x34c5('0xce')][_0x34c5('0x58')](_[_0x34c5('0x50')](_0x130d73['body'],{'read':![],'body':_0x130d73[_0x34c5('0x59')][_0x34c5('0x59')],'phone':_0x155136,'SmsAccountId':_0x2fddea['id'],'SmsInteractionId':_0x53dd43['id'],'UserId':_0x130d73['user']['id'],'ContactId':_0x44df0d['id']}))[_0x34c5('0x21')](function(_0x914767){_0x53dd43[_0x34c5('0xcf')][_0x34c5('0xd0')]=[];_0x53dd43[_0x34c5('0xcf')]['Messages']['push'](_0x914767[_0x34c5('0xcf')]);return _0x53dd43;});})['then'](respondWithResult(_0x3b3099,null))['catch'](handleError(_0x3b3099,null));};exports[_0x34c5('0x2b')]=function(_0x5d0345,_0x2c4b2b,_0x361e0e){if(_0x5d0345[_0x34c5('0x59')]['id']){delete _0x5d0345[_0x34c5('0x59')]['id'];}var _0x1e922c,_0xbf8a61,_0x322f74;return db[_0x34c5('0x3d')]['find']({'where':{'id':_0x5d0345[_0x34c5('0x63')]['id']}})[_0x34c5('0x21')](handleEntityNotFound(_0x2c4b2b,null))[_0x34c5('0x21')](function(_0xd734a5){if(_0xd734a5){_0x322f74=_0xd734a5;logger[_0x34c5('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x34c5('0xd1'),_0xd734a5[_0x34c5('0x3f')],util[_0x34c5('0xd2')](_0x5d0345[_0x34c5('0x59')],{'showHidden':![],'depth':null}));switch(_0xd734a5[_0x34c5('0x3f')]){case _0x34c5('0x84'):if(_0x5d0345['body'][_0x34c5('0xd3')]&&_0x5d0345[_0x34c5('0x59')][_0x34c5('0x2b')]){_0xbf8a61=_0x5d0345['body']['status'];return db[_0x34c5('0xce')][_0x34c5('0x62')]({'where':{'messageId':_0x5d0345[_0x34c5('0x59')][_0x34c5('0xd3')]}});}break;case'connectel':if(_0x5d0345[_0x34c5('0x59')]['requestid']&&_0x5d0345['body'][_0x34c5('0xd4')]){_0xbf8a61=_0x5d0345[_0x34c5('0x59')][_0x34c5('0xd4')];return db[_0x34c5('0xce')]['find']({'where':{'messageId':_0x5d0345[_0x34c5('0x59')][_0x34c5('0xd5')]}});}break;case'clicksend':if(_0x5d0345[_0x34c5('0x59')][_0x34c5('0x89')]&&_0x5d0345[_0x34c5('0x59')][_0x34c5('0xd6')]){_0xbf8a61=_0x5d0345['body'][_0x34c5('0xd6')];return db[_0x34c5('0xce')][_0x34c5('0x62')]({'where':{'messageId':_0x5d0345[_0x34c5('0x59')][_0x34c5('0x89')]}});}break;case _0x34c5('0x8d'):var _0xa0e94e=_0x5d0345[_0x34c5('0x59')]['results'][0x0];if(_0xa0e94e['messageId']&&_0xa0e94e['status'][_0x34c5('0xd7')]===_0x34c5('0xd8')){_0xbf8a61=_0xa0e94e[_0x34c5('0x2b')][_0x34c5('0xd7')];return db[_0x34c5('0xce')]['find']({'where':{'messageId':_0xa0e94e['messageId']}});}break;case _0x34c5('0xd9'):if(_0x5d0345[_0x34c5('0x59')][_0x34c5('0x82')]&&_0x5d0345['body'][_0x34c5('0x2b')]){_0xbf8a61=_0x5d0345[_0x34c5('0x59')][_0x34c5('0x2b')];return db[_0x34c5('0xce')][_0x34c5('0x62')]({'where':{'messageId':_0x5d0345[_0x34c5('0x59')]['messageId']}});}break;case _0x34c5('0x91'):if(_0x5d0345['body'][0x0][_0x34c5('0x28')]['id']){_0xbf8a61=_0x5d0345[_0x34c5('0x59')][0x0][_0x34c5('0x3f')];return db['SmsMessage'][_0x34c5('0x62')]({'where':{'messageId':_0x5d0345[_0x34c5('0x59')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x5d0345['body']['redif']&&_0x5d0345[_0x34c5('0x59')][_0x34c5('0x2b')]){_0xbf8a61=_0x5d0345['body']['status'];return db['SmsMessage'][_0x34c5('0x62')]({'where':{'messageId':_0x5d0345[_0x34c5('0x59')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2c4b2b,null))[_0x34c5('0x21')](function(_0x2667cd){if(_0x2667cd){_0x1e922c=_0x2667cd;switch(_0x322f74[_0x34c5('0x3f')]){case'skebby':if(_0xbf8a61==='DELIVERED'){return _0x1e922c[_0x34c5('0x35')]({'read':!![]});}else{logger[_0x34c5('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x34c5('0x2b'),_0x34c5('0x84'),util['inspect'](_0x5d0345[_0x34c5('0x59')],{'showHidden':![],'depth':null}));}break;case _0x34c5('0x87'):if(_0xbf8a61==='1'){return _0x1e922c['update']({'read':!![]});}else{logger[_0x34c5('0x27')](_0x34c5('0x24'),_0x34c5('0x2b'),_0x34c5('0x84'),util[_0x34c5('0xd2')](_0x5d0345['body'],{'showHidden':![],'depth':null}));}break;case _0x34c5('0x88'):if(!_0x5d0345['body'][_0x34c5('0xda')]&&_0xbf8a61>=0xc8&&_0xbf8a61<=0xce){return _0x1e922c[_0x34c5('0x35')]({'read':!![]});}else{logger[_0x34c5('0x27')](_0x34c5('0x24'),'status',_0x34c5('0x88'),util[_0x34c5('0xd2')](_0x5d0345['body'],{'showHidden':![],'depth':null}));}break;case _0x34c5('0x8d'):var _0x1be2cc=_0x5d0345[_0x34c5('0x59')][_0x34c5('0x8e')][0x0];if(_0x1be2cc[_0x34c5('0x2b')][_0x34c5('0xd7')]==='DELIVERED'){return _0x1e922c[_0x34c5('0x35')]({'read':!![]});}else{logger[_0x34c5('0x27')](_0x34c5('0x24'),'status',_0x34c5('0x8d'),util[_0x34c5('0xd2')](_0x5d0345[_0x34c5('0x59')],{'showHidden':![],'depth':null}));}break;case _0x34c5('0xd9'):if(_0xbf8a61=='DELIVERED_TO_GATEWAY'||_0xbf8a61=='RECEIVED_BY_RECIPIENT'){return _0x1e922c['update']({'read':!![]});}else{logger[_0x34c5('0x27')](_0x34c5('0x24'),'status',_0x34c5('0xd9'),util[_0x34c5('0xd2')](_0x5d0345[_0x34c5('0x59')],{'showHidden':![],'depth':null}));}break;case _0x34c5('0x91'):if(_0xbf8a61==_0x34c5('0xdb')){return _0x1e922c[_0x34c5('0x35')]({'read':!![]});}else{logger['error'](_0x34c5('0x24'),_0x34c5('0x2b'),_0x34c5('0x91'),util[_0x34c5('0xd2')](_0x5d0345[_0x34c5('0x59')],{'showHidden':![],'depth':null}));}break;case _0x34c5('0xdc'):if(_0xbf8a61===_0x34c5('0xdd')||_0xbf8a61===_0x34c5('0xde')){return _0x1e922c[_0x34c5('0x35')]({'read':!![]});}else{logger[_0x34c5('0x27')](_0x34c5('0x24'),_0x34c5('0x2b'),'intelepeer',util[_0x34c5('0xd2')](_0x5d0345[_0x34c5('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x1e922c;}})[_0x34c5('0x21')](respondWithResult(_0x2c4b2b,null))[_0x34c5('0x29')](handleError(_0x2c4b2b,null));};exports[_0x34c5('0xdf')]=function(_0x34f822,_0x5d6e47,_0x5ed5ea){var _0x39c345,_0x52d95a,_0x7f1d37;return db[_0x34c5('0x3d')][_0x34c5('0x62')]({'where':{'id':_0x34f822['params']['id']}})['then'](handleEntityNotFound(_0x5d6e47,null))[_0x34c5('0x21')](function(_0x1a0152){if(_0x1a0152){_0x7f1d37=_0x1a0152;logger[_0x34c5('0x23')](_0x34c5('0x24'),_0x34c5('0x2b'),_0x34c5('0xd1'),_0x1a0152[_0x34c5('0x3f')],util[_0x34c5('0xd2')](_0x34f822[_0x34c5('0x41')],{'showHidden':![],'depth':null}));switch(_0x1a0152[_0x34c5('0x3f')]){case _0x34c5('0x8f'):if(_0x34f822['query'][_0x34c5('0xe0')]&&_0x34f822[_0x34c5('0x41')]['state']){_0x52d95a=_0x34f822[_0x34c5('0x41')]['state'];return db[_0x34c5('0xce')][_0x34c5('0x62')]({'where':{'messageId':_0x34f822[_0x34c5('0x41')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x5d6e47,null))['then'](function(_0x22f7a3){if(_0x22f7a3){_0x39c345=_0x22f7a3;switch(_0x7f1d37['type']){case _0x34c5('0x8f'):if(_0x52d95a==='2'||_0x52d95a==='6'){return _0x39c345[_0x34c5('0x35')]({'read':!![]});}else{logger[_0x34c5('0x27')](_0x34c5('0x24'),_0x34c5('0x2b'),_0x34c5('0x8f'),util[_0x34c5('0xd2')](_0x34f822[_0x34c5('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x39c345;}})[_0x34c5('0x21')](respondWithResult(_0x5d6e47,null))[_0x34c5('0x29')](handleError(_0x5d6e47,null));};exports['addAgents']=function(_0x274072,_0x3c8644,_0x5a18ff){return db[_0x34c5('0x3d')]['find']({'where':{'id':_0x274072['params']['id']}})[_0x34c5('0x21')](handleEntityNotFound(_0x3c8644,null))[_0x34c5('0x21')](function(_0x675d3f){if(_0x675d3f){return _0x675d3f[_0x34c5('0xe1')](_0x274072[_0x34c5('0x59')][_0x34c5('0x6b')],_[_0x34c5('0xe2')](_0x274072[_0x34c5('0x59')],[_0x34c5('0x6b'),'id'])||{})[_0x34c5('0xa0')](function(_0x25fa9f){for(var _0x4219ef=0x0;_0x4219ef<_0x274072[_0x34c5('0x59')][_0x34c5('0x6b')][_0x34c5('0x48')];_0x4219ef+=0x1){socket[_0x34c5('0xe3')](_0x34c5('0xe4'),{'UserId':Number(_0x274072[_0x34c5('0x59')][_0x34c5('0x6b')][_0x4219ef]),'SmsAccountId':Number(_0x274072[_0x34c5('0x63')]['id'])});}return _0x25fa9f;});}})[_0x34c5('0x21')](respondWithResult(_0x3c8644,null))['catch'](handleError(_0x3c8644,null));};exports[_0x34c5('0xe5')]=function(_0x5c80e0,_0x345f7f,_0x522a04){return db[_0x34c5('0x3d')][_0x34c5('0x62')]({'where':{'id':_0x5c80e0[_0x34c5('0x63')]['id']}})[_0x34c5('0x21')](handleEntityNotFound(_0x345f7f,null))['then'](function(_0x548376){if(_0x548376){return _0x548376['removeAgents'](_0x5c80e0[_0x34c5('0x41')][_0x34c5('0x6b')])['then'](function(){if(_['isArray'](_0x5c80e0[_0x34c5('0x41')]['ids'])){for(var _0x265e84=0x0;_0x265e84<_0x5c80e0['query'][_0x34c5('0x6b')][_0x34c5('0x48')];_0x265e84+=0x1){socket[_0x34c5('0xe3')]('userSmsAccount:remove',{'UserId':Number(_0x5c80e0[_0x34c5('0x41')][_0x34c5('0x6b')][_0x265e84]),'SmsAccountId':Number(_0x5c80e0[_0x34c5('0x63')]['id'])});}}else{socket[_0x34c5('0xe3')](_0x34c5('0xe6'),{'UserId':Number(_0x5c80e0[_0x34c5('0x41')]['ids']),'SmsAccountId':Number(_0x5c80e0[_0x34c5('0x63')]['id'])});}});}})[_0x34c5('0x21')](respondWithStatusCode(_0x345f7f,null))[_0x34c5('0x29')](handleError(_0x345f7f,null));};exports['getAgents']=function(_0x1a0762,_0x17de8b,_0x361812){var _0x29a6f3={};var _0x51cb92={};var _0x1b069f;var _0x31955b;return db[_0x34c5('0x3d')]['findOne']({'where':{'id':_0x1a0762[_0x34c5('0x63')]['id']}})[_0x34c5('0x21')](handleEntityNotFound(_0x17de8b,null))[_0x34c5('0x21')](function(_0x58c21b){if(_0x58c21b){_0x1b069f=_0x58c21b;_0x51cb92[_0x34c5('0x45')]=_[_0x34c5('0x42')](db[_0x34c5('0xaa')][_0x34c5('0x56')]);_0x51cb92[_0x34c5('0x41')]=_[_0x34c5('0x42')](_0x1a0762['query']);_0x51cb92['filters']=_[_0x34c5('0x44')](_0x51cb92[_0x34c5('0x45')],_0x51cb92[_0x34c5('0x41')]);_0x29a6f3['attributes']=_[_0x34c5('0x44')](_0x51cb92['model'],qs[_0x34c5('0x47')](_0x1a0762[_0x34c5('0x41')][_0x34c5('0x47')]));_0x29a6f3['attributes']=_0x29a6f3['attributes'][_0x34c5('0x48')]?_0x29a6f3[_0x34c5('0x46')]:_0x51cb92['model'];_0x29a6f3['order']=qs[_0x34c5('0x4c')](_0x1a0762[_0x34c5('0x41')][_0x34c5('0x4c')]);_0x29a6f3['where']=qs[_0x34c5('0x43')](_[_0x34c5('0x69')](_0x1a0762[_0x34c5('0x41')],_0x51cb92['filters']));if(_0x1a0762[_0x34c5('0x41')][_0x34c5('0x4e')]){_0x29a6f3['where']=_[_0x34c5('0x50')](_0x29a6f3['where'],{'$or':_[_0x34c5('0x40')](_0x29a6f3[_0x34c5('0x46')],function(_0x28cdea){var _0x51e100={};_0x51e100[_0x28cdea]={'$like':'%'+_0x1a0762[_0x34c5('0x41')][_0x34c5('0x4e')]+'%'};return _0x51e100;})});}_0x29a6f3=_[_0x34c5('0x50')]({},_0x29a6f3,_0x1a0762[_0x34c5('0x51')]);return _0x1b069f[_0x34c5('0xe7')](_0x29a6f3);}})[_0x34c5('0x21')](function(_0x94c8bf){if(_0x94c8bf){_0x31955b=_0x94c8bf[_0x34c5('0x48')];if(!_0x1a0762['query']['hasOwnProperty'](_0x34c5('0x4a'))){_0x29a6f3[_0x34c5('0x30')]=qs[_0x34c5('0x30')](_0x1a0762['query'][_0x34c5('0x30')]);_0x29a6f3[_0x34c5('0x2e')]=qs['offset'](_0x1a0762[_0x34c5('0x41')][_0x34c5('0x2e')]);}return _0x1b069f['getAgents'](_0x29a6f3);}})[_0x34c5('0x21')](function(_0x21bed1){if(_0x21bed1){return _0x21bed1?{'count':_0x31955b,'rows':_0x21bed1}:null;}})[_0x34c5('0x21')](respondWithResult(_0x17de8b,null))[_0x34c5('0x29')](handleError(_0x17de8b,null));}; \ No newline at end of file +var _0xe1b9=['end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','options','includeAll','findAll','show','params','keys','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','twilio','from','From','Body','messageId','MessageSid','skebby','sender','connectel','plivo','Text','MessageUUID','infobip','results','text','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','spread','interaction','autoclose','push','close','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','SmsQueue','queueId','queue','waitForTheAssignedQueue','info','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','SmsInteraction','Contact','internal','Tags','tag','to\x20is\x20mandatory','List','ListId','out','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','message_id','status_code','groupName','redif','DELIVERED','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','destroy','SmsAccounts','UserProfileResource'];(function(_0x42134b,_0x12ab76){var _0x57d251=function(_0xea2120){while(--_0xea2120){_0x42134b['push'](_0x42134b['shift']());}};_0x57d251(++_0x12ab76);}(_0xe1b9,0xae));var _0x9e1b=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xe1b9[_0x5a9c0c];return _0x53c77d;};'use strict';var emlformat=require(_0x9e1b('0x0'));var rimraf=require(_0x9e1b('0x1'));var zipdir=require(_0x9e1b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e1b('0x3'));var moment=require(_0x9e1b('0x4'));var BPromise=require(_0x9e1b('0x5'));var Mustache=require(_0x9e1b('0x6'));var util=require(_0x9e1b('0x7'));var path=require(_0x9e1b('0x8'));var sox=require(_0x9e1b('0x9'));var csv=require(_0x9e1b('0xa'));var ejs=require(_0x9e1b('0xb'));var fs=require('fs');var fs_extra=require(_0x9e1b('0xc'));var _=require(_0x9e1b('0xd'));var squel=require(_0x9e1b('0xe'));var crypto=require(_0x9e1b('0xf'));var jsforce=require(_0x9e1b('0x10'));var deskjs=require(_0x9e1b('0x11'));var toCsv=require(_0x9e1b('0xa'));var querystring=require('querystring');var Papa=require(_0x9e1b('0x12'));var Redis=require(_0x9e1b('0x13'));var authService=require(_0x9e1b('0x14'));var qs=require(_0x9e1b('0x15'));var as=require(_0x9e1b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9e1b('0x17'));var utils=require(_0x9e1b('0x18'));var config=require(_0x9e1b('0x19'));var licenseUtil=require(_0x9e1b('0x1a'));var db=require(_0x9e1b('0x1b'))['db'];config[_0x9e1b('0x1c')]=_['defaults'](config[_0x9e1b('0x1c')],{'host':_0x9e1b('0x1d'),'port':0x18eb});var socket=require(_0x9e1b('0x1e'))(new Redis(config[_0x9e1b('0x1c')]));require(_0x9e1b('0x1f'))[_0x9e1b('0x20')](socket);var jayson=require(_0x9e1b('0x21'));var client=jayson[_0x9e1b('0x22')][_0x9e1b('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x4b3de9,_0x5a3927,_0x36cfd0,_0x1efcf0){return new BPromise(function(_0x3e7a7e,_0x6d064){var _0x13de14=_0x1efcf0||client;return _0x13de14[_0x9e1b('0x24')](_0x4b3de9,_0x36cfd0)[_0x9e1b('0x25')](function(_0xb17d6b){logger['info'](_0x9e1b('0x26'),_0x5a3927,'request\x20sent');logger[_0x9e1b('0x27')](_0x9e1b('0x28'),_0x5a3927,_0x9e1b('0x29'),JSON[_0x9e1b('0x2a')](_0xb17d6b));if(_0xb17d6b[_0x9e1b('0x2b')]){if(_0xb17d6b[_0x9e1b('0x2b')][_0x9e1b('0x2c')]===0x1f4){logger[_0x9e1b('0x2b')](_0x9e1b('0x26'),_0x5a3927,_0xb17d6b['error'][_0x9e1b('0x2d')]);return _0x6d064(_0xb17d6b['error'][_0x9e1b('0x2d')]);}logger[_0x9e1b('0x2b')]('SmsAccount,\x20%s,\x20%s',_0x5a3927,_0xb17d6b[_0x9e1b('0x2b')][_0x9e1b('0x2d')]);return _0x3e7a7e(_0xb17d6b[_0x9e1b('0x2b')][_0x9e1b('0x2d')]);}else{logger['info'](_0x9e1b('0x26'),_0x5a3927,_0x9e1b('0x29'));_0x3e7a7e(_0xb17d6b['result'][_0x9e1b('0x2d')]);}})['catch'](function(_0x2e9fc5){logger[_0x9e1b('0x2b')](_0x9e1b('0x26'),_0x5a3927,_0x2e9fc5);_0x6d064(_0x2e9fc5);});});}function respondWithStatusCode(_0x42731e,_0x5151eb){_0x5151eb=_0x5151eb||0xcc;return function(_0x139d74){if(_0x139d74){return _0x42731e['sendStatus'](_0x5151eb);}return _0x42731e[_0x9e1b('0x2e')](_0x5151eb)['end']();};}function respondWithResult(_0x35887f,_0x2c3ad4){_0x2c3ad4=_0x2c3ad4||0xc8;return function(_0x12530d){if(_0x12530d){return _0x35887f[_0x9e1b('0x2e')](_0x2c3ad4)[_0x9e1b('0x2f')](_0x12530d);}};}function respondWithFilteredResult(_0x127b71,_0x23938f){return function(_0x5def9f){if(_0x5def9f){var _0x54f750=typeof _0x23938f['offset']===_0x9e1b('0x30')&&typeof _0x23938f[_0x9e1b('0x31')]===_0x9e1b('0x30');var _0x321f60=_0x5def9f['count'];var _0x51134a=_0x54f750?0x0:_0x23938f[_0x9e1b('0x32')];var _0x15e12c=_0x54f750?_0x5def9f[_0x9e1b('0x33')]:_0x23938f[_0x9e1b('0x32')]+_0x23938f[_0x9e1b('0x31')];var _0x2e379d;if(_0x15e12c>=_0x321f60){_0x15e12c=_0x321f60;_0x2e379d=0xc8;}else{_0x2e379d=0xce;}_0x127b71[_0x9e1b('0x2e')](_0x2e379d);return _0x127b71[_0x9e1b('0x34')](_0x9e1b('0x35'),_0x51134a+'-'+_0x15e12c+'/'+_0x321f60)[_0x9e1b('0x2f')](_0x5def9f);}return null;};}function patchUpdates(_0x19f08f){return function(_0x1cbfb0){try{jsonpatch['apply'](_0x1cbfb0,_0x19f08f,!![]);}catch(_0x359b04){return BPromise[_0x9e1b('0x36')](_0x359b04);}return _0x1cbfb0[_0x9e1b('0x37')]();};}function saveUpdates(_0x3918ad,_0x90fd5f){return function(_0x92a876){if(_0x92a876){return _0x92a876[_0x9e1b('0x38')](_0x3918ad)[_0x9e1b('0x25')](function(_0x3ffc0a){return _0x3ffc0a;});}return null;};}function removeEntity(_0x32a508,_0x2c6134){return function(_0x9cf1c7){if(_0x9cf1c7){return _0x9cf1c7[_0x9e1b('0x39')]()[_0x9e1b('0x25')](function(){var _0x659b3=_0x9cf1c7['get']({'plain':!![]});var _0x5a8857=_0x9e1b('0x3a');return db[_0x9e1b('0x3b')]['destroy']({'where':{'type':_0x5a8857,'resourceId':_0x659b3['id']}})[_0x9e1b('0x25')](function(){return _0x9cf1c7;});})[_0x9e1b('0x25')](function(){_0x32a508[_0x9e1b('0x2e')](0xcc)[_0x9e1b('0x3c')]();});}};}function handleEntityNotFound(_0x1a6a6c,_0x6fed8f){return function(_0x841cf1){if(!_0x841cf1){_0x1a6a6c[_0x9e1b('0x3d')](0x194);}return _0x841cf1;};}function handleError(_0x2e8cfd,_0x22b9c3){_0x22b9c3=_0x22b9c3||0x1f4;return function(_0x3ff485){logger[_0x9e1b('0x2b')](_0x3ff485[_0x9e1b('0x3e')]);if(_0x3ff485[_0x9e1b('0x3f')]){delete _0x3ff485[_0x9e1b('0x3f')];}_0x2e8cfd[_0x9e1b('0x2e')](_0x22b9c3)[_0x9e1b('0x40')](_0x3ff485);};}exports[_0x9e1b('0x41')]=function(_0x24d209,_0x35908a){var _0x42a3b0={'include':[{'model':db[_0x9e1b('0x42')],'as':_0x9e1b('0x43')}]},_0x286d8b={},_0x33f39e={'count':0x0,'rows':[]};var _0x39f4a2=_[_0x9e1b('0x44')](db[_0x9e1b('0x45')][_0x9e1b('0x46')],function(_0x5dc591){return{'name':_0x5dc591['fieldName'],'type':_0x5dc591['type'][_0x9e1b('0x47')]};});_0x286d8b[_0x9e1b('0x48')]=_['map'](_0x39f4a2,'name');_0x286d8b[_0x9e1b('0x49')]=_['keys'](_0x24d209[_0x9e1b('0x49')]);_0x286d8b['filters']=_[_0x9e1b('0x4a')](_0x286d8b['model'],_0x286d8b[_0x9e1b('0x49')]);_0x42a3b0[_0x9e1b('0x4b')]=_[_0x9e1b('0x4a')](_0x286d8b[_0x9e1b('0x48')],qs[_0x9e1b('0x4c')](_0x24d209[_0x9e1b('0x49')][_0x9e1b('0x4c')]));_0x42a3b0[_0x9e1b('0x4b')]=_0x42a3b0['attributes'][_0x9e1b('0x4d')]?_0x42a3b0[_0x9e1b('0x4b')]:_0x286d8b[_0x9e1b('0x48')];if(!_0x24d209[_0x9e1b('0x49')][_0x9e1b('0x4e')]('nolimit')){_0x42a3b0[_0x9e1b('0x31')]=qs[_0x9e1b('0x31')](_0x24d209['query'][_0x9e1b('0x31')]);_0x42a3b0[_0x9e1b('0x32')]=qs['offset'](_0x24d209[_0x9e1b('0x49')][_0x9e1b('0x32')]);}_0x42a3b0[_0x9e1b('0x4f')]=qs[_0x9e1b('0x50')](_0x24d209[_0x9e1b('0x49')][_0x9e1b('0x50')]);_0x42a3b0[_0x9e1b('0x51')]=qs[_0x9e1b('0x52')](_[_0x9e1b('0x53')](_0x24d209[_0x9e1b('0x49')],_0x286d8b['filters']),_0x39f4a2);if(_0x24d209[_0x9e1b('0x49')][_0x9e1b('0x54')]){_0x42a3b0[_0x9e1b('0x51')]=_[_0x9e1b('0x55')](_0x42a3b0[_0x9e1b('0x51')],{'$or':_[_0x9e1b('0x44')](_0x39f4a2,function(_0x5c417f){if(_0x5c417f[_0x9e1b('0x56')]!=='VIRTUAL'){var _0x37277f={};_0x37277f[_0x5c417f[_0x9e1b('0x3f')]]={'$like':'%'+_0x24d209[_0x9e1b('0x49')][_0x9e1b('0x54')]+'%'};return _0x37277f;}})});}_0x42a3b0=_[_0x9e1b('0x55')]({},_0x42a3b0,_0x24d209[_0x9e1b('0x57')]);var _0xa3d3f6={'where':_0x42a3b0[_0x9e1b('0x51')]};return db[_0x9e1b('0x45')]['count'](_0xa3d3f6)[_0x9e1b('0x25')](function(_0x43a7f4){_0x33f39e[_0x9e1b('0x33')]=_0x43a7f4;if(_0x24d209[_0x9e1b('0x49')][_0x9e1b('0x58')]){_0x42a3b0['include']=[{'all':!![]}];}return db[_0x9e1b('0x45')][_0x9e1b('0x59')](_0x42a3b0);})[_0x9e1b('0x25')](function(_0x5153b7){_0x33f39e['rows']=_0x5153b7;return _0x33f39e;})[_0x9e1b('0x25')](respondWithFilteredResult(_0x35908a,_0x42a3b0))['catch'](handleError(_0x35908a,null));};exports[_0x9e1b('0x5a')]=function(_0x267673,_0x38f987){var _0x50ea31={'raw':![],'where':{'id':_0x267673[_0x9e1b('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x72072d={};_0x72072d['model']=_[_0x9e1b('0x5c')](db[_0x9e1b('0x45')][_0x9e1b('0x46')]);_0x72072d['query']=_['keys'](_0x267673[_0x9e1b('0x49')]);_0x72072d[_0x9e1b('0x52')]=_[_0x9e1b('0x4a')](_0x72072d[_0x9e1b('0x48')],_0x72072d[_0x9e1b('0x49')]);_0x50ea31[_0x9e1b('0x4b')]=_['intersection'](_0x72072d[_0x9e1b('0x48')],qs['fields'](_0x267673['query'][_0x9e1b('0x4c')]));_0x50ea31[_0x9e1b('0x4b')]=_0x50ea31[_0x9e1b('0x4b')][_0x9e1b('0x4d')]?_0x50ea31[_0x9e1b('0x4b')]:_0x72072d[_0x9e1b('0x48')];if(_0x267673[_0x9e1b('0x49')][_0x9e1b('0x58')]){_0x50ea31[_0x9e1b('0x5d')]=[{'all':!![]}];}_0x50ea31=_['merge']({},_0x50ea31,_0x267673[_0x9e1b('0x57')]);return db[_0x9e1b('0x45')][_0x9e1b('0x5e')](_0x50ea31)[_0x9e1b('0x25')](handleEntityNotFound(_0x38f987,null))['then'](respondWithResult(_0x38f987,null))[_0x9e1b('0x5f')](handleError(_0x38f987,null));};exports[_0x9e1b('0x60')]=function(_0x209669,_0x36a424){return db['SmsAccount'][_0x9e1b('0x60')](_0x209669[_0x9e1b('0x61')],{})[_0x9e1b('0x25')](function(_0x594d60){var _0x221042=_0x209669[_0x9e1b('0x62')][_0x9e1b('0x63')]({'plain':!![]});if(!_0x221042)throw new Error(_0x9e1b('0x64'));if(_0x221042[_0x9e1b('0x65')]===_0x9e1b('0x62')){var _0xcf955f=_0x594d60[_0x9e1b('0x63')]({'plain':!![]});var _0x4103f5=_0x9e1b('0x3a');return db['UserProfileSection'][_0x9e1b('0x5e')]({'where':{'name':_0x4103f5,'userProfileId':_0x221042['userProfileId']},'raw':!![]})[_0x9e1b('0x25')](function(_0x577992){if(_0x577992&&_0x577992[_0x9e1b('0x66')]===0x0){return db[_0x9e1b('0x3b')][_0x9e1b('0x60')]({'name':_0xcf955f[_0x9e1b('0x3f')],'resourceId':_0xcf955f['id'],'type':_0x577992[_0x9e1b('0x3f')],'sectionId':_0x577992['id']},{})[_0x9e1b('0x25')](function(){return _0x594d60;});}else{return _0x594d60;}})[_0x9e1b('0x5f')](function(_0x528889){logger[_0x9e1b('0x2b')](_0x9e1b('0x67'),_0x528889);throw _0x528889;});}return _0x594d60;})[_0x9e1b('0x25')](respondWithResult(_0x36a424,0xc9))[_0x9e1b('0x5f')](handleError(_0x36a424,null));};exports[_0x9e1b('0x38')]=function(_0x1f55eb,_0x2e4dbc){if(_0x1f55eb[_0x9e1b('0x61')]['id']){delete _0x1f55eb[_0x9e1b('0x61')]['id'];}return db['SmsAccount'][_0x9e1b('0x5e')]({'where':{'id':_0x1f55eb[_0x9e1b('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x9e1b('0x43')}]})[_0x9e1b('0x25')](handleEntityNotFound(_0x2e4dbc,null))[_0x9e1b('0x25')](saveUpdates(_0x1f55eb['body'],null))[_0x9e1b('0x25')](respondWithResult(_0x2e4dbc,null))[_0x9e1b('0x5f')](handleError(_0x2e4dbc,null));};exports[_0x9e1b('0x39')]=function(_0xb9f1da,_0x144240){return db['SmsAccount'][_0x9e1b('0x5e')]({'where':{'id':_0xb9f1da[_0x9e1b('0x5b')]['id']}})[_0x9e1b('0x25')](handleEntityNotFound(_0x144240,null))[_0x9e1b('0x25')](removeEntity(_0x144240,null))[_0x9e1b('0x5f')](handleError(_0x144240,null));};exports[_0x9e1b('0x68')]=function(_0x38e759,_0x17756f){return db[_0x9e1b('0x45')][_0x9e1b('0x68')]()['then'](respondWithResult(_0x17756f,null))['catch'](handleError(_0x17756f,null));};exports[_0x9e1b('0x69')]=function(_0x17bf4f,_0x542a0b,_0x41bdc5){if(_0x17bf4f[_0x9e1b('0x61')]['id']){delete _0x17bf4f[_0x9e1b('0x61')]['id'];}return db[_0x9e1b('0x45')][_0x9e1b('0x5e')]({'where':{'id':_0x17bf4f[_0x9e1b('0x5b')]['id']}})['then'](handleEntityNotFound(_0x542a0b,null))[_0x9e1b('0x25')](function(_0x2af2bd){if(_0x2af2bd){_0x17bf4f[_0x9e1b('0x61')][_0x9e1b('0x6a')]=_0x2af2bd['id'];return db[_0x9e1b('0x6b')][_0x9e1b('0x60')](_0x17bf4f[_0x9e1b('0x61')]);}})[_0x9e1b('0x25')](respondWithResult(_0x542a0b,null))[_0x9e1b('0x5f')](handleError(_0x542a0b,null));};exports[_0x9e1b('0x6c')]=function(_0x19b367,_0xa0ac43,_0x9b011c){var _0x20f1d8={'raw':![],'where':{}};var _0x4e2fb2={};var _0x1ccc25={'count':0x0,'rows':[]};return db[_0x9e1b('0x45')][_0x9e1b('0x6d')]({'where':{'id':_0x19b367['params']['id']}})[_0x9e1b('0x25')](handleEntityNotFound(_0xa0ac43,null))['then'](function(_0xd328be){if(_0xd328be){_0x4e2fb2['model']=_[_0x9e1b('0x5c')](db[_0x9e1b('0x6b')][_0x9e1b('0x46')]);_0x4e2fb2[_0x9e1b('0x49')]=_['keys'](_0x19b367['query']);_0x4e2fb2[_0x9e1b('0x52')]=_[_0x9e1b('0x4a')](_0x4e2fb2[_0x9e1b('0x48')],_0x4e2fb2['query']);_0x20f1d8['attributes']=_[_0x9e1b('0x4a')](_0x4e2fb2[_0x9e1b('0x48')],qs[_0x9e1b('0x4c')](_0x19b367[_0x9e1b('0x49')][_0x9e1b('0x4c')]));_0x20f1d8[_0x9e1b('0x4b')]=_0x20f1d8[_0x9e1b('0x4b')][_0x9e1b('0x4d')]?_0x20f1d8[_0x9e1b('0x4b')]:_0x4e2fb2['model'];if(!_0x19b367[_0x9e1b('0x49')][_0x9e1b('0x4e')](_0x9e1b('0x6e'))){_0x20f1d8[_0x9e1b('0x31')]=qs[_0x9e1b('0x31')](_0x19b367[_0x9e1b('0x49')][_0x9e1b('0x31')]);_0x20f1d8[_0x9e1b('0x32')]=qs['offset'](_0x19b367[_0x9e1b('0x49')]['offset']);}_0x20f1d8[_0x9e1b('0x4f')]=qs[_0x9e1b('0x50')](_0x19b367['query'][_0x9e1b('0x50')]);_0x20f1d8[_0x9e1b('0x51')]=qs[_0x9e1b('0x52')](_[_0x9e1b('0x53')](_0x19b367[_0x9e1b('0x49')],_0x4e2fb2[_0x9e1b('0x52')]));_0x20f1d8[_0x9e1b('0x51')][_0x9e1b('0x6a')]=_0xd328be['id'];if(_0x19b367[_0x9e1b('0x49')]['filter']){_0x20f1d8['where']=_[_0x9e1b('0x55')](_0x20f1d8[_0x9e1b('0x51')],{'$or':_[_0x9e1b('0x44')](_0x20f1d8[_0x9e1b('0x4b')],function(_0xbc35b){var _0x44a508={};_0x44a508[_0xbc35b]={'$like':'%'+_0x19b367[_0x9e1b('0x49')][_0x9e1b('0x54')]+'%'};return _0x44a508;})});}_0x20f1d8=_[_0x9e1b('0x55')]({},_0x20f1d8,_0x19b367[_0x9e1b('0x57')]);return db[_0x9e1b('0x6b')][_0x9e1b('0x33')]({'where':_0x20f1d8[_0x9e1b('0x51')]})['then'](function(_0x42c394){_0x1ccc25[_0x9e1b('0x33')]=_0x42c394;if(_0x19b367[_0x9e1b('0x49')][_0x9e1b('0x58')]){_0x20f1d8[_0x9e1b('0x5d')]=[{'all':!![]}];}return db[_0x9e1b('0x6b')][_0x9e1b('0x59')](_0x20f1d8);})[_0x9e1b('0x25')](function(_0x54d5d1){_0x1ccc25[_0x9e1b('0x6f')]=_0x54d5d1;return _0x1ccc25;});}})[_0x9e1b('0x25')](respondWithFilteredResult(_0xa0ac43,_0x20f1d8))[_0x9e1b('0x5f')](handleError(_0xa0ac43,null));};exports[_0x9e1b('0x70')]=function(_0x55fc8a,_0x370d29,_0x1e71f7){return db[_0x9e1b('0x45')]['find']({'where':{'id':_0x55fc8a[_0x9e1b('0x5b')]['id']}})[_0x9e1b('0x25')](handleEntityNotFound(_0x370d29,null))[_0x9e1b('0x25')](function(_0x1a7fe5){if(_0x1a7fe5){return _0x1a7fe5[_0x9e1b('0x70')](_0x55fc8a[_0x9e1b('0x49')][_0x9e1b('0x71')]);}})['then'](respondWithStatusCode(_0x370d29,null))[_0x9e1b('0x5f')](handleError(_0x370d29,null));};exports['addAnswer']=function(_0x1bf775,_0x2119a7,_0x4f8e7b){if(_0x1bf775[_0x9e1b('0x61')]['id']){delete _0x1bf775[_0x9e1b('0x61')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x1bf775['params']['id']}})[_0x9e1b('0x25')](handleEntityNotFound(_0x2119a7,null))[_0x9e1b('0x25')](function(_0x252c9e){if(_0x252c9e){_0x1bf775[_0x9e1b('0x61')][_0x9e1b('0x6a')]=_0x252c9e['id'];return db[_0x9e1b('0x72')]['create'](_0x1bf775[_0x9e1b('0x61')]);}})[_0x9e1b('0x25')](respondWithResult(_0x2119a7,null))[_0x9e1b('0x5f')](handleError(_0x2119a7,null));};exports[_0x9e1b('0x73')]=function(_0x20dfc9,_0x18a0d3,_0x15cc5d){var _0x366558={'raw':![],'where':{}};var _0x494fbe={};var _0x524ff5={'count':0x0,'rows':[]};return db[_0x9e1b('0x45')][_0x9e1b('0x6d')]({'where':{'id':_0x20dfc9[_0x9e1b('0x5b')]['id']}})[_0x9e1b('0x25')](handleEntityNotFound(_0x18a0d3,null))[_0x9e1b('0x25')](function(_0x40fd02){if(_0x40fd02){_0x494fbe[_0x9e1b('0x48')]=_['keys'](db[_0x9e1b('0x72')][_0x9e1b('0x46')]);_0x494fbe['query']=_[_0x9e1b('0x5c')](_0x20dfc9['query']);_0x494fbe[_0x9e1b('0x52')]=_[_0x9e1b('0x4a')](_0x494fbe[_0x9e1b('0x48')],_0x494fbe[_0x9e1b('0x49')]);_0x366558['attributes']=_['intersection'](_0x494fbe[_0x9e1b('0x48')],qs[_0x9e1b('0x4c')](_0x20dfc9[_0x9e1b('0x49')][_0x9e1b('0x4c')]));_0x366558[_0x9e1b('0x4b')]=_0x366558[_0x9e1b('0x4b')][_0x9e1b('0x4d')]?_0x366558[_0x9e1b('0x4b')]:_0x494fbe['model'];if(!_0x20dfc9['query'][_0x9e1b('0x4e')](_0x9e1b('0x6e'))){_0x366558[_0x9e1b('0x31')]=qs[_0x9e1b('0x31')](_0x20dfc9[_0x9e1b('0x49')][_0x9e1b('0x31')]);_0x366558[_0x9e1b('0x32')]=qs[_0x9e1b('0x32')](_0x20dfc9[_0x9e1b('0x49')][_0x9e1b('0x32')]);}_0x366558[_0x9e1b('0x4f')]=qs[_0x9e1b('0x50')](_0x20dfc9[_0x9e1b('0x49')]['sort']);_0x366558[_0x9e1b('0x51')]=qs['filters'](_['pick'](_0x20dfc9['query'],_0x494fbe[_0x9e1b('0x52')]));_0x366558['where'][_0x9e1b('0x6a')]=_0x40fd02['id'];if(_0x20dfc9['query']['filter']){_0x366558[_0x9e1b('0x51')]=_[_0x9e1b('0x55')](_0x366558['where'],{'$or':_[_0x9e1b('0x44')](_0x366558[_0x9e1b('0x4b')],function(_0xa28495){var _0x402200={};_0x402200[_0xa28495]={'$like':'%'+_0x20dfc9['query'][_0x9e1b('0x54')]+'%'};return _0x402200;})});}_0x366558=_['merge']({},_0x366558,_0x20dfc9[_0x9e1b('0x57')]);return db['CannedAnswer'][_0x9e1b('0x33')]({'where':_0x366558['where']})[_0x9e1b('0x25')](function(_0x12f4e4){_0x524ff5['count']=_0x12f4e4;if(_0x20dfc9[_0x9e1b('0x49')][_0x9e1b('0x58')]){_0x366558[_0x9e1b('0x5d')]=[{'all':!![]}];}return db[_0x9e1b('0x72')][_0x9e1b('0x59')](_0x366558);})['then'](function(_0x163fc1){_0x524ff5[_0x9e1b('0x6f')]=_0x163fc1;return _0x524ff5;});}})[_0x9e1b('0x25')](respondWithFilteredResult(_0x18a0d3,_0x366558))[_0x9e1b('0x5f')](handleError(_0x18a0d3,null));};exports[_0x9e1b('0x74')]=function(_0x338580,_0x1a45ea,_0x343675){return db[_0x9e1b('0x45')][_0x9e1b('0x5e')]({'where':{'id':_0x338580[_0x9e1b('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1a45ea,null))[_0x9e1b('0x25')](function(_0x5756f2){if(_0x5756f2){return _0x5756f2[_0x9e1b('0x74')](_0x338580[_0x9e1b('0x49')][_0x9e1b('0x71')]);}})['then'](respondWithStatusCode(_0x1a45ea,null))[_0x9e1b('0x5f')](handleError(_0x1a45ea,null));};exports['notify']=function(_0x59098f,_0x40caf7,_0x13f1ea){var _0x27004f={'channel':_0x9e1b('0x75')};var _0x16ead4=[];var _0xce5afa=[];var _0x4c3e0d={};return db[_0x9e1b('0x45')][_0x9e1b('0x5e')]({'where':{'id':_0x59098f[_0x9e1b('0x5b')]['id']},'include':[{'model':db[_0x9e1b('0x76')],'as':_0x9e1b('0x77')}]})['then'](handleEntityNotFound(_0x40caf7,null))['then'](function(_0x3e937b){_0x27004f['account']=_0x3e937b;_0x27004f[_0x9e1b('0x78')]=_[_0x9e1b('0x79')](_0x3e937b[_0x9e1b('0x77')],[_0x9e1b('0x7a')],[_0x9e1b('0x7b')]);if(_0x27004f['account'][_0x9e1b('0x77')]){delete _0x27004f[_0x9e1b('0x7c')][_0x9e1b('0x77')];}return db[_0x9e1b('0x7d')][_0x9e1b('0x68')]();})[_0x9e1b('0x25')](function(_0x356b5b){if(!_0x356b5b){throw new db[(_0x9e1b('0x7e'))]['ValidationError'](_0x9e1b('0x7f'));}_0x16ead4=_['difference'](_[_0x9e1b('0x5c')](_0x356b5b),[_0x9e1b('0x80'),_0x9e1b('0x81')]);_0xce5afa=_[_0x9e1b('0x82')](_[_0x9e1b('0x5c')](_0x356b5b),['createdAt',_0x9e1b('0x81'),_0x9e1b('0x83'),'ListId']);_0x27004f[_0x9e1b('0x61')]={'mapKey':'mobile'};if(_0x27004f[_0x9e1b('0x7c')][_0x9e1b('0x56')]){switch(_0x27004f[_0x9e1b('0x7c')][_0x9e1b('0x56')]){case _0x9e1b('0x84'):_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x85')]=_0x59098f[_0x9e1b('0x61')][_0x9e1b('0x86')];_0x27004f['body']['body']=_0x59098f[_0x9e1b('0x61')][_0x9e1b('0x87')];_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x88')]=_0x59098f[_0x9e1b('0x61')][_0x9e1b('0x89')];break;case _0x9e1b('0x8a'):_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x85')]='+'+_0x59098f['body'][_0x9e1b('0x8b')];_0x27004f['body']['body']=_0x59098f[_0x9e1b('0x61')]['text'];break;case _0x9e1b('0x8c'):_0x27004f['body'][_0x9e1b('0x85')]=_0x59098f[_0x9e1b('0x61')][_0x9e1b('0x85')];_0x27004f['body']['body']=_0x59098f['body']['message'];break;case'clicksend':_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x85')]=_0x59098f['body'][_0x9e1b('0x85')];_0x27004f['body'][_0x9e1b('0x61')]=_0x59098f[_0x9e1b('0x61')][_0x9e1b('0x61')];_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x88')]=_0x59098f[_0x9e1b('0x61')]['message_id'];break;case _0x9e1b('0x8d'):_0x27004f[_0x9e1b('0x61')]['from']=_0x59098f[_0x9e1b('0x61')]['From'];_0x27004f['body'][_0x9e1b('0x61')]=_0x59098f[_0x9e1b('0x61')][_0x9e1b('0x8e')];_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x88')]=_0x59098f[_0x9e1b('0x61')][_0x9e1b('0x8f')];break;case _0x9e1b('0x90'):_0x27004f[_0x9e1b('0x61')]['from']='+'+_0x59098f[_0x9e1b('0x61')][_0x9e1b('0x91')][0x0][_0x9e1b('0x85')];_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x61')]=_0x59098f['body'][_0x9e1b('0x91')][0x0][_0x9e1b('0x92')];_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x88')]=_0x59098f[_0x9e1b('0x61')][_0x9e1b('0x91')][0x0][_0x9e1b('0x88')];break;case _0x9e1b('0x93'):_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x85')]=_0x59098f[_0x9e1b('0x61')]['originatingAddress'];_0x27004f['body'][_0x9e1b('0x61')]=_0x59098f['body'][_0x9e1b('0x94')][_0x9e1b('0x2d')];break;case _0x9e1b('0x95'):_0x27004f['body'][_0x9e1b('0x85')]=_0x59098f[_0x9e1b('0x61')][_0x9e1b('0x96')];_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x61')]=_0x59098f[_0x9e1b('0x61')]['text'];_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x88')]=_0x59098f['body'][_0x9e1b('0x97')];break;case _0x9e1b('0x98'):_0x27004f['body'][_0x9e1b('0x88')]=_0x59098f[_0x9e1b('0x61')][0x0][_0x9e1b('0x2d')]['id'];_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x85')]=_0x59098f[_0x9e1b('0x61')][0x0][_0x9e1b('0x2d')][_0x9e1b('0x85')];_0x27004f[_0x9e1b('0x61')]['body']=_0x59098f[_0x9e1b('0x61')][0x0]['message'][_0x9e1b('0x92')];break;case _0x9e1b('0x99'):_0x27004f['body'][_0x9e1b('0x85')]=_0x59098f['body']['from'];_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x61')]=_0x59098f[_0x9e1b('0x61')]['message'];_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x88')]=_0x59098f[_0x9e1b('0x61')][_0x9e1b('0x9a')];break;}}if(_0x27004f[_0x9e1b('0x61')]['id']){delete _0x27004f['body']['id'];}if(_[_0x9e1b('0x9b')](_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x85')])){throw new db['Sequelize']['ValidationError'](_0x9e1b('0x9c'));}if(_[_0x9e1b('0x9b')](_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x61')])||_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x61')]===''){throw new db[(_0x9e1b('0x7e'))][(_0x9e1b('0x9d'))](_0x9e1b('0x9e'));}if(_['isNil'](_0x27004f['body'][_0x9e1b('0x9f')])){throw new db[(_0x9e1b('0x7e'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xce5afa);}if(!_[_0x9e1b('0xa0')](_0xce5afa,_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x9f')])){throw new db[(_0x9e1b('0x7e'))]['ValidationError'](_0x9e1b('0xa1')+_0xce5afa);}_0x4c3e0d[_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x9f')]]=_0x27004f[_0x9e1b('0x61')]['from'];return db[_0x9e1b('0xa2')][_0x9e1b('0x5e')]({'where':{'id':_0x27004f[_0x9e1b('0x7c')]['ListId']},'include':[{'model':db[_0x9e1b('0x7d')],'as':_0x9e1b('0xa3'),'where':_0x4c3e0d,'limit':0x1,'order':[['updatedAt',_0x9e1b('0xa4')]]}]});})[_0x9e1b('0x25')](handleEntityNotFound(_0x40caf7,null))['then'](function(_0x1576c7){if(_0x1576c7){_0x27004f[_0x9e1b('0xa5')]=_[_0x9e1b('0xa6')](_0x1576c7,['Contacts']);if(_0x1576c7['Contacts'][_0x9e1b('0x4d')]){return _0x1576c7[_0x9e1b('0xa3')][0x0];}var _0x3e3032=_[_0x9e1b('0xa7')](_0x27004f[_0x9e1b('0x61')],{'firstName':_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x85')],'ListId':_0x1576c7['id']});_0x3e3032[_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x9f')]]=_0x27004f['body'][_0x9e1b('0x85')];return db[_0x9e1b('0x7d')]['create'](_0x3e3032,{'fields':_0x16ead4,'raw':!![]});}})[_0x9e1b('0x25')](handleEntityNotFound(_0x40caf7,null))[_0x9e1b('0x25')](function(_0x583d8b){if(_0x583d8b){_0x27004f['contact']=_0x583d8b;var _0x19f543={'ContactId':_0x583d8b['id'],'phone':_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x85')],'SmsAccountId':_0x59098f['params']['id']};var _0x11d8e5={'ContactId':_0x583d8b['id'],'SmsAccountId':_0x59098f['params']['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x11d8e5})[_0x9e1b('0x25')](function(_0xeb8e72){if(_0xeb8e72){return[_0xeb8e72,![]];}return db['SmsInteraction']['create'](_0x19f543)['then'](function(_0x5711bd){return[_0x5711bd,!![]];});});}})[_0x9e1b('0xa8')](function(_0x52168f,_0x57d9d3){_0x27004f[_0x9e1b('0xa9')]=_0x52168f[_0x9e1b('0x63')]({'plain':!![]});_0x27004f[_0x9e1b('0xa9')]['created']=![];if(_0x57d9d3){if(_0x27004f[_0x9e1b('0x7c')][_0x9e1b('0xaa')]){_0x27004f[_0x9e1b('0x78')][_0x9e1b('0xab')]({'id':0x0,'priority':_0x27004f[_0x9e1b('0x78')][_0x9e1b('0x4d')]+0x1,'app':_0x9e1b('0xac'),'appdata':'unmanaged','interval':_0x9e1b('0xad')});}_0x27004f[_0x9e1b('0xa9')][_0x9e1b('0xae')]=!![];}return db[_0x9e1b('0xaf')][_0x9e1b('0x60')]({'phone':_0x27004f[_0x9e1b('0x61')]['from'],'messageId':_0x27004f[_0x9e1b('0x61')][_0x9e1b('0x88')],'body':_0x27004f['body'][_0x9e1b('0x61')],'SmsAccountId':_0x59098f['params']['id'],'SmsInteractionId':_0x52168f['id'],'direction':'in','ContactId':_0x52168f[_0x9e1b('0xb0')],'AttachmentId':_0x27004f[_0x9e1b('0x61')][_0x9e1b('0xb1')]});})[_0x9e1b('0x25')](function(_0x67eca){_0x27004f['message']=_0x67eca;if(!_0x27004f[_0x9e1b('0xa9')][_0x9e1b('0xb2')])return;return db[_0x9e1b('0xb3')]['find']({'attributes':['id','name'],'where':{'id':_0x27004f['interaction'][_0x9e1b('0xb2')]}});})[_0x9e1b('0x25')](function(_0x28bb00){if(_0x28bb00){_0x27004f['applications'][_0x9e1b('0xb4')]({'id':0x0,'priority':0x0,'app':_0x9e1b('0xb5'),'appdata':_0x28bb00[_0x9e1b('0x3f')]+','+(_0x27004f[_0x9e1b('0x7c')]['waitForTheAssignedAgent']||0xa),'interval':_0x9e1b('0xad')});}if(!_0x27004f[_0x9e1b('0xa9')]['queueId'])return;return db[_0x9e1b('0xb6')][_0x9e1b('0x5e')]({'attributes':['id','name'],'where':{'id':_0x27004f[_0x9e1b('0xa9')][_0x9e1b('0xb7')]}});})[_0x9e1b('0x25')](function(_0x393736){if(_0x393736){_0x27004f[_0x9e1b('0x78')][_0x9e1b('0xb4')]({'id':0x0,'priority':0x1,'app':_0x9e1b('0xb8'),'appdata':_0x393736[_0x9e1b('0x3f')]+','+(_0x27004f[_0x9e1b('0x7c')][_0x9e1b('0xb9')]||0x12c),'interval':_0x9e1b('0xad')});}return respondWithRpcPromise('Start','startRouting',_0x27004f);})[_0x9e1b('0x25')](function(_0x37ad28){if(_0x37ad28){var _0x78a1aa=0xc8;var _0x59ba07='receiveMessage';logger[_0x9e1b('0xba')](_0x9e1b('0x28'),_0x59ba07,_0x78a1aa,_0x9e1b('0xbb'));logger[_0x9e1b('0x27')](_0x9e1b('0xbc'),_0x59ba07,_0x78a1aa,_0x9e1b('0xbb'),JSON[_0x9e1b('0x2a')](_0x37ad28));if(_0x27004f[_0x9e1b('0x7c')][_0x9e1b('0x56')]===_0x9e1b('0x84')){return _0x40caf7[_0x9e1b('0x2e')](_0x78a1aa)['set']('Content-Type','text/xml')[_0x9e1b('0x40')](_0x9e1b('0xbd'));}else{return _0x40caf7[_0x9e1b('0x2e')](_0x78a1aa)[_0x9e1b('0x2f')](_0x37ad28);}}})[_0x9e1b('0x5f')](handleError(_0x40caf7,null));};exports['addApplications']=function(_0x5a196e,_0x2a914e){var _0x1c805f=_0x5a196e['params']['id'];var _0x131df9=_0x5a196e[_0x9e1b('0x61')];var _0x3c84df=0xc8;var _0x3851a4=null;return db[_0x9e1b('0xbe')][_0x9e1b('0xbf')]({'isolationLevel':db[_0x9e1b('0xbe')][_0x9e1b('0xc0')][_0x9e1b('0xc1')]['READ_COMMITTED']},function(_0x5cd06f){return db[_0x9e1b('0x45')][_0x9e1b('0x6d')]({'where':{'id':_0x1c805f},'transaction':_0x5cd06f})['then'](function(_0x1da555){if(_0x1da555){return db['SmsApplication'][_0x9e1b('0x39')]({'where':{'SmsAccountId':_0x1c805f},'transaction':_0x5cd06f})[_0x9e1b('0x25')](function(){var _0xe96830=_[_0x9e1b('0x44')](_0x131df9,function(_0x4ad1a4){_0x4ad1a4[_0x9e1b('0x6a')]=_0x1c805f;return _0x4ad1a4;});return db[_0x9e1b('0x76')][_0x9e1b('0xc2')](_0xe96830,{'transaction':_0x5cd06f});});}else{_0x3c84df=0x194;_0x3851a4=[];}});})[_0x9e1b('0x25')](function(){if(_0x3c84df!==0x194){return db[_0x9e1b('0x76')][_0x9e1b('0xc3')]({'where':{'SmsAccountId':_0x1c805f},'order':_0x9e1b('0x7a')})[_0x9e1b('0x25')](function(_0x18f835){_0x3851a4=_0x18f835;});}})[_0x9e1b('0x5f')](function(_0x38df42){_0x3c84df=0x1f4;logger['error'](_0x38df42[_0x9e1b('0x3e')]);if(_0x38df42[_0x9e1b('0x3f')]){delete _0x38df42[_0x9e1b('0x3f')];}_0x3851a4=_0x38df42;})[_0x9e1b('0xc4')](function(){if(_0x3851a4===null){_0x2a914e['sendStatus'](_0x3c84df);}else{if(_0x3c84df===0x1f4){_0x2a914e['status'](_0x3c84df)[_0x9e1b('0x40')](_0x3851a4);}else{_0x2a914e[_0x9e1b('0x2e')](_0x3c84df)[_0x9e1b('0x2f')](_0x3851a4);}}});};exports['getApplications']=function(_0x21ea11,_0x110acc,_0x3cd785){var _0x45a2f8={};var _0x42c569={};var _0x2f291e;var _0x571425;return db[_0x9e1b('0x45')][_0x9e1b('0x6d')]({'where':{'id':_0x21ea11[_0x9e1b('0x5b')]['id']}})[_0x9e1b('0x25')](handleEntityNotFound(_0x110acc,null))[_0x9e1b('0x25')](function(_0x11b099){if(_0x11b099){_0x2f291e=_0x11b099;_0x42c569[_0x9e1b('0x48')]=_['keys'](db[_0x9e1b('0x76')]['rawAttributes']);_0x42c569[_0x9e1b('0x49')]=_[_0x9e1b('0x5c')](_0x21ea11[_0x9e1b('0x49')]);_0x42c569[_0x9e1b('0x52')]=_['intersection'](_0x42c569[_0x9e1b('0x48')],_0x42c569[_0x9e1b('0x49')]);_0x45a2f8[_0x9e1b('0x4b')]=_[_0x9e1b('0x4a')](_0x42c569[_0x9e1b('0x48')],qs[_0x9e1b('0x4c')](_0x21ea11[_0x9e1b('0x49')][_0x9e1b('0x4c')]));_0x45a2f8[_0x9e1b('0x4b')]=_0x45a2f8[_0x9e1b('0x4b')]['length']?_0x45a2f8[_0x9e1b('0x4b')]:_0x42c569[_0x9e1b('0x48')];_0x45a2f8['order']=qs[_0x9e1b('0x50')](_0x21ea11[_0x9e1b('0x49')][_0x9e1b('0x50')]);_0x45a2f8[_0x9e1b('0x51')]=qs[_0x9e1b('0x52')](_[_0x9e1b('0x53')](_0x21ea11[_0x9e1b('0x49')],_0x42c569[_0x9e1b('0x52')]));if(_0x21ea11[_0x9e1b('0x49')][_0x9e1b('0x54')]){_0x45a2f8[_0x9e1b('0x51')]=_['merge'](_0x45a2f8[_0x9e1b('0x51')],{'$or':_[_0x9e1b('0x44')](_0x45a2f8[_0x9e1b('0x4b')],function(_0x56b51c){var _0xc8b03c={};_0xc8b03c[_0x56b51c]={'$like':'%'+_0x21ea11[_0x9e1b('0x49')]['filter']+'%'};return _0xc8b03c;})});}_0x45a2f8=_[_0x9e1b('0x55')]({},_0x45a2f8,_0x21ea11[_0x9e1b('0x57')]);return _0x2f291e[_0x9e1b('0xc5')](_0x45a2f8);}})[_0x9e1b('0x25')](function(_0x3547e9){if(_0x3547e9){_0x571425=_0x3547e9[_0x9e1b('0x4d')];if(!_0x21ea11[_0x9e1b('0x49')][_0x9e1b('0x4e')](_0x9e1b('0x6e'))){_0x45a2f8['limit']=qs[_0x9e1b('0x31')](_0x21ea11[_0x9e1b('0x49')][_0x9e1b('0x31')]);_0x45a2f8[_0x9e1b('0x32')]=qs['offset'](_0x21ea11[_0x9e1b('0x49')]['offset']);}return _0x2f291e[_0x9e1b('0xc5')](_0x45a2f8);}})[_0x9e1b('0x25')](function(_0x397bda){if(_0x397bda){return _0x397bda?{'count':_0x571425,'rows':_0x397bda}:null;}})[_0x9e1b('0x25')](respondWithResult(_0x110acc,null))[_0x9e1b('0x5f')](handleError(_0x110acc,null));};exports['getInteractions']=function(_0x41bc6a,_0x3d7161,_0x5cd4d1){var _0x1f566f={'raw':![],'where':{}};var _0x5f2efc={};var _0x341278={'count':0x0,'rows':[]};return db['SmsAccount'][_0x9e1b('0x6d')]({'where':{'id':_0x41bc6a['params']['id']}})[_0x9e1b('0x25')](handleEntityNotFound(_0x3d7161,null))['then'](function(_0x1a7e0c){if(_0x1a7e0c){_0x5f2efc[_0x9e1b('0x48')]=_['keys'](db[_0x9e1b('0xc6')]['rawAttributes']);_0x5f2efc['query']=_[_0x9e1b('0x5c')](_0x41bc6a['query']);_0x5f2efc[_0x9e1b('0x52')]=_[_0x9e1b('0x4a')](_0x5f2efc['model'],_0x5f2efc['query']);_0x1f566f[_0x9e1b('0x4b')]=_['intersection'](_0x5f2efc[_0x9e1b('0x48')],qs[_0x9e1b('0x4c')](_0x41bc6a['query'][_0x9e1b('0x4c')]));_0x1f566f[_0x9e1b('0x4b')]=_0x1f566f['attributes'][_0x9e1b('0x4d')]?_0x1f566f[_0x9e1b('0x4b')]:_0x5f2efc[_0x9e1b('0x48')];if(!_0x41bc6a['query'][_0x9e1b('0x4e')](_0x9e1b('0x6e'))){_0x1f566f['limit']=qs[_0x9e1b('0x31')](_0x41bc6a['query'][_0x9e1b('0x31')]);_0x1f566f['offset']=qs['offset'](_0x41bc6a[_0x9e1b('0x49')][_0x9e1b('0x32')]);}_0x1f566f['order']=qs['sort'](_0x41bc6a[_0x9e1b('0x49')][_0x9e1b('0x50')]);_0x1f566f[_0x9e1b('0x51')]=qs[_0x9e1b('0x52')](_[_0x9e1b('0x53')](_0x41bc6a['query'],_0x5f2efc[_0x9e1b('0x52')]));_0x1f566f[_0x9e1b('0x51')][_0x9e1b('0x6a')]=_0x1a7e0c['id'];if(_0x41bc6a[_0x9e1b('0x49')]['filter']){_0x1f566f[_0x9e1b('0x51')]=_[_0x9e1b('0x55')](_0x1f566f[_0x9e1b('0x51')],{'$or':_[_0x9e1b('0x44')](_0x1f566f[_0x9e1b('0x4b')],function(_0xd63cd6){var _0x2e341a={};_0x2e341a[_0xd63cd6]={'$like':'%'+_0x41bc6a[_0x9e1b('0x49')][_0x9e1b('0x54')]+'%'};return _0x2e341a;})});}_0x1f566f=_['merge']({},_0x1f566f,_0x41bc6a[_0x9e1b('0x57')]);return db['SmsInteraction'][_0x9e1b('0x33')]({'where':_0x1f566f[_0x9e1b('0x51')]})[_0x9e1b('0x25')](function(_0x52250c){_0x341278[_0x9e1b('0x33')]=_0x52250c;if(_0x41bc6a[_0x9e1b('0x49')][_0x9e1b('0x58')]){_0x1f566f['include']=[{'model':db[_0x9e1b('0x7d')],'as':_0x9e1b('0xc7'),'required':![]},{'model':db[_0x9e1b('0xb3')],'as':'Owner','attributes':[_0x9e1b('0x3f'),'fullname',_0x9e1b('0xc8')],'required':![]},{'model':db['Tag'],'as':_0x9e1b('0xc9'),'attributes':['id',_0x9e1b('0x3f'),'color'],'where':_0x41bc6a[_0x9e1b('0x49')][_0x9e1b('0xca')]?{'id':_0x41bc6a[_0x9e1b('0x49')][_0x9e1b('0xca')]}:undefined,'required':_0x41bc6a['query'][_0x9e1b('0xca')]?!![]:![]}];}return db['SmsInteraction'][_0x9e1b('0x59')](_0x1f566f);})[_0x9e1b('0x25')](function(_0x35da1d){_0x341278[_0x9e1b('0x6f')]=_0x35da1d;return _0x341278;});}})[_0x9e1b('0x25')](respondWithFilteredResult(_0x3d7161,_0x1f566f))['catch'](handleError(_0x3d7161,null));};exports[_0x9e1b('0x40')]=function(_0x30446a,_0x4aa4e4,_0x301b91){var _0x470e55,_0x30ff57,_0x26abfe;if(_[_0x9e1b('0x9b')](_0x30446a[_0x9e1b('0x61')][_0x9e1b('0x61')])||_0x30446a['body'][_0x9e1b('0x61')]===''){throw new db['Sequelize'][(_0x9e1b('0x9d'))](_0x9e1b('0x9e'));}if(_['isNil'](_0x30446a[_0x9e1b('0x61')]['to'])){throw new db['Sequelize'][(_0x9e1b('0x9d'))](_0x9e1b('0xcb'));}_0x470e55=_0x30446a['body']['to'];return db[_0x9e1b('0x45')][_0x9e1b('0x5e')]({'where':{'id':_0x30446a[_0x9e1b('0x5b')]['id']},'include':[{'model':db[_0x9e1b('0xa2')],'as':_0x9e1b('0xcc'),'include':[{'model':db['CmContact'],'as':_0x9e1b('0xa3'),'where':{'mobile':_0x470e55},'limit':0x1,'order':[[_0x9e1b('0x81'),_0x9e1b('0xa4')]]}]}]})[_0x9e1b('0x25')](handleEntityNotFound(_0x4aa4e4,null))[_0x9e1b('0x25')](function(_0xe033c8){if(_0xe033c8&&_0xe033c8[_0x9e1b('0xcc')]){_0x30ff57=_0xe033c8[_0x9e1b('0x63')]({'plain':!![]});if(_0x30ff57[_0x9e1b('0xcc')]&&_0x30ff57[_0x9e1b('0xcc')][_0x9e1b('0xa3')][_0x9e1b('0x4d')]){return _0x30ff57[_0x9e1b('0xcc')][_0x9e1b('0xa3')][0x0];}return db[_0x9e1b('0x7d')][_0x9e1b('0x60')](_[_0x9e1b('0xa7')](_0x30446a[_0x9e1b('0x61')],{'firstName':_0x470e55,'mobile':_0x470e55,'phone':_0x470e55,'ListId':_0x30ff57[_0x9e1b('0xcd')]}));}})['then'](handleEntityNotFound(_0x4aa4e4,null))[_0x9e1b('0x25')](function(_0x2f76bd){if(_0x2f76bd){_0x26abfe=_0x2f76bd;return db[_0x9e1b('0xc6')][_0x9e1b('0x5e')]({'where':{'ContactId':_0x26abfe['id'],'closed':![],'SmsAccountId':_0x30ff57['id']}})['then'](function(_0x53000a){if(_0x53000a){return[_0x53000a,![]];}return db[_0x9e1b('0xc6')][_0x9e1b('0x60')]({'UserId':_0x30446a[_0x9e1b('0x62')]['id'],'ContactId':_0x26abfe['id'],'SmsAccountId':_0x30ff57['id'],'phone':_0x470e55,'firstMsgDirection':_0x9e1b('0xce'),'Messages':[_['merge'](_0x30446a[_0x9e1b('0x61')],{'read':![],'body':_0x30446a[_0x9e1b('0x61')]['body'],'phone':_0x470e55,'SmsAccountId':_0x30ff57['id'],'UserId':_0x30446a[_0x9e1b('0x62')]['id'],'ContactId':_0x26abfe['id']})]},{'include':[{'model':db[_0x9e1b('0xaf')],'as':'Messages'}]})[_0x9e1b('0x25')](function(_0x2ca372){return[_0x2ca372,!![]];});});}})[_0x9e1b('0xa8')](function(_0x9d38f3,_0xae34fe){if(_0xae34fe){return _0x9d38f3;}return db[_0x9e1b('0xaf')][_0x9e1b('0x60')](_['merge'](_0x30446a[_0x9e1b('0x61')],{'read':![],'body':_0x30446a[_0x9e1b('0x61')][_0x9e1b('0x61')],'phone':_0x470e55,'SmsAccountId':_0x30ff57['id'],'SmsInteractionId':_0x9d38f3['id'],'UserId':_0x30446a[_0x9e1b('0x62')]['id'],'ContactId':_0x26abfe['id']}))['then'](function(_0x4cddd7){_0x9d38f3[_0x9e1b('0xcf')]['Messages']=[];_0x9d38f3['dataValues'][_0x9e1b('0xd0')][_0x9e1b('0xab')](_0x4cddd7[_0x9e1b('0xcf')]);return _0x9d38f3;});})['then'](respondWithResult(_0x4aa4e4,null))[_0x9e1b('0x5f')](handleError(_0x4aa4e4,null));};exports[_0x9e1b('0x2e')]=function(_0x2d7eff,_0x49fe22,_0x2d570e){if(_0x2d7eff[_0x9e1b('0x61')]['id']){delete _0x2d7eff[_0x9e1b('0x61')]['id'];}var _0x5a0bc5,_0x45fd23,_0x323d6e;return db[_0x9e1b('0x45')][_0x9e1b('0x5e')]({'where':{'id':_0x2d7eff[_0x9e1b('0x5b')]['id']}})[_0x9e1b('0x25')](handleEntityNotFound(_0x49fe22,null))[_0x9e1b('0x25')](function(_0x31c3e8){if(_0x31c3e8){_0x323d6e=_0x31c3e8;logger[_0x9e1b('0x27')](_0x9e1b('0x28'),_0x9e1b('0x2e'),_0x9e1b('0xd1'),_0x31c3e8['type'],util[_0x9e1b('0xd2')](_0x2d7eff['body'],{'showHidden':![],'depth':null}));switch(_0x31c3e8['type']){case _0x9e1b('0x8a'):if(_0x2d7eff[_0x9e1b('0x61')][_0x9e1b('0xd3')]&&_0x2d7eff[_0x9e1b('0x61')][_0x9e1b('0x2e')]){_0x45fd23=_0x2d7eff[_0x9e1b('0x61')][_0x9e1b('0x2e')];return db[_0x9e1b('0xaf')][_0x9e1b('0x5e')]({'where':{'messageId':_0x2d7eff[_0x9e1b('0x61')][_0x9e1b('0xd3')]}});}break;case'connectel':if(_0x2d7eff[_0x9e1b('0x61')][_0x9e1b('0xd4')]&&_0x2d7eff['body'][_0x9e1b('0xd5')]){_0x45fd23=_0x2d7eff[_0x9e1b('0x61')][_0x9e1b('0xd5')];return db[_0x9e1b('0xaf')]['find']({'where':{'messageId':_0x2d7eff[_0x9e1b('0x61')][_0x9e1b('0xd4')]}});}break;case _0x9e1b('0xd6'):if(_0x2d7eff[_0x9e1b('0x61')][_0x9e1b('0xd7')]&&_0x2d7eff['body'][_0x9e1b('0xd8')]){_0x45fd23=_0x2d7eff[_0x9e1b('0x61')][_0x9e1b('0xd8')];return db[_0x9e1b('0xaf')]['find']({'where':{'messageId':_0x2d7eff['body']['message_id']}});}break;case _0x9e1b('0x90'):var _0x1cbc0c=_0x2d7eff[_0x9e1b('0x61')]['results'][0x0];if(_0x1cbc0c['messageId']&&_0x1cbc0c['status'][_0x9e1b('0xd9')]==='DELIVERED'){_0x45fd23=_0x1cbc0c[_0x9e1b('0x2e')]['groupName'];return db[_0x9e1b('0xaf')]['find']({'where':{'messageId':_0x1cbc0c[_0x9e1b('0x88')]}});}break;case _0x9e1b('0x95'):if(_0x2d7eff['body']['messageId']&&_0x2d7eff[_0x9e1b('0x61')][_0x9e1b('0x2e')]){_0x45fd23=_0x2d7eff['body'][_0x9e1b('0x2e')];return db['SmsMessage'][_0x9e1b('0x5e')]({'where':{'messageId':_0x2d7eff[_0x9e1b('0x61')][_0x9e1b('0x88')]}});}break;case'bandwidth':if(_0x2d7eff[_0x9e1b('0x61')][0x0]['message']['id']){_0x45fd23=_0x2d7eff[_0x9e1b('0x61')][0x0][_0x9e1b('0x56')];return db['SmsMessage'][_0x9e1b('0x5e')]({'where':{'messageId':_0x2d7eff[_0x9e1b('0x61')][0x0][_0x9e1b('0x2d')]['id']}});}break;case'intelepeer':if(_0x2d7eff['body'][_0x9e1b('0xda')]&&_0x2d7eff['body'][_0x9e1b('0x2e')]){_0x45fd23=_0x2d7eff[_0x9e1b('0x61')][_0x9e1b('0x2e')];return db['SmsMessage'][_0x9e1b('0x5e')]({'where':{'messageId':_0x2d7eff['body'][_0x9e1b('0xda')]}});}break;}}})[_0x9e1b('0x25')](handleEntityNotFound(_0x49fe22,null))['then'](function(_0x4bdab6){if(_0x4bdab6){_0x5a0bc5=_0x4bdab6;switch(_0x323d6e['type']){case _0x9e1b('0x8a'):if(_0x45fd23===_0x9e1b('0xdb')){return _0x5a0bc5['update']({'read':!![]});}else{logger[_0x9e1b('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9e1b('0x2e'),_0x9e1b('0x8a'),util[_0x9e1b('0xd2')](_0x2d7eff[_0x9e1b('0x61')],{'showHidden':![],'depth':null}));}break;case _0x9e1b('0x8c'):if(_0x45fd23==='1'){return _0x5a0bc5[_0x9e1b('0x38')]({'read':!![]});}else{logger[_0x9e1b('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9e1b('0x2e'),_0x9e1b('0x8a'),util[_0x9e1b('0xd2')](_0x2d7eff[_0x9e1b('0x61')],{'showHidden':![],'depth':null}));}break;case _0x9e1b('0xd6'):if(!_0x2d7eff['body'][_0x9e1b('0xdc')]&&_0x45fd23>=0xc8&&_0x45fd23<=0xce){return _0x5a0bc5[_0x9e1b('0x38')]({'read':!![]});}else{logger[_0x9e1b('0x2b')](_0x9e1b('0x28'),'status','clicksend',util[_0x9e1b('0xd2')](_0x2d7eff[_0x9e1b('0x61')],{'showHidden':![],'depth':null}));}break;case _0x9e1b('0x90'):var _0x8caf18=_0x2d7eff[_0x9e1b('0x61')][_0x9e1b('0x91')][0x0];if(_0x8caf18[_0x9e1b('0x2e')][_0x9e1b('0xd9')]===_0x9e1b('0xdb')){return _0x5a0bc5[_0x9e1b('0x38')]({'read':!![]});}else{logger['error'](_0x9e1b('0x28'),_0x9e1b('0x2e'),_0x9e1b('0x90'),util['inspect'](_0x2d7eff['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x45fd23=='DELIVERED_TO_GATEWAY'||_0x45fd23==_0x9e1b('0xdd')){return _0x5a0bc5[_0x9e1b('0x38')]({'read':!![]});}else{logger[_0x9e1b('0x2b')](_0x9e1b('0x28'),_0x9e1b('0x2e'),_0x9e1b('0x95'),util['inspect'](_0x2d7eff[_0x9e1b('0x61')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x45fd23==_0x9e1b('0xde')){return _0x5a0bc5['update']({'read':!![]});}else{logger[_0x9e1b('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9e1b('0x2e'),_0x9e1b('0x98'),util[_0x9e1b('0xd2')](_0x2d7eff[_0x9e1b('0x61')],{'showHidden':![],'depth':null}));}break;case _0x9e1b('0x99'):if(_0x45fd23===_0x9e1b('0xdf')||_0x45fd23===_0x9e1b('0xe0')){return _0x5a0bc5[_0x9e1b('0x38')]({'read':!![]});}else{logger[_0x9e1b('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9e1b('0x2e'),'intelepeer',util[_0x9e1b('0xd2')](_0x2d7eff[_0x9e1b('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x5a0bc5;}})[_0x9e1b('0x25')](respondWithResult(_0x49fe22,null))[_0x9e1b('0x5f')](handleError(_0x49fe22,null));};exports[_0x9e1b('0xe1')]=function(_0x3d0108,_0x28a13b,_0x298aa7){var _0x4da0f4,_0x220ddf,_0x5d8d63;return db['SmsAccount']['find']({'where':{'id':_0x3d0108[_0x9e1b('0x5b')]['id']}})[_0x9e1b('0x25')](handleEntityNotFound(_0x28a13b,null))[_0x9e1b('0x25')](function(_0x19618a){if(_0x19618a){_0x5d8d63=_0x19618a;logger[_0x9e1b('0x27')](_0x9e1b('0x28'),_0x9e1b('0x2e'),_0x9e1b('0xd1'),_0x19618a[_0x9e1b('0x56')],util[_0x9e1b('0xd2')](_0x3d0108[_0x9e1b('0x49')],{'showHidden':![],'depth':null}));switch(_0x19618a[_0x9e1b('0x56')]){case _0x9e1b('0x93'):if(_0x3d0108['query'][_0x9e1b('0xe2')]&&_0x3d0108[_0x9e1b('0x49')][_0x9e1b('0xe3')]){_0x220ddf=_0x3d0108[_0x9e1b('0x49')]['state'];return db[_0x9e1b('0xaf')]['find']({'where':{'messageId':_0x3d0108['query'][_0x9e1b('0xe2')]}});}break;}}})[_0x9e1b('0x25')](handleEntityNotFound(_0x28a13b,null))['then'](function(_0x2abbfc){if(_0x2abbfc){_0x4da0f4=_0x2abbfc;switch(_0x5d8d63[_0x9e1b('0x56')]){case _0x9e1b('0x93'):if(_0x220ddf==='2'||_0x220ddf==='6'){return _0x4da0f4[_0x9e1b('0x38')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9e1b('0x2e'),_0x9e1b('0x93'),util['inspect'](_0x3d0108[_0x9e1b('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x4da0f4;}})[_0x9e1b('0x25')](respondWithResult(_0x28a13b,null))['catch'](handleError(_0x28a13b,null));};exports['addAgents']=function(_0x468f36,_0x2b3153,_0x2f857f){return db[_0x9e1b('0x45')]['find']({'where':{'id':_0x468f36[_0x9e1b('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2b3153,null))[_0x9e1b('0x25')](function(_0x3d706c){if(_0x3d706c){return _0x3d706c[_0x9e1b('0xe4')](_0x468f36[_0x9e1b('0x61')][_0x9e1b('0x71')],_[_0x9e1b('0xa6')](_0x468f36['body'],[_0x9e1b('0x71'),'id'])||{})[_0x9e1b('0xa8')](function(_0xcb45b5){for(var _0xf1662=0x0;_0xf1662<_0x468f36['body'][_0x9e1b('0x71')][_0x9e1b('0x4d')];_0xf1662+=0x1){socket[_0x9e1b('0xe5')]('userSmsAccount:save',{'UserId':Number(_0x468f36[_0x9e1b('0x61')][_0x9e1b('0x71')][_0xf1662]),'SmsAccountId':Number(_0x468f36['params']['id'])});}return _0xcb45b5;});}})[_0x9e1b('0x25')](respondWithResult(_0x2b3153,null))['catch'](handleError(_0x2b3153,null));};exports[_0x9e1b('0xe6')]=function(_0x9d9932,_0x565e5c,_0x117fc3){return db[_0x9e1b('0x45')]['find']({'where':{'id':_0x9d9932[_0x9e1b('0x5b')]['id']}})[_0x9e1b('0x25')](handleEntityNotFound(_0x565e5c,null))[_0x9e1b('0x25')](function(_0x2f1ee5){if(_0x2f1ee5){return _0x2f1ee5[_0x9e1b('0xe6')](_0x9d9932['query'][_0x9e1b('0x71')])[_0x9e1b('0x25')](function(){if(_[_0x9e1b('0xe7')](_0x9d9932[_0x9e1b('0x49')][_0x9e1b('0x71')])){for(var _0x192440=0x0;_0x192440<_0x9d9932['query'][_0x9e1b('0x71')]['length'];_0x192440+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x9d9932[_0x9e1b('0x49')]['ids'][_0x192440]),'SmsAccountId':Number(_0x9d9932[_0x9e1b('0x5b')]['id'])});}}else{socket['emit'](_0x9e1b('0xe8'),{'UserId':Number(_0x9d9932[_0x9e1b('0x49')][_0x9e1b('0x71')]),'SmsAccountId':Number(_0x9d9932['params']['id'])});}});}})[_0x9e1b('0x25')](respondWithStatusCode(_0x565e5c,null))[_0x9e1b('0x5f')](handleError(_0x565e5c,null));};exports[_0x9e1b('0xe9')]=function(_0x34043a,_0x17f235,_0x16e631){var _0x2db4f3={};var _0x1628e9={};var _0x469580;var _0x4f5cbc;return db[_0x9e1b('0x45')][_0x9e1b('0x6d')]({'where':{'id':_0x34043a[_0x9e1b('0x5b')]['id']}})[_0x9e1b('0x25')](handleEntityNotFound(_0x17f235,null))[_0x9e1b('0x25')](function(_0x3dc448){if(_0x3dc448){_0x469580=_0x3dc448;_0x1628e9['model']=_[_0x9e1b('0x5c')](db[_0x9e1b('0xb3')][_0x9e1b('0x46')]);_0x1628e9[_0x9e1b('0x49')]=_[_0x9e1b('0x5c')](_0x34043a['query']);_0x1628e9[_0x9e1b('0x52')]=_[_0x9e1b('0x4a')](_0x1628e9[_0x9e1b('0x48')],_0x1628e9[_0x9e1b('0x49')]);_0x2db4f3[_0x9e1b('0x4b')]=_[_0x9e1b('0x4a')](_0x1628e9[_0x9e1b('0x48')],qs[_0x9e1b('0x4c')](_0x34043a[_0x9e1b('0x49')][_0x9e1b('0x4c')]));_0x2db4f3[_0x9e1b('0x4b')]=_0x2db4f3[_0x9e1b('0x4b')]['length']?_0x2db4f3[_0x9e1b('0x4b')]:_0x1628e9['model'];_0x2db4f3[_0x9e1b('0x4f')]=qs[_0x9e1b('0x50')](_0x34043a[_0x9e1b('0x49')]['sort']);_0x2db4f3['where']=qs[_0x9e1b('0x52')](_[_0x9e1b('0x53')](_0x34043a[_0x9e1b('0x49')],_0x1628e9[_0x9e1b('0x52')]));if(_0x34043a[_0x9e1b('0x49')]['filter']){_0x2db4f3[_0x9e1b('0x51')]=_['merge'](_0x2db4f3[_0x9e1b('0x51')],{'$or':_[_0x9e1b('0x44')](_0x2db4f3['attributes'],function(_0x2898d0){var _0x49b4c8={};_0x49b4c8[_0x2898d0]={'$like':'%'+_0x34043a['query'][_0x9e1b('0x54')]+'%'};return _0x49b4c8;})});}_0x2db4f3=_[_0x9e1b('0x55')]({},_0x2db4f3,_0x34043a[_0x9e1b('0x57')]);return _0x469580[_0x9e1b('0xe9')](_0x2db4f3);}})[_0x9e1b('0x25')](function(_0x5e531a){if(_0x5e531a){_0x4f5cbc=_0x5e531a[_0x9e1b('0x4d')];if(!_0x34043a[_0x9e1b('0x49')]['hasOwnProperty'](_0x9e1b('0x6e'))){_0x2db4f3[_0x9e1b('0x31')]=qs[_0x9e1b('0x31')](_0x34043a[_0x9e1b('0x49')]['limit']);_0x2db4f3[_0x9e1b('0x32')]=qs[_0x9e1b('0x32')](_0x34043a['query'][_0x9e1b('0x32')]);}return _0x469580[_0x9e1b('0xe9')](_0x2db4f3);}})[_0x9e1b('0x25')](function(_0x4c8a14){if(_0x4c8a14){return _0x4c8a14?{'count':_0x4f5cbc,'rows':_0x4c8a14}:null;}})[_0x9e1b('0x25')](respondWithResult(_0x17f235,null))[_0x9e1b('0x5f')](handleError(_0x17f235,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 65b1f7b..39363cb 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 _0x7b37=['exports','events','../../mysqldb','SmsAccount','save','emit','hasOwnProperty'];(function(_0x1e9e43,_0x1772ee){var _0x760cd8=function(_0x1690b){while(--_0x1690b){_0x1e9e43['push'](_0x1e9e43['shift']());}};_0x760cd8(++_0x1772ee);}(_0x7b37,0xf6));var _0x77b3=function(_0x2d2b8b,_0x3e684d){_0x2d2b8b=_0x2d2b8b-0x0;var _0xdd3434=_0x7b37[_0x2d2b8b];return _0xdd3434;};'use strict';var EventEmitter=require(_0x77b3('0x0'));var SmsAccount=require(_0x77b3('0x1'))['db'][_0x77b3('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x77b3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4bbd3e){return function(_0x3b2f88,_0x315896,_0x1047c0){SmsAccountEvents[_0x77b3('0x4')](_0x4bbd3e+':'+_0x3b2f88['id'],_0x3b2f88);SmsAccountEvents[_0x77b3('0x4')](_0x4bbd3e,_0x3b2f88);_0x1047c0(null);};}for(var e in events){if(events[_0x77b3('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x77b3('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xe433=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x28d6fd,_0x685425){var _0x18dc19=function(_0x1b6d4c){while(--_0x1b6d4c){_0x28d6fd['push'](_0x28d6fd['shift']());}};_0x18dc19(++_0x685425);}(_0xe433,0x1b9));var _0x3e43=function(_0x2e1a28,_0x1887d4){_0x2e1a28=_0x2e1a28-0x0;var _0x159879=_0xe433[_0x2e1a28];return _0x159879;};'use strict';var EventEmitter=require(_0x3e43('0x0'));var SmsAccount=require(_0x3e43('0x1'))['db'][_0x3e43('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3e43('0x3')](0x0);var events={'afterCreate':_0x3e43('0x4'),'afterUpdate':_0x3e43('0x5'),'afterDestroy':_0x3e43('0x6')};function emitEvent(_0x39a4d8){return function(_0x4d9970,_0x4a2442,_0x205141){SmsAccountEvents[_0x3e43('0x7')](_0x39a4d8+':'+_0x4d9970['id'],_0x4d9970);SmsAccountEvents[_0x3e43('0x7')](_0x39a4d8,_0x4d9970);_0x205141(null);};}for(var e in events){if(events[_0x3e43('0x8')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x3e43('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 2d00c79..1e77b59 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 _0x9147=['../../config/logger','bluebird','request-promise','path','exports','define','SmsAccount','lodash','util'];(function(_0x9caef3,_0xb9746){var _0x46fb02=function(_0x264080){while(--_0x264080){_0x9caef3['push'](_0x9caef3['shift']());}};_0x46fb02(++_0xb9746);}(_0x9147,0xd6));var _0x7914=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x9147[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x7914('0x0'));var util=require(_0x7914('0x1'));var logger=require(_0x7914('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7914('0x3'));var rp=require(_0x7914('0x4'));var fs=require('fs');var path=require(_0x7914('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x7914('0x6')]=function(_0x5414da,_0x22dd05){return _0x5414da[_0x7914('0x7')](_0x7914('0x8'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf401=['exports','SmsAccount','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x447f6d,_0x36fc29){var _0x56a9b8=function(_0x16444e){while(--_0x16444e){_0x447f6d['push'](_0x447f6d['shift']());}};_0x56a9b8(++_0x36fc29);}(_0xf401,0xe3));var _0x1f40=function(_0x45f895,_0x52796d){_0x45f895=_0x45f895-0x0;var _0x9b8fb2=_0xf401[_0x45f895];return _0x9b8fb2;};'use strict';var _=require('lodash');var util=require(_0x1f40('0x0'));var logger=require(_0x1f40('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1f40('0x2'));var rp=require(_0x1f40('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f40('0x4'));var config=require(_0x1f40('0x5'));var attributes=require(_0x1f40('0x6'));module[_0x1f40('0x7')]=function(_0x55525c,_0x31080f){return _0x55525c['define'](_0x1f40('0x8'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 7afc5ac..cc16418 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 _0xafdd=['SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','options','attributes','include','map','model','info','debug','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsAccount.socket','request','then','request\x20sent'];(function(_0x15f6a0,_0x5b34fc){var _0x10f8c7=function(_0x5b7d95){while(--_0x5b7d95){_0x15f6a0['push'](_0x15f6a0['shift']());}};_0x10f8c7(++_0x5b34fc);}(_0xafdd,0x132));var _0xdafd=function(_0xdd1d3b,_0x1e4c1d){_0xdd1d3b=_0xdd1d3b-0x0;var _0x2dedec=_0xafdd[_0xdd1d3b];return _0x2dedec;};'use strict';var _=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var moment=require(_0xdafd('0x2'));var BPromise=require(_0xdafd('0x3'));var rs=require(_0xdafd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdafd('0x5'));var logger=require(_0xdafd('0x6'))('rpc');var config=require(_0xdafd('0x7'));var jayson=require(_0xdafd('0x8'));var client=jayson[_0xdafd('0x9')][_0xdafd('0xa')]({'port':0x232a});config[_0xdafd('0xb')]=_[_0xdafd('0xc')](config[_0xdafd('0xb')],{'host':_0xdafd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdafd('0xe'))['register'](socket);function respondWithRpcPromise(_0x814046,_0x3551d2,_0x33398b){return new BPromise(function(_0x159e0d,_0x7e0dee){return client[_0xdafd('0xf')](_0x814046,_0x33398b)[_0xdafd('0x10')](function(_0x5cbf40){logger['info']('SmsAccount,\x20%s,\x20%s',_0x3551d2,_0xdafd('0x11'));logger['debug'](_0xdafd('0x12'),_0x3551d2,_0xdafd('0x11'),JSON['stringify'](_0x5cbf40));if(_0x5cbf40[_0xdafd('0x13')]){if(_0x5cbf40[_0xdafd('0x13')][_0xdafd('0x14')]===0x1f4){logger[_0xdafd('0x13')](_0xdafd('0x15'),_0x3551d2,_0x5cbf40[_0xdafd('0x13')][_0xdafd('0x16')]);return _0x7e0dee(_0x5cbf40[_0xdafd('0x13')]['message']);}logger[_0xdafd('0x13')](_0xdafd('0x15'),_0x3551d2,_0x5cbf40[_0xdafd('0x13')][_0xdafd('0x16')]);return _0x159e0d(_0x5cbf40[_0xdafd('0x13')][_0xdafd('0x16')]);}else{logger['info'](_0xdafd('0x15'),_0x3551d2,_0xdafd('0x11'));_0x159e0d(_0x5cbf40[_0xdafd('0x17')][_0xdafd('0x16')]);}})[_0xdafd('0x18')](function(_0x5ddfe4){logger[_0xdafd('0x13')]('SmsAccount,\x20%s,\x20%s',_0x3551d2,_0x5ddfe4);_0x7e0dee(_0x5ddfe4);});});}exports[_0xdafd('0x19')]=function(_0x4c5cf4){var _0x3baf2a=this;return new Promise(function(_0x3aae3f,_0x18d2a9){return db[_0xdafd('0x1a')][_0xdafd('0x1b')]({'raw':_0x4c5cf4[_0xdafd('0x1c')]?_0x4c5cf4[_0xdafd('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4c5cf4[_0xdafd('0x1c')]?_0x4c5cf4[_0xdafd('0x1c')]['where']||null:null,'attributes':_0x4c5cf4[_0xdafd('0x1c')]?_0x4c5cf4[_0xdafd('0x1c')][_0xdafd('0x1d')]||null:null,'include':_0x4c5cf4[_0xdafd('0x1c')]?_0x4c5cf4[_0xdafd('0x1c')][_0xdafd('0x1e')]?_['map'](_0x4c5cf4[_0xdafd('0x1c')][_0xdafd('0x1e')],function(_0x5804e8){return{'model':db[_0x5804e8['model']],'as':_0x5804e8['as'],'attributes':_0x5804e8[_0xdafd('0x1d')],'include':_0x5804e8[_0xdafd('0x1e')]?_[_0xdafd('0x1f')](_0x5804e8[_0xdafd('0x1e')],function(_0x5030be){return{'model':db[_0x5030be['model']],'as':_0x5030be['as'],'attributes':_0x5030be[_0xdafd('0x1d')],'include':_0x5030be[_0xdafd('0x1e')]?_[_0xdafd('0x1f')](_0x5030be[_0xdafd('0x1e')],function(_0x39e863){return{'model':db[_0x39e863[_0xdafd('0x20')]],'as':_0x39e863['as'],'attributes':_0x39e863[_0xdafd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdafd('0x10')](function(_0x5e98d8){logger[_0xdafd('0x21')](_0xdafd('0x19'),_0x4c5cf4);logger[_0xdafd('0x22')](_0xdafd('0x19'),_0x4c5cf4,JSON[_0xdafd('0x23')](_0x5e98d8));_0x3aae3f(_0x5e98d8);})[_0xdafd('0x18')](function(_0x1550e1){logger['error'](_0xdafd('0x19'),_0x1550e1[_0xdafd('0x16')],_0x4c5cf4);_0x18d2a9(_0x3baf2a['error'](0x1f4,_0x1550e1[_0xdafd('0x16')]));});});}; \ No newline at end of file +var _0x2607=['message','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map','model','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','redis','defaults','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x7457fe,_0x564a5e){var _0x57a6e4=function(_0x566577){while(--_0x566577){_0x7457fe['push'](_0x7457fe['shift']());}};_0x57a6e4(++_0x564a5e);}(_0x2607,0x1c6));var _0x7260=function(_0x47604d,_0x15a014){_0x47604d=_0x47604d-0x0;var _0x388e4c=_0x2607[_0x47604d];return _0x388e4c;};'use strict';var _=require(_0x7260('0x0'));var util=require('util');var moment=require(_0x7260('0x1'));var BPromise=require(_0x7260('0x2'));var rs=require(_0x7260('0x3'));var fs=require('fs');var Redis=require(_0x7260('0x4'));var db=require(_0x7260('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7260('0x6'));var config=require(_0x7260('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7260('0x8')]['http']({'port':0x232a});config[_0x7260('0x9')]=_[_0x7260('0xa')](config[_0x7260('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7260('0x9')]));require(_0x7260('0xb'))[_0x7260('0xc')](socket);function respondWithRpcPromise(_0x4f1c71,_0x4e0323,_0x31d0b3){return new BPromise(function(_0x4e711c,_0x1c2bfa){return client[_0x7260('0xd')](_0x4f1c71,_0x31d0b3)[_0x7260('0xe')](function(_0x464717){logger[_0x7260('0xf')](_0x7260('0x10'),_0x4e0323,_0x7260('0x11'));logger[_0x7260('0x12')](_0x7260('0x13'),_0x4e0323,_0x7260('0x11'),JSON['stringify'](_0x464717));if(_0x464717[_0x7260('0x14')]){if(_0x464717['error'][_0x7260('0x15')]===0x1f4){logger[_0x7260('0x14')](_0x7260('0x10'),_0x4e0323,_0x464717[_0x7260('0x14')][_0x7260('0x16')]);return _0x1c2bfa(_0x464717[_0x7260('0x14')][_0x7260('0x16')]);}logger['error'](_0x7260('0x10'),_0x4e0323,_0x464717[_0x7260('0x14')]['message']);return _0x4e711c(_0x464717[_0x7260('0x14')][_0x7260('0x16')]);}else{logger[_0x7260('0xf')](_0x7260('0x10'),_0x4e0323,'request\x20sent');_0x4e711c(_0x464717['result'][_0x7260('0x16')]);}})[_0x7260('0x17')](function(_0x19cb6e){logger[_0x7260('0x14')]('SmsAccount,\x20%s,\x20%s',_0x4e0323,_0x19cb6e);_0x1c2bfa(_0x19cb6e);});});}exports[_0x7260('0x18')]=function(_0x350c0d){var _0x2b2d0c=this;return new Promise(function(_0x14e5ce,_0x4beb2c){return db[_0x7260('0x19')][_0x7260('0x1a')]({'raw':_0x350c0d[_0x7260('0x1b')]?_0x350c0d[_0x7260('0x1b')][_0x7260('0x1c')]===undefined?!![]:![]:!![],'where':_0x350c0d[_0x7260('0x1b')]?_0x350c0d[_0x7260('0x1b')]['where']||null:null,'attributes':_0x350c0d[_0x7260('0x1b')]?_0x350c0d[_0x7260('0x1b')][_0x7260('0x1d')]||null:null,'include':_0x350c0d[_0x7260('0x1b')]?_0x350c0d[_0x7260('0x1b')][_0x7260('0x1e')]?_[_0x7260('0x1f')](_0x350c0d[_0x7260('0x1b')]['include'],function(_0x358a13){return{'model':db[_0x358a13[_0x7260('0x20')]],'as':_0x358a13['as'],'attributes':_0x358a13['attributes'],'include':_0x358a13[_0x7260('0x1e')]?_[_0x7260('0x1f')](_0x358a13[_0x7260('0x1e')],function(_0x55a605){return{'model':db[_0x55a605[_0x7260('0x20')]],'as':_0x55a605['as'],'attributes':_0x55a605[_0x7260('0x1d')],'include':_0x55a605[_0x7260('0x1e')]?_[_0x7260('0x1f')](_0x55a605[_0x7260('0x1e')],function(_0x52f5c0){return{'model':db[_0x52f5c0[_0x7260('0x20')]],'as':_0x52f5c0['as'],'attributes':_0x52f5c0[_0x7260('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7260('0xe')](function(_0x341550){logger[_0x7260('0xf')](_0x7260('0x18'),_0x350c0d);logger[_0x7260('0x12')](_0x7260('0x18'),_0x350c0d,JSON[_0x7260('0x21')](_0x341550));_0x14e5ce(_0x341550);})[_0x7260('0x17')](function(_0x3d0b44){logger[_0x7260('0x14')](_0x7260('0x18'),_0x3d0b44[_0x7260('0x16')],_0x350c0d);_0x4beb2c(_0x2b2d0c['error'](0x1f4,_0x3d0b44[_0x7260('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 801feed..2a19c78 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 59bd25d..bf12bb5 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(_0x53dba5,_0x4e09a1){var _0x587761=function(_0x38ddaf){while(--_0x38ddaf){_0x53dba5['push'](_0x53dba5['shift']());}};_0x587761(++_0x4e09a1);}(_0x55ca,0x126));var _0xa55c=function(_0x55cdc5,_0x2b2297){_0x55cdc5=_0x55cdc5-0x0;var _0x29acd5=_0x55ca[_0x55cdc5];return _0x29acd5;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index cad246b..e1d0cfc 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 _0xddb2=['exports','STRING','noop','TEXT','sequelize'];(function(_0x2b341f,_0x5bd3b8){var _0x4a4f94=function(_0x2e0c1f){while(--_0x2e0c1f){_0x2b341f['push'](_0x2b341f['shift']());}};_0x4a4f94(++_0x5bd3b8);}(_0xddb2,0x1d0));var _0x2ddb=function(_0x436a85,_0x1c96e6){_0x436a85=_0x436a85-0x0;var _0x27be27=_0xddb2[_0x436a85];return _0x27be27;};'use strict';var Sequelize=require(_0x2ddb('0x0'));module[_0x2ddb('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2ddb('0x2')],'allowNull':![],'defaultValue':_0x2ddb('0x3')},'appdata':{'type':Sequelize[_0x2ddb('0x4')]()},'description':{'type':Sequelize[_0x2ddb('0x2')]},'interval':{'type':Sequelize[_0x2ddb('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x9bb2=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9bb2,0x16c));var _0x29bb=function(_0x2260bc,_0x3150de){_0x2260bc=_0x2260bc-0x0;var _0x5c57d5=_0x9bb2[_0x2260bc];return _0x5c57d5;};'use strict';var Sequelize=require(_0x29bb('0x0'));module[_0x29bb('0x1')]={'priority':{'type':Sequelize[_0x29bb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x29bb('0x3')],'allowNull':![],'defaultValue':_0x29bb('0x4')},'appdata':{'type':Sequelize[_0x29bb('0x5')]()},'description':{'type':Sequelize[_0x29bb('0x3')]},'interval':{'type':Sequelize[_0x29bb('0x3')],'defaultValue':_0x29bb('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 83e094d..7ac3988 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 _0x0676=['../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','SmsApplication','include','findAll','rows','catch','show','params','options','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x0676,0x1ac));var _0x6067=function(_0x2db90b,_0x1efb62){_0x2db90b=_0x2db90b-0x0;var _0x3e767c=_0x0676[_0x2db90b];return _0x3e767c;};'use strict';var emlformat=require(_0x6067('0x0'));var rimraf=require(_0x6067('0x1'));var zipdir=require(_0x6067('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6067('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6067('0x4'));var util=require('util');var path=require(_0x6067('0x5'));var sox=require(_0x6067('0x6'));var csv=require(_0x6067('0x7'));var ejs=require(_0x6067('0x8'));var fs=require('fs');var fs_extra=require(_0x6067('0x9'));var _=require(_0x6067('0xa'));var squel=require('squel');var crypto=require(_0x6067('0xb'));var jsforce=require(_0x6067('0xc'));var deskjs=require(_0x6067('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6067('0xe'));var Papa=require(_0x6067('0xf'));var Redis=require('ioredis');var authService=require(_0x6067('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6067('0x11'));var hardwareService=require(_0x6067('0x12'));var logger=require(_0x6067('0x13'))(_0x6067('0x14'));var utils=require(_0x6067('0x15'));var config=require(_0x6067('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6067('0x17'))['db'];function respondWithStatusCode(_0x237e0f,_0x147c08){_0x147c08=_0x147c08||0xcc;return function(_0x45eee2){if(_0x45eee2){return _0x237e0f['sendStatus'](_0x147c08);}return _0x237e0f[_0x6067('0x18')](_0x147c08)['end']();};}function respondWithResult(_0x20dc33,_0x327d18){_0x327d18=_0x327d18||0xc8;return function(_0x99cf8d){if(_0x99cf8d){return _0x20dc33[_0x6067('0x18')](_0x327d18)[_0x6067('0x19')](_0x99cf8d);}};}function respondWithFilteredResult(_0x903fd5,_0x20234d){return function(_0x5e930b){if(_0x5e930b){var _0x239375=typeof _0x20234d[_0x6067('0x1a')]==='undefined'&&typeof _0x20234d[_0x6067('0x1b')]===_0x6067('0x1c');var _0x4043ac=_0x5e930b[_0x6067('0x1d')];var _0x1150f8=_0x239375?0x0:_0x20234d[_0x6067('0x1a')];var _0x113443=_0x239375?_0x5e930b[_0x6067('0x1d')]:_0x20234d[_0x6067('0x1a')]+_0x20234d[_0x6067('0x1b')];var _0x1e4fed;if(_0x113443>=_0x4043ac){_0x113443=_0x4043ac;_0x1e4fed=0xc8;}else{_0x1e4fed=0xce;}_0x903fd5['status'](_0x1e4fed);return _0x903fd5[_0x6067('0x1e')](_0x6067('0x1f'),_0x1150f8+'-'+_0x113443+'/'+_0x4043ac)['json'](_0x5e930b);}return null;};}function patchUpdates(_0x2ee604){return function(_0x5716e8){try{jsonpatch[_0x6067('0x20')](_0x5716e8,_0x2ee604,!![]);}catch(_0x51be49){return BPromise[_0x6067('0x21')](_0x51be49);}return _0x5716e8['save']();};}function saveUpdates(_0x51d9a5,_0x28487f){return function(_0x3728b9){if(_0x3728b9){return _0x3728b9[_0x6067('0x22')](_0x51d9a5)[_0x6067('0x23')](function(_0x52d659){return _0x52d659;});}return null;};}function removeEntity(_0x3bb49b,_0x93889d){return function(_0xf9ec66){if(_0xf9ec66){return _0xf9ec66['destroy']()[_0x6067('0x23')](function(){_0x3bb49b['status'](0xcc)[_0x6067('0x24')]();});}};}function handleEntityNotFound(_0x138021,_0x4525df){return function(_0x32929d){if(!_0x32929d){_0x138021[_0x6067('0x25')](0x194);}return _0x32929d;};}function handleError(_0x94a415,_0x2d9915){_0x2d9915=_0x2d9915||0x1f4;return function(_0xb41e8c){logger[_0x6067('0x26')](_0xb41e8c[_0x6067('0x27')]);if(_0xb41e8c[_0x6067('0x28')]){delete _0xb41e8c[_0x6067('0x28')];}_0x94a415[_0x6067('0x18')](_0x2d9915)[_0x6067('0x29')](_0xb41e8c);};}exports[_0x6067('0x2a')]=function(_0xb201b2,_0x479054){var _0x4f9229={},_0x3becab={},_0x2dc311={'count':0x0,'rows':[]};var _0x3e4f11=_[_0x6067('0x2b')](db['SmsApplication'][_0x6067('0x2c')],function(_0x322743){return{'name':_0x322743[_0x6067('0x2d')],'type':_0x322743[_0x6067('0x2e')][_0x6067('0x2f')]};});_0x3becab[_0x6067('0x30')]=_[_0x6067('0x2b')](_0x3e4f11,_0x6067('0x28'));_0x3becab['query']=_[_0x6067('0x31')](_0xb201b2[_0x6067('0x32')]);_0x3becab[_0x6067('0x33')]=_[_0x6067('0x34')](_0x3becab['model'],_0x3becab['query']);_0x4f9229[_0x6067('0x35')]=_[_0x6067('0x34')](_0x3becab['model'],qs['fields'](_0xb201b2[_0x6067('0x32')][_0x6067('0x36')]));_0x4f9229[_0x6067('0x35')]=_0x4f9229[_0x6067('0x35')][_0x6067('0x37')]?_0x4f9229[_0x6067('0x35')]:_0x3becab[_0x6067('0x30')];if(!_0xb201b2[_0x6067('0x32')][_0x6067('0x38')](_0x6067('0x39'))){_0x4f9229[_0x6067('0x1b')]=qs['limit'](_0xb201b2[_0x6067('0x32')][_0x6067('0x1b')]);_0x4f9229[_0x6067('0x1a')]=qs[_0x6067('0x1a')](_0xb201b2['query']['offset']);}_0x4f9229['order']=qs[_0x6067('0x3a')](_0xb201b2[_0x6067('0x32')]['sort']);_0x4f9229[_0x6067('0x3b')]=qs[_0x6067('0x33')](_['pick'](_0xb201b2[_0x6067('0x32')],_0x3becab[_0x6067('0x33')]),_0x3e4f11);if(_0xb201b2[_0x6067('0x32')]['filter']){_0x4f9229[_0x6067('0x3b')]=_[_0x6067('0x3c')](_0x4f9229[_0x6067('0x3b')],{'$or':_['map'](_0x3e4f11,function(_0x408450){if(_0x408450['type']!==_0x6067('0x3d')){var _0x248644={};_0x248644[_0x408450[_0x6067('0x28')]]={'$like':'%'+_0xb201b2[_0x6067('0x32')][_0x6067('0x3e')]+'%'};return _0x248644;}})});}_0x4f9229=_['merge']({},_0x4f9229,_0xb201b2['options']);var _0x40907d={'where':_0x4f9229[_0x6067('0x3b')]};return db[_0x6067('0x3f')][_0x6067('0x1d')](_0x40907d)['then'](function(_0x2d5268){_0x2dc311[_0x6067('0x1d')]=_0x2d5268;if(_0xb201b2['query']['includeAll']){_0x4f9229[_0x6067('0x40')]=[{'all':!![]}];}return db[_0x6067('0x3f')][_0x6067('0x41')](_0x4f9229);})['then'](function(_0x1a2eeb){_0x2dc311[_0x6067('0x42')]=_0x1a2eeb;return _0x2dc311;})[_0x6067('0x23')](respondWithFilteredResult(_0x479054,_0x4f9229))[_0x6067('0x43')](handleError(_0x479054,null));};exports[_0x6067('0x44')]=function(_0x55a2ed,_0x21fefb){var _0x622907={'raw':!![],'where':{'id':_0x55a2ed[_0x6067('0x45')]['id']}},_0x3cc8a1={};_0x3cc8a1[_0x6067('0x30')]=_[_0x6067('0x31')](db[_0x6067('0x3f')]['rawAttributes']);_0x3cc8a1[_0x6067('0x32')]=_['keys'](_0x55a2ed[_0x6067('0x32')]);_0x3cc8a1['filters']=_[_0x6067('0x34')](_0x3cc8a1[_0x6067('0x30')],_0x3cc8a1['query']);_0x622907[_0x6067('0x35')]=_[_0x6067('0x34')](_0x3cc8a1['model'],qs[_0x6067('0x36')](_0x55a2ed[_0x6067('0x32')][_0x6067('0x36')]));_0x622907[_0x6067('0x35')]=_0x622907[_0x6067('0x35')][_0x6067('0x37')]?_0x622907[_0x6067('0x35')]:_0x3cc8a1[_0x6067('0x30')];if(_0x55a2ed[_0x6067('0x32')]['includeAll']){_0x622907[_0x6067('0x40')]=[{'all':!![]}];}_0x622907=_[_0x6067('0x3c')]({},_0x622907,_0x55a2ed[_0x6067('0x46')]);return db[_0x6067('0x3f')][_0x6067('0x47')](_0x622907)['then'](handleEntityNotFound(_0x21fefb,null))[_0x6067('0x23')](respondWithResult(_0x21fefb,null))['catch'](handleError(_0x21fefb,null));};exports[_0x6067('0x48')]=function(_0x47aa37,_0x3b2cb9){return db[_0x6067('0x3f')][_0x6067('0x48')](_0x47aa37['body'],{})[_0x6067('0x23')](respondWithResult(_0x3b2cb9,0xc9))['catch'](handleError(_0x3b2cb9,null));};exports['update']=function(_0x45b8d3,_0x546719){if(_0x45b8d3[_0x6067('0x49')]['id']){delete _0x45b8d3['body']['id'];}return db[_0x6067('0x3f')]['find']({'where':{'id':_0x45b8d3[_0x6067('0x45')]['id']}})[_0x6067('0x23')](handleEntityNotFound(_0x546719,null))[_0x6067('0x23')](saveUpdates(_0x45b8d3[_0x6067('0x49')],null))[_0x6067('0x23')](respondWithResult(_0x546719,null))[_0x6067('0x43')](handleError(_0x546719,null));};exports[_0x6067('0x4a')]=function(_0x2af59f,_0x52a6cf){return db[_0x6067('0x3f')][_0x6067('0x47')]({'where':{'id':_0x2af59f['params']['id']}})[_0x6067('0x23')](handleEntityNotFound(_0x52a6cf,null))[_0x6067('0x23')](removeEntity(_0x52a6cf,null))[_0x6067('0x43')](handleError(_0x52a6cf,null));}; \ No newline at end of file +var _0x878a=['../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SmsApplication','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x4471ff,_0x4bb7de){var _0xe723ca=function(_0xf3cc76){while(--_0xf3cc76){_0x4471ff['push'](_0x4471ff['shift']());}};_0xe723ca(++_0x4bb7de);}(_0x878a,0x15a));var _0xa878=function(_0x2a4f97,_0x55f996){_0x2a4f97=_0x2a4f97-0x0;var _0x57c341=_0x878a[_0x2a4f97];return _0x57c341;};'use strict';var emlformat=require(_0xa878('0x0'));var rimraf=require(_0xa878('0x1'));var zipdir=require(_0xa878('0x2'));var jsonpatch=require(_0xa878('0x3'));var rp=require('request-promise');var moment=require(_0xa878('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa878('0x5'));var path=require('path');var sox=require(_0xa878('0x6'));var csv=require(_0xa878('0x7'));var ejs=require(_0xa878('0x8'));var fs=require('fs');var fs_extra=require(_0xa878('0x9'));var _=require(_0xa878('0xa'));var squel=require('squel');var crypto=require(_0xa878('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa878('0x7'));var querystring=require('querystring');var Papa=require(_0xa878('0xc'));var Redis=require(_0xa878('0xd'));var authService=require(_0xa878('0xe'));var qs=require(_0xa878('0xf'));var as=require(_0xa878('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa878('0x11'))(_0xa878('0x12'));var utils=require('../../config/utils');var config=require(_0xa878('0x13'));var licenseUtil=require(_0xa878('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a98a7,_0x346f12){_0x346f12=_0x346f12||0xcc;return function(_0x576f94){if(_0x576f94){return _0x1a98a7[_0xa878('0x15')](_0x346f12);}return _0x1a98a7['status'](_0x346f12)[_0xa878('0x16')]();};}function respondWithResult(_0x2267e7,_0x23d247){_0x23d247=_0x23d247||0xc8;return function(_0x302918){if(_0x302918){return _0x2267e7[_0xa878('0x17')](_0x23d247)[_0xa878('0x18')](_0x302918);}};}function respondWithFilteredResult(_0x397e65,_0x24d0dc){return function(_0x3b9c47){if(_0x3b9c47){var _0xd15523=typeof _0x24d0dc[_0xa878('0x19')]===_0xa878('0x1a')&&typeof _0x24d0dc[_0xa878('0x1b')]===_0xa878('0x1a');var _0x3d07d5=_0x3b9c47[_0xa878('0x1c')];var _0x3e8e04=_0xd15523?0x0:_0x24d0dc['offset'];var _0x350121=_0xd15523?_0x3b9c47[_0xa878('0x1c')]:_0x24d0dc['offset']+_0x24d0dc['limit'];var _0x3f9a65;if(_0x350121>=_0x3d07d5){_0x350121=_0x3d07d5;_0x3f9a65=0xc8;}else{_0x3f9a65=0xce;}_0x397e65[_0xa878('0x17')](_0x3f9a65);return _0x397e65[_0xa878('0x1d')](_0xa878('0x1e'),_0x3e8e04+'-'+_0x350121+'/'+_0x3d07d5)[_0xa878('0x18')](_0x3b9c47);}return null;};}function patchUpdates(_0x13f70d){return function(_0x2d6cb3){try{jsonpatch[_0xa878('0x1f')](_0x2d6cb3,_0x13f70d,!![]);}catch(_0x2ad4ee){return BPromise[_0xa878('0x20')](_0x2ad4ee);}return _0x2d6cb3[_0xa878('0x21')]();};}function saveUpdates(_0x5a0e56,_0x41539b){return function(_0xaef1f9){if(_0xaef1f9){return _0xaef1f9[_0xa878('0x22')](_0x5a0e56)[_0xa878('0x23')](function(_0x2abc48){return _0x2abc48;});}return null;};}function removeEntity(_0x6070de,_0x495c43){return function(_0x525364){if(_0x525364){return _0x525364[_0xa878('0x24')]()[_0xa878('0x23')](function(){_0x6070de['status'](0xcc)[_0xa878('0x16')]();});}};}function handleEntityNotFound(_0x2ae866,_0x2a09d6){return function(_0x12bc2f){if(!_0x12bc2f){_0x2ae866[_0xa878('0x15')](0x194);}return _0x12bc2f;};}function handleError(_0x545fc6,_0xf7d39d){_0xf7d39d=_0xf7d39d||0x1f4;return function(_0xc1d836){logger[_0xa878('0x25')](_0xc1d836[_0xa878('0x26')]);if(_0xc1d836[_0xa878('0x27')]){delete _0xc1d836['name'];}_0x545fc6[_0xa878('0x17')](_0xf7d39d)['send'](_0xc1d836);};}exports[_0xa878('0x28')]=function(_0x254fdf,_0xb6e3cf){var _0x87ddfe={},_0xaf02e2={},_0x34a508={'count':0x0,'rows':[]};var _0x651beb=_[_0xa878('0x29')](db[_0xa878('0x2a')][_0xa878('0x2b')],function(_0x55e129){return{'name':_0x55e129['fieldName'],'type':_0x55e129['type'][_0xa878('0x2c')]};});_0xaf02e2[_0xa878('0x2d')]=_[_0xa878('0x29')](_0x651beb,_0xa878('0x27'));_0xaf02e2[_0xa878('0x2e')]=_[_0xa878('0x2f')](_0x254fdf[_0xa878('0x2e')]);_0xaf02e2[_0xa878('0x30')]=_[_0xa878('0x31')](_0xaf02e2[_0xa878('0x2d')],_0xaf02e2['query']);_0x87ddfe['attributes']=_['intersection'](_0xaf02e2[_0xa878('0x2d')],qs[_0xa878('0x32')](_0x254fdf['query']['fields']));_0x87ddfe[_0xa878('0x33')]=_0x87ddfe[_0xa878('0x33')][_0xa878('0x34')]?_0x87ddfe[_0xa878('0x33')]:_0xaf02e2['model'];if(!_0x254fdf[_0xa878('0x2e')][_0xa878('0x35')](_0xa878('0x36'))){_0x87ddfe[_0xa878('0x1b')]=qs[_0xa878('0x1b')](_0x254fdf[_0xa878('0x2e')][_0xa878('0x1b')]);_0x87ddfe[_0xa878('0x19')]=qs[_0xa878('0x19')](_0x254fdf[_0xa878('0x2e')][_0xa878('0x19')]);}_0x87ddfe[_0xa878('0x37')]=qs[_0xa878('0x38')](_0x254fdf[_0xa878('0x2e')][_0xa878('0x38')]);_0x87ddfe[_0xa878('0x39')]=qs[_0xa878('0x30')](_['pick'](_0x254fdf[_0xa878('0x2e')],_0xaf02e2[_0xa878('0x30')]),_0x651beb);if(_0x254fdf['query'][_0xa878('0x3a')]){_0x87ddfe[_0xa878('0x39')]=_[_0xa878('0x3b')](_0x87ddfe[_0xa878('0x39')],{'$or':_['map'](_0x651beb,function(_0x258244){if(_0x258244[_0xa878('0x3c')]!==_0xa878('0x3d')){var _0x3b920d={};_0x3b920d[_0x258244[_0xa878('0x27')]]={'$like':'%'+_0x254fdf['query'][_0xa878('0x3a')]+'%'};return _0x3b920d;}})});}_0x87ddfe=_[_0xa878('0x3b')]({},_0x87ddfe,_0x254fdf[_0xa878('0x3e')]);var _0x55320d={'where':_0x87ddfe[_0xa878('0x39')]};return db[_0xa878('0x2a')][_0xa878('0x1c')](_0x55320d)[_0xa878('0x23')](function(_0x32a1b){_0x34a508[_0xa878('0x1c')]=_0x32a1b;if(_0x254fdf[_0xa878('0x2e')]['includeAll']){_0x87ddfe[_0xa878('0x3f')]=[{'all':!![]}];}return db['SmsApplication'][_0xa878('0x40')](_0x87ddfe);})[_0xa878('0x23')](function(_0x38b966){_0x34a508[_0xa878('0x41')]=_0x38b966;return _0x34a508;})[_0xa878('0x23')](respondWithFilteredResult(_0xb6e3cf,_0x87ddfe))[_0xa878('0x42')](handleError(_0xb6e3cf,null));};exports[_0xa878('0x43')]=function(_0x7b5946,_0x250952){var _0x44221f={'raw':!![],'where':{'id':_0x7b5946[_0xa878('0x44')]['id']}},_0x578c5e={};_0x578c5e[_0xa878('0x2d')]=_['keys'](db['SmsApplication'][_0xa878('0x2b')]);_0x578c5e['query']=_[_0xa878('0x2f')](_0x7b5946[_0xa878('0x2e')]);_0x578c5e[_0xa878('0x30')]=_[_0xa878('0x31')](_0x578c5e[_0xa878('0x2d')],_0x578c5e[_0xa878('0x2e')]);_0x44221f['attributes']=_[_0xa878('0x31')](_0x578c5e[_0xa878('0x2d')],qs[_0xa878('0x32')](_0x7b5946[_0xa878('0x2e')][_0xa878('0x32')]));_0x44221f['attributes']=_0x44221f[_0xa878('0x33')][_0xa878('0x34')]?_0x44221f[_0xa878('0x33')]:_0x578c5e[_0xa878('0x2d')];if(_0x7b5946['query'][_0xa878('0x45')]){_0x44221f['include']=[{'all':!![]}];}_0x44221f=_[_0xa878('0x3b')]({},_0x44221f,_0x7b5946[_0xa878('0x3e')]);return db[_0xa878('0x2a')]['find'](_0x44221f)[_0xa878('0x23')](handleEntityNotFound(_0x250952,null))['then'](respondWithResult(_0x250952,null))[_0xa878('0x42')](handleError(_0x250952,null));};exports['create']=function(_0xb1f674,_0x290225){return db[_0xa878('0x2a')][_0xa878('0x46')](_0xb1f674['body'],{})['then'](respondWithResult(_0x290225,0xc9))[_0xa878('0x42')](handleError(_0x290225,null));};exports['update']=function(_0x373939,_0x56f307){if(_0x373939[_0xa878('0x47')]['id']){delete _0x373939[_0xa878('0x47')]['id'];}return db['SmsApplication'][_0xa878('0x48')]({'where':{'id':_0x373939['params']['id']}})[_0xa878('0x23')](handleEntityNotFound(_0x56f307,null))[_0xa878('0x23')](saveUpdates(_0x373939[_0xa878('0x47')],null))[_0xa878('0x23')](respondWithResult(_0x56f307,null))[_0xa878('0x42')](handleError(_0x56f307,null));};exports[_0xa878('0x24')]=function(_0x13e496,_0x17c2b4){return db[_0xa878('0x2a')][_0xa878('0x48')]({'where':{'id':_0x13e496[_0xa878('0x44')]['id']}})[_0xa878('0x23')](handleEntityNotFound(_0x17c2b4,null))[_0xa878('0x23')](removeEntity(_0x17c2b4,null))[_0xa878('0x42')](handleError(_0x17c2b4,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index e4c3bc5..57b568e 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 _0x6aa9=['./smsApplication.attributes','exports','define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4e25fe,_0x24b0c2){var _0x17fc4d=function(_0x57a3c2){while(--_0x57a3c2){_0x4e25fe['push'](_0x4e25fe['shift']());}};_0x17fc4d(++_0x24b0c2);}(_0x6aa9,0x66));var _0x96aa=function(_0xb34a27,_0x26fa6b){_0xb34a27=_0xb34a27-0x0;var _0x251e37=_0x6aa9[_0xb34a27];return _0x251e37;};'use strict';var _=require(_0x96aa('0x0'));var util=require(_0x96aa('0x1'));var logger=require(_0x96aa('0x2'))(_0x96aa('0x3'));var moment=require(_0x96aa('0x4'));var BPromise=require(_0x96aa('0x5'));var rp=require(_0x96aa('0x6'));var fs=require('fs');var path=require(_0x96aa('0x7'));var rimraf=require(_0x96aa('0x8'));var config=require(_0x96aa('0x9'));var attributes=require(_0x96aa('0xa'));module[_0x96aa('0xb')]=function(_0x20a0f2,_0x5386e7){return _0x20a0f2[_0x96aa('0xc')](_0x96aa('0xd'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x96aa('0xe'),'collate':_0x96aa('0xf')});}; \ No newline at end of file +var _0xd4f4=['./smsApplication.attributes','exports','define','sms_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x39882f,_0x5c74c1){var _0x1ec8ad=function(_0x487028){while(--_0x487028){_0x39882f['push'](_0x39882f['shift']());}};_0x1ec8ad(++_0x5c74c1);}(_0xd4f4,0x6d));var _0x4d4f=function(_0x4a542a,_0x5b5ba5){_0x4a542a=_0x4a542a-0x0;var _0x133708=_0xd4f4[_0x4a542a];return _0x133708;};'use strict';var _=require(_0x4d4f('0x0'));var util=require('util');var logger=require(_0x4d4f('0x1'))(_0x4d4f('0x2'));var moment=require(_0x4d4f('0x3'));var BPromise=require(_0x4d4f('0x4'));var rp=require(_0x4d4f('0x5'));var fs=require('fs');var path=require(_0x4d4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4d4f('0x7'));var attributes=require(_0x4d4f('0x8'));module[_0x4d4f('0x9')]=function(_0x2dc2e7,_0x41efae){return _0x2dc2e7[_0x4d4f('0xa')]('SmsApplication',attributes,{'tableName':_0x4d4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4d4f('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 2fda85d..08be1be 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 _0x6fad=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x6fad,0x17a));var _0xd6fa=function(_0xd83f3e,_0x3c909e){_0xd83f3e=_0xd83f3e-0x0;var _0x3afffc=_0x6fad[_0xd83f3e];return _0x3afffc;};'use strict';var _=require(_0xd6fa('0x0'));var util=require(_0xd6fa('0x1'));var moment=require(_0xd6fa('0x2'));var BPromise=require(_0xd6fa('0x3'));var rs=require(_0xd6fa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6fa('0x6'))('rpc');var config=require(_0xd6fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd6fa('0x8')][_0xd6fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ed68a,_0x1d5e36,_0x2f17ae){return new BPromise(function(_0x147e16,_0x163481){return client['request'](_0x2ed68a,_0x2f17ae)[_0xd6fa('0xa')](function(_0x48092f){logger[_0xd6fa('0xb')](_0xd6fa('0xc'),_0x1d5e36,_0xd6fa('0xd'));logger[_0xd6fa('0xe')](_0xd6fa('0xf'),_0x1d5e36,'request\x20sent',JSON['stringify'](_0x48092f));if(_0x48092f[_0xd6fa('0x10')]){if(_0x48092f[_0xd6fa('0x10')][_0xd6fa('0x11')]===0x1f4){logger['error'](_0xd6fa('0xc'),_0x1d5e36,_0x48092f[_0xd6fa('0x10')][_0xd6fa('0x12')]);return _0x163481(_0x48092f[_0xd6fa('0x10')][_0xd6fa('0x12')]);}logger[_0xd6fa('0x10')](_0xd6fa('0xc'),_0x1d5e36,_0x48092f['error'][_0xd6fa('0x12')]);return _0x147e16(_0x48092f['error']['message']);}else{logger[_0xd6fa('0xb')](_0xd6fa('0xc'),_0x1d5e36,'request\x20sent');_0x147e16(_0x48092f[_0xd6fa('0x13')][_0xd6fa('0x12')]);}})['catch'](function(_0x3a9263){logger[_0xd6fa('0x10')](_0xd6fa('0xc'),_0x1d5e36,_0x3a9263);_0x163481(_0x3a9263);});});} \ No newline at end of file +var _0x9563=['message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9563,0x1e7));var _0x3956=function(_0x3204d5,_0x2102cc){_0x3204d5=_0x3204d5-0x0;var _0xa09589=_0x9563[_0x3204d5];return _0xa09589;};'use strict';var _=require(_0x3956('0x0'));var util=require(_0x3956('0x1'));var moment=require('moment');var BPromise=require(_0x3956('0x2'));var rs=require(_0x3956('0x3'));var fs=require('fs');var Redis=require(_0x3956('0x4'));var db=require(_0x3956('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3956('0x6'));var config=require('../../config/environment');var jayson=require(_0x3956('0x7'));var client=jayson[_0x3956('0x8')][_0x3956('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xba3e4b,_0x47bdbc,_0x234e06){return new BPromise(function(_0xf1e100,_0x2863cd){return client[_0x3956('0xa')](_0xba3e4b,_0x234e06)[_0x3956('0xb')](function(_0x4dd27f){logger['info'](_0x3956('0xc'),_0x47bdbc,_0x3956('0xd'));logger[_0x3956('0xe')](_0x3956('0xf'),_0x47bdbc,'request\x20sent',JSON[_0x3956('0x10')](_0x4dd27f));if(_0x4dd27f[_0x3956('0x11')]){if(_0x4dd27f[_0x3956('0x11')][_0x3956('0x12')]===0x1f4){logger[_0x3956('0x11')](_0x3956('0xc'),_0x47bdbc,_0x4dd27f[_0x3956('0x11')][_0x3956('0x13')]);return _0x2863cd(_0x4dd27f[_0x3956('0x11')]['message']);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x47bdbc,_0x4dd27f[_0x3956('0x11')][_0x3956('0x13')]);return _0xf1e100(_0x4dd27f['error'][_0x3956('0x13')]);}else{logger[_0x3956('0x14')](_0x3956('0xc'),_0x47bdbc,_0x3956('0xd'));_0xf1e100(_0x4dd27f[_0x3956('0x15')][_0x3956('0x13')]);}})[_0x3956('0x16')](function(_0x458b4a){logger[_0x3956('0x11')](_0x3956('0xc'),_0x47bdbc,_0x458b4a);_0x2863cd(_0x458b4a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 842d285..15494fe 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 _0x96cc=['smsinteraction:destroy','delete','removeTags','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update'];(function(_0x18aeda,_0xf1fe62){var _0x1b3726=function(_0x1bbf0d){while(--_0x1bbf0d){_0x18aeda['push'](_0x18aeda['shift']());}};_0x1b3726(++_0xf1fe62);}(_0x96cc,0x16c));var _0xc96c=function(_0x3b0e0c,_0x5e4814){_0x3b0e0c=_0x3b0e0c-0x0;var _0x3efb86=_0x96cc[_0x3b0e0c];return _0x3efb86;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var fs_extra=require(_0xc96c('0x4'));var auth=require(_0xc96c('0x5'));var interaction=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var controller=require(_0xc96c('0x8'));router[_0xc96c('0x9')]('/',auth[_0xc96c('0xa')](),controller['index']);router[_0xc96c('0x9')](_0xc96c('0xb'),auth[_0xc96c('0xa')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x9')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller['show']);router[_0xc96c('0x9')](_0xc96c('0xe'),auth[_0xc96c('0xa')](),controller['getMessages']);router[_0xc96c('0x9')]('/:id/download',auth[_0xc96c('0xa')](),controller['download']);router[_0xc96c('0xf')]('/',auth[_0xc96c('0xa')](),controller[_0xc96c('0x10')]);router[_0xc96c('0xf')]('/:id/messages',auth[_0xc96c('0xa')](),controller[_0xc96c('0x11')]);router[_0xc96c('0xf')](_0xc96c('0x12'),auth['isAuthenticated'](),interaction[_0xc96c('0x13')](_0xc96c('0x14'),_0xc96c('0x15')),controller[_0xc96c('0x16')]);router[_0xc96c('0x17')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),interaction[_0xc96c('0x13')](_0xc96c('0x14'),_0xc96c('0x18')),controller[_0xc96c('0x19')]);router['delete']('/:id',auth[_0xc96c('0xa')](),interaction[_0xc96c('0x13')](_0xc96c('0x14'),_0xc96c('0x1a')),controller['destroy']);router[_0xc96c('0x1b')](_0xc96c('0x12'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x1c')]);module[_0xc96c('0x1d')]=router; \ No newline at end of file +var _0x36ee=['../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','sms','smsinteraction:update','update','delete','smsinteraction:destroy','/:id/tags','removeTags','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x28c5df,_0x3ac326){var _0x1cb12b=function(_0x2a6945){while(--_0x2a6945){_0x28c5df['push'](_0x28c5df['shift']());}};_0x1cb12b(++_0x3ac326);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x13')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router['post'](_0xe36e('0xf'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x13')]('/:id/tags',auth[_0xe36e('0x9')](),interaction['tracked']('sms',_0xe36e('0x16')),controller[_0xe36e('0x17')]);router[_0xe36e('0x18')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')](_0xe36e('0x1a'),_0xe36e('0x1b')),controller[_0xe36e('0x1c')]);router[_0xe36e('0x1d')]('/:id',auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')]('sms',_0xe36e('0x1e')),controller['destroy']);router[_0xe36e('0x1d')](_0xe36e('0x1f'),auth['isAuthenticated'](),controller[_0xe36e('0x20')]);module[_0xe36e('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index c55e362..f518ca9 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 _0x3588=['BOOLEAN','DATE','STRING','ENUM','sequelize','moment','exports'];(function(_0x23de94,_0x2391f1){var _0x37854c=function(_0x4e0b21){while(--_0x4e0b21){_0x23de94['push'](_0x23de94['shift']());}};_0x37854c(++_0x2391f1);}(_0x3588,0x82));var _0x8358=function(_0x45cea1,_0x45db40){_0x45cea1=_0x45cea1-0x0;var _0xda8ddd=_0x3588[_0x45cea1];return _0xda8ddd;};'use strict';var Sequelize=require(_0x8358('0x0'));var moment=require(_0x8358('0x1'));module[_0x8358('0x2')]={'closed':{'type':Sequelize[_0x8358('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8358('0x4')]},'disposition':{'type':Sequelize[_0x8358('0x5')]},'secondDisposition':{'type':Sequelize[_0x8358('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8358('0x5')]},'phone':{'type':Sequelize[_0x8358('0x5')]},'read1stAt':{'type':Sequelize[_0x8358('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x8358('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8358('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8358('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8358('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbb59=['BOOLEAN','INTEGER','sequelize','moment','exports','STRING','ENUM','out','DATE'];(function(_0x47408e,_0x481428){var _0x1636bc=function(_0x2fe7a6){while(--_0x2fe7a6){_0x47408e['push'](_0x47408e['shift']());}};_0x1636bc(++_0x481428);}(_0xbb59,0xec));var _0x9bb5=function(_0x56a977,_0x243b19){_0x56a977=_0x56a977-0x0;var _0xd85fee=_0xbb59[_0x56a977];return _0xd85fee;};'use strict';var Sequelize=require(_0x9bb5('0x0'));var moment=require(_0x9bb5('0x1'));module[_0x9bb5('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9bb5('0x3')]},'secondDisposition':{'type':Sequelize[_0x9bb5('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9bb5('0x3')]},'note':{'type':Sequelize[_0x9bb5('0x3')]},'phone':{'type':Sequelize[_0x9bb5('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x9bb5('0x4')]('in',_0x9bb5('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9bb5('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x9bb5('0x4')]('in',_0x9bb5('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9bb5('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9bb5('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index db2a7e2..0af4417 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 _0xb1ac=['create','body','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','filters','intersection','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','merge','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','push','Contact','lastName','Messages','createdAt','read','SmsAccount','Account','Owner','mkdirSync','Sms','disposition','System','firstName','direction','out','secret','value','renderFile','join','views','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','offset','undefined','count','limit','set','update','then','destroy','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','show','model','keys','attributes','fields','length','include','options','find'];(function(_0xa3b63e,_0x3a2b34){var _0x520e2a=function(_0x4d657a){while(--_0x4d657a){_0xa3b63e['push'](_0xa3b63e['shift']());}};_0x520e2a(++_0x3a2b34);}(_0xb1ac,0x134));var _0xcb1a=function(_0x8f8fc0,_0x232676){_0x8f8fc0=_0x8f8fc0-0x0;var _0x573e17=_0xb1ac[_0x8f8fc0];return _0x573e17;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xcb1a('0x0'));var moment=require(_0xcb1a('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xcb1a('0x2'));var ejs=require(_0xcb1a('0x3'));var fs=require('fs');var _=require(_0xcb1a('0x4'));var Redis=require(_0xcb1a('0x5'));var interaction=require(_0xcb1a('0x6'));var qs=require(_0xcb1a('0x7'));var pdf=require(_0xcb1a('0x8'));var logger=require(_0xcb1a('0x9'))('api');var config=require(_0xcb1a('0xa'));var db=require(_0xcb1a('0xb'))['db'];config[_0xcb1a('0xc')]=_[_0xcb1a('0xd')](config['redis'],{'host':_0xcb1a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')[_0xcb1a('0xf')](socket);function respondWithStatusCode(_0x215e51,_0x22ca2d){_0x22ca2d=_0x22ca2d||0xcc;return function(_0x32c4af){if(_0x32c4af){return _0x215e51[_0xcb1a('0x10')](_0x22ca2d);}return _0x215e51['status'](_0x22ca2d)['end']();};}function respondWithResult(_0x43c8f0,_0xe0d5af){_0xe0d5af=_0xe0d5af||0xc8;return function(_0x4da413){if(_0x4da413){return _0x43c8f0[_0xcb1a('0x11')](_0xe0d5af)['json'](_0x4da413);}};}function respondWithFilteredResult(_0x1f68eb,_0x3050c5){return function(_0x5549ef){if(_0x5549ef){var _0x590dd7=typeof _0x3050c5[_0xcb1a('0x12')]===_0xcb1a('0x13')&&typeof _0x3050c5['limit']===_0xcb1a('0x13');var _0x19123e=_0x5549ef[_0xcb1a('0x14')];var _0x566fa3=_0x590dd7?0x0:_0x3050c5[_0xcb1a('0x12')];var _0x971453=_0x590dd7?_0x5549ef[_0xcb1a('0x14')]:_0x3050c5[_0xcb1a('0x12')]+_0x3050c5[_0xcb1a('0x15')];var _0x593b14;if(_0x971453>=_0x19123e){_0x971453=_0x19123e;_0x593b14=0xc8;}else{_0x593b14=0xce;}_0x1f68eb[_0xcb1a('0x11')](_0x593b14);return _0x1f68eb[_0xcb1a('0x16')]('Content-Range',_0x566fa3+'-'+_0x971453+'/'+_0x19123e)['json'](_0x5549ef);}return null;};}function saveUpdates(_0x4b2f3e){return function(_0x531310){if(_0x531310){return _0x531310[_0xcb1a('0x17')](_0x4b2f3e)[_0xcb1a('0x18')](function(_0x100da7){return _0x100da7;});}return null;};}function removeEntity(_0x2e2b79){return function(_0x4ff98d){if(_0x4ff98d){return _0x4ff98d[_0xcb1a('0x19')]()['then'](function(){_0x2e2b79[_0xcb1a('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x339be5){return function(_0x5d66e7){if(!_0x5d66e7){_0x339be5[_0xcb1a('0x10')](0x194);}return _0x5d66e7;};}function handleError(_0x237305,_0x41ba72){_0x41ba72=_0x41ba72||0x1f4;return function(_0x775882){logger['error'](_0x775882['stack']);if(_0x775882[_0xcb1a('0x1a')]){delete _0x775882[_0xcb1a('0x1a')];}_0x237305['status'](_0x41ba72)[_0xcb1a('0x1b')](_0x775882);};}exports[_0xcb1a('0x1c')]=function(_0x6e79e6,_0x2d6765){var _0x45f80e={};var _0x24275a=_[_0xcb1a('0x1d')](db[_0xcb1a('0x1e')][_0xcb1a('0x1f')],function(_0x35654a){return{'name':_0x35654a[_0xcb1a('0x20')],'type':_0x35654a[_0xcb1a('0x21')][_0xcb1a('0x22')]};});_0x45f80e=qs[_0xcb1a('0x23')](_0x24275a,_0x6e79e6);return interaction[_0xcb1a('0x24')]('sms',_0x6e79e6[_0xcb1a('0x25')],_0x6e79e6[_0xcb1a('0x26')],_0x45f80e,_0x24275a)[_0xcb1a('0x18')](respondWithFilteredResult(_0x2d6765,_0x45f80e))[_0xcb1a('0x27')](handleError(_0x2d6765,null));};exports[_0xcb1a('0x28')]=function(_0x5741f2,_0x45034e){var _0x4a2305={'raw':![],'where':{'id':_0x5741f2['params']['id']}},_0x1849b4={};_0x1849b4[_0xcb1a('0x29')]=_[_0xcb1a('0x2a')](db[_0xcb1a('0x1e')][_0xcb1a('0x1f')]);_0x1849b4[_0xcb1a('0x25')]=_[_0xcb1a('0x2a')](_0x5741f2[_0xcb1a('0x25')]);_0x1849b4['filters']=_['intersection'](_0x1849b4['model'],_0x1849b4['query']);_0x4a2305[_0xcb1a('0x2b')]=_['intersection'](_0x1849b4[_0xcb1a('0x29')],qs[_0xcb1a('0x2c')](_0x5741f2[_0xcb1a('0x25')][_0xcb1a('0x2c')]));_0x4a2305[_0xcb1a('0x2b')]=_0x4a2305[_0xcb1a('0x2b')][_0xcb1a('0x2d')]?_0x4a2305['attributes']:_0x1849b4['model'];if(_0x5741f2[_0xcb1a('0x25')]['includeAll']){_0x4a2305[_0xcb1a('0x2e')]=[{'all':!![]}];}_0x4a2305=_['merge']({},_0x4a2305,_0x5741f2[_0xcb1a('0x2f')]);return db[_0xcb1a('0x1e')][_0xcb1a('0x30')](_0x4a2305)['then'](handleEntityNotFound(_0x45034e,null))['then'](respondWithResult(_0x45034e,null))['catch'](handleError(_0x45034e,null));};exports[_0xcb1a('0x31')]=function(_0x28f688,_0xf8338c){return db[_0xcb1a('0x1e')][_0xcb1a('0x31')](_0x28f688[_0xcb1a('0x32')],{})[_0xcb1a('0x18')](respondWithResult(_0xf8338c,0xc9))[_0xcb1a('0x27')](handleError(_0xf8338c,null));};exports[_0xcb1a('0x17')]=function(_0x54629d,_0x38d460){if(_0x54629d[_0xcb1a('0x32')]['id']){delete _0x54629d[_0xcb1a('0x32')]['id'];}return db['SmsInteraction'][_0xcb1a('0x30')]({'where':{'id':_0x54629d[_0xcb1a('0x33')]['id']}})[_0xcb1a('0x18')](handleEntityNotFound(_0x38d460,null))['then'](saveUpdates(_0x54629d[_0xcb1a('0x32')],null))[_0xcb1a('0x18')](respondWithResult(_0x38d460,null))['catch'](handleError(_0x38d460,null));};exports[_0xcb1a('0x19')]=function(_0x35038d,_0x2a120e){return db['SmsInteraction'][_0xcb1a('0x30')]({'where':{'id':_0x35038d[_0xcb1a('0x33')]['id']}})[_0xcb1a('0x18')](handleEntityNotFound(_0x2a120e,null))['then'](removeEntity(_0x2a120e,null))[_0xcb1a('0x27')](handleError(_0x2a120e,null));};exports['describe']=function(_0x3ba0c4,_0x5c7536){return db[_0xcb1a('0x1e')][_0xcb1a('0x34')]()['then'](respondWithResult(_0x5c7536,null))[_0xcb1a('0x27')](handleError(_0x5c7536,null));};exports[_0xcb1a('0x35')]=function(_0x4e6e38,_0x351262){return db[_0xcb1a('0x36')][_0xcb1a('0x30')]({'where':{'id':_0x4e6e38[_0xcb1a('0x33')]['id']}})['then'](handleEntityNotFound(_0x351262,null))[_0xcb1a('0x18')](function(_0x4e0936){if(_0x4e0936){return _0x4e0936[_0xcb1a('0x35')](_0x4e6e38[_0xcb1a('0x32')][_0xcb1a('0x37')],_[_0xcb1a('0x38')](_0x4e6e38[_0xcb1a('0x32')],[_0xcb1a('0x37'),'id'])||{});}})[_0xcb1a('0x18')](respondWithResult(_0x351262,null))[_0xcb1a('0x27')](handleError(_0x351262,null));};exports[_0xcb1a('0x39')]=function(_0x3e1582,_0x59634b){var _0x1cead1={'raw':![],'where':{}};var _0x14ccf2={};var _0x18dacd={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xcb1a('0x3a')]({'where':{'id':_0x3e1582[_0xcb1a('0x33')]['id']}})[_0xcb1a('0x18')](handleEntityNotFound(_0x59634b,null))['then'](function(_0x2ae001){if(_0x2ae001){_0x14ccf2['model']=_['keys'](db[_0xcb1a('0x36')]['rawAttributes']);_0x14ccf2[_0xcb1a('0x25')]=_[_0xcb1a('0x2a')](_0x3e1582[_0xcb1a('0x25')]);_0x14ccf2[_0xcb1a('0x3b')]=_[_0xcb1a('0x3c')](_0x14ccf2[_0xcb1a('0x29')],_0x14ccf2[_0xcb1a('0x25')]);_0x1cead1[_0xcb1a('0x2b')]=_[_0xcb1a('0x3c')](_0x14ccf2[_0xcb1a('0x29')],qs['fields'](_0x3e1582[_0xcb1a('0x25')][_0xcb1a('0x2c')]));_0x1cead1[_0xcb1a('0x2b')]=_0x1cead1[_0xcb1a('0x2b')][_0xcb1a('0x2d')]?_0x1cead1[_0xcb1a('0x2b')]:_0x14ccf2[_0xcb1a('0x29')];if(!_0x3e1582[_0xcb1a('0x25')][_0xcb1a('0x3d')](_0xcb1a('0x3e'))){_0x1cead1[_0xcb1a('0x15')]=qs[_0xcb1a('0x15')](_0x3e1582['query'][_0xcb1a('0x15')]);_0x1cead1['offset']=qs[_0xcb1a('0x12')](_0x3e1582[_0xcb1a('0x25')][_0xcb1a('0x12')]);}_0x1cead1[_0xcb1a('0x3f')]=qs['sort'](_0x3e1582[_0xcb1a('0x25')][_0xcb1a('0x40')]);_0x1cead1[_0xcb1a('0x41')]=qs[_0xcb1a('0x3b')](_[_0xcb1a('0x42')](_0x3e1582[_0xcb1a('0x25')],_0x14ccf2[_0xcb1a('0x3b')]));_0x1cead1[_0xcb1a('0x41')][_0xcb1a('0x43')]=_0x2ae001['id'];if(_0x3e1582['query']['filter']){_0x1cead1[_0xcb1a('0x41')]=_[_0xcb1a('0x44')](_0x1cead1[_0xcb1a('0x41')],{'$or':_['map'](_0x1cead1['attributes'],function(_0x5d8f90){var _0x5d8ec2={};_0x5d8ec2[_0x5d8f90]={'$like':'%'+_0x3e1582[_0xcb1a('0x25')][_0xcb1a('0x45')]+'%'};return _0x5d8ec2;})});}if(_0x3e1582[_0xcb1a('0x25')][_0xcb1a('0x46')]){var _0x28e0fe=_0x3e1582[_0xcb1a('0x25')][_0xcb1a('0x46')]['split'](',');var _0x1e79ed={};_0x1e79ed[_0x28e0fe[0x0]]={'$gte':moment(_0x28e0fe[0x1])[_0xcb1a('0x47')](_0xcb1a('0x48'))};_0x1cead1[_0xcb1a('0x41')]=_[_0xcb1a('0x44')](_0x1cead1['where'],_0x1e79ed);}_0x1cead1=_[_0xcb1a('0x44')]({},_0x1cead1,_0x3e1582['options']);return db[_0xcb1a('0x36')][_0xcb1a('0x14')]({'where':_0x1cead1[_0xcb1a('0x41')]})[_0xcb1a('0x18')](function(_0x34b623){_0x18dacd[_0xcb1a('0x14')]=_0x34b623;if(_0x3e1582[_0xcb1a('0x25')][_0xcb1a('0x49')]){_0x1cead1[_0xcb1a('0x2e')]=[{'all':!![]}];}return db[_0xcb1a('0x36')]['findAll'](_0x1cead1);})[_0xcb1a('0x18')](function(_0x4e90da){_0x18dacd[_0xcb1a('0x4a')]=_0x4e90da;return _0x18dacd;});}})[_0xcb1a('0x18')](respondWithFilteredResult(_0x59634b,_0x1cead1))[_0xcb1a('0x27')](handleError(_0x59634b,null));};exports[_0xcb1a('0x4b')]=function(_0x7ae81b,_0x521835){return db[_0xcb1a('0x1e')]['find']({'where':{'id':_0x7ae81b[_0xcb1a('0x33')]['id']}})['then'](handleEntityNotFound(_0x521835,null))['then'](function(_0x2931f1){if(_0x2931f1){return _0x2931f1[_0xcb1a('0x4c')](_0x7ae81b['body'][_0xcb1a('0x37')],_[_0xcb1a('0x38')](_0x7ae81b[_0xcb1a('0x32')],[_0xcb1a('0x37'),'id'])||{})[_0xcb1a('0x4d')](function(){return db[_0xcb1a('0x4e')]['findAll']({'attributes':['id',_0xcb1a('0x1a'),_0xcb1a('0x4f')],'where':{'id':_0x7ae81b[_0xcb1a('0x32')][_0xcb1a('0x37')]}});})[_0xcb1a('0x18')](function(_0x30e421){socket[_0xcb1a('0x50')](_0xcb1a('0x51'),{'id':Number(_0x7ae81b[_0xcb1a('0x33')]['id']),'tags':_0x30e421||[]});return{'id':Number(_0x7ae81b['params']['id']),'tags':_0x30e421||[]};});}})[_0xcb1a('0x18')](respondWithResult(_0x521835,null))[_0xcb1a('0x27')](handleError(_0x521835,null));};exports[_0xcb1a('0x52')]=function(_0x2ff9f7,_0x41cb81){return db['SmsInteraction'][_0xcb1a('0x30')]({'where':{'id':_0x2ff9f7[_0xcb1a('0x33')]['id']}})['then'](handleEntityNotFound(_0x41cb81,null))[_0xcb1a('0x18')](function(_0x3158ac){if(_0x3158ac){return _0x3158ac[_0xcb1a('0x52')](_0x2ff9f7[_0xcb1a('0x25')]['ids']);}})[_0xcb1a('0x18')](respondWithStatusCode(_0x41cb81,null))[_0xcb1a('0x27')](handleError(_0x41cb81,null));};exports[_0xcb1a('0x53')]=function(_0x5abb0b,_0x18f04b){var _0x5a23a3=moment()[_0xcb1a('0x54')]()[_0xcb1a('0x55')]();var _0x417702=path['join'](config[_0xcb1a('0x56')],_0xcb1a('0x57'),_0xcb1a('0x58'),_0xcb1a('0x59'));var _0x34e6f9=path['join'](_0x417702,_0x5a23a3);var _0x2fd277=util['format'](_0xcb1a('0x5a'),_0x5abb0b['params']['id'],_0x5a23a3);var _0x5bb1e0=path['join'](_0x417702,_0x2fd277);var _0x13d4a0=[];_0x13d4a0['push']({'model':db[_0xcb1a('0x5b')],'as':_0xcb1a('0x5b'),'attributes':['id',_0xcb1a('0x5c')],'raw':!![]});_0x13d4a0[_0xcb1a('0x5d')]({'model':db['CmContact'],'as':_0xcb1a('0x5e'),'attributes':['id','firstName',_0xcb1a('0x5f')],'raw':!![]});var _0x10c433=[{'model':db[_0xcb1a('0x36')],'as':_0xcb1a('0x60'),'attributes':['id','body',_0xcb1a('0x61'),'direction','secret',_0xcb1a('0x62')],'include':_0x13d4a0}];_0x10c433[_0xcb1a('0x5d')]({'model':db[_0xcb1a('0x63')],'as':_0xcb1a('0x64'),'attributes':['id','name']});_0x10c433['push']({'model':db[_0xcb1a('0x5b')],'as':_0xcb1a('0x65'),'attributes':['id',_0xcb1a('0x5c')]});return db[_0xcb1a('0x1e')]['find']({'where':{'id':_0x5abb0b[_0xcb1a('0x33')]['id']},'include':_0x10c433})[_0xcb1a('0x18')](handleEntityNotFound(_0x18f04b,null))[_0xcb1a('0x18')](function(_0x345ebb){if(_0x345ebb){var _0x53c6b7=_0x345ebb['get']({'plain':!![]});fs[_0xcb1a('0x66')](_0x34e6f9);var _0x347c02={'channel':_0xcb1a('0x67'),'account':_0x53c6b7[_0xcb1a('0x64')][_0xcb1a('0x1a')],'agent':_0x53c6b7['Owner']?_0x53c6b7[_0xcb1a('0x65')]['fullname']:'N.A.','createdAt':moment(_0x53c6b7[_0xcb1a('0x61')])[_0xcb1a('0x47')](_0xcb1a('0x48'))[_0xcb1a('0x55')](),'closedAt':_0x53c6b7['closed']?moment(_0x53c6b7['closedAt'])[_0xcb1a('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0xcb1a('0x55')]():'','disposition':_0x53c6b7[_0xcb1a('0x68')],'messages':_(_0x53c6b7[_0xcb1a('0x60')])[_0xcb1a('0x45')]({'secret':![]})[_0xcb1a('0x1d')](function(_0x27335e){return{'date':moment(_0x27335e[_0xcb1a('0x61')])[_0xcb1a('0x47')](_0xcb1a('0x48'))[_0xcb1a('0x55')](),'sender':_0x27335e['direction']==='out'?_0x27335e[_0xcb1a('0x5b')]?_0x27335e[_0xcb1a('0x5b')][_0xcb1a('0x5c')]:_0xcb1a('0x69'):_0x27335e[_0xcb1a('0x5e')][_0xcb1a('0x6a')]+(_0x27335e[_0xcb1a('0x5e')][_0xcb1a('0x5f')]?'\x20'+_0x27335e[_0xcb1a('0x5e')]['lastName']:''),'body':_0x27335e[_0xcb1a('0x32')],'direction':_0x27335e[_0xcb1a('0x6b')]===_0xcb1a('0x6c')?'A':'C','secret':_0x27335e[_0xcb1a('0x6d')],'read':_0x27335e[_0xcb1a('0x62')]};})[_0xcb1a('0x6e')]()};return ejs[_0xcb1a('0x6f')](path[_0xcb1a('0x70')](config[_0xcb1a('0x56')],'server',_0xcb1a('0x71'),_0xcb1a('0x72')),{'interaction':_0x347c02})[_0xcb1a('0x18')](function(_0x3c1f47){var _0x6d37ed=path[_0xcb1a('0x70')](_0x34e6f9,'transcript-'+_0x53c6b7['id']+'-'+_0x5a23a3+'.pdf');var _0x217efd={'path':_0x6d37ed,'channel':'Sms','interactionId':_0x53c6b7['id']};return pdf[_0xcb1a('0x73')](_0x3c1f47,_0x217efd);})[_0xcb1a('0x18')](function(){return new BPromise(function(_0xb3280c,_0x307ca4){zipdir(_0x34e6f9,{'saveTo':_0x5bb1e0},function(_0x352f7a,_0x170e96){if(_0x352f7a)return _0x307ca4(_0x352f7a);return _0xb3280c(_0x170e96);});})[_0xcb1a('0x18')](function(){return new BPromise(function(_0x428de1,_0x14d48f){rimraf(_0x34e6f9,function(_0x539fcf){if(_0x539fcf)_0x14d48f(_0x539fcf);return _0x428de1();});});})[_0xcb1a('0x18')](function(){return _0x18f04b[_0xcb1a('0x53')](_0x5bb1e0,_0x2fd277,function(_0x5856a6){if(_0x5856a6){console[_0xcb1a('0x74')](_0xcb1a('0x75'),_0x5856a6);}else{fs[_0xcb1a('0x76')](_0x5bb1e0);}});});});}else{return _0x18f04b['sendStatus'](0xc8);}})['catch'](handleError(_0x18f04b,null));}; \ No newline at end of file +var _0x31db=['SmsAccount','Account','Owner','get','mkdirSync','N.A.','createdAt','closed','closedAt','direction','out','System','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','redis','defaults','localhost','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','then','end','name','send','index','map','SmsInteraction','fieldName','type','getOptions','findAll','sms','query','user','catch','params','model','keys','rawAttributes','filters','intersection','fields','attributes','length','includeAll','merge','find','create','body','destroy','describe','addMessage','ids','omit','findOne','SmsMessage','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','include','addTags','spread','Tag','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','format','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Messages','secret','read'];(function(_0x5b2461,_0x4797cf){var _0x4319d3=function(_0x516cd4){while(--_0x516cd4){_0x5b2461['push'](_0x5b2461['shift']());}};_0x4319d3(++_0x4797cf);}(_0x31db,0x1ee));var _0xb31d=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0x31db[_0x513545];return _0x18b7c5;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xb31d('0x0'));var moment=require(_0xb31d('0x1'));var BPromise=require(_0xb31d('0x2'));var util=require('util');var path=require(_0xb31d('0x3'));var ejs=require(_0xb31d('0x4'));var fs=require('fs');var _=require(_0xb31d('0x5'));var Redis=require(_0xb31d('0x6'));var interaction=require(_0xb31d('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xb31d('0x8'))(_0xb31d('0x9'));var config=require('../../config/environment');var db=require(_0xb31d('0xa'))['db'];config[_0xb31d('0xb')]=_[_0xb31d('0xc')](config['redis'],{'host':_0xb31d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb31d('0xb')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x15e416,_0x1ccf94){_0x1ccf94=_0x1ccf94||0xcc;return function(_0x94ac58){if(_0x94ac58){return _0x15e416[_0xb31d('0xe')](_0x1ccf94);}return _0x15e416[_0xb31d('0xf')](_0x1ccf94)['end']();};}function respondWithResult(_0x1b41c8,_0x587484){_0x587484=_0x587484||0xc8;return function(_0x2fdba1){if(_0x2fdba1){return _0x1b41c8[_0xb31d('0xf')](_0x587484)['json'](_0x2fdba1);}};}function respondWithFilteredResult(_0x1145c9,_0x4e3821){return function(_0x2812f3){if(_0x2812f3){var _0x3acf4a=typeof _0x4e3821[_0xb31d('0x10')]===_0xb31d('0x11')&&typeof _0x4e3821[_0xb31d('0x12')]==='undefined';var _0x104229=_0x2812f3[_0xb31d('0x13')];var _0x1554b3=_0x3acf4a?0x0:_0x4e3821[_0xb31d('0x10')];var _0x1d56c0=_0x3acf4a?_0x2812f3[_0xb31d('0x13')]:_0x4e3821[_0xb31d('0x10')]+_0x4e3821[_0xb31d('0x12')];var _0x465b71;if(_0x1d56c0>=_0x104229){_0x1d56c0=_0x104229;_0x465b71=0xc8;}else{_0x465b71=0xce;}_0x1145c9[_0xb31d('0xf')](_0x465b71);return _0x1145c9[_0xb31d('0x14')](_0xb31d('0x15'),_0x1554b3+'-'+_0x1d56c0+'/'+_0x104229)[_0xb31d('0x16')](_0x2812f3);}return null;};}function saveUpdates(_0x891a91){return function(_0x4d911a){if(_0x4d911a){return _0x4d911a[_0xb31d('0x17')](_0x891a91)['then'](function(_0x5b941a){return _0x5b941a;});}return null;};}function removeEntity(_0x122474){return function(_0x487072){if(_0x487072){return _0x487072['destroy']()[_0xb31d('0x18')](function(){_0x122474[_0xb31d('0xf')](0xcc)[_0xb31d('0x19')]();});}};}function handleEntityNotFound(_0x14ba34){return function(_0x25538e){if(!_0x25538e){_0x14ba34[_0xb31d('0xe')](0x194);}return _0x25538e;};}function handleError(_0x3d8726,_0x383d04){_0x383d04=_0x383d04||0x1f4;return function(_0x1f3101){logger['error'](_0x1f3101['stack']);if(_0x1f3101['name']){delete _0x1f3101[_0xb31d('0x1a')];}_0x3d8726['status'](_0x383d04)[_0xb31d('0x1b')](_0x1f3101);};}exports[_0xb31d('0x1c')]=function(_0x4f6dd6,_0x37aae9){var _0x1dc804={};var _0x56de13=_[_0xb31d('0x1d')](db[_0xb31d('0x1e')]['rawAttributes'],function(_0x30efd8){return{'name':_0x30efd8[_0xb31d('0x1f')],'type':_0x30efd8[_0xb31d('0x20')]['key']};});_0x1dc804=qs[_0xb31d('0x21')](_0x56de13,_0x4f6dd6);return interaction[_0xb31d('0x22')](_0xb31d('0x23'),_0x4f6dd6[_0xb31d('0x24')],_0x4f6dd6[_0xb31d('0x25')],_0x1dc804,_0x56de13)[_0xb31d('0x18')](respondWithFilteredResult(_0x37aae9,_0x1dc804))[_0xb31d('0x26')](handleError(_0x37aae9,null));};exports['show']=function(_0x44bb52,_0x322248){var _0x1f3474={'raw':![],'where':{'id':_0x44bb52[_0xb31d('0x27')]['id']}},_0x368b02={};_0x368b02[_0xb31d('0x28')]=_[_0xb31d('0x29')](db[_0xb31d('0x1e')][_0xb31d('0x2a')]);_0x368b02['query']=_['keys'](_0x44bb52[_0xb31d('0x24')]);_0x368b02[_0xb31d('0x2b')]=_[_0xb31d('0x2c')](_0x368b02[_0xb31d('0x28')],_0x368b02[_0xb31d('0x24')]);_0x1f3474['attributes']=_['intersection'](_0x368b02['model'],qs[_0xb31d('0x2d')](_0x44bb52[_0xb31d('0x24')][_0xb31d('0x2d')]));_0x1f3474[_0xb31d('0x2e')]=_0x1f3474[_0xb31d('0x2e')][_0xb31d('0x2f')]?_0x1f3474[_0xb31d('0x2e')]:_0x368b02[_0xb31d('0x28')];if(_0x44bb52['query'][_0xb31d('0x30')]){_0x1f3474['include']=[{'all':!![]}];}_0x1f3474=_[_0xb31d('0x31')]({},_0x1f3474,_0x44bb52['options']);return db[_0xb31d('0x1e')][_0xb31d('0x32')](_0x1f3474)[_0xb31d('0x18')](handleEntityNotFound(_0x322248,null))[_0xb31d('0x18')](respondWithResult(_0x322248,null))['catch'](handleError(_0x322248,null));};exports['create']=function(_0x40d414,_0x13d56a){return db['SmsInteraction'][_0xb31d('0x33')](_0x40d414[_0xb31d('0x34')],{})['then'](respondWithResult(_0x13d56a,0xc9))['catch'](handleError(_0x13d56a,null));};exports['update']=function(_0x2e1ec9,_0x15b5d3){if(_0x2e1ec9[_0xb31d('0x34')]['id']){delete _0x2e1ec9[_0xb31d('0x34')]['id'];}return db[_0xb31d('0x1e')]['find']({'where':{'id':_0x2e1ec9[_0xb31d('0x27')]['id']}})['then'](handleEntityNotFound(_0x15b5d3,null))[_0xb31d('0x18')](saveUpdates(_0x2e1ec9[_0xb31d('0x34')],null))[_0xb31d('0x18')](respondWithResult(_0x15b5d3,null))['catch'](handleError(_0x15b5d3,null));};exports[_0xb31d('0x35')]=function(_0x418bc8,_0x24b521){return db[_0xb31d('0x1e')][_0xb31d('0x32')]({'where':{'id':_0x418bc8[_0xb31d('0x27')]['id']}})[_0xb31d('0x18')](handleEntityNotFound(_0x24b521,null))[_0xb31d('0x18')](removeEntity(_0x24b521,null))[_0xb31d('0x26')](handleError(_0x24b521,null));};exports[_0xb31d('0x36')]=function(_0xd07337,_0x2a3f98){return db[_0xb31d('0x1e')][_0xb31d('0x36')]()['then'](respondWithResult(_0x2a3f98,null))[_0xb31d('0x26')](handleError(_0x2a3f98,null));};exports[_0xb31d('0x37')]=function(_0x159567,_0x43b182){return db['SmsMessage'][_0xb31d('0x32')]({'where':{'id':_0x159567[_0xb31d('0x27')]['id']}})[_0xb31d('0x18')](handleEntityNotFound(_0x43b182,null))['then'](function(_0x5c5c71){if(_0x5c5c71){return _0x5c5c71['addMessage'](_0x159567[_0xb31d('0x34')][_0xb31d('0x38')],_[_0xb31d('0x39')](_0x159567[_0xb31d('0x34')],[_0xb31d('0x38'),'id'])||{});}})[_0xb31d('0x18')](respondWithResult(_0x43b182,null))[_0xb31d('0x26')](handleError(_0x43b182,null));};exports['getMessages']=function(_0xfdcae9,_0xe8db15){var _0x2031d9={'raw':![],'where':{}};var _0x29d3d6={};var _0x27df11={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xb31d('0x3a')]({'where':{'id':_0xfdcae9[_0xb31d('0x27')]['id']}})[_0xb31d('0x18')](handleEntityNotFound(_0xe8db15,null))[_0xb31d('0x18')](function(_0x253d43){if(_0x253d43){_0x29d3d6[_0xb31d('0x28')]=_['keys'](db[_0xb31d('0x3b')]['rawAttributes']);_0x29d3d6[_0xb31d('0x24')]=_[_0xb31d('0x29')](_0xfdcae9['query']);_0x29d3d6[_0xb31d('0x2b')]=_[_0xb31d('0x2c')](_0x29d3d6['model'],_0x29d3d6['query']);_0x2031d9[_0xb31d('0x2e')]=_[_0xb31d('0x2c')](_0x29d3d6[_0xb31d('0x28')],qs[_0xb31d('0x2d')](_0xfdcae9[_0xb31d('0x24')]['fields']));_0x2031d9[_0xb31d('0x2e')]=_0x2031d9['attributes'][_0xb31d('0x2f')]?_0x2031d9[_0xb31d('0x2e')]:_0x29d3d6['model'];if(!_0xfdcae9[_0xb31d('0x24')][_0xb31d('0x3c')](_0xb31d('0x3d'))){_0x2031d9[_0xb31d('0x12')]=qs[_0xb31d('0x12')](_0xfdcae9[_0xb31d('0x24')][_0xb31d('0x12')]);_0x2031d9[_0xb31d('0x10')]=qs[_0xb31d('0x10')](_0xfdcae9[_0xb31d('0x24')]['offset']);}_0x2031d9[_0xb31d('0x3e')]=qs['sort'](_0xfdcae9['query'][_0xb31d('0x3f')]);_0x2031d9['where']=qs[_0xb31d('0x2b')](_['pick'](_0xfdcae9[_0xb31d('0x24')],_0x29d3d6[_0xb31d('0x2b')]));_0x2031d9[_0xb31d('0x40')][_0xb31d('0x41')]=_0x253d43['id'];if(_0xfdcae9['query'][_0xb31d('0x42')]){_0x2031d9[_0xb31d('0x40')]=_['merge'](_0x2031d9[_0xb31d('0x40')],{'$or':_['map'](_0x2031d9[_0xb31d('0x2e')],function(_0x36c97c){var _0x5c164d={};_0x5c164d[_0x36c97c]={'$like':'%'+_0xfdcae9[_0xb31d('0x24')]['filter']+'%'};return _0x5c164d;})});}if(_0xfdcae9['query'][_0xb31d('0x43')]){var _0x37155b=_0xfdcae9['query'][_0xb31d('0x43')]['split'](',');var _0x35e4d3={};_0x35e4d3[_0x37155b[0x0]]={'$gte':moment(_0x37155b[0x1])['format'](_0xb31d('0x44'))};_0x2031d9[_0xb31d('0x40')]=_[_0xb31d('0x31')](_0x2031d9[_0xb31d('0x40')],_0x35e4d3);}_0x2031d9=_['merge']({},_0x2031d9,_0xfdcae9[_0xb31d('0x45')]);return db['SmsMessage'][_0xb31d('0x13')]({'where':_0x2031d9['where']})[_0xb31d('0x18')](function(_0x290ee4){_0x27df11[_0xb31d('0x13')]=_0x290ee4;if(_0xfdcae9[_0xb31d('0x24')][_0xb31d('0x30')]){_0x2031d9[_0xb31d('0x46')]=[{'all':!![]}];}return db[_0xb31d('0x3b')][_0xb31d('0x22')](_0x2031d9);})[_0xb31d('0x18')](function(_0x6f7a40){_0x27df11['rows']=_0x6f7a40;return _0x27df11;});}})[_0xb31d('0x18')](respondWithFilteredResult(_0xe8db15,_0x2031d9))[_0xb31d('0x26')](handleError(_0xe8db15,null));};exports[_0xb31d('0x47')]=function(_0x343e72,_0x59b239){return db[_0xb31d('0x1e')]['find']({'where':{'id':_0x343e72[_0xb31d('0x27')]['id']}})[_0xb31d('0x18')](handleEntityNotFound(_0x59b239,null))[_0xb31d('0x18')](function(_0x42304a){if(_0x42304a){return _0x42304a['setTags'](_0x343e72['body'][_0xb31d('0x38')],_[_0xb31d('0x39')](_0x343e72['body'],[_0xb31d('0x38'),'id'])||{})[_0xb31d('0x48')](function(){return db[_0xb31d('0x49')][_0xb31d('0x22')]({'attributes':['id',_0xb31d('0x1a'),'color'],'where':{'id':_0x343e72[_0xb31d('0x34')][_0xb31d('0x38')]}});})['then'](function(_0x9f159e){socket['emit'](_0xb31d('0x4a'),{'id':Number(_0x343e72[_0xb31d('0x27')]['id']),'tags':_0x9f159e||[]});return{'id':Number(_0x343e72[_0xb31d('0x27')]['id']),'tags':_0x9f159e||[]};});}})['then'](respondWithResult(_0x59b239,null))[_0xb31d('0x26')](handleError(_0x59b239,null));};exports[_0xb31d('0x4b')]=function(_0x5e38cf,_0x597618){return db['SmsInteraction'][_0xb31d('0x32')]({'where':{'id':_0x5e38cf['params']['id']}})['then'](handleEntityNotFound(_0x597618,null))[_0xb31d('0x18')](function(_0x287055){if(_0x287055){return _0x287055[_0xb31d('0x4b')](_0x5e38cf[_0xb31d('0x24')][_0xb31d('0x38')]);}})[_0xb31d('0x18')](respondWithStatusCode(_0x597618,null))[_0xb31d('0x26')](handleError(_0x597618,null));};exports[_0xb31d('0x4c')]=function(_0x5aa831,_0x1fb898){var _0x394753=moment()[_0xb31d('0x4d')]()[_0xb31d('0x4e')]();var _0x1d78ea=path[_0xb31d('0x4f')](config[_0xb31d('0x50')],_0xb31d('0x51'),_0xb31d('0x52'),_0xb31d('0x53'));var _0x2e7ece=path[_0xb31d('0x4f')](_0x1d78ea,_0x394753);var _0x5798fe=util[_0xb31d('0x54')](_0xb31d('0x55'),_0x5aa831[_0xb31d('0x27')]['id'],_0x394753);var _0x3a628b=path[_0xb31d('0x4f')](_0x1d78ea,_0x5798fe);var _0x59f562=[];_0x59f562['push']({'model':db['User'],'as':_0xb31d('0x56'),'attributes':['id',_0xb31d('0x57')],'raw':!![]});_0x59f562[_0xb31d('0x58')]({'model':db[_0xb31d('0x59')],'as':_0xb31d('0x5a'),'attributes':['id',_0xb31d('0x5b'),_0xb31d('0x5c')],'raw':!![]});var _0x5dfbdc=[{'model':db[_0xb31d('0x3b')],'as':_0xb31d('0x5d'),'attributes':['id','body','createdAt','direction',_0xb31d('0x5e'),_0xb31d('0x5f')],'include':_0x59f562}];_0x5dfbdc[_0xb31d('0x58')]({'model':db[_0xb31d('0x60')],'as':_0xb31d('0x61'),'attributes':['id',_0xb31d('0x1a')]});_0x5dfbdc[_0xb31d('0x58')]({'model':db[_0xb31d('0x56')],'as':_0xb31d('0x62'),'attributes':['id',_0xb31d('0x57')]});return db[_0xb31d('0x1e')][_0xb31d('0x32')]({'where':{'id':_0x5aa831['params']['id']},'include':_0x5dfbdc})[_0xb31d('0x18')](handleEntityNotFound(_0x1fb898,null))[_0xb31d('0x18')](function(_0x5dcdbc){if(_0x5dcdbc){var _0x35c60d=_0x5dcdbc[_0xb31d('0x63')]({'plain':!![]});fs[_0xb31d('0x64')](_0x2e7ece);var _0x4a5f47={'channel':'Sms','account':_0x35c60d[_0xb31d('0x61')]['name'],'agent':_0x35c60d[_0xb31d('0x62')]?_0x35c60d['Owner'][_0xb31d('0x57')]:_0xb31d('0x65'),'createdAt':moment(_0x35c60d[_0xb31d('0x66')])[_0xb31d('0x54')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb31d('0x4e')](),'closedAt':_0x35c60d[_0xb31d('0x67')]?moment(_0x35c60d[_0xb31d('0x68')])[_0xb31d('0x54')](_0xb31d('0x44'))[_0xb31d('0x4e')]():'','disposition':_0x35c60d['disposition'],'messages':_(_0x35c60d['Messages'])[_0xb31d('0x42')]({'secret':![]})[_0xb31d('0x1d')](function(_0x307d47){return{'date':moment(_0x307d47[_0xb31d('0x66')])['format'](_0xb31d('0x44'))[_0xb31d('0x4e')](),'sender':_0x307d47[_0xb31d('0x69')]===_0xb31d('0x6a')?_0x307d47[_0xb31d('0x56')]?_0x307d47['User'][_0xb31d('0x57')]:_0xb31d('0x6b'):_0x307d47[_0xb31d('0x5a')][_0xb31d('0x5b')]+(_0x307d47[_0xb31d('0x5a')][_0xb31d('0x5c')]?'\x20'+_0x307d47[_0xb31d('0x5a')][_0xb31d('0x5c')]:''),'body':_0x307d47[_0xb31d('0x34')],'direction':_0x307d47['direction']==='out'?'A':'C','secret':_0x307d47[_0xb31d('0x5e')],'read':_0x307d47[_0xb31d('0x5f')]};})[_0xb31d('0x6c')]()};return ejs[_0xb31d('0x6d')](path['join'](config[_0xb31d('0x50')],_0xb31d('0x51'),'views',_0xb31d('0x6e')),{'interaction':_0x4a5f47})[_0xb31d('0x18')](function(_0x9d559e){var _0x54b71a=path[_0xb31d('0x4f')](_0x2e7ece,_0xb31d('0x6f')+_0x35c60d['id']+'-'+_0x394753+_0xb31d('0x70'));var _0x392bd3={'path':_0x54b71a,'channel':_0xb31d('0x71'),'interactionId':_0x35c60d['id']};return pdf[_0xb31d('0x72')](_0x9d559e,_0x392bd3);})['then'](function(){return new BPromise(function(_0x1d0a93,_0x57a78d){zipdir(_0x2e7ece,{'saveTo':_0x3a628b},function(_0x2a9643,_0x531abd){if(_0x2a9643)return _0x57a78d(_0x2a9643);return _0x1d0a93(_0x531abd);});})['then'](function(){return new BPromise(function(_0xb2b0ce,_0x1b41f0){rimraf(_0x2e7ece,function(_0x18dafd){if(_0x18dafd)_0x1b41f0(_0x18dafd);return _0xb2b0ce();});});})[_0xb31d('0x18')](function(){return _0x1fb898['download'](_0x3a628b,_0x5798fe,function(_0xb93c26){if(_0xb93c26){console[_0xb31d('0x73')](_0xb31d('0x74'),_0xb93c26);}else{fs[_0xb31d('0x75')](_0x3a628b);}});});});}else{return _0x1fb898[_0xb31d('0xe')](0xc8);}})[_0xb31d('0x26')](handleError(_0x1fb898,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index adf09bb..d312e58 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(_0x5e76fc,_0x5ca668){var _0xbab0af=function(_0x50ad2e){while(--_0x50ad2e){_0x5e76fc['push'](_0x5e76fc['shift']());}};_0xbab0af(++_0x5ca668);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x59bd5a,_0x4ef258){_0x59bd5a=_0x59bd5a-0x0;var _0x6af313=_0x4e2e[_0x59bd5a];return _0x6af313;};'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 _0x0b0e=['update','remove','getUsers','then','Users','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','SmsMessage','setMaxListeners','save'];(function(_0x3c82e2,_0x2bff81){var _0x1317b8=function(_0x23694b){while(--_0x23694b){_0x3c82e2['push'](_0x3c82e2['shift']());}};_0x1317b8(++_0x2bff81);}(_0x0b0e,0x187));var _0xe0b0=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x0b0e[_0x36c6eb];return _0x30675b;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xe0b0('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0xe0b0('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe0b0('0x3')](0x0);var events={'afterCreate':_0xe0b0('0x4'),'afterUpdate':_0xe0b0('0x5'),'afterDestroy':_0xe0b0('0x6')};function emitEvent(_0x38a058){return function(_0x399e67,_0x185efa,_0x30e20d){_0x399e67[_0xe0b0('0x7')]({'attributes':['id'],'raw':!![]})[_0xe0b0('0x8')](function(_0x5cf9cc){_0x399e67['setDataValue'](_0xe0b0('0x9'),_0x5cf9cc[_0xe0b0('0xa')](function(_0xc4a085){return{'id':_0xc4a085['id']};}));return SmsMessage[_0xe0b0('0xb')]({'where':{'SmsInteractionId':_0x399e67['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x338e7c){_0x399e67[_0xe0b0('0xc')]('unreadMessages',_0x338e7c[_0xe0b0('0xd')]);SmsInteractionEvents[_0xe0b0('0xe')](_0x38a058+':'+_0x399e67['id'],_0x399e67);SmsInteractionEvents['emit'](_0x38a058,_0x399e67);_0x30e20d(null);})[_0xe0b0('0xf')](_0x30e20d(null));};}for(var e in events){if(events[_0xe0b0('0x10')](e)){var event=events[e];SmsInteraction[_0xe0b0('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 564ed98..9d42cdd 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 _0x894d=['moment','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x40b3e3,_0x1a1972){var _0x59f3d3=function(_0x12d6cf){while(--_0x12d6cf){_0x40b3e3['push'](_0x40b3e3['shift']());}};_0x59f3d3(++_0x1a1972);}(_0x894d,0xfc));var _0xd894=function(_0x2072a7,_0x286fbe){_0x2072a7=_0x2072a7-0x0;var _0x572539=_0x894d[_0x2072a7];return _0x572539;};'use strict';var _=require(_0xd894('0x0'));var util=require(_0xd894('0x1'));var logger=require(_0xd894('0x2'))('api');var moment=require(_0xd894('0x3'));var BPromise=require(_0xd894('0x4'));var rp=require(_0xd894('0x5'));var fs=require('fs');var path=require(_0xd894('0x6'));var rimraf=require(_0xd894('0x7'));var config=require('../../config/environment');var attributes=require(_0xd894('0x8'));module[_0xd894('0x9')]=function(_0x257b9b,_0x2a86ad){return _0x257b9b[_0xd894('0xa')]('SmsInteraction',attributes,{'tableName':_0xd894('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2cc10b,_0x1e590f,_0xd1d8fb){if(_0x2cc10b[_0xd894('0xc')](_0xd894('0xd'))){_0x2cc10b[_0xd894('0xe')]=moment()[_0xd894('0xf')](_0xd894('0x10'));}_0xd1d8fb(null,_0x2cc10b);}}});}; \ No newline at end of file +var _0xc5c7=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x69a748,_0x7e2ee1){var _0x116db0=function(_0x67e3ab){while(--_0x67e3ab){_0x69a748['push'](_0x69a748['shift']());}};_0x116db0(++_0x7e2ee1);}(_0xc5c7,0x142));var _0x7c5c=function(_0x3b5110,_0x4e6caf){_0x3b5110=_0x3b5110-0x0;var _0x449383=_0xc5c7[_0x3b5110];return _0x449383;};'use strict';var _=require(_0x7c5c('0x0'));var util=require(_0x7c5c('0x1'));var logger=require(_0x7c5c('0x2'))('api');var moment=require(_0x7c5c('0x3'));var BPromise=require('bluebird');var rp=require(_0x7c5c('0x4'));var fs=require('fs');var path=require(_0x7c5c('0x5'));var rimraf=require(_0x7c5c('0x6'));var config=require(_0x7c5c('0x7'));var attributes=require(_0x7c5c('0x8'));module[_0x7c5c('0x9')]=function(_0x320acc,_0x183a2a){return _0x320acc[_0x7c5c('0xa')](_0x7c5c('0xb'),attributes,{'tableName':_0x7c5c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1873ae,_0x22fb06,_0x132229){if(_0x1873ae['changed'](_0x7c5c('0xd'))){_0x1873ae[_0x7c5c('0xe')]=moment()[_0x7c5c('0xf')](_0x7c5c('0x10'));}_0x132229(null,_0x1873ae);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index f8e357a..304b9ec 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 _0x6674=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','then','AddTagsToSmsInteraction','ids','spread','lodash','util'];(function(_0x4383f7,_0x74939d){var _0x42b586=function(_0x10cd7d){while(--_0x10cd7d){_0x4383f7['push'](_0x4383f7['shift']());}};_0x42b586(++_0x74939d);}(_0x6674,0xfa));var _0x4667=function(_0x2cdda0,_0x588eb9){_0x2cdda0=_0x2cdda0-0x0;var _0x825dea=_0x6674[_0x2cdda0];return _0x825dea;};'use strict';var _=require(_0x4667('0x0'));var util=require(_0x4667('0x1'));var moment=require(_0x4667('0x2'));var BPromise=require(_0x4667('0x3'));var rs=require(_0x4667('0x4'));var fs=require('fs');var Redis=require(_0x4667('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4667('0x6'));var config=require(_0x4667('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4667('0x8')]=_[_0x4667('0x9')](config[_0x4667('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x4667('0xa'))(new Redis(config['redis']));require(_0x4667('0xb'))[_0x4667('0xc')](socket);function respondWithRpcPromise(_0x3ea035,_0x554ac2,_0x2eb8af){return new BPromise(function(_0x969321,_0x44b460){return client[_0x4667('0xd')](_0x3ea035,_0x2eb8af)['then'](function(_0x474d24){logger[_0x4667('0xe')](_0x4667('0xf'),_0x554ac2,_0x4667('0x10'));logger[_0x4667('0x11')](_0x4667('0x12'),_0x554ac2,_0x4667('0x10'),JSON[_0x4667('0x13')](_0x474d24));if(_0x474d24['error']){if(_0x474d24[_0x4667('0x14')]['code']===0x1f4){logger[_0x4667('0x14')](_0x4667('0xf'),_0x554ac2,_0x474d24[_0x4667('0x14')][_0x4667('0x15')]);return _0x44b460(_0x474d24[_0x4667('0x14')]['message']);}logger[_0x4667('0x14')](_0x4667('0xf'),_0x554ac2,_0x474d24['error'][_0x4667('0x15')]);return _0x969321(_0x474d24[_0x4667('0x14')]['message']);}else{logger[_0x4667('0xe')](_0x4667('0xf'),_0x554ac2,_0x4667('0x10'));_0x969321(_0x474d24[_0x4667('0x16')][_0x4667('0x15')]);}})[_0x4667('0x17')](function(_0x2de8b7){logger[_0x4667('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x554ac2,_0x2de8b7);_0x44b460(_0x2de8b7);});});}exports[_0x4667('0x18')]=function(_0x297e96){var _0x2c65d7=this;return new Promise(function(_0x54d0e7,_0x5c9301){return db[_0x4667('0x19')]['update'](_0x297e96[_0x4667('0x1a')],{'raw':_0x297e96[_0x4667('0x1b')]?_0x297e96[_0x4667('0x1b')][_0x4667('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x297e96[_0x4667('0x1b')]?_0x297e96['options'][_0x4667('0x1d')]||null:null,'attributes':_0x297e96['options']?_0x297e96['options'][_0x4667('0x1e')]||null:null,'limit':_0x297e96[_0x4667('0x1b')]?_0x297e96[_0x4667('0x1b')][_0x4667('0x1f')]||null:null})[_0x4667('0x20')](function(_0x337da4){logger[_0x4667('0xe')](_0x4667('0x18'),_0x297e96);logger[_0x4667('0x11')](_0x4667('0x18'),_0x297e96,JSON[_0x4667('0x13')](_0x337da4));_0x54d0e7(_0x337da4);})[_0x4667('0x17')](function(_0x5212a7){logger[_0x4667('0x14')](_0x4667('0x18'),_0x5212a7['message'],_0x297e96);_0x5c9301(_0x2c65d7[_0x4667('0x14')](0x1f4,_0x5212a7[_0x4667('0x15')]));});});};exports[_0x4667('0x21')]=function(_0x2c41fb){return new Promise(function(_0x3d5f06,_0x4df42f){return db[_0x4667('0x19')]['find']({'where':_0x2c41fb[_0x4667('0x1b')]?_0x2c41fb[_0x4667('0x1b')][_0x4667('0x1d')]||null:null})[_0x4667('0x20')](function(_0x4e236f){if(_0x4e236f){return _0x4e236f['addTags'](_0x2c41fb[_0x4667('0x1a')][_0x4667('0x22')],_['omit'](_0x2c41fb[_0x4667('0x1a')],[_0x4667('0x22'),'id'])||{});}})[_0x4667('0x23')](function(_0x49cffc){logger[_0x4667('0xe')]('AddTags',_0x2c41fb);logger['debug']('AddTags',_0x2c41fb,JSON[_0x4667('0x13')](_0x49cffc));_0x3d5f06(_0x49cffc);})[_0x4667('0x17')](function(_0x284c2e){logger[_0x4667('0x14')]('AddTags',_0x284c2e['message'],_0x2c41fb);_0x4df42f(_this[_0x4667('0x14')](0x1f4,_0x284c2e[_0x4667('0x15')]));});});}; \ No newline at end of file +var _0x2c0f=['socket.io-emitter','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','code','message','error','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','raw','options','attributes','limit','AddTagsToSmsInteraction','find','where','then','addTags','ids','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x2c0f,0x11a));var _0xf2c0=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x2c0f[_0x5e709a];return _0x57401a;};'use strict';var _=require('lodash');var util=require(_0xf2c0('0x0'));var moment=require(_0xf2c0('0x1'));var BPromise=require('bluebird');var rs=require(_0xf2c0('0x2'));var fs=require('fs');var Redis=require(_0xf2c0('0x3'));var db=require(_0xf2c0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf2c0('0x5'))('rpc');var config=require(_0xf2c0('0x6'));var jayson=require(_0xf2c0('0x7'));var client=jayson[_0xf2c0('0x8')][_0xf2c0('0x9')]({'port':0x232a});config[_0xf2c0('0xa')]=_['defaults'](config[_0xf2c0('0xa')],{'host':_0xf2c0('0xb'),'port':0x18eb});var socket=require(_0xf2c0('0xc'))(new Redis(config[_0xf2c0('0xa')]));require('./smsInteraction.socket')[_0xf2c0('0xd')](socket);function respondWithRpcPromise(_0x56c02d,_0x971a4b,_0x5b0043){return new BPromise(function(_0x37e1ad,_0x36f402){return client[_0xf2c0('0xe')](_0x56c02d,_0x5b0043)['then'](function(_0x58258b){logger[_0xf2c0('0xf')](_0xf2c0('0x10'),_0x971a4b,_0xf2c0('0x11'));logger[_0xf2c0('0x12')](_0xf2c0('0x13'),_0x971a4b,'request\x20sent',JSON[_0xf2c0('0x14')](_0x58258b));if(_0x58258b['error']){if(_0x58258b['error'][_0xf2c0('0x15')]===0x1f4){logger['error'](_0xf2c0('0x10'),_0x971a4b,_0x58258b['error'][_0xf2c0('0x16')]);return _0x36f402(_0x58258b['error'][_0xf2c0('0x16')]);}logger['error'](_0xf2c0('0x10'),_0x971a4b,_0x58258b[_0xf2c0('0x17')]['message']);return _0x37e1ad(_0x58258b[_0xf2c0('0x17')]['message']);}else{logger[_0xf2c0('0xf')](_0xf2c0('0x10'),_0x971a4b,'request\x20sent');_0x37e1ad(_0x58258b[_0xf2c0('0x18')][_0xf2c0('0x16')]);}})[_0xf2c0('0x19')](function(_0x3d7e0d){logger[_0xf2c0('0x17')](_0xf2c0('0x10'),_0x971a4b,_0x3d7e0d);_0x36f402(_0x3d7e0d);});});}exports[_0xf2c0('0x1a')]=function(_0x1f32a4){var _0x3b00bf=this;return new Promise(function(_0x40f3cd,_0x392e09){return db[_0xf2c0('0x1b')][_0xf2c0('0x1c')](_0x1f32a4[_0xf2c0('0x1d')],{'raw':_0x1f32a4['options']?_0x1f32a4['options'][_0xf2c0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f32a4[_0xf2c0('0x1f')]?_0x1f32a4[_0xf2c0('0x1f')]['where']||null:null,'attributes':_0x1f32a4[_0xf2c0('0x1f')]?_0x1f32a4[_0xf2c0('0x1f')][_0xf2c0('0x20')]||null:null,'limit':_0x1f32a4[_0xf2c0('0x1f')]?_0x1f32a4[_0xf2c0('0x1f')][_0xf2c0('0x21')]||null:null})['then'](function(_0x158609){logger['info'](_0xf2c0('0x1a'),_0x1f32a4);logger[_0xf2c0('0x12')](_0xf2c0('0x1a'),_0x1f32a4,JSON[_0xf2c0('0x14')](_0x158609));_0x40f3cd(_0x158609);})[_0xf2c0('0x19')](function(_0x4f3870){logger['error']('UpdateSmsInteraction',_0x4f3870[_0xf2c0('0x16')],_0x1f32a4);_0x392e09(_0x3b00bf['error'](0x1f4,_0x4f3870['message']));});});};exports[_0xf2c0('0x22')]=function(_0x215b3b){return new Promise(function(_0x1a734b,_0xcd05c0){return db[_0xf2c0('0x1b')][_0xf2c0('0x23')]({'where':_0x215b3b[_0xf2c0('0x1f')]?_0x215b3b['options'][_0xf2c0('0x24')]||null:null})[_0xf2c0('0x25')](function(_0xfd9904){if(_0xfd9904){return _0xfd9904[_0xf2c0('0x26')](_0x215b3b[_0xf2c0('0x1d')][_0xf2c0('0x27')],_['omit'](_0x215b3b[_0xf2c0('0x1d')],['ids','id'])||{});}})[_0xf2c0('0x28')](function(_0x20e595){logger[_0xf2c0('0xf')](_0xf2c0('0x29'),_0x215b3b);logger[_0xf2c0('0x12')](_0xf2c0('0x29'),_0x215b3b,JSON[_0xf2c0('0x14')](_0x20e595));_0x1a734b(_0x20e595);})[_0xf2c0('0x19')](function(_0x5f17ae){logger[_0xf2c0('0x17')](_0xf2c0('0x29'),_0x5f17ae[_0xf2c0('0x16')],_0x215b3b);_0xcd05c0(_this[_0xf2c0('0x17')](0x1f4,_0x5f17ae[_0xf2c0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 18f3d60..2f0a160 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 _0x57cf=['save','remove','removeListener','register','length','./smsInteraction.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57cf,0xcb));var _0xf57c=function(_0x163cd0,_0x461c03){_0x163cd0=_0x163cd0-0x0;var _0x166213=_0x57cf[_0x163cd0];return _0x166213;};'use strict';var SmsInteractionEvents=require(_0xf57c('0x0'));var events=[_0xf57c('0x1'),_0xf57c('0x2'),'update'];function createListener(_0x32490d,_0x133780){return function(_0x391ef2){_0x133780['emit'](_0x32490d,_0x391ef2);};}function removeListener(_0x3f0638,_0x2c963b){return function(){SmsInteractionEvents[_0xf57c('0x3')](_0x3f0638,_0x2c963b);};}exports[_0xf57c('0x4')]=function(_0x128d3b){for(var _0x38697b=0x0,_0x546ae7=events[_0xf57c('0x5')];_0x38697b<_0x546ae7;_0x38697b++){var _0x4845b9=events[_0x38697b];var _0x123654=createListener('smsInteraction:'+_0x4845b9,_0x128d3b);SmsInteractionEvents['on'](_0x4845b9,_0x123654);}}; \ No newline at end of file +var _0x1cf6=['register','length','smsInteraction:','emit'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x1cf6,0x6b));var _0x61cf=function(_0x14b9d4,_0x8c8928){_0x14b9d4=_0x14b9d4-0x0;var _0x4aab01=_0x1cf6[_0x14b9d4];return _0x4aab01;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=['save','remove','update'];function createListener(_0x1155c2,_0x374f09){return function(_0x13483e){_0x374f09[_0x61cf('0x0')](_0x1155c2,_0x13483e);};}function removeListener(_0x5e54bd,_0x5baae1){return function(){SmsInteractionEvents['removeListener'](_0x5e54bd,_0x5baae1);};}exports[_0x61cf('0x1')]=function(_0x286813){for(var _0x1c0078=0x0,_0x35c94e=events[_0x61cf('0x2')];_0x1c0078<_0x35c94e;_0x1c0078++){var _0x5508b4=events[_0x1c0078];var _0x1cd65d=createListener(_0x61cf('0x3')+_0x5508b4,_0x286813);SmsInteractionEvents['on'](_0x5508b4,_0x1cd65d);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index ab554e7..60727db 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 _0x1777=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','accept','/:id/reject'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x1777,0x1e1));var _0x7177=function(_0x5d2953,_0x40ce03){_0x5d2953=_0x5d2953-0x0;var _0x30c1b9=_0x1777[_0x5d2953];return _0x30c1b9;};'use strict';var multer=require(_0x7177('0x0'));var util=require('util');var path=require(_0x7177('0x1'));var timeout=require(_0x7177('0x2'));var express=require('express');var router=express[_0x7177('0x3')]();var fs_extra=require(_0x7177('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7177('0x5'));var config=require(_0x7177('0x6'));var controller=require('./smsMessage.controller');router[_0x7177('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7177('0x7')]('/describe',auth[_0x7177('0x8')](),controller[_0x7177('0x9')]);router['get'](_0x7177('0xa'),auth[_0x7177('0x8')](),controller[_0x7177('0xb')]);router[_0x7177('0xc')]('/',auth[_0x7177('0x8')](),interaction[_0x7177('0xd')](_0x7177('0xe'),_0x7177('0xf')),controller[_0x7177('0x10')]);router[_0x7177('0xc')](_0x7177('0x11'),controller[_0x7177('0x12')]);router[_0x7177('0x13')](_0x7177('0xa'),auth[_0x7177('0x8')](),controller[_0x7177('0x14')]);router[_0x7177('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0x7177('0x15')]);router[_0x7177('0x13')](_0x7177('0x16'),auth[_0x7177('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x7177('0x8')](),controller['destroy']);module[_0x7177('0x17')]=router; \ No newline at end of file +var _0xec18=['show','tracked','smsmessage:create','create','post','/:id/status','status','put','/:id/accept','/:id/reject','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x44968e,_0x23bbcd){var _0x338ba5=function(_0x18d818){while(--_0x18d818){_0x44968e['push'](_0x44968e['shift']());}};_0x338ba5(++_0x23bbcd);}(_0xec18,0x12a));var _0x8ec1=function(_0x8721d0,_0x238f1b){_0x8721d0=_0x8721d0-0x0;var _0xf97ab6=_0xec18[_0x8721d0];return _0xf97ab6;};'use strict';var multer=require('multer');var util=require(_0x8ec1('0x0'));var path=require(_0x8ec1('0x1'));var timeout=require(_0x8ec1('0x2'));var express=require('express');var router=express[_0x8ec1('0x3')]();var fs_extra=require(_0x8ec1('0x4'));var auth=require(_0x8ec1('0x5'));var interaction=require(_0x8ec1('0x6'));var config=require(_0x8ec1('0x7'));var controller=require(_0x8ec1('0x8'));router[_0x8ec1('0x9')]('/',auth['isAuthenticated'](),controller[_0x8ec1('0xa')]);router[_0x8ec1('0x9')](_0x8ec1('0xb'),auth[_0x8ec1('0xc')](),controller['describe']);router['get'](_0x8ec1('0xd'),auth[_0x8ec1('0xc')](),controller[_0x8ec1('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x8ec1('0xf')]('sms',_0x8ec1('0x10')),controller[_0x8ec1('0x11')]);router[_0x8ec1('0x12')](_0x8ec1('0x13'),controller[_0x8ec1('0x14')]);router[_0x8ec1('0x15')](_0x8ec1('0xd'),auth['isAuthenticated'](),controller['update']);router['put'](_0x8ec1('0x16'),auth[_0x8ec1('0xc')](),controller['accept']);router[_0x8ec1('0x15')](_0x8ec1('0x17'),auth[_0x8ec1('0xc')](),controller['reject']);router[_0x8ec1('0x18')]('/:id',auth[_0x8ec1('0xc')](),controller[_0x8ec1('0x19')]);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 8fcf6b9..9b72130 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 _0x87d3=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x2bc56d,_0x14b02b){var _0x43d3f3=function(_0x374c78){while(--_0x374c78){_0x2bc56d['push'](_0x2bc56d['shift']());}};_0x43d3f3(++_0x14b02b);}(_0x87d3,0x86));var _0x387d=function(_0x532807,_0x92d7fd){_0x532807=_0x532807-0x0;var _0x40b83f=_0x87d3[_0x532807];return _0x40b83f;};'use strict';var Sequelize=require(_0x387d('0x0'));module[_0x387d('0x1')]={'body':{'type':Sequelize[_0x387d('0x2')](_0x387d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x387d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x387d('0x5')]('in','out'),'defaultValue':_0x387d('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x387d('0x7')]},'readAt':{'type':Sequelize[_0x387d('0x8')]},'secret':{'type':Sequelize[_0x387d('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x387d('0x2')]}}; \ No newline at end of file +var _0xc6bd=['out','STRING','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x1ea8e2,_0x2b68b1){var _0x121ead=function(_0x3c6ffb){while(--_0x3c6ffb){_0x1ea8e2['push'](_0x1ea8e2['shift']());}};_0x121ead(++_0x2b68b1);}(_0xc6bd,0x130));var _0xdc6b=function(_0xe441a6,_0x3459f6){_0xe441a6=_0xe441a6-0x0;var _0x5faec8=_0xc6bd[_0xe441a6];return _0x5faec8;};'use strict';var Sequelize=require(_0xdc6b('0x0'));module['exports']={'body':{'type':Sequelize[_0xdc6b('0x1')](_0xdc6b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdc6b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xdc6b('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xdc6b('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xdc6b('0x6')]},'secret':{'type':Sequelize[_0xdc6b('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdc6b('0x5')]},'providerResponse':{'type':Sequelize[_0xdc6b('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index be01f9b..fdc9166 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 _0xe797=['indexOf','sent','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./smsMessage.socket','register','client','http','request','then','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsMessage,\x20%s,\x20%s','message','info','catch','status','json','limit','undefined','count','offset','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','options','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','isNil','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','email','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','role','rejectMessage','ContactId','User','fullname','EventManager','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID'];(function(_0x4d88f6,_0x52f758){var _0x2041c8=function(_0x16f556){while(--_0x16f556){_0x4d88f6['push'](_0x4d88f6['shift']());}};_0x2041c8(++_0x52f758);}(_0xe797,0x12a));var _0x7e79=function(_0x2dd469,_0x356586){_0x2dd469=_0x2dd469-0x0;var _0x4dcb1b=_0xe797[_0x2dd469];return _0x4dcb1b;};'use strict';var emlformat=require(_0x7e79('0x0'));var rimraf=require(_0x7e79('0x1'));var zipdir=require(_0x7e79('0x2'));var jsonpatch=require(_0x7e79('0x3'));var rp=require(_0x7e79('0x4'));var moment=require(_0x7e79('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7e79('0x6'));var util=require(_0x7e79('0x7'));var path=require('path');var sox=require(_0x7e79('0x8'));var csv=require(_0x7e79('0x9'));var ejs=require(_0x7e79('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7e79('0xb'));var crypto=require(_0x7e79('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e79('0x9'));var querystring=require(_0x7e79('0xd'));var Papa=require(_0x7e79('0xe'));var Redis=require('ioredis');var authService=require(_0x7e79('0xf'));var qs=require(_0x7e79('0x10'));var as=require(_0x7e79('0x11'));var hardwareService=require(_0x7e79('0x12'));var logger=require(_0x7e79('0x13'))(_0x7e79('0x14'));var utils=require(_0x7e79('0x15'));var config=require(_0x7e79('0x16'));var licenseUtil=require(_0x7e79('0x17'));var db=require('../../mysqldb')['db'];config[_0x7e79('0x18')]=_['defaults'](config[_0x7e79('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x7e79('0x19'))(new Redis(config[_0x7e79('0x18')]));require(_0x7e79('0x1a'))[_0x7e79('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7e79('0x1c')][_0x7e79('0x1d')]({'port':0x232c});var client9002=jayson[_0x7e79('0x1c')][_0x7e79('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1bf6ef,_0xdabb80,_0x361560,_0x4e09b5){return new BPromise(function(_0x2ec0c7,_0x3bf2d3){var _0x36db1e=_0x4e09b5||client;return _0x36db1e[_0x7e79('0x1e')](_0x1bf6ef,_0x361560)[_0x7e79('0x1f')](function(_0x4c687b){logger['info']('SmsMessage,\x20%s,\x20%s',_0xdabb80,'request\x20sent');logger[_0x7e79('0x20')](_0x7e79('0x21'),_0xdabb80,_0x7e79('0x22'),JSON['stringify'](_0x4c687b));if(_0x4c687b[_0x7e79('0x23')]){if(_0x4c687b[_0x7e79('0x23')][_0x7e79('0x24')]===0x1f4){logger[_0x7e79('0x23')](_0x7e79('0x25'),_0xdabb80,_0x4c687b[_0x7e79('0x23')][_0x7e79('0x26')]);return _0x3bf2d3(_0x4c687b['error'][_0x7e79('0x26')]);}logger[_0x7e79('0x23')](_0x7e79('0x25'),_0xdabb80,_0x4c687b[_0x7e79('0x23')][_0x7e79('0x26')]);return _0x2ec0c7(_0x4c687b[_0x7e79('0x23')]['message']);}else{logger[_0x7e79('0x27')]('SmsMessage,\x20%s,\x20%s',_0xdabb80,_0x7e79('0x22'));_0x2ec0c7(_0x4c687b['result']['message']);}})[_0x7e79('0x28')](function(_0x67b3be){logger['error'](_0x7e79('0x25'),_0xdabb80,_0x67b3be);_0x3bf2d3(_0x67b3be);});});}function respondWithStatusCode(_0x9d987,_0x23b264){_0x23b264=_0x23b264||0xcc;return function(_0x423def){if(_0x423def){return _0x9d987['sendStatus'](_0x23b264);}return _0x9d987[_0x7e79('0x29')](_0x23b264)['end']();};}function respondWithResult(_0xb6c5b4,_0x21ded9){_0x21ded9=_0x21ded9||0xc8;return function(_0x153821){if(_0x153821){return _0xb6c5b4[_0x7e79('0x29')](_0x21ded9)[_0x7e79('0x2a')](_0x153821);}};}function respondWithFilteredResult(_0x595302,_0x3e7076){return function(_0xcbd3da){if(_0xcbd3da){var _0x3e8405=typeof _0x3e7076['offset']==='undefined'&&typeof _0x3e7076[_0x7e79('0x2b')]===_0x7e79('0x2c');var _0x5791d1=_0xcbd3da[_0x7e79('0x2d')];var _0x45209c=_0x3e8405?0x0:_0x3e7076['offset'];var _0x36a725=_0x3e8405?_0xcbd3da[_0x7e79('0x2d')]:_0x3e7076[_0x7e79('0x2e')]+_0x3e7076[_0x7e79('0x2b')];var _0x3a4504;if(_0x36a725>=_0x5791d1){_0x36a725=_0x5791d1;_0x3a4504=0xc8;}else{_0x3a4504=0xce;}_0x595302['status'](_0x3a4504);return _0x595302[_0x7e79('0x2f')]('Content-Range',_0x45209c+'-'+_0x36a725+'/'+_0x5791d1)[_0x7e79('0x2a')](_0xcbd3da);}return null;};}function patchUpdates(_0x6e61fa){return function(_0x760d0d){try{jsonpatch[_0x7e79('0x30')](_0x760d0d,_0x6e61fa,!![]);}catch(_0x1a12fa){return BPromise[_0x7e79('0x31')](_0x1a12fa);}return _0x760d0d[_0x7e79('0x32')]();};}function saveUpdates(_0x1df81b,_0x107145){return function(_0x187855){if(_0x187855){return _0x187855[_0x7e79('0x33')](_0x1df81b)[_0x7e79('0x1f')](function(_0x418dc8){return _0x418dc8;});}return null;};}function removeEntity(_0x4fdb8b,_0x56ac6c){return function(_0x3a7f69){if(_0x3a7f69){return _0x3a7f69[_0x7e79('0x34')]()[_0x7e79('0x1f')](function(){_0x4fdb8b[_0x7e79('0x29')](0xcc)[_0x7e79('0x35')]();});}};}function handleEntityNotFound(_0xb32896,_0x32d384){return function(_0x30c753){if(!_0x30c753){_0xb32896['sendStatus'](0x194);}return _0x30c753;};}function handleError(_0x34d436,_0x2a1651){_0x2a1651=_0x2a1651||0x1f4;return function(_0x223833){logger[_0x7e79('0x23')](_0x223833[_0x7e79('0x36')]);if(_0x223833[_0x7e79('0x37')]){delete _0x223833['name'];}_0x34d436['status'](_0x2a1651)[_0x7e79('0x38')](_0x223833);};}exports[_0x7e79('0x39')]=function(_0x16a845,_0x3c80ba){var _0x9e1881={},_0x304d87={},_0x4cc922={'count':0x0,'rows':[]};var _0x46ffab=_[_0x7e79('0x3a')](db[_0x7e79('0x3b')][_0x7e79('0x3c')],function(_0x582fcf){return{'name':_0x582fcf[_0x7e79('0x3d')],'type':_0x582fcf[_0x7e79('0x3e')]['key']};});_0x304d87[_0x7e79('0x3f')]=_[_0x7e79('0x3a')](_0x46ffab,'name');_0x304d87[_0x7e79('0x40')]=_[_0x7e79('0x41')](_0x16a845[_0x7e79('0x40')]);_0x304d87[_0x7e79('0x42')]=_[_0x7e79('0x43')](_0x304d87[_0x7e79('0x3f')],_0x304d87[_0x7e79('0x40')]);_0x9e1881[_0x7e79('0x44')]=_[_0x7e79('0x43')](_0x304d87[_0x7e79('0x3f')],qs['fields'](_0x16a845[_0x7e79('0x40')][_0x7e79('0x45')]));_0x9e1881[_0x7e79('0x44')]=_0x9e1881[_0x7e79('0x44')]['length']?_0x9e1881[_0x7e79('0x44')]:_0x304d87['model'];if(!_0x16a845[_0x7e79('0x40')][_0x7e79('0x46')]('nolimit')){_0x9e1881[_0x7e79('0x2b')]=qs['limit'](_0x16a845[_0x7e79('0x40')]['limit']);_0x9e1881[_0x7e79('0x2e')]=qs['offset'](_0x16a845['query'][_0x7e79('0x2e')]);}_0x9e1881[_0x7e79('0x47')]=qs[_0x7e79('0x48')](_0x16a845['query'][_0x7e79('0x48')]);_0x9e1881[_0x7e79('0x49')]=qs[_0x7e79('0x42')](_[_0x7e79('0x4a')](_0x16a845[_0x7e79('0x40')],_0x304d87[_0x7e79('0x42')]),_0x46ffab);if(_0x16a845[_0x7e79('0x40')][_0x7e79('0x4b')]){_0x9e1881[_0x7e79('0x49')]=_['merge'](_0x9e1881[_0x7e79('0x49')],{'$or':_[_0x7e79('0x3a')](_0x46ffab,function(_0x2527ff){if(_0x2527ff[_0x7e79('0x3e')]!=='VIRTUAL'){var _0x55c921={};_0x55c921[_0x2527ff[_0x7e79('0x37')]]={'$like':'%'+_0x16a845['query'][_0x7e79('0x4b')]+'%'};return _0x55c921;}})});}_0x9e1881=_[_0x7e79('0x4c')]({},_0x9e1881,_0x16a845['options']);var _0x269323={'where':_0x9e1881[_0x7e79('0x49')]};return db['SmsMessage']['count'](_0x269323)[_0x7e79('0x1f')](function(_0x4ff4e5){_0x4cc922[_0x7e79('0x2d')]=_0x4ff4e5;if(_0x16a845[_0x7e79('0x40')][_0x7e79('0x4d')]){_0x9e1881[_0x7e79('0x4e')]=[{'all':!![]}];}return db['SmsMessage'][_0x7e79('0x4f')](_0x9e1881);})[_0x7e79('0x1f')](function(_0x31c8f6){_0x4cc922[_0x7e79('0x50')]=_0x31c8f6;return _0x4cc922;})[_0x7e79('0x1f')](respondWithFilteredResult(_0x3c80ba,_0x9e1881))['catch'](handleError(_0x3c80ba,null));};exports[_0x7e79('0x51')]=function(_0x5ab4a5,_0x4f062c){var _0x3613c0={'raw':!![],'where':{'id':_0x5ab4a5[_0x7e79('0x52')]['id']}},_0x56d704={};_0x56d704[_0x7e79('0x3f')]=_[_0x7e79('0x41')](db[_0x7e79('0x3b')][_0x7e79('0x3c')]);_0x56d704[_0x7e79('0x40')]=_[_0x7e79('0x41')](_0x5ab4a5['query']);_0x56d704[_0x7e79('0x42')]=_[_0x7e79('0x43')](_0x56d704[_0x7e79('0x3f')],_0x56d704[_0x7e79('0x40')]);_0x3613c0[_0x7e79('0x44')]=_[_0x7e79('0x43')](_0x56d704['model'],qs[_0x7e79('0x45')](_0x5ab4a5[_0x7e79('0x40')][_0x7e79('0x45')]));_0x3613c0['attributes']=_0x3613c0[_0x7e79('0x44')]['length']?_0x3613c0['attributes']:_0x56d704['model'];if(_0x5ab4a5[_0x7e79('0x40')][_0x7e79('0x4d')]){_0x3613c0[_0x7e79('0x4e')]=[{'all':!![]}];}_0x3613c0=_[_0x7e79('0x4c')]({},_0x3613c0,_0x5ab4a5[_0x7e79('0x53')]);return db['SmsMessage'][_0x7e79('0x54')](_0x3613c0)['then'](handleEntityNotFound(_0x4f062c,null))[_0x7e79('0x1f')](respondWithResult(_0x4f062c,null))[_0x7e79('0x28')](handleError(_0x4f062c,null));};exports[_0x7e79('0x55')]=function(_0x9ede5,_0x3ebb47){return db['SmsMessage']['create'](_0x9ede5['body'],{})['then'](respondWithResult(_0x3ebb47,0xc9))['catch'](handleError(_0x3ebb47,null));};exports[_0x7e79('0x33')]=function(_0x108468,_0x2a7b1f){if(_0x108468['body']['id']){delete _0x108468[_0x7e79('0x56')]['id'];}return db[_0x7e79('0x3b')][_0x7e79('0x54')]({'where':{'id':_0x108468[_0x7e79('0x52')]['id']}})['then'](handleEntityNotFound(_0x2a7b1f,null))[_0x7e79('0x1f')](saveUpdates(_0x108468[_0x7e79('0x56')],null))[_0x7e79('0x1f')](respondWithResult(_0x2a7b1f,null))[_0x7e79('0x28')](handleError(_0x2a7b1f,null));};exports[_0x7e79('0x34')]=function(_0x421cca,_0x3d1ed9){return db['SmsMessage'][_0x7e79('0x54')]({'where':{'id':_0x421cca[_0x7e79('0x52')]['id']}})[_0x7e79('0x1f')](handleEntityNotFound(_0x3d1ed9,null))[_0x7e79('0x1f')](removeEntity(_0x3d1ed9,null))[_0x7e79('0x28')](handleError(_0x3d1ed9,null));};exports[_0x7e79('0x57')]=function(_0x5b2dbf,_0x3bdfe8){return db['SmsMessage'][_0x7e79('0x57')]()[_0x7e79('0x1f')](respondWithResult(_0x3bdfe8,null))[_0x7e79('0x28')](handleError(_0x3bdfe8,null));};var interaction_log=require('../../config/logger')(_0x7e79('0x58'));exports[_0x7e79('0x59')]=function(_0x40cae5,_0x5a89f0,_0x294eb4){var _0x4d208e={'agent':{},'channel':_0x7e79('0x5a')};if(_0x40cae5[_0x7e79('0x56')]['id']){delete _0x40cae5[_0x7e79('0x56')]['id'];}_0x40cae5[_0x7e79('0x56')][_0x7e79('0x5b')]=!![];_0x40cae5[_0x7e79('0x56')][_0x7e79('0x5c')]=moment()[_0x7e79('0x5d')](_0x7e79('0x5e'));_0x40cae5[_0x7e79('0x56')][_0x7e79('0x5f')]=_0x40cae5[_0x7e79('0x56')][_0x7e79('0x5f')]||_0x40cae5[_0x7e79('0x60')]['id'];_0x4d208e[_0x7e79('0x61')]['id']=_0x40cae5[_0x7e79('0x56')][_0x7e79('0x5f')];return db[_0x7e79('0x3b')][_0x7e79('0x54')]({'where':{'id':_0x40cae5['params']['id'],'UserId':null}})[_0x7e79('0x1f')](handleEntityNotFound(_0x5a89f0,null))['then'](saveUpdates(_0x40cae5['body'],null))[_0x7e79('0x1f')](function(_0x2fcbf1){if(_0x2fcbf1){_0x4d208e[_0x7e79('0x26')]=_0x2fcbf1['get']({'plain':!![]});return db[_0x7e79('0x62')]['find']({'where':{'id':_0x2fcbf1['SmsInteractionId']}});}return null;})[_0x7e79('0x1f')](handleEntityNotFound(_0x5a89f0,null))[_0x7e79('0x1f')](function(_0x2e27e9){if(_0x2e27e9){return _0x2e27e9[_0x7e79('0x33')]({'UserId':_0x40cae5['body'][_0x7e79('0x5f')],'read1stAt':_[_0x7e79('0x63')](_0x2e27e9[_0x7e79('0x64')])?moment()[_0x7e79('0x5d')](_0x7e79('0x5e')):undefined});}return null;})['then'](function(_0x49a5c9){if(_0x49a5c9){_0x4d208e[_0x7e79('0x65')]=_0x49a5c9[_0x7e79('0x66')]({'plain':!![]});interaction_log[_0x7e79('0x27')](_0x7e79('0x67'),_0x40cae5[_0x7e79('0x60')]['id'],_0x40cae5['user'][_0x7e79('0x37')],_0x40cae5['user']['role'],_0x4d208e['interaction']['id'],_0x40cae5[_0x7e79('0x56')]?JSON[_0x7e79('0x68')](_0x40cae5[_0x7e79('0x56')]):_0x7e79('0x69'));return respondWithRpcPromise('AcceptMessage',_0x7e79('0x6a'),_0x4d208e);}return null;})[_0x7e79('0x1f')](function(_0x49ece0){var _0x63e5bd=_0x7e79('0x6b')+_0x49ece0[_0x7e79('0x26')]['ContactId'];return db[_0x7e79('0x6c')][_0x7e79('0x40')](_0x63e5bd,{'type':db[_0x7e79('0x6d')][_0x7e79('0x6e')][_0x7e79('0x6f')],'raw':!![]})['then'](function(_0x1bd9ae){return _0x1bd9ae;});})[_0x7e79('0x1f')](function(_0x35073f){if(_0x35073f){_0x4d208e[_0x7e79('0x26')][_0x7e79('0x70')]=_0x35073f[0x0];if(!_0x40cae5[_0x7e79('0x56')]['UserId'])return;return db['User'][_0x7e79('0x54')]({'where':{'id':_0x40cae5[_0x7e79('0x56')]['UserId'],'role':_0x7e79('0x61')},'attributes':['id',_0x7e79('0x37'),'fullname',_0x7e79('0x71'),'internal'],'raw':!![]});}return null;})[_0x7e79('0x1f')](function(_0x3d4adb){if(!_0x3d4adb)return null;_0x4d208e[_0x7e79('0x26')]['agent']=_0x3d4adb;return _0x4d208e;})[_0x7e79('0x1f')](function(_0x360aa9){if(_0x360aa9){if(_0x40cae5[_0x7e79('0x56')][_0x7e79('0x72')]){_0x4d208e['message'][_0x7e79('0x73')]=util['format'](_0x7e79('0x74'),_0x40cae5[_0x7e79('0x60')][_0x7e79('0x37')]);_0x4d208e[_0x7e79('0x26')][_0x7e79('0x75')]=_0x4d208e['channel'];_0x4d208e[_0x7e79('0x26')][_0x7e79('0x76')]=_0x4d208e[_0x7e79('0x75')];_0x4d208e[_0x7e79('0x26')][_0x7e79('0x77')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0x7e79('0x78'),'message':_0x4d208e[_0x7e79('0x26')]},client9002)[_0x7e79('0x1f')](function(){return _0x4d208e;});}return _0x4d208e;}return null;})[_0x7e79('0x1f')](respondWithResult(_0x5a89f0,null))[_0x7e79('0x28')](handleError(_0x5a89f0,null));};var interaction_log=require(_0x7e79('0x13'))(_0x7e79('0x58'));exports[_0x7e79('0x31')]=function(_0x4e45f5,_0x331669,_0x4f1d2d){var _0x1e824f={'agent':{},'channel':_0x7e79('0x5a')};if(_0x4e45f5[_0x7e79('0x56')]['id']){delete _0x4e45f5[_0x7e79('0x56')]['id'];}_0x4e45f5[_0x7e79('0x56')][_0x7e79('0x5f')]=_0x4e45f5['body']['UserId']||_0x4e45f5[_0x7e79('0x60')]['id'];_0x1e824f[_0x7e79('0x61')]['id']=_0x4e45f5['body'][_0x7e79('0x5f')];return db[_0x7e79('0x3b')][_0x7e79('0x54')]({'where':{'id':_0x4e45f5['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x331669,null))[_0x7e79('0x1f')](function(_0xfb2ad5){if(_0xfb2ad5){_0x1e824f[_0x7e79('0x26')]=_0xfb2ad5[_0x7e79('0x66')]({'plain':!![]});return db[_0x7e79('0x62')][_0x7e79('0x54')]({'where':{'id':_0xfb2ad5['SmsInteractionId']}});}return null;})[_0x7e79('0x1f')](handleEntityNotFound(_0x331669,null))['then'](function(_0x4d204c){if(_0x4d204c){_0x1e824f[_0x7e79('0x65')]=_0x4d204c[_0x7e79('0x66')]({'plain':!![]});interaction_log[_0x7e79('0x27')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e45f5['user']['id'],_0x4e45f5[_0x7e79('0x60')]['name'],_0x4e45f5[_0x7e79('0x60')][_0x7e79('0x79')],_0x1e824f[_0x7e79('0x65')]['id'],_0x4e45f5[_0x7e79('0x56')]?JSON[_0x7e79('0x68')](_0x4e45f5[_0x7e79('0x56')]):_0x7e79('0x69'));return respondWithRpcPromise('RejectMessage',_0x7e79('0x7a'),_0x1e824f);}return null;})[_0x7e79('0x1f')](function(_0x554c77){var _0x187b7a=_0x7e79('0x6b')+_0x554c77[_0x7e79('0x26')][_0x7e79('0x7b')];return db[_0x7e79('0x6c')][_0x7e79('0x40')](_0x187b7a,{'type':db['Sequelize']['QueryTypes'][_0x7e79('0x6f')],'raw':!![]})[_0x7e79('0x1f')](function(_0x41cad6){return _0x41cad6;});})[_0x7e79('0x1f')](function(_0x4f7130){if(_0x4f7130){_0x1e824f[_0x7e79('0x26')][_0x7e79('0x70')]=_0x4f7130[0x0];if(!_0x4e45f5[_0x7e79('0x56')][_0x7e79('0x5f')])return;return db[_0x7e79('0x7c')][_0x7e79('0x54')]({'where':{'id':_0x4e45f5[_0x7e79('0x56')][_0x7e79('0x5f')],'role':_0x7e79('0x61')},'attributes':['id',_0x7e79('0x37'),_0x7e79('0x7d'),_0x7e79('0x71'),'internal'],'raw':!![]});}return null;})['then'](function(_0x5ae851){if(!_0x5ae851)return null;_0x1e824f[_0x7e79('0x26')]['agent']=_0x5ae851;return _0x1e824f;})[_0x7e79('0x1f')](function(_0x5b0683){if(_0x5b0683){_0x5b0683[_0x7e79('0x26')]['interface']=util['format'](_0x7e79('0x74'),_0x4e45f5['user']['name']);_0x5b0683['message'][_0x7e79('0x75')]=_0x1e824f[_0x7e79('0x75')];_0x5b0683['message'][_0x7e79('0x76')]=_0x1e824f[_0x7e79('0x75')];_0x5b0683[_0x7e79('0x26')][_0x7e79('0x77')]='reject';respondWithRpcPromise(_0x7e79('0x7e'),_0x7e79('0x7e'),{'event':_0x7e79('0x7f'),'message':_0x5b0683[_0x7e79('0x26')]},client9002);return _0x1e824f;}return null;})['then'](respondWithResult(_0x331669,null))[_0x7e79('0x28')](handleError(_0x331669,null));};exports[_0x7e79('0x29')]=function(_0x1f31d3,_0x3ce471,_0x1cdb8d){if(_0x1f31d3[_0x7e79('0x56')]['id']){delete _0x1f31d3[_0x7e79('0x56')]['id'];}var _0x8b6ed6;return db[_0x7e79('0x3b')][_0x7e79('0x54')]({'where':{'id':_0x1f31d3['params']['id']}})[_0x7e79('0x1f')](handleEntityNotFound(_0x3ce471,null))[_0x7e79('0x1f')](function(_0x28118d){if(_0x28118d){_0x8b6ed6=_0x28118d;return db[_0x7e79('0x80')][_0x7e79('0x54')]({'where':{'id':_0x28118d[_0x7e79('0x81')]}});}})[_0x7e79('0x1f')](handleEntityNotFound(_0x3ce471,null))[_0x7e79('0x1f')](function(_0x2fb9f9){if(_0x2fb9f9){logger[_0x7e79('0x20')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7e79('0x29'),_0x7e79('0x82'),_0x2fb9f9[_0x7e79('0x3e')],util['inspect'](_0x1f31d3[_0x7e79('0x56')],{'showHidden':![],'depth':null}));switch(_0x2fb9f9[_0x7e79('0x3e')]){case _0x7e79('0x83'):if(_0x1f31d3[_0x7e79('0x56')][_0x7e79('0x84')]&&_0x1f31d3['body']['MessageSid']===_0x8b6ed6[_0x7e79('0x85')]){return _0x8b6ed6['update']({'read':!![]});}else{logger[_0x7e79('0x23')](_0x7e79('0x86'),'status',_0x7e79('0x83'),util[_0x7e79('0x87')](_0x1f31d3['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x1f31d3['body'][_0x7e79('0x88')]&&_0x1f31d3[_0x7e79('0x56')][_0x7e79('0x88')]===_0x8b6ed6[_0x7e79('0x85')]&&_[_0x7e79('0x89')]([_0x7e79('0x8a'),'delivered'],_0x1f31d3[_0x7e79('0x56')][_0x7e79('0x8b')])>=0x0){return _0x8b6ed6[_0x7e79('0x33')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x7e79('0x8c'),util[_0x7e79('0x87')](_0x1f31d3[_0x7e79('0x56')],{'showHidden':![],'depth':null}));}break;case _0x7e79('0x8d'):var _0x2ae786=_0x1f31d3[_0x7e79('0x56')][_0x7e79('0x8e')][0x0];if(_0x2ae786['status'][_0x7e79('0x8f')]===_0x7e79('0x90')){return _0x8b6ed6[_0x7e79('0x33')]({'read':!![]});}else{logger[_0x7e79('0x23')](_0x7e79('0x86'),_0x7e79('0x29'),_0x7e79('0x8d'),util['inspect'](_0x1f31d3[_0x7e79('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x8b6ed6;}})[_0x7e79('0x1f')](respondWithResult(_0x3ce471,null))[_0x7e79('0x28')](handleError(_0x3ce471,null));}; \ No newline at end of file +var _0xbd3a=['[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','Sequelize','QueryTypes','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','sent','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','show','rawAttributes','includeAll','options','create','body','find','params','describe','sms-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt'];(function(_0x123b07,_0x4a951b){var _0x2ec433=function(_0x1db51e){while(--_0x1db51e){_0x123b07['push'](_0x123b07['shift']());}};_0x2ec433(++_0x4a951b);}(_0xbd3a,0xb9));var _0xabd3=function(_0x5d3c1b,_0x2b756a){_0x5d3c1b=_0x5d3c1b-0x0;var _0x2bc7d5=_0xbd3a[_0x5d3c1b];return _0x2bc7d5;};'use strict';var emlformat=require(_0xabd3('0x0'));var rimraf=require(_0xabd3('0x1'));var zipdir=require(_0xabd3('0x2'));var jsonpatch=require(_0xabd3('0x3'));var rp=require('request-promise');var moment=require(_0xabd3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xabd3('0x5'));var util=require('util');var path=require('path');var sox=require(_0xabd3('0x6'));var csv=require('to-csv');var ejs=require(_0xabd3('0x7'));var fs=require('fs');var fs_extra=require(_0xabd3('0x8'));var _=require(_0xabd3('0x9'));var squel=require(_0xabd3('0xa'));var crypto=require(_0xabd3('0xb'));var jsforce=require(_0xabd3('0xc'));var deskjs=require(_0xabd3('0xd'));var toCsv=require(_0xabd3('0xe'));var querystring=require(_0xabd3('0xf'));var Papa=require(_0xabd3('0x10'));var Redis=require(_0xabd3('0x11'));var authService=require(_0xabd3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xabd3('0x13'));var hardwareService=require(_0xabd3('0x14'));var logger=require(_0xabd3('0x15'))(_0xabd3('0x16'));var utils=require(_0xabd3('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xabd3('0x18'))['db'];config[_0xabd3('0x19')]=_[_0xabd3('0x1a')](config[_0xabd3('0x19')],{'host':_0xabd3('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xabd3('0x1c'))['register'](socket);var jayson=require(_0xabd3('0x1d'));var client=jayson[_0xabd3('0x1e')][_0xabd3('0x1f')]({'port':0x232c});var client9002=jayson[_0xabd3('0x1e')][_0xabd3('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x562edc,_0x166ec6,_0x4f21e1,_0x5f5d28){return new BPromise(function(_0x3183d9,_0x46e261){var _0x57ee8b=_0x5f5d28||client;return _0x57ee8b['request'](_0x562edc,_0x4f21e1)[_0xabd3('0x20')](function(_0x16f38c){logger[_0xabd3('0x21')](_0xabd3('0x22'),_0x166ec6,_0xabd3('0x23'));logger[_0xabd3('0x24')](_0xabd3('0x25'),_0x166ec6,_0xabd3('0x23'),JSON[_0xabd3('0x26')](_0x16f38c));if(_0x16f38c[_0xabd3('0x27')]){if(_0x16f38c[_0xabd3('0x27')]['code']===0x1f4){logger[_0xabd3('0x27')](_0xabd3('0x22'),_0x166ec6,_0x16f38c[_0xabd3('0x27')][_0xabd3('0x28')]);return _0x46e261(_0x16f38c['error'][_0xabd3('0x28')]);}logger['error'](_0xabd3('0x22'),_0x166ec6,_0x16f38c['error'][_0xabd3('0x28')]);return _0x3183d9(_0x16f38c[_0xabd3('0x27')][_0xabd3('0x28')]);}else{logger[_0xabd3('0x21')](_0xabd3('0x22'),_0x166ec6,_0xabd3('0x23'));_0x3183d9(_0x16f38c[_0xabd3('0x29')][_0xabd3('0x28')]);}})[_0xabd3('0x2a')](function(_0x25573f){logger[_0xabd3('0x27')](_0xabd3('0x22'),_0x166ec6,_0x25573f);_0x46e261(_0x25573f);});});}function respondWithStatusCode(_0x2e3fce,_0x1c4ec4){_0x1c4ec4=_0x1c4ec4||0xcc;return function(_0x24b478){if(_0x24b478){return _0x2e3fce[_0xabd3('0x2b')](_0x1c4ec4);}return _0x2e3fce[_0xabd3('0x2c')](_0x1c4ec4)[_0xabd3('0x2d')]();};}function respondWithResult(_0x476cfa,_0x5c8c94){_0x5c8c94=_0x5c8c94||0xc8;return function(_0x2793c8){if(_0x2793c8){return _0x476cfa[_0xabd3('0x2c')](_0x5c8c94)['json'](_0x2793c8);}};}function respondWithFilteredResult(_0x6115c3,_0x179711){return function(_0x11a92b){if(_0x11a92b){var _0x565002=typeof _0x179711[_0xabd3('0x2e')]===_0xabd3('0x2f')&&typeof _0x179711[_0xabd3('0x30')]===_0xabd3('0x2f');var _0x5db9c6=_0x11a92b[_0xabd3('0x31')];var _0xc59f71=_0x565002?0x0:_0x179711[_0xabd3('0x2e')];var _0x37c42f=_0x565002?_0x11a92b[_0xabd3('0x31')]:_0x179711[_0xabd3('0x2e')]+_0x179711['limit'];var _0x2d9b83;if(_0x37c42f>=_0x5db9c6){_0x37c42f=_0x5db9c6;_0x2d9b83=0xc8;}else{_0x2d9b83=0xce;}_0x6115c3['status'](_0x2d9b83);return _0x6115c3['set'](_0xabd3('0x32'),_0xc59f71+'-'+_0x37c42f+'/'+_0x5db9c6)[_0xabd3('0x33')](_0x11a92b);}return null;};}function patchUpdates(_0x5d7b11){return function(_0x14f02f){try{jsonpatch[_0xabd3('0x34')](_0x14f02f,_0x5d7b11,!![]);}catch(_0x5b7f19){return BPromise[_0xabd3('0x35')](_0x5b7f19);}return _0x14f02f[_0xabd3('0x36')]();};}function saveUpdates(_0x875620,_0x561993){return function(_0x434333){if(_0x434333){return _0x434333[_0xabd3('0x37')](_0x875620)['then'](function(_0x4c6c67){return _0x4c6c67;});}return null;};}function removeEntity(_0x707258,_0x10b864){return function(_0x1813c0){if(_0x1813c0){return _0x1813c0[_0xabd3('0x38')]()[_0xabd3('0x20')](function(){_0x707258['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xef1fa8,_0x293aa4){return function(_0xeaa085){if(!_0xeaa085){_0xef1fa8['sendStatus'](0x194);}return _0xeaa085;};}function handleError(_0x46db68,_0x21dd63){_0x21dd63=_0x21dd63||0x1f4;return function(_0x564c5a){logger[_0xabd3('0x27')](_0x564c5a[_0xabd3('0x39')]);if(_0x564c5a['name']){delete _0x564c5a[_0xabd3('0x3a')];}_0x46db68[_0xabd3('0x2c')](_0x21dd63)[_0xabd3('0x3b')](_0x564c5a);};}exports[_0xabd3('0x3c')]=function(_0x36ca27,_0x15ab51){var _0x44ae2c={},_0x3d9af0={},_0x4567c3={'count':0x0,'rows':[]};var _0x39eed8=_[_0xabd3('0x3d')](db[_0xabd3('0x3e')]['rawAttributes'],function(_0x2d9fd0){return{'name':_0x2d9fd0[_0xabd3('0x3f')],'type':_0x2d9fd0[_0xabd3('0x40')][_0xabd3('0x41')]};});_0x3d9af0[_0xabd3('0x42')]=_[_0xabd3('0x3d')](_0x39eed8,_0xabd3('0x3a'));_0x3d9af0[_0xabd3('0x43')]=_[_0xabd3('0x44')](_0x36ca27['query']);_0x3d9af0[_0xabd3('0x45')]=_[_0xabd3('0x46')](_0x3d9af0[_0xabd3('0x42')],_0x3d9af0[_0xabd3('0x43')]);_0x44ae2c[_0xabd3('0x47')]=_[_0xabd3('0x46')](_0x3d9af0[_0xabd3('0x42')],qs[_0xabd3('0x48')](_0x36ca27[_0xabd3('0x43')][_0xabd3('0x48')]));_0x44ae2c['attributes']=_0x44ae2c['attributes'][_0xabd3('0x49')]?_0x44ae2c[_0xabd3('0x47')]:_0x3d9af0['model'];if(!_0x36ca27['query'][_0xabd3('0x4a')](_0xabd3('0x4b'))){_0x44ae2c[_0xabd3('0x30')]=qs[_0xabd3('0x30')](_0x36ca27[_0xabd3('0x43')][_0xabd3('0x30')]);_0x44ae2c[_0xabd3('0x2e')]=qs[_0xabd3('0x2e')](_0x36ca27[_0xabd3('0x43')][_0xabd3('0x2e')]);}_0x44ae2c[_0xabd3('0x4c')]=qs[_0xabd3('0x4d')](_0x36ca27[_0xabd3('0x43')][_0xabd3('0x4d')]);_0x44ae2c[_0xabd3('0x4e')]=qs[_0xabd3('0x45')](_[_0xabd3('0x4f')](_0x36ca27[_0xabd3('0x43')],_0x3d9af0[_0xabd3('0x45')]),_0x39eed8);if(_0x36ca27['query'][_0xabd3('0x50')]){_0x44ae2c['where']=_[_0xabd3('0x51')](_0x44ae2c[_0xabd3('0x4e')],{'$or':_[_0xabd3('0x3d')](_0x39eed8,function(_0x3e2a2e){if(_0x3e2a2e['type']!==_0xabd3('0x52')){var _0xcd1d8b={};_0xcd1d8b[_0x3e2a2e[_0xabd3('0x3a')]]={'$like':'%'+_0x36ca27[_0xabd3('0x43')][_0xabd3('0x50')]+'%'};return _0xcd1d8b;}})});}_0x44ae2c=_['merge']({},_0x44ae2c,_0x36ca27['options']);var _0x5adcaa={'where':_0x44ae2c['where']};return db[_0xabd3('0x3e')][_0xabd3('0x31')](_0x5adcaa)[_0xabd3('0x20')](function(_0x480838){_0x4567c3[_0xabd3('0x31')]=_0x480838;if(_0x36ca27['query']['includeAll']){_0x44ae2c['include']=[{'all':!![]}];}return db[_0xabd3('0x3e')][_0xabd3('0x53')](_0x44ae2c);})[_0xabd3('0x20')](function(_0x2286ef){_0x4567c3[_0xabd3('0x54')]=_0x2286ef;return _0x4567c3;})[_0xabd3('0x20')](respondWithFilteredResult(_0x15ab51,_0x44ae2c))[_0xabd3('0x2a')](handleError(_0x15ab51,null));};exports[_0xabd3('0x55')]=function(_0x44a11b,_0x5a4274){var _0x519fe1={'raw':!![],'where':{'id':_0x44a11b['params']['id']}},_0x2f7a5a={};_0x2f7a5a[_0xabd3('0x42')]=_[_0xabd3('0x44')](db[_0xabd3('0x3e')][_0xabd3('0x56')]);_0x2f7a5a[_0xabd3('0x43')]=_[_0xabd3('0x44')](_0x44a11b[_0xabd3('0x43')]);_0x2f7a5a[_0xabd3('0x45')]=_[_0xabd3('0x46')](_0x2f7a5a['model'],_0x2f7a5a[_0xabd3('0x43')]);_0x519fe1[_0xabd3('0x47')]=_['intersection'](_0x2f7a5a['model'],qs[_0xabd3('0x48')](_0x44a11b['query'][_0xabd3('0x48')]));_0x519fe1[_0xabd3('0x47')]=_0x519fe1[_0xabd3('0x47')]['length']?_0x519fe1[_0xabd3('0x47')]:_0x2f7a5a[_0xabd3('0x42')];if(_0x44a11b[_0xabd3('0x43')][_0xabd3('0x57')]){_0x519fe1['include']=[{'all':!![]}];}_0x519fe1=_[_0xabd3('0x51')]({},_0x519fe1,_0x44a11b[_0xabd3('0x58')]);return db[_0xabd3('0x3e')]['find'](_0x519fe1)[_0xabd3('0x20')](handleEntityNotFound(_0x5a4274,null))[_0xabd3('0x20')](respondWithResult(_0x5a4274,null))['catch'](handleError(_0x5a4274,null));};exports[_0xabd3('0x59')]=function(_0x5b78b3,_0x3b4040){return db[_0xabd3('0x3e')][_0xabd3('0x59')](_0x5b78b3[_0xabd3('0x5a')],{})[_0xabd3('0x20')](respondWithResult(_0x3b4040,0xc9))[_0xabd3('0x2a')](handleError(_0x3b4040,null));};exports[_0xabd3('0x37')]=function(_0x121fe4,_0x4442bd){if(_0x121fe4['body']['id']){delete _0x121fe4[_0xabd3('0x5a')]['id'];}return db[_0xabd3('0x3e')][_0xabd3('0x5b')]({'where':{'id':_0x121fe4[_0xabd3('0x5c')]['id']}})[_0xabd3('0x20')](handleEntityNotFound(_0x4442bd,null))[_0xabd3('0x20')](saveUpdates(_0x121fe4[_0xabd3('0x5a')],null))[_0xabd3('0x20')](respondWithResult(_0x4442bd,null))[_0xabd3('0x2a')](handleError(_0x4442bd,null));};exports[_0xabd3('0x38')]=function(_0x54fd6d,_0x510fe5){return db[_0xabd3('0x3e')]['find']({'where':{'id':_0x54fd6d[_0xabd3('0x5c')]['id']}})[_0xabd3('0x20')](handleEntityNotFound(_0x510fe5,null))[_0xabd3('0x20')](removeEntity(_0x510fe5,null))[_0xabd3('0x2a')](handleError(_0x510fe5,null));};exports[_0xabd3('0x5d')]=function(_0x1cc6e8,_0x2220aa){return db[_0xabd3('0x3e')][_0xabd3('0x5d')]()['then'](respondWithResult(_0x2220aa,null))[_0xabd3('0x2a')](handleError(_0x2220aa,null));};var interaction_log=require(_0xabd3('0x15'))(_0xabd3('0x5e'));exports[_0xabd3('0x5f')]=function(_0x4ab3bf,_0x2c05c4,_0x3db58f){var _0xb0f51a={'agent':{},'channel':'sms'};if(_0x4ab3bf['body']['id']){delete _0x4ab3bf[_0xabd3('0x5a')]['id'];}_0x4ab3bf['body']['read']=!![];_0x4ab3bf['body'][_0xabd3('0x60')]=moment()[_0xabd3('0x61')](_0xabd3('0x62'));_0x4ab3bf['body'][_0xabd3('0x63')]=_0x4ab3bf[_0xabd3('0x5a')][_0xabd3('0x63')]||_0x4ab3bf[_0xabd3('0x64')]['id'];_0xb0f51a[_0xabd3('0x65')]['id']=_0x4ab3bf[_0xabd3('0x5a')][_0xabd3('0x63')];return db[_0xabd3('0x3e')][_0xabd3('0x5b')]({'where':{'id':_0x4ab3bf[_0xabd3('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2c05c4,null))['then'](saveUpdates(_0x4ab3bf[_0xabd3('0x5a')],null))[_0xabd3('0x20')](function(_0x4e5be4){if(_0x4e5be4){_0xb0f51a[_0xabd3('0x28')]=_0x4e5be4[_0xabd3('0x66')]({'plain':!![]});return db[_0xabd3('0x67')][_0xabd3('0x5b')]({'where':{'id':_0x4e5be4[_0xabd3('0x68')]}});}return null;})[_0xabd3('0x20')](handleEntityNotFound(_0x2c05c4,null))['then'](function(_0x1be5a8){if(_0x1be5a8){return _0x1be5a8[_0xabd3('0x37')]({'UserId':_0x4ab3bf[_0xabd3('0x5a')][_0xabd3('0x63')],'read1stAt':_[_0xabd3('0x69')](_0x1be5a8[_0xabd3('0x6a')])?moment()[_0xabd3('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xabd3('0x20')](function(_0x1935cd){if(_0x1935cd){_0xb0f51a['interaction']=_0x1935cd[_0xabd3('0x66')]({'plain':!![]});interaction_log[_0xabd3('0x21')](_0xabd3('0x6b'),_0x4ab3bf[_0xabd3('0x64')]['id'],_0x4ab3bf['user']['name'],_0x4ab3bf[_0xabd3('0x64')]['role'],_0xb0f51a[_0xabd3('0x6c')]['id'],_0x4ab3bf[_0xabd3('0x5a')]?JSON[_0xabd3('0x26')](_0x4ab3bf['body']):_0xabd3('0x6d'));return respondWithRpcPromise(_0xabd3('0x6e'),_0xabd3('0x6f'),_0xb0f51a);}return null;})['then'](function(_0x2fee50){var _0x9b9d36=_0xabd3('0x70')+_0x2fee50[_0xabd3('0x28')][_0xabd3('0x71')];return db['sequelize']['query'](_0x9b9d36,{'type':db['Sequelize']['QueryTypes'][_0xabd3('0x72')],'raw':!![]})[_0xabd3('0x20')](function(_0xc8178b){return _0xc8178b;});})[_0xabd3('0x20')](function(_0x2b0d5e){if(_0x2b0d5e){_0xb0f51a[_0xabd3('0x28')][_0xabd3('0x73')]=_0x2b0d5e[0x0];if(!_0x4ab3bf[_0xabd3('0x5a')][_0xabd3('0x63')])return;return db[_0xabd3('0x74')][_0xabd3('0x5b')]({'where':{'id':_0x4ab3bf[_0xabd3('0x5a')][_0xabd3('0x63')],'role':_0xabd3('0x65')},'attributes':['id',_0xabd3('0x3a'),_0xabd3('0x75'),_0xabd3('0x76'),_0xabd3('0x77')],'raw':!![]});}return null;})[_0xabd3('0x20')](function(_0x42b058){if(!_0x42b058)return null;_0xb0f51a[_0xabd3('0x28')][_0xabd3('0x65')]=_0x42b058;return _0xb0f51a;})[_0xabd3('0x20')](function(_0x1a1f34){if(_0x1a1f34){if(_0x4ab3bf[_0xabd3('0x5a')][_0xabd3('0x78')]){_0xb0f51a[_0xabd3('0x28')][_0xabd3('0x79')]=util[_0xabd3('0x61')](_0xabd3('0x7a'),_0x4ab3bf['user']['name']);_0xb0f51a[_0xabd3('0x28')][_0xabd3('0x7b')]=_0xb0f51a[_0xabd3('0x7b')];_0xb0f51a[_0xabd3('0x28')][_0xabd3('0x7c')]=_0xb0f51a[_0xabd3('0x7b')];_0xb0f51a[_0xabd3('0x28')][_0xabd3('0x7d')]=_0xabd3('0x5f');return respondWithRpcPromise('EventManager',_0xabd3('0x7e'),{'event':'acceptmessage','message':_0xb0f51a[_0xabd3('0x28')]},client9002)[_0xabd3('0x20')](function(){return _0xb0f51a;});}return _0xb0f51a;}return null;})['then'](respondWithResult(_0x2c05c4,null))['catch'](handleError(_0x2c05c4,null));};var interaction_log=require(_0xabd3('0x15'))(_0xabd3('0x5e'));exports['reject']=function(_0xb5facf,_0x51784c,_0x4a5eb2){var _0x509601={'agent':{},'channel':_0xabd3('0x7f')};if(_0xb5facf['body']['id']){delete _0xb5facf[_0xabd3('0x5a')]['id'];}_0xb5facf['body'][_0xabd3('0x63')]=_0xb5facf[_0xabd3('0x5a')][_0xabd3('0x63')]||_0xb5facf[_0xabd3('0x64')]['id'];_0x509601[_0xabd3('0x65')]['id']=_0xb5facf[_0xabd3('0x5a')]['UserId'];return db[_0xabd3('0x3e')][_0xabd3('0x5b')]({'where':{'id':_0xb5facf[_0xabd3('0x5c')]['id'],'UserId':null}})[_0xabd3('0x20')](handleEntityNotFound(_0x51784c,null))['then'](function(_0x4137e2){if(_0x4137e2){_0x509601['message']=_0x4137e2[_0xabd3('0x66')]({'plain':!![]});return db[_0xabd3('0x67')][_0xabd3('0x5b')]({'where':{'id':_0x4137e2[_0xabd3('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x51784c,null))['then'](function(_0x5f2254){if(_0x5f2254){_0x509601[_0xabd3('0x6c')]=_0x5f2254['get']({'plain':!![]});interaction_log[_0xabd3('0x21')](_0xabd3('0x80'),_0xb5facf['user']['id'],_0xb5facf[_0xabd3('0x64')][_0xabd3('0x3a')],_0xb5facf[_0xabd3('0x64')]['role'],_0x509601['interaction']['id'],_0xb5facf['body']?JSON[_0xabd3('0x26')](_0xb5facf[_0xabd3('0x5a')]):_0xabd3('0x6d'));return respondWithRpcPromise(_0xabd3('0x81'),_0xabd3('0x82'),_0x509601);}return null;})[_0xabd3('0x20')](function(_0x352816){var _0x180975=_0xabd3('0x70')+_0x352816[_0xabd3('0x28')]['ContactId'];return db[_0xabd3('0x83')][_0xabd3('0x43')](_0x180975,{'type':db[_0xabd3('0x84')][_0xabd3('0x85')][_0xabd3('0x72')],'raw':!![]})[_0xabd3('0x20')](function(_0x5b42ce){return _0x5b42ce;});})['then'](function(_0x5a142b){if(_0x5a142b){_0x509601['message'][_0xabd3('0x73')]=_0x5a142b[0x0];if(!_0xb5facf[_0xabd3('0x5a')][_0xabd3('0x63')])return;return db[_0xabd3('0x74')][_0xabd3('0x5b')]({'where':{'id':_0xb5facf[_0xabd3('0x5a')][_0xabd3('0x63')],'role':_0xabd3('0x65')},'attributes':['id',_0xabd3('0x3a'),_0xabd3('0x75'),'email',_0xabd3('0x77')],'raw':!![]});}return null;})[_0xabd3('0x20')](function(_0x2a0f49){if(!_0x2a0f49)return null;_0x509601[_0xabd3('0x28')]['agent']=_0x2a0f49;return _0x509601;})[_0xabd3('0x20')](function(_0x37fd3e){if(_0x37fd3e){_0x37fd3e[_0xabd3('0x28')][_0xabd3('0x79')]=util[_0xabd3('0x61')]('SIP/%s',_0xb5facf[_0xabd3('0x64')][_0xabd3('0x3a')]);_0x37fd3e['message'][_0xabd3('0x7b')]=_0x509601[_0xabd3('0x7b')];_0x37fd3e[_0xabd3('0x28')][_0xabd3('0x7c')]=_0x509601['channel'];_0x37fd3e[_0xabd3('0x28')][_0xabd3('0x7d')]=_0xabd3('0x35');respondWithRpcPromise(_0xabd3('0x7e'),_0xabd3('0x7e'),{'event':'rejectmessage','message':_0x37fd3e['message']},client9002);return _0x509601;}return null;})[_0xabd3('0x20')](respondWithResult(_0x51784c,null))[_0xabd3('0x2a')](handleError(_0x51784c,null));};exports[_0xabd3('0x2c')]=function(_0x777ad4,_0x147a0f,_0x4d9733){if(_0x777ad4[_0xabd3('0x5a')]['id']){delete _0x777ad4['body']['id'];}var _0x53ab30;return db[_0xabd3('0x3e')][_0xabd3('0x5b')]({'where':{'id':_0x777ad4[_0xabd3('0x5c')]['id']}})['then'](handleEntityNotFound(_0x147a0f,null))[_0xabd3('0x20')](function(_0x582ffc){if(_0x582ffc){_0x53ab30=_0x582ffc;return db['SmsAccount']['find']({'where':{'id':_0x582ffc['SmsAccountId']}});}})[_0xabd3('0x20')](handleEntityNotFound(_0x147a0f,null))[_0xabd3('0x20')](function(_0x4f8709){if(_0x4f8709){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xabd3('0x2c'),_0xabd3('0x86'),_0x4f8709[_0xabd3('0x40')],util[_0xabd3('0x87')](_0x777ad4[_0xabd3('0x5a')],{'showHidden':![],'depth':null}));switch(_0x4f8709['type']){case _0xabd3('0x88'):if(_0x777ad4[_0xabd3('0x5a')][_0xabd3('0x89')]&&_0x777ad4[_0xabd3('0x5a')][_0xabd3('0x89')]===_0x53ab30[_0xabd3('0x8a')]){return _0x53ab30[_0xabd3('0x37')]({'read':!![]});}else{logger[_0xabd3('0x27')](_0xabd3('0x8b'),_0xabd3('0x2c'),'twilio',util[_0xabd3('0x87')](_0x777ad4[_0xabd3('0x5a')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x777ad4[_0xabd3('0x5a')][_0xabd3('0x8c')]&&_0x777ad4[_0xabd3('0x5a')][_0xabd3('0x8c')]===_0x53ab30['messageId']&&_['indexOf']([_0xabd3('0x8d'),'delivered'],_0x777ad4[_0xabd3('0x5a')]['Status'])>=0x0){return _0x53ab30[_0xabd3('0x37')]({'read':!![]});}else{logger[_0xabd3('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xabd3('0x2c'),_0xabd3('0x8e'),util[_0xabd3('0x87')](_0x777ad4[_0xabd3('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xabd3('0x8f'):var _0x3f2f34=_0x777ad4[_0xabd3('0x5a')]['results'][0x0];if(_0x3f2f34[_0xabd3('0x2c')][_0xabd3('0x90')]===_0xabd3('0x91')){return _0x53ab30[_0xabd3('0x37')]({'read':!![]});}else{logger[_0xabd3('0x27')](_0xabd3('0x8b'),'status',_0xabd3('0x8f'),util['inspect'](_0x777ad4[_0xabd3('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x53ab30;}})['then'](respondWithResult(_0x147a0f,null))[_0xabd3('0x2a')](handleError(_0x147a0f,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 957d073..8fca0c0 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 _0x1aad=['exports','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1aad,0x17b));var _0xd1aa=function(_0x481ee8,_0x5aa574){_0x481ee8=_0x481ee8-0x0;var _0x5ad55f=_0x1aad[_0x481ee8];return _0x5ad55f;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xd1aa('0x0'))['db'][_0xd1aa('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd1aa('0x2')](0x0);var events={'afterCreate':_0xd1aa('0x3'),'afterUpdate':_0xd1aa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x52cad9){return function(_0x3a59e8,_0xc4e07f,_0x54ce63){SmsMessageEvents[_0xd1aa('0x5')](_0x52cad9+':'+_0x3a59e8['id'],_0x3a59e8);SmsMessageEvents[_0xd1aa('0x5')](_0x52cad9,_0x3a59e8);_0x54ce63(null);};}for(var e in events){if(events[_0xd1aa('0x6')](e)){var event=events[e];SmsMessage[_0xd1aa('0x7')](e,emitEvent(event));}}module[_0xd1aa('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x43d2=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0x4f2aa1,_0x5cdffd){var _0x1beeb7=function(_0x18709c){while(--_0x18709c){_0x4f2aa1['push'](_0x4f2aa1['shift']());}};_0x1beeb7(++_0x5cdffd);}(_0x43d2,0x165));var _0x243d=function(_0x5b906a,_0x31b5fc){_0x5b906a=_0x5b906a-0x0;var _0x2a1dcf=_0x43d2[_0x5b906a];return _0x2a1dcf;};'use strict';var EventEmitter=require(_0x243d('0x0'));var SmsMessage=require(_0x243d('0x1'))['db'][_0x243d('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x243d('0x3')](0x0);var events={'afterCreate':_0x243d('0x4'),'afterUpdate':'update','afterDestroy':_0x243d('0x5')};function emitEvent(_0x35cac2){return function(_0x2db7ae,_0x4816d4,_0x3e047e){SmsMessageEvents[_0x243d('0x6')](_0x35cac2+':'+_0x2db7ae['id'],_0x2db7ae);SmsMessageEvents[_0x243d('0x6')](_0x35cac2,_0x2db7ae);_0x3e047e(null);};}for(var e in events){if(events[_0x243d('0x7')](e)){var event=events[e];SmsMessage[_0x243d('0x8')](e,emitEvent(event));}}module[_0x243d('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index ff9db8e..4e52b3c 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 _0xf9d3=['clickatell','apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','message','application/json','refid','status','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','authToken','accountSid','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','login?username=','&password=','password','then','split','sms','session_key','total_sent','internal_order_id','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','read','Missing\x20parameters:\x20authToken','clicksend','username','%s:%s','POST','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','queued_count','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','Missing\x20parameters:\x20base_url','crypto','login','text','timestamp','keys','sort','length','createHash','digest','hex','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf9d3,0x10c));var _0x3f9d=function(_0x24bb57,_0x4b43f4){_0x24bb57=_0x24bb57-0x0;var _0x329956=_0xf9d3[_0x24bb57];return _0x329956;};'use strict';var _=require('lodash');var util=require(_0x3f9d('0x0'));var logger=require(_0x3f9d('0x1'))(_0x3f9d('0x2'));var moment=require('moment');var BPromise=require(_0x3f9d('0x3'));var rp=require(_0x3f9d('0x4'));var fs=require('fs');var path=require(_0x3f9d('0x5'));var rimraf=require(_0x3f9d('0x6'));var config=require(_0x3f9d('0x7'));var attributes=require(_0x3f9d('0x8'));module['exports']=function(_0x2be7b0,_0x293631){return _0x2be7b0['define'](_0x3f9d('0x9'),attributes,{'tableName':_0x3f9d('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x3f9d('0xb')]},{'name':_0x3f9d('0xc'),'fields':[_0x3f9d('0xd')],'type':_0x3f9d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57096c,_0x36442a,_0x42d01f){var _0x590034=_0x2be7b0[_0x3f9d('0xf')];var _0x3419cd=_0x57096c[_0x3f9d('0x10')]({'plain':!![]});if(_0x3419cd['direction'][_0x3f9d('0x11')]()==='in'||_0x3419cd[_0x3f9d('0x12')]['toLowerCase']()===_0x3f9d('0x13')&&!_0x3419cd[_0x3f9d('0x14')]&&!_[_0x3f9d('0x15')](_0x3419cd[_0x3f9d('0x16')])&&!_[_0x3f9d('0x15')](_0x3419cd['SmsInteractionId'])){_0x590034[_0x3f9d('0x17')][_0x3f9d('0x18')]({'where':{'id':_0x3419cd[_0x3f9d('0x19')]}})['then'](function(_0x3aad4d){if(_0x3aad4d){_0x3aad4d[_0x3f9d('0x1a')]({'lastMsgAt':_0x3419cd[_0x3f9d('0x1b')],'lastMsgDirection':_0x3419cd[_0x3f9d('0x12')][_0x3f9d('0x11')]()});}})[_0x3f9d('0x1c')](function(_0x3bd9ab){console[_0x3f9d('0x1d')](_0x3bd9ab);});}if(_0x3419cd[_0x3f9d('0x12')]===_0x3f9d('0x13')&&!_0x3419cd['secret']){var _0x51b732;_0x590034[_0x3f9d('0x1e')][_0x3f9d('0x1f')]({'where':{'id':_0x3419cd[_0x3f9d('0x20')]},'raw':!![]})['then'](function(_0x2cca8e){_0x51b732=_0x2cca8e;if(_0x51b732&&_0x51b732[_0x3f9d('0x21')]){switch(_0x51b732[_0x3f9d('0x21')]){case'twilio':var _0x525a8c=require('twilio');if(_0x51b732['accountSid']&&_0x51b732[_0x3f9d('0x22')]&&_0x51b732['phone']){var _0x33761f=new _0x525a8c(_0x51b732[_0x3f9d('0x23')],_0x51b732[_0x3f9d('0x22')]);_0x33761f[_0x3f9d('0x24')][_0x3f9d('0x25')]({'body':_0x3419cd[_0x3f9d('0xd')],'to':_0x3419cd['phone'],'from':_0x51b732[_0x3f9d('0x26')],'statusCallback':_0x51b732[_0x3f9d('0x27')]+_0x3f9d('0x28')+_0x3419cd['id']+_0x3f9d('0x29')+_0x51b732[_0x3f9d('0x2a')]})['then'](function(_0x3e3818){if(_0x3e3818[_0x3f9d('0x2b')]){return _0x57096c[_0x3f9d('0x1a')]({'messageId':_0x3e3818[_0x3f9d('0x2b')]});}})[_0x3f9d('0x1c')](function(_0x2bd6bb){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f9d('0x2c'),'twilio',util[_0x3f9d('0x2d')](_0x2bd6bb,{'showHidden':![],'depth':null}));});}else{logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),_0x3f9d('0x2c'),_0x3f9d('0x2f'),_0x3f9d('0x30'));}break;case _0x3f9d('0x31'):var _0x262e24=_0x3f9d('0x32');if(_0x51b732['username']&&_0x51b732['password']){var _0x5f18c1={'recipient':[_0x3419cd[_0x3f9d('0x26')]],'message':_0x3419cd[_0x3f9d('0xd')],'message_type':_0x51b732[_0x3f9d('0x33')]};if(_0x51b732[_0x3f9d('0x33')]&&_0x51b732[_0x3f9d('0x33')]!=='SI'){_0x5f18c1[_0x3f9d('0x34')]=_0x51b732[_0x3f9d('0x26')];}var _0x4a80ef={'url':_0x262e24+_0x3f9d('0x35')+_0x51b732['username']+_0x3f9d('0x36')+_0x51b732[_0x3f9d('0x37')],'method':'GET'};rp(_0x4a80ef)[_0x3f9d('0x38')](function(_0x28d5e2){var _0x25b69a=_0x28d5e2[_0x3f9d('0x39')](';');var _0x5e0656={'user_key':_0x25b69a[0x0],'session_key':_0x25b69a[0x1]};_0x4a80ef={'url':_0x262e24+_0x3f9d('0x3a'),'method':'POST','headers':{'user_key':_0x5e0656['user_key'],'Session_key':_0x5e0656[_0x3f9d('0x3b')]},'json':!![],'body':_0x5f18c1};return rp(_0x4a80ef);})[_0x3f9d('0x38')](function(_0x36e7be){if(_0x36e7be[_0x3f9d('0x3c')]>=0x1){var _0x206bde={'messageId':_0x36e7be[_0x3f9d('0x3d')]};if(_0x51b732[_0x3f9d('0x33')]!=='GP'||!_0x51b732['deliveryReport']){_0x206bde['read']=!![];}return _0x57096c[_0x3f9d('0x1a')](_0x206bde);}else{return logger[_0x3f9d('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f9d('0x2c'),_0x3f9d('0x31'),util['inspect'](_0x36e7be,{'showHidden':![],'depth':null}));}})[_0x3f9d('0x1c')](function(_0x112a2e){return logger[_0x3f9d('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f9d('0x2c'),'skebby',util['inspect'](_0x112a2e,{'showHidden':![],'depth':null}));});}else{logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),'afterCreate',_0x3f9d('0x31'),_0x3f9d('0x3e'));}break;case _0x3f9d('0x3f'):if(_0x51b732[_0x3f9d('0x22')]){var _0xda5d52={'recipient':_0x3419cd[_0x3f9d('0x26')],'message':_0x3419cd['body'],'sender':_0x51b732[_0x3f9d('0x40')]||_0x51b732[_0x3f9d('0x26')],'authorization':_0x51b732[_0x3f9d('0x22')]};var _0x36442a={'method':'POST','uri':_0x3f9d('0x41'),'body':_0xda5d52,'json':!![]};rp(_0x36442a)[_0x3f9d('0x38')](function(_0x2d4ee5){var _0x3b8d51={'messageId':_0x2d4ee5[_0x3f9d('0x42')]};if(!_0x51b732[_0x3f9d('0x43')]){_0x3b8d51[_0x3f9d('0x44')]=!![];}return _0x57096c['update'](_0x3b8d51);})[_0x3f9d('0x1c')](function(_0x327e67){logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),'afterCreate',_0x3f9d('0x3f'),util[_0x3f9d('0x2d')](_0x327e67,{'showHidden':![],'depth':null}));});}else{logger[_0x3f9d('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f9d('0x2c'),_0x3f9d('0x3f'),_0x3f9d('0x45'));}break;case _0x3f9d('0x46'):if(_0x51b732[_0x3f9d('0x47')]&&_0x51b732[_0x3f9d('0x37')]){var _0xda5d52={'messages':[{'source':'xCALLY\x20Motion','to':_0x3419cd['phone'],'body':_0x3419cd[_0x3f9d('0xd')],'from':_0x51b732[_0x3f9d('0x40')]||_0x51b732[_0x3f9d('0x26')]}]};var _0x54f2db=util['format'](_0x3f9d('0x48'),_0x51b732[_0x3f9d('0x47')],_0x51b732[_0x3f9d('0x37')]);var _0x36442a={'method':_0x3f9d('0x49'),'uri':_0x3f9d('0x4a'),'body':_0xda5d52,'headers':{'Authorization':util[_0x3f9d('0x4b')](_0x3f9d('0x4c'),new Buffer(_0x54f2db)[_0x3f9d('0x4d')](_0x3f9d('0x4e')))},'json':!![]};rp(_0x36442a)[_0x3f9d('0x38')](function(_0x59d432){if(_0x59d432[_0x3f9d('0x4f')]>=0xc8&&_0x59d432['http_code']<=0xce){if(_0x59d432[_0x3f9d('0x50')]&&_0x59d432['data'][_0x3f9d('0x51')]>0x0){var _0x162e5f=_['head'](_0x59d432[_0x3f9d('0x50')][_0x3f9d('0x24')]);var _0x2241b7={'messageId':_0x162e5f['message_id']};if(!_0x51b732[_0x3f9d('0x43')]){_0x2241b7['read']=!![];}return _0x57096c[_0x3f9d('0x1a')](_0x2241b7);}else{logger['error'](_0x3f9d('0x2e'),_0x3f9d('0x2c'),_0x3f9d('0x52'),util[_0x3f9d('0x2d')](_0x59d432,{'showHidden':![],'depth':null}));}}else{logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),'afterCreate',_0x3f9d('0x52'),util['inspect'](_0x59d432,{'showHidden':![],'depth':null}));}})[_0x3f9d('0x1c')](function(_0x1a8bb2){logger[_0x3f9d('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f9d('0x2c'),'clickSend',util['inspect'](_0x1a8bb2,{'showHidden':![],'depth':null}));});}else{logger[_0x3f9d('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f9d('0x2c'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0x3f9d('0x53'):if(_0x51b732[_0x3f9d('0x54')]&&_0x51b732[_0x3f9d('0x22')]){var _0xda5d52={'dst':_0x3419cd[_0x3f9d('0x26')],'text':_0x3419cd[_0x3f9d('0xd')],'src':_0x51b732[_0x3f9d('0x40')]||_0x51b732[_0x3f9d('0x26')],'url':_0x51b732[_0x3f9d('0x27')]+_0x3f9d('0x28')+_0x3419cd['id']+_0x3f9d('0x29')+_0x51b732[_0x3f9d('0x2a')]};var _0x54f2db=util[_0x3f9d('0x4b')]('%s:%s',_0x51b732[_0x3f9d('0x54')],_0x51b732[_0x3f9d('0x22')]);var _0x36442a={'method':_0x3f9d('0x49'),'uri':util[_0x3f9d('0x4b')](_0x3f9d('0x55'),_0x51b732['authId']),'body':_0xda5d52,'headers':{'Authorization':util[_0x3f9d('0x4b')](_0x3f9d('0x4c'),new Buffer(_0x54f2db)[_0x3f9d('0x4d')](_0x3f9d('0x4e')))},'json':!![]};rp(_0x36442a)[_0x3f9d('0x38')](function(_0xe2cb3c){var _0x1c517b={'messageId':_0xe2cb3c[_0x3f9d('0x56')][0x0]};return _0x57096c['update'](_0x1c517b);})[_0x3f9d('0x1c')](function(_0x1d4ee8){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f9d('0x2c'),'plivo',util['inspect'](_0x1d4ee8,{'showHidden':![],'depth':null}));});}else{logger[_0x3f9d('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f9d('0x2c'),_0x3f9d('0x53'),_0x3f9d('0x57'));}break;case _0x3f9d('0x58'):if(_0x51b732[_0x3f9d('0x47')]&&_0x51b732[_0x3f9d('0x37')]){if(_0x51b732[_0x3f9d('0x59')]){var _0x19461c={'method':'POST','uri':_0x51b732[_0x3f9d('0x59')]+_0x3f9d('0x5a'),'body':{'username':_0x51b732[_0x3f9d('0x47')],'password':_0x51b732[_0x3f9d('0x37')]},'json':!![]};return rp(_0x19461c)[_0x3f9d('0x38')](function(_0x42005d){var _0x5b36dd={'method':_0x3f9d('0x49'),'uri':_0x51b732[_0x3f9d('0x59')]+_0x3f9d('0x5b'),'body':{'messages':[{'from':_0x51b732[_0x3f9d('0x26')],'destinations':[{'to':_0x3419cd['phone']}],'text':_0x3419cd[_0x3f9d('0xd')],'notifyUrl':_0x51b732[_0x3f9d('0x27')]+_0x3f9d('0x28')+_0x3419cd['id']+_0x3f9d('0x29')+_0x51b732[_0x3f9d('0x2a')],'notifyContentType':'application/json','callbackData':_0x51b732[_0x3f9d('0x26')]+';'+_0x3419cd['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x42005d[_0x3f9d('0x2a')]},'json':!![]};return rp(_0x5b36dd)[_0x3f9d('0x38')](function(_0x486c5e){if(_0x486c5e[_0x3f9d('0x24')]){var _0x4641b2={'messageId':_0x486c5e[_0x3f9d('0x24')][0x0][_0x3f9d('0xb')]};if(!_0x51b732[_0x3f9d('0x43')]){_0x4641b2[_0x3f9d('0x44')]=!![];}return _0x57096c[_0x3f9d('0x1a')](_0x4641b2);}else{return logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),'afterCreate',_0x3f9d('0x58'),util[_0x3f9d('0x2d')](_0x486c5e,{'showHidden':![],'depth':null}));}});})[_0x3f9d('0x1c')](function(_0x5ab2d9){return logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),_0x3f9d('0x2c'),_0x3f9d('0x58'),util['inspect'](_0x5ab2d9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3f9d('0x2e'),_0x3f9d('0x2c'),_0x3f9d('0x58'),_0x3f9d('0x5c'));}}else{logger['error'](_0x3f9d('0x2e'),_0x3f9d('0x2c'),'infobip',_0x3f9d('0x3e'));}break;case'csc':var _0x276b67=require(_0x3f9d('0x5d'));if(_0x51b732['apiKey']){var _0x4c4637={};_0x4c4637[_0x3f9d('0x5e')]=_0x51b732[_0x3f9d('0x47')];_0x4c4637['phone']=_0x3419cd[_0x3f9d('0x26')];_0x4c4637[_0x3f9d('0x34')]=_0x51b732[_0x3f9d('0x26')];_0x4c4637[_0x3f9d('0x5f')]=_0x3419cd[_0x3f9d('0xd')];_0x4c4637[_0x3f9d('0x60')]=+new Date();var _0xb2c604='';var _0x981ec3='';var _0xef55ba=Object[_0x3f9d('0x61')](_0x4c4637);_0xef55ba[_0x3f9d('0x62')]();for(var _0x4ad5c8=0x0;_0x4ad5c8<_0xef55ba[_0x3f9d('0x63')];_0x4ad5c8++){if(_0xb2c604!=''){_0xb2c604+='&';}_0xb2c604+=_0xef55ba[_0x4ad5c8]+'='+encodeURIComponent(_0x4c4637[_0xef55ba[_0x4ad5c8]]);_0x981ec3+=_0x4c4637[_0xef55ba[_0x4ad5c8]];}_0x981ec3+=_0x51b732['apiKey'];_0x981ec3=_0x276b67[_0x3f9d('0x64')]('md5')[_0x3f9d('0x1a')](_0x981ec3)[_0x3f9d('0x65')](_0x3f9d('0x66'));if(_0xb2c604!==''){_0xb2c604+='&';}_0xb2c604+='signature='+_0x981ec3;var _0x4a80ef={'method':'GET','uri':_0x51b732[_0x3f9d('0x59')]+_0x3f9d('0x67')+_0xb2c604,'json':!![]};return rp(_0x4a80ef)['then'](function(_0x3f1ed5){var _0x1de93d=Object['keys'](_0x3f1ed5);if(_0x3f1ed5[_0x1de93d[0x0]][_0x3f9d('0x1d')]&&parseInt(_0x3f1ed5[_0x1de93d[0x0]][_0x3f9d('0x1d')])===0x0){var _0x3a5705={'messageId':_0x3f1ed5[_0x1de93d[0x0]][_0x3f9d('0x68')]};if(!_0x51b732[_0x3f9d('0x43')]){_0x3a5705[_0x3f9d('0x44')]=!![];}return _0x57096c[_0x3f9d('0x1a')](_0x3a5705);}else{return logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),_0x3f9d('0x2c'),_0x3f9d('0x69'),util[_0x3f9d('0x2d')](_0x3f1ed5[_0x3f9d('0x1d')],{'showHidden':![],'depth':null}));}})[_0x3f9d('0x1c')](function(_0x57d139){return logger[_0x3f9d('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f9d('0x2c'),'csc',util['inspect'](_0x57d139,{'showHidden':![],'depth':null}));});}else{logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),_0x3f9d('0x2c'),'csc',_0x3f9d('0x6a'));}break;case _0x3f9d('0x6b'):if(_0x51b732[_0x3f9d('0x6c')]){var _0x7c40bc={'method':_0x3f9d('0x49'),'uri':_0x3f9d('0x6d'),'headers':{'Authorization':_0x51b732[_0x3f9d('0x6c')]},'body':{'content':_0x3419cd['body'],'to':[_0x3419cd[_0x3f9d('0x26')]],'from':_0x51b732['phone'],'binary':![],'clientMessageId':_0x3f9d('0x6e'),'charset':'UTF-8'},'json':!![]};rp(_0x7c40bc)['then'](function(_0x33454d){if(!_0x33454d[_0x3f9d('0x1d')]){var _0x46b2bd={'messageId':_0x33454d['messages'][0x0][_0x3f9d('0x6f')]};if(!_0x51b732['deliveryReport']){_0x46b2bd[_0x3f9d('0x44')]=!![];}return _0x57096c[_0x3f9d('0x1a')](_0x46b2bd);}else{return logger['error'](_0x3f9d('0x2e'),_0x3f9d('0x2c'),_0x3f9d('0x6b'),util[_0x3f9d('0x2d')](_0x33454d['error'],{'showHidden':![],'depth':null}));}})[_0x3f9d('0x1c')](function(_0x330889){return logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),'afterCreate','clickatell',util[_0x3f9d('0x2d')](_0x330889,{'showHidden':![],'depth':null}));});}else{logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),_0x3f9d('0x2c'),_0x3f9d('0x6b'),_0x3f9d('0x6a'));}break;case _0x3f9d('0x70'):if(_0x51b732['username']&&_0x51b732['password']){var _0x54f2db=util[_0x3f9d('0x4b')]('%s:%s',_0x51b732[_0x3f9d('0x47')],_0x51b732[_0x3f9d('0x37')]);var _0x36442a={'method':'POST','uri':_0x3f9d('0x71')+_0x51b732[_0x3f9d('0x72')]+_0x3f9d('0x73'),'body':{'to':[_0x3419cd[_0x3f9d('0x26')]],'text':_0x3419cd[_0x3f9d('0xd')],'from':_0x51b732[_0x3f9d('0x26')],'applicationId':_0x51b732[_0x3f9d('0x74')]},'headers':{'Authorization':util['format'](_0x3f9d('0x4c'),new Buffer(_0x54f2db)['toString'](_0x3f9d('0x4e')))},'json':!![]};rp(_0x36442a)[_0x3f9d('0x38')](function(_0x185d86){if(_0x185d86['id']){var _0x59d494={'messageId':_0x185d86['id']};return _0x57096c[_0x3f9d('0x1a')](_0x59d494);}else{logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),'afterCreate',_0x3f9d('0x70'),util[_0x3f9d('0x2d')](_0x185d86,{'showHidden':![],'depth':null}));}})[_0x3f9d('0x1c')](function(_0x37cf00){logger[_0x3f9d('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3f9d('0x2c'),_0x3f9d('0x70'),util['inspect'](_0x37cf00,{'showHidden':![],'depth':null}));});}else{logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),_0x3f9d('0x2c'),_0x3f9d('0x70'),_0x3f9d('0x3e'));}break;case _0x3f9d('0x75'):if(_0x51b732['apiKey']){var _0x42de1b={};var _0x4a80ef={'method':_0x3f9d('0x49'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x51b732[_0x3f9d('0x6c')],'Content-Type':'application/json'},'body':{'from':_0x51b732[_0x3f9d('0x26')],'to':_0x3419cd['phone'],'text':_0x3419cd[_0x3f9d('0xd')]},'json':!![]};return rp(_0x4a80ef)['then'](function(_0xf3bb06){if(_0xf3bb06['code']==0xca){_0x42de1b[_0x3f9d('0x76')]=_0xf3bb06;var _0x173b5e={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x51b732[_0x3f9d('0x6c')],'Content-Type':_0x3f9d('0x77')},'body':{'refid':_0x42de1b[_0x3f9d('0x76')][_0x3f9d('0x78')]},'json':!![]};return rp(_0x173b5e)[_0x3f9d('0x38')](function(_0x932c32){_0x42de1b[_0x3f9d('0x79')]=_0x932c32;var _0x43c819={'messageId':_0x42de1b[_0x3f9d('0x76')][_0x3f9d('0x78')],'read':!![]};return _0x57096c[_0x3f9d('0x1a')](_0x43c819);});}else{return logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),_0x3f9d('0x2c'),'intelepeer',util[_0x3f9d('0x2d')](_0xf3bb06,{'showHidden':![],'depth':null}));}})[_0x3f9d('0x1c')](function(_0x2b84a2){return logger[_0x3f9d('0x1d')](_0x3f9d('0x2e'),_0x3f9d('0x2c'),'intelepeer',util[_0x3f9d('0x2d')](_0x2b84a2,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3f9d('0x75'),_0x3f9d('0x7a'));}break;}}})['finally'](function(){_0x42d01f();});}else{_0x42d01f();}}},'charset':_0x3f9d('0x7b'),'collate':_0x3f9d('0x7c')});}; \ No newline at end of file +var _0xefe0=['bluebird','request-promise','path','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','models','direction','toLowerCase','isNil','UserId','SmsInteractionId','findOne','then','update','catch','error','out','secret','find','type','twilio','accountSid','phone','authToken','messages','create','body','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','POST','user_key','session_key','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','head','clickSend','plivo','authId','remote','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','keys','sort','length','createHash','md5','hex','signature=','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','../../config/logger','api','moment'];(function(_0x3cd91d,_0x163516){var _0x3b4fab=function(_0x1b3319){while(--_0x1b3319){_0x3cd91d['push'](_0x3cd91d['shift']());}};_0x3b4fab(++_0x163516);}(_0xefe0,0x71));var _0x0efe=function(_0x4a23a9,_0x17a2c0){_0x4a23a9=_0x4a23a9-0x0;var _0x18c27f=_0xefe0[_0x4a23a9];return _0x18c27f;};'use strict';var _=require(_0x0efe('0x0'));var util=require('util');var logger=require(_0x0efe('0x1'))(_0x0efe('0x2'));var moment=require(_0x0efe('0x3'));var BPromise=require(_0x0efe('0x4'));var rp=require(_0x0efe('0x5'));var fs=require('fs');var path=require(_0x0efe('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0efe('0x7'));module['exports']=function(_0x35cbf8,_0x43ebd0){return _0x35cbf8[_0x0efe('0x8')](_0x0efe('0x9'),attributes,{'tableName':_0x0efe('0xa'),'paranoid':![],'indexes':[{'name':_0x0efe('0xb'),'fields':['messageId']},{'name':'fti_sms_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a14e7,_0x250700,_0x2a6d72){var _0x5f0a2a=_0x35cbf8[_0x0efe('0xc')];var _0x4d8ca1=_0x3a14e7['get']({'plain':!![]});if(_0x4d8ca1[_0x0efe('0xd')][_0x0efe('0xe')]()==='in'||_0x4d8ca1[_0x0efe('0xd')]['toLowerCase']()==='out'&&!_0x4d8ca1['secret']&&!_[_0x0efe('0xf')](_0x4d8ca1[_0x0efe('0x10')])&&!_[_0x0efe('0xf')](_0x4d8ca1[_0x0efe('0x11')])){_0x5f0a2a['SmsInteraction'][_0x0efe('0x12')]({'where':{'id':_0x4d8ca1[_0x0efe('0x11')]}})[_0x0efe('0x13')](function(_0x11940e){if(_0x11940e){_0x11940e[_0x0efe('0x14')]({'lastMsgAt':_0x4d8ca1['createdAt'],'lastMsgDirection':_0x4d8ca1[_0x0efe('0xd')][_0x0efe('0xe')]()});}})[_0x0efe('0x15')](function(_0x3b2137){console[_0x0efe('0x16')](_0x3b2137);});}if(_0x4d8ca1['direction']===_0x0efe('0x17')&&!_0x4d8ca1[_0x0efe('0x18')]){var _0x3f67ff;_0x5f0a2a['SmsAccount'][_0x0efe('0x19')]({'where':{'id':_0x4d8ca1['SmsAccountId']},'raw':!![]})[_0x0efe('0x13')](function(_0x136ed1){_0x3f67ff=_0x136ed1;if(_0x3f67ff&&_0x3f67ff['type']){switch(_0x3f67ff[_0x0efe('0x1a')]){case _0x0efe('0x1b'):var _0x440b2a=require('twilio');if(_0x3f67ff[_0x0efe('0x1c')]&&_0x3f67ff['authToken']&&_0x3f67ff[_0x0efe('0x1d')]){var _0x29db54=new _0x440b2a(_0x3f67ff[_0x0efe('0x1c')],_0x3f67ff[_0x0efe('0x1e')]);_0x29db54[_0x0efe('0x1f')][_0x0efe('0x20')]({'body':_0x4d8ca1[_0x0efe('0x21')],'to':_0x4d8ca1[_0x0efe('0x1d')],'from':_0x3f67ff[_0x0efe('0x1d')],'statusCallback':_0x3f67ff['remote']+_0x0efe('0x22')+_0x4d8ca1['id']+'/status?token='+_0x3f67ff[_0x0efe('0x23')]})[_0x0efe('0x13')](function(_0x294acf){if(_0x294acf[_0x0efe('0x24')]){return _0x3a14e7[_0x0efe('0x14')]({'messageId':_0x294acf[_0x0efe('0x24')]});}})[_0x0efe('0x15')](function(_0x1ad746){logger[_0x0efe('0x16')](_0x0efe('0x25'),_0x0efe('0x26'),_0x0efe('0x1b'),util['inspect'](_0x1ad746,{'showHidden':![],'depth':null}));});}else{logger[_0x0efe('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0efe('0x26'),_0x0efe('0x1b'),_0x0efe('0x27'));}break;case _0x0efe('0x28'):var _0x1980ae=_0x0efe('0x29');if(_0x3f67ff['username']&&_0x3f67ff[_0x0efe('0x2a')]){var _0x35b2f2={'recipient':[_0x4d8ca1[_0x0efe('0x1d')]],'message':_0x4d8ca1['body'],'message_type':_0x3f67ff[_0x0efe('0x2b')]};if(_0x3f67ff[_0x0efe('0x2b')]&&_0x3f67ff[_0x0efe('0x2b')]!=='SI'){_0x35b2f2[_0x0efe('0x2c')]=_0x3f67ff[_0x0efe('0x1d')];}var _0x2c76ab={'url':_0x1980ae+_0x0efe('0x2d')+_0x3f67ff[_0x0efe('0x2e')]+_0x0efe('0x2f')+_0x3f67ff[_0x0efe('0x2a')],'method':_0x0efe('0x30')};rp(_0x2c76ab)[_0x0efe('0x13')](function(_0x45a1b1){var _0x41138a=_0x45a1b1[_0x0efe('0x31')](';');var _0x596cdc={'user_key':_0x41138a[0x0],'session_key':_0x41138a[0x1]};_0x2c76ab={'url':_0x1980ae+'sms','method':_0x0efe('0x32'),'headers':{'user_key':_0x596cdc[_0x0efe('0x33')],'Session_key':_0x596cdc[_0x0efe('0x34')]},'json':!![],'body':_0x35b2f2};return rp(_0x2c76ab);})[_0x0efe('0x13')](function(_0x539ca6){if(_0x539ca6['total_sent']>=0x1){var _0x567064={'messageId':_0x539ca6['internal_order_id']};if(_0x3f67ff[_0x0efe('0x2b')]!=='GP'||!_0x3f67ff['deliveryReport']){_0x567064[_0x0efe('0x35')]=!![];}return _0x3a14e7[_0x0efe('0x14')](_0x567064);}else{return logger[_0x0efe('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0efe('0x26'),_0x0efe('0x28'),util[_0x0efe('0x36')](_0x539ca6,{'showHidden':![],'depth':null}));}})['catch'](function(_0x445e48){return logger[_0x0efe('0x16')](_0x0efe('0x25'),_0x0efe('0x26'),_0x0efe('0x28'),util[_0x0efe('0x36')](_0x445e48,{'showHidden':![],'depth':null}));});}else{logger[_0x0efe('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0efe('0x26'),'skebby',_0x0efe('0x37'));}break;case _0x0efe('0x38'):if(_0x3f67ff[_0x0efe('0x1e')]){var _0x29fd84={'recipient':_0x4d8ca1[_0x0efe('0x1d')],'message':_0x4d8ca1[_0x0efe('0x21')],'sender':_0x3f67ff[_0x0efe('0x39')]||_0x3f67ff[_0x0efe('0x1d')],'authorization':_0x3f67ff[_0x0efe('0x1e')]};var _0x250700={'method':'POST','uri':_0x0efe('0x3a'),'body':_0x29fd84,'json':!![]};rp(_0x250700)[_0x0efe('0x13')](function(_0x1d0836){var _0x4cf003={'messageId':_0x1d0836[_0x0efe('0x3b')]};if(!_0x3f67ff[_0x0efe('0x3c')]){_0x4cf003[_0x0efe('0x35')]=!![];}return _0x3a14e7['update'](_0x4cf003);})[_0x0efe('0x15')](function(_0x38a721){logger[_0x0efe('0x16')](_0x0efe('0x25'),_0x0efe('0x26'),'connectel',util['inspect'](_0x38a721,{'showHidden':![],'depth':null}));});}else{logger[_0x0efe('0x16')](_0x0efe('0x25'),_0x0efe('0x26'),_0x0efe('0x38'),_0x0efe('0x3d'));}break;case'clicksend':if(_0x3f67ff['username']&&_0x3f67ff[_0x0efe('0x2a')]){var _0x29fd84={'messages':[{'source':'xCALLY\x20Motion','to':_0x4d8ca1[_0x0efe('0x1d')],'body':_0x4d8ca1[_0x0efe('0x21')],'from':_0x3f67ff[_0x0efe('0x39')]||_0x3f67ff[_0x0efe('0x1d')]}]};var _0x4044a2=util[_0x0efe('0x3e')](_0x0efe('0x3f'),_0x3f67ff[_0x0efe('0x2e')],_0x3f67ff[_0x0efe('0x2a')]);var _0x250700={'method':_0x0efe('0x32'),'uri':_0x0efe('0x40'),'body':_0x29fd84,'headers':{'Authorization':util[_0x0efe('0x3e')]('Basic\x20%s',new Buffer(_0x4044a2)[_0x0efe('0x41')](_0x0efe('0x42')))},'json':!![]};rp(_0x250700)[_0x0efe('0x13')](function(_0x3f9157){if(_0x3f9157[_0x0efe('0x43')]>=0xc8&&_0x3f9157[_0x0efe('0x43')]<=0xce){if(_0x3f9157[_0x0efe('0x44')]&&_0x3f9157[_0x0efe('0x44')]['queued_count']>0x0){var _0xa5eeeb=_[_0x0efe('0x45')](_0x3f9157[_0x0efe('0x44')]['messages']);var _0x46c91c={'messageId':_0xa5eeeb['message_id']};if(!_0x3f67ff[_0x0efe('0x3c')]){_0x46c91c['read']=!![];}return _0x3a14e7[_0x0efe('0x14')](_0x46c91c);}else{logger['error'](_0x0efe('0x25'),'afterCreate',_0x0efe('0x46'),util[_0x0efe('0x36')](_0x3f9157,{'showHidden':![],'depth':null}));}}else{logger[_0x0efe('0x16')](_0x0efe('0x25'),_0x0efe('0x26'),_0x0efe('0x46'),util[_0x0efe('0x36')](_0x3f9157,{'showHidden':![],'depth':null}));}})['catch'](function(_0x129d38){logger[_0x0efe('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0efe('0x26'),'clickSend',util[_0x0efe('0x36')](_0x129d38,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0efe('0x25'),'afterCreate',_0x0efe('0x46'),_0x0efe('0x37'));}break;case _0x0efe('0x47'):if(_0x3f67ff[_0x0efe('0x48')]&&_0x3f67ff[_0x0efe('0x1e')]){var _0x29fd84={'dst':_0x4d8ca1[_0x0efe('0x1d')],'text':_0x4d8ca1[_0x0efe('0x21')],'src':_0x3f67ff['senderString']||_0x3f67ff[_0x0efe('0x1d')],'url':_0x3f67ff[_0x0efe('0x49')]+_0x0efe('0x22')+_0x4d8ca1['id']+_0x0efe('0x4a')+_0x3f67ff[_0x0efe('0x23')]};var _0x4044a2=util[_0x0efe('0x3e')](_0x0efe('0x3f'),_0x3f67ff[_0x0efe('0x48')],_0x3f67ff[_0x0efe('0x1e')]);var _0x250700={'method':_0x0efe('0x32'),'uri':util[_0x0efe('0x3e')](_0x0efe('0x4b'),_0x3f67ff['authId']),'body':_0x29fd84,'headers':{'Authorization':util[_0x0efe('0x3e')](_0x0efe('0x4c'),new Buffer(_0x4044a2)[_0x0efe('0x41')]('base64'))},'json':!![]};rp(_0x250700)[_0x0efe('0x13')](function(_0x221023){var _0x251884={'messageId':_0x221023[_0x0efe('0x4d')][0x0]};return _0x3a14e7[_0x0efe('0x14')](_0x251884);})[_0x0efe('0x15')](function(_0x2d6b51){logger[_0x0efe('0x16')](_0x0efe('0x25'),'afterCreate',_0x0efe('0x47'),util[_0x0efe('0x36')](_0x2d6b51,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0efe('0x25'),_0x0efe('0x26'),_0x0efe('0x47'),_0x0efe('0x4e'));}break;case'infobip':if(_0x3f67ff[_0x0efe('0x2e')]&&_0x3f67ff[_0x0efe('0x2a')]){if(_0x3f67ff[_0x0efe('0x4f')]){var _0x1de69a={'method':_0x0efe('0x32'),'uri':_0x3f67ff['baseUrl']+_0x0efe('0x50'),'body':{'username':_0x3f67ff[_0x0efe('0x2e')],'password':_0x3f67ff[_0x0efe('0x2a')]},'json':!![]};return rp(_0x1de69a)[_0x0efe('0x13')](function(_0x22e02d){var _0x563ed9={'method':_0x0efe('0x32'),'uri':_0x3f67ff[_0x0efe('0x4f')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3f67ff[_0x0efe('0x1d')],'destinations':[{'to':_0x4d8ca1['phone']}],'text':_0x4d8ca1['body'],'notifyUrl':_0x3f67ff[_0x0efe('0x49')]+'/api/sms/messages/'+_0x4d8ca1['id']+'/status?token='+_0x3f67ff[_0x0efe('0x23')],'notifyContentType':_0x0efe('0x51'),'callbackData':_0x3f67ff[_0x0efe('0x1d')]+';'+_0x4d8ca1['body']}]},'headers':{'Authorization':_0x0efe('0x52')+_0x22e02d['token']},'json':!![]};return rp(_0x563ed9)[_0x0efe('0x13')](function(_0x1be84c){if(_0x1be84c[_0x0efe('0x1f')]){var _0x4f604d={'messageId':_0x1be84c[_0x0efe('0x1f')][0x0]['messageId']};if(!_0x3f67ff['deliveryReport']){_0x4f604d['read']=!![];}return _0x3a14e7['update'](_0x4f604d);}else{return logger[_0x0efe('0x16')](_0x0efe('0x25'),'afterCreate',_0x0efe('0x53'),util[_0x0efe('0x36')](_0x1be84c,{'showHidden':![],'depth':null}));}});})[_0x0efe('0x15')](function(_0x536c6d){return logger[_0x0efe('0x16')](_0x0efe('0x25'),_0x0efe('0x26'),_0x0efe('0x53'),util[_0x0efe('0x36')](_0x536c6d,{'showHidden':![],'depth':null}));});}else{logger[_0x0efe('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0efe('0x26'),_0x0efe('0x53'),_0x0efe('0x54'));}}else{logger['error'](_0x0efe('0x25'),_0x0efe('0x26'),_0x0efe('0x53'),_0x0efe('0x37'));}break;case _0x0efe('0x55'):var _0x19788c=require(_0x0efe('0x56'));if(_0x3f67ff[_0x0efe('0x57')]){var _0x379617={};_0x379617['login']=_0x3f67ff[_0x0efe('0x2e')];_0x379617[_0x0efe('0x1d')]=_0x4d8ca1[_0x0efe('0x1d')];_0x379617[_0x0efe('0x2c')]=_0x3f67ff[_0x0efe('0x1d')];_0x379617[_0x0efe('0x58')]=_0x4d8ca1[_0x0efe('0x21')];_0x379617['timestamp']=+new Date();var _0x131705='';var _0x4c85f2='';var _0x3beb6c=Object[_0x0efe('0x59')](_0x379617);_0x3beb6c[_0x0efe('0x5a')]();for(var _0x4c014f=0x0;_0x4c014f<_0x3beb6c[_0x0efe('0x5b')];_0x4c014f++){if(_0x131705!=''){_0x131705+='&';}_0x131705+=_0x3beb6c[_0x4c014f]+'='+encodeURIComponent(_0x379617[_0x3beb6c[_0x4c014f]]);_0x4c85f2+=_0x379617[_0x3beb6c[_0x4c014f]];}_0x4c85f2+=_0x3f67ff['apiKey'];_0x4c85f2=_0x19788c[_0x0efe('0x5c')](_0x0efe('0x5d'))[_0x0efe('0x14')](_0x4c85f2)['digest'](_0x0efe('0x5e'));if(_0x131705!==''){_0x131705+='&';}_0x131705+=_0x0efe('0x5f')+_0x4c85f2;var _0x2c76ab={'method':_0x0efe('0x30'),'uri':_0x3f67ff['baseUrl']+'/external/get/send.php?'+_0x131705,'json':!![]};return rp(_0x2c76ab)[_0x0efe('0x13')](function(_0x1a48f1){var _0x5ad8f4=Object['keys'](_0x1a48f1);if(_0x1a48f1[_0x5ad8f4[0x0]]['error']&&parseInt(_0x1a48f1[_0x5ad8f4[0x0]][_0x0efe('0x16')])===0x0){var _0x1365b6={'messageId':_0x1a48f1[_0x5ad8f4[0x0]]['id_sms']};if(!_0x3f67ff[_0x0efe('0x3c')]){_0x1365b6[_0x0efe('0x35')]=!![];}return _0x3a14e7[_0x0efe('0x14')](_0x1365b6);}else{return logger['error'](_0x0efe('0x25'),_0x0efe('0x26'),'csc',util[_0x0efe('0x36')](_0x1a48f1[_0x0efe('0x16')],{'showHidden':![],'depth':null}));}})[_0x0efe('0x15')](function(_0x10097f){return logger[_0x0efe('0x16')](_0x0efe('0x25'),'afterCreate','csc',util[_0x0efe('0x36')](_0x10097f,{'showHidden':![],'depth':null}));});}else{logger[_0x0efe('0x16')](_0x0efe('0x25'),_0x0efe('0x26'),_0x0efe('0x55'),_0x0efe('0x60'));}break;case _0x0efe('0x61'):if(_0x3f67ff[_0x0efe('0x57')]){var _0x20b64e={'method':_0x0efe('0x32'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3f67ff['apiKey']},'body':{'content':_0x4d8ca1['body'],'to':[_0x4d8ca1[_0x0efe('0x1d')]],'from':_0x3f67ff[_0x0efe('0x1d')],'binary':![],'clientMessageId':_0x0efe('0x62'),'charset':_0x0efe('0x63')},'json':!![]};rp(_0x20b64e)['then'](function(_0x1a1eb2){if(!_0x1a1eb2[_0x0efe('0x16')]){var _0x589313={'messageId':_0x1a1eb2['messages'][0x0][_0x0efe('0x64')]};if(!_0x3f67ff[_0x0efe('0x3c')]){_0x589313[_0x0efe('0x35')]=!![];}return _0x3a14e7[_0x0efe('0x14')](_0x589313);}else{return logger[_0x0efe('0x16')](_0x0efe('0x25'),_0x0efe('0x26'),'clickatell',util[_0x0efe('0x36')](_0x1a1eb2[_0x0efe('0x16')],{'showHidden':![],'depth':null}));}})[_0x0efe('0x15')](function(_0x4f95ab){return logger[_0x0efe('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0efe('0x26'),_0x0efe('0x61'),util[_0x0efe('0x36')](_0x4f95ab,{'showHidden':![],'depth':null}));});}else{logger[_0x0efe('0x16')](_0x0efe('0x25'),_0x0efe('0x26'),'clickatell',_0x0efe('0x60'));}break;case _0x0efe('0x65'):if(_0x3f67ff['username']&&_0x3f67ff[_0x0efe('0x2a')]){var _0x4044a2=util[_0x0efe('0x3e')](_0x0efe('0x3f'),_0x3f67ff[_0x0efe('0x2e')],_0x3f67ff['password']);var _0x250700={'method':'POST','uri':_0x0efe('0x66')+_0x3f67ff[_0x0efe('0x67')]+_0x0efe('0x68'),'body':{'to':[_0x4d8ca1[_0x0efe('0x1d')]],'text':_0x4d8ca1[_0x0efe('0x21')],'from':_0x3f67ff['phone'],'applicationId':_0x3f67ff[_0x0efe('0x69')]},'headers':{'Authorization':util['format'](_0x0efe('0x4c'),new Buffer(_0x4044a2)[_0x0efe('0x41')](_0x0efe('0x42')))},'json':!![]};rp(_0x250700)[_0x0efe('0x13')](function(_0x55a7e4){if(_0x55a7e4['id']){var _0x2d3937={'messageId':_0x55a7e4['id']};return _0x3a14e7[_0x0efe('0x14')](_0x2d3937);}else{logger[_0x0efe('0x16')](_0x0efe('0x25'),_0x0efe('0x26'),_0x0efe('0x65'),util[_0x0efe('0x36')](_0x55a7e4,{'showHidden':![],'depth':null}));}})[_0x0efe('0x15')](function(_0x1096d0){logger[_0x0efe('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0efe('0x65'),util[_0x0efe('0x36')](_0x1096d0,{'showHidden':![],'depth':null}));});}else{logger[_0x0efe('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0efe('0x26'),_0x0efe('0x65'),_0x0efe('0x37'));}break;case'intelepeer':if(_0x3f67ff[_0x0efe('0x57')]){var _0x40fe88={};var _0x2c76ab={'method':_0x0efe('0x32'),'uri':_0x0efe('0x6a'),'headers':{'Authorization':'Bearer\x20'+_0x3f67ff[_0x0efe('0x57')],'Content-Type':'application/json'},'body':{'from':_0x3f67ff[_0x0efe('0x1d')],'to':_0x4d8ca1[_0x0efe('0x1d')],'text':_0x4d8ca1[_0x0efe('0x21')]},'json':!![]};return rp(_0x2c76ab)['then'](function(_0x36e603){if(_0x36e603[_0x0efe('0x6b')]==0xca){_0x40fe88[_0x0efe('0x6c')]=_0x36e603;var _0x37bbe6={'method':_0x0efe('0x32'),'uri':_0x0efe('0x6d'),'headers':{'Authorization':_0x0efe('0x6e')+_0x3f67ff[_0x0efe('0x57')],'Content-Type':_0x0efe('0x51')},'body':{'refid':_0x40fe88[_0x0efe('0x6c')][_0x0efe('0x6f')]},'json':!![]};return rp(_0x37bbe6)[_0x0efe('0x13')](function(_0x5c1732){_0x40fe88[_0x0efe('0x70')]=_0x5c1732;var _0x164e25={'messageId':_0x40fe88[_0x0efe('0x6c')][_0x0efe('0x6f')],'read':!![]};return _0x3a14e7[_0x0efe('0x14')](_0x164e25);});}else{return logger[_0x0efe('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0efe('0x26'),_0x0efe('0x71'),util[_0x0efe('0x36')](_0x36e603,{'showHidden':![],'depth':null}));}})[_0x0efe('0x15')](function(_0x14059f){return logger[_0x0efe('0x16')](_0x0efe('0x25'),'afterCreate',_0x0efe('0x71'),util[_0x0efe('0x36')](_0x14059f,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x0efe('0x25'),_0x0efe('0x26'),'intelepeer',_0x0efe('0x72'));}break;}}})[_0x0efe('0x73')](function(){_0x2a6d72();});}else{_0x2a6d72();}}},'charset':_0x0efe('0x74'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 32ea599..8eb3de4 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 _0x69d1=['debug','request\x20sent','stringify','error','code','message','info','result','catch','CreateSmsMessage','create','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','./smsMessage.socket','register','request','SmsMessage,\x20%s,\x20%s'];(function(_0x4b900c,_0x3843fe){var _0x20a4d6=function(_0x383b37){while(--_0x383b37){_0x4b900c['push'](_0x4b900c['shift']());}};_0x20a4d6(++_0x3843fe);}(_0x69d1,0x162));var _0x169d=function(_0x2e6141,_0x2bcaf1){_0x2e6141=_0x2e6141-0x0;var _0x432b18=_0x69d1[_0x2e6141];return _0x432b18;};'use strict';var _=require(_0x169d('0x0'));var util=require(_0x169d('0x1'));var moment=require('moment');var BPromise=require(_0x169d('0x2'));var rs=require(_0x169d('0x3'));var fs=require('fs');var Redis=require(_0x169d('0x4'));var db=require(_0x169d('0x5'))['db'];var utils=require(_0x169d('0x6'));var logger=require(_0x169d('0x7'))(_0x169d('0x8'));var config=require(_0x169d('0x9'));var jayson=require(_0x169d('0xa'));var client=jayson[_0x169d('0xb')]['http']({'port':0x232a});config['redis']=_[_0x169d('0xc')](config[_0x169d('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x169d('0xd')]));require(_0x169d('0xe'))[_0x169d('0xf')](socket);function respondWithRpcPromise(_0x411148,_0x204977,_0x1f3b89){return new BPromise(function(_0x439e95,_0x1dd1a8){return client[_0x169d('0x10')](_0x411148,_0x1f3b89)['then'](function(_0x70bb45){logger['info'](_0x169d('0x11'),_0x204977,'request\x20sent');logger[_0x169d('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x204977,_0x169d('0x13'),JSON[_0x169d('0x14')](_0x70bb45));if(_0x70bb45[_0x169d('0x15')]){if(_0x70bb45['error'][_0x169d('0x16')]===0x1f4){logger[_0x169d('0x15')]('SmsMessage,\x20%s,\x20%s',_0x204977,_0x70bb45[_0x169d('0x15')]['message']);return _0x1dd1a8(_0x70bb45[_0x169d('0x15')][_0x169d('0x17')]);}logger[_0x169d('0x15')](_0x169d('0x11'),_0x204977,_0x70bb45['error'][_0x169d('0x17')]);return _0x439e95(_0x70bb45[_0x169d('0x15')][_0x169d('0x17')]);}else{logger[_0x169d('0x18')]('SmsMessage,\x20%s,\x20%s',_0x204977,_0x169d('0x13'));_0x439e95(_0x70bb45[_0x169d('0x19')][_0x169d('0x17')]);}})[_0x169d('0x1a')](function(_0x923a0f){logger['error'](_0x169d('0x11'),_0x204977,_0x923a0f);_0x1dd1a8(_0x923a0f);});});}exports[_0x169d('0x1b')]=function(_0x4b1660){var _0x75eed9=this;return new Promise(function(_0x2bba52,_0x4db26f){return db['SmsMessage'][_0x169d('0x1c')](_0x4b1660[_0x169d('0x1d')],{'raw':_0x4b1660[_0x169d('0x1e')]?_0x4b1660[_0x169d('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3befd5){logger[_0x169d('0x18')](_0x169d('0x1b'),_0x4b1660);logger['debug']('CreateSmsMessage',_0x4b1660,JSON[_0x169d('0x14')](_0x3befd5));_0x2bba52(_0x3befd5);})[_0x169d('0x1a')](function(_0x306bb3){logger[_0x169d('0x15')](_0x169d('0x1b'),_0x306bb3['message'],_0x4b1660);_0x4db26f(_0x75eed9['error'](0x1f4,_0x306bb3[_0x169d('0x17')]));});});}; \ No newline at end of file +var _0x48b8=['raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./smsMessage.socket','request','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','request\x20sent','result','CreateSmsMessage','create','body','options'];(function(_0x230d2a,_0x575d2e){var _0x3dddc1=function(_0x233594){while(--_0x233594){_0x230d2a['push'](_0x230d2a['shift']());}};_0x3dddc1(++_0x575d2e);}(_0x48b8,0x15d));var _0x848b=function(_0x1a9ae7,_0x5bbc22){_0x1a9ae7=_0x1a9ae7-0x0;var _0x47da32=_0x48b8[_0x1a9ae7];return _0x47da32;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x848b('0x0'));var BPromise=require(_0x848b('0x1'));var rs=require(_0x848b('0x2'));var fs=require('fs');var Redis=require(_0x848b('0x3'));var db=require(_0x848b('0x4'))['db'];var utils=require(_0x848b('0x5'));var logger=require(_0x848b('0x6'))(_0x848b('0x7'));var config=require('../../config/environment');var jayson=require(_0x848b('0x8'));var client=jayson[_0x848b('0x9')]['http']({'port':0x232a});config[_0x848b('0xa')]=_['defaults'](config['redis'],{'host':_0x848b('0xb'),'port':0x18eb});var socket=require(_0x848b('0xc'))(new Redis(config[_0x848b('0xa')]));require(_0x848b('0xd'))['register'](socket);function respondWithRpcPromise(_0x478d6d,_0x39a58b,_0x55ad59){return new BPromise(function(_0x5e9ce3,_0x226d37){return client[_0x848b('0xe')](_0x478d6d,_0x55ad59)['then'](function(_0x3ae194){logger[_0x848b('0xf')]('SmsMessage,\x20%s,\x20%s',_0x39a58b,'request\x20sent');logger[_0x848b('0x10')](_0x848b('0x11'),_0x39a58b,'request\x20sent',JSON[_0x848b('0x12')](_0x3ae194));if(_0x3ae194[_0x848b('0x13')]){if(_0x3ae194[_0x848b('0x13')]['code']===0x1f4){logger['error'](_0x848b('0x14'),_0x39a58b,_0x3ae194[_0x848b('0x13')][_0x848b('0x15')]);return _0x226d37(_0x3ae194['error'][_0x848b('0x15')]);}logger[_0x848b('0x13')](_0x848b('0x14'),_0x39a58b,_0x3ae194['error'][_0x848b('0x15')]);return _0x5e9ce3(_0x3ae194['error'][_0x848b('0x15')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x39a58b,_0x848b('0x16'));_0x5e9ce3(_0x3ae194[_0x848b('0x17')][_0x848b('0x15')]);}})['catch'](function(_0x28af2b){logger[_0x848b('0x13')]('SmsMessage,\x20%s,\x20%s',_0x39a58b,_0x28af2b);_0x226d37(_0x28af2b);});});}exports[_0x848b('0x18')]=function(_0x3b4a4e){var _0x898f5b=this;return new Promise(function(_0x39cbdf,_0x4ac23b){return db['SmsMessage'][_0x848b('0x19')](_0x3b4a4e[_0x848b('0x1a')],{'raw':_0x3b4a4e[_0x848b('0x1b')]?_0x3b4a4e['options'][_0x848b('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x13e2b3){logger[_0x848b('0xf')]('CreateSmsMessage',_0x3b4a4e);logger['debug'](_0x848b('0x18'),_0x3b4a4e,JSON['stringify'](_0x13e2b3));_0x39cbdf(_0x13e2b3);})['catch'](function(_0x43227e){logger['error'](_0x848b('0x18'),_0x43227e[_0x848b('0x15')],_0x3b4a4e);_0x4ac23b(_0x898f5b[_0x848b('0x13')](0x1f4,_0x43227e[_0x848b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 4533058..de51825 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 _0x9741=['emit','removeListener','length','./smsMessage.events','save','remove'];(function(_0x31fcfc,_0x1bb14b){var _0x442438=function(_0x5a0242){while(--_0x5a0242){_0x31fcfc['push'](_0x31fcfc['shift']());}};_0x442438(++_0x1bb14b);}(_0x9741,0x1dd));var _0x1974=function(_0x5554ab,_0x52b733){_0x5554ab=_0x5554ab-0x0;var _0x13642f=_0x9741[_0x5554ab];return _0x13642f;};'use strict';var SmsMessageEvents=require(_0x1974('0x0'));var events=[_0x1974('0x1'),_0x1974('0x2'),'update'];function createListener(_0x337468,_0xade094){return function(_0x2730d3){_0xade094[_0x1974('0x3')](_0x337468,_0x2730d3);};}function removeListener(_0xd913a4,_0x58d09d){return function(){SmsMessageEvents[_0x1974('0x4')](_0xd913a4,_0x58d09d);};}exports['register']=function(_0x4878c7){for(var _0x534337=0x0,_0x384273=events[_0x1974('0x5')];_0x534337<_0x384273;_0x534337++){var _0x36109f=events[_0x534337];var _0x43f226=createListener('smsMessage:'+_0x36109f,_0x4878c7);SmsMessageEvents['on'](_0x36109f,_0x43f226);}}; \ No newline at end of file +var _0xabfb=['register','length','smsMessage:','./smsMessage.events','save','remove','update','emit','removeListener'];(function(_0x14c357,_0x13f5a7){var _0x598abd=function(_0x4734b9){while(--_0x4734b9){_0x14c357['push'](_0x14c357['shift']());}};_0x598abd(++_0x13f5a7);}(_0xabfb,0xff));var _0xbabf=function(_0x4a8418,_0x39078a){_0x4a8418=_0x4a8418-0x0;var _0x390174=_0xabfb[_0x4a8418];return _0x390174;};'use strict';var SmsMessageEvents=require(_0xbabf('0x0'));var events=[_0xbabf('0x1'),_0xbabf('0x2'),_0xbabf('0x3')];function createListener(_0x527292,_0x11b712){return function(_0x3d4a29){_0x11b712[_0xbabf('0x4')](_0x527292,_0x3d4a29);};}function removeListener(_0x2abc44,_0x2ab50f){return function(){SmsMessageEvents[_0xbabf('0x5')](_0x2abc44,_0x2ab50f);};}exports[_0xbabf('0x6')]=function(_0x71d20c){for(var _0x20dd61=0x0,_0x27abc4=events[_0xbabf('0x7')];_0x20dd61<_0x27abc4;_0x20dd61++){var _0x2605d6=events[_0x20dd61];var _0x1b7a43=createListener(_0xbabf('0x8')+_0x2605d6,_0x71d20c);SmsMessageEvents['on'](_0x2605d6,_0x1b7a43);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index f5fb39f..7b9216f 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 _0xb741=['/:id/teams','getTeams','getAgents','create','post','/:id/users','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','describe','show','/:id/members','getMembers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb741,0x70));var _0x1b74=function(_0x3603b1,_0xadfa8c){_0x3603b1=_0x3603b1-0x0;var _0x3af28a=_0xb741[_0x3603b1];return _0x3af28a;};'use strict';var multer=require(_0x1b74('0x0'));var util=require('util');var path=require(_0x1b74('0x1'));var timeout=require(_0x1b74('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1b74('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1b74('0x4'));var config=require(_0x1b74('0x5'));var controller=require(_0x1b74('0x6'));router[_0x1b74('0x7')]('/',auth[_0x1b74('0x8')](),controller['index']);router[_0x1b74('0x7')]('/describe',auth[_0x1b74('0x8')](),controller[_0x1b74('0x9')]);router[_0x1b74('0x7')]('/:id',auth[_0x1b74('0x8')](),controller[_0x1b74('0xa')]);router[_0x1b74('0x7')](_0x1b74('0xb'),auth['isAuthenticated'](),controller[_0x1b74('0xc')]);router['get'](_0x1b74('0xd'),auth[_0x1b74('0x8')](),controller[_0x1b74('0xe')]);router['get']('/:id/users',auth[_0x1b74('0x8')](),controller[_0x1b74('0xf')]);router['post']('/',auth[_0x1b74('0x8')](),controller[_0x1b74('0x10')]);router[_0x1b74('0x11')](_0x1b74('0xd'),auth[_0x1b74('0x8')](),controller['addTeams']);router[_0x1b74('0x11')](_0x1b74('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0x1b74('0x13')](_0x1b74('0x14'),auth[_0x1b74('0x8')](),controller[_0x1b74('0x15')]);router[_0x1b74('0x16')](_0x1b74('0x14'),auth[_0x1b74('0x8')](),controller[_0x1b74('0x17')]);router[_0x1b74('0x16')](_0x1b74('0xd'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x1b74('0x16')](_0x1b74('0x12'),auth[_0x1b74('0x8')](),controller['removeAgents']);module[_0x1b74('0x18')]=router; \ No newline at end of file +var _0x003a=['delete','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','/:id','show','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update'];(function(_0x177498,_0x51eb35){var _0x374c44=function(_0x3acdfb){while(--_0x3acdfb){_0x177498['push'](_0x177498['shift']());}};_0x374c44(++_0x51eb35);}(_0x003a,0xd6));var _0xa003=function(_0x1eb9a8,_0xba8a3b){_0x1eb9a8=_0x1eb9a8-0x0;var _0x240264=_0x003a[_0x1eb9a8];return _0x240264;};'use strict';var multer=require(_0xa003('0x0'));var util=require(_0xa003('0x1'));var path=require(_0xa003('0x2'));var timeout=require('connect-timeout');var express=require(_0xa003('0x3'));var router=express[_0xa003('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa003('0x5'));var interaction=require(_0xa003('0x6'));var config=require(_0xa003('0x7'));var controller=require(_0xa003('0x8'));router['get']('/',auth[_0xa003('0x9')](),controller[_0xa003('0xa')]);router[_0xa003('0xb')](_0xa003('0xc'),auth[_0xa003('0x9')](),controller['describe']);router[_0xa003('0xb')](_0xa003('0xd'),auth[_0xa003('0x9')](),controller[_0xa003('0xe')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0xa003('0xf')]);router[_0xa003('0xb')]('/:id/teams',auth['isAuthenticated'](),controller[_0xa003('0x10')]);router[_0xa003('0xb')](_0xa003('0x11'),auth[_0xa003('0x9')](),controller[_0xa003('0x12')]);router[_0xa003('0x13')]('/',auth[_0xa003('0x9')](),controller[_0xa003('0x14')]);router[_0xa003('0x13')](_0xa003('0x15'),auth['isAuthenticated'](),controller[_0xa003('0x16')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xa003('0x17')]);router[_0xa003('0x18')](_0xa003('0xd'),auth[_0xa003('0x9')](),controller[_0xa003('0x19')]);router[_0xa003('0x1a')](_0xa003('0xd'),auth[_0xa003('0x9')](),controller['destroy']);router[_0xa003('0x1a')](_0xa003('0x15'),auth[_0xa003('0x9')](),controller[_0xa003('0x1b')]);router[_0xa003('0x1a')](_0xa003('0x11'),auth[_0xa003('0x9')](),controller[_0xa003('0x1c')]);module[_0xa003('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 56d896f..d917099 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 _0xc98a=['STRING','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x5cfeb5,_0x46ac2e){var _0x3512f2=function(_0xc251c1){while(--_0xc251c1){_0x5cfeb5['push'](_0x5cfeb5['shift']());}};_0x3512f2(++_0x46ac2e);}(_0xc98a,0x1e1));var _0xac98=function(_0xaad24a,_0x1c7172){_0xaad24a=_0xaad24a-0x0;var _0x32df5b=_0xc98a[_0xaad24a];return _0x32df5b;};'use strict';var Sequelize=require(_0xac98('0x0'));module[_0xac98('0x1')]={'name':{'type':Sequelize[_0xac98('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xac98('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xac98('0x3')](_0xac98('0x4'),_0xac98('0x5'),_0xac98('0x6'))}}; \ No newline at end of file +var _0xbd55=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x116b79,_0x35112a){var _0x1762a6=function(_0x4ad99d){while(--_0x4ad99d){_0x116b79['push'](_0x116b79['shift']());}};_0x1762a6(++_0x35112a);}(_0xbd55,0xad));var _0x5bd5=function(_0x4e28c0,_0x1ef470){_0x4e28c0=_0x4e28c0-0x0;var _0x4039d4=_0xbd55[_0x4e28c0];return _0x4039d4;};'use strict';var Sequelize=require(_0x5bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x5bd5('0x1')],'unique':_0x5bd5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5bd5('0x1')]},'timeout':{'type':Sequelize[_0x5bd5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5bd5('0x4'),_0x5bd5('0x5'),_0x5bd5('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 1f02f35..2f0ca52 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 _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x179c0c,_0x20fe42){var _0x2ab663=function(_0x3b9c1f){while(--_0x3b9c1f){_0x179c0c['push'](_0x179c0c['shift']());}};_0x2ab663(++_0x20fe42);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file +var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x334c25,_0xf6f141){var _0xaca77b=function(_0x4eba92){while(--_0x4eba92){_0x334c25['push'](_0x334c25['shift']());}};_0xaca77b(++_0xf6f141);}(_0x2ef3,0xba));var _0x32ef=function(_0xd66bac,_0x4986b1){_0xd66bac=_0xd66bac-0x0;var _0x532151=_0x2ef3[_0xd66bac];return _0x532151;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 89de196..89331ca 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 _0xa7aa=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x566fc5,_0x23da1b){var _0x4c3837=function(_0x52930e){while(--_0x52930e){_0x566fc5['push'](_0x566fc5['shift']());}};_0x4c3837(++_0x23da1b);}(_0xa7aa,0xed));var _0xaa7a=function(_0x1774fa,_0x111ccc){_0x1774fa=_0x1774fa-0x0;var _0x2b6510=_0xa7aa[_0x1774fa];return _0x2b6510;};'use strict';var EventEmitter=require(_0xaa7a('0x0'));var SmsQueue=require(_0xaa7a('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xaa7a('0x2')](0x0);var events={'afterCreate':_0xaa7a('0x3'),'afterUpdate':_0xaa7a('0x4'),'afterDestroy':_0xaa7a('0x5')};function emitEvent(_0x2a024b){return function(_0x2ebab1,_0x4b45b6,_0x17f763){SmsQueueEvents[_0xaa7a('0x6')](_0x2a024b+':'+_0x2ebab1['id'],_0x2ebab1);SmsQueueEvents[_0xaa7a('0x6')](_0x2a024b,_0x2ebab1);_0x17f763(null);};}for(var e in events){if(events[_0xaa7a('0x7')](e)){var event=events[e];SmsQueue[_0xaa7a('0x8')](e,emitEvent(event));}}module[_0xaa7a('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x27be=['hook','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x27be,0x71));var _0xe27b=function(_0x570f09,_0x5c06ff){_0x570f09=_0x570f09-0x0;var _0x46819a=_0x27be[_0x570f09];return _0x46819a;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0xe27b('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe27b('0x1')](0x0);var events={'afterCreate':_0xe27b('0x2'),'afterUpdate':_0xe27b('0x3'),'afterDestroy':_0xe27b('0x4')};function emitEvent(_0x487285){return function(_0x57330c,_0x322da6,_0x52f7bf){SmsQueueEvents[_0xe27b('0x5')](_0x487285+':'+_0x57330c['id'],_0x57330c);SmsQueueEvents[_0xe27b('0x5')](_0x487285,_0x57330c);_0x52f7bf(null);};}for(var e in events){if(events[_0xe27b('0x6')](e)){var event=events[e];SmsQueue[_0xe27b('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index b5a4aac..bd6c8ee 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 _0x27c0=['../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x27c0,0x16d));var _0x027c=function(_0x3194da,_0x2a32d0){_0x3194da=_0x3194da-0x0;var _0x12c13f=_0x27c0[_0x3194da];return _0x12c13f;};'use strict';var _=require(_0x027c('0x0'));var util=require('util');var logger=require(_0x027c('0x1'))(_0x027c('0x2'));var moment=require(_0x027c('0x3'));var BPromise=require('bluebird');var rp=require(_0x027c('0x4'));var fs=require('fs');var path=require(_0x027c('0x5'));var rimraf=require(_0x027c('0x6'));var config=require(_0x027c('0x7'));var attributes=require(_0x027c('0x8'));module[_0x027c('0x9')]=function(_0x440a66,_0x5845c7){return _0x440a66['define'](_0x027c('0xa'),attributes,{'tableName':_0x027c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8a1=['bluebird','request-promise','path','../../config/environment','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xc8a1,0xc7));var _0x1c8a=function(_0x2cb7cc,_0x5daae1){_0x2cb7cc=_0x2cb7cc-0x0;var _0x48142b=_0xc8a1[_0x2cb7cc];return _0x48142b;};'use strict';var _=require(_0x1c8a('0x0'));var util=require(_0x1c8a('0x1'));var logger=require(_0x1c8a('0x2'))(_0x1c8a('0x3'));var moment=require(_0x1c8a('0x4'));var BPromise=require(_0x1c8a('0x5'));var rp=require(_0x1c8a('0x6'));var fs=require('fs');var path=require(_0x1c8a('0x7'));var rimraf=require('rimraf');var config=require(_0x1c8a('0x8'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x102da8,_0x540cbc){return _0x102da8[_0x1c8a('0x9')](_0x1c8a('0xa'),attributes,{'tableName':_0x1c8a('0xb'),'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 0b94113..fa3f543 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 _0x1c59=['ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','http','redis','localhost','socket.io-emitter','register','then','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x1c59,0x18e));var _0x91c5=function(_0x2ad675,_0x8f7cb2){_0x2ad675=_0x2ad675-0x0;var _0x55b3c4=_0x1c59[_0x2ad675];return _0x55b3c4;};'use strict';var _=require(_0x91c5('0x0'));var util=require(_0x91c5('0x1'));var moment=require(_0x91c5('0x2'));var BPromise=require(_0x91c5('0x3'));var rs=require(_0x91c5('0x4'));var fs=require('fs');var Redis=require(_0x91c5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91c5('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x91c5('0x7'));var client=jayson['client'][_0x91c5('0x8')]({'port':0x232a});config[_0x91c5('0x9')]=_['defaults'](config['redis'],{'host':_0x91c5('0xa'),'port':0x18eb});var socket=require(_0x91c5('0xb'))(new Redis(config[_0x91c5('0x9')]));require('./smsQueue.socket')[_0x91c5('0xc')](socket);function respondWithRpcPromise(_0x3f2593,_0x147f76,_0x3b27d5){return new BPromise(function(_0x260cb4,_0x402f01){return client['request'](_0x3f2593,_0x3b27d5)[_0x91c5('0xd')](function(_0x53fc15){logger['info'](_0x91c5('0xe'),_0x147f76,_0x91c5('0xf'));logger['debug'](_0x91c5('0x10'),_0x147f76,'request\x20sent',JSON[_0x91c5('0x11')](_0x53fc15));if(_0x53fc15[_0x91c5('0x12')]){if(_0x53fc15['error']['code']===0x1f4){logger[_0x91c5('0x12')](_0x91c5('0xe'),_0x147f76,_0x53fc15[_0x91c5('0x12')][_0x91c5('0x13')]);return _0x402f01(_0x53fc15['error'][_0x91c5('0x13')]);}logger[_0x91c5('0x12')](_0x91c5('0xe'),_0x147f76,_0x53fc15[_0x91c5('0x12')][_0x91c5('0x13')]);return _0x260cb4(_0x53fc15['error'][_0x91c5('0x13')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x147f76,_0x91c5('0xf'));_0x260cb4(_0x53fc15[_0x91c5('0x14')][_0x91c5('0x13')]);}})['catch'](function(_0x47e628){logger[_0x91c5('0x12')](_0x91c5('0xe'),_0x147f76,_0x47e628);_0x402f01(_0x47e628);});});}exports[_0x91c5('0x15')]=function(_0xe0194){var _0x12a6a6=this;return new Promise(function(_0x759056,_0x2e2b4e){return db[_0x91c5('0x16')][_0x91c5('0x17')]({'raw':_0xe0194[_0x91c5('0x18')]?_0xe0194['options'][_0x91c5('0x19')]===undefined?!![]:![]:!![],'where':_0xe0194[_0x91c5('0x18')]?_0xe0194[_0x91c5('0x18')][_0x91c5('0x1a')]||null:null,'attributes':_0xe0194[_0x91c5('0x18')]?_0xe0194[_0x91c5('0x18')][_0x91c5('0x1b')]||null:null,'limit':_0xe0194[_0x91c5('0x18')]?_0xe0194[_0x91c5('0x18')][_0x91c5('0x1c')]||null:null,'include':_0xe0194[_0x91c5('0x18')]?_0xe0194['options'][_0x91c5('0x1d')]?_[_0x91c5('0x1e')](_0xe0194['options']['include'],function(_0x3ab6c6){return{'model':db[_0x3ab6c6['model']],'as':_0x3ab6c6['as'],'attributes':_0x3ab6c6[_0x91c5('0x1b')],'include':_0x3ab6c6['include']?_[_0x91c5('0x1e')](_0x3ab6c6['include'],function(_0x4d5a68){return{'model':db[_0x4d5a68[_0x91c5('0x1f')]],'as':_0x4d5a68['as'],'attributes':_0x4d5a68['attributes'],'include':_0x4d5a68[_0x91c5('0x1d')]?_[_0x91c5('0x1e')](_0x4d5a68[_0x91c5('0x1d')],function(_0x337467){return{'model':db[_0x337467[_0x91c5('0x1f')]],'as':_0x337467['as'],'attributes':_0x337467[_0x91c5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x91c5('0xd')](function(_0x398932){logger['info'](_0x91c5('0x15'),_0xe0194);logger[_0x91c5('0x20')]('GetSmsQueue',_0xe0194,JSON[_0x91c5('0x11')](_0x398932));_0x759056(_0x398932);})[_0x91c5('0x21')](function(_0x2e5127){logger[_0x91c5('0x12')](_0x91c5('0x15'),_0x2e5127[_0x91c5('0x13')],_0xe0194);_0x2e2b4e(_0x12a6a6[_0x91c5('0x12')](0x1f4,_0x2e5127[_0x91c5('0x13')]));});});};exports[_0x91c5('0x22')]=function(_0x5e65b5){var _0x52e7af=this;return new Promise(function(_0x3d4ab7,_0x2114fb){return db['SmsQueue'][_0x91c5('0x23')]({'raw':_0x5e65b5[_0x91c5('0x18')]?_0x5e65b5[_0x91c5('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5e65b5[_0x91c5('0x18')]?_0x5e65b5[_0x91c5('0x18')][_0x91c5('0x1a')]||null:null,'attributes':_0x5e65b5['options']?_0x5e65b5[_0x91c5('0x18')][_0x91c5('0x1b')]||null:null,'include':_0x5e65b5[_0x91c5('0x18')]?_0x5e65b5['options'][_0x91c5('0x1d')]?_['map'](_0x5e65b5[_0x91c5('0x18')][_0x91c5('0x1d')],function(_0x5ead9f){return{'model':db[_0x5ead9f[_0x91c5('0x1f')]],'as':_0x5ead9f['as'],'attributes':_0x5ead9f[_0x91c5('0x1b')],'include':_0x5ead9f[_0x91c5('0x1d')]?_[_0x91c5('0x1e')](_0x5ead9f[_0x91c5('0x1d')],function(_0x2344b7){return{'model':db[_0x2344b7[_0x91c5('0x1f')]],'as':_0x2344b7['as'],'attributes':_0x2344b7['attributes'],'include':_0x2344b7[_0x91c5('0x1d')]?_[_0x91c5('0x1e')](_0x2344b7[_0x91c5('0x1d')],function(_0x4b9908){return{'model':db[_0x4b9908[_0x91c5('0x1f')]],'as':_0x4b9908['as'],'attributes':_0x4b9908[_0x91c5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x91c5('0xd')](function(_0xc82d7c){logger['info'](_0x91c5('0x22'),_0x5e65b5);logger['debug'](_0x91c5('0x22'),_0x5e65b5,JSON[_0x91c5('0x11')](_0xc82d7c));_0x3d4ab7(_0xc82d7c);})['catch'](function(_0x522c31){logger[_0x91c5('0x12')]('ShowSmsQueue',_0x522c31[_0x91c5('0x13')],_0x5e65b5);_0x2114fb(_0x52e7af[_0x91c5('0x12')](0x1f4,_0x522c31['message']));});});}; \ No newline at end of file +var _0x7639=['./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','model','ShowSmsQueue','find','raw','map','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x4d23da,_0x1985b6){var _0x4b2da1=function(_0x2370ff){while(--_0x2370ff){_0x4d23da['push'](_0x4d23da['shift']());}};_0x4b2da1(++_0x1985b6);}(_0x7639,0xf2));var _0x9763=function(_0x58ba9a,_0x2967c9){_0x58ba9a=_0x58ba9a-0x0;var _0x1bd693=_0x7639[_0x58ba9a];return _0x1bd693;};'use strict';var _=require(_0x9763('0x0'));var util=require(_0x9763('0x1'));var moment=require(_0x9763('0x2'));var BPromise=require(_0x9763('0x3'));var rs=require(_0x9763('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9763('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9763('0x6'))(_0x9763('0x7'));var config=require(_0x9763('0x8'));var jayson=require(_0x9763('0x9'));var client=jayson[_0x9763('0xa')][_0x9763('0xb')]({'port':0x232a});config[_0x9763('0xc')]=_[_0x9763('0xd')](config[_0x9763('0xc')],{'host':_0x9763('0xe'),'port':0x18eb});var socket=require(_0x9763('0xf'))(new Redis(config[_0x9763('0xc')]));require(_0x9763('0x10'))[_0x9763('0x11')](socket);function respondWithRpcPromise(_0x44bf0d,_0x400450,_0x3d4933){return new BPromise(function(_0x1b019a,_0x5a7c6f){return client[_0x9763('0x12')](_0x44bf0d,_0x3d4933)[_0x9763('0x13')](function(_0x1d35fd){logger[_0x9763('0x14')](_0x9763('0x15'),_0x400450,_0x9763('0x16'));logger[_0x9763('0x17')](_0x9763('0x18'),_0x400450,_0x9763('0x16'),JSON['stringify'](_0x1d35fd));if(_0x1d35fd['error']){if(_0x1d35fd['error']['code']===0x1f4){logger[_0x9763('0x19')](_0x9763('0x15'),_0x400450,_0x1d35fd['error'][_0x9763('0x1a')]);return _0x5a7c6f(_0x1d35fd[_0x9763('0x19')][_0x9763('0x1a')]);}logger[_0x9763('0x19')](_0x9763('0x15'),_0x400450,_0x1d35fd['error']['message']);return _0x1b019a(_0x1d35fd[_0x9763('0x19')]['message']);}else{logger[_0x9763('0x14')](_0x9763('0x15'),_0x400450,'request\x20sent');_0x1b019a(_0x1d35fd[_0x9763('0x1b')][_0x9763('0x1a')]);}})['catch'](function(_0x12290d){logger[_0x9763('0x19')](_0x9763('0x15'),_0x400450,_0x12290d);_0x5a7c6f(_0x12290d);});});}exports[_0x9763('0x1c')]=function(_0x507ec8){var _0x4e4a98=this;return new Promise(function(_0xf9d5b7,_0x33ea61){return db[_0x9763('0x1d')][_0x9763('0x1e')]({'raw':_0x507ec8[_0x9763('0x1f')]?_0x507ec8['options']['raw']===undefined?!![]:![]:!![],'where':_0x507ec8[_0x9763('0x1f')]?_0x507ec8[_0x9763('0x1f')][_0x9763('0x20')]||null:null,'attributes':_0x507ec8[_0x9763('0x1f')]?_0x507ec8[_0x9763('0x1f')][_0x9763('0x21')]||null:null,'limit':_0x507ec8[_0x9763('0x1f')]?_0x507ec8[_0x9763('0x1f')][_0x9763('0x22')]||null:null,'include':_0x507ec8['options']?_0x507ec8[_0x9763('0x1f')][_0x9763('0x23')]?_['map'](_0x507ec8[_0x9763('0x1f')]['include'],function(_0x6adcf0){return{'model':db[_0x6adcf0[_0x9763('0x24')]],'as':_0x6adcf0['as'],'attributes':_0x6adcf0['attributes'],'include':_0x6adcf0[_0x9763('0x23')]?_['map'](_0x6adcf0[_0x9763('0x23')],function(_0x11cfdd){return{'model':db[_0x11cfdd[_0x9763('0x24')]],'as':_0x11cfdd['as'],'attributes':_0x11cfdd[_0x9763('0x21')],'include':_0x11cfdd[_0x9763('0x23')]?_['map'](_0x11cfdd[_0x9763('0x23')],function(_0x5cc7d3){return{'model':db[_0x5cc7d3['model']],'as':_0x5cc7d3['as'],'attributes':_0x5cc7d3['attributes']};}):[]};}):[]};}):[]:[]})[_0x9763('0x13')](function(_0x3db2bb){logger[_0x9763('0x14')](_0x9763('0x1c'),_0x507ec8);logger['debug'](_0x9763('0x1c'),_0x507ec8,JSON['stringify'](_0x3db2bb));_0xf9d5b7(_0x3db2bb);})['catch'](function(_0x80cf46){logger[_0x9763('0x19')](_0x9763('0x1c'),_0x80cf46[_0x9763('0x1a')],_0x507ec8);_0x33ea61(_0x4e4a98[_0x9763('0x19')](0x1f4,_0x80cf46['message']));});});};exports[_0x9763('0x25')]=function(_0xf46b03){var _0x4732e5=this;return new Promise(function(_0x390e4c,_0x54c0e1){return db[_0x9763('0x1d')][_0x9763('0x26')]({'raw':_0xf46b03['options']?_0xf46b03[_0x9763('0x1f')][_0x9763('0x27')]===undefined?!![]:![]:!![],'where':_0xf46b03['options']?_0xf46b03[_0x9763('0x1f')][_0x9763('0x20')]||null:null,'attributes':_0xf46b03['options']?_0xf46b03[_0x9763('0x1f')][_0x9763('0x21')]||null:null,'include':_0xf46b03['options']?_0xf46b03[_0x9763('0x1f')][_0x9763('0x23')]?_[_0x9763('0x28')](_0xf46b03[_0x9763('0x1f')][_0x9763('0x23')],function(_0x3de559){return{'model':db[_0x3de559[_0x9763('0x24')]],'as':_0x3de559['as'],'attributes':_0x3de559[_0x9763('0x21')],'include':_0x3de559[_0x9763('0x23')]?_['map'](_0x3de559[_0x9763('0x23')],function(_0x4943bb){return{'model':db[_0x4943bb[_0x9763('0x24')]],'as':_0x4943bb['as'],'attributes':_0x4943bb['attributes'],'include':_0x4943bb['include']?_['map'](_0x4943bb[_0x9763('0x23')],function(_0x4c23db){return{'model':db[_0x4c23db[_0x9763('0x24')]],'as':_0x4c23db['as'],'attributes':_0x4c23db[_0x9763('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9763('0x13')](function(_0x59e213){logger[_0x9763('0x14')](_0x9763('0x25'),_0xf46b03);logger[_0x9763('0x17')]('ShowSmsQueue',_0xf46b03,JSON[_0x9763('0x29')](_0x59e213));_0x390e4c(_0x59e213);})[_0x9763('0x2a')](function(_0xada1f3){logger[_0x9763('0x19')](_0x9763('0x25'),_0xada1f3[_0x9763('0x1a')],_0xf46b03);_0x54c0e1(_0x4732e5[_0x9763('0x19')](0x1f4,_0xada1f3[_0x9763('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 1176079..9fdab87 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 _0x8080=['emit','removeListener','register','smsQueue:','./smsQueue.events','save','update'];(function(_0x51a2ea,_0x205bcb){var _0x1f9fe=function(_0x594acd){while(--_0x594acd){_0x51a2ea['push'](_0x51a2ea['shift']());}};_0x1f9fe(++_0x205bcb);}(_0x8080,0xb3));var _0x0808=function(_0x1206d7,_0x1b0ed7){_0x1206d7=_0x1206d7-0x0;var _0x5e1142=_0x8080[_0x1206d7];return _0x5e1142;};'use strict';var SmsQueueEvents=require(_0x0808('0x0'));var events=[_0x0808('0x1'),'remove',_0x0808('0x2')];function createListener(_0x13dfef,_0x21469f){return function(_0xfbea1f){_0x21469f[_0x0808('0x3')](_0x13dfef,_0xfbea1f);};}function removeListener(_0x4687ec,_0x42f50a){return function(){SmsQueueEvents[_0x0808('0x4')](_0x4687ec,_0x42f50a);};}exports[_0x0808('0x5')]=function(_0x12e2f0){for(var _0x1d8165=0x0,_0x10b3dc=events['length'];_0x1d8165<_0x10b3dc;_0x1d8165++){var _0x4ad011=events[_0x1d8165];var _0x5ab734=createListener(_0x0808('0x6')+_0x4ad011,_0x12e2f0);SmsQueueEvents['on'](_0x4ad011,_0x5ab734);}}; \ No newline at end of file +var _0xa302=['update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x2f6dd6,_0x5e8d02){var _0x4f4a4=function(_0x284548){while(--_0x284548){_0x2f6dd6['push'](_0x2f6dd6['shift']());}};_0x4f4a4(++_0x5e8d02);}(_0xa302,0xe7));var _0x2a30=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xa302[_0x4ff09b];return _0x3f5c2e;};'use strict';var SmsQueueEvents=require(_0x2a30('0x0'));var events=[_0x2a30('0x1'),_0x2a30('0x2'),_0x2a30('0x3')];function createListener(_0x34de3e,_0x26979d){return function(_0x37922c){_0x26979d[_0x2a30('0x4')](_0x34de3e,_0x37922c);};}function removeListener(_0x47a684,_0x35e217){return function(){SmsQueueEvents[_0x2a30('0x5')](_0x47a684,_0x35e217);};}exports[_0x2a30('0x6')]=function(_0x4a5e38){for(var _0x10f9b0=0x0,_0x5e8bd6=events[_0x2a30('0x7')];_0x10f9b0<_0x5e8bd6;_0x10f9b0++){var _0x24f02d=events[_0x10f9b0];var _0x36982a=createListener(_0x2a30('0x8')+_0x24f02d,_0x4a5e38);SmsQueueEvents['on'](_0x24f02d,_0x36982a);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index a0a4583..77f4255 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 _0xea6f=['isAuthenticated','/describe','describe','post','put','/:id','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get'];(function(_0x26e10f,_0x2131cd){var _0x5cba39=function(_0x236718){while(--_0x236718){_0x26e10f['push'](_0x26e10f['shift']());}};_0x5cba39(++_0x2131cd);}(_0xea6f,0x105));var _0xfea6=function(_0x5cef40,_0xacb8e4){_0x5cef40=_0x5cef40-0x0;var _0x38360f=_0xea6f[_0x5cef40];return _0x38360f;};'use strict';var multer=require(_0xfea6('0x0'));var util=require(_0xfea6('0x1'));var path=require('path');var timeout=require(_0xfea6('0x2'));var express=require('express');var router=express[_0xfea6('0x3')]();var fs_extra=require(_0xfea6('0x4'));var auth=require(_0xfea6('0x5'));var interaction=require(_0xfea6('0x6'));var config=require('../../config/environment');var controller=require(_0xfea6('0x7'));router[_0xfea6('0x8')]('/',auth[_0xfea6('0x9')](),controller['index']);router['get'](_0xfea6('0xa'),auth[_0xfea6('0x9')](),controller[_0xfea6('0xb')]);router[_0xfea6('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xfea6('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfea6('0xd')](_0xfea6('0xe'),auth[_0xfea6('0x9')](),controller['update']);router[_0xfea6('0xf')]('/:id',auth[_0xfea6('0x9')](),controller[_0xfea6('0x10')]);module[_0xfea6('0x11')]=router; \ No newline at end of file +var _0xf2f7=['update','delete','destroy','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','index','get','/describe','describe','/:id','isAuthenticated','post','create','put'];(function(_0x5e9c46,_0x30f9ed){var _0x39adf6=function(_0x4145a3){while(--_0x4145a3){_0x5e9c46['push'](_0x5e9c46['shift']());}};_0x39adf6(++_0x30f9ed);}(_0xf2f7,0xa3));var _0x7f2f=function(_0x573319,_0x2121e4){_0x573319=_0x573319-0x0;var _0x28164f=_0xf2f7[_0x573319];return _0x28164f;};'use strict';var multer=require(_0x7f2f('0x0'));var util=require('util');var path=require(_0x7f2f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7f2f('0x2')]();var fs_extra=require(_0x7f2f('0x3'));var auth=require(_0x7f2f('0x4'));var interaction=require(_0x7f2f('0x5'));var config=require(_0x7f2f('0x6'));var controller=require(_0x7f2f('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7f2f('0x8')]);router[_0x7f2f('0x9')](_0x7f2f('0xa'),auth['isAuthenticated'](),controller[_0x7f2f('0xb')]);router[_0x7f2f('0x9')](_0x7f2f('0xc'),auth[_0x7f2f('0xd')](),controller['show']);router[_0x7f2f('0xe')]('/',auth['isAuthenticated'](),controller[_0x7f2f('0xf')]);router[_0x7f2f('0x10')](_0x7f2f('0xc'),auth['isAuthenticated'](),controller[_0x7f2f('0x11')]);router[_0x7f2f('0x12')]('/:id',auth[_0x7f2f('0xd')](),controller[_0x7f2f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 70d3297..433304c 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 _0xaf41=['STRING','DATE','moment','sequelize','exports'];(function(_0xef1d57,_0x63ef9a){var _0x553ff0=function(_0x5f5299){while(--_0x5f5299){_0xef1d57['push'](_0xef1d57['shift']());}};_0x553ff0(++_0x63ef9a);}(_0xaf41,0x13d));var _0x1af4=function(_0x4687a9,_0x59952d){_0x4687a9=_0x4687a9-0x0;var _0xc29b76=_0xaf41[_0x4687a9];return _0xc29b76;};'use strict';var moment=require(_0x1af4('0x0'));var Sequelize=require(_0x1af4('0x1'));module[_0x1af4('0x2')]={'uniqueid':{'type':Sequelize[_0x1af4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x1af4('0x3')]},'joinAt':{'type':Sequelize[_0x1af4('0x4')]},'leaveAt':{'type':Sequelize[_0x1af4('0x4')]},'acceptAt':{'type':Sequelize[_0x1af4('0x4')]},'exitAt':{'type':Sequelize[_0x1af4('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfc4c=['STRING','DATE','moment','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfc4c,0x1c9));var _0xcfc4=function(_0x2af72e,_0x4d3fe9){_0x2af72e=_0x2af72e-0x0;var _0xb7137=_0xfc4c[_0x2af72e];return _0xb7137;};'use strict';var moment=require(_0xcfc4('0x0'));var Sequelize=require(_0xcfc4('0x1'));module[_0xcfc4('0x2')]={'uniqueid':{'type':Sequelize[_0xcfc4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xcfc4('0x3')]},'joinAt':{'type':Sequelize[_0xcfc4('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xcfc4('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcfc4('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 9a9230a..63fd888 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 _0x6e9c=['rows','params','keys','rawAttributes','length','include','merge','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','includeAll','findAll'];(function(_0x183b97,_0x2d297c){var _0x629cf7=function(_0x4ffd24){while(--_0x4ffd24){_0x183b97['push'](_0x183b97['shift']());}};_0x629cf7(++_0x2d297c);}(_0x6e9c,0xe8));var _0xc6e9=function(_0x307b04,_0x4d1c61){_0x307b04=_0x307b04-0x0;var _0x4b3628=_0x6e9c[_0x307b04];return _0x4b3628;};'use strict';var emlformat=require(_0xc6e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6e9('0x1'));var jsonpatch=require(_0xc6e9('0x2'));var rp=require(_0xc6e9('0x3'));var moment=require(_0xc6e9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc6e9('0x5'));var util=require(_0xc6e9('0x6'));var path=require(_0xc6e9('0x7'));var sox=require(_0xc6e9('0x8'));var csv=require(_0xc6e9('0x9'));var ejs=require(_0xc6e9('0xa'));var fs=require('fs');var fs_extra=require(_0xc6e9('0xb'));var _=require('lodash');var squel=require(_0xc6e9('0xc'));var crypto=require(_0xc6e9('0xd'));var jsforce=require(_0xc6e9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc6e9('0x9'));var querystring=require(_0xc6e9('0xf'));var Papa=require(_0xc6e9('0x10'));var Redis=require('ioredis');var authService=require(_0xc6e9('0x11'));var qs=require(_0xc6e9('0x12'));var as=require(_0xc6e9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6e9('0x14'))(_0xc6e9('0x15'));var utils=require('../../config/utils');var config=require(_0xc6e9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40bfb8,_0x55bcb1){_0x55bcb1=_0x55bcb1||0xcc;return function(_0x4b0773){if(_0x4b0773){return _0x40bfb8['sendStatus'](_0x55bcb1);}return _0x40bfb8[_0xc6e9('0x17')](_0x55bcb1)[_0xc6e9('0x18')]();};}function respondWithResult(_0x56ca9b,_0x4f1019){_0x4f1019=_0x4f1019||0xc8;return function(_0x5288d4){if(_0x5288d4){return _0x56ca9b['status'](_0x4f1019)[_0xc6e9('0x19')](_0x5288d4);}};}function respondWithFilteredResult(_0x2a741a,_0x229b08){return function(_0x5e3d1d){if(_0x5e3d1d){var _0x31f479=typeof _0x229b08[_0xc6e9('0x1a')]===_0xc6e9('0x1b')&&typeof _0x229b08[_0xc6e9('0x1c')]==='undefined';var _0x563466=_0x5e3d1d[_0xc6e9('0x1d')];var _0xafd042=_0x31f479?0x0:_0x229b08[_0xc6e9('0x1a')];var _0x34b4de=_0x31f479?_0x5e3d1d[_0xc6e9('0x1d')]:_0x229b08[_0xc6e9('0x1a')]+_0x229b08[_0xc6e9('0x1c')];var _0x2363a4;if(_0x34b4de>=_0x563466){_0x34b4de=_0x563466;_0x2363a4=0xc8;}else{_0x2363a4=0xce;}_0x2a741a[_0xc6e9('0x17')](_0x2363a4);return _0x2a741a[_0xc6e9('0x1e')](_0xc6e9('0x1f'),_0xafd042+'-'+_0x34b4de+'/'+_0x563466)[_0xc6e9('0x19')](_0x5e3d1d);}return null;};}function patchUpdates(_0x49dfca){return function(_0x1fcd24){try{jsonpatch['apply'](_0x1fcd24,_0x49dfca,!![]);}catch(_0x2f55fa){return BPromise[_0xc6e9('0x20')](_0x2f55fa);}return _0x1fcd24[_0xc6e9('0x21')]();};}function saveUpdates(_0x549084,_0x28dbd4){return function(_0x3a5acc){if(_0x3a5acc){return _0x3a5acc[_0xc6e9('0x22')](_0x549084)[_0xc6e9('0x23')](function(_0x452253){return _0x452253;});}return null;};}function removeEntity(_0x334e5f,_0x3cdb06){return function(_0x13a0e0){if(_0x13a0e0){return _0x13a0e0[_0xc6e9('0x24')]()[_0xc6e9('0x23')](function(){_0x334e5f[_0xc6e9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40431d,_0x4a3138){return function(_0x546a82){if(!_0x546a82){_0x40431d[_0xc6e9('0x25')](0x194);}return _0x546a82;};}function handleError(_0x3d590a,_0x5be115){_0x5be115=_0x5be115||0x1f4;return function(_0x4bede0){logger['error'](_0x4bede0[_0xc6e9('0x26')]);if(_0x4bede0[_0xc6e9('0x27')]){delete _0x4bede0['name'];}_0x3d590a['status'](_0x5be115)[_0xc6e9('0x28')](_0x4bede0);};}exports[_0xc6e9('0x29')]=function(_0x1f1577,_0x223901){var _0x49fdd7={},_0x22411b={},_0x1c5273={'count':0x0,'rows':[]};var _0x15e1ff=_[_0xc6e9('0x2a')](db[_0xc6e9('0x2b')]['rawAttributes'],function(_0x1d8ae1){return{'name':_0x1d8ae1[_0xc6e9('0x2c')],'type':_0x1d8ae1[_0xc6e9('0x2d')][_0xc6e9('0x2e')]};});_0x22411b[_0xc6e9('0x2f')]=_[_0xc6e9('0x2a')](_0x15e1ff,_0xc6e9('0x27'));_0x22411b['query']=_['keys'](_0x1f1577[_0xc6e9('0x30')]);_0x22411b[_0xc6e9('0x31')]=_[_0xc6e9('0x32')](_0x22411b[_0xc6e9('0x2f')],_0x22411b[_0xc6e9('0x30')]);_0x49fdd7[_0xc6e9('0x33')]=_[_0xc6e9('0x32')](_0x22411b[_0xc6e9('0x2f')],qs[_0xc6e9('0x34')](_0x1f1577[_0xc6e9('0x30')]['fields']));_0x49fdd7['attributes']=_0x49fdd7[_0xc6e9('0x33')]['length']?_0x49fdd7[_0xc6e9('0x33')]:_0x22411b[_0xc6e9('0x2f')];if(!_0x1f1577[_0xc6e9('0x30')]['hasOwnProperty']('nolimit')){_0x49fdd7[_0xc6e9('0x1c')]=qs[_0xc6e9('0x1c')](_0x1f1577[_0xc6e9('0x30')]['limit']);_0x49fdd7[_0xc6e9('0x1a')]=qs[_0xc6e9('0x1a')](_0x1f1577[_0xc6e9('0x30')][_0xc6e9('0x1a')]);}_0x49fdd7[_0xc6e9('0x35')]=qs[_0xc6e9('0x36')](_0x1f1577[_0xc6e9('0x30')][_0xc6e9('0x36')]);_0x49fdd7[_0xc6e9('0x37')]=qs[_0xc6e9('0x31')](_[_0xc6e9('0x38')](_0x1f1577[_0xc6e9('0x30')],_0x22411b['filters']),_0x15e1ff);if(_0x1f1577[_0xc6e9('0x30')][_0xc6e9('0x39')]){_0x49fdd7[_0xc6e9('0x37')]=_['merge'](_0x49fdd7[_0xc6e9('0x37')],{'$or':_['map'](_0x15e1ff,function(_0x3e7b81){if(_0x3e7b81[_0xc6e9('0x2d')]!=='VIRTUAL'){var _0x55bf27={};_0x55bf27[_0x3e7b81[_0xc6e9('0x27')]]={'$like':'%'+_0x1f1577[_0xc6e9('0x30')][_0xc6e9('0x39')]+'%'};return _0x55bf27;}})});}_0x49fdd7=_['merge']({},_0x49fdd7,_0x1f1577['options']);var _0xa07d27={'where':_0x49fdd7[_0xc6e9('0x37')]};return db[_0xc6e9('0x2b')][_0xc6e9('0x1d')](_0xa07d27)[_0xc6e9('0x23')](function(_0x50e8fa){_0x1c5273[_0xc6e9('0x1d')]=_0x50e8fa;if(_0x1f1577[_0xc6e9('0x30')][_0xc6e9('0x3a')]){_0x49fdd7['include']=[{'all':!![]}];}return db[_0xc6e9('0x2b')][_0xc6e9('0x3b')](_0x49fdd7);})[_0xc6e9('0x23')](function(_0x67caa6){_0x1c5273[_0xc6e9('0x3c')]=_0x67caa6;return _0x1c5273;})['then'](respondWithFilteredResult(_0x223901,_0x49fdd7))['catch'](handleError(_0x223901,null));};exports['show']=function(_0x22a281,_0x6f2e2){var _0x222707={'raw':!![],'where':{'id':_0x22a281[_0xc6e9('0x3d')]['id']}},_0x55cb44={};_0x55cb44['model']=_[_0xc6e9('0x3e')](db['SmsQueueReport'][_0xc6e9('0x3f')]);_0x55cb44[_0xc6e9('0x30')]=_['keys'](_0x22a281[_0xc6e9('0x30')]);_0x55cb44[_0xc6e9('0x31')]=_['intersection'](_0x55cb44['model'],_0x55cb44['query']);_0x222707[_0xc6e9('0x33')]=_[_0xc6e9('0x32')](_0x55cb44[_0xc6e9('0x2f')],qs[_0xc6e9('0x34')](_0x22a281['query'][_0xc6e9('0x34')]));_0x222707[_0xc6e9('0x33')]=_0x222707[_0xc6e9('0x33')][_0xc6e9('0x40')]?_0x222707[_0xc6e9('0x33')]:_0x55cb44[_0xc6e9('0x2f')];if(_0x22a281['query']['includeAll']){_0x222707[_0xc6e9('0x41')]=[{'all':!![]}];}_0x222707=_[_0xc6e9('0x42')]({},_0x222707,_0x22a281[_0xc6e9('0x43')]);return db[_0xc6e9('0x2b')][_0xc6e9('0x44')](_0x222707)['then'](handleEntityNotFound(_0x6f2e2,null))['then'](respondWithResult(_0x6f2e2,null))[_0xc6e9('0x45')](handleError(_0x6f2e2,null));};exports['create']=function(_0x30ff4a,_0x44dfff){return db[_0xc6e9('0x2b')][_0xc6e9('0x46')](_0x30ff4a['body'],{})[_0xc6e9('0x23')](respondWithResult(_0x44dfff,0xc9))[_0xc6e9('0x45')](handleError(_0x44dfff,null));};exports[_0xc6e9('0x22')]=function(_0x5e5fb6,_0x30f59c){if(_0x5e5fb6['body']['id']){delete _0x5e5fb6[_0xc6e9('0x47')]['id'];}return db[_0xc6e9('0x2b')][_0xc6e9('0x44')]({'where':{'id':_0x5e5fb6[_0xc6e9('0x3d')]['id']}})[_0xc6e9('0x23')](handleEntityNotFound(_0x30f59c,null))['then'](saveUpdates(_0x5e5fb6[_0xc6e9('0x47')],null))[_0xc6e9('0x23')](respondWithResult(_0x30f59c,null))['catch'](handleError(_0x30f59c,null));};exports[_0xc6e9('0x24')]=function(_0x3c4b18,_0x308a77){return db[_0xc6e9('0x2b')][_0xc6e9('0x44')]({'where':{'id':_0x3c4b18[_0xc6e9('0x3d')]['id']}})[_0xc6e9('0x23')](handleEntityNotFound(_0x308a77,null))['then'](removeEntity(_0x308a77,null))[_0xc6e9('0x45')](handleError(_0x308a77,null));};exports['describe']=function(_0xfa1bc1,_0x2a5652){return db[_0xc6e9('0x2b')][_0xc6e9('0x48')]()[_0xc6e9('0x23')](respondWithResult(_0x2a5652,null))[_0xc6e9('0x45')](handleError(_0x2a5652,null));}; \ No newline at end of file +var _0xc408=['status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','SmsQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x1fa2cc,_0x3840c1){var _0x4a35f0=function(_0x22c979){while(--_0x22c979){_0x1fa2cc['push'](_0x1fa2cc['shift']());}};_0x4a35f0(++_0x3840c1);}(_0xc408,0x100));var _0x8c40=function(_0x4909b9,_0x3f9f23){_0x4909b9=_0x4909b9-0x0;var _0x23ee9c=_0xc408[_0x4909b9];return _0x23ee9c;};'use strict';var emlformat=require(_0x8c40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c40('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c40('0x2'));var moment=require(_0x8c40('0x3'));var BPromise=require(_0x8c40('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8c40('0x5'));var sox=require(_0x8c40('0x6'));var csv=require(_0x8c40('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c40('0x8'));var _=require(_0x8c40('0x9'));var squel=require(_0x8c40('0xa'));var crypto=require(_0x8c40('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8c40('0xc'));var toCsv=require(_0x8c40('0x7'));var querystring=require(_0x8c40('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8c40('0xe'));var qs=require(_0x8c40('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c40('0x10'));var logger=require(_0x8c40('0x11'))(_0x8c40('0x12'));var utils=require('../../config/utils');var config=require(_0x8c40('0x13'));var licenseUtil=require(_0x8c40('0x14'));var db=require(_0x8c40('0x15'))['db'];function respondWithStatusCode(_0xfad7a7,_0xe92008){_0xe92008=_0xe92008||0xcc;return function(_0x39556a){if(_0x39556a){return _0xfad7a7[_0x8c40('0x16')](_0xe92008);}return _0xfad7a7['status'](_0xe92008)[_0x8c40('0x17')]();};}function respondWithResult(_0x49bb83,_0x3e5d2c){_0x3e5d2c=_0x3e5d2c||0xc8;return function(_0x21c2a5){if(_0x21c2a5){return _0x49bb83[_0x8c40('0x18')](_0x3e5d2c)[_0x8c40('0x19')](_0x21c2a5);}};}function respondWithFilteredResult(_0x48ab89,_0x54181e){return function(_0x58a10c){if(_0x58a10c){var _0x4d9b20=typeof _0x54181e[_0x8c40('0x1a')]===_0x8c40('0x1b')&&typeof _0x54181e[_0x8c40('0x1c')]==='undefined';var _0x56ea9b=_0x58a10c[_0x8c40('0x1d')];var _0x5ceca7=_0x4d9b20?0x0:_0x54181e[_0x8c40('0x1a')];var _0x4d3fe1=_0x4d9b20?_0x58a10c[_0x8c40('0x1d')]:_0x54181e['offset']+_0x54181e[_0x8c40('0x1c')];var _0x3903e4;if(_0x4d3fe1>=_0x56ea9b){_0x4d3fe1=_0x56ea9b;_0x3903e4=0xc8;}else{_0x3903e4=0xce;}_0x48ab89[_0x8c40('0x18')](_0x3903e4);return _0x48ab89[_0x8c40('0x1e')]('Content-Range',_0x5ceca7+'-'+_0x4d3fe1+'/'+_0x56ea9b)['json'](_0x58a10c);}return null;};}function patchUpdates(_0x3be42a){return function(_0x3ba451){try{jsonpatch[_0x8c40('0x1f')](_0x3ba451,_0x3be42a,!![]);}catch(_0x3146ea){return BPromise[_0x8c40('0x20')](_0x3146ea);}return _0x3ba451[_0x8c40('0x21')]();};}function saveUpdates(_0x38f065,_0x5be731){return function(_0x3e0bac){if(_0x3e0bac){return _0x3e0bac[_0x8c40('0x22')](_0x38f065)[_0x8c40('0x23')](function(_0x380546){return _0x380546;});}return null;};}function removeEntity(_0xec1c21,_0x556581){return function(_0x38e8e5){if(_0x38e8e5){return _0x38e8e5[_0x8c40('0x24')]()[_0x8c40('0x23')](function(){_0xec1c21['status'](0xcc)[_0x8c40('0x17')]();});}};}function handleEntityNotFound(_0x5b2c1c,_0x2f21d0){return function(_0x53fe52){if(!_0x53fe52){_0x5b2c1c[_0x8c40('0x16')](0x194);}return _0x53fe52;};}function handleError(_0x128ff7,_0x5a6bb0){_0x5a6bb0=_0x5a6bb0||0x1f4;return function(_0x697aed){logger[_0x8c40('0x25')](_0x697aed[_0x8c40('0x26')]);if(_0x697aed[_0x8c40('0x27')]){delete _0x697aed['name'];}_0x128ff7[_0x8c40('0x18')](_0x5a6bb0)[_0x8c40('0x28')](_0x697aed);};}exports['index']=function(_0x37dbdd,_0x475a2e){var _0xffd880={},_0x570931={},_0x1ea795={'count':0x0,'rows':[]};var _0x23545b=_[_0x8c40('0x29')](db[_0x8c40('0x2a')][_0x8c40('0x2b')],function(_0x46f988){return{'name':_0x46f988[_0x8c40('0x2c')],'type':_0x46f988['type'][_0x8c40('0x2d')]};});_0x570931['model']=_[_0x8c40('0x29')](_0x23545b,'name');_0x570931[_0x8c40('0x2e')]=_[_0x8c40('0x2f')](_0x37dbdd[_0x8c40('0x2e')]);_0x570931[_0x8c40('0x30')]=_[_0x8c40('0x31')](_0x570931[_0x8c40('0x32')],_0x570931[_0x8c40('0x2e')]);_0xffd880[_0x8c40('0x33')]=_[_0x8c40('0x31')](_0x570931[_0x8c40('0x32')],qs[_0x8c40('0x34')](_0x37dbdd['query'][_0x8c40('0x34')]));_0xffd880[_0x8c40('0x33')]=_0xffd880['attributes'][_0x8c40('0x35')]?_0xffd880[_0x8c40('0x33')]:_0x570931['model'];if(!_0x37dbdd[_0x8c40('0x2e')][_0x8c40('0x36')]('nolimit')){_0xffd880[_0x8c40('0x1c')]=qs['limit'](_0x37dbdd[_0x8c40('0x2e')][_0x8c40('0x1c')]);_0xffd880[_0x8c40('0x1a')]=qs[_0x8c40('0x1a')](_0x37dbdd['query'][_0x8c40('0x1a')]);}_0xffd880['order']=qs[_0x8c40('0x37')](_0x37dbdd[_0x8c40('0x2e')]['sort']);_0xffd880[_0x8c40('0x38')]=qs['filters'](_['pick'](_0x37dbdd[_0x8c40('0x2e')],_0x570931[_0x8c40('0x30')]),_0x23545b);if(_0x37dbdd['query'][_0x8c40('0x39')]){_0xffd880[_0x8c40('0x38')]=_[_0x8c40('0x3a')](_0xffd880[_0x8c40('0x38')],{'$or':_[_0x8c40('0x29')](_0x23545b,function(_0x1a40c5){if(_0x1a40c5[_0x8c40('0x3b')]!==_0x8c40('0x3c')){var _0x2cb8b2={};_0x2cb8b2[_0x1a40c5[_0x8c40('0x27')]]={'$like':'%'+_0x37dbdd['query'][_0x8c40('0x39')]+'%'};return _0x2cb8b2;}})});}_0xffd880=_[_0x8c40('0x3a')]({},_0xffd880,_0x37dbdd[_0x8c40('0x3d')]);var _0x1c456f={'where':_0xffd880[_0x8c40('0x38')]};return db[_0x8c40('0x2a')][_0x8c40('0x1d')](_0x1c456f)[_0x8c40('0x23')](function(_0x1e2c61){_0x1ea795[_0x8c40('0x1d')]=_0x1e2c61;if(_0x37dbdd[_0x8c40('0x2e')][_0x8c40('0x3e')]){_0xffd880[_0x8c40('0x3f')]=[{'all':!![]}];}return db[_0x8c40('0x2a')]['findAll'](_0xffd880);})[_0x8c40('0x23')](function(_0x2ce94b){_0x1ea795['rows']=_0x2ce94b;return _0x1ea795;})['then'](respondWithFilteredResult(_0x475a2e,_0xffd880))[_0x8c40('0x40')](handleError(_0x475a2e,null));};exports[_0x8c40('0x41')]=function(_0x17a7ca,_0x2278ae){var _0x10deec={'raw':!![],'where':{'id':_0x17a7ca['params']['id']}},_0x58280c={};_0x58280c[_0x8c40('0x32')]=_[_0x8c40('0x2f')](db['SmsQueueReport'][_0x8c40('0x2b')]);_0x58280c[_0x8c40('0x2e')]=_['keys'](_0x17a7ca['query']);_0x58280c[_0x8c40('0x30')]=_[_0x8c40('0x31')](_0x58280c['model'],_0x58280c[_0x8c40('0x2e')]);_0x10deec['attributes']=_[_0x8c40('0x31')](_0x58280c[_0x8c40('0x32')],qs[_0x8c40('0x34')](_0x17a7ca['query']['fields']));_0x10deec[_0x8c40('0x33')]=_0x10deec[_0x8c40('0x33')][_0x8c40('0x35')]?_0x10deec[_0x8c40('0x33')]:_0x58280c[_0x8c40('0x32')];if(_0x17a7ca[_0x8c40('0x2e')][_0x8c40('0x3e')]){_0x10deec['include']=[{'all':!![]}];}_0x10deec=_[_0x8c40('0x3a')]({},_0x10deec,_0x17a7ca[_0x8c40('0x3d')]);return db[_0x8c40('0x2a')][_0x8c40('0x42')](_0x10deec)['then'](handleEntityNotFound(_0x2278ae,null))[_0x8c40('0x23')](respondWithResult(_0x2278ae,null))['catch'](handleError(_0x2278ae,null));};exports[_0x8c40('0x43')]=function(_0x359fbf,_0x2d4a69){return db[_0x8c40('0x2a')][_0x8c40('0x43')](_0x359fbf[_0x8c40('0x44')],{})[_0x8c40('0x23')](respondWithResult(_0x2d4a69,0xc9))['catch'](handleError(_0x2d4a69,null));};exports[_0x8c40('0x22')]=function(_0x202a39,_0x5b3c0a){if(_0x202a39['body']['id']){delete _0x202a39[_0x8c40('0x44')]['id'];}return db['SmsQueueReport'][_0x8c40('0x42')]({'where':{'id':_0x202a39[_0x8c40('0x45')]['id']}})[_0x8c40('0x23')](handleEntityNotFound(_0x5b3c0a,null))[_0x8c40('0x23')](saveUpdates(_0x202a39[_0x8c40('0x44')],null))[_0x8c40('0x23')](respondWithResult(_0x5b3c0a,null))[_0x8c40('0x40')](handleError(_0x5b3c0a,null));};exports['destroy']=function(_0x433fab,_0x140b4a){return db['SmsQueueReport']['find']({'where':{'id':_0x433fab[_0x8c40('0x45')]['id']}})[_0x8c40('0x23')](handleEntityNotFound(_0x140b4a,null))[_0x8c40('0x23')](removeEntity(_0x140b4a,null))['catch'](handleError(_0x140b4a,null));};exports['describe']=function(_0x4f17c9,_0x7cc736){return db['SmsQueueReport']['describe']()[_0x8c40('0x23')](respondWithResult(_0x7cc736,null))['catch'](handleError(_0x7cc736,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5aff150..ee05ed6 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x18aaaf,_0x385db6){var _0x52d892=function(_0x1ac6da){while(--_0x1ac6da){_0x18aaaf['push'](_0x18aaaf['shift']());}};_0x52d892(++_0x385db6);}(_0xe706,0xa3));var _0x6e70=function(_0x6b2c5c,_0x3f6949){_0x6b2c5c=_0x6b2c5c-0x0;var _0x18e3ce=_0xe706[_0x6b2c5c];return _0x18e3ce;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x10df10,_0x4ac955){var _0x1c32c3=function(_0x531d61){while(--_0x531d61){_0x10df10['push'](_0x10df10['shift']());}};_0x1c32c3(++_0x4ac955);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 6e31fd6..82c99cf 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 _0xab7e=['request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','update','body','where','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0xab7e,0x9f));var _0xeab7=function(_0x266d82,_0x62d2e){_0x266d82=_0x266d82-0x0;var _0x483f1b=_0xab7e[_0x266d82];return _0x483f1b;};'use strict';var _=require(_0xeab7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xeab7('0x1'));var rs=require(_0xeab7('0x2'));var fs=require('fs');var Redis=require(_0xeab7('0x3'));var db=require(_0xeab7('0x4'))['db'];var utils=require(_0xeab7('0x5'));var logger=require(_0xeab7('0x6'))('rpc');var config=require(_0xeab7('0x7'));var jayson=require(_0xeab7('0x8'));var client=jayson[_0xeab7('0x9')][_0xeab7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x467279,_0x24ac0b,_0x3d8a2e){return new BPromise(function(_0x3fba58,_0x10107c){return client[_0xeab7('0xb')](_0x467279,_0x3d8a2e)[_0xeab7('0xc')](function(_0x39dbdd){logger[_0xeab7('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x24ac0b,_0xeab7('0xe'));logger[_0xeab7('0xf')](_0xeab7('0x10'),_0x24ac0b,_0xeab7('0xe'),JSON[_0xeab7('0x11')](_0x39dbdd));if(_0x39dbdd['error']){if(_0x39dbdd[_0xeab7('0x12')][_0xeab7('0x13')]===0x1f4){logger[_0xeab7('0x12')](_0xeab7('0x14'),_0x24ac0b,_0x39dbdd['error']['message']);return _0x10107c(_0x39dbdd['error'][_0xeab7('0x15')]);}logger[_0xeab7('0x12')](_0xeab7('0x14'),_0x24ac0b,_0x39dbdd[_0xeab7('0x12')][_0xeab7('0x15')]);return _0x3fba58(_0x39dbdd[_0xeab7('0x12')][_0xeab7('0x15')]);}else{logger[_0xeab7('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x24ac0b,'request\x20sent');_0x3fba58(_0x39dbdd[_0xeab7('0x16')][_0xeab7('0x15')]);}})[_0xeab7('0x17')](function(_0x17f831){logger[_0xeab7('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x24ac0b,_0x17f831);_0x10107c(_0x17f831);});});}exports[_0xeab7('0x18')]=function(_0x481044){var _0x376e60=this;return new Promise(function(_0x543126,_0x51365d){return db[_0xeab7('0x19')][_0xeab7('0x1a')](_0x481044['body'],{'raw':_0x481044[_0xeab7('0x1b')]?_0x481044[_0xeab7('0x1b')][_0xeab7('0x1c')]===undefined?!![]:![]:!![]})[_0xeab7('0xc')](function(_0x4810c8){logger[_0xeab7('0xd')](_0xeab7('0x18'),_0x481044);logger['debug']('CreateSmsQueueReport',_0x481044,JSON[_0xeab7('0x11')](_0x4810c8));_0x543126(_0x4810c8);})['catch'](function(_0x1e80e6){logger[_0xeab7('0x12')](_0xeab7('0x18'),_0x1e80e6[_0xeab7('0x15')],_0x481044);_0x51365d(_0x376e60['error'](0x1f4,_0x1e80e6[_0xeab7('0x15')]));});});};exports[_0xeab7('0x1d')]=function(_0x5da555){var _0x5871ba=this;return new Promise(function(_0x3d2ec6,_0x5b2fb2){return db['SmsQueueReport'][_0xeab7('0x1e')](_0x5da555[_0xeab7('0x1f')],{'raw':_0x5da555[_0xeab7('0x1b')]?_0x5da555[_0xeab7('0x1b')][_0xeab7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5da555[_0xeab7('0x1b')]?_0x5da555[_0xeab7('0x1b')][_0xeab7('0x20')]||null:null,'attributes':_0x5da555[_0xeab7('0x1b')]?_0x5da555['options']['attributes']||null:null,'limit':_0x5da555[_0xeab7('0x1b')]?_0x5da555[_0xeab7('0x1b')][_0xeab7('0x21')]||null:null})[_0xeab7('0xc')](function(_0x5cabcc){logger[_0xeab7('0xd')](_0xeab7('0x1d'),_0x5da555);logger[_0xeab7('0xf')](_0xeab7('0x1d'),_0x5da555,JSON[_0xeab7('0x11')](_0x5cabcc));_0x3d2ec6(_0x5cabcc);})['catch'](function(_0x2c4069){logger[_0xeab7('0x12')](_0xeab7('0x1d'),_0x2c4069[_0xeab7('0x15')],_0x5da555);_0x5b2fb2(_0x5871ba['error'](0x1f4,_0x2c4069[_0xeab7('0x15')]));});});}; \ No newline at end of file +var _0x3200=['info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateSmsQueueReport','SmsQueueReport','create','body','options','then','stringify','UpdateSmsQueueReport','update','raw','where','attributes','catch','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x539538,_0x507cdd){var _0x4f3320=function(_0x3f0286){while(--_0x3f0286){_0x539538['push'](_0x539538['shift']());}};_0x4f3320(++_0x507cdd);}(_0x3200,0x1c7));var _0x0320=function(_0x3ba75c,_0x48649a){_0x3ba75c=_0x3ba75c-0x0;var _0x162942=_0x3200[_0x3ba75c];return _0x162942;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0320('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0320('0x1'));var db=require(_0x0320('0x2'))['db'];var utils=require(_0x0320('0x3'));var logger=require('../../config/logger')(_0x0320('0x4'));var config=require(_0x0320('0x5'));var jayson=require(_0x0320('0x6'));var client=jayson[_0x0320('0x7')][_0x0320('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x544f39,_0x329e62,_0x3e40a2){return new BPromise(function(_0x5d917c,_0x4f89b8){return client[_0x0320('0x9')](_0x544f39,_0x3e40a2)['then'](function(_0x581ad2){logger[_0x0320('0xa')](_0x0320('0xb'),_0x329e62,_0x0320('0xc'));logger[_0x0320('0xd')](_0x0320('0xe'),_0x329e62,_0x0320('0xc'),JSON['stringify'](_0x581ad2));if(_0x581ad2[_0x0320('0xf')]){if(_0x581ad2[_0x0320('0xf')][_0x0320('0x10')]===0x1f4){logger[_0x0320('0xf')](_0x0320('0xb'),_0x329e62,_0x581ad2['error'][_0x0320('0x11')]);return _0x4f89b8(_0x581ad2[_0x0320('0xf')][_0x0320('0x11')]);}logger['error'](_0x0320('0xb'),_0x329e62,_0x581ad2[_0x0320('0xf')]['message']);return _0x5d917c(_0x581ad2[_0x0320('0xf')]['message']);}else{logger[_0x0320('0xa')](_0x0320('0xb'),_0x329e62,'request\x20sent');_0x5d917c(_0x581ad2['result'][_0x0320('0x11')]);}})['catch'](function(_0x90e9a2){logger[_0x0320('0xf')](_0x0320('0xb'),_0x329e62,_0x90e9a2);_0x4f89b8(_0x90e9a2);});});}exports[_0x0320('0x12')]=function(_0x11b14b){var _0x10b544=this;return new Promise(function(_0x4537c1,_0x5c3ae3){return db[_0x0320('0x13')][_0x0320('0x14')](_0x11b14b[_0x0320('0x15')],{'raw':_0x11b14b[_0x0320('0x16')]?_0x11b14b[_0x0320('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x0320('0x17')](function(_0x58956e){logger[_0x0320('0xa')](_0x0320('0x12'),_0x11b14b);logger[_0x0320('0xd')]('CreateSmsQueueReport',_0x11b14b,JSON[_0x0320('0x18')](_0x58956e));_0x4537c1(_0x58956e);})['catch'](function(_0x121386){logger[_0x0320('0xf')]('CreateSmsQueueReport',_0x121386[_0x0320('0x11')],_0x11b14b);_0x5c3ae3(_0x10b544[_0x0320('0xf')](0x1f4,_0x121386[_0x0320('0x11')]));});});};exports[_0x0320('0x19')]=function(_0x476741){var _0x3def33=this;return new Promise(function(_0x35b764,_0x3afa17){return db[_0x0320('0x13')][_0x0320('0x1a')](_0x476741[_0x0320('0x15')],{'raw':_0x476741[_0x0320('0x16')]?_0x476741['options'][_0x0320('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x476741[_0x0320('0x16')]?_0x476741[_0x0320('0x16')][_0x0320('0x1c')]||null:null,'attributes':_0x476741[_0x0320('0x16')]?_0x476741[_0x0320('0x16')][_0x0320('0x1d')]||null:null,'limit':_0x476741[_0x0320('0x16')]?_0x476741[_0x0320('0x16')]['limit']||null:null})[_0x0320('0x17')](function(_0x222f98){logger[_0x0320('0xa')]('UpdateSmsQueueReport',_0x476741);logger[_0x0320('0xd')](_0x0320('0x19'),_0x476741,JSON[_0x0320('0x18')](_0x222f98));_0x35b764(_0x222f98);})[_0x0320('0x1e')](function(_0x2ca7a8){logger[_0x0320('0xf')](_0x0320('0x19'),_0x2ca7a8[_0x0320('0x11')],_0x476741);_0x3afa17(_0x3def33['error'](0x1f4,_0x2ca7a8[_0x0320('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 13e681c..d188c15 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 _0xec39=['Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x5a96c3,_0x2bce78){var _0xeceaf4=function(_0x42f4ca){while(--_0x42f4ca){_0x5a96c3['push'](_0x5a96c3['shift']());}};_0xeceaf4(++_0x2bce78);}(_0xec39,0x19f));var _0x9ec3=function(_0x342116,_0x2aeb57){_0x342116=_0x342116-0x0;var _0x4192c7=_0xec39[_0x342116];return _0x4192c7;};'use strict';var multer=require(_0x9ec3('0x0'));var util=require(_0x9ec3('0x1'));var path=require(_0x9ec3('0x2'));var timeout=require(_0x9ec3('0x3'));var express=require(_0x9ec3('0x4'));var router=express[_0x9ec3('0x5')]();var fs_extra=require(_0x9ec3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9ec3('0x7'));var config=require(_0x9ec3('0x8'));var controller=require(_0x9ec3('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9ec3('0xa')](_0x9ec3('0xb'),auth[_0x9ec3('0xc')](),controller['describe']);router[_0x9ec3('0xa')](_0x9ec3('0xd'),auth[_0x9ec3('0xc')](),controller[_0x9ec3('0xe')]);router[_0x9ec3('0xf')]('/',auth[_0x9ec3('0xc')](),controller[_0x9ec3('0x10')]);router['put'](_0x9ec3('0xd'),auth[_0x9ec3('0xc')](),controller[_0x9ec3('0x11')]);router[_0x9ec3('0x12')](_0x9ec3('0xd'),auth[_0x9ec3('0xc')](),controller[_0x9ec3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x60c2=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x5c645c,_0x453ade){var _0x113f80=function(_0x277a29){while(--_0x277a29){_0x5c645c['push'](_0x5c645c['shift']());}};_0x113f80(++_0x453ade);}(_0x60c2,0x8f));var _0x260c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x60c2[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x260c('0x0'));var path=require(_0x260c('0x1'));var timeout=require(_0x260c('0x2'));var express=require(_0x260c('0x3'));var router=express[_0x260c('0x4')]();var fs_extra=require(_0x260c('0x5'));var auth=require(_0x260c('0x6'));var interaction=require(_0x260c('0x7'));var config=require(_0x260c('0x8'));var controller=require(_0x260c('0x9'));router[_0x260c('0xa')]('/',auth[_0x260c('0xb')](),controller['index']);router[_0x260c('0xa')](_0x260c('0xc'),auth[_0x260c('0xb')](),controller[_0x260c('0xd')]);router['get'](_0x260c('0xe'),auth[_0x260c('0xb')](),controller[_0x260c('0xf')]);router[_0x260c('0x10')]('/',auth[_0x260c('0xb')](),controller[_0x260c('0x11')]);router[_0x260c('0x12')]('/:id',auth[_0x260c('0xb')](),controller[_0x260c('0x13')]);router[_0x260c('0x14')]('/:id',auth[_0x260c('0xb')](),controller[_0x260c('0x15')]);module[_0x260c('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ee6603e..f6535f5 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x9bde,0xe1));var _0xe9bd=function(_0x55f4dd,_0x1a2103){_0x55f4dd=_0x55f4dd-0x0;var _0x45bca6=_0x9bde[_0x55f4dd];return _0x45bca6;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x7b79b,_0x5b7989){var _0x29944a=function(_0x466244){while(--_0x466244){_0x7b79b['push'](_0x7b79b['shift']());}};_0x29944a(++_0x5b7989);}(_0x70e0,0x17b));var _0x070e=function(_0xe48b7e,_0x6f86f9){_0xe48b7e=_0xe48b7e-0x0;var _0x1f96ae=_0x70e0[_0xe48b7e];return _0x1f96ae;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index aca2fc3..2eb23ad 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 _0x5880=['ejs','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','status','offset','undefined','limit','count','set','Content-Range','json','apply','update','destroy','then','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv'];(function(_0x2c784d,_0x5525bf){var _0x1ddb18=function(_0x1f7ff4){while(--_0x1f7ff4){_0x2c784d['push'](_0x2c784d['shift']());}};_0x1ddb18(++_0x5525bf);}(_0x5880,0x8d));var _0x0588=function(_0x18f772,_0x26794d){_0x18f772=_0x18f772-0x0;var _0x42839f=_0x5880[_0x18f772];return _0x42839f;};'use strict';var emlformat=require(_0x0588('0x0'));var rimraf=require(_0x0588('0x1'));var zipdir=require(_0x0588('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0588('0x3'));var BPromise=require(_0x0588('0x4'));var Mustache=require(_0x0588('0x5'));var util=require(_0x0588('0x6'));var path=require(_0x0588('0x7'));var sox=require('sox');var csv=require(_0x0588('0x8'));var ejs=require(_0x0588('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0588('0xa'));var crypto=require(_0x0588('0xb'));var jsforce=require(_0x0588('0xc'));var deskjs=require(_0x0588('0xd'));var toCsv=require(_0x0588('0x8'));var querystring=require(_0x0588('0xe'));var Papa=require(_0x0588('0xf'));var Redis=require(_0x0588('0x10'));var authService=require(_0x0588('0x11'));var qs=require(_0x0588('0x12'));var as=require(_0x0588('0x13'));var hardwareService=require(_0x0588('0x14'));var logger=require(_0x0588('0x15'))(_0x0588('0x16'));var utils=require(_0x0588('0x17'));var config=require(_0x0588('0x18'));var licenseUtil=require(_0x0588('0x19'));var db=require(_0x0588('0x1a'))['db'];function respondWithStatusCode(_0x1e8f86,_0x110cb2){_0x110cb2=_0x110cb2||0xcc;return function(_0x21a05b){if(_0x21a05b){return _0x1e8f86['sendStatus'](_0x110cb2);}return _0x1e8f86['status'](_0x110cb2)['end']();};}function respondWithResult(_0x203f5d,_0x561d06){_0x561d06=_0x561d06||0xc8;return function(_0x2c930e){if(_0x2c930e){return _0x203f5d[_0x0588('0x1b')](_0x561d06)['json'](_0x2c930e);}};}function respondWithFilteredResult(_0x1f22b4,_0x5f5660){return function(_0x10af3f){if(_0x10af3f){var _0x1638f8=typeof _0x5f5660[_0x0588('0x1c')]===_0x0588('0x1d')&&typeof _0x5f5660[_0x0588('0x1e')]==='undefined';var _0x3b8989=_0x10af3f[_0x0588('0x1f')];var _0x3824d4=_0x1638f8?0x0:_0x5f5660[_0x0588('0x1c')];var _0x2c2fe4=_0x1638f8?_0x10af3f[_0x0588('0x1f')]:_0x5f5660[_0x0588('0x1c')]+_0x5f5660[_0x0588('0x1e')];var _0x133f48;if(_0x2c2fe4>=_0x3b8989){_0x2c2fe4=_0x3b8989;_0x133f48=0xc8;}else{_0x133f48=0xce;}_0x1f22b4[_0x0588('0x1b')](_0x133f48);return _0x1f22b4[_0x0588('0x20')](_0x0588('0x21'),_0x3824d4+'-'+_0x2c2fe4+'/'+_0x3b8989)[_0x0588('0x22')](_0x10af3f);}return null;};}function patchUpdates(_0x2f8754){return function(_0x5e38a1){try{jsonpatch[_0x0588('0x23')](_0x5e38a1,_0x2f8754,!![]);}catch(_0x436b43){return BPromise['reject'](_0x436b43);}return _0x5e38a1['save']();};}function saveUpdates(_0x427c18,_0x54afaf){return function(_0x51cab3){if(_0x51cab3){return _0x51cab3[_0x0588('0x24')](_0x427c18)['then'](function(_0x209afe){return _0x209afe;});}return null;};}function removeEntity(_0x35c6e1,_0x559dc4){return function(_0x6ccfa7){if(_0x6ccfa7){return _0x6ccfa7[_0x0588('0x25')]()[_0x0588('0x26')](function(){_0x35c6e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a2ea0,_0x19552e){return function(_0x5b24b0){if(!_0x5b24b0){_0x4a2ea0['sendStatus'](0x194);}return _0x5b24b0;};}function handleError(_0x1d04f3,_0x4b1083){_0x4b1083=_0x4b1083||0x1f4;return function(_0x413e27){logger[_0x0588('0x27')](_0x413e27[_0x0588('0x28')]);if(_0x413e27[_0x0588('0x29')]){delete _0x413e27[_0x0588('0x29')];}_0x1d04f3['status'](_0x4b1083)[_0x0588('0x2a')](_0x413e27);};}exports[_0x0588('0x2b')]=function(_0x1e4f02,_0x1d1621){var _0x5c1957={},_0x3f5c2c={},_0x28ac61={'count':0x0,'rows':[]};var _0x2d54e0=_[_0x0588('0x2c')](db[_0x0588('0x2d')][_0x0588('0x2e')],function(_0x28807a){return{'name':_0x28807a[_0x0588('0x2f')],'type':_0x28807a[_0x0588('0x30')][_0x0588('0x31')]};});_0x3f5c2c[_0x0588('0x32')]=_[_0x0588('0x2c')](_0x2d54e0,_0x0588('0x29'));_0x3f5c2c[_0x0588('0x33')]=_[_0x0588('0x34')](_0x1e4f02['query']);_0x3f5c2c['filters']=_[_0x0588('0x35')](_0x3f5c2c[_0x0588('0x32')],_0x3f5c2c[_0x0588('0x33')]);_0x5c1957['attributes']=_[_0x0588('0x35')](_0x3f5c2c['model'],qs[_0x0588('0x36')](_0x1e4f02[_0x0588('0x33')][_0x0588('0x36')]));_0x5c1957[_0x0588('0x37')]=_0x5c1957[_0x0588('0x37')][_0x0588('0x38')]?_0x5c1957[_0x0588('0x37')]:_0x3f5c2c[_0x0588('0x32')];if(!_0x1e4f02[_0x0588('0x33')][_0x0588('0x39')](_0x0588('0x3a'))){_0x5c1957[_0x0588('0x1e')]=qs[_0x0588('0x1e')](_0x1e4f02[_0x0588('0x33')][_0x0588('0x1e')]);_0x5c1957[_0x0588('0x1c')]=qs[_0x0588('0x1c')](_0x1e4f02['query'][_0x0588('0x1c')]);}_0x5c1957[_0x0588('0x3b')]=qs['sort'](_0x1e4f02[_0x0588('0x33')][_0x0588('0x3c')]);_0x5c1957[_0x0588('0x3d')]=qs['filters'](_['pick'](_0x1e4f02[_0x0588('0x33')],_0x3f5c2c[_0x0588('0x3e')]),_0x2d54e0);if(_0x1e4f02[_0x0588('0x33')]['filter']){_0x5c1957[_0x0588('0x3d')]=_['merge'](_0x5c1957[_0x0588('0x3d')],{'$or':_[_0x0588('0x2c')](_0x2d54e0,function(_0x3b68a9){if(_0x3b68a9[_0x0588('0x30')]!=='VIRTUAL'){var _0x9d7412={};_0x9d7412[_0x3b68a9[_0x0588('0x29')]]={'$like':'%'+_0x1e4f02[_0x0588('0x33')]['filter']+'%'};return _0x9d7412;}})});}_0x5c1957=_[_0x0588('0x3f')]({},_0x5c1957,_0x1e4f02[_0x0588('0x40')]);var _0x303852={'where':_0x5c1957[_0x0588('0x3d')]};return db[_0x0588('0x2d')][_0x0588('0x1f')](_0x303852)[_0x0588('0x26')](function(_0x283801){_0x28ac61[_0x0588('0x1f')]=_0x283801;if(_0x1e4f02[_0x0588('0x33')][_0x0588('0x41')]){_0x5c1957[_0x0588('0x42')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x0588('0x43')](_0x5c1957);})[_0x0588('0x26')](function(_0x31e895){_0x28ac61['rows']=_0x31e895;return _0x28ac61;})[_0x0588('0x26')](respondWithFilteredResult(_0x1d1621,_0x5c1957))[_0x0588('0x44')](handleError(_0x1d1621,null));};exports[_0x0588('0x45')]=function(_0x20c81f,_0x4e83ee){var _0x3ae8f8={'raw':!![],'where':{'id':_0x20c81f[_0x0588('0x46')]['id']}},_0x5436e9={};_0x5436e9['model']=_[_0x0588('0x34')](db[_0x0588('0x2d')][_0x0588('0x2e')]);_0x5436e9['query']=_[_0x0588('0x34')](_0x20c81f[_0x0588('0x33')]);_0x5436e9[_0x0588('0x3e')]=_[_0x0588('0x35')](_0x5436e9[_0x0588('0x32')],_0x5436e9[_0x0588('0x33')]);_0x3ae8f8[_0x0588('0x37')]=_[_0x0588('0x35')](_0x5436e9[_0x0588('0x32')],qs[_0x0588('0x36')](_0x20c81f[_0x0588('0x33')][_0x0588('0x36')]));_0x3ae8f8[_0x0588('0x37')]=_0x3ae8f8['attributes'][_0x0588('0x38')]?_0x3ae8f8['attributes']:_0x5436e9[_0x0588('0x32')];if(_0x20c81f[_0x0588('0x33')][_0x0588('0x41')]){_0x3ae8f8[_0x0588('0x42')]=[{'all':!![]}];}_0x3ae8f8=_[_0x0588('0x3f')]({},_0x3ae8f8,_0x20c81f[_0x0588('0x40')]);return db['SmsTransferReport'][_0x0588('0x47')](_0x3ae8f8)['then'](handleEntityNotFound(_0x4e83ee,null))[_0x0588('0x26')](respondWithResult(_0x4e83ee,null))[_0x0588('0x44')](handleError(_0x4e83ee,null));};exports[_0x0588('0x48')]=function(_0x1ac87c,_0x343362){return db[_0x0588('0x2d')][_0x0588('0x48')](_0x1ac87c[_0x0588('0x49')],{})[_0x0588('0x26')](respondWithResult(_0x343362,0xc9))[_0x0588('0x44')](handleError(_0x343362,null));};exports['update']=function(_0x1aa6ac,_0x2764a8){if(_0x1aa6ac['body']['id']){delete _0x1aa6ac[_0x0588('0x49')]['id'];}return db[_0x0588('0x2d')][_0x0588('0x47')]({'where':{'id':_0x1aa6ac[_0x0588('0x46')]['id']}})[_0x0588('0x26')](handleEntityNotFound(_0x2764a8,null))[_0x0588('0x26')](saveUpdates(_0x1aa6ac[_0x0588('0x49')],null))[_0x0588('0x26')](respondWithResult(_0x2764a8,null))['catch'](handleError(_0x2764a8,null));};exports['destroy']=function(_0xe07c85,_0x58c058){return db[_0x0588('0x2d')]['find']({'where':{'id':_0xe07c85[_0x0588('0x46')]['id']}})[_0x0588('0x26')](handleEntityNotFound(_0x58c058,null))[_0x0588('0x26')](removeEntity(_0x58c058,null))[_0x0588('0x44')](handleError(_0x58c058,null));};exports[_0x0588('0x4a')]=function(_0x53bb01,_0x1fe815){return db['SmsTransferReport'][_0x0588('0x4a')]()[_0x0588('0x26')](respondWithResult(_0x1fe815,null))[_0x0588('0x44')](handleError(_0x1fe815,null));}; \ No newline at end of file +var _0xc384=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','send','index','map','SmsTransferReport','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x253eb6,_0x5680ef){var _0x5446e=function(_0x57b960){while(--_0x57b960){_0x253eb6['push'](_0x253eb6['shift']());}};_0x5446e(++_0x5680ef);}(_0xc384,0xe1));var _0x4c38=function(_0x325453,_0x552936){_0x325453=_0x325453-0x0;var _0x477660=_0xc384[_0x325453];return _0x477660;};'use strict';var emlformat=require(_0x4c38('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c38('0x1'));var jsonpatch=require(_0x4c38('0x2'));var rp=require(_0x4c38('0x3'));var moment=require(_0x4c38('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4c38('0x5'));var path=require('path');var sox=require(_0x4c38('0x6'));var csv=require(_0x4c38('0x7'));var ejs=require(_0x4c38('0x8'));var fs=require('fs');var fs_extra=require(_0x4c38('0x9'));var _=require(_0x4c38('0xa'));var squel=require(_0x4c38('0xb'));var crypto=require(_0x4c38('0xc'));var jsforce=require(_0x4c38('0xd'));var deskjs=require(_0x4c38('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4c38('0xf'));var Redis=require(_0x4c38('0x10'));var authService=require(_0x4c38('0x11'));var qs=require(_0x4c38('0x12'));var as=require(_0x4c38('0x13'));var hardwareService=require(_0x4c38('0x14'));var logger=require(_0x4c38('0x15'))(_0x4c38('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4c38('0x17'))['db'];function respondWithStatusCode(_0x334b69,_0x1aea1c){_0x1aea1c=_0x1aea1c||0xcc;return function(_0x40f041){if(_0x40f041){return _0x334b69[_0x4c38('0x18')](_0x1aea1c);}return _0x334b69[_0x4c38('0x19')](_0x1aea1c)[_0x4c38('0x1a')]();};}function respondWithResult(_0x35f686,_0x110be8){_0x110be8=_0x110be8||0xc8;return function(_0x53d127){if(_0x53d127){return _0x35f686[_0x4c38('0x19')](_0x110be8)['json'](_0x53d127);}};}function respondWithFilteredResult(_0x1e98de,_0x37fff3){return function(_0x3bfdc1){if(_0x3bfdc1){var _0x1170a=typeof _0x37fff3[_0x4c38('0x1b')]===_0x4c38('0x1c')&&typeof _0x37fff3[_0x4c38('0x1d')]===_0x4c38('0x1c');var _0x3b2747=_0x3bfdc1[_0x4c38('0x1e')];var _0x45e4f2=_0x1170a?0x0:_0x37fff3['offset'];var _0x4551e9=_0x1170a?_0x3bfdc1['count']:_0x37fff3['offset']+_0x37fff3[_0x4c38('0x1d')];var _0x2903a4;if(_0x4551e9>=_0x3b2747){_0x4551e9=_0x3b2747;_0x2903a4=0xc8;}else{_0x2903a4=0xce;}_0x1e98de[_0x4c38('0x19')](_0x2903a4);return _0x1e98de['set'](_0x4c38('0x1f'),_0x45e4f2+'-'+_0x4551e9+'/'+_0x3b2747)[_0x4c38('0x20')](_0x3bfdc1);}return null;};}function patchUpdates(_0x180e6d){return function(_0x4c35ed){try{jsonpatch[_0x4c38('0x21')](_0x4c35ed,_0x180e6d,!![]);}catch(_0x3e95c1){return BPromise[_0x4c38('0x22')](_0x3e95c1);}return _0x4c35ed['save']();};}function saveUpdates(_0x4a1371,_0x499d11){return function(_0x2b6603){if(_0x2b6603){return _0x2b6603[_0x4c38('0x23')](_0x4a1371)[_0x4c38('0x24')](function(_0x35843e){return _0x35843e;});}return null;};}function removeEntity(_0x2fcfbb,_0x375887){return function(_0x372362){if(_0x372362){return _0x372362[_0x4c38('0x25')]()[_0x4c38('0x24')](function(){_0x2fcfbb['status'](0xcc)[_0x4c38('0x1a')]();});}};}function handleEntityNotFound(_0x6f7ae1,_0x4b66ad){return function(_0x42ea38){if(!_0x42ea38){_0x6f7ae1[_0x4c38('0x18')](0x194);}return _0x42ea38;};}function handleError(_0x9b7ccd,_0x19b876){_0x19b876=_0x19b876||0x1f4;return function(_0x172227){logger[_0x4c38('0x26')](_0x172227[_0x4c38('0x27')]);if(_0x172227['name']){delete _0x172227['name'];}_0x9b7ccd[_0x4c38('0x19')](_0x19b876)[_0x4c38('0x28')](_0x172227);};}exports[_0x4c38('0x29')]=function(_0x3e2cda,_0x4293ee){var _0x42ba08={},_0x5ab5d3={},_0x13c408={'count':0x0,'rows':[]};var _0x3294a5=_[_0x4c38('0x2a')](db[_0x4c38('0x2b')]['rawAttributes'],function(_0x3898ab){return{'name':_0x3898ab[_0x4c38('0x2c')],'type':_0x3898ab[_0x4c38('0x2d')][_0x4c38('0x2e')]};});_0x5ab5d3[_0x4c38('0x2f')]=_[_0x4c38('0x2a')](_0x3294a5,_0x4c38('0x30'));_0x5ab5d3[_0x4c38('0x31')]=_[_0x4c38('0x32')](_0x3e2cda[_0x4c38('0x31')]);_0x5ab5d3['filters']=_[_0x4c38('0x33')](_0x5ab5d3[_0x4c38('0x2f')],_0x5ab5d3[_0x4c38('0x31')]);_0x42ba08[_0x4c38('0x34')]=_[_0x4c38('0x33')](_0x5ab5d3['model'],qs[_0x4c38('0x35')](_0x3e2cda[_0x4c38('0x31')][_0x4c38('0x35')]));_0x42ba08[_0x4c38('0x34')]=_0x42ba08[_0x4c38('0x34')][_0x4c38('0x36')]?_0x42ba08[_0x4c38('0x34')]:_0x5ab5d3[_0x4c38('0x2f')];if(!_0x3e2cda[_0x4c38('0x31')][_0x4c38('0x37')](_0x4c38('0x38'))){_0x42ba08[_0x4c38('0x1d')]=qs[_0x4c38('0x1d')](_0x3e2cda[_0x4c38('0x31')][_0x4c38('0x1d')]);_0x42ba08[_0x4c38('0x1b')]=qs[_0x4c38('0x1b')](_0x3e2cda[_0x4c38('0x31')]['offset']);}_0x42ba08[_0x4c38('0x39')]=qs['sort'](_0x3e2cda[_0x4c38('0x31')][_0x4c38('0x3a')]);_0x42ba08[_0x4c38('0x3b')]=qs['filters'](_[_0x4c38('0x3c')](_0x3e2cda['query'],_0x5ab5d3[_0x4c38('0x3d')]),_0x3294a5);if(_0x3e2cda[_0x4c38('0x31')]['filter']){_0x42ba08['where']=_[_0x4c38('0x3e')](_0x42ba08['where'],{'$or':_[_0x4c38('0x2a')](_0x3294a5,function(_0xd33a2f){if(_0xd33a2f[_0x4c38('0x2d')]!=='VIRTUAL'){var _0x27e73a={};_0x27e73a[_0xd33a2f[_0x4c38('0x30')]]={'$like':'%'+_0x3e2cda[_0x4c38('0x31')][_0x4c38('0x3f')]+'%'};return _0x27e73a;}})});}_0x42ba08=_[_0x4c38('0x3e')]({},_0x42ba08,_0x3e2cda['options']);var _0x25fabc={'where':_0x42ba08[_0x4c38('0x3b')]};return db['SmsTransferReport'][_0x4c38('0x1e')](_0x25fabc)[_0x4c38('0x24')](function(_0x4da167){_0x13c408['count']=_0x4da167;if(_0x3e2cda[_0x4c38('0x31')][_0x4c38('0x40')]){_0x42ba08['include']=[{'all':!![]}];}return db[_0x4c38('0x2b')][_0x4c38('0x41')](_0x42ba08);})[_0x4c38('0x24')](function(_0x359152){_0x13c408[_0x4c38('0x42')]=_0x359152;return _0x13c408;})['then'](respondWithFilteredResult(_0x4293ee,_0x42ba08))[_0x4c38('0x43')](handleError(_0x4293ee,null));};exports[_0x4c38('0x44')]=function(_0x3f5680,_0x125bf1){var _0xddf000={'raw':!![],'where':{'id':_0x3f5680[_0x4c38('0x45')]['id']}},_0x399072={};_0x399072[_0x4c38('0x2f')]=_[_0x4c38('0x32')](db[_0x4c38('0x2b')][_0x4c38('0x46')]);_0x399072['query']=_['keys'](_0x3f5680[_0x4c38('0x31')]);_0x399072['filters']=_[_0x4c38('0x33')](_0x399072[_0x4c38('0x2f')],_0x399072[_0x4c38('0x31')]);_0xddf000[_0x4c38('0x34')]=_[_0x4c38('0x33')](_0x399072[_0x4c38('0x2f')],qs[_0x4c38('0x35')](_0x3f5680[_0x4c38('0x31')][_0x4c38('0x35')]));_0xddf000[_0x4c38('0x34')]=_0xddf000[_0x4c38('0x34')]['length']?_0xddf000[_0x4c38('0x34')]:_0x399072[_0x4c38('0x2f')];if(_0x3f5680['query'][_0x4c38('0x40')]){_0xddf000[_0x4c38('0x47')]=[{'all':!![]}];}_0xddf000=_[_0x4c38('0x3e')]({},_0xddf000,_0x3f5680[_0x4c38('0x48')]);return db[_0x4c38('0x2b')]['find'](_0xddf000)[_0x4c38('0x24')](handleEntityNotFound(_0x125bf1,null))[_0x4c38('0x24')](respondWithResult(_0x125bf1,null))[_0x4c38('0x43')](handleError(_0x125bf1,null));};exports[_0x4c38('0x49')]=function(_0x1a7fb1,_0x58e35a){return db[_0x4c38('0x2b')][_0x4c38('0x49')](_0x1a7fb1[_0x4c38('0x4a')],{})[_0x4c38('0x24')](respondWithResult(_0x58e35a,0xc9))[_0x4c38('0x43')](handleError(_0x58e35a,null));};exports[_0x4c38('0x23')]=function(_0x51d732,_0x1ddc85){if(_0x51d732['body']['id']){delete _0x51d732[_0x4c38('0x4a')]['id'];}return db[_0x4c38('0x2b')][_0x4c38('0x4b')]({'where':{'id':_0x51d732['params']['id']}})[_0x4c38('0x24')](handleEntityNotFound(_0x1ddc85,null))[_0x4c38('0x24')](saveUpdates(_0x51d732['body'],null))[_0x4c38('0x24')](respondWithResult(_0x1ddc85,null))[_0x4c38('0x43')](handleError(_0x1ddc85,null));};exports[_0x4c38('0x25')]=function(_0x6a4d76,_0x5eb16e){return db[_0x4c38('0x2b')][_0x4c38('0x4b')]({'where':{'id':_0x6a4d76[_0x4c38('0x45')]['id']}})['then'](handleEntityNotFound(_0x5eb16e,null))['then'](removeEntity(_0x5eb16e,null))[_0x4c38('0x43')](handleError(_0x5eb16e,null));};exports[_0x4c38('0x4c')]=function(_0x313422,_0x24c5f0){return db[_0x4c38('0x2b')][_0x4c38('0x4c')]()[_0x4c38('0x24')](respondWithResult(_0x24c5f0,null))[_0x4c38('0x43')](handleError(_0x24c5f0,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 6d10872..0a580aa 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 _0x851c=['rimraf','../../config/environment','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x851c,0x19d));var _0xc851=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x851c[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xc851('0x0'));var util=require(_0xc851('0x1'));var logger=require(_0xc851('0x2'))(_0xc851('0x3'));var moment=require(_0xc851('0x4'));var BPromise=require(_0xc851('0x5'));var rp=require(_0xc851('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc851('0x7'));var config=require(_0xc851('0x8'));var attributes=require('./smsTransferReport.attributes');module[_0xc851('0x9')]=function(_0x272e34,_0x535cf1){return _0x272e34[_0xc851('0xa')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xc851('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5447=['../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x429ac7,_0x473e61){var _0x1262a6=function(_0xb422ed){while(--_0xb422ed){_0x429ac7['push'](_0x429ac7['shift']());}};_0x1262a6(++_0x473e61);}(_0x5447,0xf1));var _0x7544=function(_0x5c9039,_0x5e46ea){_0x5c9039=_0x5c9039-0x0;var _0x1f00c5=_0x5447[_0x5c9039];return _0x1f00c5;};'use strict';var _=require(_0x7544('0x0'));var util=require('util');var logger=require(_0x7544('0x1'))(_0x7544('0x2'));var moment=require('moment');var BPromise=require(_0x7544('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7544('0x4'));var rimraf=require(_0x7544('0x5'));var config=require(_0x7544('0x6'));var attributes=require(_0x7544('0x7'));module[_0x7544('0x8')]=function(_0x7e80,_0x3feef7){return _0x7e80[_0x7544('0x9')](_0x7544('0xa'),attributes,{'tableName':_0x7544('0xb'),'paranoid':![],'indexes':[{'name':_0x7544('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index ec8ac01..7df1163 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 _0x1666=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x3403bd,_0x2231f2){var _0x5941f8=function(_0x4140c0){while(--_0x4140c0){_0x3403bd['push'](_0x3403bd['shift']());}};_0x5941f8(++_0x2231f2);}(_0x1666,0x75));var _0x6166=function(_0x4b322f,_0x2947ed){_0x4b322f=_0x4b322f-0x0;var _0xf221d8=_0x1666[_0x4b322f];return _0xf221d8;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var moment=require('moment');var BPromise=require(_0x6166('0x2'));var rs=require(_0x6166('0x3'));var fs=require('fs');var Redis=require(_0x6166('0x4'));var db=require(_0x6166('0x5'))['db'];var utils=require(_0x6166('0x6'));var logger=require(_0x6166('0x7'))(_0x6166('0x8'));var config=require(_0x6166('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6166('0xa')][_0x6166('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x211a92,_0x1a61d0,_0x3a29ca){return new BPromise(function(_0x4873da,_0x51b51f){return client['request'](_0x211a92,_0x3a29ca)[_0x6166('0xc')](function(_0x5ee7b3){logger[_0x6166('0xd')](_0x6166('0xe'),_0x1a61d0,_0x6166('0xf'));logger[_0x6166('0x10')](_0x6166('0x11'),_0x1a61d0,_0x6166('0xf'),JSON[_0x6166('0x12')](_0x5ee7b3));if(_0x5ee7b3['error']){if(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x14')]===0x1f4){logger[_0x6166('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x1a61d0,_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);return _0x51b51f(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);}logger['error'](_0x6166('0xe'),_0x1a61d0,_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);return _0x4873da(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);}else{logger[_0x6166('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x1a61d0,_0x6166('0xf'));_0x4873da(_0x5ee7b3[_0x6166('0x16')][_0x6166('0x15')]);}})[_0x6166('0x17')](function(_0x24bdf3){logger[_0x6166('0x13')](_0x6166('0xe'),_0x1a61d0,_0x24bdf3);_0x51b51f(_0x24bdf3);});});} \ No newline at end of file +var _0x2a9a=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','catch'];(function(_0x23afb0,_0x4f4c5d){var _0x4d0be8=function(_0x1d1323){while(--_0x1d1323){_0x23afb0['push'](_0x23afb0['shift']());}};_0x4d0be8(++_0x4f4c5d);}(_0x2a9a,0x64));var _0xa2a9=function(_0x3074eb,_0x1f49ca){_0x3074eb=_0x3074eb-0x0;var _0xd08b66=_0x2a9a[_0x3074eb];return _0xd08b66;};'use strict';var _=require(_0xa2a9('0x0'));var util=require('util');var moment=require(_0xa2a9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa2a9('0x2'));var db=require(_0xa2a9('0x3'))['db'];var utils=require(_0xa2a9('0x4'));var logger=require(_0xa2a9('0x5'))(_0xa2a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa2a9('0x7'));var client=jayson[_0xa2a9('0x8')][_0xa2a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bd1f3,_0x5c1fb2,_0x5d933f){return new BPromise(function(_0x540979,_0x523164){return client[_0xa2a9('0xa')](_0x2bd1f3,_0x5d933f)[_0xa2a9('0xb')](function(_0x3eaaa6){logger[_0xa2a9('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x5c1fb2,_0xa2a9('0xd'));logger[_0xa2a9('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x5c1fb2,_0xa2a9('0xd'),JSON[_0xa2a9('0xf')](_0x3eaaa6));if(_0x3eaaa6[_0xa2a9('0x10')]){if(_0x3eaaa6[_0xa2a9('0x10')]['code']===0x1f4){logger[_0xa2a9('0x10')](_0xa2a9('0x11'),_0x5c1fb2,_0x3eaaa6[_0xa2a9('0x10')][_0xa2a9('0x12')]);return _0x523164(_0x3eaaa6[_0xa2a9('0x10')][_0xa2a9('0x12')]);}logger['error'](_0xa2a9('0x11'),_0x5c1fb2,_0x3eaaa6[_0xa2a9('0x10')]['message']);return _0x540979(_0x3eaaa6['error']['message']);}else{logger[_0xa2a9('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x5c1fb2,_0xa2a9('0xd'));_0x540979(_0x3eaaa6['result'][_0xa2a9('0x12')]);}})[_0xa2a9('0x13')](function(_0x657934){logger[_0xa2a9('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x5c1fb2,_0x657934);_0x523164(_0x657934);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index faf0e6e..b3c2e5a 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 _0x2231=['get','isAuthenticated','index','/:id','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','create','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller'];(function(_0x273855,_0x49674b){var _0x426d11=function(_0x497045){while(--_0x497045){_0x273855['push'](_0x273855['shift']());}};_0x426d11(++_0x49674b);}(_0x2231,0xf3));var _0x1223=function(_0x12d6c2,_0x409bc8){_0x12d6c2=_0x12d6c2-0x0;var _0x1c9825=_0x2231[_0x12d6c2];return _0x1c9825;};'use strict';var multer=require(_0x1223('0x0'));var util=require(_0x1223('0x1'));var path=require(_0x1223('0x2'));var timeout=require(_0x1223('0x3'));var express=require(_0x1223('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1223('0x5'));var interaction=require(_0x1223('0x6'));var config=require(_0x1223('0x7'));var controller=require(_0x1223('0x8'));router[_0x1223('0x9')]('/',auth[_0x1223('0xa')](),controller[_0x1223('0xb')]);router[_0x1223('0x9')](_0x1223('0xc'),auth[_0x1223('0xa')](),controller['show']);router[_0x1223('0x9')]('/:id/download',auth[_0x1223('0xa')](),controller[_0x1223('0xd')]);var upload=multer({'storage':multer[_0x1223('0xe')]({'destination':function(_0x53235e,_0x18d300,_0x2d4cb3){_0x2d4cb3(null,path[_0x1223('0xf')](config[_0x1223('0x10')],_0x1223('0x11')));},'filename':function(_0x2374af,_0x642eaa,_0x38af3c){_0x642eaa[_0x1223('0x12')]=_0x642eaa[_0x1223('0x12')][_0x1223('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x38af3c(null,util[_0x1223('0x14')]('%s-%s%s',path[_0x1223('0x15')](_0x642eaa[_0x1223('0x12')],path[_0x1223('0x16')](_0x642eaa[_0x1223('0x12')])),Date[_0x1223('0x17')](),path[_0x1223('0x16')](_0x642eaa[_0x1223('0x12')])));}})});router[_0x1223('0x18')]('/',upload['single']('file'),controller[_0x1223('0x19')]);router['put'](_0x1223('0xc'),auth[_0x1223('0xa')](),controller['update']);router[_0x1223('0x1a')](_0x1223('0xc'),auth[_0x1223('0xa')](),controller[_0x1223('0x1a')]);module[_0x1223('0x1b')]=router; \ No newline at end of file +var _0x14e2=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','get','/:id','show','diskStorage','join','server/files/sounds/original/','originalname','basename','extname','post','create','put','update','delete','exports'];(function(_0x2b9af6,_0x475a9b){var _0x20ed39=function(_0x386d34){while(--_0x386d34){_0x2b9af6['push'](_0x2b9af6['shift']());}};_0x20ed39(++_0x475a9b);}(_0x14e2,0xe1));var _0x214e=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x14e2[_0x276468];return _0x36dc3a;};'use strict';var multer=require(_0x214e('0x0'));var util=require('util');var path=require(_0x214e('0x1'));var timeout=require('connect-timeout');var express=require(_0x214e('0x2'));var router=express[_0x214e('0x3')]();var fs_extra=require(_0x214e('0x4'));var auth=require(_0x214e('0x5'));var interaction=require(_0x214e('0x6'));var config=require(_0x214e('0x7'));var controller=require(_0x214e('0x8'));router['get']('/',auth[_0x214e('0x9')](),controller['index']);router[_0x214e('0xa')](_0x214e('0xb'),auth[_0x214e('0x9')](),controller[_0x214e('0xc')]);router[_0x214e('0xa')]('/:id/download',auth[_0x214e('0x9')](),controller['download']);var upload=multer({'storage':multer[_0x214e('0xd')]({'destination':function(_0x36ac95,_0x3d7e0f,_0x4ab26e){_0x4ab26e(null,path[_0x214e('0xe')](config['root'],_0x214e('0xf')));},'filename':function(_0x3dd773,_0x27a7c7,_0x2910d8){_0x27a7c7[_0x214e('0x10')]=_0x27a7c7[_0x214e('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2910d8(null,util['format']('%s-%s%s',path[_0x214e('0x11')](_0x27a7c7['originalname'],path[_0x214e('0x12')](_0x27a7c7[_0x214e('0x10')])),Date['now'](),path[_0x214e('0x12')](_0x27a7c7[_0x214e('0x10')])));}})});router[_0x214e('0x13')]('/',upload['single']('file'),controller[_0x214e('0x14')]);router[_0x214e('0x15')](_0x214e('0xb'),auth[_0x214e('0x9')](),controller[_0x214e('0x16')]);router[_0x214e('0x17')](_0x214e('0xb'),auth[_0x214e('0x9')](),controller['delete']);module[_0x214e('0x18')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 431683a..9718c86 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 _0x893c=['BIGINT','INTEGER','STRING','name','FLOAT'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x893c,0x1e7));var _0xc893=function(_0x34c553,_0x3e7dfc){_0x34c553=_0x34c553-0x0;var _0x1357d2=_0x893c[_0x34c553];return _0x1357d2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc893('0x0')],'unique':_0xc893('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0xc893('0x0')]},'display_name':{'type':Sequelize[_0xc893('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0xc893('0x0')]},'original_format':{'type':Sequelize[_0xc893('0x0')]},'original_duration':{'type':Sequelize[_0xc893('0x2')]},'original_sampleCount':{'type':Sequelize[_0xc893('0x3')]},'original_channelCount':{'type':Sequelize[_0xc893('0x4')]},'original_bitRate':{'type':Sequelize[_0xc893('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xc893('0x0')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xc893('0x4')]},'converted_bitRate':{'type':Sequelize[_0xc893('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xc893('0x4')]}}; \ No newline at end of file +var _0x4ccc=['exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x4ccc,0x145));var _0xc4cc=function(_0x58a3c0,_0x4bdb75){_0x58a3c0=_0x58a3c0-0x0;var _0x49bf1f=_0x4ccc[_0x58a3c0];return _0x49bf1f;};'use strict';var Sequelize=require('sequelize');module[_0xc4cc('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xc4cc('0x1')]},'original_format':{'type':Sequelize[_0xc4cc('0x1')]},'original_duration':{'type':Sequelize[_0xc4cc('0x2')]},'original_sampleCount':{'type':Sequelize[_0xc4cc('0x3')]},'original_channelCount':{'type':Sequelize[_0xc4cc('0x4')]},'original_bitRate':{'type':Sequelize[_0xc4cc('0x3')]},'original_sampleRate':{'type':Sequelize[_0xc4cc('0x4')]},'converted_format':{'type':Sequelize[_0xc4cc('0x1')]},'converted_duration':{'type':Sequelize[_0xc4cc('0x2')]},'converted_sampleCount':{'type':Sequelize[_0xc4cc('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xc4cc('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xc4cc('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0f388ce..d2721e8 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 _0x9387=['original_sampleCount','original_channelCount','channelCount','original_bitRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_bitRate','bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','download','format','%s.%s','create','basename','originalname','file','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','unlinkSync','src','duration'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x9387,0x94));var _0x7938=function(_0x317b9b,_0x4b7154){_0x317b9b=_0x317b9b-0x0;var _0x2e015a=_0x9387[_0x317b9b];return _0x2e015a;};'use strict';var emlformat=require(_0x7938('0x0'));var rimraf=require(_0x7938('0x1'));var zipdir=require(_0x7938('0x2'));var jsonpatch=require(_0x7938('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7938('0x4'));var Mustache=require('mustache');var util=require(_0x7938('0x5'));var path=require(_0x7938('0x6'));var sox=require('sox');var csv=require(_0x7938('0x7'));var ejs=require(_0x7938('0x8'));var fs=require('fs');var fs_extra=require(_0x7938('0x9'));var _=require(_0x7938('0xa'));var squel=require(_0x7938('0xb'));var crypto=require('crypto');var jsforce=require(_0x7938('0xc'));var deskjs=require(_0x7938('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7938('0xe'));var Papa=require(_0x7938('0xf'));var Redis=require(_0x7938('0x10'));var authService=require(_0x7938('0x11'));var qs=require(_0x7938('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7938('0x13'));var logger=require(_0x7938('0x14'))('api');var utils=require(_0x7938('0x15'));var config=require(_0x7938('0x16'));var licenseUtil=require(_0x7938('0x17'));var db=require(_0x7938('0x18'))['db'];function respondWithStatusCode(_0x14ce10,_0x42af48){_0x42af48=_0x42af48||0xcc;return function(_0x4b5099){if(_0x4b5099){return _0x14ce10[_0x7938('0x19')](_0x42af48);}return _0x14ce10[_0x7938('0x1a')](_0x42af48)[_0x7938('0x1b')]();};}function respondWithResult(_0x1c8ca6,_0x71f5ab){_0x71f5ab=_0x71f5ab||0xc8;return function(_0x59468f){if(_0x59468f){return _0x1c8ca6[_0x7938('0x1a')](_0x71f5ab)[_0x7938('0x1c')](_0x59468f);}};}function respondWithFilteredResult(_0x214048,_0x534b93){return function(_0x3cb91e){if(_0x3cb91e){var _0x3225e8=typeof _0x534b93[_0x7938('0x1d')]===_0x7938('0x1e')&&typeof _0x534b93[_0x7938('0x1f')]==='undefined';var _0x3ac230=_0x3cb91e[_0x7938('0x20')];var _0x5d7ded=_0x3225e8?0x0:_0x534b93[_0x7938('0x1d')];var _0x39215a=_0x3225e8?_0x3cb91e[_0x7938('0x20')]:_0x534b93[_0x7938('0x1d')]+_0x534b93[_0x7938('0x1f')];var _0x4a5835;if(_0x39215a>=_0x3ac230){_0x39215a=_0x3ac230;_0x4a5835=0xc8;}else{_0x4a5835=0xce;}_0x214048[_0x7938('0x1a')](_0x4a5835);return _0x214048[_0x7938('0x21')](_0x7938('0x22'),_0x5d7ded+'-'+_0x39215a+'/'+_0x3ac230)[_0x7938('0x1c')](_0x3cb91e);}return null;};}function patchUpdates(_0x5a4ab2){return function(_0x4df731){try{jsonpatch[_0x7938('0x23')](_0x4df731,_0x5a4ab2,!![]);}catch(_0x17a8a7){return BPromise[_0x7938('0x24')](_0x17a8a7);}return _0x4df731['save']();};}function saveUpdates(_0x4625d8,_0x4ccc07){return function(_0xe6a33b){if(_0xe6a33b){return _0xe6a33b[_0x7938('0x25')](_0x4625d8)['then'](function(_0x197b99){return _0x197b99;});}return null;};}function removeEntity(_0x526938,_0x361790){return function(_0x22a915){if(_0x22a915){return _0x22a915[_0x7938('0x26')]()[_0x7938('0x27')](function(){var _0x52b20d=_0x22a915[_0x7938('0x28')]({'plain':!![]});var _0x444327=_0x7938('0x29');return db[_0x7938('0x2a')]['destroy']({'where':{'type':_0x444327,'resourceId':_0x52b20d['id']}})[_0x7938('0x27')](function(){return _0x22a915;});})[_0x7938('0x27')](function(){_0x526938['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57c6cd,_0x591929){return function(_0x317436){if(!_0x317436){_0x57c6cd['sendStatus'](0x194);}return _0x317436;};}function handleError(_0xfc61f2,_0x499559){_0x499559=_0x499559||0x1f4;return function(_0x2c7125){logger[_0x7938('0x2b')](_0x2c7125[_0x7938('0x2c')]);if(_0x2c7125[_0x7938('0x2d')]){delete _0x2c7125[_0x7938('0x2d')];}_0xfc61f2[_0x7938('0x1a')](_0x499559)[_0x7938('0x2e')](_0x2c7125);};}exports[_0x7938('0x2f')]=function(_0x1eec0a,_0x4a89ef){var _0x5b0612={},_0x24704e={},_0x9c1711={'count':0x0,'rows':[]};var _0x436817=_[_0x7938('0x30')](db[_0x7938('0x31')]['rawAttributes'],function(_0x43c8bc){return{'name':_0x43c8bc[_0x7938('0x32')],'type':_0x43c8bc['type'][_0x7938('0x33')]};});_0x24704e[_0x7938('0x34')]=_['map'](_0x436817,_0x7938('0x2d'));_0x24704e[_0x7938('0x35')]=_[_0x7938('0x36')](_0x1eec0a['query']);_0x24704e[_0x7938('0x37')]=_[_0x7938('0x38')](_0x24704e[_0x7938('0x34')],_0x24704e[_0x7938('0x35')]);_0x5b0612[_0x7938('0x39')]=_[_0x7938('0x38')](_0x24704e['model'],qs[_0x7938('0x3a')](_0x1eec0a[_0x7938('0x35')]['fields']));_0x5b0612[_0x7938('0x39')]=_0x5b0612[_0x7938('0x39')][_0x7938('0x3b')]?_0x5b0612[_0x7938('0x39')]:_0x24704e['model'];if(!_0x1eec0a['query'][_0x7938('0x3c')](_0x7938('0x3d'))){_0x5b0612[_0x7938('0x1f')]=qs[_0x7938('0x1f')](_0x1eec0a[_0x7938('0x35')][_0x7938('0x1f')]);_0x5b0612['offset']=qs[_0x7938('0x1d')](_0x1eec0a[_0x7938('0x35')][_0x7938('0x1d')]);}_0x5b0612['order']=qs[_0x7938('0x3e')](_0x1eec0a[_0x7938('0x35')][_0x7938('0x3e')]);_0x5b0612[_0x7938('0x3f')]=qs[_0x7938('0x37')](_[_0x7938('0x40')](_0x1eec0a[_0x7938('0x35')],_0x24704e[_0x7938('0x37')]),_0x436817);if(_0x1eec0a[_0x7938('0x35')]['filter']){_0x5b0612[_0x7938('0x3f')]=_[_0x7938('0x41')](_0x5b0612[_0x7938('0x3f')],{'$or':_[_0x7938('0x30')](_0x436817,function(_0x31f1ee){if(_0x31f1ee[_0x7938('0x42')]!==_0x7938('0x43')){var _0x33256b={};_0x33256b[_0x31f1ee[_0x7938('0x2d')]]={'$like':'%'+_0x1eec0a[_0x7938('0x35')][_0x7938('0x44')]+'%'};return _0x33256b;}})});}_0x5b0612=_[_0x7938('0x41')]({},_0x5b0612,_0x1eec0a[_0x7938('0x45')]);var _0x557589={'where':_0x5b0612[_0x7938('0x3f')]};return db[_0x7938('0x31')][_0x7938('0x20')](_0x557589)[_0x7938('0x27')](function(_0x1daf45){_0x9c1711['count']=_0x1daf45;if(_0x1eec0a[_0x7938('0x35')][_0x7938('0x46')]){_0x5b0612[_0x7938('0x47')]=[{'all':!![]}];}return db['Sound'][_0x7938('0x48')](_0x5b0612);})['then'](function(_0x1e0995){_0x9c1711[_0x7938('0x49')]=_0x1e0995;return _0x9c1711;})['then'](respondWithFilteredResult(_0x4a89ef,_0x5b0612))[_0x7938('0x4a')](handleError(_0x4a89ef,null));};exports['show']=function(_0x56b678,_0x394765){var _0x37ad89={'raw':!![],'where':{'id':_0x56b678[_0x7938('0x4b')]['id']}},_0x189445={};_0x189445[_0x7938('0x34')]=_[_0x7938('0x36')](db[_0x7938('0x31')][_0x7938('0x4c')]);_0x189445[_0x7938('0x35')]=_[_0x7938('0x36')](_0x56b678[_0x7938('0x35')]);_0x189445[_0x7938('0x37')]=_[_0x7938('0x38')](_0x189445['model'],_0x189445[_0x7938('0x35')]);_0x37ad89[_0x7938('0x39')]=_[_0x7938('0x38')](_0x189445[_0x7938('0x34')],qs['fields'](_0x56b678[_0x7938('0x35')][_0x7938('0x3a')]));_0x37ad89[_0x7938('0x39')]=_0x37ad89['attributes'][_0x7938('0x3b')]?_0x37ad89[_0x7938('0x39')]:_0x189445['model'];if(_0x56b678['query'][_0x7938('0x46')]){_0x37ad89[_0x7938('0x47')]=[{'all':!![]}];}_0x37ad89=_[_0x7938('0x41')]({},_0x37ad89,_0x56b678[_0x7938('0x45')]);return db[_0x7938('0x31')][_0x7938('0x4d')](_0x37ad89)[_0x7938('0x27')](handleEntityNotFound(_0x394765,null))[_0x7938('0x27')](respondWithResult(_0x394765,null))[_0x7938('0x4a')](handleError(_0x394765,null));};exports['download']=function(_0x20cf00,_0x59b373,_0x15134d){return db['Sound'][_0x7938('0x4d')]({'where':{'id':_0x20cf00[_0x7938('0x4b')]['id']},'attributes':[_0x7938('0x2d'),_0x7938('0x4e'),_0x7938('0x4f')],'raw':!![]})[_0x7938('0x27')](handleEntityNotFound(_0x59b373,null))[_0x7938('0x27')](function(_0x16c5c6){if(_0x16c5c6){if(!fs['existsSync'](path[_0x7938('0x50')](config[_0x7938('0x51')],_0x7938('0x52'),_0x16c5c6[_0x7938('0x4e')]+'.'+_0x16c5c6[_0x7938('0x4f')]))){throw new db[(_0x7938('0x53'))]['ValidationError'](_0x7938('0x54'));}return _0x59b373[_0x7938('0x55')](path[_0x7938('0x50')](config[_0x7938('0x51')],_0x7938('0x52'),util[_0x7938('0x56')](_0x7938('0x57'),_0x16c5c6[_0x7938('0x4e')],_0x16c5c6[_0x7938('0x4f')])),util['format'](_0x7938('0x57'),_0x16c5c6[_0x7938('0x2d')],_0x16c5c6['converted_format']));}return null;})['catch'](handleError(_0x59b373,null));};exports[_0x7938('0x58')]=function(_0x16f71e,_0x642573,_0x18f9c4){var _0x512bce={'name':path[_0x7938('0x59')](_0x16f71e['file'][_0x7938('0x5a')],path['extname'](_0x16f71e[_0x7938('0x5b')][_0x7938('0x5a')])),'save_name':path[_0x7938('0x59')](_0x16f71e['file'][_0x7938('0x5c')],path[_0x7938('0x5d')](_0x16f71e[_0x7938('0x5b')]['filename'])),'original_format':path[_0x7938('0x5d')](_0x16f71e['file']['originalname'])[_0x7938('0x5e')](0x1),'converted_format':_0x7938('0x5f')};var _0x50098a=path[_0x7938('0x50')](config[_0x7938('0x51')],_0x7938('0x60'),_0x16f71e[_0x7938('0x5b')][_0x7938('0x5c')]);var _0x4b6661=path['join'](config['root'],_0x7938('0x52'),util['format'](_0x7938('0x57'),path['basename'](_0x16f71e['file'][_0x7938('0x5c')],path[_0x7938('0x5d')](_0x16f71e[_0x7938('0x5b')][_0x7938('0x5c')])),_0x512bce[_0x7938('0x4f')]));logger[_0x7938('0x61')](_0x7938('0x62'),_0x50098a);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x4b6661);try{fs[_0x7938('0x63')](_0x50098a,parseInt('0777',0x8));var _0x5dadd7=sox[_0x7938('0x64')](_0x50098a,_0x4b6661,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5dadd7['on'](_0x7938('0x2b'),function(_0x4d7e32){fs[_0x7938('0x65')](_0x50098a);_0x642573[_0x7938('0x1a')](0x1f4)[_0x7938('0x2e')](_0x4d7e32);});_0x5dadd7['on'](_0x7938('0x66'),function(_0x27c5ad){_0x512bce['original_duration']=isNaN(_0x27c5ad[_0x7938('0x67')])?null:_0x27c5ad[_0x7938('0x67')]*0x3e8;_0x512bce[_0x7938('0x68')]=isNaN(_0x27c5ad['sampleCount'])?null:_0x27c5ad['sampleCount'];_0x512bce[_0x7938('0x69')]=isNaN(_0x27c5ad[_0x7938('0x6a')])?null:_0x27c5ad['channelCount'];_0x512bce[_0x7938('0x6b')]=isNaN(_0x27c5ad['bitRate'])?null:_0x27c5ad['bitRate'];_0x512bce['original_sampleRate']=isNaN(_0x27c5ad[_0x7938('0x6c')])?null:_0x27c5ad[_0x7938('0x6c')];});_0x5dadd7['on'](_0x7938('0x6d'),function(_0x2c7e72){_0x512bce[_0x7938('0x6e')]=isNaN(_0x2c7e72[_0x7938('0x67')])?null:_0x2c7e72[_0x7938('0x67')]*0x3e8;_0x512bce[_0x7938('0x6f')]=isNaN(_0x2c7e72['sampleCount'])?null:_0x2c7e72[_0x7938('0x70')];_0x512bce['converted_channelCount']=isNaN(_0x2c7e72[_0x7938('0x6a')])?null:_0x2c7e72['channelCount'];_0x512bce[_0x7938('0x71')]=isNaN(_0x2c7e72[_0x7938('0x72')])?null:_0x2c7e72[_0x7938('0x72')];_0x512bce[_0x7938('0x73')]=isNaN(_0x2c7e72['sampleRate'])?null:_0x2c7e72['sampleRate'];});_0x5dadd7['on'](_0x7938('0x1b'),function(){fs[_0x7938('0x63')](_0x4b6661,parseInt('0777',0x8));return db['Sound'][_0x7938('0x58')](_0x512bce)['then'](function(_0x385902){var _0x8af08={'role':_0x16f71e['body'][_0x7938('0x74')],'userProfileId':_0x16f71e[_0x7938('0x75')][_0x7938('0x76')]};if(!_0x8af08)throw new Error(_0x7938('0x77'));if(_0x8af08['role']===_0x7938('0x78')){var _0x54609a=_0x385902[_0x7938('0x28')]({'plain':!![]});return db[_0x7938('0x79')][_0x7938('0x4d')]({'where':{'name':_0x7938('0x29'),'userProfileId':_0x8af08[_0x7938('0x76')]},'raw':!![]})[_0x7938('0x27')](function(_0x62a7b4){if(_0x62a7b4&&_0x62a7b4[_0x7938('0x7a')]===0x0){return db[_0x7938('0x2a')]['create']({'name':_0x54609a[_0x7938('0x2d')],'resourceId':_0x54609a['id'],'type':_0x62a7b4['name'],'sectionId':_0x62a7b4['id']},{})['then'](function(){return _0x385902;});}else{return _0x385902;}})['catch'](function(_0x9897b7){logger[_0x7938('0x2b')](_0x7938('0x7b'),_0x9897b7);throw _0x9897b7;});}return _0x385902;})[_0x7938('0x27')](respondWithResult(_0x642573,null))[_0x7938('0x4a')](handleError(_0x642573,null));});_0x5dadd7[_0x7938('0x7c')]();}catch(_0xd0ec8a){_0x642573[_0x7938('0x1a')](0x1f4)[_0x7938('0x2e')](_0xd0ec8a);}};exports[_0x7938('0x25')]=function(_0x2b7d0f,_0x1de1f4,_0x594a4d){return db['Sound'][_0x7938('0x4d')]({'where':{'id':_0x2b7d0f[_0x7938('0x4b')]['id']}})[_0x7938('0x27')](handleEntityNotFound(_0x1de1f4,null))[_0x7938('0x27')](saveUpdates(_[_0x7938('0x40')](_0x2b7d0f[_0x7938('0x75')],[_0x7938('0x2d'),'description']),null))[_0x7938('0x27')](respondWithResult(_0x1de1f4,null))[_0x7938('0x4a')](handleError(_0x1de1f4,null));};exports[_0x7938('0x7d')]=function(_0x34b1c1,_0x4ce9ad,_0x26ea33){return db[_0x7938('0x31')][_0x7938('0x4d')]({'where':{'id':_0x34b1c1[_0x7938('0x4b')]['id']}})['then'](function(_0x36c740){if(_0x36c740){return _0x36c740[_0x7938('0x26')]();}})[_0x7938('0x27')](function(_0x2888e2){var _0x507eee=path[_0x7938('0x50')](config[_0x7938('0x51')],_0x7938('0x60'),util[_0x7938('0x56')]('%s.%s',_0x2888e2[_0x7938('0x4e')],_0x2888e2['original_format']));var _0x534ec8=path[_0x7938('0x50')](config[_0x7938('0x51')],'server/files/sounds/converted',util[_0x7938('0x56')](_0x7938('0x57'),_0x2888e2[_0x7938('0x4e')],_0x2888e2[_0x7938('0x4f')]));fs[_0x7938('0x65')](_0x507eee);fs['unlinkSync'](_0x534ec8);return _0x2888e2;})[_0x7938('0x27')](function(_0x645072){if(_0x645072){return _0x4ce9ad['status'](0xcc)[_0x7938('0x1b')]();}})['then'](handleEntityNotFound(_0x4ce9ad,null))['catch'](handleError(_0x4ce9ad,null));}; \ No newline at end of file +var _0xbedd=['options','Sound','includeAll','include','findAll','rows','catch','show','find','download','params','save_name','root','server/files/sounds/converted','converted_format','ValidationError','Sound\x20not\x20found','join','%s.%s','format','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','0777','transcode','unlinkSync','src','original_duration','duration','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','start','description','delete','original_format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge'];(function(_0x2af8f9,_0x1bf301){var _0x39b60f=function(_0x10bbf9){while(--_0x10bbf9){_0x2af8f9['push'](_0x2af8f9['shift']());}};_0x39b60f(++_0x1bf301);}(_0xbedd,0xb2));var _0xdbed=function(_0x45494,_0x1040a5){_0x45494=_0x45494-0x0;var _0x2ee547=_0xbedd[_0x45494];return _0x2ee547;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdbed('0x0'));var jsonpatch=require(_0xdbed('0x1'));var rp=require(_0xdbed('0x2'));var moment=require('moment');var BPromise=require(_0xdbed('0x3'));var Mustache=require(_0xdbed('0x4'));var util=require('util');var path=require(_0xdbed('0x5'));var sox=require('sox');var csv=require(_0xdbed('0x6'));var ejs=require(_0xdbed('0x7'));var fs=require('fs');var fs_extra=require(_0xdbed('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdbed('0x9'));var jsforce=require(_0xdbed('0xa'));var deskjs=require(_0xdbed('0xb'));var toCsv=require(_0xdbed('0x6'));var querystring=require('querystring');var Papa=require(_0xdbed('0xc'));var Redis=require(_0xdbed('0xd'));var authService=require(_0xdbed('0xe'));var qs=require(_0xdbed('0xf'));var as=require(_0xdbed('0x10'));var hardwareService=require(_0xdbed('0x11'));var logger=require(_0xdbed('0x12'))('api');var utils=require(_0xdbed('0x13'));var config=require(_0xdbed('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e00ab,_0x4dad44){_0x4dad44=_0x4dad44||0xcc;return function(_0x283a29){if(_0x283a29){return _0x4e00ab[_0xdbed('0x15')](_0x4dad44);}return _0x4e00ab[_0xdbed('0x16')](_0x4dad44)[_0xdbed('0x17')]();};}function respondWithResult(_0x3ddbe8,_0x1435b5){_0x1435b5=_0x1435b5||0xc8;return function(_0x218ee7){if(_0x218ee7){return _0x3ddbe8[_0xdbed('0x16')](_0x1435b5)['json'](_0x218ee7);}};}function respondWithFilteredResult(_0x770fda,_0x2ef335){return function(_0x1b5d03){if(_0x1b5d03){var _0x2eda70=typeof _0x2ef335[_0xdbed('0x18')]===_0xdbed('0x19')&&typeof _0x2ef335[_0xdbed('0x1a')]===_0xdbed('0x19');var _0x3f5568=_0x1b5d03[_0xdbed('0x1b')];var _0x1cdeb0=_0x2eda70?0x0:_0x2ef335[_0xdbed('0x18')];var _0x3c7455=_0x2eda70?_0x1b5d03[_0xdbed('0x1b')]:_0x2ef335[_0xdbed('0x18')]+_0x2ef335['limit'];var _0x5ae0cb;if(_0x3c7455>=_0x3f5568){_0x3c7455=_0x3f5568;_0x5ae0cb=0xc8;}else{_0x5ae0cb=0xce;}_0x770fda[_0xdbed('0x16')](_0x5ae0cb);return _0x770fda[_0xdbed('0x1c')](_0xdbed('0x1d'),_0x1cdeb0+'-'+_0x3c7455+'/'+_0x3f5568)[_0xdbed('0x1e')](_0x1b5d03);}return null;};}function patchUpdates(_0x5b85be){return function(_0x3b90c2){try{jsonpatch[_0xdbed('0x1f')](_0x3b90c2,_0x5b85be,!![]);}catch(_0x76e2d0){return BPromise[_0xdbed('0x20')](_0x76e2d0);}return _0x3b90c2[_0xdbed('0x21')]();};}function saveUpdates(_0x2ddd63,_0x49a9f0){return function(_0x6991da){if(_0x6991da){return _0x6991da[_0xdbed('0x22')](_0x2ddd63)[_0xdbed('0x23')](function(_0x1fb62c){return _0x1fb62c;});}return null;};}function removeEntity(_0x18ef6c,_0x1a42d6){return function(_0xcededa){if(_0xcededa){return _0xcededa[_0xdbed('0x24')]()[_0xdbed('0x23')](function(){var _0xb37c9=_0xcededa[_0xdbed('0x25')]({'plain':!![]});var _0x38e3bf=_0xdbed('0x26');return db[_0xdbed('0x27')][_0xdbed('0x24')]({'where':{'type':_0x38e3bf,'resourceId':_0xb37c9['id']}})[_0xdbed('0x23')](function(){return _0xcededa;});})['then'](function(){_0x18ef6c[_0xdbed('0x16')](0xcc)[_0xdbed('0x17')]();});}};}function handleEntityNotFound(_0x57d2cb,_0x23e25f){return function(_0x3a5ecc){if(!_0x3a5ecc){_0x57d2cb[_0xdbed('0x15')](0x194);}return _0x3a5ecc;};}function handleError(_0xd396a2,_0x2c5a64){_0x2c5a64=_0x2c5a64||0x1f4;return function(_0x4f2b18){logger[_0xdbed('0x28')](_0x4f2b18['stack']);if(_0x4f2b18[_0xdbed('0x29')]){delete _0x4f2b18['name'];}_0xd396a2[_0xdbed('0x16')](_0x2c5a64)[_0xdbed('0x2a')](_0x4f2b18);};}exports[_0xdbed('0x2b')]=function(_0x513f1d,_0x4005f6){var _0x150461={},_0x536d18={},_0x39ccbb={'count':0x0,'rows':[]};var _0x1a8b46=_['map'](db['Sound'][_0xdbed('0x2c')],function(_0xf6e528){return{'name':_0xf6e528[_0xdbed('0x2d')],'type':_0xf6e528[_0xdbed('0x2e')][_0xdbed('0x2f')]};});_0x536d18[_0xdbed('0x30')]=_[_0xdbed('0x31')](_0x1a8b46,_0xdbed('0x29'));_0x536d18[_0xdbed('0x32')]=_[_0xdbed('0x33')](_0x513f1d['query']);_0x536d18[_0xdbed('0x34')]=_[_0xdbed('0x35')](_0x536d18[_0xdbed('0x30')],_0x536d18['query']);_0x150461[_0xdbed('0x36')]=_[_0xdbed('0x35')](_0x536d18[_0xdbed('0x30')],qs[_0xdbed('0x37')](_0x513f1d[_0xdbed('0x32')]['fields']));_0x150461[_0xdbed('0x36')]=_0x150461['attributes'][_0xdbed('0x38')]?_0x150461[_0xdbed('0x36')]:_0x536d18[_0xdbed('0x30')];if(!_0x513f1d['query']['hasOwnProperty'](_0xdbed('0x39'))){_0x150461[_0xdbed('0x1a')]=qs['limit'](_0x513f1d[_0xdbed('0x32')]['limit']);_0x150461[_0xdbed('0x18')]=qs[_0xdbed('0x18')](_0x513f1d[_0xdbed('0x32')]['offset']);}_0x150461[_0xdbed('0x3a')]=qs[_0xdbed('0x3b')](_0x513f1d['query'][_0xdbed('0x3b')]);_0x150461['where']=qs['filters'](_[_0xdbed('0x3c')](_0x513f1d[_0xdbed('0x32')],_0x536d18[_0xdbed('0x34')]),_0x1a8b46);if(_0x513f1d[_0xdbed('0x32')][_0xdbed('0x3d')]){_0x150461[_0xdbed('0x3e')]=_[_0xdbed('0x3f')](_0x150461[_0xdbed('0x3e')],{'$or':_[_0xdbed('0x31')](_0x1a8b46,function(_0x5d5c6e){if(_0x5d5c6e[_0xdbed('0x2e')]!=='VIRTUAL'){var _0x2ac824={};_0x2ac824[_0x5d5c6e[_0xdbed('0x29')]]={'$like':'%'+_0x513f1d['query']['filter']+'%'};return _0x2ac824;}})});}_0x150461=_[_0xdbed('0x3f')]({},_0x150461,_0x513f1d[_0xdbed('0x40')]);var _0x34c12d={'where':_0x150461[_0xdbed('0x3e')]};return db[_0xdbed('0x41')][_0xdbed('0x1b')](_0x34c12d)['then'](function(_0x11a753){_0x39ccbb[_0xdbed('0x1b')]=_0x11a753;if(_0x513f1d[_0xdbed('0x32')][_0xdbed('0x42')]){_0x150461[_0xdbed('0x43')]=[{'all':!![]}];}return db[_0xdbed('0x41')][_0xdbed('0x44')](_0x150461);})[_0xdbed('0x23')](function(_0x1d6c6c){_0x39ccbb[_0xdbed('0x45')]=_0x1d6c6c;return _0x39ccbb;})[_0xdbed('0x23')](respondWithFilteredResult(_0x4005f6,_0x150461))[_0xdbed('0x46')](handleError(_0x4005f6,null));};exports[_0xdbed('0x47')]=function(_0x60a672,_0x1b38a1){var _0xda6a5e={'raw':!![],'where':{'id':_0x60a672['params']['id']}},_0x416558={};_0x416558['model']=_[_0xdbed('0x33')](db[_0xdbed('0x41')][_0xdbed('0x2c')]);_0x416558[_0xdbed('0x32')]=_[_0xdbed('0x33')](_0x60a672[_0xdbed('0x32')]);_0x416558[_0xdbed('0x34')]=_[_0xdbed('0x35')](_0x416558['model'],_0x416558[_0xdbed('0x32')]);_0xda6a5e[_0xdbed('0x36')]=_[_0xdbed('0x35')](_0x416558[_0xdbed('0x30')],qs[_0xdbed('0x37')](_0x60a672['query'][_0xdbed('0x37')]));_0xda6a5e[_0xdbed('0x36')]=_0xda6a5e[_0xdbed('0x36')][_0xdbed('0x38')]?_0xda6a5e['attributes']:_0x416558[_0xdbed('0x30')];if(_0x60a672['query'][_0xdbed('0x42')]){_0xda6a5e['include']=[{'all':!![]}];}_0xda6a5e=_[_0xdbed('0x3f')]({},_0xda6a5e,_0x60a672[_0xdbed('0x40')]);return db[_0xdbed('0x41')][_0xdbed('0x48')](_0xda6a5e)['then'](handleEntityNotFound(_0x1b38a1,null))[_0xdbed('0x23')](respondWithResult(_0x1b38a1,null))[_0xdbed('0x46')](handleError(_0x1b38a1,null));};exports[_0xdbed('0x49')]=function(_0x3e5c1f,_0x2a9ba3,_0x59d97d){return db[_0xdbed('0x41')][_0xdbed('0x48')]({'where':{'id':_0x3e5c1f[_0xdbed('0x4a')]['id']},'attributes':[_0xdbed('0x29'),_0xdbed('0x4b'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x2a9ba3,null))['then'](function(_0x1a8093){if(_0x1a8093){if(!fs['existsSync'](path['join'](config[_0xdbed('0x4c')],_0xdbed('0x4d'),_0x1a8093[_0xdbed('0x4b')]+'.'+_0x1a8093[_0xdbed('0x4e')]))){throw new db['Sequelize'][(_0xdbed('0x4f'))](_0xdbed('0x50'));}return _0x2a9ba3[_0xdbed('0x49')](path[_0xdbed('0x51')](config[_0xdbed('0x4c')],_0xdbed('0x4d'),util['format'](_0xdbed('0x52'),_0x1a8093['save_name'],_0x1a8093[_0xdbed('0x4e')])),util[_0xdbed('0x53')](_0xdbed('0x52'),_0x1a8093[_0xdbed('0x29')],_0x1a8093[_0xdbed('0x4e')]));}return null;})[_0xdbed('0x46')](handleError(_0x2a9ba3,null));};exports[_0xdbed('0x54')]=function(_0x311fef,_0x18a9af,_0xe7bda5){var _0x144907={'name':path[_0xdbed('0x55')](_0x311fef[_0xdbed('0x56')][_0xdbed('0x57')],path[_0xdbed('0x58')](_0x311fef[_0xdbed('0x56')][_0xdbed('0x57')])),'save_name':path['basename'](_0x311fef[_0xdbed('0x56')][_0xdbed('0x59')],path['extname'](_0x311fef['file'][_0xdbed('0x59')])),'original_format':path[_0xdbed('0x58')](_0x311fef[_0xdbed('0x56')][_0xdbed('0x57')])['substring'](0x1),'converted_format':_0xdbed('0x5a')};var _0x4c7515=path['join'](config[_0xdbed('0x4c')],_0xdbed('0x5b'),_0x311fef['file'][_0xdbed('0x59')]);var _0x5b4f5f=path['join'](config[_0xdbed('0x4c')],'server/files/sounds/converted',util[_0xdbed('0x53')](_0xdbed('0x52'),path[_0xdbed('0x55')](_0x311fef[_0xdbed('0x56')]['filename'],path[_0xdbed('0x58')](_0x311fef[_0xdbed('0x56')][_0xdbed('0x59')])),_0x144907[_0xdbed('0x4e')]));logger[_0xdbed('0x5c')](_0xdbed('0x5d'),_0x4c7515);logger[_0xdbed('0x5c')]('Sound\x20upload\x20destination:\x20%s',_0x5b4f5f);try{fs['chmodSync'](_0x4c7515,parseInt(_0xdbed('0x5e'),0x8));var _0x1ad14b=sox[_0xdbed('0x5f')](_0x4c7515,_0x5b4f5f,{'sampleRate':0x1f40,'format':_0xdbed('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1ad14b['on'](_0xdbed('0x28'),function(_0x17190c){fs[_0xdbed('0x60')](_0x4c7515);_0x18a9af['status'](0x1f4)['send'](_0x17190c);});_0x1ad14b['on'](_0xdbed('0x61'),function(_0x179a22){_0x144907[_0xdbed('0x62')]=isNaN(_0x179a22[_0xdbed('0x63')])?null:_0x179a22[_0xdbed('0x63')]*0x3e8;_0x144907['original_sampleCount']=isNaN(_0x179a22['sampleCount'])?null:_0x179a22['sampleCount'];_0x144907['original_channelCount']=isNaN(_0x179a22[_0xdbed('0x64')])?null:_0x179a22[_0xdbed('0x64')];_0x144907[_0xdbed('0x65')]=isNaN(_0x179a22[_0xdbed('0x66')])?null:_0x179a22['bitRate'];_0x144907[_0xdbed('0x67')]=isNaN(_0x179a22[_0xdbed('0x68')])?null:_0x179a22[_0xdbed('0x68')];});_0x1ad14b['on'](_0xdbed('0x69'),function(_0x225218){_0x144907[_0xdbed('0x6a')]=isNaN(_0x225218[_0xdbed('0x63')])?null:_0x225218[_0xdbed('0x63')]*0x3e8;_0x144907[_0xdbed('0x6b')]=isNaN(_0x225218[_0xdbed('0x6c')])?null:_0x225218[_0xdbed('0x6c')];_0x144907['converted_channelCount']=isNaN(_0x225218[_0xdbed('0x64')])?null:_0x225218[_0xdbed('0x64')];_0x144907[_0xdbed('0x6d')]=isNaN(_0x225218[_0xdbed('0x66')])?null:_0x225218[_0xdbed('0x66')];_0x144907[_0xdbed('0x6e')]=isNaN(_0x225218[_0xdbed('0x68')])?null:_0x225218[_0xdbed('0x68')];});_0x1ad14b['on'](_0xdbed('0x17'),function(){fs['chmodSync'](_0x5b4f5f,parseInt(_0xdbed('0x5e'),0x8));return db[_0xdbed('0x41')][_0xdbed('0x54')](_0x144907)[_0xdbed('0x23')](function(_0x3001c0){var _0xf048b6={'role':_0x311fef[_0xdbed('0x6f')]['role'],'userProfileId':_0x311fef[_0xdbed('0x6f')][_0xdbed('0x70')]};if(!_0xf048b6)throw new Error(_0xdbed('0x71'));if(_0xf048b6[_0xdbed('0x72')]==='user'){var _0x3976cf=_0x3001c0['get']({'plain':!![]});return db[_0xdbed('0x73')]['find']({'where':{'name':_0xdbed('0x26'),'userProfileId':_0xf048b6[_0xdbed('0x70')]},'raw':!![]})[_0xdbed('0x23')](function(_0x28c97a){if(_0x28c97a&&_0x28c97a[_0xdbed('0x74')]===0x0){return db['UserProfileResource']['create']({'name':_0x3976cf[_0xdbed('0x29')],'resourceId':_0x3976cf['id'],'type':_0x28c97a['name'],'sectionId':_0x28c97a['id']},{})['then'](function(){return _0x3001c0;});}else{return _0x3001c0;}})[_0xdbed('0x46')](function(_0x9e6e7f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9e6e7f);throw _0x9e6e7f;});}return _0x3001c0;})[_0xdbed('0x23')](respondWithResult(_0x18a9af,null))[_0xdbed('0x46')](handleError(_0x18a9af,null));});_0x1ad14b[_0xdbed('0x75')]();}catch(_0x2ff757){_0x18a9af[_0xdbed('0x16')](0x1f4)[_0xdbed('0x2a')](_0x2ff757);}};exports['update']=function(_0x1c573b,_0x34a625,_0x4d9015){return db[_0xdbed('0x41')][_0xdbed('0x48')]({'where':{'id':_0x1c573b['params']['id']}})[_0xdbed('0x23')](handleEntityNotFound(_0x34a625,null))[_0xdbed('0x23')](saveUpdates(_['pick'](_0x1c573b[_0xdbed('0x6f')],['name',_0xdbed('0x76')]),null))[_0xdbed('0x23')](respondWithResult(_0x34a625,null))[_0xdbed('0x46')](handleError(_0x34a625,null));};exports[_0xdbed('0x77')]=function(_0x8dc3d1,_0x27ee08,_0x3907f4){return db[_0xdbed('0x41')]['find']({'where':{'id':_0x8dc3d1[_0xdbed('0x4a')]['id']}})[_0xdbed('0x23')](function(_0x549cff){if(_0x549cff){return _0x549cff['destroy']();}})[_0xdbed('0x23')](function(_0x34d831){var _0x9c487f=path[_0xdbed('0x51')](config['root'],_0xdbed('0x5b'),util[_0xdbed('0x53')]('%s.%s',_0x34d831[_0xdbed('0x4b')],_0x34d831[_0xdbed('0x78')]));var _0x553bd2=path[_0xdbed('0x51')](config[_0xdbed('0x4c')],'server/files/sounds/converted',util[_0xdbed('0x53')](_0xdbed('0x52'),_0x34d831[_0xdbed('0x4b')],_0x34d831['converted_format']));fs[_0xdbed('0x60')](_0x9c487f);fs[_0xdbed('0x60')](_0x553bd2);return _0x34d831;})[_0xdbed('0x23')](function(_0x20f4fe){if(_0x20f4fe){return _0x27ee08[_0xdbed('0x16')](0xcc)[_0xdbed('0x17')]();}})[_0xdbed('0x23')](handleEntityNotFound(_0x27ee08,null))[_0xdbed('0x46')](handleError(_0x27ee08,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 6790c2a..7009434 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 _0x0709=['../../config/logger','api','bluebird','request-promise','rimraf','exports','tools_sounds','lodash','util'];(function(_0x18e1a6,_0x24c191){var _0x6f7db6=function(_0x45f6a1){while(--_0x45f6a1){_0x18e1a6['push'](_0x18e1a6['shift']());}};_0x6f7db6(++_0x24c191);}(_0x0709,0xe8));var _0x9070=function(_0x15a8fa,_0x4652b2){_0x15a8fa=_0x15a8fa-0x0;var _0x1355c2=_0x0709[_0x15a8fa];return _0x1355c2;};'use strict';var _=require(_0x9070('0x0'));var util=require(_0x9070('0x1'));var logger=require(_0x9070('0x2'))(_0x9070('0x3'));var moment=require('moment');var BPromise=require(_0x9070('0x4'));var rp=require(_0x9070('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9070('0x6'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module[_0x9070('0x7')]=function(_0x871f21,_0x41bb67){return _0x871f21['define']('Sound',attributes,{'tableName':_0x9070('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d7c=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./sound.attributes','exports','define','lodash'];(function(_0x51ac8e,_0x20fc49){var _0x4760b2=function(_0x5eae0f){while(--_0x5eae0f){_0x51ac8e['push'](_0x51ac8e['shift']());}};_0x4760b2(++_0x20fc49);}(_0x0d7c,0x1cd));var _0xc0d7=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0x0d7c[_0x5ef55a];return _0x20ae40;};'use strict';var _=require(_0xc0d7('0x0'));var util=require(_0xc0d7('0x1'));var logger=require(_0xc0d7('0x2'))(_0xc0d7('0x3'));var moment=require(_0xc0d7('0x4'));var BPromise=require('bluebird');var rp=require(_0xc0d7('0x5'));var fs=require('fs');var path=require(_0xc0d7('0x6'));var rimraf=require('rimraf');var config=require(_0xc0d7('0x7'));var attributes=require(_0xc0d7('0x8'));module[_0xc0d7('0x9')]=function(_0x2c2bbf,_0xc40b40){return _0x2c2bbf[_0xc0d7('0xa')]('Sound',attributes,{'tableName':'tools_sounds','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 6d8f297..a7e30ec 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 _0x92ba=['include','model','ShowSound','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','info','result','catch','Sound','find','options','raw','attributes'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x92ba,0x177));var _0xa92b=function(_0x307ce3,_0x3c6439){_0x307ce3=_0x307ce3-0x0;var _0x5729d8=_0x92ba[_0x307ce3];return _0x5729d8;};'use strict';var _=require(_0xa92b('0x0'));var util=require(_0xa92b('0x1'));var moment=require(_0xa92b('0x2'));var BPromise=require(_0xa92b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa92b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa92b('0x5'));var logger=require(_0xa92b('0x6'))(_0xa92b('0x7'));var config=require(_0xa92b('0x8'));var jayson=require(_0xa92b('0x9'));var client=jayson['client'][_0xa92b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44a828,_0x1dfbb7,_0xbe1365){return new BPromise(function(_0x295bea,_0x53ee5a){return client['request'](_0x44a828,_0xbe1365)[_0xa92b('0xb')](function(_0xea4f56){logger['info']('Sound,\x20%s,\x20%s',_0x1dfbb7,_0xa92b('0xc'));logger[_0xa92b('0xd')](_0xa92b('0xe'),_0x1dfbb7,'request\x20sent',JSON[_0xa92b('0xf')](_0xea4f56));if(_0xea4f56[_0xa92b('0x10')]){if(_0xea4f56[_0xa92b('0x10')][_0xa92b('0x11')]===0x1f4){logger[_0xa92b('0x10')](_0xa92b('0x12'),_0x1dfbb7,_0xea4f56[_0xa92b('0x10')][_0xa92b('0x13')]);return _0x53ee5a(_0xea4f56['error']['message']);}logger[_0xa92b('0x10')](_0xa92b('0x12'),_0x1dfbb7,_0xea4f56[_0xa92b('0x10')][_0xa92b('0x13')]);return _0x295bea(_0xea4f56[_0xa92b('0x10')]['message']);}else{logger[_0xa92b('0x14')](_0xa92b('0x12'),_0x1dfbb7,_0xa92b('0xc'));_0x295bea(_0xea4f56[_0xa92b('0x15')]['message']);}})[_0xa92b('0x16')](function(_0x4ce925){logger['error'](_0xa92b('0x12'),_0x1dfbb7,_0x4ce925);_0x53ee5a(_0x4ce925);});});}exports['ShowSound']=function(_0x40e484){var _0xaa34ee=this;return new Promise(function(_0x2c97e8,_0xd22722){return db[_0xa92b('0x17')][_0xa92b('0x18')]({'raw':_0x40e484[_0xa92b('0x19')]?_0x40e484[_0xa92b('0x19')][_0xa92b('0x1a')]===undefined?!![]:![]:!![],'where':_0x40e484[_0xa92b('0x19')]?_0x40e484[_0xa92b('0x19')]['where']||null:null,'attributes':_0x40e484[_0xa92b('0x19')]?_0x40e484[_0xa92b('0x19')][_0xa92b('0x1b')]||null:null,'include':_0x40e484[_0xa92b('0x19')]?_0x40e484[_0xa92b('0x19')][_0xa92b('0x1c')]?_['map'](_0x40e484[_0xa92b('0x19')]['include'],function(_0x38d1e3){return{'model':db[_0x38d1e3[_0xa92b('0x1d')]],'as':_0x38d1e3['as'],'attributes':_0x38d1e3['attributes'],'include':_0x38d1e3[_0xa92b('0x1c')]?_['map'](_0x38d1e3['include'],function(_0x714aa3){return{'model':db[_0x714aa3[_0xa92b('0x1d')]],'as':_0x714aa3['as'],'attributes':_0x714aa3[_0xa92b('0x1b')],'include':_0x714aa3[_0xa92b('0x1c')]?_['map'](_0x714aa3[_0xa92b('0x1c')],function(_0x30723d){return{'model':db[_0x30723d['model']],'as':_0x30723d['as'],'attributes':_0x30723d[_0xa92b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa92b('0xb')](function(_0x5e8adf){logger[_0xa92b('0x14')](_0xa92b('0x1e'),_0x40e484);logger[_0xa92b('0xd')]('ShowSound',_0x40e484,JSON['stringify'](_0x5e8adf));_0x2c97e8(_0x5e8adf);})[_0xa92b('0x16')](function(_0x4d47b3){logger['error'](_0xa92b('0x1e'),_0x4d47b3[_0xa92b('0x13')],_0x40e484);_0xd22722(_0xaa34ee[_0xa92b('0x10')](0x1f4,_0x4d47b3[_0xa92b('0x13')]));});});}; \ No newline at end of file +var _0xfeda=['options','raw','attributes','include','map','model','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','find'];(function(_0x365b25,_0x1c4114){var _0x5e90d7=function(_0x4cd31){while(--_0x4cd31){_0x365b25['push'](_0x365b25['shift']());}};_0x5e90d7(++_0x1c4114);}(_0xfeda,0x132));var _0xafed=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xfeda[_0x433a86];return _0x23000c;};'use strict';var _=require(_0xafed('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafed('0x1'));var db=require(_0xafed('0x2'))['db'];var utils=require(_0xafed('0x3'));var logger=require(_0xafed('0x4'))(_0xafed('0x5'));var config=require(_0xafed('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xafed('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x6cb279,_0xc2916f,_0x39e7ba){return new BPromise(function(_0x44f4f9,_0x1e6fba){return client[_0xafed('0x8')](_0x6cb279,_0x39e7ba)[_0xafed('0x9')](function(_0x294cdb){logger[_0xafed('0xa')]('Sound,\x20%s,\x20%s',_0xc2916f,_0xafed('0xb'));logger[_0xafed('0xc')](_0xafed('0xd'),_0xc2916f,_0xafed('0xb'),JSON[_0xafed('0xe')](_0x294cdb));if(_0x294cdb[_0xafed('0xf')]){if(_0x294cdb[_0xafed('0xf')][_0xafed('0x10')]===0x1f4){logger[_0xafed('0xf')](_0xafed('0x11'),_0xc2916f,_0x294cdb[_0xafed('0xf')][_0xafed('0x12')]);return _0x1e6fba(_0x294cdb['error']['message']);}logger[_0xafed('0xf')]('Sound,\x20%s,\x20%s',_0xc2916f,_0x294cdb['error']['message']);return _0x44f4f9(_0x294cdb[_0xafed('0xf')][_0xafed('0x12')]);}else{logger[_0xafed('0xa')](_0xafed('0x11'),_0xc2916f,_0xafed('0xb'));_0x44f4f9(_0x294cdb[_0xafed('0x13')][_0xafed('0x12')]);}})[_0xafed('0x14')](function(_0x148954){logger[_0xafed('0xf')]('Sound,\x20%s,\x20%s',_0xc2916f,_0x148954);_0x1e6fba(_0x148954);});});}exports[_0xafed('0x15')]=function(_0x43d34c){var _0x256a68=this;return new Promise(function(_0x33d3a4,_0x5eda67){return db[_0xafed('0x16')][_0xafed('0x17')]({'raw':_0x43d34c[_0xafed('0x18')]?_0x43d34c['options'][_0xafed('0x19')]===undefined?!![]:![]:!![],'where':_0x43d34c[_0xafed('0x18')]?_0x43d34c[_0xafed('0x18')]['where']||null:null,'attributes':_0x43d34c[_0xafed('0x18')]?_0x43d34c[_0xafed('0x18')][_0xafed('0x1a')]||null:null,'include':_0x43d34c['options']?_0x43d34c[_0xafed('0x18')][_0xafed('0x1b')]?_[_0xafed('0x1c')](_0x43d34c['options'][_0xafed('0x1b')],function(_0x3bd4a1){return{'model':db[_0x3bd4a1['model']],'as':_0x3bd4a1['as'],'attributes':_0x3bd4a1['attributes'],'include':_0x3bd4a1[_0xafed('0x1b')]?_[_0xafed('0x1c')](_0x3bd4a1[_0xafed('0x1b')],function(_0x40aaea){return{'model':db[_0x40aaea[_0xafed('0x1d')]],'as':_0x40aaea['as'],'attributes':_0x40aaea[_0xafed('0x1a')],'include':_0x40aaea[_0xafed('0x1b')]?_[_0xafed('0x1c')](_0x40aaea['include'],function(_0x3b11fc){return{'model':db[_0x3b11fc[_0xafed('0x1d')]],'as':_0x3b11fc['as'],'attributes':_0x3b11fc['attributes']};}):[]};}):[]};}):[]:[]})[_0xafed('0x9')](function(_0x1fea8f){logger[_0xafed('0xa')](_0xafed('0x15'),_0x43d34c);logger[_0xafed('0xc')](_0xafed('0x15'),_0x43d34c,JSON[_0xafed('0xe')](_0x1fea8f));_0x33d3a4(_0x1fea8f);})[_0xafed('0x14')](function(_0x5fb4e8){logger[_0xafed('0xf')](_0xafed('0x15'),_0x5fb4e8[_0xafed('0x12')],_0x43d34c);_0x5eda67(_0x256a68[_0xafed('0xf')](0x1f4,_0x5fb4e8[_0xafed('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 0ae674f..319cbd7 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 _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x41fed8,_0x168adf){var _0x5d6c66=function(_0x2d3fce){while(--_0x2d3fce){_0x41fed8['push'](_0x41fed8['shift']());}};_0x5d6c66(++_0x168adf);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1e399a,_0x351c59){_0x1e399a=_0x1e399a-0x0;var _0x539897=_0x0b0e[_0x1e399a];return _0x539897;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +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(_0x2b39b6,_0x4befb0){var _0x933510=function(_0x2dc0e7){while(--_0x2dc0e7){_0x2b39b6['push'](_0x2b39b6['shift']());}};_0x933510(++_0x4befb0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'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 diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index d585bf5..ee2baa4 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 _0x1c73=['out','STRING','TEXT','medium','ENUM'];(function(_0x53e42f,_0x4bf244){var _0x8e1c36=function(_0x4c4456){while(--_0x4c4456){_0x53e42f['push'](_0x53e42f['shift']());}};_0x8e1c36(++_0x4bf244);}(_0x1c73,0xc5));var _0x31c7=function(_0x588bf2,_0xe6fb8){_0x588bf2=_0x588bf2-0x0;var _0x571db3=_0x1c73[_0x588bf2];return _0x571db3;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x31c7('0x0')](_0x31c7('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0x31c7('0x2')]('in','out'),'defaultValue':_0x31c7('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x31c7('0x4')]},'providerResponse':{'type':Sequelize[_0x31c7('0x0')]}}; \ No newline at end of file +var _0x55c0=['ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0xa539ce,_0x20577d){var _0x2179cc=function(_0x3cd7ff){while(--_0x3cd7ff){_0xa539ce['push'](_0xa539ce['shift']());}};_0x2179cc(++_0x20577d);}(_0x55c0,0x1ca));var _0x055c=function(_0x10afad,_0x30da9d){_0x10afad=_0x10afad-0x0;var _0x588d7e=_0x55c0[_0x10afad];return _0x588d7e;};'use strict';var Sequelize=require(_0x055c('0x0'));module[_0x055c('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x055c('0x2')](_0x055c('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x055c('0x4')]('in',_0x055c('0x5')),'defaultValue':_0x055c('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x055c('0x6')]},'providerResponse':{'type':Sequelize[_0x055c('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index ff87596..d9babc8 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 _0xb7e2=['limit','set','apply','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','count','includeAll','SquareMessage','catch','intersection','include','find','create','body','params','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','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'];(function(_0x4a73f2,_0x352409){var _0x4190ee=function(_0x19603c){while(--_0x19603c){_0x4a73f2['push'](_0x4a73f2['shift']());}};_0x4190ee(++_0x352409);}(_0xb7e2,0x103));var _0x2b7e=function(_0x2b87cf,_0x370f36){_0x2b87cf=_0x2b87cf-0x0;var _0x1c4821=_0xb7e2[_0x2b87cf];return _0x1c4821;};'use strict';var emlformat=require(_0x2b7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b7e('0x2'));var moment=require('moment');var BPromise=require(_0x2b7e('0x3'));var Mustache=require('mustache');var util=require(_0x2b7e('0x4'));var path=require(_0x2b7e('0x5'));var sox=require(_0x2b7e('0x6'));var csv=require(_0x2b7e('0x7'));var ejs=require(_0x2b7e('0x8'));var fs=require('fs');var fs_extra=require(_0x2b7e('0x9'));var _=require('lodash');var squel=require(_0x2b7e('0xa'));var crypto=require(_0x2b7e('0xb'));var jsforce=require(_0x2b7e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2b7e('0x7'));var querystring=require(_0x2b7e('0xd'));var Papa=require(_0x2b7e('0xe'));var Redis=require(_0x2b7e('0xf'));var authService=require(_0x2b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b7e('0x11'));var logger=require(_0x2b7e('0x12'))(_0x2b7e('0x13'));var utils=require(_0x2b7e('0x14'));var config=require(_0x2b7e('0x15'));var licenseUtil=require(_0x2b7e('0x16'));var db=require(_0x2b7e('0x17'))['db'];function respondWithStatusCode(_0x50b47f,_0x1ad9c7){_0x1ad9c7=_0x1ad9c7||0xcc;return function(_0x241b9c){if(_0x241b9c){return _0x50b47f[_0x2b7e('0x18')](_0x1ad9c7);}return _0x50b47f[_0x2b7e('0x19')](_0x1ad9c7)['end']();};}function respondWithResult(_0x4813b4,_0x4aaa1a){_0x4aaa1a=_0x4aaa1a||0xc8;return function(_0x824b79){if(_0x824b79){return _0x4813b4['status'](_0x4aaa1a)[_0x2b7e('0x1a')](_0x824b79);}};}function respondWithFilteredResult(_0x49a2f0,_0x1f5682){return function(_0x4b84b2){if(_0x4b84b2){var _0x181aec=typeof _0x1f5682[_0x2b7e('0x1b')]===_0x2b7e('0x1c')&&typeof _0x1f5682['limit']===_0x2b7e('0x1c');var _0x27a30a=_0x4b84b2['count'];var _0x16d389=_0x181aec?0x0:_0x1f5682[_0x2b7e('0x1b')];var _0x726509=_0x181aec?_0x4b84b2['count']:_0x1f5682[_0x2b7e('0x1b')]+_0x1f5682[_0x2b7e('0x1d')];var _0x627ca1;if(_0x726509>=_0x27a30a){_0x726509=_0x27a30a;_0x627ca1=0xc8;}else{_0x627ca1=0xce;}_0x49a2f0[_0x2b7e('0x19')](_0x627ca1);return _0x49a2f0[_0x2b7e('0x1e')]('Content-Range',_0x16d389+'-'+_0x726509+'/'+_0x27a30a)[_0x2b7e('0x1a')](_0x4b84b2);}return null;};}function patchUpdates(_0x4922b3){return function(_0x522810){try{jsonpatch[_0x2b7e('0x1f')](_0x522810,_0x4922b3,!![]);}catch(_0x5dae66){return BPromise[_0x2b7e('0x20')](_0x5dae66);}return _0x522810[_0x2b7e('0x21')]();};}function saveUpdates(_0x5773c4,_0x416aba){return function(_0x5988eb){if(_0x5988eb){return _0x5988eb[_0x2b7e('0x22')](_0x5773c4)[_0x2b7e('0x23')](function(_0x51f854){return _0x51f854;});}return null;};}function removeEntity(_0x4a7e79,_0x3548e3){return function(_0x151e97){if(_0x151e97){return _0x151e97[_0x2b7e('0x24')]()[_0x2b7e('0x23')](function(){_0x4a7e79[_0x2b7e('0x19')](0xcc)[_0x2b7e('0x25')]();});}};}function handleEntityNotFound(_0x41b68b,_0x11b76b){return function(_0x43e0bd){if(!_0x43e0bd){_0x41b68b[_0x2b7e('0x18')](0x194);}return _0x43e0bd;};}function handleError(_0x111892,_0x1d88e8){_0x1d88e8=_0x1d88e8||0x1f4;return function(_0x19824e){logger[_0x2b7e('0x26')](_0x19824e['stack']);if(_0x19824e[_0x2b7e('0x27')]){delete _0x19824e[_0x2b7e('0x27')];}_0x111892[_0x2b7e('0x19')](_0x1d88e8)[_0x2b7e('0x28')](_0x19824e);};}exports[_0x2b7e('0x29')]=function(_0x5d568b,_0x2e4f7f){var _0x11cfd8={},_0x5871ac={},_0x190438={'count':0x0,'rows':[]};var _0x5e3315=_[_0x2b7e('0x2a')](db['SquareMessage'][_0x2b7e('0x2b')],function(_0x23b9cf){return{'name':_0x23b9cf[_0x2b7e('0x2c')],'type':_0x23b9cf[_0x2b7e('0x2d')]['key']};});_0x5871ac[_0x2b7e('0x2e')]=_[_0x2b7e('0x2a')](_0x5e3315,_0x2b7e('0x27'));_0x5871ac[_0x2b7e('0x2f')]=_[_0x2b7e('0x30')](_0x5d568b[_0x2b7e('0x2f')]);_0x5871ac[_0x2b7e('0x31')]=_['intersection'](_0x5871ac[_0x2b7e('0x2e')],_0x5871ac[_0x2b7e('0x2f')]);_0x11cfd8[_0x2b7e('0x32')]=_['intersection'](_0x5871ac['model'],qs[_0x2b7e('0x33')](_0x5d568b[_0x2b7e('0x2f')][_0x2b7e('0x33')]));_0x11cfd8[_0x2b7e('0x32')]=_0x11cfd8[_0x2b7e('0x32')][_0x2b7e('0x34')]?_0x11cfd8[_0x2b7e('0x32')]:_0x5871ac['model'];if(!_0x5d568b[_0x2b7e('0x2f')][_0x2b7e('0x35')](_0x2b7e('0x36'))){_0x11cfd8[_0x2b7e('0x1d')]=qs[_0x2b7e('0x1d')](_0x5d568b['query'][_0x2b7e('0x1d')]);_0x11cfd8['offset']=qs['offset'](_0x5d568b[_0x2b7e('0x2f')]['offset']);}_0x11cfd8[_0x2b7e('0x37')]=qs['sort'](_0x5d568b[_0x2b7e('0x2f')]['sort']);_0x11cfd8[_0x2b7e('0x38')]=qs[_0x2b7e('0x31')](_[_0x2b7e('0x39')](_0x5d568b['query'],_0x5871ac[_0x2b7e('0x31')]),_0x5e3315);if(_0x5d568b[_0x2b7e('0x2f')][_0x2b7e('0x3a')]){_0x11cfd8['where']=_['merge'](_0x11cfd8['where'],{'$or':_[_0x2b7e('0x2a')](_0x5e3315,function(_0x4e3d0f){if(_0x4e3d0f[_0x2b7e('0x2d')]!==_0x2b7e('0x3b')){var _0x160a89={};_0x160a89[_0x4e3d0f['name']]={'$like':'%'+_0x5d568b[_0x2b7e('0x2f')][_0x2b7e('0x3a')]+'%'};return _0x160a89;}})});}_0x11cfd8=_[_0x2b7e('0x3c')]({},_0x11cfd8,_0x5d568b[_0x2b7e('0x3d')]);var _0x95a821={'where':_0x11cfd8['where']};return db['SquareMessage'][_0x2b7e('0x3e')](_0x95a821)['then'](function(_0x52d4ea){_0x190438[_0x2b7e('0x3e')]=_0x52d4ea;if(_0x5d568b['query'][_0x2b7e('0x3f')]){_0x11cfd8['include']=[{'all':!![]}];}return db[_0x2b7e('0x40')]['findAll'](_0x11cfd8);})[_0x2b7e('0x23')](function(_0x49af95){_0x190438['rows']=_0x49af95;return _0x190438;})[_0x2b7e('0x23')](respondWithFilteredResult(_0x2e4f7f,_0x11cfd8))[_0x2b7e('0x41')](handleError(_0x2e4f7f,null));};exports['show']=function(_0xea0e5b,_0x4efe72){var _0x2758ce={'raw':!![],'where':{'id':_0xea0e5b['params']['id']}},_0x383d7f={};_0x383d7f[_0x2b7e('0x2e')]=_[_0x2b7e('0x30')](db['SquareMessage'][_0x2b7e('0x2b')]);_0x383d7f[_0x2b7e('0x2f')]=_['keys'](_0xea0e5b[_0x2b7e('0x2f')]);_0x383d7f[_0x2b7e('0x31')]=_[_0x2b7e('0x42')](_0x383d7f[_0x2b7e('0x2e')],_0x383d7f[_0x2b7e('0x2f')]);_0x2758ce[_0x2b7e('0x32')]=_['intersection'](_0x383d7f[_0x2b7e('0x2e')],qs[_0x2b7e('0x33')](_0xea0e5b[_0x2b7e('0x2f')][_0x2b7e('0x33')]));_0x2758ce['attributes']=_0x2758ce[_0x2b7e('0x32')][_0x2b7e('0x34')]?_0x2758ce[_0x2b7e('0x32')]:_0x383d7f['model'];if(_0xea0e5b[_0x2b7e('0x2f')]['includeAll']){_0x2758ce[_0x2b7e('0x43')]=[{'all':!![]}];}_0x2758ce=_[_0x2b7e('0x3c')]({},_0x2758ce,_0xea0e5b[_0x2b7e('0x3d')]);return db[_0x2b7e('0x40')][_0x2b7e('0x44')](_0x2758ce)[_0x2b7e('0x23')](handleEntityNotFound(_0x4efe72,null))[_0x2b7e('0x23')](respondWithResult(_0x4efe72,null))[_0x2b7e('0x41')](handleError(_0x4efe72,null));};exports['create']=function(_0x520eec,_0x5e475f){return db[_0x2b7e('0x40')][_0x2b7e('0x45')](_0x520eec[_0x2b7e('0x46')],{})[_0x2b7e('0x23')](respondWithResult(_0x5e475f,0xc9))[_0x2b7e('0x41')](handleError(_0x5e475f,null));};exports[_0x2b7e('0x22')]=function(_0x710432,_0x1933a8){if(_0x710432[_0x2b7e('0x46')]['id']){delete _0x710432[_0x2b7e('0x46')]['id'];}return db[_0x2b7e('0x40')][_0x2b7e('0x44')]({'where':{'id':_0x710432[_0x2b7e('0x47')]['id']}})[_0x2b7e('0x23')](handleEntityNotFound(_0x1933a8,null))['then'](saveUpdates(_0x710432['body'],null))[_0x2b7e('0x23')](respondWithResult(_0x1933a8,null))[_0x2b7e('0x41')](handleError(_0x1933a8,null));};exports[_0x2b7e('0x24')]=function(_0xe57a25,_0x4d2ad1){return db[_0x2b7e('0x40')][_0x2b7e('0x44')]({'where':{'id':_0xe57a25['params']['id']}})[_0x2b7e('0x23')](handleEntityNotFound(_0x4d2ad1,null))[_0x2b7e('0x23')](removeEntity(_0x4d2ad1,null))[_0x2b7e('0x41')](handleError(_0x4d2ad1,null));}; \ No newline at end of file +var _0x7795=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','error','stack','name','map','SquareMessage','fieldName','key','model','query','keys','intersection','attributes'];(function(_0x3c91a6,_0x417372){var _0x5dcd69=function(_0x70d237){while(--_0x70d237){_0x3c91a6['push'](_0x3c91a6['shift']());}};_0x5dcd69(++_0x417372);}(_0x7795,0x149));var _0x5779=function(_0x57fa1d,_0x1e2dba){_0x57fa1d=_0x57fa1d-0x0;var _0x40ac5e=_0x7795[_0x57fa1d];return _0x40ac5e;};'use strict';var emlformat=require(_0x5779('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5779('0x1'));var jsonpatch=require(_0x5779('0x2'));var rp=require(_0x5779('0x3'));var moment=require(_0x5779('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5779('0x5'));var util=require('util');var path=require(_0x5779('0x6'));var sox=require(_0x5779('0x7'));var csv=require(_0x5779('0x8'));var ejs=require(_0x5779('0x9'));var fs=require('fs');var fs_extra=require(_0x5779('0xa'));var _=require(_0x5779('0xb'));var squel=require(_0x5779('0xc'));var crypto=require(_0x5779('0xd'));var jsforce=require(_0x5779('0xe'));var deskjs=require(_0x5779('0xf'));var toCsv=require(_0x5779('0x8'));var querystring=require('querystring');var Papa=require(_0x5779('0x10'));var Redis=require('ioredis');var authService=require(_0x5779('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5779('0x12'));var hardwareService=require(_0x5779('0x13'));var logger=require(_0x5779('0x14'))(_0x5779('0x15'));var utils=require(_0x5779('0x16'));var config=require(_0x5779('0x17'));var licenseUtil=require(_0x5779('0x18'));var db=require(_0x5779('0x19'))['db'];function respondWithStatusCode(_0x3ef0d8,_0x15cbbe){_0x15cbbe=_0x15cbbe||0xcc;return function(_0x2bc79e){if(_0x2bc79e){return _0x3ef0d8['sendStatus'](_0x15cbbe);}return _0x3ef0d8[_0x5779('0x1a')](_0x15cbbe)[_0x5779('0x1b')]();};}function respondWithResult(_0x4e8c98,_0x2f1c30){_0x2f1c30=_0x2f1c30||0xc8;return function(_0x74e4b4){if(_0x74e4b4){return _0x4e8c98[_0x5779('0x1a')](_0x2f1c30)[_0x5779('0x1c')](_0x74e4b4);}};}function respondWithFilteredResult(_0x44dde8,_0x6c4f84){return function(_0x6dd3e6){if(_0x6dd3e6){var _0x2047a9=typeof _0x6c4f84[_0x5779('0x1d')]===_0x5779('0x1e')&&typeof _0x6c4f84['limit']===_0x5779('0x1e');var _0x2ad958=_0x6dd3e6['count'];var _0x10aca7=_0x2047a9?0x0:_0x6c4f84[_0x5779('0x1d')];var _0x150e16=_0x2047a9?_0x6dd3e6['count']:_0x6c4f84['offset']+_0x6c4f84[_0x5779('0x1f')];var _0x3e290a;if(_0x150e16>=_0x2ad958){_0x150e16=_0x2ad958;_0x3e290a=0xc8;}else{_0x3e290a=0xce;}_0x44dde8[_0x5779('0x1a')](_0x3e290a);return _0x44dde8[_0x5779('0x20')]('Content-Range',_0x10aca7+'-'+_0x150e16+'/'+_0x2ad958)[_0x5779('0x1c')](_0x6dd3e6);}return null;};}function patchUpdates(_0x4fe5c4){return function(_0x5c2618){try{jsonpatch[_0x5779('0x21')](_0x5c2618,_0x4fe5c4,!![]);}catch(_0x2388eb){return BPromise[_0x5779('0x22')](_0x2388eb);}return _0x5c2618[_0x5779('0x23')]();};}function saveUpdates(_0x54f4c7,_0x34def9){return function(_0x49ad2c){if(_0x49ad2c){return _0x49ad2c[_0x5779('0x24')](_0x54f4c7)[_0x5779('0x25')](function(_0x4afaaf){return _0x4afaaf;});}return null;};}function removeEntity(_0x5530fe,_0x2cffcb){return function(_0x274080){if(_0x274080){return _0x274080[_0x5779('0x26')]()[_0x5779('0x25')](function(){_0x5530fe[_0x5779('0x1a')](0xcc)[_0x5779('0x1b')]();});}};}function handleEntityNotFound(_0x519e5c,_0x5e32ce){return function(_0x413e95){if(!_0x413e95){_0x519e5c['sendStatus'](0x194);}return _0x413e95;};}function handleError(_0x25626c,_0x57e912){_0x57e912=_0x57e912||0x1f4;return function(_0xad783e){logger[_0x5779('0x27')](_0xad783e[_0x5779('0x28')]);if(_0xad783e['name']){delete _0xad783e[_0x5779('0x29')];}_0x25626c['status'](_0x57e912)['send'](_0xad783e);};}exports['index']=function(_0x467fcb,_0x338554){var _0x4fd914={},_0x247563={},_0x2f16b4={'count':0x0,'rows':[]};var _0x5a2381=_[_0x5779('0x2a')](db[_0x5779('0x2b')]['rawAttributes'],function(_0x2063c6){return{'name':_0x2063c6[_0x5779('0x2c')],'type':_0x2063c6['type'][_0x5779('0x2d')]};});_0x247563[_0x5779('0x2e')]=_['map'](_0x5a2381,_0x5779('0x29'));_0x247563[_0x5779('0x2f')]=_[_0x5779('0x30')](_0x467fcb[_0x5779('0x2f')]);_0x247563['filters']=_[_0x5779('0x31')](_0x247563[_0x5779('0x2e')],_0x247563[_0x5779('0x2f')]);_0x4fd914[_0x5779('0x32')]=_['intersection'](_0x247563[_0x5779('0x2e')],qs[_0x5779('0x33')](_0x467fcb['query']['fields']));_0x4fd914[_0x5779('0x32')]=_0x4fd914[_0x5779('0x32')][_0x5779('0x34')]?_0x4fd914[_0x5779('0x32')]:_0x247563['model'];if(!_0x467fcb[_0x5779('0x2f')][_0x5779('0x35')](_0x5779('0x36'))){_0x4fd914[_0x5779('0x1f')]=qs[_0x5779('0x1f')](_0x467fcb[_0x5779('0x2f')]['limit']);_0x4fd914[_0x5779('0x1d')]=qs[_0x5779('0x1d')](_0x467fcb[_0x5779('0x2f')][_0x5779('0x1d')]);}_0x4fd914[_0x5779('0x37')]=qs[_0x5779('0x38')](_0x467fcb['query']['sort']);_0x4fd914[_0x5779('0x39')]=qs[_0x5779('0x3a')](_[_0x5779('0x3b')](_0x467fcb['query'],_0x247563[_0x5779('0x3a')]),_0x5a2381);if(_0x467fcb[_0x5779('0x2f')][_0x5779('0x3c')]){_0x4fd914[_0x5779('0x39')]=_[_0x5779('0x3d')](_0x4fd914[_0x5779('0x39')],{'$or':_['map'](_0x5a2381,function(_0x53adb2){if(_0x53adb2[_0x5779('0x3e')]!==_0x5779('0x3f')){var _0x4be6a3={};_0x4be6a3[_0x53adb2[_0x5779('0x29')]]={'$like':'%'+_0x467fcb[_0x5779('0x2f')][_0x5779('0x3c')]+'%'};return _0x4be6a3;}})});}_0x4fd914=_[_0x5779('0x3d')]({},_0x4fd914,_0x467fcb[_0x5779('0x40')]);var _0x51bb9d={'where':_0x4fd914[_0x5779('0x39')]};return db[_0x5779('0x2b')][_0x5779('0x41')](_0x51bb9d)[_0x5779('0x25')](function(_0x4c8e5c){_0x2f16b4[_0x5779('0x41')]=_0x4c8e5c;if(_0x467fcb['query'][_0x5779('0x42')]){_0x4fd914[_0x5779('0x43')]=[{'all':!![]}];}return db[_0x5779('0x2b')][_0x5779('0x44')](_0x4fd914);})[_0x5779('0x25')](function(_0x3ff971){_0x2f16b4[_0x5779('0x45')]=_0x3ff971;return _0x2f16b4;})['then'](respondWithFilteredResult(_0x338554,_0x4fd914))[_0x5779('0x46')](handleError(_0x338554,null));};exports['show']=function(_0xf12337,_0x371654){var _0x4f8adc={'raw':!![],'where':{'id':_0xf12337['params']['id']}},_0x44b5bb={};_0x44b5bb['model']=_[_0x5779('0x30')](db[_0x5779('0x2b')][_0x5779('0x47')]);_0x44b5bb[_0x5779('0x2f')]=_[_0x5779('0x30')](_0xf12337['query']);_0x44b5bb[_0x5779('0x3a')]=_[_0x5779('0x31')](_0x44b5bb[_0x5779('0x2e')],_0x44b5bb[_0x5779('0x2f')]);_0x4f8adc[_0x5779('0x32')]=_[_0x5779('0x31')](_0x44b5bb['model'],qs[_0x5779('0x33')](_0xf12337[_0x5779('0x2f')]['fields']));_0x4f8adc[_0x5779('0x32')]=_0x4f8adc[_0x5779('0x32')][_0x5779('0x34')]?_0x4f8adc[_0x5779('0x32')]:_0x44b5bb[_0x5779('0x2e')];if(_0xf12337[_0x5779('0x2f')][_0x5779('0x42')]){_0x4f8adc['include']=[{'all':!![]}];}_0x4f8adc=_[_0x5779('0x3d')]({},_0x4f8adc,_0xf12337[_0x5779('0x40')]);return db[_0x5779('0x2b')][_0x5779('0x48')](_0x4f8adc)[_0x5779('0x25')](handleEntityNotFound(_0x371654,null))['then'](respondWithResult(_0x371654,null))[_0x5779('0x46')](handleError(_0x371654,null));};exports[_0x5779('0x49')]=function(_0x4ac5cd,_0x3ab1d0){return db[_0x5779('0x2b')][_0x5779('0x49')](_0x4ac5cd['body'],{})[_0x5779('0x25')](respondWithResult(_0x3ab1d0,0xc9))[_0x5779('0x46')](handleError(_0x3ab1d0,null));};exports[_0x5779('0x24')]=function(_0x52dcd0,_0x2ca5a5){if(_0x52dcd0[_0x5779('0x4a')]['id']){delete _0x52dcd0[_0x5779('0x4a')]['id'];}return db[_0x5779('0x2b')][_0x5779('0x48')]({'where':{'id':_0x52dcd0[_0x5779('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2ca5a5,null))[_0x5779('0x25')](saveUpdates(_0x52dcd0[_0x5779('0x4a')],null))[_0x5779('0x25')](respondWithResult(_0x2ca5a5,null))['catch'](handleError(_0x2ca5a5,null));};exports['destroy']=function(_0x4ef7a9,_0x46f1e2){return db[_0x5779('0x2b')][_0x5779('0x48')]({'where':{'id':_0x4ef7a9[_0x5779('0x4b')]['id']}})['then'](handleEntityNotFound(_0x46f1e2,null))[_0x5779('0x25')](removeEntity(_0x46f1e2,null))[_0x5779('0x46')](handleError(_0x46f1e2,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 9fa041c..73bb5d3 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 _0x22da=['moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x22da,0x19c));var _0xa22d=function(_0x2253eb,_0x393954){_0x2253eb=_0x2253eb-0x0;var _0x3d473d=_0x22da[_0x2253eb];return _0x3d473d;};'use strict';var _=require(_0xa22d('0x0'));var util=require(_0xa22d('0x1'));var logger=require(_0xa22d('0x2'))(_0xa22d('0x3'));var moment=require(_0xa22d('0x4'));var BPromise=require(_0xa22d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa22d('0x6'));var rimraf=require(_0xa22d('0x7'));var config=require(_0xa22d('0x8'));var attributes=require('./squareMessage.attributes');module[_0xa22d('0x9')]=function(_0x34fe26,_0x396255){return _0x34fe26[_0xa22d('0xa')](_0xa22d('0xb'),attributes,{'tableName':_0xa22d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb17=['path','rimraf','../../config/environment','exports','square_messages','lodash','util','../../config/logger','request-promise'];(function(_0x247601,_0x104a76){var _0x1f13e6=function(_0x4d1def){while(--_0x4d1def){_0x247601['push'](_0x247601['shift']());}};_0x1f13e6(++_0x104a76);}(_0xfb17,0x16d));var _0x7fb1=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xfb17[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x7fb1('0x0'));var util=require(_0x7fb1('0x1'));var logger=require(_0x7fb1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7fb1('0x3'));var fs=require('fs');var path=require(_0x7fb1('0x4'));var rimraf=require(_0x7fb1('0x5'));var config=require(_0x7fb1('0x6'));var attributes=require('./squareMessage.attributes');module[_0x7fb1('0x7')]=function(_0x2170de,_0xca9216){return _0x2170de['define']('SquareMessage',attributes,{'tableName':_0x7fb1('0x8'),'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 2f59826..ffd1e2c 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 _0xf485=['../../config/utils','rpc','../../config/environment','jayson/promise','client','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','then','lodash','util','bluebird','randomstring','ioredis'];(function(_0x11ce01,_0xaace00){var _0x976fd7=function(_0x360e24){while(--_0x360e24){_0x11ce01['push'](_0x11ce01['shift']());}};_0x976fd7(++_0xaace00);}(_0xf485,0x167));var _0x5f48=function(_0x1adfac,_0x310e06){_0x1adfac=_0x1adfac-0x0;var _0x4b4bdf=_0xf485[_0x1adfac];return _0x4b4bdf;};'use strict';var _=require(_0x5f48('0x0'));var util=require(_0x5f48('0x1'));var moment=require('moment');var BPromise=require(_0x5f48('0x2'));var rs=require(_0x5f48('0x3'));var fs=require('fs');var Redis=require(_0x5f48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f48('0x5'));var logger=require('../../config/logger')(_0x5f48('0x6'));var config=require(_0x5f48('0x7'));var jayson=require(_0x5f48('0x8'));var client=jayson[_0x5f48('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35b58b,_0x463fc6,_0x596502){return new BPromise(function(_0x1df089,_0x4af6e2){return client['request'](_0x35b58b,_0x596502)['then'](function(_0x1ea655){logger[_0x5f48('0xa')](_0x5f48('0xb'),_0x463fc6,_0x5f48('0xc'));logger['debug'](_0x5f48('0xd'),_0x463fc6,_0x5f48('0xc'),JSON[_0x5f48('0xe')](_0x1ea655));if(_0x1ea655['error']){if(_0x1ea655[_0x5f48('0xf')][_0x5f48('0x10')]===0x1f4){logger[_0x5f48('0xf')](_0x5f48('0xb'),_0x463fc6,_0x1ea655['error'][_0x5f48('0x11')]);return _0x4af6e2(_0x1ea655[_0x5f48('0xf')]['message']);}logger[_0x5f48('0xf')](_0x5f48('0xb'),_0x463fc6,_0x1ea655[_0x5f48('0xf')]['message']);return _0x1df089(_0x1ea655['error'][_0x5f48('0x11')]);}else{logger[_0x5f48('0xa')]('SquareMessage,\x20%s,\x20%s',_0x463fc6,_0x5f48('0xc'));_0x1df089(_0x1ea655[_0x5f48('0x12')][_0x5f48('0x11')]);}})[_0x5f48('0x13')](function(_0x36d0e7){logger['error']('SquareMessage,\x20%s,\x20%s',_0x463fc6,_0x36d0e7);_0x4af6e2(_0x36d0e7);});});}exports[_0x5f48('0x14')]=function(_0x43042c){var _0x334d3d=this;return new Promise(function(_0x2a3a73,_0x2565a5){return db[_0x5f48('0x15')][_0x5f48('0x16')](_0x43042c['body'],{'raw':_0x43042c[_0x5f48('0x17')]?_0x43042c[_0x5f48('0x17')][_0x5f48('0x18')]===undefined?!![]:![]:!![]})[_0x5f48('0x19')](function(_0x5c527d){logger[_0x5f48('0xa')](_0x5f48('0x14'),_0x43042c);logger['debug'](_0x5f48('0x14'),_0x43042c,JSON[_0x5f48('0xe')](_0x5c527d));_0x2a3a73(_0x5c527d);})[_0x5f48('0x13')](function(_0x243db9){logger['error'](_0x5f48('0x14'),_0x243db9['message'],_0x43042c);_0x2565a5(_0x334d3d[_0x5f48('0xf')](0x1f4,_0x243db9[_0x5f48('0x11')]));});});}; \ No newline at end of file +var _0xdf78=['message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3aeb95,_0xc996ce){var _0x26bfa8=function(_0x2b2b74){while(--_0x2b2b74){_0x3aeb95['push'](_0x3aeb95['shift']());}};_0x26bfa8(++_0xc996ce);}(_0xdf78,0xf2));var _0x8df7=function(_0x42bf2e,_0x271a59){_0x42bf2e=_0x42bf2e-0x0;var _0x2c1502=_0xdf78[_0x42bf2e];return _0x2c1502;};'use strict';var _=require(_0x8df7('0x0'));var util=require(_0x8df7('0x1'));var moment=require(_0x8df7('0x2'));var BPromise=require('bluebird');var rs=require(_0x8df7('0x3'));var fs=require('fs');var Redis=require(_0x8df7('0x4'));var db=require(_0x8df7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8df7('0x6'))(_0x8df7('0x7'));var config=require(_0x8df7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8df7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5afaca,_0x2bf790,_0x335a06){return new BPromise(function(_0x4efb9a,_0x2a2d32){return client[_0x8df7('0xa')](_0x5afaca,_0x335a06)[_0x8df7('0xb')](function(_0xf0c6f0){logger['info'](_0x8df7('0xc'),_0x2bf790,_0x8df7('0xd'));logger[_0x8df7('0xe')](_0x8df7('0xf'),_0x2bf790,_0x8df7('0xd'),JSON[_0x8df7('0x10')](_0xf0c6f0));if(_0xf0c6f0[_0x8df7('0x11')]){if(_0xf0c6f0['error'][_0x8df7('0x12')]===0x1f4){logger['error'](_0x8df7('0xc'),_0x2bf790,_0xf0c6f0['error']['message']);return _0x2a2d32(_0xf0c6f0[_0x8df7('0x11')][_0x8df7('0x13')]);}logger[_0x8df7('0x11')](_0x8df7('0xc'),_0x2bf790,_0xf0c6f0[_0x8df7('0x11')]['message']);return _0x4efb9a(_0xf0c6f0['error'][_0x8df7('0x13')]);}else{logger['info'](_0x8df7('0xc'),_0x2bf790,'request\x20sent');_0x4efb9a(_0xf0c6f0[_0x8df7('0x14')]['message']);}})[_0x8df7('0x15')](function(_0x43b188){logger['error'](_0x8df7('0xc'),_0x2bf790,_0x43b188);_0x2a2d32(_0x43b188);});});}exports[_0x8df7('0x16')]=function(_0x5cb174){var _0x3fb275=this;return new Promise(function(_0x14d4a7,_0x48d101){return db[_0x8df7('0x17')][_0x8df7('0x18')](_0x5cb174[_0x8df7('0x19')],{'raw':_0x5cb174[_0x8df7('0x1a')]?_0x5cb174[_0x8df7('0x1a')][_0x8df7('0x1b')]===undefined?!![]:![]:!![]})[_0x8df7('0xb')](function(_0x20d97f){logger[_0x8df7('0x1c')](_0x8df7('0x16'),_0x5cb174);logger[_0x8df7('0xe')](_0x8df7('0x16'),_0x5cb174,JSON[_0x8df7('0x10')](_0x20d97f));_0x14d4a7(_0x20d97f);})['catch'](function(_0x4a7955){logger[_0x8df7('0x11')](_0x8df7('0x16'),_0x4a7955['message'],_0x5cb174);_0x48d101(_0x3fb275[_0x8df7('0x11')](0x1f4,_0x4a7955[_0x8df7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 51e2f83..45213d6 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 _0x8747=['/:id/test','15s','test','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5d0800,_0x4ee1fb){var _0x2f66ca=function(_0x29419a){while(--_0x29419a){_0x5d0800['push'](_0x5d0800['shift']());}};_0x2f66ca(++_0x4ee1fb);}(_0x8747,0xd8));var _0x7874=function(_0x4513df,_0x389801){_0x4513df=_0x4513df-0x0;var _0x1c8eae=_0x8747[_0x4513df];return _0x1c8eae;};'use strict';var multer=require('multer');var util=require(_0x7874('0x0'));var path=require(_0x7874('0x1'));var timeout=require(_0x7874('0x2'));var express=require(_0x7874('0x3'));var router=express[_0x7874('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7874('0x5'));var interaction=require(_0x7874('0x6'));var config=require(_0x7874('0x7'));var controller=require(_0x7874('0x8'));router[_0x7874('0x9')]('/',auth[_0x7874('0xa')](),controller[_0x7874('0xb')]);router['get'](_0x7874('0xc'),auth['isAuthenticated'](),controller[_0x7874('0xd')]);router['get'](_0x7874('0xe'),auth[_0x7874('0xa')](),timeout(_0x7874('0xf')),controller[_0x7874('0x10')]);router[_0x7874('0x11')]('/',auth[_0x7874('0xa')](),controller[_0x7874('0x12')]);router[_0x7874('0x13')](_0x7874('0xc'),auth[_0x7874('0xa')](),controller[_0x7874('0x14')]);router['delete'](_0x7874('0xc'),auth[_0x7874('0xa')](),controller[_0x7874('0x15')]);module[_0x7874('0x16')]=router; \ No newline at end of file +var _0x8a7f=['/:id','show','/:id/test','15s','test','post','create','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index'];(function(_0x3e106b,_0x10c343){var _0x1563ec=function(_0x4f9af9){while(--_0x4f9af9){_0x3e106b['push'](_0x3e106b['shift']());}};_0x1563ec(++_0x10c343);}(_0x8a7f,0xba));var _0xf8a7=function(_0x5807b4,_0x35391d){_0x5807b4=_0x5807b4-0x0;var _0x192dc8=_0x8a7f[_0x5807b4];return _0x192dc8;};'use strict';var multer=require('multer');var util=require(_0xf8a7('0x0'));var path=require(_0xf8a7('0x1'));var timeout=require(_0xf8a7('0x2'));var express=require(_0xf8a7('0x3'));var router=express[_0xf8a7('0x4')]();var fs_extra=require(_0xf8a7('0x5'));var auth=require(_0xf8a7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf8a7('0x7'));var controller=require(_0xf8a7('0x8'));router[_0xf8a7('0x9')]('/',auth[_0xf8a7('0xa')](),controller[_0xf8a7('0xb')]);router[_0xf8a7('0x9')](_0xf8a7('0xc'),auth[_0xf8a7('0xa')](),controller[_0xf8a7('0xd')]);router['get'](_0xf8a7('0xe'),auth[_0xf8a7('0xa')](),timeout(_0xf8a7('0xf')),controller[_0xf8a7('0x10')]);router[_0xf8a7('0x11')]('/',auth[_0xf8a7('0xa')](),controller[_0xf8a7('0x12')]);router[_0xf8a7('0x13')]('/:id',auth[_0xf8a7('0xa')](),controller[_0xf8a7('0x14')]);router['delete'](_0xf8a7('0xc'),auth[_0xf8a7('0xa')](),controller['destroy']);module[_0xf8a7('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 8a0edf6..77df1fa 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 _0x3db8=['exports','STRING'];(function(_0x4fa01f,_0x12b7bc){var _0x26136a=function(_0x4d3388){while(--_0x4d3388){_0x4fa01f['push'](_0x4fa01f['shift']());}};_0x26136a(++_0x12b7bc);}(_0x3db8,0x116));var _0x83db=function(_0xd19ee,_0x3124d9){_0xd19ee=_0xd19ee-0x0;var _0x1e20a3=_0x3db8[_0xd19ee];return _0x1e20a3;};'use strict';var Sequelize=require('sequelize');module[_0x83db('0x0')]={'name':{'type':Sequelize[_0x83db('0x1')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x83db('0x1')]}}; \ No newline at end of file +var _0xa285=['STRING','sequelize','name'];(function(_0x5a20c5,_0x30943e){var _0x45642e=function(_0x1aeb83){while(--_0x1aeb83){_0x5a20c5['push'](_0x5a20c5['shift']());}};_0x45642e(++_0x30943e);}(_0xa285,0x109));var _0x5a28=function(_0x217d29,_0x3c6a8f){_0x217d29=_0x217d29-0x0;var _0x191659=_0xa285[_0x217d29];return _0x191659;};'use strict';var Sequelize=require(_0x5a28('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5a28('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5a28('0x2')]},'description':{'type':Sequelize[_0x5a28('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index c41ae8d..354b248 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 _0xaf53=['attributes','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','test','dsn','odbc','openSync','closeSync','eml-format','fast-json-patch','bluebird','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x575a34,_0x45e5df){var _0x262258=function(_0x548152){while(--_0x548152){_0x575a34['push'](_0x575a34['shift']());}};_0x262258(++_0x45e5df);}(_0xaf53,0x15e));var _0x3af5=function(_0x348b81,_0x275d5e){_0x348b81=_0x348b81-0x0;var _0x5e050f=_0xaf53[_0x348b81];return _0x5e050f;};'use strict';var emlformat=require(_0x3af5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3af5('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3af5('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3af5('0x3'));var sox=require(_0x3af5('0x4'));var csv=require(_0x3af5('0x5'));var ejs=require(_0x3af5('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3af5('0x7'));var crypto=require(_0x3af5('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x3af5('0x9'));var toCsv=require(_0x3af5('0x5'));var querystring=require('querystring');var Papa=require(_0x3af5('0xa'));var Redis=require(_0x3af5('0xb'));var authService=require(_0x3af5('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x3af5('0xd'));var hardwareService=require(_0x3af5('0xe'));var logger=require('../../config/logger')(_0x3af5('0xf'));var utils=require('../../config/utils');var config=require(_0x3af5('0x10'));var licenseUtil=require(_0x3af5('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45f5ba,_0x360a1c){_0x360a1c=_0x360a1c||0xcc;return function(_0x3c58d8){if(_0x3c58d8){return _0x45f5ba[_0x3af5('0x12')](_0x360a1c);}return _0x45f5ba[_0x3af5('0x13')](_0x360a1c)[_0x3af5('0x14')]();};}function respondWithResult(_0x5e1414,_0x4cedb9){_0x4cedb9=_0x4cedb9||0xc8;return function(_0x4ab516){if(_0x4ab516){return _0x5e1414['status'](_0x4cedb9)[_0x3af5('0x15')](_0x4ab516);}};}function respondWithFilteredResult(_0x55dca6,_0x93ccc4){return function(_0x39465d){if(_0x39465d){var _0x53c8a7=typeof _0x93ccc4['offset']===_0x3af5('0x16')&&typeof _0x93ccc4[_0x3af5('0x17')]===_0x3af5('0x16');var _0x5a9d25=_0x39465d[_0x3af5('0x18')];var _0x257295=_0x53c8a7?0x0:_0x93ccc4[_0x3af5('0x19')];var _0x22f98a=_0x53c8a7?_0x39465d['count']:_0x93ccc4[_0x3af5('0x19')]+_0x93ccc4[_0x3af5('0x17')];var _0x5e3549;if(_0x22f98a>=_0x5a9d25){_0x22f98a=_0x5a9d25;_0x5e3549=0xc8;}else{_0x5e3549=0xce;}_0x55dca6[_0x3af5('0x13')](_0x5e3549);return _0x55dca6[_0x3af5('0x1a')]('Content-Range',_0x257295+'-'+_0x22f98a+'/'+_0x5a9d25)['json'](_0x39465d);}return null;};}function patchUpdates(_0x4267f2){return function(_0xb05903){try{jsonpatch['apply'](_0xb05903,_0x4267f2,!![]);}catch(_0x29f4a1){return BPromise[_0x3af5('0x1b')](_0x29f4a1);}return _0xb05903[_0x3af5('0x1c')]();};}function saveUpdates(_0x3b9283,_0x589b01){return function(_0x4a6df9){if(_0x4a6df9){return _0x4a6df9[_0x3af5('0x1d')](_0x3b9283)[_0x3af5('0x1e')](function(_0x553ac6){return _0x553ac6;});}return null;};}function removeEntity(_0x23222b,_0xd35055){return function(_0x1ce3ef){if(_0x1ce3ef){return _0x1ce3ef[_0x3af5('0x1f')]()[_0x3af5('0x1e')](function(){var _0x53a9f0=_0x1ce3ef[_0x3af5('0x20')]({'plain':!![]});var _0x3d0901=_0x3af5('0x21');return db[_0x3af5('0x22')][_0x3af5('0x1f')]({'where':{'type':_0x3d0901,'resourceId':_0x53a9f0['id']}})['then'](function(){return _0x1ce3ef;});})[_0x3af5('0x1e')](function(){_0x23222b['status'](0xcc)[_0x3af5('0x14')]();});}};}function handleEntityNotFound(_0x56a0ed,_0x1ce3e9){return function(_0x38c781){if(!_0x38c781){_0x56a0ed[_0x3af5('0x12')](0x194);}return _0x38c781;};}function handleError(_0x56f855,_0x444282){_0x444282=_0x444282||0x1f4;return function(_0x3c70e2){logger[_0x3af5('0x23')](_0x3c70e2['stack']);if(_0x3c70e2[_0x3af5('0x24')]){delete _0x3c70e2[_0x3af5('0x24')];}_0x56f855[_0x3af5('0x13')](_0x444282)['send'](_0x3c70e2);};}exports[_0x3af5('0x25')]=function(_0x268ae6,_0x38d55e){var _0x3c33ee={},_0x20656f={},_0xd637ba={'count':0x0,'rows':[]};var _0x588fd0=_[_0x3af5('0x26')](db[_0x3af5('0x27')][_0x3af5('0x28')],function(_0x46c137){return{'name':_0x46c137[_0x3af5('0x29')],'type':_0x46c137[_0x3af5('0x2a')][_0x3af5('0x2b')]};});_0x20656f[_0x3af5('0x2c')]=_[_0x3af5('0x26')](_0x588fd0,'name');_0x20656f[_0x3af5('0x2d')]=_[_0x3af5('0x2e')](_0x268ae6[_0x3af5('0x2d')]);_0x20656f[_0x3af5('0x2f')]=_[_0x3af5('0x30')](_0x20656f[_0x3af5('0x2c')],_0x20656f[_0x3af5('0x2d')]);_0x3c33ee['attributes']=_['intersection'](_0x20656f[_0x3af5('0x2c')],qs[_0x3af5('0x31')](_0x268ae6[_0x3af5('0x2d')][_0x3af5('0x31')]));_0x3c33ee[_0x3af5('0x32')]=_0x3c33ee[_0x3af5('0x32')]['length']?_0x3c33ee[_0x3af5('0x32')]:_0x20656f[_0x3af5('0x2c')];if(!_0x268ae6[_0x3af5('0x2d')][_0x3af5('0x33')](_0x3af5('0x34'))){_0x3c33ee[_0x3af5('0x17')]=qs[_0x3af5('0x17')](_0x268ae6[_0x3af5('0x2d')][_0x3af5('0x17')]);_0x3c33ee['offset']=qs[_0x3af5('0x19')](_0x268ae6[_0x3af5('0x2d')]['offset']);}_0x3c33ee[_0x3af5('0x35')]=qs['sort'](_0x268ae6[_0x3af5('0x2d')]['sort']);_0x3c33ee['where']=qs[_0x3af5('0x2f')](_[_0x3af5('0x36')](_0x268ae6[_0x3af5('0x2d')],_0x20656f[_0x3af5('0x2f')]),_0x588fd0);if(_0x268ae6[_0x3af5('0x2d')][_0x3af5('0x37')]){_0x3c33ee[_0x3af5('0x38')]=_['merge'](_0x3c33ee[_0x3af5('0x38')],{'$or':_[_0x3af5('0x26')](_0x588fd0,function(_0x97d49e){if(_0x97d49e[_0x3af5('0x2a')]!==_0x3af5('0x39')){var _0x2da37e={};_0x2da37e[_0x97d49e[_0x3af5('0x24')]]={'$like':'%'+_0x268ae6['query'][_0x3af5('0x37')]+'%'};return _0x2da37e;}})});}_0x3c33ee=_[_0x3af5('0x3a')]({},_0x3c33ee,_0x268ae6[_0x3af5('0x3b')]);var _0x4b437a={'where':_0x3c33ee[_0x3af5('0x38')]};return db[_0x3af5('0x27')][_0x3af5('0x18')](_0x4b437a)[_0x3af5('0x1e')](function(_0x2ffaca){_0xd637ba[_0x3af5('0x18')]=_0x2ffaca;if(_0x268ae6[_0x3af5('0x2d')][_0x3af5('0x3c')]){_0x3c33ee[_0x3af5('0x3d')]=[{'all':!![]}];}return db['SquareOdbc'][_0x3af5('0x3e')](_0x3c33ee);})[_0x3af5('0x1e')](function(_0x577b25){_0xd637ba[_0x3af5('0x3f')]=_0x577b25;return _0xd637ba;})[_0x3af5('0x1e')](respondWithFilteredResult(_0x38d55e,_0x3c33ee))[_0x3af5('0x40')](handleError(_0x38d55e,null));};exports[_0x3af5('0x41')]=function(_0x2e7c41,_0x58961b){var _0x338876={'raw':!![],'where':{'id':_0x2e7c41[_0x3af5('0x42')]['id']}},_0x292b69={};_0x292b69[_0x3af5('0x2c')]=_['keys'](db[_0x3af5('0x27')][_0x3af5('0x28')]);_0x292b69[_0x3af5('0x2d')]=_[_0x3af5('0x2e')](_0x2e7c41[_0x3af5('0x2d')]);_0x292b69['filters']=_[_0x3af5('0x30')](_0x292b69[_0x3af5('0x2c')],_0x292b69[_0x3af5('0x2d')]);_0x338876[_0x3af5('0x32')]=_['intersection'](_0x292b69['model'],qs['fields'](_0x2e7c41[_0x3af5('0x2d')][_0x3af5('0x31')]));_0x338876[_0x3af5('0x32')]=_0x338876[_0x3af5('0x32')][_0x3af5('0x43')]?_0x338876[_0x3af5('0x32')]:_0x292b69[_0x3af5('0x2c')];if(_0x2e7c41[_0x3af5('0x2d')][_0x3af5('0x3c')]){_0x338876[_0x3af5('0x3d')]=[{'all':!![]}];}_0x338876=_[_0x3af5('0x3a')]({},_0x338876,_0x2e7c41['options']);return db[_0x3af5('0x27')][_0x3af5('0x44')](_0x338876)['then'](handleEntityNotFound(_0x58961b,null))['then'](respondWithResult(_0x58961b,null))[_0x3af5('0x40')](handleError(_0x58961b,null));};exports[_0x3af5('0x45')]=function(_0x3b5e2e,_0x2352fa){return db['SquareOdbc'][_0x3af5('0x45')](_0x3b5e2e[_0x3af5('0x46')],{})[_0x3af5('0x1e')](function(_0x3916bc){var _0x597ad5=_0x3b5e2e['user'][_0x3af5('0x20')]({'plain':!![]});if(!_0x597ad5)throw new Error(_0x3af5('0x47'));if(_0x597ad5['role']===_0x3af5('0x48')){var _0x332701=_0x3916bc[_0x3af5('0x20')]({'plain':!![]});var _0x135eca=_0x3af5('0x21');return db[_0x3af5('0x49')][_0x3af5('0x44')]({'where':{'name':_0x135eca,'userProfileId':_0x597ad5['userProfileId']},'raw':!![]})[_0x3af5('0x1e')](function(_0xce8b66){if(_0xce8b66&&_0xce8b66[_0x3af5('0x4a')]===0x0){return db[_0x3af5('0x22')]['create']({'name':_0x332701['name'],'resourceId':_0x332701['id'],'type':_0xce8b66['name'],'sectionId':_0xce8b66['id']},{})['then'](function(){return _0x3916bc;});}else{return _0x3916bc;}})[_0x3af5('0x40')](function(_0xf628eb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf628eb);throw _0xf628eb;});}return _0x3916bc;})['then'](respondWithResult(_0x2352fa,0xc9))['catch'](handleError(_0x2352fa,null));};exports[_0x3af5('0x1d')]=function(_0xbbc387,_0x666545){if(_0xbbc387['body']['id']){delete _0xbbc387[_0x3af5('0x46')]['id'];}return db[_0x3af5('0x27')][_0x3af5('0x44')]({'where':{'id':_0xbbc387['params']['id']}})[_0x3af5('0x1e')](handleEntityNotFound(_0x666545,null))['then'](saveUpdates(_0xbbc387[_0x3af5('0x46')],null))[_0x3af5('0x1e')](respondWithResult(_0x666545,null))[_0x3af5('0x40')](handleError(_0x666545,null));};exports[_0x3af5('0x1f')]=function(_0xd85fed,_0x5292fb){return db[_0x3af5('0x27')]['find']({'where':{'id':_0xd85fed[_0x3af5('0x42')]['id']}})[_0x3af5('0x1e')](handleEntityNotFound(_0x5292fb,null))[_0x3af5('0x1e')](removeEntity(_0x5292fb,null))[_0x3af5('0x40')](handleError(_0x5292fb,null));};exports[_0x3af5('0x4b')]=function(_0x110cdc,_0x39cc8a,_0x29596d){var _0x1c3e22;return db[_0x3af5('0x27')]['find']({'where':{'id':_0x110cdc[_0x3af5('0x42')]['id']},'attributes':['id',_0x3af5('0x4c')]})['then'](handleEntityNotFound(_0x39cc8a,null))['then'](function(_0x1cb97b){if(_0x1cb97b){var _0x59e0d4=require(_0x3af5('0x4d'))();_0x59e0d4[_0x3af5('0x4e')](_0x1cb97b[_0x3af5('0x4c')]);_0x59e0d4[_0x3af5('0x4f')]();return _0x1cb97b;}})[_0x3af5('0x1e')](respondWithResult(_0x39cc8a,null))[_0x3af5('0x40')](handleError(_0x39cc8a,null));}; \ No newline at end of file +var _0x7d00=['count','set','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','include','findAll','catch','show','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','odbc','dsn','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x4c0f3b,_0x3b85e0){var _0x208cb5=function(_0x5c8a14){while(--_0x5c8a14){_0x4c0f3b['push'](_0x4c0f3b['shift']());}};_0x208cb5(++_0x3b85e0);}(_0x7d00,0x1d0));var _0x07d0=function(_0x51cc9d,_0x1e60a2){_0x51cc9d=_0x51cc9d-0x0;var _0x33dc69=_0x7d00[_0x51cc9d];return _0x33dc69;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07d0('0x0'));var zipdir=require(_0x07d0('0x1'));var jsonpatch=require(_0x07d0('0x2'));var rp=require(_0x07d0('0x3'));var moment=require(_0x07d0('0x4'));var BPromise=require(_0x07d0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x07d0('0x6'));var sox=require(_0x07d0('0x7'));var csv=require(_0x07d0('0x8'));var ejs=require(_0x07d0('0x9'));var fs=require('fs');var fs_extra=require(_0x07d0('0xa'));var _=require(_0x07d0('0xb'));var squel=require(_0x07d0('0xc'));var crypto=require('crypto');var jsforce=require(_0x07d0('0xd'));var deskjs=require(_0x07d0('0xe'));var toCsv=require(_0x07d0('0x8'));var querystring=require(_0x07d0('0xf'));var Papa=require(_0x07d0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x07d0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x07d0('0x12'))(_0x07d0('0x13'));var utils=require('../../config/utils');var config=require(_0x07d0('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd6c1e8,_0x2f332e){_0x2f332e=_0x2f332e||0xcc;return function(_0x4f6e45){if(_0x4f6e45){return _0xd6c1e8[_0x07d0('0x15')](_0x2f332e);}return _0xd6c1e8[_0x07d0('0x16')](_0x2f332e)[_0x07d0('0x17')]();};}function respondWithResult(_0x5d418e,_0x30c787){_0x30c787=_0x30c787||0xc8;return function(_0x199055){if(_0x199055){return _0x5d418e[_0x07d0('0x16')](_0x30c787)[_0x07d0('0x18')](_0x199055);}};}function respondWithFilteredResult(_0x18fb29,_0xdf84cc){return function(_0x21b0d2){if(_0x21b0d2){var _0x57b6d7=typeof _0xdf84cc[_0x07d0('0x19')]===_0x07d0('0x1a')&&typeof _0xdf84cc[_0x07d0('0x1b')]==='undefined';var _0x5ec791=_0x21b0d2[_0x07d0('0x1c')];var _0x1a33b3=_0x57b6d7?0x0:_0xdf84cc[_0x07d0('0x19')];var _0xd9f57a=_0x57b6d7?_0x21b0d2[_0x07d0('0x1c')]:_0xdf84cc[_0x07d0('0x19')]+_0xdf84cc[_0x07d0('0x1b')];var _0x182075;if(_0xd9f57a>=_0x5ec791){_0xd9f57a=_0x5ec791;_0x182075=0xc8;}else{_0x182075=0xce;}_0x18fb29[_0x07d0('0x16')](_0x182075);return _0x18fb29[_0x07d0('0x1d')]('Content-Range',_0x1a33b3+'-'+_0xd9f57a+'/'+_0x5ec791)[_0x07d0('0x18')](_0x21b0d2);}return null;};}function patchUpdates(_0xfc0db8){return function(_0x2c190b){try{jsonpatch[_0x07d0('0x1e')](_0x2c190b,_0xfc0db8,!![]);}catch(_0x368998){return BPromise[_0x07d0('0x1f')](_0x368998);}return _0x2c190b[_0x07d0('0x20')]();};}function saveUpdates(_0xa55cf3,_0x2b4e2f){return function(_0x4c70c4){if(_0x4c70c4){return _0x4c70c4[_0x07d0('0x21')](_0xa55cf3)[_0x07d0('0x22')](function(_0x543ee9){return _0x543ee9;});}return null;};}function removeEntity(_0x4678b6,_0x7b78ed){return function(_0x534c6d){if(_0x534c6d){return _0x534c6d[_0x07d0('0x23')]()[_0x07d0('0x22')](function(){var _0x62d868=_0x534c6d[_0x07d0('0x24')]({'plain':!![]});var _0x110063=_0x07d0('0x25');return db[_0x07d0('0x26')][_0x07d0('0x23')]({'where':{'type':_0x110063,'resourceId':_0x62d868['id']}})[_0x07d0('0x22')](function(){return _0x534c6d;});})[_0x07d0('0x22')](function(){_0x4678b6[_0x07d0('0x16')](0xcc)[_0x07d0('0x17')]();});}};}function handleEntityNotFound(_0x32b6ec,_0x1c89e6){return function(_0x241dd6){if(!_0x241dd6){_0x32b6ec[_0x07d0('0x15')](0x194);}return _0x241dd6;};}function handleError(_0x2b16e1,_0x1490fc){_0x1490fc=_0x1490fc||0x1f4;return function(_0x1669a7){logger[_0x07d0('0x27')](_0x1669a7[_0x07d0('0x28')]);if(_0x1669a7[_0x07d0('0x29')]){delete _0x1669a7[_0x07d0('0x29')];}_0x2b16e1[_0x07d0('0x16')](_0x1490fc)['send'](_0x1669a7);};}exports[_0x07d0('0x2a')]=function(_0x310d20,_0x2ad9a2){var _0x1a3695={},_0x346d57={},_0x41a593={'count':0x0,'rows':[]};var _0x4b2351=_[_0x07d0('0x2b')](db[_0x07d0('0x2c')][_0x07d0('0x2d')],function(_0x12e8b9){return{'name':_0x12e8b9[_0x07d0('0x2e')],'type':_0x12e8b9[_0x07d0('0x2f')][_0x07d0('0x30')]};});_0x346d57[_0x07d0('0x31')]=_[_0x07d0('0x2b')](_0x4b2351,_0x07d0('0x29'));_0x346d57[_0x07d0('0x32')]=_[_0x07d0('0x33')](_0x310d20[_0x07d0('0x32')]);_0x346d57[_0x07d0('0x34')]=_['intersection'](_0x346d57[_0x07d0('0x31')],_0x346d57[_0x07d0('0x32')]);_0x1a3695[_0x07d0('0x35')]=_[_0x07d0('0x36')](_0x346d57['model'],qs[_0x07d0('0x37')](_0x310d20[_0x07d0('0x32')][_0x07d0('0x37')]));_0x1a3695[_0x07d0('0x35')]=_0x1a3695[_0x07d0('0x35')]['length']?_0x1a3695['attributes']:_0x346d57[_0x07d0('0x31')];if(!_0x310d20[_0x07d0('0x32')][_0x07d0('0x38')]('nolimit')){_0x1a3695[_0x07d0('0x1b')]=qs[_0x07d0('0x1b')](_0x310d20[_0x07d0('0x32')][_0x07d0('0x1b')]);_0x1a3695[_0x07d0('0x19')]=qs['offset'](_0x310d20[_0x07d0('0x32')][_0x07d0('0x19')]);}_0x1a3695['order']=qs[_0x07d0('0x39')](_0x310d20['query']['sort']);_0x1a3695[_0x07d0('0x3a')]=qs[_0x07d0('0x34')](_['pick'](_0x310d20[_0x07d0('0x32')],_0x346d57['filters']),_0x4b2351);if(_0x310d20['query']['filter']){_0x1a3695[_0x07d0('0x3a')]=_[_0x07d0('0x3b')](_0x1a3695[_0x07d0('0x3a')],{'$or':_[_0x07d0('0x2b')](_0x4b2351,function(_0x8b9a5f){if(_0x8b9a5f[_0x07d0('0x2f')]!==_0x07d0('0x3c')){var _0x4ee18c={};_0x4ee18c[_0x8b9a5f[_0x07d0('0x29')]]={'$like':'%'+_0x310d20[_0x07d0('0x32')][_0x07d0('0x3d')]+'%'};return _0x4ee18c;}})});}_0x1a3695=_['merge']({},_0x1a3695,_0x310d20[_0x07d0('0x3e')]);var _0x53f4d8={'where':_0x1a3695[_0x07d0('0x3a')]};return db[_0x07d0('0x2c')]['count'](_0x53f4d8)[_0x07d0('0x22')](function(_0x1348bd){_0x41a593[_0x07d0('0x1c')]=_0x1348bd;if(_0x310d20[_0x07d0('0x32')]['includeAll']){_0x1a3695[_0x07d0('0x3f')]=[{'all':!![]}];}return db[_0x07d0('0x2c')][_0x07d0('0x40')](_0x1a3695);})[_0x07d0('0x22')](function(_0xc36b19){_0x41a593['rows']=_0xc36b19;return _0x41a593;})[_0x07d0('0x22')](respondWithFilteredResult(_0x2ad9a2,_0x1a3695))[_0x07d0('0x41')](handleError(_0x2ad9a2,null));};exports[_0x07d0('0x42')]=function(_0x4f9dc5,_0x245f51){var _0x7f0a9b={'raw':!![],'where':{'id':_0x4f9dc5['params']['id']}},_0x5a3dc5={};_0x5a3dc5[_0x07d0('0x31')]=_['keys'](db[_0x07d0('0x2c')][_0x07d0('0x2d')]);_0x5a3dc5['query']=_['keys'](_0x4f9dc5[_0x07d0('0x32')]);_0x5a3dc5[_0x07d0('0x34')]=_[_0x07d0('0x36')](_0x5a3dc5[_0x07d0('0x31')],_0x5a3dc5[_0x07d0('0x32')]);_0x7f0a9b[_0x07d0('0x35')]=_[_0x07d0('0x36')](_0x5a3dc5[_0x07d0('0x31')],qs[_0x07d0('0x37')](_0x4f9dc5[_0x07d0('0x32')][_0x07d0('0x37')]));_0x7f0a9b['attributes']=_0x7f0a9b[_0x07d0('0x35')][_0x07d0('0x43')]?_0x7f0a9b['attributes']:_0x5a3dc5[_0x07d0('0x31')];if(_0x4f9dc5['query'][_0x07d0('0x44')]){_0x7f0a9b[_0x07d0('0x3f')]=[{'all':!![]}];}_0x7f0a9b=_['merge']({},_0x7f0a9b,_0x4f9dc5[_0x07d0('0x3e')]);return db['SquareOdbc'][_0x07d0('0x45')](_0x7f0a9b)['then'](handleEntityNotFound(_0x245f51,null))[_0x07d0('0x22')](respondWithResult(_0x245f51,null))[_0x07d0('0x41')](handleError(_0x245f51,null));};exports[_0x07d0('0x46')]=function(_0x1ed0f7,_0x13fed2){return db[_0x07d0('0x2c')][_0x07d0('0x46')](_0x1ed0f7[_0x07d0('0x47')],{})[_0x07d0('0x22')](function(_0x30b883){var _0x21700a=_0x1ed0f7[_0x07d0('0x48')]['get']({'plain':!![]});if(!_0x21700a)throw new Error(_0x07d0('0x49'));if(_0x21700a['role']===_0x07d0('0x48')){var _0xaa189d=_0x30b883[_0x07d0('0x24')]({'plain':!![]});var _0x29d181=_0x07d0('0x25');return db[_0x07d0('0x4a')][_0x07d0('0x45')]({'where':{'name':_0x29d181,'userProfileId':_0x21700a[_0x07d0('0x4b')]},'raw':!![]})[_0x07d0('0x22')](function(_0x49effc){if(_0x49effc&&_0x49effc[_0x07d0('0x4c')]===0x0){return db[_0x07d0('0x26')][_0x07d0('0x46')]({'name':_0xaa189d['name'],'resourceId':_0xaa189d['id'],'type':_0x49effc[_0x07d0('0x29')],'sectionId':_0x49effc['id']},{})[_0x07d0('0x22')](function(){return _0x30b883;});}else{return _0x30b883;}})[_0x07d0('0x41')](function(_0x29f0c9){logger['error'](_0x07d0('0x4d'),_0x29f0c9);throw _0x29f0c9;});}return _0x30b883;})[_0x07d0('0x22')](respondWithResult(_0x13fed2,0xc9))['catch'](handleError(_0x13fed2,null));};exports[_0x07d0('0x21')]=function(_0x2d8348,_0x540c75){if(_0x2d8348['body']['id']){delete _0x2d8348[_0x07d0('0x47')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x2d8348['params']['id']}})[_0x07d0('0x22')](handleEntityNotFound(_0x540c75,null))[_0x07d0('0x22')](saveUpdates(_0x2d8348[_0x07d0('0x47')],null))[_0x07d0('0x22')](respondWithResult(_0x540c75,null))['catch'](handleError(_0x540c75,null));};exports[_0x07d0('0x23')]=function(_0x207ff5,_0x4f0d79){return db[_0x07d0('0x2c')][_0x07d0('0x45')]({'where':{'id':_0x207ff5[_0x07d0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4f0d79,null))[_0x07d0('0x22')](removeEntity(_0x4f0d79,null))[_0x07d0('0x41')](handleError(_0x4f0d79,null));};exports['test']=function(_0x47e0e5,_0xae2c26,_0x4052b3){var _0xe00ce5;return db[_0x07d0('0x2c')]['find']({'where':{'id':_0x47e0e5[_0x07d0('0x4e')]['id']},'attributes':['id','dsn']})[_0x07d0('0x22')](handleEntityNotFound(_0xae2c26,null))[_0x07d0('0x22')](function(_0x223b25){if(_0x223b25){var _0x56e0e0=require(_0x07d0('0x4f'))();_0x56e0e0['openSync'](_0x223b25[_0x07d0('0x50')]);_0x56e0e0[_0x07d0('0x51')]();return _0x223b25;}})[_0x07d0('0x22')](respondWithResult(_0xae2c26,null))[_0x07d0('0x41')](handleError(_0xae2c26,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index d627b00..6024128 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 _0xaebe=['request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','api','moment','bluebird'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0xaebe,0x1f3));var _0xeaeb=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xaebe[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0xeaeb('0x0'));var util=require(_0xeaeb('0x1'));var logger=require('../../config/logger')(_0xeaeb('0x2'));var moment=require(_0xeaeb('0x3'));var BPromise=require(_0xeaeb('0x4'));var rp=require(_0xeaeb('0x5'));var fs=require('fs');var path=require(_0xeaeb('0x6'));var rimraf=require(_0xeaeb('0x7'));var config=require(_0xeaeb('0x8'));var attributes=require(_0xeaeb('0x9'));module[_0xeaeb('0xa')]=function(_0x4c002f,_0x372f64){return _0x4c002f[_0xeaeb('0xb')](_0xeaeb('0xc'),attributes,{'tableName':_0xeaeb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x644d=['bluebird','request-promise','rimraf','../../config/environment','exports','square_odbc','lodash','util','../../config/logger','api','moment'];(function(_0x2740b5,_0x3286a1){var _0x413f24=function(_0x353076){while(--_0x353076){_0x2740b5['push'](_0x2740b5['shift']());}};_0x413f24(++_0x3286a1);}(_0x644d,0xab));var _0xd644=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x644d[_0x5180c3];return _0x55c975;};'use strict';var _=require(_0xd644('0x0'));var util=require(_0xd644('0x1'));var logger=require(_0xd644('0x2'))(_0xd644('0x3'));var moment=require(_0xd644('0x4'));var BPromise=require(_0xd644('0x5'));var rp=require(_0xd644('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd644('0x7'));var config=require(_0xd644('0x8'));var attributes=require('./squareOdbc.attributes');module[_0xd644('0x9')]=function(_0x2735d2,_0x3720a2){return _0x2735d2['define']('SquareOdbc',attributes,{'tableName':_0xd644('0xa'),'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 11418a9..6a26b4a 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 _0xa0f9=['request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','map','model','attributes','include','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x25e109,_0x6ab24c){var _0xc0f7d6=function(_0x2fb92b){while(--_0x2fb92b){_0x25e109['push'](_0x25e109['shift']());}};_0xc0f7d6(++_0x6ab24c);}(_0xa0f9,0x1ad));var _0x9a0f=function(_0x23629f,_0x4b37fa){_0x23629f=_0x23629f-0x0;var _0x4d810a=_0xa0f9[_0x23629f];return _0x4d810a;};'use strict';var _=require(_0x9a0f('0x0'));var util=require(_0x9a0f('0x1'));var moment=require(_0x9a0f('0x2'));var BPromise=require(_0x9a0f('0x3'));var rs=require(_0x9a0f('0x4'));var fs=require('fs');var Redis=require(_0x9a0f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a0f('0x6'));var logger=require(_0x9a0f('0x7'))(_0x9a0f('0x8'));var config=require(_0x9a0f('0x9'));var jayson=require(_0x9a0f('0xa'));var client=jayson[_0x9a0f('0xb')][_0x9a0f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d0627,_0x2306ef,_0x2299ec){return new BPromise(function(_0x373ccd,_0x7648b8){return client[_0x9a0f('0xd')](_0x1d0627,_0x2299ec)[_0x9a0f('0xe')](function(_0x14d3fe){logger[_0x9a0f('0xf')](_0x9a0f('0x10'),_0x2306ef,_0x9a0f('0x11'));logger[_0x9a0f('0x12')](_0x9a0f('0x13'),_0x2306ef,'request\x20sent',JSON[_0x9a0f('0x14')](_0x14d3fe));if(_0x14d3fe[_0x9a0f('0x15')]){if(_0x14d3fe[_0x9a0f('0x15')][_0x9a0f('0x16')]===0x1f4){logger[_0x9a0f('0x15')](_0x9a0f('0x10'),_0x2306ef,_0x14d3fe['error'][_0x9a0f('0x17')]);return _0x7648b8(_0x14d3fe[_0x9a0f('0x15')][_0x9a0f('0x17')]);}logger[_0x9a0f('0x15')]('SquareOdbc,\x20%s,\x20%s',_0x2306ef,_0x14d3fe[_0x9a0f('0x15')][_0x9a0f('0x17')]);return _0x373ccd(_0x14d3fe[_0x9a0f('0x15')][_0x9a0f('0x17')]);}else{logger[_0x9a0f('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x2306ef,_0x9a0f('0x11'));_0x373ccd(_0x14d3fe['result'][_0x9a0f('0x17')]);}})[_0x9a0f('0x18')](function(_0x4d1ef3){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x2306ef,_0x4d1ef3);_0x7648b8(_0x4d1ef3);});});}exports[_0x9a0f('0x19')]=function(_0x41f07a){var _0x3bc2e8=this;return new Promise(function(_0x68d384,_0x58465d){return db[_0x9a0f('0x1a')]['find']({'raw':_0x41f07a['options']?_0x41f07a[_0x9a0f('0x1b')][_0x9a0f('0x1c')]===undefined?!![]:![]:!![],'where':_0x41f07a[_0x9a0f('0x1b')]?_0x41f07a[_0x9a0f('0x1b')][_0x9a0f('0x1d')]||null:null,'attributes':_0x41f07a[_0x9a0f('0x1b')]?_0x41f07a[_0x9a0f('0x1b')]['attributes']||null:null,'include':_0x41f07a[_0x9a0f('0x1b')]?_0x41f07a[_0x9a0f('0x1b')]['include']?_[_0x9a0f('0x1e')](_0x41f07a['options']['include'],function(_0x4b7166){return{'model':db[_0x4b7166[_0x9a0f('0x1f')]],'as':_0x4b7166['as'],'attributes':_0x4b7166[_0x9a0f('0x20')],'include':_0x4b7166[_0x9a0f('0x21')]?_['map'](_0x4b7166[_0x9a0f('0x21')],function(_0x204299){return{'model':db[_0x204299['model']],'as':_0x204299['as'],'attributes':_0x204299[_0x9a0f('0x20')],'include':_0x204299[_0x9a0f('0x21')]?_[_0x9a0f('0x1e')](_0x204299[_0x9a0f('0x21')],function(_0x115614){return{'model':db[_0x115614[_0x9a0f('0x1f')]],'as':_0x115614['as'],'attributes':_0x115614['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c8b48){logger[_0x9a0f('0xf')](_0x9a0f('0x19'),_0x41f07a);logger['debug'](_0x9a0f('0x19'),_0x41f07a,JSON[_0x9a0f('0x14')](_0x2c8b48));_0x68d384(_0x2c8b48);})[_0x9a0f('0x18')](function(_0x4d6614){logger[_0x9a0f('0x15')](_0x9a0f('0x19'),_0x4d6614[_0x9a0f('0x17')],_0x41f07a);_0x58465d(_0x3bc2e8[_0x9a0f('0x15')](0x1f4,_0x4d6614[_0x9a0f('0x17')]));});});}; \ No newline at end of file +var _0xe3b5=['SquareOdbc,\x20%s,\x20%s','message','ShowSquareOdbc','SquareOdbc','raw','options','where','attributes','map','model','include','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xe3b5,0x88));var _0x5e3b=function(_0x5aa06c,_0x16f595){_0x5aa06c=_0x5aa06c-0x0;var _0x319b42=_0xe3b5[_0x5aa06c];return _0x319b42;};'use strict';var _=require(_0x5e3b('0x0'));var util=require(_0x5e3b('0x1'));var moment=require(_0x5e3b('0x2'));var BPromise=require(_0x5e3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e3b('0x4'));var db=require(_0x5e3b('0x5'))['db'];var utils=require(_0x5e3b('0x6'));var logger=require(_0x5e3b('0x7'))('rpc');var config=require(_0x5e3b('0x8'));var jayson=require(_0x5e3b('0x9'));var client=jayson[_0x5e3b('0xa')][_0x5e3b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9f81,_0xfd1b8a,_0x28626a){return new BPromise(function(_0x8a5353,_0x2f14ba){return client[_0x5e3b('0xc')](_0x3f9f81,_0x28626a)[_0x5e3b('0xd')](function(_0x223d85){logger[_0x5e3b('0xe')]('SquareOdbc,\x20%s,\x20%s',_0xfd1b8a,_0x5e3b('0xf'));logger['debug'](_0x5e3b('0x10'),_0xfd1b8a,_0x5e3b('0xf'),JSON['stringify'](_0x223d85));if(_0x223d85[_0x5e3b('0x11')]){if(_0x223d85[_0x5e3b('0x11')][_0x5e3b('0x12')]===0x1f4){logger[_0x5e3b('0x11')](_0x5e3b('0x13'),_0xfd1b8a,_0x223d85[_0x5e3b('0x11')][_0x5e3b('0x14')]);return _0x2f14ba(_0x223d85['error'][_0x5e3b('0x14')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0xfd1b8a,_0x223d85[_0x5e3b('0x11')][_0x5e3b('0x14')]);return _0x8a5353(_0x223d85[_0x5e3b('0x11')][_0x5e3b('0x14')]);}else{logger[_0x5e3b('0xe')]('SquareOdbc,\x20%s,\x20%s',_0xfd1b8a,'request\x20sent');_0x8a5353(_0x223d85['result'][_0x5e3b('0x14')]);}})['catch'](function(_0x1078ee){logger[_0x5e3b('0x11')](_0x5e3b('0x13'),_0xfd1b8a,_0x1078ee);_0x2f14ba(_0x1078ee);});});}exports[_0x5e3b('0x15')]=function(_0x54715d){var _0x3df31f=this;return new Promise(function(_0x12d760,_0x2e7886){return db[_0x5e3b('0x16')]['find']({'raw':_0x54715d['options']?_0x54715d['options'][_0x5e3b('0x17')]===undefined?!![]:![]:!![],'where':_0x54715d[_0x5e3b('0x18')]?_0x54715d[_0x5e3b('0x18')][_0x5e3b('0x19')]||null:null,'attributes':_0x54715d[_0x5e3b('0x18')]?_0x54715d[_0x5e3b('0x18')][_0x5e3b('0x1a')]||null:null,'include':_0x54715d[_0x5e3b('0x18')]?_0x54715d['options']['include']?_[_0x5e3b('0x1b')](_0x54715d[_0x5e3b('0x18')]['include'],function(_0x4ab495){return{'model':db[_0x4ab495[_0x5e3b('0x1c')]],'as':_0x4ab495['as'],'attributes':_0x4ab495['attributes'],'include':_0x4ab495['include']?_[_0x5e3b('0x1b')](_0x4ab495[_0x5e3b('0x1d')],function(_0x441d1f){return{'model':db[_0x441d1f[_0x5e3b('0x1c')]],'as':_0x441d1f['as'],'attributes':_0x441d1f[_0x5e3b('0x1a')],'include':_0x441d1f[_0x5e3b('0x1d')]?_[_0x5e3b('0x1b')](_0x441d1f[_0x5e3b('0x1d')],function(_0x176916){return{'model':db[_0x176916[_0x5e3b('0x1c')]],'as':_0x176916['as'],'attributes':_0x176916['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e3b('0xd')](function(_0x32b98e){logger[_0x5e3b('0xe')]('ShowSquareOdbc',_0x54715d);logger['debug'](_0x5e3b('0x15'),_0x54715d,JSON[_0x5e3b('0x1e')](_0x32b98e));_0x12d760(_0x32b98e);})['catch'](function(_0x513ac9){logger[_0x5e3b('0x11')](_0x5e3b('0x15'),_0x513ac9['message'],_0x54715d);_0x2e7886(_0x3df31f[_0x5e3b('0x11')](0x1f4,_0x513ac9[_0x5e3b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index c0e90d8..b031325 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 _0x1fbe=['get','/:id','show','post','put','update','delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','isAuthenticated','index'];(function(_0x4137d4,_0x44cba4){var _0x5a27ee=function(_0x299bf5){while(--_0x299bf5){_0x4137d4['push'](_0x4137d4['shift']());}};_0x5a27ee(++_0x44cba4);}(_0x1fbe,0x16c));var _0xe1fb=function(_0x1719e4,_0x4278fe){_0x1719e4=_0x1719e4-0x0;var _0x236bac=_0x1fbe[_0x1719e4];return _0x236bac;};'use strict';var multer=require(_0xe1fb('0x0'));var util=require('util');var path=require(_0xe1fb('0x1'));var timeout=require(_0xe1fb('0x2'));var express=require(_0xe1fb('0x3'));var router=express['Router']();var fs_extra=require(_0xe1fb('0x4'));var auth=require(_0xe1fb('0x5'));var interaction=require(_0xe1fb('0x6'));var config=require('../../config/environment');var controller=require(_0xe1fb('0x7'));router['get']('/',auth[_0xe1fb('0x8')](),controller[_0xe1fb('0x9')]);router[_0xe1fb('0xa')](_0xe1fb('0xb'),auth[_0xe1fb('0x8')](),controller[_0xe1fb('0xc')]);router[_0xe1fb('0xd')]('/',auth[_0xe1fb('0x8')](),controller['create']);router[_0xe1fb('0xe')](_0xe1fb('0xb'),auth[_0xe1fb('0x8')](),controller[_0xe1fb('0xf')]);router[_0xe1fb('0x10')](_0xe1fb('0xb'),auth[_0xe1fb('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeee5=['post','create','update','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','index','get','/:id','isAuthenticated'];(function(_0x3d32af,_0x1b1fb4){var _0x4855bc=function(_0x424925){while(--_0x424925){_0x3d32af['push'](_0x3d32af['shift']());}};_0x4855bc(++_0x1b1fb4);}(_0xeee5,0xd5));var _0x5eee=function(_0x332b57,_0x111e10){_0x332b57=_0x332b57-0x0;var _0x3b8d10=_0xeee5[_0x332b57];return _0x3b8d10;};'use strict';var multer=require('multer');var util=require(_0x5eee('0x0'));var path=require(_0x5eee('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5eee('0x2'));var auth=require(_0x5eee('0x3'));var interaction=require(_0x5eee('0x4'));var config=require(_0x5eee('0x5'));var controller=require(_0x5eee('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x5eee('0x7')]);router[_0x5eee('0x8')](_0x5eee('0x9'),auth[_0x5eee('0xa')](),controller['show']);router[_0x5eee('0xb')]('/',auth[_0x5eee('0xa')](),controller[_0x5eee('0xc')]);router['put'](_0x5eee('0x9'),auth[_0x5eee('0xa')](),controller[_0x5eee('0xd')]);router['delete']('/:id',auth[_0x5eee('0xa')](),controller[_0x5eee('0xe')]);module[_0x5eee('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index e8da0cb..2ef61bb 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 _0xe6bf=['long','getDataValue','preproduction','toString','production','utf8','DATE','STRING','name','TEXT','BLOB'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe6bf,0x8b));var _0xfe6b=function(_0x3d9b8c,_0x1accd9){_0x3d9b8c=_0x3d9b8c-0x0;var _0x5afdbc=_0xe6bf[_0x3d9b8c];return _0x5afdbc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfe6b('0x0')],'unique':_0xfe6b('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xfe6b('0x2')]},'preproduction':{'type':Sequelize[_0xfe6b('0x3')](_0xfe6b('0x4')),'get':function(){if(this[_0xfe6b('0x5')](_0xfe6b('0x6'))){return this['getDataValue'](_0xfe6b('0x6'))[_0xfe6b('0x7')]('utf8');}}},'production':{'type':Sequelize[_0xfe6b('0x3')]('long'),'get':function(){if(this[_0xfe6b('0x5')](_0xfe6b('0x8'))){return this['getDataValue']('production')['toString'](_0xfe6b('0x9'));}}},'savedAt':{'type':Sequelize[_0xfe6b('0xa')]},'publishedAt':{'type':Sequelize[_0xfe6b('0xa')]}}; \ No newline at end of file +var _0xeb6a=['TEXT','long','getDataValue','preproduction','toString','utf8','BLOB','production','DATE','sequelize','exports','STRING'];(function(_0x16dfb3,_0x1613fc){var _0x1d8030=function(_0x1bd5da){while(--_0x1bd5da){_0x16dfb3['push'](_0x16dfb3['shift']());}};_0x1d8030(++_0x1613fc);}(_0xeb6a,0x1a1));var _0xaeb6=function(_0x27da3d,_0x5dbcac){_0x27da3d=_0x27da3d-0x0;var _0x51d07d=_0xeb6a[_0x27da3d];return _0x51d07d;};'use strict';var Sequelize=require(_0xaeb6('0x0'));module[_0xaeb6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xaeb6('0x2')]},'notes':{'type':Sequelize[_0xaeb6('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0xaeb6('0x4')),'get':function(){if(this[_0xaeb6('0x5')](_0xaeb6('0x6'))){return this[_0xaeb6('0x5')](_0xaeb6('0x6'))[_0xaeb6('0x7')](_0xaeb6('0x8'));}}},'production':{'type':Sequelize[_0xaeb6('0x9')](_0xaeb6('0x4')),'get':function(){if(this[_0xaeb6('0x5')]('production')){return this[_0xaeb6('0x5')](_0xaeb6('0xa'))[_0xaeb6('0x7')](_0xaeb6('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xaeb6('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d0f2a72..63cf2a9 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 _0x27ca=['update','then','destroy','get','UserProfileResource','agi','stringify','end','sendStatus','error','name','send','index','SquareProject','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','production','../../components/parsers/qs','../../config/environment','../../mysqldb','defaults','redis','localhost','./squareProject.socket','register','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x2e4a84,_0x3de6e1){var _0x16ffe8=function(_0x43382f){while(--_0x43382f){_0x2e4a84['push'](_0x2e4a84['shift']());}};_0x16ffe8(++_0x3de6e1);}(_0x27ca,0xb7));var _0xa27c=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x27ca[_0x376b45];return _0x2341b3;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xa27c('0x0'));var logger=require('../../config/logger')('api');var config=require(_0xa27c('0x1'));var db=require(_0xa27c('0x2'))['db'];config['redis']=_[_0xa27c('0x3')](config[_0xa27c('0x4')],{'host':_0xa27c('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa27c('0x6'))[_0xa27c('0x7')](socket);function respondWithResult(_0x2f0e4d,_0x378788){_0x378788=_0x378788||0xc8;return function(_0x425855){if(_0x425855){return _0x2f0e4d[_0xa27c('0x8')](_0x378788)['json'](_0x425855);}};}function respondWithFilteredResult(_0x347c69,_0x5a5b2c){return function(_0x4f1f88){if(_0x4f1f88){var _0xc944a4=typeof _0x5a5b2c[_0xa27c('0x9')]===_0xa27c('0xa')&&typeof _0x5a5b2c[_0xa27c('0xb')]===_0xa27c('0xa');var _0x2639c3=_0x4f1f88[_0xa27c('0xc')];var _0x520fcb=_0xc944a4?0x0:_0x5a5b2c['offset'];var _0x13e7ab=_0xc944a4?_0x4f1f88[_0xa27c('0xc')]:_0x5a5b2c['offset']+_0x5a5b2c[_0xa27c('0xb')];var _0xb41fba;if(_0x13e7ab>=_0x2639c3){_0x13e7ab=_0x2639c3;_0xb41fba=0xc8;}else{_0xb41fba=0xce;}_0x347c69[_0xa27c('0x8')](_0xb41fba);return _0x347c69[_0xa27c('0xd')](_0xa27c('0xe'),_0x520fcb+'-'+_0x13e7ab+'/'+_0x2639c3)['json'](_0x4f1f88);}return null;};}function saveUpdates(_0x365c65){return function(_0x4e88f0){if(_0x4e88f0){return _0x4e88f0[_0xa27c('0xf')](_0x365c65)[_0xa27c('0x10')](function(_0x380c4f){return _0x380c4f;});}return null;};}function removeEntity(_0x3f66f1){return function(_0x28f7e8){if(_0x28f7e8){return _0x28f7e8[_0xa27c('0x11')]()[_0xa27c('0x10')](function(){var _0x364867=_0x28f7e8[_0xa27c('0x12')]({'plain':!![]});var _0xf591bc='SquareProjects';return db[_0xa27c('0x13')]['destroy']({'where':{'type':_0xf591bc,'resourceId':_0x364867['id']}})['then'](function(){return _0x28f7e8;});})[_0xa27c('0x10')](function(){var _0x5af8b4=new Redis(config[_0xa27c('0x4')]);_0x5af8b4['publish'](_0xa27c('0x14'),JSON[_0xa27c('0x15')]({'id':_0x28f7e8['id'],'deleted':!![]}));})[_0xa27c('0x10')](function(){_0x3f66f1[_0xa27c('0x8')](0xcc)[_0xa27c('0x16')]();});}};}function handleEntityNotFound(_0x35294d){return function(_0x149bc9){if(!_0x149bc9){_0x35294d[_0xa27c('0x17')](0x194);}return _0x149bc9;};}function handleError(_0x51e060,_0xa974e4){_0xa974e4=_0xa974e4||0x1f4;return function(_0x11ef9a){logger[_0xa27c('0x18')](_0x11ef9a['stack']);if(_0x11ef9a['name']){delete _0x11ef9a[_0xa27c('0x19')];}_0x51e060[_0xa27c('0x8')](_0xa974e4)[_0xa27c('0x1a')](_0x11ef9a);};}exports[_0xa27c('0x1b')]=function(_0x350b8c,_0xa81f6e){var _0x227f94={},_0x462b51={},_0x4fbe00={'count':0x0,'rows':[]};var _0x265478=_['map'](db[_0xa27c('0x1c')][_0xa27c('0x1d')],function(_0x33ff3a){return{'name':_0x33ff3a[_0xa27c('0x1e')],'type':_0x33ff3a[_0xa27c('0x1f')]['key']};});_0x462b51['model']=_[_0xa27c('0x20')](_0x265478,_0xa27c('0x19'));_0x462b51[_0xa27c('0x21')]=_[_0xa27c('0x22')](_0x350b8c[_0xa27c('0x21')]);_0x462b51[_0xa27c('0x23')]=_[_0xa27c('0x24')](_0x462b51[_0xa27c('0x25')],_0x462b51['query']);_0x227f94[_0xa27c('0x26')]=_[_0xa27c('0x24')](_0x462b51['model'],qs[_0xa27c('0x27')](_0x350b8c[_0xa27c('0x21')][_0xa27c('0x27')]));_0x227f94[_0xa27c('0x26')]=_0x227f94['attributes'][_0xa27c('0x28')]?_0x227f94['attributes']:_0x462b51[_0xa27c('0x25')];if(!_0x350b8c[_0xa27c('0x21')]['hasOwnProperty'](_0xa27c('0x29'))){_0x227f94[_0xa27c('0xb')]=qs[_0xa27c('0xb')](_0x350b8c['query'][_0xa27c('0xb')]);_0x227f94['offset']=qs[_0xa27c('0x9')](_0x350b8c[_0xa27c('0x21')][_0xa27c('0x9')]);}_0x227f94[_0xa27c('0x2a')]=qs[_0xa27c('0x2b')](_0x350b8c[_0xa27c('0x21')][_0xa27c('0x2b')]);_0x227f94[_0xa27c('0x2c')]=qs['filters'](_[_0xa27c('0x2d')](_0x350b8c[_0xa27c('0x21')],_0x462b51[_0xa27c('0x23')]),_0x265478);if(_0x350b8c['query'][_0xa27c('0x2e')]){_0x227f94[_0xa27c('0x2c')]=_[_0xa27c('0x2f')](_0x227f94['where'],{'$or':_[_0xa27c('0x20')](_0x265478,function(_0x36485e){if(_0x36485e[_0xa27c('0x1f')]!==_0xa27c('0x30')){var _0x42fbae={};_0x42fbae[_0x36485e['name']]={'$like':'%'+_0x350b8c[_0xa27c('0x21')]['filter']+'%'};return _0x42fbae;}})});}_0x227f94=_['merge']({},_0x227f94,_0x350b8c[_0xa27c('0x31')]);var _0x4911e9={'where':_0x227f94[_0xa27c('0x2c')]};return db[_0xa27c('0x1c')][_0xa27c('0xc')](_0x4911e9)['then'](function(_0x2f0e9d){_0x4fbe00[_0xa27c('0xc')]=_0x2f0e9d;if(_0x350b8c[_0xa27c('0x21')][_0xa27c('0x32')]){_0x227f94['include']=[{'all':!![]}];}return db['SquareProject'][_0xa27c('0x33')](_0x227f94);})['then'](function(_0x4c2566){_0x4fbe00[_0xa27c('0x34')]=_0x4c2566;return _0x4fbe00;})[_0xa27c('0x10')](respondWithFilteredResult(_0xa81f6e,_0x227f94))[_0xa27c('0x35')](handleError(_0xa81f6e,null));};exports['show']=function(_0x4726f2,_0xc07199){var _0x54e241={'raw':![],'where':{'id':_0x4726f2['params']['id']}},_0x6cb924={};_0x6cb924['model']=_[_0xa27c('0x22')](db[_0xa27c('0x1c')][_0xa27c('0x1d')]);_0x6cb924[_0xa27c('0x21')]=_[_0xa27c('0x22')](_0x4726f2[_0xa27c('0x21')]);_0x6cb924[_0xa27c('0x23')]=_[_0xa27c('0x24')](_0x6cb924['model'],_0x6cb924[_0xa27c('0x21')]);_0x54e241[_0xa27c('0x26')]=_[_0xa27c('0x24')](_0x6cb924[_0xa27c('0x25')],qs[_0xa27c('0x27')](_0x4726f2[_0xa27c('0x21')][_0xa27c('0x27')]));_0x54e241[_0xa27c('0x26')]=_0x54e241['attributes'][_0xa27c('0x28')]?_0x54e241[_0xa27c('0x26')]:_0x6cb924[_0xa27c('0x25')];if(_0x4726f2[_0xa27c('0x21')][_0xa27c('0x32')]){_0x54e241['include']=[{'all':!![]}];}_0x54e241=_[_0xa27c('0x2f')]({},_0x54e241,_0x4726f2['options']);return db[_0xa27c('0x1c')]['find'](_0x54e241)[_0xa27c('0x10')](handleEntityNotFound(_0xc07199,null))[_0xa27c('0x10')](respondWithResult(_0xc07199,null))['catch'](handleError(_0xc07199,null));};exports['create']=function(_0x2c59c1,_0x3da2e9){return db['SquareProject'][_0xa27c('0x36')](_0x2c59c1['body'],{})[_0xa27c('0x10')](function(_0x34d033){var _0x4d4c61=_0x2c59c1[_0xa27c('0x37')][_0xa27c('0x12')]({'plain':!![]});if(!_0x4d4c61)throw new Error(_0xa27c('0x38'));if(_0x4d4c61[_0xa27c('0x39')]===_0xa27c('0x37')){var _0x2d0aeb=_0x34d033['get']({'plain':!![]});var _0x4e3d06=_0xa27c('0x3a');return db[_0xa27c('0x3b')][_0xa27c('0x3c')]({'where':{'name':_0x4e3d06,'userProfileId':_0x4d4c61[_0xa27c('0x3d')]},'raw':!![]})[_0xa27c('0x10')](function(_0x321a8d){if(_0x321a8d&&_0x321a8d['autoAssociation']===0x0){return db[_0xa27c('0x13')][_0xa27c('0x36')]({'name':_0x2d0aeb[_0xa27c('0x19')],'resourceId':_0x2d0aeb['id'],'type':_0x321a8d[_0xa27c('0x19')],'sectionId':_0x321a8d['id']},{})[_0xa27c('0x10')](function(){return _0x34d033;});}else{return _0x34d033;}})[_0xa27c('0x35')](function(_0x2a740c){logger['error'](_0xa27c('0x3e'),_0x2a740c);throw _0x2a740c;});}return _0x34d033;})[_0xa27c('0x10')](respondWithResult(_0x3da2e9,0xc9))[_0xa27c('0x35')](handleError(_0x3da2e9,null));};exports[_0xa27c('0xf')]=function(_0x55b7b3,_0x3f38c9){if(_0x55b7b3['body']['id']){delete _0x55b7b3['body']['id'];}return db[_0xa27c('0x1c')][_0xa27c('0x3c')]({'where':{'id':_0x55b7b3[_0xa27c('0x3f')]['id']}})[_0xa27c('0x10')](handleEntityNotFound(_0x3f38c9,null))[_0xa27c('0x10')](saveUpdates(_0x55b7b3[_0xa27c('0x40')],null))['then'](function(_0x33b3ae){if(!_0x33b3ae)return;var _0x120577=_0x33b3ae[_0xa27c('0x12')]({'plain':!![]});return _0x120577;})[_0xa27c('0x10')](function(_0x531d74){var _0x1a9e98=new Redis(config[_0xa27c('0x4')]);_0x1a9e98['publish'](_0xa27c('0x14'),JSON[_0xa27c('0x15')](_[_0xa27c('0x2d')](_0x531d74,['id',_0xa27c('0x19'),_0xa27c('0x41')])));return _0x531d74;})[_0xa27c('0x10')](respondWithResult(_0x3f38c9,null))[_0xa27c('0x35')](handleError(_0x3f38c9,null));};exports['destroy']=function(_0x21175c,_0xa81035){return db[_0xa27c('0x1c')]['find']({'where':{'id':_0x21175c[_0xa27c('0x3f')]['id']}})[_0xa27c('0x10')](handleEntityNotFound(_0xa81035,null))['then'](removeEntity(_0xa81035,null))[_0xa27c('0x35')](handleError(_0xa81035,null));}; \ No newline at end of file +var _0xb44b=['create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','pick','production','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','SquareProjects','UserProfileResource','publish','stringify','end','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x4bd27b,_0x4c8cc0){var _0xaa392e=function(_0x2145fc){while(--_0x2145fc){_0x4bd27b['push'](_0x4bd27b['shift']());}};_0xaa392e(++_0x4c8cc0);}(_0xb44b,0x178));var _0xbb44=function(_0x1c1820,_0x18bb79){_0x1c1820=_0x1c1820-0x0;var _0x6690e6=_0xb44b[_0x1c1820];return _0x6690e6;};'use strict';var _=require(_0xbb44('0x0'));var Redis=require('ioredis');var qs=require(_0xbb44('0x1'));var logger=require(_0xbb44('0x2'))(_0xbb44('0x3'));var config=require(_0xbb44('0x4'));var db=require(_0xbb44('0x5'))['db'];config[_0xbb44('0x6')]=_[_0xbb44('0x7')](config[_0xbb44('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb44('0x8'))(new Redis(config[_0xbb44('0x6')]));require(_0xbb44('0x9'))[_0xbb44('0xa')](socket);function respondWithResult(_0x3c191c,_0x1dbbda){_0x1dbbda=_0x1dbbda||0xc8;return function(_0x30125b){if(_0x30125b){return _0x3c191c[_0xbb44('0xb')](_0x1dbbda)[_0xbb44('0xc')](_0x30125b);}};}function respondWithFilteredResult(_0x229af9,_0x5109ec){return function(_0x536f62){if(_0x536f62){var _0x144a29=typeof _0x5109ec[_0xbb44('0xd')]==='undefined'&&typeof _0x5109ec[_0xbb44('0xe')]===_0xbb44('0xf');var _0x3cf4b8=_0x536f62[_0xbb44('0x10')];var _0x15113d=_0x144a29?0x0:_0x5109ec[_0xbb44('0xd')];var _0x11cbdc=_0x144a29?_0x536f62[_0xbb44('0x10')]:_0x5109ec[_0xbb44('0xd')]+_0x5109ec[_0xbb44('0xe')];var _0x2ebc76;if(_0x11cbdc>=_0x3cf4b8){_0x11cbdc=_0x3cf4b8;_0x2ebc76=0xc8;}else{_0x2ebc76=0xce;}_0x229af9[_0xbb44('0xb')](_0x2ebc76);return _0x229af9[_0xbb44('0x11')](_0xbb44('0x12'),_0x15113d+'-'+_0x11cbdc+'/'+_0x3cf4b8)[_0xbb44('0xc')](_0x536f62);}return null;};}function saveUpdates(_0x5b9ab5){return function(_0x2f713d){if(_0x2f713d){return _0x2f713d['update'](_0x5b9ab5)[_0xbb44('0x13')](function(_0x20b4b5){return _0x20b4b5;});}return null;};}function removeEntity(_0x544575){return function(_0x3c5458){if(_0x3c5458){return _0x3c5458[_0xbb44('0x14')]()[_0xbb44('0x13')](function(){var _0x26d719=_0x3c5458['get']({'plain':!![]});var _0x1ebb42=_0xbb44('0x15');return db[_0xbb44('0x16')][_0xbb44('0x14')]({'where':{'type':_0x1ebb42,'resourceId':_0x26d719['id']}})[_0xbb44('0x13')](function(){return _0x3c5458;});})[_0xbb44('0x13')](function(){var _0x4445c7=new Redis(config[_0xbb44('0x6')]);_0x4445c7[_0xbb44('0x17')]('agi',JSON[_0xbb44('0x18')]({'id':_0x3c5458['id'],'deleted':!![]}));})[_0xbb44('0x13')](function(){_0x544575[_0xbb44('0xb')](0xcc)[_0xbb44('0x19')]();});}};}function handleEntityNotFound(_0x1d8bd0){return function(_0x491ad4){if(!_0x491ad4){_0x1d8bd0[_0xbb44('0x1a')](0x194);}return _0x491ad4;};}function handleError(_0x17950d,_0x5d8082){_0x5d8082=_0x5d8082||0x1f4;return function(_0x53dedf){logger[_0xbb44('0x1b')](_0x53dedf[_0xbb44('0x1c')]);if(_0x53dedf[_0xbb44('0x1d')]){delete _0x53dedf[_0xbb44('0x1d')];}_0x17950d[_0xbb44('0xb')](_0x5d8082)[_0xbb44('0x1e')](_0x53dedf);};}exports[_0xbb44('0x1f')]=function(_0x1e7bab,_0x35949f){var _0x10c85b={},_0x504295={},_0x424c63={'count':0x0,'rows':[]};var _0x386ef0=_[_0xbb44('0x20')](db[_0xbb44('0x21')][_0xbb44('0x22')],function(_0x27239f){return{'name':_0x27239f[_0xbb44('0x23')],'type':_0x27239f[_0xbb44('0x24')][_0xbb44('0x25')]};});_0x504295['model']=_[_0xbb44('0x20')](_0x386ef0,'name');_0x504295['query']=_['keys'](_0x1e7bab[_0xbb44('0x26')]);_0x504295[_0xbb44('0x27')]=_[_0xbb44('0x28')](_0x504295[_0xbb44('0x29')],_0x504295[_0xbb44('0x26')]);_0x10c85b['attributes']=_[_0xbb44('0x28')](_0x504295[_0xbb44('0x29')],qs[_0xbb44('0x2a')](_0x1e7bab[_0xbb44('0x26')][_0xbb44('0x2a')]));_0x10c85b[_0xbb44('0x2b')]=_0x10c85b['attributes']['length']?_0x10c85b[_0xbb44('0x2b')]:_0x504295[_0xbb44('0x29')];if(!_0x1e7bab[_0xbb44('0x26')][_0xbb44('0x2c')](_0xbb44('0x2d'))){_0x10c85b['limit']=qs[_0xbb44('0xe')](_0x1e7bab[_0xbb44('0x26')][_0xbb44('0xe')]);_0x10c85b[_0xbb44('0xd')]=qs[_0xbb44('0xd')](_0x1e7bab[_0xbb44('0x26')][_0xbb44('0xd')]);}_0x10c85b[_0xbb44('0x2e')]=qs[_0xbb44('0x2f')](_0x1e7bab[_0xbb44('0x26')][_0xbb44('0x2f')]);_0x10c85b[_0xbb44('0x30')]=qs[_0xbb44('0x27')](_['pick'](_0x1e7bab[_0xbb44('0x26')],_0x504295[_0xbb44('0x27')]),_0x386ef0);if(_0x1e7bab['query']['filter']){_0x10c85b['where']=_[_0xbb44('0x31')](_0x10c85b[_0xbb44('0x30')],{'$or':_[_0xbb44('0x20')](_0x386ef0,function(_0x41fce8){if(_0x41fce8['type']!==_0xbb44('0x32')){var _0x5b482c={};_0x5b482c[_0x41fce8[_0xbb44('0x1d')]]={'$like':'%'+_0x1e7bab[_0xbb44('0x26')][_0xbb44('0x33')]+'%'};return _0x5b482c;}})});}_0x10c85b=_[_0xbb44('0x31')]({},_0x10c85b,_0x1e7bab[_0xbb44('0x34')]);var _0x22b84d={'where':_0x10c85b[_0xbb44('0x30')]};return db[_0xbb44('0x21')]['count'](_0x22b84d)[_0xbb44('0x13')](function(_0x4fc7a7){_0x424c63[_0xbb44('0x10')]=_0x4fc7a7;if(_0x1e7bab['query'][_0xbb44('0x35')]){_0x10c85b[_0xbb44('0x36')]=[{'all':!![]}];}return db[_0xbb44('0x21')][_0xbb44('0x37')](_0x10c85b);})[_0xbb44('0x13')](function(_0x173065){_0x424c63[_0xbb44('0x38')]=_0x173065;return _0x424c63;})[_0xbb44('0x13')](respondWithFilteredResult(_0x35949f,_0x10c85b))[_0xbb44('0x39')](handleError(_0x35949f,null));};exports[_0xbb44('0x3a')]=function(_0x52e4a0,_0x349a1a){var _0x503409={'raw':![],'where':{'id':_0x52e4a0[_0xbb44('0x3b')]['id']}},_0x11f5ce={};_0x11f5ce['model']=_[_0xbb44('0x3c')](db[_0xbb44('0x21')]['rawAttributes']);_0x11f5ce[_0xbb44('0x26')]=_[_0xbb44('0x3c')](_0x52e4a0['query']);_0x11f5ce['filters']=_[_0xbb44('0x28')](_0x11f5ce[_0xbb44('0x29')],_0x11f5ce[_0xbb44('0x26')]);_0x503409[_0xbb44('0x2b')]=_['intersection'](_0x11f5ce[_0xbb44('0x29')],qs[_0xbb44('0x2a')](_0x52e4a0[_0xbb44('0x26')][_0xbb44('0x2a')]));_0x503409[_0xbb44('0x2b')]=_0x503409[_0xbb44('0x2b')]['length']?_0x503409[_0xbb44('0x2b')]:_0x11f5ce[_0xbb44('0x29')];if(_0x52e4a0[_0xbb44('0x26')][_0xbb44('0x35')]){_0x503409[_0xbb44('0x36')]=[{'all':!![]}];}_0x503409=_[_0xbb44('0x31')]({},_0x503409,_0x52e4a0['options']);return db[_0xbb44('0x21')][_0xbb44('0x3d')](_0x503409)[_0xbb44('0x13')](handleEntityNotFound(_0x349a1a,null))[_0xbb44('0x13')](respondWithResult(_0x349a1a,null))[_0xbb44('0x39')](handleError(_0x349a1a,null));};exports[_0xbb44('0x3e')]=function(_0x530c32,_0x5e1757){return db[_0xbb44('0x21')][_0xbb44('0x3e')](_0x530c32['body'],{})[_0xbb44('0x13')](function(_0xcffa7b){var _0x241770=_0x530c32['user']['get']({'plain':!![]});if(!_0x241770)throw new Error(_0xbb44('0x3f'));if(_0x241770[_0xbb44('0x40')]===_0xbb44('0x41')){var _0x19c584=_0xcffa7b[_0xbb44('0x42')]({'plain':!![]});var _0x4e8ed7=_0xbb44('0x15');return db['UserProfileSection']['find']({'where':{'name':_0x4e8ed7,'userProfileId':_0x241770[_0xbb44('0x43')]},'raw':!![]})[_0xbb44('0x13')](function(_0xcc4a1a){if(_0xcc4a1a&&_0xcc4a1a['autoAssociation']===0x0){return db[_0xbb44('0x16')][_0xbb44('0x3e')]({'name':_0x19c584['name'],'resourceId':_0x19c584['id'],'type':_0xcc4a1a['name'],'sectionId':_0xcc4a1a['id']},{})[_0xbb44('0x13')](function(){return _0xcffa7b;});}else{return _0xcffa7b;}})['catch'](function(_0x2399f9){logger[_0xbb44('0x1b')](_0xbb44('0x44'),_0x2399f9);throw _0x2399f9;});}return _0xcffa7b;})[_0xbb44('0x13')](respondWithResult(_0x5e1757,0xc9))[_0xbb44('0x39')](handleError(_0x5e1757,null));};exports[_0xbb44('0x45')]=function(_0x403101,_0x4f7878){if(_0x403101['body']['id']){delete _0x403101[_0xbb44('0x46')]['id'];}return db['SquareProject'][_0xbb44('0x3d')]({'where':{'id':_0x403101[_0xbb44('0x3b')]['id']}})[_0xbb44('0x13')](handleEntityNotFound(_0x4f7878,null))[_0xbb44('0x13')](saveUpdates(_0x403101[_0xbb44('0x46')],null))[_0xbb44('0x13')](function(_0x439b83){if(!_0x439b83)return;var _0x4d5adc=_0x439b83['get']({'plain':!![]});return _0x4d5adc;})[_0xbb44('0x13')](function(_0x168ded){var _0x4e9553=new Redis(config[_0xbb44('0x6')]);_0x4e9553[_0xbb44('0x17')]('agi',JSON[_0xbb44('0x18')](_[_0xbb44('0x47')](_0x168ded,['id',_0xbb44('0x1d'),_0xbb44('0x48')])));return _0x168ded;})[_0xbb44('0x13')](respondWithResult(_0x4f7878,null))['catch'](handleError(_0x4f7878,null));};exports['destroy']=function(_0x24499d,_0x1cde35){return db[_0xbb44('0x21')]['find']({'where':{'id':_0x24499d[_0xbb44('0x3b')]['id']}})[_0xbb44('0x13')](handleEntityNotFound(_0x1cde35,null))[_0xbb44('0x13')](removeEntity(_0x1cde35,null))['catch'](handleError(_0x1cde35,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 80a5560..edd46a2 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 _0x27f8=['emit','hasOwnProperty','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove'];(function(_0x253b37,_0xdb7ae0){var _0x24b147=function(_0x38c58d){while(--_0x38c58d){_0x253b37['push'](_0x253b37['shift']());}};_0x24b147(++_0xdb7ae0);}(_0x27f8,0xf5));var _0x827f=function(_0x3e659f,_0x17abb3){_0x3e659f=_0x3e659f-0x0;var _0x32bc81=_0x27f8[_0x3e659f];return _0x32bc81;};'use strict';var EventEmitter=require(_0x827f('0x0'));var SquareProject=require(_0x827f('0x1'))['db'][_0x827f('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x827f('0x3')](0x0);var events={'afterCreate':_0x827f('0x4'),'afterUpdate':_0x827f('0x5'),'afterDestroy':_0x827f('0x6')};function emitEvent(_0x40971d){return function(_0x2357ec,_0x14801c,_0x40a988){SquareProjectEvents[_0x827f('0x7')](_0x40971d+':'+_0x2357ec['id'],_0x2357ec);SquareProjectEvents['emit'](_0x40971d,_0x2357ec);_0x40a988(null);};}for(var e in events){if(events[_0x827f('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xb459=['save','remove','emit','hasOwnProperty','hook','exports','events','SquareProject','setMaxListeners'];(function(_0x58668c,_0x317e64){var _0x5674d9=function(_0x29d3e7){while(--_0x29d3e7){_0x58668c['push'](_0x58668c['shift']());}};_0x5674d9(++_0x317e64);}(_0xb459,0x72));var _0x9b45=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0xb459[_0x17c483];return _0x112bdb;};'use strict';var EventEmitter=require(_0x9b45('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x9b45('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9b45('0x2')](0x0);var events={'afterCreate':_0x9b45('0x3'),'afterUpdate':'update','afterDestroy':_0x9b45('0x4')};function emitEvent(_0x47dcde){return function(_0x2289b6,_0x2500e2,_0x2788e6){SquareProjectEvents[_0x9b45('0x5')](_0x47dcde+':'+_0x2289b6['id'],_0x2289b6);SquareProjectEvents[_0x9b45('0x5')](_0x47dcde,_0x2289b6);_0x2788e6(null);};}for(var e in events){if(events[_0x9b45('0x6')](e)){var event=events[e];SquareProject[_0x9b45('0x7')](e,emitEvent(event));}}module[_0x9b45('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b7dda39..e02e6ef 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 _0x5e02=['path','exports','define','SquareProject','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','api','moment','bluebird'];(function(_0x4400a2,_0x31fa52){var _0x348817=function(_0x5ae46a){while(--_0x5ae46a){_0x4400a2['push'](_0x4400a2['shift']());}};_0x348817(++_0x31fa52);}(_0x5e02,0x14b));var _0x25e0=function(_0x1447a3,_0x4d37da){_0x1447a3=_0x1447a3-0x0;var _0x1450b3=_0x5e02[_0x1447a3];return _0x1450b3;};'use strict';var _=require(_0x25e0('0x0'));var util=require(_0x25e0('0x1'));var logger=require('../../config/logger')(_0x25e0('0x2'));var moment=require(_0x25e0('0x3'));var BPromise=require(_0x25e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25e0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0x25e0('0x6')]=function(_0x269b1b,_0x18a2c3){return _0x269b1b[_0x25e0('0x7')](_0x25e0('0x8'),attributes,{'tableName':_0x25e0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x165b83,_0xbece3e,_0x32cb07){if(_0x165b83[_0x25e0('0xa')]('preproduction')){_0x165b83[_0x25e0('0xb')]=moment()[_0x25e0('0xc')](_0x25e0('0xd'));}if(_0x165b83[_0x25e0('0xa')](_0x25e0('0xe'))){_0x165b83[_0x25e0('0xf')]=moment()['format'](_0x25e0('0xd'));}_0x32cb07(null,_0x165b83);}}});}; \ No newline at end of file +var _0xed29=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','rimraf','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xed29,0x177));var _0x9ed2=function(_0x57fd40,_0x9de24f){_0x57fd40=_0x57fd40-0x0;var _0x52bb76=_0xed29[_0x57fd40];return _0x52bb76;};'use strict';var _=require(_0x9ed2('0x0'));var util=require(_0x9ed2('0x1'));var logger=require('../../config/logger')(_0x9ed2('0x2'));var moment=require(_0x9ed2('0x3'));var BPromise=require(_0x9ed2('0x4'));var rp=require(_0x9ed2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ed2('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ed2('0x7'));module[_0x9ed2('0x8')]=function(_0x428227,_0x4920f6){return _0x428227[_0x9ed2('0x9')](_0x9ed2('0xa'),attributes,{'tableName':_0x9ed2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x70296f,_0x3c8dae,_0x1dc153){if(_0x70296f[_0x9ed2('0xc')](_0x9ed2('0xd'))){_0x70296f[_0x9ed2('0xe')]=moment()[_0x9ed2('0xf')](_0x9ed2('0x10'));}if(_0x70296f[_0x9ed2('0xc')]('production')){_0x70296f['publishedAt']=moment()[_0x9ed2('0xf')](_0x9ed2('0x10'));}_0x1dc153(null,_0x70296f);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index ca816f4..9818259 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 _0x8d15=['model','then','info','debug','stringify','catch','error','message','ShowSquareProject','SquareProject','find','lodash','ioredis','../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects','findAll','options','raw','where','attributes','map','include'];(function(_0x174e7f,_0x3ca78e){var _0x1f71c6=function(_0x237446){while(--_0x237446){_0x174e7f['push'](_0x174e7f['shift']());}};_0x1f71c6(++_0x3ca78e);}(_0x8d15,0x1a1));var _0x58d1=function(_0x46a52c,_0x3466ea){_0x46a52c=_0x46a52c-0x0;var _0x4cd8b6=_0x8d15[_0x46a52c];return _0x4cd8b6;};'use strict';var _=require(_0x58d1('0x0'));var Redis=require(_0x58d1('0x1'));var db=require(_0x58d1('0x2'))['db'];var logger=require(_0x58d1('0x3'))(_0x58d1('0x4'));var config=require('../../config/environment');config[_0x58d1('0x5')]=_[_0x58d1('0x6')](config[_0x58d1('0x5')],{'host':_0x58d1('0x7'),'port':0x18eb});var socket=require(_0x58d1('0x8'))(new Redis(config['redis']));require(_0x58d1('0x9'))['register'](socket);exports[_0x58d1('0xa')]=function(_0x52d2d){var _0x4dfd6e=this;return new Promise(function(_0x65ad8f,_0x3252c4){return db['SquareProject'][_0x58d1('0xb')]({'raw':_0x52d2d[_0x58d1('0xc')]?_0x52d2d[_0x58d1('0xc')][_0x58d1('0xd')]===undefined?!![]:![]:!![],'where':_0x52d2d['options']?_0x52d2d['options'][_0x58d1('0xe')]||null:null,'attributes':_0x52d2d[_0x58d1('0xc')]?_0x52d2d[_0x58d1('0xc')][_0x58d1('0xf')]||null:null,'limit':_0x52d2d[_0x58d1('0xc')]?_0x52d2d[_0x58d1('0xc')]['limit']||null:null,'include':_0x52d2d['options']?_0x52d2d['options']['include']?_[_0x58d1('0x10')](_0x52d2d[_0x58d1('0xc')][_0x58d1('0x11')],function(_0x3ef232){return{'model':db[_0x3ef232[_0x58d1('0x12')]],'as':_0x3ef232['as'],'attributes':_0x3ef232[_0x58d1('0xf')],'include':_0x3ef232[_0x58d1('0x11')]?_[_0x58d1('0x10')](_0x3ef232[_0x58d1('0x11')],function(_0x87565e){return{'model':db[_0x87565e[_0x58d1('0x12')]],'as':_0x87565e['as'],'attributes':_0x87565e['attributes'],'include':_0x87565e[_0x58d1('0x11')]?_[_0x58d1('0x10')](_0x87565e[_0x58d1('0x11')],function(_0x3af1e8){return{'model':db[_0x3af1e8[_0x58d1('0x12')]],'as':_0x3af1e8['as'],'attributes':_0x3af1e8['attributes']};}):[]};}):[]};}):[]:[]})[_0x58d1('0x13')](function(_0x126597){logger[_0x58d1('0x14')](_0x58d1('0xa'),_0x52d2d);logger[_0x58d1('0x15')](_0x58d1('0xa'),_0x52d2d,JSON[_0x58d1('0x16')](_0x126597));_0x65ad8f(_0x126597);})[_0x58d1('0x17')](function(_0x3ac240){logger[_0x58d1('0x18')]('GetSquareProjects',_0x3ac240[_0x58d1('0x19')],_0x52d2d);_0x3252c4(_0x4dfd6e['error'](0x1f4,_0x3ac240[_0x58d1('0x19')]));});});};exports[_0x58d1('0x1a')]=function(_0x1c2e47){var _0x8199b0=this;return new Promise(function(_0x2f53b7,_0x1c7369){return db[_0x58d1('0x1b')][_0x58d1('0x1c')]({'raw':_0x1c2e47[_0x58d1('0xc')]?_0x1c2e47[_0x58d1('0xc')][_0x58d1('0xd')]===undefined?!![]:![]:!![],'where':_0x1c2e47[_0x58d1('0xc')]?_0x1c2e47[_0x58d1('0xc')][_0x58d1('0xe')]||null:null,'attributes':_0x1c2e47[_0x58d1('0xc')]?_0x1c2e47[_0x58d1('0xc')][_0x58d1('0xf')]||null:null,'include':_0x1c2e47[_0x58d1('0xc')]?_0x1c2e47[_0x58d1('0xc')][_0x58d1('0x11')]?_[_0x58d1('0x10')](_0x1c2e47['options']['include'],function(_0x33af56){return{'model':db[_0x33af56['model']],'as':_0x33af56['as'],'attributes':_0x33af56[_0x58d1('0xf')],'include':_0x33af56[_0x58d1('0x11')]?_[_0x58d1('0x10')](_0x33af56[_0x58d1('0x11')],function(_0x4c8c29){return{'model':db[_0x4c8c29['model']],'as':_0x4c8c29['as'],'attributes':_0x4c8c29[_0x58d1('0xf')],'include':_0x4c8c29[_0x58d1('0x11')]?_[_0x58d1('0x10')](_0x4c8c29['include'],function(_0x1102d7){return{'model':db[_0x1102d7['model']],'as':_0x1102d7['as'],'attributes':_0x1102d7[_0x58d1('0xf')]};}):[]};}):[]};}):[]:[]})[_0x58d1('0x13')](function(_0x33c02e){logger[_0x58d1('0x14')](_0x58d1('0x1a'),_0x1c2e47);logger[_0x58d1('0x15')](_0x58d1('0x1a'),_0x1c2e47,JSON[_0x58d1('0x16')](_0x33c02e));_0x2f53b7(_0x33c02e);})[_0x58d1('0x17')](function(_0x43daa1){logger[_0x58d1('0x18')](_0x58d1('0x1a'),_0x43daa1[_0x58d1('0x19')],_0x1c2e47);_0x1c7369(_0x8199b0[_0x58d1('0x18')](0x1f4,_0x43daa1['message']));});});}; \ No newline at end of file +var _0x42a5=['then','stringify','lodash','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','where','attributes','limit','include','map','model','info','debug','error','message','ShowSquareProject','find'];(function(_0x556975,_0x1a8786){var _0x1ac05a=function(_0x4d7122){while(--_0x4d7122){_0x556975['push'](_0x556975['shift']());}};_0x1ac05a(++_0x1a8786);}(_0x42a5,0xc6));var _0x542a=function(_0x1b4a4f,_0x5b6612){_0x1b4a4f=_0x1b4a4f-0x0;var _0xaeeb38=_0x42a5[_0x1b4a4f];return _0xaeeb38;};'use strict';var _=require(_0x542a('0x0'));var Redis=require('ioredis');var db=require(_0x542a('0x1'))['db'];var logger=require(_0x542a('0x2'))('rpc');var config=require(_0x542a('0x3'));config[_0x542a('0x4')]=_[_0x542a('0x5')](config[_0x542a('0x4')],{'host':_0x542a('0x6'),'port':0x18eb});var socket=require(_0x542a('0x7'))(new Redis(config[_0x542a('0x4')]));require(_0x542a('0x8'))[_0x542a('0x9')](socket);exports[_0x542a('0xa')]=function(_0x24d0c1){var _0x366421=this;return new Promise(function(_0xedec18,_0x53be33){return db[_0x542a('0xb')]['findAll']({'raw':_0x24d0c1[_0x542a('0xc')]?_0x24d0c1[_0x542a('0xc')][_0x542a('0xd')]===undefined?!![]:![]:!![],'where':_0x24d0c1[_0x542a('0xc')]?_0x24d0c1['options'][_0x542a('0xe')]||null:null,'attributes':_0x24d0c1['options']?_0x24d0c1[_0x542a('0xc')][_0x542a('0xf')]||null:null,'limit':_0x24d0c1[_0x542a('0xc')]?_0x24d0c1[_0x542a('0xc')][_0x542a('0x10')]||null:null,'include':_0x24d0c1[_0x542a('0xc')]?_0x24d0c1[_0x542a('0xc')][_0x542a('0x11')]?_[_0x542a('0x12')](_0x24d0c1[_0x542a('0xc')]['include'],function(_0x4f498f){return{'model':db[_0x4f498f[_0x542a('0x13')]],'as':_0x4f498f['as'],'attributes':_0x4f498f[_0x542a('0xf')],'include':_0x4f498f['include']?_['map'](_0x4f498f['include'],function(_0x3af38f){return{'model':db[_0x3af38f['model']],'as':_0x3af38f['as'],'attributes':_0x3af38f[_0x542a('0xf')],'include':_0x3af38f[_0x542a('0x11')]?_['map'](_0x3af38f['include'],function(_0x3555c2){return{'model':db[_0x3555c2[_0x542a('0x13')]],'as':_0x3555c2['as'],'attributes':_0x3555c2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x58d608){logger[_0x542a('0x14')](_0x542a('0xa'),_0x24d0c1);logger[_0x542a('0x15')]('GetSquareProjects',_0x24d0c1,JSON['stringify'](_0x58d608));_0xedec18(_0x58d608);})['catch'](function(_0x264ff3){logger[_0x542a('0x16')](_0x542a('0xa'),_0x264ff3[_0x542a('0x17')],_0x24d0c1);_0x53be33(_0x366421['error'](0x1f4,_0x264ff3[_0x542a('0x17')]));});});};exports[_0x542a('0x18')]=function(_0xe9bdfa){var _0x220977=this;return new Promise(function(_0x4fa874,_0x1153bb){return db[_0x542a('0xb')][_0x542a('0x19')]({'raw':_0xe9bdfa['options']?_0xe9bdfa[_0x542a('0xc')][_0x542a('0xd')]===undefined?!![]:![]:!![],'where':_0xe9bdfa[_0x542a('0xc')]?_0xe9bdfa[_0x542a('0xc')][_0x542a('0xe')]||null:null,'attributes':_0xe9bdfa[_0x542a('0xc')]?_0xe9bdfa[_0x542a('0xc')][_0x542a('0xf')]||null:null,'include':_0xe9bdfa[_0x542a('0xc')]?_0xe9bdfa[_0x542a('0xc')][_0x542a('0x11')]?_[_0x542a('0x12')](_0xe9bdfa[_0x542a('0xc')][_0x542a('0x11')],function(_0x4d77f9){return{'model':db[_0x4d77f9[_0x542a('0x13')]],'as':_0x4d77f9['as'],'attributes':_0x4d77f9['attributes'],'include':_0x4d77f9[_0x542a('0x11')]?_['map'](_0x4d77f9['include'],function(_0x57ce26){return{'model':db[_0x57ce26[_0x542a('0x13')]],'as':_0x57ce26['as'],'attributes':_0x57ce26[_0x542a('0xf')],'include':_0x57ce26['include']?_[_0x542a('0x12')](_0x57ce26['include'],function(_0x1fd67f){return{'model':db[_0x1fd67f[_0x542a('0x13')]],'as':_0x1fd67f['as'],'attributes':_0x1fd67f['attributes']};}):[]};}):[]};}):[]:[]})[_0x542a('0x1a')](function(_0x593efa){logger[_0x542a('0x14')]('ShowSquareProject',_0xe9bdfa);logger[_0x542a('0x15')](_0x542a('0x18'),_0xe9bdfa,JSON[_0x542a('0x1b')](_0x593efa));_0x4fa874(_0x593efa);})['catch'](function(_0x23a8ec){logger['error'](_0x542a('0x18'),_0x23a8ec[_0x542a('0x17')],_0xe9bdfa);_0x1153bb(_0x220977[_0x542a('0x16')](0x1f4,_0x23a8ec['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 7b334c1..8420034 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 _0xd856=['save','remove','update','emit','removeListener','register','./squareProject.events'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xd856,0x18e));var _0x6d85=function(_0x1bc9b7,_0x5cbcb3){_0x1bc9b7=_0x1bc9b7-0x0;var _0x59b9b5=_0xd856[_0x1bc9b7];return _0x59b9b5;};'use strict';var SquareProjectEvents=require(_0x6d85('0x0'));var events=[_0x6d85('0x1'),_0x6d85('0x2'),_0x6d85('0x3')];function createListener(_0x50c12a,_0x22777c){return function(_0x20cc22){_0x22777c[_0x6d85('0x4')](_0x50c12a,_0x20cc22);};}function removeListener(_0x51598a,_0x20ce99){return function(){SquareProjectEvents[_0x6d85('0x5')](_0x51598a,_0x20ce99);};}exports[_0x6d85('0x6')]=function(_0x324814){for(var _0x250df0=0x0,_0x1ebabd=events['length'];_0x250df0<_0x1ebabd;_0x250df0++){var _0x286cbd=events[_0x250df0];var _0x79c659=createListener('squareProject:'+_0x286cbd,_0x324814);SquareProjectEvents['on'](_0x286cbd,_0x79c659);}}; \ No newline at end of file +var _0x69f4=['removeListener','register','length','squareProject:','./squareProject.events','save','remove','update','emit'];(function(_0x533c07,_0x3a94d4){var _0x24d34c=function(_0x2b8eda){while(--_0x2b8eda){_0x533c07['push'](_0x533c07['shift']());}};_0x24d34c(++_0x3a94d4);}(_0x69f4,0x1ea));var _0x469f=function(_0x320a9e,_0x52d446){_0x320a9e=_0x320a9e-0x0;var _0x543ec2=_0x69f4[_0x320a9e];return _0x543ec2;};'use strict';var SquareProjectEvents=require(_0x469f('0x0'));var events=[_0x469f('0x1'),_0x469f('0x2'),_0x469f('0x3')];function createListener(_0x33052c,_0x26b4c3){return function(_0x341dfa){_0x26b4c3[_0x469f('0x4')](_0x33052c,_0x341dfa);};}function removeListener(_0x119ecd,_0x36debf){return function(){SquareProjectEvents[_0x469f('0x5')](_0x119ecd,_0x36debf);};}exports[_0x469f('0x6')]=function(_0x459f01){for(var _0x580349=0x0,_0x3e2f05=events[_0x469f('0x7')];_0x580349<_0x3e2f05;_0x580349++){var _0xcba3a0=events[_0x580349];var _0x5d91d6=createListener(_0x469f('0x8')+_0xcba3a0,_0x459f01);SquareProjectEvents['on'](_0xcba3a0,_0x5d91d6);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index b1d927d..27b044a 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4618ac,_0x34ea0b){var _0x4804af=function(_0x113292){while(--_0x113292){_0x4618ac['push'](_0x4618ac['shift']());}};_0x4804af(++_0x34ea0b);}(_0x4975,0x86));var _0x5497=function(_0x3f0a0a,_0x5b43aa){_0x3f0a0a=_0x3f0a0a-0x0;var _0x4dd04b=_0x4975[_0x3f0a0a];return _0x4dd04b;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x4522f8,_0x7a6eae){var _0x5a51ea=function(_0x49ebae){while(--_0x49ebae){_0x4522f8['push'](_0x4522f8['shift']());}};_0x5a51ea(++_0x7a6eae);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0x5fc3[_0x4f0c2b];return _0x526436;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 57b39a9..71ae381 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 _0x7da7=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7da7,0x10d));var _0x77da=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x7da7[_0x2605dc];return _0x4568c9;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'uniqueid':{'type':Sequelize[_0x77da('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x77da('0x2')]},'extension':{'type':Sequelize[_0x77da('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x77da('0x2')]},'dnid':{'type':Sequelize[_0x77da('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x77da('0x2')]},'filename':{'type':Sequelize[_0x77da('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x77da('0x3')],'get':function(){var _0x47cf1d='';var _0x1191de=this[_0x77da('0x4')](_0x77da('0x5'));if(_0x1191de){_0x47cf1d=_0x1191de[_0x77da('0x6')](_0x1191de[_0x77da('0x7')]('.'));}return _0x47cf1d;}}}; \ No newline at end of file +var _0x032e=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x1b1821,_0x26df86){var _0x4bfdcb=function(_0x2ce949){while(--_0x2ce949){_0x1b1821['push'](_0x1b1821['shift']());}};_0x4bfdcb(++_0x26df86);}(_0x032e,0x124));var _0xe032=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x032e[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xe032('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe032('0x1')]},'callerid':{'type':Sequelize[_0xe032('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe032('0x1')]},'priority':{'type':Sequelize[_0xe032('0x1')]},'accountcode':{'type':Sequelize[_0xe032('0x1')]},'dnid':{'type':Sequelize[_0xe032('0x1')]},'projectName':{'type':Sequelize[_0xe032('0x1')]},'saveName':{'type':Sequelize[_0xe032('0x1')]},'filename':{'type':Sequelize[_0xe032('0x1')]},'savePath':{'type':Sequelize[_0xe032('0x1')]},'format':{'type':Sequelize[_0xe032('0x2')],'get':function(){var _0x1576c8='';var _0x3289b0=this[_0xe032('0x3')](_0xe032('0x4'));if(_0x3289b0){_0x1576c8=_0x3289b0[_0xe032('0x5')](_0x3289b0[_0xe032('0x6')]('.'));}return _0x1576c8;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e9291f5..fc89d8f 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 _0x2071=['send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','reject','save','update','then','destroy','sendStatus','error','name'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x2071,0x163));var _0x1207=function(_0x216799,_0x44b817){_0x216799=_0x216799-0x0;var _0x3661c3=_0x2071[_0x216799];return _0x3661c3;};'use strict';var emlformat=require(_0x1207('0x0'));var rimraf=require(_0x1207('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1207('0x2'));var rp=require(_0x1207('0x3'));var moment=require(_0x1207('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1207('0x5'));var util=require(_0x1207('0x6'));var path=require(_0x1207('0x7'));var sox=require(_0x1207('0x8'));var csv=require(_0x1207('0x9'));var ejs=require(_0x1207('0xa'));var fs=require('fs');var fs_extra=require(_0x1207('0xb'));var _=require('lodash');var squel=require(_0x1207('0xc'));var crypto=require(_0x1207('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1207('0xe'));var toCsv=require(_0x1207('0x9'));var querystring=require(_0x1207('0xf'));var Papa=require('papaparse');var Redis=require(_0x1207('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1207('0x11'));var as=require(_0x1207('0x12'));var hardwareService=require(_0x1207('0x13'));var logger=require(_0x1207('0x14'))(_0x1207('0x15'));var utils=require(_0x1207('0x16'));var config=require(_0x1207('0x17'));var licenseUtil=require(_0x1207('0x18'));var db=require(_0x1207('0x19'))['db'];function respondWithStatusCode(_0x523a33,_0x1fb665){_0x1fb665=_0x1fb665||0xcc;return function(_0xb6833b){if(_0xb6833b){return _0x523a33['sendStatus'](_0x1fb665);}return _0x523a33['status'](_0x1fb665)[_0x1207('0x1a')]();};}function respondWithResult(_0x475391,_0x55630e){_0x55630e=_0x55630e||0xc8;return function(_0x1df8b0){if(_0x1df8b0){return _0x475391[_0x1207('0x1b')](_0x55630e)[_0x1207('0x1c')](_0x1df8b0);}};}function respondWithFilteredResult(_0x55a32f,_0x4cf8b0){return function(_0x2a99b2){if(_0x2a99b2){var _0x1c12bb=typeof _0x4cf8b0[_0x1207('0x1d')]===_0x1207('0x1e')&&typeof _0x4cf8b0[_0x1207('0x1f')]===_0x1207('0x1e');var _0x5e10bd=_0x2a99b2[_0x1207('0x20')];var _0x40915c=_0x1c12bb?0x0:_0x4cf8b0[_0x1207('0x1d')];var _0x1c5122=_0x1c12bb?_0x2a99b2[_0x1207('0x20')]:_0x4cf8b0[_0x1207('0x1d')]+_0x4cf8b0['limit'];var _0x3b4244;if(_0x1c5122>=_0x5e10bd){_0x1c5122=_0x5e10bd;_0x3b4244=0xc8;}else{_0x3b4244=0xce;}_0x55a32f['status'](_0x3b4244);return _0x55a32f['set']('Content-Range',_0x40915c+'-'+_0x1c5122+'/'+_0x5e10bd)['json'](_0x2a99b2);}return null;};}function patchUpdates(_0x51a8e4){return function(_0xafa4e9){try{jsonpatch['apply'](_0xafa4e9,_0x51a8e4,!![]);}catch(_0x57d11f){return BPromise[_0x1207('0x21')](_0x57d11f);}return _0xafa4e9[_0x1207('0x22')]();};}function saveUpdates(_0x575574,_0x20efe0){return function(_0x3a8cee){if(_0x3a8cee){return _0x3a8cee[_0x1207('0x23')](_0x575574)[_0x1207('0x24')](function(_0x18c3f5){return _0x18c3f5;});}return null;};}function removeEntity(_0x1905c1,_0x31a689){return function(_0x9a85d3){if(_0x9a85d3){return _0x9a85d3[_0x1207('0x25')]()[_0x1207('0x24')](function(){_0x1905c1['status'](0xcc)[_0x1207('0x1a')]();});}};}function handleEntityNotFound(_0x4a6a38,_0x16c192){return function(_0x118c54){if(!_0x118c54){_0x4a6a38[_0x1207('0x26')](0x194);}return _0x118c54;};}function handleError(_0x59269f,_0xc4fd9b){_0xc4fd9b=_0xc4fd9b||0x1f4;return function(_0x1f507b){logger[_0x1207('0x27')](_0x1f507b['stack']);if(_0x1f507b[_0x1207('0x28')]){delete _0x1f507b[_0x1207('0x28')];}_0x59269f[_0x1207('0x1b')](_0xc4fd9b)[_0x1207('0x29')](_0x1f507b);};}exports[_0x1207('0x2a')]=function(_0x13063b,_0x4eec27){var _0xe25254={},_0x4c496c={},_0x2b36c1={'count':0x0,'rows':[]};var _0x430a1d=_[_0x1207('0x2b')](db[_0x1207('0x2c')][_0x1207('0x2d')],function(_0x2a87c4){return{'name':_0x2a87c4[_0x1207('0x2e')],'type':_0x2a87c4[_0x1207('0x2f')][_0x1207('0x30')]};});_0x4c496c[_0x1207('0x31')]=_[_0x1207('0x2b')](_0x430a1d,_0x1207('0x28'));_0x4c496c[_0x1207('0x32')]=_[_0x1207('0x33')](_0x13063b['query']);_0x4c496c['filters']=_['intersection'](_0x4c496c['model'],_0x4c496c[_0x1207('0x32')]);_0xe25254[_0x1207('0x34')]=_[_0x1207('0x35')](_0x4c496c[_0x1207('0x31')],qs[_0x1207('0x36')](_0x13063b[_0x1207('0x32')][_0x1207('0x36')]));_0xe25254[_0x1207('0x34')]=_0xe25254[_0x1207('0x34')][_0x1207('0x37')]?_0xe25254['attributes']:_0x4c496c['model'];if(!_0x13063b[_0x1207('0x32')][_0x1207('0x38')]('nolimit')){_0xe25254[_0x1207('0x1f')]=qs['limit'](_0x13063b[_0x1207('0x32')][_0x1207('0x1f')]);_0xe25254['offset']=qs['offset'](_0x13063b[_0x1207('0x32')]['offset']);}_0xe25254[_0x1207('0x39')]=qs[_0x1207('0x3a')](_0x13063b[_0x1207('0x32')][_0x1207('0x3a')]);_0xe25254[_0x1207('0x3b')]=qs[_0x1207('0x3c')](_[_0x1207('0x3d')](_0x13063b[_0x1207('0x32')],_0x4c496c[_0x1207('0x3c')]),_0x430a1d);if(_0x13063b['query']['filter']){_0xe25254[_0x1207('0x3b')]=_['merge'](_0xe25254['where'],{'$or':_[_0x1207('0x2b')](_0x430a1d,function(_0x37d8c4){if(_0x37d8c4[_0x1207('0x2f')]!==_0x1207('0x3e')){var _0x2aaa1a={};_0x2aaa1a[_0x37d8c4[_0x1207('0x28')]]={'$like':'%'+_0x13063b[_0x1207('0x32')][_0x1207('0x3f')]+'%'};return _0x2aaa1a;}})});}_0xe25254=_[_0x1207('0x40')]({},_0xe25254,_0x13063b[_0x1207('0x41')]);var _0x246d8a={'where':_0xe25254[_0x1207('0x3b')]};return db[_0x1207('0x2c')][_0x1207('0x20')](_0x246d8a)[_0x1207('0x24')](function(_0x22d933){_0x2b36c1[_0x1207('0x20')]=_0x22d933;if(_0x13063b[_0x1207('0x32')]['includeAll']){_0xe25254[_0x1207('0x42')]=[{'all':!![]}];}return db[_0x1207('0x2c')][_0x1207('0x43')](_0xe25254);})[_0x1207('0x24')](function(_0x5461cc){_0x2b36c1[_0x1207('0x44')]=_0x5461cc;return _0x2b36c1;})[_0x1207('0x24')](respondWithFilteredResult(_0x4eec27,_0xe25254))[_0x1207('0x45')](handleError(_0x4eec27,null));};exports[_0x1207('0x46')]=function(_0x4da591,_0x489c2a){var _0x137b08={'raw':!![],'where':{'id':_0x4da591[_0x1207('0x47')]['id']}},_0x5e92a1={};_0x5e92a1[_0x1207('0x31')]=_[_0x1207('0x33')](db[_0x1207('0x2c')][_0x1207('0x2d')]);_0x5e92a1[_0x1207('0x32')]=_[_0x1207('0x33')](_0x4da591[_0x1207('0x32')]);_0x5e92a1[_0x1207('0x3c')]=_[_0x1207('0x35')](_0x5e92a1[_0x1207('0x31')],_0x5e92a1[_0x1207('0x32')]);_0x137b08[_0x1207('0x34')]=_[_0x1207('0x35')](_0x5e92a1[_0x1207('0x31')],qs[_0x1207('0x36')](_0x4da591[_0x1207('0x32')][_0x1207('0x36')]));_0x137b08['attributes']=_0x137b08[_0x1207('0x34')][_0x1207('0x37')]?_0x137b08[_0x1207('0x34')]:_0x5e92a1[_0x1207('0x31')];if(_0x4da591['query'][_0x1207('0x48')]){_0x137b08['include']=[{'all':!![]}];}_0x137b08=_[_0x1207('0x40')]({},_0x137b08,_0x4da591[_0x1207('0x41')]);return db[_0x1207('0x2c')]['find'](_0x137b08)['then'](handleEntityNotFound(_0x489c2a,null))[_0x1207('0x24')](respondWithResult(_0x489c2a,null))['catch'](handleError(_0x489c2a,null));};exports[_0x1207('0x49')]=function(_0x1df3b6,_0x2675af){return db[_0x1207('0x2c')][_0x1207('0x49')](_0x1df3b6[_0x1207('0x4a')],{})[_0x1207('0x24')](respondWithResult(_0x2675af,0xc9))[_0x1207('0x45')](handleError(_0x2675af,null));};exports[_0x1207('0x23')]=function(_0x461873,_0x2fe78f){if(_0x461873[_0x1207('0x4a')]['id']){delete _0x461873[_0x1207('0x4a')]['id'];}return db[_0x1207('0x2c')][_0x1207('0x4b')]({'where':{'id':_0x461873[_0x1207('0x47')]['id']}})['then'](handleEntityNotFound(_0x2fe78f,null))[_0x1207('0x24')](saveUpdates(_0x461873['body'],null))[_0x1207('0x24')](respondWithResult(_0x2fe78f,null))[_0x1207('0x45')](handleError(_0x2fe78f,null));};exports[_0x1207('0x4c')]=function(_0x18e6f6,_0x1a3055,_0x4c194f){var _0x38f810=require(_0x1207('0x4d'));var _0x106b72=![];var _0x5e183d={};if(_0x18e6f6[_0x1207('0x32')][_0x1207('0x2f')]&&_0x18e6f6['query']['type']===_0x1207('0x4e')){_0x5e183d[_0x1207('0x4e')]=_0x18e6f6[_0x1207('0x47')]['id'];}else{_0x5e183d['id']=_0x18e6f6['params']['id'];}return db[_0x1207('0x2c')][_0x1207('0x4b')]({'where':_0x5e183d,'attributes':['id',_0x1207('0x4f'),_0x1207('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x1a3055,null))[_0x1207('0x24')](function(_0x493976){if(_0x493976){var _0x34e7a4=_0x493976[_0x1207('0x4f')];var _0x468150=util[_0x1207('0x51')](_0x1207('0x52'),_0x34e7a4);if(fs[_0x1207('0x53')](_0x468150)){_0x106b72=!![];return _0x38f810['decryptFile'](_0x468150,_0x34e7a4,config[_0x1207('0x54')][_0x1207('0x55')])[_0x1207('0x24')](function(){return _0x493976;});}return _0x493976;}})[_0x1207('0x24')](function(_0x18117a){if(_0x18117a){var _0x3ce9d1=_0x18117a['savePath'];if(!fs[_0x1207('0x53')](_0x3ce9d1)){throw new db[(_0x1207('0x56'))][(_0x1207('0x57'))]('SquareRecording\x20not\x20found');}if(_0x18117a[_0x1207('0x50')]){return _0x1a3055[_0x1207('0x4c')](_0x3ce9d1,_0x18117a[_0x1207('0x50')]+path[_0x1207('0x58')](_0x3ce9d1),function(){if(_0x106b72){fs[_0x1207('0x59')](_0x3ce9d1);}});}else{return _0x1a3055['download'](_0x3ce9d1,function(_0x4242f2){if(_0x106b72){fs[_0x1207('0x59')](_0x3ce9d1);}});}}})['catch'](function(_0x5d3a38){if(_0x5d3a38[_0x1207('0x5a')]==='SquareRecording\x20not\x20found'){_0x1a3055[_0x1207('0x1b')](0x194)['send'](_0x1207('0x5b'));}else{return handleError(_0x1a3055,null);}});};exports[_0x1207('0x25')]=function(_0x4f5659,_0x152696){return db['SquareRecording']['find']({'where':{'id':_0x4f5659['params']['id']}})[_0x1207('0x24')](function(_0x5abd39){if(_[_0x1207('0x5c')](_0x5abd39)){throw new ReferenceError(_0x1207('0x5d'));}return _0x5abd39;})[_0x1207('0x24')](function(_0x43eb5d){var _0x49963f=_0x43eb5d[_0x1207('0x4f')];logger['info'](_0x1207('0x5e'),_0x49963f);if(!_[_0x1207('0x5c')](_0x43eb5d['savePath'])&&fs[_0x1207('0x53')](_0x49963f)){logger['info'](_0x1207('0x5f')+_0x49963f+_0x1207('0x60'));fs[_0x1207('0x61')](_0x49963f);}_0x49963f=_0x49963f+_0x1207('0x62');if(!_['isNil'](_0x43eb5d[_0x1207('0x4f')])&&fs[_0x1207('0x53')](_0x49963f)){logger['info']('File:\x20\x22'+_0x49963f+_0x1207('0x60'));fs['unlinkSync'](_0x49963f);}return _0x43eb5d;})[_0x1207('0x24')](function(_0x4c7010){if(!_0x4c7010)throw new InternalError();return _0x4c7010[_0x1207('0x25')]();})[_0x1207('0x24')](function(){_0x152696[_0x1207('0x1b')](0xcc)['end']();})[_0x1207('0x45')](handleError(_0x152696,null));}; \ No newline at end of file +var _0x0dee=['unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','offset','order','sort','where','pick','VIRTUAL','filter','merge','options','SquareRecording','count','includeAll','include','catch','show','params','keys','find','body','download','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','extname','unlink','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0dee,0xbd));var _0xe0de=function(_0x5b8b84,_0x118d5b){_0x5b8b84=_0x5b8b84-0x0;var _0x5ea4f0=_0x0dee[_0x5b8b84];return _0x5ea4f0;};'use strict';var emlformat=require(_0xe0de('0x0'));var rimraf=require(_0xe0de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0de('0x2'));var rp=require(_0xe0de('0x3'));var moment=require('moment');var BPromise=require(_0xe0de('0x4'));var Mustache=require(_0xe0de('0x5'));var util=require(_0xe0de('0x6'));var path=require(_0xe0de('0x7'));var sox=require(_0xe0de('0x8'));var csv=require(_0xe0de('0x9'));var ejs=require(_0xe0de('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0de('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0de('0xc'));var deskjs=require(_0xe0de('0xd'));var toCsv=require(_0xe0de('0x9'));var querystring=require('querystring');var Papa=require(_0xe0de('0xe'));var Redis=require('ioredis');var authService=require(_0xe0de('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe0de('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0de('0x11'))(_0xe0de('0x12'));var utils=require('../../config/utils');var config=require(_0xe0de('0x13'));var licenseUtil=require(_0xe0de('0x14'));var db=require(_0xe0de('0x15'))['db'];function respondWithStatusCode(_0x3b12d0,_0x46a7b2){_0x46a7b2=_0x46a7b2||0xcc;return function(_0x7d660){if(_0x7d660){return _0x3b12d0[_0xe0de('0x16')](_0x46a7b2);}return _0x3b12d0[_0xe0de('0x17')](_0x46a7b2)[_0xe0de('0x18')]();};}function respondWithResult(_0x359c83,_0x19703c){_0x19703c=_0x19703c||0xc8;return function(_0x2cdff7){if(_0x2cdff7){return _0x359c83[_0xe0de('0x17')](_0x19703c)[_0xe0de('0x19')](_0x2cdff7);}};}function respondWithFilteredResult(_0x4cdcd3,_0x9a01d3){return function(_0x43b7f7){if(_0x43b7f7){var _0x4919cc=typeof _0x9a01d3['offset']===_0xe0de('0x1a')&&typeof _0x9a01d3[_0xe0de('0x1b')]===_0xe0de('0x1a');var _0x40ec0f=_0x43b7f7['count'];var _0x3dd72f=_0x4919cc?0x0:_0x9a01d3['offset'];var _0x2d993e=_0x4919cc?_0x43b7f7['count']:_0x9a01d3['offset']+_0x9a01d3[_0xe0de('0x1b')];var _0x4ea77f;if(_0x2d993e>=_0x40ec0f){_0x2d993e=_0x40ec0f;_0x4ea77f=0xc8;}else{_0x4ea77f=0xce;}_0x4cdcd3[_0xe0de('0x17')](_0x4ea77f);return _0x4cdcd3[_0xe0de('0x1c')](_0xe0de('0x1d'),_0x3dd72f+'-'+_0x2d993e+'/'+_0x40ec0f)[_0xe0de('0x19')](_0x43b7f7);}return null;};}function patchUpdates(_0x14ce1e){return function(_0x199dcc){try{jsonpatch['apply'](_0x199dcc,_0x14ce1e,!![]);}catch(_0x5224b5){return BPromise[_0xe0de('0x1e')](_0x5224b5);}return _0x199dcc[_0xe0de('0x1f')]();};}function saveUpdates(_0x16a102,_0x180284){return function(_0x1033ba){if(_0x1033ba){return _0x1033ba[_0xe0de('0x20')](_0x16a102)['then'](function(_0x5ae51f){return _0x5ae51f;});}return null;};}function removeEntity(_0x1929c9,_0x1ee12f){return function(_0x545f58){if(_0x545f58){return _0x545f58[_0xe0de('0x21')]()[_0xe0de('0x22')](function(){_0x1929c9[_0xe0de('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f4e79,_0x127d4b){return function(_0x561d08){if(!_0x561d08){_0x4f4e79['sendStatus'](0x194);}return _0x561d08;};}function handleError(_0x441be4,_0x38c5a1){_0x38c5a1=_0x38c5a1||0x1f4;return function(_0x4f4d24){logger[_0xe0de('0x23')](_0x4f4d24[_0xe0de('0x24')]);if(_0x4f4d24[_0xe0de('0x25')]){delete _0x4f4d24[_0xe0de('0x25')];}_0x441be4['status'](_0x38c5a1)[_0xe0de('0x26')](_0x4f4d24);};}exports[_0xe0de('0x27')]=function(_0x4a6441,_0x5bd54b){var _0x51e430={},_0x4033dc={},_0x12d91b={'count':0x0,'rows':[]};var _0x3796bb=_['map'](db['SquareRecording'][_0xe0de('0x28')],function(_0xb1d65e){return{'name':_0xb1d65e[_0xe0de('0x29')],'type':_0xb1d65e[_0xe0de('0x2a')][_0xe0de('0x2b')]};});_0x4033dc[_0xe0de('0x2c')]=_[_0xe0de('0x2d')](_0x3796bb,_0xe0de('0x25'));_0x4033dc[_0xe0de('0x2e')]=_['keys'](_0x4a6441[_0xe0de('0x2e')]);_0x4033dc[_0xe0de('0x2f')]=_[_0xe0de('0x30')](_0x4033dc[_0xe0de('0x2c')],_0x4033dc[_0xe0de('0x2e')]);_0x51e430['attributes']=_[_0xe0de('0x30')](_0x4033dc[_0xe0de('0x2c')],qs[_0xe0de('0x31')](_0x4a6441['query']['fields']));_0x51e430[_0xe0de('0x32')]=_0x51e430[_0xe0de('0x32')][_0xe0de('0x33')]?_0x51e430['attributes']:_0x4033dc[_0xe0de('0x2c')];if(!_0x4a6441[_0xe0de('0x2e')]['hasOwnProperty'](_0xe0de('0x34'))){_0x51e430['limit']=qs[_0xe0de('0x1b')](_0x4a6441['query']['limit']);_0x51e430[_0xe0de('0x35')]=qs[_0xe0de('0x35')](_0x4a6441[_0xe0de('0x2e')][_0xe0de('0x35')]);}_0x51e430[_0xe0de('0x36')]=qs['sort'](_0x4a6441[_0xe0de('0x2e')][_0xe0de('0x37')]);_0x51e430[_0xe0de('0x38')]=qs[_0xe0de('0x2f')](_[_0xe0de('0x39')](_0x4a6441[_0xe0de('0x2e')],_0x4033dc['filters']),_0x3796bb);if(_0x4a6441[_0xe0de('0x2e')]['filter']){_0x51e430['where']=_['merge'](_0x51e430[_0xe0de('0x38')],{'$or':_[_0xe0de('0x2d')](_0x3796bb,function(_0xd14a0f){if(_0xd14a0f['type']!==_0xe0de('0x3a')){var _0xab34ef={};_0xab34ef[_0xd14a0f[_0xe0de('0x25')]]={'$like':'%'+_0x4a6441[_0xe0de('0x2e')][_0xe0de('0x3b')]+'%'};return _0xab34ef;}})});}_0x51e430=_[_0xe0de('0x3c')]({},_0x51e430,_0x4a6441[_0xe0de('0x3d')]);var _0x328a7d={'where':_0x51e430[_0xe0de('0x38')]};return db[_0xe0de('0x3e')][_0xe0de('0x3f')](_0x328a7d)[_0xe0de('0x22')](function(_0x5482de){_0x12d91b[_0xe0de('0x3f')]=_0x5482de;if(_0x4a6441['query'][_0xe0de('0x40')]){_0x51e430[_0xe0de('0x41')]=[{'all':!![]}];}return db[_0xe0de('0x3e')]['findAll'](_0x51e430);})[_0xe0de('0x22')](function(_0x1d63aa){_0x12d91b['rows']=_0x1d63aa;return _0x12d91b;})[_0xe0de('0x22')](respondWithFilteredResult(_0x5bd54b,_0x51e430))[_0xe0de('0x42')](handleError(_0x5bd54b,null));};exports[_0xe0de('0x43')]=function(_0x5afade,_0x27d2bd){var _0x37cd2c={'raw':!![],'where':{'id':_0x5afade[_0xe0de('0x44')]['id']}},_0x42ab16={};_0x42ab16[_0xe0de('0x2c')]=_[_0xe0de('0x45')](db[_0xe0de('0x3e')]['rawAttributes']);_0x42ab16[_0xe0de('0x2e')]=_[_0xe0de('0x45')](_0x5afade[_0xe0de('0x2e')]);_0x42ab16[_0xe0de('0x2f')]=_[_0xe0de('0x30')](_0x42ab16[_0xe0de('0x2c')],_0x42ab16[_0xe0de('0x2e')]);_0x37cd2c['attributes']=_[_0xe0de('0x30')](_0x42ab16[_0xe0de('0x2c')],qs[_0xe0de('0x31')](_0x5afade['query'][_0xe0de('0x31')]));_0x37cd2c[_0xe0de('0x32')]=_0x37cd2c[_0xe0de('0x32')]['length']?_0x37cd2c[_0xe0de('0x32')]:_0x42ab16[_0xe0de('0x2c')];if(_0x5afade['query']['includeAll']){_0x37cd2c[_0xe0de('0x41')]=[{'all':!![]}];}_0x37cd2c=_[_0xe0de('0x3c')]({},_0x37cd2c,_0x5afade['options']);return db[_0xe0de('0x3e')][_0xe0de('0x46')](_0x37cd2c)[_0xe0de('0x22')](handleEntityNotFound(_0x27d2bd,null))[_0xe0de('0x22')](respondWithResult(_0x27d2bd,null))[_0xe0de('0x42')](handleError(_0x27d2bd,null));};exports['create']=function(_0x50f2a3,_0x2ac2c1){return db[_0xe0de('0x3e')]['create'](_0x50f2a3[_0xe0de('0x47')],{})[_0xe0de('0x22')](respondWithResult(_0x2ac2c1,0xc9))['catch'](handleError(_0x2ac2c1,null));};exports[_0xe0de('0x20')]=function(_0x14f950,_0x5bc355){if(_0x14f950[_0xe0de('0x47')]['id']){delete _0x14f950[_0xe0de('0x47')]['id'];}return db['SquareRecording'][_0xe0de('0x46')]({'where':{'id':_0x14f950[_0xe0de('0x44')]['id']}})[_0xe0de('0x22')](handleEntityNotFound(_0x5bc355,null))[_0xe0de('0x22')](saveUpdates(_0x14f950[_0xe0de('0x47')],null))[_0xe0de('0x22')](respondWithResult(_0x5bc355,null))[_0xe0de('0x42')](handleError(_0x5bc355,null));};exports[_0xe0de('0x48')]=function(_0x5a2a56,_0x3f6460,_0x71ef9a){var _0x179389=require(_0xe0de('0x49'));var _0xf3d64d=![];var _0x585320={};if(_0x5a2a56[_0xe0de('0x2e')][_0xe0de('0x2a')]&&_0x5a2a56[_0xe0de('0x2e')][_0xe0de('0x2a')]===_0xe0de('0x4a')){_0x585320['uniqueid']=_0x5a2a56[_0xe0de('0x44')]['id'];}else{_0x585320['id']=_0x5a2a56[_0xe0de('0x44')]['id'];}return db['SquareRecording'][_0xe0de('0x46')]({'where':_0x585320,'attributes':['id','savePath',_0xe0de('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x3f6460,null))[_0xe0de('0x22')](function(_0x3d043f){if(_0x3d043f){var _0x46e74f=_0x3d043f[_0xe0de('0x4c')];var _0x4bdafc=util[_0xe0de('0x4d')](_0xe0de('0x4e'),_0x46e74f);if(fs[_0xe0de('0x4f')](_0x4bdafc)){_0xf3d64d=!![];return _0x179389[_0xe0de('0x50')](_0x4bdafc,_0x46e74f,config[_0xe0de('0x51')][_0xe0de('0x52')])[_0xe0de('0x22')](function(){return _0x3d043f;});}return _0x3d043f;}})[_0xe0de('0x22')](function(_0x4f42d7){if(_0x4f42d7){var _0x902add=_0x4f42d7[_0xe0de('0x4c')];if(!fs[_0xe0de('0x4f')](_0x902add)){throw new db['Sequelize'][(_0xe0de('0x53'))]('SquareRecording\x20not\x20found');}if(_0x4f42d7[_0xe0de('0x4b')]){return _0x3f6460[_0xe0de('0x48')](_0x902add,_0x4f42d7['filename']+path[_0xe0de('0x54')](_0x902add),function(){if(_0xf3d64d){fs[_0xe0de('0x55')](_0x902add);}});}else{return _0x3f6460[_0xe0de('0x48')](_0x902add,function(_0x35510a){if(_0xf3d64d){fs[_0xe0de('0x55')](_0x902add);}});}}})['catch'](function(_0x405a50){if(_0x405a50['message']===_0xe0de('0x56')){_0x3f6460[_0xe0de('0x17')](0x194)[_0xe0de('0x26')](_0xe0de('0x57'));}else{return handleError(_0x3f6460,null);}});};exports['destroy']=function(_0x3a6d6b,_0x111ad3){return db[_0xe0de('0x3e')][_0xe0de('0x46')]({'where':{'id':_0x3a6d6b['params']['id']}})[_0xe0de('0x22')](function(_0x127041){if(_[_0xe0de('0x58')](_0x127041)){throw new ReferenceError(_0xe0de('0x59'));}return _0x127041;})[_0xe0de('0x22')](function(_0x69f67c){var _0x9d6edf=_0x69f67c['savePath'];logger[_0xe0de('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x9d6edf);if(!_[_0xe0de('0x58')](_0x69f67c[_0xe0de('0x4c')])&&fs[_0xe0de('0x4f')](_0x9d6edf)){logger[_0xe0de('0x5a')](_0xe0de('0x5b')+_0x9d6edf+_0xe0de('0x5c'));fs['unlinkSync'](_0x9d6edf);}_0x9d6edf=_0x9d6edf+'.cypher';if(!_[_0xe0de('0x58')](_0x69f67c[_0xe0de('0x4c')])&&fs[_0xe0de('0x4f')](_0x9d6edf)){logger[_0xe0de('0x5a')](_0xe0de('0x5b')+_0x9d6edf+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe0de('0x5d')](_0x9d6edf);}return _0x69f67c;})['then'](function(_0x6ea64b){if(!_0x6ea64b)throw new InternalError();return _0x6ea64b[_0xe0de('0x21')]();})['then'](function(){_0x111ad3[_0xe0de('0x17')](0xcc)[_0xe0de('0x18')]();})['catch'](handleError(_0x111ad3,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 21e39a2..8874c7c 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 _0xe0dc=['./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0xe0dc,0x190));var _0xce0d=function(_0x1aa59b,_0x26612c){_0x1aa59b=_0x1aa59b-0x0;var _0x33011c=_0xe0dc[_0x1aa59b];return _0x33011c;};'use strict';var _=require(_0xce0d('0x0'));var util=require('util');var logger=require(_0xce0d('0x1'))(_0xce0d('0x2'));var moment=require('moment');var BPromise=require(_0xce0d('0x3'));var rp=require(_0xce0d('0x4'));var fs=require('fs');var path=require(_0xce0d('0x5'));var rimraf=require(_0xce0d('0x6'));var config=require('../../config/environment');var attributes=require(_0xce0d('0x7'));module['exports']=function(_0x3e7888,_0x33f430){return _0x3e7888[_0xce0d('0x8')](_0xce0d('0x9'),attributes,{'tableName':_0xce0d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3eb=['define','SquareRecording','square_recordings','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa3eb,0x1ed));var _0xba3e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa3eb[_0x411add];return _0x238242;};'use strict';var _=require(_0xba3e('0x0'));var util=require(_0xba3e('0x1'));var logger=require(_0xba3e('0x2'))('api');var moment=require(_0xba3e('0x3'));var BPromise=require(_0xba3e('0x4'));var rp=require(_0xba3e('0x5'));var fs=require('fs');var path=require(_0xba3e('0x6'));var rimraf=require(_0xba3e('0x7'));var config=require(_0xba3e('0x8'));var attributes=require(_0xba3e('0x9'));module[_0xba3e('0xa')]=function(_0x259b23,_0x298ece){return _0x259b23[_0xba3e('0xb')](_0xba3e('0xc'),attributes,{'tableName':_0xba3e('0xd'),'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 592e7ee..da7137d 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 _0x1a6e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','SquareRecording','create','body','options','CreateSquareRecording','lodash','util','bluebird','randomstring','ioredis'];(function(_0x9178d4,_0x2d5ab9){var _0x1f8636=function(_0x355d25){while(--_0x355d25){_0x9178d4['push'](_0x9178d4['shift']());}};_0x1f8636(++_0x2d5ab9);}(_0x1a6e,0x1bb));var _0xe1a6=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x1a6e[_0x28d18d];return _0x470640;};'use strict';var _=require(_0xe1a6('0x0'));var util=require(_0xe1a6('0x1'));var moment=require('moment');var BPromise=require(_0xe1a6('0x2'));var rs=require(_0xe1a6('0x3'));var fs=require('fs');var Redis=require(_0xe1a6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1a6('0x5'));var logger=require(_0xe1a6('0x6'))(_0xe1a6('0x7'));var config=require(_0xe1a6('0x8'));var jayson=require(_0xe1a6('0x9'));var client=jayson[_0xe1a6('0xa')][_0xe1a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2080e7,_0x4bbaf9,_0x39ab5b){return new BPromise(function(_0x3f157d,_0xd50e93){return client[_0xe1a6('0xc')](_0x2080e7,_0x39ab5b)[_0xe1a6('0xd')](function(_0x4cd7bd){logger[_0xe1a6('0xe')](_0xe1a6('0xf'),_0x4bbaf9,'request\x20sent');logger[_0xe1a6('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x4bbaf9,_0xe1a6('0x11'),JSON[_0xe1a6('0x12')](_0x4cd7bd));if(_0x4cd7bd[_0xe1a6('0x13')]){if(_0x4cd7bd['error'][_0xe1a6('0x14')]===0x1f4){logger[_0xe1a6('0x13')]('SquareRecording,\x20%s,\x20%s',_0x4bbaf9,_0x4cd7bd['error'][_0xe1a6('0x15')]);return _0xd50e93(_0x4cd7bd['error'][_0xe1a6('0x15')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x4bbaf9,_0x4cd7bd[_0xe1a6('0x13')]['message']);return _0x3f157d(_0x4cd7bd[_0xe1a6('0x13')][_0xe1a6('0x15')]);}else{logger[_0xe1a6('0xe')]('SquareRecording,\x20%s,\x20%s',_0x4bbaf9,_0xe1a6('0x11'));_0x3f157d(_0x4cd7bd['result']['message']);}})[_0xe1a6('0x16')](function(_0x330716){logger[_0xe1a6('0x13')](_0xe1a6('0xf'),_0x4bbaf9,_0x330716);_0xd50e93(_0x330716);});});}exports['CreateSquareRecording']=function(_0x2d4d57){var _0x289a80=this;return new Promise(function(_0x4b6636,_0x257741){return db[_0xe1a6('0x17')][_0xe1a6('0x18')](_0x2d4d57[_0xe1a6('0x19')],{'raw':_0x2d4d57[_0xe1a6('0x1a')]?_0x2d4d57[_0xe1a6('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xe1a6('0xd')](function(_0x2dcea8){logger[_0xe1a6('0xe')](_0xe1a6('0x1b'),_0x2d4d57);logger[_0xe1a6('0x10')](_0xe1a6('0x1b'),_0x2d4d57,JSON['stringify'](_0x2dcea8));_0x4b6636(_0x2dcea8);})[_0xe1a6('0x16')](function(_0x16095d){logger[_0xe1a6('0x13')](_0xe1a6('0x1b'),_0x16095d[_0xe1a6('0x15')],_0x2d4d57);_0x257741(_0x289a80[_0xe1a6('0x13')](0x1f4,_0x16095d[_0xe1a6('0x15')]));});});}; \ No newline at end of file +var _0xd71c=['then','info','SquareRecording,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x19727a,_0x510fbc){var _0x16b4fe=function(_0x4543eb){while(--_0x4543eb){_0x19727a['push'](_0x19727a['shift']());}};_0x16b4fe(++_0x510fbc);}(_0xd71c,0x1ec));var _0xcd71=function(_0x473687,_0x3e8b50){_0x473687=_0x473687-0x0;var _0x47a880=_0xd71c[_0x473687];return _0x47a880;};'use strict';var _=require(_0xcd71('0x0'));var util=require(_0xcd71('0x1'));var moment=require(_0xcd71('0x2'));var BPromise=require(_0xcd71('0x3'));var rs=require(_0xcd71('0x4'));var fs=require('fs');var Redis=require(_0xcd71('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd71('0x6'));var logger=require(_0xcd71('0x7'))(_0xcd71('0x8'));var config=require(_0xcd71('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcd71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14b7ce,_0x394b04,_0x522667){return new BPromise(function(_0x508496,_0x4139e3){return client[_0xcd71('0xb')](_0x14b7ce,_0x522667)[_0xcd71('0xc')](function(_0x94591){logger[_0xcd71('0xd')](_0xcd71('0xe'),_0x394b04,'request\x20sent');logger[_0xcd71('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x394b04,_0xcd71('0x10'),JSON['stringify'](_0x94591));if(_0x94591[_0xcd71('0x11')]){if(_0x94591[_0xcd71('0x11')]['code']===0x1f4){logger[_0xcd71('0x11')](_0xcd71('0xe'),_0x394b04,_0x94591['error'][_0xcd71('0x12')]);return _0x4139e3(_0x94591[_0xcd71('0x11')]['message']);}logger[_0xcd71('0x11')](_0xcd71('0xe'),_0x394b04,_0x94591[_0xcd71('0x11')][_0xcd71('0x12')]);return _0x508496(_0x94591[_0xcd71('0x11')][_0xcd71('0x12')]);}else{logger[_0xcd71('0xd')](_0xcd71('0xe'),_0x394b04,_0xcd71('0x10'));_0x508496(_0x94591[_0xcd71('0x13')][_0xcd71('0x12')]);}})[_0xcd71('0x14')](function(_0x53bbef){logger[_0xcd71('0x11')](_0xcd71('0xe'),_0x394b04,_0x53bbef);_0x4139e3(_0x53bbef);});});}exports['CreateSquareRecording']=function(_0x31a3a5){var _0x518a69=this;return new Promise(function(_0x426168,_0x5c4e9f){return db[_0xcd71('0x15')][_0xcd71('0x16')](_0x31a3a5[_0xcd71('0x17')],{'raw':_0x31a3a5[_0xcd71('0x18')]?_0x31a3a5[_0xcd71('0x18')][_0xcd71('0x19')]===undefined?!![]:![]:!![]})[_0xcd71('0xc')](function(_0x17ac1f){logger[_0xcd71('0xd')](_0xcd71('0x1a'),_0x31a3a5);logger[_0xcd71('0xf')]('CreateSquareRecording',_0x31a3a5,JSON[_0xcd71('0x1b')](_0x17ac1f));_0x426168(_0x17ac1f);})['catch'](function(_0x1f0e0f){logger[_0xcd71('0x11')](_0xcd71('0x1a'),_0x1f0e0f[_0xcd71('0x12')],_0x31a3a5);_0x5c4e9f(_0x518a69[_0xcd71('0x11')](0x1f4,_0x1f0e0f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e544af0..7fb05e4 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(_0x5d9890,_0x50b7bd){var _0x2ed102=function(_0x5f10f5){while(--_0x5f10f5){_0x5d9890['push'](_0x5d9890['shift']());}};_0x2ed102(++_0x50b7bd);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a7d7c,_0x9ae68a){_0x5a7d7c=_0x5a7d7c-0x0;var _0x239238=_0xb10b[_0x5a7d7c];return _0x239238;};'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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x3d477e,_0x455bc0){var _0x5416fa=function(_0x3dad0c){while(--_0x3dad0c){_0x3d477e['push'](_0x3d477e['shift']());}};_0x5416fa(++_0x455bc0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 083b86f..c5377c9 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 _0x5482=['sequelize','exports','STRING','DATE'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5482,0x1c4));var _0x2548=function(_0xea2c75,_0x4bf4bd){_0xea2c75=_0xea2c75-0x0;var _0x2bebca=_0x5482[_0xea2c75];return _0x2bebca;};'use strict';var Sequelize=require(_0x2548('0x0'));module[_0x2548('0x1')]={'network':{'type':Sequelize[_0x2548('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x2548('0x2')]},'channel':{'type':Sequelize[_0x2548('0x2')]},'language':{'type':Sequelize[_0x2548('0x2')]},'type':{'type':Sequelize[_0x2548('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x2548('0x2')]},'callerid':{'type':Sequelize[_0x2548('0x2')]},'calleridname':{'type':Sequelize[_0x2548('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x2548('0x2')]},'callington':{'type':Sequelize[_0x2548('0x2')]},'callingtns':{'type':Sequelize[_0x2548('0x2')]},'dnid':{'type':Sequelize[_0x2548('0x2')]},'rdnis':{'type':Sequelize[_0x2548('0x2')]},'context':{'type':Sequelize[_0x2548('0x2')]},'extension':{'type':Sequelize[_0x2548('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x2548('0x2')]},'project_name':{'type':Sequelize[_0x2548('0x2')]},'joinAt':{'type':Sequelize[_0x2548('0x3')]},'leaveAt':{'type':Sequelize[_0x2548('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbc1d=['exports','STRING','DATE'];(function(_0x14dba8,_0x270e73){var _0x2d1283=function(_0x25120e){while(--_0x25120e){_0x14dba8['push'](_0x14dba8['shift']());}};_0x2d1283(++_0x270e73);}(_0xbc1d,0x19e));var _0xdbc1=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0xbc1d[_0x307086];return _0x699043;};'use strict';var Sequelize=require('sequelize');module[_0xdbc1('0x0')]={'network':{'type':Sequelize[_0xdbc1('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xdbc1('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xdbc1('0x1')]},'callerid':{'type':Sequelize[_0xdbc1('0x1')]},'calleridname':{'type':Sequelize[_0xdbc1('0x1')]},'callingpres':{'type':Sequelize[_0xdbc1('0x1')]},'callingani2':{'type':Sequelize[_0xdbc1('0x1')]},'callington':{'type':Sequelize[_0xdbc1('0x1')]},'callingtns':{'type':Sequelize[_0xdbc1('0x1')]},'dnid':{'type':Sequelize[_0xdbc1('0x1')]},'rdnis':{'type':Sequelize[_0xdbc1('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xdbc1('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdbc1('0x1')]},'threadid':{'type':Sequelize[_0xdbc1('0x1')]},'project_name':{'type':Sequelize[_0xdbc1('0x1')]},'joinAt':{'type':Sequelize[_0xdbc1('0x2')]},'leaveAt':{'type':Sequelize[_0xdbc1('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index c85c290..25f9bc0 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 _0x3cf5=['length','create','body','find','params','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','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/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','error','name','send','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareReport','includeAll','include','rows','catch','show'];(function(_0x4f50e9,_0x2fb1d4){var _0x2d161b=function(_0xb0a6e4){while(--_0xb0a6e4){_0x4f50e9['push'](_0x4f50e9['shift']());}};_0x2d161b(++_0x2fb1d4);}(_0x3cf5,0xdc));var _0x53cf=function(_0x40001a,_0x57f2ae){_0x40001a=_0x40001a-0x0;var _0x4cec45=_0x3cf5[_0x40001a];return _0x4cec45;};'use strict';var emlformat=require(_0x53cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x53cf('0x1'));var jsonpatch=require(_0x53cf('0x2'));var rp=require(_0x53cf('0x3'));var moment=require('moment');var BPromise=require(_0x53cf('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x53cf('0x5'));var csv=require(_0x53cf('0x6'));var ejs=require(_0x53cf('0x7'));var fs=require('fs');var fs_extra=require(_0x53cf('0x8'));var _=require('lodash');var squel=require(_0x53cf('0x9'));var crypto=require(_0x53cf('0xa'));var jsforce=require(_0x53cf('0xb'));var deskjs=require(_0x53cf('0xc'));var toCsv=require(_0x53cf('0x6'));var querystring=require(_0x53cf('0xd'));var Papa=require(_0x53cf('0xe'));var Redis=require(_0x53cf('0xf'));var authService=require(_0x53cf('0x10'));var qs=require(_0x53cf('0x11'));var as=require(_0x53cf('0x12'));var hardwareService=require(_0x53cf('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x53cf('0x14'));var licenseUtil=require(_0x53cf('0x15'));var db=require(_0x53cf('0x16'))['db'];function respondWithStatusCode(_0x1b0908,_0x2cc54e){_0x2cc54e=_0x2cc54e||0xcc;return function(_0x131871){if(_0x131871){return _0x1b0908['sendStatus'](_0x2cc54e);}return _0x1b0908[_0x53cf('0x17')](_0x2cc54e)[_0x53cf('0x18')]();};}function respondWithResult(_0x456bda,_0x127685){_0x127685=_0x127685||0xc8;return function(_0x2465e8){if(_0x2465e8){return _0x456bda['status'](_0x127685)[_0x53cf('0x19')](_0x2465e8);}};}function respondWithFilteredResult(_0x414fcc,_0x5118bc){return function(_0xa26a2a){if(_0xa26a2a){var _0x3af82b=typeof _0x5118bc['offset']===_0x53cf('0x1a')&&typeof _0x5118bc[_0x53cf('0x1b')]===_0x53cf('0x1a');var _0x1c26cc=_0xa26a2a[_0x53cf('0x1c')];var _0x21418b=_0x3af82b?0x0:_0x5118bc[_0x53cf('0x1d')];var _0x5d6f65=_0x3af82b?_0xa26a2a['count']:_0x5118bc[_0x53cf('0x1d')]+_0x5118bc[_0x53cf('0x1b')];var _0x1cfb9f;if(_0x5d6f65>=_0x1c26cc){_0x5d6f65=_0x1c26cc;_0x1cfb9f=0xc8;}else{_0x1cfb9f=0xce;}_0x414fcc[_0x53cf('0x17')](_0x1cfb9f);return _0x414fcc[_0x53cf('0x1e')](_0x53cf('0x1f'),_0x21418b+'-'+_0x5d6f65+'/'+_0x1c26cc)[_0x53cf('0x19')](_0xa26a2a);}return null;};}function patchUpdates(_0x54c206){return function(_0x425138){try{jsonpatch[_0x53cf('0x20')](_0x425138,_0x54c206,!![]);}catch(_0x274f8f){return BPromise['reject'](_0x274f8f);}return _0x425138[_0x53cf('0x21')]();};}function saveUpdates(_0x43ea48,_0x46eb7f){return function(_0x33b751){if(_0x33b751){return _0x33b751['update'](_0x43ea48)[_0x53cf('0x22')](function(_0x34970e){return _0x34970e;});}return null;};}function removeEntity(_0x3cd286,_0x1cf225){return function(_0x57d6b4){if(_0x57d6b4){return _0x57d6b4['destroy']()[_0x53cf('0x22')](function(){_0x3cd286[_0x53cf('0x17')](0xcc)[_0x53cf('0x18')]();});}};}function handleEntityNotFound(_0x9cb7f6,_0x1b3101){return function(_0x218796){if(!_0x218796){_0x9cb7f6['sendStatus'](0x194);}return _0x218796;};}function handleError(_0x4aab18,_0xe6c49){_0xe6c49=_0xe6c49||0x1f4;return function(_0x325fcd){logger[_0x53cf('0x23')](_0x325fcd['stack']);if(_0x325fcd[_0x53cf('0x24')]){delete _0x325fcd[_0x53cf('0x24')];}_0x4aab18[_0x53cf('0x17')](_0xe6c49)[_0x53cf('0x25')](_0x325fcd);};}exports['index']=function(_0x887cea,_0x36e062){var _0x4d409d={},_0x2f6fb6={},_0x3c7ee7={'count':0x0,'rows':[]};var _0x2ff680=_['map'](db['SquareReport'][_0x53cf('0x26')],function(_0x47375a){return{'name':_0x47375a['fieldName'],'type':_0x47375a[_0x53cf('0x27')][_0x53cf('0x28')]};});_0x2f6fb6[_0x53cf('0x29')]=_[_0x53cf('0x2a')](_0x2ff680,_0x53cf('0x24'));_0x2f6fb6[_0x53cf('0x2b')]=_[_0x53cf('0x2c')](_0x887cea[_0x53cf('0x2b')]);_0x2f6fb6[_0x53cf('0x2d')]=_[_0x53cf('0x2e')](_0x2f6fb6[_0x53cf('0x29')],_0x2f6fb6[_0x53cf('0x2b')]);_0x4d409d['attributes']=_[_0x53cf('0x2e')](_0x2f6fb6[_0x53cf('0x29')],qs['fields'](_0x887cea[_0x53cf('0x2b')][_0x53cf('0x2f')]));_0x4d409d['attributes']=_0x4d409d[_0x53cf('0x30')]['length']?_0x4d409d['attributes']:_0x2f6fb6[_0x53cf('0x29')];if(!_0x887cea[_0x53cf('0x2b')][_0x53cf('0x31')]('nolimit')){_0x4d409d[_0x53cf('0x1b')]=qs[_0x53cf('0x1b')](_0x887cea[_0x53cf('0x2b')][_0x53cf('0x1b')]);_0x4d409d['offset']=qs[_0x53cf('0x1d')](_0x887cea[_0x53cf('0x2b')][_0x53cf('0x1d')]);}_0x4d409d[_0x53cf('0x32')]=qs[_0x53cf('0x33')](_0x887cea[_0x53cf('0x2b')][_0x53cf('0x33')]);_0x4d409d[_0x53cf('0x34')]=qs[_0x53cf('0x2d')](_[_0x53cf('0x35')](_0x887cea[_0x53cf('0x2b')],_0x2f6fb6[_0x53cf('0x2d')]),_0x2ff680);if(_0x887cea['query'][_0x53cf('0x36')]){_0x4d409d[_0x53cf('0x34')]=_['merge'](_0x4d409d['where'],{'$or':_['map'](_0x2ff680,function(_0x1f39af){if(_0x1f39af[_0x53cf('0x27')]!==_0x53cf('0x37')){var _0x2de93c={};_0x2de93c[_0x1f39af[_0x53cf('0x24')]]={'$like':'%'+_0x887cea[_0x53cf('0x2b')][_0x53cf('0x36')]+'%'};return _0x2de93c;}})});}_0x4d409d=_[_0x53cf('0x38')]({},_0x4d409d,_0x887cea[_0x53cf('0x39')]);var _0x40c9d6={'where':_0x4d409d[_0x53cf('0x34')]};return db[_0x53cf('0x3a')]['count'](_0x40c9d6)[_0x53cf('0x22')](function(_0x4403f9){_0x3c7ee7['count']=_0x4403f9;if(_0x887cea['query'][_0x53cf('0x3b')]){_0x4d409d[_0x53cf('0x3c')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x4d409d);})[_0x53cf('0x22')](function(_0x11a79d){_0x3c7ee7[_0x53cf('0x3d')]=_0x11a79d;return _0x3c7ee7;})[_0x53cf('0x22')](respondWithFilteredResult(_0x36e062,_0x4d409d))[_0x53cf('0x3e')](handleError(_0x36e062,null));};exports[_0x53cf('0x3f')]=function(_0x4031d0,_0xda101d){var _0x271dba={'raw':!![],'where':{'id':_0x4031d0['params']['id']}},_0x55d8c8={};_0x55d8c8[_0x53cf('0x29')]=_[_0x53cf('0x2c')](db[_0x53cf('0x3a')]['rawAttributes']);_0x55d8c8[_0x53cf('0x2b')]=_['keys'](_0x4031d0[_0x53cf('0x2b')]);_0x55d8c8['filters']=_[_0x53cf('0x2e')](_0x55d8c8[_0x53cf('0x29')],_0x55d8c8[_0x53cf('0x2b')]);_0x271dba['attributes']=_[_0x53cf('0x2e')](_0x55d8c8[_0x53cf('0x29')],qs[_0x53cf('0x2f')](_0x4031d0[_0x53cf('0x2b')][_0x53cf('0x2f')]));_0x271dba[_0x53cf('0x30')]=_0x271dba['attributes'][_0x53cf('0x40')]?_0x271dba[_0x53cf('0x30')]:_0x55d8c8[_0x53cf('0x29')];if(_0x4031d0[_0x53cf('0x2b')][_0x53cf('0x3b')]){_0x271dba['include']=[{'all':!![]}];}_0x271dba=_['merge']({},_0x271dba,_0x4031d0[_0x53cf('0x39')]);return db[_0x53cf('0x3a')]['find'](_0x271dba)[_0x53cf('0x22')](handleEntityNotFound(_0xda101d,null))[_0x53cf('0x22')](respondWithResult(_0xda101d,null))[_0x53cf('0x3e')](handleError(_0xda101d,null));};exports['create']=function(_0x1e591c,_0x1f245b){return db['SquareReport'][_0x53cf('0x41')](_0x1e591c[_0x53cf('0x42')],{})[_0x53cf('0x22')](respondWithResult(_0x1f245b,0xc9))[_0x53cf('0x3e')](handleError(_0x1f245b,null));};exports['update']=function(_0x546e16,_0x50b802){if(_0x546e16[_0x53cf('0x42')]['id']){delete _0x546e16[_0x53cf('0x42')]['id'];}return db[_0x53cf('0x3a')][_0x53cf('0x43')]({'where':{'id':_0x546e16[_0x53cf('0x44')]['id']}})[_0x53cf('0x22')](handleEntityNotFound(_0x50b802,null))['then'](saveUpdates(_0x546e16['body'],null))[_0x53cf('0x22')](respondWithResult(_0x50b802,null))[_0x53cf('0x3e')](handleError(_0x50b802,null));};exports[_0x53cf('0x45')]=function(_0x39a650,_0x243f23){return db[_0x53cf('0x3a')][_0x53cf('0x43')]({'where':{'id':_0x39a650[_0x53cf('0x44')]['id']}})['then'](handleEntityNotFound(_0x243f23,null))[_0x53cf('0x22')](removeEntity(_0x243f23,null))[_0x53cf('0x3e')](handleError(_0x243f23,null));};exports[_0x53cf('0x46')]=function(_0x121c20,_0x97f8a8){return db[_0x53cf('0x3a')][_0x53cf('0x46')]()['then'](respondWithResult(_0x97f8a8,null))[_0x53cf('0x3e')](handleError(_0x97f8a8,null));}; \ No newline at end of file +var _0x78e5=['catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','count','status','set','apply','save','destroy','sendStatus','error','stack','name','send','index','map','SquareReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','then','params','rawAttributes'];(function(_0x412850,_0x1cd659){var _0x10b660=function(_0x5d2c5e){while(--_0x5d2c5e){_0x412850['push'](_0x412850['shift']());}};_0x10b660(++_0x1cd659);}(_0x78e5,0xe9));var _0x578e=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x78e5[_0x279d37];return _0x530173;};'use strict';var emlformat=require(_0x578e('0x0'));var rimraf=require(_0x578e('0x1'));var zipdir=require(_0x578e('0x2'));var jsonpatch=require(_0x578e('0x3'));var rp=require(_0x578e('0x4'));var moment=require(_0x578e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x578e('0x6'));var util=require(_0x578e('0x7'));var path=require(_0x578e('0x8'));var sox=require(_0x578e('0x9'));var csv=require(_0x578e('0xa'));var ejs=require(_0x578e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x578e('0xc'));var crypto=require(_0x578e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x578e('0xe'));var toCsv=require(_0x578e('0xa'));var querystring=require('querystring');var Papa=require(_0x578e('0xf'));var Redis=require(_0x578e('0x10'));var authService=require(_0x578e('0x11'));var qs=require(_0x578e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x578e('0x13'));var logger=require(_0x578e('0x14'))(_0x578e('0x15'));var utils=require(_0x578e('0x16'));var config=require(_0x578e('0x17'));var licenseUtil=require(_0x578e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24d684,_0x1e4e2c){_0x1e4e2c=_0x1e4e2c||0xcc;return function(_0x2750f9){if(_0x2750f9){return _0x24d684['sendStatus'](_0x1e4e2c);}return _0x24d684['status'](_0x1e4e2c)[_0x578e('0x19')]();};}function respondWithResult(_0x3fa8d9,_0x5d833a){_0x5d833a=_0x5d833a||0xc8;return function(_0x3ad54a){if(_0x3ad54a){return _0x3fa8d9['status'](_0x5d833a)[_0x578e('0x1a')](_0x3ad54a);}};}function respondWithFilteredResult(_0xa25718,_0x399c58){return function(_0x2cdc45){if(_0x2cdc45){var _0x392bd5=typeof _0x399c58[_0x578e('0x1b')]===_0x578e('0x1c')&&typeof _0x399c58['limit']===_0x578e('0x1c');var _0x4ab230=_0x2cdc45[_0x578e('0x1d')];var _0x224937=_0x392bd5?0x0:_0x399c58[_0x578e('0x1b')];var _0x2283ff=_0x392bd5?_0x2cdc45[_0x578e('0x1d')]:_0x399c58['offset']+_0x399c58['limit'];var _0x1e0c50;if(_0x2283ff>=_0x4ab230){_0x2283ff=_0x4ab230;_0x1e0c50=0xc8;}else{_0x1e0c50=0xce;}_0xa25718[_0x578e('0x1e')](_0x1e0c50);return _0xa25718[_0x578e('0x1f')]('Content-Range',_0x224937+'-'+_0x2283ff+'/'+_0x4ab230)['json'](_0x2cdc45);}return null;};}function patchUpdates(_0x28eed4){return function(_0x1ebfba){try{jsonpatch[_0x578e('0x20')](_0x1ebfba,_0x28eed4,!![]);}catch(_0x10cc3b){return BPromise['reject'](_0x10cc3b);}return _0x1ebfba[_0x578e('0x21')]();};}function saveUpdates(_0x486d6a,_0x386184){return function(_0x3bf4a8){if(_0x3bf4a8){return _0x3bf4a8['update'](_0x486d6a)['then'](function(_0x2fe2f0){return _0x2fe2f0;});}return null;};}function removeEntity(_0x539935,_0x1a293c){return function(_0x2e489b){if(_0x2e489b){return _0x2e489b[_0x578e('0x22')]()['then'](function(){_0x539935[_0x578e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x149b24,_0x54e8e4){return function(_0x39cc2e){if(!_0x39cc2e){_0x149b24[_0x578e('0x23')](0x194);}return _0x39cc2e;};}function handleError(_0xbbc2fa,_0x3005f6){_0x3005f6=_0x3005f6||0x1f4;return function(_0x175d6c){logger[_0x578e('0x24')](_0x175d6c[_0x578e('0x25')]);if(_0x175d6c[_0x578e('0x26')]){delete _0x175d6c[_0x578e('0x26')];}_0xbbc2fa[_0x578e('0x1e')](_0x3005f6)[_0x578e('0x27')](_0x175d6c);};}exports[_0x578e('0x28')]=function(_0xab2e2d,_0x52ff74){var _0x102157={},_0xcbbb12={},_0x1c3637={'count':0x0,'rows':[]};var _0x2f45e7=_[_0x578e('0x29')](db[_0x578e('0x2a')]['rawAttributes'],function(_0x355d1c){return{'name':_0x355d1c[_0x578e('0x2b')],'type':_0x355d1c[_0x578e('0x2c')][_0x578e('0x2d')]};});_0xcbbb12[_0x578e('0x2e')]=_[_0x578e('0x29')](_0x2f45e7,_0x578e('0x26'));_0xcbbb12['query']=_[_0x578e('0x2f')](_0xab2e2d[_0x578e('0x30')]);_0xcbbb12[_0x578e('0x31')]=_[_0x578e('0x32')](_0xcbbb12[_0x578e('0x2e')],_0xcbbb12[_0x578e('0x30')]);_0x102157[_0x578e('0x33')]=_[_0x578e('0x32')](_0xcbbb12['model'],qs[_0x578e('0x34')](_0xab2e2d['query']['fields']));_0x102157[_0x578e('0x33')]=_0x102157['attributes'][_0x578e('0x35')]?_0x102157[_0x578e('0x33')]:_0xcbbb12[_0x578e('0x2e')];if(!_0xab2e2d[_0x578e('0x30')][_0x578e('0x36')]('nolimit')){_0x102157[_0x578e('0x37')]=qs[_0x578e('0x37')](_0xab2e2d[_0x578e('0x30')][_0x578e('0x37')]);_0x102157[_0x578e('0x1b')]=qs[_0x578e('0x1b')](_0xab2e2d['query'][_0x578e('0x1b')]);}_0x102157[_0x578e('0x38')]=qs[_0x578e('0x39')](_0xab2e2d[_0x578e('0x30')][_0x578e('0x39')]);_0x102157[_0x578e('0x3a')]=qs['filters'](_[_0x578e('0x3b')](_0xab2e2d[_0x578e('0x30')],_0xcbbb12['filters']),_0x2f45e7);if(_0xab2e2d[_0x578e('0x30')]['filter']){_0x102157[_0x578e('0x3a')]=_['merge'](_0x102157[_0x578e('0x3a')],{'$or':_[_0x578e('0x29')](_0x2f45e7,function(_0x8ddcf8){if(_0x8ddcf8[_0x578e('0x2c')]!==_0x578e('0x3c')){var _0x10daa9={};_0x10daa9[_0x8ddcf8['name']]={'$like':'%'+_0xab2e2d['query'][_0x578e('0x3d')]+'%'};return _0x10daa9;}})});}_0x102157=_[_0x578e('0x3e')]({},_0x102157,_0xab2e2d[_0x578e('0x3f')]);var _0x422bea={'where':_0x102157[_0x578e('0x3a')]};return db['SquareReport']['count'](_0x422bea)['then'](function(_0x171946){_0x1c3637[_0x578e('0x1d')]=_0x171946;if(_0xab2e2d[_0x578e('0x30')][_0x578e('0x40')]){_0x102157[_0x578e('0x41')]=[{'all':!![]}];}return db[_0x578e('0x2a')][_0x578e('0x42')](_0x102157);})['then'](function(_0x4c6561){_0x1c3637[_0x578e('0x43')]=_0x4c6561;return _0x1c3637;})[_0x578e('0x44')](respondWithFilteredResult(_0x52ff74,_0x102157))['catch'](handleError(_0x52ff74,null));};exports['show']=function(_0x137b74,_0x53e864){var _0x22ac56={'raw':!![],'where':{'id':_0x137b74[_0x578e('0x45')]['id']}},_0x551c37={};_0x551c37[_0x578e('0x2e')]=_[_0x578e('0x2f')](db[_0x578e('0x2a')][_0x578e('0x46')]);_0x551c37[_0x578e('0x30')]=_[_0x578e('0x2f')](_0x137b74[_0x578e('0x30')]);_0x551c37[_0x578e('0x31')]=_[_0x578e('0x32')](_0x551c37[_0x578e('0x2e')],_0x551c37[_0x578e('0x30')]);_0x22ac56[_0x578e('0x33')]=_[_0x578e('0x32')](_0x551c37[_0x578e('0x2e')],qs[_0x578e('0x34')](_0x137b74['query']['fields']));_0x22ac56['attributes']=_0x22ac56[_0x578e('0x33')]['length']?_0x22ac56['attributes']:_0x551c37[_0x578e('0x2e')];if(_0x137b74[_0x578e('0x30')][_0x578e('0x40')]){_0x22ac56[_0x578e('0x41')]=[{'all':!![]}];}_0x22ac56=_[_0x578e('0x3e')]({},_0x22ac56,_0x137b74[_0x578e('0x3f')]);return db[_0x578e('0x2a')]['find'](_0x22ac56)['then'](handleEntityNotFound(_0x53e864,null))[_0x578e('0x44')](respondWithResult(_0x53e864,null))[_0x578e('0x47')](handleError(_0x53e864,null));};exports[_0x578e('0x48')]=function(_0x331f32,_0x4478b7){return db[_0x578e('0x2a')][_0x578e('0x48')](_0x331f32[_0x578e('0x49')],{})['then'](respondWithResult(_0x4478b7,0xc9))['catch'](handleError(_0x4478b7,null));};exports['update']=function(_0x3e56ab,_0x2d621c){if(_0x3e56ab[_0x578e('0x49')]['id']){delete _0x3e56ab[_0x578e('0x49')]['id'];}return db[_0x578e('0x2a')][_0x578e('0x4a')]({'where':{'id':_0x3e56ab[_0x578e('0x45')]['id']}})[_0x578e('0x44')](handleEntityNotFound(_0x2d621c,null))[_0x578e('0x44')](saveUpdates(_0x3e56ab['body'],null))[_0x578e('0x44')](respondWithResult(_0x2d621c,null))[_0x578e('0x47')](handleError(_0x2d621c,null));};exports[_0x578e('0x22')]=function(_0x1c0f8c,_0xf2c53e){return db[_0x578e('0x2a')][_0x578e('0x4a')]({'where':{'id':_0x1c0f8c['params']['id']}})['then'](handleEntityNotFound(_0xf2c53e,null))['then'](removeEntity(_0xf2c53e,null))[_0x578e('0x47')](handleError(_0xf2c53e,null));};exports[_0x578e('0x4b')]=function(_0x1d9934,_0xfe74e6){return db[_0x578e('0x2a')][_0x578e('0x4b')]()['then'](respondWithResult(_0xfe74e6,null))[_0x578e('0x47')](handleError(_0xfe74e6,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index a7fe844..ef81585 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 _0x911e=['moment','request-promise','path','../../config/environment','./squareReport.attributes','define','uid_pname','uniqueid','project_name','leaveAt','../../config/logger','api'];(function(_0x44c77f,_0x38a21f){var _0x3dc34d=function(_0x541860){while(--_0x541860){_0x44c77f['push'](_0x44c77f['shift']());}};_0x3dc34d(++_0x38a21f);}(_0x911e,0xb2));var _0xe911=function(_0x591072,_0x3f8708){_0x591072=_0x591072-0x0;var _0x5cc4a9=_0x911e[_0x591072];return _0x5cc4a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe911('0x0'))(_0xe911('0x1'));var moment=require(_0xe911('0x2'));var BPromise=require('bluebird');var rp=require(_0xe911('0x3'));var fs=require('fs');var path=require(_0xe911('0x4'));var rimraf=require('rimraf');var config=require(_0xe911('0x5'));var attributes=require(_0xe911('0x6'));module['exports']=function(_0x19a01b,_0x107698){return _0x19a01b[_0xe911('0x7')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xe911('0x8'),'fields':[_0xe911('0x9'),_0xe911('0xa')]},{'name':_0xe911('0xb'),'fields':[_0xe911('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc7cc=['define','SquareReport','report_square','uniqueid','project_name','leaveAt','util','../../config/logger','api','request-promise','path','./squareReport.attributes'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xc7cc,0x11a));var _0xcc7c=function(_0x10c3f1,_0x563147){_0x10c3f1=_0x10c3f1-0x0;var _0x1c9653=_0xc7cc[_0x10c3f1];return _0x1c9653;};'use strict';var _=require('lodash');var util=require(_0xcc7c('0x0'));var logger=require(_0xcc7c('0x1'))(_0xcc7c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcc7c('0x3'));var fs=require('fs');var path=require(_0xcc7c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcc7c('0x5'));module['exports']=function(_0x101b2a,_0x354390){return _0x101b2a[_0xcc7c('0x6')](_0xcc7c('0x7'),attributes,{'tableName':_0xcc7c('0x8'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xcc7c('0x9'),_0xcc7c('0xa')]},{'name':_0xcc7c('0xb'),'fields':[_0xcc7c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index a671732..0e882db 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 _0x7237=['where','attributes','limit','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','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','catch','CreateSquareReport','create','body','options','raw','SquareReport','update'];(function(_0x47fcd7,_0x22ea00){var _0x1cd336=function(_0x1a6802){while(--_0x1a6802){_0x47fcd7['push'](_0x47fcd7['shift']());}};_0x1cd336(++_0x22ea00);}(_0x7237,0xf9));var _0x7723=function(_0xc7fac3,_0x4f8853){_0xc7fac3=_0xc7fac3-0x0;var _0x1007c3=_0x7237[_0xc7fac3];return _0x1007c3;};'use strict';var _=require(_0x7723('0x0'));var util=require(_0x7723('0x1'));var moment=require(_0x7723('0x2'));var BPromise=require(_0x7723('0x3'));var rs=require(_0x7723('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7723('0x5'))['db'];var utils=require(_0x7723('0x6'));var logger=require('../../config/logger')(_0x7723('0x7'));var config=require(_0x7723('0x8'));var jayson=require(_0x7723('0x9'));var client=jayson[_0x7723('0xa')][_0x7723('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29fd31,_0x4e6156,_0x326617){return new BPromise(function(_0x3b352c,_0x2f4d8a){return client[_0x7723('0xc')](_0x29fd31,_0x326617)[_0x7723('0xd')](function(_0x91f9f2){logger[_0x7723('0xe')](_0x7723('0xf'),_0x4e6156,'request\x20sent');logger[_0x7723('0x10')](_0x7723('0x11'),_0x4e6156,_0x7723('0x12'),JSON[_0x7723('0x13')](_0x91f9f2));if(_0x91f9f2[_0x7723('0x14')]){if(_0x91f9f2['error'][_0x7723('0x15')]===0x1f4){logger[_0x7723('0x14')](_0x7723('0xf'),_0x4e6156,_0x91f9f2[_0x7723('0x14')][_0x7723('0x16')]);return _0x2f4d8a(_0x91f9f2[_0x7723('0x14')][_0x7723('0x16')]);}logger[_0x7723('0x14')]('SquareReport,\x20%s,\x20%s',_0x4e6156,_0x91f9f2['error']['message']);return _0x3b352c(_0x91f9f2[_0x7723('0x14')]['message']);}else{logger[_0x7723('0xe')](_0x7723('0xf'),_0x4e6156,'request\x20sent');_0x3b352c(_0x91f9f2['result']['message']);}})[_0x7723('0x17')](function(_0x445107){logger['error'](_0x7723('0xf'),_0x4e6156,_0x445107);_0x2f4d8a(_0x445107);});});}exports[_0x7723('0x18')]=function(_0xa0d89d){var _0x4ce1bc=this;return new Promise(function(_0x3b1802,_0x4ec1fd){return db['SquareReport'][_0x7723('0x19')](_0xa0d89d[_0x7723('0x1a')],{'raw':_0xa0d89d[_0x7723('0x1b')]?_0xa0d89d[_0x7723('0x1b')][_0x7723('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4a23ae){logger['info'](_0x7723('0x18'),_0xa0d89d);logger[_0x7723('0x10')](_0x7723('0x18'),_0xa0d89d,JSON['stringify'](_0x4a23ae));_0x3b1802(_0x4a23ae);})[_0x7723('0x17')](function(_0x583d66){logger[_0x7723('0x14')](_0x7723('0x18'),_0x583d66[_0x7723('0x16')],_0xa0d89d);_0x4ec1fd(_0x4ce1bc[_0x7723('0x14')](0x1f4,_0x583d66[_0x7723('0x16')]));});});};exports['UpdateSquareReport']=function(_0x57668c){var _0x402496=this;return new Promise(function(_0x5498d4,_0x168203){return db[_0x7723('0x1d')][_0x7723('0x1e')](_0x57668c[_0x7723('0x1a')],{'raw':_0x57668c[_0x7723('0x1b')]?_0x57668c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57668c[_0x7723('0x1b')]?_0x57668c[_0x7723('0x1b')][_0x7723('0x1f')]||null:null,'attributes':_0x57668c[_0x7723('0x1b')]?_0x57668c[_0x7723('0x1b')][_0x7723('0x20')]||null:null,'limit':_0x57668c[_0x7723('0x1b')]?_0x57668c[_0x7723('0x1b')][_0x7723('0x21')]||null:null})['then'](function(_0x302f64){logger[_0x7723('0xe')](_0x7723('0x22'),_0x57668c);logger[_0x7723('0x10')](_0x7723('0x22'),_0x57668c,JSON['stringify'](_0x302f64));_0x5498d4(_0x302f64);})[_0x7723('0x17')](function(_0xd87738){logger['error']('UpdateSquareReport',_0xd87738[_0x7723('0x16')],_0x57668c);_0x168203(_0x402496[_0x7723('0x14')](0x1f4,_0xd87738[_0x7723('0x16')]));});});}; \ No newline at end of file +var _0x94a1=['UpdateSquareReport','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw'];(function(_0x547a6b,_0x2262ab){var _0x2e707f=function(_0x39ce0e){while(--_0x39ce0e){_0x547a6b['push'](_0x547a6b['shift']());}};_0x2e707f(++_0x2262ab);}(_0x94a1,0x10c));var _0x194a=function(_0x4d3552,_0x3de3ba){_0x4d3552=_0x4d3552-0x0;var _0x5aabf7=_0x94a1[_0x4d3552];return _0x5aabf7;};'use strict';var _=require(_0x194a('0x0'));var util=require(_0x194a('0x1'));var moment=require(_0x194a('0x2'));var BPromise=require('bluebird');var rs=require(_0x194a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x194a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x194a('0x5'))(_0x194a('0x6'));var config=require(_0x194a('0x7'));var jayson=require(_0x194a('0x8'));var client=jayson[_0x194a('0x9')][_0x194a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ba38f,_0x446585,_0x804777){return new BPromise(function(_0x8d3e85,_0x5ba03a){return client[_0x194a('0xb')](_0x4ba38f,_0x804777)[_0x194a('0xc')](function(_0x59995a){logger[_0x194a('0xd')](_0x194a('0xe'),_0x446585,_0x194a('0xf'));logger[_0x194a('0x10')](_0x194a('0x11'),_0x446585,'request\x20sent',JSON[_0x194a('0x12')](_0x59995a));if(_0x59995a[_0x194a('0x13')]){if(_0x59995a[_0x194a('0x13')]['code']===0x1f4){logger[_0x194a('0x13')]('SquareReport,\x20%s,\x20%s',_0x446585,_0x59995a[_0x194a('0x13')][_0x194a('0x14')]);return _0x5ba03a(_0x59995a['error'][_0x194a('0x14')]);}logger['error'](_0x194a('0xe'),_0x446585,_0x59995a[_0x194a('0x13')][_0x194a('0x14')]);return _0x8d3e85(_0x59995a[_0x194a('0x13')]['message']);}else{logger[_0x194a('0xd')](_0x194a('0xe'),_0x446585,_0x194a('0xf'));_0x8d3e85(_0x59995a[_0x194a('0x15')][_0x194a('0x14')]);}})[_0x194a('0x16')](function(_0x478fd3){logger[_0x194a('0x13')](_0x194a('0xe'),_0x446585,_0x478fd3);_0x5ba03a(_0x478fd3);});});}exports[_0x194a('0x17')]=function(_0x42668a){var _0x537e15=this;return new Promise(function(_0x3be23b,_0x80fd){return db[_0x194a('0x18')][_0x194a('0x19')](_0x42668a[_0x194a('0x1a')],{'raw':_0x42668a['options']?_0x42668a[_0x194a('0x1b')][_0x194a('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x137710){logger[_0x194a('0xd')]('CreateSquareReport',_0x42668a);logger[_0x194a('0x10')](_0x194a('0x17'),_0x42668a,JSON[_0x194a('0x12')](_0x137710));_0x3be23b(_0x137710);})['catch'](function(_0x197b58){logger[_0x194a('0x13')]('CreateSquareReport',_0x197b58[_0x194a('0x14')],_0x42668a);_0x80fd(_0x537e15[_0x194a('0x13')](0x1f4,_0x197b58[_0x194a('0x14')]));});});};exports[_0x194a('0x1d')]=function(_0x57b8bf){var _0x4adf11=this;return new Promise(function(_0x1441f1,_0x184aad){return db[_0x194a('0x18')]['update'](_0x57b8bf[_0x194a('0x1a')],{'raw':_0x57b8bf[_0x194a('0x1b')]?_0x57b8bf[_0x194a('0x1b')][_0x194a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57b8bf[_0x194a('0x1b')]?_0x57b8bf['options'][_0x194a('0x1e')]||null:null,'attributes':_0x57b8bf[_0x194a('0x1b')]?_0x57b8bf['options'][_0x194a('0x1f')]||null:null,'limit':_0x57b8bf[_0x194a('0x1b')]?_0x57b8bf[_0x194a('0x1b')][_0x194a('0x20')]||null:null})[_0x194a('0xc')](function(_0x38c9ae){logger[_0x194a('0xd')](_0x194a('0x1d'),_0x57b8bf);logger['debug'](_0x194a('0x1d'),_0x57b8bf,JSON[_0x194a('0x12')](_0x38c9ae));_0x1441f1(_0x38c9ae);})['catch'](function(_0x45f7d5){logger['error']('UpdateSquareReport',_0x45f7d5[_0x194a('0x14')],_0x57b8bf);_0x184aad(_0x4adf11['error'](0x1f4,_0x45f7d5[_0x194a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 23adcfa..bd3c301 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 _0x9b12=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','exports','multer'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x9b12,0x1f3));var _0x29b1=function(_0x4c0eb5,_0x3c4113){_0x4c0eb5=_0x4c0eb5-0x0;var _0xd9d09a=_0x9b12[_0x4c0eb5];return _0xd9d09a;};'use strict';var multer=require(_0x29b1('0x0'));var util=require('util');var path=require(_0x29b1('0x1'));var timeout=require(_0x29b1('0x2'));var express=require(_0x29b1('0x3'));var router=express[_0x29b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x29b1('0x5'));var interaction=require(_0x29b1('0x6'));var config=require(_0x29b1('0x7'));var controller=require(_0x29b1('0x8'));router['get']('/',auth[_0x29b1('0x9')](),controller['index']);router[_0x29b1('0xa')](_0x29b1('0xb'),auth[_0x29b1('0x9')](),controller[_0x29b1('0xc')]);router[_0x29b1('0xa')](_0x29b1('0xd'),auth['isAuthenticated'](),controller[_0x29b1('0xe')]);router[_0x29b1('0xf')]('/',auth[_0x29b1('0x9')](),controller[_0x29b1('0x10')]);router[_0x29b1('0x11')](_0x29b1('0xd'),auth['isAuthenticated'](),controller[_0x29b1('0x12')]);router['delete'](_0x29b1('0xd'),auth[_0x29b1('0x9')](),controller['destroy']);module[_0x29b1('0x13')]=router; \ No newline at end of file +var _0xe10b=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x549d13,_0x9f7df2){var _0x40a774=function(_0x3e5403){while(--_0x3e5403){_0x549d13['push'](_0x549d13['shift']());}};_0x40a774(++_0x9f7df2);}(_0xe10b,0x153));var _0xbe10=function(_0x8c1909,_0x2c9953){_0x8c1909=_0x8c1909-0x0;var _0x5d7740=_0xe10b[_0x8c1909];return _0x5d7740;};'use strict';var multer=require(_0xbe10('0x0'));var util=require(_0xbe10('0x1'));var path=require(_0xbe10('0x2'));var timeout=require(_0xbe10('0x3'));var express=require(_0xbe10('0x4'));var router=express[_0xbe10('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbe10('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbe10('0x7'));var controller=require(_0xbe10('0x8'));router['get']('/',auth[_0xbe10('0x9')](),controller[_0xbe10('0xa')]);router[_0xbe10('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xbe10('0xb')](_0xbe10('0xc'),auth[_0xbe10('0x9')](),controller[_0xbe10('0xd')]);router[_0xbe10('0xe')]('/',auth[_0xbe10('0x9')](),controller[_0xbe10('0xf')]);router[_0xbe10('0x10')](_0xbe10('0xc'),auth['isAuthenticated'](),controller[_0xbe10('0x11')]);router[_0xbe10('0x12')](_0xbe10('0xc'),auth[_0xbe10('0x9')](),controller['destroy']);module[_0xbe10('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 b4d7ba9..2df6f35 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 _0x6688=['sequelize','exports','STRING','TEXT'];(function(_0x193e24,_0x4f1a87){var _0x180faa=function(_0x300018){while(--_0x300018){_0x193e24['push'](_0x193e24['shift']());}};_0x180faa(++_0x4f1a87);}(_0x6688,0x144));var _0x8668=function(_0x53c5de,_0xcd224d){_0x53c5de=_0x53c5de-0x0;var _0x531268=_0x6688[_0x53c5de];return _0x531268;};'use strict';var Sequelize=require(_0x8668('0x0'));module[_0x8668('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x8668('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x8668('0x3')]},'project_name':{'type':Sequelize[_0x8668('0x2')]},'callerid':{'type':Sequelize[_0x8668('0x2')]}}; \ No newline at end of file +var _0x3730=['STRING','sequelize','exports'];(function(_0x565060,_0x5ac753){var _0xe6e453=function(_0x1239e0){while(--_0x1239e0){_0x565060['push'](_0x565060['shift']());}};_0xe6e453(++_0x5ac753);}(_0x3730,0xe5));var _0x0373=function(_0x52f815,_0x472b14){_0x52f815=_0x52f815-0x0;var _0x197430=_0x3730[_0x52f815];return _0x197430;};'use strict';var Sequelize=require(_0x0373('0x0'));module[_0x0373('0x1')]={'uniqueid':{'type':Sequelize[_0x0373('0x2')]},'node':{'type':Sequelize[_0x0373('0x2')]},'application':{'type':Sequelize[_0x0373('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x0373('0x2')]},'callerid':{'type':Sequelize[_0x0373('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 0390f36..144c894 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 _0x00a6=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x47dcc0,_0x5edde8){var _0x2fbda0=function(_0x474708){while(--_0x474708){_0x47dcc0['push'](_0x47dcc0['shift']());}};_0x2fbda0(++_0x5edde8);}(_0x00a6,0xfb));var _0x600a=function(_0x2a306d,_0x584ef6){_0x2a306d=_0x2a306d-0x0;var _0x35b96f=_0x00a6[_0x2a306d];return _0x35b96f;};'use strict';var emlformat=require(_0x600a('0x0'));var rimraf=require(_0x600a('0x1'));var zipdir=require(_0x600a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x600a('0x3'));var moment=require('moment');var BPromise=require(_0x600a('0x4'));var Mustache=require(_0x600a('0x5'));var util=require(_0x600a('0x6'));var path=require(_0x600a('0x7'));var sox=require('sox');var csv=require(_0x600a('0x8'));var ejs=require(_0x600a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x600a('0xa'));var squel=require(_0x600a('0xb'));var crypto=require(_0x600a('0xc'));var jsforce=require(_0x600a('0xd'));var deskjs=require(_0x600a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x600a('0xf'));var Papa=require(_0x600a('0x10'));var Redis=require(_0x600a('0x11'));var authService=require(_0x600a('0x12'));var qs=require(_0x600a('0x13'));var as=require(_0x600a('0x14'));var hardwareService=require(_0x600a('0x15'));var logger=require(_0x600a('0x16'))(_0x600a('0x17'));var utils=require(_0x600a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x600a('0x19'));var db=require(_0x600a('0x1a'))['db'];function respondWithStatusCode(_0x481248,_0x461154){_0x461154=_0x461154||0xcc;return function(_0x2c6be6){if(_0x2c6be6){return _0x481248[_0x600a('0x1b')](_0x461154);}return _0x481248[_0x600a('0x1c')](_0x461154)[_0x600a('0x1d')]();};}function respondWithResult(_0x9af23e,_0x2ed41e){_0x2ed41e=_0x2ed41e||0xc8;return function(_0x46d44d){if(_0x46d44d){return _0x9af23e[_0x600a('0x1c')](_0x2ed41e)[_0x600a('0x1e')](_0x46d44d);}};}function respondWithFilteredResult(_0x593ab7,_0x4151c2){return function(_0x1e7be1){if(_0x1e7be1){var _0x385156=typeof _0x4151c2[_0x600a('0x1f')]===_0x600a('0x20')&&typeof _0x4151c2[_0x600a('0x21')]==='undefined';var _0x50ec46=_0x1e7be1['count'];var _0x157117=_0x385156?0x0:_0x4151c2[_0x600a('0x1f')];var _0x5d6f7b=_0x385156?_0x1e7be1[_0x600a('0x22')]:_0x4151c2[_0x600a('0x1f')]+_0x4151c2[_0x600a('0x21')];var _0xdfbac2;if(_0x5d6f7b>=_0x50ec46){_0x5d6f7b=_0x50ec46;_0xdfbac2=0xc8;}else{_0xdfbac2=0xce;}_0x593ab7[_0x600a('0x1c')](_0xdfbac2);return _0x593ab7[_0x600a('0x23')](_0x600a('0x24'),_0x157117+'-'+_0x5d6f7b+'/'+_0x50ec46)[_0x600a('0x1e')](_0x1e7be1);}return null;};}function patchUpdates(_0x3f0e62){return function(_0x3a8bfe){try{jsonpatch['apply'](_0x3a8bfe,_0x3f0e62,!![]);}catch(_0x1bac39){return BPromise[_0x600a('0x25')](_0x1bac39);}return _0x3a8bfe[_0x600a('0x26')]();};}function saveUpdates(_0x58b12c,_0x3d3d47){return function(_0x15a020){if(_0x15a020){return _0x15a020['update'](_0x58b12c)[_0x600a('0x27')](function(_0x166c56){return _0x166c56;});}return null;};}function removeEntity(_0x1a17ad,_0x38ae1e){return function(_0x531371){if(_0x531371){return _0x531371[_0x600a('0x28')]()[_0x600a('0x27')](function(){_0x1a17ad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e00db,_0x4a007e){return function(_0x5e906d){if(!_0x5e906d){_0x1e00db['sendStatus'](0x194);}return _0x5e906d;};}function handleError(_0x12791c,_0x5f4e1b){_0x5f4e1b=_0x5f4e1b||0x1f4;return function(_0x4d2634){logger[_0x600a('0x29')](_0x4d2634['stack']);if(_0x4d2634[_0x600a('0x2a')]){delete _0x4d2634['name'];}_0x12791c[_0x600a('0x1c')](_0x5f4e1b)['send'](_0x4d2634);};}exports[_0x600a('0x2b')]=function(_0x4007ea,_0xf25087){var _0x412415={},_0x53bac9={},_0x35de26={'count':0x0,'rows':[]};var _0x22b89d=_[_0x600a('0x2c')](db[_0x600a('0x2d')][_0x600a('0x2e')],function(_0x542421){return{'name':_0x542421[_0x600a('0x2f')],'type':_0x542421[_0x600a('0x30')][_0x600a('0x31')]};});_0x53bac9[_0x600a('0x32')]=_[_0x600a('0x2c')](_0x22b89d,_0x600a('0x2a'));_0x53bac9['query']=_[_0x600a('0x33')](_0x4007ea[_0x600a('0x34')]);_0x53bac9[_0x600a('0x35')]=_['intersection'](_0x53bac9[_0x600a('0x32')],_0x53bac9[_0x600a('0x34')]);_0x412415['attributes']=_[_0x600a('0x36')](_0x53bac9[_0x600a('0x32')],qs[_0x600a('0x37')](_0x4007ea[_0x600a('0x34')][_0x600a('0x37')]));_0x412415[_0x600a('0x38')]=_0x412415[_0x600a('0x38')][_0x600a('0x39')]?_0x412415[_0x600a('0x38')]:_0x53bac9[_0x600a('0x32')];if(!_0x4007ea[_0x600a('0x34')][_0x600a('0x3a')](_0x600a('0x3b'))){_0x412415[_0x600a('0x21')]=qs[_0x600a('0x21')](_0x4007ea['query']['limit']);_0x412415[_0x600a('0x1f')]=qs[_0x600a('0x1f')](_0x4007ea[_0x600a('0x34')]['offset']);}_0x412415[_0x600a('0x3c')]=qs[_0x600a('0x3d')](_0x4007ea[_0x600a('0x34')][_0x600a('0x3d')]);_0x412415[_0x600a('0x3e')]=qs[_0x600a('0x35')](_[_0x600a('0x3f')](_0x4007ea[_0x600a('0x34')],_0x53bac9[_0x600a('0x35')]),_0x22b89d);if(_0x4007ea[_0x600a('0x34')][_0x600a('0x40')]){_0x412415['where']=_[_0x600a('0x41')](_0x412415[_0x600a('0x3e')],{'$or':_['map'](_0x22b89d,function(_0x10356f){if(_0x10356f['type']!==_0x600a('0x42')){var _0x5f5419={};_0x5f5419[_0x10356f[_0x600a('0x2a')]]={'$like':'%'+_0x4007ea['query'][_0x600a('0x40')]+'%'};return _0x5f5419;}})});}_0x412415=_[_0x600a('0x41')]({},_0x412415,_0x4007ea[_0x600a('0x43')]);var _0x373f22={'where':_0x412415[_0x600a('0x3e')]};return db[_0x600a('0x2d')]['count'](_0x373f22)[_0x600a('0x27')](function(_0x44b7f1){_0x35de26['count']=_0x44b7f1;if(_0x4007ea[_0x600a('0x34')][_0x600a('0x44')]){_0x412415[_0x600a('0x45')]=[{'all':!![]}];}return db[_0x600a('0x2d')]['findAll'](_0x412415);})[_0x600a('0x27')](function(_0xa4c625){_0x35de26[_0x600a('0x46')]=_0xa4c625;return _0x35de26;})[_0x600a('0x27')](respondWithFilteredResult(_0xf25087,_0x412415))[_0x600a('0x47')](handleError(_0xf25087,null));};exports[_0x600a('0x48')]=function(_0x2158fb,_0x586414){var _0x4bb7f2={'raw':!![],'where':{'id':_0x2158fb[_0x600a('0x49')]['id']}},_0x1b18e7={};_0x1b18e7[_0x600a('0x32')]=_[_0x600a('0x33')](db[_0x600a('0x2d')][_0x600a('0x2e')]);_0x1b18e7[_0x600a('0x34')]=_[_0x600a('0x33')](_0x2158fb[_0x600a('0x34')]);_0x1b18e7['filters']=_[_0x600a('0x36')](_0x1b18e7[_0x600a('0x32')],_0x1b18e7['query']);_0x4bb7f2['attributes']=_[_0x600a('0x36')](_0x1b18e7[_0x600a('0x32')],qs[_0x600a('0x37')](_0x2158fb['query'][_0x600a('0x37')]));_0x4bb7f2[_0x600a('0x38')]=_0x4bb7f2[_0x600a('0x38')]['length']?_0x4bb7f2[_0x600a('0x38')]:_0x1b18e7[_0x600a('0x32')];if(_0x2158fb[_0x600a('0x34')][_0x600a('0x44')]){_0x4bb7f2[_0x600a('0x45')]=[{'all':!![]}];}_0x4bb7f2=_['merge']({},_0x4bb7f2,_0x2158fb[_0x600a('0x43')]);return db[_0x600a('0x2d')][_0x600a('0x4a')](_0x4bb7f2)[_0x600a('0x27')](handleEntityNotFound(_0x586414,null))[_0x600a('0x27')](respondWithResult(_0x586414,null))['catch'](handleError(_0x586414,null));};exports[_0x600a('0x4b')]=function(_0x368698,_0x2ad8e7){return db['SquareDetailsReport'][_0x600a('0x4b')](_0x368698['body'],{})['then'](respondWithResult(_0x2ad8e7,0xc9))['catch'](handleError(_0x2ad8e7,null));};exports[_0x600a('0x4c')]=function(_0x47751f,_0xed67cf){if(_0x47751f['body']['id']){delete _0x47751f[_0x600a('0x4d')]['id'];}return db['SquareDetailsReport'][_0x600a('0x4a')]({'where':{'id':_0x47751f['params']['id']}})[_0x600a('0x27')](handleEntityNotFound(_0xed67cf,null))['then'](saveUpdates(_0x47751f[_0x600a('0x4d')],null))[_0x600a('0x27')](respondWithResult(_0xed67cf,null))['catch'](handleError(_0xed67cf,null));};exports[_0x600a('0x28')]=function(_0x2c5502,_0x1beab1){return db[_0x600a('0x2d')][_0x600a('0x4a')]({'where':{'id':_0x2c5502[_0x600a('0x49')]['id']}})[_0x600a('0x27')](handleEntityNotFound(_0x1beab1,null))[_0x600a('0x27')](removeEntity(_0x1beab1,null))[_0x600a('0x47')](handleError(_0x1beab1,null));};exports[_0x600a('0x4e')]=function(_0x195bf8,_0x3ee172){return db[_0x600a('0x2d')][_0x600a('0x4e')]()[_0x600a('0x27')](respondWithResult(_0x3ee172,null))['catch'](handleError(_0x3ee172,null));}; \ No newline at end of file +var _0xcb2e=['update','then','destroy','name','send','map','SquareDetailsReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x5f4606,_0xdfa5cd){var _0x644983=function(_0x4d13b1){while(--_0x4d13b1){_0x5f4606['push'](_0x5f4606['shift']());}};_0x644983(++_0xdfa5cd);}(_0xcb2e,0x1e8));var _0xecb2=function(_0x3f9033,_0x171e08){_0x3f9033=_0x3f9033-0x0;var _0x2818b6=_0xcb2e[_0x3f9033];return _0x2818b6;};'use strict';var emlformat=require(_0xecb2('0x0'));var rimraf=require(_0xecb2('0x1'));var zipdir=require(_0xecb2('0x2'));var jsonpatch=require(_0xecb2('0x3'));var rp=require(_0xecb2('0x4'));var moment=require(_0xecb2('0x5'));var BPromise=require(_0xecb2('0x6'));var Mustache=require('mustache');var util=require(_0xecb2('0x7'));var path=require(_0xecb2('0x8'));var sox=require('sox');var csv=require(_0xecb2('0x9'));var ejs=require(_0xecb2('0xa'));var fs=require('fs');var fs_extra=require(_0xecb2('0xb'));var _=require(_0xecb2('0xc'));var squel=require(_0xecb2('0xd'));var crypto=require('crypto');var jsforce=require(_0xecb2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xecb2('0x9'));var querystring=require(_0xecb2('0xf'));var Papa=require(_0xecb2('0x10'));var Redis=require(_0xecb2('0x11'));var authService=require(_0xecb2('0x12'));var qs=require(_0xecb2('0x13'));var as=require(_0xecb2('0x14'));var hardwareService=require(_0xecb2('0x15'));var logger=require(_0xecb2('0x16'))(_0xecb2('0x17'));var utils=require(_0xecb2('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xecb2('0x19'))['db'];function respondWithStatusCode(_0x2f88e7,_0x443fc2){_0x443fc2=_0x443fc2||0xcc;return function(_0x30f1b6){if(_0x30f1b6){return _0x2f88e7[_0xecb2('0x1a')](_0x443fc2);}return _0x2f88e7['status'](_0x443fc2)[_0xecb2('0x1b')]();};}function respondWithResult(_0x11f52b,_0x2b6574){_0x2b6574=_0x2b6574||0xc8;return function(_0x3cac3e){if(_0x3cac3e){return _0x11f52b[_0xecb2('0x1c')](_0x2b6574)[_0xecb2('0x1d')](_0x3cac3e);}};}function respondWithFilteredResult(_0x1c8280,_0x369cd1){return function(_0x57b7e4){if(_0x57b7e4){var _0x2818f4=typeof _0x369cd1['offset']==='undefined'&&typeof _0x369cd1[_0xecb2('0x1e')]==='undefined';var _0x1b880e=_0x57b7e4[_0xecb2('0x1f')];var _0x1ebf5c=_0x2818f4?0x0:_0x369cd1['offset'];var _0x19ede6=_0x2818f4?_0x57b7e4[_0xecb2('0x1f')]:_0x369cd1[_0xecb2('0x20')]+_0x369cd1[_0xecb2('0x1e')];var _0x33326c;if(_0x19ede6>=_0x1b880e){_0x19ede6=_0x1b880e;_0x33326c=0xc8;}else{_0x33326c=0xce;}_0x1c8280[_0xecb2('0x1c')](_0x33326c);return _0x1c8280[_0xecb2('0x21')](_0xecb2('0x22'),_0x1ebf5c+'-'+_0x19ede6+'/'+_0x1b880e)['json'](_0x57b7e4);}return null;};}function patchUpdates(_0x4c3462){return function(_0x112285){try{jsonpatch[_0xecb2('0x23')](_0x112285,_0x4c3462,!![]);}catch(_0x7a1e8c){return BPromise[_0xecb2('0x24')](_0x7a1e8c);}return _0x112285['save']();};}function saveUpdates(_0x956cb1,_0x112cb1){return function(_0x1f9420){if(_0x1f9420){return _0x1f9420[_0xecb2('0x25')](_0x956cb1)[_0xecb2('0x26')](function(_0x27f633){return _0x27f633;});}return null;};}function removeEntity(_0x22a138,_0x36b278){return function(_0x544b4c){if(_0x544b4c){return _0x544b4c[_0xecb2('0x27')]()['then'](function(){_0x22a138[_0xecb2('0x1c')](0xcc)[_0xecb2('0x1b')]();});}};}function handleEntityNotFound(_0x23b3c3,_0x27de70){return function(_0x474e62){if(!_0x474e62){_0x23b3c3[_0xecb2('0x1a')](0x194);}return _0x474e62;};}function handleError(_0x4d8c52,_0x3471a0){_0x3471a0=_0x3471a0||0x1f4;return function(_0x29eeca){logger['error'](_0x29eeca['stack']);if(_0x29eeca['name']){delete _0x29eeca[_0xecb2('0x28')];}_0x4d8c52['status'](_0x3471a0)[_0xecb2('0x29')](_0x29eeca);};}exports['index']=function(_0x4bccd6,_0x38d208){var _0x3b2056={},_0x50fdad={},_0x1dc5c2={'count':0x0,'rows':[]};var _0x1c6acb=_[_0xecb2('0x2a')](db[_0xecb2('0x2b')]['rawAttributes'],function(_0x491fba){return{'name':_0x491fba[_0xecb2('0x2c')],'type':_0x491fba[_0xecb2('0x2d')][_0xecb2('0x2e')]};});_0x50fdad[_0xecb2('0x2f')]=_[_0xecb2('0x2a')](_0x1c6acb,'name');_0x50fdad[_0xecb2('0x30')]=_[_0xecb2('0x31')](_0x4bccd6[_0xecb2('0x30')]);_0x50fdad[_0xecb2('0x32')]=_['intersection'](_0x50fdad[_0xecb2('0x2f')],_0x50fdad['query']);_0x3b2056[_0xecb2('0x33')]=_[_0xecb2('0x34')](_0x50fdad['model'],qs[_0xecb2('0x35')](_0x4bccd6['query'][_0xecb2('0x35')]));_0x3b2056[_0xecb2('0x33')]=_0x3b2056[_0xecb2('0x33')][_0xecb2('0x36')]?_0x3b2056[_0xecb2('0x33')]:_0x50fdad[_0xecb2('0x2f')];if(!_0x4bccd6[_0xecb2('0x30')][_0xecb2('0x37')](_0xecb2('0x38'))){_0x3b2056['limit']=qs[_0xecb2('0x1e')](_0x4bccd6['query'][_0xecb2('0x1e')]);_0x3b2056[_0xecb2('0x20')]=qs['offset'](_0x4bccd6['query'][_0xecb2('0x20')]);}_0x3b2056[_0xecb2('0x39')]=qs['sort'](_0x4bccd6[_0xecb2('0x30')]['sort']);_0x3b2056['where']=qs[_0xecb2('0x32')](_[_0xecb2('0x3a')](_0x4bccd6[_0xecb2('0x30')],_0x50fdad['filters']),_0x1c6acb);if(_0x4bccd6[_0xecb2('0x30')][_0xecb2('0x3b')]){_0x3b2056[_0xecb2('0x3c')]=_['merge'](_0x3b2056['where'],{'$or':_['map'](_0x1c6acb,function(_0x22fbd9){if(_0x22fbd9[_0xecb2('0x2d')]!==_0xecb2('0x3d')){var _0x12ca98={};_0x12ca98[_0x22fbd9[_0xecb2('0x28')]]={'$like':'%'+_0x4bccd6[_0xecb2('0x30')][_0xecb2('0x3b')]+'%'};return _0x12ca98;}})});}_0x3b2056=_[_0xecb2('0x3e')]({},_0x3b2056,_0x4bccd6[_0xecb2('0x3f')]);var _0x4fc67f={'where':_0x3b2056[_0xecb2('0x3c')]};return db['SquareDetailsReport'][_0xecb2('0x1f')](_0x4fc67f)['then'](function(_0x1b8fae){_0x1dc5c2[_0xecb2('0x1f')]=_0x1b8fae;if(_0x4bccd6['query'][_0xecb2('0x40')]){_0x3b2056[_0xecb2('0x41')]=[{'all':!![]}];}return db[_0xecb2('0x2b')]['findAll'](_0x3b2056);})[_0xecb2('0x26')](function(_0x9eeef3){_0x1dc5c2[_0xecb2('0x42')]=_0x9eeef3;return _0x1dc5c2;})[_0xecb2('0x26')](respondWithFilteredResult(_0x38d208,_0x3b2056))[_0xecb2('0x43')](handleError(_0x38d208,null));};exports[_0xecb2('0x44')]=function(_0x3f5ec4,_0x424f75){var _0x56c7cf={'raw':!![],'where':{'id':_0x3f5ec4[_0xecb2('0x45')]['id']}},_0x70bed6={};_0x70bed6[_0xecb2('0x2f')]=_[_0xecb2('0x31')](db['SquareDetailsReport'][_0xecb2('0x46')]);_0x70bed6[_0xecb2('0x30')]=_[_0xecb2('0x31')](_0x3f5ec4['query']);_0x70bed6['filters']=_[_0xecb2('0x34')](_0x70bed6[_0xecb2('0x2f')],_0x70bed6['query']);_0x56c7cf[_0xecb2('0x33')]=_['intersection'](_0x70bed6['model'],qs[_0xecb2('0x35')](_0x3f5ec4[_0xecb2('0x30')]['fields']));_0x56c7cf[_0xecb2('0x33')]=_0x56c7cf['attributes'][_0xecb2('0x36')]?_0x56c7cf[_0xecb2('0x33')]:_0x70bed6[_0xecb2('0x2f')];if(_0x3f5ec4['query'][_0xecb2('0x40')]){_0x56c7cf[_0xecb2('0x41')]=[{'all':!![]}];}_0x56c7cf=_[_0xecb2('0x3e')]({},_0x56c7cf,_0x3f5ec4[_0xecb2('0x3f')]);return db['SquareDetailsReport'][_0xecb2('0x47')](_0x56c7cf)['then'](handleEntityNotFound(_0x424f75,null))[_0xecb2('0x26')](respondWithResult(_0x424f75,null))['catch'](handleError(_0x424f75,null));};exports['create']=function(_0x3d3f49,_0x5dea15){return db[_0xecb2('0x2b')][_0xecb2('0x48')](_0x3d3f49[_0xecb2('0x49')],{})[_0xecb2('0x26')](respondWithResult(_0x5dea15,0xc9))['catch'](handleError(_0x5dea15,null));};exports['update']=function(_0x2f18e7,_0x5ec654){if(_0x2f18e7[_0xecb2('0x49')]['id']){delete _0x2f18e7[_0xecb2('0x49')]['id'];}return db[_0xecb2('0x2b')]['find']({'where':{'id':_0x2f18e7['params']['id']}})[_0xecb2('0x26')](handleEntityNotFound(_0x5ec654,null))[_0xecb2('0x26')](saveUpdates(_0x2f18e7[_0xecb2('0x49')],null))[_0xecb2('0x26')](respondWithResult(_0x5ec654,null))[_0xecb2('0x43')](handleError(_0x5ec654,null));};exports['destroy']=function(_0x5cec3b,_0x58a88c){return db[_0xecb2('0x2b')][_0xecb2('0x47')]({'where':{'id':_0x5cec3b[_0xecb2('0x45')]['id']}})['then'](handleEntityNotFound(_0x58a88c,null))[_0xecb2('0x26')](removeEntity(_0x58a88c,null))[_0xecb2('0x43')](handleError(_0x58a88c,null));};exports[_0xecb2('0x4a')]=function(_0x31ae8f,_0x3e530c){return db[_0xecb2('0x2b')][_0xecb2('0x4a')]()['then'](respondWithResult(_0x3e530c,null))[_0xecb2('0x43')](handleError(_0x3e530c,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 89baaab..446ca92 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 _0x5996=['moment','path','../../config/environment','exports','define','SquareDetailsReport','lodash','util','../../config/logger','api'];(function(_0x328191,_0x560372){var _0x3616d8=function(_0x20459c){while(--_0x20459c){_0x328191['push'](_0x328191['shift']());}};_0x3616d8(++_0x560372);}(_0x5996,0x164));var _0x6599=function(_0x44e47d,_0x3c4a24){_0x44e47d=_0x44e47d-0x0;var _0x50a639=_0x5996[_0x44e47d];return _0x50a639;};'use strict';var _=require(_0x6599('0x0'));var util=require(_0x6599('0x1'));var logger=require(_0x6599('0x2'))(_0x6599('0x3'));var moment=require(_0x6599('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6599('0x5'));var rimraf=require('rimraf');var config=require(_0x6599('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0x6599('0x7')]=function(_0x2e052b,_0x45c793){return _0x2e052b[_0x6599('0x8')](_0x6599('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb646=['define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb646,0x148));var _0x6b64=function(_0x103206,_0x1fae01){_0x103206=_0x103206-0x0;var _0x2e2f53=_0xb646[_0x103206];return _0x2e2f53;};'use strict';var _=require(_0x6b64('0x0'));var util=require(_0x6b64('0x1'));var logger=require(_0x6b64('0x2'))(_0x6b64('0x3'));var moment=require(_0x6b64('0x4'));var BPromise=require(_0x6b64('0x5'));var rp=require(_0x6b64('0x6'));var fs=require('fs');var path=require(_0x6b64('0x7'));var rimraf=require(_0x6b64('0x8'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0x6b64('0x9')]=function(_0x23d97d,_0x4425c2){return _0x23d97d[_0x6b64('0xa')](_0x6b64('0xb'),attributes,{'tableName':_0x6b64('0xc'),'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 37c608a..cc82766 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 _0x09df=['util','bluebird','../../mysqldb','rpc','../../config/environment','request','then','info','request\x20sent','debug','error','code','SquareDetailsReport,\x20%s,\x20%s','message','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','catch','lodash'];(function(_0x2892db,_0x37719b){var _0x39089f=function(_0x3731c0){while(--_0x3731c0){_0x2892db['push'](_0x2892db['shift']());}};_0x39089f(++_0x37719b);}(_0x09df,0x164));var _0xf09d=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x09df[_0x2261ce];return _0x524640;};'use strict';var _=require(_0xf09d('0x0'));var util=require(_0xf09d('0x1'));var moment=require('moment');var BPromise=require(_0xf09d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf09d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf09d('0x4'));var config=require(_0xf09d('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x284a42,_0x48b82f,_0x28c91c){return new BPromise(function(_0x2555c7,_0x2f1810){return client[_0xf09d('0x6')](_0x284a42,_0x28c91c)[_0xf09d('0x7')](function(_0x2a59a8){logger[_0xf09d('0x8')]('SquareDetailsReport,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'));logger[_0xf09d('0xa')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x48b82f,_0xf09d('0x9'),JSON['stringify'](_0x2a59a8));if(_0x2a59a8[_0xf09d('0xb')]){if(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xc')]===0x1f4){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2f1810(_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);}logger['error'](_0xf09d('0xd'),_0x48b82f,_0x2a59a8[_0xf09d('0xb')][_0xf09d('0xe')]);return _0x2555c7(_0x2a59a8['error']['message']);}else{logger[_0xf09d('0x8')](_0xf09d('0xd'),_0x48b82f,_0xf09d('0x9'));_0x2555c7(_0x2a59a8['result'][_0xf09d('0xe')]);}})['catch'](function(_0x3614f7){logger[_0xf09d('0xb')](_0xf09d('0xd'),_0x48b82f,_0x3614f7);_0x2f1810(_0x3614f7);});});}exports[_0xf09d('0xf')]=function(_0x57e3f8){var _0x38083e=this;return new Promise(function(_0xc4b380,_0x106fb0){return db[_0xf09d('0x10')][_0xf09d('0x11')](_0x57e3f8[_0xf09d('0x12')],{'raw':_0x57e3f8['options']?_0x57e3f8[_0xf09d('0x13')]['raw']===undefined?!![]:![]:!![]})[_0xf09d('0x7')](function(_0x342e14){logger[_0xf09d('0x8')](_0xf09d('0xf'),_0x57e3f8);logger[_0xf09d('0xa')](_0xf09d('0xf'),_0x57e3f8,JSON['stringify'](_0x342e14));_0xc4b380(_0x342e14);})[_0xf09d('0x14')](function(_0x2ab436){logger[_0xf09d('0xb')](_0xf09d('0xf'),_0x2ab436[_0xf09d('0xe')],_0x57e3f8);_0x106fb0(_0x38083e[_0xf09d('0xb')](0x1f4,_0x2ab436[_0xf09d('0xe')]));});});}; \ No newline at end of file +var _0x0e56=['body','options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport'];(function(_0x467e9e,_0x4a6888){var _0x10376a=function(_0x5f3437){while(--_0x5f3437){_0x467e9e['push'](_0x467e9e['shift']());}};_0x10376a(++_0x4a6888);}(_0x0e56,0xf5));var _0x60e5=function(_0x861e02,_0x33f772){_0x861e02=_0x861e02-0x0;var _0x48fc24=_0x0e56[_0x861e02];return _0x48fc24;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var moment=require('moment');var BPromise=require(_0x60e5('0x2'));var rs=require(_0x60e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60e5('0x4'))['db'];var utils=require(_0x60e5('0x5'));var logger=require(_0x60e5('0x6'))(_0x60e5('0x7'));var config=require(_0x60e5('0x8'));var jayson=require(_0x60e5('0x9'));var client=jayson[_0x60e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b44b9,_0x5513f2,_0x31765c){return new BPromise(function(_0x3083a0,_0x59389e){return client[_0x60e5('0xb')](_0x1b44b9,_0x31765c)[_0x60e5('0xc')](function(_0x46d531){logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,_0x60e5('0xf'));logger[_0x60e5('0x10')](_0x60e5('0x11'),_0x5513f2,_0x60e5('0xf'),JSON[_0x60e5('0x12')](_0x46d531));if(_0x46d531[_0x60e5('0x13')]){if(_0x46d531[_0x60e5('0x13')][_0x60e5('0x14')]===0x1f4){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x59389e(_0x46d531[_0x60e5('0x13')]['message']);}logger['error'](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x3083a0(_0x46d531[_0x60e5('0x13')][_0x60e5('0x15')]);}else{logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,'request\x20sent');_0x3083a0(_0x46d531[_0x60e5('0x16')][_0x60e5('0x15')]);}})[_0x60e5('0x17')](function(_0x1ed08d){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x1ed08d);_0x59389e(_0x1ed08d);});});}exports[_0x60e5('0x18')]=function(_0x12aee7){var _0x3060b6=this;return new Promise(function(_0x51688a,_0x599dc4){return db['SquareDetailsReport']['create'](_0x12aee7[_0x60e5('0x19')],{'raw':_0x12aee7[_0x60e5('0x1a')]?_0x12aee7[_0x60e5('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x60e5('0xc')](function(_0x68c78){logger[_0x60e5('0xd')](_0x60e5('0x18'),_0x12aee7);logger[_0x60e5('0x10')](_0x60e5('0x18'),_0x12aee7,JSON[_0x60e5('0x12')](_0x68c78));_0x51688a(_0x68c78);})[_0x60e5('0x17')](function(_0x443665){logger[_0x60e5('0x13')](_0x60e5('0x18'),_0x443665['message'],_0x12aee7);_0x599dc4(_0x3060b6['error'](0x1f4,_0x443665[_0x60e5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index a227cb7..90afc35 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 _0x1e84=['../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','Router'];(function(_0xa19907,_0x4bebc5){var _0x28f72c=function(_0x2bd1ef){while(--_0x2bd1ef){_0xa19907['push'](_0xa19907['shift']());}};_0x28f72c(++_0x4bebc5);}(_0x1e84,0x19c));var _0x41e8=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0x1e84[_0x20cf8a];return _0x54e165;};'use strict';var express=require('express');var router=express[_0x41e8('0x0')]();var auth=require(_0x41e8('0x1'));var controller=require(_0x41e8('0x2'));router[_0x41e8('0x3')]('/',auth[_0x41e8('0x4')](),controller[_0x41e8('0x5')]);router['get'](_0x41e8('0x6'),auth[_0x41e8('0x4')](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0x01f2=['../../components/auth/service','./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess','express','Router'];(function(_0x351b7e,_0xabc589){var _0x5c91df=function(_0x1acc6f){while(--_0x1acc6f){_0x351b7e['push'](_0x351b7e['shift']());}};_0x5c91df(++_0xabc589);}(_0x01f2,0x97));var _0x201f=function(_0x803eb0,_0x33c886){_0x803eb0=_0x803eb0-0x0;var _0x55314e=_0x01f2[_0x803eb0];return _0x55314e;};'use strict';var express=require(_0x201f('0x0'));var router=express[_0x201f('0x1')]();var auth=require(_0x201f('0x2'));var controller=require(_0x201f('0x3'));router[_0x201f('0x4')]('/',auth['isAuthenticated'](),controller[_0x201f('0x5')]);router[_0x201f('0x4')](_0x201f('0x6'),auth[_0x201f('0x7')](),controller[_0x201f('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 2dd6d4d..07442c9 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 _0x2626=['kill','SIGINT','systeminformation','child_process','exec','../../config/logger','api','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','params'];(function(_0x45e7dd,_0xcff570){var _0xa3aa19=function(_0x5a11b2){while(--_0x5a11b2){_0x45e7dd['push'](_0x45e7dd['shift']());}};_0xa3aa19(++_0xcff570);}(_0x2626,0x197));var _0x6262=function(_0x327fbf,_0x17e496){_0x327fbf=_0x327fbf-0x0;var _0x3e588a=_0x2626[_0x327fbf];return _0x3e588a;};'use strict';var info=require(_0x6262('0x0'));var exec=require(_0x6262('0x1'))[_0x6262('0x2')];var logger=require(_0x6262('0x3'))(_0x6262('0x4'));var util=require(_0x6262('0x5'));var BPromise=require('bluebird');var _=require(_0x6262('0x6'));function handleError(_0x58ef8d,_0x5c2083,_0x2cb229){_0x5c2083=_0x5c2083||0x1f4;return function(_0x4a097d){logger['error'](_0x6262('0x7'),_0x2cb229,_0x5c2083,util[_0x6262('0x8')](_0x4a097d,{'showHidden':![],'depth':null}));delete _0x4a097d[_0x6262('0x9')];_0x58ef8d[_0x6262('0xa')](_0x5c2083)[_0x6262('0xb')](_0x4a097d);};}exports[_0x6262('0xc')]=function(_0x2af2b3,_0x17b948){return info[_0x6262('0xd')]()[_0x6262('0xe')](function(_0xa0ed2a){return _0x17b948['status'](0xc8)[_0x6262('0xf')](_0xa0ed2a);})[_0x6262('0x10')](function(_0x2379f1){return _0x17b948[_0x6262('0xa')](0x1f4)['json'](_0x2379f1);});};exports[_0x6262('0x11')]=function(_0x4beb21,_0x2ea567){var _0x3bcf5c=['components/import/cm'];return new BPromise(function(_0x5dea61,_0x3b2b8f){return exec(util['format'](_0x6262('0x12'),_0x4beb21['params'][_0x6262('0x13')]),function(_0x35f859,_0x2ef5fc,_0x52b732){if(_0x35f859){return _0x3b2b8f(_0x35f859);}return _0x5dea61(_0x2ef5fc);});})[_0x6262('0xe')](function(_0x435e04){var _0x299a42=![];var _0x2fc1fe=_0x435e04['split'](/\n/);for(var _0x42582f=0x0,_0xe491ef=_0x3bcf5c[_0x6262('0x14')];_0x42582f<_0xe491ef,_0x299a42===![];_0x42582f+=0x1){if(_0x435e04[_0x6262('0x15')](_0x3bcf5c[_0x42582f])>=0x0){_0x299a42=!![];}}if(!_0x299a42){throw new Error(util[_0x6262('0x16')](_0x6262('0x17'),_0x4beb21[_0x6262('0x18')][_0x6262('0x13')]));}process[_0x6262('0x19')](_0x4beb21[_0x6262('0x18')][_0x6262('0x13')],_0x6262('0x1a'));return _0x2ea567['status'](0xc8)[_0x6262('0xf')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4beb21[_0x6262('0x18')][_0x6262('0x13')])});})[_0x6262('0x10')](handleError(_0x2ea567,null,_0x6262('0x11')));}; \ No newline at end of file +var _0x4736=['index','getAllData','then','catch','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','SIGINT','killProcess','child_process','exec','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send'];(function(_0x40901f,_0x5bfe11){var _0x37a5b2=function(_0x1fe634){while(--_0x1fe634){_0x40901f['push'](_0x40901f['shift']());}};_0x37a5b2(++_0x5bfe11);}(_0x4736,0x13c));var _0x6473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4736[_0x3dd15e];return _0x231fd0;};'use strict';var info=require('systeminformation');var exec=require(_0x6473('0x0'))[_0x6473('0x1')];var logger=require('../../config/logger')('api');var util=require(_0x6473('0x2'));var BPromise=require(_0x6473('0x3'));var _=require(_0x6473('0x4'));function handleError(_0x3c0933,_0x40958e,_0x338a51){_0x40958e=_0x40958e||0x1f4;return function(_0xa672e3){logger['error'](_0x6473('0x5'),_0x338a51,_0x40958e,util[_0x6473('0x6')](_0xa672e3,{'showHidden':![],'depth':null}));delete _0xa672e3['name'];_0x3c0933[_0x6473('0x7')](_0x40958e)[_0x6473('0x8')](_0xa672e3);};}exports[_0x6473('0x9')]=function(_0x437a52,_0xe3262){return info[_0x6473('0xa')]()[_0x6473('0xb')](function(_0x4a1516){return _0xe3262[_0x6473('0x7')](0xc8)['json'](_0x4a1516);})[_0x6473('0xc')](function(_0x4c3745){return _0xe3262['status'](0x1f4)[_0x6473('0xd')](_0x4c3745);});};exports['killProcess']=function(_0x260d5a,_0x9c8d95){var _0x3eb6bb=[_0x6473('0xe')];return new BPromise(function(_0x16554b,_0x1fa5b0){return exec(util[_0x6473('0xf')](_0x6473('0x10'),_0x260d5a[_0x6473('0x11')]['pid']),function(_0x567dc4,_0x4edbcb,_0x26f1d2){if(_0x567dc4){return _0x1fa5b0(_0x567dc4);}return _0x16554b(_0x4edbcb);});})[_0x6473('0xb')](function(_0x3ae692){var _0x391bc4=![];var _0x398dd7=_0x3ae692[_0x6473('0x12')](/\n/);for(var _0x1a5fb0=0x0,_0x30b58d=_0x3eb6bb[_0x6473('0x13')];_0x1a5fb0<_0x30b58d,_0x391bc4===![];_0x1a5fb0+=0x1){if(_0x3ae692[_0x6473('0x14')](_0x3eb6bb[_0x1a5fb0])>=0x0){_0x391bc4=!![];}}if(!_0x391bc4){throw new Error(util['format'](_0x6473('0x15'),_0x260d5a[_0x6473('0x11')][_0x6473('0x16')]));}process['kill'](_0x260d5a[_0x6473('0x11')]['pid'],_0x6473('0x17'));return _0x9c8d95['status'](0xc8)[_0x6473('0xd')]({'message':util[_0x6473('0xf')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x260d5a[_0x6473('0x11')][_0x6473('0x16')])});})[_0x6473('0xc')](handleError(_0x9c8d95,null,_0x6473('0x18')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d11e550..070f2c6 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 _0xfd28=['show','put','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x58b301,_0x45e991){var _0x2171b3=function(_0x30b475){while(--_0x30b475){_0x58b301['push'](_0x58b301['shift']());}};_0x2171b3(++_0x45e991);}(_0xfd28,0x148));var _0x8fd2=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xfd28[_0x2d89ce];return _0x3fad10;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8fd2('0xa')]);router[_0x8fd2('0x7')](_0x8fd2('0xb'),auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['post']('/',auth[_0x8fd2('0x8')](),controller['create']);router[_0x8fd2('0xd')]('/:id',auth[_0x8fd2('0x8')](),controller['update']);router[_0x8fd2('0xe')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0xf')]);module[_0x8fd2('0x10')]=router; \ No newline at end of file +var _0x55e0=['./tag.controller','get','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5494d2,_0x50e653){var _0x5f0f8f=function(_0x4d1778){while(--_0x4d1778){_0x5494d2['push'](_0x5494d2['shift']());}};_0x5f0f8f(++_0x50e653);}(_0x55e0,0xdc));var _0x055e=function(_0x30e881,_0x522604){_0x30e881=_0x30e881-0x0;var _0x3222f7=_0x55e0[_0x30e881];return _0x3222f7;};'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')]('/describe',auth[_0x055e('0xa')](),controller[_0x055e('0xb')]);router[_0x055e('0x9')](_0x055e('0xc'),auth[_0x055e('0xa')](),controller['show']);router[_0x055e('0xd')]('/',auth[_0x055e('0xa')](),controller[_0x055e('0xe')]);router[_0x055e('0xf')](_0x055e('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x055e('0x10')]('/:id',auth[_0x055e('0xa')](),controller[_0x055e('0x11')]);module[_0x055e('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 0cc1f30..3014913 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 _0x0e21=['exports','STRING','name','#0091EA'];(function(_0x3071ab,_0x574a59){var _0x2f458c=function(_0x1eb9c7){while(--_0x1eb9c7){_0x3071ab['push'](_0x3071ab['shift']());}};_0x2f458c(++_0x574a59);}(_0x0e21,0xe8));var _0x10e2=function(_0x20e5a5,_0x43c35c){_0x20e5a5=_0x20e5a5-0x0;var _0x47c760=_0x0e21[_0x20e5a5];return _0x47c760;};'use strict';var Sequelize=require('sequelize');module[_0x10e2('0x0')]={'name':{'type':Sequelize[_0x10e2('0x1')],'unique':_0x10e2('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x10e2('0x3')},'description':{'type':Sequelize[_0x10e2('0x1')]}}; \ No newline at end of file +var _0x83cd=['exports','STRING','name','sequelize'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x83cd,0x17b));var _0xd83c=function(_0x581d10,_0x15beba){_0x581d10=_0x581d10-0x0;var _0x3ab17f=_0x83cd[_0x581d10];return _0x3ab17f;};'use strict';var Sequelize=require(_0xd83c('0x0'));module[_0xd83c('0x1')]={'name':{'type':Sequelize[_0xd83c('0x2')],'unique':_0xd83c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xd83c('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xd83c('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5e79bb3..fa22778 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 _0x1f26=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','limit','undefined','count','offset','Content-Range','reject','save','then','destroy','Tags','UserProfileResource','end','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','Tag','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','jsforce'];(function(_0x2f66e2,_0x5a69e6){var _0x1d079b=function(_0x1b48d5){while(--_0x1b48d5){_0x2f66e2['push'](_0x2f66e2['shift']());}};_0x1d079b(++_0x5a69e6);}(_0x1f26,0x197));var _0x61f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f26[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x61f2('0x0'));var rimraf=require(_0x61f2('0x1'));var zipdir=require(_0x61f2('0x2'));var jsonpatch=require(_0x61f2('0x3'));var rp=require(_0x61f2('0x4'));var moment=require(_0x61f2('0x5'));var BPromise=require(_0x61f2('0x6'));var Mustache=require('mustache');var util=require(_0x61f2('0x7'));var path=require(_0x61f2('0x8'));var sox=require(_0x61f2('0x9'));var csv=require('to-csv');var ejs=require(_0x61f2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x61f2('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x61f2('0xc'));var deskjs=require(_0x61f2('0xd'));var toCsv=require(_0x61f2('0xe'));var querystring=require(_0x61f2('0xf'));var Papa=require(_0x61f2('0x10'));var Redis=require(_0x61f2('0x11'));var authService=require(_0x61f2('0x12'));var qs=require(_0x61f2('0x13'));var as=require(_0x61f2('0x14'));var hardwareService=require(_0x61f2('0x15'));var logger=require(_0x61f2('0x16'))('api');var utils=require(_0x61f2('0x17'));var config=require(_0x61f2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d991d,_0x57a5ae){_0x57a5ae=_0x57a5ae||0xcc;return function(_0x4cd6e4){if(_0x4cd6e4){return _0x5d991d[_0x61f2('0x19')](_0x57a5ae);}return _0x5d991d[_0x61f2('0x1a')](_0x57a5ae)['end']();};}function respondWithResult(_0x331e2d,_0x4cdcd2){_0x4cdcd2=_0x4cdcd2||0xc8;return function(_0x34669b){if(_0x34669b){return _0x331e2d[_0x61f2('0x1a')](_0x4cdcd2)[_0x61f2('0x1b')](_0x34669b);}};}function respondWithFilteredResult(_0x51b9e8,_0x2ca347){return function(_0x5b72af){if(_0x5b72af){var _0x4f24a9=typeof _0x2ca347['offset']==='undefined'&&typeof _0x2ca347[_0x61f2('0x1c')]===_0x61f2('0x1d');var _0x382298=_0x5b72af['count'];var _0x2e51d1=_0x4f24a9?0x0:_0x2ca347['offset'];var _0x2a5823=_0x4f24a9?_0x5b72af[_0x61f2('0x1e')]:_0x2ca347[_0x61f2('0x1f')]+_0x2ca347[_0x61f2('0x1c')];var _0x2b26d0;if(_0x2a5823>=_0x382298){_0x2a5823=_0x382298;_0x2b26d0=0xc8;}else{_0x2b26d0=0xce;}_0x51b9e8['status'](_0x2b26d0);return _0x51b9e8['set'](_0x61f2('0x20'),_0x2e51d1+'-'+_0x2a5823+'/'+_0x382298)[_0x61f2('0x1b')](_0x5b72af);}return null;};}function patchUpdates(_0x56c6a8){return function(_0x5b86f5){try{jsonpatch['apply'](_0x5b86f5,_0x56c6a8,!![]);}catch(_0x5464be){return BPromise[_0x61f2('0x21')](_0x5464be);}return _0x5b86f5[_0x61f2('0x22')]();};}function saveUpdates(_0x5b47c8,_0x32c690){return function(_0x3880d){if(_0x3880d){return _0x3880d['update'](_0x5b47c8)[_0x61f2('0x23')](function(_0x3b0d24){return _0x3b0d24;});}return null;};}function removeEntity(_0x2818fb,_0x2288ed){return function(_0x35c4cd){if(_0x35c4cd){return _0x35c4cd[_0x61f2('0x24')]()[_0x61f2('0x23')](function(){var _0x1501cd=_0x35c4cd['get']({'plain':!![]});var _0x21fa88=_0x61f2('0x25');return db[_0x61f2('0x26')][_0x61f2('0x24')]({'where':{'type':_0x21fa88,'resourceId':_0x1501cd['id']}})['then'](function(){return _0x35c4cd;});})[_0x61f2('0x23')](function(){_0x2818fb[_0x61f2('0x1a')](0xcc)[_0x61f2('0x27')]();});}};}function handleEntityNotFound(_0x4eab50,_0x4a39b7){return function(_0x1de72d){if(!_0x1de72d){_0x4eab50['sendStatus'](0x194);}return _0x1de72d;};}function handleError(_0x4f39fb,_0x3a352c){_0x3a352c=_0x3a352c||0x1f4;return function(_0x394a07){logger[_0x61f2('0x28')](_0x394a07[_0x61f2('0x29')]);if(_0x394a07['name']){delete _0x394a07[_0x61f2('0x2a')];}_0x4f39fb['status'](_0x3a352c)['send'](_0x394a07);};}exports[_0x61f2('0x2b')]=function(_0x148baf,_0x4542bb){var _0x145a4c={},_0x23b345={},_0x433a6e={'count':0x0,'rows':[]};var _0x55b85b=_[_0x61f2('0x2c')](db['Tag']['rawAttributes'],function(_0x43cbdd){return{'name':_0x43cbdd[_0x61f2('0x2d')],'type':_0x43cbdd[_0x61f2('0x2e')][_0x61f2('0x2f')]};});_0x23b345[_0x61f2('0x30')]=_['map'](_0x55b85b,_0x61f2('0x2a'));_0x23b345[_0x61f2('0x31')]=_[_0x61f2('0x32')](_0x148baf[_0x61f2('0x31')]);_0x23b345[_0x61f2('0x33')]=_[_0x61f2('0x34')](_0x23b345['model'],_0x23b345['query']);_0x145a4c[_0x61f2('0x35')]=_[_0x61f2('0x34')](_0x23b345[_0x61f2('0x30')],qs[_0x61f2('0x36')](_0x148baf[_0x61f2('0x31')][_0x61f2('0x36')]));_0x145a4c['attributes']=_0x145a4c['attributes'][_0x61f2('0x37')]?_0x145a4c[_0x61f2('0x35')]:_0x23b345[_0x61f2('0x30')];if(!_0x148baf[_0x61f2('0x31')][_0x61f2('0x38')](_0x61f2('0x39'))){_0x145a4c[_0x61f2('0x1c')]=qs[_0x61f2('0x1c')](_0x148baf[_0x61f2('0x31')][_0x61f2('0x1c')]);_0x145a4c[_0x61f2('0x1f')]=qs[_0x61f2('0x1f')](_0x148baf[_0x61f2('0x31')]['offset']);}_0x145a4c['order']=qs['sort'](_0x148baf[_0x61f2('0x31')]['sort']);_0x145a4c[_0x61f2('0x3a')]=qs[_0x61f2('0x33')](_[_0x61f2('0x3b')](_0x148baf[_0x61f2('0x31')],_0x23b345[_0x61f2('0x33')]),_0x55b85b);if(_0x148baf[_0x61f2('0x31')]['filter']){_0x145a4c[_0x61f2('0x3a')]=_[_0x61f2('0x3c')](_0x145a4c[_0x61f2('0x3a')],{'$or':_['map'](_0x55b85b,function(_0x3d019a){if(_0x3d019a[_0x61f2('0x2e')]!==_0x61f2('0x3d')){var _0x438909={};_0x438909[_0x3d019a['name']]={'$like':'%'+_0x148baf[_0x61f2('0x31')][_0x61f2('0x3e')]+'%'};return _0x438909;}})});}_0x145a4c=_[_0x61f2('0x3c')]({},_0x145a4c,_0x148baf[_0x61f2('0x3f')]);var _0x568df3={'where':_0x145a4c[_0x61f2('0x3a')]};return db[_0x61f2('0x40')][_0x61f2('0x1e')](_0x568df3)[_0x61f2('0x23')](function(_0x24dc60){_0x433a6e[_0x61f2('0x1e')]=_0x24dc60;if(_0x148baf['query'][_0x61f2('0x41')]){_0x145a4c['include']=[{'all':!![]}];}return db[_0x61f2('0x40')][_0x61f2('0x42')](_0x145a4c);})[_0x61f2('0x23')](function(_0x6bdc59){_0x433a6e[_0x61f2('0x43')]=_0x6bdc59;return _0x433a6e;})[_0x61f2('0x23')](respondWithFilteredResult(_0x4542bb,_0x145a4c))[_0x61f2('0x44')](handleError(_0x4542bb,null));};exports[_0x61f2('0x45')]=function(_0x341736,_0xda216){var _0x2efc73={'raw':!![],'where':{'id':_0x341736[_0x61f2('0x46')]['id']}},_0xfeebae={};_0xfeebae[_0x61f2('0x30')]=_[_0x61f2('0x32')](db[_0x61f2('0x40')][_0x61f2('0x47')]);_0xfeebae[_0x61f2('0x31')]=_[_0x61f2('0x32')](_0x341736['query']);_0xfeebae[_0x61f2('0x33')]=_[_0x61f2('0x34')](_0xfeebae[_0x61f2('0x30')],_0xfeebae[_0x61f2('0x31')]);_0x2efc73[_0x61f2('0x35')]=_[_0x61f2('0x34')](_0xfeebae[_0x61f2('0x30')],qs[_0x61f2('0x36')](_0x341736[_0x61f2('0x31')][_0x61f2('0x36')]));_0x2efc73[_0x61f2('0x35')]=_0x2efc73[_0x61f2('0x35')][_0x61f2('0x37')]?_0x2efc73['attributes']:_0xfeebae[_0x61f2('0x30')];if(_0x341736[_0x61f2('0x31')][_0x61f2('0x41')]){_0x2efc73[_0x61f2('0x48')]=[{'all':!![]}];}_0x2efc73=_[_0x61f2('0x3c')]({},_0x2efc73,_0x341736[_0x61f2('0x3f')]);return db[_0x61f2('0x40')][_0x61f2('0x49')](_0x2efc73)[_0x61f2('0x23')](handleEntityNotFound(_0xda216,null))[_0x61f2('0x23')](respondWithResult(_0xda216,null))[_0x61f2('0x44')](handleError(_0xda216,null));};exports[_0x61f2('0x4a')]=function(_0x16c68c,_0x1875d6){return db[_0x61f2('0x40')]['create'](_0x16c68c[_0x61f2('0x4b')],{})[_0x61f2('0x23')](function(_0x52c0de){var _0x30c191=_0x16c68c[_0x61f2('0x4c')][_0x61f2('0x4d')]({'plain':!![]});if(!_0x30c191)throw new Error(_0x61f2('0x4e'));if(_0x30c191[_0x61f2('0x4f')]===_0x61f2('0x4c')){var _0x3833dc=_0x52c0de[_0x61f2('0x4d')]({'plain':!![]});var _0x5b3639=_0x61f2('0x25');return db[_0x61f2('0x50')][_0x61f2('0x49')]({'where':{'name':_0x5b3639,'userProfileId':_0x30c191[_0x61f2('0x51')]},'raw':!![]})[_0x61f2('0x23')](function(_0x8acb94){if(_0x8acb94&&_0x8acb94['autoAssociation']===0x0){return db['UserProfileResource'][_0x61f2('0x4a')]({'name':_0x3833dc[_0x61f2('0x2a')],'resourceId':_0x3833dc['id'],'type':_0x8acb94[_0x61f2('0x2a')],'sectionId':_0x8acb94['id']},{})['then'](function(){return _0x52c0de;});}else{return _0x52c0de;}})[_0x61f2('0x44')](function(_0x3d3237){logger[_0x61f2('0x28')](_0x61f2('0x52'),_0x3d3237);throw _0x3d3237;});}return _0x52c0de;})[_0x61f2('0x23')](respondWithResult(_0x1875d6,0xc9))['catch'](handleError(_0x1875d6,null));};exports['update']=function(_0x3e518c,_0x19a4f8){if(_0x3e518c[_0x61f2('0x4b')]['id']){delete _0x3e518c['body']['id'];}return db[_0x61f2('0x40')][_0x61f2('0x49')]({'where':{'id':_0x3e518c[_0x61f2('0x46')]['id']}})[_0x61f2('0x23')](handleEntityNotFound(_0x19a4f8,null))['then'](saveUpdates(_0x3e518c[_0x61f2('0x4b')],null))[_0x61f2('0x23')](respondWithResult(_0x19a4f8,null))['catch'](handleError(_0x19a4f8,null));};exports[_0x61f2('0x24')]=function(_0x3ddb59,_0x18e639){return db[_0x61f2('0x40')][_0x61f2('0x49')]({'where':{'id':_0x3ddb59[_0x61f2('0x46')]['id']}})['then'](handleEntityNotFound(_0x18e639,null))[_0x61f2('0x23')](removeEntity(_0x18e639,null))[_0x61f2('0x44')](handleError(_0x18e639,null));};exports[_0x61f2('0x53')]=function(_0xe2a7e3,_0x419630){return db[_0x61f2('0x40')][_0x61f2('0x53')]()[_0x61f2('0x23')](respondWithResult(_0x419630,null))[_0x61f2('0x44')](handleError(_0x419630,null));}; \ No newline at end of file +var _0xa5d5=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','get','Tags','UserProfileResource','destroy','error','stack','name','send','index','Tag','rawAttributes','type','key','map','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x12d825,_0x2522d9){var _0x4581ce=function(_0x48b188){while(--_0x48b188){_0x12d825['push'](_0x12d825['shift']());}};_0x4581ce(++_0x2522d9);}(_0xa5d5,0x100));var _0x5a5d=function(_0x250265,_0x54078b){_0x250265=_0x250265-0x0;var _0x227ff2=_0xa5d5[_0x250265];return _0x227ff2;};'use strict';var emlformat=require(_0x5a5d('0x0'));var rimraf=require(_0x5a5d('0x1'));var zipdir=require(_0x5a5d('0x2'));var jsonpatch=require(_0x5a5d('0x3'));var rp=require('request-promise');var moment=require(_0x5a5d('0x4'));var BPromise=require(_0x5a5d('0x5'));var Mustache=require(_0x5a5d('0x6'));var util=require(_0x5a5d('0x7'));var path=require(_0x5a5d('0x8'));var sox=require(_0x5a5d('0x9'));var csv=require(_0x5a5d('0xa'));var ejs=require(_0x5a5d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a5d('0xc'));var squel=require(_0x5a5d('0xd'));var crypto=require('crypto');var jsforce=require(_0x5a5d('0xe'));var deskjs=require(_0x5a5d('0xf'));var toCsv=require(_0x5a5d('0xa'));var querystring=require('querystring');var Papa=require(_0x5a5d('0x10'));var Redis=require(_0x5a5d('0x11'));var authService=require(_0x5a5d('0x12'));var qs=require(_0x5a5d('0x13'));var as=require(_0x5a5d('0x14'));var hardwareService=require(_0x5a5d('0x15'));var logger=require(_0x5a5d('0x16'))(_0x5a5d('0x17'));var utils=require(_0x5a5d('0x18'));var config=require(_0x5a5d('0x19'));var licenseUtil=require(_0x5a5d('0x1a'));var db=require(_0x5a5d('0x1b'))['db'];function respondWithStatusCode(_0x2dad7b,_0x317e7d){_0x317e7d=_0x317e7d||0xcc;return function(_0x27a0f0){if(_0x27a0f0){return _0x2dad7b[_0x5a5d('0x1c')](_0x317e7d);}return _0x2dad7b['status'](_0x317e7d)[_0x5a5d('0x1d')]();};}function respondWithResult(_0x12629e,_0x460fc7){_0x460fc7=_0x460fc7||0xc8;return function(_0xdba5ff){if(_0xdba5ff){return _0x12629e['status'](_0x460fc7)[_0x5a5d('0x1e')](_0xdba5ff);}};}function respondWithFilteredResult(_0x326668,_0xb85c55){return function(_0x513cda){if(_0x513cda){var _0x460589=typeof _0xb85c55[_0x5a5d('0x1f')]===_0x5a5d('0x20')&&typeof _0xb85c55[_0x5a5d('0x21')]===_0x5a5d('0x20');var _0x53ab05=_0x513cda[_0x5a5d('0x22')];var _0x464bc9=_0x460589?0x0:_0xb85c55['offset'];var _0x7d7cbd=_0x460589?_0x513cda['count']:_0xb85c55[_0x5a5d('0x1f')]+_0xb85c55[_0x5a5d('0x21')];var _0x489d3b;if(_0x7d7cbd>=_0x53ab05){_0x7d7cbd=_0x53ab05;_0x489d3b=0xc8;}else{_0x489d3b=0xce;}_0x326668[_0x5a5d('0x23')](_0x489d3b);return _0x326668[_0x5a5d('0x24')](_0x5a5d('0x25'),_0x464bc9+'-'+_0x7d7cbd+'/'+_0x53ab05)[_0x5a5d('0x1e')](_0x513cda);}return null;};}function patchUpdates(_0x3039b0){return function(_0xd339cf){try{jsonpatch[_0x5a5d('0x26')](_0xd339cf,_0x3039b0,!![]);}catch(_0x23a19f){return BPromise['reject'](_0x23a19f);}return _0xd339cf[_0x5a5d('0x27')]();};}function saveUpdates(_0x3297c8,_0x4238f6){return function(_0x5d565d){if(_0x5d565d){return _0x5d565d[_0x5a5d('0x28')](_0x3297c8)['then'](function(_0x320267){return _0x320267;});}return null;};}function removeEntity(_0x2621a1,_0x21fa50){return function(_0x158197){if(_0x158197){return _0x158197['destroy']()[_0x5a5d('0x29')](function(){var _0x2917ce=_0x158197[_0x5a5d('0x2a')]({'plain':!![]});var _0x265f31=_0x5a5d('0x2b');return db[_0x5a5d('0x2c')][_0x5a5d('0x2d')]({'where':{'type':_0x265f31,'resourceId':_0x2917ce['id']}})[_0x5a5d('0x29')](function(){return _0x158197;});})['then'](function(){_0x2621a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18b170,_0x4c2ff6){return function(_0x7453e7){if(!_0x7453e7){_0x18b170[_0x5a5d('0x1c')](0x194);}return _0x7453e7;};}function handleError(_0x3570ef,_0x244503){_0x244503=_0x244503||0x1f4;return function(_0x526019){logger[_0x5a5d('0x2e')](_0x526019[_0x5a5d('0x2f')]);if(_0x526019['name']){delete _0x526019[_0x5a5d('0x30')];}_0x3570ef[_0x5a5d('0x23')](_0x244503)[_0x5a5d('0x31')](_0x526019);};}exports[_0x5a5d('0x32')]=function(_0xf589c6,_0x13c476){var _0x133d20={},_0x187755={},_0x2180a3={'count':0x0,'rows':[]};var _0x5d5ba8=_['map'](db[_0x5a5d('0x33')][_0x5a5d('0x34')],function(_0x59cdb4){return{'name':_0x59cdb4['fieldName'],'type':_0x59cdb4[_0x5a5d('0x35')][_0x5a5d('0x36')]};});_0x187755['model']=_[_0x5a5d('0x37')](_0x5d5ba8,_0x5a5d('0x30'));_0x187755[_0x5a5d('0x38')]=_['keys'](_0xf589c6[_0x5a5d('0x38')]);_0x187755['filters']=_[_0x5a5d('0x39')](_0x187755[_0x5a5d('0x3a')],_0x187755[_0x5a5d('0x38')]);_0x133d20['attributes']=_[_0x5a5d('0x39')](_0x187755[_0x5a5d('0x3a')],qs['fields'](_0xf589c6['query'][_0x5a5d('0x3b')]));_0x133d20[_0x5a5d('0x3c')]=_0x133d20[_0x5a5d('0x3c')]['length']?_0x133d20[_0x5a5d('0x3c')]:_0x187755[_0x5a5d('0x3a')];if(!_0xf589c6[_0x5a5d('0x38')][_0x5a5d('0x3d')](_0x5a5d('0x3e'))){_0x133d20[_0x5a5d('0x21')]=qs[_0x5a5d('0x21')](_0xf589c6[_0x5a5d('0x38')][_0x5a5d('0x21')]);_0x133d20[_0x5a5d('0x1f')]=qs[_0x5a5d('0x1f')](_0xf589c6[_0x5a5d('0x38')][_0x5a5d('0x1f')]);}_0x133d20[_0x5a5d('0x3f')]=qs['sort'](_0xf589c6[_0x5a5d('0x38')][_0x5a5d('0x40')]);_0x133d20[_0x5a5d('0x41')]=qs[_0x5a5d('0x42')](_[_0x5a5d('0x43')](_0xf589c6[_0x5a5d('0x38')],_0x187755['filters']),_0x5d5ba8);if(_0xf589c6['query']['filter']){_0x133d20[_0x5a5d('0x41')]=_['merge'](_0x133d20[_0x5a5d('0x41')],{'$or':_['map'](_0x5d5ba8,function(_0x618bf7){if(_0x618bf7[_0x5a5d('0x35')]!==_0x5a5d('0x44')){var _0x3dd798={};_0x3dd798[_0x618bf7[_0x5a5d('0x30')]]={'$like':'%'+_0xf589c6[_0x5a5d('0x38')][_0x5a5d('0x45')]+'%'};return _0x3dd798;}})});}_0x133d20=_[_0x5a5d('0x46')]({},_0x133d20,_0xf589c6[_0x5a5d('0x47')]);var _0x1a6dc1={'where':_0x133d20[_0x5a5d('0x41')]};return db[_0x5a5d('0x33')][_0x5a5d('0x22')](_0x1a6dc1)['then'](function(_0x53ded5){_0x2180a3[_0x5a5d('0x22')]=_0x53ded5;if(_0xf589c6['query'][_0x5a5d('0x48')]){_0x133d20[_0x5a5d('0x49')]=[{'all':!![]}];}return db['Tag'][_0x5a5d('0x4a')](_0x133d20);})[_0x5a5d('0x29')](function(_0x1f66b8){_0x2180a3['rows']=_0x1f66b8;return _0x2180a3;})['then'](respondWithFilteredResult(_0x13c476,_0x133d20))[_0x5a5d('0x4b')](handleError(_0x13c476,null));};exports[_0x5a5d('0x4c')]=function(_0x5d798e,_0xc33b0f){var _0x2a4683={'raw':!![],'where':{'id':_0x5d798e[_0x5a5d('0x4d')]['id']}},_0xafecdf={};_0xafecdf[_0x5a5d('0x3a')]=_['keys'](db['Tag'][_0x5a5d('0x34')]);_0xafecdf[_0x5a5d('0x38')]=_[_0x5a5d('0x4e')](_0x5d798e[_0x5a5d('0x38')]);_0xafecdf[_0x5a5d('0x42')]=_[_0x5a5d('0x39')](_0xafecdf[_0x5a5d('0x3a')],_0xafecdf[_0x5a5d('0x38')]);_0x2a4683[_0x5a5d('0x3c')]=_[_0x5a5d('0x39')](_0xafecdf[_0x5a5d('0x3a')],qs['fields'](_0x5d798e[_0x5a5d('0x38')][_0x5a5d('0x3b')]));_0x2a4683[_0x5a5d('0x3c')]=_0x2a4683[_0x5a5d('0x3c')][_0x5a5d('0x4f')]?_0x2a4683[_0x5a5d('0x3c')]:_0xafecdf[_0x5a5d('0x3a')];if(_0x5d798e['query'][_0x5a5d('0x48')]){_0x2a4683[_0x5a5d('0x49')]=[{'all':!![]}];}_0x2a4683=_[_0x5a5d('0x46')]({},_0x2a4683,_0x5d798e['options']);return db[_0x5a5d('0x33')][_0x5a5d('0x50')](_0x2a4683)[_0x5a5d('0x29')](handleEntityNotFound(_0xc33b0f,null))[_0x5a5d('0x29')](respondWithResult(_0xc33b0f,null))[_0x5a5d('0x4b')](handleError(_0xc33b0f,null));};exports['create']=function(_0x593979,_0x221083){return db[_0x5a5d('0x33')]['create'](_0x593979[_0x5a5d('0x51')],{})['then'](function(_0x451e56){var _0xa56c82=_0x593979[_0x5a5d('0x52')][_0x5a5d('0x2a')]({'plain':!![]});if(!_0xa56c82)throw new Error(_0x5a5d('0x53'));if(_0xa56c82[_0x5a5d('0x54')]==='user'){var _0x3d6f68=_0x451e56[_0x5a5d('0x2a')]({'plain':!![]});var _0x4bd5df=_0x5a5d('0x2b');return db['UserProfileSection'][_0x5a5d('0x50')]({'where':{'name':_0x4bd5df,'userProfileId':_0xa56c82[_0x5a5d('0x55')]},'raw':!![]})[_0x5a5d('0x29')](function(_0x49a173){if(_0x49a173&&_0x49a173[_0x5a5d('0x56')]===0x0){return db[_0x5a5d('0x2c')][_0x5a5d('0x57')]({'name':_0x3d6f68['name'],'resourceId':_0x3d6f68['id'],'type':_0x49a173['name'],'sectionId':_0x49a173['id']},{})[_0x5a5d('0x29')](function(){return _0x451e56;});}else{return _0x451e56;}})[_0x5a5d('0x4b')](function(_0x3ec111){logger['error'](_0x5a5d('0x58'),_0x3ec111);throw _0x3ec111;});}return _0x451e56;})['then'](respondWithResult(_0x221083,0xc9))[_0x5a5d('0x4b')](handleError(_0x221083,null));};exports[_0x5a5d('0x28')]=function(_0x50ada1,_0x24f6e4){if(_0x50ada1[_0x5a5d('0x51')]['id']){delete _0x50ada1[_0x5a5d('0x51')]['id'];}return db['Tag'][_0x5a5d('0x50')]({'where':{'id':_0x50ada1['params']['id']}})[_0x5a5d('0x29')](handleEntityNotFound(_0x24f6e4,null))[_0x5a5d('0x29')](saveUpdates(_0x50ada1[_0x5a5d('0x51')],null))[_0x5a5d('0x29')](respondWithResult(_0x24f6e4,null))['catch'](handleError(_0x24f6e4,null));};exports[_0x5a5d('0x2d')]=function(_0x3619f7,_0x457dc9){return db['Tag'][_0x5a5d('0x50')]({'where':{'id':_0x3619f7[_0x5a5d('0x4d')]['id']}})[_0x5a5d('0x29')](handleEntityNotFound(_0x457dc9,null))[_0x5a5d('0x29')](removeEntity(_0x457dc9,null))[_0x5a5d('0x4b')](handleError(_0x457dc9,null));};exports[_0x5a5d('0x59')]=function(_0x2e3a52,_0x5a064c){return db['Tag'][_0x5a5d('0x59')]()[_0x5a5d('0x29')](respondWithResult(_0x5a064c,null))[_0x5a5d('0x4b')](handleError(_0x5a064c,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b479f66..5c23d3a 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 _0xe702=['util','../../config/logger','api','moment','bluebird','rimraf','./tag.attributes','define','tools_tags','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe702,0x95));var _0x2e70=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xe702[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x2e70('0x0'));var util=require(_0x2e70('0x1'));var logger=require(_0x2e70('0x2'))(_0x2e70('0x3'));var moment=require(_0x2e70('0x4'));var BPromise=require(_0x2e70('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e70('0x6'));var config=require('../../config/environment');var attributes=require(_0x2e70('0x7'));module['exports']=function(_0x32c37e,_0x32ad67){return _0x32c37e[_0x2e70('0x8')]('Tag',attributes,{'tableName':_0x2e70('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c0e=['api','moment','bluebird','path','rimraf','./tag.attributes','exports','define','tools_tags','lodash','util'];(function(_0x18295b,_0x1c0aea){var _0x59890b=function(_0x1ff845){while(--_0x1ff845){_0x18295b['push'](_0x18295b['shift']());}};_0x59890b(++_0x1c0aea);}(_0x9c0e,0x11c));var _0xe9c0=function(_0x40ee71,_0x1e1ac0){_0x40ee71=_0x40ee71-0x0;var _0x512224=_0x9c0e[_0x40ee71];return _0x512224;};'use strict';var _=require(_0xe9c0('0x0'));var util=require(_0xe9c0('0x1'));var logger=require('../../config/logger')(_0xe9c0('0x2'));var moment=require(_0xe9c0('0x3'));var BPromise=require(_0xe9c0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9c0('0x5'));var rimraf=require(_0xe9c0('0x6'));var config=require('../../config/environment');var attributes=require(_0xe9c0('0x7'));module[_0xe9c0('0x8')]=function(_0x501eea,_0x424c5a){return _0x501eea[_0xe9c0('0x9')]('Tag',attributes,{'tableName':_0xe9c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index a14d041..ad04ad9 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 _0xb18e=['debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x3bbd4e,_0x502b91){var _0x4dfeb8=function(_0x54f4ca){while(--_0x54f4ca){_0x3bbd4e['push'](_0x3bbd4e['shift']());}};_0x4dfeb8(++_0x502b91);}(_0xb18e,0x181));var _0xeb18=function(_0x2fcf18,_0x10009a){_0x2fcf18=_0x2fcf18-0x0;var _0x4c68cc=_0xb18e[_0x2fcf18];return _0x4c68cc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeb18('0x0'));var BPromise=require('bluebird');var rs=require(_0xeb18('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb18('0x2'))['db'];var utils=require(_0xeb18('0x3'));var logger=require('../../config/logger')(_0xeb18('0x4'));var config=require(_0xeb18('0x5'));var jayson=require(_0xeb18('0x6'));var client=jayson[_0xeb18('0x7')][_0xeb18('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x183bdf,_0x4a9ddd,_0x1bc3ee){return new BPromise(function(_0x131389,_0x534358){return client[_0xeb18('0x9')](_0x183bdf,_0x1bc3ee)[_0xeb18('0xa')](function(_0x942945){logger[_0xeb18('0xb')](_0xeb18('0xc'),_0x4a9ddd,_0xeb18('0xd'));logger[_0xeb18('0xe')](_0xeb18('0xf'),_0x4a9ddd,_0xeb18('0xd'),JSON[_0xeb18('0x10')](_0x942945));if(_0x942945['error']){if(_0x942945[_0xeb18('0x11')][_0xeb18('0x12')]===0x1f4){logger['error'](_0xeb18('0xc'),_0x4a9ddd,_0x942945['error']['message']);return _0x534358(_0x942945[_0xeb18('0x11')][_0xeb18('0x13')]);}logger[_0xeb18('0x11')]('Tag,\x20%s,\x20%s',_0x4a9ddd,_0x942945['error'][_0xeb18('0x13')]);return _0x131389(_0x942945[_0xeb18('0x11')]['message']);}else{logger[_0xeb18('0xb')](_0xeb18('0xc'),_0x4a9ddd,_0xeb18('0xd'));_0x131389(_0x942945['result'][_0xeb18('0x13')]);}})[_0xeb18('0x14')](function(_0x318043){logger[_0xeb18('0x11')](_0xeb18('0xc'),_0x4a9ddd,_0x318043);_0x534358(_0x318043);});});} \ No newline at end of file +var _0x43fd=['request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x43fd,0x1ec));var _0xd43f=function(_0x45172d,_0x1a712b){_0x45172d=_0x45172d-0x0;var _0x5c1274=_0x43fd[_0x45172d];return _0x5c1274;};'use strict';var _=require('lodash');var util=require(_0xd43f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd43f('0x1'));var fs=require('fs');var Redis=require(_0xd43f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd43f('0x3'));var logger=require('../../config/logger')(_0xd43f('0x4'));var config=require(_0xd43f('0x5'));var jayson=require(_0xd43f('0x6'));var client=jayson[_0xd43f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde214d,_0xad5196,_0x20ccd7){return new BPromise(function(_0x331163,_0x547e12){return client[_0xd43f('0x8')](_0xde214d,_0x20ccd7)[_0xd43f('0x9')](function(_0x52e9c8){logger[_0xd43f('0xa')](_0xd43f('0xb'),_0xad5196,_0xd43f('0xc'));logger[_0xd43f('0xd')](_0xd43f('0xe'),_0xad5196,'request\x20sent',JSON[_0xd43f('0xf')](_0x52e9c8));if(_0x52e9c8[_0xd43f('0x10')]){if(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x11')]===0x1f4){logger[_0xd43f('0x10')](_0xd43f('0xb'),_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x547e12(_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);}logger[_0xd43f('0x10')]('Tag,\x20%s,\x20%s',_0xad5196,_0x52e9c8[_0xd43f('0x10')][_0xd43f('0x12')]);return _0x331163(_0x52e9c8[_0xd43f('0x10')]['message']);}else{logger['info']('Tag,\x20%s,\x20%s',_0xad5196,_0xd43f('0xc'));_0x331163(_0x52e9c8[_0xd43f('0x13')]['message']);}})[_0xd43f('0x14')](function(_0x3647df){logger['error']('Tag,\x20%s,\x20%s',_0xad5196,_0x3647df);_0x547e12(_0x3647df);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 9e679d1..1f397d3 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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 413cac8..c7688ce 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 _0xb7e7=['STRING','sequelize'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xb7e7[_0x5c9307];return _0x373e29;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x377eaf,_0x22cea8){var _0x822c48=function(_0x148929){while(--_0x148929){_0x377eaf['push'](_0x377eaf['shift']());}};_0x822c48(++_0x22cea8);}(_0x2032,0xd9));var _0x2203=function(_0x42067a,_0xd69a7e){_0x42067a=_0x42067a-0x0;var _0x1285c5=_0x2032[_0x42067a];return _0x1285c5;};'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 diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index a74b3c0..4ef5f53 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 _0x2ffa=['crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./team.socket','register','sendStatus','status','end','undefined','count','offset','set','json','apply','reject','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','filters','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','get','capitalize','addQueues','Queues','removeQueues','remove','addAgents','isArray','ids','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','upsert','isNil','format','SIP/%s','all','spread','removeAgents','Queue:remove','UserVoiceQueueRt','getAgents','nolimit','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x2ffa,0x97));var _0xa2ff=function(_0x25184a,_0x14f735){_0x25184a=_0x25184a-0x0;var _0x1b1167=_0x2ffa[_0x25184a];return _0x1b1167;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa2ff('0x0'));var jsonpatch=require(_0xa2ff('0x1'));var rp=require(_0xa2ff('0x2'));var moment=require(_0xa2ff('0x3'));var BPromise=require(_0xa2ff('0x4'));var Mustache=require(_0xa2ff('0x5'));var util=require(_0xa2ff('0x6'));var path=require(_0xa2ff('0x7'));var sox=require(_0xa2ff('0x8'));var csv=require(_0xa2ff('0x9'));var ejs=require(_0xa2ff('0xa'));var fs=require('fs');var fs_extra=require(_0xa2ff('0xb'));var _=require('lodash');var squel=require(_0xa2ff('0xc'));var crypto=require(_0xa2ff('0xd'));var jsforce=require(_0xa2ff('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa2ff('0x9'));var querystring=require(_0xa2ff('0xf'));var Papa=require(_0xa2ff('0x10'));var Redis=require('ioredis');var authService=require(_0xa2ff('0x11'));var qs=require(_0xa2ff('0x12'));var as=require(_0xa2ff('0x13'));var hardwareService=require(_0xa2ff('0x14'));var logger=require(_0xa2ff('0x15'))('api');var utils=require(_0xa2ff('0x16'));var config=require(_0xa2ff('0x17'));var licenseUtil=require(_0xa2ff('0x18'));var db=require(_0xa2ff('0x19'))['db'];config['redis']=_[_0xa2ff('0x1a')](config[_0xa2ff('0x1b')],{'host':_0xa2ff('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa2ff('0x1b')]));require(_0xa2ff('0x1d'))[_0xa2ff('0x1e')](socket);function respondWithStatusCode(_0x24495b,_0xe4632e){_0xe4632e=_0xe4632e||0xcc;return function(_0x32347f){if(_0x32347f){return _0x24495b[_0xa2ff('0x1f')](_0xe4632e);}return _0x24495b[_0xa2ff('0x20')](_0xe4632e)[_0xa2ff('0x21')]();};}function respondWithResult(_0x234d61,_0x559228){_0x559228=_0x559228||0xc8;return function(_0x490059){if(_0x490059){return _0x234d61[_0xa2ff('0x20')](_0x559228)['json'](_0x490059);}};}function respondWithFilteredResult(_0x14d277,_0x3e1b77){return function(_0x1e618f){if(_0x1e618f){var _0x583d6a=typeof _0x3e1b77['offset']===_0xa2ff('0x22')&&typeof _0x3e1b77['limit']===_0xa2ff('0x22');var _0x1e2f42=_0x1e618f[_0xa2ff('0x23')];var _0xef5ab6=_0x583d6a?0x0:_0x3e1b77[_0xa2ff('0x24')];var _0x4e7d1f=_0x583d6a?_0x1e618f[_0xa2ff('0x23')]:_0x3e1b77[_0xa2ff('0x24')]+_0x3e1b77['limit'];var _0x3d9d3a;if(_0x4e7d1f>=_0x1e2f42){_0x4e7d1f=_0x1e2f42;_0x3d9d3a=0xc8;}else{_0x3d9d3a=0xce;}_0x14d277[_0xa2ff('0x20')](_0x3d9d3a);return _0x14d277[_0xa2ff('0x25')]('Content-Range',_0xef5ab6+'-'+_0x4e7d1f+'/'+_0x1e2f42)[_0xa2ff('0x26')](_0x1e618f);}return null;};}function patchUpdates(_0x2babee){return function(_0x21131e){try{jsonpatch[_0xa2ff('0x27')](_0x21131e,_0x2babee,!![]);}catch(_0x32c941){return BPromise[_0xa2ff('0x28')](_0x32c941);}return _0x21131e[_0xa2ff('0x29')]();};}function saveUpdates(_0x182d40,_0x572757){return function(_0x5263d1){if(_0x5263d1){return _0x5263d1[_0xa2ff('0x2a')](_0x182d40)[_0xa2ff('0x2b')](function(_0x2c473f){return _0x2c473f;});}return null;};}function handleEntityNotFound(_0x3b492e,_0x18faeb){return function(_0x5965bf){if(!_0x5965bf){_0x3b492e[_0xa2ff('0x1f')](0x194);}return _0x5965bf;};}function handleError(_0x5f03a5,_0x1ea19f){_0x1ea19f=_0x1ea19f||0x1f4;return function(_0x38cb4c){logger[_0xa2ff('0x2c')](_0x38cb4c[_0xa2ff('0x2d')]);if(_0x38cb4c[_0xa2ff('0x2e')]){delete _0x38cb4c[_0xa2ff('0x2e')];}_0x5f03a5[_0xa2ff('0x20')](_0x1ea19f)[_0xa2ff('0x2f')](_0x38cb4c);};}exports[_0xa2ff('0x30')]=function(_0x224e5e,_0x38ca07){var _0x2798bf={},_0x27a6e6={},_0x5076a1={'count':0x0,'rows':[]};var _0x14e9bb=_[_0xa2ff('0x31')](db[_0xa2ff('0x32')][_0xa2ff('0x33')],function(_0x3324d8){return{'name':_0x3324d8['fieldName'],'type':_0x3324d8['type'][_0xa2ff('0x34')]};});_0x27a6e6[_0xa2ff('0x35')]=_[_0xa2ff('0x31')](_0x14e9bb,_0xa2ff('0x2e'));_0x27a6e6['query']=_[_0xa2ff('0x36')](_0x224e5e[_0xa2ff('0x37')]);_0x27a6e6['filters']=_['intersection'](_0x27a6e6['model'],_0x27a6e6[_0xa2ff('0x37')]);_0x2798bf[_0xa2ff('0x38')]=_[_0xa2ff('0x39')](_0x27a6e6[_0xa2ff('0x35')],qs['fields'](_0x224e5e[_0xa2ff('0x37')][_0xa2ff('0x3a')]));_0x2798bf[_0xa2ff('0x38')]=_0x2798bf['attributes'][_0xa2ff('0x3b')]?_0x2798bf[_0xa2ff('0x38')]:_0x27a6e6[_0xa2ff('0x35')];if(!_0x224e5e[_0xa2ff('0x37')][_0xa2ff('0x3c')]('nolimit')){_0x2798bf[_0xa2ff('0x3d')]=qs['limit'](_0x224e5e['query']['limit']);_0x2798bf[_0xa2ff('0x24')]=qs[_0xa2ff('0x24')](_0x224e5e[_0xa2ff('0x37')][_0xa2ff('0x24')]);}_0x2798bf[_0xa2ff('0x3e')]=qs[_0xa2ff('0x3f')](_0x224e5e[_0xa2ff('0x37')][_0xa2ff('0x3f')]);_0x2798bf[_0xa2ff('0x40')]=qs['filters'](_[_0xa2ff('0x41')](_0x224e5e[_0xa2ff('0x37')],_0x27a6e6['filters']),_0x14e9bb);if(_0x224e5e['query'][_0xa2ff('0x42')]){_0x2798bf[_0xa2ff('0x40')]=_[_0xa2ff('0x43')](_0x2798bf[_0xa2ff('0x40')],{'$or':_['map'](_0x14e9bb,function(_0x33759f){if(_0x33759f[_0xa2ff('0x44')]!==_0xa2ff('0x45')){var _0x58667c={};_0x58667c[_0x33759f['name']]={'$like':'%'+_0x224e5e['query'][_0xa2ff('0x42')]+'%'};return _0x58667c;}})});}_0x2798bf=_[_0xa2ff('0x43')]({},_0x2798bf,_0x224e5e[_0xa2ff('0x46')]);var _0x326f1f={'where':_0x2798bf['where']};return db[_0xa2ff('0x32')][_0xa2ff('0x23')](_0x326f1f)[_0xa2ff('0x2b')](function(_0x35f9fb){_0x5076a1[_0xa2ff('0x23')]=_0x35f9fb;if(_0x224e5e[_0xa2ff('0x37')][_0xa2ff('0x47')]){_0x2798bf[_0xa2ff('0x48')]=[{'all':!![]}];}return db[_0xa2ff('0x32')][_0xa2ff('0x49')](_0x2798bf);})[_0xa2ff('0x2b')](function(_0x5d5d4b){_0x5076a1[_0xa2ff('0x4a')]=_0x5d5d4b;return _0x5076a1;})[_0xa2ff('0x2b')](respondWithFilteredResult(_0x38ca07,_0x2798bf))[_0xa2ff('0x4b')](handleError(_0x38ca07,null));};exports['show']=function(_0x483495,_0x24fbe9){var _0x5bed12={'raw':![],'where':{'id':_0x483495[_0xa2ff('0x4c')]['id']}},_0x203f21={};_0x203f21['model']=_[_0xa2ff('0x36')](db[_0xa2ff('0x32')][_0xa2ff('0x33')]);_0x203f21['query']=_[_0xa2ff('0x36')](_0x483495['query']);_0x203f21[_0xa2ff('0x4d')]=_[_0xa2ff('0x39')](_0x203f21[_0xa2ff('0x35')],_0x203f21[_0xa2ff('0x37')]);_0x5bed12[_0xa2ff('0x38')]=_['intersection'](_0x203f21[_0xa2ff('0x35')],qs[_0xa2ff('0x3a')](_0x483495[_0xa2ff('0x37')][_0xa2ff('0x3a')]));_0x5bed12[_0xa2ff('0x38')]=_0x5bed12[_0xa2ff('0x38')][_0xa2ff('0x3b')]?_0x5bed12[_0xa2ff('0x38')]:_0x203f21['model'];if(_0x483495[_0xa2ff('0x37')]['includeAll']){_0x5bed12[_0xa2ff('0x48')]=[{'all':!![]}];}_0x5bed12=_[_0xa2ff('0x43')]({},_0x5bed12,_0x483495[_0xa2ff('0x46')]);return db[_0xa2ff('0x32')]['find'](_0x5bed12)[_0xa2ff('0x2b')](handleEntityNotFound(_0x24fbe9,null))[_0xa2ff('0x2b')](respondWithResult(_0x24fbe9,null))['catch'](handleError(_0x24fbe9,null));};exports[_0xa2ff('0x4e')]=function(_0x3b5adf,_0x20bc46){return db['Team']['create'](_0x3b5adf['body'],{})[_0xa2ff('0x2b')](function(_0x4eda0a){var _0x59ce72=_0x3b5adf['user']['get']({'plain':!![]});if(!_0x59ce72)throw new Error(_0xa2ff('0x4f'));if(_0x59ce72[_0xa2ff('0x50')]===_0xa2ff('0x51')){var _0x4a9ec5=_0x4eda0a['get']({'plain':!![]});var _0x172f44=_0xa2ff('0x52');return db[_0xa2ff('0x53')][_0xa2ff('0x54')]({'where':{'name':_0x172f44,'userProfileId':_0x59ce72[_0xa2ff('0x55')]},'raw':!![]})[_0xa2ff('0x2b')](function(_0x4789c0){if(_0x4789c0&&_0x4789c0['autoAssociation']===0x0){return db[_0xa2ff('0x56')][_0xa2ff('0x4e')]({'name':_0x4a9ec5[_0xa2ff('0x2e')],'resourceId':_0x4a9ec5['id'],'type':_0x4789c0['name'],'sectionId':_0x4789c0['id']},{})[_0xa2ff('0x2b')](function(){return _0x4eda0a;});}else{return _0x4eda0a;}})['catch'](function(_0xf4bf5d){logger['error'](_0xa2ff('0x57'),_0xf4bf5d);throw _0xf4bf5d;});}return _0x4eda0a;})[_0xa2ff('0x2b')](respondWithResult(_0x20bc46,0xc9))[_0xa2ff('0x4b')](handleError(_0x20bc46,null));};exports[_0xa2ff('0x2a')]=function(_0x91640b,_0x2163d7){if(_0x91640b[_0xa2ff('0x58')]['id']){delete _0x91640b[_0xa2ff('0x58')]['id'];}return db[_0xa2ff('0x32')][_0xa2ff('0x54')]({'where':{'id':_0x91640b['params']['id']}})[_0xa2ff('0x2b')](handleEntityNotFound(_0x2163d7,null))[_0xa2ff('0x2b')](saveUpdates(_0x91640b[_0xa2ff('0x58')],null))[_0xa2ff('0x2b')](respondWithResult(_0x2163d7,null))[_0xa2ff('0x4b')](handleError(_0x2163d7,null));};exports[_0xa2ff('0x59')]=function(_0x33b0e3,_0x4719b0){var _0x3f701a=_0x33b0e3[_0xa2ff('0x4c')]['id'];var _0x449c84=[];return db[_0xa2ff('0x5a')][_0xa2ff('0x5b')](function(_0xcee8ee){var _0x50ba0c=_0xa2ff('0x5c')+_0x3f701a;return db[_0xa2ff('0x5a')][_0xa2ff('0x37')](_0x50ba0c,{'type':db[_0xa2ff('0x5d')]['QueryTypes'][_0xa2ff('0x5e')],'raw':!![],'transaction':_0xcee8ee})['then'](function(_0x50c8bc){_0x449c84=_[_0xa2ff('0x31')](_0x50c8bc,function(_0x597d89){return Number(_0x597d89['UserId']);});})[_0xa2ff('0x2b')](function(){var _0x1dc98a=_0xa2ff('0x5f')+_0x3f701a;return db[_0xa2ff('0x5a')][_0xa2ff('0x37')](_0x1dc98a,{'type':db[_0xa2ff('0x5d')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xcee8ee});})[_0xa2ff('0x2b')](function(_0x8af005){var _0xee50d2=_[_0xa2ff('0x31')](_0x8af005,function(_0x20c0a1){return Number(_0x20c0a1[_0xa2ff('0x60')]);});return db[_0xa2ff('0x61')][_0xa2ff('0x59')]({'where':{'UserId':{'$in':_0x449c84},'VoiceQueueId':{'$in':_0xee50d2}},'transaction':_0xcee8ee});})['then'](function(){var _0x2b9ed2=_0xa2ff('0x62')+_0x3f701a;return db[_0xa2ff('0x5a')][_0xa2ff('0x37')](_0x2b9ed2,{'type':db[_0xa2ff('0x5d')][_0xa2ff('0x63')][_0xa2ff('0x5e')],'raw':!![],'transaction':_0xcee8ee});})['then'](function(_0x91e498){var _0x4f95f7=_[_0xa2ff('0x31')](_0x91e498,function(_0xf93b14){return Number(_0xf93b14[_0xa2ff('0x64')]);});return db[_0xa2ff('0x65')][_0xa2ff('0x59')]({'where':{'UserId':{'$in':_0x449c84},'MailQueueId':{'$in':_0x4f95f7}},'transaction':_0xcee8ee});})[_0xa2ff('0x2b')](function(){var _0x3c6d11=_0xa2ff('0x66')+_0x3f701a;return db[_0xa2ff('0x5a')][_0xa2ff('0x37')](_0x3c6d11,{'type':db[_0xa2ff('0x5d')][_0xa2ff('0x63')][_0xa2ff('0x5e')],'raw':!![],'transaction':_0xcee8ee});})[_0xa2ff('0x2b')](function(_0x46802b){var _0x5b31a2=_['map'](_0x46802b,function(_0x1d5504){return Number(_0x1d5504[_0xa2ff('0x67')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x449c84},'SmsQueueId':{'$in':_0x5b31a2}},'transaction':_0xcee8ee});})[_0xa2ff('0x2b')](function(){var _0x350331=_0xa2ff('0x68')+_0x3f701a;return db['sequelize'][_0xa2ff('0x37')](_0x350331,{'type':db[_0xa2ff('0x5d')]['QueryTypes'][_0xa2ff('0x5e')],'raw':!![],'transaction':_0xcee8ee});})[_0xa2ff('0x2b')](function(_0x30d30d){var _0x330c1a=_['map'](_0x30d30d,function(_0x40c87e){return Number(_0x40c87e[_0xa2ff('0x69')]);});return db[_0xa2ff('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x449c84},'ChatQueueId':{'$in':_0x330c1a}},'transaction':_0xcee8ee});})[_0xa2ff('0x2b')](function(){var _0x4426d6=_0xa2ff('0x6b')+_0x3f701a;return db['sequelize'][_0xa2ff('0x37')](_0x4426d6,{'type':db[_0xa2ff('0x5d')][_0xa2ff('0x63')]['SELECT'],'raw':!![],'transaction':_0xcee8ee});})['then'](function(_0x281947){var _0x1aa5e7=_['map'](_0x281947,function(_0x42591b){return Number(_0x42591b[_0xa2ff('0x6c')]);});return db[_0xa2ff('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x449c84},'FaxQueueId':{'$in':_0x1aa5e7}},'transaction':_0xcee8ee});})[_0xa2ff('0x2b')](function(){var _0x403f92=_0xa2ff('0x6e')+_0x3f701a;return db['sequelize'][_0xa2ff('0x37')](_0x403f92,{'type':db['Sequelize']['QueryTypes'][_0xa2ff('0x5e')],'raw':!![],'transaction':_0xcee8ee});})[_0xa2ff('0x2b')](function(_0x1e31ea){var _0x1a9899=_[_0xa2ff('0x31')](_0x1e31ea,function(_0x327060){return Number(_0x327060[_0xa2ff('0x6f')]);});return db[_0xa2ff('0x70')][_0xa2ff('0x59')]({'where':{'UserId':{'$in':_0x449c84},'OpenchannelQueueId':{'$in':_0x1a9899}},'transaction':_0xcee8ee});})[_0xa2ff('0x2b')](function(){var _0x8c68cd=_0xa2ff('0x71')+_0x3f701a;return db['sequelize'][_0xa2ff('0x37')](_0x8c68cd,{'type':db[_0xa2ff('0x5d')][_0xa2ff('0x63')][_0xa2ff('0x5e')],'raw':!![],'transaction':_0xcee8ee});})[_0xa2ff('0x2b')](function(_0x3ce167){var _0x3a8148=_[_0xa2ff('0x31')](_0x3ce167,function(_0x21e566){return Number(_0x21e566[_0xa2ff('0x72')]);});return db['UserWhatsappQueue'][_0xa2ff('0x59')]({'where':{'UserId':{'$in':_0x449c84},'WhatsappQueueId':{'$in':_0x3a8148}},'transaction':_0xcee8ee});})[_0xa2ff('0x2b')](function(){return db[_0xa2ff('0x73')]['find']({'where':{'TeamId':_0x3f701a}});})['then'](function(_0xd6b6fe){if(_0xd6b6fe===null){return;}return db[_0xa2ff('0x74')][_0xa2ff('0x59')]({'where':{'UserId':{'$in':_0x449c84},'VoicePrefixId':_0xd6b6fe[_0xa2ff('0x75')]},'transaction':_0xcee8ee});})['then'](function(){return db[_0xa2ff('0x32')][_0xa2ff('0x59')]({'where':{'id':_0x3f701a},'cascade':!![],'transaction':_0xcee8ee});})['then'](function(_0x4801b9){if(_0x4801b9===0x0){_0x4719b0[_0xa2ff('0x1f')](0x194);}else{return db[_0xa2ff('0x56')][_0xa2ff('0x59')]({'where':{'type':_0xa2ff('0x52'),'resourceId':_0x3f701a},'cascade':!![],'transaction':_0xcee8ee})[_0xa2ff('0x2b')](function(){_0x4719b0[_0xa2ff('0x20')](0xcc)[_0xa2ff('0x21')]();});}})[_0xa2ff('0x4b')](function(_0x3d0c38){_0x4719b0[_0xa2ff('0x20')](0x1f4)[_0xa2ff('0x2f')](_0x3d0c38);});});};exports[_0xa2ff('0x76')]=function(_0x353e2c,_0x75195,_0x3e76a6){return db[_0xa2ff('0x32')][_0xa2ff('0x77')]({'where':{'id':_0x353e2c[_0xa2ff('0x4c')]['id']}})[_0xa2ff('0x2b')](handleEntityNotFound(_0x75195,null))['then'](function(_0x3e0913){if(!_0x353e2c[_0xa2ff('0x37')][_0xa2ff('0x78')]||!utils[_0xa2ff('0x79')](_0x353e2c[_0xa2ff('0x37')][_0xa2ff('0x78')])){throw new db['Sequelize'][(_0xa2ff('0x7a'))](_0xa2ff('0x7b'));}var _0x505755={};var _0x12df5f={};_0x12df5f[_0xa2ff('0x35')]=_[_0xa2ff('0x36')](db[_['capitalize'](_0x353e2c[_0xa2ff('0x37')]['channel'][_0xa2ff('0x7c')]())+_0xa2ff('0x7d')][_0xa2ff('0x33')]);_0x12df5f[_0xa2ff('0x37')]=_[_0xa2ff('0x36')](_0x353e2c['query']);_0x12df5f['filters']=_[_0xa2ff('0x39')](_0x12df5f[_0xa2ff('0x35')],_0x12df5f[_0xa2ff('0x37')]);_0x505755[_0xa2ff('0x38')]=_['intersection'](_0x12df5f['model'],qs[_0xa2ff('0x3a')](_0x353e2c[_0xa2ff('0x37')][_0xa2ff('0x3a')]));_0x505755[_0xa2ff('0x38')]=_0x505755['attributes']['length']?_0x505755[_0xa2ff('0x38')]:_0x12df5f['model'];_0x505755[_0xa2ff('0x3d')]=qs[_0xa2ff('0x3d')](_0x353e2c['query'][_0xa2ff('0x3d')]);_0x505755[_0xa2ff('0x24')]=qs[_0xa2ff('0x24')](_0x353e2c[_0xa2ff('0x37')][_0xa2ff('0x24')]);_0x505755['order']=qs[_0xa2ff('0x3f')](_0x353e2c['query'][_0xa2ff('0x3f')]);_0x505755[_0xa2ff('0x40')]=qs[_0xa2ff('0x4d')](_[_0xa2ff('0x41')](_0x353e2c['query'],_0x12df5f['filters']));_0x505755=_[_0xa2ff('0x43')]({},_0x505755,_0x353e2c[_0xa2ff('0x46')]);return _0x3e0913[_0xa2ff('0x7e')+_[_0xa2ff('0x7f')](_0x353e2c[_0xa2ff('0x37')][_0xa2ff('0x78')]['toLowerCase']())+'Queues'](_0x505755);})[_0xa2ff('0x2b')](respondWithResult(_0x75195,null))['catch'](handleError(_0x75195,null));};exports[_0xa2ff('0x80')]=function(_0x5c474f,_0x191022,_0x4131cd){return db[_0xa2ff('0x32')][_0xa2ff('0x77')]({'where':{'id':_0x5c474f[_0xa2ff('0x4c')]['id']}})['then'](function(_0x51da68){if(_0x51da68){if(!_0x5c474f[_0xa2ff('0x58')]['channel']||!utils[_0xa2ff('0x79')](_0x5c474f['body'][_0xa2ff('0x78')])){throw new db[(_0xa2ff('0x5d'))]['ValidationError'](_0xa2ff('0x7b'));}return _0x51da68['add'+_['capitalize'](_0x5c474f['body']['channel'][_0xa2ff('0x7c')]())+_0xa2ff('0x81')](_0x5c474f[_0xa2ff('0x58')]['ids']);}return null;})[_0xa2ff('0x2b')](handleEntityNotFound(_0x191022,null))[_0xa2ff('0x2b')](respondWithStatusCode(_0x191022,null))[_0xa2ff('0x4b')](handleError(_0x191022,null));};exports[_0xa2ff('0x82')]=function(_0x554dda,_0x2c505e,_0x5abf4f){return db[_0xa2ff('0x32')][_0xa2ff('0x77')]({'where':{'id':_0x554dda['params']['id']}})[_0xa2ff('0x2b')](function(_0x12f48a){if(_0x12f48a){if(!_0x554dda[_0xa2ff('0x37')]['channel']||!utils['isValidChannel'](_0x554dda[_0xa2ff('0x37')][_0xa2ff('0x78')])){throw new db['Sequelize'][(_0xa2ff('0x7a'))](_0xa2ff('0x7b'));}return _0x12f48a[_0xa2ff('0x83')+_['capitalize'](_0x554dda[_0xa2ff('0x37')][_0xa2ff('0x78')]['toLowerCase']())+_0xa2ff('0x81')](_0x554dda[_0xa2ff('0x37')]['ids']);}return null;})[_0xa2ff('0x2b')](handleEntityNotFound(_0x2c505e,null))[_0xa2ff('0x2b')](respondWithStatusCode(_0x2c505e,null))['catch'](handleError(_0x2c505e,null));};exports[_0xa2ff('0x84')]=function(_0x24eb68,_0x37ae6b){var _0x1d5788=_[_0xa2ff('0x85')](_0x24eb68[_0xa2ff('0x58')][_0xa2ff('0x86')])?_0x24eb68[_0xa2ff('0x58')][_0xa2ff('0x86')]:[_0x24eb68[_0xa2ff('0x58')][_0xa2ff('0x86')]];var _0x14b5a5=_0x24eb68[_0xa2ff('0x4c')]['id'];return db[_0xa2ff('0x32')]['find']({'where':{'id':_0x14b5a5}})[_0xa2ff('0x2b')](handleEntityNotFound(_0x37ae6b,null))[_0xa2ff('0x2b')](function(_0xc16dfd){if(_0xc16dfd){var _0x4d0061=[_0xa2ff('0x87'),_0xa2ff('0x88'),_0xa2ff('0x89'),_0xa2ff('0x8a'),_0xa2ff('0x8b'),_0xa2ff('0x8c'),_0xa2ff('0x8d')];return db['sequelize'][_0xa2ff('0x5b')](function(_0x350b34){var _0x35171e=_['map'](_0x4d0061,function(_0x52affc){var _0x95239d={'attributes':['id',_0xa2ff('0x2e')]};if(_0x52affc===_0xa2ff('0x87')){_0x95239d[_0xa2ff('0x8e')]={'attributes':[_0xa2ff('0x8f')]};}return _0xc16dfd[_0xa2ff('0x7e')+_0x52affc+_0xa2ff('0x81')](_0x95239d)['then'](function(_0x3fa9c0){var _0x15d968=_['map'](_0x3fa9c0,function(_0x3c6e88){var _0x5acfc4=_[_0xa2ff('0x31')](_0x1d5788,function(_0x502e09){var _0x5bdc25={'where':{'UserId':_0x502e09,[_0x52affc+_0xa2ff('0x90')]:_0x3c6e88['id']},'transaction':_0x350b34};if(_0x52affc===_0xa2ff('0x87')){_0x5bdc25['defaults']={'penalty':_0x3c6e88[_0xa2ff('0x91')]['penalty']};}return db[_0xa2ff('0x92')+_0x52affc+'Queue'][_0xa2ff('0x93')](_0x5bdc25)[_0xa2ff('0x2b')](function(){socket[_0xa2ff('0x94')](_0xa2ff('0x51')+_0x52affc+_0xa2ff('0x95'),{'UserId':_0x502e09,[_0x52affc+_0xa2ff('0x90')]:_0x3c6e88['id']});if(_0x52affc!==_0xa2ff('0x87')){return;}return db[_0xa2ff('0x92')][_0xa2ff('0x49')]({'where':{'id':_0x1d5788,'online':0x1},'attributes':['id',_0xa2ff('0x2e'),_0xa2ff('0x96'),_0xa2ff('0x97'),_0xa2ff('0x98')],'raw':!![]})[_0xa2ff('0x2b')](function(_0x2fec63){var _0xae5b9f=_[_0xa2ff('0x31')](_0x2fec63,function(_0x62b25){return db['UserVoiceQueueRt'][_0xa2ff('0x99')]({'membername':_0x62b25[_0xa2ff('0x2e')],'UserId':_0x62b25['id'],'queue_name':_0x3c6e88[_0xa2ff('0x2e')],'VoiceQueueId':_0x3c6e88['id'],'interface':_[_0xa2ff('0x9a')](_0x62b25[_0xa2ff('0x98')])?util[_0xa2ff('0x9b')](_0xa2ff('0x9c'),_0x62b25[_0xa2ff('0x2e')]):_0x62b25[_0xa2ff('0x98')],'paused':_0x62b25[_0xa2ff('0x97')]||![],'penalty':_0x3c6e88[_0xa2ff('0x91')][_0xa2ff('0x8f')]},{'transaction':_0x350b34});});return Promise[_0xa2ff('0x9d')](_0xae5b9f);});});});return Promise[_0xa2ff('0x9d')](_0x5acfc4);});return Promise[_0xa2ff('0x9d')](_0x15d968);})[_0xa2ff('0x2b')](function(){return db[_0xa2ff('0x73')]['findOne']({'where':{'teamId':_0x14b5a5}})[_0xa2ff('0x2b')](function(_0x3ce310){if(_0x3ce310){var _0x20bedd=_['map'](_0x1d5788,function(_0x4cc861){db[_0xa2ff('0x74')][_0xa2ff('0x99')]({'UserId':_0x4cc861,'VoicePrefixId':_0x3ce310['VoicePrefixId']});});return Promise[_0xa2ff('0x9d')](_0x20bedd);}});});});return Promise[_0xa2ff('0x9d')](_0x35171e)[_0xa2ff('0x2b')](function(){return _0xc16dfd[_0xa2ff('0x84')](_0x1d5788,{'transaction':_0x350b34})[_0xa2ff('0x9e')](function(_0x35211c){return _0x35211c;});});});}})['then'](respondWithResult(_0x37ae6b,null))['catch'](handleError(_0x37ae6b,null));};exports[_0xa2ff('0x9f')]=function(_0x4442f8,_0x23503b){var _0x4ab0b2=_['isArray'](_0x4442f8[_0xa2ff('0x37')][_0xa2ff('0x86')])?_0x4442f8[_0xa2ff('0x37')][_0xa2ff('0x86')]:[_0x4442f8[_0xa2ff('0x37')][_0xa2ff('0x86')]];var _0x27aa24=_0x4442f8[_0xa2ff('0x4c')]['id'];return db[_0xa2ff('0x32')][_0xa2ff('0x54')]({'where':{'id':_0x27aa24}})['then'](handleEntityNotFound(_0x23503b,null))[_0xa2ff('0x2b')](function(_0xb075fb){if(_0xb075fb){var _0x1abc62=[_0xa2ff('0x87'),_0xa2ff('0x88'),_0xa2ff('0x89'),_0xa2ff('0x8a'),_0xa2ff('0x8b'),_0xa2ff('0x8c'),_0xa2ff('0x8d')];return db['sequelize']['transaction'](function(_0x171ba5){var _0xdf6294=_[_0xa2ff('0x31')](_0x1abc62,function(_0x1996f8){var _0x121828={'attributes':['id',_0xa2ff('0x2e')]};return _0xb075fb[_0xa2ff('0x7e')+_0x1996f8+'Queues'](_0x121828)[_0xa2ff('0x2b')](function(_0x467e03){var _0x233761=_[_0xa2ff('0x31')](_0x467e03,function(_0x543659){return _0x543659[_0xa2ff('0x9f')](_0x4ab0b2,{'transaction':_0x171ba5})['then'](function(){var _0x3fb544=_['map'](_0x4ab0b2,function(_0x6d063a){socket[_0xa2ff('0x94')](_0xa2ff('0x51')+_0x1996f8+_0xa2ff('0xa0'),{'UserId':Number(_0x6d063a),[_0x1996f8+'QueueId']:_0x543659['id']});if(_0x1996f8!==_0xa2ff('0x87')){return;}return db[_0xa2ff('0xa1')]['destroy']({'where':{'VoiceQueueId':_0x543659['id'],'UserId':_0x6d063a},'transaction':_0x171ba5});});return Promise['all'](_0x3fb544);});});return Promise[_0xa2ff('0x9d')](_0x233761);});});return Promise[_0xa2ff('0x9d')](_0xdf6294)['then'](function(){return _0xb075fb[_0xa2ff('0x9f')](_0x4ab0b2,{'transaction':_0x171ba5});})['then'](function(){return db[_0xa2ff('0x73')]['findOne']({'where':{'teamId':_0x27aa24}})[_0xa2ff('0x2b')](function(_0x401184){if(_0x401184){var _0x55fc83=_[_0xa2ff('0x31')](_0x4ab0b2,function(_0x1d449a){db[_0xa2ff('0x74')][_0xa2ff('0x59')]({'where':{'UserId':_0x1d449a,'VoicePrefixId':_0x401184[_0xa2ff('0x75')]}});});return Promise[_0xa2ff('0x9d')](_0x55fc83);}});});});}})[_0xa2ff('0x2b')](respondWithStatusCode(_0x23503b,null))[_0xa2ff('0x4b')](handleError(_0x23503b,null));};exports['getAgents']=function(_0x47cf94,_0x322bf2,_0x25a5ee){var _0x43e089={};var _0x54a73a={};var _0x37797c;var _0x360638;return db['Team'][_0xa2ff('0x77')]({'where':{'id':_0x47cf94['params']['id']}})['then'](handleEntityNotFound(_0x322bf2,null))[_0xa2ff('0x2b')](function(_0x10fe63){if(_0x10fe63){_0x37797c=_0x10fe63;_0x54a73a[_0xa2ff('0x35')]=_['keys'](db[_0xa2ff('0x92')][_0xa2ff('0x33')]);_0x54a73a['query']=_[_0xa2ff('0x36')](_0x47cf94[_0xa2ff('0x37')]);_0x54a73a[_0xa2ff('0x4d')]=_[_0xa2ff('0x39')](_0x54a73a[_0xa2ff('0x35')],_0x54a73a['query']);_0x43e089[_0xa2ff('0x38')]=_['intersection'](_0x54a73a[_0xa2ff('0x35')],qs['fields'](_0x47cf94['query'][_0xa2ff('0x3a')]));_0x43e089[_0xa2ff('0x38')]=_0x43e089[_0xa2ff('0x38')][_0xa2ff('0x3b')]?_0x43e089['attributes']:_0x54a73a[_0xa2ff('0x35')];_0x43e089[_0xa2ff('0x3e')]=qs[_0xa2ff('0x3f')](_0x47cf94[_0xa2ff('0x37')][_0xa2ff('0x3f')]);_0x43e089['where']=qs[_0xa2ff('0x4d')](_[_0xa2ff('0x41')](_0x47cf94[_0xa2ff('0x37')],_0x54a73a[_0xa2ff('0x4d')]));if(_0x47cf94['query'][_0xa2ff('0x42')]){_0x43e089[_0xa2ff('0x40')]=_[_0xa2ff('0x43')](_0x43e089[_0xa2ff('0x40')],{'$or':_['map'](_0x43e089['attributes'],function(_0x1b0b0b){var _0x42be7a={};_0x42be7a[_0x1b0b0b]={'$like':'%'+_0x47cf94[_0xa2ff('0x37')][_0xa2ff('0x42')]+'%'};return _0x42be7a;})});}_0x43e089=_['merge']({},_0x43e089,_0x47cf94[_0xa2ff('0x46')]);return _0x37797c[_0xa2ff('0xa2')](_0x43e089);}})[_0xa2ff('0x2b')](function(_0x4ba19e){if(_0x4ba19e){_0x360638=_0x4ba19e['length'];if(!_0x47cf94[_0xa2ff('0x37')]['hasOwnProperty'](_0xa2ff('0xa3'))){_0x43e089['limit']=qs[_0xa2ff('0x3d')](_0x47cf94[_0xa2ff('0x37')]['limit']);_0x43e089[_0xa2ff('0x24')]=qs[_0xa2ff('0x24')](_0x47cf94[_0xa2ff('0x37')]['offset']);}return _0x37797c[_0xa2ff('0xa2')](_0x43e089);}})[_0xa2ff('0x2b')](function(_0x12399d){if(_0x12399d){return _0x12399d?{'count':_0x360638,'rows':_0x12399d}:null;}})[_0xa2ff('0x2b')](respondWithResult(_0x322bf2,null))[_0xa2ff('0x4b')](handleError(_0x322bf2,null));}; \ No newline at end of file +var _0x1f8f=['querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','error','stack','name','status','send','index','map','Team','rawAttributes','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','params','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','end','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','filters','Queues','findOne','removeQueues','remove','ids','addAgents','Voice','Chat','Sms','Fax','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','upsert','interface','SIP/%s','all','VoicePrefixId','removeAgents','isArray','Mail','Openchannel','Queue:remove','UserVoiceQueueRt','getAgents','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','squel','jsforce','desk.js'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1f8f,0x1b2));var _0xf1f8=function(_0x138b36,_0x4a39fb){_0x138b36=_0x138b36-0x0;var _0x3ac8e5=_0x1f8f[_0x138b36];return _0x3ac8e5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf1f8('0x0'));var rp=require('request-promise');var moment=require(_0xf1f8('0x1'));var BPromise=require(_0xf1f8('0x2'));var Mustache=require('mustache');var util=require(_0xf1f8('0x3'));var path=require('path');var sox=require(_0xf1f8('0x4'));var csv=require(_0xf1f8('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1f8('0x6'));var _=require('lodash');var squel=require(_0xf1f8('0x7'));var crypto=require('crypto');var jsforce=require(_0xf1f8('0x8'));var deskjs=require(_0xf1f8('0x9'));var toCsv=require('to-csv');var querystring=require(_0xf1f8('0xa'));var Papa=require(_0xf1f8('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf1f8('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf1f8('0xd'));var logger=require(_0xf1f8('0xe'))('api');var utils=require(_0xf1f8('0xf'));var config=require(_0xf1f8('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf1f8('0x11')]=_[_0xf1f8('0x12')](config[_0xf1f8('0x11')],{'host':_0xf1f8('0x13'),'port':0x18eb});var socket=require(_0xf1f8('0x14'))(new Redis(config[_0xf1f8('0x11')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x4ec7fc,_0x3affed){_0x3affed=_0x3affed||0xcc;return function(_0x16b490){if(_0x16b490){return _0x4ec7fc[_0xf1f8('0x15')](_0x3affed);}return _0x4ec7fc['status'](_0x3affed)['end']();};}function respondWithResult(_0x192710,_0x29844f){_0x29844f=_0x29844f||0xc8;return function(_0x1ed1cf){if(_0x1ed1cf){return _0x192710['status'](_0x29844f)[_0xf1f8('0x16')](_0x1ed1cf);}};}function respondWithFilteredResult(_0x114024,_0x5e4f22){return function(_0x31752b){if(_0x31752b){var _0x3b85ae=typeof _0x5e4f22[_0xf1f8('0x17')]==='undefined'&&typeof _0x5e4f22['limit']===_0xf1f8('0x18');var _0x7393c6=_0x31752b[_0xf1f8('0x19')];var _0x4d0439=_0x3b85ae?0x0:_0x5e4f22[_0xf1f8('0x17')];var _0x4b9bf6=_0x3b85ae?_0x31752b[_0xf1f8('0x19')]:_0x5e4f22[_0xf1f8('0x17')]+_0x5e4f22[_0xf1f8('0x1a')];var _0x524ae7;if(_0x4b9bf6>=_0x7393c6){_0x4b9bf6=_0x7393c6;_0x524ae7=0xc8;}else{_0x524ae7=0xce;}_0x114024['status'](_0x524ae7);return _0x114024[_0xf1f8('0x1b')](_0xf1f8('0x1c'),_0x4d0439+'-'+_0x4b9bf6+'/'+_0x7393c6)['json'](_0x31752b);}return null;};}function patchUpdates(_0x2acf99){return function(_0x2cffd0){try{jsonpatch['apply'](_0x2cffd0,_0x2acf99,!![]);}catch(_0x23315a){return BPromise[_0xf1f8('0x1d')](_0x23315a);}return _0x2cffd0['save']();};}function saveUpdates(_0x4c444e,_0x364f50){return function(_0x34d325){if(_0x34d325){return _0x34d325[_0xf1f8('0x1e')](_0x4c444e)[_0xf1f8('0x1f')](function(_0x2bb53b){return _0x2bb53b;});}return null;};}function handleEntityNotFound(_0x528e7b,_0x224c81){return function(_0x51bd5f){if(!_0x51bd5f){_0x528e7b[_0xf1f8('0x15')](0x194);}return _0x51bd5f;};}function handleError(_0x1138fc,_0x5ae9dd){_0x5ae9dd=_0x5ae9dd||0x1f4;return function(_0xcdb03c){logger[_0xf1f8('0x20')](_0xcdb03c[_0xf1f8('0x21')]);if(_0xcdb03c[_0xf1f8('0x22')]){delete _0xcdb03c['name'];}_0x1138fc[_0xf1f8('0x23')](_0x5ae9dd)[_0xf1f8('0x24')](_0xcdb03c);};}exports[_0xf1f8('0x25')]=function(_0x3a584e,_0x606f09){var _0x27f885={},_0xd9b3ff={},_0x13aec9={'count':0x0,'rows':[]};var _0x4ac13c=_[_0xf1f8('0x26')](db[_0xf1f8('0x27')][_0xf1f8('0x28')],function(_0x398444){return{'name':_0x398444['fieldName'],'type':_0x398444['type'][_0xf1f8('0x29')]};});_0xd9b3ff[_0xf1f8('0x2a')]=_[_0xf1f8('0x26')](_0x4ac13c,'name');_0xd9b3ff['query']=_[_0xf1f8('0x2b')](_0x3a584e['query']);_0xd9b3ff['filters']=_[_0xf1f8('0x2c')](_0xd9b3ff[_0xf1f8('0x2a')],_0xd9b3ff[_0xf1f8('0x2d')]);_0x27f885[_0xf1f8('0x2e')]=_[_0xf1f8('0x2c')](_0xd9b3ff['model'],qs[_0xf1f8('0x2f')](_0x3a584e[_0xf1f8('0x2d')][_0xf1f8('0x2f')]));_0x27f885[_0xf1f8('0x2e')]=_0x27f885[_0xf1f8('0x2e')][_0xf1f8('0x30')]?_0x27f885[_0xf1f8('0x2e')]:_0xd9b3ff[_0xf1f8('0x2a')];if(!_0x3a584e['query'][_0xf1f8('0x31')](_0xf1f8('0x32'))){_0x27f885[_0xf1f8('0x1a')]=qs[_0xf1f8('0x1a')](_0x3a584e[_0xf1f8('0x2d')]['limit']);_0x27f885[_0xf1f8('0x17')]=qs[_0xf1f8('0x17')](_0x3a584e[_0xf1f8('0x2d')][_0xf1f8('0x17')]);}_0x27f885[_0xf1f8('0x33')]=qs['sort'](_0x3a584e[_0xf1f8('0x2d')][_0xf1f8('0x34')]);_0x27f885[_0xf1f8('0x35')]=qs['filters'](_[_0xf1f8('0x36')](_0x3a584e['query'],_0xd9b3ff['filters']),_0x4ac13c);if(_0x3a584e[_0xf1f8('0x2d')][_0xf1f8('0x37')]){_0x27f885[_0xf1f8('0x35')]=_[_0xf1f8('0x38')](_0x27f885['where'],{'$or':_[_0xf1f8('0x26')](_0x4ac13c,function(_0x183b69){if(_0x183b69[_0xf1f8('0x39')]!==_0xf1f8('0x3a')){var _0x144250={};_0x144250[_0x183b69[_0xf1f8('0x22')]]={'$like':'%'+_0x3a584e[_0xf1f8('0x2d')][_0xf1f8('0x37')]+'%'};return _0x144250;}})});}_0x27f885=_[_0xf1f8('0x38')]({},_0x27f885,_0x3a584e[_0xf1f8('0x3b')]);var _0xebf8b8={'where':_0x27f885[_0xf1f8('0x35')]};return db[_0xf1f8('0x27')][_0xf1f8('0x19')](_0xebf8b8)[_0xf1f8('0x1f')](function(_0x2eb1ae){_0x13aec9[_0xf1f8('0x19')]=_0x2eb1ae;if(_0x3a584e['query'][_0xf1f8('0x3c')]){_0x27f885[_0xf1f8('0x3d')]=[{'all':!![]}];}return db['Team'][_0xf1f8('0x3e')](_0x27f885);})[_0xf1f8('0x1f')](function(_0x45bb31){_0x13aec9[_0xf1f8('0x3f')]=_0x45bb31;return _0x13aec9;})[_0xf1f8('0x1f')](respondWithFilteredResult(_0x606f09,_0x27f885))['catch'](handleError(_0x606f09,null));};exports[_0xf1f8('0x40')]=function(_0x1812a2,_0x2b5ff5){var _0xd36a8a={'raw':![],'where':{'id':_0x1812a2['params']['id']}},_0x787b93={};_0x787b93['model']=_[_0xf1f8('0x2b')](db[_0xf1f8('0x27')]['rawAttributes']);_0x787b93[_0xf1f8('0x2d')]=_['keys'](_0x1812a2[_0xf1f8('0x2d')]);_0x787b93['filters']=_[_0xf1f8('0x2c')](_0x787b93[_0xf1f8('0x2a')],_0x787b93[_0xf1f8('0x2d')]);_0xd36a8a[_0xf1f8('0x2e')]=_[_0xf1f8('0x2c')](_0x787b93[_0xf1f8('0x2a')],qs[_0xf1f8('0x2f')](_0x1812a2[_0xf1f8('0x2d')][_0xf1f8('0x2f')]));_0xd36a8a['attributes']=_0xd36a8a['attributes'][_0xf1f8('0x30')]?_0xd36a8a[_0xf1f8('0x2e')]:_0x787b93['model'];if(_0x1812a2[_0xf1f8('0x2d')][_0xf1f8('0x3c')]){_0xd36a8a[_0xf1f8('0x3d')]=[{'all':!![]}];}_0xd36a8a=_['merge']({},_0xd36a8a,_0x1812a2[_0xf1f8('0x3b')]);return db[_0xf1f8('0x27')]['find'](_0xd36a8a)[_0xf1f8('0x1f')](handleEntityNotFound(_0x2b5ff5,null))[_0xf1f8('0x1f')](respondWithResult(_0x2b5ff5,null))[_0xf1f8('0x41')](handleError(_0x2b5ff5,null));};exports[_0xf1f8('0x42')]=function(_0x59054f,_0x94aa76){return db[_0xf1f8('0x27')][_0xf1f8('0x42')](_0x59054f[_0xf1f8('0x43')],{})[_0xf1f8('0x1f')](function(_0x1e90b7){var _0x34978b=_0x59054f[_0xf1f8('0x44')][_0xf1f8('0x45')]({'plain':!![]});if(!_0x34978b)throw new Error(_0xf1f8('0x46'));if(_0x34978b['role']==='user'){var _0xd7443b=_0x1e90b7[_0xf1f8('0x45')]({'plain':!![]});var _0xc76329=_0xf1f8('0x47');return db[_0xf1f8('0x48')][_0xf1f8('0x49')]({'where':{'name':_0xc76329,'userProfileId':_0x34978b[_0xf1f8('0x4a')]},'raw':!![]})['then'](function(_0x23cc81){if(_0x23cc81&&_0x23cc81[_0xf1f8('0x4b')]===0x0){return db[_0xf1f8('0x4c')][_0xf1f8('0x42')]({'name':_0xd7443b[_0xf1f8('0x22')],'resourceId':_0xd7443b['id'],'type':_0x23cc81[_0xf1f8('0x22')],'sectionId':_0x23cc81['id']},{})[_0xf1f8('0x1f')](function(){return _0x1e90b7;});}else{return _0x1e90b7;}})[_0xf1f8('0x41')](function(_0x2bc0fc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bc0fc);throw _0x2bc0fc;});}return _0x1e90b7;})[_0xf1f8('0x1f')](respondWithResult(_0x94aa76,0xc9))[_0xf1f8('0x41')](handleError(_0x94aa76,null));};exports[_0xf1f8('0x1e')]=function(_0x58d204,_0x1dd15f){if(_0x58d204['body']['id']){delete _0x58d204['body']['id'];}return db[_0xf1f8('0x27')][_0xf1f8('0x49')]({'where':{'id':_0x58d204[_0xf1f8('0x4d')]['id']}})[_0xf1f8('0x1f')](handleEntityNotFound(_0x1dd15f,null))[_0xf1f8('0x1f')](saveUpdates(_0x58d204[_0xf1f8('0x43')],null))[_0xf1f8('0x1f')](respondWithResult(_0x1dd15f,null))[_0xf1f8('0x41')](handleError(_0x1dd15f,null));};exports[_0xf1f8('0x4e')]=function(_0x3caa38,_0x13f08c){var _0x2d9ecd=_0x3caa38['params']['id'];var _0x216676=[];return db['sequelize'][_0xf1f8('0x4f')](function(_0x164a75){var _0x1c1fe8=_0xf1f8('0x50')+_0x2d9ecd;return db[_0xf1f8('0x51')][_0xf1f8('0x2d')](_0x1c1fe8,{'type':db[_0xf1f8('0x52')][_0xf1f8('0x53')][_0xf1f8('0x54')],'raw':!![],'transaction':_0x164a75})[_0xf1f8('0x1f')](function(_0x37eef8){_0x216676=_[_0xf1f8('0x26')](_0x37eef8,function(_0xd53a43){return Number(_0xd53a43[_0xf1f8('0x55')]);});})[_0xf1f8('0x1f')](function(){var _0xce7769=_0xf1f8('0x56')+_0x2d9ecd;return db['sequelize'][_0xf1f8('0x2d')](_0xce7769,{'type':db['Sequelize'][_0xf1f8('0x53')][_0xf1f8('0x54')],'raw':!![],'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(_0x4cd923){var _0x1e58b4=_['map'](_0x4cd923,function(_0x147d38){return Number(_0x147d38[_0xf1f8('0x57')]);});return db[_0xf1f8('0x58')][_0xf1f8('0x4e')]({'where':{'UserId':{'$in':_0x216676},'VoiceQueueId':{'$in':_0x1e58b4}},'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(){var _0x5a0a73='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2d9ecd;return db[_0xf1f8('0x51')][_0xf1f8('0x2d')](_0x5a0a73,{'type':db[_0xf1f8('0x52')][_0xf1f8('0x53')]['SELECT'],'raw':!![],'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(_0x468677){var _0x36e477=_[_0xf1f8('0x26')](_0x468677,function(_0x3ec219){return Number(_0x3ec219[_0xf1f8('0x59')]);});return db[_0xf1f8('0x5a')]['destroy']({'where':{'UserId':{'$in':_0x216676},'MailQueueId':{'$in':_0x36e477}},'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(){var _0x18c871=_0xf1f8('0x5b')+_0x2d9ecd;return db[_0xf1f8('0x51')]['query'](_0x18c871,{'type':db[_0xf1f8('0x52')][_0xf1f8('0x53')]['SELECT'],'raw':!![],'transaction':_0x164a75});})['then'](function(_0x3d7b24){var _0xce7ffe=_['map'](_0x3d7b24,function(_0x26d6f0){return Number(_0x26d6f0[_0xf1f8('0x5c')]);});return db[_0xf1f8('0x5d')][_0xf1f8('0x4e')]({'where':{'UserId':{'$in':_0x216676},'SmsQueueId':{'$in':_0xce7ffe}},'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(){var _0x50d99a=_0xf1f8('0x5e')+_0x2d9ecd;return db['sequelize'][_0xf1f8('0x2d')](_0x50d99a,{'type':db[_0xf1f8('0x52')]['QueryTypes'][_0xf1f8('0x54')],'raw':!![],'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(_0x3026b2){var _0x53e9d3=_[_0xf1f8('0x26')](_0x3026b2,function(_0x48e91f){return Number(_0x48e91f[_0xf1f8('0x5f')]);});return db[_0xf1f8('0x60')][_0xf1f8('0x4e')]({'where':{'UserId':{'$in':_0x216676},'ChatQueueId':{'$in':_0x53e9d3}},'transaction':_0x164a75});})['then'](function(){var _0x2ec972='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2d9ecd;return db[_0xf1f8('0x51')][_0xf1f8('0x2d')](_0x2ec972,{'type':db[_0xf1f8('0x52')]['QueryTypes'][_0xf1f8('0x54')],'raw':!![],'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(_0x178934){var _0x8c4aba=_[_0xf1f8('0x26')](_0x178934,function(_0x2716ec){return Number(_0x2716ec[_0xf1f8('0x61')]);});return db[_0xf1f8('0x62')]['destroy']({'where':{'UserId':{'$in':_0x216676},'FaxQueueId':{'$in':_0x8c4aba}},'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(){var _0x475e1d=_0xf1f8('0x63')+_0x2d9ecd;return db[_0xf1f8('0x51')][_0xf1f8('0x2d')](_0x475e1d,{'type':db[_0xf1f8('0x52')][_0xf1f8('0x53')]['SELECT'],'raw':!![],'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(_0x5e7760){var _0x43aebf=_[_0xf1f8('0x26')](_0x5e7760,function(_0x49f637){return Number(_0x49f637[_0xf1f8('0x64')]);});return db[_0xf1f8('0x65')][_0xf1f8('0x4e')]({'where':{'UserId':{'$in':_0x216676},'OpenchannelQueueId':{'$in':_0x43aebf}},'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(){var _0x17bb7e=_0xf1f8('0x66')+_0x2d9ecd;return db[_0xf1f8('0x51')]['query'](_0x17bb7e,{'type':db[_0xf1f8('0x52')][_0xf1f8('0x53')][_0xf1f8('0x54')],'raw':!![],'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(_0x20fbf3){var _0xecf58=_[_0xf1f8('0x26')](_0x20fbf3,function(_0x297f98){return Number(_0x297f98[_0xf1f8('0x67')]);});return db['UserWhatsappQueue'][_0xf1f8('0x4e')]({'where':{'UserId':{'$in':_0x216676},'WhatsappQueueId':{'$in':_0xecf58}},'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(){return db[_0xf1f8('0x68')][_0xf1f8('0x49')]({'where':{'TeamId':_0x2d9ecd}});})[_0xf1f8('0x1f')](function(_0x16bd16){if(_0x16bd16===null){return;}return db[_0xf1f8('0x69')][_0xf1f8('0x4e')]({'where':{'UserId':{'$in':_0x216676},'VoicePrefixId':_0x16bd16['VoicePrefixId']},'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(){return db[_0xf1f8('0x27')][_0xf1f8('0x4e')]({'where':{'id':_0x2d9ecd},'cascade':!![],'transaction':_0x164a75});})[_0xf1f8('0x1f')](function(_0x51c436){if(_0x51c436===0x0){_0x13f08c['sendStatus'](0x194);}else{return db['UserProfileResource'][_0xf1f8('0x4e')]({'where':{'type':'Teams','resourceId':_0x2d9ecd},'cascade':!![],'transaction':_0x164a75})[_0xf1f8('0x1f')](function(){_0x13f08c[_0xf1f8('0x23')](0xcc)[_0xf1f8('0x6a')]();});}})[_0xf1f8('0x41')](function(_0x5d56d2){_0x13f08c[_0xf1f8('0x23')](0x1f4)[_0xf1f8('0x24')](_0x5d56d2);});});};exports['getQueues']=function(_0x1e16cb,_0x2d64f9,_0x49d353){return db['Team']['findOne']({'where':{'id':_0x1e16cb[_0xf1f8('0x4d')]['id']}})[_0xf1f8('0x1f')](handleEntityNotFound(_0x2d64f9,null))['then'](function(_0x396c29){if(!_0x1e16cb[_0xf1f8('0x2d')][_0xf1f8('0x6b')]||!utils[_0xf1f8('0x6c')](_0x1e16cb['query'][_0xf1f8('0x6b')])){throw new db[(_0xf1f8('0x52'))][(_0xf1f8('0x6d'))](_0xf1f8('0x6e'));}var _0x30e53a={};var _0x51bb5f={};_0x51bb5f[_0xf1f8('0x2a')]=_[_0xf1f8('0x2b')](db[_[_0xf1f8('0x6f')](_0x1e16cb['query']['channel'][_0xf1f8('0x70')]())+_0xf1f8('0x71')][_0xf1f8('0x28')]);_0x51bb5f[_0xf1f8('0x2d')]=_['keys'](_0x1e16cb['query']);_0x51bb5f[_0xf1f8('0x72')]=_[_0xf1f8('0x2c')](_0x51bb5f['model'],_0x51bb5f['query']);_0x30e53a[_0xf1f8('0x2e')]=_[_0xf1f8('0x2c')](_0x51bb5f[_0xf1f8('0x2a')],qs['fields'](_0x1e16cb['query']['fields']));_0x30e53a['attributes']=_0x30e53a[_0xf1f8('0x2e')]['length']?_0x30e53a['attributes']:_0x51bb5f[_0xf1f8('0x2a')];_0x30e53a[_0xf1f8('0x1a')]=qs[_0xf1f8('0x1a')](_0x1e16cb['query']['limit']);_0x30e53a[_0xf1f8('0x17')]=qs[_0xf1f8('0x17')](_0x1e16cb[_0xf1f8('0x2d')][_0xf1f8('0x17')]);_0x30e53a[_0xf1f8('0x33')]=qs[_0xf1f8('0x34')](_0x1e16cb['query'][_0xf1f8('0x34')]);_0x30e53a[_0xf1f8('0x35')]=qs['filters'](_[_0xf1f8('0x36')](_0x1e16cb['query'],_0x51bb5f[_0xf1f8('0x72')]));_0x30e53a=_[_0xf1f8('0x38')]({},_0x30e53a,_0x1e16cb[_0xf1f8('0x3b')]);return _0x396c29[_0xf1f8('0x45')+_['capitalize'](_0x1e16cb['query']['channel'][_0xf1f8('0x70')]())+_0xf1f8('0x73')](_0x30e53a);})[_0xf1f8('0x1f')](respondWithResult(_0x2d64f9,null))[_0xf1f8('0x41')](handleError(_0x2d64f9,null));};exports['addQueues']=function(_0x2be808,_0x338610,_0x54f0b5){return db[_0xf1f8('0x27')][_0xf1f8('0x74')]({'where':{'id':_0x2be808['params']['id']}})[_0xf1f8('0x1f')](function(_0x3df13){if(_0x3df13){if(!_0x2be808[_0xf1f8('0x43')][_0xf1f8('0x6b')]||!utils[_0xf1f8('0x6c')](_0x2be808['body'][_0xf1f8('0x6b')])){throw new db[(_0xf1f8('0x52'))][(_0xf1f8('0x6d'))]('Unknown\x20channel');}return _0x3df13['add'+_[_0xf1f8('0x6f')](_0x2be808[_0xf1f8('0x43')]['channel'][_0xf1f8('0x70')]())+_0xf1f8('0x73')](_0x2be808[_0xf1f8('0x43')]['ids']);}return null;})[_0xf1f8('0x1f')](handleEntityNotFound(_0x338610,null))[_0xf1f8('0x1f')](respondWithStatusCode(_0x338610,null))[_0xf1f8('0x41')](handleError(_0x338610,null));};exports[_0xf1f8('0x75')]=function(_0x187d6d,_0x4906d7,_0x150a3a){return db[_0xf1f8('0x27')][_0xf1f8('0x74')]({'where':{'id':_0x187d6d[_0xf1f8('0x4d')]['id']}})['then'](function(_0x5b7776){if(_0x5b7776){if(!_0x187d6d[_0xf1f8('0x2d')]['channel']||!utils[_0xf1f8('0x6c')](_0x187d6d[_0xf1f8('0x2d')][_0xf1f8('0x6b')])){throw new db[(_0xf1f8('0x52'))][(_0xf1f8('0x6d'))](_0xf1f8('0x6e'));}return _0x5b7776[_0xf1f8('0x76')+_['capitalize'](_0x187d6d['query'][_0xf1f8('0x6b')][_0xf1f8('0x70')]())+_0xf1f8('0x73')](_0x187d6d[_0xf1f8('0x2d')][_0xf1f8('0x77')]);}return null;})[_0xf1f8('0x1f')](handleEntityNotFound(_0x4906d7,null))[_0xf1f8('0x1f')](respondWithStatusCode(_0x4906d7,null))['catch'](handleError(_0x4906d7,null));};exports[_0xf1f8('0x78')]=function(_0x1be675,_0x273edb){var _0x479ae7=_['isArray'](_0x1be675[_0xf1f8('0x43')][_0xf1f8('0x77')])?_0x1be675['body']['ids']:[_0x1be675[_0xf1f8('0x43')][_0xf1f8('0x77')]];var _0x1226d5=_0x1be675[_0xf1f8('0x4d')]['id'];return db[_0xf1f8('0x27')]['find']({'where':{'id':_0x1226d5}})[_0xf1f8('0x1f')](handleEntityNotFound(_0x273edb,null))['then'](function(_0x563168){if(_0x563168){var _0x37363e=[_0xf1f8('0x79'),_0xf1f8('0x7a'),'Mail',_0xf1f8('0x7b'),_0xf1f8('0x7c'),'Openchannel',_0xf1f8('0x7d')];return db[_0xf1f8('0x51')][_0xf1f8('0x4f')](function(_0x4fea2e){var _0x1240f7=_[_0xf1f8('0x26')](_0x37363e,function(_0x24279e){var _0x1ac09b={'attributes':['id',_0xf1f8('0x22')]};if(_0x24279e===_0xf1f8('0x79')){_0x1ac09b[_0xf1f8('0x7e')]={'attributes':[_0xf1f8('0x7f')]};}return _0x563168[_0xf1f8('0x45')+_0x24279e+_0xf1f8('0x73')](_0x1ac09b)[_0xf1f8('0x1f')](function(_0x2a334a){var _0x406f5f=_[_0xf1f8('0x26')](_0x2a334a,function(_0x1ecc8b){var _0x975bf6=_[_0xf1f8('0x26')](_0x479ae7,function(_0x4046bf){var _0x3c52f4={'where':{'UserId':_0x4046bf,[_0x24279e+_0xf1f8('0x80')]:_0x1ecc8b['id']},'transaction':_0x4fea2e};if(_0x24279e===_0xf1f8('0x79')){_0x3c52f4[_0xf1f8('0x12')]={'penalty':_0x1ecc8b[_0xf1f8('0x81')][_0xf1f8('0x7f')]};}return db[_0xf1f8('0x82')+_0x24279e+'Queue'][_0xf1f8('0x83')](_0x3c52f4)['then'](function(){socket[_0xf1f8('0x84')](_0xf1f8('0x44')+_0x24279e+_0xf1f8('0x85'),{'UserId':_0x4046bf,[_0x24279e+_0xf1f8('0x80')]:_0x1ecc8b['id']});if(_0x24279e!=='Voice'){return;}return db[_0xf1f8('0x82')][_0xf1f8('0x3e')]({'where':{'id':_0x479ae7,'online':0x1},'attributes':['id',_0xf1f8('0x22'),_0xf1f8('0x86'),_0xf1f8('0x87'),'interface'],'raw':!![]})[_0xf1f8('0x1f')](function(_0x34e7aa){var _0x2f997d=_['map'](_0x34e7aa,function(_0x599191){return db['UserVoiceQueueRt'][_0xf1f8('0x88')]({'membername':_0x599191[_0xf1f8('0x22')],'UserId':_0x599191['id'],'queue_name':_0x1ecc8b[_0xf1f8('0x22')],'VoiceQueueId':_0x1ecc8b['id'],'interface':_['isNil'](_0x599191[_0xf1f8('0x89')])?util['format'](_0xf1f8('0x8a'),_0x599191[_0xf1f8('0x22')]):_0x599191[_0xf1f8('0x89')],'paused':_0x599191['voicePause']||![],'penalty':_0x1ecc8b['TeamVoiceQueue'][_0xf1f8('0x7f')]},{'transaction':_0x4fea2e});});return Promise[_0xf1f8('0x8b')](_0x2f997d);});});});return Promise['all'](_0x975bf6);});return Promise['all'](_0x406f5f);})[_0xf1f8('0x1f')](function(){return db['TeamVoicePrefix'][_0xf1f8('0x74')]({'where':{'teamId':_0x1226d5}})[_0xf1f8('0x1f')](function(_0xb40d7b){if(_0xb40d7b){var _0x241d75=_[_0xf1f8('0x26')](_0x479ae7,function(_0x3f4b49){db[_0xf1f8('0x69')]['upsert']({'UserId':_0x3f4b49,'VoicePrefixId':_0xb40d7b[_0xf1f8('0x8c')]});});return Promise[_0xf1f8('0x8b')](_0x241d75);}});});});return Promise[_0xf1f8('0x8b')](_0x1240f7)[_0xf1f8('0x1f')](function(){return _0x563168[_0xf1f8('0x78')](_0x479ae7,{'transaction':_0x4fea2e})['spread'](function(_0x16288c){return _0x16288c;});});});}})[_0xf1f8('0x1f')](respondWithResult(_0x273edb,null))['catch'](handleError(_0x273edb,null));};exports[_0xf1f8('0x8d')]=function(_0x14f2a0,_0x4f2029){var _0x52d6b2=_[_0xf1f8('0x8e')](_0x14f2a0[_0xf1f8('0x2d')][_0xf1f8('0x77')])?_0x14f2a0['query'][_0xf1f8('0x77')]:[_0x14f2a0['query'][_0xf1f8('0x77')]];var _0x17c0c5=_0x14f2a0[_0xf1f8('0x4d')]['id'];return db[_0xf1f8('0x27')]['find']({'where':{'id':_0x17c0c5}})[_0xf1f8('0x1f')](handleEntityNotFound(_0x4f2029,null))[_0xf1f8('0x1f')](function(_0x42e9d3){if(_0x42e9d3){var _0x310822=[_0xf1f8('0x79'),_0xf1f8('0x7a'),_0xf1f8('0x8f'),_0xf1f8('0x7b'),_0xf1f8('0x7c'),_0xf1f8('0x90'),_0xf1f8('0x7d')];return db['sequelize'][_0xf1f8('0x4f')](function(_0x30ae48){var _0x4d8ebd=_[_0xf1f8('0x26')](_0x310822,function(_0x19d827){var _0x517651={'attributes':['id',_0xf1f8('0x22')]};return _0x42e9d3[_0xf1f8('0x45')+_0x19d827+_0xf1f8('0x73')](_0x517651)[_0xf1f8('0x1f')](function(_0x1e1941){var _0x135216=_['map'](_0x1e1941,function(_0x1bc5ce){return _0x1bc5ce[_0xf1f8('0x8d')](_0x52d6b2,{'transaction':_0x30ae48})['then'](function(){var _0x5c5f9a=_['map'](_0x52d6b2,function(_0x793eeb){socket['emit'](_0xf1f8('0x44')+_0x19d827+_0xf1f8('0x91'),{'UserId':Number(_0x793eeb),[_0x19d827+_0xf1f8('0x80')]:_0x1bc5ce['id']});if(_0x19d827!==_0xf1f8('0x79')){return;}return db[_0xf1f8('0x92')][_0xf1f8('0x4e')]({'where':{'VoiceQueueId':_0x1bc5ce['id'],'UserId':_0x793eeb},'transaction':_0x30ae48});});return Promise[_0xf1f8('0x8b')](_0x5c5f9a);});});return Promise[_0xf1f8('0x8b')](_0x135216);});});return Promise['all'](_0x4d8ebd)['then'](function(){return _0x42e9d3[_0xf1f8('0x8d')](_0x52d6b2,{'transaction':_0x30ae48});})[_0xf1f8('0x1f')](function(){return db[_0xf1f8('0x68')]['findOne']({'where':{'teamId':_0x17c0c5}})[_0xf1f8('0x1f')](function(_0xbd9af5){if(_0xbd9af5){var _0x459541=_[_0xf1f8('0x26')](_0x52d6b2,function(_0xc7454e){db['UserVoicePrefix'][_0xf1f8('0x4e')]({'where':{'UserId':_0xc7454e,'VoicePrefixId':_0xbd9af5[_0xf1f8('0x8c')]}});});return Promise[_0xf1f8('0x8b')](_0x459541);}});});});}})['then'](respondWithStatusCode(_0x4f2029,null))['catch'](handleError(_0x4f2029,null));};exports[_0xf1f8('0x93')]=function(_0x343ba9,_0x18e99a,_0x37786e){var _0xeca447={};var _0x4798f4={};var _0x32fa70;var _0x5f93e8;return db[_0xf1f8('0x27')][_0xf1f8('0x74')]({'where':{'id':_0x343ba9[_0xf1f8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x18e99a,null))[_0xf1f8('0x1f')](function(_0x1eb593){if(_0x1eb593){_0x32fa70=_0x1eb593;_0x4798f4[_0xf1f8('0x2a')]=_[_0xf1f8('0x2b')](db[_0xf1f8('0x82')]['rawAttributes']);_0x4798f4[_0xf1f8('0x2d')]=_[_0xf1f8('0x2b')](_0x343ba9[_0xf1f8('0x2d')]);_0x4798f4['filters']=_['intersection'](_0x4798f4[_0xf1f8('0x2a')],_0x4798f4[_0xf1f8('0x2d')]);_0xeca447[_0xf1f8('0x2e')]=_[_0xf1f8('0x2c')](_0x4798f4[_0xf1f8('0x2a')],qs[_0xf1f8('0x2f')](_0x343ba9['query'][_0xf1f8('0x2f')]));_0xeca447[_0xf1f8('0x2e')]=_0xeca447['attributes'][_0xf1f8('0x30')]?_0xeca447[_0xf1f8('0x2e')]:_0x4798f4[_0xf1f8('0x2a')];_0xeca447['order']=qs[_0xf1f8('0x34')](_0x343ba9[_0xf1f8('0x2d')]['sort']);_0xeca447[_0xf1f8('0x35')]=qs[_0xf1f8('0x72')](_[_0xf1f8('0x36')](_0x343ba9[_0xf1f8('0x2d')],_0x4798f4[_0xf1f8('0x72')]));if(_0x343ba9[_0xf1f8('0x2d')]['filter']){_0xeca447[_0xf1f8('0x35')]=_[_0xf1f8('0x38')](_0xeca447[_0xf1f8('0x35')],{'$or':_[_0xf1f8('0x26')](_0xeca447['attributes'],function(_0x1e0bdc){var _0x5b7e33={};_0x5b7e33[_0x1e0bdc]={'$like':'%'+_0x343ba9[_0xf1f8('0x2d')][_0xf1f8('0x37')]+'%'};return _0x5b7e33;})});}_0xeca447=_[_0xf1f8('0x38')]({},_0xeca447,_0x343ba9[_0xf1f8('0x3b')]);return _0x32fa70[_0xf1f8('0x93')](_0xeca447);}})[_0xf1f8('0x1f')](function(_0x4adb71){if(_0x4adb71){_0x5f93e8=_0x4adb71[_0xf1f8('0x30')];if(!_0x343ba9['query']['hasOwnProperty'](_0xf1f8('0x32'))){_0xeca447[_0xf1f8('0x1a')]=qs['limit'](_0x343ba9[_0xf1f8('0x2d')][_0xf1f8('0x1a')]);_0xeca447[_0xf1f8('0x17')]=qs[_0xf1f8('0x17')](_0x343ba9[_0xf1f8('0x2d')][_0xf1f8('0x17')]);}return _0x32fa70['getAgents'](_0xeca447);}})[_0xf1f8('0x1f')](function(_0x44822d){if(_0x44822d){return _0x44822d?{'count':_0x5f93e8,'rows':_0x44822d}:null;}})['then'](respondWithResult(_0x18e99a,null))[_0xf1f8('0x41')](handleError(_0x18e99a,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index ea05ff5..3b01073 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 _0xecae=['exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0xe752d3,_0x11e502){var _0x2f7f85=function(_0x4dcf13){while(--_0x4dcf13){_0xe752d3['push'](_0xe752d3['shift']());}};_0x2f7f85(++_0x11e502);}(_0xecae,0xa9));var _0xeeca=function(_0x239521,_0x40d672){_0x239521=_0x239521-0x0;var _0x21d6cc=_0xecae[_0x239521];return _0x21d6cc;};'use strict';var EventEmitter=require(_0xeeca('0x0'));var Team=require(_0xeeca('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xeeca('0x2')](0x0);var events={'afterCreate':_0xeeca('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x18c998){return function(_0x563740,_0x42e642,_0x24691b){TeamEvents[_0xeeca('0x4')](_0x18c998+':'+_0x563740['id'],_0x563740);TeamEvents[_0xeeca('0x4')](_0x18c998,_0x563740);_0x24691b(null);};}for(var e in events){if(events[_0xeeca('0x5')](e)){var event=events[e];Team[_0xeeca('0x6')](e,emitEvent(event));}}module[_0xeeca('0x7')]=TeamEvents; \ No newline at end of file +var _0x7eca=['save','remove','emit','hasOwnProperty','hook','exports','events','Team','setMaxListeners'];(function(_0x4dbc5d,_0x2d0a51){var _0x45b461=function(_0x3e73ab){while(--_0x3e73ab){_0x4dbc5d['push'](_0x4dbc5d['shift']());}};_0x45b461(++_0x2d0a51);}(_0x7eca,0x15c));var _0xa7ec=function(_0x2dd27d,_0x5567a7){_0x2dd27d=_0x2dd27d-0x0;var _0x5d6b98=_0x7eca[_0x2dd27d];return _0x5d6b98;};'use strict';var EventEmitter=require(_0xa7ec('0x0'));var Team=require('../../mysqldb')['db'][_0xa7ec('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xa7ec('0x2')](0x0);var events={'afterCreate':_0xa7ec('0x3'),'afterUpdate':'update','afterDestroy':_0xa7ec('0x4')};function emitEvent(_0xa5011b){return function(_0x21a8b6,_0x3a4cc4,_0x53f6ac){TeamEvents['emit'](_0xa5011b+':'+_0x21a8b6['id'],_0x21a8b6);TeamEvents[_0xa7ec('0x5')](_0xa5011b,_0x21a8b6);_0x53f6ac(null);};}for(var e in events){if(events[_0xa7ec('0x6')](e)){var event=events[e];Team[_0xa7ec('0x7')](e,emitEvent(event));}}module[_0xa7ec('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 4c29048..1b4b8f0 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 _0x31a3=['all','lodash','./team.attributes','get','Queues','map','setDataValue','channel','catch','define','Team','teams','Fax','Mail','Sms','then'];(function(_0x227779,_0x312afc){var _0x4fbb93=function(_0x5ac8ec){while(--_0x5ac8ec){_0x227779['push'](_0x227779['shift']());}};_0x4fbb93(++_0x312afc);}(_0x31a3,0x1e1));var _0x331a=function(_0x9b7721,_0x36ef2f){_0x9b7721=_0x9b7721-0x0;var _0x2c92de=_0x31a3[_0x9b7721];return _0x2c92de;};'use strict';var _=require(_0x331a('0x0'));var attributes=require(_0x331a('0x1'));function getQueuesByChannel(_0x2c54e3,_0x554abe){var _0x2118b9=_0x331a('0x2')+_0x554abe+_0x331a('0x3');return _0x2c54e3[_0x2118b9]()['then'](function(_0x47f66c){return _[_0x331a('0x4')](_0x47f66c,function(_0x47be5b){_0x47be5b[_0x331a('0x5')](_0x331a('0x6'),_0x554abe);return _0x47be5b;});})[_0x331a('0x7')](function(_0x2d71dc){throw _0x2d71dc;});}module['exports']=function(_0x6c4c3c){return _0x6c4c3c[_0x331a('0x8')](_0x331a('0x9'),attributes,{'tableName':_0x331a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x11dd96=this;var _0x1910ae=['Chat',_0x331a('0xb'),_0x331a('0xc'),'Openchannel',_0x331a('0xd'),'Voice','Whatsapp'];return Promise['resolve']()[_0x331a('0xe')](function(){var _0x2b8565=_[_0x331a('0x4')](_0x1910ae,function(_0x4551e7){return getQueuesByChannel(_0x11dd96,_0x4551e7);});return Promise[_0x331a('0xf')](_0x2b8565);})[_0x331a('0x7')](function(_0x2e1c0d){throw _0x2e1c0d;});}}});}; \ No newline at end of file +var _0x8462=['Openchannel','Sms','Voice','Whatsapp','resolve','map','all','lodash','./team.attributes','get','then','channel','catch','define','Team','teams','Chat','Fax','Mail'];(function(_0x1b8e2e,_0xb2b37c){var _0x9f7d98=function(_0x14eb02){while(--_0x14eb02){_0x1b8e2e['push'](_0x1b8e2e['shift']());}};_0x9f7d98(++_0xb2b37c);}(_0x8462,0xc5));var _0x2846=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0x8462[_0x18a436];return _0x5c2cf8;};'use strict';var _=require(_0x2846('0x0'));var attributes=require(_0x2846('0x1'));function getQueuesByChannel(_0x2f0f10,_0x53a42a){var _0xe200ae=_0x2846('0x2')+_0x53a42a+'Queues';return _0x2f0f10[_0xe200ae]()[_0x2846('0x3')](function(_0x5dc413){return _['map'](_0x5dc413,function(_0x249e51){_0x249e51['setDataValue'](_0x2846('0x4'),_0x53a42a);return _0x249e51;});})[_0x2846('0x5')](function(_0x3f58d1){throw _0x3f58d1;});}module['exports']=function(_0x1d96d1){return _0x1d96d1[_0x2846('0x6')](_0x2846('0x7'),attributes,{'tableName':_0x2846('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x61a63b=this;var _0x4345b6=[_0x2846('0x9'),_0x2846('0xa'),_0x2846('0xb'),_0x2846('0xc'),_0x2846('0xd'),_0x2846('0xe'),_0x2846('0xf')];return Promise[_0x2846('0x10')]()[_0x2846('0x3')](function(){var _0x151cab=_[_0x2846('0x11')](_0x4345b6,function(_0x3f60c2){return getQueuesByChannel(_0x61a63b,_0x3f60c2);});return Promise[_0x2846('0x12')](_0x151cab);})['catch'](function(_0x3dfe27){throw _0x3dfe27;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 003c313..abb25bb 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 _0x5110=['debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x7f105a,_0x2f0052){var _0x8a1ab8=function(_0x1c4eed){while(--_0x1c4eed){_0x7f105a['push'](_0x7f105a['shift']());}};_0x8a1ab8(++_0x2f0052);}(_0x5110,0x19e));var _0x0511=function(_0x29bef8,_0x578bbf){_0x29bef8=_0x29bef8-0x0;var _0x59cfc5=_0x5110[_0x29bef8];return _0x59cfc5;};'use strict';var _=require(_0x0511('0x0'));var util=require(_0x0511('0x1'));var moment=require(_0x0511('0x2'));var BPromise=require(_0x0511('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0511('0x4'))['db'];var utils=require(_0x0511('0x5'));var logger=require(_0x0511('0x6'))(_0x0511('0x7'));var config=require(_0x0511('0x8'));var jayson=require(_0x0511('0x9'));var client=jayson[_0x0511('0xa')][_0x0511('0xb')]({'port':0x232a});config[_0x0511('0xc')]=_[_0x0511('0xd')](config['redis'],{'host':_0x0511('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0511('0xc')]));require(_0x0511('0xf'))['register'](socket);function respondWithRpcPromise(_0x2629f7,_0x19b214,_0xec7f22){return new BPromise(function(_0x468526,_0x59f461){return client[_0x0511('0x10')](_0x2629f7,_0xec7f22)[_0x0511('0x11')](function(_0x1d47de){logger[_0x0511('0x12')](_0x0511('0x13'),_0x19b214,_0x0511('0x14'));logger[_0x0511('0x15')](_0x0511('0x16'),_0x19b214,_0x0511('0x14'),JSON[_0x0511('0x17')](_0x1d47de));if(_0x1d47de[_0x0511('0x18')]){if(_0x1d47de[_0x0511('0x18')][_0x0511('0x19')]===0x1f4){logger[_0x0511('0x18')](_0x0511('0x13'),_0x19b214,_0x1d47de[_0x0511('0x18')][_0x0511('0x1a')]);return _0x59f461(_0x1d47de[_0x0511('0x18')][_0x0511('0x1a')]);}logger[_0x0511('0x18')](_0x0511('0x13'),_0x19b214,_0x1d47de[_0x0511('0x18')][_0x0511('0x1a')]);return _0x468526(_0x1d47de[_0x0511('0x18')]['message']);}else{logger['info'](_0x0511('0x13'),_0x19b214,_0x0511('0x14'));_0x468526(_0x1d47de[_0x0511('0x1b')]['message']);}})[_0x0511('0x1c')](function(_0x4c79ae){logger['error'](_0x0511('0x13'),_0x19b214,_0x4c79ae);_0x59f461(_0x4c79ae);});});} \ No newline at end of file +var _0x71e0=['Team,\x20%s,\x20%s','message','info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4b7b0a,_0x4d68ee){var _0x29354f=function(_0x4af58a){while(--_0x4af58a){_0x4b7b0a['push'](_0x4b7b0a['shift']());}};_0x29354f(++_0x4d68ee);}(_0x71e0,0x8b));var _0x071e=function(_0x3edfd4,_0x3441be){_0x3edfd4=_0x3edfd4-0x0;var _0x3bb9c2=_0x71e0[_0x3edfd4];return _0x3bb9c2;};'use strict';var _=require(_0x071e('0x0'));var util=require('util');var moment=require(_0x071e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x071e('0x2'));var db=require(_0x071e('0x3'))['db'];var utils=require(_0x071e('0x4'));var logger=require(_0x071e('0x5'))(_0x071e('0x6'));var config=require(_0x071e('0x7'));var jayson=require(_0x071e('0x8'));var client=jayson[_0x071e('0x9')]['http']({'port':0x232a});config[_0x071e('0xa')]=_[_0x071e('0xb')](config['redis'],{'host':_0x071e('0xc'),'port':0x18eb});var socket=require(_0x071e('0xd'))(new Redis(config[_0x071e('0xa')]));require(_0x071e('0xe'))['register'](socket);function respondWithRpcPromise(_0x3414d9,_0x659b05,_0x27400e){return new BPromise(function(_0x35ae14,_0x578a78){return client[_0x071e('0xf')](_0x3414d9,_0x27400e)[_0x071e('0x10')](function(_0x4a62fc){logger['info']('Team,\x20%s,\x20%s',_0x659b05,_0x071e('0x11'));logger[_0x071e('0x12')](_0x071e('0x13'),_0x659b05,'request\x20sent',JSON[_0x071e('0x14')](_0x4a62fc));if(_0x4a62fc[_0x071e('0x15')]){if(_0x4a62fc[_0x071e('0x15')][_0x071e('0x16')]===0x1f4){logger[_0x071e('0x15')](_0x071e('0x17'),_0x659b05,_0x4a62fc[_0x071e('0x15')][_0x071e('0x18')]);return _0x578a78(_0x4a62fc[_0x071e('0x15')][_0x071e('0x18')]);}logger[_0x071e('0x15')](_0x071e('0x17'),_0x659b05,_0x4a62fc['error'][_0x071e('0x18')]);return _0x35ae14(_0x4a62fc[_0x071e('0x15')]['message']);}else{logger[_0x071e('0x19')](_0x071e('0x17'),_0x659b05,_0x071e('0x11'));_0x35ae14(_0x4a62fc['result'][_0x071e('0x18')]);}})[_0x071e('0x1a')](function(_0x30d728){logger[_0x071e('0x15')](_0x071e('0x17'),_0x659b05,_0x30d728);_0x578a78(_0x30d728);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 21eb031..4959513 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 _0x4746=['length','team:','./team.events','save','update','emit','register'];(function(_0x43b852,_0x591eba){var _0x10d838=function(_0x58f467){while(--_0x58f467){_0x43b852['push'](_0x43b852['shift']());}};_0x10d838(++_0x591eba);}(_0x4746,0xc6));var _0x6474=function(_0x546dc3,_0x14a203){_0x546dc3=_0x546dc3-0x0;var _0x142c53=_0x4746[_0x546dc3];return _0x142c53;};'use strict';var TeamEvents=require(_0x6474('0x0'));var events=[_0x6474('0x1'),'remove',_0x6474('0x2')];function createListener(_0x59b95a,_0xd115f7){return function(_0x244bc5){_0xd115f7[_0x6474('0x3')](_0x59b95a,_0x244bc5);};}function removeListener(_0x156374,_0x1314f4){return function(){TeamEvents['removeListener'](_0x156374,_0x1314f4);};}exports[_0x6474('0x4')]=function(_0x2bcf7c){for(var _0x4cadd7=0x0,_0x433af9=events[_0x6474('0x5')];_0x4cadd7<_0x433af9;_0x4cadd7++){var _0xcd065e=events[_0x4cadd7];var _0xec3cda=createListener(_0x6474('0x6')+_0xcd065e,_0x2bcf7c);TeamEvents['on'](_0xcd065e,_0xec3cda);}}; \ No newline at end of file +var _0x112f=['emit','register','length','team:','./team.events','remove'];(function(_0x1878db,_0x18d9f6){var _0x1ae242=function(_0x5a66d7){while(--_0x5a66d7){_0x1878db['push'](_0x1878db['shift']());}};_0x1ae242(++_0x18d9f6);}(_0x112f,0x11e));var _0xf112=function(_0x1f15a0,_0x4a2ed9){_0x1f15a0=_0x1f15a0-0x0;var _0x52ae38=_0x112f[_0x1f15a0];return _0x52ae38;};'use strict';var TeamEvents=require(_0xf112('0x0'));var events=['save',_0xf112('0x1'),'update'];function createListener(_0x3c60e2,_0x4443ae){return function(_0x56e8cf){_0x4443ae[_0xf112('0x2')](_0x3c60e2,_0x56e8cf);};}function removeListener(_0x584bbb,_0x44a5f1){return function(){TeamEvents['removeListener'](_0x584bbb,_0x44a5f1);};}exports[_0xf112('0x3')]=function(_0x2ca020){for(var _0x1b060d=0x0,_0x1b62b4=events[_0xf112('0x4')];_0x1b060d<_0x1b62b4;_0x1b060d++){var _0x3f0411=events[_0x1b060d];var _0x48aaf0=createListener(_0xf112('0x5')+_0x3f0411,_0x2ca020);TeamEvents['on'](_0x3f0411,_0x48aaf0);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index fab30f0..4a1e9bc 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb441=['INTEGER','sequelize'];(function(_0x4fa4c2,_0x489ba7){var _0x1c4753=function(_0x4e479d){while(--_0x4e479d){_0x4fa4c2['push'](_0x4fa4c2['shift']());}};_0x1c4753(++_0x489ba7);}(_0xb441,0xa5));var _0x1b44=function(_0x437d68,_0x5e6599){_0x437d68=_0x437d68-0x0;var _0xc99ec=_0xb441[_0x437d68];return _0xc99ec;};'use strict';var Sequelize=require(_0x1b44('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x1b44('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf9bb=['sequelize','exports','INTEGER'];(function(_0x487e48,_0x232219){var _0x934dbb=function(_0x12a6bb){while(--_0x12a6bb){_0x487e48['push'](_0x487e48['shift']());}};_0x934dbb(++_0x232219);}(_0xf9bb,0x14d));var _0xbf9b=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0xf9bb[_0x576170];return _0x397c70;};'use strict';var Sequelize=require(_0xbf9b('0x0'));module[_0xbf9b('0x1')]={'TeamId':{'type':Sequelize[_0xbf9b('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index a1b75af..87f9d43 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa45c=['request-promise','rimraf','exports','define','team_has_voice_prefixes','lodash','util','moment'];(function(_0x4c7918,_0x3b2d45){var _0x32e4a5=function(_0x20908a){while(--_0x20908a){_0x4c7918['push'](_0x4c7918['shift']());}};_0x32e4a5(++_0x3b2d45);}(_0xa45c,0x6d));var _0xca45=function(_0x5e35e8,_0x59401c){_0x5e35e8=_0x5e35e8-0x0;var _0x2d619a=_0xa45c[_0x5e35e8];return _0x2d619a;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xca45('0x2'));var BPromise=require('bluebird');var rp=require(_0xca45('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca45('0x4'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0xca45('0x5')]=function(_0x3803d6,_0x18d789){return _0x3803d6[_0xca45('0x6')]('TeamVoicePrefix',attributes,{'tableName':_0xca45('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x082b=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','team_has_voice_prefixes','lodash','util','../../config/logger'];(function(_0x1ce25b,_0xc18eb8){var _0x577059=function(_0x5615a7){while(--_0x5615a7){_0x1ce25b['push'](_0x1ce25b['shift']());}};_0x577059(++_0xc18eb8);}(_0x082b,0x1ec));var _0xb082=function(_0x464f25,_0x1dcae3){_0x464f25=_0x464f25-0x0;var _0x4be4f9=_0x082b[_0x464f25];return _0x4be4f9;};'use strict';var _=require(_0xb082('0x0'));var util=require(_0xb082('0x1'));var logger=require(_0xb082('0x2'))(_0xb082('0x3'));var moment=require('moment');var BPromise=require(_0xb082('0x4'));var rp=require(_0xb082('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb082('0x6'));var config=require(_0xb082('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0xb082('0x8')]=function(_0x37b715,_0x16e0b8){return _0x37b715[_0xb082('0x9')]('TeamVoicePrefix',attributes,{'tableName':_0xb082('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index bd2f425..30a5496 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(_0x1d850e,_0x723bc4){var _0x2efd1f=function(_0x4aabc7){while(--_0x4aabc7){_0x1d850e['push'](_0x1d850e['shift']());}};_0x2efd1f(++_0x723bc4);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x279727,_0x3737ee){var _0x742ac9=function(_0x437909){while(--_0x437909){_0x279727['push'](_0x279727['shift']());}};_0x742ac9(++_0x3737ee);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xcb91[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 83297b4..0de7ef4 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 _0x5590=['sequelize','exports','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5590,0x11a));var _0x0559=function(_0x499a68,_0x45c5e2){_0x499a68=_0x499a68-0x0;var _0x32bea2=_0x5590[_0x499a68];return _0x32bea2;};'use strict';var Sequelize=require(_0x0559('0x0'));module[_0x0559('0x1')]={'penalty':{'type':Sequelize[_0x0559('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x07b1=['INTEGER','sequelize'];(function(_0x37095c,_0x175b9d){var _0x491fd4=function(_0x47312f){while(--_0x47312f){_0x37095c['push'](_0x37095c['shift']());}};_0x491fd4(++_0x175b9d);}(_0x07b1,0x1a9));var _0x107b=function(_0x33dff0,_0x42960d){_0x33dff0=_0x33dff0-0x0;var _0x8a1455=_0x07b1[_0x33dff0];return _0x8a1455;};'use strict';var Sequelize=require(_0x107b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x107b('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 01f46a3..e534a09 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 _0xf6d1=['api','moment','bluebird','request-promise','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger'];(function(_0x2d2d01,_0x299680){var _0x4614f0=function(_0xa114c1){while(--_0xa114c1){_0x2d2d01['push'](_0x2d2d01['shift']());}};_0x4614f0(++_0x299680);}(_0xf6d1,0x99));var _0x1f6d=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xf6d1[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x1f6d('0x0'));var util=require(_0x1f6d('0x1'));var logger=require(_0x1f6d('0x2'))(_0x1f6d('0x3'));var moment=require(_0x1f6d('0x4'));var BPromise=require(_0x1f6d('0x5'));var rp=require(_0x1f6d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f6d('0x7'));var config=require('../../config/environment');var attributes=require(_0x1f6d('0x8'));module[_0x1f6d('0x9')]=function(_0x1278cf,_0x927c3c){return _0x1278cf[_0x1f6d('0xa')](_0x1f6d('0xb'),attributes,{'tableName':_0x1f6d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5ca=['bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger'];(function(_0x310236,_0x2a17e3){var _0xea9e8c=function(_0x41508f){while(--_0x41508f){_0x310236['push'](_0x310236['shift']());}};_0xea9e8c(++_0x2a17e3);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0xa5ca[_0x209ec9];return _0x129b1b;};'use strict';var _=require(_0xaa5c('0x0'));var util=require(_0xaa5c('0x1'));var logger=require(_0xaa5c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xaa5c('0x3'));var rp=require(_0xaa5c('0x4'));var fs=require('fs');var path=require(_0xaa5c('0x5'));var rimraf=require(_0xaa5c('0x6'));var config=require(_0xaa5c('0x7'));var attributes=require(_0xaa5c('0x8'));module['exports']=function(_0x5bbe71,_0x49da9b){return _0x5bbe71[_0xaa5c('0x9')](_0xaa5c('0xa'),attributes,{'tableName':_0xaa5c('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 7b1c5fe..690dbc1 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 _0x0662=['stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x0662,0x175));var _0x2066=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x0662[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require('lodash');var util=require(_0x2066('0x0'));var moment=require(_0x2066('0x1'));var BPromise=require(_0x2066('0x2'));var rs=require(_0x2066('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2066('0x4'))['db'];var utils=require(_0x2066('0x5'));var logger=require(_0x2066('0x6'))(_0x2066('0x7'));var config=require(_0x2066('0x8'));var jayson=require(_0x2066('0x9'));var client=jayson[_0x2066('0xa')][_0x2066('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38e656,_0x23ee81,_0x2999ed){return new BPromise(function(_0x510675,_0x1f82a2){return client[_0x2066('0xc')](_0x38e656,_0x2999ed)[_0x2066('0xd')](function(_0x1bb145){logger[_0x2066('0xe')](_0x2066('0xf'),_0x23ee81,_0x2066('0x10'));logger[_0x2066('0x11')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x23ee81,_0x2066('0x10'),JSON[_0x2066('0x12')](_0x1bb145));if(_0x1bb145[_0x2066('0x13')]){if(_0x1bb145[_0x2066('0x13')][_0x2066('0x14')]===0x1f4){logger[_0x2066('0x13')](_0x2066('0xf'),_0x23ee81,_0x1bb145[_0x2066('0x13')][_0x2066('0x15')]);return _0x1f82a2(_0x1bb145[_0x2066('0x13')][_0x2066('0x15')]);}logger[_0x2066('0x13')](_0x2066('0xf'),_0x23ee81,_0x1bb145[_0x2066('0x13')][_0x2066('0x15')]);return _0x510675(_0x1bb145[_0x2066('0x13')]['message']);}else{logger['info'](_0x2066('0xf'),_0x23ee81,_0x2066('0x10'));_0x510675(_0x1bb145[_0x2066('0x16')]['message']);}})['catch'](function(_0x2fbce4){logger[_0x2066('0x13')](_0x2066('0xf'),_0x23ee81,_0x2fbce4);_0x1f82a2(_0x2fbce4);});});} \ No newline at end of file +var _0x2333=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','randomstring','ioredis'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x2333,0x11a));var _0x3233=function(_0x1588ba,_0x5a0a16){_0x1588ba=_0x1588ba-0x0;var _0xd003ce=_0x2333[_0x1588ba];return _0xd003ce;};'use strict';var _=require(_0x3233('0x0'));var util=require(_0x3233('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3233('0x2'));var fs=require('fs');var Redis=require(_0x3233('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3233('0x4'));var logger=require(_0x3233('0x5'))(_0x3233('0x6'));var config=require(_0x3233('0x7'));var jayson=require(_0x3233('0x8'));var client=jayson[_0x3233('0x9')][_0x3233('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33a56d,_0x1e93e8,_0x1842a1){return new BPromise(function(_0x1837b6,_0x2ee6df){return client[_0x3233('0xb')](_0x33a56d,_0x1842a1)[_0x3233('0xc')](function(_0x7ff4bd){logger[_0x3233('0xd')](_0x3233('0xe'),_0x1e93e8,_0x3233('0xf'));logger[_0x3233('0x10')](_0x3233('0x11'),_0x1e93e8,_0x3233('0xf'),JSON['stringify'](_0x7ff4bd));if(_0x7ff4bd[_0x3233('0x12')]){if(_0x7ff4bd[_0x3233('0x12')][_0x3233('0x13')]===0x1f4){logger[_0x3233('0x12')](_0x3233('0xe'),_0x1e93e8,_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);return _0x2ee6df(_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);}logger[_0x3233('0x12')](_0x3233('0xe'),_0x1e93e8,_0x7ff4bd[_0x3233('0x12')][_0x3233('0x14')]);return _0x1837b6(_0x7ff4bd['error']['message']);}else{logger[_0x3233('0xd')](_0x3233('0xe'),_0x1e93e8,_0x3233('0xf'));_0x1837b6(_0x7ff4bd['result'][_0x3233('0x14')]);}})[_0x3233('0x15')](function(_0x127227){logger['error'](_0x3233('0xe'),_0x1e93e8,_0x127227);_0x2ee6df(_0x127227);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 4617de7..b99baa5 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 _0x4123=['Router','fs-extra','../../components/auth/service','./template.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x5b6532,_0x592fdd){var _0x13fbc1=function(_0x51887b){while(--_0x51887b){_0x5b6532['push'](_0x5b6532['shift']());}};_0x13fbc1(++_0x592fdd);}(_0x4123,0x87));var _0x3412=function(_0x56e2a8,_0x2cf877){_0x56e2a8=_0x56e2a8-0x0;var _0x232412=_0x4123[_0x56e2a8];return _0x232412;};'use strict';var multer=require(_0x3412('0x0'));var util=require(_0x3412('0x1'));var path=require(_0x3412('0x2'));var timeout=require(_0x3412('0x3'));var express=require(_0x3412('0x4'));var router=express[_0x3412('0x5')]();var fs_extra=require(_0x3412('0x6'));var auth=require(_0x3412('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3412('0x8'));router[_0x3412('0x9')]('/',auth['isAuthenticated'](),controller[_0x3412('0xa')]);router[_0x3412('0x9')](_0x3412('0xb'),auth[_0x3412('0xc')](),controller[_0x3412('0xd')]);router[_0x3412('0xe')]('/',auth['isAuthenticated'](),controller[_0x3412('0xf')]);router[_0x3412('0x10')](_0x3412('0xb'),auth[_0x3412('0xc')](),controller[_0x3412('0x11')]);router[_0x3412('0x12')](_0x3412('0xb'),auth[_0x3412('0xc')](),controller[_0x3412('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5a13=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./template.controller','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x2b5125,_0x1173d2){var _0x1bcd69=function(_0x2ba87b){while(--_0x2ba87b){_0x2b5125['push'](_0x2b5125['shift']());}};_0x1bcd69(++_0x1173d2);}(_0x5a13,0x92));var _0x35a1=function(_0x54e511,_0x2bc2b3){_0x54e511=_0x54e511-0x0;var _0x2be8e0=_0x5a13[_0x54e511];return _0x2be8e0;};'use strict';var multer=require('multer');var util=require(_0x35a1('0x0'));var path=require(_0x35a1('0x1'));var timeout=require(_0x35a1('0x2'));var express=require(_0x35a1('0x3'));var router=express[_0x35a1('0x4')]();var fs_extra=require(_0x35a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x35a1('0x6'));var config=require('../../config/environment');var controller=require(_0x35a1('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x35a1('0x8')](_0x35a1('0x9'),auth[_0x35a1('0xa')](),controller[_0x35a1('0xb')]);router[_0x35a1('0xc')]('/',auth['isAuthenticated'](),controller[_0x35a1('0xd')]);router[_0x35a1('0xe')](_0x35a1('0x9'),auth[_0x35a1('0xa')](),controller[_0x35a1('0xf')]);router[_0x35a1('0x10')](_0x35a1('0x9'),auth[_0x35a1('0xa')](),controller[_0x35a1('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 15d1050..a9b8a55 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 _0xe199=['exports','STRING','TEXT'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xe199,0x69));var _0x9e19=function(_0x5427c8,_0x18f384){_0x5427c8=_0x5427c8-0x0;var _0x33a129=_0xe199[_0x5427c8];return _0x33a129;};'use strict';var Sequelize=require('sequelize');module[_0x9e19('0x0')]={'name':{'type':Sequelize[_0x9e19('0x1')]},'description':{'type':Sequelize[_0x9e19('0x1')]},'html':{'type':Sequelize[_0x9e19('0x2')]}}; \ No newline at end of file +var _0x7ad0=['STRING','TEXT'];(function(_0x1c6392,_0x460acd){var _0x13e3b7=function(_0x100b82){while(--_0x100b82){_0x1c6392['push'](_0x1c6392['shift']());}};_0x13e3b7(++_0x460acd);}(_0x7ad0,0x162));var _0x07ad=function(_0x36ab88,_0x23f292){_0x36ab88=_0x36ab88-0x0;var _0x685d83=_0x7ad0[_0x36ab88];return _0x685d83;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x07ad('0x0')]},'description':{'type':Sequelize[_0x07ad('0x0')]},'html':{'type':Sequelize[_0x07ad('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 50445a0..23b3dc8 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 _0xf35c=['crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Templates','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','Template','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0xf35c,0x1d9));var _0xcf35=function(_0x7427dd,_0x14d109){_0x7427dd=_0x7427dd-0x0;var _0x34697b=_0xf35c[_0x7427dd];return _0x34697b;};'use strict';var emlformat=require(_0xcf35('0x0'));var rimraf=require(_0xcf35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf35('0x2'));var rp=require(_0xcf35('0x3'));var moment=require('moment');var BPromise=require(_0xcf35('0x4'));var Mustache=require('mustache');var util=require(_0xcf35('0x5'));var path=require(_0xcf35('0x6'));var sox=require(_0xcf35('0x7'));var csv=require(_0xcf35('0x8'));var ejs=require(_0xcf35('0x9'));var fs=require('fs');var fs_extra=require(_0xcf35('0xa'));var _=require(_0xcf35('0xb'));var squel=require(_0xcf35('0xc'));var crypto=require(_0xcf35('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcf35('0xe'));var Papa=require('papaparse');var Redis=require(_0xcf35('0xf'));var authService=require(_0xcf35('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcf35('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf35('0x12'))(_0xcf35('0x13'));var utils=require('../../config/utils');var config=require(_0xcf35('0x14'));var licenseUtil=require(_0xcf35('0x15'));var db=require(_0xcf35('0x16'))['db'];function respondWithStatusCode(_0xec50c1,_0x415581){_0x415581=_0x415581||0xcc;return function(_0xc2068b){if(_0xc2068b){return _0xec50c1['sendStatus'](_0x415581);}return _0xec50c1[_0xcf35('0x17')](_0x415581)['end']();};}function respondWithResult(_0x10d97a,_0xa487d4){_0xa487d4=_0xa487d4||0xc8;return function(_0x499c62){if(_0x499c62){return _0x10d97a['status'](_0xa487d4)[_0xcf35('0x18')](_0x499c62);}};}function respondWithFilteredResult(_0x3e6e56,_0x989d6a){return function(_0x480bd1){if(_0x480bd1){var _0x329bcd=typeof _0x989d6a[_0xcf35('0x19')]===_0xcf35('0x1a')&&typeof _0x989d6a[_0xcf35('0x1b')]===_0xcf35('0x1a');var _0x306914=_0x480bd1[_0xcf35('0x1c')];var _0x2348f4=_0x329bcd?0x0:_0x989d6a['offset'];var _0x3041ce=_0x329bcd?_0x480bd1[_0xcf35('0x1c')]:_0x989d6a[_0xcf35('0x19')]+_0x989d6a[_0xcf35('0x1b')];var _0x2b8e92;if(_0x3041ce>=_0x306914){_0x3041ce=_0x306914;_0x2b8e92=0xc8;}else{_0x2b8e92=0xce;}_0x3e6e56[_0xcf35('0x17')](_0x2b8e92);return _0x3e6e56[_0xcf35('0x1d')](_0xcf35('0x1e'),_0x2348f4+'-'+_0x3041ce+'/'+_0x306914)['json'](_0x480bd1);}return null;};}function patchUpdates(_0x38980b){return function(_0x3709ae){try{jsonpatch[_0xcf35('0x1f')](_0x3709ae,_0x38980b,!![]);}catch(_0x1749da){return BPromise[_0xcf35('0x20')](_0x1749da);}return _0x3709ae[_0xcf35('0x21')]();};}function saveUpdates(_0x5d1fa9,_0x4dbcc6){return function(_0x11c7b1){if(_0x11c7b1){return _0x11c7b1[_0xcf35('0x22')](_0x5d1fa9)[_0xcf35('0x23')](function(_0x5d05f6){return _0x5d05f6;});}return null;};}function removeEntity(_0x35e0e3,_0x17b2b4){return function(_0x17facc){if(_0x17facc){return _0x17facc['destroy']()['then'](function(){var _0xa78881=_0x17facc[_0xcf35('0x24')]({'plain':!![]});var _0x122551=_0xcf35('0x25');return db['UserProfileResource'][_0xcf35('0x26')]({'where':{'type':_0x122551,'resourceId':_0xa78881['id']}})['then'](function(){return _0x17facc;});})['then'](function(){_0x35e0e3['status'](0xcc)[_0xcf35('0x27')]();});}};}function handleEntityNotFound(_0x164f95,_0xd22855){return function(_0x4824db){if(!_0x4824db){_0x164f95[_0xcf35('0x28')](0x194);}return _0x4824db;};}function handleError(_0x27e28d,_0x277924){_0x277924=_0x277924||0x1f4;return function(_0x8981ee){logger['error'](_0x8981ee[_0xcf35('0x29')]);if(_0x8981ee[_0xcf35('0x2a')]){delete _0x8981ee[_0xcf35('0x2a')];}_0x27e28d['status'](_0x277924)[_0xcf35('0x2b')](_0x8981ee);};}exports[_0xcf35('0x2c')]=function(_0x3a9d4d,_0x508c3c){var _0x49bcb0={},_0x2d70f3={},_0x732e9f={'count':0x0,'rows':[]};var _0x252b99=_[_0xcf35('0x2d')](db['Template'][_0xcf35('0x2e')],function(_0x56a2e2){return{'name':_0x56a2e2['fieldName'],'type':_0x56a2e2[_0xcf35('0x2f')]['key']};});_0x2d70f3[_0xcf35('0x30')]=_[_0xcf35('0x2d')](_0x252b99,_0xcf35('0x2a'));_0x2d70f3['query']=_[_0xcf35('0x31')](_0x3a9d4d[_0xcf35('0x32')]);_0x2d70f3[_0xcf35('0x33')]=_[_0xcf35('0x34')](_0x2d70f3[_0xcf35('0x30')],_0x2d70f3[_0xcf35('0x32')]);_0x49bcb0[_0xcf35('0x35')]=_['intersection'](_0x2d70f3[_0xcf35('0x30')],qs[_0xcf35('0x36')](_0x3a9d4d[_0xcf35('0x32')]['fields']));_0x49bcb0[_0xcf35('0x35')]=_0x49bcb0[_0xcf35('0x35')]['length']?_0x49bcb0[_0xcf35('0x35')]:_0x2d70f3[_0xcf35('0x30')];if(!_0x3a9d4d[_0xcf35('0x32')][_0xcf35('0x37')]('nolimit')){_0x49bcb0['limit']=qs[_0xcf35('0x1b')](_0x3a9d4d[_0xcf35('0x32')][_0xcf35('0x1b')]);_0x49bcb0[_0xcf35('0x19')]=qs[_0xcf35('0x19')](_0x3a9d4d['query']['offset']);}_0x49bcb0[_0xcf35('0x38')]=qs[_0xcf35('0x39')](_0x3a9d4d['query'][_0xcf35('0x39')]);_0x49bcb0['where']=qs[_0xcf35('0x33')](_[_0xcf35('0x3a')](_0x3a9d4d['query'],_0x2d70f3[_0xcf35('0x33')]),_0x252b99);if(_0x3a9d4d[_0xcf35('0x32')][_0xcf35('0x3b')]){_0x49bcb0[_0xcf35('0x3c')]=_[_0xcf35('0x3d')](_0x49bcb0[_0xcf35('0x3c')],{'$or':_[_0xcf35('0x2d')](_0x252b99,function(_0x320620){if(_0x320620[_0xcf35('0x2f')]!=='VIRTUAL'){var _0x407d49={};_0x407d49[_0x320620[_0xcf35('0x2a')]]={'$like':'%'+_0x3a9d4d[_0xcf35('0x32')][_0xcf35('0x3b')]+'%'};return _0x407d49;}})});}_0x49bcb0=_[_0xcf35('0x3d')]({},_0x49bcb0,_0x3a9d4d[_0xcf35('0x3e')]);var _0x734e57={'where':_0x49bcb0[_0xcf35('0x3c')]};return db['Template']['count'](_0x734e57)[_0xcf35('0x23')](function(_0x1ec9b1){_0x732e9f[_0xcf35('0x1c')]=_0x1ec9b1;if(_0x3a9d4d['query'][_0xcf35('0x3f')]){_0x49bcb0[_0xcf35('0x40')]=[{'all':!![]}];}return db['Template'][_0xcf35('0x41')](_0x49bcb0);})[_0xcf35('0x23')](function(_0x233189){_0x732e9f[_0xcf35('0x42')]=_0x233189;return _0x732e9f;})['then'](respondWithFilteredResult(_0x508c3c,_0x49bcb0))[_0xcf35('0x43')](handleError(_0x508c3c,null));};exports[_0xcf35('0x44')]=function(_0x209436,_0x2d3325){var _0x1920d0={'raw':!![],'where':{'id':_0x209436[_0xcf35('0x45')]['id']}},_0x3a2229={};_0x3a2229[_0xcf35('0x30')]=_['keys'](db[_0xcf35('0x46')][_0xcf35('0x2e')]);_0x3a2229['query']=_[_0xcf35('0x31')](_0x209436[_0xcf35('0x32')]);_0x3a2229[_0xcf35('0x33')]=_[_0xcf35('0x34')](_0x3a2229['model'],_0x3a2229['query']);_0x1920d0[_0xcf35('0x35')]=_[_0xcf35('0x34')](_0x3a2229[_0xcf35('0x30')],qs[_0xcf35('0x36')](_0x209436[_0xcf35('0x32')][_0xcf35('0x36')]));_0x1920d0['attributes']=_0x1920d0['attributes'][_0xcf35('0x47')]?_0x1920d0['attributes']:_0x3a2229[_0xcf35('0x30')];if(_0x209436[_0xcf35('0x32')][_0xcf35('0x3f')]){_0x1920d0[_0xcf35('0x40')]=[{'all':!![]}];}_0x1920d0=_[_0xcf35('0x3d')]({},_0x1920d0,_0x209436[_0xcf35('0x3e')]);return db[_0xcf35('0x46')]['find'](_0x1920d0)[_0xcf35('0x23')](handleEntityNotFound(_0x2d3325,null))[_0xcf35('0x23')](respondWithResult(_0x2d3325,null))[_0xcf35('0x43')](handleError(_0x2d3325,null));};exports[_0xcf35('0x48')]=function(_0x3e3744,_0x36899b){return db[_0xcf35('0x46')][_0xcf35('0x48')](_0x3e3744[_0xcf35('0x49')],{})['then'](function(_0x4b12aa){var _0x565e6a=_0x3e3744[_0xcf35('0x4a')][_0xcf35('0x24')]({'plain':!![]});if(!_0x565e6a)throw new Error(_0xcf35('0x4b'));if(_0x565e6a[_0xcf35('0x4c')]===_0xcf35('0x4a')){var _0x15417b=_0x4b12aa[_0xcf35('0x24')]({'plain':!![]});var _0x28d175=_0xcf35('0x25');return db['UserProfileSection'][_0xcf35('0x4d')]({'where':{'name':_0x28d175,'userProfileId':_0x565e6a[_0xcf35('0x4e')]},'raw':!![]})[_0xcf35('0x23')](function(_0xa3246e){if(_0xa3246e&&_0xa3246e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x15417b[_0xcf35('0x2a')],'resourceId':_0x15417b['id'],'type':_0xa3246e[_0xcf35('0x2a')],'sectionId':_0xa3246e['id']},{})[_0xcf35('0x23')](function(){return _0x4b12aa;});}else{return _0x4b12aa;}})['catch'](function(_0x1c1758){logger[_0xcf35('0x4f')](_0xcf35('0x50'),_0x1c1758);throw _0x1c1758;});}return _0x4b12aa;})[_0xcf35('0x23')](respondWithResult(_0x36899b,0xc9))[_0xcf35('0x43')](handleError(_0x36899b,null));};exports[_0xcf35('0x22')]=function(_0x48948a,_0x5ddab7){if(_0x48948a[_0xcf35('0x49')]['id']){delete _0x48948a[_0xcf35('0x49')]['id'];}return db[_0xcf35('0x46')]['find']({'where':{'id':_0x48948a[_0xcf35('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ddab7,null))['then'](saveUpdates(_0x48948a[_0xcf35('0x49')],null))[_0xcf35('0x23')](respondWithResult(_0x5ddab7,null))['catch'](handleError(_0x5ddab7,null));};exports[_0xcf35('0x26')]=function(_0x4906a2,_0x48bbaf){return db['Template'][_0xcf35('0x4d')]({'where':{'id':_0x4906a2[_0xcf35('0x45')]['id']}})[_0xcf35('0x23')](handleEntityNotFound(_0x48bbaf,null))[_0xcf35('0x23')](removeEntity(_0x48bbaf,null))['catch'](handleError(_0x48bbaf,null));}; \ No newline at end of file +var _0x4511=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','includeAll','include','Template','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','limit','count','json','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x2e2e41,_0x3a7848){var _0x266226=function(_0x458e0a){while(--_0x458e0a){_0x2e2e41['push'](_0x2e2e41['shift']());}};_0x266226(++_0x3a7848);}(_0x4511,0xbe));var _0x1451=function(_0x5b6d84,_0x12caf7){_0x5b6d84=_0x5b6d84-0x0;var _0x4c762c=_0x4511[_0x5b6d84];return _0x4c762c;};'use strict';var emlformat=require(_0x1451('0x0'));var rimraf=require(_0x1451('0x1'));var zipdir=require(_0x1451('0x2'));var jsonpatch=require(_0x1451('0x3'));var rp=require(_0x1451('0x4'));var moment=require(_0x1451('0x5'));var BPromise=require(_0x1451('0x6'));var Mustache=require(_0x1451('0x7'));var util=require('util');var path=require(_0x1451('0x8'));var sox=require(_0x1451('0x9'));var csv=require(_0x1451('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1451('0xb'));var squel=require(_0x1451('0xc'));var crypto=require('crypto');var jsforce=require(_0x1451('0xd'));var deskjs=require(_0x1451('0xe'));var toCsv=require(_0x1451('0xa'));var querystring=require(_0x1451('0xf'));var Papa=require(_0x1451('0x10'));var Redis=require(_0x1451('0x11'));var authService=require(_0x1451('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1451('0x13'));var hardwareService=require(_0x1451('0x14'));var logger=require(_0x1451('0x15'))(_0x1451('0x16'));var utils=require(_0x1451('0x17'));var config=require(_0x1451('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1451('0x19'))['db'];function respondWithStatusCode(_0x3949ec,_0x3d44ed){_0x3d44ed=_0x3d44ed||0xcc;return function(_0x3f28d6){if(_0x3f28d6){return _0x3949ec['sendStatus'](_0x3d44ed);}return _0x3949ec['status'](_0x3d44ed)[_0x1451('0x1a')]();};}function respondWithResult(_0x3ee965,_0x30395b){_0x30395b=_0x30395b||0xc8;return function(_0x4dc7b0){if(_0x4dc7b0){return _0x3ee965[_0x1451('0x1b')](_0x30395b)['json'](_0x4dc7b0);}};}function respondWithFilteredResult(_0x3a8fe0,_0x3cb424){return function(_0x258da8){if(_0x258da8){var _0x46a65c=typeof _0x3cb424[_0x1451('0x1c')]==='undefined'&&typeof _0x3cb424[_0x1451('0x1d')]==='undefined';var _0xb349c6=_0x258da8[_0x1451('0x1e')];var _0x5e117b=_0x46a65c?0x0:_0x3cb424[_0x1451('0x1c')];var _0x258f6a=_0x46a65c?_0x258da8['count']:_0x3cb424['offset']+_0x3cb424['limit'];var _0x9e06cc;if(_0x258f6a>=_0xb349c6){_0x258f6a=_0xb349c6;_0x9e06cc=0xc8;}else{_0x9e06cc=0xce;}_0x3a8fe0[_0x1451('0x1b')](_0x9e06cc);return _0x3a8fe0['set']('Content-Range',_0x5e117b+'-'+_0x258f6a+'/'+_0xb349c6)[_0x1451('0x1f')](_0x258da8);}return null;};}function patchUpdates(_0x340e0e){return function(_0x20f856){try{jsonpatch['apply'](_0x20f856,_0x340e0e,!![]);}catch(_0x86a6a1){return BPromise[_0x1451('0x20')](_0x86a6a1);}return _0x20f856[_0x1451('0x21')]();};}function saveUpdates(_0x262a11,_0x223e91){return function(_0x1b089e){if(_0x1b089e){return _0x1b089e['update'](_0x262a11)[_0x1451('0x22')](function(_0x177fd0){return _0x177fd0;});}return null;};}function removeEntity(_0x2ba703,_0x239120){return function(_0x4e0ede){if(_0x4e0ede){return _0x4e0ede[_0x1451('0x23')]()[_0x1451('0x22')](function(){var _0x561cd7=_0x4e0ede[_0x1451('0x24')]({'plain':!![]});var _0x51094f=_0x1451('0x25');return db[_0x1451('0x26')][_0x1451('0x23')]({'where':{'type':_0x51094f,'resourceId':_0x561cd7['id']}})[_0x1451('0x22')](function(){return _0x4e0ede;});})['then'](function(){_0x2ba703[_0x1451('0x1b')](0xcc)[_0x1451('0x1a')]();});}};}function handleEntityNotFound(_0x457cb3,_0x47b421){return function(_0x3b8692){if(!_0x3b8692){_0x457cb3['sendStatus'](0x194);}return _0x3b8692;};}function handleError(_0x166103,_0x321507){_0x321507=_0x321507||0x1f4;return function(_0x3a9f2a){logger[_0x1451('0x27')](_0x3a9f2a[_0x1451('0x28')]);if(_0x3a9f2a[_0x1451('0x29')]){delete _0x3a9f2a[_0x1451('0x29')];}_0x166103[_0x1451('0x1b')](_0x321507)[_0x1451('0x2a')](_0x3a9f2a);};}exports[_0x1451('0x2b')]=function(_0x438d5e,_0x4d3a0e){var _0x193fe0={},_0x880e2f={},_0x41bbb8={'count':0x0,'rows':[]};var _0x215892=_[_0x1451('0x2c')](db['Template']['rawAttributes'],function(_0x22701f){return{'name':_0x22701f[_0x1451('0x2d')],'type':_0x22701f[_0x1451('0x2e')][_0x1451('0x2f')]};});_0x880e2f[_0x1451('0x30')]=_[_0x1451('0x2c')](_0x215892,_0x1451('0x29'));_0x880e2f[_0x1451('0x31')]=_[_0x1451('0x32')](_0x438d5e[_0x1451('0x31')]);_0x880e2f[_0x1451('0x33')]=_[_0x1451('0x34')](_0x880e2f[_0x1451('0x30')],_0x880e2f[_0x1451('0x31')]);_0x193fe0[_0x1451('0x35')]=_[_0x1451('0x34')](_0x880e2f[_0x1451('0x30')],qs[_0x1451('0x36')](_0x438d5e[_0x1451('0x31')][_0x1451('0x36')]));_0x193fe0['attributes']=_0x193fe0[_0x1451('0x35')][_0x1451('0x37')]?_0x193fe0[_0x1451('0x35')]:_0x880e2f[_0x1451('0x30')];if(!_0x438d5e[_0x1451('0x31')][_0x1451('0x38')](_0x1451('0x39'))){_0x193fe0[_0x1451('0x1d')]=qs[_0x1451('0x1d')](_0x438d5e[_0x1451('0x31')][_0x1451('0x1d')]);_0x193fe0[_0x1451('0x1c')]=qs['offset'](_0x438d5e[_0x1451('0x31')][_0x1451('0x1c')]);}_0x193fe0[_0x1451('0x3a')]=qs['sort'](_0x438d5e['query'][_0x1451('0x3b')]);_0x193fe0['where']=qs[_0x1451('0x33')](_[_0x1451('0x3c')](_0x438d5e[_0x1451('0x31')],_0x880e2f[_0x1451('0x33')]),_0x215892);if(_0x438d5e['query'][_0x1451('0x3d')]){_0x193fe0['where']=_[_0x1451('0x3e')](_0x193fe0['where'],{'$or':_['map'](_0x215892,function(_0x339131){if(_0x339131[_0x1451('0x2e')]!==_0x1451('0x3f')){var _0xbec86a={};_0xbec86a[_0x339131[_0x1451('0x29')]]={'$like':'%'+_0x438d5e['query'][_0x1451('0x3d')]+'%'};return _0xbec86a;}})});}_0x193fe0=_[_0x1451('0x3e')]({},_0x193fe0,_0x438d5e[_0x1451('0x40')]);var _0x24741a={'where':_0x193fe0['where']};return db['Template'][_0x1451('0x1e')](_0x24741a)['then'](function(_0x2f71a8){_0x41bbb8['count']=_0x2f71a8;if(_0x438d5e[_0x1451('0x31')][_0x1451('0x41')]){_0x193fe0[_0x1451('0x42')]=[{'all':!![]}];}return db[_0x1451('0x43')][_0x1451('0x44')](_0x193fe0);})[_0x1451('0x22')](function(_0x23d235){_0x41bbb8[_0x1451('0x45')]=_0x23d235;return _0x41bbb8;})['then'](respondWithFilteredResult(_0x4d3a0e,_0x193fe0))[_0x1451('0x46')](handleError(_0x4d3a0e,null));};exports[_0x1451('0x47')]=function(_0x398e9b,_0x1a3ca0){var _0x398d21={'raw':!![],'where':{'id':_0x398e9b[_0x1451('0x48')]['id']}},_0x155dcb={};_0x155dcb['model']=_[_0x1451('0x32')](db[_0x1451('0x43')]['rawAttributes']);_0x155dcb[_0x1451('0x31')]=_[_0x1451('0x32')](_0x398e9b['query']);_0x155dcb['filters']=_[_0x1451('0x34')](_0x155dcb[_0x1451('0x30')],_0x155dcb[_0x1451('0x31')]);_0x398d21['attributes']=_[_0x1451('0x34')](_0x155dcb[_0x1451('0x30')],qs['fields'](_0x398e9b[_0x1451('0x31')]['fields']));_0x398d21[_0x1451('0x35')]=_0x398d21[_0x1451('0x35')][_0x1451('0x37')]?_0x398d21['attributes']:_0x155dcb[_0x1451('0x30')];if(_0x398e9b[_0x1451('0x31')][_0x1451('0x41')]){_0x398d21[_0x1451('0x42')]=[{'all':!![]}];}_0x398d21=_[_0x1451('0x3e')]({},_0x398d21,_0x398e9b[_0x1451('0x40')]);return db['Template'][_0x1451('0x49')](_0x398d21)['then'](handleEntityNotFound(_0x1a3ca0,null))[_0x1451('0x22')](respondWithResult(_0x1a3ca0,null))[_0x1451('0x46')](handleError(_0x1a3ca0,null));};exports[_0x1451('0x4a')]=function(_0xd04c58,_0x5d8ad5){return db[_0x1451('0x43')][_0x1451('0x4a')](_0xd04c58[_0x1451('0x4b')],{})[_0x1451('0x22')](function(_0x3908a8){var _0x2842aa=_0xd04c58['user'][_0x1451('0x24')]({'plain':!![]});if(!_0x2842aa)throw new Error(_0x1451('0x4c'));if(_0x2842aa[_0x1451('0x4d')]===_0x1451('0x4e')){var _0x5bce31=_0x3908a8[_0x1451('0x24')]({'plain':!![]});var _0x409151='Templates';return db['UserProfileSection'][_0x1451('0x49')]({'where':{'name':_0x409151,'userProfileId':_0x2842aa[_0x1451('0x4f')]},'raw':!![]})[_0x1451('0x22')](function(_0x55ed68){if(_0x55ed68&&_0x55ed68['autoAssociation']===0x0){return db['UserProfileResource'][_0x1451('0x4a')]({'name':_0x5bce31[_0x1451('0x29')],'resourceId':_0x5bce31['id'],'type':_0x55ed68[_0x1451('0x29')],'sectionId':_0x55ed68['id']},{})[_0x1451('0x22')](function(){return _0x3908a8;});}else{return _0x3908a8;}})[_0x1451('0x46')](function(_0x4fe774){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fe774);throw _0x4fe774;});}return _0x3908a8;})[_0x1451('0x22')](respondWithResult(_0x5d8ad5,0xc9))[_0x1451('0x46')](handleError(_0x5d8ad5,null));};exports[_0x1451('0x50')]=function(_0x4f6ef4,_0x411659){if(_0x4f6ef4[_0x1451('0x4b')]['id']){delete _0x4f6ef4[_0x1451('0x4b')]['id'];}return db[_0x1451('0x43')][_0x1451('0x49')]({'where':{'id':_0x4f6ef4[_0x1451('0x48')]['id']}})[_0x1451('0x22')](handleEntityNotFound(_0x411659,null))[_0x1451('0x22')](saveUpdates(_0x4f6ef4[_0x1451('0x4b')],null))[_0x1451('0x22')](respondWithResult(_0x411659,null))['catch'](handleError(_0x411659,null));};exports[_0x1451('0x23')]=function(_0x5da0f0,_0x3ecd07){return db[_0x1451('0x43')][_0x1451('0x49')]({'where':{'id':_0x5da0f0[_0x1451('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ecd07,null))[_0x1451('0x22')](removeEntity(_0x3ecd07,null))['catch'](handleError(_0x3ecd07,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 35dcdc1..fafc7a5 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 _0x0508=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','lodash','util'];(function(_0x4a7d06,_0x4cbb90){var _0x283136=function(_0x58c1be){while(--_0x58c1be){_0x4a7d06['push'](_0x4a7d06['shift']());}};_0x283136(++_0x4cbb90);}(_0x0508,0x191));var _0x8050=function(_0x4ffa17,_0x22b324){_0x4ffa17=_0x4ffa17-0x0;var _0x51ccee=_0x0508[_0x4ffa17];return _0x51ccee;};'use strict';var _=require(_0x8050('0x0'));var util=require(_0x8050('0x1'));var logger=require(_0x8050('0x2'))('api');var moment=require(_0x8050('0x3'));var BPromise=require(_0x8050('0x4'));var rp=require(_0x8050('0x5'));var fs=require('fs');var path=require(_0x8050('0x6'));var rimraf=require(_0x8050('0x7'));var config=require(_0x8050('0x8'));var attributes=require(_0x8050('0x9'));module[_0x8050('0xa')]=function(_0x23f89c,_0x5b6eba){return _0x23f89c[_0x8050('0xb')](_0x8050('0xc'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09fd=['define','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./template.attributes','exports'];(function(_0x318b17,_0x3566d6){var _0x95b9f1=function(_0x4f886b){while(--_0x4f886b){_0x318b17['push'](_0x318b17['shift']());}};_0x95b9f1(++_0x3566d6);}(_0x09fd,0x177));var _0xd09f=function(_0x33cf59,_0x5dc4f1){_0x33cf59=_0x33cf59-0x0;var _0xaa7d6b=_0x09fd[_0x33cf59];return _0xaa7d6b;};'use strict';var _=require(_0xd09f('0x0'));var util=require(_0xd09f('0x1'));var logger=require(_0xd09f('0x2'))(_0xd09f('0x3'));var moment=require(_0xd09f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd09f('0x5'));var rimraf=require(_0xd09f('0x6'));var config=require(_0xd09f('0x7'));var attributes=require(_0xd09f('0x8'));module[_0xd09f('0x9')]=function(_0x38b216,_0x50fbae){return _0x38b216[_0xd09f('0xa')]('Template',attributes,{'tableName':'tools_templates','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 a640b32..f6509da 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 _0x64a9=['code','Template,\x20%s,\x20%s','message','result','Template','findAll','options','raw','where','limit','include','model','attributes','GetTemplate','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5ca2df,_0x1e95b9){var _0x7e3a3a=function(_0xa5b450){while(--_0xa5b450){_0x5ca2df['push'](_0x5ca2df['shift']());}};_0x7e3a3a(++_0x1e95b9);}(_0x64a9,0xce));var _0x964a=function(_0x764faa,_0x164d6e){_0x764faa=_0x764faa-0x0;var _0x4f01e3=_0x64a9[_0x764faa];return _0x4f01e3;};'use strict';var _=require(_0x964a('0x0'));var util=require('util');var moment=require(_0x964a('0x1'));var BPromise=require(_0x964a('0x2'));var rs=require(_0x964a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x964a('0x4'))['db'];var utils=require(_0x964a('0x5'));var logger=require(_0x964a('0x6'))(_0x964a('0x7'));var config=require(_0x964a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x964a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x81c103,_0x2d85af,_0x1e0f52){return new BPromise(function(_0x5120b9,_0x2e0000){return client[_0x964a('0xa')](_0x81c103,_0x1e0f52)[_0x964a('0xb')](function(_0x426af9){logger[_0x964a('0xc')]('Template,\x20%s,\x20%s',_0x2d85af,_0x964a('0xd'));logger[_0x964a('0xe')](_0x964a('0xf'),_0x2d85af,_0x964a('0xd'),JSON[_0x964a('0x10')](_0x426af9));if(_0x426af9[_0x964a('0x11')]){if(_0x426af9[_0x964a('0x11')][_0x964a('0x12')]===0x1f4){logger[_0x964a('0x11')](_0x964a('0x13'),_0x2d85af,_0x426af9[_0x964a('0x11')][_0x964a('0x14')]);return _0x2e0000(_0x426af9[_0x964a('0x11')][_0x964a('0x14')]);}logger[_0x964a('0x11')]('Template,\x20%s,\x20%s',_0x2d85af,_0x426af9[_0x964a('0x11')][_0x964a('0x14')]);return _0x5120b9(_0x426af9[_0x964a('0x11')][_0x964a('0x14')]);}else{logger[_0x964a('0xc')](_0x964a('0x13'),_0x2d85af,_0x964a('0xd'));_0x5120b9(_0x426af9[_0x964a('0x15')]['message']);}})['catch'](function(_0x1ef031){logger[_0x964a('0x11')]('Template,\x20%s,\x20%s',_0x2d85af,_0x1ef031);_0x2e0000(_0x1ef031);});});}exports['GetTemplate']=function(_0x47dd55){var _0x4f5409=this;return new Promise(function(_0x53d14c,_0x2ba396){return db[_0x964a('0x16')][_0x964a('0x17')]({'raw':_0x47dd55[_0x964a('0x18')]?_0x47dd55[_0x964a('0x18')][_0x964a('0x19')]===undefined?!![]:![]:!![],'where':_0x47dd55['options']?_0x47dd55[_0x964a('0x18')][_0x964a('0x1a')]||null:null,'attributes':_0x47dd55['options']?_0x47dd55[_0x964a('0x18')]['attributes']||null:null,'limit':_0x47dd55['options']?_0x47dd55[_0x964a('0x18')][_0x964a('0x1b')]||null:null,'include':_0x47dd55['options']?_0x47dd55[_0x964a('0x18')][_0x964a('0x1c')]?_['map'](_0x47dd55[_0x964a('0x18')][_0x964a('0x1c')],function(_0x580127){return{'model':db[_0x580127['model']],'as':_0x580127['as'],'attributes':_0x580127['attributes'],'include':_0x580127[_0x964a('0x1c')]?_['map'](_0x580127[_0x964a('0x1c')],function(_0x2e7c57){return{'model':db[_0x2e7c57[_0x964a('0x1d')]],'as':_0x2e7c57['as'],'attributes':_0x2e7c57[_0x964a('0x1e')],'include':_0x2e7c57[_0x964a('0x1c')]?_['map'](_0x2e7c57['include'],function(_0x27ab5f){return{'model':db[_0x27ab5f[_0x964a('0x1d')]],'as':_0x27ab5f['as'],'attributes':_0x27ab5f['attributes']};}):[]};}):[]};}):[]:[]})[_0x964a('0xb')](function(_0x5c46e6){logger[_0x964a('0xc')](_0x964a('0x1f'),_0x47dd55);logger['debug'](_0x964a('0x1f'),_0x47dd55,JSON['stringify'](_0x5c46e6));_0x53d14c(_0x5c46e6);})['catch'](function(_0x206237){logger[_0x964a('0x11')](_0x964a('0x1f'),_0x206237[_0x964a('0x14')],_0x47dd55);_0x2ba396(_0x4f5409[_0x964a('0x11')](0x1f4,_0x206237[_0x964a('0x14')]));});});}; \ No newline at end of file +var _0x3ebb=['attributes','limit','include','map','model','debug','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','code','Template,\x20%s,\x20%s','message','info','result','catch','GetTemplate','findAll','raw','where','options'];(function(_0x897b6f,_0x366557){var _0x2ecba3=function(_0x28b8a0){while(--_0x28b8a0){_0x897b6f['push'](_0x897b6f['shift']());}};_0x2ecba3(++_0x366557);}(_0x3ebb,0xcd));var _0xb3eb=function(_0x33a2e9,_0x4c1967){_0x33a2e9=_0x33a2e9-0x0;var _0x2c83d8=_0x3ebb[_0x33a2e9];return _0x2c83d8;};'use strict';var _=require(_0xb3eb('0x0'));var util=require(_0xb3eb('0x1'));var moment=require(_0xb3eb('0x2'));var BPromise=require('bluebird');var rs=require(_0xb3eb('0x3'));var fs=require('fs');var Redis=require(_0xb3eb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3eb('0x5'));var logger=require(_0xb3eb('0x6'))(_0xb3eb('0x7'));var config=require(_0xb3eb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb3eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319efb,_0x403611,_0x5dc27d){return new BPromise(function(_0x3f8195,_0x2d2e8a){return client[_0xb3eb('0xa')](_0x319efb,_0x5dc27d)[_0xb3eb('0xb')](function(_0x1e238e){logger['info']('Template,\x20%s,\x20%s',_0x403611,_0xb3eb('0xc'));logger['debug'](_0xb3eb('0xd'),_0x403611,_0xb3eb('0xc'),JSON['stringify'](_0x1e238e));if(_0x1e238e['error']){if(_0x1e238e[_0xb3eb('0xe')][_0xb3eb('0xf')]===0x1f4){logger[_0xb3eb('0xe')](_0xb3eb('0x10'),_0x403611,_0x1e238e[_0xb3eb('0xe')][_0xb3eb('0x11')]);return _0x2d2e8a(_0x1e238e[_0xb3eb('0xe')][_0xb3eb('0x11')]);}logger['error'](_0xb3eb('0x10'),_0x403611,_0x1e238e['error'][_0xb3eb('0x11')]);return _0x3f8195(_0x1e238e[_0xb3eb('0xe')][_0xb3eb('0x11')]);}else{logger[_0xb3eb('0x12')](_0xb3eb('0x10'),_0x403611,_0xb3eb('0xc'));_0x3f8195(_0x1e238e[_0xb3eb('0x13')][_0xb3eb('0x11')]);}})[_0xb3eb('0x14')](function(_0x52f56d){logger[_0xb3eb('0xe')](_0xb3eb('0x10'),_0x403611,_0x52f56d);_0x2d2e8a(_0x52f56d);});});}exports[_0xb3eb('0x15')]=function(_0x10fb6d){var _0x56e4d8=this;return new Promise(function(_0x86819c,_0x3fc60e){return db['Template'][_0xb3eb('0x16')]({'raw':_0x10fb6d['options']?_0x10fb6d['options'][_0xb3eb('0x17')]===undefined?!![]:![]:!![],'where':_0x10fb6d['options']?_0x10fb6d['options'][_0xb3eb('0x18')]||null:null,'attributes':_0x10fb6d[_0xb3eb('0x19')]?_0x10fb6d[_0xb3eb('0x19')][_0xb3eb('0x1a')]||null:null,'limit':_0x10fb6d[_0xb3eb('0x19')]?_0x10fb6d[_0xb3eb('0x19')][_0xb3eb('0x1b')]||null:null,'include':_0x10fb6d['options']?_0x10fb6d[_0xb3eb('0x19')][_0xb3eb('0x1c')]?_[_0xb3eb('0x1d')](_0x10fb6d[_0xb3eb('0x19')][_0xb3eb('0x1c')],function(_0x39fd13){return{'model':db[_0x39fd13[_0xb3eb('0x1e')]],'as':_0x39fd13['as'],'attributes':_0x39fd13['attributes'],'include':_0x39fd13[_0xb3eb('0x1c')]?_['map'](_0x39fd13['include'],function(_0x5dfe0f){return{'model':db[_0x5dfe0f['model']],'as':_0x5dfe0f['as'],'attributes':_0x5dfe0f[_0xb3eb('0x1a')],'include':_0x5dfe0f['include']?_['map'](_0x5dfe0f[_0xb3eb('0x1c')],function(_0x5a428f){return{'model':db[_0x5a428f[_0xb3eb('0x1e')]],'as':_0x5a428f['as'],'attributes':_0x5a428f[_0xb3eb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb3eb('0xb')](function(_0xf58886){logger[_0xb3eb('0x12')](_0xb3eb('0x15'),_0x10fb6d);logger[_0xb3eb('0x1f')](_0xb3eb('0x15'),_0x10fb6d,JSON[_0xb3eb('0x20')](_0xf58886));_0x86819c(_0xf58886);})[_0xb3eb('0x14')](function(_0x1a32d8){logger[_0xb3eb('0xe')](_0xb3eb('0x15'),_0x1a32d8[_0xb3eb('0x11')],_0x10fb6d);_0x3fc60e(_0x56e4d8[_0xb3eb('0xe')](0x1f4,_0x1a32d8[_0xb3eb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 5ea4fe8..080abb0 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 _0x2e1d=['index','get','isAuthenticated','getAllConditions','getAnyConditions','/:id/actions','getActions','create','post','/:id/all_conditions','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','put','/:id','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./trigger.controller'];(function(_0x262de1,_0x383efd){var _0x5599b5=function(_0x2f2574){while(--_0x2f2574){_0x262de1['push'](_0x262de1['shift']());}};_0x5599b5(++_0x383efd);}(_0x2e1d,0xc8));var _0xd2e1=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x2e1d[_0x10f6e8];return _0x35bb3c;};'use strict';var multer=require(_0xd2e1('0x0'));var util=require(_0xd2e1('0x1'));var path=require(_0xd2e1('0x2'));var timeout=require(_0xd2e1('0x3'));var express=require(_0xd2e1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd2e1('0x5'));var interaction=require(_0xd2e1('0x6'));var config=require('../../config/environment');var controller=require(_0xd2e1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd2e1('0x8')]);router[_0xd2e1('0x9')]('/:id',auth[_0xd2e1('0xa')](),controller['show']);router[_0xd2e1('0x9')]('/:id/all_conditions',auth[_0xd2e1('0xa')](),controller[_0xd2e1('0xb')]);router[_0xd2e1('0x9')]('/:id/any_conditions',auth[_0xd2e1('0xa')](),controller[_0xd2e1('0xc')]);router[_0xd2e1('0x9')](_0xd2e1('0xd'),auth['isAuthenticated'](),controller[_0xd2e1('0xe')]);router['post']('/',auth[_0xd2e1('0xa')](),controller[_0xd2e1('0xf')]);router[_0xd2e1('0x10')](_0xd2e1('0x11'),auth[_0xd2e1('0xa')](),controller[_0xd2e1('0x12')]);router['post'](_0xd2e1('0x13'),auth[_0xd2e1('0xa')](),controller[_0xd2e1('0x14')]);router[_0xd2e1('0x10')]('/:id/actions',auth[_0xd2e1('0xa')](),controller[_0xd2e1('0x15')]);router[_0xd2e1('0x16')](_0xd2e1('0x17'),auth[_0xd2e1('0xa')](),controller['update']);router[_0xd2e1('0x18')](_0xd2e1('0x17'),auth[_0xd2e1('0xa')](),controller['destroy']);module[_0xd2e1('0x19')]=router; \ No newline at end of file +var _0xad07=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','isAuthenticated','/:id/actions','getActions','post','create','addAllCondition','addAction','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7ad0('0x0'));var util=require(_0x7ad0('0x1'));var path=require('path');var timeout=require(_0x7ad0('0x2'));var express=require(_0x7ad0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7ad0('0x4'));var interaction=require(_0x7ad0('0x5'));var config=require(_0x7ad0('0x6'));var controller=require('./trigger.controller');router[_0x7ad0('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7ad0('0x7')](_0x7ad0('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x7ad0('0x7')](_0x7ad0('0x9'),auth['isAuthenticated'](),controller[_0x7ad0('0xa')]);router[_0x7ad0('0x7')](_0x7ad0('0xb'),auth[_0x7ad0('0xc')](),controller['getAnyConditions']);router[_0x7ad0('0x7')](_0x7ad0('0xd'),auth[_0x7ad0('0xc')](),controller[_0x7ad0('0xe')]);router[_0x7ad0('0xf')]('/',auth[_0x7ad0('0xc')](),controller[_0x7ad0('0x10')]);router[_0x7ad0('0xf')](_0x7ad0('0x9'),auth['isAuthenticated'](),controller[_0x7ad0('0x11')]);router[_0x7ad0('0xf')](_0x7ad0('0xb'),auth[_0x7ad0('0xc')](),controller['addAnyCondition']);router['post'](_0x7ad0('0xd'),auth[_0x7ad0('0xc')](),controller[_0x7ad0('0x12')]);router[_0x7ad0('0x13')](_0x7ad0('0x8'),auth[_0x7ad0('0xc')](),controller[_0x7ad0('0x14')]);router[_0x7ad0('0x15')]('/:id',auth[_0x7ad0('0xc')](),controller[_0x7ad0('0x16')]);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 6a6cd6a..d4785bd 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 _0x9ca1=['sequelize','exports','STRING','BOOLEAN'];(function(_0x90a39a,_0x32020d){var _0x2b62f7=function(_0x6841cc){while(--_0x6841cc){_0x90a39a['push'](_0x90a39a['shift']());}};_0x2b62f7(++_0x32020d);}(_0x9ca1,0x1cc));var _0x19ca=function(_0x200f8f,_0x1228c4){_0x200f8f=_0x200f8f-0x0;var _0x584dc2=_0x9ca1[_0x200f8f];return _0x584dc2;};'use strict';var Sequelize=require(_0x19ca('0x0'));module[_0x19ca('0x1')]={'name':{'type':Sequelize[_0x19ca('0x2')]},'channel':{'type':Sequelize[_0x19ca('0x2')]},'description':{'type':Sequelize[_0x19ca('0x2')]},'status':{'type':Sequelize[_0x19ca('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xfceb=['BOOLEAN','sequelize','exports','STRING'];(function(_0x16e3dc,_0x35770a){var _0x2f1001=function(_0x516ef7){while(--_0x516ef7){_0x16e3dc['push'](_0x16e3dc['shift']());}};_0x2f1001(++_0x35770a);}(_0xfceb,0x109));var _0xbfce=function(_0x5002a6,_0x32b889){_0x5002a6=_0x5002a6-0x0;var _0x656f71=_0xfceb[_0x5002a6];return _0x656f71;};'use strict';var Sequelize=require(_0xbfce('0x0'));module[_0xbfce('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbfce('0x2')]},'description':{'type':Sequelize[_0xbfce('0x2')]},'status':{'type':Sequelize[_0xbfce('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 5a47456..de8a2fc 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 _0xfa3e=['body','user','UserProfileSection','autoAssociation','update','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','getAnyConditions','TriggerId','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','destroy','then','get','Triggers','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','type','key','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','params','keys','includeAll','find','create'];(function(_0x41e478,_0x27bbfc){var _0x4daab6=function(_0x3a582c){while(--_0x3a582c){_0x41e478['push'](_0x41e478['shift']());}};_0x4daab6(++_0x27bbfc);}(_0xfa3e,0x174));var _0xefa3=function(_0x3ae636,_0x247a82){_0x3ae636=_0x3ae636-0x0;var _0x398ea6=_0xfa3e[_0x3ae636];return _0x398ea6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xefa3('0x0'));var jsonpatch=require(_0xefa3('0x1'));var rp=require(_0xefa3('0x2'));var moment=require(_0xefa3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xefa3('0x4'));var path=require(_0xefa3('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xefa3('0x6'));var fs=require('fs');var fs_extra=require(_0xefa3('0x7'));var _=require('lodash');var squel=require(_0xefa3('0x8'));var crypto=require(_0xefa3('0x9'));var jsforce=require(_0xefa3('0xa'));var deskjs=require(_0xefa3('0xb'));var toCsv=require(_0xefa3('0xc'));var querystring=require(_0xefa3('0xd'));var Papa=require(_0xefa3('0xe'));var Redis=require('ioredis');var authService=require(_0xefa3('0xf'));var qs=require(_0xefa3('0x10'));var as=require(_0xefa3('0x11'));var hardwareService=require(_0xefa3('0x12'));var logger=require(_0xefa3('0x13'))(_0xefa3('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x252c01,_0x2a0610){_0x2a0610=_0x2a0610||0xcc;return function(_0x6610cd){if(_0x6610cd){return _0x252c01[_0xefa3('0x15')](_0x2a0610);}return _0x252c01['status'](_0x2a0610)[_0xefa3('0x16')]();};}function respondWithResult(_0x37bdf4,_0x40a196){_0x40a196=_0x40a196||0xc8;return function(_0x415167){if(_0x415167){return _0x37bdf4[_0xefa3('0x17')](_0x40a196)[_0xefa3('0x18')](_0x415167);}};}function respondWithFilteredResult(_0x3ea1cb,_0x21b6ca){return function(_0x54bb3){if(_0x54bb3){var _0x299185=typeof _0x21b6ca[_0xefa3('0x19')]===_0xefa3('0x1a')&&typeof _0x21b6ca[_0xefa3('0x1b')]===_0xefa3('0x1a');var _0x371636=_0x54bb3['count'];var _0x28f0c9=_0x299185?0x0:_0x21b6ca[_0xefa3('0x19')];var _0x3c7b06=_0x299185?_0x54bb3['count']:_0x21b6ca[_0xefa3('0x19')]+_0x21b6ca[_0xefa3('0x1b')];var _0x2d2a86;if(_0x3c7b06>=_0x371636){_0x3c7b06=_0x371636;_0x2d2a86=0xc8;}else{_0x2d2a86=0xce;}_0x3ea1cb['status'](_0x2d2a86);return _0x3ea1cb[_0xefa3('0x1c')](_0xefa3('0x1d'),_0x28f0c9+'-'+_0x3c7b06+'/'+_0x371636)[_0xefa3('0x18')](_0x54bb3);}return null;};}function patchUpdates(_0x5ce344){return function(_0x5d21d1){try{jsonpatch[_0xefa3('0x1e')](_0x5d21d1,_0x5ce344,!![]);}catch(_0x207f92){return BPromise['reject'](_0x207f92);}return _0x5d21d1[_0xefa3('0x1f')]();};}function saveUpdates(_0x4c4959,_0x24c31d){return function(_0x5cf3f2){if(_0x5cf3f2){return _0x5cf3f2['update'](_0x4c4959)['then'](function(_0x178de1){return _0x178de1;});}return null;};}function removeEntity(_0x4eab22,_0x5c07ae){return function(_0x446fe2){if(_0x446fe2){return _0x446fe2[_0xefa3('0x20')]()[_0xefa3('0x21')](function(){var _0x1262a2=_0x446fe2[_0xefa3('0x22')]({'plain':!![]});var _0x5195df=_0xefa3('0x23');return db[_0xefa3('0x24')][_0xefa3('0x20')]({'where':{'type':_0x5195df,'resourceId':_0x1262a2['id']}})[_0xefa3('0x21')](function(){return _0x446fe2;});})['then'](function(){_0x4eab22[_0xefa3('0x17')](0xcc)[_0xefa3('0x16')]();});}};}function handleEntityNotFound(_0x336e96,_0x23028e){return function(_0x228128){if(!_0x228128){_0x336e96['sendStatus'](0x194);}return _0x228128;};}function handleError(_0x25ec35,_0x3abfad){_0x3abfad=_0x3abfad||0x1f4;return function(_0x22f618){logger[_0xefa3('0x25')](_0x22f618[_0xefa3('0x26')]);if(_0x22f618[_0xefa3('0x27')]){delete _0x22f618[_0xefa3('0x27')];}_0x25ec35[_0xefa3('0x17')](_0x3abfad)[_0xefa3('0x28')](_0x22f618);};}exports[_0xefa3('0x29')]=function(_0x28b540,_0x507698){var _0x19e066={},_0xef52d5={},_0x5769d9={'count':0x0,'rows':[]};var _0x102cbf=_[_0xefa3('0x2a')](db[_0xefa3('0x2b')][_0xefa3('0x2c')],function(_0x34f38b){return{'name':_0x34f38b['fieldName'],'type':_0x34f38b[_0xefa3('0x2d')][_0xefa3('0x2e')]};});_0xef52d5[_0xefa3('0x2f')]=_[_0xefa3('0x2a')](_0x102cbf,_0xefa3('0x27'));_0xef52d5['query']=_['keys'](_0x28b540['query']);_0xef52d5[_0xefa3('0x30')]=_['intersection'](_0xef52d5[_0xefa3('0x2f')],_0xef52d5[_0xefa3('0x31')]);_0x19e066[_0xefa3('0x32')]=_[_0xefa3('0x33')](_0xef52d5[_0xefa3('0x2f')],qs['fields'](_0x28b540['query'][_0xefa3('0x34')]));_0x19e066['attributes']=_0x19e066[_0xefa3('0x32')][_0xefa3('0x35')]?_0x19e066[_0xefa3('0x32')]:_0xef52d5[_0xefa3('0x2f')];if(!_0x28b540['query'][_0xefa3('0x36')](_0xefa3('0x37'))){_0x19e066['limit']=qs[_0xefa3('0x1b')](_0x28b540['query'][_0xefa3('0x1b')]);_0x19e066[_0xefa3('0x19')]=qs['offset'](_0x28b540[_0xefa3('0x31')][_0xefa3('0x19')]);}_0x19e066['order']=qs[_0xefa3('0x38')](_0x28b540[_0xefa3('0x31')]['sort']);_0x19e066[_0xefa3('0x39')]=qs[_0xefa3('0x30')](_[_0xefa3('0x3a')](_0x28b540['query'],_0xef52d5[_0xefa3('0x30')]),_0x102cbf);if(_0x28b540[_0xefa3('0x31')]['filter']){_0x19e066[_0xefa3('0x39')]=_[_0xefa3('0x3b')](_0x19e066[_0xefa3('0x39')],{'$or':_[_0xefa3('0x2a')](_0x102cbf,function(_0x1e7b33){if(_0x1e7b33[_0xefa3('0x2d')]!==_0xefa3('0x3c')){var _0x544aeb={};_0x544aeb[_0x1e7b33[_0xefa3('0x27')]]={'$like':'%'+_0x28b540[_0xefa3('0x31')][_0xefa3('0x3d')]+'%'};return _0x544aeb;}})});}_0x19e066=_[_0xefa3('0x3b')]({},_0x19e066,_0x28b540[_0xefa3('0x3e')]);var _0x1dc483={'where':_0x19e066['where']};return db[_0xefa3('0x2b')][_0xefa3('0x3f')](_0x1dc483)[_0xefa3('0x21')](function(_0xb52a0e){_0x5769d9[_0xefa3('0x3f')]=_0xb52a0e;if(_0x28b540['query']['includeAll']){_0x19e066[_0xefa3('0x40')]=[{'all':!![]}];}return db[_0xefa3('0x2b')][_0xefa3('0x41')](_0x19e066);})[_0xefa3('0x21')](function(_0x5858c8){_0x5769d9[_0xefa3('0x42')]=_0x5858c8;return _0x5769d9;})[_0xefa3('0x21')](respondWithFilteredResult(_0x507698,_0x19e066))[_0xefa3('0x43')](handleError(_0x507698,null));};exports['show']=function(_0x248399,_0x244ec1){var _0xb1a917={'raw':![],'where':{'id':_0x248399[_0xefa3('0x44')]['id']}},_0x11e044={};_0x11e044[_0xefa3('0x2f')]=_[_0xefa3('0x45')](db[_0xefa3('0x2b')][_0xefa3('0x2c')]);_0x11e044[_0xefa3('0x31')]=_[_0xefa3('0x45')](_0x248399[_0xefa3('0x31')]);_0x11e044[_0xefa3('0x30')]=_[_0xefa3('0x33')](_0x11e044['model'],_0x11e044[_0xefa3('0x31')]);_0xb1a917[_0xefa3('0x32')]=_[_0xefa3('0x33')](_0x11e044[_0xefa3('0x2f')],qs[_0xefa3('0x34')](_0x248399[_0xefa3('0x31')]['fields']));_0xb1a917[_0xefa3('0x32')]=_0xb1a917[_0xefa3('0x32')]['length']?_0xb1a917[_0xefa3('0x32')]:_0x11e044[_0xefa3('0x2f')];if(_0x248399[_0xefa3('0x31')][_0xefa3('0x46')]){_0xb1a917['include']=[{'all':!![]}];}_0xb1a917=_[_0xefa3('0x3b')]({},_0xb1a917,_0x248399[_0xefa3('0x3e')]);return db[_0xefa3('0x2b')][_0xefa3('0x47')](_0xb1a917)[_0xefa3('0x21')](handleEntityNotFound(_0x244ec1,null))[_0xefa3('0x21')](respondWithResult(_0x244ec1,null))[_0xefa3('0x43')](handleError(_0x244ec1,null));};exports[_0xefa3('0x48')]=function(_0x455166,_0x1c975e){return db['Trigger'][_0xefa3('0x48')](_0x455166[_0xefa3('0x49')],{})['then'](function(_0x36ae2a){var _0x2387c9=_0x455166[_0xefa3('0x4a')][_0xefa3('0x22')]({'plain':!![]});if(!_0x2387c9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2387c9['role']===_0xefa3('0x4a')){var _0x407010=_0x36ae2a['get']({'plain':!![]});var _0x2d9355=_0xefa3('0x23');return db[_0xefa3('0x4b')][_0xefa3('0x47')]({'where':{'name':_0x2d9355,'userProfileId':_0x2387c9['userProfileId']},'raw':!![]})[_0xefa3('0x21')](function(_0x35beb7){if(_0x35beb7&&_0x35beb7[_0xefa3('0x4c')]===0x0){return db[_0xefa3('0x24')][_0xefa3('0x48')]({'name':_0x407010[_0xefa3('0x27')],'resourceId':_0x407010['id'],'type':_0x35beb7[_0xefa3('0x27')],'sectionId':_0x35beb7['id']},{})['then'](function(){return _0x36ae2a;});}else{return _0x36ae2a;}})['catch'](function(_0x20dd07){logger[_0xefa3('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20dd07);throw _0x20dd07;});}return _0x36ae2a;})[_0xefa3('0x21')](respondWithResult(_0x1c975e,0xc9))[_0xefa3('0x43')](handleError(_0x1c975e,null));};exports[_0xefa3('0x4d')]=function(_0x5ecd81,_0x5b28a7){if(_0x5ecd81[_0xefa3('0x49')]['id']){delete _0x5ecd81['body']['id'];}return db['Trigger'][_0xefa3('0x47')]({'where':{'id':_0x5ecd81[_0xefa3('0x44')]['id']}})[_0xefa3('0x21')](handleEntityNotFound(_0x5b28a7,null))[_0xefa3('0x21')](saveUpdates(_0x5ecd81[_0xefa3('0x49')],null))[_0xefa3('0x21')](respondWithResult(_0x5b28a7,null))[_0xefa3('0x43')](handleError(_0x5b28a7,null));};exports[_0xefa3('0x20')]=function(_0x3f4452,_0x5d4bd5){return db['Trigger'][_0xefa3('0x47')]({'where':{'id':_0x3f4452[_0xefa3('0x44')]['id']}})[_0xefa3('0x21')](handleEntityNotFound(_0x5d4bd5,null))[_0xefa3('0x21')](removeEntity(_0x5d4bd5,null))[_0xefa3('0x43')](handleError(_0x5d4bd5,null));};exports['addAllCondition']=function(_0x4aa0c8,_0xe531d3,_0x17b664){if(_0x4aa0c8['body']['id']){delete _0x4aa0c8[_0xefa3('0x49')]['id'];}return db[_0xefa3('0x2b')][_0xefa3('0x47')]({'where':{'id':_0x4aa0c8['params']['id']}})['then'](handleEntityNotFound(_0xe531d3,null))[_0xefa3('0x21')](function(_0x23cfdf){if(_0x23cfdf){_0x4aa0c8[_0xefa3('0x49')][_0xefa3('0x4e')]=_0x23cfdf['id'];return db[_0xefa3('0x4f')][_0xefa3('0x48')](_0x4aa0c8['body']);}})[_0xefa3('0x21')](respondWithResult(_0xe531d3,null))[_0xefa3('0x43')](handleError(_0xe531d3,null));};exports[_0xefa3('0x50')]=function(_0x34392d,_0x592b88,_0xb7cca9){if(_0x34392d[_0xefa3('0x49')]['id']){delete _0x34392d[_0xefa3('0x49')]['id'];}return db[_0xefa3('0x2b')]['find']({'where':{'id':_0x34392d[_0xefa3('0x44')]['id']}})[_0xefa3('0x21')](handleEntityNotFound(_0x592b88,null))[_0xefa3('0x21')](function(_0x5a4106){if(_0x5a4106){_0x34392d[_0xefa3('0x49')][_0xefa3('0x51')]=_0x5a4106['id'];return db['Condition']['create'](_0x34392d[_0xefa3('0x49')]);}})[_0xefa3('0x21')](respondWithResult(_0x592b88,null))['catch'](handleError(_0x592b88,null));};exports[_0xefa3('0x52')]=function(_0x15fa0a,_0x4f44eb,_0x397d7b){var _0x59a8cb={};var _0x5254bc={};var _0x26affd;var _0x283ee4;return db['Trigger'][_0xefa3('0x53')]({'where':{'id':_0x15fa0a[_0xefa3('0x44')]['id']}})[_0xefa3('0x21')](handleEntityNotFound(_0x4f44eb,null))[_0xefa3('0x21')](function(_0x16cd05){if(_0x16cd05){_0x26affd=_0x16cd05;_0x5254bc['model']=_[_0xefa3('0x45')](db[_0xefa3('0x4f')][_0xefa3('0x2c')]);_0x5254bc[_0xefa3('0x31')]=_[_0xefa3('0x45')](_0x15fa0a['query']);_0x5254bc[_0xefa3('0x30')]=_[_0xefa3('0x33')](_0x5254bc[_0xefa3('0x2f')],_0x5254bc[_0xefa3('0x31')]);_0x59a8cb[_0xefa3('0x32')]=_[_0xefa3('0x33')](_0x5254bc[_0xefa3('0x2f')],qs[_0xefa3('0x34')](_0x15fa0a[_0xefa3('0x31')][_0xefa3('0x34')]));_0x59a8cb[_0xefa3('0x32')]=_0x59a8cb[_0xefa3('0x32')][_0xefa3('0x35')]?_0x59a8cb[_0xefa3('0x32')]:_0x5254bc['model'];_0x59a8cb[_0xefa3('0x54')]=qs[_0xefa3('0x38')](_0x15fa0a[_0xefa3('0x31')]['sort']);_0x59a8cb[_0xefa3('0x39')]=qs[_0xefa3('0x30')](_[_0xefa3('0x3a')](_0x15fa0a[_0xefa3('0x31')],_0x5254bc['filters']));if(_0x15fa0a[_0xefa3('0x31')][_0xefa3('0x3d')]){_0x59a8cb[_0xefa3('0x39')]=_[_0xefa3('0x3b')](_0x59a8cb['where'],{'$or':_['map'](_0x59a8cb['attributes'],function(_0x385586){var _0x307936={};_0x307936[_0x385586]={'$like':'%'+_0x15fa0a[_0xefa3('0x31')][_0xefa3('0x3d')]+'%'};return _0x307936;})});}_0x59a8cb=_[_0xefa3('0x3b')]({},_0x59a8cb,_0x15fa0a[_0xefa3('0x3e')]);return _0x26affd['getAllConditions'](_0x59a8cb);}})['then'](function(_0x36019b){if(_0x36019b){_0x283ee4=_0x36019b[_0xefa3('0x35')];if(!_0x15fa0a['query'][_0xefa3('0x36')]('nolimit')){_0x59a8cb[_0xefa3('0x1b')]=qs[_0xefa3('0x1b')](_0x15fa0a['query']['limit']);_0x59a8cb[_0xefa3('0x19')]=qs[_0xefa3('0x19')](_0x15fa0a[_0xefa3('0x31')][_0xefa3('0x19')]);}return _0x26affd[_0xefa3('0x52')](_0x59a8cb);}})['then'](function(_0x57ef46){if(_0x57ef46){return _0x57ef46?{'count':_0x283ee4,'rows':_0x57ef46}:null;}})[_0xefa3('0x21')](respondWithResult(_0x4f44eb,null))[_0xefa3('0x43')](handleError(_0x4f44eb,null));};exports[_0xefa3('0x55')]=function(_0x2c09c3,_0x377873,_0x327e78){var _0x5ba60e={};var _0x3e85c3={};var _0x4952a0;var _0x21afb9;return db['Trigger'][_0xefa3('0x53')]({'where':{'id':_0x2c09c3[_0xefa3('0x44')]['id']}})[_0xefa3('0x21')](handleEntityNotFound(_0x377873,null))['then'](function(_0x20fa5d){if(_0x20fa5d){_0x4952a0=_0x20fa5d;_0x3e85c3[_0xefa3('0x2f')]=_[_0xefa3('0x45')](db[_0xefa3('0x4f')][_0xefa3('0x2c')]);_0x3e85c3[_0xefa3('0x31')]=_[_0xefa3('0x45')](_0x2c09c3[_0xefa3('0x31')]);_0x3e85c3[_0xefa3('0x30')]=_['intersection'](_0x3e85c3[_0xefa3('0x2f')],_0x3e85c3['query']);_0x5ba60e[_0xefa3('0x32')]=_[_0xefa3('0x33')](_0x3e85c3[_0xefa3('0x2f')],qs[_0xefa3('0x34')](_0x2c09c3[_0xefa3('0x31')][_0xefa3('0x34')]));_0x5ba60e[_0xefa3('0x32')]=_0x5ba60e[_0xefa3('0x32')]['length']?_0x5ba60e[_0xefa3('0x32')]:_0x3e85c3[_0xefa3('0x2f')];_0x5ba60e['order']=qs[_0xefa3('0x38')](_0x2c09c3[_0xefa3('0x31')]['sort']);_0x5ba60e[_0xefa3('0x39')]=qs[_0xefa3('0x30')](_[_0xefa3('0x3a')](_0x2c09c3[_0xefa3('0x31')],_0x3e85c3[_0xefa3('0x30')]));if(_0x2c09c3[_0xefa3('0x31')][_0xefa3('0x3d')]){_0x5ba60e[_0xefa3('0x39')]=_['merge'](_0x5ba60e[_0xefa3('0x39')],{'$or':_[_0xefa3('0x2a')](_0x5ba60e[_0xefa3('0x32')],function(_0x2d3c65){var _0x29a11f={};_0x29a11f[_0x2d3c65]={'$like':'%'+_0x2c09c3[_0xefa3('0x31')]['filter']+'%'};return _0x29a11f;})});}_0x5ba60e=_['merge']({},_0x5ba60e,_0x2c09c3[_0xefa3('0x3e')]);return _0x4952a0[_0xefa3('0x55')](_0x5ba60e);}})[_0xefa3('0x21')](function(_0x30a57f){if(_0x30a57f){_0x21afb9=_0x30a57f[_0xefa3('0x35')];if(!_0x2c09c3[_0xefa3('0x31')][_0xefa3('0x36')](_0xefa3('0x37'))){_0x5ba60e[_0xefa3('0x1b')]=qs[_0xefa3('0x1b')](_0x2c09c3[_0xefa3('0x31')]['limit']);_0x5ba60e[_0xefa3('0x19')]=qs[_0xefa3('0x19')](_0x2c09c3[_0xefa3('0x31')][_0xefa3('0x19')]);}return _0x4952a0[_0xefa3('0x55')](_0x5ba60e);}})[_0xefa3('0x21')](function(_0x4a4430){if(_0x4a4430){return _0x4a4430?{'count':_0x21afb9,'rows':_0x4a4430}:null;}})[_0xefa3('0x21')](respondWithResult(_0x377873,null))['catch'](handleError(_0x377873,null));};exports['addAction']=function(_0x419cb1,_0x1d675d,_0x7b23ab){if(_0x419cb1[_0xefa3('0x49')]['id']){delete _0x419cb1[_0xefa3('0x49')]['id'];}return db[_0xefa3('0x2b')][_0xefa3('0x47')]({'where':{'id':_0x419cb1[_0xefa3('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d675d,null))['then'](function(_0x36bfc3){if(_0x36bfc3){_0x419cb1['body'][_0xefa3('0x56')]=_0x36bfc3['id'];return db[_0xefa3('0x57')][_0xefa3('0x48')](_0x419cb1[_0xefa3('0x49')]);}})[_0xefa3('0x21')](respondWithResult(_0x1d675d,null))['catch'](handleError(_0x1d675d,null));};exports['getActions']=function(_0x48d802,_0x171778,_0x3ffd4b){var _0x208dc9={};var _0x5c334b={};var _0x4fe296;var _0x20d2af;return db[_0xefa3('0x2b')][_0xefa3('0x53')]({'where':{'id':_0x48d802['params']['id']}})[_0xefa3('0x21')](handleEntityNotFound(_0x171778,null))[_0xefa3('0x21')](function(_0x54aa8b){if(_0x54aa8b){_0x4fe296=_0x54aa8b;_0x5c334b[_0xefa3('0x2f')]=_[_0xefa3('0x45')](db[_0xefa3('0x57')][_0xefa3('0x2c')]);_0x5c334b[_0xefa3('0x31')]=_[_0xefa3('0x45')](_0x48d802['query']);_0x5c334b['filters']=_['intersection'](_0x5c334b[_0xefa3('0x2f')],_0x5c334b['query']);_0x208dc9[_0xefa3('0x32')]=_['intersection'](_0x5c334b[_0xefa3('0x2f')],qs['fields'](_0x48d802[_0xefa3('0x31')][_0xefa3('0x34')]));_0x208dc9['attributes']=_0x208dc9[_0xefa3('0x32')][_0xefa3('0x35')]?_0x208dc9[_0xefa3('0x32')]:_0x5c334b[_0xefa3('0x2f')];_0x208dc9['order']=qs[_0xefa3('0x38')](_0x48d802[_0xefa3('0x31')][_0xefa3('0x38')]);_0x208dc9[_0xefa3('0x39')]=qs['filters'](_['pick'](_0x48d802[_0xefa3('0x31')],_0x5c334b['filters']));if(_0x48d802[_0xefa3('0x31')][_0xefa3('0x3d')]){_0x208dc9[_0xefa3('0x39')]=_[_0xefa3('0x3b')](_0x208dc9['where'],{'$or':_[_0xefa3('0x2a')](_0x208dc9['attributes'],function(_0x294534){var _0xbb19f3={};_0xbb19f3[_0x294534]={'$like':'%'+_0x48d802['query'][_0xefa3('0x3d')]+'%'};return _0xbb19f3;})});}_0x208dc9=_['merge']({},_0x208dc9,_0x48d802[_0xefa3('0x3e')]);return _0x4fe296[_0xefa3('0x58')](_0x208dc9);}})[_0xefa3('0x21')](function(_0x583765){if(_0x583765){_0x20d2af=_0x583765['length'];if(!_0x48d802[_0xefa3('0x31')]['hasOwnProperty'](_0xefa3('0x37'))){_0x208dc9['limit']=qs[_0xefa3('0x1b')](_0x48d802[_0xefa3('0x31')][_0xefa3('0x1b')]);_0x208dc9['offset']=qs[_0xefa3('0x19')](_0x48d802[_0xefa3('0x31')][_0xefa3('0x19')]);}return _0x4fe296[_0xefa3('0x58')](_0x208dc9);}})[_0xefa3('0x21')](function(_0x3a29d0){if(_0x3a29d0){return _0x3a29d0?{'count':_0x20d2af,'rows':_0x3a29d0}:null;}})[_0xefa3('0x21')](respondWithResult(_0x171778,null))[_0xefa3('0x43')](handleError(_0x171778,null));}; \ No newline at end of file +var _0xd307=['params','includeAll','create','body','user','role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','update','destroy','then','get','Triggers','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show'];(function(_0x418517,_0x27ad62){var _0x4022b9=function(_0x25fcd2){while(--_0x25fcd2){_0x418517['push'](_0x418517['shift']());}};_0x4022b9(++_0x27ad62);}(_0xd307,0x12b));var _0x7d30=function(_0x38e8b5,_0x1c3fb3){_0x38e8b5=_0x38e8b5-0x0;var _0x39985a=_0xd307[_0x38e8b5];return _0x39985a;};'use strict';var emlformat=require(_0x7d30('0x0'));var rimraf=require(_0x7d30('0x1'));var zipdir=require(_0x7d30('0x2'));var jsonpatch=require(_0x7d30('0x3'));var rp=require(_0x7d30('0x4'));var moment=require(_0x7d30('0x5'));var BPromise=require(_0x7d30('0x6'));var Mustache=require(_0x7d30('0x7'));var util=require('util');var path=require('path');var sox=require(_0x7d30('0x8'));var csv=require(_0x7d30('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d30('0xa'));var _=require('lodash');var squel=require(_0x7d30('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d30('0xc'));var toCsv=require(_0x7d30('0x9'));var querystring=require(_0x7d30('0xd'));var Papa=require(_0x7d30('0xe'));var Redis=require(_0x7d30('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7d30('0x10'));var hardwareService=require(_0x7d30('0x11'));var logger=require(_0x7d30('0x12'))('api');var utils=require(_0x7d30('0x13'));var config=require(_0x7d30('0x14'));var licenseUtil=require(_0x7d30('0x15'));var db=require(_0x7d30('0x16'))['db'];function respondWithStatusCode(_0x111198,_0x1feb66){_0x1feb66=_0x1feb66||0xcc;return function(_0x4573d0){if(_0x4573d0){return _0x111198[_0x7d30('0x17')](_0x1feb66);}return _0x111198['status'](_0x1feb66)[_0x7d30('0x18')]();};}function respondWithResult(_0x1d10c2,_0x4ca814){_0x4ca814=_0x4ca814||0xc8;return function(_0x37076e){if(_0x37076e){return _0x1d10c2[_0x7d30('0x19')](_0x4ca814)[_0x7d30('0x1a')](_0x37076e);}};}function respondWithFilteredResult(_0x34f313,_0x2ca04d){return function(_0xf916dd){if(_0xf916dd){var _0x3b29d2=typeof _0x2ca04d[_0x7d30('0x1b')]===_0x7d30('0x1c')&&typeof _0x2ca04d['limit']===_0x7d30('0x1c');var _0x26ead6=_0xf916dd[_0x7d30('0x1d')];var _0x263831=_0x3b29d2?0x0:_0x2ca04d['offset'];var _0x5df666=_0x3b29d2?_0xf916dd[_0x7d30('0x1d')]:_0x2ca04d[_0x7d30('0x1b')]+_0x2ca04d['limit'];var _0x3a593e;if(_0x5df666>=_0x26ead6){_0x5df666=_0x26ead6;_0x3a593e=0xc8;}else{_0x3a593e=0xce;}_0x34f313[_0x7d30('0x19')](_0x3a593e);return _0x34f313[_0x7d30('0x1e')](_0x7d30('0x1f'),_0x263831+'-'+_0x5df666+'/'+_0x26ead6)['json'](_0xf916dd);}return null;};}function patchUpdates(_0x146c17){return function(_0x3d3064){try{jsonpatch[_0x7d30('0x20')](_0x3d3064,_0x146c17,!![]);}catch(_0x8621e1){return BPromise['reject'](_0x8621e1);}return _0x3d3064['save']();};}function saveUpdates(_0x3e5610,_0x43fe0e){return function(_0x50dd75){if(_0x50dd75){return _0x50dd75[_0x7d30('0x21')](_0x3e5610)['then'](function(_0x3404e4){return _0x3404e4;});}return null;};}function removeEntity(_0x46cf96,_0x4b9190){return function(_0x4dd7fe){if(_0x4dd7fe){return _0x4dd7fe[_0x7d30('0x22')]()[_0x7d30('0x23')](function(){var _0x438750=_0x4dd7fe[_0x7d30('0x24')]({'plain':!![]});var _0x51b3d8=_0x7d30('0x25');return db['UserProfileResource'][_0x7d30('0x22')]({'where':{'type':_0x51b3d8,'resourceId':_0x438750['id']}})[_0x7d30('0x23')](function(){return _0x4dd7fe;});})[_0x7d30('0x23')](function(){_0x46cf96[_0x7d30('0x19')](0xcc)[_0x7d30('0x18')]();});}};}function handleEntityNotFound(_0x1b2eaf,_0x11ff9a){return function(_0x34c25f){if(!_0x34c25f){_0x1b2eaf[_0x7d30('0x17')](0x194);}return _0x34c25f;};}function handleError(_0x51a731,_0x5832d8){_0x5832d8=_0x5832d8||0x1f4;return function(_0x32f22a){logger[_0x7d30('0x26')](_0x32f22a[_0x7d30('0x27')]);if(_0x32f22a[_0x7d30('0x28')]){delete _0x32f22a[_0x7d30('0x28')];}_0x51a731[_0x7d30('0x19')](_0x5832d8)[_0x7d30('0x29')](_0x32f22a);};}exports[_0x7d30('0x2a')]=function(_0x2050b9,_0x500186){var _0x41a0bd={},_0x4e1ff9={},_0x4eac87={'count':0x0,'rows':[]};var _0x673c95=_[_0x7d30('0x2b')](db[_0x7d30('0x2c')][_0x7d30('0x2d')],function(_0x43748c){return{'name':_0x43748c[_0x7d30('0x2e')],'type':_0x43748c[_0x7d30('0x2f')][_0x7d30('0x30')]};});_0x4e1ff9[_0x7d30('0x31')]=_[_0x7d30('0x2b')](_0x673c95,_0x7d30('0x28'));_0x4e1ff9[_0x7d30('0x32')]=_[_0x7d30('0x33')](_0x2050b9[_0x7d30('0x32')]);_0x4e1ff9[_0x7d30('0x34')]=_['intersection'](_0x4e1ff9[_0x7d30('0x31')],_0x4e1ff9[_0x7d30('0x32')]);_0x41a0bd['attributes']=_[_0x7d30('0x35')](_0x4e1ff9[_0x7d30('0x31')],qs[_0x7d30('0x36')](_0x2050b9[_0x7d30('0x32')]['fields']));_0x41a0bd['attributes']=_0x41a0bd[_0x7d30('0x37')][_0x7d30('0x38')]?_0x41a0bd[_0x7d30('0x37')]:_0x4e1ff9[_0x7d30('0x31')];if(!_0x2050b9[_0x7d30('0x32')][_0x7d30('0x39')](_0x7d30('0x3a'))){_0x41a0bd[_0x7d30('0x3b')]=qs[_0x7d30('0x3b')](_0x2050b9[_0x7d30('0x32')][_0x7d30('0x3b')]);_0x41a0bd['offset']=qs['offset'](_0x2050b9[_0x7d30('0x32')][_0x7d30('0x1b')]);}_0x41a0bd[_0x7d30('0x3c')]=qs['sort'](_0x2050b9[_0x7d30('0x32')][_0x7d30('0x3d')]);_0x41a0bd[_0x7d30('0x3e')]=qs['filters'](_[_0x7d30('0x3f')](_0x2050b9[_0x7d30('0x32')],_0x4e1ff9[_0x7d30('0x34')]),_0x673c95);if(_0x2050b9['query']['filter']){_0x41a0bd['where']=_['merge'](_0x41a0bd[_0x7d30('0x3e')],{'$or':_['map'](_0x673c95,function(_0x19e465){if(_0x19e465['type']!==_0x7d30('0x40')){var _0x35e697={};_0x35e697[_0x19e465[_0x7d30('0x28')]]={'$like':'%'+_0x2050b9[_0x7d30('0x32')][_0x7d30('0x41')]+'%'};return _0x35e697;}})});}_0x41a0bd=_[_0x7d30('0x42')]({},_0x41a0bd,_0x2050b9[_0x7d30('0x43')]);var _0x2d711b={'where':_0x41a0bd[_0x7d30('0x3e')]};return db['Trigger'][_0x7d30('0x1d')](_0x2d711b)[_0x7d30('0x23')](function(_0x4506a8){_0x4eac87[_0x7d30('0x1d')]=_0x4506a8;if(_0x2050b9[_0x7d30('0x32')]['includeAll']){_0x41a0bd[_0x7d30('0x44')]=[{'all':!![]}];}return db[_0x7d30('0x2c')][_0x7d30('0x45')](_0x41a0bd);})[_0x7d30('0x23')](function(_0x2854fb){_0x4eac87[_0x7d30('0x46')]=_0x2854fb;return _0x4eac87;})[_0x7d30('0x23')](respondWithFilteredResult(_0x500186,_0x41a0bd))[_0x7d30('0x47')](handleError(_0x500186,null));};exports[_0x7d30('0x48')]=function(_0x3b2688,_0x5c5ad7){var _0xa3ee56={'raw':![],'where':{'id':_0x3b2688[_0x7d30('0x49')]['id']}},_0x4037cc={};_0x4037cc[_0x7d30('0x31')]=_[_0x7d30('0x33')](db[_0x7d30('0x2c')][_0x7d30('0x2d')]);_0x4037cc['query']=_[_0x7d30('0x33')](_0x3b2688[_0x7d30('0x32')]);_0x4037cc[_0x7d30('0x34')]=_[_0x7d30('0x35')](_0x4037cc[_0x7d30('0x31')],_0x4037cc[_0x7d30('0x32')]);_0xa3ee56[_0x7d30('0x37')]=_[_0x7d30('0x35')](_0x4037cc[_0x7d30('0x31')],qs['fields'](_0x3b2688[_0x7d30('0x32')][_0x7d30('0x36')]));_0xa3ee56[_0x7d30('0x37')]=_0xa3ee56['attributes'][_0x7d30('0x38')]?_0xa3ee56[_0x7d30('0x37')]:_0x4037cc['model'];if(_0x3b2688[_0x7d30('0x32')][_0x7d30('0x4a')]){_0xa3ee56[_0x7d30('0x44')]=[{'all':!![]}];}_0xa3ee56=_['merge']({},_0xa3ee56,_0x3b2688['options']);return db[_0x7d30('0x2c')]['find'](_0xa3ee56)['then'](handleEntityNotFound(_0x5c5ad7,null))[_0x7d30('0x23')](respondWithResult(_0x5c5ad7,null))['catch'](handleError(_0x5c5ad7,null));};exports['create']=function(_0x2533e0,_0x3c371e){return db[_0x7d30('0x2c')][_0x7d30('0x4b')](_0x2533e0[_0x7d30('0x4c')],{})['then'](function(_0x585843){var _0x4a29cb=_0x2533e0[_0x7d30('0x4d')][_0x7d30('0x24')]({'plain':!![]});if(!_0x4a29cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a29cb[_0x7d30('0x4e')]===_0x7d30('0x4d')){var _0xc4658a=_0x585843['get']({'plain':!![]});var _0x12fd2b=_0x7d30('0x25');return db[_0x7d30('0x4f')][_0x7d30('0x50')]({'where':{'name':_0x12fd2b,'userProfileId':_0x4a29cb[_0x7d30('0x51')]},'raw':!![]})[_0x7d30('0x23')](function(_0x15ca40){if(_0x15ca40&&_0x15ca40['autoAssociation']===0x0){return db[_0x7d30('0x52')][_0x7d30('0x4b')]({'name':_0xc4658a[_0x7d30('0x28')],'resourceId':_0xc4658a['id'],'type':_0x15ca40['name'],'sectionId':_0x15ca40['id']},{})[_0x7d30('0x23')](function(){return _0x585843;});}else{return _0x585843;}})[_0x7d30('0x47')](function(_0x23cdce){logger[_0x7d30('0x26')](_0x7d30('0x53'),_0x23cdce);throw _0x23cdce;});}return _0x585843;})[_0x7d30('0x23')](respondWithResult(_0x3c371e,0xc9))[_0x7d30('0x47')](handleError(_0x3c371e,null));};exports['update']=function(_0x13a75f,_0x1fa15c){if(_0x13a75f['body']['id']){delete _0x13a75f[_0x7d30('0x4c')]['id'];}return db['Trigger'][_0x7d30('0x50')]({'where':{'id':_0x13a75f[_0x7d30('0x49')]['id']}})[_0x7d30('0x23')](handleEntityNotFound(_0x1fa15c,null))[_0x7d30('0x23')](saveUpdates(_0x13a75f[_0x7d30('0x4c')],null))[_0x7d30('0x23')](respondWithResult(_0x1fa15c,null))['catch'](handleError(_0x1fa15c,null));};exports['destroy']=function(_0x5f1b48,_0x263f20){return db[_0x7d30('0x2c')][_0x7d30('0x50')]({'where':{'id':_0x5f1b48[_0x7d30('0x49')]['id']}})[_0x7d30('0x23')](handleEntityNotFound(_0x263f20,null))[_0x7d30('0x23')](removeEntity(_0x263f20,null))[_0x7d30('0x47')](handleError(_0x263f20,null));};exports[_0x7d30('0x54')]=function(_0x571014,_0x29a310,_0x2407df){if(_0x571014[_0x7d30('0x4c')]['id']){delete _0x571014['body']['id'];}return db[_0x7d30('0x2c')][_0x7d30('0x50')]({'where':{'id':_0x571014[_0x7d30('0x49')]['id']}})[_0x7d30('0x23')](handleEntityNotFound(_0x29a310,null))[_0x7d30('0x23')](function(_0x595a2f){if(_0x595a2f){_0x571014['body']['TriggerAllId']=_0x595a2f['id'];return db[_0x7d30('0x55')][_0x7d30('0x4b')](_0x571014['body']);}})[_0x7d30('0x23')](respondWithResult(_0x29a310,null))[_0x7d30('0x47')](handleError(_0x29a310,null));};exports['addAnyCondition']=function(_0x22f009,_0x344e0e,_0x54b16b){if(_0x22f009[_0x7d30('0x4c')]['id']){delete _0x22f009[_0x7d30('0x4c')]['id'];}return db[_0x7d30('0x2c')]['find']({'where':{'id':_0x22f009['params']['id']}})['then'](handleEntityNotFound(_0x344e0e,null))[_0x7d30('0x23')](function(_0x1cacea){if(_0x1cacea){_0x22f009['body'][_0x7d30('0x56')]=_0x1cacea['id'];return db[_0x7d30('0x55')][_0x7d30('0x4b')](_0x22f009[_0x7d30('0x4c')]);}})['then'](respondWithResult(_0x344e0e,null))[_0x7d30('0x47')](handleError(_0x344e0e,null));};exports[_0x7d30('0x57')]=function(_0x5e72a4,_0x33719d,_0x135a9f){var _0xc6a49d={};var _0x2e83f3={};var _0x595fc2;var _0x136909;return db[_0x7d30('0x2c')][_0x7d30('0x58')]({'where':{'id':_0x5e72a4[_0x7d30('0x49')]['id']}})[_0x7d30('0x23')](handleEntityNotFound(_0x33719d,null))[_0x7d30('0x23')](function(_0x4c9c3f){if(_0x4c9c3f){_0x595fc2=_0x4c9c3f;_0x2e83f3[_0x7d30('0x31')]=_[_0x7d30('0x33')](db[_0x7d30('0x55')][_0x7d30('0x2d')]);_0x2e83f3[_0x7d30('0x32')]=_[_0x7d30('0x33')](_0x5e72a4[_0x7d30('0x32')]);_0x2e83f3['filters']=_['intersection'](_0x2e83f3['model'],_0x2e83f3[_0x7d30('0x32')]);_0xc6a49d[_0x7d30('0x37')]=_[_0x7d30('0x35')](_0x2e83f3['model'],qs[_0x7d30('0x36')](_0x5e72a4[_0x7d30('0x32')][_0x7d30('0x36')]));_0xc6a49d[_0x7d30('0x37')]=_0xc6a49d[_0x7d30('0x37')][_0x7d30('0x38')]?_0xc6a49d[_0x7d30('0x37')]:_0x2e83f3[_0x7d30('0x31')];_0xc6a49d[_0x7d30('0x3c')]=qs[_0x7d30('0x3d')](_0x5e72a4[_0x7d30('0x32')]['sort']);_0xc6a49d[_0x7d30('0x3e')]=qs['filters'](_[_0x7d30('0x3f')](_0x5e72a4[_0x7d30('0x32')],_0x2e83f3[_0x7d30('0x34')]));if(_0x5e72a4[_0x7d30('0x32')][_0x7d30('0x41')]){_0xc6a49d[_0x7d30('0x3e')]=_[_0x7d30('0x42')](_0xc6a49d[_0x7d30('0x3e')],{'$or':_[_0x7d30('0x2b')](_0xc6a49d[_0x7d30('0x37')],function(_0x2cdd71){var _0x4da3e4={};_0x4da3e4[_0x2cdd71]={'$like':'%'+_0x5e72a4[_0x7d30('0x32')]['filter']+'%'};return _0x4da3e4;})});}_0xc6a49d=_[_0x7d30('0x42')]({},_0xc6a49d,_0x5e72a4[_0x7d30('0x43')]);return _0x595fc2[_0x7d30('0x57')](_0xc6a49d);}})[_0x7d30('0x23')](function(_0x227a95){if(_0x227a95){_0x136909=_0x227a95[_0x7d30('0x38')];if(!_0x5e72a4[_0x7d30('0x32')][_0x7d30('0x39')](_0x7d30('0x3a'))){_0xc6a49d[_0x7d30('0x3b')]=qs[_0x7d30('0x3b')](_0x5e72a4[_0x7d30('0x32')][_0x7d30('0x3b')]);_0xc6a49d[_0x7d30('0x1b')]=qs[_0x7d30('0x1b')](_0x5e72a4[_0x7d30('0x32')]['offset']);}return _0x595fc2[_0x7d30('0x57')](_0xc6a49d);}})[_0x7d30('0x23')](function(_0x2769a6){if(_0x2769a6){return _0x2769a6?{'count':_0x136909,'rows':_0x2769a6}:null;}})[_0x7d30('0x23')](respondWithResult(_0x33719d,null))['catch'](handleError(_0x33719d,null));};exports[_0x7d30('0x59')]=function(_0x1f5e6b,_0xc8e477,_0x39821a){var _0x5e4127={};var _0x1e0fb0={};var _0xfee27a;var _0x227db7;return db[_0x7d30('0x2c')]['findOne']({'where':{'id':_0x1f5e6b[_0x7d30('0x49')]['id']}})[_0x7d30('0x23')](handleEntityNotFound(_0xc8e477,null))[_0x7d30('0x23')](function(_0x1fbe89){if(_0x1fbe89){_0xfee27a=_0x1fbe89;_0x1e0fb0[_0x7d30('0x31')]=_['keys'](db[_0x7d30('0x55')][_0x7d30('0x2d')]);_0x1e0fb0[_0x7d30('0x32')]=_[_0x7d30('0x33')](_0x1f5e6b['query']);_0x1e0fb0[_0x7d30('0x34')]=_[_0x7d30('0x35')](_0x1e0fb0[_0x7d30('0x31')],_0x1e0fb0['query']);_0x5e4127[_0x7d30('0x37')]=_[_0x7d30('0x35')](_0x1e0fb0[_0x7d30('0x31')],qs['fields'](_0x1f5e6b['query'][_0x7d30('0x36')]));_0x5e4127[_0x7d30('0x37')]=_0x5e4127[_0x7d30('0x37')][_0x7d30('0x38')]?_0x5e4127[_0x7d30('0x37')]:_0x1e0fb0[_0x7d30('0x31')];_0x5e4127[_0x7d30('0x3c')]=qs[_0x7d30('0x3d')](_0x1f5e6b['query'][_0x7d30('0x3d')]);_0x5e4127[_0x7d30('0x3e')]=qs[_0x7d30('0x34')](_['pick'](_0x1f5e6b[_0x7d30('0x32')],_0x1e0fb0[_0x7d30('0x34')]));if(_0x1f5e6b[_0x7d30('0x32')][_0x7d30('0x41')]){_0x5e4127[_0x7d30('0x3e')]=_[_0x7d30('0x42')](_0x5e4127[_0x7d30('0x3e')],{'$or':_[_0x7d30('0x2b')](_0x5e4127['attributes'],function(_0x43051b){var _0x37d043={};_0x37d043[_0x43051b]={'$like':'%'+_0x1f5e6b[_0x7d30('0x32')][_0x7d30('0x41')]+'%'};return _0x37d043;})});}_0x5e4127=_[_0x7d30('0x42')]({},_0x5e4127,_0x1f5e6b[_0x7d30('0x43')]);return _0xfee27a['getAnyConditions'](_0x5e4127);}})['then'](function(_0x3da408){if(_0x3da408){_0x227db7=_0x3da408[_0x7d30('0x38')];if(!_0x1f5e6b['query'][_0x7d30('0x39')](_0x7d30('0x3a'))){_0x5e4127['limit']=qs['limit'](_0x1f5e6b[_0x7d30('0x32')][_0x7d30('0x3b')]);_0x5e4127[_0x7d30('0x1b')]=qs[_0x7d30('0x1b')](_0x1f5e6b[_0x7d30('0x32')][_0x7d30('0x1b')]);}return _0xfee27a[_0x7d30('0x59')](_0x5e4127);}})[_0x7d30('0x23')](function(_0x4e2328){if(_0x4e2328){return _0x4e2328?{'count':_0x227db7,'rows':_0x4e2328}:null;}})[_0x7d30('0x23')](respondWithResult(_0xc8e477,null))[_0x7d30('0x47')](handleError(_0xc8e477,null));};exports[_0x7d30('0x5a')]=function(_0x5e2775,_0x40d510,_0xd4bece){if(_0x5e2775['body']['id']){delete _0x5e2775[_0x7d30('0x4c')]['id'];}return db['Trigger'][_0x7d30('0x50')]({'where':{'id':_0x5e2775[_0x7d30('0x49')]['id']}})[_0x7d30('0x23')](handleEntityNotFound(_0x40d510,null))[_0x7d30('0x23')](function(_0x571497){if(_0x571497){_0x5e2775[_0x7d30('0x4c')]['TriggerId']=_0x571497['id'];return db[_0x7d30('0x5b')]['create'](_0x5e2775[_0x7d30('0x4c')]);}})[_0x7d30('0x23')](respondWithResult(_0x40d510,null))[_0x7d30('0x47')](handleError(_0x40d510,null));};exports[_0x7d30('0x5c')]=function(_0x3ec3d8,_0x40962c,_0x2d08a6){var _0x26a411={};var _0x52f3fa={};var _0x2413f9;var _0x1264ae;return db['Trigger']['findOne']({'where':{'id':_0x3ec3d8[_0x7d30('0x49')]['id']}})[_0x7d30('0x23')](handleEntityNotFound(_0x40962c,null))['then'](function(_0x3eb8f5){if(_0x3eb8f5){_0x2413f9=_0x3eb8f5;_0x52f3fa[_0x7d30('0x31')]=_[_0x7d30('0x33')](db[_0x7d30('0x5b')][_0x7d30('0x2d')]);_0x52f3fa[_0x7d30('0x32')]=_[_0x7d30('0x33')](_0x3ec3d8[_0x7d30('0x32')]);_0x52f3fa[_0x7d30('0x34')]=_[_0x7d30('0x35')](_0x52f3fa[_0x7d30('0x31')],_0x52f3fa['query']);_0x26a411[_0x7d30('0x37')]=_[_0x7d30('0x35')](_0x52f3fa[_0x7d30('0x31')],qs[_0x7d30('0x36')](_0x3ec3d8[_0x7d30('0x32')][_0x7d30('0x36')]));_0x26a411['attributes']=_0x26a411['attributes'][_0x7d30('0x38')]?_0x26a411['attributes']:_0x52f3fa[_0x7d30('0x31')];_0x26a411[_0x7d30('0x3c')]=qs[_0x7d30('0x3d')](_0x3ec3d8[_0x7d30('0x32')]['sort']);_0x26a411['where']=qs[_0x7d30('0x34')](_[_0x7d30('0x3f')](_0x3ec3d8[_0x7d30('0x32')],_0x52f3fa[_0x7d30('0x34')]));if(_0x3ec3d8[_0x7d30('0x32')][_0x7d30('0x41')]){_0x26a411[_0x7d30('0x3e')]=_[_0x7d30('0x42')](_0x26a411[_0x7d30('0x3e')],{'$or':_[_0x7d30('0x2b')](_0x26a411['attributes'],function(_0x6c8bb0){var _0x471937={};_0x471937[_0x6c8bb0]={'$like':'%'+_0x3ec3d8[_0x7d30('0x32')][_0x7d30('0x41')]+'%'};return _0x471937;})});}_0x26a411=_[_0x7d30('0x42')]({},_0x26a411,_0x3ec3d8[_0x7d30('0x43')]);return _0x2413f9[_0x7d30('0x5c')](_0x26a411);}})[_0x7d30('0x23')](function(_0x583a6c){if(_0x583a6c){_0x1264ae=_0x583a6c['length'];if(!_0x3ec3d8['query'][_0x7d30('0x39')]('nolimit')){_0x26a411[_0x7d30('0x3b')]=qs['limit'](_0x3ec3d8[_0x7d30('0x32')][_0x7d30('0x3b')]);_0x26a411[_0x7d30('0x1b')]=qs[_0x7d30('0x1b')](_0x3ec3d8[_0x7d30('0x32')][_0x7d30('0x1b')]);}return _0x2413f9[_0x7d30('0x5c')](_0x26a411);}})[_0x7d30('0x23')](function(_0x2d8cd8){if(_0x2d8cd8){return _0x2d8cd8?{'count':_0x1264ae,'rows':_0x2d8cd8}:null;}})[_0x7d30('0x23')](respondWithResult(_0x40962c,null))[_0x7d30('0x47')](handleError(_0x40962c,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 447f5b2..c61d8f4 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 _0x5697=['moment','./trigger.attributes','define','Trigger','tools_triggers','lodash','../../config/logger','api'];(function(_0x4c1f40,_0x25e086){var _0x584aec=function(_0x26d25e){while(--_0x26d25e){_0x4c1f40['push'](_0x4c1f40['shift']());}};_0x584aec(++_0x25e086);}(_0x5697,0x1b5));var _0x7569=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x5697[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x7569('0x0'));var util=require('util');var logger=require(_0x7569('0x1'))(_0x7569('0x2'));var moment=require(_0x7569('0x3'));var BPromise=require('bluebird');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(_0x7569('0x4'));module['exports']=function(_0x5705bd,_0x5afe12){return _0x5705bd[_0x7569('0x5')](_0x7569('0x6'),attributes,{'tableName':_0x7569('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6597=['../../config/logger','moment','request-promise','./trigger.attributes','exports','define','lodash','util'];(function(_0x529e91,_0xd01714){var _0x1914e9=function(_0x1ee74f){while(--_0x1ee74f){_0x529e91['push'](_0x529e91['shift']());}};_0x1914e9(++_0xd01714);}(_0x6597,0x16e));var _0x7659=function(_0x511d70,_0x171015){_0x511d70=_0x511d70-0x0;var _0x448c33=_0x6597[_0x511d70];return _0x448c33;};'use strict';var _=require(_0x7659('0x0'));var util=require(_0x7659('0x1'));var logger=require(_0x7659('0x2'))('api');var moment=require(_0x7659('0x3'));var BPromise=require('bluebird');var rp=require(_0x7659('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7659('0x5'));module[_0x7659('0x6')]=function(_0x4e09cc,_0xb90fa2){return _0x4e09cc[_0x7659('0x7')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 3bc4dc9..1dfe407 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 _0xb430=['ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrigger','findAll','options','raw','attributes','limit','include','map','model','ShowTrigger','Trigger','find','where','util','moment','bluebird','randomstring'];(function(_0x363e33,_0x12a5f8){var _0x237d27=function(_0x2cc8b8){while(--_0x2cc8b8){_0x363e33['push'](_0x363e33['shift']());}};_0x237d27(++_0x12a5f8);}(_0xb430,0xab));var _0x0b43=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0xb430[_0x5ad07c];return _0x204bae;};'use strict';var _=require('lodash');var util=require(_0x0b43('0x0'));var moment=require(_0x0b43('0x1'));var BPromise=require(_0x0b43('0x2'));var rs=require(_0x0b43('0x3'));var fs=require('fs');var Redis=require(_0x0b43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b43('0x5'));var logger=require(_0x0b43('0x6'))('rpc');var config=require(_0x0b43('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0b43('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x325a8c,_0x4845ed,_0x296ce4){return new BPromise(function(_0x3e3893,_0x153f36){return client[_0x0b43('0x9')](_0x325a8c,_0x296ce4)[_0x0b43('0xa')](function(_0xa5f0c1){logger['info'](_0x0b43('0xb'),_0x4845ed,_0x0b43('0xc'));logger[_0x0b43('0xd')](_0x0b43('0xe'),_0x4845ed,_0x0b43('0xc'),JSON[_0x0b43('0xf')](_0xa5f0c1));if(_0xa5f0c1[_0x0b43('0x10')]){if(_0xa5f0c1[_0x0b43('0x10')][_0x0b43('0x11')]===0x1f4){logger['error'](_0x0b43('0xb'),_0x4845ed,_0xa5f0c1[_0x0b43('0x10')][_0x0b43('0x12')]);return _0x153f36(_0xa5f0c1[_0x0b43('0x10')][_0x0b43('0x12')]);}logger[_0x0b43('0x10')](_0x0b43('0xb'),_0x4845ed,_0xa5f0c1['error']['message']);return _0x3e3893(_0xa5f0c1[_0x0b43('0x10')][_0x0b43('0x12')]);}else{logger[_0x0b43('0x13')](_0x0b43('0xb'),_0x4845ed,_0x0b43('0xc'));_0x3e3893(_0xa5f0c1[_0x0b43('0x14')][_0x0b43('0x12')]);}})[_0x0b43('0x15')](function(_0x1a48ad){logger[_0x0b43('0x10')](_0x0b43('0xb'),_0x4845ed,_0x1a48ad);_0x153f36(_0x1a48ad);});});}exports[_0x0b43('0x16')]=function(_0x588805){var _0x2536a3=this;return new Promise(function(_0x46da19,_0x46e058){return db['Trigger'][_0x0b43('0x17')]({'raw':_0x588805[_0x0b43('0x18')]?_0x588805[_0x0b43('0x18')][_0x0b43('0x19')]===undefined?!![]:![]:!![],'where':_0x588805[_0x0b43('0x18')]?_0x588805[_0x0b43('0x18')]['where']||null:null,'attributes':_0x588805[_0x0b43('0x18')]?_0x588805[_0x0b43('0x18')][_0x0b43('0x1a')]||null:null,'limit':_0x588805[_0x0b43('0x18')]?_0x588805[_0x0b43('0x18')][_0x0b43('0x1b')]||null:null,'include':_0x588805['options']?_0x588805[_0x0b43('0x18')][_0x0b43('0x1c')]?_[_0x0b43('0x1d')](_0x588805[_0x0b43('0x18')][_0x0b43('0x1c')],function(_0x5ed244){return{'model':db[_0x5ed244[_0x0b43('0x1e')]],'as':_0x5ed244['as'],'attributes':_0x5ed244[_0x0b43('0x1a')],'include':_0x5ed244[_0x0b43('0x1c')]?_[_0x0b43('0x1d')](_0x5ed244[_0x0b43('0x1c')],function(_0x3b08dd){return{'model':db[_0x3b08dd[_0x0b43('0x1e')]],'as':_0x3b08dd['as'],'attributes':_0x3b08dd[_0x0b43('0x1a')],'include':_0x3b08dd[_0x0b43('0x1c')]?_[_0x0b43('0x1d')](_0x3b08dd[_0x0b43('0x1c')],function(_0x3cbf1d){return{'model':db[_0x3cbf1d['model']],'as':_0x3cbf1d['as'],'attributes':_0x3cbf1d['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b43('0xa')](function(_0x15e994){logger[_0x0b43('0x13')](_0x0b43('0x16'),_0x588805);logger[_0x0b43('0xd')]('GetTrigger',_0x588805,JSON[_0x0b43('0xf')](_0x15e994));_0x46da19(_0x15e994);})['catch'](function(_0x498c4c){logger['error'](_0x0b43('0x16'),_0x498c4c[_0x0b43('0x12')],_0x588805);_0x46e058(_0x2536a3['error'](0x1f4,_0x498c4c[_0x0b43('0x12')]));});});};exports[_0x0b43('0x1f')]=function(_0x1c6596){var _0x284517=this;return new Promise(function(_0x520805,_0x3264e6){return db[_0x0b43('0x20')][_0x0b43('0x21')]({'raw':_0x1c6596['options']?_0x1c6596['options'][_0x0b43('0x19')]===undefined?!![]:![]:!![],'where':_0x1c6596[_0x0b43('0x18')]?_0x1c6596[_0x0b43('0x18')][_0x0b43('0x22')]||null:null,'attributes':_0x1c6596[_0x0b43('0x18')]?_0x1c6596[_0x0b43('0x18')][_0x0b43('0x1a')]||null:null,'include':_0x1c6596['options']?_0x1c6596['options'][_0x0b43('0x1c')]?_[_0x0b43('0x1d')](_0x1c6596[_0x0b43('0x18')][_0x0b43('0x1c')],function(_0x47a84b){return{'model':db[_0x47a84b[_0x0b43('0x1e')]],'as':_0x47a84b['as'],'attributes':_0x47a84b[_0x0b43('0x1a')],'include':_0x47a84b[_0x0b43('0x1c')]?_[_0x0b43('0x1d')](_0x47a84b[_0x0b43('0x1c')],function(_0x557647){return{'model':db[_0x557647[_0x0b43('0x1e')]],'as':_0x557647['as'],'attributes':_0x557647['attributes'],'include':_0x557647[_0x0b43('0x1c')]?_[_0x0b43('0x1d')](_0x557647[_0x0b43('0x1c')],function(_0x32e46f){return{'model':db[_0x32e46f['model']],'as':_0x32e46f['as'],'attributes':_0x32e46f[_0x0b43('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0b43('0xa')](function(_0x54bccd){logger[_0x0b43('0x13')](_0x0b43('0x1f'),_0x1c6596);logger[_0x0b43('0xd')](_0x0b43('0x1f'),_0x1c6596,JSON[_0x0b43('0xf')](_0x54bccd));_0x520805(_0x54bccd);})[_0x0b43('0x15')](function(_0x1fbbdf){logger[_0x0b43('0x10')]('ShowTrigger',_0x1fbbdf[_0x0b43('0x12')],_0x1c6596);_0x3264e6(_0x284517[_0x0b43('0x10')](0x1f4,_0x1fbbdf['message']));});});}; \ No newline at end of file +var _0x920d=['attributes','map','ShowTrigger','Trigger','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll','options','raw','where','include','model'];(function(_0x301c12,_0x3525ca){var _0x3636b0=function(_0x226380){while(--_0x226380){_0x301c12['push'](_0x301c12['shift']());}};_0x3636b0(++_0x3525ca);}(_0x920d,0x191));var _0xd920=function(_0x528fae,_0x54648c){_0x528fae=_0x528fae-0x0;var _0x370d13=_0x920d[_0x528fae];return _0x370d13;};'use strict';var _=require('lodash');var util=require(_0xd920('0x0'));var moment=require(_0xd920('0x1'));var BPromise=require(_0xd920('0x2'));var rs=require(_0xd920('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd920('0x4'))['db'];var utils=require(_0xd920('0x5'));var logger=require(_0xd920('0x6'))(_0xd920('0x7'));var config=require(_0xd920('0x8'));var jayson=require(_0xd920('0x9'));var client=jayson['client'][_0xd920('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53cae5,_0x2cc171,_0x4c0aa3){return new BPromise(function(_0x4231df,_0x29f665){return client[_0xd920('0xb')](_0x53cae5,_0x4c0aa3)[_0xd920('0xc')](function(_0x1214e3){logger[_0xd920('0xd')]('Trigger,\x20%s,\x20%s',_0x2cc171,_0xd920('0xe'));logger[_0xd920('0xf')](_0xd920('0x10'),_0x2cc171,'request\x20sent',JSON[_0xd920('0x11')](_0x1214e3));if(_0x1214e3['error']){if(_0x1214e3[_0xd920('0x12')][_0xd920('0x13')]===0x1f4){logger['error'](_0xd920('0x14'),_0x2cc171,_0x1214e3[_0xd920('0x12')][_0xd920('0x15')]);return _0x29f665(_0x1214e3[_0xd920('0x12')][_0xd920('0x15')]);}logger[_0xd920('0x12')](_0xd920('0x14'),_0x2cc171,_0x1214e3[_0xd920('0x12')]['message']);return _0x4231df(_0x1214e3[_0xd920('0x12')]['message']);}else{logger[_0xd920('0xd')](_0xd920('0x14'),_0x2cc171,_0xd920('0xe'));_0x4231df(_0x1214e3[_0xd920('0x16')]['message']);}})[_0xd920('0x17')](function(_0x4f57c0){logger['error'](_0xd920('0x14'),_0x2cc171,_0x4f57c0);_0x29f665(_0x4f57c0);});});}exports[_0xd920('0x18')]=function(_0x1ca364){var _0x59bbf4=this;return new Promise(function(_0xe0c5ad,_0x38c697){return db['Trigger'][_0xd920('0x19')]({'raw':_0x1ca364[_0xd920('0x1a')]?_0x1ca364['options'][_0xd920('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ca364[_0xd920('0x1a')]?_0x1ca364[_0xd920('0x1a')][_0xd920('0x1c')]||null:null,'attributes':_0x1ca364[_0xd920('0x1a')]?_0x1ca364['options']['attributes']||null:null,'limit':_0x1ca364[_0xd920('0x1a')]?_0x1ca364['options']['limit']||null:null,'include':_0x1ca364[_0xd920('0x1a')]?_0x1ca364[_0xd920('0x1a')][_0xd920('0x1d')]?_['map'](_0x1ca364[_0xd920('0x1a')][_0xd920('0x1d')],function(_0x1f94e2){return{'model':db[_0x1f94e2[_0xd920('0x1e')]],'as':_0x1f94e2['as'],'attributes':_0x1f94e2[_0xd920('0x1f')],'include':_0x1f94e2[_0xd920('0x1d')]?_['map'](_0x1f94e2[_0xd920('0x1d')],function(_0x5eee43){return{'model':db[_0x5eee43[_0xd920('0x1e')]],'as':_0x5eee43['as'],'attributes':_0x5eee43[_0xd920('0x1f')],'include':_0x5eee43['include']?_[_0xd920('0x20')](_0x5eee43[_0xd920('0x1d')],function(_0x778b83){return{'model':db[_0x778b83[_0xd920('0x1e')]],'as':_0x778b83['as'],'attributes':_0x778b83[_0xd920('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd920('0xc')](function(_0xb82d76){logger[_0xd920('0xd')](_0xd920('0x18'),_0x1ca364);logger['debug'](_0xd920('0x18'),_0x1ca364,JSON[_0xd920('0x11')](_0xb82d76));_0xe0c5ad(_0xb82d76);})[_0xd920('0x17')](function(_0x4c353c){logger[_0xd920('0x12')](_0xd920('0x18'),_0x4c353c[_0xd920('0x15')],_0x1ca364);_0x38c697(_0x59bbf4[_0xd920('0x12')](0x1f4,_0x4c353c['message']));});});};exports[_0xd920('0x21')]=function(_0x3334a5){var _0x7596f9=this;return new Promise(function(_0x33f42c,_0x330d5a){return db[_0xd920('0x22')][_0xd920('0x23')]({'raw':_0x3334a5[_0xd920('0x1a')]?_0x3334a5[_0xd920('0x1a')][_0xd920('0x1b')]===undefined?!![]:![]:!![],'where':_0x3334a5[_0xd920('0x1a')]?_0x3334a5['options'][_0xd920('0x1c')]||null:null,'attributes':_0x3334a5['options']?_0x3334a5['options'][_0xd920('0x1f')]||null:null,'include':_0x3334a5['options']?_0x3334a5['options'][_0xd920('0x1d')]?_[_0xd920('0x20')](_0x3334a5[_0xd920('0x1a')][_0xd920('0x1d')],function(_0x1b72d1){return{'model':db[_0x1b72d1[_0xd920('0x1e')]],'as':_0x1b72d1['as'],'attributes':_0x1b72d1[_0xd920('0x1f')],'include':_0x1b72d1[_0xd920('0x1d')]?_[_0xd920('0x20')](_0x1b72d1['include'],function(_0x1268b6){return{'model':db[_0x1268b6[_0xd920('0x1e')]],'as':_0x1268b6['as'],'attributes':_0x1268b6[_0xd920('0x1f')],'include':_0x1268b6['include']?_[_0xd920('0x20')](_0x1268b6['include'],function(_0x1c50ad){return{'model':db[_0x1c50ad[_0xd920('0x1e')]],'as':_0x1c50ad['as'],'attributes':_0x1c50ad[_0xd920('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd920('0xc')](function(_0x4722b6){logger['info']('ShowTrigger',_0x3334a5);logger[_0xd920('0xf')](_0xd920('0x21'),_0x3334a5,JSON[_0xd920('0x11')](_0x4722b6));_0x33f42c(_0x4722b6);})['catch'](function(_0x5bb772){logger[_0xd920('0x12')](_0xd920('0x21'),_0x5bb772['message'],_0x3334a5);_0x330d5a(_0x7596f9[_0xd920('0x12')](0x1f4,_0x5bb772['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5a6eda7..5252891 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 _0x4fcc=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','clone','create','put'];(function(_0x171cf6,_0x143eff){var _0x5926a5=function(_0x42cbb9){while(--_0x42cbb9){_0x171cf6['push'](_0x171cf6['shift']());}};_0x5926a5(++_0x143eff);}(_0x4fcc,0x9d));var _0xc4fc=function(_0x571a61,_0x28df6e){_0x571a61=_0x571a61-0x0;var _0x4b1ffa=_0x4fcc[_0x571a61];return _0x4b1ffa;};'use strict';var multer=require(_0xc4fc('0x0'));var util=require(_0xc4fc('0x1'));var path=require(_0xc4fc('0x2'));var timeout=require(_0xc4fc('0x3'));var express=require(_0xc4fc('0x4'));var router=express[_0xc4fc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc4fc('0x6'));var interaction=require(_0xc4fc('0x7'));var config=require(_0xc4fc('0x8'));var controller=require(_0xc4fc('0x9'));router[_0xc4fc('0xa')]('/',auth[_0xc4fc('0xb')](),controller[_0xc4fc('0xc')]);router[_0xc4fc('0xa')](_0xc4fc('0xd'),auth[_0xc4fc('0xb')](),controller[_0xc4fc('0xe')]);router['post'](_0xc4fc('0xf'),auth['isAuthenticated'](),controller[_0xc4fc('0x10')]);router['post']('/',auth[_0xc4fc('0xb')](),controller[_0xc4fc('0x11')]);router[_0xc4fc('0x12')](_0xc4fc('0xd'),auth[_0xc4fc('0xb')](),controller[_0xc4fc('0x13')]);router[_0xc4fc('0x14')](_0xc4fc('0xd'),auth[_0xc4fc('0xb')](),controller['destroy']);module[_0xc4fc('0x15')]=router; \ No newline at end of file +var _0xae83=['clone','create','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/clone'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xae83,0x1a8));var _0x3ae8=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xae83[_0x199572];return _0x13cfa3;};'use strict';var multer=require('multer');var util=require(_0x3ae8('0x0'));var path=require('path');var timeout=require(_0x3ae8('0x1'));var express=require(_0x3ae8('0x2'));var router=express[_0x3ae8('0x3')]();var fs_extra=require(_0x3ae8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3ae8('0x5'));var controller=require('./trunk.controller');router[_0x3ae8('0x6')]('/',auth[_0x3ae8('0x7')](),controller[_0x3ae8('0x8')]);router[_0x3ae8('0x6')](_0x3ae8('0x9'),auth[_0x3ae8('0x7')](),controller[_0x3ae8('0xa')]);router[_0x3ae8('0xb')](_0x3ae8('0xc'),auth['isAuthenticated'](),controller[_0x3ae8('0xd')]);router['post']('/',auth[_0x3ae8('0x7')](),controller[_0x3ae8('0xe')]);router['put'](_0x3ae8('0x9'),auth[_0x3ae8('0x7')](),controller[_0x3ae8('0xf')]);router[_0x3ae8('0x10')](_0x3ae8('0x9'),auth[_0x3ae8('0x7')](),controller[_0x3ae8('0x11')]);module[_0x3ae8('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index dea7e2b..74de4f5 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 _0xd44d=['setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','update','yes','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\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','accept','refuse','originate','uas','pai','fingerprint','active','passive','actpass','dynamic','nonat','update,nonat','sequelize','exports','STRING','ENUM','friend','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp'];(function(_0x45d7b0,_0x3e54f7){var _0x390b67=function(_0x217e17){while(--_0x217e17){_0x45d7b0['push'](_0x45d7b0['shift']());}};_0x390b67(++_0x3e54f7);}(_0xd44d,0x1b5));var _0xdd44=function(_0xf4b16f,_0x40b935){_0xf4b16f=_0xf4b16f-0x0;var _0x184b1c=_0xd44d[_0xf4b16f];return _0x184b1c;};'use strict';var Sequelize=require(_0xdd44('0x0'));module[_0xdd44('0x1')]={'name':{'type':Sequelize[_0xdd44('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x4'),'user',_0xdd44('0x5')),'allowNull':![],'defaultValue':_0xdd44('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdd44('0x6')},'callingpres':{'type':Sequelize[_0xdd44('0x3')]('ALLOWED_NOT_SCREENED',_0xdd44('0x7'),'ALLOWED_FAILED_SCREEN',_0xdd44('0x8'),_0xdd44('0x9'),'PROHIB_PASSED_SCREEN',_0xdd44('0xa'),_0xdd44('0xb'))},'deny':{'type':Sequelize[_0xdd44('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xdd44('0x2')]},'md5secret':{'type':Sequelize[_0xdd44('0x2')]},'remotesecret':{'type':Sequelize[_0xdd44('0x2')]},'transport':{'type':Sequelize[_0xdd44('0x2')],'defaultValue':_0xdd44('0xc'),'set':function(_0x41563e){this[_0xdd44('0xd')](_0xdd44('0xe'),_0x41563e?_0x41563e[_0xdd44('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xdd44('0xe'))?this[_0xdd44('0x10')]('transport')[_0xdd44('0x11')](','):null;},'comment':_0xdd44('0x12')},'dtmfmode':{'type':Sequelize['ENUM'](_0xdd44('0x13'),_0xdd44('0x14'),_0xdd44('0x15'),_0xdd44('0x16'),_0xdd44('0x17')),'defaultValue':_0xdd44('0x13')},'directmedia':{'type':Sequelize[_0xdd44('0x3')]('yes','no','nonat',_0xdd44('0x18'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xdd44('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdd44('0x2')]},'directmediadeny':{'type':Sequelize[_0xdd44('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xdd44('0x1a'),'set':function(_0x5617a0){this['setDataValue'](_0xdd44('0x1b'),_0x5617a0?_0x5617a0['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xdd44('0x10')](_0xdd44('0x1b'))[_0xdd44('0x11')](','):null;},'comment':_0xdd44('0x1c')},'callgroup':{'type':Sequelize[_0xdd44('0x2')]},'namedcallgroup':{'type':Sequelize[_0xdd44('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xdd44('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdd44('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xdd44('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdd44('0x1e'),'set':function(_0x4c4c2a){this[_0xdd44('0xd')](_0xdd44('0x1f'),_0x4c4c2a?_0x4c4c2a[_0xdd44('0xf')](';'):_0xdd44('0x1e'));},'get':function(){return this[_0xdd44('0x10')](_0xdd44('0x1f'))?this[_0xdd44('0x10')]('allow')['split'](';'):null;},'comment':_0xdd44('0x20')},'autoframing':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no')},'insecure':{'type':Sequelize[_0xdd44('0x2')],'defaultValue':_0xdd44('0x21'),'set':function(_0x44dbed){this[_0xdd44('0xd')](_0xdd44('0x22'),_0x44dbed?_0x44dbed[_0xdd44('0xf')](','):null);},'get':function(){return this[_0xdd44('0x10')]('insecure')?this[_0xdd44('0x10')]('insecure')[_0xdd44('0x11')](','):null;},'comment':_0xdd44('0x23')},'trustrpid':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no','never')},'promiscredir':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xdd44('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0xdd44('0x24')](0xb)},'setvar':{'type':Sequelize[_0xdd44('0x2')]},'callerid':{'type':Sequelize[_0xdd44('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xdd44('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xdd44('0x2')]},'template':{'type':Sequelize[_0xdd44('0x2')]},'videosupport':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no',_0xdd44('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdd44('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no')},'mailbox':{'type':Sequelize[_0xdd44('0x2')]},'session_timers':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x26'),_0xdd44('0x27'),_0xdd44('0x28'))},'session_expires':{'type':Sequelize[_0xdd44('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xdd44('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xdd44('0x3')]('uac','uas'),'defaultValue':_0xdd44('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xdd44('0x2')]},'fromdomain':{'type':Sequelize[_0xdd44('0x2')]},'fromuser':{'type':Sequelize[_0xdd44('0x2')]},'port':{'type':Sequelize[_0xdd44('0x24')](0x5)},'qualify':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no'),'defaultValue':_0xdd44('0x19')},'keepalive':{'type':Sequelize[_0xdd44('0x24')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xdd44('0x2')]},'rtptimeout':{'type':Sequelize[_0xdd44('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xdd44('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no',_0xdd44('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdd44('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xdd44('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xdd44('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0xdd44('0x2')]},'contactdeny':{'type':Sequelize[_0xdd44('0x2')]},'contactacl':{'type':Sequelize[_0xdd44('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xdd44('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no')},'force_avp':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no')},'icesupport':{'type':Sequelize[_0xdd44('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no',_0xdd44('0x2b'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xdd44('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xdd44('0x2')]},'dtlssetup':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x2c'),_0xdd44('0x2d'),_0xdd44('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdd44('0x2')]},'usereqphone':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdd44('0x2')]},'recordofffeature':{'type':Sequelize[_0xdd44('0x2')]},'call_limit':{'type':Sequelize[_0xdd44('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xdd44('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xdd44('0x2')]},'mohsuggest':{'type':Sequelize[_0xdd44('0x2')]},'parkinglot':{'type':Sequelize[_0xdd44('0x2')]},'description':{'type':Sequelize[_0xdd44('0x2')]},'host':{'type':Sequelize[_0xdd44('0x2')],'defaultValue':_0xdd44('0x2f')},'canreinvite':{'type':Sequelize[_0xdd44('0x3')](_0xdd44('0x19'),'no',_0xdd44('0x30'),_0xdd44('0x18'),_0xdd44('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xdd44('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xdd44('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x9e64=['PROHIB','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','update','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','\x22\x22\x20<>','always','refuse','INTEGER','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','user','friend','from-voip-provider','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x9e64,0x14c));var _0x49e6=function(_0xd797e2,_0x4eff54){_0xd797e2=_0xd797e2-0x0;var _0x15d2f5=_0x9e64[_0xd797e2];return _0x15d2f5;};'use strict';var Sequelize=require(_0x49e6('0x0'));module[_0x49e6('0x1')]={'name':{'type':Sequelize[_0x49e6('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x49e6('0x3')]('friend',_0x49e6('0x4'),'peer'),'allowNull':![],'defaultValue':_0x49e6('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x49e6('0x6')},'callingpres':{'type':Sequelize[_0x49e6('0x3')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x49e6('0x7'),_0x49e6('0x8'),_0x49e6('0x9'),_0x49e6('0xa'),'PROHIB_FAILED_SCREEN',_0x49e6('0xb'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x49e6('0x2')]},'secret':{'type':Sequelize[_0x49e6('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x49e6('0x2')]},'transport':{'type':Sequelize[_0x49e6('0x2')],'defaultValue':'udp','set':function(_0x2e6703){this[_0x49e6('0xc')](_0x49e6('0xd'),_0x2e6703?_0x2e6703[_0x49e6('0xe')](','):null);},'get':function(){return this[_0x49e6('0xf')](_0x49e6('0xd'))?this[_0x49e6('0xf')](_0x49e6('0xd'))['split'](','):null;},'comment':_0x49e6('0x10')},'dtmfmode':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x11'),_0x49e6('0x12'),'shortinfo',_0x49e6('0x13'),_0x49e6('0x14')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x15'),'no','nonat',_0x49e6('0x16'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x49e6('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49e6('0x2')]},'directmediadeny':{'type':Sequelize[_0x49e6('0x2')]},'nat':{'type':Sequelize[_0x49e6('0x2')],'defaultValue':_0x49e6('0x17'),'set':function(_0x5ce0dd){this[_0x49e6('0xc')]('nat',_0x5ce0dd?_0x5ce0dd[_0x49e6('0xe')](','):null);},'get':function(){return this[_0x49e6('0xf')](_0x49e6('0x18'))?this[_0x49e6('0xf')](_0x49e6('0x18'))[_0x49e6('0x19')](','):null;},'comment':_0x49e6('0x1a')},'callgroup':{'type':Sequelize[_0x49e6('0x2')]},'namedcallgroup':{'type':Sequelize[_0x49e6('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x49e6('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x49e6('0x2')],'defaultValue':_0x49e6('0x1b')},'allow':{'type':Sequelize[_0x49e6('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x89ee01){this[_0x49e6('0xc')](_0x49e6('0x1c'),_0x89ee01?_0x89ee01[_0x49e6('0xe')](';'):_0x49e6('0x1d'));},'get':function(){return this[_0x49e6('0xf')](_0x49e6('0x1c'))?this[_0x49e6('0xf')]('allow')[_0x49e6('0x19')](';'):null;},'comment':_0x49e6('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0x49e6('0x15'),'no')},'insecure':{'type':Sequelize[_0x49e6('0x2')],'defaultValue':_0x49e6('0x1f'),'set':function(_0x3b7b1d){this[_0x49e6('0xc')]('insecure',_0x3b7b1d?_0x3b7b1d[_0x49e6('0xe')](','):null);},'get':function(){return this[_0x49e6('0xf')](_0x49e6('0x20'))?this['getDataValue']('insecure')[_0x49e6('0x19')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x49e6('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x49e6('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49e6('0x3')]('yes','no',_0x49e6('0x21'))},'promiscredir':{'type':Sequelize[_0x49e6('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x15'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x49e6('0x2')]},'callerid':{'type':Sequelize[_0x49e6('0x2')],'defaultValue':_0x49e6('0x22')},'amaflags':{'type':Sequelize[_0x49e6('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x49e6('0x15'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x49e6('0x2')]},'template':{'type':Sequelize[_0x49e6('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x49e6('0x15'),'no',_0x49e6('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x15'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x49e6('0x3')]('accept',_0x49e6('0x24'),'originate')},'session_expires':{'type':Sequelize[_0x49e6('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x49e6('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x49e6('0x3')]('uac',_0x49e6('0x26')),'defaultValue':_0x49e6('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0x49e6('0x2')]},'regexten':{'type':Sequelize[_0x49e6('0x2')]},'fromdomain':{'type':Sequelize[_0x49e6('0x2')]},'fromuser':{'type':Sequelize[_0x49e6('0x2')]},'port':{'type':Sequelize[_0x49e6('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x49e6('0x15'),'no'),'defaultValue':_0x49e6('0x15')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x49e6('0x2')]},'defaultuser':{'type':Sequelize[_0x49e6('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x49e6('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x15'),'no',_0x49e6('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49e6('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x49e6('0x25')](0xb)},'timerb':{'type':Sequelize[_0x49e6('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x49e6('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x49e6('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x49e6('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x49e6('0x2')]},'maxforwards':{'type':Sequelize[_0x49e6('0x25')](0xb)},'encryption':{'type':Sequelize[_0x49e6('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x15'),'no')},'force_avp':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x15'),'no')},'icesupport':{'type':Sequelize[_0x49e6('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x49e6('0x3')]('yes','no',_0x49e6('0x28'),_0x49e6('0x29'))},'dtlsrekey':{'type':Sequelize[_0x49e6('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x49e6('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x49e6('0x2')]},'dtlscipher':{'type':Sequelize[_0x49e6('0x2')]},'dtlscafile':{'type':Sequelize[_0x49e6('0x2')]},'dtlscapath':{'type':Sequelize[_0x49e6('0x2')]},'dtlssetup':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x2a'),_0x49e6('0x2b'),_0x49e6('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49e6('0x2')]},'usereqphone':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49e6('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x49e6('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x49e6('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0x49e6('0x3')](_0x49e6('0x15'),'no')},'vmexten':{'type':Sequelize[_0x49e6('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x49e6('0x2')]},'parkinglot':{'type':Sequelize[_0x49e6('0x2')]},'description':{'type':Sequelize[_0x49e6('0x2')]},'host':{'type':Sequelize[_0x49e6('0x2')],'defaultValue':_0x49e6('0x2d')},'canreinvite':{'type':Sequelize['ENUM'](_0x49e6('0x15'),'no',_0x49e6('0x2e'),_0x49e6('0x16'),_0x49e6('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x49e6('0x2')]},'otherFields':{'type':Sequelize[_0x49e6('0x2')]},'active':{'type':Sequelize[_0x49e6('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x49e6('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 a706651..935dabd 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 _0xa41a=['server/files/templates/registry.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','destroy','get','UserProfileResource','end','name','send','map','Trunk','fieldName','type','key','query','intersection','model','attributes','fields','length','order','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','createdAt','updatedAt','body','create','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','Trunks','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload'];(function(_0x400848,_0x33dd23){var _0x2cb2ef=function(_0x175695){while(--_0x175695){_0x400848['push'](_0x400848['shift']());}};_0x2cb2ef(++_0x33dd23);}(_0xa41a,0x6b));var _0xaa41=function(_0x3319c4,_0x3e09f3){_0x3319c4=_0x3319c4-0x0;var _0x17a370=_0xa41a[_0x3319c4];return _0x17a370;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xaa41('0x19'));var client=jayson['client'][_0xaa41('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12d9e6,_0x2f64bc,_0x889d44,_0x6f9ade){return new BPromise(function(_0x4eaf81,_0x1e9d7f){var _0x178170=_0x6f9ade||client;return _0x178170[_0xaa41('0x1b')](_0x12d9e6,_0x889d44)[_0xaa41('0x1c')](function(_0x2a6988){logger[_0xaa41('0x1d')](_0xaa41('0x1e'),_0x2f64bc,'request\x20sent');logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2f64bc,_0xaa41('0x21'),JSON[_0xaa41('0x22')](_0x2a6988));if(_0x2a6988[_0xaa41('0x23')]){if(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x24')]===0x1f4){logger[_0xaa41('0x23')](_0xaa41('0x1e'),_0x2f64bc,_0x2a6988['error']['message']);return _0x1e9d7f(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);}logger[_0xaa41('0x23')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);return _0x4eaf81(_0x2a6988['error']['message']);}else{logger[_0xaa41('0x1d')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0xaa41('0x21'));_0x4eaf81(_0x2a6988[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x1d623c){logger['error'](_0xaa41('0x1e'),_0x2f64bc,_0x1d623c);_0x1e9d7f(_0x1d623c);});});}function respondWithStatusCode(_0x43a85c,_0x448a21){_0x448a21=_0x448a21||0xcc;return function(_0x21f596){if(_0x21f596){return _0x43a85c[_0xaa41('0x28')](_0x448a21);}return _0x43a85c[_0xaa41('0x29')](_0x448a21)['end']();};}function respondWithResult(_0x5795f4,_0x16aec5){_0x16aec5=_0x16aec5||0xc8;return function(_0x527cac){if(_0x527cac){return _0x5795f4['status'](_0x16aec5)[_0xaa41('0x2a')](_0x527cac);}};}function respondWithFilteredResult(_0x59707f,_0x536bed){return function(_0x2d0ac0){if(_0x2d0ac0){var _0x9c8c21=typeof _0x536bed[_0xaa41('0x2b')]===_0xaa41('0x2c')&&typeof _0x536bed[_0xaa41('0x2d')]===_0xaa41('0x2c');var _0x57ef96=_0x2d0ac0[_0xaa41('0x2e')];var _0x1f0275=_0x9c8c21?0x0:_0x536bed[_0xaa41('0x2b')];var _0x9a16e3=_0x9c8c21?_0x2d0ac0[_0xaa41('0x2e')]:_0x536bed[_0xaa41('0x2b')]+_0x536bed[_0xaa41('0x2d')];var _0x104a95;if(_0x9a16e3>=_0x57ef96){_0x9a16e3=_0x57ef96;_0x104a95=0xc8;}else{_0x104a95=0xce;}_0x59707f['status'](_0x104a95);return _0x59707f[_0xaa41('0x2f')]('Content-Range',_0x1f0275+'-'+_0x9a16e3+'/'+_0x57ef96)['json'](_0x2d0ac0);}return null;};}function patchUpdates(_0x714537){return function(_0x1176bd){try{jsonpatch['apply'](_0x1176bd,_0x714537,!![]);}catch(_0x392b5d){return BPromise[_0xaa41('0x30')](_0x392b5d);}return _0x1176bd['save']();};}function saveUpdates(_0x5022fb,_0x5c25fb){return function(_0x1cf3da){if(_0x1cf3da){return _0x1cf3da[_0xaa41('0x31')](_0x5022fb)[_0xaa41('0x1c')](function(_0x38afc4){return _0x38afc4;});}return null;};}function removeEntity(_0x58f203,_0x289c4a){return function(_0x45c8fe){if(_0x45c8fe){return _0x45c8fe[_0xaa41('0x32')]()['then'](function(){var _0x387c55=_0x45c8fe[_0xaa41('0x33')]({'plain':!![]});var _0x321eb7='Trunks';return db[_0xaa41('0x34')][_0xaa41('0x32')]({'where':{'type':_0x321eb7,'resourceId':_0x387c55['id']}})['then'](function(){return _0x45c8fe;});})[_0xaa41('0x1c')](function(){_0x58f203[_0xaa41('0x29')](0xcc)[_0xaa41('0x35')]();});}};}function handleEntityNotFound(_0x5cec87,_0x22b272){return function(_0x48335f){if(!_0x48335f){_0x5cec87[_0xaa41('0x28')](0x194);}return _0x48335f;};}function handleError(_0x199b24,_0xf13742){_0xf13742=_0xf13742||0x1f4;return function(_0x49b77a){logger['error'](_0x49b77a['stack']);if(_0x49b77a[_0xaa41('0x36')]){delete _0x49b77a[_0xaa41('0x36')];}_0x199b24[_0xaa41('0x29')](_0xf13742)[_0xaa41('0x37')](_0x49b77a);};}exports['index']=function(_0x53a2e4,_0x267999){var _0x5673c={},_0x951e52={},_0x4e8d2e={'count':0x0,'rows':[]};var _0xba115a=_[_0xaa41('0x38')](db[_0xaa41('0x39')]['rawAttributes'],function(_0x3adc28){return{'name':_0x3adc28[_0xaa41('0x3a')],'type':_0x3adc28[_0xaa41('0x3b')][_0xaa41('0x3c')]};});_0x951e52['model']=_['map'](_0xba115a,_0xaa41('0x36'));_0x951e52[_0xaa41('0x3d')]=_['keys'](_0x53a2e4[_0xaa41('0x3d')]);_0x951e52['filters']=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],_0x951e52[_0xaa41('0x3d')]);_0x5673c[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x53a2e4[_0xaa41('0x3d')]['fields']));_0x5673c[_0xaa41('0x40')]=_0x5673c[_0xaa41('0x40')][_0xaa41('0x42')]?_0x5673c[_0xaa41('0x40')]:_0x951e52[_0xaa41('0x3f')];if(!_0x53a2e4[_0xaa41('0x3d')]['hasOwnProperty']('nolimit')){_0x5673c[_0xaa41('0x2d')]=qs['limit'](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2d')]);_0x5673c[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2b')]);}_0x5673c[_0xaa41('0x43')]=qs['sort'](_0x53a2e4[_0xaa41('0x3d')]['sort']);_0x5673c['where']=qs[_0xaa41('0x44')](_['pick'](_0x53a2e4['query'],_0x951e52['filters']),_0xba115a);if(_0x53a2e4[_0xaa41('0x3d')]['filter']){_0x5673c[_0xaa41('0x45')]=_[_0xaa41('0x46')](_0x5673c['where'],{'$or':_['map'](_0xba115a,function(_0xe58f5e){if(_0xe58f5e[_0xaa41('0x3b')]!==_0xaa41('0x47')){var _0x2af8ba={};_0x2af8ba[_0xe58f5e[_0xaa41('0x36')]]={'$like':'%'+_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x48')]+'%'};return _0x2af8ba;}})});}_0x5673c=_[_0xaa41('0x46')]({},_0x5673c,_0x53a2e4[_0xaa41('0x49')]);var _0x4e1ac4={'where':_0x5673c[_0xaa41('0x45')]};return db[_0xaa41('0x39')][_0xaa41('0x2e')](_0x4e1ac4)[_0xaa41('0x1c')](function(_0x206d86){_0x4e8d2e[_0xaa41('0x2e')]=_0x206d86;if(_0x53a2e4['query'][_0xaa41('0x4a')]){_0x5673c[_0xaa41('0x4b')]=[{'all':!![]}];}return db[_0xaa41('0x39')][_0xaa41('0x4c')](_0x5673c);})['then'](function(_0x23bc61){_0x4e8d2e['rows']=_0x23bc61;return _0x4e8d2e;})['then'](respondWithFilteredResult(_0x267999,_0x5673c))[_0xaa41('0x27')](handleError(_0x267999,null));};exports[_0xaa41('0x4d')]=function(_0x3e16ef,_0x4ca114){var _0xb4773b={'raw':![],'where':{'id':_0x3e16ef[_0xaa41('0x4e')]['id']}},_0x3e1a73={};_0x3e1a73['model']=_[_0xaa41('0x4f')](db[_0xaa41('0x39')][_0xaa41('0x50')]);_0x3e1a73[_0xaa41('0x3d')]=_[_0xaa41('0x4f')](_0x3e16ef[_0xaa41('0x3d')]);_0x3e1a73[_0xaa41('0x44')]=_[_0xaa41('0x3e')](_0x3e1a73['model'],_0x3e1a73[_0xaa41('0x3d')]);_0xb4773b['attributes']=_['intersection'](_0x3e1a73[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x41')]));_0xb4773b[_0xaa41('0x40')]=_0xb4773b[_0xaa41('0x40')][_0xaa41('0x42')]?_0xb4773b[_0xaa41('0x40')]:_0x3e1a73['model'];if(_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0xb4773b[_0xaa41('0x4b')]=[{'all':!![]}];}_0xb4773b=_['merge']({},_0xb4773b,_0x3e16ef[_0xaa41('0x49')]);return db[_0xaa41('0x39')]['find'](_0xb4773b)[_0xaa41('0x1c')](handleEntityNotFound(_0x4ca114,null))[_0xaa41('0x1c')](respondWithResult(_0x4ca114,null))[_0xaa41('0x27')](handleError(_0x4ca114,null));};exports['clone']=function(_0x2cf32c,_0xc8e626){var _0x4e3b13={'where':{'id':_0x2cf32c[_0xaa41('0x4e')]['id']}},_0x49789a={};_0x49789a[_0xaa41('0x3f')]=_[_0xaa41('0x4f')](db['Trunk'][_0xaa41('0x50')]);_0x4e3b13[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x49789a[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x2cf32c['query'][_0xaa41('0x41')]));_0x4e3b13['attributes']=_0x4e3b13['attributes'][_0xaa41('0x42')]?_0x4e3b13['attributes']:_0x49789a[_0xaa41('0x3f')];if(_0x2cf32c[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0x4e3b13['include']=[{'all':!![]}];}_0x4e3b13=_[_0xaa41('0x46')]({},_0x4e3b13,_0x2cf32c[_0xaa41('0x49')]);return db[_0xaa41('0x39')][_0xaa41('0x51')](_0x4e3b13)[_0xaa41('0x1c')](handleEntityNotFound(_0xc8e626,null))[_0xaa41('0x1c')](function(_0xc56018){if(_0xc56018){var _0x337059=_0xc56018[_0xaa41('0x33')]({'plain':!![]});_0x337059=qs['omit'](_0x337059,['id',_0xaa41('0x52'),_0xaa41('0x53')]);_0x2cf32c[_0xaa41('0x54')]=_['omit'](_0x2cf32c[_0xaa41('0x54')],['id',_0xaa41('0x52'),_0xaa41('0x53')]);return db[_0xaa41('0x39')][_0xaa41('0x55')](_[_0xaa41('0x46')](_0x337059,_0x2cf32c[_0xaa41('0x54')]),{'include':_0x2cf32c['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x540325){var _0x4ec357=_0x2cf32c['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x4ec357)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec357['role']===_0xaa41('0x56')){var _0x40a524=_0x540325[_0xaa41('0x33')]({'plain':!![]});var _0x312eee='Trunks';return db[_0xaa41('0x57')][_0xaa41('0x51')]({'where':{'name':_0x312eee,'userProfileId':_0x4ec357[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0xa71432){if(_0xa71432&&_0xa71432[_0xaa41('0x59')]===0x0){return db[_0xaa41('0x34')][_0xaa41('0x55')]({'name':_0x40a524[_0xaa41('0x36')],'resourceId':_0x40a524['id'],'type':_0xa71432['name'],'sectionId':_0xa71432['id']},{})[_0xaa41('0x1c')](function(){return _0x540325;});}else{return _0x540325;}})[_0xaa41('0x27')](function(_0x50170f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50170f);throw _0x50170f;});}return _0x540325;});}})[_0xaa41('0x1c')](respondWithResult(_0xc8e626,0xc9))['catch'](handleError(_0xc8e626,null));};exports[_0xaa41('0x55')]=function(_0x5c8028,_0x5423b6,_0x18d18b){var _0x4b1ec4;return db[_0xaa41('0x39')][_0xaa41('0x55')](_0x5c8028[_0xaa41('0x54')],{'raw':!![]})[_0xaa41('0x1c')](function(_0x5a2683){_0x4b1ec4=_0x5a2683;return db['Trunk'][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x4d6d0c){var _0x5954ba=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x5a385e=fs[_0xaa41('0x5a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x19ec63=ejs[_0xaa41('0x5f')](_0x5954ba,{'trunks':_0x4d6d0c||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x19ec63);if(_0x4b1ec4[_0xaa41('0x61')]){var _0x19ed68=ejs[_0xaa41('0x5f')](_0x5a385e,{'trunks':_0x4d6d0c||[]});fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x19ed68);}})[_0xaa41('0x1c')](function(){return respondWithRpcPromise('Reload',_0xaa41('0x55'),{'module':_0xaa41('0x64')});})[_0xaa41('0x1c')](function(){var _0x175ca9=_0x5c8028['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x175ca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x175ca9[_0xaa41('0x65')]===_0xaa41('0x56')){var _0x2b9e68=_0x4b1ec4[_0xaa41('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xaa41('0x51')]({'where':{'name':_0xaa41('0x66'),'userProfileId':_0x175ca9[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0x59052d){if(_0x59052d&&_0x59052d[_0xaa41('0x59')]===0x0){return db['UserProfileResource'][_0xaa41('0x55')]({'name':_0x2b9e68[_0xaa41('0x36')],'resourceId':_0x2b9e68['id'],'type':_0x59052d['name'],'sectionId':_0x59052d['id']},{})[_0xaa41('0x1c')](function(){return _0x4b1ec4;});}else{return _0x4b1ec4;}})[_0xaa41('0x27')](function(_0x2ba160){logger[_0xaa41('0x23')](_0xaa41('0x67'),_0x2ba160);throw _0x2ba160;});}return _0x4b1ec4;})[_0xaa41('0x1c')](respondWithResult(_0x5423b6,0xc9))[_0xaa41('0x27')](handleError(_0x5423b6,null));};exports[_0xaa41('0x31')]=function(_0x33b5f4,_0x3d4f1e,_0x25a064){var _0x59a30b;return db[_0xaa41('0x39')][_0xaa41('0x51')]({'where':{'id':_0x33b5f4[_0xaa41('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d4f1e,null))['then'](saveUpdates(_0x33b5f4[_0xaa41('0x54')],null))[_0xaa41('0x1c')](function(_0x59fd6a){if(_0x59fd6a){_0x59a30b=_0x59fd6a;return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});}})['then'](function(_0x305050){if(_0x305050){var _0x3dd47e=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x1472be=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x44154f=ejs[_0xaa41('0x5f')](_0x3dd47e,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x44154f);var _0x404c38=ejs[_0xaa41('0x5f')](_0x1472be,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x63'),_0x404c38);return respondWithRpcPromise(_0xaa41('0x68'),'update',{'module':_0xaa41('0x64')});}return null;})['then'](function(_0x53faf4){if(_0x53faf4){return _0x59a30b;}})[_0xaa41('0x1c')](respondWithResult(_0x3d4f1e,null))[_0xaa41('0x27')](handleError(_0x3d4f1e,null));};exports['destroy']=function(_0x5a8cb0,_0x241e1a,_0x1726ec){var _0x3c189d;return db[_0xaa41('0x39')]['find']({'where':{'id':_0x5a8cb0[_0xaa41('0x4e')]['id']}})[_0xaa41('0x1c')](handleEntityNotFound(_0x241e1a,null))[_0xaa41('0x1c')](removeEntity(_0x241e1a,null))['then'](function(){return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x5697b6){var _0x183b36=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],_0xaa41('0x5d')),'utf8');var _0x399fbd=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config['root'],_0xaa41('0x69')),_0xaa41('0x5e'));var _0x1a2deb=ejs[_0xaa41('0x5f')](_0x183b36,{'trunks':_0x5697b6});var _0x38f5d0=ejs['render'](_0x399fbd,{'trunks':_0x5697b6});fs[_0xaa41('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1a2deb);fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x38f5d0);return respondWithRpcPromise(_0xaa41('0x68'),_0xaa41('0x32'),{'module':_0xaa41('0x64')});})[_0xaa41('0x27')](handleError(_0x241e1a,null));}; \ No newline at end of file +var _0x6f0d=['server/files/templates/registry.ejs','utf8','render','writeFileSync','registry','Reload','chan_sip.so','user','UserProfileSection','autoAssociation','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','rawAttributes','find','updatedAt','body','omit','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','server/files/templates/trunk.ejs','join'];(function(_0x3b4e78,_0x3a2c2b){var _0x104a68=function(_0x45630a){while(--_0x45630a){_0x3b4e78['push'](_0x3b4e78['shift']());}};_0x104a68(++_0x3a2c2b);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x407dac,_0x6f27d4){_0x407dac=_0x407dac-0x0;var _0x6b8e61=_0x6f0d[_0x407dac];return _0x6b8e61;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];var jayson=require(_0xd6f0('0x19'));var client=jayson[_0xd6f0('0x1a')][_0xd6f0('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x409549,_0x2bf5b8,_0x250999,_0x246dad){return new BPromise(function(_0x4ab979,_0x2b3f32){var _0x354846=_0x246dad||client;return _0x354846['request'](_0x409549,_0x250999)[_0xd6f0('0x1c')](function(_0x593abe){logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,_0xd6f0('0x1f'));logger[_0xd6f0('0x20')](_0xd6f0('0x21'),_0x2bf5b8,_0xd6f0('0x1f'),JSON[_0xd6f0('0x22')](_0x593abe));if(_0x593abe[_0xd6f0('0x23')]){if(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x24')]===0x1f4){logger[_0xd6f0('0x23')](_0xd6f0('0x1e'),_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x2b3f32(_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x2bf5b8,_0x593abe[_0xd6f0('0x23')][_0xd6f0('0x25')]);return _0x4ab979(_0x593abe[_0xd6f0('0x23')]['message']);}else{logger[_0xd6f0('0x1d')](_0xd6f0('0x1e'),_0x2bf5b8,'request\x20sent');_0x4ab979(_0x593abe[_0xd6f0('0x26')]['message']);}})[_0xd6f0('0x27')](function(_0x1c9d90){logger['error'](_0xd6f0('0x1e'),_0x2bf5b8,_0x1c9d90);_0x2b3f32(_0x1c9d90);});});}function respondWithStatusCode(_0x45e99c,_0x5ea2dd){_0x5ea2dd=_0x5ea2dd||0xcc;return function(_0x3dbdc3){if(_0x3dbdc3){return _0x45e99c[_0xd6f0('0x28')](_0x5ea2dd);}return _0x45e99c[_0xd6f0('0x29')](_0x5ea2dd)['end']();};}function respondWithResult(_0x2ca8bb,_0x3dc166){_0x3dc166=_0x3dc166||0xc8;return function(_0x5ecb16){if(_0x5ecb16){return _0x2ca8bb[_0xd6f0('0x29')](_0x3dc166)['json'](_0x5ecb16);}};}function respondWithFilteredResult(_0x2042d5,_0x3fb5c3){return function(_0x1630dc){if(_0x1630dc){var _0x3c1bff=typeof _0x3fb5c3[_0xd6f0('0x2a')]===_0xd6f0('0x2b')&&typeof _0x3fb5c3[_0xd6f0('0x2c')]===_0xd6f0('0x2b');var _0x48975d=_0x1630dc[_0xd6f0('0x2d')];var _0x1982d3=_0x3c1bff?0x0:_0x3fb5c3['offset'];var _0x38a3e9=_0x3c1bff?_0x1630dc[_0xd6f0('0x2d')]:_0x3fb5c3[_0xd6f0('0x2a')]+_0x3fb5c3[_0xd6f0('0x2c')];var _0x1a3967;if(_0x38a3e9>=_0x48975d){_0x38a3e9=_0x48975d;_0x1a3967=0xc8;}else{_0x1a3967=0xce;}_0x2042d5[_0xd6f0('0x29')](_0x1a3967);return _0x2042d5[_0xd6f0('0x2e')](_0xd6f0('0x2f'),_0x1982d3+'-'+_0x38a3e9+'/'+_0x48975d)[_0xd6f0('0x30')](_0x1630dc);}return null;};}function patchUpdates(_0x43f72f){return function(_0x1dff9b){try{jsonpatch[_0xd6f0('0x31')](_0x1dff9b,_0x43f72f,!![]);}catch(_0x348529){return BPromise[_0xd6f0('0x32')](_0x348529);}return _0x1dff9b[_0xd6f0('0x33')]();};}function saveUpdates(_0x2d7c90,_0x31c493){return function(_0x376890){if(_0x376890){return _0x376890[_0xd6f0('0x34')](_0x2d7c90)[_0xd6f0('0x1c')](function(_0x3906ca){return _0x3906ca;});}return null;};}function removeEntity(_0x26ab29,_0x4a8ebe){return function(_0x11124c){if(_0x11124c){return _0x11124c['destroy']()['then'](function(){var _0x43d588=_0x11124c[_0xd6f0('0x35')]({'plain':!![]});var _0x12a6fa=_0xd6f0('0x36');return db[_0xd6f0('0x37')]['destroy']({'where':{'type':_0x12a6fa,'resourceId':_0x43d588['id']}})[_0xd6f0('0x1c')](function(){return _0x11124c;});})['then'](function(){_0x26ab29[_0xd6f0('0x29')](0xcc)[_0xd6f0('0x38')]();});}};}function handleEntityNotFound(_0x42c01a,_0x1eecf0){return function(_0x518751){if(!_0x518751){_0x42c01a['sendStatus'](0x194);}return _0x518751;};}function handleError(_0x47b33d,_0x3b6463){_0x3b6463=_0x3b6463||0x1f4;return function(_0xe2958d){logger['error'](_0xe2958d[_0xd6f0('0x39')]);if(_0xe2958d['name']){delete _0xe2958d[_0xd6f0('0x3a')];}_0x47b33d[_0xd6f0('0x29')](_0x3b6463)[_0xd6f0('0x3b')](_0xe2958d);};}exports[_0xd6f0('0x3c')]=function(_0x451834,_0x3d1280){var _0x6b44fa={},_0x4fd4db={},_0x52203d={'count':0x0,'rows':[]};var _0x162537=_[_0xd6f0('0x3d')](db[_0xd6f0('0x3e')]['rawAttributes'],function(_0x59f905){return{'name':_0x59f905[_0xd6f0('0x3f')],'type':_0x59f905[_0xd6f0('0x40')][_0xd6f0('0x41')]};});_0x4fd4db[_0xd6f0('0x42')]=_[_0xd6f0('0x3d')](_0x162537,_0xd6f0('0x3a'));_0x4fd4db[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x451834['query']);_0x4fd4db[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],_0x4fd4db[_0xd6f0('0x43')]);_0x6b44fa['attributes']=_[_0xd6f0('0x46')](_0x4fd4db[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x6b44fa['attributes']=_0x6b44fa[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x6b44fa[_0xd6f0('0x48')]:_0x4fd4db['model'];if(!_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4a')]('nolimit')){_0x6b44fa['limit']=qs[_0xd6f0('0x2c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x2c')]);_0x6b44fa['offset']=qs[_0xd6f0('0x2a')](_0x451834[_0xd6f0('0x43')]['offset']);}_0x6b44fa[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4c')]);_0x6b44fa['where']=qs[_0xd6f0('0x45')](_[_0xd6f0('0x4d')](_0x451834[_0xd6f0('0x43')],_0x4fd4db[_0xd6f0('0x45')]),_0x162537);if(_0x451834[_0xd6f0('0x43')][_0xd6f0('0x4e')]){_0x6b44fa[_0xd6f0('0x4f')]=_[_0xd6f0('0x50')](_0x6b44fa['where'],{'$or':_[_0xd6f0('0x3d')](_0x162537,function(_0x3d42ca){if(_0x3d42ca['type']!==_0xd6f0('0x51')){var _0x39ca69={};_0x39ca69[_0x3d42ca[_0xd6f0('0x3a')]]={'$like':'%'+_0x451834[_0xd6f0('0x43')]['filter']+'%'};return _0x39ca69;}})});}_0x6b44fa=_[_0xd6f0('0x50')]({},_0x6b44fa,_0x451834[_0xd6f0('0x52')]);var _0x494542={'where':_0x6b44fa['where']};return db[_0xd6f0('0x3e')]['count'](_0x494542)[_0xd6f0('0x1c')](function(_0x61b354){_0x52203d[_0xd6f0('0x2d')]=_0x61b354;if(_0x451834['query'][_0xd6f0('0x53')]){_0x6b44fa[_0xd6f0('0x54')]=[{'all':!![]}];}return db[_0xd6f0('0x3e')][_0xd6f0('0x55')](_0x6b44fa);})[_0xd6f0('0x1c')](function(_0x4c42ce){_0x52203d[_0xd6f0('0x56')]=_0x4c42ce;return _0x52203d;})['then'](respondWithFilteredResult(_0x3d1280,_0x6b44fa))[_0xd6f0('0x27')](handleError(_0x3d1280,null));};exports[_0xd6f0('0x57')]=function(_0x2eb338,_0x1dc320){var _0x554e37={'raw':![],'where':{'id':_0x2eb338[_0xd6f0('0x58')]['id']}},_0x5ceb6b={};_0x5ceb6b[_0xd6f0('0x42')]=_['keys'](db[_0xd6f0('0x3e')]['rawAttributes']);_0x5ceb6b[_0xd6f0('0x43')]=_[_0xd6f0('0x44')](_0x2eb338[_0xd6f0('0x43')]);_0x5ceb6b[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x5ceb6b['model'],_0x5ceb6b[_0xd6f0('0x43')]);_0x554e37[_0xd6f0('0x48')]=_[_0xd6f0('0x46')](_0x5ceb6b[_0xd6f0('0x42')],qs[_0xd6f0('0x47')](_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x554e37[_0xd6f0('0x48')]=_0x554e37['attributes'][_0xd6f0('0x49')]?_0x554e37[_0xd6f0('0x48')]:_0x5ceb6b[_0xd6f0('0x42')];if(_0x2eb338[_0xd6f0('0x43')][_0xd6f0('0x53')]){_0x554e37[_0xd6f0('0x54')]=[{'all':!![]}];}_0x554e37=_[_0xd6f0('0x50')]({},_0x554e37,_0x2eb338[_0xd6f0('0x52')]);return db[_0xd6f0('0x3e')]['find'](_0x554e37)[_0xd6f0('0x1c')](handleEntityNotFound(_0x1dc320,null))['then'](respondWithResult(_0x1dc320,null))['catch'](handleError(_0x1dc320,null));};exports[_0xd6f0('0x59')]=function(_0x55fd25,_0x539ef1){var _0x28c3c4={'where':{'id':_0x55fd25[_0xd6f0('0x58')]['id']}},_0x2d39a2={};_0x2d39a2['model']=_[_0xd6f0('0x44')](db[_0xd6f0('0x3e')][_0xd6f0('0x5a')]);_0x28c3c4['attributes']=_[_0xd6f0('0x46')](_0x2d39a2[_0xd6f0('0x42')],qs['fields'](_0x55fd25[_0xd6f0('0x43')][_0xd6f0('0x47')]));_0x28c3c4['attributes']=_0x28c3c4[_0xd6f0('0x48')][_0xd6f0('0x49')]?_0x28c3c4[_0xd6f0('0x48')]:_0x2d39a2[_0xd6f0('0x42')];if(_0x55fd25[_0xd6f0('0x43')]['includeAll']){_0x28c3c4[_0xd6f0('0x54')]=[{'all':!![]}];}_0x28c3c4=_[_0xd6f0('0x50')]({},_0x28c3c4,_0x55fd25['options']);return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')](_0x28c3c4)[_0xd6f0('0x1c')](handleEntityNotFound(_0x539ef1,null))['then'](function(_0x229f19){if(_0x229f19){var _0x5d75fa=_0x229f19['get']({'plain':!![]});_0x5d75fa=qs['omit'](_0x5d75fa,['id','createdAt',_0xd6f0('0x5c')]);_0x55fd25[_0xd6f0('0x5d')]=_[_0xd6f0('0x5e')](_0x55fd25[_0xd6f0('0x5d')],['id','createdAt',_0xd6f0('0x5c')]);return db['Trunk'][_0xd6f0('0x5f')](_[_0xd6f0('0x50')](_0x5d75fa,_0x55fd25[_0xd6f0('0x5d')]),{'include':_0x55fd25['query'][_0xd6f0('0x53')]?[{'all':!![]}]:undefined})[_0xd6f0('0x1c')](function(_0x269dd7){var _0x705eb=_0x55fd25['user'][_0xd6f0('0x35')]({'plain':!![]});if(!_0x705eb)throw new Error(_0xd6f0('0x60'));if(_0x705eb[_0xd6f0('0x61')]==='user'){var _0x5bc4e7=_0x269dd7[_0xd6f0('0x35')]({'plain':!![]});var _0x1fee47=_0xd6f0('0x36');return db['UserProfileSection'][_0xd6f0('0x5b')]({'where':{'name':_0x1fee47,'userProfileId':_0x705eb[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x282e9b){if(_0x282e9b&&_0x282e9b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5bc4e7['name'],'resourceId':_0x5bc4e7['id'],'type':_0x282e9b[_0xd6f0('0x3a')],'sectionId':_0x282e9b['id']},{})[_0xd6f0('0x1c')](function(){return _0x269dd7;});}else{return _0x269dd7;}})[_0xd6f0('0x27')](function(_0x30cd81){logger[_0xd6f0('0x23')](_0xd6f0('0x63'),_0x30cd81);throw _0x30cd81;});}return _0x269dd7;});}})[_0xd6f0('0x1c')](respondWithResult(_0x539ef1,0xc9))[_0xd6f0('0x27')](handleError(_0x539ef1,null));};exports[_0xd6f0('0x5f')]=function(_0x5ad146,_0x55f96e,_0x1b9728){var _0x5af4f6;return db[_0xd6f0('0x3e')][_0xd6f0('0x5f')](_0x5ad146[_0xd6f0('0x5d')],{'raw':!![]})[_0xd6f0('0x1c')](function(_0x14384f){_0x5af4f6=_0x14384f;return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})['then'](function(_0x3c8a3e){var _0x318a68=fs[_0xd6f0('0x64')](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x66')),'utf8');var _0xad50ac=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x1c6140=ejs[_0xd6f0('0x6a')](_0x318a68,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1c6140);if(_0x5af4f6[_0xd6f0('0x6c')]){var _0x205b6a=ejs[_0xd6f0('0x6a')](_0xad50ac,{'trunks':_0x3c8a3e||[]});fs[_0xd6f0('0x6b')]('/etc/asterisk/sip_xcally_registers.conf',_0x205b6a);}})[_0xd6f0('0x1c')](function(){return respondWithRpcPromise(_0xd6f0('0x6d'),_0xd6f0('0x5f'),{'module':_0xd6f0('0x6e')});})[_0xd6f0('0x1c')](function(){var _0x12e0e5=_0x5ad146[_0xd6f0('0x6f')][_0xd6f0('0x35')]({'plain':!![]});if(!_0x12e0e5)throw new Error(_0xd6f0('0x60'));if(_0x12e0e5[_0xd6f0('0x61')]==='user'){var _0x440d5c=_0x5af4f6[_0xd6f0('0x35')]({'plain':!![]});return db[_0xd6f0('0x70')]['find']({'where':{'name':_0xd6f0('0x36'),'userProfileId':_0x12e0e5[_0xd6f0('0x62')]},'raw':!![]})[_0xd6f0('0x1c')](function(_0x406bc7){if(_0x406bc7&&_0x406bc7[_0xd6f0('0x71')]===0x0){return db[_0xd6f0('0x37')][_0xd6f0('0x5f')]({'name':_0x440d5c[_0xd6f0('0x3a')],'resourceId':_0x440d5c['id'],'type':_0x406bc7[_0xd6f0('0x3a')],'sectionId':_0x406bc7['id']},{})[_0xd6f0('0x1c')](function(){return _0x5af4f6;});}else{return _0x5af4f6;}})[_0xd6f0('0x27')](function(_0x5b3155){logger['error'](_0xd6f0('0x63'),_0x5b3155);throw _0x5b3155;});}return _0x5af4f6;})[_0xd6f0('0x1c')](respondWithResult(_0x55f96e,0xc9))[_0xd6f0('0x27')](handleError(_0x55f96e,null));};exports[_0xd6f0('0x34')]=function(_0x1da442,_0x5a781b,_0x15143a){var _0x2d38e6;return db['Trunk'][_0xd6f0('0x5b')]({'where':{'id':_0x1da442['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0x5a781b,null))[_0xd6f0('0x1c')](saveUpdates(_0x1da442[_0xd6f0('0x5d')],null))[_0xd6f0('0x1c')](function(_0x391c2a){if(_0x391c2a){_0x2d38e6=_0x391c2a;return db['Trunk']['findAll']({'raw':!![]});}})[_0xd6f0('0x1c')](function(_0x17b320){if(_0x17b320){var _0x484124=fs[_0xd6f0('0x64')](path['join'](config['root'],_0xd6f0('0x66')),'utf8');var _0x5dc1c7=fs['readFileSync'](path['join'](config[_0xd6f0('0x65')],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0xcfed18=ejs[_0xd6f0('0x6a')](_0x484124,{'trunks':_0x17b320||[]});fs[_0xd6f0('0x6b')](_0xd6f0('0x72'),_0xcfed18);var _0x381f88=ejs[_0xd6f0('0x6a')](_0x5dc1c7,{'trunks':_0x17b320||[]});fs['writeFileSync'](_0xd6f0('0x73'),_0x381f88);return respondWithRpcPromise('Reload','update',{'module':_0xd6f0('0x6e')});}return null;})[_0xd6f0('0x1c')](function(_0x397f2c){if(_0x397f2c){return _0x2d38e6;}})['then'](respondWithResult(_0x5a781b,null))[_0xd6f0('0x27')](handleError(_0x5a781b,null));};exports[_0xd6f0('0x74')]=function(_0xc0585c,_0xf7ade1,_0x41e738){var _0x202e37;return db[_0xd6f0('0x3e')][_0xd6f0('0x5b')]({'where':{'id':_0xc0585c['params']['id']}})[_0xd6f0('0x1c')](handleEntityNotFound(_0xf7ade1,null))[_0xd6f0('0x1c')](removeEntity(_0xf7ade1,null))['then'](function(){return db[_0xd6f0('0x3e')][_0xd6f0('0x55')]({'raw':!![]});})[_0xd6f0('0x1c')](function(_0x175ba6){var _0x403698=fs[_0xd6f0('0x64')](path[_0xd6f0('0x67')](config['root'],_0xd6f0('0x66')),_0xd6f0('0x69'));var _0x5c3659=fs['readFileSync'](path['join'](config['root'],_0xd6f0('0x68')),_0xd6f0('0x69'));var _0x2fdd59=ejs[_0xd6f0('0x6a')](_0x403698,{'trunks':_0x175ba6});var _0x427b95=ejs[_0xd6f0('0x6a')](_0x5c3659,{'trunks':_0x175ba6});fs['writeFileSync'](_0xd6f0('0x72'),_0x2fdd59);fs[_0xd6f0('0x6b')](_0xd6f0('0x73'),_0x427b95);return respondWithRpcPromise(_0xd6f0('0x6d'),'destroy',{'module':_0xd6f0('0x6e')});})['catch'](handleError(_0xf7ade1,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index db2ad49..c72ec20 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 _0x51d6=['api','moment','bluebird','path','../../config/environment','./trunk.attributes','define','tools_trunks','lodash','../../config/logger'];(function(_0x388ca4,_0x1e1fd7){var _0x1637fc=function(_0x528844){while(--_0x528844){_0x388ca4['push'](_0x388ca4['shift']());}};_0x1637fc(++_0x1e1fd7);}(_0x51d6,0x94));var _0x651d=function(_0x5ecdd6,_0x543ea4){_0x5ecdd6=_0x5ecdd6-0x0;var _0x6c9d2f=_0x51d6[_0x5ecdd6];return _0x6c9d2f;};'use strict';var _=require(_0x651d('0x0'));var util=require('util');var logger=require(_0x651d('0x1'))(_0x651d('0x2'));var moment=require(_0x651d('0x3'));var BPromise=require(_0x651d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x651d('0x5'));var rimraf=require('rimraf');var config=require(_0x651d('0x6'));var attributes=require(_0x651d('0x7'));module['exports']=function(_0x3afe01,_0x2da560){return _0x3afe01[_0x651d('0x8')]('Trunk',attributes,{'tableName':_0x651d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8a7=['./trunk.attributes','exports','define','Trunk','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x2492f3,_0x53d198){var _0x499c31=function(_0x5abe1a){while(--_0x5abe1a){_0x2492f3['push'](_0x2492f3['shift']());}};_0x499c31(++_0x53d198);}(_0xb8a7,0x1e8));var _0x7b8a=function(_0x14aefc,_0x1e8ef0){_0x14aefc=_0x14aefc-0x0;var _0x507c7f=_0xb8a7[_0x14aefc];return _0x507c7f;};'use strict';var _=require(_0x7b8a('0x0'));var util=require(_0x7b8a('0x1'));var logger=require('../../config/logger')(_0x7b8a('0x2'));var moment=require(_0x7b8a('0x3'));var BPromise=require('bluebird');var rp=require(_0x7b8a('0x4'));var fs=require('fs');var path=require(_0x7b8a('0x5'));var rimraf=require(_0x7b8a('0x6'));var config=require('../../config/environment');var attributes=require(_0x7b8a('0x7'));module[_0x7b8a('0x8')]=function(_0x5f4943,_0x10f688){return _0x5f4943[_0x7b8a('0x9')](_0x7b8a('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 8e3ad49..ce0dd00 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 _0x5f39=['findAll','options','where','limit','include','model','attributes','map','catch','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetTrunk','Trunk'];(function(_0x133eba,_0x2dccdb){var _0x122ecc=function(_0x1c1ef9){while(--_0x1c1ef9){_0x133eba['push'](_0x133eba['shift']());}};_0x122ecc(++_0x2dccdb);}(_0x5f39,0x9b));var _0x95f3=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x5f39[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x95f3('0x0'));var util=require(_0x95f3('0x1'));var moment=require(_0x95f3('0x2'));var BPromise=require(_0x95f3('0x3'));var rs=require(_0x95f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95f3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95f3('0x6'))(_0x95f3('0x7'));var config=require(_0x95f3('0x8'));var jayson=require(_0x95f3('0x9'));var client=jayson[_0x95f3('0xa')][_0x95f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32577f,_0x568533,_0xc9fc7f){return new BPromise(function(_0x553f54,_0x2177c9){return client[_0x95f3('0xc')](_0x32577f,_0xc9fc7f)[_0x95f3('0xd')](function(_0x336b01){logger[_0x95f3('0xe')](_0x95f3('0xf'),_0x568533,'request\x20sent');logger[_0x95f3('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0x568533,_0x95f3('0x11'),JSON[_0x95f3('0x12')](_0x336b01));if(_0x336b01[_0x95f3('0x13')]){if(_0x336b01[_0x95f3('0x13')][_0x95f3('0x14')]===0x1f4){logger[_0x95f3('0x13')](_0x95f3('0xf'),_0x568533,_0x336b01[_0x95f3('0x13')][_0x95f3('0x15')]);return _0x2177c9(_0x336b01[_0x95f3('0x13')][_0x95f3('0x15')]);}logger[_0x95f3('0x13')](_0x95f3('0xf'),_0x568533,_0x336b01[_0x95f3('0x13')]['message']);return _0x553f54(_0x336b01[_0x95f3('0x13')][_0x95f3('0x15')]);}else{logger['info'](_0x95f3('0xf'),_0x568533,_0x95f3('0x11'));_0x553f54(_0x336b01[_0x95f3('0x16')]['message']);}})['catch'](function(_0x154599){logger['error'](_0x95f3('0xf'),_0x568533,_0x154599);_0x2177c9(_0x154599);});});}exports[_0x95f3('0x17')]=function(_0x423482){var _0x750d7d=this;return new Promise(function(_0x1c0953,_0x2d0618){return db[_0x95f3('0x18')][_0x95f3('0x19')]({'raw':_0x423482[_0x95f3('0x1a')]?_0x423482[_0x95f3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x423482[_0x95f3('0x1a')]?_0x423482['options'][_0x95f3('0x1b')]||null:null,'attributes':_0x423482[_0x95f3('0x1a')]?_0x423482[_0x95f3('0x1a')]['attributes']||null:null,'limit':_0x423482[_0x95f3('0x1a')]?_0x423482['options'][_0x95f3('0x1c')]||null:null,'include':_0x423482[_0x95f3('0x1a')]?_0x423482[_0x95f3('0x1a')][_0x95f3('0x1d')]?_['map'](_0x423482['options'][_0x95f3('0x1d')],function(_0x2b1ded){return{'model':db[_0x2b1ded[_0x95f3('0x1e')]],'as':_0x2b1ded['as'],'attributes':_0x2b1ded[_0x95f3('0x1f')],'include':_0x2b1ded['include']?_[_0x95f3('0x20')](_0x2b1ded[_0x95f3('0x1d')],function(_0xe36f24){return{'model':db[_0xe36f24[_0x95f3('0x1e')]],'as':_0xe36f24['as'],'attributes':_0xe36f24[_0x95f3('0x1f')],'include':_0xe36f24[_0x95f3('0x1d')]?_[_0x95f3('0x20')](_0xe36f24[_0x95f3('0x1d')],function(_0xfccbc4){return{'model':db[_0xfccbc4[_0x95f3('0x1e')]],'as':_0xfccbc4['as'],'attributes':_0xfccbc4['attributes']};}):[]};}):[]};}):[]:[]})[_0x95f3('0xd')](function(_0x429b98){logger[_0x95f3('0xe')](_0x95f3('0x17'),_0x423482);logger[_0x95f3('0x10')](_0x95f3('0x17'),_0x423482,JSON[_0x95f3('0x12')](_0x429b98));_0x1c0953(_0x429b98);})[_0x95f3('0x21')](function(_0x22559e){logger[_0x95f3('0x13')](_0x95f3('0x17'),_0x22559e[_0x95f3('0x15')],_0x423482);_0x2d0618(_0x750d7d[_0x95f3('0x13')](0x1f4,_0x22559e['message']));});});};exports[_0x95f3('0x22')]=function(_0x495831){var _0x365a2a=this;return new Promise(function(_0x35f2d7,_0x2401e7){return db['Trunk'][_0x95f3('0x23')]({'raw':_0x495831['options']?_0x495831[_0x95f3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x495831[_0x95f3('0x1a')]?_0x495831['options']['where']||null:null,'attributes':_0x495831[_0x95f3('0x1a')]?_0x495831['options'][_0x95f3('0x1f')]||null:null,'include':_0x495831[_0x95f3('0x1a')]?_0x495831[_0x95f3('0x1a')][_0x95f3('0x1d')]?_['map'](_0x495831[_0x95f3('0x1a')][_0x95f3('0x1d')],function(_0x4ee558){return{'model':db[_0x4ee558[_0x95f3('0x1e')]],'as':_0x4ee558['as'],'attributes':_0x4ee558[_0x95f3('0x1f')],'include':_0x4ee558[_0x95f3('0x1d')]?_[_0x95f3('0x20')](_0x4ee558[_0x95f3('0x1d')],function(_0xd92390){return{'model':db[_0xd92390[_0x95f3('0x1e')]],'as':_0xd92390['as'],'attributes':_0xd92390['attributes'],'include':_0xd92390[_0x95f3('0x1d')]?_[_0x95f3('0x20')](_0xd92390[_0x95f3('0x1d')],function(_0x44a2ed){return{'model':db[_0x44a2ed[_0x95f3('0x1e')]],'as':_0x44a2ed['as'],'attributes':_0x44a2ed['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c9178){logger['info'](_0x95f3('0x22'),_0x495831);logger[_0x95f3('0x10')]('ShowTrunk',_0x495831,JSON[_0x95f3('0x12')](_0x3c9178));_0x35f2d7(_0x3c9178);})[_0x95f3('0x21')](function(_0x589739){logger[_0x95f3('0x13')](_0x95f3('0x22'),_0x589739[_0x95f3('0x15')],_0x495831);_0x2401e7(_0x365a2a[_0x95f3('0x13')](0x1f4,_0x589739[_0x95f3('0x15')]));});});}; \ No newline at end of file +var _0x640c=['raw','where','attributes','limit','include','map','model','ShowTrunk','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','catch','GetTrunk','Trunk','options'];(function(_0x339352,_0x251274){var _0x4793d0=function(_0x17fcc9){while(--_0x17fcc9){_0x339352['push'](_0x339352['shift']());}};_0x4793d0(++_0x251274);}(_0x640c,0x100));var _0xc640=function(_0x43b833,_0x345a9e){_0x43b833=_0x43b833-0x0;var _0x5085d0=_0x640c[_0x43b833];return _0x5085d0;};'use strict';var _=require(_0xc640('0x0'));var util=require(_0xc640('0x1'));var moment=require('moment');var BPromise=require(_0xc640('0x2'));var rs=require(_0xc640('0x3'));var fs=require('fs');var Redis=require(_0xc640('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc640('0x5'));var logger=require('../../config/logger')(_0xc640('0x6'));var config=require(_0xc640('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc640('0x8')][_0xc640('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x377654,_0x1bd115,_0xb3bfb3){return new BPromise(function(_0x4a75c1,_0x4aa254){return client['request'](_0x377654,_0xb3bfb3)[_0xc640('0xa')](function(_0x50e2f6){logger[_0xc640('0xb')]('Trunk,\x20%s,\x20%s',_0x1bd115,_0xc640('0xc'));logger[_0xc640('0xd')](_0xc640('0xe'),_0x1bd115,'request\x20sent',JSON[_0xc640('0xf')](_0x50e2f6));if(_0x50e2f6['error']){if(_0x50e2f6[_0xc640('0x10')]['code']===0x1f4){logger[_0xc640('0x10')](_0xc640('0x11'),_0x1bd115,_0x50e2f6[_0xc640('0x10')][_0xc640('0x12')]);return _0x4aa254(_0x50e2f6['error']['message']);}logger[_0xc640('0x10')](_0xc640('0x11'),_0x1bd115,_0x50e2f6[_0xc640('0x10')][_0xc640('0x12')]);return _0x4a75c1(_0x50e2f6[_0xc640('0x10')]['message']);}else{logger[_0xc640('0xb')](_0xc640('0x11'),_0x1bd115,'request\x20sent');_0x4a75c1(_0x50e2f6['result'][_0xc640('0x12')]);}})[_0xc640('0x13')](function(_0x216d48){logger[_0xc640('0x10')]('Trunk,\x20%s,\x20%s',_0x1bd115,_0x216d48);_0x4aa254(_0x216d48);});});}exports[_0xc640('0x14')]=function(_0x6fda56){var _0x498124=this;return new Promise(function(_0x4b14c6,_0x52792d){return db[_0xc640('0x15')]['findAll']({'raw':_0x6fda56['options']?_0x6fda56[_0xc640('0x16')][_0xc640('0x17')]===undefined?!![]:![]:!![],'where':_0x6fda56[_0xc640('0x16')]?_0x6fda56['options'][_0xc640('0x18')]||null:null,'attributes':_0x6fda56['options']?_0x6fda56[_0xc640('0x16')][_0xc640('0x19')]||null:null,'limit':_0x6fda56[_0xc640('0x16')]?_0x6fda56[_0xc640('0x16')][_0xc640('0x1a')]||null:null,'include':_0x6fda56[_0xc640('0x16')]?_0x6fda56['options'][_0xc640('0x1b')]?_[_0xc640('0x1c')](_0x6fda56[_0xc640('0x16')]['include'],function(_0x235451){return{'model':db[_0x235451[_0xc640('0x1d')]],'as':_0x235451['as'],'attributes':_0x235451['attributes'],'include':_0x235451[_0xc640('0x1b')]?_[_0xc640('0x1c')](_0x235451[_0xc640('0x1b')],function(_0x54bcfc){return{'model':db[_0x54bcfc['model']],'as':_0x54bcfc['as'],'attributes':_0x54bcfc[_0xc640('0x19')],'include':_0x54bcfc[_0xc640('0x1b')]?_[_0xc640('0x1c')](_0x54bcfc[_0xc640('0x1b')],function(_0x53e865){return{'model':db[_0x53e865[_0xc640('0x1d')]],'as':_0x53e865['as'],'attributes':_0x53e865[_0xc640('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc640('0xa')](function(_0x39ccc8){logger[_0xc640('0xb')](_0xc640('0x14'),_0x6fda56);logger[_0xc640('0xd')]('GetTrunk',_0x6fda56,JSON['stringify'](_0x39ccc8));_0x4b14c6(_0x39ccc8);})['catch'](function(_0x3c3407){logger[_0xc640('0x10')](_0xc640('0x14'),_0x3c3407[_0xc640('0x12')],_0x6fda56);_0x52792d(_0x498124[_0xc640('0x10')](0x1f4,_0x3c3407['message']));});});};exports[_0xc640('0x1e')]=function(_0xa4a978){var _0x356d4d=this;return new Promise(function(_0x1d7e7c,_0x14bfc6){return db[_0xc640('0x15')]['find']({'raw':_0xa4a978[_0xc640('0x16')]?_0xa4a978[_0xc640('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xa4a978[_0xc640('0x16')]?_0xa4a978[_0xc640('0x16')][_0xc640('0x18')]||null:null,'attributes':_0xa4a978[_0xc640('0x16')]?_0xa4a978[_0xc640('0x16')][_0xc640('0x19')]||null:null,'include':_0xa4a978[_0xc640('0x16')]?_0xa4a978[_0xc640('0x16')][_0xc640('0x1b')]?_[_0xc640('0x1c')](_0xa4a978[_0xc640('0x16')][_0xc640('0x1b')],function(_0xdd84d6){return{'model':db[_0xdd84d6[_0xc640('0x1d')]],'as':_0xdd84d6['as'],'attributes':_0xdd84d6[_0xc640('0x19')],'include':_0xdd84d6['include']?_[_0xc640('0x1c')](_0xdd84d6[_0xc640('0x1b')],function(_0x3e7459){return{'model':db[_0x3e7459[_0xc640('0x1d')]],'as':_0x3e7459['as'],'attributes':_0x3e7459[_0xc640('0x19')],'include':_0x3e7459[_0xc640('0x1b')]?_[_0xc640('0x1c')](_0x3e7459[_0xc640('0x1b')],function(_0x43b0a4){return{'model':db[_0x43b0a4[_0xc640('0x1d')]],'as':_0x43b0a4['as'],'attributes':_0x43b0a4['attributes']};}):[]};}):[]};}):[]:[]})[_0xc640('0xa')](function(_0x15639c){logger[_0xc640('0xb')](_0xc640('0x1e'),_0xa4a978);logger[_0xc640('0xd')](_0xc640('0x1e'),_0xa4a978,JSON[_0xc640('0xf')](_0x15639c));_0x1d7e7c(_0x15639c);})['catch'](function(_0x2bb9d2){logger[_0xc640('0x10')](_0xc640('0x1e'),_0x2bb9d2[_0xc640('0x12')],_0xa4a978);_0x14bfc6(_0x356d4d[_0xc640('0x10')](0x1f4,_0x2bb9d2[_0xc640('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 2fe22ac..4e235c9 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36a4=['isAuthenticated','exports','express','Router','../../components/auth/service','put','/:id'];(function(_0x596f48,_0x57d528){var _0xd2b9b6=function(_0x3ffbb5){while(--_0x3ffbb5){_0x596f48['push'](_0x596f48['shift']());}};_0xd2b9b6(++_0x57d528);}(_0x36a4,0x10c));var _0x436a=function(_0x2f49d0,_0x31a7e0){_0x2f49d0=_0x2f49d0-0x0;var _0x1f36c8=_0x36a4[_0x2f49d0];return _0x1f36c8;};'use strict';var express=require(_0x436a('0x0'));var router=express[_0x436a('0x1')]();var auth=require(_0x436a('0x2'));var controller=require('./user-setting.controller');router[_0x436a('0x3')](_0x436a('0x4'),auth[_0x436a('0x5')](),controller['update']);module[_0x436a('0x6')]=router; \ No newline at end of file +var _0x32ce=['express','Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','exports'];(function(_0x58e4e0,_0x2958fa){var _0x1aea62=function(_0x1c3125){while(--_0x1c3125){_0x58e4e0['push'](_0x58e4e0['shift']());}};_0x1aea62(++_0x2958fa);}(_0x32ce,0x1a4));var _0xe32c=function(_0x3a59bd,_0x4cf989){_0x3a59bd=_0x3a59bd-0x0;var _0x68c07d=_0x32ce[_0x3a59bd];return _0x68c07d;};'use strict';var express=require(_0xe32c('0x0'));var router=express[_0xe32c('0x1')]();var auth=require(_0xe32c('0x2'));var controller=require(_0xe32c('0x3'));router['put'](_0xe32c('0x4'),auth[_0xe32c('0x5')](),controller['update']);module[_0xe32c('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 1367288..d97ab39 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcc9=['exports','TEXT','DATE','INTEGER','sequelize','error','warning','info','debug'];(function(_0x1377b4,_0x44c574){var _0x1d4af1=function(_0x3a5a7a){while(--_0x3a5a7a){_0x1377b4['push'](_0x1377b4['shift']());}};_0x1d4af1(++_0x44c574);}(_0xfcc9,0x67));var _0x9fcc=function(_0x10baeb,_0x1f83cf){_0x10baeb=_0x10baeb-0x0;var _0x54493e=_0xfcc9[_0x10baeb];return _0x54493e;};'use strict';var Sequelize=require(_0x9fcc('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x9fcc('0x1'),_0x9fcc('0x2'),_0x9fcc('0x3'),_0x9fcc('0x4')];module[_0x9fcc('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x9fcc('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x9fcc('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x9fcc('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x9fcc('0x8')],'unique':'UserId'}}; \ No newline at end of file +var _0x0c58=['error','warning','info','debug','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId'];(function(_0x3cbdcc,_0x2749c2){var _0x107c27=function(_0x13ea79){while(--_0x13ea79){_0x3cbdcc['push'](_0x3cbdcc['shift']());}};_0x107c27(++_0x2749c2);}(_0x0c58,0x197));var _0x80c5=function(_0x1c04a6,_0x5a87ac){_0x1c04a6=_0x1c04a6-0x0;var _0x394e45=_0x0c58[_0x1c04a6];return _0x394e45;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x80c5('0x0'),_0x80c5('0x1'),_0x80c5('0x2'),_0x80c5('0x3')];module[_0x80c5('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x80c5('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x80c5('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x80c5('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x80c5('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x80c5('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x80c5('0x9')],'unique':_0x80c5('0xa')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 1b2332b..c179552 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf80=['then','sendStatus','error','name','send','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','lodash','ioredis','../../config/logger','api','redis','./user-setting.socket','register','defaults','status','json','update'];(function(_0x353f95,_0x146b5c){var _0x3fe44b=function(_0x42d7b1){while(--_0x42d7b1){_0x353f95['push'](_0x353f95['shift']());}};_0x3fe44b(++_0x146b5c);}(_0xaf80,0x1ef));var _0x0af8=function(_0x26dcd4,_0x41200c){_0x26dcd4=_0x26dcd4-0x0;var _0x5e12cc=_0xaf80[_0x26dcd4];return _0x5e12cc;};'use strict';var _=require(_0x0af8('0x0'));var Redis=require(_0x0af8('0x1'));var logger=require(_0x0af8('0x2'))(_0x0af8('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x0af8('0x4')]));require(_0x0af8('0x5'))[_0x0af8('0x6')](socket);config[_0x0af8('0x4')]=_[_0x0af8('0x7')](config[_0x0af8('0x4')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x4bce2c,_0x28f555){_0x28f555=_0x28f555||0xc8;return function(_0x538c1c){if(_0x538c1c){return _0x4bce2c[_0x0af8('0x8')](_0x28f555)[_0x0af8('0x9')](_0x538c1c);}};}function saveUpdates(_0x9f82a7){return function(_0x5ef34e){if(_0x5ef34e){return _0x5ef34e[_0x0af8('0xa')](_0x9f82a7)[_0x0af8('0xb')](function(_0x2f4267){return _0x2f4267;});}return null;};}function handleEntityNotFound(_0x55964b){return function(_0x52f25f){if(!_0x52f25f){_0x55964b[_0x0af8('0xc')](0x194);}return _0x52f25f;};}function handleError(_0x1b4570,_0x74f81e){_0x74f81e=_0x74f81e||0x1f4;return function(_0x19d65e){logger[_0x0af8('0xd')](_0x19d65e['stack']);if(_0x19d65e[_0x0af8('0xe')]){delete _0x19d65e[_0x0af8('0xe')];}_0x1b4570[_0x0af8('0x8')](_0x74f81e)[_0x0af8('0xf')](_0x19d65e);};}exports[_0x0af8('0xa')]=function(_0x10911f,_0xe51111){if(_0x10911f['user']['role']!==_0x0af8('0x10'))throw new Error(_0x0af8('0x11'));if(isNaN(Number(_0x10911f[_0x0af8('0x12')]['id'])))throw new Error(_0x0af8('0x13'));return db[_0x0af8('0x14')][_0x0af8('0x15')]({'where':{'id':_0x10911f[_0x0af8('0x12')]['id']}})[_0x0af8('0xb')](handleEntityNotFound(_0xe51111,null))['then'](saveUpdates(_0x10911f['body'],null))['then'](respondWithResult(_0xe51111,null))[_0x0af8('0x16')](handleError(_0xe51111,null));}; \ No newline at end of file +var _0x7c8e=['name','send','role','params','Invalid\x20user\x20setting\x20id','find','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus'];(function(_0x40453a,_0x1ff061){var _0x2da74d=function(_0x73e877){while(--_0x73e877){_0x40453a['push'](_0x40453a['shift']());}};_0x2da74d(++_0x1ff061);}(_0x7c8e,0x10e));var _0xe7c8=function(_0x54bed0,_0x13dba1){_0x54bed0=_0x54bed0-0x0;var _0x56768b=_0x7c8e[_0x54bed0];return _0x56768b;};'use strict';var _=require('lodash');var Redis=require(_0xe7c8('0x0'));var logger=require(_0xe7c8('0x1'))(_0xe7c8('0x2'));var config=require(_0xe7c8('0x3'));var db=require(_0xe7c8('0x4'))['db'];var socket=require(_0xe7c8('0x5'))(new Redis(config[_0xe7c8('0x6')]));require(_0xe7c8('0x7'))[_0xe7c8('0x8')](socket);config[_0xe7c8('0x6')]=_[_0xe7c8('0x9')](config[_0xe7c8('0x6')],{'host':_0xe7c8('0xa'),'port':0x18eb});function respondWithResult(_0x2d2940,_0x17c191){_0x17c191=_0x17c191||0xc8;return function(_0x3d3f66){if(_0x3d3f66){return _0x2d2940[_0xe7c8('0xb')](_0x17c191)[_0xe7c8('0xc')](_0x3d3f66);}};}function saveUpdates(_0x47eb25){return function(_0x12ce24){if(_0x12ce24){return _0x12ce24[_0xe7c8('0xd')](_0x47eb25)[_0xe7c8('0xe')](function(_0x50c222){return _0x50c222;});}return null;};}function handleEntityNotFound(_0x27b924){return function(_0x329b4c){if(!_0x329b4c){_0x27b924[_0xe7c8('0xf')](0x194);}return _0x329b4c;};}function handleError(_0x359f49,_0x161676){_0x161676=_0x161676||0x1f4;return function(_0x44c1d8){logger['error'](_0x44c1d8['stack']);if(_0x44c1d8[_0xe7c8('0x10')]){delete _0x44c1d8[_0xe7c8('0x10')];}_0x359f49[_0xe7c8('0xb')](_0x161676)[_0xe7c8('0x11')](_0x44c1d8);};}exports[_0xe7c8('0xd')]=function(_0x449265,_0x4e2266){if(_0x449265['user'][_0xe7c8('0x12')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x449265[_0xe7c8('0x13')]['id'])))throw new Error(_0xe7c8('0x14'));return db['UserSetting'][_0xe7c8('0x15')]({'where':{'id':_0x449265['params']['id']}})['then'](handleEntityNotFound(_0x4e2266,null))['then'](saveUpdates(_0x449265['body'],null))[_0xe7c8('0xe')](respondWithResult(_0x4e2266,null))['catch'](handleError(_0x4e2266,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 5b48a2e..be2733c 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef04=['UserSetting','setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x1c94cb,_0x3b4b91){var _0x5bd05c=function(_0xe86b0e){while(--_0xe86b0e){_0x1c94cb['push'](_0x1c94cb['shift']());}};_0x5bd05c(++_0x3b4b91);}(_0xef04,0x1e4));var _0x4ef0=function(_0x2b2884,_0x302c5f){_0x2b2884=_0x2b2884-0x0;var _0x1616c6=_0xef04[_0x2b2884];return _0x1616c6;};'use strict';var EventEmitter=require(_0x4ef0('0x0'));var UserSetting=require(_0x4ef0('0x1'))['db'][_0x4ef0('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x4ef0('0x3')](0x0);var events={'afterCreate':_0x4ef0('0x4'),'afterUpdate':_0x4ef0('0x5'),'afterDestroy':'remove'};function emitEvent(_0xeac781){return function(_0x35f402,_0x520e4f,_0x42f2b9){UserSettingEvents[_0x4ef0('0x6')](_0xeac781+':'+_0x35f402['id'],_0x35f402);UserSettingEvents[_0x4ef0('0x6')](_0xeac781,_0x35f402);_0x42f2b9(null);};}for(var e in events){if(events[_0x4ef0('0x7')](e)){var event=events[e];UserSetting[_0x4ef0('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x63b9=['save','update','remove','emit','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63b9,0xe2));var _0x963b=function(_0x354344,_0x5311be){_0x354344=_0x354344-0x0;var _0x14c13e=_0x63b9[_0x354344];return _0x14c13e;};'use strict';var EventEmitter=require(_0x963b('0x0'));var UserSetting=require(_0x963b('0x1'))['db'][_0x963b('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x963b('0x3')](0x0);var events={'afterCreate':_0x963b('0x4'),'afterUpdate':_0x963b('0x5'),'afterDestroy':_0x963b('0x6')};function emitEvent(_0x5711ab){return function(_0x2b622e,_0x1c226f,_0x4a8cdb){UserSettingEvents[_0x963b('0x7')](_0x5711ab+':'+_0x2b622e['id'],_0x2b622e);UserSettingEvents[_0x963b('0x7')](_0x5711ab,_0x2b622e);_0x4a8cdb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x963b('0x8')](e,emitEvent(event));}}module[_0x963b('0x9')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 9a2d466..b881509 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcffe=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x2e1980,_0x1c9c85){var _0x13ec88=function(_0x4edd8d){while(--_0x4edd8d){_0x2e1980['push'](_0x2e1980['shift']());}};_0x13ec88(++_0x1c9c85);}(_0xcffe,0x1a1));var _0xecff=function(_0x2211d4,_0x592254){_0x2211d4=_0x2211d4-0x0;var _0x565b56=_0xcffe[_0x2211d4];return _0x565b56;};'use strict';var attributes=require(_0xecff('0x0'));module[_0xecff('0x1')]=function(_0x1946a1){return _0x1946a1[_0xecff('0x2')](_0xecff('0x3'),attributes,{'tableName':_0xecff('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xfe1d81){if(!_0xfe1d81[_0xecff('0x5')])_0xfe1d81[_0xecff('0x6')]=null;else if(_0xfe1d81[_0xecff('0x6')]===null)_0xfe1d81['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x74f0=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports','UserSetting'];(function(_0x12dc35,_0x50bbce){var _0x5c6d53=function(_0x2ff8ff){while(--_0x2ff8ff){_0x12dc35['push'](_0x12dc35['shift']());}};_0x5c6d53(++_0x50bbce);}(_0x74f0,0xf3));var _0x074f=function(_0x10df1e,_0xf56f85){_0x10df1e=_0x10df1e-0x0;var _0x3e24fb=_0x74f0[_0x10df1e];return _0x3e24fb;};'use strict';var attributes=require('./user-setting.attributes');module[_0x074f('0x0')]=function(_0x57b681){return _0x57b681['define'](_0x074f('0x1'),attributes,{'tableName':_0x074f('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15ae79){if(!_0x15ae79[_0x074f('0x3')])_0x15ae79['clientSideLoggingEnabledSince']=null;else if(_0x15ae79['clientSideLoggingEnabledSince']===null)_0x15ae79[_0x074f('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 00568a4..22f83e8 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5280=['user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','save','remove','update','emit'];(function(_0x5202bc,_0x405abc){var _0xfff325=function(_0x2fa489){while(--_0x2fa489){_0x5202bc['push'](_0x5202bc['shift']());}};_0xfff325(++_0x405abc);}(_0x5280,0x114));var _0x0528=function(_0x2f10e3,_0x5018fe){_0x2f10e3=_0x2f10e3-0x0;var _0x37264=_0x5280[_0x2f10e3];return _0x37264;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x0528('0x0'),_0x0528('0x1'),_0x0528('0x2')];function createListener(_0x48996f,_0x248a82){return function(_0x4121d4){_0x248a82[_0x0528('0x3')](_0x48996f,_0x4121d4);if(_0x48996f===_0x0528('0x4')){_0x248a82[_0x0528('0x3')](_0x0528('0x5')+_0x4121d4[_0x0528('0x6')],_0x4121d4);}};}exports[_0x0528('0x7')]=function(_0x4a3a16){for(var _0x3d89ec=0x0,_0x306d9c=events[_0x0528('0x8')];_0x3d89ec<_0x306d9c;_0x3d89ec++){var _0x2dfdc3=events[_0x3d89ec];var _0x2dbcb9=createListener(_0x0528('0x9')+_0x2dfdc3,_0x4a3a16);UserSettingEvents['on'](_0x2dfdc3,_0x2dbcb9);}}; \ No newline at end of file +var _0x751d=['user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','remove','user-setting:update','emit'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x751d,0x1a3));var _0xd751=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0x751d[_0x2ba740];return _0x358bda;};'use strict';var UserSettingEvents=require(_0xd751('0x0'));var events=['save',_0xd751('0x1'),'update'];function createListener(_0x3da2ba,_0x73fd5c){return function(_0x4e72a7){_0x73fd5c['emit'](_0x3da2ba,_0x4e72a7);if(_0x3da2ba===_0xd751('0x2')){_0x73fd5c[_0xd751('0x3')](_0xd751('0x4')+_0x4e72a7[_0xd751('0x5')],_0x4e72a7);}};}exports[_0xd751('0x6')]=function(_0x5b034a){for(var _0x2b4cae=0x0,_0x5d6b95=events[_0xd751('0x7')];_0x2b4cae<_0x5d6b95;_0x2b4cae++){var _0x233e83=events[_0x2b4cae];var _0x1c98e3=createListener(_0xd751('0x8')+_0x233e83,_0x5b034a);UserSettingEvents['on'](_0x233e83,_0x1c98e3);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index a5c6e01..05dfcfc 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 _0x671e=['get','isAuthenticated','/describe','describe','/whoami','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/:id/contacts','create','bulkCreate','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','file','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','put','/:id/password','changePassword','removeQueues','destroy','delete','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59ff51,_0x3ce7a8){var _0x19ef55=function(_0x8d883f){while(--_0x8d883f){_0x59ff51['push'](_0x59ff51['shift']());}};_0x19ef55(++_0x3ce7a8);}(_0x671e,0xd6));var _0xe671=function(_0xb8298b,_0x411bdc){_0xb8298b=_0xb8298b-0x0;var _0x2077ab=_0x671e[_0xb8298b];return _0x2077ab;};'use strict';var multer=require(_0xe671('0x0'));var util=require(_0xe671('0x1'));var path=require(_0xe671('0x2'));var timeout=require('connect-timeout');var express=require(_0xe671('0x3'));var router=express[_0xe671('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe671('0x5'));var interaction=require(_0xe671('0x6'));var config=require(_0xe671('0x7'));var controller=require('./user.controller');router[_0xe671('0x8')]('/',auth[_0xe671('0x9')](),controller['index']);router[_0xe671('0x8')](_0xe671('0xa'),auth[_0xe671('0x9')](),controller[_0xe671('0xb')]);router['get'](_0xe671('0xc'),auth[_0xe671('0x9')](),controller[_0xe671('0xd')]);router[_0xe671('0x8')]('/presence',auth['isAuthenticated'](),controller[_0xe671('0xe')]);router[_0xe671('0x8')](_0xe671('0xf'),auth['isAuthenticated'](),controller[_0xe671('0x10')]);router[_0xe671('0x8')](_0xe671('0x11'),controller[_0xe671('0x12')]);router['get'](_0xe671('0x13'),auth['isAuthenticated'](),controller[_0xe671('0x14')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0xe671('0x8')](_0xe671('0x15'),auth[_0xe671('0x9')](),controller[_0xe671('0x16')]);router['get'](_0xe671('0x17'),auth[_0xe671('0x9')](),controller[_0xe671('0x18')]);router[_0xe671('0x8')](_0xe671('0x19'),auth['isAuthenticated'](),controller[_0xe671('0x1a')]);router[_0xe671('0x8')](_0xe671('0x1b'),auth[_0xe671('0x9')](),controller[_0xe671('0x1c')]);router[_0xe671('0x8')](_0xe671('0x1d'),auth[_0xe671('0x9')](),controller['getScreenRecordings']);router[_0xe671('0x8')](_0xe671('0x1e'),auth[_0xe671('0x9')](),controller[_0xe671('0x1f')]);router['get'](_0xe671('0x20'),auth['isAuthenticated'](),controller[_0xe671('0x21')]);router[_0xe671('0x8')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0xe671('0x22')]);router[_0xe671('0x8')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0xe671('0x23')]);router['get'](_0xe671('0x24'),auth['isAuthenticated'](),controller[_0xe671('0x25')]);router[_0xe671('0x8')]('/:id/whatsapp/interactions',auth[_0xe671('0x9')](),controller[_0xe671('0x26')]);router[_0xe671('0x8')](_0xe671('0x27'),auth[_0xe671('0x9')](),controller[_0xe671('0x28')]);router[_0xe671('0x8')]('/:id/lists',auth[_0xe671('0x9')](),controller[_0xe671('0x29')]);router[_0xe671('0x8')]('/:id/agents',auth[_0xe671('0x9')](),controller[_0xe671('0x2a')]);router[_0xe671('0x8')](_0xe671('0x2b'),auth['isAuthenticated'](),controller[_0xe671('0x2c')]);router[_0xe671('0x8')](_0xe671('0x2d'),auth['isAuthenticated'](),controller[_0xe671('0x2e')]);router[_0xe671('0x8')]('/:id/mail_accounts',auth[_0xe671('0x9')](),controller[_0xe671('0x2f')]);router[_0xe671('0x8')](_0xe671('0x30'),auth[_0xe671('0x9')](),controller[_0xe671('0x31')]);router[_0xe671('0x8')]('/:id/sms_accounts',auth[_0xe671('0x9')](),controller['getSmsAccounts']);router[_0xe671('0x8')](_0xe671('0x32'),auth[_0xe671('0x9')](),controller['getChatWebsites']);router[_0xe671('0x8')](_0xe671('0x33'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router['get'](_0xe671('0x34'),auth['isAuthenticated'](),controller[_0xe671('0x35')]);router[_0xe671('0x8')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xe671('0x36')]);router[_0xe671('0x37')](_0xe671('0x38'),auth[_0xe671('0x9')](),controller['addContacts']);router[_0xe671('0x37')]('/',auth[_0xe671('0x9')](),controller[_0xe671('0x39')]);router[_0xe671('0x37')]('/create_many',auth['isAuthenticated'](),controller[_0xe671('0x3a')]);router[_0xe671('0x37')](_0xe671('0x15'),auth[_0xe671('0x9')](),controller[_0xe671('0x3b')]);var upload=multer({'storage':multer[_0xe671('0x3c')]({'destination':function(_0x33ddad,_0x35ed98,_0x22a63a){_0x22a63a(null,path[_0xe671('0x3d')](config['root'],_0xe671('0x3e')));},'filename':function(_0x42bcb5,_0x3a416e,_0x5a0237){_0x5a0237(null,util[_0xe671('0x3f')](_0xe671('0x40'),Date[_0xe671('0x41')](),_0x3a416e['originalname']));}})});router['post']('/:id/avatar',upload['single'](_0xe671('0x42')),controller['addAvatar']);router[_0xe671('0x37')](_0xe671('0x43'),auth[_0xe671('0x9')](),controller[_0xe671('0x44')]);router[_0xe671('0x37')]('/:id/logout',auth[_0xe671('0x9')](),controller[_0xe671('0x45')]);router[_0xe671('0x37')](_0xe671('0x46'),auth[_0xe671('0x9')](),controller[_0xe671('0x47')]);router[_0xe671('0x37')](_0xe671('0x48'),auth[_0xe671('0x9')](),controller[_0xe671('0x49')]);router['post'](_0xe671('0x27'),auth['isAuthenticated'](),controller[_0xe671('0x4a')]);router[_0xe671('0x37')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xe671('0x4b')]);router[_0xe671('0x37')](_0xe671('0x4c'),auth[_0xe671('0x9')](),controller[_0xe671('0x4d')]);router[_0xe671('0x37')](_0xe671('0x4e'),auth['isAuthenticated'](),controller[_0xe671('0x4f')]);router[_0xe671('0x37')](_0xe671('0x50'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0xe671('0x37')](_0xe671('0x51'),auth['isAuthenticated'](),controller[_0xe671('0x52')]);router['post'](_0xe671('0x53'),auth[_0xe671('0x9')](),controller[_0xe671('0x54')]);router[_0xe671('0x37')]('/:id/fax_accounts',auth[_0xe671('0x9')](),controller[_0xe671('0x55')]);router['post']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xe671('0x56')]);router[_0xe671('0x37')]('/:id/openchannel_accounts',auth[_0xe671('0x9')](),controller[_0xe671('0x57')]);router[_0xe671('0x37')]('/:id/sms_accounts',auth[_0xe671('0x9')](),controller['addSmsAccounts']);router[_0xe671('0x37')]('/:id/chat_websites',auth[_0xe671('0x9')](),controller[_0xe671('0x58')]);router[_0xe671('0x37')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xe671('0x59')]);router[_0xe671('0x37')](_0xe671('0x5a'),auth[_0xe671('0x9')](),controller[_0xe671('0x5b')]);router[_0xe671('0x5c')](_0xe671('0xf'),auth[_0xe671('0x9')](),controller['update']);router[_0xe671('0x5c')](_0xe671('0x5d'),auth[_0xe671('0x9')](),controller[_0xe671('0x5e')]);router['delete']('/:id/queues',auth[_0xe671('0x9')](),controller[_0xe671('0x5f')]);router['delete'](_0xe671('0x27'),auth[_0xe671('0x9')](),controller['removeTeams']);router['delete'](_0xe671('0xf'),auth[_0xe671('0x9')](),controller[_0xe671('0x60')]);router[_0xe671('0x61')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0xe671('0x62')]);router[_0xe671('0x61')](_0xe671('0x4c'),auth[_0xe671('0x9')](),controller[_0xe671('0x63')]);router[_0xe671('0x61')](_0xe671('0x4e'),auth[_0xe671('0x9')](),controller[_0xe671('0x64')]);router[_0xe671('0x61')](_0xe671('0x50'),auth[_0xe671('0x9')](),controller[_0xe671('0x65')]);router[_0xe671('0x61')](_0xe671('0x51'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xe671('0x61')](_0xe671('0x53'),auth[_0xe671('0x9')](),controller[_0xe671('0x66')]);router[_0xe671('0x61')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0xe671('0x61')]('/:id/mail_accounts',auth[_0xe671('0x9')](),controller[_0xe671('0x67')]);router[_0xe671('0x61')](_0xe671('0x30'),auth[_0xe671('0x9')](),controller[_0xe671('0x68')]);router[_0xe671('0x61')]('/:id/sms_accounts',auth[_0xe671('0x9')](),controller['removeSmsAccounts']);router[_0xe671('0x61')](_0xe671('0x32'),auth[_0xe671('0x9')](),controller[_0xe671('0x69')]);router[_0xe671('0x61')](_0xe671('0x33'),auth[_0xe671('0x9')](),controller[_0xe671('0x6a')]);router['delete'](_0xe671('0x5a'),auth[_0xe671('0x9')](),controller[_0xe671('0x6b')]);router[_0xe671('0x37')](_0xe671('0x6c'),auth[_0xe671('0x9')](),controller[_0xe671('0x6d')]);module[_0xe671('0x6e')]=router; \ No newline at end of file +var _0xbe8f=['/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/whatsapp_accounts','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','messengerSoundNotification','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','/create_many','bulkCreate','addQueues','diskStorage','root','format','%s-%s','originalname','file','addAvatar','login','/:id/logout'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xbe8f,0x1e4));var _0xfbe8=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xbe8f[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require(_0xfbe8('0x0'));var path=require(_0xfbe8('0x1'));var timeout=require(_0xfbe8('0x2'));var express=require(_0xfbe8('0x3'));var router=express[_0xfbe8('0x4')]();var fs_extra=require(_0xfbe8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfbe8('0x6'));var config=require(_0xfbe8('0x7'));var controller=require('./user.controller');router[_0xfbe8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfbe8('0x8')]('/describe',auth[_0xfbe8('0x9')](),controller['describe']);router[_0xfbe8('0x8')](_0xfbe8('0xa'),auth['isAuthenticated'](),controller[_0xfbe8('0xb')]);router[_0xfbe8('0x8')](_0xfbe8('0xc'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0xd')]);router[_0xfbe8('0x8')](_0xfbe8('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0xfbe8('0xf'),controller['getAvatar']);router[_0xfbe8('0x8')](_0xfbe8('0x10'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x11')]);router['get']('/:id/contacts',auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x12')]);router['get'](_0xfbe8('0x13'),auth['isAuthenticated'](),controller[_0xfbe8('0x14')]);router[_0xfbe8('0x8')]('/:id/queues_rt',auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x15')]);router[_0xfbe8('0x8')]('/:id/groups',auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x16')]);router[_0xfbe8('0x8')](_0xfbe8('0x17'),auth['isAuthenticated'](),controller[_0xfbe8('0x18')]);router[_0xfbe8('0x8')](_0xfbe8('0x19'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x1a')]);router[_0xfbe8('0x8')](_0xfbe8('0x1b'),auth[_0xfbe8('0x9')](),controller['getChatInteractions']);router[_0xfbe8('0x8')]('/:id/openchannel/interactions',auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x1c')]);router['get'](_0xfbe8('0x1d'),auth[_0xfbe8('0x9')](),controller['getMailInteractions']);router[_0xfbe8('0x8')](_0xfbe8('0x1e'),auth['isAuthenticated'](),controller[_0xfbe8('0x1f')]);router[_0xfbe8('0x8')](_0xfbe8('0x20'),auth[_0xfbe8('0x9')](),controller['getFaxInteractions']);router[_0xfbe8('0x8')](_0xfbe8('0x21'),auth[_0xfbe8('0x9')](),controller['getWhatsappInteractions']);router[_0xfbe8('0x8')](_0xfbe8('0x22'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x23')]);router['get'](_0xfbe8('0x24'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x25')]);router[_0xfbe8('0x8')](_0xfbe8('0x26'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x27')]);router['get'](_0xfbe8('0x28'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x29')]);router[_0xfbe8('0x8')](_0xfbe8('0x2a'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x2b')]);router[_0xfbe8('0x8')](_0xfbe8('0x2c'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x2d')]);router[_0xfbe8('0x8')](_0xfbe8('0x2e'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x2f')]);router[_0xfbe8('0x8')](_0xfbe8('0x30'),auth['isAuthenticated'](),controller[_0xfbe8('0x31')]);router[_0xfbe8('0x8')](_0xfbe8('0x32'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x33')]);router['get']('/:id/whatsapp_accounts',auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x34')]);router[_0xfbe8('0x8')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0xfbe8('0x35')]);router['get'](_0xfbe8('0x36'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x37')]);router[_0xfbe8('0x38')](_0xfbe8('0x39'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x3a')]);router[_0xfbe8('0x38')]('/',auth[_0xfbe8('0x9')](),controller['create']);router[_0xfbe8('0x38')](_0xfbe8('0x3b'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x3c')]);router[_0xfbe8('0x38')](_0xfbe8('0x13'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x3d')]);var upload=multer({'storage':multer[_0xfbe8('0x3e')]({'destination':function(_0x34346c,_0x1d1376,_0x59e23b){_0x59e23b(null,path['join'](config[_0xfbe8('0x3f')],'server/files/images/'));},'filename':function(_0x1207cc,_0x52e5b2,_0x5754e4){_0x5754e4(null,util[_0xfbe8('0x40')](_0xfbe8('0x41'),Date['now'](),_0x52e5b2[_0xfbe8('0x42')]));}})});router['post']('/:id/avatar',upload['single'](_0xfbe8('0x43')),controller[_0xfbe8('0x44')]);router[_0xfbe8('0x38')]('/:id/login',auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x45')]);router[_0xfbe8('0x38')](_0xfbe8('0x46'),auth[_0xfbe8('0x9')](),controller['logout']);router[_0xfbe8('0x38')](_0xfbe8('0x47'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x48')]);router[_0xfbe8('0x38')](_0xfbe8('0x49'),auth['isAuthenticated'](),controller[_0xfbe8('0x4a')]);router['post'](_0xfbe8('0x22'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x4b')]);router[_0xfbe8('0x38')](_0xfbe8('0x4c'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x4d')]);router[_0xfbe8('0x38')](_0xfbe8('0x4e'),auth[_0xfbe8('0x9')](),controller['addMailInteractions']);router['post'](_0xfbe8('0x4f'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x50')]);router['post'](_0xfbe8('0x51'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x52')]);router[_0xfbe8('0x38')](_0xfbe8('0x53'),auth['isAuthenticated'](),controller[_0xfbe8('0x54')]);router[_0xfbe8('0x38')](_0xfbe8('0x55'),auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0xfbe8('0x38')](_0xfbe8('0x2a'),auth['isAuthenticated'](),controller[_0xfbe8('0x56')]);router[_0xfbe8('0x38')](_0xfbe8('0x2c'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x57')]);router['post'](_0xfbe8('0x2e'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x58')]);router[_0xfbe8('0x38')](_0xfbe8('0x30'),auth['isAuthenticated'](),controller[_0xfbe8('0x59')]);router['post']('/:id/chat_websites',auth['isAuthenticated'](),controller['addChatWebsites']);router['post'](_0xfbe8('0x5a'),auth[_0xfbe8('0x9')](),controller['addWhatsappAccounts']);router[_0xfbe8('0x38')](_0xfbe8('0x36'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x5b')]);router[_0xfbe8('0x5c')](_0xfbe8('0xe'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x5d')]);router['put'](_0xfbe8('0x5e'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x5f')]);router[_0xfbe8('0x60')](_0xfbe8('0x13'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x61')]);router['delete'](_0xfbe8('0x22'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x62')]);router[_0xfbe8('0x60')](_0xfbe8('0xe'),auth['isAuthenticated'](),controller[_0xfbe8('0x63')]);router[_0xfbe8('0x60')](_0xfbe8('0x4c'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x64')]);router['delete'](_0xfbe8('0x4e'),auth[_0xfbe8('0x9')](),controller['removeMailInteractions']);router[_0xfbe8('0x60')]('/:id/fax_interactions',auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x65')]);router['delete'](_0xfbe8('0x51'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x66')]);router[_0xfbe8('0x60')](_0xfbe8('0x53'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xfbe8('0x60')](_0xfbe8('0x55'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0xfbe8('0x60')](_0xfbe8('0x2a'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x67')]);router[_0xfbe8('0x60')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xfbe8('0x68')]);router['delete']('/:id/openchannel_accounts',auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x69')]);router[_0xfbe8('0x60')](_0xfbe8('0x30'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x6a')]);router[_0xfbe8('0x60')](_0xfbe8('0x32'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x6b')]);router[_0xfbe8('0x60')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xfbe8('0x6c')]);router[_0xfbe8('0x60')](_0xfbe8('0x36'),auth[_0xfbe8('0x9')](),controller['removeApiKey']);router[_0xfbe8('0x38')](_0xfbe8('0x6d'),auth[_0xfbe8('0x9')](),controller[_0xfbe8('0x6e')]);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 0a3f56d..8923e00 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 _0x07a8=['/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','moment','util','lodash','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','getDataValue','internal','email','toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','format','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','rfc2833','inband','auto','yes','nonat','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','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update','update,nonat','showWebBar','get','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','rtcp_mux','force_avp','dtlscertfile'];(function(_0xdaea2f,_0x3fdec6){var _0x14d1a6=function(_0x41d563){while(--_0x41d563){_0xdaea2f['push'](_0xdaea2f['shift']());}};_0x14d1a6(++_0x3fdec6);}(_0x07a8,0x113));var _0x807a=function(_0x1ce5df,_0x4140b8){_0x1ce5df=_0x1ce5df-0x0;var _0x118127=_0x07a8[_0x1ce5df];return _0x118127;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x807a('0x0'));var util=require(_0x807a('0x1'));var _=require(_0x807a('0x2'));module['exports']={'name':{'type':Sequelize[_0x807a('0x3')],'allowNull':![],'unique':_0x807a('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x486678){this[_0x807a('0x5')]('name',_0x486678);this['setDataValue']('defaultuser',_0x486678);},'comment':_0x807a('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x370872){this['setDataValue'](_0x807a('0x7'),_0x370872);this[_0x807a('0x5')](_0x807a('0x8'),util['format']('\x22%s\x22\x20<%s>',_0x370872,this[_0x807a('0x9')](_0x807a('0xa'))));}},'alias':{'type':Sequelize[_0x807a('0x3')]},'email':{'type':Sequelize[_0x807a('0x3')],'allowNull':![],'unique':_0x807a('0xb'),'validate':{'isEmail':!![]},'set':function(_0x2aa03c){if(_0x2aa03c){this[_0x807a('0x5')](_0x807a('0xb'),_0x2aa03c[_0x807a('0xc')]());}}},'role':{'type':Sequelize[_0x807a('0xd')](_0x807a('0xe'),_0x807a('0xf'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x807a('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x807a('0x10')},'internal':{'type':Sequelize[_0x807a('0x11')](0xb),'allowNull':![],'unique':'internal','set':function(_0x1e8f19){this[_0x807a('0x5')](_0x807a('0xa'),_0x1e8f19);this[_0x807a('0x5')](_0x807a('0x12'),_0x1e8f19);this[_0x807a('0x5')](_0x807a('0x8'),util[_0x807a('0x13')](_0x807a('0x14'),this[_0x807a('0x9')](_0x807a('0x7')),_0x1e8f19));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x807a('0x3')]},'mobile':{'type':Sequelize[_0x807a('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x807a('0x3')]},'userpic':{'type':Sequelize[_0x807a('0x3')]},'city':{'type':Sequelize[_0x807a('0x3')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x807a('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x807a('0x16')]},'chatCapacity':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x807a('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x807a('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x807a('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![],'defaultValue':_0x807a('0x17')},'ipaddr':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x807a('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x807a('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x807a('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x807a('0xd')]('friend',_0x807a('0xf'),_0x807a('0x18')),'allowNull':!![],'defaultValue':_0x807a('0x19')},'context':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![],'defaultValue':_0x807a('0x1a')},'callingpres':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x1b'),_0x807a('0x1c'),_0x807a('0x1d'),_0x807a('0x1e'),_0x807a('0x1f'),_0x807a('0x20'),_0x807a('0x21'),_0x807a('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x807a('0x23'),'set':function(_0x330e8c){this['setDataValue'](_0x807a('0x24'),_0x330e8c?_0x330e8c[_0x807a('0x25')](','):null);},'get':function(){return this[_0x807a('0x9')]('transport')?this[_0x807a('0x9')](_0x807a('0x24'))[_0x807a('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x27'),'info','shortinfo',_0x807a('0x28'),_0x807a('0x29')),'allowNull':!![],'defaultValue':_0x807a('0x27')},'directmedia':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no',_0x807a('0x2b'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![],'defaultValue':_0x807a('0x2c'),'set':function(_0x51a02c){this['setDataValue'](_0x807a('0x2d'),_0x51a02c?_0x51a02c[_0x807a('0x25')](','):null);},'get':function(){return this[_0x807a('0x9')]('nat')?this[_0x807a('0x9')]('nat')[_0x807a('0x26')](','):null;},'comment':_0x807a('0x2e')},'callgroup':{'type':Sequelize[_0x807a('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x807a('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x807a('0x3')]},'language':{'type':Sequelize[_0x807a('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x807a('0x3')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x807a('0x2f')},'allow':{'type':Sequelize[_0x807a('0x3')],'allowNull':![],'defaultValue':_0x807a('0x30'),'set':function(_0x2dff0d){this[_0x807a('0x5')](_0x807a('0x31'),_0x2dff0d?_0x2dff0d['join'](';'):_0x807a('0x30'));},'get':function(){return this[_0x807a('0x9')](_0x807a('0x31'))?this['getDataValue'](_0x807a('0x31'))[_0x807a('0x26')](';'):null;},'comment':_0x807a('0x32')},'autoframing':{'type':Sequelize[_0x807a('0xd')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x2290b4){this[_0x807a('0x5')]('insecure',_0x2290b4?_0x2290b4[_0x807a('0x25')](','):null);},'get':function(){return this[_0x807a('0x9')](_0x807a('0x33'))?this[_0x807a('0x9')](_0x807a('0x33'))[_0x807a('0x26')](','):null;},'comment':_0x807a('0x34')},'trustrpid':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x807a('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x807a('0xd')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x807a('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x807a('0xd')]('yes','no'),'allowNull':!![],'defaultValue':_0x807a('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x807a('0xd')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x807a('0x2a'),'no',_0x807a('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x807a('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x807a('0xd')]('accept',_0x807a('0x37'),_0x807a('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x807a('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x807a('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x39'),_0x807a('0x3a')),'allowNull':!![],'defaultValue':_0x807a('0x3a')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x807a('0x2a')},'keepalive':{'type':Sequelize[_0x807a('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x807a('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x807a('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x807a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x807a('0xd')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x807a('0x2a'),'no',_0x807a('0x3b'),_0x807a('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x807a('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x3d'),_0x807a('0x3e'),_0x807a('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x807a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x807a('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no','nonat',_0x807a('0x40'),_0x807a('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x807a('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x807a('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x46137c){this[_0x807a('0x5')](_0x807a('0x42'),_0x46137c);var _0x26ed1f=this[_0x807a('0x43')]({'plain':!![]});switch(_0x46137c){case 0x0:case 0x1:var _0x19111c=_0x26ed1f['transport']?_['isArray'](_0x26ed1f[_0x807a('0x24')])?_0x26ed1f[_0x807a('0x24')][_0x807a('0x25')]():_0x26ed1f['transport']:_0x807a('0x23');if(_0x19111c==='wss'){_0x19111c=_0x807a('0x23');}this[_0x807a('0x5')](_0x807a('0x24'),_0x19111c);this[_0x807a('0x5')](_0x807a('0x44'),'no');this[_0x807a('0x5')](_0x807a('0x45'),null);this[_0x807a('0x5')]('force_avp',null);this[_0x807a('0x5')](_0x807a('0x46'),null);this['setDataValue'](_0x807a('0x47'),null);this[_0x807a('0x5')](_0x807a('0x48'),null);this[_0x807a('0x5')](_0x807a('0x49'),null);this[_0x807a('0x5')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x807a('0x5')](_0x807a('0x4a'),'no');break;case 0x2:this[_0x807a('0x5')](_0x807a('0x24'),'wss');this[_0x807a('0x5')](_0x807a('0x44'),_0x807a('0x2a'));this[_0x807a('0x5')](_0x807a('0x45'),_0x807a('0x2a'));this[_0x807a('0x5')](_0x807a('0x4b'),_0x807a('0x2a'));this[_0x807a('0x5')](_0x807a('0x46'),_0x807a('0x2a'));this[_0x807a('0x5')]('dtlsenable',_0x807a('0x2a'));this[_0x807a('0x5')](_0x807a('0x48'),'no');this[_0x807a('0x5')](_0x807a('0x49'),_0x807a('0x3f'));this[_0x807a('0x5')](_0x807a('0x4c'),_0x26ed1f[_0x807a('0x4c')]||_0x807a('0x4d'));this[_0x807a('0x5')](_0x807a('0x4e'),_0x26ed1f['dtlsprivatekey']||_0x807a('0x4f'));this[_0x807a('0x5')](_0x807a('0x4a'),_0x807a('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x3a7948){this[_0x807a('0x5')](_0x807a('0x50'),_0x3a7948?_0x3a7948[_0x807a('0x25')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_[_0x807a('0x51')](this['getDataValue'](_0x807a('0x50'))[_0x807a('0x26')](','),function(_0x5bfeaf){return parseInt(_0x5bfeaf,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x807a('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x807a('0x3')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x807a('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x807a('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x807a('0xd')](_0x807a('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x807a('0x9')](_0x807a('0x52'))?this[_0x807a('0x9')](_0x807a('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x807a('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x324f76){if(typeof _0x324f76===_0x807a('0x53')){var _0x9299d9=_0x324f76==='1'?!![]:_0x324f76==='0'?![]:_0x324f76===_0x807a('0x54')?!![]:_0x324f76==='false'?![]:![];this[_0x807a('0x5')](_0x807a('0x55'),_0x9299d9);}else{this[_0x807a('0x5')](_0x807a('0x55'),_0x324f76);}}},'blocked':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![],'set':function(_0x511ec0){this[_0x807a('0x5')](_0x807a('0x56'),_0x511ec0);if(_0x511ec0===!![]){this[_0x807a('0x5')](_0x807a('0x57'),moment());this[_0x807a('0x5')]('loginAttempts',0x0);}else{this['setDataValue'](_0x807a('0x57'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x807a('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x807a('0x11')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x807a('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x807a('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x807a('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x807a('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x807a('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1024=['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','accept','originate','uas','certificate','active','actpass','TEXT','showWebBar','get','isArray','wss','encryption','avpf','force_avp','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','icesupport','dtlsenable','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','util','lodash','exports','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','toLowerCase','admin','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','peer','from-sip','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','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'];(function(_0x26f775,_0x4e590c){var _0xc9af17=function(_0x467879){while(--_0x467879){_0x26f775['push'](_0x26f775['shift']());}};_0xc9af17(++_0x4e590c);}(_0x1024,0x19c));var _0x4102=function(_0x10816b,_0x3d550b){_0x10816b=_0x10816b-0x0;var _0x194dbf=_0x1024[_0x10816b];return _0x194dbf;};'use strict';var Sequelize=require(_0x4102('0x0'));var moment=require('moment');var util=require(_0x4102('0x1'));var _=require(_0x4102('0x2'));module[_0x4102('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4102('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x11f1f7){this[_0x4102('0x5')](_0x4102('0x4'),_0x11f1f7);this[_0x4102('0x5')](_0x4102('0x6'),_0x11f1f7);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x48709f){this[_0x4102('0x5')](_0x4102('0x7'),_0x48709f);this[_0x4102('0x5')](_0x4102('0x8'),util[_0x4102('0x9')](_0x4102('0xa'),_0x48709f,this[_0x4102('0xb')](_0x4102('0xc'))));}},'alias':{'type':Sequelize[_0x4102('0xd')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x5e9ed5){if(_0x5e9ed5){this[_0x4102('0x5')]('email',_0x5e9ed5[_0x4102('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0x4102('0xf'),_0x4102('0x10'),_0x4102('0x11'),_0x4102('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x4102('0xd')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x4102('0xd')],'defaultValue':_0x4102('0x13')},'internal':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':![],'unique':_0x4102('0xc'),'set':function(_0x1d7a82){this[_0x4102('0x5')]('internal',_0x1d7a82);this[_0x4102('0x5')](_0x4102('0x15'),_0x1d7a82);this[_0x4102('0x5')](_0x4102('0x8'),util[_0x4102('0x9')](_0x4102('0xa'),this['getDataValue'](_0x4102('0x7')),_0x1d7a82));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4102('0xd')]},'mobile':{'type':Sequelize[_0x4102('0xd')]},'address':{'type':Sequelize[_0x4102('0xd')]},'zipcode':{'type':Sequelize[_0x4102('0xd')]},'userpic':{'type':Sequelize[_0x4102('0xd')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x4102('0x17')},'lastPauseAt':{'type':Sequelize[_0x4102('0x18')]},'chatCapacity':{'type':Sequelize[_0x4102('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x4102('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x4102('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x4102('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x4102('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x4102('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x4102('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x4102('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![],'defaultValue':_0x4102('0x19')},'ipaddr':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'port':{'type':Sequelize[_0x4102('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0x4102('0x10'),_0x4102('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![],'defaultValue':_0x4102('0x1b')},'callingpres':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x1d'),'ALLOWED_PASSED_SCREEN',_0x4102('0x1e'),_0x4102('0x1f'),'PROHIB_NOT_SCREENED',_0x4102('0x20'),_0x4102('0x21'),_0x4102('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'permit':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'secret':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![],'defaultValue':_0x4102('0x23'),'set':function(_0xe5fdf4){this[_0x4102('0x5')]('transport',_0xe5fdf4?_0xe5fdf4[_0x4102('0x24')](','):null);},'get':function(){return this[_0x4102('0xb')](_0x4102('0x25'))?this['getDataValue']('transport')[_0x4102('0x26')](','):null;},'comment':_0x4102('0x27')},'dtmfmode':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x28'),_0x4102('0x29'),_0x4102('0x2a'),'inband','auto'),'allowNull':!![],'defaultValue':_0x4102('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0x4102('0x2b'),'no',_0x4102('0x2c'),_0x4102('0x2d'),_0x4102('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4102('0x1c')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'nat':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![],'defaultValue':_0x4102('0x2f'),'set':function(_0x257d2f){this['setDataValue'](_0x4102('0x30'),_0x257d2f?_0x257d2f[_0x4102('0x24')](','):null);},'get':function(){return this[_0x4102('0xb')](_0x4102('0x30'))?this[_0x4102('0xb')](_0x4102('0x30'))[_0x4102('0x26')](','):null;},'comment':_0x4102('0x31')},'callgroup':{'type':Sequelize[_0x4102('0xd')]},'namedcallgroup':{'type':Sequelize[_0x4102('0xd')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4102('0xd')]},'disallow':{'type':Sequelize[_0x4102('0xd')],'allowNull':![],'defaultValue':_0x4102('0x32')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4102('0x33'),'set':function(_0x2f87fc){this[_0x4102('0x5')](_0x4102('0x34'),_0x2f87fc?_0x2f87fc['join'](';'):_0x4102('0x33'));},'get':function(){return this[_0x4102('0xb')]('allow')?this[_0x4102('0xb')](_0x4102('0x34'))[_0x4102('0x26')](';'):null;},'comment':_0x4102('0x35')},'autoframing':{'type':Sequelize['ENUM'](_0x4102('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![],'set':function(_0x56e996){this[_0x4102('0x5')]('insecure',_0x56e996?_0x56e996['join'](','):null);},'get':function(){return this['getDataValue'](_0x4102('0x36'))?this[_0x4102('0xb')](_0x4102('0x36'))[_0x4102('0x26')](','):null;},'comment':_0x4102('0x37')},'trustrpid':{'type':Sequelize['ENUM'](_0x4102('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![],'defaultValue':_0x4102('0x38')},'amaflags':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x4102('0x2b')},'busylevel':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x4102('0x1c')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x4102('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x4102('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x4102('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'template':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x2b'),'no',_0x4102('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x3a'),'refuse',_0x4102('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x4102('0x1c')]('uac',_0x4102('0x3c')),'allowNull':!![],'defaultValue':_0x4102('0x3c')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x4102('0x1c')]('yes','no'),'allowNull':!![],'defaultValue':_0x4102('0x2b')},'keepalive':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x4102('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x4102('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x4102('0x1c')]('yes','no','fingerprint',_0x4102('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x4102('0x3e'),'passive',_0x4102('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x4102('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x4102('0x1c')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x2b'),'no',_0x4102('0x2c'),'update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x4102('0xd')]},'resetPasswordExpires':{'type':Sequelize[_0x4102('0x18')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x4102('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x27daa9){this['setDataValue'](_0x4102('0x41'),_0x27daa9);var _0x1544ec=this[_0x4102('0x42')]({'plain':!![]});switch(_0x27daa9){case 0x0:case 0x1:var _0x5b9125=_0x1544ec['transport']?_[_0x4102('0x43')](_0x1544ec[_0x4102('0x25')])?_0x1544ec[_0x4102('0x25')][_0x4102('0x24')]():_0x1544ec[_0x4102('0x25')]:_0x4102('0x23');if(_0x5b9125===_0x4102('0x44')){_0x5b9125=_0x4102('0x23');}this[_0x4102('0x5')](_0x4102('0x25'),_0x5b9125);this[_0x4102('0x5')](_0x4102('0x45'),'no');this['setDataValue'](_0x4102('0x46'),null);this[_0x4102('0x5')](_0x4102('0x47'),null);this[_0x4102('0x5')]('icesupport',null);this[_0x4102('0x5')]('dtlsenable',null);this[_0x4102('0x5')](_0x4102('0x48'),null);this['setDataValue'](_0x4102('0x49'),null);this[_0x4102('0x5')]('dtlscertfile',null);this[_0x4102('0x5')](_0x4102('0x4a'),null);this[_0x4102('0x5')](_0x4102('0x4b'),'no');break;case 0x2:this[_0x4102('0x5')]('transport',_0x4102('0x44'));this[_0x4102('0x5')](_0x4102('0x45'),'yes');this['setDataValue'](_0x4102('0x46'),_0x4102('0x2b'));this[_0x4102('0x5')]('force_avp',_0x4102('0x2b'));this[_0x4102('0x5')](_0x4102('0x4c'),'yes');this['setDataValue'](_0x4102('0x4d'),_0x4102('0x2b'));this[_0x4102('0x5')](_0x4102('0x48'),'no');this[_0x4102('0x5')](_0x4102('0x49'),_0x4102('0x3f'));this[_0x4102('0x5')]('dtlscertfile',_0x1544ec[_0x4102('0x4e')]||_0x4102('0x4f'));this['setDataValue'](_0x4102('0x4a'),_0x1544ec['dtlsprivatekey']||_0x4102('0x50'));this[_0x4102('0x5')](_0x4102('0x4b'),_0x4102('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x4102('0x40')],'set':function(_0x1f3aa6){this[_0x4102('0x5')]('permissions',_0x1f3aa6?_0x1f3aa6[_0x4102('0x24')](','):[]);},'get':function(){return this['getDataValue'](_0x4102('0x51'))?_[_0x4102('0x52')](this[_0x4102('0xb')](_0x4102('0x51'))[_0x4102('0x26')](','),function(_0x523fc4){return parseInt(_0x523fc4,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x4102('0xd')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x4102('0xd')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x4102('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x4102('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x4102('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x4102('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x4102('0x1c')](_0x4102('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x4102('0xd')]},'phoneBarEnableJaws':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x4102('0x53')],'get':function(){return this[_0x4102('0xb')](_0x4102('0x54'))?this[_0x4102('0xb')](_0x4102('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x4102('0xd')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x4102('0xd')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1f16d8){if(typeof _0x1f16d8===_0x4102('0x55')){var _0x111ac1=_0x1f16d8==='1'?!![]:_0x1f16d8==='0'?![]:_0x1f16d8===_0x4102('0x56')?!![]:_0x1f16d8===_0x4102('0x57')?![]:![];this[_0x4102('0x5')]('screenrecording',_0x111ac1);}else{this[_0x4102('0x5')](_0x4102('0x58'),_0x1f16d8);}}},'blocked':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![],'set':function(_0x3595a1){this[_0x4102('0x5')](_0x4102('0x59'),_0x3595a1);if(_0x3595a1===!![]){this['setDataValue'](_0x4102('0x5a'),moment());this['setDataValue'](_0x4102('0x5b'),0x0);}else{this[_0x4102('0x5')](_0x4102('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x4102('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x4102('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x4102('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x4102('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x4102('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x4102('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x4102('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x4102('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x4102('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x4102('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x4102('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 629a187..8dfdaff 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 _0x7836=['passwordHistoryLimit','updatePasswordsHistory','channel','voicePause','isValidChannel','add','capitalize','toLowerCase','Queues','spread','emit','voice','online','interface','SIP/%s','penalty','UserVoiceQueueRt','upsert','removeQueues','isArray','QueueId','Queue:remove','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','join','server/files/images/','getOpenTabs','FAX','createdAt','OpenchannelOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','concat','findOne','format','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','List','Tag','Tags','color','tag','getQueues','Unknown\x20channel','model','keys','intersection','fields','order','sort','filters','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','pick','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','LOGININPAUSE','resolve','QueuePause','pause','PAUSE','updateAttributes','DEFAULT\x20PAUSE','type','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','addTeams','getAssociatedQueues','addAgent','getDataValue','Voice','UserVoicePrefix','VoicePrefixId','removeTeams','flattenDeep','removeAgent','TeamVoicePrefix','getLists','values','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$iLike','$notILike','$contains','$any','firstName','lastName','Contact','dialActive','VoiceQueue','token','json','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','send','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','idle','unknown','ringing','teams','queues','flatten','toString','lower','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','voiceStatus','unavailable','busy','charAt','toUpperCase','select','ui.','InteractionId','field','user_has_','_interactions','OpenTabs','messengerSoundNotification','enabled','moment','util','squel','ioredis','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../components/realtime/agents','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','update','role','agent','userNotification:recalc:','destroy','get','admin','Users','user','Agents','Telephones','telephone','ignore','map','value','find','UserProfileResource','stack','name','User','rawAttributes','fieldName','key','filter','salt','previousPasswords','resetPasswordExpires','md5secret','includes','index','getOptions','where','query','includeAll','true','include','UserSetting','userSetting','push','findAll','rows','dataValues','sms','fax','openchannel','whatsapp','all','show','params','merge','options','attributes','openTabs','chat','mail','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','password','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','length','from','voicemail','VoiceMail','fullname','permissions','101','102','113','104','105','106','108','100','111','114','115','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','create','UserProfileSection','autoAssociation','bulkCreate','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','userProfileId','isEmpty','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x7836,0xf2));var _0x6783=function(_0x1a0303,_0x6508d3){_0x1a0303=_0x1a0303-0x0;var _0x4f9bee=_0x7836[_0x1a0303];return _0x4f9bee;};'use strict';var moment=require(_0x6783('0x0'));var util=require(_0x6783('0x1'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x6783('0x2'));var Redis=require(_0x6783('0x3'));var jayson=require(_0x6783('0x4'));var authService=require(_0x6783('0x5'));var contacts=require(_0x6783('0x6'));var qs=require(_0x6783('0x7'));var rta=require(_0x6783('0x8'));var logger=require('../../config/logger')(_0x6783('0x9'));var utils=require('../../config/utils');var config=require(_0x6783('0xa'));var licenseUtil=require('../../config/license/util');var APIBadRequestError=require(_0x6783('0xb'))[_0x6783('0xc')];var APINotFoundError=require(_0x6783('0xb'))[_0x6783('0xd')];var APIForbiddenError=require(_0x6783('0xb'))['APIForbiddenrror'];var APIHandleError=require('../../errors/api')[_0x6783('0xe')];var db=require(_0x6783('0xf'))['db'];var socket=require(_0x6783('0x10'))(new Redis(config[_0x6783('0x11')]));require(_0x6783('0x12'))[_0x6783('0x13')](socket);config['redis']=_[_0x6783('0x14')](config['redis'],{'host':_0x6783('0x15'),'port':0x18eb});var amiClient=jayson[_0x6783('0x16')][_0x6783('0x17')]({'port':0x232a});var values;function respondWithStatusCode(_0x4b194e,_0x1574e1){_0x1574e1=_0x1574e1||0xcc;return function(_0x5ce091){if(_0x5ce091){return _0x4b194e[_0x6783('0x18')](_0x1574e1);}return _0x4b194e[_0x6783('0x19')](_0x1574e1)[_0x6783('0x1a')]();};}function respondWithResult(_0x99b1e0,_0x2a86f8){_0x2a86f8=_0x2a86f8||0xc8;return function(_0x339e72){if(_0x339e72){return _0x99b1e0['status'](_0x2a86f8)['json'](_0x339e72);}};}function respondWithFilteredResult(_0x37460f,_0x16425e){return function(_0x2edf86){if(_0x2edf86){var _0x40d3cc=typeof _0x16425e[_0x6783('0x1b')]==='undefined'&&typeof _0x16425e[_0x6783('0x1c')]===_0x6783('0x1d');var _0x480408=_0x2edf86[_0x6783('0x1e')];var _0x257548=_0x40d3cc?0x0:_0x16425e['offset'];var _0x468d2b=_0x40d3cc?_0x2edf86['count']:_0x16425e[_0x6783('0x1b')]+_0x16425e[_0x6783('0x1c')];var _0xfaba7f;if(_0x468d2b>=_0x480408){_0x468d2b=_0x480408;_0xfaba7f=0xc8;}else{_0xfaba7f=0xce;}_0x37460f[_0x6783('0x19')](_0xfaba7f);return _0x37460f[_0x6783('0x1f')](_0x6783('0x20'),_0x257548+'-'+_0x468d2b+'/'+_0x480408)['json'](_0x2edf86);}return null;};}function respondWithRpcPromise(_0x553325,_0x1e5266,_0x233856,_0x4de5f6){return new Promise(function(_0x47061e,_0x123cd8){var _0x36f5eb=_0x4de5f6||amiClient;return _0x36f5eb[_0x6783('0x21')](_0x553325,_0x233856)[_0x6783('0x22')](function(_0x3335fe){logger[_0x6783('0x23')](_0x6783('0x24'),_0x1e5266,_0x6783('0x25'));logger[_0x6783('0x26')]('User,\x20%s,\x20%s,\x20%s',_0x1e5266,_0x6783('0x25'),JSON[_0x6783('0x27')](_0x3335fe));if(_0x3335fe[_0x6783('0x28')]){if(_0x3335fe['error']['code']===0x1f4){logger[_0x6783('0x28')]('User,\x20%s,\x20%s',_0x1e5266,_0x3335fe['error'][_0x6783('0x29')]);return _0x123cd8(_0x3335fe[_0x6783('0x28')][_0x6783('0x29')]);}logger[_0x6783('0x28')](_0x6783('0x24'),_0x1e5266,_0x3335fe['error'][_0x6783('0x29')]);return _0x47061e(_0x3335fe['error'][_0x6783('0x29')]);}else{logger['info'](_0x6783('0x24'),_0x1e5266,'request\x20sent');_0x47061e(_0x3335fe[_0x6783('0x2a')]['message']);}})[_0x6783('0x2b')](function(_0x48b192){logger[_0x6783('0x28')](_0x6783('0x24'),_0x1e5266,_0x48b192);_0x123cd8(_0x48b192);});});}function saveUpdates(_0x4be478){return function(_0x3aefa1){if(_0x3aefa1){return _0x3aefa1[_0x6783('0x2c')](_0x4be478)[_0x6783('0x22')](function(_0x176afa){if(_0x176afa[_0x6783('0x2d')]===_0x6783('0x2e')){socket['emit'](_0x6783('0x2f')+_0x176afa['id'],_0x176afa);}return _0x176afa;});}return null;};}function removeEntity(_0x1e140f,_0x3fd7c5){return function(_0x4f1beb){if(_0x4f1beb){return _0x4f1beb[_0x6783('0x30')]({'transaction':_0x3fd7c5})[_0x6783('0x22')](function(){var _0x533210=_0x4f1beb[_0x6783('0x31')]({'plain':!![]});if(_0x533210[_0x6783('0x2d')]===_0x6783('0x32'))return;var _0x51b33c=[{'name':_0x6783('0x33'),'value':_0x6783('0x34'),'ignore':!![]},{'name':_0x6783('0x35'),'value':_0x6783('0x2e'),'ignore':![]},{'name':_0x6783('0x36'),'value':_0x6783('0x37'),'ignore':![]}];var _0x2036b4=_(_0x51b33c)['filter'](_0x6783('0x38'))[_0x6783('0x39')](_0x6783('0x3a'))[_0x6783('0x3a')]();if(_['includes'](_0x2036b4,_0x533210[_0x6783('0x2d')])){return;}var _0x56401d=_[_0x6783('0x3b')](_0x51b33c,[_0x6783('0x3a'),_0x533210['role']])['name'];return db[_0x6783('0x3c')][_0x6783('0x30')]({'where':{'type':_0x56401d,'resourceId':_0x533210['id']},'transaction':_0x3fd7c5})[_0x6783('0x22')](function(){return _0x4f1beb;});})[_0x6783('0x22')](function(){_0x1e140f[_0x6783('0x19')](0xcc)[_0x6783('0x1a')]();});}};}function handleEntityNotFound(_0x750bd){return function(_0x1c1dd0){if(!_0x1c1dd0){_0x750bd[_0x6783('0x18')](0x194);}return _0x1c1dd0;};}function handleError(_0x4f5a7e,_0x235e6b){_0x235e6b=_0x235e6b||0x1f4;return function(_0x1c7ace){logger[_0x6783('0x28')](_0x1c7ace[_0x6783('0x3d')]);if(_0x1c7ace[_0x6783('0x3e')]){delete _0x1c7ace[_0x6783('0x3e')];}_0x4f5a7e[_0x6783('0x19')](_0x235e6b)['send'](_0x1c7ace);};}function getUserAttributes(){return _(db[_0x6783('0x3f')][_0x6783('0x40')])[_0x6783('0x39')](function(_0x2e5c84){return{'name':_0x2e5c84[_0x6783('0x41')],'type':_0x2e5c84['type'][_0x6783('0x42')]};})[_0x6783('0x43')](function(_0x3dea53){return!['password',_0x6783('0x44'),_0x6783('0x45'),'resetPasswordToken',_0x6783('0x46'),_0x6783('0x47')][_0x6783('0x48')](_0x3dea53[_0x6783('0x3e')]);})[_0x6783('0x3a')]();}exports[_0x6783('0x49')]=function(_0x1a7ecf,_0x47839c){var _0x35b710={},_0x5ba72f={'count':0x0,'rows':[]};var _0x2e16b5=getUserAttributes();_0x35b710=qs[_0x6783('0x4a')](_0x2e16b5,_0x1a7ecf);var _0x8531c9={'where':_0x35b710[_0x6783('0x4b')]};return db[_0x6783('0x3f')][_0x6783('0x1e')](_0x8531c9)[_0x6783('0x22')](function(_0x271802){_0x5ba72f['count']=_0x271802;if(_0x1a7ecf[_0x6783('0x4c')][_0x6783('0x4d')]){_0x35b710['include']=[{'all':!![]}];}if(_0x1a7ecf[_0x6783('0x4c')]['userSetting']===_0x6783('0x4e')){_0x35b710[_0x6783('0x4f')]=[{'model':db[_0x6783('0x50')],'as':_0x6783('0x51')}];}if(!_['includes'](_0x35b710['attributes'],'id')){_0x35b710['attributes'][_0x6783('0x52')]('id');}return db[_0x6783('0x3f')][_0x6783('0x53')](_0x35b710);})['then'](function(_0x3c4b91){_0x5ba72f[_0x6783('0x54')]=_0x3c4b91;if(_0x1a7ecf[_0x6783('0x4c')]['openTabs']===_0x6783('0x4e')){var _0x54a1e4=[];for(var _0x17803f=0x0;_0x17803f<_0x5ba72f[_0x6783('0x54')]['length'];_0x17803f++){_0x54a1e4[_0x6783('0x52')](get_open_tabs('chat',_0x5ba72f['rows'][_0x17803f][_0x6783('0x55')]));_0x54a1e4[_0x6783('0x52')](get_open_tabs(_0x6783('0x56'),_0x5ba72f['rows'][_0x17803f]['dataValues']));_0x54a1e4[_0x6783('0x52')](get_open_tabs(_0x6783('0x57'),_0x5ba72f['rows'][_0x17803f][_0x6783('0x55')]));_0x54a1e4['push'](get_open_tabs('mail',_0x5ba72f['rows'][_0x17803f][_0x6783('0x55')]));_0x54a1e4[_0x6783('0x52')](get_open_tabs(_0x6783('0x58'),_0x5ba72f[_0x6783('0x54')][_0x17803f][_0x6783('0x55')]));_0x54a1e4[_0x6783('0x52')](get_open_tabs(_0x6783('0x59'),_0x5ba72f[_0x6783('0x54')][_0x17803f][_0x6783('0x55')]));}return Promise[_0x6783('0x5a')](_0x54a1e4)[_0x6783('0x22')](function(){return _0x5ba72f;});}else{return _0x5ba72f;}})[_0x6783('0x22')](respondWithFilteredResult(_0x47839c,_0x35b710))[_0x6783('0x2b')](handleError(_0x47839c,null));};exports[_0x6783('0x5b')]=function(_0x4f2edb,_0x4815f4){var _0x9682f9=getUserAttributes();_0x4f2edb[_0x6783('0x4c')]['id']=_0x4f2edb[_0x6783('0x5c')]['id'];var _0x108774=qs[_0x6783('0x4a')](_0x9682f9,_0x4f2edb);if(_0x4f2edb[_0x6783('0x4c')][_0x6783('0x4d')]){_0x108774['include']=[{'all':!![]}];}if(_0x4f2edb['query']['userSetting']===_0x6783('0x4e')){_0x108774['include']=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x108774=_[_0x6783('0x5d')]({},_0x108774,_0x4f2edb[_0x6783('0x5e')]);if(!_[_0x6783('0x48')](_0x108774[_0x6783('0x5f')],'id')){_0x108774[_0x6783('0x5f')][_0x6783('0x52')]('id');}return db['User'][_0x6783('0x3b')](_0x108774)[_0x6783('0x22')](handleEntityNotFound(_0x4815f4,null))[_0x6783('0x22')](function(_0x5bb8a9){var _0x177561=[];values=_0x5bb8a9;if(_0x4f2edb[_0x6783('0x4c')][_0x6783('0x60')]==='true'){_0x177561[_0x6783('0x52')](get_open_tabs(_0x6783('0x61'),_0x5bb8a9[_0x6783('0x55')]));_0x177561[_0x6783('0x52')](get_open_tabs(_0x6783('0x56'),_0x5bb8a9[_0x6783('0x55')]));_0x177561[_0x6783('0x52')](get_open_tabs(_0x6783('0x58'),_0x5bb8a9[_0x6783('0x55')]));_0x177561[_0x6783('0x52')](get_open_tabs(_0x6783('0x59'),_0x5bb8a9['dataValues']));_0x177561[_0x6783('0x52')](get_open_tabs('fax',_0x5bb8a9[_0x6783('0x55')]));_0x177561[_0x6783('0x52')](get_open_tabs(_0x6783('0x62'),_0x5bb8a9['dataValues']));return Promise[_0x6783('0x5a')](_0x177561);}else{return values;}})[_0x6783('0x22')](function(){return values;})[_0x6783('0x22')](respondWithResult(_0x4815f4,null))[_0x6783('0x2b')](handleError(_0x4815f4,null));};exports['update']=function(_0x196dbe,_0x51a8c1){if(_0x196dbe[_0x6783('0x63')]['id']){delete _0x196dbe['body']['id'];}delete _0x196dbe[_0x6783('0x63')][_0x6783('0x2d')];return db['User'][_0x6783('0x3b')]({'where':{'id':_0x196dbe[_0x6783('0x5c')]['id']}})[_0x6783('0x22')](handleEntityNotFound(_0x51a8c1,null))['then'](saveUpdates(_0x196dbe['body'],null))['then'](respondWithResult(_0x51a8c1,null))[_0x6783('0x2b')](handleError(_0x51a8c1,null));};exports[_0x6783('0x64')]=function(_0x20b27d,_0x35f663){return db[_0x6783('0x3f')][_0x6783('0x64')]()[_0x6783('0x22')](respondWithResult(_0x35f663,null))['catch'](handleError(_0x35f663,null));};exports[_0x6783('0x65')]=function(_0x34aefb,_0x3f2f04){return db[_0x6783('0x3f')]['find']({'where':{'id':_0x34aefb[_0x6783('0x5c')]['id']}})[_0x6783('0x22')](handleEntityNotFound(_0x3f2f04,null))[_0x6783('0x22')](function(_0x51d5b2){if(_0x51d5b2){return _0x51d5b2['addContacts'](_0x34aefb['body'][_0x6783('0x66')],_[_0x6783('0x67')](_0x34aefb[_0x6783('0x63')],[_0x6783('0x66'),'id'])||{});}})['then'](respondWithResult(_0x3f2f04,null))['catch'](handleError(_0x3f2f04,null));};function validateUser(_0x4faef2){return new Promise(function(_0x849b2,_0x3b4c9f){if(_0x4faef2[_0x6783('0x68')])return _0x849b2(_0x4faef2);return db[_0x6783('0x69')][_0x6783('0x6a')](0x1)[_0x6783('0x22')](function(_0x3737db){if(_0x3737db[_0x6783('0x6b')])authService[_0x6783('0x6c')](_0x4faef2[_0x6783('0x6d')]);db[_0x6783('0x3f')][_0x6783('0x6e')]('internal')[_0x6783('0x22')](function(_0x4ade12){if(_[_0x6783('0x6f')](_0x4ade12)){_0x4faef2['internal']=_0x3737db['min_internal']||0x1;return;}if(_['isNil'](_0x3737db['min_internal'])||_0x3737db['min_internal']===_0x4ade12){_0x4faef2[_0x6783('0x68')]=_0x4ade12+0x1;return;}if(_0x3737db[_0x6783('0x70')]>_0x4ade12){_0x4faef2[_0x6783('0x68')]=_0x3737db['min_internal'];return;}return db[_0x6783('0x71')]['query'](_0x6783('0x72'),{'type':db[_0x6783('0x71')][_0x6783('0x73')][_0x6783('0x74')]})[_0x6783('0x22')](function(_0x241c2d){if(_0x241c2d&&_0x241c2d['length']){for(var _0x4a01c3=0x0,_0x433f46=_0x241c2d[_0x6783('0x75')];_0x4a01c3<_0x433f46&&_[_0x6783('0x6f')](_0x4faef2[_0x6783('0x68')]);_0x4a01c3++){if(_0x3737db[_0x6783('0x70')]<=_0x241c2d[_0x4a01c3][_0x6783('0x76')]){_0x4faef2['internal']=_0x241c2d[_0x4a01c3][_0x6783('0x76')];}else if(_0x3737db['min_internal']>_0x241c2d[_0x4a01c3][_0x6783('0x76')]&&_0x3737db[_0x6783('0x70')]<=_0x241c2d[_0x4a01c3]['to']){_0x4faef2[_0x6783('0x68')]=_0x3737db[_0x6783('0x70')];}}}if(_['isNil'](_0x4faef2['internal'])){_0x4faef2[_0x6783('0x68')]=_0x4ade12+0x1;}return _0x849b2(_0x4faef2);});});})[_0x6783('0x2b')](function(_0x254ad6){_0x3b4c9f(_0x254ad6);});});}function updateUser(_0xb0da2a){return new Promise(function(_0x381083,_0x359100){try{if(_0xb0da2a[_0x6783('0x77')]){_0xb0da2a['mailbox']=_0xb0da2a['internal'];_0xb0da2a[_0x6783('0x78')]={'mailbox':_0xb0da2a[_0x6783('0x68')],'password':_0xb0da2a[_0x6783('0x6d')],'fullname':_0xb0da2a[_0x6783('0x79')],'email':_0xb0da2a['email']};}if(_0xb0da2a['role']===_0x6783('0x2e')){if(!_0xb0da2a[_0x6783('0x7a')])_0xb0da2a[_0x6783('0x7a')]=[_0x6783('0x7b'),_0x6783('0x7c'),'103',_0x6783('0x7d'),'110',_0x6783('0x7e'),_0x6783('0x7f'),_0x6783('0x80'),'107',_0x6783('0x81'),'109',_0x6783('0x82'),_0x6783('0x83'),_0x6783('0x84'),_0x6783('0x85')];}_0x381083(_0xb0da2a);}catch(_0x112f99){_0x359100(_0x112f99);}});}exports['create']=function(_0x549941,_0x2e90be){if(_0x549941[_0x6783('0x34')][_0x6783('0x2d')]===_0x6783('0x2e'))throw new Error('Unauthorized');if(_0x549941[_0x6783('0x63')][_0x6783('0x2d')]==='user'&&_0x549941[_0x6783('0x34')][_0x6783('0x2d')]!==_0x6783('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x549941['body'][_0x6783('0x2d')]===_0x6783('0x32')&&_0x549941['user'][_0x6783('0x2d')]!=='admin'){throw new Error(_0x6783('0x86'));}return licenseUtil[_0x6783('0x87')]([_0x549941[_0x6783('0x63')]])[_0x6783('0x22')](function(){return validateUser(_0x549941['body']);})[_0x6783('0x22')](function(_0x3fddda){return updateUser(_0x3fddda)[_0x6783('0x22')](function(_0x46ccd2){if(_0x46ccd2[_0x6783('0x2d')]===_0x6783('0x32')){_0x46ccd2[_0x6783('0x88')]=_0x549941['user'][_0x6783('0x88')];delete _0x46ccd2['userProfileId'];}return _0x46ccd2;});})[_0x6783('0x22')](function(_0x2e7f29){return db[_0x6783('0x3f')][_0x6783('0x89')](_0x2e7f29,{'include':[{'model':db[_0x6783('0x78')],'as':'VoiceMail'}]});})[_0x6783('0x22')](function(_0x4cc02f){if(_0x549941[_0x6783('0x63')]['role']==='user')return _0x4cc02f;if(_0x549941[_0x6783('0x34')][_0x6783('0x2d')]!==_0x6783('0x34'))return _0x4cc02f;return db[_0x6783('0x8a')][_0x6783('0x3b')]({'where':{'name':_0x4cc02f['role']===_0x6783('0x2e')?'Agents':_0x6783('0x36'),'userProfileId':_0x549941[_0x6783('0x34')]['userProfileId']},'raw':!![]})['then'](function(_0x7d4b86){if(!_0x7d4b86||_0x7d4b86[_0x6783('0x8b')]!=0x0)return _0x4cc02f;return db['UserProfileResource'][_0x6783('0x89')]({'name':_0x4cc02f[_0x6783('0x3e')],'resourceId':_0x4cc02f['id'],'type':_0x7d4b86['name'],'sectionId':_0x7d4b86['id']},{})[_0x6783('0x22')](function(){return _0x4cc02f;});})[_0x6783('0x2b')](function(_0x2aec9){logger[_0x6783('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2aec9);throw _0x2aec9;});})[_0x6783('0x22')](respondWithResult(_0x2e90be,0xc9))[_0x6783('0x2b')](handleError(_0x2e90be,null));};exports[_0x6783('0x8c')]=function(_0x1997e3,_0x51547d){var _0x3bbe87=_0x1997e3[_0x6783('0x63')];var _0x439a1a=[];if(_0x1997e3[_0x6783('0x34')]['role']===_0x6783('0x2e'))throw new Error(_0x6783('0x8d'));if(_['some'](_0x3bbe87,['role',_0x6783('0x34')])&&_0x1997e3[_0x6783('0x34')][_0x6783('0x2d')]!==_0x6783('0x32')){throw new Error(_0x6783('0x8e'));}if(_[_0x6783('0x8f')](_0x3bbe87,[_0x6783('0x2d'),_0x6783('0x32')])&&_0x1997e3[_0x6783('0x34')]['role']!=='admin'){throw new Error(_0x6783('0x90'));}return licenseUtil[_0x6783('0x87')](_0x3bbe87)[_0x6783('0x22')](function(){return validateUser(_0x3bbe87[0x0]);})[_0x6783('0x22')](function(){for(var _0x5188a3=0x1;_0x5188a3<_0x3bbe87[_0x6783('0x75')];_0x5188a3++){var _0x188e1b=_0x3bbe87[_0x5188a3-0x1]['internal'];if(!_0x3bbe87[_0x5188a3][_0x6783('0x68')])_0x3bbe87[_0x5188a3][_0x6783('0x68')]=_0x188e1b+0x1;_0x439a1a[_0x6783('0x52')](validateUser(_0x3bbe87[_0x5188a3]));}return Promise['all'](_0x439a1a);})[_0x6783('0x22')](function(){_0x439a1a=[];for(var _0x1b8a5d=0x0;_0x1b8a5d<_0x3bbe87[_0x6783('0x75')];_0x1b8a5d++){_0x439a1a[_0x6783('0x52')](updateUser(_0x3bbe87[_0x1b8a5d]));}return Promise[_0x6783('0x5a')](_0x439a1a);})[_0x6783('0x22')](function(){_0x439a1a=_0x3bbe87[_0x6783('0x39')](function(_0xc1eb27){return db[_0x6783('0x3f')][_0x6783('0x89')](_0xc1eb27,{'include':[{'model':db['VoiceMail'],'as':_0x6783('0x78')}]})['then'](function(_0x101c46){_0xc1eb27['id']=_0x101c46['id'];return _0xc1eb27;});});return Promise[_0x6783('0x5a')](_0x439a1a);})['then'](function(_0x1943ee){if(_0x1997e3[_0x6783('0x63')][_0x6783('0x2d')]===_0x6783('0x34'))return _0x1943ee;if(_0x1997e3['user'][_0x6783('0x2d')]!=='user')return _0x1943ee;var _0x2a0d9a=_[_0x6783('0x8f')](_0x1943ee,function(_0x1801c7){return _0x1801c7['role']===_0x6783('0x2e')||_0x1801c7[_0x6783('0x2d')]==='telephone';});if(!_0x2a0d9a)return _0x1943ee;return db[_0x6783('0x8a')][_0x6783('0x53')]({'where':{'name':{'$or':[_0x6783('0x35'),_0x6783('0x36')]},'userProfileId':_0x1997e3[_0x6783('0x34')][_0x6783('0x91')]},'raw':!![]})[_0x6783('0x22')](function(_0x3aebdb){if(_[_0x6783('0x92')](_0x3aebdb)||!_[_0x6783('0x8f')](_0x3aebdb,[_0x6783('0x8b'),0x0]))return _0x1943ee;_0x439a1a=[];var _0x18f661=_(_0x3aebdb)[_0x6783('0x39')](function(_0x2c0aa1){if(_0x2c0aa1[_0x6783('0x8b')]===0x1)return;return _0x2c0aa1['name']==='Agents'?_0x6783('0x2e'):_0x6783('0x37');})['compact']()[_0x6783('0x3a')]();for(var _0x3f7d1b=0x0;_0x3f7d1b<_0x1943ee['length'];_0x3f7d1b++){if(!_[_0x6783('0x48')](_0x18f661,_0x1943ee[_0x3f7d1b][_0x6783('0x2d')]))return;var _0x30c5fb=_0x1943ee[_0x3f7d1b][_0x6783('0x2d')]===_0x6783('0x2e')?_0x6783('0x35'):'Telephones';_0x439a1a[_0x6783('0x52')](db[_0x6783('0x3c')][_0x6783('0x89')]({'name':_0x1943ee[_0x3f7d1b][_0x6783('0x3e')],'resourceId':_0x1943ee[_0x3f7d1b]['id'],'type':_0x30c5fb,'sectionId':_[_0x6783('0x3b')](_0x3aebdb,['name',_0x30c5fb])['id']},{}));}return Promise[_0x6783('0x5a')](_0x439a1a);});})[_0x6783('0x22')](respondWithResult(_0x51547d,0xc9))[_0x6783('0x2b')](handleError(_0x51547d,null));};exports['changePassword']=function(_0x505261,_0x47b58e){if(_0x505261['body']['id']){delete _0x505261['body']['id'];}return db[_0x6783('0x3f')][_0x6783('0x3b')]({'where':{'id':_0x505261[_0x6783('0x5c')]['id']}})['then'](function(_0x3635fe){if(!_0x3635fe)return null;if(_0x3635fe['id']===_0x505261['user']['id']){if(!_0x505261['body'][_0x6783('0x93')]||!_0x505261[_0x6783('0x63')][_0x6783('0x94')]){throw new db[(_0x6783('0x95'))]['ValidationError'](_0x6783('0x96'));}if(!_0x3635fe[_0x6783('0x97')](_0x505261['body'][_0x6783('0x93')])){throw new db[(_0x6783('0x95'))][(_0x6783('0x98'))](_0x6783('0x99'));}if(_0x505261[_0x6783('0x63')][_0x6783('0x93')]===_0x505261[_0x6783('0x63')][_0x6783('0x94')]){throw new db[(_0x6783('0x95'))][(_0x6783('0x98'))](_0x6783('0x9a'));}}else if(_0x505261[_0x6783('0x34')][_0x6783('0x2d')]===_0x6783('0x32')){if(!_0x505261[_0x6783('0x63')][_0x6783('0x94')]){throw new db[(_0x6783('0x95'))]['ValidationError'](_0x6783('0x9b'));}}else if(_0x505261[_0x6783('0x34')][_0x6783('0x2d')]===_0x6783('0x34')){if(!_0x505261['body'][_0x6783('0x94')]){throw new db[(_0x6783('0x95'))][(_0x6783('0x98'))](_0x6783('0x9b'));}if(_0x3635fe['role']!=='agent'){throw new db[(_0x6783('0x95'))][(_0x6783('0x98'))](_0x6783('0x8d'));}}else{throw new db[(_0x6783('0x95'))]['ValidationError'](_0x6783('0x8d'));}return _0x3635fe;})['then'](handleEntityNotFound(_0x47b58e,null))[_0x6783('0x22')](function(_0x195ec2){return db[_0x6783('0x69')]['findOne']({'attributes':['id',_0x6783('0x6b'),_0x6783('0x9c'),_0x6783('0x9d')]})[_0x6783('0x22')](function(_0x1e0378){if(_0x1e0378[_0x6783('0x6b')])authService['validatePasswordPattern'](_0x505261['body'][_0x6783('0x94')]);if(!_0x1e0378[_0x6783('0x9c')]||!_0x195ec2['previousPasswords'])return _0x195ec2;authService['validatePasswordHistory'](_0x505261[_0x6783('0x63')][_0x6783('0x94')],_0x195ec2[_0x6783('0x45')],_0x1e0378['passwordHistoryLimit']);return _0x195ec2;})[_0x6783('0x22')](saveUpdates({'password':_0x505261[_0x6783('0x63')]['newPassword'],'passwordResetAt':_0x505261['user']['id']==_0x505261[_0x6783('0x5c')]['id']?moment():null,'previousPasswords':authService[_0x6783('0x9e')](_0x505261['body'][_0x6783('0x94')],_0x195ec2['previousPasswords'])},null));})['then'](respondWithResult(_0x47b58e,null))[_0x6783('0x2b')](handleError(_0x47b58e,null));};exports['addQueues']=function(_0x509e96,_0x2ae8eb){var _0x1be0da=_0x509e96[_0x6783('0x63')][_0x6783('0x9f')];return db[_0x6783('0x3f')]['find']({'where':{'id':_0x509e96[_0x6783('0x5c')]['id']},'attributes':['id',_0x6783('0x3e'),_0x6783('0x2d'),'online','loginInPause',_0x6783('0xa0'),'interface']})[_0x6783('0x22')](handleEntityNotFound(_0x2ae8eb,null))[_0x6783('0x22')](function(_0xefea8b){if(_0xefea8b){if(!utils[_0x6783('0xa1')](_0x1be0da)){throw new db[(_0x6783('0x95'))][(_0x6783('0x98'))]('Unknown\x20channel');}return _0xefea8b[_0x6783('0xa2')+_[_0x6783('0xa3')](_0x1be0da[_0x6783('0xa4')]())+_0x6783('0xa5')](_0x509e96[_0x6783('0x63')][_0x6783('0x66')],{'penalty':_0x509e96[_0x6783('0x63')]['penalty']||0x0})[_0x6783('0xa6')](function(_0x45056e){for(var _0x15f73d=0x0;_0x15f73d<_0x509e96[_0x6783('0x63')]['ids'][_0x6783('0x75')];_0x15f73d+=0x1){var _0x181648={'UserId':Number(_0x509e96[_0x6783('0x5c')]['id'])};_0x181648[_[_0x6783('0xa3')](_0x1be0da[_0x6783('0xa4')]())+'QueueId']=Number(_0x509e96[_0x6783('0x63')][_0x6783('0x66')][_0x15f73d]);socket[_0x6783('0xa7')]('user'+_[_0x6783('0xa3')](_0x1be0da[_0x6783('0xa4')]())+'Queue:save',_0x181648);}return _0x45056e;})['then'](function(){if(_0x1be0da===_0x6783('0xa8')){return db['VoiceQueue']['findAll']({'where':{'id':_0x509e96[_0x6783('0x63')][_0x6783('0x66')]||[]},'raw':!![],'attributes':['id',_0x6783('0x3e')]});}})[_0x6783('0x22')](function(_0x336bd9){var _0x285dde=_0xefea8b[_0x6783('0x31')]({'plain':!![]});var _0x1bbcbf=[];if(_0x1be0da==='voice'&&_0x285dde[_0x6783('0x2d')]==='agent'&&_0x285dde[_0x6783('0xa9')]){for(let _0x50d11a=0x0;_0x50d11a<_0x336bd9[_0x6783('0x75')];_0x50d11a+=0x1){_0x1bbcbf[_0x6783('0x52')]({'membername':_0x285dde[_0x6783('0x3e')],'UserId':_0x285dde['id'],'queue_name':_0x336bd9[_0x50d11a][_0x6783('0x3e')],'VoiceQueueId':_0x336bd9[_0x50d11a]['id'],'interface':_[_0x6783('0x6f')](_0x285dde[_0x6783('0xaa')])?util['format'](_0x6783('0xab'),_0x285dde['name']):_0x285dde['interface'],'paused':_0x285dde[_0x6783('0xa0')]||![],'penalty':_0x509e96[_0x6783('0x63')][_0x6783('0xac')]||0x0});}return Promise[_0x6783('0x5a')](_0x1bbcbf[_0x6783('0x39')](function(_0xd385ff){return db[_0x6783('0xad')][_0x6783('0xae')](_0xd385ff);}));}return _0xefea8b;});}})[_0x6783('0x22')](respondWithStatusCode(_0x2ae8eb,null))[_0x6783('0x2b')](handleError(_0x2ae8eb,null));};exports[_0x6783('0xaf')]=function(_0x2295af,_0x26438b){var _0x27d47d,_0x30cc7d;return db['User'][_0x6783('0x3b')]({'where':{'id':_0x2295af['params']['id']},'attributes':['id','name','role']})[_0x6783('0x22')](handleEntityNotFound(_0x26438b,null))[_0x6783('0x22')](function(_0x2ddb15){if(_0x2ddb15){_0x27d47d=_0x2ddb15;if(!_0x2295af['query']['channel']||!utils['isValidChannel'](_0x2295af[_0x6783('0x4c')][_0x6783('0x9f')])){throw new db[(_0x6783('0x95'))][(_0x6783('0x98'))]('Unknown\x20channel');}return _0x2ddb15['remove'+_[_0x6783('0xa3')](_0x2295af['query'][_0x6783('0x9f')]['toLowerCase']())+_0x6783('0xa5')](_0x2295af[_0x6783('0x4c')]['ids']);}})[_0x6783('0x22')](function(_0x2680f5){if(_[_0x6783('0xb0')](_0x2295af[_0x6783('0x4c')]['ids'])){for(var _0x1589e0=0x0;_0x1589e0<_0x2295af[_0x6783('0x4c')][_0x6783('0x66')][_0x6783('0x75')];_0x1589e0+=0x1){_0x30cc7d={'UserId':Number(_0x2295af[_0x6783('0x5c')]['id'])};_0x30cc7d[_[_0x6783('0xa3')](_0x2295af[_0x6783('0x4c')]['channel'][_0x6783('0xa4')]())+'QueueId']=Number(_0x2295af[_0x6783('0x4c')][_0x6783('0x66')][_0x1589e0]);socket[_0x6783('0xa7')]('user'+_[_0x6783('0xa3')](_0x2295af['query']['channel']['toLowerCase']())+'Queue:remove',_0x30cc7d);}}else{_0x30cc7d={'UserId':Number(_0x2295af['params']['id'])};_0x30cc7d[_[_0x6783('0xa3')](_0x2295af[_0x6783('0x4c')][_0x6783('0x9f')]['toLowerCase']())+_0x6783('0xb1')]=Number(_0x2295af[_0x6783('0x4c')][_0x6783('0x66')]);socket[_0x6783('0xa7')](_0x6783('0x34')+_[_0x6783('0xa3')](_0x2295af[_0x6783('0x4c')]['channel'][_0x6783('0xa4')]())+_0x6783('0xb2'),_0x30cc7d);}return _0x2680f5;})['then'](function(){if(_0x2295af[_0x6783('0x4c')][_0x6783('0x9f')]===_0x6783('0xa8')){return db['UserVoiceQueueRt'][_0x6783('0x30')]({'where':{'UserId':_0x2295af['params']['id'],'VoiceQueueId':_0x2295af[_0x6783('0x4c')][_0x6783('0x66')]},'individualHooks':!![]})[_0x6783('0x22')](function(){return _0x27d47d;});}return _0x27d47d;})[_0x6783('0x22')](respondWithStatusCode(_0x26438b,null))[_0x6783('0x2b')](handleError(_0x26438b,null));};exports['addAvatar']=function(_0x40cdec,_0x1532b8){_0x40cdec[_0x6783('0x63')]['userpic']=_0x40cdec[_0x6783('0xb3')][_0x6783('0xb4')];return db[_0x6783('0x3f')]['find']({'where':{'id':_0x40cdec[_0x6783('0x5c')]['id']}})[_0x6783('0x22')](handleEntityNotFound(_0x1532b8,null))[_0x6783('0x22')](saveUpdates(_0x40cdec['body'],null))[_0x6783('0x22')](respondWithResult(_0x1532b8,null))[_0x6783('0x2b')](handleError(_0x1532b8,null));};exports[_0x6783('0xb5')]=function(_0x1d3c9d,_0x612b2){var _0x2a2999=path['join'](config[_0x6783('0xb6')],_0x6783('0xb7'));return db[_0x6783('0x3f')][_0x6783('0x3b')]({'where':{'id':_0x1d3c9d['params']['id']},'attributes':['id',_0x6783('0xb8')],'raw':!![]})[_0x6783('0x22')](handleEntityNotFound(_0x612b2,null))[_0x6783('0x22')](function(_0xbb3552){if(_0xbb3552){if(_[_0x6783('0x6f')](_0xbb3552[_0x6783('0xb8')])){return _0x612b2[_0x6783('0xb9')](_0x2a2999);}else{if(!fs[_0x6783('0xba')](path[_0x6783('0xbb')](config[_0x6783('0xb6')],_0x6783('0xbc'),_0xbb3552[_0x6783('0xb8')]))){return _0x612b2['download'](_0x2a2999);}return _0x612b2[_0x6783('0xb9')](path[_0x6783('0xbb')](config[_0x6783('0xb6')],_0x6783('0xbc'),_0xbb3552['userpic']));}}})[_0x6783('0x2b')](handleError(_0x612b2,null));};exports[_0x6783('0xbd')]=function(_0x16a663,_0x108a35){return db[_0x6783('0x3f')][_0x6783('0x3b')]({'where':{'id':_0x16a663[_0x6783('0x5c')]['id']},'attributes':['id']})[_0x6783('0x22')](handleEntityNotFound(_0x108a35,null))[_0x6783('0x22')](function(_0x25a6d7){var _0x1275bb=[];values=_0x25a6d7['dataValues'];_0x1275bb['push'](get_open_tabs('chat',_0x25a6d7[_0x6783('0x55')]));_0x1275bb[_0x6783('0x52')](get_open_tabs('sms',_0x25a6d7['dataValues']));_0x1275bb[_0x6783('0x52')](get_open_tabs(_0x6783('0x58'),_0x25a6d7['dataValues']));_0x1275bb[_0x6783('0x52')](get_open_tabs(_0x6783('0x59'),_0x25a6d7['dataValues']));_0x1275bb['push'](get_open_tabs(_0x6783('0x57'),_0x25a6d7[_0x6783('0x55')]));_0x1275bb[_0x6783('0x52')](get_open_tabs(_0x6783('0x62'),_0x25a6d7[_0x6783('0x55')]));return Promise[_0x6783('0x5a')](_0x1275bb);})[_0x6783('0x22')](function(_0xe482d7){if(_0xe482d7){var _0xeb1480=_['map'](values['ChatOpenTabs'],function(_0x2c38c9){return{'channel':'CHAT','id':_0x2c38c9['id'],'createdAt':_0x2c38c9['createdAt']};});var _0x48c837=_[_0x6783('0x39')](values['FaxOpenTabs'],function(_0x1a62f2){return{'channel':_0x6783('0xbe'),'id':_0x1a62f2['id'],'createdAt':_0x1a62f2[_0x6783('0xbf')]};});var _0x23a3bb=_['map'](values[_0x6783('0xc0')],function(_0x43de25){return{'channel':'OPENCHANNEL','id':_0x43de25['id'],'createdAt':_0x43de25[_0x6783('0xbf')]};});var _0x52516f=_[_0x6783('0x39')](values['MailOpenTabs'],function(_0x1854fc){return{'channel':_0x6783('0xc1'),'id':_0x1854fc['id'],'createdAt':_0x1854fc[_0x6783('0xbf')]};});var _0x4db99a=_[_0x6783('0x39')](values[_0x6783('0xc2')],function(_0x271008){return{'channel':'SMS','id':_0x271008['id'],'createdAt':_0x271008[_0x6783('0xbf')]};});var _0x2c274b=_['map'](values[_0x6783('0xc3')],function(_0x1aa39e){return{'channel':'WHATSAPP','id':_0x1aa39e['id'],'createdAt':_0x1aa39e[_0x6783('0xbf')]};});var _0x8e4599=_[_0x6783('0xc4')](_0xeb1480,_0x48c837,_0x23a3bb,_0x52516f,_0x4db99a,_0x2c274b);var _0x4c2b3b={'count':_0x8e4599['length'],'rows':_0x8e4599};return _0x4c2b3b;}else return null;})[_0x6783('0x22')](respondWithResult(_0x108a35,null))[_0x6783('0x2b')](handleError(_0x108a35,null));};exports['getContacts']=function(_0x372da5,_0x3af0e1){var _0x37df49={};return db[_0x6783('0x3f')][_0x6783('0xc5')]({'where':{'id':_0x372da5[_0x6783('0x5c')]['id']}})[_0x6783('0x22')](function(_0x2a0274){if(!_0x2a0274){throw new APINotFoundError(util[_0x6783('0xc6')](_0x6783('0xc7'),_0x372da5['params']['id']));}return contacts[_0x6783('0x64')]();})[_0x6783('0x22')](function(_0x46d34b){_0x372da5['query'][_0x6783('0x3f')]=_0x372da5[_0x6783('0x5c')]['id'];_0x37df49=qs[_0x6783('0x4a')](_0x46d34b,_0x372da5);if(_0x372da5[_0x6783('0x4c')][_0x6783('0xc8')](_0x6783('0x4d'))){_0x37df49[_0x6783('0x4f')]=[{'model':db['CmList'],'as':_0x6783('0xc9'),'required':![]},{'model':db[_0x6783('0xca')],'as':_0x6783('0xcb'),'attributes':['id',_0x6783('0x3e'),_0x6783('0xcc')],'where':_0x372da5['query']['tag']?{'id':_0x372da5[_0x6783('0x4c')][_0x6783('0xcd')]}:undefined,'required':_0x372da5[_0x6783('0x4c')][_0x6783('0xcd')]?!![]:![]}];}return contacts[_0x6783('0x53')](_0x372da5['query'],_0x372da5[_0x6783('0x34')],_0x37df49,_0x46d34b);})[_0x6783('0x22')](respondWithFilteredResult(_0x3af0e1,_0x37df49))[_0x6783('0x2b')](APIHandleError(_0x3af0e1));};exports[_0x6783('0xce')]=function(_0x3e67df,_0x44b991){var _0x114f9d;var _0x124be9={};var _0x1e86c5;return db[_0x6783('0x3f')][_0x6783('0xc5')]({'where':{'id':_0x3e67df['params']['id']},'attributes':['id',_0x6783('0x3e'),_0x6783('0x2d')]})[_0x6783('0x22')](handleEntityNotFound(_0x44b991,null))[_0x6783('0x22')](function(_0x27dd3e){if(!utils[_0x6783('0xa1')](_0x3e67df[_0x6783('0x4c')][_0x6783('0x9f')])){throw new db[(_0x6783('0x95'))][(_0x6783('0x98'))](_0x6783('0xcf'));}_0x114f9d=_0x27dd3e;var _0x56b465={};_0x56b465[_0x6783('0xd0')]=_[_0x6783('0xd1')](db[_[_0x6783('0xa3')](_0x3e67df[_0x6783('0x4c')]['channel'])+'Queue'][_0x6783('0x40')]);_0x56b465[_0x6783('0x4c')]=_[_0x6783('0xd1')](_0x3e67df[_0x6783('0x4c')]);_0x56b465['filters']=_['intersection'](_0x56b465['model'],_0x56b465[_0x6783('0x4c')]);_0x124be9[_0x6783('0x5f')]=_[_0x6783('0xd2')](_0x56b465[_0x6783('0xd0')],qs[_0x6783('0xd3')](_0x3e67df[_0x6783('0x4c')][_0x6783('0xd3')]));_0x124be9[_0x6783('0x5f')]=_0x124be9['attributes'][_0x6783('0x75')]?_0x124be9['attributes']:_0x56b465['model'];_0x124be9[_0x6783('0xd4')]=qs[_0x6783('0xd5')](_0x3e67df[_0x6783('0x4c')][_0x6783('0xd5')]);_0x124be9[_0x6783('0x4b')]=qs[_0x6783('0xd6')](_['pick'](_0x3e67df[_0x6783('0x4c')],_0x56b465[_0x6783('0xd6')]));if(_0x3e67df[_0x6783('0x4c')][_0x6783('0x43')]){_0x124be9[_0x6783('0x4b')]=_[_0x6783('0x5d')](_0x124be9[_0x6783('0x4b')],{'$or':_['map'](_0x124be9[_0x6783('0x5f')],function(_0x3f7354){var _0x5b34b6={};_0x5b34b6[_0x3f7354]={'$like':'%'+_0x3e67df['query'][_0x6783('0x43')]+'%'};return _0x5b34b6;})});}_0x124be9=_[_0x6783('0x5d')]({},_0x124be9,_0x3e67df[_0x6783('0x5e')]);switch(_0x114f9d[_0x6783('0x2d')]){case'admin':return db[_[_0x6783('0xa3')](_0x3e67df['query'][_0x6783('0x9f')])+_0x6783('0xd7')][_0x6783('0x53')](_0x124be9);case _0x6783('0x34'):case _0x6783('0x2e'):return _0x114f9d['get'+_[_0x6783('0xa3')](_0x3e67df[_0x6783('0x4c')]['channel'])+_0x6783('0xa5')](_0x124be9);default:throw new db[(_0x6783('0x95'))]['ValidationError'](_0x6783('0xd8'));}})['then'](function(_0x199162){_0x1e86c5=_0x199162['length'];if(!_0x3e67df[_0x6783('0x4c')][_0x6783('0xc8')](_0x6783('0xd9'))){_0x124be9[_0x6783('0x1c')]=qs['limit'](_0x3e67df['query'][_0x6783('0x1c')]);_0x124be9['offset']=qs[_0x6783('0x1b')](_0x3e67df[_0x6783('0x4c')][_0x6783('0x1b')]);}switch(_0x114f9d[_0x6783('0x2d')]){case'admin':return db[_['capitalize'](_0x3e67df['query'][_0x6783('0x9f')])+_0x6783('0xd7')]['findAll'](_0x124be9);case _0x6783('0x34'):case _0x6783('0x2e'):return _0x114f9d['get'+_['capitalize'](_0x3e67df['query'][_0x6783('0x9f')])+_0x6783('0xa5')](_0x124be9);}})[_0x6783('0x22')](function(_0x2ec21b){return{'count':_0x1e86c5,'rows':_0x2ec21b};})[_0x6783('0x22')](respondWithResult(_0x44b991,null))['catch'](handleError(_0x44b991,null));};exports[_0x6783('0xda')]=function(_0x4f6fdc,_0x2d97a4){var _0x187b4c={};var _0x363f89={};var _0x397b7f;var _0x222b23;return db[_0x6783('0x3f')]['findOne']({'where':{'id':_0x4f6fdc[_0x6783('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2d97a4,null))[_0x6783('0x22')](function(_0x146d05){if(_0x146d05){_0x397b7f=_0x146d05;_0x363f89['model']=_[_0x6783('0xd1')](db[_0x6783('0xad')][_0x6783('0x40')]);_0x363f89[_0x6783('0x4c')]=_['keys'](_0x4f6fdc[_0x6783('0x4c')]);_0x363f89[_0x6783('0xd6')]=_['intersection'](_0x363f89[_0x6783('0xd0')],_0x363f89[_0x6783('0x4c')]);_0x187b4c['attributes']=_['intersection'](_0x363f89[_0x6783('0xd0')],qs[_0x6783('0xd3')](_0x4f6fdc[_0x6783('0x4c')][_0x6783('0xd3')]));_0x187b4c['attributes']=_0x187b4c[_0x6783('0x5f')]['length']?_0x187b4c[_0x6783('0x5f')]:_0x363f89[_0x6783('0xd0')];_0x187b4c[_0x6783('0xd4')]=qs['sort'](_0x4f6fdc[_0x6783('0x4c')][_0x6783('0xd5')]);_0x187b4c['where']=qs[_0x6783('0xd6')](_['pick'](_0x4f6fdc[_0x6783('0x4c')],_0x363f89['filters']));if(_0x4f6fdc[_0x6783('0x4c')][_0x6783('0x43')]){_0x187b4c[_0x6783('0x4b')]=_[_0x6783('0x5d')](_0x187b4c[_0x6783('0x4b')],{'$or':_['map'](_0x187b4c[_0x6783('0x5f')],function(_0xa31664){var _0x2b6373={};_0x2b6373[_0xa31664]={'$like':'%'+_0x4f6fdc['query'][_0x6783('0x43')]+'%'};return _0x2b6373;})});}_0x187b4c=_[_0x6783('0x5d')]({},_0x187b4c,_0x4f6fdc['options']);return _0x397b7f['getVoiceQueuesRt'](_0x187b4c);}})[_0x6783('0x22')](function(_0x2eebaf){if(_0x2eebaf){_0x222b23=_0x2eebaf['length'];if(!_0x4f6fdc['query'][_0x6783('0xc8')](_0x6783('0xd9'))){_0x187b4c[_0x6783('0x1c')]=qs[_0x6783('0x1c')](_0x4f6fdc[_0x6783('0x4c')][_0x6783('0x1c')]);_0x187b4c[_0x6783('0x1b')]=qs[_0x6783('0x1b')](_0x4f6fdc[_0x6783('0x4c')][_0x6783('0x1b')]);}return _0x397b7f[_0x6783('0xda')](_0x187b4c);}})[_0x6783('0x22')](function(_0x5cdf87){if(_0x5cdf87){return _0x5cdf87?{'count':_0x222b23,'rows':_0x5cdf87}:null;}})[_0x6783('0x22')](respondWithResult(_0x2d97a4,null))[_0x6783('0x2b')](handleError(_0x2d97a4,null));};exports[_0x6783('0xdb')]=function(_0x562f6e,_0x160cde){var _0x5b0e61={};var _0x1c513e={};var _0x9c3608;var _0x5ba9e4;return db['User'][_0x6783('0xc5')]({'where':{'id':_0x562f6e[_0x6783('0x5c')]['id']}})[_0x6783('0x22')](handleEntityNotFound(_0x160cde,null))['then'](function(_0x5f541a){if(_0x5f541a){_0x9c3608=_0x5f541a;_0x1c513e[_0x6783('0xd0')]=_['keys'](db[_0x6783('0xdc')][_0x6783('0x40')]);_0x1c513e[_0x6783('0x4c')]=_[_0x6783('0xd1')](_0x562f6e[_0x6783('0x4c')]);_0x1c513e[_0x6783('0xd6')]=_['intersection'](_0x1c513e[_0x6783('0xd0')],_0x1c513e[_0x6783('0x4c')]);_0x5b0e61[_0x6783('0x5f')]=_[_0x6783('0xd2')](_0x1c513e[_0x6783('0xd0')],qs[_0x6783('0xd3')](_0x562f6e['query'][_0x6783('0xd3')]));_0x5b0e61[_0x6783('0x5f')]=_0x5b0e61[_0x6783('0x5f')][_0x6783('0x75')]?_0x5b0e61[_0x6783('0x5f')]:_0x1c513e[_0x6783('0xd0')];_0x5b0e61[_0x6783('0xd4')]=qs['sort'](_0x562f6e[_0x6783('0x4c')][_0x6783('0xd5')]);_0x5b0e61['where']=qs[_0x6783('0xd6')](_['pick'](_0x562f6e[_0x6783('0x4c')],_0x1c513e[_0x6783('0xd6')]));if(_0x562f6e['query'][_0x6783('0x43')]){_0x5b0e61[_0x6783('0x4b')]=_['merge'](_0x5b0e61[_0x6783('0x4b')],{'$or':_['map'](_0x5b0e61[_0x6783('0x5f')],function(_0xe049d7){var _0x22d50e={};_0x22d50e[_0xe049d7]={'$like':'%'+_0x562f6e[_0x6783('0x4c')]['filter']+'%'};return _0x22d50e;})});}_0x5b0e61=_[_0x6783('0x5d')]({},_0x5b0e61,_0x562f6e[_0x6783('0x5e')]);return _0x9c3608[_0x6783('0xdb')](_0x5b0e61);}})[_0x6783('0x22')](function(_0x12695d){if(_0x12695d){_0x5ba9e4=_0x12695d[_0x6783('0x75')];if(!_0x562f6e[_0x6783('0x4c')][_0x6783('0xc8')](_0x6783('0xd9'))){_0x5b0e61[_0x6783('0x1c')]=qs['limit'](_0x562f6e[_0x6783('0x4c')]['limit']);_0x5b0e61[_0x6783('0x1b')]=qs[_0x6783('0x1b')](_0x562f6e[_0x6783('0x4c')][_0x6783('0x1b')]);}return _0x9c3608[_0x6783('0xdb')](_0x5b0e61);}})['then'](function(_0x31feea){if(_0x31feea){return _0x31feea?{'count':_0x5ba9e4,'rows':_0x31feea}:null;}})['then'](respondWithResult(_0x160cde,null))[_0x6783('0x2b')](handleError(_0x160cde,null));};exports[_0x6783('0xdd')]=function(_0x174927,_0x15101f){var _0x24b845={'raw':!![],'where':{}};var _0x50e81e={};var _0x237c80={'count':0x0,'rows':[]};return db[_0x6783('0x3f')][_0x6783('0xc5')]({'where':{'id':_0x174927[_0x6783('0x5c')]['id']}})['then'](handleEntityNotFound(_0x15101f,null))[_0x6783('0x22')](function(_0x5e9c32){if(_0x5e9c32){_0x50e81e['model']=_[_0x6783('0xd1')](db[_0x6783('0xde')]['rawAttributes']);_0x50e81e[_0x6783('0x4c')]=_[_0x6783('0xd1')](_0x174927[_0x6783('0x4c')]);_0x50e81e[_0x6783('0xd6')]=_[_0x6783('0xd2')](_0x50e81e[_0x6783('0xd0')],_0x50e81e[_0x6783('0x4c')]);_0x24b845[_0x6783('0x5f')]=_[_0x6783('0xd2')](_0x50e81e[_0x6783('0xd0')],qs[_0x6783('0xd3')](_0x174927[_0x6783('0x4c')][_0x6783('0xd3')]));_0x24b845[_0x6783('0x5f')]=_0x24b845[_0x6783('0x5f')][_0x6783('0x75')]?_0x24b845[_0x6783('0x5f')]:_0x50e81e[_0x6783('0xd0')];if(!_0x174927[_0x6783('0x4c')]['hasOwnProperty'](_0x6783('0xd9'))){_0x24b845[_0x6783('0x1c')]=qs['limit'](_0x174927[_0x6783('0x4c')]['limit']);_0x24b845['offset']=qs[_0x6783('0x1b')](_0x174927[_0x6783('0x4c')][_0x6783('0x1b')]);}_0x24b845[_0x6783('0xd4')]=qs[_0x6783('0xd5')](_0x174927['query'][_0x6783('0xd5')]);_0x24b845[_0x6783('0x4b')]=qs[_0x6783('0xd6')](_[_0x6783('0xdf')](_0x174927[_0x6783('0x4c')],_0x50e81e[_0x6783('0xd6')]));_0x24b845[_0x6783('0x4b')][_0x6783('0xe0')]=_0x5e9c32['id'];if(_0x174927['query'][_0x6783('0x43')]){_0x24b845[_0x6783('0x4b')]=_[_0x6783('0x5d')](_0x24b845[_0x6783('0x4b')],{'$or':_[_0x6783('0x39')](_0x24b845[_0x6783('0x5f')],function(_0x29213a){var _0x153021={};_0x153021[_0x29213a]={'$like':'%'+_0x174927[_0x6783('0x4c')][_0x6783('0x43')]+'%'};return _0x153021;})});}_0x24b845=_[_0x6783('0x5d')]({},_0x24b845,_0x174927[_0x6783('0x5e')]);return db[_0x6783('0xde')]['count']({'where':_0x24b845['where']})[_0x6783('0x22')](function(_0x3c9131){_0x237c80[_0x6783('0x1e')]=_0x3c9131;if(_0x174927[_0x6783('0x4c')][_0x6783('0x4d')]){_0x24b845[_0x6783('0x4f')]=[{'all':!![]}];}return db['VoiceRecording'][_0x6783('0x53')](_0x24b845);})[_0x6783('0x22')](function(_0x1bc91f){_0x237c80[_0x6783('0x54')]=_0x1bc91f;return _0x237c80;});}})['then'](respondWithFilteredResult(_0x15101f,_0x24b845))[_0x6783('0x2b')](handleError(_0x15101f,null));};exports[_0x6783('0xe1')]=function(_0x2c0019,_0x20e435){var _0xbb598f={'raw':!![],'where':{}};var _0x26e8ed={};var _0x1a178c={'count':0x0,'rows':[]};return db[_0x6783('0x3f')]['findOne']({'where':{'id':_0x2c0019[_0x6783('0x5c')]['id']}})[_0x6783('0x22')](handleEntityNotFound(_0x20e435,null))[_0x6783('0x22')](function(_0x85dfe2){if(_0x85dfe2){_0x26e8ed[_0x6783('0xd0')]=_[_0x6783('0xd1')](db[_0x6783('0xe2')][_0x6783('0x40')]);_0x26e8ed['query']=_[_0x6783('0xd1')](_0x2c0019[_0x6783('0x4c')]);_0x26e8ed['filters']=_['intersection'](_0x26e8ed[_0x6783('0xd0')],_0x26e8ed['query']);_0xbb598f[_0x6783('0x5f')]=_[_0x6783('0xd2')](_0x26e8ed[_0x6783('0xd0')],qs['fields'](_0x2c0019['query'][_0x6783('0xd3')]));_0xbb598f[_0x6783('0x5f')]=_0xbb598f[_0x6783('0x5f')]['length']?_0xbb598f[_0x6783('0x5f')]:_0x26e8ed[_0x6783('0xd0')];if(!_0x2c0019[_0x6783('0x4c')][_0x6783('0xc8')]('nolimit')){_0xbb598f['limit']=qs['limit'](_0x2c0019[_0x6783('0x4c')][_0x6783('0x1c')]);_0xbb598f[_0x6783('0x1b')]=qs['offset'](_0x2c0019[_0x6783('0x4c')][_0x6783('0x1b')]);}_0xbb598f['order']=qs[_0x6783('0xd5')](_0x2c0019['query'][_0x6783('0xd5')]);_0xbb598f[_0x6783('0x4b')]=qs[_0x6783('0xd6')](_[_0x6783('0xdf')](_0x2c0019[_0x6783('0x4c')],_0x26e8ed[_0x6783('0xd6')]));_0xbb598f[_0x6783('0x4b')][_0x6783('0xe0')]=_0x85dfe2['id'];if(_0x2c0019['query'][_0x6783('0x43')]){_0xbb598f[_0x6783('0x4b')]=_[_0x6783('0x5d')](_0xbb598f[_0x6783('0x4b')],{'$or':_[_0x6783('0x39')](_0xbb598f[_0x6783('0x5f')],function(_0x35b6a6){var _0x4d85c3={};_0x4d85c3[_0x35b6a6]={'$like':'%'+_0x2c0019['query'][_0x6783('0x43')]+'%'};return _0x4d85c3;})});}_0xbb598f=_[_0x6783('0x5d')]({},_0xbb598f,_0x2c0019[_0x6783('0x5e')]);return db[_0x6783('0xe2')][_0x6783('0x1e')]({'where':_0xbb598f[_0x6783('0x4b')]})[_0x6783('0x22')](function(_0x3871df){_0x1a178c[_0x6783('0x1e')]=_0x3871df;if(_0x2c0019[_0x6783('0x4c')][_0x6783('0x4d')]){_0xbb598f[_0x6783('0x4f')]=[{'all':!![]}];}return db[_0x6783('0xe2')][_0x6783('0x53')](_0xbb598f);})['then'](function(_0x35e88d){_0x1a178c[_0x6783('0x54')]=_0x35e88d;return _0x1a178c;});}})['then'](respondWithFilteredResult(_0x20e435,_0xbb598f))[_0x6783('0x2b')](handleError(_0x20e435,null));};exports[_0x6783('0xe3')]=function(_0x4486a6,_0x558cb9){var _0x24aa64={};var _0x170e93={};var _0xb59766;var _0x15d46f;return db['User'][_0x6783('0xc5')]({'where':{'id':_0x4486a6[_0x6783('0x5c')]['id']}})[_0x6783('0x22')](handleEntityNotFound(_0x558cb9,null))['then'](function(_0x15265b){if(_0x15265b){_0xb59766=_0x15265b;_0x170e93[_0x6783('0xd0')]=_[_0x6783('0xd1')](db[_0x6783('0xe4')][_0x6783('0x40')]);_0x170e93['query']=_[_0x6783('0xd1')](_0x4486a6['query']);_0x170e93[_0x6783('0xd6')]=_[_0x6783('0xd2')](_0x170e93[_0x6783('0xd0')],_0x170e93[_0x6783('0x4c')]);_0x24aa64[_0x6783('0x5f')]=_[_0x6783('0xd2')](_0x170e93[_0x6783('0xd0')],qs['fields'](_0x4486a6[_0x6783('0x4c')][_0x6783('0xd3')]));_0x24aa64['attributes']=_0x24aa64[_0x6783('0x5f')][_0x6783('0x75')]?_0x24aa64[_0x6783('0x5f')]:_0x170e93[_0x6783('0xd0')];_0x24aa64[_0x6783('0xd4')]=qs[_0x6783('0xd5')](_0x4486a6[_0x6783('0x4c')][_0x6783('0xd5')]);_0x24aa64[_0x6783('0x4b')]=qs[_0x6783('0xd6')](_[_0x6783('0xdf')](_0x4486a6[_0x6783('0x4c')],_0x170e93['filters']));if(_0x4486a6['query'][_0x6783('0x43')]){_0x24aa64[_0x6783('0x4b')]=_[_0x6783('0x5d')](_0x24aa64[_0x6783('0x4b')],{'$or':_[_0x6783('0x39')](_0x24aa64['attributes'],function(_0xef4bd4){var _0x5ece95={};_0x5ece95[_0xef4bd4]={'$like':'%'+_0x4486a6['query'][_0x6783('0x43')]+'%'};return _0x5ece95;})});}_0x24aa64=_[_0x6783('0x5d')]({},_0x24aa64,_0x4486a6['options']);return _0xb59766[_0x6783('0xe3')](_0x24aa64);}})[_0x6783('0x22')](function(_0x49da08){if(_0x49da08){_0x15d46f=_0x49da08['length'];if(!_0x4486a6[_0x6783('0x4c')][_0x6783('0xc8')]('nolimit')){_0x24aa64[_0x6783('0x1c')]=qs[_0x6783('0x1c')](_0x4486a6[_0x6783('0x4c')]['limit']);_0x24aa64[_0x6783('0x1b')]=qs[_0x6783('0x1b')](_0x4486a6[_0x6783('0x4c')][_0x6783('0x1b')]);}return _0xb59766[_0x6783('0xe3')](_0x24aa64);}})['then'](function(_0x329a8e){if(_0x329a8e){return _0x329a8e?{'count':_0x15d46f,'rows':_0x329a8e}:null;}})['then'](respondWithResult(_0x558cb9,null))[_0x6783('0x2b')](handleError(_0x558cb9,null));};exports[_0x6783('0xe5')]=function(_0x9d4530,_0x2a62f4){var _0x904296={};var _0x1718d9={};var _0x2b1ca0;var _0x33a1b3;return db['User'][_0x6783('0xc5')]({'where':{'id':_0x9d4530[_0x6783('0x5c')]['id']}})[_0x6783('0x22')](handleEntityNotFound(_0x2a62f4,null))[_0x6783('0x22')](function(_0x459cfe){if(_0x459cfe){_0x2b1ca0=_0x459cfe;_0x1718d9[_0x6783('0xd0')]=_['keys'](db['OpenchannelInteraction'][_0x6783('0x40')]);_0x1718d9['query']=_[_0x6783('0xd1')](_0x9d4530[_0x6783('0x4c')]);_0x1718d9[_0x6783('0xd6')]=_[_0x6783('0xd2')](_0x1718d9[_0x6783('0xd0')],_0x1718d9[_0x6783('0x4c')]);_0x904296[_0x6783('0x5f')]=_[_0x6783('0xd2')](_0x1718d9[_0x6783('0xd0')],qs[_0x6783('0xd3')](_0x9d4530['query']['fields']));_0x904296[_0x6783('0x5f')]=_0x904296['attributes'][_0x6783('0x75')]?_0x904296[_0x6783('0x5f')]:_0x1718d9[_0x6783('0xd0')];_0x904296[_0x6783('0xd4')]=qs[_0x6783('0xd5')](_0x9d4530[_0x6783('0x4c')][_0x6783('0xd5')]);_0x904296[_0x6783('0x4b')]=qs[_0x6783('0xd6')](_[_0x6783('0xdf')](_0x9d4530[_0x6783('0x4c')],_0x1718d9[_0x6783('0xd6')]));if(_0x9d4530[_0x6783('0x4c')][_0x6783('0x43')]){_0x904296[_0x6783('0x4b')]=_[_0x6783('0x5d')](_0x904296['where'],{'$or':_[_0x6783('0x39')](_0x904296['attributes'],function(_0x4d973a){var _0x5c555f={};_0x5c555f[_0x4d973a]={'$like':'%'+_0x9d4530[_0x6783('0x4c')][_0x6783('0x43')]+'%'};return _0x5c555f;})});}_0x904296=_[_0x6783('0x5d')]({},_0x904296,_0x9d4530[_0x6783('0x5e')]);return _0x2b1ca0[_0x6783('0xe5')](_0x904296);}})[_0x6783('0x22')](function(_0x313b52){if(_0x313b52){_0x33a1b3=_0x313b52[_0x6783('0x75')];if(!_0x9d4530[_0x6783('0x4c')]['hasOwnProperty'](_0x6783('0xd9'))){_0x904296[_0x6783('0x1c')]=qs[_0x6783('0x1c')](_0x9d4530['query']['limit']);_0x904296[_0x6783('0x1b')]=qs[_0x6783('0x1b')](_0x9d4530[_0x6783('0x4c')][_0x6783('0x1b')]);}return _0x2b1ca0[_0x6783('0xe5')](_0x904296);}})[_0x6783('0x22')](function(_0xc88f96){if(_0xc88f96){return _0xc88f96?{'count':_0x33a1b3,'rows':_0xc88f96}:null;}})[_0x6783('0x22')](respondWithResult(_0x2a62f4,null))['catch'](handleError(_0x2a62f4,null));};exports[_0x6783('0xe6')]=function(_0x4f5ba5,_0x1767b5){var _0x4c679a={'raw':!![],'where':{}};var _0x364e17={};var _0x4d8895={'count':0x0,'rows':[]};return db[_0x6783('0x3f')][_0x6783('0xc5')]({'where':{'id':_0x4f5ba5[_0x6783('0x5c')]['id']}})[_0x6783('0x22')](handleEntityNotFound(_0x1767b5,null))[_0x6783('0x22')](function(_0x3535fc){if(_0x3535fc){_0x364e17['model']=_[_0x6783('0xd1')](db['MailInteraction'][_0x6783('0x40')]);_0x364e17[_0x6783('0x4c')]=_[_0x6783('0xd1')](_0x4f5ba5['query']);_0x364e17['filters']=_[_0x6783('0xd2')](_0x364e17[_0x6783('0xd0')],_0x364e17[_0x6783('0x4c')]);_0x4c679a[_0x6783('0x5f')]=_[_0x6783('0xd2')](_0x364e17[_0x6783('0xd0')],qs['fields'](_0x4f5ba5[_0x6783('0x4c')]['fields']));_0x4c679a[_0x6783('0x5f')]=_0x4c679a[_0x6783('0x5f')]['length']?_0x4c679a[_0x6783('0x5f')]:_0x364e17[_0x6783('0xd0')];if(!_0x4f5ba5[_0x6783('0x4c')][_0x6783('0xc8')](_0x6783('0xd9'))){_0x4c679a['limit']=qs[_0x6783('0x1c')](_0x4f5ba5['query'][_0x6783('0x1c')]);_0x4c679a[_0x6783('0x1b')]=qs[_0x6783('0x1b')](_0x4f5ba5[_0x6783('0x4c')][_0x6783('0x1b')]);}_0x4c679a[_0x6783('0xd4')]=qs[_0x6783('0xd5')](_0x4f5ba5[_0x6783('0x4c')][_0x6783('0xd5')]);_0x4c679a[_0x6783('0x4b')]=qs[_0x6783('0xd6')](_['pick'](_0x4f5ba5[_0x6783('0x4c')],_0x364e17[_0x6783('0xd6')]));_0x4c679a[_0x6783('0x4b')][_0x6783('0xe0')]=_0x3535fc['id'];if(_0x4f5ba5[_0x6783('0x4c')][_0x6783('0x43')]){_0x4c679a[_0x6783('0x4b')]=_[_0x6783('0x5d')](_0x4c679a[_0x6783('0x4b')],{'$or':_['map'](_0x4c679a[_0x6783('0x5f')],function(_0x4e68f9){var _0x2f50e={};_0x2f50e[_0x4e68f9]={'$like':'%'+_0x4f5ba5[_0x6783('0x4c')]['filter']+'%'};return _0x2f50e;})});}_0x4c679a=_['merge']({},_0x4c679a,_0x4f5ba5[_0x6783('0x5e')]);return db[_0x6783('0xe7')][_0x6783('0x1e')]({'where':_0x4c679a[_0x6783('0x4b')]})[_0x6783('0x22')](function(_0x37488f){_0x4d8895[_0x6783('0x1e')]=_0x37488f;if(_0x4f5ba5[_0x6783('0x4c')]['includeAll']){_0x4c679a[_0x6783('0x4f')]=[{'all':!![]}];}return db['MailInteraction'][_0x6783('0x53')](_0x4c679a);})[_0x6783('0x22')](function(_0x52aad3){_0x4d8895['rows']=_0x52aad3;return _0x4d8895;});}})[_0x6783('0x22')](respondWithFilteredResult(_0x1767b5,_0x4c679a))[_0x6783('0x2b')](handleError(_0x1767b5,null));};exports['getSmsInteractions']=function(_0x54cfea,_0x14f66e){var _0x129376={};var _0x1aa4c2={};var _0x8b8306;var _0x5a1212;return db[_0x6783('0x3f')][_0x6783('0xc5')]({'where':{'id':_0x54cfea[_0x6783('0x5c')]['id']}})[_0x6783('0x22')](handleEntityNotFound(_0x14f66e,null))['then'](function(_0x30f89d){if(_0x30f89d){_0x8b8306=_0x30f89d;_0x1aa4c2[_0x6783('0xd0')]=_[_0x6783('0xd1')](db[_0x6783('0xe8')][_0x6783('0x40')]);_0x1aa4c2[_0x6783('0x4c')]=_[_0x6783('0xd1')](_0x54cfea[_0x6783('0x4c')]);_0x1aa4c2[_0x6783('0xd6')]=_[_0x6783('0xd2')](_0x1aa4c2[_0x6783('0xd0')],_0x1aa4c2[_0x6783('0x4c')]);_0x129376['attributes']=_[_0x6783('0xd2')](_0x1aa4c2[_0x6783('0xd0')],qs[_0x6783('0xd3')](_0x54cfea['query'][_0x6783('0xd3')]));_0x129376[_0x6783('0x5f')]=_0x129376['attributes'][_0x6783('0x75')]?_0x129376[_0x6783('0x5f')]:_0x1aa4c2[_0x6783('0xd0')];_0x129376[_0x6783('0xd4')]=qs[_0x6783('0xd5')](_0x54cfea[_0x6783('0x4c')][_0x6783('0xd5')]);_0x129376[_0x6783('0x4b')]=qs[_0x6783('0xd6')](_[_0x6783('0xdf')](_0x54cfea[_0x6783('0x4c')],_0x1aa4c2[_0x6783('0xd6')]));if(_0x54cfea[_0x6783('0x4c')][_0x6783('0x43')]){_0x129376[_0x6783('0x4b')]=_[_0x6783('0x5d')](_0x129376['where'],{'$or':_['map'](_0x129376[_0x6783('0x5f')],function(_0x4de121){var _0x1a84db={};_0x1a84db[_0x4de121]={'$like':'%'+_0x54cfea['query'][_0x6783('0x43')]+'%'};return _0x1a84db;})});}_0x129376=_[_0x6783('0x5d')]({},_0x129376,_0x54cfea[_0x6783('0x5e')]);return _0x8b8306[_0x6783('0xe9')](_0x129376);}})[_0x6783('0x22')](function(_0x55b0e5){if(_0x55b0e5){_0x5a1212=_0x55b0e5['length'];if(!_0x54cfea['query'][_0x6783('0xc8')](_0x6783('0xd9'))){_0x129376[_0x6783('0x1c')]=qs[_0x6783('0x1c')](_0x54cfea[_0x6783('0x4c')][_0x6783('0x1c')]);_0x129376['offset']=qs[_0x6783('0x1b')](_0x54cfea[_0x6783('0x4c')][_0x6783('0x1b')]);}return _0x8b8306[_0x6783('0xe9')](_0x129376);}})[_0x6783('0x22')](function(_0x545ed4){if(_0x545ed4){return _0x545ed4?{'count':_0x5a1212,'rows':_0x545ed4}:null;}})['then'](respondWithResult(_0x14f66e,null))[_0x6783('0x2b')](handleError(_0x14f66e,null));};exports['getFaxInteractions']=function(_0x1055a5,_0x30f19c){var _0xa0741b={};var _0x5f1dbf={};var _0x14cb21;var _0x1badd0;return db['User'][_0x6783('0xc5')]({'where':{'id':_0x1055a5[_0x6783('0x5c')]['id']}})[_0x6783('0x22')](handleEntityNotFound(_0x30f19c,null))[_0x6783('0x22')](function(_0xda352e){if(_0xda352e){_0x14cb21=_0xda352e;_0x5f1dbf['model']=_[_0x6783('0xd1')](db['FaxInteraction']['rawAttributes']);_0x5f1dbf[_0x6783('0x4c')]=_[_0x6783('0xd1')](_0x1055a5[_0x6783('0x4c')]);_0x5f1dbf[_0x6783('0xd6')]=_['intersection'](_0x5f1dbf['model'],_0x5f1dbf[_0x6783('0x4c')]);_0xa0741b[_0x6783('0x5f')]=_[_0x6783('0xd2')](_0x5f1dbf['model'],qs['fields'](_0x1055a5[_0x6783('0x4c')][_0x6783('0xd3')]));_0xa0741b[_0x6783('0x5f')]=_0xa0741b[_0x6783('0x5f')][_0x6783('0x75')]?_0xa0741b[_0x6783('0x5f')]:_0x5f1dbf['model'];_0xa0741b[_0x6783('0xd4')]=qs[_0x6783('0xd5')](_0x1055a5[_0x6783('0x4c')]['sort']);_0xa0741b[_0x6783('0x4b')]=qs['filters'](_['pick'](_0x1055a5[_0x6783('0x4c')],_0x5f1dbf[_0x6783('0xd6')]));if(_0x1055a5[_0x6783('0x4c')][_0x6783('0x43')]){_0xa0741b[_0x6783('0x4b')]=_[_0x6783('0x5d')](_0xa0741b['where'],{'$or':_[_0x6783('0x39')](_0xa0741b[_0x6783('0x5f')],function(_0x57326c){var _0x915ca3={};_0x915ca3[_0x57326c]={'$like':'%'+_0x1055a5['query'][_0x6783('0x43')]+'%'};return _0x915ca3;})});}_0xa0741b=_[_0x6783('0x5d')]({},_0xa0741b,_0x1055a5[_0x6783('0x5e')]);return _0x14cb21['getFaxInteractions'](_0xa0741b);}})[_0x6783('0x22')](function(_0x278625){if(_0x278625){_0x1badd0=_0x278625[_0x6783('0x75')];if(!_0x1055a5[_0x6783('0x4c')][_0x6783('0xc8')](_0x6783('0xd9'))){_0xa0741b[_0x6783('0x1c')]=qs['limit'](_0x1055a5[_0x6783('0x4c')][_0x6783('0x1c')]);_0xa0741b[_0x6783('0x1b')]=qs['offset'](_0x1055a5[_0x6783('0x4c')][_0x6783('0x1b')]);}return _0x14cb21[_0x6783('0xea')](_0xa0741b);}})[_0x6783('0x22')](function(_0x55890){if(_0x55890){return _0x55890?{'count':_0x1badd0,'rows':_0x55890}:null;}})[_0x6783('0x22')](respondWithResult(_0x30f19c,null))[_0x6783('0x2b')](handleError(_0x30f19c,null));};exports[_0x6783('0xeb')]=function(_0x6c4aad,_0x3b5768){var _0x35878e={};var _0x46e19d={};var _0x4adc12;var _0xf52adc;return db[_0x6783('0x3f')][_0x6783('0xc5')]({'where':{'id':_0x6c4aad[_0x6783('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3b5768,null))[_0x6783('0x22')](function(_0x4d2929){if(_0x4d2929){_0x4adc12=_0x4d2929;_0x46e19d['model']=_['keys'](db[_0x6783('0xec')][_0x6783('0x40')]);_0x46e19d['query']=_[_0x6783('0xd1')](_0x6c4aad[_0x6783('0x4c')]);_0x46e19d[_0x6783('0xd6')]=_[_0x6783('0xd2')](_0x46e19d[_0x6783('0xd0')],_0x46e19d['query']);_0x35878e[_0x6783('0x5f')]=_[_0x6783('0xd2')](_0x46e19d[_0x6783('0xd0')],qs[_0x6783('0xd3')](_0x6c4aad[_0x6783('0x4c')][_0x6783('0xd3')]));_0x35878e['attributes']=_0x35878e['attributes'][_0x6783('0x75')]?_0x35878e['attributes']:_0x46e19d[_0x6783('0xd0')];_0x35878e[_0x6783('0xd4')]=qs[_0x6783('0xd5')](_0x6c4aad[_0x6783('0x4c')][_0x6783('0xd5')]);_0x35878e[_0x6783('0x4b')]=qs[_0x6783('0xd6')](_[_0x6783('0xdf')](_0x6c4aad['query'],_0x46e19d[_0x6783('0xd6')]));if(_0x6c4aad[_0x6783('0x4c')][_0x6783('0x43')]){_0x35878e[_0x6783('0x4b')]=_[_0x6783('0x5d')](_0x35878e[_0x6783('0x4b')],{'$or':_[_0x6783('0x39')](_0x35878e['attributes'],function(_0x5a2cdf){var _0x3e3534={};_0x3e3534[_0x5a2cdf]={'$like':'%'+_0x6c4aad['query'][_0x6783('0x43')]+'%'};return _0x3e3534;})});}_0x35878e=_[_0x6783('0x5d')]({},_0x35878e,_0x6c4aad[_0x6783('0x5e')]);return _0x4adc12[_0x6783('0xeb')](_0x35878e);}})['then'](function(_0xe3656f){if(_0xe3656f){_0xf52adc=_0xe3656f['length'];if(!_0x6c4aad[_0x6783('0x4c')][_0x6783('0xc8')](_0x6783('0xd9'))){_0x35878e[_0x6783('0x1c')]=qs[_0x6783('0x1c')](_0x6c4aad['query']['limit']);_0x35878e[_0x6783('0x1b')]=qs['offset'](_0x6c4aad[_0x6783('0x4c')]['offset']);}return _0x4adc12[_0x6783('0xeb')](_0x35878e);}})[_0x6783('0x22')](function(_0x31c133){if(_0x31c133){return _0x31c133?{'count':_0xf52adc,'rows':_0x31c133}:null;}})[_0x6783('0x22')](respondWithResult(_0x3b5768,null))[_0x6783('0x2b')](handleError(_0x3b5768,null));};exports[_0x6783('0xed')]=function(_0x4900d1,_0x4768f9,_0x44d558){var _0x1550c3;var _0x276e0f;var _0x25b3bc;var _0x3f1aab=!_[_0x6783('0x6f')](_0x4900d1[_0x6783('0x5c')]['id'])?_0x4900d1[_0x6783('0x5c')]['id']:!_['isNil'](_0x4900d1['user']['id'])?_0x4900d1['user']['id']:null;return db[_0x6783('0x3f')][_0x6783('0x3b')]({'where':{'id':_0x3f1aab,'role':{'$or':[_0x6783('0x32'),_0x6783('0x34'),_0x6783('0x2e')]}},'attributes':['id',_0x6783('0x3e'),_0x6783('0xee'),_0x6783('0xef'),_0x6783('0x2d'),'internal',_0x6783('0xf0')]})[_0x6783('0x22')](function(_0x119f15){if(_0x119f15){if(_0x119f15[_0x6783('0x2d')]===_0x6783('0x2e')){_0x1550c3=_0x119f15;if(_0x4900d1[_0x6783('0x63')][_0x6783('0xaa')]){_0x25b3bc=util[_0x6783('0xc6')](_0x6783('0xf1'),_0x1550c3[_0x4900d1[_0x6783('0x63')]['interface']]);}else if(_0x4900d1[_0x6783('0x63')]['intrf']){_0x25b3bc=util['format'](_0x6783('0xab'),_0x4900d1[_0x6783('0x63')]['intrf']);}else{_0x25b3bc=util[_0x6783('0xc6')]('SIP/%s',_0x1550c3[_0x6783('0x3e')]);}socket['to'](util[_0x6783('0xc6')](_0x6783('0xf2'),_0x1550c3['name']))[_0x6783('0xa7')](_0x6783('0xf3'),{'user':{'id':_0x1550c3['id'],'name':_0x1550c3['name']},'ip':_0x4900d1[_0x6783('0xf4')][_0x6783('0xf5')]||_0x4900d1[_0x6783('0xf6')][_0x6783('0xf7')]||_0x4900d1[_0x6783('0xf8')][_0x6783('0xf7')]||_0x4900d1[_0x6783('0xf6')]['socket']['remoteAddress']});return db[_0x6783('0xad')][_0x6783('0x30')]({'where':{'membername':_0x1550c3[_0x6783('0x3e')]},'individualHooks':!![]});}}else{throw new db[(_0x6783('0x95'))][(_0x6783('0x98'))](_0x6783('0xf9'));}})[_0x6783('0x22')](function(){if(_0x1550c3){return _0x1550c3['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x4a7d0b){if(_0x1550c3){if(_0x4a7d0b){_0x276e0f=_0x4a7d0b;if(_0x276e0f[_0x6783('0x75')]){var _0x268bc5=_0x276e0f[_0x6783('0x39')](function(_0x235e24){var _0x448a19={'membername':_0x1550c3[_0x6783('0x3e')],'UserId':_0x1550c3['id'],'queue_name':_0x235e24['name'],'VoiceQueueId':_0x235e24['id'],'interface':_0x25b3bc,'paused':_0x1550c3[_0x6783('0xf0')]||![],'penalty':_0x235e24['UserVoiceQueue.penalty']||0x0};return db[_0x6783('0xad')][_0x6783('0xae')](_0x448a19);});return Promise['all'](_0x268bc5);}}}})[_0x6783('0x22')](function(){if(_0x1550c3){return db[_0x6783('0xfa')]['findAll']({'where':{'membername':_0x1550c3[_0x6783('0x3e')],'exitAt':null}});}})[_0x6783('0x22')](function(_0x1a2e73){if(_0x1550c3){var _0x34e0db=[];_0x1a2e73['forEach'](function(_0x53a268){_0x34e0db['push'](_0x53a268[_0x6783('0x2c')]({'exitAt':moment()[_0x6783('0xc6')](_0x6783('0xfb'))}));});return Promise[_0x6783('0x5a')](_0x34e0db);}})['then'](function(){if(_0x1550c3){var _0x425e17=[];var _0x5d562b=[];var _0x5babe7=utils[_0x6783('0xfc')]();var _0x5d2d7b={'membername':_0x1550c3[_0x6783('0x3e')],'interface':_0x25b3bc,'enterAt':moment()[_0x6783('0xc6')](_0x6783('0xfb')),'role':_0x1550c3[_0x6783('0x2d')],'internal':_0x1550c3[_0x6783('0x68')]};_0x5babe7[_0x6783('0xfd')](function(_0xa5e1cd){_0x425e17[_0x6783('0x52')](_[_0x6783('0x5d')]({'channel':_0xa5e1cd,'type':'LOGIN','data1':_0x4900d1['body']['device'],'data2':_0x25b3bc},_0x5d2d7b));if(_0x1550c3['loginInPause']){_0x5d562b['push'](_[_0x6783('0x5d')]({'channel':_0xa5e1cd,'type':'PAUSE','data1':_0x6783('0xfe')},_0x5d2d7b));}});return db['MemberReport'][_0x6783('0x8c')](_0x425e17[_0x6783('0xc4')](_0x5d562b),{'individualHooks':!![]});}})['then'](function(){if(_0x1550c3){return _0x1550c3[_0x6783('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x6783('0xc6')](_0x6783('0xfb')),'voicePause':_0x1550c3[_0x6783('0xf0')]||![],'mailPause':_0x1550c3[_0x6783('0xf0')]||![],'chatPause':_0x1550c3[_0x6783('0xf0')]||![],'faxPause':_0x1550c3[_0x6783('0xf0')]||![],'smsPause':_0x1550c3[_0x6783('0xf0')]||![],'openchannelPause':_0x1550c3[_0x6783('0xf0')]||![],'whatsappPause':_0x1550c3[_0x6783('0xf0')]||![],'pauseType':_0x1550c3[_0x6783('0xf0')]?'LOGININPAUSE':null,'interface':_0x25b3bc,'lastPauseAt':moment()[_0x6783('0xc6')](_0x6783('0xfb'))});}})[_0x6783('0x22')](function(_0x1b152d){if(_0x4900d1['isMiddleware']){return _0x44d558();}else{return Promise[_0x6783('0xff')](_0x1b152d)[_0x6783('0x22')](respondWithResult(_0x4768f9,null));}})[_0x6783('0x2b')](handleError(_0x4768f9,null));};exports['logout']=function(_0x251192,_0x50eac2){var _0x489ff2;return db[_0x6783('0x3f')][_0x6783('0x3b')]({'where':{'id':_0x251192['params']['id'],'role':_0x6783('0x2e')},'attributes':['id',_0x6783('0x3e'),_0x6783('0x2d')]})[_0x6783('0x22')](handleEntityNotFound(_0x50eac2,null))[_0x6783('0x22')](function(_0x53131b){if(_0x53131b){_0x489ff2=_0x53131b;return db[_0x6783('0xad')][_0x6783('0x30')]({'where':{'membername':_0x489ff2[_0x6783('0x3e')]},'individualHooks':!![]});}})[_0x6783('0x22')](function(){return db[_0x6783('0xfa')]['findAll']({'where':{'membername':_0x489ff2[_0x6783('0x3e')],'exitAt':null}});})[_0x6783('0x22')](function(_0xa4bbf){var _0x3f894a=[];_0xa4bbf[_0x6783('0xfd')](function(_0x92aba7){_0x3f894a[_0x6783('0x52')](_0x92aba7['update']({'exitAt':moment()[_0x6783('0xc6')](_0x6783('0xfb'))}));});return Promise[_0x6783('0x5a')](_0x3f894a);})['then'](function(){return _0x489ff2['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6783('0x22')](respondWithResult(_0x50eac2,null))['catch'](handleError(_0x50eac2,null));};exports['pause']=function(_0x1229aa,_0x408e55){var _0x30b19a;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x1229aa[_0x6783('0x5c')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x6783('0x3f')]['find']({'where':{'id':_0x1229aa[_0x6783('0x5c')]['id'],'role':_0x6783('0x2e')},'attributes':['id',_0x6783('0x3e'),_0x6783('0x2d'),_0x6783('0x68'),_0x6783('0xaa'),'online']});})[_0x6783('0x22')](handleEntityNotFound(_0x408e55,null))[_0x6783('0x22')](function(_0x297f98){if(_0x297f98){_0x30b19a=_0x297f98;return respondWithRpcPromise(_0x6783('0x100'),_0x6783('0x101'),{'id':_0x30b19a['id'],'name':_0x30b19a[_0x6783('0x3e')],'pause':!![]});}})[_0x6783('0x22')](function(){if(_0x30b19a){return db[_0x6783('0xfa')][_0x6783('0x53')]({'where':{'membername':_0x30b19a[_0x6783('0x3e')],'type':_0x6783('0x102'),'exitAt':null}});}})[_0x6783('0x22')](function(_0x246f50){if(_0x246f50[_0x6783('0x75')]){var _0x5a2855=moment()[_0x6783('0xc6')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1c5290=0x0,_0x2546fa=_0x246f50[_0x6783('0x75')];_0x1c5290<_0x2546fa;_0x1c5290++){_0x246f50[_0x1c5290][_0x6783('0x103')]({'exitAt':_0x5a2855});}}})[_0x6783('0x22')](function(){var _0x2ca89=[];var _0x28cbe2=utils[_0x6783('0xfc')]();_0x28cbe2[_0x6783('0xfd')](function(_0x19f8a2){_0x2ca89[_0x6783('0x52')]({'channel':_0x19f8a2,'membername':_0x30b19a[_0x6783('0x3e')],'interface':_[_0x6783('0x6f')](_0x30b19a[_0x6783('0xaa')])?util[_0x6783('0xc6')](_0x6783('0xab'),_0x30b19a[_0x6783('0x3e')]):_0x30b19a[_0x6783('0xaa')],'type':_0x6783('0x102'),'enterAt':moment()[_0x6783('0xc6')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x1229aa[_0x6783('0x63')]['type']||_0x6783('0x104'),'role':_0x30b19a[_0x6783('0x2d')],'internal':_0x30b19a['internal']});});return db[_0x6783('0xfa')][_0x6783('0x8c')](_0x2ca89,{'individualHooks':!![]});})[_0x6783('0x22')](function(){return _0x30b19a['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1229aa[_0x6783('0x63')][_0x6783('0x105')]||_0x6783('0x104'),'lastPauseAt':moment()[_0x6783('0xc6')](_0x6783('0xfb'))});})[_0x6783('0x22')](respondWithResult(_0x408e55,null))[_0x6783('0x2b')](handleError(_0x408e55,null));};exports[_0x6783('0x106')]=function(_0x259b6d,_0x43f175){if(_0x259b6d[_0x6783('0x63')][_0x6783('0x9f')]&&!utils[_0x6783('0xa1')](_0x259b6d['body']['channel'])){throw new APIBadRequestError(util[_0x6783('0xc6')](_0x6783('0x107'),_0x259b6d['body'][_0x6783('0x9f')]));}return db[_0x6783('0x3f')]['find']({'where':{'id':_0x259b6d['params']['id']},'attributes':['id',_0x6783('0x3e'),_0x6783('0x2d'),_0x6783('0x68'),_0x6783('0xaa'),'online',_0x6783('0xa0'),'mailPause','chatPause',_0x6783('0x108'),_0x6783('0x109'),_0x6783('0x10a'),'whatsappPause',_0x6783('0x10b'),_0x6783('0x10c')]})[_0x6783('0x22')](function(_0x165103){if(!_0x165103){throw new APINotFoundError(util['format'](_0x6783('0xc7'),_0x259b6d['params']['id']));}return _0x165103['unpause'](_0x259b6d['body'][_0x6783('0x9f')]);})[_0x6783('0x22')](respondWithResult(_0x43f175,null))[_0x6783('0x2b')](APIHandleError(_0x43f175));};exports[_0x6783('0x10d')]=function(_0x26d719,_0x34226a){var _0x1ecfb8={};var _0x468b72={};var _0x43f748;var _0x592bca;return db[_0x6783('0x3f')][_0x6783('0xc5')]({'where':{'id':_0x26d719[_0x6783('0x5c')]['id']}})['then'](handleEntityNotFound(_0x34226a,null))['then'](function(_0x5026d5){if(_0x5026d5){_0x43f748=_0x5026d5;_0x468b72[_0x6783('0xd0')]=_[_0x6783('0xd1')](db[_0x6783('0x10e')][_0x6783('0x40')]);_0x468b72[_0x6783('0x4c')]=_[_0x6783('0xd1')](_0x26d719['query']);_0x468b72[_0x6783('0xd6')]=_[_0x6783('0xd2')](_0x468b72[_0x6783('0xd0')],_0x468b72[_0x6783('0x4c')]);_0x1ecfb8[_0x6783('0x5f')]=_[_0x6783('0xd2')](_0x468b72[_0x6783('0xd0')],qs[_0x6783('0xd3')](_0x26d719[_0x6783('0x4c')][_0x6783('0xd3')]));_0x1ecfb8['attributes']=_0x1ecfb8[_0x6783('0x5f')][_0x6783('0x75')]?_0x1ecfb8['attributes']:_0x468b72[_0x6783('0xd0')];_0x1ecfb8[_0x6783('0xd4')]=qs[_0x6783('0xd5')](_0x26d719[_0x6783('0x4c')]['sort']);_0x1ecfb8['where']=qs[_0x6783('0xd6')](_['pick'](_0x26d719[_0x6783('0x4c')],_0x468b72[_0x6783('0xd6')]));if(_0x26d719[_0x6783('0x4c')][_0x6783('0x43')]){_0x1ecfb8[_0x6783('0x4b')]=_[_0x6783('0x5d')](_0x1ecfb8[_0x6783('0x4b')],{'$or':_['map'](_0x1ecfb8['attributes'],function(_0x2c761f){var _0x167457={};_0x167457[_0x2c761f]={'$like':'%'+_0x26d719[_0x6783('0x4c')][_0x6783('0x43')]+'%'};return _0x167457;})});}_0x1ecfb8=_['merge']({},_0x1ecfb8,_0x26d719['options']);return _0x43f748[_0x6783('0x10d')](_0x1ecfb8);}})[_0x6783('0x22')](function(_0x3abae8){if(_0x3abae8){_0x592bca=_0x3abae8['length'];if(!_0x26d719[_0x6783('0x4c')]['hasOwnProperty']('nolimit')){_0x1ecfb8[_0x6783('0x1c')]=qs[_0x6783('0x1c')](_0x26d719[_0x6783('0x4c')][_0x6783('0x1c')]);_0x1ecfb8[_0x6783('0x1b')]=qs['offset'](_0x26d719[_0x6783('0x4c')][_0x6783('0x1b')]);}return _0x43f748[_0x6783('0x10d')](_0x1ecfb8);}})['then'](function(_0x8cec75){if(_0x8cec75){return _0x8cec75?{'count':_0x592bca,'rows':_0x8cec75}:null;}})[_0x6783('0x22')](respondWithResult(_0x34226a,null))['catch'](handleError(_0x34226a,null));};exports['addTeams']=function(_0x56e593,_0x2b6a3f){var _0x3ad49c=_0x56e593[_0x6783('0x5c')]['id'];var _0x46f46e=_0x56e593['body']?_0x56e593[_0x6783('0x63')][_0x6783('0x66')]:null;var _0x392379=[];return Promise['resolve']()[_0x6783('0x22')](function(){if(!_0x46f46e)throw new APIBadRequestError(_0x6783('0x10f'));})[_0x6783('0x22')](function(){return db[_0x6783('0x3f')][_0x6783('0xc5')]({'where':{'id':_0x3ad49c}});})['then'](function(_0x4c8417){if(!_0x4c8417)throw new APINotFoundError(util[_0x6783('0xc6')](_0x6783('0xc7'),_0x56e593[_0x6783('0x5c')]['id']));return db[_0x6783('0x71')][_0x6783('0x110')](function(_0x515bad){return _0x4c8417[_0x6783('0x111')](_0x46f46e,{'transaction':_0x515bad})[_0x6783('0x22')](function(){return db[_0x6783('0x10e')][_0x6783('0x53')]({'where':{'id':{'$in':_0x46f46e}}});})['then'](function(_0x75eb50){var _0x17627d=_[_0x6783('0x39')](_0x75eb50,function(_0x55f018){return _0x55f018[_0x6783('0x112')]();});return Promise[_0x6783('0x5a')](_0x17627d);})[_0x6783('0x22')](function(_0x1fe1c0){_0x392379=_['flattenDeep'](_0x1fe1c0);var _0x2af934=_[_0x6783('0x39')](_0x392379,function(_0x58f56e){return _0x58f56e[_0x6783('0x113')](_0x4c8417['id'],{'transaction':_0x515bad});});return Promise[_0x6783('0x5a')](_0x2af934);})[_0x6783('0x22')](function(){if(!_0x4c8417[_0x6783('0xa9')])return;var _0x371d47=_['filter'](_0x392379,function(_0x558faa){return _0x558faa[_0x6783('0x114')](_0x6783('0x9f'))===_0x6783('0x115');});var _0x5da11e=_[_0x6783('0x39')](_0x371d47,function(_0x1397a3){return db[_0x6783('0xad')]['upsert']({'membername':_0x4c8417['name'],'UserId':_0x4c8417['id'],'queue_name':_0x1397a3['name'],'VoiceQueueId':_0x1397a3['id'],'interface':_['isNil'](_0x4c8417[_0x6783('0xaa')])?util[_0x6783('0xc6')](_0x6783('0xab'),_0x4c8417[_0x6783('0x3e')]):_0x4c8417[_0x6783('0xaa')],'paused':_0x4c8417[_0x6783('0xa0')]||![],'penalty':_0x4c8417[_0x6783('0xac')]},{'transaction':_0x515bad});});return Promise[_0x6783('0x5a')](_0x5da11e);})[_0x6783('0x22')](function(){return db['TeamVoicePrefix'][_0x6783('0x53')]({'where':{'teamId':{'$in':_0x46f46e}}});})[_0x6783('0x22')](function(_0x4f5bea){var _0x313bca=_['map'](_0x4f5bea,function(_0x2bcf0c){return db[_0x6783('0x116')][_0x6783('0x89')]({'UserId':_0x4c8417['id'],'VoicePrefixId':_0x2bcf0c[_0x6783('0x117')]},{'transaction':_0x515bad});});return Promise[_0x6783('0x5a')](_0x313bca);});});})['then'](function(){for(var _0x128bdd=0x0;_0x128bdd<_0x392379[_0x6783('0x75')];_0x128bdd++){var _0x1f6f84=_0x392379[_0x128bdd][_0x6783('0x114')]('channel');var _0x5b80ac=_0x1f6f84+_0x6783('0xb1');socket['emit']('user'+_0x1f6f84+'Queue:save',{'UserId':_0x3ad49c,['queueField']:_0x392379[_0x128bdd]['id']});}})['then'](respondWithStatusCode(_0x2b6a3f,null))[_0x6783('0x2b')](APIHandleError(_0x2b6a3f));};exports[_0x6783('0x118')]=function(_0x55f547,_0x38f96c){var _0x54c28f=_0x55f547[_0x6783('0x5c')]['id'];var _0x276621=null;if(_0x55f547[_0x6783('0x4c')][_0x6783('0x66')]){_0x276621=_[_0x6783('0xb0')](_0x55f547[_0x6783('0x4c')]['ids'])?_0x55f547['query'][_0x6783('0x66')]:[_0x55f547['query'][_0x6783('0x66')]];}var _0x4355f0=[];return Promise[_0x6783('0xff')]()[_0x6783('0x22')](function(){if(!_0x276621)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x6783('0x22')](function(){return db[_0x6783('0x3f')][_0x6783('0xc5')]({'where':{'id':_0x54c28f}});})[_0x6783('0x22')](function(_0x2eae4b){if(!_0x2eae4b)throw new APINotFoundError(util[_0x6783('0xc6')](_0x6783('0xc7'),_0x55f547[_0x6783('0x5c')]['id']));return db['sequelize'][_0x6783('0x110')](function(_0x1515f5){return _0x2eae4b[_0x6783('0x118')](_0x276621,{'transaction':_0x1515f5})[_0x6783('0x22')](function(){return db['Team'][_0x6783('0x53')]({'where':{'id':{'$in':_0x276621}}});})[_0x6783('0x22')](function(_0x4d08c1){var _0x421b72=_[_0x6783('0x39')](_0x4d08c1,function(_0x1ff739){return _0x1ff739[_0x6783('0x112')]();});return Promise['all'](_0x421b72);})['then'](function(_0x17ee5d){_0x4355f0=_[_0x6783('0x119')](_0x17ee5d);var _0x467ac3=_[_0x6783('0x39')](_0x4355f0,function(_0x28e8ba){return _0x28e8ba[_0x6783('0x11a')](_0x2eae4b['id'],{'transaction':_0x1515f5});});return Promise[_0x6783('0x5a')](_0x467ac3);})[_0x6783('0x22')](function(){if(!_0x2eae4b[_0x6783('0xa9')])return;var _0x169e46=_[_0x6783('0x43')](_0x4355f0,function(_0xd02aa5){return _0xd02aa5['getDataValue'](_0x6783('0x9f'))===_0x6783('0x115');});var _0x89aac1=_[_0x6783('0x39')](_0x169e46,function(_0x350cfc){return db['UserVoiceQueueRt'][_0x6783('0x30')]({'where':{'VoiceQueueId':_0x350cfc['id'],'UserId':_0x2eae4b['id']},'transaction':_0x1515f5});});return Promise[_0x6783('0x5a')](_0x89aac1);})['then'](function(){return db[_0x6783('0x11b')][_0x6783('0x53')]({'where':{'teamId':{'$in':_0x276621}}});})[_0x6783('0x22')](function(_0x46173d){var _0x3f3ea7=_[_0x6783('0x39')](_0x46173d,function(_0x189575){return db[_0x6783('0x116')][_0x6783('0x30')]({'where':{'UserId':_0x2eae4b['id'],'VoicePrefixId':_0x189575[_0x6783('0x117')]}},{'transaction':_0x1515f5});});return Promise[_0x6783('0x5a')](_0x3f3ea7);});});})[_0x6783('0x22')](function(){for(var _0x57d2fd=0x0;_0x57d2fd<_0x4355f0[_0x6783('0x75')];_0x57d2fd++){var _0xfda33a=_0x4355f0[_0x57d2fd][_0x6783('0x114')](_0x6783('0x9f'));var _0x2242cc=_0xfda33a+_0x6783('0xb1');socket[_0x6783('0xa7')]('user'+_0xfda33a+_0x6783('0xb2'),{'UserId':_0x54c28f,['queueField']:_0x4355f0[_0x57d2fd]['id']});}})[_0x6783('0x22')](respondWithStatusCode(_0x38f96c,null))['catch'](APIHandleError(_0x38f96c));};exports[_0x6783('0x11c')]=function(_0x1a7db6,_0x51f3da){var _0x4a5316={};var _0x179233={};var _0x4c5f15;var _0x287c60;return db[_0x6783('0x3f')][_0x6783('0xc5')]({'where':{'id':_0x1a7db6[_0x6783('0x5c')]['id']}})[_0x6783('0x22')](handleEntityNotFound(_0x51f3da,null))[_0x6783('0x22')](function(_0x952b76){if(_0x952b76){_0x4c5f15=_0x952b76;_0x179233[_0x6783('0xd0')]=_[_0x6783('0xd1')](db['CmList'][_0x6783('0x40')]);_0x179233[_0x6783('0x4c')]=_['keys'](_0x1a7db6[_0x6783('0x4c')]);_0x179233[_0x6783('0xd6')]=_[_0x6783('0xd2')](_0x179233[_0x6783('0xd0')],_0x179233[_0x6783('0x4c')]);_0x4a5316['attributes']=_[_0x6783('0xd2')](_0x179233[_0x6783('0xd0')],qs[_0x6783('0xd3')](_0x1a7db6['query'][_0x6783('0xd3')]));_0x4a5316[_0x6783('0x5f')]=_0x4a5316[_0x6783('0x5f')][_0x6783('0x75')]?_0x4a5316[_0x6783('0x5f')]:_0x179233[_0x6783('0xd0')];_0x4a5316['order']=qs[_0x6783('0xd5')](_0x1a7db6['query'][_0x6783('0xd5')]);_0x4a5316[_0x6783('0x4b')]=qs[_0x6783('0xd6')](_[_0x6783('0xdf')](_0x1a7db6[_0x6783('0x4c')],_0x179233[_0x6783('0xd6')]));if(_0x1a7db6[_0x6783('0x4c')][_0x6783('0x43')]){_0x4a5316[_0x6783('0x4b')]=_[_0x6783('0x5d')](_0x4a5316['where'],{'$or':_[_0x6783('0x39')](_0x4a5316[_0x6783('0x5f')],function(_0x22fcf4){var _0x1ad136={};_0x1ad136[_0x22fcf4]={'$like':'%'+_0x1a7db6[_0x6783('0x4c')][_0x6783('0x43')]+'%'};return _0x1ad136;})});}_0x4a5316=_[_0x6783('0x5d')]({},_0x4a5316,_0x1a7db6['options']);return _0x4c5f15[_0x6783('0x11c')](_0x4a5316);}})[_0x6783('0x22')](function(_0x52b619){if(_0x52b619){_0x287c60=_0x52b619[_0x6783('0x75')];if(!_0x1a7db6['query'][_0x6783('0xc8')](_0x6783('0xd9'))){_0x4a5316[_0x6783('0x1c')]=qs[_0x6783('0x1c')](_0x1a7db6[_0x6783('0x4c')][_0x6783('0x1c')]);_0x4a5316[_0x6783('0x1b')]=qs[_0x6783('0x1b')](_0x1a7db6[_0x6783('0x4c')][_0x6783('0x1b')]);}return _0x4c5f15['getLists'](_0x4a5316);}})['then'](function(_0x443eb8){if(_0x443eb8){return _0x443eb8?{'count':_0x287c60,'rows':_0x443eb8}:null;}})[_0x6783('0x22')](respondWithResult(_0x51f3da,null))[_0x6783('0x2b')](handleError(_0x51f3da,null));};exports['getAgents']=function(_0x4df1dc,_0x1d8a28){var _0x568260={};var _0x22e555={};var _0x27a45e;return db['User'][_0x6783('0xc5')]({'where':{'id':_0x4df1dc['params']['id']}})[_0x6783('0x22')](handleEntityNotFound(_0x1d8a28,null))[_0x6783('0x22')](function(_0xa87711){if(_0xa87711){_0x27a45e=_0xa87711;_0x22e555['model']=_[_0x6783('0xd1')](db['User'][_0x6783('0x40')]);_0x22e555[_0x6783('0x4c')]=_[_0x6783('0xd1')](_0x4df1dc['query']);_0x22e555[_0x6783('0xd6')]=_[_0x6783('0xd2')](_0x22e555[_0x6783('0xd0')],_0x22e555['query']);_0x568260[_0x6783('0x5f')]=_[_0x6783('0xd2')](_0x22e555[_0x6783('0xd0')],qs[_0x6783('0xd3')](_0x4df1dc[_0x6783('0x4c')][_0x6783('0xd3')]));_0x568260[_0x6783('0x5f')]=_0x568260['attributes'][_0x6783('0x75')]?_0x568260[_0x6783('0x5f')]:_0x22e555[_0x6783('0xd0')];_0x568260[_0x6783('0xd4')]=qs[_0x6783('0xd5')](_0x4df1dc[_0x6783('0x4c')][_0x6783('0xd5')]);_0x568260[_0x6783('0x4b')]=qs[_0x6783('0xd6')](_[_0x6783('0xdf')](_0x4df1dc[_0x6783('0x4c')],_0x22e555[_0x6783('0xd6')]));if(_0x4df1dc[_0x6783('0x4c')]['filter']){_0x568260[_0x6783('0x4b')]=_['merge'](_0x568260['where'],{'$or':_['map'](_0x568260[_0x6783('0x5f')],function(_0xb6b423){var _0x4af914={};_0x4af914[_0xb6b423]={'$like':'%'+_0x4df1dc['query']['filter']+'%'};return _0x4af914;})});}_0x568260[_0x6783('0xd0')]=db[_0x6783('0x3f')];_0x568260['as']=_0x6783('0x35');_0x568260=_[_0x6783('0x5d')]({},_0x568260,_0x4df1dc[_0x6783('0x5e')]);return _0x27a45e['getVoiceQueues']({'include':[_0x568260]});}})[_0x6783('0x22')](function(_0x6fe4e3){if(_0x6fe4e3){var _0x13f2e7={},_0x137c78=[];for(var _0x30a7cd=0x0;_0x30a7cd<_0x6fe4e3[_0x6783('0x75')];_0x30a7cd+=0x1){for(var _0xbd45b2=0x0,_0x3edadb;_0xbd45b2<_0x6fe4e3[_0x30a7cd][_0x6783('0x35')]['length'];_0xbd45b2+=0x1){_0x3edadb=_0x6fe4e3[_0x30a7cd]['Agents'][_0xbd45b2][_0x6783('0x31')]({'plain':!![]});_0x13f2e7[_0x3edadb['id']]=_0x3edadb;}}_0x13f2e7=_[_0x6783('0x11d')](_0x13f2e7);for(var _0x5a4967=qs[_0x6783('0x1b')](_0x4df1dc[_0x6783('0x4c')][_0x6783('0x1b')]);_0x5a4967<_0x13f2e7[_0x6783('0x75')]&&_0x137c78[_0x6783('0x75')]=_0x4c2f46){_0x1d5b7b=_0x4c2f46;_0x4c1918=0xc8;}else{_0x4c1918=0xce;}_0x4ea993[_0x58ba('0x15')](_0x4c1918);return _0x4ea993[_0x58ba('0x1c')](_0x58ba('0x1d'),_0x2d73e3+'-'+_0x1d5b7b+'/'+_0x4c2f46)[_0x58ba('0x17')](_0x49187a);}return null;};}function respondWithRpcPromise(_0x123beb,_0x3e8c58,_0x248b07,_0x39484a){return new Promise(function(_0x2f26eb,_0x1a3959){var _0x40a30d=_0x39484a||amiClient;return _0x40a30d[_0x58ba('0x1e')](_0x123beb,_0x248b07)[_0x58ba('0x1f')](function(_0x3e5db6){logger['info'](_0x58ba('0x20'),_0x3e8c58,_0x58ba('0x21'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x3e8c58,_0x58ba('0x21'),JSON['stringify'](_0x3e5db6));if(_0x3e5db6[_0x58ba('0x22')]){if(_0x3e5db6[_0x58ba('0x22')]['code']===0x1f4){logger[_0x58ba('0x22')](_0x58ba('0x20'),_0x3e8c58,_0x3e5db6[_0x58ba('0x22')][_0x58ba('0x23')]);return _0x1a3959(_0x3e5db6[_0x58ba('0x22')][_0x58ba('0x23')]);}logger['error'](_0x58ba('0x20'),_0x3e8c58,_0x3e5db6[_0x58ba('0x22')][_0x58ba('0x23')]);return _0x2f26eb(_0x3e5db6[_0x58ba('0x22')][_0x58ba('0x23')]);}else{logger[_0x58ba('0x24')](_0x58ba('0x20'),_0x3e8c58,'request\x20sent');_0x2f26eb(_0x3e5db6[_0x58ba('0x25')][_0x58ba('0x23')]);}})[_0x58ba('0x26')](function(_0xe47cfd){logger[_0x58ba('0x22')](_0x58ba('0x20'),_0x3e8c58,_0xe47cfd);_0x1a3959(_0xe47cfd);});});}function saveUpdates(_0x3bb754){return function(_0x1e4703){if(_0x1e4703){return _0x1e4703[_0x58ba('0x27')](_0x3bb754)[_0x58ba('0x1f')](function(_0x3bd348){if(_0x3bd348[_0x58ba('0x28')]===_0x58ba('0x29')){socket['emit'](_0x58ba('0x2a')+_0x3bd348['id'],_0x3bd348);}return _0x3bd348;});}return null;};}function removeEntity(_0x577dc,_0x248bd7){return function(_0x5f3aa8){if(_0x5f3aa8){return _0x5f3aa8['destroy']({'transaction':_0x248bd7})[_0x58ba('0x1f')](function(){var _0xe22cfe=_0x5f3aa8[_0x58ba('0x2b')]({'plain':!![]});if(_0xe22cfe[_0x58ba('0x28')]===_0x58ba('0x2c'))return;var _0x2c3963=[{'name':_0x58ba('0x2d'),'value':_0x58ba('0x2e'),'ignore':!![]},{'name':_0x58ba('0x2f'),'value':_0x58ba('0x29'),'ignore':![]},{'name':_0x58ba('0x30'),'value':_0x58ba('0x31'),'ignore':![]}];var _0x2a69e9=_(_0x2c3963)['filter'](_0x58ba('0x32'))[_0x58ba('0x33')]('value')[_0x58ba('0x34')]();if(_[_0x58ba('0x35')](_0x2a69e9,_0xe22cfe[_0x58ba('0x28')])){return;}var _0x1123f6=_[_0x58ba('0x36')](_0x2c3963,[_0x58ba('0x34'),_0xe22cfe[_0x58ba('0x28')]])['name'];return db[_0x58ba('0x37')][_0x58ba('0x38')]({'where':{'type':_0x1123f6,'resourceId':_0xe22cfe['id']},'transaction':_0x248bd7})[_0x58ba('0x1f')](function(){return _0x5f3aa8;});})[_0x58ba('0x1f')](function(){_0x577dc['status'](0xcc)[_0x58ba('0x16')]();});}};}function handleEntityNotFound(_0x519814){return function(_0x4d9e44){if(!_0x4d9e44){_0x519814['sendStatus'](0x194);}return _0x4d9e44;};}function handleError(_0x3e724c,_0x23d4f9){_0x23d4f9=_0x23d4f9||0x1f4;return function(_0x590edd){logger[_0x58ba('0x22')](_0x590edd[_0x58ba('0x39')]);if(_0x590edd[_0x58ba('0x3a')]){delete _0x590edd[_0x58ba('0x3a')];}_0x3e724c[_0x58ba('0x15')](_0x23d4f9)['send'](_0x590edd);};}function getUserAttributes(){return _(db[_0x58ba('0x3b')][_0x58ba('0x3c')])[_0x58ba('0x33')](function(_0x463477){return{'name':_0x463477['fieldName'],'type':_0x463477[_0x58ba('0x3d')][_0x58ba('0x3e')]};})['filter'](function(_0xb9edf4){return![_0x58ba('0x3f'),_0x58ba('0x40'),_0x58ba('0x41'),_0x58ba('0x42'),_0x58ba('0x43'),_0x58ba('0x44')][_0x58ba('0x35')](_0xb9edf4[_0x58ba('0x3a')]);})[_0x58ba('0x34')]();}exports[_0x58ba('0x45')]=function(_0x37ac29,_0x2fd308){var _0x5224dd={},_0x5ec564={'count':0x0,'rows':[]};var _0x2b12e2=getUserAttributes();_0x5224dd=qs['getOptions'](_0x2b12e2,_0x37ac29);var _0x18e954={'where':_0x5224dd[_0x58ba('0x46')]};return db['User'][_0x58ba('0x1b')](_0x18e954)[_0x58ba('0x1f')](function(_0x2affe5){_0x5ec564[_0x58ba('0x1b')]=_0x2affe5;if(_0x37ac29[_0x58ba('0x47')][_0x58ba('0x48')]){_0x5224dd[_0x58ba('0x49')]=[{'all':!![]}];}if(_0x37ac29[_0x58ba('0x47')][_0x58ba('0x4a')]===_0x58ba('0x4b')){_0x5224dd[_0x58ba('0x49')]=[{'model':db[_0x58ba('0x4c')],'as':_0x58ba('0x4a')}];}if(!_[_0x58ba('0x35')](_0x5224dd[_0x58ba('0x4d')],'id')){_0x5224dd['attributes']['push']('id');}return db['User'][_0x58ba('0x4e')](_0x5224dd);})[_0x58ba('0x1f')](function(_0x2c7efa){_0x5ec564[_0x58ba('0x4f')]=_0x2c7efa;if(_0x37ac29[_0x58ba('0x47')][_0x58ba('0x50')]==='true'){var _0x30438c=[];for(var _0x577096=0x0;_0x577096<_0x5ec564[_0x58ba('0x4f')][_0x58ba('0x51')];_0x577096++){_0x30438c[_0x58ba('0x52')](get_open_tabs(_0x58ba('0x53'),_0x5ec564[_0x58ba('0x4f')][_0x577096][_0x58ba('0x54')]));_0x30438c[_0x58ba('0x52')](get_open_tabs(_0x58ba('0x55'),_0x5ec564[_0x58ba('0x4f')][_0x577096][_0x58ba('0x54')]));_0x30438c[_0x58ba('0x52')](get_open_tabs(_0x58ba('0x56'),_0x5ec564[_0x58ba('0x4f')][_0x577096]['dataValues']));_0x30438c['push'](get_open_tabs(_0x58ba('0x57'),_0x5ec564[_0x58ba('0x4f')][_0x577096][_0x58ba('0x54')]));_0x30438c[_0x58ba('0x52')](get_open_tabs(_0x58ba('0x58'),_0x5ec564['rows'][_0x577096][_0x58ba('0x54')]));_0x30438c['push'](get_open_tabs('whatsapp',_0x5ec564['rows'][_0x577096][_0x58ba('0x54')]));}return Promise[_0x58ba('0x59')](_0x30438c)[_0x58ba('0x1f')](function(){return _0x5ec564;});}else{return _0x5ec564;}})[_0x58ba('0x1f')](respondWithFilteredResult(_0x2fd308,_0x5224dd))[_0x58ba('0x26')](handleError(_0x2fd308,null));};exports[_0x58ba('0x5a')]=function(_0x22257e,_0x6219d3){var _0x47f55f=getUserAttributes();_0x22257e[_0x58ba('0x47')]['id']=_0x22257e[_0x58ba('0x5b')]['id'];var _0x546ac3=qs[_0x58ba('0x5c')](_0x47f55f,_0x22257e);if(_0x22257e[_0x58ba('0x47')][_0x58ba('0x48')]){_0x546ac3[_0x58ba('0x49')]=[{'all':!![]}];}if(_0x22257e[_0x58ba('0x47')][_0x58ba('0x4a')]===_0x58ba('0x4b')){_0x546ac3[_0x58ba('0x49')]=[{'model':db['UserSetting'],'as':_0x58ba('0x4a')}];}_0x546ac3=_[_0x58ba('0x5d')]({},_0x546ac3,_0x22257e[_0x58ba('0x5e')]);if(!_[_0x58ba('0x35')](_0x546ac3[_0x58ba('0x4d')],'id')){_0x546ac3['attributes'][_0x58ba('0x52')]('id');}return db[_0x58ba('0x3b')][_0x58ba('0x36')](_0x546ac3)[_0x58ba('0x1f')](handleEntityNotFound(_0x6219d3,null))[_0x58ba('0x1f')](function(_0x4cd1b5){var _0x5babd0=[];values=_0x4cd1b5;if(_0x22257e[_0x58ba('0x47')][_0x58ba('0x50')]===_0x58ba('0x4b')){_0x5babd0[_0x58ba('0x52')](get_open_tabs(_0x58ba('0x53'),_0x4cd1b5['dataValues']));_0x5babd0[_0x58ba('0x52')](get_open_tabs(_0x58ba('0x55'),_0x4cd1b5[_0x58ba('0x54')]));_0x5babd0['push'](get_open_tabs('openchannel',_0x4cd1b5['dataValues']));_0x5babd0[_0x58ba('0x52')](get_open_tabs(_0x58ba('0x5f'),_0x4cd1b5[_0x58ba('0x54')]));_0x5babd0['push'](get_open_tabs(_0x58ba('0x56'),_0x4cd1b5[_0x58ba('0x54')]));_0x5babd0[_0x58ba('0x52')](get_open_tabs(_0x58ba('0x57'),_0x4cd1b5['dataValues']));return Promise[_0x58ba('0x59')](_0x5babd0);}else{return values;}})[_0x58ba('0x1f')](function(){return values;})['then'](respondWithResult(_0x6219d3,null))[_0x58ba('0x26')](handleError(_0x6219d3,null));};exports[_0x58ba('0x27')]=function(_0x3c4a74,_0xc9e6f){if(_0x3c4a74['body']['id']){delete _0x3c4a74['body']['id'];}delete _0x3c4a74[_0x58ba('0x60')][_0x58ba('0x28')];return db[_0x58ba('0x3b')][_0x58ba('0x36')]({'where':{'id':_0x3c4a74['params']['id']}})[_0x58ba('0x1f')](handleEntityNotFound(_0xc9e6f,null))[_0x58ba('0x1f')](saveUpdates(_0x3c4a74['body'],null))[_0x58ba('0x1f')](respondWithResult(_0xc9e6f,null))['catch'](handleError(_0xc9e6f,null));};exports[_0x58ba('0x61')]=function(_0x479448,_0x397db8){return db['User'][_0x58ba('0x61')]()[_0x58ba('0x1f')](respondWithResult(_0x397db8,null))[_0x58ba('0x26')](handleError(_0x397db8,null));};exports[_0x58ba('0x62')]=function(_0x1aaecc,_0x58702e){return db[_0x58ba('0x3b')][_0x58ba('0x36')]({'where':{'id':_0x1aaecc[_0x58ba('0x5b')]['id']}})['then'](handleEntityNotFound(_0x58702e,null))[_0x58ba('0x1f')](function(_0x6a627a){if(_0x6a627a){return _0x6a627a[_0x58ba('0x62')](_0x1aaecc[_0x58ba('0x60')][_0x58ba('0x63')],_['omit'](_0x1aaecc['body'],[_0x58ba('0x63'),'id'])||{});}})[_0x58ba('0x1f')](respondWithResult(_0x58702e,null))[_0x58ba('0x26')](handleError(_0x58702e,null));};function validateUser(_0x48df62){return new Promise(function(_0x5a767e,_0x4c4074){if(_0x48df62[_0x58ba('0x64')])return _0x5a767e(_0x48df62);return db[_0x58ba('0x65')]['findById'](0x1)['then'](function(_0x4b95d2){if(_0x4b95d2['securePassword'])authService[_0x58ba('0x66')](_0x48df62[_0x58ba('0x3f')]);db[_0x58ba('0x3b')]['max']('internal')['then'](function(_0xa46226){if(_[_0x58ba('0x67')](_0xa46226)){_0x48df62[_0x58ba('0x64')]=_0x4b95d2[_0x58ba('0x68')]||0x1;return;}if(_['isNil'](_0x4b95d2['min_internal'])||_0x4b95d2[_0x58ba('0x68')]===_0xa46226){_0x48df62[_0x58ba('0x64')]=_0xa46226+0x1;return;}if(_0x4b95d2[_0x58ba('0x68')]>_0xa46226){_0x48df62[_0x58ba('0x64')]=_0x4b95d2[_0x58ba('0x68')];return;}return db[_0x58ba('0x69')][_0x58ba('0x47')](_0x58ba('0x6a'),{'type':db['sequelize']['QueryTypes'][_0x58ba('0x6b')]})[_0x58ba('0x1f')](function(_0x48028c){if(_0x48028c&&_0x48028c['length']){for(var _0x51b3d7=0x0,_0xc41c95=_0x48028c[_0x58ba('0x51')];_0x51b3d7<_0xc41c95&&_[_0x58ba('0x67')](_0x48df62['internal']);_0x51b3d7++){if(_0x4b95d2[_0x58ba('0x68')]<=_0x48028c[_0x51b3d7][_0x58ba('0x6c')]){_0x48df62[_0x58ba('0x64')]=_0x48028c[_0x51b3d7][_0x58ba('0x6c')];}else if(_0x4b95d2['min_internal']>_0x48028c[_0x51b3d7]['from']&&_0x4b95d2[_0x58ba('0x68')]<=_0x48028c[_0x51b3d7]['to']){_0x48df62['internal']=_0x4b95d2[_0x58ba('0x68')];}}}if(_[_0x58ba('0x67')](_0x48df62[_0x58ba('0x64')])){_0x48df62[_0x58ba('0x64')]=_0xa46226+0x1;}return _0x5a767e(_0x48df62);});});})['catch'](function(_0x19b104){_0x4c4074(_0x19b104);});});}function updateUser(_0x10a7eb){return new Promise(function(_0x7d15e0,_0x66ead5){try{if(_0x10a7eb[_0x58ba('0x6d')]){_0x10a7eb[_0x58ba('0x6e')]=_0x10a7eb[_0x58ba('0x64')];_0x10a7eb['VoiceMail']={'mailbox':_0x10a7eb[_0x58ba('0x64')],'password':_0x10a7eb[_0x58ba('0x3f')],'fullname':_0x10a7eb[_0x58ba('0x6f')],'email':_0x10a7eb[_0x58ba('0x70')]};}if(_0x10a7eb[_0x58ba('0x28')]===_0x58ba('0x29')){if(!_0x10a7eb['permissions'])_0x10a7eb[_0x58ba('0x71')]=[_0x58ba('0x72'),_0x58ba('0x73'),_0x58ba('0x74'),'113',_0x58ba('0x75'),_0x58ba('0x76'),_0x58ba('0x77'),'106',_0x58ba('0x78'),_0x58ba('0x79'),_0x58ba('0x7a'),_0x58ba('0x7b'),_0x58ba('0x7c'),_0x58ba('0x7d'),_0x58ba('0x7e')];}_0x7d15e0(_0x10a7eb);}catch(_0x37d769){_0x66ead5(_0x37d769);}});}exports[_0x58ba('0x7f')]=function(_0xd0c516,_0x32cea6){if(_0xd0c516[_0x58ba('0x2e')][_0x58ba('0x28')]===_0x58ba('0x29'))throw new Error(_0x58ba('0x80'));if(_0xd0c516[_0x58ba('0x60')]['role']===_0x58ba('0x2e')&&_0xd0c516[_0x58ba('0x2e')][_0x58ba('0x28')]!=='admin'){throw new Error(_0x58ba('0x81'));}if(_0xd0c516[_0x58ba('0x60')]['role']==='admin'&&_0xd0c516[_0x58ba('0x2e')][_0x58ba('0x28')]!==_0x58ba('0x2c')){throw new Error(_0x58ba('0x82'));}return licenseUtil[_0x58ba('0x83')]([_0xd0c516['body']])[_0x58ba('0x1f')](function(){return validateUser(_0xd0c516[_0x58ba('0x60')]);})['then'](function(_0x3eed44){return updateUser(_0x3eed44)[_0x58ba('0x1f')](function(_0x5d5114){if(_0x5d5114[_0x58ba('0x28')]===_0x58ba('0x2c')){_0x5d5114[_0x58ba('0x84')]=_0xd0c516[_0x58ba('0x2e')][_0x58ba('0x84')];delete _0x5d5114['userProfileId'];}return _0x5d5114;});})[_0x58ba('0x1f')](function(_0x4e1fd1){return db[_0x58ba('0x3b')][_0x58ba('0x7f')](_0x4e1fd1,{'include':[{'model':db[_0x58ba('0x85')],'as':_0x58ba('0x85')}]});})[_0x58ba('0x1f')](function(_0x2799b5){if(_0xd0c516[_0x58ba('0x60')]['role']===_0x58ba('0x2e'))return _0x2799b5;if(_0xd0c516[_0x58ba('0x2e')][_0x58ba('0x28')]!==_0x58ba('0x2e'))return _0x2799b5;return db['UserProfileSection']['find']({'where':{'name':_0x2799b5[_0x58ba('0x28')]===_0x58ba('0x29')?'Agents':'Telephones','userProfileId':_0xd0c516[_0x58ba('0x2e')][_0x58ba('0x86')]},'raw':!![]})[_0x58ba('0x1f')](function(_0x37d909){if(!_0x37d909||_0x37d909[_0x58ba('0x87')]!=0x0)return _0x2799b5;return db[_0x58ba('0x37')][_0x58ba('0x7f')]({'name':_0x2799b5[_0x58ba('0x3a')],'resourceId':_0x2799b5['id'],'type':_0x37d909[_0x58ba('0x3a')],'sectionId':_0x37d909['id']},{})[_0x58ba('0x1f')](function(){return _0x2799b5;});})[_0x58ba('0x26')](function(_0x4d99ee){logger[_0x58ba('0x22')](_0x58ba('0x88'),_0x4d99ee);throw _0x4d99ee;});})['then'](respondWithResult(_0x32cea6,0xc9))[_0x58ba('0x26')](handleError(_0x32cea6,null));};exports['bulkCreate']=function(_0x1bba21,_0x24ad1f){var _0x466993=_0x1bba21[_0x58ba('0x60')];var _0x3ed185=[];if(_0x1bba21[_0x58ba('0x2e')][_0x58ba('0x28')]===_0x58ba('0x29'))throw new Error(_0x58ba('0x80'));if(_[_0x58ba('0x89')](_0x466993,['role',_0x58ba('0x2e')])&&_0x1bba21[_0x58ba('0x2e')]['role']!=='admin'){throw new Error(_0x58ba('0x81'));}if(_[_0x58ba('0x89')](_0x466993,['role',_0x58ba('0x2c')])&&_0x1bba21['user'][_0x58ba('0x28')]!==_0x58ba('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x58ba('0x83')](_0x466993)[_0x58ba('0x1f')](function(){return validateUser(_0x466993[0x0]);})[_0x58ba('0x1f')](function(){for(var _0x11b021=0x1;_0x11b021<_0x466993['length'];_0x11b021++){var _0x48bdc7=_0x466993[_0x11b021-0x1][_0x58ba('0x64')];if(!_0x466993[_0x11b021][_0x58ba('0x64')])_0x466993[_0x11b021][_0x58ba('0x64')]=_0x48bdc7+0x1;_0x3ed185[_0x58ba('0x52')](validateUser(_0x466993[_0x11b021]));}return Promise[_0x58ba('0x59')](_0x3ed185);})[_0x58ba('0x1f')](function(){_0x3ed185=[];for(var _0x42921d=0x0;_0x42921d<_0x466993[_0x58ba('0x51')];_0x42921d++){_0x3ed185[_0x58ba('0x52')](updateUser(_0x466993[_0x42921d]));}return Promise[_0x58ba('0x59')](_0x3ed185);})[_0x58ba('0x1f')](function(){_0x3ed185=_0x466993[_0x58ba('0x33')](function(_0x3604cb){return db[_0x58ba('0x3b')][_0x58ba('0x7f')](_0x3604cb,{'include':[{'model':db[_0x58ba('0x85')],'as':_0x58ba('0x85')}]})[_0x58ba('0x1f')](function(_0x20e0cd){_0x3604cb['id']=_0x20e0cd['id'];return _0x3604cb;});});return Promise[_0x58ba('0x59')](_0x3ed185);})['then'](function(_0x319dfa){if(_0x1bba21['body']['role']==='user')return _0x319dfa;if(_0x1bba21[_0x58ba('0x2e')]['role']!==_0x58ba('0x2e'))return _0x319dfa;var _0x344986=_[_0x58ba('0x89')](_0x319dfa,function(_0x484817){return _0x484817[_0x58ba('0x28')]===_0x58ba('0x29')||_0x484817['role']==='telephone';});if(!_0x344986)return _0x319dfa;return db[_0x58ba('0x8a')][_0x58ba('0x4e')]({'where':{'name':{'$or':[_0x58ba('0x2f'),_0x58ba('0x30')]},'userProfileId':_0x1bba21[_0x58ba('0x2e')][_0x58ba('0x86')]},'raw':!![]})[_0x58ba('0x1f')](function(_0x257c6c){if(_[_0x58ba('0x8b')](_0x257c6c)||!_[_0x58ba('0x89')](_0x257c6c,[_0x58ba('0x87'),0x0]))return _0x319dfa;_0x3ed185=[];var _0x2eb0f7=_(_0x257c6c)['map'](function(_0x1c5c1e){if(_0x1c5c1e['autoAssociation']===0x1)return;return _0x1c5c1e[_0x58ba('0x3a')]==='Agents'?'agent':_0x58ba('0x31');})[_0x58ba('0x8c')]()['value']();for(var _0x2e2037=0x0;_0x2e2037<_0x319dfa[_0x58ba('0x51')];_0x2e2037++){if(!_[_0x58ba('0x35')](_0x2eb0f7,_0x319dfa[_0x2e2037]['role']))return;var _0x57cd41=_0x319dfa[_0x2e2037][_0x58ba('0x28')]===_0x58ba('0x29')?_0x58ba('0x2f'):'Telephones';_0x3ed185[_0x58ba('0x52')](db[_0x58ba('0x37')][_0x58ba('0x7f')]({'name':_0x319dfa[_0x2e2037][_0x58ba('0x3a')],'resourceId':_0x319dfa[_0x2e2037]['id'],'type':_0x57cd41,'sectionId':_[_0x58ba('0x36')](_0x257c6c,[_0x58ba('0x3a'),_0x57cd41])['id']},{}));}return Promise['all'](_0x3ed185);});})[_0x58ba('0x1f')](respondWithResult(_0x24ad1f,0xc9))['catch'](handleError(_0x24ad1f,null));};exports['changePassword']=function(_0x28a821,_0x14d1f4){if(_0x28a821[_0x58ba('0x60')]['id']){delete _0x28a821[_0x58ba('0x60')]['id'];}return db[_0x58ba('0x3b')][_0x58ba('0x36')]({'where':{'id':_0x28a821[_0x58ba('0x5b')]['id']}})[_0x58ba('0x1f')](function(_0x493c77){if(!_0x493c77)return null;if(_0x493c77['id']===_0x28a821['user']['id']){if(!_0x28a821['body'][_0x58ba('0x8d')]||!_0x28a821[_0x58ba('0x60')][_0x58ba('0x8e')]){throw new db[(_0x58ba('0x8f'))][(_0x58ba('0x90'))](_0x58ba('0x91'));}if(!_0x493c77[_0x58ba('0x92')](_0x28a821[_0x58ba('0x60')][_0x58ba('0x8d')])){throw new db[(_0x58ba('0x8f'))][(_0x58ba('0x90'))]('Wrong\x20credentials');}if(_0x28a821[_0x58ba('0x60')][_0x58ba('0x8d')]===_0x28a821[_0x58ba('0x60')][_0x58ba('0x8e')]){throw new db[(_0x58ba('0x8f'))][(_0x58ba('0x90'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x28a821[_0x58ba('0x2e')][_0x58ba('0x28')]===_0x58ba('0x2c')){if(!_0x28a821['body'][_0x58ba('0x8e')]){throw new db['Sequelize'][(_0x58ba('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x28a821[_0x58ba('0x2e')][_0x58ba('0x28')]==='user'){if(!_0x28a821['body']['newPassword']){throw new db['Sequelize'][(_0x58ba('0x90'))](_0x58ba('0x93'));}if(_0x493c77['role']!==_0x58ba('0x29')){throw new db['Sequelize'][(_0x58ba('0x90'))](_0x58ba('0x80'));}}else{throw new db[(_0x58ba('0x8f'))][(_0x58ba('0x90'))](_0x58ba('0x80'));}return _0x493c77;})[_0x58ba('0x1f')](handleEntityNotFound(_0x14d1f4,null))[_0x58ba('0x1f')](function(_0x2361d6){return db[_0x58ba('0x65')][_0x58ba('0x94')]({'attributes':['id',_0x58ba('0x95'),_0x58ba('0x96'),'passwordHistoryLimit']})[_0x58ba('0x1f')](function(_0x415e60){if(_0x415e60[_0x58ba('0x95')])authService[_0x58ba('0x66')](_0x28a821[_0x58ba('0x60')][_0x58ba('0x8e')]);if(!_0x415e60[_0x58ba('0x96')]||!_0x2361d6[_0x58ba('0x41')])return _0x2361d6;authService['validatePasswordHistory'](_0x28a821['body']['newPassword'],_0x2361d6[_0x58ba('0x41')],_0x415e60['passwordHistoryLimit']);return _0x2361d6;})['then'](saveUpdates({'password':_0x28a821['body'][_0x58ba('0x8e')],'passwordResetAt':_0x28a821[_0x58ba('0x2e')]['id']==_0x28a821[_0x58ba('0x5b')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x28a821['body']['newPassword'],_0x2361d6[_0x58ba('0x41')])},null));})[_0x58ba('0x1f')](respondWithResult(_0x14d1f4,null))[_0x58ba('0x26')](handleError(_0x14d1f4,null));};exports[_0x58ba('0x97')]=function(_0x14b740,_0x5cc8d0){var _0x5b231d=_0x14b740[_0x58ba('0x60')][_0x58ba('0x98')];return db['User']['find']({'where':{'id':_0x14b740['params']['id']},'attributes':['id',_0x58ba('0x3a'),_0x58ba('0x28'),'online',_0x58ba('0x99'),'voicePause','interface']})[_0x58ba('0x1f')](handleEntityNotFound(_0x5cc8d0,null))[_0x58ba('0x1f')](function(_0x3d46b8){if(_0x3d46b8){if(!utils[_0x58ba('0x9a')](_0x5b231d)){throw new db[(_0x58ba('0x8f'))][(_0x58ba('0x90'))](_0x58ba('0x9b'));}return _0x3d46b8[_0x58ba('0x9c')+_['capitalize'](_0x5b231d[_0x58ba('0x9d')]())+_0x58ba('0x9e')](_0x14b740[_0x58ba('0x60')][_0x58ba('0x63')],{'penalty':_0x14b740['body'][_0x58ba('0x9f')]||0x0})[_0x58ba('0xa0')](function(_0x13520c){for(var _0x5178ef=0x0;_0x5178ef<_0x14b740[_0x58ba('0x60')][_0x58ba('0x63')][_0x58ba('0x51')];_0x5178ef+=0x1){var _0x5336b1={'UserId':Number(_0x14b740[_0x58ba('0x5b')]['id'])};_0x5336b1[_[_0x58ba('0xa1')](_0x5b231d[_0x58ba('0x9d')]())+_0x58ba('0xa2')]=Number(_0x14b740['body'][_0x58ba('0x63')][_0x5178ef]);socket[_0x58ba('0xa3')](_0x58ba('0x2e')+_[_0x58ba('0xa1')](_0x5b231d[_0x58ba('0x9d')]())+_0x58ba('0xa4'),_0x5336b1);}return _0x13520c;})['then'](function(){if(_0x5b231d===_0x58ba('0xa5')){return db[_0x58ba('0xa6')]['findAll']({'where':{'id':_0x14b740[_0x58ba('0x60')]['ids']||[]},'raw':!![],'attributes':['id',_0x58ba('0x3a')]});}})['then'](function(_0x386e60){var _0x332c6a=_0x3d46b8[_0x58ba('0x2b')]({'plain':!![]});var _0x3753c2=[];if(_0x5b231d===_0x58ba('0xa5')&&_0x332c6a[_0x58ba('0x28')]==='agent'&&_0x332c6a[_0x58ba('0xa7')]){for(let _0x403830=0x0;_0x403830<_0x386e60[_0x58ba('0x51')];_0x403830+=0x1){_0x3753c2[_0x58ba('0x52')]({'membername':_0x332c6a[_0x58ba('0x3a')],'UserId':_0x332c6a['id'],'queue_name':_0x386e60[_0x403830][_0x58ba('0x3a')],'VoiceQueueId':_0x386e60[_0x403830]['id'],'interface':_['isNil'](_0x332c6a[_0x58ba('0xa8')])?util[_0x58ba('0xa9')]('SIP/%s',_0x332c6a[_0x58ba('0x3a')]):_0x332c6a[_0x58ba('0xa8')],'paused':_0x332c6a[_0x58ba('0xaa')]||![],'penalty':_0x14b740[_0x58ba('0x60')][_0x58ba('0x9f')]||0x0});}return Promise[_0x58ba('0x59')](_0x3753c2['map'](function(_0x411e13){return db['UserVoiceQueueRt'][_0x58ba('0xab')](_0x411e13);}));}return _0x3d46b8;});}})[_0x58ba('0x1f')](respondWithStatusCode(_0x5cc8d0,null))['catch'](handleError(_0x5cc8d0,null));};exports['removeQueues']=function(_0x3d70f3,_0x5f0d77){var _0x1e49eb,_0x4e5bc2;return db[_0x58ba('0x3b')][_0x58ba('0x36')]({'where':{'id':_0x3d70f3[_0x58ba('0x5b')]['id']},'attributes':['id',_0x58ba('0x3a'),_0x58ba('0x28')]})[_0x58ba('0x1f')](handleEntityNotFound(_0x5f0d77,null))[_0x58ba('0x1f')](function(_0x323edf){if(_0x323edf){_0x1e49eb=_0x323edf;if(!_0x3d70f3[_0x58ba('0x47')][_0x58ba('0x98')]||!utils[_0x58ba('0x9a')](_0x3d70f3[_0x58ba('0x47')]['channel'])){throw new db[(_0x58ba('0x8f'))][(_0x58ba('0x90'))](_0x58ba('0x9b'));}return _0x323edf[_0x58ba('0xac')+_[_0x58ba('0xa1')](_0x3d70f3[_0x58ba('0x47')][_0x58ba('0x98')][_0x58ba('0x9d')]())+_0x58ba('0x9e')](_0x3d70f3['query'][_0x58ba('0x63')]);}})[_0x58ba('0x1f')](function(_0x5d8852){if(_['isArray'](_0x3d70f3[_0x58ba('0x47')]['ids'])){for(var _0x2a4368=0x0;_0x2a4368<_0x3d70f3[_0x58ba('0x47')][_0x58ba('0x63')][_0x58ba('0x51')];_0x2a4368+=0x1){_0x4e5bc2={'UserId':Number(_0x3d70f3[_0x58ba('0x5b')]['id'])};_0x4e5bc2[_[_0x58ba('0xa1')](_0x3d70f3[_0x58ba('0x47')][_0x58ba('0x98')]['toLowerCase']())+_0x58ba('0xa2')]=Number(_0x3d70f3['query'][_0x58ba('0x63')][_0x2a4368]);socket[_0x58ba('0xa3')](_0x58ba('0x2e')+_[_0x58ba('0xa1')](_0x3d70f3[_0x58ba('0x47')][_0x58ba('0x98')][_0x58ba('0x9d')]())+_0x58ba('0xad'),_0x4e5bc2);}}else{_0x4e5bc2={'UserId':Number(_0x3d70f3[_0x58ba('0x5b')]['id'])};_0x4e5bc2[_[_0x58ba('0xa1')](_0x3d70f3[_0x58ba('0x47')][_0x58ba('0x98')]['toLowerCase']())+_0x58ba('0xa2')]=Number(_0x3d70f3[_0x58ba('0x47')][_0x58ba('0x63')]);socket['emit'](_0x58ba('0x2e')+_['capitalize'](_0x3d70f3[_0x58ba('0x47')][_0x58ba('0x98')]['toLowerCase']())+_0x58ba('0xad'),_0x4e5bc2);}return _0x5d8852;})['then'](function(){if(_0x3d70f3[_0x58ba('0x47')][_0x58ba('0x98')]===_0x58ba('0xa5')){return db[_0x58ba('0xae')][_0x58ba('0x38')]({'where':{'UserId':_0x3d70f3['params']['id'],'VoiceQueueId':_0x3d70f3['query'][_0x58ba('0x63')]},'individualHooks':!![]})[_0x58ba('0x1f')](function(){return _0x1e49eb;});}return _0x1e49eb;})[_0x58ba('0x1f')](respondWithStatusCode(_0x5f0d77,null))[_0x58ba('0x26')](handleError(_0x5f0d77,null));};exports[_0x58ba('0xaf')]=function(_0x31af48,_0x396315){_0x31af48[_0x58ba('0x60')][_0x58ba('0xb0')]=_0x31af48['file']['filename'];return db['User'][_0x58ba('0x36')]({'where':{'id':_0x31af48['params']['id']}})[_0x58ba('0x1f')](handleEntityNotFound(_0x396315,null))['then'](saveUpdates(_0x31af48[_0x58ba('0x60')],null))[_0x58ba('0x1f')](respondWithResult(_0x396315,null))[_0x58ba('0x26')](handleError(_0x396315,null));};exports[_0x58ba('0xb1')]=function(_0x300e22,_0x2c3069){var _0x2adfa2=path[_0x58ba('0xb2')](config[_0x58ba('0xb3')],_0x58ba('0xb4'));return db['User'][_0x58ba('0x36')]({'where':{'id':_0x300e22[_0x58ba('0x5b')]['id']},'attributes':['id',_0x58ba('0xb0')],'raw':!![]})[_0x58ba('0x1f')](handleEntityNotFound(_0x2c3069,null))[_0x58ba('0x1f')](function(_0x48e0e6){if(_0x48e0e6){if(_[_0x58ba('0x67')](_0x48e0e6[_0x58ba('0xb0')])){return _0x2c3069['download'](_0x2adfa2);}else{if(!fs[_0x58ba('0xb5')](path[_0x58ba('0xb2')](config[_0x58ba('0xb3')],_0x58ba('0xb6'),_0x48e0e6[_0x58ba('0xb0')]))){return _0x2c3069[_0x58ba('0xb7')](_0x2adfa2);}return _0x2c3069[_0x58ba('0xb7')](path[_0x58ba('0xb2')](config['root'],_0x58ba('0xb6'),_0x48e0e6[_0x58ba('0xb0')]));}}})['catch'](handleError(_0x2c3069,null));};exports[_0x58ba('0xb8')]=function(_0xcfbc3d,_0x3d9dce){return db['User']['find']({'where':{'id':_0xcfbc3d['params']['id']},'attributes':['id']})[_0x58ba('0x1f')](handleEntityNotFound(_0x3d9dce,null))['then'](function(_0xb40fd2){var _0x5ab17f=[];values=_0xb40fd2[_0x58ba('0x54')];_0x5ab17f['push'](get_open_tabs(_0x58ba('0x53'),_0xb40fd2[_0x58ba('0x54')]));_0x5ab17f['push'](get_open_tabs(_0x58ba('0x55'),_0xb40fd2[_0x58ba('0x54')]));_0x5ab17f[_0x58ba('0x52')](get_open_tabs(_0x58ba('0x58'),_0xb40fd2['dataValues']));_0x5ab17f['push'](get_open_tabs(_0x58ba('0x5f'),_0xb40fd2[_0x58ba('0x54')]));_0x5ab17f['push'](get_open_tabs(_0x58ba('0x56'),_0xb40fd2[_0x58ba('0x54')]));_0x5ab17f[_0x58ba('0x52')](get_open_tabs(_0x58ba('0x57'),_0xb40fd2[_0x58ba('0x54')]));return Promise[_0x58ba('0x59')](_0x5ab17f);})[_0x58ba('0x1f')](function(_0x47d619){if(_0x47d619){var _0x53accf=_['map'](values['ChatOpenTabs'],function(_0x29f98b){return{'channel':_0x58ba('0xb9'),'id':_0x29f98b['id'],'createdAt':_0x29f98b['createdAt']};});var _0xee40b=_[_0x58ba('0x33')](values['FaxOpenTabs'],function(_0x451551){return{'channel':_0x58ba('0xba'),'id':_0x451551['id'],'createdAt':_0x451551[_0x58ba('0xbb')]};});var _0x5c2260=_[_0x58ba('0x33')](values[_0x58ba('0xbc')],function(_0x47d0ee){return{'channel':_0x58ba('0xbd'),'id':_0x47d0ee['id'],'createdAt':_0x47d0ee[_0x58ba('0xbb')]};});var _0x3ed4f8=_[_0x58ba('0x33')](values[_0x58ba('0xbe')],function(_0x4bf486){return{'channel':_0x58ba('0xbf'),'id':_0x4bf486['id'],'createdAt':_0x4bf486[_0x58ba('0xbb')]};});var _0xa8121a=_[_0x58ba('0x33')](values[_0x58ba('0xc0')],function(_0x167d28){return{'channel':_0x58ba('0xc1'),'id':_0x167d28['id'],'createdAt':_0x167d28[_0x58ba('0xbb')]};});var _0xfc2f7c=_[_0x58ba('0x33')](values[_0x58ba('0xc2')],function(_0x446f37){return{'channel':_0x58ba('0xc3'),'id':_0x446f37['id'],'createdAt':_0x446f37['createdAt']};});var _0x3fce2a=_[_0x58ba('0xc4')](_0x53accf,_0xee40b,_0x5c2260,_0x3ed4f8,_0xa8121a,_0xfc2f7c);var _0x37ff71={'count':_0x3fce2a[_0x58ba('0x51')],'rows':_0x3fce2a};return _0x37ff71;}else return null;})[_0x58ba('0x1f')](respondWithResult(_0x3d9dce,null))[_0x58ba('0x26')](handleError(_0x3d9dce,null));};exports[_0x58ba('0xc5')]=function(_0x814101,_0x5a684c){var _0x17ff94={};return db['User'][_0x58ba('0x94')]({'where':{'id':_0x814101[_0x58ba('0x5b')]['id']}})[_0x58ba('0x1f')](function(_0x32075d){if(!_0x32075d){throw new APINotFoundError(util[_0x58ba('0xa9')]('User\x20with\x20id\x20%s\x20not\x20found',_0x814101[_0x58ba('0x5b')]['id']));}return contacts[_0x58ba('0x61')]();})[_0x58ba('0x1f')](function(_0x3adb16){_0x814101[_0x58ba('0x47')]['User']=_0x814101[_0x58ba('0x5b')]['id'];_0x17ff94=qs['getOptions'](_0x3adb16,_0x814101);if(_0x814101[_0x58ba('0x47')][_0x58ba('0xc6')](_0x58ba('0x48'))){_0x17ff94[_0x58ba('0x49')]=[{'model':db[_0x58ba('0xc7')],'as':_0x58ba('0xc8'),'required':![]},{'model':db[_0x58ba('0xc9')],'as':_0x58ba('0xca'),'attributes':['id','name',_0x58ba('0xcb')],'where':_0x814101['query'][_0x58ba('0xcc')]?{'id':_0x814101[_0x58ba('0x47')][_0x58ba('0xcc')]}:undefined,'required':_0x814101[_0x58ba('0x47')][_0x58ba('0xcc')]?!![]:![]}];}return contacts[_0x58ba('0x4e')](_0x814101['query'],_0x814101[_0x58ba('0x2e')],_0x17ff94,_0x3adb16);})[_0x58ba('0x1f')](respondWithFilteredResult(_0x5a684c,_0x17ff94))['catch'](APIHandleError(_0x5a684c));};exports[_0x58ba('0xcd')]=function(_0x313c39,_0x2110e5){var _0xc33bc;var _0x448564={};var _0x5c1126;return db[_0x58ba('0x3b')][_0x58ba('0x94')]({'where':{'id':_0x313c39[_0x58ba('0x5b')]['id']},'attributes':['id','name',_0x58ba('0x28')]})[_0x58ba('0x1f')](handleEntityNotFound(_0x2110e5,null))[_0x58ba('0x1f')](function(_0xf8a580){if(!utils['isValidChannel'](_0x313c39[_0x58ba('0x47')]['channel'])){throw new db[(_0x58ba('0x8f'))]['ValidationError'](_0x58ba('0x9b'));}_0xc33bc=_0xf8a580;var _0x465d6c={};_0x465d6c[_0x58ba('0xce')]=_[_0x58ba('0xcf')](db[_[_0x58ba('0xa1')](_0x313c39[_0x58ba('0x47')][_0x58ba('0x98')])+_0x58ba('0xd0')][_0x58ba('0x3c')]);_0x465d6c['query']=_[_0x58ba('0xcf')](_0x313c39[_0x58ba('0x47')]);_0x465d6c[_0x58ba('0xd1')]=_[_0x58ba('0xd2')](_0x465d6c[_0x58ba('0xce')],_0x465d6c['query']);_0x448564[_0x58ba('0x4d')]=_[_0x58ba('0xd2')](_0x465d6c[_0x58ba('0xce')],qs[_0x58ba('0xd3')](_0x313c39['query'][_0x58ba('0xd3')]));_0x448564[_0x58ba('0x4d')]=_0x448564[_0x58ba('0x4d')][_0x58ba('0x51')]?_0x448564[_0x58ba('0x4d')]:_0x465d6c[_0x58ba('0xce')];_0x448564['order']=qs['sort'](_0x313c39[_0x58ba('0x47')][_0x58ba('0xd4')]);_0x448564[_0x58ba('0x46')]=qs[_0x58ba('0xd1')](_[_0x58ba('0xd5')](_0x313c39['query'],_0x465d6c['filters']));if(_0x313c39['query'][_0x58ba('0xd6')]){_0x448564[_0x58ba('0x46')]=_['merge'](_0x448564['where'],{'$or':_[_0x58ba('0x33')](_0x448564[_0x58ba('0x4d')],function(_0x12d964){var _0xf01151={};_0xf01151[_0x12d964]={'$like':'%'+_0x313c39[_0x58ba('0x47')][_0x58ba('0xd6')]+'%'};return _0xf01151;})});}_0x448564=_[_0x58ba('0x5d')]({},_0x448564,_0x313c39[_0x58ba('0x5e')]);switch(_0xc33bc['role']){case _0x58ba('0x2c'):return db[_[_0x58ba('0xa1')](_0x313c39['query'][_0x58ba('0x98')])+_0x58ba('0xd0')]['findAll'](_0x448564);case _0x58ba('0x2e'):case _0x58ba('0x29'):return _0xc33bc['get'+_[_0x58ba('0xa1')](_0x313c39[_0x58ba('0x47')][_0x58ba('0x98')])+_0x58ba('0x9e')](_0x448564);default:throw new db[(_0x58ba('0x8f'))]['ValidationError'](_0x58ba('0xd7'));}})[_0x58ba('0x1f')](function(_0x2a5b49){_0x5c1126=_0x2a5b49['length'];if(!_0x313c39[_0x58ba('0x47')][_0x58ba('0xc6')](_0x58ba('0xd8'))){_0x448564['limit']=qs[_0x58ba('0x1a')](_0x313c39[_0x58ba('0x47')][_0x58ba('0x1a')]);_0x448564[_0x58ba('0x18')]=qs[_0x58ba('0x18')](_0x313c39[_0x58ba('0x47')]['offset']);}switch(_0xc33bc[_0x58ba('0x28')]){case _0x58ba('0x2c'):return db[_[_0x58ba('0xa1')](_0x313c39[_0x58ba('0x47')][_0x58ba('0x98')])+_0x58ba('0xd0')]['findAll'](_0x448564);case _0x58ba('0x2e'):case'agent':return _0xc33bc['get'+_[_0x58ba('0xa1')](_0x313c39[_0x58ba('0x47')][_0x58ba('0x98')])+'Queues'](_0x448564);}})[_0x58ba('0x1f')](function(_0x826b01){return{'count':_0x5c1126,'rows':_0x826b01};})[_0x58ba('0x1f')](respondWithResult(_0x2110e5,null))[_0x58ba('0x26')](handleError(_0x2110e5,null));};exports[_0x58ba('0xd9')]=function(_0x3b6330,_0x2b58f4){var _0x48d8fc={};var _0x4c9c90={};var _0x129e25;var _0x301a3a;return db[_0x58ba('0x3b')][_0x58ba('0x94')]({'where':{'id':_0x3b6330[_0x58ba('0x5b')]['id']}})[_0x58ba('0x1f')](handleEntityNotFound(_0x2b58f4,null))[_0x58ba('0x1f')](function(_0x1a5106){if(_0x1a5106){_0x129e25=_0x1a5106;_0x4c9c90[_0x58ba('0xce')]=_['keys'](db[_0x58ba('0xae')][_0x58ba('0x3c')]);_0x4c9c90['query']=_[_0x58ba('0xcf')](_0x3b6330[_0x58ba('0x47')]);_0x4c9c90[_0x58ba('0xd1')]=_[_0x58ba('0xd2')](_0x4c9c90[_0x58ba('0xce')],_0x4c9c90['query']);_0x48d8fc[_0x58ba('0x4d')]=_['intersection'](_0x4c9c90[_0x58ba('0xce')],qs[_0x58ba('0xd3')](_0x3b6330[_0x58ba('0x47')][_0x58ba('0xd3')]));_0x48d8fc[_0x58ba('0x4d')]=_0x48d8fc[_0x58ba('0x4d')][_0x58ba('0x51')]?_0x48d8fc[_0x58ba('0x4d')]:_0x4c9c90[_0x58ba('0xce')];_0x48d8fc[_0x58ba('0xda')]=qs[_0x58ba('0xd4')](_0x3b6330[_0x58ba('0x47')][_0x58ba('0xd4')]);_0x48d8fc[_0x58ba('0x46')]=qs['filters'](_[_0x58ba('0xd5')](_0x3b6330[_0x58ba('0x47')],_0x4c9c90[_0x58ba('0xd1')]));if(_0x3b6330[_0x58ba('0x47')]['filter']){_0x48d8fc[_0x58ba('0x46')]=_[_0x58ba('0x5d')](_0x48d8fc['where'],{'$or':_[_0x58ba('0x33')](_0x48d8fc['attributes'],function(_0x54c0f1){var _0x392e16={};_0x392e16[_0x54c0f1]={'$like':'%'+_0x3b6330['query'][_0x58ba('0xd6')]+'%'};return _0x392e16;})});}_0x48d8fc=_[_0x58ba('0x5d')]({},_0x48d8fc,_0x3b6330[_0x58ba('0x5e')]);return _0x129e25[_0x58ba('0xd9')](_0x48d8fc);}})[_0x58ba('0x1f')](function(_0x4013f7){if(_0x4013f7){_0x301a3a=_0x4013f7[_0x58ba('0x51')];if(!_0x3b6330[_0x58ba('0x47')][_0x58ba('0xc6')](_0x58ba('0xd8'))){_0x48d8fc['limit']=qs[_0x58ba('0x1a')](_0x3b6330[_0x58ba('0x47')][_0x58ba('0x1a')]);_0x48d8fc['offset']=qs[_0x58ba('0x18')](_0x3b6330['query'][_0x58ba('0x18')]);}return _0x129e25[_0x58ba('0xd9')](_0x48d8fc);}})[_0x58ba('0x1f')](function(_0x57d6ce){if(_0x57d6ce){return _0x57d6ce?{'count':_0x301a3a,'rows':_0x57d6ce}:null;}})[_0x58ba('0x1f')](respondWithResult(_0x2b58f4,null))[_0x58ba('0x26')](handleError(_0x2b58f4,null));};exports[_0x58ba('0xdb')]=function(_0x414828,_0x3e59f4){var _0x2b36d8={};var _0x4ed42b={};var _0x5e3b5d;var _0x1d2c89;return db[_0x58ba('0x3b')][_0x58ba('0x94')]({'where':{'id':_0x414828[_0x58ba('0x5b')]['id']}})[_0x58ba('0x1f')](handleEntityNotFound(_0x3e59f4,null))['then'](function(_0x22f2b1){if(_0x22f2b1){_0x5e3b5d=_0x22f2b1;_0x4ed42b['model']=_[_0x58ba('0xcf')](db[_0x58ba('0xdc')][_0x58ba('0x3c')]);_0x4ed42b[_0x58ba('0x47')]=_[_0x58ba('0xcf')](_0x414828[_0x58ba('0x47')]);_0x4ed42b['filters']=_[_0x58ba('0xd2')](_0x4ed42b['model'],_0x4ed42b[_0x58ba('0x47')]);_0x2b36d8[_0x58ba('0x4d')]=_[_0x58ba('0xd2')](_0x4ed42b[_0x58ba('0xce')],qs['fields'](_0x414828['query'][_0x58ba('0xd3')]));_0x2b36d8[_0x58ba('0x4d')]=_0x2b36d8[_0x58ba('0x4d')][_0x58ba('0x51')]?_0x2b36d8[_0x58ba('0x4d')]:_0x4ed42b[_0x58ba('0xce')];_0x2b36d8[_0x58ba('0xda')]=qs[_0x58ba('0xd4')](_0x414828['query'][_0x58ba('0xd4')]);_0x2b36d8[_0x58ba('0x46')]=qs[_0x58ba('0xd1')](_['pick'](_0x414828[_0x58ba('0x47')],_0x4ed42b['filters']));if(_0x414828[_0x58ba('0x47')][_0x58ba('0xd6')]){_0x2b36d8['where']=_[_0x58ba('0x5d')](_0x2b36d8[_0x58ba('0x46')],{'$or':_[_0x58ba('0x33')](_0x2b36d8[_0x58ba('0x4d')],function(_0x31c0f7){var _0x3c85ac={};_0x3c85ac[_0x31c0f7]={'$like':'%'+_0x414828[_0x58ba('0x47')]['filter']+'%'};return _0x3c85ac;})});}_0x2b36d8=_[_0x58ba('0x5d')]({},_0x2b36d8,_0x414828[_0x58ba('0x5e')]);return _0x5e3b5d[_0x58ba('0xdb')](_0x2b36d8);}})[_0x58ba('0x1f')](function(_0x18b0c7){if(_0x18b0c7){_0x1d2c89=_0x18b0c7['length'];if(!_0x414828['query'][_0x58ba('0xc6')](_0x58ba('0xd8'))){_0x2b36d8['limit']=qs[_0x58ba('0x1a')](_0x414828['query'][_0x58ba('0x1a')]);_0x2b36d8['offset']=qs['offset'](_0x414828['query']['offset']);}return _0x5e3b5d['getGroups'](_0x2b36d8);}})[_0x58ba('0x1f')](function(_0x5446e1){if(_0x5446e1){return _0x5446e1?{'count':_0x1d2c89,'rows':_0x5446e1}:null;}})['then'](respondWithResult(_0x3e59f4,null))[_0x58ba('0x26')](handleError(_0x3e59f4,null));};exports[_0x58ba('0xdd')]=function(_0x583b0f,_0x4d52e3){var _0x5b43d6={'raw':!![],'where':{}};var _0x2c5d58={};var _0x3e07f9={'count':0x0,'rows':[]};return db[_0x58ba('0x3b')][_0x58ba('0x94')]({'where':{'id':_0x583b0f[_0x58ba('0x5b')]['id']}})[_0x58ba('0x1f')](handleEntityNotFound(_0x4d52e3,null))['then'](function(_0x1f3726){if(_0x1f3726){_0x2c5d58[_0x58ba('0xce')]=_[_0x58ba('0xcf')](db[_0x58ba('0xde')][_0x58ba('0x3c')]);_0x2c5d58['query']=_[_0x58ba('0xcf')](_0x583b0f['query']);_0x2c5d58['filters']=_[_0x58ba('0xd2')](_0x2c5d58['model'],_0x2c5d58[_0x58ba('0x47')]);_0x5b43d6[_0x58ba('0x4d')]=_[_0x58ba('0xd2')](_0x2c5d58[_0x58ba('0xce')],qs[_0x58ba('0xd3')](_0x583b0f[_0x58ba('0x47')]['fields']));_0x5b43d6[_0x58ba('0x4d')]=_0x5b43d6[_0x58ba('0x4d')][_0x58ba('0x51')]?_0x5b43d6[_0x58ba('0x4d')]:_0x2c5d58[_0x58ba('0xce')];if(!_0x583b0f['query']['hasOwnProperty']('nolimit')){_0x5b43d6[_0x58ba('0x1a')]=qs['limit'](_0x583b0f[_0x58ba('0x47')][_0x58ba('0x1a')]);_0x5b43d6[_0x58ba('0x18')]=qs[_0x58ba('0x18')](_0x583b0f[_0x58ba('0x47')][_0x58ba('0x18')]);}_0x5b43d6[_0x58ba('0xda')]=qs[_0x58ba('0xd4')](_0x583b0f[_0x58ba('0x47')]['sort']);_0x5b43d6[_0x58ba('0x46')]=qs[_0x58ba('0xd1')](_[_0x58ba('0xd5')](_0x583b0f[_0x58ba('0x47')],_0x2c5d58[_0x58ba('0xd1')]));_0x5b43d6[_0x58ba('0x46')]['UserId']=_0x1f3726['id'];if(_0x583b0f['query'][_0x58ba('0xd6')]){_0x5b43d6[_0x58ba('0x46')]=_[_0x58ba('0x5d')](_0x5b43d6[_0x58ba('0x46')],{'$or':_['map'](_0x5b43d6[_0x58ba('0x4d')],function(_0x346c49){var _0x3da4e6={};_0x3da4e6[_0x346c49]={'$like':'%'+_0x583b0f[_0x58ba('0x47')][_0x58ba('0xd6')]+'%'};return _0x3da4e6;})});}_0x5b43d6=_[_0x58ba('0x5d')]({},_0x5b43d6,_0x583b0f[_0x58ba('0x5e')]);return db[_0x58ba('0xde')][_0x58ba('0x1b')]({'where':_0x5b43d6[_0x58ba('0x46')]})[_0x58ba('0x1f')](function(_0x564961){_0x3e07f9['count']=_0x564961;if(_0x583b0f['query']['includeAll']){_0x5b43d6[_0x58ba('0x49')]=[{'all':!![]}];}return db[_0x58ba('0xde')][_0x58ba('0x4e')](_0x5b43d6);})[_0x58ba('0x1f')](function(_0x46159a){_0x3e07f9[_0x58ba('0x4f')]=_0x46159a;return _0x3e07f9;});}})[_0x58ba('0x1f')](respondWithFilteredResult(_0x4d52e3,_0x5b43d6))[_0x58ba('0x26')](handleError(_0x4d52e3,null));};exports[_0x58ba('0xdf')]=function(_0x3423c9,_0x45586a){var _0x2acbff={'raw':!![],'where':{}};var _0x5c21fe={};var _0x3a558e={'count':0x0,'rows':[]};return db[_0x58ba('0x3b')][_0x58ba('0x94')]({'where':{'id':_0x3423c9['params']['id']}})[_0x58ba('0x1f')](handleEntityNotFound(_0x45586a,null))[_0x58ba('0x1f')](function(_0x43e67e){if(_0x43e67e){_0x5c21fe['model']=_[_0x58ba('0xcf')](db[_0x58ba('0xe0')][_0x58ba('0x3c')]);_0x5c21fe['query']=_[_0x58ba('0xcf')](_0x3423c9['query']);_0x5c21fe[_0x58ba('0xd1')]=_['intersection'](_0x5c21fe[_0x58ba('0xce')],_0x5c21fe['query']);_0x2acbff['attributes']=_[_0x58ba('0xd2')](_0x5c21fe[_0x58ba('0xce')],qs[_0x58ba('0xd3')](_0x3423c9[_0x58ba('0x47')]['fields']));_0x2acbff[_0x58ba('0x4d')]=_0x2acbff[_0x58ba('0x4d')]['length']?_0x2acbff[_0x58ba('0x4d')]:_0x5c21fe[_0x58ba('0xce')];if(!_0x3423c9[_0x58ba('0x47')][_0x58ba('0xc6')](_0x58ba('0xd8'))){_0x2acbff['limit']=qs[_0x58ba('0x1a')](_0x3423c9[_0x58ba('0x47')][_0x58ba('0x1a')]);_0x2acbff[_0x58ba('0x18')]=qs['offset'](_0x3423c9[_0x58ba('0x47')]['offset']);}_0x2acbff[_0x58ba('0xda')]=qs[_0x58ba('0xd4')](_0x3423c9['query'][_0x58ba('0xd4')]);_0x2acbff[_0x58ba('0x46')]=qs[_0x58ba('0xd1')](_[_0x58ba('0xd5')](_0x3423c9[_0x58ba('0x47')],_0x5c21fe[_0x58ba('0xd1')]));_0x2acbff['where']['UserId']=_0x43e67e['id'];if(_0x3423c9['query']['filter']){_0x2acbff[_0x58ba('0x46')]=_[_0x58ba('0x5d')](_0x2acbff[_0x58ba('0x46')],{'$or':_[_0x58ba('0x33')](_0x2acbff[_0x58ba('0x4d')],function(_0x57e7ef){var _0x13bbf6={};_0x13bbf6[_0x57e7ef]={'$like':'%'+_0x3423c9['query'][_0x58ba('0xd6')]+'%'};return _0x13bbf6;})});}_0x2acbff=_['merge']({},_0x2acbff,_0x3423c9[_0x58ba('0x5e')]);return db[_0x58ba('0xe0')][_0x58ba('0x1b')]({'where':_0x2acbff[_0x58ba('0x46')]})[_0x58ba('0x1f')](function(_0x19614e){_0x3a558e[_0x58ba('0x1b')]=_0x19614e;if(_0x3423c9[_0x58ba('0x47')][_0x58ba('0x48')]){_0x2acbff[_0x58ba('0x49')]=[{'all':!![]}];}return db[_0x58ba('0xe0')]['findAll'](_0x2acbff);})[_0x58ba('0x1f')](function(_0x48651d){_0x3a558e[_0x58ba('0x4f')]=_0x48651d;return _0x3a558e;});}})[_0x58ba('0x1f')](respondWithFilteredResult(_0x45586a,_0x2acbff))[_0x58ba('0x26')](handleError(_0x45586a,null));};exports['getChatInteractions']=function(_0x3358be,_0x1e704e){var _0x5c0fca={};var _0x1f3bb0={};var _0x41c040;var _0x41fdb8;return db[_0x58ba('0x3b')][_0x58ba('0x94')]({'where':{'id':_0x3358be['params']['id']}})[_0x58ba('0x1f')](handleEntityNotFound(_0x1e704e,null))['then'](function(_0x3cd561){if(_0x3cd561){_0x41c040=_0x3cd561;_0x1f3bb0[_0x58ba('0xce')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x1f3bb0[_0x58ba('0x47')]=_[_0x58ba('0xcf')](_0x3358be[_0x58ba('0x47')]);_0x1f3bb0['filters']=_[_0x58ba('0xd2')](_0x1f3bb0['model'],_0x1f3bb0[_0x58ba('0x47')]);_0x5c0fca['attributes']=_[_0x58ba('0xd2')](_0x1f3bb0[_0x58ba('0xce')],qs['fields'](_0x3358be[_0x58ba('0x47')][_0x58ba('0xd3')]));_0x5c0fca[_0x58ba('0x4d')]=_0x5c0fca[_0x58ba('0x4d')][_0x58ba('0x51')]?_0x5c0fca[_0x58ba('0x4d')]:_0x1f3bb0[_0x58ba('0xce')];_0x5c0fca[_0x58ba('0xda')]=qs[_0x58ba('0xd4')](_0x3358be[_0x58ba('0x47')][_0x58ba('0xd4')]);_0x5c0fca[_0x58ba('0x46')]=qs['filters'](_[_0x58ba('0xd5')](_0x3358be['query'],_0x1f3bb0[_0x58ba('0xd1')]));if(_0x3358be[_0x58ba('0x47')][_0x58ba('0xd6')]){_0x5c0fca['where']=_[_0x58ba('0x5d')](_0x5c0fca[_0x58ba('0x46')],{'$or':_[_0x58ba('0x33')](_0x5c0fca[_0x58ba('0x4d')],function(_0x1f3b15){var _0x38930f={};_0x38930f[_0x1f3b15]={'$like':'%'+_0x3358be[_0x58ba('0x47')][_0x58ba('0xd6')]+'%'};return _0x38930f;})});}_0x5c0fca=_[_0x58ba('0x5d')]({},_0x5c0fca,_0x3358be[_0x58ba('0x5e')]);return _0x41c040[_0x58ba('0xe1')](_0x5c0fca);}})[_0x58ba('0x1f')](function(_0x3385f9){if(_0x3385f9){_0x41fdb8=_0x3385f9[_0x58ba('0x51')];if(!_0x3358be[_0x58ba('0x47')][_0x58ba('0xc6')]('nolimit')){_0x5c0fca['limit']=qs['limit'](_0x3358be['query'][_0x58ba('0x1a')]);_0x5c0fca['offset']=qs[_0x58ba('0x18')](_0x3358be[_0x58ba('0x47')][_0x58ba('0x18')]);}return _0x41c040[_0x58ba('0xe1')](_0x5c0fca);}})[_0x58ba('0x1f')](function(_0x58e677){if(_0x58e677){return _0x58e677?{'count':_0x41fdb8,'rows':_0x58e677}:null;}})[_0x58ba('0x1f')](respondWithResult(_0x1e704e,null))[_0x58ba('0x26')](handleError(_0x1e704e,null));};exports[_0x58ba('0xe2')]=function(_0x111814,_0x1daa70){var _0xea5afc={};var _0x4974dc={};var _0x133bdb;var _0x286fd2;return db[_0x58ba('0x3b')][_0x58ba('0x94')]({'where':{'id':_0x111814[_0x58ba('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1daa70,null))[_0x58ba('0x1f')](function(_0x233121){if(_0x233121){_0x133bdb=_0x233121;_0x4974dc[_0x58ba('0xce')]=_['keys'](db['OpenchannelInteraction'][_0x58ba('0x3c')]);_0x4974dc[_0x58ba('0x47')]=_[_0x58ba('0xcf')](_0x111814['query']);_0x4974dc[_0x58ba('0xd1')]=_[_0x58ba('0xd2')](_0x4974dc['model'],_0x4974dc['query']);_0xea5afc[_0x58ba('0x4d')]=_[_0x58ba('0xd2')](_0x4974dc[_0x58ba('0xce')],qs[_0x58ba('0xd3')](_0x111814['query'][_0x58ba('0xd3')]));_0xea5afc[_0x58ba('0x4d')]=_0xea5afc['attributes']['length']?_0xea5afc[_0x58ba('0x4d')]:_0x4974dc[_0x58ba('0xce')];_0xea5afc[_0x58ba('0xda')]=qs[_0x58ba('0xd4')](_0x111814[_0x58ba('0x47')]['sort']);_0xea5afc['where']=qs['filters'](_['pick'](_0x111814[_0x58ba('0x47')],_0x4974dc[_0x58ba('0xd1')]));if(_0x111814[_0x58ba('0x47')][_0x58ba('0xd6')]){_0xea5afc['where']=_[_0x58ba('0x5d')](_0xea5afc[_0x58ba('0x46')],{'$or':_[_0x58ba('0x33')](_0xea5afc['attributes'],function(_0x25aa2b){var _0xfd4f79={};_0xfd4f79[_0x25aa2b]={'$like':'%'+_0x111814[_0x58ba('0x47')][_0x58ba('0xd6')]+'%'};return _0xfd4f79;})});}_0xea5afc=_[_0x58ba('0x5d')]({},_0xea5afc,_0x111814[_0x58ba('0x5e')]);return _0x133bdb['getOpenchannelInteractions'](_0xea5afc);}})[_0x58ba('0x1f')](function(_0x1a220d){if(_0x1a220d){_0x286fd2=_0x1a220d['length'];if(!_0x111814[_0x58ba('0x47')][_0x58ba('0xc6')]('nolimit')){_0xea5afc[_0x58ba('0x1a')]=qs[_0x58ba('0x1a')](_0x111814[_0x58ba('0x47')][_0x58ba('0x1a')]);_0xea5afc[_0x58ba('0x18')]=qs[_0x58ba('0x18')](_0x111814[_0x58ba('0x47')][_0x58ba('0x18')]);}return _0x133bdb[_0x58ba('0xe2')](_0xea5afc);}})[_0x58ba('0x1f')](function(_0x24d34f){if(_0x24d34f){return _0x24d34f?{'count':_0x286fd2,'rows':_0x24d34f}:null;}})[_0x58ba('0x1f')](respondWithResult(_0x1daa70,null))['catch'](handleError(_0x1daa70,null));};exports['getMailInteractions']=function(_0x88eb62,_0x298400){var _0xedf736={'raw':!![],'where':{}};var _0x383726={};var _0x9ad1b2={'count':0x0,'rows':[]};return db[_0x58ba('0x3b')][_0x58ba('0x94')]({'where':{'id':_0x88eb62['params']['id']}})[_0x58ba('0x1f')](handleEntityNotFound(_0x298400,null))[_0x58ba('0x1f')](function(_0x56c929){if(_0x56c929){_0x383726[_0x58ba('0xce')]=_[_0x58ba('0xcf')](db[_0x58ba('0xe3')]['rawAttributes']);_0x383726[_0x58ba('0x47')]=_['keys'](_0x88eb62[_0x58ba('0x47')]);_0x383726['filters']=_[_0x58ba('0xd2')](_0x383726[_0x58ba('0xce')],_0x383726[_0x58ba('0x47')]);_0xedf736['attributes']=_['intersection'](_0x383726[_0x58ba('0xce')],qs[_0x58ba('0xd3')](_0x88eb62['query'][_0x58ba('0xd3')]));_0xedf736[_0x58ba('0x4d')]=_0xedf736[_0x58ba('0x4d')][_0x58ba('0x51')]?_0xedf736[_0x58ba('0x4d')]:_0x383726['model'];if(!_0x88eb62[_0x58ba('0x47')][_0x58ba('0xc6')](_0x58ba('0xd8'))){_0xedf736[_0x58ba('0x1a')]=qs[_0x58ba('0x1a')](_0x88eb62[_0x58ba('0x47')][_0x58ba('0x1a')]);_0xedf736[_0x58ba('0x18')]=qs[_0x58ba('0x18')](_0x88eb62[_0x58ba('0x47')][_0x58ba('0x18')]);}_0xedf736['order']=qs[_0x58ba('0xd4')](_0x88eb62[_0x58ba('0x47')][_0x58ba('0xd4')]);_0xedf736[_0x58ba('0x46')]=qs[_0x58ba('0xd1')](_[_0x58ba('0xd5')](_0x88eb62[_0x58ba('0x47')],_0x383726[_0x58ba('0xd1')]));_0xedf736[_0x58ba('0x46')][_0x58ba('0xe4')]=_0x56c929['id'];if(_0x88eb62[_0x58ba('0x47')][_0x58ba('0xd6')]){_0xedf736[_0x58ba('0x46')]=_[_0x58ba('0x5d')](_0xedf736[_0x58ba('0x46')],{'$or':_[_0x58ba('0x33')](_0xedf736[_0x58ba('0x4d')],function(_0x262a44){var _0x272070={};_0x272070[_0x262a44]={'$like':'%'+_0x88eb62[_0x58ba('0x47')][_0x58ba('0xd6')]+'%'};return _0x272070;})});}_0xedf736=_['merge']({},_0xedf736,_0x88eb62[_0x58ba('0x5e')]);return db['MailInteraction'][_0x58ba('0x1b')]({'where':_0xedf736[_0x58ba('0x46')]})[_0x58ba('0x1f')](function(_0x2a2423){_0x9ad1b2[_0x58ba('0x1b')]=_0x2a2423;if(_0x88eb62[_0x58ba('0x47')]['includeAll']){_0xedf736[_0x58ba('0x49')]=[{'all':!![]}];}return db[_0x58ba('0xe3')][_0x58ba('0x4e')](_0xedf736);})['then'](function(_0x20cd69){_0x9ad1b2[_0x58ba('0x4f')]=_0x20cd69;return _0x9ad1b2;});}})[_0x58ba('0x1f')](respondWithFilteredResult(_0x298400,_0xedf736))[_0x58ba('0x26')](handleError(_0x298400,null));};exports[_0x58ba('0xe5')]=function(_0x56fbe7,_0x265d95){var _0x3365d6={};var _0x18a7df={};var _0xc7684f;var _0x53dafd;return db[_0x58ba('0x3b')][_0x58ba('0x94')]({'where':{'id':_0x56fbe7[_0x58ba('0x5b')]['id']}})[_0x58ba('0x1f')](handleEntityNotFound(_0x265d95,null))['then'](function(_0x31f224){if(_0x31f224){_0xc7684f=_0x31f224;_0x18a7df[_0x58ba('0xce')]=_[_0x58ba('0xcf')](db[_0x58ba('0xe6')][_0x58ba('0x3c')]);_0x18a7df[_0x58ba('0x47')]=_[_0x58ba('0xcf')](_0x56fbe7['query']);_0x18a7df[_0x58ba('0xd1')]=_['intersection'](_0x18a7df[_0x58ba('0xce')],_0x18a7df[_0x58ba('0x47')]);_0x3365d6[_0x58ba('0x4d')]=_['intersection'](_0x18a7df['model'],qs[_0x58ba('0xd3')](_0x56fbe7[_0x58ba('0x47')][_0x58ba('0xd3')]));_0x3365d6['attributes']=_0x3365d6[_0x58ba('0x4d')][_0x58ba('0x51')]?_0x3365d6['attributes']:_0x18a7df[_0x58ba('0xce')];_0x3365d6['order']=qs['sort'](_0x56fbe7[_0x58ba('0x47')][_0x58ba('0xd4')]);_0x3365d6[_0x58ba('0x46')]=qs[_0x58ba('0xd1')](_[_0x58ba('0xd5')](_0x56fbe7[_0x58ba('0x47')],_0x18a7df[_0x58ba('0xd1')]));if(_0x56fbe7['query']['filter']){_0x3365d6['where']=_[_0x58ba('0x5d')](_0x3365d6[_0x58ba('0x46')],{'$or':_[_0x58ba('0x33')](_0x3365d6[_0x58ba('0x4d')],function(_0x4e8ca9){var _0x36929d={};_0x36929d[_0x4e8ca9]={'$like':'%'+_0x56fbe7['query'][_0x58ba('0xd6')]+'%'};return _0x36929d;})});}_0x3365d6=_[_0x58ba('0x5d')]({},_0x3365d6,_0x56fbe7['options']);return _0xc7684f[_0x58ba('0xe5')](_0x3365d6);}})[_0x58ba('0x1f')](function(_0xb13cd9){if(_0xb13cd9){_0x53dafd=_0xb13cd9['length'];if(!_0x56fbe7[_0x58ba('0x47')]['hasOwnProperty'](_0x58ba('0xd8'))){_0x3365d6['limit']=qs['limit'](_0x56fbe7[_0x58ba('0x47')][_0x58ba('0x1a')]);_0x3365d6[_0x58ba('0x18')]=qs[_0x58ba('0x18')](_0x56fbe7[_0x58ba('0x47')][_0x58ba('0x18')]);}return _0xc7684f[_0x58ba('0xe5')](_0x3365d6);}})[_0x58ba('0x1f')](function(_0x340b68){if(_0x340b68){return _0x340b68?{'count':_0x53dafd,'rows':_0x340b68}:null;}})[_0x58ba('0x1f')](respondWithResult(_0x265d95,null))[_0x58ba('0x26')](handleError(_0x265d95,null));};exports[_0x58ba('0xe7')]=function(_0x388737,_0x5eb456){var _0xacd17e={};var _0x8585d9={};var _0x556b59;var _0x526e95;return db[_0x58ba('0x3b')][_0x58ba('0x94')]({'where':{'id':_0x388737['params']['id']}})[_0x58ba('0x1f')](handleEntityNotFound(_0x5eb456,null))[_0x58ba('0x1f')](function(_0x600edb){if(_0x600edb){_0x556b59=_0x600edb;_0x8585d9[_0x58ba('0xce')]=_[_0x58ba('0xcf')](db['FaxInteraction'][_0x58ba('0x3c')]);_0x8585d9[_0x58ba('0x47')]=_[_0x58ba('0xcf')](_0x388737[_0x58ba('0x47')]);_0x8585d9[_0x58ba('0xd1')]=_['intersection'](_0x8585d9[_0x58ba('0xce')],_0x8585d9[_0x58ba('0x47')]);_0xacd17e[_0x58ba('0x4d')]=_['intersection'](_0x8585d9[_0x58ba('0xce')],qs[_0x58ba('0xd3')](_0x388737[_0x58ba('0x47')][_0x58ba('0xd3')]));_0xacd17e[_0x58ba('0x4d')]=_0xacd17e[_0x58ba('0x4d')]['length']?_0xacd17e[_0x58ba('0x4d')]:_0x8585d9[_0x58ba('0xce')];_0xacd17e[_0x58ba('0xda')]=qs[_0x58ba('0xd4')](_0x388737[_0x58ba('0x47')][_0x58ba('0xd4')]);_0xacd17e[_0x58ba('0x46')]=qs[_0x58ba('0xd1')](_['pick'](_0x388737[_0x58ba('0x47')],_0x8585d9[_0x58ba('0xd1')]));if(_0x388737['query'][_0x58ba('0xd6')]){_0xacd17e[_0x58ba('0x46')]=_[_0x58ba('0x5d')](_0xacd17e[_0x58ba('0x46')],{'$or':_['map'](_0xacd17e[_0x58ba('0x4d')],function(_0x49757a){var _0x4b9872={};_0x4b9872[_0x49757a]={'$like':'%'+_0x388737[_0x58ba('0x47')][_0x58ba('0xd6')]+'%'};return _0x4b9872;})});}_0xacd17e=_['merge']({},_0xacd17e,_0x388737[_0x58ba('0x5e')]);return _0x556b59[_0x58ba('0xe7')](_0xacd17e);}})[_0x58ba('0x1f')](function(_0x4adf27){if(_0x4adf27){_0x526e95=_0x4adf27[_0x58ba('0x51')];if(!_0x388737[_0x58ba('0x47')][_0x58ba('0xc6')](_0x58ba('0xd8'))){_0xacd17e[_0x58ba('0x1a')]=qs['limit'](_0x388737[_0x58ba('0x47')][_0x58ba('0x1a')]);_0xacd17e['offset']=qs[_0x58ba('0x18')](_0x388737[_0x58ba('0x47')][_0x58ba('0x18')]);}return _0x556b59[_0x58ba('0xe7')](_0xacd17e);}})[_0x58ba('0x1f')](function(_0x5da40d){if(_0x5da40d){return _0x5da40d?{'count':_0x526e95,'rows':_0x5da40d}:null;}})[_0x58ba('0x1f')](respondWithResult(_0x5eb456,null))['catch'](handleError(_0x5eb456,null));};exports[_0x58ba('0xe8')]=function(_0x17cb2f,_0x4312dc){var _0x4487e0={};var _0x5b6d4c={};var _0x347edf;var _0x7a9e9;return db[_0x58ba('0x3b')][_0x58ba('0x94')]({'where':{'id':_0x17cb2f[_0x58ba('0x5b')]['id']}})[_0x58ba('0x1f')](handleEntityNotFound(_0x4312dc,null))['then'](function(_0xbaa68d){if(_0xbaa68d){_0x347edf=_0xbaa68d;_0x5b6d4c[_0x58ba('0xce')]=_['keys'](db[_0x58ba('0xe9')]['rawAttributes']);_0x5b6d4c[_0x58ba('0x47')]=_[_0x58ba('0xcf')](_0x17cb2f[_0x58ba('0x47')]);_0x5b6d4c[_0x58ba('0xd1')]=_[_0x58ba('0xd2')](_0x5b6d4c[_0x58ba('0xce')],_0x5b6d4c[_0x58ba('0x47')]);_0x4487e0[_0x58ba('0x4d')]=_[_0x58ba('0xd2')](_0x5b6d4c['model'],qs[_0x58ba('0xd3')](_0x17cb2f[_0x58ba('0x47')][_0x58ba('0xd3')]));_0x4487e0[_0x58ba('0x4d')]=_0x4487e0[_0x58ba('0x4d')][_0x58ba('0x51')]?_0x4487e0['attributes']:_0x5b6d4c[_0x58ba('0xce')];_0x4487e0[_0x58ba('0xda')]=qs['sort'](_0x17cb2f['query'][_0x58ba('0xd4')]);_0x4487e0[_0x58ba('0x46')]=qs['filters'](_[_0x58ba('0xd5')](_0x17cb2f[_0x58ba('0x47')],_0x5b6d4c[_0x58ba('0xd1')]));if(_0x17cb2f['query'][_0x58ba('0xd6')]){_0x4487e0['where']=_[_0x58ba('0x5d')](_0x4487e0['where'],{'$or':_[_0x58ba('0x33')](_0x4487e0['attributes'],function(_0x506019){var _0x2e7da0={};_0x2e7da0[_0x506019]={'$like':'%'+_0x17cb2f['query'][_0x58ba('0xd6')]+'%'};return _0x2e7da0;})});}_0x4487e0=_['merge']({},_0x4487e0,_0x17cb2f[_0x58ba('0x5e')]);return _0x347edf[_0x58ba('0xe8')](_0x4487e0);}})['then'](function(_0x4a0e87){if(_0x4a0e87){_0x7a9e9=_0x4a0e87[_0x58ba('0x51')];if(!_0x17cb2f[_0x58ba('0x47')]['hasOwnProperty'](_0x58ba('0xd8'))){_0x4487e0[_0x58ba('0x1a')]=qs[_0x58ba('0x1a')](_0x17cb2f['query'][_0x58ba('0x1a')]);_0x4487e0['offset']=qs[_0x58ba('0x18')](_0x17cb2f[_0x58ba('0x47')][_0x58ba('0x18')]);}return _0x347edf[_0x58ba('0xe8')](_0x4487e0);}})[_0x58ba('0x1f')](function(_0x259d1c){if(_0x259d1c){return _0x259d1c?{'count':_0x7a9e9,'rows':_0x259d1c}:null;}})[_0x58ba('0x1f')](respondWithResult(_0x4312dc,null))['catch'](handleError(_0x4312dc,null));};exports[_0x58ba('0xea')]=function(_0x2c1aee,_0x2d1528,_0x3ad46a){var _0x380f36;var _0x2c912b;var _0x7d4ae1;var _0x40ba36=!_[_0x58ba('0x67')](_0x2c1aee['params']['id'])?_0x2c1aee['params']['id']:!_[_0x58ba('0x67')](_0x2c1aee['user']['id'])?_0x2c1aee[_0x58ba('0x2e')]['id']:null;return db[_0x58ba('0x3b')][_0x58ba('0x36')]({'where':{'id':_0x40ba36,'role':{'$or':[_0x58ba('0x2c'),_0x58ba('0x2e'),_0x58ba('0x29')]}},'attributes':['id',_0x58ba('0x3a'),_0x58ba('0xeb'),_0x58ba('0xec'),_0x58ba('0x28'),_0x58ba('0x64'),_0x58ba('0x99')]})['then'](function(_0x4181e8){if(_0x4181e8){if(_0x4181e8['role']===_0x58ba('0x29')){_0x380f36=_0x4181e8;if(_0x2c1aee[_0x58ba('0x60')]['interface']){_0x7d4ae1=util[_0x58ba('0xa9')](_0x58ba('0xed'),_0x380f36[_0x2c1aee[_0x58ba('0x60')][_0x58ba('0xa8')]]);}else if(_0x2c1aee[_0x58ba('0x60')]['intrf']){_0x7d4ae1=util['format'](_0x58ba('0xee'),_0x2c1aee[_0x58ba('0x60')][_0x58ba('0xef')]);}else{_0x7d4ae1=util[_0x58ba('0xa9')](_0x58ba('0xee'),_0x380f36['name']);}socket['to'](util[_0x58ba('0xa9')]('user:%s',_0x380f36[_0x58ba('0x3a')]))[_0x58ba('0xa3')]('user:forcelogout',{'user':{'id':_0x380f36['id'],'name':_0x380f36[_0x58ba('0x3a')]},'ip':_0x2c1aee[_0x58ba('0xf0')][_0x58ba('0xf1')]||_0x2c1aee[_0x58ba('0xf2')][_0x58ba('0xf3')]||_0x2c1aee[_0x58ba('0xf4')]['remoteAddress']||_0x2c1aee[_0x58ba('0xf2')][_0x58ba('0xf4')][_0x58ba('0xf3')]});return db[_0x58ba('0xae')]['destroy']({'where':{'membername':_0x380f36['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x58ba('0x90'))](_0x58ba('0xf5'));}})['then'](function(){if(_0x380f36){return _0x380f36['getVoiceQueues']({'raw':!![]});}})[_0x58ba('0x1f')](function(_0x5ed100){if(_0x380f36){if(_0x5ed100){_0x2c912b=_0x5ed100;if(_0x2c912b['length']){var _0xb42f75=_0x2c912b['map'](function(_0x4d3776){var _0x584bf0={'membername':_0x380f36['name'],'UserId':_0x380f36['id'],'queue_name':_0x4d3776['name'],'VoiceQueueId':_0x4d3776['id'],'interface':_0x7d4ae1,'paused':_0x380f36[_0x58ba('0x99')]||![],'penalty':_0x4d3776[_0x58ba('0xf6')]||0x0};return db['UserVoiceQueueRt']['upsert'](_0x584bf0);});return Promise['all'](_0xb42f75);}}}})['then'](function(){if(_0x380f36){return db[_0x58ba('0xf7')][_0x58ba('0x4e')]({'where':{'membername':_0x380f36[_0x58ba('0x3a')],'exitAt':null}});}})[_0x58ba('0x1f')](function(_0x5d01c9){if(_0x380f36){var _0x5828bc=[];_0x5d01c9[_0x58ba('0xf8')](function(_0x292da7){_0x5828bc['push'](_0x292da7[_0x58ba('0x27')]({'exitAt':moment()[_0x58ba('0xa9')](_0x58ba('0xf9'))}));});return Promise[_0x58ba('0x59')](_0x5828bc);}})[_0x58ba('0x1f')](function(){if(_0x380f36){var _0x350577=[];var _0x323b7d=[];var _0x38a98b=utils[_0x58ba('0xfa')]();var _0x33bb59={'membername':_0x380f36[_0x58ba('0x3a')],'interface':_0x7d4ae1,'enterAt':moment()[_0x58ba('0xa9')](_0x58ba('0xf9')),'role':_0x380f36[_0x58ba('0x28')],'internal':_0x380f36['internal']};_0x38a98b[_0x58ba('0xf8')](function(_0x44283e){_0x350577[_0x58ba('0x52')](_[_0x58ba('0x5d')]({'channel':_0x44283e,'type':_0x58ba('0xfb'),'data1':_0x2c1aee[_0x58ba('0x60')][_0x58ba('0xfc')],'data2':_0x7d4ae1},_0x33bb59));if(_0x380f36['loginInPause']){_0x323b7d['push'](_[_0x58ba('0x5d')]({'channel':_0x44283e,'type':_0x58ba('0xfd'),'data1':'LOGININPAUSE'},_0x33bb59));}});return db[_0x58ba('0xf7')][_0x58ba('0xfe')](_0x350577['concat'](_0x323b7d),{'individualHooks':!![]});}})[_0x58ba('0x1f')](function(){if(_0x380f36){return _0x380f36['update']({'online':!![],'lastLoginAt':moment()[_0x58ba('0xa9')](_0x58ba('0xf9')),'voicePause':_0x380f36['loginInPause']||![],'mailPause':_0x380f36['loginInPause']||![],'chatPause':_0x380f36[_0x58ba('0x99')]||![],'faxPause':_0x380f36['loginInPause']||![],'smsPause':_0x380f36[_0x58ba('0x99')]||![],'openchannelPause':_0x380f36['loginInPause']||![],'whatsappPause':_0x380f36[_0x58ba('0x99')]||![],'pauseType':_0x380f36[_0x58ba('0x99')]?_0x58ba('0xff'):null,'interface':_0x7d4ae1,'lastPauseAt':moment()[_0x58ba('0xa9')](_0x58ba('0xf9'))});}})[_0x58ba('0x1f')](function(_0x938535){if(_0x2c1aee[_0x58ba('0x100')]){return _0x3ad46a();}else{return Promise['resolve'](_0x938535)[_0x58ba('0x1f')](respondWithResult(_0x2d1528,null));}})[_0x58ba('0x26')](handleError(_0x2d1528,null));};exports[_0x58ba('0x101')]=function(_0x17ecc5,_0x591260){var _0x27fc2c;return db[_0x58ba('0x3b')][_0x58ba('0x36')]({'where':{'id':_0x17ecc5[_0x58ba('0x5b')]['id'],'role':_0x58ba('0x29')},'attributes':['id',_0x58ba('0x3a'),_0x58ba('0x28')]})[_0x58ba('0x1f')](handleEntityNotFound(_0x591260,null))[_0x58ba('0x1f')](function(_0x421bf7){if(_0x421bf7){_0x27fc2c=_0x421bf7;return db[_0x58ba('0xae')][_0x58ba('0x38')]({'where':{'membername':_0x27fc2c[_0x58ba('0x3a')]},'individualHooks':!![]});}})['then'](function(){return db[_0x58ba('0xf7')]['findAll']({'where':{'membername':_0x27fc2c[_0x58ba('0x3a')],'exitAt':null}});})[_0x58ba('0x1f')](function(_0x598090){var _0x388444=[];_0x598090[_0x58ba('0xf8')](function(_0x2d3e4e){_0x388444[_0x58ba('0x52')](_0x2d3e4e[_0x58ba('0x27')]({'exitAt':moment()[_0x58ba('0xa9')](_0x58ba('0xf9'))}));});return Promise[_0x58ba('0x59')](_0x388444);})[_0x58ba('0x1f')](function(){return _0x27fc2c[_0x58ba('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x58ba('0x1f')](respondWithResult(_0x591260,null))['catch'](handleError(_0x591260,null));};exports[_0x58ba('0x102')]=function(_0x59fba6,_0x1396a1){var _0x4d420b;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x59fba6[_0x58ba('0x5b')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x58ba('0x3b')][_0x58ba('0x36')]({'where':{'id':_0x59fba6[_0x58ba('0x5b')]['id'],'role':'agent'},'attributes':['id',_0x58ba('0x3a'),_0x58ba('0x28'),_0x58ba('0x64'),'interface',_0x58ba('0xa7')]});})['then'](handleEntityNotFound(_0x1396a1,null))[_0x58ba('0x1f')](function(_0xd951c1){if(_0xd951c1){_0x4d420b=_0xd951c1;return respondWithRpcPromise(_0x58ba('0x103'),'pause',{'id':_0x4d420b['id'],'name':_0x4d420b['name'],'pause':!![]});}})[_0x58ba('0x1f')](function(){if(_0x4d420b){return db['MemberReport']['findAll']({'where':{'membername':_0x4d420b[_0x58ba('0x3a')],'type':_0x58ba('0xfd'),'exitAt':null}});}})['then'](function(_0x4e8e68){if(_0x4e8e68[_0x58ba('0x51')]){var _0x2a7061=moment()[_0x58ba('0xa9')](_0x58ba('0xf9'));for(var _0x362c44=0x0,_0x47ef40=_0x4e8e68[_0x58ba('0x51')];_0x362c44<_0x47ef40;_0x362c44++){_0x4e8e68[_0x362c44][_0x58ba('0x104')]({'exitAt':_0x2a7061});}}})[_0x58ba('0x1f')](function(){var _0x2484fe=[];var _0xd02799=utils[_0x58ba('0xfa')]();_0xd02799[_0x58ba('0xf8')](function(_0x4b33f6){_0x2484fe[_0x58ba('0x52')]({'channel':_0x4b33f6,'membername':_0x4d420b[_0x58ba('0x3a')],'interface':_[_0x58ba('0x67')](_0x4d420b[_0x58ba('0xa8')])?util[_0x58ba('0xa9')](_0x58ba('0xee'),_0x4d420b[_0x58ba('0x3a')]):_0x4d420b[_0x58ba('0xa8')],'type':_0x58ba('0xfd'),'enterAt':moment()[_0x58ba('0xa9')](_0x58ba('0xf9')),'data1':_0x59fba6[_0x58ba('0x60')][_0x58ba('0x3d')]||_0x58ba('0x105'),'role':_0x4d420b[_0x58ba('0x28')],'internal':_0x4d420b[_0x58ba('0x64')]});});return db['MemberReport']['bulkCreate'](_0x2484fe,{'individualHooks':!![]});})[_0x58ba('0x1f')](function(){return _0x4d420b['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x59fba6[_0x58ba('0x60')][_0x58ba('0x3d')]||_0x58ba('0x105'),'lastPauseAt':moment()['format'](_0x58ba('0xf9'))});})[_0x58ba('0x1f')](respondWithResult(_0x1396a1,null))['catch'](handleError(_0x1396a1,null));};exports[_0x58ba('0x106')]=function(_0x4a8110,_0x4923b4){if(_0x4a8110[_0x58ba('0x60')][_0x58ba('0x98')]&&!utils[_0x58ba('0x9a')](_0x4a8110[_0x58ba('0x60')]['channel'])){throw new APIBadRequestError(util['format'](_0x58ba('0x107'),_0x4a8110['body'][_0x58ba('0x98')]));}return db['User'][_0x58ba('0x36')]({'where':{'id':_0x4a8110[_0x58ba('0x5b')]['id']},'attributes':['id',_0x58ba('0x3a'),_0x58ba('0x28'),'internal',_0x58ba('0xa8'),_0x58ba('0xa7'),_0x58ba('0xaa'),_0x58ba('0x108'),'chatPause',_0x58ba('0x109'),_0x58ba('0x10a'),_0x58ba('0x10b'),'whatsappPause',_0x58ba('0x10c'),'lastPauseAt']})[_0x58ba('0x1f')](function(_0xbb698c){if(!_0xbb698c){throw new APINotFoundError(util[_0x58ba('0xa9')](_0x58ba('0x10d'),_0x4a8110['params']['id']));}return _0xbb698c[_0x58ba('0x106')](_0x4a8110[_0x58ba('0x60')][_0x58ba('0x98')]);})[_0x58ba('0x1f')](respondWithResult(_0x4923b4,null))['catch'](APIHandleError(_0x4923b4));};exports[_0x58ba('0x10e')]=function(_0x287ac4,_0x45d628){var _0x1405cb={};var _0x315e85={};var _0x335198;var _0x267495;return db['User'][_0x58ba('0x94')]({'where':{'id':_0x287ac4[_0x58ba('0x5b')]['id']}})[_0x58ba('0x1f')](handleEntityNotFound(_0x45d628,null))[_0x58ba('0x1f')](function(_0x8f1bda){if(_0x8f1bda){_0x335198=_0x8f1bda;_0x315e85[_0x58ba('0xce')]=_[_0x58ba('0xcf')](db['Team'][_0x58ba('0x3c')]);_0x315e85[_0x58ba('0x47')]=_[_0x58ba('0xcf')](_0x287ac4[_0x58ba('0x47')]);_0x315e85['filters']=_[_0x58ba('0xd2')](_0x315e85[_0x58ba('0xce')],_0x315e85['query']);_0x1405cb[_0x58ba('0x4d')]=_[_0x58ba('0xd2')](_0x315e85[_0x58ba('0xce')],qs[_0x58ba('0xd3')](_0x287ac4[_0x58ba('0x47')][_0x58ba('0xd3')]));_0x1405cb[_0x58ba('0x4d')]=_0x1405cb[_0x58ba('0x4d')][_0x58ba('0x51')]?_0x1405cb[_0x58ba('0x4d')]:_0x315e85[_0x58ba('0xce')];_0x1405cb[_0x58ba('0xda')]=qs[_0x58ba('0xd4')](_0x287ac4[_0x58ba('0x47')][_0x58ba('0xd4')]);_0x1405cb[_0x58ba('0x46')]=qs[_0x58ba('0xd1')](_['pick'](_0x287ac4[_0x58ba('0x47')],_0x315e85[_0x58ba('0xd1')]));if(_0x287ac4[_0x58ba('0x47')][_0x58ba('0xd6')]){_0x1405cb[_0x58ba('0x46')]=_[_0x58ba('0x5d')](_0x1405cb[_0x58ba('0x46')],{'$or':_[_0x58ba('0x33')](_0x1405cb[_0x58ba('0x4d')],function(_0x3011a5){var _0x33e4e4={};_0x33e4e4[_0x3011a5]={'$like':'%'+_0x287ac4[_0x58ba('0x47')][_0x58ba('0xd6')]+'%'};return _0x33e4e4;})});}_0x1405cb=_[_0x58ba('0x5d')]({},_0x1405cb,_0x287ac4['options']);return _0x335198[_0x58ba('0x10e')](_0x1405cb);}})[_0x58ba('0x1f')](function(_0xbcc314){if(_0xbcc314){_0x267495=_0xbcc314[_0x58ba('0x51')];if(!_0x287ac4[_0x58ba('0x47')][_0x58ba('0xc6')](_0x58ba('0xd8'))){_0x1405cb[_0x58ba('0x1a')]=qs['limit'](_0x287ac4[_0x58ba('0x47')]['limit']);_0x1405cb[_0x58ba('0x18')]=qs[_0x58ba('0x18')](_0x287ac4[_0x58ba('0x47')][_0x58ba('0x18')]);}return _0x335198['getTeams'](_0x1405cb);}})[_0x58ba('0x1f')](function(_0x375dda){if(_0x375dda){return _0x375dda?{'count':_0x267495,'rows':_0x375dda}:null;}})['then'](respondWithResult(_0x45d628,null))['catch'](handleError(_0x45d628,null));};exports['addTeams']=function(_0x2cca0e,_0x36228b){var _0x1ba387=_0x2cca0e[_0x58ba('0x5b')]['id'];var _0x18e76f=_0x2cca0e[_0x58ba('0x60')]?_0x2cca0e['body'][_0x58ba('0x63')]:null;var _0x4a08fc=[];return Promise['resolve']()[_0x58ba('0x1f')](function(){if(!_0x18e76f)throw new APIBadRequestError(_0x58ba('0x10f'));})[_0x58ba('0x1f')](function(){return db[_0x58ba('0x3b')]['findOne']({'where':{'id':_0x1ba387}});})[_0x58ba('0x1f')](function(_0x534ff7){if(!_0x534ff7)throw new APINotFoundError(util['format'](_0x58ba('0x10d'),_0x2cca0e[_0x58ba('0x5b')]['id']));return db[_0x58ba('0x69')][_0x58ba('0x110')](function(_0x3dbe62){return _0x534ff7[_0x58ba('0x111')](_0x18e76f,{'transaction':_0x3dbe62})[_0x58ba('0x1f')](function(){return db[_0x58ba('0x112')][_0x58ba('0x4e')]({'where':{'id':{'$in':_0x18e76f}}});})['then'](function(_0x4a60f8){var _0x48da61=_[_0x58ba('0x33')](_0x4a60f8,function(_0x5bc901){return _0x5bc901[_0x58ba('0x113')]();});return Promise['all'](_0x48da61);})['then'](function(_0x4cffe6){_0x4a08fc=_['flattenDeep'](_0x4cffe6);var _0x5471e4=_[_0x58ba('0x33')](_0x4a08fc,function(_0x4a64d5){return _0x4a64d5[_0x58ba('0x114')](_0x534ff7['id'],{'transaction':_0x3dbe62});});return Promise[_0x58ba('0x59')](_0x5471e4);})[_0x58ba('0x1f')](function(){if(!_0x534ff7[_0x58ba('0xa7')])return;var _0x4a6286=_['filter'](_0x4a08fc,function(_0x5066d8){return _0x5066d8['getDataValue'](_0x58ba('0x98'))==='Voice';});var _0x532c63=_[_0x58ba('0x33')](_0x4a6286,function(_0x55f8a0){return db[_0x58ba('0xae')][_0x58ba('0xab')]({'membername':_0x534ff7[_0x58ba('0x3a')],'UserId':_0x534ff7['id'],'queue_name':_0x55f8a0[_0x58ba('0x3a')],'VoiceQueueId':_0x55f8a0['id'],'interface':_[_0x58ba('0x67')](_0x534ff7[_0x58ba('0xa8')])?util[_0x58ba('0xa9')]('SIP/%s',_0x534ff7['name']):_0x534ff7[_0x58ba('0xa8')],'paused':_0x534ff7['voicePause']||![],'penalty':_0x534ff7['penalty']},{'transaction':_0x3dbe62});});return Promise[_0x58ba('0x59')](_0x532c63);})[_0x58ba('0x1f')](function(){return db['TeamVoicePrefix'][_0x58ba('0x4e')]({'where':{'teamId':{'$in':_0x18e76f}}});})[_0x58ba('0x1f')](function(_0xa10679){var _0x1cfd3d=_[_0x58ba('0x33')](_0xa10679,function(_0x528478){return db[_0x58ba('0x115')]['create']({'UserId':_0x534ff7['id'],'VoicePrefixId':_0x528478[_0x58ba('0x116')]},{'transaction':_0x3dbe62});});return Promise[_0x58ba('0x59')](_0x1cfd3d);});});})[_0x58ba('0x1f')](function(){for(var _0x344d58=0x0;_0x344d58<_0x4a08fc[_0x58ba('0x51')];_0x344d58++){var _0x632093=_0x4a08fc[_0x344d58]['getDataValue'](_0x58ba('0x98'));var _0x80b17e=_0x632093+_0x58ba('0xa2');socket[_0x58ba('0xa3')](_0x58ba('0x2e')+_0x632093+_0x58ba('0xa4'),{'UserId':_0x1ba387,['queueField']:_0x4a08fc[_0x344d58]['id']});}})[_0x58ba('0x1f')](respondWithStatusCode(_0x36228b,null))['catch'](APIHandleError(_0x36228b));};exports[_0x58ba('0x117')]=function(_0x51c80b,_0x50c21f){var _0x4257d6=_0x51c80b[_0x58ba('0x5b')]['id'];var _0x3f6b69=null;if(_0x51c80b['query'][_0x58ba('0x63')]){_0x3f6b69=_[_0x58ba('0x118')](_0x51c80b[_0x58ba('0x47')]['ids'])?_0x51c80b[_0x58ba('0x47')][_0x58ba('0x63')]:[_0x51c80b[_0x58ba('0x47')][_0x58ba('0x63')]];}var _0x2937eb=[];return Promise['resolve']()[_0x58ba('0x1f')](function(){if(!_0x3f6b69)throw new APIBadRequestError(_0x58ba('0x119'));})['then'](function(){return db[_0x58ba('0x3b')][_0x58ba('0x94')]({'where':{'id':_0x4257d6}});})[_0x58ba('0x1f')](function(_0x4dbd49){if(!_0x4dbd49)throw new APINotFoundError(util[_0x58ba('0xa9')](_0x58ba('0x10d'),_0x51c80b[_0x58ba('0x5b')]['id']));return db[_0x58ba('0x69')][_0x58ba('0x110')](function(_0x458139){return _0x4dbd49[_0x58ba('0x117')](_0x3f6b69,{'transaction':_0x458139})['then'](function(){return db[_0x58ba('0x112')][_0x58ba('0x4e')]({'where':{'id':{'$in':_0x3f6b69}}});})[_0x58ba('0x1f')](function(_0x13808a){var _0x566ac8=_[_0x58ba('0x33')](_0x13808a,function(_0x4cb3dd){return _0x4cb3dd['getAssociatedQueues']();});return Promise[_0x58ba('0x59')](_0x566ac8);})[_0x58ba('0x1f')](function(_0x14e1ae){_0x2937eb=_[_0x58ba('0x11a')](_0x14e1ae);var _0x92ac36=_[_0x58ba('0x33')](_0x2937eb,function(_0xef0177){return _0xef0177[_0x58ba('0x11b')](_0x4dbd49['id'],{'transaction':_0x458139});});return Promise['all'](_0x92ac36);})[_0x58ba('0x1f')](function(){if(!_0x4dbd49['online'])return;var _0x659fcc=_[_0x58ba('0xd6')](_0x2937eb,function(_0x10ba7d){return _0x10ba7d[_0x58ba('0x11c')](_0x58ba('0x98'))===_0x58ba('0x11d');});var _0x56b0f0=_[_0x58ba('0x33')](_0x659fcc,function(_0x3e90ff){return db[_0x58ba('0xae')]['destroy']({'where':{'VoiceQueueId':_0x3e90ff['id'],'UserId':_0x4dbd49['id']},'transaction':_0x458139});});return Promise['all'](_0x56b0f0);})[_0x58ba('0x1f')](function(){return db[_0x58ba('0x11e')][_0x58ba('0x4e')]({'where':{'teamId':{'$in':_0x3f6b69}}});})[_0x58ba('0x1f')](function(_0x352748){var _0x9f7abe=_[_0x58ba('0x33')](_0x352748,function(_0x5389c5){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x4dbd49['id'],'VoicePrefixId':_0x5389c5['VoicePrefixId']}},{'transaction':_0x458139});});return Promise['all'](_0x9f7abe);});});})['then'](function(){for(var _0x2c8bc6=0x0;_0x2c8bc6<_0x2937eb[_0x58ba('0x51')];_0x2c8bc6++){var _0x2f29d8=_0x2937eb[_0x2c8bc6][_0x58ba('0x11c')](_0x58ba('0x98'));var _0x1b5d2f=_0x2f29d8+_0x58ba('0xa2');socket[_0x58ba('0xa3')]('user'+_0x2f29d8+_0x58ba('0xad'),{'UserId':_0x4257d6,['queueField']:_0x2937eb[_0x2c8bc6]['id']});}})[_0x58ba('0x1f')](respondWithStatusCode(_0x50c21f,null))['catch'](APIHandleError(_0x50c21f));};exports[_0x58ba('0x11f')]=function(_0x524641,_0x5bc79f){var _0x408429={};var _0x52033d={};var _0x36b80e;var _0x1c076f;return db[_0x58ba('0x3b')][_0x58ba('0x94')]({'where':{'id':_0x524641['params']['id']}})['then'](handleEntityNotFound(_0x5bc79f,null))[_0x58ba('0x1f')](function(_0x192b95){if(_0x192b95){_0x36b80e=_0x192b95;_0x52033d[_0x58ba('0xce')]=_['keys'](db['CmList'][_0x58ba('0x3c')]);_0x52033d[_0x58ba('0x47')]=_[_0x58ba('0xcf')](_0x524641['query']);_0x52033d[_0x58ba('0xd1')]=_['intersection'](_0x52033d['model'],_0x52033d[_0x58ba('0x47')]);_0x408429[_0x58ba('0x4d')]=_[_0x58ba('0xd2')](_0x52033d[_0x58ba('0xce')],qs[_0x58ba('0xd3')](_0x524641[_0x58ba('0x47')]['fields']));_0x408429[_0x58ba('0x4d')]=_0x408429[_0x58ba('0x4d')][_0x58ba('0x51')]?_0x408429[_0x58ba('0x4d')]:_0x52033d['model'];_0x408429['order']=qs[_0x58ba('0xd4')](_0x524641[_0x58ba('0x47')][_0x58ba('0xd4')]);_0x408429[_0x58ba('0x46')]=qs[_0x58ba('0xd1')](_[_0x58ba('0xd5')](_0x524641[_0x58ba('0x47')],_0x52033d['filters']));if(_0x524641[_0x58ba('0x47')][_0x58ba('0xd6')]){_0x408429[_0x58ba('0x46')]=_[_0x58ba('0x5d')](_0x408429[_0x58ba('0x46')],{'$or':_[_0x58ba('0x33')](_0x408429[_0x58ba('0x4d')],function(_0x3baad6){var _0x59f8a8={};_0x59f8a8[_0x3baad6]={'$like':'%'+_0x524641[_0x58ba('0x47')][_0x58ba('0xd6')]+'%'};return _0x59f8a8;})});}_0x408429=_[_0x58ba('0x5d')]({},_0x408429,_0x524641['options']);return _0x36b80e[_0x58ba('0x11f')](_0x408429);}})[_0x58ba('0x1f')](function(_0x5b1bd6){if(_0x5b1bd6){_0x1c076f=_0x5b1bd6[_0x58ba('0x51')];if(!_0x524641[_0x58ba('0x47')][_0x58ba('0xc6')]('nolimit')){_0x408429[_0x58ba('0x1a')]=qs['limit'](_0x524641[_0x58ba('0x47')][_0x58ba('0x1a')]);_0x408429[_0x58ba('0x18')]=qs[_0x58ba('0x18')](_0x524641[_0x58ba('0x47')][_0x58ba('0x18')]);}return _0x36b80e[_0x58ba('0x11f')](_0x408429);}})[_0x58ba('0x1f')](function(_0x36afa2){if(_0x36afa2){return _0x36afa2?{'count':_0x1c076f,'rows':_0x36afa2}:null;}})[_0x58ba('0x1f')](respondWithResult(_0x5bc79f,null))[_0x58ba('0x26')](handleError(_0x5bc79f,null));};exports[_0x58ba('0x120')]=function(_0x1aa5a0,_0x1f76fd){var _0x3be497={};var _0x1983f2={};var _0x24697a;return db[_0x58ba('0x3b')]['findOne']({'where':{'id':_0x1aa5a0[_0x58ba('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1f76fd,null))[_0x58ba('0x1f')](function(_0x199fcb){if(_0x199fcb){_0x24697a=_0x199fcb;_0x1983f2['model']=_['keys'](db[_0x58ba('0x3b')][_0x58ba('0x3c')]);_0x1983f2['query']=_[_0x58ba('0xcf')](_0x1aa5a0['query']);_0x1983f2['filters']=_['intersection'](_0x1983f2[_0x58ba('0xce')],_0x1983f2[_0x58ba('0x47')]);_0x3be497[_0x58ba('0x4d')]=_['intersection'](_0x1983f2[_0x58ba('0xce')],qs['fields'](_0x1aa5a0[_0x58ba('0x47')][_0x58ba('0xd3')]));_0x3be497[_0x58ba('0x4d')]=_0x3be497[_0x58ba('0x4d')][_0x58ba('0x51')]?_0x3be497[_0x58ba('0x4d')]:_0x1983f2[_0x58ba('0xce')];_0x3be497[_0x58ba('0xda')]=qs[_0x58ba('0xd4')](_0x1aa5a0[_0x58ba('0x47')][_0x58ba('0xd4')]);_0x3be497[_0x58ba('0x46')]=qs['filters'](_[_0x58ba('0xd5')](_0x1aa5a0[_0x58ba('0x47')],_0x1983f2[_0x58ba('0xd1')]));if(_0x1aa5a0['query'][_0x58ba('0xd6')]){_0x3be497[_0x58ba('0x46')]=_[_0x58ba('0x5d')](_0x3be497[_0x58ba('0x46')],{'$or':_[_0x58ba('0x33')](_0x3be497['attributes'],function(_0x8c1ade){var _0x5302c2={};_0x5302c2[_0x8c1ade]={'$like':'%'+_0x1aa5a0['query'][_0x58ba('0xd6')]+'%'};return _0x5302c2;})});}_0x3be497[_0x58ba('0xce')]=db[_0x58ba('0x3b')];_0x3be497['as']='Agents';_0x3be497=_[_0x58ba('0x5d')]({},_0x3be497,_0x1aa5a0[_0x58ba('0x5e')]);return _0x24697a[_0x58ba('0x121')]({'include':[_0x3be497]});}})[_0x58ba('0x1f')](function(_0x8bb281){if(_0x8bb281){var _0x443f9c={},_0x305d8d=[];for(var _0x4790e1=0x0;_0x4790e1<_0x8bb281[_0x58ba('0x51')];_0x4790e1+=0x1){for(var _0x1250af=0x0,_0x4ddbe2;_0x1250af<_0x8bb281[_0x4790e1][_0x58ba('0x2f')][_0x58ba('0x51')];_0x1250af+=0x1){_0x4ddbe2=_0x8bb281[_0x4790e1][_0x58ba('0x2f')][_0x1250af][_0x58ba('0x2b')]({'plain':!![]});_0x443f9c[_0x4ddbe2['id']]=_0x4ddbe2;}}_0x443f9c=_['values'](_0x443f9c);for(var _0x44ab10=qs[_0x58ba('0x18')](_0x1aa5a0[_0x58ba('0x47')]['offset']);_0x44ab10<_0x443f9c[_0x58ba('0x51')]&&_0x305d8d[_0x58ba('0x51')]=_0xf6e90b[_0x46ef('0x4c')]){throw new Error(_0x46ef('0x4d'));}})[_0x46ef('0x16')](function(){if(_0x58c464){return db[_0x46ef('0x24')][_0x46ef('0x4e')]({'where':{'membername':_0x58c464[_0x46ef('0x20')]},'individualHooks':!![]});}})[_0x46ef('0x16')](function(){if(_0x58c464){return _0x58c464['getVoiceQueues']({'raw':!![]});}})[_0x46ef('0x16')](function(_0x4c3960){if(_0x58c464){if(_0x4c3960){var _0x18c5a2=[];_0x4eec8f=_0x4c3960;if(_0x4eec8f[_0x46ef('0x27')]){for(var _0x13ccd8=0x0;_0x13ccd8<_0x4eec8f[_0x46ef('0x27')];_0x13ccd8++){_0x18c5a2[_0x46ef('0x2b')](db[_0x46ef('0x24')][_0x46ef('0x4f')]({'membername':_0x58c464['name'],'UserId':_0x58c464['id'],'queue_name':_0x4eec8f[_0x13ccd8][_0x46ef('0x20')],'VoiceQueueId':_0x4eec8f[_0x13ccd8]['id'],'interface':_0x5a1749,'paused':_0x58c464[_0x46ef('0x47')]||![],'penalty':_0x4eec8f[_0x13ccd8][_0x46ef('0x50')]||0x0}));}return BPromise[_0x46ef('0x44')](_0x18c5a2);}}}})[_0x46ef('0x16')](function(){if(_0x58c464){return db[_0x46ef('0x26')]['findAll']({'where':{'membername':_0x58c464['name'],'exitAt':null}});}})[_0x46ef('0x16')](function(_0x23ba6b){if(_0x58c464){if(_0x23ba6b&&_0x23ba6b[_0x46ef('0x27')]){var _0x396a3d=[];_0x23ba6b[_0x46ef('0x2a')](function(_0x2a54a3){_0x396a3d[_0x46ef('0x2b')](_0x2a54a3[_0x46ef('0x25')]({'exitAt':moment()[_0x46ef('0x23')](_0x46ef('0x28'))}));});return BPromise[_0x46ef('0x44')](_0x396a3d);}}})[_0x46ef('0x16')](function(){if(_0x58c464){var _0x265565=[];var _0x4ca764=[];var _0x169d8a=utils[_0x46ef('0x29')]();var _0x9b3ef0={'membername':_0x58c464['name'],'interface':_0x5a1749,'enterAt':moment()[_0x46ef('0x23')](_0x46ef('0x28')),'role':_0x58c464[_0x46ef('0x21')],'internal':_0x58c464[_0x46ef('0x22')]};_0x169d8a[_0x46ef('0x2a')](function(_0x519eeb){_0x265565['push'](_[_0x46ef('0x51')]({'channel':_0x519eeb,'type':_0x46ef('0x52'),'data1':_0x46ef('0x53'),'data2':_0x5a1749},_0x9b3ef0));if(_0x58c464[_0x46ef('0x47')]){_0x4ca764[_0x46ef('0x2b')](_[_0x46ef('0x51')]({'channel':_0x519eeb,'type':_0x46ef('0x54'),'data1':_0x46ef('0x55')},_0x9b3ef0));}});return db['MemberReport'][_0x46ef('0x33')](_0x265565['concat'](_0x4ca764),{'individualHooks':!![]});}})[_0x46ef('0x16')](function(){if(_0x58c464){return _0x58c464[_0x46ef('0x25')]({'online':!![],'lastLoginAt':moment()[_0x46ef('0x23')](_0x46ef('0x28')),'voicePause':_0x58c464[_0x46ef('0x47')]||![],'mailPause':_0x58c464[_0x46ef('0x47')]||![],'chatPause':_0x58c464['loginInPause']||![],'faxPause':_0x58c464[_0x46ef('0x47')]||![],'smsPause':_0x58c464[_0x46ef('0x47')]||![],'openchannelPause':_0x58c464[_0x46ef('0x47')]||![],'pauseType':_0x58c464[_0x46ef('0x47')]?_0x46ef('0x55'):null,'lastPauseAt':moment()[_0x46ef('0x23')](_0x46ef('0x28')),'interface':_0x5a1749});}})[_0x46ef('0x16')](function(_0x1a83f2){_0x5c2480(_0x1a83f2);})[_0x46ef('0x1e')](function(_0x4f187e){_0x46fd4f(_0x5a645b['error'](0x1f4,_0x4f187e[_0x46ef('0x1c')]));});});}; \ No newline at end of file +var _0x129c=['length','updateAttributes','getChannels','forEach','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','DEFAULT\x20PAUSE','uniqueid','bulkCreate','type','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','unpause','system','LogoutUser','MemberReport','push','phone','internal','loginInPause','agent','../../config/license/util','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','UserVoiceQueue.penalty','all','merge','LOGIN','LOGININPAUSE','concat','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./user.socket','register','GetUser','User','raw','options','where','attributes','limit','include','map','model','info','stringify','catch','error','message','ShowUser','then','debug','find','name','role','format','params','UserVoiceQueueRt','update','findAll','PAUSE'];(function(_0x2106f9,_0x4cc28b){var _0x5d2286=function(_0x4737b2){while(--_0x4737b2){_0x2106f9['push'](_0x2106f9['shift']());}};_0x5d2286(++_0x4cc28b);}(_0x129c,0xcf));var _0xc129=function(_0x20f072,_0x37d9cf){_0x20f072=_0x20f072-0x0;var _0x25ebd0=_0x129c[_0x20f072];return _0x25ebd0;};'use strict';var _=require('lodash');var util=require(_0xc129('0x0'));var moment=require(_0xc129('0x1'));var BPromise=require('bluebird');var Redis=require(_0xc129('0x2'));var db=require(_0xc129('0x3'))['db'];var utils=require(_0xc129('0x4'));var logger=require(_0xc129('0x5'))('rpc');var config=require(_0xc129('0x6'));config[_0xc129('0x7')]=_[_0xc129('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc129('0x9'))(new Redis(config[_0xc129('0x7')]));require(_0xc129('0xa'))[_0xc129('0xb')](socket);exports[_0xc129('0xc')]=function(_0x562bf6){var _0x259ca7=this;return new Promise(function(_0x455970,_0xbd6efe){return db[_0xc129('0xd')]['findAll']({'raw':_0x562bf6['options']?_0x562bf6['options'][_0xc129('0xe')]===undefined?!![]:![]:!![],'where':_0x562bf6[_0xc129('0xf')]?_0x562bf6['options'][_0xc129('0x10')]||null:null,'attributes':_0x562bf6[_0xc129('0xf')]?_0x562bf6['options'][_0xc129('0x11')]||null:null,'limit':_0x562bf6['options']?_0x562bf6[_0xc129('0xf')][_0xc129('0x12')]||null:null,'include':_0x562bf6['options']?_0x562bf6['options'][_0xc129('0x13')]?_[_0xc129('0x14')](_0x562bf6[_0xc129('0xf')][_0xc129('0x13')],function(_0x13d5b0){return{'model':db[_0x13d5b0[_0xc129('0x15')]],'as':_0x13d5b0['as'],'attributes':_0x13d5b0['attributes'],'include':_0x13d5b0['include']?_[_0xc129('0x14')](_0x13d5b0[_0xc129('0x13')],function(_0x100f1f){return{'model':db[_0x100f1f[_0xc129('0x15')]],'as':_0x100f1f['as'],'attributes':_0x100f1f['attributes'],'include':_0x100f1f[_0xc129('0x13')]?_['map'](_0x100f1f[_0xc129('0x13')],function(_0x59cada){return{'model':db[_0x59cada[_0xc129('0x15')]],'as':_0x59cada['as'],'attributes':_0x59cada[_0xc129('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56fb17){logger[_0xc129('0x16')](_0xc129('0xc'),_0x562bf6);logger['debug'](_0xc129('0xc'),_0x562bf6,JSON[_0xc129('0x17')](_0x56fb17));_0x455970(_0x56fb17);})[_0xc129('0x18')](function(_0x42d8ce){logger[_0xc129('0x19')](_0xc129('0xc'),_0x42d8ce['message'],_0x562bf6);_0xbd6efe(_0x259ca7[_0xc129('0x19')](0x1f4,_0x42d8ce[_0xc129('0x1a')]));});});};exports[_0xc129('0x1b')]=function(_0x429e2c){var _0x3d9957=this;return new Promise(function(_0x5db046,_0x17cb80){return db[_0xc129('0xd')]['find']({'raw':_0x429e2c[_0xc129('0xf')]?_0x429e2c[_0xc129('0xf')]['raw']===undefined?!![]:![]:!![],'where':_0x429e2c[_0xc129('0xf')]?_0x429e2c[_0xc129('0xf')][_0xc129('0x10')]||null:null,'attributes':_0x429e2c[_0xc129('0xf')]?_0x429e2c[_0xc129('0xf')]['attributes']||null:null,'include':_0x429e2c[_0xc129('0xf')]?_0x429e2c[_0xc129('0xf')][_0xc129('0x13')]?_[_0xc129('0x14')](_0x429e2c['options'][_0xc129('0x13')],function(_0x1d98da){return{'model':db[_0x1d98da[_0xc129('0x15')]],'as':_0x1d98da['as'],'attributes':_0x1d98da[_0xc129('0x11')],'include':_0x1d98da[_0xc129('0x13')]?_[_0xc129('0x14')](_0x1d98da['include'],function(_0x29ea03){return{'model':db[_0x29ea03[_0xc129('0x15')]],'as':_0x29ea03['as'],'attributes':_0x29ea03[_0xc129('0x11')],'include':_0x29ea03['include']?_[_0xc129('0x14')](_0x29ea03[_0xc129('0x13')],function(_0x4eca76){return{'model':db[_0x4eca76[_0xc129('0x15')]],'as':_0x4eca76['as'],'attributes':_0x4eca76[_0xc129('0x11')]};}):[]};}):[]};}):[]:[]})[_0xc129('0x1c')](function(_0x2f714d){logger[_0xc129('0x16')](_0xc129('0x1b'),_0x429e2c);logger[_0xc129('0x1d')](_0xc129('0x1b'),_0x429e2c,JSON[_0xc129('0x17')](_0x2f714d));_0x5db046(_0x2f714d);})[_0xc129('0x18')](function(_0x2be5ea){logger[_0xc129('0x19')](_0xc129('0x1b'),_0x2be5ea[_0xc129('0x1a')],_0x429e2c);_0x17cb80(_0x3d9957[_0xc129('0x19')](0x1f4,_0x2be5ea['message']));});});};exports['PauseUser']=function(_0xd8b19e){var _0x3cbb5d;return db[_0xc129('0xd')][_0xc129('0x1e')]({'where':_0xd8b19e['options'][_0xc129('0x10')]||{},'attributes':['id',_0xc129('0x1f'),_0xc129('0x20'),'internal','interface']})[_0xc129('0x1c')](function(_0x54c2dd){if(!_0x54c2dd){throw new Error(util[_0xc129('0x21')]('User\x20with\x20id\x20%s\x20not\x20found',_0xd8b19e[_0xc129('0x22')]['id']));}_0x3cbb5d=_0x54c2dd;return db[_0xc129('0x23')][_0xc129('0x24')]({'paused':0x1},{'where':{'UserId':_0x3cbb5d['id']},'individualHooks':!![]});})[_0xc129('0x1c')](function(){return db['MemberReport'][_0xc129('0x25')]({'where':{'membername':_0x3cbb5d[_0xc129('0x1f')],'type':_0xc129('0x26'),'exitAt':null}});})[_0xc129('0x1c')](function(_0x15afec){if(_0x15afec&&_0x15afec[_0xc129('0x27')]){var _0x3216aa=moment()[_0xc129('0x21')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x488a72=0x0,_0x4841dc=_0x15afec[_0xc129('0x27')];_0x488a72<_0x4841dc;_0x488a72++){_0x15afec[_0x488a72][_0xc129('0x28')]({'exitAt':_0x3216aa});}}})[_0xc129('0x1c')](function(){var _0x576030=[];var _0x5274dc=utils[_0xc129('0x29')]();_0x5274dc[_0xc129('0x2a')](function(_0xd58859){_0x576030['push']({'channel':_0xd58859,'membername':_0x3cbb5d['name'],'interface':_['isNil'](_0x3cbb5d[_0xc129('0x2b')])?util[_0xc129('0x21')](_0xc129('0x2c'),_0x3cbb5d[_0xc129('0x1f')]):_0x3cbb5d[_0xc129('0x2b')],'type':_0xc129('0x26'),'enterAt':moment()[_0xc129('0x21')](_0xc129('0x2d')),'data1':_0xd8b19e[_0xc129('0x2e')]['type']||_0xc129('0x2f'),'role':_0x3cbb5d['role'],'internal':_0x3cbb5d['internal'],'uniqueid':_0xd8b19e[_0xc129('0x2e')][_0xc129('0x30')]||null});});return db['MemberReport'][_0xc129('0x31')](_0x576030,{'individualHooks':!![]});})[_0xc129('0x1c')](function(){return _0x3cbb5d['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xd8b19e['body'][_0xc129('0x32')]||_0xc129('0x2f'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xc129('0x18')](function(_0x4c78e1){throw _0x4c78e1;});};exports[_0xc129('0x33')]=function(_0x11fe8b){return Promise[_0xc129('0x34')]()[_0xc129('0x1c')](function(){if(_0x11fe8b[_0xc129('0x2e')][_0xc129('0x35')]&&!utils[_0xc129('0x36')](_0x11fe8b[_0xc129('0x2e')][_0xc129('0x35')])){throw new Error(util[_0xc129('0x21')](_0xc129('0x37'),_0x11fe8b[_0xc129('0x2e')]['channel']));}return db['User'][_0xc129('0x38')]({'where':_0x11fe8b['options'][_0xc129('0x10')]||{},'attributes':['id',_0xc129('0x1f'),_0xc129('0x20'),'internal',_0xc129('0x2b'),_0xc129('0x39'),'voicePause',_0xc129('0x3a'),_0xc129('0x3b'),_0xc129('0x3c'),_0xc129('0x3d'),_0xc129('0x3e'),'whatsappPause',_0xc129('0x3f'),'lastPauseAt']});})[_0xc129('0x1c')](function(_0x23d965){if(!_0x23d965){throw new Error(util[_0xc129('0x21')]('User\x20with\x20id\x20%s\x20not\x20found',_0x11fe8b[_0xc129('0x22')]['id']));}return _0x23d965[_0xc129('0x40')](_0x11fe8b[_0xc129('0x2e')]['channel'],_0xc129('0x41'));})[_0xc129('0x18')](function(_0x188a34){throw _0x188a34;});};exports[_0xc129('0x42')]=function(_0x2bc2dd){var _0x13a299=this;return new Promise(function(_0x1a4c15,_0x31b8b3){var _0x53f746;return db['User'][_0xc129('0x38')]({'where':_0x2bc2dd[_0xc129('0xf')][_0xc129('0x10')]||{},'attributes':['id',_0xc129('0x1f')]})[_0xc129('0x1c')](function(_0x831897){if(_0x831897){_0x53f746=_0x831897;return db[_0xc129('0x23')]['destroy']({'where':{'membername':_0x53f746[_0xc129('0x1f')]},'individualHooks':!![]});}})[_0xc129('0x1c')](function(){if(_0x53f746){return db[_0xc129('0x43')][_0xc129('0x25')]({'where':{'membername':_0x53f746[_0xc129('0x1f')],'exitAt':null}});}})[_0xc129('0x1c')](function(_0x4a7330){if(_0x53f746){if(_0x4a7330&&_0x4a7330[_0xc129('0x27')]){var _0x4e57ef=[];_0x4a7330['forEach'](function(_0x2bb412){_0x4e57ef[_0xc129('0x44')](_0x2bb412['update']({'exitAt':moment()[_0xc129('0x21')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x4e57ef);}}})[_0xc129('0x1c')](function(){if(_0x53f746){return _0x53f746[_0xc129('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x44c23f){_0x1a4c15(_0x44c23f);})[_0xc129('0x18')](function(_0xbed5a){_0x31b8b3(_0x13a299[_0xc129('0x19')](0x1f4,_0xbed5a[_0xc129('0x1a')]));});});};exports['LoginUser']=function(_0x57b822){var _0x4337f7=this;return new Promise(function(_0x2e7808,_0x4e64bc){var _0x127be4;var _0x95499;var _0x21aa2e;var _0x55f957;return db['User'][_0xc129('0x38')]({'where':_0x57b822[_0xc129('0xf')][_0xc129('0x10')]||{},'attributes':['id',_0xc129('0x1f'),_0xc129('0x20'),'mobile',_0xc129('0x45'),_0xc129('0x46'),_0xc129('0x47'),_0xc129('0x2b')]})['then'](function(_0x29afc4){if(_0x29afc4){_0x127be4=_0x29afc4;_0x55f957=_0x57b822['body'][_0xc129('0x2b')]?_0x57b822[_0xc129('0x2e')][_0xc129('0x2b')]:util[_0xc129('0x21')]('SIP/%s',_0x127be4['name']);return db[_0xc129('0xd')]['count']({'where':{'role':_0xc129('0x48'),'online':!![],'id':{'$ne':_0x127be4['id']}}});}})[_0xc129('0x1c')](function(_0x5edb34){if(_0x5edb34){_0x21aa2e=_0x5edb34;return require(_0xc129('0x49'))['getLicense']();}})[_0xc129('0x1c')](function(_0xddacee){if(_0xddacee&&_0xddacee['agents']&&_0x21aa2e>=_0xddacee['agents']){throw new Error(_0xc129('0x4a'));}})[_0xc129('0x1c')](function(){if(_0x127be4){return db[_0xc129('0x23')]['destroy']({'where':{'membername':_0x127be4[_0xc129('0x1f')]},'individualHooks':!![]});}})[_0xc129('0x1c')](function(){if(_0x127be4){return _0x127be4[_0xc129('0x4b')]({'raw':!![]});}})[_0xc129('0x1c')](function(_0xbc7da3){if(_0x127be4){if(_0xbc7da3){var _0xff5d9=[];_0x95499=_0xbc7da3;if(_0x95499[_0xc129('0x27')]){for(var _0x166370=0x0;_0x166370<_0x95499[_0xc129('0x27')];_0x166370++){_0xff5d9['push'](db[_0xc129('0x23')]['upsert']({'membername':_0x127be4[_0xc129('0x1f')],'UserId':_0x127be4['id'],'queue_name':_0x95499[_0x166370][_0xc129('0x1f')],'VoiceQueueId':_0x95499[_0x166370]['id'],'interface':_0x55f957,'paused':_0x127be4['loginInPause']||![],'penalty':_0x95499[_0x166370][_0xc129('0x4c')]||0x0}));}return BPromise[_0xc129('0x4d')](_0xff5d9);}}}})['then'](function(){if(_0x127be4){return db[_0xc129('0x43')][_0xc129('0x25')]({'where':{'membername':_0x127be4[_0xc129('0x1f')],'exitAt':null}});}})['then'](function(_0x30a278){if(_0x127be4){if(_0x30a278&&_0x30a278[_0xc129('0x27')]){var _0x45ad04=[];_0x30a278[_0xc129('0x2a')](function(_0x519115){_0x45ad04['push'](_0x519115[_0xc129('0x24')]({'exitAt':moment()[_0xc129('0x21')](_0xc129('0x2d'))}));});return BPromise[_0xc129('0x4d')](_0x45ad04);}}})[_0xc129('0x1c')](function(){if(_0x127be4){var _0x3300e0=[];var _0x3e8630=[];var _0xff772c=utils[_0xc129('0x29')]();var _0x2c16c7={'membername':_0x127be4['name'],'interface':_0x55f957,'enterAt':moment()[_0xc129('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x127be4[_0xc129('0x20')],'internal':_0x127be4['internal']};_0xff772c['forEach'](function(_0x536baa){_0x3300e0['push'](_[_0xc129('0x4e')]({'channel':_0x536baa,'type':_0xc129('0x4f'),'data1':'callysquare','data2':_0x55f957},_0x2c16c7));if(_0x127be4['loginInPause']){_0x3e8630[_0xc129('0x44')](_[_0xc129('0x4e')]({'channel':_0x536baa,'type':_0xc129('0x26'),'data1':_0xc129('0x50')},_0x2c16c7));}});return db['MemberReport'][_0xc129('0x31')](_0x3300e0[_0xc129('0x51')](_0x3e8630),{'individualHooks':!![]});}})['then'](function(){if(_0x127be4){return _0x127be4[_0xc129('0x24')]({'online':!![],'lastLoginAt':moment()[_0xc129('0x21')](_0xc129('0x2d')),'voicePause':_0x127be4[_0xc129('0x47')]||![],'mailPause':_0x127be4[_0xc129('0x47')]||![],'chatPause':_0x127be4[_0xc129('0x47')]||![],'faxPause':_0x127be4[_0xc129('0x47')]||![],'smsPause':_0x127be4[_0xc129('0x47')]||![],'openchannelPause':_0x127be4[_0xc129('0x47')]||![],'pauseType':_0x127be4['loginInPause']?_0xc129('0x50'):null,'lastPauseAt':moment()['format'](_0xc129('0x2d')),'interface':_0x55f957});}})['then'](function(_0x1f3e8d){_0x2e7808(_0x1f3e8d);})[_0xc129('0x18')](function(_0x859b80){_0x4e64bc(_0x4337f7['error'](0x1f4,_0x859b80[_0xc129('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index c343e4a..177a2f4 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 _0xbf98=['user:','./user.events','save','remove','update','emit','length'];(function(_0x2a2607,_0x52b66c){var _0x8fd2ab=function(_0x46d5b3){while(--_0x46d5b3){_0x2a2607['push'](_0x2a2607['shift']());}};_0x8fd2ab(++_0x52b66c);}(_0xbf98,0x13c));var _0x8bf9=function(_0x3e801b,_0x3dab77){_0x3e801b=_0x3e801b-0x0;var _0x47856c=_0xbf98[_0x3e801b];return _0x47856c;};'use strict';var UserEvents=require(_0x8bf9('0x0'));var events=[_0x8bf9('0x1'),_0x8bf9('0x2'),_0x8bf9('0x3')];function createListener(_0x52e9c2,_0x14ea12){return function(_0x22d440){_0x14ea12[_0x8bf9('0x4')](_0x52e9c2,_0x22d440);};}function removeListener(_0x1933c9,_0x49d779){return function(){UserEvents['removeListener'](_0x1933c9,_0x49d779);};}exports['register']=function(_0x537813){for(var _0x4a6d81=0x0,_0x432a99=events[_0x8bf9('0x5')];_0x4a6d81<_0x432a99;_0x4a6d81++){var _0x593578=events[_0x4a6d81];var _0x41b7fa=createListener(_0x8bf9('0x6')+_0x593578,_0x537813);UserEvents['on'](_0x593578,_0x41b7fa);}}; \ No newline at end of file +var _0xa3e4=['remove','update','emit','removeListener','register','length','user:','save'];(function(_0x2f96c2,_0x3e1f5b){var _0x2571d6=function(_0x25c2ee){while(--_0x25c2ee){_0x2f96c2['push'](_0x2f96c2['shift']());}};_0x2571d6(++_0x3e1f5b);}(_0xa3e4,0x1bf));var _0x4a3e=function(_0x197954,_0x3f61d0){_0x197954=_0x197954-0x0;var _0x231d54=_0xa3e4[_0x197954];return _0x231d54;};'use strict';var UserEvents=require('./user.events');var events=[_0x4a3e('0x0'),_0x4a3e('0x1'),_0x4a3e('0x2')];function createListener(_0x4c451d,_0x205617){return function(_0x43c969){_0x205617[_0x4a3e('0x3')](_0x4c451d,_0x43c969);};}function removeListener(_0x3d21e0,_0x4fbcb7){return function(){UserEvents[_0x4a3e('0x4')](_0x3d21e0,_0x4fbcb7);};}exports[_0x4a3e('0x5')]=function(_0x511e9c){for(var _0x1b1e8f=0x0,_0x4db1ef=events[_0x4a3e('0x6')];_0x1b1e8f<_0x4db1ef;_0x1b1e8f++){var _0x348b33=events[_0x1b1e8f];var _0x19e49b=createListener(_0x4a3e('0x7')+_0x348b33,_0x511e9c);UserEvents['on'](_0x348b33,_0x19e49b);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 95fab3e..6e024d9 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x310196,_0x2e76d7){var _0x35aa0a=function(_0x468dfc){while(--_0x468dfc){_0x310196['push'](_0x310196['shift']());}};_0x35aa0a(++_0x2e76d7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x233ec7,_0x7e1847){var _0x328648=function(_0x3a617f){while(--_0x3a617f){_0x233ec7['push'](_0x233ec7['shift']());}};_0x328648(++_0x7e1847);}(_0x70e0,0x17b));var _0x070e=function(_0x37d7ca,_0x473c37){_0x37d7ca=_0x37d7ca-0x0;var _0x1e91de=_0x70e0[_0x37d7ca];return _0x1e91de;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index acebdf2..4240e45 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 _0x3600=['INTEGER','sequelize'];(function(_0x96e50e,_0xa067bf){var _0x2baeaa=function(_0x390ba3){while(--_0x390ba3){_0x96e50e['push'](_0x96e50e['shift']());}};_0x2baeaa(++_0xa067bf);}(_0x3600,0x13f));var _0x0360=function(_0x24ff76,_0x2d0563){_0x24ff76=_0x24ff76-0x0;var _0x178bc4=_0x3600[_0x24ff76];return _0x178bc4;};'use strict';var Sequelize=require(_0x0360('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0360('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1156=['sequelize','INTEGER'];(function(_0x4bb566,_0x407512){var _0x200aa0=function(_0x3b7ee2){while(--_0x3b7ee2){_0x4bb566['push'](_0x4bb566['shift']());}};_0x200aa0(++_0x407512);}(_0x1156,0x1a8));var _0x6115=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x1156[_0x4e5552];return _0x60a338;};'use strict';var Sequelize=require(_0x6115('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6115('0x1')],'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 529bace..825db79 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 _0xc374=['exports','define','user_has_chat_queues','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xc374,0xd4));var _0x4c37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc374[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4c37('0x0'));var logger=require(_0x4c37('0x1'))('api');var moment=require(_0x4c37('0x2'));var BPromise=require(_0x4c37('0x3'));var rp=require(_0x4c37('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c37('0x5'));var config=require(_0x4c37('0x6'));var attributes=require(_0x4c37('0x7'));module[_0x4c37('0x8')]=function(_0x4a83c9,_0x327ec2){return _0x4a83c9[_0x4c37('0x9')]('UserChatQueue',attributes,{'tableName':_0x4c37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5329=['rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x5329,0x172));var _0x9532=function(_0x447275,_0x3f22fc){_0x447275=_0x447275-0x0;var _0x46264a=_0x5329[_0x447275];return _0x46264a;};'use strict';var _=require(_0x9532('0x0'));var util=require(_0x9532('0x1'));var logger=require(_0x9532('0x2'))(_0x9532('0x3'));var moment=require(_0x9532('0x4'));var BPromise=require(_0x9532('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9532('0x6'));var rimraf=require(_0x9532('0x7'));var config=require(_0x9532('0x8'));var attributes=require(_0x9532('0x9'));module[_0x9532('0xa')]=function(_0x588c94,_0x560ed3){return _0x588c94['define'](_0x9532('0xb'),attributes,{'tableName':_0x9532('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 4d5e428..7cbffeb 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 _0x3bb5=['code','UserChatQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3bb5,0x13a));var _0x53bb=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x3bb5[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x53bb('0x0'));var util=require(_0x53bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x53bb('0x2'));var fs=require('fs');var Redis=require(_0x53bb('0x3'));var db=require(_0x53bb('0x4'))['db'];var utils=require(_0x53bb('0x5'));var logger=require(_0x53bb('0x6'))('rpc');var config=require(_0x53bb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x53bb('0x8')][_0x53bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2968ee,_0x3f69fc,_0x1f757b){return new BPromise(function(_0x58fd2f,_0x279f67){return client[_0x53bb('0xa')](_0x2968ee,_0x1f757b)[_0x53bb('0xb')](function(_0x89259d){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x3f69fc,_0x53bb('0xc'));logger[_0x53bb('0xd')](_0x53bb('0xe'),_0x3f69fc,_0x53bb('0xc'),JSON['stringify'](_0x89259d));if(_0x89259d[_0x53bb('0xf')]){if(_0x89259d[_0x53bb('0xf')][_0x53bb('0x10')]===0x1f4){logger[_0x53bb('0xf')](_0x53bb('0x11'),_0x3f69fc,_0x89259d['error'][_0x53bb('0x12')]);return _0x279f67(_0x89259d['error'][_0x53bb('0x12')]);}logger[_0x53bb('0xf')](_0x53bb('0x11'),_0x3f69fc,_0x89259d['error'][_0x53bb('0x12')]);return _0x58fd2f(_0x89259d['error'][_0x53bb('0x12')]);}else{logger[_0x53bb('0x13')](_0x53bb('0x11'),_0x3f69fc,'request\x20sent');_0x58fd2f(_0x89259d[_0x53bb('0x14')][_0x53bb('0x12')]);}})[_0x53bb('0x15')](function(_0x538792){logger[_0x53bb('0xf')](_0x53bb('0x11'),_0x3f69fc,_0x538792);_0x279f67(_0x538792);});});} \ No newline at end of file +var _0xabde=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4de7d7,_0x480ca5){var _0x4b06e8=function(_0x23b3c4){while(--_0x23b3c4){_0x4de7d7['push'](_0x4de7d7['shift']());}};_0x4b06e8(++_0x480ca5);}(_0xabde,0xab));var _0xeabd=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xabde[_0xe39824];return _0x4bc31e;};'use strict';var _=require('lodash');var util=require(_0xeabd('0x0'));var moment=require(_0xeabd('0x1'));var BPromise=require(_0xeabd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeabd('0x3'));var db=require(_0xeabd('0x4'))['db'];var utils=require(_0xeabd('0x5'));var logger=require(_0xeabd('0x6'))(_0xeabd('0x7'));var config=require('../../config/environment');var jayson=require(_0xeabd('0x8'));var client=jayson[_0xeabd('0x9')][_0xeabd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x116e94,_0x3aa8e6,_0x1cd717){return new BPromise(function(_0x11feb8,_0x5b195a){return client[_0xeabd('0xb')](_0x116e94,_0x1cd717)[_0xeabd('0xc')](function(_0x191804){logger['info'](_0xeabd('0xd'),_0x3aa8e6,_0xeabd('0xe'));logger[_0xeabd('0xf')](_0xeabd('0x10'),_0x3aa8e6,_0xeabd('0xe'),JSON[_0xeabd('0x11')](_0x191804));if(_0x191804[_0xeabd('0x12')]){if(_0x191804[_0xeabd('0x12')]['code']===0x1f4){logger[_0xeabd('0x12')](_0xeabd('0xd'),_0x3aa8e6,_0x191804['error'][_0xeabd('0x13')]);return _0x5b195a(_0x191804[_0xeabd('0x12')][_0xeabd('0x13')]);}logger[_0xeabd('0x12')](_0xeabd('0xd'),_0x3aa8e6,_0x191804[_0xeabd('0x12')][_0xeabd('0x13')]);return _0x11feb8(_0x191804['error']['message']);}else{logger[_0xeabd('0x14')](_0xeabd('0xd'),_0x3aa8e6,_0xeabd('0xe'));_0x11feb8(_0x191804['result'][_0xeabd('0x13')]);}})[_0xeabd('0x15')](function(_0x3bb7ee){logger[_0xeabd('0x12')](_0xeabd('0xd'),_0x3aa8e6,_0x3bb7ee);_0x5b195a(_0x3bb7ee);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 9e1b75e..0473df5 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(_0x36bff5,_0x3156cb){var _0x80ade5=function(_0x5eee65){while(--_0x5eee65){_0x36bff5['push'](_0x36bff5['shift']());}};_0x80ade5(++_0x3156cb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3d391b,_0x139db6){var _0x34adb6=function(_0x464b1e){while(--_0x464b1e){_0x3d391b['push'](_0x3d391b['shift']());}};_0x34adb6(++_0x139db6);}(_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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 80648c4..cfd7ab3 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 _0x704c=['sequelize','exports','INTEGER'];(function(_0x5f3fcd,_0x53f367){var _0x444ec2=function(_0x1a65ea){while(--_0x1a65ea){_0x5f3fcd['push'](_0x5f3fcd['shift']());}};_0x444ec2(++_0x53f367);}(_0x704c,0xb7));var _0xc704=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0x704c[_0x2ef44b];return _0x2405b9;};'use strict';var Sequelize=require(_0xc704('0x0'));module[_0xc704('0x1')]={'penalty':{'type':Sequelize[_0xc704('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3f4c=['INTEGER','exports'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x3f4c,0x15d));var _0xc3f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f4c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc3f4('0x0')]={'penalty':{'type':Sequelize[_0xc3f4('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc3f4('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5c09715..b34bb0f 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 _0x2f01=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserFaxQueue','user_has_fax_queues','lodash','api'];(function(_0x3b7c80,_0x5d55d1){var _0x5611a5=function(_0xa63a2){while(--_0xa63a2){_0x3b7c80['push'](_0x3b7c80['shift']());}};_0x5611a5(++_0x5d55d1);}(_0x2f01,0x1a2));var _0x12f0=function(_0xf7aef7,_0x4d2c5a){_0xf7aef7=_0xf7aef7-0x0;var _0x5cf076=_0x2f01[_0xf7aef7];return _0x5cf076;};'use strict';var _=require(_0x12f0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x12f0('0x1'));var moment=require(_0x12f0('0x2'));var BPromise=require(_0x12f0('0x3'));var rp=require(_0x12f0('0x4'));var fs=require('fs');var path=require(_0x12f0('0x5'));var rimraf=require(_0x12f0('0x6'));var config=require(_0x12f0('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x12f0('0x8')]=function(_0x4137f7,_0x3bfdde){return _0x4137f7[_0x12f0('0x9')](_0x12f0('0xa'),attributes,{'tableName':_0x12f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb62b=['exports','define','UserFaxQueue','user_has_fax_queues','api','moment','bluebird','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x175255,_0x35b47f){var _0x1b14d1=function(_0x4b2946){while(--_0x4b2946){_0x175255['push'](_0x175255['shift']());}};_0x1b14d1(++_0x35b47f);}(_0xb62b,0x7c));var _0xbb62=function(_0xda962c,_0x1e6c37){_0xda962c=_0xda962c-0x0;var _0x5061a4=_0xb62b[_0xda962c];return _0x5061a4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbb62('0x0'));var moment=require(_0xbb62('0x1'));var BPromise=require(_0xbb62('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbb62('0x3'));var config=require(_0xbb62('0x4'));var attributes=require(_0xbb62('0x5'));module[_0xbb62('0x6')]=function(_0x5134f2,_0x4c9669){return _0x5134f2[_0xbb62('0x7')](_0xbb62('0x8'),attributes,{'tableName':_0xbb62('0x9'),'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 206e99f..1da3322 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 _0x41c3=['stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3d6fb3,_0x2ac69a){var _0x470417=function(_0x2b91f9){while(--_0x2b91f9){_0x3d6fb3['push'](_0x3d6fb3['shift']());}};_0x470417(++_0x2ac69a);}(_0x41c3,0x1d5));var _0x341c=function(_0x3ff7b0,_0x391f4a){_0x3ff7b0=_0x3ff7b0-0x0;var _0x5910f2=_0x41c3[_0x3ff7b0];return _0x5910f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x341c('0x0'));var BPromise=require(_0x341c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x341c('0x2'));var db=require(_0x341c('0x3'))['db'];var utils=require(_0x341c('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x341c('0x5'));var jayson=require(_0x341c('0x6'));var client=jayson[_0x341c('0x7')][_0x341c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c71df,_0x530edf,_0x37fb91){return new BPromise(function(_0x12ca32,_0x446f4a){return client[_0x341c('0x9')](_0x2c71df,_0x37fb91)[_0x341c('0xa')](function(_0x199bd5){logger[_0x341c('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x530edf,_0x341c('0xc'));logger['debug'](_0x341c('0xd'),_0x530edf,_0x341c('0xc'),JSON[_0x341c('0xe')](_0x199bd5));if(_0x199bd5[_0x341c('0xf')]){if(_0x199bd5[_0x341c('0xf')][_0x341c('0x10')]===0x1f4){logger['error'](_0x341c('0x11'),_0x530edf,_0x199bd5[_0x341c('0xf')]['message']);return _0x446f4a(_0x199bd5['error'][_0x341c('0x12')]);}logger[_0x341c('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x530edf,_0x199bd5[_0x341c('0xf')]['message']);return _0x12ca32(_0x199bd5['error'][_0x341c('0x12')]);}else{logger[_0x341c('0xb')](_0x341c('0x11'),_0x530edf,_0x341c('0xc'));_0x12ca32(_0x199bd5[_0x341c('0x13')]['message']);}})[_0x341c('0x14')](function(_0x19fdef){logger[_0x341c('0xf')](_0x341c('0x11'),_0x530edf,_0x19fdef);_0x446f4a(_0x19fdef);});});} \ No newline at end of file +var _0x9b5f=['../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0x9b5f,0x100));var _0xf9b5=function(_0x172948,_0x4262cc){_0x172948=_0x172948-0x0;var _0x4aeaa9=_0x9b5f[_0x172948];return _0x4aeaa9;};'use strict';var _=require(_0xf9b5('0x0'));var util=require(_0xf9b5('0x1'));var moment=require(_0xf9b5('0x2'));var BPromise=require(_0xf9b5('0x3'));var rs=require(_0xf9b5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9b5('0x6'))(_0xf9b5('0x7'));var config=require(_0xf9b5('0x8'));var jayson=require(_0xf9b5('0x9'));var client=jayson[_0xf9b5('0xa')][_0xf9b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf3f6f2,_0x35b33b,_0x2bc10d){return new BPromise(function(_0x44741c,_0x1fda5f){return client[_0xf9b5('0xc')](_0xf3f6f2,_0x2bc10d)[_0xf9b5('0xd')](function(_0x4057a3){logger[_0xf9b5('0xe')](_0xf9b5('0xf'),_0x35b33b,'request\x20sent');logger['debug'](_0xf9b5('0x10'),_0x35b33b,'request\x20sent',JSON[_0xf9b5('0x11')](_0x4057a3));if(_0x4057a3[_0xf9b5('0x12')]){if(_0x4057a3[_0xf9b5('0x12')][_0xf9b5('0x13')]===0x1f4){logger[_0xf9b5('0x12')](_0xf9b5('0xf'),_0x35b33b,_0x4057a3['error']['message']);return _0x1fda5f(_0x4057a3[_0xf9b5('0x12')][_0xf9b5('0x14')]);}logger[_0xf9b5('0x12')](_0xf9b5('0xf'),_0x35b33b,_0x4057a3[_0xf9b5('0x12')]['message']);return _0x44741c(_0x4057a3[_0xf9b5('0x12')][_0xf9b5('0x14')]);}else{logger[_0xf9b5('0xe')](_0xf9b5('0xf'),_0x35b33b,_0xf9b5('0x15'));_0x44741c(_0x4057a3[_0xf9b5('0x16')][_0xf9b5('0x14')]);}})[_0xf9b5('0x17')](function(_0x4fe1cb){logger[_0xf9b5('0x12')](_0xf9b5('0xf'),_0x35b33b,_0x4fe1cb);_0x1fda5f(_0x4fe1cb);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 3ded9ca..49d08c8 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3d0697,_0x255b50){var _0x31f632=function(_0x96eb78){while(--_0x96eb78){_0x3d0697['push'](_0x3d0697['shift']());}};_0x31f632(++_0x255b50);}(_0x70e0,0x17b));var _0x070e=function(_0xb97765,_0x2baf18){_0xb97765=_0xb97765-0x0;var _0x4d9e17=_0x70e0[_0xb97765];return _0x4d9e17;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 7a09260..f71445b 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 _0xfe3d=['exports','sequelize'];(function(_0x2ffe07,_0x11a102){var _0x50fa7f=function(_0x423745){while(--_0x423745){_0x2ffe07['push'](_0x2ffe07['shift']());}};_0x50fa7f(++_0x11a102);}(_0xfe3d,0x119));var _0xdfe3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfe3d[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xdfe3('0x0'));module[_0xdfe3('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1c5d=['INTEGER'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x1c5d,0xd7));var _0xd1c5=function(_0xf047d5,_0x3a37b7){_0xf047d5=_0xf047d5-0x0;var _0x5cfb43=_0x1c5d[_0xf047d5];return _0x5cfb43;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xd1c5('0x0')],'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 cfa61df..bca108d 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 _0xdf99=['bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api'];(function(_0x5d2a37,_0x3bd1d4){var _0xb8370=function(_0x42de40){while(--_0x42de40){_0x5d2a37['push'](_0x5d2a37['shift']());}};_0xb8370(++_0x3bd1d4);}(_0xdf99,0x11a));var _0x9df9=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0xdf99[_0x178856];return _0x3c7fe7;};'use strict';var _=require(_0x9df9('0x0'));var util=require(_0x9df9('0x1'));var logger=require(_0x9df9('0x2'))(_0x9df9('0x3'));var moment=require('moment');var BPromise=require(_0x9df9('0x4'));var rp=require(_0x9df9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9df9('0x6'));var config=require(_0x9df9('0x7'));var attributes=require(_0x9df9('0x8'));module[_0x9df9('0x9')]=function(_0x42de9c,_0x17875d){return _0x42de9c[_0x9df9('0xa')](_0x9df9('0xb'),attributes,{'tableName':_0x9df9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0a5=['path','rimraf','../../config/environment','exports','define','UserMailQueue','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x45cfd6,_0x31f11e){var _0x23f977=function(_0x5b03f7){while(--_0x5b03f7){_0x45cfd6['push'](_0x45cfd6['shift']());}};_0x23f977(++_0x31f11e);}(_0xf0a5,0x119));var _0x5f0a=function(_0x5d9865,_0x4c7ad6){_0x5d9865=_0x5d9865-0x0;var _0x4df8ae=_0xf0a5[_0x5d9865];return _0x4df8ae;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5f0a('0x0'))(_0x5f0a('0x1'));var moment=require(_0x5f0a('0x2'));var BPromise=require(_0x5f0a('0x3'));var rp=require(_0x5f0a('0x4'));var fs=require('fs');var path=require(_0x5f0a('0x5'));var rimraf=require(_0x5f0a('0x6'));var config=require(_0x5f0a('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x5f0a('0x8')]=function(_0x286676,_0x16c839){return _0x286676[_0x5f0a('0x9')](_0x5f0a('0xa'),attributes,{'tableName':'user_has_mail_queues','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 aeec5df..1cde08d 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x44fa43,_0x4224df){var _0x5683ff=function(_0x42a69f){while(--_0x42a69f){_0x44fa43['push'](_0x44fa43['shift']());}};_0x5683ff(++_0x4224df);}(_0x8ef6,0xf2));var _0x68ef=function(_0x49e48a,_0x25211f){_0x49e48a=_0x49e48a-0x0;var _0x153542=_0x8ef6[_0x49e48a];return _0x153542;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3b0e01,_0x40b7f6){var _0x614eee=function(_0x5953da){while(--_0x5953da){_0x3b0e01['push'](_0x3b0e01['shift']());}};_0x614eee(++_0x40b7f6);}(_0x6aa7,0x178));var _0x76aa=function(_0x389f78,_0x3ee1d1){_0x389f78=_0x389f78-0x0;var _0x16826e=_0x6aa7[_0x389f78];return _0x16826e;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index f684440..351e480 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 _0xf38d=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x523b95,_0x51bab4){var _0x334471=function(_0x24fe26){while(--_0x24fe26){_0x523b95['push'](_0x523b95['shift']());}};_0x334471(++_0x51bab4);}(_0xf38d,0x1b8));var _0xdf38=function(_0x149737,_0x236c78){_0x149737=_0x149737-0x0;var _0x3b816d=_0xf38d[_0x149737];return _0x3b816d;};'use strict';var multer=require('multer');var util=require(_0xdf38('0x0'));var path=require(_0xdf38('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdf38('0x2')]();var fs_extra=require(_0xdf38('0x3'));var auth=require(_0xdf38('0x4'));var interaction=require(_0xdf38('0x5'));var config=require(_0xdf38('0x6'));var controller=require(_0xdf38('0x7'));router[_0xdf38('0x8')]('/',auth[_0xdf38('0x9')](),controller[_0xdf38('0xa')]);module['exports']=router; \ No newline at end of file +var _0x15f8=['../../components/interaction/service','../../config/environment','post','sendUserNotification','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1ffaf9,_0x3180b1){var _0x25e3a5=function(_0x3ecdb0){while(--_0x3ecdb0){_0x1ffaf9['push'](_0x1ffaf9['shift']());}};_0x25e3a5(++_0x3180b1);}(_0x15f8,0x1e5));var _0x815f=function(_0x505e1c,_0x51ae52){_0x505e1c=_0x505e1c-0x0;var _0x277e98=_0x15f8[_0x505e1c];return _0x277e98;};'use strict';var multer=require(_0x815f('0x0'));var util=require(_0x815f('0x1'));var path=require(_0x815f('0x2'));var timeout=require(_0x815f('0x3'));var express=require('express');var router=express[_0x815f('0x4')]();var fs_extra=require(_0x815f('0x5'));var auth=require(_0x815f('0x6'));var interaction=require(_0x815f('0x7'));var config=require(_0x815f('0x8'));var controller=require('./userNotification.controller');router[_0x815f('0x9')]('/',auth['isAuthenticated'](),controller[_0x815f('0xa')]);module[_0x815f('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 7bd1efb..77f8b0d 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 _0xaa9c=['STRING','sequelize','exports','TEXT'];(function(_0x24aa02,_0x3a2fa0){var _0x31a862=function(_0x1b467d){while(--_0x1b467d){_0x24aa02['push'](_0x24aa02['shift']());}};_0x31a862(++_0x3a2fa0);}(_0xaa9c,0x7d));var _0xcaa9=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xaa9c[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xcaa9('0x0'));module[_0xcaa9('0x1')]={'body':{'type':Sequelize[_0xcaa9('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xcaa9('0x2')]},'recipientsDescription':{'type':Sequelize[_0xcaa9('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x84dd=['STRING','BOOLEAN','TEXT'];(function(_0x199fe8,_0x2f737e){var _0x44e5dc=function(_0x12f124){while(--_0x12f124){_0x199fe8['push'](_0x199fe8['shift']());}};_0x44e5dc(++_0x2f737e);}(_0x84dd,0x1f4));var _0xd84d=function(_0xb922d8,_0x4cab8b){_0xb922d8=_0xb922d8-0x0;var _0x4b9aec=_0x84dd[_0xb922d8];return _0x4b9aec;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xd84d('0x0')]},'senderName':{'type':Sequelize[_0xd84d('0x1')]},'recipientsId':{'type':Sequelize[_0xd84d('0x0')]},'recipientsDescription':{'type':Sequelize[_0xd84d('0x1')]},'beep':{'type':Sequelize[_0xd84d('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 8944114..a24f1da 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 _0x7c48=['Missing\x20\x27view\x27\x20parameter','recipients','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','whatsappqueue','user','some','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','UserNotification','create','recipient','userNotification:send','catch','text','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','model','includes','queue','replace','Queue','ids','push','all','union','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view'];(function(_0x592df4,_0x4e719b){var _0x3b4fe4=function(_0x5ebf53){while(--_0x5ebf53){_0x592df4['push'](_0x592df4['shift']());}};_0x3b4fe4(++_0x4e719b);}(_0x7c48,0x1cd));var _0x87c4=function(_0x514e2b,_0x442968){_0x514e2b=_0x514e2b-0x0;var _0x170828=_0x7c48[_0x514e2b];return _0x170828;};'use strict';var emlformat=require(_0x87c4('0x0'));var rimraf=require(_0x87c4('0x1'));var zipdir=require(_0x87c4('0x2'));var jsonpatch=require(_0x87c4('0x3'));var rp=require(_0x87c4('0x4'));var moment=require(_0x87c4('0x5'));var BPromise=require(_0x87c4('0x6'));var Mustache=require('mustache');var util=require(_0x87c4('0x7'));var path=require(_0x87c4('0x8'));var sox=require(_0x87c4('0x9'));var csv=require(_0x87c4('0xa'));var ejs=require(_0x87c4('0xb'));var fs=require('fs');var fs_extra=require(_0x87c4('0xc'));var _=require(_0x87c4('0xd'));var squel=require(_0x87c4('0xe'));var crypto=require(_0x87c4('0xf'));var jsforce=require(_0x87c4('0x10'));var deskjs=require(_0x87c4('0x11'));var toCsv=require(_0x87c4('0xa'));var querystring=require(_0x87c4('0x12'));var Papa=require(_0x87c4('0x13'));var Redis=require(_0x87c4('0x14'));var authService=require(_0x87c4('0x15'));var qs=require(_0x87c4('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87c4('0x17'));var logger=require(_0x87c4('0x18'))('api');var utils=require(_0x87c4('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x87c4('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x87c4('0x1b')](config['redis'],{'host':_0x87c4('0x1c'),'port':0x18eb});var socket=require(_0x87c4('0x1d'))(new Redis(config[_0x87c4('0x1e')]));require(_0x87c4('0x1f'))[_0x87c4('0x20')](socket);function respondWithStatusCode(_0x31bb43,_0x5ca756){_0x5ca756=_0x5ca756||0xcc;return function(_0x29173b){if(_0x29173b){return _0x31bb43[_0x87c4('0x21')](_0x5ca756);}return _0x31bb43[_0x87c4('0x22')](_0x5ca756)[_0x87c4('0x23')]();};}function respondWithResult(_0x446c45,_0x3fa70f){_0x3fa70f=_0x3fa70f||0xc8;return function(_0xcdce08){if(_0xcdce08){return _0x446c45['status'](_0x3fa70f)[_0x87c4('0x24')](_0xcdce08);}};}function respondWithFilteredResult(_0x2f31fd,_0x42fbd3){return function(_0x8984d5){if(_0x8984d5){var _0x2bcc1c=typeof _0x42fbd3[_0x87c4('0x25')]===_0x87c4('0x26')&&typeof _0x42fbd3[_0x87c4('0x27')]===_0x87c4('0x26');var _0x37ea87=_0x8984d5['count'];var _0x33c66a=_0x2bcc1c?0x0:_0x42fbd3[_0x87c4('0x25')];var _0x41b066=_0x2bcc1c?_0x8984d5[_0x87c4('0x28')]:_0x42fbd3[_0x87c4('0x25')]+_0x42fbd3[_0x87c4('0x27')];var _0x432e9b;if(_0x41b066>=_0x37ea87){_0x41b066=_0x37ea87;_0x432e9b=0xc8;}else{_0x432e9b=0xce;}_0x2f31fd[_0x87c4('0x22')](_0x432e9b);return _0x2f31fd[_0x87c4('0x29')](_0x87c4('0x2a'),_0x33c66a+'-'+_0x41b066+'/'+_0x37ea87)[_0x87c4('0x24')](_0x8984d5);}return null;};}function patchUpdates(_0x4392cc){return function(_0x496c9f){try{jsonpatch[_0x87c4('0x2b')](_0x496c9f,_0x4392cc,!![]);}catch(_0x210654){return BPromise[_0x87c4('0x2c')](_0x210654);}return _0x496c9f[_0x87c4('0x2d')]();};}function saveUpdates(_0x4f7708,_0x194012){return function(_0x1e00c7){if(_0x1e00c7){return _0x1e00c7[_0x87c4('0x2e')](_0x4f7708)[_0x87c4('0x2f')](function(_0x1ebb08){return _0x1ebb08;});}return null;};}function removeEntity(_0x2eb35f,_0x3ab17b){return function(_0x5844ad){if(_0x5844ad){return _0x5844ad['destroy']()[_0x87c4('0x2f')](function(){_0x2eb35f[_0x87c4('0x22')](0xcc)[_0x87c4('0x23')]();});}};}function handleEntityNotFound(_0x1d5258,_0x420f98){return function(_0x3b195e){if(!_0x3b195e){_0x1d5258['sendStatus'](0x194);}return _0x3b195e;};}function handleError(_0x2e7c2f,_0x28cec2){_0x28cec2=_0x28cec2||0x1f4;return function(_0x51595c){logger[_0x87c4('0x30')](_0x51595c[_0x87c4('0x31')]);if(_0x51595c[_0x87c4('0x32')]){delete _0x51595c['name'];}_0x2e7c2f[_0x87c4('0x22')](_0x28cec2)[_0x87c4('0x33')](_0x51595c);};}exports[_0x87c4('0x34')]=function(_0x1d5187,_0xeabfae,_0x323339){if(!_0x1d5187[_0x87c4('0x35')]['hasOwnProperty']('text')&&!_0x1d5187['body'][_0x87c4('0x36')](_0x87c4('0x37'))){throw new db[(_0x87c4('0x38'))]['ValidationError'](_0x87c4('0x39'));}else{if(_0x1d5187[_0x87c4('0x35')][_0x87c4('0x36')](_0x87c4('0x37'))&&!_0x1d5187['body'][_0x87c4('0x36')](_0x87c4('0x3a'))){throw new db[(_0x87c4('0x38'))]['ValidationError'](_0x87c4('0x3b'));}if(!_0x1d5187[_0x87c4('0x35')][_0x87c4('0x36')](_0x87c4('0x3c'))){throw new db[(_0x87c4('0x38'))][(_0x87c4('0x3d'))](_0x87c4('0x3e'));}else{try{var _0x33ed64=JSON[_0x87c4('0x3f')](_0x1d5187[_0x87c4('0x35')][_0x87c4('0x3c')]);}catch(_0x52946e){logger['error'](_0x52946e);throw new db[(_0x87c4('0x38'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x5a24f8=[_0x87c4('0x40'),_0x87c4('0x41'),_0x87c4('0x42'),_0x87c4('0x43'),'smsqueue','voicequeue',_0x87c4('0x44'),'team',_0x87c4('0x45')];if(_[_0x87c4('0x46')](_0x33ed64,function(_0x3c48f3){return!_['includes'](_0x5a24f8,_0x3c48f3['model']['toLowerCase']());})){throw new db[(_0x87c4('0x38'))]['ValidationError'](_0x87c4('0x47'));}}}var _0x384503={};_0x384503[_0x87c4('0x48')]=_0x1d5187['body'][_0x87c4('0x36')]('senderName')?_0x1d5187[_0x87c4('0x35')][_0x87c4('0x48')]:_0x1d5187['user'][_0x87c4('0x49')];_0x384503[_0x87c4('0x4a')]=_[_0x87c4('0x4b')](_0x1d5187['body']['recipientsDescription'])?null:_0x1d5187[_0x87c4('0x35')]['recipientsDescription'];_0x384503[_0x87c4('0x4c')]=_0x1d5187[_0x87c4('0x35')]['beep']||![];_0x384503[_0x87c4('0x4d')]=_0x1d5187[_0x87c4('0x45')]['id'];return getContent(_0x1d5187[_0x87c4('0x35')])[_0x87c4('0x2f')](function(_0x26554c){_0x384503[_0x87c4('0x35')]=_0x26554c;return getRecipients(_0x33ed64);})[_0x87c4('0x2f')](function(_0x520b5d){_0x384503[_0x87c4('0x4e')]=_[_0x87c4('0x4f')](_0x520b5d)[_0x87c4('0x50')](',');return db['sequelize']['transaction'](function(_0x169c2b){return db[_0x87c4('0x51')][_0x87c4('0x52')](_0x384503,{'raw':!![],'transaction':_0x169c2b})['then'](function(_0x23cbc5){var _0x36acfe={'sender':_0x384503[_0x87c4('0x48')],'description':_0x384503[_0x87c4('0x4a')],'content':_0x384503[_0x87c4('0x35')],'beep':_0x384503[_0x87c4('0x4c')]};_0x520b5d['forEach'](function(_0x5f1737){_0x36acfe[_0x87c4('0x53')]=_0x5f1737;socket['emit'](_0x87c4('0x54'),_0x36acfe);});return _0x23cbc5;});});})['then'](respondWithResult(_0xeabfae,0xc9))[_0x87c4('0x55')](handleError(_0xeabfae,null));};function getContent(_0x1e4ee7){return new BPromise(function(_0x4aad8e,_0x2f6e59){if(_0x1e4ee7[_0x87c4('0x56')]){_0x4aad8e(_0x1e4ee7[_0x87c4('0x56')]);return;}return db['Template'][_0x87c4('0x57')]({'attributes':[_0x87c4('0x58')],'where':{'id':_0x1e4ee7[_0x87c4('0x37')]},'raw':!![]})[_0x87c4('0x2f')](function(_0x45f7b0){if(!_0x45f7b0)throw new db[(_0x87c4('0x38'))]['ValidationError'](_0x87c4('0x59'));var _0x2e2c01=Mustache[_0x87c4('0x5a')](_0x45f7b0[_0x87c4('0x58')],_0x1e4ee7['view']);_0x4aad8e(_0x2e2c01);})['catch'](function(_0x2bb67b){_0x2f6e59(_0x2bb67b);});});}function getRecipients(_0x314790){return new BPromise(function(_0x7eba51,_0x666a73){var _0x3e3282=[];var _0x491e45=[];_0x314790[_0x87c4('0x5b')](function(_0x4193cb){var _0x29a3f8=_['startCase'](_0x4193cb[_0x87c4('0x5c')]['toLowerCase']());if(_0x29a3f8==='User'){_0x3e3282=_['union'](_0x3e3282,_0x4193cb['ids']);}else{if(_[_0x87c4('0x5d')](_0x29a3f8,_0x87c4('0x5e')))_0x29a3f8=_0x29a3f8[_0x87c4('0x5f')]('queue',_0x87c4('0x60'));_0x4193cb[_0x87c4('0x61')]['forEach'](function(_0x241ae6){_0x491e45[_0x87c4('0x62')](getAgents(_0x29a3f8,_0x241ae6));});}});return BPromise[_0x87c4('0x63')](_0x491e45)[_0x87c4('0x2f')](function(_0x53e2fd){_0x3e3282=_[_0x87c4('0x64')](_0x3e3282,_[_0x87c4('0x65')](_0x53e2fd));_0x7eba51(_0x3e3282);})[_0x87c4('0x55')](function(_0x3a46af){_0x666a73(_0x3a46af);});});}function getAgents(_0x59151a,_0x182efb){return new BPromise(function(_0x2fecbf,_0x15403e){return db[_0x59151a][_0x87c4('0x57')]({'where':{'id':_0x182efb}})['then'](function(_0x3037d6){return _0x3037d6[_0x87c4('0x66')]({'attributes':['id'],'raw':!![]})[_0x87c4('0x2f')](function(_0x1889a3){var _0x1be746=_[_0x87c4('0x67')](_0x1889a3,'id');_0x2fecbf(_0x1be746);});})[_0x87c4('0x55')](function(_0x35dc31){_0x15403e(_0x35dc31);});});} \ No newline at end of file +var _0xd82e=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','view','Sequelize','Missing\x20\x27view\x27\x20parameter','parse','recipients','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipient','emit','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','ids','queue','replace','Queue','forEach','push','union','flatten','map','eml-format'];(function(_0x3be221,_0x4663d0){var _0x293b2c=function(_0xbf16c1){while(--_0xbf16c1){_0x3be221['push'](_0x3be221['shift']());}};_0x293b2c(++_0x4663d0);}(_0xd82e,0x66));var _0xed82=function(_0x2ed41f,_0x168dc6){_0x2ed41f=_0x2ed41f-0x0;var _0x250119=_0xd82e[_0x2ed41f];return _0x250119;};'use strict';var emlformat=require(_0xed82('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xed82('0x1'));var rp=require('request-promise');var moment=require(_0xed82('0x2'));var BPromise=require(_0xed82('0x3'));var Mustache=require(_0xed82('0x4'));var util=require(_0xed82('0x5'));var path=require(_0xed82('0x6'));var sox=require(_0xed82('0x7'));var csv=require(_0xed82('0x8'));var ejs=require(_0xed82('0x9'));var fs=require('fs');var fs_extra=require(_0xed82('0xa'));var _=require(_0xed82('0xb'));var squel=require(_0xed82('0xc'));var crypto=require(_0xed82('0xd'));var jsforce=require(_0xed82('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xed82('0x8'));var querystring=require(_0xed82('0xf'));var Papa=require(_0xed82('0x10'));var Redis=require(_0xed82('0x11'));var authService=require(_0xed82('0x12'));var qs=require(_0xed82('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed82('0x14'));var logger=require(_0xed82('0x15'))('api');var utils=require(_0xed82('0x16'));var config=require(_0xed82('0x17'));var licenseUtil=require(_0xed82('0x18'));var db=require(_0xed82('0x19'))['db'];config[_0xed82('0x1a')]=_[_0xed82('0x1b')](config['redis'],{'host':_0xed82('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed82('0x1a')]));require('./userNotification.socket')[_0xed82('0x1d')](socket);function respondWithStatusCode(_0x3c4e64,_0x4b95d0){_0x4b95d0=_0x4b95d0||0xcc;return function(_0x1f2a41){if(_0x1f2a41){return _0x3c4e64[_0xed82('0x1e')](_0x4b95d0);}return _0x3c4e64[_0xed82('0x1f')](_0x4b95d0)[_0xed82('0x20')]();};}function respondWithResult(_0xbee1d4,_0x4f80b8){_0x4f80b8=_0x4f80b8||0xc8;return function(_0x187e2b){if(_0x187e2b){return _0xbee1d4[_0xed82('0x1f')](_0x4f80b8)['json'](_0x187e2b);}};}function respondWithFilteredResult(_0x2b47a1,_0x11db35){return function(_0x5ce23e){if(_0x5ce23e){var _0x94838f=typeof _0x11db35[_0xed82('0x21')]===_0xed82('0x22')&&typeof _0x11db35[_0xed82('0x23')]==='undefined';var _0x2bfa80=_0x5ce23e[_0xed82('0x24')];var _0x21d44d=_0x94838f?0x0:_0x11db35[_0xed82('0x21')];var _0x402d29=_0x94838f?_0x5ce23e['count']:_0x11db35[_0xed82('0x21')]+_0x11db35[_0xed82('0x23')];var _0x1cfd14;if(_0x402d29>=_0x2bfa80){_0x402d29=_0x2bfa80;_0x1cfd14=0xc8;}else{_0x1cfd14=0xce;}_0x2b47a1['status'](_0x1cfd14);return _0x2b47a1[_0xed82('0x25')]('Content-Range',_0x21d44d+'-'+_0x402d29+'/'+_0x2bfa80)[_0xed82('0x26')](_0x5ce23e);}return null;};}function patchUpdates(_0x2b9ad4){return function(_0x5375c4){try{jsonpatch[_0xed82('0x27')](_0x5375c4,_0x2b9ad4,!![]);}catch(_0x247088){return BPromise[_0xed82('0x28')](_0x247088);}return _0x5375c4['save']();};}function saveUpdates(_0x20983e,_0x189cb8){return function(_0x3feb77){if(_0x3feb77){return _0x3feb77[_0xed82('0x29')](_0x20983e)[_0xed82('0x2a')](function(_0x23f84b){return _0x23f84b;});}return null;};}function removeEntity(_0x47c543,_0xb45ead){return function(_0x50d0b8){if(_0x50d0b8){return _0x50d0b8[_0xed82('0x2b')]()[_0xed82('0x2a')](function(){_0x47c543[_0xed82('0x1f')](0xcc)[_0xed82('0x20')]();});}};}function handleEntityNotFound(_0x256621,_0x5eea13){return function(_0x5e2cc5){if(!_0x5e2cc5){_0x256621[_0xed82('0x1e')](0x194);}return _0x5e2cc5;};}function handleError(_0x4764fa,_0x12977e){_0x12977e=_0x12977e||0x1f4;return function(_0x5dd85b){logger[_0xed82('0x2c')](_0x5dd85b[_0xed82('0x2d')]);if(_0x5dd85b[_0xed82('0x2e')]){delete _0x5dd85b[_0xed82('0x2e')];}_0x4764fa['status'](_0x12977e)[_0xed82('0x2f')](_0x5dd85b);};}exports[_0xed82('0x30')]=function(_0x441490,_0x222930,_0x3b211a){if(!_0x441490[_0xed82('0x31')][_0xed82('0x32')](_0xed82('0x33'))&&!_0x441490[_0xed82('0x31')][_0xed82('0x32')](_0xed82('0x34'))){throw new db['Sequelize'][(_0xed82('0x35'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x441490[_0xed82('0x31')][_0xed82('0x32')]('TemplateId')&&!_0x441490['body'][_0xed82('0x32')](_0xed82('0x36'))){throw new db[(_0xed82('0x37'))][(_0xed82('0x35'))](_0xed82('0x38'));}if(!_0x441490[_0xed82('0x31')][_0xed82('0x32')]('recipients')){throw new db[(_0xed82('0x37'))][(_0xed82('0x35'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x4385cf=JSON[_0xed82('0x39')](_0x441490[_0xed82('0x31')][_0xed82('0x3a')]);}catch(_0x4f4e3d){logger[_0xed82('0x2c')](_0x4f4e3d);throw new db['Sequelize'][(_0xed82('0x35'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x249621=[_0xed82('0x3b'),_0xed82('0x3c'),_0xed82('0x3d'),_0xed82('0x3e'),'smsqueue',_0xed82('0x3f'),_0xed82('0x40'),_0xed82('0x41'),_0xed82('0x42')];if(_[_0xed82('0x43')](_0x4385cf,function(_0x2ac5fe){return!_[_0xed82('0x44')](_0x249621,_0x2ac5fe[_0xed82('0x45')][_0xed82('0x46')]());})){throw new db[(_0xed82('0x37'))][(_0xed82('0x35'))](_0xed82('0x47'));}}}var _0x22e0e3={};_0x22e0e3[_0xed82('0x48')]=_0x441490[_0xed82('0x31')][_0xed82('0x32')](_0xed82('0x48'))?_0x441490['body']['senderName']:_0x441490['user'][_0xed82('0x49')];_0x22e0e3[_0xed82('0x4a')]=_[_0xed82('0x4b')](_0x441490['body']['recipientsDescription'])?null:_0x441490['body'][_0xed82('0x4a')];_0x22e0e3[_0xed82('0x4c')]=_0x441490[_0xed82('0x31')][_0xed82('0x4c')]||![];_0x22e0e3[_0xed82('0x4d')]=_0x441490[_0xed82('0x42')]['id'];return getContent(_0x441490[_0xed82('0x31')])[_0xed82('0x2a')](function(_0x178b3c){_0x22e0e3['body']=_0x178b3c;return getRecipients(_0x4385cf);})[_0xed82('0x2a')](function(_0x3ffa3d){_0x22e0e3[_0xed82('0x4e')]=_[_0xed82('0x4f')](_0x3ffa3d)[_0xed82('0x50')](',');return db[_0xed82('0x51')][_0xed82('0x52')](function(_0x5bc033){return db[_0xed82('0x53')][_0xed82('0x54')](_0x22e0e3,{'raw':!![],'transaction':_0x5bc033})[_0xed82('0x2a')](function(_0x3a07c7){var _0x315c2f={'sender':_0x22e0e3[_0xed82('0x48')],'description':_0x22e0e3['recipientsDescription'],'content':_0x22e0e3[_0xed82('0x31')],'beep':_0x22e0e3['beep']};_0x3ffa3d['forEach'](function(_0x3499f3){_0x315c2f[_0xed82('0x55')]=_0x3499f3;socket[_0xed82('0x56')]('userNotification:send',_0x315c2f);});return _0x3a07c7;});});})['then'](respondWithResult(_0x222930,0xc9))[_0xed82('0x57')](handleError(_0x222930,null));};function getContent(_0x1719a3){return new BPromise(function(_0x46e05c,_0x50a24a){if(_0x1719a3['text']){_0x46e05c(_0x1719a3['text']);return;}return db[_0xed82('0x58')][_0xed82('0x59')]({'attributes':['html'],'where':{'id':_0x1719a3[_0xed82('0x34')]},'raw':!![]})['then'](function(_0xe61ec4){if(!_0xe61ec4)throw new db[(_0xed82('0x37'))][(_0xed82('0x35'))](_0xed82('0x5a'));var _0x40aabc=Mustache[_0xed82('0x5b')](_0xe61ec4[_0xed82('0x5c')],_0x1719a3[_0xed82('0x36')]);_0x46e05c(_0x40aabc);})[_0xed82('0x57')](function(_0x22a684){_0x50a24a(_0x22a684);});});}function getRecipients(_0x41d667){return new BPromise(function(_0x1f86a6,_0x380abd){var _0x30bc73=[];var _0x2057e1=[];_0x41d667['forEach'](function(_0x80a8fb){var _0x340704=_[_0xed82('0x5d')](_0x80a8fb['model'][_0xed82('0x46')]());if(_0x340704==='User'){_0x30bc73=_['union'](_0x30bc73,_0x80a8fb[_0xed82('0x5e')]);}else{if(_[_0xed82('0x44')](_0x340704,_0xed82('0x5f')))_0x340704=_0x340704[_0xed82('0x60')](_0xed82('0x5f'),_0xed82('0x61'));_0x80a8fb[_0xed82('0x5e')][_0xed82('0x62')](function(_0x3a2a4a){_0x2057e1[_0xed82('0x63')](getAgents(_0x340704,_0x3a2a4a));});}});return BPromise['all'](_0x2057e1)[_0xed82('0x2a')](function(_0x5de21b){_0x30bc73=_[_0xed82('0x64')](_0x30bc73,_[_0xed82('0x65')](_0x5de21b));_0x1f86a6(_0x30bc73);})[_0xed82('0x57')](function(_0x4b129d){_0x380abd(_0x4b129d);});});}function getAgents(_0x3a57a1,_0x8fda2a){return new BPromise(function(_0x1570c8,_0x70f62){return db[_0x3a57a1][_0xed82('0x59')]({'where':{'id':_0x8fda2a}})['then'](function(_0x1193bc){return _0x1193bc['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x5a8ea0){var _0x440af6=_[_0xed82('0x66')](_0x5a8ea0,'id');_0x1570c8(_0x440af6);});})['catch'](function(_0x31a33e){_0x70f62(_0x31a33e);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index b85bd50..9fc11d9 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 _0xdf35=['../../mysqldb','UserNotification','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4723d1,_0x515d2e){var _0x335b7f=function(_0x559134){while(--_0x559134){_0x4723d1['push'](_0x4723d1['shift']());}};_0x335b7f(++_0x515d2e);}(_0xdf35,0x1f3));var _0x5df3=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xdf35[_0x4b055c];return _0x4b62bb;};'use strict';var EventEmitter=require(_0x5df3('0x0'));var UserNotification=require(_0x5df3('0x1'))['db'][_0x5df3('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5df3('0x3')](0x0);var events={'afterCreate':_0x5df3('0x4'),'afterUpdate':'update','afterDestroy':_0x5df3('0x5')};function emitEvent(_0x359689){return function(_0x4f67c0,_0x1da023,_0x168688){UserNotificationEvents[_0x5df3('0x6')](_0x359689+':'+_0x4f67c0['id'],_0x4f67c0);UserNotificationEvents[_0x5df3('0x6')](_0x359689,_0x4f67c0);_0x168688(null);};}for(var e in events){if(events[_0x5df3('0x7')](e)){var event=events[e];UserNotification[_0x5df3('0x8')](e,emitEvent(event));}}module[_0x5df3('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0xf66a=['emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification','setMaxListeners','save','update','remove'];(function(_0x409ef4,_0x435589){var _0x50036b=function(_0x4d12ff){while(--_0x4d12ff){_0x409ef4['push'](_0x409ef4['shift']());}};_0x50036b(++_0x435589);}(_0xf66a,0xf4));var _0xaf66=function(_0x5005cb,_0x43ed1b){_0x5005cb=_0x5005cb-0x0;var _0x35c0ab=_0xf66a[_0x5005cb];return _0x35c0ab;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xaf66('0x0'))['db'][_0xaf66('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xaf66('0x2')](0x0);var events={'afterCreate':_0xaf66('0x3'),'afterUpdate':_0xaf66('0x4'),'afterDestroy':_0xaf66('0x5')};function emitEvent(_0x32922f){return function(_0x162b48,_0x43c754,_0xdc4b04){UserNotificationEvents[_0xaf66('0x6')](_0x32922f+':'+_0x162b48['id'],_0x162b48);UserNotificationEvents[_0xaf66('0x6')](_0x32922f,_0x162b48);_0xdc4b04(null);};}for(var e in events){if(events[_0xaf66('0x7')](e)){var event=events[e];UserNotification[_0xaf66('0x8')](e,emitEvent(event));}}module[_0xaf66('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 1a39c32..fe11c7c 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 _0xc07b=['../../config/logger','api','path','rimraf','../../config/environment','exports','define','UserNotification','userNotifications','utf8mb4','lodash','util'];(function(_0x1561ce,_0x364e74){var _0xa118aa=function(_0x2a9427){while(--_0x2a9427){_0x1561ce['push'](_0x1561ce['shift']());}};_0xa118aa(++_0x364e74);}(_0xc07b,0xe2));var _0xbc07=function(_0x3b2244,_0x54873f){_0x3b2244=_0x3b2244-0x0;var _0x2dcc14=_0xc07b[_0x3b2244];return _0x2dcc14;};'use strict';var _=require(_0xbc07('0x0'));var util=require(_0xbc07('0x1'));var logger=require(_0xbc07('0x2'))(_0xbc07('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc07('0x4'));var rimraf=require(_0xbc07('0x5'));var config=require(_0xbc07('0x6'));var attributes=require('./userNotification.attributes');module[_0xbc07('0x7')]=function(_0x5154da,_0x3a4dbb){return _0x5154da[_0xbc07('0x8')](_0xbc07('0x9'),attributes,{'tableName':_0xbc07('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbc07('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3a41=['define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports'];(function(_0x49ef93,_0x554396){var _0xa0bd86=function(_0x399e3e){while(--_0x399e3e){_0x49ef93['push'](_0x49ef93['shift']());}};_0xa0bd86(++_0x554396);}(_0x3a41,0x86));var _0x13a4=function(_0x459e81,_0x52aeb0){_0x459e81=_0x459e81-0x0;var _0x4fac6a=_0x3a41[_0x459e81];return _0x4fac6a;};'use strict';var _=require(_0x13a4('0x0'));var util=require(_0x13a4('0x1'));var logger=require(_0x13a4('0x2'))(_0x13a4('0x3'));var moment=require(_0x13a4('0x4'));var BPromise=require(_0x13a4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x13a4('0x6'));var rimraf=require(_0x13a4('0x7'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x13a4('0x8')]=function(_0x16173a,_0x1f51ab){return _0x16173a[_0x13a4('0x9')](_0x13a4('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x13a4('0xb'),'collate':_0x13a4('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 62d80b7..5a28d16 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 _0xc9fa=['request\x20sent','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc9fa,0x73));var _0xac9f=function(_0x18f475,_0x5a5607){_0x18f475=_0x18f475-0x0;var _0x2daf6f=_0xc9fa[_0x18f475];return _0x2daf6f;};'use strict';var _=require('lodash');var util=require(_0xac9f('0x0'));var moment=require('moment');var BPromise=require(_0xac9f('0x1'));var rs=require(_0xac9f('0x2'));var fs=require('fs');var Redis=require(_0xac9f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xac9f('0x4'));var logger=require(_0xac9f('0x5'))(_0xac9f('0x6'));var config=require(_0xac9f('0x7'));var jayson=require(_0xac9f('0x8'));var client=jayson['client'][_0xac9f('0x9')]({'port':0x232a});config['redis']=_[_0xac9f('0xa')](config[_0xac9f('0xb')],{'host':_0xac9f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac9f('0xb')]));require(_0xac9f('0xd'))['register'](socket);function respondWithRpcPromise(_0xb2b33c,_0x30d874,_0xf049cf){return new BPromise(function(_0x5a9c1b,_0x5c48e2){return client[_0xac9f('0xe')](_0xb2b33c,_0xf049cf)[_0xac9f('0xf')](function(_0x138776){logger[_0xac9f('0x10')](_0xac9f('0x11'),_0x30d874,'request\x20sent');logger[_0xac9f('0x12')](_0xac9f('0x13'),_0x30d874,_0xac9f('0x14'),JSON[_0xac9f('0x15')](_0x138776));if(_0x138776[_0xac9f('0x16')]){if(_0x138776['error'][_0xac9f('0x17')]===0x1f4){logger[_0xac9f('0x16')](_0xac9f('0x11'),_0x30d874,_0x138776[_0xac9f('0x16')][_0xac9f('0x18')]);return _0x5c48e2(_0x138776[_0xac9f('0x16')][_0xac9f('0x18')]);}logger[_0xac9f('0x16')](_0xac9f('0x11'),_0x30d874,_0x138776[_0xac9f('0x16')][_0xac9f('0x18')]);return _0x5a9c1b(_0x138776['error'][_0xac9f('0x18')]);}else{logger['info'](_0xac9f('0x11'),_0x30d874,_0xac9f('0x14'));_0x5a9c1b(_0x138776[_0xac9f('0x19')][_0xac9f('0x18')]);}})[_0xac9f('0x1a')](function(_0x43786d){logger[_0xac9f('0x16')]('UserNotification,\x20%s,\x20%s',_0x30d874,_0x43786d);_0x5c48e2(_0x43786d);});});} \ No newline at end of file +var _0x7579=['code','UserNotification,\x20%s,\x20%s','message','info','request\x20sent','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','./userNotification.socket','register','request','then','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x98ac87,_0x1fe9ac){var _0x2ae9ca=function(_0x495147){while(--_0x495147){_0x98ac87['push'](_0x98ac87['shift']());}};_0x2ae9ca(++_0x1fe9ac);}(_0x7579,0x159));var _0x9757=function(_0x435c59,_0x5c3114){_0x435c59=_0x435c59-0x0;var _0x532e99=_0x7579[_0x435c59];return _0x532e99;};'use strict';var _=require('lodash');var util=require(_0x9757('0x0'));var moment=require('moment');var BPromise=require(_0x9757('0x1'));var rs=require(_0x9757('0x2'));var fs=require('fs');var Redis=require(_0x9757('0x3'));var db=require(_0x9757('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9757('0x5'))('rpc');var config=require(_0x9757('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9757('0x7')][_0x9757('0x8')]({'port':0x232a});config[_0x9757('0x9')]=_[_0x9757('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9757('0x9')]));require(_0x9757('0xb'))[_0x9757('0xc')](socket);function respondWithRpcPromise(_0x8d2850,_0x3e9b21,_0x1275c1){return new BPromise(function(_0x565da1,_0x1c6de9){return client[_0x9757('0xd')](_0x8d2850,_0x1275c1)[_0x9757('0xe')](function(_0x3f39e2){logger['info']('UserNotification,\x20%s,\x20%s',_0x3e9b21,'request\x20sent');logger[_0x9757('0xf')](_0x9757('0x10'),_0x3e9b21,'request\x20sent',JSON[_0x9757('0x11')](_0x3f39e2));if(_0x3f39e2[_0x9757('0x12')]){if(_0x3f39e2[_0x9757('0x12')][_0x9757('0x13')]===0x1f4){logger['error'](_0x9757('0x14'),_0x3e9b21,_0x3f39e2[_0x9757('0x12')]['message']);return _0x1c6de9(_0x3f39e2[_0x9757('0x12')][_0x9757('0x15')]);}logger[_0x9757('0x12')](_0x9757('0x14'),_0x3e9b21,_0x3f39e2[_0x9757('0x12')][_0x9757('0x15')]);return _0x565da1(_0x3f39e2[_0x9757('0x12')]['message']);}else{logger[_0x9757('0x16')]('UserNotification,\x20%s,\x20%s',_0x3e9b21,_0x9757('0x17'));_0x565da1(_0x3f39e2[_0x9757('0x18')][_0x9757('0x15')]);}})[_0x9757('0x19')](function(_0x1c754a){logger['error'](_0x9757('0x14'),_0x3e9b21,_0x1c754a);_0x1c6de9(_0x1c754a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index be761fa..cc08494 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 _0xb88b=['length','userNotification:','save','remove','emit','removeListener'];(function(_0x207ed3,_0x1565e6){var _0xd60b1b=function(_0x389f04){while(--_0x389f04){_0x207ed3['push'](_0x207ed3['shift']());}};_0xd60b1b(++_0x1565e6);}(_0xb88b,0x164));var _0xbb88=function(_0x593476,_0x284b33){_0x593476=_0x593476-0x0;var _0x2c8f67=_0xb88b[_0x593476];return _0x2c8f67;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xbb88('0x0'),_0xbb88('0x1'),'update'];function createListener(_0x3d0201,_0x4ac2a5){return function(_0x369a39){_0x4ac2a5[_0xbb88('0x2')](_0x3d0201,_0x369a39);};}function removeListener(_0x59a37c,_0x3573f9){return function(){UserNotificationEvents[_0xbb88('0x3')](_0x59a37c,_0x3573f9);};}exports['register']=function(_0x1c4d9f){for(var _0x1daaae=0x0,_0x34fdb2=events[_0xbb88('0x4')];_0x1daaae<_0x34fdb2;_0x1daaae++){var _0x1f76ce=events[_0x1daaae];var _0x4e2067=createListener(_0xbb88('0x5')+_0x1f76ce,_0x1c4d9f);UserNotificationEvents['on'](_0x1f76ce,_0x4e2067);}}; \ No newline at end of file +var _0x242b=['userNotification:','./userNotification.events','save','remove','update','emit','removeListener','register','length'];(function(_0x56c70b,_0x38ae38){var _0x36fea1=function(_0x4273e0){while(--_0x4273e0){_0x56c70b['push'](_0x56c70b['shift']());}};_0x36fea1(++_0x38ae38);}(_0x242b,0x1c3));var _0xb242=function(_0x2e236c,_0x3b91c6){_0x2e236c=_0x2e236c-0x0;var _0x3479e3=_0x242b[_0x2e236c];return _0x3479e3;};'use strict';var UserNotificationEvents=require(_0xb242('0x0'));var events=[_0xb242('0x1'),_0xb242('0x2'),_0xb242('0x3')];function createListener(_0x43022c,_0x1e7ff6){return function(_0x2314bb){_0x1e7ff6[_0xb242('0x4')](_0x43022c,_0x2314bb);};}function removeListener(_0x1bcee9,_0x47f2c4){return function(){UserNotificationEvents[_0xb242('0x5')](_0x1bcee9,_0x47f2c4);};}exports[_0xb242('0x6')]=function(_0x4eb3bf){for(var _0x59559b=0x0,_0x5eeb26=events[_0xb242('0x7')];_0x59559b<_0x5eeb26;_0x59559b++){var _0x43ee52=events[_0x59559b];var _0xe186c3=createListener(_0xb242('0x8')+_0x43ee52,_0x4eb3bf);UserNotificationEvents['on'](_0x43ee52,_0xe186c3);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index b0b1bd4..2c80151 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xb8135c,_0x46c002){var _0x4e54e5=function(_0x5689bd){while(--_0x5689bd){_0xb8135c['push'](_0xb8135c['shift']());}};_0x4e54e5(++_0x46c002);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x590deb,_0x249ee5){var _0x1b0022=function(_0x5e9718){while(--_0x5e9718){_0x590deb['push'](_0x590deb['shift']());}};_0x1b0022(++_0x249ee5);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 78490bb..d007ef1 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 _0xecac=['exports','INTEGER'];(function(_0xd40932,_0x10425f){var _0x54e057=function(_0x594cbb){while(--_0x594cbb){_0xd40932['push'](_0xd40932['shift']());}};_0x54e057(++_0x10425f);}(_0xecac,0x174));var _0xceca=function(_0x469536,_0x22492f){_0x469536=_0x469536-0x0;var _0x3bb2ee=_0xecac[_0x469536];return _0x3bb2ee;};'use strict';var Sequelize=require('sequelize');module[_0xceca('0x0')]={'penalty':{'type':Sequelize[_0xceca('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd043=['exports','INTEGER','sequelize'];(function(_0x21f555,_0x17fad2){var _0x380d39=function(_0x4f8260){while(--_0x4f8260){_0x21f555['push'](_0x21f555['shift']());}};_0x380d39(++_0x17fad2);}(_0xd043,0x143));var _0x3d04=function(_0xc838b8,_0x2f4309){_0xc838b8=_0xc838b8-0x0;var _0x18c0be=_0xd043[_0xc838b8];return _0x18c0be;};'use strict';var Sequelize=require(_0x3d04('0x0'));module[_0x3d04('0x1')]={'penalty':{'type':Sequelize[_0x3d04('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 96e5e80..bc6b3c0 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 _0xeaea=['user_has_openchannel_queues','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','define'];(function(_0x3b5c09,_0x854ae){var _0x187762=function(_0x523822){while(--_0x523822){_0x3b5c09['push'](_0x3b5c09['shift']());}};_0x187762(++_0x854ae);}(_0xeaea,0xe7));var _0xaeae=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xeaea[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0xaeae('0x0'));var util=require('util');var logger=require(_0xaeae('0x1'))(_0xaeae('0x2'));var moment=require(_0xaeae('0x3'));var BPromise=require('bluebird');var rp=require(_0xaeae('0x4'));var fs=require('fs');var path=require(_0xaeae('0x5'));var rimraf=require('rimraf');var config=require(_0xaeae('0x6'));var attributes=require(_0xaeae('0x7'));module['exports']=function(_0x484bf1,_0x2c068b){return _0x484bf1[_0xaeae('0x8')]('UserOpenchannelQueue',attributes,{'tableName':_0xaeae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa666=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x5b63db,_0x2c36aa){var _0xc0a0a2=function(_0x493d29){while(--_0x493d29){_0x5b63db['push'](_0x5b63db['shift']());}};_0xc0a0a2(++_0x2c36aa);}(_0xa666,0xfc));var _0x6a66=function(_0x5addf5,_0x1071ac){_0x5addf5=_0x5addf5-0x0;var _0x1b7361=_0xa666[_0x5addf5];return _0x1b7361;};'use strict';var _=require(_0x6a66('0x0'));var util=require(_0x6a66('0x1'));var logger=require(_0x6a66('0x2'))(_0x6a66('0x3'));var moment=require(_0x6a66('0x4'));var BPromise=require(_0x6a66('0x5'));var rp=require(_0x6a66('0x6'));var fs=require('fs');var path=require(_0x6a66('0x7'));var rimraf=require(_0x6a66('0x8'));var config=require(_0x6a66('0x9'));var attributes=require(_0x6a66('0xa'));module[_0x6a66('0xb')]=function(_0x2aeebd,_0x2cbec4){return _0x2aeebd[_0x6a66('0xc')](_0x6a66('0xd'),attributes,{'tableName':'user_has_openchannel_queues','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 627a6b1..dba517e 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 _0xa6f8=['request','then','debug','request\x20sent','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0xa6f8,0x94));var _0x8a6f=function(_0x3ac064,_0x278b44){_0x3ac064=_0x3ac064-0x0;var _0x57a926=_0xa6f8[_0x3ac064];return _0x57a926;};'use strict';var _=require(_0x8a6f('0x0'));var util=require('util');var moment=require(_0x8a6f('0x1'));var BPromise=require(_0x8a6f('0x2'));var rs=require(_0x8a6f('0x3'));var fs=require('fs');var Redis=require(_0x8a6f('0x4'));var db=require(_0x8a6f('0x5'))['db'];var utils=require(_0x8a6f('0x6'));var logger=require(_0x8a6f('0x7'))(_0x8a6f('0x8'));var config=require(_0x8a6f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8a6f('0xa')][_0x8a6f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25915f,_0x482f58,_0x7dcd55){return new BPromise(function(_0x3f035c,_0x1a4577){return client[_0x8a6f('0xc')](_0x25915f,_0x7dcd55)[_0x8a6f('0xd')](function(_0x32a38b){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x482f58,'request\x20sent');logger[_0x8a6f('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x482f58,_0x8a6f('0xf'),JSON['stringify'](_0x32a38b));if(_0x32a38b[_0x8a6f('0x10')]){if(_0x32a38b['error'][_0x8a6f('0x11')]===0x1f4){logger['error'](_0x8a6f('0x12'),_0x482f58,_0x32a38b[_0x8a6f('0x10')][_0x8a6f('0x13')]);return _0x1a4577(_0x32a38b['error'][_0x8a6f('0x13')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x482f58,_0x32a38b[_0x8a6f('0x10')]['message']);return _0x3f035c(_0x32a38b[_0x8a6f('0x10')][_0x8a6f('0x13')]);}else{logger['info'](_0x8a6f('0x12'),_0x482f58,_0x8a6f('0xf'));_0x3f035c(_0x32a38b['result']['message']);}})['catch'](function(_0x47a614){logger[_0x8a6f('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x482f58,_0x47a614);_0x1a4577(_0x47a614);});});} \ No newline at end of file +var _0x6b1c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x356e95,_0x407c22){var _0x1ab18e=function(_0xf5f88a){while(--_0xf5f88a){_0x356e95['push'](_0x356e95['shift']());}};_0x1ab18e(++_0x407c22);}(_0x6b1c,0x1d5));var _0xc6b1=function(_0x2e902b,_0x30f6c6){_0x2e902b=_0x2e902b-0x0;var _0x5408a3=_0x6b1c[_0x2e902b];return _0x5408a3;};'use strict';var _=require(_0xc6b1('0x0'));var util=require(_0xc6b1('0x1'));var moment=require(_0xc6b1('0x2'));var BPromise=require(_0xc6b1('0x3'));var rs=require(_0xc6b1('0x4'));var fs=require('fs');var Redis=require(_0xc6b1('0x5'));var db=require(_0xc6b1('0x6'))['db'];var utils=require(_0xc6b1('0x7'));var logger=require(_0xc6b1('0x8'))(_0xc6b1('0x9'));var config=require(_0xc6b1('0xa'));var jayson=require(_0xc6b1('0xb'));var client=jayson[_0xc6b1('0xc')][_0xc6b1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x122129,_0x43c372,_0xc08242){return new BPromise(function(_0x56fa1d,_0x3c4069){return client[_0xc6b1('0xe')](_0x122129,_0xc08242)['then'](function(_0x9d0562){logger[_0xc6b1('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x43c372,'request\x20sent');logger['debug'](_0xc6b1('0x10'),_0x43c372,_0xc6b1('0x11'),JSON[_0xc6b1('0x12')](_0x9d0562));if(_0x9d0562[_0xc6b1('0x13')]){if(_0x9d0562[_0xc6b1('0x13')][_0xc6b1('0x14')]===0x1f4){logger[_0xc6b1('0x13')](_0xc6b1('0x15'),_0x43c372,_0x9d0562[_0xc6b1('0x13')]['message']);return _0x3c4069(_0x9d0562['error']['message']);}logger[_0xc6b1('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x43c372,_0x9d0562['error'][_0xc6b1('0x16')]);return _0x56fa1d(_0x9d0562[_0xc6b1('0x13')][_0xc6b1('0x16')]);}else{logger['info'](_0xc6b1('0x15'),_0x43c372,_0xc6b1('0x11'));_0x56fa1d(_0x9d0562[_0xc6b1('0x17')][_0xc6b1('0x16')]);}})[_0xc6b1('0x18')](function(_0x338fb9){logger[_0xc6b1('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x43c372,_0x338fb9);_0x3c4069(_0x338fb9);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e0d50bf..f146674 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 _0xae4a=['../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addResources','put','update','delete','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0xae4a,0x18c));var _0xaae4=function(_0x12e57a,_0x455b50){_0x12e57a=_0x12e57a-0x0;var _0xa0726=_0xae4a[_0x12e57a];return _0xa0726;};'use strict';var multer=require('multer');var util=require(_0xaae4('0x0'));var path=require(_0xaae4('0x1'));var timeout=require(_0xaae4('0x2'));var express=require(_0xaae4('0x3'));var router=express[_0xaae4('0x4')]();var fs_extra=require(_0xaae4('0x5'));var auth=require(_0xaae4('0x6'));var interaction=require(_0xaae4('0x7'));var config=require(_0xaae4('0x8'));var controller=require(_0xaae4('0x9'));router[_0xaae4('0xa')]('/',auth[_0xaae4('0xb')](),controller[_0xaae4('0xc')]);router[_0xaae4('0xa')](_0xaae4('0xd'),auth['isAuthenticated'](),controller[_0xaae4('0xe')]);router[_0xaae4('0xa')](_0xaae4('0xf'),auth[_0xaae4('0xb')](),controller[_0xaae4('0x10')]);router['get'](_0xaae4('0x11'),auth[_0xaae4('0xb')](),controller[_0xaae4('0x12')]);router['get'](_0xaae4('0x13'),auth[_0xaae4('0xb')](),controller[_0xaae4('0x14')]);router[_0xaae4('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaae4('0x15')](_0xaae4('0x16'),auth['isAuthenticated'](),controller[_0xaae4('0x17')]);router[_0xaae4('0x15')](_0xaae4('0x11'),auth[_0xaae4('0xb')](),controller['addSections']);router[_0xaae4('0x15')]('/:id/resources',auth[_0xaae4('0xb')](),controller[_0xaae4('0x18')]);router[_0xaae4('0x19')](_0xaae4('0xf'),auth[_0xaae4('0xb')](),controller[_0xaae4('0x1a')]);router[_0xaae4('0x1b')](_0xaae4('0xf'),auth[_0xaae4('0xb')](),controller['destroy']);router[_0xaae4('0x1b')](_0xaae4('0x11'),auth[_0xaae4('0xb')](),controller[_0xaae4('0x1c')]);router['delete']('/:id/resources',auth['isAuthenticated'](),controller[_0xaae4('0x1d')]);module[_0xaae4('0x1e')]=router; \ No newline at end of file +var _0x9193=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/resources','getResources','post','addResources','put','update','delete','destroy','/:id/sections','removeResources','exports'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x9193,0x1d4));var _0x3919=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9193[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0x3919('0x0'));var util=require(_0x3919('0x1'));var path=require(_0x3919('0x2'));var timeout=require(_0x3919('0x3'));var express=require(_0x3919('0x4'));var router=express[_0x3919('0x5')]();var fs_extra=require(_0x3919('0x6'));var auth=require(_0x3919('0x7'));var interaction=require(_0x3919('0x8'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x3919('0x9')]('/',auth[_0x3919('0xa')](),controller[_0x3919('0xb')]);router[_0x3919('0x9')](_0x3919('0xc'),auth[_0x3919('0xa')](),controller['describe']);router[_0x3919('0x9')](_0x3919('0xd'),auth[_0x3919('0xa')](),controller[_0x3919('0xe')]);router[_0x3919('0x9')]('/:id/sections',auth[_0x3919('0xa')](),controller['getSections']);router['get'](_0x3919('0xf'),auth[_0x3919('0xa')](),controller[_0x3919('0x10')]);router[_0x3919('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3919('0x11')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x3919('0x11')]('/:id/sections',auth[_0x3919('0xa')](),controller['addSections']);router[_0x3919('0x11')](_0x3919('0xf'),auth[_0x3919('0xa')](),controller[_0x3919('0x12')]);router[_0x3919('0x13')](_0x3919('0xd'),auth['isAuthenticated'](),controller[_0x3919('0x14')]);router[_0x3919('0x15')](_0x3919('0xd'),auth['isAuthenticated'](),controller[_0x3919('0x16')]);router[_0x3919('0x15')](_0x3919('0x17'),auth[_0x3919('0xa')](),controller['removeSections']);router[_0x3919('0x15')](_0x3919('0xf'),auth[_0x3919('0xa')](),controller[_0x3919('0x18')]);module[_0x3919('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index fd08cc0..7bd37e5 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 _0xcf68=['split','BOOLEAN','sequelize','exports','STRING','setDataValue','join','getDataValue','crudPermissions'];(function(_0x189aaf,_0x19deae){var _0x3b6e78=function(_0x336e5f){while(--_0x336e5f){_0x189aaf['push'](_0x189aaf['shift']());}};_0x3b6e78(++_0x19deae);}(_0xcf68,0x6e));var _0x8cf6=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xcf68[_0x36c5b0];return _0xf19333;};'use strict';var Sequelize=require(_0x8cf6('0x0'));module[_0x8cf6('0x1')]={'name':{'type':Sequelize[_0x8cf6('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x8cf6('0x2')],'set':function(_0x48c544){this[_0x8cf6('0x3')]('crudPermissions',_0x48c544?_0x48c544[_0x8cf6('0x4')](''):[]);},'get':function(){return this[_0x8cf6('0x5')](_0x8cf6('0x6'))?this['getDataValue'](_0x8cf6('0x6'))[_0x8cf6('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8cf6('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8cf6('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8cf6('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8cf6('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8cf6('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8cf6('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8cf6('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x86d0=['BOOLEAN','sequelize','exports','name','STRING','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x23267f,_0x27da39){var _0x1a8af3=function(_0x39dca4){while(--_0x39dca4){_0x23267f['push'](_0x23267f['shift']());}};_0x1a8af3(++_0x27da39);}(_0x86d0,0x10f));var _0x086d=function(_0x46b7ed,_0x211e80){_0x46b7ed=_0x46b7ed-0x0;var _0x25ffb4=_0x86d0[_0x46b7ed];return _0x25ffb4;};'use strict';var Sequelize=require(_0x086d('0x0'));module[_0x086d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x086d('0x2')},'crudPermissions':{'type':Sequelize[_0x086d('0x3')],'set':function(_0x1599f2){this[_0x086d('0x4')](_0x086d('0x5'),_0x1599f2?_0x1599f2[_0x086d('0x6')](''):[]);},'get':function(){return this[_0x086d('0x7')](_0x086d('0x5'))?this[_0x086d('0x7')](_0x086d('0x5'))[_0x086d('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x086d('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x086d('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x086d('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x086d('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x086d('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x086d('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x086d('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index aad24fa..8b03345 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 _0xc79a=['body','sequelize','autoAssociation','UserProfileResource','createdAt','userProfileId','Resources','UserProfileSection','describe','addSections','transaction','each','push','removeSections','ids','getSections','enabled','includes','sectionId','isEmpty','subsections','concat','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','UserProfile','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','create','clone','params','keys','find','get','omit','updatedAt','crudPermissions'];(function(_0x316efa,_0x20a1e1){var _0x4d96cc=function(_0x4a0648){while(--_0x4a0648){_0x316efa['push'](_0x316efa['shift']());}};_0x4d96cc(++_0x20a1e1);}(_0xc79a,0x183));var _0xac79=function(_0x279e6f,_0x566574){_0x279e6f=_0x279e6f-0x0;var _0x489a5f=_0xc79a[_0x279e6f];return _0x489a5f;};'use strict';var emlformat=require(_0xac79('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac79('0x1'));var jsonpatch=require(_0xac79('0x2'));var rp=require(_0xac79('0x3'));var moment=require('moment');var BPromise=require(_0xac79('0x4'));var Mustache=require(_0xac79('0x5'));var util=require(_0xac79('0x6'));var path=require(_0xac79('0x7'));var sox=require('sox');var csv=require(_0xac79('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac79('0x9'));var _=require(_0xac79('0xa'));var squel=require(_0xac79('0xb'));var crypto=require(_0xac79('0xc'));var jsforce=require(_0xac79('0xd'));var deskjs=require(_0xac79('0xe'));var toCsv=require(_0xac79('0x8'));var querystring=require(_0xac79('0xf'));var Papa=require('papaparse');var Redis=require(_0xac79('0x10'));var authService=require(_0xac79('0x11'));var qs=require(_0xac79('0x12'));var as=require(_0xac79('0x13'));var hardwareService=require(_0xac79('0x14'));var logger=require(_0xac79('0x15'))('api');var utils=require(_0xac79('0x16'));var config=require(_0xac79('0x17'));var licenseUtil=require(_0xac79('0x18'));var db=require(_0xac79('0x19'))['db'];config[_0xac79('0x1a')]=_[_0xac79('0x1b')](config[_0xac79('0x1a')],{'host':_0xac79('0x1c'),'port':0x18eb});var socket=require(_0xac79('0x1d'))(new Redis(config[_0xac79('0x1a')]));require(_0xac79('0x1e'))[_0xac79('0x1f')](socket);function respondWithStatusCode(_0x35dbaa,_0xa25600){_0xa25600=_0xa25600||0xcc;return function(_0x4ce75f){if(_0x4ce75f){return _0x35dbaa['sendStatus'](_0xa25600);}return _0x35dbaa[_0xac79('0x20')](_0xa25600)[_0xac79('0x21')]();};}function respondWithResult(_0x1fb754,_0x4bed01){_0x4bed01=_0x4bed01||0xc8;return function(_0x4b09ad){if(_0x4b09ad){return _0x1fb754[_0xac79('0x20')](_0x4bed01)['json'](_0x4b09ad);}};}function respondWithFilteredResult(_0x32b811,_0x51fbfc){return function(_0x2a57ad){if(_0x2a57ad){var _0x4a097c=typeof _0x51fbfc[_0xac79('0x22')]==='undefined'&&typeof _0x51fbfc['limit']===_0xac79('0x23');var _0x3599a8=_0x2a57ad['count'];var _0x4e3354=_0x4a097c?0x0:_0x51fbfc['offset'];var _0x257970=_0x4a097c?_0x2a57ad[_0xac79('0x24')]:_0x51fbfc[_0xac79('0x22')]+_0x51fbfc[_0xac79('0x25')];var _0x5acac7;if(_0x257970>=_0x3599a8){_0x257970=_0x3599a8;_0x5acac7=0xc8;}else{_0x5acac7=0xce;}_0x32b811[_0xac79('0x20')](_0x5acac7);return _0x32b811[_0xac79('0x26')](_0xac79('0x27'),_0x4e3354+'-'+_0x257970+'/'+_0x3599a8)[_0xac79('0x28')](_0x2a57ad);}return null;};}function patchUpdates(_0x5c5516){return function(_0x17f10b){try{jsonpatch[_0xac79('0x29')](_0x17f10b,_0x5c5516,!![]);}catch(_0xd47e98){return BPromise['reject'](_0xd47e98);}return _0x17f10b[_0xac79('0x2a')]();};}function saveUpdates(_0x4cb99d,_0x1a5e80){return function(_0xea5624){if(_0xea5624){return _0xea5624[_0xac79('0x2b')](_0x4cb99d)[_0xac79('0x2c')](function(_0x23511a){return _0x23511a;});}return null;};}function removeEntity(_0x4ae9e3,_0x446b36){return function(_0x2e1a04){if(_0x2e1a04){return _0x2e1a04[_0xac79('0x2d')]()[_0xac79('0x2c')](function(){_0x4ae9e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x553af0,_0x23aae9){return function(_0x258296){if(!_0x258296){_0x553af0[_0xac79('0x2e')](0x194);}return _0x258296;};}function handleError(_0x26f55e,_0x442e33){_0x442e33=_0x442e33||0x1f4;return function(_0x25b00d){logger[_0xac79('0x2f')](_0x25b00d[_0xac79('0x30')]);if(_0x25b00d[_0xac79('0x31')]){delete _0x25b00d[_0xac79('0x31')];}_0x26f55e['status'](_0x442e33)[_0xac79('0x32')](_0x25b00d);};}exports[_0xac79('0x33')]=function(_0x4ac5e5,_0x6c6311){var _0x2dd529={},_0xeac40b={},_0x12b5ea={'count':0x0,'rows':[]};var _0x3ac871=_['map'](db[_0xac79('0x34')]['rawAttributes'],function(_0x49b4d5){return{'name':_0x49b4d5[_0xac79('0x35')],'type':_0x49b4d5[_0xac79('0x36')][_0xac79('0x37')]};});_0xeac40b[_0xac79('0x38')]=_[_0xac79('0x39')](_0x3ac871,_0xac79('0x31'));_0xeac40b[_0xac79('0x3a')]=_['keys'](_0x4ac5e5['query']);_0xeac40b[_0xac79('0x3b')]=_['intersection'](_0xeac40b[_0xac79('0x38')],_0xeac40b['query']);_0x2dd529[_0xac79('0x3c')]=_[_0xac79('0x3d')](_0xeac40b[_0xac79('0x38')],qs['fields'](_0x4ac5e5[_0xac79('0x3a')][_0xac79('0x3e')]));_0x2dd529[_0xac79('0x3c')]=_0x2dd529[_0xac79('0x3c')]['length']?_0x2dd529[_0xac79('0x3c')]:_0xeac40b[_0xac79('0x38')];if(!_0x4ac5e5[_0xac79('0x3a')][_0xac79('0x3f')](_0xac79('0x40'))){_0x2dd529['limit']=qs[_0xac79('0x25')](_0x4ac5e5[_0xac79('0x3a')][_0xac79('0x25')]);_0x2dd529[_0xac79('0x22')]=qs[_0xac79('0x22')](_0x4ac5e5[_0xac79('0x3a')][_0xac79('0x22')]);}_0x2dd529['order']=qs[_0xac79('0x41')](_0x4ac5e5[_0xac79('0x3a')][_0xac79('0x41')]);_0x2dd529[_0xac79('0x42')]=qs['filters'](_['pick'](_0x4ac5e5[_0xac79('0x3a')],_0xeac40b[_0xac79('0x3b')]),_0x3ac871);if(_0x4ac5e5[_0xac79('0x3a')]['filter']){_0x2dd529['where']=_[_0xac79('0x43')](_0x2dd529['where'],{'$or':_[_0xac79('0x39')](_0x3ac871,function(_0x527dd0){if(_0x527dd0[_0xac79('0x36')]!=='VIRTUAL'){var _0xb219fa={};_0xb219fa[_0x527dd0[_0xac79('0x31')]]={'$like':'%'+_0x4ac5e5['query'][_0xac79('0x44')]+'%'};return _0xb219fa;}})});}_0x2dd529=_[_0xac79('0x43')]({},_0x2dd529,_0x4ac5e5[_0xac79('0x45')]);var _0x28ce20={'where':_0x2dd529[_0xac79('0x42')]};return db[_0xac79('0x34')]['count'](_0x28ce20)[_0xac79('0x2c')](function(_0x300ae7){_0x12b5ea[_0xac79('0x24')]=_0x300ae7;if(_0x4ac5e5[_0xac79('0x3a')][_0xac79('0x46')]){_0x2dd529[_0xac79('0x47')]=[{'all':!![]}];}return db[_0xac79('0x34')][_0xac79('0x48')](_0x2dd529);})[_0xac79('0x2c')](function(_0x5d70cd){_0x12b5ea[_0xac79('0x49')]=_0x5d70cd;return _0x12b5ea;})[_0xac79('0x2c')](respondWithFilteredResult(_0x6c6311,_0x2dd529))[_0xac79('0x4a')](handleError(_0x6c6311,null));};exports[_0xac79('0x4b')]=function(_0x5eb971,_0x3970fe){var _0x32b729={'raw':![],'where':{'id':_0x5eb971['params']['id']}},_0x13557c={};_0x13557c[_0xac79('0x38')]=_['keys'](db[_0xac79('0x34')]['rawAttributes']);_0x13557c[_0xac79('0x3a')]=_['keys'](_0x5eb971['query']);_0x13557c['filters']=_[_0xac79('0x3d')](_0x13557c[_0xac79('0x38')],_0x13557c[_0xac79('0x3a')]);_0x32b729[_0xac79('0x3c')]=_['intersection'](_0x13557c['model'],qs[_0xac79('0x3e')](_0x5eb971['query'][_0xac79('0x3e')]));_0x32b729[_0xac79('0x3c')]=_0x32b729[_0xac79('0x3c')]['length']?_0x32b729[_0xac79('0x3c')]:_0x13557c[_0xac79('0x38')];if(_0x5eb971[_0xac79('0x3a')]['includeAll']){_0x32b729[_0xac79('0x47')]=[{'all':!![]}];}_0x32b729=_[_0xac79('0x43')]({},_0x32b729,_0x5eb971[_0xac79('0x45')]);return db[_0xac79('0x34')]['find'](_0x32b729)[_0xac79('0x2c')](handleEntityNotFound(_0x3970fe,null))[_0xac79('0x2c')](respondWithResult(_0x3970fe,null))[_0xac79('0x4a')](handleError(_0x3970fe,null));};exports[_0xac79('0x4c')]=function(_0x10d7e1,_0x58b551){return db[_0xac79('0x34')][_0xac79('0x4c')](_0x10d7e1['body'],{})['then'](respondWithResult(_0x58b551,0xc9))[_0xac79('0x4a')](handleError(_0x58b551,null));};exports[_0xac79('0x4d')]=function(_0x40a172,_0x1bb2b){var _0x3bfa03={'where':{'id':_0x40a172[_0xac79('0x4e')]['id']}},_0x592efe={};_0x592efe[_0xac79('0x38')]=_[_0xac79('0x4f')](db['UserProfile']['rawAttributes']);_0x3bfa03[_0xac79('0x3c')]=_['intersection'](_0x592efe[_0xac79('0x38')],qs['fields'](_0x40a172['query'][_0xac79('0x3e')]));_0x3bfa03[_0xac79('0x3c')]=_0x3bfa03[_0xac79('0x3c')]['length']?_0x3bfa03[_0xac79('0x3c')]:_0x592efe[_0xac79('0x38')];if(_0x40a172[_0xac79('0x3a')][_0xac79('0x46')]){_0x3bfa03[_0xac79('0x47')]=[{'all':!![]}];}_0x3bfa03=_[_0xac79('0x43')]({},_0x3bfa03,_0x40a172['options']);return db['UserProfile'][_0xac79('0x50')](_0x3bfa03)[_0xac79('0x2c')](handleEntityNotFound(_0x1bb2b,null))[_0xac79('0x2c')](function(_0x12a686){if(_0x12a686){var _0x4196b7=_0x12a686[_0xac79('0x51')]({'plain':!![]});_0x4196b7=qs[_0xac79('0x52')](_0x4196b7,['id','createdAt',_0xac79('0x53'),_0xac79('0x54')]);_0x40a172[_0xac79('0x55')]=_[_0xac79('0x52')](_0x40a172[_0xac79('0x55')],['id','createdAt',_0xac79('0x53')]);return db[_0xac79('0x56')]['transaction'](function(_0x23a342){return db[_0xac79('0x34')]['create'](_['merge'](_0x4196b7,_0x40a172[_0xac79('0x55')]),{'include':_0x40a172[_0xac79('0x3a')][_0xac79('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x23a342})['then'](function(_0xb28cb6){var _0x300f04=_0xb28cb6['get']({'plain':!![]});return db['UserProfileSection'][_0xac79('0x48')]({'where':{'userProfileId':_0x40a172['params']['id']},'raw':!![]})[_0xac79('0x2c')](function(_0x43dea7){if(_0x43dea7){return BPromise['each'](_0x43dea7,function(_0x3e1b1a){return new BPromise(function(_0x354a7c,_0x159e88){if(_0x3e1b1a[_0xac79('0x57')]===null||_0x3e1b1a['autoAssociation']===0x1)_0x354a7c(null);return db[_0xac79('0x58')][_0xac79('0x48')]({'where':{'sectionId':_0x3e1b1a['id']},'raw':!![]})['then'](function(_0x27726f){var _0x451d17=_[_0xac79('0x39')](_0x27726f,function(_0x52183a){return qs['omit'](_0x52183a,['id',_0xac79('0x59'),_0xac79('0x53'),'sectionId']);});_0x354a7c(_0x451d17);})[_0xac79('0x4a')](function(_0x2b8ac3){_0x159e88(_0x2b8ac3);});})[_0xac79('0x2c')](function(_0x3ac855){var _0x4b2d16=qs[_0xac79('0x52')](_0x3e1b1a,['id',_0xac79('0x59'),_0xac79('0x53')]);_0x4b2d16[_0xac79('0x5a')]=_0x300f04['id'];if(_0x3ac855)_0x4b2d16[_0xac79('0x5b')]=_0x3ac855;return _0x4b2d16;})[_0xac79('0x2c')](function(_0x293cb6){return db[_0xac79('0x5c')][_0xac79('0x4c')](_0x293cb6,{'include':[{'model':db[_0xac79('0x58')],'as':_0xac79('0x5b')}],'raw':!![],'transaction':_0x23a342});});})[_0xac79('0x2c')](function(){return _0x300f04;});}});});});}})[_0xac79('0x2c')](respondWithResult(_0x1bb2b,0xc9))[_0xac79('0x4a')](handleError(_0x1bb2b,null));};exports[_0xac79('0x2b')]=function(_0x3d47ba,_0xb5393b){if(_0x3d47ba[_0xac79('0x55')]['id']){delete _0x3d47ba['body']['id'];}return db[_0xac79('0x34')][_0xac79('0x50')]({'where':{'id':_0x3d47ba[_0xac79('0x4e')]['id']}})[_0xac79('0x2c')](handleEntityNotFound(_0xb5393b,null))[_0xac79('0x2c')](saveUpdates(_0x3d47ba[_0xac79('0x55')],null))[_0xac79('0x2c')](respondWithResult(_0xb5393b,null))[_0xac79('0x4a')](handleError(_0xb5393b,null));};exports[_0xac79('0x2d')]=function(_0x4960cc,_0x5280be){return db[_0xac79('0x34')][_0xac79('0x50')]({'where':{'id':_0x4960cc[_0xac79('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5280be,null))['then'](removeEntity(_0x5280be,null))[_0xac79('0x4a')](handleError(_0x5280be,null));};exports['describe']=function(_0x1a299a,_0x327af9){return db[_0xac79('0x34')][_0xac79('0x5d')]()[_0xac79('0x2c')](respondWithResult(_0x327af9,null))[_0xac79('0x4a')](handleError(_0x327af9,null));};exports[_0xac79('0x5e')]=function(_0x2d658b,_0x120bc5){var _0xbd08=_0x2d658b[_0xac79('0x55')];return db['UserProfile'][_0xac79('0x50')]({'where':{'id':_0x2d658b[_0xac79('0x4e')]['id']}})[_0xac79('0x2c')](handleEntityNotFound(_0x120bc5,null))[_0xac79('0x2c')](function(_0x2f8492){if(_0x2f8492){return db[_0xac79('0x56')][_0xac79('0x5f')](function(_0xc215ad){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x2d658b['params']['id'],'sectionId':_[_0xac79('0x39')](_0xbd08,function(_0x4959e7){return _0x4959e7['sectionId'];})},'transaction':_0xc215ad})[_0xac79('0x2c')](function(){var _0xfd63ed=_[_0xac79('0x39')](_0xbd08,function(_0x4208a7){_0x4208a7['userProfileId']=_0x2d658b[_0xac79('0x4e')]['id'];return _0x4208a7;});var _0x1b2d64=[];return BPromise[_0xac79('0x60')](_0xfd63ed,function(_0x4ce3ae){return db[_0xac79('0x5c')][_0xac79('0x4c')](_0x4ce3ae,{'include':[{'model':db[_0xac79('0x58')],'as':_0xac79('0x5b')}],'raw':!![],'transaction':_0xc215ad})[_0xac79('0x2c')](function(_0xd519ca){_0x1b2d64[_0xac79('0x61')](_0xd519ca[_0xac79('0x51')]({'plain':!![]}));});})['then'](function(){return _0x1b2d64;});});});}})['then'](function(_0x21630b){return _0x21630b;})['then'](respondWithResult(_0x120bc5,null))['catch'](handleError(_0x120bc5,null));};exports[_0xac79('0x62')]=function(_0x19bf63,_0x534d20){var _0x27abc5;return db[_0xac79('0x34')][_0xac79('0x50')]({'where':{'id':_0x19bf63[_0xac79('0x4e')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x534d20,null))['then'](function(_0x289365){if(_0x289365){_0x27abc5=_0x289365;return db[_0xac79('0x5c')][_0xac79('0x2d')]({'where':{'userProfileId':_0x19bf63[_0xac79('0x4e')]['id'],'sectionId':_0x19bf63['query'][_0xac79('0x63')]}});}})[_0xac79('0x2c')](function(){return _0x27abc5;})['then'](respondWithStatusCode(_0x534d20,null))[_0xac79('0x4a')](handleError(_0x534d20,null));};exports[_0xac79('0x64')]=function(_0x3ead21,_0x590ef0){var _0x121643=[];var _0x31542e=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3ead21[_0xac79('0x4e')]['id']},'raw':!![]})['then'](function(_0x511d47){_0x121643=_['filter'](_0x511d47,function(_0x4414a5){return _0x4414a5[_0xac79('0x65')]===0x1||_[_0xac79('0x66')]([0x3eb,0x709],_0x4414a5[_0xac79('0x67')]);});if(!_[_0xac79('0x68')](_0x121643)){return _[_0xac79('0x39')](_0x121643,function(_0x4c4baf){return _0x4c4baf[_0xac79('0x67')];});}else{return;}})[_0xac79('0x2c')](function(_0x2c5248){if(_0x2c5248)_0x31542e=_0x2c5248;if(_[_0xac79('0x66')](_0x31542e,0x64)){var _0x45a3fc=_['find'](_0x121643,{'sectionId':0x64});return hasDefaultDashboard(_0x45a3fc)[_0xac79('0x2c')](function(_0x4b68b3){return _[_0xac79('0x39')](_0x121643,function(_0x4d5bf3){if(_0x4d5bf3[_0xac79('0x67')]===0x64){_0x4d5bf3[_0xac79('0x69')]=_0x4b68b3;}return _0x4d5bf3;});});}else{return;}})['then'](function(_0x527e21){if(_0x527e21)_0x121643=_0x527e21;if(_[_0xac79('0x66')](_0x31542e,0x3eb)){var _0x22bde6=_[_0xac79('0x50')](_0x121643,{'sectionId':0x3eb});return getCustomDashboards(_0x22bde6)[_0xac79('0x2c')](function(_0x4cbf8a){return _['map'](_0x121643,function(_0x495515){if(_0x22bde6[_0xac79('0x65')]){if(_0x495515[_0xac79('0x67')]===0x3eb){_0x495515[_0xac79('0x69')]=_0x4cbf8a;}}else{if(_0x495515[_0xac79('0x67')]===0x64){if(!_0x495515['subsections']){_0x495515[_0xac79('0x69')]=[];}_0x495515[_0xac79('0x69')]=_0x495515[_0xac79('0x69')][_0xac79('0x6a')](_0x4cbf8a);}}return _0x495515;});});}else{return;}})['then'](function(_0x441097){if(_0x441097)_0x121643=_0x441097;if(_[_0xac79('0x66')](_0x31542e,0x709)){var _0x463c00=_[_0xac79('0x50')](_0x121643,{'sectionId':0x709});return getPlugins(_0x463c00)[_0xac79('0x2c')](function(_0x1c0b29){if(_0x463c00[_0xac79('0x65')]){return _['map'](_0x121643,function(_0x4107b5){if(_0x4107b5[_0xac79('0x67')]===0x709){_0x4107b5['subsections']=_0x1c0b29;}return _0x4107b5;});}else{var _0x5a3b1b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1c0b29};var _0x112e28=_[_0xac79('0x39')](_0x121643);_0x112e28['push'](_0x5a3b1b);return _0x112e28;}});}else{return;}})[_0xac79('0x2c')](function(_0x5219d8){if(_0x5219d8)_0x121643=_0x5219d8;return _['filter'](_0x121643,[_0xac79('0x65'),0x1]);})['then'](respondWithResult(_0x590ef0,null))[_0xac79('0x4a')](handleError(_0x590ef0,null));};function hasDefaultDashboard(_0x3a0c31){var _0x3b1b45=[0x65];return new BPromise(function(_0x417e5b,_0x10ec98){try{if(_0x3a0c31[_0xac79('0x57')]){_0x417e5b(_0x3b1b45);}else{return db['UserProfileResource'][_0xac79('0x6b')]({'where':{'sectionId':_0x3a0c31['id']},'raw':!![]})['then'](function(_0x25f2fb){_0x25f2fb?_0x417e5b(_0x3b1b45):_0x417e5b();});}}catch(_0x3f0d17){_0x10ec98(_0x3f0d17);}});}function getCustomDashboards(_0x55e5bd){var _0x203c1a=[];return new BPromise(function(_0x1e3e7e,_0x462845){try{if(_0x55e5bd[_0xac79('0x57')]){return db[_0xac79('0x6c')][_0xac79('0x48')]({'raw':!![]})[_0xac79('0x2c')](function(_0x44c4b4){_0x44c4b4[_0xac79('0x6d')](function(_0x1f9548){_0x203c1a[_0xac79('0x61')](_0x1f9548['id']+0x1869f);});_0x1e3e7e(_0x203c1a);});}else{return db[_0xac79('0x58')][_0xac79('0x48')]({'where':{'sectionId':_0x55e5bd['id']},'raw':!![]})[_0xac79('0x2c')](function(_0x98df46){_0x98df46[_0xac79('0x6d')](function(_0xf71b0c){_0x203c1a[_0xac79('0x61')](_0xf71b0c['resourceId']+0x1869f);});_0x1e3e7e(_0x203c1a);});}}catch(_0x2efda6){_0x462845(_0x2efda6);}});}function getPlugins(_0x236fbb){var _0x12e293=[];return new BPromise(function(_0x254976,_0x48e319){try{if(_0x236fbb['autoAssociation']){return db[_0xac79('0x6e')][_0xac79('0x48')]({'raw':!![]})[_0xac79('0x2c')](function(_0x4ef98e){_0x4ef98e[_0xac79('0x6d')](function(_0x4a909b){_0x12e293['push'](_0x4a909b['id']+0x15b38);});_0x254976(_0x12e293);});}else{return db['UserProfileResource'][_0xac79('0x48')]({'where':{'sectionId':_0x236fbb['id']},'raw':!![]})['then'](function(_0xb4425){_0xb4425['forEach'](function(_0x5e60bd){_0x12e293[_0xac79('0x61')](_0x5e60bd[_0xac79('0x6f')]+0x15b38);});_0x254976(_0x12e293);});}}catch(_0x564ca8){_0x48e319(_0x564ca8);}});}exports[_0xac79('0x70')]=function(_0x32464d,_0x4d3dda){return db[_0xac79('0x34')]['find']({'where':{'id':_0x32464d[_0xac79('0x4e')]['id']}})[_0xac79('0x2c')](handleEntityNotFound(_0x4d3dda,null))[_0xac79('0x2c')](function(_0x50f70f){if(_0x50f70f){return db[_0xac79('0x56')][_0xac79('0x5f')](function(_0x55ccd6){return db['UserProfileSection'][_0xac79('0x48')]({'where':{'userProfileId':_0x32464d[_0xac79('0x4e')]['id']},'attributes':['id'],'raw':!![]})[_0xac79('0x2c')](function(_0x468c5b){if(_0x468c5b){return db[_0xac79('0x5c')][_0xac79('0x2d')]({'where':{'userProfileId':_0x32464d[_0xac79('0x4e')]['id'],'id':_[_0xac79('0x39')](_0x468c5b,function(_0x17f807){return _0x17f807['id'];})},'transaction':_0x55ccd6});}})[_0xac79('0x2c')](function(_0x5cedf1){var _0x12ca5e=_['map'](_0x32464d['body'],function(_0x26e3b4){_0x26e3b4[_0xac79('0x5a')]=_0x32464d[_0xac79('0x4e')]['id'];return _0x26e3b4;});return db[_0xac79('0x5c')]['bulkCreate'](_0x12ca5e,{'raw':!![],'transaction':_0x55ccd6});})['then'](function(_0xc026d4){var _0x228048=_[_0xac79('0x44')](_[_0xac79('0x39')](_0xc026d4,function(_0x39a1f4){return _0x39a1f4[_0xac79('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x228048){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x32464d[_0xac79('0x4e')]['id'],'sectionId':_[_0xac79('0x39')](_0x228048,function(_0x28335d){return _0x28335d['sectionId'];})},'attributes':['id',_0xac79('0x67')],'raw':!![]})[_0xac79('0x2c')](function(_0x7814c8){var _0x5797b8=_[_0xac79('0x39')](_0x32464d[_0xac79('0x55')],function(_0x2a0ce3){_0x2a0ce3['userProfileId']=_0x32464d['params']['id'];return _0x2a0ce3;});return db[_0xac79('0x58')][_0xac79('0x71')](_0x5797b8,{'raw':!![],'transaction':_0x55ccd6});});}})[_0xac79('0x4a')](handleError(_0x4d3dda,null));});}})[_0xac79('0x2c')](function(_0x367926){var _0x2a5b29=_['map'](_0x367926,function(_0x19aca7){return _0x19aca7[_0xac79('0x51')]({'plain':!![]});});})[_0xac79('0x2c')](respondWithResult(_0x4d3dda,null))['catch'](handleError(_0x4d3dda,null));};exports[_0xac79('0x72')]=function(_0x1d2a05,_0x898b7,_0x4894a8){return db[_0xac79('0x34')]['find']({'where':{'id':_0x1d2a05[_0xac79('0x4e')]['id']}})[_0xac79('0x2c')](handleEntityNotFound(_0x898b7,null))['then'](function(_0x5bb338){if(_0x5bb338){return _0x5bb338[_0xac79('0x72')](_0x1d2a05[_0xac79('0x3a')][_0xac79('0x63')]);}})[_0xac79('0x2c')](respondWithStatusCode(_0x898b7,null))[_0xac79('0x4a')](handleError(_0x898b7,null));};exports['getResources']=function(_0x41f4ca,_0x337cbe){var _0x208df9={};if(!_0x41f4ca[_0xac79('0x3a')]['section'])throw new Error(_0xac79('0x73'));if(!_0x41f4ca['query'][_0xac79('0x3f')](_0xac79('0x40'))){_0x208df9[_0xac79('0x25')]=qs[_0xac79('0x25')](_0x41f4ca[_0xac79('0x3a')][_0xac79('0x25')]);_0x208df9[_0xac79('0x22')]=qs[_0xac79('0x22')](_0x41f4ca[_0xac79('0x3a')][_0xac79('0x22')]);}return db[_0xac79('0x34')][_0xac79('0x50')]({'where':{'id':_0x41f4ca[_0xac79('0x4e')]['id']}})['then'](function(_0x543ce5){if(!_0x543ce5)throw new Error(_0xac79('0x74')+_0x41f4ca[_0xac79('0x4e')]['id']);return db[_0xac79('0x34')][_0xac79('0x75')](_0x41f4ca);})['then'](respondWithFilteredResult(_0x337cbe,_0x208df9))['catch'](handleError(_0x337cbe,null));}; \ No newline at end of file +var _0x724e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','update','then','destroy','error','stack','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','name','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','filters','find','create','body','clone','params','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','each','removeSections','ids','getSections','enabled','includes','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1dc938,_0x2c369b){var _0x18ae0d=function(_0x11af48){while(--_0x11af48){_0x1dc938['push'](_0x1dc938['shift']());}};_0x18ae0d(++_0x2c369b);}(_0x724e,0x1c0));var _0xe724=function(_0x1baa10,_0x222681){_0x1baa10=_0x1baa10-0x0;var _0x8a31f8=_0x724e[_0x1baa10];return _0x8a31f8;};'use strict';var emlformat=require(_0xe724('0x0'));var rimraf=require(_0xe724('0x1'));var zipdir=require(_0xe724('0x2'));var jsonpatch=require(_0xe724('0x3'));var rp=require('request-promise');var moment=require(_0xe724('0x4'));var BPromise=require(_0xe724('0x5'));var Mustache=require(_0xe724('0x6'));var util=require(_0xe724('0x7'));var path=require(_0xe724('0x8'));var sox=require(_0xe724('0x9'));var csv=require(_0xe724('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe724('0xb'));var _=require(_0xe724('0xc'));var squel=require(_0xe724('0xd'));var crypto=require(_0xe724('0xe'));var jsforce=require(_0xe724('0xf'));var deskjs=require(_0xe724('0x10'));var toCsv=require(_0xe724('0xa'));var querystring=require(_0xe724('0x11'));var Papa=require(_0xe724('0x12'));var Redis=require(_0xe724('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe724('0x14'));var as=require(_0xe724('0x15'));var hardwareService=require(_0xe724('0x16'));var logger=require(_0xe724('0x17'))(_0xe724('0x18'));var utils=require(_0xe724('0x19'));var config=require(_0xe724('0x1a'));var licenseUtil=require(_0xe724('0x1b'));var db=require(_0xe724('0x1c'))['db'];config[_0xe724('0x1d')]=_[_0xe724('0x1e')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe724('0x1f'))(new Redis(config[_0xe724('0x1d')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x3a17e7,_0x55041e){_0x55041e=_0x55041e||0xcc;return function(_0x47720b){if(_0x47720b){return _0x3a17e7[_0xe724('0x20')](_0x55041e);}return _0x3a17e7[_0xe724('0x21')](_0x55041e)[_0xe724('0x22')]();};}function respondWithResult(_0x1bfc11,_0x6878e4){_0x6878e4=_0x6878e4||0xc8;return function(_0xcb44bd){if(_0xcb44bd){return _0x1bfc11[_0xe724('0x21')](_0x6878e4)[_0xe724('0x23')](_0xcb44bd);}};}function respondWithFilteredResult(_0x4adb83,_0x39847b){return function(_0x4dd3f7){if(_0x4dd3f7){var _0x48d3cf=typeof _0x39847b['offset']==='undefined'&&typeof _0x39847b[_0xe724('0x24')]===_0xe724('0x25');var _0x16cb6f=_0x4dd3f7['count'];var _0x8cb9df=_0x48d3cf?0x0:_0x39847b[_0xe724('0x26')];var _0x505eab=_0x48d3cf?_0x4dd3f7[_0xe724('0x27')]:_0x39847b[_0xe724('0x26')]+_0x39847b[_0xe724('0x24')];var _0x415560;if(_0x505eab>=_0x16cb6f){_0x505eab=_0x16cb6f;_0x415560=0xc8;}else{_0x415560=0xce;}_0x4adb83[_0xe724('0x21')](_0x415560);return _0x4adb83[_0xe724('0x28')](_0xe724('0x29'),_0x8cb9df+'-'+_0x505eab+'/'+_0x16cb6f)[_0xe724('0x23')](_0x4dd3f7);}return null;};}function patchUpdates(_0x15e6de){return function(_0x2e598f){try{jsonpatch['apply'](_0x2e598f,_0x15e6de,!![]);}catch(_0x102c10){return BPromise['reject'](_0x102c10);}return _0x2e598f['save']();};}function saveUpdates(_0x21197e,_0x5d212c){return function(_0x2ee579){if(_0x2ee579){return _0x2ee579[_0xe724('0x2a')](_0x21197e)[_0xe724('0x2b')](function(_0x2fd255){return _0x2fd255;});}return null;};}function removeEntity(_0x2aedd6,_0xfa3cdf){return function(_0x41784f){if(_0x41784f){return _0x41784f[_0xe724('0x2c')]()[_0xe724('0x2b')](function(){_0x2aedd6[_0xe724('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3048d1,_0x1efe26){return function(_0x3aedfa){if(!_0x3aedfa){_0x3048d1[_0xe724('0x20')](0x194);}return _0x3aedfa;};}function handleError(_0x4934da,_0x4f61a9){_0x4f61a9=_0x4f61a9||0x1f4;return function(_0x1b2a25){logger[_0xe724('0x2d')](_0x1b2a25[_0xe724('0x2e')]);if(_0x1b2a25['name']){delete _0x1b2a25['name'];}_0x4934da[_0xe724('0x21')](_0x4f61a9)[_0xe724('0x2f')](_0x1b2a25);};}exports[_0xe724('0x30')]=function(_0x213062,_0x4ff1be){var _0x124bf3={},_0x52be24={},_0x269812={'count':0x0,'rows':[]};var _0x1025c9=_[_0xe724('0x31')](db[_0xe724('0x32')][_0xe724('0x33')],function(_0x2982de){return{'name':_0x2982de[_0xe724('0x34')],'type':_0x2982de[_0xe724('0x35')][_0xe724('0x36')]};});_0x52be24[_0xe724('0x37')]=_['map'](_0x1025c9,_0xe724('0x38'));_0x52be24[_0xe724('0x39')]=_['keys'](_0x213062[_0xe724('0x39')]);_0x52be24['filters']=_[_0xe724('0x3a')](_0x52be24[_0xe724('0x37')],_0x52be24[_0xe724('0x39')]);_0x124bf3[_0xe724('0x3b')]=_['intersection'](_0x52be24[_0xe724('0x37')],qs[_0xe724('0x3c')](_0x213062[_0xe724('0x39')][_0xe724('0x3c')]));_0x124bf3['attributes']=_0x124bf3['attributes'][_0xe724('0x3d')]?_0x124bf3[_0xe724('0x3b')]:_0x52be24[_0xe724('0x37')];if(!_0x213062[_0xe724('0x39')][_0xe724('0x3e')]('nolimit')){_0x124bf3['limit']=qs['limit'](_0x213062[_0xe724('0x39')][_0xe724('0x24')]);_0x124bf3['offset']=qs['offset'](_0x213062[_0xe724('0x39')][_0xe724('0x26')]);}_0x124bf3['order']=qs['sort'](_0x213062['query'][_0xe724('0x3f')]);_0x124bf3[_0xe724('0x40')]=qs['filters'](_[_0xe724('0x41')](_0x213062[_0xe724('0x39')],_0x52be24['filters']),_0x1025c9);if(_0x213062[_0xe724('0x39')][_0xe724('0x42')]){_0x124bf3[_0xe724('0x40')]=_[_0xe724('0x43')](_0x124bf3['where'],{'$or':_['map'](_0x1025c9,function(_0x3d5d38){if(_0x3d5d38[_0xe724('0x35')]!=='VIRTUAL'){var _0x43df8c={};_0x43df8c[_0x3d5d38[_0xe724('0x38')]]={'$like':'%'+_0x213062[_0xe724('0x39')]['filter']+'%'};return _0x43df8c;}})});}_0x124bf3=_[_0xe724('0x43')]({},_0x124bf3,_0x213062[_0xe724('0x44')]);var _0x416730={'where':_0x124bf3[_0xe724('0x40')]};return db[_0xe724('0x32')]['count'](_0x416730)[_0xe724('0x2b')](function(_0x5d47c6){_0x269812[_0xe724('0x27')]=_0x5d47c6;if(_0x213062[_0xe724('0x39')][_0xe724('0x45')]){_0x124bf3[_0xe724('0x46')]=[{'all':!![]}];}return db[_0xe724('0x32')][_0xe724('0x47')](_0x124bf3);})[_0xe724('0x2b')](function(_0x2dda8b){_0x269812[_0xe724('0x48')]=_0x2dda8b;return _0x269812;})['then'](respondWithFilteredResult(_0x4ff1be,_0x124bf3))[_0xe724('0x49')](handleError(_0x4ff1be,null));};exports[_0xe724('0x4a')]=function(_0x7f181d,_0x1311e6){var _0x132425={'raw':![],'where':{'id':_0x7f181d['params']['id']}},_0x5dec36={};_0x5dec36[_0xe724('0x37')]=_[_0xe724('0x4b')](db[_0xe724('0x32')]['rawAttributes']);_0x5dec36[_0xe724('0x39')]=_['keys'](_0x7f181d[_0xe724('0x39')]);_0x5dec36[_0xe724('0x4c')]=_[_0xe724('0x3a')](_0x5dec36[_0xe724('0x37')],_0x5dec36[_0xe724('0x39')]);_0x132425['attributes']=_[_0xe724('0x3a')](_0x5dec36['model'],qs[_0xe724('0x3c')](_0x7f181d[_0xe724('0x39')]['fields']));_0x132425[_0xe724('0x3b')]=_0x132425[_0xe724('0x3b')][_0xe724('0x3d')]?_0x132425['attributes']:_0x5dec36[_0xe724('0x37')];if(_0x7f181d[_0xe724('0x39')][_0xe724('0x45')]){_0x132425[_0xe724('0x46')]=[{'all':!![]}];}_0x132425=_[_0xe724('0x43')]({},_0x132425,_0x7f181d[_0xe724('0x44')]);return db[_0xe724('0x32')][_0xe724('0x4d')](_0x132425)[_0xe724('0x2b')](handleEntityNotFound(_0x1311e6,null))[_0xe724('0x2b')](respondWithResult(_0x1311e6,null))[_0xe724('0x49')](handleError(_0x1311e6,null));};exports['create']=function(_0xa63ffd,_0x1555f5){return db[_0xe724('0x32')][_0xe724('0x4e')](_0xa63ffd[_0xe724('0x4f')],{})['then'](respondWithResult(_0x1555f5,0xc9))[_0xe724('0x49')](handleError(_0x1555f5,null));};exports[_0xe724('0x50')]=function(_0x2d198d,_0xef10c8){var _0x41293d={'where':{'id':_0x2d198d[_0xe724('0x51')]['id']}},_0x1a138f={};_0x1a138f['model']=_[_0xe724('0x4b')](db[_0xe724('0x32')][_0xe724('0x33')]);_0x41293d['attributes']=_[_0xe724('0x3a')](_0x1a138f[_0xe724('0x37')],qs['fields'](_0x2d198d['query'][_0xe724('0x3c')]));_0x41293d[_0xe724('0x3b')]=_0x41293d[_0xe724('0x3b')][_0xe724('0x3d')]?_0x41293d[_0xe724('0x3b')]:_0x1a138f['model'];if(_0x2d198d[_0xe724('0x39')][_0xe724('0x45')]){_0x41293d['include']=[{'all':!![]}];}_0x41293d=_['merge']({},_0x41293d,_0x2d198d[_0xe724('0x44')]);return db[_0xe724('0x32')]['find'](_0x41293d)[_0xe724('0x2b')](handleEntityNotFound(_0xef10c8,null))[_0xe724('0x2b')](function(_0x264069){if(_0x264069){var _0x2a833e=_0x264069[_0xe724('0x52')]({'plain':!![]});_0x2a833e=qs[_0xe724('0x53')](_0x2a833e,['id',_0xe724('0x54'),_0xe724('0x55'),_0xe724('0x56')]);_0x2d198d[_0xe724('0x4f')]=_['omit'](_0x2d198d[_0xe724('0x4f')],['id','createdAt',_0xe724('0x55')]);return db[_0xe724('0x57')][_0xe724('0x58')](function(_0x288921){return db['UserProfile'][_0xe724('0x4e')](_['merge'](_0x2a833e,_0x2d198d[_0xe724('0x4f')]),{'include':_0x2d198d['query'][_0xe724('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x288921})[_0xe724('0x2b')](function(_0x3d6c83){var _0x4da3c0=_0x3d6c83[_0xe724('0x52')]({'plain':!![]});return db[_0xe724('0x59')][_0xe724('0x47')]({'where':{'userProfileId':_0x2d198d[_0xe724('0x51')]['id']},'raw':!![]})['then'](function(_0x4cbce2){if(_0x4cbce2){return BPromise['each'](_0x4cbce2,function(_0x18dc14){return new BPromise(function(_0x4257b9,_0x347a81){if(_0x18dc14[_0xe724('0x5a')]===null||_0x18dc14[_0xe724('0x5a')]===0x1)_0x4257b9(null);return db['UserProfileResource'][_0xe724('0x47')]({'where':{'sectionId':_0x18dc14['id']},'raw':!![]})[_0xe724('0x2b')](function(_0x4a9256){var _0x3b4a0e=_['map'](_0x4a9256,function(_0x20afd2){return qs[_0xe724('0x53')](_0x20afd2,['id','createdAt',_0xe724('0x55'),_0xe724('0x5b')]);});_0x4257b9(_0x3b4a0e);})['catch'](function(_0x31c678){_0x347a81(_0x31c678);});})[_0xe724('0x2b')](function(_0x177e73){var _0x11f73a=qs[_0xe724('0x53')](_0x18dc14,['id',_0xe724('0x54'),_0xe724('0x55')]);_0x11f73a[_0xe724('0x5c')]=_0x4da3c0['id'];if(_0x177e73)_0x11f73a[_0xe724('0x5d')]=_0x177e73;return _0x11f73a;})[_0xe724('0x2b')](function(_0x450eca){return db[_0xe724('0x59')]['create'](_0x450eca,{'include':[{'model':db[_0xe724('0x5e')],'as':_0xe724('0x5d')}],'raw':!![],'transaction':_0x288921});});})[_0xe724('0x2b')](function(){return _0x4da3c0;});}});});});}})['then'](respondWithResult(_0xef10c8,0xc9))['catch'](handleError(_0xef10c8,null));};exports[_0xe724('0x2a')]=function(_0x19fa6b,_0x2174c4){if(_0x19fa6b['body']['id']){delete _0x19fa6b['body']['id'];}return db[_0xe724('0x32')][_0xe724('0x4d')]({'where':{'id':_0x19fa6b[_0xe724('0x51')]['id']}})[_0xe724('0x2b')](handleEntityNotFound(_0x2174c4,null))[_0xe724('0x2b')](saveUpdates(_0x19fa6b[_0xe724('0x4f')],null))[_0xe724('0x2b')](respondWithResult(_0x2174c4,null))[_0xe724('0x49')](handleError(_0x2174c4,null));};exports['destroy']=function(_0x142645,_0x36ad34){return db['UserProfile'][_0xe724('0x4d')]({'where':{'id':_0x142645[_0xe724('0x51')]['id']}})[_0xe724('0x2b')](handleEntityNotFound(_0x36ad34,null))['then'](removeEntity(_0x36ad34,null))[_0xe724('0x49')](handleError(_0x36ad34,null));};exports[_0xe724('0x5f')]=function(_0x3129bd,_0x35bdad){return db['UserProfile'][_0xe724('0x5f')]()[_0xe724('0x2b')](respondWithResult(_0x35bdad,null))['catch'](handleError(_0x35bdad,null));};exports[_0xe724('0x60')]=function(_0x1a15cb,_0x2976e3){var _0x46792b=_0x1a15cb['body'];return db[_0xe724('0x32')][_0xe724('0x4d')]({'where':{'id':_0x1a15cb[_0xe724('0x51')]['id']}})[_0xe724('0x2b')](handleEntityNotFound(_0x2976e3,null))[_0xe724('0x2b')](function(_0xac96d5){if(_0xac96d5){return db[_0xe724('0x57')][_0xe724('0x58')](function(_0x28d0e6){return db[_0xe724('0x59')]['destroy']({'where':{'userProfileId':_0x1a15cb['params']['id'],'sectionId':_['map'](_0x46792b,function(_0x1ee5d2){return _0x1ee5d2[_0xe724('0x5b')];})},'transaction':_0x28d0e6})[_0xe724('0x2b')](function(){var _0x267fc3=_[_0xe724('0x31')](_0x46792b,function(_0x506a2b){_0x506a2b[_0xe724('0x5c')]=_0x1a15cb[_0xe724('0x51')]['id'];return _0x506a2b;});var _0x590d9c=[];return BPromise[_0xe724('0x61')](_0x267fc3,function(_0x4b0be8){return db['UserProfileSection'][_0xe724('0x4e')](_0x4b0be8,{'include':[{'model':db[_0xe724('0x5e')],'as':'Resources'}],'raw':!![],'transaction':_0x28d0e6})[_0xe724('0x2b')](function(_0x5047ac){_0x590d9c['push'](_0x5047ac[_0xe724('0x52')]({'plain':!![]}));});})[_0xe724('0x2b')](function(){return _0x590d9c;});});});}})[_0xe724('0x2b')](function(_0x360d9f){return _0x360d9f;})[_0xe724('0x2b')](respondWithResult(_0x2976e3,null))[_0xe724('0x49')](handleError(_0x2976e3,null));};exports[_0xe724('0x62')]=function(_0x538c89,_0x52364a){var _0x53bc41;return db[_0xe724('0x32')][_0xe724('0x4d')]({'where':{'id':_0x538c89[_0xe724('0x51')]['id']},'attributes':['id',_0xe724('0x38')]})[_0xe724('0x2b')](handleEntityNotFound(_0x52364a,null))[_0xe724('0x2b')](function(_0x1d8dfd){if(_0x1d8dfd){_0x53bc41=_0x1d8dfd;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x538c89[_0xe724('0x51')]['id'],'sectionId':_0x538c89[_0xe724('0x39')][_0xe724('0x63')]}});}})[_0xe724('0x2b')](function(){return _0x53bc41;})[_0xe724('0x2b')](respondWithStatusCode(_0x52364a,null))[_0xe724('0x49')](handleError(_0x52364a,null));};exports[_0xe724('0x64')]=function(_0x3fd24f,_0x20037f){var _0x209be3=[];var _0xe47e75=[];return db[_0xe724('0x59')]['findAll']({'where':{'userProfileId':_0x3fd24f['params']['id']},'raw':!![]})[_0xe724('0x2b')](function(_0x38bb10){_0x209be3=_[_0xe724('0x42')](_0x38bb10,function(_0x5ba0ae){return _0x5ba0ae[_0xe724('0x65')]===0x1||_[_0xe724('0x66')]([0x3eb,0x709],_0x5ba0ae['sectionId']);});if(!_['isEmpty'](_0x209be3)){return _[_0xe724('0x31')](_0x209be3,function(_0x2b688d){return _0x2b688d[_0xe724('0x5b')];});}else{return;}})['then'](function(_0xc4c6b8){if(_0xc4c6b8)_0xe47e75=_0xc4c6b8;if(_[_0xe724('0x66')](_0xe47e75,0x64)){var _0x2840bd=_[_0xe724('0x4d')](_0x209be3,{'sectionId':0x64});return hasDefaultDashboard(_0x2840bd)[_0xe724('0x2b')](function(_0x59b466){return _[_0xe724('0x31')](_0x209be3,function(_0x49748f){if(_0x49748f[_0xe724('0x5b')]===0x64){_0x49748f[_0xe724('0x67')]=_0x59b466;}return _0x49748f;});});}else{return;}})['then'](function(_0x2c45ce){if(_0x2c45ce)_0x209be3=_0x2c45ce;if(_[_0xe724('0x66')](_0xe47e75,0x3eb)){var _0x5aede4=_[_0xe724('0x4d')](_0x209be3,{'sectionId':0x3eb});return getCustomDashboards(_0x5aede4)['then'](function(_0x12ac6c){return _[_0xe724('0x31')](_0x209be3,function(_0x3bfadd){if(_0x5aede4['enabled']){if(_0x3bfadd[_0xe724('0x5b')]===0x3eb){_0x3bfadd['subsections']=_0x12ac6c;}}else{if(_0x3bfadd[_0xe724('0x5b')]===0x64){if(!_0x3bfadd[_0xe724('0x67')]){_0x3bfadd['subsections']=[];}_0x3bfadd[_0xe724('0x67')]=_0x3bfadd['subsections']['concat'](_0x12ac6c);}}return _0x3bfadd;});});}else{return;}})['then'](function(_0xfd2e45){if(_0xfd2e45)_0x209be3=_0xfd2e45;if(_[_0xe724('0x66')](_0xe47e75,0x709)){var _0x1a107a=_[_0xe724('0x4d')](_0x209be3,{'sectionId':0x709});return getPlugins(_0x1a107a)[_0xe724('0x2b')](function(_0x39d93d){if(_0x1a107a[_0xe724('0x65')]){return _[_0xe724('0x31')](_0x209be3,function(_0x24c965){if(_0x24c965[_0xe724('0x5b')]===0x709){_0x24c965[_0xe724('0x67')]=_0x39d93d;}return _0x24c965;});}else{var _0x1ef3f6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x39d93d};var _0x266688=_[_0xe724('0x31')](_0x209be3);_0x266688[_0xe724('0x68')](_0x1ef3f6);return _0x266688;}});}else{return;}})[_0xe724('0x2b')](function(_0x3c0456){if(_0x3c0456)_0x209be3=_0x3c0456;return _['filter'](_0x209be3,[_0xe724('0x65'),0x1]);})[_0xe724('0x2b')](respondWithResult(_0x20037f,null))[_0xe724('0x49')](handleError(_0x20037f,null));};function hasDefaultDashboard(_0x1ba593){var _0x2da8f2=[0x65];return new BPromise(function(_0x7a0755,_0x476fc5){try{if(_0x1ba593['autoAssociation']){_0x7a0755(_0x2da8f2);}else{return db[_0xe724('0x5e')][_0xe724('0x69')]({'where':{'sectionId':_0x1ba593['id']},'raw':!![]})['then'](function(_0x2ddc79){_0x2ddc79?_0x7a0755(_0x2da8f2):_0x7a0755();});}}catch(_0x25508a){_0x476fc5(_0x25508a);}});}function getCustomDashboards(_0x4d745f){var _0x112057=[];return new BPromise(function(_0x2f10b8,_0x5f2c39){try{if(_0x4d745f[_0xe724('0x5a')]){return db[_0xe724('0x6a')][_0xe724('0x47')]({'raw':!![]})[_0xe724('0x2b')](function(_0x45b461){_0x45b461[_0xe724('0x6b')](function(_0x53d4cd){_0x112057[_0xe724('0x68')](_0x53d4cd['id']+0x1869f);});_0x2f10b8(_0x112057);});}else{return db[_0xe724('0x5e')][_0xe724('0x47')]({'where':{'sectionId':_0x4d745f['id']},'raw':!![]})[_0xe724('0x2b')](function(_0x246487){_0x246487[_0xe724('0x6b')](function(_0x1b7068){_0x112057['push'](_0x1b7068[_0xe724('0x6c')]+0x1869f);});_0x2f10b8(_0x112057);});}}catch(_0x17aedb){_0x5f2c39(_0x17aedb);}});}function getPlugins(_0x8a4583){var _0x39969d=[];return new BPromise(function(_0x368bdd,_0x3a2a4c){try{if(_0x8a4583['autoAssociation']){return db[_0xe724('0x6d')]['findAll']({'raw':!![]})[_0xe724('0x2b')](function(_0x1c8651){_0x1c8651[_0xe724('0x6b')](function(_0x42b85b){_0x39969d['push'](_0x42b85b['id']+0x15b38);});_0x368bdd(_0x39969d);});}else{return db[_0xe724('0x5e')][_0xe724('0x47')]({'where':{'sectionId':_0x8a4583['id']},'raw':!![]})[_0xe724('0x2b')](function(_0x15d243){_0x15d243[_0xe724('0x6b')](function(_0x4c359a){_0x39969d['push'](_0x4c359a[_0xe724('0x6c')]+0x15b38);});_0x368bdd(_0x39969d);});}}catch(_0x4a67cf){_0x3a2a4c(_0x4a67cf);}});}exports[_0xe724('0x6e')]=function(_0x21c5e9,_0x13ff1b){return db[_0xe724('0x32')][_0xe724('0x4d')]({'where':{'id':_0x21c5e9[_0xe724('0x51')]['id']}})[_0xe724('0x2b')](handleEntityNotFound(_0x13ff1b,null))[_0xe724('0x2b')](function(_0x3cfa61){if(_0x3cfa61){return db[_0xe724('0x57')]['transaction'](function(_0x545e15){return db[_0xe724('0x59')][_0xe724('0x47')]({'where':{'userProfileId':_0x21c5e9[_0xe724('0x51')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x3e69b7){if(_0x3e69b7){return db[_0xe724('0x59')][_0xe724('0x2c')]({'where':{'userProfileId':_0x21c5e9[_0xe724('0x51')]['id'],'id':_[_0xe724('0x31')](_0x3e69b7,function(_0x272414){return _0x272414['id'];})},'transaction':_0x545e15});}})[_0xe724('0x2b')](function(_0x124f4c){var _0x180a33=_[_0xe724('0x31')](_0x21c5e9[_0xe724('0x4f')],function(_0x17669b){_0x17669b[_0xe724('0x5c')]=_0x21c5e9['params']['id'];return _0x17669b;});return db['UserProfileSection'][_0xe724('0x6f')](_0x180a33,{'raw':!![],'transaction':_0x545e15});})[_0xe724('0x2b')](function(_0x141821){var _0x512c73=_['filter'](_['map'](_0x141821,function(_0x34ae63){return _0x34ae63['get']({'plain':!![]});}),{'includeAll':![]});if(_0x512c73){return db[_0xe724('0x59')][_0xe724('0x47')]({'where':{'userProfileId':_0x21c5e9[_0xe724('0x51')]['id'],'sectionId':_['map'](_0x512c73,function(_0x12d3c6){return _0x12d3c6[_0xe724('0x5b')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0xa99bed){var _0x6993f2=_['map'](_0x21c5e9[_0xe724('0x4f')],function(_0x4ed12b){_0x4ed12b[_0xe724('0x5c')]=_0x21c5e9[_0xe724('0x51')]['id'];return _0x4ed12b;});return db[_0xe724('0x5e')]['bulkCreate'](_0x6993f2,{'raw':!![],'transaction':_0x545e15});});}})['catch'](handleError(_0x13ff1b,null));});}})[_0xe724('0x2b')](function(_0x4538a1){var _0x222027=_[_0xe724('0x31')](_0x4538a1,function(_0xb783f5){return _0xb783f5[_0xe724('0x52')]({'plain':!![]});});})[_0xe724('0x2b')](respondWithResult(_0x13ff1b,null))['catch'](handleError(_0x13ff1b,null));};exports['removeResources']=function(_0x44a56b,_0x2044d6,_0x13c08a){return db[_0xe724('0x32')][_0xe724('0x4d')]({'where':{'id':_0x44a56b[_0xe724('0x51')]['id']}})[_0xe724('0x2b')](handleEntityNotFound(_0x2044d6,null))['then'](function(_0x50dbb5){if(_0x50dbb5){return _0x50dbb5[_0xe724('0x70')](_0x44a56b['query'][_0xe724('0x63')]);}})[_0xe724('0x2b')](respondWithStatusCode(_0x2044d6,null))[_0xe724('0x49')](handleError(_0x2044d6,null));};exports[_0xe724('0x71')]=function(_0x374a63,_0x2f4a3b){var _0x5cda3b={};if(!_0x374a63[_0xe724('0x39')]['section'])throw new Error(_0xe724('0x72'));if(!_0x374a63[_0xe724('0x39')][_0xe724('0x3e')](_0xe724('0x73'))){_0x5cda3b[_0xe724('0x24')]=qs[_0xe724('0x24')](_0x374a63[_0xe724('0x39')][_0xe724('0x24')]);_0x5cda3b[_0xe724('0x26')]=qs[_0xe724('0x26')](_0x374a63['query'][_0xe724('0x26')]);}return db['UserProfile']['find']({'where':{'id':_0x374a63['params']['id']}})[_0xe724('0x2b')](function(_0x33faed){if(!_0x33faed)throw new Error(_0xe724('0x74')+_0x374a63[_0xe724('0x51')]['id']);return db[_0xe724('0x32')][_0xe724('0x71')](_0x374a63);})['then'](respondWithFilteredResult(_0x2f4a3b,_0x5cda3b))['catch'](handleError(_0x2f4a3b,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 03c11fd..a709113 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 _0x0650=['events','../../mysqldb','UserProfile','setMaxListeners','update','hasOwnProperty'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x0650,0x1aa));var _0x0065=function(_0x203536,_0x2189a1){_0x203536=_0x203536-0x0;var _0x897e83=_0x0650[_0x203536];return _0x897e83;};'use strict';var EventEmitter=require(_0x0065('0x0'));var UserProfile=require(_0x0065('0x1'))['db'][_0x0065('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0065('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0065('0x4'),'afterDestroy':'remove'};function emitEvent(_0x49a595){return function(_0x1798d6,_0xe2785,_0x185c29){UserProfileEvents['emit'](_0x49a595+':'+_0x1798d6['id'],_0x1798d6);UserProfileEvents['emit'](_0x49a595,_0x1798d6);_0x185c29(null);};}for(var e in events){if(events[_0x0065('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xfdcd=['UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x9a5d83,_0x49bad7){var _0x1a7b42=function(_0x983a12){while(--_0x983a12){_0x9a5d83['push'](_0x9a5d83['shift']());}};_0x1a7b42(++_0x49bad7);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xdfdc('0x0'))['db'][_0xdfdc('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xdfdc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdfdc('0x3'),'afterDestroy':_0xdfdc('0x4')};function emitEvent(_0x274740){return function(_0x789311,_0x453c75,_0x349d57){UserProfileEvents[_0xdfdc('0x5')](_0x274740+':'+_0x789311['id'],_0x789311);UserProfileEvents[_0xdfdc('0x5')](_0x274740,_0x789311);_0x349d57(null);};}for(var e in events){if(events[_0xdfdc('0x6')](e)){var event=events[e];UserProfile[_0xdfdc('0x7')](e,emitEvent(event));}}module[_0xdfdc('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 0550af3..a3fc97b 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 _0x1a87=['Schedule','sounds','Tag','templates','Template','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','define','UserProfile','../../components/parsers/qs','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','then','ignore','union','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','foreignKey','options','autoAssociation','includeAll','forEach','reportType','default','DefaultReports','custom','reportId','CustomReports','count','rows','ids','customSorting','extraQueryConditions','include','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','squel','exports','filter','field','value','map','catch','findAll','associatedResources','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareOdbc','squarerecordings','parentSections','SquareProjects','name','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','Telephones','membername','role','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','Team','queuecampaigns','users','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler'];(function(_0x2a6ec2,_0x2262e4){var _0x2b3fab=function(_0x317a90){while(--_0x317a90){_0x2a6ec2['push'](_0x2a6ec2['shift']());}};_0x2b3fab(++_0x2262e4);}(_0x1a87,0x125));var _0x71a8=function(_0x4921a3,_0x2fdbfb){_0x4921a3=_0x4921a3-0x0;var _0x19a0a4=_0x1a87[_0x4921a3];return _0x19a0a4;};'use strict';var _=require(_0x71a8('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0x71a8('0x1'));module[_0x71a8('0x2')]=function(_0x26c3ee){var _0x114d7e=_0x26c3ee['models'];function _0x3e37a8(_0x124889,_0x461ba0){return new Promise(function(_0x4266e8,_0x212b8e){if(!_0x461ba0)return _0x4266e8(null);var _0x409e06=_0x461ba0['filter']?{[_0x461ba0[_0x71a8('0x3')][_0x71a8('0x4')]]:_0x461ba0[_0x71a8('0x3')][_0x71a8('0x5')]}:undefined;return _0x114d7e[_0x124889]['findAll']({'where':_0x409e06,'raw':!![]})['then'](function(_0x32007a){_0x461ba0['associatedResources']=_[_0x71a8('0x6')](_0x32007a,'id');_0x4266e8(_0x461ba0);})[_0x71a8('0x7')](function(_0x2e092f){_0x212b8e(_0x2e092f);});});}function _0x501fe9(_0x27db68,_0x176544){return new Promise(function(_0x4be6f6,_0x42dfca){var _0x588a54=_0x27db68[_0x71a8('0x3')]?{[_0x27db68[_0x71a8('0x3')][_0x71a8('0x4')]]:_0x27db68[_0x71a8('0x3')][_0x71a8('0x5')]}:undefined;return _0x114d7e[_0x27db68['model']][_0x71a8('0x8')]({'where':_0x588a54,'raw':!![]})['then'](function(_0x1dbe97){_0x176544[_0x71a8('0x9')]=_[_0x71a8('0x6')](_0x1dbe97,function(_0x22b485){return _0x22b485['name'];});_0x4be6f6(_0x176544);})[_0x71a8('0x7')](function(_0x4e4d0d){_0x42dfca(_0x4e4d0d);});});}function _0x4dccd9(_0x5cee00,_0x15fe4b,_0x3fa7f8){if(!_0x15fe4b)return Promise[_0x71a8('0xa')](null);return new Promise(function(_0x5a7a7c,_0x356c9c){return _0x114d7e[_0x71a8('0xb')][_0x71a8('0x8')]({'where':{'sectionId':_0x15fe4b['id']},'raw':!![]})['then'](function(_0x506265){if(_0x5cee00[_0x71a8('0x4')]&&_0x5cee00[_0x71a8('0x4')]!=='id'){_0x15fe4b[_0x71a8('0x9')]=_[_0x71a8('0x6')](_0x506265,function(_0x40a811){return _0x40a811[_0x5cee00[_0x71a8('0x4')]];});}else{if(_0x3fa7f8===_0x71a8('0xc')){_0x15fe4b[_0x71a8('0x9')]=_[_0x71a8('0x6')](_0x506265,function(_0x58fca3){return{'id':_0x58fca3[_0x71a8('0xd')],'type':_0x58fca3[_0x71a8('0xe')]};});}else{_0x15fe4b[_0x71a8('0x9')]=_[_0x71a8('0x6')](_0x506265,function(_0x4c3b8c){return _0x4c3b8c[_0x71a8('0xd')];});}}_0x5a7a7c(_0x15fe4b);})[_0x71a8('0x7')](function(_0x426132){_0x356c9c(_0x426132);});});}function _0x4a8021(_0x4a2222,_0x652d6c){var _0x36f8dc={'parentSections':[]};switch(_0x4a2222[_0x71a8('0xf')]()){case _0x71a8('0x10'):_0x36f8dc['childModel']='SquareProject';break;case'odbc':_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x12');break;case _0x71a8('0x13'):_0x36f8dc[_0x71a8('0x11')]='SquareRecording';_0x36f8dc[_0x71a8('0x14')]=[{'name':_0x71a8('0x15'),'field':_0x71a8('0x16'),'foreignKey':'projectName'}];break;case _0x71a8('0x17'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x18');break;case _0x71a8('0x19'):_0x36f8dc['childModel']=_0x71a8('0x1a');_0x36f8dc[_0x71a8('0x14')]=[{'name':_0x71a8('0x1b'),'field':'id','foreignKey':_0x71a8('0x1c')}];break;case _0x71a8('0x1d'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x1e');break;case _0x71a8('0x1f'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x20');break;case _0x71a8('0x21'):_0x36f8dc[_0x71a8('0x11')]='CmCustomField';break;case _0x71a8('0x22'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x23');break;case _0x71a8('0x24'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x25');break;case _0x71a8('0x26'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x27');break;case'faxaccounts':_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x28');break;case _0x71a8('0x29'):case _0x71a8('0x2a'):case _0x71a8('0x2b'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x2c');break;case _0x71a8('0x2d'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x2e');break;case _0x71a8('0x2f'):_0x36f8dc['childModel']=_0x71a8('0x30');break;case _0x71a8('0x31'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x32');_0x36f8dc[_0x71a8('0x14')]=[{'name':_0x71a8('0x33'),'field':_0x71a8('0x16'),'foreignKey':'membername','model':_0x71a8('0x34'),'filter':{'field':'role','value':['agent']}},{'name':_0x71a8('0x35'),'field':_0x71a8('0x16'),'foreignKey':_0x71a8('0x36'),'model':_0x71a8('0x34'),'filter':{'field':_0x71a8('0x37'),'value':['telephone']}},{'name':_0x71a8('0x38'),'field':'name','foreignKey':_0x71a8('0x39'),'model':'VoiceQueue','filter':{'field':_0x71a8('0xe'),'value':[_0x71a8('0x3a')]}},{'name':_0x71a8('0x3b'),'field':_0x71a8('0x16'),'foreignKey':'queue','model':_0x71a8('0x3c'),'filter':{'field':'type','value':[_0x71a8('0x3d')]}}];break;case'musiconholds':_0x36f8dc[_0x71a8('0x11')]='VoiceMusicOnHold';break;case _0x71a8('0x3e'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x3f');break;case _0x71a8('0x40'):_0x36f8dc['childModel']=_0x71a8('0x41');break;case _0x71a8('0x42'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x43');break;case _0x71a8('0x44'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x45');break;case _0x71a8('0x46'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x47');break;case _0x71a8('0x48'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x49');break;case _0x71a8('0x4a'):_0x36f8dc['childModel']='OpenchannelQueue';break;case _0x71a8('0x4b'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x4c');break;case _0x71a8('0x4d'):_0x36f8dc['childModel']=_0x71a8('0x4e');break;case _0x71a8('0x4f'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x50');break;case _0x71a8('0x51'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x52');break;case'whatsappaccounts':_0x36f8dc['childModel']='WhatsappAccount';break;case'teams':_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x53');break;case'voicequeues':case _0x71a8('0x54'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x3c');if(_0x652d6c){_0x36f8dc[_0x71a8('0x14')]=[{'name':_0x71a8('0x38')},{'name':_0x71a8('0x3b')}];}break;case _0x71a8('0x55'):case'agents':case _0x71a8('0x56'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x34');if(_0x652d6c){_0x36f8dc[_0x71a8('0x14')]=[{'name':_0x71a8('0x57'),'filter':{'field':_0x71a8('0x37'),'value':[_0x71a8('0x58'),_0x71a8('0x59')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x71a8('0x5a'):_0x36f8dc['childModel']='ZendeskAccount';break;case _0x71a8('0x5b'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x5c');break;case'freshdeskaccounts':_0x36f8dc[_0x71a8('0x11')]='FreshdeskAccount';break;case _0x71a8('0x5d'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x5e');break;case'deskaccounts':_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x5f');break;case _0x71a8('0x60'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x61');break;case _0x71a8('0x62'):_0x36f8dc['childModel']=_0x71a8('0x34');break;case _0x71a8('0x63'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x64');break;case _0x71a8('0x65'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x66');break;case _0x71a8('0x67'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x68');break;case _0x71a8('0x69'):_0x36f8dc[_0x71a8('0x11')]='Interval';break;case _0x71a8('0x6a'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x6b');break;case _0x71a8('0x6c'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x6d');break;case _0x71a8('0x6e'):_0x36f8dc[_0x71a8('0x11')]='Sound';break;case'tags':_0x36f8dc['childModel']=_0x71a8('0x6f');break;case _0x71a8('0x70'):_0x36f8dc['childModel']=_0x71a8('0x71');break;case _0x71a8('0x72'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x73');break;case _0x71a8('0x74'):_0x36f8dc['childModel']='Trunk';break;case _0x71a8('0x75'):_0x36f8dc['childModel']=_0x71a8('0x76');break;case _0x71a8('0x77'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0x78');break;case _0x71a8('0x79'):_0x36f8dc[_0x71a8('0x11')]=_0x71a8('0xc');_0x36f8dc[_0x71a8('0x14')]=[{'name':_0x71a8('0x7a'),'field':'id','foreignKey':'reportId'}];break;case _0x71a8('0x7b'):_0x36f8dc[_0x71a8('0x11')]='AnalyticMetric';break;}return _0x36f8dc;}function _0x196f23(_0x41d0f0,_0x2269e5){var _0xdb38e9=_0x41d0f0[_0x71a8('0x7c')](0x0)[_0x71a8('0x7d')]()+_0x41d0f0[_0x71a8('0x7e')](0x1);var _0x8abe92={'type':_0x114d7e['Sequelize'][_0x71a8('0x7f')][_0x71a8('0x80')],'raw':!![]};return new Promise(function(_0x8769bf,_0x4d18df){var _0x1e3c9c=squel[_0x71a8('0x81')]()[_0x71a8('0x4')](_0x71a8('0x82')+_0xdb38e9+'InteractionId','id')['field'](_0x71a8('0x83'))['from'](_0x71a8('0x84')+_0x41d0f0+_0x71a8('0x85'),'ui')[_0x71a8('0x86')](_0x71a8('0x87'),_0x2269e5['id']);return _0x114d7e[_0x71a8('0x88')][_0x71a8('0x89')](_0x1e3c9c['toString'](),_0x8abe92)['then'](function(_0x2a8107){_0x2269e5[_0xdb38e9+_0x71a8('0x8a')]=_0x2a8107;_0x8769bf(_0x2a8107);})['catch'](function(_0x3ad66c){_0x4d18df(_0x3ad66c);});});}return _0x26c3ee[_0x71a8('0x8b')](_0x71a8('0x8c'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x16c155){var _0x85b7c0=require(_0x71a8('0x8d'));var _0x4c662e={'raw':_0x16c155[_0x71a8('0x89')][_0x71a8('0x8e')],'where':{}};var _0x2da2f8={};var _0x2a7835={'count':0x0,'rows':[]};var _0x429c0e=_0x16c155[_0x71a8('0x89')][_0x71a8('0x8f')];var _0x261101=_0x16c155['query']['mergeResources']||![];var _0x9022c5=_0x4a8021(_0x429c0e,_0x261101);if(!_0x9022c5['childModel'])throw new Error(_0x71a8('0x90')+_0x429c0e+'\x27');var _0x22d3a7=[{'name':_0x429c0e}];if(!_[_0x71a8('0x91')](_0x9022c5[_0x71a8('0x14')]))_0x22d3a7=_0x9022c5[_0x71a8('0x14')];var _0x284814=[];for(var _0x319d86=0x0;_0x319d86<_0x22d3a7[_0x71a8('0x92')];_0x319d86++){_0x284814[_0x71a8('0x93')](_0x114d7e[_0x71a8('0x94')][_0x71a8('0x95')]({'where':{'userProfileId':_0x16c155[_0x71a8('0x96')]['id'],'name':_0x22d3a7[_0x319d86][_0x71a8('0x16')]},'raw':!![]}));}return Promise[_0x71a8('0x97')](_0x284814)[_0x71a8('0x98')](function(_0x20744b){var _0xfe0d3=_[_0x71a8('0x3')](_0x20744b,function(_0x105fe4){return _0x105fe4?_0x105fe4:undefined;});var _0x36f2f2=_[_0x71a8('0x3')](_0x22d3a7,[_0x71a8('0x99'),!![]]);var _0x1adbf6=_[_0x71a8('0x91')](_0xfe0d3)&&_[_0x71a8('0x91')](_0x36f2f2)?null:_[_0x71a8('0x9a')](_0x36f2f2,_0xfe0d3);if(!_0x1adbf6)return null;var _0x534975=[];for(var _0x49b629=0x0;_0x49b629<_0x1adbf6['length'];_0x49b629++){var _0x22826b=_['find'](_0x22d3a7,function(_0x110f52){return _0x1adbf6[_0x49b629]?_0x110f52['name']===_0x1adbf6[_0x49b629][_0x71a8('0x16')]:null;});if(_0x22826b){if(_0x1adbf6[_0x49b629][_0x71a8('0x99')]){_0x534975[_0x71a8('0x93')](_0x3e37a8(_0x9022c5[_0x71a8('0x11')],_0x1adbf6[_0x49b629]));}else{if(!_0x1adbf6[_0x49b629]['autoAssociation']){_0x534975['push'](_0x4dccd9(_0x22826b,_0x1adbf6[_0x49b629],_0x9022c5[_0x71a8('0x11')]));}else{if(_0x22826b[_0x71a8('0x9b')]){_0x534975['push'](_0x501fe9(_0x22826b,_0x1adbf6[_0x49b629]));}}}}}return Promise[_0x71a8('0x97')](_0x534975);})[_0x71a8('0x98')](function(_0x104f73){var _0x426ed5=_0x104f73;var _0x4d7406=null;if(_0x426ed5){_0x4d7406=_0x426ed5[_0x71a8('0x92')]===0x1?_0x426ed5[0x0]:null;}if(!_0x4d7406&&!_0x426ed5)return _0x2a7835;var _0x2be60c=_0x114d7e[_0x9022c5[_0x71a8('0x11')]][_0x71a8('0x9c')];_0x2da2f8[_0x71a8('0x9b')]=_[_0x71a8('0x9d')](_0x2be60c);_0x2da2f8['query']=_[_0x71a8('0x9d')](_0x16c155[_0x71a8('0x89')]);_0x2da2f8[_0x71a8('0x9e')]=_[_0x71a8('0x9f')](_0x2da2f8[_0x71a8('0x9b')],_0x2da2f8[_0x71a8('0x89')]);_0x4c662e[_0x71a8('0xa0')]=_[_0x71a8('0x9f')](_0x2da2f8[_0x71a8('0x9b')],_0x85b7c0['fields'](_0x16c155['query'][_0x71a8('0xa1')]));_0x4c662e['attributes']=_0x4c662e['attributes'][_0x71a8('0x92')]?_0x4c662e[_0x71a8('0xa0')]:_0x2da2f8[_0x71a8('0x9b')];if(!_0x16c155['query'][_0x71a8('0xa2')](_0x71a8('0xa3'))){_0x4c662e[_0x71a8('0xa4')]=_0x85b7c0[_0x71a8('0xa4')](_0x16c155[_0x71a8('0x89')][_0x71a8('0xa4')]);_0x4c662e[_0x71a8('0xa5')]=_0x85b7c0[_0x71a8('0xa5')](_0x16c155[_0x71a8('0x89')][_0x71a8('0xa5')]);}_0x4c662e[_0x71a8('0xa6')]=_0x85b7c0[_0x71a8('0xa7')](_0x16c155['query']['sort']);_0x4c662e['where']=_0x85b7c0['filters'](_[_0x71a8('0xa8')](_0x16c155[_0x71a8('0x89')],_0x2da2f8[_0x71a8('0x9e')]));if(_0x16c155[_0x71a8('0x89')][_0x71a8('0x3')]){_0x4c662e[_0x71a8('0x86')]=_[_0x71a8('0xa9')](_0x4c662e[_0x71a8('0x86')],{'$or':_[_0x71a8('0x6')](_0x2be60c,function(_0x1eba69){if(_0x1eba69[_0x71a8('0xe')][_0x71a8('0xaa')]!=='VIRTUAL'){var _0x4c8d28={};_0x4c8d28[_0x1eba69[_0x71a8('0x4')]]={'$like':'%'+_0x16c155['query']['filter']+'%'};return _0x4c8d28;}})});}var _0x3f75c6=[];var _0x5e5f42=null;var _0x3aaec1={};if(_0x4d7406){_0x5e5f42=_['find'](_0x22d3a7,['name',_0x4d7406[_0x71a8('0x16')]]);if(_0x5e5f42['field']){_0x3aaec1={};if(_0x9022c5['childModel']===_0x71a8('0xc')){_0x3aaec1[_0x5e5f42[_0x71a8('0xab')]]=_[_0x71a8('0x6')](_0x4d7406[_0x71a8('0x9')],'id');}else{_0x3aaec1[_0x5e5f42[_0x71a8('0xab')]]=_0x4d7406['associatedResources'];}_0x3f75c6['push'](_0x3aaec1);}else{_0x4c662e[_0x71a8('0x86')]['id']=_0x4d7406[_0x71a8('0x9')];}}else{for(var _0x3e7101=0x0;_0x3e7101<_0x426ed5['length'];_0x3e7101++){_0x5e5f42=_[_0x71a8('0x95')](_0x22d3a7,[_0x71a8('0x16'),_0x426ed5[_0x3e7101]['name']]);if(_0x5e5f42[_0x71a8('0x4')]){_0x3aaec1={};_0x3aaec1[_0x5e5f42[_0x71a8('0xab')]]=_0x426ed5[_0x3e7101]['associatedResources'];_0x3f75c6[_0x71a8('0x93')](_0x3aaec1);}else{if(!_0x4c662e[_0x71a8('0x86')]['id'])_0x4c662e['where']['id']=[];_0x426ed5[_0x3e7101][_0x71a8('0x9')]['forEach'](function(_0x549f4a){_0x4c662e[_0x71a8('0x86')]['id'][_0x71a8('0x93')](_0x549f4a);});}}}if(!_['isEmpty'](_0x3f75c6)){_0x4c662e[_0x71a8('0x86')]=_[_0x71a8('0xa9')](_0x4c662e[_0x71a8('0x86')],{'$and':{'$or':_0x3f75c6}});}_0x4c662e=_['merge']({},_0x4c662e,_0x16c155[_0x71a8('0xac')]);if(_0x4d7406&&!_0x4d7406[_0x71a8('0xad')]&&_0x9022c5['childModel']===_0x71a8('0xc')){if(_0x16c155[_0x71a8('0x89')][_0x71a8('0xae')]){_0x4c662e['include']=[{'all':!![]}];}return _0x114d7e[_0x9022c5[_0x71a8('0x11')]][_0x71a8('0x8')](_0x4c662e)[_0x71a8('0x98')](function(_0x34b353){var _0x486910=[];_0x34b353[_0x71a8('0xaf')](function(_0x28fd9e){var _0xf828ee;switch(_0x28fd9e[_0x71a8('0xb0')]){case _0x71a8('0xb1'):_0xf828ee=_[_0x71a8('0x95')](_0x4d7406[_0x71a8('0x9')],function(_0x4d0444){return _0x4d0444['id']===_0x28fd9e['reportId']&&_0x4d0444[_0x71a8('0xe')]===_0x71a8('0xb2');});break;case _0x71a8('0xb3'):_0xf828ee=_[_0x71a8('0x95')](_0x4d7406[_0x71a8('0x9')],function(_0x2dcc70){return _0x2dcc70['id']===_0x28fd9e[_0x71a8('0xb4')]&&_0x2dcc70[_0x71a8('0xe')]===_0x71a8('0xb5');});break;}if(_0xf828ee)_0x486910[_0x71a8('0x93')](_0x28fd9e);});_0x2a7835[_0x71a8('0xb6')]=_0x486910[_0x71a8('0x92')];_0x2a7835[_0x71a8('0xb7')]=_0x486910;return _0x2a7835;});}else{if(!_[_0x71a8('0x91')](_0x16c155[_0x71a8('0x89')][_0x71a8('0xb8')])){_0x4c662e['where']['id']=_0x4c662e[_0x71a8('0x86')]['id']?_[_0x71a8('0x9f')](_0x4c662e['where']['id'],_0x16c155[_0x71a8('0x89')][_0x71a8('0xb8')]):_0x16c155[_0x71a8('0x89')][_0x71a8('0xb8')];if(_0x16c155[_0x71a8('0x89')][_0x71a8('0xb9')]){_0x4c662e[_0x71a8('0xa6')]=_0x16c155[_0x71a8('0x89')][_0x71a8('0xb9')];}}if(_0x16c155['query'][_0x71a8('0xba')]){_0x4c662e[_0x71a8('0x86')]=_[_0x71a8('0xa9')](_0x4c662e['where'],{'$and':_0x16c155[_0x71a8('0x89')][_0x71a8('0xba')]});}return _0x114d7e[_0x9022c5[_0x71a8('0x11')]][_0x71a8('0xb6')]({'where':_0x4c662e[_0x71a8('0x86')]})[_0x71a8('0x98')](function(_0x2224b7){_0x2a7835[_0x71a8('0xb6')]=_0x2224b7;if(_0x16c155[_0x71a8('0x89')][_0x71a8('0xae')]){if(_0x9022c5[_0x71a8('0x11')]===_0x71a8('0x1a')){_0x4c662e[_0x71a8('0xbb')]=[{'model':_0x114d7e['Tag'],'as':_0x71a8('0xbc'),'attributes':['id',_0x71a8('0x16'),_0x71a8('0xbd')],'required':_0x16c155['query'][_0x71a8('0xbe')]?!![]:![]},{'model':_0x114d7e[_0x71a8('0x6f')],'as':_0x71a8('0xbf'),'attributes':['id',_0x71a8('0x16'),'color'],'through':_0x16c155[_0x71a8('0x89')]['tag']?{'attributes':[],'where':{'TagId':_0x16c155[_0x71a8('0x89')][_0x71a8('0xbe')]||undefined}}:{},'required':_0x16c155[_0x71a8('0x89')]['tag']?!![]:![]}];}else{_0x4c662e['include']=[{'all':!![]}];}}return _0x114d7e[_0x9022c5['childModel']][_0x71a8('0x8')](_0x4c662e);})[_0x71a8('0x98')](function(_0x2cc070){_0x2a7835['rows']=_0x2cc070;if(_0x429c0e===_0x71a8('0x33')&&_0x16c155[_0x71a8('0x89')][_0x71a8('0xc0')]===_0x71a8('0xc1')){var _0x1e79db=[];for(var _0x5b0e99=0x0;_0x5b0e99<_0x2a7835[_0x71a8('0xb7')][_0x71a8('0x92')];_0x5b0e99++){_0x1e79db[_0x71a8('0x93')](_0x196f23(_0x71a8('0xc2'),_0x2a7835[_0x71a8('0xb7')][_0x5b0e99][_0x71a8('0xc3')]));_0x1e79db[_0x71a8('0x93')](_0x196f23(_0x71a8('0xc4'),_0x2a7835[_0x71a8('0xb7')][_0x5b0e99][_0x71a8('0xc3')]));_0x1e79db[_0x71a8('0x93')](_0x196f23(_0x71a8('0xc5'),_0x2a7835[_0x71a8('0xb7')][_0x5b0e99][_0x71a8('0xc3')]));_0x1e79db[_0x71a8('0x93')](_0x196f23(_0x71a8('0xc6'),_0x2a7835[_0x71a8('0xb7')][_0x5b0e99]['dataValues']));_0x1e79db[_0x71a8('0x93')](_0x196f23(_0x71a8('0xc7'),_0x2a7835[_0x71a8('0xb7')][_0x5b0e99][_0x71a8('0xc3')]));_0x1e79db[_0x71a8('0x93')](_0x196f23(_0x71a8('0xc8'),_0x2a7835[_0x71a8('0xb7')][_0x5b0e99]['dataValues']));}return Promise['all'](_0x1e79db)['then'](function(){return _0x2a7835;});}return _0x2a7835;});}});}}});}; \ No newline at end of file +var _0x3910=['telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','users','agents','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','cannedanswers','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','Reports','reportId','slice','QueryTypes','SELECT','ui.','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','find','params','ignore','autoAssociation','all','keys','filters','intersection','attributes','fields','limit','offset','merge','key','VIRTUAL','foreignKey','forEach','includeAll','reportType','custom','CustomReports','count','ids','order','customSorting','extraQueryConditions','include','Tags','color','tag','ThroughTags','rows','openTabs','true','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','findAll','catch','value','model','then','associatedResources','name','UserProfileResource','AnalyticExtractedReport','map','resourceId','type','toLowerCase','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','projectName','projects','JscriptyProject','contacts','ListId','lists','CmCompany','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','voicerecordings','VoiceRecording','parentSections','Agents','membername','User','role','agent'];(function(_0x89d941,_0x432917){var _0x1fe01c=function(_0x39eb81){while(--_0x39eb81){_0x89d941['push'](_0x89d941['shift']());}};_0x1fe01c(++_0x432917);}(_0x3910,0x83));var _0x0391=function(_0x12bc59,_0x382477){_0x12bc59=_0x12bc59-0x0;var _0x47e470=_0x3910[_0x12bc59];return _0x47e470;};'use strict';var _=require(_0x0391('0x0'));var attributes=require(_0x0391('0x1'));var squel=require(_0x0391('0x2'));module[_0x0391('0x3')]=function(_0x4128bc){var _0x31734f=_0x4128bc[_0x0391('0x4')];function _0x6fcda(_0x271e15,_0x506e2a){return new Promise(function(_0x435b0a,_0x326fe3){if(!_0x506e2a)return _0x435b0a(null);var _0x10f836=_0x506e2a['filter']?{[_0x506e2a[_0x0391('0x5')][_0x0391('0x6')]]:_0x506e2a['filter']['value']}:undefined;return _0x31734f[_0x271e15][_0x0391('0x7')]({'where':_0x10f836,'raw':!![]})['then'](function(_0x1a073a){_0x506e2a['associatedResources']=_['map'](_0x1a073a,'id');_0x435b0a(_0x506e2a);})[_0x0391('0x8')](function(_0x19dafd){_0x326fe3(_0x19dafd);});});}function _0x2eab8e(_0x1b8781,_0xea2c5f){return new Promise(function(_0x223578,_0x3b1ad9){var _0xfd2a53=_0x1b8781[_0x0391('0x5')]?{[_0x1b8781[_0x0391('0x5')]['field']]:_0x1b8781[_0x0391('0x5')][_0x0391('0x9')]}:undefined;return _0x31734f[_0x1b8781[_0x0391('0xa')]]['findAll']({'where':_0xfd2a53,'raw':!![]})[_0x0391('0xb')](function(_0x31980a){_0xea2c5f[_0x0391('0xc')]=_['map'](_0x31980a,function(_0x36fa0c){return _0x36fa0c[_0x0391('0xd')];});_0x223578(_0xea2c5f);})['catch'](function(_0x2400bf){_0x3b1ad9(_0x2400bf);});});}function _0x262eb2(_0x597e78,_0x37b09f,_0x74d540){if(!_0x37b09f)return Promise['resolve'](null);return new Promise(function(_0x4acf05,_0x43fe9d){return _0x31734f[_0x0391('0xe')]['findAll']({'where':{'sectionId':_0x37b09f['id']},'raw':!![]})[_0x0391('0xb')](function(_0x5e7673){if(_0x597e78[_0x0391('0x6')]&&_0x597e78[_0x0391('0x6')]!=='id'){_0x37b09f[_0x0391('0xc')]=_['map'](_0x5e7673,function(_0x5db30e){return _0x5db30e[_0x597e78[_0x0391('0x6')]];});}else{if(_0x74d540===_0x0391('0xf')){_0x37b09f['associatedResources']=_[_0x0391('0x10')](_0x5e7673,function(_0x26c68a){return{'id':_0x26c68a[_0x0391('0x11')],'type':_0x26c68a[_0x0391('0x12')]};});}else{_0x37b09f[_0x0391('0xc')]=_[_0x0391('0x10')](_0x5e7673,function(_0x2615fe){return _0x2615fe[_0x0391('0x11')];});}}_0x4acf05(_0x37b09f);})[_0x0391('0x8')](function(_0x170853){_0x43fe9d(_0x170853);});});}function _0x5c4ee9(_0x5304ae,_0x5647a1){var _0x4e56b8={'parentSections':[]};switch(_0x5304ae[_0x0391('0x13')]()){case'squareprojects':_0x4e56b8[_0x0391('0x14')]=_0x0391('0x15');break;case _0x0391('0x16'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x17');break;case _0x0391('0x18'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x19');_0x4e56b8['parentSections']=[{'name':'SquareProjects','field':_0x0391('0xd'),'foreignKey':_0x0391('0x1a')}];break;case _0x0391('0x1b'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x1c');break;case _0x0391('0x1d'):_0x4e56b8[_0x0391('0x14')]='CmContact';_0x4e56b8['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0x0391('0x1e')}];break;case _0x0391('0x1f'):_0x4e56b8[_0x0391('0x14')]='CmList';break;case'companies':_0x4e56b8['childModel']=_0x0391('0x20');break;case'globalcustomfields':_0x4e56b8[_0x0391('0x14')]='CmCustomField';break;case'chatqueues':_0x4e56b8['childModel']=_0x0391('0x21');break;case _0x0391('0x22'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x23');break;case _0x0391('0x24'):_0x4e56b8['childModel']=_0x0391('0x25');break;case _0x0391('0x26'):_0x4e56b8[_0x0391('0x14')]='FaxAccount';break;case'inboundroutes':case _0x0391('0x27'):case _0x0391('0x28'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x29');break;case _0x0391('0x2a'):_0x4e56b8[_0x0391('0x14')]='VoiceContext';break;case _0x0391('0x2b'):_0x4e56b8[_0x0391('0x14')]='VoiceMail';break;case _0x0391('0x2c'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x2d');_0x4e56b8[_0x0391('0x2e')]=[{'name':_0x0391('0x2f'),'field':'name','foreignKey':_0x0391('0x30'),'model':_0x0391('0x31'),'filter':{'field':_0x0391('0x32'),'value':[_0x0391('0x33')]}},{'name':'Telephones','field':_0x0391('0xd'),'foreignKey':_0x0391('0x30'),'model':_0x0391('0x31'),'filter':{'field':'role','value':[_0x0391('0x34')]}},{'name':_0x0391('0x35'),'field':_0x0391('0xd'),'foreignKey':_0x0391('0x36'),'model':_0x0391('0x37'),'filter':{'field':_0x0391('0x12'),'value':[_0x0391('0x38')]}},{'name':_0x0391('0x39'),'field':'name','foreignKey':'queue','model':_0x0391('0x37'),'filter':{'field':_0x0391('0x12'),'value':['outbound']}}];break;case _0x0391('0x3a'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x3b');break;case'chanspies':_0x4e56b8[_0x0391('0x14')]='VoiceChanSpy';break;case _0x0391('0x3c'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x3d');break;case _0x0391('0x3e'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x3f');break;case _0x0391('0x40'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x41');break;case _0x0391('0x42'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x43');break;case _0x0391('0x44'):_0x4e56b8[_0x0391('0x14')]='MailSubstatus';break;case _0x0391('0x45'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x46');break;case'openchannelaccounts':_0x4e56b8[_0x0391('0x14')]=_0x0391('0x47');break;case _0x0391('0x48'):_0x4e56b8[_0x0391('0x14')]='SmsQueue';break;case _0x0391('0x49'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x4a');break;case _0x0391('0x4b'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x4c');break;case _0x0391('0x4d'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x4e');break;case _0x0391('0x4f'):_0x4e56b8['childModel']=_0x0391('0x50');break;case'voicequeues':case'queuecampaigns':_0x4e56b8['childModel']='VoiceQueue';if(_0x5647a1){_0x4e56b8[_0x0391('0x2e')]=[{'name':'VoiceQueues'},{'name':_0x0391('0x39')}];}break;case _0x0391('0x51'):case _0x0391('0x52'):case _0x0391('0x53'):_0x4e56b8['childModel']=_0x0391('0x31');if(_0x5647a1){_0x4e56b8[_0x0391('0x2e')]=[{'name':_0x0391('0x54'),'filter':{'field':_0x0391('0x32'),'value':[_0x0391('0x55'),_0x0391('0x56')]},'ignore':!![]},{'name':'Agents'},{'name':_0x0391('0x57')}];}break;case _0x0391('0x58'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x59');break;case'salesforceaccounts':_0x4e56b8['childModel']=_0x0391('0x5a');break;case _0x0391('0x5b'):_0x4e56b8[_0x0391('0x14')]='FreshdeskAccount';break;case _0x0391('0x5c'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x5d');break;case'deskaccounts':_0x4e56b8['childModel']=_0x0391('0x5e');break;case _0x0391('0x5f'):_0x4e56b8[_0x0391('0x14')]='ZohoAccount';break;case'vtigeraccounts':_0x4e56b8[_0x0391('0x14')]=_0x0391('0x31');break;case _0x0391('0x60'):_0x4e56b8[_0x0391('0x14')]='CannedAnswer';break;case _0x0391('0x61'):_0x4e56b8['childModel']=_0x0391('0x62');break;case _0x0391('0x63'):_0x4e56b8[_0x0391('0x14')]='Dashboard';break;case _0x0391('0x64'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x65');break;case _0x0391('0x66'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x67');break;case _0x0391('0x68'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x69');break;case'sounds':_0x4e56b8['childModel']=_0x0391('0x6a');break;case'tags':_0x4e56b8[_0x0391('0x14')]=_0x0391('0x6b');break;case _0x0391('0x6c'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x6d');break;case _0x0391('0x6e'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x6f');break;case _0x0391('0x70'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x71');break;case'variables':_0x4e56b8['childModel']=_0x0391('0x72');break;case _0x0391('0x73'):_0x4e56b8[_0x0391('0x14')]=_0x0391('0x74');break;case'extractedreports':_0x4e56b8[_0x0391('0x14')]=_0x0391('0xf');_0x4e56b8[_0x0391('0x2e')]=[{'name':_0x0391('0x75'),'field':'id','foreignKey':_0x0391('0x76')}];break;case'metrics':_0x4e56b8['childModel']='AnalyticMetric';break;}return _0x4e56b8;}function _0xd28685(_0x58dce2,_0x5027b0){var _0x3d4d84=_0x58dce2['charAt'](0x0)['toUpperCase']()+_0x58dce2[_0x0391('0x77')](0x1);var _0x1a86a0={'type':_0x31734f['Sequelize'][_0x0391('0x78')][_0x0391('0x79')],'raw':!![]};return new Promise(function(_0xf92304,_0x459173){var _0x44221e=squel['select']()[_0x0391('0x6')](_0x0391('0x7a')+_0x3d4d84+'InteractionId','id')[_0x0391('0x6')](_0x0391('0x7b'))[_0x0391('0x7c')](_0x0391('0x7d')+_0x58dce2+_0x0391('0x7e'),'ui')[_0x0391('0x7f')](_0x0391('0x80'),_0x5027b0['id']);return _0x31734f[_0x0391('0x81')][_0x0391('0x82')](_0x44221e[_0x0391('0x83')](),_0x1a86a0)[_0x0391('0xb')](function(_0x201632){_0x5027b0[_0x3d4d84+_0x0391('0x84')]=_0x201632;_0xf92304(_0x201632);})[_0x0391('0x8')](function(_0x515db){_0x459173(_0x515db);});});}return _0x4128bc['define'](_0x0391('0x85'),attributes,{'tableName':_0x0391('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x29b12d){var _0x359dfb=require(_0x0391('0x87'));var _0x1fc6c6={'raw':_0x29b12d['query'][_0x0391('0x88')],'where':{}};var _0x3c361a={};var _0x2d55b7={'count':0x0,'rows':[]};var _0x1de0d1=_0x29b12d[_0x0391('0x82')][_0x0391('0x89')];var _0x15907e=_0x29b12d[_0x0391('0x82')][_0x0391('0x8a')]||![];var _0x252f8b=_0x5c4ee9(_0x1de0d1,_0x15907e);if(!_0x252f8b[_0x0391('0x14')])throw new Error('Invalid\x20section\x20\x27'+_0x1de0d1+'\x27');var _0x5dac99=[{'name':_0x1de0d1}];if(!_[_0x0391('0x8b')](_0x252f8b[_0x0391('0x2e')]))_0x5dac99=_0x252f8b[_0x0391('0x2e')];var _0x12c653=[];for(var _0x354186=0x0;_0x354186<_0x5dac99[_0x0391('0x8c')];_0x354186++){_0x12c653[_0x0391('0x8d')](_0x31734f[_0x0391('0x8e')][_0x0391('0x8f')]({'where':{'userProfileId':_0x29b12d[_0x0391('0x90')]['id'],'name':_0x5dac99[_0x354186][_0x0391('0xd')]},'raw':!![]}));}return Promise['all'](_0x12c653)[_0x0391('0xb')](function(_0xccded9){var _0x1f1a7c=_[_0x0391('0x5')](_0xccded9,function(_0x437317){return _0x437317?_0x437317:undefined;});var _0x3a1909=_[_0x0391('0x5')](_0x5dac99,[_0x0391('0x91'),!![]]);var _0xb0a0c3=_[_0x0391('0x8b')](_0x1f1a7c)&&_[_0x0391('0x8b')](_0x3a1909)?null:_['union'](_0x3a1909,_0x1f1a7c);if(!_0xb0a0c3)return null;var _0x440485=[];for(var _0x43808e=0x0;_0x43808e<_0xb0a0c3[_0x0391('0x8c')];_0x43808e++){var _0x1cbff2=_[_0x0391('0x8f')](_0x5dac99,function(_0xac9aba){return _0xb0a0c3[_0x43808e]?_0xac9aba[_0x0391('0xd')]===_0xb0a0c3[_0x43808e][_0x0391('0xd')]:null;});if(_0x1cbff2){if(_0xb0a0c3[_0x43808e][_0x0391('0x91')]){_0x440485[_0x0391('0x8d')](_0x6fcda(_0x252f8b[_0x0391('0x14')],_0xb0a0c3[_0x43808e]));}else{if(!_0xb0a0c3[_0x43808e][_0x0391('0x92')]){_0x440485[_0x0391('0x8d')](_0x262eb2(_0x1cbff2,_0xb0a0c3[_0x43808e],_0x252f8b[_0x0391('0x14')]));}else{if(_0x1cbff2[_0x0391('0xa')]){_0x440485[_0x0391('0x8d')](_0x2eab8e(_0x1cbff2,_0xb0a0c3[_0x43808e]));}}}}}return Promise[_0x0391('0x93')](_0x440485);})[_0x0391('0xb')](function(_0x1dfd33){var _0x181727=_0x1dfd33;var _0x294938=null;if(_0x181727){_0x294938=_0x181727['length']===0x1?_0x181727[0x0]:null;}if(!_0x294938&&!_0x181727)return _0x2d55b7;var _0x43b161=_0x31734f[_0x252f8b[_0x0391('0x14')]]['rawAttributes'];_0x3c361a[_0x0391('0xa')]=_[_0x0391('0x94')](_0x43b161);_0x3c361a['query']=_['keys'](_0x29b12d[_0x0391('0x82')]);_0x3c361a[_0x0391('0x95')]=_[_0x0391('0x96')](_0x3c361a[_0x0391('0xa')],_0x3c361a['query']);_0x1fc6c6[_0x0391('0x97')]=_[_0x0391('0x96')](_0x3c361a[_0x0391('0xa')],_0x359dfb[_0x0391('0x98')](_0x29b12d['query'][_0x0391('0x98')]));_0x1fc6c6['attributes']=_0x1fc6c6['attributes'][_0x0391('0x8c')]?_0x1fc6c6['attributes']:_0x3c361a[_0x0391('0xa')];if(!_0x29b12d[_0x0391('0x82')]['hasOwnProperty']('nolimit')){_0x1fc6c6['limit']=_0x359dfb[_0x0391('0x99')](_0x29b12d[_0x0391('0x82')]['limit']);_0x1fc6c6['offset']=_0x359dfb[_0x0391('0x9a')](_0x29b12d[_0x0391('0x82')][_0x0391('0x9a')]);}_0x1fc6c6['order']=_0x359dfb['sort'](_0x29b12d[_0x0391('0x82')]['sort']);_0x1fc6c6['where']=_0x359dfb[_0x0391('0x95')](_['pick'](_0x29b12d['query'],_0x3c361a[_0x0391('0x95')]));if(_0x29b12d[_0x0391('0x82')]['filter']){_0x1fc6c6[_0x0391('0x7f')]=_[_0x0391('0x9b')](_0x1fc6c6[_0x0391('0x7f')],{'$or':_[_0x0391('0x10')](_0x43b161,function(_0x47cf62){if(_0x47cf62[_0x0391('0x12')][_0x0391('0x9c')]!==_0x0391('0x9d')){var _0x5802d4={};_0x5802d4[_0x47cf62[_0x0391('0x6')]]={'$like':'%'+_0x29b12d[_0x0391('0x82')][_0x0391('0x5')]+'%'};return _0x5802d4;}})});}var _0x5d8333=[];var _0x19e830=null;var _0x14c202={};if(_0x294938){_0x19e830=_[_0x0391('0x8f')](_0x5dac99,[_0x0391('0xd'),_0x294938[_0x0391('0xd')]]);if(_0x19e830['field']){_0x14c202={};if(_0x252f8b['childModel']===_0x0391('0xf')){_0x14c202[_0x19e830[_0x0391('0x9e')]]=_[_0x0391('0x10')](_0x294938[_0x0391('0xc')],'id');}else{_0x14c202[_0x19e830[_0x0391('0x9e')]]=_0x294938[_0x0391('0xc')];}_0x5d8333[_0x0391('0x8d')](_0x14c202);}else{_0x1fc6c6[_0x0391('0x7f')]['id']=_0x294938[_0x0391('0xc')];}}else{for(var _0x4e13e1=0x0;_0x4e13e1<_0x181727[_0x0391('0x8c')];_0x4e13e1++){_0x19e830=_[_0x0391('0x8f')](_0x5dac99,[_0x0391('0xd'),_0x181727[_0x4e13e1][_0x0391('0xd')]]);if(_0x19e830[_0x0391('0x6')]){_0x14c202={};_0x14c202[_0x19e830[_0x0391('0x9e')]]=_0x181727[_0x4e13e1][_0x0391('0xc')];_0x5d8333[_0x0391('0x8d')](_0x14c202);}else{if(!_0x1fc6c6[_0x0391('0x7f')]['id'])_0x1fc6c6['where']['id']=[];_0x181727[_0x4e13e1][_0x0391('0xc')][_0x0391('0x9f')](function(_0x1fc43e){_0x1fc6c6['where']['id'][_0x0391('0x8d')](_0x1fc43e);});}}}if(!_['isEmpty'](_0x5d8333)){_0x1fc6c6[_0x0391('0x7f')]=_['merge'](_0x1fc6c6[_0x0391('0x7f')],{'$and':{'$or':_0x5d8333}});}_0x1fc6c6=_[_0x0391('0x9b')]({},_0x1fc6c6,_0x29b12d['options']);if(_0x294938&&!_0x294938['autoAssociation']&&_0x252f8b[_0x0391('0x14')]===_0x0391('0xf')){if(_0x29b12d[_0x0391('0x82')][_0x0391('0xa0')]){_0x1fc6c6['include']=[{'all':!![]}];}return _0x31734f[_0x252f8b['childModel']][_0x0391('0x7')](_0x1fc6c6)[_0x0391('0xb')](function(_0x4f90eb){var _0x586daf=[];_0x4f90eb[_0x0391('0x9f')](function(_0x288bb5){var _0x1a6b40;switch(_0x288bb5[_0x0391('0xa1')]){case'default':_0x1a6b40=_['find'](_0x294938[_0x0391('0xc')],function(_0x59b3da){return _0x59b3da['id']===_0x288bb5[_0x0391('0x76')]&&_0x59b3da[_0x0391('0x12')]==='DefaultReports';});break;case _0x0391('0xa2'):_0x1a6b40=_[_0x0391('0x8f')](_0x294938[_0x0391('0xc')],function(_0x2a393d){return _0x2a393d['id']===_0x288bb5[_0x0391('0x76')]&&_0x2a393d[_0x0391('0x12')]===_0x0391('0xa3');});break;}if(_0x1a6b40)_0x586daf[_0x0391('0x8d')](_0x288bb5);});_0x2d55b7[_0x0391('0xa4')]=_0x586daf[_0x0391('0x8c')];_0x2d55b7['rows']=_0x586daf;return _0x2d55b7;});}else{if(!_[_0x0391('0x8b')](_0x29b12d[_0x0391('0x82')]['ids'])){_0x1fc6c6['where']['id']=_0x1fc6c6['where']['id']?_[_0x0391('0x96')](_0x1fc6c6['where']['id'],_0x29b12d[_0x0391('0x82')][_0x0391('0xa5')]):_0x29b12d[_0x0391('0x82')]['ids'];if(_0x29b12d[_0x0391('0x82')]['customSorting']){_0x1fc6c6[_0x0391('0xa6')]=_0x29b12d[_0x0391('0x82')][_0x0391('0xa7')];}}if(_0x29b12d[_0x0391('0x82')][_0x0391('0xa8')]){_0x1fc6c6['where']=_[_0x0391('0x9b')](_0x1fc6c6[_0x0391('0x7f')],{'$and':_0x29b12d['query']['extraQueryConditions']});}return _0x31734f[_0x252f8b[_0x0391('0x14')]][_0x0391('0xa4')]({'where':_0x1fc6c6['where']})['then'](function(_0x4ee557){_0x2d55b7['count']=_0x4ee557;if(_0x29b12d[_0x0391('0x82')][_0x0391('0xa0')]){if(_0x252f8b[_0x0391('0x14')]==='CmContact'){_0x1fc6c6[_0x0391('0xa9')]=[{'model':_0x31734f[_0x0391('0x6b')],'as':_0x0391('0xaa'),'attributes':['id','name',_0x0391('0xab')],'required':_0x29b12d[_0x0391('0x82')][_0x0391('0xac')]?!![]:![]},{'model':_0x31734f[_0x0391('0x6b')],'as':_0x0391('0xad'),'attributes':['id','name',_0x0391('0xab')],'through':_0x29b12d[_0x0391('0x82')]['tag']?{'attributes':[],'where':{'TagId':_0x29b12d[_0x0391('0x82')]['tag']||undefined}}:{},'required':_0x29b12d[_0x0391('0x82')][_0x0391('0xac')]?!![]:![]}];}else{_0x1fc6c6[_0x0391('0xa9')]=[{'all':!![]}];}}return _0x31734f[_0x252f8b[_0x0391('0x14')]][_0x0391('0x7')](_0x1fc6c6);})[_0x0391('0xb')](function(_0x1e30ea){_0x2d55b7[_0x0391('0xae')]=_0x1e30ea;if(_0x1de0d1===_0x0391('0x2f')&&_0x29b12d[_0x0391('0x82')][_0x0391('0xaf')]===_0x0391('0xb0')){var _0x4e1ece=[];for(var _0x5ac2f2=0x0;_0x5ac2f2<_0x2d55b7[_0x0391('0xae')][_0x0391('0x8c')];_0x5ac2f2++){_0x4e1ece[_0x0391('0x8d')](_0xd28685('chat',_0x2d55b7[_0x0391('0xae')][_0x5ac2f2][_0x0391('0xb1')]));_0x4e1ece[_0x0391('0x8d')](_0xd28685(_0x0391('0xb2'),_0x2d55b7[_0x0391('0xae')][_0x5ac2f2][_0x0391('0xb1')]));_0x4e1ece['push'](_0xd28685(_0x0391('0xb3'),_0x2d55b7[_0x0391('0xae')][_0x5ac2f2]['dataValues']));_0x4e1ece[_0x0391('0x8d')](_0xd28685(_0x0391('0xb4'),_0x2d55b7[_0x0391('0xae')][_0x5ac2f2]['dataValues']));_0x4e1ece[_0x0391('0x8d')](_0xd28685(_0x0391('0xb5'),_0x2d55b7[_0x0391('0xae')][_0x5ac2f2][_0x0391('0xb1')]));_0x4e1ece[_0x0391('0x8d')](_0xd28685(_0x0391('0xb6'),_0x2d55b7['rows'][_0x5ac2f2][_0x0391('0xb1')]));}return Promise[_0x0391('0x93')](_0x4e1ece)[_0x0391('0xb')](function(){return _0x2d55b7;});}return _0x2d55b7;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index d638e9d..e5eeb06 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 _0x2c8f=['client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x499a43,_0x3cbee7){var _0x4e607e=function(_0xd7f146){while(--_0xd7f146){_0x499a43['push'](_0x499a43['shift']());}};_0x4e607e(++_0x3cbee7);}(_0x2c8f,0x192));var _0xf2c8=function(_0x5af246,_0x52a000){_0x5af246=_0x5af246-0x0;var _0x3da5c2=_0x2c8f[_0x5af246];return _0x3da5c2;};'use strict';var _=require('lodash');var util=require(_0xf2c8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2c8('0x1'));var db=require(_0xf2c8('0x2'))['db'];var utils=require(_0xf2c8('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf2c8('0x4'));var jayson=require(_0xf2c8('0x5'));var client=jayson[_0xf2c8('0x6')][_0xf2c8('0x7')]({'port':0x232a});config[_0xf2c8('0x8')]=_['defaults'](config[_0xf2c8('0x8')],{'host':_0xf2c8('0x9'),'port':0x18eb});var socket=require(_0xf2c8('0xa'))(new Redis(config[_0xf2c8('0x8')]));require(_0xf2c8('0xb'))[_0xf2c8('0xc')](socket);function respondWithRpcPromise(_0x496d64,_0x1679fe,_0x1d3ece){return new BPromise(function(_0x281e82,_0x22eacb){return client[_0xf2c8('0xd')](_0x496d64,_0x1d3ece)[_0xf2c8('0xe')](function(_0x267a6e){logger[_0xf2c8('0xf')]('UserProfile,\x20%s,\x20%s',_0x1679fe,_0xf2c8('0x10'));logger['debug'](_0xf2c8('0x11'),_0x1679fe,_0xf2c8('0x10'),JSON[_0xf2c8('0x12')](_0x267a6e));if(_0x267a6e[_0xf2c8('0x13')]){if(_0x267a6e[_0xf2c8('0x13')][_0xf2c8('0x14')]===0x1f4){logger['error'](_0xf2c8('0x15'),_0x1679fe,_0x267a6e[_0xf2c8('0x13')][_0xf2c8('0x16')]);return _0x22eacb(_0x267a6e[_0xf2c8('0x13')][_0xf2c8('0x16')]);}logger[_0xf2c8('0x13')](_0xf2c8('0x15'),_0x1679fe,_0x267a6e['error'][_0xf2c8('0x16')]);return _0x281e82(_0x267a6e[_0xf2c8('0x13')][_0xf2c8('0x16')]);}else{logger[_0xf2c8('0xf')](_0xf2c8('0x15'),_0x1679fe,'request\x20sent');_0x281e82(_0x267a6e['result'][_0xf2c8('0x16')]);}})[_0xf2c8('0x17')](function(_0x2c6d7a){logger[_0xf2c8('0x13')]('UserProfile,\x20%s,\x20%s',_0x1679fe,_0x2c6d7a);_0x22eacb(_0x2c6d7a);});});} \ No newline at end of file +var _0x8374=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./userProfile.socket','register','UserProfile,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2e9c72,_0x232d43){var _0x4510cf=function(_0x38b374){while(--_0x38b374){_0x2e9c72['push'](_0x2e9c72['shift']());}};_0x4510cf(++_0x232d43);}(_0x8374,0x174));var _0x4837=function(_0x5d0361,_0x362017){_0x5d0361=_0x5d0361-0x0;var _0xfbf7f2=_0x8374[_0x5d0361];return _0xfbf7f2;};'use strict';var _=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var moment=require(_0x4837('0x2'));var BPromise=require(_0x4837('0x3'));var rs=require(_0x4837('0x4'));var fs=require('fs');var Redis=require(_0x4837('0x5'));var db=require(_0x4837('0x6'))['db'];var utils=require(_0x4837('0x7'));var logger=require(_0x4837('0x8'))(_0x4837('0x9'));var config=require(_0x4837('0xa'));var jayson=require(_0x4837('0xb'));var client=jayson[_0x4837('0xc')][_0x4837('0xd')]({'port':0x232a});config['redis']=_[_0x4837('0xe')](config['redis'],{'host':_0x4837('0xf'),'port':0x18eb});var socket=require(_0x4837('0x10'))(new Redis(config[_0x4837('0x11')]));require(_0x4837('0x12'))[_0x4837('0x13')](socket);function respondWithRpcPromise(_0x3d0e2b,_0x7c34dd,_0xcf709b){return new BPromise(function(_0x37f017,_0x299827){return client['request'](_0x3d0e2b,_0xcf709b)['then'](function(_0x2cad13){logger['info'](_0x4837('0x14'),_0x7c34dd,_0x4837('0x15'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x7c34dd,'request\x20sent',JSON[_0x4837('0x16')](_0x2cad13));if(_0x2cad13[_0x4837('0x17')]){if(_0x2cad13[_0x4837('0x17')][_0x4837('0x18')]===0x1f4){logger['error'](_0x4837('0x14'),_0x7c34dd,_0x2cad13[_0x4837('0x17')][_0x4837('0x19')]);return _0x299827(_0x2cad13['error'][_0x4837('0x19')]);}logger[_0x4837('0x17')]('UserProfile,\x20%s,\x20%s',_0x7c34dd,_0x2cad13[_0x4837('0x17')][_0x4837('0x19')]);return _0x37f017(_0x2cad13[_0x4837('0x17')][_0x4837('0x19')]);}else{logger[_0x4837('0x1a')](_0x4837('0x14'),_0x7c34dd,'request\x20sent');_0x37f017(_0x2cad13[_0x4837('0x1b')][_0x4837('0x19')]);}})[_0x4837('0x1c')](function(_0x3c4d53){logger[_0x4837('0x17')](_0x4837('0x14'),_0x7c34dd,_0x3c4d53);_0x299827(_0x3c4d53);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e47a527..b6ad3ec 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 _0x69c9=['userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0x3818c8,_0x234f80){var _0x3253a7=function(_0x5f1000){while(--_0x5f1000){_0x3818c8['push'](_0x3818c8['shift']());}};_0x3253a7(++_0x234f80);}(_0x69c9,0x169));var _0x969c=function(_0x2c4b6a,_0x12997d){_0x2c4b6a=_0x2c4b6a-0x0;var _0x58d10b=_0x69c9[_0x2c4b6a];return _0x58d10b;};'use strict';var UserProfileEvents=require(_0x969c('0x0'));var events=[_0x969c('0x1'),_0x969c('0x2'),_0x969c('0x3')];function createListener(_0x1e5132,_0x4b5c28){return function(_0x4e61d0){_0x4b5c28[_0x969c('0x4')](_0x1e5132,_0x4e61d0);};}function removeListener(_0x59e7f8,_0x473dfd){return function(){UserProfileEvents['removeListener'](_0x59e7f8,_0x473dfd);};}exports['register']=function(_0x371923){for(var _0x2d23b4=0x0,_0x1dab44=events['length'];_0x2d23b4<_0x1dab44;_0x2d23b4++){var _0x23b1b3=events[_0x2d23b4];var _0x2ef7f7=createListener(_0x969c('0x5')+_0x23b1b3,_0x371923);UserProfileEvents['on'](_0x23b1b3,_0x2ef7f7);}}; \ No newline at end of file +var _0x546a=['removeListener','register','length','userProfile:','save','remove','update','emit'];(function(_0xd91aea,_0x90202d){var _0xed7cb0=function(_0x325633){while(--_0x325633){_0xd91aea['push'](_0xd91aea['shift']());}};_0xed7cb0(++_0x90202d);}(_0x546a,0x84));var _0xa546=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x546a[_0x3dd15e];return _0x231fd0;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xa546('0x0'),_0xa546('0x1'),_0xa546('0x2')];function createListener(_0x2d72b3,_0x4a1b48){return function(_0x1f199b){_0x4a1b48[_0xa546('0x3')](_0x2d72b3,_0x1f199b);};}function removeListener(_0x4a5562,_0x104367){return function(){UserProfileEvents[_0xa546('0x4')](_0x4a5562,_0x104367);};}exports[_0xa546('0x5')]=function(_0x3cf38a){for(var _0x35ee43=0x0,_0x1d7548=events[_0xa546('0x6')];_0x35ee43<_0x1d7548;_0x35ee43++){var _0x3fbe32=events[_0x35ee43];var _0x41290d=createListener(_0xa546('0x7')+_0x3fbe32,_0x3cf38a);UserProfileEvents['on'](_0x3fbe32,_0x41290d);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 07bce0b..548aeef 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 _0x1193=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x53f275,_0x17c29e){var _0x1b6c12=function(_0x4f1597){while(--_0x4f1597){_0x53f275['push'](_0x53f275['shift']());}};_0x1b6c12(++_0x17c29e);}(_0x1193,0xbc));var _0x3119=function(_0x48df22,_0x1bd2ac){_0x48df22=_0x48df22-0x0;var _0x403593=_0x1193[_0x48df22];return _0x403593;};'use strict';var multer=require(_0x3119('0x0'));var util=require(_0x3119('0x1'));var path=require(_0x3119('0x2'));var timeout=require(_0x3119('0x3'));var express=require(_0x3119('0x4'));var router=express['Router']();var fs_extra=require(_0x3119('0x5'));var auth=require(_0x3119('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3119('0x7'));var controller=require(_0x3119('0x8'));router['get']('/',auth[_0x3119('0x9')](),controller[_0x3119('0xa')]);router[_0x3119('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x3119('0xc')]);router[_0x3119('0xb')](_0x3119('0xd'),auth[_0x3119('0x9')](),controller[_0x3119('0xe')]);router[_0x3119('0xf')]('/',auth[_0x3119('0x9')](),controller[_0x3119('0x10')]);router[_0x3119('0x11')](_0x3119('0xd'),auth[_0x3119('0x9')](),controller[_0x3119('0x12')]);router['delete']('/:id',auth[_0x3119('0x9')](),controller[_0x3119('0x13')]);module[_0x3119('0x14')]=router; \ No newline at end of file +var _0x34e5=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x211576,_0xcc41af){var _0x3ce235=function(_0x28bd8a){while(--_0x28bd8a){_0x211576['push'](_0x211576['shift']());}};_0x3ce235(++_0xcc41af);}(_0x34e5,0x1cc));var _0x534e=function(_0x49048b,_0x23ad3d){_0x49048b=_0x49048b-0x0;var _0x372d56=_0x34e5[_0x49048b];return _0x372d56;};'use strict';var multer=require(_0x534e('0x0'));var util=require('util');var path=require(_0x534e('0x1'));var timeout=require(_0x534e('0x2'));var express=require('express');var router=express[_0x534e('0x3')]();var fs_extra=require(_0x534e('0x4'));var auth=require(_0x534e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x534e('0x6'));var controller=require(_0x534e('0x7'));router[_0x534e('0x8')]('/',auth[_0x534e('0x9')](),controller[_0x534e('0xa')]);router[_0x534e('0x8')]('/describe',auth[_0x534e('0x9')](),controller[_0x534e('0xb')]);router['get'](_0x534e('0xc'),auth[_0x534e('0x9')](),controller[_0x534e('0xd')]);router[_0x534e('0xe')]('/',auth[_0x534e('0x9')](),controller[_0x534e('0xf')]);router[_0x534e('0x10')](_0x534e('0xc'),auth[_0x534e('0x9')](),controller[_0x534e('0x11')]);router[_0x534e('0x12')]('/:id',auth[_0x534e('0x9')](),controller[_0x534e('0x13')]);module[_0x534e('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index d414df4..99c83f4 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 _0x8708=['sequelize','exports','STRING'];(function(_0x400f83,_0x12853f){var _0x159295=function(_0xfd5fe1){while(--_0xfd5fe1){_0x400f83['push'](_0x400f83['shift']());}};_0x159295(++_0x12853f);}(_0x8708,0x1a4));var _0x8870=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8708[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x8870('0x0'));module[_0x8870('0x1')]={'name':{'type':Sequelize[_0x8870('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x8870('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7037=['STRING','sequelize','exports','INTEGER'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7037,0x109));var _0x7703=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x7037[_0x12fc8d];return _0x3f9d04;};'use strict';var Sequelize=require(_0x7703('0x0'));module[_0x7703('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7703('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7703('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 7df385a..614e07d 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 _0x57ca=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','UserProfileResource','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x26d4c8,_0xc9496b){var _0x5f0eb9=function(_0x538cd7){while(--_0x538cd7){_0x26d4c8['push'](_0x26d4c8['shift']());}};_0x5f0eb9(++_0xc9496b);}(_0x57ca,0x108));var _0xa57c=function(_0x4d66b6,_0x37f362){_0x4d66b6=_0x4d66b6-0x0;var _0x3ba1d5=_0x57ca[_0x4d66b6];return _0x3ba1d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['UserProfileResource']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['UserProfileResource'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));};exports[_0xa57c('0x43')]=function(_0x5ded49,_0x5bf336){return db['UserProfileResource'][_0xa57c('0x43')]()[_0xa57c('0x21')](respondWithResult(_0x5bf336,null))[_0xa57c('0x40')](handleError(_0x5bf336,null));}; \ No newline at end of file +var _0x57ca=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','UserProfileResource','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x243427,_0x784e11){var _0xc59f9a=function(_0x408037){while(--_0x408037){_0x243427['push'](_0x243427['shift']());}};_0xc59f9a(++_0x784e11);}(_0x57ca,0x108));var _0xa57c=function(_0x58d321,_0x2802db){_0x58d321=_0x58d321-0x0;var _0x400f9a=_0x57ca[_0x58d321];return _0x400f9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}exports[_0xa57c('0x28')]=function(_0x4c1478,_0x54a18b){var _0x257661={},_0x7d10ec={},_0x5a3e03={'count':0x0,'rows':[]};var _0x12898b=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes'],function(_0xd779f1){return{'name':_0xd779f1['fieldName'],'type':_0xd779f1[_0xa57c('0x2b')]['key']};});_0x7d10ec[_0xa57c('0x2c')]=_['map'](_0x12898b,_0xa57c('0x27'));_0x7d10ec['query']=_[_0xa57c('0x2d')](_0x4c1478[_0xa57c('0x2e')]);_0x7d10ec[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x7d10ec[_0xa57c('0x2c')],_0x7d10ec[_0xa57c('0x2e')]);_0x257661[_0xa57c('0x31')]=_['intersection'](_0x7d10ec[_0xa57c('0x2c')],qs['fields'](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x257661[_0xa57c('0x31')]=_0x257661['attributes'][_0xa57c('0x33')]?_0x257661['attributes']:_0x7d10ec[_0xa57c('0x2c')];if(!_0x4c1478['query'][_0xa57c('0x34')]('nolimit')){_0x257661[_0xa57c('0x1c')]=qs[_0xa57c('0x1c')](_0x4c1478['query'][_0xa57c('0x1c')]);_0x257661['offset']=qs[_0xa57c('0x19')](_0x4c1478['query'][_0xa57c('0x19')]);}_0x257661[_0xa57c('0x35')]=qs[_0xa57c('0x36')](_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x36')]);_0x257661[_0xa57c('0x37')]=qs['filters'](_['pick'](_0x4c1478[_0xa57c('0x2e')],_0x7d10ec[_0xa57c('0x2f')]),_0x12898b);if(_0x4c1478[_0xa57c('0x2e')]['filter']){_0x257661[_0xa57c('0x37')]=_['merge'](_0x257661[_0xa57c('0x37')],{'$or':_[_0xa57c('0x29')](_0x12898b,function(_0x5c8256){if(_0x5c8256['type']!=='VIRTUAL'){var _0x3be888={};_0x3be888[_0x5c8256[_0xa57c('0x27')]]={'$like':'%'+_0x4c1478[_0xa57c('0x2e')][_0xa57c('0x38')]+'%'};return _0x3be888;}})});}_0x257661=_[_0xa57c('0x39')]({},_0x257661,_0x4c1478[_0xa57c('0x3a')]);var _0x5a444a={'where':_0x257661[_0xa57c('0x37')]};return db[_0xa57c('0x2a')]['count'](_0x5a444a)['then'](function(_0x5e10b){_0x5a3e03[_0xa57c('0x1b')]=_0x5e10b;if(_0x4c1478['query'][_0xa57c('0x3b')]){_0x257661[_0xa57c('0x3c')]=[{'all':!![]}];}return db[_0xa57c('0x2a')][_0xa57c('0x3d')](_0x257661);})[_0xa57c('0x21')](function(_0x43c1d7){_0x5a3e03['rows']=_0x43c1d7;return _0x5a3e03;})[_0xa57c('0x21')](respondWithFilteredResult(_0x54a18b,_0x257661))['catch'](handleError(_0x54a18b,null));};exports['show']=function(_0x5b3300,_0x520383){var _0x588199={'raw':![],'where':{'id':_0x5b3300[_0xa57c('0x3e')]['id']}},_0x39b20f={};_0x39b20f[_0xa57c('0x2c')]=_['keys'](db['UserProfileResource']['rawAttributes']);_0x39b20f[_0xa57c('0x2e')]=_[_0xa57c('0x2d')](_0x5b3300[_0xa57c('0x2e')]);_0x39b20f[_0xa57c('0x2f')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],_0x39b20f['query']);_0x588199[_0xa57c('0x31')]=_[_0xa57c('0x30')](_0x39b20f[_0xa57c('0x2c')],qs[_0xa57c('0x32')](_0x5b3300[_0xa57c('0x2e')][_0xa57c('0x32')]));_0x588199['attributes']=_0x588199[_0xa57c('0x31')][_0xa57c('0x33')]?_0x588199[_0xa57c('0x31')]:_0x39b20f[_0xa57c('0x2c')];if(_0x5b3300[_0xa57c('0x2e')]['includeAll']){_0x588199[_0xa57c('0x3c')]=[{'all':!![]}];}_0x588199=_[_0xa57c('0x39')]({},_0x588199,_0x5b3300[_0xa57c('0x3a')]);return db[_0xa57c('0x2a')][_0xa57c('0x3f')](_0x588199)[_0xa57c('0x21')](handleEntityNotFound(_0x520383,null))['then'](respondWithResult(_0x520383,null))[_0xa57c('0x40')](handleError(_0x520383,null));};exports[_0xa57c('0x41')]=function(_0x247906,_0x44ea0a){return db[_0xa57c('0x2a')][_0xa57c('0x41')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['UserProfileResource'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));};exports[_0xa57c('0x43')]=function(_0x5ded49,_0x5bf336){return db['UserProfileResource'][_0xa57c('0x43')]()[_0xa57c('0x21')](respondWithResult(_0x5bf336,null))[_0xa57c('0x40')](handleError(_0x5bf336,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 459d655..d2ca621 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 _0x72a6=['path','rimraf','../../config/environment','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','api','moment','bluebird','request-promise'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x72a6,0x133));var _0x672a=function(_0x3a9e3f,_0x39063f){_0x3a9e3f=_0x3a9e3f-0x0;var _0x45acac=_0x72a6[_0x3a9e3f];return _0x45acac;};'use strict';var _=require(_0x672a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x672a('0x1'));var moment=require(_0x672a('0x2'));var BPromise=require(_0x672a('0x3'));var rp=require(_0x672a('0x4'));var fs=require('fs');var path=require(_0x672a('0x5'));var rimraf=require(_0x672a('0x6'));var config=require(_0x672a('0x7'));var attributes=require(_0x672a('0x8'));module['exports']=function(_0x1d25d2,_0x559b03){return _0x1d25d2['define'](_0x672a('0x9'),attributes,{'tableName':_0x672a('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x672a('0xb'),_0x672a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b40=['compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources'];(function(_0x3f3437,_0x2f3bf2){var _0x25c956=function(_0x17ec17){while(--_0x17ec17){_0x3f3437['push'](_0x3f3437['shift']());}};_0x25c956(++_0x2f3bf2);}(_0x2b40,0xa7));var _0x02b4=function(_0x486919,_0x1ff17d){_0x486919=_0x486919-0x0;var _0x30d637=_0x2b40[_0x486919];return _0x30d637;};'use strict';var _=require(_0x02b4('0x0'));var util=require(_0x02b4('0x1'));var logger=require(_0x02b4('0x2'))(_0x02b4('0x3'));var moment=require(_0x02b4('0x4'));var BPromise=require('bluebird');var rp=require(_0x02b4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x02b4('0x6'));var config=require(_0x02b4('0x7'));var attributes=require(_0x02b4('0x8'));module[_0x02b4('0x9')]=function(_0x52039f,_0x33e39b){return _0x52039f[_0x02b4('0xa')](_0x02b4('0xb'),attributes,{'tableName':_0x02b4('0xc'),'paranoid':![],'indexes':[{'name':_0x02b4('0xd'),'fields':['resourceId',_0x02b4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 938f9a6..a653423 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 _0x7ac7=['../../config/environment','jayson/promise','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7ac7,0xf6));var _0x77ac=function(_0x4b0854,_0x1c0670){_0x4b0854=_0x4b0854-0x0;var _0x3fb913=_0x7ac7[_0x4b0854];return _0x3fb913;};'use strict';var _=require(_0x77ac('0x0'));var util=require('util');var moment=require(_0x77ac('0x1'));var BPromise=require(_0x77ac('0x2'));var rs=require(_0x77ac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77ac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77ac('0x5'))('rpc');var config=require(_0x77ac('0x6'));var jayson=require(_0x77ac('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x536b5a,_0x555dbc,_0x57fa71){return new BPromise(function(_0x3adc69,_0x1806ed){return client[_0x77ac('0x8')](_0x536b5a,_0x57fa71)[_0x77ac('0x9')](function(_0x522b19){logger[_0x77ac('0xa')](_0x77ac('0xb'),_0x555dbc,_0x77ac('0xc'));logger[_0x77ac('0xd')](_0x77ac('0xe'),_0x555dbc,_0x77ac('0xc'),JSON[_0x77ac('0xf')](_0x522b19));if(_0x522b19[_0x77ac('0x10')]){if(_0x522b19[_0x77ac('0x10')][_0x77ac('0x11')]===0x1f4){logger['error'](_0x77ac('0xb'),_0x555dbc,_0x522b19[_0x77ac('0x10')][_0x77ac('0x12')]);return _0x1806ed(_0x522b19[_0x77ac('0x10')]['message']);}logger[_0x77ac('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x555dbc,_0x522b19[_0x77ac('0x10')][_0x77ac('0x12')]);return _0x3adc69(_0x522b19[_0x77ac('0x10')][_0x77ac('0x12')]);}else{logger['info'](_0x77ac('0xb'),_0x555dbc,_0x77ac('0xc'));_0x3adc69(_0x522b19[_0x77ac('0x13')]['message']);}})[_0x77ac('0x14')](function(_0x3d7ba4){logger[_0x77ac('0x10')](_0x77ac('0xb'),_0x555dbc,_0x3d7ba4);_0x1806ed(_0x3d7ba4);});});} \ No newline at end of file +var _0xd1b3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird'];(function(_0x2d1971,_0x20b764){var _0x4d7759=function(_0x56a550){while(--_0x56a550){_0x2d1971['push'](_0x2d1971['shift']());}};_0x4d7759(++_0x20b764);}(_0xd1b3,0xef));var _0x3d1b=function(_0x28628e,_0x3dfb0e){_0x28628e=_0x28628e-0x0;var _0x24e741=_0xd1b3[_0x28628e];return _0x24e741;};'use strict';var _=require('lodash');var util=require(_0x3d1b('0x0'));var moment=require(_0x3d1b('0x1'));var BPromise=require(_0x3d1b('0x2'));var rs=require(_0x3d1b('0x3'));var fs=require('fs');var Redis=require(_0x3d1b('0x4'));var db=require(_0x3d1b('0x5'))['db'];var utils=require(_0x3d1b('0x6'));var logger=require(_0x3d1b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3d1b('0x8'));var client=jayson['client'][_0x3d1b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x357ad5,_0x315769,_0x3fadfb){return new BPromise(function(_0x79506d,_0x274815){return client[_0x3d1b('0xa')](_0x357ad5,_0x3fadfb)[_0x3d1b('0xb')](function(_0x2597a0){logger[_0x3d1b('0xc')](_0x3d1b('0xd'),_0x315769,_0x3d1b('0xe'));logger[_0x3d1b('0xf')](_0x3d1b('0x10'),_0x315769,'request\x20sent',JSON[_0x3d1b('0x11')](_0x2597a0));if(_0x2597a0['error']){if(_0x2597a0[_0x3d1b('0x12')]['code']===0x1f4){logger[_0x3d1b('0x12')](_0x3d1b('0xd'),_0x315769,_0x2597a0[_0x3d1b('0x12')][_0x3d1b('0x13')]);return _0x274815(_0x2597a0[_0x3d1b('0x12')]['message']);}logger[_0x3d1b('0x12')](_0x3d1b('0xd'),_0x315769,_0x2597a0[_0x3d1b('0x12')][_0x3d1b('0x13')]);return _0x79506d(_0x2597a0[_0x3d1b('0x12')][_0x3d1b('0x13')]);}else{logger[_0x3d1b('0xc')](_0x3d1b('0xd'),_0x315769,_0x3d1b('0xe'));_0x79506d(_0x2597a0[_0x3d1b('0x14')][_0x3d1b('0x13')]);}})[_0x3d1b('0x15')](function(_0x1e344c){logger[_0x3d1b('0x12')](_0x3d1b('0xd'),_0x315769,_0x1e344c);_0x274815(_0x1e344c);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index d4f456c..6e33897 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 _0x148a=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','isAuthenticated','/:id','show','post','create','put'];(function(_0x211bde,_0x3ef0d1){var _0x4b4023=function(_0x1490fe){while(--_0x1490fe){_0x211bde['push'](_0x211bde['shift']());}};_0x4b4023(++_0x3ef0d1);}(_0x148a,0x1bc));var _0xa148=function(_0x4cb8e7,_0x2e1d22){_0x4cb8e7=_0x4cb8e7-0x0;var _0x3d0188=_0x148a[_0x4cb8e7];return _0x3d0188;};'use strict';var multer=require(_0xa148('0x0'));var util=require(_0xa148('0x1'));var path=require(_0xa148('0x2'));var timeout=require(_0xa148('0x3'));var express=require(_0xa148('0x4'));var router=express[_0xa148('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa148('0x6'));var interaction=require(_0xa148('0x7'));var config=require(_0xa148('0x8'));var controller=require(_0xa148('0x9'));router[_0xa148('0xa')]('/',auth['isAuthenticated'](),controller[_0xa148('0xb')]);router[_0xa148('0xa')]('/describe',auth[_0xa148('0xc')](),controller['describe']);router[_0xa148('0xa')](_0xa148('0xd'),auth[_0xa148('0xc')](),controller[_0xa148('0xe')]);router[_0xa148('0xf')]('/',auth['isAuthenticated'](),controller[_0xa148('0x10')]);router[_0xa148('0x11')](_0xa148('0xd'),auth[_0xa148('0xc')](),controller[_0xa148('0x12')]);router[_0xa148('0x13')](_0xa148('0xd'),auth[_0xa148('0xc')](),controller[_0xa148('0x14')]);module[_0xa148('0x15')]=router; \ No newline at end of file +var _0x527d=['../../components/interaction/service','./userProfileSection.controller','isAuthenticated','/describe','describe','get','/:id','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x527d,0xde));var _0xd527=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0x527d[_0x14490c];return _0x2f6825;};'use strict';var multer=require('multer');var util=require(_0xd527('0x0'));var path=require(_0xd527('0x1'));var timeout=require(_0xd527('0x2'));var express=require(_0xd527('0x3'));var router=express[_0xd527('0x4')]();var fs_extra=require(_0xd527('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd527('0x6'));var config=require('../../config/environment');var controller=require(_0xd527('0x7'));router['get']('/',auth[_0xd527('0x8')](),controller['index']);router['get'](_0xd527('0x9'),auth[_0xd527('0x8')](),controller[_0xd527('0xa')]);router[_0xd527('0xb')](_0xd527('0xc'),auth[_0xd527('0x8')](),controller['show']);router['post']('/',auth[_0xd527('0x8')](),controller[_0xd527('0xd')]);router[_0xd527('0xe')](_0xd527('0xc'),auth['isAuthenticated'](),controller[_0xd527('0xf')]);router[_0xd527('0x10')](_0xd527('0xc'),auth[_0xd527('0x8')](),controller[_0xd527('0x11')]);module[_0xd527('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index e417025..27c8b1b 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 _0x57f8=['join','getDataValue','split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x57f8,0x198));var _0x857f=function(_0x546f9f,_0xcce640){_0x546f9f=_0x546f9f-0x0;var _0x3513dd=_0x57f8[_0x546f9f];return _0x3513dd;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'name':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x857f('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x857f('0x1')],'set':function(_0x6f054b){this[_0x857f('0x4')](_0x857f('0x5'),_0x6f054b?_0x6f054b[_0x857f('0x6')](''):[]);},'get':function(){return this[_0x857f('0x7')]('crudPermissions')?this[_0x857f('0x7')](_0x857f('0x5'))[_0x857f('0x8')](''):[];}}}; \ No newline at end of file +var _0x3423=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x1b5949,_0x308670){var _0x177a76=function(_0x512ef8){while(--_0x512ef8){_0x1b5949['push'](_0x1b5949['shift']());}};_0x177a76(++_0x308670);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3342('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x3342('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3342('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3342('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3342('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3342('0x0')],'set':function(_0x2207ce){this[_0x3342('0x3')](_0x3342('0x4'),_0x2207ce?_0x2207ce[_0x3342('0x5')](''):[]);},'get':function(){return this[_0x3342('0x6')](_0x3342('0x4'))?this[_0x3342('0x6')](_0x3342('0x4'))[_0x3342('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 35535c6..d6db6a0 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 _0x8da6=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','sort','where','pick','filter','merge','options','UserProfileSection','include','findAll','rows','catch','show','params','length','includeAll','find'];(function(_0x242566,_0x4ec88d){var _0x1bc410=function(_0x2996fa){while(--_0x2996fa){_0x242566['push'](_0x242566['shift']());}};_0x1bc410(++_0x4ec88d);}(_0x8da6,0x93));var _0x68da=function(_0x59634b,_0x381ed9){_0x59634b=_0x59634b-0x0;var _0x42bc2c=_0x8da6[_0x59634b];return _0x42bc2c;};'use strict';var emlformat=require(_0x68da('0x0'));var rimraf=require(_0x68da('0x1'));var zipdir=require(_0x68da('0x2'));var jsonpatch=require(_0x68da('0x3'));var rp=require('request-promise');var moment=require(_0x68da('0x4'));var BPromise=require(_0x68da('0x5'));var Mustache=require(_0x68da('0x6'));var util=require(_0x68da('0x7'));var path=require(_0x68da('0x8'));var sox=require('sox');var csv=require(_0x68da('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68da('0xa'));var _=require(_0x68da('0xb'));var squel=require(_0x68da('0xc'));var crypto=require(_0x68da('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68da('0xe'));var toCsv=require(_0x68da('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x68da('0xf'));var authService=require(_0x68da('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x68da('0x11'));var config=require(_0x68da('0x12'));var licenseUtil=require(_0x68da('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29c20a,_0x3aa2e6){_0x3aa2e6=_0x3aa2e6||0xcc;return function(_0x42e547){if(_0x42e547){return _0x29c20a[_0x68da('0x14')](_0x3aa2e6);}return _0x29c20a[_0x68da('0x15')](_0x3aa2e6)['end']();};}function respondWithResult(_0x42ff4a,_0x2a5b89){_0x2a5b89=_0x2a5b89||0xc8;return function(_0x3546b7){if(_0x3546b7){return _0x42ff4a[_0x68da('0x15')](_0x2a5b89)[_0x68da('0x16')](_0x3546b7);}};}function respondWithFilteredResult(_0x2329eb,_0x187f34){return function(_0x43f0bd){if(_0x43f0bd){var _0x41518c=typeof _0x187f34[_0x68da('0x17')]===_0x68da('0x18')&&typeof _0x187f34[_0x68da('0x19')]===_0x68da('0x18');var _0x2cda37=_0x43f0bd[_0x68da('0x1a')];var _0xb4620c=_0x41518c?0x0:_0x187f34[_0x68da('0x17')];var _0x507dd1=_0x41518c?_0x43f0bd[_0x68da('0x1a')]:_0x187f34['offset']+_0x187f34[_0x68da('0x19')];var _0x101537;if(_0x507dd1>=_0x2cda37){_0x507dd1=_0x2cda37;_0x101537=0xc8;}else{_0x101537=0xce;}_0x2329eb[_0x68da('0x15')](_0x101537);return _0x2329eb[_0x68da('0x1b')](_0x68da('0x1c'),_0xb4620c+'-'+_0x507dd1+'/'+_0x2cda37)[_0x68da('0x16')](_0x43f0bd);}return null;};}function patchUpdates(_0x2195ce){return function(_0xe8d56d){try{jsonpatch[_0x68da('0x1d')](_0xe8d56d,_0x2195ce,!![]);}catch(_0x287b7e){return BPromise[_0x68da('0x1e')](_0x287b7e);}return _0xe8d56d[_0x68da('0x1f')]();};}function saveUpdates(_0x48e93b,_0xd99317){return function(_0x7f0eff){if(_0x7f0eff){return _0x7f0eff[_0x68da('0x20')](_0x48e93b)[_0x68da('0x21')](function(_0x56a1d1){return _0x56a1d1;});}return null;};}function removeEntity(_0x3cffbe,_0x4b8712){return function(_0x2a8042){if(_0x2a8042){return _0x2a8042[_0x68da('0x22')]()[_0x68da('0x21')](function(){_0x3cffbe[_0x68da('0x15')](0xcc)[_0x68da('0x23')]();});}};}function handleEntityNotFound(_0x2982ab,_0x67519a){return function(_0x2a517d){if(!_0x2a517d){_0x2982ab['sendStatus'](0x194);}return _0x2a517d;};}function handleError(_0xbfadfe,_0x498cc3){_0x498cc3=_0x498cc3||0x1f4;return function(_0x47b7bf){logger[_0x68da('0x24')](_0x47b7bf[_0x68da('0x25')]);if(_0x47b7bf['name']){delete _0x47b7bf[_0x68da('0x26')];}_0xbfadfe['status'](_0x498cc3)[_0x68da('0x27')](_0x47b7bf);};}exports[_0x68da('0x28')]=function(_0x4225af,_0xe7f834){var _0x9e561b={},_0xf927f2={},_0x563fa8={'count':0x0,'rows':[]};var _0x153bcc=_[_0x68da('0x29')](db['UserProfileSection'][_0x68da('0x2a')],function(_0x421edf){return{'name':_0x421edf[_0x68da('0x2b')],'type':_0x421edf[_0x68da('0x2c')][_0x68da('0x2d')]};});_0xf927f2[_0x68da('0x2e')]=_[_0x68da('0x29')](_0x153bcc,'name');_0xf927f2['query']=_[_0x68da('0x2f')](_0x4225af['query']);_0xf927f2[_0x68da('0x30')]=_[_0x68da('0x31')](_0xf927f2[_0x68da('0x2e')],_0xf927f2[_0x68da('0x32')]);_0x9e561b[_0x68da('0x33')]=_[_0x68da('0x31')](_0xf927f2[_0x68da('0x2e')],qs[_0x68da('0x34')](_0x4225af[_0x68da('0x32')]['fields']));_0x9e561b[_0x68da('0x33')]=_0x9e561b[_0x68da('0x33')]['length']?_0x9e561b[_0x68da('0x33')]:_0xf927f2[_0x68da('0x2e')];if(!_0x4225af[_0x68da('0x32')]['hasOwnProperty']('nolimit')){_0x9e561b[_0x68da('0x19')]=qs[_0x68da('0x19')](_0x4225af[_0x68da('0x32')][_0x68da('0x19')]);_0x9e561b[_0x68da('0x17')]=qs[_0x68da('0x17')](_0x4225af[_0x68da('0x32')][_0x68da('0x17')]);}_0x9e561b['order']=qs[_0x68da('0x35')](_0x4225af[_0x68da('0x32')]['sort']);_0x9e561b[_0x68da('0x36')]=qs[_0x68da('0x30')](_[_0x68da('0x37')](_0x4225af[_0x68da('0x32')],_0xf927f2[_0x68da('0x30')]),_0x153bcc);if(_0x4225af[_0x68da('0x32')][_0x68da('0x38')]){_0x9e561b[_0x68da('0x36')]=_[_0x68da('0x39')](_0x9e561b[_0x68da('0x36')],{'$or':_[_0x68da('0x29')](_0x153bcc,function(_0x64c577){if(_0x64c577['type']!=='VIRTUAL'){var _0x5994a7={};_0x5994a7[_0x64c577[_0x68da('0x26')]]={'$like':'%'+_0x4225af[_0x68da('0x32')]['filter']+'%'};return _0x5994a7;}})});}_0x9e561b=_[_0x68da('0x39')]({},_0x9e561b,_0x4225af[_0x68da('0x3a')]);var _0xf222af={'where':_0x9e561b[_0x68da('0x36')]};return db[_0x68da('0x3b')][_0x68da('0x1a')](_0xf222af)[_0x68da('0x21')](function(_0x341f20){_0x563fa8['count']=_0x341f20;if(_0x4225af['query']['includeAll']){_0x9e561b[_0x68da('0x3c')]=[{'all':!![]}];}return db[_0x68da('0x3b')][_0x68da('0x3d')](_0x9e561b);})[_0x68da('0x21')](function(_0x5784e4){_0x563fa8[_0x68da('0x3e')]=_0x5784e4;return _0x563fa8;})[_0x68da('0x21')](respondWithFilteredResult(_0xe7f834,_0x9e561b))[_0x68da('0x3f')](handleError(_0xe7f834,null));};exports[_0x68da('0x40')]=function(_0x172762,_0x5ab1d9){var _0x4987e7={'raw':![],'where':{'id':_0x172762[_0x68da('0x41')]['id']}},_0x145571={};_0x145571['model']=_[_0x68da('0x2f')](db['UserProfileSection'][_0x68da('0x2a')]);_0x145571[_0x68da('0x32')]=_[_0x68da('0x2f')](_0x172762[_0x68da('0x32')]);_0x145571[_0x68da('0x30')]=_['intersection'](_0x145571[_0x68da('0x2e')],_0x145571[_0x68da('0x32')]);_0x4987e7['attributes']=_[_0x68da('0x31')](_0x145571[_0x68da('0x2e')],qs[_0x68da('0x34')](_0x172762['query'][_0x68da('0x34')]));_0x4987e7[_0x68da('0x33')]=_0x4987e7[_0x68da('0x33')][_0x68da('0x42')]?_0x4987e7['attributes']:_0x145571[_0x68da('0x2e')];if(_0x172762[_0x68da('0x32')][_0x68da('0x43')]){_0x4987e7['include']=[{'all':!![]}];}_0x4987e7=_[_0x68da('0x39')]({},_0x4987e7,_0x172762[_0x68da('0x3a')]);return db[_0x68da('0x3b')][_0x68da('0x44')](_0x4987e7)[_0x68da('0x21')](handleEntityNotFound(_0x5ab1d9,null))['then'](respondWithResult(_0x5ab1d9,null))[_0x68da('0x3f')](handleError(_0x5ab1d9,null));};exports[_0x68da('0x45')]=function(_0x5b682a,_0x2f9156){return db[_0x68da('0x3b')]['create'](_0x5b682a[_0x68da('0x46')],{})[_0x68da('0x21')](respondWithResult(_0x2f9156,0xc9))[_0x68da('0x3f')](handleError(_0x2f9156,null));};exports[_0x68da('0x20')]=function(_0x37f29e,_0x60b87a){if(_0x37f29e['body']['id']){delete _0x37f29e[_0x68da('0x46')]['id'];}return db[_0x68da('0x3b')][_0x68da('0x44')]({'where':{'id':_0x37f29e[_0x68da('0x41')]['id']}})[_0x68da('0x21')](handleEntityNotFound(_0x60b87a,null))[_0x68da('0x21')](saveUpdates(_0x37f29e[_0x68da('0x46')],null))['then'](respondWithResult(_0x60b87a,null))[_0x68da('0x3f')](handleError(_0x60b87a,null));};exports['destroy']=function(_0x3d96b9,_0x345ced){return db[_0x68da('0x3b')]['find']({'where':{'id':_0x3d96b9[_0x68da('0x41')]['id']}})[_0x68da('0x21')](handleEntityNotFound(_0x345ced,null))['then'](removeEntity(_0x345ced,null))[_0x68da('0x3f')](handleError(_0x345ced,null));};exports[_0x68da('0x47')]=function(_0x368c1b,_0x22796b){return db[_0x68da('0x3b')]['describe']()[_0x68da('0x21')](respondWithResult(_0x22796b,null))[_0x68da('0x3f')](handleError(_0x22796b,null));}; \ No newline at end of file +var _0x5185=['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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','offset','undefined','count','limit','status','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','find','create','body','params','destroy','describe','rimraf','zip-dir','request-promise','moment'];(function(_0xd59c38,_0x8e8add){var _0x36cf47=function(_0x715b94){while(--_0x715b94){_0xd59c38['push'](_0xd59c38['shift']());}};_0x36cf47(++_0x8e8add);}(_0x5185,0x173));var _0x5518=function(_0x340682,_0x2d73de){_0x340682=_0x340682-0x0;var _0x311b87=_0x5185[_0x340682];return _0x311b87;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5518('0x0'));var zipdir=require(_0x5518('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5518('0x2'));var moment=require(_0x5518('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5518('0x4'));var util=require(_0x5518('0x5'));var path=require(_0x5518('0x6'));var sox=require(_0x5518('0x7'));var csv=require(_0x5518('0x8'));var ejs=require(_0x5518('0x9'));var fs=require('fs');var fs_extra=require(_0x5518('0xa'));var _=require(_0x5518('0xb'));var squel=require(_0x5518('0xc'));var crypto=require('crypto');var jsforce=require(_0x5518('0xd'));var deskjs=require(_0x5518('0xe'));var toCsv=require(_0x5518('0x8'));var querystring=require('querystring');var Papa=require(_0x5518('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5518('0x10'));var as=require(_0x5518('0x11'));var hardwareService=require(_0x5518('0x12'));var logger=require(_0x5518('0x13'))('api');var utils=require(_0x5518('0x14'));var config=require(_0x5518('0x15'));var licenseUtil=require(_0x5518('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2371f7,_0x5ba219){_0x5ba219=_0x5ba219||0xcc;return function(_0x2f6a19){if(_0x2f6a19){return _0x2371f7[_0x5518('0x17')](_0x5ba219);}return _0x2371f7['status'](_0x5ba219)['end']();};}function respondWithResult(_0x188ca8,_0x577acc){_0x577acc=_0x577acc||0xc8;return function(_0x229939){if(_0x229939){return _0x188ca8['status'](_0x577acc)['json'](_0x229939);}};}function respondWithFilteredResult(_0x30528b,_0x1a257a){return function(_0x54bebe){if(_0x54bebe){var _0x2f125a=typeof _0x1a257a[_0x5518('0x18')]===_0x5518('0x19')&&typeof _0x1a257a['limit']===_0x5518('0x19');var _0x46410b=_0x54bebe[_0x5518('0x1a')];var _0x41599f=_0x2f125a?0x0:_0x1a257a[_0x5518('0x18')];var _0x2d19b2=_0x2f125a?_0x54bebe[_0x5518('0x1a')]:_0x1a257a[_0x5518('0x18')]+_0x1a257a[_0x5518('0x1b')];var _0x472326;if(_0x2d19b2>=_0x46410b){_0x2d19b2=_0x46410b;_0x472326=0xc8;}else{_0x472326=0xce;}_0x30528b[_0x5518('0x1c')](_0x472326);return _0x30528b['set'](_0x5518('0x1d'),_0x41599f+'-'+_0x2d19b2+'/'+_0x46410b)[_0x5518('0x1e')](_0x54bebe);}return null;};}function patchUpdates(_0x50a97f){return function(_0x3f5076){try{jsonpatch[_0x5518('0x1f')](_0x3f5076,_0x50a97f,!![]);}catch(_0x189b6f){return BPromise[_0x5518('0x20')](_0x189b6f);}return _0x3f5076[_0x5518('0x21')]();};}function saveUpdates(_0x359e1f,_0x118c5f){return function(_0x2ffd33){if(_0x2ffd33){return _0x2ffd33[_0x5518('0x22')](_0x359e1f)[_0x5518('0x23')](function(_0x14ec2f){return _0x14ec2f;});}return null;};}function removeEntity(_0x50dc36,_0x5cc0fb){return function(_0x30346a){if(_0x30346a){return _0x30346a['destroy']()[_0x5518('0x23')](function(){_0x50dc36[_0x5518('0x1c')](0xcc)[_0x5518('0x24')]();});}};}function handleEntityNotFound(_0x1b5a0d,_0x265330){return function(_0x155120){if(!_0x155120){_0x1b5a0d[_0x5518('0x17')](0x194);}return _0x155120;};}function handleError(_0xbde9ab,_0x300f6a){_0x300f6a=_0x300f6a||0x1f4;return function(_0x31ac89){logger[_0x5518('0x25')](_0x31ac89[_0x5518('0x26')]);if(_0x31ac89[_0x5518('0x27')]){delete _0x31ac89[_0x5518('0x27')];}_0xbde9ab[_0x5518('0x1c')](_0x300f6a)[_0x5518('0x28')](_0x31ac89);};}exports['index']=function(_0x32301a,_0x55420f){var _0x1dd23a={},_0x4cca8c={},_0x22c04a={'count':0x0,'rows':[]};var _0x23d4f8=_[_0x5518('0x29')](db[_0x5518('0x2a')][_0x5518('0x2b')],function(_0x12769a){return{'name':_0x12769a[_0x5518('0x2c')],'type':_0x12769a[_0x5518('0x2d')][_0x5518('0x2e')]};});_0x4cca8c[_0x5518('0x2f')]=_[_0x5518('0x29')](_0x23d4f8,'name');_0x4cca8c[_0x5518('0x30')]=_[_0x5518('0x31')](_0x32301a[_0x5518('0x30')]);_0x4cca8c['filters']=_['intersection'](_0x4cca8c['model'],_0x4cca8c[_0x5518('0x30')]);_0x1dd23a[_0x5518('0x32')]=_[_0x5518('0x33')](_0x4cca8c[_0x5518('0x2f')],qs[_0x5518('0x34')](_0x32301a[_0x5518('0x30')][_0x5518('0x34')]));_0x1dd23a[_0x5518('0x32')]=_0x1dd23a[_0x5518('0x32')][_0x5518('0x35')]?_0x1dd23a[_0x5518('0x32')]:_0x4cca8c[_0x5518('0x2f')];if(!_0x32301a[_0x5518('0x30')][_0x5518('0x36')](_0x5518('0x37'))){_0x1dd23a['limit']=qs['limit'](_0x32301a[_0x5518('0x30')][_0x5518('0x1b')]);_0x1dd23a[_0x5518('0x18')]=qs['offset'](_0x32301a['query'][_0x5518('0x18')]);}_0x1dd23a[_0x5518('0x38')]=qs['sort'](_0x32301a[_0x5518('0x30')][_0x5518('0x39')]);_0x1dd23a['where']=qs[_0x5518('0x3a')](_['pick'](_0x32301a[_0x5518('0x30')],_0x4cca8c['filters']),_0x23d4f8);if(_0x32301a[_0x5518('0x30')][_0x5518('0x3b')]){_0x1dd23a[_0x5518('0x3c')]=_[_0x5518('0x3d')](_0x1dd23a[_0x5518('0x3c')],{'$or':_[_0x5518('0x29')](_0x23d4f8,function(_0x2f0960){if(_0x2f0960['type']!==_0x5518('0x3e')){var _0x4ac7c3={};_0x4ac7c3[_0x2f0960[_0x5518('0x27')]]={'$like':'%'+_0x32301a[_0x5518('0x30')][_0x5518('0x3b')]+'%'};return _0x4ac7c3;}})});}_0x1dd23a=_['merge']({},_0x1dd23a,_0x32301a[_0x5518('0x3f')]);var _0x426baf={'where':_0x1dd23a[_0x5518('0x3c')]};return db['UserProfileSection']['count'](_0x426baf)[_0x5518('0x23')](function(_0x433797){_0x22c04a[_0x5518('0x1a')]=_0x433797;if(_0x32301a[_0x5518('0x30')]['includeAll']){_0x1dd23a['include']=[{'all':!![]}];}return db[_0x5518('0x2a')][_0x5518('0x40')](_0x1dd23a);})[_0x5518('0x23')](function(_0x35da85){_0x22c04a[_0x5518('0x41')]=_0x35da85;return _0x22c04a;})[_0x5518('0x23')](respondWithFilteredResult(_0x55420f,_0x1dd23a))[_0x5518('0x42')](handleError(_0x55420f,null));};exports[_0x5518('0x43')]=function(_0x1c05e6,_0x3c5436){var _0x581ece={'raw':![],'where':{'id':_0x1c05e6['params']['id']}},_0xed5421={};_0xed5421['model']=_[_0x5518('0x31')](db[_0x5518('0x2a')][_0x5518('0x2b')]);_0xed5421[_0x5518('0x30')]=_['keys'](_0x1c05e6[_0x5518('0x30')]);_0xed5421['filters']=_[_0x5518('0x33')](_0xed5421['model'],_0xed5421[_0x5518('0x30')]);_0x581ece[_0x5518('0x32')]=_[_0x5518('0x33')](_0xed5421[_0x5518('0x2f')],qs[_0x5518('0x34')](_0x1c05e6[_0x5518('0x30')][_0x5518('0x34')]));_0x581ece[_0x5518('0x32')]=_0x581ece['attributes']['length']?_0x581ece[_0x5518('0x32')]:_0xed5421['model'];if(_0x1c05e6[_0x5518('0x30')][_0x5518('0x44')]){_0x581ece['include']=[{'all':!![]}];}_0x581ece=_[_0x5518('0x3d')]({},_0x581ece,_0x1c05e6[_0x5518('0x3f')]);return db[_0x5518('0x2a')][_0x5518('0x45')](_0x581ece)['then'](handleEntityNotFound(_0x3c5436,null))[_0x5518('0x23')](respondWithResult(_0x3c5436,null))['catch'](handleError(_0x3c5436,null));};exports[_0x5518('0x46')]=function(_0x43c13c,_0x13a42e){return db['UserProfileSection'][_0x5518('0x46')](_0x43c13c[_0x5518('0x47')],{})[_0x5518('0x23')](respondWithResult(_0x13a42e,0xc9))[_0x5518('0x42')](handleError(_0x13a42e,null));};exports[_0x5518('0x22')]=function(_0x5b86dd,_0x145ba3){if(_0x5b86dd[_0x5518('0x47')]['id']){delete _0x5b86dd['body']['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x5b86dd[_0x5518('0x48')]['id']}})[_0x5518('0x23')](handleEntityNotFound(_0x145ba3,null))['then'](saveUpdates(_0x5b86dd[_0x5518('0x47')],null))[_0x5518('0x23')](respondWithResult(_0x145ba3,null))[_0x5518('0x42')](handleError(_0x145ba3,null));};exports[_0x5518('0x49')]=function(_0x5e9b8e,_0x2b6c3d){return db['UserProfileSection'][_0x5518('0x45')]({'where':{'id':_0x5e9b8e[_0x5518('0x48')]['id']}})[_0x5518('0x23')](handleEntityNotFound(_0x2b6c3d,null))['then'](removeEntity(_0x2b6c3d,null))[_0x5518('0x42')](handleError(_0x2b6c3d,null));};exports['describe']=function(_0x465a78,_0x1e6462){return db[_0x5518('0x2a')][_0x5518('0x4a')]()[_0x5518('0x23')](respondWithResult(_0x1e6462,null))[_0x5518('0x42')](handleError(_0x1e6462,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index fe8e1ca..0f45769 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 _0x1aa5=['rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','../../config/logger','api','request-promise','path'];(function(_0x2c6dd4,_0x4bd67d){var _0x19eb1e=function(_0x5d6d4f){while(--_0x5d6d4f){_0x2c6dd4['push'](_0x2c6dd4['shift']());}};_0x19eb1e(++_0x4bd67d);}(_0x1aa5,0x18e));var _0x51aa=function(_0x2c9b2f,_0x4dfc33){_0x2c9b2f=_0x2c9b2f-0x0;var _0x3977ed=_0x1aa5[_0x2c9b2f];return _0x3977ed;};'use strict';var _=require(_0x51aa('0x0'));var util=require('util');var logger=require(_0x51aa('0x1'))(_0x51aa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x51aa('0x3'));var fs=require('fs');var path=require(_0x51aa('0x4'));var rimraf=require(_0x51aa('0x5'));var config=require('../../config/environment');var attributes=require(_0x51aa('0x6'));module[_0x51aa('0x7')]=function(_0x1cd71b,_0x18716a){return _0x1cd71b[_0x51aa('0x8')](_0x51aa('0x9'),attributes,{'tableName':_0x51aa('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x51aa('0xb'),_0x51aa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x300b=['user_profile_has_sections','compositeIndex','sectionId','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0xa19fb2,_0x3e6556){var _0x4f5c6b=function(_0x3a32b3){while(--_0x3a32b3){_0xa19fb2['push'](_0xa19fb2['shift']());}};_0x4f5c6b(++_0x3e6556);}(_0x300b,0x1f1));var _0xb300=function(_0x11b149,_0x5e3ea7){_0x11b149=_0x11b149-0x0;var _0x39fc54=_0x300b[_0x11b149];return _0x39fc54;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb300('0x0'))(_0xb300('0x1'));var moment=require(_0xb300('0x2'));var BPromise=require(_0xb300('0x3'));var rp=require(_0xb300('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb300('0x5'));var config=require(_0xb300('0x6'));var attributes=require(_0xb300('0x7'));module[_0xb300('0x8')]=function(_0x4dc3b6,_0x26fcac){return _0x4dc3b6[_0xb300('0x9')]('UserProfileSection',attributes,{'tableName':_0xb300('0xa'),'paranoid':![],'indexes':[{'name':_0xb300('0xb'),'fields':[_0xb300('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index d1fecb4..21988a5 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 _0xd98b=['error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x15d774,_0x4776aa){var _0x5323cb=function(_0x5418fd){while(--_0x5418fd){_0x15d774['push'](_0x15d774['shift']());}};_0x5323cb(++_0x4776aa);}(_0xd98b,0x1d1));var _0xbd98=function(_0x23dda5,_0x221860){_0x23dda5=_0x23dda5-0x0;var _0x32c24e=_0xd98b[_0x23dda5];return _0x32c24e;};'use strict';var _=require(_0xbd98('0x0'));var util=require('util');var moment=require(_0xbd98('0x1'));var BPromise=require(_0xbd98('0x2'));var rs=require(_0xbd98('0x3'));var fs=require('fs');var Redis=require(_0xbd98('0x4'));var db=require(_0xbd98('0x5'))['db'];var utils=require(_0xbd98('0x6'));var logger=require(_0xbd98('0x7'))(_0xbd98('0x8'));var config=require(_0xbd98('0x9'));var jayson=require(_0xbd98('0xa'));var client=jayson[_0xbd98('0xb')][_0xbd98('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1fdd91,_0x42c5f2,_0x18c8da){return new BPromise(function(_0x5ebff7,_0x203be0){return client['request'](_0x1fdd91,_0x18c8da)[_0xbd98('0xd')](function(_0x49f491){logger['info'](_0xbd98('0xe'),_0x42c5f2,_0xbd98('0xf'));logger[_0xbd98('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x42c5f2,'request\x20sent',JSON[_0xbd98('0x11')](_0x49f491));if(_0x49f491[_0xbd98('0x12')]){if(_0x49f491[_0xbd98('0x12')][_0xbd98('0x13')]===0x1f4){logger[_0xbd98('0x12')](_0xbd98('0xe'),_0x42c5f2,_0x49f491[_0xbd98('0x12')][_0xbd98('0x14')]);return _0x203be0(_0x49f491[_0xbd98('0x12')][_0xbd98('0x14')]);}logger[_0xbd98('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x42c5f2,_0x49f491[_0xbd98('0x12')][_0xbd98('0x14')]);return _0x5ebff7(_0x49f491[_0xbd98('0x12')][_0xbd98('0x14')]);}else{logger[_0xbd98('0x15')]('UserProfileSection,\x20%s,\x20%s',_0x42c5f2,_0xbd98('0xf'));_0x5ebff7(_0x49f491['result'][_0xbd98('0x14')]);}})[_0xbd98('0x16')](function(_0x4b4dd5){logger[_0xbd98('0x12')](_0xbd98('0xe'),_0x42c5f2,_0x4b4dd5);_0x203be0(_0x4b4dd5);});});} \ No newline at end of file +var _0xb2c0=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x367f92,_0x2f5967){var _0x4376a7=function(_0x25c373){while(--_0x25c373){_0x367f92['push'](_0x367f92['shift']());}};_0x4376a7(++_0x2f5967);}(_0xb2c0,0x110));var _0x0b2c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb2c0[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x0b2c('0x0'));var util=require('util');var moment=require(_0x0b2c('0x1'));var BPromise=require('bluebird');var rs=require(_0x0b2c('0x2'));var fs=require('fs');var Redis=require(_0x0b2c('0x3'));var db=require(_0x0b2c('0x4'))['db'];var utils=require(_0x0b2c('0x5'));var logger=require(_0x0b2c('0x6'))(_0x0b2c('0x7'));var config=require(_0x0b2c('0x8'));var jayson=require(_0x0b2c('0x9'));var client=jayson[_0x0b2c('0xa')][_0x0b2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16abf0,_0x31b11e,_0x3a4a11){return new BPromise(function(_0x196d73,_0x3f137a){return client['request'](_0x16abf0,_0x3a4a11)[_0x0b2c('0xc')](function(_0x3c44e4){logger['info'](_0x0b2c('0xd'),_0x31b11e,_0x0b2c('0xe'));logger[_0x0b2c('0xf')](_0x0b2c('0x10'),_0x31b11e,_0x0b2c('0xe'),JSON[_0x0b2c('0x11')](_0x3c44e4));if(_0x3c44e4[_0x0b2c('0x12')]){if(_0x3c44e4[_0x0b2c('0x12')]['code']===0x1f4){logger[_0x0b2c('0x12')](_0x0b2c('0xd'),_0x31b11e,_0x3c44e4['error'][_0x0b2c('0x13')]);return _0x3f137a(_0x3c44e4[_0x0b2c('0x12')][_0x0b2c('0x13')]);}logger[_0x0b2c('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x31b11e,_0x3c44e4[_0x0b2c('0x12')][_0x0b2c('0x13')]);return _0x196d73(_0x3c44e4[_0x0b2c('0x12')][_0x0b2c('0x13')]);}else{logger[_0x0b2c('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x31b11e,_0x0b2c('0xe'));_0x196d73(_0x3c44e4[_0x0b2c('0x15')]['message']);}})[_0x0b2c('0x16')](function(_0x5ec12e){logger[_0x0b2c('0x12')](_0x0b2c('0xd'),_0x31b11e,_0x5ec12e);_0x3f137a(_0x5ec12e);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 14b5802..6705025 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1d4a4b,_0x1ea49d){var _0x5852fa=function(_0x23b450){while(--_0x23b450){_0x1d4a4b['push'](_0x1d4a4b['shift']());}};_0x5852fa(++_0x1ea49d);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4cdf87,_0x200caf){var _0x14d49d=function(_0xf7eced){while(--_0xf7eced){_0x4cdf87['push'](_0x4cdf87['shift']());}};_0x14d49d(++_0x200caf);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index d950be0..d995f74 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54c0=['exports'];(function(_0xda1f6d,_0x10edbd){var _0x584a74=function(_0x3ba906){while(--_0x3ba906){_0xda1f6d['push'](_0xda1f6d['shift']());}};_0x584a74(++_0x10edbd);}(_0x54c0,0x1ee));var _0x054c=function(_0x356592,_0xd5d018){_0x356592=_0x356592-0x0;var _0x5c7231=_0x54c0[_0x356592];return _0x5c7231;};'use strict';var Sequelize=require('sequelize');module[_0x054c('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x174e=['INTEGER','sequelize','exports'];(function(_0x3f28a8,_0x447a45){var _0x2e735b=function(_0x1bdcb6){while(--_0x1bdcb6){_0x3f28a8['push'](_0x3f28a8['shift']());}};_0x2e735b(++_0x447a45);}(_0x174e,0x19c));var _0xe174=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x174e[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xe174('0x0'));module[_0xe174('0x1')]={'penalty':{'type':Sequelize[_0xe174('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 760dd10..121346b 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 _0x32f4=['./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x32f4,0x154));var _0x432f=function(_0x1cd2bf,_0x5bee46){_0x1cd2bf=_0x1cd2bf-0x0;var _0x32cd77=_0x32f4[_0x1cd2bf];return _0x32cd77;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var logger=require(_0x432f('0x2'))(_0x432f('0x3'));var moment=require('moment');var BPromise=require(_0x432f('0x4'));var rp=require(_0x432f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var attributes=require(_0x432f('0x8'));module[_0x432f('0x9')]=function(_0x2f5f03,_0x5d8cc0){return _0x2f5f03['define'](_0x432f('0xa'),attributes,{'tableName':_0x432f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x430c=['user_has_sms_queues','lodash','api','moment','bluebird','./userSmsQueue.attributes','exports','UserSmsQueue'];(function(_0xb03f9,_0x588391){var _0x3ec30a=function(_0x3ef5e7){while(--_0x3ef5e7){_0xb03f9['push'](_0xb03f9['shift']());}};_0x3ec30a(++_0x588391);}(_0x430c,0x1a1));var _0xc430=function(_0x12d951,_0x249808){_0x12d951=_0x12d951-0x0;var _0x44de17=_0x430c[_0x12d951];return _0x44de17;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));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(_0xc430('0x4'));module[_0xc430('0x5')]=function(_0x50b256,_0x42aa9c){return _0x50b256['define'](_0xc430('0x6'),attributes,{'tableName':_0xc430('0x7'),'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 aacdcf5..cccefa7 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 _0xbf17=['jayson/promise','client','http','request','then','info','request\x20sent','debug','error','UserSmsQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xbf17,0xfe));var _0x7bf1=function(_0x2bcf61,_0x545461){_0x2bcf61=_0x2bcf61-0x0;var _0x4ac271=_0xbf17[_0x2bcf61];return _0x4ac271;};'use strict';var _=require(_0x7bf1('0x0'));var util=require(_0x7bf1('0x1'));var moment=require(_0x7bf1('0x2'));var BPromise=require(_0x7bf1('0x3'));var rs=require(_0x7bf1('0x4'));var fs=require('fs');var Redis=require(_0x7bf1('0x5'));var db=require(_0x7bf1('0x6'))['db'];var utils=require(_0x7bf1('0x7'));var logger=require(_0x7bf1('0x8'))(_0x7bf1('0x9'));var config=require('../../config/environment');var jayson=require(_0x7bf1('0xa'));var client=jayson[_0x7bf1('0xb')][_0x7bf1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58eab4,_0x268277,_0x39c020){return new BPromise(function(_0x409416,_0x2e034b){return client[_0x7bf1('0xd')](_0x58eab4,_0x39c020)[_0x7bf1('0xe')](function(_0x13e2b2){logger[_0x7bf1('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x268277,_0x7bf1('0x10'));logger[_0x7bf1('0x11')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x268277,_0x7bf1('0x10'),JSON['stringify'](_0x13e2b2));if(_0x13e2b2[_0x7bf1('0x12')]){if(_0x13e2b2[_0x7bf1('0x12')]['code']===0x1f4){logger[_0x7bf1('0x12')](_0x7bf1('0x13'),_0x268277,_0x13e2b2['error'][_0x7bf1('0x14')]);return _0x2e034b(_0x13e2b2[_0x7bf1('0x12')][_0x7bf1('0x14')]);}logger[_0x7bf1('0x12')](_0x7bf1('0x13'),_0x268277,_0x13e2b2[_0x7bf1('0x12')][_0x7bf1('0x14')]);return _0x409416(_0x13e2b2[_0x7bf1('0x12')][_0x7bf1('0x14')]);}else{logger['info'](_0x7bf1('0x13'),_0x268277,_0x7bf1('0x10'));_0x409416(_0x13e2b2['result']['message']);}})[_0x7bf1('0x15')](function(_0x4d40d8){logger['error'](_0x7bf1('0x13'),_0x268277,_0x4d40d8);_0x2e034b(_0x4d40d8);});});} \ No newline at end of file +var _0xa7dc=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0xa7dc,0x181));var _0xca7d=function(_0x595be1,_0x58ef55){_0x595be1=_0x595be1-0x0;var _0xc2c999=_0xa7dc[_0x595be1];return _0xc2c999;};'use strict';var _=require(_0xca7d('0x0'));var util=require(_0xca7d('0x1'));var moment=require(_0xca7d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca7d('0x3'));var db=require(_0xca7d('0x4'))['db'];var utils=require(_0xca7d('0x5'));var logger=require(_0xca7d('0x6'))('rpc');var config=require(_0xca7d('0x7'));var jayson=require(_0xca7d('0x8'));var client=jayson[_0xca7d('0x9')][_0xca7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f1ede,_0x419def,_0x5d1a8d){return new BPromise(function(_0x16d468,_0x3343c7){return client[_0xca7d('0xb')](_0x5f1ede,_0x5d1a8d)[_0xca7d('0xc')](function(_0x1c7c63){logger[_0xca7d('0xd')](_0xca7d('0xe'),_0x419def,_0xca7d('0xf'));logger[_0xca7d('0x10')](_0xca7d('0x11'),_0x419def,_0xca7d('0xf'),JSON['stringify'](_0x1c7c63));if(_0x1c7c63['error']){if(_0x1c7c63[_0xca7d('0x12')]['code']===0x1f4){logger[_0xca7d('0x12')](_0xca7d('0xe'),_0x419def,_0x1c7c63[_0xca7d('0x12')]['message']);return _0x3343c7(_0x1c7c63[_0xca7d('0x12')][_0xca7d('0x13')]);}logger[_0xca7d('0x12')](_0xca7d('0xe'),_0x419def,_0x1c7c63[_0xca7d('0x12')]['message']);return _0x16d468(_0x1c7c63[_0xca7d('0x12')][_0xca7d('0x13')]);}else{logger[_0xca7d('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x419def,_0xca7d('0xf'));_0x16d468(_0x1c7c63[_0xca7d('0x14')][_0xca7d('0x13')]);}})['catch'](function(_0x46f168){logger[_0xca7d('0x12')](_0xca7d('0xe'),_0x419def,_0x46f168);_0x3343c7(_0x46f168);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index f12343e..b8b4911 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf15=['sequelize','exports','INTEGER'];(function(_0x416586,_0xbdf0b1){var _0x5cbb10=function(_0x274854){while(--_0x274854){_0x416586['push'](_0x416586['shift']());}};_0x5cbb10(++_0xbdf0b1);}(_0xdf15,0x7b));var _0x5df1=function(_0x1e2c38,_0x5a42de){_0x1e2c38=_0x1e2c38-0x0;var _0x45bfd0=_0xdf15[_0x1e2c38];return _0x45bfd0;};'use strict';var Sequelize=require(_0x5df1('0x0'));module[_0x5df1('0x1')]={'UserId':{'type':Sequelize[_0x5df1('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x5df1('0x2')]}}; \ No newline at end of file +var _0xed3b=['sequelize','exports','INTEGER'];(function(_0x497ce,_0x16cdab){var _0x241e12=function(_0x5e250c){while(--_0x5e250c){_0x497ce['push'](_0x497ce['shift']());}};_0x241e12(++_0x16cdab);}(_0xed3b,0x9f));var _0xbed3=function(_0x3eb694,_0x3f8832){_0x3eb694=_0x3eb694-0x0;var _0x37bf87=_0xed3b[_0x3eb694];return _0x37bf87;};'use strict';var Sequelize=require(_0xbed3('0x0'));module[_0xbed3('0x1')]={'UserId':{'type':Sequelize[_0xbed3('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xbed3('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 19965b4..9665335 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x510938,_0x2b9b26){var _0x815ac7=function(_0x2cf7d9){while(--_0x2cf7d9){_0x510938['push'](_0x510938['shift']());}};_0x815ac7(++_0x2b9b26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1a2880,_0x4d7731){var _0x556537=function(_0xfc3868){while(--_0xfc3868){_0x1a2880['push'](_0x1a2880['shift']());}};_0x556537(++_0x4d7731);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 74d0eab..655e58d 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(_0x124948,_0x2357be){var _0x42ef39=function(_0x289f3c){while(--_0x289f3c){_0x124948['push'](_0x124948['shift']());}};_0x42ef39(++_0x2357be);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0xcb91[_0x2f3ecd];return _0xffdc44;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x40889c,_0x73e154){var _0x1e69a3=function(_0x365601){while(--_0x365601){_0x40889c['push'](_0x40889c['shift']());}};_0x1e69a3(++_0x73e154);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 4ccf968..9b6ecc5 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 _0x11a1=['sequelize','exports','INTEGER'];(function(_0x2f7b20,_0x522e1c){var _0x2b2865=function(_0xb25d04){while(--_0xb25d04){_0x2f7b20['push'](_0x2f7b20['shift']());}};_0x2b2865(++_0x522e1c);}(_0x11a1,0xbd));var _0x111a=function(_0x3e3108,_0x600886){_0x3e3108=_0x3e3108-0x0;var _0x5db508=_0x11a1[_0x3e3108];return _0x5db508;};'use strict';var Sequelize=require(_0x111a('0x0'));module[_0x111a('0x1')]={'penalty':{'type':Sequelize[_0x111a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xca35=['INTEGER','sequelize','exports'];(function(_0x32115e,_0x243452){var _0x5684d3=function(_0x585aba){while(--_0x585aba){_0x32115e['push'](_0x32115e['shift']());}};_0x5684d3(++_0x243452);}(_0xca35,0xee));var _0x5ca3=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0xca35[_0x261e29];return _0x25ef43;};'use strict';var Sequelize=require(_0x5ca3('0x0'));module[_0x5ca3('0x1')]={'penalty':{'type':Sequelize[_0x5ca3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 4665dbd..356fe5d 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 _0x59e8=['request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','bluebird'];(function(_0x5dae50,_0x5433c1){var _0x4ac351=function(_0xa4eb94){while(--_0xa4eb94){_0x5dae50['push'](_0x5dae50['shift']());}};_0x4ac351(++_0x5433c1);}(_0x59e8,0x1e5));var _0x859e=function(_0x14ad77,_0xb5c484){_0x14ad77=_0x14ad77-0x0;var _0x47d4a6=_0x59e8[_0x14ad77];return _0x47d4a6;};'use strict';var _=require(_0x859e('0x0'));var util=require(_0x859e('0x1'));var logger=require('../../config/logger')(_0x859e('0x2'));var moment=require(_0x859e('0x3'));var BPromise=require(_0x859e('0x4'));var rp=require(_0x859e('0x5'));var fs=require('fs');var path=require(_0x859e('0x6'));var rimraf=require(_0x859e('0x7'));var config=require(_0x859e('0x8'));var attributes=require(_0x859e('0x9'));module[_0x859e('0xa')]=function(_0x4d73d1,_0x25f9af){return _0x4d73d1[_0x859e('0xb')](_0x859e('0xc'),attributes,{'tableName':_0x859e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69cb=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','util'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0x69cb,0x10d));var _0xb69c=function(_0xd73239,_0x488346){_0xd73239=_0xd73239-0x0;var _0x41cee6=_0x69cb[_0xd73239];return _0x41cee6;};'use strict';var _=require('lodash');var util=require(_0xb69c('0x0'));var logger=require(_0xb69c('0x1'))(_0xb69c('0x2'));var moment=require('moment');var BPromise=require(_0xb69c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb69c('0x4'));var rimraf=require(_0xb69c('0x5'));var config=require(_0xb69c('0x6'));var attributes=require(_0xb69c('0x7'));module[_0xb69c('0x8')]=function(_0x29e501,_0x10caba){return _0x29e501[_0xb69c('0x9')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 5daf48e..399d535 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 _0x9567=['request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','UserVoiceQueue,\x20%s,\x20%s'];(function(_0x10c4d6,_0x1cd56c){var _0x3a4a5f=function(_0x18c39f){while(--_0x18c39f){_0x10c4d6['push'](_0x10c4d6['shift']());}};_0x3a4a5f(++_0x1cd56c);}(_0x9567,0x105));var _0x7956=function(_0x5d8061,_0x559e4d){_0x5d8061=_0x5d8061-0x0;var _0x3d5c83=_0x9567[_0x5d8061];return _0x3d5c83;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var moment=require(_0x7956('0x2'));var BPromise=require(_0x7956('0x3'));var rs=require(_0x7956('0x4'));var fs=require('fs');var Redis=require(_0x7956('0x5'));var db=require(_0x7956('0x6'))['db'];var utils=require(_0x7956('0x7'));var logger=require(_0x7956('0x8'))(_0x7956('0x9'));var config=require('../../config/environment');var jayson=require(_0x7956('0xa'));var client=jayson[_0x7956('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23614d,_0x46272a,_0x1c92cb){return new BPromise(function(_0x5de1c5,_0xdde7ca){return client[_0x7956('0xc')](_0x23614d,_0x1c92cb)['then'](function(_0xe3827b){logger[_0x7956('0xd')](_0x7956('0xe'),_0x46272a,_0x7956('0xf'));logger['debug'](_0x7956('0x10'),_0x46272a,'request\x20sent',JSON[_0x7956('0x11')](_0xe3827b));if(_0xe3827b['error']){if(_0xe3827b[_0x7956('0x12')][_0x7956('0x13')]===0x1f4){logger[_0x7956('0x12')](_0x7956('0xe'),_0x46272a,_0xe3827b[_0x7956('0x12')]['message']);return _0xdde7ca(_0xe3827b[_0x7956('0x12')][_0x7956('0x14')]);}logger[_0x7956('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x46272a,_0xe3827b[_0x7956('0x12')][_0x7956('0x14')]);return _0x5de1c5(_0xe3827b[_0x7956('0x12')][_0x7956('0x14')]);}else{logger[_0x7956('0xd')](_0x7956('0xe'),_0x46272a,_0x7956('0xf'));_0x5de1c5(_0xe3827b[_0x7956('0x15')][_0x7956('0x14')]);}})[_0x7956('0x16')](function(_0x1466bc){logger['error'](_0x7956('0xe'),_0x46272a,_0x1466bc);_0xdde7ca(_0x1466bc);});});} \ No newline at end of file +var _0x8a89=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x4c3493,_0x1e0333){var _0x3f3716=function(_0x21fc23){while(--_0x21fc23){_0x4c3493['push'](_0x4c3493['shift']());}};_0x3f3716(++_0x1e0333);}(_0x8a89,0x19e));var _0x98a8=function(_0x51d71a,_0x596fda){_0x51d71a=_0x51d71a-0x0;var _0xff01f1=_0x8a89[_0x51d71a];return _0xff01f1;};'use strict';var _=require(_0x98a8('0x0'));var util=require(_0x98a8('0x1'));var moment=require(_0x98a8('0x2'));var BPromise=require(_0x98a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98a8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x98a8('0x5'));var logger=require('../../config/logger')(_0x98a8('0x6'));var config=require(_0x98a8('0x7'));var jayson=require(_0x98a8('0x8'));var client=jayson['client'][_0x98a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40ca98,_0x1fb240,_0xfc352a){return new BPromise(function(_0x185d31,_0x508604){return client['request'](_0x40ca98,_0xfc352a)['then'](function(_0x575a9c){logger[_0x98a8('0xa')](_0x98a8('0xb'),_0x1fb240,_0x98a8('0xc'));logger[_0x98a8('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1fb240,'request\x20sent',JSON[_0x98a8('0xe')](_0x575a9c));if(_0x575a9c['error']){if(_0x575a9c[_0x98a8('0xf')][_0x98a8('0x10')]===0x1f4){logger[_0x98a8('0xf')](_0x98a8('0xb'),_0x1fb240,_0x575a9c[_0x98a8('0xf')]['message']);return _0x508604(_0x575a9c[_0x98a8('0xf')][_0x98a8('0x11')]);}logger['error'](_0x98a8('0xb'),_0x1fb240,_0x575a9c[_0x98a8('0xf')][_0x98a8('0x11')]);return _0x185d31(_0x575a9c['error'][_0x98a8('0x11')]);}else{logger[_0x98a8('0xa')](_0x98a8('0xb'),_0x1fb240,_0x98a8('0xc'));_0x185d31(_0x575a9c['result']['message']);}})[_0x98a8('0x12')](function(_0x4e115a){logger[_0x98a8('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x1fb240,_0x4e115a);_0x508604(_0x4e115a);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index dc796d7..3c65a1c 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1f7c3c,_0xd778bc){var _0x13553e=function(_0x57db34){while(--_0x57db34){_0x1f7c3c['push'](_0x1f7c3c['shift']());}};_0x13553e(++_0xd778bc);}(_0xe706,0xa3));var _0x6e70=function(_0x3e4bd5,_0x1191df){_0x3e4bd5=_0x3e4bd5-0x0;var _0x261d71=_0xe706[_0x3e4bd5];return _0x261d71;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x59c24f,_0x54cd2e){var _0x571d24=function(_0x86db99){while(--_0x86db99){_0x59c24f['push'](_0x59c24f['shift']());}};_0x571d24(++_0x54cd2e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0xcb91[_0x5c768b];return _0x335af8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index b555089..db6f8bb 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 _0x9be3=['sequelize','exports','Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface'];(function(_0x178993,_0x298709){var _0x1d6301=function(_0x8fb46a){while(--_0x8fb46a){_0x178993['push'](_0x178993['shift']());}};_0x1d6301(++_0x298709);}(_0x9be3,0xd2));var _0x39be=function(_0x6f4046,_0x133bc9){_0x6f4046=_0x6f4046-0x0;var _0x35e23f=_0x9be3[_0x6f4046];return _0x35e23f;};'use strict';var Sequelize=require(_0x39be('0x0'));module[_0x39be('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x39be('0x2')},'membername':{'type':Sequelize[_0x39be('0x3')],'allowNull':![],'comment':_0x39be('0x2')},'UserId':{'type':Sequelize[_0x39be('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x39be('0x3')],'allowNull':![],'unique':_0x39be('0x5'),'comment':_0x39be('0x2')},'VoiceQueueId':{'type':Sequelize[_0x39be('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x39be('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x39be('0x2')},'penalty':{'type':Sequelize[_0x39be('0x4')](0xb),'defaultValue':0x0,'comment':_0x39be('0x2')},'paused':{'type':Sequelize[_0x39be('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x86d8=['queue_interface','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x1a2928,_0x25354d){var _0xb97b12=function(_0x518818){while(--_0x518818){_0x1a2928['push'](_0x1a2928['shift']());}};_0xb97b12(++_0x25354d);}(_0x86d8,0x101));var _0x886d=function(_0x3e860a,_0x1816bd){_0x3e860a=_0x3e860a-0x0;var _0x53842a=_0x86d8[_0x3e860a];return _0x53842a;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x886d('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x886d('0x1')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x886d('0x1')},'UserId':{'type':Sequelize[_0x886d('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x886d('0x2')],'allowNull':![],'unique':'queue_interface','comment':_0x886d('0x1')},'VoiceQueueId':{'type':Sequelize[_0x886d('0x0')],'allowNull':![]},'interface':{'type':Sequelize[_0x886d('0x2')],'allowNull':![],'unique':_0x886d('0x3'),'comment':_0x886d('0x1')},'penalty':{'type':Sequelize[_0x886d('0x0')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x886d('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f763668..5fcca7e 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 _0xa578=['hook','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x2f88d7,_0x46472d){var _0x21f0e1=function(_0x280189){while(--_0x280189){_0x2f88d7['push'](_0x2f88d7['shift']());}};_0x21f0e1(++_0x46472d);}(_0xa578,0xa9));var _0x8a57=function(_0x959a68,_0x2ad3f0){_0x959a68=_0x959a68-0x0;var _0x2997c0=_0xa578[_0x959a68];return _0x2997c0;};'use strict';var EventEmitter=require(_0x8a57('0x0'));var UserVoiceQueueRt=require(_0x8a57('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a57('0x2'),'afterUpdate':_0x8a57('0x3'),'afterDestroy':_0x8a57('0x4')};function emitEvent(_0x454c5f){return function(_0x5bf866,_0x15a5aa,_0x4380f7){UserVoiceQueueRtEvents[_0x8a57('0x5')](_0x454c5f+':'+_0x5bf866['id'],_0x5bf866);UserVoiceQueueRtEvents['emit'](_0x454c5f,_0x5bf866);_0x4380f7(null);};}for(var e in events){if(events[_0x8a57('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x8a57('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x430f=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x5bf2a6,_0x96d3b8){var _0x284505=function(_0x55febe){while(--_0x55febe){_0x5bf2a6['push'](_0x5bf2a6['shift']());}};_0x284505(++_0x96d3b8);}(_0x430f,0xc8));var _0xf430=function(_0x32b8fa,_0x540cbb){_0x32b8fa=_0x32b8fa-0x0;var _0x84840b=_0x430f[_0x32b8fa];return _0x84840b;};'use strict';var EventEmitter=require(_0xf430('0x0'));var UserVoiceQueueRt=require(_0xf430('0x1'))['db'][_0xf430('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf430('0x3')](0x0);var events={'afterCreate':_0xf430('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x417ede){return function(_0x248e19,_0x716479,_0x299b84){UserVoiceQueueRtEvents[_0xf430('0x5')](_0x417ede+':'+_0x248e19['id'],_0x248e19);UserVoiceQueueRtEvents[_0xf430('0x5')](_0x417ede,_0x248e19);_0x299b84(null);};}for(var e in events){if(events[_0xf430('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xf430('0x7')](e,emitEvent(event));}}module[_0xf430('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 2e3a602..7f2f75a 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 _0x723a=['util','../../config/logger','api','moment','request-promise','path','rimraf','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0x3af728,_0x55c8c4){var _0x3b08b8=function(_0x5efc38){while(--_0x5efc38){_0x3af728['push'](_0x3af728['shift']());}};_0x3b08b8(++_0x55c8c4);}(_0x723a,0x78));var _0xa723=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x723a[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0xa723('0x0'));var util=require(_0xa723('0x1'));var logger=require(_0xa723('0x2'))(_0xa723('0x3'));var moment=require(_0xa723('0x4'));var BPromise=require('bluebird');var rp=require(_0xa723('0x5'));var fs=require('fs');var path=require(_0xa723('0x6'));var rimraf=require(_0xa723('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x114c48,_0x428b23){return _0x114c48[_0xa723('0x8')](_0xa723('0x9'),attributes,{'tableName':_0xa723('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c7c=['moment','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api'];(function(_0x2374ef,_0x5226ea){var _0x2acca5=function(_0x1dac71){while(--_0x1dac71){_0x2374ef['push'](_0x2374ef['shift']());}};_0x2acca5(++_0x5226ea);}(_0x0c7c,0x1d8));var _0xc0c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c7c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc0c7('0x0'));var util=require(_0xc0c7('0x1'));var logger=require(_0xc0c7('0x2'))(_0xc0c7('0x3'));var moment=require(_0xc0c7('0x4'));var BPromise=require(_0xc0c7('0x5'));var rp=require(_0xc0c7('0x6'));var fs=require('fs');var path=require(_0xc0c7('0x7'));var rimraf=require(_0xc0c7('0x8'));var config=require('../../config/environment');var attributes=require(_0xc0c7('0x9'));module[_0xc0c7('0xa')]=function(_0x29d9c7,_0x3d06ee){return _0x29d9c7[_0xc0c7('0xb')](_0xc0c7('0xc'),attributes,{'tableName':_0xc0c7('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 1565014..9fac8d5 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 _0x0b42=['../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','outboundQueuePauses','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x5209ef,_0x3a4592){var _0x63f75f=function(_0x2591e1){while(--_0x2591e1){_0x5209ef['push'](_0x5209ef['shift']());}};_0x63f75f(++_0x3a4592);}(_0x0b42,0x1a9));var _0x20b4=function(_0x2b514d,_0x43f4cb){_0x2b514d=_0x2b514d-0x0;var _0x4f3669=_0x0b42[_0x2b514d];return _0x4f3669;};'use strict';var _=require(_0x20b4('0x0'));var util=require(_0x20b4('0x1'));var moment=require('moment');var BPromise=require(_0x20b4('0x2'));var rs=require(_0x20b4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x20b4('0x4'));var logger=require(_0x20b4('0x5'))(_0x20b4('0x6'));var config=require(_0x20b4('0x7'));var jayson=require(_0x20b4('0x8'));var client=jayson[_0x20b4('0x9')][_0x20b4('0xa')]({'port':0x232a});config['redis']=_[_0x20b4('0xb')](config[_0x20b4('0xc')],{'host':_0x20b4('0xd'),'port':0x18eb});var socket=require(_0x20b4('0xe'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x1e808a,_0x5f10ab,_0x3519da){return new BPromise(function(_0x136001,_0x81a6be){return client[_0x20b4('0xf')](_0x1e808a,_0x3519da)[_0x20b4('0x10')](function(_0x38af58){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5f10ab,_0x20b4('0x11'));logger[_0x20b4('0x12')](_0x20b4('0x13'),_0x5f10ab,_0x20b4('0x11'),JSON[_0x20b4('0x14')](_0x38af58));if(_0x38af58[_0x20b4('0x15')]){if(_0x38af58[_0x20b4('0x15')][_0x20b4('0x16')]===0x1f4){logger[_0x20b4('0x15')](_0x20b4('0x17'),_0x5f10ab,_0x38af58[_0x20b4('0x15')][_0x20b4('0x18')]);return _0x81a6be(_0x38af58[_0x20b4('0x15')][_0x20b4('0x18')]);}logger[_0x20b4('0x15')](_0x20b4('0x17'),_0x5f10ab,_0x38af58[_0x20b4('0x15')][_0x20b4('0x18')]);return _0x136001(_0x38af58[_0x20b4('0x15')][_0x20b4('0x18')]);}else{logger[_0x20b4('0x19')](_0x20b4('0x17'),_0x5f10ab,_0x20b4('0x11'));_0x136001(_0x38af58['result'][_0x20b4('0x18')]);}})[_0x20b4('0x1a')](function(_0x4f5c18){logger['error'](_0x20b4('0x17'),_0x5f10ab,_0x4f5c18);_0x81a6be(_0x4f5c18);});});}exports[_0x20b4('0x1b')]=function(_0x11e805){var _0x5e1c79=this;return new Promise(function(_0x230f43,_0x3d30d9){return db[_0x20b4('0x1c')][_0x20b4('0x1d')]({'raw':_0x11e805[_0x20b4('0x1e')]?_0x11e805[_0x20b4('0x1e')][_0x20b4('0x1f')]===undefined?!![]:![]:!![],'where':_0x11e805[_0x20b4('0x1e')]?_0x11e805[_0x20b4('0x1e')][_0x20b4('0x20')]||null:null,'attributes':[[db[_0x20b4('0x21')]['fn'](_0x20b4('0x22'),db[_0x20b4('0x21')]['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x20b4('0x23')]]})[_0x20b4('0x10')](function(_0x34ce35){logger[_0x20b4('0x19')](_0x20b4('0x1b'),_0x11e805);logger[_0x20b4('0x12')]('GetVoiceQueueRtPauses',_0x11e805,JSON[_0x20b4('0x14')](_0x34ce35));_0x230f43(_0x34ce35);})[_0x20b4('0x1a')](function(_0x3cf292){logger['error'](_0x20b4('0x1b'),_0x3cf292[_0x20b4('0x18')],_0x11e805);_0x3d30d9(_0x5e1c79[_0x20b4('0x15')](0x1f4,_0x3cf292[_0x20b4('0x18')]));});});}; \ No newline at end of file +var _0xedfd=['request','then','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','options','raw','where','sequelize','outboundQueuePauses','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register'];(function(_0x1a58d1,_0xa90685){var _0x101adc=function(_0x4a7543){while(--_0x4a7543){_0x1a58d1['push'](_0x1a58d1['shift']());}};_0x101adc(++_0xa90685);}(_0xedfd,0x1ee));var _0xdedf=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xedfd[_0x2160a9];return _0xa88cf7;};'use strict';var _=require('lodash');var util=require(_0xdedf('0x0'));var moment=require(_0xdedf('0x1'));var BPromise=require(_0xdedf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdedf('0x3'))['db'];var utils=require(_0xdedf('0x4'));var logger=require(_0xdedf('0x5'))(_0xdedf('0x6'));var config=require(_0xdedf('0x7'));var jayson=require(_0xdedf('0x8'));var client=jayson[_0xdedf('0x9')][_0xdedf('0xa')]({'port':0x232a});config[_0xdedf('0xb')]=_['defaults'](config[_0xdedf('0xb')],{'host':_0xdedf('0xc'),'port':0x18eb});var socket=require(_0xdedf('0xd'))(new Redis(config[_0xdedf('0xb')]));require(_0xdedf('0xe'))[_0xdedf('0xf')](socket);function respondWithRpcPromise(_0x319628,_0x1cd194,_0x564f5a){return new BPromise(function(_0x54cf6b,_0x5405d4){return client[_0xdedf('0x10')](_0x319628,_0x564f5a)[_0xdedf('0x11')](function(_0x4f4290){logger[_0xdedf('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1cd194,'request\x20sent');logger[_0xdedf('0x13')](_0xdedf('0x14'),_0x1cd194,_0xdedf('0x15'),JSON['stringify'](_0x4f4290));if(_0x4f4290[_0xdedf('0x16')]){if(_0x4f4290[_0xdedf('0x16')][_0xdedf('0x17')]===0x1f4){logger[_0xdedf('0x16')](_0xdedf('0x18'),_0x1cd194,_0x4f4290[_0xdedf('0x16')][_0xdedf('0x19')]);return _0x5405d4(_0x4f4290[_0xdedf('0x16')][_0xdedf('0x19')]);}logger[_0xdedf('0x16')](_0xdedf('0x18'),_0x1cd194,_0x4f4290['error']['message']);return _0x54cf6b(_0x4f4290[_0xdedf('0x16')][_0xdedf('0x19')]);}else{logger[_0xdedf('0x12')](_0xdedf('0x18'),_0x1cd194,'request\x20sent');_0x54cf6b(_0x4f4290[_0xdedf('0x1a')][_0xdedf('0x19')]);}})[_0xdedf('0x1b')](function(_0x3eacfb){logger[_0xdedf('0x16')](_0xdedf('0x18'),_0x1cd194,_0x3eacfb);_0x5405d4(_0x3eacfb);});});}exports[_0xdedf('0x1c')]=function(_0x10544c){var _0x310a37=this;return new Promise(function(_0x41aa9c,_0xd968c3){return db['UserVoiceQueueRt']['findAll']({'raw':_0x10544c[_0xdedf('0x1d')]?_0x10544c[_0xdedf('0x1d')][_0xdedf('0x1e')]===undefined?!![]:![]:!![],'where':_0x10544c[_0xdedf('0x1d')]?_0x10544c[_0xdedf('0x1d')][_0xdedf('0x1f')]||null:null,'attributes':[[db[_0xdedf('0x20')]['fn']('COUNT',db[_0xdedf('0x20')]['fn']('IF',db[_0xdedf('0x20')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0xdedf('0x21')]]})[_0xdedf('0x11')](function(_0x30786f){logger[_0xdedf('0x12')](_0xdedf('0x1c'),_0x10544c);logger['debug'](_0xdedf('0x1c'),_0x10544c,JSON['stringify'](_0x30786f));_0x41aa9c(_0x30786f);})[_0xdedf('0x1b')](function(_0x308425){logger[_0xdedf('0x16')](_0xdedf('0x1c'),_0x308425[_0xdedf('0x19')],_0x10544c);_0xd968c3(_0x310a37[_0xdedf('0x16')](0x1f4,_0x308425[_0xdedf('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 243cede..35bb2d3 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 _0xe714=['register','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit','removeListener'];(function(_0x51e416,_0x24f5e0){var _0x1d2ce1=function(_0x247c48){while(--_0x247c48){_0x51e416['push'](_0x51e416['shift']());}};_0x1d2ce1(++_0x24f5e0);}(_0xe714,0xe2));var _0x4e71=function(_0x792a66,_0x567b01){_0x792a66=_0x792a66-0x0;var _0xb67fa7=_0xe714[_0x792a66];return _0xb67fa7;};'use strict';var UserVoiceQueueRtEvents=require(_0x4e71('0x0'));var events=['save',_0x4e71('0x1'),_0x4e71('0x2')];function createListener(_0xe0504f,_0x28abe0){return function(_0x5c5974){_0x28abe0[_0x4e71('0x3')](_0xe0504f,_0x5c5974);};}function removeListener(_0x59a685,_0xad5224){return function(){UserVoiceQueueRtEvents[_0x4e71('0x4')](_0x59a685,_0xad5224);};}exports[_0x4e71('0x5')]=function(_0x204a19){for(var _0xfe1559=0x0,_0x1f1d35=events['length'];_0xfe1559<_0x1f1d35;_0xfe1559++){var _0x3b0a3a=events[_0xfe1559];var _0x32b6d0=createListener(_0x4e71('0x6')+_0x3b0a3a,_0x204a19);UserVoiceQueueRtEvents['on'](_0x3b0a3a,_0x32b6d0);}}; \ No newline at end of file +var _0x4672=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit','removeListener'];(function(_0x45e864,_0x30b951){var _0x37bc96=function(_0x27c086){while(--_0x27c086){_0x45e864['push'](_0x45e864['shift']());}};_0x37bc96(++_0x30b951);}(_0x4672,0x18a));var _0x2467=function(_0x129d04,_0x5c0644){_0x129d04=_0x129d04-0x0;var _0x3cb2ff=_0x4672[_0x129d04];return _0x3cb2ff;};'use strict';var UserVoiceQueueRtEvents=require(_0x2467('0x0'));var events=['save',_0x2467('0x1'),_0x2467('0x2')];function createListener(_0x57972f,_0x3d4246){return function(_0x56aa2b){_0x3d4246[_0x2467('0x3')](_0x57972f,_0x56aa2b);};}function removeListener(_0x228e2f,_0x1368f7){return function(){UserVoiceQueueRtEvents[_0x2467('0x4')](_0x228e2f,_0x1368f7);};}exports['register']=function(_0x19e085){for(var _0x48674e=0x0,_0x741c4d=events[_0x2467('0x5')];_0x48674e<_0x741c4d;_0x48674e++){var _0x1e91f3=events[_0x48674e];var _0x19e43a=createListener(_0x2467('0x6')+_0x1e91f3,_0x19e085);UserVoiceQueueRtEvents['on'](_0x1e91f3,_0x19e43a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 7d3b8f6..896e5f2 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1551af,_0x5223c3){var _0xd8eb82=function(_0x4b133a){while(--_0x4b133a){_0x1551af['push'](_0x1551af['shift']());}};_0xd8eb82(++_0x5223c3);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'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(_0x4e9a8f,_0x290706){var _0x32ad34=function(_0x1e077a){while(--_0x1e077a){_0x4e9a8f['push'](_0x4e9a8f['shift']());}};_0x32ad34(++_0x290706);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 5eefdd6..b3aadbe 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 _0x5646=['exports','INTEGER','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5646,0x1b8));var _0x6564=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x5646[_0x95942];return _0x6d7f81;};'use strict';var Sequelize=require(_0x6564('0x0'));module[_0x6564('0x1')]={'penalty':{'type':Sequelize[_0x6564('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x07dc=['exports'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0x07dc,0x174));var _0xc07d=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x07dc[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require('sequelize');module[_0xc07d('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 7483586..6add65e 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 _0x0d84=['../../config/environment','./userWhatsappQueue.attributes','exports','UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','api','moment','bluebird','path'];(function(_0x33ec75,_0x56dbb7){var _0x377c09=function(_0x4cec00){while(--_0x4cec00){_0x33ec75['push'](_0x33ec75['shift']());}};_0x377c09(++_0x56dbb7);}(_0x0d84,0xcd));var _0x40d8=function(_0x1da014,_0x12c8ed){_0x1da014=_0x1da014-0x0;var _0x15197b=_0x0d84[_0x1da014];return _0x15197b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x40d8('0x0'))(_0x40d8('0x1'));var moment=require(_0x40d8('0x2'));var BPromise=require(_0x40d8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40d8('0x4'));var rimraf=require('rimraf');var config=require(_0x40d8('0x5'));var attributes=require(_0x40d8('0x6'));module[_0x40d8('0x7')]=function(_0x257f3c,_0x242d0c){return _0x257f3c['define'](_0x40d8('0x8'),attributes,{'tableName':_0x40d8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0198=['define','UserWhatsappQueue','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x3f45f8,_0x227f96){var _0x2f8466=function(_0x4700b0){while(--_0x4700b0){_0x3f45f8['push'](_0x3f45f8['shift']());}};_0x2f8466(++_0x227f96);}(_0x0198,0x1a4));var _0x8019=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x0198[_0x1bfe2b];return _0x1477d4;};'use strict';var _=require(_0x8019('0x0'));var util=require(_0x8019('0x1'));var logger=require('../../config/logger')(_0x8019('0x2'));var moment=require(_0x8019('0x3'));var BPromise=require('bluebird');var rp=require(_0x8019('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8019('0x5'));var config=require(_0x8019('0x6'));var attributes=require(_0x8019('0x7'));module[_0x8019('0x8')]=function(_0x1cb712,_0x2d908f){return _0x1cb712[_0x8019('0x9')](_0x8019('0xa'),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 6f8fc4c..62bed40 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 _0x28a2=['jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4aa285,_0x1fe00d){var _0x2777ee=function(_0x181d0f){while(--_0x181d0f){_0x4aa285['push'](_0x4aa285['shift']());}};_0x2777ee(++_0x1fe00d);}(_0x28a2,0x123));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x228a('0x0'));var moment=require(_0x228a('0x1'));var BPromise=require(_0x228a('0x2'));var rs=require(_0x228a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x228a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x228a('0x5'))(_0x228a('0x6'));var config=require(_0x228a('0x7'));var jayson=require(_0x228a('0x8'));var client=jayson[_0x228a('0x9')][_0x228a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33f07d,_0x361b88,_0x462957){return new BPromise(function(_0x30a813,_0x1336a3){return client[_0x228a('0xb')](_0x33f07d,_0x462957)[_0x228a('0xc')](function(_0x16e761){logger[_0x228a('0xd')](_0x228a('0xe'),_0x361b88,_0x228a('0xf'));logger[_0x228a('0x10')](_0x228a('0x11'),_0x361b88,_0x228a('0xf'),JSON[_0x228a('0x12')](_0x16e761));if(_0x16e761[_0x228a('0x13')]){if(_0x16e761[_0x228a('0x13')]['code']===0x1f4){logger[_0x228a('0x13')](_0x228a('0xe'),_0x361b88,_0x16e761[_0x228a('0x13')]['message']);return _0x1336a3(_0x16e761[_0x228a('0x13')][_0x228a('0x14')]);}logger[_0x228a('0x13')](_0x228a('0xe'),_0x361b88,_0x16e761['error']['message']);return _0x30a813(_0x16e761[_0x228a('0x13')][_0x228a('0x14')]);}else{logger[_0x228a('0xd')](_0x228a('0xe'),_0x361b88,_0x228a('0xf'));_0x30a813(_0x16e761[_0x228a('0x15')][_0x228a('0x14')]);}})[_0x228a('0x16')](function(_0x433ce9){logger[_0x228a('0x13')](_0x228a('0xe'),_0x361b88,_0x433ce9);_0x1336a3(_0x433ce9);});});} \ No newline at end of file +var _0x55c1=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','UserWhatsappQueue,\x20%s,\x20%s','result','catch','lodash'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x55c1,0x141));var _0x155c=function(_0x619fcc,_0x3bd756){_0x619fcc=_0x619fcc-0x0;var _0x4737a6=_0x55c1[_0x619fcc];return _0x4737a6;};'use strict';var _=require(_0x155c('0x0'));var util=require(_0x155c('0x1'));var moment=require(_0x155c('0x2'));var BPromise=require(_0x155c('0x3'));var rs=require(_0x155c('0x4'));var fs=require('fs');var Redis=require(_0x155c('0x5'));var db=require(_0x155c('0x6'))['db'];var utils=require(_0x155c('0x7'));var logger=require(_0x155c('0x8'))('rpc');var config=require(_0x155c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x155c('0xa')][_0x155c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a5fab,_0x3eec9c,_0x5e3039){return new BPromise(function(_0x1c9629,_0x311074){return client[_0x155c('0xc')](_0x2a5fab,_0x5e3039)[_0x155c('0xd')](function(_0x13845e){logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x3eec9c,_0x155c('0xe'));logger[_0x155c('0xf')](_0x155c('0x10'),_0x3eec9c,_0x155c('0xe'),JSON['stringify'](_0x13845e));if(_0x13845e[_0x155c('0x11')]){if(_0x13845e[_0x155c('0x11')][_0x155c('0x12')]===0x1f4){logger[_0x155c('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x3eec9c,_0x13845e[_0x155c('0x11')][_0x155c('0x13')]);return _0x311074(_0x13845e[_0x155c('0x11')][_0x155c('0x13')]);}logger[_0x155c('0x11')](_0x155c('0x14'),_0x3eec9c,_0x13845e['error'][_0x155c('0x13')]);return _0x1c9629(_0x13845e['error'][_0x155c('0x13')]);}else{logger['info'](_0x155c('0x14'),_0x3eec9c,_0x155c('0xe'));_0x1c9629(_0x13845e[_0x155c('0x15')][_0x155c('0x13')]);}})[_0x155c('0x16')](function(_0x56ee0b){logger[_0x155c('0x11')](_0x155c('0x14'),_0x3eec9c,_0x56ee0b);_0x311074(_0x56ee0b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 6e78611..50a2e4b 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 _0xb201=['Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','exports','multer','path','connect-timeout','express'];(function(_0x205b46,_0x3ca65b){var _0x2b6ae8=function(_0x1f4ae9){while(--_0x1f4ae9){_0x205b46['push'](_0x205b46['shift']());}};_0x2b6ae8(++_0x3ca65b);}(_0xb201,0x1b1));var _0x1b20=function(_0xd64c44,_0x5efe7a){_0xd64c44=_0xd64c44-0x0;var _0x18888a=_0xb201[_0xd64c44];return _0x18888a;};'use strict';var multer=require(_0x1b20('0x0'));var util=require('util');var path=require(_0x1b20('0x1'));var timeout=require(_0x1b20('0x2'));var express=require(_0x1b20('0x3'));var router=express[_0x1b20('0x4')]();var fs_extra=require(_0x1b20('0x5'));var auth=require(_0x1b20('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1b20('0x7'));var controller=require(_0x1b20('0x8'));router[_0x1b20('0x9')]('/',auth['isAuthenticated'](),controller[_0x1b20('0xa')]);router['get'](_0x1b20('0xb'),auth[_0x1b20('0xc')](),controller[_0x1b20('0xd')]);router[_0x1b20('0xe')]('/',auth['isAuthenticated'](),controller[_0x1b20('0xf')]);router[_0x1b20('0x10')](_0x1b20('0xb'),auth['isAuthenticated'](),controller[_0x1b20('0x11')]);router['delete'](_0x1b20('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x1b20('0x12')]=router; \ No newline at end of file +var _0x1ae3=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x1aa13e,_0x12a40b){var _0x1144bd=function(_0x5f5cae){while(--_0x5f5cae){_0x1aa13e['push'](_0x1aa13e['shift']());}};_0x1144bd(++_0x12a40b);}(_0x1ae3,0x139));var _0x31ae=function(_0x5d3267,_0xe106a8){_0x5d3267=_0x5d3267-0x0;var _0x57dba1=_0x1ae3[_0x5d3267];return _0x57dba1;};'use strict';var multer=require(_0x31ae('0x0'));var util=require(_0x31ae('0x1'));var path=require('path');var timeout=require(_0x31ae('0x2'));var express=require(_0x31ae('0x3'));var router=express[_0x31ae('0x4')]();var fs_extra=require(_0x31ae('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x31ae('0x6'));var config=require(_0x31ae('0x7'));var controller=require(_0x31ae('0x8'));router[_0x31ae('0x9')]('/',auth[_0x31ae('0xa')](),controller[_0x31ae('0xb')]);router[_0x31ae('0x9')](_0x31ae('0xc'),auth[_0x31ae('0xa')](),controller[_0x31ae('0xd')]);router[_0x31ae('0xe')]('/',auth[_0x31ae('0xa')](),controller[_0x31ae('0xf')]);router[_0x31ae('0x10')](_0x31ae('0xc'),auth['isAuthenticated'](),controller[_0x31ae('0x11')]);router[_0x31ae('0x12')](_0x31ae('0xc'),auth['isAuthenticated'](),controller[_0x31ae('0x13')]);module[_0x31ae('0x14')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 7d5b709..54c5949 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 _0xfe45=['sequelize','STRING','name'];(function(_0x1e7241,_0x13c216){var _0x370552=function(_0x260349){while(--_0x260349){_0x1e7241['push'](_0x1e7241['shift']());}};_0x370552(++_0x13c216);}(_0xfe45,0xe1));var _0x5fe4=function(_0x183c0b,_0xd75248){_0x183c0b=_0x183c0b-0x0;var _0x3304db=_0xfe45[_0x183c0b];return _0x3304db;};'use strict';var Sequelize=require(_0x5fe4('0x0'));module['exports']={'name':{'type':Sequelize[_0x5fe4('0x1')],'unique':_0x5fe4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5fe4('0x1')]}}; \ No newline at end of file +var _0x47c7=['name','sequelize','STRING'];(function(_0x46a192,_0x1c26d0){var _0x1dad26=function(_0x103f6d){while(--_0x103f6d){_0x46a192['push'](_0x46a192['shift']());}};_0x1dad26(++_0x1c26d0);}(_0x47c7,0x1ab));var _0x747c=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x47c7[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0x747c('0x0'));module['exports']={'name':{'type':Sequelize[_0x747c('0x1')],'unique':_0x747c('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 6778f5a..564d525 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 _0x27c0=['type','key','model','query','keys','filters','intersection','attributes','fields','length','where','pick','filter','merge','Variable','includeAll','findAll','rows','catch','show','params','rawAttributes','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','find','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','UserProfileResource','error','stack','name','send','index','map'];(function(_0x2088df,_0x491f89){var _0x54ab64=function(_0x2dba6f){while(--_0x2dba6f){_0x2088df['push'](_0x2088df['shift']());}};_0x54ab64(++_0x491f89);}(_0x27c0,0x1ab));var _0x027c=function(_0x30ceae,_0xed5e9b){_0x30ceae=_0x30ceae-0x0;var _0xe57a2f=_0x27c0[_0x30ceae];return _0xe57a2f;};'use strict';var emlformat=require(_0x027c('0x0'));var rimraf=require(_0x027c('0x1'));var zipdir=require(_0x027c('0x2'));var jsonpatch=require(_0x027c('0x3'));var rp=require(_0x027c('0x4'));var moment=require(_0x027c('0x5'));var BPromise=require(_0x027c('0x6'));var Mustache=require(_0x027c('0x7'));var util=require('util');var path=require(_0x027c('0x8'));var sox=require(_0x027c('0x9'));var csv=require('to-csv');var ejs=require(_0x027c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x027c('0xb'));var squel=require(_0x027c('0xc'));var crypto=require(_0x027c('0xd'));var jsforce=require(_0x027c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x027c('0xf'));var querystring=require(_0x027c('0x10'));var Papa=require(_0x027c('0x11'));var Redis=require(_0x027c('0x12'));var authService=require(_0x027c('0x13'));var qs=require(_0x027c('0x14'));var as=require(_0x027c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x027c('0x16'))(_0x027c('0x17'));var utils=require('../../config/utils');var config=require(_0x027c('0x18'));var licenseUtil=require(_0x027c('0x19'));var db=require(_0x027c('0x1a'))['db'];function respondWithStatusCode(_0x2005f3,_0x43065e){_0x43065e=_0x43065e||0xcc;return function(_0x36ae39){if(_0x36ae39){return _0x2005f3['sendStatus'](_0x43065e);}return _0x2005f3[_0x027c('0x1b')](_0x43065e)[_0x027c('0x1c')]();};}function respondWithResult(_0x4360ff,_0x1f46e1){_0x1f46e1=_0x1f46e1||0xc8;return function(_0x2fa877){if(_0x2fa877){return _0x4360ff[_0x027c('0x1b')](_0x1f46e1)[_0x027c('0x1d')](_0x2fa877);}};}function respondWithFilteredResult(_0x23f773,_0x25a86c){return function(_0x46e667){if(_0x46e667){var _0x527e54=typeof _0x25a86c[_0x027c('0x1e')]===_0x027c('0x1f')&&typeof _0x25a86c[_0x027c('0x20')]===_0x027c('0x1f');var _0x3ca345=_0x46e667['count'];var _0xa3420d=_0x527e54?0x0:_0x25a86c[_0x027c('0x1e')];var _0xd44a1a=_0x527e54?_0x46e667[_0x027c('0x21')]:_0x25a86c[_0x027c('0x1e')]+_0x25a86c[_0x027c('0x20')];var _0x151a6b;if(_0xd44a1a>=_0x3ca345){_0xd44a1a=_0x3ca345;_0x151a6b=0xc8;}else{_0x151a6b=0xce;}_0x23f773[_0x027c('0x1b')](_0x151a6b);return _0x23f773[_0x027c('0x22')](_0x027c('0x23'),_0xa3420d+'-'+_0xd44a1a+'/'+_0x3ca345)['json'](_0x46e667);}return null;};}function patchUpdates(_0x537e28){return function(_0x52b6aa){try{jsonpatch[_0x027c('0x24')](_0x52b6aa,_0x537e28,!![]);}catch(_0x3a836e){return BPromise[_0x027c('0x25')](_0x3a836e);}return _0x52b6aa['save']();};}function saveUpdates(_0xe4e6d7,_0xed3dc1){return function(_0x2facd4){if(_0x2facd4){return _0x2facd4['update'](_0xe4e6d7)[_0x027c('0x26')](function(_0x560e87){return _0x560e87;});}return null;};}function removeEntity(_0x5b7eb2,_0xaa51c5){return function(_0x43faf2){if(_0x43faf2){return _0x43faf2[_0x027c('0x27')]()[_0x027c('0x26')](function(){var _0x3c019e=_0x43faf2['get']({'plain':!![]});var _0x44e8bd='Variables';return db[_0x027c('0x28')][_0x027c('0x27')]({'where':{'type':_0x44e8bd,'resourceId':_0x3c019e['id']}})['then'](function(){return _0x43faf2;});})[_0x027c('0x26')](function(){_0x5b7eb2[_0x027c('0x1b')](0xcc)[_0x027c('0x1c')]();});}};}function handleEntityNotFound(_0x453cc3,_0x338db1){return function(_0x17e651){if(!_0x17e651){_0x453cc3['sendStatus'](0x194);}return _0x17e651;};}function handleError(_0x322981,_0x270ddd){_0x270ddd=_0x270ddd||0x1f4;return function(_0x14c216){logger[_0x027c('0x29')](_0x14c216[_0x027c('0x2a')]);if(_0x14c216[_0x027c('0x2b')]){delete _0x14c216[_0x027c('0x2b')];}_0x322981[_0x027c('0x1b')](_0x270ddd)[_0x027c('0x2c')](_0x14c216);};}exports[_0x027c('0x2d')]=function(_0x51b685,_0x336704){var _0x1dbe0a={},_0x2ce203={},_0xcc959f={'count':0x0,'rows':[]};var _0x3828d2=_[_0x027c('0x2e')](db['Variable']['rawAttributes'],function(_0x4c276f){return{'name':_0x4c276f['fieldName'],'type':_0x4c276f[_0x027c('0x2f')][_0x027c('0x30')]};});_0x2ce203[_0x027c('0x31')]=_[_0x027c('0x2e')](_0x3828d2,_0x027c('0x2b'));_0x2ce203[_0x027c('0x32')]=_[_0x027c('0x33')](_0x51b685[_0x027c('0x32')]);_0x2ce203[_0x027c('0x34')]=_[_0x027c('0x35')](_0x2ce203[_0x027c('0x31')],_0x2ce203['query']);_0x1dbe0a[_0x027c('0x36')]=_[_0x027c('0x35')](_0x2ce203[_0x027c('0x31')],qs[_0x027c('0x37')](_0x51b685[_0x027c('0x32')][_0x027c('0x37')]));_0x1dbe0a[_0x027c('0x36')]=_0x1dbe0a['attributes'][_0x027c('0x38')]?_0x1dbe0a[_0x027c('0x36')]:_0x2ce203[_0x027c('0x31')];if(!_0x51b685[_0x027c('0x32')]['hasOwnProperty']('nolimit')){_0x1dbe0a[_0x027c('0x20')]=qs[_0x027c('0x20')](_0x51b685[_0x027c('0x32')][_0x027c('0x20')]);_0x1dbe0a[_0x027c('0x1e')]=qs[_0x027c('0x1e')](_0x51b685[_0x027c('0x32')][_0x027c('0x1e')]);}_0x1dbe0a['order']=qs['sort'](_0x51b685[_0x027c('0x32')]['sort']);_0x1dbe0a[_0x027c('0x39')]=qs[_0x027c('0x34')](_[_0x027c('0x3a')](_0x51b685[_0x027c('0x32')],_0x2ce203['filters']),_0x3828d2);if(_0x51b685[_0x027c('0x32')][_0x027c('0x3b')]){_0x1dbe0a[_0x027c('0x39')]=_[_0x027c('0x3c')](_0x1dbe0a['where'],{'$or':_['map'](_0x3828d2,function(_0x197d8e){if(_0x197d8e[_0x027c('0x2f')]!=='VIRTUAL'){var _0x4914bb={};_0x4914bb[_0x197d8e['name']]={'$like':'%'+_0x51b685[_0x027c('0x32')]['filter']+'%'};return _0x4914bb;}})});}_0x1dbe0a=_[_0x027c('0x3c')]({},_0x1dbe0a,_0x51b685['options']);var _0x2c698c={'where':_0x1dbe0a['where']};return db[_0x027c('0x3d')]['count'](_0x2c698c)['then'](function(_0x5ea00c){_0xcc959f['count']=_0x5ea00c;if(_0x51b685[_0x027c('0x32')][_0x027c('0x3e')]){_0x1dbe0a['include']=[{'all':!![]}];}return db[_0x027c('0x3d')][_0x027c('0x3f')](_0x1dbe0a);})[_0x027c('0x26')](function(_0x2ed5dc){_0xcc959f[_0x027c('0x40')]=_0x2ed5dc;return _0xcc959f;})[_0x027c('0x26')](respondWithFilteredResult(_0x336704,_0x1dbe0a))[_0x027c('0x41')](handleError(_0x336704,null));};exports[_0x027c('0x42')]=function(_0x3c66aa,_0x32af08){var _0x50af9a={'raw':!![],'where':{'id':_0x3c66aa[_0x027c('0x43')]['id']}},_0x739fc0={};_0x739fc0[_0x027c('0x31')]=_[_0x027c('0x33')](db[_0x027c('0x3d')][_0x027c('0x44')]);_0x739fc0[_0x027c('0x32')]=_['keys'](_0x3c66aa[_0x027c('0x32')]);_0x739fc0[_0x027c('0x34')]=_['intersection'](_0x739fc0[_0x027c('0x31')],_0x739fc0[_0x027c('0x32')]);_0x50af9a[_0x027c('0x36')]=_[_0x027c('0x35')](_0x739fc0[_0x027c('0x31')],qs[_0x027c('0x37')](_0x3c66aa['query'][_0x027c('0x37')]));_0x50af9a[_0x027c('0x36')]=_0x50af9a[_0x027c('0x36')]['length']?_0x50af9a[_0x027c('0x36')]:_0x739fc0[_0x027c('0x31')];if(_0x3c66aa[_0x027c('0x32')][_0x027c('0x3e')]){_0x50af9a['include']=[{'all':!![]}];}_0x50af9a=_[_0x027c('0x3c')]({},_0x50af9a,_0x3c66aa[_0x027c('0x45')]);return db[_0x027c('0x3d')]['find'](_0x50af9a)['then'](handleEntityNotFound(_0x32af08,null))[_0x027c('0x26')](respondWithResult(_0x32af08,null))['catch'](handleError(_0x32af08,null));};exports['create']=function(_0x518875,_0x5acdb6){return db['Variable'][_0x027c('0x46')](_0x518875[_0x027c('0x47')],{})[_0x027c('0x26')](function(_0x38b63c){var _0x26087c=_0x518875[_0x027c('0x48')][_0x027c('0x49')]({'plain':!![]});if(!_0x26087c)throw new Error(_0x027c('0x4a'));if(_0x26087c[_0x027c('0x4b')]===_0x027c('0x48')){var _0x3035b2=_0x38b63c[_0x027c('0x49')]({'plain':!![]});var _0x126a00=_0x027c('0x4c');return db['UserProfileSection'][_0x027c('0x4d')]({'where':{'name':_0x126a00,'userProfileId':_0x26087c['userProfileId']},'raw':!![]})[_0x027c('0x26')](function(_0x16fb34){if(_0x16fb34&&_0x16fb34['autoAssociation']===0x0){return db['UserProfileResource'][_0x027c('0x46')]({'name':_0x3035b2[_0x027c('0x2b')],'resourceId':_0x3035b2['id'],'type':_0x16fb34['name'],'sectionId':_0x16fb34['id']},{})[_0x027c('0x26')](function(){return _0x38b63c;});}else{return _0x38b63c;}})['catch'](function(_0x4e17cd){logger[_0x027c('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e17cd);throw _0x4e17cd;});}return _0x38b63c;})[_0x027c('0x26')](respondWithResult(_0x5acdb6,0xc9))[_0x027c('0x41')](handleError(_0x5acdb6,null));};exports[_0x027c('0x4e')]=function(_0x6bc996,_0xb6b137){if(_0x6bc996[_0x027c('0x47')]['id']){delete _0x6bc996[_0x027c('0x47')]['id'];}return db[_0x027c('0x3d')][_0x027c('0x4d')]({'where':{'id':_0x6bc996[_0x027c('0x43')]['id']}})[_0x027c('0x26')](handleEntityNotFound(_0xb6b137,null))[_0x027c('0x26')](saveUpdates(_0x6bc996[_0x027c('0x47')],null))[_0x027c('0x26')](respondWithResult(_0xb6b137,null))[_0x027c('0x41')](handleError(_0xb6b137,null));};exports[_0x027c('0x27')]=function(_0x1e178f,_0xeb0680){return db[_0x027c('0x3d')][_0x027c('0x4d')]({'where':{'id':_0x1e178f[_0x027c('0x43')]['id']}})[_0x027c('0x26')](handleEntityNotFound(_0xeb0680,null))['then'](removeEntity(_0xeb0680,null))['catch'](handleError(_0xeb0680,null));}; \ No newline at end of file +var _0xded3=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','json','apply','reject','save','then','Variables','UserProfileResource','error','stack','send','index','map','Variable','rawAttributes','fieldName','type','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0xded3,0x13d));var _0x3ded=function(_0x2ea2cc,_0x1dc6bf){_0x2ea2cc=_0x2ea2cc-0x0;var _0x55035e=_0xded3[_0x2ea2cc];return _0x55035e;};'use strict';var emlformat=require(_0x3ded('0x0'));var rimraf=require(_0x3ded('0x1'));var zipdir=require(_0x3ded('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ded('0x3'));var moment=require(_0x3ded('0x4'));var BPromise=require(_0x3ded('0x5'));var Mustache=require('mustache');var util=require(_0x3ded('0x6'));var path=require(_0x3ded('0x7'));var sox=require(_0x3ded('0x8'));var csv=require('to-csv');var ejs=require(_0x3ded('0x9'));var fs=require('fs');var fs_extra=require(_0x3ded('0xa'));var _=require(_0x3ded('0xb'));var squel=require('squel');var crypto=require(_0x3ded('0xc'));var jsforce=require(_0x3ded('0xd'));var deskjs=require(_0x3ded('0xe'));var toCsv=require(_0x3ded('0xf'));var querystring=require(_0x3ded('0x10'));var Papa=require(_0x3ded('0x11'));var Redis=require('ioredis');var authService=require(_0x3ded('0x12'));var qs=require(_0x3ded('0x13'));var as=require(_0x3ded('0x14'));var hardwareService=require(_0x3ded('0x15'));var logger=require(_0x3ded('0x16'))('api');var utils=require(_0x3ded('0x17'));var config=require(_0x3ded('0x18'));var licenseUtil=require(_0x3ded('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd4c106,_0x286cb6){_0x286cb6=_0x286cb6||0xcc;return function(_0x494c54){if(_0x494c54){return _0xd4c106[_0x3ded('0x1a')](_0x286cb6);}return _0xd4c106[_0x3ded('0x1b')](_0x286cb6)[_0x3ded('0x1c')]();};}function respondWithResult(_0xbeb99e,_0x1c0276){_0x1c0276=_0x1c0276||0xc8;return function(_0x790ff6){if(_0x790ff6){return _0xbeb99e['status'](_0x1c0276)['json'](_0x790ff6);}};}function respondWithFilteredResult(_0x5c1fcd,_0x2526ac){return function(_0x282747){if(_0x282747){var _0x32fb2b=typeof _0x2526ac['offset']==='undefined'&&typeof _0x2526ac['limit']===_0x3ded('0x1d');var _0x5b17c6=_0x282747['count'];var _0x6c38e8=_0x32fb2b?0x0:_0x2526ac[_0x3ded('0x1e')];var _0x47f8b5=_0x32fb2b?_0x282747[_0x3ded('0x1f')]:_0x2526ac[_0x3ded('0x1e')]+_0x2526ac[_0x3ded('0x20')];var _0x14bff0;if(_0x47f8b5>=_0x5b17c6){_0x47f8b5=_0x5b17c6;_0x14bff0=0xc8;}else{_0x14bff0=0xce;}_0x5c1fcd['status'](_0x14bff0);return _0x5c1fcd[_0x3ded('0x21')](_0x3ded('0x22'),_0x6c38e8+'-'+_0x47f8b5+'/'+_0x5b17c6)[_0x3ded('0x23')](_0x282747);}return null;};}function patchUpdates(_0x4c7d15){return function(_0x165d5f){try{jsonpatch[_0x3ded('0x24')](_0x165d5f,_0x4c7d15,!![]);}catch(_0x507500){return BPromise[_0x3ded('0x25')](_0x507500);}return _0x165d5f[_0x3ded('0x26')]();};}function saveUpdates(_0xeca822,_0x4bda02){return function(_0x3d3d1f){if(_0x3d3d1f){return _0x3d3d1f['update'](_0xeca822)['then'](function(_0x2931ca){return _0x2931ca;});}return null;};}function removeEntity(_0x1766ea,_0x1f55bd){return function(_0x358ce0){if(_0x358ce0){return _0x358ce0['destroy']()[_0x3ded('0x27')](function(){var _0x4c26f7=_0x358ce0['get']({'plain':!![]});var _0x35e7b6=_0x3ded('0x28');return db[_0x3ded('0x29')]['destroy']({'where':{'type':_0x35e7b6,'resourceId':_0x4c26f7['id']}})[_0x3ded('0x27')](function(){return _0x358ce0;});})[_0x3ded('0x27')](function(){_0x1766ea['status'](0xcc)[_0x3ded('0x1c')]();});}};}function handleEntityNotFound(_0x4b5a16,_0x2b82a1){return function(_0x8130d5){if(!_0x8130d5){_0x4b5a16[_0x3ded('0x1a')](0x194);}return _0x8130d5;};}function handleError(_0x3c4a33,_0x4b7089){_0x4b7089=_0x4b7089||0x1f4;return function(_0x4c7e59){logger[_0x3ded('0x2a')](_0x4c7e59[_0x3ded('0x2b')]);if(_0x4c7e59['name']){delete _0x4c7e59['name'];}_0x3c4a33[_0x3ded('0x1b')](_0x4b7089)[_0x3ded('0x2c')](_0x4c7e59);};}exports[_0x3ded('0x2d')]=function(_0xcc4a65,_0x124231){var _0xc121ea={},_0x3075cf={},_0x1e57e5={'count':0x0,'rows':[]};var _0x5acb4b=_[_0x3ded('0x2e')](db[_0x3ded('0x2f')][_0x3ded('0x30')],function(_0x34d6e1){return{'name':_0x34d6e1[_0x3ded('0x31')],'type':_0x34d6e1[_0x3ded('0x32')]['key']};});_0x3075cf['model']=_[_0x3ded('0x2e')](_0x5acb4b,_0x3ded('0x33'));_0x3075cf[_0x3ded('0x34')]=_['keys'](_0xcc4a65[_0x3ded('0x34')]);_0x3075cf[_0x3ded('0x35')]=_[_0x3ded('0x36')](_0x3075cf[_0x3ded('0x37')],_0x3075cf['query']);_0xc121ea[_0x3ded('0x38')]=_[_0x3ded('0x36')](_0x3075cf['model'],qs[_0x3ded('0x39')](_0xcc4a65[_0x3ded('0x34')][_0x3ded('0x39')]));_0xc121ea[_0x3ded('0x38')]=_0xc121ea[_0x3ded('0x38')][_0x3ded('0x3a')]?_0xc121ea[_0x3ded('0x38')]:_0x3075cf['model'];if(!_0xcc4a65[_0x3ded('0x34')][_0x3ded('0x3b')](_0x3ded('0x3c'))){_0xc121ea[_0x3ded('0x20')]=qs[_0x3ded('0x20')](_0xcc4a65[_0x3ded('0x34')][_0x3ded('0x20')]);_0xc121ea[_0x3ded('0x1e')]=qs['offset'](_0xcc4a65['query'][_0x3ded('0x1e')]);}_0xc121ea[_0x3ded('0x3d')]=qs[_0x3ded('0x3e')](_0xcc4a65[_0x3ded('0x34')][_0x3ded('0x3e')]);_0xc121ea[_0x3ded('0x3f')]=qs['filters'](_[_0x3ded('0x40')](_0xcc4a65[_0x3ded('0x34')],_0x3075cf[_0x3ded('0x35')]),_0x5acb4b);if(_0xcc4a65[_0x3ded('0x34')]['filter']){_0xc121ea[_0x3ded('0x3f')]=_['merge'](_0xc121ea['where'],{'$or':_[_0x3ded('0x2e')](_0x5acb4b,function(_0x22a772){if(_0x22a772[_0x3ded('0x32')]!=='VIRTUAL'){var _0x3ac7ed={};_0x3ac7ed[_0x22a772[_0x3ded('0x33')]]={'$like':'%'+_0xcc4a65['query'][_0x3ded('0x41')]+'%'};return _0x3ac7ed;}})});}_0xc121ea=_[_0x3ded('0x42')]({},_0xc121ea,_0xcc4a65['options']);var _0x496858={'where':_0xc121ea['where']};return db[_0x3ded('0x2f')][_0x3ded('0x1f')](_0x496858)[_0x3ded('0x27')](function(_0xdb716){_0x1e57e5[_0x3ded('0x1f')]=_0xdb716;if(_0xcc4a65['query']['includeAll']){_0xc121ea[_0x3ded('0x43')]=[{'all':!![]}];}return db[_0x3ded('0x2f')]['findAll'](_0xc121ea);})['then'](function(_0x36b27a){_0x1e57e5['rows']=_0x36b27a;return _0x1e57e5;})['then'](respondWithFilteredResult(_0x124231,_0xc121ea))[_0x3ded('0x44')](handleError(_0x124231,null));};exports[_0x3ded('0x45')]=function(_0x3cd03d,_0x56a7ac){var _0x587a49={'raw':!![],'where':{'id':_0x3cd03d[_0x3ded('0x46')]['id']}},_0x18ee05={};_0x18ee05[_0x3ded('0x37')]=_[_0x3ded('0x47')](db['Variable']['rawAttributes']);_0x18ee05[_0x3ded('0x34')]=_[_0x3ded('0x47')](_0x3cd03d['query']);_0x18ee05[_0x3ded('0x35')]=_[_0x3ded('0x36')](_0x18ee05['model'],_0x18ee05[_0x3ded('0x34')]);_0x587a49[_0x3ded('0x38')]=_['intersection'](_0x18ee05[_0x3ded('0x37')],qs[_0x3ded('0x39')](_0x3cd03d[_0x3ded('0x34')][_0x3ded('0x39')]));_0x587a49[_0x3ded('0x38')]=_0x587a49[_0x3ded('0x38')][_0x3ded('0x3a')]?_0x587a49['attributes']:_0x18ee05[_0x3ded('0x37')];if(_0x3cd03d[_0x3ded('0x34')][_0x3ded('0x48')]){_0x587a49[_0x3ded('0x43')]=[{'all':!![]}];}_0x587a49=_[_0x3ded('0x42')]({},_0x587a49,_0x3cd03d['options']);return db['Variable'][_0x3ded('0x49')](_0x587a49)[_0x3ded('0x27')](handleEntityNotFound(_0x56a7ac,null))[_0x3ded('0x27')](respondWithResult(_0x56a7ac,null))[_0x3ded('0x44')](handleError(_0x56a7ac,null));};exports['create']=function(_0x5eb0e0,_0x2dc0d0){return db['Variable'][_0x3ded('0x4a')](_0x5eb0e0[_0x3ded('0x4b')],{})[_0x3ded('0x27')](function(_0x10de2b){var _0x2bb6a3=_0x5eb0e0[_0x3ded('0x4c')]['get']({'plain':!![]});if(!_0x2bb6a3)throw new Error(_0x3ded('0x4d'));if(_0x2bb6a3[_0x3ded('0x4e')]==='user'){var _0xb92f9f=_0x10de2b[_0x3ded('0x4f')]({'plain':!![]});var _0x2382fe=_0x3ded('0x28');return db['UserProfileSection'][_0x3ded('0x49')]({'where':{'name':_0x2382fe,'userProfileId':_0x2bb6a3[_0x3ded('0x50')]},'raw':!![]})[_0x3ded('0x27')](function(_0x381072){if(_0x381072&&_0x381072[_0x3ded('0x51')]===0x0){return db['UserProfileResource'][_0x3ded('0x4a')]({'name':_0xb92f9f['name'],'resourceId':_0xb92f9f['id'],'type':_0x381072[_0x3ded('0x33')],'sectionId':_0x381072['id']},{})['then'](function(){return _0x10de2b;});}else{return _0x10de2b;}})[_0x3ded('0x44')](function(_0x414488){logger[_0x3ded('0x2a')](_0x3ded('0x52'),_0x414488);throw _0x414488;});}return _0x10de2b;})['then'](respondWithResult(_0x2dc0d0,0xc9))['catch'](handleError(_0x2dc0d0,null));};exports[_0x3ded('0x53')]=function(_0x59e46e,_0x30d749){if(_0x59e46e[_0x3ded('0x4b')]['id']){delete _0x59e46e[_0x3ded('0x4b')]['id'];}return db[_0x3ded('0x2f')][_0x3ded('0x49')]({'where':{'id':_0x59e46e[_0x3ded('0x46')]['id']}})['then'](handleEntityNotFound(_0x30d749,null))['then'](saveUpdates(_0x59e46e['body'],null))[_0x3ded('0x27')](respondWithResult(_0x30d749,null))[_0x3ded('0x44')](handleError(_0x30d749,null));};exports['destroy']=function(_0x3feae6,_0x45fd7f){return db[_0x3ded('0x2f')]['find']({'where':{'id':_0x3feae6['params']['id']}})['then'](handleEntityNotFound(_0x45fd7f,null))[_0x3ded('0x27')](removeEntity(_0x45fd7f,null))['catch'](handleError(_0x45fd7f,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 73dbc67..8ba4d83 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 _0xda45=['../../config/environment','./variable.attributes','exports','Variable','tools_variables','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3e5fe4,_0x167d61){var _0x1ebae4=function(_0x3e8fc3){while(--_0x3e8fc3){_0x3e5fe4['push'](_0x3e5fe4['shift']());}};_0x1ebae4(++_0x167d61);}(_0xda45,0x71));var _0x5da4=function(_0x3ba3e3,_0x122754){_0x3ba3e3=_0x3ba3e3-0x0;var _0x28115c=_0xda45[_0x3ba3e3];return _0x28115c;};'use strict';var _=require('lodash');var util=require(_0x5da4('0x0'));var logger=require(_0x5da4('0x1'))(_0x5da4('0x2'));var moment=require(_0x5da4('0x3'));var BPromise=require(_0x5da4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5da4('0x5'));var rimraf=require(_0x5da4('0x6'));var config=require(_0x5da4('0x7'));var attributes=require(_0x5da4('0x8'));module[_0x5da4('0x9')]=function(_0x447b81,_0x3c9a62){return _0x447b81['define'](_0x5da4('0xa'),attributes,{'tableName':_0x5da4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69f2=['tools_variables','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./variable.attributes','define','Variable'];(function(_0x3a1cca,_0xf9cf7e){var _0x53b71c=function(_0x56c49f){while(--_0x56c49f){_0x3a1cca['push'](_0x3a1cca['shift']());}};_0x53b71c(++_0xf9cf7e);}(_0x69f2,0xe5));var _0x269f=function(_0x54d97c,_0x1219f9){_0x54d97c=_0x54d97c-0x0;var _0x5ce581=_0x69f2[_0x54d97c];return _0x5ce581;};'use strict';var _=require('lodash');var util=require(_0x269f('0x0'));var logger=require(_0x269f('0x1'))(_0x269f('0x2'));var moment=require(_0x269f('0x3'));var BPromise=require(_0x269f('0x4'));var rp=require(_0x269f('0x5'));var fs=require('fs');var path=require(_0x269f('0x6'));var rimraf=require(_0x269f('0x7'));var config=require('../../config/environment');var attributes=require(_0x269f('0x8'));module['exports']=function(_0x5cdd7e,_0x2cf68d){return _0x5cdd7e[_0x269f('0x9')](_0x269f('0xa'),attributes,{'tableName':_0x269f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index f50e03d..d149eea 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 _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(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0x1cb9,0x14e));var _0x91cb=function(_0x9767e5,_0x221757){_0x9767e5=_0x9767e5-0x0;var _0x32dadd=_0x1cb9[_0x9767e5];return _0x32dadd;};'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 +var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xa41a,0x6b));var _0xaa41=function(_0x264fae,_0x1c6d07){_0x264fae=_0x264fae-0x0;var _0x4b5a3c=_0xa41a[_0x264fae];return _0x4b5a3c;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index e1903b2..9e5657f 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 _0x9f7e=['get','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','pull','/restart','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller'];(function(_0x3cdbc7,_0x2a7cb3){var _0x422d20=function(_0x11ac87){while(--_0x11ac87){_0x3cdbc7['push'](_0x3cdbc7['shift']());}};_0x422d20(++_0x2a7cb3);}(_0x9f7e,0xfc));var _0xe9f7=function(_0x505ab8,_0xaff7c8){_0x505ab8=_0x505ab8-0x0;var _0x1515da=_0x9f7e[_0x505ab8];return _0x1515da;};'use strict';var express=require(_0xe9f7('0x0'));var router=express[_0xe9f7('0x1')]();var auth=require(_0xe9f7('0x2'));var controller=require(_0xe9f7('0x3'));router[_0xe9f7('0x4')]('/',controller['index']);router['get'](_0xe9f7('0x5'),auth[_0xe9f7('0x6')](),auth[_0xe9f7('0x7')](),controller['fetch']);router[_0xe9f7('0x4')](_0xe9f7('0x8'),auth[_0xe9f7('0x6')](),auth[_0xe9f7('0x7')](),controller[_0xe9f7('0x9')]);router[_0xe9f7('0x4')](_0xe9f7('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xe9f7('0xb')]);router[_0xe9f7('0x4')](_0xe9f7('0xc'),auth[_0xe9f7('0x6')](),controller[_0xe9f7('0xd')]);router[_0xe9f7('0x4')]('/migrations',controller[_0xe9f7('0xe')]);module[_0xe9f7('0xf')]=router; \ No newline at end of file +var _0xa97c=['restart','/migrations','migrations','exports','express','../../components/auth/service','get','index','/fetch','canUpdate','fetch','/reset','isAuthenticated','/pull','pull','/restart'];(function(_0x2ed88f,_0x5bc5ae){var _0x17ca96=function(_0x2be0dc){while(--_0x2be0dc){_0x2ed88f['push'](_0x2ed88f['shift']());}};_0x17ca96(++_0x5bc5ae);}(_0xa97c,0x134));var _0xca97=function(_0xbcddc9,_0x173eda){_0xbcddc9=_0xbcddc9-0x0;var _0x2fa1c0=_0xa97c[_0xbcddc9];return _0x2fa1c0;};'use strict';var express=require(_0xca97('0x0'));var router=express['Router']();var auth=require(_0xca97('0x1'));var controller=require('./version.controller');router[_0xca97('0x2')]('/',controller[_0xca97('0x3')]);router[_0xca97('0x2')](_0xca97('0x4'),auth['isAuthenticated'](),auth[_0xca97('0x5')](),controller[_0xca97('0x6')]);router[_0xca97('0x2')](_0xca97('0x7'),auth[_0xca97('0x8')](),auth['canUpdate'](),controller['reset']);router['get'](_0xca97('0x9'),auth['isAuthenticated'](),auth[_0xca97('0x5')](),controller[_0xca97('0xa')]);router[_0xca97('0x2')](_0xca97('0xb'),auth[_0xca97('0x8')](),controller[_0xca97('0xc')]);router[_0xca97('0x2')](_0xca97('0xd'),controller[_0xca97('0xe')]);module[_0xca97('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 74542a7..7364769 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 _0x5520=['replace','.js','push','length','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server'];(function(_0x35c4b6,_0x3f462e){var _0x444f74=function(_0xee09cb){while(--_0xee09cb){_0x35c4b6['push'](_0x35c4b6['shift']());}};_0x444f74(++_0x3f462e);}(_0x5520,0x187));var _0x0552=function(_0xefe955,_0x139c69){_0xefe955=_0xefe955-0x0;var _0x50ce7d=_0x5520[_0xefe955];return _0x50ce7d;};'use strict';var Umzug=require(_0x0552('0x0'));var path=require(_0x0552('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x0552('0x2'))(module,_0x0552('0x3'));var compareVersions=require(_0x0552('0x4'));var exec=require(_0x0552('0x5'))[_0x0552('0x6')];var db=require(_0x0552('0x7'))['db'];var config=require(_0x0552('0x8'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x0552('0x9'));var git=require(_0x0552('0xa'))(config['root']);exports[_0x0552('0xb')]=function(_0x687486,_0x1259ab){var _0x50e664={'current':module[_0x0552('0xc')][_0x0552('0x3')],'phonebar':0x2};if(_0x687486['query']&&_0x687486[_0x0552('0xd')][_0x0552('0xe')]){return git[_0x0552('0xf')]()[_0x0552('0x10')](function(_0x325a9a,_0x1a5ea0){_0x50e664[_0x0552('0xe')]=(_0x325a9a?module['exports'][_0x0552('0x3')]:_0x1a5ea0[_0x0552('0xe')])||_0x0552('0x11');return _0x1259ab[_0x0552('0x12')](0xc8)['json'](_0x50e664);});}else{return _0x1259ab['status'](0xc8)[_0x0552('0x13')](_0x50e664);}};exports[_0x0552('0xf')]=function(_0x16d955,_0x352a0f){return git[_0x0552('0xf')]([_0x0552('0x14'),'master'],function(_0x27f91e){if(_0x27f91e){logger[_0x0552('0x15')](_0x27f91e);return _0x352a0f[_0x0552('0x12')](0x1f4)[_0x0552('0x13')](_0x27f91e);}logger[_0x0552('0x16')](_0x0552('0x17'));return _0x352a0f['status'](0xc8)['json']({'output':_0x0552('0x18')});});};exports['reset']=function(_0x4a1b0d,_0x4ee6d9){return git['reset']([_0x0552('0x19'),'FETCH_HEAD'],function(_0x52a729){if(_0x52a729){logger['error'](_0x52a729);return _0x4ee6d9[_0x0552('0x12')](0x1f4)[_0x0552('0x13')](_0x52a729);}logger[_0x0552('0x16')](_0x0552('0x1a'));return _0x4ee6d9['status'](0xc8)[_0x0552('0x13')]({'output':_0x0552('0x1b')});});};exports[_0x0552('0x1c')]=function(_0x3f7786,_0x36e938){exec(_0x0552('0x1d'),function(_0x1b5969,_0x2d6545,_0x561a63){logger[_0x0552('0x16')](_0x2d6545);logger['info'](_0x561a63);if(_0x1b5969){logger['error'](_0x1b5969);return _0x36e938['status'](0x1f4)[_0x0552('0x13')](_0x1b5969);}return _0x36e938[_0x0552('0x12')](0xc8)[_0x0552('0x13')]({'output':_0x2d6545});});};exports[_0x0552('0x1e')]=function(_0x138cb5,_0xd57eea){return pm2[_0x0552('0x1e')](_0x0552('0x1f'))[_0x0552('0x20')](function(_0x2d2f9b){logger[_0x0552('0x16')](_0x0552('0x21'),_0x2d2f9b);return _0xd57eea['status'](0xc8)['json']({'output':_0x0552('0x22')});})[_0x0552('0x23')](function(_0x2126c0){logger[_0x0552('0x15')](_0x2126c0);return _0xd57eea[_0x0552('0x12')](0x1f4)[_0x0552('0x13')](_0x2126c0);});};exports[_0x0552('0x24')]=function(_0x9f2be3,_0x52bbd1){var _0x2dc63f=fs[_0x0552('0x25')](path[_0x0552('0x26')](config[_0x0552('0x27')],_0x0552('0x28'),'migrations'));var _0x6677de=[];for(var _0x4c2356=0x0;_0x4c2356<_0x2dc63f['length'];_0x4c2356++){var _0x2ca6aa=_0x2dc63f[_0x4c2356][_0x0552('0x29')](_0x0552('0x2a'),'');if(compareVersions(module[_0x0552('0xc')]['version'],_0x2ca6aa)===-0x1){_0x6677de[_0x0552('0x2b')](_0x2ca6aa);}}if(_0x6677de[_0x0552('0x2c')]){var _0x48f00b=_0x6677de['sort'](compareVersions);var _0x1c5e83=new Umzug({'storage':_0x0552('0x2d'),'storageOptions':{'model':db[_0x0552('0x2e')],'modelName':_0x0552('0x2e'),'columnName':_0x0552('0x3')},'migrations':{'params':[db['sequelize'][_0x0552('0x2f')](),db[_0x0552('0x2d')][_0x0552('0x30')],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[_0x0552('0x26')](config[_0x0552('0x27')],'server','migrations'),'pattern':/\.js$/}});_0x1c5e83['up']({'migrations':_[_0x0552('0x31')](_0x48f00b,function(_0x3490a9){return _0x3490a9+_0x0552('0x2a');})})[_0x0552('0x20')](function(){return _0x52bbd1[_0x0552('0x12')](0xc8)[_0x0552('0x13')]({'output':_0x0552('0x32')+module['exports']['version']+_0x0552('0x33')+_['last'](_0x48f00b),'migrations':_[_0x0552('0x26')](_0x48f00b)});})[_0x0552('0x23')](function(_0x3a8e49){if(_0x3a8e49 instanceof db[_0x0552('0x2d')][_0x0552('0x34')]){return _0x52bbd1[_0x0552('0x12')](0xc8)[_0x0552('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x52bbd1[_0x0552('0x12')](0x1f4)['json'](_0x3a8e49);}});}else{return _0x52bbd1['status'](0xc8)[_0x0552('0x13')]({'output':_0x0552('0x35')});}}; \ No newline at end of file +var _0xbe7c=['status','json','origin','master','error','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','root','server','length','replace','.js','exports','push','sequelize','Migration','getQueryInterface','constructor','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','index','query','fetch','tags','latest','2.0.0'];(function(_0x4bed2d,_0x4ebe20){var _0xe82d9f=function(_0x54d1af){while(--_0x54d1af){_0x4bed2d['push'](_0x4bed2d['shift']());}};_0xe82d9f(++_0x4ebe20);}(_0xbe7c,0x147));var _0xcbe7=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xbe7c[_0x3ab51d];return _0x29a04e;};'use strict';var Umzug=require(_0xcbe7('0x0'));var path=require(_0xcbe7('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0xcbe7('0x2'));var compareVersions=require(_0xcbe7('0x3'));var exec=require(_0xcbe7('0x4'))['exec'];var db=require(_0xcbe7('0x5'))['db'];var config=require(_0xcbe7('0x6'));var pm2=require('../../config/pm2');var logger=require(_0xcbe7('0x7'))(_0xcbe7('0x8'));var git=require(_0xcbe7('0x9'))(config['root']);exports[_0xcbe7('0xa')]=function(_0x3f1f31,_0x542dcb){var _0x1400d6={'current':module['exports'][_0xcbe7('0x2')],'phonebar':0x2};if(_0x3f1f31[_0xcbe7('0xb')]&&_0x3f1f31[_0xcbe7('0xb')]['latest']){return git[_0xcbe7('0xc')]()[_0xcbe7('0xd')](function(_0x52da51,_0x452fa4){_0x1400d6[_0xcbe7('0xe')]=(_0x52da51?module['exports']['version']:_0x452fa4['latest'])||_0xcbe7('0xf');return _0x542dcb[_0xcbe7('0x10')](0xc8)[_0xcbe7('0x11')](_0x1400d6);});}else{return _0x542dcb[_0xcbe7('0x10')](0xc8)['json'](_0x1400d6);}};exports[_0xcbe7('0xc')]=function(_0x1cd1a5,_0x4b3376){return git[_0xcbe7('0xc')]([_0xcbe7('0x12'),_0xcbe7('0x13')],function(_0x4ad724){if(_0x4ad724){logger[_0xcbe7('0x14')](_0x4ad724);return _0x4b3376['status'](0x1f4)[_0xcbe7('0x11')](_0x4ad724);}logger['info']('git\x20fetch');return _0x4b3376['status'](0xc8)['json']({'output':_0xcbe7('0x15')});});};exports[_0xcbe7('0x16')]=function(_0x1cc5c4,_0x437bf9){return git[_0xcbe7('0x16')]([_0xcbe7('0x17'),_0xcbe7('0x18')],function(_0x9aeece){if(_0x9aeece){logger[_0xcbe7('0x14')](_0x9aeece);return _0x437bf9['status'](0x1f4)[_0xcbe7('0x11')](_0x9aeece);}logger[_0xcbe7('0x19')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x437bf9[_0xcbe7('0x10')](0xc8)[_0xcbe7('0x11')]({'output':_0xcbe7('0x1a')});});};exports['pull']=function(_0x5c426f,_0x4983da){exec(_0xcbe7('0x1b'),function(_0x43946f,_0xf587ea,_0x121885){logger[_0xcbe7('0x19')](_0xf587ea);logger[_0xcbe7('0x19')](_0x121885);if(_0x43946f){logger['error'](_0x43946f);return _0x4983da['status'](0x1f4)[_0xcbe7('0x11')](_0x43946f);}return _0x4983da[_0xcbe7('0x10')](0xc8)[_0xcbe7('0x11')]({'output':_0xf587ea});});};exports[_0xcbe7('0x1c')]=function(_0x4d33c6,_0x46ea6b){return pm2[_0xcbe7('0x1c')]('motion2')['then'](function(_0x4bfc60){logger[_0xcbe7('0x19')](_0xcbe7('0x1d'),_0x4bfc60);return _0x46ea6b['status'](0xc8)[_0xcbe7('0x11')]({'output':_0xcbe7('0x1e')});})['catch'](function(_0x47ca45){logger['error'](_0x47ca45);return _0x46ea6b[_0xcbe7('0x10')](0x1f4)[_0xcbe7('0x11')](_0x47ca45);});};exports[_0xcbe7('0x1f')]=function(_0x263309,_0x3e89fd){var _0x525362=fs[_0xcbe7('0x20')](path[_0xcbe7('0x21')](config[_0xcbe7('0x22')],_0xcbe7('0x23'),_0xcbe7('0x1f')));var _0x2089a8=[];for(var _0x1c7159=0x0;_0x1c7159<_0x525362[_0xcbe7('0x24')];_0x1c7159++){var _0x457871=_0x525362[_0x1c7159][_0xcbe7('0x25')](_0xcbe7('0x26'),'');if(compareVersions(module[_0xcbe7('0x27')]['version'],_0x457871)===-0x1){_0x2089a8[_0xcbe7('0x28')](_0x457871);}}if(_0x2089a8[_0xcbe7('0x24')]){var _0x579b57=_0x2089a8['sort'](compareVersions);var _0x3f5ec1=new Umzug({'storage':_0xcbe7('0x29'),'storageOptions':{'model':db['Migration'],'modelName':_0xcbe7('0x2a'),'columnName':_0xcbe7('0x2')},'migrations':{'params':[db[_0xcbe7('0x29')][_0xcbe7('0x2b')](),db[_0xcbe7('0x29')][_0xcbe7('0x2c')],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['join'](config[_0xcbe7('0x22')],'server',_0xcbe7('0x1f')),'pattern':/\.js$/}});_0x3f5ec1['up']({'migrations':_['map'](_0x579b57,function(_0x3f1903){return _0x3f1903+_0xcbe7('0x26');})})['then'](function(){return _0x3e89fd[_0xcbe7('0x10')](0xc8)[_0xcbe7('0x11')]({'output':_0xcbe7('0x2d')+module[_0xcbe7('0x27')][_0xcbe7('0x2')]+_0xcbe7('0x2e')+_['last'](_0x579b57),'migrations':_['join'](_0x579b57)});})['catch'](function(_0x41ba88){if(_0x41ba88 instanceof db[_0xcbe7('0x29')][_0xcbe7('0x2f')]){return _0x3e89fd['status'](0xc8)[_0xcbe7('0x11')]({'output':_0xcbe7('0x30')});}else{return _0x3e89fd[_0xcbe7('0x10')](0x1f4)[_0xcbe7('0x11')](_0x41ba88);}});}else{return _0x3e89fd[_0xcbe7('0x10')](0xc8)[_0xcbe7('0x11')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 33abf99..e755813 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 _0x2db6=['./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1a3ce1,_0x40ed90){var _0x24aaae=function(_0x4ad875){while(--_0x4ad875){_0x1a3ce1['push'](_0x1a3ce1['shift']());}};_0x24aaae(++_0x40ed90);}(_0x2db6,0xfe));var _0x62db=function(_0x33dcef,_0x459eeb){_0x33dcef=_0x33dcef-0x0;var _0x2e747c=_0x2db6[_0x33dcef];return _0x2e747c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x62db('0x0'));var timeout=require(_0x62db('0x1'));var express=require(_0x62db('0x2'));var router=express['Router']();var fs_extra=require(_0x62db('0x3'));var auth=require(_0x62db('0x4'));var interaction=require(_0x62db('0x5'));var config=require('../../config/environment');var controller=require(_0x62db('0x6'));router[_0x62db('0x7')]('/',auth[_0x62db('0x8')](),controller[_0x62db('0x9')]);router[_0x62db('0x7')](_0x62db('0xa'),auth['isAuthenticated'](),controller[_0x62db('0xb')]);router[_0x62db('0x7')](_0x62db('0xc'),auth[_0x62db('0x8')](),controller[_0x62db('0xd')]);router[_0x62db('0xe')]('/',auth['isAuthenticated'](),controller[_0x62db('0xf')]);router['put'](_0x62db('0xc'),auth['isAuthenticated'](),controller[_0x62db('0x10')]);router[_0x62db('0x11')](_0x62db('0xc'),auth[_0x62db('0x8')](),controller[_0x62db('0x12')]);module[_0x62db('0x13')]=router; \ No newline at end of file +var _0xae3c=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','create','put','delete'];(function(_0x2e608d,_0x3066ce){var _0x764349=function(_0x4b30e0){while(--_0x4b30e0){_0x2e608d['push'](_0x2e608d['shift']());}};_0x764349(++_0x3066ce);}(_0xae3c,0x7e));var _0xcae3=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xae3c[_0x68ee8b];return _0x5148f7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcae3('0x0'));var express=require('express');var router=express[_0xcae3('0x1')]();var fs_extra=require(_0xcae3('0x2'));var auth=require(_0xcae3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcae3('0x4'));var controller=require('./voiceAgentReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xcae3('0x5')](_0xcae3('0x6'),auth[_0xcae3('0x7')](),controller[_0xcae3('0x8')]);router[_0xcae3('0x5')](_0xcae3('0x9'),auth[_0xcae3('0x7')](),controller[_0xcae3('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcae3('0xb')]);router[_0xcae3('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xcae3('0xd')](_0xcae3('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 935137e..9e9a713 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 _0xe77c=['BOOLEAN','INTEGER','sequelize','exports','STRING','DATE'];(function(_0x5df1ee,_0x2d0b80){var _0x8f0d50=function(_0x425754){while(--_0x425754){_0x5df1ee['push'](_0x5df1ee['shift']());}};_0x8f0d50(++_0x2d0b80);}(_0xe77c,0x176));var _0xce77=function(_0x3972dd,_0x298e3f){_0x3972dd=_0x3972dd-0x0;var _0x3a29c8=_0xe77c[_0x3972dd];return _0x3a29c8;};'use strict';var Sequelize=require(_0xce77('0x0'));module[_0xce77('0x1')]={'type':{'type':Sequelize[_0xce77('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xce77('0x2')]},'calleridname':{'type':Sequelize[_0xce77('0x2')]},'queue':{'type':Sequelize[_0xce77('0x2')]},'interface':{'type':Sequelize[_0xce77('0x2')]},'membername':{'type':Sequelize[_0xce77('0x2')]},'agentcalledAt':{'type':Sequelize[_0xce77('0x3')]},'agentconnectAt':{'type':Sequelize[_0xce77('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xce77('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xce77('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xce77('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xce77('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xce77('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xce77('0x5')]},'reason':{'type':Sequelize[_0xce77('0x2')]},'lastevent':{'type':Sequelize[_0xce77('0x2')]},'channel':{'type':Sequelize[_0xce77('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xce77('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xce77('0x2')]},'language':{'type':Sequelize[_0xce77('0x2')]},'accountcode':{'type':Sequelize[_0xce77('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xce77('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xce77('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xce77('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xce77('0x2')]},'destlanguage':{'type':Sequelize[_0xce77('0x2')]},'destaccountcode':{'type':Sequelize[_0xce77('0x2')]},'destcontext':{'type':Sequelize[_0xce77('0x2')]},'destexten':{'type':Sequelize[_0xce77('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xce77('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xce77('0x2')]},'transfer':{'type':Sequelize[_0xce77('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xce77('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xce77('0x2')]},'transferuniqueid':{'type':Sequelize[_0xce77('0x2')]},'agententerreason':{'type':Sequelize[_0xce77('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x955f=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x531041,_0x2f4c81){var _0x2330b6=function(_0x5d3a2a){while(--_0x5d3a2a){_0x531041['push'](_0x531041['shift']());}};_0x2330b6(++_0x2f4c81);}(_0x955f,0x1eb));var _0xf955=function(_0x45153d,_0x9b215b){_0x45153d=_0x45153d-0x0;var _0x563a93=_0x955f[_0x45153d];return _0x563a93;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'type':{'type':Sequelize[_0xf955('0x2')]},'uniqueid':{'type':Sequelize[_0xf955('0x2')]},'calleridnum':{'type':Sequelize[_0xf955('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xf955('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xf955('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xf955('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xf955('0x3')]},'agentdumpAt':{'type':Sequelize[_0xf955('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xf955('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xf955('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xf955('0x5')]},'agentacw':{'type':Sequelize[_0xf955('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf955('0x5')]},'reason':{'type':Sequelize[_0xf955('0x2')]},'lastevent':{'type':Sequelize[_0xf955('0x2')]},'channel':{'type':Sequelize[_0xf955('0x2')]},'channelstate':{'type':Sequelize[_0xf955('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xf955('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf955('0x2')]},'accountcode':{'type':Sequelize[_0xf955('0x2')]},'context':{'type':Sequelize[_0xf955('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf955('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xf955('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf955('0x2')]},'destcalleridname':{'type':Sequelize[_0xf955('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf955('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xf955('0x2')]},'destlanguage':{'type':Sequelize[_0xf955('0x2')]},'destaccountcode':{'type':Sequelize[_0xf955('0x2')]},'destcontext':{'type':Sequelize[_0xf955('0x2')]},'destexten':{'type':Sequelize[_0xf955('0x2')]},'destpriority':{'type':Sequelize[_0xf955('0x2')]},'destuniqueid':{'type':Sequelize[_0xf955('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xf955('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf955('0x2')],'comment':_0xf955('0x6')},'transferexten':{'type':Sequelize[_0xf955('0x2')]},'transferuniqueid':{'type':Sequelize[_0xf955('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 98e1b1a..d7503b9 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(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 fad8fc4..0bf0f70 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 _0xbd51=['VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','bluebird','./voiceAgentReport.attributes','exports','define'];(function(_0x1afdce,_0x1608b0){var _0x5330fe=function(_0xef3146){while(--_0xef3146){_0x1afdce['push'](_0x1afdce['shift']());}};_0x5330fe(++_0x1608b0);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1112c1,_0x49a9cb){_0x1112c1=_0x1112c1-0x0;var _0x4fc52c=_0xbd51[_0x1112c1];return _0x4fc52c;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bd5('0x5'));module[_0x1bd5('0x6')]=function(_0x43e6b6,_0x59ddfb){return _0x43e6b6[_0x1bd5('0x7')](_0x1bd5('0x8'),attributes,{'tableName':_0x1bd5('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1bd5('0xa'),_0x1bd5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x5e0a09,_0x2ae193){var _0x4d72f3=function(_0x4c2031){while(--_0x4c2031){_0x5e0a09['push'](_0x5e0a09['shift']());}};_0x4d72f3(++_0x2ae193);}(_0x8ef6,0xf2));var _0x68ef=function(_0x317df4,_0xff1706){_0x317df4=_0x317df4-0x0;var _0x307c0f=_0x8ef6[_0x317df4];return _0x307c0f;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x68ef('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 01a5c05..f825e08 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 _0x0876=['VoiceAgentReport','create','body','options','debug','stringify','update','where','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateVoiceAgentReport'];(function(_0x1bbd2f,_0x3d13c6){var _0x1bf581=function(_0x41060b){while(--_0x41060b){_0x1bbd2f['push'](_0x1bbd2f['shift']());}};_0x1bf581(++_0x3d13c6);}(_0x0876,0x1ca));var _0x6087=function(_0x41f345,_0x513e4a){_0x41f345=_0x41f345-0x0;var _0x41fbc3=_0x0876[_0x41f345];return _0x41fbc3;};'use strict';var _=require(_0x6087('0x0'));var util=require(_0x6087('0x1'));var moment=require(_0x6087('0x2'));var BPromise=require(_0x6087('0x3'));var rs=require(_0x6087('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6087('0x5'))['db'];var utils=require(_0x6087('0x6'));var logger=require(_0x6087('0x7'))(_0x6087('0x8'));var config=require(_0x6087('0x9'));var jayson=require(_0x6087('0xa'));var client=jayson[_0x6087('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9700f4,_0x235b97,_0x43b959){return new BPromise(function(_0x139f91,_0x458182){return client[_0x6087('0xc')](_0x9700f4,_0x43b959)[_0x6087('0xd')](function(_0x7721fd){logger['info'](_0x6087('0xe'),_0x235b97,'request\x20sent');logger['debug'](_0x6087('0xf'),_0x235b97,'request\x20sent',JSON['stringify'](_0x7721fd));if(_0x7721fd[_0x6087('0x10')]){if(_0x7721fd[_0x6087('0x10')]['code']===0x1f4){logger[_0x6087('0x10')](_0x6087('0xe'),_0x235b97,_0x7721fd['error'][_0x6087('0x11')]);return _0x458182(_0x7721fd[_0x6087('0x10')][_0x6087('0x11')]);}logger[_0x6087('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x235b97,_0x7721fd[_0x6087('0x10')][_0x6087('0x11')]);return _0x139f91(_0x7721fd[_0x6087('0x10')][_0x6087('0x11')]);}else{logger[_0x6087('0x12')](_0x6087('0xe'),_0x235b97,'request\x20sent');_0x139f91(_0x7721fd[_0x6087('0x13')][_0x6087('0x11')]);}})[_0x6087('0x14')](function(_0x51e202){logger[_0x6087('0x10')](_0x6087('0xe'),_0x235b97,_0x51e202);_0x458182(_0x51e202);});});}exports[_0x6087('0x15')]=function(_0x2da75f){var _0x259e96=this;return new Promise(function(_0xc97263,_0x468ebb){return db[_0x6087('0x16')][_0x6087('0x17')](_0x2da75f[_0x6087('0x18')],{'raw':_0x2da75f[_0x6087('0x19')]?_0x2da75f[_0x6087('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x55b3f1){logger[_0x6087('0x12')]('CreateVoiceAgentReport',_0x2da75f);logger[_0x6087('0x1a')]('CreateVoiceAgentReport',_0x2da75f,JSON[_0x6087('0x1b')](_0x55b3f1));_0xc97263(_0x55b3f1);})[_0x6087('0x14')](function(_0x34f8ea){logger['error']('CreateVoiceAgentReport',_0x34f8ea['message'],_0x2da75f);_0x468ebb(_0x259e96['error'](0x1f4,_0x34f8ea['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x5dfbfa){var _0x5839e6=this;return new Promise(function(_0x57cd58,_0x24d852){return db['VoiceAgentReport'][_0x6087('0x1c')](_0x5dfbfa[_0x6087('0x18')],{'raw':_0x5dfbfa['options']?_0x5dfbfa['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dfbfa['options']?_0x5dfbfa[_0x6087('0x19')][_0x6087('0x1d')]||null:null,'attributes':_0x5dfbfa[_0x6087('0x19')]?_0x5dfbfa[_0x6087('0x19')]['attributes']||null:null,'limit':_0x5dfbfa[_0x6087('0x19')]?_0x5dfbfa[_0x6087('0x19')][_0x6087('0x1e')]||null:null})['then'](function(_0x106e3c){logger[_0x6087('0x12')](_0x6087('0x1f'),_0x5dfbfa);logger[_0x6087('0x1a')](_0x6087('0x1f'),_0x5dfbfa,JSON[_0x6087('0x1b')](_0x106e3c));_0x57cd58(_0x106e3c);})[_0x6087('0x14')](function(_0xf8d470){logger[_0x6087('0x10')](_0x6087('0x1f'),_0xf8d470[_0x6087('0x11')],_0x5dfbfa);_0x24d852(_0x5839e6['error'](0x1f4,_0xf8d470[_0x6087('0x11')]));});});}; \ No newline at end of file +var _0x568f=['attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','debug','catch','update','where'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x568f,0x135));var _0xf568=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x568f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf568('0x0'));var util=require(_0xf568('0x1'));var moment=require(_0xf568('0x2'));var BPromise=require(_0xf568('0x3'));var rs=require(_0xf568('0x4'));var fs=require('fs');var Redis=require(_0xf568('0x5'));var db=require(_0xf568('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf568('0x7'))(_0xf568('0x8'));var config=require('../../config/environment');var jayson=require(_0xf568('0x9'));var client=jayson[_0xf568('0xa')][_0xf568('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54c84a,_0x1610bf,_0x19c3c8){return new BPromise(function(_0x1a8d6b,_0x7738e1){return client[_0xf568('0xc')](_0x54c84a,_0x19c3c8)[_0xf568('0xd')](function(_0x3616a5){logger[_0xf568('0xe')](_0xf568('0xf'),_0x1610bf,'request\x20sent');logger['debug'](_0xf568('0x10'),_0x1610bf,_0xf568('0x11'),JSON[_0xf568('0x12')](_0x3616a5));if(_0x3616a5[_0xf568('0x13')]){if(_0x3616a5[_0xf568('0x13')]['code']===0x1f4){logger[_0xf568('0x13')](_0xf568('0xf'),_0x1610bf,_0x3616a5[_0xf568('0x13')][_0xf568('0x14')]);return _0x7738e1(_0x3616a5[_0xf568('0x13')][_0xf568('0x14')]);}logger['error'](_0xf568('0xf'),_0x1610bf,_0x3616a5['error']['message']);return _0x1a8d6b(_0x3616a5['error'][_0xf568('0x14')]);}else{logger['info'](_0xf568('0xf'),_0x1610bf,'request\x20sent');_0x1a8d6b(_0x3616a5['result'][_0xf568('0x14')]);}})['catch'](function(_0x1feb5c){logger['error'](_0xf568('0xf'),_0x1610bf,_0x1feb5c);_0x7738e1(_0x1feb5c);});});}exports[_0xf568('0x15')]=function(_0x2b104f){var _0x261dc6=this;return new Promise(function(_0x5747b2,_0x5f06ae){return db[_0xf568('0x16')][_0xf568('0x17')](_0x2b104f[_0xf568('0x18')],{'raw':_0x2b104f['options']?_0x2b104f[_0xf568('0x19')][_0xf568('0x1a')]===undefined?!![]:![]:!![]})[_0xf568('0xd')](function(_0x327470){logger['info'](_0xf568('0x15'),_0x2b104f);logger[_0xf568('0x1b')](_0xf568('0x15'),_0x2b104f,JSON[_0xf568('0x12')](_0x327470));_0x5747b2(_0x327470);})[_0xf568('0x1c')](function(_0x210258){logger[_0xf568('0x13')](_0xf568('0x15'),_0x210258['message'],_0x2b104f);_0x5f06ae(_0x261dc6[_0xf568('0x13')](0x1f4,_0x210258[_0xf568('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x30f342){var _0x2589f5=this;return new Promise(function(_0x593a8e,_0x474c61){return db[_0xf568('0x16')][_0xf568('0x1d')](_0x30f342[_0xf568('0x18')],{'raw':_0x30f342[_0xf568('0x19')]?_0x30f342[_0xf568('0x19')][_0xf568('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30f342[_0xf568('0x19')]?_0x30f342[_0xf568('0x19')][_0xf568('0x1e')]||null:null,'attributes':_0x30f342[_0xf568('0x19')]?_0x30f342[_0xf568('0x19')][_0xf568('0x1f')]||null:null,'limit':_0x30f342[_0xf568('0x19')]?_0x30f342[_0xf568('0x19')][_0xf568('0x20')]||null:null})['then'](function(_0x128263){logger['info'](_0xf568('0x21'),_0x30f342);logger[_0xf568('0x1b')]('UpdateVoiceAgentReport',_0x30f342,JSON[_0xf568('0x12')](_0x128263));_0x593a8e(_0x128263);})[_0xf568('0x1c')](function(_0x593574){logger[_0xf568('0x13')](_0xf568('0x21'),_0x593574[_0xf568('0x14')],_0x30f342);_0x474c61(_0x2589f5[_0xf568('0x13')](0x1f4,_0x593574[_0xf568('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index a9f9b25..32b2cc4 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 _0xd508=['create','put','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','describe','/:id','post'];(function(_0x1259e3,_0x21b625){var _0x88195=function(_0x459278){while(--_0x459278){_0x1259e3['push'](_0x1259e3['shift']());}};_0x88195(++_0x21b625);}(_0xd508,0x197));var _0x8d50=function(_0x35d666,_0x1218f2){_0x35d666=_0x35d666-0x0;var _0x416f16=_0xd508[_0x35d666];return _0x416f16;};'use strict';var express=require(_0x8d50('0x0'));var router=express['Router']();var auth=require(_0x8d50('0x1'));var controller=require(_0x8d50('0x2'));router[_0x8d50('0x3')]('/',auth[_0x8d50('0x4')](),controller[_0x8d50('0x5')]);router[_0x8d50('0x3')]('/describe',auth[_0x8d50('0x4')](),controller[_0x8d50('0x6')]);router[_0x8d50('0x3')](_0x8d50('0x7'),auth[_0x8d50('0x4')](),controller['show']);router[_0x8d50('0x8')]('/',auth['isAuthenticated'](),controller[_0x8d50('0x9')]);router[_0x8d50('0xa')](_0x8d50('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x8d50('0xa')](_0x8d50('0xb'),auth[_0x8d50('0x4')](),controller[_0x8d50('0xc')]);router[_0x8d50('0xd')](_0x8d50('0x7'),auth[_0x8d50('0x4')](),controller[_0x8d50('0xe')]);module[_0x8d50('0xf')]=router; \ No newline at end of file +var _0x42ad=['index','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','../../components/auth/service','./voiceCallReport.controller'];(function(_0x9a9d4a,_0x2db676){var _0x113926=function(_0x335c90){while(--_0x335c90){_0x9a9d4a['push'](_0x9a9d4a['shift']());}};_0x113926(++_0x2db676);}(_0x42ad,0xee));var _0xd42a=function(_0x709bba,_0x3f9e22){_0x709bba=_0x709bba-0x0;var _0x12784f=_0x42ad[_0x709bba];return _0x12784f;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xd42a('0x0'));var controller=require(_0xd42a('0x1'));router['get']('/',auth['isAuthenticated'](),controller[_0xd42a('0x2')]);router[_0xd42a('0x3')](_0xd42a('0x4'),auth[_0xd42a('0x5')](),controller[_0xd42a('0x6')]);router['get']('/:id',auth[_0xd42a('0x5')](),controller[_0xd42a('0x7')]);router[_0xd42a('0x8')]('/',auth['isAuthenticated'](),controller[_0xd42a('0x9')]);router[_0xd42a('0xa')](_0xd42a('0xb'),auth['isAuthenticated'](),controller[_0xd42a('0xc')]);router['put']('/with-retry/:id',auth[_0xd42a('0x5')](),controller['updateWithRetry']);router[_0xd42a('0xd')](_0xd42a('0xb'),auth['isAuthenticated'](),controller[_0xd42a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 0b91d46..abb3bd8 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 _0x0abf=['ENUM','outbound','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING'];(function(_0x1f9b22,_0x3be141){var _0x5a6686=function(_0x23c2e0){while(--_0x23c2e0){_0x1f9b22['push'](_0x1f9b22['shift']());}};_0x5a6686(++_0x3be141);}(_0x0abf,0xe8));var _0xf0ab=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0abf[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xf0ab('0x1')]},'type':{'type':Sequelize[_0xf0ab('0x2')]('inbound','internal',_0xf0ab('0x3'),'inbound-fax',_0xf0ab('0x4'),_0xf0ab('0x5'))},'tag':{'type':Sequelize[_0xf0ab('0x1')]},'accountcode':{'type':Sequelize[_0xf0ab('0x1')]},'source':{'type':Sequelize[_0xf0ab('0x1')]},'destination':{'type':Sequelize[_0xf0ab('0x1')]},'destinationcontext':{'type':Sequelize[_0xf0ab('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf0ab('0x1')]},'destinationchannel':{'type':Sequelize[_0xf0ab('0x1')]},'lastapplication':{'type':Sequelize[_0xf0ab('0x1')]},'lastdata':{'type':Sequelize[_0xf0ab('0x6')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xf0ab('0x7')]},'answertime':{'type':Sequelize[_0xf0ab('0x7')]},'endtime':{'type':Sequelize[_0xf0ab('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xf0ab('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xf0ab('0x1')]},'userfield':{'type':Sequelize[_0xf0ab('0x1')]},'userDisposition':{'type':Sequelize[_0xf0ab('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xf0ab('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xf0ab('0x1')]},'note':{'type':Sequelize[_0xf0ab('0x1')]},'prefix':{'type':Sequelize[_0xf0ab('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xf0ab('0x1')]}}; \ No newline at end of file +var _0x3e22=['inbound','internal','outbound','dialer','STRING','TEXT','DATE','INTEGER','exports','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e22,0xa8));var _0x23e2=function(_0x57a381,_0xf90e44){_0x57a381=_0x57a381-0x0;var _0x198b6a=_0x3e22[_0x57a381];return _0x198b6a;};'use strict';var Sequelize=require('sequelize');module[_0x23e2('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x23e2('0x1')](_0x23e2('0x2'),_0x23e2('0x3'),_0x23e2('0x4'),'inbound-fax','outbound-fax',_0x23e2('0x5'))},'tag':{'type':Sequelize[_0x23e2('0x6')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x23e2('0x6')]},'destination':{'type':Sequelize[_0x23e2('0x6')]},'destinationcontext':{'type':Sequelize[_0x23e2('0x6')]},'callerid':{'type':Sequelize[_0x23e2('0x6')]},'channel':{'type':Sequelize[_0x23e2('0x6')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x23e2('0x6')]},'lastdata':{'type':Sequelize[_0x23e2('0x7')]},'starttime':{'type':Sequelize[_0x23e2('0x8')]},'systemanswertime':{'type':Sequelize[_0x23e2('0x8')]},'answertime':{'type':Sequelize[_0x23e2('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x23e2('0x9')]},'billableseconds':{'type':Sequelize[_0x23e2('0x9')]},'mohtime':{'type':Sequelize[_0x23e2('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x23e2('0x6')]},'amaflags':{'type':Sequelize[_0x23e2('0x6')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x23e2('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x23e2('0x6')]},'note':{'type':Sequelize[_0x23e2('0x6')]},'prefix':{'type':Sequelize[_0x23e2('0x6')]},'routeid':{'type':Sequelize[_0x23e2('0x9')]},'sipcallid':{'type':Sequelize[_0x23e2('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 5867ad6..112c9c9 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 _0xa9e0=['create','body','describe','user','uniqueid','No\x20such\x20Voice\x20Call\x20Report','lodash','../../components/parsers/qs','../../config/logger','promise-retry','status','json','offset','undefined','count','limit','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','alias','User','findAll','rows','catch','show','params'];(function(_0x40f3a6,_0xb97e5d){var _0x200a8f=function(_0x482cf5){while(--_0x482cf5){_0x40f3a6['push'](_0x40f3a6['shift']());}};_0x200a8f(++_0xb97e5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0x0a9e('0x0'));var qs=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var db=require('../../mysqldb')['db'];const promiseRetry=require(_0x0a9e('0x3'));function respondWithResult(_0x4ce2f1,_0x333808){_0x333808=_0x333808||0xc8;return function(_0x432180){if(_0x432180){return _0x4ce2f1[_0x0a9e('0x4')](_0x333808)[_0x0a9e('0x5')](_0x432180);}};}function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x6')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x7');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x6')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x8')]:_0x57b080[_0x0a9e('0x6')]+_0x57b080[_0x0a9e('0x9')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0x5')](_0x219af0);}return null;};}function saveUpdates(_0x36471c){return function(_0xd5b662){if(_0xd5b662){return _0xd5b662[_0x0a9e('0xa')](_0x36471c)[_0x0a9e('0xb')](function(_0x69aeb7){return _0x69aeb7;});}return null;};}function removeEntity(_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){return _0x4283ce[_0x0a9e('0xc')]()[_0x0a9e('0xb')](function(){_0x5db4b0[_0x0a9e('0x4')](0xcc)[_0x0a9e('0xd')]();});}};}function handleEntityNotFound(_0x4d5611){return function(_0x52a03d){if(!_0x52a03d){_0x4d5611[_0x0a9e('0xe')](0x194);}return _0x52a03d;};}function handleError(_0x5d0880,_0x1985b6){_0x1985b6=_0x1985b6||0x1f4;return function(_0x519dfd){logger[_0x0a9e('0xf')](_0x519dfd[_0x0a9e('0x10')]);if(_0x519dfd['name']){delete _0x519dfd[_0x0a9e('0x11')];}_0x5d0880['status'](_0x1985b6)[_0x0a9e('0x12')](_0x519dfd);};}exports[_0x0a9e('0x13')]=function(_0x106033,_0x205fd6){var _0x31b1ca={},_0x2eb11f={},_0x530eb7={'count':0x0,'rows':[]};var _0x20559e=_[_0x0a9e('0x14')](db[_0x0a9e('0x15')][_0x0a9e('0x16')],function(_0x105080){return{'name':_0x105080['fieldName'],'type':_0x105080[_0x0a9e('0x17')][_0x0a9e('0x18')]};});_0x2eb11f['model']=_[_0x0a9e('0x14')](_0x20559e,'name');_0x2eb11f['query']=_[_0x0a9e('0x19')](_0x106033[_0x0a9e('0x1a')]);_0x2eb11f[_0x0a9e('0x1b')]=_[_0x0a9e('0x1c')](_0x2eb11f['model'],_0x2eb11f[_0x0a9e('0x1a')]);_0x31b1ca[_0x0a9e('0x1d')]=_[_0x0a9e('0x1c')](_0x2eb11f[_0x0a9e('0x1e')],qs[_0x0a9e('0x1f')](_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x1f')]));_0x31b1ca['attributes']=_0x31b1ca['attributes'][_0x0a9e('0x20')]?_0x31b1ca[_0x0a9e('0x1d')]:_0x2eb11f[_0x0a9e('0x1e')];if(!_0x106033[_0x0a9e('0x1a')]['hasOwnProperty'](_0x0a9e('0x21'))){_0x31b1ca['limit']=qs[_0x0a9e('0x9')](_0x106033['query'][_0x0a9e('0x9')]);_0x31b1ca[_0x0a9e('0x6')]=qs[_0x0a9e('0x6')](_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x6')]);}_0x31b1ca[_0x0a9e('0x22')]=qs[_0x0a9e('0x23')](_0x106033[_0x0a9e('0x1a')]['sort']);_0x31b1ca[_0x0a9e('0x24')]=qs[_0x0a9e('0x1b')](_[_0x0a9e('0x25')](_0x106033[_0x0a9e('0x1a')],_0x2eb11f['filters']),_0x20559e);if(_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x26')]){_0x31b1ca[_0x0a9e('0x24')]=_[_0x0a9e('0x27')](_0x31b1ca[_0x0a9e('0x24')],{'$or':_[_0x0a9e('0x14')](_0x20559e,function(_0x296f41){if(_0x296f41[_0x0a9e('0x17')]!==_0x0a9e('0x28')){var _0x540530={};_0x540530[_0x296f41[_0x0a9e('0x11')]]={'$like':'%'+_0x106033['query'][_0x0a9e('0x26')]+'%'};return _0x540530;}})});}_0x31b1ca=_[_0x0a9e('0x27')]({},_0x31b1ca,_0x106033[_0x0a9e('0x29')]);var _0x33bdb7={'where':_0x31b1ca[_0x0a9e('0x24')]};return db['VoiceCallReport'][_0x0a9e('0x8')](_0x33bdb7)[_0x0a9e('0xb')](function(_0x40cb85){_0x530eb7[_0x0a9e('0x8')]=_0x40cb85;if(_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x2a')]){_0x31b1ca[_0x0a9e('0x2b')]=[{'attributes':['id',_0x0a9e('0x11'),'fullname',_0x0a9e('0x2c')],'model':db['User'],'as':_0x0a9e('0x2d')}];}return db[_0x0a9e('0x15')][_0x0a9e('0x2e')](_0x31b1ca);})[_0x0a9e('0xb')](function(_0x567193){_0x530eb7[_0x0a9e('0x2f')]=_0x567193;return _0x530eb7;})[_0x0a9e('0xb')](respondWithFilteredResult(_0x205fd6,_0x31b1ca))[_0x0a9e('0x30')](handleError(_0x205fd6,null));};exports[_0x0a9e('0x31')]=function(_0x4853b1,_0x54135e){var _0x1e8694={'raw':!![],'where':{'id':_0x4853b1[_0x0a9e('0x32')]['id']}},_0x5640eb={};_0x5640eb[_0x0a9e('0x1e')]=_[_0x0a9e('0x19')](db[_0x0a9e('0x15')]['rawAttributes']);_0x5640eb[_0x0a9e('0x1a')]=_[_0x0a9e('0x19')](_0x4853b1[_0x0a9e('0x1a')]);_0x5640eb['filters']=_[_0x0a9e('0x1c')](_0x5640eb[_0x0a9e('0x1e')],_0x5640eb[_0x0a9e('0x1a')]);_0x1e8694['attributes']=_['intersection'](_0x5640eb[_0x0a9e('0x1e')],qs[_0x0a9e('0x1f')](_0x4853b1['query'][_0x0a9e('0x1f')]));_0x1e8694[_0x0a9e('0x1d')]=_0x1e8694[_0x0a9e('0x1d')][_0x0a9e('0x20')]?_0x1e8694['attributes']:_0x5640eb['model'];if(_0x4853b1[_0x0a9e('0x1a')][_0x0a9e('0x2a')]){_0x1e8694['include']=[{'all':!![]}];}_0x1e8694=_[_0x0a9e('0x27')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x29')]);return db[_0x0a9e('0x15')]['find'](_0x1e8694)[_0x0a9e('0xb')](handleEntityNotFound(_0x54135e,null))[_0x0a9e('0xb')](respondWithResult(_0x54135e,null))[_0x0a9e('0x30')](handleError(_0x54135e,null));};exports[_0x0a9e('0x33')]=function(_0x13cb1f,_0xeaa5e5){return db[_0x0a9e('0x15')][_0x0a9e('0x33')](_0x13cb1f[_0x0a9e('0x34')],{})[_0x0a9e('0xb')](respondWithResult(_0xeaa5e5,0xc9))[_0x0a9e('0x30')](handleError(_0xeaa5e5,null));};exports[_0x0a9e('0xc')]=function(_0x1a7bce,_0x11ca30){return db[_0x0a9e('0x15')]['find']({'where':{'id':_0x1a7bce['params']['id']}})[_0x0a9e('0xb')](handleEntityNotFound(_0x11ca30,null))[_0x0a9e('0xb')](removeEntity(_0x11ca30,null))[_0x0a9e('0x30')](handleError(_0x11ca30,null));};exports[_0x0a9e('0x35')]=function(_0x1a69dd,_0xc9a702){return db[_0x0a9e('0x15')][_0x0a9e('0x35')]()[_0x0a9e('0xb')](respondWithResult(_0xc9a702,null))[_0x0a9e('0x30')](handleError(_0xc9a702,null));};function findForUpdate(_0x2c2cb0){return db[_0x0a9e('0x15')]['find']({'where':{'uniqueid':_0x2c2cb0[_0x0a9e('0x32')]['id'],'UserId':{'$or':[null,_0x2c2cb0[_0x0a9e('0x36')]['id']]}}});}exports[_0x0a9e('0xa')]=function(_0xfbd5ad,_0x2e8caf){if(_0xfbd5ad[_0x0a9e('0x34')][_0x0a9e('0x37')]){delete _0xfbd5ad[_0x0a9e('0x34')]['uniqueid'];}return findForUpdate(_0xfbd5ad)[_0x0a9e('0xb')](handleEntityNotFound(_0x2e8caf,null))['then'](saveUpdates(_0xfbd5ad[_0x0a9e('0x34')],null))[_0x0a9e('0xb')](respondWithResult(_0x2e8caf,null))[_0x0a9e('0x30')](handleError(_0x2e8caf,null));};exports['updateWithRetry']=function(_0x14bec2,_0x7f6eb1,_0x4774f4){if(_0x14bec2[_0x0a9e('0x34')][_0x0a9e('0x37')]){delete _0x14bec2[_0x0a9e('0x34')][_0x0a9e('0x37')];}promiseRetry(function(){return findForUpdate(_0x14bec2);},{'retries':0x6,'minTimeout':0xfa})['then'](function(_0x13f44d){if(!_0x13f44d){return new Promise(function(_0x1bde3c){_0x1bde3c(handleEntityNotFound(_0x7f6eb1)({'message':_0x0a9e('0x38')}));});}else{return _0x13f44d[_0x0a9e('0xa')](_0x14bec2[_0x0a9e('0x34')])[_0x0a9e('0xb')](function(_0x6054ee){return respondWithResult(_0x7f6eb1)(_0x6054ee);});}})[_0x0a9e('0x30')](_0x4774f4);}; \ No newline at end of file +var _0xa9e0=['create','body','describe','user','uniqueid','No\x20such\x20Voice\x20Call\x20Report','lodash','../../components/parsers/qs','../../config/logger','promise-retry','status','json','offset','undefined','count','limit','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceCallReport','rawAttributes','type','key','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','alias','User','findAll','rows','catch','show','params'];(function(_0x121a24,_0x58a016){var _0x7bc61b=function(_0x400d69){while(--_0x400d69){_0x121a24['push'](_0x121a24['shift']());}};_0x7bc61b(++_0x58a016);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var qs=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var db=require('../../mysqldb')['db'];const promiseRetry=require(_0x0a9e('0x3'));function respondWithResult(_0x4ce2f1,_0x333808){_0x333808=_0x333808||0xc8;return function(_0x432180){if(_0x432180){return _0x4ce2f1[_0x0a9e('0x4')](_0x333808)[_0x0a9e('0x5')](_0x432180);}};}function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x6')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x7');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x6')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x8')]:_0x57b080[_0x0a9e('0x6')]+_0x57b080[_0x0a9e('0x9')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0x5')](_0x219af0);}return null;};}function saveUpdates(_0x36471c){return function(_0xd5b662){if(_0xd5b662){return _0xd5b662[_0x0a9e('0xa')](_0x36471c)[_0x0a9e('0xb')](function(_0x69aeb7){return _0x69aeb7;});}return null;};}function removeEntity(_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){return _0x4283ce[_0x0a9e('0xc')]()[_0x0a9e('0xb')](function(){_0x5db4b0[_0x0a9e('0x4')](0xcc)[_0x0a9e('0xd')]();});}};}function handleEntityNotFound(_0x4d5611){return function(_0x52a03d){if(!_0x52a03d){_0x4d5611[_0x0a9e('0xe')](0x194);}return _0x52a03d;};}function handleError(_0x5d0880,_0x1985b6){_0x1985b6=_0x1985b6||0x1f4;return function(_0x519dfd){logger[_0x0a9e('0xf')](_0x519dfd[_0x0a9e('0x10')]);if(_0x519dfd['name']){delete _0x519dfd[_0x0a9e('0x11')];}_0x5d0880['status'](_0x1985b6)[_0x0a9e('0x12')](_0x519dfd);};}exports[_0x0a9e('0x13')]=function(_0x106033,_0x205fd6){var _0x31b1ca={},_0x2eb11f={},_0x530eb7={'count':0x0,'rows':[]};var _0x20559e=_[_0x0a9e('0x14')](db[_0x0a9e('0x15')][_0x0a9e('0x16')],function(_0x105080){return{'name':_0x105080['fieldName'],'type':_0x105080[_0x0a9e('0x17')][_0x0a9e('0x18')]};});_0x2eb11f['model']=_[_0x0a9e('0x14')](_0x20559e,'name');_0x2eb11f['query']=_[_0x0a9e('0x19')](_0x106033[_0x0a9e('0x1a')]);_0x2eb11f[_0x0a9e('0x1b')]=_[_0x0a9e('0x1c')](_0x2eb11f['model'],_0x2eb11f[_0x0a9e('0x1a')]);_0x31b1ca[_0x0a9e('0x1d')]=_[_0x0a9e('0x1c')](_0x2eb11f[_0x0a9e('0x1e')],qs[_0x0a9e('0x1f')](_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x1f')]));_0x31b1ca['attributes']=_0x31b1ca['attributes'][_0x0a9e('0x20')]?_0x31b1ca[_0x0a9e('0x1d')]:_0x2eb11f[_0x0a9e('0x1e')];if(!_0x106033[_0x0a9e('0x1a')]['hasOwnProperty'](_0x0a9e('0x21'))){_0x31b1ca['limit']=qs[_0x0a9e('0x9')](_0x106033['query'][_0x0a9e('0x9')]);_0x31b1ca[_0x0a9e('0x6')]=qs[_0x0a9e('0x6')](_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x6')]);}_0x31b1ca[_0x0a9e('0x22')]=qs[_0x0a9e('0x23')](_0x106033[_0x0a9e('0x1a')]['sort']);_0x31b1ca[_0x0a9e('0x24')]=qs[_0x0a9e('0x1b')](_[_0x0a9e('0x25')](_0x106033[_0x0a9e('0x1a')],_0x2eb11f['filters']),_0x20559e);if(_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x26')]){_0x31b1ca[_0x0a9e('0x24')]=_[_0x0a9e('0x27')](_0x31b1ca[_0x0a9e('0x24')],{'$or':_[_0x0a9e('0x14')](_0x20559e,function(_0x296f41){if(_0x296f41[_0x0a9e('0x17')]!==_0x0a9e('0x28')){var _0x540530={};_0x540530[_0x296f41[_0x0a9e('0x11')]]={'$like':'%'+_0x106033['query'][_0x0a9e('0x26')]+'%'};return _0x540530;}})});}_0x31b1ca=_[_0x0a9e('0x27')]({},_0x31b1ca,_0x106033[_0x0a9e('0x29')]);var _0x33bdb7={'where':_0x31b1ca[_0x0a9e('0x24')]};return db['VoiceCallReport'][_0x0a9e('0x8')](_0x33bdb7)[_0x0a9e('0xb')](function(_0x40cb85){_0x530eb7[_0x0a9e('0x8')]=_0x40cb85;if(_0x106033[_0x0a9e('0x1a')][_0x0a9e('0x2a')]){_0x31b1ca[_0x0a9e('0x2b')]=[{'attributes':['id',_0x0a9e('0x11'),'fullname',_0x0a9e('0x2c')],'model':db['User'],'as':_0x0a9e('0x2d')}];}return db[_0x0a9e('0x15')][_0x0a9e('0x2e')](_0x31b1ca);})[_0x0a9e('0xb')](function(_0x567193){_0x530eb7[_0x0a9e('0x2f')]=_0x567193;return _0x530eb7;})[_0x0a9e('0xb')](respondWithFilteredResult(_0x205fd6,_0x31b1ca))[_0x0a9e('0x30')](handleError(_0x205fd6,null));};exports[_0x0a9e('0x31')]=function(_0x4853b1,_0x54135e){var _0x1e8694={'raw':!![],'where':{'id':_0x4853b1[_0x0a9e('0x32')]['id']}},_0x5640eb={};_0x5640eb[_0x0a9e('0x1e')]=_[_0x0a9e('0x19')](db[_0x0a9e('0x15')]['rawAttributes']);_0x5640eb[_0x0a9e('0x1a')]=_[_0x0a9e('0x19')](_0x4853b1[_0x0a9e('0x1a')]);_0x5640eb['filters']=_[_0x0a9e('0x1c')](_0x5640eb[_0x0a9e('0x1e')],_0x5640eb[_0x0a9e('0x1a')]);_0x1e8694['attributes']=_['intersection'](_0x5640eb[_0x0a9e('0x1e')],qs[_0x0a9e('0x1f')](_0x4853b1['query'][_0x0a9e('0x1f')]));_0x1e8694[_0x0a9e('0x1d')]=_0x1e8694[_0x0a9e('0x1d')][_0x0a9e('0x20')]?_0x1e8694['attributes']:_0x5640eb['model'];if(_0x4853b1[_0x0a9e('0x1a')][_0x0a9e('0x2a')]){_0x1e8694['include']=[{'all':!![]}];}_0x1e8694=_[_0x0a9e('0x27')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x29')]);return db[_0x0a9e('0x15')]['find'](_0x1e8694)[_0x0a9e('0xb')](handleEntityNotFound(_0x54135e,null))[_0x0a9e('0xb')](respondWithResult(_0x54135e,null))[_0x0a9e('0x30')](handleError(_0x54135e,null));};exports[_0x0a9e('0x33')]=function(_0x13cb1f,_0xeaa5e5){return db[_0x0a9e('0x15')][_0x0a9e('0x33')](_0x13cb1f[_0x0a9e('0x34')],{})[_0x0a9e('0xb')](respondWithResult(_0xeaa5e5,0xc9))[_0x0a9e('0x30')](handleError(_0xeaa5e5,null));};exports[_0x0a9e('0xc')]=function(_0x1a7bce,_0x11ca30){return db[_0x0a9e('0x15')]['find']({'where':{'id':_0x1a7bce['params']['id']}})[_0x0a9e('0xb')](handleEntityNotFound(_0x11ca30,null))[_0x0a9e('0xb')](removeEntity(_0x11ca30,null))[_0x0a9e('0x30')](handleError(_0x11ca30,null));};exports[_0x0a9e('0x35')]=function(_0x1a69dd,_0xc9a702){return db[_0x0a9e('0x15')][_0x0a9e('0x35')]()[_0x0a9e('0xb')](respondWithResult(_0xc9a702,null))[_0x0a9e('0x30')](handleError(_0xc9a702,null));};function findForUpdate(_0x2c2cb0){return db[_0x0a9e('0x15')]['find']({'where':{'uniqueid':_0x2c2cb0[_0x0a9e('0x32')]['id'],'UserId':{'$or':[null,_0x2c2cb0[_0x0a9e('0x36')]['id']]}}});}exports[_0x0a9e('0xa')]=function(_0xfbd5ad,_0x2e8caf){if(_0xfbd5ad[_0x0a9e('0x34')][_0x0a9e('0x37')]){delete _0xfbd5ad[_0x0a9e('0x34')]['uniqueid'];}return findForUpdate(_0xfbd5ad)[_0x0a9e('0xb')](handleEntityNotFound(_0x2e8caf,null))['then'](saveUpdates(_0xfbd5ad[_0x0a9e('0x34')],null))[_0x0a9e('0xb')](respondWithResult(_0x2e8caf,null))[_0x0a9e('0x30')](handleError(_0x2e8caf,null));};exports['updateWithRetry']=function(_0x14bec2,_0x7f6eb1,_0x4774f4){if(_0x14bec2[_0x0a9e('0x34')][_0x0a9e('0x37')]){delete _0x14bec2[_0x0a9e('0x34')][_0x0a9e('0x37')];}promiseRetry(function(){return findForUpdate(_0x14bec2);},{'retries':0x6,'minTimeout':0xfa})['then'](function(_0x13f44d){if(!_0x13f44d){return new Promise(function(_0x1bde3c){_0x1bde3c(handleEntityNotFound(_0x7f6eb1)({'message':_0x0a9e('0x38')}));});}else{return _0x13f44d[_0x0a9e('0xa')](_0x14bec2[_0x0a9e('0x34')])[_0x0a9e('0xb')](function(_0x6054ee){return respondWithResult(_0x7f6eb1)(_0x6054ee);});}})[_0x0a9e('0x30')](_0x4774f4);}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1c8fe6f..c34e7df 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 _0x3931=['bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment'];(function(_0x39872b,_0x343e6b){var _0x55fa18=function(_0x217c7f){while(--_0x217c7f){_0x39872b['push'](_0x39872b['shift']());}};_0x55fa18(++_0x343e6b);}(_0x3931,0x14c));var _0x1393=function(_0x3b4da8,_0x1e1fa8){_0x3b4da8=_0x3b4da8-0x0;var _0x3640cc=_0x3931[_0x3b4da8];return _0x3640cc;};'use strict';var _=require('lodash');var util=require(_0x1393('0x0'));var logger=require(_0x1393('0x1'))(_0x1393('0x2'));var moment=require(_0x1393('0x3'));var BPromise=require(_0x1393('0x4'));var rp=require(_0x1393('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1393('0x6'));var config=require(_0x1393('0x7'));var attributes=require(_0x1393('0x8'));module[_0x1393('0x9')]=function(_0x4daf69,_0x52c156){return _0x4daf69[_0x1393('0xa')](_0x1393('0xb'),attributes,{'tableName':_0x1393('0xc'),'paranoid':![],'indexes':[{'fields':[_0x1393('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c00=['exports','define','VoiceCallReport','report_call','bluebird','request-promise','rimraf','./voiceCallReport.attributes'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9c00,0xf4));var _0x09c0=function(_0x137ef8,_0x3384dc){_0x137ef8=_0x137ef8-0x0;var _0x3b7d28=_0x9c00[_0x137ef8];return _0x3b7d28;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x09c0('0x0'));var rp=require(_0x09c0('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x09c0('0x2'));var config=require('../../config/environment');var attributes=require(_0x09c0('0x3'));module[_0x09c0('0x4')]=function(_0x30dddb,_0x42e740){return _0x30dddb[_0x09c0('0x5')](_0x09c0('0x6'),attributes,{'tableName':_0x09c0('0x7'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 252f9bd..6d70b04 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 _0x9ebf=['code','message','result','catch','VoiceCallReport','findAll','options','where','attributes','limit','include','map','model','then','GetVoiceCallReport','create','body','raw','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xac19bc,_0xf5aa46){var _0x4b0541=function(_0x4da81e){while(--_0x4da81e){_0xac19bc['push'](_0xac19bc['shift']());}};_0x4b0541(++_0xf5aa46);}(_0x9ebf,0x105));var _0xf9eb=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9ebf[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xf9eb('0x0'));var util=require(_0xf9eb('0x1'));var moment=require(_0xf9eb('0x2'));var BPromise=require(_0xf9eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf9eb('0x4'));var db=require(_0xf9eb('0x5'))['db'];var utils=require(_0xf9eb('0x6'));var logger=require('../../config/logger')(_0xf9eb('0x7'));var config=require(_0xf9eb('0x8'));var jayson=require(_0xf9eb('0x9'));var client=jayson['client'][_0xf9eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12c9aa,_0x4acf02,_0x23b8f5){return new BPromise(function(_0x37c536,_0x5aea0b){return client[_0xf9eb('0xb')](_0x12c9aa,_0x23b8f5)['then'](function(_0x103457){logger[_0xf9eb('0xc')](_0xf9eb('0xd'),_0x4acf02,'request\x20sent');logger[_0xf9eb('0xe')](_0xf9eb('0xf'),_0x4acf02,_0xf9eb('0x10'),JSON[_0xf9eb('0x11')](_0x103457));if(_0x103457[_0xf9eb('0x12')]){if(_0x103457[_0xf9eb('0x12')][_0xf9eb('0x13')]===0x1f4){logger[_0xf9eb('0x12')](_0xf9eb('0xd'),_0x4acf02,_0x103457[_0xf9eb('0x12')][_0xf9eb('0x14')]);return _0x5aea0b(_0x103457[_0xf9eb('0x12')][_0xf9eb('0x14')]);}logger[_0xf9eb('0x12')](_0xf9eb('0xd'),_0x4acf02,_0x103457[_0xf9eb('0x12')][_0xf9eb('0x14')]);return _0x37c536(_0x103457['error']['message']);}else{logger[_0xf9eb('0xc')](_0xf9eb('0xd'),_0x4acf02,'request\x20sent');_0x37c536(_0x103457[_0xf9eb('0x15')][_0xf9eb('0x14')]);}})[_0xf9eb('0x16')](function(_0x490292){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x4acf02,_0x490292);_0x5aea0b(_0x490292);});});}exports['GetVoiceCallReport']=function(_0x113461){var _0x402806=this;return new Promise(function(_0x3e9d03,_0x49748a){return db[_0xf9eb('0x17')][_0xf9eb('0x18')]({'raw':_0x113461[_0xf9eb('0x19')]?_0x113461[_0xf9eb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x113461[_0xf9eb('0x19')]?_0x113461['options'][_0xf9eb('0x1a')]||null:null,'attributes':_0x113461['options']?_0x113461['options'][_0xf9eb('0x1b')]||null:null,'limit':_0x113461[_0xf9eb('0x19')]?_0x113461[_0xf9eb('0x19')][_0xf9eb('0x1c')]||null:null,'include':_0x113461[_0xf9eb('0x19')]?_0x113461[_0xf9eb('0x19')][_0xf9eb('0x1d')]?_[_0xf9eb('0x1e')](_0x113461[_0xf9eb('0x19')]['include'],function(_0x28ef1b){return{'model':db[_0x28ef1b[_0xf9eb('0x1f')]],'as':_0x28ef1b['as'],'attributes':_0x28ef1b[_0xf9eb('0x1b')],'include':_0x28ef1b[_0xf9eb('0x1d')]?_[_0xf9eb('0x1e')](_0x28ef1b['include'],function(_0x495170){return{'model':db[_0x495170['model']],'as':_0x495170['as'],'attributes':_0x495170[_0xf9eb('0x1b')],'include':_0x495170[_0xf9eb('0x1d')]?_['map'](_0x495170['include'],function(_0x4c9337){return{'model':db[_0x4c9337[_0xf9eb('0x1f')]],'as':_0x4c9337['as'],'attributes':_0x4c9337[_0xf9eb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf9eb('0x20')](function(_0x12e152){logger[_0xf9eb('0xc')](_0xf9eb('0x21'),_0x113461);logger[_0xf9eb('0xe')](_0xf9eb('0x21'),_0x113461,JSON[_0xf9eb('0x11')](_0x12e152));_0x3e9d03(_0x12e152);})[_0xf9eb('0x16')](function(_0x234a92){logger['error'](_0xf9eb('0x21'),_0x234a92['message'],_0x113461);_0x49748a(_0x402806['error'](0x1f4,_0x234a92[_0xf9eb('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x2ef0c9){var _0xde5d4f=this;return new Promise(function(_0x2a0292,_0x42f4fa){return db[_0xf9eb('0x17')][_0xf9eb('0x22')](_0x2ef0c9[_0xf9eb('0x23')],{'raw':_0x2ef0c9['options']?_0x2ef0c9[_0xf9eb('0x19')][_0xf9eb('0x24')]===undefined?!![]:![]:!![]})['then'](function(_0x5b87d0){logger[_0xf9eb('0xc')](_0xf9eb('0x25'),_0x2ef0c9);logger[_0xf9eb('0xe')](_0xf9eb('0x25'),_0x2ef0c9,JSON[_0xf9eb('0x11')](_0x5b87d0));_0x2a0292(_0x5b87d0);})[_0xf9eb('0x16')](function(_0x48ff01){logger[_0xf9eb('0x12')](_0xf9eb('0x25'),_0x48ff01[_0xf9eb('0x14')],_0x2ef0c9);_0x42f4fa(_0xde5d4f['error'](0x1f4,_0x48ff01[_0xf9eb('0x14')]));});});};exports[_0xf9eb('0x26')]=function(_0x156d76){var _0x581df2=this;return new Promise(function(_0x58e1c5,_0x4ba25f){return db[_0xf9eb('0x17')][_0xf9eb('0x27')](_0x156d76[_0xf9eb('0x23')],{'raw':_0x156d76[_0xf9eb('0x19')]?_0x156d76[_0xf9eb('0x19')][_0xf9eb('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x156d76[_0xf9eb('0x19')]?_0x156d76[_0xf9eb('0x19')][_0xf9eb('0x1a')]||null:null,'attributes':_0x156d76[_0xf9eb('0x19')]?_0x156d76[_0xf9eb('0x19')][_0xf9eb('0x1b')]||null:null,'limit':_0x156d76[_0xf9eb('0x19')]?_0x156d76[_0xf9eb('0x19')][_0xf9eb('0x1c')]||null:null})[_0xf9eb('0x20')](function(_0x1172ec){logger['info'](_0xf9eb('0x26'),_0x156d76);logger['debug']('UpdateVoiceCallReport',_0x156d76,JSON[_0xf9eb('0x11')](_0x1172ec));_0x58e1c5(_0x1172ec);})['catch'](function(_0x3ebacc){logger['error'](_0xf9eb('0x26'),_0x3ebacc[_0xf9eb('0x14')],_0x156d76);_0x4ba25f(_0x581df2['error'](0x1f4,_0x3ebacc['message']));});});}; \ No newline at end of file +var _0x6fe5=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','code','VoiceCallReport,\x20%s,\x20%s','error','message','result','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','create','body','UpdateVoiceCallReport','VoiceCallReport','update','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6fe5,0x180));var _0x56fe=function(_0x248ce,_0x466e41){_0x248ce=_0x248ce-0x0;var _0x35e4ec=_0x6fe5[_0x248ce];return _0x35e4ec;};'use strict';var _=require(_0x56fe('0x0'));var util=require(_0x56fe('0x1'));var moment=require(_0x56fe('0x2'));var BPromise=require(_0x56fe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56fe('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x56fe('0x5'));var logger=require(_0x56fe('0x6'))(_0x56fe('0x7'));var config=require(_0x56fe('0x8'));var jayson=require(_0x56fe('0x9'));var client=jayson[_0x56fe('0xa')][_0x56fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b473c,_0x10f826,_0x3809d4){return new BPromise(function(_0x4986a2,_0x495139){return client[_0x56fe('0xc')](_0x2b473c,_0x3809d4)[_0x56fe('0xd')](function(_0x432da5){logger[_0x56fe('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x10f826,_0x56fe('0xf'));logger[_0x56fe('0x10')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x10f826,_0x56fe('0xf'),JSON[_0x56fe('0x11')](_0x432da5));if(_0x432da5['error']){if(_0x432da5['error'][_0x56fe('0x12')]===0x1f4){logger['error'](_0x56fe('0x13'),_0x10f826,_0x432da5[_0x56fe('0x14')][_0x56fe('0x15')]);return _0x495139(_0x432da5['error'][_0x56fe('0x15')]);}logger[_0x56fe('0x14')](_0x56fe('0x13'),_0x10f826,_0x432da5[_0x56fe('0x14')][_0x56fe('0x15')]);return _0x4986a2(_0x432da5[_0x56fe('0x14')]['message']);}else{logger[_0x56fe('0xe')](_0x56fe('0x13'),_0x10f826,_0x56fe('0xf'));_0x4986a2(_0x432da5[_0x56fe('0x16')][_0x56fe('0x15')]);}})[_0x56fe('0x17')](function(_0x17582c){logger['error'](_0x56fe('0x13'),_0x10f826,_0x17582c);_0x495139(_0x17582c);});});}exports[_0x56fe('0x18')]=function(_0x373570){var _0x3dde36=this;return new Promise(function(_0x233e87,_0x2203c2){return db['VoiceCallReport'][_0x56fe('0x19')]({'raw':_0x373570[_0x56fe('0x1a')]?_0x373570[_0x56fe('0x1a')][_0x56fe('0x1b')]===undefined?!![]:![]:!![],'where':_0x373570[_0x56fe('0x1a')]?_0x373570[_0x56fe('0x1a')][_0x56fe('0x1c')]||null:null,'attributes':_0x373570[_0x56fe('0x1a')]?_0x373570['options'][_0x56fe('0x1d')]||null:null,'limit':_0x373570[_0x56fe('0x1a')]?_0x373570[_0x56fe('0x1a')][_0x56fe('0x1e')]||null:null,'include':_0x373570['options']?_0x373570[_0x56fe('0x1a')][_0x56fe('0x1f')]?_[_0x56fe('0x20')](_0x373570[_0x56fe('0x1a')][_0x56fe('0x1f')],function(_0x4735a9){return{'model':db[_0x4735a9[_0x56fe('0x21')]],'as':_0x4735a9['as'],'attributes':_0x4735a9['attributes'],'include':_0x4735a9[_0x56fe('0x1f')]?_[_0x56fe('0x20')](_0x4735a9[_0x56fe('0x1f')],function(_0x1ae9eb){return{'model':db[_0x1ae9eb[_0x56fe('0x21')]],'as':_0x1ae9eb['as'],'attributes':_0x1ae9eb[_0x56fe('0x1d')],'include':_0x1ae9eb[_0x56fe('0x1f')]?_[_0x56fe('0x20')](_0x1ae9eb[_0x56fe('0x1f')],function(_0x37c945){return{'model':db[_0x37c945[_0x56fe('0x21')]],'as':_0x37c945['as'],'attributes':_0x37c945[_0x56fe('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54f432){logger['info'](_0x56fe('0x18'),_0x373570);logger[_0x56fe('0x10')](_0x56fe('0x18'),_0x373570,JSON['stringify'](_0x54f432));_0x233e87(_0x54f432);})[_0x56fe('0x17')](function(_0x415b72){logger['error']('GetVoiceCallReport',_0x415b72[_0x56fe('0x15')],_0x373570);_0x2203c2(_0x3dde36[_0x56fe('0x14')](0x1f4,_0x415b72[_0x56fe('0x15')]));});});};exports['CreateVoiceCallReport']=function(_0x2f97ae){var _0x54f600=this;return new Promise(function(_0x175245,_0x56dd0c){return db['VoiceCallReport'][_0x56fe('0x22')](_0x2f97ae[_0x56fe('0x23')],{'raw':_0x2f97ae[_0x56fe('0x1a')]?_0x2f97ae[_0x56fe('0x1a')][_0x56fe('0x1b')]===undefined?!![]:![]:!![]})[_0x56fe('0xd')](function(_0xb55320){logger[_0x56fe('0xe')]('CreateVoiceCallReport',_0x2f97ae);logger[_0x56fe('0x10')]('CreateVoiceCallReport',_0x2f97ae,JSON['stringify'](_0xb55320));_0x175245(_0xb55320);})[_0x56fe('0x17')](function(_0x3e34d4){logger[_0x56fe('0x14')]('CreateVoiceCallReport',_0x3e34d4['message'],_0x2f97ae);_0x56dd0c(_0x54f600['error'](0x1f4,_0x3e34d4[_0x56fe('0x15')]));});});};exports[_0x56fe('0x24')]=function(_0x59fe2d){var _0x269ee3=this;return new Promise(function(_0x2090ae,_0x36cee7){return db[_0x56fe('0x25')][_0x56fe('0x26')](_0x59fe2d[_0x56fe('0x23')],{'raw':_0x59fe2d[_0x56fe('0x1a')]?_0x59fe2d[_0x56fe('0x1a')][_0x56fe('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59fe2d[_0x56fe('0x1a')]?_0x59fe2d['options'][_0x56fe('0x1c')]||null:null,'attributes':_0x59fe2d[_0x56fe('0x1a')]?_0x59fe2d['options'][_0x56fe('0x1d')]||null:null,'limit':_0x59fe2d[_0x56fe('0x1a')]?_0x59fe2d[_0x56fe('0x1a')][_0x56fe('0x1e')]||null:null})['then'](function(_0x4300b6){logger['info'](_0x56fe('0x24'),_0x59fe2d);logger[_0x56fe('0x10')]('UpdateVoiceCallReport',_0x59fe2d,JSON[_0x56fe('0x11')](_0x4300b6));_0x2090ae(_0x4300b6);})[_0x56fe('0x17')](function(_0x47d173){logger[_0x56fe('0x14')](_0x56fe('0x24'),_0x47d173[_0x56fe('0x15')],_0x59fe2d);_0x36cee7(_0x269ee3[_0x56fe('0x14')](0x1f4,_0x47d173[_0x56fe('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index bd9f18d..fea8f79 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 _0x5fbb=['destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','put','update','delete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5fbb,0x161));var _0xb5fb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5fbb[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xb5fb('0x0'));var util=require(_0xb5fb('0x1'));var path=require(_0xb5fb('0x2'));var timeout=require(_0xb5fb('0x3'));var express=require(_0xb5fb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb5fb('0x5'));var interaction=require(_0xb5fb('0x6'));var config=require(_0xb5fb('0x7'));var controller=require('./voiceChanSpy.controller');router[_0xb5fb('0x8')]('/',auth[_0xb5fb('0x9')](),controller['index']);router[_0xb5fb('0x8')](_0xb5fb('0xa'),auth[_0xb5fb('0x9')](),controller[_0xb5fb('0xb')]);router['post']('/',auth[_0xb5fb('0x9')](),controller['create']);router[_0xb5fb('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xb5fb('0xd')]);router[_0xb5fb('0xe')](_0xb5fb('0xa'),auth[_0xb5fb('0x9')](),controller[_0xb5fb('0xf')]);module['exports']=router; \ No newline at end of file +var _0x8b10=['exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','put','delete'];(function(_0x581981,_0x1c7c54){var _0x2147ca=function(_0xd39465){while(--_0xd39465){_0x581981['push'](_0x581981['shift']());}};_0x2147ca(++_0x1c7c54);}(_0x8b10,0x1d2));var _0x08b1=function(_0x26be98,_0x1de128){_0x26be98=_0x26be98-0x0;var _0x4a4c97=_0x8b10[_0x26be98];return _0x4a4c97;};'use strict';var multer=require(_0x08b1('0x0'));var util=require('util');var path=require(_0x08b1('0x1'));var timeout=require(_0x08b1('0x2'));var express=require(_0x08b1('0x3'));var router=express['Router']();var fs_extra=require(_0x08b1('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x08b1('0x5'));var controller=require(_0x08b1('0x6'));router[_0x08b1('0x7')]('/',auth[_0x08b1('0x8')](),controller[_0x08b1('0x9')]);router[_0x08b1('0x7')](_0x08b1('0xa'),auth[_0x08b1('0x8')](),controller['show']);router[_0x08b1('0xb')]('/',auth[_0x08b1('0x8')](),controller['create']);router[_0x08b1('0xc')](_0x08b1('0xa'),auth[_0x08b1('0x8')](),controller['update']);router[_0x08b1('0xd')](_0x08b1('0xa'),auth[_0x08b1('0x8')](),controller['destroy']);module[_0x08b1('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 7c03f1d..d7d9394 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 _0x8e09=['name','options','getDataValue','split','BOOLEAN','exports','STRING'];(function(_0x5b1643,_0x56567f){var _0x49eda0=function(_0x433eb7){while(--_0x433eb7){_0x5b1643['push'](_0x5b1643['shift']());}};_0x49eda0(++_0x56567f);}(_0x8e09,0x1cc));var _0x98e0=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0x8e09[_0x4de586];return _0x46baf5;};'use strict';var Sequelize=require('sequelize');module[_0x98e0('0x0')]={'name':{'type':Sequelize[_0x98e0('0x1')]},'prefix':{'type':Sequelize[_0x98e0('0x1')],'unique':_0x98e0('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x98e0('0x1')],'set':function(_0x484224){this['setDataValue'](_0x98e0('0x3'),_0x484224?_0x484224['join'](''):[]);},'get':function(){return this[_0x98e0('0x4')](_0x98e0('0x3'))?this['getDataValue']('options')[_0x98e0('0x5')](''):[];}},'auth':{'type':Sequelize[_0x98e0('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x98e0('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x98e0('0x1')]},'description':{'type':Sequelize[_0x98e0('0x1')]}}; \ No newline at end of file +var _0xcf78=['name','setDataValue','options','getDataValue','split','BOOLEAN','sequelize','STRING'];(function(_0x3c0a43,_0x5ca0d2){var _0x473909=function(_0x1454e5){while(--_0x1454e5){_0x3c0a43['push'](_0x3c0a43['shift']());}};_0x473909(++_0x5ca0d2);}(_0xcf78,0xc6));var _0x8cf7=function(_0xb9b4d,_0x1ea196){_0xb9b4d=_0xb9b4d-0x0;var _0x4ec718=_0xcf78[_0xb9b4d];return _0x4ec718;};'use strict';var Sequelize=require(_0x8cf7('0x0'));module['exports']={'name':{'type':Sequelize[_0x8cf7('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x8cf7('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x8cf7('0x1')],'set':function(_0x246b5d){this[_0x8cf7('0x3')](_0x8cf7('0x4'),_0x246b5d?_0x246b5d['join'](''):[]);},'get':function(){return this[_0x8cf7('0x5')](_0x8cf7('0x4'))?this['getDataValue'](_0x8cf7('0x4'))[_0x8cf7('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x8cf7('0x1')]},'record':{'type':Sequelize[_0x8cf7('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8cf7('0x1')]},'description':{'type':Sequelize[_0x8cf7('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 2dd9516..889ab7e 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 _0x5a8c=['catch','create','body','user','UserProfileSection','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','show','params','find'];(function(_0x4997a6,_0x5a65e3){var _0x139fe7=function(_0x261da1){while(--_0x261da1){_0x4997a6['push'](_0x4997a6['shift']());}};_0x139fe7(++_0x5a65e3);}(_0x5a8c,0x1da));var _0xc5a8=function(_0xa34f01,_0x4dfd44){_0xa34f01=_0xa34f01-0x0;var _0x34c117=_0x5a8c[_0xa34f01];return _0x34c117;};'use strict';var emlformat=require(_0xc5a8('0x0'));var rimraf=require(_0xc5a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5a8('0x2'));var rp=require(_0xc5a8('0x3'));var moment=require(_0xc5a8('0x4'));var BPromise=require(_0xc5a8('0x5'));var Mustache=require('mustache');var util=require(_0xc5a8('0x6'));var path=require(_0xc5a8('0x7'));var sox=require('sox');var csv=require(_0xc5a8('0x8'));var ejs=require(_0xc5a8('0x9'));var fs=require('fs');var fs_extra=require(_0xc5a8('0xa'));var _=require(_0xc5a8('0xb'));var squel=require(_0xc5a8('0xc'));var crypto=require(_0xc5a8('0xd'));var jsforce=require(_0xc5a8('0xe'));var deskjs=require(_0xc5a8('0xf'));var toCsv=require(_0xc5a8('0x8'));var querystring=require(_0xc5a8('0x10'));var Papa=require(_0xc5a8('0x11'));var Redis=require('ioredis');var authService=require(_0xc5a8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc5a8('0x13'));var hardwareService=require(_0xc5a8('0x14'));var logger=require(_0xc5a8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc5a8('0x16'));var licenseUtil=require(_0xc5a8('0x17'));var db=require(_0xc5a8('0x18'))['db'];function respondWithStatusCode(_0x2c4875,_0x445926){_0x445926=_0x445926||0xcc;return function(_0x5d2d2c){if(_0x5d2d2c){return _0x2c4875[_0xc5a8('0x19')](_0x445926);}return _0x2c4875[_0xc5a8('0x1a')](_0x445926)[_0xc5a8('0x1b')]();};}function respondWithResult(_0x3a820f,_0x3d6990){_0x3d6990=_0x3d6990||0xc8;return function(_0x219823){if(_0x219823){return _0x3a820f[_0xc5a8('0x1a')](_0x3d6990)[_0xc5a8('0x1c')](_0x219823);}};}function respondWithFilteredResult(_0x168e76,_0x9a94e3){return function(_0x26177f){if(_0x26177f){var _0x443376=typeof _0x9a94e3[_0xc5a8('0x1d')]===_0xc5a8('0x1e')&&typeof _0x9a94e3[_0xc5a8('0x1f')]===_0xc5a8('0x1e');var _0x22b230=_0x26177f[_0xc5a8('0x20')];var _0x506c10=_0x443376?0x0:_0x9a94e3[_0xc5a8('0x1d')];var _0x184749=_0x443376?_0x26177f[_0xc5a8('0x20')]:_0x9a94e3[_0xc5a8('0x1d')]+_0x9a94e3['limit'];var _0x326baf;if(_0x184749>=_0x22b230){_0x184749=_0x22b230;_0x326baf=0xc8;}else{_0x326baf=0xce;}_0x168e76['status'](_0x326baf);return _0x168e76[_0xc5a8('0x21')](_0xc5a8('0x22'),_0x506c10+'-'+_0x184749+'/'+_0x22b230)[_0xc5a8('0x1c')](_0x26177f);}return null;};}function patchUpdates(_0x52ca0a){return function(_0x59dd9b){try{jsonpatch['apply'](_0x59dd9b,_0x52ca0a,!![]);}catch(_0x332ee2){return BPromise[_0xc5a8('0x23')](_0x332ee2);}return _0x59dd9b[_0xc5a8('0x24')]();};}function saveUpdates(_0x403b80,_0x4b126d){return function(_0x1a8662){if(_0x1a8662){return _0x1a8662[_0xc5a8('0x25')](_0x403b80)[_0xc5a8('0x26')](function(_0x36d2c6){return _0x36d2c6;});}return null;};}function removeEntity(_0x5d8e5e,_0x411470){return function(_0x4865dd){if(_0x4865dd){return _0x4865dd[_0xc5a8('0x27')]()[_0xc5a8('0x26')](function(){var _0x2b8a67=_0x4865dd[_0xc5a8('0x28')]({'plain':!![]});var _0x5c8705=_0xc5a8('0x29');return db[_0xc5a8('0x2a')][_0xc5a8('0x27')]({'where':{'type':_0x5c8705,'resourceId':_0x2b8a67['id']}})[_0xc5a8('0x26')](function(){return _0x4865dd;});})[_0xc5a8('0x26')](function(){_0x5d8e5e[_0xc5a8('0x1a')](0xcc)[_0xc5a8('0x1b')]();});}};}function handleEntityNotFound(_0x165ee0,_0x4ebb64){return function(_0x75a5e5){if(!_0x75a5e5){_0x165ee0['sendStatus'](0x194);}return _0x75a5e5;};}function handleError(_0x32ef14,_0x58bd05){_0x58bd05=_0x58bd05||0x1f4;return function(_0x19e4f4){logger[_0xc5a8('0x2b')](_0x19e4f4['stack']);if(_0x19e4f4[_0xc5a8('0x2c')]){delete _0x19e4f4[_0xc5a8('0x2c')];}_0x32ef14[_0xc5a8('0x1a')](_0x58bd05)[_0xc5a8('0x2d')](_0x19e4f4);};}exports[_0xc5a8('0x2e')]=function(_0x2d7fae,_0x316ccb){var _0x4ec715={},_0x106a0b={},_0x367ecf={'count':0x0,'rows':[]};var _0x27efa2=_[_0xc5a8('0x2f')](db[_0xc5a8('0x30')][_0xc5a8('0x31')],function(_0x434d67){return{'name':_0x434d67[_0xc5a8('0x32')],'type':_0x434d67[_0xc5a8('0x33')][_0xc5a8('0x34')]};});_0x106a0b[_0xc5a8('0x35')]=_[_0xc5a8('0x2f')](_0x27efa2,_0xc5a8('0x2c'));_0x106a0b[_0xc5a8('0x36')]=_[_0xc5a8('0x37')](_0x2d7fae['query']);_0x106a0b['filters']=_[_0xc5a8('0x38')](_0x106a0b[_0xc5a8('0x35')],_0x106a0b[_0xc5a8('0x36')]);_0x4ec715['attributes']=_[_0xc5a8('0x38')](_0x106a0b[_0xc5a8('0x35')],qs[_0xc5a8('0x39')](_0x2d7fae[_0xc5a8('0x36')]['fields']));_0x4ec715['attributes']=_0x4ec715['attributes'][_0xc5a8('0x3a')]?_0x4ec715[_0xc5a8('0x3b')]:_0x106a0b[_0xc5a8('0x35')];if(!_0x2d7fae[_0xc5a8('0x36')][_0xc5a8('0x3c')]('nolimit')){_0x4ec715[_0xc5a8('0x1f')]=qs[_0xc5a8('0x1f')](_0x2d7fae['query'][_0xc5a8('0x1f')]);_0x4ec715['offset']=qs[_0xc5a8('0x1d')](_0x2d7fae[_0xc5a8('0x36')][_0xc5a8('0x1d')]);}_0x4ec715[_0xc5a8('0x3d')]=qs[_0xc5a8('0x3e')](_0x2d7fae[_0xc5a8('0x36')]['sort']);_0x4ec715[_0xc5a8('0x3f')]=qs[_0xc5a8('0x40')](_[_0xc5a8('0x41')](_0x2d7fae[_0xc5a8('0x36')],_0x106a0b[_0xc5a8('0x40')]),_0x27efa2);if(_0x2d7fae[_0xc5a8('0x36')][_0xc5a8('0x42')]){_0x4ec715[_0xc5a8('0x3f')]=_['merge'](_0x4ec715[_0xc5a8('0x3f')],{'$or':_[_0xc5a8('0x2f')](_0x27efa2,function(_0x3ea1e3){if(_0x3ea1e3[_0xc5a8('0x33')]!=='VIRTUAL'){var _0x1123fc={};_0x1123fc[_0x3ea1e3['name']]={'$like':'%'+_0x2d7fae[_0xc5a8('0x36')][_0xc5a8('0x42')]+'%'};return _0x1123fc;}})});}_0x4ec715=_[_0xc5a8('0x43')]({},_0x4ec715,_0x2d7fae['options']);var _0x351d49={'where':_0x4ec715[_0xc5a8('0x3f')]};return db[_0xc5a8('0x30')]['count'](_0x351d49)['then'](function(_0x5ee3b6){_0x367ecf[_0xc5a8('0x20')]=_0x5ee3b6;if(_0x2d7fae[_0xc5a8('0x36')][_0xc5a8('0x44')]){_0x4ec715['include']=[{'all':!![]}];}return db[_0xc5a8('0x30')]['findAll'](_0x4ec715);})['then'](function(_0x5b2284){_0x367ecf['rows']=_0x5b2284;return _0x367ecf;})['then'](respondWithFilteredResult(_0x316ccb,_0x4ec715))['catch'](handleError(_0x316ccb,null));};exports[_0xc5a8('0x45')]=function(_0x273932,_0x5c2968){var _0x36945b={'raw':![],'where':{'id':_0x273932[_0xc5a8('0x46')]['id']}},_0x922cc4={};_0x922cc4[_0xc5a8('0x35')]=_[_0xc5a8('0x37')](db[_0xc5a8('0x30')]['rawAttributes']);_0x922cc4[_0xc5a8('0x36')]=_[_0xc5a8('0x37')](_0x273932[_0xc5a8('0x36')]);_0x922cc4[_0xc5a8('0x40')]=_['intersection'](_0x922cc4[_0xc5a8('0x35')],_0x922cc4[_0xc5a8('0x36')]);_0x36945b[_0xc5a8('0x3b')]=_[_0xc5a8('0x38')](_0x922cc4['model'],qs['fields'](_0x273932[_0xc5a8('0x36')][_0xc5a8('0x39')]));_0x36945b[_0xc5a8('0x3b')]=_0x36945b['attributes'][_0xc5a8('0x3a')]?_0x36945b[_0xc5a8('0x3b')]:_0x922cc4[_0xc5a8('0x35')];if(_0x273932[_0xc5a8('0x36')][_0xc5a8('0x44')]){_0x36945b['include']=[{'all':!![]}];}_0x36945b=_[_0xc5a8('0x43')]({},_0x36945b,_0x273932['options']);return db[_0xc5a8('0x30')][_0xc5a8('0x47')](_0x36945b)['then'](handleEntityNotFound(_0x5c2968,null))['then'](respondWithResult(_0x5c2968,null))[_0xc5a8('0x48')](handleError(_0x5c2968,null));};exports[_0xc5a8('0x49')]=function(_0x4929b5,_0x526d11){return db[_0xc5a8('0x30')][_0xc5a8('0x49')](_0x4929b5[_0xc5a8('0x4a')],{})[_0xc5a8('0x26')](function(_0x3c84d8){var _0x1fd68b=_0x4929b5['user']['get']({'plain':!![]});if(!_0x1fd68b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fd68b['role']===_0xc5a8('0x4b')){var _0x395fa6=_0x3c84d8[_0xc5a8('0x28')]({'plain':!![]});var _0x4a930c='ChanSpies';return db[_0xc5a8('0x4c')][_0xc5a8('0x47')]({'where':{'name':_0x4a930c,'userProfileId':_0x1fd68b['userProfileId']},'raw':!![]})['then'](function(_0x65798f){if(_0x65798f&&_0x65798f[_0xc5a8('0x4d')]===0x0){return db[_0xc5a8('0x2a')]['create']({'name':_0x395fa6[_0xc5a8('0x2c')],'resourceId':_0x395fa6['id'],'type':_0x65798f[_0xc5a8('0x2c')],'sectionId':_0x65798f['id']},{})[_0xc5a8('0x26')](function(){return _0x3c84d8;});}else{return _0x3c84d8;}})[_0xc5a8('0x48')](function(_0x3be874){logger[_0xc5a8('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3be874);throw _0x3be874;});}return _0x3c84d8;})[_0xc5a8('0x26')](respondWithResult(_0x526d11,0xc9))[_0xc5a8('0x48')](handleError(_0x526d11,null));};exports[_0xc5a8('0x25')]=function(_0x4fa548,_0xc334f3){if(_0x4fa548[_0xc5a8('0x4a')]['id']){delete _0x4fa548[_0xc5a8('0x4a')]['id'];}return db[_0xc5a8('0x30')][_0xc5a8('0x47')]({'where':{'id':_0x4fa548[_0xc5a8('0x46')]['id']}})[_0xc5a8('0x26')](handleEntityNotFound(_0xc334f3,null))[_0xc5a8('0x26')](saveUpdates(_0x4fa548[_0xc5a8('0x4a')],null))[_0xc5a8('0x26')](respondWithResult(_0xc334f3,null))['catch'](handleError(_0xc334f3,null));};exports['destroy']=function(_0x309371,_0x7b5b7){return db[_0xc5a8('0x30')][_0xc5a8('0x47')]({'where':{'id':_0x309371[_0xc5a8('0x46')]['id']}})['then'](handleEntityNotFound(_0x7b5b7,null))[_0xc5a8('0x26')](removeEntity(_0x7b5b7,null))[_0xc5a8('0x48')](handleError(_0x7b5b7,null));}; \ No newline at end of file +var _0xd6ce=['../../components/auth/service','api','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','set','Content-Range','json','reject','save','then','destroy','get','ChanSpies','UserProfileResource','end','index','map','VoiceChanSpy','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x57cf8e,_0x3a7f60){var _0x4bbf1e=function(_0x3bfb3d){while(--_0x3bfb3d){_0x57cf8e['push'](_0x57cf8e['shift']());}};_0x4bbf1e(++_0x3a7f60);}(_0xd6ce,0x127));var _0xed6c=function(_0x4799c1,_0x2a585c){_0x4799c1=_0x4799c1-0x0;var _0x22822d=_0xd6ce[_0x4799c1];return _0x22822d;};'use strict';var emlformat=require(_0xed6c('0x0'));var rimraf=require(_0xed6c('0x1'));var zipdir=require(_0xed6c('0x2'));var jsonpatch=require(_0xed6c('0x3'));var rp=require(_0xed6c('0x4'));var moment=require(_0xed6c('0x5'));var BPromise=require(_0xed6c('0x6'));var Mustache=require(_0xed6c('0x7'));var util=require('util');var path=require('path');var sox=require(_0xed6c('0x8'));var csv=require(_0xed6c('0x9'));var ejs=require(_0xed6c('0xa'));var fs=require('fs');var fs_extra=require(_0xed6c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xed6c('0xc'));var jsforce=require(_0xed6c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed6c('0xe'));var Papa=require(_0xed6c('0xf'));var Redis=require(_0xed6c('0x10'));var authService=require(_0xed6c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed6c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xed6c('0x13'));var db=require(_0xed6c('0x14'))['db'];function respondWithStatusCode(_0x4efd40,_0x17e109){_0x17e109=_0x17e109||0xcc;return function(_0x55ea5e){if(_0x55ea5e){return _0x4efd40[_0xed6c('0x15')](_0x17e109);}return _0x4efd40[_0xed6c('0x16')](_0x17e109)['end']();};}function respondWithResult(_0x3f3126,_0x32a8c9){_0x32a8c9=_0x32a8c9||0xc8;return function(_0x46d807){if(_0x46d807){return _0x3f3126[_0xed6c('0x16')](_0x32a8c9)['json'](_0x46d807);}};}function respondWithFilteredResult(_0x57ec05,_0x2034d4){return function(_0x3d99b8){if(_0x3d99b8){var _0x156e84=typeof _0x2034d4['offset']===_0xed6c('0x17')&&typeof _0x2034d4['limit']===_0xed6c('0x17');var _0x326350=_0x3d99b8[_0xed6c('0x18')];var _0x1fe8c0=_0x156e84?0x0:_0x2034d4['offset'];var _0x387ba1=_0x156e84?_0x3d99b8[_0xed6c('0x18')]:_0x2034d4[_0xed6c('0x19')]+_0x2034d4['limit'];var _0x3f32a3;if(_0x387ba1>=_0x326350){_0x387ba1=_0x326350;_0x3f32a3=0xc8;}else{_0x3f32a3=0xce;}_0x57ec05[_0xed6c('0x16')](_0x3f32a3);return _0x57ec05[_0xed6c('0x1a')](_0xed6c('0x1b'),_0x1fe8c0+'-'+_0x387ba1+'/'+_0x326350)[_0xed6c('0x1c')](_0x3d99b8);}return null;};}function patchUpdates(_0x5e86ad){return function(_0x85aedf){try{jsonpatch['apply'](_0x85aedf,_0x5e86ad,!![]);}catch(_0x4a3fae){return BPromise[_0xed6c('0x1d')](_0x4a3fae);}return _0x85aedf[_0xed6c('0x1e')]();};}function saveUpdates(_0x34faac,_0x49a583){return function(_0x2fd94b){if(_0x2fd94b){return _0x2fd94b['update'](_0x34faac)[_0xed6c('0x1f')](function(_0x5ea6f4){return _0x5ea6f4;});}return null;};}function removeEntity(_0x7882e0,_0x21e0ba){return function(_0x51876b){if(_0x51876b){return _0x51876b[_0xed6c('0x20')]()[_0xed6c('0x1f')](function(){var _0x1c3aca=_0x51876b[_0xed6c('0x21')]({'plain':!![]});var _0x27fb6c=_0xed6c('0x22');return db[_0xed6c('0x23')][_0xed6c('0x20')]({'where':{'type':_0x27fb6c,'resourceId':_0x1c3aca['id']}})['then'](function(){return _0x51876b;});})[_0xed6c('0x1f')](function(){_0x7882e0[_0xed6c('0x16')](0xcc)[_0xed6c('0x24')]();});}};}function handleEntityNotFound(_0x21d91e,_0x953c0d){return function(_0x3574a3){if(!_0x3574a3){_0x21d91e['sendStatus'](0x194);}return _0x3574a3;};}function handleError(_0x23ee72,_0x2d03d7){_0x2d03d7=_0x2d03d7||0x1f4;return function(_0x3182ce){logger['error'](_0x3182ce['stack']);if(_0x3182ce['name']){delete _0x3182ce['name'];}_0x23ee72[_0xed6c('0x16')](_0x2d03d7)['send'](_0x3182ce);};}exports[_0xed6c('0x25')]=function(_0x4d4feb,_0x202b96){var _0x110238={},_0x47e1bd={},_0x2bef4f={'count':0x0,'rows':[]};var _0x2d2187=_[_0xed6c('0x26')](db[_0xed6c('0x27')][_0xed6c('0x28')],function(_0x10e1e2){return{'name':_0x10e1e2['fieldName'],'type':_0x10e1e2[_0xed6c('0x29')][_0xed6c('0x2a')]};});_0x47e1bd['model']=_[_0xed6c('0x26')](_0x2d2187,'name');_0x47e1bd[_0xed6c('0x2b')]=_[_0xed6c('0x2c')](_0x4d4feb[_0xed6c('0x2b')]);_0x47e1bd[_0xed6c('0x2d')]=_[_0xed6c('0x2e')](_0x47e1bd[_0xed6c('0x2f')],_0x47e1bd['query']);_0x110238['attributes']=_['intersection'](_0x47e1bd[_0xed6c('0x2f')],qs[_0xed6c('0x30')](_0x4d4feb[_0xed6c('0x2b')]['fields']));_0x110238[_0xed6c('0x31')]=_0x110238[_0xed6c('0x31')][_0xed6c('0x32')]?_0x110238[_0xed6c('0x31')]:_0x47e1bd[_0xed6c('0x2f')];if(!_0x4d4feb[_0xed6c('0x2b')][_0xed6c('0x33')](_0xed6c('0x34'))){_0x110238[_0xed6c('0x35')]=qs[_0xed6c('0x35')](_0x4d4feb[_0xed6c('0x2b')][_0xed6c('0x35')]);_0x110238['offset']=qs[_0xed6c('0x19')](_0x4d4feb[_0xed6c('0x2b')][_0xed6c('0x19')]);}_0x110238[_0xed6c('0x36')]=qs['sort'](_0x4d4feb[_0xed6c('0x2b')][_0xed6c('0x37')]);_0x110238[_0xed6c('0x38')]=qs['filters'](_[_0xed6c('0x39')](_0x4d4feb['query'],_0x47e1bd[_0xed6c('0x2d')]),_0x2d2187);if(_0x4d4feb[_0xed6c('0x2b')][_0xed6c('0x3a')]){_0x110238['where']=_[_0xed6c('0x3b')](_0x110238[_0xed6c('0x38')],{'$or':_[_0xed6c('0x26')](_0x2d2187,function(_0x275f2f){if(_0x275f2f[_0xed6c('0x29')]!==_0xed6c('0x3c')){var _0x124865={};_0x124865[_0x275f2f[_0xed6c('0x3d')]]={'$like':'%'+_0x4d4feb[_0xed6c('0x2b')][_0xed6c('0x3a')]+'%'};return _0x124865;}})});}_0x110238=_[_0xed6c('0x3b')]({},_0x110238,_0x4d4feb[_0xed6c('0x3e')]);var _0x3c3c8e={'where':_0x110238[_0xed6c('0x38')]};return db[_0xed6c('0x27')][_0xed6c('0x18')](_0x3c3c8e)['then'](function(_0x10d810){_0x2bef4f[_0xed6c('0x18')]=_0x10d810;if(_0x4d4feb['query'][_0xed6c('0x3f')]){_0x110238[_0xed6c('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x110238);})[_0xed6c('0x1f')](function(_0x177544){_0x2bef4f['rows']=_0x177544;return _0x2bef4f;})[_0xed6c('0x1f')](respondWithFilteredResult(_0x202b96,_0x110238))[_0xed6c('0x41')](handleError(_0x202b96,null));};exports['show']=function(_0x5a09c5,_0xa10ed8){var _0x81b60={'raw':![],'where':{'id':_0x5a09c5[_0xed6c('0x42')]['id']}},_0x3a9d5d={};_0x3a9d5d['model']=_[_0xed6c('0x2c')](db[_0xed6c('0x27')][_0xed6c('0x28')]);_0x3a9d5d[_0xed6c('0x2b')]=_[_0xed6c('0x2c')](_0x5a09c5[_0xed6c('0x2b')]);_0x3a9d5d[_0xed6c('0x2d')]=_[_0xed6c('0x2e')](_0x3a9d5d[_0xed6c('0x2f')],_0x3a9d5d['query']);_0x81b60[_0xed6c('0x31')]=_['intersection'](_0x3a9d5d[_0xed6c('0x2f')],qs[_0xed6c('0x30')](_0x5a09c5[_0xed6c('0x2b')][_0xed6c('0x30')]));_0x81b60['attributes']=_0x81b60[_0xed6c('0x31')]['length']?_0x81b60[_0xed6c('0x31')]:_0x3a9d5d[_0xed6c('0x2f')];if(_0x5a09c5[_0xed6c('0x2b')][_0xed6c('0x3f')]){_0x81b60['include']=[{'all':!![]}];}_0x81b60=_[_0xed6c('0x3b')]({},_0x81b60,_0x5a09c5[_0xed6c('0x3e')]);return db[_0xed6c('0x27')][_0xed6c('0x43')](_0x81b60)[_0xed6c('0x1f')](handleEntityNotFound(_0xa10ed8,null))[_0xed6c('0x1f')](respondWithResult(_0xa10ed8,null))[_0xed6c('0x41')](handleError(_0xa10ed8,null));};exports[_0xed6c('0x44')]=function(_0x2475eb,_0x124616){return db[_0xed6c('0x27')][_0xed6c('0x44')](_0x2475eb[_0xed6c('0x45')],{})[_0xed6c('0x1f')](function(_0x10434a){var _0x3032ba=_0x2475eb[_0xed6c('0x46')]['get']({'plain':!![]});if(!_0x3032ba)throw new Error(_0xed6c('0x47'));if(_0x3032ba[_0xed6c('0x48')]===_0xed6c('0x46')){var _0x3ce893=_0x10434a[_0xed6c('0x21')]({'plain':!![]});var _0x200a7a=_0xed6c('0x22');return db[_0xed6c('0x49')]['find']({'where':{'name':_0x200a7a,'userProfileId':_0x3032ba[_0xed6c('0x4a')]},'raw':!![]})[_0xed6c('0x1f')](function(_0x42d2ec){if(_0x42d2ec&&_0x42d2ec[_0xed6c('0x4b')]===0x0){return db[_0xed6c('0x23')][_0xed6c('0x44')]({'name':_0x3ce893['name'],'resourceId':_0x3ce893['id'],'type':_0x42d2ec[_0xed6c('0x3d')],'sectionId':_0x42d2ec['id']},{})[_0xed6c('0x1f')](function(){return _0x10434a;});}else{return _0x10434a;}})[_0xed6c('0x41')](function(_0x3808b1){logger['error'](_0xed6c('0x4c'),_0x3808b1);throw _0x3808b1;});}return _0x10434a;})[_0xed6c('0x1f')](respondWithResult(_0x124616,0xc9))[_0xed6c('0x41')](handleError(_0x124616,null));};exports[_0xed6c('0x4d')]=function(_0x32c422,_0x584b18){if(_0x32c422[_0xed6c('0x45')]['id']){delete _0x32c422[_0xed6c('0x45')]['id'];}return db['VoiceChanSpy'][_0xed6c('0x43')]({'where':{'id':_0x32c422[_0xed6c('0x42')]['id']}})['then'](handleEntityNotFound(_0x584b18,null))[_0xed6c('0x1f')](saveUpdates(_0x32c422[_0xed6c('0x45')],null))[_0xed6c('0x1f')](respondWithResult(_0x584b18,null))[_0xed6c('0x41')](handleError(_0x584b18,null));};exports['destroy']=function(_0x39d335,_0x4e8fd8){return db[_0xed6c('0x27')][_0xed6c('0x43')]({'where':{'id':_0x39d335[_0xed6c('0x42')]['id']}})[_0xed6c('0x1f')](handleEntityNotFound(_0x4e8fd8,null))[_0xed6c('0x1f')](removeEntity(_0x4e8fd8,null))[_0xed6c('0x41')](handleError(_0x4e8fd8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index a3ef2e9..d91f978 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 _0xd23c=['from-sip','format','%s%s','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal','User','findAll','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','context'];(function(_0x3fa2af,_0x4eb094){var _0x39c5ba=function(_0x21aa10){while(--_0x21aa10){_0x3fa2af['push'](_0x3fa2af['shift']());}};_0x39c5ba(++_0x4eb094);}(_0xd23c,0x12c));var _0xcd23=function(_0x3bca8f,_0x12993f){_0x3bca8f=_0x3bca8f-0x0;var _0x66b1da=_0xd23c[_0x3bca8f];return _0x66b1da;};'use strict';var _=require(_0xcd23('0x0'));var util=require(_0xcd23('0x1'));var BPromise=require(_0xcd23('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x536cc8,_0x3f7838,_0x58e160){var _0xb16b51=0x1;var _0x4ed00c=[];var _0x2c3d32={'context':_0x3f7838[_0xcd23('0x3')]||_0xcd23('0x4'),'exten':util[_0xcd23('0x5')](_0xcd23('0x6'),_0x536cc8['prefix'],_0x58e160),'type':'system','isApp':![],'ChanSpyId':_0x536cc8['id'],'UserId':_0x3f7838['id']};_0x4ed00c[_0xcd23('0x7')](_[_0xcd23('0x8')]({'app':_0xcd23('0x9'),'appdata':util[_0xcd23('0x5')](_0xcd23('0xa'),_0xcd23('0xb')),'priority':_0xb16b51++},_0x2c3d32));if(_0x536cc8[_0xcd23('0xc')]){_0x4ed00c[_0xcd23('0x7')](_['merge']({'app':'MixMonitor','appdata':util['format'](_0xcd23('0xd'),_0x536cc8[_0xcd23('0xe')]),'priority':_0xb16b51++},_0x2c3d32));}if(_0x536cc8[_0xcd23('0xf')]){_0x4ed00c[_0xcd23('0x7')](_[_0xcd23('0x8')]({'app':_0xcd23('0x10'),'appdata':_0x536cc8[_0xcd23('0x11')],'priority':_0xb16b51++},_0x2c3d32));}_0x4ed00c[_0xcd23('0x7')](_[_0xcd23('0x8')]({'app':_0xcd23('0x12'),'appdata':util[_0xcd23('0x5')](_0xcd23('0x13'),_0x3f7838[_0xcd23('0x14')],_0x536cc8[_0xcd23('0x15')]?_0x536cc8[_0xcd23('0x15')]['join'](''):''),'priority':_0xb16b51++},_0x2c3d32));if(_0x536cc8['record']){_0x4ed00c['push'](_[_0xcd23('0x8')]({'app':_0xcd23('0x16'),'priority':_0xb16b51++},_0x2c3d32));}return _0x4ed00c;};var getChanSpyApplications=function(_0x48d58b,_0x39ac6c){var _0x2da181=[];for(var _0x2ad6a0=0x0,_0xd1c36d=0x1;_0x2ad6a0<_0x39ac6c[_0xcd23('0x17')];_0x2ad6a0++,_0xd1c36d=0x1){_0x2da181=_0x2da181[_0xcd23('0x18')](getUserApplications(_0x48d58b,_0x39ac6c[_0x2ad6a0],_0x39ac6c[_0x2ad6a0][_0xcd23('0x19')]));if(_0x39ac6c[_0x2ad6a0][_0xcd23('0x19')]!=_0x39ac6c[_0x2ad6a0][_0xcd23('0x14')]){_0x2da181=_0x2da181[_0xcd23('0x18')](getUserApplications(_0x48d58b,_0x39ac6c[_0x2ad6a0],_0x39ac6c[_0x2ad6a0][_0xcd23('0x14')]));}}return _0x2da181;};var getChanSpyPromise=function(_0x1cd75e,_0x42ffba){return new BPromise(function(_0x1f97f7,_0x17c927){return _0x1cd75e[_0xcd23('0x1a')][_0xcd23('0x1b')]({'attributes':['id','name','internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x2b6048){if(_0x2b6048){return _0x1f97f7(getChanSpyApplications(_0x42ffba,_0x2b6048));}return _0x1f97f7([]);})[_0xcd23('0x1c')](function(_0x1926d7){_0x17c927(_0x1926d7);});});};module[_0xcd23('0x1d')]=function(_0x2113e5,_0xd687dd){var _0x58c111=_0x2113e5[_0xcd23('0x1e')];return _0x2113e5[_0xcd23('0x1f')](_0xcd23('0x20'),attributes,{'tableName':_0xcd23('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xa40782,_0x1af0bd,_0x3ea069){return getChanSpyPromise(_0x58c111,_0xa40782)[_0xcd23('0x22')](function(_0xaac128){if(_0xaac128&&_0xaac128[_0xcd23('0x17')]){return _0x58c111[_0xcd23('0x23')][_0xcd23('0x24')](_0xaac128);}})[_0xcd23('0x22')](function(){_0x3ea069();})['catch'](function(_0x3549af){_0x3ea069(_0x3549af);});},'afterUpdate':function(_0x143db4,_0x2d0247,_0x4991db){return _0x58c111[_0xcd23('0x23')][_0xcd23('0x25')]({'where':{'ChanSpyId':_0x143db4['id']}})[_0xcd23('0x22')](function(){return getChanSpyPromise(_0x58c111,_0x143db4);})['then'](function(_0xbd9ef6){if(_0xbd9ef6&&_0xbd9ef6[_0xcd23('0x17')]){return _0x58c111[_0xcd23('0x23')][_0xcd23('0x24')](_0xbd9ef6);}})['then'](function(){_0x4991db();})['catch'](function(_0x17e77c){_0x4991db(_0x17e77c);});},'afterDestroy':function(_0x3112f5,_0x5bf027,_0x44f235){return _0x58c111[_0xcd23('0x23')][_0xcd23('0x25')]({'where':{'ChanSpyId':_0x3112f5['id']}})[_0xcd23('0x22')](function(){_0x44f235();})['catch'](function(_0x40622f){_0x44f235(_0x40622f);});}}});}; \ No newline at end of file +var _0xad57=['then','catch','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','options','StopMixMonitor','length','concat','internal','name','agent','exports','models','define','VoiceChanSpy','voice_chanspy'];(function(_0x449508,_0x1dbb71){var _0x2cd9d6=function(_0x3a2d89){while(--_0x3a2d89){_0x449508['push'](_0x449508['shift']());}};_0x2cd9d6(++_0x1dbb71);}(_0xad57,0x180));var _0x7ad5=function(_0xab30fd,_0x132cc0){_0xab30fd=_0xab30fd-0x0;var _0x486fa0=_0xad57[_0xab30fd];return _0x486fa0;};'use strict';var _=require(_0x7ad5('0x0'));var util=require(_0x7ad5('0x1'));var BPromise=require(_0x7ad5('0x2'));var attributes=require(_0x7ad5('0x3'));var getUserApplications=function(_0x477747,_0x518aab,_0x1efbd3){var _0x41574b=0x1;var _0x7f21b9=[];var _0x42a8ee={'context':_0x518aab[_0x7ad5('0x4')]||_0x7ad5('0x5'),'exten':util[_0x7ad5('0x6')](_0x7ad5('0x7'),_0x477747[_0x7ad5('0x8')],_0x1efbd3),'type':_0x7ad5('0x9'),'isApp':![],'ChanSpyId':_0x477747['id'],'UserId':_0x518aab['id']};_0x7f21b9[_0x7ad5('0xa')](_[_0x7ad5('0xb')]({'app':_0x7ad5('0xc'),'appdata':util[_0x7ad5('0x6')](_0x7ad5('0xd'),_0x7ad5('0xe')),'priority':_0x41574b++},_0x42a8ee));if(_0x477747[_0x7ad5('0xf')]){_0x7f21b9[_0x7ad5('0xa')](_[_0x7ad5('0xb')]({'app':'MixMonitor','appdata':util[_0x7ad5('0x6')](_0x7ad5('0x10'),_0x477747[_0x7ad5('0x11')]),'priority':_0x41574b++},_0x42a8ee));}if(_0x477747[_0x7ad5('0x12')]){_0x7f21b9['push'](_[_0x7ad5('0xb')]({'app':_0x7ad5('0x13'),'appdata':_0x477747[_0x7ad5('0x14')],'priority':_0x41574b++},_0x42a8ee));}_0x7f21b9[_0x7ad5('0xa')](_[_0x7ad5('0xb')]({'app':_0x7ad5('0x15'),'appdata':util[_0x7ad5('0x6')]('SIP/%s,%s',_0x518aab['name'],_0x477747[_0x7ad5('0x16')]?_0x477747['options']['join'](''):''),'priority':_0x41574b++},_0x42a8ee));if(_0x477747[_0x7ad5('0xf')]){_0x7f21b9[_0x7ad5('0xa')](_[_0x7ad5('0xb')]({'app':_0x7ad5('0x17'),'priority':_0x41574b++},_0x42a8ee));}return _0x7f21b9;};var getChanSpyApplications=function(_0x13b171,_0x4f197d){var _0x248f8b=[];for(var _0x5a6237=0x0,_0x218bde=0x1;_0x5a6237<_0x4f197d[_0x7ad5('0x18')];_0x5a6237++,_0x218bde=0x1){_0x248f8b=_0x248f8b[_0x7ad5('0x19')](getUserApplications(_0x13b171,_0x4f197d[_0x5a6237],_0x4f197d[_0x5a6237][_0x7ad5('0x1a')]));if(_0x4f197d[_0x5a6237][_0x7ad5('0x1a')]!=_0x4f197d[_0x5a6237][_0x7ad5('0x1b')]){_0x248f8b=_0x248f8b[_0x7ad5('0x19')](getUserApplications(_0x13b171,_0x4f197d[_0x5a6237],_0x4f197d[_0x5a6237][_0x7ad5('0x1b')]));}}return _0x248f8b;};var getChanSpyPromise=function(_0xe8968c,_0x2b1bb9){return new BPromise(function(_0x30d8f1,_0x49feba){return _0xe8968c['User']['findAll']({'attributes':['id','name',_0x7ad5('0x1a')],'where':{'role':_0x7ad5('0x1c'),'chanspy':!![]},'raw':!![]})['then'](function(_0x1e6847){if(_0x1e6847){return _0x30d8f1(getChanSpyApplications(_0x2b1bb9,_0x1e6847));}return _0x30d8f1([]);})['catch'](function(_0xf0241a){_0x49feba(_0xf0241a);});});};module[_0x7ad5('0x1d')]=function(_0x2a96b2,_0x12cf6c){var _0x271b17=_0x2a96b2[_0x7ad5('0x1e')];return _0x2a96b2[_0x7ad5('0x1f')](_0x7ad5('0x20'),attributes,{'tableName':_0x7ad5('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x57d1bc,_0x2935b6,_0x3ef8f4){return getChanSpyPromise(_0x271b17,_0x57d1bc)[_0x7ad5('0x22')](function(_0x630d80){if(_0x630d80&&_0x630d80[_0x7ad5('0x18')]){return _0x271b17['VoiceExtension']['bulkCreate'](_0x630d80);}})[_0x7ad5('0x22')](function(){_0x3ef8f4();})[_0x7ad5('0x23')](function(_0x59bfc9){_0x3ef8f4(_0x59bfc9);});},'afterUpdate':function(_0x36aa02,_0x3e087f,_0x2ec1c2){return _0x271b17[_0x7ad5('0x24')][_0x7ad5('0x25')]({'where':{'ChanSpyId':_0x36aa02['id']}})[_0x7ad5('0x22')](function(){return getChanSpyPromise(_0x271b17,_0x36aa02);})[_0x7ad5('0x22')](function(_0x3dbcc9){if(_0x3dbcc9&&_0x3dbcc9[_0x7ad5('0x18')]){return _0x271b17[_0x7ad5('0x24')]['bulkCreate'](_0x3dbcc9);}})[_0x7ad5('0x22')](function(){_0x2ec1c2();})['catch'](function(_0x5564dd){_0x2ec1c2(_0x5564dd);});},'afterDestroy':function(_0x248af8,_0x468c3b,_0x1f05a2){return _0x271b17[_0x7ad5('0x24')][_0x7ad5('0x25')]({'where':{'ChanSpyId':_0x248af8['id']}})['then'](function(){_0x1f05a2();})[_0x7ad5('0x23')](function(_0xffc743){_0x1f05a2(_0xffc743);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 3f3f195..48eed91 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 _0xa75b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x50cd41,_0x25e72b){var _0x4c0791=function(_0x3a59fa){while(--_0x3a59fa){_0x50cd41['push'](_0x50cd41['shift']());}};_0x4c0791(++_0x25e72b);}(_0xa75b,0x170));var _0xba75=function(_0x50dd29,_0xbc0961){_0x50dd29=_0x50dd29-0x0;var _0x4c0ceb=_0xa75b[_0x50dd29];return _0x4c0ceb;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});} \ No newline at end of file +var _0x9f4d=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x4fa214,_0x3e7f72){var _0x5f5c95=function(_0x1367dd){while(--_0x1367dd){_0x4fa214['push'](_0x4fa214['shift']());}};_0x5f5c95(++_0x3e7f72);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x9686e3,_0x205f24){_0x9686e3=_0x9686e3-0x0;var _0x4d6220=_0x9f4d[_0x9686e3];return _0x4d6220;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var moment=require(_0xd9f4('0x2'));var BPromise=require(_0xd9f4('0x3'));var rs=require(_0xd9f4('0x4'));var fs=require('fs');var Redis=require(_0xd9f4('0x5'));var db=require(_0xd9f4('0x6'))['db'];var utils=require(_0xd9f4('0x7'));var logger=require(_0xd9f4('0x8'))('rpc');var config=require(_0xd9f4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9f4('0xa')][_0xd9f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cc036,_0x366b9d,_0x5cf448){return new BPromise(function(_0x6b13b5,_0x18305f){return client['request'](_0x2cc036,_0x5cf448)[_0xd9f4('0xc')](function(_0x47d52f){logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));logger[_0xd9f4('0x10')](_0xd9f4('0x11'),_0x366b9d,'request\x20sent',JSON[_0xd9f4('0x12')](_0x47d52f));if(_0x47d52f[_0xd9f4('0x13')]){if(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x14')]===0x1f4){logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x18305f(_0x47d52f['error'][_0xd9f4('0x15')]);}logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x6b13b5(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);}else{logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));_0x6b13b5(_0x47d52f[_0xd9f4('0x16')][_0xd9f4('0x15')]);}})[_0xd9f4('0x17')](function(_0x5e7da1){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x366b9d,_0x5e7da1);_0x18305f(_0x5e7da1);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 5ee422e..62eafe3 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 _0x12ce=['./voiceContext.controller','get','isAuthenticated','show','post','create','/:id','update','delete','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x1654f5,_0x5e1214){var _0x37cd7d=function(_0x9d544e){while(--_0x9d544e){_0x1654f5['push'](_0x1654f5['shift']());}};_0x37cd7d(++_0x5e1214);}(_0x12ce,0xbd));var _0xe12c=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x12ce[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0xe12c('0x0'));var util=require(_0xe12c('0x1'));var path=require(_0xe12c('0x2'));var timeout=require(_0xe12c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe12c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe12c('0x5'));var controller=require(_0xe12c('0x6'));router[_0xe12c('0x7')]('/',auth[_0xe12c('0x8')](),controller['index']);router[_0xe12c('0x7')]('/:id',auth[_0xe12c('0x8')](),controller[_0xe12c('0x9')]);router[_0xe12c('0xa')]('/',auth['isAuthenticated'](),controller[_0xe12c('0xb')]);router['put'](_0xe12c('0xc'),auth[_0xe12c('0x8')](),controller[_0xe12c('0xd')]);router[_0xe12c('0xe')](_0xe12c('0xc'),auth[_0xe12c('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe730=['delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x12723c,_0x148a5a){var _0x3fc804=function(_0x810da6){while(--_0x810da6){_0x12723c['push'](_0x12723c['shift']());}};_0x3fc804(++_0x148a5a);}(_0xe730,0x13e));var _0x0e73=function(_0x43ccf7,_0x2a901a){_0x43ccf7=_0x43ccf7-0x0;var _0x106166=_0xe730[_0x43ccf7];return _0x106166;};'use strict';var multer=require(_0x0e73('0x0'));var util=require('util');var path=require(_0x0e73('0x1'));var timeout=require('connect-timeout');var express=require(_0x0e73('0x2'));var router=express[_0x0e73('0x3')]();var fs_extra=require(_0x0e73('0x4'));var auth=require(_0x0e73('0x5'));var interaction=require(_0x0e73('0x6'));var config=require(_0x0e73('0x7'));var controller=require(_0x0e73('0x8'));router[_0x0e73('0x9')]('/',auth[_0x0e73('0xa')](),controller[_0x0e73('0xb')]);router['get'](_0x0e73('0xc'),auth[_0x0e73('0xa')](),controller[_0x0e73('0xd')]);router[_0x0e73('0xe')]('/',auth['isAuthenticated'](),controller[_0x0e73('0xf')]);router[_0x0e73('0x10')](_0x0e73('0xc'),auth[_0x0e73('0xa')](),controller[_0x0e73('0x11')]);router[_0x0e73('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0e73('0x13')]);module[_0x0e73('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 52e2891..21bde5d 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 _0x2d5f=['BOOLEAN','sequelize','STRING'];(function(_0x5d54db,_0x4bd371){var _0x540989=function(_0x512929){while(--_0x512929){_0x5d54db['push'](_0x5d54db['shift']());}};_0x540989(++_0x4bd371);}(_0x2d5f,0x1f0));var _0xf2d5=function(_0x3cf7df,_0x43b053){_0x3cf7df=_0x3cf7df-0x0;var _0x52ca51=_0x2d5f[_0x3cf7df];return _0x52ca51;};'use strict';var Sequelize=require(_0xf2d5('0x0'));module['exports']={'name':{'type':Sequelize[_0xf2d5('0x1')],'unique':'name'},'description':{'type':Sequelize[_0xf2d5('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xf2d5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x209b=['exports','name','STRING','BOOLEAN','sequelize'];(function(_0x212322,_0x51249a){var _0x1eb1fb=function(_0x415a9d){while(--_0x415a9d){_0x212322['push'](_0x212322['shift']());}};_0x1eb1fb(++_0x51249a);}(_0x209b,0xcc));var _0xb209=function(_0x535956,_0x411673){_0x535956=_0x535956-0x0;var _0x5b21ab=_0x209b[_0x535956];return _0x5b21ab;};'use strict';var Sequelize=require(_0xb209('0x0'));module[_0xb209('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb209('0x2')},'description':{'type':Sequelize[_0xb209('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xb209('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index d74d1f9..447421c 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 _0x97b8=['body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','destroy','get','Contexts','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','find','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x97b8,0xe2));var _0x897b=function(_0x30f68b,_0x296bce){_0x30f68b=_0x30f68b-0x0;var _0x2d984a=_0x97b8[_0x30f68b];return _0x2d984a;};'use strict';var emlformat=require(_0x897b('0x0'));var rimraf=require(_0x897b('0x1'));var zipdir=require(_0x897b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x897b('0x3'));var moment=require(_0x897b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x897b('0x5'));var util=require(_0x897b('0x6'));var path=require('path');var sox=require(_0x897b('0x7'));var csv=require('to-csv');var ejs=require(_0x897b('0x8'));var fs=require('fs');var fs_extra=require(_0x897b('0x9'));var _=require(_0x897b('0xa'));var squel=require(_0x897b('0xb'));var crypto=require(_0x897b('0xc'));var jsforce=require(_0x897b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x897b('0xe'));var querystring=require('querystring');var Papa=require(_0x897b('0xf'));var Redis=require(_0x897b('0x10'));var authService=require(_0x897b('0x11'));var qs=require(_0x897b('0x12'));var as=require(_0x897b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x897b('0x14'))(_0x897b('0x15'));var utils=require(_0x897b('0x16'));var config=require(_0x897b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x897b('0x18'))['db'];var jayson=require(_0x897b('0x19'));var client=jayson[_0x897b('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5436e0,_0x2dbc70,_0x592f05,_0x186789){return new BPromise(function(_0x581837,_0x4e803b){var _0x29d935=_0x186789||client;return _0x29d935['request'](_0x5436e0,_0x592f05)[_0x897b('0x1b')](function(_0x643fa6){logger['info'](_0x897b('0x1c'),_0x2dbc70,_0x897b('0x1d'));logger[_0x897b('0x1e')](_0x897b('0x1f'),_0x2dbc70,_0x897b('0x1d'),JSON[_0x897b('0x20')](_0x643fa6));if(_0x643fa6[_0x897b('0x21')]){if(_0x643fa6[_0x897b('0x21')][_0x897b('0x22')]===0x1f4){logger[_0x897b('0x21')](_0x897b('0x1c'),_0x2dbc70,_0x643fa6[_0x897b('0x21')][_0x897b('0x23')]);return _0x4e803b(_0x643fa6[_0x897b('0x21')]['message']);}logger[_0x897b('0x21')](_0x897b('0x1c'),_0x2dbc70,_0x643fa6[_0x897b('0x21')]['message']);return _0x581837(_0x643fa6[_0x897b('0x21')][_0x897b('0x23')]);}else{logger[_0x897b('0x24')](_0x897b('0x1c'),_0x2dbc70,_0x897b('0x1d'));_0x581837(_0x643fa6[_0x897b('0x25')][_0x897b('0x23')]);}})['catch'](function(_0x5cb583){logger[_0x897b('0x21')]('VoiceContext,\x20%s,\x20%s',_0x2dbc70,_0x5cb583);_0x4e803b(_0x5cb583);});});}function respondWithStatusCode(_0x4bf479,_0x5b1c53){_0x5b1c53=_0x5b1c53||0xcc;return function(_0x5930d6){if(_0x5930d6){return _0x4bf479['sendStatus'](_0x5b1c53);}return _0x4bf479['status'](_0x5b1c53)[_0x897b('0x26')]();};}function respondWithResult(_0x44095a,_0x26b423){_0x26b423=_0x26b423||0xc8;return function(_0x226d21){if(_0x226d21){return _0x44095a[_0x897b('0x27')](_0x26b423)[_0x897b('0x28')](_0x226d21);}};}function respondWithFilteredResult(_0x2df520,_0x28804b){return function(_0x3e8c29){if(_0x3e8c29){var _0x208f53=typeof _0x28804b[_0x897b('0x29')]==='undefined'&&typeof _0x28804b[_0x897b('0x2a')]===_0x897b('0x2b');var _0x1374e8=_0x3e8c29['count'];var _0x3450dd=_0x208f53?0x0:_0x28804b['offset'];var _0x6b1aa=_0x208f53?_0x3e8c29[_0x897b('0x2c')]:_0x28804b[_0x897b('0x29')]+_0x28804b['limit'];var _0x1f0874;if(_0x6b1aa>=_0x1374e8){_0x6b1aa=_0x1374e8;_0x1f0874=0xc8;}else{_0x1f0874=0xce;}_0x2df520['status'](_0x1f0874);return _0x2df520[_0x897b('0x2d')](_0x897b('0x2e'),_0x3450dd+'-'+_0x6b1aa+'/'+_0x1374e8)[_0x897b('0x28')](_0x3e8c29);}return null;};}function patchUpdates(_0x465479){return function(_0x1a07c5){try{jsonpatch[_0x897b('0x2f')](_0x1a07c5,_0x465479,!![]);}catch(_0x48515c){return BPromise['reject'](_0x48515c);}return _0x1a07c5[_0x897b('0x30')]();};}function saveUpdates(_0xb87599,_0x49fab0){return function(_0x4cede7){if(_0x4cede7){return _0x4cede7['update'](_0xb87599)[_0x897b('0x1b')](function(_0x9a5373){return _0x9a5373;});}return null;};}function removeEntity(_0x32cf13,_0x93623e){return function(_0x1bdd7f){if(_0x1bdd7f){return _0x1bdd7f[_0x897b('0x31')]()[_0x897b('0x1b')](function(){var _0x44b77a=_0x1bdd7f[_0x897b('0x32')]({'plain':!![]});var _0xaa0de3=_0x897b('0x33');return db[_0x897b('0x34')][_0x897b('0x31')]({'where':{'type':_0xaa0de3,'resourceId':_0x44b77a['id']}})[_0x897b('0x1b')](function(){return _0x1bdd7f;});})[_0x897b('0x1b')](function(){_0x32cf13['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21e3c6,_0x3f0b9f){return function(_0x428078){if(!_0x428078){_0x21e3c6['sendStatus'](0x194);}return _0x428078;};}function handleError(_0x157d81,_0x4c5c6f){_0x4c5c6f=_0x4c5c6f||0x1f4;return function(_0x3c0787){logger[_0x897b('0x21')](_0x3c0787['stack']);if(_0x3c0787[_0x897b('0x35')]){delete _0x3c0787[_0x897b('0x35')];}_0x157d81['status'](_0x4c5c6f)[_0x897b('0x36')](_0x3c0787);};}exports[_0x897b('0x37')]=function(_0x3fe76e,_0x4dc10d){var _0x4bf07d={},_0x3c9c6b={},_0x242927={'count':0x0,'rows':[]};var _0x2a1cbc=_[_0x897b('0x38')](db[_0x897b('0x39')][_0x897b('0x3a')],function(_0x9b6045){return{'name':_0x9b6045[_0x897b('0x3b')],'type':_0x9b6045['type']['key']};});_0x3c9c6b['model']=_['map'](_0x2a1cbc,'name');_0x3c9c6b[_0x897b('0x3c')]=_[_0x897b('0x3d')](_0x3fe76e[_0x897b('0x3c')]);_0x3c9c6b[_0x897b('0x3e')]=_['intersection'](_0x3c9c6b[_0x897b('0x3f')],_0x3c9c6b[_0x897b('0x3c')]);_0x4bf07d[_0x897b('0x40')]=_[_0x897b('0x41')](_0x3c9c6b[_0x897b('0x3f')],qs[_0x897b('0x42')](_0x3fe76e[_0x897b('0x3c')][_0x897b('0x42')]));_0x4bf07d[_0x897b('0x40')]=_0x4bf07d['attributes'][_0x897b('0x43')]?_0x4bf07d['attributes']:_0x3c9c6b[_0x897b('0x3f')];if(!_0x3fe76e[_0x897b('0x3c')][_0x897b('0x44')](_0x897b('0x45'))){_0x4bf07d[_0x897b('0x2a')]=qs[_0x897b('0x2a')](_0x3fe76e[_0x897b('0x3c')][_0x897b('0x2a')]);_0x4bf07d['offset']=qs[_0x897b('0x29')](_0x3fe76e[_0x897b('0x3c')][_0x897b('0x29')]);}_0x4bf07d[_0x897b('0x46')]=qs[_0x897b('0x47')](_0x3fe76e[_0x897b('0x3c')][_0x897b('0x47')]);_0x4bf07d[_0x897b('0x48')]=qs[_0x897b('0x3e')](_[_0x897b('0x49')](_0x3fe76e[_0x897b('0x3c')],_0x3c9c6b[_0x897b('0x3e')]),_0x2a1cbc);if(_0x3fe76e[_0x897b('0x3c')][_0x897b('0x4a')]){_0x4bf07d['where']=_[_0x897b('0x4b')](_0x4bf07d[_0x897b('0x48')],{'$or':_['map'](_0x2a1cbc,function(_0x450295){if(_0x450295['type']!==_0x897b('0x4c')){var _0x68181e={};_0x68181e[_0x450295[_0x897b('0x35')]]={'$like':'%'+_0x3fe76e[_0x897b('0x3c')][_0x897b('0x4a')]+'%'};return _0x68181e;}})});}_0x4bf07d=_[_0x897b('0x4b')]({},_0x4bf07d,_0x3fe76e['options']);var _0x3e4a1f={'where':_0x4bf07d[_0x897b('0x48')]};return db[_0x897b('0x39')][_0x897b('0x2c')](_0x3e4a1f)[_0x897b('0x1b')](function(_0x29b873){_0x242927[_0x897b('0x2c')]=_0x29b873;if(_0x3fe76e[_0x897b('0x3c')][_0x897b('0x4d')]){_0x4bf07d['include']=[{'all':!![]}];}return db[_0x897b('0x39')][_0x897b('0x4e')](_0x4bf07d);})[_0x897b('0x1b')](function(_0x33e89c){_0x242927[_0x897b('0x4f')]=_0x33e89c;return _0x242927;})[_0x897b('0x1b')](respondWithFilteredResult(_0x4dc10d,_0x4bf07d))[_0x897b('0x50')](handleError(_0x4dc10d,null));};exports[_0x897b('0x51')]=function(_0x2a44e8,_0x34cd48){var _0x15aea9={'raw':![],'where':{'id':_0x2a44e8[_0x897b('0x52')]['id']}},_0x5c3f05={};_0x5c3f05[_0x897b('0x3f')]=_['keys'](db[_0x897b('0x39')][_0x897b('0x3a')]);_0x5c3f05['query']=_[_0x897b('0x3d')](_0x2a44e8['query']);_0x5c3f05['filters']=_[_0x897b('0x41')](_0x5c3f05[_0x897b('0x3f')],_0x5c3f05['query']);_0x15aea9[_0x897b('0x40')]=_[_0x897b('0x41')](_0x5c3f05[_0x897b('0x3f')],qs[_0x897b('0x42')](_0x2a44e8[_0x897b('0x3c')][_0x897b('0x42')]));_0x15aea9['attributes']=_0x15aea9['attributes'][_0x897b('0x43')]?_0x15aea9[_0x897b('0x40')]:_0x5c3f05[_0x897b('0x3f')];if(_0x2a44e8[_0x897b('0x3c')][_0x897b('0x4d')]){_0x15aea9[_0x897b('0x53')]=[{'all':!![]}];}_0x15aea9=_[_0x897b('0x4b')]({},_0x15aea9,_0x2a44e8['options']);return db['VoiceContext'][_0x897b('0x54')](_0x15aea9)[_0x897b('0x1b')](handleEntityNotFound(_0x34cd48,null))[_0x897b('0x1b')](respondWithResult(_0x34cd48,null))[_0x897b('0x50')](handleError(_0x34cd48,null));};exports[_0x897b('0x55')]=function(_0x46a5ba,_0x427cb2,_0xa4ddfa){var _0x7f2b18;return db[_0x897b('0x39')]['create'](_0x46a5ba[_0x897b('0x56')],{'raw':!![]})[_0x897b('0x1b')](function(_0x4c5efd){_0x7f2b18=_0x4c5efd;return db[_0x897b('0x39')][_0x897b('0x4e')]({'raw':!![]});})[_0x897b('0x1b')](function(_0x5f0a12){var _0x57b4cd=fs[_0x897b('0x57')](path[_0x897b('0x58')](config[_0x897b('0x59')],_0x897b('0x5a')),_0x897b('0x5b'));var _0x7ab735=ejs[_0x897b('0x5c')](_0x57b4cd,{'contexts':_0x5f0a12||[]});fs[_0x897b('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x7ab735);})[_0x897b('0x1b')](function(){return respondWithRpcPromise(_0x897b('0x5e'),_0x897b('0x55'),{'module':_0x897b('0x5f')});})[_0x897b('0x1b')](function(){var _0x1fe572=_0x46a5ba['user']['get']({'plain':!![]});if(!_0x1fe572)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fe572[_0x897b('0x60')]===_0x897b('0x61')){var _0x171a3c=_0x7f2b18[_0x897b('0x32')]({'plain':!![]});return db[_0x897b('0x62')]['find']({'where':{'name':_0x897b('0x33'),'userProfileId':_0x1fe572[_0x897b('0x63')]},'raw':!![]})[_0x897b('0x1b')](function(_0xefc0c2){if(_0xefc0c2&&_0xefc0c2[_0x897b('0x64')]===0x0){return db['UserProfileResource'][_0x897b('0x55')]({'name':_0x171a3c[_0x897b('0x35')],'resourceId':_0x171a3c['id'],'type':_0xefc0c2[_0x897b('0x35')],'sectionId':_0xefc0c2['id']},{})[_0x897b('0x1b')](function(){return _0x7f2b18;});}else{return _0x7f2b18;}})['catch'](function(_0x2dbea8){logger['error'](_0x897b('0x65'),_0x2dbea8);throw _0x2dbea8;});}return _0x7f2b18;})['then'](respondWithResult(_0x427cb2,0xc9))[_0x897b('0x50')](handleError(_0x427cb2,null));};exports[_0x897b('0x66')]=function(_0x17fc5e,_0x39d72c,_0x3a9317){var _0xb669c5;return db[_0x897b('0x39')][_0x897b('0x54')]({'where':{'id':_0x17fc5e[_0x897b('0x52')]['id']}})[_0x897b('0x1b')](handleEntityNotFound(_0x39d72c,null))[_0x897b('0x1b')](saveUpdates(_0x17fc5e[_0x897b('0x56')],null))[_0x897b('0x1b')](function(_0x5f438e){if(_0x5f438e){_0xb669c5=_0x5f438e;return db['VoiceContext'][_0x897b('0x4e')]({'raw':!![]});}})[_0x897b('0x1b')](function(_0xeedaa3){var _0x4fb432=fs[_0x897b('0x57')](path[_0x897b('0x58')](config[_0x897b('0x59')],_0x897b('0x5a')),_0x897b('0x5b'));var _0x14342f=ejs[_0x897b('0x5c')](_0x4fb432,{'contexts':_0xeedaa3||[]});fs[_0x897b('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x14342f);})['then'](function(){return respondWithRpcPromise(_0x897b('0x5e'),_0x897b('0x66'),{'module':_0x897b('0x5f')});})[_0x897b('0x1b')](function(){return _0xb669c5;})[_0x897b('0x1b')](respondWithResult(_0x39d72c,null))[_0x897b('0x50')](handleError(_0x39d72c,null));};exports[_0x897b('0x31')]=function(_0xe20146,_0x999e4,_0x3bc789){var _0x50d434;return db[_0x897b('0x39')]['find']({'where':{'id':_0xe20146[_0x897b('0x52')]['id']}})[_0x897b('0x1b')](handleEntityNotFound(_0x999e4,null))[_0x897b('0x1b')](removeEntity(_0x999e4,null))[_0x897b('0x1b')](function(){return db[_0x897b('0x39')][_0x897b('0x4e')]({'raw':!![]});})[_0x897b('0x1b')](function(_0x4e7d61){var _0x4ebb6c=fs[_0x897b('0x57')](path[_0x897b('0x58')](config[_0x897b('0x59')],_0x897b('0x5a')),_0x897b('0x5b'));var _0x45fd38=ejs[_0x897b('0x5c')](_0x4ebb6c,{'contexts':_0x4e7d61});fs['writeFileSync'](_0x897b('0x67'),_0x45fd38);return respondWithRpcPromise(_0x897b('0x5e'),_0x897b('0x31'),{'module':_0x897b('0x5f')});})[_0x897b('0x50')](handleError(_0x999e4,null));}; \ No newline at end of file +var _0xad9c=['update','destroy','then','Contexts','UserProfileResource','end','sendStatus','stack','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','catch','params','include','find','create','body','findAll','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','chan_sip.so','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0xad9c,0x1d4));var _0xcad9=function(_0xaabe72,_0x4111ae){_0xaabe72=_0xaabe72-0x0;var _0x1d3468=_0xad9c[_0xaabe72];return _0x1d3468;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcad9('0x0'));var rp=require(_0xcad9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcad9('0x2'));var path=require(_0xcad9('0x3'));var sox=require(_0xcad9('0x4'));var csv=require(_0xcad9('0x5'));var ejs=require(_0xcad9('0x6'));var fs=require('fs');var fs_extra=require(_0xcad9('0x7'));var _=require(_0xcad9('0x8'));var squel=require(_0xcad9('0x9'));var crypto=require(_0xcad9('0xa'));var jsforce=require(_0xcad9('0xb'));var deskjs=require(_0xcad9('0xc'));var toCsv=require(_0xcad9('0x5'));var querystring=require(_0xcad9('0xd'));var Papa=require(_0xcad9('0xe'));var Redis=require(_0xcad9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcad9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcad9('0x11'))(_0xcad9('0x12'));var utils=require(_0xcad9('0x13'));var config=require(_0xcad9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xcad9('0x15'))['db'];var jayson=require(_0xcad9('0x16'));var client=jayson[_0xcad9('0x17')][_0xcad9('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1c1ecd,_0x54fab7,_0x492bd5,_0x370247){return new BPromise(function(_0x2fcba6,_0x32c59a){var _0x5ed55c=_0x370247||client;return _0x5ed55c[_0xcad9('0x19')](_0x1c1ecd,_0x492bd5)['then'](function(_0x29387e){logger[_0xcad9('0x1a')](_0xcad9('0x1b'),_0x54fab7,_0xcad9('0x1c'));logger[_0xcad9('0x1d')](_0xcad9('0x1e'),_0x54fab7,'request\x20sent',JSON[_0xcad9('0x1f')](_0x29387e));if(_0x29387e[_0xcad9('0x20')]){if(_0x29387e[_0xcad9('0x20')][_0xcad9('0x21')]===0x1f4){logger[_0xcad9('0x20')](_0xcad9('0x1b'),_0x54fab7,_0x29387e['error'][_0xcad9('0x22')]);return _0x32c59a(_0x29387e[_0xcad9('0x20')]['message']);}logger[_0xcad9('0x20')](_0xcad9('0x1b'),_0x54fab7,_0x29387e['error']['message']);return _0x2fcba6(_0x29387e[_0xcad9('0x20')][_0xcad9('0x22')]);}else{logger[_0xcad9('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x54fab7,'request\x20sent');_0x2fcba6(_0x29387e[_0xcad9('0x23')][_0xcad9('0x22')]);}})['catch'](function(_0x55819d){logger[_0xcad9('0x20')](_0xcad9('0x1b'),_0x54fab7,_0x55819d);_0x32c59a(_0x55819d);});});}function respondWithStatusCode(_0x50140f,_0x415f65){_0x415f65=_0x415f65||0xcc;return function(_0x15c6ae){if(_0x15c6ae){return _0x50140f['sendStatus'](_0x415f65);}return _0x50140f['status'](_0x415f65)['end']();};}function respondWithResult(_0x19417b,_0x29f57d){_0x29f57d=_0x29f57d||0xc8;return function(_0x2aa1e6){if(_0x2aa1e6){return _0x19417b[_0xcad9('0x24')](_0x29f57d)[_0xcad9('0x25')](_0x2aa1e6);}};}function respondWithFilteredResult(_0x47bddd,_0x11784e){return function(_0x105644){if(_0x105644){var _0x11e0a0=typeof _0x11784e[_0xcad9('0x26')]==='undefined'&&typeof _0x11784e[_0xcad9('0x27')]===_0xcad9('0x28');var _0x53d3b3=_0x105644['count'];var _0x46c0be=_0x11e0a0?0x0:_0x11784e['offset'];var _0x8f38d5=_0x11e0a0?_0x105644[_0xcad9('0x29')]:_0x11784e[_0xcad9('0x26')]+_0x11784e[_0xcad9('0x27')];var _0x2c44e2;if(_0x8f38d5>=_0x53d3b3){_0x8f38d5=_0x53d3b3;_0x2c44e2=0xc8;}else{_0x2c44e2=0xce;}_0x47bddd[_0xcad9('0x24')](_0x2c44e2);return _0x47bddd[_0xcad9('0x2a')](_0xcad9('0x2b'),_0x46c0be+'-'+_0x8f38d5+'/'+_0x53d3b3)['json'](_0x105644);}return null;};}function patchUpdates(_0x25cc5b){return function(_0x17a5f2){try{jsonpatch[_0xcad9('0x2c')](_0x17a5f2,_0x25cc5b,!![]);}catch(_0x545b77){return BPromise[_0xcad9('0x2d')](_0x545b77);}return _0x17a5f2[_0xcad9('0x2e')]();};}function saveUpdates(_0x154987,_0x2f530e){return function(_0x1d5644){if(_0x1d5644){return _0x1d5644[_0xcad9('0x2f')](_0x154987)['then'](function(_0x27f31b){return _0x27f31b;});}return null;};}function removeEntity(_0x7ec67,_0x137de5){return function(_0x2a360f){if(_0x2a360f){return _0x2a360f[_0xcad9('0x30')]()[_0xcad9('0x31')](function(){var _0x30b869=_0x2a360f['get']({'plain':!![]});var _0x4cfd01=_0xcad9('0x32');return db[_0xcad9('0x33')][_0xcad9('0x30')]({'where':{'type':_0x4cfd01,'resourceId':_0x30b869['id']}})[_0xcad9('0x31')](function(){return _0x2a360f;});})[_0xcad9('0x31')](function(){_0x7ec67[_0xcad9('0x24')](0xcc)[_0xcad9('0x34')]();});}};}function handleEntityNotFound(_0x5a93c7,_0x5c4c6f){return function(_0x2829f0){if(!_0x2829f0){_0x5a93c7[_0xcad9('0x35')](0x194);}return _0x2829f0;};}function handleError(_0x51c0fd,_0x5f0db5){_0x5f0db5=_0x5f0db5||0x1f4;return function(_0x143567){logger['error'](_0x143567[_0xcad9('0x36')]);if(_0x143567['name']){delete _0x143567['name'];}_0x51c0fd[_0xcad9('0x24')](_0x5f0db5)[_0xcad9('0x37')](_0x143567);};}exports[_0xcad9('0x38')]=function(_0x1be013,_0xd33dcd){var _0x55fc90={},_0x5924d4={},_0x58727a={'count':0x0,'rows':[]};var _0x47c5d9=_[_0xcad9('0x39')](db[_0xcad9('0x3a')][_0xcad9('0x3b')],function(_0x34d28c){return{'name':_0x34d28c[_0xcad9('0x3c')],'type':_0x34d28c[_0xcad9('0x3d')][_0xcad9('0x3e')]};});_0x5924d4[_0xcad9('0x3f')]=_[_0xcad9('0x39')](_0x47c5d9,_0xcad9('0x40'));_0x5924d4[_0xcad9('0x41')]=_[_0xcad9('0x42')](_0x1be013[_0xcad9('0x41')]);_0x5924d4['filters']=_['intersection'](_0x5924d4[_0xcad9('0x3f')],_0x5924d4['query']);_0x55fc90['attributes']=_[_0xcad9('0x43')](_0x5924d4[_0xcad9('0x3f')],qs['fields'](_0x1be013[_0xcad9('0x41')][_0xcad9('0x44')]));_0x55fc90[_0xcad9('0x45')]=_0x55fc90[_0xcad9('0x45')][_0xcad9('0x46')]?_0x55fc90[_0xcad9('0x45')]:_0x5924d4[_0xcad9('0x3f')];if(!_0x1be013[_0xcad9('0x41')][_0xcad9('0x47')]('nolimit')){_0x55fc90[_0xcad9('0x27')]=qs[_0xcad9('0x27')](_0x1be013[_0xcad9('0x41')]['limit']);_0x55fc90[_0xcad9('0x26')]=qs[_0xcad9('0x26')](_0x1be013['query']['offset']);}_0x55fc90['order']=qs[_0xcad9('0x48')](_0x1be013[_0xcad9('0x41')]['sort']);_0x55fc90[_0xcad9('0x49')]=qs['filters'](_[_0xcad9('0x4a')](_0x1be013[_0xcad9('0x41')],_0x5924d4[_0xcad9('0x4b')]),_0x47c5d9);if(_0x1be013['query'][_0xcad9('0x4c')]){_0x55fc90[_0xcad9('0x49')]=_[_0xcad9('0x4d')](_0x55fc90[_0xcad9('0x49')],{'$or':_['map'](_0x47c5d9,function(_0x38b745){if(_0x38b745[_0xcad9('0x3d')]!==_0xcad9('0x4e')){var _0x583be9={};_0x583be9[_0x38b745[_0xcad9('0x40')]]={'$like':'%'+_0x1be013['query'][_0xcad9('0x4c')]+'%'};return _0x583be9;}})});}_0x55fc90=_[_0xcad9('0x4d')]({},_0x55fc90,_0x1be013[_0xcad9('0x4f')]);var _0x40e55f={'where':_0x55fc90[_0xcad9('0x49')]};return db[_0xcad9('0x3a')][_0xcad9('0x29')](_0x40e55f)['then'](function(_0x24836d){_0x58727a[_0xcad9('0x29')]=_0x24836d;if(_0x1be013[_0xcad9('0x41')][_0xcad9('0x50')]){_0x55fc90['include']=[{'all':!![]}];}return db[_0xcad9('0x3a')]['findAll'](_0x55fc90);})[_0xcad9('0x31')](function(_0x3d850a){_0x58727a['rows']=_0x3d850a;return _0x58727a;})[_0xcad9('0x31')](respondWithFilteredResult(_0xd33dcd,_0x55fc90))[_0xcad9('0x51')](handleError(_0xd33dcd,null));};exports['show']=function(_0x206410,_0xb0b53b){var _0x3a89aa={'raw':![],'where':{'id':_0x206410[_0xcad9('0x52')]['id']}},_0x3d1edb={};_0x3d1edb['model']=_[_0xcad9('0x42')](db['VoiceContext']['rawAttributes']);_0x3d1edb[_0xcad9('0x41')]=_[_0xcad9('0x42')](_0x206410[_0xcad9('0x41')]);_0x3d1edb[_0xcad9('0x4b')]=_[_0xcad9('0x43')](_0x3d1edb[_0xcad9('0x3f')],_0x3d1edb[_0xcad9('0x41')]);_0x3a89aa[_0xcad9('0x45')]=_[_0xcad9('0x43')](_0x3d1edb[_0xcad9('0x3f')],qs[_0xcad9('0x44')](_0x206410['query']['fields']));_0x3a89aa[_0xcad9('0x45')]=_0x3a89aa[_0xcad9('0x45')][_0xcad9('0x46')]?_0x3a89aa[_0xcad9('0x45')]:_0x3d1edb[_0xcad9('0x3f')];if(_0x206410[_0xcad9('0x41')]['includeAll']){_0x3a89aa[_0xcad9('0x53')]=[{'all':!![]}];}_0x3a89aa=_[_0xcad9('0x4d')]({},_0x3a89aa,_0x206410[_0xcad9('0x4f')]);return db[_0xcad9('0x3a')][_0xcad9('0x54')](_0x3a89aa)['then'](handleEntityNotFound(_0xb0b53b,null))[_0xcad9('0x31')](respondWithResult(_0xb0b53b,null))[_0xcad9('0x51')](handleError(_0xb0b53b,null));};exports[_0xcad9('0x55')]=function(_0x29029a,_0x5dc116,_0x1a0bdf){var _0x58b123;return db[_0xcad9('0x3a')][_0xcad9('0x55')](_0x29029a[_0xcad9('0x56')],{'raw':!![]})[_0xcad9('0x31')](function(_0x46ba9e){_0x58b123=_0x46ba9e;return db['VoiceContext'][_0xcad9('0x57')]({'raw':!![]});})[_0xcad9('0x31')](function(_0x1fd1de){var _0xc4d211=fs['readFileSync'](path[_0xcad9('0x58')](config[_0xcad9('0x59')],_0xcad9('0x5a')),_0xcad9('0x5b'));var _0x4e59f6=ejs[_0xcad9('0x5c')](_0xc4d211,{'contexts':_0x1fd1de||[]});fs[_0xcad9('0x5d')](_0xcad9('0x5e'),_0x4e59f6);})[_0xcad9('0x31')](function(){return respondWithRpcPromise(_0xcad9('0x5f'),_0xcad9('0x55'),{'module':'chan_sip.so'});})[_0xcad9('0x31')](function(){var _0x3deb68=_0x29029a['user'][_0xcad9('0x60')]({'plain':!![]});if(!_0x3deb68)throw new Error(_0xcad9('0x61'));if(_0x3deb68[_0xcad9('0x62')]==='user'){var _0xc54cec=_0x58b123[_0xcad9('0x60')]({'plain':!![]});return db[_0xcad9('0x63')][_0xcad9('0x54')]({'where':{'name':_0xcad9('0x32'),'userProfileId':_0x3deb68['userProfileId']},'raw':!![]})[_0xcad9('0x31')](function(_0x4a9cbf){if(_0x4a9cbf&&_0x4a9cbf['autoAssociation']===0x0){return db[_0xcad9('0x33')][_0xcad9('0x55')]({'name':_0xc54cec[_0xcad9('0x40')],'resourceId':_0xc54cec['id'],'type':_0x4a9cbf[_0xcad9('0x40')],'sectionId':_0x4a9cbf['id']},{})['then'](function(){return _0x58b123;});}else{return _0x58b123;}})[_0xcad9('0x51')](function(_0x281947){logger['error'](_0xcad9('0x64'),_0x281947);throw _0x281947;});}return _0x58b123;})[_0xcad9('0x31')](respondWithResult(_0x5dc116,0xc9))[_0xcad9('0x51')](handleError(_0x5dc116,null));};exports['update']=function(_0x264698,_0x18c3c6,_0x47c292){var _0x44f403;return db[_0xcad9('0x3a')][_0xcad9('0x54')]({'where':{'id':_0x264698['params']['id']}})[_0xcad9('0x31')](handleEntityNotFound(_0x18c3c6,null))['then'](saveUpdates(_0x264698[_0xcad9('0x56')],null))[_0xcad9('0x31')](function(_0x44cbf7){if(_0x44cbf7){_0x44f403=_0x44cbf7;return db[_0xcad9('0x3a')][_0xcad9('0x57')]({'raw':!![]});}})[_0xcad9('0x31')](function(_0x383dec){var _0x4ca0c3=fs[_0xcad9('0x65')](path[_0xcad9('0x58')](config[_0xcad9('0x59')],_0xcad9('0x5a')),_0xcad9('0x5b'));var _0x5f53b2=ejs['render'](_0x4ca0c3,{'contexts':_0x383dec||[]});fs[_0xcad9('0x5d')](_0xcad9('0x5e'),_0x5f53b2);})[_0xcad9('0x31')](function(){return respondWithRpcPromise(_0xcad9('0x5f'),_0xcad9('0x2f'),{'module':_0xcad9('0x66')});})['then'](function(){return _0x44f403;})[_0xcad9('0x31')](respondWithResult(_0x18c3c6,null))[_0xcad9('0x51')](handleError(_0x18c3c6,null));};exports['destroy']=function(_0x501c47,_0x28f8d6,_0xcfd151){var _0x987667;return db['VoiceContext'][_0xcad9('0x54')]({'where':{'id':_0x501c47[_0xcad9('0x52')]['id']}})[_0xcad9('0x31')](handleEntityNotFound(_0x28f8d6,null))[_0xcad9('0x31')](removeEntity(_0x28f8d6,null))['then'](function(){return db[_0xcad9('0x3a')][_0xcad9('0x57')]({'raw':!![]});})[_0xcad9('0x31')](function(_0x231b1b){var _0x42f9c0=fs[_0xcad9('0x65')](path[_0xcad9('0x58')](config['root'],_0xcad9('0x5a')),_0xcad9('0x5b'));var _0x489fd9=ejs[_0xcad9('0x5c')](_0x42f9c0,{'contexts':_0x231b1b});fs['writeFileSync'](_0xcad9('0x5e'),_0x489fd9);return respondWithRpcPromise('Reload',_0xcad9('0x30'),{'module':_0xcad9('0x66')});})[_0xcad9('0x51')](handleError(_0x28f8d6,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index aa1bdb3..87a0650 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 _0x9ad9=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x9ad9,0xbc));var _0x99ad=function(_0x3ea022,_0x2d5328){_0x3ea022=_0x3ea022-0x0;var _0x3b97a2=_0x9ad9[_0x3ea022];return _0x3b97a2;};'use strict';var _=require(_0x99ad('0x0'));var util=require('util');var logger=require(_0x99ad('0x1'))(_0x99ad('0x2'));var moment=require(_0x99ad('0x3'));var BPromise=require(_0x99ad('0x4'));var rp=require(_0x99ad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x99ad('0x6'));var config=require(_0x99ad('0x7'));var attributes=require(_0x99ad('0x8'));module[_0x99ad('0x9')]=function(_0x5d0d18,_0x3c5ac6){return _0x5d0d18[_0x99ad('0xa')](_0x99ad('0xb'),attributes,{'tableName':_0x99ad('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefd0=['../../config/logger','api','moment','bluebird','path','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util'];(function(_0x547594,_0x1a88f0){var _0x25292e=function(_0x4c71d8){while(--_0x4c71d8){_0x547594['push'](_0x547594['shift']());}};_0x25292e(++_0x1a88f0);}(_0xefd0,0x196));var _0x0efd=function(_0x266257,_0x5f507e){_0x266257=_0x266257-0x0;var _0xd3923c=_0xefd0[_0x266257];return _0xd3923c;};'use strict';var _=require(_0x0efd('0x0'));var util=require(_0x0efd('0x1'));var logger=require(_0x0efd('0x2'))(_0x0efd('0x3'));var moment=require(_0x0efd('0x4'));var BPromise=require(_0x0efd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0efd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0efd('0x7'));module[_0x0efd('0x8')]=function(_0x5f4e90,_0x5aacbb){return _0x5f4e90[_0x0efd('0x9')](_0x0efd('0xa'),attributes,{'tableName':_0x0efd('0xb'),'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 9984268..383de78 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 _0x09ef=['rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1d1a9c,_0x2274db){var _0x3e0c65=function(_0x2c41c5){while(--_0x2c41c5){_0x1d1a9c['push'](_0x1d1a9c['shift']());}};_0x3e0c65(++_0x2274db);}(_0x09ef,0x15e));var _0xf09e=function(_0x4aa68e,_0x1e1ce7){_0x4aa68e=_0x4aa68e-0x0;var _0x15ad9f=_0x09ef[_0x4aa68e];return _0x15ad9f;};'use strict';var _=require(_0xf09e('0x0'));var util=require(_0xf09e('0x1'));var moment=require(_0xf09e('0x2'));var BPromise=require(_0xf09e('0x3'));var rs=require(_0xf09e('0x4'));var fs=require('fs');var Redis=require(_0xf09e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf09e('0x6'));var logger=require('../../config/logger')(_0xf09e('0x7'));var config=require(_0xf09e('0x8'));var jayson=require(_0xf09e('0x9'));var client=jayson[_0xf09e('0xa')][_0xf09e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x294258,_0x1d205f,_0x877574){return new BPromise(function(_0x2e5a79,_0x2f28e1){return client['request'](_0x294258,_0x877574)[_0xf09e('0xc')](function(_0xfdb22a){logger[_0xf09e('0xd')](_0xf09e('0xe'),_0x1d205f,_0xf09e('0xf'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1d205f,_0xf09e('0xf'),JSON[_0xf09e('0x10')](_0xfdb22a));if(_0xfdb22a['error']){if(_0xfdb22a[_0xf09e('0x11')]['code']===0x1f4){logger[_0xf09e('0x11')](_0xf09e('0xe'),_0x1d205f,_0xfdb22a[_0xf09e('0x11')][_0xf09e('0x12')]);return _0x2f28e1(_0xfdb22a[_0xf09e('0x11')][_0xf09e('0x12')]);}logger['error'](_0xf09e('0xe'),_0x1d205f,_0xfdb22a['error'][_0xf09e('0x12')]);return _0x2e5a79(_0xfdb22a[_0xf09e('0x11')][_0xf09e('0x12')]);}else{logger['info'](_0xf09e('0xe'),_0x1d205f,_0xf09e('0xf'));_0x2e5a79(_0xfdb22a[_0xf09e('0x13')][_0xf09e('0x12')]);}})[_0xf09e('0x14')](function(_0x176029){logger[_0xf09e('0x11')](_0xf09e('0xe'),_0x1d205f,_0x176029);_0x2f28e1(_0x176029);});});} \ No newline at end of file +var _0x8135=['info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x21b54a,_0x3b4932){var _0x366f51=function(_0x25e8d4){while(--_0x25e8d4){_0x21b54a['push'](_0x21b54a['shift']());}};_0x366f51(++_0x3b4932);}(_0x8135,0x171));var _0x5813=function(_0x3f06fc,_0x5edacc){_0x3f06fc=_0x3f06fc-0x0;var _0x39ea2b=_0x8135[_0x3f06fc];return _0x39ea2b;};'use strict';var _=require(_0x5813('0x0'));var util=require(_0x5813('0x1'));var moment=require('moment');var BPromise=require(_0x5813('0x2'));var rs=require(_0x5813('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5813('0x4'));var logger=require(_0x5813('0x5'))(_0x5813('0x6'));var config=require(_0x5813('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5813('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x517898,_0x4fd2c8,_0x5c6798){return new BPromise(function(_0x32f39e,_0x209cb3){return client[_0x5813('0x9')](_0x517898,_0x5c6798)[_0x5813('0xa')](function(_0x5a4be3){logger[_0x5813('0xb')](_0x5813('0xc'),_0x4fd2c8,_0x5813('0xd'));logger['debug'](_0x5813('0xe'),_0x4fd2c8,_0x5813('0xd'),JSON['stringify'](_0x5a4be3));if(_0x5a4be3[_0x5813('0xf')]){if(_0x5a4be3[_0x5813('0xf')][_0x5813('0x10')]===0x1f4){logger['error'](_0x5813('0xc'),_0x4fd2c8,_0x5a4be3[_0x5813('0xf')]['message']);return _0x209cb3(_0x5a4be3[_0x5813('0xf')]['message']);}logger[_0x5813('0xf')](_0x5813('0xc'),_0x4fd2c8,_0x5a4be3[_0x5813('0xf')]['message']);return _0x32f39e(_0x5a4be3[_0x5813('0xf')][_0x5813('0x11')]);}else{logger[_0x5813('0xb')](_0x5813('0xc'),_0x4fd2c8,_0x5813('0xd'));_0x32f39e(_0x5a4be3[_0x5813('0x12')]['message']);}})[_0x5813('0x13')](function(_0x16cbe5){logger[_0x5813('0xf')](_0x5813('0xc'),_0x4fd2c8,_0x16cbe5);_0x209cb3(_0x16cbe5);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a93ef23..0a28967 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 _0xec81=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','show','post','create','/:id','update','delete','destroy','util'];(function(_0x59ae8f,_0x148344){var _0x3900b5=function(_0x63af51){while(--_0x63af51){_0x59ae8f['push'](_0x59ae8f['shift']());}};_0x3900b5(++_0x148344);}(_0xec81,0x71));var _0x1ec8=function(_0x221f1b,_0xa94857){_0x221f1b=_0x221f1b-0x0;var _0x1f1522=_0xec81[_0x221f1b];return _0x1f1522;};'use strict';var multer=require('multer');var util=require(_0x1ec8('0x0'));var path=require('path');var timeout=require(_0x1ec8('0x1'));var express=require('express');var router=express[_0x1ec8('0x2')]();var fs_extra=require(_0x1ec8('0x3'));var auth=require(_0x1ec8('0x4'));var interaction=require(_0x1ec8('0x5'));var config=require(_0x1ec8('0x6'));var controller=require(_0x1ec8('0x7'));router[_0x1ec8('0x8')]('/',auth[_0x1ec8('0x9')](),controller['index']);router[_0x1ec8('0x8')](_0x1ec8('0xa'),auth['isAuthenticated'](),controller[_0x1ec8('0xb')]);router[_0x1ec8('0x8')]('/:id',auth[_0x1ec8('0x9')](),controller[_0x1ec8('0xc')]);router[_0x1ec8('0xd')]('/',auth[_0x1ec8('0x9')](),controller[_0x1ec8('0xe')]);router['put'](_0x1ec8('0xf'),auth[_0x1ec8('0x9')](),controller[_0x1ec8('0x10')]);router[_0x1ec8('0x11')](_0x1ec8('0xf'),auth[_0x1ec8('0x9')](),controller[_0x1ec8('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb6ec=['express','Router','fs-extra','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','/:id','show','create','update','destroy','exports','multer','util','path'];(function(_0x5c96eb,_0x5404da){var _0x4ddbad=function(_0x5a1225){while(--_0x5a1225){_0x5c96eb['push'](_0x5c96eb['shift']());}};_0x4ddbad(++_0x5404da);}(_0xb6ec,0x74));var _0xcb6e=function(_0x51948f,_0x4286f6){_0x51948f=_0x51948f-0x0;var _0x1afa2e=_0xb6ec[_0x51948f];return _0x1afa2e;};'use strict';var multer=require(_0xcb6e('0x0'));var util=require(_0xcb6e('0x1'));var path=require(_0xcb6e('0x2'));var timeout=require('connect-timeout');var express=require(_0xcb6e('0x3'));var router=express[_0xcb6e('0x4')]();var fs_extra=require(_0xcb6e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcb6e('0x6'));var config=require('../../config/environment');var controller=require(_0xcb6e('0x7'));router[_0xcb6e('0x8')]('/',auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xa')]);router[_0xcb6e('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xcb6e('0x8')](_0xcb6e('0xb'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xc')]);router['post']('/',auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xd')]);router['put'](_0xcb6e('0xb'),auth['isAuthenticated'](),controller[_0xcb6e('0xe')]);router['delete'](_0xcb6e('0xb'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xf')]);module[_0xcb6e('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index da20ce8..be9dacb 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 _0x9a19=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x69ab24,_0x372e47){var _0x106e55=function(_0xbdda13){while(--_0xbdda13){_0x69ab24['push'](_0x69ab24['shift']());}};_0x106e55(++_0x372e47);}(_0x9a19,0x114));var _0x99a1=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x9a19[_0x1d50f2];return _0x3769b8;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'privilege':{'type':Sequelize[_0x99a1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x99a1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'calleridnum':{'type':Sequelize[_0x99a1('0x2')]},'calleridname':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'language':{'type':Sequelize[_0x99a1('0x2')]},'accountcode':{'type':Sequelize[_0x99a1('0x2')]},'context':{'type':Sequelize[_0x99a1('0x2')]},'exten':{'type':Sequelize[_0x99a1('0x2')]},'priority':{'type':Sequelize[_0x99a1('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x99a1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'destlanguage':{'type':Sequelize[_0x99a1('0x2')]},'destaccountcode':{'type':Sequelize[_0x99a1('0x2')]},'destcontext':{'type':Sequelize[_0x99a1('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x99a1('0x3')]},'destuniqueid':{'type':Sequelize[_0x99a1('0x2')]},'destlinkedid':{'type':Sequelize[_0x99a1('0x2')]},'dialstring':{'type':Sequelize[_0x99a1('0x2')]},'dialstatus':{'type':Sequelize[_0x99a1('0x2')]},'starttime':{'type':Sequelize[_0x99a1('0x4')]},'answertime':{'type':Sequelize[_0x99a1('0x4')]},'endtime':{'type':Sequelize[_0x99a1('0x4')]},'lastevent':{'type':Sequelize[_0x99a1('0x2')],'comment':_0x99a1('0x5')},'routeId':{'type':Sequelize[_0x99a1('0x3')]},'duration':{'type':Sequelize[_0x99a1('0x3')]},'holdtime':{'type':Sequelize[_0x99a1('0x3')]},'billableseconds':{'type':Sequelize[_0x99a1('0x3')]}}; \ No newline at end of file +var _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3e74,0x175));var _0x43e7=function(_0x232879,_0x3b586e){_0x232879=_0x232879-0x0;var _0x4e20bc=_0x3e74[_0x232879];return _0x4e20bc;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x43e7('0x1')]},'channel':{'type':Sequelize[_0x43e7('0x1')]},'channelstate':{'type':Sequelize[_0x43e7('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43e7('0x1')]},'language':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize[_0x43e7('0x1')]},'exten':{'type':Sequelize[_0x43e7('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'linkedid':{'type':Sequelize[_0x43e7('0x1')]},'destchannel':{'type':Sequelize[_0x43e7('0x1')]},'destchannelstate':{'type':Sequelize[_0x43e7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x43e7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x43e7('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x43e7('0x1')]},'destaccountcode':{'type':Sequelize[_0x43e7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x43e7('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x43e7('0x1')]},'destlinkedid':{'type':Sequelize[_0x43e7('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x43e7('0x1')]},'starttime':{'type':Sequelize[_0x43e7('0x3')]},'answertime':{'type':Sequelize[_0x43e7('0x3')]},'endtime':{'type':Sequelize[_0x43e7('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x43e7('0x2')]},'duration':{'type':Sequelize[_0x43e7('0x2')]},'holdtime':{'type':Sequelize[_0x43e7('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 550e098..fad6b96 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 _0x585d=['error','stack','send','index','VoiceDialReport','rawAttributes','fieldName','type','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','name','options','includeAll','include','findAll','rows','catch','keys','filters','length','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x562a72,_0x13740c){var _0x37a933=function(_0x18357a){while(--_0x18357a){_0x562a72['push'](_0x562a72['shift']());}};_0x37a933(++_0x13740c);}(_0x585d,0x6f));var _0xd585=function(_0x214f44,_0xfd1903){_0x214f44=_0x214f44-0x0;var _0x8c1bc8=_0x585d[_0x214f44];return _0x8c1bc8;};'use strict';var emlformat=require(_0xd585('0x0'));var rimraf=require(_0xd585('0x1'));var zipdir=require(_0xd585('0x2'));var jsonpatch=require(_0xd585('0x3'));var rp=require('request-promise');var moment=require(_0xd585('0x4'));var BPromise=require(_0xd585('0x5'));var Mustache=require('mustache');var util=require(_0xd585('0x6'));var path=require(_0xd585('0x7'));var sox=require(_0xd585('0x8'));var csv=require(_0xd585('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd585('0xa'));var _=require(_0xd585('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd585('0xc'));var deskjs=require(_0xd585('0xd'));var toCsv=require(_0xd585('0x9'));var querystring=require(_0xd585('0xe'));var Papa=require(_0xd585('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd585('0x10'));var as=require(_0xd585('0x11'));var hardwareService=require(_0xd585('0x12'));var logger=require(_0xd585('0x13'))(_0xd585('0x14'));var utils=require(_0xd585('0x15'));var config=require(_0xd585('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd585('0x17'))['db'];function respondWithStatusCode(_0x16b6de,_0xefd520){_0xefd520=_0xefd520||0xcc;return function(_0x35118f){if(_0x35118f){return _0x16b6de['sendStatus'](_0xefd520);}return _0x16b6de[_0xd585('0x18')](_0xefd520)[_0xd585('0x19')]();};}function respondWithResult(_0x6b496b,_0x5a7a7e){_0x5a7a7e=_0x5a7a7e||0xc8;return function(_0x4353e8){if(_0x4353e8){return _0x6b496b[_0xd585('0x18')](_0x5a7a7e)['json'](_0x4353e8);}};}function respondWithFilteredResult(_0x381742,_0x5245a5){return function(_0x253c8e){if(_0x253c8e){var _0x205508=typeof _0x5245a5[_0xd585('0x1a')]==='undefined'&&typeof _0x5245a5[_0xd585('0x1b')]===_0xd585('0x1c');var _0xb65b1=_0x253c8e[_0xd585('0x1d')];var _0x17640f=_0x205508?0x0:_0x5245a5[_0xd585('0x1a')];var _0x1b4e31=_0x205508?_0x253c8e['count']:_0x5245a5['offset']+_0x5245a5[_0xd585('0x1b')];var _0x3fec24;if(_0x1b4e31>=_0xb65b1){_0x1b4e31=_0xb65b1;_0x3fec24=0xc8;}else{_0x3fec24=0xce;}_0x381742[_0xd585('0x18')](_0x3fec24);return _0x381742[_0xd585('0x1e')](_0xd585('0x1f'),_0x17640f+'-'+_0x1b4e31+'/'+_0xb65b1)['json'](_0x253c8e);}return null;};}function patchUpdates(_0x1d7701){return function(_0x4f0619){try{jsonpatch[_0xd585('0x20')](_0x4f0619,_0x1d7701,!![]);}catch(_0x416dc4){return BPromise[_0xd585('0x21')](_0x416dc4);}return _0x4f0619[_0xd585('0x22')]();};}function saveUpdates(_0x4606cb,_0x2a3763){return function(_0x588396){if(_0x588396){return _0x588396[_0xd585('0x23')](_0x4606cb)[_0xd585('0x24')](function(_0x2abf30){return _0x2abf30;});}return null;};}function removeEntity(_0x502425,_0x4dc4f3){return function(_0x4ad1a7){if(_0x4ad1a7){return _0x4ad1a7[_0xd585('0x25')]()[_0xd585('0x24')](function(){_0x502425[_0xd585('0x18')](0xcc)[_0xd585('0x19')]();});}};}function handleEntityNotFound(_0x38d74c,_0xfe05f6){return function(_0x2718cb){if(!_0x2718cb){_0x38d74c[_0xd585('0x26')](0x194);}return _0x2718cb;};}function handleError(_0x41e22c,_0x53ff40){_0x53ff40=_0x53ff40||0x1f4;return function(_0x318137){logger[_0xd585('0x27')](_0x318137[_0xd585('0x28')]);if(_0x318137['name']){delete _0x318137['name'];}_0x41e22c['status'](_0x53ff40)[_0xd585('0x29')](_0x318137);};}exports[_0xd585('0x2a')]=function(_0x3ae3e0,_0x4b06ca){var _0x258e72={},_0x5ae099={},_0x11326={'count':0x0,'rows':[]};var _0x4ca137=_['map'](db[_0xd585('0x2b')][_0xd585('0x2c')],function(_0x20df26){return{'name':_0x20df26[_0xd585('0x2d')],'type':_0x20df26[_0xd585('0x2e')]['key']};});_0x5ae099[_0xd585('0x2f')]=_[_0xd585('0x30')](_0x4ca137,'name');_0x5ae099['query']=_['keys'](_0x3ae3e0[_0xd585('0x31')]);_0x5ae099['filters']=_[_0xd585('0x32')](_0x5ae099[_0xd585('0x2f')],_0x5ae099[_0xd585('0x31')]);_0x258e72['attributes']=_[_0xd585('0x32')](_0x5ae099[_0xd585('0x2f')],qs['fields'](_0x3ae3e0[_0xd585('0x31')][_0xd585('0x33')]));_0x258e72[_0xd585('0x34')]=_0x258e72[_0xd585('0x34')]['length']?_0x258e72[_0xd585('0x34')]:_0x5ae099['model'];if(!_0x3ae3e0['query'][_0xd585('0x35')](_0xd585('0x36'))){_0x258e72[_0xd585('0x1b')]=qs[_0xd585('0x1b')](_0x3ae3e0[_0xd585('0x31')][_0xd585('0x1b')]);_0x258e72[_0xd585('0x1a')]=qs[_0xd585('0x1a')](_0x3ae3e0[_0xd585('0x31')]['offset']);}_0x258e72['order']=qs[_0xd585('0x37')](_0x3ae3e0[_0xd585('0x31')][_0xd585('0x37')]);_0x258e72[_0xd585('0x38')]=qs['filters'](_[_0xd585('0x39')](_0x3ae3e0[_0xd585('0x31')],_0x5ae099['filters']),_0x4ca137);if(_0x3ae3e0[_0xd585('0x31')][_0xd585('0x3a')]){_0x258e72['where']=_[_0xd585('0x3b')](_0x258e72[_0xd585('0x38')],{'$or':_[_0xd585('0x30')](_0x4ca137,function(_0x2ad2a6){if(_0x2ad2a6['type']!=='VIRTUAL'){var _0x4cffe1={};_0x4cffe1[_0x2ad2a6[_0xd585('0x3c')]]={'$like':'%'+_0x3ae3e0[_0xd585('0x31')]['filter']+'%'};return _0x4cffe1;}})});}_0x258e72=_[_0xd585('0x3b')]({},_0x258e72,_0x3ae3e0[_0xd585('0x3d')]);var _0x3a838d={'where':_0x258e72['where']};return db['VoiceDialReport'][_0xd585('0x1d')](_0x3a838d)['then'](function(_0x5c9179){_0x11326[_0xd585('0x1d')]=_0x5c9179;if(_0x3ae3e0['query'][_0xd585('0x3e')]){_0x258e72[_0xd585('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xd585('0x40')](_0x258e72);})[_0xd585('0x24')](function(_0x597b21){_0x11326[_0xd585('0x41')]=_0x597b21;return _0x11326;})['then'](respondWithFilteredResult(_0x4b06ca,_0x258e72))[_0xd585('0x42')](handleError(_0x4b06ca,null));};exports['show']=function(_0x1cb02a,_0x4a212a){var _0x3bcfde={'raw':!![],'where':{'id':_0x1cb02a['params']['id']}},_0x3c692c={};_0x3c692c[_0xd585('0x2f')]=_[_0xd585('0x43')](db[_0xd585('0x2b')]['rawAttributes']);_0x3c692c[_0xd585('0x31')]=_[_0xd585('0x43')](_0x1cb02a[_0xd585('0x31')]);_0x3c692c[_0xd585('0x44')]=_[_0xd585('0x32')](_0x3c692c[_0xd585('0x2f')],_0x3c692c[_0xd585('0x31')]);_0x3bcfde[_0xd585('0x34')]=_[_0xd585('0x32')](_0x3c692c[_0xd585('0x2f')],qs[_0xd585('0x33')](_0x1cb02a[_0xd585('0x31')]['fields']));_0x3bcfde['attributes']=_0x3bcfde['attributes'][_0xd585('0x45')]?_0x3bcfde[_0xd585('0x34')]:_0x3c692c[_0xd585('0x2f')];if(_0x1cb02a['query'][_0xd585('0x3e')]){_0x3bcfde[_0xd585('0x3f')]=[{'all':!![]}];}_0x3bcfde=_['merge']({},_0x3bcfde,_0x1cb02a[_0xd585('0x3d')]);return db[_0xd585('0x2b')][_0xd585('0x46')](_0x3bcfde)[_0xd585('0x24')](handleEntityNotFound(_0x4a212a,null))['then'](respondWithResult(_0x4a212a,null))[_0xd585('0x42')](handleError(_0x4a212a,null));};exports[_0xd585('0x47')]=function(_0x2e5804,_0x2ccb99){return db[_0xd585('0x2b')][_0xd585('0x47')](_0x2e5804['body'],{})[_0xd585('0x24')](respondWithResult(_0x2ccb99,0xc9))[_0xd585('0x42')](handleError(_0x2ccb99,null));};exports['update']=function(_0x29382a,_0x484ee4){if(_0x29382a[_0xd585('0x48')]['id']){delete _0x29382a['body']['id'];}return db[_0xd585('0x2b')]['find']({'where':{'id':_0x29382a[_0xd585('0x49')]['id']}})[_0xd585('0x24')](handleEntityNotFound(_0x484ee4,null))['then'](saveUpdates(_0x29382a[_0xd585('0x48')],null))[_0xd585('0x24')](respondWithResult(_0x484ee4,null))[_0xd585('0x42')](handleError(_0x484ee4,null));};exports['destroy']=function(_0x12c6ee,_0x4d4ddc){return db['VoiceDialReport'][_0xd585('0x46')]({'where':{'id':_0x12c6ee[_0xd585('0x49')]['id']}})['then'](handleEntityNotFound(_0x4d4ddc,null))['then'](removeEntity(_0x4d4ddc,null))[_0xd585('0x42')](handleError(_0x4d4ddc,null));};exports[_0xd585('0x4a')]=function(_0x44a49e,_0x227db5){return db[_0xd585('0x2b')][_0xd585('0x4a')]()[_0xd585('0x24')](respondWithResult(_0x227db5,null))[_0xd585('0x42')](handleError(_0x227db5,null));}; \ No newline at end of file +var _0x7b2e=['mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','send','index','VoiceDialReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x1b6eb6,_0x5a7238){var _0x194725=function(_0x3c137a){while(--_0x3c137a){_0x1b6eb6['push'](_0x1b6eb6['shift']());}};_0x194725(++_0x5a7238);}(_0x7b2e,0x1a6));var _0xe7b2=function(_0x27ba18,_0x2604d1){_0x27ba18=_0x27ba18-0x0;var _0x26c0a2=_0x7b2e[_0x27ba18];return _0x26c0a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe7b2('0x0'));var zipdir=require(_0xe7b2('0x1'));var jsonpatch=require(_0xe7b2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe7b2('0x3'));var Mustache=require(_0xe7b2('0x4'));var util=require(_0xe7b2('0x5'));var path=require(_0xe7b2('0x6'));var sox=require(_0xe7b2('0x7'));var csv=require(_0xe7b2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe7b2('0x9'));var _=require('lodash');var squel=require(_0xe7b2('0xa'));var crypto=require(_0xe7b2('0xb'));var jsforce=require(_0xe7b2('0xc'));var deskjs=require(_0xe7b2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe7b2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe7b2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe7b2('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe7b2('0x11'))['db'];function respondWithStatusCode(_0x3ee678,_0x39edd1){_0x39edd1=_0x39edd1||0xcc;return function(_0x21758d){if(_0x21758d){return _0x3ee678[_0xe7b2('0x12')](_0x39edd1);}return _0x3ee678[_0xe7b2('0x13')](_0x39edd1)[_0xe7b2('0x14')]();};}function respondWithResult(_0x3da868,_0x2507ee){_0x2507ee=_0x2507ee||0xc8;return function(_0xe22909){if(_0xe22909){return _0x3da868[_0xe7b2('0x13')](_0x2507ee)[_0xe7b2('0x15')](_0xe22909);}};}function respondWithFilteredResult(_0x44d5d6,_0x52d0eb){return function(_0x3f2f1a){if(_0x3f2f1a){var _0x3e60eb=typeof _0x52d0eb['offset']===_0xe7b2('0x16')&&typeof _0x52d0eb['limit']==='undefined';var _0x2073c0=_0x3f2f1a[_0xe7b2('0x17')];var _0x4c2648=_0x3e60eb?0x0:_0x52d0eb[_0xe7b2('0x18')];var _0x1d3a0c=_0x3e60eb?_0x3f2f1a[_0xe7b2('0x17')]:_0x52d0eb[_0xe7b2('0x18')]+_0x52d0eb[_0xe7b2('0x19')];var _0x1130ae;if(_0x1d3a0c>=_0x2073c0){_0x1d3a0c=_0x2073c0;_0x1130ae=0xc8;}else{_0x1130ae=0xce;}_0x44d5d6['status'](_0x1130ae);return _0x44d5d6['set'](_0xe7b2('0x1a'),_0x4c2648+'-'+_0x1d3a0c+'/'+_0x2073c0)[_0xe7b2('0x15')](_0x3f2f1a);}return null;};}function patchUpdates(_0x20514e){return function(_0x36fe06){try{jsonpatch[_0xe7b2('0x1b')](_0x36fe06,_0x20514e,!![]);}catch(_0x402411){return BPromise[_0xe7b2('0x1c')](_0x402411);}return _0x36fe06[_0xe7b2('0x1d')]();};}function saveUpdates(_0x3be698,_0x1818db){return function(_0x53f3b9){if(_0x53f3b9){return _0x53f3b9['update'](_0x3be698)[_0xe7b2('0x1e')](function(_0x4fa0e4){return _0x4fa0e4;});}return null;};}function removeEntity(_0x357763,_0x3dea39){return function(_0x1a5d2d){if(_0x1a5d2d){return _0x1a5d2d[_0xe7b2('0x1f')]()['then'](function(){_0x357763['status'](0xcc)[_0xe7b2('0x14')]();});}};}function handleEntityNotFound(_0x4a4aa2,_0x53764e){return function(_0xb5bc1e){if(!_0xb5bc1e){_0x4a4aa2[_0xe7b2('0x12')](0x194);}return _0xb5bc1e;};}function handleError(_0x135b49,_0x39430){_0x39430=_0x39430||0x1f4;return function(_0x1717fb){logger[_0xe7b2('0x20')](_0x1717fb[_0xe7b2('0x21')]);if(_0x1717fb['name']){delete _0x1717fb['name'];}_0x135b49[_0xe7b2('0x13')](_0x39430)[_0xe7b2('0x22')](_0x1717fb);};}exports[_0xe7b2('0x23')]=function(_0x58c91a,_0x373422){var _0x216881={},_0xe5f145={},_0x54c60e={'count':0x0,'rows':[]};var _0x42cb9e=_['map'](db[_0xe7b2('0x24')]['rawAttributes'],function(_0x101e0a){return{'name':_0x101e0a[_0xe7b2('0x25')],'type':_0x101e0a[_0xe7b2('0x26')][_0xe7b2('0x27')]};});_0xe5f145[_0xe7b2('0x28')]=_[_0xe7b2('0x29')](_0x42cb9e,'name');_0xe5f145[_0xe7b2('0x2a')]=_[_0xe7b2('0x2b')](_0x58c91a[_0xe7b2('0x2a')]);_0xe5f145[_0xe7b2('0x2c')]=_[_0xe7b2('0x2d')](_0xe5f145[_0xe7b2('0x28')],_0xe5f145['query']);_0x216881[_0xe7b2('0x2e')]=_[_0xe7b2('0x2d')](_0xe5f145[_0xe7b2('0x28')],qs[_0xe7b2('0x2f')](_0x58c91a[_0xe7b2('0x2a')][_0xe7b2('0x2f')]));_0x216881[_0xe7b2('0x2e')]=_0x216881[_0xe7b2('0x2e')][_0xe7b2('0x30')]?_0x216881[_0xe7b2('0x2e')]:_0xe5f145[_0xe7b2('0x28')];if(!_0x58c91a[_0xe7b2('0x2a')][_0xe7b2('0x31')](_0xe7b2('0x32'))){_0x216881['limit']=qs[_0xe7b2('0x19')](_0x58c91a[_0xe7b2('0x2a')]['limit']);_0x216881[_0xe7b2('0x18')]=qs[_0xe7b2('0x18')](_0x58c91a[_0xe7b2('0x2a')]['offset']);}_0x216881[_0xe7b2('0x33')]=qs[_0xe7b2('0x34')](_0x58c91a['query'][_0xe7b2('0x34')]);_0x216881[_0xe7b2('0x35')]=qs[_0xe7b2('0x2c')](_[_0xe7b2('0x36')](_0x58c91a[_0xe7b2('0x2a')],_0xe5f145[_0xe7b2('0x2c')]),_0x42cb9e);if(_0x58c91a[_0xe7b2('0x2a')][_0xe7b2('0x37')]){_0x216881[_0xe7b2('0x35')]=_['merge'](_0x216881[_0xe7b2('0x35')],{'$or':_[_0xe7b2('0x29')](_0x42cb9e,function(_0x235cec){if(_0x235cec[_0xe7b2('0x26')]!==_0xe7b2('0x38')){var _0x5d8bf1={};_0x5d8bf1[_0x235cec['name']]={'$like':'%'+_0x58c91a['query'][_0xe7b2('0x37')]+'%'};return _0x5d8bf1;}})});}_0x216881=_[_0xe7b2('0x39')]({},_0x216881,_0x58c91a[_0xe7b2('0x3a')]);var _0x2b33ef={'where':_0x216881[_0xe7b2('0x35')]};return db[_0xe7b2('0x24')][_0xe7b2('0x17')](_0x2b33ef)['then'](function(_0x588f35){_0x54c60e[_0xe7b2('0x17')]=_0x588f35;if(_0x58c91a[_0xe7b2('0x2a')]['includeAll']){_0x216881[_0xe7b2('0x3b')]=[{'all':!![]}];}return db[_0xe7b2('0x24')][_0xe7b2('0x3c')](_0x216881);})[_0xe7b2('0x1e')](function(_0x43e719){_0x54c60e[_0xe7b2('0x3d')]=_0x43e719;return _0x54c60e;})[_0xe7b2('0x1e')](respondWithFilteredResult(_0x373422,_0x216881))[_0xe7b2('0x3e')](handleError(_0x373422,null));};exports[_0xe7b2('0x3f')]=function(_0x50f244,_0xf7b918){var _0x552148={'raw':!![],'where':{'id':_0x50f244[_0xe7b2('0x40')]['id']}},_0x22165a={};_0x22165a[_0xe7b2('0x28')]=_['keys'](db[_0xe7b2('0x24')]['rawAttributes']);_0x22165a[_0xe7b2('0x2a')]=_['keys'](_0x50f244[_0xe7b2('0x2a')]);_0x22165a[_0xe7b2('0x2c')]=_[_0xe7b2('0x2d')](_0x22165a[_0xe7b2('0x28')],_0x22165a['query']);_0x552148[_0xe7b2('0x2e')]=_[_0xe7b2('0x2d')](_0x22165a[_0xe7b2('0x28')],qs[_0xe7b2('0x2f')](_0x50f244[_0xe7b2('0x2a')]['fields']));_0x552148[_0xe7b2('0x2e')]=_0x552148[_0xe7b2('0x2e')]['length']?_0x552148[_0xe7b2('0x2e')]:_0x22165a['model'];if(_0x50f244['query'][_0xe7b2('0x41')]){_0x552148[_0xe7b2('0x3b')]=[{'all':!![]}];}_0x552148=_[_0xe7b2('0x39')]({},_0x552148,_0x50f244['options']);return db[_0xe7b2('0x24')][_0xe7b2('0x42')](_0x552148)[_0xe7b2('0x1e')](handleEntityNotFound(_0xf7b918,null))[_0xe7b2('0x1e')](respondWithResult(_0xf7b918,null))[_0xe7b2('0x3e')](handleError(_0xf7b918,null));};exports[_0xe7b2('0x43')]=function(_0x326a00,_0x485fd6){return db['VoiceDialReport'][_0xe7b2('0x43')](_0x326a00[_0xe7b2('0x44')],{})['then'](respondWithResult(_0x485fd6,0xc9))[_0xe7b2('0x3e')](handleError(_0x485fd6,null));};exports[_0xe7b2('0x45')]=function(_0xaf4d4b,_0xdfce5c){if(_0xaf4d4b[_0xe7b2('0x44')]['id']){delete _0xaf4d4b[_0xe7b2('0x44')]['id'];}return db[_0xe7b2('0x24')]['find']({'where':{'id':_0xaf4d4b['params']['id']}})['then'](handleEntityNotFound(_0xdfce5c,null))[_0xe7b2('0x1e')](saveUpdates(_0xaf4d4b[_0xe7b2('0x44')],null))[_0xe7b2('0x1e')](respondWithResult(_0xdfce5c,null))['catch'](handleError(_0xdfce5c,null));};exports[_0xe7b2('0x1f')]=function(_0x41a749,_0x22b573){return db[_0xe7b2('0x24')][_0xe7b2('0x42')]({'where':{'id':_0x41a749[_0xe7b2('0x40')]['id']}})['then'](handleEntityNotFound(_0x22b573,null))[_0xe7b2('0x1e')](removeEntity(_0x22b573,null))['catch'](handleError(_0x22b573,null));};exports[_0xe7b2('0x46')]=function(_0x56495b,_0x1114de){return db['VoiceDialReport']['describe']()[_0xe7b2('0x1e')](respondWithResult(_0x1114de,null))['catch'](handleError(_0x1114de,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c8ef625..5f42326 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 _0xb777=['VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x2f124d,_0x335da7){var _0x443d83=function(_0x3a48eb){while(--_0x3a48eb){_0x2f124d['push'](_0x2f124d['shift']());}};_0x443d83(++_0x335da7);}(_0xb777,0x107));var _0x7b77=function(_0x378a07,_0x26dbbe){_0x378a07=_0x378a07-0x0;var _0x1013e7=_0xb777[_0x378a07];return _0x1013e7;};'use strict';var _=require('lodash');var util=require(_0x7b77('0x0'));var logger=require(_0x7b77('0x1'))(_0x7b77('0x2'));var moment=require(_0x7b77('0x3'));var BPromise=require('bluebird');var rp=require(_0x7b77('0x4'));var fs=require('fs');var path=require(_0x7b77('0x5'));var rimraf=require(_0x7b77('0x6'));var config=require(_0x7b77('0x7'));var attributes=require(_0x7b77('0x8'));module[_0x7b77('0x9')]=function(_0x32d70c,_0x19bef1){return _0x32d70c['define'](_0x7b77('0xa'),attributes,{'tableName':_0x7b77('0xb'),'paranoid':![],'indexes':[{'fields':[_0x7b77('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x475d=['request-promise','../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','bluebird'];(function(_0x314bf9,_0x5a40c1){var _0x4db419=function(_0x479fab){while(--_0x479fab){_0x314bf9['push'](_0x314bf9['shift']());}};_0x4db419(++_0x5a40c1);}(_0x475d,0x188));var _0xd475=function(_0x1ac41c,_0x1dacbf){_0x1ac41c=_0x1ac41c-0x0;var _0x561d64=_0x475d[_0x1ac41c];return _0x561d64;};'use strict';var _=require('lodash');var util=require(_0xd475('0x0'));var logger=require(_0xd475('0x1'))(_0xd475('0x2'));var moment=require('moment');var BPromise=require(_0xd475('0x3'));var rp=require(_0xd475('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd475('0x5'));var attributes=require('./voiceDialReport.attributes');module[_0xd475('0x6')]=function(_0x132096,_0x1a0fd5){return _0x132096[_0xd475('0x7')](_0xd475('0x8'),attributes,{'tableName':_0xd475('0x9'),'paranoid':![],'indexes':[{'fields':[_0xd475('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 bea5f1b..c2756d5 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 _0xd15b=['stringify','error','code','message','info','result','catch','CreateVoiceDialReport','create','body','options','raw','VoiceDialReport','attributes','limit','UpdateVoiceDialReport','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3b2f5f,_0x4f41b9){var _0x4b3557=function(_0xd4e5d5){while(--_0xd4e5d5){_0x3b2f5f['push'](_0x3b2f5f['shift']());}};_0x4b3557(++_0x4f41b9);}(_0xd15b,0xd6));var _0xbd15=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd15b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbd15('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbd15('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd15('0x2'));var db=require(_0xbd15('0x3'))['db'];var utils=require(_0xbd15('0x4'));var logger=require(_0xbd15('0x5'))(_0xbd15('0x6'));var config=require(_0xbd15('0x7'));var jayson=require(_0xbd15('0x8'));var client=jayson[_0xbd15('0x9')][_0xbd15('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12a0cb,_0x54303c,_0x3a531c){return new BPromise(function(_0x3ecb0e,_0x1591a8){return client[_0xbd15('0xb')](_0x12a0cb,_0x3a531c)[_0xbd15('0xc')](function(_0x32cff2){logger['info'](_0xbd15('0xd'),_0x54303c,'request\x20sent');logger[_0xbd15('0xe')](_0xbd15('0xf'),_0x54303c,_0xbd15('0x10'),JSON[_0xbd15('0x11')](_0x32cff2));if(_0x32cff2[_0xbd15('0x12')]){if(_0x32cff2['error'][_0xbd15('0x13')]===0x1f4){logger[_0xbd15('0x12')](_0xbd15('0xd'),_0x54303c,_0x32cff2['error'][_0xbd15('0x14')]);return _0x1591a8(_0x32cff2[_0xbd15('0x12')]['message']);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x54303c,_0x32cff2[_0xbd15('0x12')][_0xbd15('0x14')]);return _0x3ecb0e(_0x32cff2[_0xbd15('0x12')]['message']);}else{logger[_0xbd15('0x15')]('VoiceDialReport,\x20%s,\x20%s',_0x54303c,_0xbd15('0x10'));_0x3ecb0e(_0x32cff2[_0xbd15('0x16')][_0xbd15('0x14')]);}})[_0xbd15('0x17')](function(_0x39152b){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x54303c,_0x39152b);_0x1591a8(_0x39152b);});});}exports[_0xbd15('0x18')]=function(_0x1ff848){var _0x5d47d3=this;return new Promise(function(_0xadd166,_0x1de191){return db['VoiceDialReport'][_0xbd15('0x19')](_0x1ff848[_0xbd15('0x1a')],{'raw':_0x1ff848[_0xbd15('0x1b')]?_0x1ff848[_0xbd15('0x1b')][_0xbd15('0x1c')]===undefined?!![]:![]:!![]})[_0xbd15('0xc')](function(_0x3e21a7){logger['info'](_0xbd15('0x18'),_0x1ff848);logger['debug']('CreateVoiceDialReport',_0x1ff848,JSON[_0xbd15('0x11')](_0x3e21a7));_0xadd166(_0x3e21a7);})[_0xbd15('0x17')](function(_0x13c80d){logger[_0xbd15('0x12')](_0xbd15('0x18'),_0x13c80d[_0xbd15('0x14')],_0x1ff848);_0x1de191(_0x5d47d3['error'](0x1f4,_0x13c80d[_0xbd15('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x3dff2d){var _0x4ff6aa=this;return new Promise(function(_0x5bb1a4,_0x3d4e6a){return db[_0xbd15('0x1d')]['update'](_0x3dff2d[_0xbd15('0x1a')],{'raw':_0x3dff2d[_0xbd15('0x1b')]?_0x3dff2d[_0xbd15('0x1b')][_0xbd15('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dff2d[_0xbd15('0x1b')]?_0x3dff2d[_0xbd15('0x1b')]['where']||null:null,'attributes':_0x3dff2d['options']?_0x3dff2d[_0xbd15('0x1b')][_0xbd15('0x1e')]||null:null,'limit':_0x3dff2d[_0xbd15('0x1b')]?_0x3dff2d[_0xbd15('0x1b')][_0xbd15('0x1f')]||null:null})['then'](function(_0x5bb64c){logger[_0xbd15('0x15')](_0xbd15('0x20'),_0x3dff2d);logger['debug']('UpdateVoiceDialReport',_0x3dff2d,JSON['stringify'](_0x5bb64c));_0x5bb1a4(_0x5bb64c);})[_0xbd15('0x17')](function(_0x3b5947){logger[_0xbd15('0x12')](_0xbd15('0x20'),_0x3b5947[_0xbd15('0x14')],_0x3dff2d);_0x3d4e6a(_0x4ff6aa[_0xbd15('0x12')](0x1f4,_0x3b5947[_0xbd15('0x14')]));});});}; \ No newline at end of file +var _0xd769=['code','message','result','VoiceDialReport','options','raw','CreateVoiceDialReport','catch','UpdateVoiceDialReport','where','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd769,0x107));var _0x9d76=function(_0x593517,_0x32f81e){_0x593517=_0x593517-0x0;var _0x1c42e9=_0xd769[_0x593517];return _0x1c42e9;};'use strict';var _=require(_0x9d76('0x0'));var util=require('util');var moment=require(_0x9d76('0x1'));var BPromise=require(_0x9d76('0x2'));var rs=require(_0x9d76('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d76('0x4'))['db'];var utils=require(_0x9d76('0x5'));var logger=require(_0x9d76('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9d76('0x7'));var client=jayson['client'][_0x9d76('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25ba78,_0x448a6c,_0x578eb4){return new BPromise(function(_0x38f004,_0x3c36f5){return client[_0x9d76('0x9')](_0x25ba78,_0x578eb4)[_0x9d76('0xa')](function(_0x45bf2c){logger['info'](_0x9d76('0xb'),_0x448a6c,_0x9d76('0xc'));logger[_0x9d76('0xd')](_0x9d76('0xe'),_0x448a6c,'request\x20sent',JSON[_0x9d76('0xf')](_0x45bf2c));if(_0x45bf2c[_0x9d76('0x10')]){if(_0x45bf2c['error'][_0x9d76('0x11')]===0x1f4){logger[_0x9d76('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x448a6c,_0x45bf2c[_0x9d76('0x10')][_0x9d76('0x12')]);return _0x3c36f5(_0x45bf2c[_0x9d76('0x10')][_0x9d76('0x12')]);}logger[_0x9d76('0x10')](_0x9d76('0xb'),_0x448a6c,_0x45bf2c[_0x9d76('0x10')][_0x9d76('0x12')]);return _0x38f004(_0x45bf2c['error']['message']);}else{logger['info'](_0x9d76('0xb'),_0x448a6c,_0x9d76('0xc'));_0x38f004(_0x45bf2c[_0x9d76('0x13')][_0x9d76('0x12')]);}})['catch'](function(_0x18b04f){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x448a6c,_0x18b04f);_0x3c36f5(_0x18b04f);});});}exports['CreateVoiceDialReport']=function(_0x10e2d0){var _0xf1e696=this;return new Promise(function(_0x2bf439,_0x20a96d){return db[_0x9d76('0x14')]['create'](_0x10e2d0['body'],{'raw':_0x10e2d0[_0x9d76('0x15')]?_0x10e2d0['options'][_0x9d76('0x16')]===undefined?!![]:![]:!![]})[_0x9d76('0xa')](function(_0x21f2b8){logger['info']('CreateVoiceDialReport',_0x10e2d0);logger[_0x9d76('0xd')](_0x9d76('0x17'),_0x10e2d0,JSON['stringify'](_0x21f2b8));_0x2bf439(_0x21f2b8);})[_0x9d76('0x18')](function(_0x96fa5){logger[_0x9d76('0x10')](_0x9d76('0x17'),_0x96fa5[_0x9d76('0x12')],_0x10e2d0);_0x20a96d(_0xf1e696[_0x9d76('0x10')](0x1f4,_0x96fa5[_0x9d76('0x12')]));});});};exports[_0x9d76('0x19')]=function(_0x4273ca){var _0xda0818=this;return new Promise(function(_0x12bb2f,_0x206821){return db[_0x9d76('0x14')]['update'](_0x4273ca['body'],{'raw':_0x4273ca[_0x9d76('0x15')]?_0x4273ca[_0x9d76('0x15')][_0x9d76('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4273ca[_0x9d76('0x15')]?_0x4273ca[_0x9d76('0x15')][_0x9d76('0x1a')]||null:null,'attributes':_0x4273ca[_0x9d76('0x15')]?_0x4273ca[_0x9d76('0x15')]['attributes']||null:null,'limit':_0x4273ca[_0x9d76('0x15')]?_0x4273ca[_0x9d76('0x15')][_0x9d76('0x1b')]||null:null})['then'](function(_0x23dc44){logger['info'](_0x9d76('0x19'),_0x4273ca);logger[_0x9d76('0xd')](_0x9d76('0x19'),_0x4273ca,JSON[_0x9d76('0xf')](_0x23dc44));_0x12bb2f(_0x23dc44);})[_0x9d76('0x18')](function(_0x14e253){logger['error'](_0x9d76('0x19'),_0x14e253['message'],_0x4273ca);_0x206821(_0xda0818[_0x9d76('0x10')](0x1f4,_0x14e253[_0x9d76('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index ed9dfb3..87c9b40 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 _0xcfdd=['show','post','create','addApplications','put','/:id','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x5b3a7c,_0x275e07){var _0x2ff8cf=function(_0x2aeb19){while(--_0x2aeb19){_0x5b3a7c['push'](_0x5b3a7c['shift']());}};_0x2ff8cf(++_0x275e07);}(_0xcfdd,0x195));var _0xdcfd=function(_0x5c68c7,_0x54ba85){_0x5c68c7=_0x5c68c7-0x0;var _0x4a94fc=_0xcfdd[_0x5c68c7];return _0x4a94fc;};'use strict';var multer=require('multer');var util=require(_0xdcfd('0x0'));var path=require(_0xdcfd('0x1'));var timeout=require(_0xdcfd('0x2'));var express=require(_0xdcfd('0x3'));var router=express['Router']();var fs_extra=require(_0xdcfd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdcfd('0x5'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xdcfd('0x6')]('/',auth[_0xdcfd('0x7')](),controller[_0xdcfd('0x8')]);router[_0xdcfd('0x6')]('/:id',auth[_0xdcfd('0x7')](),controller[_0xdcfd('0x9')]);router[_0xdcfd('0xa')]('/',auth['isAuthenticated'](),controller[_0xdcfd('0xb')]);router[_0xdcfd('0xa')]('/:id/applications',auth['isAuthenticated'](),controller[_0xdcfd('0xc')]);router[_0xdcfd('0xd')](_0xdcfd('0xe'),auth[_0xdcfd('0x7')](),controller[_0xdcfd('0xf')]);router[_0xdcfd('0x10')](_0xdcfd('0xe'),auth[_0xdcfd('0x7')](),controller['destroy']);module[_0xdcfd('0x11')]=router; \ No newline at end of file +var _0xd0ea=['addApplications','put','update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','get','/:id','post','create','/:id/applications'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xd0ea,0xfc));var _0xad0e=function(_0x52de74,_0x152687){_0x52de74=_0x52de74-0x0;var _0x33113e=_0xd0ea[_0x52de74];return _0x33113e;};'use strict';var multer=require(_0xad0e('0x0'));var util=require(_0xad0e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xad0e('0x2')]();var fs_extra=require(_0xad0e('0x3'));var auth=require(_0xad0e('0x4'));var interaction=require(_0xad0e('0x5'));var config=require(_0xad0e('0x6'));var controller=require(_0xad0e('0x7'));router['get']('/',auth[_0xad0e('0x8')](),controller['index']);router[_0xad0e('0x9')](_0xad0e('0xa'),auth[_0xad0e('0x8')](),controller['show']);router[_0xad0e('0xb')]('/',auth[_0xad0e('0x8')](),controller[_0xad0e('0xc')]);router['post'](_0xad0e('0xd'),auth['isAuthenticated'](),controller[_0xad0e('0xe')]);router[_0xad0e('0xf')](_0xad0e('0xa'),auth['isAuthenticated'](),controller[_0xad0e('0x10')]);router[_0xad0e('0x11')](_0xad0e('0xa'),auth['isAuthenticated'](),controller[_0xad0e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 9fed6fa..0379289 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 _0xe0d9=['ENUM','outbound','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex'];(function(_0x25ab2b,_0x4809c9){var _0x4d6342=function(_0x2e360c){while(--_0x2e360c){_0x25ab2b['push'](_0x25ab2b['shift']());}};_0x4d6342(++_0x4809c9);}(_0xe0d9,0x18c));var _0x9e0d=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0xe0d9[_0x2e8418];return _0x548fe6;};'use strict';var Sequelize=require(_0x9e0d('0x0'));module[_0x9e0d('0x1')]={'context':{'type':Sequelize[_0x9e0d('0x2')],'allowNull':![],'unique':_0x9e0d('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x9e0d('0x2')],'allowNull':![],'unique':_0x9e0d('0x3')},'priority':{'type':Sequelize[_0x9e0d('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x9e0d('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x9e0d('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x9e0d('0x4')]('inbound',_0x9e0d('0x5'),'internal',_0x9e0d('0x6'),_0x9e0d('0x7'),_0x9e0d('0x8'),_0x9e0d('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x9e0d('0x2')]},'interval':{'type':Sequelize[_0x9e0d('0x2')],'allowNull':![],'defaultValue':_0x9e0d('0xa')},'IntervalId':{'type':Sequelize[_0x9e0d('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x9e0d('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x9e0d('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x9e0d('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x9e0d('0xd')},'answer':{'type':Sequelize[_0x9e0d('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x9e0d('0xe')],'get':function(_0x4f4a29){return this['getDataValue'](_0x9e0d('0xf'));}},'alias':{'type':Sequelize[_0x9e0d('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xc500=['compositeIndex','ENUM','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING'];(function(_0x3bb0d4,_0xe492ec){var _0x269be3=function(_0x3fc0af){while(--_0x3fc0af){_0x3bb0d4['push'](_0x3bb0d4['shift']());}};_0x269be3(++_0xe492ec);}(_0xc500,0x10d));var _0x0c50=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc500[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x0c50('0x0'));module[_0x0c50('0x1')]={'context':{'type':Sequelize[_0x0c50('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0c50('0x2')],'allowNull':![],'unique':_0x0c50('0x3')},'priority':{'type':Sequelize[_0x0c50('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0c50('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0c50('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x0c50('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0c50('0x4')]('inbound',_0x0c50('0x5'),_0x0c50('0x6'),_0x0c50('0x7'),_0x0c50('0x8'),'system',_0x0c50('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x0c50('0x2')]},'interval':{'type':Sequelize[_0x0c50('0x2')],'allowNull':![],'defaultValue':_0x0c50('0xa')},'IntervalId':{'type':Sequelize[_0x0c50('0xb')]},'isApp':{'type':Sequelize[_0x0c50('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0c50('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0c50('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x0c50('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0c50('0xb')]},'recordingFormat':{'type':Sequelize[_0x0c50('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0c50('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0c50('0xd')],'get':function(_0x578dcb){return this[_0x0c50('0xe')](_0x0c50('0xf'));}},'alias':{'type':Sequelize[_0x0c50('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 5822974..f42577b 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 _0x3bc9=['model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','length','catch','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','context','description','recordingFormat','alias','addApplications','sequelize','transaction','findOne','isApp','createRouting','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','send','VoiceExtension','rawAttributes','fieldName','key'];(function(_0x2a2bc3,_0x2c79e0){var _0x4d165a=function(_0x378f60){while(--_0x378f60){_0x2a2bc3['push'](_0x2a2bc3['shift']());}};_0x4d165a(++_0x2c79e0);}(_0x3bc9,0x1f2));var _0x93bc=function(_0x31cca9,_0x5ae0c8){_0x31cca9=_0x31cca9-0x0;var _0x14d591=_0x3bc9[_0x31cca9];return _0x14d591;};'use strict';var _=require(_0x93bc('0x0'));var Redis=require(_0x93bc('0x1'));var qs=require(_0x93bc('0x2'));var logger=require(_0x93bc('0x3'))(_0x93bc('0x4'));var config=require(_0x93bc('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x93bc('0x6')](config[_0x93bc('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x93bc('0x7')]));require('./voiceExtension.socket')[_0x93bc('0x8')](socket);function respondWithStatusCode(_0x3b8ab5,_0x3fd968){_0x3fd968=_0x3fd968||0xcc;return function(_0xbfc677){if(_0xbfc677){return _0x3b8ab5[_0x93bc('0x9')](_0x3fd968);}return _0x3b8ab5[_0x93bc('0xa')](_0x3fd968)[_0x93bc('0xb')]();};}function respondWithResult(_0x20298f,_0x3c67e5){_0x3c67e5=_0x3c67e5||0xc8;return function(_0x3d0da3){if(_0x3d0da3){return _0x20298f[_0x93bc('0xa')](_0x3c67e5)[_0x93bc('0xc')](_0x3d0da3);}};}function respondWithFilteredResult(_0x3c700a,_0x5a1830){return function(_0x269818){if(_0x269818){var _0x2e6e0d=typeof _0x5a1830['offset']===_0x93bc('0xd')&&typeof _0x5a1830[_0x93bc('0xe')]===_0x93bc('0xd');var _0x52b2be=_0x269818[_0x93bc('0xf')];var _0x3aeae8=_0x2e6e0d?0x0:_0x5a1830['offset'];var _0x226752=_0x2e6e0d?_0x269818[_0x93bc('0xf')]:_0x5a1830[_0x93bc('0x10')]+_0x5a1830['limit'];var _0x209053;if(_0x226752>=_0x52b2be){_0x226752=_0x52b2be;_0x209053=0xc8;}else{_0x209053=0xce;}_0x3c700a[_0x93bc('0xa')](_0x209053);return _0x3c700a[_0x93bc('0x11')](_0x93bc('0x12'),_0x3aeae8+'-'+_0x226752+'/'+_0x52b2be)[_0x93bc('0xc')](_0x269818);}return null;};}function removeEntity(_0x42f903){return function(_0x311588){if(_0x311588){return _0x311588[_0x93bc('0x13')]()[_0x93bc('0x14')](function(){var _0x2d48c4=_0x311588['get']({'plain':!![]});var _0x557672=[{'name':_0x93bc('0x15'),'value':_0x93bc('0x16'),'ignore':![]},{'name':_0x93bc('0x17'),'value':_0x93bc('0x18'),'ignore':![]},{'name':_0x93bc('0x19'),'value':_0x93bc('0x1a'),'ignore':![]}];var _0x3f36b3=_(_0x557672)[_0x93bc('0x1b')](_0x93bc('0x1c'))[_0x93bc('0x1d')]('value')[_0x93bc('0x1e')]();if(_[_0x93bc('0x1f')](_0x3f36b3,_0x2d48c4[_0x93bc('0x20')])){return;}var _0x49d55d=_[_0x93bc('0x21')](_0x557672,[_0x93bc('0x1e'),_0x2d48c4[_0x93bc('0x20')]])[_0x93bc('0x22')];return db[_0x93bc('0x23')]['destroy']({'where':{'type':_0x49d55d,'resourceId':_0x2d48c4['id']}})[_0x93bc('0x14')](function(){return _0x311588;});})['then'](function(){_0x42f903[_0x93bc('0xa')](0xcc)[_0x93bc('0xb')]();});}};}function handleEntityNotFound(_0x3a0bf8){return function(_0x118fe7){if(!_0x118fe7){_0x3a0bf8[_0x93bc('0x9')](0x194);}return _0x118fe7;};}function handleError(_0x342764,_0x3075e5){_0x3075e5=_0x3075e5||0x1f4;return function(_0x576168){logger[_0x93bc('0x24')](_0x576168['stack']);if(_0x576168['name']){delete _0x576168['name'];}_0x342764[_0x93bc('0xa')](_0x3075e5)[_0x93bc('0x25')](_0x576168);};}exports['index']=function(_0xb8b7f2,_0x299a7f){var _0x40a020={},_0x4f8707={},_0x8f32cb={'count':0x0,'rows':[]};var _0x252fe4=_['map'](db[_0x93bc('0x26')][_0x93bc('0x27')],function(_0x10edf8){return{'name':_0x10edf8[_0x93bc('0x28')],'type':_0x10edf8[_0x93bc('0x20')][_0x93bc('0x29')]};});_0x4f8707[_0x93bc('0x2a')]=_[_0x93bc('0x1d')](_0x252fe4,_0x93bc('0x22'));_0x4f8707['query']=_[_0x93bc('0x2b')](_0xb8b7f2['query']);_0x4f8707[_0x93bc('0x2c')]=_[_0x93bc('0x2d')](_0x4f8707['model'],_0x4f8707[_0x93bc('0x2e')]);_0x40a020[_0x93bc('0x2f')]=_[_0x93bc('0x2d')](_0x4f8707[_0x93bc('0x2a')],qs[_0x93bc('0x30')](_0xb8b7f2[_0x93bc('0x2e')][_0x93bc('0x30')]));_0x40a020[_0x93bc('0x2f')]=_0x40a020[_0x93bc('0x2f')]['length']?_0x40a020[_0x93bc('0x2f')]:_0x4f8707[_0x93bc('0x2a')];if(!_0xb8b7f2['query'][_0x93bc('0x31')](_0x93bc('0x32'))){_0x40a020[_0x93bc('0xe')]=qs[_0x93bc('0xe')](_0xb8b7f2[_0x93bc('0x2e')]['limit']);_0x40a020[_0x93bc('0x10')]=qs[_0x93bc('0x10')](_0xb8b7f2[_0x93bc('0x2e')][_0x93bc('0x10')]);}_0x40a020[_0x93bc('0x33')]=qs[_0x93bc('0x34')](_0xb8b7f2[_0x93bc('0x2e')][_0x93bc('0x34')]);_0x40a020[_0x93bc('0x35')]=qs[_0x93bc('0x2c')](_[_0x93bc('0x36')](_0xb8b7f2['query'],_0x4f8707[_0x93bc('0x2c')]),_0x252fe4);if(_0xb8b7f2[_0x93bc('0x2e')][_0x93bc('0x1b')]){_0x40a020[_0x93bc('0x35')]=_['merge'](_0x40a020[_0x93bc('0x35')],{'$or':_[_0x93bc('0x1d')](_0x252fe4,function(_0x3308d7){if(_0x3308d7[_0x93bc('0x20')]!==_0x93bc('0x37')){var _0x981fa6={};_0x981fa6[_0x3308d7[_0x93bc('0x22')]]={'$like':'%'+_0xb8b7f2[_0x93bc('0x2e')][_0x93bc('0x1b')]+'%'};return _0x981fa6;}})});}_0x40a020=_[_0x93bc('0x38')]({},_0x40a020,_0xb8b7f2[_0x93bc('0x39')]);var _0xe79b34={'where':_0x40a020[_0x93bc('0x35')]};return db[_0x93bc('0x26')]['count'](_0xe79b34)[_0x93bc('0x14')](function(_0x2d24eb){_0x8f32cb['count']=_0x2d24eb;if(_0xb8b7f2[_0x93bc('0x2e')][_0x93bc('0x3a')]){_0x40a020[_0x93bc('0x3b')]=[{'all':!![]}];}return db['VoiceExtension'][_0x93bc('0x3c')](_0x40a020);})[_0x93bc('0x14')](function(_0x47d4dc){_0x8f32cb[_0x93bc('0x3d')]=_0x47d4dc;return _0x8f32cb;})['then'](respondWithFilteredResult(_0x299a7f,_0x40a020))['catch'](handleError(_0x299a7f,null));};exports['show']=function(_0x4389eb,_0xb78b68){var _0x1f2a72={'raw':![],'where':{'id':_0x4389eb['params']['id']}},_0x12c8df={};_0x12c8df[_0x93bc('0x2a')]=_['keys'](db[_0x93bc('0x26')][_0x93bc('0x27')]);_0x12c8df[_0x93bc('0x2e')]=_[_0x93bc('0x2b')](_0x4389eb['query']);_0x12c8df[_0x93bc('0x2c')]=_['intersection'](_0x12c8df[_0x93bc('0x2a')],_0x12c8df[_0x93bc('0x2e')]);_0x1f2a72[_0x93bc('0x2f')]=_[_0x93bc('0x2d')](_0x12c8df[_0x93bc('0x2a')],qs[_0x93bc('0x30')](_0x4389eb[_0x93bc('0x2e')][_0x93bc('0x30')]));_0x1f2a72[_0x93bc('0x2f')]=_0x1f2a72['attributes'][_0x93bc('0x3e')]?_0x1f2a72[_0x93bc('0x2f')]:_0x12c8df['model'];if(_0x4389eb[_0x93bc('0x2e')][_0x93bc('0x3a')]){_0x1f2a72[_0x93bc('0x3b')]=[{'all':!![]}];}_0x1f2a72=_['merge']({},_0x1f2a72,_0x4389eb['options']);return db[_0x93bc('0x26')][_0x93bc('0x21')](_0x1f2a72)['then'](handleEntityNotFound(_0xb78b68,null))[_0x93bc('0x14')](respondWithResult(_0xb78b68,null))['catch'](handleError(_0xb78b68,null));};exports[_0x93bc('0x13')]=function(_0x49ab02,_0x1f3f0b){return db[_0x93bc('0x26')][_0x93bc('0x21')]({'where':{'id':_0x49ab02['params']['id']}})[_0x93bc('0x14')](handleEntityNotFound(_0x1f3f0b,null))['then'](removeEntity(_0x1f3f0b,null))[_0x93bc('0x3f')](handleError(_0x1f3f0b,null));};exports[_0x93bc('0x40')]=function(_0x2d9445,_0x19480e){if(_0x2d9445[_0x93bc('0x41')]['type']==='outbound'&&!_[_0x93bc('0x42')](_0x2d9445[_0x93bc('0x41')][_0x93bc('0x43')],'_')){_0x2d9445[_0x93bc('0x41')][_0x93bc('0x43')]='_'['concat'](_0x2d9445[_0x93bc('0x41')]['exten']);}return db[_0x93bc('0x26')][_0x93bc('0x40')](_0x2d9445[_0x93bc('0x41')],{'raw':![]})[_0x93bc('0x14')](function(_0x885d46){var _0x42e01e=_0x2d9445['user']['get']({'plain':!![]});if(!_0x42e01e)throw new Error(_0x93bc('0x44'));if(_0x42e01e[_0x93bc('0x45')]==='user'){var _0x2f14df=_0x885d46[_0x93bc('0x46')]({'plain':!![]});var _0x5db49f=[{'name':_0x93bc('0x15'),'value':_0x93bc('0x16')},{'name':_0x93bc('0x17'),'value':_0x93bc('0x18')},{'name':_0x93bc('0x19'),'value':_0x93bc('0x1a')}];var _0xe53f57=_[_0x93bc('0x21')](_0x5db49f,[_0x93bc('0x1e'),_0x2f14df[_0x93bc('0x20')]])[_0x93bc('0x22')];return db[_0x93bc('0x47')]['find']({'where':{'name':_0xe53f57,'userProfileId':_0x42e01e[_0x93bc('0x48')]},'raw':!![]})[_0x93bc('0x14')](function(_0x547499){if(_0x547499&&_0x547499[_0x93bc('0x49')]===0x0){return db[_0x93bc('0x23')]['create']({'name':_0x2f14df[_0x93bc('0x22')],'resourceId':_0x2f14df['id'],'type':_0x547499[_0x93bc('0x22')],'sectionId':_0x547499['id']},{})[_0x93bc('0x14')](function(){return _0x885d46;});}else{return _0x885d46;}})[_0x93bc('0x3f')](function(_0x1de4a5){logger['error'](_0x93bc('0x4a'),_0x1de4a5);throw _0x1de4a5;});}return _0x885d46;})[_0x93bc('0x14')](respondWithResult(_0x19480e,0xc9))[_0x93bc('0x3f')](handleError(_0x19480e,null));};exports[_0x93bc('0x4b')]=function(_0x40c25e,_0x50b01e){if(_0x40c25e['body']['id']){delete _0x40c25e['body']['id'];}return db[_0x93bc('0x26')][_0x93bc('0x21')]({'where':{'id':_0x40c25e[_0x93bc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x50b01e,null))[_0x93bc('0x14')](function(_0x429aca){if(_0x429aca){return db[_0x93bc('0x26')][_0x93bc('0x4b')](_[_0x93bc('0x36')](_0x40c25e[_0x93bc('0x41')],[_0x93bc('0x43'),_0x93bc('0x4d'),_0x93bc('0x4e'),_0x93bc('0x4f'),'cutdigits','mandatoryDisposition',_0x93bc('0x50')]),{'where':{'context':_0x429aca['context'],'exten':_0x429aca[_0x93bc('0x43')]},'individualHooks':!![]})['then'](function(_0x4df5cc){return _0x4df5cc;});}return null;})[_0x93bc('0x14')](respondWithStatusCode(_0x50b01e,null))[_0x93bc('0x3f')](handleError(_0x50b01e,null));};exports[_0x93bc('0x51')]=function(_0x43852a,_0x152ef5){var _0x11bd30=_0x43852a[_0x93bc('0x4c')]['id'];var _0x3388d8=_0x43852a['body'];var _0x22dbc1=0xc8;var _0x35e25d=null;return db[_0x93bc('0x52')][_0x93bc('0x53')]({'isolationLevel':db[_0x93bc('0x52')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4cfecf){return db[_0x93bc('0x26')][_0x93bc('0x54')]({'where':{'id':_0x11bd30},'transaction':_0x4cfecf})[_0x93bc('0x14')](function(_0x4c158c){if(_0x4c158c){return db['VoiceExtension'][_0x93bc('0x13')]({'where':{'VoiceExtensionId':_0x11bd30},'transaction':_0x4cfecf})[_0x93bc('0x14')](function(){var _0x156c49=_[_0x93bc('0x1d')](_0x3388d8,function(_0x2279e8){_0x2279e8['VoiceExtensionId']=_0x11bd30;_0x2279e8[_0x93bc('0x55')]=!![];return _0x2279e8;});return _0x4c158c[_0x93bc('0x56')](_0x156c49);})[_0x93bc('0x14')](function(_0x319982){return db['VoiceExtension']['bulkCreate'](_0x319982,{'transaction':_0x4cfecf});});}else{_0x22dbc1=0x194;_0x35e25d=[];}});})[_0x93bc('0x14')](function(){if(_0x22dbc1!==0x194){return db[_0x93bc('0x26')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x11bd30},'order':_0x93bc('0x57')})[_0x93bc('0x14')](function(_0x1aff86){_0x35e25d=_0x1aff86;});}})[_0x93bc('0x3f')](function(_0x4277f8){_0x22dbc1=0x1f4;logger['error'](_0x4277f8[_0x93bc('0x58')]);if(_0x4277f8[_0x93bc('0x22')]){delete _0x4277f8[_0x93bc('0x22')];}_0x35e25d=_0x4277f8;})[_0x93bc('0x59')](function(){if(_0x35e25d===null){_0x152ef5[_0x93bc('0x9')](_0x22dbc1);}else{if(_0x22dbc1===0x1f4){_0x152ef5['status'](_0x22dbc1)['send'](_0x35e25d);}else{_0x152ef5[_0x93bc('0xa')](_0x22dbc1)[_0x93bc('0xc')](_0x35e25d);}}});}; \ No newline at end of file +var _0xc64d=['internal','filter','map','value','includes','type','name','error','stack','send','index','fieldName','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','pick','where','VIRTUAL','merge','options','VoiceExtension','include','findAll','catch','show','rawAttributes','fields','length','includeAll','find','params','body','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','exten','description','recordingFormat','mandatoryDisposition','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc64d,0xa0));var _0xdc64=function(_0x4f809b,_0x4072e2){_0x4f809b=_0x4f809b-0x0;var _0x1ace0d=_0xc64d[_0x4f809b];return _0x1ace0d;};'use strict';var _=require('lodash');var Redis=require(_0xdc64('0x0'));var qs=require(_0xdc64('0x1'));var logger=require('../../config/logger')(_0xdc64('0x2'));var config=require(_0xdc64('0x3'));var db=require(_0xdc64('0x4'))['db'];config[_0xdc64('0x5')]=_[_0xdc64('0x6')](config[_0xdc64('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc64('0x7'))(new Redis(config[_0xdc64('0x5')]));require(_0xdc64('0x8'))[_0xdc64('0x9')](socket);function respondWithStatusCode(_0x208656,_0x5bbffa){_0x5bbffa=_0x5bbffa||0xcc;return function(_0xc0a877){if(_0xc0a877){return _0x208656[_0xdc64('0xa')](_0x5bbffa);}return _0x208656['status'](_0x5bbffa)[_0xdc64('0xb')]();};}function respondWithResult(_0x173d7f,_0x30463e){_0x30463e=_0x30463e||0xc8;return function(_0x1563ee){if(_0x1563ee){return _0x173d7f[_0xdc64('0xc')](_0x30463e)['json'](_0x1563ee);}};}function respondWithFilteredResult(_0x4acda2,_0x3fc96f){return function(_0x12796b){if(_0x12796b){var _0x35d2a3=typeof _0x3fc96f[_0xdc64('0xd')]==='undefined'&&typeof _0x3fc96f['limit']===_0xdc64('0xe');var _0x340957=_0x12796b[_0xdc64('0xf')];var _0x104a79=_0x35d2a3?0x0:_0x3fc96f[_0xdc64('0xd')];var _0x212458=_0x35d2a3?_0x12796b[_0xdc64('0xf')]:_0x3fc96f[_0xdc64('0xd')]+_0x3fc96f[_0xdc64('0x10')];var _0x75e183;if(_0x212458>=_0x340957){_0x212458=_0x340957;_0x75e183=0xc8;}else{_0x75e183=0xce;}_0x4acda2[_0xdc64('0xc')](_0x75e183);return _0x4acda2['set'](_0xdc64('0x11'),_0x104a79+'-'+_0x212458+'/'+_0x340957)[_0xdc64('0x12')](_0x12796b);}return null;};}function removeEntity(_0x17ae1e){return function(_0x51492c){if(_0x51492c){return _0x51492c[_0xdc64('0x13')]()[_0xdc64('0x14')](function(){var _0x56941e=_0x51492c[_0xdc64('0x15')]({'plain':!![]});var _0x132614=[{'name':'InboundRoutes','value':_0xdc64('0x16'),'ignore':![]},{'name':_0xdc64('0x17'),'value':_0xdc64('0x18'),'ignore':![]},{'name':_0xdc64('0x19'),'value':_0xdc64('0x1a'),'ignore':![]}];var _0x25e9bb=_(_0x132614)[_0xdc64('0x1b')]('ignore')[_0xdc64('0x1c')](_0xdc64('0x1d'))[_0xdc64('0x1d')]();if(_[_0xdc64('0x1e')](_0x25e9bb,_0x56941e[_0xdc64('0x1f')])){return;}var _0x540040=_['find'](_0x132614,['value',_0x56941e[_0xdc64('0x1f')]])[_0xdc64('0x20')];return db['UserProfileResource'][_0xdc64('0x13')]({'where':{'type':_0x540040,'resourceId':_0x56941e['id']}})[_0xdc64('0x14')](function(){return _0x51492c;});})[_0xdc64('0x14')](function(){_0x17ae1e[_0xdc64('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x505468){return function(_0xfc009e){if(!_0xfc009e){_0x505468[_0xdc64('0xa')](0x194);}return _0xfc009e;};}function handleError(_0x4382fe,_0xc47fc5){_0xc47fc5=_0xc47fc5||0x1f4;return function(_0x49a08a){logger[_0xdc64('0x21')](_0x49a08a[_0xdc64('0x22')]);if(_0x49a08a[_0xdc64('0x20')]){delete _0x49a08a[_0xdc64('0x20')];}_0x4382fe[_0xdc64('0xc')](_0xc47fc5)[_0xdc64('0x23')](_0x49a08a);};}exports[_0xdc64('0x24')]=function(_0x417612,_0x532a74){var _0x14e72f={},_0x3f4777={},_0x150c06={'count':0x0,'rows':[]};var _0x1f7a23=_[_0xdc64('0x1c')](db['VoiceExtension']['rawAttributes'],function(_0x50540e){return{'name':_0x50540e[_0xdc64('0x25')],'type':_0x50540e[_0xdc64('0x1f')][_0xdc64('0x26')]};});_0x3f4777[_0xdc64('0x27')]=_[_0xdc64('0x1c')](_0x1f7a23,'name');_0x3f4777[_0xdc64('0x28')]=_[_0xdc64('0x29')](_0x417612[_0xdc64('0x28')]);_0x3f4777[_0xdc64('0x2a')]=_[_0xdc64('0x2b')](_0x3f4777[_0xdc64('0x27')],_0x3f4777[_0xdc64('0x28')]);_0x14e72f[_0xdc64('0x2c')]=_['intersection'](_0x3f4777[_0xdc64('0x27')],qs['fields'](_0x417612[_0xdc64('0x28')]['fields']));_0x14e72f['attributes']=_0x14e72f[_0xdc64('0x2c')]['length']?_0x14e72f[_0xdc64('0x2c')]:_0x3f4777[_0xdc64('0x27')];if(!_0x417612['query']['hasOwnProperty'](_0xdc64('0x2d'))){_0x14e72f['limit']=qs[_0xdc64('0x10')](_0x417612[_0xdc64('0x28')][_0xdc64('0x10')]);_0x14e72f['offset']=qs[_0xdc64('0xd')](_0x417612[_0xdc64('0x28')]['offset']);}_0x14e72f[_0xdc64('0x2e')]=qs[_0xdc64('0x2f')](_0x417612[_0xdc64('0x28')][_0xdc64('0x2f')]);_0x14e72f['where']=qs[_0xdc64('0x2a')](_[_0xdc64('0x30')](_0x417612[_0xdc64('0x28')],_0x3f4777[_0xdc64('0x2a')]),_0x1f7a23);if(_0x417612['query'][_0xdc64('0x1b')]){_0x14e72f[_0xdc64('0x31')]=_['merge'](_0x14e72f[_0xdc64('0x31')],{'$or':_[_0xdc64('0x1c')](_0x1f7a23,function(_0x515315){if(_0x515315[_0xdc64('0x1f')]!==_0xdc64('0x32')){var _0x156409={};_0x156409[_0x515315['name']]={'$like':'%'+_0x417612[_0xdc64('0x28')][_0xdc64('0x1b')]+'%'};return _0x156409;}})});}_0x14e72f=_[_0xdc64('0x33')]({},_0x14e72f,_0x417612[_0xdc64('0x34')]);var _0x44a9e2={'where':_0x14e72f[_0xdc64('0x31')]};return db[_0xdc64('0x35')][_0xdc64('0xf')](_0x44a9e2)[_0xdc64('0x14')](function(_0x43134e){_0x150c06[_0xdc64('0xf')]=_0x43134e;if(_0x417612[_0xdc64('0x28')]['includeAll']){_0x14e72f[_0xdc64('0x36')]=[{'all':!![]}];}return db['VoiceExtension'][_0xdc64('0x37')](_0x14e72f);})[_0xdc64('0x14')](function(_0x3d6148){_0x150c06['rows']=_0x3d6148;return _0x150c06;})[_0xdc64('0x14')](respondWithFilteredResult(_0x532a74,_0x14e72f))[_0xdc64('0x38')](handleError(_0x532a74,null));};exports[_0xdc64('0x39')]=function(_0x2c7d47,_0x2df042){var _0x3d7be5={'raw':![],'where':{'id':_0x2c7d47['params']['id']}},_0x371af7={};_0x371af7['model']=_['keys'](db['VoiceExtension'][_0xdc64('0x3a')]);_0x371af7['query']=_[_0xdc64('0x29')](_0x2c7d47[_0xdc64('0x28')]);_0x371af7['filters']=_[_0xdc64('0x2b')](_0x371af7[_0xdc64('0x27')],_0x371af7['query']);_0x3d7be5['attributes']=_[_0xdc64('0x2b')](_0x371af7[_0xdc64('0x27')],qs[_0xdc64('0x3b')](_0x2c7d47['query'][_0xdc64('0x3b')]));_0x3d7be5['attributes']=_0x3d7be5['attributes'][_0xdc64('0x3c')]?_0x3d7be5[_0xdc64('0x2c')]:_0x371af7[_0xdc64('0x27')];if(_0x2c7d47[_0xdc64('0x28')][_0xdc64('0x3d')]){_0x3d7be5[_0xdc64('0x36')]=[{'all':!![]}];}_0x3d7be5=_[_0xdc64('0x33')]({},_0x3d7be5,_0x2c7d47[_0xdc64('0x34')]);return db[_0xdc64('0x35')][_0xdc64('0x3e')](_0x3d7be5)[_0xdc64('0x14')](handleEntityNotFound(_0x2df042,null))[_0xdc64('0x14')](respondWithResult(_0x2df042,null))[_0xdc64('0x38')](handleError(_0x2df042,null));};exports['destroy']=function(_0x578c7d,_0x382d4c){return db[_0xdc64('0x35')]['find']({'where':{'id':_0x578c7d[_0xdc64('0x3f')]['id']}})[_0xdc64('0x14')](handleEntityNotFound(_0x382d4c,null))[_0xdc64('0x14')](removeEntity(_0x382d4c,null))[_0xdc64('0x38')](handleError(_0x382d4c,null));};exports['create']=function(_0x3ae511,_0x456979){if(_0x3ae511[_0xdc64('0x40')][_0xdc64('0x1f')]===_0xdc64('0x18')&&!_['startsWith'](_0x3ae511[_0xdc64('0x40')]['exten'],'_')){_0x3ae511[_0xdc64('0x40')]['exten']='_'[_0xdc64('0x41')](_0x3ae511['body']['exten']);}return db[_0xdc64('0x35')][_0xdc64('0x42')](_0x3ae511[_0xdc64('0x40')],{'raw':![]})['then'](function(_0x48442d){var _0x2952b3=_0x3ae511[_0xdc64('0x43')][_0xdc64('0x15')]({'plain':!![]});if(!_0x2952b3)throw new Error(_0xdc64('0x44'));if(_0x2952b3[_0xdc64('0x45')]===_0xdc64('0x43')){var _0xd52275=_0x48442d[_0xdc64('0x15')]({'plain':!![]});var _0x484e92=[{'name':_0xdc64('0x46'),'value':_0xdc64('0x16')},{'name':_0xdc64('0x17'),'value':_0xdc64('0x18')},{'name':_0xdc64('0x19'),'value':'internal'}];var _0x13aeec=_['find'](_0x484e92,[_0xdc64('0x1d'),_0xd52275['type']])[_0xdc64('0x20')];return db[_0xdc64('0x47')][_0xdc64('0x3e')]({'where':{'name':_0x13aeec,'userProfileId':_0x2952b3[_0xdc64('0x48')]},'raw':!![]})['then'](function(_0x5b1a21){if(_0x5b1a21&&_0x5b1a21[_0xdc64('0x49')]===0x0){return db[_0xdc64('0x4a')]['create']({'name':_0xd52275[_0xdc64('0x20')],'resourceId':_0xd52275['id'],'type':_0x5b1a21[_0xdc64('0x20')],'sectionId':_0x5b1a21['id']},{})[_0xdc64('0x14')](function(){return _0x48442d;});}else{return _0x48442d;}})[_0xdc64('0x38')](function(_0x58f059){logger[_0xdc64('0x21')](_0xdc64('0x4b'),_0x58f059);throw _0x58f059;});}return _0x48442d;})[_0xdc64('0x14')](respondWithResult(_0x456979,0xc9))['catch'](handleError(_0x456979,null));};exports[_0xdc64('0x4c')]=function(_0xc48dd2,_0x3f2cbf){if(_0xc48dd2['body']['id']){delete _0xc48dd2[_0xdc64('0x40')]['id'];}return db[_0xdc64('0x35')][_0xdc64('0x3e')]({'where':{'id':_0xc48dd2[_0xdc64('0x3f')]['id']}})[_0xdc64('0x14')](handleEntityNotFound(_0x3f2cbf,null))[_0xdc64('0x14')](function(_0x1369cd){if(_0x1369cd){return db[_0xdc64('0x35')][_0xdc64('0x4c')](_[_0xdc64('0x30')](_0xc48dd2[_0xdc64('0x40')],[_0xdc64('0x4d'),'context',_0xdc64('0x4e'),_0xdc64('0x4f'),'cutdigits',_0xdc64('0x50'),'alias']),{'where':{'context':_0x1369cd['context'],'exten':_0x1369cd[_0xdc64('0x4d')]},'individualHooks':!![]})[_0xdc64('0x14')](function(_0x572d72){return _0x572d72;});}return null;})[_0xdc64('0x14')](respondWithStatusCode(_0x3f2cbf,null))['catch'](handleError(_0x3f2cbf,null));};exports[_0xdc64('0x51')]=function(_0x32d452,_0x40718f){var _0x1701b3=_0x32d452[_0xdc64('0x3f')]['id'];var _0xe1b412=_0x32d452[_0xdc64('0x40')];var _0x10db91=0xc8;var _0x338b99=null;return db['sequelize'][_0xdc64('0x52')]({'isolationLevel':db[_0xdc64('0x53')][_0xdc64('0x54')]['ISOLATION_LEVELS'][_0xdc64('0x55')]},function(_0x179dad){return db[_0xdc64('0x35')][_0xdc64('0x56')]({'where':{'id':_0x1701b3},'transaction':_0x179dad})[_0xdc64('0x14')](function(_0x51028a){if(_0x51028a){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x1701b3},'transaction':_0x179dad})[_0xdc64('0x14')](function(){var _0x5831d2=_[_0xdc64('0x1c')](_0xe1b412,function(_0x1262e6){_0x1262e6[_0xdc64('0x57')]=_0x1701b3;_0x1262e6[_0xdc64('0x58')]=!![];return _0x1262e6;});return _0x51028a[_0xdc64('0x59')](_0x5831d2);})[_0xdc64('0x14')](function(_0x27b895){return db[_0xdc64('0x35')][_0xdc64('0x5a')](_0x27b895,{'transaction':_0x179dad});});}else{_0x10db91=0x194;_0x338b99=[];}});})[_0xdc64('0x14')](function(){if(_0x10db91!==0x194){return db[_0xdc64('0x35')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x1701b3},'order':_0xdc64('0x5b')})[_0xdc64('0x14')](function(_0x31a824){_0x338b99=_0x31a824;});}})[_0xdc64('0x38')](function(_0x3a836f){_0x10db91=0x1f4;logger['error'](_0x3a836f['stack']);if(_0x3a836f['name']){delete _0x3a836f[_0xdc64('0x20')];}_0x338b99=_0x3a836f;})[_0xdc64('0x5c')](function(){if(_0x338b99===null){_0x40718f['sendStatus'](_0x10db91);}else{if(_0x10db91===0x1f4){_0x40718f[_0xdc64('0xc')](_0x10db91)[_0xdc64('0x23')](_0x338b99);}else{_0x40718f[_0xdc64('0xc')](_0x10db91)[_0xdc64('0x12')](_0x338b99);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 54e7793..a064a99 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 _0x560d=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x323ad4,_0x38730d){var _0x39ea5f=function(_0x20dbd0){while(--_0x20dbd0){_0x323ad4['push'](_0x323ad4['shift']());}};_0x39ea5f(++_0x38730d);}(_0x560d,0xcc));var _0xd560=function(_0x1e0715,_0x1df11a){_0x1e0715=_0x1e0715-0x0;var _0x5c69f3=_0x560d[_0x1e0715];return _0x5c69f3;};'use strict';var EventEmitter=require(_0xd560('0x0'));var VoiceExtension=require(_0xd560('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xd560('0x2')](0x0);var events={'afterCreate':_0xd560('0x3'),'afterUpdate':'update','afterDestroy':_0xd560('0x4')};function emitEvent(_0x165471){return function(_0x3eb90e,_0x51f587,_0x16f776){VoiceExtensionEvents[_0xd560('0x5')](_0x165471+':'+_0x3eb90e['id'],_0x3eb90e);VoiceExtensionEvents[_0xd560('0x5')](_0x165471,_0x3eb90e);_0x16f776(null);};}for(var e in events){if(events[_0xd560('0x6')](e)){var event=events[e];VoiceExtension[_0xd560('0x7')](e,emitEvent(event));}}module[_0xd560('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xe47a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update'];(function(_0x4e3313,_0x2aaa09){var _0x43dadf=function(_0x185680){while(--_0x185680){_0x4e3313['push'](_0x4e3313['shift']());}};_0x43dadf(++_0x2aaa09);}(_0xe47a,0x72));var _0xae47=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xe47a[_0x1d9aa0];return _0x226868;};'use strict';var EventEmitter=require(_0xae47('0x0'));var VoiceExtension=require(_0xae47('0x1'))['db'][_0xae47('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xae47('0x3')](0x0);var events={'afterCreate':_0xae47('0x4'),'afterUpdate':_0xae47('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3c9e9c){return function(_0x17d037,_0x2c4148,_0x4c0d37){VoiceExtensionEvents[_0xae47('0x6')](_0x3c9e9c+':'+_0x17d037['id'],_0x17d037);VoiceExtensionEvents[_0xae47('0x6')](_0x3c9e9c,_0x17d037);_0x4c0d37(null);};}for(var e in events){if(events[_0xae47('0x7')](e)){var event=events[e];VoiceExtension[_0xae47('0x8')](e,emitEvent(event));}}module[_0xae47('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 945699e..6465dfb 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 _0xadec=['toLowerCase','tag','CDR(tag)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','voice_extensions','lodash','./voiceExtension.attributes','exports','type','exten','alias','CDR(routeAlias)=','context','inbound','push','Set','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','NoOp','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','name','param','prefix','phone','split','none','indexOf','U(xcally-mixmonitor-context)','replace','join','Interval','findAll','interval','IntervalId','then','intervals','filter'];(function(_0x474a37,_0x43012e){var _0x13c63e=function(_0x3cc08d){while(--_0x3cc08d){_0x474a37['push'](_0x474a37['shift']());}};_0x13c63e(++_0x43012e);}(_0xadec,0x156));var _0xcade=function(_0x551dc7,_0x395b19){_0x551dc7=_0x551dc7-0x0;var _0x1df540=_0xadec[_0x551dc7];return _0x1df540;};'use strict';var _=require(_0xcade('0x0'));var attributes=require(_0xcade('0x1'));module[_0xcade('0x2')]=function(_0x210817){var _0x35756e=_0x210817['models'];function _0x55ad3c(_0x570d9c){var _0x475533=0x2;var _0x875b81=[{'type':_0x570d9c[_0xcade('0x3')],'app':'Set','appdata':'CDR(type)='+_0x570d9c['type'],'context':_0x570d9c['context'],'exten':_0x570d9c[_0xcade('0x4')],'priority':_0x475533++,'VoiceExtensionId':_0x570d9c['id']},{'type':_0x570d9c['type'],'app':_0x570d9c[_0xcade('0x5')]?'Set':'NoOp','appdata':_0x570d9c[_0xcade('0x5')]?_0xcade('0x6')+_0x570d9c[_0xcade('0x5')]:'No\x20alias\x20set','context':_0x570d9c[_0xcade('0x7')],'exten':_0x570d9c[_0xcade('0x4')],'priority':_0x475533++,'VoiceExtensionId':_0x570d9c['id']}];if(_0x570d9c[_0xcade('0x3')]===_0xcade('0x8')){_0x875b81[_0xcade('0x9')]({'type':_0xcade('0x8'),'app':_0xcade('0xa'),'appdata':_0xcade('0xb')+_0x570d9c['id'],'context':_0x570d9c[_0xcade('0x7')],'exten':_0x570d9c[_0xcade('0x4')],'priority':_0x475533++,'VoiceExtensionId':_0x570d9c['id']});}_0x875b81[_0xcade('0x9')]({'type':_0x570d9c[_0xcade('0x3')],'app':_0xcade('0xa'),'appdata':_0xcade('0xc'),'context':_0x570d9c['context'],'exten':_0x570d9c[_0xcade('0x4')],'priority':_0x475533++,'VoiceExtensionId':_0x570d9c['id']},{'type':_0x570d9c[_0xcade('0x3')],'app':_0xcade('0xa'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x570d9c[_0xcade('0x7')],'exten':_0x570d9c[_0xcade('0x4')],'priority':_0x475533++,'VoiceExtensionId':_0x570d9c['id']},{'type':_0x570d9c['type'],'app':_0xcade('0xa'),'appdata':_0xcade('0xd'),'context':_0x570d9c[_0xcade('0x7')],'exten':_0x570d9c['exten'],'priority':_0x475533++,'VoiceExtensionId':_0x570d9c['id']});return _0x875b81;}function _0x1678cd(_0x329322){var _0x28a720=0x2;var _0x50efed=[{'type':_0xcade('0xe'),'app':_0xcade('0xa'),'appdata':_0xcade('0xf'),'context':_0x329322[_0xcade('0x7')],'exten':_0x329322[_0xcade('0x4')],'priority':_0x28a720++,'VoiceExtensionId':_0x329322['id']},{'type':_0xcade('0xe'),'app':_0x329322[_0xcade('0x5')]?'Set':_0xcade('0x10'),'appdata':_0x329322[_0xcade('0x5')]?_0xcade('0x6')+_0x329322[_0xcade('0x5')]:_0xcade('0x11'),'context':_0x329322['context'],'exten':_0x329322['exten'],'priority':_0x28a720++,'VoiceExtensionId':_0x329322['id']},{'type':_0xcade('0xe'),'app':'Set','appdata':_0xcade('0x12')+(_0x329322[_0xcade('0x13')]?_0xcade('0x14')+_0x329322[_0xcade('0x13')]+'}':_0xcade('0x15')),'context':_0x329322[_0xcade('0x7')],'exten':_0x329322[_0xcade('0x4')],'priority':_0x28a720++,'VoiceExtensionId':_0x329322['id']},{'type':_0xcade('0xe'),'app':_0xcade('0xa'),'appdata':_0xcade('0xb')+_0x329322['id'],'context':_0x329322[_0xcade('0x7')],'exten':_0x329322[_0xcade('0x4')],'priority':_0x28a720++,'VoiceExtensionId':_0x329322['id']},{'type':'outbound','app':_0xcade('0x16'),'appdata':_0xcade('0x17')+(_0x28a720+0x2)+'):Goto('+(_0x28a720+0x1)+')','context':_0x329322[_0xcade('0x7')],'exten':_0x329322[_0xcade('0x4')],'priority':_0x28a720++,'VoiceExtensionId':_0x329322['id']},{'type':_0xcade('0xe'),'app':_0xcade('0xa'),'appdata':_0x329322[_0xcade('0x13')]?_0xcade('0x18')+_0x329322[_0xcade('0x13')]+'}':'CDR(prefix)=noprefix','context':_0x329322[_0xcade('0x7')],'exten':_0x329322[_0xcade('0x4')],'priority':_0x28a720++,'VoiceExtensionId':_0x329322['id']},{'type':_0xcade('0xe'),'app':_0xcade('0xa'),'appdata':_0xcade('0xc'),'context':_0x329322[_0xcade('0x7')],'exten':_0x329322[_0xcade('0x4')],'priority':_0x28a720++,'VoiceExtensionId':_0x329322['id']},{'type':_0xcade('0xe'),'app':'Set','appdata':_0xcade('0x19'),'context':_0x329322[_0xcade('0x7')],'exten':_0x329322[_0xcade('0x4')],'priority':_0x28a720++,'VoiceExtensionId':_0x329322['id']},{'type':_0xcade('0xe'),'app':'Set','appdata':_0xcade('0xd'),'context':_0x329322[_0xcade('0x7')],'exten':_0x329322[_0xcade('0x4')],'priority':_0x28a720++,'VoiceExtensionId':_0x329322['id']},{'type':_0xcade('0xe'),'app':_0xcade('0xa'),'appdata':_0xcade('0x1a')+_0x329322['id'],'context':_0x329322['context'],'exten':_0x329322[_0xcade('0x4')],'priority':_0x28a720++,'VoiceExtensionId':_0x329322['id']}];if(_0x329322[_0xcade('0x1b')](_0xcade('0x1c'))&&_0x329322[_0xcade('0x1c')]!=='none'){_0x50efed[_0xcade('0x9')]({'type':_0xcade('0xe'),'app':_0xcade('0xa'),'appdata':_0xcade('0x1d'),'context':_0x329322[_0xcade('0x7')],'exten':_0x329322[_0xcade('0x4')],'priority':_0x28a720++,'VoiceExtensionId':_0x329322['id']},{'type':'outbound','app':'Set','appdata':_0xcade('0x1e')+_0x329322['recordingFormat']||_0xcade('0x1f'),'context':_0x329322[_0xcade('0x7')],'exten':_0x329322[_0xcade('0x4')],'priority':_0x28a720++,'VoiceExtensionId':_0x329322['id']});}return _0x50efed;}function _0x2b39de(_0x41fc55,_0x2aae69){var _0x3727d5=[{'name':_0xcade('0x20'),'param':0x0},{'name':_0xcade('0x21'),'param':0x1},{'name':_0xcade('0x22'),'param':0x2},{'name':_0xcade('0x23'),'param':0x3}];var _0x265011={};var _0x51d576=_0x2aae69['split'](',');var _0x53d5a8=[];for(var _0x396baa=0x0;_0x396baa<_0x3727d5['length'];_0x396baa++){switch(_0x3727d5[_0x396baa][_0xcade('0x24')]){case'trunk':_0x265011['trunk']=_0x51d576[_0x3727d5[_0x396baa]['param']]['split']('/')[0x1];_0x265011['phone']=_0x51d576[_0x3727d5[_0x396baa][_0xcade('0x25')]]['split']('/')[0x2];_0x265011[_0xcade('0x26')]=_0x265011['phone']?_0x265011[_0xcade('0x27')][_0xcade('0x28')]('$')[0x0]:undefined;_0x265011[_0xcade('0x27')]=_0x41fc55[_0xcade('0x13')]?(_0x265011[_0xcade('0x26')]||'')+_0xcade('0x14')+_0x41fc55['cutdigits']+'}':(_0x265011[_0xcade('0x26')]||'')+_0xcade('0x15');_0x53d5a8[_0x3727d5[_0x396baa][_0xcade('0x25')]]=['SIP',_0x265011[_0xcade('0x20')],_0x265011[_0xcade('0x27')]]['join']('/');break;case _0xcade('0x22'):_0x265011[_0xcade('0x22')]=_0x51d576[_0x3727d5[_0x396baa]['param']];if(_0x41fc55[_0xcade('0x1c')]!==_0xcade('0x29')){if(_0x265011['options'][_0xcade('0x2a')](_0xcade('0x2b'))<0x0){_0x265011['options']+=_0xcade('0x2b');}}else{_0x265011[_0xcade('0x22')]=_0x265011[_0xcade('0x22')][_0xcade('0x2c')](_0xcade('0x2b'),'');}_0x53d5a8[_0x3727d5[_0x396baa][_0xcade('0x25')]]=_0x265011[_0xcade('0x22')];break;default:_0x53d5a8[_0x3727d5[_0x396baa][_0xcade('0x25')]]=_0x51d576[_0x3727d5[_0x396baa][_0xcade('0x25')]];}}return _0x53d5a8[_0xcade('0x2d')](',');}function _0xedaab8(_0x4b6184,_0xc0fc60,_0x4ad05f){return new Promise(function(_0x1963c8,_0x2efd65){var _0xa73b76=[];if(_['isEmpty'](_0xc0fc60))return _0x1963c8(_0xa73b76);_0x35756e[_0xcade('0x2e')][_0xcade('0x2f')]({'attributes':['id',_0xcade('0x30'),_0xcade('0x31')],'raw':!![]})[_0xcade('0x32')](function(_0x34c46b){for(var _0x4bee0a=0x0,_0x485e0d=0x0;_0x4bee0a<_0xc0fc60['length'];_0x4bee0a++,_0x485e0d=0x0){var _0x274ab8=_0xc0fc60[_0x4bee0a];var _0xdbd296=[];var _0x1161d9=[];delete _0x274ab8['id'];if(_0x274ab8[_0xcade('0x30')]!=='*,*,*,*'){_0x274ab8[_0xcade('0x33')]=[_0x274ab8[_0xcade('0x30')]];}else{_0x274ab8[_0xcade('0x33')]=_0x274ab8['IntervalId']?_['map'](_[_0xcade('0x34')](_0x34c46b,{'IntervalId':_0x274ab8[_0xcade('0x31')]}),_0xcade('0x30')):[];}_0x274ab8[_0xcade('0x7')]=_0x4b6184['context'];_0x274ab8[_0xcade('0x4')]=_0x4b6184[_0xcade('0x4')];if(_0x274ab8[_0xcade('0x3')])_0x274ab8[_0xcade('0x3')]=_0x274ab8[_0xcade('0x3')][_0xcade('0x35')]();if(_0x4b6184[_0xcade('0x3')]==='outbound'){if(_0x274ab8[_0xcade('0x1b')](_0xcade('0x36'))&&_0x274ab8[_0xcade('0x36')]&&_0x274ab8[_0xcade('0x36')]!=='--'){_0xdbd296['push']({'type':_0x274ab8[_0xcade('0x3')][_0xcade('0x35')](),'app':_0xcade('0xa'),'appdata':_0xcade('0x37')+_0x274ab8[_0xcade('0x36')],'context':_0x4b6184[_0xcade('0x7')],'exten':_0x4b6184[_0xcade('0x4')],'priority':_0x274ab8[_0xcade('0x33')][_0xcade('0x38')]+_0x4ad05f+_0x485e0d++,'VoiceExtensionId':_0x4b6184['id']});}_0xdbd296[_0xcade('0x9')]({'type':_0x274ab8[_0xcade('0x3')]['toLowerCase'](),'app':_0xcade('0x16'),'appdata':_0xcade('0x39')+(_0x274ab8['callerID']?_0xcade('0x3a')+_0x274ab8['callerID']+')':_0xcade('0x3b')),'context':_0x4b6184[_0xcade('0x7')],'exten':_0x4b6184['exten'],'priority':_0x274ab8[_0xcade('0x33')][_0xcade('0x38')]+_0x4ad05f+_0x485e0d++,'VoiceExtensionId':_0x4b6184['id']});}else{if(_0x274ab8['hasOwnProperty'](_0xcade('0x3c'))){if([_0xcade('0x3d'),_0xcade('0x3e')]['includes'](_0x274ab8[_0xcade('0x3f')][_0xcade('0x35')]())&&_0x274ab8[_0xcade('0x40')]!==_0xcade('0x41')){if(_0x274ab8[_0xcade('0x3c')]){_0xdbd296[_0xcade('0x9')]({'type':_0x274ab8[_0xcade('0x3')]['toLowerCase'](),'app':_0xcade('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4b6184['context'],'exten':_0x4b6184[_0xcade('0x4')],'priority':_0x274ab8[_0xcade('0x33')][_0xcade('0x38')]+_0x4ad05f+_0x485e0d++,'VoiceExtensionId':_0x4b6184['id']});_0xdbd296['push']({'type':_0x274ab8[_0xcade('0x3')][_0xcade('0x35')](),'app':'Set','appdata':_0xcade('0x42'),'context':_0x4b6184[_0xcade('0x7')],'exten':_0x4b6184[_0xcade('0x4')],'priority':_0x274ab8['intervals'][_0xcade('0x38')]+_0x4ad05f+_0x485e0d++,'VoiceExtensionId':_0x4b6184['id']});}else{_0xdbd296[_0xcade('0x9')]({'type':_0x274ab8[_0xcade('0x3')][_0xcade('0x35')](),'app':'ExecIf','appdata':_0xcade('0x43'),'context':_0x4b6184['context'],'exten':_0x4b6184[_0xcade('0x4')],'priority':_0x274ab8[_0xcade('0x33')][_0xcade('0x38')]+_0x4ad05f+_0x485e0d++,'VoiceExtensionId':_0x4b6184['id']});_0xdbd296[_0xcade('0x9')]({'type':_0x274ab8[_0xcade('0x3')][_0xcade('0x35')](),'app':_0xcade('0xa'),'appdata':_0xcade('0x44'),'context':_0x4b6184[_0xcade('0x7')],'exten':_0x4b6184[_0xcade('0x4')],'priority':_0x274ab8['intervals'][_0xcade('0x38')]+_0x4ad05f+_0x485e0d++,'VoiceExtensionId':_0x4b6184['id']});}}}}for(var _0x4696b3=0x0;_0x4696b3<_0x274ab8[_0xcade('0x33')][_0xcade('0x38')];_0x4696b3++){var _0x650665=_0x4ad05f+_0x274ab8['intervals']['length'];var _0x18645a=_0x4696b3===_0x274ab8[_0xcade('0x33')]['length']-0x1?_0x4ad05f+_0xdbd296[_0xcade('0x38')]+_0x1161d9['length']+0x2:_0x4ad05f+_0x4696b3+0x1;_0xdbd296[_0xcade('0x45')](_0x4696b3,0x0,{'type':_0x4b6184[_0xcade('0x3')],'app':_0xcade('0x46'),'appdata':_0x274ab8[_0xcade('0x33')][_0x4696b3]+'?'+_0x4b6184[_0xcade('0x7')]+_0xcade('0x47')+_0x650665+':'+_0x4b6184[_0xcade('0x7')]+_0xcade('0x47')+_0x18645a,'exten':_0x4b6184[_0xcade('0x4')],'context':_0x4b6184[_0xcade('0x7')],'priority':_0x4ad05f+_0x4696b3,'VoiceExtensionId':_0x4b6184['id']});}if(_0x274ab8[_0xcade('0x40')]===_0xcade('0x48')){_0x274ab8[_0xcade('0x49')]=_0x2b39de(_0x4b6184,_0x274ab8[_0xcade('0x49')]);}if(_0x274ab8[_0xcade('0x40')]==='agi'){_0xdbd296['push']({'type':_0x274ab8['type'][_0xcade('0x35')](),'app':'Set','appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x4b6184[_0xcade('0x7')],'exten':_0x4b6184[_0xcade('0x4')],'priority':_0x274ab8[_0xcade('0x33')][_0xcade('0x38')]+_0x4ad05f+_0x485e0d++,'VoiceExtensionId':_0x4b6184['id']});}_0x274ab8[_0xcade('0x4a')]=_0xdbd296[_0xcade('0x38')]?_[_0xcade('0x4b')](_0xdbd296)[_0xcade('0x4a')]+0x1:_0x4ad05f;_0xa73b76=_[_0xcade('0x4c')](_0xa73b76,_0xdbd296,[_0x274ab8],_0x1161d9);_0x4ad05f=_[_0xcade('0x4b')](_0xa73b76)['priority']+0x1;}return _0x1963c8(_0xa73b76);})[_0xcade('0x4d')](function(_0x50aca){_0x2efd65(_0x50aca);});});}return _0x210817['define']('VoiceExtension',attributes,{'tableName':_0xcade('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1c4218){var _0x2fdc2b=this['get']({'plain':!![]});var _0x39943b=_0x2fdc2b[_0xcade('0x3')]===_0xcade('0xe')?_0x1678cd(_0x2fdc2b):_0x55ad3c(_0x2fdc2b);return _0xedaab8(_0x2fdc2b,_0x1c4218,_[_0xcade('0x4b')](_0x39943b)['priority']+0x1)[_0xcade('0x32')](function(_0x19797e){var _0xb94a89=_['concat'](_0x39943b,_0x19797e);_0xb94a89[_0xcade('0x9')]({'type':_0x2fdc2b[_0xcade('0x3')],'app':'Hangup','exten':_0x2fdc2b[_0xcade('0x4')],'context':_0x2fdc2b['context'],'priority':_[_0xcade('0x4b')](_0xb94a89)[_0xcade('0x4a')]+0x1,'VoiceExtensionId':_0x2fdc2b['id']});return _0xb94a89;});}}});}; \ No newline at end of file +var _0x0b71=['tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appdata','appType','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','models','type','CDR(type)=','context','exten','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','name','param','phone','prefix','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','toLowerCase'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b71,0x119));var _0x10b7=function(_0xd29c88,_0x141c80){_0xd29c88=_0xd29c88-0x0;var _0x375635=_0x0b71[_0xd29c88];return _0x375635;};'use strict';var _=require(_0x10b7('0x0'));var attributes=require(_0x10b7('0x1'));module['exports']=function(_0x49f29e){var _0xdbb309=_0x49f29e[_0x10b7('0x2')];function _0x4f44eb(_0x11cf39){var _0x1f43d5=0x2;var _0x16eb96=[{'type':_0x11cf39[_0x10b7('0x3')],'app':'Set','appdata':_0x10b7('0x4')+_0x11cf39[_0x10b7('0x3')],'context':_0x11cf39[_0x10b7('0x5')],'exten':_0x11cf39[_0x10b7('0x6')],'priority':_0x1f43d5++,'VoiceExtensionId':_0x11cf39['id']},{'type':_0x11cf39[_0x10b7('0x3')],'app':_0x11cf39[_0x10b7('0x7')]?_0x10b7('0x8'):_0x10b7('0x9'),'appdata':_0x11cf39[_0x10b7('0x7')]?_0x10b7('0xa')+_0x11cf39['alias']:_0x10b7('0xb'),'context':_0x11cf39[_0x10b7('0x5')],'exten':_0x11cf39[_0x10b7('0x6')],'priority':_0x1f43d5++,'VoiceExtensionId':_0x11cf39['id']}];if(_0x11cf39[_0x10b7('0x3')]===_0x10b7('0xc')){_0x16eb96[_0x10b7('0xd')]({'type':'inbound','app':_0x10b7('0x8'),'appdata':_0x10b7('0xe')+_0x11cf39['id'],'context':_0x11cf39[_0x10b7('0x5')],'exten':_0x11cf39[_0x10b7('0x6')],'priority':_0x1f43d5++,'VoiceExtensionId':_0x11cf39['id']});}_0x16eb96['push']({'type':_0x11cf39[_0x10b7('0x3')],'app':_0x10b7('0x8'),'appdata':_0x10b7('0xf'),'context':_0x11cf39['context'],'exten':_0x11cf39[_0x10b7('0x6')],'priority':_0x1f43d5++,'VoiceExtensionId':_0x11cf39['id']},{'type':_0x11cf39[_0x10b7('0x3')],'app':'Set','appdata':_0x10b7('0x10'),'context':_0x11cf39[_0x10b7('0x5')],'exten':_0x11cf39['exten'],'priority':_0x1f43d5++,'VoiceExtensionId':_0x11cf39['id']},{'type':_0x11cf39[_0x10b7('0x3')],'app':_0x10b7('0x8'),'appdata':'MONITOR_OPTIONS=ab','context':_0x11cf39[_0x10b7('0x5')],'exten':_0x11cf39['exten'],'priority':_0x1f43d5++,'VoiceExtensionId':_0x11cf39['id']});return _0x16eb96;}function _0x27dbdb(_0x592583){var _0xc93dd4=0x2;var _0xd56348=[{'type':_0x10b7('0x11'),'app':'Set','appdata':_0x10b7('0x12'),'context':_0x592583[_0x10b7('0x5')],'exten':_0x592583[_0x10b7('0x6')],'priority':_0xc93dd4++,'VoiceExtensionId':_0x592583['id']},{'type':_0x10b7('0x11'),'app':_0x592583['alias']?_0x10b7('0x8'):_0x10b7('0x9'),'appdata':_0x592583[_0x10b7('0x7')]?_0x10b7('0xa')+_0x592583['alias']:_0x10b7('0xb'),'context':_0x592583[_0x10b7('0x5')],'exten':_0x592583[_0x10b7('0x6')],'priority':_0xc93dd4++,'VoiceExtensionId':_0x592583['id']},{'type':'outbound','app':_0x10b7('0x8'),'appdata':_0x10b7('0x13')+(_0x592583['cutdigits']?_0x10b7('0x14')+_0x592583['cutdigits']+'}':_0x10b7('0x15')),'context':_0x592583[_0x10b7('0x5')],'exten':_0x592583[_0x10b7('0x6')],'priority':_0xc93dd4++,'VoiceExtensionId':_0x592583['id']},{'type':'outbound','app':'Set','appdata':_0x10b7('0xe')+_0x592583['id'],'context':_0x592583[_0x10b7('0x5')],'exten':_0x592583[_0x10b7('0x6')],'priority':_0xc93dd4++,'VoiceExtensionId':_0x592583['id']},{'type':_0x10b7('0x11'),'app':_0x10b7('0x16'),'appdata':_0x10b7('0x17')+(_0xc93dd4+0x2)+_0x10b7('0x18')+(_0xc93dd4+0x1)+')','context':_0x592583[_0x10b7('0x5')],'exten':_0x592583[_0x10b7('0x6')],'priority':_0xc93dd4++,'VoiceExtensionId':_0x592583['id']},{'type':_0x10b7('0x11'),'app':'Set','appdata':_0x592583[_0x10b7('0x19')]?_0x10b7('0x1a')+_0x592583[_0x10b7('0x19')]+'}':_0x10b7('0x1b'),'context':_0x592583[_0x10b7('0x5')],'exten':_0x592583[_0x10b7('0x6')],'priority':_0xc93dd4++,'VoiceExtensionId':_0x592583['id']},{'type':_0x10b7('0x11'),'app':'Set','appdata':_0x10b7('0xf'),'context':_0x592583[_0x10b7('0x5')],'exten':_0x592583['exten'],'priority':_0xc93dd4++,'VoiceExtensionId':_0x592583['id']},{'type':'outbound','app':_0x10b7('0x8'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x592583[_0x10b7('0x5')],'exten':_0x592583['exten'],'priority':_0xc93dd4++,'VoiceExtensionId':_0x592583['id']},{'type':_0x10b7('0x11'),'app':_0x10b7('0x8'),'appdata':'MONITOR_OPTIONS=ab','context':_0x592583[_0x10b7('0x5')],'exten':_0x592583[_0x10b7('0x6')],'priority':_0xc93dd4++,'VoiceExtensionId':_0x592583['id']},{'type':'outbound','app':_0x10b7('0x8'),'appdata':_0x10b7('0x1c')+_0x592583['id'],'context':_0x592583['context'],'exten':_0x592583['exten'],'priority':_0xc93dd4++,'VoiceExtensionId':_0x592583['id']}];if(_0x592583[_0x10b7('0x1d')]('recordingFormat')&&_0x592583[_0x10b7('0x1e')]!==_0x10b7('0x1f')){_0xd56348['push']({'type':_0x10b7('0x11'),'app':_0x10b7('0x8'),'appdata':_0x10b7('0x20'),'context':_0x592583['context'],'exten':_0x592583['exten'],'priority':_0xc93dd4++,'VoiceExtensionId':_0x592583['id']},{'type':_0x10b7('0x11'),'app':_0x10b7('0x8'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x592583[_0x10b7('0x1e')]||_0x10b7('0x21'),'context':_0x592583['context'],'exten':_0x592583['exten'],'priority':_0xc93dd4++,'VoiceExtensionId':_0x592583['id']});}return _0xd56348;}function _0x39a6a0(_0x30f082,_0x4780cc){var _0x4d4015=[{'name':_0x10b7('0x22'),'param':0x0},{'name':_0x10b7('0x23'),'param':0x1},{'name':_0x10b7('0x24'),'param':0x2},{'name':_0x10b7('0x25'),'param':0x3}];var _0x507de3={};var _0x55e1b5=_0x4780cc[_0x10b7('0x26')](',');var _0x564cc1=[];for(var _0x82567c=0x0;_0x82567c<_0x4d4015['length'];_0x82567c++){switch(_0x4d4015[_0x82567c][_0x10b7('0x27')]){case _0x10b7('0x22'):_0x507de3['trunk']=_0x55e1b5[_0x4d4015[_0x82567c][_0x10b7('0x28')]]['split']('/')[0x1];_0x507de3[_0x10b7('0x29')]=_0x55e1b5[_0x4d4015[_0x82567c]['param']][_0x10b7('0x26')]('/')[0x2];_0x507de3[_0x10b7('0x2a')]=_0x507de3[_0x10b7('0x29')]?_0x507de3[_0x10b7('0x29')]['split']('$')[0x0]:undefined;_0x507de3['phone']=_0x30f082[_0x10b7('0x19')]?(_0x507de3[_0x10b7('0x2a')]||'')+_0x10b7('0x14')+_0x30f082[_0x10b7('0x19')]+'}':(_0x507de3[_0x10b7('0x2a')]||'')+_0x10b7('0x15');_0x564cc1[_0x4d4015[_0x82567c]['param']]=['SIP',_0x507de3[_0x10b7('0x22')],_0x507de3[_0x10b7('0x29')]][_0x10b7('0x2b')]('/');break;case _0x10b7('0x24'):_0x507de3[_0x10b7('0x24')]=_0x55e1b5[_0x4d4015[_0x82567c][_0x10b7('0x28')]];if(_0x30f082[_0x10b7('0x1e')]!==_0x10b7('0x1f')){if(_0x507de3['options'][_0x10b7('0x2c')](_0x10b7('0x2d'))<0x0){_0x507de3[_0x10b7('0x24')]+=_0x10b7('0x2d');}}else{_0x507de3[_0x10b7('0x24')]=_0x507de3['options'][_0x10b7('0x2e')](_0x10b7('0x2d'),'');}_0x564cc1[_0x4d4015[_0x82567c]['param']]=_0x507de3[_0x10b7('0x24')];break;default:_0x564cc1[_0x4d4015[_0x82567c]['param']]=_0x55e1b5[_0x4d4015[_0x82567c][_0x10b7('0x28')]];}}return _0x564cc1['join'](',');}function _0x4edb16(_0x1bcb1e,_0x2f87f9,_0x53bf1e){return new Promise(function(_0x540441,_0x7853de){var _0xd5894f=[];if(_[_0x10b7('0x2f')](_0x2f87f9))return _0x540441(_0xd5894f);_0xdbb309[_0x10b7('0x30')][_0x10b7('0x31')]({'attributes':['id',_0x10b7('0x32'),_0x10b7('0x33')],'raw':!![]})[_0x10b7('0x34')](function(_0x5bc07c){for(var _0x596e69=0x0,_0x52c5bc=0x0;_0x596e69<_0x2f87f9[_0x10b7('0x35')];_0x596e69++,_0x52c5bc=0x0){var _0xa0e0ba=_0x2f87f9[_0x596e69];var _0x55f0bb=[];var _0x2bab66=[];delete _0xa0e0ba['id'];if(_0xa0e0ba['interval']!==_0x10b7('0x36')){_0xa0e0ba[_0x10b7('0x37')]=[_0xa0e0ba[_0x10b7('0x32')]];}else{_0xa0e0ba['intervals']=_0xa0e0ba['IntervalId']?_[_0x10b7('0x38')](_[_0x10b7('0x39')](_0x5bc07c,{'IntervalId':_0xa0e0ba[_0x10b7('0x33')]}),_0x10b7('0x32')):[];}_0xa0e0ba[_0x10b7('0x5')]=_0x1bcb1e[_0x10b7('0x5')];_0xa0e0ba['exten']=_0x1bcb1e['exten'];if(_0xa0e0ba[_0x10b7('0x3')])_0xa0e0ba['type']=_0xa0e0ba[_0x10b7('0x3')][_0x10b7('0x3a')]();if(_0x1bcb1e['type']===_0x10b7('0x11')){if(_0xa0e0ba[_0x10b7('0x1d')](_0x10b7('0x3b'))&&_0xa0e0ba[_0x10b7('0x3b')]&&_0xa0e0ba['tag']!=='--'){_0x55f0bb[_0x10b7('0xd')]({'type':_0xa0e0ba[_0x10b7('0x3')][_0x10b7('0x3a')](),'app':_0x10b7('0x8'),'appdata':_0x10b7('0x3c')+_0xa0e0ba[_0x10b7('0x3b')],'context':_0x1bcb1e['context'],'exten':_0x1bcb1e['exten'],'priority':_0xa0e0ba[_0x10b7('0x37')][_0x10b7('0x35')]+_0x53bf1e+_0x52c5bc++,'VoiceExtensionId':_0x1bcb1e['id']});}_0x55f0bb[_0x10b7('0xd')]({'type':_0xa0e0ba[_0x10b7('0x3')]['toLowerCase'](),'app':_0x10b7('0x16'),'appdata':_0x10b7('0x3d')+(_0xa0e0ba[_0x10b7('0x3e')]?'Set(CALLERID(all)='+_0xa0e0ba[_0x10b7('0x3e')]+')':_0x10b7('0x3f')),'context':_0x1bcb1e[_0x10b7('0x5')],'exten':_0x1bcb1e[_0x10b7('0x6')],'priority':_0xa0e0ba['intervals'][_0x10b7('0x35')]+_0x53bf1e+_0x52c5bc++,'VoiceExtensionId':_0x1bcb1e['id']});}else{if(_0xa0e0ba[_0x10b7('0x1d')](_0x10b7('0x40'))){if(['queue','playback']['includes'](_0xa0e0ba[_0x10b7('0x41')][_0x10b7('0x3a')]())&&_0xa0e0ba['appType']!=='custom'){if(_0xa0e0ba[_0x10b7('0x40')]){_0x55f0bb[_0x10b7('0xd')]({'type':_0xa0e0ba[_0x10b7('0x3')][_0x10b7('0x3a')](),'app':_0x10b7('0x16'),'appdata':_0x10b7('0x42'),'context':_0x1bcb1e['context'],'exten':_0x1bcb1e[_0x10b7('0x6')],'priority':_0xa0e0ba[_0x10b7('0x37')]['length']+_0x53bf1e+_0x52c5bc++,'VoiceExtensionId':_0x1bcb1e['id']});_0x55f0bb[_0x10b7('0xd')]({'type':_0xa0e0ba[_0x10b7('0x3')]['toLowerCase'](),'app':_0x10b7('0x8'),'appdata':_0x10b7('0x43'),'context':_0x1bcb1e[_0x10b7('0x5')],'exten':_0x1bcb1e['exten'],'priority':_0xa0e0ba[_0x10b7('0x37')][_0x10b7('0x35')]+_0x53bf1e+_0x52c5bc++,'VoiceExtensionId':_0x1bcb1e['id']});}else{_0x55f0bb[_0x10b7('0xd')]({'type':_0xa0e0ba[_0x10b7('0x3')][_0x10b7('0x3a')](),'app':_0x10b7('0x16'),'appdata':_0x10b7('0x44'),'context':_0x1bcb1e['context'],'exten':_0x1bcb1e[_0x10b7('0x6')],'priority':_0xa0e0ba[_0x10b7('0x37')][_0x10b7('0x35')]+_0x53bf1e+_0x52c5bc++,'VoiceExtensionId':_0x1bcb1e['id']});_0x55f0bb[_0x10b7('0xd')]({'type':_0xa0e0ba[_0x10b7('0x3')]['toLowerCase'](),'app':_0x10b7('0x8'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x1bcb1e[_0x10b7('0x5')],'exten':_0x1bcb1e[_0x10b7('0x6')],'priority':_0xa0e0ba[_0x10b7('0x37')][_0x10b7('0x35')]+_0x53bf1e+_0x52c5bc++,'VoiceExtensionId':_0x1bcb1e['id']});}}}}for(var _0x3a6f12=0x0;_0x3a6f12<_0xa0e0ba['intervals'][_0x10b7('0x35')];_0x3a6f12++){var _0x55d9a6=_0x53bf1e+_0xa0e0ba[_0x10b7('0x37')][_0x10b7('0x35')];var _0x227ec6=_0x3a6f12===_0xa0e0ba[_0x10b7('0x37')]['length']-0x1?_0x53bf1e+_0x55f0bb[_0x10b7('0x35')]+_0x2bab66[_0x10b7('0x35')]+0x2:_0x53bf1e+_0x3a6f12+0x1;_0x55f0bb[_0x10b7('0x45')](_0x3a6f12,0x0,{'type':_0x1bcb1e['type'],'app':_0x10b7('0x46'),'appdata':_0xa0e0ba['intervals'][_0x3a6f12]+'?'+_0x1bcb1e[_0x10b7('0x5')]+',${EXTEN},'+_0x55d9a6+':'+_0x1bcb1e[_0x10b7('0x5')]+_0x10b7('0x47')+_0x227ec6,'exten':_0x1bcb1e[_0x10b7('0x6')],'context':_0x1bcb1e['context'],'priority':_0x53bf1e+_0x3a6f12,'VoiceExtensionId':_0x1bcb1e['id']});}if(_0xa0e0ba['appType']==='outboundDial'){_0xa0e0ba[_0x10b7('0x48')]=_0x39a6a0(_0x1bcb1e,_0xa0e0ba['appdata']);}if(_0xa0e0ba[_0x10b7('0x49')]===_0x10b7('0x4a')){_0x55f0bb[_0x10b7('0xd')]({'type':_0xa0e0ba[_0x10b7('0x3')][_0x10b7('0x3a')](),'app':_0x10b7('0x8'),'appdata':_0x10b7('0x4b'),'context':_0x1bcb1e[_0x10b7('0x5')],'exten':_0x1bcb1e[_0x10b7('0x6')],'priority':_0xa0e0ba['intervals'][_0x10b7('0x35')]+_0x53bf1e+_0x52c5bc++,'VoiceExtensionId':_0x1bcb1e['id']});}_0xa0e0ba['priority']=_0x55f0bb['length']?_[_0x10b7('0x4c')](_0x55f0bb)[_0x10b7('0x4d')]+0x1:_0x53bf1e;_0xd5894f=_[_0x10b7('0x4e')](_0xd5894f,_0x55f0bb,[_0xa0e0ba],_0x2bab66);_0x53bf1e=_['last'](_0xd5894f)[_0x10b7('0x4d')]+0x1;}return _0x540441(_0xd5894f);})[_0x10b7('0x4f')](function(_0x25fdb6){_0x7853de(_0x25fdb6);});});}return _0x49f29e[_0x10b7('0x50')](_0x10b7('0x51'),attributes,{'tableName':_0x10b7('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3d031b){var _0x562f98=this[_0x10b7('0x53')]({'plain':!![]});var _0x5d2598=_0x562f98['type']===_0x10b7('0x11')?_0x27dbdb(_0x562f98):_0x4f44eb(_0x562f98);return _0x4edb16(_0x562f98,_0x3d031b,_['last'](_0x5d2598)[_0x10b7('0x4d')]+0x1)[_0x10b7('0x34')](function(_0xad9de8){var _0x5b01c2=_[_0x10b7('0x4e')](_0x5d2598,_0xad9de8);_0x5b01c2['push']({'type':_0x562f98[_0x10b7('0x3')],'app':_0x10b7('0x54'),'exten':_0x562f98[_0x10b7('0x6')],'context':_0x562f98[_0x10b7('0x5')],'priority':_[_0x10b7('0x4c')](_0x5b01c2)[_0x10b7('0x4d')]+0x1,'VoiceExtensionId':_0x562f98['id']});return _0x5b01c2;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 6c02aeb..6ac939a 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 _0x8a5c=['./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','VoiceExtension','findAll','options','raw','attributes','include','map','model','GetVoiceExtension','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x8a5c,0x112));var _0xc8a5=function(_0x25e4e0,_0x5923e5){_0x25e4e0=_0x25e4e0-0x0;var _0x3f8f75=_0x8a5c[_0x25e4e0];return _0x3f8f75;};'use strict';var _=require('lodash');var util=require(_0xc8a5('0x0'));var moment=require(_0xc8a5('0x1'));var BPromise=require(_0xc8a5('0x2'));var rs=require(_0xc8a5('0x3'));var fs=require('fs');var Redis=require(_0xc8a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8a5('0x5'));var logger=require(_0xc8a5('0x6'))('rpc');var config=require(_0xc8a5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc8a5('0x8')][_0xc8a5('0x9')]({'port':0x232a});config[_0xc8a5('0xa')]=_[_0xc8a5('0xb')](config[_0xc8a5('0xa')],{'host':_0xc8a5('0xc'),'port':0x18eb});var socket=require(_0xc8a5('0xd'))(new Redis(config[_0xc8a5('0xa')]));require(_0xc8a5('0xe'))[_0xc8a5('0xf')](socket);function respondWithRpcPromise(_0x1b6dbc,_0x1a5d79,_0xa5f1f6){return new BPromise(function(_0xb75c77,_0x270030){return client[_0xc8a5('0x10')](_0x1b6dbc,_0xa5f1f6)[_0xc8a5('0x11')](function(_0x1c22e){logger[_0xc8a5('0x12')](_0xc8a5('0x13'),_0x1a5d79,'request\x20sent');logger[_0xc8a5('0x14')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x1a5d79,_0xc8a5('0x15'),JSON[_0xc8a5('0x16')](_0x1c22e));if(_0x1c22e['error']){if(_0x1c22e[_0xc8a5('0x17')]['code']===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x1a5d79,_0x1c22e[_0xc8a5('0x17')]['message']);return _0x270030(_0x1c22e[_0xc8a5('0x17')][_0xc8a5('0x18')]);}logger[_0xc8a5('0x17')](_0xc8a5('0x13'),_0x1a5d79,_0x1c22e[_0xc8a5('0x17')][_0xc8a5('0x18')]);return _0xb75c77(_0x1c22e[_0xc8a5('0x17')][_0xc8a5('0x18')]);}else{logger[_0xc8a5('0x12')](_0xc8a5('0x13'),_0x1a5d79,_0xc8a5('0x15'));_0xb75c77(_0x1c22e[_0xc8a5('0x19')][_0xc8a5('0x18')]);}})[_0xc8a5('0x1a')](function(_0x4defb9){logger[_0xc8a5('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x1a5d79,_0x4defb9);_0x270030(_0x4defb9);});});}exports['GetVoiceExtension']=function(_0x26cd2f){var _0x1d2325=this;return new Promise(function(_0x277aaf,_0x43ba3e){return db[_0xc8a5('0x1b')][_0xc8a5('0x1c')]({'raw':_0x26cd2f[_0xc8a5('0x1d')]?_0x26cd2f[_0xc8a5('0x1d')][_0xc8a5('0x1e')]===undefined?!![]:![]:!![],'where':_0x26cd2f[_0xc8a5('0x1d')]?_0x26cd2f[_0xc8a5('0x1d')]['where']||null:null,'attributes':_0x26cd2f[_0xc8a5('0x1d')]?_0x26cd2f[_0xc8a5('0x1d')][_0xc8a5('0x1f')]||null:null,'limit':_0x26cd2f[_0xc8a5('0x1d')]?_0x26cd2f[_0xc8a5('0x1d')]['limit']||null:null,'include':_0x26cd2f[_0xc8a5('0x1d')]?_0x26cd2f[_0xc8a5('0x1d')][_0xc8a5('0x20')]?_[_0xc8a5('0x21')](_0x26cd2f['options'][_0xc8a5('0x20')],function(_0xe7289d){return{'model':db[_0xe7289d[_0xc8a5('0x22')]],'as':_0xe7289d['as'],'attributes':_0xe7289d[_0xc8a5('0x1f')],'include':_0xe7289d[_0xc8a5('0x20')]?_[_0xc8a5('0x21')](_0xe7289d[_0xc8a5('0x20')],function(_0x13ed95){return{'model':db[_0x13ed95[_0xc8a5('0x22')]],'as':_0x13ed95['as'],'attributes':_0x13ed95[_0xc8a5('0x1f')],'include':_0x13ed95['include']?_['map'](_0x13ed95['include'],function(_0x2aa7eb){return{'model':db[_0x2aa7eb[_0xc8a5('0x22')]],'as':_0x2aa7eb['as'],'attributes':_0x2aa7eb[_0xc8a5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc8a5('0x11')](function(_0x545e9e){logger[_0xc8a5('0x12')](_0xc8a5('0x23'),_0x26cd2f);logger[_0xc8a5('0x14')]('GetVoiceExtension',_0x26cd2f,JSON['stringify'](_0x545e9e));_0x277aaf(_0x545e9e);})[_0xc8a5('0x1a')](function(_0x25c91c){logger[_0xc8a5('0x17')]('GetVoiceExtension',_0x25c91c[_0xc8a5('0x18')],_0x26cd2f);_0x43ba3e(_0x1d2325[_0xc8a5('0x17')](0x1f4,_0x25c91c['message']));});});}; \ No newline at end of file +var _0x2d06=['info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceExtension','options','raw','where','limit','map','include','model','GetVoiceExtension','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then'];(function(_0x13e17f,_0x89b33c){var _0x1eaa46=function(_0x22724b){while(--_0x22724b){_0x13e17f['push'](_0x13e17f['shift']());}};_0x1eaa46(++_0x89b33c);}(_0x2d06,0x157));var _0x62d0=function(_0x2c5cb,_0xaa8970){_0x2c5cb=_0x2c5cb-0x0;var _0x24cf1a=_0x2d06[_0x2c5cb];return _0x24cf1a;};'use strict';var _=require('lodash');var util=require(_0x62d0('0x0'));var moment=require(_0x62d0('0x1'));var BPromise=require(_0x62d0('0x2'));var rs=require(_0x62d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62d0('0x4'))['db'];var utils=require(_0x62d0('0x5'));var logger=require(_0x62d0('0x6'))(_0x62d0('0x7'));var config=require('../../config/environment');var jayson=require(_0x62d0('0x8'));var client=jayson[_0x62d0('0x9')]['http']({'port':0x232a});config[_0x62d0('0xa')]=_[_0x62d0('0xb')](config['redis'],{'host':_0x62d0('0xc'),'port':0x18eb});var socket=require(_0x62d0('0xd'))(new Redis(config[_0x62d0('0xa')]));require(_0x62d0('0xe'))['register'](socket);function respondWithRpcPromise(_0x530014,_0x2942cd,_0x340cff){return new BPromise(function(_0x43e4c4,_0x26a4c0){return client[_0x62d0('0xf')](_0x530014,_0x340cff)[_0x62d0('0x10')](function(_0x7069c7){logger[_0x62d0('0x11')](_0x62d0('0x12'),_0x2942cd,_0x62d0('0x13'));logger[_0x62d0('0x14')](_0x62d0('0x15'),_0x2942cd,_0x62d0('0x13'),JSON[_0x62d0('0x16')](_0x7069c7));if(_0x7069c7['error']){if(_0x7069c7[_0x62d0('0x17')][_0x62d0('0x18')]===0x1f4){logger[_0x62d0('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x2942cd,_0x7069c7[_0x62d0('0x17')][_0x62d0('0x19')]);return _0x26a4c0(_0x7069c7['error'][_0x62d0('0x19')]);}logger[_0x62d0('0x17')](_0x62d0('0x12'),_0x2942cd,_0x7069c7[_0x62d0('0x17')]['message']);return _0x43e4c4(_0x7069c7[_0x62d0('0x17')][_0x62d0('0x19')]);}else{logger['info'](_0x62d0('0x12'),_0x2942cd,_0x62d0('0x13'));_0x43e4c4(_0x7069c7['result'][_0x62d0('0x19')]);}})['catch'](function(_0xaa093f){logger[_0x62d0('0x17')](_0x62d0('0x12'),_0x2942cd,_0xaa093f);_0x26a4c0(_0xaa093f);});});}exports['GetVoiceExtension']=function(_0x4579fa){var _0x434aae=this;return new Promise(function(_0xb665b2,_0x5503dc){return db[_0x62d0('0x1a')]['findAll']({'raw':_0x4579fa[_0x62d0('0x1b')]?_0x4579fa['options'][_0x62d0('0x1c')]===undefined?!![]:![]:!![],'where':_0x4579fa['options']?_0x4579fa[_0x62d0('0x1b')][_0x62d0('0x1d')]||null:null,'attributes':_0x4579fa['options']?_0x4579fa[_0x62d0('0x1b')]['attributes']||null:null,'limit':_0x4579fa[_0x62d0('0x1b')]?_0x4579fa['options'][_0x62d0('0x1e')]||null:null,'include':_0x4579fa[_0x62d0('0x1b')]?_0x4579fa[_0x62d0('0x1b')]['include']?_[_0x62d0('0x1f')](_0x4579fa[_0x62d0('0x1b')]['include'],function(_0x479dd1){return{'model':db[_0x479dd1['model']],'as':_0x479dd1['as'],'attributes':_0x479dd1['attributes'],'include':_0x479dd1[_0x62d0('0x20')]?_[_0x62d0('0x1f')](_0x479dd1[_0x62d0('0x20')],function(_0x2d5279){return{'model':db[_0x2d5279[_0x62d0('0x21')]],'as':_0x2d5279['as'],'attributes':_0x2d5279['attributes'],'include':_0x2d5279['include']?_[_0x62d0('0x1f')](_0x2d5279[_0x62d0('0x20')],function(_0xeac742){return{'model':db[_0xeac742[_0x62d0('0x21')]],'as':_0xeac742['as'],'attributes':_0xeac742['attributes']};}):[]};}):[]};}):[]:[]})[_0x62d0('0x10')](function(_0x5e8cd2){logger[_0x62d0('0x11')](_0x62d0('0x22'),_0x4579fa);logger[_0x62d0('0x14')](_0x62d0('0x22'),_0x4579fa,JSON[_0x62d0('0x16')](_0x5e8cd2));_0xb665b2(_0x5e8cd2);})[_0x62d0('0x23')](function(_0x84dbb2){logger[_0x62d0('0x17')](_0x62d0('0x22'),_0x84dbb2[_0x62d0('0x19')],_0x4579fa);_0x5503dc(_0x434aae[_0x62d0('0x17')](0x1f4,_0x84dbb2[_0x62d0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 8f59258..b1a99b8 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 _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x586af9,_0x249111){var _0x2056ca=function(_0x524dcd){while(--_0x524dcd){_0x586af9['push'](_0x586af9['shift']());}};_0x2056ca(++_0x249111);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x3e9143,_0x4a323e){var _0x151bb4=function(_0x3abdd6){while(--_0x3abdd6){_0x3e9143['push'](_0x3e9143['shift']());}};_0x151bb4(++_0x4a323e);}(_0x1261,0x144));var _0x1126=function(_0x39f375,_0x3aa8ec){_0x39f375=_0x39f375-0x0;var _0x463f93=_0x1261[_0x39f375];return _0x463f93;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index a46e4b9..012a6df 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 _0x627e=['show','/:id/messages','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id'];(function(_0x44ac41,_0x194b4a){var _0x2d1643=function(_0x5a6a40){while(--_0x5a6a40){_0x44ac41['push'](_0x44ac41['shift']());}};_0x2d1643(++_0x194b4a);}(_0x627e,0x14a));var _0xe627=function(_0x23ad77,_0xc725a8){_0x23ad77=_0x23ad77-0x0;var _0x20fd33=_0x627e[_0x23ad77];return _0x20fd33;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require(_0xe627('0x7'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router['get']('/',auth[_0xe627('0x8')](),controller[_0xe627('0x9')]);router[_0xe627('0xa')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xc')]);router['get'](_0xe627('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0xe627('0xe')]('/',auth[_0xe627('0x8')](),controller['create']);router['put'](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xf')]);router[_0xe627('0x10')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0x11')]);module[_0xe627('0x12')]=router; \ No newline at end of file +var _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','/:id','isAuthenticated','/:id/messages','getMessages','post','create','put','update','delete','destroy','multer','util'];(function(_0xa6b085,_0x7728a0){var _0x1a1e4c=function(_0x2680e7){while(--_0x2680e7){_0xa6b085['push'](_0xa6b085['shift']());}};_0x1a1e4c(++_0x7728a0);}(_0x9f0e,0x116));var _0xe9f0=function(_0x184093,_0x59ecb7){_0x184093=_0x184093-0x0;var _0x13c21c=_0x9f0e[_0x184093];return _0x13c21c;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['show']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xa'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xa'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);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 e847490..9743ab7 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 _0x1c78=['trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','fullname','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x1c78,0x196));var _0x81c7=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x1c78[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x81c7('0x0'));module[_0x81c7('0x1')]={'customer_id':{'type':Sequelize[_0x81c7('0x2')]},'context':{'type':Sequelize[_0x81c7('0x2')],'defaultValue':_0x81c7('0x3'),'unique':_0x81c7('0x4')},'mailbox':{'type':Sequelize[_0x81c7('0x2')],'defaultValue':'','allowNull':![],'unique':_0x81c7('0x4')},'password':{'type':Sequelize[_0x81c7('0x2')]},'fullname':{'type':Sequelize[_0x81c7('0x2')]},'email':{'type':Sequelize[_0x81c7('0x2')],'validate':{'isEmail':!![]},'set':function(_0x47e156){this[_0x81c7('0x5')](_0x81c7('0x6'),typeof _0x47e156===_0x81c7('0x7')&&_0x47e156[_0x81c7('0x8')]()?_0x47e156['trim']():null);}},'pager':{'type':Sequelize[_0x81c7('0x2')]},'tz':{'type':Sequelize[_0x81c7('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x81c7('0x9')](_0x81c7('0xa'),'no'),'defaultValue':_0x81c7('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x81c7('0x9')]('yes','no'),'defaultValue':_0x81c7('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x81c7('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x81c7('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x81c7('0x9')](_0x81c7('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x81c7('0x9')](_0x81c7('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x81c7('0x9')](_0x81c7('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x81c7('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x81c7('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x81c7('0x9')](_0x81c7('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x81c7('0x9')](_0x81c7('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x81c7('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x81c7('0x9')](_0x81c7('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x81c7('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x81c7('0xc')},'emailsubject':{'type':Sequelize[_0x81c7('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x81c7('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x81c7('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x81c7('0xe'))+_0x81c7('0xf')+this[_0x81c7('0x10')](_0x81c7('0x11'));}}}; \ No newline at end of file +var _0x8e01=['trim','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x1dcac1,_0x547636){var _0x4639d8=function(_0x2ed203){while(--_0x2ed203){_0x1dcac1['push'](_0x1dcac1['shift']());}};_0x4639d8(++_0x547636);}(_0x8e01,0x197));var _0x18e0=function(_0x3ab142,_0x5c03bc){_0x3ab142=_0x3ab142-0x0;var _0x12fc21=_0x8e01[_0x3ab142];return _0x12fc21;};'use strict';var Sequelize=require('sequelize');module[_0x18e0('0x0')]={'customer_id':{'type':Sequelize[_0x18e0('0x1')]},'context':{'type':Sequelize[_0x18e0('0x1')],'defaultValue':_0x18e0('0x2'),'unique':_0x18e0('0x3')},'mailbox':{'type':Sequelize[_0x18e0('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x18e0('0x1')],'validate':{'isEmail':!![]},'set':function(_0x49f25d){this[_0x18e0('0x4')](_0x18e0('0x5'),typeof _0x49f25d===_0x18e0('0x6')&&_0x49f25d[_0x18e0('0x7')]()?_0x49f25d['trim']():null);}},'pager':{'type':Sequelize[_0x18e0('0x1')]},'tz':{'type':Sequelize[_0x18e0('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x18e0('0x8'),'no'),'defaultValue':_0x18e0('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x18e0('0x9')](_0x18e0('0x8'),'no'),'defaultValue':_0x18e0('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x18e0('0x1')]},'callback':{'type':Sequelize[_0x18e0('0x1')]},'review':{'type':Sequelize['ENUM'](_0x18e0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x18e0('0x9')](_0x18e0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x18e0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x18e0('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x18e0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x18e0('0x9')](_0x18e0('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x18e0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x18e0('0x9')](_0x18e0('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x18e0('0x9')]('yes','no'),'defaultValue':_0x18e0('0x8'),'allowNull':![]},'stamp':{'type':_0x18e0('0xb')},'emailsubject':{'type':Sequelize[_0x18e0('0x1')]},'emailbody':{'type':Sequelize[_0x18e0('0x1')]},'maxsecs':{'type':Sequelize[_0x18e0('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x18e0('0xd')],'get':function(){return this[_0x18e0('0xe')](_0x18e0('0xf'))+_0x18e0('0x10')+this[_0x18e0('0xe')](_0x18e0('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 4658fb3..5622e5e 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 _0x1c7c=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0x1c7c,0x164));var _0xc1c7=function(_0x160096,_0x42f686){_0x160096=_0x160096-0x0;var _0x30a930=_0x1c7c[_0x160096];return _0x30a930;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];function respondWithStatusCode(_0x44bf88,_0x376cab){_0x376cab=_0x376cab||0xcc;return function(_0x35feaa){if(_0x35feaa){return _0x44bf88[_0xc1c7('0x1b')](_0x376cab);}return _0x44bf88[_0xc1c7('0x1c')](_0x376cab)[_0xc1c7('0x1d')]();};}function respondWithResult(_0x1b57ab,_0xdfc7d9){_0xdfc7d9=_0xdfc7d9||0xc8;return function(_0x1b6905){if(_0x1b6905){return _0x1b57ab[_0xc1c7('0x1c')](_0xdfc7d9)[_0xc1c7('0x1e')](_0x1b6905);}};}function respondWithFilteredResult(_0x49576d,_0x3e1f0e){return function(_0x335600){if(_0x335600){var _0x21911c=typeof _0x3e1f0e['offset']===_0xc1c7('0x1f')&&typeof _0x3e1f0e[_0xc1c7('0x20')]===_0xc1c7('0x1f');var _0x39ac54=_0x335600[_0xc1c7('0x21')];var _0xb42702=_0x21911c?0x0:_0x3e1f0e[_0xc1c7('0x22')];var _0x2e93e5=_0x21911c?_0x335600['count']:_0x3e1f0e[_0xc1c7('0x22')]+_0x3e1f0e[_0xc1c7('0x20')];var _0x3ec66a;if(_0x2e93e5>=_0x39ac54){_0x2e93e5=_0x39ac54;_0x3ec66a=0xc8;}else{_0x3ec66a=0xce;}_0x49576d[_0xc1c7('0x1c')](_0x3ec66a);return _0x49576d['set'](_0xc1c7('0x23'),_0xb42702+'-'+_0x2e93e5+'/'+_0x39ac54)['json'](_0x335600);}return null;};}function patchUpdates(_0x5e7e4a){return function(_0x195c5f){try{jsonpatch['apply'](_0x195c5f,_0x5e7e4a,!![]);}catch(_0x5846f0){return BPromise[_0xc1c7('0x24')](_0x5846f0);}return _0x195c5f[_0xc1c7('0x25')]();};}function saveUpdates(_0x2f1b87,_0x4c6b34){return function(_0x813853){if(_0x813853){return _0x813853[_0xc1c7('0x26')](_0x2f1b87)[_0xc1c7('0x27')](function(_0x31a0e0){return _0x31a0e0;});}return null;};}function removeEntity(_0x2e64c4,_0x3a2483){return function(_0x3180fd){if(_0x3180fd){return _0x3180fd[_0xc1c7('0x28')]()[_0xc1c7('0x27')](function(){var _0x1540c1=_0x3180fd[_0xc1c7('0x29')]({'plain':!![]});var _0x363fbc=_0xc1c7('0x2a');return db[_0xc1c7('0x2b')][_0xc1c7('0x28')]({'where':{'type':_0x363fbc,'resourceId':_0x1540c1['id']}})[_0xc1c7('0x27')](function(){return _0x3180fd;});})['then'](function(){_0x2e64c4[_0xc1c7('0x1c')](0xcc)[_0xc1c7('0x1d')]();});}};}function handleEntityNotFound(_0x4e1721,_0x52a1d5){return function(_0x352f24){if(!_0x352f24){_0x4e1721['sendStatus'](0x194);}return _0x352f24;};}function handleError(_0x544fbb,_0x541f12){_0x541f12=_0x541f12||0x1f4;return function(_0x1b873c){logger[_0xc1c7('0x2c')](_0x1b873c[_0xc1c7('0x2d')]);if(_0x1b873c[_0xc1c7('0x2e')]){delete _0x1b873c['name'];}_0x544fbb['status'](_0x541f12)[_0xc1c7('0x2f')](_0x1b873c);};}exports[_0xc1c7('0x30')]=function(_0x9a0ab3,_0x3a786f){var _0x2e35f1={},_0x4968b0={},_0x50042f={'count':0x0,'rows':[]};var _0x125920=_[_0xc1c7('0x31')](db['VoiceMail'][_0xc1c7('0x32')],function(_0x3cf425){return{'name':_0x3cf425[_0xc1c7('0x33')],'type':_0x3cf425[_0xc1c7('0x34')][_0xc1c7('0x35')]};});_0x4968b0[_0xc1c7('0x36')]=_[_0xc1c7('0x31')](_0x125920,'name');_0x4968b0[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x9a0ab3[_0xc1c7('0x37')]);_0x4968b0[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x4968b0[_0xc1c7('0x36')],_0x4968b0[_0xc1c7('0x37')]);_0x2e35f1[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4968b0['model'],qs['fields'](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x2e35f1[_0xc1c7('0x3b')]=_0x2e35f1[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x2e35f1[_0xc1c7('0x3b')]:_0x4968b0[_0xc1c7('0x36')];if(!_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x2e35f1[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x2e35f1[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x2e35f1[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x9a0ab3[_0xc1c7('0x37')]['sort']);_0x2e35f1['where']=qs['filters'](_[_0xc1c7('0x42')](_0x9a0ab3['query'],_0x4968b0['filters']),_0x125920);if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x2e35f1[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x2e35f1['where'],{'$or':_[_0xc1c7('0x31')](_0x125920,function(_0x25e005){if(_0x25e005[_0xc1c7('0x34')]!==_0xc1c7('0x46')){var _0x1a395c={};_0x1a395c[_0x25e005[_0xc1c7('0x2e')]]={'$like':'%'+_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x1a395c;}})});}_0x2e35f1=_[_0xc1c7('0x45')]({},_0x2e35f1,_0x9a0ab3[_0xc1c7('0x47')]);var _0x955ba6={'where':_0x2e35f1[_0xc1c7('0x44')]};return db[_0xc1c7('0x48')]['count'](_0x955ba6)[_0xc1c7('0x27')](function(_0x412520){_0x50042f['count']=_0x412520;if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x2e35f1[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x48')][_0xc1c7('0x4b')](_0x2e35f1);})[_0xc1c7('0x27')](function(_0xd5e06a){_0x50042f[_0xc1c7('0x4c')]=_0xd5e06a;return _0x50042f;})[_0xc1c7('0x27')](respondWithFilteredResult(_0x3a786f,_0x2e35f1))[_0xc1c7('0x4d')](handleError(_0x3a786f,null));};exports['show']=function(_0x14b61f,_0x16fbf5){var _0x519665={'raw':!![],'where':{'id':_0x14b61f[_0xc1c7('0x4e')]['id']}},_0x4c6834={};_0x4c6834[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db[_0xc1c7('0x48')][_0xc1c7('0x32')]);_0x4c6834['query']=_[_0xc1c7('0x38')](_0x14b61f[_0xc1c7('0x37')]);_0x4c6834['filters']=_['intersection'](_0x4c6834['model'],_0x4c6834[_0xc1c7('0x37')]);_0x519665[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4c6834['model'],qs[_0xc1c7('0x3c')](_0x14b61f[_0xc1c7('0x37')]['fields']));_0x519665[_0xc1c7('0x3b')]=_0x519665[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x519665[_0xc1c7('0x3b')]:_0x4c6834[_0xc1c7('0x36')];if(_0x14b61f[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x519665[_0xc1c7('0x4a')]=[{'all':!![]}];}_0x519665=_[_0xc1c7('0x45')]({},_0x519665,_0x14b61f[_0xc1c7('0x47')]);return db[_0xc1c7('0x48')][_0xc1c7('0x4f')](_0x519665)[_0xc1c7('0x27')](handleEntityNotFound(_0x16fbf5,null))[_0xc1c7('0x27')](respondWithResult(_0x16fbf5,null))[_0xc1c7('0x4d')](handleError(_0x16fbf5,null));};exports[_0xc1c7('0x50')]=function(_0x2967b7,_0x1addc8){return db['VoiceMail'][_0xc1c7('0x50')](_0x2967b7['body'],{})[_0xc1c7('0x27')](function(_0x23f42f){var _0x2840a3=_0x2967b7['user'][_0xc1c7('0x29')]({'plain':!![]});if(!_0x2840a3)throw new Error(_0xc1c7('0x51'));if(_0x2840a3['role']==='user'){var _0x5c96cc=_0x23f42f[_0xc1c7('0x29')]({'plain':!![]});var _0x415416='Voicemails';return db[_0xc1c7('0x52')][_0xc1c7('0x4f')]({'where':{'name':_0x415416,'userProfileId':_0x2840a3[_0xc1c7('0x53')]},'raw':!![]})[_0xc1c7('0x27')](function(_0x37374c){if(_0x37374c&&_0x37374c[_0xc1c7('0x54')]===0x0){return db['UserProfileResource'][_0xc1c7('0x50')]({'name':_0x5c96cc['name'],'resourceId':_0x5c96cc['id'],'type':_0x37374c[_0xc1c7('0x2e')],'sectionId':_0x37374c['id']},{})[_0xc1c7('0x27')](function(){return _0x23f42f;});}else{return _0x23f42f;}})[_0xc1c7('0x4d')](function(_0x557cb6){logger[_0xc1c7('0x2c')](_0xc1c7('0x55'),_0x557cb6);throw _0x557cb6;});}return _0x23f42f;})[_0xc1c7('0x27')](respondWithResult(_0x1addc8,0xc9))[_0xc1c7('0x4d')](handleError(_0x1addc8,null));};exports[_0xc1c7('0x26')]=function(_0x45dfa2,_0x1dc39f){if(_0x45dfa2[_0xc1c7('0x56')]['id']){delete _0x45dfa2['body']['id'];}return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x45dfa2[_0xc1c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1dc39f,null))['then'](saveUpdates(_0x45dfa2[_0xc1c7('0x56')],null))[_0xc1c7('0x27')](respondWithResult(_0x1dc39f,null))[_0xc1c7('0x4d')](handleError(_0x1dc39f,null));};exports['destroy']=function(_0x1c636c,_0x48304a){return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x1c636c[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x48304a,null))[_0xc1c7('0x27')](removeEntity(_0x48304a,null))[_0xc1c7('0x4d')](handleError(_0x48304a,null));};exports[_0xc1c7('0x57')]=function(_0x4df2f8,_0x11c116,_0x2ad2d5){return db[_0xc1c7('0x48')]['findOne']({'where':{'id':_0x4df2f8[_0xc1c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x11c116,null))[_0xc1c7('0x27')](function(_0x528986){var _0x39d3e2;var _0x212d53={},_0x314232={};_0x314232[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db['VoiceMailMessage']['rawAttributes']);_0x314232['query']=_[_0xc1c7('0x38')](_0x4df2f8[_0xc1c7('0x37')]);_0x314232[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x314232[_0xc1c7('0x36')],_0x314232[_0xc1c7('0x37')]);_0x212d53['attributes']=_[_0xc1c7('0x3a')](_0x314232[_0xc1c7('0x36')],qs[_0xc1c7('0x3c')](_0x4df2f8[_0xc1c7('0x37')]['fields']));_0x212d53[_0xc1c7('0x3b')]=_0x212d53[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x212d53['attributes']:_0x314232[_0xc1c7('0x36')];if(!_0x4df2f8[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x212d53['limit']=qs['limit'](_0x4df2f8[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x212d53['offset']=qs[_0xc1c7('0x22')](_0x4df2f8[_0xc1c7('0x37')]['offset']);}_0x212d53[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x4df2f8['query'][_0xc1c7('0x41')]);_0x212d53[_0xc1c7('0x44')]=qs[_0xc1c7('0x39')](_[_0xc1c7('0x42')](_0x4df2f8[_0xc1c7('0x37')],_0x314232[_0xc1c7('0x39')]));if(_0x4df2f8[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x212d53[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x212d53[_0xc1c7('0x44')],{'$or':_[_0xc1c7('0x31')](_0x212d53[_0xc1c7('0x3b')],function(_0x3c9ffe){var _0x342fc8={};_0x342fc8[_0x3c9ffe]={'$like':'%'+_0x4df2f8[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x342fc8;})});}_0x212d53[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x212d53[_0xc1c7('0x44')],{'mailboxuser':_0x528986[_0xc1c7('0x58')]});_0x212d53=_[_0xc1c7('0x45')]({},_0x212d53,_0x4df2f8[_0xc1c7('0x47')]);return db[_0xc1c7('0x59')][_0xc1c7('0x5a')](_0x212d53)[_0xc1c7('0x27')](respondWithFilteredResult(_0x11c116,_0x212d53));})[_0xc1c7('0x4d')](handleError(_0x11c116,null));}; \ No newline at end of file +var _0xb10b=['attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','type','merge','options','VoiceMail','include','findAll','rows','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Voicemails','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','rawAttributes','mailbox','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','end','error','stack','name','send','map','fieldName','key','model','query','keys','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb10b,0x12a));var _0xbb10=function(_0x137815,_0x78dd4b){_0x137815=_0x137815-0x0;var _0x29ded1=_0xb10b[_0x137815];return _0x29ded1;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){var _0x3ba6cd=_0x436104[_0xbb10('0x25')]({'plain':!![]});var _0x537898='Voicemails';return db['UserProfileResource'][_0xbb10('0x24')]({'where':{'type':_0x537898,'resourceId':_0x3ba6cd['id']}})[_0xbb10('0x23')](function(){return _0x436104;});})[_0xbb10('0x23')](function(){_0x1824b7['status'](0xcc)[_0xbb10('0x26')]();});}};}function handleEntityNotFound(_0x24d586,_0x6ed43b){return function(_0x1d5e95){if(!_0x1d5e95){_0x24d586[_0xbb10('0x18')](0x194);}return _0x1d5e95;};}function handleError(_0x20d946,_0x2a0e8b){_0x2a0e8b=_0x2a0e8b||0x1f4;return function(_0x4aabb9){logger[_0xbb10('0x27')](_0x4aabb9[_0xbb10('0x28')]);if(_0x4aabb9[_0xbb10('0x29')]){delete _0x4aabb9[_0xbb10('0x29')];}_0x20d946[_0xbb10('0x19')](_0x2a0e8b)[_0xbb10('0x2a')](_0x4aabb9);};}exports['index']=function(_0x221624,_0x4ee02e){var _0x448d5c={},_0x56f2da={},_0x16ad2a={'count':0x0,'rows':[]};var _0x1dcc9c=_[_0xbb10('0x2b')](db['VoiceMail']['rawAttributes'],function(_0x4c3744){return{'name':_0x4c3744[_0xbb10('0x2c')],'type':_0x4c3744['type'][_0xbb10('0x2d')]};});_0x56f2da[_0xbb10('0x2e')]=_[_0xbb10('0x2b')](_0x1dcc9c,_0xbb10('0x29'));_0x56f2da[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x221624[_0xbb10('0x2f')]);_0x56f2da['filters']=_[_0xbb10('0x31')](_0x56f2da[_0xbb10('0x2e')],_0x56f2da[_0xbb10('0x2f')]);_0x448d5c[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x56f2da[_0xbb10('0x2e')],qs[_0xbb10('0x33')](_0x221624[_0xbb10('0x2f')][_0xbb10('0x33')]));_0x448d5c['attributes']=_0x448d5c[_0xbb10('0x32')][_0xbb10('0x34')]?_0x448d5c[_0xbb10('0x32')]:_0x56f2da[_0xbb10('0x2e')];if(!_0x221624['query'][_0xbb10('0x35')]('nolimit')){_0x448d5c['limit']=qs[_0xbb10('0x1c')](_0x221624[_0xbb10('0x2f')][_0xbb10('0x1c')]);_0x448d5c[_0xbb10('0x1b')]=qs[_0xbb10('0x1b')](_0x221624[_0xbb10('0x2f')]['offset']);}_0x448d5c[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x221624['query']['sort']);_0x448d5c['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x39')](_0x221624[_0xbb10('0x2f')],_0x56f2da['filters']),_0x1dcc9c);if(_0x221624[_0xbb10('0x2f')][_0xbb10('0x3a')]){_0x448d5c[_0xbb10('0x3b')]=_['merge'](_0x448d5c[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x2b')](_0x1dcc9c,function(_0x1dcd38){if(_0x1dcd38[_0xbb10('0x3c')]!=='VIRTUAL'){var _0xd238e9={};_0xd238e9[_0x1dcd38[_0xbb10('0x29')]]={'$like':'%'+_0x221624['query'][_0xbb10('0x3a')]+'%'};return _0xd238e9;}})});}_0x448d5c=_[_0xbb10('0x3d')]({},_0x448d5c,_0x221624[_0xbb10('0x3e')]);var _0x3a9934={'where':_0x448d5c[_0xbb10('0x3b')]};return db[_0xbb10('0x3f')]['count'](_0x3a9934)[_0xbb10('0x23')](function(_0x1c7fae){_0x16ad2a[_0xbb10('0x1e')]=_0x1c7fae;if(_0x221624[_0xbb10('0x2f')]['includeAll']){_0x448d5c[_0xbb10('0x40')]=[{'all':!![]}];}return db[_0xbb10('0x3f')][_0xbb10('0x41')](_0x448d5c);})[_0xbb10('0x23')](function(_0x5e2cfa){_0x16ad2a[_0xbb10('0x42')]=_0x5e2cfa;return _0x16ad2a;})[_0xbb10('0x23')](respondWithFilteredResult(_0x4ee02e,_0x448d5c))['catch'](handleError(_0x4ee02e,null));};exports['show']=function(_0x38d78f,_0x4a3ddf){var _0x318984={'raw':!![],'where':{'id':_0x38d78f['params']['id']}},_0x180933={};_0x180933[_0xbb10('0x2e')]=_[_0xbb10('0x30')](db[_0xbb10('0x3f')]['rawAttributes']);_0x180933[_0xbb10('0x2f')]=_[_0xbb10('0x30')](_0x38d78f[_0xbb10('0x2f')]);_0x180933[_0xbb10('0x38')]=_[_0xbb10('0x31')](_0x180933[_0xbb10('0x2e')],_0x180933[_0xbb10('0x2f')]);_0x318984[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x180933[_0xbb10('0x2e')],qs[_0xbb10('0x33')](_0x38d78f[_0xbb10('0x2f')]['fields']));_0x318984[_0xbb10('0x32')]=_0x318984[_0xbb10('0x32')]['length']?_0x318984[_0xbb10('0x32')]:_0x180933[_0xbb10('0x2e')];if(_0x38d78f[_0xbb10('0x2f')][_0xbb10('0x43')]){_0x318984[_0xbb10('0x40')]=[{'all':!![]}];}_0x318984=_[_0xbb10('0x3d')]({},_0x318984,_0x38d78f[_0xbb10('0x3e')]);return db['VoiceMail']['find'](_0x318984)[_0xbb10('0x23')](handleEntityNotFound(_0x4a3ddf,null))[_0xbb10('0x23')](respondWithResult(_0x4a3ddf,null))[_0xbb10('0x44')](handleError(_0x4a3ddf,null));};exports['create']=function(_0x5f0c12,_0x3cd6f3){return db[_0xbb10('0x3f')][_0xbb10('0x45')](_0x5f0c12[_0xbb10('0x46')],{})[_0xbb10('0x23')](function(_0x22b315){var _0x2f2552=_0x5f0c12[_0xbb10('0x47')][_0xbb10('0x25')]({'plain':!![]});if(!_0x2f2552)throw new Error(_0xbb10('0x48'));if(_0x2f2552['role']==='user'){var _0x412e13=_0x22b315[_0xbb10('0x25')]({'plain':!![]});var _0x36ab7d=_0xbb10('0x49');return db[_0xbb10('0x4a')][_0xbb10('0x4b')]({'where':{'name':_0x36ab7d,'userProfileId':_0x2f2552[_0xbb10('0x4c')]},'raw':!![]})[_0xbb10('0x23')](function(_0x1c0d8f){if(_0x1c0d8f&&_0x1c0d8f[_0xbb10('0x4d')]===0x0){return db[_0xbb10('0x4e')][_0xbb10('0x45')]({'name':_0x412e13[_0xbb10('0x29')],'resourceId':_0x412e13['id'],'type':_0x1c0d8f[_0xbb10('0x29')],'sectionId':_0x1c0d8f['id']},{})[_0xbb10('0x23')](function(){return _0x22b315;});}else{return _0x22b315;}})['catch'](function(_0x124052){logger['error'](_0xbb10('0x4f'),_0x124052);throw _0x124052;});}return _0x22b315;})[_0xbb10('0x23')](respondWithResult(_0x3cd6f3,0xc9))[_0xbb10('0x44')](handleError(_0x3cd6f3,null));};exports[_0xbb10('0x22')]=function(_0x26e66e,_0x32d8e9){if(_0x26e66e[_0xbb10('0x46')]['id']){delete _0x26e66e[_0xbb10('0x46')]['id'];}return db[_0xbb10('0x3f')][_0xbb10('0x4b')]({'where':{'id':_0x26e66e[_0xbb10('0x50')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x32d8e9,null))[_0xbb10('0x23')](saveUpdates(_0x26e66e[_0xbb10('0x46')],null))[_0xbb10('0x23')](respondWithResult(_0x32d8e9,null))['catch'](handleError(_0x32d8e9,null));};exports[_0xbb10('0x24')]=function(_0x466eb7,_0x1b83a9){return db[_0xbb10('0x3f')][_0xbb10('0x4b')]({'where':{'id':_0x466eb7[_0xbb10('0x50')]['id']}})['then'](handleEntityNotFound(_0x1b83a9,null))[_0xbb10('0x23')](removeEntity(_0x1b83a9,null))[_0xbb10('0x44')](handleError(_0x1b83a9,null));};exports[_0xbb10('0x51')]=function(_0x14fed3,_0x432728,_0x22de7f){return db[_0xbb10('0x3f')][_0xbb10('0x52')]({'where':{'id':_0x14fed3[_0xbb10('0x50')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x432728,null))[_0xbb10('0x23')](function(_0x2a1ce1){var _0x16932f;var _0x4e7fac={},_0x4ea1a6={};_0x4ea1a6[_0xbb10('0x2e')]=_[_0xbb10('0x30')](db[_0xbb10('0x53')][_0xbb10('0x54')]);_0x4ea1a6['query']=_['keys'](_0x14fed3[_0xbb10('0x2f')]);_0x4ea1a6[_0xbb10('0x38')]=_[_0xbb10('0x31')](_0x4ea1a6[_0xbb10('0x2e')],_0x4ea1a6[_0xbb10('0x2f')]);_0x4e7fac[_0xbb10('0x32')]=_[_0xbb10('0x31')](_0x4ea1a6['model'],qs[_0xbb10('0x33')](_0x14fed3[_0xbb10('0x2f')]['fields']));_0x4e7fac['attributes']=_0x4e7fac['attributes'][_0xbb10('0x34')]?_0x4e7fac[_0xbb10('0x32')]:_0x4ea1a6[_0xbb10('0x2e')];if(!_0x14fed3['query']['hasOwnProperty']('nolimit')){_0x4e7fac[_0xbb10('0x1c')]=qs[_0xbb10('0x1c')](_0x14fed3[_0xbb10('0x2f')]['limit']);_0x4e7fac[_0xbb10('0x1b')]=qs[_0xbb10('0x1b')](_0x14fed3['query']['offset']);}_0x4e7fac[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x14fed3[_0xbb10('0x2f')][_0xbb10('0x37')]);_0x4e7fac['where']=qs[_0xbb10('0x38')](_[_0xbb10('0x39')](_0x14fed3[_0xbb10('0x2f')],_0x4ea1a6['filters']));if(_0x14fed3[_0xbb10('0x2f')][_0xbb10('0x3a')]){_0x4e7fac[_0xbb10('0x3b')]=_['merge'](_0x4e7fac[_0xbb10('0x3b')],{'$or':_[_0xbb10('0x2b')](_0x4e7fac[_0xbb10('0x32')],function(_0x37b65f){var _0x5e4a6e={};_0x5e4a6e[_0x37b65f]={'$like':'%'+_0x14fed3[_0xbb10('0x2f')][_0xbb10('0x3a')]+'%'};return _0x5e4a6e;})});}_0x4e7fac[_0xbb10('0x3b')]=_[_0xbb10('0x3d')](_0x4e7fac['where'],{'mailboxuser':_0x2a1ce1[_0xbb10('0x55')]});_0x4e7fac=_[_0xbb10('0x3d')]({},_0x4e7fac,_0x14fed3[_0xbb10('0x3e')]);return db[_0xbb10('0x53')][_0xbb10('0x56')](_0x4e7fac)[_0xbb10('0x23')](respondWithFilteredResult(_0x432728,_0x4e7fac));})[_0xbb10('0x44')](handleError(_0x432728,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index ff3795c..5faeeb9 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 _0x15b9=['voice_voicemail','mailbox_context','mailbox','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x53a570,_0x486c44){var _0x111110=function(_0x3816ed){while(--_0x3816ed){_0x53a570['push'](_0x53a570['shift']());}};_0x111110(++_0x486c44);}(_0x15b9,0x143));var _0x915b=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0x15b9[_0x179b53];return _0x38a146;};'use strict';var _=require(_0x915b('0x0'));var util=require(_0x915b('0x1'));var logger=require(_0x915b('0x2'))(_0x915b('0x3'));var moment=require(_0x915b('0x4'));var BPromise=require(_0x915b('0x5'));var rp=require(_0x915b('0x6'));var fs=require('fs');var path=require(_0x915b('0x7'));var rimraf=require(_0x915b('0x8'));var config=require(_0x915b('0x9'));var attributes=require(_0x915b('0xa'));module[_0x915b('0xb')]=function(_0x183ddc,_0x39a99a){return _0x183ddc[_0x915b('0xc')]('VoiceMail',attributes,{'tableName':_0x915b('0xd'),'paranoid':![],'indexes':[{'name':_0x915b('0xe'),'fields':[_0x915b('0xf'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2e6=['define','VoiceMail','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x2c47fc,_0x2f4350){var _0x34eb23=function(_0x5e9a9f){while(--_0x5e9a9f){_0x2c47fc['push'](_0x2c47fc['shift']());}};_0x34eb23(++_0x2f4350);}(_0xf2e6,0xd4));var _0x6f2e=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xf2e6[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x6f2e('0x0'));var util=require(_0x6f2e('0x1'));var logger=require(_0x6f2e('0x2'))(_0x6f2e('0x3'));var moment=require(_0x6f2e('0x4'));var BPromise=require(_0x6f2e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6f2e('0x6'));var config=require(_0x6f2e('0x7'));var attributes=require(_0x6f2e('0x8'));module['exports']=function(_0xa71050,_0x477983){return _0xa71050[_0x6f2e('0x9')](_0x6f2e('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x6f2e('0xb'),_0x6f2e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 8661bf7..b763834 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 _0xda97=['../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x17c405,_0x205780){var _0x86d737=function(_0x5d89f8){while(--_0x5d89f8){_0x17c405['push'](_0x17c405['shift']());}};_0x86d737(++_0x205780);}(_0xda97,0x8c));var _0x7da9=function(_0x1e8117,_0x3c5377){_0x1e8117=_0x1e8117-0x0;var _0x682722=_0xda97[_0x1e8117];return _0x682722;};'use strict';var _=require(_0x7da9('0x0'));var util=require(_0x7da9('0x1'));var moment=require(_0x7da9('0x2'));var BPromise=require(_0x7da9('0x3'));var rs=require(_0x7da9('0x4'));var fs=require('fs');var Redis=require(_0x7da9('0x5'));var db=require(_0x7da9('0x6'))['db'];var utils=require(_0x7da9('0x7'));var logger=require(_0x7da9('0x8'))(_0x7da9('0x9'));var config=require(_0x7da9('0xa'));var jayson=require(_0x7da9('0xb'));var client=jayson['client'][_0x7da9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x351b02,_0x1d1398,_0x3f478d){return new BPromise(function(_0x447303,_0x2c5cf1){return client[_0x7da9('0xd')](_0x351b02,_0x3f478d)[_0x7da9('0xe')](function(_0x2a995b){logger[_0x7da9('0xf')](_0x7da9('0x10'),_0x1d1398,_0x7da9('0x11'));logger[_0x7da9('0x12')](_0x7da9('0x13'),_0x1d1398,'request\x20sent',JSON[_0x7da9('0x14')](_0x2a995b));if(_0x2a995b[_0x7da9('0x15')]){if(_0x2a995b['error'][_0x7da9('0x16')]===0x1f4){logger[_0x7da9('0x15')]('VoiceMail,\x20%s,\x20%s',_0x1d1398,_0x2a995b[_0x7da9('0x15')][_0x7da9('0x17')]);return _0x2c5cf1(_0x2a995b[_0x7da9('0x15')][_0x7da9('0x17')]);}logger['error'](_0x7da9('0x10'),_0x1d1398,_0x2a995b[_0x7da9('0x15')][_0x7da9('0x17')]);return _0x447303(_0x2a995b[_0x7da9('0x15')][_0x7da9('0x17')]);}else{logger[_0x7da9('0xf')]('VoiceMail,\x20%s,\x20%s',_0x1d1398,_0x7da9('0x11'));_0x447303(_0x2a995b[_0x7da9('0x18')][_0x7da9('0x17')]);}})['catch'](function(_0x45151e){logger['error'](_0x7da9('0x10'),_0x1d1398,_0x45151e);_0x2c5cf1(_0x45151e);});});} \ No newline at end of file +var _0xc06a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5532a6,_0x10cda6){var _0x105d60=function(_0x269cdb){while(--_0x269cdb){_0x5532a6['push'](_0x5532a6['shift']());}};_0x105d60(++_0x10cda6);}(_0xc06a,0xcc));var _0xac06=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc06a[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xac06('0x0'));var util=require(_0xac06('0x1'));var moment=require(_0xac06('0x2'));var BPromise=require(_0xac06('0x3'));var rs=require(_0xac06('0x4'));var fs=require('fs');var Redis=require(_0xac06('0x5'));var db=require(_0xac06('0x6'))['db'];var utils=require(_0xac06('0x7'));var logger=require(_0xac06('0x8'))(_0xac06('0x9'));var config=require(_0xac06('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xac06('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x252a8e,_0x23cd40,_0x452e76){return new BPromise(function(_0x12df2d,_0x464f49){return client[_0xac06('0xc')](_0x252a8e,_0x452e76)['then'](function(_0x3e6f3f){logger['info'](_0xac06('0xd'),_0x23cd40,'request\x20sent');logger[_0xac06('0xe')](_0xac06('0xf'),_0x23cd40,_0xac06('0x10'),JSON['stringify'](_0x3e6f3f));if(_0x3e6f3f[_0xac06('0x11')]){if(_0x3e6f3f[_0xac06('0x11')]['code']===0x1f4){logger['error'](_0xac06('0xd'),_0x23cd40,_0x3e6f3f['error'][_0xac06('0x12')]);return _0x464f49(_0x3e6f3f[_0xac06('0x11')]['message']);}logger[_0xac06('0x11')](_0xac06('0xd'),_0x23cd40,_0x3e6f3f[_0xac06('0x11')][_0xac06('0x12')]);return _0x12df2d(_0x3e6f3f[_0xac06('0x11')]['message']);}else{logger[_0xac06('0x13')](_0xac06('0xd'),_0x23cd40,_0xac06('0x10'));_0x12df2d(_0x3e6f3f['result'][_0xac06('0x12')]);}})[_0xac06('0x14')](function(_0xfa8d83){logger[_0xac06('0x11')](_0xac06('0xd'),_0x23cd40,_0xfa8d83);_0x464f49(_0xfa8d83);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index a38a7c4..0fba713 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 _0x52bf=['exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','update','delete'];(function(_0x1d5ffe,_0x541ec3){var _0x2e33ea=function(_0x5c227f){while(--_0x5c227f){_0x1d5ffe['push'](_0x1d5ffe['shift']());}};_0x2e33ea(++_0x541ec3);}(_0x52bf,0xe5));var _0xf52b=function(_0xabb944,_0x715f89){_0xabb944=_0xabb944-0x0;var _0x58a20d=_0x52bf[_0xabb944];return _0x58a20d;};'use strict';var multer=require(_0xf52b('0x0'));var util=require('util');var path=require(_0xf52b('0x1'));var timeout=require('connect-timeout');var express=require(_0xf52b('0x2'));var router=express[_0xf52b('0x3')]();var fs_extra=require(_0xf52b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf52b('0x5'));var config=require(_0xf52b('0x6'));var controller=require(_0xf52b('0x7'));router[_0xf52b('0x8')]('/',auth[_0xf52b('0x9')](),controller[_0xf52b('0xa')]);router[_0xf52b('0x8')](_0xf52b('0xb'),auth[_0xf52b('0x9')](),controller[_0xf52b('0xc')]);router[_0xf52b('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xf52b('0xd')]);router[_0xf52b('0xe')]('/',auth[_0xf52b('0x9')](),controller[_0xf52b('0xf')]);router['put'](_0xf52b('0xb'),auth[_0xf52b('0x9')](),controller[_0xf52b('0x10')]);router[_0xf52b('0x11')]('/:id',auth[_0xf52b('0x9')](),controller['destroy']);module[_0xf52b('0x12')]=router; \ No newline at end of file +var _0xdb09=['put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','/:id/download','post','create'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xdb09,0xba));var _0x9db0=function(_0x3c2efd,_0x405f28){_0x3c2efd=_0x3c2efd-0x0;var _0x433b01=_0xdb09[_0x3c2efd];return _0x433b01;};'use strict';var multer=require('multer');var util=require(_0x9db0('0x0'));var path=require(_0x9db0('0x1'));var timeout=require(_0x9db0('0x2'));var express=require(_0x9db0('0x3'));var router=express[_0x9db0('0x4')]();var fs_extra=require(_0x9db0('0x5'));var auth=require(_0x9db0('0x6'));var interaction=require(_0x9db0('0x7'));var config=require('../../config/environment');var controller=require(_0x9db0('0x8'));router[_0x9db0('0x9')]('/',auth[_0x9db0('0xa')](),controller['index']);router[_0x9db0('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x9db0('0xb'),auth['isAuthenticated'](),controller['download']);router[_0x9db0('0xc')]('/',auth[_0x9db0('0xa')](),controller[_0x9db0('0xd')]);router[_0x9db0('0xe')](_0x9db0('0xf'),auth[_0x9db0('0xa')](),controller[_0x9db0('0x10')]);router[_0x9db0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9db0('0x12')]);module[_0x9db0('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index f654d5a..b0187a7 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 _0xe640=['INTEGER','STRING','BLOB','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue'];(function(_0x3090d6,_0x23625f){var _0x3a2e00=function(_0x42d6fd){while(--_0x42d6fd){_0x3090d6['push'](_0x3090d6['shift']());}};_0x3a2e00(++_0x23625f);}(_0xe640,0x1ad));var _0x0e64=function(_0x5f17c4,_0x23458c){_0x5f17c4=_0x5f17c4-0x0;var _0x57752e=_0xe640[_0x5f17c4];return _0x57752e;};'use strict';var Sequelize=require(_0x0e64('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e64('0x1')],'get':function(_0x270480){return this[_0x0e64('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x0e64('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x0e64('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0e64('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x0e64('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x0e64('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x0e64('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0e64('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x0e64('0x5')](_0x0e64('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x0e64('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x0e64('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x0e64('0x7')](_0x0e64('0x8'))}}; \ No newline at end of file +var _0x9866=['TIMESTAMP','literal','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0x9866,0x1c4));var _0x6986=function(_0x442e9c,_0xf988d0){_0x442e9c=_0x442e9c-0x0;var _0x2e9668=_0x9866[_0x442e9c];return _0x2e9668;};'use strict';var Sequelize=require(_0x6986('0x0'));module[_0x6986('0x1')]={'name':{'type':Sequelize[_0x6986('0x2')],'get':function(_0x1dfe66){return this[_0x6986('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x6986('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6986('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x6986('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6986('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x6986('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6986('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6986('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x6986('0x6')](_0x6986('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x6986('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6986('0x5')],'defaultValue':''},'stamp':{'type':_0x6986('0x8'),'defaultValue':Sequelize[_0x6986('0x9')]('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 496e694..3663f7a 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 _0x1d1c=['set','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','keys','find','create','body','params','download','recording','msg_id','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','limit'];(function(_0x160dcb,_0x3451b5){var _0x2ce20a=function(_0x1dbb76){while(--_0x1dbb76){_0x160dcb['push'](_0x160dcb['shift']());}};_0x2ce20a(++_0x3451b5);}(_0x1d1c,0x13b));var _0xc1d1=function(_0xaf04cf,_0x309415){_0xaf04cf=_0xaf04cf-0x0;var _0x46dcf7=_0x1d1c[_0xaf04cf];return _0x46dcf7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc1d1('0x0'));var jsonpatch=require(_0xc1d1('0x1'));var rp=require(_0xc1d1('0x2'));var moment=require(_0xc1d1('0x3'));var BPromise=require(_0xc1d1('0x4'));var Mustache=require(_0xc1d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc1d1('0x6'));var csv=require(_0xc1d1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1d1('0x8'));var _=require('lodash');var squel=require(_0xc1d1('0x9'));var crypto=require(_0xc1d1('0xa'));var jsforce=require(_0xc1d1('0xb'));var deskjs=require(_0xc1d1('0xc'));var toCsv=require(_0xc1d1('0x7'));var querystring=require(_0xc1d1('0xd'));var Papa=require(_0xc1d1('0xe'));var Redis=require(_0xc1d1('0xf'));var authService=require(_0xc1d1('0x10'));var qs=require(_0xc1d1('0x11'));var as=require(_0xc1d1('0x12'));var hardwareService=require(_0xc1d1('0x13'));var logger=require(_0xc1d1('0x14'))(_0xc1d1('0x15'));var utils=require(_0xc1d1('0x16'));var config=require(_0xc1d1('0x17'));var licenseUtil=require(_0xc1d1('0x18'));var db=require(_0xc1d1('0x19'))['db'];function respondWithStatusCode(_0x10d4ca,_0x79f220){_0x79f220=_0x79f220||0xcc;return function(_0x15e6ee){if(_0x15e6ee){return _0x10d4ca[_0xc1d1('0x1a')](_0x79f220);}return _0x10d4ca[_0xc1d1('0x1b')](_0x79f220)[_0xc1d1('0x1c')]();};}function respondWithResult(_0x531f22,_0x5aa4c7){_0x5aa4c7=_0x5aa4c7||0xc8;return function(_0x538c35){if(_0x538c35){return _0x531f22[_0xc1d1('0x1b')](_0x5aa4c7)[_0xc1d1('0x1d')](_0x538c35);}};}function respondWithFilteredResult(_0x5de153,_0x25d4b6){return function(_0x1e98c4){if(_0x1e98c4){var _0x51ac72=typeof _0x25d4b6['offset']===_0xc1d1('0x1e')&&typeof _0x25d4b6['limit']===_0xc1d1('0x1e');var _0x500e28=_0x1e98c4[_0xc1d1('0x1f')];var _0x122380=_0x51ac72?0x0:_0x25d4b6['offset'];var _0x473304=_0x51ac72?_0x1e98c4[_0xc1d1('0x1f')]:_0x25d4b6['offset']+_0x25d4b6[_0xc1d1('0x20')];var _0x91daea;if(_0x473304>=_0x500e28){_0x473304=_0x500e28;_0x91daea=0xc8;}else{_0x91daea=0xce;}_0x5de153[_0xc1d1('0x1b')](_0x91daea);return _0x5de153[_0xc1d1('0x21')]('Content-Range',_0x122380+'-'+_0x473304+'/'+_0x500e28)[_0xc1d1('0x1d')](_0x1e98c4);}return null;};}function patchUpdates(_0x141ed5){return function(_0x2defaa){try{jsonpatch[_0xc1d1('0x22')](_0x2defaa,_0x141ed5,!![]);}catch(_0x103615){return BPromise[_0xc1d1('0x23')](_0x103615);}return _0x2defaa[_0xc1d1('0x24')]();};}function saveUpdates(_0x251905,_0x11a761){return function(_0x267128){if(_0x267128){return _0x267128[_0xc1d1('0x25')](_0x251905)[_0xc1d1('0x26')](function(_0x217b05){return _0x217b05;});}return null;};}function removeEntity(_0x2d8244,_0x3fc6a2){return function(_0x4aa9bd){if(_0x4aa9bd){return _0x4aa9bd[_0xc1d1('0x27')]()[_0xc1d1('0x26')](function(){_0x2d8244[_0xc1d1('0x1b')](0xcc)[_0xc1d1('0x1c')]();});}};}function handleEntityNotFound(_0x50b88a,_0x133bef){return function(_0x1bdbbf){if(!_0x1bdbbf){_0x50b88a['sendStatus'](0x194);}return _0x1bdbbf;};}function handleError(_0x4c0444,_0x223f8d){_0x223f8d=_0x223f8d||0x1f4;return function(_0x5ca10d){logger[_0xc1d1('0x28')](_0x5ca10d[_0xc1d1('0x29')]);if(_0x5ca10d[_0xc1d1('0x2a')]){delete _0x5ca10d[_0xc1d1('0x2a')];}_0x4c0444[_0xc1d1('0x1b')](_0x223f8d)[_0xc1d1('0x2b')](_0x5ca10d);};}exports['index']=function(_0x55b9f6,_0x316632){var _0x735482={},_0x426cfa={},_0x57f6a4={'count':0x0,'rows':[]};var _0x4cc15d=_[_0xc1d1('0x2c')](db[_0xc1d1('0x2d')][_0xc1d1('0x2e')],function(_0x2fc6a6){return{'name':_0x2fc6a6[_0xc1d1('0x2f')],'type':_0x2fc6a6['type'][_0xc1d1('0x30')]};});_0x426cfa[_0xc1d1('0x31')]=_[_0xc1d1('0x32')](_[_0xc1d1('0x2c')](_0x4cc15d,_0xc1d1('0x2a')),[_0xc1d1('0x2a')]);_0x426cfa[_0xc1d1('0x33')]=_['keys'](_0x55b9f6[_0xc1d1('0x33')]);_0x426cfa[_0xc1d1('0x34')]=_[_0xc1d1('0x35')](_0x426cfa[_0xc1d1('0x31')],_0x426cfa[_0xc1d1('0x33')]);_0x735482['attributes']=_[_0xc1d1('0x35')](_0x426cfa['model'],qs['fields'](_0x55b9f6[_0xc1d1('0x33')][_0xc1d1('0x36')]));_0x735482[_0xc1d1('0x37')]=_0x735482[_0xc1d1('0x37')][_0xc1d1('0x38')]?_0x735482[_0xc1d1('0x37')]:_0x426cfa[_0xc1d1('0x31')];if(!_0x55b9f6[_0xc1d1('0x33')][_0xc1d1('0x39')](_0xc1d1('0x3a'))){_0x735482[_0xc1d1('0x20')]=qs['limit'](_0x55b9f6[_0xc1d1('0x33')][_0xc1d1('0x20')]);_0x735482[_0xc1d1('0x3b')]=qs['offset'](_0x55b9f6[_0xc1d1('0x33')][_0xc1d1('0x3b')]);}_0x735482['order']=qs['sort'](_0x55b9f6['query'][_0xc1d1('0x3c')]);_0x735482[_0xc1d1('0x3d')]=qs['filters'](_[_0xc1d1('0x3e')](_0x55b9f6['query'],_0x426cfa[_0xc1d1('0x34')]),_0x4cc15d);if(_0x55b9f6['query'][_0xc1d1('0x3f')]){_0x735482['where']=_['merge'](_0x735482[_0xc1d1('0x3d')],{'$or':_[_0xc1d1('0x2c')](_0x4cc15d,function(_0x4dd066){if(_0x4dd066[_0xc1d1('0x40')]!==_0xc1d1('0x41')){var _0x17c275={};_0x17c275[_0x4dd066[_0xc1d1('0x2a')]]={'$like':'%'+_0x55b9f6['query']['filter']+'%'};return _0x17c275;}})});}_0x735482=_[_0xc1d1('0x42')]({},_0x735482,_0x55b9f6[_0xc1d1('0x43')]);var _0xf008de={'where':_0x735482['where']};return db[_0xc1d1('0x2d')][_0xc1d1('0x1f')](_0xf008de)[_0xc1d1('0x26')](function(_0x403137){_0x57f6a4[_0xc1d1('0x1f')]=_0x403137;if(_0x55b9f6[_0xc1d1('0x33')][_0xc1d1('0x44')]){_0x735482[_0xc1d1('0x45')]=[{'all':!![]}];}return db[_0xc1d1('0x2d')][_0xc1d1('0x46')](_0x735482);})[_0xc1d1('0x26')](function(_0x5831c3){_0x57f6a4['rows']=_0x5831c3;return _0x57f6a4;})[_0xc1d1('0x26')](respondWithFilteredResult(_0x316632,_0x735482))[_0xc1d1('0x47')](handleError(_0x316632,null));};exports[_0xc1d1('0x48')]=function(_0x26ea39,_0x4546d4){var _0x14d5ab={'raw':!![],'where':{'id':_0x26ea39['params']['id']}},_0x2ddbc0={};_0x2ddbc0[_0xc1d1('0x31')]=_[_0xc1d1('0x49')](db[_0xc1d1('0x2d')]['rawAttributes']);_0x2ddbc0[_0xc1d1('0x33')]=_[_0xc1d1('0x49')](_0x26ea39['query']);_0x2ddbc0[_0xc1d1('0x34')]=_[_0xc1d1('0x35')](_0x2ddbc0['model'],_0x2ddbc0['query']);_0x14d5ab[_0xc1d1('0x37')]=_[_0xc1d1('0x35')](_0x2ddbc0[_0xc1d1('0x31')],qs[_0xc1d1('0x36')](_0x26ea39[_0xc1d1('0x33')][_0xc1d1('0x36')]));_0x14d5ab[_0xc1d1('0x37')]=_0x14d5ab[_0xc1d1('0x37')][_0xc1d1('0x38')]?_0x14d5ab[_0xc1d1('0x37')]:_0x2ddbc0['model'];if(_0x26ea39[_0xc1d1('0x33')][_0xc1d1('0x44')]){_0x14d5ab[_0xc1d1('0x45')]=[{'all':!![]}];}_0x14d5ab=_[_0xc1d1('0x42')]({},_0x14d5ab,_0x26ea39[_0xc1d1('0x43')]);return db['VoiceMailMessage'][_0xc1d1('0x4a')](_0x14d5ab)[_0xc1d1('0x26')](handleEntityNotFound(_0x4546d4,null))['then'](respondWithResult(_0x4546d4,null))['catch'](handleError(_0x4546d4,null));};exports[_0xc1d1('0x4b')]=function(_0x35eef2,_0x12095f){return db['VoiceMailMessage']['create'](_0x35eef2[_0xc1d1('0x4c')],{})[_0xc1d1('0x26')](respondWithResult(_0x12095f,0xc9))[_0xc1d1('0x47')](handleError(_0x12095f,null));};exports[_0xc1d1('0x25')]=function(_0x14e621,_0x190cca){if(_0x14e621[_0xc1d1('0x4c')]['id']){delete _0x14e621[_0xc1d1('0x4c')]['id'];}return db[_0xc1d1('0x2d')][_0xc1d1('0x4a')]({'where':{'id':_0x14e621['params']['id']}})[_0xc1d1('0x26')](handleEntityNotFound(_0x190cca,null))[_0xc1d1('0x26')](saveUpdates(_0x14e621['body'],null))[_0xc1d1('0x26')](respondWithResult(_0x190cca,null))[_0xc1d1('0x47')](handleError(_0x190cca,null));};exports['destroy']=function(_0x367077,_0x2429f5){return db[_0xc1d1('0x2d')][_0xc1d1('0x4a')]({'where':{'id':_0x367077[_0xc1d1('0x4d')]['id']}})[_0xc1d1('0x26')](handleEntityNotFound(_0x2429f5,null))[_0xc1d1('0x26')](removeEntity(_0x2429f5,null))['catch'](handleError(_0x2429f5,null));};exports[_0xc1d1('0x4e')]=function(_0x157112,_0x5e7bba,_0x376745){return db[_0xc1d1('0x2d')][_0xc1d1('0x4a')]({'where':{'id':_0x157112[_0xc1d1('0x4d')]['id']},'attributes':['id',_0xc1d1('0x4f'),_0xc1d1('0x50')]})['then'](handleEntityNotFound(_0x5e7bba,null))[_0xc1d1('0x26')](function(_0x452c91){if(_0x452c91){if(!_0x452c91[_0xc1d1('0x4f')]){throw new db['Sequelize'][(_0xc1d1('0x51'))]('VoiceMailMessage\x20not\x20found');}var _0x1d7668={'Content-Type':_0xc1d1('0x52'),'Content-Disposition':_0xc1d1('0x53')};if(_0x452c91[_0xc1d1('0x50')]){_0x1d7668[_0xc1d1('0x54')]=_0xc1d1('0x55')+_0x452c91['msg_id']+_0xc1d1('0x56');}_0x5e7bba[_0xc1d1('0x21')](_0x1d7668);return _0x5e7bba[_0xc1d1('0x2b')](new Buffer(_0x452c91['recording']));}})['catch'](handleError(_0x5e7bba,null));}; \ No newline at end of file +var _0xb387=['VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','rows','catch','show','find','create','body','destroy','params','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','msg_id','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','send','index'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xb387,0x1dd));var _0x7b38=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xb387[_0x238671];return _0x474844;};'use strict';var emlformat=require(_0x7b38('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b38('0x1'));var jsonpatch=require(_0x7b38('0x2'));var rp=require('request-promise');var moment=require(_0x7b38('0x3'));var BPromise=require(_0x7b38('0x4'));var Mustache=require(_0x7b38('0x5'));var util=require('util');var path=require(_0x7b38('0x6'));var sox=require(_0x7b38('0x7'));var csv=require('to-csv');var ejs=require(_0x7b38('0x8'));var fs=require('fs');var fs_extra=require(_0x7b38('0x9'));var _=require(_0x7b38('0xa'));var squel=require(_0x7b38('0xb'));var crypto=require(_0x7b38('0xc'));var jsforce=require(_0x7b38('0xd'));var deskjs=require(_0x7b38('0xe'));var toCsv=require(_0x7b38('0xf'));var querystring=require(_0x7b38('0x10'));var Papa=require(_0x7b38('0x11'));var Redis=require(_0x7b38('0x12'));var authService=require(_0x7b38('0x13'));var qs=require(_0x7b38('0x14'));var as=require(_0x7b38('0x15'));var hardwareService=require(_0x7b38('0x16'));var logger=require(_0x7b38('0x17'))('api');var utils=require(_0x7b38('0x18'));var config=require(_0x7b38('0x19'));var licenseUtil=require(_0x7b38('0x1a'));var db=require(_0x7b38('0x1b'))['db'];function respondWithStatusCode(_0x446a23,_0x3e4c9d){_0x3e4c9d=_0x3e4c9d||0xcc;return function(_0xf49a38){if(_0xf49a38){return _0x446a23[_0x7b38('0x1c')](_0x3e4c9d);}return _0x446a23[_0x7b38('0x1d')](_0x3e4c9d)[_0x7b38('0x1e')]();};}function respondWithResult(_0x53be8c,_0x487c2f){_0x487c2f=_0x487c2f||0xc8;return function(_0x564a48){if(_0x564a48){return _0x53be8c[_0x7b38('0x1d')](_0x487c2f)[_0x7b38('0x1f')](_0x564a48);}};}function respondWithFilteredResult(_0x920e34,_0x5e31a8){return function(_0x2f5689){if(_0x2f5689){var _0x28e0b8=typeof _0x5e31a8[_0x7b38('0x20')]===_0x7b38('0x21')&&typeof _0x5e31a8[_0x7b38('0x22')]===_0x7b38('0x21');var _0x417e22=_0x2f5689['count'];var _0xae39bb=_0x28e0b8?0x0:_0x5e31a8[_0x7b38('0x20')];var _0x5881b5=_0x28e0b8?_0x2f5689[_0x7b38('0x23')]:_0x5e31a8['offset']+_0x5e31a8['limit'];var _0x3c6128;if(_0x5881b5>=_0x417e22){_0x5881b5=_0x417e22;_0x3c6128=0xc8;}else{_0x3c6128=0xce;}_0x920e34[_0x7b38('0x1d')](_0x3c6128);return _0x920e34[_0x7b38('0x24')]('Content-Range',_0xae39bb+'-'+_0x5881b5+'/'+_0x417e22)[_0x7b38('0x1f')](_0x2f5689);}return null;};}function patchUpdates(_0x226779){return function(_0x19d454){try{jsonpatch['apply'](_0x19d454,_0x226779,!![]);}catch(_0x14c91e){return BPromise[_0x7b38('0x25')](_0x14c91e);}return _0x19d454[_0x7b38('0x26')]();};}function saveUpdates(_0x575dae,_0x50f606){return function(_0x3d0bc7){if(_0x3d0bc7){return _0x3d0bc7[_0x7b38('0x27')](_0x575dae)[_0x7b38('0x28')](function(_0x4209fd){return _0x4209fd;});}return null;};}function removeEntity(_0x22d90a,_0x3b33e9){return function(_0x37e997){if(_0x37e997){return _0x37e997['destroy']()[_0x7b38('0x28')](function(){_0x22d90a[_0x7b38('0x1d')](0xcc)[_0x7b38('0x1e')]();});}};}function handleEntityNotFound(_0x507e8b,_0x46fd20){return function(_0x3e3184){if(!_0x3e3184){_0x507e8b['sendStatus'](0x194);}return _0x3e3184;};}function handleError(_0x87fca0,_0x3bef87){_0x3bef87=_0x3bef87||0x1f4;return function(_0x49b428){logger[_0x7b38('0x29')](_0x49b428[_0x7b38('0x2a')]);if(_0x49b428['name']){delete _0x49b428['name'];}_0x87fca0['status'](_0x3bef87)[_0x7b38('0x2b')](_0x49b428);};}exports[_0x7b38('0x2c')]=function(_0x48fe55,_0x558d8f){var _0xb84578={},_0x3aa0b5={},_0x198b33={'count':0x0,'rows':[]};var _0x1949ca=_['map'](db[_0x7b38('0x2d')][_0x7b38('0x2e')],function(_0x41d63b){return{'name':_0x41d63b[_0x7b38('0x2f')],'type':_0x41d63b['type'][_0x7b38('0x30')]};});_0x3aa0b5[_0x7b38('0x31')]=_[_0x7b38('0x32')](_['map'](_0x1949ca,_0x7b38('0x33')),[_0x7b38('0x33')]);_0x3aa0b5[_0x7b38('0x34')]=_[_0x7b38('0x35')](_0x48fe55[_0x7b38('0x34')]);_0x3aa0b5[_0x7b38('0x36')]=_[_0x7b38('0x37')](_0x3aa0b5[_0x7b38('0x31')],_0x3aa0b5['query']);_0xb84578['attributes']=_[_0x7b38('0x37')](_0x3aa0b5[_0x7b38('0x31')],qs[_0x7b38('0x38')](_0x48fe55[_0x7b38('0x34')][_0x7b38('0x38')]));_0xb84578[_0x7b38('0x39')]=_0xb84578[_0x7b38('0x39')][_0x7b38('0x3a')]?_0xb84578[_0x7b38('0x39')]:_0x3aa0b5['model'];if(!_0x48fe55[_0x7b38('0x34')][_0x7b38('0x3b')](_0x7b38('0x3c'))){_0xb84578[_0x7b38('0x22')]=qs[_0x7b38('0x22')](_0x48fe55[_0x7b38('0x34')][_0x7b38('0x22')]);_0xb84578['offset']=qs['offset'](_0x48fe55[_0x7b38('0x34')][_0x7b38('0x20')]);}_0xb84578[_0x7b38('0x3d')]=qs['sort'](_0x48fe55[_0x7b38('0x34')][_0x7b38('0x3e')]);_0xb84578[_0x7b38('0x3f')]=qs[_0x7b38('0x36')](_['pick'](_0x48fe55[_0x7b38('0x34')],_0x3aa0b5[_0x7b38('0x36')]),_0x1949ca);if(_0x48fe55[_0x7b38('0x34')][_0x7b38('0x40')]){_0xb84578[_0x7b38('0x3f')]=_[_0x7b38('0x41')](_0xb84578[_0x7b38('0x3f')],{'$or':_[_0x7b38('0x42')](_0x1949ca,function(_0x29b641){if(_0x29b641['type']!==_0x7b38('0x43')){var _0x40b0dc={};_0x40b0dc[_0x29b641[_0x7b38('0x33')]]={'$like':'%'+_0x48fe55[_0x7b38('0x34')][_0x7b38('0x40')]+'%'};return _0x40b0dc;}})});}_0xb84578=_[_0x7b38('0x41')]({},_0xb84578,_0x48fe55['options']);var _0x1ec31a={'where':_0xb84578[_0x7b38('0x3f')]};return db[_0x7b38('0x2d')][_0x7b38('0x23')](_0x1ec31a)[_0x7b38('0x28')](function(_0x13a409){_0x198b33[_0x7b38('0x23')]=_0x13a409;if(_0x48fe55['query'][_0x7b38('0x44')]){_0xb84578[_0x7b38('0x45')]=[{'all':!![]}];}return db[_0x7b38('0x2d')]['findAll'](_0xb84578);})[_0x7b38('0x28')](function(_0xadf548){_0x198b33[_0x7b38('0x46')]=_0xadf548;return _0x198b33;})[_0x7b38('0x28')](respondWithFilteredResult(_0x558d8f,_0xb84578))[_0x7b38('0x47')](handleError(_0x558d8f,null));};exports[_0x7b38('0x48')]=function(_0x4ae5c4,_0x51c630){var _0x210837={'raw':!![],'where':{'id':_0x4ae5c4['params']['id']}},_0x48eaf5={};_0x48eaf5['model']=_[_0x7b38('0x35')](db['VoiceMailMessage']['rawAttributes']);_0x48eaf5['query']=_['keys'](_0x4ae5c4[_0x7b38('0x34')]);_0x48eaf5[_0x7b38('0x36')]=_[_0x7b38('0x37')](_0x48eaf5['model'],_0x48eaf5[_0x7b38('0x34')]);_0x210837[_0x7b38('0x39')]=_['intersection'](_0x48eaf5[_0x7b38('0x31')],qs[_0x7b38('0x38')](_0x4ae5c4[_0x7b38('0x34')][_0x7b38('0x38')]));_0x210837[_0x7b38('0x39')]=_0x210837[_0x7b38('0x39')][_0x7b38('0x3a')]?_0x210837[_0x7b38('0x39')]:_0x48eaf5['model'];if(_0x4ae5c4[_0x7b38('0x34')][_0x7b38('0x44')]){_0x210837['include']=[{'all':!![]}];}_0x210837=_[_0x7b38('0x41')]({},_0x210837,_0x4ae5c4['options']);return db[_0x7b38('0x2d')][_0x7b38('0x49')](_0x210837)[_0x7b38('0x28')](handleEntityNotFound(_0x51c630,null))[_0x7b38('0x28')](respondWithResult(_0x51c630,null))[_0x7b38('0x47')](handleError(_0x51c630,null));};exports[_0x7b38('0x4a')]=function(_0x10c065,_0x38c972){return db['VoiceMailMessage']['create'](_0x10c065[_0x7b38('0x4b')],{})['then'](respondWithResult(_0x38c972,0xc9))[_0x7b38('0x47')](handleError(_0x38c972,null));};exports[_0x7b38('0x27')]=function(_0x161454,_0x3fcf42){if(_0x161454[_0x7b38('0x4b')]['id']){delete _0x161454[_0x7b38('0x4b')]['id'];}return db[_0x7b38('0x2d')][_0x7b38('0x49')]({'where':{'id':_0x161454['params']['id']}})[_0x7b38('0x28')](handleEntityNotFound(_0x3fcf42,null))[_0x7b38('0x28')](saveUpdates(_0x161454[_0x7b38('0x4b')],null))[_0x7b38('0x28')](respondWithResult(_0x3fcf42,null))['catch'](handleError(_0x3fcf42,null));};exports[_0x7b38('0x4c')]=function(_0x5cc346,_0x583908){return db[_0x7b38('0x2d')][_0x7b38('0x49')]({'where':{'id':_0x5cc346[_0x7b38('0x4d')]['id']}})[_0x7b38('0x28')](handleEntityNotFound(_0x583908,null))['then'](removeEntity(_0x583908,null))[_0x7b38('0x47')](handleError(_0x583908,null));};exports[_0x7b38('0x4e')]=function(_0x34ecbe,_0x34933c,_0x243f3d){return db[_0x7b38('0x2d')]['find']({'where':{'id':_0x34ecbe[_0x7b38('0x4d')]['id']},'attributes':['id',_0x7b38('0x4f'),'msg_id']})[_0x7b38('0x28')](handleEntityNotFound(_0x34933c,null))[_0x7b38('0x28')](function(_0x1029ac){if(_0x1029ac){if(!_0x1029ac[_0x7b38('0x4f')]){throw new db[(_0x7b38('0x50'))]['ValidationError'](_0x7b38('0x51'));}var _0x2249d6={'Content-Type':_0x7b38('0x52'),'Content-Disposition':_0x7b38('0x53')};if(_0x1029ac['msg_id']){_0x2249d6[_0x7b38('0x54')]=_0x7b38('0x55')+_0x1029ac[_0x7b38('0x56')]+'.wav\x22';}_0x34933c['set'](_0x2249d6);return _0x34933c[_0x7b38('0x2b')](new Buffer(_0x1029ac['recording']));}})['catch'](handleError(_0x34933c,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 175dc67..4c5f45d 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 _0x7fba=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7fba,0x78));var _0xa7fb=function(_0x54342e,_0x3e0dbd){_0x54342e=_0x54342e-0x0;var _0x2e0ffa=_0x7fba[_0x54342e];return _0x2e0ffa;};'use strict';var _=require(_0xa7fb('0x0'));var util=require('util');var logger=require(_0xa7fb('0x1'))(_0xa7fb('0x2'));var moment=require(_0xa7fb('0x3'));var BPromise=require(_0xa7fb('0x4'));var rp=require(_0xa7fb('0x5'));var fs=require('fs');var path=require(_0xa7fb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa7fb('0x7'));module[_0xa7fb('0x8')]=function(_0x17aa24,_0x1d9d41){return _0x17aa24['define'](_0xa7fb('0x9'),attributes,{'tableName':_0xa7fb('0xa'),'paranoid':![],'indexes':[{'name':_0xa7fb('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xf182=['../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xf44aab,_0x3c2136){var _0x29e3db=function(_0x249bc9){while(--_0x249bc9){_0xf44aab['push'](_0xf44aab['shift']());}};_0x29e3db(++_0x3c2136);}(_0xf182,0xd8));var _0x2f18=function(_0x129ebb,_0x13b12b){_0x129ebb=_0x129ebb-0x0;var _0x2a21db=_0xf182[_0x129ebb];return _0x2a21db;};'use strict';var _=require(_0x2f18('0x0'));var util=require(_0x2f18('0x1'));var logger=require(_0x2f18('0x2'))(_0x2f18('0x3'));var moment=require(_0x2f18('0x4'));var BPromise=require('bluebird');var rp=require(_0x2f18('0x5'));var fs=require('fs');var path=require(_0x2f18('0x6'));var rimraf=require(_0x2f18('0x7'));var config=require(_0x2f18('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x2f18('0x9')]=function(_0x158048,_0x2e5dd4){return _0x158048[_0x2f18('0xa')](_0x2f18('0xb'),attributes,{'tableName':_0x2f18('0xc'),'paranoid':![],'indexes':[{'name':_0x2f18('0xd'),'fields':[_0x2f18('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 66d395f..b8fa5f2 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 _0x9705=['request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9705,0x171));var _0x5970=function(_0x29da30,_0x1840ee){_0x29da30=_0x29da30-0x0;var _0xa0843=_0x9705[_0x29da30];return _0xa0843;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5970('0x0'));var BPromise=require(_0x5970('0x1'));var rs=require(_0x5970('0x2'));var fs=require('fs');var Redis=require(_0x5970('0x3'));var db=require(_0x5970('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5970('0x5'));var jayson=require(_0x5970('0x6'));var client=jayson[_0x5970('0x7')][_0x5970('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b0d51,_0x84cb10,_0x546b39){return new BPromise(function(_0x5a91f7,_0x1d27c8){return client[_0x5970('0x9')](_0x2b0d51,_0x546b39)['then'](function(_0x2641da){logger['info'](_0x5970('0xa'),_0x84cb10,_0x5970('0xb'));logger[_0x5970('0xc')](_0x5970('0xd'),_0x84cb10,_0x5970('0xb'),JSON[_0x5970('0xe')](_0x2641da));if(_0x2641da[_0x5970('0xf')]){if(_0x2641da[_0x5970('0xf')][_0x5970('0x10')]===0x1f4){logger[_0x5970('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x84cb10,_0x2641da['error'][_0x5970('0x11')]);return _0x1d27c8(_0x2641da[_0x5970('0xf')][_0x5970('0x11')]);}logger['error'](_0x5970('0xa'),_0x84cb10,_0x2641da[_0x5970('0xf')][_0x5970('0x11')]);return _0x5a91f7(_0x2641da['error'][_0x5970('0x11')]);}else{logger[_0x5970('0x12')](_0x5970('0xa'),_0x84cb10,_0x5970('0xb'));_0x5a91f7(_0x2641da['result'][_0x5970('0x11')]);}})[_0x5970('0x13')](function(_0x3023d2){logger[_0x5970('0xf')](_0x5970('0xa'),_0x84cb10,_0x3023d2);_0x1d27c8(_0x3023d2);});});} \ No newline at end of file +var _0xae6e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','catch','util','moment','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xae6e,0xd9));var _0xeae6=function(_0x4f90c9,_0x1f528e){_0x4f90c9=_0x4f90c9-0x0;var _0x242378=_0xae6e[_0x4f90c9];return _0x242378;};'use strict';var _=require('lodash');var util=require(_0xeae6('0x0'));var moment=require(_0xeae6('0x1'));var BPromise=require('bluebird');var rs=require(_0xeae6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeae6('0x3'))['db'];var utils=require(_0xeae6('0x4'));var logger=require(_0xeae6('0x5'))(_0xeae6('0x6'));var config=require(_0xeae6('0x7'));var jayson=require(_0xeae6('0x8'));var client=jayson[_0xeae6('0x9')][_0xeae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1108e7,_0x341dc0,_0x83b080){return new BPromise(function(_0x7fa336,_0xbce116){return client[_0xeae6('0xb')](_0x1108e7,_0x83b080)[_0xeae6('0xc')](function(_0x938e47){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x341dc0,_0xeae6('0xd'));logger['debug'](_0xeae6('0xe'),_0x341dc0,_0xeae6('0xd'),JSON[_0xeae6('0xf')](_0x938e47));if(_0x938e47[_0xeae6('0x10')]){if(_0x938e47[_0xeae6('0x10')][_0xeae6('0x11')]===0x1f4){logger[_0xeae6('0x10')](_0xeae6('0x12'),_0x341dc0,_0x938e47['error'][_0xeae6('0x13')]);return _0xbce116(_0x938e47[_0xeae6('0x10')][_0xeae6('0x13')]);}logger[_0xeae6('0x10')](_0xeae6('0x12'),_0x341dc0,_0x938e47[_0xeae6('0x10')][_0xeae6('0x13')]);return _0x7fa336(_0x938e47['error'][_0xeae6('0x13')]);}else{logger[_0xeae6('0x14')](_0xeae6('0x12'),_0x341dc0,_0xeae6('0xd'));_0x7fa336(_0x938e47['result'][_0xeae6('0x13')]);}})[_0xeae6('0x15')](function(_0x1c65c7){logger[_0xeae6('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x341dc0,_0x1c65c7);_0xbce116(_0x1c65c7);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index c814b59..dbb4d87 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 _0x99e9=['../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','create','put','update','delete','destroy','/:id/sounds/:id2','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x499eec,_0xaecfc7){var _0x3b7bfc=function(_0x161250){while(--_0x161250){_0x499eec['push'](_0x499eec['shift']());}};_0x3b7bfc(++_0xaecfc7);}(_0x99e9,0x6d));var _0x999e=function(_0x5bd1a9,_0x313714){_0x5bd1a9=_0x5bd1a9-0x0;var _0x2ba345=_0x99e9[_0x5bd1a9];return _0x2ba345;};'use strict';var multer=require(_0x999e('0x0'));var util=require(_0x999e('0x1'));var path=require(_0x999e('0x2'));var timeout=require(_0x999e('0x3'));var express=require('express');var router=express[_0x999e('0x4')]();var fs_extra=require(_0x999e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x999e('0x6'));var config=require(_0x999e('0x7'));var controller=require(_0x999e('0x8'));router[_0x999e('0x9')]('/',auth[_0x999e('0xa')](),controller[_0x999e('0xb')]);router['get'](_0x999e('0xc'),auth[_0x999e('0xa')](),controller[_0x999e('0xd')]);router[_0x999e('0x9')](_0x999e('0xe'),auth[_0x999e('0xa')](),controller[_0x999e('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x999e('0x10')]);router['post'](_0x999e('0xe'),auth[_0x999e('0xa')](),controller['addSound']);router[_0x999e('0x11')](_0x999e('0xc'),auth[_0x999e('0xa')](),controller[_0x999e('0x12')]);router[_0x999e('0x13')]('/:id',auth[_0x999e('0xa')](),controller[_0x999e('0x14')]);router[_0x999e('0x13')](_0x999e('0x15'),auth[_0x999e('0xa')](),controller['removeSound']);module[_0x999e('0x16')]=router; \ No newline at end of file +var _0x6873=['post','create','addSound','put','update','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','/:id','isAuthenticated','show','/:id/sounds','getSounds'];(function(_0x31d5d9,_0x207133){var _0x1e64c3=function(_0x54cc36){while(--_0x54cc36){_0x31d5d9['push'](_0x31d5d9['shift']());}};_0x1e64c3(++_0x207133);}(_0x6873,0x1ec));var _0x3687=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x6873[_0x39c734];return _0xb2a2f9;};'use strict';var multer=require(_0x3687('0x0'));var util=require('util');var path=require(_0x3687('0x1'));var timeout=require(_0x3687('0x2'));var express=require('express');var router=express[_0x3687('0x3')]();var fs_extra=require(_0x3687('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3687('0x5'));var config=require(_0x3687('0x6'));var controller=require(_0x3687('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3687('0x8')](_0x3687('0x9'),auth[_0x3687('0xa')](),controller[_0x3687('0xb')]);router['get'](_0x3687('0xc'),auth[_0x3687('0xa')](),controller[_0x3687('0xd')]);router[_0x3687('0xe')]('/',auth[_0x3687('0xa')](),controller[_0x3687('0xf')]);router[_0x3687('0xe')](_0x3687('0xc'),auth[_0x3687('0xa')](),controller[_0x3687('0x10')]);router[_0x3687('0x11')](_0x3687('0x9'),auth['isAuthenticated'](),controller[_0x3687('0x12')]);router['delete'](_0x3687('0x9'),auth[_0x3687('0xa')](),controller[_0x3687('0x13')]);router['delete'](_0x3687('0x14'),auth[_0x3687('0xa')](),controller[_0x3687('0x15')]);module[_0x3687('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 4eb19fa..0577ef2 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 _0x5534=['sequelize','exports','STRING','name','ENUM','files','mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5534,0x108));var _0x4553=function(_0x40482f,_0x17a0b4){_0x40482f=_0x40482f-0x0;var _0xd1906b=_0x5534[_0x40482f];return _0xd1906b;};'use strict';var Sequelize=require(_0x4553('0x0'));module[_0x4553('0x1')]={'name':{'type':Sequelize[_0x4553('0x2')],'allowNull':![],'unique':_0x4553('0x3')},'mode':{'type':Sequelize[_0x4553('0x4')]('custom',_0x4553('0x5'),_0x4553('0x6'),_0x4553('0x7'),_0x4553('0x8'),'mp3'),'allowNull':!![],'defaultValue':_0x4553('0x5')},'directory':{'type':Sequelize[_0x4553('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x4553('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x4553('0x2')],'allowNull':!![],'defaultValue':_0x4553('0x9')},'format':{'type':Sequelize[_0x4553('0x2')],'allowNull':!![]},'stamp':{'type':_0x4553('0xa')},'defaultEntry':{'type':Sequelize[_0x4553('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2365=['custom','files','mp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','STRING','name'];(function(_0x149225,_0x5869e2){var _0x21e6ac=function(_0x3bbef8){while(--_0x3bbef8){_0x149225['push'](_0x149225['shift']());}};_0x21e6ac(++_0x5869e2);}(_0x2365,0x12a));var _0x5236=function(_0x2022e4,_0x18de6b){_0x2022e4=_0x2022e4-0x0;var _0x4f4bc8=_0x2365[_0x2022e4];return _0x4f4bc8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5236('0x0')],'allowNull':![],'unique':_0x5236('0x1')},'mode':{'type':Sequelize['ENUM'](_0x5236('0x2'),_0x5236('0x3'),_0x5236('0x4'),'quietmp3nb',_0x5236('0x5'),_0x5236('0x6')),'allowNull':!![],'defaultValue':_0x5236('0x3')},'directory':{'type':Sequelize[_0x5236('0x0')],'allowNull':!![]},'application':{'type':Sequelize[_0x5236('0x0')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5236('0x0')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5236('0x0')],'allowNull':!![],'defaultValue':_0x5236('0x7')},'format':{'type':Sequelize[_0x5236('0x0')],'allowNull':!![]},'stamp':{'type':_0x5236('0x8')},'defaultEntry':{'type':Sequelize[_0x5236('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 5f66238..07bbec9 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 _0xc2b8=['find','body','create','transaction','files','directory','root','server/files/moh','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','sequelize','readdirSync','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','removeSound','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','VoiceMusicOnHold','includeAll','include','findAll','catch','show','params','keys','intersection','options'];(function(_0x48c652,_0x379b57){var _0x5d9163=function(_0x4c666b){while(--_0x4c666b){_0x48c652['push'](_0x48c652['shift']());}};_0x5d9163(++_0x379b57);}(_0xc2b8,0x108));var _0x8c2b=function(_0x2de0ab,_0x353746){_0x2de0ab=_0x2de0ab-0x0;var _0x7f8af9=_0xc2b8[_0x2de0ab];return _0x7f8af9;};'use strict';var emlformat=require(_0x8c2b('0x0'));var rimraf=require(_0x8c2b('0x1'));var zipdir=require(_0x8c2b('0x2'));var jsonpatch=require(_0x8c2b('0x3'));var rp=require(_0x8c2b('0x4'));var moment=require(_0x8c2b('0x5'));var BPromise=require(_0x8c2b('0x6'));var Mustache=require('mustache');var util=require(_0x8c2b('0x7'));var path=require('path');var sox=require(_0x8c2b('0x8'));var csv=require(_0x8c2b('0x9'));var ejs=require(_0x8c2b('0xa'));var fs=require('fs');var fs_extra=require(_0x8c2b('0xb'));var _=require('lodash');var squel=require(_0x8c2b('0xc'));var crypto=require('crypto');var jsforce=require(_0x8c2b('0xd'));var deskjs=require(_0x8c2b('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8c2b('0xf'));var authService=require(_0x8c2b('0x10'));var qs=require(_0x8c2b('0x11'));var as=require(_0x8c2b('0x12'));var hardwareService=require(_0x8c2b('0x13'));var logger=require(_0x8c2b('0x14'))(_0x8c2b('0x15'));var utils=require(_0x8c2b('0x16'));var config=require(_0x8c2b('0x17'));var licenseUtil=require(_0x8c2b('0x18'));var db=require(_0x8c2b('0x19'))['db'];function respondWithStatusCode(_0x255046,_0x5dbe27){_0x5dbe27=_0x5dbe27||0xcc;return function(_0x483578){if(_0x483578){return _0x255046[_0x8c2b('0x1a')](_0x5dbe27);}return _0x255046[_0x8c2b('0x1b')](_0x5dbe27)[_0x8c2b('0x1c')]();};}function respondWithResult(_0x13bcc4,_0x48c78e){_0x48c78e=_0x48c78e||0xc8;return function(_0x40895a){if(_0x40895a){return _0x13bcc4['status'](_0x48c78e)[_0x8c2b('0x1d')](_0x40895a);}};}function respondWithFilteredResult(_0x25b215,_0x3f3238){return function(_0x8264ae){if(_0x8264ae){var _0x3eafec=typeof _0x3f3238[_0x8c2b('0x1e')]===_0x8c2b('0x1f')&&typeof _0x3f3238[_0x8c2b('0x20')]===_0x8c2b('0x1f');var _0x41f757=_0x8264ae[_0x8c2b('0x21')];var _0x3bface=_0x3eafec?0x0:_0x3f3238[_0x8c2b('0x1e')];var _0x552fe1=_0x3eafec?_0x8264ae[_0x8c2b('0x21')]:_0x3f3238[_0x8c2b('0x1e')]+_0x3f3238['limit'];var _0x419e04;if(_0x552fe1>=_0x41f757){_0x552fe1=_0x41f757;_0x419e04=0xc8;}else{_0x419e04=0xce;}_0x25b215[_0x8c2b('0x1b')](_0x419e04);return _0x25b215[_0x8c2b('0x22')](_0x8c2b('0x23'),_0x3bface+'-'+_0x552fe1+'/'+_0x41f757)[_0x8c2b('0x1d')](_0x8264ae);}return null;};}function patchUpdates(_0x2ecbdf){return function(_0x36efa3){try{jsonpatch[_0x8c2b('0x24')](_0x36efa3,_0x2ecbdf,!![]);}catch(_0x36c17d){return BPromise['reject'](_0x36c17d);}return _0x36efa3[_0x8c2b('0x25')]();};}function saveUpdates(_0x241131,_0x43034f){return function(_0x525830){if(_0x525830){return _0x525830['update'](_0x241131)[_0x8c2b('0x26')](function(_0x38ad5c){return _0x38ad5c;});}return null;};}function removeEntity(_0x193649,_0x3a7eda){return function(_0x4bdf00){if(_0x4bdf00){return _0x4bdf00[_0x8c2b('0x27')]()[_0x8c2b('0x26')](function(){var _0x503893=_0x4bdf00['get']({'plain':!![]});var _0x5729c8='MusicOnHolds';return db['UserProfileResource'][_0x8c2b('0x27')]({'where':{'type':_0x5729c8,'resourceId':_0x503893['id']}})[_0x8c2b('0x26')](function(){return _0x4bdf00;});})[_0x8c2b('0x26')](function(){_0x193649['status'](0xcc)[_0x8c2b('0x1c')]();});}};}function handleEntityNotFound(_0xfa729f,_0x439486){return function(_0x2192e8){if(!_0x2192e8){_0xfa729f[_0x8c2b('0x1a')](0x194);}return _0x2192e8;};}function handleError(_0x36950f,_0x4f1781){_0x4f1781=_0x4f1781||0x1f4;return function(_0xa4a382){logger['error'](_0xa4a382[_0x8c2b('0x28')]);if(_0xa4a382[_0x8c2b('0x29')]){delete _0xa4a382[_0x8c2b('0x29')];}_0x36950f[_0x8c2b('0x1b')](_0x4f1781)['send'](_0xa4a382);};}exports['index']=function(_0x2d762b,_0x9a3032){var _0x4086dc={},_0x3329d3={},_0x285611={'count':0x0,'rows':[]};var _0x19d331=_[_0x8c2b('0x2a')](db['VoiceMusicOnHold'][_0x8c2b('0x2b')],function(_0xade828){return{'name':_0xade828[_0x8c2b('0x2c')],'type':_0xade828[_0x8c2b('0x2d')][_0x8c2b('0x2e')]};});_0x3329d3[_0x8c2b('0x2f')]=_[_0x8c2b('0x2a')](_0x19d331,_0x8c2b('0x29'));_0x3329d3[_0x8c2b('0x30')]=_['keys'](_0x2d762b[_0x8c2b('0x30')]);_0x3329d3[_0x8c2b('0x31')]=_['intersection'](_0x3329d3['model'],_0x3329d3[_0x8c2b('0x30')]);_0x4086dc[_0x8c2b('0x32')]=_['intersection'](_0x3329d3[_0x8c2b('0x2f')],qs[_0x8c2b('0x33')](_0x2d762b[_0x8c2b('0x30')][_0x8c2b('0x33')]));_0x4086dc[_0x8c2b('0x32')]=_0x4086dc['attributes'][_0x8c2b('0x34')]?_0x4086dc[_0x8c2b('0x32')]:_0x3329d3[_0x8c2b('0x2f')];if(!_0x2d762b['query'][_0x8c2b('0x35')](_0x8c2b('0x36'))){_0x4086dc[_0x8c2b('0x20')]=qs[_0x8c2b('0x20')](_0x2d762b[_0x8c2b('0x30')][_0x8c2b('0x20')]);_0x4086dc[_0x8c2b('0x1e')]=qs[_0x8c2b('0x1e')](_0x2d762b[_0x8c2b('0x30')][_0x8c2b('0x1e')]);}_0x4086dc[_0x8c2b('0x37')]=qs[_0x8c2b('0x38')](_0x2d762b[_0x8c2b('0x30')][_0x8c2b('0x38')]);delete _0x2d762b[_0x8c2b('0x30')][_0x8c2b('0x38')];_0x4086dc[_0x8c2b('0x39')]=qs['filters'](_[_0x8c2b('0x3a')](_0x2d762b[_0x8c2b('0x30')],_0x3329d3[_0x8c2b('0x31')]),_0x19d331);if(_0x2d762b['query']['filter']){_0x4086dc['where']=_['merge'](_0x4086dc[_0x8c2b('0x39')],{'$or':_['map'](_0x19d331,function(_0x234e03){if(_0x234e03[_0x8c2b('0x2d')]!==_0x8c2b('0x3b')){var _0xffbeeb={};_0xffbeeb[_0x234e03['name']]={'$like':'%'+_0x2d762b[_0x8c2b('0x30')][_0x8c2b('0x3c')]+'%'};return _0xffbeeb;}})});}_0x4086dc=_[_0x8c2b('0x3d')]({},_0x4086dc,_0x2d762b['options']);var _0x50ab6a={'where':_0x4086dc['where']};return db[_0x8c2b('0x3e')][_0x8c2b('0x21')](_0x50ab6a)[_0x8c2b('0x26')](function(_0x266fd2){_0x285611[_0x8c2b('0x21')]=_0x266fd2;if(_0x2d762b[_0x8c2b('0x30')][_0x8c2b('0x3f')]){_0x4086dc[_0x8c2b('0x40')]=[{'all':!![]}];}return db[_0x8c2b('0x3e')][_0x8c2b('0x41')](_0x4086dc);})[_0x8c2b('0x26')](function(_0x65d16f){_0x285611['rows']=_0x65d16f;return _0x285611;})['then'](respondWithFilteredResult(_0x9a3032,_0x4086dc))[_0x8c2b('0x42')](handleError(_0x9a3032,null));};exports[_0x8c2b('0x43')]=function(_0xf0868c,_0x4bd08d){var _0x4bd554={'raw':![],'where':{'id':_0xf0868c[_0x8c2b('0x44')]['id']}},_0x107812={};_0x107812['model']=_[_0x8c2b('0x45')](db['VoiceMusicOnHold'][_0x8c2b('0x2b')]);_0x107812['query']=_[_0x8c2b('0x45')](_0xf0868c[_0x8c2b('0x30')]);_0x107812[_0x8c2b('0x31')]=_[_0x8c2b('0x46')](_0x107812[_0x8c2b('0x2f')],_0x107812[_0x8c2b('0x30')]);_0x4bd554['attributes']=_[_0x8c2b('0x46')](_0x107812[_0x8c2b('0x2f')],qs[_0x8c2b('0x33')](_0xf0868c[_0x8c2b('0x30')][_0x8c2b('0x33')]));_0x4bd554[_0x8c2b('0x32')]=_0x4bd554[_0x8c2b('0x32')]['length']?_0x4bd554[_0x8c2b('0x32')]:_0x107812[_0x8c2b('0x2f')];if(_0xf0868c[_0x8c2b('0x30')]['includeAll']){_0x4bd554[_0x8c2b('0x40')]=[{'all':!![]}];}_0x4bd554=_['merge']({},_0x4bd554,_0xf0868c[_0x8c2b('0x47')]);return db[_0x8c2b('0x3e')][_0x8c2b('0x48')](_0x4bd554)['then'](handleEntityNotFound(_0x4bd08d,null))[_0x8c2b('0x26')](respondWithResult(_0x4bd08d,null))[_0x8c2b('0x42')](handleError(_0x4bd08d,null));};exports['update']=function(_0x52cd45,_0x4ed052){if(_0x52cd45['body']['id']){delete _0x52cd45[_0x8c2b('0x49')]['id'];}return db[_0x8c2b('0x3e')][_0x8c2b('0x48')]({'where':{'id':_0x52cd45[_0x8c2b('0x44')]['id']}})[_0x8c2b('0x26')](handleEntityNotFound(_0x4ed052,null))[_0x8c2b('0x26')](saveUpdates(_0x52cd45[_0x8c2b('0x49')],null))['then'](respondWithResult(_0x4ed052,null))['catch'](handleError(_0x4ed052,null));};exports[_0x8c2b('0x4a')]=function(_0x23407e,_0x5e56b7,_0x4c75f0){return db['sequelize'][_0x8c2b('0x4b')](function(_0x5e4896){if(_0x23407e[_0x8c2b('0x49')]['mode']===_0x8c2b('0x4c')){_0x23407e[_0x8c2b('0x49')][_0x8c2b('0x4d')]=path['join'](config[_0x8c2b('0x4e')],_0x8c2b('0x4f'),_0x23407e[_0x8c2b('0x49')]['name']);}return db[_0x8c2b('0x3e')][_0x8c2b('0x4a')](_0x23407e[_0x8c2b('0x49')],{'transaction':_0x5e4896})['then'](function(_0x3008f0){if(_0x23407e['body']['mode']===_0x8c2b('0x4c')){fs[_0x8c2b('0x50')](_0x3008f0['directory'],parseInt(_0x8c2b('0x51'),0x8));}var _0x2f8f73=_0x23407e[_0x8c2b('0x52')][_0x8c2b('0x53')]({'plain':!![]});if(!_0x2f8f73)throw new Error(_0x8c2b('0x54'));if(_0x2f8f73[_0x8c2b('0x55')]==='user'){var _0x284b10=_0x3008f0[_0x8c2b('0x53')]({'plain':!![]});return db[_0x8c2b('0x56')][_0x8c2b('0x48')]({'where':{'name':'MusicOnHolds','userProfileId':_0x2f8f73[_0x8c2b('0x57')]},'raw':!![]})['then'](function(_0x116b6c){if(_0x116b6c&&_0x116b6c[_0x8c2b('0x58')]===0x0){return db[_0x8c2b('0x59')][_0x8c2b('0x4a')]({'name':_0x284b10[_0x8c2b('0x29')],'resourceId':_0x284b10['id'],'type':_0x116b6c['name'],'sectionId':_0x116b6c['id']},{})[_0x8c2b('0x26')](function(){return _0x3008f0;});}else{return _0x3008f0;}})[_0x8c2b('0x42')](function(_0x2c1f24){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c1f24);});}return _0x3008f0;});})[_0x8c2b('0x26')](respondWithResult(_0x5e56b7,0xc9))[_0x8c2b('0x42')](handleError(_0x5e56b7,null));};exports['destroy']=function(_0x53a78d,_0x1b333d,_0x1936a7){var _0x4c8e02;return db[_0x8c2b('0x3e')][_0x8c2b('0x48')]({'where':{'id':_0x53a78d[_0x8c2b('0x44')]['id']}})[_0x8c2b('0x26')](function(_0x1b536e){if(_0x1b536e){return db[_0x8c2b('0x5a')][_0x8c2b('0x4b')](function(_0x397c08){return _0x1b536e['destroy']({'transaction':_0x397c08,'raw':!![]})[_0x8c2b('0x26')](function(_0x4e9b55){if(_0x4e9b55['directory']){fs[_0x8c2b('0x5b')](_0x4e9b55[_0x8c2b('0x4d')])['forEach'](function(_0x3006ae){fs[_0x8c2b('0x5c')](path[_0x8c2b('0x5d')](_0x4e9b55[_0x8c2b('0x4d')],_0x3006ae));});fs[_0x8c2b('0x5e')](_0x4e9b55[_0x8c2b('0x4d')]);}return _0x4e9b55;});})[_0x8c2b('0x42')](function(_0x1a1b9c){throw new db[(_0x8c2b('0x5f'))][(_0x8c2b('0x60'))](_0x1a1b9c[_0x8c2b('0x61')]);});}})[_0x8c2b('0x26')](handleEntityNotFound(_0x1b333d,null))['then'](removeEntity(_0x1b333d,null))[_0x8c2b('0x42')](handleError(_0x1b333d,null));};exports[_0x8c2b('0x62')]=function(_0x8d5c5c,_0x373bfe,_0x153815){return db[_0x8c2b('0x5a')][_0x8c2b('0x4b')](function(_0x8cd0b){var _0x3fa25d;return db[_0x8c2b('0x3e')][_0x8c2b('0x48')]({'where':{'id':_0x8d5c5c['params']['id']}})[_0x8c2b('0x26')](function(_0x24a6aa){if(_0x24a6aa){_0x3fa25d=_0x24a6aa;return _0x24a6aa[_0x8c2b('0x62')](_0x8d5c5c[_0x8c2b('0x49')]['id'],{'transaction':_0x8cd0b});}})[_0x8c2b('0x26')](function(_0xa614f8){if(_0xa614f8){return db[_0x8c2b('0x63')][_0x8c2b('0x64')]({'where':{'id':_0x8d5c5c[_0x8c2b('0x49')]['id']},'attributes':['id',_0x8c2b('0x29'),_0x8c2b('0x65'),_0x8c2b('0x66'),_0x8c2b('0x67')],'raw':!![]});}})[_0x8c2b('0x26')](function(_0x9d697e){if(_0x9d697e){var _0x4d6312=path[_0x8c2b('0x5d')](config[_0x8c2b('0x4e')],_0x8c2b('0x68'),util[_0x8c2b('0x69')](_0x8c2b('0x6a'),path[_0x8c2b('0x6b')](_0x9d697e[_0x8c2b('0x65')],path['extname'](_0x9d697e['save_name'])),_0x9d697e[_0x8c2b('0x66')]));var _0x1dbc49=path['join'](config[_0x8c2b('0x4e')],_0x8c2b('0x4f'),_0x3fa25d[_0x8c2b('0x29')],util[_0x8c2b('0x69')]('%s.%s',_0x9d697e[_0x8c2b('0x29')],_0x9d697e['converted_format']));fs[_0x8c2b('0x6c')](_0x4d6312,_0x1dbc49);return _0x9d697e;}})[_0x8c2b('0x42')](function(_0x5c7ca0){throw new db['Sequelize'][(_0x8c2b('0x60'))](_0x5c7ca0[_0x8c2b('0x61')]);});})[_0x8c2b('0x26')](handleEntityNotFound(_0x373bfe,null))[_0x8c2b('0x26')](respondWithResult(_0x373bfe,0xc9))['catch'](handleError(_0x373bfe,null));};exports[_0x8c2b('0x6d')]=function(_0x467f3a,_0x337406,_0x3b148f){return db[_0x8c2b('0x5a')][_0x8c2b('0x4b')](function(_0x5bef2c){var _0x43d84b;return db[_0x8c2b('0x3e')][_0x8c2b('0x64')]({'where':{'id':_0x467f3a[_0x8c2b('0x44')]['id']}})[_0x8c2b('0x26')](handleEntityNotFound(_0x337406,null))[_0x8c2b('0x26')](function(_0x3f96be){if(_0x3f96be){_0x43d84b=_0x3f96be;return _0x3f96be[_0x8c2b('0x6d')](_0x467f3a[_0x8c2b('0x44')][_0x8c2b('0x6e')]);}})[_0x8c2b('0x26')](function(_0xc39936){if(_0xc39936){return db['Sound'][_0x8c2b('0x64')]({'where':{'id':_0x467f3a[_0x8c2b('0x44')][_0x8c2b('0x6e')]},'attributes':['id',_0x8c2b('0x29'),'save_name',_0x8c2b('0x66'),_0x8c2b('0x67')],'raw':!![]});}})[_0x8c2b('0x26')](function(_0x462a41){if(_0x462a41){fs['unlinkSync'](path[_0x8c2b('0x5d')](_0x43d84b[_0x8c2b('0x4d')],util[_0x8c2b('0x69')](_0x8c2b('0x6a'),_0x462a41[_0x8c2b('0x29')],_0x462a41['converted_format'])));return _0x462a41;}})[_0x8c2b('0x42')](function(_0x20db36){throw new db[(_0x8c2b('0x5f'))][(_0x8c2b('0x60'))](_0x20db36[_0x8c2b('0x61')]);});})[_0x8c2b('0x26')](handleEntityNotFound(_0x337406,null))[_0x8c2b('0x26')](respondWithStatusCode(_0x337406,0xcc))['catch'](handleError(_0x337406,null));};exports[_0x8c2b('0x6f')]=function(_0x158ac7,_0x166c02,_0x2b33ab){var _0x2348f0={};var _0x3bf208={};var _0x44bc51;var _0x3f5263;return db['VoiceMusicOnHold'][_0x8c2b('0x64')]({'where':{'id':_0x158ac7[_0x8c2b('0x44')]['id']}})[_0x8c2b('0x26')](handleEntityNotFound(_0x166c02,null))['then'](function(_0x10a5c4){if(_0x10a5c4){_0x44bc51=_0x10a5c4;_0x3bf208[_0x8c2b('0x2f')]=_[_0x8c2b('0x45')](db['Sound']['rawAttributes']);_0x3bf208[_0x8c2b('0x30')]=_['keys'](_0x158ac7[_0x8c2b('0x30')]);_0x3bf208[_0x8c2b('0x31')]=_['intersection'](_0x3bf208[_0x8c2b('0x2f')],_0x3bf208[_0x8c2b('0x30')]);_0x2348f0[_0x8c2b('0x32')]=_[_0x8c2b('0x46')](_0x3bf208[_0x8c2b('0x2f')],qs[_0x8c2b('0x33')](_0x158ac7['query'][_0x8c2b('0x33')]));_0x2348f0[_0x8c2b('0x32')]=_0x2348f0[_0x8c2b('0x32')][_0x8c2b('0x34')]?_0x2348f0['attributes']:_0x3bf208[_0x8c2b('0x2f')];_0x2348f0['order']=qs[_0x8c2b('0x38')](_0x158ac7[_0x8c2b('0x30')][_0x8c2b('0x38')]);_0x2348f0[_0x8c2b('0x39')]=qs[_0x8c2b('0x31')](_['pick'](_0x158ac7[_0x8c2b('0x30')],_0x3bf208['filters']));if(_0x158ac7[_0x8c2b('0x30')][_0x8c2b('0x3c')]){_0x2348f0[_0x8c2b('0x39')]=_['merge'](_0x2348f0[_0x8c2b('0x39')],{'$or':_[_0x8c2b('0x2a')](_0x2348f0[_0x8c2b('0x32')],function(_0x344bf3){var _0x1edaeb={};_0x1edaeb[_0x344bf3]={'$like':'%'+_0x158ac7[_0x8c2b('0x30')][_0x8c2b('0x3c')]+'%'};return _0x1edaeb;})});}_0x2348f0=_[_0x8c2b('0x3d')]({},_0x2348f0,_0x158ac7[_0x8c2b('0x47')]);return _0x44bc51[_0x8c2b('0x6f')](_0x2348f0);}})['then'](function(_0x3906a6){if(_0x3906a6){_0x3f5263=_0x3906a6['length'];if(!_0x158ac7[_0x8c2b('0x30')][_0x8c2b('0x35')](_0x8c2b('0x36'))){_0x2348f0[_0x8c2b('0x20')]=qs[_0x8c2b('0x20')](_0x158ac7[_0x8c2b('0x30')]['limit']);_0x2348f0[_0x8c2b('0x1e')]=qs[_0x8c2b('0x1e')](_0x158ac7[_0x8c2b('0x30')][_0x8c2b('0x1e')]);}return _0x44bc51[_0x8c2b('0x6f')](_0x2348f0);}})['then'](function(_0x48e115){if(_0x48e115){return _0x48e115?{'count':_0x3f5263,'rows':_0x48e115}:null;}})[_0x8c2b('0x26')](respondWithResult(_0x166c02,null))[_0x8c2b('0x42')](handleError(_0x166c02,null));}; \ No newline at end of file +var _0x27fa=['mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','rmdirSync','ValidationError','message','addSound','findOne','save_name','createdAt','server/files/sounds/converted','%s.%s','basename','extname','converted_format','server/files/moh','format','symlinkSync','removeSound','id2','unlinkSync','Sequelize','getSounds','keys','Sound','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','body','create','sequelize','transaction','files','directory','join','root'];(function(_0x27e72d,_0x27a2fd){var _0x4b1eaa=function(_0x49a94c){while(--_0x49a94c){_0x27e72d['push'](_0x27e72d['shift']());}};_0x4b1eaa(++_0x27a2fd);}(_0x27fa,0x17a));var _0xa27f=function(_0x4cd67d,_0x48bea9){_0x4cd67d=_0x4cd67d-0x0;var _0x501aec=_0x27fa[_0x4cd67d];return _0x501aec;};'use strict';var emlformat=require(_0xa27f('0x0'));var rimraf=require(_0xa27f('0x1'));var zipdir=require(_0xa27f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa27f('0x3'));var moment=require(_0xa27f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa27f('0x5'));var util=require(_0xa27f('0x6'));var path=require('path');var sox=require(_0xa27f('0x7'));var csv=require('to-csv');var ejs=require(_0xa27f('0x8'));var fs=require('fs');var fs_extra=require(_0xa27f('0x9'));var _=require(_0xa27f('0xa'));var squel=require('squel');var crypto=require(_0xa27f('0xb'));var jsforce=require(_0xa27f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa27f('0xd'));var querystring=require('querystring');var Papa=require(_0xa27f('0xe'));var Redis=require(_0xa27f('0xf'));var authService=require(_0xa27f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa27f('0x11'));var hardwareService=require(_0xa27f('0x12'));var logger=require(_0xa27f('0x13'))(_0xa27f('0x14'));var utils=require(_0xa27f('0x15'));var config=require(_0xa27f('0x16'));var licenseUtil=require(_0xa27f('0x17'));var db=require(_0xa27f('0x18'))['db'];function respondWithStatusCode(_0x3a0dc4,_0x1df123){_0x1df123=_0x1df123||0xcc;return function(_0x5b3b8a){if(_0x5b3b8a){return _0x3a0dc4[_0xa27f('0x19')](_0x1df123);}return _0x3a0dc4[_0xa27f('0x1a')](_0x1df123)['end']();};}function respondWithResult(_0x595d76,_0x1fbf54){_0x1fbf54=_0x1fbf54||0xc8;return function(_0x53b2ff){if(_0x53b2ff){return _0x595d76[_0xa27f('0x1a')](_0x1fbf54)['json'](_0x53b2ff);}};}function respondWithFilteredResult(_0x28945e,_0x28eb41){return function(_0xd6dbb3){if(_0xd6dbb3){var _0x7fca17=typeof _0x28eb41[_0xa27f('0x1b')]===_0xa27f('0x1c')&&typeof _0x28eb41[_0xa27f('0x1d')]===_0xa27f('0x1c');var _0x5dd294=_0xd6dbb3[_0xa27f('0x1e')];var _0x56abc6=_0x7fca17?0x0:_0x28eb41[_0xa27f('0x1b')];var _0x276726=_0x7fca17?_0xd6dbb3['count']:_0x28eb41[_0xa27f('0x1b')]+_0x28eb41[_0xa27f('0x1d')];var _0x346201;if(_0x276726>=_0x5dd294){_0x276726=_0x5dd294;_0x346201=0xc8;}else{_0x346201=0xce;}_0x28945e[_0xa27f('0x1a')](_0x346201);return _0x28945e[_0xa27f('0x1f')](_0xa27f('0x20'),_0x56abc6+'-'+_0x276726+'/'+_0x5dd294)[_0xa27f('0x21')](_0xd6dbb3);}return null;};}function patchUpdates(_0x125f37){return function(_0xf7c8dd){try{jsonpatch['apply'](_0xf7c8dd,_0x125f37,!![]);}catch(_0x24c3a2){return BPromise[_0xa27f('0x22')](_0x24c3a2);}return _0xf7c8dd[_0xa27f('0x23')]();};}function saveUpdates(_0x4105b1,_0x13b4dd){return function(_0x20afd6){if(_0x20afd6){return _0x20afd6[_0xa27f('0x24')](_0x4105b1)['then'](function(_0x4eb383){return _0x4eb383;});}return null;};}function removeEntity(_0x7b9e81,_0x38bee2){return function(_0x38e142){if(_0x38e142){return _0x38e142[_0xa27f('0x25')]()[_0xa27f('0x26')](function(){var _0x433969=_0x38e142[_0xa27f('0x27')]({'plain':!![]});var _0x328837=_0xa27f('0x28');return db[_0xa27f('0x29')][_0xa27f('0x25')]({'where':{'type':_0x328837,'resourceId':_0x433969['id']}})[_0xa27f('0x26')](function(){return _0x38e142;});})[_0xa27f('0x26')](function(){_0x7b9e81[_0xa27f('0x1a')](0xcc)[_0xa27f('0x2a')]();});}};}function handleEntityNotFound(_0x159d0d,_0x83a3c5){return function(_0x3e5f8d){if(!_0x3e5f8d){_0x159d0d[_0xa27f('0x19')](0x194);}return _0x3e5f8d;};}function handleError(_0x5c8b99,_0x4b46cd){_0x4b46cd=_0x4b46cd||0x1f4;return function(_0x2fc058){logger[_0xa27f('0x2b')](_0x2fc058[_0xa27f('0x2c')]);if(_0x2fc058[_0xa27f('0x2d')]){delete _0x2fc058['name'];}_0x5c8b99[_0xa27f('0x1a')](_0x4b46cd)[_0xa27f('0x2e')](_0x2fc058);};}exports[_0xa27f('0x2f')]=function(_0x358ca9,_0x2eb571){var _0x101df2={},_0x46bd22={},_0x3f5002={'count':0x0,'rows':[]};var _0x8e3c74=_[_0xa27f('0x30')](db[_0xa27f('0x31')][_0xa27f('0x32')],function(_0x4e5ca4){return{'name':_0x4e5ca4[_0xa27f('0x33')],'type':_0x4e5ca4[_0xa27f('0x34')][_0xa27f('0x35')]};});_0x46bd22[_0xa27f('0x36')]=_[_0xa27f('0x30')](_0x8e3c74,_0xa27f('0x2d'));_0x46bd22[_0xa27f('0x37')]=_['keys'](_0x358ca9[_0xa27f('0x37')]);_0x46bd22[_0xa27f('0x38')]=_[_0xa27f('0x39')](_0x46bd22[_0xa27f('0x36')],_0x46bd22[_0xa27f('0x37')]);_0x101df2[_0xa27f('0x3a')]=_[_0xa27f('0x39')](_0x46bd22[_0xa27f('0x36')],qs['fields'](_0x358ca9[_0xa27f('0x37')][_0xa27f('0x3b')]));_0x101df2[_0xa27f('0x3a')]=_0x101df2[_0xa27f('0x3a')]['length']?_0x101df2[_0xa27f('0x3a')]:_0x46bd22[_0xa27f('0x36')];if(!_0x358ca9['query'][_0xa27f('0x3c')](_0xa27f('0x3d'))){_0x101df2['limit']=qs[_0xa27f('0x1d')](_0x358ca9[_0xa27f('0x37')][_0xa27f('0x1d')]);_0x101df2[_0xa27f('0x1b')]=qs[_0xa27f('0x1b')](_0x358ca9[_0xa27f('0x37')][_0xa27f('0x1b')]);}_0x101df2[_0xa27f('0x3e')]=qs['sort'](_0x358ca9['query']['sort']);delete _0x358ca9[_0xa27f('0x37')][_0xa27f('0x3f')];_0x101df2[_0xa27f('0x40')]=qs[_0xa27f('0x38')](_[_0xa27f('0x41')](_0x358ca9[_0xa27f('0x37')],_0x46bd22[_0xa27f('0x38')]),_0x8e3c74);if(_0x358ca9['query'][_0xa27f('0x42')]){_0x101df2['where']=_[_0xa27f('0x43')](_0x101df2[_0xa27f('0x40')],{'$or':_[_0xa27f('0x30')](_0x8e3c74,function(_0x362620){if(_0x362620[_0xa27f('0x34')]!==_0xa27f('0x44')){var _0x32e290={};_0x32e290[_0x362620[_0xa27f('0x2d')]]={'$like':'%'+_0x358ca9[_0xa27f('0x37')]['filter']+'%'};return _0x32e290;}})});}_0x101df2=_[_0xa27f('0x43')]({},_0x101df2,_0x358ca9[_0xa27f('0x45')]);var _0x922f37={'where':_0x101df2[_0xa27f('0x40')]};return db['VoiceMusicOnHold'][_0xa27f('0x1e')](_0x922f37)['then'](function(_0x160797){_0x3f5002[_0xa27f('0x1e')]=_0x160797;if(_0x358ca9[_0xa27f('0x37')][_0xa27f('0x46')]){_0x101df2[_0xa27f('0x47')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xa27f('0x48')](_0x101df2);})[_0xa27f('0x26')](function(_0x2fb8e1){_0x3f5002[_0xa27f('0x49')]=_0x2fb8e1;return _0x3f5002;})[_0xa27f('0x26')](respondWithFilteredResult(_0x2eb571,_0x101df2))[_0xa27f('0x4a')](handleError(_0x2eb571,null));};exports['show']=function(_0xc9164f,_0x2a98cf){var _0xaec095={'raw':![],'where':{'id':_0xc9164f[_0xa27f('0x4b')]['id']}},_0x7eb8d8={};_0x7eb8d8[_0xa27f('0x36')]=_['keys'](db[_0xa27f('0x31')][_0xa27f('0x32')]);_0x7eb8d8[_0xa27f('0x37')]=_['keys'](_0xc9164f[_0xa27f('0x37')]);_0x7eb8d8[_0xa27f('0x38')]=_['intersection'](_0x7eb8d8[_0xa27f('0x36')],_0x7eb8d8[_0xa27f('0x37')]);_0xaec095[_0xa27f('0x3a')]=_['intersection'](_0x7eb8d8['model'],qs['fields'](_0xc9164f[_0xa27f('0x37')][_0xa27f('0x3b')]));_0xaec095['attributes']=_0xaec095[_0xa27f('0x3a')][_0xa27f('0x4c')]?_0xaec095['attributes']:_0x7eb8d8[_0xa27f('0x36')];if(_0xc9164f[_0xa27f('0x37')][_0xa27f('0x46')]){_0xaec095[_0xa27f('0x47')]=[{'all':!![]}];}_0xaec095=_[_0xa27f('0x43')]({},_0xaec095,_0xc9164f[_0xa27f('0x45')]);return db['VoiceMusicOnHold'][_0xa27f('0x4d')](_0xaec095)['then'](handleEntityNotFound(_0x2a98cf,null))[_0xa27f('0x26')](respondWithResult(_0x2a98cf,null))['catch'](handleError(_0x2a98cf,null));};exports[_0xa27f('0x24')]=function(_0x315edb,_0xd8f9ef){if(_0x315edb['body']['id']){delete _0x315edb[_0xa27f('0x4e')]['id'];}return db[_0xa27f('0x31')][_0xa27f('0x4d')]({'where':{'id':_0x315edb[_0xa27f('0x4b')]['id']}})[_0xa27f('0x26')](handleEntityNotFound(_0xd8f9ef,null))['then'](saveUpdates(_0x315edb[_0xa27f('0x4e')],null))[_0xa27f('0x26')](respondWithResult(_0xd8f9ef,null))['catch'](handleError(_0xd8f9ef,null));};exports[_0xa27f('0x4f')]=function(_0x3ce2a4,_0x531406,_0x2c660b){return db[_0xa27f('0x50')][_0xa27f('0x51')](function(_0x79a1c2){if(_0x3ce2a4['body']['mode']===_0xa27f('0x52')){_0x3ce2a4[_0xa27f('0x4e')][_0xa27f('0x53')]=path[_0xa27f('0x54')](config[_0xa27f('0x55')],'server/files/moh',_0x3ce2a4['body']['name']);}return db[_0xa27f('0x31')][_0xa27f('0x4f')](_0x3ce2a4['body'],{'transaction':_0x79a1c2})[_0xa27f('0x26')](function(_0x516684){if(_0x3ce2a4[_0xa27f('0x4e')]['mode']===_0xa27f('0x52')){fs[_0xa27f('0x56')](_0x516684['directory'],parseInt('0777',0x8));}var _0x251477=_0x3ce2a4['user']['get']({'plain':!![]});if(!_0x251477)throw new Error(_0xa27f('0x57'));if(_0x251477[_0xa27f('0x58')]===_0xa27f('0x59')){var _0x41f7e6=_0x516684[_0xa27f('0x27')]({'plain':!![]});return db[_0xa27f('0x5a')][_0xa27f('0x4d')]({'where':{'name':_0xa27f('0x28'),'userProfileId':_0x251477['userProfileId']},'raw':!![]})[_0xa27f('0x26')](function(_0xfaa066){if(_0xfaa066&&_0xfaa066[_0xa27f('0x5b')]===0x0){return db[_0xa27f('0x29')][_0xa27f('0x4f')]({'name':_0x41f7e6['name'],'resourceId':_0x41f7e6['id'],'type':_0xfaa066[_0xa27f('0x2d')],'sectionId':_0xfaa066['id']},{})[_0xa27f('0x26')](function(){return _0x516684;});}else{return _0x516684;}})['catch'](function(_0x12f9ad){logger[_0xa27f('0x2b')](_0xa27f('0x5c'),_0x12f9ad);});}return _0x516684;});})['then'](respondWithResult(_0x531406,0xc9))[_0xa27f('0x4a')](handleError(_0x531406,null));};exports[_0xa27f('0x25')]=function(_0x11c820,_0x2dd03b,_0xafdcfc){var _0x468716;return db[_0xa27f('0x31')][_0xa27f('0x4d')]({'where':{'id':_0x11c820['params']['id']}})[_0xa27f('0x26')](function(_0x5a38b8){if(_0x5a38b8){return db[_0xa27f('0x50')][_0xa27f('0x51')](function(_0x80fb8e){return _0x5a38b8[_0xa27f('0x25')]({'transaction':_0x80fb8e,'raw':!![]})['then'](function(_0x39858d){if(_0x39858d[_0xa27f('0x53')]){fs[_0xa27f('0x5d')](_0x39858d[_0xa27f('0x53')])['forEach'](function(_0x3c832c){fs['unlinkSync'](path[_0xa27f('0x54')](_0x39858d[_0xa27f('0x53')],_0x3c832c));});fs[_0xa27f('0x5e')](_0x39858d[_0xa27f('0x53')]);}return _0x39858d;});})[_0xa27f('0x4a')](function(_0x1d3f35){throw new db['Sequelize'][(_0xa27f('0x5f'))](_0x1d3f35[_0xa27f('0x60')]);});}})[_0xa27f('0x26')](handleEntityNotFound(_0x2dd03b,null))['then'](removeEntity(_0x2dd03b,null))['catch'](handleError(_0x2dd03b,null));};exports[_0xa27f('0x61')]=function(_0x13eff3,_0x2c4010,_0x1e575d){return db[_0xa27f('0x50')]['transaction'](function(_0x48f670){var _0x1e1a6f;return db[_0xa27f('0x31')][_0xa27f('0x4d')]({'where':{'id':_0x13eff3[_0xa27f('0x4b')]['id']}})['then'](function(_0x1f4b47){if(_0x1f4b47){_0x1e1a6f=_0x1f4b47;return _0x1f4b47[_0xa27f('0x61')](_0x13eff3[_0xa27f('0x4e')]['id'],{'transaction':_0x48f670});}})[_0xa27f('0x26')](function(_0x43adf3){if(_0x43adf3){return db['Sound'][_0xa27f('0x62')]({'where':{'id':_0x13eff3[_0xa27f('0x4e')]['id']},'attributes':['id',_0xa27f('0x2d'),_0xa27f('0x63'),'converted_format',_0xa27f('0x64')],'raw':!![]});}})[_0xa27f('0x26')](function(_0x361c17){if(_0x361c17){var _0x2a0369=path[_0xa27f('0x54')](config[_0xa27f('0x55')],_0xa27f('0x65'),util['format'](_0xa27f('0x66'),path[_0xa27f('0x67')](_0x361c17[_0xa27f('0x63')],path[_0xa27f('0x68')](_0x361c17[_0xa27f('0x63')])),_0x361c17[_0xa27f('0x69')]));var _0x2393e4=path[_0xa27f('0x54')](config[_0xa27f('0x55')],_0xa27f('0x6a'),_0x1e1a6f[_0xa27f('0x2d')],util[_0xa27f('0x6b')](_0xa27f('0x66'),_0x361c17[_0xa27f('0x2d')],_0x361c17[_0xa27f('0x69')]));fs[_0xa27f('0x6c')](_0x2a0369,_0x2393e4);return _0x361c17;}})['catch'](function(_0x1fa63d){throw new db['Sequelize'][(_0xa27f('0x5f'))](_0x1fa63d[_0xa27f('0x60')]);});})[_0xa27f('0x26')](handleEntityNotFound(_0x2c4010,null))['then'](respondWithResult(_0x2c4010,0xc9))[_0xa27f('0x4a')](handleError(_0x2c4010,null));};exports[_0xa27f('0x6d')]=function(_0x32c23b,_0x33456d,_0x3e3801){return db[_0xa27f('0x50')][_0xa27f('0x51')](function(_0xd5d038){var _0x53e7c2;return db[_0xa27f('0x31')][_0xa27f('0x62')]({'where':{'id':_0x32c23b[_0xa27f('0x4b')]['id']}})[_0xa27f('0x26')](handleEntityNotFound(_0x33456d,null))['then'](function(_0x129732){if(_0x129732){_0x53e7c2=_0x129732;return _0x129732[_0xa27f('0x6d')](_0x32c23b[_0xa27f('0x4b')][_0xa27f('0x6e')]);}})['then'](function(_0x121732){if(_0x121732){return db['Sound'][_0xa27f('0x62')]({'where':{'id':_0x32c23b['params'][_0xa27f('0x6e')]},'attributes':['id',_0xa27f('0x2d'),_0xa27f('0x63'),_0xa27f('0x69'),_0xa27f('0x64')],'raw':!![]});}})[_0xa27f('0x26')](function(_0x1c7511){if(_0x1c7511){fs[_0xa27f('0x6f')](path[_0xa27f('0x54')](_0x53e7c2[_0xa27f('0x53')],util[_0xa27f('0x6b')](_0xa27f('0x66'),_0x1c7511[_0xa27f('0x2d')],_0x1c7511[_0xa27f('0x69')])));return _0x1c7511;}})[_0xa27f('0x4a')](function(_0x47d439){throw new db[(_0xa27f('0x70'))][(_0xa27f('0x5f'))](_0x47d439[_0xa27f('0x60')]);});})[_0xa27f('0x26')](handleEntityNotFound(_0x33456d,null))[_0xa27f('0x26')](respondWithStatusCode(_0x33456d,0xcc))['catch'](handleError(_0x33456d,null));};exports[_0xa27f('0x71')]=function(_0x11b8d8,_0x435630,_0x227a47){var _0x399578={};var _0xb0dbf7={};var _0x45de06;var _0x71f455;return db[_0xa27f('0x31')][_0xa27f('0x62')]({'where':{'id':_0x11b8d8[_0xa27f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x435630,null))[_0xa27f('0x26')](function(_0x45e51a){if(_0x45e51a){_0x45de06=_0x45e51a;_0xb0dbf7[_0xa27f('0x36')]=_[_0xa27f('0x72')](db[_0xa27f('0x73')][_0xa27f('0x32')]);_0xb0dbf7['query']=_[_0xa27f('0x72')](_0x11b8d8['query']);_0xb0dbf7[_0xa27f('0x38')]=_['intersection'](_0xb0dbf7[_0xa27f('0x36')],_0xb0dbf7['query']);_0x399578['attributes']=_['intersection'](_0xb0dbf7[_0xa27f('0x36')],qs['fields'](_0x11b8d8[_0xa27f('0x37')][_0xa27f('0x3b')]));_0x399578[_0xa27f('0x3a')]=_0x399578[_0xa27f('0x3a')][_0xa27f('0x4c')]?_0x399578['attributes']:_0xb0dbf7[_0xa27f('0x36')];_0x399578[_0xa27f('0x3e')]=qs[_0xa27f('0x3f')](_0x11b8d8['query'][_0xa27f('0x3f')]);_0x399578[_0xa27f('0x40')]=qs[_0xa27f('0x38')](_[_0xa27f('0x41')](_0x11b8d8[_0xa27f('0x37')],_0xb0dbf7[_0xa27f('0x38')]));if(_0x11b8d8[_0xa27f('0x37')][_0xa27f('0x42')]){_0x399578['where']=_[_0xa27f('0x43')](_0x399578[_0xa27f('0x40')],{'$or':_['map'](_0x399578[_0xa27f('0x3a')],function(_0x581222){var _0x2a71d0={};_0x2a71d0[_0x581222]={'$like':'%'+_0x11b8d8['query'][_0xa27f('0x42')]+'%'};return _0x2a71d0;})});}_0x399578=_[_0xa27f('0x43')]({},_0x399578,_0x11b8d8['options']);return _0x45de06[_0xa27f('0x71')](_0x399578);}})['then'](function(_0x46e116){if(_0x46e116){_0x71f455=_0x46e116[_0xa27f('0x4c')];if(!_0x11b8d8[_0xa27f('0x37')][_0xa27f('0x3c')](_0xa27f('0x3d'))){_0x399578[_0xa27f('0x1d')]=qs['limit'](_0x11b8d8[_0xa27f('0x37')][_0xa27f('0x1d')]);_0x399578[_0xa27f('0x1b')]=qs[_0xa27f('0x1b')](_0x11b8d8[_0xa27f('0x37')][_0xa27f('0x1b')]);}return _0x45de06['getSounds'](_0x399578);}})[_0xa27f('0x26')](function(_0x330a2f){if(_0x330a2f){return _0x330a2f?{'count':_0x71f455,'rows':_0x330a2f}:null;}})['then'](respondWithResult(_0x435630,null))[_0xa27f('0x4a')](handleError(_0x435630,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index e82c362..6d64e7f 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 _0xa9a4=['moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api'];(function(_0x4c68e6,_0x243b36){var _0x41ac1a=function(_0xf89c2e){while(--_0xf89c2e){_0x4c68e6['push'](_0x4c68e6['shift']());}};_0x41ac1a(++_0x243b36);}(_0xa9a4,0x88));var _0x4a9a=function(_0x1dc14f,_0x2f9b4e){_0x1dc14f=_0x1dc14f-0x0;var _0x3b3272=_0xa9a4[_0x1dc14f];return _0x3b3272;};'use strict';var _=require(_0x4a9a('0x0'));var util=require(_0x4a9a('0x1'));var logger=require(_0x4a9a('0x2'))(_0x4a9a('0x3'));var moment=require(_0x4a9a('0x4'));var BPromise=require(_0x4a9a('0x5'));var rp=require(_0x4a9a('0x6'));var fs=require('fs');var path=require(_0x4a9a('0x7'));var rimraf=require(_0x4a9a('0x8'));var config=require('../../config/environment');var attributes=require(_0x4a9a('0x9'));module[_0x4a9a('0xa')]=function(_0x5b9033,_0x4f0fe2){return _0x5b9033[_0x4a9a('0xb')](_0x4a9a('0xc'),attributes,{'tableName':_0x4a9a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf16=['moment','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0xdf16,0x8b));var _0x6df1=function(_0x4f2330,_0x371cd7){_0x4f2330=_0x4f2330-0x0;var _0x38016f=_0xdf16[_0x4f2330];return _0x38016f;};'use strict';var _=require(_0x6df1('0x0'));var util=require(_0x6df1('0x1'));var logger=require(_0x6df1('0x2'))(_0x6df1('0x3'));var moment=require(_0x6df1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6df1('0x5'));var config=require('../../config/environment');var attributes=require(_0x6df1('0x6'));module[_0x6df1('0x7')]=function(_0xa7bc8b,_0x439ed6){return _0xa7bc8b[_0x6df1('0x8')](_0x6df1('0x9'),attributes,{'tableName':_0x6df1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 4af15cc..ef1808a 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x919408,_0x2b3000){var _0x1d0362=function(_0xead4aa){while(--_0xead4aa){_0x919408['push'](_0x919408['shift']());}};_0x1d0362(++_0x2b3000);}(_0xedd9,0xfc));var _0x9edd=function(_0x3db639,_0x59d613){_0x3db639=_0x3db639-0x0;var _0x337446=_0xedd9[_0x3db639];return _0x337446;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x125c5b,_0x2f03be){var _0x381658=function(_0x52bf43){while(--_0x52bf43){_0x125c5b['push'](_0x125c5b['shift']());}};_0x381658(++_0x2f03be);}(_0x34e8,0x12c));var _0x834e=function(_0x32ffe0,_0x18d30f){_0x32ffe0=_0x32ffe0-0x0;var _0x42325c=_0x34e8[_0x32ffe0];return _0x42325c;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index a2c6e75..84de876 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 _0x5343=['getTeams','post','create','/:id/users','addAgents','/:id/teams','put','delete','destroy','removeAgents','removeTeams','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x228b22,_0xe9493b){var _0x5168a6=function(_0x106ef0){while(--_0x106ef0){_0x228b22['push'](_0x228b22['shift']());}};_0x5168a6(++_0xe9493b);}(_0x5343,0x123));var _0x3534=function(_0x320f87,_0x33931b){_0x320f87=_0x320f87-0x0;var _0x3c4470=_0x5343[_0x320f87];return _0x3c4470;};'use strict';var multer=require(_0x3534('0x0'));var util=require(_0x3534('0x1'));var path=require(_0x3534('0x2'));var timeout=require(_0x3534('0x3'));var express=require('express');var router=express[_0x3534('0x4')]();var fs_extra=require(_0x3534('0x5'));var auth=require(_0x3534('0x6'));var interaction=require(_0x3534('0x7'));var config=require(_0x3534('0x8'));var controller=require(_0x3534('0x9'));router[_0x3534('0xa')]('/',auth[_0x3534('0xb')](),controller[_0x3534('0xc')]);router[_0x3534('0xa')](_0x3534('0xd'),auth[_0x3534('0xb')](),controller[_0x3534('0xe')]);router[_0x3534('0xa')](_0x3534('0xf'),auth[_0x3534('0xb')](),controller[_0x3534('0x10')]);router[_0x3534('0xa')]('/:id/users',auth[_0x3534('0xb')](),controller['getAgents']);router[_0x3534('0xa')]('/:id/teams',auth[_0x3534('0xb')](),controller[_0x3534('0x11')]);router[_0x3534('0x12')]('/',auth[_0x3534('0xb')](),controller[_0x3534('0x13')]);router[_0x3534('0x12')](_0x3534('0x14'),auth[_0x3534('0xb')](),controller[_0x3534('0x15')]);router['post'](_0x3534('0x16'),auth[_0x3534('0xb')](),controller['addTeams']);router[_0x3534('0x17')](_0x3534('0xf'),auth[_0x3534('0xb')](),controller['update']);router[_0x3534('0x18')](_0x3534('0xf'),auth[_0x3534('0xb')](),controller[_0x3534('0x19')]);router[_0x3534('0x18')](_0x3534('0x14'),auth[_0x3534('0xb')](),controller[_0x3534('0x1a')]);router['delete'](_0x3534('0x16'),auth['isAuthenticated'](),controller[_0x3534('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xfde9=['isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','post','create','/:id/users','addAgents','addTeams','put','update','delete','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voicePrefix.controller','get'];(function(_0x267616,_0x19487d){var _0xe59e36=function(_0x4e61e9){while(--_0x4e61e9){_0x267616['push'](_0x267616['shift']());}};_0xe59e36(++_0x19487d);}(_0xfde9,0x66));var _0x9fde=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xfde9[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x9fde('0x0'));var util=require(_0x9fde('0x1'));var path=require(_0x9fde('0x2'));var timeout=require(_0x9fde('0x3'));var express=require(_0x9fde('0x4'));var router=express['Router']();var fs_extra=require(_0x9fde('0x5'));var auth=require(_0x9fde('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9fde('0x7'));var controller=require(_0x9fde('0x8'));router[_0x9fde('0x9')]('/',auth[_0x9fde('0xa')](),controller[_0x9fde('0xb')]);router[_0x9fde('0x9')](_0x9fde('0xc'),auth[_0x9fde('0xa')](),controller[_0x9fde('0xd')]);router[_0x9fde('0x9')](_0x9fde('0xe'),auth[_0x9fde('0xa')](),controller[_0x9fde('0xf')]);router[_0x9fde('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x9fde('0x9')](_0x9fde('0x10'),auth[_0x9fde('0xa')](),controller['getTeams']);router[_0x9fde('0x11')]('/',auth[_0x9fde('0xa')](),controller[_0x9fde('0x12')]);router[_0x9fde('0x11')](_0x9fde('0x13'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x14')]);router[_0x9fde('0x11')](_0x9fde('0x10'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x15')]);router[_0x9fde('0x16')](_0x9fde('0xe'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x17')]);router[_0x9fde('0x18')](_0x9fde('0xe'),auth[_0x9fde('0xa')](),controller['destroy']);router[_0x9fde('0x18')](_0x9fde('0x13'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x19')]);router['delete'](_0x9fde('0x10'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x1a')]);module[_0x9fde('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 67ce435..ca923f0 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 _0x55bd=['VIRTUAL','getDataValue','INTEGER','exports','STRING','name'];(function(_0x35d06a,_0x81abc0){var _0x3cf8a5=function(_0x2693f){while(--_0x2693f){_0x35d06a['push'](_0x35d06a['shift']());}};_0x3cf8a5(++_0x81abc0);}(_0x55bd,0x81));var _0xd55b=function(_0x35a56d,_0x30d2c1){_0x35a56d=_0x35a56d-0x0;var _0x49ce52=_0x55bd[_0x35a56d];return _0x49ce52;};'use strict';var Sequelize=require('sequelize');module[_0xd55b('0x0')]={'name':{'type':Sequelize[_0xd55b('0x1')],'allowNull':![],'unique':_0xd55b('0x2')},'prefix':{'type':Sequelize[_0xd55b('0x3')],'get':function(_0x225b0a){return'system-'+this[_0xd55b('0x4')](_0xd55b('0x2'))+'-';}},'description':{'type':Sequelize[_0xd55b('0x1')]},'callerIdAll':{'type':Sequelize[_0xd55b('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xd55b('0x5')]}}; \ No newline at end of file +var _0x9d34=['exports','name','VIRTUAL','system-','getDataValue','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9d34,0xa7));var _0x49d3=function(_0x14525d,_0x747b83){_0x14525d=_0x14525d-0x0;var _0x26b05c=_0x9d34[_0x14525d];return _0x26b05c;};'use strict';var Sequelize=require(_0x49d3('0x0'));module[_0x49d3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x49d3('0x2')},'prefix':{'type':Sequelize[_0x49d3('0x3')],'get':function(_0x2b781c){return _0x49d3('0x4')+this[_0x49d3('0x5')](_0x49d3('0x2'))+'-';}},'description':{'type':Sequelize[_0x49d3('0x6')]},'callerIdAll':{'type':Sequelize[_0x49d3('0x6')]},'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 bae768a..65c9f9b 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 _0x4b17=['status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','stack','name','send','map','VoicePrefix','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','catch','params','rawAttributes','includeAll','options','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','context','from-sip','exten','app','type','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','Agents','voicePause','flatMap','each','upsert','findOrCreate','forEach','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','isEmpty','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','redis','localhost','register','sendStatus'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4b17,0x10f));var _0x74b1=function(_0x254076,_0x5e7b8d){_0x254076=_0x254076-0x0;var _0x21a93e=_0x4b17[_0x254076];return _0x21a93e;};'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'];config['redis']=_['defaults'](config[_0x74b1('0x17')],{'host':_0x74b1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voicePrefix.socket')[_0x74b1('0x19')](socket);function respondWithStatusCode(_0x5c12eb,_0x4e289b){_0x4e289b=_0x4e289b||0xcc;return function(_0x2ccba6){if(_0x2ccba6){return _0x5c12eb[_0x74b1('0x1a')](_0x4e289b);}return _0x5c12eb[_0x74b1('0x1b')](_0x4e289b)[_0x74b1('0x1c')]();};}function respondWithResult(_0x16b147,_0x10138e){_0x10138e=_0x10138e||0xc8;return function(_0x528e8c){if(_0x528e8c){return _0x16b147[_0x74b1('0x1b')](_0x10138e)[_0x74b1('0x1d')](_0x528e8c);}};}function respondWithFilteredResult(_0x1a0851,_0x2cfcc3){return function(_0xde2736){if(_0xde2736){var _0x8c9510=typeof _0x2cfcc3[_0x74b1('0x1e')]==='undefined'&&typeof _0x2cfcc3[_0x74b1('0x1f')]===_0x74b1('0x20');var _0x524ece=_0xde2736[_0x74b1('0x21')];var _0x38d932=_0x8c9510?0x0:_0x2cfcc3[_0x74b1('0x1e')];var _0x25704e=_0x8c9510?_0xde2736[_0x74b1('0x21')]:_0x2cfcc3[_0x74b1('0x1e')]+_0x2cfcc3[_0x74b1('0x1f')];var _0xaac5f7;if(_0x25704e>=_0x524ece){_0x25704e=_0x524ece;_0xaac5f7=0xc8;}else{_0xaac5f7=0xce;}_0x1a0851['status'](_0xaac5f7);return _0x1a0851[_0x74b1('0x22')]('Content-Range',_0x38d932+'-'+_0x25704e+'/'+_0x524ece)['json'](_0xde2736);}return null;};}function patchUpdates(_0x481bf2){return function(_0x27fd1a){try{jsonpatch[_0x74b1('0x23')](_0x27fd1a,_0x481bf2,!![]);}catch(_0x405a22){return BPromise[_0x74b1('0x24')](_0x405a22);}return _0x27fd1a[_0x74b1('0x25')]();};}function saveUpdates(_0x4ee88b,_0x3c78e5){return function(_0x4eca36){if(_0x4eca36){return _0x4eca36[_0x74b1('0x26')](_0x4ee88b)[_0x74b1('0x27')](function(_0xb5af0){return _0xb5af0;});}return null;};}function removeEntity(_0x14a651,_0x3239d8){return function(_0x322de5){if(_0x322de5){return _0x322de5[_0x74b1('0x28')]()[_0x74b1('0x27')](function(){var _0x4c7f05=_0x322de5[_0x74b1('0x29')]({'plain':!![]});var _0x42b69d=_0x74b1('0x2a');return db['UserProfileResource'][_0x74b1('0x28')]({'where':{'type':_0x42b69d,'resourceId':_0x4c7f05['id']}})[_0x74b1('0x27')](function(){return _0x322de5;});})[_0x74b1('0x27')](function(){_0x14a651[_0x74b1('0x1b')](0xcc)[_0x74b1('0x1c')]();});}};}function handleEntityNotFound(_0x273ff1,_0x436eda){return function(_0x3ce043){if(!_0x3ce043){_0x273ff1['sendStatus'](0x194);}return _0x3ce043;};}function handleError(_0xe74c82,_0x40b32a){_0x40b32a=_0x40b32a||0x1f4;return function(_0x51ce6d){logger[_0x74b1('0x2b')](_0x51ce6d[_0x74b1('0x2c')]);if(_0x51ce6d[_0x74b1('0x2d')]){delete _0x51ce6d['name'];}_0xe74c82[_0x74b1('0x1b')](_0x40b32a)[_0x74b1('0x2e')](_0x51ce6d);};}exports['index']=function(_0x3dbf18,_0x33ec7c){var _0x2211b2={},_0x31c321={},_0x68a3bd={'count':0x0,'rows':[]};var _0x32a8d6=_[_0x74b1('0x2f')](db[_0x74b1('0x30')]['rawAttributes'],function(_0x3d5fc0){return{'name':_0x3d5fc0['fieldName'],'type':_0x3d5fc0['type'][_0x74b1('0x31')]};});_0x31c321['model']=_['map'](_0x32a8d6,_0x74b1('0x2d'));_0x31c321[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x3dbf18[_0x74b1('0x32')]);_0x31c321[_0x74b1('0x34')]=_[_0x74b1('0x35')](_0x31c321[_0x74b1('0x36')],_0x31c321[_0x74b1('0x32')]);_0x2211b2['attributes']=_['intersection'](_0x31c321['model'],qs[_0x74b1('0x37')](_0x3dbf18['query']['fields']));_0x2211b2[_0x74b1('0x38')]=_0x2211b2[_0x74b1('0x38')][_0x74b1('0x39')]?_0x2211b2['attributes']:_0x31c321[_0x74b1('0x36')];if(!_0x3dbf18['query'][_0x74b1('0x3a')](_0x74b1('0x3b'))){_0x2211b2['limit']=qs['limit'](_0x3dbf18[_0x74b1('0x32')][_0x74b1('0x1f')]);_0x2211b2['offset']=qs['offset'](_0x3dbf18[_0x74b1('0x32')]['offset']);}_0x2211b2[_0x74b1('0x3c')]=qs[_0x74b1('0x3d')](_0x3dbf18[_0x74b1('0x32')][_0x74b1('0x3d')]);_0x2211b2[_0x74b1('0x3e')]=qs['filters'](_[_0x74b1('0x3f')](_0x3dbf18['query'],_0x31c321[_0x74b1('0x34')]),_0x32a8d6);if(_0x3dbf18['query'][_0x74b1('0x40')]){_0x2211b2['where']=_['merge'](_0x2211b2[_0x74b1('0x3e')],{'$or':_[_0x74b1('0x2f')](_0x32a8d6,function(_0x2725fd){if(_0x2725fd['type']!==_0x74b1('0x41')){var _0x327334={};_0x327334[_0x2725fd[_0x74b1('0x2d')]]={'$like':'%'+_0x3dbf18['query'][_0x74b1('0x40')]+'%'};return _0x327334;}})});}_0x2211b2=_[_0x74b1('0x42')]({},_0x2211b2,_0x3dbf18['options']);var _0x48ac05={'where':_0x2211b2[_0x74b1('0x3e')]};return db[_0x74b1('0x30')][_0x74b1('0x21')](_0x48ac05)[_0x74b1('0x27')](function(_0x1d9f5b){_0x68a3bd[_0x74b1('0x21')]=_0x1d9f5b;if(_0x3dbf18[_0x74b1('0x32')]['includeAll']){_0x2211b2[_0x74b1('0x43')]=[{'all':!![]}];}return db[_0x74b1('0x30')][_0x74b1('0x44')](_0x2211b2);})[_0x74b1('0x27')](function(_0x17a44f){_0x68a3bd['rows']=_0x17a44f;return _0x68a3bd;})[_0x74b1('0x27')](respondWithFilteredResult(_0x33ec7c,_0x2211b2))[_0x74b1('0x45')](handleError(_0x33ec7c,null));};exports['show']=function(_0x50d9de,_0x1b7a58){var _0x3c3c3c={'raw':![],'where':{'id':_0x50d9de[_0x74b1('0x46')]['id']}},_0x54c94b={};_0x54c94b[_0x74b1('0x36')]=_[_0x74b1('0x33')](db[_0x74b1('0x30')][_0x74b1('0x47')]);_0x54c94b[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x50d9de['query']);_0x54c94b['filters']=_['intersection'](_0x54c94b[_0x74b1('0x36')],_0x54c94b[_0x74b1('0x32')]);_0x3c3c3c[_0x74b1('0x38')]=_[_0x74b1('0x35')](_0x54c94b[_0x74b1('0x36')],qs['fields'](_0x50d9de[_0x74b1('0x32')][_0x74b1('0x37')]));_0x3c3c3c[_0x74b1('0x38')]=_0x3c3c3c[_0x74b1('0x38')][_0x74b1('0x39')]?_0x3c3c3c[_0x74b1('0x38')]:_0x54c94b[_0x74b1('0x36')];if(_0x50d9de[_0x74b1('0x32')][_0x74b1('0x48')]){_0x3c3c3c[_0x74b1('0x43')]=[{'all':!![]}];}_0x3c3c3c=_[_0x74b1('0x42')]({},_0x3c3c3c,_0x50d9de[_0x74b1('0x49')]);return db['VoicePrefix'][_0x74b1('0x4a')](_0x3c3c3c)[_0x74b1('0x27')](handleEntityNotFound(_0x1b7a58,null))['then'](respondWithResult(_0x1b7a58,null))[_0x74b1('0x45')](handleError(_0x1b7a58,null));};exports['destroy']=function(_0x4b1add,_0x2073eb){return db['VoicePrefix'][_0x74b1('0x4a')]({'where':{'id':_0x4b1add[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x2073eb,null))['then'](removeEntity(_0x2073eb,null))[_0x74b1('0x45')](handleError(_0x2073eb,null));};exports[_0x74b1('0x4b')]=function(_0x1b2d51,_0x3d199b){return db[_0x74b1('0x30')]['describe']()[_0x74b1('0x27')](respondWithResult(_0x3d199b,null))['catch'](handleError(_0x3d199b,null));};exports[_0x74b1('0x4c')]=function(_0x4085b8,_0x5e458c){var _0x1be639;return db[_0x74b1('0x4d')][_0x74b1('0x4e')](function(_0x54a221){return db[_0x74b1('0x30')][_0x74b1('0x4c')](_0x4085b8['body'],{'transaction':_0x54a221})[_0x74b1('0x27')](function(_0x4fdd6b){_0x1be639=_0x4fdd6b['get']({'plain':!![]});return db[_0x74b1('0x4f')][_0x74b1('0x4a')]({'where':{'id':_0x1be639[_0x74b1('0x50')]},'raw':!![]})[_0x74b1('0x27')](function(_0x41b45f){return createVoicePrefixExtensions(_0x1be639,_0x41b45f,_0x54a221);});});})['then'](function(){var _0x145ce3=_0x4085b8[_0x74b1('0x51')]['get']({'plain':!![]});if(!_0x145ce3)throw new Error(_0x74b1('0x52'));if(_0x145ce3[_0x74b1('0x53')]===_0x74b1('0x51')){var _0x5634d1=_0x1be639;return db[_0x74b1('0x54')][_0x74b1('0x4a')]({'where':{'name':_0x74b1('0x2a'),'userProfileId':_0x145ce3['userProfileId']},'raw':!![]})[_0x74b1('0x27')](function(_0x3b4338){if(_0x3b4338&&_0x3b4338[_0x74b1('0x55')]===0x0){return db[_0x74b1('0x56')][_0x74b1('0x4c')]({'name':_0x5634d1[_0x74b1('0x2d')],'resourceId':_0x5634d1['id'],'type':_0x3b4338['name'],'sectionId':_0x3b4338['id']},{})[_0x74b1('0x27')](function(){return _0x1be639;});}else{return _0x1be639;}})['catch'](function(_0x5343c4){logger[_0x74b1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5343c4);throw _0x5343c4;});}return _0x1be639;})['then'](respondWithResult(_0x5e458c,null))[_0x74b1('0x45')](handleError(_0x5e458c,null));};function Extension(_0x29ab63,_0x16db5c,_0x515a8e,_0x204b7d){this[_0x74b1('0x57')]=_0x74b1('0x58');this[_0x74b1('0x59')]=_0x29ab63;this[_0x74b1('0x5a')]=_0x515a8e;this[_0x74b1('0x5b')]=_0x74b1('0x5c');this[_0x74b1('0x5d')]=_0x74b1('0x5e');this[_0x74b1('0x5f')]=_0x16db5c;this[_0x74b1('0x60')]=_0x204b7d;}function createVoicePrefixExtensions(_0x112721,_0x516e44,_0x598daa){return new BPromise(function(_0x2a46ca,_0x553615){var _0x15eb38=new Extension(formatPrefixName(_0x112721[_0x74b1('0x61')]),0x1,'NoOp','Voice\x20Prefix');_0x15eb38[_0x74b1('0x62')]=_0x112721['id'];return db[_0x74b1('0x4f')][_0x74b1('0x4c')](_0x15eb38,{'transaction':_0x598daa})[_0x74b1('0x27')](function(_0x3dd0c3){var _0x1f879f=_0x3dd0c3[_0x74b1('0x29')]({'plain':!![]});var _0x1fb137=_[_0x74b1('0x2f')](addVoicePrefixExtensions(_0x112721,_0x516e44),function(_0x128a7e){_0x128a7e[_0x74b1('0x50')]=_0x1f879f['id'];_0x128a7e[_0x74b1('0x62')]=_0x112721['id'];return _0x128a7e;});return db['VoiceExtension'][_0x74b1('0x63')](_0x1fb137,{'transaction':_0x598daa})[_0x74b1('0x27')](function(_0x378f63){if(!_0x378f63){return _0x553615(_0x74b1('0x64'));}else{return _0x2a46ca(_0x378f63);}})['catch'](function(_0x308b98){return _0x553615(_0x308b98);});});;});};function addVoicePrefixExtensions(_0x1709d9,_0x5ada76){var _0x425f9f=[];var _0x4d2fcb=formatPrefixName(_0x1709d9[_0x74b1('0x61')]);_0x425f9f[_0x74b1('0x65')](new Extension(_0x4d2fcb,0x2,'Set',_0x74b1('0x66')+_0x1709d9[_0x74b1('0x2d')]));if(_0x1709d9[_0x74b1('0x67')]){_0x425f9f['push'](new Extension(_0x4d2fcb,0x3,_0x74b1('0x68'),'PREFIX-CALLERIDALL='+_0x1709d9[_0x74b1('0x67')]));}else{_0x425f9f[_0x74b1('0x65')](new Extension(_0x4d2fcb,0x3,_0x74b1('0x69'),_0x74b1('0x6a')));}_0x425f9f[_0x74b1('0x65')](new Extension(_0x4d2fcb,0x4,_0x74b1('0x6b'),_0x5ada76[_0x74b1('0x57')]+','+_0x74b1('0x6c')+(0x8+_0x1709d9[_0x74b1('0x2d')][_0x74b1('0x39')])+'}'+','+0x1));return _0x425f9f;}function formatPrefixName(_0x8b4902){var _0x44563d='_';for(var _0x2a33c9=0x0;_0x2a33c9<_0x8b4902['length'];_0x2a33c9++){if(_0x8b4902[_0x74b1('0x6d')](_0x2a33c9)=='-'){_0x44563d+=_0x8b4902[_0x74b1('0x6d')](_0x2a33c9);}else{_0x44563d+='['+_0x8b4902[_0x74b1('0x6d')](_0x2a33c9)+']';}}_0x44563d+='.';return _0x44563d;}exports[_0x74b1('0x26')]=function(_0x30692c,_0x228f8f,_0x2e94d6){var _0x7e2bcc=_0x30692c[_0x74b1('0x6e')];_0x7e2bcc['prefix']=_0x74b1('0x6f')+_0x7e2bcc['name']+'-';return db[_0x74b1('0x4d')]['transaction'](function(_0x5886d1){return db[_0x74b1('0x30')][_0x74b1('0x26')](_0x7e2bcc,{'where':{'id':_0x7e2bcc['id']},'transaction':_0x5886d1})[_0x74b1('0x27')](function(){return db['VoiceExtension'][_0x74b1('0x28')]({'where':{'VoicePrefixId':_0x7e2bcc['id']},'transaction':_0x5886d1})[_0x74b1('0x27')](function(){return db['VoiceExtension'][_0x74b1('0x4a')]({'where':{'id':_0x7e2bcc[_0x74b1('0x50')]},'raw':!![]})[_0x74b1('0x27')](function(_0x21e767){return createVoicePrefixExtensions(_0x7e2bcc,_0x21e767,_0x5886d1);});});});})[_0x74b1('0x27')](function(){return db[_0x74b1('0x30')][_0x74b1('0x70')](_0x7e2bcc['id']);})[_0x74b1('0x27')](respondWithResult(_0x228f8f,null))[_0x74b1('0x45')](handleError(_0x228f8f,null));};exports[_0x74b1('0x71')]=function(_0x542ee7,_0x2b1119,_0x3267ef){return db[_0x74b1('0x30')]['find']({'where':{'id':_0x542ee7[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x2b1119,null))[_0x74b1('0x27')](function(_0x1a6a70){if(_0x1a6a70){return _0x1a6a70[_0x74b1('0x71')](_0x542ee7['body'][_0x74b1('0x72')],_[_0x74b1('0x73')](_0x542ee7[_0x74b1('0x6e')],[_0x74b1('0x72'),'id'])||{})[_0x74b1('0x74')](function(_0x36733f){for(var _0x359e05=0x0;_0x359e05<_0x542ee7[_0x74b1('0x6e')]['ids'][_0x74b1('0x39')];_0x359e05+=0x1){socket[_0x74b1('0x75')](_0x74b1('0x76'),{'UserId':Number(_0x542ee7['body']['ids'][_0x359e05]),'VoicePrefixId':Number(_0x542ee7[_0x74b1('0x46')]['id'])});}return _0x36733f;});}})[_0x74b1('0x27')](respondWithResult(_0x2b1119,null))[_0x74b1('0x45')](handleError(_0x2b1119,null));};exports[_0x74b1('0x77')]=function(_0x2de935,_0x5d8729,_0x42a630){return db['VoicePrefix']['find']({'where':{'id':_0x2de935[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x5d8729,null))[_0x74b1('0x27')](function(_0x2da0f2){if(_0x2da0f2){return _0x2da0f2[_0x74b1('0x77')](_0x2de935[_0x74b1('0x32')][_0x74b1('0x72')])[_0x74b1('0x27')](function(){if(_['isArray'](_0x2de935['query']['ids'])){for(var _0x7ec28f=0x0;_0x7ec28f<_0x2de935[_0x74b1('0x32')][_0x74b1('0x72')][_0x74b1('0x39')];_0x7ec28f+=0x1){socket[_0x74b1('0x75')](_0x74b1('0x78'),{'UserId':Number(_0x2de935[_0x74b1('0x32')][_0x74b1('0x72')][_0x7ec28f]),'VoicePrefixId':Number(_0x2de935[_0x74b1('0x46')]['id'])});}}else{socket[_0x74b1('0x75')](_0x74b1('0x78'),{'UserId':Number(_0x2de935[_0x74b1('0x32')]['ids']),'VoicePrefixId':Number(_0x2de935[_0x74b1('0x46')]['id'])});}});}})[_0x74b1('0x27')](respondWithStatusCode(_0x5d8729,null))[_0x74b1('0x45')](handleError(_0x5d8729,null));};exports[_0x74b1('0x79')]=function(_0x25f929,_0x138f79,_0x5a07a6){var _0x2567d7={};var _0x32eb2d={};var _0x21c54f;var _0x4b025c;return db[_0x74b1('0x30')][_0x74b1('0x7a')]({'where':{'id':_0x25f929[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x138f79,null))['then'](function(_0x7d3f08){if(_0x7d3f08){_0x21c54f=_0x7d3f08;_0x32eb2d[_0x74b1('0x36')]=_[_0x74b1('0x33')](db[_0x74b1('0x7b')][_0x74b1('0x47')]);_0x32eb2d['query']=_[_0x74b1('0x33')](_0x25f929[_0x74b1('0x32')]);_0x32eb2d['filters']=_[_0x74b1('0x35')](_0x32eb2d[_0x74b1('0x36')],_0x32eb2d['query']);_0x2567d7[_0x74b1('0x38')]=_[_0x74b1('0x35')](_0x32eb2d[_0x74b1('0x36')],qs[_0x74b1('0x37')](_0x25f929['query']['fields']));_0x2567d7[_0x74b1('0x38')]=_0x2567d7[_0x74b1('0x38')][_0x74b1('0x39')]?_0x2567d7['attributes']:_0x32eb2d[_0x74b1('0x36')];_0x2567d7[_0x74b1('0x3c')]=qs['sort'](_0x25f929['query'][_0x74b1('0x3d')]);_0x2567d7[_0x74b1('0x3e')]=qs[_0x74b1('0x34')](_['pick'](_0x25f929[_0x74b1('0x32')],_0x32eb2d[_0x74b1('0x34')]));if(_0x25f929[_0x74b1('0x32')][_0x74b1('0x40')]){_0x2567d7['where']=_['merge'](_0x2567d7[_0x74b1('0x3e')],{'$or':_[_0x74b1('0x2f')](_0x2567d7['attributes'],function(_0x1bf4a4){var _0x258b8f={};_0x258b8f[_0x1bf4a4]={'$like':'%'+_0x25f929[_0x74b1('0x32')][_0x74b1('0x40')]+'%'};return _0x258b8f;})});}_0x2567d7=_[_0x74b1('0x42')]({},_0x2567d7,_0x25f929[_0x74b1('0x49')]);return _0x21c54f[_0x74b1('0x79')](_0x2567d7);}})[_0x74b1('0x27')](function(_0x21453e){if(_0x21453e){_0x4b025c=_0x21453e[_0x74b1('0x39')];if(!_0x25f929['query'][_0x74b1('0x3a')](_0x74b1('0x3b'))){_0x2567d7[_0x74b1('0x1f')]=qs[_0x74b1('0x1f')](_0x25f929[_0x74b1('0x32')][_0x74b1('0x1f')]);_0x2567d7['offset']=qs[_0x74b1('0x1e')](_0x25f929['query'][_0x74b1('0x1e')]);}return _0x21c54f[_0x74b1('0x79')](_0x2567d7);}})[_0x74b1('0x27')](function(_0x4fcd9a){if(_0x4fcd9a){return _0x4fcd9a?{'count':_0x4b025c,'rows':_0x4fcd9a}:null;}})[_0x74b1('0x27')](respondWithResult(_0x138f79,null))[_0x74b1('0x45')](handleError(_0x138f79,null));};exports['getTeams']=function(_0x4a9ec5,_0x5c02fc,_0x1cbfde){var _0x6ac5ae={};var _0x1a223d={};var _0x25624b;var _0xb24035;return db[_0x74b1('0x30')][_0x74b1('0x7a')]({'where':{'id':_0x4a9ec5[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](handleEntityNotFound(_0x5c02fc,null))[_0x74b1('0x27')](function(_0x220cbf){if(_0x220cbf){_0x25624b=_0x220cbf;_0x1a223d[_0x74b1('0x36')]=_['keys'](db[_0x74b1('0x7c')][_0x74b1('0x47')]);_0x1a223d[_0x74b1('0x32')]=_['keys'](_0x4a9ec5[_0x74b1('0x32')]);_0x1a223d[_0x74b1('0x34')]=_[_0x74b1('0x35')](_0x1a223d['model'],_0x1a223d[_0x74b1('0x32')]);_0x6ac5ae[_0x74b1('0x38')]=_[_0x74b1('0x35')](_0x1a223d['model'],qs[_0x74b1('0x37')](_0x4a9ec5[_0x74b1('0x32')][_0x74b1('0x37')]));_0x6ac5ae[_0x74b1('0x38')]=_0x6ac5ae[_0x74b1('0x38')][_0x74b1('0x39')]?_0x6ac5ae[_0x74b1('0x38')]:_0x1a223d[_0x74b1('0x36')];_0x6ac5ae[_0x74b1('0x3c')]=qs[_0x74b1('0x3d')](_0x4a9ec5[_0x74b1('0x32')][_0x74b1('0x3d')]);_0x6ac5ae[_0x74b1('0x3e')]=qs[_0x74b1('0x34')](_[_0x74b1('0x3f')](_0x4a9ec5[_0x74b1('0x32')],_0x1a223d[_0x74b1('0x34')]));if(_0x4a9ec5['query'][_0x74b1('0x40')]){_0x6ac5ae[_0x74b1('0x3e')]=_['merge'](_0x6ac5ae[_0x74b1('0x3e')],{'$or':_[_0x74b1('0x2f')](_0x6ac5ae[_0x74b1('0x38')],function(_0x3e3dfb){var _0x1a5c1e={};_0x1a5c1e[_0x3e3dfb]={'$like':'%'+_0x4a9ec5[_0x74b1('0x32')]['filter']+'%'};return _0x1a5c1e;})});}_0x6ac5ae=_['merge']({},_0x6ac5ae,_0x4a9ec5[_0x74b1('0x49')]);return _0x25624b[_0x74b1('0x7d')](_0x6ac5ae);}})[_0x74b1('0x27')](function(_0x401599){if(_0x401599){_0xb24035=_0x401599[_0x74b1('0x39')];if(!_0x4a9ec5[_0x74b1('0x32')]['hasOwnProperty'](_0x74b1('0x3b'))){_0x6ac5ae[_0x74b1('0x1f')]=qs[_0x74b1('0x1f')](_0x4a9ec5[_0x74b1('0x32')]['limit']);_0x6ac5ae[_0x74b1('0x1e')]=qs[_0x74b1('0x1e')](_0x4a9ec5['query'][_0x74b1('0x1e')]);}return _0x25624b[_0x74b1('0x7d')](_0x6ac5ae);}})[_0x74b1('0x27')](function(_0x29de45){if(_0x29de45){return _0x29de45?{'count':_0xb24035,'rows':_0x29de45}:null;}})[_0x74b1('0x27')](respondWithResult(_0x5c02fc,null))[_0x74b1('0x45')](handleError(_0x5c02fc,null));};exports[_0x74b1('0x7e')]=function(_0x33b136,_0x4f9b6a,_0x8366b){var _0x2d356c=_0x33b136['body'][_0x74b1('0x72')];var _0x3719d7;return db[_0x74b1('0x7c')][_0x74b1('0x44')]({'where':{'id':_0x2d356c},'attributes':['id'],'include':[{'model':db[_0x74b1('0x7b')],'as':_0x74b1('0x7f'),'attributes':['id',_0x74b1('0x2d'),'online',_0x74b1('0x80'),'interface'],'raw':!![]}]})[_0x74b1('0x27')](function(_0x3bd788){if(_0x3bd788){_0x3719d7=_0x3bd788;var _0x5b4ecf=_[_0x74b1('0x81')](_0x3bd788,function(_0x5dbc1f){var _0x4aa62a=_0x5dbc1f[_0x74b1('0x29')]({'plain':!![]});return _0x4aa62a['Agents'];});return db[_0x74b1('0x30')]['find']({'where':{'id':_0x33b136[_0x74b1('0x46')]['id']}})['then'](function(_0x5b8ba6){return db[_0x74b1('0x4d')]['transaction'](function(_0x2ea97c){return _0x5b8ba6[_0x74b1('0x7e')](_0x2d356c,{'transaction':_0x2ea97c})[_0x74b1('0x27')](function(){return BPromise[_0x74b1('0x82')](_0x3719d7,function(_0x433293){return db['TeamVoicePrefix'][_0x74b1('0x83')]({'TeamId':_0x433293['id'],'VoicePrefixId':_0x33b136['params']['id']},{'transaction':_0x2ea97c});});})[_0x74b1('0x27')](function(){return BPromise[_0x74b1('0x82')](_0x5b4ecf,function(_0x110bb6){return db['UserVoicePrefix'][_0x74b1('0x84')]({'where':{'UserId':_0x110bb6['id'],'VoicePrefixId':_0x33b136[_0x74b1('0x46')]['id']},'transaction':_0x2ea97c});});})['then'](function(){_0x5b4ecf[_0x74b1('0x85')](function(_0xbaf7f4){socket[_0x74b1('0x75')](_0x74b1('0x76'),{'UserId':_0xbaf7f4['id'],'VoicePrefixId':_0x5b8ba6['id']});});});});});}})['then'](respondWithStatusCode(_0x4f9b6a,null))[_0x74b1('0x45')](handleError(_0x4f9b6a,null));};exports[_0x74b1('0x86')]=function(_0x1f2add,_0x1ab4ea,_0x5b3ae9){return db[_0x74b1('0x7c')][_0x74b1('0x44')]({'where':{'id':_0x1f2add['query'][_0x74b1('0x72')]},'attributes':['id'],'include':[{'model':db[_0x74b1('0x7b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x74b1('0x27')](handleEntityNotFound(_0x1ab4ea,null))[_0x74b1('0x27')](function(_0x39354d){var _0x484368=_['map'](_0x39354d,'id');var _0xfcd9b=[];var _0x1b3847=[];var _0x4880f6=squel['select']();_0x4880f6[_0x74b1('0x87')](_0x74b1('0x88'))['from'](_0x74b1('0x89'),'tq')[_0x74b1('0x8a')](_0x74b1('0x8b'),'ut',_0x74b1('0x8c'))[_0x74b1('0x3e')](_0x74b1('0x8d'),_0x1f2add[_0x74b1('0x46')]['id']);for(var _0x523ec1=0x0;_0x523ec1<_0x39354d[_0x74b1('0x39')];_0x523ec1+=0x1){let _0x304756=_0x39354d[_0x523ec1];for(var _0x3039d7=0x0;_0x3039d7<_0x304756[_0x74b1('0x7f')][_0x74b1('0x39')];_0x3039d7+=0x1){let _0x367373=_0x304756[_0x74b1('0x7f')][_0x3039d7];var _0x2ee3a7=_0x4880f6[_0x74b1('0x8e')]();_0x2ee3a7[_0x74b1('0x3e')]('ut.UserId\x20=\x20?',_0x367373['id']);_0x1b3847['push'](db['sequelize'][_0x74b1('0x32')](_0x2ee3a7[_0x74b1('0x8f')](),{'type':db['sequelize'][_0x74b1('0x90')][_0x74b1('0x91')]})[_0x74b1('0x27')](function(_0x399c7c){if(_0x399c7c['length']===0x1){return _0x367373['id'];}else{var _0xe421dc=_[_0x74b1('0x92')](_[_0x74b1('0x2f')](_0x399c7c,_0x74b1('0x93')),function(_0x58896f){return _['includes'](_0x484368,_0x58896f);});if(_0xe421dc){return _0x367373['id'];}}}));}}return BPromise['all'](_0x1b3847)[_0x74b1('0x27')](function(_0x20f41b){_0xfcd9b=_(_0xfcd9b)['union'](_0x20f41b)['compact']()['value']();return db[_0x74b1('0x30')]['find']({'where':{'id':_0x1f2add[_0x74b1('0x46')]['id']}})[_0x74b1('0x27')](function(_0x1326b3){return db['sequelize'][_0x74b1('0x4e')](function(_0x155534){return _0x1326b3['removeTeams'](_0x1f2add[_0x74b1('0x32')][_0x74b1('0x72')],{'transaction':_0x155534})[_0x74b1('0x27')](function(){if(!_[_0x74b1('0x94')](_0xfcd9b)){return _0x1326b3['removeAgents'](_0xfcd9b,{'transaction':_0x155534});}})[_0x74b1('0x27')](function(){_0xfcd9b[_0x74b1('0x85')](function(_0x4a9046){socket[_0x74b1('0x75')]('userVoicePrefix:remove',{'UserId':_0x4a9046,'VoicePrefixId':_0x1326b3['id']});});});});});});})[_0x74b1('0x27')](respondWithStatusCode(_0x1ab4ea,null))[_0x74b1('0x45')](handleError(_0x1ab4ea,null));}; \ No newline at end of file +var _0x02ce=['apply','reject','save','update','destroy','then','get','VoicePrefixes','UserProfileResource','sendStatus','error','name','send','index','map','VoicePrefix','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','sequelize','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','context','from-sip','exten','app','type','description','Voice\x20Prefix\x20Extension','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','callerIdAll','Set','PREFIX-CALLERIDALL=','${EXTEN:','charAt','system-','transaction','VoiceExtension','findById','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','getAgents','User','pick','findOne','Team','getTeams','addTeams','online','voicePause','flatMap','Agents','each','TeamVoicePrefix','upsert','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','union','compact','value','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','status','end','json','undefined','limit','count','offset','set'];(function(_0x5e9a66,_0x4c75af){var _0x256199=function(_0x2f6d11){while(--_0x2f6d11){_0x5e9a66['push'](_0x5e9a66['shift']());}};_0x256199(++_0x4c75af);}(_0x02ce,0x1ac));var _0xe02c=function(_0x2bba7c,_0x2316b3){_0x2bba7c=_0x2bba7c-0x0;var _0x416fa8=_0x02ce[_0x2bba7c];return _0x416fa8;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];config[_0xe02c('0x1c')]=_[_0xe02c('0x1d')](config['redis'],{'host':_0xe02c('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe02c('0x1f'))['register'](socket);function respondWithStatusCode(_0x221910,_0x59614c){_0x59614c=_0x59614c||0xcc;return function(_0x3a5a2c){if(_0x3a5a2c){return _0x221910['sendStatus'](_0x59614c);}return _0x221910[_0xe02c('0x20')](_0x59614c)[_0xe02c('0x21')]();};}function respondWithResult(_0x59f2f6,_0x10a2a6){_0x10a2a6=_0x10a2a6||0xc8;return function(_0x226a80){if(_0x226a80){return _0x59f2f6['status'](_0x10a2a6)[_0xe02c('0x22')](_0x226a80);}};}function respondWithFilteredResult(_0x20f492,_0x5a4583){return function(_0x52917f){if(_0x52917f){var _0x3e37bf=typeof _0x5a4583['offset']===_0xe02c('0x23')&&typeof _0x5a4583[_0xe02c('0x24')]===_0xe02c('0x23');var _0x36fed0=_0x52917f[_0xe02c('0x25')];var _0x54c5b0=_0x3e37bf?0x0:_0x5a4583[_0xe02c('0x26')];var _0x59026f=_0x3e37bf?_0x52917f['count']:_0x5a4583[_0xe02c('0x26')]+_0x5a4583[_0xe02c('0x24')];var _0x480b9a;if(_0x59026f>=_0x36fed0){_0x59026f=_0x36fed0;_0x480b9a=0xc8;}else{_0x480b9a=0xce;}_0x20f492[_0xe02c('0x20')](_0x480b9a);return _0x20f492[_0xe02c('0x27')]('Content-Range',_0x54c5b0+'-'+_0x59026f+'/'+_0x36fed0)[_0xe02c('0x22')](_0x52917f);}return null;};}function patchUpdates(_0x45fd82){return function(_0x39b00c){try{jsonpatch[_0xe02c('0x28')](_0x39b00c,_0x45fd82,!![]);}catch(_0x2d44c8){return BPromise[_0xe02c('0x29')](_0x2d44c8);}return _0x39b00c[_0xe02c('0x2a')]();};}function saveUpdates(_0xf41d4c,_0xeae877){return function(_0x18b538){if(_0x18b538){return _0x18b538[_0xe02c('0x2b')](_0xf41d4c)['then'](function(_0xefd882){return _0xefd882;});}return null;};}function removeEntity(_0x4411d8,_0x3592ca){return function(_0x14ffba){if(_0x14ffba){return _0x14ffba[_0xe02c('0x2c')]()[_0xe02c('0x2d')](function(){var _0x43dc78=_0x14ffba[_0xe02c('0x2e')]({'plain':!![]});var _0x55ef2a=_0xe02c('0x2f');return db[_0xe02c('0x30')][_0xe02c('0x2c')]({'where':{'type':_0x55ef2a,'resourceId':_0x43dc78['id']}})['then'](function(){return _0x14ffba;});})[_0xe02c('0x2d')](function(){_0x4411d8[_0xe02c('0x20')](0xcc)[_0xe02c('0x21')]();});}};}function handleEntityNotFound(_0x287f7e,_0x1e7eab){return function(_0x35a309){if(!_0x35a309){_0x287f7e[_0xe02c('0x31')](0x194);}return _0x35a309;};}function handleError(_0x1b8f21,_0x9ee479){_0x9ee479=_0x9ee479||0x1f4;return function(_0x288004){logger[_0xe02c('0x32')](_0x288004['stack']);if(_0x288004[_0xe02c('0x33')]){delete _0x288004[_0xe02c('0x33')];}_0x1b8f21[_0xe02c('0x20')](_0x9ee479)[_0xe02c('0x34')](_0x288004);};}exports[_0xe02c('0x35')]=function(_0x14d27a,_0x58bf16){var _0x436bcc={},_0x1e605c={},_0x4fc4fd={'count':0x0,'rows':[]};var _0x1ce34c=_[_0xe02c('0x36')](db[_0xe02c('0x37')][_0xe02c('0x38')],function(_0x2b5ebe){return{'name':_0x2b5ebe['fieldName'],'type':_0x2b5ebe['type'][_0xe02c('0x39')]};});_0x1e605c[_0xe02c('0x3a')]=_['map'](_0x1ce34c,_0xe02c('0x33'));_0x1e605c['query']=_[_0xe02c('0x3b')](_0x14d27a[_0xe02c('0x3c')]);_0x1e605c[_0xe02c('0x3d')]=_[_0xe02c('0x3e')](_0x1e605c[_0xe02c('0x3a')],_0x1e605c['query']);_0x436bcc[_0xe02c('0x3f')]=_['intersection'](_0x1e605c[_0xe02c('0x3a')],qs[_0xe02c('0x40')](_0x14d27a[_0xe02c('0x3c')][_0xe02c('0x40')]));_0x436bcc[_0xe02c('0x3f')]=_0x436bcc[_0xe02c('0x3f')]['length']?_0x436bcc[_0xe02c('0x3f')]:_0x1e605c[_0xe02c('0x3a')];if(!_0x14d27a['query'][_0xe02c('0x41')](_0xe02c('0x42'))){_0x436bcc['limit']=qs[_0xe02c('0x24')](_0x14d27a['query'][_0xe02c('0x24')]);_0x436bcc[_0xe02c('0x26')]=qs['offset'](_0x14d27a[_0xe02c('0x3c')][_0xe02c('0x26')]);}_0x436bcc[_0xe02c('0x43')]=qs[_0xe02c('0x44')](_0x14d27a[_0xe02c('0x3c')][_0xe02c('0x44')]);_0x436bcc['where']=qs[_0xe02c('0x3d')](_['pick'](_0x14d27a['query'],_0x1e605c[_0xe02c('0x3d')]),_0x1ce34c);if(_0x14d27a[_0xe02c('0x3c')][_0xe02c('0x45')]){_0x436bcc[_0xe02c('0x46')]=_['merge'](_0x436bcc[_0xe02c('0x46')],{'$or':_[_0xe02c('0x36')](_0x1ce34c,function(_0x163573){if(_0x163573['type']!=='VIRTUAL'){var _0x33c6da={};_0x33c6da[_0x163573[_0xe02c('0x33')]]={'$like':'%'+_0x14d27a[_0xe02c('0x3c')][_0xe02c('0x45')]+'%'};return _0x33c6da;}})});}_0x436bcc=_[_0xe02c('0x47')]({},_0x436bcc,_0x14d27a[_0xe02c('0x48')]);var _0x25f8ae={'where':_0x436bcc[_0xe02c('0x46')]};return db[_0xe02c('0x37')]['count'](_0x25f8ae)[_0xe02c('0x2d')](function(_0x5ef4a1){_0x4fc4fd['count']=_0x5ef4a1;if(_0x14d27a[_0xe02c('0x3c')][_0xe02c('0x49')]){_0x436bcc[_0xe02c('0x4a')]=[{'all':!![]}];}return db[_0xe02c('0x37')][_0xe02c('0x4b')](_0x436bcc);})[_0xe02c('0x2d')](function(_0x165f4a){_0x4fc4fd[_0xe02c('0x4c')]=_0x165f4a;return _0x4fc4fd;})['then'](respondWithFilteredResult(_0x58bf16,_0x436bcc))['catch'](handleError(_0x58bf16,null));};exports[_0xe02c('0x4d')]=function(_0xf89a57,_0x304ece){var _0x52f239={'raw':![],'where':{'id':_0xf89a57[_0xe02c('0x4e')]['id']}},_0x1cf443={};_0x1cf443[_0xe02c('0x3a')]=_[_0xe02c('0x3b')](db[_0xe02c('0x37')][_0xe02c('0x38')]);_0x1cf443[_0xe02c('0x3c')]=_[_0xe02c('0x3b')](_0xf89a57[_0xe02c('0x3c')]);_0x1cf443[_0xe02c('0x3d')]=_['intersection'](_0x1cf443[_0xe02c('0x3a')],_0x1cf443[_0xe02c('0x3c')]);_0x52f239[_0xe02c('0x3f')]=_[_0xe02c('0x3e')](_0x1cf443[_0xe02c('0x3a')],qs[_0xe02c('0x40')](_0xf89a57[_0xe02c('0x3c')][_0xe02c('0x40')]));_0x52f239[_0xe02c('0x3f')]=_0x52f239[_0xe02c('0x3f')][_0xe02c('0x4f')]?_0x52f239[_0xe02c('0x3f')]:_0x1cf443[_0xe02c('0x3a')];if(_0xf89a57['query'][_0xe02c('0x49')]){_0x52f239['include']=[{'all':!![]}];}_0x52f239=_[_0xe02c('0x47')]({},_0x52f239,_0xf89a57[_0xe02c('0x48')]);return db[_0xe02c('0x37')][_0xe02c('0x50')](_0x52f239)[_0xe02c('0x2d')](handleEntityNotFound(_0x304ece,null))[_0xe02c('0x2d')](respondWithResult(_0x304ece,null))[_0xe02c('0x51')](handleError(_0x304ece,null));};exports[_0xe02c('0x2c')]=function(_0xc6ea7b,_0x385497){return db['VoicePrefix'][_0xe02c('0x50')]({'where':{'id':_0xc6ea7b[_0xe02c('0x4e')]['id']}})[_0xe02c('0x2d')](handleEntityNotFound(_0x385497,null))['then'](removeEntity(_0x385497,null))[_0xe02c('0x51')](handleError(_0x385497,null));};exports['describe']=function(_0x21a126,_0x56b9e2){return db['VoicePrefix']['describe']()['then'](respondWithResult(_0x56b9e2,null))['catch'](handleError(_0x56b9e2,null));};exports['create']=function(_0x107f3f,_0x3ac0a5){var _0x1510aa;return db[_0xe02c('0x52')]['transaction'](function(_0x274beb){return db[_0xe02c('0x37')]['create'](_0x107f3f[_0xe02c('0x53')],{'transaction':_0x274beb})[_0xe02c('0x2d')](function(_0x221e5e){_0x1510aa=_0x221e5e['get']({'plain':!![]});return db['VoiceExtension'][_0xe02c('0x50')]({'where':{'id':_0x1510aa[_0xe02c('0x54')]},'raw':!![]})[_0xe02c('0x2d')](function(_0x5b2d2b){return createVoicePrefixExtensions(_0x1510aa,_0x5b2d2b,_0x274beb);});});})[_0xe02c('0x2d')](function(){var _0x53765c=_0x107f3f['user'][_0xe02c('0x2e')]({'plain':!![]});if(!_0x53765c)throw new Error(_0xe02c('0x55'));if(_0x53765c['role']===_0xe02c('0x56')){var _0x849eea=_0x1510aa;return db[_0xe02c('0x57')]['find']({'where':{'name':_0xe02c('0x2f'),'userProfileId':_0x53765c[_0xe02c('0x58')]},'raw':!![]})['then'](function(_0x3788e8){if(_0x3788e8&&_0x3788e8[_0xe02c('0x59')]===0x0){return db[_0xe02c('0x30')][_0xe02c('0x5a')]({'name':_0x849eea[_0xe02c('0x33')],'resourceId':_0x849eea['id'],'type':_0x3788e8[_0xe02c('0x33')],'sectionId':_0x3788e8['id']},{})[_0xe02c('0x2d')](function(){return _0x1510aa;});}else{return _0x1510aa;}})[_0xe02c('0x51')](function(_0xf7e836){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf7e836);throw _0xf7e836;});}return _0x1510aa;})['then'](respondWithResult(_0x3ac0a5,null))[_0xe02c('0x51')](handleError(_0x3ac0a5,null));};function Extension(_0x299770,_0x42f2fd,_0x496eb1,_0x4eb35d){this[_0xe02c('0x5b')]=_0xe02c('0x5c');this[_0xe02c('0x5d')]=_0x299770;this[_0xe02c('0x5e')]=_0x496eb1;this[_0xe02c('0x5f')]='system';this[_0xe02c('0x60')]=_0xe02c('0x61');this['priority']=_0x42f2fd;this['appdata']=_0x4eb35d;}function createVoicePrefixExtensions(_0x879d99,_0x566204,_0x4da197){return new BPromise(function(_0x480d49,_0x3b19c9){var _0x28d7a2=new Extension(formatPrefixName(_0x879d99[_0xe02c('0x62')]),0x1,_0xe02c('0x63'),_0xe02c('0x64'));_0x28d7a2[_0xe02c('0x65')]=_0x879d99['id'];return db['VoiceExtension'][_0xe02c('0x5a')](_0x28d7a2,{'transaction':_0x4da197})['then'](function(_0x4f3c9a){var _0x185dc2=_0x4f3c9a[_0xe02c('0x2e')]({'plain':!![]});var _0x44ba68=_[_0xe02c('0x36')](addVoicePrefixExtensions(_0x879d99,_0x566204),function(_0x5b6979){_0x5b6979[_0xe02c('0x54')]=_0x185dc2['id'];_0x5b6979[_0xe02c('0x65')]=_0x879d99['id'];return _0x5b6979;});return db['VoiceExtension'][_0xe02c('0x66')](_0x44ba68,{'transaction':_0x4da197})[_0xe02c('0x2d')](function(_0x4cc74d){if(!_0x4cc74d){return _0x3b19c9(_0xe02c('0x67'));}else{return _0x480d49(_0x4cc74d);}})[_0xe02c('0x51')](function(_0x44f28f){return _0x3b19c9(_0x44f28f);});});;});};function addVoicePrefixExtensions(_0x4053e6,_0x323f3b){var _0x3a62a2=[];var _0x31b281=formatPrefixName(_0x4053e6['prefix']);_0x3a62a2[_0xe02c('0x68')](new Extension(_0x31b281,0x2,'Set','CDR(prefix)='+_0x4053e6['name']));if(_0x4053e6[_0xe02c('0x69')]){_0x3a62a2[_0xe02c('0x68')](new Extension(_0x31b281,0x3,_0xe02c('0x6a'),_0xe02c('0x6b')+_0x4053e6['callerIdAll']));}else{_0x3a62a2[_0xe02c('0x68')](new Extension(_0x31b281,0x3,_0xe02c('0x63'),'No\x20callerid\x20available'));}_0x3a62a2['push'](new Extension(_0x31b281,0x4,'goto',_0x323f3b[_0xe02c('0x5b')]+','+_0xe02c('0x6c')+(0x8+_0x4053e6['name']['length'])+'}'+','+0x1));return _0x3a62a2;}function formatPrefixName(_0x38789c){var _0x30ad9f='_';for(var _0x120ef1=0x0;_0x120ef1<_0x38789c[_0xe02c('0x4f')];_0x120ef1++){if(_0x38789c[_0xe02c('0x6d')](_0x120ef1)=='-'){_0x30ad9f+=_0x38789c['charAt'](_0x120ef1);}else{_0x30ad9f+='['+_0x38789c[_0xe02c('0x6d')](_0x120ef1)+']';}}_0x30ad9f+='.';return _0x30ad9f;}exports[_0xe02c('0x2b')]=function(_0x3f277b,_0x2776c0,_0x11c506){var _0x119119=_0x3f277b['body'];_0x119119[_0xe02c('0x62')]=_0xe02c('0x6e')+_0x119119['name']+'-';return db[_0xe02c('0x52')][_0xe02c('0x6f')](function(_0x123ca9){return db[_0xe02c('0x37')]['update'](_0x119119,{'where':{'id':_0x119119['id']},'transaction':_0x123ca9})[_0xe02c('0x2d')](function(){return db[_0xe02c('0x70')]['destroy']({'where':{'VoicePrefixId':_0x119119['id']},'transaction':_0x123ca9})['then'](function(){return db['VoiceExtension'][_0xe02c('0x50')]({'where':{'id':_0x119119[_0xe02c('0x54')]},'raw':!![]})[_0xe02c('0x2d')](function(_0x34e692){return createVoicePrefixExtensions(_0x119119,_0x34e692,_0x123ca9);});});});})[_0xe02c('0x2d')](function(){return db['VoicePrefix'][_0xe02c('0x71')](_0x119119['id']);})[_0xe02c('0x2d')](respondWithResult(_0x2776c0,null))[_0xe02c('0x51')](handleError(_0x2776c0,null));};exports['addAgents']=function(_0x4a7783,_0x4c3c91,_0x3cd802){return db[_0xe02c('0x37')][_0xe02c('0x50')]({'where':{'id':_0x4a7783[_0xe02c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4c3c91,null))[_0xe02c('0x2d')](function(_0x48f524){if(_0x48f524){return _0x48f524['addAgents'](_0x4a7783[_0xe02c('0x53')][_0xe02c('0x72')],_[_0xe02c('0x73')](_0x4a7783[_0xe02c('0x53')],[_0xe02c('0x72'),'id'])||{})[_0xe02c('0x74')](function(_0x748217){for(var _0x12aaea=0x0;_0x12aaea<_0x4a7783['body'][_0xe02c('0x72')][_0xe02c('0x4f')];_0x12aaea+=0x1){socket[_0xe02c('0x75')](_0xe02c('0x76'),{'UserId':Number(_0x4a7783[_0xe02c('0x53')][_0xe02c('0x72')][_0x12aaea]),'VoicePrefixId':Number(_0x4a7783[_0xe02c('0x4e')]['id'])});}return _0x748217;});}})[_0xe02c('0x2d')](respondWithResult(_0x4c3c91,null))[_0xe02c('0x51')](handleError(_0x4c3c91,null));};exports[_0xe02c('0x77')]=function(_0x5e6df5,_0x58acfd,_0x120dd7){return db[_0xe02c('0x37')][_0xe02c('0x50')]({'where':{'id':_0x5e6df5[_0xe02c('0x4e')]['id']}})[_0xe02c('0x2d')](handleEntityNotFound(_0x58acfd,null))['then'](function(_0x405b16){if(_0x405b16){return _0x405b16[_0xe02c('0x77')](_0x5e6df5[_0xe02c('0x3c')][_0xe02c('0x72')])[_0xe02c('0x2d')](function(){if(_[_0xe02c('0x78')](_0x5e6df5[_0xe02c('0x3c')][_0xe02c('0x72')])){for(var _0x1d594c=0x0;_0x1d594c<_0x5e6df5[_0xe02c('0x3c')][_0xe02c('0x72')][_0xe02c('0x4f')];_0x1d594c+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x5e6df5[_0xe02c('0x3c')][_0xe02c('0x72')][_0x1d594c]),'VoicePrefixId':Number(_0x5e6df5['params']['id'])});}}else{socket[_0xe02c('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x5e6df5[_0xe02c('0x3c')]['ids']),'VoicePrefixId':Number(_0x5e6df5[_0xe02c('0x4e')]['id'])});}});}})[_0xe02c('0x2d')](respondWithStatusCode(_0x58acfd,null))[_0xe02c('0x51')](handleError(_0x58acfd,null));};exports[_0xe02c('0x79')]=function(_0x28755a,_0x3c44d3,_0x119439){var _0x10d067={};var _0x3d3954={};var _0xd0d895;var _0x567478;return db['VoicePrefix']['findOne']({'where':{'id':_0x28755a[_0xe02c('0x4e')]['id']}})[_0xe02c('0x2d')](handleEntityNotFound(_0x3c44d3,null))[_0xe02c('0x2d')](function(_0x1133ce){if(_0x1133ce){_0xd0d895=_0x1133ce;_0x3d3954[_0xe02c('0x3a')]=_[_0xe02c('0x3b')](db[_0xe02c('0x7a')][_0xe02c('0x38')]);_0x3d3954[_0xe02c('0x3c')]=_[_0xe02c('0x3b')](_0x28755a[_0xe02c('0x3c')]);_0x3d3954[_0xe02c('0x3d')]=_[_0xe02c('0x3e')](_0x3d3954['model'],_0x3d3954['query']);_0x10d067[_0xe02c('0x3f')]=_[_0xe02c('0x3e')](_0x3d3954[_0xe02c('0x3a')],qs['fields'](_0x28755a[_0xe02c('0x3c')][_0xe02c('0x40')]));_0x10d067[_0xe02c('0x3f')]=_0x10d067[_0xe02c('0x3f')][_0xe02c('0x4f')]?_0x10d067['attributes']:_0x3d3954[_0xe02c('0x3a')];_0x10d067[_0xe02c('0x43')]=qs[_0xe02c('0x44')](_0x28755a['query'][_0xe02c('0x44')]);_0x10d067[_0xe02c('0x46')]=qs[_0xe02c('0x3d')](_[_0xe02c('0x7b')](_0x28755a[_0xe02c('0x3c')],_0x3d3954['filters']));if(_0x28755a[_0xe02c('0x3c')][_0xe02c('0x45')]){_0x10d067[_0xe02c('0x46')]=_['merge'](_0x10d067[_0xe02c('0x46')],{'$or':_[_0xe02c('0x36')](_0x10d067[_0xe02c('0x3f')],function(_0x3a5ec8){var _0x45e463={};_0x45e463[_0x3a5ec8]={'$like':'%'+_0x28755a['query'][_0xe02c('0x45')]+'%'};return _0x45e463;})});}_0x10d067=_[_0xe02c('0x47')]({},_0x10d067,_0x28755a['options']);return _0xd0d895[_0xe02c('0x79')](_0x10d067);}})['then'](function(_0x52fcd6){if(_0x52fcd6){_0x567478=_0x52fcd6['length'];if(!_0x28755a[_0xe02c('0x3c')][_0xe02c('0x41')](_0xe02c('0x42'))){_0x10d067[_0xe02c('0x24')]=qs[_0xe02c('0x24')](_0x28755a[_0xe02c('0x3c')][_0xe02c('0x24')]);_0x10d067[_0xe02c('0x26')]=qs[_0xe02c('0x26')](_0x28755a[_0xe02c('0x3c')][_0xe02c('0x26')]);}return _0xd0d895[_0xe02c('0x79')](_0x10d067);}})[_0xe02c('0x2d')](function(_0xfe0b1c){if(_0xfe0b1c){return _0xfe0b1c?{'count':_0x567478,'rows':_0xfe0b1c}:null;}})[_0xe02c('0x2d')](respondWithResult(_0x3c44d3,null))[_0xe02c('0x51')](handleError(_0x3c44d3,null));};exports['getTeams']=function(_0x283de9,_0x4cfbc0,_0x3650cb){var _0xdc8df0={};var _0x4564f1={};var _0x2c6d29;var _0x5b75ed;return db[_0xe02c('0x37')][_0xe02c('0x7c')]({'where':{'id':_0x283de9[_0xe02c('0x4e')]['id']}})[_0xe02c('0x2d')](handleEntityNotFound(_0x4cfbc0,null))[_0xe02c('0x2d')](function(_0xced62f){if(_0xced62f){_0x2c6d29=_0xced62f;_0x4564f1[_0xe02c('0x3a')]=_['keys'](db[_0xe02c('0x7d')][_0xe02c('0x38')]);_0x4564f1['query']=_[_0xe02c('0x3b')](_0x283de9['query']);_0x4564f1['filters']=_[_0xe02c('0x3e')](_0x4564f1[_0xe02c('0x3a')],_0x4564f1[_0xe02c('0x3c')]);_0xdc8df0[_0xe02c('0x3f')]=_['intersection'](_0x4564f1['model'],qs[_0xe02c('0x40')](_0x283de9[_0xe02c('0x3c')]['fields']));_0xdc8df0[_0xe02c('0x3f')]=_0xdc8df0[_0xe02c('0x3f')][_0xe02c('0x4f')]?_0xdc8df0[_0xe02c('0x3f')]:_0x4564f1[_0xe02c('0x3a')];_0xdc8df0[_0xe02c('0x43')]=qs['sort'](_0x283de9[_0xe02c('0x3c')][_0xe02c('0x44')]);_0xdc8df0[_0xe02c('0x46')]=qs[_0xe02c('0x3d')](_[_0xe02c('0x7b')](_0x283de9[_0xe02c('0x3c')],_0x4564f1[_0xe02c('0x3d')]));if(_0x283de9[_0xe02c('0x3c')][_0xe02c('0x45')]){_0xdc8df0[_0xe02c('0x46')]=_[_0xe02c('0x47')](_0xdc8df0[_0xe02c('0x46')],{'$or':_[_0xe02c('0x36')](_0xdc8df0[_0xe02c('0x3f')],function(_0x5c4ed7){var _0x1abb2d={};_0x1abb2d[_0x5c4ed7]={'$like':'%'+_0x283de9[_0xe02c('0x3c')][_0xe02c('0x45')]+'%'};return _0x1abb2d;})});}_0xdc8df0=_['merge']({},_0xdc8df0,_0x283de9[_0xe02c('0x48')]);return _0x2c6d29[_0xe02c('0x7e')](_0xdc8df0);}})[_0xe02c('0x2d')](function(_0x2127e7){if(_0x2127e7){_0x5b75ed=_0x2127e7[_0xe02c('0x4f')];if(!_0x283de9[_0xe02c('0x3c')][_0xe02c('0x41')]('nolimit')){_0xdc8df0[_0xe02c('0x24')]=qs[_0xe02c('0x24')](_0x283de9[_0xe02c('0x3c')][_0xe02c('0x24')]);_0xdc8df0[_0xe02c('0x26')]=qs[_0xe02c('0x26')](_0x283de9[_0xe02c('0x3c')][_0xe02c('0x26')]);}return _0x2c6d29[_0xe02c('0x7e')](_0xdc8df0);}})['then'](function(_0x4297b2){if(_0x4297b2){return _0x4297b2?{'count':_0x5b75ed,'rows':_0x4297b2}:null;}})[_0xe02c('0x2d')](respondWithResult(_0x4cfbc0,null))['catch'](handleError(_0x4cfbc0,null));};exports[_0xe02c('0x7f')]=function(_0x4081f5,_0x1d23ed,_0x46fd38){var _0x7cd9df=_0x4081f5[_0xe02c('0x53')]['ids'];var _0xc21958;return db[_0xe02c('0x7d')][_0xe02c('0x4b')]({'where':{'id':_0x7cd9df},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe02c('0x33'),_0xe02c('0x80'),_0xe02c('0x81'),'interface'],'raw':!![]}]})[_0xe02c('0x2d')](function(_0x35b30c){if(_0x35b30c){_0xc21958=_0x35b30c;var _0x469eac=_[_0xe02c('0x82')](_0x35b30c,function(_0x7441e6){var _0x56e35d=_0x7441e6[_0xe02c('0x2e')]({'plain':!![]});return _0x56e35d[_0xe02c('0x83')];});return db[_0xe02c('0x37')][_0xe02c('0x50')]({'where':{'id':_0x4081f5[_0xe02c('0x4e')]['id']}})[_0xe02c('0x2d')](function(_0x327507){return db[_0xe02c('0x52')][_0xe02c('0x6f')](function(_0x2ee007){return _0x327507[_0xe02c('0x7f')](_0x7cd9df,{'transaction':_0x2ee007})[_0xe02c('0x2d')](function(){return BPromise[_0xe02c('0x84')](_0xc21958,function(_0x1de725){return db[_0xe02c('0x85')][_0xe02c('0x86')]({'TeamId':_0x1de725['id'],'VoicePrefixId':_0x4081f5[_0xe02c('0x4e')]['id']},{'transaction':_0x2ee007});});})['then'](function(){return BPromise['each'](_0x469eac,function(_0x4400b2){return db['UserVoicePrefix']['findOrCreate']({'where':{'UserId':_0x4400b2['id'],'VoicePrefixId':_0x4081f5['params']['id']},'transaction':_0x2ee007});});})[_0xe02c('0x2d')](function(){_0x469eac[_0xe02c('0x87')](function(_0x889cef){socket['emit'](_0xe02c('0x76'),{'UserId':_0x889cef['id'],'VoicePrefixId':_0x327507['id']});});});});});}})['then'](respondWithStatusCode(_0x1d23ed,null))['catch'](handleError(_0x1d23ed,null));};exports[_0xe02c('0x88')]=function(_0x3ca665,_0x4eb163,_0x1433bd){return db['Team']['findAll']({'where':{'id':_0x3ca665[_0xe02c('0x3c')][_0xe02c('0x72')]},'attributes':['id'],'include':[{'model':db[_0xe02c('0x7a')],'as':_0xe02c('0x83'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4eb163,null))[_0xe02c('0x2d')](function(_0x25933f){var _0x323d81=_[_0xe02c('0x36')](_0x25933f,'id');var _0x3b6e15=[];var _0x1c96cc=[];var _0x322b4a=squel[_0xe02c('0x89')]();_0x322b4a[_0xe02c('0x8a')](_0xe02c('0x8b'))[_0xe02c('0x8c')](_0xe02c('0x8d'),'tq')[_0xe02c('0x8e')](_0xe02c('0x8f'),'ut',_0xe02c('0x90'))[_0xe02c('0x46')](_0xe02c('0x91'),_0x3ca665['params']['id']);for(var _0x252f5f=0x0;_0x252f5f<_0x25933f[_0xe02c('0x4f')];_0x252f5f+=0x1){let _0x4d112d=_0x25933f[_0x252f5f];for(var _0x3e0961=0x0;_0x3e0961<_0x4d112d[_0xe02c('0x83')][_0xe02c('0x4f')];_0x3e0961+=0x1){let _0x4b7886=_0x4d112d[_0xe02c('0x83')][_0x3e0961];var _0x505074=_0x322b4a[_0xe02c('0x92')]();_0x505074['where'](_0xe02c('0x93'),_0x4b7886['id']);_0x1c96cc[_0xe02c('0x68')](db[_0xe02c('0x52')][_0xe02c('0x3c')](_0x505074[_0xe02c('0x94')](),{'type':db['sequelize'][_0xe02c('0x95')]['SELECT']})[_0xe02c('0x2d')](function(_0x47d3fa){if(_0x47d3fa[_0xe02c('0x4f')]===0x1){return _0x4b7886['id'];}else{var _0x534002=_[_0xe02c('0x96')](_[_0xe02c('0x36')](_0x47d3fa,_0xe02c('0x97')),function(_0x45c425){return _[_0xe02c('0x98')](_0x323d81,_0x45c425);});if(_0x534002){return _0x4b7886['id'];}}}));}}return BPromise['all'](_0x1c96cc)['then'](function(_0x27ea6e){_0x3b6e15=_(_0x3b6e15)[_0xe02c('0x99')](_0x27ea6e)[_0xe02c('0x9a')]()[_0xe02c('0x9b')]();return db[_0xe02c('0x37')]['find']({'where':{'id':_0x3ca665[_0xe02c('0x4e')]['id']}})[_0xe02c('0x2d')](function(_0x34b426){return db['sequelize'][_0xe02c('0x6f')](function(_0x2a8e1d){return _0x34b426[_0xe02c('0x88')](_0x3ca665[_0xe02c('0x3c')][_0xe02c('0x72')],{'transaction':_0x2a8e1d})[_0xe02c('0x2d')](function(){if(!_['isEmpty'](_0x3b6e15)){return _0x34b426['removeAgents'](_0x3b6e15,{'transaction':_0x2a8e1d});}})[_0xe02c('0x2d')](function(){_0x3b6e15[_0xe02c('0x87')](function(_0x4b9fb7){socket['emit']('userVoicePrefix:remove',{'UserId':_0x4b9fb7,'VoicePrefixId':_0x34b426['id']});});});});});});})['then'](respondWithStatusCode(_0x4eb163,null))[_0xe02c('0x51')](handleError(_0x4eb163,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index c615da8..b0234fc 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 _0x39a0=['hasOwnProperty','events','../../mysqldb','VoicePrefix','save','update','remove','emit'];(function(_0x4e0ccf,_0x1128e7){var _0x47f3b0=function(_0xe88446){while(--_0xe88446){_0x4e0ccf['push'](_0x4e0ccf['shift']());}};_0x47f3b0(++_0x1128e7);}(_0x39a0,0x169));var _0x039a=function(_0x3b66a2,_0x587b3d){_0x3b66a2=_0x3b66a2-0x0;var _0x21d241=_0x39a0[_0x3b66a2];return _0x21d241;};'use strict';var EventEmitter=require(_0x039a('0x0'));var VoicePrefix=require(_0x039a('0x1'))['db'][_0x039a('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x039a('0x3'),'afterUpdate':_0x039a('0x4'),'afterDestroy':_0x039a('0x5')};function emitEvent(_0x387031){return function(_0x165da1,_0xd7927f,_0x47a5d5){VoicePrefixEvents[_0x039a('0x6')](_0x387031+':'+_0x165da1['id'],_0x165da1);VoicePrefixEvents['emit'](_0x387031,_0x165da1);_0x47a5d5(null);};}for(var e in events){if(events[_0x039a('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xdf8d=['hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove','emit'];(function(_0x3c1f6b,_0x4090ef){var _0x2935a7=function(_0x29d157){while(--_0x29d157){_0x3c1f6b['push'](_0x3c1f6b['shift']());}};_0x2935a7(++_0x4090ef);}(_0xdf8d,0xa4));var _0xddf8=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0xdf8d[_0x67f95e];return _0x538f5a;};'use strict';var EventEmitter=require(_0xddf8('0x0'));var VoicePrefix=require(_0xddf8('0x1'))['db'][_0xddf8('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xddf8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xddf8('0x4'),'afterDestroy':_0xddf8('0x5')};function emitEvent(_0xcc7d53){return function(_0x4a7de3,_0x3d1e0d,_0x18bd30){VoicePrefixEvents['emit'](_0xcc7d53+':'+_0x4a7de3['id'],_0x4a7de3);VoicePrefixEvents[_0xddf8('0x6')](_0xcc7d53,_0x4a7de3);_0x18bd30(null);};}for(var e in events){if(events[_0xddf8('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xddf8('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index a02a577..33a31df 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 _0x4a73=['VoicePrefix','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x4a73,0x71));var _0x34a7=function(_0x32dc9c,_0x16451c){_0x32dc9c=_0x32dc9c-0x0;var _0x5ec13c=_0x4a73[_0x32dc9c];return _0x5ec13c;};'use strict';var _=require(_0x34a7('0x0'));var util=require(_0x34a7('0x1'));var logger=require(_0x34a7('0x2'))(_0x34a7('0x3'));var moment=require(_0x34a7('0x4'));var BPromise=require(_0x34a7('0x5'));var rp=require(_0x34a7('0x6'));var fs=require('fs');var path=require(_0x34a7('0x7'));var rimraf=require(_0x34a7('0x8'));var config=require(_0x34a7('0x9'));var attributes=require(_0x34a7('0xa'));module[_0x34a7('0xb')]=function(_0x4b835b,_0x36fc5a){return _0x4b835b[_0x34a7('0xc')](_0x34a7('0xd'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43a8=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x43a8,0x1ec));var _0x843a=function(_0x264312,_0x434df3){_0x264312=_0x264312-0x0;var _0x493511=_0x43a8[_0x264312];return _0x493511;};'use strict';var _=require(_0x843a('0x0'));var util=require('util');var logger=require(_0x843a('0x1'))('api');var moment=require(_0x843a('0x2'));var BPromise=require(_0x843a('0x3'));var rp=require(_0x843a('0x4'));var fs=require('fs');var path=require(_0x843a('0x5'));var rimraf=require(_0x843a('0x6'));var config=require(_0x843a('0x7'));var attributes=require(_0x843a('0x8'));module[_0x843a('0x9')]=function(_0x94426d,_0x3843d1){return _0x94426d[_0x843a('0xa')](_0x843a('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 2444d10..dbc2d5c 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 _0xf7f7=['request','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','VoicePrefix,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./voicePrefix.socket'];(function(_0x28689b,_0x2cbbcf){var _0x104f1c=function(_0x25279a){while(--_0x25279a){_0x28689b['push'](_0x28689b['shift']());}};_0x104f1c(++_0x2cbbcf);}(_0xf7f7,0x192));var _0x7f7f=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0xf7f7[_0x513047];return _0x15b779;};'use strict';var _=require(_0x7f7f('0x0'));var util=require(_0x7f7f('0x1'));var moment=require(_0x7f7f('0x2'));var BPromise=require(_0x7f7f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f7f('0x4'))['db'];var utils=require(_0x7f7f('0x5'));var logger=require(_0x7f7f('0x6'))(_0x7f7f('0x7'));var config=require('../../config/environment');var jayson=require(_0x7f7f('0x8'));var client=jayson[_0x7f7f('0x9')][_0x7f7f('0xa')]({'port':0x232a});config[_0x7f7f('0xb')]=_['defaults'](config[_0x7f7f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f7f('0xc'))(new Redis(config['redis']));require(_0x7f7f('0xd'))['register'](socket);function respondWithRpcPromise(_0x237049,_0x167cba,_0x297ab0){return new BPromise(function(_0x478b9e,_0x88b55d){return client[_0x7f7f('0xe')](_0x237049,_0x297ab0)[_0x7f7f('0xf')](function(_0x5946fa){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x167cba,_0x7f7f('0x10'));logger[_0x7f7f('0x11')](_0x7f7f('0x12'),_0x167cba,_0x7f7f('0x10'),JSON['stringify'](_0x5946fa));if(_0x5946fa['error']){if(_0x5946fa[_0x7f7f('0x13')][_0x7f7f('0x14')]===0x1f4){logger[_0x7f7f('0x13')](_0x7f7f('0x15'),_0x167cba,_0x5946fa[_0x7f7f('0x13')][_0x7f7f('0x16')]);return _0x88b55d(_0x5946fa[_0x7f7f('0x13')][_0x7f7f('0x16')]);}logger[_0x7f7f('0x13')](_0x7f7f('0x15'),_0x167cba,_0x5946fa[_0x7f7f('0x13')][_0x7f7f('0x16')]);return _0x478b9e(_0x5946fa[_0x7f7f('0x13')][_0x7f7f('0x16')]);}else{logger[_0x7f7f('0x17')](_0x7f7f('0x15'),_0x167cba,_0x7f7f('0x10'));_0x478b9e(_0x5946fa[_0x7f7f('0x18')][_0x7f7f('0x16')]);}})[_0x7f7f('0x19')](function(_0x4313c6){logger['error'](_0x7f7f('0x15'),_0x167cba,_0x4313c6);_0x88b55d(_0x4313c6);});});} \ No newline at end of file +var _0x7bd0=['register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket'];(function(_0x478f27,_0x21988d){var _0x2ed82d=function(_0x5f3640){while(--_0x5f3640){_0x478f27['push'](_0x478f27['shift']());}};_0x2ed82d(++_0x21988d);}(_0x7bd0,0x111));var _0x07bd=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0x7bd0[_0x3df871];return _0x570f7b;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});config[_0x07bd('0xd')]=_[_0x07bd('0xe')](config['redis'],{'host':_0x07bd('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07bd('0xd')]));require(_0x07bd('0x10'))[_0x07bd('0x11')](socket);function respondWithRpcPromise(_0x5984fa,_0x2bace8,_0x141e8b){return new BPromise(function(_0x324a46,_0x169b07){return client['request'](_0x5984fa,_0x141e8b)[_0x07bd('0x12')](function(_0x313ca5){logger[_0x07bd('0x13')](_0x07bd('0x14'),_0x2bace8,_0x07bd('0x15'));logger[_0x07bd('0x16')](_0x07bd('0x17'),_0x2bace8,_0x07bd('0x15'),JSON['stringify'](_0x313ca5));if(_0x313ca5['error']){if(_0x313ca5[_0x07bd('0x18')][_0x07bd('0x19')]===0x1f4){logger[_0x07bd('0x18')](_0x07bd('0x14'),_0x2bace8,_0x313ca5[_0x07bd('0x18')][_0x07bd('0x1a')]);return _0x169b07(_0x313ca5[_0x07bd('0x18')]['message']);}logger[_0x07bd('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x2bace8,_0x313ca5[_0x07bd('0x18')][_0x07bd('0x1a')]);return _0x324a46(_0x313ca5[_0x07bd('0x18')][_0x07bd('0x1a')]);}else{logger[_0x07bd('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x2bace8,_0x07bd('0x15'));_0x324a46(_0x313ca5[_0x07bd('0x1b')]['message']);}})[_0x07bd('0x1c')](function(_0x72f775){logger[_0x07bd('0x18')](_0x07bd('0x14'),_0x2bace8,_0x72f775);_0x169b07(_0x72f775);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index f34bbeb..519bff4 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 _0xe829=['removeListener','length','voicePrefix:','./voicePrefix.events','save','remove','emit'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xe829,0x1d8));var _0x9e82=function(_0x5c92f7,_0x17381f){_0x5c92f7=_0x5c92f7-0x0;var _0x452cc1=_0xe829[_0x5c92f7];return _0x452cc1;};'use strict';var VoicePrefixEvents=require(_0x9e82('0x0'));var events=[_0x9e82('0x1'),_0x9e82('0x2'),'update'];function createListener(_0x559076,_0xf56525){return function(_0x337730){_0xf56525[_0x9e82('0x3')](_0x559076,_0x337730);};}function removeListener(_0x168d3e,_0x31591a){return function(){VoicePrefixEvents[_0x9e82('0x4')](_0x168d3e,_0x31591a);};}exports['register']=function(_0x392df9){for(var _0x2338e7=0x0,_0x1a63b3=events[_0x9e82('0x5')];_0x2338e7<_0x1a63b3;_0x2338e7++){var _0x2d91ba=events[_0x2338e7];var _0x5c4c57=createListener(_0x9e82('0x6')+_0x2d91ba,_0x392df9);VoicePrefixEvents['on'](_0x2d91ba,_0x5c4c57);}}; \ No newline at end of file +var _0x9993=['voicePrefix:','./voicePrefix.events','remove','update','removeListener','length'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x9993,0x109));var _0x3999=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x9993[_0x2dadb9];return _0x2f0097;};'use strict';var VoicePrefixEvents=require(_0x3999('0x0'));var events=['save',_0x3999('0x1'),_0x3999('0x2')];function createListener(_0x1fd8c5,_0x4b3123){return function(_0x464d6f){_0x4b3123['emit'](_0x1fd8c5,_0x464d6f);};}function removeListener(_0x3e3ea7,_0x145a79){return function(){VoicePrefixEvents[_0x3999('0x3')](_0x3e3ea7,_0x145a79);};}exports['register']=function(_0x9f0add){for(var _0x59fcf8=0x0,_0x536de7=events[_0x3999('0x4')];_0x59fcf8<_0x536de7;_0x59fcf8++){var _0x85b5af=events[_0x59fcf8];var _0x4c1a49=createListener(_0x3999('0x5')+_0x85b5af,_0x9f0add);VoicePrefixEvents['on'](_0x85b5af,_0x4c1a49);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 27789fb..742b47c 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x575a31,_0x56336f){var _0x5d7dad=function(_0x2c8c09){while(--_0x2c8c09){_0x575a31['push'](_0x575a31['shift']());}};_0x5d7dad(++_0x56336f);}(_0xb10b,0x12a));var _0xbb10=function(_0x245c9f,_0x1d9e8c){_0x245c9f=_0x245c9f-0x0;var _0x276b79=_0xb10b[_0x245c9f];return _0x276b79;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x5806c3,_0x5105d8){var _0x48ac77=function(_0x4826ec){while(--_0x4826ec){_0x5806c3['push'](_0x5806c3['shift']());}};_0x48ac77(++_0x5105d8);}(_0xb10b,0x12a));var _0xbb10=function(_0x26f1c4,_0x2bbc6a){_0x26f1c4=_0x26f1c4-0x0;var _0x393a70=_0xb10b[_0x26f1c4];return _0x393a70;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 39daf66..289b947 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 _0x1c01=['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)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','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','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','inbound','outbound','STRING','default','ringall','fewestcalls','random','rrmemory','linear','wrandom','setDataValue','strategy','preview','roundrobin','includes','INTEGER','yes','all','TEXT','join','periodic_announce','getDataValue','joinempty','split','leavewhenempty','BOOLEAN','wrapuptime','progressive','power','predictive','booked','UNSIGNED'];(function(_0x14a6cf,_0x48dc6c){var _0x522073=function(_0x19d05d){while(--_0x19d05d){_0x14a6cf['push'](_0x14a6cf['shift']());}};_0x522073(++_0x48dc6c);}(_0x1c01,0x1c8));var _0x11c0=function(_0x319471,_0x39bc1b){_0x319471=_0x319471-0x0;var _0x564d46=_0x1c01[_0x319471];return _0x564d46;};'use strict';var Sequelize=require(_0x11c0('0x0'));module[_0x11c0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x11c0('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x11c0('0x3')](_0x11c0('0x4'),_0x11c0('0x5')),'allowNull':![],'defaultValue':_0x11c0('0x4')},'musiconhold':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':_0x11c0('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x11c0('0x3')]('rr',_0x11c0('0x8'),'leastrecent',_0x11c0('0x9'),_0x11c0('0xa'),_0x11c0('0xb'),_0x11c0('0xc'),_0x11c0('0xd'),'rrordered'),'allowNull':![],'defaultValue':_0x11c0('0x8'),'set':function(_0x976557){this[_0x11c0('0xe')](_0x11c0('0xf'),_0x976557?_0x976557:_0x11c0('0xb'));},'get':function(){var _0xe496c4=this['getDataValue']('type');var _0x86d3d3=this['getDataValue']('dialMethod');var _0x6edd55=this['getDataValue'](_0x11c0('0xf'));if(_0xe496c4===_0x11c0('0x5')){if(_0x86d3d3===_0x11c0('0x10')){return null;}if(_0x86d3d3==='booked'&&!['rrmemory',_0x11c0('0x11')][_0x11c0('0x12')](_0x6edd55)){this[_0x11c0('0xe')](_0x11c0('0xf'),_0x11c0('0xb'));}}return _0x6edd55;}},'servicelevel':{'type':Sequelize[_0x11c0('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x11c0('0x13')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x11c0('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x11c0('0x3')](_0x11c0('0x14'),'no'),'defaultValue':_0x11c0('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x11c0('0x14'),'no',_0x11c0('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x11c0('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x11c0('0x3')](_0x11c0('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x11c0('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x11c0('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x11c0('0x3')](_0x11c0('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x11c0('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x11c0('0x3')](_0x11c0('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x11c0('0x3')](_0x11c0('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x11c0('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x11c0('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x11c0('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x11c0('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x11c0('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x11c0('0x3')]('yes','no'),'defaultValue':_0x11c0('0x14')},'announce_holdtime':{'type':Sequelize[_0x11c0('0x3')](_0x11c0('0x14'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x11c0('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x11c0('0x6')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x11c0('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0x11c0('0x6')]},'queue_less_than':{'type':Sequelize[_0x11c0('0x6')]},'periodic_announce':{'type':Sequelize[_0x11c0('0x16')],'set':function(_0x119c54){this[_0x11c0('0xe')]('periodic_announce',_0x119c54?_0x119c54[_0x11c0('0x17')](','):[]);},'get':function(){return this['getDataValue'](_0x11c0('0x18'))?this[_0x11c0('0x19')](_0x11c0('0x18'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':_0x11c0('0x14'),'set':function(_0x25c6da){this[_0x11c0('0xe')]('joinempty',_0x25c6da?_0x25c6da[_0x11c0('0x17')](','):undefined);},'get':function(){return this['getDataValue'](_0x11c0('0x1a'))?this[_0x11c0('0x19')](_0x11c0('0x1a'))[_0x11c0('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x499cd5){this[_0x11c0('0xe')]('leavewhenempty',_0x499cd5?_0x499cd5['join'](','):undefined);},'get':function(){return this[_0x11c0('0x19')](_0x11c0('0x1c'))?this['getDataValue'](_0x11c0('0x1c'))[_0x11c0('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x11c0('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x11c0('0x3')](_0x11c0('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x11c0('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x11c0('0x3')](_0x11c0('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x11c0('0x6')]},'description':{'type':Sequelize[_0x11c0('0x6')]},'acw':{'type':Sequelize[_0x11c0('0x1d')],'defaultValue':0x0,'set':function(_0x4b0d34){this[_0x11c0('0xe')]('acw',_0x4b0d34);if(_0x4b0d34){if(this['getDataValue'](_0x11c0('0x1e'))<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x11c0('0x3')]('preview',_0x11c0('0x1f'),_0x11c0('0x20'),_0x11c0('0x21'),_0x11c0('0x22')),'defaultValue':_0x11c0('0x1f'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x11c0('0x13')](0x4)[_0x11c0('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x11c0('0x24')},'dialLimitQueue':{'type':Sequelize[_0x11c0('0x13')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x11c0('0x25')},'dialPowerLevel':{'type':Sequelize[_0x11c0('0x26')](0x2)[_0x11c0('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x11c0('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x11c0('0x3')](_0x11c0('0x28'),_0x11c0('0x29')),'defaultValue':_0x11c0('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x11c0('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x11c0('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x11c0('0x13')](0x3)[_0x11c0('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x11c0('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x11c0('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0x11c0('0x13')](0x3)[_0x11c0('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x11c0('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':_0x11c0('0x2c'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x11c0('0x13')](0x3)[_0x11c0('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x11c0('0x2d')},'dialQueueProject':{'type':Sequelize[_0x11c0('0x6')],'comment':_0x11c0('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x11c0('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x11c0('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x11c0('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x11c0('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x11c0('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x11c0('0x31')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x11c0('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x11c0('0x13')](0x3)[_0x11c0('0x23')],'defaultValue':0x3,'comment':_0x11c0('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x11c0('0x13')](0x5)[_0x11c0('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x11c0('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x11c0('0x13')](0x3)[_0x11c0('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x11c0('0x35')},'dialTimezone':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':_0x11c0('0x36')},'dialPrefix':{'type':Sequelize[_0x11c0('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x11c0('0x3')](_0x11c0('0x37'),_0x11c0('0x38'),_0x11c0('0x39')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x11c0('0x1d')],'defaultValue':0x0,'comment':_0x11c0('0x3a')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x11c0('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x11c0('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x11c0('0x13')](0x9)[_0x11c0('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x11c0('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x11c0('0x13')](0x9)[_0x11c0('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x11c0('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x11c0('0x13')](0x9)[_0x11c0('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x11c0('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x11c0('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x11c0('0x13')](0x9)[_0x11c0('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x11c0('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x11c0('0x13')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x11c0('0x13')](0x5)[_0x11c0('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x11c0('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x11c0('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x11c0('0x13')](0x5)[_0x11c0('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x11c0('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x11c0('0x1d')],'defaultValue':0x0,'comment':_0x11c0('0x43')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x11c0('0x44'),'ASC'),'defaultValue':_0x11c0('0x44')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x11c0('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x11c0('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x11c0('0x13')](0x3)[_0x11c0('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x11c0('0x45')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x11c0('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x11c0('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x11c0('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x11c0('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x11c0('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x11c0('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x11c0('0x13')](0x3)[_0x11c0('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x11c0('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0x11c0('0x13')](0x5)[_0x11c0('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x11c0('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x11c0('0x13')](0x3)[_0x11c0('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x11c0('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x11c0('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x11c0('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0x11c0('0x13')](0x3)[_0x11c0('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x11c0('0x13')](0x5)[_0x11c0('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x11c0('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x11c0('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x11c0('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x11c0('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x11c0('0x1d')],'defaultValue':![],'comment':_0x11c0('0x4f'),'set':function(_0x1350f0){if(!_0x1350f0)this[_0x11c0('0xe')](_0x11c0('0x50'),null);this[_0x11c0('0xe')](_0x11c0('0x51'),_0x1350f0);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x11c0('0x13')](0x3)[_0x11c0('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x11c0('0x13')](0x3)[_0x11c0('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x11c0('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x11c0('0x13')](0x3)[_0x11c0('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x855e=['outbound','STRING','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','INTEGER','yes','all','once','TEXT','periodic_announce','split','join','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\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\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','ENUM','inbound'];(function(_0x14e65e,_0x461afd){var _0x4774a1=function(_0x39fc84){while(--_0x39fc84){_0x14e65e['push'](_0x14e65e['shift']());}};_0x4774a1(++_0x461afd);}(_0x855e,0x12f));var _0xe855=function(_0x1341a6,_0x23816a){_0x1341a6=_0x1341a6-0x0;var _0x37658e=_0x855e[_0x1341a6];return _0x37658e;};'use strict';var Sequelize=require(_0xe855('0x0'));module[_0xe855('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe855('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe855('0x3')](_0xe855('0x4'),_0xe855('0x5')),'allowNull':![],'defaultValue':_0xe855('0x4')},'musiconhold':{'type':Sequelize[_0xe855('0x6')],'defaultValue':_0xe855('0x7')},'announce':{'type':Sequelize[_0xe855('0x6')],'defaultValue':''},'strategy':{'type':Sequelize[_0xe855('0x3')]('rr',_0xe855('0x8'),_0xe855('0x9'),_0xe855('0xa'),_0xe855('0xb'),_0xe855('0xc'),_0xe855('0xd'),_0xe855('0xe'),_0xe855('0xf')),'allowNull':![],'defaultValue':'ringall','set':function(_0x843131){this[_0xe855('0x10')](_0xe855('0x11'),_0x843131?_0x843131:_0xe855('0xc'));},'get':function(){var _0x218334=this[_0xe855('0x12')](_0xe855('0x13'));var _0x559379=this[_0xe855('0x12')](_0xe855('0x14'));var _0x572c06=this[_0xe855('0x12')](_0xe855('0x11'));if(_0x218334==='outbound'){if(_0x559379==='preview'){return null;}if(_0x559379===_0xe855('0x15')&&![_0xe855('0xc'),_0xe855('0x16')]['includes'](_0x572c06)){this['setDataValue']('strategy',_0xe855('0xc'));}}return _0x572c06;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xe855('0x6')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xe855('0x17')](0xb)},'timeout':{'type':Sequelize[_0xe855('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xe855('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xe855('0x6')]},'weight':{'type':Sequelize[_0xe855('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xe855('0x18'),'no'),'defaultValue':_0xe855('0x18')},'autopause':{'type':Sequelize['ENUM'](_0xe855('0x18'),'no',_0xe855('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xe855('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xe855('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xe855('0x3')](_0xe855('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xe855('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xe855('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xe855('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xe855('0x3')](_0xe855('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xe855('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xe855('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe855('0x3')](_0xe855('0x18'),'no'),'defaultValue':_0xe855('0x18')},'announce_holdtime':{'type':Sequelize[_0xe855('0x3')](_0xe855('0x18'),'no',_0xe855('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xe855('0x3')](_0xe855('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xe855('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xe855('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xe855('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe855('0x6')]},'queue_youarenext':{'type':Sequelize[_0xe855('0x6')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xe855('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xe855('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe855('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xe855('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xe855('0x6')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xe855('0x1b')],'set':function(_0x975258){this[_0xe855('0x10')](_0xe855('0x1c'),_0x975258?_0x975258['join'](','):[]);},'get':function(){return this[_0xe855('0x12')](_0xe855('0x1c'))?this[_0xe855('0x12')](_0xe855('0x1c'))[_0xe855('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xe855('0x6')],'defaultValue':'yes','set':function(_0x4974c6){this[_0xe855('0x10')]('joinempty',_0x4974c6?_0x4974c6[_0xe855('0x1e')](','):undefined);},'get':function(){return this[_0xe855('0x12')]('joinempty')?this[_0xe855('0x12')](_0xe855('0x1f'))[_0xe855('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xe855('0x6')],'defaultValue':'no','set':function(_0x4c1a33){this[_0xe855('0x10')](_0xe855('0x20'),_0x4c1a33?_0x4c1a33[_0xe855('0x1e')](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this[_0xe855('0x12')](_0xe855('0x20'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe855('0x3')](_0xe855('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xe855('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xe855('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xe855('0x21')],'defaultValue':0x0,'set':function(_0x3d6a60){this[_0xe855('0x10')](_0xe855('0x22'),_0x3d6a60);if(_0x3d6a60){if(this[_0xe855('0x12')](_0xe855('0x23'))<0x2){this[_0xe855('0x10')](_0xe855('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xe855('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xe855('0x21')],'defaultValue':0x0,'comment':_0xe855('0x24')},'dialMethod':{'type':Sequelize[_0xe855('0x3')](_0xe855('0x25'),_0xe855('0x26'),'power',_0xe855('0x27'),_0xe855('0x15')),'defaultValue':_0xe855('0x26'),'comment':_0xe855('0x28')},'dialLimitChannel':{'type':Sequelize[_0xe855('0x17')](0x4)[_0xe855('0x29')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe855('0x2a')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xe855('0x29')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xe855('0x2b')](0x2)[_0xe855('0x29')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0xe855('0x2c')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xe855('0x2b')](0x2)[_0xe855('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xe855('0x2d')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xe855('0x29')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xe855('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe855('0x29')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe855('0x2f')},'dialQueueOptions':{'type':Sequelize[_0xe855('0x6')],'defaultValue':'tTxX','comment':_0xe855('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe855('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xe855('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe855('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe855('0x17')](0x5)[_0xe855('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe855('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0xe855('0x17')](0x3)[_0xe855('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xe855('0x17')](0x5)[_0xe855('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe855('0x17')](0x3)[_0xe855('0x29')],'defaultValue':0x3,'comment':_0xe855('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe855('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe855('0x34')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe855('0x29')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe855('0x35')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe855('0x6')],'defaultValue':_0xe855('0x36')},'dialPrefix':{'type':Sequelize[_0xe855('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xe855('0x3')](_0xe855('0x37'),_0xe855('0x38'),_0xe855('0x39')),'defaultValue':_0xe855('0x37')},'dialAMDActive':{'type':Sequelize[_0xe855('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe855('0x29')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe855('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe855('0x17')](0x9)[_0xe855('0x29')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe855('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xe855('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xe855('0x17')](0x9)[_0xe855('0x29')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe855('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe855('0x17')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe855('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xe855('0x29')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe855('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xe855('0x29')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xe855('0x29')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xe855('0x17')](0x5)[_0xe855('0x29')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xe855('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xe855('0x21')],'defaultValue':0x0,'comment':_0xe855('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe855('0x3')](_0xe855('0x41'),'ASC'),'defaultValue':_0xe855('0x41')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xe855('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xe855('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xe855('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xe855('0x29')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe855('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe855('0x17')](0x3)[_0xe855('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe855('0x17')](0x5)[_0xe855('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe855('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0xe855('0x17')](0x3)[_0xe855('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xe855('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe855('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe855('0x17')](0x3)[_0xe855('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe855('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe855('0x17')](0x5)[_0xe855('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe855('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe855('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe855('0x17')](0x5)[_0xe855('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe855('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe855('0x17')](0x3)[_0xe855('0x29')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe855('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe855('0x17')](0x5)[_0xe855('0x29')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe855('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xe855('0x4a')},'mandatoryDisposition':{'type':Sequelize[_0xe855('0x21')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x50f33a){if(!_0x50f33a)this[_0xe855('0x10')](_0xe855('0x4b'),null);this[_0xe855('0x10')](_0xe855('0x4c'),_0x50f33a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xe855('0x17')](0x3)[_0xe855('0x29')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xe855('0x29')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xe855('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xe855('0x17')](0x3)[_0xe855('0x29')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xe855('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 46f9414..9e32752 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 _0x5fc3=['redis','localhost','./voiceQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','UserProfileResource','destroy','stack','name','index','VoiceQueue','fieldName','getOptions','where','include','findAll','rows','catch','show','params','model','keys','query','intersection','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','rawAttributes','fields','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','nolimit','order','sort','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','hasOwnProperty','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','emit','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','User','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x56518f,_0x299a12){var _0x431257=function(_0x1d4e61){while(--_0x1d4e61){_0x56518f['push'](_0x56518f['shift']());}};_0x431257(++_0x299a12);}(_0x5fc3,0xa8));var _0x35fc=function(_0x51ec61,_0xf9d1e3){_0x51ec61=_0x51ec61-0x0;var _0x223200=_0x5fc3[_0x51ec61];return _0x223200;};'use strict';var moment=require(_0x35fc('0x0'));var BPromise=require(_0x35fc('0x1'));var util=require('util');var _=require(_0x35fc('0x2'));var squel=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var qs=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('api');var config=require(_0x35fc('0x7'));var db=require(_0x35fc('0x8'))['db'];config[_0x35fc('0x9')]=_['defaults'](config['redis'],{'host':_0x35fc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x35fc('0x9')]));require(_0x35fc('0xb'))[_0x35fc('0xc')](socket);function respondWithStatusCode(_0x1e5f90,_0x34ff19){_0x34ff19=_0x34ff19||0xcc;return function(_0xf9d3a6){if(_0xf9d3a6){return _0x1e5f90[_0x35fc('0xd')](_0x34ff19);}return _0x1e5f90['status'](_0x34ff19)[_0x35fc('0xe')]();};}function respondWithResult(_0x2a1084,_0x4fdca1){_0x4fdca1=_0x4fdca1||0xc8;return function(_0x471549){if(_0x471549){return _0x2a1084[_0x35fc('0xf')](_0x4fdca1)['json'](_0x471549);}};}function respondWithFilteredResult(_0xda83fb,_0x1a9f2b){return function(_0x5469f5){if(_0x5469f5){var _0x4cbe74=typeof _0x1a9f2b[_0x35fc('0x10')]==='undefined'&&typeof _0x1a9f2b[_0x35fc('0x11')]===_0x35fc('0x12');var _0x2a6ad2=_0x5469f5[_0x35fc('0x13')];var _0x38d9f2=_0x4cbe74?0x0:_0x1a9f2b['offset'];var _0x59507a=_0x4cbe74?_0x5469f5['count']:_0x1a9f2b['offset']+_0x1a9f2b[_0x35fc('0x11')];var _0x229d56;if(_0x59507a>=_0x2a6ad2){_0x59507a=_0x2a6ad2;_0x229d56=0xc8;}else{_0x229d56=0xce;}_0xda83fb[_0x35fc('0xf')](_0x229d56);return _0xda83fb[_0x35fc('0x14')](_0x35fc('0x15'),_0x38d9f2+'-'+_0x59507a+'/'+_0x2a6ad2)[_0x35fc('0x16')](_0x5469f5);}return null;};}function saveUpdates(_0x480851){return function(_0x26ba54){if(_0x26ba54){return _0x26ba54[_0x35fc('0x17')](_0x480851)['then'](function(_0x41e165){return _0x41e165;});}return null;};}function removeEntity(_0x363e47){return function(_0x2e513b){if(_0x2e513b){return _0x2e513b['destroy']()[_0x35fc('0x18')](function(){var _0x3c58ea=_0x2e513b[_0x35fc('0x19')]({'plain':!![]});var _0x488234=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b'),'ignore':![]},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d'),'ignore':![]}];var _0x20ffde=_(_0x488234)[_0x35fc('0x1e')](_0x35fc('0x1f'))[_0x35fc('0x20')](_0x35fc('0x21'))[_0x35fc('0x21')]();if(_['includes'](_0x20ffde,_0x3c58ea[_0x35fc('0x22')])){return;}var _0xd5399f=_[_0x35fc('0x23')](_0x488234,[_0x35fc('0x21'),_0x3c58ea[_0x35fc('0x22')]])['name'];return db[_0x35fc('0x24')][_0x35fc('0x25')]({'where':{'type':_0xd5399f,'resourceId':_0x3c58ea['id']}})['then'](function(){return _0x2e513b;});})[_0x35fc('0x18')](function(){_0x363e47[_0x35fc('0xf')](0xcc)[_0x35fc('0xe')]();});}};}function handleEntityNotFound(_0x51cfec){return function(_0x4086e9){if(!_0x4086e9){_0x51cfec['sendStatus'](0x194);}return _0x4086e9;};}function handleError(_0x1bf180,_0xdfab9f){_0xdfab9f=_0xdfab9f||0x1f4;return function(_0x5cb986){logger['error'](_0x5cb986[_0x35fc('0x26')]);if(_0x5cb986['name']){delete _0x5cb986[_0x35fc('0x27')];}_0x1bf180[_0x35fc('0xf')](_0xdfab9f)['send'](_0x5cb986);};}exports[_0x35fc('0x28')]=function(_0x645eac,_0x383837){var _0x9f3c8a={};var _0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x20')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x22')]['key']};});_0x9f3c8a=qs[_0x35fc('0x2b')](_0x134dfa,_0x645eac);var _0x16f067={'where':_0x9f3c8a[_0x35fc('0x2c')]};return db[_0x35fc('0x29')][_0x35fc('0x13')](_0x16f067)[_0x35fc('0x18')](function(_0x222ddb){_0x3735da[_0x35fc('0x13')]=_0x222ddb;_0x9f3c8a[_0x35fc('0x2d')]=qs[_0x35fc('0x2d')](_0x645eac['query']);return db['VoiceQueue'][_0x35fc('0x2e')](_0x9f3c8a);})['then'](function(_0x37b394){_0x3735da[_0x35fc('0x2f')]=_0x37b394;return _0x3735da;})[_0x35fc('0x18')](respondWithFilteredResult(_0x383837,_0x9f3c8a))[_0x35fc('0x30')](handleError(_0x383837,null));};exports[_0x35fc('0x31')]=function(_0x12e78f,_0x4e43b4){var _0x3fe193={'raw':![],'where':{'id':_0x12e78f[_0x35fc('0x32')]['id']}},_0x330a14={};_0x330a14[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x29')]['rawAttributes']);_0x330a14[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x12e78f[_0x35fc('0x35')]);_0x330a14['filters']=_[_0x35fc('0x36')](_0x330a14['model'],_0x330a14[_0x35fc('0x35')]);_0x3fe193[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x330a14[_0x35fc('0x33')],qs['fields'](_0x12e78f['query']['fields']));_0x3fe193[_0x35fc('0x37')]=_0x3fe193['attributes'][_0x35fc('0x38')]?_0x3fe193['attributes']:_0x330a14[_0x35fc('0x33')];if(_0x12e78f[_0x35fc('0x35')][_0x35fc('0x39')]){_0x3fe193[_0x35fc('0x2d')]=[{'all':!![]}];}_0x3fe193=_[_0x35fc('0x3a')]({},_0x3fe193,_0x12e78f[_0x35fc('0x3b')]);return db[_0x35fc('0x29')]['find'](_0x3fe193)[_0x35fc('0x18')](handleEntityNotFound(_0x4e43b4,null))[_0x35fc('0x18')](respondWithResult(_0x4e43b4,null))['catch'](handleError(_0x4e43b4,null));};exports[_0x35fc('0x3c')]=function(_0x1ccc41,_0x1aac67){return db[_0x35fc('0x29')][_0x35fc('0x3c')](_0x1ccc41[_0x35fc('0x3d')],{})['then'](function(_0x3f6480){var _0x267858=_0x1ccc41[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x267858)throw new Error(_0x35fc('0x3f'));if(_0x267858[_0x35fc('0x40')]==='user'){var _0x237548=_0x3f6480[_0x35fc('0x19')]({'plain':!![]});var _0x43b77c=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':_0x35fc('0x1c'),'value':_0x35fc('0x1d')}];var _0x3ec51f=_['find'](_0x43b77c,['value',_0x237548[_0x35fc('0x22')]])[_0x35fc('0x27')];return db['UserProfileSection']['find']({'where':{'name':_0x3ec51f,'userProfileId':_0x267858['userProfileId']},'raw':!![]})[_0x35fc('0x18')](function(_0x10f98b){if(_0x10f98b&&_0x10f98b['autoAssociation']===0x0){return db[_0x35fc('0x24')][_0x35fc('0x3c')]({'name':_0x237548[_0x35fc('0x27')],'resourceId':_0x237548['id'],'type':_0x10f98b[_0x35fc('0x27')],'sectionId':_0x10f98b['id']},{})['then'](function(){return _0x3f6480;});}else{return _0x3f6480;}})['catch'](function(_0x5bf2f4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bf2f4);throw _0x5bf2f4;});}return _0x3f6480;})[_0x35fc('0x18')](respondWithResult(_0x1aac67,0xc9))[_0x35fc('0x30')](handleError(_0x1aac67,null));};exports['clone']=function(_0x119925,_0x56cf1f){var _0x13d16c={'where':{'id':_0x119925[_0x35fc('0x32')]['id']}},_0x40797d={};_0x40797d[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['VoiceQueue'][_0x35fc('0x41')]);_0x13d16c[_0x35fc('0x37')]=_['intersection'](_0x40797d[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x119925[_0x35fc('0x35')][_0x35fc('0x42')]));_0x13d16c['attributes']=_0x13d16c[_0x35fc('0x37')]['length']?_0x13d16c['attributes']:_0x40797d[_0x35fc('0x33')];if(_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]){_0x13d16c[_0x35fc('0x2d')]=[{'all':!![]}];}_0x13d16c=_[_0x35fc('0x3a')]({},_0x13d16c,_0x119925[_0x35fc('0x3b')]);return db[_0x35fc('0x29')][_0x35fc('0x23')](_0x13d16c)['then'](handleEntityNotFound(_0x56cf1f,null))[_0x35fc('0x18')](function(_0x91d7c0){if(_0x91d7c0){var _0xeca02e=_0x91d7c0[_0x35fc('0x19')]({'plain':!![]});_0xeca02e=qs[_0x35fc('0x43')](_0xeca02e,['id',_0x35fc('0x44'),_0x35fc('0x45')]);_0x119925[_0x35fc('0x3d')]=_[_0x35fc('0x43')](_0x119925[_0x35fc('0x3d')],['id',_0x35fc('0x44'),_0x35fc('0x45')]);return db[_0x35fc('0x29')][_0x35fc('0x3c')](_['merge'](_0xeca02e,_0x119925['body']),{'include':_0x119925[_0x35fc('0x35')][_0x35fc('0x39')]?[{'all':!![]}]:undefined})[_0x35fc('0x18')](function(_0x2bf0b0){var _0x3ee296=_0x119925[_0x35fc('0x3e')]['get']({'plain':!![]});if(!_0x3ee296)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ee296[_0x35fc('0x40')]===_0x35fc('0x3e')){var _0x395d63=_0x2bf0b0[_0x35fc('0x19')]({'plain':!![]});var _0x5b2595=[{'name':_0x35fc('0x1a'),'value':_0x35fc('0x1b')},{'name':'QueueCampaigns','value':_0x35fc('0x1d')}];var _0x2536d3=_['find'](_0x5b2595,[_0x35fc('0x21'),_0x395d63[_0x35fc('0x22')]])[_0x35fc('0x27')];return db[_0x35fc('0x46')]['find']({'where':{'name':_0x2536d3,'userProfileId':_0x3ee296['userProfileId']},'raw':!![]})['then'](function(_0x240338){if(_0x240338&&_0x240338[_0x35fc('0x47')]===0x0){return db['UserProfileResource'][_0x35fc('0x3c')]({'name':_0x395d63[_0x35fc('0x27')],'resourceId':_0x395d63['id'],'type':_0x240338[_0x35fc('0x27')],'sectionId':_0x240338['id']},{})[_0x35fc('0x18')](function(){return _0x2bf0b0;});}else{return _0x2bf0b0;}})[_0x35fc('0x30')](function(_0x538be0){logger[_0x35fc('0x48')](_0x35fc('0x49'),_0x538be0);throw _0x538be0;});}return _0x2bf0b0;});}})[_0x35fc('0x18')](respondWithResult(_0x56cf1f,0xc9))['catch'](handleError(_0x56cf1f,null));};exports[_0x35fc('0x17')]=function(_0x1dbf5a,_0x47fb1a){if(_0x1dbf5a[_0x35fc('0x3d')]['id']){delete _0x1dbf5a[_0x35fc('0x3d')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x1dbf5a[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x47fb1a,null))[_0x35fc('0x18')](saveUpdates(_0x1dbf5a[_0x35fc('0x3d')],null))['then'](respondWithResult(_0x47fb1a,null))[_0x35fc('0x30')](handleError(_0x47fb1a,null));};exports[_0x35fc('0x25')]=function(_0x303927,_0x4fabd4){return db[_0x35fc('0x29')]['find']({'where':{'id':_0x303927['params']['id']}})['then'](handleEntityNotFound(_0x4fabd4,null))[_0x35fc('0x18')](removeEntity(_0x4fabd4,null))[_0x35fc('0x30')](handleError(_0x4fabd4,null));};exports[_0x35fc('0x4a')]=function(_0x13901c,_0x3d06b8){var _0x4bbea0={'raw':![],'where':{}};var _0x579f5a={};var _0x5353ea={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x13901c[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3d06b8,null))[_0x35fc('0x18')](function(_0x3ef680){if(_0x3ef680){_0x579f5a['model']=_[_0x35fc('0x34')](db[_0x35fc('0x4b')][_0x35fc('0x41')]);_0x579f5a[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x13901c[_0x35fc('0x35')]);_0x579f5a[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x579f5a[_0x35fc('0x33')],_0x579f5a['query']);_0x4bbea0[_0x35fc('0x37')]=_['intersection'](_0x579f5a[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x13901c[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4bbea0['attributes']=_0x4bbea0[_0x35fc('0x37')]['length']?_0x4bbea0['attributes']:_0x579f5a['model'];if(!_0x13901c[_0x35fc('0x35')]['hasOwnProperty'](_0x35fc('0x4d'))){_0x4bbea0['limit']=qs[_0x35fc('0x11')](_0x13901c['query'][_0x35fc('0x11')]);_0x4bbea0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x13901c[_0x35fc('0x35')]['offset']);}_0x4bbea0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x13901c[_0x35fc('0x35')]['sort']);_0x4bbea0[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x13901c[_0x35fc('0x35')],_0x579f5a[_0x35fc('0x4c')]));_0x4bbea0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3ef680['id'];if(_0x13901c[_0x35fc('0x35')]['filter']){_0x4bbea0[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x4bbea0[_0x35fc('0x2c')],{'$or':_['map'](_0x4bbea0[_0x35fc('0x37')],function(_0x1b76f0){var _0x586729={};_0x586729[_0x1b76f0]={'$like':'%'+_0x13901c['query'][_0x35fc('0x1e')]+'%'};return _0x586729;})});}_0x4bbea0=_['merge']({},_0x4bbea0,_0x13901c[_0x35fc('0x3b')]);return db[_0x35fc('0x4b')][_0x35fc('0x13')]({'where':_0x4bbea0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x20ddc6){_0x5353ea[_0x35fc('0x13')]=_0x20ddc6;if(_0x13901c[_0x35fc('0x35')][_0x35fc('0x39')]){_0x4bbea0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x4b')][_0x35fc('0x2e')](_0x4bbea0);})[_0x35fc('0x18')](function(_0x9f034e){_0x5353ea[_0x35fc('0x2f')]=_0x9f034e;return _0x5353ea;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x3d06b8,_0x4bbea0))[_0x35fc('0x30')](handleError(_0x3d06b8,null));};exports[_0x35fc('0x52')]=function(_0x3b2160,_0x3f3f36){var _0x4ba1b0={'raw':!![],'where':{}};var _0x1797d0={};var _0x55cb69={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x3b2160[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x3f3f36,null))[_0x35fc('0x18')](function(_0x3f56f4){if(_0x3f56f4){_0x1797d0[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x54')][_0x35fc('0x41')]);_0x1797d0[_0x35fc('0x35')]=_['keys'](_0x3b2160[_0x35fc('0x35')]);_0x1797d0[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1797d0[_0x35fc('0x33')],_0x1797d0[_0x35fc('0x35')]);_0x4ba1b0[_0x35fc('0x37')]=_['intersection'](_0x1797d0[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x42')]));_0x4ba1b0[_0x35fc('0x37')]=_0x4ba1b0[_0x35fc('0x37')][_0x35fc('0x38')]?_0x4ba1b0[_0x35fc('0x37')]:_0x1797d0[_0x35fc('0x33')];if(!_0x3b2160['query'][_0x35fc('0x55')]('nolimit')){_0x4ba1b0[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x3b2160['query'][_0x35fc('0x11')]);_0x4ba1b0[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x4ba1b0[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x3b2160[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x4ba1b0['where']=qs['filters'](_['pick'](_0x3b2160['query'],_0x1797d0[_0x35fc('0x4c')]));_0x4ba1b0[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x3f56f4['id'];if(_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x4ba1b0['where']=_[_0x35fc('0x3a')](_0x4ba1b0[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x4ba1b0[_0x35fc('0x37')],function(_0x584a58){var _0x15e936={};_0x15e936[_0x584a58]={'$like':'%'+_0x3b2160[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x15e936;})});}_0x4ba1b0=_['merge']({},_0x4ba1b0,_0x3b2160[_0x35fc('0x3b')]);return db[_0x35fc('0x54')][_0x35fc('0x13')]({'where':_0x4ba1b0[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x31d276){_0x55cb69[_0x35fc('0x13')]=_0x31d276;if(_0x3b2160[_0x35fc('0x35')]['includeAll']){_0x4ba1b0[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x54')][_0x35fc('0x2e')](_0x4ba1b0);})[_0x35fc('0x18')](function(_0x221c5b){_0x55cb69[_0x35fc('0x2f')]=_0x221c5b;return _0x55cb69;});}})['then'](respondWithFilteredResult(_0x3f3f36,_0x4ba1b0))[_0x35fc('0x30')](handleError(_0x3f3f36,null));};exports['getHopperFinals']=function(_0x4855ee,_0x1a2da0){var _0x597670={'raw':!![],'where':{}};var _0x1246c7={};var _0x233b7d={'count':0x0,'rows':[]};return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x4855ee[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x1a2da0,null))[_0x35fc('0x18')](function(_0x1beb46){if(_0x1beb46){_0x1246c7[_0x35fc('0x33')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x1246c7[_0x35fc('0x35')]=_['keys'](_0x4855ee[_0x35fc('0x35')]);_0x1246c7[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],_0x1246c7['query']);_0x597670[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x1246c7[_0x35fc('0x33')],qs['fields'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x42')]));_0x597670[_0x35fc('0x37')]=_0x597670['attributes']['length']?_0x597670['attributes']:_0x1246c7[_0x35fc('0x33')];if(!_0x4855ee[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x597670['limit']=qs[_0x35fc('0x11')](_0x4855ee[_0x35fc('0x35')]['limit']);_0x597670['offset']=qs[_0x35fc('0x10')](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x597670['order']=qs['sort'](_0x4855ee[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x597670['where']=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4855ee[_0x35fc('0x35')],_0x1246c7['filters']));_0x597670[_0x35fc('0x2c')][_0x35fc('0x51')]=_0x1beb46['id'];if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x597670['where']=_[_0x35fc('0x3a')](_0x597670[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x597670['attributes'],function(_0x96dfc){var _0x26d242={};_0x26d242[_0x96dfc]={'$like':'%'+_0x4855ee[_0x35fc('0x35')]['filter']+'%'};return _0x26d242;})});}_0x597670=_[_0x35fc('0x3a')]({},_0x597670,_0x4855ee[_0x35fc('0x3b')]);return db['CmHopperFinal'][_0x35fc('0x13')]({'where':_0x597670[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x45eaae){_0x233b7d[_0x35fc('0x13')]=_0x45eaae;if(_0x4855ee[_0x35fc('0x35')][_0x35fc('0x39')]){_0x597670[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x56')]['findAll'](_0x597670);})[_0x35fc('0x18')](function(_0x3fc6cc){_0x233b7d[_0x35fc('0x2f')]=_0x3fc6cc;return _0x233b7d;});}})[_0x35fc('0x18')](respondWithFilteredResult(_0x1a2da0,_0x597670))['catch'](handleError(_0x1a2da0,null));};exports[_0x35fc('0x57')]=function(_0x1808a3,_0x209d7a){var _0x7b633a={'raw':!![],'where':{}};var _0x4684b6={};var _0x319998={'count':0x0,'rows':[]};return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x1808a3['params']['id']}})['then'](handleEntityNotFound(_0x209d7a,null))[_0x35fc('0x18')](function(_0xafa771){if(_0xafa771){_0x4684b6[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x58')][_0x35fc('0x41')]);_0x4684b6[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x1808a3['query']);_0x4684b6['filters']=_[_0x35fc('0x36')](_0x4684b6['model'],_0x4684b6[_0x35fc('0x35')]);_0x7b633a[_0x35fc('0x37')]=_['intersection'](_0x4684b6['model'],qs[_0x35fc('0x42')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x42')]));_0x7b633a['attributes']=_0x7b633a[_0x35fc('0x37')][_0x35fc('0x38')]?_0x7b633a[_0x35fc('0x37')]:_0x4684b6['model'];if(!_0x1808a3[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x7b633a[_0x35fc('0x11')]=qs['limit'](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x11')]);_0x7b633a[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x1808a3[_0x35fc('0x35')][_0x35fc('0x10')]);}_0x7b633a['order']=qs[_0x35fc('0x4f')](_0x1808a3[_0x35fc('0x35')]['sort']);_0x7b633a[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_['pick'](_0x1808a3[_0x35fc('0x35')],_0x4684b6[_0x35fc('0x4c')]));_0x7b633a[_0x35fc('0x2c')][_0x35fc('0x51')]=_0xafa771['id'];if(_0x1808a3[_0x35fc('0x35')]['filter']){_0x7b633a[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x7b633a[_0x35fc('0x2c')],{'$or':_['map'](_0x7b633a[_0x35fc('0x37')],function(_0x5a8641){var _0x58d3d5={};_0x58d3d5[_0x5a8641]={'$like':'%'+_0x1808a3[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x58d3d5;})});}_0x7b633a=_[_0x35fc('0x3a')]({},_0x7b633a,_0x1808a3[_0x35fc('0x3b')]);return db[_0x35fc('0x58')]['count']({'where':_0x7b633a[_0x35fc('0x2c')]})[_0x35fc('0x18')](function(_0x44683e){_0x319998['count']=_0x44683e;if(_0x1808a3[_0x35fc('0x35')][_0x35fc('0x39')]){_0x7b633a[_0x35fc('0x2d')]=[{'all':!![]}];}return db[_0x35fc('0x58')][_0x35fc('0x2e')](_0x7b633a);})['then'](function(_0x1a2d73){_0x319998[_0x35fc('0x2f')]=_0x1a2d73;return _0x319998;});}})['then'](respondWithFilteredResult(_0x209d7a,_0x7b633a))['catch'](handleError(_0x209d7a,null));};exports[_0x35fc('0x59')]=function(_0x44b356,_0x207336){var _0x2b16b2={};var _0x405a43={};var _0x2b2a87;var _0x8c80ca;return db['VoiceQueue']['findOne']({'where':{'id':_0x44b356[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x207336,null))[_0x35fc('0x18')](function(_0x1a92fa){if(_0x1a92fa){_0x2b2a87=_0x1a92fa;_0x405a43[_0x35fc('0x33')]=_['keys'](db['Team'][_0x35fc('0x41')]);_0x405a43[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x44b356[_0x35fc('0x35')]);_0x405a43['filters']=_['intersection'](_0x405a43[_0x35fc('0x33')],_0x405a43[_0x35fc('0x35')]);_0x2b16b2[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x405a43['model'],qs['fields'](_0x44b356[_0x35fc('0x35')][_0x35fc('0x42')]));_0x2b16b2['attributes']=_0x2b16b2[_0x35fc('0x37')][_0x35fc('0x38')]?_0x2b16b2[_0x35fc('0x37')]:_0x405a43[_0x35fc('0x33')];_0x2b16b2[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x44b356[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x2b16b2[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x44b356[_0x35fc('0x35')],_0x405a43[_0x35fc('0x4c')]));if(_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x2b16b2[_0x35fc('0x2c')]=_['merge'](_0x2b16b2[_0x35fc('0x2c')],{'$or':_['map'](_0x2b16b2[_0x35fc('0x37')],function(_0x5d677a){var _0x5aa072={};_0x5aa072[_0x5d677a]={'$like':'%'+_0x44b356[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x5aa072;})});}_0x2b16b2=_[_0x35fc('0x3a')]({},_0x2b16b2,_0x44b356['options']);return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})[_0x35fc('0x18')](function(_0xe9c7c2){if(_0xe9c7c2){_0x8c80ca=_0xe9c7c2[_0x35fc('0x38')];if(!_0x44b356[_0x35fc('0x35')][_0x35fc('0x55')]('nolimit')){_0x2b16b2['limit']=qs[_0x35fc('0x11')](_0x44b356['query']['limit']);_0x2b16b2[_0x35fc('0x10')]=qs['offset'](_0x44b356['query']['offset']);}return _0x2b2a87[_0x35fc('0x59')](_0x2b16b2);}})['then'](function(_0x355154){if(_0x355154){return _0x355154?{'count':_0x8c80ca,'rows':_0x355154}:null;}})[_0x35fc('0x18')](respondWithResult(_0x207336,null))[_0x35fc('0x30')](handleError(_0x207336,null));};exports[_0x35fc('0x5a')]=function(_0x392212,_0x201dfa){var _0x4ab6f9=_0x392212['body'][_0x35fc('0x5b')];var _0x5994ec=_[_0x35fc('0x20')](_0x4ab6f9,'id');return db[_0x35fc('0x5c')]['findAll']({'where':{'id':_0x5994ec},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]}]})[_0x35fc('0x18')](function(_0x28525f){if(_0x28525f){var _0x9116b1=_[_0x35fc('0x60')](_0x28525f,function(_0x4818ea){var _0x5436a3=_0x4818ea['get']({'plain':!![]});_0x5436a3['Agents'][_0x35fc('0x61')](function(_0x4c9c90){_0x4c9c90[_0x35fc('0x62')]=_['find'](_0x4ab6f9,{'id':_0x5436a3['id']})[_0x35fc('0x62')];});return _0x5436a3[_0x35fc('0x63')];});return db['VoiceQueue']['find']({'where':{'id':_0x392212[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x10ef95){return db[_0x35fc('0x64')][_0x35fc('0x65')](function(_0x4ff80c){return _0x10ef95['addTeams'](_0x5994ec,{'transaction':_0x4ff80c})[_0x35fc('0x18')](function(){return BPromise['each'](_0x4ab6f9,function(_0x15b6be){return db['TeamVoiceQueue'][_0x35fc('0x66')]({'TeamId':_0x15b6be['id'],'VoiceQueueId':_0x392212[_0x35fc('0x32')]['id'],'penalty':_0x15b6be[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_0x9116b1,function(_0x29a77a){return db['UserVoiceQueue'][_0x35fc('0x67')]({'where':{'UserId':_0x29a77a['id'],'VoiceQueueId':_0x392212['params']['id']},'defaults':{'penalty':_0x29a77a['penalty']},'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){return BPromise['each'](_[_0x35fc('0x1e')](_0x9116b1,{'online':!![]}),function(_0x2c8361){return db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x2c8361[_0x35fc('0x27')],'UserId':_0x2c8361['id'],'queue_name':_0x10ef95[_0x35fc('0x27')],'VoiceQueueId':_0x10ef95['id'],'interface':_[_0x35fc('0x69')](_0x2c8361[_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x2c8361[_0x35fc('0x27')]):_0x2c8361[_0x35fc('0x5f')],'paused':_0x2c8361[_0x35fc('0x5e')]||![],'penalty':_0x2c8361[_0x35fc('0x62')]},{'transaction':_0x4ff80c});});})[_0x35fc('0x18')](function(){_0x9116b1[_0x35fc('0x61')](function(_0x4020ae){socket[_0x35fc('0x6b')]('userVoiceQueue:save',{'UserId':_0x4020ae['id'],'VoiceQueueId':_0x10ef95['id']});});});});});}})['then'](respondWithStatusCode(_0x201dfa,null))['catch'](handleError(_0x201dfa,null));};exports['removeTeams']=function(_0x5c8419,_0x271087){return db[_0x35fc('0x5c')][_0x35fc('0x2e')]({'where':{'id':_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x35fc('0x63'),'attributes':['id'],'raw':!![]}]})[_0x35fc('0x18')](handleEntityNotFound(_0x271087,null))[_0x35fc('0x18')](function(_0x2f450e){var _0x370e99=_['map'](_0x2f450e,'id');var _0x195ca3=[];var _0x398359=[];var _0x4188bc=squel['select']();_0x4188bc[_0x35fc('0x6d')](_0x35fc('0x6e'))[_0x35fc('0x6f')](_0x35fc('0x70'),'tq')[_0x35fc('0x71')](_0x35fc('0x72'),'ut',_0x35fc('0x73'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0x5c8419[_0x35fc('0x32')]['id']);for(var _0x3aba1c=0x0;_0x3aba1c<_0x2f450e[_0x35fc('0x38')];_0x3aba1c+=0x1){let _0x225eb1=_0x2f450e[_0x3aba1c];for(var _0x206f0b=0x0;_0x206f0b<_0x225eb1[_0x35fc('0x63')]['length'];_0x206f0b+=0x1){let _0x4ae3d8=_0x225eb1[_0x35fc('0x63')][_0x206f0b];var _0x6a0c44=_0x4188bc[_0x35fc('0x75')]();_0x6a0c44[_0x35fc('0x2c')](_0x35fc('0x76'),_0x4ae3d8['id']);_0x398359[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x6a0c44[_0x35fc('0x78')](),{'type':db[_0x35fc('0x64')][_0x35fc('0x79')][_0x35fc('0x7a')]})[_0x35fc('0x18')](function(_0x336c4a){if(_0x336c4a[_0x35fc('0x38')]===0x1){return _0x4ae3d8['id'];}else{var _0x5824a0=_[_0x35fc('0x7b')](_[_0x35fc('0x20')](_0x336c4a,_0x35fc('0x7c')),function(_0x34e007){return _[_0x35fc('0x7d')](_0x370e99,_0x34e007);});if(_0x5824a0){return _0x4ae3d8['id'];}}}));}}return BPromise[_0x35fc('0x7e')](_0x398359)[_0x35fc('0x18')](function(_0xa4c51a){_0x195ca3=_(_0x195ca3)['union'](_0xa4c51a)['compact']()[_0x35fc('0x21')]();return db[_0x35fc('0x29')]['find']({'where':{'id':_0x5c8419[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(_0x43a794){return db[_0x35fc('0x64')]['transaction'](function(_0x42912c){return _0x43a794[_0x35fc('0x7f')](_0x5c8419[_0x35fc('0x35')][_0x35fc('0x6c')],{'transaction':_0x42912c})['then'](function(){if(!_[_0x35fc('0x80')](_0x195ca3)){return _0x43a794[_0x35fc('0x81')](_0x195ca3,{'transaction':_0x42912c})['then'](function(){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0x5c8419[_0x35fc('0x32')]['id'],'UserId':_0x195ca3},'transaction':_0x42912c});});}})['then'](function(){_0x195ca3[_0x35fc('0x61')](function(_0x4de072){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':_0x4de072,'VoiceQueueId':_0x43a794['id']});});});});});});})['then'](respondWithStatusCode(_0x271087,null))[_0x35fc('0x30')](handleError(_0x271087,null));};exports[_0x35fc('0x83')]=function(_0x139065,_0x25aedf){var _0x316d37,_0x3fd897;return db[_0x35fc('0x29')]['find']({'where':{'id':_0x139065['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x25aedf,null))[_0x35fc('0x18')](function(_0x2463dd){if(_0x2463dd){_0x3fd897=_0x2463dd;return _0x2463dd[_0x35fc('0x83')](_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x139065['body'],[_0x35fc('0x6c'),'id'])||{})[_0x35fc('0x84')](function(_0x46b9b6){for(var _0x4cdc31=0x0;_0x4cdc31<_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x35fc('0x38')];_0x4cdc31+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x85'),{'UserId':Number(_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')][_0x4cdc31]),'VoiceQueueId':Number(_0x139065[_0x35fc('0x32')]['id'])});}return _0x46b9b6;});}})[_0x35fc('0x18')](function(_0x14e414){_0x316d37=_0x14e414||[];if(_0x3fd897){return db[_0x35fc('0x86')][_0x35fc('0x2e')]({'where':{'id':_0x139065[_0x35fc('0x3d')][_0x35fc('0x6c')]},'attributes':['id',_0x35fc('0x27'),_0x35fc('0x5d'),_0x35fc('0x5e'),_0x35fc('0x5f')],'raw':!![]});}})[_0x35fc('0x18')](function(_0x4949ed){if(!_[_0x35fc('0x80')](_0x4949ed)){var _0x4f74ff=[];for(var _0x28cbc8=0x0;_0x28cbc8<_0x4949ed[_0x35fc('0x38')];_0x28cbc8++){if(_0x4949ed[_0x28cbc8]['online']){_0x4f74ff[_0x35fc('0x77')](db[_0x35fc('0x68')][_0x35fc('0x66')]({'membername':_0x4949ed[_0x28cbc8][_0x35fc('0x27')],'UserId':_0x4949ed[_0x28cbc8]['id'],'queue_name':_0x3fd897[_0x35fc('0x27')],'VoiceQueueId':_0x3fd897['id'],'interface':_[_0x35fc('0x69')](_0x4949ed[_0x28cbc8][_0x35fc('0x5f')])?util[_0x35fc('0x6a')]('SIP/%s',_0x4949ed[_0x28cbc8][_0x35fc('0x27')]):_0x4949ed[_0x28cbc8][_0x35fc('0x5f')],'paused':_0x4949ed[_0x28cbc8][_0x35fc('0x5e')]||![],'penalty':_0x139065[_0x35fc('0x3d')]['penalty']||0x0}));}}return BPromise['all'](_0x4f74ff);}})['then'](function(){return _0x316d37;})['then'](respondWithResult(_0x25aedf,null))[_0x35fc('0x30')](handleError(_0x25aedf,null));};exports['removeAgents']=function(_0xcbabdf,_0x2475d6){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0xcbabdf[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x2475d6,null))[_0x35fc('0x18')](function(_0x41cbaa){if(_0x41cbaa){return _0x41cbaa[_0x35fc('0x81')](_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')])[_0x35fc('0x18')](function(){if(_[_0x35fc('0x87')](_0xcbabdf['query'][_0x35fc('0x6c')])){for(var _0x3e8580=0x0;_0x3e8580<_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]['length'];_0x3e8580+=0x1){socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')][_0x3e8580]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}}else{socket[_0x35fc('0x6b')](_0x35fc('0x82'),{'UserId':Number(_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]),'VoiceQueueId':Number(_0xcbabdf[_0x35fc('0x32')]['id'])});}});}})[_0x35fc('0x18')](function(_0xa39c4c){return db[_0x35fc('0x68')][_0x35fc('0x25')]({'where':{'VoiceQueueId':_0xcbabdf[_0x35fc('0x32')]['id'],'UserId':_0xcbabdf[_0x35fc('0x35')][_0x35fc('0x6c')]}})[_0x35fc('0x18')](function(){return _0xa39c4c;});})[_0x35fc('0x18')](respondWithStatusCode(_0x2475d6,null))[_0x35fc('0x30')](handleError(_0x2475d6,null));};exports[_0x35fc('0x88')]=function(_0x11d0f4,_0x4f150a){var _0x12238e={};var _0x16b52f={};var _0x238242;var _0x452f30;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x11d0f4[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x4f150a,null))[_0x35fc('0x18')](function(_0x156c24){if(_0x156c24){_0x238242=_0x156c24;_0x16b52f[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x86')][_0x35fc('0x41')]);_0x16b52f[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x11d0f4[_0x35fc('0x35')]);_0x16b52f[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],_0x16b52f[_0x35fc('0x35')]);_0x12238e[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x16b52f[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x42')]));_0x12238e[_0x35fc('0x37')]=_0x12238e['attributes'][_0x35fc('0x38')]?_0x12238e[_0x35fc('0x37')]:_0x16b52f[_0x35fc('0x33')];_0x12238e['order']=qs[_0x35fc('0x4f')](_0x11d0f4[_0x35fc('0x35')]['sort']);_0x12238e['where']=qs['filters'](_[_0x35fc('0x50')](_0x11d0f4[_0x35fc('0x35')],_0x16b52f['filters']));if(_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x12238e[_0x35fc('0x2c')]=_[_0x35fc('0x3a')](_0x12238e[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x12238e['attributes'],function(_0x13534c){var _0x3be339={};_0x3be339[_0x13534c]={'$like':'%'+_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x3be339;})});}_0x12238e=_[_0x35fc('0x3a')]({},_0x12238e,_0x11d0f4['options']);return _0x238242[_0x35fc('0x88')](_0x12238e);}})[_0x35fc('0x18')](function(_0x52f355){if(_0x52f355){_0x452f30=_0x52f355[_0x35fc('0x38')];if(!_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x12238e[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x11')]);_0x12238e[_0x35fc('0x10')]=qs['offset'](_0x11d0f4[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x238242['getAgents'](_0x12238e);}})[_0x35fc('0x18')](function(_0x4ffbf9){if(_0x4ffbf9){return _0x4ffbf9?{'count':_0x452f30,'rows':_0x4ffbf9}:null;}})[_0x35fc('0x18')](respondWithResult(_0x4f150a,null))[_0x35fc('0x30')](handleError(_0x4f150a,null));};exports[_0x35fc('0x89')]=function(_0x206491,_0x536837){var _0x3cfbd4={};var _0x3ac7fb={};var _0x3916e7;var _0x4bcc53;return db[_0x35fc('0x29')]['findOne']({'where':{'id':_0x206491[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x536837,null))[_0x35fc('0x18')](function(_0x3da024){if(_0x3da024){_0x3916e7=_0x3da024;_0x3ac7fb[_0x35fc('0x33')]=_[_0x35fc('0x34')](db[_0x35fc('0x68')][_0x35fc('0x41')]);_0x3ac7fb[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x206491[_0x35fc('0x35')]);_0x3ac7fb[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],_0x3ac7fb[_0x35fc('0x35')]);_0x3cfbd4['attributes']=_[_0x35fc('0x36')](_0x3ac7fb[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x206491[_0x35fc('0x35')][_0x35fc('0x42')]));_0x3cfbd4[_0x35fc('0x37')]=_0x3cfbd4[_0x35fc('0x37')]['length']?_0x3cfbd4['attributes']:_0x3ac7fb['model'];_0x3cfbd4['order']=qs[_0x35fc('0x4f')](_0x206491['query'][_0x35fc('0x4f')]);_0x3cfbd4[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x206491[_0x35fc('0x35')],_0x3ac7fb[_0x35fc('0x4c')]));if(_0x206491['query'][_0x35fc('0x1e')]){_0x3cfbd4['where']=_[_0x35fc('0x3a')](_0x3cfbd4['where'],{'$or':_['map'](_0x3cfbd4[_0x35fc('0x37')],function(_0x472e13){var _0x2d0512={};_0x2d0512[_0x472e13]={'$like':'%'+_0x206491['query']['filter']+'%'};return _0x2d0512;})});}_0x3cfbd4=_['merge']({},_0x3cfbd4,_0x206491['options']);return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x131db6){if(_0x131db6){_0x4bcc53=_0x131db6[_0x35fc('0x38')];if(!_0x206491[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x3cfbd4[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x206491['query']['limit']);_0x3cfbd4[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x206491[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3916e7[_0x35fc('0x89')](_0x3cfbd4);}})[_0x35fc('0x18')](function(_0x4f4c68){return _0x4f4c68?{'count':_0x4bcc53,'rows':_0x4f4c68}:null;})[_0x35fc('0x18')](respondWithResult(_0x536837,null))[_0x35fc('0x30')](handleError(_0x536837,null));};exports[_0x35fc('0x8a')]=function(_0x4f9a00,_0x5c097d){var _0x11c117={};var _0x26b1cb={};var _0x84e749;var _0x4f9685;return db[_0x35fc('0x29')][_0x35fc('0x53')]({'where':{'id':_0x4f9a00[_0x35fc('0x32')]['id']}})['then'](handleEntityNotFound(_0x5c097d,null))[_0x35fc('0x18')](function(_0x546d2e){if(_0x546d2e){_0x84e749=_0x546d2e;_0x26b1cb[_0x35fc('0x33')]=_['keys'](db[_0x35fc('0x8b')][_0x35fc('0x41')]);_0x26b1cb['query']=_[_0x35fc('0x34')](_0x4f9a00[_0x35fc('0x35')]);_0x26b1cb['filters']=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],_0x26b1cb[_0x35fc('0x35')]);_0x11c117[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x26b1cb[_0x35fc('0x33')],qs['fields'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x42')]));_0x11c117[_0x35fc('0x37')]=_0x11c117[_0x35fc('0x37')][_0x35fc('0x38')]?_0x11c117['attributes']:_0x26b1cb[_0x35fc('0x33')];_0x11c117[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x11c117[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x4f9a00[_0x35fc('0x35')],_0x26b1cb['filters']));if(_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]){_0x11c117[_0x35fc('0x2c')]=_['merge'](_0x11c117[_0x35fc('0x2c')],{'$or':_['map'](_0x11c117[_0x35fc('0x37')],function(_0x413a4b){var _0x599121={};_0x599121[_0x413a4b]={'$like':'%'+_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x599121;})});}_0x11c117=_[_0x35fc('0x3a')]({},_0x11c117,_0x4f9a00[_0x35fc('0x3b')]);return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x411d09){if(_0x411d09){_0x4f9685=_0x411d09['length'];if(!_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x11c117['limit']=qs['limit'](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x11')]);_0x11c117[_0x35fc('0x10')]=qs[_0x35fc('0x10')](_0x4f9a00[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x84e749[_0x35fc('0x8a')](_0x11c117);}})[_0x35fc('0x18')](function(_0x214f01){if(_0x214f01){return _0x214f01?{'count':_0x4f9685,'rows':_0x214f01}:null;}})[_0x35fc('0x18')](respondWithResult(_0x5c097d,null))[_0x35fc('0x30')](handleError(_0x5c097d,null));};exports[_0x35fc('0x8c')]=function(_0xae43b4,_0x3c5524){var _0x2ceb04=moment()[_0x35fc('0x6a')](_0x35fc('0x8d'));var _0x605f3b,_0x43bb43;return db['VoiceQueue'][_0x35fc('0x23')]({'where':{'id':_0xae43b4['params']['id']}})['then'](handleEntityNotFound(_0x3c5524,null))[_0x35fc('0x18')](function(_0x1d7881){if(_0x1d7881){_0x43bb43=_0x1d7881;return _0x1d7881[_0x35fc('0x8c')](_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0xae43b4[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x3e0ebb){var _0x138fe5;_0x605f3b=_0x3e0ebb||[];var _0x3033a0=[];if(_0x3e0ebb){for(var _0x228bb9=0x0;_0x228bb9<_0x3e0ebb[_0x35fc('0x38')];_0x228bb9+=0x1){var _0x163afe=_0x3e0ebb[_0x228bb9][_0x35fc('0x19')]({'plain':!![]});_0x43bb43[_0x35fc('0x8e')]=_0xae43b4[_0x35fc('0x3d')][_0x35fc('0x8e')]?_0xae43b4[_0x35fc('0x3d')]['dialCheckDuplicateType']:_0x43bb43[_0x35fc('0x8e')];switch(_0x43bb43[_0x35fc('0x8e')]){case _0x35fc('0x8f'):_0x138fe5=squel['insert']()[_0x35fc('0x90')](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','scheduledAt')['field']('id','ContactId')[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())['where'](_0x35fc('0x9b'))['where'](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x9e'))[_0x35fc('0x6f')](_0x35fc('0x9f'))['where']('VoiceQueueId\x20=\x20?',_0xae43b4['params']['id'][_0x35fc('0x78')]()))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel['select']()[_0x35fc('0x6d')](_0x35fc('0xa0'))[_0x35fc('0x6f')](_0x35fc('0x91'))[_0x35fc('0x2c')](_0x35fc('0x74'),_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;case _0x35fc('0xa1'):_0x138fe5=squel[_0x35fc('0xa2')]()['into'](_0x35fc('0x91'))[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),'ListId','VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))['field']('id',_0x35fc('0x94'))[_0x35fc('0x6d')](_0x163afe[_0x35fc('0x97')]['toString'](),_0x35fc('0x95'))['field'](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))['from']('cm_contacts')[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')]('ListId\x20=\x20?',_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b'))[_0x35fc('0x2c')](_0x35fc('0x9c'),squel[_0x35fc('0x9d')]()['field']('COALESCE(phone,\x27\x27)')[_0x35fc('0x6f')](_0x35fc('0x91'))['where'](_0x35fc('0x74'),_0xae43b4['params']['id'][_0x35fc('0x78')]())))[_0x35fc('0x78')]();break;default:_0x138fe5=squel[_0x35fc('0xa2')]()[_0x35fc('0x90')]('cm_hopper')[_0x35fc('0x92')](['phone',_0x35fc('0x93'),_0x35fc('0x94'),_0x35fc('0x95'),'VoiceQueueId',_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()[_0x35fc('0x6d')](_0x35fc('0x96'),_0x35fc('0x96'))['field']('\x27'+_0x2ceb04+'\x27',_0x35fc('0x93'))[_0x35fc('0x6d')]('id','ContactId')[_0x35fc('0x6d')](_0x163afe['CmListId']['toString'](),'ListId')[_0x35fc('0x6d')](_0xae43b4[_0x35fc('0x32')]['id'][_0x35fc('0x78')](),_0x35fc('0x51'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x45'))[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))['where'](_0x35fc('0x9a'),_0x163afe[_0x35fc('0x97')][_0x35fc('0x78')]())[_0x35fc('0x2c')](_0x35fc('0x9b')))[_0x35fc('0x78')]();}_0x3033a0[_0x35fc('0x77')](db['sequelize'][_0x35fc('0x35')](_0x138fe5));}return BPromise['all'](_0x3033a0);}})[_0x35fc('0x18')](function(){var _0x477d70=[];var _0x28533f=squel['insert']()[_0x35fc('0x90')](_0x35fc('0xa3'))[_0x35fc('0x92')]([_0x35fc('0xa4'),_0x35fc('0x96'),_0x35fc('0xa5'),'createdAt',_0x35fc('0x45')],squel['select']()[_0x35fc('0x6d')]('h.id')['field'](_0x35fc('0xa6'))[_0x35fc('0x6d')]('ci.OrderBy+1')[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27',_0x35fc('0x44'))[_0x35fc('0x6d')]('\x27'+_0x2ceb04+'\x27','updatedAt')[_0x35fc('0x6f')](_0x35fc('0xa7'),'ci')[_0x35fc('0x71')]('cm_hopper','h',_0x35fc('0xa8'))[_0x35fc('0x2c')](_0x35fc('0xa9'),_0x2ceb04)[_0x35fc('0x2c')](_0x35fc('0xaa'),_0x35fc('0xab')))[_0x35fc('0x78')]();_0x477d70[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x28533f));return BPromise[_0x35fc('0x7e')](_0x477d70);})[_0x35fc('0x18')](function(){return _0x605f3b;})[_0x35fc('0x18')](respondWithResult(_0x3c5524,null))[_0x35fc('0x30')](handleError(_0x3c5524,null));};exports['removeLists']=function(_0x57b3f1,_0x8fa3cf){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x8fa3cf,null))[_0x35fc('0x18')](function(_0x293c2d){if(_0x293c2d){return _0x293c2d[_0x35fc('0xac')](_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')]);}})['then'](function(_0x4860b4){if(_0x4860b4){return db[_0x35fc('0x4b')][_0x35fc('0x25')]({'where':{'ListId':_0x57b3f1[_0x35fc('0x35')][_0x35fc('0x6c')],'VoiceQueueId':_0x57b3f1[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x4860b4;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x8fa3cf,null))[_0x35fc('0x30')](handleError(_0x8fa3cf,null));};exports[_0x35fc('0xad')]=function(_0x55d140,_0x488cea){var _0x1a5f12={};var _0x4c40e5={};var _0x3afdf3;var _0x3b64de;return db['VoiceQueue'][_0x35fc('0x53')]({'where':{'id':_0x55d140['params']['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x488cea,null))[_0x35fc('0x18')](function(_0xa46452){if(_0xa46452){_0x3afdf3=_0xa46452;_0x4c40e5[_0x35fc('0x33')]=_[_0x35fc('0x34')](db['CmList'][_0x35fc('0x41')]);_0x4c40e5[_0x35fc('0x35')]=_[_0x35fc('0x34')](_0x55d140['query']);_0x4c40e5[_0x35fc('0x4c')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],_0x4c40e5['query']);_0x1a5f12[_0x35fc('0x37')]=_[_0x35fc('0x36')](_0x4c40e5[_0x35fc('0x33')],qs[_0x35fc('0x42')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x42')]));_0x1a5f12[_0x35fc('0x37')]=_0x1a5f12[_0x35fc('0x37')][_0x35fc('0x38')]?_0x1a5f12[_0x35fc('0x37')]:_0x4c40e5[_0x35fc('0x33')];_0x1a5f12[_0x35fc('0x4e')]=qs[_0x35fc('0x4f')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x4f')]);_0x1a5f12[_0x35fc('0x2c')]=qs[_0x35fc('0x4c')](_[_0x35fc('0x50')](_0x55d140[_0x35fc('0x35')],_0x4c40e5[_0x35fc('0x4c')]));if(_0x55d140['query'][_0x35fc('0x1e')]){_0x1a5f12[_0x35fc('0x2c')]=_['merge'](_0x1a5f12[_0x35fc('0x2c')],{'$or':_[_0x35fc('0x20')](_0x1a5f12[_0x35fc('0x37')],function(_0x55c126){var _0x9e7561={};_0x9e7561[_0x55c126]={'$like':'%'+_0x55d140[_0x35fc('0x35')][_0x35fc('0x1e')]+'%'};return _0x9e7561;})});}_0x1a5f12=_[_0x35fc('0x3a')]({},_0x1a5f12,_0x55d140[_0x35fc('0x3b')]);return _0x3afdf3[_0x35fc('0xad')](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x5545e9){if(_0x5545e9){_0x3b64de=_0x5545e9[_0x35fc('0x38')];if(!_0x55d140[_0x35fc('0x35')][_0x35fc('0x55')](_0x35fc('0x4d'))){_0x1a5f12[_0x35fc('0x11')]=qs[_0x35fc('0x11')](_0x55d140[_0x35fc('0x35')][_0x35fc('0x11')]);_0x1a5f12['offset']=qs['offset'](_0x55d140[_0x35fc('0x35')][_0x35fc('0x10')]);}return _0x3afdf3['getBlackLists'](_0x1a5f12);}})[_0x35fc('0x18')](function(_0x2c1181){if(_0x2c1181){return _0x2c1181?{'count':_0x3b64de,'rows':_0x2c1181}:null;}})[_0x35fc('0x18')](respondWithResult(_0x488cea,null))[_0x35fc('0x30')](handleError(_0x488cea,null));};exports[_0x35fc('0xae')]=function(_0x3f7fd7,_0x5e16f1){var _0xa46ffd;return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x3f7fd7[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](handleEntityNotFound(_0x5e16f1,null))[_0x35fc('0x18')](function(_0x4abeb5){if(_0x4abeb5){return _0x4abeb5[_0x35fc('0xae')](_0x3f7fd7[_0x35fc('0x3d')][_0x35fc('0x6c')],_[_0x35fc('0x43')](_0x3f7fd7[_0x35fc('0x3d')],[_0x35fc('0x6c'),'id'])||{});}return null;})[_0x35fc('0x84')](function(_0x4007f9){var _0x58d0b1;_0xa46ffd=_0x4007f9||[];var _0x4bf83e=[];if(_0x4007f9){for(var _0x1afe94=0x0;_0x1afe94<_0x4007f9[_0x35fc('0x38')];_0x1afe94+=0x1){var _0x108366=_0x4007f9[_0x1afe94][_0x35fc('0x19')]({'plain':!![]});_0x58d0b1=squel['insert']()[_0x35fc('0x90')]('cm_hopper_black')['fromQuery']([_0x35fc('0x96'),_0x35fc('0x94'),_0x35fc('0x95'),_0x35fc('0x51'),_0x35fc('0x44'),_0x35fc('0x45')],squel[_0x35fc('0x9d')]()['field'](_0x35fc('0x96'),_0x35fc('0x96'))[_0x35fc('0x6d')]('id',_0x35fc('0x94'))['field'](_0x108366[_0x35fc('0x97')][_0x35fc('0x78')](),_0x35fc('0x95'))[_0x35fc('0x6d')](_0x3f7fd7[_0x35fc('0x32')]['id']['toString'](),_0x35fc('0x51'))[_0x35fc('0x6d')](_0x35fc('0xaf'),_0x35fc('0x44'))[_0x35fc('0x6d')]('NOW()','updatedAt')[_0x35fc('0x6f')](_0x35fc('0x98'))[_0x35fc('0x2c')](_0x35fc('0x99'))[_0x35fc('0x2c')](_0x35fc('0x9a'),_0x108366[_0x35fc('0x97')]['toString']())[_0x35fc('0x2c')](_0x35fc('0x9b')))['toString']();_0x4bf83e[_0x35fc('0x77')](db[_0x35fc('0x64')][_0x35fc('0x35')](_0x58d0b1));}return BPromise[_0x35fc('0x7e')](_0x4bf83e);}})[_0x35fc('0x18')](function(){return _0xa46ffd;})[_0x35fc('0x18')](respondWithResult(_0x5e16f1,null))[_0x35fc('0x30')](handleError(_0x5e16f1,null));};exports[_0x35fc('0xb0')]=function(_0x4fd3d4,_0x2dff64){return db[_0x35fc('0x29')][_0x35fc('0x23')]({'where':{'id':_0x4fd3d4['params']['id']}})['then'](handleEntityNotFound(_0x2dff64,null))[_0x35fc('0x18')](function(_0x409a32){if(_0x409a32){return _0x409a32['removeBlackLists'](_0x4fd3d4[_0x35fc('0x35')][_0x35fc('0x6c')]);}})[_0x35fc('0x18')](function(_0x2c0bf5){if(_0x2c0bf5){return db['CmHopperBlack'][_0x35fc('0x25')]({'where':{'ListId':_0x4fd3d4['query']['ids'],'VoiceQueueId':_0x4fd3d4[_0x35fc('0x32')]['id']}})[_0x35fc('0x18')](function(){return _0x2c0bf5;});}})[_0x35fc('0x18')](respondWithStatusCode(_0x2dff64,null))[_0x35fc('0x30')](handleError(_0x2dff64,null));}; \ No newline at end of file +var _0x3e74=['phone\x20NOT\x20IN\x20(?)','cm_hopper','onlyIfOpen','insert','into','fromQuery','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','moment','util','lodash','squel','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','end','json','offset','undefined','count','limit','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','UserProfileResource','sendStatus','stack','name','status','send','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','catch','show','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','clone','params','keys','omit','updatedAt','createdAt','outbound','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findOne','CmHopper','hasOwnProperty','nolimit','sort','filters','pick','VoiceQueueId','options','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','order','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','online','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','addTeams','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','User','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','QueryTypes','every','all','union','compact','isEmpty','userVoiceQueue:remove','addAgents','removeAgents','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','phone','scheduledAt','field','ContactId','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?'];(function(_0x18b375,_0xd086ba){var _0x479e0e=function(_0x4e7652){while(--_0x4e7652){_0x18b375['push'](_0x18b375['shift']());}};_0x479e0e(++_0xd086ba);}(_0x3e74,0x175));var _0x43e7=function(_0x1fbc40,_0x4a90b5){_0x1fbc40=_0x1fbc40-0x0;var _0x4eb27d=_0x3e74[_0x1fbc40];return _0x4eb27d;};'use strict';var moment=require(_0x43e7('0x0'));var BPromise=require('bluebird');var util=require(_0x43e7('0x1'));var _=require(_0x43e7('0x2'));var squel=require(_0x43e7('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x43e7('0x4'))('api');var config=require(_0x43e7('0x5'));var db=require(_0x43e7('0x6'))['db'];config[_0x43e7('0x7')]=_[_0x43e7('0x8')](config[_0x43e7('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x43e7('0x9'))(new Redis(config[_0x43e7('0x7')]));require(_0x43e7('0xa'))[_0x43e7('0xb')](socket);function respondWithStatusCode(_0x21f491,_0x516b4d){_0x516b4d=_0x516b4d||0xcc;return function(_0x212c6c){if(_0x212c6c){return _0x21f491['sendStatus'](_0x516b4d);}return _0x21f491['status'](_0x516b4d)[_0x43e7('0xc')]();};}function respondWithResult(_0x4139c9,_0x5c34f4){_0x5c34f4=_0x5c34f4||0xc8;return function(_0x2803d9){if(_0x2803d9){return _0x4139c9['status'](_0x5c34f4)[_0x43e7('0xd')](_0x2803d9);}};}function respondWithFilteredResult(_0x37302c,_0x4ebc8e){return function(_0x3eb206){if(_0x3eb206){var _0xc960ea=typeof _0x4ebc8e[_0x43e7('0xe')]===_0x43e7('0xf')&&typeof _0x4ebc8e['limit']==='undefined';var _0x2fcb36=_0x3eb206[_0x43e7('0x10')];var _0x44b0bd=_0xc960ea?0x0:_0x4ebc8e['offset'];var _0x5e641c=_0xc960ea?_0x3eb206[_0x43e7('0x10')]:_0x4ebc8e[_0x43e7('0xe')]+_0x4ebc8e[_0x43e7('0x11')];var _0x328445;if(_0x5e641c>=_0x2fcb36){_0x5e641c=_0x2fcb36;_0x328445=0xc8;}else{_0x328445=0xce;}_0x37302c['status'](_0x328445);return _0x37302c['set'](_0x43e7('0x12'),_0x44b0bd+'-'+_0x5e641c+'/'+_0x2fcb36)[_0x43e7('0xd')](_0x3eb206);}return null;};}function saveUpdates(_0x273a32){return function(_0x5d346f){if(_0x5d346f){return _0x5d346f['update'](_0x273a32)[_0x43e7('0x13')](function(_0x1ca758){return _0x1ca758;});}return null;};}function removeEntity(_0x9037d3){return function(_0x140657){if(_0x140657){return _0x140657[_0x43e7('0x14')]()[_0x43e7('0x13')](function(){var _0x619236=_0x140657[_0x43e7('0x15')]({'plain':!![]});var _0x2377a3=[{'name':_0x43e7('0x16'),'value':_0x43e7('0x17'),'ignore':![]},{'name':_0x43e7('0x18'),'value':'outbound','ignore':![]}];var _0xef1a5a=_(_0x2377a3)[_0x43e7('0x19')]('ignore')[_0x43e7('0x1a')](_0x43e7('0x1b'))[_0x43e7('0x1b')]();if(_[_0x43e7('0x1c')](_0xef1a5a,_0x619236[_0x43e7('0x1d')])){return;}var _0x2f4cb4=_['find'](_0x2377a3,[_0x43e7('0x1b'),_0x619236['type']])['name'];return db[_0x43e7('0x1e')][_0x43e7('0x14')]({'where':{'type':_0x2f4cb4,'resourceId':_0x619236['id']}})['then'](function(){return _0x140657;});})[_0x43e7('0x13')](function(){_0x9037d3['status'](0xcc)[_0x43e7('0xc')]();});}};}function handleEntityNotFound(_0x5c5e67){return function(_0x1af208){if(!_0x1af208){_0x5c5e67[_0x43e7('0x1f')](0x194);}return _0x1af208;};}function handleError(_0x20888b,_0x405f85){_0x405f85=_0x405f85||0x1f4;return function(_0x51f4d7){logger['error'](_0x51f4d7[_0x43e7('0x20')]);if(_0x51f4d7['name']){delete _0x51f4d7[_0x43e7('0x21')];}_0x20888b[_0x43e7('0x22')](_0x405f85)[_0x43e7('0x23')](_0x51f4d7);};}exports[_0x43e7('0x24')]=function(_0x5087d7,_0x33a1a5){var _0x4690a6={};var _0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x1a')](db[_0x43e7('0x25')][_0x43e7('0x26')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x27')],'type':_0x31b2a6[_0x43e7('0x1d')][_0x43e7('0x28')]};});_0x4690a6=qs[_0x43e7('0x29')](_0x50f9f5,_0x5087d7);var _0x2bde44={'where':_0x4690a6[_0x43e7('0x2a')]};return db['VoiceQueue'][_0x43e7('0x10')](_0x2bde44)[_0x43e7('0x13')](function(_0x3b8f78){_0x45b675[_0x43e7('0x10')]=_0x3b8f78;_0x4690a6[_0x43e7('0x2b')]=qs['include'](_0x5087d7[_0x43e7('0x2c')]);return db[_0x43e7('0x25')][_0x43e7('0x2d')](_0x4690a6);})[_0x43e7('0x13')](function(_0x4c61b9){_0x45b675['rows']=_0x4c61b9;return _0x45b675;})['then'](respondWithFilteredResult(_0x33a1a5,_0x4690a6))[_0x43e7('0x2e')](handleError(_0x33a1a5,null));};exports[_0x43e7('0x2f')]=function(_0x117c07,_0x234fe6){var _0x108313={'raw':![],'where':{'id':_0x117c07['params']['id']}},_0xde7ed={};_0xde7ed['model']=_['keys'](db['VoiceQueue']['rawAttributes']);_0xde7ed['query']=_['keys'](_0x117c07[_0x43e7('0x2c')]);_0xde7ed['filters']=_[_0x43e7('0x30')](_0xde7ed[_0x43e7('0x31')],_0xde7ed[_0x43e7('0x2c')]);_0x108313[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0xde7ed[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x117c07['query']['fields']));_0x108313['attributes']=_0x108313[_0x43e7('0x32')][_0x43e7('0x34')]?_0x108313[_0x43e7('0x32')]:_0xde7ed[_0x43e7('0x31')];if(_0x117c07[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x108313[_0x43e7('0x2b')]=[{'all':!![]}];}_0x108313=_[_0x43e7('0x36')]({},_0x108313,_0x117c07['options']);return db[_0x43e7('0x25')][_0x43e7('0x37')](_0x108313)['then'](handleEntityNotFound(_0x234fe6,null))[_0x43e7('0x13')](respondWithResult(_0x234fe6,null))['catch'](handleError(_0x234fe6,null));};exports[_0x43e7('0x38')]=function(_0x2ad008,_0x1c6f45){return db[_0x43e7('0x25')][_0x43e7('0x38')](_0x2ad008[_0x43e7('0x39')],{})['then'](function(_0x574a93){var _0x30dfa9=_0x2ad008[_0x43e7('0x3a')][_0x43e7('0x15')]({'plain':!![]});if(!_0x30dfa9)throw new Error(_0x43e7('0x3b'));if(_0x30dfa9[_0x43e7('0x3c')]==='user'){var _0x32a451=_0x574a93[_0x43e7('0x15')]({'plain':!![]});var _0x575439=[{'name':_0x43e7('0x16'),'value':'inbound'},{'name':_0x43e7('0x18'),'value':'outbound'}];var _0x3d81ae=_[_0x43e7('0x37')](_0x575439,[_0x43e7('0x1b'),_0x32a451[_0x43e7('0x1d')]])['name'];return db['UserProfileSection'][_0x43e7('0x37')]({'where':{'name':_0x3d81ae,'userProfileId':_0x30dfa9[_0x43e7('0x3d')]},'raw':!![]})[_0x43e7('0x13')](function(_0x36b770){if(_0x36b770&&_0x36b770['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x32a451[_0x43e7('0x21')],'resourceId':_0x32a451['id'],'type':_0x36b770['name'],'sectionId':_0x36b770['id']},{})[_0x43e7('0x13')](function(){return _0x574a93;});}else{return _0x574a93;}})['catch'](function(_0x5b28db){logger[_0x43e7('0x3e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b28db);throw _0x5b28db;});}return _0x574a93;})[_0x43e7('0x13')](respondWithResult(_0x1c6f45,0xc9))[_0x43e7('0x2e')](handleError(_0x1c6f45,null));};exports[_0x43e7('0x3f')]=function(_0x99b9e1,_0x4fc5e8){var _0x91f1e4={'where':{'id':_0x99b9e1[_0x43e7('0x40')]['id']}},_0x2b9046={};_0x2b9046[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x25')]['rawAttributes']);_0x91f1e4['attributes']=_[_0x43e7('0x30')](_0x2b9046[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x99b9e1['query']['fields']));_0x91f1e4['attributes']=_0x91f1e4[_0x43e7('0x32')][_0x43e7('0x34')]?_0x91f1e4['attributes']:_0x2b9046[_0x43e7('0x31')];if(_0x99b9e1[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x91f1e4['include']=[{'all':!![]}];}_0x91f1e4=_['merge']({},_0x91f1e4,_0x99b9e1['options']);return db['VoiceQueue'][_0x43e7('0x37')](_0x91f1e4)[_0x43e7('0x13')](handleEntityNotFound(_0x4fc5e8,null))['then'](function(_0x23e7cb){if(_0x23e7cb){var _0x82d32f=_0x23e7cb[_0x43e7('0x15')]({'plain':!![]});_0x82d32f=qs[_0x43e7('0x42')](_0x82d32f,['id','createdAt',_0x43e7('0x43')]);_0x99b9e1['body']=_['omit'](_0x99b9e1[_0x43e7('0x39')],['id',_0x43e7('0x44'),_0x43e7('0x43')]);return db[_0x43e7('0x25')][_0x43e7('0x38')](_[_0x43e7('0x36')](_0x82d32f,_0x99b9e1[_0x43e7('0x39')]),{'include':_0x99b9e1[_0x43e7('0x2c')][_0x43e7('0x35')]?[{'all':!![]}]:undefined})[_0x43e7('0x13')](function(_0x58dfd0){var _0x119d34=_0x99b9e1[_0x43e7('0x3a')]['get']({'plain':!![]});if(!_0x119d34)throw new Error(_0x43e7('0x3b'));if(_0x119d34['role']===_0x43e7('0x3a')){var _0x520857=_0x58dfd0[_0x43e7('0x15')]({'plain':!![]});var _0x1f561f=[{'name':_0x43e7('0x16'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x43e7('0x45')}];var _0x2ab7ee=_[_0x43e7('0x37')](_0x1f561f,[_0x43e7('0x1b'),_0x520857[_0x43e7('0x1d')]])[_0x43e7('0x21')];return db[_0x43e7('0x46')][_0x43e7('0x37')]({'where':{'name':_0x2ab7ee,'userProfileId':_0x119d34[_0x43e7('0x3d')]},'raw':!![]})[_0x43e7('0x13')](function(_0x312306){if(_0x312306&&_0x312306['autoAssociation']===0x0){return db[_0x43e7('0x1e')][_0x43e7('0x38')]({'name':_0x520857['name'],'resourceId':_0x520857['id'],'type':_0x312306[_0x43e7('0x21')],'sectionId':_0x312306['id']},{})[_0x43e7('0x13')](function(){return _0x58dfd0;});}else{return _0x58dfd0;}})[_0x43e7('0x2e')](function(_0x558d54){logger['error'](_0x43e7('0x47'),_0x558d54);throw _0x558d54;});}return _0x58dfd0;});}})[_0x43e7('0x13')](respondWithResult(_0x4fc5e8,0xc9))['catch'](handleError(_0x4fc5e8,null));};exports[_0x43e7('0x48')]=function(_0x54506d,_0x49a6ce){if(_0x54506d[_0x43e7('0x39')]['id']){delete _0x54506d[_0x43e7('0x39')]['id'];}return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x54506d[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x49a6ce,null))[_0x43e7('0x13')](saveUpdates(_0x54506d[_0x43e7('0x39')],null))['then'](respondWithResult(_0x49a6ce,null))[_0x43e7('0x2e')](handleError(_0x49a6ce,null));};exports[_0x43e7('0x14')]=function(_0x296a0d,_0x5bb536){return db['VoiceQueue']['find']({'where':{'id':_0x296a0d[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x5bb536,null))[_0x43e7('0x13')](removeEntity(_0x5bb536,null))[_0x43e7('0x2e')](handleError(_0x5bb536,null));};exports['getHoppers']=function(_0x5a50fc,_0x1b27da){var _0x8b50bb={'raw':![],'where':{}};var _0x140438={};var _0x5dd349={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x5a50fc[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x1b27da,null))[_0x43e7('0x13')](function(_0x3369b8){if(_0x3369b8){_0x140438[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x4a')][_0x43e7('0x26')]);_0x140438[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x5a50fc['query']);_0x140438['filters']=_[_0x43e7('0x30')](_0x140438['model'],_0x140438['query']);_0x8b50bb['attributes']=_[_0x43e7('0x30')](_0x140438[_0x43e7('0x31')],qs['fields'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x8b50bb[_0x43e7('0x32')]=_0x8b50bb['attributes'][_0x43e7('0x34')]?_0x8b50bb[_0x43e7('0x32')]:_0x140438[_0x43e7('0x31')];if(!_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x8b50bb[_0x43e7('0x11')]=qs['limit'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x8b50bb[_0x43e7('0xe')]=qs['offset'](_0x5a50fc['query'][_0x43e7('0xe')]);}_0x8b50bb['order']=qs['sort'](_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x8b50bb['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x5a50fc[_0x43e7('0x2c')],_0x140438[_0x43e7('0x4e')]));_0x8b50bb[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x3369b8['id'];if(_0x5a50fc[_0x43e7('0x2c')]['filter']){_0x8b50bb[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x8b50bb['where'],{'$or':_[_0x43e7('0x1a')](_0x8b50bb['attributes'],function(_0x26ee52){var _0x248936={};_0x248936[_0x26ee52]={'$like':'%'+_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x248936;})});}_0x8b50bb=_['merge']({},_0x8b50bb,_0x5a50fc[_0x43e7('0x51')]);return db[_0x43e7('0x4a')][_0x43e7('0x10')]({'where':_0x8b50bb['where']})[_0x43e7('0x13')](function(_0x38fa5b){_0x5dd349[_0x43e7('0x10')]=_0x38fa5b;if(_0x5a50fc[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x8b50bb['include']=[{'all':!![]}];}return db[_0x43e7('0x4a')][_0x43e7('0x2d')](_0x8b50bb);})[_0x43e7('0x13')](function(_0x2499ef){_0x5dd349[_0x43e7('0x52')]=_0x2499ef;return _0x5dd349;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x1b27da,_0x8b50bb))[_0x43e7('0x2e')](handleError(_0x1b27da,null));};exports['getHopperHistories']=function(_0x499ee9,_0x405faa){var _0x536477={'raw':!![],'where':{}};var _0x550036={};var _0x5b98bf={'count':0x0,'rows':[]};return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x499ee9[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x405faa,null))[_0x43e7('0x13')](function(_0x1ae0c8){if(_0x1ae0c8){_0x550036['model']=_[_0x43e7('0x41')](db[_0x43e7('0x53')][_0x43e7('0x26')]);_0x550036['query']=_[_0x43e7('0x41')](_0x499ee9[_0x43e7('0x2c')]);_0x550036[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x550036[_0x43e7('0x31')],_0x550036[_0x43e7('0x2c')]);_0x536477[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x550036['model'],qs['fields'](_0x499ee9['query'][_0x43e7('0x33')]));_0x536477[_0x43e7('0x32')]=_0x536477['attributes'][_0x43e7('0x34')]?_0x536477[_0x43e7('0x32')]:_0x550036[_0x43e7('0x31')];if(!_0x499ee9[_0x43e7('0x2c')]['hasOwnProperty']('nolimit')){_0x536477['limit']=qs[_0x43e7('0x11')](_0x499ee9[_0x43e7('0x2c')]['limit']);_0x536477['offset']=qs[_0x43e7('0xe')](_0x499ee9[_0x43e7('0x2c')][_0x43e7('0xe')]);}_0x536477['order']=qs[_0x43e7('0x4d')](_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x536477[_0x43e7('0x2a')]=qs['filters'](_[_0x43e7('0x4f')](_0x499ee9['query'],_0x550036[_0x43e7('0x4e')]));_0x536477[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x1ae0c8['id'];if(_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x536477[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x536477['where'],{'$or':_[_0x43e7('0x1a')](_0x536477[_0x43e7('0x32')],function(_0x1aea4e){var _0x6fb694={};_0x6fb694[_0x1aea4e]={'$like':'%'+_0x499ee9['query']['filter']+'%'};return _0x6fb694;})});}_0x536477=_['merge']({},_0x536477,_0x499ee9[_0x43e7('0x51')]);return db['CmHopperHistory'][_0x43e7('0x10')]({'where':_0x536477[_0x43e7('0x2a')]})[_0x43e7('0x13')](function(_0x7387f6){_0x5b98bf[_0x43e7('0x10')]=_0x7387f6;if(_0x499ee9[_0x43e7('0x2c')][_0x43e7('0x35')]){_0x536477[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x53')][_0x43e7('0x2d')](_0x536477);})[_0x43e7('0x13')](function(_0x5b3565){_0x5b98bf[_0x43e7('0x52')]=_0x5b3565;return _0x5b98bf;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x405faa,_0x536477))[_0x43e7('0x2e')](handleError(_0x405faa,null));};exports[_0x43e7('0x54')]=function(_0x206e54,_0x4ea4a9){var _0x5e04ec={'raw':!![],'where':{}};var _0x162a27={};var _0x3e3c82={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x206e54[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ea4a9,null))['then'](function(_0x1e869a){if(_0x1e869a){_0x162a27[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x55')][_0x43e7('0x26')]);_0x162a27['query']=_['keys'](_0x206e54[_0x43e7('0x2c')]);_0x162a27[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x162a27[_0x43e7('0x31')],_0x162a27['query']);_0x5e04ec[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x162a27[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x206e54['query'][_0x43e7('0x33')]));_0x5e04ec[_0x43e7('0x32')]=_0x5e04ec[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5e04ec[_0x43e7('0x32')]:_0x162a27['model'];if(!_0x206e54[_0x43e7('0x2c')][_0x43e7('0x4b')]('nolimit')){_0x5e04ec[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0x206e54[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x5e04ec['offset']=qs[_0x43e7('0xe')](_0x206e54['query'][_0x43e7('0xe')]);}_0x5e04ec[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x206e54[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x5e04ec[_0x43e7('0x2a')]=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x206e54[_0x43e7('0x2c')],_0x162a27['filters']));_0x5e04ec[_0x43e7('0x2a')][_0x43e7('0x50')]=_0x1e869a['id'];if(_0x206e54[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x5e04ec['where']=_['merge'](_0x5e04ec[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x5e04ec[_0x43e7('0x32')],function(_0x4d30f7){var _0x12e7a8={};_0x12e7a8[_0x4d30f7]={'$like':'%'+_0x206e54['query']['filter']+'%'};return _0x12e7a8;})});}_0x5e04ec=_['merge']({},_0x5e04ec,_0x206e54[_0x43e7('0x51')]);return db['CmHopperFinal'][_0x43e7('0x10')]({'where':_0x5e04ec[_0x43e7('0x2a')]})[_0x43e7('0x13')](function(_0x2fea54){_0x3e3c82[_0x43e7('0x10')]=_0x2fea54;if(_0x206e54['query']['includeAll']){_0x5e04ec[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x55')]['findAll'](_0x5e04ec);})[_0x43e7('0x13')](function(_0x10fd28){_0x3e3c82[_0x43e7('0x52')]=_0x10fd28;return _0x3e3c82;});}})[_0x43e7('0x13')](respondWithFilteredResult(_0x4ea4a9,_0x5e04ec))[_0x43e7('0x2e')](handleError(_0x4ea4a9,null));};exports[_0x43e7('0x57')]=function(_0x399253,_0x32e698){var _0x39ce5e={'raw':!![],'where':{}};var _0x284617={};var _0x610819={'count':0x0,'rows':[]};return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x399253[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x32e698,null))[_0x43e7('0x13')](function(_0x3286b1){if(_0x3286b1){_0x284617[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x58')][_0x43e7('0x26')]);_0x284617[_0x43e7('0x2c')]=_['keys'](_0x399253[_0x43e7('0x2c')]);_0x284617[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x284617[_0x43e7('0x31')],_0x284617['query']);_0x39ce5e[_0x43e7('0x32')]=_['intersection'](_0x284617[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x399253[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x39ce5e[_0x43e7('0x32')]=_0x39ce5e[_0x43e7('0x32')]['length']?_0x39ce5e[_0x43e7('0x32')]:_0x284617[_0x43e7('0x31')];if(!_0x399253[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x39ce5e['limit']=qs['limit'](_0x399253[_0x43e7('0x2c')]['limit']);_0x39ce5e[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x399253[_0x43e7('0x2c')][_0x43e7('0xe')]);}_0x39ce5e['order']=qs['sort'](_0x399253['query'][_0x43e7('0x4d')]);_0x39ce5e['where']=qs['filters'](_['pick'](_0x399253[_0x43e7('0x2c')],_0x284617[_0x43e7('0x4e')]));_0x39ce5e['where'][_0x43e7('0x50')]=_0x3286b1['id'];if(_0x399253['query'][_0x43e7('0x19')]){_0x39ce5e[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x39ce5e[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x39ce5e['attributes'],function(_0x1f4162){var _0x449cb4={};_0x449cb4[_0x1f4162]={'$like':'%'+_0x399253[_0x43e7('0x2c')]['filter']+'%'};return _0x449cb4;})});}_0x39ce5e=_['merge']({},_0x39ce5e,_0x399253[_0x43e7('0x51')]);return db[_0x43e7('0x58')][_0x43e7('0x10')]({'where':_0x39ce5e[_0x43e7('0x2a')]})['then'](function(_0x385cc1){_0x610819[_0x43e7('0x10')]=_0x385cc1;if(_0x399253[_0x43e7('0x2c')]['includeAll']){_0x39ce5e[_0x43e7('0x2b')]=[{'all':!![]}];}return db[_0x43e7('0x58')][_0x43e7('0x2d')](_0x39ce5e);})[_0x43e7('0x13')](function(_0x541ce8){_0x610819[_0x43e7('0x52')]=_0x541ce8;return _0x610819;});}})['then'](respondWithFilteredResult(_0x32e698,_0x39ce5e))[_0x43e7('0x2e')](handleError(_0x32e698,null));};exports[_0x43e7('0x59')]=function(_0x47f29f,_0x4e5484){var _0xc62dc9={};var _0x1480c6={};var _0x21d001;var _0x4600e5;return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x47f29f[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x4e5484,null))[_0x43e7('0x13')](function(_0xfc577b){if(_0xfc577b){_0x21d001=_0xfc577b;_0x1480c6[_0x43e7('0x31')]=_['keys'](db[_0x43e7('0x5a')]['rawAttributes']);_0x1480c6[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x47f29f[_0x43e7('0x2c')]);_0x1480c6['filters']=_[_0x43e7('0x30')](_0x1480c6[_0x43e7('0x31')],_0x1480c6[_0x43e7('0x2c')]);_0xc62dc9[_0x43e7('0x32')]=_['intersection'](_0x1480c6[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x47f29f['query']['fields']));_0xc62dc9['attributes']=_0xc62dc9[_0x43e7('0x32')][_0x43e7('0x34')]?_0xc62dc9[_0x43e7('0x32')]:_0x1480c6[_0x43e7('0x31')];_0xc62dc9[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0xc62dc9['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x47f29f[_0x43e7('0x2c')],_0x1480c6[_0x43e7('0x4e')]));if(_0x47f29f['query']['filter']){_0xc62dc9[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0xc62dc9[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0xc62dc9['attributes'],function(_0x2f529b){var _0x427cec={};_0x427cec[_0x2f529b]={'$like':'%'+_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x427cec;})});}_0xc62dc9=_[_0x43e7('0x36')]({},_0xc62dc9,_0x47f29f[_0x43e7('0x51')]);return _0x21d001['getTeams'](_0xc62dc9);}})[_0x43e7('0x13')](function(_0x52c974){if(_0x52c974){_0x4600e5=_0x52c974['length'];if(!_0x47f29f[_0x43e7('0x2c')][_0x43e7('0x4b')]('nolimit')){_0xc62dc9['limit']=qs[_0x43e7('0x11')](_0x47f29f[_0x43e7('0x2c')]['limit']);_0xc62dc9[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x47f29f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x21d001['getTeams'](_0xc62dc9);}})['then'](function(_0x2a084b){if(_0x2a084b){return _0x2a084b?{'count':_0x4600e5,'rows':_0x2a084b}:null;}})[_0x43e7('0x13')](respondWithResult(_0x4e5484,null))[_0x43e7('0x2e')](handleError(_0x4e5484,null));};exports['addTeams']=function(_0x49de67,_0x298239){var _0xf682ec=_0x49de67[_0x43e7('0x39')][_0x43e7('0x5b')];var _0x1e247f=_[_0x43e7('0x1a')](_0xf682ec,'id');return db[_0x43e7('0x5a')][_0x43e7('0x2d')]({'where':{'id':_0x1e247f},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x43e7('0x5c'),'voicePause',_0x43e7('0x5d')],'raw':!![]}]})[_0x43e7('0x13')](function(_0x44fee0){if(_0x44fee0){var _0x41d130=_[_0x43e7('0x5e')](_0x44fee0,function(_0x5e87d6){var _0x21039a=_0x5e87d6[_0x43e7('0x15')]({'plain':!![]});_0x21039a[_0x43e7('0x5f')][_0x43e7('0x60')](function(_0x59f68a){_0x59f68a[_0x43e7('0x61')]=_[_0x43e7('0x37')](_0xf682ec,{'id':_0x21039a['id']})[_0x43e7('0x61')];});return _0x21039a[_0x43e7('0x5f')];});return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x49de67[_0x43e7('0x40')]['id']}})['then'](function(_0xc9356c){return db[_0x43e7('0x62')][_0x43e7('0x63')](function(_0x3637d9){return _0xc9356c[_0x43e7('0x64')](_0x1e247f,{'transaction':_0x3637d9})['then'](function(){return BPromise[_0x43e7('0x65')](_0xf682ec,function(_0x25ddf8){return db['TeamVoiceQueue'][_0x43e7('0x66')]({'TeamId':_0x25ddf8['id'],'VoiceQueueId':_0x49de67[_0x43e7('0x40')]['id'],'penalty':_0x25ddf8['penalty']},{'transaction':_0x3637d9});});})[_0x43e7('0x13')](function(){return BPromise[_0x43e7('0x65')](_0x41d130,function(_0x110154){return db[_0x43e7('0x67')][_0x43e7('0x68')]({'where':{'UserId':_0x110154['id'],'VoiceQueueId':_0x49de67['params']['id']},'defaults':{'penalty':_0x110154[_0x43e7('0x61')]},'transaction':_0x3637d9});});})[_0x43e7('0x13')](function(){return BPromise[_0x43e7('0x65')](_['filter'](_0x41d130,{'online':!![]}),function(_0x32b788){return db[_0x43e7('0x69')]['upsert']({'membername':_0x32b788[_0x43e7('0x21')],'UserId':_0x32b788['id'],'queue_name':_0xc9356c[_0x43e7('0x21')],'VoiceQueueId':_0xc9356c['id'],'interface':_[_0x43e7('0x6a')](_0x32b788[_0x43e7('0x5d')])?util[_0x43e7('0x6b')](_0x43e7('0x6c'),_0x32b788['name']):_0x32b788[_0x43e7('0x5d')],'paused':_0x32b788[_0x43e7('0x6d')]||![],'penalty':_0x32b788[_0x43e7('0x61')]},{'transaction':_0x3637d9});});})['then'](function(){_0x41d130[_0x43e7('0x60')](function(_0x21901c){socket[_0x43e7('0x6e')](_0x43e7('0x6f'),{'UserId':_0x21901c['id'],'VoiceQueueId':_0xc9356c['id']});});});});});}})[_0x43e7('0x13')](respondWithStatusCode(_0x298239,null))[_0x43e7('0x2e')](handleError(_0x298239,null));};exports[_0x43e7('0x70')]=function(_0x1896b3,_0x4345a5){return db['Team'][_0x43e7('0x2d')]({'where':{'id':_0x1896b3[_0x43e7('0x2c')][_0x43e7('0x71')]},'attributes':['id'],'include':[{'model':db[_0x43e7('0x72')],'as':_0x43e7('0x5f'),'attributes':['id'],'raw':!![]}]})[_0x43e7('0x13')](handleEntityNotFound(_0x4345a5,null))[_0x43e7('0x13')](function(_0x3e8631){var _0x51e17c=_[_0x43e7('0x1a')](_0x3e8631,'id');var _0x6246c4=[];var _0xd0dca2=[];var _0xa721ba=squel[_0x43e7('0x73')]();_0xa721ba['field'](_0x43e7('0x74'))[_0x43e7('0x75')](_0x43e7('0x76'),'tq')[_0x43e7('0x77')](_0x43e7('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x43e7('0x2a')]('VoiceQueueId\x20=\x20?',_0x1896b3[_0x43e7('0x40')]['id']);for(var _0x339826=0x0;_0x339826<_0x3e8631[_0x43e7('0x34')];_0x339826+=0x1){let _0xc28ac6=_0x3e8631[_0x339826];for(var _0x4b0abd=0x0;_0x4b0abd<_0xc28ac6[_0x43e7('0x5f')][_0x43e7('0x34')];_0x4b0abd+=0x1){let _0x41d636=_0xc28ac6[_0x43e7('0x5f')][_0x4b0abd];var _0x19bdf7=_0xa721ba[_0x43e7('0x3f')]();_0x19bdf7[_0x43e7('0x2a')](_0x43e7('0x79'),_0x41d636['id']);_0xd0dca2[_0x43e7('0x7a')](db[_0x43e7('0x62')][_0x43e7('0x2c')](_0x19bdf7['toString'](),{'type':db['sequelize'][_0x43e7('0x7b')]['SELECT']})['then'](function(_0x4a0d5d){if(_0x4a0d5d[_0x43e7('0x34')]===0x1){return _0x41d636['id'];}else{var _0x5eae45=_[_0x43e7('0x7c')](_['map'](_0x4a0d5d,'TeamId'),function(_0x55f1df){return _[_0x43e7('0x1c')](_0x51e17c,_0x55f1df);});if(_0x5eae45){return _0x41d636['id'];}}}));}}return BPromise[_0x43e7('0x7d')](_0xd0dca2)[_0x43e7('0x13')](function(_0xd6ebb0){_0x6246c4=_(_0x6246c4)[_0x43e7('0x7e')](_0xd6ebb0)[_0x43e7('0x7f')]()[_0x43e7('0x1b')]();return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1896b3[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](function(_0x2a1218){return db[_0x43e7('0x62')][_0x43e7('0x63')](function(_0xe14e67){return _0x2a1218[_0x43e7('0x70')](_0x1896b3[_0x43e7('0x2c')][_0x43e7('0x71')],{'transaction':_0xe14e67})[_0x43e7('0x13')](function(){if(!_[_0x43e7('0x80')](_0x6246c4)){return _0x2a1218['removeAgents'](_0x6246c4,{'transaction':_0xe14e67})[_0x43e7('0x13')](function(){return db[_0x43e7('0x69')]['destroy']({'where':{'VoiceQueueId':_0x1896b3[_0x43e7('0x40')]['id'],'UserId':_0x6246c4},'transaction':_0xe14e67});});}})[_0x43e7('0x13')](function(){_0x6246c4[_0x43e7('0x60')](function(_0x32b33c){socket['emit'](_0x43e7('0x81'),{'UserId':_0x32b33c,'VoiceQueueId':_0x2a1218['id']});});});});});});})[_0x43e7('0x13')](respondWithStatusCode(_0x4345a5,null))['catch'](handleError(_0x4345a5,null));};exports[_0x43e7('0x82')]=function(_0x1a520e,_0xb4cf23){var _0x559145,_0x22b824;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1a520e[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0xb4cf23,null))['then'](function(_0x33b63b){if(_0x33b63b){_0x22b824=_0x33b63b;return _0x33b63b[_0x43e7('0x82')](_0x1a520e['body'][_0x43e7('0x71')],_['omit'](_0x1a520e['body'],['ids','id'])||{})['spread'](function(_0x255113){for(var _0x451fb5=0x0;_0x451fb5<_0x1a520e[_0x43e7('0x39')][_0x43e7('0x71')]['length'];_0x451fb5+=0x1){socket['emit'](_0x43e7('0x6f'),{'UserId':Number(_0x1a520e['body'][_0x43e7('0x71')][_0x451fb5]),'VoiceQueueId':Number(_0x1a520e['params']['id'])});}return _0x255113;});}})[_0x43e7('0x13')](function(_0x4cf7e9){_0x559145=_0x4cf7e9||[];if(_0x22b824){return db['User']['findAll']({'where':{'id':_0x1a520e['body'][_0x43e7('0x71')]},'attributes':['id',_0x43e7('0x21'),_0x43e7('0x5c'),'voicePause',_0x43e7('0x5d')],'raw':!![]});}})[_0x43e7('0x13')](function(_0x517289){if(!_['isEmpty'](_0x517289)){var _0x25fd39=[];for(var _0xb2aca0=0x0;_0xb2aca0<_0x517289[_0x43e7('0x34')];_0xb2aca0++){if(_0x517289[_0xb2aca0][_0x43e7('0x5c')]){_0x25fd39['push'](db[_0x43e7('0x69')]['upsert']({'membername':_0x517289[_0xb2aca0][_0x43e7('0x21')],'UserId':_0x517289[_0xb2aca0]['id'],'queue_name':_0x22b824[_0x43e7('0x21')],'VoiceQueueId':_0x22b824['id'],'interface':_[_0x43e7('0x6a')](_0x517289[_0xb2aca0][_0x43e7('0x5d')])?util[_0x43e7('0x6b')](_0x43e7('0x6c'),_0x517289[_0xb2aca0][_0x43e7('0x21')]):_0x517289[_0xb2aca0]['interface'],'paused':_0x517289[_0xb2aca0][_0x43e7('0x6d')]||![],'penalty':_0x1a520e[_0x43e7('0x39')]['penalty']||0x0}));}}return BPromise[_0x43e7('0x7d')](_0x25fd39);}})[_0x43e7('0x13')](function(){return _0x559145;})[_0x43e7('0x13')](respondWithResult(_0xb4cf23,null))[_0x43e7('0x2e')](handleError(_0xb4cf23,null));};exports[_0x43e7('0x83')]=function(_0x4fd17e,_0x3fd573){return db['VoiceQueue'][_0x43e7('0x37')]({'where':{'id':_0x4fd17e['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x3fd573,null))[_0x43e7('0x13')](function(_0x4446cb){if(_0x4446cb){return _0x4446cb[_0x43e7('0x83')](_0x4fd17e[_0x43e7('0x2c')]['ids'])[_0x43e7('0x13')](function(){if(_['isArray'](_0x4fd17e[_0x43e7('0x2c')][_0x43e7('0x71')])){for(var _0x34d476=0x0;_0x34d476<_0x4fd17e['query'][_0x43e7('0x71')][_0x43e7('0x34')];_0x34d476+=0x1){socket[_0x43e7('0x6e')](_0x43e7('0x81'),{'UserId':Number(_0x4fd17e[_0x43e7('0x2c')]['ids'][_0x34d476]),'VoiceQueueId':Number(_0x4fd17e[_0x43e7('0x40')]['id'])});}}else{socket['emit'](_0x43e7('0x81'),{'UserId':Number(_0x4fd17e[_0x43e7('0x2c')][_0x43e7('0x71')]),'VoiceQueueId':Number(_0x4fd17e[_0x43e7('0x40')]['id'])});}});}})[_0x43e7('0x13')](function(_0x34ed9e){return db[_0x43e7('0x69')]['destroy']({'where':{'VoiceQueueId':_0x4fd17e[_0x43e7('0x40')]['id'],'UserId':_0x4fd17e['query'][_0x43e7('0x71')]}})[_0x43e7('0x13')](function(){return _0x34ed9e;});})[_0x43e7('0x13')](respondWithStatusCode(_0x3fd573,null))[_0x43e7('0x2e')](handleError(_0x3fd573,null));};exports[_0x43e7('0x84')]=function(_0xf9178f,_0x3bb7ab){var _0x2be8c7={};var _0x2bb14d={};var _0x57f7ea;var _0x240478;return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0xf9178f[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x3bb7ab,null))[_0x43e7('0x13')](function(_0x381e47){if(_0x381e47){_0x57f7ea=_0x381e47;_0x2bb14d['model']=_[_0x43e7('0x41')](db[_0x43e7('0x72')][_0x43e7('0x26')]);_0x2bb14d[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0xf9178f[_0x43e7('0x2c')]);_0x2bb14d[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x2bb14d['model'],_0x2bb14d[_0x43e7('0x2c')]);_0x2be8c7[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x2bb14d['model'],qs[_0x43e7('0x33')](_0xf9178f[_0x43e7('0x2c')]['fields']));_0x2be8c7[_0x43e7('0x32')]=_0x2be8c7[_0x43e7('0x32')]['length']?_0x2be8c7[_0x43e7('0x32')]:_0x2bb14d[_0x43e7('0x31')];_0x2be8c7[_0x43e7('0x56')]=qs['sort'](_0xf9178f[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x2be8c7['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0xf9178f[_0x43e7('0x2c')],_0x2bb14d[_0x43e7('0x4e')]));if(_0xf9178f['query']['filter']){_0x2be8c7[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x2be8c7[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x2be8c7['attributes'],function(_0x1e6245){var _0x36860d={};_0x36860d[_0x1e6245]={'$like':'%'+_0xf9178f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x36860d;})});}_0x2be8c7=_['merge']({},_0x2be8c7,_0xf9178f[_0x43e7('0x51')]);return _0x57f7ea[_0x43e7('0x84')](_0x2be8c7);}})[_0x43e7('0x13')](function(_0x3ff5d6){if(_0x3ff5d6){_0x240478=_0x3ff5d6[_0x43e7('0x34')];if(!_0xf9178f['query']['hasOwnProperty']('nolimit')){_0x2be8c7[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0xf9178f[_0x43e7('0x2c')]['limit']);_0x2be8c7[_0x43e7('0xe')]=qs['offset'](_0xf9178f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x57f7ea[_0x43e7('0x84')](_0x2be8c7);}})[_0x43e7('0x13')](function(_0x249a8d){if(_0x249a8d){return _0x249a8d?{'count':_0x240478,'rows':_0x249a8d}:null;}})[_0x43e7('0x13')](respondWithResult(_0x3bb7ab,null))['catch'](handleError(_0x3bb7ab,null));};exports[_0x43e7('0x85')]=function(_0x202421,_0x12e4a3){var _0x16ca0e={};var _0x2f467b={};var _0x7f43b5;var _0x4637f6;return db[_0x43e7('0x25')][_0x43e7('0x49')]({'where':{'id':_0x202421[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x12e4a3,null))[_0x43e7('0x13')](function(_0x24e9a7){if(_0x24e9a7){_0x7f43b5=_0x24e9a7;_0x2f467b['model']=_[_0x43e7('0x41')](db[_0x43e7('0x69')]['rawAttributes']);_0x2f467b[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x202421['query']);_0x2f467b[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x2f467b[_0x43e7('0x31')],_0x2f467b['query']);_0x16ca0e['attributes']=_[_0x43e7('0x30')](_0x2f467b[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x16ca0e[_0x43e7('0x32')]=_0x16ca0e[_0x43e7('0x32')][_0x43e7('0x34')]?_0x16ca0e['attributes']:_0x2f467b[_0x43e7('0x31')];_0x16ca0e[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x16ca0e[_0x43e7('0x2a')]=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x202421[_0x43e7('0x2c')],_0x2f467b[_0x43e7('0x4e')]));if(_0x202421[_0x43e7('0x2c')][_0x43e7('0x19')]){_0x16ca0e['where']=_[_0x43e7('0x36')](_0x16ca0e[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x16ca0e[_0x43e7('0x32')],function(_0x49f43c){var _0xad02f6={};_0xad02f6[_0x49f43c]={'$like':'%'+_0x202421['query'][_0x43e7('0x19')]+'%'};return _0xad02f6;})});}_0x16ca0e=_['merge']({},_0x16ca0e,_0x202421[_0x43e7('0x51')]);return _0x7f43b5[_0x43e7('0x85')](_0x16ca0e);}})[_0x43e7('0x13')](function(_0x4a500c){if(_0x4a500c){_0x4637f6=_0x4a500c[_0x43e7('0x34')];if(!_0x202421[_0x43e7('0x2c')]['hasOwnProperty'](_0x43e7('0x4c'))){_0x16ca0e['limit']=qs[_0x43e7('0x11')](_0x202421[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x16ca0e[_0x43e7('0xe')]=qs['offset'](_0x202421[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x7f43b5[_0x43e7('0x85')](_0x16ca0e);}})['then'](function(_0x12c4f9){return _0x12c4f9?{'count':_0x4637f6,'rows':_0x12c4f9}:null;})[_0x43e7('0x13')](respondWithResult(_0x12e4a3,null))[_0x43e7('0x2e')](handleError(_0x12e4a3,null));};exports[_0x43e7('0x86')]=function(_0x77c2f,_0x1e4a25){var _0x5790b5={};var _0x3f057e={};var _0x505287;var _0x221938;return db[_0x43e7('0x25')]['findOne']({'where':{'id':_0x77c2f[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x1e4a25,null))['then'](function(_0x46aa47){if(_0x46aa47){_0x505287=_0x46aa47;_0x3f057e[_0x43e7('0x31')]=_[_0x43e7('0x41')](db[_0x43e7('0x87')]['rawAttributes']);_0x3f057e['query']=_[_0x43e7('0x41')](_0x77c2f[_0x43e7('0x2c')]);_0x3f057e[_0x43e7('0x4e')]=_[_0x43e7('0x30')](_0x3f057e[_0x43e7('0x31')],_0x3f057e[_0x43e7('0x2c')]);_0x5790b5[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x3f057e['model'],qs[_0x43e7('0x33')](_0x77c2f[_0x43e7('0x2c')]['fields']));_0x5790b5[_0x43e7('0x32')]=_0x5790b5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5790b5[_0x43e7('0x32')]:_0x3f057e[_0x43e7('0x31')];_0x5790b5[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x77c2f['query'][_0x43e7('0x4d')]);_0x5790b5['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x77c2f['query'],_0x3f057e[_0x43e7('0x4e')]));if(_0x77c2f['query'][_0x43e7('0x19')]){_0x5790b5[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x5790b5['where'],{'$or':_['map'](_0x5790b5[_0x43e7('0x32')],function(_0xcfecd2){var _0x4cd879={};_0x4cd879[_0xcfecd2]={'$like':'%'+_0x77c2f[_0x43e7('0x2c')][_0x43e7('0x19')]+'%'};return _0x4cd879;})});}_0x5790b5=_[_0x43e7('0x36')]({},_0x5790b5,_0x77c2f['options']);return _0x505287[_0x43e7('0x86')](_0x5790b5);}})[_0x43e7('0x13')](function(_0xb2eb62){if(_0xb2eb62){_0x221938=_0xb2eb62['length'];if(!_0x77c2f[_0x43e7('0x2c')][_0x43e7('0x4b')](_0x43e7('0x4c'))){_0x5790b5[_0x43e7('0x11')]=qs[_0x43e7('0x11')](_0x77c2f[_0x43e7('0x2c')]['limit']);_0x5790b5[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x77c2f[_0x43e7('0x2c')][_0x43e7('0xe')]);}return _0x505287[_0x43e7('0x86')](_0x5790b5);}})[_0x43e7('0x13')](function(_0x34ab5a){if(_0x34ab5a){return _0x34ab5a?{'count':_0x221938,'rows':_0x34ab5a}:null;}})[_0x43e7('0x13')](respondWithResult(_0x1e4a25,null))[_0x43e7('0x2e')](handleError(_0x1e4a25,null));};exports[_0x43e7('0x88')]=function(_0x13133c,_0x288d6a){var _0x47ef9d=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x56598f,_0x280668;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x13133c[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x288d6a,null))[_0x43e7('0x13')](function(_0x51dc07){if(_0x51dc07){_0x280668=_0x51dc07;return _0x51dc07['addLists'](_0x13133c[_0x43e7('0x39')][_0x43e7('0x71')],_['omit'](_0x13133c['body'],[_0x43e7('0x71'),'id'])||{});}return null;})[_0x43e7('0x89')](function(_0x58a783){var _0x3d6659;_0x56598f=_0x58a783||[];var _0x57bcab=[];if(_0x58a783){for(var _0x5f4023=0x0;_0x5f4023<_0x58a783[_0x43e7('0x34')];_0x5f4023+=0x1){var _0x2be66d=_0x58a783[_0x5f4023]['get']({'plain':!![]});_0x280668['dialCheckDuplicateType']=_0x13133c[_0x43e7('0x39')][_0x43e7('0x8a')]?_0x13133c[_0x43e7('0x39')][_0x43e7('0x8a')]:_0x280668['dialCheckDuplicateType'];switch(_0x280668[_0x43e7('0x8a')]){case _0x43e7('0x8b'):_0x3d6659=squel['insert']()['into']('cm_hopper')['fromQuery']([_0x43e7('0x8c'),_0x43e7('0x8d'),'ContactId','ListId',_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')]('phone',_0x43e7('0x8c'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))[_0x43e7('0x8e')]('id',_0x43e7('0x8f'))['field'](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),_0x43e7('0x92'))[_0x43e7('0x8e')](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x44'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0x93'))[_0x43e7('0x2a')](_0x43e7('0x94'))[_0x43e7('0x2a')]('ListId\x20=\x20?',_0x2be66d[_0x43e7('0x90')]['toString']())[_0x43e7('0x2a')]('phone\x20IS\x20NOT\x20NULL')[_0x43e7('0x2a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x43e7('0x73')]()['field'](_0x43e7('0x95'))[_0x43e7('0x75')](_0x43e7('0x96'))[_0x43e7('0x2a')](_0x43e7('0x97'),_0x13133c[_0x43e7('0x40')]['id'][_0x43e7('0x91')]()))[_0x43e7('0x2a')](_0x43e7('0x98'),squel[_0x43e7('0x73')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x43e7('0x99'))['where']('VoiceQueueId\x20=\x20?',_0x13133c[_0x43e7('0x40')]['id'][_0x43e7('0x91')]())))[_0x43e7('0x91')]();break;case _0x43e7('0x9a'):_0x3d6659=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')](_0x43e7('0x99'))[_0x43e7('0x9d')]([_0x43e7('0x8c'),_0x43e7('0x8d'),_0x43e7('0x8f'),'ListId',_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel['select']()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))[_0x43e7('0x8e')]('id',_0x43e7('0x8f'))[_0x43e7('0x8e')](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),_0x43e7('0x92'))['field'](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27','createdAt')['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0x93'))['where'](_0x43e7('0x94'))[_0x43e7('0x2a')]('ListId\x20=\x20?',_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e'))['where'](_0x43e7('0x98'),squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x9f'))['from']('cm_hopper')[_0x43e7('0x2a')]('VoiceQueueId\x20=\x20?',_0x13133c['params']['id'][_0x43e7('0x91')]())))[_0x43e7('0x91')]();break;default:_0x3d6659=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')]('cm_hopper')[_0x43e7('0x9d')]([_0x43e7('0x8c'),_0x43e7('0x8d'),_0x43e7('0x8f'),_0x43e7('0x92'),_0x43e7('0x50'),'createdAt','updatedAt'],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27',_0x43e7('0x8d'))['field']('id',_0x43e7('0x8f'))[_0x43e7('0x8e')](_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')](),'ListId')[_0x43e7('0x8e')](_0x13133c['params']['id'][_0x43e7('0x91')](),_0x43e7('0x50'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x44'))['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))[_0x43e7('0x75')]('cm_contacts')[_0x43e7('0x2a')](_0x43e7('0x94'))[_0x43e7('0x2a')](_0x43e7('0xa0'),_0x2be66d[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e')))[_0x43e7('0x91')]();}_0x57bcab['push'](db['sequelize'][_0x43e7('0x2c')](_0x3d6659));}return BPromise[_0x43e7('0x7d')](_0x57bcab);}})[_0x43e7('0x13')](function(){var _0x3ac223=[];var _0x486780=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')](_0x43e7('0xa1'))[_0x43e7('0x9d')]([_0x43e7('0xa2'),_0x43e7('0x8c'),_0x43e7('0xa3'),'createdAt',_0x43e7('0x43')],squel['select']()['field']('h.id')[_0x43e7('0x8e')](_0x43e7('0xa4'))[_0x43e7('0x8e')](_0x43e7('0xa5'))[_0x43e7('0x8e')]('\x27'+_0x47ef9d+'\x27','createdAt')['field']('\x27'+_0x47ef9d+'\x27',_0x43e7('0x43'))['from'](_0x43e7('0xa6'),'ci')['join'](_0x43e7('0x99'),'h',_0x43e7('0xa7'))[_0x43e7('0x2a')](_0x43e7('0xa8'),_0x47ef9d)['where']('ci.ItemClass=?',_0x43e7('0xa9')))[_0x43e7('0x91')]();_0x3ac223['push'](db['sequelize'][_0x43e7('0x2c')](_0x486780));return BPromise[_0x43e7('0x7d')](_0x3ac223);})[_0x43e7('0x13')](function(){return _0x56598f;})[_0x43e7('0x13')](respondWithResult(_0x288d6a,null))[_0x43e7('0x2e')](handleError(_0x288d6a,null));};exports[_0x43e7('0xaa')]=function(_0x71807e,_0x314259){return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x71807e['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x314259,null))[_0x43e7('0x13')](function(_0x2613fc){if(_0x2613fc){return _0x2613fc[_0x43e7('0xaa')](_0x71807e['query'][_0x43e7('0x71')]);}})['then'](function(_0x17b298){if(_0x17b298){return db[_0x43e7('0x4a')][_0x43e7('0x14')]({'where':{'ListId':_0x71807e[_0x43e7('0x2c')]['ids'],'VoiceQueueId':_0x71807e['params']['id']}})[_0x43e7('0x13')](function(){return _0x17b298;});}})['then'](respondWithStatusCode(_0x314259,null))[_0x43e7('0x2e')](handleError(_0x314259,null));};exports[_0x43e7('0xab')]=function(_0x44c536,_0x3a9550){var _0x5dcd3f={};var _0x2e7f00={};var _0x2627e2;var _0x591517;return db['VoiceQueue'][_0x43e7('0x49')]({'where':{'id':_0x44c536[_0x43e7('0x40')]['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x3a9550,null))[_0x43e7('0x13')](function(_0x5e042f){if(_0x5e042f){_0x2627e2=_0x5e042f;_0x2e7f00['model']=_[_0x43e7('0x41')](db[_0x43e7('0x87')][_0x43e7('0x26')]);_0x2e7f00[_0x43e7('0x2c')]=_[_0x43e7('0x41')](_0x44c536[_0x43e7('0x2c')]);_0x2e7f00[_0x43e7('0x4e')]=_['intersection'](_0x2e7f00[_0x43e7('0x31')],_0x2e7f00[_0x43e7('0x2c')]);_0x5dcd3f[_0x43e7('0x32')]=_[_0x43e7('0x30')](_0x2e7f00[_0x43e7('0x31')],qs[_0x43e7('0x33')](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x33')]));_0x5dcd3f[_0x43e7('0x32')]=_0x5dcd3f[_0x43e7('0x32')][_0x43e7('0x34')]?_0x5dcd3f[_0x43e7('0x32')]:_0x2e7f00[_0x43e7('0x31')];_0x5dcd3f[_0x43e7('0x56')]=qs[_0x43e7('0x4d')](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x4d')]);_0x5dcd3f['where']=qs[_0x43e7('0x4e')](_[_0x43e7('0x4f')](_0x44c536[_0x43e7('0x2c')],_0x2e7f00[_0x43e7('0x4e')]));if(_0x44c536[_0x43e7('0x2c')]['filter']){_0x5dcd3f[_0x43e7('0x2a')]=_[_0x43e7('0x36')](_0x5dcd3f[_0x43e7('0x2a')],{'$or':_[_0x43e7('0x1a')](_0x5dcd3f[_0x43e7('0x32')],function(_0x5278fd){var _0x84b4f4={};_0x84b4f4[_0x5278fd]={'$like':'%'+_0x44c536['query']['filter']+'%'};return _0x84b4f4;})});}_0x5dcd3f=_['merge']({},_0x5dcd3f,_0x44c536[_0x43e7('0x51')]);return _0x2627e2[_0x43e7('0xab')](_0x5dcd3f);}})[_0x43e7('0x13')](function(_0x4ee587){if(_0x4ee587){_0x591517=_0x4ee587[_0x43e7('0x34')];if(!_0x44c536[_0x43e7('0x2c')]['hasOwnProperty'](_0x43e7('0x4c'))){_0x5dcd3f[_0x43e7('0x11')]=qs['limit'](_0x44c536[_0x43e7('0x2c')][_0x43e7('0x11')]);_0x5dcd3f[_0x43e7('0xe')]=qs[_0x43e7('0xe')](_0x44c536[_0x43e7('0x2c')]['offset']);}return _0x2627e2[_0x43e7('0xab')](_0x5dcd3f);}})[_0x43e7('0x13')](function(_0x3b641e){if(_0x3b641e){return _0x3b641e?{'count':_0x591517,'rows':_0x3b641e}:null;}})[_0x43e7('0x13')](respondWithResult(_0x3a9550,null))[_0x43e7('0x2e')](handleError(_0x3a9550,null));};exports['addBlackLists']=function(_0x5b046d,_0x4a0427){var _0xc3460c;return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x5b046d[_0x43e7('0x40')]['id']}})['then'](handleEntityNotFound(_0x4a0427,null))[_0x43e7('0x13')](function(_0x19c1d2){if(_0x19c1d2){return _0x19c1d2[_0x43e7('0xac')](_0x5b046d['body'][_0x43e7('0x71')],_['omit'](_0x5b046d[_0x43e7('0x39')],[_0x43e7('0x71'),'id'])||{});}return null;})[_0x43e7('0x89')](function(_0x40cc83){var _0x148d72;_0xc3460c=_0x40cc83||[];var _0x1ceb94=[];if(_0x40cc83){for(var _0x19c29b=0x0;_0x19c29b<_0x40cc83[_0x43e7('0x34')];_0x19c29b+=0x1){var _0x38a8db=_0x40cc83[_0x19c29b]['get']({'plain':!![]});_0x148d72=squel[_0x43e7('0x9b')]()[_0x43e7('0x9c')]('cm_hopper_black')['fromQuery']([_0x43e7('0x8c'),_0x43e7('0x8f'),_0x43e7('0x92'),_0x43e7('0x50'),_0x43e7('0x44'),_0x43e7('0x43')],squel[_0x43e7('0x73')]()[_0x43e7('0x8e')](_0x43e7('0x8c'),_0x43e7('0x8c'))[_0x43e7('0x8e')]('id','ContactId')[_0x43e7('0x8e')](_0x38a8db['CmListId'][_0x43e7('0x91')](),_0x43e7('0x92'))[_0x43e7('0x8e')](_0x5b046d[_0x43e7('0x40')]['id']['toString'](),_0x43e7('0x50'))[_0x43e7('0x8e')]('NOW()',_0x43e7('0x44'))[_0x43e7('0x8e')](_0x43e7('0xad'),_0x43e7('0x43'))[_0x43e7('0x75')](_0x43e7('0x93'))[_0x43e7('0x2a')]('deletedAt\x20IS\x20NULL')[_0x43e7('0x2a')](_0x43e7('0xa0'),_0x38a8db[_0x43e7('0x90')][_0x43e7('0x91')]())[_0x43e7('0x2a')](_0x43e7('0x9e')))[_0x43e7('0x91')]();_0x1ceb94[_0x43e7('0x7a')](db[_0x43e7('0x62')]['query'](_0x148d72));}return BPromise[_0x43e7('0x7d')](_0x1ceb94);}})['then'](function(){return _0xc3460c;})[_0x43e7('0x13')](respondWithResult(_0x4a0427,null))[_0x43e7('0x2e')](handleError(_0x4a0427,null));};exports[_0x43e7('0xae')]=function(_0x1dc579,_0x6d9fb){return db[_0x43e7('0x25')][_0x43e7('0x37')]({'where':{'id':_0x1dc579['params']['id']}})[_0x43e7('0x13')](handleEntityNotFound(_0x6d9fb,null))['then'](function(_0x59ca95){if(_0x59ca95){return _0x59ca95[_0x43e7('0xae')](_0x1dc579['query']['ids']);}})[_0x43e7('0x13')](function(_0x759eb5){if(_0x759eb5){return db[_0x43e7('0x58')][_0x43e7('0x14')]({'where':{'ListId':_0x1dc579['query'][_0x43e7('0x71')],'VoiceQueueId':_0x1dc579['params']['id']}})[_0x43e7('0x13')](function(){return _0x759eb5;});}})[_0x43e7('0x13')](respondWithStatusCode(_0x6d9fb,null))[_0x43e7('0x2e')](handleError(_0x6d9fb,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 6194b3e..d4a6c35 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 _0x78dd=['VoiceQueue','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x7a1a50,_0x13593){var _0xe6587d=function(_0x36f8a8){while(--_0x36f8a8){_0x7a1a50['push'](_0x7a1a50['shift']());}};_0xe6587d(++_0x13593);}(_0x78dd,0x178));var _0xd78d=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0x78dd[_0x2f62aa];return _0x1a341f;};'use strict';var EventEmitter=require(_0xd78d('0x0'));var VoiceQueue=require(_0xd78d('0x1'))['db'][_0xd78d('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd78d('0x3'),'afterUpdate':_0xd78d('0x4'),'afterDestroy':_0xd78d('0x5')};function emitEvent(_0x26e90f){return function(_0x257911,_0x4518b6,_0x320ea9){VoiceQueueEvents[_0xd78d('0x6')](_0x26e90f+':'+_0x257911['id'],_0x257911);VoiceQueueEvents[_0xd78d('0x6')](_0x26e90f,_0x257911);_0x320ea9(null);};}for(var e in events){if(events[_0xd78d('0x7')](e)){var event=events[e];VoiceQueue[_0xd78d('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xe493=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x467400,_0x53feca){var _0x21228f=function(_0x292de1){while(--_0x292de1){_0x467400['push'](_0x467400['shift']());}};_0x21228f(++_0x53feca);}(_0xe493,0x1dd));var _0x3e49=function(_0x585a56,_0x20908f){_0x585a56=_0x585a56-0x0;var _0x27465a=_0xe493[_0x585a56];return _0x27465a;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x3e49('0x0'))['db'][_0x3e49('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3e49('0x2')](0x0);var events={'afterCreate':_0x3e49('0x3'),'afterUpdate':_0x3e49('0x4'),'afterDestroy':_0x3e49('0x5')};function emitEvent(_0xa8508d){return function(_0x441f4e,_0x34ccf,_0x289233){VoiceQueueEvents['emit'](_0xa8508d+':'+_0x441f4e['id'],_0x441f4e);VoiceQueueEvents[_0x3e49('0x6')](_0xa8508d,_0x441f4e);_0x289233(null);};}for(var e in events){if(events[_0x3e49('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x3e49('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 447539b..3c41ec5 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x37b624,_0x28c3aa){var _0x44abd9=function(_0x40c152){while(--_0x40c152){_0x37b624['push'](_0x37b624['shift']());}};_0x44abd9(++_0x28c3aa);}(_0x3e74,0x175));var _0x43e7=function(_0x5989d7,_0x1560b9){_0x5989d7=_0x5989d7-0x0;var _0x1c63b9=_0x3e74[_0x5989d7];return _0x1c63b9;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x22763f,_0x5ed69d){var _0x46476a=function(_0x5a7ba4){while(--_0x5a7ba4){_0x22763f['push'](_0x22763f['shift']());}};_0x46476a(++_0x5ed69d);}(_0x34e8,0x12c));var _0x834e=function(_0x9cbd5,_0x262ee9){_0x9cbd5=_0x9cbd5-0x0;var _0x323a52=_0x34e8[_0x9cbd5];return _0x323a52;};'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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index a5196f1..3fed01e 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 _0xaa11=['include','model','stringify','ShowVoiceQueue','raw','lodash','util','moment','ioredis','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','error','VoiceQueue,\x20%s,\x20%s','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','attributes','limit','map'];(function(_0x544de5,_0x252485){var _0xbfc9ba=function(_0x1e5482){while(--_0x1e5482){_0x544de5['push'](_0x544de5['shift']());}};_0xbfc9ba(++_0x252485);}(_0xaa11,0xd7));var _0x1aa1=function(_0x3b4455,_0x3e4395){_0x3b4455=_0x3b4455-0x0;var _0x34dd09=_0xaa11[_0x3b4455];return _0x34dd09;};'use strict';var _=require(_0x1aa1('0x0'));var util=require(_0x1aa1('0x1'));var moment=require(_0x1aa1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1aa1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1aa1('0x4'))('rpc');var config=require(_0x1aa1('0x5'));var jayson=require(_0x1aa1('0x6'));var client=jayson['client'][_0x1aa1('0x7')]({'port':0x232a});config[_0x1aa1('0x8')]=_[_0x1aa1('0x9')](config['redis'],{'host':_0x1aa1('0xa'),'port':0x18eb});var socket=require(_0x1aa1('0xb'))(new Redis(config['redis']));require(_0x1aa1('0xc'))[_0x1aa1('0xd')](socket);function respondWithRpcPromise(_0x527446,_0xf3b215,_0x5bbf17){return new BPromise(function(_0x474419,_0x520375){return client[_0x1aa1('0xe')](_0x527446,_0x5bbf17)[_0x1aa1('0xf')](function(_0x303694){logger[_0x1aa1('0x10')]('VoiceQueue,\x20%s,\x20%s',_0xf3b215,_0x1aa1('0x11'));logger[_0x1aa1('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0xf3b215,_0x1aa1('0x11'),JSON['stringify'](_0x303694));if(_0x303694['error']){if(_0x303694[_0x1aa1('0x13')]['code']===0x1f4){logger['error'](_0x1aa1('0x14'),_0xf3b215,_0x303694[_0x1aa1('0x13')][_0x1aa1('0x15')]);return _0x520375(_0x303694[_0x1aa1('0x13')][_0x1aa1('0x15')]);}logger[_0x1aa1('0x13')](_0x1aa1('0x14'),_0xf3b215,_0x303694[_0x1aa1('0x13')]['message']);return _0x474419(_0x303694['error']['message']);}else{logger[_0x1aa1('0x10')](_0x1aa1('0x14'),_0xf3b215,_0x1aa1('0x11'));_0x474419(_0x303694['result']['message']);}})[_0x1aa1('0x16')](function(_0x5461f5){logger[_0x1aa1('0x13')](_0x1aa1('0x14'),_0xf3b215,_0x5461f5);_0x520375(_0x5461f5);});});}exports[_0x1aa1('0x17')]=function(_0x17264e){var _0xb31699=this;return new Promise(function(_0x1fba4d,_0x18868d){return db[_0x1aa1('0x18')][_0x1aa1('0x19')]({'raw':_0x17264e[_0x1aa1('0x1a')]?_0x17264e['options']['raw']===undefined?!![]:![]:!![],'where':_0x17264e['options']?_0x17264e[_0x1aa1('0x1a')]['where']||null:null,'attributes':_0x17264e['options']?_0x17264e[_0x1aa1('0x1a')][_0x1aa1('0x1b')]||null:null,'limit':_0x17264e['options']?_0x17264e[_0x1aa1('0x1a')][_0x1aa1('0x1c')]||null:null,'include':_0x17264e[_0x1aa1('0x1a')]?_0x17264e[_0x1aa1('0x1a')]['include']?_[_0x1aa1('0x1d')](_0x17264e[_0x1aa1('0x1a')][_0x1aa1('0x1e')],function(_0x13a93a){return{'model':db[_0x13a93a[_0x1aa1('0x1f')]],'as':_0x13a93a['as'],'attributes':_0x13a93a[_0x1aa1('0x1b')],'include':_0x13a93a[_0x1aa1('0x1e')]?_[_0x1aa1('0x1d')](_0x13a93a['include'],function(_0x4395af){return{'model':db[_0x4395af[_0x1aa1('0x1f')]],'as':_0x4395af['as'],'attributes':_0x4395af[_0x1aa1('0x1b')],'include':_0x4395af[_0x1aa1('0x1e')]?_['map'](_0x4395af[_0x1aa1('0x1e')],function(_0x28c79e){return{'model':db[_0x28c79e[_0x1aa1('0x1f')]],'as':_0x28c79e['as'],'attributes':_0x28c79e[_0x1aa1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1aa1('0xf')](function(_0x4f659a){logger[_0x1aa1('0x10')]('GetVoiceQueue',_0x17264e);logger[_0x1aa1('0x12')]('GetVoiceQueue',_0x17264e,JSON[_0x1aa1('0x20')](_0x4f659a));_0x1fba4d(_0x4f659a);})['catch'](function(_0x764fd){logger[_0x1aa1('0x13')]('GetVoiceQueue',_0x764fd['message'],_0x17264e);_0x18868d(_0xb31699['error'](0x1f4,_0x764fd[_0x1aa1('0x15')]));});});};exports[_0x1aa1('0x21')]=function(_0x1e0bea){var _0x3cf977=this;return new Promise(function(_0x312e8d,_0x5a889c){return db['VoiceQueue']['find']({'raw':_0x1e0bea[_0x1aa1('0x1a')]?_0x1e0bea[_0x1aa1('0x1a')][_0x1aa1('0x22')]===undefined?!![]:![]:!![],'where':_0x1e0bea['options']?_0x1e0bea['options']['where']||null:null,'attributes':_0x1e0bea[_0x1aa1('0x1a')]?_0x1e0bea[_0x1aa1('0x1a')][_0x1aa1('0x1b')]||null:null,'include':_0x1e0bea['options']?_0x1e0bea[_0x1aa1('0x1a')][_0x1aa1('0x1e')]?_[_0x1aa1('0x1d')](_0x1e0bea[_0x1aa1('0x1a')][_0x1aa1('0x1e')],function(_0x285a52){return{'model':db[_0x285a52[_0x1aa1('0x1f')]],'as':_0x285a52['as'],'attributes':_0x285a52[_0x1aa1('0x1b')],'include':_0x285a52[_0x1aa1('0x1e')]?_[_0x1aa1('0x1d')](_0x285a52[_0x1aa1('0x1e')],function(_0x54c8ef){return{'model':db[_0x54c8ef[_0x1aa1('0x1f')]],'as':_0x54c8ef['as'],'attributes':_0x54c8ef[_0x1aa1('0x1b')],'include':_0x54c8ef[_0x1aa1('0x1e')]?_[_0x1aa1('0x1d')](_0x54c8ef[_0x1aa1('0x1e')],function(_0x4ed336){return{'model':db[_0x4ed336['model']],'as':_0x4ed336['as'],'attributes':_0x4ed336[_0x1aa1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1aa1('0xf')](function(_0x1eb564){logger[_0x1aa1('0x10')]('ShowVoiceQueue',_0x1e0bea);logger[_0x1aa1('0x12')](_0x1aa1('0x21'),_0x1e0bea,JSON[_0x1aa1('0x20')](_0x1eb564));_0x312e8d(_0x1eb564);})[_0x1aa1('0x16')](function(_0x45fa68){logger[_0x1aa1('0x13')](_0x1aa1('0x21'),_0x45fa68[_0x1aa1('0x15')],_0x1e0bea);_0x5a889c(_0x3cf977[_0x1aa1('0x13')](0x1f4,_0x45fa68[_0x1aa1('0x15')]));});});}; \ No newline at end of file +var _0x2266=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','VoiceQueue,\x20%s,\x20%s','message','result','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','stringify','catch','ShowVoiceQueue','find','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x2266,0x19c));var _0x6226=function(_0x2676e8,_0x392259){_0x2676e8=_0x2676e8-0x0;var _0x17a24b=_0x2266[_0x2676e8];return _0x17a24b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6226('0x0'));var BPromise=require(_0x6226('0x1'));var rs=require(_0x6226('0x2'));var fs=require('fs');var Redis=require(_0x6226('0x3'));var db=require(_0x6226('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6226('0x5'))(_0x6226('0x6'));var config=require(_0x6226('0x7'));var jayson=require(_0x6226('0x8'));var client=jayson[_0x6226('0x9')][_0x6226('0xa')]({'port':0x232a});config[_0x6226('0xb')]=_[_0x6226('0xc')](config[_0x6226('0xb')],{'host':_0x6226('0xd'),'port':0x18eb});var socket=require(_0x6226('0xe'))(new Redis(config[_0x6226('0xb')]));require(_0x6226('0xf'))[_0x6226('0x10')](socket);function respondWithRpcPromise(_0x3e3871,_0x34eeee,_0x299d05){return new BPromise(function(_0x2a9260,_0x15e675){return client['request'](_0x3e3871,_0x299d05)[_0x6226('0x11')](function(_0xa8fce6){logger[_0x6226('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x34eeee,_0x6226('0x13'));logger[_0x6226('0x14')](_0x6226('0x15'),_0x34eeee,'request\x20sent',JSON['stringify'](_0xa8fce6));if(_0xa8fce6[_0x6226('0x16')]){if(_0xa8fce6[_0x6226('0x16')][_0x6226('0x17')]===0x1f4){logger[_0x6226('0x16')](_0x6226('0x18'),_0x34eeee,_0xa8fce6[_0x6226('0x16')]['message']);return _0x15e675(_0xa8fce6[_0x6226('0x16')]['message']);}logger[_0x6226('0x16')](_0x6226('0x18'),_0x34eeee,_0xa8fce6['error'][_0x6226('0x19')]);return _0x2a9260(_0xa8fce6[_0x6226('0x16')][_0x6226('0x19')]);}else{logger[_0x6226('0x12')](_0x6226('0x18'),_0x34eeee,_0x6226('0x13'));_0x2a9260(_0xa8fce6[_0x6226('0x1a')][_0x6226('0x19')]);}})['catch'](function(_0x286866){logger[_0x6226('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x34eeee,_0x286866);_0x15e675(_0x286866);});});}exports[_0x6226('0x1b')]=function(_0x386ae5){var _0x4b6ffc=this;return new Promise(function(_0x16793f,_0x2f868d){return db[_0x6226('0x1c')][_0x6226('0x1d')]({'raw':_0x386ae5[_0x6226('0x1e')]?_0x386ae5[_0x6226('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x386ae5[_0x6226('0x1e')]?_0x386ae5[_0x6226('0x1e')][_0x6226('0x1f')]||null:null,'attributes':_0x386ae5[_0x6226('0x1e')]?_0x386ae5['options'][_0x6226('0x20')]||null:null,'limit':_0x386ae5['options']?_0x386ae5[_0x6226('0x1e')][_0x6226('0x21')]||null:null,'include':_0x386ae5[_0x6226('0x1e')]?_0x386ae5[_0x6226('0x1e')][_0x6226('0x22')]?_[_0x6226('0x23')](_0x386ae5[_0x6226('0x1e')][_0x6226('0x22')],function(_0x854f40){return{'model':db[_0x854f40[_0x6226('0x24')]],'as':_0x854f40['as'],'attributes':_0x854f40[_0x6226('0x20')],'include':_0x854f40[_0x6226('0x22')]?_[_0x6226('0x23')](_0x854f40['include'],function(_0x4f85c8){return{'model':db[_0x4f85c8[_0x6226('0x24')]],'as':_0x4f85c8['as'],'attributes':_0x4f85c8[_0x6226('0x20')],'include':_0x4f85c8['include']?_[_0x6226('0x23')](_0x4f85c8[_0x6226('0x22')],function(_0x17fc8e){return{'model':db[_0x17fc8e[_0x6226('0x24')]],'as':_0x17fc8e['as'],'attributes':_0x17fc8e[_0x6226('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6226('0x11')](function(_0x1ff576){logger['info']('GetVoiceQueue',_0x386ae5);logger[_0x6226('0x14')](_0x6226('0x1b'),_0x386ae5,JSON[_0x6226('0x25')](_0x1ff576));_0x16793f(_0x1ff576);})[_0x6226('0x26')](function(_0x6dc538){logger[_0x6226('0x16')]('GetVoiceQueue',_0x6dc538[_0x6226('0x19')],_0x386ae5);_0x2f868d(_0x4b6ffc[_0x6226('0x16')](0x1f4,_0x6dc538[_0x6226('0x19')]));});});};exports[_0x6226('0x27')]=function(_0x167856){var _0x3d2a30=this;return new Promise(function(_0x38b793,_0x4d8669){return db[_0x6226('0x1c')][_0x6226('0x28')]({'raw':_0x167856[_0x6226('0x1e')]?_0x167856[_0x6226('0x1e')][_0x6226('0x29')]===undefined?!![]:![]:!![],'where':_0x167856['options']?_0x167856['options']['where']||null:null,'attributes':_0x167856[_0x6226('0x1e')]?_0x167856[_0x6226('0x1e')][_0x6226('0x20')]||null:null,'include':_0x167856[_0x6226('0x1e')]?_0x167856['options'][_0x6226('0x22')]?_[_0x6226('0x23')](_0x167856[_0x6226('0x1e')][_0x6226('0x22')],function(_0x42b38b){return{'model':db[_0x42b38b[_0x6226('0x24')]],'as':_0x42b38b['as'],'attributes':_0x42b38b[_0x6226('0x20')],'include':_0x42b38b['include']?_['map'](_0x42b38b[_0x6226('0x22')],function(_0x589f63){return{'model':db[_0x589f63['model']],'as':_0x589f63['as'],'attributes':_0x589f63[_0x6226('0x20')],'include':_0x589f63[_0x6226('0x22')]?_[_0x6226('0x23')](_0x589f63[_0x6226('0x22')],function(_0x397808){return{'model':db[_0x397808[_0x6226('0x24')]],'as':_0x397808['as'],'attributes':_0x397808['attributes']};}):[]};}):[]};}):[]:[]})[_0x6226('0x11')](function(_0x424212){logger['info'](_0x6226('0x27'),_0x167856);logger[_0x6226('0x14')](_0x6226('0x27'),_0x167856,JSON[_0x6226('0x25')](_0x424212));_0x38b793(_0x424212);})['catch'](function(_0x3e1380){logger[_0x6226('0x16')](_0x6226('0x27'),_0x3e1380[_0x6226('0x19')],_0x167856);_0x4d8669(_0x3d2a30[_0x6226('0x16')](0x1f4,_0x3e1380[_0x6226('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7749d9a..bdb5372 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 _0xf883=['removeListener','length','voiceQueue:','./voiceQueue.events','save','update','emit'];(function(_0x508421,_0x8d4cf4){var _0x2eb366=function(_0x52428b){while(--_0x52428b){_0x508421['push'](_0x508421['shift']());}};_0x2eb366(++_0x8d4cf4);}(_0xf883,0x1d8));var _0x3f88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf883[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueEvents=require(_0x3f88('0x0'));var events=[_0x3f88('0x1'),'remove',_0x3f88('0x2')];function createListener(_0x2ea1b4,_0x3d39ff){return function(_0x15aaba){_0x3d39ff[_0x3f88('0x3')](_0x2ea1b4,_0x15aaba);};}function removeListener(_0x5d015f,_0x28fa60){return function(){VoiceQueueEvents[_0x3f88('0x4')](_0x5d015f,_0x28fa60);};}exports['register']=function(_0x5ecea2){for(var _0x59951e=0x0,_0x57e46b=events[_0x3f88('0x5')];_0x59951e<_0x57e46b;_0x59951e++){var _0x2820d4=events[_0x59951e];var _0x34baae=createListener(_0x3f88('0x6')+_0x2820d4,_0x5ecea2);VoiceQueueEvents['on'](_0x2820d4,_0x34baae);}}; \ No newline at end of file +var _0x4d7c=['remove','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x26f1cf,_0x3ed15f){var _0x6674e8=function(_0x1ed975){while(--_0x1ed975){_0x26f1cf['push'](_0x26f1cf['shift']());}};_0x6674e8(++_0x3ed15f);}(_0x4d7c,0x16f));var _0xc4d7=function(_0x35e168,_0x34d2f2){_0x35e168=_0x35e168-0x0;var _0x5bbf85=_0x4d7c[_0x35e168];return _0x5bbf85;};'use strict';var VoiceQueueEvents=require(_0xc4d7('0x0'));var events=[_0xc4d7('0x1'),_0xc4d7('0x2'),_0xc4d7('0x3')];function createListener(_0x39af0e,_0x1bbfdc){return function(_0x4879f1){_0x1bbfdc[_0xc4d7('0x4')](_0x39af0e,_0x4879f1);};}function removeListener(_0x147e6c,_0xc01ddd){return function(){VoiceQueueEvents[_0xc4d7('0x5')](_0x147e6c,_0xc01ddd);};}exports[_0xc4d7('0x6')]=function(_0x37671a){for(var _0x4b3c9b=0x0,_0x10ee71=events[_0xc4d7('0x7')];_0x4b3c9b<_0x10ee71;_0x4b3c9b++){var _0x1f479c=events[_0x4b3c9b];var _0x345cfc=createListener(_0xc4d7('0x8')+_0x1f479c,_0x37671a);VoiceQueueEvents['on'](_0x1f479c,_0x345cfc);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index ff92010..884b7c4 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 _0xf666=['delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf666,0xd1));var _0x6f66=function(_0x513c68,_0x3d15e2){_0x513c68=_0x513c68-0x0;var _0x361e7d=_0xf666[_0x513c68];return _0x361e7d;};'use strict';var multer=require(_0x6f66('0x0'));var util=require(_0x6f66('0x1'));var path=require(_0x6f66('0x2'));var timeout=require('connect-timeout');var express=require(_0x6f66('0x3'));var router=express[_0x6f66('0x4')]();var fs_extra=require(_0x6f66('0x5'));var auth=require(_0x6f66('0x6'));var interaction=require(_0x6f66('0x7'));var config=require(_0x6f66('0x8'));var controller=require(_0x6f66('0x9'));router[_0x6f66('0xa')]('/',auth[_0x6f66('0xb')](),controller[_0x6f66('0xc')]);router[_0x6f66('0xa')](_0x6f66('0xd'),auth[_0x6f66('0xb')](),controller[_0x6f66('0xe')]);router[_0x6f66('0xa')](_0x6f66('0xf'),auth[_0x6f66('0xb')](),controller[_0x6f66('0x10')]);router[_0x6f66('0xa')](_0x6f66('0x11'),auth[_0x6f66('0xb')](),controller[_0x6f66('0x12')]);router['post']('/',auth[_0x6f66('0xb')](),controller['create']);router[_0x6f66('0x13')]('/:id',auth[_0x6f66('0xb')](),controller[_0x6f66('0x14')]);router[_0x6f66('0x15')](_0x6f66('0x11'),auth[_0x6f66('0xb')](),controller[_0x6f66('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5bbb=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','/:id','post','create','put','update','destroy','exports','multer'];(function(_0x524c9e,_0x587eff){var _0x3126dc=function(_0x433865){while(--_0x433865){_0x524c9e['push'](_0x524c9e['shift']());}};_0x3126dc(++_0x587eff);}(_0x5bbb,0x107));var _0xb5bb=function(_0x4ce978,_0x2a225a){_0x4ce978=_0x4ce978-0x0;var _0x1465a9=_0x5bbb[_0x4ce978];return _0x1465a9;};'use strict';var multer=require(_0xb5bb('0x0'));var util=require(_0xb5bb('0x1'));var path=require(_0xb5bb('0x2'));var timeout=require(_0xb5bb('0x3'));var express=require(_0xb5bb('0x4'));var router=express['Router']();var fs_extra=require(_0xb5bb('0x5'));var auth=require(_0xb5bb('0x6'));var interaction=require(_0xb5bb('0x7'));var config=require('../../config/environment');var controller=require(_0xb5bb('0x8'));router[_0xb5bb('0x9')]('/',auth[_0xb5bb('0xa')](),controller[_0xb5bb('0xb')]);router[_0xb5bb('0x9')](_0xb5bb('0xc'),auth[_0xb5bb('0xa')](),controller[_0xb5bb('0xd')]);router[_0xb5bb('0x9')](_0xb5bb('0xe'),auth[_0xb5bb('0xa')](),controller['getVoiceQueuesReport']);router['get'](_0xb5bb('0xf'),auth[_0xb5bb('0xa')](),controller['show']);router[_0xb5bb('0x10')]('/',auth[_0xb5bb('0xa')](),controller[_0xb5bb('0x11')]);router[_0xb5bb('0x12')]('/:id',auth[_0xb5bb('0xa')](),controller[_0xb5bb('0x13')]);router['delete'](_0xb5bb('0xf'),auth[_0xb5bb('0xa')](),controller[_0xb5bb('0x14')]);module[_0xb5bb('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 6c1fa2e..5319d98 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 _0x30ea=['FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0xc77097,_0x692da6){var _0x436c6d=function(_0x5739ba){while(--_0x5739ba){_0xc77097['push'](_0xc77097['shift']());}};_0x436c6d(++_0x692da6);}(_0x30ea,0x191));var _0xa30e=function(_0x1fbb56,_0x22b4f8){_0x1fbb56=_0x1fbb56-0x0;var _0x562df4=_0x30ea[_0x1fbb56];return _0x562df4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa30e('0x0'));module[_0xa30e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa30e('0x2')]},'calleridnum':{'type':Sequelize[_0xa30e('0x2')]},'calleridname':{'type':Sequelize[_0xa30e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xa30e('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x11229e){var _0x5acaaa=moment(_0x11229e);var _0x522b74=moment(this[_0xa30e('0x4')](_0xa30e('0x5')))['format'](_0xa30e('0x6'));var _0x24a6e8=_0x5acaaa[_0xa30e('0x7')](_0x522b74,_0xa30e('0x8'));this['setDataValue'](_0xa30e('0x9'),_0x11229e);this[_0xa30e('0xa')](_0xa30e('0xb'),_0x24a6e8||null);}},'position':{'type':Sequelize[_0xa30e('0xc')]},'count':{'type':Sequelize[_0xa30e('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xa30e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xa30e('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa30e('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xa30e('0xe')},'originalposition':{'type':Sequelize[_0xa30e('0xc')]},'channel':{'type':Sequelize[_0xa30e('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa30e('0x2')]},'connectedlinename':{'type':Sequelize[_0xa30e('0x2')]},'accountcode':{'type':Sequelize[_0xa30e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa30e('0x2')]},'priority':{'type':Sequelize[_0xa30e('0x2')]},'holdtime':{'type':Sequelize[_0xa30e('0xc')]},'mohtime':{'type':Sequelize[_0xa30e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xa30e('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa30e('0x2')],'comment':_0xa30e('0xf')},'transferexten':{'type':Sequelize[_0xa30e('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xa30e('0x2')]},'secondDisposition':{'type':Sequelize[_0xa30e('0x2')]},'thirdDisposition':{'type':Sequelize[_0xa30e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xa30e('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0xa30e('0x2')]}}; \ No newline at end of file +var _0xc5f0=['STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports'];(function(_0x325b1b,_0x149c75){var _0x51b5b9=function(_0x20701b){while(--_0x20701b){_0x325b1b['push'](_0x325b1b['shift']());}};_0x51b5b9(++_0x149c75);}(_0xc5f0,0xce));var _0x0c5f=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0xc5f0[_0x2525f1];return _0x13c1b5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0c5f('0x0'));module[_0x0c5f('0x1')]={'type':{'type':Sequelize[_0x0c5f('0x2')]},'uniqueid':{'type':Sequelize[_0x0c5f('0x2')]},'calleridnum':{'type':Sequelize[_0x0c5f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0c5f('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x0c5f('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x0c5f('0x3')],'set':function(_0x54deb7){var _0x47ff52=moment(_0x54deb7);var _0x153117=moment(this[_0x0c5f('0x4')](_0x0c5f('0x5')))['format'](_0x0c5f('0x6'));var _0x22d77e=_0x47ff52[_0x0c5f('0x7')](_0x153117,_0x0c5f('0x8'));this['setDataValue'](_0x0c5f('0x9'),_0x54deb7);this[_0x0c5f('0xa')](_0x0c5f('0xb'),_0x22d77e||null);}},'position':{'type':Sequelize[_0x0c5f('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x0c5f('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x0c5f('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x0c5f('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0c5f('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x0c5f('0x2')],'comment':_0x0c5f('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x0c5f('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0c5f('0x2')]},'connectedlinename':{'type':Sequelize[_0x0c5f('0x2')]},'accountcode':{'type':Sequelize[_0x0c5f('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0c5f('0x2')]},'priority':{'type':Sequelize[_0x0c5f('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x0c5f('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0c5f('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0c5f('0x2')]},'transfer':{'type':Sequelize[_0x0c5f('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0c5f('0x2')],'comment':_0x0c5f('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x0c5f('0x2')]},'disposition':{'type':Sequelize[_0x0c5f('0x2')]},'secondDisposition':{'type':Sequelize[_0x0c5f('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x0c5f('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x0c5f('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 03d1d9c..bf88e2d 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 _0xb772=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','getVoiceQueuesReport','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','name','send','index','map','VoiceQueueReport'];(function(_0x5663f4,_0x4ee714){var _0x5767af=function(_0x493929){while(--_0x493929){_0x5663f4['push'](_0x5663f4['shift']());}};_0x5767af(++_0x4ee714);}(_0xb772,0x12a));var _0x2b77=function(_0x5b710b,_0x103f64){_0x5b710b=_0x5b710b-0x0;var _0x40ccbe=_0xb772[_0x5b710b];return _0x40ccbe;};'use strict';var emlformat=require(_0x2b77('0x0'));var rimraf=require(_0x2b77('0x1'));var zipdir=require(_0x2b77('0x2'));var jsonpatch=require(_0x2b77('0x3'));var rp=require(_0x2b77('0x4'));var moment=require(_0x2b77('0x5'));var BPromise=require(_0x2b77('0x6'));var Mustache=require('mustache');var util=require(_0x2b77('0x7'));var path=require(_0x2b77('0x8'));var sox=require(_0x2b77('0x9'));var csv=require(_0x2b77('0xa'));var ejs=require(_0x2b77('0xb'));var fs=require('fs');var fs_extra=require(_0x2b77('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b77('0xd'));var jsforce=require(_0x2b77('0xe'));var deskjs=require(_0x2b77('0xf'));var toCsv=require(_0x2b77('0xa'));var querystring=require(_0x2b77('0x10'));var Papa=require(_0x2b77('0x11'));var Redis=require(_0x2b77('0x12'));var authService=require(_0x2b77('0x13'));var qs=require(_0x2b77('0x14'));var as=require(_0x2b77('0x15'));var hardwareService=require(_0x2b77('0x16'));var logger=require(_0x2b77('0x17'))(_0x2b77('0x18'));var utils=require(_0x2b77('0x19'));var config=require(_0x2b77('0x1a'));var licenseUtil=require(_0x2b77('0x1b'));var db=require('../../mysqldb')['db'];config[_0x2b77('0x1c')]=_[_0x2b77('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2b77('0x1e'))(new Redis(config['redis']));require(_0x2b77('0x1f'))[_0x2b77('0x20')](socket);function respondWithStatusCode(_0xe8cdf3,_0x269836){_0x269836=_0x269836||0xcc;return function(_0x17d3cb){if(_0x17d3cb){return _0xe8cdf3[_0x2b77('0x21')](_0x269836);}return _0xe8cdf3[_0x2b77('0x22')](_0x269836)['end']();};}function respondWithResult(_0x3f5fab,_0x5962da){_0x5962da=_0x5962da||0xc8;return function(_0x1d3c22){if(_0x1d3c22){return _0x3f5fab['status'](_0x5962da)[_0x2b77('0x23')](_0x1d3c22);}};}function respondWithFilteredResult(_0x295538,_0x1f18a5){return function(_0x232453){if(_0x232453){var _0x53b590=typeof _0x1f18a5[_0x2b77('0x24')]===_0x2b77('0x25')&&typeof _0x1f18a5['limit']===_0x2b77('0x25');var _0x32aa75=_0x232453[_0x2b77('0x26')];var _0x50c928=_0x53b590?0x0:_0x1f18a5[_0x2b77('0x24')];var _0x40bb65=_0x53b590?_0x232453['count']:_0x1f18a5['offset']+_0x1f18a5[_0x2b77('0x27')];var _0x4b0217;if(_0x40bb65>=_0x32aa75){_0x40bb65=_0x32aa75;_0x4b0217=0xc8;}else{_0x4b0217=0xce;}_0x295538[_0x2b77('0x22')](_0x4b0217);return _0x295538[_0x2b77('0x28')](_0x2b77('0x29'),_0x50c928+'-'+_0x40bb65+'/'+_0x32aa75)[_0x2b77('0x23')](_0x232453);}return null;};}function patchUpdates(_0x2fc249){return function(_0x32bd90){try{jsonpatch[_0x2b77('0x2a')](_0x32bd90,_0x2fc249,!![]);}catch(_0xf4ff0a){return BPromise[_0x2b77('0x2b')](_0xf4ff0a);}return _0x32bd90['save']();};}function saveUpdates(_0x3486d6,_0x521833){return function(_0x30b0f0){if(_0x30b0f0){return _0x30b0f0[_0x2b77('0x2c')](_0x3486d6)['then'](function(_0x3adba7){return _0x3adba7;});}return null;};}function removeEntity(_0x3b2a01,_0x1e7515){return function(_0x298342){if(_0x298342){return _0x298342[_0x2b77('0x2d')]()[_0x2b77('0x2e')](function(){_0x3b2a01[_0x2b77('0x22')](0xcc)[_0x2b77('0x2f')]();});}};}function handleEntityNotFound(_0x203af1,_0xcf0f77){return function(_0xfd8a5f){if(!_0xfd8a5f){_0x203af1[_0x2b77('0x21')](0x194);}return _0xfd8a5f;};}function handleError(_0x29dd59,_0x34cc2e){_0x34cc2e=_0x34cc2e||0x1f4;return function(_0x423d8d){logger[_0x2b77('0x30')](_0x423d8d['stack']);if(_0x423d8d[_0x2b77('0x31')]){delete _0x423d8d[_0x2b77('0x31')];}_0x29dd59['status'](_0x34cc2e)[_0x2b77('0x32')](_0x423d8d);};}exports[_0x2b77('0x33')]=function(_0x58e526,_0x2ab591){var _0x2ac4c5={},_0x489562={},_0x4953bb={'count':0x0,'rows':[]};var _0x22990b=_[_0x2b77('0x34')](db[_0x2b77('0x35')]['rawAttributes'],function(_0x4d5f13){return{'name':_0x4d5f13[_0x2b77('0x36')],'type':_0x4d5f13[_0x2b77('0x37')][_0x2b77('0x38')]};});_0x489562[_0x2b77('0x39')]=_[_0x2b77('0x34')](_0x22990b,_0x2b77('0x31'));_0x489562[_0x2b77('0x3a')]=_[_0x2b77('0x3b')](_0x58e526[_0x2b77('0x3a')]);_0x489562[_0x2b77('0x3c')]=_[_0x2b77('0x3d')](_0x489562[_0x2b77('0x39')],_0x489562['query']);_0x2ac4c5[_0x2b77('0x3e')]=_[_0x2b77('0x3d')](_0x489562['model'],qs[_0x2b77('0x3f')](_0x58e526[_0x2b77('0x3a')]['fields']));_0x2ac4c5[_0x2b77('0x3e')]=_0x2ac4c5['attributes'][_0x2b77('0x40')]?_0x2ac4c5[_0x2b77('0x3e')]:_0x489562['model'];if(!_0x58e526['query'][_0x2b77('0x41')](_0x2b77('0x42'))){_0x2ac4c5[_0x2b77('0x27')]=qs[_0x2b77('0x27')](_0x58e526[_0x2b77('0x3a')][_0x2b77('0x27')]);_0x2ac4c5[_0x2b77('0x24')]=qs[_0x2b77('0x24')](_0x58e526[_0x2b77('0x3a')]['offset']);}_0x2ac4c5[_0x2b77('0x43')]=qs[_0x2b77('0x44')](_0x58e526[_0x2b77('0x3a')][_0x2b77('0x44')]);_0x2ac4c5[_0x2b77('0x45')]=qs[_0x2b77('0x3c')](_[_0x2b77('0x46')](_0x58e526[_0x2b77('0x3a')],_0x489562[_0x2b77('0x3c')]),_0x22990b);if(_0x58e526[_0x2b77('0x3a')][_0x2b77('0x47')]){_0x2ac4c5[_0x2b77('0x45')]=_[_0x2b77('0x48')](_0x2ac4c5[_0x2b77('0x45')],{'$or':_[_0x2b77('0x34')](_0x22990b,function(_0x364968){if(_0x364968[_0x2b77('0x37')]!==_0x2b77('0x49')){var _0x50caf0={};_0x50caf0[_0x364968[_0x2b77('0x31')]]={'$like':'%'+_0x58e526[_0x2b77('0x3a')]['filter']+'%'};return _0x50caf0;}})});}_0x2ac4c5=_[_0x2b77('0x48')]({},_0x2ac4c5,_0x58e526[_0x2b77('0x4a')]);var _0x1584ac={'where':_0x2ac4c5['where']};return db[_0x2b77('0x35')][_0x2b77('0x26')](_0x1584ac)[_0x2b77('0x2e')](function(_0x28ea01){_0x4953bb[_0x2b77('0x26')]=_0x28ea01;if(_0x58e526[_0x2b77('0x3a')][_0x2b77('0x4b')]){_0x2ac4c5[_0x2b77('0x4c')]=[{'all':!![]}];}return db[_0x2b77('0x35')]['findAll'](_0x2ac4c5);})[_0x2b77('0x2e')](function(_0x37a9e3){_0x4953bb[_0x2b77('0x4d')]=_0x37a9e3;return _0x4953bb;})['then'](respondWithFilteredResult(_0x2ab591,_0x2ac4c5))[_0x2b77('0x4e')](handleError(_0x2ab591,null));};exports[_0x2b77('0x4f')]=function(_0x386151,_0x5c58d8){var _0x2ad614={'raw':![],'where':{'id':_0x386151[_0x2b77('0x50')]['id']}},_0x210fa8={};_0x210fa8[_0x2b77('0x39')]=_[_0x2b77('0x3b')](db[_0x2b77('0x35')][_0x2b77('0x51')]);_0x210fa8[_0x2b77('0x3a')]=_[_0x2b77('0x3b')](_0x386151[_0x2b77('0x3a')]);_0x210fa8['filters']=_[_0x2b77('0x3d')](_0x210fa8[_0x2b77('0x39')],_0x210fa8[_0x2b77('0x3a')]);_0x2ad614[_0x2b77('0x3e')]=_[_0x2b77('0x3d')](_0x210fa8[_0x2b77('0x39')],qs[_0x2b77('0x3f')](_0x386151[_0x2b77('0x3a')][_0x2b77('0x3f')]));_0x2ad614['attributes']=_0x2ad614[_0x2b77('0x3e')][_0x2b77('0x40')]?_0x2ad614[_0x2b77('0x3e')]:_0x210fa8[_0x2b77('0x39')];if(_0x386151[_0x2b77('0x3a')]['includeAll']){_0x2ad614[_0x2b77('0x4c')]=[{'all':!![]}];}_0x2ad614=_[_0x2b77('0x48')]({},_0x2ad614,_0x386151[_0x2b77('0x4a')]);return db[_0x2b77('0x35')][_0x2b77('0x52')](_0x2ad614)[_0x2b77('0x2e')](handleEntityNotFound(_0x5c58d8,null))[_0x2b77('0x2e')](respondWithResult(_0x5c58d8,null))[_0x2b77('0x4e')](handleError(_0x5c58d8,null));};exports[_0x2b77('0x53')]=function(_0x30c6ef,_0x3fb89d){return db[_0x2b77('0x35')][_0x2b77('0x53')](_0x30c6ef[_0x2b77('0x54')],{})[_0x2b77('0x2e')](respondWithResult(_0x3fb89d,0xc9))[_0x2b77('0x4e')](handleError(_0x3fb89d,null));};exports[_0x2b77('0x2c')]=function(_0x271301,_0x1539d1){if(_0x271301[_0x2b77('0x54')]['id']){delete _0x271301[_0x2b77('0x54')]['id'];}return db[_0x2b77('0x35')]['find']({'where':{'id':_0x271301[_0x2b77('0x50')]['id']}})['then'](handleEntityNotFound(_0x1539d1,null))[_0x2b77('0x2e')](saveUpdates(_0x271301[_0x2b77('0x54')],null))[_0x2b77('0x2e')](respondWithResult(_0x1539d1,null))['catch'](handleError(_0x1539d1,null));};exports['destroy']=function(_0x45d645,_0xff0248){return db['VoiceQueueReport'][_0x2b77('0x52')]({'where':{'id':_0x45d645[_0x2b77('0x50')]['id']}})[_0x2b77('0x2e')](handleEntityNotFound(_0xff0248,null))[_0x2b77('0x2e')](removeEntity(_0xff0248,null))[_0x2b77('0x4e')](handleError(_0xff0248,null));};exports[_0x2b77('0x55')]=function(_0x3caae0,_0x5a471e){return db[_0x2b77('0x35')][_0x2b77('0x55')]()[_0x2b77('0x2e')](respondWithResult(_0x5a471e,null))[_0x2b77('0x4e')](handleError(_0x5a471e,null));};exports[_0x2b77('0x56')]=function(_0x1818d9,_0x297734){var _0x5120f1={},_0x2d2a66={},_0x914b3d={'count':0x0,'rows':[]};_0x2d2a66[_0x2b77('0x39')]=_[_0x2b77('0x3b')](db[_0x2b77('0x35')]['rawAttributes']);_0x2d2a66['query']=_[_0x2b77('0x3b')](_0x1818d9[_0x2b77('0x3a')]);_0x2d2a66[_0x2b77('0x3c')]=_[_0x2b77('0x3d')](_0x2d2a66['model'],_0x2d2a66[_0x2b77('0x3a')]);_0x5120f1[_0x2b77('0x3e')]=_[_0x2b77('0x3d')](_0x2d2a66[_0x2b77('0x39')],qs[_0x2b77('0x3f')](_0x1818d9[_0x2b77('0x3a')][_0x2b77('0x3f')]));_0x5120f1[_0x2b77('0x3e')]=_0x5120f1[_0x2b77('0x3e')][_0x2b77('0x40')]?_0x5120f1[_0x2b77('0x3e')]:_0x2d2a66[_0x2b77('0x39')];if(!_0x1818d9[_0x2b77('0x3a')][_0x2b77('0x41')]('nolimit')){_0x5120f1[_0x2b77('0x27')]=qs['limit'](_0x1818d9[_0x2b77('0x3a')][_0x2b77('0x27')]);_0x5120f1['offset']=qs[_0x2b77('0x24')](_0x1818d9[_0x2b77('0x3a')]['offset']);}_0x5120f1['order']=qs['sort'](_0x1818d9[_0x2b77('0x3a')]['sort']);_0x5120f1['where']=qs['filters'](_[_0x2b77('0x46')](_0x1818d9[_0x2b77('0x3a')],_0x2d2a66[_0x2b77('0x3c')]));if(_0x1818d9[_0x2b77('0x3a')][_0x2b77('0x47')]){_0x5120f1[_0x2b77('0x45')]=_['merge'](_0x5120f1[_0x2b77('0x45')],{'$or':_[_0x2b77('0x34')](_0x5120f1['attributes'],function(_0x251e44){var _0x29c159={};_0x29c159[_0x251e44]={'$like':'%'+_0x1818d9[_0x2b77('0x3a')][_0x2b77('0x47')]+'%'};return _0x29c159;})});}_0x5120f1=_[_0x2b77('0x48')]({},_0x5120f1,_0x1818d9[_0x2b77('0x4a')]);var _0xf2c6be={'where':_0x5120f1[_0x2b77('0x45')]};return db[_0x2b77('0x35')][_0x2b77('0x26')](_0xf2c6be)['then'](function(_0x1466d2){_0x914b3d['count']=_0x1466d2;if(_0x1818d9[_0x2b77('0x3a')][_0x2b77('0x4b')]){_0x5120f1['include']=[{'all':!![]}];}return db[_0x2b77('0x35')][_0x2b77('0x57')](_0x5120f1);})[_0x2b77('0x2e')](function(_0x1eca55){_0x914b3d[_0x2b77('0x4d')]=_0x1eca55;return _0x914b3d;})[_0x2b77('0x2e')](respondWithFilteredResult(_0x297734,_0x5120f1,_0x2b77('0x56')))[_0x2b77('0x4e')](handleError(_0x297734,null,_0x2b77('0x56')));}; \ No newline at end of file +var _0x8966=['filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getVoiceQueuesReport','rawAttributes','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','end','json','offset','limit','count','status','set','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','VoiceQueueReport','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','order','sort','where'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0x8966,0x1a9));var _0x6896=function(_0x2ee1bb,_0x29b818){_0x2ee1bb=_0x2ee1bb-0x0;var _0xf2af2=_0x8966[_0x2ee1bb];return _0xf2af2;};'use strict';var emlformat=require(_0x6896('0x0'));var rimraf=require(_0x6896('0x1'));var zipdir=require(_0x6896('0x2'));var jsonpatch=require(_0x6896('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6896('0x4'));var util=require(_0x6896('0x5'));var path=require(_0x6896('0x6'));var sox=require(_0x6896('0x7'));var csv=require(_0x6896('0x8'));var ejs=require(_0x6896('0x9'));var fs=require('fs');var fs_extra=require(_0x6896('0xa'));var _=require('lodash');var squel=require(_0x6896('0xb'));var crypto=require('crypto');var jsforce=require(_0x6896('0xc'));var deskjs=require(_0x6896('0xd'));var toCsv=require(_0x6896('0x8'));var querystring=require(_0x6896('0xe'));var Papa=require(_0x6896('0xf'));var Redis=require(_0x6896('0x10'));var authService=require(_0x6896('0x11'));var qs=require(_0x6896('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6896('0x13'));var logger=require('../../config/logger')(_0x6896('0x14'));var utils=require(_0x6896('0x15'));var config=require(_0x6896('0x16'));var licenseUtil=require(_0x6896('0x17'));var db=require('../../mysqldb')['db'];config[_0x6896('0x18')]=_['defaults'](config[_0x6896('0x18')],{'host':_0x6896('0x19'),'port':0x18eb});var socket=require(_0x6896('0x1a'))(new Redis(config[_0x6896('0x18')]));require(_0x6896('0x1b'))[_0x6896('0x1c')](socket);function respondWithStatusCode(_0xaaeaeb,_0x20f312){_0x20f312=_0x20f312||0xcc;return function(_0x2355d6){if(_0x2355d6){return _0xaaeaeb['sendStatus'](_0x20f312);}return _0xaaeaeb['status'](_0x20f312)[_0x6896('0x1d')]();};}function respondWithResult(_0x4e4348,_0x16ab68){_0x16ab68=_0x16ab68||0xc8;return function(_0x26e0d9){if(_0x26e0d9){return _0x4e4348['status'](_0x16ab68)[_0x6896('0x1e')](_0x26e0d9);}};}function respondWithFilteredResult(_0x44e645,_0x5bc636){return function(_0x38546f){if(_0x38546f){var _0x1594c8=typeof _0x5bc636[_0x6896('0x1f')]==='undefined'&&typeof _0x5bc636[_0x6896('0x20')]==='undefined';var _0x577e22=_0x38546f[_0x6896('0x21')];var _0x8f38ae=_0x1594c8?0x0:_0x5bc636[_0x6896('0x1f')];var _0x5c7428=_0x1594c8?_0x38546f[_0x6896('0x21')]:_0x5bc636['offset']+_0x5bc636[_0x6896('0x20')];var _0x36be73;if(_0x5c7428>=_0x577e22){_0x5c7428=_0x577e22;_0x36be73=0xc8;}else{_0x36be73=0xce;}_0x44e645[_0x6896('0x22')](_0x36be73);return _0x44e645[_0x6896('0x23')]('Content-Range',_0x8f38ae+'-'+_0x5c7428+'/'+_0x577e22)['json'](_0x38546f);}return null;};}function patchUpdates(_0x5c28da){return function(_0x53d8d5){try{jsonpatch[_0x6896('0x24')](_0x53d8d5,_0x5c28da,!![]);}catch(_0x226e94){return BPromise[_0x6896('0x25')](_0x226e94);}return _0x53d8d5[_0x6896('0x26')]();};}function saveUpdates(_0x3014bd,_0x3f9053){return function(_0x49f604){if(_0x49f604){return _0x49f604[_0x6896('0x27')](_0x3014bd)[_0x6896('0x28')](function(_0x128aa8){return _0x128aa8;});}return null;};}function removeEntity(_0x1b3e74,_0x5da336){return function(_0x19bc1e){if(_0x19bc1e){return _0x19bc1e[_0x6896('0x29')]()[_0x6896('0x28')](function(){_0x1b3e74['status'](0xcc)[_0x6896('0x1d')]();});}};}function handleEntityNotFound(_0x8a8ebb,_0x14322c){return function(_0xfb12e7){if(!_0xfb12e7){_0x8a8ebb[_0x6896('0x2a')](0x194);}return _0xfb12e7;};}function handleError(_0x348758,_0xd514a4){_0xd514a4=_0xd514a4||0x1f4;return function(_0x117ce8){logger[_0x6896('0x2b')](_0x117ce8['stack']);if(_0x117ce8[_0x6896('0x2c')]){delete _0x117ce8['name'];}_0x348758['status'](_0xd514a4)[_0x6896('0x2d')](_0x117ce8);};}exports['index']=function(_0x368768,_0x1f3e6f){var _0x231eb3={},_0x2f4959={},_0xb5c10f={'count':0x0,'rows':[]};var _0x1df273=_[_0x6896('0x2e')](db[_0x6896('0x2f')]['rawAttributes'],function(_0x52bfd2){return{'name':_0x52bfd2[_0x6896('0x30')],'type':_0x52bfd2[_0x6896('0x31')][_0x6896('0x32')]};});_0x2f4959['model']=_[_0x6896('0x2e')](_0x1df273,_0x6896('0x2c'));_0x2f4959[_0x6896('0x33')]=_[_0x6896('0x34')](_0x368768[_0x6896('0x33')]);_0x2f4959['filters']=_[_0x6896('0x35')](_0x2f4959[_0x6896('0x36')],_0x2f4959[_0x6896('0x33')]);_0x231eb3[_0x6896('0x37')]=_[_0x6896('0x35')](_0x2f4959[_0x6896('0x36')],qs[_0x6896('0x38')](_0x368768['query'][_0x6896('0x38')]));_0x231eb3[_0x6896('0x37')]=_0x231eb3[_0x6896('0x37')][_0x6896('0x39')]?_0x231eb3[_0x6896('0x37')]:_0x2f4959[_0x6896('0x36')];if(!_0x368768[_0x6896('0x33')]['hasOwnProperty']('nolimit')){_0x231eb3[_0x6896('0x20')]=qs[_0x6896('0x20')](_0x368768[_0x6896('0x33')]['limit']);_0x231eb3[_0x6896('0x1f')]=qs[_0x6896('0x1f')](_0x368768['query'][_0x6896('0x1f')]);}_0x231eb3[_0x6896('0x3a')]=qs[_0x6896('0x3b')](_0x368768[_0x6896('0x33')][_0x6896('0x3b')]);_0x231eb3[_0x6896('0x3c')]=qs[_0x6896('0x3d')](_[_0x6896('0x3e')](_0x368768['query'],_0x2f4959[_0x6896('0x3d')]),_0x1df273);if(_0x368768[_0x6896('0x33')][_0x6896('0x3f')]){_0x231eb3[_0x6896('0x3c')]=_['merge'](_0x231eb3[_0x6896('0x3c')],{'$or':_[_0x6896('0x2e')](_0x1df273,function(_0x4c51eb){if(_0x4c51eb[_0x6896('0x31')]!==_0x6896('0x40')){var _0x5596a7={};_0x5596a7[_0x4c51eb['name']]={'$like':'%'+_0x368768['query'][_0x6896('0x3f')]+'%'};return _0x5596a7;}})});}_0x231eb3=_[_0x6896('0x41')]({},_0x231eb3,_0x368768[_0x6896('0x42')]);var _0x16238c={'where':_0x231eb3['where']};return db[_0x6896('0x2f')][_0x6896('0x21')](_0x16238c)[_0x6896('0x28')](function(_0x31c3f7){_0xb5c10f[_0x6896('0x21')]=_0x31c3f7;if(_0x368768[_0x6896('0x33')][_0x6896('0x43')]){_0x231eb3[_0x6896('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x6896('0x45')](_0x231eb3);})[_0x6896('0x28')](function(_0x33d1c9){_0xb5c10f[_0x6896('0x46')]=_0x33d1c9;return _0xb5c10f;})[_0x6896('0x28')](respondWithFilteredResult(_0x1f3e6f,_0x231eb3))[_0x6896('0x47')](handleError(_0x1f3e6f,null));};exports[_0x6896('0x48')]=function(_0x1b9031,_0x243ddd){var _0x55b44e={'raw':![],'where':{'id':_0x1b9031[_0x6896('0x49')]['id']}},_0x39008d={};_0x39008d[_0x6896('0x36')]=_[_0x6896('0x34')](db[_0x6896('0x2f')]['rawAttributes']);_0x39008d['query']=_[_0x6896('0x34')](_0x1b9031[_0x6896('0x33')]);_0x39008d['filters']=_[_0x6896('0x35')](_0x39008d[_0x6896('0x36')],_0x39008d[_0x6896('0x33')]);_0x55b44e[_0x6896('0x37')]=_['intersection'](_0x39008d[_0x6896('0x36')],qs['fields'](_0x1b9031['query'][_0x6896('0x38')]));_0x55b44e[_0x6896('0x37')]=_0x55b44e['attributes'][_0x6896('0x39')]?_0x55b44e[_0x6896('0x37')]:_0x39008d[_0x6896('0x36')];if(_0x1b9031[_0x6896('0x33')]['includeAll']){_0x55b44e[_0x6896('0x44')]=[{'all':!![]}];}_0x55b44e=_[_0x6896('0x41')]({},_0x55b44e,_0x1b9031[_0x6896('0x42')]);return db[_0x6896('0x2f')][_0x6896('0x4a')](_0x55b44e)['then'](handleEntityNotFound(_0x243ddd,null))[_0x6896('0x28')](respondWithResult(_0x243ddd,null))['catch'](handleError(_0x243ddd,null));};exports[_0x6896('0x4b')]=function(_0x4a78b8,_0x105f18){return db[_0x6896('0x2f')]['create'](_0x4a78b8[_0x6896('0x4c')],{})[_0x6896('0x28')](respondWithResult(_0x105f18,0xc9))[_0x6896('0x47')](handleError(_0x105f18,null));};exports[_0x6896('0x27')]=function(_0x585132,_0x3d3cfa){if(_0x585132[_0x6896('0x4c')]['id']){delete _0x585132[_0x6896('0x4c')]['id'];}return db['VoiceQueueReport'][_0x6896('0x4a')]({'where':{'id':_0x585132[_0x6896('0x49')]['id']}})['then'](handleEntityNotFound(_0x3d3cfa,null))[_0x6896('0x28')](saveUpdates(_0x585132[_0x6896('0x4c')],null))[_0x6896('0x28')](respondWithResult(_0x3d3cfa,null))['catch'](handleError(_0x3d3cfa,null));};exports['destroy']=function(_0xe8a712,_0x2a0180){return db[_0x6896('0x2f')][_0x6896('0x4a')]({'where':{'id':_0xe8a712[_0x6896('0x49')]['id']}})[_0x6896('0x28')](handleEntityNotFound(_0x2a0180,null))[_0x6896('0x28')](removeEntity(_0x2a0180,null))[_0x6896('0x47')](handleError(_0x2a0180,null));};exports[_0x6896('0x4d')]=function(_0x292d5b,_0x212735){return db['VoiceQueueReport'][_0x6896('0x4d')]()['then'](respondWithResult(_0x212735,null))[_0x6896('0x47')](handleError(_0x212735,null));};exports[_0x6896('0x4e')]=function(_0x3d266d,_0x2a9b6f){var _0x4f45a6={},_0x12f8f0={},_0x7d6341={'count':0x0,'rows':[]};_0x12f8f0['model']=_[_0x6896('0x34')](db[_0x6896('0x2f')][_0x6896('0x4f')]);_0x12f8f0[_0x6896('0x33')]=_['keys'](_0x3d266d[_0x6896('0x33')]);_0x12f8f0[_0x6896('0x3d')]=_[_0x6896('0x35')](_0x12f8f0[_0x6896('0x36')],_0x12f8f0['query']);_0x4f45a6['attributes']=_[_0x6896('0x35')](_0x12f8f0[_0x6896('0x36')],qs['fields'](_0x3d266d[_0x6896('0x33')]['fields']));_0x4f45a6[_0x6896('0x37')]=_0x4f45a6[_0x6896('0x37')][_0x6896('0x39')]?_0x4f45a6[_0x6896('0x37')]:_0x12f8f0[_0x6896('0x36')];if(!_0x3d266d[_0x6896('0x33')]['hasOwnProperty'](_0x6896('0x50'))){_0x4f45a6[_0x6896('0x20')]=qs[_0x6896('0x20')](_0x3d266d[_0x6896('0x33')][_0x6896('0x20')]);_0x4f45a6['offset']=qs[_0x6896('0x1f')](_0x3d266d[_0x6896('0x33')][_0x6896('0x1f')]);}_0x4f45a6['order']=qs[_0x6896('0x3b')](_0x3d266d[_0x6896('0x33')][_0x6896('0x3b')]);_0x4f45a6[_0x6896('0x3c')]=qs[_0x6896('0x3d')](_[_0x6896('0x3e')](_0x3d266d[_0x6896('0x33')],_0x12f8f0[_0x6896('0x3d')]));if(_0x3d266d['query'][_0x6896('0x3f')]){_0x4f45a6['where']=_[_0x6896('0x41')](_0x4f45a6[_0x6896('0x3c')],{'$or':_[_0x6896('0x2e')](_0x4f45a6[_0x6896('0x37')],function(_0x1d4892){var _0x2cf226={};_0x2cf226[_0x1d4892]={'$like':'%'+_0x3d266d[_0x6896('0x33')][_0x6896('0x3f')]+'%'};return _0x2cf226;})});}_0x4f45a6=_[_0x6896('0x41')]({},_0x4f45a6,_0x3d266d[_0x6896('0x42')]);var _0x12e5a8={'where':_0x4f45a6['where']};return db[_0x6896('0x2f')][_0x6896('0x21')](_0x12e5a8)[_0x6896('0x28')](function(_0x1daf06){_0x7d6341[_0x6896('0x21')]=_0x1daf06;if(_0x3d266d[_0x6896('0x33')][_0x6896('0x43')]){_0x4f45a6['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x6896('0x45')](_0x4f45a6);})[_0x6896('0x28')](function(_0x2eab11){_0x7d6341[_0x6896('0x46')]=_0x2eab11;return _0x7d6341;})[_0x6896('0x28')](respondWithFilteredResult(_0x2a9b6f,_0x4f45a6,_0x6896('0x4e')))[_0x6896('0x47')](handleError(_0x2a9b6f,null,_0x6896('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 3e268b6..cef0041 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 _0x23da=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x23da,0x1cd));var _0xa23d=function(_0x129e06,_0x1cc2b1){_0x129e06=_0x129e06-0x0;var _0x224fff=_0x23da[_0x129e06];return _0x224fff;};'use strict';var EventEmitter=require(_0xa23d('0x0'));var VoiceQueueReport=require(_0xa23d('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xa23d('0x2')](0x0);var events={'afterCreate':_0xa23d('0x3'),'afterUpdate':'update','afterDestroy':_0xa23d('0x4')};function emitEvent(_0x314d74){return function(_0x3388e1,_0x2c3d60,_0x2a60c5){VoiceQueueReportEvents[_0xa23d('0x5')](_0x314d74+':'+_0x3388e1['id'],_0x3388e1);VoiceQueueReportEvents['emit'](_0x314d74,_0x3388e1);_0x2a60c5(null);};}for(var e in events){if(events[_0xa23d('0x6')](e)){var event=events[e];VoiceQueueReport[_0xa23d('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x2714=['../../mysqldb','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x1598ed,_0x457eb8){var _0x22341f=function(_0x134297){while(--_0x134297){_0x1598ed['push'](_0x1598ed['shift']());}};_0x22341f(++_0x457eb8);}(_0x2714,0x92));var _0x4271=function(_0x5a6a90,_0x2ca2a0){_0x5a6a90=_0x5a6a90-0x0;var _0x434a61=_0x2714[_0x5a6a90];return _0x434a61;};'use strict';var EventEmitter=require(_0x4271('0x0'));var VoiceQueueReport=require(_0x4271('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4271('0x2'),'afterDestroy':_0x4271('0x3')};function emitEvent(_0x459912){return function(_0x38acb3,_0x34c7f4,_0xa55ca1){VoiceQueueReportEvents['emit'](_0x459912+':'+_0x38acb3['id'],_0x38acb3);VoiceQueueReportEvents[_0x4271('0x4')](_0x459912,_0x38acb3);_0xa55ca1(null);};}for(var e in events){if(events[_0x4271('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x4271('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index b566165..7a67c04 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 _0xbd2e=['report_queue','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbd2e,0x198));var _0xebd2=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xbd2e[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xebd2('0x0'));var util=require(_0xebd2('0x1'));var logger=require('../../config/logger')(_0xebd2('0x2'));var moment=require(_0xebd2('0x3'));var BPromise=require(_0xebd2('0x4'));var rp=require(_0xebd2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xebd2('0x6'));var config=require(_0xebd2('0x7'));var attributes=require(_0xebd2('0x8'));module[_0xebd2('0x9')]=function(_0x6507a,_0xad7e35){return _0x6507a[_0xebd2('0xa')](_0xebd2('0xb'),attributes,{'tableName':_0xebd2('0xc'),'paranoid':![],'indexes':[{'fields':[_0xebd2('0xd')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xca9b=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','calleridnum','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca9b,0x1bc));var _0xbca9=function(_0x3569b1,_0x37d03a){_0x3569b1=_0x3569b1-0x0;var _0x2de64c=_0xca9b[_0x3569b1];return _0x2de64c;};'use strict';var _=require(_0xbca9('0x0'));var util=require(_0xbca9('0x1'));var logger=require(_0xbca9('0x2'))(_0xbca9('0x3'));var moment=require(_0xbca9('0x4'));var BPromise=require(_0xbca9('0x5'));var rp=require(_0xbca9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbca9('0x7'));var config=require(_0xbca9('0x8'));var attributes=require(_0xbca9('0x9'));module['exports']=function(_0x1c2324,_0x53daf2){return _0x1c2324[_0xbca9('0xa')](_0xbca9('0xb'),attributes,{'tableName':_0xbca9('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xbca9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index f078855..4a4e514 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 _0x4b81=['attributes','limit','map','include','model','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','body','stringify','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','findAll','options','raw','where'];(function(_0x16af92,_0x24426d){var _0x48fb0b=function(_0x4e843b){while(--_0x4e843b){_0x16af92['push'](_0x16af92['shift']());}};_0x48fb0b(++_0x24426d);}(_0x4b81,0x16a));var _0x14b8=function(_0x181ee0,_0x5438ae){_0x181ee0=_0x181ee0-0x0;var _0x31480f=_0x4b81[_0x181ee0];return _0x31480f;};'use strict';var _=require('lodash');var util=require(_0x14b8('0x0'));var moment=require(_0x14b8('0x1'));var BPromise=require(_0x14b8('0x2'));var rs=require(_0x14b8('0x3'));var fs=require('fs');var Redis=require(_0x14b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x14b8('0x5'));var logger=require(_0x14b8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x14b8('0x7'));var client=jayson[_0x14b8('0x8')][_0x14b8('0x9')]({'port':0x232a});config[_0x14b8('0xa')]=_[_0x14b8('0xb')](config[_0x14b8('0xa')],{'host':_0x14b8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x14b8('0xa')]));require(_0x14b8('0xd'))['register'](socket);function respondWithRpcPromise(_0x297098,_0x274139,_0xc86af9){return new BPromise(function(_0x11fb24,_0x34a8c8){return client['request'](_0x297098,_0xc86af9)[_0x14b8('0xe')](function(_0xd9d6d6){logger['info'](_0x14b8('0xf'),_0x274139,_0x14b8('0x10'));logger[_0x14b8('0x11')](_0x14b8('0x12'),_0x274139,_0x14b8('0x10'),JSON['stringify'](_0xd9d6d6));if(_0xd9d6d6[_0x14b8('0x13')]){if(_0xd9d6d6[_0x14b8('0x13')][_0x14b8('0x14')]===0x1f4){logger[_0x14b8('0x13')](_0x14b8('0xf'),_0x274139,_0xd9d6d6[_0x14b8('0x13')][_0x14b8('0x15')]);return _0x34a8c8(_0xd9d6d6[_0x14b8('0x13')][_0x14b8('0x15')]);}logger[_0x14b8('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x274139,_0xd9d6d6[_0x14b8('0x13')][_0x14b8('0x15')]);return _0x11fb24(_0xd9d6d6[_0x14b8('0x13')][_0x14b8('0x15')]);}else{logger[_0x14b8('0x16')](_0x14b8('0xf'),_0x274139,_0x14b8('0x10'));_0x11fb24(_0xd9d6d6['result'][_0x14b8('0x15')]);}})[_0x14b8('0x17')](function(_0x5c81b0){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x274139,_0x5c81b0);_0x34a8c8(_0x5c81b0);});});}exports['GetVoiceQueueReport']=function(_0x43516c){var _0x423cc4=this;return new Promise(function(_0x3b9dc5,_0xc64a2c){return db['VoiceQueueReport'][_0x14b8('0x18')]({'raw':_0x43516c[_0x14b8('0x19')]?_0x43516c[_0x14b8('0x19')][_0x14b8('0x1a')]===undefined?!![]:![]:!![],'where':_0x43516c[_0x14b8('0x19')]?_0x43516c[_0x14b8('0x19')][_0x14b8('0x1b')]||null:null,'attributes':_0x43516c['options']?_0x43516c[_0x14b8('0x19')][_0x14b8('0x1c')]||null:null,'limit':_0x43516c[_0x14b8('0x19')]?_0x43516c[_0x14b8('0x19')][_0x14b8('0x1d')]||null:null,'include':_0x43516c[_0x14b8('0x19')]?_0x43516c[_0x14b8('0x19')]['include']?_[_0x14b8('0x1e')](_0x43516c[_0x14b8('0x19')][_0x14b8('0x1f')],function(_0x514fed){return{'model':db[_0x514fed[_0x14b8('0x20')]],'as':_0x514fed['as'],'attributes':_0x514fed[_0x14b8('0x1c')],'include':_0x514fed[_0x14b8('0x1f')]?_[_0x14b8('0x1e')](_0x514fed['include'],function(_0x5a140b){return{'model':db[_0x5a140b[_0x14b8('0x20')]],'as':_0x5a140b['as'],'attributes':_0x5a140b[_0x14b8('0x1c')],'include':_0x5a140b['include']?_[_0x14b8('0x1e')](_0x5a140b[_0x14b8('0x1f')],function(_0x1227cb){return{'model':db[_0x1227cb[_0x14b8('0x20')]],'as':_0x1227cb['as'],'attributes':_0x1227cb[_0x14b8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x14b8('0xe')](function(_0x4bd9de){logger[_0x14b8('0x16')](_0x14b8('0x21'),_0x43516c);logger[_0x14b8('0x11')](_0x14b8('0x21'),_0x43516c,JSON['stringify'](_0x4bd9de));_0x3b9dc5(_0x4bd9de);})['catch'](function(_0x4cef54){logger['error'](_0x14b8('0x21'),_0x4cef54['message'],_0x43516c);_0xc64a2c(_0x423cc4[_0x14b8('0x13')](0x1f4,_0x4cef54[_0x14b8('0x15')]));});});};exports[_0x14b8('0x22')]=function(_0x183a22){var _0x39d153=this;return new Promise(function(_0x36502d,_0x2f5957){return db[_0x14b8('0x23')]['create'](_0x183a22[_0x14b8('0x24')],{'raw':_0x183a22['options']?_0x183a22[_0x14b8('0x19')][_0x14b8('0x1a')]===undefined?!![]:![]:!![]})[_0x14b8('0xe')](function(_0x233e1c){logger['info'](_0x14b8('0x22'),_0x183a22);logger['debug'](_0x14b8('0x22'),_0x183a22,JSON[_0x14b8('0x25')](_0x233e1c));_0x36502d(_0x233e1c);})['catch'](function(_0x2b4e5d){logger[_0x14b8('0x13')](_0x14b8('0x22'),_0x2b4e5d[_0x14b8('0x15')],_0x183a22);_0x2f5957(_0x39d153['error'](0x1f4,_0x2b4e5d[_0x14b8('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0xe373bc){var _0x2901a7=this;return new Promise(function(_0x4c97a4,_0x44f624){return db[_0x14b8('0x23')]['update'](_0xe373bc[_0x14b8('0x24')],{'raw':_0xe373bc['options']?_0xe373bc[_0x14b8('0x19')][_0x14b8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe373bc[_0x14b8('0x19')]?_0xe373bc[_0x14b8('0x19')]['where']||null:null,'attributes':_0xe373bc['options']?_0xe373bc[_0x14b8('0x19')][_0x14b8('0x1c')]||null:null,'limit':_0xe373bc[_0x14b8('0x19')]?_0xe373bc[_0x14b8('0x19')]['limit']||null:null})[_0x14b8('0xe')](function(_0x1a8a5a){logger[_0x14b8('0x16')](_0x14b8('0x26'),_0xe373bc);logger['debug']('UpdateVoiceQueueReport',_0xe373bc,JSON[_0x14b8('0x25')](_0x1a8a5a));_0x4c97a4(_0x1a8a5a);})[_0x14b8('0x17')](function(_0x3792ad){logger[_0x14b8('0x13')](_0x14b8('0x26'),_0x3792ad['message'],_0xe373bc);_0x44f624(_0x2901a7[_0x14b8('0x13')](0x1f4,_0x3792ad[_0x14b8('0x15')]));});});}; \ No newline at end of file +var _0x0803=['stringify','error','message','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','VoiceQueueReport','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x0803,0x1f3));var _0x3080=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0803[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3080('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3080('0x1'));var fs=require('fs');var Redis=require(_0x3080('0x2'));var db=require(_0x3080('0x3'))['db'];var utils=require(_0x3080('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3080('0x5'));var jayson=require(_0x3080('0x6'));var client=jayson['client'][_0x3080('0x7')]({'port':0x232a});config[_0x3080('0x8')]=_[_0x3080('0x9')](config[_0x3080('0x8')],{'host':_0x3080('0xa'),'port':0x18eb});var socket=require(_0x3080('0xb'))(new Redis(config['redis']));require(_0x3080('0xc'))[_0x3080('0xd')](socket);function respondWithRpcPromise(_0x4a64ae,_0x4458a2,_0x14077a){return new BPromise(function(_0x442558,_0x15613e){return client[_0x3080('0xe')](_0x4a64ae,_0x14077a)[_0x3080('0xf')](function(_0x322910){logger[_0x3080('0x10')](_0x3080('0x11'),_0x4458a2,_0x3080('0x12'));logger[_0x3080('0x13')](_0x3080('0x14'),_0x4458a2,_0x3080('0x12'),JSON[_0x3080('0x15')](_0x322910));if(_0x322910[_0x3080('0x16')]){if(_0x322910[_0x3080('0x16')]['code']===0x1f4){logger[_0x3080('0x16')](_0x3080('0x11'),_0x4458a2,_0x322910[_0x3080('0x16')][_0x3080('0x17')]);return _0x15613e(_0x322910['error']['message']);}logger[_0x3080('0x16')](_0x3080('0x11'),_0x4458a2,_0x322910['error']['message']);return _0x442558(_0x322910[_0x3080('0x16')][_0x3080('0x17')]);}else{logger[_0x3080('0x10')](_0x3080('0x11'),_0x4458a2,_0x3080('0x12'));_0x442558(_0x322910[_0x3080('0x18')][_0x3080('0x17')]);}})[_0x3080('0x19')](function(_0x55f422){logger[_0x3080('0x16')](_0x3080('0x11'),_0x4458a2,_0x55f422);_0x15613e(_0x55f422);});});}exports[_0x3080('0x1a')]=function(_0x54953c){var _0x3f6e2c=this;return new Promise(function(_0x2574da,_0x3d8de5){return db['VoiceQueueReport'][_0x3080('0x1b')]({'raw':_0x54953c[_0x3080('0x1c')]?_0x54953c[_0x3080('0x1c')][_0x3080('0x1d')]===undefined?!![]:![]:!![],'where':_0x54953c[_0x3080('0x1c')]?_0x54953c[_0x3080('0x1c')][_0x3080('0x1e')]||null:null,'attributes':_0x54953c[_0x3080('0x1c')]?_0x54953c['options'][_0x3080('0x1f')]||null:null,'limit':_0x54953c['options']?_0x54953c[_0x3080('0x1c')][_0x3080('0x20')]||null:null,'include':_0x54953c[_0x3080('0x1c')]?_0x54953c[_0x3080('0x1c')][_0x3080('0x21')]?_[_0x3080('0x22')](_0x54953c[_0x3080('0x1c')][_0x3080('0x21')],function(_0x3940f9){return{'model':db[_0x3940f9[_0x3080('0x23')]],'as':_0x3940f9['as'],'attributes':_0x3940f9[_0x3080('0x1f')],'include':_0x3940f9[_0x3080('0x21')]?_[_0x3080('0x22')](_0x3940f9[_0x3080('0x21')],function(_0x32f095){return{'model':db[_0x32f095[_0x3080('0x23')]],'as':_0x32f095['as'],'attributes':_0x32f095[_0x3080('0x1f')],'include':_0x32f095['include']?_['map'](_0x32f095[_0x3080('0x21')],function(_0x412c9d){return{'model':db[_0x412c9d[_0x3080('0x23')]],'as':_0x412c9d['as'],'attributes':_0x412c9d[_0x3080('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3080('0xf')](function(_0x2a4799){logger[_0x3080('0x10')]('GetVoiceQueueReport',_0x54953c);logger[_0x3080('0x13')](_0x3080('0x1a'),_0x54953c,JSON[_0x3080('0x15')](_0x2a4799));_0x2574da(_0x2a4799);})[_0x3080('0x19')](function(_0x505c0b){logger[_0x3080('0x16')]('GetVoiceQueueReport',_0x505c0b[_0x3080('0x17')],_0x54953c);_0x3d8de5(_0x3f6e2c[_0x3080('0x16')](0x1f4,_0x505c0b[_0x3080('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0x2426ff){var _0x20a748=this;return new Promise(function(_0x1cfd2c,_0x410a4b){return db[_0x3080('0x24')]['create'](_0x2426ff[_0x3080('0x25')],{'raw':_0x2426ff['options']?_0x2426ff[_0x3080('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x3080('0xf')](function(_0x105ba9){logger[_0x3080('0x10')](_0x3080('0x26'),_0x2426ff);logger[_0x3080('0x13')](_0x3080('0x26'),_0x2426ff,JSON['stringify'](_0x105ba9));_0x1cfd2c(_0x105ba9);})[_0x3080('0x19')](function(_0x4c09b1){logger[_0x3080('0x16')](_0x3080('0x26'),_0x4c09b1[_0x3080('0x17')],_0x2426ff);_0x410a4b(_0x20a748[_0x3080('0x16')](0x1f4,_0x4c09b1['message']));});});};exports[_0x3080('0x27')]=function(_0x139a51){var _0x278c77=this;return new Promise(function(_0x4cf04d,_0x29eb6b){return db['VoiceQueueReport']['update'](_0x139a51['body'],{'raw':_0x139a51['options']?_0x139a51[_0x3080('0x1c')][_0x3080('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x139a51[_0x3080('0x1c')]?_0x139a51['options'][_0x3080('0x1e')]||null:null,'attributes':_0x139a51['options']?_0x139a51[_0x3080('0x1c')][_0x3080('0x1f')]||null:null,'limit':_0x139a51[_0x3080('0x1c')]?_0x139a51[_0x3080('0x1c')][_0x3080('0x20')]||null:null})[_0x3080('0xf')](function(_0x4a6547){logger['info'](_0x3080('0x27'),_0x139a51);logger[_0x3080('0x13')]('UpdateVoiceQueueReport',_0x139a51,JSON[_0x3080('0x15')](_0x4a6547));_0x4cf04d(_0x4a6547);})[_0x3080('0x19')](function(_0x40b826){logger[_0x3080('0x16')]('UpdateVoiceQueueReport',_0x40b826[_0x3080('0x17')],_0x139a51);_0x29eb6b(_0x278c77[_0x3080('0x16')](0x1f4,_0x40b826['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ec3c6cd..e748710 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 _0x2a3a=['save','remove','update','emit','removeListener','register','length','./voiceQueueReport.events'];(function(_0x3eb593,_0x5496c1){var _0x29d2e0=function(_0x1cd6d6){while(--_0x1cd6d6){_0x3eb593['push'](_0x3eb593['shift']());}};_0x29d2e0(++_0x5496c1);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x25db28,_0x305a11){_0x25db28=_0x25db28-0x0;var _0x16c0b3=_0x2a3a[_0x25db28];return _0x16c0b3;};'use strict';var VoiceQueueReportEvents=require(_0xa2a3('0x0'));var events=[_0xa2a3('0x1'),_0xa2a3('0x2'),_0xa2a3('0x3')];function createListener(_0x45ba85,_0x4caf0f){return function(_0x531167){_0x4caf0f[_0xa2a3('0x4')](_0x45ba85,_0x531167);};}function removeListener(_0x34d7f9,_0x1e61b2){return function(){VoiceQueueReportEvents[_0xa2a3('0x5')](_0x34d7f9,_0x1e61b2);};}exports[_0xa2a3('0x6')]=function(_0xf652d7){for(var _0x186655=0x0,_0x5e5e50=events[_0xa2a3('0x7')];_0x186655<_0x5e5e50;_0x186655++){var _0x196c96=events[_0x186655];var _0x2a3753=createListener('voiceQueueReport:'+_0x196c96,_0xf652d7);VoiceQueueReportEvents['on'](_0x196c96,_0x2a3753);}}; \ No newline at end of file +var _0xf5cd=['update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x1143e1,_0x21aab9){var _0x3b44ca=function(_0xec9598){while(--_0xec9598){_0x1143e1['push'](_0x1143e1['shift']());}};_0x3b44ca(++_0x21aab9);}(_0xf5cd,0x1bf));var _0xdf5c=function(_0x222fdd,_0x30f656){_0x222fdd=_0x222fdd-0x0;var _0x4d012e=_0xf5cd[_0x222fdd];return _0x4d012e;};'use strict';var VoiceQueueReportEvents=require(_0xdf5c('0x0'));var events=[_0xdf5c('0x1'),_0xdf5c('0x2'),_0xdf5c('0x3')];function createListener(_0x24a764,_0x451a36){return function(_0x516def){_0x451a36[_0xdf5c('0x4')](_0x24a764,_0x516def);};}function removeListener(_0x5a9de3,_0x417206){return function(){VoiceQueueReportEvents[_0xdf5c('0x5')](_0x5a9de3,_0x417206);};}exports[_0xdf5c('0x6')]=function(_0x1dc4a7){for(var _0x3c994f=0x0,_0x986cf1=events[_0xdf5c('0x7')];_0x3c994f<_0x986cf1;_0x3c994f++){var _0x14337a=events[_0x3c994f];var _0x1d766a=createListener(_0xdf5c('0x8')+_0x14337a,_0x1dc4a7);VoiceQueueReportEvents['on'](_0x14337a,_0x1d766a);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 9e9b06a..b3af7e2 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 _0x6898=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x27ca78,_0x3b5796){var _0x528091=function(_0x3e4dd6){while(--_0x3e4dd6){_0x27ca78['push'](_0x27ca78['shift']());}};_0x528091(++_0x3b5796);}(_0x6898,0x11b));var _0x8689=function(_0xa54e9f,_0x5a2fcf){_0xa54e9f=_0xa54e9f-0x0;var _0x15b438=_0x6898[_0xa54e9f];return _0x15b438;};'use strict';var multer=require(_0x8689('0x0'));var util=require('util');var path=require(_0x8689('0x1'));var timeout=require(_0x8689('0x2'));var express=require(_0x8689('0x3'));var router=express[_0x8689('0x4')]();var fs_extra=require(_0x8689('0x5'));var auth=require(_0x8689('0x6'));var interaction=require(_0x8689('0x7'));var config=require('../../config/environment');var controller=require(_0x8689('0x8'));router[_0x8689('0x9')]('/',auth[_0x8689('0xa')](),controller['index']);router[_0x8689('0x9')](_0x8689('0xb'),auth[_0x8689('0xa')](),controller[_0x8689('0xc')]);router[_0x8689('0xd')]('/',auth[_0x8689('0xa')](),controller['create']);router['put']('/:id',auth[_0x8689('0xa')](),controller['update']);router[_0x8689('0xe')](_0x8689('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8689('0xf')]=router; \ No newline at end of file +var _0x0079=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','update','exports','util','path','connect-timeout'];(function(_0x97c9f6,_0x17dff6){var _0x5c84e3=function(_0x4834a4){while(--_0x4834a4){_0x97c9f6['push'](_0x97c9f6['shift']());}};_0x5c84e3(++_0x17dff6);}(_0x0079,0x74));var _0x9007=function(_0x1f3e50,_0x589588){_0x1f3e50=_0x1f3e50-0x0;var _0x441f37=_0x0079[_0x1f3e50];return _0x441f37;};'use strict';var multer=require('multer');var util=require(_0x9007('0x0'));var path=require(_0x9007('0x1'));var timeout=require(_0x9007('0x2'));var express=require(_0x9007('0x3'));var router=express[_0x9007('0x4')]();var fs_extra=require(_0x9007('0x5'));var auth=require(_0x9007('0x6'));var interaction=require(_0x9007('0x7'));var config=require(_0x9007('0x8'));var controller=require(_0x9007('0x9'));router[_0x9007('0xa')]('/',auth[_0x9007('0xb')](),controller['index']);router['get'](_0x9007('0xc'),auth['isAuthenticated'](),controller[_0x9007('0xd')]);router[_0x9007('0xe')]('/',auth[_0x9007('0xb')](),controller['create']);router['put'](_0x9007('0xc'),auth[_0x9007('0xb')](),controller[_0x9007('0xf')]);router['delete'](_0x9007('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9007('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 4cb5f7e..bceba4a 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 _0x65b0=['sequelize','moment','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x2db3ce,_0x360607){var _0x4f45ec=function(_0x241bef){while(--_0x241bef){_0x2db3ce['push'](_0x2db3ce['shift']());}};_0x4f45ec(++_0x360607);}(_0x65b0,0x1b0));var _0x065b=function(_0x564b15,_0x32f1d9){_0x564b15=_0x564b15-0x0;var _0x3e0640=_0x65b0[_0x564b15];return _0x3e0640;};'use strict';var Sequelize=require(_0x065b('0x0'));var moment=require(_0x065b('0x1'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x065b('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x065b('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x065b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x065b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x065b('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x065b('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x065b('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x065b('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x065b('0x4')](_0x065b('0x5'))}}; \ No newline at end of file +var _0x9ae7=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment','STRING','literal'];(function(_0x373a39,_0x2f59f8){var _0x475747=function(_0x444e1b){while(--_0x444e1b){_0x373a39['push'](_0x373a39['shift']());}};_0x475747(++_0x2f59f8);}(_0x9ae7,0xb1));var _0x79ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ae7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x79ae('0x0'));module['exports']={'time':{'type':Sequelize[_0x79ae('0x1')]},'callid':{'type':Sequelize[_0x79ae('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x79ae('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x79ae('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x79ae('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x79ae('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x79ae('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x79ae('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x79ae('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x79ae('0x2')](_0x79ae('0x3'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 3815a23..4ddb3a6 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 _0x29ce=['filter','type','VIRTUAL','VoiceQueuesLog','includeAll','include','findAll','rows','show','params','rawAttributes','merge','options','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','limit','set','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x29ce,0xec));var _0xe29c=function(_0x351943,_0x1779f8){_0x351943=_0x351943-0x0;var _0x388d5b=_0x29ce[_0x351943];return _0x388d5b;};'use strict';var emlformat=require(_0xe29c('0x0'));var rimraf=require(_0xe29c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe29c('0x2'));var rp=require(_0xe29c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe29c('0x4'));var util=require(_0xe29c('0x5'));var path=require('path');var sox=require(_0xe29c('0x6'));var csv=require(_0xe29c('0x7'));var ejs=require(_0xe29c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe29c('0x9'));var squel=require(_0xe29c('0xa'));var crypto=require('crypto');var jsforce=require(_0xe29c('0xb'));var deskjs=require(_0xe29c('0xc'));var toCsv=require(_0xe29c('0x7'));var querystring=require(_0xe29c('0xd'));var Papa=require(_0xe29c('0xe'));var Redis=require('ioredis');var authService=require(_0xe29c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe29c('0x10'));var hardwareService=require(_0xe29c('0x11'));var logger=require(_0xe29c('0x12'))(_0xe29c('0x13'));var utils=require(_0xe29c('0x14'));var config=require(_0xe29c('0x15'));var licenseUtil=require(_0xe29c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b3c6c,_0x115c66){_0x115c66=_0x115c66||0xcc;return function(_0x21e2d8){if(_0x21e2d8){return _0x4b3c6c['sendStatus'](_0x115c66);}return _0x4b3c6c[_0xe29c('0x17')](_0x115c66)['end']();};}function respondWithResult(_0x44f803,_0x26db58){_0x26db58=_0x26db58||0xc8;return function(_0x58ef3b){if(_0x58ef3b){return _0x44f803[_0xe29c('0x17')](_0x26db58)[_0xe29c('0x18')](_0x58ef3b);}};}function respondWithFilteredResult(_0x64cc0a,_0x4eb1ac){return function(_0x42a61e){if(_0x42a61e){var _0x8d9cb7=typeof _0x4eb1ac[_0xe29c('0x19')]===_0xe29c('0x1a')&&typeof _0x4eb1ac['limit']===_0xe29c('0x1a');var _0x1e2ca1=_0x42a61e[_0xe29c('0x1b')];var _0x311636=_0x8d9cb7?0x0:_0x4eb1ac[_0xe29c('0x19')];var _0x29aecd=_0x8d9cb7?_0x42a61e[_0xe29c('0x1b')]:_0x4eb1ac['offset']+_0x4eb1ac[_0xe29c('0x1c')];var _0xe3feb9;if(_0x29aecd>=_0x1e2ca1){_0x29aecd=_0x1e2ca1;_0xe3feb9=0xc8;}else{_0xe3feb9=0xce;}_0x64cc0a[_0xe29c('0x17')](_0xe3feb9);return _0x64cc0a[_0xe29c('0x1d')]('Content-Range',_0x311636+'-'+_0x29aecd+'/'+_0x1e2ca1)[_0xe29c('0x18')](_0x42a61e);}return null;};}function patchUpdates(_0x5a1e66){return function(_0x4af07e){try{jsonpatch['apply'](_0x4af07e,_0x5a1e66,!![]);}catch(_0x49794f){return BPromise['reject'](_0x49794f);}return _0x4af07e[_0xe29c('0x1e')]();};}function saveUpdates(_0x1e980d,_0x5a350c){return function(_0x16465e){if(_0x16465e){return _0x16465e[_0xe29c('0x1f')](_0x1e980d)[_0xe29c('0x20')](function(_0x56e66b){return _0x56e66b;});}return null;};}function removeEntity(_0x50c3b1,_0x142ca8){return function(_0x2c05a7){if(_0x2c05a7){return _0x2c05a7[_0xe29c('0x21')]()[_0xe29c('0x20')](function(){_0x50c3b1[_0xe29c('0x17')](0xcc)[_0xe29c('0x22')]();});}};}function handleEntityNotFound(_0x3a7632,_0x4f4066){return function(_0x555d8b){if(!_0x555d8b){_0x3a7632[_0xe29c('0x23')](0x194);}return _0x555d8b;};}function handleError(_0xd79eae,_0x23d6ec){_0x23d6ec=_0x23d6ec||0x1f4;return function(_0x36dbe2){logger[_0xe29c('0x24')](_0x36dbe2[_0xe29c('0x25')]);if(_0x36dbe2[_0xe29c('0x26')]){delete _0x36dbe2[_0xe29c('0x26')];}_0xd79eae[_0xe29c('0x17')](_0x23d6ec)['send'](_0x36dbe2);};}exports[_0xe29c('0x27')]=function(_0x832e42,_0x4d3010){var _0x4ea72c={},_0x4ccff9={},_0xfc7aa0={'count':0x0,'rows':[]};var _0x583b00=_[_0xe29c('0x28')](db['VoiceQueuesLog']['rawAttributes'],function(_0x2f581b){return{'name':_0x2f581b[_0xe29c('0x29')],'type':_0x2f581b['type'][_0xe29c('0x2a')]};});_0x4ccff9[_0xe29c('0x2b')]=_[_0xe29c('0x28')](_0x583b00,_0xe29c('0x26'));_0x4ccff9[_0xe29c('0x2c')]=_[_0xe29c('0x2d')](_0x832e42[_0xe29c('0x2c')]);_0x4ccff9[_0xe29c('0x2e')]=_[_0xe29c('0x2f')](_0x4ccff9[_0xe29c('0x2b')],_0x4ccff9['query']);_0x4ea72c[_0xe29c('0x30')]=_[_0xe29c('0x2f')](_0x4ccff9[_0xe29c('0x2b')],qs[_0xe29c('0x31')](_0x832e42['query'][_0xe29c('0x31')]));_0x4ea72c[_0xe29c('0x30')]=_0x4ea72c['attributes'][_0xe29c('0x32')]?_0x4ea72c[_0xe29c('0x30')]:_0x4ccff9[_0xe29c('0x2b')];if(!_0x832e42['query'][_0xe29c('0x33')](_0xe29c('0x34'))){_0x4ea72c[_0xe29c('0x1c')]=qs[_0xe29c('0x1c')](_0x832e42[_0xe29c('0x2c')][_0xe29c('0x1c')]);_0x4ea72c[_0xe29c('0x19')]=qs['offset'](_0x832e42[_0xe29c('0x2c')][_0xe29c('0x19')]);}_0x4ea72c['order']=qs[_0xe29c('0x35')](_0x832e42[_0xe29c('0x2c')][_0xe29c('0x35')]);_0x4ea72c[_0xe29c('0x36')]=qs[_0xe29c('0x2e')](_[_0xe29c('0x37')](_0x832e42[_0xe29c('0x2c')],_0x4ccff9[_0xe29c('0x2e')]),_0x583b00);if(_0x832e42[_0xe29c('0x2c')][_0xe29c('0x38')]){_0x4ea72c[_0xe29c('0x36')]=_['merge'](_0x4ea72c[_0xe29c('0x36')],{'$or':_['map'](_0x583b00,function(_0x2889e0){if(_0x2889e0[_0xe29c('0x39')]!==_0xe29c('0x3a')){var _0x2cca06={};_0x2cca06[_0x2889e0[_0xe29c('0x26')]]={'$like':'%'+_0x832e42['query'][_0xe29c('0x38')]+'%'};return _0x2cca06;}})});}_0x4ea72c=_['merge']({},_0x4ea72c,_0x832e42['options']);var _0x5c4375={'where':_0x4ea72c[_0xe29c('0x36')]};return db[_0xe29c('0x3b')][_0xe29c('0x1b')](_0x5c4375)[_0xe29c('0x20')](function(_0xf936ea){_0xfc7aa0[_0xe29c('0x1b')]=_0xf936ea;if(_0x832e42[_0xe29c('0x2c')][_0xe29c('0x3c')]){_0x4ea72c[_0xe29c('0x3d')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xe29c('0x3e')](_0x4ea72c);})[_0xe29c('0x20')](function(_0x489a12){_0xfc7aa0[_0xe29c('0x3f')]=_0x489a12;return _0xfc7aa0;})[_0xe29c('0x20')](respondWithFilteredResult(_0x4d3010,_0x4ea72c))['catch'](handleError(_0x4d3010,null));};exports[_0xe29c('0x40')]=function(_0x3c8c01,_0x3f2494){var _0x4b06c4={'raw':!![],'where':{'id':_0x3c8c01[_0xe29c('0x41')]['id']}},_0x3e2c89={};_0x3e2c89[_0xe29c('0x2b')]=_[_0xe29c('0x2d')](db[_0xe29c('0x3b')][_0xe29c('0x42')]);_0x3e2c89['query']=_[_0xe29c('0x2d')](_0x3c8c01[_0xe29c('0x2c')]);_0x3e2c89['filters']=_[_0xe29c('0x2f')](_0x3e2c89[_0xe29c('0x2b')],_0x3e2c89[_0xe29c('0x2c')]);_0x4b06c4[_0xe29c('0x30')]=_['intersection'](_0x3e2c89[_0xe29c('0x2b')],qs['fields'](_0x3c8c01[_0xe29c('0x2c')][_0xe29c('0x31')]));_0x4b06c4[_0xe29c('0x30')]=_0x4b06c4['attributes'][_0xe29c('0x32')]?_0x4b06c4[_0xe29c('0x30')]:_0x3e2c89['model'];if(_0x3c8c01[_0xe29c('0x2c')][_0xe29c('0x3c')]){_0x4b06c4[_0xe29c('0x3d')]=[{'all':!![]}];}_0x4b06c4=_[_0xe29c('0x43')]({},_0x4b06c4,_0x3c8c01[_0xe29c('0x44')]);return db[_0xe29c('0x3b')][_0xe29c('0x45')](_0x4b06c4)[_0xe29c('0x20')](handleEntityNotFound(_0x3f2494,null))[_0xe29c('0x20')](respondWithResult(_0x3f2494,null))[_0xe29c('0x46')](handleError(_0x3f2494,null));};exports[_0xe29c('0x47')]=function(_0x1f777d,_0x510f51){return db[_0xe29c('0x3b')][_0xe29c('0x47')](_0x1f777d[_0xe29c('0x48')],{})[_0xe29c('0x20')](respondWithResult(_0x510f51,0xc9))[_0xe29c('0x46')](handleError(_0x510f51,null));};exports[_0xe29c('0x1f')]=function(_0x3a302e,_0x1b1ca3){if(_0x3a302e[_0xe29c('0x48')]['id']){delete _0x3a302e[_0xe29c('0x48')]['id'];}return db[_0xe29c('0x3b')][_0xe29c('0x45')]({'where':{'id':_0x3a302e['params']['id']}})['then'](handleEntityNotFound(_0x1b1ca3,null))[_0xe29c('0x20')](saveUpdates(_0x3a302e[_0xe29c('0x48')],null))['then'](respondWithResult(_0x1b1ca3,null))[_0xe29c('0x46')](handleError(_0x1b1ca3,null));};exports[_0xe29c('0x21')]=function(_0x353e4b,_0x23a93c){return db[_0xe29c('0x3b')][_0xe29c('0x45')]({'where':{'id':_0x353e4b[_0xe29c('0x41')]['id']}})[_0xe29c('0x20')](handleEntityNotFound(_0x23a93c,null))[_0xe29c('0x20')](removeEntity(_0x23a93c,null))[_0xe29c('0x46')](handleError(_0x23a93c,null));}; \ No newline at end of file +var _0x2ff0=['model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VoiceQueuesLog','include','findAll','rows','show','params','intersection','includeAll','options','body','catch','find','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x5b4e35,_0x157230){var _0x42e4e2=function(_0x315c73){while(--_0x315c73){_0x5b4e35['push'](_0x5b4e35['shift']());}};_0x42e4e2(++_0x157230);}(_0x2ff0,0xe6));var _0x02ff=function(_0x203a7f,_0x49e1fd){_0x203a7f=_0x203a7f-0x0;var _0x9d0dee=_0x2ff0[_0x203a7f];return _0x9d0dee;};'use strict';var emlformat=require(_0x02ff('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x02ff('0x1'));var rp=require('request-promise');var moment=require(_0x02ff('0x2'));var BPromise=require(_0x02ff('0x3'));var Mustache=require(_0x02ff('0x4'));var util=require(_0x02ff('0x5'));var path=require(_0x02ff('0x6'));var sox=require(_0x02ff('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x02ff('0x8'));var squel=require(_0x02ff('0x9'));var crypto=require(_0x02ff('0xa'));var jsforce=require(_0x02ff('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x02ff('0xc'));var Redis=require('ioredis');var authService=require(_0x02ff('0xd'));var qs=require(_0x02ff('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02ff('0xf'));var logger=require(_0x02ff('0x10'))(_0x02ff('0x11'));var utils=require('../../config/utils');var config=require(_0x02ff('0x12'));var licenseUtil=require(_0x02ff('0x13'));var db=require(_0x02ff('0x14'))['db'];function respondWithStatusCode(_0x4b3003,_0x30e7e3){_0x30e7e3=_0x30e7e3||0xcc;return function(_0x36980d){if(_0x36980d){return _0x4b3003[_0x02ff('0x15')](_0x30e7e3);}return _0x4b3003[_0x02ff('0x16')](_0x30e7e3)['end']();};}function respondWithResult(_0x410eff,_0x192b2b){_0x192b2b=_0x192b2b||0xc8;return function(_0x28b231){if(_0x28b231){return _0x410eff[_0x02ff('0x16')](_0x192b2b)[_0x02ff('0x17')](_0x28b231);}};}function respondWithFilteredResult(_0x2ef8b3,_0x415ced){return function(_0x12527d){if(_0x12527d){var _0x333e9d=typeof _0x415ced[_0x02ff('0x18')]===_0x02ff('0x19')&&typeof _0x415ced[_0x02ff('0x1a')]==='undefined';var _0x343bdb=_0x12527d[_0x02ff('0x1b')];var _0x2efc9f=_0x333e9d?0x0:_0x415ced[_0x02ff('0x18')];var _0x36ee95=_0x333e9d?_0x12527d[_0x02ff('0x1b')]:_0x415ced[_0x02ff('0x18')]+_0x415ced[_0x02ff('0x1a')];var _0x5a54db;if(_0x36ee95>=_0x343bdb){_0x36ee95=_0x343bdb;_0x5a54db=0xc8;}else{_0x5a54db=0xce;}_0x2ef8b3[_0x02ff('0x16')](_0x5a54db);return _0x2ef8b3[_0x02ff('0x1c')]('Content-Range',_0x2efc9f+'-'+_0x36ee95+'/'+_0x343bdb)['json'](_0x12527d);}return null;};}function patchUpdates(_0x372fab){return function(_0x5607ea){try{jsonpatch[_0x02ff('0x1d')](_0x5607ea,_0x372fab,!![]);}catch(_0x412477){return BPromise['reject'](_0x412477);}return _0x5607ea['save']();};}function saveUpdates(_0x2d634b,_0xb7a79f){return function(_0x30b12b){if(_0x30b12b){return _0x30b12b['update'](_0x2d634b)[_0x02ff('0x1e')](function(_0x3e78dd){return _0x3e78dd;});}return null;};}function removeEntity(_0x568d3c,_0x2590dc){return function(_0x17b90e){if(_0x17b90e){return _0x17b90e[_0x02ff('0x1f')]()['then'](function(){_0x568d3c[_0x02ff('0x16')](0xcc)[_0x02ff('0x20')]();});}};}function handleEntityNotFound(_0x280071,_0x1185b3){return function(_0x3d6a6){if(!_0x3d6a6){_0x280071[_0x02ff('0x15')](0x194);}return _0x3d6a6;};}function handleError(_0x3a730b,_0xddabbb){_0xddabbb=_0xddabbb||0x1f4;return function(_0x3a8ce5){logger['error'](_0x3a8ce5[_0x02ff('0x21')]);if(_0x3a8ce5[_0x02ff('0x22')]){delete _0x3a8ce5[_0x02ff('0x22')];}_0x3a730b[_0x02ff('0x16')](_0xddabbb)[_0x02ff('0x23')](_0x3a8ce5);};}exports[_0x02ff('0x24')]=function(_0x2439b5,_0x32192c){var _0x5762e3={},_0x61b732={},_0x38d547={'count':0x0,'rows':[]};var _0xee91d2=_[_0x02ff('0x25')](db['VoiceQueuesLog'][_0x02ff('0x26')],function(_0x333082){return{'name':_0x333082[_0x02ff('0x27')],'type':_0x333082[_0x02ff('0x28')][_0x02ff('0x29')]};});_0x61b732[_0x02ff('0x2a')]=_['map'](_0xee91d2,_0x02ff('0x22'));_0x61b732[_0x02ff('0x2b')]=_[_0x02ff('0x2c')](_0x2439b5[_0x02ff('0x2b')]);_0x61b732[_0x02ff('0x2d')]=_['intersection'](_0x61b732[_0x02ff('0x2a')],_0x61b732[_0x02ff('0x2b')]);_0x5762e3[_0x02ff('0x2e')]=_['intersection'](_0x61b732['model'],qs[_0x02ff('0x2f')](_0x2439b5[_0x02ff('0x2b')][_0x02ff('0x2f')]));_0x5762e3[_0x02ff('0x2e')]=_0x5762e3[_0x02ff('0x2e')][_0x02ff('0x30')]?_0x5762e3[_0x02ff('0x2e')]:_0x61b732[_0x02ff('0x2a')];if(!_0x2439b5[_0x02ff('0x2b')][_0x02ff('0x31')](_0x02ff('0x32'))){_0x5762e3['limit']=qs[_0x02ff('0x1a')](_0x2439b5[_0x02ff('0x2b')]['limit']);_0x5762e3[_0x02ff('0x18')]=qs[_0x02ff('0x18')](_0x2439b5['query'][_0x02ff('0x18')]);}_0x5762e3['order']=qs['sort'](_0x2439b5['query'][_0x02ff('0x33')]);_0x5762e3[_0x02ff('0x34')]=qs[_0x02ff('0x2d')](_[_0x02ff('0x35')](_0x2439b5[_0x02ff('0x2b')],_0x61b732[_0x02ff('0x2d')]),_0xee91d2);if(_0x2439b5[_0x02ff('0x2b')][_0x02ff('0x36')]){_0x5762e3[_0x02ff('0x34')]=_[_0x02ff('0x37')](_0x5762e3[_0x02ff('0x34')],{'$or':_[_0x02ff('0x25')](_0xee91d2,function(_0x416697){if(_0x416697[_0x02ff('0x28')]!=='VIRTUAL'){var _0x22702d={};_0x22702d[_0x416697[_0x02ff('0x22')]]={'$like':'%'+_0x2439b5[_0x02ff('0x2b')][_0x02ff('0x36')]+'%'};return _0x22702d;}})});}_0x5762e3=_[_0x02ff('0x37')]({},_0x5762e3,_0x2439b5['options']);var _0x3b30b0={'where':_0x5762e3[_0x02ff('0x34')]};return db[_0x02ff('0x38')][_0x02ff('0x1b')](_0x3b30b0)['then'](function(_0x50c265){_0x38d547['count']=_0x50c265;if(_0x2439b5['query']['includeAll']){_0x5762e3[_0x02ff('0x39')]=[{'all':!![]}];}return db[_0x02ff('0x38')][_0x02ff('0x3a')](_0x5762e3);})['then'](function(_0x166727){_0x38d547[_0x02ff('0x3b')]=_0x166727;return _0x38d547;})['then'](respondWithFilteredResult(_0x32192c,_0x5762e3))['catch'](handleError(_0x32192c,null));};exports[_0x02ff('0x3c')]=function(_0x349761,_0x5625ab){var _0xfc2bca={'raw':!![],'where':{'id':_0x349761[_0x02ff('0x3d')]['id']}},_0xed27a9={};_0xed27a9['model']=_[_0x02ff('0x2c')](db[_0x02ff('0x38')][_0x02ff('0x26')]);_0xed27a9[_0x02ff('0x2b')]=_['keys'](_0x349761[_0x02ff('0x2b')]);_0xed27a9[_0x02ff('0x2d')]=_[_0x02ff('0x3e')](_0xed27a9[_0x02ff('0x2a')],_0xed27a9['query']);_0xfc2bca[_0x02ff('0x2e')]=_['intersection'](_0xed27a9[_0x02ff('0x2a')],qs[_0x02ff('0x2f')](_0x349761[_0x02ff('0x2b')][_0x02ff('0x2f')]));_0xfc2bca['attributes']=_0xfc2bca[_0x02ff('0x2e')][_0x02ff('0x30')]?_0xfc2bca[_0x02ff('0x2e')]:_0xed27a9[_0x02ff('0x2a')];if(_0x349761[_0x02ff('0x2b')][_0x02ff('0x3f')]){_0xfc2bca[_0x02ff('0x39')]=[{'all':!![]}];}_0xfc2bca=_[_0x02ff('0x37')]({},_0xfc2bca,_0x349761[_0x02ff('0x40')]);return db['VoiceQueuesLog']['find'](_0xfc2bca)[_0x02ff('0x1e')](handleEntityNotFound(_0x5625ab,null))[_0x02ff('0x1e')](respondWithResult(_0x5625ab,null))['catch'](handleError(_0x5625ab,null));};exports['create']=function(_0x3cd1c8,_0x196dd8){return db['VoiceQueuesLog']['create'](_0x3cd1c8[_0x02ff('0x41')],{})[_0x02ff('0x1e')](respondWithResult(_0x196dd8,0xc9))[_0x02ff('0x42')](handleError(_0x196dd8,null));};exports['update']=function(_0x219a7a,_0x4c0f59){if(_0x219a7a[_0x02ff('0x41')]['id']){delete _0x219a7a[_0x02ff('0x41')]['id'];}return db[_0x02ff('0x38')][_0x02ff('0x43')]({'where':{'id':_0x219a7a['params']['id']}})['then'](handleEntityNotFound(_0x4c0f59,null))[_0x02ff('0x1e')](saveUpdates(_0x219a7a[_0x02ff('0x41')],null))['then'](respondWithResult(_0x4c0f59,null))[_0x02ff('0x42')](handleError(_0x4c0f59,null));};exports[_0x02ff('0x1f')]=function(_0x2e7c22,_0x3a6297){return db[_0x02ff('0x38')][_0x02ff('0x43')]({'where':{'id':_0x2e7c22['params']['id']}})[_0x02ff('0x1e')](handleEntityNotFound(_0x3a6297,null))[_0x02ff('0x1e')](removeEntity(_0x3a6297,null))[_0x02ff('0x42')](handleError(_0x3a6297,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b5c4450..2d34d37 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 _0xfc73=['define','voice_queues_log','event','dtm','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x18763b,_0x45ba56){var _0x230478=function(_0x2f4a5f){while(--_0x2f4a5f){_0x18763b['push'](_0x18763b['shift']());}};_0x230478(++_0x45ba56);}(_0xfc73,0x1e5));var _0x3fc7=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xfc73[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x3fc7('0x0'));var util=require(_0x3fc7('0x1'));var logger=require('../../config/logger')(_0x3fc7('0x2'));var moment=require(_0x3fc7('0x3'));var BPromise=require(_0x3fc7('0x4'));var rp=require(_0x3fc7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3fc7('0x6'));var attributes=require(_0x3fc7('0x7'));module[_0x3fc7('0x8')]=function(_0xc3aa8b,_0x168396){return _0xc3aa8b[_0x3fc7('0x9')]('VoiceQueuesLog',attributes,{'tableName':_0x3fc7('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x3fc7('0xb'),_0x3fc7('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0xab3a=['../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xa5aaf9,_0x51c384){var _0x2c05d0=function(_0x17217a){while(--_0x17217a){_0xa5aaf9['push'](_0xa5aaf9['shift']());}};_0x2c05d0(++_0x51c384);}(_0xab3a,0x1d3));var _0xaab3=function(_0x5401ae,_0x5e58ac){_0x5401ae=_0x5401ae-0x0;var _0x286068=_0xab3a[_0x5401ae];return _0x286068;};'use strict';var _=require(_0xaab3('0x0'));var util=require(_0xaab3('0x1'));var logger=require(_0xaab3('0x2'))(_0xaab3('0x3'));var moment=require(_0xaab3('0x4'));var BPromise=require(_0xaab3('0x5'));var rp=require(_0xaab3('0x6'));var fs=require('fs');var path=require(_0xaab3('0x7'));var rimraf=require(_0xaab3('0x8'));var config=require(_0xaab3('0x9'));var attributes=require(_0xaab3('0xa'));module[_0xaab3('0xb')]=function(_0x3c7162,_0x4c5d04){return _0x3c7162['define'](_0xaab3('0xc'),attributes,{'tableName':_0xaab3('0xd'),'paranoid':![],'indexes':[{'name':_0xaab3('0xe'),'fields':[_0xaab3('0xf'),_0xaab3('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 3636979..2584a04 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 _0xf33f=['request','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3b99c1,_0x5dfa65){var _0x40c446=function(_0xa39cb0){while(--_0xa39cb0){_0x3b99c1['push'](_0x3b99c1['shift']());}};_0x40c446(++_0x5dfa65);}(_0xf33f,0x13d));var _0xff33=function(_0x45bc8c,_0x5df23){_0x45bc8c=_0x45bc8c-0x0;var _0xc68b72=_0xf33f[_0x45bc8c];return _0xc68b72;};'use strict';var _=require(_0xff33('0x0'));var util=require(_0xff33('0x1'));var moment=require(_0xff33('0x2'));var BPromise=require(_0xff33('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff33('0x4'));var db=require(_0xff33('0x5'))['db'];var utils=require(_0xff33('0x6'));var logger=require(_0xff33('0x7'))(_0xff33('0x8'));var config=require(_0xff33('0x9'));var jayson=require(_0xff33('0xa'));var client=jayson[_0xff33('0xb')][_0xff33('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c85f8,_0x6614f2,_0x4e2b90){return new BPromise(function(_0x324eea,_0x442e5b){return client[_0xff33('0xd')](_0x4c85f8,_0x4e2b90)['then'](function(_0x5b2c81){logger[_0xff33('0xe')](_0xff33('0xf'),_0x6614f2,'request\x20sent');logger[_0xff33('0x10')](_0xff33('0x11'),_0x6614f2,'request\x20sent',JSON['stringify'](_0x5b2c81));if(_0x5b2c81['error']){if(_0x5b2c81['error']['code']===0x1f4){logger[_0xff33('0x12')](_0xff33('0xf'),_0x6614f2,_0x5b2c81[_0xff33('0x12')][_0xff33('0x13')]);return _0x442e5b(_0x5b2c81[_0xff33('0x12')]['message']);}logger[_0xff33('0x12')](_0xff33('0xf'),_0x6614f2,_0x5b2c81[_0xff33('0x12')]['message']);return _0x324eea(_0x5b2c81[_0xff33('0x12')]['message']);}else{logger['info'](_0xff33('0xf'),_0x6614f2,_0xff33('0x14'));_0x324eea(_0x5b2c81['result'][_0xff33('0x13')]);}})[_0xff33('0x15')](function(_0x598416){logger[_0xff33('0x12')](_0xff33('0xf'),_0x6614f2,_0x598416);_0x442e5b(_0x598416);});});} \ No newline at end of file +var _0xc792=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc792,0x1e5));var _0x2c79=function(_0x183920,_0x3efceb){_0x183920=_0x183920-0x0;var _0x269dfd=_0xc792[_0x183920];return _0x269dfd;};'use strict';var _=require(_0x2c79('0x0'));var util=require(_0x2c79('0x1'));var moment=require(_0x2c79('0x2'));var BPromise=require(_0x2c79('0x3'));var rs=require(_0x2c79('0x4'));var fs=require('fs');var Redis=require(_0x2c79('0x5'));var db=require(_0x2c79('0x6'))['db'];var utils=require(_0x2c79('0x7'));var logger=require(_0x2c79('0x8'))('rpc');var config=require(_0x2c79('0x9'));var jayson=require(_0x2c79('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x43307f,_0x463685,_0x300416){return new BPromise(function(_0x31920f,_0x558fd0){return client['request'](_0x43307f,_0x300416)[_0x2c79('0xb')](function(_0x5f3726){logger[_0x2c79('0xc')](_0x2c79('0xd'),_0x463685,'request\x20sent');logger['debug'](_0x2c79('0xe'),_0x463685,_0x2c79('0xf'),JSON[_0x2c79('0x10')](_0x5f3726));if(_0x5f3726['error']){if(_0x5f3726['error'][_0x2c79('0x11')]===0x1f4){logger[_0x2c79('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x463685,_0x5f3726[_0x2c79('0x12')][_0x2c79('0x13')]);return _0x558fd0(_0x5f3726[_0x2c79('0x12')][_0x2c79('0x13')]);}logger[_0x2c79('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x463685,_0x5f3726[_0x2c79('0x12')][_0x2c79('0x13')]);return _0x31920f(_0x5f3726[_0x2c79('0x12')][_0x2c79('0x13')]);}else{logger[_0x2c79('0xc')](_0x2c79('0xd'),_0x463685,_0x2c79('0xf'));_0x31920f(_0x5f3726['result'][_0x2c79('0x13')]);}})[_0x2c79('0x14')](function(_0x7c4175){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x463685,_0x7c4175);_0x558fd0(_0x7c4175);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index a73cb9d..dfbc232 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 _0x2a9f=['exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads','post','create','/:id/transcribe','runTranscribe','put','update','delete','destroy'];(function(_0x106ad1,_0x53253b){var _0x24ca40=function(_0x2bca94){while(--_0x2bca94){_0x106ad1['push'](_0x106ad1['shift']());}};_0x24ca40(++_0x53253b);}(_0x2a9f,0x169));var _0xf2a9=function(_0x101f13,_0xe2f9e6){_0x101f13=_0x101f13-0x0;var _0x2f8fda=_0x2a9f[_0x101f13];return _0x2f8fda;};'use strict';var multer=require('multer');var util=require(_0xf2a9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf2a9('0x1'));var router=express['Router']();var fs_extra=require(_0xf2a9('0x2'));var auth=require(_0xf2a9('0x3'));var interaction=require(_0xf2a9('0x4'));var config=require(_0xf2a9('0x5'));var controller=require('./voiceRecording.controller');router[_0xf2a9('0x6')]('/',auth[_0xf2a9('0x7')](),controller['index']);router['get'](_0xf2a9('0x8'),auth[_0xf2a9('0x7')](),controller[_0xf2a9('0x9')]);router[_0xf2a9('0x6')](_0xf2a9('0xa'),auth['isAuthenticated'](),controller[_0xf2a9('0xb')]);router[_0xf2a9('0x6')](_0xf2a9('0xc'),auth[_0xf2a9('0x7')](),controller['download']);router[_0xf2a9('0x6')](_0xf2a9('0xd'),controller[_0xf2a9('0xe')]);router[_0xf2a9('0x6')]('/:id/transcribe',auth[_0xf2a9('0x7')](),controller['downloadTranscribe']);router[_0xf2a9('0xf')]('/',auth[_0xf2a9('0x7')](),controller[_0xf2a9('0x10')]);router[_0xf2a9('0xf')](_0xf2a9('0x11'),auth[_0xf2a9('0x7')](),controller[_0xf2a9('0x12')]);router[_0xf2a9('0x13')](_0xf2a9('0xa'),auth[_0xf2a9('0x7')](),controller[_0xf2a9('0x14')]);router[_0xf2a9('0x15')](_0xf2a9('0xa'),auth['isAuthenticated'](),controller[_0xf2a9('0x16')]);module[_0xf2a9('0x17')]=router; \ No newline at end of file +var _0x880b=['fs-extra','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','/describe','show','/:id/download','download','/:id/downloads','post','/:id/transcribe','runTranscribe','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x246dee,_0x53f2dc){var _0x5ca18c=function(_0x2da6c8){while(--_0x2da6c8){_0x246dee['push'](_0x246dee['shift']());}};_0x5ca18c(++_0x53f2dc);}(_0x880b,0x19a));var _0xb880=function(_0x2088df,_0x19d3f1){_0x2088df=_0x2088df-0x0;var _0x132da3=_0x880b[_0x2088df];return _0x132da3;};'use strict';var multer=require(_0xb880('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb880('0x1'));var express=require(_0xb880('0x2'));var router=express[_0xb880('0x3')]();var fs_extra=require(_0xb880('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb880('0x5'));var config=require('../../config/environment');var controller=require(_0xb880('0x6'));router[_0xb880('0x7')]('/',auth[_0xb880('0x8')](),controller['index']);router[_0xb880('0x7')](_0xb880('0x9'),auth[_0xb880('0x8')](),controller['describe']);router[_0xb880('0x7')]('/:id',auth[_0xb880('0x8')](),controller[_0xb880('0xa')]);router[_0xb880('0x7')](_0xb880('0xb'),auth[_0xb880('0x8')](),controller[_0xb880('0xc')]);router[_0xb880('0x7')](_0xb880('0xd'),controller['downloads']);router[_0xb880('0x7')]('/:id/transcribe',auth[_0xb880('0x8')](),controller['downloadTranscribe']);router[_0xb880('0xe')]('/',auth[_0xb880('0x8')](),controller['create']);router[_0xb880('0xe')](_0xb880('0xf'),auth['isAuthenticated'](),controller[_0xb880('0x10')]);router[_0xb880('0x11')](_0xb880('0x12'),auth[_0xb880('0x8')](),controller[_0xb880('0x13')]);router[_0xb880('0x14')]('/:id',auth[_0xb880('0x8')](),controller[_0xb880('0x15')]);module[_0xb880('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index b9250ec..34a9aa3 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(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +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(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 fd8df00..501c4dd 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 _0x8d8c=['filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','length','includeAll','create','body','find','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','ValidationError','filename','download','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','decryptFile','recording','Sequelize','VoiceRecording\x20not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','where','pick'];(function(_0x27b423,_0x312583){var _0x5c11b8=function(_0x22a3b9){while(--_0x22a3b9){_0x27b423['push'](_0x27b423['shift']());}};_0x5c11b8(++_0x312583);}(_0x8d8c,0x19b));var _0xc8d8=function(_0x5a32bb,_0x2d24ca){_0x5a32bb=_0x5a32bb-0x0;var _0x594bce=_0x8d8c[_0x5a32bb];return _0x594bce;};'use strict';var emlformat=require(_0xc8d8('0x0'));var rimraf=require(_0xc8d8('0x1'));var zipdir=require(_0xc8d8('0x2'));var jsonpatch=require(_0xc8d8('0x3'));var rp=require(_0xc8d8('0x4'));var moment=require(_0xc8d8('0x5'));var BPromise=require(_0xc8d8('0x6'));var Mustache=require(_0xc8d8('0x7'));var util=require(_0xc8d8('0x8'));var path=require(_0xc8d8('0x9'));var sox=require('sox');var csv=require(_0xc8d8('0xa'));var ejs=require(_0xc8d8('0xb'));var fs=require('fs');var fs_extra=require(_0xc8d8('0xc'));var _=require(_0xc8d8('0xd'));var squel=require(_0xc8d8('0xe'));var crypto=require(_0xc8d8('0xf'));var jsforce=require(_0xc8d8('0x10'));var deskjs=require(_0xc8d8('0x11'));var toCsv=require('to-csv');var querystring=require(_0xc8d8('0x12'));var Papa=require(_0xc8d8('0x13'));var AWS=require('aws-sdk');var uuidv4=require(_0xc8d8('0x14'));var Redis=require('ioredis');var authService=require(_0xc8d8('0x15'));var qs=require(_0xc8d8('0x16'));var as=require(_0xc8d8('0x17'));var hardwareService=require(_0xc8d8('0x18'));var logger=require('../../config/logger')(_0xc8d8('0x19'));var utils=require(_0xc8d8('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c60c3,_0x730918){_0x730918=_0x730918||0xcc;return function(_0x49c635){if(_0x49c635){return _0x3c60c3[_0xc8d8('0x1b')](_0x730918);}return _0x3c60c3[_0xc8d8('0x1c')](_0x730918)[_0xc8d8('0x1d')]();};}function respondWithResult(_0x591fc1,_0x28db48){_0x28db48=_0x28db48||0xc8;return function(_0x13620c){if(_0x13620c){return _0x591fc1[_0xc8d8('0x1c')](_0x28db48)[_0xc8d8('0x1e')](_0x13620c);}};}function respondWithFilteredResult(_0x1c1304,_0x205e6d){return function(_0xe8ad98){if(_0xe8ad98){var _0x4929d3=typeof _0x205e6d[_0xc8d8('0x1f')]===_0xc8d8('0x20')&&typeof _0x205e6d['limit']===_0xc8d8('0x20');var _0x528822=_0xe8ad98[_0xc8d8('0x21')];var _0x544d1e=_0x4929d3?0x0:_0x205e6d[_0xc8d8('0x1f')];var _0x2347b5=_0x4929d3?_0xe8ad98[_0xc8d8('0x21')]:_0x205e6d['offset']+_0x205e6d[_0xc8d8('0x22')];var _0x89c1cb;if(_0x2347b5>=_0x528822){_0x2347b5=_0x528822;_0x89c1cb=0xc8;}else{_0x89c1cb=0xce;}_0x1c1304[_0xc8d8('0x1c')](_0x89c1cb);return _0x1c1304[_0xc8d8('0x23')]('Content-Range',_0x544d1e+'-'+_0x2347b5+'/'+_0x528822)[_0xc8d8('0x1e')](_0xe8ad98);}return null;};}function patchUpdates(_0x3e85bc){return function(_0x2e1d73){try{jsonpatch[_0xc8d8('0x24')](_0x2e1d73,_0x3e85bc,!![]);}catch(_0x32d4e6){return BPromise[_0xc8d8('0x25')](_0x32d4e6);}return _0x2e1d73[_0xc8d8('0x26')]();};}function saveUpdates(_0x1ba390,_0x4ad10d){return function(_0x15ca92){if(_0x15ca92){return _0x15ca92[_0xc8d8('0x27')](_0x1ba390)[_0xc8d8('0x28')](function(_0x5d4e42){return _0x5d4e42;});}return null;};}function removeEntity(_0x2221af,_0x586d52){return function(_0x3ed879){if(_0x3ed879){return _0x3ed879[_0xc8d8('0x29')]()[_0xc8d8('0x28')](function(){_0x2221af[_0xc8d8('0x1c')](0xcc)[_0xc8d8('0x1d')]();});}};}function handleEntityNotFound(_0x42f43a,_0x10fe57){return function(_0x218e68){if(!_0x218e68){_0x42f43a[_0xc8d8('0x1b')](0x194);}return _0x218e68;};}function handleError(_0x37055c,_0x12af59){_0x12af59=_0x12af59||0x1f4;return function(_0x13e8de){logger[_0xc8d8('0x2a')](_0x13e8de[_0xc8d8('0x2b')]);if(_0x13e8de[_0xc8d8('0x2c')]){delete _0x13e8de['name'];}_0x37055c['status'](_0x12af59)[_0xc8d8('0x2d')](_0x13e8de);};}exports[_0xc8d8('0x2e')]=function(_0xb422a4,_0x37efe1){var _0xf2c111={},_0x45a7af={},_0x28daa1={'count':0x0,'rows':[]};var _0x3d0116=_[_0xc8d8('0x2f')](db[_0xc8d8('0x30')][_0xc8d8('0x31')],function(_0x158d10){return{'name':_0x158d10[_0xc8d8('0x32')],'type':_0x158d10[_0xc8d8('0x33')][_0xc8d8('0x34')]};});_0x45a7af[_0xc8d8('0x35')]=_[_0xc8d8('0x36')](_['map'](_0x3d0116,_0xc8d8('0x2c')),[_0xc8d8('0x37')]);_0x45a7af['query']=_['keys'](_0xb422a4['query']);_0x45a7af[_0xc8d8('0x38')]=_[_0xc8d8('0x39')](_0x45a7af[_0xc8d8('0x35')],_0x45a7af[_0xc8d8('0x3a')]);_0xf2c111['attributes']=_['intersection'](_0x45a7af[_0xc8d8('0x35')],qs[_0xc8d8('0x3b')](_0xb422a4[_0xc8d8('0x3a')][_0xc8d8('0x3b')]));_0xf2c111[_0xc8d8('0x3c')]=_0xf2c111[_0xc8d8('0x3c')]['length']?_0xf2c111['attributes']:_0x45a7af[_0xc8d8('0x35')];if(!_0xb422a4[_0xc8d8('0x3a')][_0xc8d8('0x3d')](_0xc8d8('0x3e'))){_0xf2c111[_0xc8d8('0x22')]=qs[_0xc8d8('0x22')](_0xb422a4['query'][_0xc8d8('0x22')]);_0xf2c111[_0xc8d8('0x1f')]=qs[_0xc8d8('0x1f')](_0xb422a4['query'][_0xc8d8('0x1f')]);}_0xf2c111[_0xc8d8('0x3f')]=qs['sort'](_0xb422a4[_0xc8d8('0x3a')]['sort']);_0xf2c111[_0xc8d8('0x40')]=qs[_0xc8d8('0x38')](_[_0xc8d8('0x41')](_0xb422a4['query'],_0x45a7af['filters']),_0x3d0116);if(_0xb422a4[_0xc8d8('0x3a')][_0xc8d8('0x42')]){_0xf2c111[_0xc8d8('0x40')]=_[_0xc8d8('0x43')](_0xf2c111[_0xc8d8('0x40')],{'$or':_[_0xc8d8('0x2f')](_0x3d0116,function(_0x498851){if(_0x498851['type']!==_0xc8d8('0x44')){var _0x163d7b={};_0x163d7b[_0x498851[_0xc8d8('0x2c')]]={'$like':'%'+_0xb422a4[_0xc8d8('0x3a')]['filter']+'%'};return _0x163d7b;}})});}_0xf2c111=_[_0xc8d8('0x43')]({},_0xf2c111,_0xb422a4[_0xc8d8('0x45')]);var _0x247d06={'where':_0xf2c111[_0xc8d8('0x40')]};return db[_0xc8d8('0x30')][_0xc8d8('0x21')](_0x247d06)[_0xc8d8('0x28')](function(_0x1e6e57){_0x28daa1[_0xc8d8('0x21')]=_0x1e6e57;if(_0xb422a4['query']['includeAll']){_0xf2c111[_0xc8d8('0x46')]=[{'all':!![]}];}return db[_0xc8d8('0x30')][_0xc8d8('0x47')](_0xf2c111);})[_0xc8d8('0x28')](function(_0x5051cf){_0x28daa1[_0xc8d8('0x48')]=_0x5051cf;return _0x28daa1;})['then'](respondWithFilteredResult(_0x37efe1,_0xf2c111))[_0xc8d8('0x49')](handleError(_0x37efe1,null));};exports[_0xc8d8('0x4a')]=function(_0xa585c2,_0x256993){var _0x1ed4c3={'raw':![],'where':{'id':_0xa585c2[_0xc8d8('0x4b')]['id']}},_0x59f67a={};_0x59f67a['model']=_[_0xc8d8('0x4c')](db['VoiceRecording'][_0xc8d8('0x31')]);_0x59f67a[_0xc8d8('0x3a')]=_[_0xc8d8('0x4c')](_0xa585c2[_0xc8d8('0x3a')]);_0x59f67a[_0xc8d8('0x38')]=_[_0xc8d8('0x39')](_0x59f67a[_0xc8d8('0x35')],_0x59f67a['query']);_0x1ed4c3['attributes']=_[_0xc8d8('0x39')](_0x59f67a['model'],qs[_0xc8d8('0x3b')](_0xa585c2[_0xc8d8('0x3a')][_0xc8d8('0x3b')]));_0x1ed4c3[_0xc8d8('0x3c')]=_0x1ed4c3[_0xc8d8('0x3c')][_0xc8d8('0x4d')]?_0x1ed4c3[_0xc8d8('0x3c')]:_0x59f67a[_0xc8d8('0x35')];if(_0xa585c2[_0xc8d8('0x3a')][_0xc8d8('0x4e')]){_0x1ed4c3[_0xc8d8('0x46')]=[{'all':!![]}];}_0x1ed4c3=_['merge']({},_0x1ed4c3,_0xa585c2[_0xc8d8('0x45')]);return db[_0xc8d8('0x30')]['find'](_0x1ed4c3)['then'](handleEntityNotFound(_0x256993,null))[_0xc8d8('0x28')](respondWithResult(_0x256993,null))['catch'](handleError(_0x256993,null));};exports['create']=function(_0xadf9c4,_0x21b4de){return db[_0xc8d8('0x30')][_0xc8d8('0x4f')](_0xadf9c4['body'],{})[_0xc8d8('0x28')](respondWithResult(_0x21b4de,0xc9))[_0xc8d8('0x49')](handleError(_0x21b4de,null));};exports['update']=function(_0x554214,_0x648bbc){if(_0x554214[_0xc8d8('0x50')]['id']){delete _0x554214[_0xc8d8('0x50')]['id'];}return db[_0xc8d8('0x30')][_0xc8d8('0x51')]({'where':{'id':_0x554214[_0xc8d8('0x4b')]['id']}})[_0xc8d8('0x28')](handleEntityNotFound(_0x648bbc,null))[_0xc8d8('0x28')](saveUpdates(_0x554214[_0xc8d8('0x50')],null))[_0xc8d8('0x28')](respondWithResult(_0x648bbc,null))['catch'](handleError(_0x648bbc,null));};exports[_0xc8d8('0x52')]=function(_0x2865dd,_0x55f4dd){return db[_0xc8d8('0x30')]['describe']()['then'](respondWithResult(_0x55f4dd,null))['catch'](handleError(_0x55f4dd,null));};exports['download']=function(_0x9a7f16,_0x1a0d2e,_0x3fd7ae){var _0x1d0b2f=require(_0xc8d8('0x53'));var _0x3c2945=![];var _0x39e52a={};if(_0x9a7f16['query'][_0xc8d8('0x33')]&&_0x9a7f16[_0xc8d8('0x3a')][_0xc8d8('0x33')]==='uniqueid'){_0x39e52a[_0xc8d8('0x54')]=_0x9a7f16[_0xc8d8('0x4b')]['id'];}else{_0x39e52a['id']=_0x9a7f16[_0xc8d8('0x4b')]['id'];}return db['VoiceRecording'][_0xc8d8('0x51')]({'where':_0x39e52a,'attributes':['id',_0xc8d8('0x55')],'raw':!![]})[_0xc8d8('0x28')](handleEntityNotFound(_0x1a0d2e,null))[_0xc8d8('0x28')](function(_0x5d0985){if(_0x5d0985){var _0x25ed9f=_0x5d0985['value'];var _0x1f71e2=util[_0xc8d8('0x37')](_0xc8d8('0x56'),_0x25ed9f);if(fs[_0xc8d8('0x57')](_0x1f71e2)){_0x3c2945=!![];return _0x1d0b2f['decryptFile'](_0x1f71e2,_0x25ed9f,config[_0xc8d8('0x58')]['recording'])[_0xc8d8('0x28')](function(){return _0x5d0985;});}return _0x5d0985;}})[_0xc8d8('0x28')](function(_0x38abdd){if(_0x38abdd){var _0x2f6aa8=_0x38abdd[_0xc8d8('0x55')];if(!fs[_0xc8d8('0x57')](_0x2f6aa8)){throw new db['Sequelize'][(_0xc8d8('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x38abdd[_0xc8d8('0x5a')]){return _0x1a0d2e[_0xc8d8('0x5b')](_0x2f6aa8,_0x38abdd[_0xc8d8('0x5a')]+path[_0xc8d8('0x5c')](_0x2f6aa8),function(){if(_0x3c2945){fs[_0xc8d8('0x5d')](_0x2f6aa8);}});}else{return _0x1a0d2e['download'](_0x2f6aa8,function(_0x23a870){if(_0x3c2945){fs[_0xc8d8('0x5d')](_0x2f6aa8);}});}}})['catch'](function(_0x1c5c64){if(_0x1c5c64[_0xc8d8('0x5e')]==='VoiceRecording\x20not\x20found'){_0x1a0d2e[_0xc8d8('0x1c')](0x194)[_0xc8d8('0x2d')](_0xc8d8('0x5f'));}else{return handleError(_0x1a0d2e,null);}});};exports['downloads']=function(_0x594cda,_0x138ac5,_0x5e350d){var _0x11b991=require(_0xc8d8('0x53'));var _0xc699be=![];var _0x2be8aa={'$and':[db['sequelize'][_0xc8d8('0x40')](db[_0xc8d8('0x60')]['fn'](_0xc8d8('0x61'),db[_0xc8d8('0x60')][_0xc8d8('0x62')](_0xc8d8('0x54'))),_0x594cda[_0xc8d8('0x3a')][_0xc8d8('0x63')])]};if(_0x594cda['query'][_0xc8d8('0x33')]&&_0x594cda[_0xc8d8('0x3a')][_0xc8d8('0x33')]==='uniqueid'){_0x2be8aa[_0xc8d8('0x64')][_0xc8d8('0x65')]({'uniqueid':_0x594cda[_0xc8d8('0x4b')]['id']});}else{_0x2be8aa[_0xc8d8('0x64')][_0xc8d8('0x65')]({'id':_0x594cda[_0xc8d8('0x4b')]['id']});}return db[_0xc8d8('0x30')][_0xc8d8('0x51')]({'where':_0x2be8aa,'attributes':['id','value'],'raw':!![]})[_0xc8d8('0x28')](handleEntityNotFound(_0x138ac5,null))[_0xc8d8('0x28')](function(_0x3f3c80){if(_0x3f3c80){var _0xbd50e5=util['format'](_0xc8d8('0x56'),_0x3f3c80[_0xc8d8('0x55')]);if(fs[_0xc8d8('0x57')](_0xbd50e5)){_0xc699be=!![];return _0x11b991[_0xc8d8('0x66')](_0xbd50e5,_0x3f3c80['value'],config['secrets'][_0xc8d8('0x67')])[_0xc8d8('0x28')](function(){return _0x3f3c80;});}return _0x3f3c80;}})[_0xc8d8('0x28')](function(_0x56fb9b){if(_0x56fb9b){if(!fs[_0xc8d8('0x57')](_0x56fb9b[_0xc8d8('0x55')])){throw new db[(_0xc8d8('0x68'))][(_0xc8d8('0x59'))](_0xc8d8('0x69'));}if(_0x56fb9b[_0xc8d8('0x5a')]){return _0x138ac5[_0xc8d8('0x5b')](_0x56fb9b[_0xc8d8('0x55')],_0x56fb9b[_0xc8d8('0x5a')]+path[_0xc8d8('0x5c')](_0x56fb9b[_0xc8d8('0x55')]),function(){if(_0xc699be){fs[_0xc8d8('0x5d')](_0x56fb9b[_0xc8d8('0x55')]);}});}else{return _0x138ac5[_0xc8d8('0x5b')](_0x56fb9b['value'],function(_0x5b5028){if(_0xc699be){fs['unlink'](_0x56fb9b['value']);}});}}})[_0xc8d8('0x49')](handleError(_0x138ac5,null));};exports[_0xc8d8('0x29')]=function(_0x4aebe8,_0x38ddb2){return db['VoiceRecording'][_0xc8d8('0x51')]({'where':{'id':_0x4aebe8[_0xc8d8('0x4b')]['id']}})['then'](function(_0x365906){if(_[_0xc8d8('0x6a')](_0x365906)){throw new ReferenceError('Entity\x20not\x20found');}return _0x365906;})[_0xc8d8('0x28')](function(_0x41378f){var _0x31bf96=_0x41378f[_0xc8d8('0x55')];logger[_0xc8d8('0x6b')](_0xc8d8('0x6c'),_0x31bf96);if(!_[_0xc8d8('0x6a')](_0x41378f['value'])&&fs['existsSync'](_0x31bf96)){logger[_0xc8d8('0x6b')](_0xc8d8('0x6d')+_0x31bf96+_0xc8d8('0x6e'));fs[_0xc8d8('0x6f')](_0x31bf96);}_0x31bf96=_0x31bf96+_0xc8d8('0x70');if(!_[_0xc8d8('0x6a')](_0x41378f[_0xc8d8('0x55')])&&fs[_0xc8d8('0x57')](_0x31bf96)){logger[_0xc8d8('0x6b')]('File:\x20\x22'+_0x31bf96+_0xc8d8('0x6e'));fs['unlinkSync'](_0x31bf96);}return _0x41378f;})['then'](function(_0x5eb18b){if(!_0x5eb18b)throw new InternalError();return _0x5eb18b[_0xc8d8('0x29')]();})['then'](function(){_0x38ddb2['status'](0xcc)[_0xc8d8('0x1d')]();})['catch'](handleError(_0x38ddb2,null));};function getBucketslist(_0x1baadf,_0x84b68e,_0x479c8c){return new Promise(function(_0x5785b0,_0x48ab76){var _0x366b1c=new AWS['S3']({'accessKeyId':_0x84b68e,'secretAccessKey':_0x1baadf,'region':_0x479c8c});_0x366b1c[_0xc8d8('0x71')]({},function(_0x55c219,_0x18be69){if(_0x55c219){return _0x48ab76(_0x55c219);}else{return _0x5785b0(_0x18be69);}});});}function createBucket(_0x5b008e,_0x251e2e,_0x4cf9c7,_0x5c70ed){return new Promise(function(_0x3849e2,_0x18ec9d){var _0x242337=new AWS['S3']({'accessKeyId':_0x251e2e,'secretAccessKey':_0x5b008e,'region':_0x4cf9c7});_0x242337['createBucket']({'Bucket':_0x5c70ed},function(_0x159ef5,_0x4e64dd){if(_0x159ef5){return _0x18ec9d(_0x159ef5);}else{return _0x3849e2(_0x4e64dd);}});});}function uploadFile(_0xa5445b,_0x55adc4,_0x7e6bea,_0x5f2f6f,_0x599db8,_0x47b6ff){return new Promise(function(_0x36602,_0x60b500){var _0x8e5899=new AWS['S3']({'accessKeyId':_0x55adc4,'secretAccessKey':_0xa5445b,'region':_0x7e6bea});_0x8e5899[_0xc8d8('0x72')]({'Bucket':_0x5f2f6f,'Key':_0x599db8,'Body':_0x47b6ff},function(_0x1eac62,_0x20972c){if(_0x1eac62){return _0x60b500(_0x1eac62);}else{return _0x36602(_0x20972c);}});});}function startTranscribe(_0x3c5d60,_0x429524,_0x301511,_0x2104e0,_0x3b03a3,_0x2c6acb){return new Promise(function(_0x295709,_0x583306){var _0x4660c9=new AWS[(_0xc8d8('0x73'))]({'accessKeyId':_0x429524,'secretAccessKey':_0x3c5d60,'region':_0x301511});_0x4660c9[_0xc8d8('0x74')]({'TranscriptionJobName':_0x2104e0,'LanguageCode':_0x3b03a3,'Media':{'MediaFileUri':_0x2c6acb}},function(_0x4d75ce,_0x40b12f){if(_0x4d75ce){return _0x583306(_0x4d75ce);}else{return _0x295709(_0x40b12f);}});});}function transcribe(_0x4efae2,_0x1171d4,_0x270de7,_0x3b336e,_0x21cb63,_0x3fcad9,_0x54a128){return new Promise(function(_0x10ae93,_0xeacaa){var _0x5ba5bb={};logger[_0xc8d8('0x6b')](util[_0xc8d8('0x37')](_0xc8d8('0x75'),_0x4efae2,_0x21cb63));return uploadFile(_0x1171d4,_0x270de7,_0x3b336e,_0x21cb63,path[_0xc8d8('0x76')](_0x3fcad9),fs[_0xc8d8('0x77')](_0x3fcad9))[_0xc8d8('0x28')](function(_0x213af0){logger[_0xc8d8('0x6b')](util[_0xc8d8('0x37')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x4efae2,_0x21cb63,_0x213af0[_0xc8d8('0x78')]));_0x5ba5bb[_0xc8d8('0x79')]=_0x213af0[_0xc8d8('0x7a')];_0x5ba5bb[_0xc8d8('0x7b')]=_0x213af0[_0xc8d8('0x78')];logger[_0xc8d8('0x6b')](util[_0xc8d8('0x37')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x4efae2));return startTranscribe(_0x1171d4,_0x270de7,_0x3b336e,uuidv4(),_0x54a128,_0x213af0[_0xc8d8('0x78')]);})[_0xc8d8('0x28')](function(_0x2eb381){logger[_0xc8d8('0x6b')](util[_0xc8d8('0x37')](_0xc8d8('0x7c'),_0x4efae2,_0x2eb381[_0xc8d8('0x7d')][_0xc8d8('0x7e')]));_0x5ba5bb[_0xc8d8('0x7f')]=_0x2eb381[_0xc8d8('0x7d')]['TranscriptionJobName'];_0x5ba5bb['transcribeStatus']=_0x2eb381[_0xc8d8('0x7d')][_0xc8d8('0x80')];return _0x10ae93(_0x5ba5bb);})[_0xc8d8('0x49')](function(_0x58198d){return _0xeacaa(_0x58198d);});});}exports[_0xc8d8('0x81')]=function(_0x3b50c4,_0x238117,_0x5b0f64){var _0x51403c;var _0xff7640;var _0x4d8c4a;var _0x554d3a=require(_0xc8d8('0x53'));return db['VoiceRecording'][_0xc8d8('0x82')]({'where':{'id':_0x3b50c4[_0xc8d8('0x4b')]['id']}})[_0xc8d8('0x28')](function(_0x5d971d){if(_0x5d971d){var _0x1c05b8=util[_0xc8d8('0x37')](_0xc8d8('0x56'),_0x5d971d[_0xc8d8('0x55')]);if(fs[_0xc8d8('0x57')](_0x1c05b8)){cypher=!![];return _0x554d3a['decryptFile'](_0x1c05b8,_0x5d971d['value'],config[_0xc8d8('0x58')][_0xc8d8('0x67')])[_0xc8d8('0x28')](function(){return _0x5d971d;});}return _0x5d971d;}})[_0xc8d8('0x28')](function(_0x40ce83){if(!_0x40ce83){throw new db['Sequelize'][(_0xc8d8('0x59'))](_0xc8d8('0x83'));}_0xff7640=_0x40ce83;return db[_0xc8d8('0x84')][_0xc8d8('0x82')]({'where':{'id':0x1}});})[_0xc8d8('0x28')](handleEntityNotFound(_0x238117,null))['then'](function(_0x3dba8c){if(_0x3dba8c){_0x51403c=_0x3dba8c;if(!_0x51403c['transcribe']||!_0x51403c[_0xc8d8('0x85')]||!_0x51403c['transcribeRegion']||!_0x51403c[_0xc8d8('0x86')]||!_0x51403c['bucket']){throw new db[(_0xc8d8('0x68'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x3b50c4[_0xc8d8('0x50')][_0xc8d8('0x87')]&&(!_0x51403c[_0xc8d8('0x88')]||!_0x51403c[_0xc8d8('0x89')]||!_0x51403c[_0xc8d8('0x8a')]||!_0x51403c[_0xc8d8('0x86')]||!_0x51403c[_0xc8d8('0x79')])){throw new db['Sequelize'][(_0xc8d8('0x59'))](_0xc8d8('0x8b'));}return db[_0xc8d8('0x8c')][_0xc8d8('0x82')]({'where':{'id':_0x51403c[_0xc8d8('0x85')]}});}})[_0xc8d8('0x28')](function(_0x200bad){if(!_0x200bad){throw new db[(_0xc8d8('0x68'))][(_0xc8d8('0x59'))](_0xc8d8('0x8d'));}if(!_0x200bad[_0xc8d8('0x8e')]||!_0x200bad[_0xc8d8('0x8f')]){throw new db[(_0xc8d8('0x68'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x4d8c4a=_0x200bad;return getBucketslist(_0x4d8c4a[_0xc8d8('0x8e')],_0x4d8c4a[_0xc8d8('0x8f')],_0x51403c[_0xc8d8('0x90')]);})['then'](function(_0x360e17){if(_0x360e17&&_0x360e17[_0xc8d8('0x91')]){var _0x3d51d1=_['find'](_0x360e17[_0xc8d8('0x91')],function(_0x4a57ed){return _0x4a57ed[_0xc8d8('0x92')]===_0x51403c[_0xc8d8('0x79')];});if(!_0x3d51d1){logger[_0xc8d8('0x6b')](util['format'](_0xc8d8('0x93'),_0x3b50c4[_0xc8d8('0x4b')]['id'],_0x51403c['bucket']));return createBucket(_0x4d8c4a['data1'],_0x4d8c4a['data2'],_0x51403c[_0xc8d8('0x90')],_0x51403c['bucket']);}logger['info'](util[_0xc8d8('0x37')](_0xc8d8('0x94'),_0x3b50c4['params']['id'],_0x51403c[_0xc8d8('0x79')]));return;}})[_0xc8d8('0x28')](function(_0x1357b7){if(_0xff7640[_0xc8d8('0x95')]==='NEW'){return transcribe(_0x3b50c4[_0xc8d8('0x4b')]['id'],_0x4d8c4a['data1'],_0x4d8c4a[_0xc8d8('0x8f')],_0x51403c['transcribeRegion'],_0x51403c[_0xc8d8('0x79')],_0xff7640[_0xc8d8('0x55')],_0x51403c[_0xc8d8('0x86')]);}else{logger['info'](util[_0xc8d8('0x37')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3b50c4[_0xc8d8('0x4b')]['id']));return{'transcribeStatus':_0xc8d8('0x96')};}})['then'](function(_0x44ae6d){if(_0x44ae6d){_0x44ae6d[_0xc8d8('0x97')]=_0x3b50c4[_0xc8d8('0x50')]['runSentiment'];return _0xff7640[_0xc8d8('0x98')](_0x44ae6d);}})[_0xc8d8('0x28')](respondWithResult(_0x238117,null))['catch'](handleError(_0x238117,null));};function writeFile(_0x1884c6,_0x220d8f){return new Promise(function(_0x4f7925,_0x2a5f1c){fs['writeFile'](_0x220d8f,_0x1884c6,function(_0x55324b,_0x30585b){if(_0x55324b){return _0x2a5f1c(_0x55324b);}else{return _0x4f7925(_0x30585b);}});});}exports[_0xc8d8('0x99')]=function(_0x16927c,_0x251e82,_0x2b87c6){return db['VoiceRecording'][_0xc8d8('0x82')]({'where':{'id':_0x16927c[_0xc8d8('0x4b')]['id']}})[_0xc8d8('0x28')](handleEntityNotFound(_0x251e82))[_0xc8d8('0x28')](function(_0x336679){if(_0x336679&&_0x336679[_0xc8d8('0x9a')]){var _0x390688=_0x336679[_0xc8d8('0x9a')];var _0x4c83f4=config[_0xc8d8('0x9b')]+_0xc8d8('0x9c')+_0x336679['id']+_0xc8d8('0x9d');if(fs[_0xc8d8('0x57')](_0x4c83f4)){return _0x4c83f4;}return writeFile(_0x390688,_0x4c83f4)[_0xc8d8('0x28')](function(){return _0x4c83f4;});}else{throw new db[(_0xc8d8('0x68'))][(_0xc8d8('0x59'))](_0xc8d8('0x9e'));}})[_0xc8d8('0x28')](function(_0x4164e1){return _0x251e82[_0xc8d8('0x5b')](_0x4164e1);})['catch'](handleError(_0x251e82));}; \ No newline at end of file +var _0x9704=['filter','merge','type','VIRTUAL','catch','params','keys','length','include','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','downloads','sequelize','MD5','col','token','%s.cypher','decryptFile','extname','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','Setting','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','updateAttributes','downloadTranscribe','findOne','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','differenceBy','format','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x3199cd,_0x49aa09){var _0x1a98c0=function(_0x5714b2){while(--_0x5714b2){_0x3199cd['push'](_0x3199cd['shift']());}};_0x1a98c0(++_0x49aa09);}(_0x9704,0xf3));var _0x4970=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9704[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4970('0x0'));var rimraf=require(_0x4970('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4970('0x2'));var rp=require(_0x4970('0x3'));var moment=require(_0x4970('0x4'));var BPromise=require(_0x4970('0x5'));var Mustache=require(_0x4970('0x6'));var util=require(_0x4970('0x7'));var path=require(_0x4970('0x8'));var sox=require(_0x4970('0x9'));var csv=require('to-csv');var ejs=require(_0x4970('0xa'));var fs=require('fs');var fs_extra=require(_0x4970('0xb'));var _=require(_0x4970('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4970('0xd'));var toCsv=require(_0x4970('0xe'));var querystring=require(_0x4970('0xf'));var Papa=require(_0x4970('0x10'));var AWS=require(_0x4970('0x11'));var uuidv4=require(_0x4970('0x12'));var Redis=require(_0x4970('0x13'));var authService=require(_0x4970('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4970('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4970('0x16'));var utils=require(_0x4970('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4970('0x18'));var db=require(_0x4970('0x19'))['db'];function respondWithStatusCode(_0x346949,_0x3e4706){_0x3e4706=_0x3e4706||0xcc;return function(_0x24ce5d){if(_0x24ce5d){return _0x346949[_0x4970('0x1a')](_0x3e4706);}return _0x346949[_0x4970('0x1b')](_0x3e4706)['end']();};}function respondWithResult(_0x62817e,_0x4792d2){_0x4792d2=_0x4792d2||0xc8;return function(_0x5bcafb){if(_0x5bcafb){return _0x62817e[_0x4970('0x1b')](_0x4792d2)[_0x4970('0x1c')](_0x5bcafb);}};}function respondWithFilteredResult(_0x545c1c,_0x13ca06){return function(_0x44124e){if(_0x44124e){var _0x36534f=typeof _0x13ca06['offset']===_0x4970('0x1d')&&typeof _0x13ca06['limit']===_0x4970('0x1d');var _0x1d04c=_0x44124e[_0x4970('0x1e')];var _0x43e199=_0x36534f?0x0:_0x13ca06[_0x4970('0x1f')];var _0x4761be=_0x36534f?_0x44124e[_0x4970('0x1e')]:_0x13ca06[_0x4970('0x1f')]+_0x13ca06['limit'];var _0x407bb0;if(_0x4761be>=_0x1d04c){_0x4761be=_0x1d04c;_0x407bb0=0xc8;}else{_0x407bb0=0xce;}_0x545c1c[_0x4970('0x1b')](_0x407bb0);return _0x545c1c[_0x4970('0x20')]('Content-Range',_0x43e199+'-'+_0x4761be+'/'+_0x1d04c)['json'](_0x44124e);}return null;};}function patchUpdates(_0x206262){return function(_0x4748f2){try{jsonpatch[_0x4970('0x21')](_0x4748f2,_0x206262,!![]);}catch(_0x3b2fa5){return BPromise[_0x4970('0x22')](_0x3b2fa5);}return _0x4748f2[_0x4970('0x23')]();};}function saveUpdates(_0x16bf76,_0x30abb3){return function(_0x43d178){if(_0x43d178){return _0x43d178[_0x4970('0x24')](_0x16bf76)[_0x4970('0x25')](function(_0x54ff83){return _0x54ff83;});}return null;};}function removeEntity(_0x31737f,_0x534a42){return function(_0x4c0177){if(_0x4c0177){return _0x4c0177[_0x4970('0x26')]()[_0x4970('0x25')](function(){_0x31737f[_0x4970('0x1b')](0xcc)[_0x4970('0x27')]();});}};}function handleEntityNotFound(_0x2a4dfd,_0x52934f){return function(_0x5a4ae6){if(!_0x5a4ae6){_0x2a4dfd['sendStatus'](0x194);}return _0x5a4ae6;};}function handleError(_0x2cf0a3,_0x5020b4){_0x5020b4=_0x5020b4||0x1f4;return function(_0x4dfd74){logger[_0x4970('0x28')](_0x4dfd74[_0x4970('0x29')]);if(_0x4dfd74[_0x4970('0x2a')]){delete _0x4dfd74[_0x4970('0x2a')];}_0x2cf0a3['status'](_0x5020b4)[_0x4970('0x2b')](_0x4dfd74);};}exports[_0x4970('0x2c')]=function(_0x30b267,_0x3710a3){var _0x163b24={},_0x215751={},_0x758215={'count':0x0,'rows':[]};var _0x2310f9=_[_0x4970('0x2d')](db[_0x4970('0x2e')][_0x4970('0x2f')],function(_0x4de46f){return{'name':_0x4de46f[_0x4970('0x30')],'type':_0x4de46f['type'][_0x4970('0x31')]};});_0x215751['model']=_[_0x4970('0x32')](_[_0x4970('0x2d')](_0x2310f9,_0x4970('0x2a')),[_0x4970('0x33')]);_0x215751[_0x4970('0x34')]=_['keys'](_0x30b267[_0x4970('0x34')]);_0x215751[_0x4970('0x35')]=_[_0x4970('0x36')](_0x215751[_0x4970('0x37')],_0x215751[_0x4970('0x34')]);_0x163b24[_0x4970('0x38')]=_[_0x4970('0x36')](_0x215751[_0x4970('0x37')],qs[_0x4970('0x39')](_0x30b267[_0x4970('0x34')][_0x4970('0x39')]));_0x163b24[_0x4970('0x38')]=_0x163b24[_0x4970('0x38')]['length']?_0x163b24[_0x4970('0x38')]:_0x215751[_0x4970('0x37')];if(!_0x30b267[_0x4970('0x34')][_0x4970('0x3a')](_0x4970('0x3b'))){_0x163b24['limit']=qs[_0x4970('0x3c')](_0x30b267[_0x4970('0x34')][_0x4970('0x3c')]);_0x163b24[_0x4970('0x1f')]=qs[_0x4970('0x1f')](_0x30b267['query'][_0x4970('0x1f')]);}_0x163b24[_0x4970('0x3d')]=qs['sort'](_0x30b267[_0x4970('0x34')][_0x4970('0x3e')]);_0x163b24[_0x4970('0x3f')]=qs[_0x4970('0x35')](_[_0x4970('0x40')](_0x30b267[_0x4970('0x34')],_0x215751[_0x4970('0x35')]),_0x2310f9);if(_0x30b267['query'][_0x4970('0x41')]){_0x163b24[_0x4970('0x3f')]=_[_0x4970('0x42')](_0x163b24['where'],{'$or':_[_0x4970('0x2d')](_0x2310f9,function(_0x10c43d){if(_0x10c43d[_0x4970('0x43')]!==_0x4970('0x44')){var _0x53fc56={};_0x53fc56[_0x10c43d[_0x4970('0x2a')]]={'$like':'%'+_0x30b267[_0x4970('0x34')][_0x4970('0x41')]+'%'};return _0x53fc56;}})});}_0x163b24=_['merge']({},_0x163b24,_0x30b267['options']);var _0x4bc5f8={'where':_0x163b24[_0x4970('0x3f')]};return db[_0x4970('0x2e')]['count'](_0x4bc5f8)[_0x4970('0x25')](function(_0x1c129d){_0x758215[_0x4970('0x1e')]=_0x1c129d;if(_0x30b267[_0x4970('0x34')]['includeAll']){_0x163b24['include']=[{'all':!![]}];}return db[_0x4970('0x2e')]['findAll'](_0x163b24);})[_0x4970('0x25')](function(_0x3e5a1b){_0x758215['rows']=_0x3e5a1b;return _0x758215;})[_0x4970('0x25')](respondWithFilteredResult(_0x3710a3,_0x163b24))[_0x4970('0x45')](handleError(_0x3710a3,null));};exports['show']=function(_0x596edd,_0x548978){var _0x302737={'raw':![],'where':{'id':_0x596edd[_0x4970('0x46')]['id']}},_0x1ed2c4={};_0x1ed2c4['model']=_[_0x4970('0x47')](db[_0x4970('0x2e')][_0x4970('0x2f')]);_0x1ed2c4[_0x4970('0x34')]=_[_0x4970('0x47')](_0x596edd['query']);_0x1ed2c4[_0x4970('0x35')]=_[_0x4970('0x36')](_0x1ed2c4['model'],_0x1ed2c4[_0x4970('0x34')]);_0x302737['attributes']=_['intersection'](_0x1ed2c4[_0x4970('0x37')],qs[_0x4970('0x39')](_0x596edd[_0x4970('0x34')]['fields']));_0x302737[_0x4970('0x38')]=_0x302737[_0x4970('0x38')][_0x4970('0x48')]?_0x302737[_0x4970('0x38')]:_0x1ed2c4[_0x4970('0x37')];if(_0x596edd[_0x4970('0x34')]['includeAll']){_0x302737[_0x4970('0x49')]=[{'all':!![]}];}_0x302737=_['merge']({},_0x302737,_0x596edd[_0x4970('0x4a')]);return db['VoiceRecording'][_0x4970('0x4b')](_0x302737)[_0x4970('0x25')](handleEntityNotFound(_0x548978,null))[_0x4970('0x25')](respondWithResult(_0x548978,null))[_0x4970('0x45')](handleError(_0x548978,null));};exports[_0x4970('0x4c')]=function(_0x279bca,_0x2f0be6){return db[_0x4970('0x2e')]['create'](_0x279bca[_0x4970('0x4d')],{})[_0x4970('0x25')](respondWithResult(_0x2f0be6,0xc9))[_0x4970('0x45')](handleError(_0x2f0be6,null));};exports[_0x4970('0x24')]=function(_0x1be63d,_0x4951be){if(_0x1be63d['body']['id']){delete _0x1be63d[_0x4970('0x4d')]['id'];}return db[_0x4970('0x2e')][_0x4970('0x4b')]({'where':{'id':_0x1be63d['params']['id']}})['then'](handleEntityNotFound(_0x4951be,null))[_0x4970('0x25')](saveUpdates(_0x1be63d[_0x4970('0x4d')],null))['then'](respondWithResult(_0x4951be,null))[_0x4970('0x45')](handleError(_0x4951be,null));};exports[_0x4970('0x4e')]=function(_0x257a9b,_0x2e1281){return db['VoiceRecording'][_0x4970('0x4e')]()[_0x4970('0x25')](respondWithResult(_0x2e1281,null))[_0x4970('0x45')](handleError(_0x2e1281,null));};exports[_0x4970('0x4f')]=function(_0x308ee8,_0x2e43ba,_0x3bed22){var _0x2db822=require(_0x4970('0x50'));var _0xdce5e9=![];var _0x27cd41={};if(_0x308ee8[_0x4970('0x34')][_0x4970('0x43')]&&_0x308ee8['query']['type']===_0x4970('0x51')){_0x27cd41[_0x4970('0x51')]=_0x308ee8[_0x4970('0x46')]['id'];}else{_0x27cd41['id']=_0x308ee8[_0x4970('0x46')]['id'];}return db[_0x4970('0x2e')][_0x4970('0x4b')]({'where':_0x27cd41,'attributes':['id',_0x4970('0x52')],'raw':!![]})[_0x4970('0x25')](handleEntityNotFound(_0x2e43ba,null))['then'](function(_0x3c4c91){if(_0x3c4c91){var _0x42ea3b=_0x3c4c91[_0x4970('0x52')];var _0x1ec718=util[_0x4970('0x33')]('%s.cypher',_0x42ea3b);if(fs[_0x4970('0x53')](_0x1ec718)){_0xdce5e9=!![];return _0x2db822['decryptFile'](_0x1ec718,_0x42ea3b,config[_0x4970('0x54')][_0x4970('0x55')])['then'](function(){return _0x3c4c91;});}return _0x3c4c91;}})[_0x4970('0x25')](function(_0x89dc3d){if(_0x89dc3d){var _0x3f39f4=_0x89dc3d[_0x4970('0x52')];if(!fs['existsSync'](_0x3f39f4)){throw new db[(_0x4970('0x56'))][(_0x4970('0x57'))](_0x4970('0x58'));}if(_0x89dc3d[_0x4970('0x59')]){return _0x2e43ba[_0x4970('0x4f')](_0x3f39f4,_0x89dc3d['filename']+path['extname'](_0x3f39f4),function(){if(_0xdce5e9){fs[_0x4970('0x5a')](_0x3f39f4);}});}else{return _0x2e43ba[_0x4970('0x4f')](_0x3f39f4,function(_0x102268){if(_0xdce5e9){fs[_0x4970('0x5a')](_0x3f39f4);}});}}})['catch'](function(_0xdecb1){if(_0xdecb1[_0x4970('0x5b')]===_0x4970('0x58')){_0x2e43ba[_0x4970('0x1b')](0x194)['send']('Not\x20found');}else{return handleError(_0x2e43ba,null);}});};exports[_0x4970('0x5c')]=function(_0x53cc3f,_0x30f9ef,_0x5715be){var _0x1e2dc4=require(_0x4970('0x50'));var _0x90655f=![];var _0x4175c1={'$and':[db[_0x4970('0x5d')]['where'](db[_0x4970('0x5d')]['fn'](_0x4970('0x5e'),db['sequelize'][_0x4970('0x5f')](_0x4970('0x51'))),_0x53cc3f[_0x4970('0x34')][_0x4970('0x60')])]};if(_0x53cc3f[_0x4970('0x34')][_0x4970('0x43')]&&_0x53cc3f['query'][_0x4970('0x43')]==='uniqueid'){_0x4175c1['$and']['push']({'uniqueid':_0x53cc3f[_0x4970('0x46')]['id']});}else{_0x4175c1['$and']['push']({'id':_0x53cc3f[_0x4970('0x46')]['id']});}return db[_0x4970('0x2e')][_0x4970('0x4b')]({'where':_0x4175c1,'attributes':['id',_0x4970('0x52')],'raw':!![]})[_0x4970('0x25')](handleEntityNotFound(_0x30f9ef,null))[_0x4970('0x25')](function(_0xf6b23d){if(_0xf6b23d){var _0xc0df0e=util['format'](_0x4970('0x61'),_0xf6b23d[_0x4970('0x52')]);if(fs[_0x4970('0x53')](_0xc0df0e)){_0x90655f=!![];return _0x1e2dc4[_0x4970('0x62')](_0xc0df0e,_0xf6b23d[_0x4970('0x52')],config['secrets'][_0x4970('0x55')])[_0x4970('0x25')](function(){return _0xf6b23d;});}return _0xf6b23d;}})[_0x4970('0x25')](function(_0x1b89a5){if(_0x1b89a5){if(!fs[_0x4970('0x53')](_0x1b89a5['value'])){throw new db[(_0x4970('0x56'))][(_0x4970('0x57'))](_0x4970('0x58'));}if(_0x1b89a5[_0x4970('0x59')]){return _0x30f9ef['download'](_0x1b89a5['value'],_0x1b89a5[_0x4970('0x59')]+path[_0x4970('0x63')](_0x1b89a5[_0x4970('0x52')]),function(){if(_0x90655f){fs['unlink'](_0x1b89a5[_0x4970('0x52')]);}});}else{return _0x30f9ef['download'](_0x1b89a5[_0x4970('0x52')],function(_0x1aeed2){if(_0x90655f){fs[_0x4970('0x5a')](_0x1b89a5[_0x4970('0x52')]);}});}}})[_0x4970('0x45')](handleError(_0x30f9ef,null));};exports[_0x4970('0x26')]=function(_0x787172,_0x227eaa){return db[_0x4970('0x2e')][_0x4970('0x4b')]({'where':{'id':_0x787172[_0x4970('0x46')]['id']}})[_0x4970('0x25')](function(_0x2f8ce8){if(_[_0x4970('0x64')](_0x2f8ce8)){throw new ReferenceError(_0x4970('0x65'));}return _0x2f8ce8;})[_0x4970('0x25')](function(_0x31d593){var _0x5009d5=_0x31d593['value'];logger['info'](_0x4970('0x66'),_0x5009d5);if(!_[_0x4970('0x64')](_0x31d593[_0x4970('0x52')])&&fs['existsSync'](_0x5009d5)){logger[_0x4970('0x67')](_0x4970('0x68')+_0x5009d5+_0x4970('0x69'));fs[_0x4970('0x6a')](_0x5009d5);}_0x5009d5=_0x5009d5+_0x4970('0x6b');if(!_['isNil'](_0x31d593[_0x4970('0x52')])&&fs['existsSync'](_0x5009d5)){logger[_0x4970('0x67')]('File:\x20\x22'+_0x5009d5+_0x4970('0x69'));fs[_0x4970('0x6a')](_0x5009d5);}return _0x31d593;})[_0x4970('0x25')](function(_0x32187c){if(!_0x32187c)throw new InternalError();return _0x32187c[_0x4970('0x26')]();})[_0x4970('0x25')](function(){_0x227eaa[_0x4970('0x1b')](0xcc)[_0x4970('0x27')]();})[_0x4970('0x45')](handleError(_0x227eaa,null));};function getBucketslist(_0x45381b,_0x52a03d,_0x19a03d){return new Promise(function(_0x1dd210,_0x4cd2ba){var _0x1106ca=new AWS['S3']({'accessKeyId':_0x52a03d,'secretAccessKey':_0x45381b,'region':_0x19a03d});_0x1106ca[_0x4970('0x6c')]({},function(_0x1a03fd,_0x123c3e){if(_0x1a03fd){return _0x4cd2ba(_0x1a03fd);}else{return _0x1dd210(_0x123c3e);}});});}function createBucket(_0x3bf119,_0x3c5ba4,_0x3c42ea,_0x1a6c52){return new Promise(function(_0x3627af,_0x438b36){var _0x2ba135=new AWS['S3']({'accessKeyId':_0x3c5ba4,'secretAccessKey':_0x3bf119,'region':_0x3c42ea});_0x2ba135[_0x4970('0x6d')]({'Bucket':_0x1a6c52},function(_0x2ab362,_0x2d32de){if(_0x2ab362){return _0x438b36(_0x2ab362);}else{return _0x3627af(_0x2d32de);}});});}function uploadFile(_0x3394db,_0x4204b3,_0x400e86,_0x4dd209,_0x1112c6,_0x31918b){return new Promise(function(_0x2da16c,_0x5c9497){var _0x4178df=new AWS['S3']({'accessKeyId':_0x4204b3,'secretAccessKey':_0x3394db,'region':_0x400e86});_0x4178df[_0x4970('0x6e')]({'Bucket':_0x4dd209,'Key':_0x1112c6,'Body':_0x31918b},function(_0x1fea0b,_0x24155e){if(_0x1fea0b){return _0x5c9497(_0x1fea0b);}else{return _0x2da16c(_0x24155e);}});});}function startTranscribe(_0x24b8cc,_0x3b70a9,_0x2e9f89,_0x259078,_0x42a19a,_0x5a1aad){return new Promise(function(_0x384f21,_0x4a9450){var _0x3ec6d9=new AWS[(_0x4970('0x6f'))]({'accessKeyId':_0x3b70a9,'secretAccessKey':_0x24b8cc,'region':_0x2e9f89});_0x3ec6d9[_0x4970('0x70')]({'TranscriptionJobName':_0x259078,'LanguageCode':_0x42a19a,'Media':{'MediaFileUri':_0x5a1aad}},function(_0x6204c5,_0x449673){if(_0x6204c5){return _0x4a9450(_0x6204c5);}else{return _0x384f21(_0x449673);}});});}function transcribe(_0x52c31a,_0x210c65,_0x27f8c6,_0xcc9839,_0x37440d,_0x341bb1,_0x1eb92b){return new Promise(function(_0x4c201a,_0x5234f3){var _0x3c151b={};logger[_0x4970('0x67')](util[_0x4970('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x52c31a,_0x37440d));return uploadFile(_0x210c65,_0x27f8c6,_0xcc9839,_0x37440d,path[_0x4970('0x71')](_0x341bb1),fs['readFileSync'](_0x341bb1))[_0x4970('0x25')](function(_0x10cc6d){logger[_0x4970('0x67')](util[_0x4970('0x33')](_0x4970('0x72'),_0x52c31a,_0x37440d,_0x10cc6d[_0x4970('0x73')]));_0x3c151b[_0x4970('0x74')]=_0x10cc6d[_0x4970('0x75')];_0x3c151b['location']=_0x10cc6d[_0x4970('0x73')];logger['info'](util[_0x4970('0x33')](_0x4970('0x76'),_0x52c31a));return startTranscribe(_0x210c65,_0x27f8c6,_0xcc9839,uuidv4(),_0x1eb92b,_0x10cc6d[_0x4970('0x73')]);})[_0x4970('0x25')](function(_0x437544){logger['info'](util[_0x4970('0x33')](_0x4970('0x77'),_0x52c31a,_0x437544[_0x4970('0x78')][_0x4970('0x79')]));_0x3c151b[_0x4970('0x7a')]=_0x437544[_0x4970('0x78')][_0x4970('0x79')];_0x3c151b[_0x4970('0x7b')]=_0x437544['TranscriptionJob']['TranscriptionJobStatus'];return _0x4c201a(_0x3c151b);})[_0x4970('0x45')](function(_0x1f3386){return _0x5234f3(_0x1f3386);});});}exports[_0x4970('0x7c')]=function(_0x5532c6,_0x1b3317,_0x5205e5){var _0x41bb0e;var _0x5d71da;var _0x2c7814;var _0x23f89f=require(_0x4970('0x50'));return db['VoiceRecording']['findOne']({'where':{'id':_0x5532c6['params']['id']}})[_0x4970('0x25')](function(_0x56471f){if(_0x56471f){var _0x20f597=util[_0x4970('0x33')](_0x4970('0x61'),_0x56471f[_0x4970('0x52')]);if(fs[_0x4970('0x53')](_0x20f597)){cypher=!![];return _0x23f89f[_0x4970('0x62')](_0x20f597,_0x56471f[_0x4970('0x52')],config[_0x4970('0x54')][_0x4970('0x55')])[_0x4970('0x25')](function(){return _0x56471f;});}return _0x56471f;}})[_0x4970('0x25')](function(_0x57c72d){if(!_0x57c72d){throw new db[(_0x4970('0x56'))][(_0x4970('0x57'))]('Voice\x20Recording\x20not\x20found');}_0x5d71da=_0x57c72d;return db[_0x4970('0x7d')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x1b3317,null))[_0x4970('0x25')](function(_0x2b9e31){if(_0x2b9e31){_0x41bb0e=_0x2b9e31;if(!_0x41bb0e[_0x4970('0x7e')]||!_0x41bb0e[_0x4970('0x7f')]||!_0x41bb0e[_0x4970('0x80')]||!_0x41bb0e['language']||!_0x41bb0e[_0x4970('0x74')]){throw new db[(_0x4970('0x56'))][(_0x4970('0x57'))](_0x4970('0x81'));}if(_0x5532c6[_0x4970('0x4d')][_0x4970('0x82')]&&(!_0x41bb0e[_0x4970('0x83')]||!_0x41bb0e[_0x4970('0x84')]||!_0x41bb0e[_0x4970('0x85')]||!_0x41bb0e[_0x4970('0x86')]||!_0x41bb0e['bucket'])){throw new db['Sequelize'][(_0x4970('0x57'))](_0x4970('0x87'));}return db[_0x4970('0x88')]['findOne']({'where':{'id':_0x41bb0e[_0x4970('0x7f')]}});}})['then'](function(_0x45d2f6){if(!_0x45d2f6){throw new db[(_0x4970('0x56'))][(_0x4970('0x57'))](_0x4970('0x89'));}if(!_0x45d2f6[_0x4970('0x8a')]||!_0x45d2f6[_0x4970('0x8b')]){throw new db[(_0x4970('0x56'))][(_0x4970('0x57'))](_0x4970('0x8c'));}_0x2c7814=_0x45d2f6;return getBucketslist(_0x2c7814[_0x4970('0x8a')],_0x2c7814['data2'],_0x41bb0e[_0x4970('0x80')]);})[_0x4970('0x25')](function(_0x33d5f9){if(_0x33d5f9&&_0x33d5f9[_0x4970('0x8d')]){var _0x319c3f=_[_0x4970('0x4b')](_0x33d5f9[_0x4970('0x8d')],function(_0x58690b){return _0x58690b[_0x4970('0x8e')]===_0x41bb0e[_0x4970('0x74')];});if(!_0x319c3f){logger['info'](util[_0x4970('0x33')](_0x4970('0x8f'),_0x5532c6[_0x4970('0x46')]['id'],_0x41bb0e[_0x4970('0x74')]));return createBucket(_0x2c7814[_0x4970('0x8a')],_0x2c7814[_0x4970('0x8b')],_0x41bb0e[_0x4970('0x80')],_0x41bb0e['bucket']);}logger['info'](util[_0x4970('0x33')](_0x4970('0x90'),_0x5532c6[_0x4970('0x46')]['id'],_0x41bb0e[_0x4970('0x74')]));return;}})[_0x4970('0x25')](function(_0x4e4005){if(_0x5d71da[_0x4970('0x7b')]===_0x4970('0x91')){return transcribe(_0x5532c6[_0x4970('0x46')]['id'],_0x2c7814[_0x4970('0x8a')],_0x2c7814[_0x4970('0x8b')],_0x41bb0e[_0x4970('0x80')],_0x41bb0e[_0x4970('0x74')],_0x5d71da[_0x4970('0x52')],_0x41bb0e[_0x4970('0x86')]);}else{logger[_0x4970('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5532c6[_0x4970('0x46')]['id']));return{'transcribeStatus':_0x4970('0x92')};}})[_0x4970('0x25')](function(_0x449f28){if(_0x449f28){_0x449f28['tempSentiment']=_0x5532c6[_0x4970('0x4d')][_0x4970('0x82')];return _0x5d71da[_0x4970('0x93')](_0x449f28);}})['then'](respondWithResult(_0x1b3317,null))[_0x4970('0x45')](handleError(_0x1b3317,null));};function writeFile(_0x5089cc,_0xefe37f){return new Promise(function(_0xcc104d,_0x550501){fs['writeFile'](_0xefe37f,_0x5089cc,function(_0x32dc21,_0x1e68ab){if(_0x32dc21){return _0x550501(_0x32dc21);}else{return _0xcc104d(_0x1e68ab);}});});}exports[_0x4970('0x94')]=function(_0x19367e,_0x57df4a,_0x12f9a3){return db[_0x4970('0x2e')][_0x4970('0x95')]({'where':{'id':_0x19367e[_0x4970('0x46')]['id']}})[_0x4970('0x25')](handleEntityNotFound(_0x57df4a))[_0x4970('0x25')](function(_0x109f8a){if(_0x109f8a&&_0x109f8a[_0x4970('0x96')]){var _0x22e5f6=_0x109f8a[_0x4970('0x96')];var _0x1e2678=config[_0x4970('0x97')]+'/server/files/transcribes/transcribe_'+_0x109f8a['id']+_0x4970('0x98');if(fs['existsSync'](_0x1e2678)){return _0x1e2678;}return writeFile(_0x22e5f6,_0x1e2678)['then'](function(){return _0x1e2678;});}else{throw new db[(_0x4970('0x56'))][(_0x4970('0x57'))](_0x4970('0x99'));}})[_0x4970('0x25')](function(_0x56ad04){return _0x57df4a['download'](_0x56ad04);})['catch'](handleError(_0x57df4a));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 9caf37c..1b0a722 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 _0x4b84=['./voiceRecording.attributes','exports','define','uniqueid','transcribeStatus'];(function(_0x3f7dc7,_0x5022e0){var _0xf47427=function(_0x3a75d5){while(--_0x3a75d5){_0x3f7dc7['push'](_0x3f7dc7['shift']());}};_0xf47427(++_0x5022e0);}(_0x4b84,0x1cc));var _0x44b8=function(_0x77d286,_0x1ddc6d){_0x77d286=_0x77d286-0x0;var _0x5446a5=_0x4b84[_0x77d286];return _0x5446a5;};'use strict';var attributes=require(_0x44b8('0x0'));module[_0x44b8('0x1')]=function(_0x499894,_0x5005fd){return _0x499894[_0x44b8('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x44b8('0x3'),'fields':[_0x44b8('0x3')]},{'name':_0x44b8('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x177a=['define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x5ea859,_0x223245){var _0x39e64b=function(_0x2e8ba5){while(--_0x2e8ba5){_0x5ea859['push'](_0x5ea859['shift']());}};_0x39e64b(++_0x223245);}(_0x177a,0xdd));var _0xa177=function(_0x1f3822,_0x267980){_0x1f3822=_0x1f3822-0x0;var _0x4feef6=_0x177a[_0x1f3822];return _0x4feef6;};'use strict';var attributes=require(_0xa177('0x0'));module['exports']=function(_0x5ce606,_0x3c21e0){return _0x5ce606[_0xa177('0x1')](_0xa177('0x2'),attributes,{'tableName':_0xa177('0x3'),'paranoid':![],'indexes':[{'name':_0xa177('0x4'),'fields':[_0xa177('0x4')]},{'name':'transcribeStatus','fields':[_0xa177('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d58f2a5..f17fd23 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 _0x2542=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','UpdateVoiceRecording','update','body','options','raw','where','limit','../../components/encryptor','Setting','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording'];(function(_0x3c19ba,_0x4ee033){var _0xa80aa0=function(_0x40d116){while(--_0x40d116){_0x3c19ba['push'](_0x3c19ba['shift']());}};_0xa80aa0(++_0x4ee033);}(_0x2542,0x169));var _0x2254=function(_0x159462,_0xf832de){_0x159462=_0x159462-0x0;var _0xc24337=_0x2542[_0x159462];return _0xc24337;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});}exports[_0x2254('0x16')]=function(_0x1ae11e){var _0x34f90e=this;return new Promise(function(_0x497724,_0x51b395){return db['VoiceRecording'][_0x2254('0x17')](_0x1ae11e[_0x2254('0x18')],{'raw':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e[_0x2254('0x19')][_0x2254('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e['options'][_0x2254('0x1b')]||null:null,'attributes':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e[_0x2254('0x19')]['attributes']||null:null,'limit':_0x1ae11e['options']?_0x1ae11e['options'][_0x2254('0x1c')]||null:null})[_0x2254('0xc')](function(_0xf88b56){logger['info']('UpdateVoiceRecording',_0x1ae11e);logger['debug']('UpdateVoiceRecording',_0x1ae11e,JSON['stringify'](_0xf88b56));_0x497724(_0xf88b56);})['catch'](function(_0x1aa71f){logger[_0x2254('0x14')](_0x2254('0x16'),_0x1aa71f[_0x2254('0x15')],_0x1ae11e);_0x51b395(_0x34f90e[_0x2254('0x14')](0x1f4,_0x1aa71f[_0x2254('0x15')]));});});};exports['CreateVoiceRecording']=function(_0x4a8274){var _0x1ada42=this;return new Promise(function(_0x4f6877,_0x35608a){var _0x141dc5=require(_0x2254('0x1d'));var _0x3aa0bd;return db[_0x2254('0x1e')]['findOne']({'attributes':['id',_0x2254('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x2254('0xc')](function(_0x21285d){_0x3aa0bd=_0x21285d;return db[_0x2254('0x20')][_0x2254('0x21')](_0x4a8274[_0x2254('0x18')]);})[_0x2254('0xc')](function(_0x22e791){if(_0x3aa0bd[_0x2254('0x1f')]&&fs[_0x2254('0x22')](_0x22e791[_0x2254('0x23')])){var _0xad7774=util[_0x2254('0x24')](_0x2254('0x25'),_0x22e791[_0x2254('0x23')]);return _0x141dc5[_0x2254('0x26')](_0x22e791[_0x2254('0x23')],_0xad7774,config[_0x2254('0x27')][_0x2254('0x28')])['then'](function(){fs[_0x2254('0x29')](_0x22e791[_0x2254('0x23')]);logger[_0x2254('0xd')](_0x2254('0x2a'));return _0x22e791;});}return _0x22e791;})[_0x2254('0xc')](function(_0x1d275b){logger[_0x2254('0xd')](_0x2254('0x2b'),_0x4a8274);logger[_0x2254('0xf')]('CreateVoiceRecording',_0x4a8274,JSON[_0x2254('0x12')](_0x1d275b));_0x4f6877(_0x1d275b);})[_0x2254('0x2c')](function(_0x503540){logger[_0x2254('0x14')](_0x2254('0x2b'),_0x503540[_0x2254('0x15')],_0x4a8274);_0x35608a(_0x1ada42[_0x2254('0x14')](0x1f4,_0x503540['message']));});});}; \ No newline at end of file +var _0xacf4=['limit','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes'];(function(_0x1f7962,_0x181f16){var _0x3af491=function(_0x504ecf){while(--_0x504ecf){_0x1f7962['push'](_0x1f7962['shift']());}};_0x3af491(++_0x181f16);}(_0xacf4,0xe7));var _0x4acf=function(_0x5c41e3,_0x260c34){_0x5c41e3=_0x5c41e3-0x0;var _0x27383b=_0xacf4[_0x5c41e3];return _0x27383b;};'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')](_0x240c00[_0x4acf('0x16')],{'raw':_0x240c00[_0x4acf('0x17')]?_0x240c00[_0x4acf('0x17')][_0x4acf('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x240c00[_0x4acf('0x17')]?_0x240c00[_0x4acf('0x17')][_0x4acf('0x19')]||null:null,'attributes':_0x240c00['options']?_0x240c00[_0x4acf('0x17')][_0x4acf('0x1a')]||null:null,'limit':_0x240c00['options']?_0x240c00[_0x4acf('0x17')][_0x4acf('0x1b')]||null:null})['then'](function(_0x3b26ac){logger[_0x4acf('0xb')](_0x4acf('0x13'),_0x240c00);logger[_0x4acf('0x1c')]('UpdateVoiceRecording',_0x240c00,JSON[_0x4acf('0x1d')](_0x3b26ac));_0x2a678b(_0x3b26ac);})[_0x4acf('0x12')](function(_0x57e595){logger[_0x4acf('0xf')](_0x4acf('0x13'),_0x57e595['message'],_0x240c00);_0x137302(_0x4b1d93[_0x4acf('0xf')](0x1f4,_0x57e595[_0x4acf('0x10')]));});});};exports[_0x4acf('0x1e')]=function(_0x16458f){var _0x571a30=this;return new Promise(function(_0x50236d,_0x17a756){var _0x3f548a=require(_0x4acf('0x1f'));var _0x42c90c;return db[_0x4acf('0x20')][_0x4acf('0x21')]({'attributes':['id',_0x4acf('0x22')],'where':{'id':0x1},'raw':!![]})[_0x4acf('0xa')](function(_0x382c41){_0x42c90c=_0x382c41;return db[_0x4acf('0x14')]['create'](_0x16458f[_0x4acf('0x16')]);})[_0x4acf('0xa')](function(_0xd027c7){if(_0x42c90c[_0x4acf('0x22')]&&fs[_0x4acf('0x23')](_0xd027c7[_0x4acf('0x24')])){var _0x27384c=util['format'](_0x4acf('0x25'),_0xd027c7[_0x4acf('0x24')]);return _0x3f548a[_0x4acf('0x26')](_0xd027c7['value'],_0x27384c,config[_0x4acf('0x27')][_0x4acf('0x28')])[_0x4acf('0xa')](function(){fs[_0x4acf('0x29')](_0xd027c7['value']);logger[_0x4acf('0xb')](_0x4acf('0x2a'));return _0xd027c7;});}return _0xd027c7;})[_0x4acf('0xa')](function(_0x5e2332){logger[_0x4acf('0xb')](_0x4acf('0x1e'),_0x16458f);logger[_0x4acf('0x1c')](_0x4acf('0x1e'),_0x16458f,JSON[_0x4acf('0x1d')](_0x5e2332));_0x50236d(_0x5e2332);})[_0x4acf('0x12')](function(_0x490880){logger[_0x4acf('0xf')](_0x4acf('0x1e'),_0x490880['message'],_0x16458f);_0x17a756(_0x571a30[_0x4acf('0xf')](0x1f4,_0x490880['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 4120b1b..a22a0a5 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 _0x05a8=['isAuthenticated','index','/describe','/:id','post','create','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/interaction/service','get'];(function(_0x3f39ab,_0x16c981){var _0x170952=function(_0x45e049){while(--_0x45e049){_0x3f39ab['push'](_0x3f39ab['shift']());}};_0x170952(++_0x16c981);}(_0x05a8,0x149));var _0x805a=function(_0x437e8a,_0x44dfba){_0x437e8a=_0x437e8a-0x0;var _0x5e9910=_0x05a8[_0x437e8a];return _0x5e9910;};'use strict';var multer=require(_0x805a('0x0'));var util=require('util');var path=require(_0x805a('0x1'));var timeout=require('connect-timeout');var express=require(_0x805a('0x2'));var router=express[_0x805a('0x3')]();var fs_extra=require(_0x805a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x805a('0x5'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x805a('0x6')]('/',auth[_0x805a('0x7')](),controller[_0x805a('0x8')]);router[_0x805a('0x6')](_0x805a('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x805a('0x6')](_0x805a('0xa'),auth[_0x805a('0x7')](),controller['show']);router[_0x805a('0xb')]('/',auth[_0x805a('0x7')](),controller[_0x805a('0xc')]);router['put'](_0x805a('0xa'),auth['isAuthenticated'](),controller[_0x805a('0xd')]);router[_0x805a('0xe')]('/:id',auth[_0x805a('0x7')](),controller[_0x805a('0xf')]);module['exports']=router; \ No newline at end of file +var _0xc3c8=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','path','connect-timeout','Router'];(function(_0x15e254,_0x11ee35){var _0x5bb3c7=function(_0x1f2124){while(--_0x1f2124){_0x15e254['push'](_0x15e254['shift']());}};_0x5bb3c7(++_0x11ee35);}(_0xc3c8,0x1eb));var _0x8c3c=function(_0x7eee7,_0x3779a1){_0x7eee7=_0x7eee7-0x0;var _0x469f62=_0xc3c8[_0x7eee7];return _0x469f62;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8c3c('0x0'));var timeout=require(_0x8c3c('0x1'));var express=require('express');var router=express[_0x8c3c('0x2')]();var fs_extra=require(_0x8c3c('0x3'));var auth=require(_0x8c3c('0x4'));var interaction=require(_0x8c3c('0x5'));var config=require('../../config/environment');var controller=require(_0x8c3c('0x6'));router[_0x8c3c('0x7')]('/',auth[_0x8c3c('0x8')](),controller[_0x8c3c('0x9')]);router[_0x8c3c('0x7')](_0x8c3c('0xa'),auth[_0x8c3c('0x8')](),controller[_0x8c3c('0xb')]);router[_0x8c3c('0x7')](_0x8c3c('0xc'),auth[_0x8c3c('0x8')](),controller[_0x8c3c('0xd')]);router[_0x8c3c('0xe')]('/',auth[_0x8c3c('0x8')](),controller[_0x8c3c('0xf')]);router['put'](_0x8c3c('0xc'),auth[_0x8c3c('0x8')](),controller[_0x8c3c('0x10')]);router[_0x8c3c('0x11')](_0x8c3c('0xc'),auth['isAuthenticated'](),controller[_0x8c3c('0x12')]);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 0d94b48..2e74f73 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 _0x41e9=['Yes','sequelize','ENUM','blind','attended','STRING'];(function(_0xff8113,_0x280dc3){var _0x496b15=function(_0x402f74){while(--_0x402f74){_0xff8113['push'](_0xff8113['shift']());}};_0x496b15(++_0x280dc3);}(_0x41e9,0x109));var _0x941e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x41e9[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x941e('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x941e('0x1')](_0x941e('0x2'),_0x941e('0x3'))},'result':{'type':Sequelize[_0x941e('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x941e('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x941e('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x941e('0x4')]},'transferercontext':{'type':Sequelize[_0x941e('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x941e('0x4')]},'transfereechannel':{'type':Sequelize[_0x941e('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x941e('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x941e('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x941e('0x4')]},'transfereecontext':{'type':Sequelize[_0x941e('0x4')]},'transfereeexten':{'type':Sequelize[_0x941e('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x941e('0x4')]},'isexternal':{'type':Sequelize[_0x941e('0x1')](_0x941e('0x5'),'No')},'context':{'type':Sequelize[_0x941e('0x4')]},'extension':{'type':Sequelize[_0x941e('0x4')]}}; \ No newline at end of file +var _0x282d=['Yes','ENUM','blind','attended','STRING'];(function(_0x5e7672,_0x4f019a){var _0x40ea3d=function(_0x3fb671){while(--_0x3fb671){_0x5e7672['push'](_0x5e7672['shift']());}};_0x40ea3d(++_0x4f019a);}(_0x282d,0x132));var _0xd282=function(_0x48b211,_0x5d288a){_0x48b211=_0x48b211-0x0;var _0x4a58e0=_0x282d[_0x48b211];return _0x4a58e0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xd282('0x0')](_0xd282('0x1'),_0xd282('0x2'))},'result':{'type':Sequelize[_0xd282('0x3')]},'transfererchannel':{'type':Sequelize[_0xd282('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xd282('0x3')]},'transferercalleridname':{'type':Sequelize[_0xd282('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xd282('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xd282('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xd282('0x3')]},'transferercontext':{'type':Sequelize[_0xd282('0x3')]},'transfererexten':{'type':Sequelize[_0xd282('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xd282('0x3')]},'transfereechannel':{'type':Sequelize[_0xd282('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xd282('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xd282('0x3')]},'transfereeexten':{'type':Sequelize[_0xd282('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xd282('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0xd282('0x4'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index f45c0ec..69c82bd 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 _0x9610=['sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','length','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','destroy','then','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x32b6d4,_0x1d3a55){var _0x4b99ad=function(_0x1589fe){while(--_0x1589fe){_0x32b6d4['push'](_0x32b6d4['shift']());}};_0x4b99ad(++_0x1d3a55);}(_0x9610,0x1e7));var _0x0961=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9610[_0x15bc81];return _0x59440e;};'use strict';var emlformat=require(_0x0961('0x0'));var rimraf=require(_0x0961('0x1'));var zipdir=require(_0x0961('0x2'));var jsonpatch=require(_0x0961('0x3'));var rp=require(_0x0961('0x4'));var moment=require('moment');var BPromise=require(_0x0961('0x5'));var Mustache=require(_0x0961('0x6'));var util=require(_0x0961('0x7'));var path=require('path');var sox=require(_0x0961('0x8'));var csv=require(_0x0961('0x9'));var ejs=require(_0x0961('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0961('0xb'));var squel=require(_0x0961('0xc'));var crypto=require('crypto');var jsforce=require(_0x0961('0xd'));var deskjs=require(_0x0961('0xe'));var toCsv=require(_0x0961('0x9'));var querystring=require(_0x0961('0xf'));var Papa=require('papaparse');var Redis=require(_0x0961('0x10'));var authService=require(_0x0961('0x11'));var qs=require(_0x0961('0x12'));var as=require(_0x0961('0x13'));var hardwareService=require(_0x0961('0x14'));var logger=require('../../config/logger')(_0x0961('0x15'));var utils=require(_0x0961('0x16'));var config=require(_0x0961('0x17'));var licenseUtil=require(_0x0961('0x18'));var db=require(_0x0961('0x19'))['db'];function respondWithStatusCode(_0x4b4b08,_0x9da889){_0x9da889=_0x9da889||0xcc;return function(_0x4c71d8){if(_0x4c71d8){return _0x4b4b08[_0x0961('0x1a')](_0x9da889);}return _0x4b4b08[_0x0961('0x1b')](_0x9da889)[_0x0961('0x1c')]();};}function respondWithResult(_0x30815a,_0x1819ac){_0x1819ac=_0x1819ac||0xc8;return function(_0x4d332e){if(_0x4d332e){return _0x30815a[_0x0961('0x1b')](_0x1819ac)[_0x0961('0x1d')](_0x4d332e);}};}function respondWithFilteredResult(_0x5d29e2,_0x1148ed){return function(_0x11c026){if(_0x11c026){var _0x34e77b=typeof _0x1148ed[_0x0961('0x1e')]===_0x0961('0x1f')&&typeof _0x1148ed[_0x0961('0x20')]==='undefined';var _0x2d426f=_0x11c026['count'];var _0x4b8ba6=_0x34e77b?0x0:_0x1148ed[_0x0961('0x1e')];var _0x345a1a=_0x34e77b?_0x11c026[_0x0961('0x21')]:_0x1148ed['offset']+_0x1148ed[_0x0961('0x20')];var _0x102e36;if(_0x345a1a>=_0x2d426f){_0x345a1a=_0x2d426f;_0x102e36=0xc8;}else{_0x102e36=0xce;}_0x5d29e2[_0x0961('0x1b')](_0x102e36);return _0x5d29e2[_0x0961('0x22')]('Content-Range',_0x4b8ba6+'-'+_0x345a1a+'/'+_0x2d426f)[_0x0961('0x1d')](_0x11c026);}return null;};}function patchUpdates(_0xfb7d4d){return function(_0x1a04ee){try{jsonpatch[_0x0961('0x23')](_0x1a04ee,_0xfb7d4d,!![]);}catch(_0x350509){return BPromise[_0x0961('0x24')](_0x350509);}return _0x1a04ee['save']();};}function saveUpdates(_0x1435ca,_0x4a2487){return function(_0x15bfb2){if(_0x15bfb2){return _0x15bfb2['update'](_0x1435ca)['then'](function(_0x391654){return _0x391654;});}return null;};}function removeEntity(_0x5d8570,_0x2876c9){return function(_0x462f2f){if(_0x462f2f){return _0x462f2f[_0x0961('0x25')]()[_0x0961('0x26')](function(){_0x5d8570[_0x0961('0x1b')](0xcc)[_0x0961('0x1c')]();});}};}function handleEntityNotFound(_0x21e2fc,_0x28c004){return function(_0x2c7c0f){if(!_0x2c7c0f){_0x21e2fc[_0x0961('0x1a')](0x194);}return _0x2c7c0f;};}function handleError(_0x21a560,_0x10ee8f){_0x10ee8f=_0x10ee8f||0x1f4;return function(_0x50b3d4){logger[_0x0961('0x27')](_0x50b3d4[_0x0961('0x28')]);if(_0x50b3d4['name']){delete _0x50b3d4[_0x0961('0x29')];}_0x21a560[_0x0961('0x1b')](_0x10ee8f)['send'](_0x50b3d4);};}exports[_0x0961('0x2a')]=function(_0x42d580,_0x3e76f8){var _0x39bd6f={},_0x3bda77={},_0x5b237c={'count':0x0,'rows':[]};var _0x2f7299=_[_0x0961('0x2b')](db[_0x0961('0x2c')][_0x0961('0x2d')],function(_0x410e86){return{'name':_0x410e86[_0x0961('0x2e')],'type':_0x410e86[_0x0961('0x2f')][_0x0961('0x30')]};});_0x3bda77[_0x0961('0x31')]=_['map'](_0x2f7299,_0x0961('0x29'));_0x3bda77[_0x0961('0x32')]=_[_0x0961('0x33')](_0x42d580['query']);_0x3bda77[_0x0961('0x34')]=_[_0x0961('0x35')](_0x3bda77[_0x0961('0x31')],_0x3bda77[_0x0961('0x32')]);_0x39bd6f[_0x0961('0x36')]=_[_0x0961('0x35')](_0x3bda77[_0x0961('0x31')],qs[_0x0961('0x37')](_0x42d580[_0x0961('0x32')][_0x0961('0x37')]));_0x39bd6f[_0x0961('0x36')]=_0x39bd6f[_0x0961('0x36')]['length']?_0x39bd6f[_0x0961('0x36')]:_0x3bda77['model'];if(!_0x42d580[_0x0961('0x32')][_0x0961('0x38')](_0x0961('0x39'))){_0x39bd6f[_0x0961('0x20')]=qs[_0x0961('0x20')](_0x42d580['query'][_0x0961('0x20')]);_0x39bd6f[_0x0961('0x1e')]=qs['offset'](_0x42d580['query'][_0x0961('0x1e')]);}_0x39bd6f[_0x0961('0x3a')]=qs[_0x0961('0x3b')](_0x42d580[_0x0961('0x32')][_0x0961('0x3b')]);_0x39bd6f[_0x0961('0x3c')]=qs[_0x0961('0x34')](_[_0x0961('0x3d')](_0x42d580[_0x0961('0x32')],_0x3bda77[_0x0961('0x34')]),_0x2f7299);if(_0x42d580[_0x0961('0x32')][_0x0961('0x3e')]){_0x39bd6f[_0x0961('0x3c')]=_[_0x0961('0x3f')](_0x39bd6f[_0x0961('0x3c')],{'$or':_[_0x0961('0x2b')](_0x2f7299,function(_0x3b0e82){if(_0x3b0e82[_0x0961('0x2f')]!==_0x0961('0x40')){var _0x102ded={};_0x102ded[_0x3b0e82[_0x0961('0x29')]]={'$like':'%'+_0x42d580[_0x0961('0x32')][_0x0961('0x3e')]+'%'};return _0x102ded;}})});}_0x39bd6f=_[_0x0961('0x3f')]({},_0x39bd6f,_0x42d580[_0x0961('0x41')]);var _0xedff2a={'where':_0x39bd6f[_0x0961('0x3c')]};return db['VoiceTransferReport'][_0x0961('0x21')](_0xedff2a)[_0x0961('0x26')](function(_0x4bb671){_0x5b237c[_0x0961('0x21')]=_0x4bb671;if(_0x42d580[_0x0961('0x32')]['includeAll']){_0x39bd6f['include']=[{'all':!![]}];}return db[_0x0961('0x2c')][_0x0961('0x42')](_0x39bd6f);})[_0x0961('0x26')](function(_0x17b76f){_0x5b237c[_0x0961('0x43')]=_0x17b76f;return _0x5b237c;})[_0x0961('0x26')](respondWithFilteredResult(_0x3e76f8,_0x39bd6f))[_0x0961('0x44')](handleError(_0x3e76f8,null));};exports[_0x0961('0x45')]=function(_0x4b3928,_0x2e0e66){var _0x21fe0f={'raw':!![],'where':{'id':_0x4b3928[_0x0961('0x46')]['id']}},_0x4cbffb={};_0x4cbffb['model']=_['keys'](db['VoiceTransferReport'][_0x0961('0x2d')]);_0x4cbffb['query']=_[_0x0961('0x33')](_0x4b3928[_0x0961('0x32')]);_0x4cbffb[_0x0961('0x34')]=_[_0x0961('0x35')](_0x4cbffb[_0x0961('0x31')],_0x4cbffb['query']);_0x21fe0f['attributes']=_['intersection'](_0x4cbffb['model'],qs[_0x0961('0x37')](_0x4b3928[_0x0961('0x32')][_0x0961('0x37')]));_0x21fe0f[_0x0961('0x36')]=_0x21fe0f[_0x0961('0x36')][_0x0961('0x47')]?_0x21fe0f[_0x0961('0x36')]:_0x4cbffb[_0x0961('0x31')];if(_0x4b3928['query']['includeAll']){_0x21fe0f[_0x0961('0x48')]=[{'all':!![]}];}_0x21fe0f=_[_0x0961('0x3f')]({},_0x21fe0f,_0x4b3928['options']);return db[_0x0961('0x2c')][_0x0961('0x49')](_0x21fe0f)[_0x0961('0x26')](handleEntityNotFound(_0x2e0e66,null))['then'](respondWithResult(_0x2e0e66,null))[_0x0961('0x44')](handleError(_0x2e0e66,null));};exports['create']=function(_0x217eb3,_0x38c60b){return db[_0x0961('0x2c')][_0x0961('0x4a')](_0x217eb3[_0x0961('0x4b')],{})['then'](respondWithResult(_0x38c60b,0xc9))[_0x0961('0x44')](handleError(_0x38c60b,null));};exports[_0x0961('0x4c')]=function(_0x45b763,_0x365112){if(_0x45b763[_0x0961('0x4b')]['id']){delete _0x45b763[_0x0961('0x4b')]['id'];}return db[_0x0961('0x2c')][_0x0961('0x49')]({'where':{'id':_0x45b763[_0x0961('0x46')]['id']}})[_0x0961('0x26')](handleEntityNotFound(_0x365112,null))[_0x0961('0x26')](saveUpdates(_0x45b763[_0x0961('0x4b')],null))[_0x0961('0x26')](respondWithResult(_0x365112,null))[_0x0961('0x44')](handleError(_0x365112,null));};exports[_0x0961('0x25')]=function(_0x3194b3,_0x551f49){return db[_0x0961('0x2c')]['find']({'where':{'id':_0x3194b3['params']['id']}})[_0x0961('0x26')](handleEntityNotFound(_0x551f49,null))['then'](removeEntity(_0x551f49,null))[_0x0961('0x44')](handleError(_0x551f49,null));};exports['describe']=function(_0x5a1abe,_0xc6f2b3){return db[_0x0961('0x2c')][_0x0961('0x4d')]()['then'](respondWithResult(_0xc6f2b3,null))[_0x0961('0x44')](handleError(_0xc6f2b3,null));}; \ No newline at end of file +var _0x1d09=['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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','type','key','map','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','VoiceTransferReport','findAll','catch','show','intersection','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x1d09,0xe3));var _0x91d0=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x1d09[_0x28509b];return _0x1e0b6;};'use strict';var emlformat=require(_0x91d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91d0('0x2'));var moment=require(_0x91d0('0x3'));var BPromise=require(_0x91d0('0x4'));var Mustache=require(_0x91d0('0x5'));var util=require('util');var path=require(_0x91d0('0x6'));var sox=require(_0x91d0('0x7'));var csv=require(_0x91d0('0x8'));var ejs=require(_0x91d0('0x9'));var fs=require('fs');var fs_extra=require(_0x91d0('0xa'));var _=require(_0x91d0('0xb'));var squel=require(_0x91d0('0xc'));var crypto=require(_0x91d0('0xd'));var jsforce=require(_0x91d0('0xe'));var deskjs=require(_0x91d0('0xf'));var toCsv=require(_0x91d0('0x8'));var querystring=require(_0x91d0('0x10'));var Papa=require(_0x91d0('0x11'));var Redis=require(_0x91d0('0x12'));var authService=require(_0x91d0('0x13'));var qs=require(_0x91d0('0x14'));var as=require(_0x91d0('0x15'));var hardwareService=require(_0x91d0('0x16'));var logger=require(_0x91d0('0x17'))(_0x91d0('0x18'));var utils=require('../../config/utils');var config=require(_0x91d0('0x19'));var licenseUtil=require(_0x91d0('0x1a'));var db=require(_0x91d0('0x1b'))['db'];function respondWithStatusCode(_0x3f95dd,_0x19316f){_0x19316f=_0x19316f||0xcc;return function(_0x45184e){if(_0x45184e){return _0x3f95dd['sendStatus'](_0x19316f);}return _0x3f95dd[_0x91d0('0x1c')](_0x19316f)[_0x91d0('0x1d')]();};}function respondWithResult(_0x3d76b5,_0x285fcc){_0x285fcc=_0x285fcc||0xc8;return function(_0x235ea8){if(_0x235ea8){return _0x3d76b5[_0x91d0('0x1c')](_0x285fcc)[_0x91d0('0x1e')](_0x235ea8);}};}function respondWithFilteredResult(_0xb69cec,_0xed7450){return function(_0x2fb252){if(_0x2fb252){var _0x135e20=typeof _0xed7450[_0x91d0('0x1f')]===_0x91d0('0x20')&&typeof _0xed7450[_0x91d0('0x21')]===_0x91d0('0x20');var _0x2fc791=_0x2fb252['count'];var _0x2102b7=_0x135e20?0x0:_0xed7450[_0x91d0('0x1f')];var _0xc9426=_0x135e20?_0x2fb252[_0x91d0('0x22')]:_0xed7450[_0x91d0('0x1f')]+_0xed7450[_0x91d0('0x21')];var _0x3a3c46;if(_0xc9426>=_0x2fc791){_0xc9426=_0x2fc791;_0x3a3c46=0xc8;}else{_0x3a3c46=0xce;}_0xb69cec[_0x91d0('0x1c')](_0x3a3c46);return _0xb69cec[_0x91d0('0x23')](_0x91d0('0x24'),_0x2102b7+'-'+_0xc9426+'/'+_0x2fc791)['json'](_0x2fb252);}return null;};}function patchUpdates(_0x346af1){return function(_0x1fdc36){try{jsonpatch[_0x91d0('0x25')](_0x1fdc36,_0x346af1,!![]);}catch(_0xbef94f){return BPromise[_0x91d0('0x26')](_0xbef94f);}return _0x1fdc36[_0x91d0('0x27')]();};}function saveUpdates(_0x449f07,_0x34610e){return function(_0x404fc6){if(_0x404fc6){return _0x404fc6[_0x91d0('0x28')](_0x449f07)[_0x91d0('0x29')](function(_0x1e8438){return _0x1e8438;});}return null;};}function removeEntity(_0x2bc74c,_0x4c7e40){return function(_0x183f38){if(_0x183f38){return _0x183f38[_0x91d0('0x2a')]()[_0x91d0('0x29')](function(){_0x2bc74c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1db1c3,_0x444eec){return function(_0x5c03a7){if(!_0x5c03a7){_0x1db1c3[_0x91d0('0x2b')](0x194);}return _0x5c03a7;};}function handleError(_0x22d7dd,_0x3cad5f){_0x3cad5f=_0x3cad5f||0x1f4;return function(_0x3f3a68){logger['error'](_0x3f3a68[_0x91d0('0x2c')]);if(_0x3f3a68[_0x91d0('0x2d')]){delete _0x3f3a68[_0x91d0('0x2d')];}_0x22d7dd['status'](_0x3cad5f)[_0x91d0('0x2e')](_0x3f3a68);};}exports[_0x91d0('0x2f')]=function(_0x527472,_0x33f01a){var _0x39bbf8={},_0x1f31a0={},_0x31237b={'count':0x0,'rows':[]};var _0x84c9fb=_['map'](db['VoiceTransferReport'][_0x91d0('0x30')],function(_0x4bc4fb){return{'name':_0x4bc4fb['fieldName'],'type':_0x4bc4fb[_0x91d0('0x31')][_0x91d0('0x32')]};});_0x1f31a0['model']=_[_0x91d0('0x33')](_0x84c9fb,_0x91d0('0x2d'));_0x1f31a0[_0x91d0('0x34')]=_[_0x91d0('0x35')](_0x527472[_0x91d0('0x34')]);_0x1f31a0[_0x91d0('0x36')]=_['intersection'](_0x1f31a0[_0x91d0('0x37')],_0x1f31a0[_0x91d0('0x34')]);_0x39bbf8['attributes']=_['intersection'](_0x1f31a0[_0x91d0('0x37')],qs['fields'](_0x527472[_0x91d0('0x34')][_0x91d0('0x38')]));_0x39bbf8['attributes']=_0x39bbf8[_0x91d0('0x39')][_0x91d0('0x3a')]?_0x39bbf8[_0x91d0('0x39')]:_0x1f31a0[_0x91d0('0x37')];if(!_0x527472['query'][_0x91d0('0x3b')](_0x91d0('0x3c'))){_0x39bbf8[_0x91d0('0x21')]=qs[_0x91d0('0x21')](_0x527472['query'][_0x91d0('0x21')]);_0x39bbf8[_0x91d0('0x1f')]=qs[_0x91d0('0x1f')](_0x527472[_0x91d0('0x34')][_0x91d0('0x1f')]);}_0x39bbf8[_0x91d0('0x3d')]=qs['sort'](_0x527472[_0x91d0('0x34')][_0x91d0('0x3e')]);_0x39bbf8[_0x91d0('0x3f')]=qs[_0x91d0('0x36')](_[_0x91d0('0x40')](_0x527472[_0x91d0('0x34')],_0x1f31a0['filters']),_0x84c9fb);if(_0x527472['query'][_0x91d0('0x41')]){_0x39bbf8['where']=_[_0x91d0('0x42')](_0x39bbf8[_0x91d0('0x3f')],{'$or':_[_0x91d0('0x33')](_0x84c9fb,function(_0x8a0659){if(_0x8a0659[_0x91d0('0x31')]!==_0x91d0('0x43')){var _0x13994b={};_0x13994b[_0x8a0659['name']]={'$like':'%'+_0x527472[_0x91d0('0x34')][_0x91d0('0x41')]+'%'};return _0x13994b;}})});}_0x39bbf8=_[_0x91d0('0x42')]({},_0x39bbf8,_0x527472[_0x91d0('0x44')]);var _0x4d197d={'where':_0x39bbf8[_0x91d0('0x3f')]};return db['VoiceTransferReport']['count'](_0x4d197d)[_0x91d0('0x29')](function(_0x52024c){_0x31237b[_0x91d0('0x22')]=_0x52024c;if(_0x527472['query']['includeAll']){_0x39bbf8[_0x91d0('0x45')]=[{'all':!![]}];}return db[_0x91d0('0x46')][_0x91d0('0x47')](_0x39bbf8);})['then'](function(_0x142737){_0x31237b['rows']=_0x142737;return _0x31237b;})[_0x91d0('0x29')](respondWithFilteredResult(_0x33f01a,_0x39bbf8))[_0x91d0('0x48')](handleError(_0x33f01a,null));};exports[_0x91d0('0x49')]=function(_0x333a19,_0x340eb2){var _0x54eeec={'raw':!![],'where':{'id':_0x333a19['params']['id']}},_0x5c0033={};_0x5c0033[_0x91d0('0x37')]=_['keys'](db[_0x91d0('0x46')][_0x91d0('0x30')]);_0x5c0033[_0x91d0('0x34')]=_[_0x91d0('0x35')](_0x333a19[_0x91d0('0x34')]);_0x5c0033[_0x91d0('0x36')]=_['intersection'](_0x5c0033[_0x91d0('0x37')],_0x5c0033[_0x91d0('0x34')]);_0x54eeec[_0x91d0('0x39')]=_[_0x91d0('0x4a')](_0x5c0033[_0x91d0('0x37')],qs[_0x91d0('0x38')](_0x333a19[_0x91d0('0x34')]['fields']));_0x54eeec[_0x91d0('0x39')]=_0x54eeec[_0x91d0('0x39')]['length']?_0x54eeec[_0x91d0('0x39')]:_0x5c0033[_0x91d0('0x37')];if(_0x333a19[_0x91d0('0x34')]['includeAll']){_0x54eeec[_0x91d0('0x45')]=[{'all':!![]}];}_0x54eeec=_[_0x91d0('0x42')]({},_0x54eeec,_0x333a19[_0x91d0('0x44')]);return db[_0x91d0('0x46')][_0x91d0('0x4b')](_0x54eeec)['then'](handleEntityNotFound(_0x340eb2,null))[_0x91d0('0x29')](respondWithResult(_0x340eb2,null))['catch'](handleError(_0x340eb2,null));};exports[_0x91d0('0x4c')]=function(_0x48313a,_0x43a940){return db[_0x91d0('0x46')][_0x91d0('0x4c')](_0x48313a[_0x91d0('0x4d')],{})['then'](respondWithResult(_0x43a940,0xc9))[_0x91d0('0x48')](handleError(_0x43a940,null));};exports[_0x91d0('0x28')]=function(_0x34d6e2,_0x38b4fb){if(_0x34d6e2[_0x91d0('0x4d')]['id']){delete _0x34d6e2[_0x91d0('0x4d')]['id'];}return db[_0x91d0('0x46')]['find']({'where':{'id':_0x34d6e2[_0x91d0('0x4e')]['id']}})[_0x91d0('0x29')](handleEntityNotFound(_0x38b4fb,null))[_0x91d0('0x29')](saveUpdates(_0x34d6e2[_0x91d0('0x4d')],null))['then'](respondWithResult(_0x38b4fb,null))['catch'](handleError(_0x38b4fb,null));};exports[_0x91d0('0x2a')]=function(_0x384456,_0x47a5d9){return db['VoiceTransferReport']['find']({'where':{'id':_0x384456[_0x91d0('0x4e')]['id']}})[_0x91d0('0x29')](handleEntityNotFound(_0x47a5d9,null))[_0x91d0('0x29')](removeEntity(_0x47a5d9,null))[_0x91d0('0x48')](handleError(_0x47a5d9,null));};exports[_0x91d0('0x4f')]=function(_0x49af07,_0x3c3dbb){return db[_0x91d0('0x46')][_0x91d0('0x4f')]()[_0x91d0('0x29')](respondWithResult(_0x3c3dbb,null))[_0x91d0('0x48')](handleError(_0x3c3dbb,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index b8b8814..79f863a 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 _0x135e=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x38b71c,_0x50f5f0){var _0x274c38=function(_0x110737){while(--_0x110737){_0x38b71c['push'](_0x38b71c['shift']());}};_0x274c38(++_0x50f5f0);}(_0x135e,0xf5));var _0xe135=function(_0x58a9ea,_0x568d54){_0x58a9ea=_0x58a9ea-0x0;var _0x70d93c=_0x135e[_0x58a9ea];return _0x70d93c;};'use strict';var _=require(_0xe135('0x0'));var util=require(_0xe135('0x1'));var logger=require(_0xe135('0x2'))(_0xe135('0x3'));var moment=require('moment');var BPromise=require(_0xe135('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe135('0x5'));var rimraf=require(_0xe135('0x6'));var config=require('../../config/environment');var attributes=require(_0xe135('0x7'));module[_0xe135('0x8')]=function(_0x454ab1,_0x3e004f){return _0x454ab1[_0xe135('0x9')](_0xe135('0xa'),attributes,{'tableName':_0xe135('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f42=['report_call_transfer','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','VoiceTransferReport'];(function(_0xd66abb,_0x3e453a){var _0x20ac76=function(_0x297a23){while(--_0x297a23){_0xd66abb['push'](_0xd66abb['shift']());}};_0x20ac76(++_0x3e453a);}(_0x1f42,0x83));var _0x21f4=function(_0x5b4a31,_0x14a018){_0x5b4a31=_0x5b4a31-0x0;var _0x176477=_0x1f42[_0x5b4a31];return _0x176477;};'use strict';var _=require('lodash');var util=require(_0x21f4('0x0'));var logger=require(_0x21f4('0x1'))(_0x21f4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x21f4('0x3'));var fs=require('fs');var path=require(_0x21f4('0x4'));var rimraf=require(_0x21f4('0x5'));var config=require(_0x21f4('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0x21f4('0x7')]=function(_0x1e7ddc,_0x12de02){return _0x1e7ddc['define'](_0x21f4('0x8'),attributes,{'tableName':_0x21f4('0x9'),'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 7446165..e2ebb62 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 _0xc5dc=['rpc','../../config/environment','http','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x86122b,_0x29f3ac){var _0x21490c=function(_0x47a0ac){while(--_0x47a0ac){_0x86122b['push'](_0x86122b['shift']());}};_0x21490c(++_0x29f3ac);}(_0xc5dc,0x173));var _0xcc5d=function(_0x257f7a,_0x14f422){_0x257f7a=_0x257f7a-0x0;var _0x22cf2b=_0xc5dc[_0x257f7a];return _0x22cf2b;};'use strict';var _=require(_0xcc5d('0x0'));var util=require(_0xcc5d('0x1'));var moment=require(_0xcc5d('0x2'));var BPromise=require(_0xcc5d('0x3'));var rs=require(_0xcc5d('0x4'));var fs=require('fs');var Redis=require(_0xcc5d('0x5'));var db=require(_0xcc5d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcc5d('0x7'));var config=require(_0xcc5d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcc5d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b5609,_0x1e25c6,_0x5b740b){return new BPromise(function(_0x280ea1,_0x94a29c){return client['request'](_0x1b5609,_0x5b740b)[_0xcc5d('0xa')](function(_0x5cc9fd){logger[_0xcc5d('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x1e25c6,_0xcc5d('0xc'));logger[_0xcc5d('0xd')](_0xcc5d('0xe'),_0x1e25c6,_0xcc5d('0xc'),JSON['stringify'](_0x5cc9fd));if(_0x5cc9fd[_0xcc5d('0xf')]){if(_0x5cc9fd[_0xcc5d('0xf')][_0xcc5d('0x10')]===0x1f4){logger[_0xcc5d('0xf')](_0xcc5d('0x11'),_0x1e25c6,_0x5cc9fd[_0xcc5d('0xf')][_0xcc5d('0x12')]);return _0x94a29c(_0x5cc9fd[_0xcc5d('0xf')][_0xcc5d('0x12')]);}logger[_0xcc5d('0xf')](_0xcc5d('0x11'),_0x1e25c6,_0x5cc9fd[_0xcc5d('0xf')][_0xcc5d('0x12')]);return _0x280ea1(_0x5cc9fd[_0xcc5d('0xf')][_0xcc5d('0x12')]);}else{logger[_0xcc5d('0xb')](_0xcc5d('0x11'),_0x1e25c6,_0xcc5d('0xc'));_0x280ea1(_0x5cc9fd[_0xcc5d('0x13')][_0xcc5d('0x12')]);}})[_0xcc5d('0x14')](function(_0x443323){logger['error'](_0xcc5d('0x11'),_0x1e25c6,_0x443323);_0x94a29c(_0x443323);});});}exports[_0xcc5d('0x15')]=function(_0x279576){var _0x242430=this;return new Promise(function(_0x305957,_0x220411){return db['VoiceTransferReport'][_0xcc5d('0x16')](_0x279576[_0xcc5d('0x17')],{'raw':_0x279576[_0xcc5d('0x18')]?_0x279576[_0xcc5d('0x18')][_0xcc5d('0x19')]===undefined?!![]:![]:!![]})[_0xcc5d('0xa')](function(_0x1222a2){logger[_0xcc5d('0xb')]('CreateVoiceTransferReport',_0x279576);logger['debug'](_0xcc5d('0x15'),_0x279576,JSON[_0xcc5d('0x1a')](_0x1222a2));_0x305957(_0x1222a2);})[_0xcc5d('0x14')](function(_0x467c81){logger[_0xcc5d('0xf')](_0xcc5d('0x15'),_0x467c81['message'],_0x279576);_0x220411(_0x242430[_0xcc5d('0xf')](0x1f4,_0x467c81[_0xcc5d('0x12')]));});});}; \ No newline at end of file +var _0x30be=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','VoiceTransferReport,\x20%s,\x20%s','message','result','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','then','lodash','util','moment','bluebird','randomstring'];(function(_0x191ac6,_0x3cae04){var _0x1201db=function(_0x465079){while(--_0x465079){_0x191ac6['push'](_0x191ac6['shift']());}};_0x1201db(++_0x3cae04);}(_0x30be,0x1cf));var _0xe30b=function(_0x36bf46,_0x3d8db9){_0x36bf46=_0x36bf46-0x0;var _0x1d0a72=_0x30be[_0x36bf46];return _0x1d0a72;};'use strict';var _=require(_0xe30b('0x0'));var util=require(_0xe30b('0x1'));var moment=require(_0xe30b('0x2'));var BPromise=require(_0xe30b('0x3'));var rs=require(_0xe30b('0x4'));var fs=require('fs');var Redis=require(_0xe30b('0x5'));var db=require(_0xe30b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe30b('0x7'))('rpc');var config=require(_0xe30b('0x8'));var jayson=require(_0xe30b('0x9'));var client=jayson[_0xe30b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46460f,_0x59591a,_0x11b5ab){return new BPromise(function(_0x3f4f6b,_0x529589){return client[_0xe30b('0xb')](_0x46460f,_0x11b5ab)['then'](function(_0x3af4fb){logger[_0xe30b('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x59591a,_0xe30b('0xd'));logger[_0xe30b('0xe')](_0xe30b('0xf'),_0x59591a,_0xe30b('0xd'),JSON['stringify'](_0x3af4fb));if(_0x3af4fb[_0xe30b('0x10')]){if(_0x3af4fb[_0xe30b('0x10')]['code']===0x1f4){logger['error'](_0xe30b('0x11'),_0x59591a,_0x3af4fb[_0xe30b('0x10')]['message']);return _0x529589(_0x3af4fb['error'][_0xe30b('0x12')]);}logger[_0xe30b('0x10')](_0xe30b('0x11'),_0x59591a,_0x3af4fb['error'][_0xe30b('0x12')]);return _0x3f4f6b(_0x3af4fb[_0xe30b('0x10')][_0xe30b('0x12')]);}else{logger[_0xe30b('0xc')](_0xe30b('0x11'),_0x59591a,'request\x20sent');_0x3f4f6b(_0x3af4fb[_0xe30b('0x13')]['message']);}})['catch'](function(_0xf7c88a){logger[_0xe30b('0x10')](_0xe30b('0x11'),_0x59591a,_0xf7c88a);_0x529589(_0xf7c88a);});});}exports[_0xe30b('0x14')]=function(_0x2140b0){var _0x5bf762=this;return new Promise(function(_0x2d4f61,_0x18ce9a){return db[_0xe30b('0x15')]['create'](_0x2140b0[_0xe30b('0x16')],{'raw':_0x2140b0['options']?_0x2140b0[_0xe30b('0x17')][_0xe30b('0x18')]===undefined?!![]:![]:!![]})[_0xe30b('0x19')](function(_0x5d5c81){logger['info'](_0xe30b('0x14'),_0x2140b0);logger['debug'](_0xe30b('0x14'),_0x2140b0,JSON['stringify'](_0x5d5c81));_0x2d4f61(_0x5d5c81);})['catch'](function(_0x26cd72){logger[_0xe30b('0x10')](_0xe30b('0x14'),_0x26cd72[_0xe30b('0x12')],_0x2140b0);_0x18ce9a(_0x5bf762[_0xe30b('0x10')](0x1f4,_0x26cd72[_0xe30b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 0d24f9c..add6c0b 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 _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb43b,0x1b2));var _0xbb43=function(_0x260965,_0x2d5e94){_0x260965=_0x260965-0x0;var _0x2313eb=_0xb43b[_0x260965];return _0x2313eb;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file +var _0x153f=['hold','/unhold','unhold','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup','isWebrtcLicence','hangup','answer','/hold'];(function(_0x1ada39,_0x3cd2a6){var _0x476c8e=function(_0x152e7a){while(--_0x152e7a){_0x1ada39['push'](_0x1ada39['shift']());}};_0x476c8e(++_0x3cd2a6);}(_0x153f,0x15b));var _0xf153=function(_0x254e1a,_0x1b69d1){_0x254e1a=_0x254e1a-0x0;var _0x4eb4ae=_0x153f[_0x254e1a];return _0x4eb4ae;};'use strict';var express=require(_0xf153('0x0'));var router=express[_0xf153('0x1')]();var auth=require(_0xf153('0x2'));var controller=require(_0xf153('0x3'));router[_0xf153('0x4')](_0xf153('0x5'),auth[_0xf153('0x6')](),auth['isWebrtcLicence'](),controller[_0xf153('0x7')]);router['post'](_0xf153('0x8'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xa')]);router[_0xf153('0x4')]('/answer',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xb')]);router[_0xf153('0x4')](_0xf153('0xc'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xd')]);router[_0xf153('0x4')](_0xf153('0xe'),auth['isAuthenticated'](),auth[_0xf153('0x9')](),controller[_0xf153('0xf')]);router[_0xf153('0x4')]('/calls',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x10')]);router[_0xf153('0x4')](_0xf153('0x11'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x12')]);module[_0xf153('0x13')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 8ba29cf..e05e542 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 _0x3220=['error','name','status','send','NotFound','request','then','code','message','result','User','findOne','VoiceChannels','all','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','sessionId','webbar:hangup','answer','entityFound:','webbar:answer','answer\x20executed!','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:'];(function(_0x1bdef7,_0x3eb97c){var _0x28d658=function(_0x340750){while(--_0x340750){_0x1bdef7['push'](_0x1bdef7['shift']());}};_0x28d658(++_0x3eb97c);}(_0x3220,0x1c5));var _0x0322=function(_0x306e26,_0x588d82){_0x306e26=_0x306e26-0x0;var _0x3f5994=_0x3220[_0x306e26];return _0x3f5994;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x0322('0x0'));var db=require(_0x0322('0x1'))['db'];var config=require(_0x0322('0x2'));var util=require(_0x0322('0x3'));var BPromise=require(_0x0322('0x4'));var jayson=require(_0x0322('0x5'));var amiClient=jayson[_0x0322('0x6')][_0x0322('0x7')]({'port':0x232a});var logger=require(_0x0322('0x8'))(_0x0322('0x9'));var Redis=require(_0x0322('0xa'));config[_0x0322('0xb')]=_[_0x0322('0xc')](config[_0x0322('0xb')],{'host':_0x0322('0xd'),'port':0x18eb});var io=require(_0x0322('0xe'))(new Redis(config[_0x0322('0xb')]));var Schema=require(_0x0322('0xf'));var originateValidation=new Schema({'userId':{'type':_0x0322('0x10'),'required':[!![],_0x0322('0x11')]},'callNumber':{'type':_0x0322('0x12'),'required':[!![],_0x0322('0x13')]},'callerId':{'type':_0x0322('0x12')},'callbackUrl':{'type':_0x0322('0x12')}});var hangupValidation=new Schema({'userId':{'type':_0x0322('0x10'),'required':[!![],_0x0322('0x11')]},'sessionId':{'type':_0x0322('0x12'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0322('0x10'),'required':[!![],_0x0322('0x11')]},'sessionId':{'type':_0x0322('0x12'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0322('0x10'),'required':[!![],_0x0322('0x11')]},'sessionId':{'type':_0x0322('0x12'),'required':[!![],_0x0322('0x14')]},'transferNumber':{'type':_0x0322('0x12'),'required':[!![],_0x0322('0x15')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0322('0x11')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0322('0x10'),'required':[!![],_0x0322('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0322('0x10'),'required':[!![],_0x0322('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0322('0x11')]}});function emit(_0x393cf1,_0x3edcd1,_0x5c38e1){logger[_0x0322('0x16')](_0x393cf1,_0x3edcd1,JSON[_0x0322('0x17')](_0x5c38e1));io['to'](_0x393cf1)[_0x0322('0x18')](_0x3edcd1,_0x5c38e1);}function handleError(_0x597495){return function(_0x49e762){console[_0x0322('0x19')](_0x0322('0x1a'),_0x49e762,_0x49e762 instanceof RangeError);logger[_0x0322('0x1b')](_0x49e762['stack']);if(_0x49e762 instanceof RangeError){if(_0x49e762[_0x0322('0x1c')]){delete _0x49e762[_0x0322('0x1c')];}_0x597495[_0x0322('0x1d')](0x194)['send'](_0x49e762);}else{if(_0x49e762['name']){delete _0x49e762[_0x0322('0x1c')];}_0x597495[_0x0322('0x1d')](0x1f4)[_0x0322('0x1e')](_0x49e762);}};}function checkError(){return function(_0x2c6e40){if(!_0x2c6e40){throw new RangeError(_0x0322('0x1f'));}return _0x2c6e40;};}function respondWithRpcPromise(_0x422053,_0x5b80f4){return new BPromise(function(_0x4e0903,_0x46c587){var _0x17d015=amiClient;return _0x17d015[_0x0322('0x20')](_0x422053,_0x5b80f4)[_0x0322('0x21')](function(_0x5eb2fd){if(_0x5eb2fd[_0x0322('0x1b')]){if(_0x5eb2fd[_0x0322('0x1b')][_0x0322('0x22')]===0x1f4){return _0x46c587(_0x5eb2fd[_0x0322('0x1b')][_0x0322('0x23')]);}return _0x4e0903(_0x5eb2fd[_0x0322('0x1b')][_0x0322('0x23')]);}else{_0x4e0903(_0x5eb2fd[_0x0322('0x24')]);}})['catch'](function(_0x46905e){_0x46c587(_0x46905e);});});}function getAgent(_0x48bd17){return db[_0x0322('0x25')][_0x0322('0x26')]({'where':{'id':_0x48bd17,'role':'agent'}})[_0x0322('0x21')](checkError());}function getAgentCheckSession(_0x1303b4,_0x154b9e){return new BPromise(function(_0x2850d8,_0x388335){var _0x15d0db=respondWithRpcPromise(_0x0322('0x27'));var _0x4c6031=getAgent(_0x1303b4);Promise[_0x0322('0x28')]([_0x15d0db,_0x4c6031])[_0x0322('0x21')](function(_0x5af15c){var _0x488468=_0x5af15c[0x0];var _0x177ddc=_0x5af15c[0x1];var _0x3c5b85=_['filter'](_0x488468[_0x0322('0x29')],function(_0x4ac09f){return _0x4ac09f[_0x0322('0x2a')]==_0x177ddc['id']&&_0x4ac09f['sessionId']==_0x154b9e;});if(_0x3c5b85[_0x0322('0x2b')]==0x1){_0x2850d8(_0x177ddc);}else{_0x388335(new RangeError(_0x0322('0x2c')+_0x154b9e+_0x0322('0x2d')));}});});}exports['originate']=function(_0x1012c2,_0x1af479){logger[_0x0322('0x16')](_0x0322('0x2e'),_0x1012c2['body']);var _0x242031=originateValidation[_0x0322('0xf')](_0x1012c2[_0x0322('0x2f')]);if(_0x242031['length']>0x0){return _0x1af479[_0x0322('0x1d')](0x190)[_0x0322('0x30')](_0x242031);}var _0x2a18d1=_0x1012c2[_0x0322('0x2f')][_0x0322('0x31')];var _0x3afe3c=_0x1012c2['body'][_0x0322('0x32')];var _0x332e5d=_0x1012c2[_0x0322('0x2f')][_0x0322('0x33')];var _0x4a8db1=_0x1012c2['body'][_0x0322('0x34')];return getAgent(_0x2a18d1)['then'](function(_0x5d1b4e){logger[_0x0322('0x16')]('entityFound:',_0x5d1b4e[_0x0322('0x1c')]);emit(util[_0x0322('0x35')](_0x0322('0x36'),_0x5d1b4e[_0x0322('0x1c')]),_0x0322('0x37'),{'callNumber':_0x3afe3c,'callerId':_0x332e5d,'callbackUrl':_0x4a8db1});return _0x1af479[_0x0322('0x1d')](0xc8)[_0x0322('0x30')]({'error':![],'message':_0x0322('0x38')});})[_0x0322('0x39')](handleError(_0x1af479));};exports[_0x0322('0x3a')]=function(_0x1273f3,_0x476bc6){logger[_0x0322('0x16')](_0x0322('0x3b'),_0x1273f3[_0x0322('0x2f')]);var _0x42af7b=hangupValidation['validate'](_0x1273f3[_0x0322('0x2f')]);if(_0x42af7b['length']>0x0){return _0x476bc6[_0x0322('0x1d')](0x190)[_0x0322('0x30')](_0x42af7b);}var _0x1afc23=_0x1273f3['body']['userId'];var _0x5918fe=_0x1273f3[_0x0322('0x2f')][_0x0322('0x3c')];return getAgent(_0x1afc23)[_0x0322('0x21')](function(_0x18f1c4){logger[_0x0322('0x16')]('entityFound:',_0x18f1c4[_0x0322('0x1c')]);emit(util[_0x0322('0x35')](_0x0322('0x36'),_0x18f1c4[_0x0322('0x1c')]),_0x0322('0x3d'),{'sessionId':_0x5918fe});return _0x476bc6['status'](0xc8)[_0x0322('0x30')]({'error':![],'message':'hangup\x20executed!'});})[_0x0322('0x39')](handleError(_0x476bc6));};exports[_0x0322('0x3e')]=function(_0x35112e,_0x23e0da){logger['info']('answer\x20fired:',_0x35112e['body']);var _0x56ced6=answerValidation[_0x0322('0xf')](_0x35112e[_0x0322('0x2f')]);if(_0x56ced6[_0x0322('0x2b')]>0x0){return _0x23e0da['status'](0x190)['json'](_0x56ced6);}var _0x179a1d=_0x35112e[_0x0322('0x2f')][_0x0322('0x31')];var _0x592076=_0x35112e[_0x0322('0x2f')][_0x0322('0x3c')];return getAgent(_0x179a1d)[_0x0322('0x21')](function(_0x2dd732){logger[_0x0322('0x16')](_0x0322('0x3f'),_0x2dd732[_0x0322('0x1c')]);emit(util[_0x0322('0x35')](_0x0322('0x36'),_0x2dd732[_0x0322('0x1c')]),_0x0322('0x40'),{'sessionId':_0x592076});return _0x23e0da[_0x0322('0x1d')](0xc8)[_0x0322('0x30')]({'error':![],'message':_0x0322('0x41')});})[_0x0322('0x39')](handleError(_0x23e0da));};exports['hold']=function(_0x1c50e9,_0x3b138a){logger[_0x0322('0x16')]('hold\x20fired:',_0x1c50e9[_0x0322('0x2f')]);var _0x3bec9a=holdValidation['validate'](_0x1c50e9[_0x0322('0x2f')]);if(_0x3bec9a[_0x0322('0x2b')]>0x0){return _0x3b138a[_0x0322('0x1d')](0x190)[_0x0322('0x30')](_0x3bec9a);}var _0x37aa32=_0x1c50e9[_0x0322('0x2f')][_0x0322('0x31')];var _0x47ee07=_0x1c50e9[_0x0322('0x2f')][_0x0322('0x3c')];return getAgent(_0x37aa32)[_0x0322('0x21')](function(_0x31bb2d){logger[_0x0322('0x16')](_0x0322('0x3f'),_0x31bb2d['name']);emit(util[_0x0322('0x35')](_0x0322('0x36'),_0x31bb2d[_0x0322('0x1c')]),_0x0322('0x42'),{'sessionId':_0x47ee07});return _0x3b138a[_0x0322('0x1d')](0xc8)[_0x0322('0x30')]({'error':![],'message':'hold\x20executed!'});})[_0x0322('0x39')](handleError(_0x3b138a));};exports[_0x0322('0x43')]=function(_0x4228d5,_0x14df6c){logger[_0x0322('0x16')](_0x0322('0x44'),_0x4228d5[_0x0322('0x2f')]);var _0x2c5914=unholdValidation['validate'](_0x4228d5[_0x0322('0x2f')]);if(_0x2c5914[_0x0322('0x2b')]>0x0){return _0x14df6c['status'](0x190)[_0x0322('0x30')](_0x2c5914);}var _0x1d5c08=_0x4228d5[_0x0322('0x2f')][_0x0322('0x31')];var _0x167f86=_0x4228d5[_0x0322('0x2f')][_0x0322('0x3c')];return getAgent(_0x1d5c08)[_0x0322('0x21')](function(_0x4674d0){logger[_0x0322('0x16')](_0x0322('0x3f'),_0x4674d0[_0x0322('0x1c')]);emit(util[_0x0322('0x35')](_0x0322('0x36'),_0x4674d0['name']),_0x0322('0x45'),{'sessionId':_0x167f86});return _0x14df6c['status'](0xc8)[_0x0322('0x30')]({'error':![],'message':_0x0322('0x46')});})[_0x0322('0x39')](handleError(_0x14df6c));};exports['calls']=function(_0x1db9e4,_0x2aa317){logger[_0x0322('0x16')](_0x0322('0x47'),_0x2aa317[_0x0322('0x2f')]);var _0x55b75b=callsValidation[_0x0322('0xf')](_0x1db9e4[_0x0322('0x2f')]);if(_0x55b75b[_0x0322('0x2b')]>0x0){return _0x2aa317[_0x0322('0x1d')](0x190)[_0x0322('0x30')](_0x55b75b);}var _0x382524=_0x1db9e4['body'][_0x0322('0x31')];var _0x15ff8a=respondWithRpcPromise(_0x0322('0x27'));var _0x4adc09=getAgent(_0x382524);return Promise[_0x0322('0x28')]([_0x15ff8a,_0x4adc09])[_0x0322('0x21')](function(_0xb0c174){var _0x1c654f=_0xb0c174[0x0];var _0x3f950a=_0xb0c174[0x1];var _0x4abcda=_[_0x0322('0x48')](_0x1c654f[_0x0322('0x29')],function(_0x1abefd){return _0x1abefd[_0x0322('0x2a')]==_0x3f950a['id'];});return _0x2aa317[_0x0322('0x1d')](0xc8)[_0x0322('0x30')]({'count':_0x4abcda[_0x0322('0x2b')],'rows':_0x4abcda});})[_0x0322('0x39')](handleError(_0x2aa317));};exports[_0x0322('0x49')]=function(_0xe89273,_0x10d20c){logger[_0x0322('0x16')](_0x0322('0x4a'),_0xe89273[_0x0322('0x2f')]);var _0x274983=conferenceValidation[_0x0322('0xf')](_0xe89273[_0x0322('0x2f')]);if(_0x274983[_0x0322('0x2b')]>0x0){return _0x10d20c['status'](0x190)[_0x0322('0x30')](_0x274983);}var _0x195fbe=_0xe89273['body'][_0x0322('0x31')];return getAgent(_0x195fbe)['then'](function(_0xfc3ff4){logger['info']('entityFound:',_0xfc3ff4[_0x0322('0x1c')]);emit(util[_0x0322('0x35')](_0x0322('0x36'),_0xfc3ff4['name']),'webbar:conference');return _0x10d20c[_0x0322('0x1d')](0xc8)[_0x0322('0x30')]({'error':![],'message':_0x0322('0x4b')});})[_0x0322('0x39')](handleError(_0x10d20c));};exports[_0x0322('0x4c')]=function(_0x39019f,_0xe65346){logger[_0x0322('0x16')](_0x0322('0x4d'),_0x39019f[_0x0322('0x2f')]);var _0x456767=transferValidation['validate'](_0x39019f[_0x0322('0x2f')]);if(_0x456767[_0x0322('0x2b')]>0x0){return _0xe65346['status'](0x190)[_0x0322('0x30')](_0x456767);}var _0x30c316=_0x39019f['body'][_0x0322('0x31')];var _0x5612c0=_0x39019f['body']['sessionId'];var _0x285267=_0x39019f[_0x0322('0x2f')][_0x0322('0x4e')];return getAgent(_0x30c316)[_0x0322('0x21')](function(_0x551a3e){logger[_0x0322('0x16')](_0x0322('0x3f'),_0x551a3e[_0x0322('0x1c')]);emit(util[_0x0322('0x35')](_0x0322('0x36'),_0x551a3e[_0x0322('0x1c')]),'webbar:transfer',{'sessionId':_0x5612c0,'transferNumber':_0x285267});return _0xe65346[_0x0322('0x1d')](0xc8)['json']({'error':![],'message':_0x0322('0x4f')});})[_0x0322('0x39')](handleError(_0xe65346));}; \ No newline at end of file +var _0xb441=['hangup\x20executed!','catch','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','conference','transfer','webbar:transfer','transfer\x20executed!','path','../../mysqldb','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','stack','name','status','send','NotFound','then','error','code','message','result','User','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','userId','callNumber','callerId','format','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','user:%s','webbar:hangup'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb441,0xa5));var _0x1b44=function(_0x33368b,_0x414e19){_0x33368b=_0x33368b-0x0;var _0x7c774d=_0xb441[_0x33368b];return _0x7c774d;};'use strict';var path=require(_0x1b44('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x1b44('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x1b44('0x2'));var BPromise=require(_0x1b44('0x3'));var jayson=require(_0x1b44('0x4'));var amiClient=jayson[_0x1b44('0x5')][_0x1b44('0x6')]({'port':0x232a});var logger=require(_0x1b44('0x7'))(_0x1b44('0x8'));var Redis=require(_0x1b44('0x9'));config[_0x1b44('0xa')]=_[_0x1b44('0xb')](config[_0x1b44('0xa')],{'host':_0x1b44('0xc'),'port':0x18eb});var io=require(_0x1b44('0xd'))(new Redis(config[_0x1b44('0xa')]));var Schema=require(_0x1b44('0xe'));var originateValidation=new Schema({'userId':{'type':_0x1b44('0xf'),'required':[!![],_0x1b44('0x10')]},'callNumber':{'type':_0x1b44('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x1b44('0x11')},'callbackUrl':{'type':_0x1b44('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1b44('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1b44('0x10')]},'sessionId':{'type':_0x1b44('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1b44('0xf'),'required':[!![],_0x1b44('0x10')]},'sessionId':{'type':'string','required':[!![],_0x1b44('0x12')]},'transferNumber':{'type':_0x1b44('0x11'),'required':[!![],_0x1b44('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1b44('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1b44('0xf'),'required':[!![],_0x1b44('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1b44('0xf'),'required':[!![],_0x1b44('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1b44('0xf'),'required':[!![],_0x1b44('0x10')]}});function emit(_0x435c52,_0x3f2198,_0x1466cc){logger['info'](_0x435c52,_0x3f2198,JSON[_0x1b44('0x14')](_0x1466cc));io['to'](_0x435c52)['emit'](_0x3f2198,_0x1466cc);}function handleError(_0x4d4615){return function(_0x126597){console[_0x1b44('0x15')]('handleError:',_0x126597,_0x126597 instanceof RangeError);logger['error'](_0x126597[_0x1b44('0x16')]);if(_0x126597 instanceof RangeError){if(_0x126597[_0x1b44('0x17')]){delete _0x126597['name'];}_0x4d4615[_0x1b44('0x18')](0x194)[_0x1b44('0x19')](_0x126597);}else{if(_0x126597[_0x1b44('0x17')]){delete _0x126597['name'];}_0x4d4615['status'](0x1f4)['send'](_0x126597);}};}function checkError(){return function(_0x904626){if(!_0x904626){throw new RangeError(_0x1b44('0x1a'));}return _0x904626;};}function respondWithRpcPromise(_0x1b71d5,_0x50e36c){return new BPromise(function(_0x522f64,_0x112444){var _0x5262bc=amiClient;return _0x5262bc['request'](_0x1b71d5,_0x50e36c)[_0x1b44('0x1b')](function(_0x40ffd6){if(_0x40ffd6[_0x1b44('0x1c')]){if(_0x40ffd6[_0x1b44('0x1c')][_0x1b44('0x1d')]===0x1f4){return _0x112444(_0x40ffd6['error'][_0x1b44('0x1e')]);}return _0x522f64(_0x40ffd6[_0x1b44('0x1c')][_0x1b44('0x1e')]);}else{_0x522f64(_0x40ffd6[_0x1b44('0x1f')]);}})['catch'](function(_0x1ee57c){_0x112444(_0x1ee57c);});});}function getAgent(_0x155280){return db[_0x1b44('0x20')]['findOne']({'where':{'id':_0x155280,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x4bcc21,_0x2c7d87){return new BPromise(function(_0x3432d9,_0x50064b){var _0x186b07=respondWithRpcPromise('VoiceChannels');var _0xe00125=getAgent(_0x4bcc21);Promise[_0x1b44('0x21')]([_0x186b07,_0xe00125])[_0x1b44('0x1b')](function(_0x38fd02){var _0x1e8753=_0x38fd02[0x0];var _0x4e09e1=_0x38fd02[0x1];var _0x58ebb5=_[_0x1b44('0x22')](_0x1e8753[_0x1b44('0x23')],function(_0x5f707b){return _0x5f707b[_0x1b44('0x24')]==_0x4e09e1['id']&&_0x5f707b[_0x1b44('0x25')]==_0x2c7d87;});if(_0x58ebb5[_0x1b44('0x26')]==0x1){_0x3432d9(_0x4e09e1);}else{_0x50064b(new RangeError(_0x1b44('0x27')+_0x2c7d87+_0x1b44('0x28')));}});});}exports[_0x1b44('0x29')]=function(_0x1f7090,_0xc4b0e5){logger[_0x1b44('0x2a')](_0x1b44('0x2b'),_0x1f7090[_0x1b44('0x2c')]);var _0x35f124=originateValidation[_0x1b44('0xe')](_0x1f7090[_0x1b44('0x2c')]);if(_0x35f124[_0x1b44('0x26')]>0x0){return _0xc4b0e5['status'](0x190)['json'](_0x35f124);}var _0x2caf6a=_0x1f7090[_0x1b44('0x2c')][_0x1b44('0x2d')];var _0x1f0be8=_0x1f7090[_0x1b44('0x2c')][_0x1b44('0x2e')];var _0x1c8f86=_0x1f7090['body'][_0x1b44('0x2f')];var _0x54cd58=_0x1f7090[_0x1b44('0x2c')]['callbackUrl'];return getAgent(_0x2caf6a)[_0x1b44('0x1b')](function(_0x32b38d){logger[_0x1b44('0x2a')]('entityFound:',_0x32b38d[_0x1b44('0x17')]);emit(util[_0x1b44('0x30')]('user:%s',_0x32b38d[_0x1b44('0x17')]),_0x1b44('0x31'),{'callNumber':_0x1f0be8,'callerId':_0x1c8f86,'callbackUrl':_0x54cd58});return _0xc4b0e5[_0x1b44('0x18')](0xc8)[_0x1b44('0x32')]({'error':![],'message':_0x1b44('0x33')});})['catch'](handleError(_0xc4b0e5));};exports[_0x1b44('0x34')]=function(_0x460f1d,_0x554d02){logger[_0x1b44('0x2a')](_0x1b44('0x35'),_0x460f1d[_0x1b44('0x2c')]);var _0x443afd=hangupValidation[_0x1b44('0xe')](_0x460f1d['body']);if(_0x443afd['length']>0x0){return _0x554d02[_0x1b44('0x18')](0x190)[_0x1b44('0x32')](_0x443afd);}var _0x495e9c=_0x460f1d[_0x1b44('0x2c')][_0x1b44('0x2d')];var _0xb78eeb=_0x460f1d[_0x1b44('0x2c')][_0x1b44('0x25')];return getAgent(_0x495e9c)[_0x1b44('0x1b')](function(_0x8b3815){logger[_0x1b44('0x2a')](_0x1b44('0x36'),_0x8b3815[_0x1b44('0x17')]);emit(util[_0x1b44('0x30')](_0x1b44('0x37'),_0x8b3815[_0x1b44('0x17')]),_0x1b44('0x38'),{'sessionId':_0xb78eeb});return _0x554d02['status'](0xc8)['json']({'error':![],'message':_0x1b44('0x39')});})[_0x1b44('0x3a')](handleError(_0x554d02));};exports[_0x1b44('0x3b')]=function(_0x4784da,_0x195ba3){logger[_0x1b44('0x2a')](_0x1b44('0x3c'),_0x4784da['body']);var _0x1be905=answerValidation[_0x1b44('0xe')](_0x4784da[_0x1b44('0x2c')]);if(_0x1be905[_0x1b44('0x26')]>0x0){return _0x195ba3['status'](0x190)[_0x1b44('0x32')](_0x1be905);}var _0x4e6398=_0x4784da['body'][_0x1b44('0x2d')];var _0x29da02=_0x4784da[_0x1b44('0x2c')][_0x1b44('0x25')];return getAgent(_0x4e6398)[_0x1b44('0x1b')](function(_0x42a971){logger['info'](_0x1b44('0x36'),_0x42a971['name']);emit(util[_0x1b44('0x30')](_0x1b44('0x37'),_0x42a971[_0x1b44('0x17')]),_0x1b44('0x3d'),{'sessionId':_0x29da02});return _0x195ba3['status'](0xc8)[_0x1b44('0x32')]({'error':![],'message':_0x1b44('0x3e')});})['catch'](handleError(_0x195ba3));};exports[_0x1b44('0x3f')]=function(_0x3129e8,_0x171afd){logger[_0x1b44('0x2a')](_0x1b44('0x40'),_0x3129e8[_0x1b44('0x2c')]);var _0x52cb96=holdValidation['validate'](_0x3129e8[_0x1b44('0x2c')]);if(_0x52cb96['length']>0x0){return _0x171afd[_0x1b44('0x18')](0x190)[_0x1b44('0x32')](_0x52cb96);}var _0x26e334=_0x3129e8[_0x1b44('0x2c')][_0x1b44('0x2d')];var _0xa7685=_0x3129e8[_0x1b44('0x2c')][_0x1b44('0x25')];return getAgent(_0x26e334)[_0x1b44('0x1b')](function(_0x55d473){logger[_0x1b44('0x2a')](_0x1b44('0x36'),_0x55d473[_0x1b44('0x17')]);emit(util[_0x1b44('0x30')](_0x1b44('0x37'),_0x55d473['name']),_0x1b44('0x41'),{'sessionId':_0xa7685});return _0x171afd['status'](0xc8)[_0x1b44('0x32')]({'error':![],'message':_0x1b44('0x42')});})[_0x1b44('0x3a')](handleError(_0x171afd));};exports[_0x1b44('0x43')]=function(_0x41f3aa,_0x184728){logger[_0x1b44('0x2a')](_0x1b44('0x44'),_0x41f3aa[_0x1b44('0x2c')]);var _0x4bc565=unholdValidation[_0x1b44('0xe')](_0x41f3aa[_0x1b44('0x2c')]);if(_0x4bc565['length']>0x0){return _0x184728[_0x1b44('0x18')](0x190)[_0x1b44('0x32')](_0x4bc565);}var _0xe4df01=_0x41f3aa[_0x1b44('0x2c')][_0x1b44('0x2d')];var _0x5a34ca=_0x41f3aa[_0x1b44('0x2c')][_0x1b44('0x25')];return getAgent(_0xe4df01)['then'](function(_0x50d07d){logger['info'](_0x1b44('0x36'),_0x50d07d[_0x1b44('0x17')]);emit(util[_0x1b44('0x30')](_0x1b44('0x37'),_0x50d07d[_0x1b44('0x17')]),'webbar:unhold',{'sessionId':_0x5a34ca});return _0x184728[_0x1b44('0x18')](0xc8)[_0x1b44('0x32')]({'error':![],'message':_0x1b44('0x45')});})[_0x1b44('0x3a')](handleError(_0x184728));};exports['calls']=function(_0x175743,_0x18adb3){logger['info']('calls\x20fired:',_0x18adb3[_0x1b44('0x2c')]);var _0x2a3c63=callsValidation[_0x1b44('0xe')](_0x175743['body']);if(_0x2a3c63['length']>0x0){return _0x18adb3[_0x1b44('0x18')](0x190)['json'](_0x2a3c63);}var _0x3bf64e=_0x175743[_0x1b44('0x2c')]['userId'];var _0x4e0b81=respondWithRpcPromise('VoiceChannels');var _0x513eb0=getAgent(_0x3bf64e);return Promise[_0x1b44('0x21')]([_0x4e0b81,_0x513eb0])[_0x1b44('0x1b')](function(_0x54faa3){var _0x330a95=_0x54faa3[0x0];var _0x5f33f1=_0x54faa3[0x1];var _0x4c11cb=_[_0x1b44('0x22')](_0x330a95[_0x1b44('0x23')],function(_0xdd988b){return _0xdd988b[_0x1b44('0x24')]==_0x5f33f1['id'];});return _0x18adb3[_0x1b44('0x18')](0xc8)[_0x1b44('0x32')]({'count':_0x4c11cb[_0x1b44('0x26')],'rows':_0x4c11cb});})[_0x1b44('0x3a')](handleError(_0x18adb3));};exports[_0x1b44('0x46')]=function(_0x28729a,_0x5375e8){logger[_0x1b44('0x2a')]('conference\x20fired:',_0x28729a['body']);var _0x2cd73d=conferenceValidation[_0x1b44('0xe')](_0x28729a['body']);if(_0x2cd73d[_0x1b44('0x26')]>0x0){return _0x5375e8[_0x1b44('0x18')](0x190)['json'](_0x2cd73d);}var _0x213f89=_0x28729a['body']['userId'];return getAgent(_0x213f89)[_0x1b44('0x1b')](function(_0x2381cf){logger[_0x1b44('0x2a')]('entityFound:',_0x2381cf[_0x1b44('0x17')]);emit(util[_0x1b44('0x30')](_0x1b44('0x37'),_0x2381cf[_0x1b44('0x17')]),'webbar:conference');return _0x5375e8[_0x1b44('0x18')](0xc8)[_0x1b44('0x32')]({'error':![],'message':'conference\x20executed!'});})[_0x1b44('0x3a')](handleError(_0x5375e8));};exports[_0x1b44('0x47')]=function(_0x31ef8d,_0x29ec4f){logger['info']('transfer\x20fired:',_0x31ef8d[_0x1b44('0x2c')]);var _0x3b9ac8=transferValidation[_0x1b44('0xe')](_0x31ef8d[_0x1b44('0x2c')]);if(_0x3b9ac8[_0x1b44('0x26')]>0x0){return _0x29ec4f['status'](0x190)[_0x1b44('0x32')](_0x3b9ac8);}var _0x66a2d4=_0x31ef8d['body'][_0x1b44('0x2d')];var _0x2ac0da=_0x31ef8d[_0x1b44('0x2c')]['sessionId'];var _0x349ac5=_0x31ef8d[_0x1b44('0x2c')]['transferNumber'];return getAgent(_0x66a2d4)['then'](function(_0x8165e1){logger[_0x1b44('0x2a')](_0x1b44('0x36'),_0x8165e1[_0x1b44('0x17')]);emit(util[_0x1b44('0x30')](_0x1b44('0x37'),_0x8165e1[_0x1b44('0x17')]),_0x1b44('0x48'),{'sessionId':_0x2ac0da,'transferNumber':_0x349ac5});return _0x29ec4f[_0x1b44('0x18')](0xc8)[_0x1b44('0x32')]({'error':![],'message':_0x1b44('0x49')});})['catch'](handleError(_0x29ec4f));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 487f456..9bb2ac0 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 _0xbf8f=['path','express','Router','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','/describe','isAuthenticated','describe','/:id','show','getDispositions','getAnswers','/:id/users','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','addAgents','/:id/applications','addApplications','notify','/:id/send','put','delete','destroy','removeAnswers','removeAgents','exports','multer'];(function(_0x384dae,_0x346d06){var _0x2f1787=function(_0x3b86f1){while(--_0x3b86f1){_0x384dae['push'](_0x384dae['shift']());}};_0x2f1787(++_0x346d06);}(_0xbf8f,0xff));var _0xfbf8=function(_0x322fcc,_0xfd23ba){_0x322fcc=_0x322fcc-0x0;var _0x21c462=_0xbf8f[_0x322fcc];return _0x21c462;};'use strict';var multer=require(_0xfbf8('0x0'));var util=require('util');var path=require(_0xfbf8('0x1'));var timeout=require('connect-timeout');var express=require(_0xfbf8('0x2'));var router=express[_0xfbf8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfbf8('0x4'));var config=require(_0xfbf8('0x5'));var controller=require(_0xfbf8('0x6'));router[_0xfbf8('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfbf8('0x7')](_0xfbf8('0x8'),auth[_0xfbf8('0x9')](),controller[_0xfbf8('0xa')]);router['get'](_0xfbf8('0xb'),auth[_0xfbf8('0x9')](),controller[_0xfbf8('0xc')]);router['get']('/:id/dispositions',auth[_0xfbf8('0x9')](),controller[_0xfbf8('0xd')]);router['get']('/:id/canned_answers',auth[_0xfbf8('0x9')](),controller[_0xfbf8('0xe')]);router[_0xfbf8('0x7')](_0xfbf8('0xf'),auth[_0xfbf8('0x9')](),controller['getAgents']);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xfbf8('0x10')]('/',auth['isAuthenticated'](),controller[_0xfbf8('0x11')]);router[_0xfbf8('0x10')](_0xfbf8('0x12'),auth[_0xfbf8('0x9')](),controller[_0xfbf8('0x13')]);router[_0xfbf8('0x10')](_0xfbf8('0x14'),auth[_0xfbf8('0x9')](),controller['addAnswer']);router[_0xfbf8('0x10')](_0xfbf8('0xf'),auth[_0xfbf8('0x9')](),controller[_0xfbf8('0x15')]);router[_0xfbf8('0x10')](_0xfbf8('0x16'),auth['isAuthenticated'](),controller[_0xfbf8('0x17')]);router[_0xfbf8('0x10')]('/:id/notify',controller[_0xfbf8('0x18')]);router[_0xfbf8('0x10')](_0xfbf8('0x19'),auth['isAuthenticated'](),controller['send']);router[_0xfbf8('0x1a')](_0xfbf8('0xb'),auth[_0xfbf8('0x9')](),controller['update']);router[_0xfbf8('0x1b')](_0xfbf8('0xb'),auth[_0xfbf8('0x9')](),controller[_0xfbf8('0x1c')]);router[_0xfbf8('0x1b')](_0xfbf8('0x12'),auth[_0xfbf8('0x9')](),controller['removeDispositions']);router[_0xfbf8('0x1b')](_0xfbf8('0x14'),auth['isAuthenticated'](),controller[_0xfbf8('0x1d')]);router[_0xfbf8('0x1b')](_0xfbf8('0xf'),auth[_0xfbf8('0x9')](),controller[_0xfbf8('0x1e')]);module[_0xfbf8('0x1f')]=router; \ No newline at end of file +var _0x1c86=['/describe','describe','get','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','notify','/:id/send','send','put','update','/:id','destroy','delete','removeDispositions','removeAnswers','exports','connect-timeout','Router','../../components/interaction/service','./whatsappAccount.controller','isAuthenticated','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1c86,0x112));var _0x61c8=function(_0x2ff98a,_0x2ca3ab){_0x2ff98a=_0x2ff98a-0x0;var _0x2bcf36=_0x1c86[_0x2ff98a];return _0x2bcf36;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x61c8('0x0'));var express=require('express');var router=express[_0x61c8('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x61c8('0x2'));var config=require('../../config/environment');var controller=require(_0x61c8('0x3'));router['get']('/',auth[_0x61c8('0x4')](),controller[_0x61c8('0x5')]);router['get'](_0x61c8('0x6'),auth[_0x61c8('0x4')](),controller[_0x61c8('0x7')]);router[_0x61c8('0x8')]('/:id',auth[_0x61c8('0x4')](),controller[_0x61c8('0x9')]);router['get'](_0x61c8('0xa'),auth[_0x61c8('0x4')](),controller[_0x61c8('0xb')]);router['get'](_0x61c8('0xc'),auth['isAuthenticated'](),controller[_0x61c8('0xd')]);router[_0x61c8('0x8')](_0x61c8('0xe'),auth[_0x61c8('0x4')](),controller[_0x61c8('0xf')]);router[_0x61c8('0x8')](_0x61c8('0x10'),auth[_0x61c8('0x4')](),controller[_0x61c8('0x11')]);router[_0x61c8('0x12')]('/',auth[_0x61c8('0x4')](),controller[_0x61c8('0x13')]);router['post'](_0x61c8('0xa'),auth[_0x61c8('0x4')](),controller[_0x61c8('0x14')]);router[_0x61c8('0x12')](_0x61c8('0xc'),auth[_0x61c8('0x4')](),controller[_0x61c8('0x15')]);router['post']('/:id/users',auth[_0x61c8('0x4')](),controller[_0x61c8('0x16')]);router[_0x61c8('0x12')](_0x61c8('0x10'),auth['isAuthenticated'](),controller[_0x61c8('0x17')]);router[_0x61c8('0x12')]('/:id/notify',controller[_0x61c8('0x18')]);router[_0x61c8('0x12')](_0x61c8('0x19'),auth['isAuthenticated'](),controller[_0x61c8('0x1a')]);router[_0x61c8('0x1b')]('/:id',auth[_0x61c8('0x4')](),controller[_0x61c8('0x1c')]);router['delete'](_0x61c8('0x1d'),auth['isAuthenticated'](),controller[_0x61c8('0x1e')]);router[_0x61c8('0x1f')](_0x61c8('0xa'),auth[_0x61c8('0x4')](),controller[_0x61c8('0x20')]);router[_0x61c8('0x1f')](_0x61c8('0xc'),auth[_0x61c8('0x4')](),controller[_0x61c8('0x21')]);router[_0x61c8('0x1f')]('/:id/users',auth[_0x61c8('0x4')](),controller['removeAgents']);module[_0x61c8('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 3272803..5d746ad 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 _0x5970=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0xab649b,_0x1519e9){var _0x3b7584=function(_0x4b878e){while(--_0x4b878e){_0xab649b['push'](_0xab649b['shift']());}};_0x3b7584(++_0x1519e9);}(_0x5970,0xae));var _0x0597=function(_0x589c8b,_0x45e782){_0x589c8b=_0x589c8b-0x0;var _0x5bede1=_0x5970[_0x589c8b];return _0x5bede1;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0597('0x0'));module[_0x0597('0x1')]={'name':{'type':Sequelize[_0x0597('0x2')],'unique':_0x0597('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0597('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x0597('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0597('0x4')]();}},'phone':{'type':Sequelize[_0x0597('0x2')]},'type':{'type':Sequelize[_0x0597('0x5')](_0x0597('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0x0597('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x0597('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0597('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x0597('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0597('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0597('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0597('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0597('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0597('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0597('0x9')],'comment':_0x0597('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x0597('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x28cf9c){if(!_0x28cf9c){this[_0x0597('0xb')](_0x0597('0xc'),null);}this['setDataValue'](_0x0597('0xd'),_0x28cf9c);}},'description':{'type':Sequelize[_0x0597('0x2')]}}; \ No newline at end of file +var _0x8da0=['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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8da0,0x108));var _0x08da=function(_0x1d09f2,_0x263fa7){_0x1d09f2=_0x1d09f2-0x0;var _0x205d86=_0x8da0[_0x1d09f2];return _0x205d86;};'use strict';var Sequelize=require(_0x08da('0x0'));var rs=require(_0x08da('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x08da('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x08da('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x08da('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x08da('0x3')],'defaultValue':function(){return rs[_0x08da('0x4')]();}},'phone':{'type':Sequelize[_0x08da('0x3')]},'type':{'type':Sequelize[_0x08da('0x5')](_0x08da('0x6'),'sinch')},'accountSid':{'type':Sequelize[_0x08da('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x08da('0x3')]},'notificationTemplate':{'type':Sequelize[_0x08da('0x7')],'defaultValue':function(){return _0x08da('0x8');}},'notificationSound':{'type':Sequelize[_0x08da('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x08da('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x08da('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x08da('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x08da('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x08da('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x08da('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x08da('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2eb1fd){if(!_0x2eb1fd){this[_0x08da('0xc')](_0x08da('0xd'),null);}this[_0x08da('0xc')](_0x08da('0xe'),_0x2eb1fd);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 261bcbd..dcd8df6 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 _0x23cf=['isNil','to\x20is\x20mandatory','List','DESC','WhatsappInteraction','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','socket.io-emitter','./whatsappAccount.socket','register','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','params','Pause','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','getDispositions','Disposition','hasOwnProperty','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','ids','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','findOne','User','addApplications','sequelize','Transaction','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','stack','finally','getApplications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','Applications','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','from','From','whatsapp:','Body','messageId','MessageSid','notifications','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','CmList','list','omit','Contacts','contact','interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','queueId','WhatsappQueue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x23cf,0x189));var _0xf23c=function(_0x12f5c0,_0xe0aa51){_0x12f5c0=_0x12f5c0-0x0;var _0xf28dfd=_0x23cf[_0x12f5c0];return _0xf28dfd;};'use strict';var emlformat=require(_0xf23c('0x0'));var rimraf=require(_0xf23c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf23c('0x2'));var rp=require(_0xf23c('0x3'));var moment=require('moment');var BPromise=require(_0xf23c('0x4'));var Mustache=require(_0xf23c('0x5'));var util=require(_0xf23c('0x6'));var path=require(_0xf23c('0x7'));var sox=require(_0xf23c('0x8'));var csv=require(_0xf23c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf23c('0xa'));var _=require(_0xf23c('0xb'));var squel=require(_0xf23c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf23c('0x9'));var querystring=require(_0xf23c('0xd'));var Papa=require(_0xf23c('0xe'));var Redis=require(_0xf23c('0xf'));var authService=require(_0xf23c('0x10'));var qs=require(_0xf23c('0x11'));var as=require(_0xf23c('0x12'));var hardwareService=require(_0xf23c('0x13'));var logger=require(_0xf23c('0x14'))(_0xf23c('0x15'));var utils=require(_0xf23c('0x16'));var config=require(_0xf23c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xf23c('0x18')](config[_0xf23c('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xf23c('0x1a'))(new Redis(config['redis']));require(_0xf23c('0x1b'))[_0xf23c('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xf23c('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x1972ac,_0x35d4c3,_0x9b9cfe,_0x37e7f0){return new BPromise(function(_0x122cc0,_0x4815ae){var _0x28ec36=_0x37e7f0||client;return _0x28ec36[_0xf23c('0x1e')](_0x1972ac,_0x9b9cfe)[_0xf23c('0x1f')](function(_0x20ecc0){logger[_0xf23c('0x20')](_0xf23c('0x21'),_0x35d4c3,'request\x20sent');logger[_0xf23c('0x22')](_0xf23c('0x23'),_0x35d4c3,_0xf23c('0x24'),JSON['stringify'](_0x20ecc0));if(_0x20ecc0[_0xf23c('0x25')]){if(_0x20ecc0[_0xf23c('0x25')][_0xf23c('0x26')]===0x1f4){logger[_0xf23c('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x35d4c3,_0x20ecc0[_0xf23c('0x25')][_0xf23c('0x27')]);return _0x4815ae(_0x20ecc0[_0xf23c('0x25')]['message']);}logger[_0xf23c('0x25')](_0xf23c('0x21'),_0x35d4c3,_0x20ecc0[_0xf23c('0x25')][_0xf23c('0x27')]);return _0x122cc0(_0x20ecc0['error']['message']);}else{logger[_0xf23c('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x35d4c3,_0xf23c('0x24'));_0x122cc0(_0x20ecc0[_0xf23c('0x28')][_0xf23c('0x27')]);}})[_0xf23c('0x29')](function(_0x47bd99){logger['error'](_0xf23c('0x21'),_0x35d4c3,_0x47bd99);_0x4815ae(_0x47bd99);});});}function respondWithStatusCode(_0x31446e,_0x156372){_0x156372=_0x156372||0xcc;return function(_0x36f26e){if(_0x36f26e){return _0x31446e[_0xf23c('0x2a')](_0x156372);}return _0x31446e[_0xf23c('0x2b')](_0x156372)[_0xf23c('0x2c')]();};}function respondWithResult(_0x3f3808,_0x59a05e){_0x59a05e=_0x59a05e||0xc8;return function(_0x9dbf62){if(_0x9dbf62){return _0x3f3808[_0xf23c('0x2b')](_0x59a05e)[_0xf23c('0x2d')](_0x9dbf62);}};}function respondWithFilteredResult(_0x9780f9,_0x4073c4){return function(_0x41c1d2){if(_0x41c1d2){var _0x4b2002=typeof _0x4073c4[_0xf23c('0x2e')]===_0xf23c('0x2f')&&typeof _0x4073c4[_0xf23c('0x30')]==='undefined';var _0x48712c=_0x41c1d2[_0xf23c('0x31')];var _0x2ecc56=_0x4b2002?0x0:_0x4073c4[_0xf23c('0x2e')];var _0x255ff5=_0x4b2002?_0x41c1d2['count']:_0x4073c4[_0xf23c('0x2e')]+_0x4073c4['limit'];var _0x1288f3;if(_0x255ff5>=_0x48712c){_0x255ff5=_0x48712c;_0x1288f3=0xc8;}else{_0x1288f3=0xce;}_0x9780f9['status'](_0x1288f3);return _0x9780f9['set'](_0xf23c('0x32'),_0x2ecc56+'-'+_0x255ff5+'/'+_0x48712c)[_0xf23c('0x2d')](_0x41c1d2);}return null;};}function patchUpdates(_0xd05630){return function(_0x2890b1){try{jsonpatch['apply'](_0x2890b1,_0xd05630,!![]);}catch(_0x21996a){return BPromise[_0xf23c('0x33')](_0x21996a);}return _0x2890b1[_0xf23c('0x34')]();};}function saveUpdates(_0x5eddbd,_0x5e6ed2){return function(_0x1d869d){if(_0x1d869d){return _0x1d869d['update'](_0x5eddbd)['then'](function(_0x5b7733){return _0x5b7733;});}return null;};}function removeEntity(_0x212b29,_0x2fac76){return function(_0x2adae2){if(_0x2adae2){return _0x2adae2[_0xf23c('0x35')]()[_0xf23c('0x1f')](function(){var _0x5bf57d=_0x2adae2[_0xf23c('0x36')]({'plain':!![]});var _0xbeddd3=_0xf23c('0x37');return db[_0xf23c('0x38')][_0xf23c('0x35')]({'where':{'type':_0xbeddd3,'resourceId':_0x5bf57d['id']}})['then'](function(){return _0x2adae2;});})[_0xf23c('0x1f')](function(){_0x212b29[_0xf23c('0x2b')](0xcc)[_0xf23c('0x2c')]();});}};}function handleEntityNotFound(_0x4f5aff,_0x1ce987){return function(_0x493f95){if(!_0x493f95){_0x4f5aff[_0xf23c('0x2a')](0x194);}return _0x493f95;};}function handleError(_0x599a4d,_0x329b6e){_0x329b6e=_0x329b6e||0x1f4;return function(_0x44a245){logger['error'](_0x44a245['stack']);if(_0x44a245[_0xf23c('0x39')]){delete _0x44a245['name'];}_0x599a4d['status'](_0x329b6e)[_0xf23c('0x3a')](_0x44a245);};}exports[_0xf23c('0x3b')]=function(_0x49e8c2,_0x4a6b99){var _0x5ad594={'include':[{'model':db['Pause'],'as':_0xf23c('0x3c')}]},_0x4e7644={},_0x28f890={'count':0x0,'rows':[]};var _0x1d6a86=_[_0xf23c('0x3d')](db[_0xf23c('0x3e')][_0xf23c('0x3f')],function(_0x16b103){return{'name':_0x16b103['fieldName'],'type':_0x16b103[_0xf23c('0x40')][_0xf23c('0x41')]};});_0x4e7644[_0xf23c('0x42')]=_[_0xf23c('0x3d')](_0x1d6a86,_0xf23c('0x39'));_0x4e7644[_0xf23c('0x43')]=_['keys'](_0x49e8c2[_0xf23c('0x43')]);_0x4e7644[_0xf23c('0x44')]=_[_0xf23c('0x45')](_0x4e7644[_0xf23c('0x42')],_0x4e7644['query']);_0x5ad594[_0xf23c('0x46')]=_[_0xf23c('0x45')](_0x4e7644[_0xf23c('0x42')],qs[_0xf23c('0x47')](_0x49e8c2['query']['fields']));_0x5ad594['attributes']=_0x5ad594[_0xf23c('0x46')][_0xf23c('0x48')]?_0x5ad594['attributes']:_0x4e7644[_0xf23c('0x42')];if(!_0x49e8c2['query']['hasOwnProperty'](_0xf23c('0x49'))){_0x5ad594[_0xf23c('0x30')]=qs[_0xf23c('0x30')](_0x49e8c2[_0xf23c('0x43')][_0xf23c('0x30')]);_0x5ad594[_0xf23c('0x2e')]=qs[_0xf23c('0x2e')](_0x49e8c2[_0xf23c('0x43')][_0xf23c('0x2e')]);}_0x5ad594[_0xf23c('0x4a')]=qs[_0xf23c('0x4b')](_0x49e8c2[_0xf23c('0x43')][_0xf23c('0x4b')]);_0x5ad594['where']=qs[_0xf23c('0x44')](_[_0xf23c('0x4c')](_0x49e8c2[_0xf23c('0x43')],_0x4e7644['filters']),_0x1d6a86);if(_0x49e8c2[_0xf23c('0x43')][_0xf23c('0x4d')]){_0x5ad594['where']=_[_0xf23c('0x4e')](_0x5ad594[_0xf23c('0x4f')],{'$or':_[_0xf23c('0x3d')](_0x1d6a86,function(_0x50f0fd){if(_0x50f0fd['type']!==_0xf23c('0x50')){var _0x5a9f3e={};_0x5a9f3e[_0x50f0fd[_0xf23c('0x39')]]={'$like':'%'+_0x49e8c2[_0xf23c('0x43')][_0xf23c('0x4d')]+'%'};return _0x5a9f3e;}})});}_0x5ad594=_[_0xf23c('0x4e')]({},_0x5ad594,_0x49e8c2[_0xf23c('0x51')]);var _0x245f4d={'where':_0x5ad594['where']};return db['WhatsappAccount'][_0xf23c('0x31')](_0x245f4d)[_0xf23c('0x1f')](function(_0x3dc160){_0x28f890['count']=_0x3dc160;if(_0x49e8c2[_0xf23c('0x43')][_0xf23c('0x52')]){_0x5ad594['include']=[{'all':!![]}];}return db[_0xf23c('0x3e')][_0xf23c('0x53')](_0x5ad594);})['then'](function(_0x46277d){_0x28f890[_0xf23c('0x54')]=_0x46277d;return _0x28f890;})[_0xf23c('0x1f')](respondWithFilteredResult(_0x4a6b99,_0x5ad594))[_0xf23c('0x29')](handleError(_0x4a6b99,null));};exports['show']=function(_0x2ac3dc,_0x2f1d32){var _0x28111d={'raw':![],'where':{'id':_0x2ac3dc[_0xf23c('0x55')]['id']},'include':[{'model':db[_0xf23c('0x56')],'as':_0xf23c('0x3c')}]},_0x504412={};_0x504412[_0xf23c('0x42')]=_[_0xf23c('0x57')](db[_0xf23c('0x3e')][_0xf23c('0x3f')]);_0x504412[_0xf23c('0x43')]=_[_0xf23c('0x57')](_0x2ac3dc[_0xf23c('0x43')]);_0x504412[_0xf23c('0x44')]=_['intersection'](_0x504412[_0xf23c('0x42')],_0x504412[_0xf23c('0x43')]);_0x28111d[_0xf23c('0x46')]=_[_0xf23c('0x45')](_0x504412[_0xf23c('0x42')],qs['fields'](_0x2ac3dc['query'][_0xf23c('0x47')]));_0x28111d['attributes']=_0x28111d[_0xf23c('0x46')][_0xf23c('0x48')]?_0x28111d[_0xf23c('0x46')]:_0x504412[_0xf23c('0x42')];if(_0x2ac3dc[_0xf23c('0x43')]['includeAll']){_0x28111d[_0xf23c('0x58')]=[{'all':!![]}];}_0x28111d=_[_0xf23c('0x4e')]({},_0x28111d,_0x2ac3dc[_0xf23c('0x51')]);return db[_0xf23c('0x3e')][_0xf23c('0x59')](_0x28111d)['then'](handleEntityNotFound(_0x2f1d32,null))['then'](respondWithResult(_0x2f1d32,null))[_0xf23c('0x29')](handleError(_0x2f1d32,null));};exports[_0xf23c('0x5a')]=function(_0x4a003d,_0xa62df4){return db['WhatsappAccount'][_0xf23c('0x5a')](_0x4a003d[_0xf23c('0x5b')],{})[_0xf23c('0x1f')](function(_0x4de1af){var _0x48a92b=_0x4a003d[_0xf23c('0x5c')]['get']({'plain':!![]});if(!_0x48a92b)throw new Error(_0xf23c('0x5d'));if(_0x48a92b['role']===_0xf23c('0x5c')){var _0x2e1b28=_0x4de1af[_0xf23c('0x36')]({'plain':!![]});var _0x57d965='WhatsappAccounts';return db[_0xf23c('0x5e')]['find']({'where':{'name':_0x57d965,'userProfileId':_0x48a92b[_0xf23c('0x5f')]},'raw':!![]})[_0xf23c('0x1f')](function(_0xf10a1a){if(_0xf10a1a&&_0xf10a1a[_0xf23c('0x60')]===0x0){return db[_0xf23c('0x38')]['create']({'name':_0x2e1b28[_0xf23c('0x39')],'resourceId':_0x2e1b28['id'],'type':_0xf10a1a[_0xf23c('0x39')],'sectionId':_0xf10a1a['id']},{})[_0xf23c('0x1f')](function(){return _0x4de1af;});}else{return _0x4de1af;}})[_0xf23c('0x29')](function(_0xe0c4c){logger[_0xf23c('0x25')](_0xf23c('0x61'),_0xe0c4c);throw _0xe0c4c;});}return _0x4de1af;})[_0xf23c('0x1f')](respondWithResult(_0xa62df4,0xc9))['catch'](handleError(_0xa62df4,null));};exports[_0xf23c('0x62')]=function(_0x2d3a0c,_0x1e59e1){if(_0x2d3a0c[_0xf23c('0x5b')]['id']){delete _0x2d3a0c[_0xf23c('0x5b')]['id'];}return db[_0xf23c('0x3e')][_0xf23c('0x59')]({'where':{'id':_0x2d3a0c[_0xf23c('0x55')]['id']},'include':[{'model':db[_0xf23c('0x56')],'as':_0xf23c('0x3c')}]})[_0xf23c('0x1f')](handleEntityNotFound(_0x1e59e1,null))[_0xf23c('0x1f')](saveUpdates(_0x2d3a0c[_0xf23c('0x5b')],null))[_0xf23c('0x1f')](respondWithResult(_0x1e59e1,null))[_0xf23c('0x29')](handleError(_0x1e59e1,null));};exports['destroy']=function(_0xa1c76b,_0x4d95a4){return db[_0xf23c('0x3e')][_0xf23c('0x59')]({'where':{'id':_0xa1c76b[_0xf23c('0x55')]['id']}})[_0xf23c('0x1f')](handleEntityNotFound(_0x4d95a4,null))[_0xf23c('0x1f')](removeEntity(_0x4d95a4,null))[_0xf23c('0x29')](handleError(_0x4d95a4,null));};exports['describe']=function(_0x3c78db,_0x267afc){return db['WhatsappAccount'][_0xf23c('0x63')]()[_0xf23c('0x1f')](respondWithResult(_0x267afc,null))[_0xf23c('0x29')](handleError(_0x267afc,null));};exports[_0xf23c('0x64')]=function(_0x3002a0,_0x1dedc2,_0x5c878a){if(_0x3002a0[_0xf23c('0x5b')]['id']){delete _0x3002a0[_0xf23c('0x5b')]['id'];}return db[_0xf23c('0x3e')]['find']({'where':{'id':_0x3002a0[_0xf23c('0x55')]['id']}})[_0xf23c('0x1f')](handleEntityNotFound(_0x1dedc2,null))[_0xf23c('0x1f')](function(_0x3d8f57){if(_0x3d8f57){_0x3002a0['body'][_0xf23c('0x65')]=_0x3d8f57['id'];return db['Disposition'][_0xf23c('0x5a')](_0x3002a0[_0xf23c('0x5b')]);}})['then'](respondWithResult(_0x1dedc2,null))[_0xf23c('0x29')](handleError(_0x1dedc2,null));};exports[_0xf23c('0x66')]=function(_0x3d1287,_0x11a2df,_0xb3e7fb){var _0x5410a5={'raw':![],'where':{}};var _0x3841df={};var _0x3d37a6={'count':0x0,'rows':[]};return db[_0xf23c('0x3e')]['findOne']({'where':{'id':_0x3d1287['params']['id']}})[_0xf23c('0x1f')](handleEntityNotFound(_0x11a2df,null))[_0xf23c('0x1f')](function(_0x1f10a0){if(_0x1f10a0){_0x3841df[_0xf23c('0x42')]=_[_0xf23c('0x57')](db[_0xf23c('0x67')]['rawAttributes']);_0x3841df['query']=_['keys'](_0x3d1287[_0xf23c('0x43')]);_0x3841df[_0xf23c('0x44')]=_[_0xf23c('0x45')](_0x3841df[_0xf23c('0x42')],_0x3841df[_0xf23c('0x43')]);_0x5410a5['attributes']=_[_0xf23c('0x45')](_0x3841df[_0xf23c('0x42')],qs[_0xf23c('0x47')](_0x3d1287[_0xf23c('0x43')]['fields']));_0x5410a5[_0xf23c('0x46')]=_0x5410a5['attributes'][_0xf23c('0x48')]?_0x5410a5[_0xf23c('0x46')]:_0x3841df[_0xf23c('0x42')];if(!_0x3d1287['query'][_0xf23c('0x68')](_0xf23c('0x49'))){_0x5410a5[_0xf23c('0x30')]=qs[_0xf23c('0x30')](_0x3d1287[_0xf23c('0x43')][_0xf23c('0x30')]);_0x5410a5[_0xf23c('0x2e')]=qs['offset'](_0x3d1287[_0xf23c('0x43')][_0xf23c('0x2e')]);}_0x5410a5[_0xf23c('0x4a')]=qs['sort'](_0x3d1287[_0xf23c('0x43')][_0xf23c('0x4b')]);_0x5410a5[_0xf23c('0x4f')]=qs['filters'](_[_0xf23c('0x4c')](_0x3d1287[_0xf23c('0x43')],_0x3841df[_0xf23c('0x44')]));_0x5410a5[_0xf23c('0x4f')][_0xf23c('0x65')]=_0x1f10a0['id'];if(_0x3d1287['query'][_0xf23c('0x4d')]){_0x5410a5[_0xf23c('0x4f')]=_[_0xf23c('0x4e')](_0x5410a5['where'],{'$or':_[_0xf23c('0x3d')](_0x5410a5[_0xf23c('0x46')],function(_0x446181){var _0x2e95b0={};_0x2e95b0[_0x446181]={'$like':'%'+_0x3d1287['query'][_0xf23c('0x4d')]+'%'};return _0x2e95b0;})});}_0x5410a5=_[_0xf23c('0x4e')]({},_0x5410a5,_0x3d1287[_0xf23c('0x51')]);return db[_0xf23c('0x67')][_0xf23c('0x31')]({'where':_0x5410a5['where']})[_0xf23c('0x1f')](function(_0x461929){_0x3d37a6['count']=_0x461929;if(_0x3d1287[_0xf23c('0x43')]['includeAll']){_0x5410a5['include']=[{'all':!![]}];}return db[_0xf23c('0x67')][_0xf23c('0x53')](_0x5410a5);})['then'](function(_0x302f46){_0x3d37a6[_0xf23c('0x54')]=_0x302f46;return _0x3d37a6;});}})[_0xf23c('0x1f')](respondWithFilteredResult(_0x11a2df,_0x5410a5))[_0xf23c('0x29')](handleError(_0x11a2df,null));};exports['removeDispositions']=function(_0x203d3d,_0xb19c14,_0x5d229a){return db[_0xf23c('0x3e')][_0xf23c('0x59')]({'where':{'id':_0x203d3d['params']['id']}})[_0xf23c('0x1f')](handleEntityNotFound(_0xb19c14,null))[_0xf23c('0x1f')](function(_0x15cbf8){if(_0x15cbf8){return _0x15cbf8['removeDispositions'](_0x203d3d[_0xf23c('0x43')]['ids']);}})[_0xf23c('0x1f')](respondWithStatusCode(_0xb19c14,null))[_0xf23c('0x29')](handleError(_0xb19c14,null));};exports[_0xf23c('0x69')]=function(_0x290ce8,_0x3252ef,_0x22825a){if(_0x290ce8[_0xf23c('0x5b')]['id']){delete _0x290ce8[_0xf23c('0x5b')]['id'];}return db[_0xf23c('0x3e')][_0xf23c('0x59')]({'where':{'id':_0x290ce8['params']['id']}})[_0xf23c('0x1f')](handleEntityNotFound(_0x3252ef,null))[_0xf23c('0x1f')](function(_0x1dcf10){if(_0x1dcf10){_0x290ce8[_0xf23c('0x5b')][_0xf23c('0x65')]=_0x1dcf10['id'];return db['CannedAnswer']['create'](_0x290ce8[_0xf23c('0x5b')]);}})[_0xf23c('0x1f')](respondWithResult(_0x3252ef,null))[_0xf23c('0x29')](handleError(_0x3252ef,null));};exports[_0xf23c('0x6a')]=function(_0x3fb940,_0x58a61e,_0x167007){var _0x1bc05a={'raw':![],'where':{}};var _0x359000={};var _0x2907b9={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x3fb940['params']['id']}})[_0xf23c('0x1f')](handleEntityNotFound(_0x58a61e,null))[_0xf23c('0x1f')](function(_0x576156){if(_0x576156){_0x359000[_0xf23c('0x42')]=_['keys'](db[_0xf23c('0x6b')][_0xf23c('0x3f')]);_0x359000['query']=_[_0xf23c('0x57')](_0x3fb940[_0xf23c('0x43')]);_0x359000['filters']=_[_0xf23c('0x45')](_0x359000[_0xf23c('0x42')],_0x359000[_0xf23c('0x43')]);_0x1bc05a['attributes']=_[_0xf23c('0x45')](_0x359000[_0xf23c('0x42')],qs['fields'](_0x3fb940[_0xf23c('0x43')]['fields']));_0x1bc05a[_0xf23c('0x46')]=_0x1bc05a['attributes'][_0xf23c('0x48')]?_0x1bc05a['attributes']:_0x359000[_0xf23c('0x42')];if(!_0x3fb940['query']['hasOwnProperty']('nolimit')){_0x1bc05a['limit']=qs['limit'](_0x3fb940[_0xf23c('0x43')][_0xf23c('0x30')]);_0x1bc05a[_0xf23c('0x2e')]=qs[_0xf23c('0x2e')](_0x3fb940[_0xf23c('0x43')][_0xf23c('0x2e')]);}_0x1bc05a[_0xf23c('0x4a')]=qs[_0xf23c('0x4b')](_0x3fb940['query'][_0xf23c('0x4b')]);_0x1bc05a[_0xf23c('0x4f')]=qs[_0xf23c('0x44')](_[_0xf23c('0x4c')](_0x3fb940['query'],_0x359000['filters']));_0x1bc05a[_0xf23c('0x4f')][_0xf23c('0x65')]=_0x576156['id'];if(_0x3fb940[_0xf23c('0x43')][_0xf23c('0x4d')]){_0x1bc05a[_0xf23c('0x4f')]=_[_0xf23c('0x4e')](_0x1bc05a['where'],{'$or':_[_0xf23c('0x3d')](_0x1bc05a[_0xf23c('0x46')],function(_0x520f0f){var _0x269c20={};_0x269c20[_0x520f0f]={'$like':'%'+_0x3fb940['query'][_0xf23c('0x4d')]+'%'};return _0x269c20;})});}_0x1bc05a=_[_0xf23c('0x4e')]({},_0x1bc05a,_0x3fb940[_0xf23c('0x51')]);return db[_0xf23c('0x6b')][_0xf23c('0x31')]({'where':_0x1bc05a[_0xf23c('0x4f')]})['then'](function(_0x5c6142){_0x2907b9[_0xf23c('0x31')]=_0x5c6142;if(_0x3fb940[_0xf23c('0x43')][_0xf23c('0x52')]){_0x1bc05a[_0xf23c('0x58')]=[{'all':!![]}];}return db[_0xf23c('0x6b')][_0xf23c('0x53')](_0x1bc05a);})[_0xf23c('0x1f')](function(_0x27af81){_0x2907b9['rows']=_0x27af81;return _0x2907b9;});}})['then'](respondWithFilteredResult(_0x58a61e,_0x1bc05a))[_0xf23c('0x29')](handleError(_0x58a61e,null));};exports[_0xf23c('0x6c')]=function(_0x367822,_0x47ceb4,_0x17cabe){return db[_0xf23c('0x3e')][_0xf23c('0x59')]({'where':{'id':_0x367822['params']['id']}})[_0xf23c('0x1f')](handleEntityNotFound(_0x47ceb4,null))[_0xf23c('0x1f')](function(_0x5439a1){if(_0x5439a1){return _0x5439a1[_0xf23c('0x6c')](_0x367822[_0xf23c('0x43')]['ids']);}})[_0xf23c('0x1f')](respondWithStatusCode(_0x47ceb4,null))['catch'](handleError(_0x47ceb4,null));};exports[_0xf23c('0x6d')]=function(_0x3acaa4,_0x202514,_0xd5f63b){return db[_0xf23c('0x3e')]['find']({'where':{'id':_0x3acaa4[_0xf23c('0x55')]['id']}})['then'](handleEntityNotFound(_0x202514,null))[_0xf23c('0x1f')](function(_0x5970af){if(_0x5970af){return _0x5970af['addAgents'](_0x3acaa4[_0xf23c('0x5b')]['ids'],_['omit'](_0x3acaa4['body'],[_0xf23c('0x6e'),'id'])||{})[_0xf23c('0x6f')](function(_0x22b81b){for(var _0x51718f=0x0;_0x51718f<_0x3acaa4[_0xf23c('0x5b')][_0xf23c('0x6e')][_0xf23c('0x48')];_0x51718f+=0x1){socket[_0xf23c('0x70')](_0xf23c('0x71'),{'UserId':Number(_0x3acaa4[_0xf23c('0x5b')]['ids'][_0x51718f]),'WhatsappAccountId':Number(_0x3acaa4[_0xf23c('0x55')]['id'])});}return _0x22b81b;});}})['then'](respondWithResult(_0x202514,null))[_0xf23c('0x29')](handleError(_0x202514,null));};exports['removeAgents']=function(_0x133b21,_0x3909b5,_0x41f4d1){return db['WhatsappAccount'][_0xf23c('0x59')]({'where':{'id':_0x133b21[_0xf23c('0x55')]['id']}})[_0xf23c('0x1f')](handleEntityNotFound(_0x3909b5,null))[_0xf23c('0x1f')](function(_0x4b0d2b){if(_0x4b0d2b){return _0x4b0d2b[_0xf23c('0x72')](_0x133b21['query']['ids'])[_0xf23c('0x1f')](function(){if(_['isArray'](_0x133b21[_0xf23c('0x43')]['ids'])){for(var _0x2c3d50=0x0;_0x2c3d50<_0x133b21[_0xf23c('0x43')]['ids'][_0xf23c('0x48')];_0x2c3d50+=0x1){socket[_0xf23c('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x133b21[_0xf23c('0x43')][_0xf23c('0x6e')][_0x2c3d50]),'WhatsappAccountId':Number(_0x133b21[_0xf23c('0x55')]['id'])});}}else{socket[_0xf23c('0x70')](_0xf23c('0x73'),{'UserId':Number(_0x133b21[_0xf23c('0x43')][_0xf23c('0x6e')]),'WhatsappAccountId':Number(_0x133b21[_0xf23c('0x55')]['id'])});}});}})[_0xf23c('0x1f')](respondWithStatusCode(_0x3909b5,null))[_0xf23c('0x29')](handleError(_0x3909b5,null));};exports[_0xf23c('0x74')]=function(_0x191638,_0x2e29f4,_0x1f4f05){var _0x5f4f79={};var _0x47fa55={};var _0x1be606;var _0x156072;return db[_0xf23c('0x3e')][_0xf23c('0x75')]({'where':{'id':_0x191638[_0xf23c('0x55')]['id']}})[_0xf23c('0x1f')](handleEntityNotFound(_0x2e29f4,null))[_0xf23c('0x1f')](function(_0x372fc6){if(_0x372fc6){_0x1be606=_0x372fc6;_0x47fa55['model']=_['keys'](db[_0xf23c('0x76')][_0xf23c('0x3f')]);_0x47fa55[_0xf23c('0x43')]=_[_0xf23c('0x57')](_0x191638[_0xf23c('0x43')]);_0x47fa55[_0xf23c('0x44')]=_['intersection'](_0x47fa55[_0xf23c('0x42')],_0x47fa55[_0xf23c('0x43')]);_0x5f4f79['attributes']=_[_0xf23c('0x45')](_0x47fa55['model'],qs[_0xf23c('0x47')](_0x191638['query'][_0xf23c('0x47')]));_0x5f4f79[_0xf23c('0x46')]=_0x5f4f79[_0xf23c('0x46')]['length']?_0x5f4f79[_0xf23c('0x46')]:_0x47fa55['model'];_0x5f4f79[_0xf23c('0x4a')]=qs[_0xf23c('0x4b')](_0x191638[_0xf23c('0x43')][_0xf23c('0x4b')]);_0x5f4f79['where']=qs[_0xf23c('0x44')](_[_0xf23c('0x4c')](_0x191638[_0xf23c('0x43')],_0x47fa55[_0xf23c('0x44')]));if(_0x191638[_0xf23c('0x43')][_0xf23c('0x4d')]){_0x5f4f79[_0xf23c('0x4f')]=_[_0xf23c('0x4e')](_0x5f4f79[_0xf23c('0x4f')],{'$or':_[_0xf23c('0x3d')](_0x5f4f79[_0xf23c('0x46')],function(_0x140fde){var _0x8f1a52={};_0x8f1a52[_0x140fde]={'$like':'%'+_0x191638['query'][_0xf23c('0x4d')]+'%'};return _0x8f1a52;})});}_0x5f4f79=_[_0xf23c('0x4e')]({},_0x5f4f79,_0x191638['options']);return _0x1be606[_0xf23c('0x74')](_0x5f4f79);}})[_0xf23c('0x1f')](function(_0x2a9c39){if(_0x2a9c39){_0x156072=_0x2a9c39[_0xf23c('0x48')];if(!_0x191638[_0xf23c('0x43')][_0xf23c('0x68')](_0xf23c('0x49'))){_0x5f4f79[_0xf23c('0x30')]=qs['limit'](_0x191638['query'][_0xf23c('0x30')]);_0x5f4f79[_0xf23c('0x2e')]=qs[_0xf23c('0x2e')](_0x191638[_0xf23c('0x43')][_0xf23c('0x2e')]);}return _0x1be606[_0xf23c('0x74')](_0x5f4f79);}})[_0xf23c('0x1f')](function(_0x31776e){if(_0x31776e){return _0x31776e?{'count':_0x156072,'rows':_0x31776e}:null;}})['then'](respondWithResult(_0x2e29f4,null))[_0xf23c('0x29')](handleError(_0x2e29f4,null));};exports[_0xf23c('0x77')]=function(_0x576e44,_0x3d6f01){var _0x455e13=_0x576e44[_0xf23c('0x55')]['id'];var _0x14828c=_0x576e44[_0xf23c('0x5b')];var _0x5660b1=0xc8;var _0x11f9af=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xf23c('0x78')][_0xf23c('0x79')]['ISOLATION_LEVELS'][_0xf23c('0x7a')]},function(_0x4bb2cb){return db[_0xf23c('0x3e')][_0xf23c('0x75')]({'where':{'id':_0x455e13},'transaction':_0x4bb2cb})['then'](function(_0x99ce2){if(_0x99ce2){return db[_0xf23c('0x7b')][_0xf23c('0x35')]({'where':{'WhatsappAccountId':_0x455e13},'transaction':_0x4bb2cb})[_0xf23c('0x1f')](function(){var _0x2c0479=_[_0xf23c('0x3d')](_0x14828c,function(_0x5357c9){_0x5357c9['WhatsappAccountId']=_0x455e13;return _0x5357c9;});return db[_0xf23c('0x7b')]['bulkCreate'](_0x2c0479,{'transaction':_0x4bb2cb});});}else{_0x5660b1=0x194;_0x11f9af=[];}});})[_0xf23c('0x1f')](function(){if(_0x5660b1!==0x194){return db['WhatsappApplication'][_0xf23c('0x7c')]({'where':{'WhatsappAccountId':_0x455e13},'order':_0xf23c('0x7d')})[_0xf23c('0x1f')](function(_0x4e03c7){_0x11f9af=_0x4e03c7;});}})[_0xf23c('0x29')](function(_0x3d2859){_0x5660b1=0x1f4;logger['error'](_0x3d2859[_0xf23c('0x7e')]);if(_0x3d2859['name']){delete _0x3d2859[_0xf23c('0x39')];}_0x11f9af=_0x3d2859;})[_0xf23c('0x7f')](function(){if(_0x11f9af===null){_0x3d6f01[_0xf23c('0x2a')](_0x5660b1);}else{if(_0x5660b1===0x1f4){_0x3d6f01[_0xf23c('0x2b')](_0x5660b1)[_0xf23c('0x3a')](_0x11f9af);}else{_0x3d6f01['status'](_0x5660b1)[_0xf23c('0x2d')](_0x11f9af);}}});};exports['getApplications']=function(_0x58f2ca,_0x195c2f,_0x222caa){var _0x37de31={};var _0x537533={};var _0x5e739f;var _0x2246f2;return db[_0xf23c('0x3e')]['findOne']({'where':{'id':_0x58f2ca['params']['id']}})[_0xf23c('0x1f')](handleEntityNotFound(_0x195c2f,null))['then'](function(_0x48f3b9){if(_0x48f3b9){_0x5e739f=_0x48f3b9;_0x537533['model']=_['keys'](db[_0xf23c('0x7b')][_0xf23c('0x3f')]);_0x537533['query']=_[_0xf23c('0x57')](_0x58f2ca[_0xf23c('0x43')]);_0x537533[_0xf23c('0x44')]=_[_0xf23c('0x45')](_0x537533[_0xf23c('0x42')],_0x537533['query']);_0x37de31[_0xf23c('0x46')]=_[_0xf23c('0x45')](_0x537533['model'],qs[_0xf23c('0x47')](_0x58f2ca[_0xf23c('0x43')]['fields']));_0x37de31[_0xf23c('0x46')]=_0x37de31[_0xf23c('0x46')]['length']?_0x37de31[_0xf23c('0x46')]:_0x537533[_0xf23c('0x42')];_0x37de31['order']=qs['sort'](_0x58f2ca[_0xf23c('0x43')][_0xf23c('0x4b')]);_0x37de31[_0xf23c('0x4f')]=qs[_0xf23c('0x44')](_[_0xf23c('0x4c')](_0x58f2ca[_0xf23c('0x43')],_0x537533[_0xf23c('0x44')]));if(_0x58f2ca[_0xf23c('0x43')]['filter']){_0x37de31['where']=_['merge'](_0x37de31['where'],{'$or':_[_0xf23c('0x3d')](_0x37de31[_0xf23c('0x46')],function(_0x5c8097){var _0x40369e={};_0x40369e[_0x5c8097]={'$like':'%'+_0x58f2ca[_0xf23c('0x43')][_0xf23c('0x4d')]+'%'};return _0x40369e;})});}_0x37de31=_['merge']({},_0x37de31,_0x58f2ca[_0xf23c('0x51')]);return _0x5e739f[_0xf23c('0x80')](_0x37de31);}})[_0xf23c('0x1f')](function(_0x9d6b32){if(_0x9d6b32){_0x2246f2=_0x9d6b32[_0xf23c('0x48')];if(!_0x58f2ca['query'][_0xf23c('0x68')](_0xf23c('0x49'))){_0x37de31[_0xf23c('0x30')]=qs[_0xf23c('0x30')](_0x58f2ca[_0xf23c('0x43')][_0xf23c('0x30')]);_0x37de31[_0xf23c('0x2e')]=qs[_0xf23c('0x2e')](_0x58f2ca[_0xf23c('0x43')][_0xf23c('0x2e')]);}return _0x5e739f['getApplications'](_0x37de31);}})[_0xf23c('0x1f')](function(_0x2f5a3e){if(_0x2f5a3e){return _0x2f5a3e?{'count':_0x2246f2,'rows':_0x2f5a3e}:null;}})[_0xf23c('0x1f')](respondWithResult(_0x195c2f,null))[_0xf23c('0x29')](handleError(_0x195c2f,null));};exports['notify']=function(_0x16b5a4,_0x433924,_0x1aac3e){var _0x5c0969={'channel':'whatsapp'};var _0x31e174=[];var _0x22850c=[];var _0xfb6df8={};return db['WhatsappAccount'][_0xf23c('0x59')]({'where':{'id':_0x16b5a4[_0xf23c('0x55')]['id']},'include':[{'model':db[_0xf23c('0x7b')],'as':'Applications'}]})[_0xf23c('0x1f')](handleEntityNotFound(_0x433924,null))[_0xf23c('0x1f')](function(_0x3c6f2f){_0x5c0969['account']=_0x3c6f2f;if(_0x5c0969[_0xf23c('0x81')]&&_0x5c0969[_0xf23c('0x81')][_0xf23c('0x40')]===_0xf23c('0x82')&&_0x16b5a4[_0xf23c('0x5b')][_0xf23c('0x83')]){if(_0x16b5a4[_0xf23c('0x5b')][_0xf23c('0x83')][_0xf23c('0x48')]===0x0)return;if(_0x16b5a4[_0xf23c('0x5b')][_0xf23c('0x83')][0x0][_0xf23c('0x84')]!==_0xf23c('0x85'))return;return db[_0xf23c('0x86')][_0xf23c('0x62')]({'read':!![],'readAt':_0x16b5a4[_0xf23c('0x5b')][_0xf23c('0x83')][0x0][_0xf23c('0x87')]},{'where':{'messageId':_0x16b5a4[_0xf23c('0x5b')][_0xf23c('0x83')][0x0]['message_id']},'individualHooks':!![]})[_0xf23c('0x1f')](function(_0x264b62){return _0x433924[_0xf23c('0x2b')](0xc8)[_0xf23c('0x2d')](_0x264b62);});}_0x5c0969[_0xf23c('0x88')]=_[_0xf23c('0x89')](_0x3c6f2f[_0xf23c('0x8a')],[_0xf23c('0x7d')],['asc']);if(_0x5c0969[_0xf23c('0x81')]['Applications']){delete _0x5c0969['account']['Applications'];}return db[_0xf23c('0x8b')][_0xf23c('0x63')]()[_0xf23c('0x1f')](function(_0x58b31d){if(!_0x58b31d){throw new db['Sequelize'][(_0xf23c('0x8c'))](_0xf23c('0x8d'));}_0x31e174=_[_0xf23c('0x8e')](_[_0xf23c('0x57')](_0x58b31d),[_0xf23c('0x8f'),_0xf23c('0x90')]);_0x22850c=_['difference'](_[_0xf23c('0x57')](_0x58b31d),['createdAt',_0xf23c('0x90'),'CompanyId',_0xf23c('0x91')]);_0x5c0969[_0xf23c('0x5b')]={'mapKey':'mobile'};if(_0x5c0969['account']&&_0x5c0969[_0xf23c('0x81')][_0xf23c('0x40')]===_0xf23c('0x92')){_0x5c0969[_0xf23c('0x5b')][_0xf23c('0x93')]=_0x16b5a4[_0xf23c('0x5b')][_0xf23c('0x94')]['replace'](_0xf23c('0x95'),'');_0x5c0969['body'][_0xf23c('0x5b')]=_0x16b5a4['body'][_0xf23c('0x96')];_0x5c0969[_0xf23c('0x5b')][_0xf23c('0x97')]=_0x16b5a4['body'][_0xf23c('0x98')];}if(_0x5c0969[_0xf23c('0x81')]&&_0x5c0969[_0xf23c('0x81')][_0xf23c('0x40')]===_0xf23c('0x82')){_0x5c0969[_0xf23c('0x5b')][_0xf23c('0x93')]=_0x16b5a4['body'][_0xf23c('0x99')][0x0][_0xf23c('0x93')];_0x5c0969['body']['body']=_0x16b5a4[_0xf23c('0x5b')][_0xf23c('0x99')][0x0][_0xf23c('0x27')][_0xf23c('0x5b')];_0x5c0969[_0xf23c('0x5b')]['messageId']=_0x16b5a4[_0xf23c('0x5b')][_0xf23c('0x99')][0x0]['message_id'];}if(_0x5c0969[_0xf23c('0x5b')]['id']){delete _0x5c0969[_0xf23c('0x5b')]['id'];}if(_['isNil'](_0x5c0969[_0xf23c('0x5b')][_0xf23c('0x93')])){throw new db[(_0xf23c('0x9a'))][(_0xf23c('0x8c'))](_0xf23c('0x9b'));}if(_['isNil'](_0x5c0969[_0xf23c('0x5b')][_0xf23c('0x5b')])||_0x5c0969[_0xf23c('0x5b')]['body']===''){throw new db[(_0xf23c('0x9a'))][(_0xf23c('0x8c'))](_0xf23c('0x9c'));}if(_['isNil'](_0x5c0969[_0xf23c('0x5b')]['mapKey'])){throw new db[(_0xf23c('0x9a'))][(_0xf23c('0x8c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x22850c);}if(!_[_0xf23c('0x9d')](_0x22850c,_0x5c0969[_0xf23c('0x5b')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x22850c);}_0xfb6df8[_0x5c0969[_0xf23c('0x5b')][_0xf23c('0x9e')]]=_0x5c0969[_0xf23c('0x5b')][_0xf23c('0x93')];return db[_0xf23c('0x9f')][_0xf23c('0x59')]({'where':{'id':_0x5c0969['account'][_0xf23c('0x91')]},'include':[{'model':db[_0xf23c('0x8b')],'as':'Contacts','where':_0xfb6df8,'limit':0x1,'order':[[_0xf23c('0x90'),'DESC']]}]});})[_0xf23c('0x1f')](handleEntityNotFound(_0x433924,null))[_0xf23c('0x1f')](function(_0x44c560){if(_0x44c560){_0x5c0969[_0xf23c('0xa0')]=_[_0xf23c('0xa1')](_0x44c560,[_0xf23c('0xa2')]);if(_0x44c560[_0xf23c('0xa2')][_0xf23c('0x48')]){return _0x44c560[_0xf23c('0xa2')][0x0];}var _0x4cc5be=_['defaults'](_0x5c0969[_0xf23c('0x5b')],{'firstName':_0x5c0969[_0xf23c('0x5b')][_0xf23c('0x93')],'ListId':_0x44c560['id']});_0x4cc5be[_0x5c0969['body'][_0xf23c('0x9e')]]=_0x5c0969[_0xf23c('0x5b')][_0xf23c('0x93')];return db[_0xf23c('0x8b')][_0xf23c('0x5a')](_0x4cc5be,{'fields':_0x31e174,'raw':!![]});}})[_0xf23c('0x1f')](handleEntityNotFound(_0x433924,null))['then'](function(_0x32f3be){if(_0x32f3be){_0x5c0969[_0xf23c('0xa3')]=_0x32f3be;var _0x32ac10={'ContactId':_0x32f3be['id'],'phone':_0x5c0969[_0xf23c('0x5b')][_0xf23c('0x93')],'WhatsappAccountId':_0x16b5a4[_0xf23c('0x55')]['id']};var _0x594cd4={'ContactId':_0x32f3be['id'],'WhatsappAccountId':_0x16b5a4[_0xf23c('0x55')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xf23c('0x59')]({'where':_0x594cd4})[_0xf23c('0x1f')](function(_0x23d2a3){if(_0x23d2a3){return[_0x23d2a3,![]];}return db['WhatsappInteraction'][_0xf23c('0x5a')](_0x32ac10)['then'](function(_0x2e3320){return[_0x2e3320,!![]];});});}})[_0xf23c('0x6f')](function(_0x2a1c2c,_0x4cee25){_0x5c0969[_0xf23c('0xa4')]=_0x2a1c2c['get']({'plain':!![]});_0x5c0969[_0xf23c('0xa4')][_0xf23c('0xa5')]=![];if(_0x4cee25){if(_0x5c0969[_0xf23c('0x81')][_0xf23c('0xa6')]){_0x5c0969['applications'][_0xf23c('0xa7')]({'id':0x0,'priority':_0x5c0969[_0xf23c('0x88')][_0xf23c('0x48')]+0x1,'app':'close','appdata':_0xf23c('0xa8'),'interval':_0xf23c('0xa9')});}_0x5c0969[_0xf23c('0xa4')][_0xf23c('0xa5')]=!![];}return db[_0xf23c('0x86')][_0xf23c('0x5a')]({'phone':_0x5c0969[_0xf23c('0x5b')][_0xf23c('0x93')],'messageId':_0x5c0969[_0xf23c('0x5b')][_0xf23c('0x97')],'body':_0x5c0969[_0xf23c('0x5b')]['body'],'WhatsappAccountId':_0x16b5a4[_0xf23c('0x55')]['id'],'WhatsappInteractionId':_0x2a1c2c['id'],'direction':'in','ContactId':_0x2a1c2c[_0xf23c('0xaa')],'AttachmentId':_0x5c0969[_0xf23c('0x5b')][_0xf23c('0xab')]});})[_0xf23c('0x1f')](function(_0x3bca11){_0x5c0969[_0xf23c('0x27')]=_0x3bca11;if(!_0x5c0969[_0xf23c('0xa4')][_0xf23c('0xac')])return;return db[_0xf23c('0x76')][_0xf23c('0x59')]({'attributes':['id',_0xf23c('0x39')],'where':{'id':_0x5c0969['interaction'][_0xf23c('0xac')]}});})[_0xf23c('0x1f')](function(_0x382b54){if(_0x382b54){_0x5c0969[_0xf23c('0x88')][_0xf23c('0xad')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x382b54[_0xf23c('0x39')]+','+(_0x5c0969[_0xf23c('0x81')]['waitForTheAssignedAgent']||0xa),'interval':_0xf23c('0xa9')});}if(!_0x5c0969['interaction'][_0xf23c('0xae')])return;return db[_0xf23c('0xaf')][_0xf23c('0x59')]({'attributes':['id',_0xf23c('0x39')],'where':{'id':_0x5c0969[_0xf23c('0xa4')][_0xf23c('0xae')]}});})[_0xf23c('0x1f')](function(_0x39dfc6){if(_0x39dfc6){_0x5c0969['applications'][_0xf23c('0xad')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x39dfc6['name']+','+(_0x5c0969['account'][_0xf23c('0xb0')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf23c('0xb1'),_0xf23c('0xb2'),_0x5c0969);})[_0xf23c('0x1f')](function(_0x558f63){if(_0x558f63){var _0x21a039=0xc8;var _0x372d71=_0xf23c('0xb3');logger['info'](_0xf23c('0x23'),_0x372d71,_0x21a039,_0xf23c('0xb4'));logger[_0xf23c('0x22')](_0xf23c('0xb5'),_0x372d71,_0x21a039,_0xf23c('0xb4'),JSON['stringify'](_0x558f63));if(_0x5c0969[_0xf23c('0x81')][_0xf23c('0x40')]===_0xf23c('0x92')){return _0x433924[_0xf23c('0x2b')](_0x21a039)[_0xf23c('0xb6')](_0xf23c('0xb7'),_0xf23c('0xb8'))[_0xf23c('0x3a')](_0xf23c('0xb9'));}else{return _0x433924[_0xf23c('0x2b')](_0x21a039)[_0xf23c('0x2d')](_0x558f63);}}});})[_0xf23c('0x29')](handleError(_0x433924,null));};exports[_0xf23c('0x3a')]=function(_0x36516f,_0x4c668d,_0x455d84){var _0x4dbcc3,_0x59c023,_0x51c030;if(_[_0xf23c('0xba')](_0x36516f['body']['body'])||_0x36516f[_0xf23c('0x5b')][_0xf23c('0x5b')]===''){throw new db[(_0xf23c('0x9a'))][(_0xf23c('0x8c'))](_0xf23c('0x9c'));}if(_[_0xf23c('0xba')](_0x36516f[_0xf23c('0x5b')]['to'])){throw new db['Sequelize'][(_0xf23c('0x8c'))](_0xf23c('0xbb'));}_0x4dbcc3=_0x36516f[_0xf23c('0x5b')]['to'];return db[_0xf23c('0x3e')][_0xf23c('0x59')]({'where':{'id':_0x36516f['params']['id']},'include':[{'model':db[_0xf23c('0x9f')],'as':_0xf23c('0xbc'),'include':[{'model':db[_0xf23c('0x8b')],'as':_0xf23c('0xa2'),'where':{'mobile':_0x4dbcc3},'limit':0x1,'order':[[_0xf23c('0x90'),_0xf23c('0xbd')]]}]}]})['then'](handleEntityNotFound(_0x4c668d,null))[_0xf23c('0x1f')](function(_0x16ef64){if(_0x16ef64&&_0x16ef64[_0xf23c('0xbc')]){_0x59c023=_0x16ef64['get']({'plain':!![]});if(_0x59c023[_0xf23c('0xbc')]&&_0x59c023['List']['Contacts']['length']){return _0x59c023[_0xf23c('0xbc')]['Contacts'][0x0];}return db['CmContact'][_0xf23c('0x5a')](_[_0xf23c('0x18')](_0x36516f[_0xf23c('0x5b')],{'firstName':_0x4dbcc3,'mobile':_0x4dbcc3,'phone':_0x4dbcc3,'ListId':_0x59c023['ListId']}));}})[_0xf23c('0x1f')](handleEntityNotFound(_0x4c668d,null))[_0xf23c('0x1f')](function(_0x5c160e){if(_0x5c160e){_0x51c030=_0x5c160e;return db[_0xf23c('0xbe')]['find']({'where':{'ContactId':_0x51c030['id'],'closed':![],'WhatsappAccountId':_0x59c023['id']}})[_0xf23c('0x1f')](function(_0x7d86c){if(_0x7d86c){return[_0x7d86c,![]];}return db['WhatsappInteraction'][_0xf23c('0x5a')]({'UserId':_0x36516f['user']['id'],'ContactId':_0x51c030['id'],'WhatsappAccountId':_0x59c023['id'],'phone':_0x4dbcc3,'firstMsgDirection':'out','Messages':[_[_0xf23c('0x4e')](_0x36516f[_0xf23c('0x5b')],{'read':![],'body':_0x36516f[_0xf23c('0x5b')][_0xf23c('0x5b')],'phone':_0x4dbcc3,'WhatsappAccountId':_0x59c023['id'],'UserId':_0x36516f['user']['id'],'ContactId':_0x51c030['id']})]},{'include':[{'model':db[_0xf23c('0x86')],'as':_0xf23c('0xbf')}]})[_0xf23c('0x1f')](function(_0x47d866){return[_0x47d866,!![]];});});}})[_0xf23c('0x6f')](function(_0x2ea940,_0x3493e8){if(_0x3493e8){return _0x2ea940;}return db['WhatsappMessage'][_0xf23c('0x5a')](_['merge'](_0x36516f['body'],{'read':![],'body':_0x36516f[_0xf23c('0x5b')][_0xf23c('0x5b')],'phone':_0x4dbcc3,'WhatsappAccountId':_0x59c023['id'],'WhatsappInteractionId':_0x2ea940['id'],'UserId':_0x36516f[_0xf23c('0x5c')]['id'],'ContactId':_0x51c030['id']}))['then'](function(_0x3234fd){_0x2ea940[_0xf23c('0xc0')][_0xf23c('0xbf')]=[];_0x2ea940[_0xf23c('0xc0')][_0xf23c('0xbf')]['push'](_0x3234fd[_0xf23c('0xc0')]);return _0x2ea940;});})[_0xf23c('0x1f')](respondWithResult(_0x4c668d,null))[_0xf23c('0x29')](handleError(_0x4c668d,null));}; \ No newline at end of file +var _0x33c4=['messageId','MessageSid','sinch','from','notifications','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','push','applications','unmanaged','*,*,*,*','ContactId','UserId','unshift','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','List','ListId','out','WhatsappMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','map','rawAttributes','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','WhatsappAccount','findAll','rows','show','params','mandatoryDispositionPause','keys','length','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','Pause','body','describe','addDisposition','WhatsappAccountId','getDispositions','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','Transaction','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','whatsapp','Applications','account','statuses','update','timestamp','orderBy','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','twilio','From','whatsapp:','Body'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x33c4,0xef));var _0x433c=function(_0xe6164f,_0x47e826){_0xe6164f=_0xe6164f-0x0;var _0x557c61=_0x33c4[_0xe6164f];return _0x557c61;};'use strict';var emlformat=require(_0x433c('0x0'));var rimraf=require(_0x433c('0x1'));var zipdir=require(_0x433c('0x2'));var jsonpatch=require(_0x433c('0x3'));var rp=require(_0x433c('0x4'));var moment=require(_0x433c('0x5'));var BPromise=require(_0x433c('0x6'));var Mustache=require(_0x433c('0x7'));var util=require('util');var path=require(_0x433c('0x8'));var sox=require(_0x433c('0x9'));var csv=require(_0x433c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x433c('0xb'));var _=require(_0x433c('0xc'));var squel=require(_0x433c('0xd'));var crypto=require('crypto');var jsforce=require(_0x433c('0xe'));var deskjs=require(_0x433c('0xf'));var toCsv=require(_0x433c('0xa'));var querystring=require(_0x433c('0x10'));var Papa=require(_0x433c('0x11'));var Redis=require(_0x433c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x433c('0x13'));var as=require(_0x433c('0x14'));var hardwareService=require(_0x433c('0x15'));var logger=require('../../config/logger')(_0x433c('0x16'));var utils=require(_0x433c('0x17'));var config=require(_0x433c('0x18'));var licenseUtil=require(_0x433c('0x19'));var db=require(_0x433c('0x1a'))['db'];config[_0x433c('0x1b')]=_[_0x433c('0x1c')](config[_0x433c('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x433c('0x1d'))(new Redis(config[_0x433c('0x1b')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x433c('0x1e'));var client=jayson[_0x433c('0x1f')][_0x433c('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x578984,_0x164058,_0x5151f2,_0x242de7){return new BPromise(function(_0x372baf,_0x202b96){var _0xd25690=_0x242de7||client;return _0xd25690['request'](_0x578984,_0x5151f2)[_0x433c('0x21')](function(_0x2e39d6){logger[_0x433c('0x22')](_0x433c('0x23'),_0x164058,_0x433c('0x24'));logger[_0x433c('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x164058,_0x433c('0x24'),JSON[_0x433c('0x26')](_0x2e39d6));if(_0x2e39d6['error']){if(_0x2e39d6[_0x433c('0x27')]['code']===0x1f4){logger[_0x433c('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x164058,_0x2e39d6[_0x433c('0x27')]['message']);return _0x202b96(_0x2e39d6['error'][_0x433c('0x28')]);}logger[_0x433c('0x27')](_0x433c('0x23'),_0x164058,_0x2e39d6['error'][_0x433c('0x28')]);return _0x372baf(_0x2e39d6['error'][_0x433c('0x28')]);}else{logger[_0x433c('0x22')](_0x433c('0x23'),_0x164058,_0x433c('0x24'));_0x372baf(_0x2e39d6[_0x433c('0x29')][_0x433c('0x28')]);}})[_0x433c('0x2a')](function(_0x1da058){logger[_0x433c('0x27')](_0x433c('0x23'),_0x164058,_0x1da058);_0x202b96(_0x1da058);});});}function respondWithStatusCode(_0x51f6bd,_0xf7b528){_0xf7b528=_0xf7b528||0xcc;return function(_0x1f402e){if(_0x1f402e){return _0x51f6bd[_0x433c('0x2b')](_0xf7b528);}return _0x51f6bd[_0x433c('0x2c')](_0xf7b528)[_0x433c('0x2d')]();};}function respondWithResult(_0x388562,_0x36da0f){_0x36da0f=_0x36da0f||0xc8;return function(_0x2d9380){if(_0x2d9380){return _0x388562[_0x433c('0x2c')](_0x36da0f)['json'](_0x2d9380);}};}function respondWithFilteredResult(_0x359155,_0xc3bfd){return function(_0x4da59b){if(_0x4da59b){var _0x383737=typeof _0xc3bfd[_0x433c('0x2e')]==='undefined'&&typeof _0xc3bfd[_0x433c('0x2f')]===_0x433c('0x30');var _0x222098=_0x4da59b[_0x433c('0x31')];var _0x3e29c8=_0x383737?0x0:_0xc3bfd[_0x433c('0x2e')];var _0x31a208=_0x383737?_0x4da59b[_0x433c('0x31')]:_0xc3bfd[_0x433c('0x2e')]+_0xc3bfd[_0x433c('0x2f')];var _0x1fc7c3;if(_0x31a208>=_0x222098){_0x31a208=_0x222098;_0x1fc7c3=0xc8;}else{_0x1fc7c3=0xce;}_0x359155[_0x433c('0x2c')](_0x1fc7c3);return _0x359155[_0x433c('0x32')]('Content-Range',_0x3e29c8+'-'+_0x31a208+'/'+_0x222098)[_0x433c('0x33')](_0x4da59b);}return null;};}function patchUpdates(_0x4deadb){return function(_0xf8bd08){try{jsonpatch[_0x433c('0x34')](_0xf8bd08,_0x4deadb,!![]);}catch(_0x29cb06){return BPromise[_0x433c('0x35')](_0x29cb06);}return _0xf8bd08['save']();};}function saveUpdates(_0x5c017f,_0x237f1b){return function(_0x57a4c9){if(_0x57a4c9){return _0x57a4c9['update'](_0x5c017f)[_0x433c('0x21')](function(_0x2828a2){return _0x2828a2;});}return null;};}function removeEntity(_0x41537a,_0x37bc1f){return function(_0x17ca3f){if(_0x17ca3f){return _0x17ca3f[_0x433c('0x36')]()[_0x433c('0x21')](function(){var _0xc7a2b8=_0x17ca3f[_0x433c('0x37')]({'plain':!![]});var _0x10c598=_0x433c('0x38');return db[_0x433c('0x39')]['destroy']({'where':{'type':_0x10c598,'resourceId':_0xc7a2b8['id']}})['then'](function(){return _0x17ca3f;});})[_0x433c('0x21')](function(){_0x41537a['status'](0xcc)[_0x433c('0x2d')]();});}};}function handleEntityNotFound(_0xf87fc7,_0x152c6e){return function(_0x32e4b8){if(!_0x32e4b8){_0xf87fc7['sendStatus'](0x194);}return _0x32e4b8;};}function handleError(_0x26c84c,_0x3f335e){_0x3f335e=_0x3f335e||0x1f4;return function(_0x4ccdc7){logger[_0x433c('0x27')](_0x4ccdc7[_0x433c('0x3a')]);if(_0x4ccdc7[_0x433c('0x3b')]){delete _0x4ccdc7[_0x433c('0x3b')];}_0x26c84c[_0x433c('0x2c')](_0x3f335e)[_0x433c('0x3c')](_0x4ccdc7);};}exports[_0x433c('0x3d')]=function(_0x398aae,_0x4a6682){var _0x3eaa0f={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2d2123={},_0x1bc3d3={'count':0x0,'rows':[]};var _0x1482cd=_[_0x433c('0x3e')](db['WhatsappAccount'][_0x433c('0x3f')],function(_0x189f2e){return{'name':_0x189f2e['fieldName'],'type':_0x189f2e['type'][_0x433c('0x40')]};});_0x2d2123[_0x433c('0x41')]=_[_0x433c('0x3e')](_0x1482cd,_0x433c('0x3b'));_0x2d2123[_0x433c('0x42')]=_['keys'](_0x398aae[_0x433c('0x42')]);_0x2d2123['filters']=_[_0x433c('0x43')](_0x2d2123[_0x433c('0x41')],_0x2d2123[_0x433c('0x42')]);_0x3eaa0f['attributes']=_[_0x433c('0x43')](_0x2d2123['model'],qs[_0x433c('0x44')](_0x398aae[_0x433c('0x42')][_0x433c('0x44')]));_0x3eaa0f[_0x433c('0x45')]=_0x3eaa0f[_0x433c('0x45')]['length']?_0x3eaa0f[_0x433c('0x45')]:_0x2d2123[_0x433c('0x41')];if(!_0x398aae['query'][_0x433c('0x46')](_0x433c('0x47'))){_0x3eaa0f['limit']=qs[_0x433c('0x2f')](_0x398aae[_0x433c('0x42')][_0x433c('0x2f')]);_0x3eaa0f[_0x433c('0x2e')]=qs[_0x433c('0x2e')](_0x398aae[_0x433c('0x42')]['offset']);}_0x3eaa0f[_0x433c('0x48')]=qs['sort'](_0x398aae[_0x433c('0x42')][_0x433c('0x49')]);_0x3eaa0f[_0x433c('0x4a')]=qs[_0x433c('0x4b')](_[_0x433c('0x4c')](_0x398aae[_0x433c('0x42')],_0x2d2123[_0x433c('0x4b')]),_0x1482cd);if(_0x398aae[_0x433c('0x42')]['filter']){_0x3eaa0f[_0x433c('0x4a')]=_['merge'](_0x3eaa0f[_0x433c('0x4a')],{'$or':_[_0x433c('0x3e')](_0x1482cd,function(_0x56eb3b){if(_0x56eb3b[_0x433c('0x4d')]!==_0x433c('0x4e')){var _0x1ef56a={};_0x1ef56a[_0x56eb3b['name']]={'$like':'%'+_0x398aae[_0x433c('0x42')][_0x433c('0x4f')]+'%'};return _0x1ef56a;}})});}_0x3eaa0f=_[_0x433c('0x50')]({},_0x3eaa0f,_0x398aae[_0x433c('0x51')]);var _0x45d9fb={'where':_0x3eaa0f[_0x433c('0x4a')]};return db['WhatsappAccount']['count'](_0x45d9fb)[_0x433c('0x21')](function(_0x4e1825){_0x1bc3d3[_0x433c('0x31')]=_0x4e1825;if(_0x398aae[_0x433c('0x42')][_0x433c('0x52')]){_0x3eaa0f['include']=[{'all':!![]}];}return db[_0x433c('0x53')][_0x433c('0x54')](_0x3eaa0f);})[_0x433c('0x21')](function(_0x14037f){_0x1bc3d3[_0x433c('0x55')]=_0x14037f;return _0x1bc3d3;})[_0x433c('0x21')](respondWithFilteredResult(_0x4a6682,_0x3eaa0f))['catch'](handleError(_0x4a6682,null));};exports[_0x433c('0x56')]=function(_0xf0e0a5,_0x12baaa){var _0x289d77={'raw':![],'where':{'id':_0xf0e0a5[_0x433c('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x433c('0x58')}]},_0x40b996={};_0x40b996[_0x433c('0x41')]=_[_0x433c('0x59')](db['WhatsappAccount']['rawAttributes']);_0x40b996[_0x433c('0x42')]=_[_0x433c('0x59')](_0xf0e0a5[_0x433c('0x42')]);_0x40b996[_0x433c('0x4b')]=_['intersection'](_0x40b996[_0x433c('0x41')],_0x40b996[_0x433c('0x42')]);_0x289d77['attributes']=_[_0x433c('0x43')](_0x40b996['model'],qs[_0x433c('0x44')](_0xf0e0a5[_0x433c('0x42')][_0x433c('0x44')]));_0x289d77[_0x433c('0x45')]=_0x289d77[_0x433c('0x45')][_0x433c('0x5a')]?_0x289d77[_0x433c('0x45')]:_0x40b996[_0x433c('0x41')];if(_0xf0e0a5[_0x433c('0x42')]['includeAll']){_0x289d77[_0x433c('0x5b')]=[{'all':!![]}];}_0x289d77=_['merge']({},_0x289d77,_0xf0e0a5[_0x433c('0x51')]);return db['WhatsappAccount']['find'](_0x289d77)[_0x433c('0x21')](handleEntityNotFound(_0x12baaa,null))[_0x433c('0x21')](respondWithResult(_0x12baaa,null))['catch'](handleError(_0x12baaa,null));};exports[_0x433c('0x5c')]=function(_0x5c2394,_0x3032ea){return db[_0x433c('0x53')][_0x433c('0x5c')](_0x5c2394['body'],{})['then'](function(_0x2c47ae){var _0x319c5c=_0x5c2394[_0x433c('0x5d')][_0x433c('0x37')]({'plain':!![]});if(!_0x319c5c)throw new Error(_0x433c('0x5e'));if(_0x319c5c[_0x433c('0x5f')]===_0x433c('0x5d')){var _0x59308b=_0x2c47ae[_0x433c('0x37')]({'plain':!![]});var _0x3df310=_0x433c('0x38');return db[_0x433c('0x60')]['find']({'where':{'name':_0x3df310,'userProfileId':_0x319c5c[_0x433c('0x61')]},'raw':!![]})[_0x433c('0x21')](function(_0x5e1c9e){if(_0x5e1c9e&&_0x5e1c9e[_0x433c('0x62')]===0x0){return db['UserProfileResource'][_0x433c('0x5c')]({'name':_0x59308b[_0x433c('0x3b')],'resourceId':_0x59308b['id'],'type':_0x5e1c9e['name'],'sectionId':_0x5e1c9e['id']},{})[_0x433c('0x21')](function(){return _0x2c47ae;});}else{return _0x2c47ae;}})['catch'](function(_0x7605fd){logger[_0x433c('0x27')](_0x433c('0x63'),_0x7605fd);throw _0x7605fd;});}return _0x2c47ae;})[_0x433c('0x21')](respondWithResult(_0x3032ea,0xc9))[_0x433c('0x2a')](handleError(_0x3032ea,null));};exports['update']=function(_0x245218,_0x121480){if(_0x245218['body']['id']){delete _0x245218['body']['id'];}return db[_0x433c('0x53')][_0x433c('0x64')]({'where':{'id':_0x245218[_0x433c('0x57')]['id']},'include':[{'model':db[_0x433c('0x65')],'as':_0x433c('0x58')}]})[_0x433c('0x21')](handleEntityNotFound(_0x121480,null))['then'](saveUpdates(_0x245218[_0x433c('0x66')],null))[_0x433c('0x21')](respondWithResult(_0x121480,null))['catch'](handleError(_0x121480,null));};exports[_0x433c('0x36')]=function(_0x224a26,_0x2b88a3){return db[_0x433c('0x53')][_0x433c('0x64')]({'where':{'id':_0x224a26[_0x433c('0x57')]['id']}})['then'](handleEntityNotFound(_0x2b88a3,null))[_0x433c('0x21')](removeEntity(_0x2b88a3,null))[_0x433c('0x2a')](handleError(_0x2b88a3,null));};exports[_0x433c('0x67')]=function(_0x47d790,_0x217871){return db[_0x433c('0x53')][_0x433c('0x67')]()['then'](respondWithResult(_0x217871,null))[_0x433c('0x2a')](handleError(_0x217871,null));};exports[_0x433c('0x68')]=function(_0x34c142,_0x41778f,_0x20d6c2){if(_0x34c142[_0x433c('0x66')]['id']){delete _0x34c142[_0x433c('0x66')]['id'];}return db[_0x433c('0x53')][_0x433c('0x64')]({'where':{'id':_0x34c142[_0x433c('0x57')]['id']}})[_0x433c('0x21')](handleEntityNotFound(_0x41778f,null))[_0x433c('0x21')](function(_0x1f1f2a){if(_0x1f1f2a){_0x34c142['body'][_0x433c('0x69')]=_0x1f1f2a['id'];return db['Disposition'][_0x433c('0x5c')](_0x34c142[_0x433c('0x66')]);}})[_0x433c('0x21')](respondWithResult(_0x41778f,null))[_0x433c('0x2a')](handleError(_0x41778f,null));};exports[_0x433c('0x6a')]=function(_0x307b63,_0xe07ab0,_0x3e7120){var _0xd7c156={'raw':![],'where':{}};var _0x4ce9b9={};var _0x4028b5={'count':0x0,'rows':[]};return db[_0x433c('0x53')]['findOne']({'where':{'id':_0x307b63[_0x433c('0x57')]['id']}})[_0x433c('0x21')](handleEntityNotFound(_0xe07ab0,null))[_0x433c('0x21')](function(_0x381027){if(_0x381027){_0x4ce9b9['model']=_['keys'](db[_0x433c('0x6b')][_0x433c('0x3f')]);_0x4ce9b9['query']=_[_0x433c('0x59')](_0x307b63[_0x433c('0x42')]);_0x4ce9b9[_0x433c('0x4b')]=_[_0x433c('0x43')](_0x4ce9b9['model'],_0x4ce9b9[_0x433c('0x42')]);_0xd7c156[_0x433c('0x45')]=_[_0x433c('0x43')](_0x4ce9b9['model'],qs[_0x433c('0x44')](_0x307b63[_0x433c('0x42')]['fields']));_0xd7c156['attributes']=_0xd7c156['attributes'][_0x433c('0x5a')]?_0xd7c156[_0x433c('0x45')]:_0x4ce9b9[_0x433c('0x41')];if(!_0x307b63[_0x433c('0x42')][_0x433c('0x46')]('nolimit')){_0xd7c156[_0x433c('0x2f')]=qs['limit'](_0x307b63['query'][_0x433c('0x2f')]);_0xd7c156[_0x433c('0x2e')]=qs[_0x433c('0x2e')](_0x307b63[_0x433c('0x42')][_0x433c('0x2e')]);}_0xd7c156['order']=qs[_0x433c('0x49')](_0x307b63[_0x433c('0x42')][_0x433c('0x49')]);_0xd7c156[_0x433c('0x4a')]=qs[_0x433c('0x4b')](_[_0x433c('0x4c')](_0x307b63[_0x433c('0x42')],_0x4ce9b9[_0x433c('0x4b')]));_0xd7c156['where']['WhatsappAccountId']=_0x381027['id'];if(_0x307b63[_0x433c('0x42')][_0x433c('0x4f')]){_0xd7c156[_0x433c('0x4a')]=_[_0x433c('0x50')](_0xd7c156[_0x433c('0x4a')],{'$or':_['map'](_0xd7c156[_0x433c('0x45')],function(_0x5c8871){var _0x357cbb={};_0x357cbb[_0x5c8871]={'$like':'%'+_0x307b63[_0x433c('0x42')][_0x433c('0x4f')]+'%'};return _0x357cbb;})});}_0xd7c156=_[_0x433c('0x50')]({},_0xd7c156,_0x307b63[_0x433c('0x51')]);return db['Disposition'][_0x433c('0x31')]({'where':_0xd7c156[_0x433c('0x4a')]})[_0x433c('0x21')](function(_0x1b8bf0){_0x4028b5['count']=_0x1b8bf0;if(_0x307b63[_0x433c('0x42')][_0x433c('0x52')]){_0xd7c156[_0x433c('0x5b')]=[{'all':!![]}];}return db[_0x433c('0x6b')][_0x433c('0x54')](_0xd7c156);})['then'](function(_0x3d5da2){_0x4028b5['rows']=_0x3d5da2;return _0x4028b5;});}})[_0x433c('0x21')](respondWithFilteredResult(_0xe07ab0,_0xd7c156))['catch'](handleError(_0xe07ab0,null));};exports['removeDispositions']=function(_0x35ab9c,_0x588491,_0x410e9a){return db[_0x433c('0x53')][_0x433c('0x64')]({'where':{'id':_0x35ab9c[_0x433c('0x57')]['id']}})[_0x433c('0x21')](handleEntityNotFound(_0x588491,null))[_0x433c('0x21')](function(_0x4b4331){if(_0x4b4331){return _0x4b4331[_0x433c('0x6c')](_0x35ab9c[_0x433c('0x42')][_0x433c('0x6d')]);}})[_0x433c('0x21')](respondWithStatusCode(_0x588491,null))[_0x433c('0x2a')](handleError(_0x588491,null));};exports[_0x433c('0x6e')]=function(_0x2b2686,_0x37657c,_0x53af67){if(_0x2b2686[_0x433c('0x66')]['id']){delete _0x2b2686['body']['id'];}return db[_0x433c('0x53')][_0x433c('0x64')]({'where':{'id':_0x2b2686[_0x433c('0x57')]['id']}})[_0x433c('0x21')](handleEntityNotFound(_0x37657c,null))[_0x433c('0x21')](function(_0x93c3c8){if(_0x93c3c8){_0x2b2686['body'][_0x433c('0x69')]=_0x93c3c8['id'];return db[_0x433c('0x6f')][_0x433c('0x5c')](_0x2b2686[_0x433c('0x66')]);}})[_0x433c('0x21')](respondWithResult(_0x37657c,null))['catch'](handleError(_0x37657c,null));};exports[_0x433c('0x70')]=function(_0x3cfd29,_0x53707b,_0x23b87f){var _0x5bafbd={'raw':![],'where':{}};var _0x1eb1b2={};var _0xaf8806={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x433c('0x71')]({'where':{'id':_0x3cfd29[_0x433c('0x57')]['id']}})[_0x433c('0x21')](handleEntityNotFound(_0x53707b,null))[_0x433c('0x21')](function(_0x5edebe){if(_0x5edebe){_0x1eb1b2['model']=_[_0x433c('0x59')](db[_0x433c('0x6f')]['rawAttributes']);_0x1eb1b2[_0x433c('0x42')]=_[_0x433c('0x59')](_0x3cfd29[_0x433c('0x42')]);_0x1eb1b2[_0x433c('0x4b')]=_[_0x433c('0x43')](_0x1eb1b2['model'],_0x1eb1b2[_0x433c('0x42')]);_0x5bafbd[_0x433c('0x45')]=_['intersection'](_0x1eb1b2[_0x433c('0x41')],qs[_0x433c('0x44')](_0x3cfd29[_0x433c('0x42')][_0x433c('0x44')]));_0x5bafbd[_0x433c('0x45')]=_0x5bafbd[_0x433c('0x45')][_0x433c('0x5a')]?_0x5bafbd['attributes']:_0x1eb1b2[_0x433c('0x41')];if(!_0x3cfd29['query']['hasOwnProperty'](_0x433c('0x47'))){_0x5bafbd[_0x433c('0x2f')]=qs[_0x433c('0x2f')](_0x3cfd29[_0x433c('0x42')]['limit']);_0x5bafbd[_0x433c('0x2e')]=qs[_0x433c('0x2e')](_0x3cfd29[_0x433c('0x42')]['offset']);}_0x5bafbd['order']=qs[_0x433c('0x49')](_0x3cfd29[_0x433c('0x42')][_0x433c('0x49')]);_0x5bafbd[_0x433c('0x4a')]=qs[_0x433c('0x4b')](_[_0x433c('0x4c')](_0x3cfd29[_0x433c('0x42')],_0x1eb1b2[_0x433c('0x4b')]));_0x5bafbd[_0x433c('0x4a')][_0x433c('0x69')]=_0x5edebe['id'];if(_0x3cfd29[_0x433c('0x42')]['filter']){_0x5bafbd[_0x433c('0x4a')]=_[_0x433c('0x50')](_0x5bafbd['where'],{'$or':_[_0x433c('0x3e')](_0x5bafbd[_0x433c('0x45')],function(_0x39884d){var _0x8bb744={};_0x8bb744[_0x39884d]={'$like':'%'+_0x3cfd29[_0x433c('0x42')][_0x433c('0x4f')]+'%'};return _0x8bb744;})});}_0x5bafbd=_[_0x433c('0x50')]({},_0x5bafbd,_0x3cfd29[_0x433c('0x51')]);return db[_0x433c('0x6f')]['count']({'where':_0x5bafbd['where']})[_0x433c('0x21')](function(_0x230021){_0xaf8806[_0x433c('0x31')]=_0x230021;if(_0x3cfd29[_0x433c('0x42')][_0x433c('0x52')]){_0x5bafbd[_0x433c('0x5b')]=[{'all':!![]}];}return db[_0x433c('0x6f')][_0x433c('0x54')](_0x5bafbd);})[_0x433c('0x21')](function(_0x3c3acc){_0xaf8806[_0x433c('0x55')]=_0x3c3acc;return _0xaf8806;});}})[_0x433c('0x21')](respondWithFilteredResult(_0x53707b,_0x5bafbd))[_0x433c('0x2a')](handleError(_0x53707b,null));};exports[_0x433c('0x72')]=function(_0x556e6b,_0x4fdad6,_0x3ead7a){return db[_0x433c('0x53')]['find']({'where':{'id':_0x556e6b[_0x433c('0x57')]['id']}})[_0x433c('0x21')](handleEntityNotFound(_0x4fdad6,null))['then'](function(_0x108100){if(_0x108100){return _0x108100[_0x433c('0x72')](_0x556e6b[_0x433c('0x42')][_0x433c('0x6d')]);}})['then'](respondWithStatusCode(_0x4fdad6,null))['catch'](handleError(_0x4fdad6,null));};exports[_0x433c('0x73')]=function(_0x503af1,_0x3810a0,_0x228d4c){return db[_0x433c('0x53')]['find']({'where':{'id':_0x503af1[_0x433c('0x57')]['id']}})[_0x433c('0x21')](handleEntityNotFound(_0x3810a0,null))['then'](function(_0x24f92a){if(_0x24f92a){return _0x24f92a[_0x433c('0x73')](_0x503af1[_0x433c('0x66')][_0x433c('0x6d')],_[_0x433c('0x74')](_0x503af1[_0x433c('0x66')],['ids','id'])||{})[_0x433c('0x75')](function(_0x467d9f){for(var _0x836033=0x0;_0x836033<_0x503af1[_0x433c('0x66')]['ids']['length'];_0x836033+=0x1){socket[_0x433c('0x76')](_0x433c('0x77'),{'UserId':Number(_0x503af1['body'][_0x433c('0x6d')][_0x836033]),'WhatsappAccountId':Number(_0x503af1['params']['id'])});}return _0x467d9f;});}})[_0x433c('0x21')](respondWithResult(_0x3810a0,null))[_0x433c('0x2a')](handleError(_0x3810a0,null));};exports['removeAgents']=function(_0x25ae12,_0xc2e0ed,_0x1d0a65){return db[_0x433c('0x53')]['find']({'where':{'id':_0x25ae12[_0x433c('0x57')]['id']}})[_0x433c('0x21')](handleEntityNotFound(_0xc2e0ed,null))[_0x433c('0x21')](function(_0x496c7c){if(_0x496c7c){return _0x496c7c['removeAgents'](_0x25ae12[_0x433c('0x42')][_0x433c('0x6d')])[_0x433c('0x21')](function(){if(_['isArray'](_0x25ae12['query']['ids'])){for(var _0x4e9b81=0x0;_0x4e9b81<_0x25ae12[_0x433c('0x42')][_0x433c('0x6d')][_0x433c('0x5a')];_0x4e9b81+=0x1){socket['emit'](_0x433c('0x78'),{'UserId':Number(_0x25ae12[_0x433c('0x42')][_0x433c('0x6d')][_0x4e9b81]),'WhatsappAccountId':Number(_0x25ae12['params']['id'])});}}else{socket['emit'](_0x433c('0x78'),{'UserId':Number(_0x25ae12['query'][_0x433c('0x6d')]),'WhatsappAccountId':Number(_0x25ae12[_0x433c('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0xc2e0ed,null))[_0x433c('0x2a')](handleError(_0xc2e0ed,null));};exports['getAgents']=function(_0x46e5ad,_0x5c5958,_0x120e34){var _0x224d60={};var _0x7dafca={};var _0x4a3532;var _0x4a3de6;return db[_0x433c('0x53')][_0x433c('0x71')]({'where':{'id':_0x46e5ad[_0x433c('0x57')]['id']}})[_0x433c('0x21')](handleEntityNotFound(_0x5c5958,null))[_0x433c('0x21')](function(_0x5e301e){if(_0x5e301e){_0x4a3532=_0x5e301e;_0x7dafca[_0x433c('0x41')]=_['keys'](db[_0x433c('0x79')][_0x433c('0x3f')]);_0x7dafca['query']=_[_0x433c('0x59')](_0x46e5ad[_0x433c('0x42')]);_0x7dafca[_0x433c('0x4b')]=_[_0x433c('0x43')](_0x7dafca[_0x433c('0x41')],_0x7dafca[_0x433c('0x42')]);_0x224d60['attributes']=_[_0x433c('0x43')](_0x7dafca[_0x433c('0x41')],qs[_0x433c('0x44')](_0x46e5ad[_0x433c('0x42')][_0x433c('0x44')]));_0x224d60['attributes']=_0x224d60[_0x433c('0x45')][_0x433c('0x5a')]?_0x224d60['attributes']:_0x7dafca[_0x433c('0x41')];_0x224d60['order']=qs[_0x433c('0x49')](_0x46e5ad[_0x433c('0x42')]['sort']);_0x224d60[_0x433c('0x4a')]=qs[_0x433c('0x4b')](_['pick'](_0x46e5ad[_0x433c('0x42')],_0x7dafca[_0x433c('0x4b')]));if(_0x46e5ad[_0x433c('0x42')][_0x433c('0x4f')]){_0x224d60[_0x433c('0x4a')]=_[_0x433c('0x50')](_0x224d60[_0x433c('0x4a')],{'$or':_[_0x433c('0x3e')](_0x224d60[_0x433c('0x45')],function(_0x779b13){var _0x13ea2d={};_0x13ea2d[_0x779b13]={'$like':'%'+_0x46e5ad['query'][_0x433c('0x4f')]+'%'};return _0x13ea2d;})});}_0x224d60=_[_0x433c('0x50')]({},_0x224d60,_0x46e5ad[_0x433c('0x51')]);return _0x4a3532['getAgents'](_0x224d60);}})[_0x433c('0x21')](function(_0x599a71){if(_0x599a71){_0x4a3de6=_0x599a71['length'];if(!_0x46e5ad[_0x433c('0x42')][_0x433c('0x46')](_0x433c('0x47'))){_0x224d60[_0x433c('0x2f')]=qs[_0x433c('0x2f')](_0x46e5ad['query'][_0x433c('0x2f')]);_0x224d60['offset']=qs[_0x433c('0x2e')](_0x46e5ad[_0x433c('0x42')][_0x433c('0x2e')]);}return _0x4a3532[_0x433c('0x7a')](_0x224d60);}})[_0x433c('0x21')](function(_0x403892){if(_0x403892){return _0x403892?{'count':_0x4a3de6,'rows':_0x403892}:null;}})[_0x433c('0x21')](respondWithResult(_0x5c5958,null))[_0x433c('0x2a')](handleError(_0x5c5958,null));};exports[_0x433c('0x7b')]=function(_0x2d0089,_0x4a01fe){var _0x39696e=_0x2d0089['params']['id'];var _0x155c1f=_0x2d0089['body'];var _0x18f1e4=0xc8;var _0x313e50=null;return db[_0x433c('0x7c')]['transaction']({'isolationLevel':db[_0x433c('0x7c')][_0x433c('0x7d')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x5199ab){return db[_0x433c('0x53')][_0x433c('0x71')]({'where':{'id':_0x39696e},'transaction':_0x5199ab})[_0x433c('0x21')](function(_0x576533){if(_0x576533){return db[_0x433c('0x7e')][_0x433c('0x36')]({'where':{'WhatsappAccountId':_0x39696e},'transaction':_0x5199ab})[_0x433c('0x21')](function(){var _0x29545d=_[_0x433c('0x3e')](_0x155c1f,function(_0x1dc268){_0x1dc268[_0x433c('0x69')]=_0x39696e;return _0x1dc268;});return db[_0x433c('0x7e')][_0x433c('0x7f')](_0x29545d,{'transaction':_0x5199ab});});}else{_0x18f1e4=0x194;_0x313e50=[];}});})[_0x433c('0x21')](function(){if(_0x18f1e4!==0x194){return db['WhatsappApplication'][_0x433c('0x80')]({'where':{'WhatsappAccountId':_0x39696e},'order':'priority'})[_0x433c('0x21')](function(_0x5ec305){_0x313e50=_0x5ec305;});}})[_0x433c('0x2a')](function(_0x1d22e1){_0x18f1e4=0x1f4;logger[_0x433c('0x27')](_0x1d22e1['stack']);if(_0x1d22e1[_0x433c('0x3b')]){delete _0x1d22e1['name'];}_0x313e50=_0x1d22e1;})[_0x433c('0x81')](function(){if(_0x313e50===null){_0x4a01fe[_0x433c('0x2b')](_0x18f1e4);}else{if(_0x18f1e4===0x1f4){_0x4a01fe[_0x433c('0x2c')](_0x18f1e4)[_0x433c('0x3c')](_0x313e50);}else{_0x4a01fe[_0x433c('0x2c')](_0x18f1e4)[_0x433c('0x33')](_0x313e50);}}});};exports[_0x433c('0x82')]=function(_0x463ef8,_0x2891fb,_0x476116){var _0xc0e7dd={};var _0x193af7={};var _0x3d0631;var _0x1be637;return db['WhatsappAccount']['findOne']({'where':{'id':_0x463ef8[_0x433c('0x57')]['id']}})[_0x433c('0x21')](handleEntityNotFound(_0x2891fb,null))[_0x433c('0x21')](function(_0x3e54d6){if(_0x3e54d6){_0x3d0631=_0x3e54d6;_0x193af7[_0x433c('0x41')]=_[_0x433c('0x59')](db[_0x433c('0x7e')][_0x433c('0x3f')]);_0x193af7[_0x433c('0x42')]=_[_0x433c('0x59')](_0x463ef8['query']);_0x193af7[_0x433c('0x4b')]=_[_0x433c('0x43')](_0x193af7[_0x433c('0x41')],_0x193af7[_0x433c('0x42')]);_0xc0e7dd[_0x433c('0x45')]=_[_0x433c('0x43')](_0x193af7[_0x433c('0x41')],qs[_0x433c('0x44')](_0x463ef8[_0x433c('0x42')][_0x433c('0x44')]));_0xc0e7dd[_0x433c('0x45')]=_0xc0e7dd['attributes'][_0x433c('0x5a')]?_0xc0e7dd[_0x433c('0x45')]:_0x193af7[_0x433c('0x41')];_0xc0e7dd[_0x433c('0x48')]=qs[_0x433c('0x49')](_0x463ef8[_0x433c('0x42')][_0x433c('0x49')]);_0xc0e7dd[_0x433c('0x4a')]=qs[_0x433c('0x4b')](_[_0x433c('0x4c')](_0x463ef8['query'],_0x193af7[_0x433c('0x4b')]));if(_0x463ef8[_0x433c('0x42')][_0x433c('0x4f')]){_0xc0e7dd[_0x433c('0x4a')]=_[_0x433c('0x50')](_0xc0e7dd[_0x433c('0x4a')],{'$or':_[_0x433c('0x3e')](_0xc0e7dd[_0x433c('0x45')],function(_0x205d63){var _0x378ca2={};_0x378ca2[_0x205d63]={'$like':'%'+_0x463ef8[_0x433c('0x42')][_0x433c('0x4f')]+'%'};return _0x378ca2;})});}_0xc0e7dd=_[_0x433c('0x50')]({},_0xc0e7dd,_0x463ef8[_0x433c('0x51')]);return _0x3d0631[_0x433c('0x82')](_0xc0e7dd);}})[_0x433c('0x21')](function(_0x18d498){if(_0x18d498){_0x1be637=_0x18d498[_0x433c('0x5a')];if(!_0x463ef8['query'][_0x433c('0x46')](_0x433c('0x47'))){_0xc0e7dd[_0x433c('0x2f')]=qs[_0x433c('0x2f')](_0x463ef8[_0x433c('0x42')][_0x433c('0x2f')]);_0xc0e7dd[_0x433c('0x2e')]=qs[_0x433c('0x2e')](_0x463ef8[_0x433c('0x42')][_0x433c('0x2e')]);}return _0x3d0631['getApplications'](_0xc0e7dd);}})[_0x433c('0x21')](function(_0x549689){if(_0x549689){return _0x549689?{'count':_0x1be637,'rows':_0x549689}:null;}})[_0x433c('0x21')](respondWithResult(_0x2891fb,null))[_0x433c('0x2a')](handleError(_0x2891fb,null));};exports['notify']=function(_0x2ea8f0,_0x3e5f2d,_0x4752e0){var _0x5ce21a={'channel':_0x433c('0x83')};var _0x228e66=[];var _0x204f9c=[];var _0x23279b={};return db[_0x433c('0x53')][_0x433c('0x64')]({'where':{'id':_0x2ea8f0[_0x433c('0x57')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x433c('0x84')}]})['then'](handleEntityNotFound(_0x3e5f2d,null))['then'](function(_0x31a821){_0x5ce21a[_0x433c('0x85')]=_0x31a821;if(_0x5ce21a['account']&&_0x5ce21a[_0x433c('0x85')][_0x433c('0x4d')]==='sinch'&&_0x2ea8f0['body'][_0x433c('0x86')]){if(_0x2ea8f0[_0x433c('0x66')]['statuses']['length']===0x0)return;if(_0x2ea8f0[_0x433c('0x66')][_0x433c('0x86')][0x0]['state']!=='read')return;return db['WhatsappMessage'][_0x433c('0x87')]({'read':!![],'readAt':_0x2ea8f0[_0x433c('0x66')]['statuses'][0x0][_0x433c('0x88')]},{'where':{'messageId':_0x2ea8f0[_0x433c('0x66')][_0x433c('0x86')][0x0]['message_id']},'individualHooks':!![]})[_0x433c('0x21')](function(_0x5f1292){return _0x3e5f2d['status'](0xc8)['json'](_0x5f1292);});}_0x5ce21a['applications']=_[_0x433c('0x89')](_0x31a821['Applications'],[_0x433c('0x8a')],[_0x433c('0x8b')]);if(_0x5ce21a[_0x433c('0x85')][_0x433c('0x84')]){delete _0x5ce21a[_0x433c('0x85')][_0x433c('0x84')];}return db[_0x433c('0x8c')][_0x433c('0x67')]()[_0x433c('0x21')](function(_0x37e4be){if(!_0x37e4be){throw new db['Sequelize'][(_0x433c('0x8d'))](_0x433c('0x8e'));}_0x228e66=_['difference'](_[_0x433c('0x59')](_0x37e4be),[_0x433c('0x8f'),_0x433c('0x90')]);_0x204f9c=_['difference'](_[_0x433c('0x59')](_0x37e4be),[_0x433c('0x8f'),'updatedAt','CompanyId','ListId']);_0x5ce21a['body']={'mapKey':'mobile'};if(_0x5ce21a[_0x433c('0x85')]&&_0x5ce21a['account'][_0x433c('0x4d')]===_0x433c('0x91')){_0x5ce21a['body']['from']=_0x2ea8f0[_0x433c('0x66')][_0x433c('0x92')]['replace'](_0x433c('0x93'),'');_0x5ce21a[_0x433c('0x66')][_0x433c('0x66')]=_0x2ea8f0[_0x433c('0x66')][_0x433c('0x94')];_0x5ce21a[_0x433c('0x66')][_0x433c('0x95')]=_0x2ea8f0[_0x433c('0x66')][_0x433c('0x96')];}if(_0x5ce21a[_0x433c('0x85')]&&_0x5ce21a[_0x433c('0x85')][_0x433c('0x4d')]===_0x433c('0x97')){_0x5ce21a[_0x433c('0x66')][_0x433c('0x98')]=_0x2ea8f0[_0x433c('0x66')][_0x433c('0x99')][0x0][_0x433c('0x98')];_0x5ce21a['body'][_0x433c('0x66')]=_0x2ea8f0[_0x433c('0x66')][_0x433c('0x99')][0x0][_0x433c('0x28')][_0x433c('0x66')];_0x5ce21a[_0x433c('0x66')][_0x433c('0x95')]=_0x2ea8f0[_0x433c('0x66')][_0x433c('0x99')][0x0]['message_id'];}if(_0x5ce21a['body']['id']){delete _0x5ce21a['body']['id'];}if(_[_0x433c('0x9a')](_0x5ce21a[_0x433c('0x66')][_0x433c('0x98')])){throw new db[(_0x433c('0x9b'))][(_0x433c('0x8d'))](_0x433c('0x9c'));}if(_['isNil'](_0x5ce21a['body'][_0x433c('0x66')])||_0x5ce21a[_0x433c('0x66')][_0x433c('0x66')]===''){throw new db[(_0x433c('0x9b'))][(_0x433c('0x8d'))](_0x433c('0x9d'));}if(_[_0x433c('0x9a')](_0x5ce21a['body']['mapKey'])){throw new db[(_0x433c('0x9b'))][(_0x433c('0x8d'))](_0x433c('0x9e')+_0x204f9c);}if(!_[_0x433c('0x9f')](_0x204f9c,_0x5ce21a[_0x433c('0x66')]['mapKey'])){throw new db[(_0x433c('0x9b'))][(_0x433c('0x8d'))](_0x433c('0xa0')+_0x204f9c);}_0x23279b[_0x5ce21a[_0x433c('0x66')][_0x433c('0xa1')]]=_0x5ce21a[_0x433c('0x66')]['from'];return db['CmList']['find']({'where':{'id':_0x5ce21a[_0x433c('0x85')]['ListId']},'include':[{'model':db[_0x433c('0x8c')],'as':_0x433c('0xa2'),'where':_0x23279b,'limit':0x1,'order':[[_0x433c('0x90'),_0x433c('0xa3')]]}]});})[_0x433c('0x21')](handleEntityNotFound(_0x3e5f2d,null))[_0x433c('0x21')](function(_0x1fec96){if(_0x1fec96){_0x5ce21a[_0x433c('0xa4')]=_[_0x433c('0x74')](_0x1fec96,['Contacts']);if(_0x1fec96[_0x433c('0xa2')][_0x433c('0x5a')]){return _0x1fec96[_0x433c('0xa2')][0x0];}var _0xd1739e=_[_0x433c('0x1c')](_0x5ce21a[_0x433c('0x66')],{'firstName':_0x5ce21a[_0x433c('0x66')][_0x433c('0x98')],'ListId':_0x1fec96['id']});_0xd1739e[_0x5ce21a['body'][_0x433c('0xa1')]]=_0x5ce21a[_0x433c('0x66')]['from'];return db[_0x433c('0x8c')][_0x433c('0x5c')](_0xd1739e,{'fields':_0x228e66,'raw':!![]});}})[_0x433c('0x21')](handleEntityNotFound(_0x3e5f2d,null))[_0x433c('0x21')](function(_0x31d9f4){if(_0x31d9f4){_0x5ce21a[_0x433c('0xa5')]=_0x31d9f4;var _0x4e9360={'ContactId':_0x31d9f4['id'],'phone':_0x5ce21a['body'][_0x433c('0x98')],'WhatsappAccountId':_0x2ea8f0['params']['id']};var _0x674322={'ContactId':_0x31d9f4['id'],'WhatsappAccountId':_0x2ea8f0[_0x433c('0x57')]['id'],'closed':![]};return db[_0x433c('0xa6')]['find']({'where':_0x674322})[_0x433c('0x21')](function(_0x23d1d4){if(_0x23d1d4){return[_0x23d1d4,![]];}return db[_0x433c('0xa6')][_0x433c('0x5c')](_0x4e9360)['then'](function(_0x923ecf){return[_0x923ecf,!![]];});});}})[_0x433c('0x75')](function(_0x32ca23,_0x25ea98){_0x5ce21a['interaction']=_0x32ca23[_0x433c('0x37')]({'plain':!![]});_0x5ce21a[_0x433c('0xa7')][_0x433c('0xa8')]=![];if(_0x25ea98){if(_0x5ce21a[_0x433c('0x85')][_0x433c('0xa9')]){_0x5ce21a['applications'][_0x433c('0xaa')]({'id':0x0,'priority':_0x5ce21a[_0x433c('0xab')][_0x433c('0x5a')]+0x1,'app':'close','appdata':_0x433c('0xac'),'interval':_0x433c('0xad')});}_0x5ce21a[_0x433c('0xa7')][_0x433c('0xa8')]=!![];}return db['WhatsappMessage'][_0x433c('0x5c')]({'phone':_0x5ce21a[_0x433c('0x66')][_0x433c('0x98')],'messageId':_0x5ce21a[_0x433c('0x66')]['messageId'],'body':_0x5ce21a[_0x433c('0x66')][_0x433c('0x66')],'WhatsappAccountId':_0x2ea8f0[_0x433c('0x57')]['id'],'WhatsappInteractionId':_0x32ca23['id'],'direction':'in','ContactId':_0x32ca23[_0x433c('0xae')],'AttachmentId':_0x5ce21a['body']['AttachmentId']});})[_0x433c('0x21')](function(_0x54cdcd){_0x5ce21a['message']=_0x54cdcd;if(!_0x5ce21a[_0x433c('0xa7')][_0x433c('0xaf')])return;return db[_0x433c('0x79')][_0x433c('0x64')]({'attributes':['id',_0x433c('0x3b')],'where':{'id':_0x5ce21a[_0x433c('0xa7')][_0x433c('0xaf')]}});})[_0x433c('0x21')](function(_0x1cfa3e){if(_0x1cfa3e){_0x5ce21a[_0x433c('0xab')][_0x433c('0xb0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1cfa3e['name']+','+(_0x5ce21a[_0x433c('0x85')][_0x433c('0xb1')]||0xa),'interval':_0x433c('0xad')});}if(!_0x5ce21a[_0x433c('0xa7')][_0x433c('0xb2')])return;return db[_0x433c('0xb3')][_0x433c('0x64')]({'attributes':['id',_0x433c('0x3b')],'where':{'id':_0x5ce21a[_0x433c('0xa7')][_0x433c('0xb2')]}});})[_0x433c('0x21')](function(_0x5f4101){if(_0x5f4101){_0x5ce21a[_0x433c('0xab')][_0x433c('0xb0')]({'id':0x0,'priority':0x1,'app':_0x433c('0xb4'),'appdata':_0x5f4101[_0x433c('0x3b')]+','+(_0x5ce21a[_0x433c('0x85')]['waitForTheAssignedQueue']||0x12c),'interval':_0x433c('0xad')});}return respondWithRpcPromise(_0x433c('0xb5'),_0x433c('0xb6'),_0x5ce21a);})[_0x433c('0x21')](function(_0x4ebdcf){if(_0x4ebdcf){var _0x174128=0xc8;var _0x2863bf=_0x433c('0xb7');logger[_0x433c('0x22')](_0x433c('0xb8'),_0x2863bf,_0x174128,'entity\x20found');logger[_0x433c('0x25')](_0x433c('0xb9'),_0x2863bf,_0x174128,'entity\x20found',JSON[_0x433c('0x26')](_0x4ebdcf));if(_0x5ce21a['account']['type']===_0x433c('0x91')){return _0x3e5f2d[_0x433c('0x2c')](_0x174128)[_0x433c('0x32')](_0x433c('0xba'),_0x433c('0xbb'))['send']('\x0a');}else{return _0x3e5f2d[_0x433c('0x2c')](_0x174128)[_0x433c('0x33')](_0x4ebdcf);}}});})['catch'](handleError(_0x3e5f2d,null));};exports[_0x433c('0x3c')]=function(_0x152d50,_0x554f26,_0x440840){var _0x27bca7,_0x22421a,_0x420658;if(_['isNil'](_0x152d50['body'][_0x433c('0x66')])||_0x152d50[_0x433c('0x66')][_0x433c('0x66')]===''){throw new db['Sequelize'][(_0x433c('0x8d'))](_0x433c('0x9d'));}if(_[_0x433c('0x9a')](_0x152d50[_0x433c('0x66')]['to'])){throw new db[(_0x433c('0x9b'))][(_0x433c('0x8d'))]('to\x20is\x20mandatory');}_0x27bca7=_0x152d50[_0x433c('0x66')]['to'];return db[_0x433c('0x53')][_0x433c('0x64')]({'where':{'id':_0x152d50['params']['id']},'include':[{'model':db['CmList'],'as':_0x433c('0xbc'),'include':[{'model':db[_0x433c('0x8c')],'as':'Contacts','where':{'mobile':_0x27bca7},'limit':0x1,'order':[['updatedAt',_0x433c('0xa3')]]}]}]})[_0x433c('0x21')](handleEntityNotFound(_0x554f26,null))[_0x433c('0x21')](function(_0x32eef5){if(_0x32eef5&&_0x32eef5[_0x433c('0xbc')]){_0x22421a=_0x32eef5['get']({'plain':!![]});if(_0x22421a['List']&&_0x22421a[_0x433c('0xbc')][_0x433c('0xa2')][_0x433c('0x5a')]){return _0x22421a['List'][_0x433c('0xa2')][0x0];}return db[_0x433c('0x8c')][_0x433c('0x5c')](_[_0x433c('0x1c')](_0x152d50[_0x433c('0x66')],{'firstName':_0x27bca7,'mobile':_0x27bca7,'phone':_0x27bca7,'ListId':_0x22421a[_0x433c('0xbd')]}));}})[_0x433c('0x21')](handleEntityNotFound(_0x554f26,null))[_0x433c('0x21')](function(_0x351d86){if(_0x351d86){_0x420658=_0x351d86;return db[_0x433c('0xa6')][_0x433c('0x64')]({'where':{'ContactId':_0x420658['id'],'closed':![],'WhatsappAccountId':_0x22421a['id']}})['then'](function(_0x1f5c54){if(_0x1f5c54){return[_0x1f5c54,![]];}return db[_0x433c('0xa6')][_0x433c('0x5c')]({'UserId':_0x152d50['user']['id'],'ContactId':_0x420658['id'],'WhatsappAccountId':_0x22421a['id'],'phone':_0x27bca7,'firstMsgDirection':_0x433c('0xbe'),'Messages':[_['merge'](_0x152d50[_0x433c('0x66')],{'read':![],'body':_0x152d50['body'][_0x433c('0x66')],'phone':_0x27bca7,'WhatsappAccountId':_0x22421a['id'],'UserId':_0x152d50[_0x433c('0x5d')]['id'],'ContactId':_0x420658['id']})]},{'include':[{'model':db[_0x433c('0xbf')],'as':_0x433c('0xc0')}]})[_0x433c('0x21')](function(_0x6ced82){return[_0x6ced82,!![]];});});}})['spread'](function(_0x2864a1,_0x9f8baa){if(_0x9f8baa){return _0x2864a1;}return db[_0x433c('0xbf')][_0x433c('0x5c')](_[_0x433c('0x50')](_0x152d50[_0x433c('0x66')],{'read':![],'body':_0x152d50[_0x433c('0x66')][_0x433c('0x66')],'phone':_0x27bca7,'WhatsappAccountId':_0x22421a['id'],'WhatsappInteractionId':_0x2864a1['id'],'UserId':_0x152d50[_0x433c('0x5d')]['id'],'ContactId':_0x420658['id']}))[_0x433c('0x21')](function(_0x38b9fc){_0x2864a1[_0x433c('0xc1')][_0x433c('0xc0')]=[];_0x2864a1['dataValues'][_0x433c('0xc0')][_0x433c('0xaa')](_0x38b9fc[_0x433c('0xc1')]);return _0x2864a1;});})[_0x433c('0x21')](respondWithResult(_0x554f26,null))[_0x433c('0x2a')](handleError(_0x554f26,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 70f9ce8..2bfcf3a 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 _0x8b8c=['emit','exports','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x23bd4c,_0x694e0b){var _0x4b385e=function(_0x3f6543){while(--_0x3f6543){_0x23bd4c['push'](_0x23bd4c['shift']());}};_0x4b385e(++_0x694e0b);}(_0x8b8c,0x113));var _0xc8b8=function(_0x3c0180,_0x43a2ec){_0x3c0180=_0x3c0180-0x0;var _0x51f00c=_0x8b8c[_0x3c0180];return _0x51f00c;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0xc8b8('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xc8b8('0x1')](0x0);var events={'afterCreate':_0xc8b8('0x2'),'afterUpdate':_0xc8b8('0x3'),'afterDestroy':_0xc8b8('0x4')};function emitEvent(_0x4e0e18){return function(_0x4d74a0,_0x8ad405,_0xffaea){WhatsappAccountEvents['emit'](_0x4e0e18+':'+_0x4d74a0['id'],_0x4d74a0);WhatsappAccountEvents[_0xc8b8('0x5')](_0x4e0e18,_0x4d74a0);_0xffaea(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xc8b8('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x3e57=['events','../../mysqldb','WhatsappAccount','save','emit','hasOwnProperty'];(function(_0x3d0397,_0x1d64c2){var _0x391edf=function(_0x239f9d){while(--_0x239f9d){_0x3d0397['push'](_0x3d0397['shift']());}};_0x391edf(++_0x1d64c2);}(_0x3e57,0xcc));var _0x73e5=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0x3e57[_0x4191af];return _0x27bebf;};'use strict';var EventEmitter=require(_0x73e5('0x0'));var WhatsappAccount=require(_0x73e5('0x1'))['db'][_0x73e5('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x73e5('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4561e4){return function(_0x39c446,_0x395968,_0x24ac5f){WhatsappAccountEvents['emit'](_0x4561e4+':'+_0x39c446['id'],_0x39c446);WhatsappAccountEvents[_0x73e5('0x4')](_0x4561e4,_0x39c446);_0x24ac5f(null);};}for(var e in events){if(events[_0x73e5('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 4728d3e..cf558d7 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 _0x17cb=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','whatsapp_accounts'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0x17cb,0x172));var _0xb17c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x17cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb17c('0x0'))(_0xb17c('0x1'));var moment=require('moment');var BPromise=require(_0xb17c('0x2'));var rp=require(_0xb17c('0x3'));var fs=require('fs');var path=require(_0xb17c('0x4'));var rimraf=require(_0xb17c('0x5'));var config=require(_0xb17c('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0xb17c('0x7')]=function(_0x531fa0,_0x4e25cd){return _0x531fa0[_0xb17c('0x8')]('WhatsappAccount',attributes,{'tableName':_0xb17c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7678=['exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','bluebird','request-promise','../../config/environment','./whatsappAccount.attributes'];(function(_0xeb7891,_0x4771f7){var _0x11cc19=function(_0x768961){while(--_0x768961){_0xeb7891['push'](_0xeb7891['shift']());}};_0x11cc19(++_0x4771f7);}(_0x7678,0x16c));var _0x8767=function(_0xee22f8,_0x4e8459){_0xee22f8=_0xee22f8-0x0;var _0x2e6c20=_0x7678[_0xee22f8];return _0x2e6c20;};'use strict';var _=require(_0x8767('0x0'));var util=require(_0x8767('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8767('0x2'));var rp=require(_0x8767('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8767('0x4'));var attributes=require(_0x8767('0x5'));module[_0x8767('0x6')]=function(_0x511b7a,_0x1922f8){return _0x511b7a[_0x8767('0x7')](_0x8767('0x8'),attributes,{'tableName':_0x8767('0x9'),'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 688b541..16ad613 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 _0x024b=['WhatsappAccount','find','options','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount'];(function(_0x36cd93,_0x593481){var _0x10f6cd=function(_0x1c3aa3){while(--_0x1c3aa3){_0x36cd93['push'](_0x36cd93['shift']());}};_0x10f6cd(++_0x593481);}(_0x024b,0xac));var _0xb024=function(_0x158be2,_0x59b5e6){_0x158be2=_0x158be2-0x0;var _0x4826ce=_0x024b[_0x158be2];return _0x4826ce;};'use strict';var _=require(_0xb024('0x0'));var util=require(_0xb024('0x1'));var moment=require(_0xb024('0x2'));var BPromise=require('bluebird');var rs=require(_0xb024('0x3'));var fs=require('fs');var Redis=require(_0xb024('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb024('0x5'));var logger=require(_0xb024('0x6'))('rpc');var config=require(_0xb024('0x7'));var jayson=require(_0xb024('0x8'));var client=jayson[_0xb024('0x9')]['http']({'port':0x232a});config['redis']=_[_0xb024('0xa')](config[_0xb024('0xb')],{'host':_0xb024('0xc'),'port':0x18eb});var socket=require(_0xb024('0xd'))(new Redis(config[_0xb024('0xb')]));require(_0xb024('0xe'))['register'](socket);function respondWithRpcPromise(_0x36adb4,_0x1db81b,_0x29467a){return new BPromise(function(_0x3aeb8b,_0x2c8d09){return client['request'](_0x36adb4,_0x29467a)[_0xb024('0xf')](function(_0x587ce1){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1db81b,_0xb024('0x10'));logger[_0xb024('0x11')](_0xb024('0x12'),_0x1db81b,_0xb024('0x10'),JSON['stringify'](_0x587ce1));if(_0x587ce1[_0xb024('0x13')]){if(_0x587ce1[_0xb024('0x13')]['code']===0x1f4){logger[_0xb024('0x13')](_0xb024('0x14'),_0x1db81b,_0x587ce1[_0xb024('0x13')]['message']);return _0x2c8d09(_0x587ce1[_0xb024('0x13')][_0xb024('0x15')]);}logger['error'](_0xb024('0x14'),_0x1db81b,_0x587ce1[_0xb024('0x13')][_0xb024('0x15')]);return _0x3aeb8b(_0x587ce1[_0xb024('0x13')]['message']);}else{logger[_0xb024('0x16')](_0xb024('0x14'),_0x1db81b,'request\x20sent');_0x3aeb8b(_0x587ce1[_0xb024('0x17')][_0xb024('0x15')]);}})[_0xb024('0x18')](function(_0x27992a){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1db81b,_0x27992a);_0x2c8d09(_0x27992a);});});}exports[_0xb024('0x19')]=function(_0x4d23b1){var _0x15e353=this;return new Promise(function(_0x612958,_0x3f7c26){return db[_0xb024('0x1a')][_0xb024('0x1b')]({'raw':_0x4d23b1[_0xb024('0x1c')]?_0x4d23b1[_0xb024('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4d23b1[_0xb024('0x1c')]?_0x4d23b1[_0xb024('0x1c')]['where']||null:null,'attributes':_0x4d23b1[_0xb024('0x1c')]?_0x4d23b1[_0xb024('0x1c')][_0xb024('0x1d')]||null:null,'include':_0x4d23b1['options']?_0x4d23b1['options'][_0xb024('0x1e')]?_[_0xb024('0x1f')](_0x4d23b1['options'][_0xb024('0x1e')],function(_0x51d163){return{'model':db[_0x51d163[_0xb024('0x20')]],'as':_0x51d163['as'],'attributes':_0x51d163[_0xb024('0x1d')],'include':_0x51d163[_0xb024('0x1e')]?_[_0xb024('0x1f')](_0x51d163[_0xb024('0x1e')],function(_0x320037){return{'model':db[_0x320037[_0xb024('0x20')]],'as':_0x320037['as'],'attributes':_0x320037[_0xb024('0x1d')],'include':_0x320037[_0xb024('0x1e')]?_[_0xb024('0x1f')](_0x320037[_0xb024('0x1e')],function(_0x33f102){return{'model':db[_0x33f102[_0xb024('0x20')]],'as':_0x33f102['as'],'attributes':_0x33f102[_0xb024('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb024('0xf')](function(_0x1fdd0f){logger[_0xb024('0x16')]('ShowWhatsappAccount',_0x4d23b1);logger[_0xb024('0x11')]('ShowWhatsappAccount',_0x4d23b1,JSON['stringify'](_0x1fdd0f));_0x612958(_0x1fdd0f);})[_0xb024('0x18')](function(_0x38e74e){logger[_0xb024('0x13')](_0xb024('0x19'),_0x38e74e['message'],_0x4d23b1);_0x3f7c26(_0x15e353['error'](0x1f4,_0x38e74e['message']));});});}; \ No newline at end of file +var _0xfb27=['error','code','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','model','map','then','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xfc8faf,_0x86244a){var _0x48c40b=function(_0x107c22){while(--_0x107c22){_0xfc8faf['push'](_0xfc8faf['shift']());}};_0x48c40b(++_0x86244a);}(_0xfb27,0x7e));var _0x7fb2=function(_0x1bb829,_0x503e6a){_0x1bb829=_0x1bb829-0x0;var _0x235c25=_0xfb27[_0x1bb829];return _0x235c25;};'use strict';var _=require(_0x7fb2('0x0'));var util=require(_0x7fb2('0x1'));var moment=require(_0x7fb2('0x2'));var BPromise=require(_0x7fb2('0x3'));var rs=require(_0x7fb2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fb2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7fb2('0x6'))(_0x7fb2('0x7'));var config=require(_0x7fb2('0x8'));var jayson=require(_0x7fb2('0x9'));var client=jayson[_0x7fb2('0xa')][_0x7fb2('0xb')]({'port':0x232a});config[_0x7fb2('0xc')]=_[_0x7fb2('0xd')](config[_0x7fb2('0xc')],{'host':_0x7fb2('0xe'),'port':0x18eb});var socket=require(_0x7fb2('0xf'))(new Redis(config[_0x7fb2('0xc')]));require('./whatsappAccount.socket')[_0x7fb2('0x10')](socket);function respondWithRpcPromise(_0x4c90e8,_0x442ce8,_0x64e251){return new BPromise(function(_0x6cf461,_0x3dbe12){return client[_0x7fb2('0x11')](_0x4c90e8,_0x64e251)['then'](function(_0x31080f){logger[_0x7fb2('0x12')](_0x7fb2('0x13'),_0x442ce8,_0x7fb2('0x14'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x442ce8,_0x7fb2('0x14'),JSON[_0x7fb2('0x15')](_0x31080f));if(_0x31080f[_0x7fb2('0x16')]){if(_0x31080f[_0x7fb2('0x16')][_0x7fb2('0x17')]===0x1f4){logger[_0x7fb2('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x442ce8,_0x31080f[_0x7fb2('0x16')][_0x7fb2('0x18')]);return _0x3dbe12(_0x31080f[_0x7fb2('0x16')]['message']);}logger['error'](_0x7fb2('0x13'),_0x442ce8,_0x31080f[_0x7fb2('0x16')]['message']);return _0x6cf461(_0x31080f['error'][_0x7fb2('0x18')]);}else{logger[_0x7fb2('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x442ce8,'request\x20sent');_0x6cf461(_0x31080f['result'][_0x7fb2('0x18')]);}})[_0x7fb2('0x19')](function(_0x512d3f){logger['error'](_0x7fb2('0x13'),_0x442ce8,_0x512d3f);_0x3dbe12(_0x512d3f);});});}exports[_0x7fb2('0x1a')]=function(_0x5bdb31){var _0xb78232=this;return new Promise(function(_0x1002a6,_0x34fe6b){return db[_0x7fb2('0x1b')][_0x7fb2('0x1c')]({'raw':_0x5bdb31[_0x7fb2('0x1d')]?_0x5bdb31[_0x7fb2('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5bdb31[_0x7fb2('0x1d')]?_0x5bdb31['options'][_0x7fb2('0x1e')]||null:null,'attributes':_0x5bdb31[_0x7fb2('0x1d')]?_0x5bdb31[_0x7fb2('0x1d')][_0x7fb2('0x1f')]||null:null,'include':_0x5bdb31[_0x7fb2('0x1d')]?_0x5bdb31['options'][_0x7fb2('0x20')]?_['map'](_0x5bdb31[_0x7fb2('0x1d')][_0x7fb2('0x20')],function(_0x108fbc){return{'model':db[_0x108fbc[_0x7fb2('0x21')]],'as':_0x108fbc['as'],'attributes':_0x108fbc['attributes'],'include':_0x108fbc[_0x7fb2('0x20')]?_[_0x7fb2('0x22')](_0x108fbc[_0x7fb2('0x20')],function(_0x40aea2){return{'model':db[_0x40aea2[_0x7fb2('0x21')]],'as':_0x40aea2['as'],'attributes':_0x40aea2[_0x7fb2('0x1f')],'include':_0x40aea2[_0x7fb2('0x20')]?_[_0x7fb2('0x22')](_0x40aea2[_0x7fb2('0x20')],function(_0x3aebf4){return{'model':db[_0x3aebf4[_0x7fb2('0x21')]],'as':_0x3aebf4['as'],'attributes':_0x3aebf4[_0x7fb2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7fb2('0x23')](function(_0x26de5e){logger[_0x7fb2('0x12')](_0x7fb2('0x1a'),_0x5bdb31);logger[_0x7fb2('0x24')](_0x7fb2('0x1a'),_0x5bdb31,JSON['stringify'](_0x26de5e));_0x1002a6(_0x26de5e);})[_0x7fb2('0x19')](function(_0x3d8b3e){logger[_0x7fb2('0x16')](_0x7fb2('0x1a'),_0x3d8b3e[_0x7fb2('0x18')],_0x5bdb31);_0x34fe6b(_0xb78232[_0x7fb2('0x16')](0x1f4,_0x3d8b3e[_0x7fb2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index aef5923..050e5ac 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 _0x58a9=['save','remove','emit','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x1d660d,_0x3d5611){var _0x25910c=function(_0x130e35){while(--_0x130e35){_0x1d660d['push'](_0x1d660d['shift']());}};_0x25910c(++_0x3d5611);}(_0x58a9,0x161));var _0x958a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x58a9[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappAccountEvents=require(_0x958a('0x0'));var events=[_0x958a('0x1'),_0x958a('0x2'),'update'];function createListener(_0x58fd9e,_0x26496b){return function(_0x2090f7){_0x26496b[_0x958a('0x3')](_0x58fd9e,_0x2090f7);};}function removeListener(_0x548013,_0x33b45e){return function(){WhatsappAccountEvents['removeListener'](_0x548013,_0x33b45e);};}exports['register']=function(_0x13e3c2){for(var _0x2d893d=0x0,_0x30924c=events[_0x958a('0x4')];_0x2d893d<_0x30924c;_0x2d893d++){var _0x50eaf0=events[_0x2d893d];var _0x43e50c=createListener(_0x958a('0x5')+_0x50eaf0,_0x13e3c2);WhatsappAccountEvents['on'](_0x50eaf0,_0x43e50c);}}; \ No newline at end of file +var _0xe7ce=['update','removeListener','length','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x2722d8,_0x4fa6d6){var _0x395882=function(_0x110998){while(--_0x110998){_0x2722d8['push'](_0x2722d8['shift']());}};_0x395882(++_0x4fa6d6);}(_0xe7ce,0xd6));var _0xee7c=function(_0x1fd988,_0xf7f376){_0x1fd988=_0x1fd988-0x0;var _0x9c37ab=_0xe7ce[_0x1fd988];return _0x9c37ab;};'use strict';var WhatsappAccountEvents=require(_0xee7c('0x0'));var events=[_0xee7c('0x1'),_0xee7c('0x2'),_0xee7c('0x3')];function createListener(_0xc43766,_0x58265a){return function(_0x36a043){_0x58265a['emit'](_0xc43766,_0x36a043);};}function removeListener(_0x1db325,_0x59118b){return function(){WhatsappAccountEvents[_0xee7c('0x4')](_0x1db325,_0x59118b);};}exports['register']=function(_0x31b7ef){for(var _0x233126=0x0,_0x226111=events[_0xee7c('0x5')];_0x233126<_0x226111;_0x233126++){var _0xef0eb4=events[_0x233126];var _0x4fa26d=createListener(_0xee7c('0x6')+_0xef0eb4,_0x31b7ef);WhatsappAccountEvents['on'](_0xef0eb4,_0x4fa26d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 5a00fc6..80c6eed 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 _0x39ad=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete'];(function(_0x346962,_0x4f69d6){var _0x3f2a3d=function(_0x5cf591){while(--_0x5cf591){_0x346962['push'](_0x346962['shift']());}};_0x3f2a3d(++_0x4f69d6);}(_0x39ad,0xbc));var _0xd39a=function(_0x465014,_0x1fab07){_0x465014=_0x465014-0x0;var _0x2145ac=_0x39ad[_0x465014];return _0x2145ac;};'use strict';var multer=require('multer');var util=require(_0xd39a('0x0'));var path=require(_0xd39a('0x1'));var timeout=require(_0xd39a('0x2'));var express=require('express');var router=express[_0xd39a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd39a('0x4'));var interaction=require(_0xd39a('0x5'));var config=require(_0xd39a('0x6'));var controller=require(_0xd39a('0x7'));router[_0xd39a('0x8')]('/',auth[_0xd39a('0x9')](),controller[_0xd39a('0xa')]);router[_0xd39a('0x8')](_0xd39a('0xb'),auth[_0xd39a('0x9')](),controller[_0xd39a('0xc')]);router[_0xd39a('0xd')]('/',auth[_0xd39a('0x9')](),controller['create']);router['put']('/:id',auth[_0xd39a('0x9')](),controller[_0xd39a('0xe')]);router[_0xd39a('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd39a('0x10')]=router; \ No newline at end of file +var _0xf202=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x19ac3a,_0x24a96d){var _0x1053b8=function(_0x499601){while(--_0x499601){_0x19ac3a['push'](_0x19ac3a['shift']());}};_0x1053b8(++_0x24a96d);}(_0xf202,0x1a1));var _0x2f20=function(_0x4af90e,_0x21babf){_0x4af90e=_0x4af90e-0x0;var _0x5262c6=_0xf202[_0x4af90e];return _0x5262c6;};'use strict';var multer=require(_0x2f20('0x0'));var util=require('util');var path=require(_0x2f20('0x1'));var timeout=require(_0x2f20('0x2'));var express=require(_0x2f20('0x3'));var router=express[_0x2f20('0x4')]();var fs_extra=require(_0x2f20('0x5'));var auth=require(_0x2f20('0x6'));var interaction=require(_0x2f20('0x7'));var config=require(_0x2f20('0x8'));var controller=require('./whatsappApplication.controller');router[_0x2f20('0x9')]('/',auth['isAuthenticated'](),controller[_0x2f20('0xa')]);router[_0x2f20('0x9')](_0x2f20('0xb'),auth[_0x2f20('0xc')](),controller[_0x2f20('0xd')]);router[_0x2f20('0xe')]('/',auth[_0x2f20('0xc')](),controller[_0x2f20('0xf')]);router[_0x2f20('0x10')](_0x2f20('0xb'),auth[_0x2f20('0xc')](),controller[_0x2f20('0x11')]);router[_0x2f20('0x12')](_0x2f20('0xb'),auth[_0x2f20('0xc')](),controller[_0x2f20('0x13')]);module[_0x2f20('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index efd6339..4e19e5b 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 _0xa076=['*,*,*,*','sequelize','exports','noop','TEXT','STRING'];(function(_0x41b8b4,_0x2b8e54){var _0x186585=function(_0x170ff4){while(--_0x170ff4){_0x41b8b4['push'](_0x41b8b4['shift']());}};_0x186585(++_0x2b8e54);}(_0xa076,0xb5));var _0x6a07=function(_0x56128e,_0x57ce23){_0x56128e=_0x56128e-0x0;var _0x2ffed9=_0xa076[_0x56128e];return _0x2ffed9;};'use strict';var Sequelize=require(_0x6a07('0x0'));module[_0x6a07('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6a07('0x2')},'appdata':{'type':Sequelize[_0x6a07('0x3')]()},'description':{'type':Sequelize[_0x6a07('0x4')]},'interval':{'type':Sequelize[_0x6a07('0x4')],'defaultValue':_0x6a07('0x5')}}; \ No newline at end of file +var _0x71b2=['exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x1d32d1,_0x24082e){var _0x8b6f4e=function(_0x3564f5){while(--_0x3564f5){_0x1d32d1['push'](_0x1d32d1['shift']());}};_0x8b6f4e(++_0x24082e);}(_0x71b2,0x195));var _0x271b=function(_0x4e231f,_0x315a9e){_0x4e231f=_0x4e231f-0x0;var _0x43a501=_0x71b2[_0x4e231f];return _0x43a501;};'use strict';var Sequelize=require('sequelize');module[_0x271b('0x0')]={'priority':{'type':Sequelize[_0x271b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x271b('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x271b('0x3')]()},'description':{'type':Sequelize[_0x271b('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x271b('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 80ae08d..6399c0c 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 _0xf03a=['error','stack','send','index','map','WhatsappApplication','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','include','findAll','catch','show','params','length','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x177e14,_0x401d6b){var _0x4dcdfe=function(_0x2c0158){while(--_0x2c0158){_0x177e14['push'](_0x177e14['shift']());}};_0x4dcdfe(++_0x401d6b);}(_0xf03a,0x1a0));var _0xaf03=function(_0x77b9d3,_0x409336){_0x77b9d3=_0x77b9d3-0x0;var _0x10a359=_0xf03a[_0x77b9d3];return _0x10a359;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf03('0x0'));var zipdir=require(_0xaf03('0x1'));var jsonpatch=require(_0xaf03('0x2'));var rp=require(_0xaf03('0x3'));var moment=require('moment');var BPromise=require(_0xaf03('0x4'));var Mustache=require(_0xaf03('0x5'));var util=require('util');var path=require(_0xaf03('0x6'));var sox=require(_0xaf03('0x7'));var csv=require(_0xaf03('0x8'));var ejs=require(_0xaf03('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf03('0xa'));var squel=require('squel');var crypto=require(_0xaf03('0xb'));var jsforce=require(_0xaf03('0xc'));var deskjs=require(_0xaf03('0xd'));var toCsv=require(_0xaf03('0x8'));var querystring=require(_0xaf03('0xe'));var Papa=require(_0xaf03('0xf'));var Redis=require('ioredis');var authService=require(_0xaf03('0x10'));var qs=require(_0xaf03('0x11'));var as=require(_0xaf03('0x12'));var hardwareService=require(_0xaf03('0x13'));var logger=require(_0xaf03('0x14'))('api');var utils=require(_0xaf03('0x15'));var config=require(_0xaf03('0x16'));var licenseUtil=require(_0xaf03('0x17'));var db=require(_0xaf03('0x18'))['db'];function respondWithStatusCode(_0x37156e,_0x216ccd){_0x216ccd=_0x216ccd||0xcc;return function(_0x2b1ccf){if(_0x2b1ccf){return _0x37156e['sendStatus'](_0x216ccd);}return _0x37156e['status'](_0x216ccd)[_0xaf03('0x19')]();};}function respondWithResult(_0x525cfb,_0x464635){_0x464635=_0x464635||0xc8;return function(_0x550e22){if(_0x550e22){return _0x525cfb['status'](_0x464635)[_0xaf03('0x1a')](_0x550e22);}};}function respondWithFilteredResult(_0x2d825c,_0x38ca61){return function(_0x2de266){if(_0x2de266){var _0x342f7a=typeof _0x38ca61[_0xaf03('0x1b')]==='undefined'&&typeof _0x38ca61[_0xaf03('0x1c')]===_0xaf03('0x1d');var _0x12bd6=_0x2de266[_0xaf03('0x1e')];var _0x24a074=_0x342f7a?0x0:_0x38ca61[_0xaf03('0x1b')];var _0x5cede9=_0x342f7a?_0x2de266['count']:_0x38ca61[_0xaf03('0x1b')]+_0x38ca61[_0xaf03('0x1c')];var _0x3f5064;if(_0x5cede9>=_0x12bd6){_0x5cede9=_0x12bd6;_0x3f5064=0xc8;}else{_0x3f5064=0xce;}_0x2d825c[_0xaf03('0x1f')](_0x3f5064);return _0x2d825c[_0xaf03('0x20')]('Content-Range',_0x24a074+'-'+_0x5cede9+'/'+_0x12bd6)[_0xaf03('0x1a')](_0x2de266);}return null;};}function patchUpdates(_0x55eca3){return function(_0x14f5e3){try{jsonpatch[_0xaf03('0x21')](_0x14f5e3,_0x55eca3,!![]);}catch(_0x9e28b4){return BPromise[_0xaf03('0x22')](_0x9e28b4);}return _0x14f5e3[_0xaf03('0x23')]();};}function saveUpdates(_0x3664b6,_0x230dd7){return function(_0x1cefca){if(_0x1cefca){return _0x1cefca[_0xaf03('0x24')](_0x3664b6)[_0xaf03('0x25')](function(_0x1e8cac){return _0x1e8cac;});}return null;};}function removeEntity(_0x49cb83,_0x47647f){return function(_0x1ab68b){if(_0x1ab68b){return _0x1ab68b[_0xaf03('0x26')]()[_0xaf03('0x25')](function(){_0x49cb83['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38aa61,_0x382e43){return function(_0x4db61b){if(!_0x4db61b){_0x38aa61[_0xaf03('0x27')](0x194);}return _0x4db61b;};}function handleError(_0xec24e2,_0x247b05){_0x247b05=_0x247b05||0x1f4;return function(_0x1b1ac8){logger[_0xaf03('0x28')](_0x1b1ac8[_0xaf03('0x29')]);if(_0x1b1ac8['name']){delete _0x1b1ac8['name'];}_0xec24e2[_0xaf03('0x1f')](_0x247b05)[_0xaf03('0x2a')](_0x1b1ac8);};}exports[_0xaf03('0x2b')]=function(_0x166a23,_0x416728){var _0x3a74b9={},_0x2e2d91={},_0x4e98c1={'count':0x0,'rows':[]};var _0x256ed5=_[_0xaf03('0x2c')](db[_0xaf03('0x2d')][_0xaf03('0x2e')],function(_0xe05319){return{'name':_0xe05319['fieldName'],'type':_0xe05319[_0xaf03('0x2f')][_0xaf03('0x30')]};});_0x2e2d91['model']=_[_0xaf03('0x2c')](_0x256ed5,'name');_0x2e2d91[_0xaf03('0x31')]=_[_0xaf03('0x32')](_0x166a23[_0xaf03('0x31')]);_0x2e2d91[_0xaf03('0x33')]=_[_0xaf03('0x34')](_0x2e2d91[_0xaf03('0x35')],_0x2e2d91['query']);_0x3a74b9[_0xaf03('0x36')]=_['intersection'](_0x2e2d91[_0xaf03('0x35')],qs[_0xaf03('0x37')](_0x166a23[_0xaf03('0x31')][_0xaf03('0x37')]));_0x3a74b9['attributes']=_0x3a74b9['attributes']['length']?_0x3a74b9[_0xaf03('0x36')]:_0x2e2d91[_0xaf03('0x35')];if(!_0x166a23[_0xaf03('0x31')][_0xaf03('0x38')]('nolimit')){_0x3a74b9[_0xaf03('0x1c')]=qs[_0xaf03('0x1c')](_0x166a23[_0xaf03('0x31')][_0xaf03('0x1c')]);_0x3a74b9['offset']=qs[_0xaf03('0x1b')](_0x166a23['query'][_0xaf03('0x1b')]);}_0x3a74b9[_0xaf03('0x39')]=qs[_0xaf03('0x3a')](_0x166a23[_0xaf03('0x31')][_0xaf03('0x3a')]);_0x3a74b9[_0xaf03('0x3b')]=qs[_0xaf03('0x33')](_[_0xaf03('0x3c')](_0x166a23[_0xaf03('0x31')],_0x2e2d91['filters']),_0x256ed5);if(_0x166a23[_0xaf03('0x31')][_0xaf03('0x3d')]){_0x3a74b9[_0xaf03('0x3b')]=_[_0xaf03('0x3e')](_0x3a74b9[_0xaf03('0x3b')],{'$or':_['map'](_0x256ed5,function(_0x2e22c8){if(_0x2e22c8['type']!==_0xaf03('0x3f')){var _0x477b31={};_0x477b31[_0x2e22c8[_0xaf03('0x40')]]={'$like':'%'+_0x166a23[_0xaf03('0x31')]['filter']+'%'};return _0x477b31;}})});}_0x3a74b9=_[_0xaf03('0x3e')]({},_0x3a74b9,_0x166a23[_0xaf03('0x41')]);var _0x41a323={'where':_0x3a74b9[_0xaf03('0x3b')]};return db[_0xaf03('0x2d')][_0xaf03('0x1e')](_0x41a323)[_0xaf03('0x25')](function(_0x49236c){_0x4e98c1['count']=_0x49236c;if(_0x166a23[_0xaf03('0x31')]['includeAll']){_0x3a74b9[_0xaf03('0x42')]=[{'all':!![]}];}return db[_0xaf03('0x2d')][_0xaf03('0x43')](_0x3a74b9);})[_0xaf03('0x25')](function(_0x184a88){_0x4e98c1['rows']=_0x184a88;return _0x4e98c1;})[_0xaf03('0x25')](respondWithFilteredResult(_0x416728,_0x3a74b9))[_0xaf03('0x44')](handleError(_0x416728,null));};exports[_0xaf03('0x45')]=function(_0x17efbd,_0x11c11e){var _0x27ad10={'raw':!![],'where':{'id':_0x17efbd[_0xaf03('0x46')]['id']}},_0x133531={};_0x133531['model']=_[_0xaf03('0x32')](db[_0xaf03('0x2d')][_0xaf03('0x2e')]);_0x133531[_0xaf03('0x31')]=_['keys'](_0x17efbd[_0xaf03('0x31')]);_0x133531[_0xaf03('0x33')]=_[_0xaf03('0x34')](_0x133531[_0xaf03('0x35')],_0x133531[_0xaf03('0x31')]);_0x27ad10[_0xaf03('0x36')]=_['intersection'](_0x133531[_0xaf03('0x35')],qs[_0xaf03('0x37')](_0x17efbd[_0xaf03('0x31')][_0xaf03('0x37')]));_0x27ad10['attributes']=_0x27ad10[_0xaf03('0x36')][_0xaf03('0x47')]?_0x27ad10[_0xaf03('0x36')]:_0x133531[_0xaf03('0x35')];if(_0x17efbd[_0xaf03('0x31')][_0xaf03('0x48')]){_0x27ad10[_0xaf03('0x42')]=[{'all':!![]}];}_0x27ad10=_['merge']({},_0x27ad10,_0x17efbd[_0xaf03('0x41')]);return db[_0xaf03('0x2d')][_0xaf03('0x49')](_0x27ad10)[_0xaf03('0x25')](handleEntityNotFound(_0x11c11e,null))['then'](respondWithResult(_0x11c11e,null))[_0xaf03('0x44')](handleError(_0x11c11e,null));};exports['create']=function(_0x5a073b,_0x14dc29){return db[_0xaf03('0x2d')][_0xaf03('0x4a')](_0x5a073b['body'],{})[_0xaf03('0x25')](respondWithResult(_0x14dc29,0xc9))[_0xaf03('0x44')](handleError(_0x14dc29,null));};exports['update']=function(_0x53767e,_0x172cc0){if(_0x53767e[_0xaf03('0x4b')]['id']){delete _0x53767e[_0xaf03('0x4b')]['id'];}return db[_0xaf03('0x2d')][_0xaf03('0x49')]({'where':{'id':_0x53767e[_0xaf03('0x46')]['id']}})[_0xaf03('0x25')](handleEntityNotFound(_0x172cc0,null))['then'](saveUpdates(_0x53767e[_0xaf03('0x4b')],null))['then'](respondWithResult(_0x172cc0,null))['catch'](handleError(_0x172cc0,null));};exports[_0xaf03('0x26')]=function(_0x235043,_0x83c57f){return db[_0xaf03('0x2d')]['find']({'where':{'id':_0x235043[_0xaf03('0x46')]['id']}})[_0xaf03('0x25')](handleEntityNotFound(_0x83c57f,null))[_0xaf03('0x25')](removeEntity(_0x83c57f,null))[_0xaf03('0x44')](handleError(_0x83c57f,null));}; \ No newline at end of file +var _0x6d4b=['json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','status','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter','type','VIRTUAL','merge','options','WhatsappApplication','include','findAll','show','params','length','includeAll','find','create','body','catch','update','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','sendStatus','end'];(function(_0x192f63,_0x5cc16b){var _0x50c2a1=function(_0x433cd5){while(--_0x433cd5){_0x192f63['push'](_0x192f63['shift']());}};_0x50c2a1(++_0x5cc16b);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x273dfc,_0xcac31a){_0x273dfc=_0x273dfc-0x0;var _0x3485ba=_0x6d4b[_0x273dfc];return _0x3485ba;};'use strict';var emlformat=require(_0xb6d4('0x0'));var rimraf=require(_0xb6d4('0x1'));var zipdir=require(_0xb6d4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6d4('0x3'));var moment=require(_0xb6d4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb6d4('0x5'));var path=require(_0xb6d4('0x6'));var sox=require(_0xb6d4('0x7'));var csv=require(_0xb6d4('0x8'));var ejs=require(_0xb6d4('0x9'));var fs=require('fs');var fs_extra=require(_0xb6d4('0xa'));var _=require(_0xb6d4('0xb'));var squel=require(_0xb6d4('0xc'));var crypto=require('crypto');var jsforce=require(_0xb6d4('0xd'));var deskjs=require(_0xb6d4('0xe'));var toCsv=require(_0xb6d4('0x8'));var querystring=require(_0xb6d4('0xf'));var Papa=require(_0xb6d4('0x10'));var Redis=require(_0xb6d4('0x11'));var authService=require(_0xb6d4('0x12'));var qs=require(_0xb6d4('0x13'));var as=require(_0xb6d4('0x14'));var hardwareService=require(_0xb6d4('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb6d4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x900d20,_0x23ca6e){_0x23ca6e=_0x23ca6e||0xcc;return function(_0x13cbfc){if(_0x13cbfc){return _0x900d20[_0xb6d4('0x17')](_0x23ca6e);}return _0x900d20['status'](_0x23ca6e)[_0xb6d4('0x18')]();};}function respondWithResult(_0x2c3af8,_0x4bb27b){_0x4bb27b=_0x4bb27b||0xc8;return function(_0xbad248){if(_0xbad248){return _0x2c3af8['status'](_0x4bb27b)[_0xb6d4('0x19')](_0xbad248);}};}function respondWithFilteredResult(_0x2b7c50,_0x300443){return function(_0x1b0dab){if(_0x1b0dab){var _0x9813c8=typeof _0x300443[_0xb6d4('0x1a')]===_0xb6d4('0x1b')&&typeof _0x300443['limit']===_0xb6d4('0x1b');var _0x14f314=_0x1b0dab[_0xb6d4('0x1c')];var _0x431af2=_0x9813c8?0x0:_0x300443[_0xb6d4('0x1a')];var _0x438053=_0x9813c8?_0x1b0dab[_0xb6d4('0x1c')]:_0x300443[_0xb6d4('0x1a')]+_0x300443[_0xb6d4('0x1d')];var _0x5221e7;if(_0x438053>=_0x14f314){_0x438053=_0x14f314;_0x5221e7=0xc8;}else{_0x5221e7=0xce;}_0x2b7c50['status'](_0x5221e7);return _0x2b7c50[_0xb6d4('0x1e')](_0xb6d4('0x1f'),_0x431af2+'-'+_0x438053+'/'+_0x14f314)[_0xb6d4('0x19')](_0x1b0dab);}return null;};}function patchUpdates(_0x3d3cd6){return function(_0x4e034e){try{jsonpatch['apply'](_0x4e034e,_0x3d3cd6,!![]);}catch(_0x145157){return BPromise[_0xb6d4('0x20')](_0x145157);}return _0x4e034e[_0xb6d4('0x21')]();};}function saveUpdates(_0x5b9fb1,_0x3ee5c4){return function(_0x532cbc){if(_0x532cbc){return _0x532cbc['update'](_0x5b9fb1)[_0xb6d4('0x22')](function(_0x9e402a){return _0x9e402a;});}return null;};}function removeEntity(_0x54ef55,_0x56baa4){return function(_0x3a86ac){if(_0x3a86ac){return _0x3a86ac[_0xb6d4('0x23')]()[_0xb6d4('0x22')](function(){_0x54ef55[_0xb6d4('0x24')](0xcc)[_0xb6d4('0x18')]();});}};}function handleEntityNotFound(_0x223ca0,_0x1d1ac6){return function(_0x474cfc){if(!_0x474cfc){_0x223ca0[_0xb6d4('0x17')](0x194);}return _0x474cfc;};}function handleError(_0x3aedc7,_0xe67526){_0xe67526=_0xe67526||0x1f4;return function(_0x18db34){logger['error'](_0x18db34[_0xb6d4('0x25')]);if(_0x18db34[_0xb6d4('0x26')]){delete _0x18db34['name'];}_0x3aedc7[_0xb6d4('0x24')](_0xe67526)['send'](_0x18db34);};}exports[_0xb6d4('0x27')]=function(_0x3f2e8b,_0x346d4d){var _0x3191d2={},_0x1a311d={},_0x1b7ace={'count':0x0,'rows':[]};var _0x41847c=_[_0xb6d4('0x28')](db['WhatsappApplication'][_0xb6d4('0x29')],function(_0x1fea09){return{'name':_0x1fea09[_0xb6d4('0x2a')],'type':_0x1fea09['type'][_0xb6d4('0x2b')]};});_0x1a311d[_0xb6d4('0x2c')]=_['map'](_0x41847c,_0xb6d4('0x26'));_0x1a311d[_0xb6d4('0x2d')]=_[_0xb6d4('0x2e')](_0x3f2e8b['query']);_0x1a311d['filters']=_['intersection'](_0x1a311d[_0xb6d4('0x2c')],_0x1a311d[_0xb6d4('0x2d')]);_0x3191d2[_0xb6d4('0x2f')]=_[_0xb6d4('0x30')](_0x1a311d[_0xb6d4('0x2c')],qs[_0xb6d4('0x31')](_0x3f2e8b['query']['fields']));_0x3191d2[_0xb6d4('0x2f')]=_0x3191d2['attributes']['length']?_0x3191d2['attributes']:_0x1a311d['model'];if(!_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x32')]('nolimit')){_0x3191d2[_0xb6d4('0x1d')]=qs['limit'](_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x1d')]);_0x3191d2[_0xb6d4('0x1a')]=qs[_0xb6d4('0x1a')](_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x1a')]);}_0x3191d2[_0xb6d4('0x33')]=qs['sort'](_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x34')]);_0x3191d2[_0xb6d4('0x35')]=qs['filters'](_['pick'](_0x3f2e8b[_0xb6d4('0x2d')],_0x1a311d[_0xb6d4('0x36')]),_0x41847c);if(_0x3f2e8b[_0xb6d4('0x2d')][_0xb6d4('0x37')]){_0x3191d2[_0xb6d4('0x35')]=_['merge'](_0x3191d2[_0xb6d4('0x35')],{'$or':_['map'](_0x41847c,function(_0x188a38){if(_0x188a38[_0xb6d4('0x38')]!==_0xb6d4('0x39')){var _0x4e0ac2={};_0x4e0ac2[_0x188a38[_0xb6d4('0x26')]]={'$like':'%'+_0x3f2e8b['query']['filter']+'%'};return _0x4e0ac2;}})});}_0x3191d2=_[_0xb6d4('0x3a')]({},_0x3191d2,_0x3f2e8b[_0xb6d4('0x3b')]);var _0xa71efc={'where':_0x3191d2[_0xb6d4('0x35')]};return db[_0xb6d4('0x3c')][_0xb6d4('0x1c')](_0xa71efc)['then'](function(_0x9c3a24){_0x1b7ace['count']=_0x9c3a24;if(_0x3f2e8b[_0xb6d4('0x2d')]['includeAll']){_0x3191d2[_0xb6d4('0x3d')]=[{'all':!![]}];}return db[_0xb6d4('0x3c')][_0xb6d4('0x3e')](_0x3191d2);})[_0xb6d4('0x22')](function(_0x23aefc){_0x1b7ace['rows']=_0x23aefc;return _0x1b7ace;})[_0xb6d4('0x22')](respondWithFilteredResult(_0x346d4d,_0x3191d2))['catch'](handleError(_0x346d4d,null));};exports[_0xb6d4('0x3f')]=function(_0x2c92c9,_0x12c55e){var _0x1d7960={'raw':!![],'where':{'id':_0x2c92c9[_0xb6d4('0x40')]['id']}},_0x314bfb={};_0x314bfb['model']=_[_0xb6d4('0x2e')](db['WhatsappApplication'][_0xb6d4('0x29')]);_0x314bfb[_0xb6d4('0x2d')]=_[_0xb6d4('0x2e')](_0x2c92c9[_0xb6d4('0x2d')]);_0x314bfb[_0xb6d4('0x36')]=_[_0xb6d4('0x30')](_0x314bfb['model'],_0x314bfb['query']);_0x1d7960[_0xb6d4('0x2f')]=_['intersection'](_0x314bfb['model'],qs[_0xb6d4('0x31')](_0x2c92c9[_0xb6d4('0x2d')][_0xb6d4('0x31')]));_0x1d7960['attributes']=_0x1d7960['attributes'][_0xb6d4('0x41')]?_0x1d7960[_0xb6d4('0x2f')]:_0x314bfb[_0xb6d4('0x2c')];if(_0x2c92c9[_0xb6d4('0x2d')][_0xb6d4('0x42')]){_0x1d7960['include']=[{'all':!![]}];}_0x1d7960=_[_0xb6d4('0x3a')]({},_0x1d7960,_0x2c92c9[_0xb6d4('0x3b')]);return db[_0xb6d4('0x3c')][_0xb6d4('0x43')](_0x1d7960)[_0xb6d4('0x22')](handleEntityNotFound(_0x12c55e,null))[_0xb6d4('0x22')](respondWithResult(_0x12c55e,null))['catch'](handleError(_0x12c55e,null));};exports['create']=function(_0x15eb4d,_0x47efcf){return db['WhatsappApplication'][_0xb6d4('0x44')](_0x15eb4d[_0xb6d4('0x45')],{})[_0xb6d4('0x22')](respondWithResult(_0x47efcf,0xc9))[_0xb6d4('0x46')](handleError(_0x47efcf,null));};exports[_0xb6d4('0x47')]=function(_0x3544ed,_0x28a5d5){if(_0x3544ed['body']['id']){delete _0x3544ed[_0xb6d4('0x45')]['id'];}return db[_0xb6d4('0x3c')][_0xb6d4('0x43')]({'where':{'id':_0x3544ed[_0xb6d4('0x40')]['id']}})['then'](handleEntityNotFound(_0x28a5d5,null))['then'](saveUpdates(_0x3544ed['body'],null))['then'](respondWithResult(_0x28a5d5,null))[_0xb6d4('0x46')](handleError(_0x28a5d5,null));};exports['destroy']=function(_0x2d2891,_0x19c8fd){return db[_0xb6d4('0x3c')][_0xb6d4('0x43')]({'where':{'id':_0x2d2891[_0xb6d4('0x40')]['id']}})[_0xb6d4('0x22')](handleEntityNotFound(_0x19c8fd,null))['then'](removeEntity(_0x19c8fd,null))['catch'](handleError(_0x19c8fd,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 386a171..2456907 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 _0x8ce1=['WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define'];(function(_0x55b4fe,_0x101766){var _0x5ad6c9=function(_0x446261){while(--_0x446261){_0x55b4fe['push'](_0x55b4fe['shift']());}};_0x5ad6c9(++_0x101766);}(_0x8ce1,0x183));var _0x18ce=function(_0x7ad46c,_0x3ab0c1){_0x7ad46c=_0x7ad46c-0x0;var _0x5247c6=_0x8ce1[_0x7ad46c];return _0x5247c6;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require(_0x18ce('0x7'));var rimraf=require(_0x18ce('0x8'));var config=require(_0x18ce('0x9'));var attributes=require(_0x18ce('0xa'));module[_0x18ce('0xb')]=function(_0x13ff9d,_0x36f8db){return _0x13ff9d[_0x18ce('0xc')](_0x18ce('0xd'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x18ce('0xe'),'collate':_0x18ce('0xf')});}; \ No newline at end of file +var _0x9b67=['util','../../config/logger','api','moment','request-promise','path','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash'];(function(_0x1af85b,_0x389cdf){var _0x2bca62=function(_0x5c5ed4){while(--_0x5c5ed4){_0x1af85b['push'](_0x1af85b['shift']());}};_0x2bca62(++_0x389cdf);}(_0x9b67,0xf6));var _0x79b6=function(_0x431331,_0x1b77bb){_0x431331=_0x431331-0x0;var _0x206aa0=_0x9b67[_0x431331];return _0x206aa0;};'use strict';var _=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var logger=require(_0x79b6('0x2'))(_0x79b6('0x3'));var moment=require(_0x79b6('0x4'));var BPromise=require('bluebird');var rp=require(_0x79b6('0x5'));var fs=require('fs');var path=require(_0x79b6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x79b6('0x7'));module[_0x79b6('0x8')]=function(_0x258103,_0xec367e){return _0x258103[_0x79b6('0x9')](_0x79b6('0xa'),attributes,{'tableName':_0x79b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x79b6('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 313f534..1796c92 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 _0x0a9a=['WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x5d245c,_0x858414){var _0x2cfacd=function(_0x3c3f56){while(--_0x3c3f56){_0x5d245c['push'](_0x5d245c['shift']());}};_0x2cfacd(++_0x858414);}(_0x0a9a,0x183));var _0xa0a9=function(_0x1600da,_0x1e572e){_0x1600da=_0x1600da-0x0;var _0x1e0fa6=_0x0a9a[_0x1600da];return _0x1e0fa6;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file +var _0xac9d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x4e25f9,_0xb1ae3c){var _0x454019=function(_0x1853c4){while(--_0x1853c4){_0x4e25f9['push'](_0x4e25f9['shift']());}};_0x454019(++_0xb1ae3c);}(_0xac9d,0x14d));var _0xdac9=function(_0x2813fa,_0x3211d4){_0x2813fa=_0x2813fa-0x0;var _0x8a2acb=_0xac9d[_0x2813fa];return _0x8a2acb;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){return client['request'](_0x776b6c,_0x39f560)[_0xdac9('0xc')](function(_0x3a013b){logger[_0xdac9('0xd')](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));logger[_0xdac9('0x10')](_0xdac9('0x11'),_0x1c78c5,_0xdac9('0xf'),JSON[_0xdac9('0x12')](_0x3a013b));if(_0x3a013b['error']){if(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x14')]===0x1f4){logger['error'](_0xdac9('0xe'),_0x1c78c5,_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);return _0x2b1d6f(_0x3a013b['error'][_0xdac9('0x15')]);}logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x3a013b['error']['message']);return _0x5531af(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);}else{logger['info'](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));_0x5531af(_0x3a013b[_0xdac9('0x16')][_0xdac9('0x15')]);}})[_0xdac9('0x17')](function(_0x393acc){logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x393acc);_0x2b1d6f(_0x393acc);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index cfd0907..f699e0d 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 _0x06f4=['connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','/:id','whatsappinteraction:update','destroy','delete','multer','util'];(function(_0x3702a8,_0x247eed){var _0x498549=function(_0x48c988){while(--_0x48c988){_0x3702a8['push'](_0x3702a8['shift']());}};_0x498549(++_0x247eed);}(_0x06f4,0x136));var _0x406f=function(_0x34d85d,_0x16023c){_0x34d85d=_0x34d85d-0x0;var _0x2e416a=_0x06f4[_0x34d85d];return _0x2e416a;};'use strict';var multer=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var path=require('path');var timeout=require(_0x406f('0x2'));var express=require(_0x406f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x406f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x406f('0x5'));var controller=require(_0x406f('0x6'));router[_0x406f('0x7')]('/',auth[_0x406f('0x8')](),controller['index']);router[_0x406f('0x7')]('/describe',auth[_0x406f('0x8')](),controller[_0x406f('0x9')]);router[_0x406f('0x7')]('/:id',auth[_0x406f('0x8')](),controller['show']);router['get'](_0x406f('0xa'),auth['isAuthenticated'](),controller[_0x406f('0xb')]);router['get'](_0x406f('0xc'),auth['isAuthenticated'](),controller[_0x406f('0xd')]);router[_0x406f('0xe')]('/',auth['isAuthenticated'](),controller[_0x406f('0xf')]);router[_0x406f('0xe')](_0x406f('0xa'),auth[_0x406f('0x8')](),controller[_0x406f('0x10')]);router[_0x406f('0xe')](_0x406f('0x11'),auth[_0x406f('0x8')](),interaction[_0x406f('0x12')](_0x406f('0x13'),_0x406f('0x14')),controller['addTags']);router[_0x406f('0x15')](_0x406f('0x16'),auth[_0x406f('0x8')](),interaction['tracked'](_0x406f('0x13'),_0x406f('0x17')),controller['update']);router['delete'](_0x406f('0x16'),auth[_0x406f('0x8')](),interaction['tracked'](_0x406f('0x13'),'whatsappinteraction:destroy'),controller[_0x406f('0x18')]);router[_0x406f('0x19')](_0x406f('0x11'),auth[_0x406f('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x292c=['getMessages','download','post','create','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','whatsapp','update','delete','tracked','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages'];(function(_0x51cd34,_0x1486f7){var _0x345c33=function(_0x28e222){while(--_0x28e222){_0x51cd34['push'](_0x51cd34['shift']());}};_0x345c33(++_0x1486f7);}(_0x292c,0x66));var _0xc292=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x292c[_0x874cf1];return _0x233579;};'use strict';var multer=require(_0xc292('0x0'));var util=require('util');var path=require(_0xc292('0x1'));var timeout=require(_0xc292('0x2'));var express=require(_0xc292('0x3'));var router=express[_0xc292('0x4')]();var fs_extra=require(_0xc292('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc292('0x6'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0xc292('0x7')]('/',auth[_0xc292('0x8')](),controller[_0xc292('0x9')]);router[_0xc292('0x7')](_0xc292('0xa'),auth[_0xc292('0x8')](),controller[_0xc292('0xb')]);router[_0xc292('0x7')](_0xc292('0xc'),auth[_0xc292('0x8')](),controller['show']);router[_0xc292('0x7')](_0xc292('0xd'),auth[_0xc292('0x8')](),controller[_0xc292('0xe')]);router[_0xc292('0x7')]('/:id/download',auth[_0xc292('0x8')](),controller[_0xc292('0xf')]);router[_0xc292('0x10')]('/',auth[_0xc292('0x8')](),controller[_0xc292('0x11')]);router[_0xc292('0x10')]('/:id/messages',auth[_0xc292('0x8')](),controller[_0xc292('0x12')]);router[_0xc292('0x10')](_0xc292('0x13'),auth[_0xc292('0x8')](),interaction['tracked']('whatsapp',_0xc292('0x14')),controller[_0xc292('0x15')]);router['put'](_0xc292('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xc292('0x16'),'whatsappinteraction:update'),controller[_0xc292('0x17')]);router[_0xc292('0x18')](_0xc292('0xc'),auth['isAuthenticated'](),interaction[_0xc292('0x19')]('whatsapp','whatsappinteraction:destroy'),controller[_0xc292('0x1a')]);router[_0xc292('0x18')]('/:id/tags',auth[_0xc292('0x8')](),controller[_0xc292('0x1b')]);module[_0xc292('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 644f61a..e02e2f7 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 _0x50a8=['STRING','ENUM','out','INTEGER','moment','BOOLEAN','DATE'];(function(_0x42e2ea,_0x46fc6f){var _0x2e4fc9=function(_0x378ae5){while(--_0x378ae5){_0x42e2ea['push'](_0x42e2ea['shift']());}};_0x2e4fc9(++_0x46fc6f);}(_0x50a8,0x193));var _0x850a=function(_0x32d8f6,_0x153146){_0x32d8f6=_0x32d8f6-0x0;var _0x4d6740=_0x50a8[_0x32d8f6];return _0x4d6740;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x850a('0x0'));module['exports']={'closed':{'type':Sequelize[_0x850a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x850a('0x2')]},'disposition':{'type':Sequelize[_0x850a('0x3')]},'secondDisposition':{'type':Sequelize[_0x850a('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x850a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x850a('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x850a('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x850a('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x850a('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x850a('0x6')]}}; \ No newline at end of file +var _0x0a48=['DATE','STRING','ENUM','out','INTEGER','sequelize','moment','BOOLEAN'];(function(_0x302dfa,_0x466f11){var _0x11b69b=function(_0x5e9d52){while(--_0x5e9d52){_0x302dfa['push'](_0x302dfa['shift']());}};_0x11b69b(++_0x466f11);}(_0x0a48,0x95));var _0x80a4=function(_0x51eba4,_0x1ed011){_0x51eba4=_0x51eba4-0x0;var _0x3195ce=_0x0a48[_0x51eba4];return _0x3195ce;};'use strict';var Sequelize=require(_0x80a4('0x0'));var moment=require(_0x80a4('0x1'));module['exports']={'closed':{'type':Sequelize[_0x80a4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x80a4('0x3')]},'disposition':{'type':Sequelize[_0x80a4('0x4')]},'secondDisposition':{'type':Sequelize[_0x80a4('0x4')]},'thirdDisposition':{'type':Sequelize[_0x80a4('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x80a4('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x80a4('0x5')]('in',_0x80a4('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x80a4('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x80a4('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x80a4('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 0b0bed9..65b9ac7 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 _0xe8fc=['omit','getMessages','findOne','hasOwnProperty','nolimit','sort','filters','pick','WhatsappInteractionId','filter','where','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','WhatsappMessage','addTags','setTags','spread','Tag','color','whatsappInteractionTags:save','removeTags','download','root','server','files','tmp','attachments','join','push','User','fullname','CmContact','firstName','lastName','Attachment','createdAt','read','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','N.A.','toString','disposition','Messages','createReadStream','pipe','createWriteStream','basename','direction','out','System','Contact','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','stack','name','send','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','user','show','params','keys','intersection','attributes','fields','length','model','includeAll','include','merge','find','catch','create','body','update','destroy','describe','addMessage','ids'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0xe8fc,0x144));var _0xce8f=function(_0x16a637,_0x5eb627){_0x16a637=_0x16a637-0x0;var _0x25126d=_0xe8fc[_0x16a637];return _0x25126d;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xce8f('0x0'));var moment=require(_0xce8f('0x1'));var BPromise=require(_0xce8f('0x2'));var util=require(_0xce8f('0x3'));var path=require(_0xce8f('0x4'));var ejs=require(_0xce8f('0x5'));var fs=require('fs');var _=require(_0xce8f('0x6'));var Redis=require(_0xce8f('0x7'));var interaction=require(_0xce8f('0x8'));var qs=require(_0xce8f('0x9'));var pdf=require(_0xce8f('0xa'));var logger=require('../../config/logger')('api');var config=require(_0xce8f('0xb'));var db=require(_0xce8f('0xc'))['db'];config[_0xce8f('0xd')]=_[_0xce8f('0xe')](config[_0xce8f('0xd')],{'host':_0xce8f('0xf'),'port':0x18eb});var socket=require(_0xce8f('0x10'))(new Redis(config[_0xce8f('0xd')]));require(_0xce8f('0x11'))[_0xce8f('0x12')](socket);function respondWithStatusCode(_0x4a9975,_0x5c4487){_0x5c4487=_0x5c4487||0xcc;return function(_0x16d11e){if(_0x16d11e){return _0x4a9975[_0xce8f('0x13')](_0x5c4487);}return _0x4a9975[_0xce8f('0x14')](_0x5c4487)[_0xce8f('0x15')]();};}function respondWithResult(_0x52a422,_0x640bd2){_0x640bd2=_0x640bd2||0xc8;return function(_0x5b2823){if(_0x5b2823){return _0x52a422['status'](_0x640bd2)[_0xce8f('0x16')](_0x5b2823);}};}function respondWithFilteredResult(_0x1767a7,_0x5e4f1d){return function(_0x2df5cb){if(_0x2df5cb){var _0xd79e16=typeof _0x5e4f1d[_0xce8f('0x17')]==='undefined'&&typeof _0x5e4f1d[_0xce8f('0x18')]===_0xce8f('0x19');var _0x5c3567=_0x2df5cb['count'];var _0x5d2749=_0xd79e16?0x0:_0x5e4f1d[_0xce8f('0x17')];var _0x20a4c9=_0xd79e16?_0x2df5cb[_0xce8f('0x1a')]:_0x5e4f1d['offset']+_0x5e4f1d['limit'];var _0xcef0d0;if(_0x20a4c9>=_0x5c3567){_0x20a4c9=_0x5c3567;_0xcef0d0=0xc8;}else{_0xcef0d0=0xce;}_0x1767a7[_0xce8f('0x14')](_0xcef0d0);return _0x1767a7[_0xce8f('0x1b')](_0xce8f('0x1c'),_0x5d2749+'-'+_0x20a4c9+'/'+_0x5c3567)[_0xce8f('0x16')](_0x2df5cb);}return null;};}function saveUpdates(_0x481f58){return function(_0x40fd42){if(_0x40fd42){return _0x40fd42['update'](_0x481f58)[_0xce8f('0x1d')](function(_0x12ba63){return _0x12ba63;});}return null;};}function removeEntity(_0x165cea){return function(_0x512db2){if(_0x512db2){return _0x512db2['destroy']()[_0xce8f('0x1d')](function(){_0x165cea['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x986f77){return function(_0x24bdb6){if(!_0x24bdb6){_0x986f77[_0xce8f('0x13')](0x194);}return _0x24bdb6;};}function handleError(_0x3955d7,_0x52df58){_0x52df58=_0x52df58||0x1f4;return function(_0xb48e06){logger['error'](_0xb48e06[_0xce8f('0x1e')]);if(_0xb48e06[_0xce8f('0x1f')]){delete _0xb48e06[_0xce8f('0x1f')];}_0x3955d7[_0xce8f('0x14')](_0x52df58)[_0xce8f('0x20')](_0xb48e06);};}exports['index']=function(_0x2942d5,_0x39b7e0){var _0x54b430={};var _0x4e6a93=_[_0xce8f('0x21')](db[_0xce8f('0x22')][_0xce8f('0x23')],function(_0x4d078f){return{'name':_0x4d078f[_0xce8f('0x24')],'type':_0x4d078f['type'][_0xce8f('0x25')]};});_0x54b430=qs[_0xce8f('0x26')](_0x4e6a93,_0x2942d5);return interaction[_0xce8f('0x27')](_0xce8f('0x28'),_0x2942d5[_0xce8f('0x29')],_0x2942d5[_0xce8f('0x2a')],_0x54b430,_0x4e6a93)[_0xce8f('0x1d')](respondWithFilteredResult(_0x39b7e0,_0x54b430))['catch'](handleError(_0x39b7e0,null));};exports[_0xce8f('0x2b')]=function(_0x31f5e7,_0x17c367){var _0x3c3ea3={'raw':![],'where':{'id':_0x31f5e7[_0xce8f('0x2c')]['id']}},_0x56e0a4={};_0x56e0a4['model']=_[_0xce8f('0x2d')](db[_0xce8f('0x22')]['rawAttributes']);_0x56e0a4[_0xce8f('0x29')]=_[_0xce8f('0x2d')](_0x31f5e7[_0xce8f('0x29')]);_0x56e0a4['filters']=_[_0xce8f('0x2e')](_0x56e0a4['model'],_0x56e0a4[_0xce8f('0x29')]);_0x3c3ea3[_0xce8f('0x2f')]=_['intersection'](_0x56e0a4['model'],qs[_0xce8f('0x30')](_0x31f5e7[_0xce8f('0x29')][_0xce8f('0x30')]));_0x3c3ea3['attributes']=_0x3c3ea3[_0xce8f('0x2f')][_0xce8f('0x31')]?_0x3c3ea3[_0xce8f('0x2f')]:_0x56e0a4[_0xce8f('0x32')];if(_0x31f5e7[_0xce8f('0x29')][_0xce8f('0x33')]){_0x3c3ea3[_0xce8f('0x34')]=[{'all':!![]}];}_0x3c3ea3=_[_0xce8f('0x35')]({},_0x3c3ea3,_0x31f5e7['options']);return db[_0xce8f('0x22')][_0xce8f('0x36')](_0x3c3ea3)[_0xce8f('0x1d')](handleEntityNotFound(_0x17c367,null))[_0xce8f('0x1d')](respondWithResult(_0x17c367,null))[_0xce8f('0x37')](handleError(_0x17c367,null));};exports['create']=function(_0xf43ac6,_0x1c8853){return db[_0xce8f('0x22')][_0xce8f('0x38')](_0xf43ac6[_0xce8f('0x39')],{})[_0xce8f('0x1d')](respondWithResult(_0x1c8853,0xc9))['catch'](handleError(_0x1c8853,null));};exports[_0xce8f('0x3a')]=function(_0x21b64a,_0x47e01c){if(_0x21b64a[_0xce8f('0x39')]['id']){delete _0x21b64a[_0xce8f('0x39')]['id'];}return db[_0xce8f('0x22')][_0xce8f('0x36')]({'where':{'id':_0x21b64a[_0xce8f('0x2c')]['id']}})[_0xce8f('0x1d')](handleEntityNotFound(_0x47e01c,null))[_0xce8f('0x1d')](saveUpdates(_0x21b64a[_0xce8f('0x39')],null))[_0xce8f('0x1d')](respondWithResult(_0x47e01c,null))[_0xce8f('0x37')](handleError(_0x47e01c,null));};exports[_0xce8f('0x3b')]=function(_0x4add64,_0x18a902){return db[_0xce8f('0x22')][_0xce8f('0x36')]({'where':{'id':_0x4add64[_0xce8f('0x2c')]['id']}})[_0xce8f('0x1d')](handleEntityNotFound(_0x18a902,null))[_0xce8f('0x1d')](removeEntity(_0x18a902,null))['catch'](handleError(_0x18a902,null));};exports[_0xce8f('0x3c')]=function(_0x555174,_0x16947a){return db[_0xce8f('0x22')][_0xce8f('0x3c')]()[_0xce8f('0x1d')](respondWithResult(_0x16947a,null))[_0xce8f('0x37')](handleError(_0x16947a,null));};exports[_0xce8f('0x3d')]=function(_0x361733,_0x3a8892){return db['WhatsappMessage']['find']({'where':{'id':_0x361733['params']['id']}})[_0xce8f('0x1d')](handleEntityNotFound(_0x3a8892,null))[_0xce8f('0x1d')](function(_0x5e15e8){if(_0x5e15e8){return _0x5e15e8[_0xce8f('0x3d')](_0x361733[_0xce8f('0x39')][_0xce8f('0x3e')],_[_0xce8f('0x3f')](_0x361733[_0xce8f('0x39')],[_0xce8f('0x3e'),'id'])||{});}})[_0xce8f('0x1d')](respondWithResult(_0x3a8892,null))[_0xce8f('0x37')](handleError(_0x3a8892,null));};exports[_0xce8f('0x40')]=function(_0x3aa3e7,_0x51f548){var _0x4b8b43={'raw':![],'where':{}};var _0x1ea310={};var _0x2d6ea2={'count':0x0,'rows':[]};return db[_0xce8f('0x22')][_0xce8f('0x41')]({'where':{'id':_0x3aa3e7[_0xce8f('0x2c')]['id']}})['then'](handleEntityNotFound(_0x51f548,null))[_0xce8f('0x1d')](function(_0xb09d47){if(_0xb09d47){_0x1ea310[_0xce8f('0x32')]=_[_0xce8f('0x2d')](db['WhatsappMessage']['rawAttributes']);_0x1ea310[_0xce8f('0x29')]=_['keys'](_0x3aa3e7[_0xce8f('0x29')]);_0x1ea310['filters']=_['intersection'](_0x1ea310[_0xce8f('0x32')],_0x1ea310['query']);_0x4b8b43[_0xce8f('0x2f')]=_[_0xce8f('0x2e')](_0x1ea310[_0xce8f('0x32')],qs['fields'](_0x3aa3e7[_0xce8f('0x29')][_0xce8f('0x30')]));_0x4b8b43[_0xce8f('0x2f')]=_0x4b8b43['attributes'][_0xce8f('0x31')]?_0x4b8b43[_0xce8f('0x2f')]:_0x1ea310[_0xce8f('0x32')];if(!_0x3aa3e7[_0xce8f('0x29')][_0xce8f('0x42')](_0xce8f('0x43'))){_0x4b8b43[_0xce8f('0x18')]=qs[_0xce8f('0x18')](_0x3aa3e7[_0xce8f('0x29')][_0xce8f('0x18')]);_0x4b8b43[_0xce8f('0x17')]=qs[_0xce8f('0x17')](_0x3aa3e7['query'][_0xce8f('0x17')]);}_0x4b8b43['order']=qs[_0xce8f('0x44')](_0x3aa3e7[_0xce8f('0x29')][_0xce8f('0x44')]);_0x4b8b43['where']=qs[_0xce8f('0x45')](_[_0xce8f('0x46')](_0x3aa3e7[_0xce8f('0x29')],_0x1ea310[_0xce8f('0x45')]));_0x4b8b43['where'][_0xce8f('0x47')]=_0xb09d47['id'];if(_0x3aa3e7[_0xce8f('0x29')][_0xce8f('0x48')]){_0x4b8b43[_0xce8f('0x49')]=_[_0xce8f('0x35')](_0x4b8b43['where'],{'$or':_[_0xce8f('0x21')](_0x4b8b43[_0xce8f('0x2f')],function(_0x16c611){var _0x59cf0b={};_0x59cf0b[_0x16c611]={'$like':'%'+_0x3aa3e7[_0xce8f('0x29')]['filter']+'%'};return _0x59cf0b;})});}if(_0x3aa3e7[_0xce8f('0x29')][_0xce8f('0x4a')]){var _0x295726=_0x3aa3e7['query'][_0xce8f('0x4a')][_0xce8f('0x4b')](',');var _0x3d99d0={};_0x3d99d0[_0x295726[0x0]]={'$gte':moment(_0x295726[0x1])[_0xce8f('0x4c')](_0xce8f('0x4d'))};_0x4b8b43[_0xce8f('0x49')]=_['merge'](_0x4b8b43['where'],_0x3d99d0);}_0x4b8b43=_[_0xce8f('0x35')]({},_0x4b8b43,_0x3aa3e7[_0xce8f('0x4e')]);return db[_0xce8f('0x4f')][_0xce8f('0x1a')]({'where':_0x4b8b43[_0xce8f('0x49')]})[_0xce8f('0x1d')](function(_0xd0297b){_0x2d6ea2[_0xce8f('0x1a')]=_0xd0297b;if(_0x3aa3e7['query'][_0xce8f('0x33')]){_0x4b8b43[_0xce8f('0x34')]=[{'all':!![]}];}return db[_0xce8f('0x4f')][_0xce8f('0x27')](_0x4b8b43);})['then'](function(_0xf5aced){_0x2d6ea2['rows']=_0xf5aced;return _0x2d6ea2;});}})['then'](respondWithFilteredResult(_0x51f548,_0x4b8b43))[_0xce8f('0x37')](handleError(_0x51f548,null));};exports[_0xce8f('0x50')]=function(_0x43ca80,_0x3e4ae5){return db['WhatsappInteraction'][_0xce8f('0x36')]({'where':{'id':_0x43ca80['params']['id']}})[_0xce8f('0x1d')](handleEntityNotFound(_0x3e4ae5,null))[_0xce8f('0x1d')](function(_0x48a53e){if(_0x48a53e){return _0x48a53e[_0xce8f('0x51')](_0x43ca80['body'][_0xce8f('0x3e')],_['omit'](_0x43ca80['body'],[_0xce8f('0x3e'),'id'])||{})[_0xce8f('0x52')](function(){return db[_0xce8f('0x53')]['findAll']({'attributes':['id','name',_0xce8f('0x54')],'where':{'id':_0x43ca80['body']['ids']}});})[_0xce8f('0x1d')](function(_0x37b69b){socket['emit'](_0xce8f('0x55'),{'id':Number(_0x43ca80[_0xce8f('0x2c')]['id']),'tags':_0x37b69b||[]});return{'id':Number(_0x43ca80[_0xce8f('0x2c')]['id']),'tags':_0x37b69b||[]};});}})[_0xce8f('0x1d')](respondWithResult(_0x3e4ae5,null))[_0xce8f('0x37')](handleError(_0x3e4ae5,null));};exports[_0xce8f('0x56')]=function(_0x169e0f,_0x307ee7){return db[_0xce8f('0x22')][_0xce8f('0x36')]({'where':{'id':_0x169e0f['params']['id']}})['then'](handleEntityNotFound(_0x307ee7,null))[_0xce8f('0x1d')](function(_0x31fd34){if(_0x31fd34){return _0x31fd34[_0xce8f('0x56')](_0x169e0f[_0xce8f('0x29')][_0xce8f('0x3e')]);}})['then'](respondWithStatusCode(_0x307ee7,null))[_0xce8f('0x37')](handleError(_0x307ee7,null));};exports[_0xce8f('0x57')]=function(_0x368e40,_0xdd2f94){var _0x11962e=moment()['unix']()['toString']();var _0x3e5556=path['join'](config[_0xce8f('0x58')],_0xce8f('0x59'),_0xce8f('0x5a'),_0xce8f('0x5b'));var _0x47ff75=path['join'](config[_0xce8f('0x58')],_0xce8f('0x59'),'files',_0xce8f('0x5c'));var _0xb733cb=path[_0xce8f('0x5d')](_0x3e5556,_0x11962e);var _0x50ba06=util[_0xce8f('0x4c')]('transcript-%d-%s.zip',_0x368e40[_0xce8f('0x2c')]['id'],_0x11962e);var _0x37dbf8=path['join'](_0x3e5556,_0x50ba06);var _0x2ffede=[];_0x2ffede[_0xce8f('0x5e')]({'model':db[_0xce8f('0x5f')],'as':_0xce8f('0x5f'),'attributes':['id',_0xce8f('0x60')],'raw':!![]});_0x2ffede[_0xce8f('0x5e')]({'model':db[_0xce8f('0x61')],'as':'Contact','attributes':['id',_0xce8f('0x62'),_0xce8f('0x63')],'raw':!![]});if(_0x368e40[_0xce8f('0x29')][_0xce8f('0x5c')]){_0x2ffede[_0xce8f('0x5e')]({'model':db[_0xce8f('0x64')],'as':'Attachment','raw':!![]});}var _0x54be4c=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0xce8f('0x39'),_0xce8f('0x65'),'direction','secret',_0xce8f('0x66')],'include':_0x2ffede}];_0x54be4c[_0xce8f('0x5e')]({'model':db[_0xce8f('0x67')],'as':'Account','attributes':['id',_0xce8f('0x1f')]});_0x54be4c[_0xce8f('0x5e')]({'model':db[_0xce8f('0x5f')],'as':_0xce8f('0x68'),'attributes':['id','fullname']});return db[_0xce8f('0x22')]['find']({'where':{'id':_0x368e40['params']['id']},'include':_0x54be4c})[_0xce8f('0x1d')](handleEntityNotFound(_0xdd2f94,null))[_0xce8f('0x1d')](function(_0x494bea){if(_0x494bea){var _0x196f26=_0x494bea[_0xce8f('0x69')]({'plain':!![]});fs[_0xce8f('0x6a')](_0xb733cb);var _0x35358d={'channel':_0xce8f('0x6b'),'account':_0x196f26[_0xce8f('0x6c')][_0xce8f('0x1f')],'agent':_0x196f26[_0xce8f('0x68')]?_0x196f26[_0xce8f('0x68')][_0xce8f('0x60')]:_0xce8f('0x6d'),'createdAt':moment(_0x196f26['createdAt'])[_0xce8f('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xce8f('0x6e')](),'closedAt':_0x196f26['closed']?moment(_0x196f26['closedAt'])[_0xce8f('0x4c')](_0xce8f('0x4d'))['toString']():'','disposition':_0x196f26[_0xce8f('0x6f')],'messages':_(_0x196f26[_0xce8f('0x70')])[_0xce8f('0x48')]({'secret':![]})['map'](function(_0x4cab35){if(_0x4cab35[_0xce8f('0x64')]){var _0x4b2363=path['join'](_0x47ff75,_0x4cab35[_0xce8f('0x64')]['basename']);if(fs['existsSync'](_0x4b2363)){fs[_0xce8f('0x71')](_0x4b2363)[_0xce8f('0x72')](fs[_0xce8f('0x73')](path[_0xce8f('0x5d')](_0xb733cb,_0x4cab35[_0xce8f('0x64')][_0xce8f('0x74')])));}}return{'date':moment(_0x4cab35[_0xce8f('0x65')])['format'](_0xce8f('0x4d'))['toString'](),'sender':_0x4cab35[_0xce8f('0x75')]===_0xce8f('0x76')?_0x4cab35[_0xce8f('0x5f')]?_0x4cab35[_0xce8f('0x5f')]['fullname']:_0xce8f('0x77'):_0x4cab35['Contact'][_0xce8f('0x62')]+(_0x4cab35['Contact'][_0xce8f('0x63')]?'\x20'+_0x4cab35[_0xce8f('0x78')][_0xce8f('0x63')]:''),'body':_0x4cab35[_0xce8f('0x64')]?_0x4cab35['Attachment'][_0xce8f('0x74')]:_0x4cab35[_0xce8f('0x39')],'direction':_0x4cab35[_0xce8f('0x75')]===_0xce8f('0x76')?'A':'C','secret':_0x4cab35['secret'],'read':_0x4cab35[_0xce8f('0x66')],'attachment':_0x4cab35[_0xce8f('0x64')]};})[_0xce8f('0x79')]()};return ejs[_0xce8f('0x7a')](path['join'](config[_0xce8f('0x58')],_0xce8f('0x59'),_0xce8f('0x7b'),'downloadInteraction.ejs'),{'interaction':_0x35358d})[_0xce8f('0x1d')](function(_0x10f86b){var _0x929f33=path[_0xce8f('0x5d')](_0xb733cb,_0xce8f('0x7c')+_0x196f26['id']+'-'+_0x11962e+_0xce8f('0x7d'));var _0x478d18={'path':_0x929f33,'channel':_0xce8f('0x6b'),'interactionId':_0x196f26['id']};return pdf[_0xce8f('0x7e')](_0x10f86b,_0x478d18);})[_0xce8f('0x1d')](function(){return new BPromise(function(_0x4db8c2,_0x1b056a){zipdir(_0xb733cb,{'saveTo':_0x37dbf8},function(_0x5e1bee,_0x1b8bb5){if(_0x5e1bee)return _0x1b056a(_0x5e1bee);return _0x4db8c2(_0x1b8bb5);});})[_0xce8f('0x1d')](function(){return new BPromise(function(_0x521540,_0x3af38a){rimraf(_0xb733cb,function(_0x27b6f4){if(_0x27b6f4)_0x3af38a(_0x27b6f4);return _0x521540();});});})[_0xce8f('0x1d')](function(){return _0xdd2f94[_0xce8f('0x57')](_0x37dbf8,_0x50ba06,function(_0x1c213f){if(_0x1c213f){console['log'](_0xce8f('0x7f'),_0x1c213f);}else{fs[_0xce8f('0x80')](_0x37dbf8);}});});});}else{return _0xdd2f94['sendStatus'](0xc8);}})[_0xce8f('0x37')](handleError(_0xdd2f94,null));}; \ No newline at end of file +var _0x1efe=['limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','findAll','whatsapp','query','user','catch','show','params','keys','WhatsappInteraction','intersection','attributes','model','fields','merge','body','find','describe','WhatsappMessage','addMessage','ids','findOne','order','sort','where','filters','pick','WhatsappInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','setTags','omit','spread','Tag','whatsappInteractionTags:save','download','join','root','server','tmp','files','attachments','format','transcript-%d-%s.zip','push','User','fullname','firstName','Attachment','Messages','createdAt','secret','read','Account','Owner','get','mkdirSync','Whatsapp','toString','closed','closedAt','disposition','basename','createReadStream','direction','out','System','Contact','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','sendStatus','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','redis','./whatsappInteraction.socket','register','status','end','offset','undefined'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0x1efe,0x1d5));var _0xe1ef=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x1efe[_0x373dee];return _0x46798f;};'use strict';var rimraf=require(_0xe1ef('0x0'));var zipdir=require(_0xe1ef('0x1'));var moment=require(_0xe1ef('0x2'));var BPromise=require(_0xe1ef('0x3'));var util=require(_0xe1ef('0x4'));var path=require(_0xe1ef('0x5'));var ejs=require(_0xe1ef('0x6'));var fs=require('fs');var _=require(_0xe1ef('0x7'));var Redis=require(_0xe1ef('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0xe1ef('0x9'));var pdf=require(_0xe1ef('0xa'));var logger=require(_0xe1ef('0xb'))('api');var config=require(_0xe1ef('0xc'));var db=require(_0xe1ef('0xd'))['db'];config['redis']=_[_0xe1ef('0xe')](config['redis'],{'host':_0xe1ef('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe1ef('0x10')]));require(_0xe1ef('0x11'))[_0xe1ef('0x12')](socket);function respondWithStatusCode(_0x26bfa2,_0x36d257){_0x36d257=_0x36d257||0xcc;return function(_0x133b2a){if(_0x133b2a){return _0x26bfa2['sendStatus'](_0x36d257);}return _0x26bfa2[_0xe1ef('0x13')](_0x36d257)[_0xe1ef('0x14')]();};}function respondWithResult(_0xcf9fc4,_0x35240b){_0x35240b=_0x35240b||0xc8;return function(_0x5d9c7c){if(_0x5d9c7c){return _0xcf9fc4['status'](_0x35240b)['json'](_0x5d9c7c);}};}function respondWithFilteredResult(_0x2a9d5f,_0x4a7a04){return function(_0x3b2230){if(_0x3b2230){var _0x46a961=typeof _0x4a7a04[_0xe1ef('0x15')]===_0xe1ef('0x16')&&typeof _0x4a7a04[_0xe1ef('0x17')]===_0xe1ef('0x16');var _0x1b5e4a=_0x3b2230[_0xe1ef('0x18')];var _0x3bf5b3=_0x46a961?0x0:_0x4a7a04[_0xe1ef('0x15')];var _0x117af8=_0x46a961?_0x3b2230[_0xe1ef('0x18')]:_0x4a7a04[_0xe1ef('0x15')]+_0x4a7a04['limit'];var _0x25890e;if(_0x117af8>=_0x1b5e4a){_0x117af8=_0x1b5e4a;_0x25890e=0xc8;}else{_0x25890e=0xce;}_0x2a9d5f['status'](_0x25890e);return _0x2a9d5f[_0xe1ef('0x19')](_0xe1ef('0x1a'),_0x3bf5b3+'-'+_0x117af8+'/'+_0x1b5e4a)[_0xe1ef('0x1b')](_0x3b2230);}return null;};}function saveUpdates(_0x14f294){return function(_0x254a53){if(_0x254a53){return _0x254a53[_0xe1ef('0x1c')](_0x14f294)[_0xe1ef('0x1d')](function(_0x5cbf8e){return _0x5cbf8e;});}return null;};}function removeEntity(_0x28eb20){return function(_0x2dcf06){if(_0x2dcf06){return _0x2dcf06[_0xe1ef('0x1e')]()[_0xe1ef('0x1d')](function(){_0x28eb20[_0xe1ef('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb97b7d){return function(_0x56037a){if(!_0x56037a){_0xb97b7d['sendStatus'](0x194);}return _0x56037a;};}function handleError(_0x39e003,_0x178f9e){_0x178f9e=_0x178f9e||0x1f4;return function(_0x1bf2b1){logger[_0xe1ef('0x1f')](_0x1bf2b1[_0xe1ef('0x20')]);if(_0x1bf2b1[_0xe1ef('0x21')]){delete _0x1bf2b1[_0xe1ef('0x21')];}_0x39e003[_0xe1ef('0x13')](_0x178f9e)[_0xe1ef('0x22')](_0x1bf2b1);};}exports[_0xe1ef('0x23')]=function(_0x1351fb,_0x223156){var _0x12af87={};var _0x22f6e4=_[_0xe1ef('0x24')](db['WhatsappInteraction'][_0xe1ef('0x25')],function(_0x47a8f8){return{'name':_0x47a8f8[_0xe1ef('0x26')],'type':_0x47a8f8[_0xe1ef('0x27')][_0xe1ef('0x28')]};});_0x12af87=qs['getOptions'](_0x22f6e4,_0x1351fb);return interaction[_0xe1ef('0x29')](_0xe1ef('0x2a'),_0x1351fb[_0xe1ef('0x2b')],_0x1351fb[_0xe1ef('0x2c')],_0x12af87,_0x22f6e4)['then'](respondWithFilteredResult(_0x223156,_0x12af87))[_0xe1ef('0x2d')](handleError(_0x223156,null));};exports[_0xe1ef('0x2e')]=function(_0x39c9fd,_0x54a133){var _0x29893c={'raw':![],'where':{'id':_0x39c9fd[_0xe1ef('0x2f')]['id']}},_0x17c3d5={};_0x17c3d5['model']=_[_0xe1ef('0x30')](db[_0xe1ef('0x31')]['rawAttributes']);_0x17c3d5[_0xe1ef('0x2b')]=_['keys'](_0x39c9fd['query']);_0x17c3d5['filters']=_[_0xe1ef('0x32')](_0x17c3d5['model'],_0x17c3d5[_0xe1ef('0x2b')]);_0x29893c[_0xe1ef('0x33')]=_[_0xe1ef('0x32')](_0x17c3d5[_0xe1ef('0x34')],qs['fields'](_0x39c9fd[_0xe1ef('0x2b')][_0xe1ef('0x35')]));_0x29893c['attributes']=_0x29893c['attributes']['length']?_0x29893c[_0xe1ef('0x33')]:_0x17c3d5[_0xe1ef('0x34')];if(_0x39c9fd[_0xe1ef('0x2b')]['includeAll']){_0x29893c['include']=[{'all':!![]}];}_0x29893c=_[_0xe1ef('0x36')]({},_0x29893c,_0x39c9fd['options']);return db[_0xe1ef('0x31')]['find'](_0x29893c)[_0xe1ef('0x1d')](handleEntityNotFound(_0x54a133,null))[_0xe1ef('0x1d')](respondWithResult(_0x54a133,null))[_0xe1ef('0x2d')](handleError(_0x54a133,null));};exports['create']=function(_0x122f72,_0x3791dc){return db[_0xe1ef('0x31')]['create'](_0x122f72[_0xe1ef('0x37')],{})[_0xe1ef('0x1d')](respondWithResult(_0x3791dc,0xc9))[_0xe1ef('0x2d')](handleError(_0x3791dc,null));};exports[_0xe1ef('0x1c')]=function(_0x6ee0b,_0x5873fd){if(_0x6ee0b[_0xe1ef('0x37')]['id']){delete _0x6ee0b[_0xe1ef('0x37')]['id'];}return db['WhatsappInteraction'][_0xe1ef('0x38')]({'where':{'id':_0x6ee0b[_0xe1ef('0x2f')]['id']}})[_0xe1ef('0x1d')](handleEntityNotFound(_0x5873fd,null))[_0xe1ef('0x1d')](saveUpdates(_0x6ee0b[_0xe1ef('0x37')],null))[_0xe1ef('0x1d')](respondWithResult(_0x5873fd,null))['catch'](handleError(_0x5873fd,null));};exports[_0xe1ef('0x1e')]=function(_0x4150ae,_0x140d0b){return db[_0xe1ef('0x31')][_0xe1ef('0x38')]({'where':{'id':_0x4150ae[_0xe1ef('0x2f')]['id']}})[_0xe1ef('0x1d')](handleEntityNotFound(_0x140d0b,null))[_0xe1ef('0x1d')](removeEntity(_0x140d0b,null))[_0xe1ef('0x2d')](handleError(_0x140d0b,null));};exports[_0xe1ef('0x39')]=function(_0x5d2e0b,_0x3d82e4){return db[_0xe1ef('0x31')][_0xe1ef('0x39')]()[_0xe1ef('0x1d')](respondWithResult(_0x3d82e4,null))[_0xe1ef('0x2d')](handleError(_0x3d82e4,null));};exports['addMessage']=function(_0x1b3155,_0x3d2fd9){return db[_0xe1ef('0x3a')][_0xe1ef('0x38')]({'where':{'id':_0x1b3155[_0xe1ef('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3d2fd9,null))[_0xe1ef('0x1d')](function(_0xd1065d){if(_0xd1065d){return _0xd1065d[_0xe1ef('0x3b')](_0x1b3155[_0xe1ef('0x37')][_0xe1ef('0x3c')],_['omit'](_0x1b3155[_0xe1ef('0x37')],['ids','id'])||{});}})[_0xe1ef('0x1d')](respondWithResult(_0x3d2fd9,null))['catch'](handleError(_0x3d2fd9,null));};exports['getMessages']=function(_0x69d7d7,_0x4573d6){var _0x15b14f={'raw':![],'where':{}};var _0x16bfd4={};var _0x463220={'count':0x0,'rows':[]};return db[_0xe1ef('0x31')][_0xe1ef('0x3d')]({'where':{'id':_0x69d7d7[_0xe1ef('0x2f')]['id']}})[_0xe1ef('0x1d')](handleEntityNotFound(_0x4573d6,null))[_0xe1ef('0x1d')](function(_0x4ab5b4){if(_0x4ab5b4){_0x16bfd4[_0xe1ef('0x34')]=_[_0xe1ef('0x30')](db[_0xe1ef('0x3a')][_0xe1ef('0x25')]);_0x16bfd4[_0xe1ef('0x2b')]=_[_0xe1ef('0x30')](_0x69d7d7['query']);_0x16bfd4['filters']=_[_0xe1ef('0x32')](_0x16bfd4[_0xe1ef('0x34')],_0x16bfd4[_0xe1ef('0x2b')]);_0x15b14f[_0xe1ef('0x33')]=_[_0xe1ef('0x32')](_0x16bfd4[_0xe1ef('0x34')],qs[_0xe1ef('0x35')](_0x69d7d7['query'][_0xe1ef('0x35')]));_0x15b14f['attributes']=_0x15b14f[_0xe1ef('0x33')]['length']?_0x15b14f['attributes']:_0x16bfd4['model'];if(!_0x69d7d7['query']['hasOwnProperty']('nolimit')){_0x15b14f['limit']=qs[_0xe1ef('0x17')](_0x69d7d7[_0xe1ef('0x2b')][_0xe1ef('0x17')]);_0x15b14f[_0xe1ef('0x15')]=qs[_0xe1ef('0x15')](_0x69d7d7[_0xe1ef('0x2b')]['offset']);}_0x15b14f[_0xe1ef('0x3e')]=qs[_0xe1ef('0x3f')](_0x69d7d7[_0xe1ef('0x2b')][_0xe1ef('0x3f')]);_0x15b14f[_0xe1ef('0x40')]=qs[_0xe1ef('0x41')](_[_0xe1ef('0x42')](_0x69d7d7[_0xe1ef('0x2b')],_0x16bfd4[_0xe1ef('0x41')]));_0x15b14f[_0xe1ef('0x40')][_0xe1ef('0x43')]=_0x4ab5b4['id'];if(_0x69d7d7[_0xe1ef('0x2b')]['filter']){_0x15b14f['where']=_[_0xe1ef('0x36')](_0x15b14f['where'],{'$or':_[_0xe1ef('0x24')](_0x15b14f['attributes'],function(_0x3cc575){var _0x95e385={};_0x95e385[_0x3cc575]={'$like':'%'+_0x69d7d7[_0xe1ef('0x2b')][_0xe1ef('0x44')]+'%'};return _0x95e385;})});}if(_0x69d7d7[_0xe1ef('0x2b')]['$gte']){var _0x4b01ce=_0x69d7d7[_0xe1ef('0x2b')][_0xe1ef('0x45')][_0xe1ef('0x46')](',');var _0xec945a={};_0xec945a[_0x4b01ce[0x0]]={'$gte':moment(_0x4b01ce[0x1])['format'](_0xe1ef('0x47'))};_0x15b14f[_0xe1ef('0x40')]=_[_0xe1ef('0x36')](_0x15b14f['where'],_0xec945a);}_0x15b14f=_['merge']({},_0x15b14f,_0x69d7d7[_0xe1ef('0x48')]);return db['WhatsappMessage']['count']({'where':_0x15b14f['where']})['then'](function(_0x553839){_0x463220[_0xe1ef('0x18')]=_0x553839;if(_0x69d7d7['query'][_0xe1ef('0x49')]){_0x15b14f['include']=[{'all':!![]}];}return db[_0xe1ef('0x3a')][_0xe1ef('0x29')](_0x15b14f);})[_0xe1ef('0x1d')](function(_0xd5dd23){_0x463220[_0xe1ef('0x4a')]=_0xd5dd23;return _0x463220;});}})[_0xe1ef('0x1d')](respondWithFilteredResult(_0x4573d6,_0x15b14f))['catch'](handleError(_0x4573d6,null));};exports['addTags']=function(_0x581fd3,_0x83bb41){return db[_0xe1ef('0x31')][_0xe1ef('0x38')]({'where':{'id':_0x581fd3[_0xe1ef('0x2f')]['id']}})[_0xe1ef('0x1d')](handleEntityNotFound(_0x83bb41,null))[_0xe1ef('0x1d')](function(_0xf0ddc0){if(_0xf0ddc0){return _0xf0ddc0[_0xe1ef('0x4b')](_0x581fd3[_0xe1ef('0x37')]['ids'],_[_0xe1ef('0x4c')](_0x581fd3[_0xe1ef('0x37')],[_0xe1ef('0x3c'),'id'])||{})[_0xe1ef('0x4d')](function(){return db[_0xe1ef('0x4e')][_0xe1ef('0x29')]({'attributes':['id','name','color'],'where':{'id':_0x581fd3['body']['ids']}});})['then'](function(_0x16d65e){socket['emit'](_0xe1ef('0x4f'),{'id':Number(_0x581fd3[_0xe1ef('0x2f')]['id']),'tags':_0x16d65e||[]});return{'id':Number(_0x581fd3[_0xe1ef('0x2f')]['id']),'tags':_0x16d65e||[]};});}})[_0xe1ef('0x1d')](respondWithResult(_0x83bb41,null))[_0xe1ef('0x2d')](handleError(_0x83bb41,null));};exports['removeTags']=function(_0x336422,_0x24efa5){return db[_0xe1ef('0x31')]['find']({'where':{'id':_0x336422[_0xe1ef('0x2f')]['id']}})[_0xe1ef('0x1d')](handleEntityNotFound(_0x24efa5,null))[_0xe1ef('0x1d')](function(_0x2da77a){if(_0x2da77a){return _0x2da77a['removeTags'](_0x336422[_0xe1ef('0x2b')][_0xe1ef('0x3c')]);}})[_0xe1ef('0x1d')](respondWithStatusCode(_0x24efa5,null))[_0xe1ef('0x2d')](handleError(_0x24efa5,null));};exports[_0xe1ef('0x50')]=function(_0x2daad8,_0x596e55){var _0x572f5c=moment()['unix']()['toString']();var _0x13c62a=path[_0xe1ef('0x51')](config[_0xe1ef('0x52')],_0xe1ef('0x53'),'files',_0xe1ef('0x54'));var _0x4b9545=path['join'](config[_0xe1ef('0x52')],_0xe1ef('0x53'),_0xe1ef('0x55'),_0xe1ef('0x56'));var _0x3645b1=path['join'](_0x13c62a,_0x572f5c);var _0x477606=util[_0xe1ef('0x57')](_0xe1ef('0x58'),_0x2daad8[_0xe1ef('0x2f')]['id'],_0x572f5c);var _0xa2de1e=path[_0xe1ef('0x51')](_0x13c62a,_0x477606);var _0x177754=[];_0x177754[_0xe1ef('0x59')]({'model':db[_0xe1ef('0x5a')],'as':_0xe1ef('0x5a'),'attributes':['id',_0xe1ef('0x5b')],'raw':!![]});_0x177754['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xe1ef('0x5c'),'lastName'],'raw':!![]});if(_0x2daad8[_0xe1ef('0x2b')][_0xe1ef('0x56')]){_0x177754['push']({'model':db[_0xe1ef('0x5d')],'as':_0xe1ef('0x5d'),'raw':!![]});}var _0x30fb68=[{'model':db[_0xe1ef('0x3a')],'as':_0xe1ef('0x5e'),'attributes':['id',_0xe1ef('0x37'),_0xe1ef('0x5f'),'direction',_0xe1ef('0x60'),_0xe1ef('0x61')],'include':_0x177754}];_0x30fb68[_0xe1ef('0x59')]({'model':db['WhatsappAccount'],'as':_0xe1ef('0x62'),'attributes':['id','name']});_0x30fb68[_0xe1ef('0x59')]({'model':db[_0xe1ef('0x5a')],'as':_0xe1ef('0x63'),'attributes':['id',_0xe1ef('0x5b')]});return db['WhatsappInteraction'][_0xe1ef('0x38')]({'where':{'id':_0x2daad8[_0xe1ef('0x2f')]['id']},'include':_0x30fb68})['then'](handleEntityNotFound(_0x596e55,null))[_0xe1ef('0x1d')](function(_0x386914){if(_0x386914){var _0x593239=_0x386914[_0xe1ef('0x64')]({'plain':!![]});fs[_0xe1ef('0x65')](_0x3645b1);var _0x58ad81={'channel':_0xe1ef('0x66'),'account':_0x593239[_0xe1ef('0x62')][_0xe1ef('0x21')],'agent':_0x593239[_0xe1ef('0x63')]?_0x593239[_0xe1ef('0x63')][_0xe1ef('0x5b')]:'N.A.','createdAt':moment(_0x593239[_0xe1ef('0x5f')])[_0xe1ef('0x57')](_0xe1ef('0x47'))[_0xe1ef('0x67')](),'closedAt':_0x593239[_0xe1ef('0x68')]?moment(_0x593239[_0xe1ef('0x69')])[_0xe1ef('0x57')](_0xe1ef('0x47'))[_0xe1ef('0x67')]():'','disposition':_0x593239[_0xe1ef('0x6a')],'messages':_(_0x593239['Messages'])['filter']({'secret':![]})[_0xe1ef('0x24')](function(_0x320d87){if(_0x320d87[_0xe1ef('0x5d')]){var _0x2f34dd=path[_0xe1ef('0x51')](_0x4b9545,_0x320d87[_0xe1ef('0x5d')][_0xe1ef('0x6b')]);if(fs['existsSync'](_0x2f34dd)){fs[_0xe1ef('0x6c')](_0x2f34dd)['pipe'](fs['createWriteStream'](path[_0xe1ef('0x51')](_0x3645b1,_0x320d87[_0xe1ef('0x5d')][_0xe1ef('0x6b')])));}}return{'date':moment(_0x320d87[_0xe1ef('0x5f')])['format'](_0xe1ef('0x47'))[_0xe1ef('0x67')](),'sender':_0x320d87[_0xe1ef('0x6d')]===_0xe1ef('0x6e')?_0x320d87[_0xe1ef('0x5a')]?_0x320d87[_0xe1ef('0x5a')][_0xe1ef('0x5b')]:_0xe1ef('0x6f'):_0x320d87[_0xe1ef('0x70')][_0xe1ef('0x5c')]+(_0x320d87['Contact'][_0xe1ef('0x71')]?'\x20'+_0x320d87[_0xe1ef('0x70')][_0xe1ef('0x71')]:''),'body':_0x320d87[_0xe1ef('0x5d')]?_0x320d87[_0xe1ef('0x5d')][_0xe1ef('0x6b')]:_0x320d87[_0xe1ef('0x37')],'direction':_0x320d87[_0xe1ef('0x6d')]==='out'?'A':'C','secret':_0x320d87['secret'],'read':_0x320d87[_0xe1ef('0x61')],'attachment':_0x320d87['Attachment']};})[_0xe1ef('0x72')]()};return ejs[_0xe1ef('0x73')](path[_0xe1ef('0x51')](config['root'],_0xe1ef('0x53'),_0xe1ef('0x74'),_0xe1ef('0x75')),{'interaction':_0x58ad81})[_0xe1ef('0x1d')](function(_0x3d84b5){var _0x1c921e=path['join'](_0x3645b1,_0xe1ef('0x76')+_0x593239['id']+'-'+_0x572f5c+_0xe1ef('0x77'));var _0x20a0ce={'path':_0x1c921e,'channel':_0xe1ef('0x66'),'interactionId':_0x593239['id']};return pdf['createPdfFromHTML'](_0x3d84b5,_0x20a0ce);})[_0xe1ef('0x1d')](function(){return new BPromise(function(_0x1a32f6,_0x5b3828){zipdir(_0x3645b1,{'saveTo':_0xa2de1e},function(_0x4f965f,_0x1a9c78){if(_0x4f965f)return _0x5b3828(_0x4f965f);return _0x1a32f6(_0x1a9c78);});})[_0xe1ef('0x1d')](function(){return new BPromise(function(_0x339cf3,_0x58f464){rimraf(_0x3645b1,function(_0x5d3bee){if(_0x5d3bee)_0x58f464(_0x5d3bee);return _0x339cf3();});});})[_0xe1ef('0x1d')](function(){return _0x596e55[_0xe1ef('0x50')](_0xa2de1e,_0x477606,function(_0x432d1d){if(_0x432d1d){console[_0xe1ef('0x78')](_0xe1ef('0x79'),_0x432d1d);}else{fs['unlinkSync'](_0xa2de1e);}});});});}else{return _0x596e55[_0xe1ef('0x7a')](0xc8);}})[_0xe1ef('0x2d')](handleError(_0x596e55,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index e9788fe..045d45d 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 _0xc831=['then','length','emit','hasOwnProperty','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0xc831,0x103));var _0x1c83=function(_0x47e470,_0x161293){_0x47e470=_0x47e470-0x0;var _0x2f9d8d=_0xc831[_0x47e470];return _0x2f9d8d;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x1c83('0x0'))['db'][_0x1c83('0x1')];var WhatsappMessage=require(_0x1c83('0x0'))['db'][_0x1c83('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1c83('0x3')](0x0);var events={'afterCreate':_0x1c83('0x4'),'afterUpdate':_0x1c83('0x5'),'afterDestroy':_0x1c83('0x6')};function emitEvent(_0x1a2a48){return function(_0x1c0cde,_0x4fb4c3,_0x5682fb){_0x1c0cde[_0x1c83('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1ce77e){_0x1c0cde[_0x1c83('0x8')](_0x1c83('0x9'),_0x1ce77e[_0x1c83('0xa')](function(_0x282313){return{'id':_0x282313['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x1c0cde['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1c83('0xb')](function(_0x405dfe){_0x1c0cde['setDataValue']('unreadMessages',_0x405dfe[_0x1c83('0xc')]);WhatsappInteractionEvents[_0x1c83('0xd')](_0x1a2a48+':'+_0x1c0cde['id'],_0x1c0cde);WhatsappInteractionEvents[_0x1c83('0xd')](_0x1a2a48,_0x1c0cde);_0x5682fb(null);})['catch'](_0x5682fb(null));};}for(var e in events){if(events[_0x1c83('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x2504=['length','emit','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x2504,0xee));var _0x4250=function(_0x6ef390,_0x101c0c){_0x6ef390=_0x6ef390-0x0;var _0x3ded55=_0x2504[_0x6ef390];return _0x3ded55;};'use strict';var EventEmitter=require(_0x4250('0x0'));var WhatsappInteraction=require(_0x4250('0x1'))['db'][_0x4250('0x2')];var WhatsappMessage=require(_0x4250('0x1'))['db'][_0x4250('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4250('0x4')](0x0);var events={'afterCreate':_0x4250('0x5'),'afterUpdate':_0x4250('0x6'),'afterDestroy':_0x4250('0x7')};function emitEvent(_0xc31f3a){return function(_0xe5986d,_0x33d70b,_0x493da9){_0xe5986d[_0x4250('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5a5286){_0xe5986d[_0x4250('0x9')](_0x4250('0xa'),_0x5a5286[_0x4250('0xb')](function(_0x3c5dba){return{'id':_0x3c5dba['id']};}));return WhatsappMessage[_0x4250('0xc')]({'where':{'WhatsappInteractionId':_0xe5986d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1016b9){_0xe5986d['setDataValue'](_0x4250('0xd'),_0x1016b9[_0x4250('0xe')]);WhatsappInteractionEvents['emit'](_0xc31f3a+':'+_0xe5986d['id'],_0xe5986d);WhatsappInteractionEvents[_0x4250('0xf')](_0xc31f3a,_0xe5986d);_0x493da9(null);})['catch'](_0x493da9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x4250('0x10')](e,emitEvent(event));}}module[_0x4250('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 2471f67..0f02158 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 _0x56b7=['moment','bluebird','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x586427,_0x1b56b2){var _0xe47d32=function(_0x4ec44c){while(--_0x4ec44c){_0x586427['push'](_0x586427['shift']());}};_0xe47d32(++_0x1b56b2);}(_0x56b7,0x193));var _0x756b=function(_0x38d832,_0xf2104d){_0x38d832=_0x38d832-0x0;var _0x2e166e=_0x56b7[_0x38d832];return _0x2e166e;};'use strict';var _=require(_0x756b('0x0'));var util=require(_0x756b('0x1'));var logger=require(_0x756b('0x2'))('api');var moment=require(_0x756b('0x3'));var BPromise=require(_0x756b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x756b('0x5'));var rimraf=require('rimraf');var config=require(_0x756b('0x6'));var attributes=require(_0x756b('0x7'));module[_0x756b('0x8')]=function(_0x301dc1,_0x11e96f){return _0x301dc1[_0x756b('0x9')](_0x756b('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49962d,_0x5d53c5,_0x477867){if(_0x49962d[_0x756b('0xb')]('closed')){_0x49962d[_0x756b('0xc')]=moment()['format'](_0x756b('0xd'));}_0x477867(null,_0x49962d);}}});}; \ No newline at end of file +var _0x609b=['bluebird','request-promise','rimraf','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x609b,0x155));var _0xb609=function(_0x5291f8,_0x431564){_0x5291f8=_0x5291f8-0x0;var _0x29830c=_0x609b[_0x5291f8];return _0x29830c;};'use strict';var _=require(_0xb609('0x0'));var util=require(_0xb609('0x1'));var logger=require(_0xb609('0x2'))('api');var moment=require(_0xb609('0x3'));var BPromise=require(_0xb609('0x4'));var rp=require(_0xb609('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb609('0x6'));var config=require('../../config/environment');var attributes=require(_0xb609('0x7'));module['exports']=function(_0x19d91d,_0x23549c){return _0x19d91d[_0xb609('0x8')](_0xb609('0x9'),attributes,{'tableName':_0xb609('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14ed39,_0x5d0a2f,_0x1eabb8){if(_0x14ed39['changed'](_0xb609('0xb'))){_0x14ed39[_0xb609('0xc')]=moment()[_0xb609('0xd')](_0xb609('0xe'));}_0x1eabb8(null,_0x14ed39);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 1542e39..b2ddbf0 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 _0x94e5=['debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateWhatsappInteraction','WhatsappInteraction','body','options','attributes','limit','catch','find','where','then','addTags','omit','spread','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent'];(function(_0x4abb2f,_0xa69cb4){var _0x14cbad=function(_0x5c1d65){while(--_0x5c1d65){_0x4abb2f['push'](_0x4abb2f['shift']());}};_0x14cbad(++_0xa69cb4);}(_0x94e5,0x161));var _0x594e=function(_0x37236a,_0x41085f){_0x37236a=_0x37236a-0x0;var _0x689f44=_0x94e5[_0x37236a];return _0x689f44;};'use strict';var _=require('lodash');var util=require(_0x594e('0x0'));var moment=require('moment');var BPromise=require(_0x594e('0x1'));var rs=require(_0x594e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x594e('0x3'))['db'];var utils=require(_0x594e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x594e('0x5'));var jayson=require(_0x594e('0x6'));var client=jayson[_0x594e('0x7')][_0x594e('0x8')]({'port':0x232a});config[_0x594e('0x9')]=_['defaults'](config[_0x594e('0x9')],{'host':_0x594e('0xa'),'port':0x18eb});var socket=require(_0x594e('0xb'))(new Redis(config[_0x594e('0x9')]));require('./whatsappInteraction.socket')[_0x594e('0xc')](socket);function respondWithRpcPromise(_0x31fd2c,_0x2c1d0d,_0x164989){return new BPromise(function(_0xf0f1b7,_0xc8c9eb){return client[_0x594e('0xd')](_0x31fd2c,_0x164989)['then'](function(_0xcc1516){logger[_0x594e('0xe')](_0x594e('0xf'),_0x2c1d0d,_0x594e('0x10'));logger[_0x594e('0x11')](_0x594e('0x12'),_0x2c1d0d,_0x594e('0x10'),JSON[_0x594e('0x13')](_0xcc1516));if(_0xcc1516[_0x594e('0x14')]){if(_0xcc1516[_0x594e('0x14')][_0x594e('0x15')]===0x1f4){logger['error'](_0x594e('0xf'),_0x2c1d0d,_0xcc1516['error'][_0x594e('0x16')]);return _0xc8c9eb(_0xcc1516[_0x594e('0x14')][_0x594e('0x16')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x2c1d0d,_0xcc1516[_0x594e('0x14')][_0x594e('0x16')]);return _0xf0f1b7(_0xcc1516[_0x594e('0x14')][_0x594e('0x16')]);}else{logger[_0x594e('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x2c1d0d,_0x594e('0x10'));_0xf0f1b7(_0xcc1516['result'][_0x594e('0x16')]);}})['catch'](function(_0x38590b){logger[_0x594e('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x2c1d0d,_0x38590b);_0xc8c9eb(_0x38590b);});});}exports[_0x594e('0x17')]=function(_0x51ec6e){var _0x40c122=this;return new Promise(function(_0x5e22be,_0x57b610){return db[_0x594e('0x18')]['update'](_0x51ec6e[_0x594e('0x19')],{'raw':_0x51ec6e[_0x594e('0x1a')]?_0x51ec6e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51ec6e[_0x594e('0x1a')]?_0x51ec6e[_0x594e('0x1a')]['where']||null:null,'attributes':_0x51ec6e[_0x594e('0x1a')]?_0x51ec6e[_0x594e('0x1a')][_0x594e('0x1b')]||null:null,'limit':_0x51ec6e[_0x594e('0x1a')]?_0x51ec6e['options'][_0x594e('0x1c')]||null:null})['then'](function(_0x304c7d){logger[_0x594e('0xe')](_0x594e('0x17'),_0x51ec6e);logger[_0x594e('0x11')]('UpdateWhatsappInteraction',_0x51ec6e,JSON[_0x594e('0x13')](_0x304c7d));_0x5e22be(_0x304c7d);})[_0x594e('0x1d')](function(_0x139b9b){logger[_0x594e('0x14')](_0x594e('0x17'),_0x139b9b['message'],_0x51ec6e);_0x57b610(_0x40c122[_0x594e('0x14')](0x1f4,_0x139b9b['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x56f7ee){return new Promise(function(_0x280c50,_0x2c0b54){return db[_0x594e('0x18')][_0x594e('0x1e')]({'where':_0x56f7ee[_0x594e('0x1a')]?_0x56f7ee[_0x594e('0x1a')][_0x594e('0x1f')]||null:null})[_0x594e('0x20')](function(_0x5882ed){if(_0x5882ed){return _0x5882ed[_0x594e('0x21')](_0x56f7ee[_0x594e('0x19')]['ids'],_[_0x594e('0x22')](_0x56f7ee[_0x594e('0x19')],['ids','id'])||{});}})[_0x594e('0x23')](function(_0x27fdb2){logger[_0x594e('0xe')]('AddTags',_0x56f7ee);logger['debug'](_0x594e('0x24'),_0x56f7ee,JSON[_0x594e('0x13')](_0x27fdb2));_0x280c50(_0x27fdb2);})[_0x594e('0x1d')](function(_0x4f7df8){logger[_0x594e('0x14')](_0x594e('0x24'),_0x4f7df8[_0x594e('0x16')],_0x56f7ee);_0x2c0b54(_this['error'](0x1f4,_0x4f7df8[_0x594e('0x16')]));});});}; \ No newline at end of file +var _0x2f1b=['spread','AddTags','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','limit','then','AddTagsToWhatsappInteraction','find','addTags','ids'];(function(_0xeb2a7a,_0x2451d2){var _0x22e732=function(_0x50364f){while(--_0x50364f){_0xeb2a7a['push'](_0xeb2a7a['shift']());}};_0x22e732(++_0x2451d2);}(_0x2f1b,0xcf));var _0xb2f1=function(_0x360586,_0x35c5af){_0x360586=_0x360586-0x0;var _0x1d8eb3=_0x2f1b[_0x360586];return _0x1d8eb3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb2f1('0x0'));var BPromise=require('bluebird');var rs=require(_0xb2f1('0x1'));var fs=require('fs');var Redis=require(_0xb2f1('0x2'));var db=require(_0xb2f1('0x3'))['db'];var utils=require(_0xb2f1('0x4'));var logger=require('../../config/logger')(_0xb2f1('0x5'));var config=require(_0xb2f1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb2f1('0x7')][_0xb2f1('0x8')]({'port':0x232a});config[_0xb2f1('0x9')]=_[_0xb2f1('0xa')](config[_0xb2f1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb2f1('0xb'))(new Redis(config['redis']));require(_0xb2f1('0xc'))[_0xb2f1('0xd')](socket);function respondWithRpcPromise(_0x1f48d8,_0x5ef1f8,_0x47f005){return new BPromise(function(_0x12e626,_0x37e6cb){return client[_0xb2f1('0xe')](_0x1f48d8,_0x47f005)['then'](function(_0x3b0ec9){logger[_0xb2f1('0xf')](_0xb2f1('0x10'),_0x5ef1f8,_0xb2f1('0x11'));logger[_0xb2f1('0x12')](_0xb2f1('0x13'),_0x5ef1f8,_0xb2f1('0x11'),JSON[_0xb2f1('0x14')](_0x3b0ec9));if(_0x3b0ec9[_0xb2f1('0x15')]){if(_0x3b0ec9[_0xb2f1('0x15')][_0xb2f1('0x16')]===0x1f4){logger['error'](_0xb2f1('0x10'),_0x5ef1f8,_0x3b0ec9['error'][_0xb2f1('0x17')]);return _0x37e6cb(_0x3b0ec9[_0xb2f1('0x15')][_0xb2f1('0x17')]);}logger[_0xb2f1('0x15')](_0xb2f1('0x10'),_0x5ef1f8,_0x3b0ec9[_0xb2f1('0x15')][_0xb2f1('0x17')]);return _0x12e626(_0x3b0ec9[_0xb2f1('0x15')][_0xb2f1('0x17')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x5ef1f8,_0xb2f1('0x11'));_0x12e626(_0x3b0ec9[_0xb2f1('0x18')][_0xb2f1('0x17')]);}})[_0xb2f1('0x19')](function(_0x569ede){logger[_0xb2f1('0x15')](_0xb2f1('0x10'),_0x5ef1f8,_0x569ede);_0x37e6cb(_0x569ede);});});}exports[_0xb2f1('0x1a')]=function(_0x19304b){var _0x2fe1ab=this;return new Promise(function(_0x292a02,_0x50117b){return db[_0xb2f1('0x1b')][_0xb2f1('0x1c')](_0x19304b[_0xb2f1('0x1d')],{'raw':_0x19304b[_0xb2f1('0x1e')]?_0x19304b[_0xb2f1('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19304b[_0xb2f1('0x1e')]?_0x19304b[_0xb2f1('0x1e')][_0xb2f1('0x1f')]||null:null,'attributes':_0x19304b[_0xb2f1('0x1e')]?_0x19304b[_0xb2f1('0x1e')][_0xb2f1('0x20')]||null:null,'limit':_0x19304b[_0xb2f1('0x1e')]?_0x19304b[_0xb2f1('0x1e')][_0xb2f1('0x21')]||null:null})[_0xb2f1('0x22')](function(_0x23c99b){logger['info'](_0xb2f1('0x1a'),_0x19304b);logger[_0xb2f1('0x12')]('UpdateWhatsappInteraction',_0x19304b,JSON['stringify'](_0x23c99b));_0x292a02(_0x23c99b);})[_0xb2f1('0x19')](function(_0x4fb534){logger[_0xb2f1('0x15')](_0xb2f1('0x1a'),_0x4fb534['message'],_0x19304b);_0x50117b(_0x2fe1ab['error'](0x1f4,_0x4fb534[_0xb2f1('0x17')]));});});};exports[_0xb2f1('0x23')]=function(_0x5b3b15){return new Promise(function(_0x357978,_0x21e01d){return db['WhatsappInteraction'][_0xb2f1('0x24')]({'where':_0x5b3b15[_0xb2f1('0x1e')]?_0x5b3b15[_0xb2f1('0x1e')]['where']||null:null})[_0xb2f1('0x22')](function(_0x2af1e9){if(_0x2af1e9){return _0x2af1e9[_0xb2f1('0x25')](_0x5b3b15[_0xb2f1('0x1d')][_0xb2f1('0x26')],_['omit'](_0x5b3b15[_0xb2f1('0x1d')],[_0xb2f1('0x26'),'id'])||{});}})[_0xb2f1('0x27')](function(_0x5c3769){logger[_0xb2f1('0xf')](_0xb2f1('0x28'),_0x5b3b15);logger[_0xb2f1('0x12')](_0xb2f1('0x28'),_0x5b3b15,JSON[_0xb2f1('0x14')](_0x5c3769));_0x357978(_0x5c3769);})['catch'](function(_0x82a890){logger['error'](_0xb2f1('0x28'),_0x82a890['message'],_0x5b3b15);_0x21e01d(_this[_0xb2f1('0x15')](0x1f4,_0x82a890['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index f61386a..dc7e1a1 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 _0x25eb=['register','length','./whatsappInteraction.events','update','emit','removeListener'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x25eb,0x12e));var _0xb25e=function(_0x15005d,_0x48cc16){_0x15005d=_0x15005d-0x0;var _0x46518c=_0x25eb[_0x15005d];return _0x46518c;};'use strict';var WhatsappInteractionEvents=require(_0xb25e('0x0'));var events=['save','remove',_0xb25e('0x1')];function createListener(_0x236adb,_0x40ce1b){return function(_0x1e1edf){_0x40ce1b[_0xb25e('0x2')](_0x236adb,_0x1e1edf);};}function removeListener(_0x1c657e,_0x42f782){return function(){WhatsappInteractionEvents[_0xb25e('0x3')](_0x1c657e,_0x42f782);};}exports[_0xb25e('0x4')]=function(_0x47c1bd){for(var _0x17544c=0x0,_0x5a562b=events[_0xb25e('0x5')];_0x17544c<_0x5a562b;_0x17544c++){var _0x592919=events[_0x17544c];var _0x1de9e2=createListener('whatsappInteraction:'+_0x592919,_0x47c1bd);WhatsappInteractionEvents['on'](_0x592919,_0x1de9e2);}}; \ No newline at end of file +var _0x95ca=['save','update','emit','removeListener','register','./whatsappInteraction.events'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0x95ca,0x167));var _0xa95c=function(_0x21871b,_0x11bedd){_0x21871b=_0x21871b-0x0;var _0x5c25bc=_0x95ca[_0x21871b];return _0x5c25bc;};'use strict';var WhatsappInteractionEvents=require(_0xa95c('0x0'));var events=[_0xa95c('0x1'),'remove',_0xa95c('0x2')];function createListener(_0x522208,_0x4a7deb){return function(_0x4f0d9f){_0x4a7deb[_0xa95c('0x3')](_0x522208,_0x4f0d9f);};}function removeListener(_0x3b0be7,_0x406879){return function(){WhatsappInteractionEvents[_0xa95c('0x4')](_0x3b0be7,_0x406879);};}exports[_0xa95c('0x5')]=function(_0x2c53ba){for(var _0x4ef2c9=0x0,_0x5b95ac=events['length'];_0x4ef2c9<_0x5b95ac;_0x4ef2c9++){var _0x3bc29c=events[_0x4ef2c9];var _0x5e625b=createListener('whatsappInteraction:'+_0x3bc29c,_0x2c53ba);WhatsappInteractionEvents['on'](_0x3bc29c,_0x5e625b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 60cf556..70e6c6a 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 _0x5d5d=['/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','put','update','accept','/:id/reject','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe'];(function(_0x32fcc7,_0x5a9d57){var _0x13d8c7=function(_0x482c19){while(--_0x482c19){_0x32fcc7['push'](_0x32fcc7['shift']());}};_0x13d8c7(++_0x5a9d57);}(_0x5d5d,0x136));var _0xd5d5=function(_0x2b8d4c,_0x1f1bdc){_0x2b8d4c=_0x2b8d4c-0x0;var _0x400baf=_0x5d5d[_0x2b8d4c];return _0x400baf;};'use strict';var multer=require(_0xd5d5('0x0'));var util=require(_0xd5d5('0x1'));var path=require(_0xd5d5('0x2'));var timeout=require('connect-timeout');var express=require(_0xd5d5('0x3'));var router=express[_0xd5d5('0x4')]();var fs_extra=require(_0xd5d5('0x5'));var auth=require(_0xd5d5('0x6'));var interaction=require(_0xd5d5('0x7'));var config=require(_0xd5d5('0x8'));var controller=require(_0xd5d5('0x9'));router[_0xd5d5('0xa')]('/',auth[_0xd5d5('0xb')](),controller['index']);router[_0xd5d5('0xa')](_0xd5d5('0xc'),auth[_0xd5d5('0xb')](),controller[_0xd5d5('0xd')]);router[_0xd5d5('0xa')](_0xd5d5('0xe'),auth[_0xd5d5('0xb')](),controller[_0xd5d5('0xf')]);router[_0xd5d5('0x10')]('/',auth[_0xd5d5('0xb')](),interaction[_0xd5d5('0x11')](_0xd5d5('0x12'),_0xd5d5('0x13')),controller['create']);router[_0xd5d5('0x10')](_0xd5d5('0x14'),controller['status']);router[_0xd5d5('0x15')]('/:id',auth[_0xd5d5('0xb')](),controller[_0xd5d5('0x16')]);router[_0xd5d5('0x15')]('/:id/accept',auth[_0xd5d5('0xb')](),controller[_0xd5d5('0x17')]);router[_0xd5d5('0x15')](_0xd5d5('0x18'),auth['isAuthenticated'](),controller['reject']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd5d5('0x19')]);module[_0xd5d5('0x1a')]=router; \ No newline at end of file +var _0xf019=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','isAuthenticated','index','get','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf019,0x134));var _0x9f01=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf019[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x9f01('0x0'));var util=require(_0x9f01('0x1'));var path=require(_0x9f01('0x2'));var timeout=require(_0x9f01('0x3'));var express=require('express');var router=express[_0x9f01('0x4')]();var fs_extra=require(_0x9f01('0x5'));var auth=require(_0x9f01('0x6'));var interaction=require(_0x9f01('0x7'));var config=require('../../config/environment');var controller=require(_0x9f01('0x8'));router['get']('/',auth[_0x9f01('0x9')](),controller[_0x9f01('0xa')]);router[_0x9f01('0xb')](_0x9f01('0xc'),auth[_0x9f01('0x9')](),controller['describe']);router['get'](_0x9f01('0xd'),auth[_0x9f01('0x9')](),controller[_0x9f01('0xe')]);router[_0x9f01('0xf')]('/',auth[_0x9f01('0x9')](),interaction[_0x9f01('0x10')](_0x9f01('0x11'),_0x9f01('0x12')),controller['create']);router[_0x9f01('0xf')](_0x9f01('0x13'),controller['status']);router[_0x9f01('0x14')]('/:id',auth[_0x9f01('0x9')](),controller[_0x9f01('0x15')]);router[_0x9f01('0x14')](_0x9f01('0x16'),auth['isAuthenticated'](),controller[_0x9f01('0x17')]);router[_0x9f01('0x14')](_0x9f01('0x18'),auth[_0x9f01('0x9')](),controller[_0x9f01('0x19')]);router[_0x9f01('0x1a')](_0x9f01('0xd'),auth[_0x9f01('0x9')](),controller[_0x9f01('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 53737b3..f8963ff 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 _0x4318=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x4318,0x1a7));var _0x8431=function(_0x3fef53,_0x104fa4){_0x3fef53=_0x3fef53-0x0;var _0x35a15d=_0x4318[_0x3fef53];return _0x35a15d;};'use strict';var Sequelize=require(_0x8431('0x0'));module[_0x8431('0x1')]={'body':{'type':Sequelize[_0x8431('0x2')](_0x8431('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8431('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8431('0x5')]('in','out'),'defaultValue':_0x8431('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8431('0x7')](0xbe)},'phone':{'type':Sequelize[_0x8431('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x8431('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8431('0x7')]},'providerResponse':{'type':Sequelize[_0x8431('0x2')]}}; \ No newline at end of file +var _0x7af0=['ENUM','out','STRING','DATE','TEXT','sequelize','exports'];(function(_0x555d47,_0x438d03){var _0xbb6d5e=function(_0x57aa16){while(--_0x57aa16){_0x555d47['push'](_0x555d47['shift']());}};_0xbb6d5e(++_0x438d03);}(_0x7af0,0x139));var _0x07af=function(_0x574ce3,_0x59eef4){_0x574ce3=_0x574ce3-0x0;var _0x3447a0=_0x7af0[_0x574ce3];return _0x3447a0;};'use strict';var Sequelize=require(_0x07af('0x0'));module[_0x07af('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x07af('0x2')]('in',_0x07af('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x07af('0x4')](0xbe)},'phone':{'type':Sequelize[_0x07af('0x4')]},'readAt':{'type':Sequelize[_0x07af('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x07af('0x4')]},'providerResponse':{'type':Sequelize[_0x07af('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index f0557dd..418e325 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 _0x0bb0=['role','interaction','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','email','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','apply','reject','save','destroy','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','keys','length','find','body','update','params','describe','whatsapp-interactions','accept','read','format','UserId','user','agent','WhatsappInteractionId','isNil','read1stAt','get'];(function(_0x3c54c7,_0x1e8c5d){var _0x4c4a3e=function(_0x2fe5b3){while(--_0x2fe5b3){_0x3c54c7['push'](_0x3c54c7['shift']());}};_0x4c4a3e(++_0x1e8c5d);}(_0x0bb0,0x1a8));var _0x00bb=function(_0x51ffd6,_0x344e5c){_0x51ffd6=_0x51ffd6-0x0;var _0x2552ba=_0x0bb0[_0x51ffd6];return _0x2552ba;};'use strict';var emlformat=require(_0x00bb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x00bb('0x1'));var rp=require(_0x00bb('0x2'));var moment=require(_0x00bb('0x3'));var BPromise=require(_0x00bb('0x4'));var Mustache=require('mustache');var util=require(_0x00bb('0x5'));var path=require(_0x00bb('0x6'));var sox=require(_0x00bb('0x7'));var csv=require(_0x00bb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x00bb('0x9'));var crypto=require(_0x00bb('0xa'));var jsforce=require(_0x00bb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x00bb('0x8'));var querystring=require('querystring');var Papa=require(_0x00bb('0xc'));var Redis=require('ioredis');var authService=require(_0x00bb('0xd'));var qs=require(_0x00bb('0xe'));var as=require(_0x00bb('0xf'));var hardwareService=require(_0x00bb('0x10'));var logger=require(_0x00bb('0x11'))(_0x00bb('0x12'));var utils=require(_0x00bb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x00bb('0x14'));var db=require(_0x00bb('0x15'))['db'];config[_0x00bb('0x16')]=_['defaults'](config[_0x00bb('0x16')],{'host':_0x00bb('0x17'),'port':0x18eb});var socket=require(_0x00bb('0x18'))(new Redis(config[_0x00bb('0x16')]));require(_0x00bb('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x00bb('0x1a')][_0x00bb('0x1b')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39ecee,_0x428eae,_0x4f0656,_0x58b4a2){return new BPromise(function(_0x2b32ed,_0x482c53){var _0xf32b61=_0x58b4a2||client;return _0xf32b61['request'](_0x39ecee,_0x4f0656)[_0x00bb('0x1c')](function(_0x95e9db){logger[_0x00bb('0x1d')](_0x00bb('0x1e'),_0x428eae,_0x00bb('0x1f'));logger[_0x00bb('0x20')](_0x00bb('0x21'),_0x428eae,_0x00bb('0x1f'),JSON['stringify'](_0x95e9db));if(_0x95e9db[_0x00bb('0x22')]){if(_0x95e9db[_0x00bb('0x22')][_0x00bb('0x23')]===0x1f4){logger[_0x00bb('0x22')](_0x00bb('0x1e'),_0x428eae,_0x95e9db[_0x00bb('0x22')][_0x00bb('0x24')]);return _0x482c53(_0x95e9db[_0x00bb('0x22')][_0x00bb('0x24')]);}logger[_0x00bb('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x428eae,_0x95e9db[_0x00bb('0x22')]['message']);return _0x2b32ed(_0x95e9db[_0x00bb('0x22')][_0x00bb('0x24')]);}else{logger['info'](_0x00bb('0x1e'),_0x428eae,_0x00bb('0x1f'));_0x2b32ed(_0x95e9db['result']['message']);}})[_0x00bb('0x25')](function(_0xb0792b){logger[_0x00bb('0x22')](_0x00bb('0x1e'),_0x428eae,_0xb0792b);_0x482c53(_0xb0792b);});});}function respondWithStatusCode(_0x5b18a3,_0x386372){_0x386372=_0x386372||0xcc;return function(_0x4dc701){if(_0x4dc701){return _0x5b18a3[_0x00bb('0x26')](_0x386372);}return _0x5b18a3[_0x00bb('0x27')](_0x386372)[_0x00bb('0x28')]();};}function respondWithResult(_0x35ed62,_0x30dbd6){_0x30dbd6=_0x30dbd6||0xc8;return function(_0x410f4c){if(_0x410f4c){return _0x35ed62['status'](_0x30dbd6)[_0x00bb('0x29')](_0x410f4c);}};}function respondWithFilteredResult(_0x10a80c,_0x5504db){return function(_0x2cb01b){if(_0x2cb01b){var _0x404795=typeof _0x5504db['offset']===_0x00bb('0x2a')&&typeof _0x5504db[_0x00bb('0x2b')]===_0x00bb('0x2a');var _0x3cc3b8=_0x2cb01b['count'];var _0x465927=_0x404795?0x0:_0x5504db[_0x00bb('0x2c')];var _0x5aabdd=_0x404795?_0x2cb01b[_0x00bb('0x2d')]:_0x5504db[_0x00bb('0x2c')]+_0x5504db[_0x00bb('0x2b')];var _0x565daa;if(_0x5aabdd>=_0x3cc3b8){_0x5aabdd=_0x3cc3b8;_0x565daa=0xc8;}else{_0x565daa=0xce;}_0x10a80c[_0x00bb('0x27')](_0x565daa);return _0x10a80c['set']('Content-Range',_0x465927+'-'+_0x5aabdd+'/'+_0x3cc3b8)[_0x00bb('0x29')](_0x2cb01b);}return null;};}function patchUpdates(_0x5ce106){return function(_0x538395){try{jsonpatch[_0x00bb('0x2e')](_0x538395,_0x5ce106,!![]);}catch(_0x340755){return BPromise[_0x00bb('0x2f')](_0x340755);}return _0x538395[_0x00bb('0x30')]();};}function saveUpdates(_0x348bb1,_0x300ced){return function(_0xc35892){if(_0xc35892){return _0xc35892['update'](_0x348bb1)[_0x00bb('0x1c')](function(_0x22cb00){return _0x22cb00;});}return null;};}function removeEntity(_0x333c25,_0x428117){return function(_0x4d290e){if(_0x4d290e){return _0x4d290e[_0x00bb('0x31')]()['then'](function(){_0x333c25[_0x00bb('0x27')](0xcc)[_0x00bb('0x28')]();});}};}function handleEntityNotFound(_0xea0914,_0x556398){return function(_0x3c56a3){if(!_0x3c56a3){_0xea0914[_0x00bb('0x26')](0x194);}return _0x3c56a3;};}function handleError(_0x3a2e8d,_0x28eebd){_0x28eebd=_0x28eebd||0x1f4;return function(_0x5adae7){logger[_0x00bb('0x22')](_0x5adae7['stack']);if(_0x5adae7[_0x00bb('0x32')]){delete _0x5adae7[_0x00bb('0x32')];}_0x3a2e8d[_0x00bb('0x27')](_0x28eebd)[_0x00bb('0x33')](_0x5adae7);};}exports[_0x00bb('0x34')]=function(_0x5586e2,_0x43dbdc){var _0x4eeffd={},_0x4c8cec={},_0x1f3ded={'count':0x0,'rows':[]};var _0x12667d=_[_0x00bb('0x35')](db[_0x00bb('0x36')][_0x00bb('0x37')],function(_0x5c760d){return{'name':_0x5c760d[_0x00bb('0x38')],'type':_0x5c760d[_0x00bb('0x39')][_0x00bb('0x3a')]};});_0x4c8cec[_0x00bb('0x3b')]=_['map'](_0x12667d,_0x00bb('0x32'));_0x4c8cec[_0x00bb('0x3c')]=_['keys'](_0x5586e2['query']);_0x4c8cec['filters']=_[_0x00bb('0x3d')](_0x4c8cec[_0x00bb('0x3b')],_0x4c8cec['query']);_0x4eeffd['attributes']=_[_0x00bb('0x3d')](_0x4c8cec[_0x00bb('0x3b')],qs[_0x00bb('0x3e')](_0x5586e2[_0x00bb('0x3c')]['fields']));_0x4eeffd[_0x00bb('0x3f')]=_0x4eeffd[_0x00bb('0x3f')]['length']?_0x4eeffd['attributes']:_0x4c8cec[_0x00bb('0x3b')];if(!_0x5586e2['query'][_0x00bb('0x40')](_0x00bb('0x41'))){_0x4eeffd[_0x00bb('0x2b')]=qs[_0x00bb('0x2b')](_0x5586e2[_0x00bb('0x3c')][_0x00bb('0x2b')]);_0x4eeffd['offset']=qs[_0x00bb('0x2c')](_0x5586e2['query'][_0x00bb('0x2c')]);}_0x4eeffd[_0x00bb('0x42')]=qs[_0x00bb('0x43')](_0x5586e2[_0x00bb('0x3c')][_0x00bb('0x43')]);_0x4eeffd['where']=qs[_0x00bb('0x44')](_[_0x00bb('0x45')](_0x5586e2[_0x00bb('0x3c')],_0x4c8cec[_0x00bb('0x44')]),_0x12667d);if(_0x5586e2[_0x00bb('0x3c')][_0x00bb('0x46')]){_0x4eeffd[_0x00bb('0x47')]=_['merge'](_0x4eeffd[_0x00bb('0x47')],{'$or':_[_0x00bb('0x35')](_0x12667d,function(_0x2af7c2){if(_0x2af7c2[_0x00bb('0x39')]!==_0x00bb('0x48')){var _0x38be59={};_0x38be59[_0x2af7c2[_0x00bb('0x32')]]={'$like':'%'+_0x5586e2[_0x00bb('0x3c')]['filter']+'%'};return _0x38be59;}})});}_0x4eeffd=_[_0x00bb('0x49')]({},_0x4eeffd,_0x5586e2[_0x00bb('0x4a')]);var _0x5c4308={'where':_0x4eeffd[_0x00bb('0x47')]};return db[_0x00bb('0x36')][_0x00bb('0x2d')](_0x5c4308)[_0x00bb('0x1c')](function(_0x3af385){_0x1f3ded[_0x00bb('0x2d')]=_0x3af385;if(_0x5586e2[_0x00bb('0x3c')][_0x00bb('0x4b')]){_0x4eeffd[_0x00bb('0x4c')]=[{'all':!![]}];}return db[_0x00bb('0x36')][_0x00bb('0x4d')](_0x4eeffd);})['then'](function(_0xcb01ce){_0x1f3ded['rows']=_0xcb01ce;return _0x1f3ded;})[_0x00bb('0x1c')](respondWithFilteredResult(_0x43dbdc,_0x4eeffd))[_0x00bb('0x25')](handleError(_0x43dbdc,null));};exports['show']=function(_0x50c6d9,_0x46e71a){var _0x434951={'raw':!![],'where':{'id':_0x50c6d9['params']['id']}},_0x53c79c={};_0x53c79c[_0x00bb('0x3b')]=_[_0x00bb('0x4e')](db[_0x00bb('0x36')]['rawAttributes']);_0x53c79c[_0x00bb('0x3c')]=_[_0x00bb('0x4e')](_0x50c6d9[_0x00bb('0x3c')]);_0x53c79c[_0x00bb('0x44')]=_[_0x00bb('0x3d')](_0x53c79c[_0x00bb('0x3b')],_0x53c79c[_0x00bb('0x3c')]);_0x434951['attributes']=_[_0x00bb('0x3d')](_0x53c79c[_0x00bb('0x3b')],qs[_0x00bb('0x3e')](_0x50c6d9[_0x00bb('0x3c')][_0x00bb('0x3e')]));_0x434951['attributes']=_0x434951[_0x00bb('0x3f')][_0x00bb('0x4f')]?_0x434951[_0x00bb('0x3f')]:_0x53c79c[_0x00bb('0x3b')];if(_0x50c6d9[_0x00bb('0x3c')][_0x00bb('0x4b')]){_0x434951[_0x00bb('0x4c')]=[{'all':!![]}];}_0x434951=_[_0x00bb('0x49')]({},_0x434951,_0x50c6d9[_0x00bb('0x4a')]);return db[_0x00bb('0x36')][_0x00bb('0x50')](_0x434951)[_0x00bb('0x1c')](handleEntityNotFound(_0x46e71a,null))[_0x00bb('0x1c')](respondWithResult(_0x46e71a,null))['catch'](handleError(_0x46e71a,null));};exports['create']=function(_0x239ac1,_0x44fe00){return db[_0x00bb('0x36')]['create'](_0x239ac1[_0x00bb('0x51')],{})[_0x00bb('0x1c')](respondWithResult(_0x44fe00,0xc9))[_0x00bb('0x25')](handleError(_0x44fe00,null));};exports[_0x00bb('0x52')]=function(_0x126f8d,_0xdab65f){if(_0x126f8d[_0x00bb('0x51')]['id']){delete _0x126f8d['body']['id'];}return db[_0x00bb('0x36')][_0x00bb('0x50')]({'where':{'id':_0x126f8d[_0x00bb('0x53')]['id']}})[_0x00bb('0x1c')](handleEntityNotFound(_0xdab65f,null))[_0x00bb('0x1c')](saveUpdates(_0x126f8d[_0x00bb('0x51')],null))[_0x00bb('0x1c')](respondWithResult(_0xdab65f,null))['catch'](handleError(_0xdab65f,null));};exports[_0x00bb('0x31')]=function(_0x1b0bcd,_0x3978c0){return db[_0x00bb('0x36')]['find']({'where':{'id':_0x1b0bcd[_0x00bb('0x53')]['id']}})['then'](handleEntityNotFound(_0x3978c0,null))[_0x00bb('0x1c')](removeEntity(_0x3978c0,null))[_0x00bb('0x25')](handleError(_0x3978c0,null));};exports[_0x00bb('0x54')]=function(_0x5032dd,_0x3c1d02){return db[_0x00bb('0x36')][_0x00bb('0x54')]()['then'](respondWithResult(_0x3c1d02,null))[_0x00bb('0x25')](handleError(_0x3c1d02,null));};var interaction_log=require(_0x00bb('0x11'))(_0x00bb('0x55'));exports[_0x00bb('0x56')]=function(_0x4918b5,_0x3254d4,_0x2b51cc){var _0x116c2a={'agent':{},'channel':'whatsapp'};if(_0x4918b5[_0x00bb('0x51')]['id']){delete _0x4918b5['body']['id'];}_0x4918b5[_0x00bb('0x51')][_0x00bb('0x57')]=!![];_0x4918b5[_0x00bb('0x51')]['readAt']=moment()[_0x00bb('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x4918b5[_0x00bb('0x51')][_0x00bb('0x59')]=_0x4918b5[_0x00bb('0x51')][_0x00bb('0x59')]||_0x4918b5[_0x00bb('0x5a')]['id'];_0x116c2a[_0x00bb('0x5b')]['id']=_0x4918b5['body'][_0x00bb('0x59')];return db['WhatsappMessage'][_0x00bb('0x50')]({'where':{'id':_0x4918b5[_0x00bb('0x53')]['id'],'UserId':null}})[_0x00bb('0x1c')](handleEntityNotFound(_0x3254d4,null))[_0x00bb('0x1c')](saveUpdates(_0x4918b5['body'],null))[_0x00bb('0x1c')](function(_0x267dd0){if(_0x267dd0){_0x116c2a[_0x00bb('0x24')]=_0x267dd0['get']({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x267dd0[_0x00bb('0x5c')]}});}return null;})[_0x00bb('0x1c')](handleEntityNotFound(_0x3254d4,null))[_0x00bb('0x1c')](function(_0x298e55){if(_0x298e55){return _0x298e55[_0x00bb('0x52')]({'UserId':_0x4918b5[_0x00bb('0x51')][_0x00bb('0x59')],'read1stAt':_[_0x00bb('0x5d')](_0x298e55[_0x00bb('0x5e')])?moment()[_0x00bb('0x58')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0xf9b80){if(_0xf9b80){_0x116c2a['interaction']=_0xf9b80[_0x00bb('0x5f')]({'plain':!![]});interaction_log[_0x00bb('0x1d')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4918b5[_0x00bb('0x5a')]['id'],_0x4918b5[_0x00bb('0x5a')][_0x00bb('0x32')],_0x4918b5[_0x00bb('0x5a')][_0x00bb('0x60')],_0x116c2a[_0x00bb('0x61')]['id'],_0x4918b5['body']?JSON[_0x00bb('0x62')](_0x4918b5[_0x00bb('0x51')]):'null');return respondWithRpcPromise('AcceptMessage',_0x00bb('0x63'),_0x116c2a);}return null;})[_0x00bb('0x1c')](function(_0x37bc28){var _0xfbc947=_0x00bb('0x64')+_0x37bc28[_0x00bb('0x24')][_0x00bb('0x65')];return db[_0x00bb('0x66')]['query'](_0xfbc947,{'type':db[_0x00bb('0x67')][_0x00bb('0x68')]['SELECT'],'raw':!![]})['then'](function(_0x3b955e){return _0x3b955e;});})[_0x00bb('0x1c')](function(_0x24a6d5){if(_0x24a6d5){_0x116c2a['message'][_0x00bb('0x69')]=_0x24a6d5[0x0];if(!_0x4918b5['body'][_0x00bb('0x59')])return;return db[_0x00bb('0x6a')]['find']({'where':{'id':_0x4918b5[_0x00bb('0x51')]['UserId'],'role':_0x00bb('0x5b')},'attributes':['id','name','fullname','email',_0x00bb('0x6b')],'raw':!![]});}return null;})[_0x00bb('0x1c')](function(_0x4f3859){if(!_0x4f3859)return null;_0x116c2a[_0x00bb('0x24')]['agent']=_0x4f3859;return _0x116c2a;})['then'](function(_0x16c7a3){if(_0x16c7a3){if(_0x4918b5[_0x00bb('0x51')][_0x00bb('0x6c')]){_0x116c2a[_0x00bb('0x24')][_0x00bb('0x6d')]=util['format'](_0x00bb('0x6e'),_0x4918b5[_0x00bb('0x5a')][_0x00bb('0x32')]);_0x116c2a[_0x00bb('0x24')][_0x00bb('0x6f')]=_0x116c2a[_0x00bb('0x6f')];_0x116c2a['message'][_0x00bb('0x70')]=_0x116c2a['channel'];_0x116c2a['message'][_0x00bb('0x71')]=_0x00bb('0x56');return respondWithRpcPromise(_0x00bb('0x72'),'EventManager',{'event':_0x00bb('0x73'),'message':_0x116c2a[_0x00bb('0x24')]},client9002)[_0x00bb('0x1c')](function(){return _0x116c2a;});}return _0x116c2a;}return null;})[_0x00bb('0x1c')](respondWithResult(_0x3254d4,null))[_0x00bb('0x25')](handleError(_0x3254d4,null));};var interaction_log=require(_0x00bb('0x11'))(_0x00bb('0x55'));exports[_0x00bb('0x2f')]=function(_0x30ce99,_0x46a695,_0x52a0dc){var _0x18386d={'agent':{},'channel':'whatsapp'};if(_0x30ce99['body']['id']){delete _0x30ce99['body']['id'];}_0x30ce99[_0x00bb('0x51')]['UserId']=_0x30ce99[_0x00bb('0x51')][_0x00bb('0x59')]||_0x30ce99[_0x00bb('0x5a')]['id'];_0x18386d[_0x00bb('0x5b')]['id']=_0x30ce99['body'][_0x00bb('0x59')];return db[_0x00bb('0x36')][_0x00bb('0x50')]({'where':{'id':_0x30ce99[_0x00bb('0x53')]['id'],'UserId':null}})[_0x00bb('0x1c')](handleEntityNotFound(_0x46a695,null))[_0x00bb('0x1c')](function(_0x1204b9){if(_0x1204b9){_0x18386d[_0x00bb('0x24')]=_0x1204b9[_0x00bb('0x5f')]({'plain':!![]});return db[_0x00bb('0x74')][_0x00bb('0x50')]({'where':{'id':_0x1204b9[_0x00bb('0x5c')]}});}return null;})[_0x00bb('0x1c')](handleEntityNotFound(_0x46a695,null))[_0x00bb('0x1c')](function(_0x187b5b){if(_0x187b5b){_0x18386d[_0x00bb('0x61')]=_0x187b5b['get']({'plain':!![]});interaction_log[_0x00bb('0x1d')](_0x00bb('0x75'),_0x30ce99[_0x00bb('0x5a')]['id'],_0x30ce99['user'][_0x00bb('0x32')],_0x30ce99[_0x00bb('0x5a')][_0x00bb('0x60')],_0x18386d[_0x00bb('0x61')]['id'],_0x30ce99['body']?JSON[_0x00bb('0x62')](_0x30ce99['body']):'null');return respondWithRpcPromise('RejectMessage',_0x00bb('0x76'),_0x18386d);}return null;})[_0x00bb('0x1c')](function(_0x1cf0df){var _0x33de99=_0x00bb('0x64')+_0x1cf0df[_0x00bb('0x24')][_0x00bb('0x65')];return db[_0x00bb('0x66')][_0x00bb('0x3c')](_0x33de99,{'type':db[_0x00bb('0x67')]['QueryTypes']['SELECT'],'raw':!![]})[_0x00bb('0x1c')](function(_0x4ff07b){return _0x4ff07b;});})['then'](function(_0x367aa3){if(_0x367aa3){_0x18386d[_0x00bb('0x24')][_0x00bb('0x69')]=_0x367aa3[0x0];if(!_0x30ce99[_0x00bb('0x51')][_0x00bb('0x59')])return;return db[_0x00bb('0x6a')][_0x00bb('0x50')]({'where':{'id':_0x30ce99[_0x00bb('0x51')][_0x00bb('0x59')],'role':_0x00bb('0x5b')},'attributes':['id',_0x00bb('0x32'),'fullname',_0x00bb('0x77'),'internal'],'raw':!![]});}return null;})[_0x00bb('0x1c')](function(_0x2f1688){if(!_0x2f1688)return null;_0x18386d[_0x00bb('0x24')][_0x00bb('0x5b')]=_0x2f1688;return _0x18386d;})[_0x00bb('0x1c')](function(_0x59cd12){if(_0x59cd12){_0x59cd12['message'][_0x00bb('0x6d')]=util[_0x00bb('0x58')](_0x00bb('0x6e'),_0x30ce99['user'][_0x00bb('0x32')]);_0x59cd12[_0x00bb('0x24')]['channel']=_0x18386d[_0x00bb('0x6f')];_0x59cd12['message'][_0x00bb('0x70')]=_0x18386d[_0x00bb('0x6f')];_0x59cd12[_0x00bb('0x24')][_0x00bb('0x71')]=_0x00bb('0x2f');respondWithRpcPromise(_0x00bb('0x72'),_0x00bb('0x72'),{'event':_0x00bb('0x78'),'message':_0x59cd12[_0x00bb('0x24')]},client9002);return _0x18386d;}return null;})[_0x00bb('0x1c')](respondWithResult(_0x46a695,null))[_0x00bb('0x25')](handleError(_0x46a695,null));};exports[_0x00bb('0x27')]=function(_0x219281,_0x33cd18,_0x121e7c){if(_0x219281[_0x00bb('0x51')]['id']){delete _0x219281[_0x00bb('0x51')]['id'];}var _0x291eeb;return db['WhatsappMessage'][_0x00bb('0x50')]({'where':{'id':_0x219281[_0x00bb('0x53')]['id']}})[_0x00bb('0x1c')](handleEntityNotFound(_0x33cd18,null))[_0x00bb('0x1c')](function(_0x743d61){if(_0x743d61){_0x291eeb=_0x743d61;return db[_0x00bb('0x79')]['find']({'where':{'id':_0x743d61[_0x00bb('0x7a')]}});}})[_0x00bb('0x1c')](handleEntityNotFound(_0x33cd18,null))[_0x00bb('0x1c')](function(_0x576d4a){if(_0x576d4a){logger[_0x00bb('0x20')](_0x00bb('0x7b'),_0x00bb('0x27'),_0x00bb('0x7c'),_0x576d4a['type'],util[_0x00bb('0x7d')](_0x219281[_0x00bb('0x51')],{'showHidden':![],'depth':null}));switch(_0x576d4a[_0x00bb('0x39')]){case _0x00bb('0x7e'):if(_0x219281['body']['MessageSid']&&_0x219281[_0x00bb('0x51')]['MessageSid']===_0x291eeb[_0x00bb('0x7f')]&&_0x219281[_0x00bb('0x51')][_0x00bb('0x80')]&&_0x219281[_0x00bb('0x51')][_0x00bb('0x80')]===_0x00bb('0x57')){return _0x291eeb[_0x00bb('0x52')]({'read':!![]});}else{logger[_0x00bb('0x22')](_0x00bb('0x81'),'status','twilio',util[_0x00bb('0x7d')](_0x219281[_0x00bb('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x291eeb;}})[_0x00bb('0x1c')](respondWithResult(_0x33cd18,null))[_0x00bb('0x25')](handleError(_0x33cd18,null));}; \ No newline at end of file +var _0xe44f=['ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','WhatsappInteraction','WhatsappInteractionId','stringify','null','RejectMessage','rejectMessage','QueryTypes','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','WhatsappMessage','count','includeAll','include','rows','show','fields','length','find','create','body','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','isNil','interaction','get','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'];(function(_0x51b362,_0x2a3af3){var _0x18bd6=function(_0xd5fcdb){while(--_0xd5fcdb){_0x51b362['push'](_0x51b362['shift']());}};_0x18bd6(++_0x2a3af3);}(_0xe44f,0xb5));var _0xfe44=function(_0x4e8d79,_0x4c3320){_0x4e8d79=_0x4e8d79-0x0;var _0x24f539=_0xe44f[_0x4e8d79];return _0x24f539;};'use strict';var emlformat=require(_0xfe44('0x0'));var rimraf=require(_0xfe44('0x1'));var zipdir=require(_0xfe44('0x2'));var jsonpatch=require(_0xfe44('0x3'));var rp=require(_0xfe44('0x4'));var moment=require('moment');var BPromise=require(_0xfe44('0x5'));var Mustache=require(_0xfe44('0x6'));var util=require('util');var path=require(_0xfe44('0x7'));var sox=require('sox');var csv=require(_0xfe44('0x8'));var ejs=require(_0xfe44('0x9'));var fs=require('fs');var fs_extra=require(_0xfe44('0xa'));var _=require(_0xfe44('0xb'));var squel=require('squel');var crypto=require(_0xfe44('0xc'));var jsforce=require(_0xfe44('0xd'));var deskjs=require(_0xfe44('0xe'));var toCsv=require(_0xfe44('0x8'));var querystring=require('querystring');var Papa=require(_0xfe44('0xf'));var Redis=require(_0xfe44('0x10'));var authService=require(_0xfe44('0x11'));var qs=require(_0xfe44('0x12'));var as=require(_0xfe44('0x13'));var hardwareService=require(_0xfe44('0x14'));var logger=require(_0xfe44('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xfe44('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe44('0x17'))['db'];config[_0xfe44('0x18')]=_[_0xfe44('0x19')](config[_0xfe44('0x18')],{'host':_0xfe44('0x1a'),'port':0x18eb});var socket=require(_0xfe44('0x1b'))(new Redis(config[_0xfe44('0x18')]));require(_0xfe44('0x1c'))[_0xfe44('0x1d')](socket);var jayson=require(_0xfe44('0x1e'));var client=jayson[_0xfe44('0x1f')][_0xfe44('0x20')]({'port':0x232c});var client9002=jayson[_0xfe44('0x1f')][_0xfe44('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1eeacf,_0x49ba25,_0x3dd183,_0x49478e){return new BPromise(function(_0x3045d7,_0x16716d){var _0x5d07ea=_0x49478e||client;return _0x5d07ea['request'](_0x1eeacf,_0x3dd183)[_0xfe44('0x21')](function(_0x18ffba){logger['info'](_0xfe44('0x22'),_0x49ba25,'request\x20sent');logger[_0xfe44('0x23')](_0xfe44('0x24'),_0x49ba25,_0xfe44('0x25'),JSON['stringify'](_0x18ffba));if(_0x18ffba[_0xfe44('0x26')]){if(_0x18ffba[_0xfe44('0x26')][_0xfe44('0x27')]===0x1f4){logger[_0xfe44('0x26')](_0xfe44('0x22'),_0x49ba25,_0x18ffba[_0xfe44('0x26')][_0xfe44('0x28')]);return _0x16716d(_0x18ffba[_0xfe44('0x26')][_0xfe44('0x28')]);}logger[_0xfe44('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x49ba25,_0x18ffba[_0xfe44('0x26')]['message']);return _0x3045d7(_0x18ffba[_0xfe44('0x26')][_0xfe44('0x28')]);}else{logger[_0xfe44('0x29')](_0xfe44('0x22'),_0x49ba25,'request\x20sent');_0x3045d7(_0x18ffba[_0xfe44('0x2a')][_0xfe44('0x28')]);}})[_0xfe44('0x2b')](function(_0x4ed418){logger[_0xfe44('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x49ba25,_0x4ed418);_0x16716d(_0x4ed418);});});}function respondWithStatusCode(_0x5d8c51,_0x53a909){_0x53a909=_0x53a909||0xcc;return function(_0x36ed7e){if(_0x36ed7e){return _0x5d8c51[_0xfe44('0x2c')](_0x53a909);}return _0x5d8c51[_0xfe44('0x2d')](_0x53a909)[_0xfe44('0x2e')]();};}function respondWithResult(_0x3e84e6,_0x34495b){_0x34495b=_0x34495b||0xc8;return function(_0x4f951b){if(_0x4f951b){return _0x3e84e6['status'](_0x34495b)[_0xfe44('0x2f')](_0x4f951b);}};}function respondWithFilteredResult(_0x313b7f,_0x1605fa){return function(_0x48eca0){if(_0x48eca0){var _0x3b9989=typeof _0x1605fa[_0xfe44('0x30')]===_0xfe44('0x31')&&typeof _0x1605fa['limit']==='undefined';var _0x44f237=_0x48eca0['count'];var _0x3c65e2=_0x3b9989?0x0:_0x1605fa[_0xfe44('0x30')];var _0x25cd80=_0x3b9989?_0x48eca0['count']:_0x1605fa[_0xfe44('0x30')]+_0x1605fa[_0xfe44('0x32')];var _0x54f529;if(_0x25cd80>=_0x44f237){_0x25cd80=_0x44f237;_0x54f529=0xc8;}else{_0x54f529=0xce;}_0x313b7f[_0xfe44('0x2d')](_0x54f529);return _0x313b7f[_0xfe44('0x33')](_0xfe44('0x34'),_0x3c65e2+'-'+_0x25cd80+'/'+_0x44f237)[_0xfe44('0x2f')](_0x48eca0);}return null;};}function patchUpdates(_0x2cb125){return function(_0x2a4241){try{jsonpatch[_0xfe44('0x35')](_0x2a4241,_0x2cb125,!![]);}catch(_0x8567f5){return BPromise[_0xfe44('0x36')](_0x8567f5);}return _0x2a4241[_0xfe44('0x37')]();};}function saveUpdates(_0x353914,_0xd557f4){return function(_0x10bc4b){if(_0x10bc4b){return _0x10bc4b[_0xfe44('0x38')](_0x353914)['then'](function(_0x46e6ab){return _0x46e6ab;});}return null;};}function removeEntity(_0x25fa91,_0x1fc7c3){return function(_0x28892f){if(_0x28892f){return _0x28892f[_0xfe44('0x39')]()[_0xfe44('0x21')](function(){_0x25fa91[_0xfe44('0x2d')](0xcc)[_0xfe44('0x2e')]();});}};}function handleEntityNotFound(_0x52c7f6,_0x18597c){return function(_0x3630d9){if(!_0x3630d9){_0x52c7f6[_0xfe44('0x2c')](0x194);}return _0x3630d9;};}function handleError(_0x270848,_0x38c4a9){_0x38c4a9=_0x38c4a9||0x1f4;return function(_0x138342){logger['error'](_0x138342[_0xfe44('0x3a')]);if(_0x138342[_0xfe44('0x3b')]){delete _0x138342[_0xfe44('0x3b')];}_0x270848[_0xfe44('0x2d')](_0x38c4a9)[_0xfe44('0x3c')](_0x138342);};}exports[_0xfe44('0x3d')]=function(_0x1a7eb6,_0x27d9a6){var _0x981fdc={},_0x421483={},_0x5a61f6={'count':0x0,'rows':[]};var _0x159057=_[_0xfe44('0x3e')](db['WhatsappMessage'][_0xfe44('0x3f')],function(_0xdd4b6){return{'name':_0xdd4b6['fieldName'],'type':_0xdd4b6[_0xfe44('0x40')][_0xfe44('0x41')]};});_0x421483[_0xfe44('0x42')]=_[_0xfe44('0x3e')](_0x159057,'name');_0x421483[_0xfe44('0x43')]=_[_0xfe44('0x44')](_0x1a7eb6['query']);_0x421483['filters']=_[_0xfe44('0x45')](_0x421483[_0xfe44('0x42')],_0x421483['query']);_0x981fdc['attributes']=_[_0xfe44('0x45')](_0x421483['model'],qs['fields'](_0x1a7eb6[_0xfe44('0x43')]['fields']));_0x981fdc['attributes']=_0x981fdc[_0xfe44('0x46')]['length']?_0x981fdc['attributes']:_0x421483[_0xfe44('0x42')];if(!_0x1a7eb6[_0xfe44('0x43')][_0xfe44('0x47')](_0xfe44('0x48'))){_0x981fdc['limit']=qs[_0xfe44('0x32')](_0x1a7eb6['query'][_0xfe44('0x32')]);_0x981fdc[_0xfe44('0x30')]=qs[_0xfe44('0x30')](_0x1a7eb6[_0xfe44('0x43')][_0xfe44('0x30')]);}_0x981fdc[_0xfe44('0x49')]=qs[_0xfe44('0x4a')](_0x1a7eb6[_0xfe44('0x43')]['sort']);_0x981fdc[_0xfe44('0x4b')]=qs['filters'](_[_0xfe44('0x4c')](_0x1a7eb6['query'],_0x421483[_0xfe44('0x4d')]),_0x159057);if(_0x1a7eb6[_0xfe44('0x43')][_0xfe44('0x4e')]){_0x981fdc[_0xfe44('0x4b')]=_[_0xfe44('0x4f')](_0x981fdc[_0xfe44('0x4b')],{'$or':_[_0xfe44('0x3e')](_0x159057,function(_0x5e234f){if(_0x5e234f[_0xfe44('0x40')]!==_0xfe44('0x50')){var _0x5de3a9={};_0x5de3a9[_0x5e234f[_0xfe44('0x3b')]]={'$like':'%'+_0x1a7eb6['query'][_0xfe44('0x4e')]+'%'};return _0x5de3a9;}})});}_0x981fdc=_[_0xfe44('0x4f')]({},_0x981fdc,_0x1a7eb6[_0xfe44('0x51')]);var _0x671779={'where':_0x981fdc['where']};return db[_0xfe44('0x52')][_0xfe44('0x53')](_0x671779)['then'](function(_0x497f71){_0x5a61f6[_0xfe44('0x53')]=_0x497f71;if(_0x1a7eb6['query'][_0xfe44('0x54')]){_0x981fdc[_0xfe44('0x55')]=[{'all':!![]}];}return db[_0xfe44('0x52')]['findAll'](_0x981fdc);})['then'](function(_0x1994d4){_0x5a61f6[_0xfe44('0x56')]=_0x1994d4;return _0x5a61f6;})['then'](respondWithFilteredResult(_0x27d9a6,_0x981fdc))['catch'](handleError(_0x27d9a6,null));};exports[_0xfe44('0x57')]=function(_0x3ce220,_0x1924ab){var _0x2e86df={'raw':!![],'where':{'id':_0x3ce220['params']['id']}},_0x308631={};_0x308631[_0xfe44('0x42')]=_[_0xfe44('0x44')](db[_0xfe44('0x52')][_0xfe44('0x3f')]);_0x308631[_0xfe44('0x43')]=_['keys'](_0x3ce220['query']);_0x308631[_0xfe44('0x4d')]=_['intersection'](_0x308631['model'],_0x308631[_0xfe44('0x43')]);_0x2e86df['attributes']=_[_0xfe44('0x45')](_0x308631[_0xfe44('0x42')],qs[_0xfe44('0x58')](_0x3ce220[_0xfe44('0x43')][_0xfe44('0x58')]));_0x2e86df[_0xfe44('0x46')]=_0x2e86df[_0xfe44('0x46')][_0xfe44('0x59')]?_0x2e86df[_0xfe44('0x46')]:_0x308631[_0xfe44('0x42')];if(_0x3ce220[_0xfe44('0x43')][_0xfe44('0x54')]){_0x2e86df[_0xfe44('0x55')]=[{'all':!![]}];}_0x2e86df=_['merge']({},_0x2e86df,_0x3ce220[_0xfe44('0x51')]);return db[_0xfe44('0x52')][_0xfe44('0x5a')](_0x2e86df)[_0xfe44('0x21')](handleEntityNotFound(_0x1924ab,null))[_0xfe44('0x21')](respondWithResult(_0x1924ab,null))[_0xfe44('0x2b')](handleError(_0x1924ab,null));};exports[_0xfe44('0x5b')]=function(_0x433f92,_0x426725){return db[_0xfe44('0x52')][_0xfe44('0x5b')](_0x433f92[_0xfe44('0x5c')],{})[_0xfe44('0x21')](respondWithResult(_0x426725,0xc9))[_0xfe44('0x2b')](handleError(_0x426725,null));};exports[_0xfe44('0x38')]=function(_0x30a226,_0x952c4){if(_0x30a226[_0xfe44('0x5c')]['id']){delete _0x30a226[_0xfe44('0x5c')]['id'];}return db[_0xfe44('0x52')]['find']({'where':{'id':_0x30a226['params']['id']}})[_0xfe44('0x21')](handleEntityNotFound(_0x952c4,null))[_0xfe44('0x21')](saveUpdates(_0x30a226[_0xfe44('0x5c')],null))[_0xfe44('0x21')](respondWithResult(_0x952c4,null))[_0xfe44('0x2b')](handleError(_0x952c4,null));};exports[_0xfe44('0x39')]=function(_0x2a20f0,_0x4954bd){return db[_0xfe44('0x52')][_0xfe44('0x5a')]({'where':{'id':_0x2a20f0[_0xfe44('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4954bd,null))[_0xfe44('0x21')](removeEntity(_0x4954bd,null))[_0xfe44('0x2b')](handleError(_0x4954bd,null));};exports[_0xfe44('0x5e')]=function(_0x2bc04b,_0x4e89d7){return db['WhatsappMessage'][_0xfe44('0x5e')]()[_0xfe44('0x21')](respondWithResult(_0x4e89d7,null))[_0xfe44('0x2b')](handleError(_0x4e89d7,null));};var interaction_log=require(_0xfe44('0x15'))(_0xfe44('0x5f'));exports[_0xfe44('0x60')]=function(_0x2fa4cf,_0x282875,_0x370f23){var _0x538c23={'agent':{},'channel':_0xfe44('0x61')};if(_0x2fa4cf[_0xfe44('0x5c')]['id']){delete _0x2fa4cf[_0xfe44('0x5c')]['id'];}_0x2fa4cf['body'][_0xfe44('0x62')]=!![];_0x2fa4cf[_0xfe44('0x5c')][_0xfe44('0x63')]=moment()[_0xfe44('0x64')](_0xfe44('0x65'));_0x2fa4cf['body'][_0xfe44('0x66')]=_0x2fa4cf[_0xfe44('0x5c')]['UserId']||_0x2fa4cf[_0xfe44('0x67')]['id'];_0x538c23['agent']['id']=_0x2fa4cf[_0xfe44('0x5c')][_0xfe44('0x66')];return db[_0xfe44('0x52')][_0xfe44('0x5a')]({'where':{'id':_0x2fa4cf[_0xfe44('0x5d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x282875,null))[_0xfe44('0x21')](saveUpdates(_0x2fa4cf['body'],null))[_0xfe44('0x21')](function(_0x38ee43){if(_0x38ee43){_0x538c23[_0xfe44('0x28')]=_0x38ee43['get']({'plain':!![]});return db['WhatsappInteraction'][_0xfe44('0x5a')]({'where':{'id':_0x38ee43['WhatsappInteractionId']}});}return null;})[_0xfe44('0x21')](handleEntityNotFound(_0x282875,null))['then'](function(_0x4d548a){if(_0x4d548a){return _0x4d548a['update']({'UserId':_0x2fa4cf[_0xfe44('0x5c')][_0xfe44('0x66')],'read1stAt':_[_0xfe44('0x68')](_0x4d548a['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0xa611ab){if(_0xa611ab){_0x538c23[_0xfe44('0x69')]=_0xa611ab[_0xfe44('0x6a')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2fa4cf['user']['id'],_0x2fa4cf[_0xfe44('0x67')][_0xfe44('0x3b')],_0x2fa4cf['user'][_0xfe44('0x6b')],_0x538c23[_0xfe44('0x69')]['id'],_0x2fa4cf['body']?JSON['stringify'](_0x2fa4cf[_0xfe44('0x5c')]):'null');return respondWithRpcPromise(_0xfe44('0x6c'),_0xfe44('0x6d'),_0x538c23);}return null;})[_0xfe44('0x21')](function(_0x2b2a99){var _0xe04d56=_0xfe44('0x6e')+_0x2b2a99[_0xfe44('0x28')][_0xfe44('0x6f')];return db[_0xfe44('0x70')][_0xfe44('0x43')](_0xe04d56,{'type':db[_0xfe44('0x71')]['QueryTypes'][_0xfe44('0x72')],'raw':!![]})[_0xfe44('0x21')](function(_0x4a1253){return _0x4a1253;});})[_0xfe44('0x21')](function(_0xe55546){if(_0xe55546){_0x538c23[_0xfe44('0x28')][_0xfe44('0x73')]=_0xe55546[0x0];if(!_0x2fa4cf['body'][_0xfe44('0x66')])return;return db[_0xfe44('0x74')][_0xfe44('0x5a')]({'where':{'id':_0x2fa4cf['body'][_0xfe44('0x66')],'role':_0xfe44('0x75')},'attributes':['id',_0xfe44('0x3b'),_0xfe44('0x76'),_0xfe44('0x77'),_0xfe44('0x78')],'raw':!![]});}return null;})[_0xfe44('0x21')](function(_0x489865){if(!_0x489865)return null;_0x538c23[_0xfe44('0x28')][_0xfe44('0x75')]=_0x489865;return _0x538c23;})['then'](function(_0x4ce1a0){if(_0x4ce1a0){if(_0x2fa4cf[_0xfe44('0x5c')][_0xfe44('0x79')]){_0x538c23[_0xfe44('0x28')][_0xfe44('0x7a')]=util[_0xfe44('0x64')](_0xfe44('0x7b'),_0x2fa4cf[_0xfe44('0x67')]['name']);_0x538c23['message'][_0xfe44('0x7c')]=_0x538c23['channel'];_0x538c23['message'][_0xfe44('0x7d')]=_0x538c23['channel'];_0x538c23[_0xfe44('0x28')][_0xfe44('0x7e')]=_0xfe44('0x60');return respondWithRpcPromise('EventManager',_0xfe44('0x7f'),{'event':'acceptmessage','message':_0x538c23['message']},client9002)[_0xfe44('0x21')](function(){return _0x538c23;});}return _0x538c23;}return null;})[_0xfe44('0x21')](respondWithResult(_0x282875,null))[_0xfe44('0x2b')](handleError(_0x282875,null));};var interaction_log=require(_0xfe44('0x15'))('whatsapp-interactions');exports[_0xfe44('0x36')]=function(_0xa4d137,_0x4e57f9,_0x512427){var _0x43aac1={'agent':{},'channel':_0xfe44('0x61')};if(_0xa4d137[_0xfe44('0x5c')]['id']){delete _0xa4d137[_0xfe44('0x5c')]['id'];}_0xa4d137['body'][_0xfe44('0x66')]=_0xa4d137[_0xfe44('0x5c')][_0xfe44('0x66')]||_0xa4d137[_0xfe44('0x67')]['id'];_0x43aac1['agent']['id']=_0xa4d137[_0xfe44('0x5c')][_0xfe44('0x66')];return db[_0xfe44('0x52')][_0xfe44('0x5a')]({'where':{'id':_0xa4d137[_0xfe44('0x5d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4e57f9,null))[_0xfe44('0x21')](function(_0x57a902){if(_0x57a902){_0x43aac1[_0xfe44('0x28')]=_0x57a902[_0xfe44('0x6a')]({'plain':!![]});return db[_0xfe44('0x80')][_0xfe44('0x5a')]({'where':{'id':_0x57a902[_0xfe44('0x81')]}});}return null;})['then'](handleEntityNotFound(_0x4e57f9,null))['then'](function(_0x27feb3){if(_0x27feb3){_0x43aac1[_0xfe44('0x69')]=_0x27feb3[_0xfe44('0x6a')]({'plain':!![]});interaction_log[_0xfe44('0x29')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa4d137[_0xfe44('0x67')]['id'],_0xa4d137[_0xfe44('0x67')][_0xfe44('0x3b')],_0xa4d137[_0xfe44('0x67')][_0xfe44('0x6b')],_0x43aac1[_0xfe44('0x69')]['id'],_0xa4d137['body']?JSON[_0xfe44('0x82')](_0xa4d137[_0xfe44('0x5c')]):_0xfe44('0x83'));return respondWithRpcPromise(_0xfe44('0x84'),_0xfe44('0x85'),_0x43aac1);}return null;})[_0xfe44('0x21')](function(_0x3922e7){var _0xd77ea2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3922e7[_0xfe44('0x28')][_0xfe44('0x6f')];return db[_0xfe44('0x70')][_0xfe44('0x43')](_0xd77ea2,{'type':db[_0xfe44('0x71')][_0xfe44('0x86')][_0xfe44('0x72')],'raw':!![]})[_0xfe44('0x21')](function(_0x1ae22a){return _0x1ae22a;});})[_0xfe44('0x21')](function(_0x221e43){if(_0x221e43){_0x43aac1[_0xfe44('0x28')][_0xfe44('0x73')]=_0x221e43[0x0];if(!_0xa4d137[_0xfe44('0x5c')][_0xfe44('0x66')])return;return db[_0xfe44('0x74')][_0xfe44('0x5a')]({'where':{'id':_0xa4d137[_0xfe44('0x5c')][_0xfe44('0x66')],'role':'agent'},'attributes':['id',_0xfe44('0x3b'),_0xfe44('0x76'),_0xfe44('0x77'),'internal'],'raw':!![]});}return null;})[_0xfe44('0x21')](function(_0x107301){if(!_0x107301)return null;_0x43aac1[_0xfe44('0x28')][_0xfe44('0x75')]=_0x107301;return _0x43aac1;})[_0xfe44('0x21')](function(_0x5a981e){if(_0x5a981e){_0x5a981e[_0xfe44('0x28')]['interface']=util[_0xfe44('0x64')](_0xfe44('0x7b'),_0xa4d137[_0xfe44('0x67')][_0xfe44('0x3b')]);_0x5a981e[_0xfe44('0x28')][_0xfe44('0x7c')]=_0x43aac1[_0xfe44('0x7c')];_0x5a981e[_0xfe44('0x28')][_0xfe44('0x7d')]=_0x43aac1[_0xfe44('0x7c')];_0x5a981e[_0xfe44('0x28')][_0xfe44('0x7e')]=_0xfe44('0x36');respondWithRpcPromise(_0xfe44('0x7f'),_0xfe44('0x7f'),{'event':_0xfe44('0x87'),'message':_0x5a981e['message']},client9002);return _0x43aac1;}return null;})[_0xfe44('0x21')](respondWithResult(_0x4e57f9,null))[_0xfe44('0x2b')](handleError(_0x4e57f9,null));};exports[_0xfe44('0x2d')]=function(_0x2c2fb0,_0x5ea0b9,_0x29ffb6){if(_0x2c2fb0[_0xfe44('0x5c')]['id']){delete _0x2c2fb0[_0xfe44('0x5c')]['id'];}var _0x1b2d0c;return db[_0xfe44('0x52')][_0xfe44('0x5a')]({'where':{'id':_0x2c2fb0[_0xfe44('0x5d')]['id']}})[_0xfe44('0x21')](handleEntityNotFound(_0x5ea0b9,null))[_0xfe44('0x21')](function(_0x2e267c){if(_0x2e267c){_0x1b2d0c=_0x2e267c;return db[_0xfe44('0x88')]['find']({'where':{'id':_0x2e267c[_0xfe44('0x89')]}});}})[_0xfe44('0x21')](handleEntityNotFound(_0x5ea0b9,null))['then'](function(_0x335979){if(_0x335979){logger[_0xfe44('0x23')](_0xfe44('0x8a'),_0xfe44('0x2d'),_0xfe44('0x8b'),_0x335979[_0xfe44('0x40')],util[_0xfe44('0x8c')](_0x2c2fb0[_0xfe44('0x5c')],{'showHidden':![],'depth':null}));switch(_0x335979['type']){case _0xfe44('0x8d'):if(_0x2c2fb0['body'][_0xfe44('0x8e')]&&_0x2c2fb0[_0xfe44('0x5c')]['MessageSid']===_0x1b2d0c[_0xfe44('0x8f')]&&_0x2c2fb0[_0xfe44('0x5c')][_0xfe44('0x90')]&&_0x2c2fb0[_0xfe44('0x5c')][_0xfe44('0x90')]===_0xfe44('0x62')){return _0x1b2d0c[_0xfe44('0x38')]({'read':!![]});}else{logger[_0xfe44('0x26')](_0xfe44('0x91'),_0xfe44('0x2d'),'twilio',util[_0xfe44('0x8c')](_0x2c2fb0['body'],{'showHidden':![],'depth':null}));}break;}return _0x1b2d0c;}})['then'](respondWithResult(_0x5ea0b9,null))[_0xfe44('0x2b')](handleError(_0x5ea0b9,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 8747b21..a874992 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 _0x84a0=['hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x19612b,_0x422d5a){var _0x1d7347=function(_0x115830){while(--_0x115830){_0x19612b['push'](_0x19612b['shift']());}};_0x1d7347(++_0x422d5a);}(_0x84a0,0x66));var _0x084a=function(_0x43160b,_0x4e067c){_0x43160b=_0x43160b-0x0;var _0x3b09c0=_0x84a0[_0x43160b];return _0x3b09c0;};'use strict';var EventEmitter=require(_0x084a('0x0'));var WhatsappMessage=require(_0x084a('0x1'))['db'][_0x084a('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x084a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x084a('0x4'),'afterDestroy':_0x084a('0x5')};function emitEvent(_0x4b7672){return function(_0x58a814,_0x52d04c,_0x1c0292){WhatsappMessageEvents['emit'](_0x4b7672+':'+_0x58a814['id'],_0x58a814);WhatsappMessageEvents[_0x084a('0x6')](_0x4b7672,_0x58a814);_0x1c0292(null);};}for(var e in events){if(events[_0x084a('0x7')](e)){var event=events[e];WhatsappMessage[_0x084a('0x8')](e,emitEvent(event));}}module[_0x084a('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0xefda=['save','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x2b505f,_0x40f4de){var _0x8b90f9=function(_0x16c0ea){while(--_0x16c0ea){_0x2b505f['push'](_0x2b505f['shift']());}};_0x8b90f9(++_0x40f4de);}(_0xefda,0x96));var _0xaefd=function(_0x570305,_0x38ee56){_0x570305=_0x570305-0x0;var _0x1d3026=_0xefda[_0x570305];return _0x1d3026;};'use strict';var EventEmitter=require(_0xaefd('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xaefd('0x1')](0x0);var events={'afterCreate':_0xaefd('0x2'),'afterUpdate':'update','afterDestroy':_0xaefd('0x3')};function emitEvent(_0x1c65db){return function(_0x2ade44,_0x22df24,_0x1ef6b4){WhatsappMessageEvents[_0xaefd('0x4')](_0x1c65db+':'+_0x2ade44['id'],_0x2ade44);WhatsappMessageEvents['emit'](_0x1c65db,_0x2ade44);_0x1ef6b4(null);};}for(var e in events){if(events[_0xaefd('0x5')](e)){var event=events[e];WhatsappMessage[_0xaefd('0x6')](e,emitEvent(event));}}module[_0xaefd('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 8757a15..2285af9 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 _0xe3e0=['application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','util','../../config/logger','api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','WhatsappInteraction','findOne','update','createdAt','catch','error','secret','WhatsappAccount','find','then','type','twilio','authToken','accountSid','messages','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','body'];(function(_0x4ded08,_0x16dd5a){var _0x5030da=function(_0x4eb249){while(--_0x4eb249){_0x4ded08['push'](_0x4ded08['shift']());}};_0x5030da(++_0x16dd5a);}(_0xe3e0,0x188));var _0x0e3e=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0xe3e0[_0x178856];return _0x3c7fe7;};'use strict';var _=require('lodash');var util=require(_0x0e3e('0x0'));var logger=require(_0x0e3e('0x1'))(_0x0e3e('0x2'));var moment=require(_0x0e3e('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e3e('0x4'));var fetch=require(_0x0e3e('0x5'));var fs=require('fs');var path=require(_0x0e3e('0x6'));var rimraf=require(_0x0e3e('0x7'));var config=require(_0x0e3e('0x8'));var attributes=require(_0x0e3e('0x9'));module['exports']=function(_0xd13c74,_0x3814c0){return _0xd13c74['define']('WhatsappMessage',attributes,{'tableName':_0x0e3e('0xa'),'paranoid':![],'indexes':[{'name':_0x0e3e('0xb'),'fields':['messageId']},{'name':_0x0e3e('0xc'),'fields':['body'],'type':_0x0e3e('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ba1bb,_0x51efc8,_0x2cbd47){var _0x1bc3f2=_0xd13c74[_0x0e3e('0xe')];var _0x57f961=_0x3ba1bb[_0x0e3e('0xf')]({'plain':!![]});if(_0x57f961[_0x0e3e('0x10')][_0x0e3e('0x11')]()==='in'||_0x57f961[_0x0e3e('0x10')]['toLowerCase']()===_0x0e3e('0x12')&&!_0x57f961['secret']&&!_['isNil'](_0x57f961['UserId'])){_0x1bc3f2[_0x0e3e('0x13')][_0x0e3e('0x14')]({'where':{'id':_0x57f961['WhatsappInteractionId']}})['then'](function(_0x559f0f){if(_0x559f0f){_0x559f0f[_0x0e3e('0x15')]({'lastMsgAt':_0x57f961[_0x0e3e('0x16')],'lastMsgDirection':_0x57f961[_0x0e3e('0x10')]['toLowerCase']()});}})[_0x0e3e('0x17')](function(_0x2373c3){console[_0x0e3e('0x18')](_0x2373c3);});}if(_0x57f961[_0x0e3e('0x10')]===_0x0e3e('0x12')&&!_0x57f961[_0x0e3e('0x19')]){var _0x173b8c;_0x1bc3f2[_0x0e3e('0x1a')][_0x0e3e('0x1b')]({'where':{'id':_0x57f961['WhatsappAccountId']},'raw':!![]})[_0x0e3e('0x1c')](function(_0x2d9e1f){_0x173b8c=_0x2d9e1f;if(_0x173b8c&&_0x173b8c[_0x0e3e('0x1d')]){switch(_0x173b8c['type']){case _0x0e3e('0x1e'):var _0x38fc50=require(_0x0e3e('0x1e'));if(_0x173b8c['accountSid']&&_0x173b8c[_0x0e3e('0x1f')]&&_0x173b8c['phone']){var _0x507ab8=new _0x38fc50(_0x173b8c[_0x0e3e('0x20')],_0x173b8c[_0x0e3e('0x1f')]);_0x507ab8[_0x0e3e('0x21')]['create']({'body':_0x57f961['body'],'to':_0x0e3e('0x22')+_0x57f961['phone'],'from':_0x0e3e('0x22')+_0x173b8c[_0x0e3e('0x23')],'statusCallback':_0x173b8c[_0x0e3e('0x24')]+_0x0e3e('0x25')+_0x57f961['id']+_0x0e3e('0x26')+_0x173b8c['token']})[_0x0e3e('0x1c')](function(_0x58da3b){if(_0x58da3b[_0x0e3e('0x27')]){return _0x3ba1bb['update']({'messageId':_0x58da3b[_0x0e3e('0x27')]});}})['catch'](function(_0x1c5a4f){logger[_0x0e3e('0x18')](_0x0e3e('0x28'),_0x0e3e('0x29'),_0x0e3e('0x1e'),util['inspect'](_0x1c5a4f,{'showHidden':![],'depth':null}));});}else{logger[_0x0e3e('0x18')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0e3e('0x1e'),_0x0e3e('0x2a'));}break;case'sinch':var _0x2865b0=_0x173b8c[_0x0e3e('0x20')];var _0x1d1ae9=_0x173b8c['authToken'];var _0x2fc935=_0x173b8c[_0x0e3e('0x2b')]+_0x0e3e('0x2c')+_0x2865b0+_0x0e3e('0x2d');var _0x2f5051={'to':[_0x57f961[_0x0e3e('0x23')]],'message':{'type':_0x0e3e('0x2e'),'text':_0x57f961[_0x0e3e('0x2f')]}};var _0x406aa3={'method':'POST','uri':_0x2fc935,'headers':{'Authorization':'Bearer\x20'+_0x1d1ae9,'Content-Type':_0x0e3e('0x30')},'body':_0x2f5051,'json':!![]};rp(_0x406aa3)[_0x0e3e('0x1c')](function(_0x2cb2ed){if(_0x2cb2ed[_0x0e3e('0x31')][0x0][_0x0e3e('0x32')]){return _0x3ba1bb['update']({'messageId':_0x2cb2ed[_0x0e3e('0x31')][0x0][_0x0e3e('0x32')]});}})['catch'](function(_0x167f5c){logger[_0x0e3e('0x33')](_0x0e3e('0x34'),_0x167f5c);});break;}}})[_0x0e3e('0x35')](function(){_0x2cbd47();});}else{_0x2cbd47();}}},'charset':_0x0e3e('0x36'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x906c=['then','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','/messages/','text','POST','Bearer\x20','application/json','statuses','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','whatsapp_messages','messageId','models','get','toLowerCase','direction','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','find'];(function(_0x4f9bcb,_0x433d80){var _0x2c2dc1=function(_0x37727f){while(--_0x37727f){_0x4f9bcb['push'](_0x4f9bcb['shift']());}};_0x2c2dc1(++_0x433d80);}(_0x906c,0x17d));var _0xc906=function(_0x1fb6cd,_0x5b87e2){_0x1fb6cd=_0x1fb6cd-0x0;var _0x17e145=_0x906c[_0x1fb6cd];return _0x17e145;};'use strict';var _=require(_0xc906('0x0'));var util=require(_0xc906('0x1'));var logger=require(_0xc906('0x2'))(_0xc906('0x3'));var moment=require(_0xc906('0x4'));var BPromise=require(_0xc906('0x5'));var rp=require(_0xc906('0x6'));var fetch=require(_0xc906('0x7'));var fs=require('fs');var path=require(_0xc906('0x8'));var rimraf=require(_0xc906('0x9'));var config=require(_0xc906('0xa'));var attributes=require(_0xc906('0xb'));module[_0xc906('0xc')]=function(_0x2c4fe7,_0x3b9c12){return _0x2c4fe7['define']('WhatsappMessage',attributes,{'tableName':_0xc906('0xd'),'paranoid':![],'indexes':[{'name':_0xc906('0xe'),'fields':[_0xc906('0xe')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b6e4d,_0x3516bc,_0x45f71d){var _0x42fbba=_0x2c4fe7[_0xc906('0xf')];var _0x1cead9=_0x4b6e4d[_0xc906('0x10')]({'plain':!![]});if(_0x1cead9['direction'][_0xc906('0x11')]()==='in'||_0x1cead9[_0xc906('0x12')][_0xc906('0x11')]()===_0xc906('0x13')&&!_0x1cead9[_0xc906('0x14')]&&!_[_0xc906('0x15')](_0x1cead9[_0xc906('0x16')])){_0x42fbba[_0xc906('0x17')][_0xc906('0x18')]({'where':{'id':_0x1cead9[_0xc906('0x19')]}})['then'](function(_0x465f9e){if(_0x465f9e){_0x465f9e[_0xc906('0x1a')]({'lastMsgAt':_0x1cead9[_0xc906('0x1b')],'lastMsgDirection':_0x1cead9[_0xc906('0x12')][_0xc906('0x11')]()});}})[_0xc906('0x1c')](function(_0x3753ea){console[_0xc906('0x1d')](_0x3753ea);});}if(_0x1cead9[_0xc906('0x12')]===_0xc906('0x13')&&!_0x1cead9[_0xc906('0x14')]){var _0x17623d;_0x42fbba[_0xc906('0x1e')][_0xc906('0x1f')]({'where':{'id':_0x1cead9['WhatsappAccountId']},'raw':!![]})[_0xc906('0x20')](function(_0x2f380c){_0x17623d=_0x2f380c;if(_0x17623d&&_0x17623d[_0xc906('0x21')]){switch(_0x17623d[_0xc906('0x21')]){case'twilio':var _0x4b55e2=require(_0xc906('0x22'));if(_0x17623d[_0xc906('0x23')]&&_0x17623d[_0xc906('0x24')]&&_0x17623d[_0xc906('0x25')]){var _0x2c6695=new _0x4b55e2(_0x17623d[_0xc906('0x23')],_0x17623d['authToken']);_0x2c6695[_0xc906('0x26')][_0xc906('0x27')]({'body':_0x1cead9[_0xc906('0x28')],'to':_0xc906('0x29')+_0x1cead9[_0xc906('0x25')],'from':_0xc906('0x29')+_0x17623d[_0xc906('0x25')],'statusCallback':_0x17623d[_0xc906('0x2a')]+_0xc906('0x2b')+_0x1cead9['id']+'/status?token='+_0x17623d[_0xc906('0x2c')]})[_0xc906('0x20')](function(_0x4fe062){if(_0x4fe062[_0xc906('0x2d')]){return _0x4b6e4d[_0xc906('0x1a')]({'messageId':_0x4fe062[_0xc906('0x2d')]});}})['catch'](function(_0x30716e){logger[_0xc906('0x1d')](_0xc906('0x2e'),_0xc906('0x2f'),_0xc906('0x22'),util[_0xc906('0x30')](_0x30716e,{'showHidden':![],'depth':null}));});}else{logger[_0xc906('0x1d')](_0xc906('0x2e'),_0xc906('0x2f'),_0xc906('0x22'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xc906('0x31'):var _0x54c7de=_0x17623d[_0xc906('0x23')];var _0x1a7ac3=_0x17623d[_0xc906('0x24')];var _0x19b16e=_0x17623d['baseUrl']+'/whatsapp/v1/'+_0x54c7de+_0xc906('0x32');var _0x4e7484={'to':[_0x1cead9[_0xc906('0x25')]],'message':{'type':_0xc906('0x33'),'text':_0x1cead9[_0xc906('0x28')]}};var _0x359869={'method':_0xc906('0x34'),'uri':_0x19b16e,'headers':{'Authorization':_0xc906('0x35')+_0x1a7ac3,'Content-Type':_0xc906('0x36')},'body':_0x4e7484,'json':!![]};rp(_0x359869)[_0xc906('0x20')](function(_0x4b0119){if(_0x4b0119[_0xc906('0x37')][0x0]['message_id']){return _0x4b6e4d[_0xc906('0x1a')]({'messageId':_0x4b0119['statuses'][0x0]['message_id']});}})[_0xc906('0x1c')](function(_0x2c3385){logger['err'](_0xc906('0x38'),_0x2c3385);});break;}}})['finally'](function(){_0x45f71d();});}else{_0x45f71d();}}},'charset':_0xc906('0x39'),'collate':_0xc906('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 524822e..fd582fa 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 _0xc32d=['WhatsappMessage','create','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateWhatsappMessage'];(function(_0x150961,_0x211501){var _0x5e210c=function(_0x186414){while(--_0x186414){_0x150961['push'](_0x150961['shift']());}};_0x5e210c(++_0x211501);}(_0xc32d,0xd2));var _0xdc32=function(_0x2f8903,_0x381f57){_0x2f8903=_0x2f8903-0x0;var _0x94f2fd=_0xc32d[_0x2f8903];return _0x94f2fd;};'use strict';var _=require('lodash');var util=require(_0xdc32('0x0'));var moment=require(_0xdc32('0x1'));var BPromise=require(_0xdc32('0x2'));var rs=require(_0xdc32('0x3'));var fs=require('fs');var Redis=require(_0xdc32('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc32('0x5'));var logger=require(_0xdc32('0x6'))(_0xdc32('0x7'));var config=require(_0xdc32('0x8'));var jayson=require(_0xdc32('0x9'));var client=jayson[_0xdc32('0xa')][_0xdc32('0xb')]({'port':0x232a});config[_0xdc32('0xc')]=_[_0xdc32('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdc32('0xe'))(new Redis(config[_0xdc32('0xc')]));require(_0xdc32('0xf'))['register'](socket);function respondWithRpcPromise(_0x41e816,_0x4c38af,_0x1f1e69){return new BPromise(function(_0x28f6c8,_0x5a9c96){return client[_0xdc32('0x10')](_0x41e816,_0x1f1e69)[_0xdc32('0x11')](function(_0x1d97cc){logger[_0xdc32('0x12')](_0xdc32('0x13'),_0x4c38af,'request\x20sent');logger[_0xdc32('0x14')](_0xdc32('0x15'),_0x4c38af,_0xdc32('0x16'),JSON[_0xdc32('0x17')](_0x1d97cc));if(_0x1d97cc[_0xdc32('0x18')]){if(_0x1d97cc[_0xdc32('0x18')]['code']===0x1f4){logger['error'](_0xdc32('0x13'),_0x4c38af,_0x1d97cc[_0xdc32('0x18')]['message']);return _0x5a9c96(_0x1d97cc[_0xdc32('0x18')]['message']);}logger[_0xdc32('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x4c38af,_0x1d97cc[_0xdc32('0x18')]['message']);return _0x28f6c8(_0x1d97cc[_0xdc32('0x18')][_0xdc32('0x19')]);}else{logger[_0xdc32('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x4c38af,_0xdc32('0x16'));_0x28f6c8(_0x1d97cc[_0xdc32('0x1a')]['message']);}})['catch'](function(_0x444e23){logger[_0xdc32('0x18')](_0xdc32('0x13'),_0x4c38af,_0x444e23);_0x5a9c96(_0x444e23);});});}exports[_0xdc32('0x1b')]=function(_0x523b50){var _0x1d17ec=this;return new Promise(function(_0x4d00dd,_0x1511c4){return db[_0xdc32('0x1c')][_0xdc32('0x1d')](_0x523b50[_0xdc32('0x1e')],{'raw':_0x523b50[_0xdc32('0x1f')]?_0x523b50[_0xdc32('0x1f')][_0xdc32('0x20')]===undefined?!![]:![]:!![]})[_0xdc32('0x11')](function(_0x111374){logger['info'](_0xdc32('0x1b'),_0x523b50);logger[_0xdc32('0x14')](_0xdc32('0x1b'),_0x523b50,JSON[_0xdc32('0x17')](_0x111374));_0x4d00dd(_0x111374);})[_0xdc32('0x21')](function(_0x28a2a5){logger[_0xdc32('0x18')](_0xdc32('0x1b'),_0x28a2a5['message'],_0x523b50);_0x1511c4(_0x1d17ec[_0xdc32('0x18')](0x1f4,_0x28a2a5['message']));});});}; \ No newline at end of file +var _0x457c=['result','CreateWhatsappMessage','WhatsappMessage','create','body','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x479106,_0x3fdd66){var _0x40f74e=function(_0x2dd6a1){while(--_0x2dd6a1){_0x479106['push'](_0x479106['shift']());}};_0x40f74e(++_0x3fdd66);}(_0x457c,0x9c));var _0xc457=function(_0x1d8b8c,_0x288da6){_0x1d8b8c=_0x1d8b8c-0x0;var _0x4d9a72=_0x457c[_0x1d8b8c];return _0x4d9a72;};'use strict';var _=require(_0xc457('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc457('0x1'));var rs=require(_0xc457('0x2'));var fs=require('fs');var Redis=require(_0xc457('0x3'));var db=require(_0xc457('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc457('0x5'));var jayson=require(_0xc457('0x6'));var client=jayson[_0xc457('0x7')][_0xc457('0x8')]({'port':0x232a});config[_0xc457('0x9')]=_['defaults'](config[_0xc457('0x9')],{'host':_0xc457('0xa'),'port':0x18eb});var socket=require(_0xc457('0xb'))(new Redis(config[_0xc457('0x9')]));require(_0xc457('0xc'))[_0xc457('0xd')](socket);function respondWithRpcPromise(_0xd2f66a,_0x4e6002,_0x26b732){return new BPromise(function(_0x3a70cf,_0x2dd871){return client[_0xc457('0xe')](_0xd2f66a,_0x26b732)[_0xc457('0xf')](function(_0x2e9aa7){logger[_0xc457('0x10')](_0xc457('0x11'),_0x4e6002,_0xc457('0x12'));logger[_0xc457('0x13')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4e6002,_0xc457('0x12'),JSON[_0xc457('0x14')](_0x2e9aa7));if(_0x2e9aa7[_0xc457('0x15')]){if(_0x2e9aa7[_0xc457('0x15')][_0xc457('0x16')]===0x1f4){logger['error'](_0xc457('0x11'),_0x4e6002,_0x2e9aa7[_0xc457('0x15')][_0xc457('0x17')]);return _0x2dd871(_0x2e9aa7[_0xc457('0x15')][_0xc457('0x17')]);}logger[_0xc457('0x15')](_0xc457('0x11'),_0x4e6002,_0x2e9aa7[_0xc457('0x15')][_0xc457('0x17')]);return _0x3a70cf(_0x2e9aa7[_0xc457('0x15')][_0xc457('0x17')]);}else{logger['info'](_0xc457('0x11'),_0x4e6002,_0xc457('0x12'));_0x3a70cf(_0x2e9aa7[_0xc457('0x18')][_0xc457('0x17')]);}})['catch'](function(_0x567d9c){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4e6002,_0x567d9c);_0x2dd871(_0x567d9c);});});}exports[_0xc457('0x19')]=function(_0x25dede){var _0x3262ad=this;return new Promise(function(_0x21275a,_0x51db73){return db[_0xc457('0x1a')][_0xc457('0x1b')](_0x25dede[_0xc457('0x1c')],{'raw':_0x25dede['options']?_0x25dede['options'][_0xc457('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x10e81f){logger[_0xc457('0x10')](_0xc457('0x19'),_0x25dede);logger[_0xc457('0x13')]('CreateWhatsappMessage',_0x25dede,JSON['stringify'](_0x10e81f));_0x21275a(_0x10e81f);})['catch'](function(_0x2ecf06){logger[_0xc457('0x15')]('CreateWhatsappMessage',_0x2ecf06['message'],_0x25dede);_0x51db73(_0x3262ad[_0xc457('0x15')](0x1f4,_0x2ecf06[_0xc457('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 6fd55e2..8a4adf6 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 _0x69ff=['whatsappMessage:','./whatsappMessage.events','save','remove','emit','removeListener','register','length'];(function(_0x501ca1,_0x6c6edc){var _0x2a99c4=function(_0x542cad){while(--_0x542cad){_0x501ca1['push'](_0x501ca1['shift']());}};_0x2a99c4(++_0x6c6edc);}(_0x69ff,0xd9));var _0xf69f=function(_0x4463bc,_0x50a55c){_0x4463bc=_0x4463bc-0x0;var _0x637213=_0x69ff[_0x4463bc];return _0x637213;};'use strict';var WhatsappMessageEvents=require(_0xf69f('0x0'));var events=[_0xf69f('0x1'),_0xf69f('0x2'),'update'];function createListener(_0x2748ca,_0x1720da){return function(_0x42f5db){_0x1720da[_0xf69f('0x3')](_0x2748ca,_0x42f5db);};}function removeListener(_0x1b5309,_0x4ec495){return function(){WhatsappMessageEvents[_0xf69f('0x4')](_0x1b5309,_0x4ec495);};}exports[_0xf69f('0x5')]=function(_0x2b519c){for(var _0x46db22=0x0,_0x58659e=events[_0xf69f('0x6')];_0x46db22<_0x58659e;_0x46db22++){var _0x279929=events[_0x46db22];var _0x16924f=createListener(_0xf69f('0x7')+_0x279929,_0x2b519c);WhatsappMessageEvents['on'](_0x279929,_0x16924f);}}; \ No newline at end of file +var _0x49d7=['whatsappMessage:','./whatsappMessage.events','removeListener'];(function(_0x5c7e12,_0x65d01c){var _0x3ea2cf=function(_0x18c4f4){while(--_0x18c4f4){_0x5c7e12['push'](_0x5c7e12['shift']());}};_0x3ea2cf(++_0x65d01c);}(_0x49d7,0x1de));var _0x749d=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0x49d7[_0x1057a3];return _0x131cdb;};'use strict';var WhatsappMessageEvents=require(_0x749d('0x0'));var events=['save','remove','update'];function createListener(_0x24d94e,_0x434e3c){return function(_0x3dd4a4){_0x434e3c['emit'](_0x24d94e,_0x3dd4a4);};}function removeListener(_0x217520,_0x5e902e){return function(){WhatsappMessageEvents[_0x749d('0x1')](_0x217520,_0x5e902e);};}exports['register']=function(_0x413c63){for(var _0x51d0b6=0x0,_0x571385=events['length'];_0x51d0b6<_0x571385;_0x51d0b6++){var _0x43f540=events[_0x51d0b6];var _0x484d00=createListener(_0x749d('0x2')+_0x43f540,_0x413c63);WhatsappMessageEvents['on'](_0x43f540,_0x484d00);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 9f3b5f8..d22aed2 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 _0x0531=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents'];(function(_0x475242,_0x56b1d2){var _0x36075c=function(_0x103a94){while(--_0x103a94){_0x475242['push'](_0x475242['shift']());}};_0x36075c(++_0x56b1d2);}(_0x0531,0x8d));var _0x1053=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0x0531[_0x58175c];return _0x55b88f;};'use strict';var multer=require(_0x1053('0x0'));var util=require(_0x1053('0x1'));var path=require(_0x1053('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1053('0x3')]();var fs_extra=require(_0x1053('0x4'));var auth=require(_0x1053('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1053('0x6'));router[_0x1053('0x7')]('/',auth[_0x1053('0x8')](),controller['index']);router['get'](_0x1053('0x9'),auth[_0x1053('0x8')](),controller[_0x1053('0xa')]);router[_0x1053('0x7')]('/:id',auth[_0x1053('0x8')](),controller[_0x1053('0xb')]);router[_0x1053('0x7')](_0x1053('0xc'),auth[_0x1053('0x8')](),controller[_0x1053('0xd')]);router['get'](_0x1053('0xe'),auth['isAuthenticated'](),controller[_0x1053('0xf')]);router['get'](_0x1053('0x10'),auth[_0x1053('0x8')](),controller[_0x1053('0x11')]);router[_0x1053('0x12')]('/',auth[_0x1053('0x8')](),controller['create']);router[_0x1053('0x12')](_0x1053('0xe'),auth[_0x1053('0x8')](),controller[_0x1053('0x13')]);router['post'](_0x1053('0x10'),auth['isAuthenticated'](),controller[_0x1053('0x14')]);router['put'](_0x1053('0x15'),auth[_0x1053('0x8')](),controller[_0x1053('0x16')]);router[_0x1053('0x17')](_0x1053('0x15'),auth[_0x1053('0x8')](),controller[_0x1053('0x18')]);router[_0x1053('0x17')](_0x1053('0xe'),auth[_0x1053('0x8')](),controller[_0x1053('0x19')]);router[_0x1053('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x1053('0x1a')]);module[_0x1053('0x1b')]=router; \ No newline at end of file +var _0xf8ec=['/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xf8ec,0x17a));var _0xcf8e=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0xf8ec[_0x3c51d4];return _0x53c45f;};'use strict';var multer=require('multer');var util=require(_0xcf8e('0x0'));var path=require(_0xcf8e('0x1'));var timeout=require(_0xcf8e('0x2'));var express=require(_0xcf8e('0x3'));var router=express[_0xcf8e('0x4')]();var fs_extra=require(_0xcf8e('0x5'));var auth=require(_0xcf8e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf8e('0x7'));var controller=require(_0xcf8e('0x8'));router['get']('/',auth[_0xcf8e('0x9')](),controller[_0xcf8e('0xa')]);router[_0xcf8e('0xb')](_0xcf8e('0xc'),auth[_0xcf8e('0x9')](),controller['describe']);router[_0xcf8e('0xb')](_0xcf8e('0xd'),auth[_0xcf8e('0x9')](),controller[_0xcf8e('0xe')]);router[_0xcf8e('0xb')](_0xcf8e('0xf'),auth['isAuthenticated'](),controller[_0xcf8e('0x10')]);router[_0xcf8e('0xb')](_0xcf8e('0x11'),auth[_0xcf8e('0x9')](),controller[_0xcf8e('0x12')]);router[_0xcf8e('0xb')]('/:id/users',auth[_0xcf8e('0x9')](),controller[_0xcf8e('0x13')]);router[_0xcf8e('0x14')]('/',auth[_0xcf8e('0x9')](),controller[_0xcf8e('0x15')]);router[_0xcf8e('0x14')](_0xcf8e('0x11'),auth[_0xcf8e('0x9')](),controller[_0xcf8e('0x16')]);router[_0xcf8e('0x14')](_0xcf8e('0x17'),auth[_0xcf8e('0x9')](),controller[_0xcf8e('0x18')]);router[_0xcf8e('0x19')]('/:id',auth[_0xcf8e('0x9')](),controller['update']);router['delete'](_0xcf8e('0xd'),auth[_0xcf8e('0x9')](),controller['destroy']);router[_0xcf8e('0x1a')](_0xcf8e('0x11'),auth[_0xcf8e('0x9')](),controller[_0xcf8e('0x1b')]);router['delete'](_0xcf8e('0x17'),auth['isAuthenticated'](),controller[_0xcf8e('0x1c')]);module[_0xcf8e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 9875989..7d9a645 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 _0x0eaa=['INTEGER','ENUM','beepall','roundrobin','STRING','sequelize','exports'];(function(_0x1dec49,_0x3c7ef8){var _0x2a9969=function(_0xa4beeb){while(--_0xa4beeb){_0x1dec49['push'](_0x1dec49['shift']());}};_0x2a9969(++_0x3c7ef8);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x1280e3,_0x5a6dbf){_0x1280e3=_0x1280e3-0x0;var _0x2431a0=_0x0eaa[_0x1280e3];return _0x2431a0;};'use strict';var Sequelize=require(_0xa0ea('0x0'));module[_0xa0ea('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xa0ea('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa0ea('0x3')]('rrmemory',_0xa0ea('0x4'),_0xa0ea('0x5'))},'description':{'type':Sequelize[_0xa0ea('0x6')]}}; \ No newline at end of file +var _0x4584=['roundrobin','sequelize','STRING','name','INTEGER','beepall'];(function(_0x398cd9,_0x447f6b){var _0x392138=function(_0x5b3870){while(--_0x5b3870){_0x398cd9['push'](_0x398cd9['shift']());}};_0x392138(++_0x447f6b);}(_0x4584,0x1cf));var _0x4458=function(_0x268a71,_0x320096){_0x268a71=_0x268a71-0x0;var _0xd456b3=_0x4584[_0x268a71];return _0xd456b3;};'use strict';var Sequelize=require(_0x4458('0x0'));module['exports']={'name':{'type':Sequelize[_0x4458('0x1')],'unique':_0x4458('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4458('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x4458('0x4'),_0x4458('0x5'))},'description':{'type':Sequelize[_0x4458('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index f3899e8..0b669e9 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 _0x6d64=['key','where','include','query','findAll','rows','show','model','keys','filters','intersection','fields','attributes','includeAll','options','find','catch','body','user','role','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','length','nolimit','order','sort','WhatsappQueueId','filter','merge','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','hasOwnProperty','addTeams','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','ids','field','tq.TeamId','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','removeAgents','emit','addAgents','spread','isArray','userWhatsappQueue:remove','getAgents','bluebird','util','lodash','ioredis','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','WhatsappQueues','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type'];(function(_0x55dc5f,_0x336957){var _0x4e1610=function(_0x1f5140){while(--_0x1f5140){_0x55dc5f['push'](_0x55dc5f['shift']());}};_0x4e1610(++_0x336957);}(_0x6d64,0x1c1));var _0x46d6=function(_0x40cc9c,_0x4f3c9d){_0x40cc9c=_0x40cc9c-0x0;var _0x308f58=_0x6d64[_0x40cc9c];return _0x308f58;};'use strict';var BPromise=require(_0x46d6('0x0'));var util=require(_0x46d6('0x1'));var _=require(_0x46d6('0x2'));var squel=require('squel');var Redis=require(_0x46d6('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x46d6('0x4'));var config=require(_0x46d6('0x5'));var db=require(_0x46d6('0x6'))['db'];config['redis']=_['defaults'](config[_0x46d6('0x7')],{'host':_0x46d6('0x8'),'port':0x18eb});var socket=require(_0x46d6('0x9'))(new Redis(config[_0x46d6('0x7')]));require(_0x46d6('0xa'))[_0x46d6('0xb')](socket);function respondWithStatusCode(_0xcf249b,_0x476c7f){_0x476c7f=_0x476c7f||0xcc;return function(_0x4e34ba){if(_0x4e34ba){return _0xcf249b[_0x46d6('0xc')](_0x476c7f);}return _0xcf249b[_0x46d6('0xd')](_0x476c7f)[_0x46d6('0xe')]();};}function respondWithResult(_0x19801f,_0x450583){_0x450583=_0x450583||0xc8;return function(_0x4224ae){if(_0x4224ae){return _0x19801f['status'](_0x450583)['json'](_0x4224ae);}};}function respondWithFilteredResult(_0x154063,_0x5e5a22){return function(_0x2fa1ec){if(_0x2fa1ec){var _0x251cb0=typeof _0x5e5a22[_0x46d6('0xf')]===_0x46d6('0x10')&&typeof _0x5e5a22[_0x46d6('0x11')]===_0x46d6('0x10');var _0x3a808a=_0x2fa1ec[_0x46d6('0x12')];var _0xf38aa8=_0x251cb0?0x0:_0x5e5a22[_0x46d6('0xf')];var _0x5529b7=_0x251cb0?_0x2fa1ec['count']:_0x5e5a22[_0x46d6('0xf')]+_0x5e5a22[_0x46d6('0x11')];var _0x1aaadb;if(_0x5529b7>=_0x3a808a){_0x5529b7=_0x3a808a;_0x1aaadb=0xc8;}else{_0x1aaadb=0xce;}_0x154063[_0x46d6('0xd')](_0x1aaadb);return _0x154063[_0x46d6('0x13')](_0x46d6('0x14'),_0xf38aa8+'-'+_0x5529b7+'/'+_0x3a808a)[_0x46d6('0x15')](_0x2fa1ec);}return null;};}function saveUpdates(_0x408d0e){return function(_0x352cd9){if(_0x352cd9){return _0x352cd9[_0x46d6('0x16')](_0x408d0e)['then'](function(_0xe4f273){return _0xe4f273;});}return null;};}function removeEntity(_0x3a578b){return function(_0x246433){if(_0x246433){return _0x246433[_0x46d6('0x17')]()[_0x46d6('0x18')](function(){var _0x6fffa0=_0x246433['get']({'plain':!![]});var _0x4072e4=_0x46d6('0x19');return db['UserProfileResource'][_0x46d6('0x17')]({'where':{'type':_0x4072e4,'resourceId':_0x6fffa0['id']}})[_0x46d6('0x18')](function(){return _0x246433;});})[_0x46d6('0x18')](function(){_0x3a578b[_0x46d6('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8242){return function(_0x325b38){if(!_0x325b38){_0x3f8242[_0x46d6('0xc')](0x194);}return _0x325b38;};}function handleError(_0x590dbc,_0x43f64c){_0x43f64c=_0x43f64c||0x1f4;return function(_0x3d3a9e){logger[_0x46d6('0x1a')](_0x3d3a9e['stack']);if(_0x3d3a9e[_0x46d6('0x1b')]){delete _0x3d3a9e[_0x46d6('0x1b')];}_0x590dbc[_0x46d6('0xd')](_0x43f64c)[_0x46d6('0x1c')](_0x3d3a9e);};}exports[_0x46d6('0x1d')]=function(_0x3cfa5b,_0x3fd42b){var _0x2289c2={};var _0x36799e={'count':0x0,'rows':[]};var _0x2814e5=_[_0x46d6('0x1e')](db[_0x46d6('0x1f')][_0x46d6('0x20')],function(_0x24e765){return{'name':_0x24e765[_0x46d6('0x21')],'type':_0x24e765[_0x46d6('0x22')][_0x46d6('0x23')]};});_0x2289c2=qs['getOptions'](_0x2814e5,_0x3cfa5b);var _0x11ccc9={'where':_0x2289c2[_0x46d6('0x24')]};return db['WhatsappQueue'][_0x46d6('0x12')](_0x11ccc9)[_0x46d6('0x18')](function(_0xeef68e){_0x36799e[_0x46d6('0x12')]=_0xeef68e;_0x2289c2[_0x46d6('0x25')]=qs['include'](_0x3cfa5b[_0x46d6('0x26')]);return db[_0x46d6('0x1f')][_0x46d6('0x27')](_0x2289c2);})[_0x46d6('0x18')](function(_0x4b4eb1){_0x36799e[_0x46d6('0x28')]=_0x4b4eb1;return _0x36799e;})[_0x46d6('0x18')](respondWithFilteredResult(_0x3fd42b,_0x2289c2))['catch'](handleError(_0x3fd42b,null));};exports[_0x46d6('0x29')]=function(_0xbd86fd,_0x3e011e){var _0x2bbe6e={'raw':!![],'where':{'id':_0xbd86fd['params']['id']}},_0x59ef61={};_0x59ef61[_0x46d6('0x2a')]=_[_0x46d6('0x2b')](db[_0x46d6('0x1f')][_0x46d6('0x20')]);_0x59ef61['query']=_[_0x46d6('0x2b')](_0xbd86fd[_0x46d6('0x26')]);_0x59ef61[_0x46d6('0x2c')]=_['intersection'](_0x59ef61[_0x46d6('0x2a')],_0x59ef61[_0x46d6('0x26')]);_0x2bbe6e['attributes']=_[_0x46d6('0x2d')](_0x59ef61[_0x46d6('0x2a')],qs[_0x46d6('0x2e')](_0xbd86fd['query']['fields']));_0x2bbe6e[_0x46d6('0x2f')]=_0x2bbe6e[_0x46d6('0x2f')]['length']?_0x2bbe6e[_0x46d6('0x2f')]:_0x59ef61[_0x46d6('0x2a')];if(_0xbd86fd[_0x46d6('0x26')][_0x46d6('0x30')]){_0x2bbe6e['include']=[{'all':!![]}];}_0x2bbe6e=_['merge']({},_0x2bbe6e,_0xbd86fd[_0x46d6('0x31')]);return db[_0x46d6('0x1f')][_0x46d6('0x32')](_0x2bbe6e)['then'](handleEntityNotFound(_0x3e011e,null))[_0x46d6('0x18')](respondWithResult(_0x3e011e,null))[_0x46d6('0x33')](handleError(_0x3e011e,null));};exports['create']=function(_0x5f2417,_0x40cad1){return db[_0x46d6('0x1f')]['create'](_0x5f2417[_0x46d6('0x34')],{})['then'](function(_0x5e868c){var _0x17328e=_0x5f2417[_0x46d6('0x35')]['get']({'plain':!![]});if(!_0x17328e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17328e[_0x46d6('0x36')]===_0x46d6('0x35')){var _0x5d264a=_0x5e868c[_0x46d6('0x37')]({'plain':!![]});var _0x135c4e=_0x46d6('0x19');return db[_0x46d6('0x38')][_0x46d6('0x32')]({'where':{'name':_0x135c4e,'userProfileId':_0x17328e[_0x46d6('0x39')]},'raw':!![]})[_0x46d6('0x18')](function(_0x2ac295){if(_0x2ac295&&_0x2ac295['autoAssociation']===0x0){return db[_0x46d6('0x3a')]['create']({'name':_0x5d264a[_0x46d6('0x1b')],'resourceId':_0x5d264a['id'],'type':_0x2ac295['name'],'sectionId':_0x2ac295['id']},{})[_0x46d6('0x18')](function(){return _0x5e868c;});}else{return _0x5e868c;}})[_0x46d6('0x33')](function(_0x218bab){logger[_0x46d6('0x1a')](_0x46d6('0x3b'),_0x218bab);throw _0x218bab;});}return _0x5e868c;})['then'](respondWithResult(_0x40cad1,0xc9))[_0x46d6('0x33')](handleError(_0x40cad1,null));};exports['update']=function(_0x461c9b,_0x38b59e){if(_0x461c9b[_0x46d6('0x34')]['id']){delete _0x461c9b['body']['id'];}return db[_0x46d6('0x1f')][_0x46d6('0x32')]({'where':{'id':_0x461c9b[_0x46d6('0x3c')]['id']}})[_0x46d6('0x18')](handleEntityNotFound(_0x38b59e,null))[_0x46d6('0x18')](saveUpdates(_0x461c9b[_0x46d6('0x34')],null))['then'](respondWithResult(_0x38b59e,null))['catch'](handleError(_0x38b59e,null));};exports[_0x46d6('0x17')]=function(_0x12fd36,_0x51e9aa){return db[_0x46d6('0x1f')]['find']({'where':{'id':_0x12fd36[_0x46d6('0x3c')]['id']}})[_0x46d6('0x18')](handleEntityNotFound(_0x51e9aa,null))[_0x46d6('0x18')](removeEntity(_0x51e9aa,null))[_0x46d6('0x33')](handleError(_0x51e9aa,null));};exports[_0x46d6('0x3d')]=function(_0x265a12,_0x257fe5){return db[_0x46d6('0x1f')][_0x46d6('0x3d')]()[_0x46d6('0x18')](respondWithResult(_0x257fe5,null))['catch'](handleError(_0x257fe5,null));};exports[_0x46d6('0x3e')]=function(_0x34a486,_0x1ab582){var _0x31d5be={'raw':!![],'where':{}},_0x289fcd={},_0x2e1253;return db[_0x46d6('0x1f')][_0x46d6('0x3f')]({'where':{'id':_0x34a486['params']['id']}})[_0x46d6('0x18')](handleEntityNotFound(_0x1ab582,null))['then'](function(_0x440cf4){if(_0x440cf4){_0x2e1253=_0x440cf4[_0x46d6('0x37')]({'plain':!![]});_0x289fcd[_0x46d6('0x2a')]=_['keys'](db[_0x46d6('0x40')][_0x46d6('0x20')]);_0x289fcd['query']=_['keys'](_0x34a486[_0x46d6('0x26')]);_0x289fcd[_0x46d6('0x2c')]=_[_0x46d6('0x2d')](_0x289fcd[_0x46d6('0x2a')],_0x289fcd[_0x46d6('0x26')]);_0x31d5be[_0x46d6('0x2f')]=_['intersection'](_0x289fcd[_0x46d6('0x2a')],qs[_0x46d6('0x2e')](_0x34a486['query'][_0x46d6('0x2e')]));_0x31d5be[_0x46d6('0x2f')]=_0x31d5be['attributes'][_0x46d6('0x41')]?_0x31d5be[_0x46d6('0x2f')]:_0x289fcd['model'];if(!_0x34a486['query']['hasOwnProperty'](_0x46d6('0x42'))){_0x31d5be[_0x46d6('0x11')]=qs[_0x46d6('0x11')](_0x34a486[_0x46d6('0x26')][_0x46d6('0x11')]);_0x31d5be[_0x46d6('0xf')]=qs[_0x46d6('0xf')](_0x34a486[_0x46d6('0x26')][_0x46d6('0xf')]);}_0x31d5be[_0x46d6('0x43')]=qs[_0x46d6('0x44')](_0x34a486[_0x46d6('0x26')][_0x46d6('0x44')]);_0x31d5be[_0x46d6('0x24')]=qs[_0x46d6('0x2c')](_['pick'](_0x34a486[_0x46d6('0x26')],_0x289fcd[_0x46d6('0x2c')]));_0x31d5be[_0x46d6('0x24')][_0x46d6('0x45')]=_0x440cf4['id'];if(_0x34a486['query'][_0x46d6('0x46')]){_0x31d5be[_0x46d6('0x24')]=_[_0x46d6('0x47')](_0x31d5be[_0x46d6('0x24')],{'$or':_[_0x46d6('0x1e')](_0x31d5be[_0x46d6('0x2f')],function(_0xbd3359){var _0x537629={};_0x537629[_0xbd3359]={'$like':'%'+_0x34a486[_0x46d6('0x26')]['filter']+'%'};return _0x537629;})});}_0x31d5be=_[_0x46d6('0x47')]({},_0x31d5be,_0x34a486[_0x46d6('0x31')]);return db['UserWhatsappQueue'][_0x46d6('0x27')](_0x31d5be);}})[_0x46d6('0x18')](function(_0xabc33d){if(_0xabc33d){return db[_0x46d6('0x48')][_0x46d6('0x49')]({'where':{'id':_[_0x46d6('0x1e')](_0xabc33d,_0x46d6('0x4a')),'role':_0x46d6('0x4b')},'attributes':['id','name',_0x46d6('0x4c'),_0x46d6('0x4d'),_0x46d6('0x4e')]});}})['then'](function(_0x11dcf2){if(_0x11dcf2){return{'count':_0x11dcf2[_0x46d6('0x12')],'rows':_[_0x46d6('0x1e')](_0x11dcf2[_0x46d6('0x28')],function(_0x521833){return{'membername':_0x521833[_0x46d6('0x1b')],'UserId':_0x521833['id'],'queue_name':_0x2e1253[_0x46d6('0x1b')],'WhatsappQueueId':_0x2e1253['id'],'interface':util[_0x46d6('0x4f')]('%s/%s',_0x46d6('0x50'),_0x521833[_0x46d6('0x1b')]),'penalty':0x0,'paused':_0x521833[_0x46d6('0x4c')],'createdAt':_0x521833[_0x46d6('0x4e')],'updatedAt':_0x521833[_0x46d6('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x46d6('0x18')](respondWithFilteredResult(_0x1ab582,_0x31d5be))['catch'](handleError(_0x1ab582,null));};exports[_0x46d6('0x51')]=function(_0x34e4fe,_0x1a4e0f){var _0x1e1053={};var _0x538ac6={};var _0x320f5d;var _0x7cfa08;return db[_0x46d6('0x1f')]['findOne']({'where':{'id':_0x34e4fe['params']['id']}})[_0x46d6('0x18')](handleEntityNotFound(_0x1a4e0f,null))[_0x46d6('0x18')](function(_0x5a6e56){if(_0x5a6e56){_0x320f5d=_0x5a6e56;_0x538ac6[_0x46d6('0x2a')]=_[_0x46d6('0x2b')](db['Team'][_0x46d6('0x20')]);_0x538ac6[_0x46d6('0x26')]=_['keys'](_0x34e4fe['query']);_0x538ac6[_0x46d6('0x2c')]=_[_0x46d6('0x2d')](_0x538ac6[_0x46d6('0x2a')],_0x538ac6['query']);_0x1e1053[_0x46d6('0x2f')]=_[_0x46d6('0x2d')](_0x538ac6[_0x46d6('0x2a')],qs[_0x46d6('0x2e')](_0x34e4fe[_0x46d6('0x26')][_0x46d6('0x2e')]));_0x1e1053['attributes']=_0x1e1053['attributes'][_0x46d6('0x41')]?_0x1e1053[_0x46d6('0x2f')]:_0x538ac6[_0x46d6('0x2a')];_0x1e1053[_0x46d6('0x43')]=qs[_0x46d6('0x44')](_0x34e4fe['query'][_0x46d6('0x44')]);_0x1e1053['where']=qs['filters'](_['pick'](_0x34e4fe[_0x46d6('0x26')],_0x538ac6[_0x46d6('0x2c')]));if(_0x34e4fe['query'][_0x46d6('0x46')]){_0x1e1053[_0x46d6('0x24')]=_[_0x46d6('0x47')](_0x1e1053[_0x46d6('0x24')],{'$or':_[_0x46d6('0x1e')](_0x1e1053['attributes'],function(_0x485ed5){var _0x34154e={};_0x34154e[_0x485ed5]={'$like':'%'+_0x34e4fe['query'][_0x46d6('0x46')]+'%'};return _0x34154e;})});}_0x1e1053=_[_0x46d6('0x47')]({},_0x1e1053,_0x34e4fe[_0x46d6('0x31')]);return _0x320f5d[_0x46d6('0x51')](_0x1e1053);}})[_0x46d6('0x18')](function(_0x23835e){if(_0x23835e){_0x7cfa08=_0x23835e[_0x46d6('0x41')];if(!_0x34e4fe[_0x46d6('0x26')][_0x46d6('0x52')](_0x46d6('0x42'))){_0x1e1053[_0x46d6('0x11')]=qs[_0x46d6('0x11')](_0x34e4fe[_0x46d6('0x26')][_0x46d6('0x11')]);_0x1e1053[_0x46d6('0xf')]=qs['offset'](_0x34e4fe[_0x46d6('0x26')][_0x46d6('0xf')]);}return _0x320f5d['getTeams'](_0x1e1053);}})[_0x46d6('0x18')](function(_0x11eec9){if(_0x11eec9){return _0x11eec9?{'count':_0x7cfa08,'rows':_0x11eec9}:null;}})['then'](respondWithResult(_0x1a4e0f,null))[_0x46d6('0x33')](handleError(_0x1a4e0f,null));};exports[_0x46d6('0x53')]=function(_0x189338,_0x86149f){var _0x365ce9=_0x189338['body']['ids'];return db[_0x46d6('0x54')][_0x46d6('0x27')]({'where':{'id':_0x365ce9},'attributes':['id'],'include':[{'model':db[_0x46d6('0x48')],'as':_0x46d6('0x55'),'attributes':['id',_0x46d6('0x1b'),_0x46d6('0x56'),_0x46d6('0x57'),'interface'],'raw':!![]}]})['then'](function(_0x37da55){if(_0x37da55){var _0x368a45=_[_0x46d6('0x58')](_0x37da55,function(_0x476d5e){var _0x2bcdf7=_0x476d5e[_0x46d6('0x37')]({'plain':!![]});return _0x2bcdf7[_0x46d6('0x55')];});return db[_0x46d6('0x1f')]['find']({'where':{'id':_0x189338[_0x46d6('0x3c')]['id']}})['then'](function(_0x17f23b){return db[_0x46d6('0x59')][_0x46d6('0x5a')](function(_0x173a4e){return _0x17f23b[_0x46d6('0x53')](_0x365ce9,{'transaction':_0x173a4e})[_0x46d6('0x18')](function(){return BPromise[_0x46d6('0x5b')](_0x368a45,function(_0x5a0df9){return db[_0x46d6('0x40')][_0x46d6('0x5c')]({'where':{'UserId':_0x5a0df9['id'],'WhatsappQueueId':_0x189338[_0x46d6('0x3c')]['id']},'transaction':_0x173a4e});});})[_0x46d6('0x18')](function(){_0x368a45[_0x46d6('0x5d')](function(_0x4c7e97){socket['emit'](_0x46d6('0x5e'),{'UserId':_0x4c7e97['id'],'WhatsappQueueId':_0x17f23b['id']});});});});});}})[_0x46d6('0x18')](respondWithStatusCode(_0x86149f,null))['catch'](handleError(_0x86149f,null));};exports[_0x46d6('0x5f')]=function(_0x14ecdc,_0x35741a){return db[_0x46d6('0x54')][_0x46d6('0x27')]({'where':{'id':_0x14ecdc['query'][_0x46d6('0x60')]},'attributes':['id'],'include':[{'model':db[_0x46d6('0x48')],'as':_0x46d6('0x55'),'attributes':['id'],'raw':!![]}]})[_0x46d6('0x18')](handleEntityNotFound(_0x35741a,null))['then'](function(_0x47958f){var _0x50ee2d=_[_0x46d6('0x1e')](_0x47958f,'id');var _0x608cb0=[];var _0x583d63=[];var _0x1b0be9=squel['select']();_0x1b0be9[_0x46d6('0x61')](_0x46d6('0x62'))['from'](_0x46d6('0x63'),'tq')['join'](_0x46d6('0x64'),'ut',_0x46d6('0x65'))[_0x46d6('0x24')]('WhatsappQueueId\x20=\x20?',_0x14ecdc[_0x46d6('0x3c')]['id']);for(var _0x2e894a=0x0;_0x2e894a<_0x47958f[_0x46d6('0x41')];_0x2e894a+=0x1){let _0x14a529=_0x47958f[_0x2e894a];for(var _0x33018e=0x0;_0x33018e<_0x14a529[_0x46d6('0x55')]['length'];_0x33018e+=0x1){let _0x2b19f9=_0x14a529[_0x46d6('0x55')][_0x33018e];var _0x4ce3aa=_0x1b0be9[_0x46d6('0x66')]();_0x4ce3aa[_0x46d6('0x24')](_0x46d6('0x67'),_0x2b19f9['id']);_0x583d63[_0x46d6('0x68')](db['sequelize'][_0x46d6('0x26')](_0x4ce3aa[_0x46d6('0x69')](),{'type':db[_0x46d6('0x59')][_0x46d6('0x6a')][_0x46d6('0x6b')]})[_0x46d6('0x18')](function(_0x4b42d8){if(_0x4b42d8[_0x46d6('0x41')]===0x1){return _0x2b19f9['id'];}else{var _0x19f545=_['every'](_['map'](_0x4b42d8,_0x46d6('0x6c')),function(_0x55e980){return _[_0x46d6('0x6d')](_0x50ee2d,_0x55e980);});if(_0x19f545){return _0x2b19f9['id'];}}}));}}return BPromise[_0x46d6('0x6e')](_0x583d63)[_0x46d6('0x18')](function(_0x3e31a2){_0x608cb0=_(_0x608cb0)[_0x46d6('0x6f')](_0x3e31a2)[_0x46d6('0x70')]()['value']();return db[_0x46d6('0x1f')][_0x46d6('0x32')]({'where':{'id':_0x14ecdc[_0x46d6('0x3c')]['id']}})[_0x46d6('0x18')](function(_0x40e3ea){return db[_0x46d6('0x59')][_0x46d6('0x5a')](function(_0x58cabf){return _0x40e3ea[_0x46d6('0x5f')](_0x14ecdc[_0x46d6('0x26')][_0x46d6('0x60')],{'transaction':_0x58cabf})[_0x46d6('0x18')](function(){if(!_[_0x46d6('0x71')](_0x608cb0)){return _0x40e3ea[_0x46d6('0x72')](_0x608cb0,{'transaction':_0x58cabf});}})[_0x46d6('0x18')](function(){_0x608cb0[_0x46d6('0x5d')](function(_0x49fb8e){socket[_0x46d6('0x73')]('userWhatsappQueue:remove',{'UserId':_0x49fb8e,'WhatsappQueueId':_0x40e3ea['id']});});});});});});})['then'](respondWithStatusCode(_0x35741a,null))[_0x46d6('0x33')](handleError(_0x35741a,null));};exports[_0x46d6('0x74')]=function(_0x342fac,_0x24b7ab){return db[_0x46d6('0x1f')]['find']({'where':{'id':_0x342fac['params']['id']}})['then'](handleEntityNotFound(_0x24b7ab,null))[_0x46d6('0x18')](function(_0x3cc036){if(_0x3cc036){return _0x3cc036[_0x46d6('0x74')](_0x342fac[_0x46d6('0x34')][_0x46d6('0x60')],_['omit'](_0x342fac['body'],[_0x46d6('0x60'),'id'])||{})[_0x46d6('0x75')](function(_0x28c132){for(var _0x25ae31=0x0;_0x25ae31<_0x342fac['body'][_0x46d6('0x60')][_0x46d6('0x41')];_0x25ae31+=0x1){socket[_0x46d6('0x73')](_0x46d6('0x5e'),{'UserId':Number(_0x342fac[_0x46d6('0x34')]['ids'][_0x25ae31]),'WhatsappQueueId':Number(_0x342fac[_0x46d6('0x3c')]['id'])});}return _0x28c132;});}})[_0x46d6('0x18')](respondWithResult(_0x24b7ab,null))[_0x46d6('0x33')](handleError(_0x24b7ab,null));};exports[_0x46d6('0x72')]=function(_0x41995c,_0x927b5e){return db[_0x46d6('0x1f')]['find']({'where':{'id':_0x41995c['params']['id']}})[_0x46d6('0x18')](handleEntityNotFound(_0x927b5e,null))[_0x46d6('0x18')](function(_0x414c2f){if(_0x414c2f){return _0x414c2f[_0x46d6('0x72')](_0x41995c[_0x46d6('0x26')][_0x46d6('0x60')])[_0x46d6('0x18')](function(){if(_[_0x46d6('0x76')](_0x41995c[_0x46d6('0x26')][_0x46d6('0x60')])){for(var _0x2fb759=0x0;_0x2fb759<_0x41995c[_0x46d6('0x26')][_0x46d6('0x60')][_0x46d6('0x41')];_0x2fb759+=0x1){socket['emit'](_0x46d6('0x77'),{'UserId':Number(_0x41995c[_0x46d6('0x26')][_0x46d6('0x60')][_0x2fb759]),'WhatsappQueueId':Number(_0x41995c[_0x46d6('0x3c')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x41995c['query'][_0x46d6('0x60')]),'WhatsappQueueId':Number(_0x41995c[_0x46d6('0x3c')]['id'])});}});}})['then'](respondWithStatusCode(_0x927b5e,null))[_0x46d6('0x33')](handleError(_0x927b5e,null));};exports[_0x46d6('0x78')]=function(_0x23e331,_0x705b3d){var _0x349605={};var _0xcbf8ff={};var _0x39dc53;var _0x1e730f;return db['WhatsappQueue'][_0x46d6('0x3f')]({'where':{'id':_0x23e331[_0x46d6('0x3c')]['id']}})[_0x46d6('0x18')](handleEntityNotFound(_0x705b3d,null))[_0x46d6('0x18')](function(_0x53c8a7){if(_0x53c8a7){_0x39dc53=_0x53c8a7;_0xcbf8ff[_0x46d6('0x2a')]=_[_0x46d6('0x2b')](db[_0x46d6('0x48')][_0x46d6('0x20')]);_0xcbf8ff['query']=_[_0x46d6('0x2b')](_0x23e331['query']);_0xcbf8ff[_0x46d6('0x2c')]=_[_0x46d6('0x2d')](_0xcbf8ff[_0x46d6('0x2a')],_0xcbf8ff[_0x46d6('0x26')]);_0x349605['attributes']=_[_0x46d6('0x2d')](_0xcbf8ff[_0x46d6('0x2a')],qs[_0x46d6('0x2e')](_0x23e331['query'][_0x46d6('0x2e')]));_0x349605[_0x46d6('0x2f')]=_0x349605[_0x46d6('0x2f')][_0x46d6('0x41')]?_0x349605['attributes']:_0xcbf8ff['model'];_0x349605[_0x46d6('0x43')]=qs[_0x46d6('0x44')](_0x23e331['query'][_0x46d6('0x44')]);_0x349605['where']=qs[_0x46d6('0x2c')](_['pick'](_0x23e331[_0x46d6('0x26')],_0xcbf8ff['filters']));if(_0x23e331[_0x46d6('0x26')][_0x46d6('0x46')]){_0x349605[_0x46d6('0x24')]=_['merge'](_0x349605['where'],{'$or':_[_0x46d6('0x1e')](_0x349605[_0x46d6('0x2f')],function(_0x2e1dfb){var _0x5e56f5={};_0x5e56f5[_0x2e1dfb]={'$like':'%'+_0x23e331['query']['filter']+'%'};return _0x5e56f5;})});}_0x349605=_[_0x46d6('0x47')]({},_0x349605,_0x23e331[_0x46d6('0x31')]);return _0x39dc53[_0x46d6('0x78')](_0x349605);}})[_0x46d6('0x18')](function(_0x433d0e){if(_0x433d0e){_0x1e730f=_0x433d0e[_0x46d6('0x41')];if(!_0x23e331['query'][_0x46d6('0x52')](_0x46d6('0x42'))){_0x349605[_0x46d6('0x11')]=qs[_0x46d6('0x11')](_0x23e331[_0x46d6('0x26')][_0x46d6('0x11')]);_0x349605[_0x46d6('0xf')]=qs[_0x46d6('0xf')](_0x23e331[_0x46d6('0x26')][_0x46d6('0xf')]);}return _0x39dc53[_0x46d6('0x78')](_0x349605);}})[_0x46d6('0x18')](function(_0x1294c6){if(_0x1294c6){return _0x1294c6?{'count':_0x1e730f,'rows':_0x1294c6}:null;}})['then'](respondWithResult(_0x705b3d,null))[_0x46d6('0x33')](handleError(_0x705b3d,null));}; \ No newline at end of file +var _0x7b3a=['union','compact','value','transaction','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','emit','isArray','getAgents','bluebird','util','lodash','squel','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','then','destroy','get','WhatsappQueues','error','stack','name','send','index','WhatsappQueue','rawAttributes','type','key','getOptions','include','query','findAll','rows','catch','show','params','model','keys','intersection','fields','attributes','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserWhatsappQueue','filters','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappQueueId','filter','map','options','findAndCountAll','UserId','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','ids','Team','User','online','voicePause','interface','Agents','sequelize','addTeams','each','userWhatsappQueue:save','removeTeams','select','field','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes'];(function(_0x213b44,_0x2163a1){var _0x10c116=function(_0x35041a){while(--_0x35041a){_0x213b44['push'](_0x213b44['shift']());}};_0x10c116(++_0x2163a1);}(_0x7b3a,0x17d));var _0xa7b3=function(_0x46cbbb,_0x3faff5){_0x46cbbb=_0x46cbbb-0x0;var _0x26f95a=_0x7b3a[_0x46cbbb];return _0x26f95a;};'use strict';var BPromise=require(_0xa7b3('0x0'));var util=require(_0xa7b3('0x1'));var _=require(_0xa7b3('0x2'));var squel=require(_0xa7b3('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xa7b3('0x4'))('api');var config=require(_0xa7b3('0x5'));var db=require(_0xa7b3('0x6'))['db'];config[_0xa7b3('0x7')]=_[_0xa7b3('0x8')](config[_0xa7b3('0x7')],{'host':_0xa7b3('0x9'),'port':0x18eb});var socket=require(_0xa7b3('0xa'))(new Redis(config[_0xa7b3('0x7')]));require('./whatsappQueue.socket')[_0xa7b3('0xb')](socket);function respondWithStatusCode(_0x59f444,_0x139dce){_0x139dce=_0x139dce||0xcc;return function(_0x32bd20){if(_0x32bd20){return _0x59f444[_0xa7b3('0xc')](_0x139dce);}return _0x59f444[_0xa7b3('0xd')](_0x139dce)[_0xa7b3('0xe')]();};}function respondWithResult(_0x507213,_0x308301){_0x308301=_0x308301||0xc8;return function(_0x2b7efc){if(_0x2b7efc){return _0x507213[_0xa7b3('0xd')](_0x308301)[_0xa7b3('0xf')](_0x2b7efc);}};}function respondWithFilteredResult(_0x5ad886,_0xb7d71f){return function(_0x20df49){if(_0x20df49){var _0x1367e2=typeof _0xb7d71f['offset']===_0xa7b3('0x10')&&typeof _0xb7d71f[_0xa7b3('0x11')]===_0xa7b3('0x10');var _0x46c8ef=_0x20df49[_0xa7b3('0x12')];var _0x256f17=_0x1367e2?0x0:_0xb7d71f[_0xa7b3('0x13')];var _0x1aa139=_0x1367e2?_0x20df49[_0xa7b3('0x12')]:_0xb7d71f['offset']+_0xb7d71f[_0xa7b3('0x11')];var _0x5a0a8c;if(_0x1aa139>=_0x46c8ef){_0x1aa139=_0x46c8ef;_0x5a0a8c=0xc8;}else{_0x5a0a8c=0xce;}_0x5ad886[_0xa7b3('0xd')](_0x5a0a8c);return _0x5ad886[_0xa7b3('0x14')](_0xa7b3('0x15'),_0x256f17+'-'+_0x1aa139+'/'+_0x46c8ef)[_0xa7b3('0xf')](_0x20df49);}return null;};}function saveUpdates(_0x4b5bca){return function(_0x1012c4){if(_0x1012c4){return _0x1012c4['update'](_0x4b5bca)[_0xa7b3('0x16')](function(_0x179746){return _0x179746;});}return null;};}function removeEntity(_0x39edca){return function(_0xedca44){if(_0xedca44){return _0xedca44[_0xa7b3('0x17')]()[_0xa7b3('0x16')](function(){var _0x4c32f5=_0xedca44[_0xa7b3('0x18')]({'plain':!![]});var _0xa4349=_0xa7b3('0x19');return db['UserProfileResource'][_0xa7b3('0x17')]({'where':{'type':_0xa4349,'resourceId':_0x4c32f5['id']}})['then'](function(){return _0xedca44;});})[_0xa7b3('0x16')](function(){_0x39edca[_0xa7b3('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7fda07){return function(_0x501e1b){if(!_0x501e1b){_0x7fda07[_0xa7b3('0xc')](0x194);}return _0x501e1b;};}function handleError(_0x70233d,_0x28375a){_0x28375a=_0x28375a||0x1f4;return function(_0x2f03c4){logger[_0xa7b3('0x1a')](_0x2f03c4[_0xa7b3('0x1b')]);if(_0x2f03c4[_0xa7b3('0x1c')]){delete _0x2f03c4[_0xa7b3('0x1c')];}_0x70233d['status'](_0x28375a)[_0xa7b3('0x1d')](_0x2f03c4);};}exports[_0xa7b3('0x1e')]=function(_0x37f2fd,_0x472fb2){var _0x13e149={};var _0x597740={'count':0x0,'rows':[]};var _0x1b77ff=_['map'](db[_0xa7b3('0x1f')][_0xa7b3('0x20')],function(_0x3a2c73){return{'name':_0x3a2c73['fieldName'],'type':_0x3a2c73[_0xa7b3('0x21')][_0xa7b3('0x22')]};});_0x13e149=qs[_0xa7b3('0x23')](_0x1b77ff,_0x37f2fd);var _0x2e08cd={'where':_0x13e149['where']};return db[_0xa7b3('0x1f')]['count'](_0x2e08cd)[_0xa7b3('0x16')](function(_0x27af11){_0x597740[_0xa7b3('0x12')]=_0x27af11;_0x13e149['include']=qs[_0xa7b3('0x24')](_0x37f2fd[_0xa7b3('0x25')]);return db[_0xa7b3('0x1f')][_0xa7b3('0x26')](_0x13e149);})[_0xa7b3('0x16')](function(_0x5dc279){_0x597740[_0xa7b3('0x27')]=_0x5dc279;return _0x597740;})[_0xa7b3('0x16')](respondWithFilteredResult(_0x472fb2,_0x13e149))[_0xa7b3('0x28')](handleError(_0x472fb2,null));};exports[_0xa7b3('0x29')]=function(_0x2d325a,_0x2c8667){var _0x4e0a25={'raw':!![],'where':{'id':_0x2d325a[_0xa7b3('0x2a')]['id']}},_0x7dc90b={};_0x7dc90b[_0xa7b3('0x2b')]=_[_0xa7b3('0x2c')](db[_0xa7b3('0x1f')][_0xa7b3('0x20')]);_0x7dc90b['query']=_['keys'](_0x2d325a[_0xa7b3('0x25')]);_0x7dc90b['filters']=_[_0xa7b3('0x2d')](_0x7dc90b['model'],_0x7dc90b[_0xa7b3('0x25')]);_0x4e0a25['attributes']=_[_0xa7b3('0x2d')](_0x7dc90b[_0xa7b3('0x2b')],qs['fields'](_0x2d325a[_0xa7b3('0x25')][_0xa7b3('0x2e')]));_0x4e0a25[_0xa7b3('0x2f')]=_0x4e0a25[_0xa7b3('0x2f')][_0xa7b3('0x30')]?_0x4e0a25[_0xa7b3('0x2f')]:_0x7dc90b['model'];if(_0x2d325a[_0xa7b3('0x25')][_0xa7b3('0x31')]){_0x4e0a25[_0xa7b3('0x24')]=[{'all':!![]}];}_0x4e0a25=_[_0xa7b3('0x32')]({},_0x4e0a25,_0x2d325a['options']);return db[_0xa7b3('0x1f')][_0xa7b3('0x33')](_0x4e0a25)[_0xa7b3('0x16')](handleEntityNotFound(_0x2c8667,null))[_0xa7b3('0x16')](respondWithResult(_0x2c8667,null))[_0xa7b3('0x28')](handleError(_0x2c8667,null));};exports[_0xa7b3('0x34')]=function(_0x2bda21,_0x4ac8bc){return db['WhatsappQueue'][_0xa7b3('0x34')](_0x2bda21[_0xa7b3('0x35')],{})[_0xa7b3('0x16')](function(_0x4cb84a){var _0x4d6d2c=_0x2bda21[_0xa7b3('0x36')][_0xa7b3('0x18')]({'plain':!![]});if(!_0x4d6d2c)throw new Error(_0xa7b3('0x37'));if(_0x4d6d2c['role']===_0xa7b3('0x36')){var _0x83257c=_0x4cb84a[_0xa7b3('0x18')]({'plain':!![]});var _0x2f876a=_0xa7b3('0x19');return db[_0xa7b3('0x38')][_0xa7b3('0x33')]({'where':{'name':_0x2f876a,'userProfileId':_0x4d6d2c[_0xa7b3('0x39')]},'raw':!![]})['then'](function(_0x11a722){if(_0x11a722&&_0x11a722[_0xa7b3('0x3a')]===0x0){return db[_0xa7b3('0x3b')][_0xa7b3('0x34')]({'name':_0x83257c[_0xa7b3('0x1c')],'resourceId':_0x83257c['id'],'type':_0x11a722[_0xa7b3('0x1c')],'sectionId':_0x11a722['id']},{})[_0xa7b3('0x16')](function(){return _0x4cb84a;});}else{return _0x4cb84a;}})[_0xa7b3('0x28')](function(_0x475be2){logger['error'](_0xa7b3('0x3c'),_0x475be2);throw _0x475be2;});}return _0x4cb84a;})['then'](respondWithResult(_0x4ac8bc,0xc9))[_0xa7b3('0x28')](handleError(_0x4ac8bc,null));};exports[_0xa7b3('0x3d')]=function(_0xaa5614,_0x51d00e){if(_0xaa5614[_0xa7b3('0x35')]['id']){delete _0xaa5614[_0xa7b3('0x35')]['id'];}return db[_0xa7b3('0x1f')]['find']({'where':{'id':_0xaa5614[_0xa7b3('0x2a')]['id']}})[_0xa7b3('0x16')](handleEntityNotFound(_0x51d00e,null))[_0xa7b3('0x16')](saveUpdates(_0xaa5614[_0xa7b3('0x35')],null))[_0xa7b3('0x16')](respondWithResult(_0x51d00e,null))['catch'](handleError(_0x51d00e,null));};exports[_0xa7b3('0x17')]=function(_0x3ba84f,_0x8ca15){return db[_0xa7b3('0x1f')][_0xa7b3('0x33')]({'where':{'id':_0x3ba84f['params']['id']}})[_0xa7b3('0x16')](handleEntityNotFound(_0x8ca15,null))[_0xa7b3('0x16')](removeEntity(_0x8ca15,null))[_0xa7b3('0x28')](handleError(_0x8ca15,null));};exports[_0xa7b3('0x3e')]=function(_0x517a0c,_0x179e20){return db[_0xa7b3('0x1f')]['describe']()[_0xa7b3('0x16')](respondWithResult(_0x179e20,null))[_0xa7b3('0x28')](handleError(_0x179e20,null));};exports[_0xa7b3('0x3f')]=function(_0xea6550,_0x28b3a2){var _0x190801={'raw':!![],'where':{}},_0x5a0526={},_0x4eabf9;return db['WhatsappQueue']['findOne']({'where':{'id':_0xea6550[_0xa7b3('0x2a')]['id']}})[_0xa7b3('0x16')](handleEntityNotFound(_0x28b3a2,null))[_0xa7b3('0x16')](function(_0xc9d5a8){if(_0xc9d5a8){_0x4eabf9=_0xc9d5a8[_0xa7b3('0x18')]({'plain':!![]});_0x5a0526[_0xa7b3('0x2b')]=_[_0xa7b3('0x2c')](db[_0xa7b3('0x40')]['rawAttributes']);_0x5a0526[_0xa7b3('0x25')]=_[_0xa7b3('0x2c')](_0xea6550[_0xa7b3('0x25')]);_0x5a0526[_0xa7b3('0x41')]=_[_0xa7b3('0x2d')](_0x5a0526[_0xa7b3('0x2b')],_0x5a0526[_0xa7b3('0x25')]);_0x190801[_0xa7b3('0x2f')]=_[_0xa7b3('0x2d')](_0x5a0526[_0xa7b3('0x2b')],qs[_0xa7b3('0x2e')](_0xea6550['query'][_0xa7b3('0x2e')]));_0x190801['attributes']=_0x190801[_0xa7b3('0x2f')][_0xa7b3('0x30')]?_0x190801['attributes']:_0x5a0526['model'];if(!_0xea6550[_0xa7b3('0x25')][_0xa7b3('0x42')](_0xa7b3('0x43'))){_0x190801[_0xa7b3('0x11')]=qs[_0xa7b3('0x11')](_0xea6550['query'][_0xa7b3('0x11')]);_0x190801[_0xa7b3('0x13')]=qs['offset'](_0xea6550[_0xa7b3('0x25')][_0xa7b3('0x13')]);}_0x190801[_0xa7b3('0x44')]=qs[_0xa7b3('0x45')](_0xea6550[_0xa7b3('0x25')][_0xa7b3('0x45')]);_0x190801[_0xa7b3('0x46')]=qs['filters'](_[_0xa7b3('0x47')](_0xea6550[_0xa7b3('0x25')],_0x5a0526[_0xa7b3('0x41')]));_0x190801[_0xa7b3('0x46')][_0xa7b3('0x48')]=_0xc9d5a8['id'];if(_0xea6550['query'][_0xa7b3('0x49')]){_0x190801[_0xa7b3('0x46')]=_[_0xa7b3('0x32')](_0x190801['where'],{'$or':_[_0xa7b3('0x4a')](_0x190801[_0xa7b3('0x2f')],function(_0x26dfba){var _0x70474d={};_0x70474d[_0x26dfba]={'$like':'%'+_0xea6550['query']['filter']+'%'};return _0x70474d;})});}_0x190801=_[_0xa7b3('0x32')]({},_0x190801,_0xea6550[_0xa7b3('0x4b')]);return db['UserWhatsappQueue']['findAll'](_0x190801);}})['then'](function(_0x200bbc){if(_0x200bbc){return db['User'][_0xa7b3('0x4c')]({'where':{'id':_[_0xa7b3('0x4a')](_0x200bbc,_0xa7b3('0x4d')),'role':'agent'},'attributes':['id',_0xa7b3('0x1c'),_0xa7b3('0x4e'),'updatedAt',_0xa7b3('0x4f')]});}})[_0xa7b3('0x16')](function(_0xd2f0d7){if(_0xd2f0d7){return{'count':_0xd2f0d7['count'],'rows':_['map'](_0xd2f0d7['rows'],function(_0x15677b){return{'membername':_0x15677b['name'],'UserId':_0x15677b['id'],'queue_name':_0x4eabf9[_0xa7b3('0x1c')],'WhatsappQueueId':_0x4eabf9['id'],'interface':util[_0xa7b3('0x50')](_0xa7b3('0x51'),_0xa7b3('0x52'),_0x15677b[_0xa7b3('0x1c')]),'penalty':0x0,'paused':_0x15677b['whatsappPause'],'createdAt':_0x15677b[_0xa7b3('0x4f')],'updatedAt':_0x15677b[_0xa7b3('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa7b3('0x16')](respondWithFilteredResult(_0x28b3a2,_0x190801))[_0xa7b3('0x28')](handleError(_0x28b3a2,null));};exports[_0xa7b3('0x54')]=function(_0x348e4d,_0x3eaad0){var _0x58436b={};var _0x443891={};var _0x534e59;var _0x32c8e5;return db[_0xa7b3('0x1f')][_0xa7b3('0x55')]({'where':{'id':_0x348e4d[_0xa7b3('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3eaad0,null))['then'](function(_0x32ad45){if(_0x32ad45){_0x534e59=_0x32ad45;_0x443891['model']=_[_0xa7b3('0x2c')](db['Team'][_0xa7b3('0x20')]);_0x443891[_0xa7b3('0x25')]=_[_0xa7b3('0x2c')](_0x348e4d['query']);_0x443891[_0xa7b3('0x41')]=_[_0xa7b3('0x2d')](_0x443891[_0xa7b3('0x2b')],_0x443891[_0xa7b3('0x25')]);_0x58436b[_0xa7b3('0x2f')]=_['intersection'](_0x443891[_0xa7b3('0x2b')],qs['fields'](_0x348e4d['query']['fields']));_0x58436b[_0xa7b3('0x2f')]=_0x58436b['attributes']['length']?_0x58436b[_0xa7b3('0x2f')]:_0x443891['model'];_0x58436b[_0xa7b3('0x44')]=qs[_0xa7b3('0x45')](_0x348e4d[_0xa7b3('0x25')][_0xa7b3('0x45')]);_0x58436b[_0xa7b3('0x46')]=qs[_0xa7b3('0x41')](_[_0xa7b3('0x47')](_0x348e4d['query'],_0x443891[_0xa7b3('0x41')]));if(_0x348e4d[_0xa7b3('0x25')][_0xa7b3('0x49')]){_0x58436b[_0xa7b3('0x46')]=_['merge'](_0x58436b['where'],{'$or':_['map'](_0x58436b[_0xa7b3('0x2f')],function(_0x496718){var _0x4314b3={};_0x4314b3[_0x496718]={'$like':'%'+_0x348e4d[_0xa7b3('0x25')][_0xa7b3('0x49')]+'%'};return _0x4314b3;})});}_0x58436b=_[_0xa7b3('0x32')]({},_0x58436b,_0x348e4d[_0xa7b3('0x4b')]);return _0x534e59['getTeams'](_0x58436b);}})['then'](function(_0x5254c8){if(_0x5254c8){_0x32c8e5=_0x5254c8[_0xa7b3('0x30')];if(!_0x348e4d['query']['hasOwnProperty'](_0xa7b3('0x43'))){_0x58436b[_0xa7b3('0x11')]=qs[_0xa7b3('0x11')](_0x348e4d[_0xa7b3('0x25')][_0xa7b3('0x11')]);_0x58436b[_0xa7b3('0x13')]=qs[_0xa7b3('0x13')](_0x348e4d[_0xa7b3('0x25')]['offset']);}return _0x534e59[_0xa7b3('0x54')](_0x58436b);}})[_0xa7b3('0x16')](function(_0x4f5592){if(_0x4f5592){return _0x4f5592?{'count':_0x32c8e5,'rows':_0x4f5592}:null;}})['then'](respondWithResult(_0x3eaad0,null))[_0xa7b3('0x28')](handleError(_0x3eaad0,null));};exports['addTeams']=function(_0xb2706c,_0x96157e){var _0x2901c4=_0xb2706c[_0xa7b3('0x35')][_0xa7b3('0x56')];return db[_0xa7b3('0x57')][_0xa7b3('0x26')]({'where':{'id':_0x2901c4},'attributes':['id'],'include':[{'model':db[_0xa7b3('0x58')],'as':'Agents','attributes':['id',_0xa7b3('0x1c'),_0xa7b3('0x59'),_0xa7b3('0x5a'),_0xa7b3('0x5b')],'raw':!![]}]})['then'](function(_0x58c1bb){if(_0x58c1bb){var _0x3b0c71=_['flatMap'](_0x58c1bb,function(_0x39a529){var _0x52dcfc=_0x39a529[_0xa7b3('0x18')]({'plain':!![]});return _0x52dcfc[_0xa7b3('0x5c')];});return db['WhatsappQueue'][_0xa7b3('0x33')]({'where':{'id':_0xb2706c[_0xa7b3('0x2a')]['id']}})[_0xa7b3('0x16')](function(_0xc38b51){return db[_0xa7b3('0x5d')]['transaction'](function(_0x331b45){return _0xc38b51[_0xa7b3('0x5e')](_0x2901c4,{'transaction':_0x331b45})[_0xa7b3('0x16')](function(){return BPromise[_0xa7b3('0x5f')](_0x3b0c71,function(_0x373e23){return db[_0xa7b3('0x40')]['findOrCreate']({'where':{'UserId':_0x373e23['id'],'WhatsappQueueId':_0xb2706c[_0xa7b3('0x2a')]['id']},'transaction':_0x331b45});});})[_0xa7b3('0x16')](function(){_0x3b0c71['forEach'](function(_0x44992e){socket['emit'](_0xa7b3('0x60'),{'UserId':_0x44992e['id'],'WhatsappQueueId':_0xc38b51['id']});});});});});}})[_0xa7b3('0x16')](respondWithStatusCode(_0x96157e,null))[_0xa7b3('0x28')](handleError(_0x96157e,null));};exports[_0xa7b3('0x61')]=function(_0x576cc3,_0x290c95){return db[_0xa7b3('0x57')][_0xa7b3('0x26')]({'where':{'id':_0x576cc3[_0xa7b3('0x25')][_0xa7b3('0x56')]},'attributes':['id'],'include':[{'model':db[_0xa7b3('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x290c95,null))[_0xa7b3('0x16')](function(_0xf6fbb3){var _0x555011=_[_0xa7b3('0x4a')](_0xf6fbb3,'id');var _0xcd4aad=[];var _0x2c8f08=[];var _0xbc9eca=squel[_0xa7b3('0x62')]();_0xbc9eca[_0xa7b3('0x63')]('tq.TeamId')['from']('team_has_whatsapp_queues','tq')[_0xa7b3('0x64')](_0xa7b3('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa7b3('0x46')](_0xa7b3('0x66'),_0x576cc3[_0xa7b3('0x2a')]['id']);for(var _0x55e8df=0x0;_0x55e8df<_0xf6fbb3[_0xa7b3('0x30')];_0x55e8df+=0x1){let _0x87f471=_0xf6fbb3[_0x55e8df];for(var _0xa77c31=0x0;_0xa77c31<_0x87f471[_0xa7b3('0x5c')][_0xa7b3('0x30')];_0xa77c31+=0x1){let _0x3e63d8=_0x87f471['Agents'][_0xa77c31];var _0x354436=_0xbc9eca[_0xa7b3('0x67')]();_0x354436['where'](_0xa7b3('0x68'),_0x3e63d8['id']);_0x2c8f08[_0xa7b3('0x69')](db['sequelize'][_0xa7b3('0x25')](_0x354436[_0xa7b3('0x6a')](),{'type':db[_0xa7b3('0x5d')][_0xa7b3('0x6b')]['SELECT']})[_0xa7b3('0x16')](function(_0x98eea9){if(_0x98eea9[_0xa7b3('0x30')]===0x1){return _0x3e63d8['id'];}else{var _0x521ec6=_[_0xa7b3('0x6c')](_[_0xa7b3('0x4a')](_0x98eea9,_0xa7b3('0x6d')),function(_0x448e8e){return _[_0xa7b3('0x6e')](_0x555011,_0x448e8e);});if(_0x521ec6){return _0x3e63d8['id'];}}}));}}return BPromise['all'](_0x2c8f08)[_0xa7b3('0x16')](function(_0x2e0184){_0xcd4aad=_(_0xcd4aad)[_0xa7b3('0x6f')](_0x2e0184)[_0xa7b3('0x70')]()[_0xa7b3('0x71')]();return db[_0xa7b3('0x1f')][_0xa7b3('0x33')]({'where':{'id':_0x576cc3[_0xa7b3('0x2a')]['id']}})[_0xa7b3('0x16')](function(_0x4a4ae6){return db['sequelize'][_0xa7b3('0x72')](function(_0x5d4371){return _0x4a4ae6[_0xa7b3('0x61')](_0x576cc3[_0xa7b3('0x25')][_0xa7b3('0x56')],{'transaction':_0x5d4371})['then'](function(){if(!_['isEmpty'](_0xcd4aad)){return _0x4a4ae6[_0xa7b3('0x73')](_0xcd4aad,{'transaction':_0x5d4371});}})['then'](function(){_0xcd4aad[_0xa7b3('0x74')](function(_0x4d1ba5){socket['emit'](_0xa7b3('0x75'),{'UserId':_0x4d1ba5,'WhatsappQueueId':_0x4a4ae6['id']});});});});});});})[_0xa7b3('0x16')](respondWithStatusCode(_0x290c95,null))[_0xa7b3('0x28')](handleError(_0x290c95,null));};exports[_0xa7b3('0x76')]=function(_0x25119c,_0xecba3){return db[_0xa7b3('0x1f')][_0xa7b3('0x33')]({'where':{'id':_0x25119c[_0xa7b3('0x2a')]['id']}})['then'](handleEntityNotFound(_0xecba3,null))[_0xa7b3('0x16')](function(_0x1e6685){if(_0x1e6685){return _0x1e6685[_0xa7b3('0x76')](_0x25119c[_0xa7b3('0x35')][_0xa7b3('0x56')],_[_0xa7b3('0x77')](_0x25119c[_0xa7b3('0x35')],['ids','id'])||{})['spread'](function(_0xccc7b3){for(var _0x1c875a=0x0;_0x1c875a<_0x25119c[_0xa7b3('0x35')][_0xa7b3('0x56')][_0xa7b3('0x30')];_0x1c875a+=0x1){socket[_0xa7b3('0x78')](_0xa7b3('0x60'),{'UserId':Number(_0x25119c[_0xa7b3('0x35')][_0xa7b3('0x56')][_0x1c875a]),'WhatsappQueueId':Number(_0x25119c['params']['id'])});}return _0xccc7b3;});}})['then'](respondWithResult(_0xecba3,null))[_0xa7b3('0x28')](handleError(_0xecba3,null));};exports['removeAgents']=function(_0x8c3379,_0x31b7e5){return db['WhatsappQueue']['find']({'where':{'id':_0x8c3379['params']['id']}})[_0xa7b3('0x16')](handleEntityNotFound(_0x31b7e5,null))[_0xa7b3('0x16')](function(_0x123fc0){if(_0x123fc0){return _0x123fc0['removeAgents'](_0x8c3379[_0xa7b3('0x25')][_0xa7b3('0x56')])['then'](function(){if(_[_0xa7b3('0x79')](_0x8c3379['query'][_0xa7b3('0x56')])){for(var _0x3454f3=0x0;_0x3454f3<_0x8c3379['query']['ids']['length'];_0x3454f3+=0x1){socket[_0xa7b3('0x78')](_0xa7b3('0x75'),{'UserId':Number(_0x8c3379['query'][_0xa7b3('0x56')][_0x3454f3]),'WhatsappQueueId':Number(_0x8c3379[_0xa7b3('0x2a')]['id'])});}}else{socket[_0xa7b3('0x78')](_0xa7b3('0x75'),{'UserId':Number(_0x8c3379[_0xa7b3('0x25')][_0xa7b3('0x56')]),'WhatsappQueueId':Number(_0x8c3379[_0xa7b3('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x31b7e5,null))[_0xa7b3('0x28')](handleError(_0x31b7e5,null));};exports[_0xa7b3('0x7a')]=function(_0x3c1fee,_0x504cfd){var _0x31f9fa={};var _0x3201ec={};var _0x1a75fc;var _0x229dae;return db[_0xa7b3('0x1f')]['findOne']({'where':{'id':_0x3c1fee[_0xa7b3('0x2a')]['id']}})[_0xa7b3('0x16')](handleEntityNotFound(_0x504cfd,null))[_0xa7b3('0x16')](function(_0x20a50a){if(_0x20a50a){_0x1a75fc=_0x20a50a;_0x3201ec[_0xa7b3('0x2b')]=_[_0xa7b3('0x2c')](db[_0xa7b3('0x58')][_0xa7b3('0x20')]);_0x3201ec[_0xa7b3('0x25')]=_['keys'](_0x3c1fee[_0xa7b3('0x25')]);_0x3201ec[_0xa7b3('0x41')]=_[_0xa7b3('0x2d')](_0x3201ec[_0xa7b3('0x2b')],_0x3201ec[_0xa7b3('0x25')]);_0x31f9fa[_0xa7b3('0x2f')]=_['intersection'](_0x3201ec['model'],qs[_0xa7b3('0x2e')](_0x3c1fee[_0xa7b3('0x25')]['fields']));_0x31f9fa[_0xa7b3('0x2f')]=_0x31f9fa[_0xa7b3('0x2f')][_0xa7b3('0x30')]?_0x31f9fa[_0xa7b3('0x2f')]:_0x3201ec[_0xa7b3('0x2b')];_0x31f9fa[_0xa7b3('0x44')]=qs[_0xa7b3('0x45')](_0x3c1fee['query']['sort']);_0x31f9fa[_0xa7b3('0x46')]=qs[_0xa7b3('0x41')](_[_0xa7b3('0x47')](_0x3c1fee[_0xa7b3('0x25')],_0x3201ec[_0xa7b3('0x41')]));if(_0x3c1fee[_0xa7b3('0x25')][_0xa7b3('0x49')]){_0x31f9fa[_0xa7b3('0x46')]=_[_0xa7b3('0x32')](_0x31f9fa[_0xa7b3('0x46')],{'$or':_[_0xa7b3('0x4a')](_0x31f9fa['attributes'],function(_0x4fe836){var _0x4088ff={};_0x4088ff[_0x4fe836]={'$like':'%'+_0x3c1fee[_0xa7b3('0x25')][_0xa7b3('0x49')]+'%'};return _0x4088ff;})});}_0x31f9fa=_['merge']({},_0x31f9fa,_0x3c1fee[_0xa7b3('0x4b')]);return _0x1a75fc[_0xa7b3('0x7a')](_0x31f9fa);}})[_0xa7b3('0x16')](function(_0x4a19f9){if(_0x4a19f9){_0x229dae=_0x4a19f9['length'];if(!_0x3c1fee['query'][_0xa7b3('0x42')](_0xa7b3('0x43'))){_0x31f9fa['limit']=qs[_0xa7b3('0x11')](_0x3c1fee[_0xa7b3('0x25')][_0xa7b3('0x11')]);_0x31f9fa['offset']=qs['offset'](_0x3c1fee['query'][_0xa7b3('0x13')]);}return _0x1a75fc[_0xa7b3('0x7a')](_0x31f9fa);}})[_0xa7b3('0x16')](function(_0x3f9cb){if(_0x3f9cb){return _0x3f9cb?{'count':_0x229dae,'rows':_0x3f9cb}:null;}})[_0xa7b3('0x16')](respondWithResult(_0x504cfd,null))[_0xa7b3('0x28')](handleError(_0x504cfd,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index c60dfcf..c4d9be2 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 _0x9d59=['../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x219fee,_0x3520a8){var _0x282a6b=function(_0x46f6c9){while(--_0x46f6c9){_0x219fee['push'](_0x219fee['shift']());}};_0x282a6b(++_0x3520a8);}(_0x9d59,0x199));var _0x99d5=function(_0x444b10,_0x49185d){_0x444b10=_0x444b10-0x0;var _0x35f280=_0x9d59[_0x444b10];return _0x35f280;};'use strict';var EventEmitter=require(_0x99d5('0x0'));var WhatsappQueue=require(_0x99d5('0x1'))['db'][_0x99d5('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x99d5('0x3')](0x0);var events={'afterCreate':_0x99d5('0x4'),'afterUpdate':_0x99d5('0x5'),'afterDestroy':_0x99d5('0x6')};function emitEvent(_0x50b7a2){return function(_0x4a78f1,_0x15bebd,_0x1dc42a){WhatsappQueueEvents[_0x99d5('0x7')](_0x50b7a2+':'+_0x4a78f1['id'],_0x4a78f1);WhatsappQueueEvents[_0x99d5('0x7')](_0x50b7a2,_0x4a78f1);_0x1dc42a(null);};}for(var e in events){if(events[_0x99d5('0x8')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x99d5('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0xf7fe=['hook','exports','events','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x30671f,_0x57b7d6){var _0x4c0643=function(_0x41f3a0){while(--_0x41f3a0){_0x30671f['push'](_0x30671f['shift']());}};_0x4c0643(++_0x57b7d6);}(_0xf7fe,0xa2));var _0xef7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf7fe[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xef7f('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xef7f('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xef7f('0x2')](0x0);var events={'afterCreate':_0xef7f('0x3'),'afterUpdate':_0xef7f('0x4'),'afterDestroy':_0xef7f('0x5')};function emitEvent(_0xc59fe9){return function(_0x2b0674,_0x27c23e,_0x2b41a3){WhatsappQueueEvents[_0xef7f('0x6')](_0xc59fe9+':'+_0x2b0674['id'],_0x2b0674);WhatsappQueueEvents['emit'](_0xc59fe9,_0x2b0674);_0x2b41a3(null);};}for(var e in events){if(events[_0xef7f('0x7')](e)){var event=events[e];WhatsappQueue[_0xef7f('0x8')](e,emitEvent(event));}}module[_0xef7f('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index d028dd4..b01022f 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 _0x5e1c=['whatsapp_queues','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappQueue'];(function(_0x1df117,_0x213d70){var _0xb6135e=function(_0x5c000a){while(--_0x5c000a){_0x1df117['push'](_0x1df117['shift']());}};_0xb6135e(++_0x213d70);}(_0x5e1c,0x1e5));var _0xc5e1=function(_0x1e32a7,_0x24494c){_0x1e32a7=_0x1e32a7-0x0;var _0x24583d=_0x5e1c[_0x1e32a7];return _0x24583d;};'use strict';var _=require('lodash');var util=require(_0xc5e1('0x0'));var logger=require('../../config/logger')(_0xc5e1('0x1'));var moment=require(_0xc5e1('0x2'));var BPromise=require(_0xc5e1('0x3'));var rp=require(_0xc5e1('0x4'));var fs=require('fs');var path=require(_0xc5e1('0x5'));var rimraf=require(_0xc5e1('0x6'));var config=require(_0xc5e1('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0xc5e1('0x8')]=function(_0x1fa6d5,_0x1dc64b){return _0x1fa6d5['define'](_0xc5e1('0x9'),attributes,{'tableName':_0xc5e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72be=['lodash','api','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes'];(function(_0x51623d,_0x56d219){var _0x36a248=function(_0x1eb6ec){while(--_0x1eb6ec){_0x51623d['push'](_0x51623d['shift']());}};_0x36a248(++_0x56d219);}(_0x72be,0xd2));var _0xe72b=function(_0x3d21b7,_0x572d45){_0x3d21b7=_0x3d21b7-0x0;var _0x5fb14a=_0x72be[_0x3d21b7];return _0x5fb14a;};'use strict';var _=require(_0xe72b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe72b('0x1'));var moment=require('moment');var BPromise=require(_0xe72b('0x2'));var rp=require(_0xe72b('0x3'));var fs=require('fs');var path=require(_0xe72b('0x4'));var rimraf=require(_0xe72b('0x5'));var config=require('../../config/environment');var attributes=require(_0xe72b('0x6'));module['exports']=function(_0x1fda87,_0x2c1e33){return _0x1fda87['define']('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index c745800..e012aa9 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 _0x2358=['code','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','then','stringify','ShowWhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x1ee4d0,_0x3abf3c){var _0x442b77=function(_0x53c2d4){while(--_0x53c2d4){_0x1ee4d0['push'](_0x1ee4d0['shift']());}};_0x442b77(++_0x3abf3c);}(_0x2358,0x12b));var _0x8235=function(_0x2765e7,_0x11e5cf){_0x2765e7=_0x2765e7-0x0;var _0x331d93=_0x2358[_0x2765e7];return _0x331d93;};'use strict';var _=require(_0x8235('0x0'));var util=require(_0x8235('0x1'));var moment=require(_0x8235('0x2'));var BPromise=require(_0x8235('0x3'));var rs=require(_0x8235('0x4'));var fs=require('fs');var Redis=require(_0x8235('0x5'));var db=require(_0x8235('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8235('0x7'));var config=require(_0x8235('0x8'));var jayson=require(_0x8235('0x9'));var client=jayson[_0x8235('0xa')][_0x8235('0xb')]({'port':0x232a});config[_0x8235('0xc')]=_['defaults'](config[_0x8235('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8235('0xd'))(new Redis(config[_0x8235('0xc')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5009a7,_0x20e5d6,_0x1abd19){return new BPromise(function(_0x5a8621,_0x388384){return client[_0x8235('0xe')](_0x5009a7,_0x1abd19)['then'](function(_0x151693){logger[_0x8235('0xf')](_0x8235('0x10'),_0x20e5d6,_0x8235('0x11'));logger[_0x8235('0x12')](_0x8235('0x13'),_0x20e5d6,_0x8235('0x11'),JSON['stringify'](_0x151693));if(_0x151693['error']){if(_0x151693[_0x8235('0x14')][_0x8235('0x15')]===0x1f4){logger[_0x8235('0x14')](_0x8235('0x10'),_0x20e5d6,_0x151693[_0x8235('0x14')]['message']);return _0x388384(_0x151693[_0x8235('0x14')][_0x8235('0x16')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x20e5d6,_0x151693[_0x8235('0x14')]['message']);return _0x5a8621(_0x151693[_0x8235('0x14')][_0x8235('0x16')]);}else{logger[_0x8235('0xf')](_0x8235('0x10'),_0x20e5d6,_0x8235('0x11'));_0x5a8621(_0x151693[_0x8235('0x17')]['message']);}})[_0x8235('0x18')](function(_0x445bfd){logger[_0x8235('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x20e5d6,_0x445bfd);_0x388384(_0x445bfd);});});}exports[_0x8235('0x19')]=function(_0x110dce){var _0x41d454=this;return new Promise(function(_0x329b87,_0xcd79ea){return db[_0x8235('0x1a')][_0x8235('0x1b')]({'raw':_0x110dce[_0x8235('0x1c')]?_0x110dce[_0x8235('0x1c')][_0x8235('0x1d')]===undefined?!![]:![]:!![],'where':_0x110dce[_0x8235('0x1c')]?_0x110dce[_0x8235('0x1c')]['where']||null:null,'attributes':_0x110dce[_0x8235('0x1c')]?_0x110dce[_0x8235('0x1c')][_0x8235('0x1e')]||null:null,'limit':_0x110dce[_0x8235('0x1c')]?_0x110dce['options'][_0x8235('0x1f')]||null:null,'include':_0x110dce[_0x8235('0x1c')]?_0x110dce[_0x8235('0x1c')][_0x8235('0x20')]?_[_0x8235('0x21')](_0x110dce['options'][_0x8235('0x20')],function(_0x767ff5){return{'model':db[_0x767ff5['model']],'as':_0x767ff5['as'],'attributes':_0x767ff5[_0x8235('0x1e')],'include':_0x767ff5['include']?_['map'](_0x767ff5[_0x8235('0x20')],function(_0x4a055e){return{'model':db[_0x4a055e[_0x8235('0x22')]],'as':_0x4a055e['as'],'attributes':_0x4a055e['attributes'],'include':_0x4a055e[_0x8235('0x20')]?_[_0x8235('0x21')](_0x4a055e[_0x8235('0x20')],function(_0xa59c38){return{'model':db[_0xa59c38[_0x8235('0x22')]],'as':_0xa59c38['as'],'attributes':_0xa59c38[_0x8235('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8235('0x23')](function(_0x5c3048){logger['info'](_0x8235('0x19'),_0x110dce);logger[_0x8235('0x12')](_0x8235('0x19'),_0x110dce,JSON[_0x8235('0x24')](_0x5c3048));_0x329b87(_0x5c3048);})[_0x8235('0x18')](function(_0x2d2309){logger[_0x8235('0x14')]('GetWhatsappQueue',_0x2d2309[_0x8235('0x16')],_0x110dce);_0xcd79ea(_0x41d454[_0x8235('0x14')](0x1f4,_0x2d2309[_0x8235('0x16')]));});});};exports[_0x8235('0x25')]=function(_0x5843f1){var _0x37c7d6=this;return new Promise(function(_0x1f0196,_0x14e85a){return db['WhatsappQueue'][_0x8235('0x26')]({'raw':_0x5843f1[_0x8235('0x1c')]?_0x5843f1['options'][_0x8235('0x1d')]===undefined?!![]:![]:!![],'where':_0x5843f1[_0x8235('0x1c')]?_0x5843f1[_0x8235('0x1c')][_0x8235('0x27')]||null:null,'attributes':_0x5843f1[_0x8235('0x1c')]?_0x5843f1[_0x8235('0x1c')][_0x8235('0x1e')]||null:null,'include':_0x5843f1[_0x8235('0x1c')]?_0x5843f1[_0x8235('0x1c')]['include']?_[_0x8235('0x21')](_0x5843f1[_0x8235('0x1c')][_0x8235('0x20')],function(_0x2da2d3){return{'model':db[_0x2da2d3[_0x8235('0x22')]],'as':_0x2da2d3['as'],'attributes':_0x2da2d3['attributes'],'include':_0x2da2d3[_0x8235('0x20')]?_[_0x8235('0x21')](_0x2da2d3['include'],function(_0x491e36){return{'model':db[_0x491e36['model']],'as':_0x491e36['as'],'attributes':_0x491e36[_0x8235('0x1e')],'include':_0x491e36['include']?_[_0x8235('0x21')](_0x491e36['include'],function(_0x5154d3){return{'model':db[_0x5154d3['model']],'as':_0x5154d3['as'],'attributes':_0x5154d3[_0x8235('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56263f){logger[_0x8235('0xf')](_0x8235('0x25'),_0x5843f1);logger[_0x8235('0x12')]('ShowWhatsappQueue',_0x5843f1,JSON[_0x8235('0x24')](_0x56263f));_0x1f0196(_0x56263f);})['catch'](function(_0x462188){logger[_0x8235('0x14')]('ShowWhatsappQueue',_0x462188['message'],_0x5843f1);_0x14e85a(_0x37c7d6['error'](0x1f4,_0x462188[_0x8235('0x16')]));});});}; \ No newline at end of file +var _0x014a=['client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetWhatsappQueue','find','ShowWhatsappQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x157064,_0x2b3e35){var _0x595813=function(_0x3cc43c){while(--_0x3cc43c){_0x157064['push'](_0x157064['shift']());}};_0x595813(++_0x2b3e35);}(_0x014a,0x1a4));var _0xa014=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x014a[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var util=require(_0xa014('0x0'));var moment=require(_0xa014('0x1'));var BPromise=require(_0xa014('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa014('0x3'));var db=require(_0xa014('0x4'))['db'];var utils=require(_0xa014('0x5'));var logger=require(_0xa014('0x6'))(_0xa014('0x7'));var config=require(_0xa014('0x8'));var jayson=require(_0xa014('0x9'));var client=jayson[_0xa014('0xa')][_0xa014('0xb')]({'port':0x232a});config[_0xa014('0xc')]=_[_0xa014('0xd')](config['redis'],{'host':_0xa014('0xe'),'port':0x18eb});var socket=require(_0xa014('0xf'))(new Redis(config[_0xa014('0xc')]));require(_0xa014('0x10'))[_0xa014('0x11')](socket);function respondWithRpcPromise(_0x24fea3,_0xb6f747,_0x5dafcb){return new BPromise(function(_0x34aa58,_0x4be8af){return client[_0xa014('0x12')](_0x24fea3,_0x5dafcb)[_0xa014('0x13')](function(_0x17fa4c){logger['info'](_0xa014('0x14'),_0xb6f747,'request\x20sent');logger['debug'](_0xa014('0x15'),_0xb6f747,'request\x20sent',JSON[_0xa014('0x16')](_0x17fa4c));if(_0x17fa4c[_0xa014('0x17')]){if(_0x17fa4c[_0xa014('0x17')][_0xa014('0x18')]===0x1f4){logger[_0xa014('0x17')](_0xa014('0x14'),_0xb6f747,_0x17fa4c[_0xa014('0x17')][_0xa014('0x19')]);return _0x4be8af(_0x17fa4c[_0xa014('0x17')]['message']);}logger[_0xa014('0x17')](_0xa014('0x14'),_0xb6f747,_0x17fa4c[_0xa014('0x17')][_0xa014('0x19')]);return _0x34aa58(_0x17fa4c[_0xa014('0x17')][_0xa014('0x19')]);}else{logger[_0xa014('0x1a')]('WhatsappQueue,\x20%s,\x20%s',_0xb6f747,_0xa014('0x1b'));_0x34aa58(_0x17fa4c[_0xa014('0x1c')][_0xa014('0x19')]);}})[_0xa014('0x1d')](function(_0x3c261b){logger[_0xa014('0x17')](_0xa014('0x14'),_0xb6f747,_0x3c261b);_0x4be8af(_0x3c261b);});});}exports['GetWhatsappQueue']=function(_0x267e11){var _0x4ac5e0=this;return new Promise(function(_0x99a71b,_0x445924){return db[_0xa014('0x1e')][_0xa014('0x1f')]({'raw':_0x267e11[_0xa014('0x20')]?_0x267e11[_0xa014('0x20')][_0xa014('0x21')]===undefined?!![]:![]:!![],'where':_0x267e11['options']?_0x267e11[_0xa014('0x20')][_0xa014('0x22')]||null:null,'attributes':_0x267e11['options']?_0x267e11[_0xa014('0x20')][_0xa014('0x23')]||null:null,'limit':_0x267e11[_0xa014('0x20')]?_0x267e11[_0xa014('0x20')][_0xa014('0x24')]||null:null,'include':_0x267e11['options']?_0x267e11[_0xa014('0x20')][_0xa014('0x25')]?_[_0xa014('0x26')](_0x267e11[_0xa014('0x20')][_0xa014('0x25')],function(_0x4ef02c){return{'model':db[_0x4ef02c[_0xa014('0x27')]],'as':_0x4ef02c['as'],'attributes':_0x4ef02c[_0xa014('0x23')],'include':_0x4ef02c[_0xa014('0x25')]?_[_0xa014('0x26')](_0x4ef02c[_0xa014('0x25')],function(_0x4dc7cb){return{'model':db[_0x4dc7cb[_0xa014('0x27')]],'as':_0x4dc7cb['as'],'attributes':_0x4dc7cb[_0xa014('0x23')],'include':_0x4dc7cb[_0xa014('0x25')]?_[_0xa014('0x26')](_0x4dc7cb['include'],function(_0x330975){return{'model':db[_0x330975[_0xa014('0x27')]],'as':_0x330975['as'],'attributes':_0x330975[_0xa014('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa014('0x13')](function(_0xa23c96){logger[_0xa014('0x1a')]('GetWhatsappQueue',_0x267e11);logger['debug'](_0xa014('0x28'),_0x267e11,JSON['stringify'](_0xa23c96));_0x99a71b(_0xa23c96);})['catch'](function(_0x4cbe94){logger[_0xa014('0x17')](_0xa014('0x28'),_0x4cbe94[_0xa014('0x19')],_0x267e11);_0x445924(_0x4ac5e0['error'](0x1f4,_0x4cbe94['message']));});});};exports['ShowWhatsappQueue']=function(_0x308993){var _0x466a30=this;return new Promise(function(_0xb87adc,_0x5c5b44){return db['WhatsappQueue'][_0xa014('0x29')]({'raw':_0x308993['options']?_0x308993[_0xa014('0x20')][_0xa014('0x21')]===undefined?!![]:![]:!![],'where':_0x308993[_0xa014('0x20')]?_0x308993[_0xa014('0x20')]['where']||null:null,'attributes':_0x308993[_0xa014('0x20')]?_0x308993['options']['attributes']||null:null,'include':_0x308993[_0xa014('0x20')]?_0x308993[_0xa014('0x20')][_0xa014('0x25')]?_[_0xa014('0x26')](_0x308993[_0xa014('0x20')][_0xa014('0x25')],function(_0x45b6fb){return{'model':db[_0x45b6fb[_0xa014('0x27')]],'as':_0x45b6fb['as'],'attributes':_0x45b6fb[_0xa014('0x23')],'include':_0x45b6fb[_0xa014('0x25')]?_['map'](_0x45b6fb['include'],function(_0x52ffe6){return{'model':db[_0x52ffe6[_0xa014('0x27')]],'as':_0x52ffe6['as'],'attributes':_0x52ffe6[_0xa014('0x23')],'include':_0x52ffe6['include']?_['map'](_0x52ffe6[_0xa014('0x25')],function(_0xe3901e){return{'model':db[_0xe3901e[_0xa014('0x27')]],'as':_0xe3901e['as'],'attributes':_0xe3901e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f7ede){logger['info'](_0xa014('0x2a'),_0x308993);logger['debug'](_0xa014('0x2a'),_0x308993,JSON['stringify'](_0x3f7ede));_0xb87adc(_0x3f7ede);})[_0xa014('0x1d')](function(_0x59580d){logger[_0xa014('0x17')](_0xa014('0x2a'),_0x59580d[_0xa014('0x19')],_0x308993);_0x5c5b44(_0x466a30[_0xa014('0x17')](0x1f4,_0x59580d[_0xa014('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 41ab8d6..b95b8e4 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 _0xe81a=['register','length','whatsappQueue:','./whatsappQueue.events','remove','update','emit','removeListener'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xe81a,0x103));var _0xae81=function(_0x69188b,_0x550923){_0x69188b=_0x69188b-0x0;var _0x3320f4=_0xe81a[_0x69188b];return _0x3320f4;};'use strict';var WhatsappQueueEvents=require(_0xae81('0x0'));var events=['save',_0xae81('0x1'),_0xae81('0x2')];function createListener(_0xac2dbc,_0x128606){return function(_0x2c7d62){_0x128606[_0xae81('0x3')](_0xac2dbc,_0x2c7d62);};}function removeListener(_0x1a04fc,_0x3cf3a9){return function(){WhatsappQueueEvents[_0xae81('0x4')](_0x1a04fc,_0x3cf3a9);};}exports[_0xae81('0x5')]=function(_0x3331f1){for(var _0x286c44=0x0,_0x3faadf=events[_0xae81('0x6')];_0x286c44<_0x3faadf;_0x286c44++){var _0x701a9=events[_0x286c44];var _0x5a4572=createListener(_0xae81('0x7')+_0x701a9,_0x3331f1);WhatsappQueueEvents['on'](_0x701a9,_0x5a4572);}}; \ No newline at end of file +var _0xe81f=['register','./whatsappQueue.events','remove','update','removeListener'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xe81f,0xd8));var _0xfe81=function(_0x47da64,_0x34a4ba){_0x47da64=_0x47da64-0x0;var _0x154bd3=_0xe81f[_0x47da64];return _0x154bd3;};'use strict';var WhatsappQueueEvents=require(_0xfe81('0x0'));var events=['save',_0xfe81('0x1'),_0xfe81('0x2')];function createListener(_0x22508e,_0x19ba45){return function(_0x36a39f){_0x19ba45['emit'](_0x22508e,_0x36a39f);};}function removeListener(_0x540a55,_0x3ed140){return function(){WhatsappQueueEvents[_0xfe81('0x3')](_0x540a55,_0x3ed140);};}exports[_0xfe81('0x4')]=function(_0xf3540){for(var _0x54db90=0x0,_0x552c5b=events['length'];_0x54db90<_0x552c5b;_0x54db90++){var _0x5109eb=events[_0x54db90];var _0x2e66d4=createListener('whatsappQueue:'+_0x5109eb,_0xf3540);WhatsappQueueEvents['on'](_0x5109eb,_0x2e66d4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 5d9fd0f..e8636cb 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 _0x8a31=['update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x5cf0fa,_0xaca1af){var _0x5450d9=function(_0x2c1004){while(--_0x2c1004){_0x5cf0fa['push'](_0x5cf0fa['shift']());}};_0x5450d9(++_0xaca1af);}(_0x8a31,0x121));var _0x18a3=function(_0x483ab9,_0x419148){_0x483ab9=_0x483ab9-0x0;var _0x35043b=_0x8a31[_0x483ab9];return _0x35043b;};'use strict';var multer=require(_0x18a3('0x0'));var util=require(_0x18a3('0x1'));var path=require('path');var timeout=require(_0x18a3('0x2'));var express=require(_0x18a3('0x3'));var router=express[_0x18a3('0x4')]();var fs_extra=require(_0x18a3('0x5'));var auth=require(_0x18a3('0x6'));var interaction=require(_0x18a3('0x7'));var config=require(_0x18a3('0x8'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x18a3('0x9')](),controller[_0x18a3('0xa')]);router[_0x18a3('0xb')](_0x18a3('0xc'),auth['isAuthenticated'](),controller[_0x18a3('0xd')]);router[_0x18a3('0xb')](_0x18a3('0xe'),auth[_0x18a3('0x9')](),controller[_0x18a3('0xf')]);router[_0x18a3('0x10')]('/',auth[_0x18a3('0x9')](),controller[_0x18a3('0x11')]);router[_0x18a3('0x12')]('/:id',auth[_0x18a3('0x9')](),controller[_0x18a3('0x13')]);router[_0x18a3('0x14')]('/:id',auth[_0x18a3('0x9')](),controller['destroy']);module[_0x18a3('0x15')]=router; \ No newline at end of file +var _0x2ec8=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','/:id','delete','exports','multer','path'];(function(_0x23a6e5,_0x3452b2){var _0x4db85d=function(_0x1fcf99){while(--_0x1fcf99){_0x23a6e5['push'](_0x23a6e5['shift']());}};_0x4db85d(++_0x3452b2);}(_0x2ec8,0xfd));var _0x82ec=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x2ec8[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x82ec('0x0'));var util=require('util');var path=require(_0x82ec('0x1'));var timeout=require(_0x82ec('0x2'));var express=require(_0x82ec('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x82ec('0x4'));var interaction=require(_0x82ec('0x5'));var config=require(_0x82ec('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0x82ec('0x7')]('/',auth['isAuthenticated'](),controller[_0x82ec('0x8')]);router[_0x82ec('0x7')]('/describe',auth[_0x82ec('0x9')](),controller['describe']);router[_0x82ec('0x7')]('/:id',auth[_0x82ec('0x9')](),controller[_0x82ec('0xa')]);router[_0x82ec('0xb')]('/',auth[_0x82ec('0x9')](),controller[_0x82ec('0xc')]);router[_0x82ec('0xd')](_0x82ec('0xe'),auth[_0x82ec('0x9')](),controller['update']);router[_0x82ec('0xf')](_0x82ec('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x82ec('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 5b29fd3..9c94645 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x7c7eb2,_0x5e96c9){var _0x4877b6=function(_0x594a86){while(--_0x594a86){_0x7c7eb2['push'](_0x7c7eb2['shift']());}};_0x4877b6(++_0x5e96c9);}(_0x7a54,0x106));var _0x47a5=function(_0x2bb563,_0x5df632){_0x2bb563=_0x2bb563-0x0;var _0x4ad952=_0x7a54[_0x2bb563];return _0x4ad952;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x2281d5,_0x1196df){var _0x451a93=function(_0xe17c7e){while(--_0xe17c7e){_0x2281d5['push'](_0x2281d5['shift']());}};_0x451a93(++_0x1196df);}(_0x7a54,0x106));var _0x47a5=function(_0x4e263d,_0x6a8360){_0x4e263d=_0x4e263d-0x0;var _0x404b02=_0x7a54[_0x4e263d];return _0x404b02;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index b231c1e..b9b5a6a 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 _0xcf66=['json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','WhatsappQueueReport','catch','show','params','rawAttributes','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end'];(function(_0x367405,_0x19ac0e){var _0x3de038=function(_0x24e22a){while(--_0x24e22a){_0x367405['push'](_0x367405['shift']());}};_0x3de038(++_0x19ac0e);}(_0xcf66,0x71));var _0x6cf6=function(_0x47ff9e,_0x5c944a){_0x47ff9e=_0x47ff9e-0x0;var _0xd6c882=_0xcf66[_0x47ff9e];return _0xd6c882;};'use strict';var emlformat=require(_0x6cf6('0x0'));var rimraf=require(_0x6cf6('0x1'));var zipdir=require(_0x6cf6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cf6('0x3'));var moment=require(_0x6cf6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cf6('0x5'));var path=require(_0x6cf6('0x6'));var sox=require('sox');var csv=require(_0x6cf6('0x7'));var ejs=require(_0x6cf6('0x8'));var fs=require('fs');var fs_extra=require(_0x6cf6('0x9'));var _=require('lodash');var squel=require(_0x6cf6('0xa'));var crypto=require(_0x6cf6('0xb'));var jsforce=require(_0x6cf6('0xc'));var deskjs=require(_0x6cf6('0xd'));var toCsv=require(_0x6cf6('0x7'));var querystring=require(_0x6cf6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cf6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cf6('0x10'));var logger=require(_0x6cf6('0x11'))(_0x6cf6('0x12'));var utils=require(_0x6cf6('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fdfea,_0x13b1ad){_0x13b1ad=_0x13b1ad||0xcc;return function(_0x372d12){if(_0x372d12){return _0x3fdfea[_0x6cf6('0x14')](_0x13b1ad);}return _0x3fdfea[_0x6cf6('0x15')](_0x13b1ad)[_0x6cf6('0x16')]();};}function respondWithResult(_0x57909f,_0x32fe64){_0x32fe64=_0x32fe64||0xc8;return function(_0x494ece){if(_0x494ece){return _0x57909f[_0x6cf6('0x15')](_0x32fe64)[_0x6cf6('0x17')](_0x494ece);}};}function respondWithFilteredResult(_0x4b073f,_0x40e413){return function(_0x1b40f8){if(_0x1b40f8){var _0x2d23ab=typeof _0x40e413[_0x6cf6('0x18')]===_0x6cf6('0x19')&&typeof _0x40e413[_0x6cf6('0x1a')]===_0x6cf6('0x19');var _0x39ec25=_0x1b40f8[_0x6cf6('0x1b')];var _0x2ca2b1=_0x2d23ab?0x0:_0x40e413['offset'];var _0x11d994=_0x2d23ab?_0x1b40f8[_0x6cf6('0x1b')]:_0x40e413[_0x6cf6('0x18')]+_0x40e413['limit'];var _0x18abd9;if(_0x11d994>=_0x39ec25){_0x11d994=_0x39ec25;_0x18abd9=0xc8;}else{_0x18abd9=0xce;}_0x4b073f[_0x6cf6('0x15')](_0x18abd9);return _0x4b073f[_0x6cf6('0x1c')](_0x6cf6('0x1d'),_0x2ca2b1+'-'+_0x11d994+'/'+_0x39ec25)[_0x6cf6('0x17')](_0x1b40f8);}return null;};}function patchUpdates(_0x21e903){return function(_0x123993){try{jsonpatch['apply'](_0x123993,_0x21e903,!![]);}catch(_0x19f2cd){return BPromise[_0x6cf6('0x1e')](_0x19f2cd);}return _0x123993[_0x6cf6('0x1f')]();};}function saveUpdates(_0x380a40,_0x5cba3a){return function(_0x470ea4){if(_0x470ea4){return _0x470ea4[_0x6cf6('0x20')](_0x380a40)[_0x6cf6('0x21')](function(_0x5b2767){return _0x5b2767;});}return null;};}function removeEntity(_0x5b30e0,_0x276225){return function(_0x59f838){if(_0x59f838){return _0x59f838[_0x6cf6('0x22')]()[_0x6cf6('0x21')](function(){_0x5b30e0[_0x6cf6('0x15')](0xcc)[_0x6cf6('0x16')]();});}};}function handleEntityNotFound(_0x3f9871,_0x565fad){return function(_0x1c966e){if(!_0x1c966e){_0x3f9871['sendStatus'](0x194);}return _0x1c966e;};}function handleError(_0x2779b7,_0xc7b489){_0xc7b489=_0xc7b489||0x1f4;return function(_0x3eaa31){logger['error'](_0x3eaa31[_0x6cf6('0x23')]);if(_0x3eaa31[_0x6cf6('0x24')]){delete _0x3eaa31[_0x6cf6('0x24')];}_0x2779b7[_0x6cf6('0x15')](_0xc7b489)['send'](_0x3eaa31);};}exports['index']=function(_0x2afe84,_0x4521af){var _0x57099f={},_0x5869e9={},_0x5ccc8f={'count':0x0,'rows':[]};var _0x2afc06=_['map'](db['WhatsappQueueReport']['rawAttributes'],function(_0x10bde5){return{'name':_0x10bde5[_0x6cf6('0x25')],'type':_0x10bde5[_0x6cf6('0x26')][_0x6cf6('0x27')]};});_0x5869e9[_0x6cf6('0x28')]=_['map'](_0x2afc06,_0x6cf6('0x24'));_0x5869e9[_0x6cf6('0x29')]=_[_0x6cf6('0x2a')](_0x2afe84['query']);_0x5869e9[_0x6cf6('0x2b')]=_[_0x6cf6('0x2c')](_0x5869e9[_0x6cf6('0x28')],_0x5869e9[_0x6cf6('0x29')]);_0x57099f[_0x6cf6('0x2d')]=_[_0x6cf6('0x2c')](_0x5869e9[_0x6cf6('0x28')],qs[_0x6cf6('0x2e')](_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x2e')]));_0x57099f[_0x6cf6('0x2d')]=_0x57099f[_0x6cf6('0x2d')][_0x6cf6('0x2f')]?_0x57099f[_0x6cf6('0x2d')]:_0x5869e9[_0x6cf6('0x28')];if(!_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x30')](_0x6cf6('0x31'))){_0x57099f['limit']=qs[_0x6cf6('0x1a')](_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x1a')]);_0x57099f[_0x6cf6('0x18')]=qs[_0x6cf6('0x18')](_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x18')]);}_0x57099f[_0x6cf6('0x32')]=qs[_0x6cf6('0x33')](_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x33')]);_0x57099f['where']=qs[_0x6cf6('0x2b')](_[_0x6cf6('0x34')](_0x2afe84[_0x6cf6('0x29')],_0x5869e9[_0x6cf6('0x2b')]),_0x2afc06);if(_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x35')]){_0x57099f[_0x6cf6('0x36')]=_[_0x6cf6('0x37')](_0x57099f[_0x6cf6('0x36')],{'$or':_['map'](_0x2afc06,function(_0x1c5eda){if(_0x1c5eda[_0x6cf6('0x26')]!==_0x6cf6('0x38')){var _0x3e906f={};_0x3e906f[_0x1c5eda[_0x6cf6('0x24')]]={'$like':'%'+_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x35')]+'%'};return _0x3e906f;}})});}_0x57099f=_[_0x6cf6('0x37')]({},_0x57099f,_0x2afe84[_0x6cf6('0x39')]);var _0x5ed61f={'where':_0x57099f[_0x6cf6('0x36')]};return db['WhatsappQueueReport'][_0x6cf6('0x1b')](_0x5ed61f)[_0x6cf6('0x21')](function(_0x23d280){_0x5ccc8f[_0x6cf6('0x1b')]=_0x23d280;if(_0x2afe84[_0x6cf6('0x29')][_0x6cf6('0x3a')]){_0x57099f[_0x6cf6('0x3b')]=[{'all':!![]}];}return db[_0x6cf6('0x3c')]['findAll'](_0x57099f);})[_0x6cf6('0x21')](function(_0x335dce){_0x5ccc8f['rows']=_0x335dce;return _0x5ccc8f;})[_0x6cf6('0x21')](respondWithFilteredResult(_0x4521af,_0x57099f))[_0x6cf6('0x3d')](handleError(_0x4521af,null));};exports[_0x6cf6('0x3e')]=function(_0x4874c0,_0x10bb9b){var _0x128f7a={'raw':!![],'where':{'id':_0x4874c0[_0x6cf6('0x3f')]['id']}},_0x51d915={};_0x51d915[_0x6cf6('0x28')]=_[_0x6cf6('0x2a')](db[_0x6cf6('0x3c')][_0x6cf6('0x40')]);_0x51d915[_0x6cf6('0x29')]=_[_0x6cf6('0x2a')](_0x4874c0['query']);_0x51d915[_0x6cf6('0x2b')]=_['intersection'](_0x51d915[_0x6cf6('0x28')],_0x51d915[_0x6cf6('0x29')]);_0x128f7a['attributes']=_[_0x6cf6('0x2c')](_0x51d915[_0x6cf6('0x28')],qs[_0x6cf6('0x2e')](_0x4874c0[_0x6cf6('0x29')][_0x6cf6('0x2e')]));_0x128f7a['attributes']=_0x128f7a[_0x6cf6('0x2d')][_0x6cf6('0x2f')]?_0x128f7a[_0x6cf6('0x2d')]:_0x51d915['model'];if(_0x4874c0[_0x6cf6('0x29')][_0x6cf6('0x3a')]){_0x128f7a[_0x6cf6('0x3b')]=[{'all':!![]}];}_0x128f7a=_['merge']({},_0x128f7a,_0x4874c0[_0x6cf6('0x39')]);return db['WhatsappQueueReport']['find'](_0x128f7a)[_0x6cf6('0x21')](handleEntityNotFound(_0x10bb9b,null))[_0x6cf6('0x21')](respondWithResult(_0x10bb9b,null))[_0x6cf6('0x3d')](handleError(_0x10bb9b,null));};exports[_0x6cf6('0x41')]=function(_0xb8788a,_0x311745){return db[_0x6cf6('0x3c')][_0x6cf6('0x41')](_0xb8788a[_0x6cf6('0x42')],{})[_0x6cf6('0x21')](respondWithResult(_0x311745,0xc9))[_0x6cf6('0x3d')](handleError(_0x311745,null));};exports[_0x6cf6('0x20')]=function(_0x3786d1,_0x4c8ada){if(_0x3786d1[_0x6cf6('0x42')]['id']){delete _0x3786d1[_0x6cf6('0x42')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x3786d1[_0x6cf6('0x3f')]['id']}})[_0x6cf6('0x21')](handleEntityNotFound(_0x4c8ada,null))[_0x6cf6('0x21')](saveUpdates(_0x3786d1[_0x6cf6('0x42')],null))[_0x6cf6('0x21')](respondWithResult(_0x4c8ada,null))[_0x6cf6('0x3d')](handleError(_0x4c8ada,null));};exports['destroy']=function(_0x115b9b,_0x262c23){return db[_0x6cf6('0x3c')]['find']({'where':{'id':_0x115b9b['params']['id']}})[_0x6cf6('0x21')](handleEntityNotFound(_0x262c23,null))[_0x6cf6('0x21')](removeEntity(_0x262c23,null))[_0x6cf6('0x3d')](handleError(_0x262c23,null));};exports[_0x6cf6('0x43')]=function(_0x2dbd71,_0x1fb6f1){return db[_0x6cf6('0x3c')][_0x6cf6('0x43')]()[_0x6cf6('0x21')](respondWithResult(_0x1fb6f1,null))[_0x6cf6('0x3d')](handleError(_0x1fb6f1,null));}; \ No newline at end of file +var _0xe605=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x2735e0,_0x14c45a){var _0x261f1e=function(_0x326f41){while(--_0x326f41){_0x2735e0['push'](_0x2735e0['shift']());}};_0x261f1e(++_0x14c45a);}(_0xe605,0x92));var _0x5e60=function(_0x2d4bfa,_0x135ce6){_0x2d4bfa=_0x2d4bfa-0x0;var _0x42594b=_0xe605[_0x2d4bfa];return _0x42594b;};'use strict';var emlformat=require(_0x5e60('0x0'));var rimraf=require(_0x5e60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e60('0x2'));var rp=require(_0x5e60('0x3'));var moment=require(_0x5e60('0x4'));var BPromise=require(_0x5e60('0x5'));var Mustache=require(_0x5e60('0x6'));var util=require(_0x5e60('0x7'));var path=require(_0x5e60('0x8'));var sox=require(_0x5e60('0x9'));var csv=require(_0x5e60('0xa'));var ejs=require(_0x5e60('0xb'));var fs=require('fs');var fs_extra=require(_0x5e60('0xc'));var _=require(_0x5e60('0xd'));var squel=require('squel');var crypto=require(_0x5e60('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5e60('0xf'));var Papa=require(_0x5e60('0x10'));var Redis=require(_0x5e60('0x11'));var authService=require(_0x5e60('0x12'));var qs=require(_0x5e60('0x13'));var as=require(_0x5e60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e60('0x15'))('api');var utils=require(_0x5e60('0x16'));var config=require(_0x5e60('0x17'));var licenseUtil=require(_0x5e60('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x371df7,_0x178782){_0x178782=_0x178782||0xcc;return function(_0x1f4e14){if(_0x1f4e14){return _0x371df7[_0x5e60('0x19')](_0x178782);}return _0x371df7[_0x5e60('0x1a')](_0x178782)[_0x5e60('0x1b')]();};}function respondWithResult(_0x4fd10e,_0x209adb){_0x209adb=_0x209adb||0xc8;return function(_0x45304f){if(_0x45304f){return _0x4fd10e[_0x5e60('0x1a')](_0x209adb)[_0x5e60('0x1c')](_0x45304f);}};}function respondWithFilteredResult(_0x5b028f,_0x20af5f){return function(_0x529ffe){if(_0x529ffe){var _0x1ffd77=typeof _0x20af5f[_0x5e60('0x1d')]==='undefined'&&typeof _0x20af5f[_0x5e60('0x1e')]===_0x5e60('0x1f');var _0xaa7d05=_0x529ffe[_0x5e60('0x20')];var _0x5c485d=_0x1ffd77?0x0:_0x20af5f[_0x5e60('0x1d')];var _0x22d718=_0x1ffd77?_0x529ffe['count']:_0x20af5f[_0x5e60('0x1d')]+_0x20af5f[_0x5e60('0x1e')];var _0x17c630;if(_0x22d718>=_0xaa7d05){_0x22d718=_0xaa7d05;_0x17c630=0xc8;}else{_0x17c630=0xce;}_0x5b028f[_0x5e60('0x1a')](_0x17c630);return _0x5b028f[_0x5e60('0x21')](_0x5e60('0x22'),_0x5c485d+'-'+_0x22d718+'/'+_0xaa7d05)[_0x5e60('0x1c')](_0x529ffe);}return null;};}function patchUpdates(_0x524c93){return function(_0x3282e4){try{jsonpatch[_0x5e60('0x23')](_0x3282e4,_0x524c93,!![]);}catch(_0x228f13){return BPromise['reject'](_0x228f13);}return _0x3282e4[_0x5e60('0x24')]();};}function saveUpdates(_0x5d77dd,_0x376069){return function(_0x1a44e5){if(_0x1a44e5){return _0x1a44e5[_0x5e60('0x25')](_0x5d77dd)[_0x5e60('0x26')](function(_0x34e98d){return _0x34e98d;});}return null;};}function removeEntity(_0x2a499e,_0x2636f1){return function(_0x5d2c03){if(_0x5d2c03){return _0x5d2c03[_0x5e60('0x27')]()[_0x5e60('0x26')](function(){_0x2a499e[_0x5e60('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45cb62,_0x56e3a5){return function(_0x2d8aac){if(!_0x2d8aac){_0x45cb62[_0x5e60('0x19')](0x194);}return _0x2d8aac;};}function handleError(_0x4a0dbc,_0x3bedea){_0x3bedea=_0x3bedea||0x1f4;return function(_0x5712f7){logger[_0x5e60('0x28')](_0x5712f7[_0x5e60('0x29')]);if(_0x5712f7['name']){delete _0x5712f7[_0x5e60('0x2a')];}_0x4a0dbc[_0x5e60('0x1a')](_0x3bedea)['send'](_0x5712f7);};}exports[_0x5e60('0x2b')]=function(_0xac9c7a,_0x52c97c){var _0x5431a8={},_0x52f668={},_0xf25956={'count':0x0,'rows':[]};var _0x235cc7=_[_0x5e60('0x2c')](db[_0x5e60('0x2d')][_0x5e60('0x2e')],function(_0x558197){return{'name':_0x558197[_0x5e60('0x2f')],'type':_0x558197[_0x5e60('0x30')]['key']};});_0x52f668[_0x5e60('0x31')]=_['map'](_0x235cc7,'name');_0x52f668[_0x5e60('0x32')]=_[_0x5e60('0x33')](_0xac9c7a[_0x5e60('0x32')]);_0x52f668[_0x5e60('0x34')]=_[_0x5e60('0x35')](_0x52f668[_0x5e60('0x31')],_0x52f668[_0x5e60('0x32')]);_0x5431a8[_0x5e60('0x36')]=_[_0x5e60('0x35')](_0x52f668[_0x5e60('0x31')],qs['fields'](_0xac9c7a[_0x5e60('0x32')]['fields']));_0x5431a8['attributes']=_0x5431a8[_0x5e60('0x36')][_0x5e60('0x37')]?_0x5431a8['attributes']:_0x52f668[_0x5e60('0x31')];if(!_0xac9c7a['query'][_0x5e60('0x38')](_0x5e60('0x39'))){_0x5431a8[_0x5e60('0x1e')]=qs[_0x5e60('0x1e')](_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x1e')]);_0x5431a8[_0x5e60('0x1d')]=qs[_0x5e60('0x1d')](_0xac9c7a['query'][_0x5e60('0x1d')]);}_0x5431a8[_0x5e60('0x3a')]=qs[_0x5e60('0x3b')](_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x3b')]);_0x5431a8[_0x5e60('0x3c')]=qs[_0x5e60('0x34')](_['pick'](_0xac9c7a[_0x5e60('0x32')],_0x52f668[_0x5e60('0x34')]),_0x235cc7);if(_0xac9c7a['query']['filter']){_0x5431a8[_0x5e60('0x3c')]=_[_0x5e60('0x3d')](_0x5431a8[_0x5e60('0x3c')],{'$or':_[_0x5e60('0x2c')](_0x235cc7,function(_0x31b900){if(_0x31b900['type']!==_0x5e60('0x3e')){var _0x413bf0={};_0x413bf0[_0x31b900[_0x5e60('0x2a')]]={'$like':'%'+_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x3f')]+'%'};return _0x413bf0;}})});}_0x5431a8=_[_0x5e60('0x3d')]({},_0x5431a8,_0xac9c7a[_0x5e60('0x40')]);var _0x54022a={'where':_0x5431a8[_0x5e60('0x3c')]};return db[_0x5e60('0x2d')]['count'](_0x54022a)['then'](function(_0x47a6df){_0xf25956[_0x5e60('0x20')]=_0x47a6df;if(_0xac9c7a[_0x5e60('0x32')][_0x5e60('0x41')]){_0x5431a8[_0x5e60('0x42')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x5e60('0x43')](_0x5431a8);})[_0x5e60('0x26')](function(_0x4b6192){_0xf25956['rows']=_0x4b6192;return _0xf25956;})[_0x5e60('0x26')](respondWithFilteredResult(_0x52c97c,_0x5431a8))[_0x5e60('0x44')](handleError(_0x52c97c,null));};exports[_0x5e60('0x45')]=function(_0x38ff1d,_0x39ab09){var _0x3899ae={'raw':!![],'where':{'id':_0x38ff1d[_0x5e60('0x46')]['id']}},_0x2522d2={};_0x2522d2[_0x5e60('0x31')]=_['keys'](db[_0x5e60('0x2d')][_0x5e60('0x2e')]);_0x2522d2['query']=_[_0x5e60('0x33')](_0x38ff1d[_0x5e60('0x32')]);_0x2522d2[_0x5e60('0x34')]=_[_0x5e60('0x35')](_0x2522d2[_0x5e60('0x31')],_0x2522d2['query']);_0x3899ae[_0x5e60('0x36')]=_[_0x5e60('0x35')](_0x2522d2[_0x5e60('0x31')],qs[_0x5e60('0x47')](_0x38ff1d['query']['fields']));_0x3899ae['attributes']=_0x3899ae[_0x5e60('0x36')][_0x5e60('0x37')]?_0x3899ae[_0x5e60('0x36')]:_0x2522d2[_0x5e60('0x31')];if(_0x38ff1d[_0x5e60('0x32')][_0x5e60('0x41')]){_0x3899ae['include']=[{'all':!![]}];}_0x3899ae=_[_0x5e60('0x3d')]({},_0x3899ae,_0x38ff1d[_0x5e60('0x40')]);return db[_0x5e60('0x2d')][_0x5e60('0x48')](_0x3899ae)[_0x5e60('0x26')](handleEntityNotFound(_0x39ab09,null))[_0x5e60('0x26')](respondWithResult(_0x39ab09,null))[_0x5e60('0x44')](handleError(_0x39ab09,null));};exports['create']=function(_0x24c757,_0x3ed45d){return db[_0x5e60('0x2d')][_0x5e60('0x49')](_0x24c757[_0x5e60('0x4a')],{})[_0x5e60('0x26')](respondWithResult(_0x3ed45d,0xc9))[_0x5e60('0x44')](handleError(_0x3ed45d,null));};exports[_0x5e60('0x25')]=function(_0x1518bd,_0x350d6d){if(_0x1518bd[_0x5e60('0x4a')]['id']){delete _0x1518bd[_0x5e60('0x4a')]['id'];}return db[_0x5e60('0x2d')][_0x5e60('0x48')]({'where':{'id':_0x1518bd[_0x5e60('0x46')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x350d6d,null))[_0x5e60('0x26')](saveUpdates(_0x1518bd[_0x5e60('0x4a')],null))['then'](respondWithResult(_0x350d6d,null))['catch'](handleError(_0x350d6d,null));};exports[_0x5e60('0x27')]=function(_0x4d3588,_0x3525d){return db[_0x5e60('0x2d')][_0x5e60('0x48')]({'where':{'id':_0x4d3588[_0x5e60('0x46')]['id']}})[_0x5e60('0x26')](handleEntityNotFound(_0x3525d,null))[_0x5e60('0x26')](removeEntity(_0x3525d,null))['catch'](handleError(_0x3525d,null));};exports['describe']=function(_0xd7d32c,_0x1e4e41){return db[_0x5e60('0x2d')]['describe']()['then'](respondWithResult(_0x1e4e41,null))[_0x5e60('0x44')](handleError(_0x1e4e41,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 30608e3..f585190 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 _0xd311=['bluebird','request-promise','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','uniqueid','util','../../config/logger','api','moment'];(function(_0x1a2c5b,_0x4a189e){var _0x56a265=function(_0x5c8bc4){while(--_0x5c8bc4){_0x1a2c5b['push'](_0x1a2c5b['shift']());}};_0x56a265(++_0x4a189e);}(_0xd311,0x1eb));var _0x1d31=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd311[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x1d31('0x0'));var logger=require(_0x1d31('0x1'))(_0x1d31('0x2'));var moment=require(_0x1d31('0x3'));var BPromise=require(_0x1d31('0x4'));var rp=require(_0x1d31('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1d31('0x6'));var attributes=require(_0x1d31('0x7'));module['exports']=function(_0x26abd2,_0x18105b){return _0x26abd2[_0x1d31('0x8')](_0x1d31('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1d31('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6807=['api','moment','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x225dbe,_0x2a8335){var _0x8b6573=function(_0x40d614){while(--_0x40d614){_0x225dbe['push'](_0x225dbe['shift']());}};_0x8b6573(++_0x2a8335);}(_0x6807,0x126));var _0x7680=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x6807[_0x34843e];return _0x598f7f;};'use strict';var _=require(_0x7680('0x0'));var util=require(_0x7680('0x1'));var logger=require(_0x7680('0x2'))(_0x7680('0x3'));var moment=require(_0x7680('0x4'));var BPromise=require('bluebird');var rp=require(_0x7680('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7680('0x6'));var config=require(_0x7680('0x7'));var attributes=require(_0x7680('0x8'));module['exports']=function(_0x2f4044,_0x5231f3){return _0x2f4044['define'](_0x7680('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x7680('0xa'),'fields':[_0x7680('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index c391cee..89453b1 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 _0x4b3c=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','then','catch','update','where','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring'];(function(_0x19babd,_0x1d4ef7){var _0x314eaf=function(_0x24ea35){while(--_0x24ea35){_0x19babd['push'](_0x19babd['shift']());}};_0x314eaf(++_0x1d4ef7);}(_0x4b3c,0x1bb));var _0xc4b3=function(_0x502eb0,_0x6d0814){_0x502eb0=_0x502eb0-0x0;var _0x4f78e4=_0x4b3c[_0x502eb0];return _0x4f78e4;};'use strict';var _=require(_0xc4b3('0x0'));var util=require(_0xc4b3('0x1'));var moment=require(_0xc4b3('0x2'));var BPromise=require(_0xc4b3('0x3'));var rs=require(_0xc4b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4b3('0x5'))['db'];var utils=require(_0xc4b3('0x6'));var logger=require(_0xc4b3('0x7'))(_0xc4b3('0x8'));var config=require('../../config/environment');var jayson=require(_0xc4b3('0x9'));var client=jayson[_0xc4b3('0xa')][_0xc4b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a26b8,_0x49ab50,_0xe8da48){return new BPromise(function(_0x3a7178,_0x544dd1){return client[_0xc4b3('0xc')](_0x3a26b8,_0xe8da48)['then'](function(_0x405e00){logger[_0xc4b3('0xd')](_0xc4b3('0xe'),_0x49ab50,'request\x20sent');logger[_0xc4b3('0xf')](_0xc4b3('0x10'),_0x49ab50,_0xc4b3('0x11'),JSON[_0xc4b3('0x12')](_0x405e00));if(_0x405e00[_0xc4b3('0x13')]){if(_0x405e00[_0xc4b3('0x13')][_0xc4b3('0x14')]===0x1f4){logger[_0xc4b3('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x49ab50,_0x405e00['error'][_0xc4b3('0x15')]);return _0x544dd1(_0x405e00[_0xc4b3('0x13')][_0xc4b3('0x15')]);}logger[_0xc4b3('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x49ab50,_0x405e00[_0xc4b3('0x13')][_0xc4b3('0x15')]);return _0x3a7178(_0x405e00[_0xc4b3('0x13')][_0xc4b3('0x15')]);}else{logger[_0xc4b3('0xd')](_0xc4b3('0xe'),_0x49ab50,_0xc4b3('0x11'));_0x3a7178(_0x405e00['result'][_0xc4b3('0x15')]);}})['catch'](function(_0x26434e){logger[_0xc4b3('0x13')](_0xc4b3('0xe'),_0x49ab50,_0x26434e);_0x544dd1(_0x26434e);});});}exports[_0xc4b3('0x16')]=function(_0x456d47){var _0x268083=this;return new Promise(function(_0x40a327,_0x378fe5){return db[_0xc4b3('0x17')]['create'](_0x456d47[_0xc4b3('0x18')],{'raw':_0x456d47['options']?_0x456d47[_0xc4b3('0x19')][_0xc4b3('0x1a')]===undefined?!![]:![]:!![]})[_0xc4b3('0x1b')](function(_0x59ecc2){logger['info'](_0xc4b3('0x16'),_0x456d47);logger[_0xc4b3('0xf')]('CreateWhatsappQueueReport',_0x456d47,JSON[_0xc4b3('0x12')](_0x59ecc2));_0x40a327(_0x59ecc2);})[_0xc4b3('0x1c')](function(_0x238747){logger[_0xc4b3('0x13')]('CreateWhatsappQueueReport',_0x238747[_0xc4b3('0x15')],_0x456d47);_0x378fe5(_0x268083['error'](0x1f4,_0x238747['message']));});});};exports['UpdateWhatsappQueueReport']=function(_0x7a8674){var _0x30a78d=this;return new Promise(function(_0x46528c,_0x1ac1bf){return db[_0xc4b3('0x17')][_0xc4b3('0x1d')](_0x7a8674['body'],{'raw':_0x7a8674[_0xc4b3('0x19')]?_0x7a8674[_0xc4b3('0x19')][_0xc4b3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7a8674[_0xc4b3('0x19')]?_0x7a8674[_0xc4b3('0x19')][_0xc4b3('0x1e')]||null:null,'attributes':_0x7a8674['options']?_0x7a8674[_0xc4b3('0x19')]['attributes']||null:null,'limit':_0x7a8674[_0xc4b3('0x19')]?_0x7a8674[_0xc4b3('0x19')]['limit']||null:null})[_0xc4b3('0x1b')](function(_0x2c0ee0){logger['info'](_0xc4b3('0x1f'),_0x7a8674);logger['debug'](_0xc4b3('0x1f'),_0x7a8674,JSON[_0xc4b3('0x12')](_0x2c0ee0));_0x46528c(_0x2c0ee0);})[_0xc4b3('0x1c')](function(_0x22aad8){logger[_0xc4b3('0x13')](_0xc4b3('0x1f'),_0x22aad8[_0xc4b3('0x15')],_0x7a8674);_0x1ac1bf(_0x30a78d[_0xc4b3('0x13')](0x1f4,_0x22aad8[_0xc4b3('0x15')]));});});}; \ No newline at end of file +var _0x14b8=['WhatsappQueueReport','create','body','options','raw','debug','stringify','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateWhatsappQueueReport'];(function(_0x50f0dc,_0x232208){var _0x455a3c=function(_0x5a52d2){while(--_0x5a52d2){_0x50f0dc['push'](_0x50f0dc['shift']());}};_0x455a3c(++_0x232208);}(_0x14b8,0x198));var _0x814b=function(_0x1e5866,_0x437182){_0x1e5866=_0x1e5866-0x0;var _0x424cfa=_0x14b8[_0x1e5866];return _0x424cfa;};'use strict';var _=require(_0x814b('0x0'));var util=require(_0x814b('0x1'));var moment=require(_0x814b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x814b('0x3'));var db=require(_0x814b('0x4'))['db'];var utils=require(_0x814b('0x5'));var logger=require(_0x814b('0x6'))(_0x814b('0x7'));var config=require(_0x814b('0x8'));var jayson=require(_0x814b('0x9'));var client=jayson[_0x814b('0xa')][_0x814b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4184f4,_0x146fd5,_0x3aff9c){return new BPromise(function(_0x221a60,_0x1477b8){return client[_0x814b('0xc')](_0x4184f4,_0x3aff9c)[_0x814b('0xd')](function(_0x3e024a){logger[_0x814b('0xe')](_0x814b('0xf'),_0x146fd5,'request\x20sent');logger['debug'](_0x814b('0x10'),_0x146fd5,_0x814b('0x11'),JSON['stringify'](_0x3e024a));if(_0x3e024a[_0x814b('0x12')]){if(_0x3e024a['error'][_0x814b('0x13')]===0x1f4){logger[_0x814b('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x146fd5,_0x3e024a[_0x814b('0x12')][_0x814b('0x14')]);return _0x1477b8(_0x3e024a[_0x814b('0x12')][_0x814b('0x14')]);}logger[_0x814b('0x12')](_0x814b('0xf'),_0x146fd5,_0x3e024a[_0x814b('0x12')]['message']);return _0x221a60(_0x3e024a['error'][_0x814b('0x14')]);}else{logger[_0x814b('0xe')](_0x814b('0xf'),_0x146fd5,'request\x20sent');_0x221a60(_0x3e024a[_0x814b('0x15')]['message']);}})[_0x814b('0x16')](function(_0x507f3f){logger[_0x814b('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x146fd5,_0x507f3f);_0x1477b8(_0x507f3f);});});}exports[_0x814b('0x17')]=function(_0x119bef){var _0x1c4f0a=this;return new Promise(function(_0x27e514,_0x50e8f4){return db[_0x814b('0x18')][_0x814b('0x19')](_0x119bef[_0x814b('0x1a')],{'raw':_0x119bef[_0x814b('0x1b')]?_0x119bef['options'][_0x814b('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2efe95){logger[_0x814b('0xe')]('CreateWhatsappQueueReport',_0x119bef);logger[_0x814b('0x1d')](_0x814b('0x17'),_0x119bef,JSON[_0x814b('0x1e')](_0x2efe95));_0x27e514(_0x2efe95);})['catch'](function(_0x14f267){logger[_0x814b('0x12')](_0x814b('0x17'),_0x14f267[_0x814b('0x14')],_0x119bef);_0x50e8f4(_0x1c4f0a[_0x814b('0x12')](0x1f4,_0x14f267[_0x814b('0x14')]));});});};exports[_0x814b('0x1f')]=function(_0x1f6264){var _0x91d23e=this;return new Promise(function(_0x39edcb,_0x29cf67){return db[_0x814b('0x18')][_0x814b('0x20')](_0x1f6264[_0x814b('0x1a')],{'raw':_0x1f6264[_0x814b('0x1b')]?_0x1f6264[_0x814b('0x1b')][_0x814b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f6264['options']?_0x1f6264['options'][_0x814b('0x21')]||null:null,'attributes':_0x1f6264[_0x814b('0x1b')]?_0x1f6264['options'][_0x814b('0x22')]||null:null,'limit':_0x1f6264[_0x814b('0x1b')]?_0x1f6264[_0x814b('0x1b')][_0x814b('0x23')]||null:null})[_0x814b('0xd')](function(_0x52e9da){logger[_0x814b('0xe')](_0x814b('0x1f'),_0x1f6264);logger[_0x814b('0x1d')](_0x814b('0x1f'),_0x1f6264,JSON[_0x814b('0x1e')](_0x52e9da));_0x39edcb(_0x52e9da);})[_0x814b('0x16')](function(_0x41a00f){logger[_0x814b('0x12')](_0x814b('0x1f'),_0x41a00f['message'],_0x1f6264);_0x29cf67(_0x91d23e[_0x814b('0x12')](0x1f4,_0x41a00f[_0x814b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 6432cca..6cc9b0d 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 _0x4fc2=['isAuthenticated','index','describe','get','/:id','post','create','put','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller'];(function(_0x2420be,_0xe5d7d6){var _0x2c0c34=function(_0x435770){while(--_0x435770){_0x2420be['push'](_0x2420be['shift']());}};_0x2c0c34(++_0xe5d7d6);}(_0x4fc2,0xad));var _0x24fc=function(_0x50b57f,_0x2f01e9){_0x50b57f=_0x50b57f-0x0;var _0x4386fd=_0x4fc2[_0x50b57f];return _0x4386fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x24fc('0x0'));var timeout=require('connect-timeout');var express=require(_0x24fc('0x1'));var router=express[_0x24fc('0x2')]();var fs_extra=require(_0x24fc('0x3'));var auth=require(_0x24fc('0x4'));var interaction=require(_0x24fc('0x5'));var config=require('../../config/environment');var controller=require(_0x24fc('0x6'));router['get']('/',auth[_0x24fc('0x7')](),controller[_0x24fc('0x8')]);router['get']('/describe',auth[_0x24fc('0x7')](),controller[_0x24fc('0x9')]);router[_0x24fc('0xa')](_0x24fc('0xb'),auth[_0x24fc('0x7')](),controller['show']);router[_0x24fc('0xc')]('/',auth['isAuthenticated'](),controller[_0x24fc('0xd')]);router[_0x24fc('0xe')](_0x24fc('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x24fc('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x24fc('0x10')]);module[_0x24fc('0x11')]=router; \ No newline at end of file +var _0x4739=['get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./whatsappTransferReport.controller'];(function(_0x24e6da,_0x5279af){var _0x1f5155=function(_0x354e50){while(--_0x354e50){_0x24e6da['push'](_0x24e6da['shift']());}};_0x1f5155(++_0x5279af);}(_0x4739,0x14c));var _0x9473=function(_0x1672b9,_0x39381c){_0x1672b9=_0x1672b9-0x0;var _0x40d185=_0x4739[_0x1672b9];return _0x40d185;};'use strict';var multer=require(_0x9473('0x0'));var util=require(_0x9473('0x1'));var path=require(_0x9473('0x2'));var timeout=require(_0x9473('0x3'));var express=require(_0x9473('0x4'));var router=express[_0x9473('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9473('0x6'));var config=require('../../config/environment');var controller=require(_0x9473('0x7'));router[_0x9473('0x8')]('/',auth[_0x9473('0x9')](),controller[_0x9473('0xa')]);router[_0x9473('0x8')](_0x9473('0xb'),auth[_0x9473('0x9')](),controller[_0x9473('0xc')]);router[_0x9473('0x8')](_0x9473('0xd'),auth[_0x9473('0x9')](),controller[_0x9473('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9473('0xf')]);router['put'](_0x9473('0xd'),auth[_0x9473('0x9')](),controller[_0x9473('0x10')]);router[_0x9473('0x11')]('/:id',auth[_0x9473('0x9')](),controller[_0x9473('0x12')]);module[_0x9473('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 9de9a7d..43fc66c 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 _0xd7ab=['STRING','ENUM','account','agent','queue','sequelize','exports'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xd7ab,0x14e));var _0xbd7a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd7ab[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xbd7a('0x0'));module[_0xbd7a('0x1')]={'uniqueid':{'type':Sequelize[_0xbd7a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbd7a('0x3')](_0xbd7a('0x4'),_0xbd7a('0x5'),_0xbd7a('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x4b11=['exports','STRING','ENUM','agent','queue','DATE','sequelize'];(function(_0x2e7385,_0xb462b5){var _0x225167=function(_0x154239){while(--_0x154239){_0x2e7385['push'](_0x2e7385['shift']());}};_0x225167(++_0xb462b5);}(_0x4b11,0xf4));var _0x14b1=function(_0x45f6a3,_0x5a363f){_0x45f6a3=_0x45f6a3-0x0;var _0x5d5436=_0x4b11[_0x45f6a3];return _0x5d5436;};'use strict';var Sequelize=require(_0x14b1('0x0'));module[_0x14b1('0x1')]={'uniqueid':{'type':Sequelize[_0x14b1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x14b1('0x3')]('account',_0x14b1('0x4'),_0x14b1('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x14b1('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 03b4e0c..e18cec9 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 _0x9bc7=['rawAttributes','type','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','name','send','index','WhatsappTransferReport'];(function(_0x31fe01,_0x8e1eae){var _0x12c9ca=function(_0x170b76){while(--_0x170b76){_0x31fe01['push'](_0x31fe01['shift']());}};_0x12c9ca(++_0x8e1eae);}(_0x9bc7,0x1cd));var _0x79bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bc7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x79bc('0x0'));var rimraf=require(_0x79bc('0x1'));var zipdir=require(_0x79bc('0x2'));var jsonpatch=require(_0x79bc('0x3'));var rp=require(_0x79bc('0x4'));var moment=require(_0x79bc('0x5'));var BPromise=require(_0x79bc('0x6'));var Mustache=require(_0x79bc('0x7'));var util=require(_0x79bc('0x8'));var path=require(_0x79bc('0x9'));var sox=require('sox');var csv=require(_0x79bc('0xa'));var ejs=require(_0x79bc('0xb'));var fs=require('fs');var fs_extra=require(_0x79bc('0xc'));var _=require('lodash');var squel=require(_0x79bc('0xd'));var crypto=require('crypto');var jsforce=require(_0x79bc('0xe'));var deskjs=require(_0x79bc('0xf'));var toCsv=require(_0x79bc('0xa'));var querystring=require(_0x79bc('0x10'));var Papa=require(_0x79bc('0x11'));var Redis=require('ioredis');var authService=require(_0x79bc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x79bc('0x13'));var hardwareService=require(_0x79bc('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x79bc('0x15'));var config=require(_0x79bc('0x16'));var licenseUtil=require(_0x79bc('0x17'));var db=require(_0x79bc('0x18'))['db'];function respondWithStatusCode(_0x174eff,_0x401de9){_0x401de9=_0x401de9||0xcc;return function(_0x29e987){if(_0x29e987){return _0x174eff[_0x79bc('0x19')](_0x401de9);}return _0x174eff['status'](_0x401de9)[_0x79bc('0x1a')]();};}function respondWithResult(_0x57530f,_0x404adf){_0x404adf=_0x404adf||0xc8;return function(_0x2ee065){if(_0x2ee065){return _0x57530f[_0x79bc('0x1b')](_0x404adf)[_0x79bc('0x1c')](_0x2ee065);}};}function respondWithFilteredResult(_0x564d68,_0x21cb53){return function(_0x3e4244){if(_0x3e4244){var _0x510906=typeof _0x21cb53[_0x79bc('0x1d')]==='undefined'&&typeof _0x21cb53[_0x79bc('0x1e')]===_0x79bc('0x1f');var _0x5af0ec=_0x3e4244[_0x79bc('0x20')];var _0x478552=_0x510906?0x0:_0x21cb53[_0x79bc('0x1d')];var _0x4205b2=_0x510906?_0x3e4244[_0x79bc('0x20')]:_0x21cb53['offset']+_0x21cb53[_0x79bc('0x1e')];var _0x2f3b0c;if(_0x4205b2>=_0x5af0ec){_0x4205b2=_0x5af0ec;_0x2f3b0c=0xc8;}else{_0x2f3b0c=0xce;}_0x564d68[_0x79bc('0x1b')](_0x2f3b0c);return _0x564d68[_0x79bc('0x21')]('Content-Range',_0x478552+'-'+_0x4205b2+'/'+_0x5af0ec)[_0x79bc('0x1c')](_0x3e4244);}return null;};}function patchUpdates(_0x52a423){return function(_0x51282d){try{jsonpatch[_0x79bc('0x22')](_0x51282d,_0x52a423,!![]);}catch(_0x323d6e){return BPromise[_0x79bc('0x23')](_0x323d6e);}return _0x51282d['save']();};}function saveUpdates(_0xc9c88a,_0x3cbe59){return function(_0x1a62fa){if(_0x1a62fa){return _0x1a62fa[_0x79bc('0x24')](_0xc9c88a)[_0x79bc('0x25')](function(_0x44ca15){return _0x44ca15;});}return null;};}function removeEntity(_0x5ed341,_0x5bc690){return function(_0x307147){if(_0x307147){return _0x307147[_0x79bc('0x26')]()[_0x79bc('0x25')](function(){_0x5ed341[_0x79bc('0x1b')](0xcc)[_0x79bc('0x1a')]();});}};}function handleEntityNotFound(_0x121a28,_0x31aba2){return function(_0x38f667){if(!_0x38f667){_0x121a28[_0x79bc('0x19')](0x194);}return _0x38f667;};}function handleError(_0x197bcc,_0x3f6472){_0x3f6472=_0x3f6472||0x1f4;return function(_0x157437){logger['error'](_0x157437['stack']);if(_0x157437[_0x79bc('0x27')]){delete _0x157437[_0x79bc('0x27')];}_0x197bcc['status'](_0x3f6472)[_0x79bc('0x28')](_0x157437);};}exports[_0x79bc('0x29')]=function(_0x48584b,_0x5740a1){var _0x4dfcae={},_0x143bb3={},_0xe7fe10={'count':0x0,'rows':[]};var _0x126ee1=_['map'](db[_0x79bc('0x2a')][_0x79bc('0x2b')],function(_0x5c4535){return{'name':_0x5c4535['fieldName'],'type':_0x5c4535[_0x79bc('0x2c')]['key']};});_0x143bb3[_0x79bc('0x2d')]=_[_0x79bc('0x2e')](_0x126ee1,_0x79bc('0x27'));_0x143bb3['query']=_[_0x79bc('0x2f')](_0x48584b['query']);_0x143bb3[_0x79bc('0x30')]=_[_0x79bc('0x31')](_0x143bb3[_0x79bc('0x2d')],_0x143bb3[_0x79bc('0x32')]);_0x4dfcae[_0x79bc('0x33')]=_['intersection'](_0x143bb3[_0x79bc('0x2d')],qs[_0x79bc('0x34')](_0x48584b[_0x79bc('0x32')][_0x79bc('0x34')]));_0x4dfcae['attributes']=_0x4dfcae[_0x79bc('0x33')][_0x79bc('0x35')]?_0x4dfcae['attributes']:_0x143bb3[_0x79bc('0x2d')];if(!_0x48584b[_0x79bc('0x32')][_0x79bc('0x36')]('nolimit')){_0x4dfcae[_0x79bc('0x1e')]=qs[_0x79bc('0x1e')](_0x48584b[_0x79bc('0x32')]['limit']);_0x4dfcae[_0x79bc('0x1d')]=qs['offset'](_0x48584b['query'][_0x79bc('0x1d')]);}_0x4dfcae['order']=qs[_0x79bc('0x37')](_0x48584b[_0x79bc('0x32')][_0x79bc('0x37')]);_0x4dfcae[_0x79bc('0x38')]=qs[_0x79bc('0x30')](_[_0x79bc('0x39')](_0x48584b['query'],_0x143bb3['filters']),_0x126ee1);if(_0x48584b[_0x79bc('0x32')][_0x79bc('0x3a')]){_0x4dfcae[_0x79bc('0x38')]=_['merge'](_0x4dfcae[_0x79bc('0x38')],{'$or':_['map'](_0x126ee1,function(_0x5267e8){if(_0x5267e8[_0x79bc('0x2c')]!==_0x79bc('0x3b')){var _0xbb2ede={};_0xbb2ede[_0x5267e8[_0x79bc('0x27')]]={'$like':'%'+_0x48584b[_0x79bc('0x32')][_0x79bc('0x3a')]+'%'};return _0xbb2ede;}})});}_0x4dfcae=_[_0x79bc('0x3c')]({},_0x4dfcae,_0x48584b[_0x79bc('0x3d')]);var _0x379b5b={'where':_0x4dfcae[_0x79bc('0x38')]};return db['WhatsappTransferReport'][_0x79bc('0x20')](_0x379b5b)[_0x79bc('0x25')](function(_0x52af6a){_0xe7fe10[_0x79bc('0x20')]=_0x52af6a;if(_0x48584b[_0x79bc('0x32')][_0x79bc('0x3e')]){_0x4dfcae[_0x79bc('0x3f')]=[{'all':!![]}];}return db[_0x79bc('0x2a')]['findAll'](_0x4dfcae);})[_0x79bc('0x25')](function(_0x3ea23c){_0xe7fe10[_0x79bc('0x40')]=_0x3ea23c;return _0xe7fe10;})[_0x79bc('0x25')](respondWithFilteredResult(_0x5740a1,_0x4dfcae))[_0x79bc('0x41')](handleError(_0x5740a1,null));};exports[_0x79bc('0x42')]=function(_0x1d8215,_0x45e0fd){var _0x1effed={'raw':!![],'where':{'id':_0x1d8215[_0x79bc('0x43')]['id']}},_0x1400d5={};_0x1400d5['model']=_[_0x79bc('0x2f')](db[_0x79bc('0x2a')][_0x79bc('0x2b')]);_0x1400d5[_0x79bc('0x32')]=_[_0x79bc('0x2f')](_0x1d8215[_0x79bc('0x32')]);_0x1400d5[_0x79bc('0x30')]=_[_0x79bc('0x31')](_0x1400d5[_0x79bc('0x2d')],_0x1400d5[_0x79bc('0x32')]);_0x1effed[_0x79bc('0x33')]=_[_0x79bc('0x31')](_0x1400d5['model'],qs[_0x79bc('0x34')](_0x1d8215[_0x79bc('0x32')][_0x79bc('0x34')]));_0x1effed['attributes']=_0x1effed['attributes'][_0x79bc('0x35')]?_0x1effed[_0x79bc('0x33')]:_0x1400d5[_0x79bc('0x2d')];if(_0x1d8215[_0x79bc('0x32')]['includeAll']){_0x1effed[_0x79bc('0x3f')]=[{'all':!![]}];}_0x1effed=_[_0x79bc('0x3c')]({},_0x1effed,_0x1d8215['options']);return db['WhatsappTransferReport'][_0x79bc('0x44')](_0x1effed)[_0x79bc('0x25')](handleEntityNotFound(_0x45e0fd,null))[_0x79bc('0x25')](respondWithResult(_0x45e0fd,null))[_0x79bc('0x41')](handleError(_0x45e0fd,null));};exports[_0x79bc('0x45')]=function(_0xddccef,_0x5e2b2c){return db['WhatsappTransferReport'][_0x79bc('0x45')](_0xddccef[_0x79bc('0x46')],{})[_0x79bc('0x25')](respondWithResult(_0x5e2b2c,0xc9))[_0x79bc('0x41')](handleError(_0x5e2b2c,null));};exports['update']=function(_0x358f57,_0x526625){if(_0x358f57[_0x79bc('0x46')]['id']){delete _0x358f57[_0x79bc('0x46')]['id'];}return db[_0x79bc('0x2a')]['find']({'where':{'id':_0x358f57[_0x79bc('0x43')]['id']}})[_0x79bc('0x25')](handleEntityNotFound(_0x526625,null))['then'](saveUpdates(_0x358f57[_0x79bc('0x46')],null))[_0x79bc('0x25')](respondWithResult(_0x526625,null))[_0x79bc('0x41')](handleError(_0x526625,null));};exports[_0x79bc('0x26')]=function(_0x450313,_0xe8a583){return db['WhatsappTransferReport'][_0x79bc('0x44')]({'where':{'id':_0x450313[_0x79bc('0x43')]['id']}})[_0x79bc('0x25')](handleEntityNotFound(_0xe8a583,null))[_0x79bc('0x25')](removeEntity(_0xe8a583,null))[_0x79bc('0x41')](handleError(_0xe8a583,null));};exports[_0x79bc('0x47')]=function(_0x74727c,_0x2ecc1a){return db['WhatsappTransferReport'][_0x79bc('0x47')]()['then'](respondWithResult(_0x2ecc1a,null))[_0x79bc('0x41')](handleError(_0x2ecc1a,null));}; \ No newline at end of file +var _0xa32b=['then','destroy','error','name','send','index','map','WhatsappTransferReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','includeAll','options','create','body','find','describe','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update'];(function(_0xf3e09e,_0x5ef196){var _0x3f5da2=function(_0x43c917){while(--_0x43c917){_0xf3e09e['push'](_0xf3e09e['shift']());}};_0x3f5da2(++_0x5ef196);}(_0xa32b,0x68));var _0xba32=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0xa32b[_0x59e821];return _0x5333f6;};'use strict';var emlformat=require(_0xba32('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba32('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba32('0x2'));var BPromise=require(_0xba32('0x3'));var Mustache=require(_0xba32('0x4'));var util=require('util');var path=require(_0xba32('0x5'));var sox=require(_0xba32('0x6'));var csv=require(_0xba32('0x7'));var ejs=require(_0xba32('0x8'));var fs=require('fs');var fs_extra=require(_0xba32('0x9'));var _=require('lodash');var squel=require(_0xba32('0xa'));var crypto=require('crypto');var jsforce=require(_0xba32('0xb'));var deskjs=require(_0xba32('0xc'));var toCsv=require(_0xba32('0x7'));var querystring=require(_0xba32('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xba32('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba32('0xf'))('api');var utils=require(_0xba32('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xba32('0x11'))['db'];function respondWithStatusCode(_0x18ae07,_0x46f042){_0x46f042=_0x46f042||0xcc;return function(_0x1fc11d){if(_0x1fc11d){return _0x18ae07[_0xba32('0x12')](_0x46f042);}return _0x18ae07['status'](_0x46f042)[_0xba32('0x13')]();};}function respondWithResult(_0x3f9bef,_0x43652a){_0x43652a=_0x43652a||0xc8;return function(_0xd82932){if(_0xd82932){return _0x3f9bef[_0xba32('0x14')](_0x43652a)[_0xba32('0x15')](_0xd82932);}};}function respondWithFilteredResult(_0x11d280,_0x5c0bd8){return function(_0x176763){if(_0x176763){var _0x22c2be=typeof _0x5c0bd8[_0xba32('0x16')]===_0xba32('0x17')&&typeof _0x5c0bd8[_0xba32('0x18')]==='undefined';var _0x4d0b72=_0x176763['count'];var _0x5c3fe6=_0x22c2be?0x0:_0x5c0bd8[_0xba32('0x16')];var _0x1ae3ea=_0x22c2be?_0x176763[_0xba32('0x19')]:_0x5c0bd8[_0xba32('0x16')]+_0x5c0bd8[_0xba32('0x18')];var _0x1bcce4;if(_0x1ae3ea>=_0x4d0b72){_0x1ae3ea=_0x4d0b72;_0x1bcce4=0xc8;}else{_0x1bcce4=0xce;}_0x11d280['status'](_0x1bcce4);return _0x11d280['set']('Content-Range',_0x5c3fe6+'-'+_0x1ae3ea+'/'+_0x4d0b72)[_0xba32('0x15')](_0x176763);}return null;};}function patchUpdates(_0x51c43a){return function(_0x44e11c){try{jsonpatch[_0xba32('0x1a')](_0x44e11c,_0x51c43a,!![]);}catch(_0x4266dc){return BPromise[_0xba32('0x1b')](_0x4266dc);}return _0x44e11c[_0xba32('0x1c')]();};}function saveUpdates(_0x34124d,_0xdfa807){return function(_0x503698){if(_0x503698){return _0x503698[_0xba32('0x1d')](_0x34124d)[_0xba32('0x1e')](function(_0x34a3cd){return _0x34a3cd;});}return null;};}function removeEntity(_0x171626,_0x5eb640){return function(_0x4b03a5){if(_0x4b03a5){return _0x4b03a5[_0xba32('0x1f')]()[_0xba32('0x1e')](function(){_0x171626['status'](0xcc)[_0xba32('0x13')]();});}};}function handleEntityNotFound(_0x5dcdc4,_0x37ade0){return function(_0x18f0c8){if(!_0x18f0c8){_0x5dcdc4[_0xba32('0x12')](0x194);}return _0x18f0c8;};}function handleError(_0x5e1f71,_0x385ae0){_0x385ae0=_0x385ae0||0x1f4;return function(_0x11fb8c){logger[_0xba32('0x20')](_0x11fb8c['stack']);if(_0x11fb8c[_0xba32('0x21')]){delete _0x11fb8c[_0xba32('0x21')];}_0x5e1f71[_0xba32('0x14')](_0x385ae0)[_0xba32('0x22')](_0x11fb8c);};}exports[_0xba32('0x23')]=function(_0x168206,_0x27bc6f){var _0xd00fcd={},_0x1ef5ed={},_0x5dbba9={'count':0x0,'rows':[]};var _0x454f4b=_[_0xba32('0x24')](db[_0xba32('0x25')][_0xba32('0x26')],function(_0x30c137){return{'name':_0x30c137['fieldName'],'type':_0x30c137[_0xba32('0x27')]['key']};});_0x1ef5ed[_0xba32('0x28')]=_[_0xba32('0x24')](_0x454f4b,'name');_0x1ef5ed[_0xba32('0x29')]=_[_0xba32('0x2a')](_0x168206[_0xba32('0x29')]);_0x1ef5ed[_0xba32('0x2b')]=_['intersection'](_0x1ef5ed[_0xba32('0x28')],_0x1ef5ed[_0xba32('0x29')]);_0xd00fcd['attributes']=_[_0xba32('0x2c')](_0x1ef5ed[_0xba32('0x28')],qs[_0xba32('0x2d')](_0x168206[_0xba32('0x29')]['fields']));_0xd00fcd[_0xba32('0x2e')]=_0xd00fcd['attributes'][_0xba32('0x2f')]?_0xd00fcd[_0xba32('0x2e')]:_0x1ef5ed[_0xba32('0x28')];if(!_0x168206['query'][_0xba32('0x30')](_0xba32('0x31'))){_0xd00fcd['limit']=qs[_0xba32('0x18')](_0x168206[_0xba32('0x29')][_0xba32('0x18')]);_0xd00fcd[_0xba32('0x16')]=qs['offset'](_0x168206['query'][_0xba32('0x16')]);}_0xd00fcd['order']=qs[_0xba32('0x32')](_0x168206[_0xba32('0x29')][_0xba32('0x32')]);_0xd00fcd[_0xba32('0x33')]=qs['filters'](_[_0xba32('0x34')](_0x168206[_0xba32('0x29')],_0x1ef5ed[_0xba32('0x2b')]),_0x454f4b);if(_0x168206[_0xba32('0x29')]['filter']){_0xd00fcd['where']=_[_0xba32('0x35')](_0xd00fcd[_0xba32('0x33')],{'$or':_[_0xba32('0x24')](_0x454f4b,function(_0x385b28){if(_0x385b28[_0xba32('0x27')]!==_0xba32('0x36')){var _0x475893={};_0x475893[_0x385b28[_0xba32('0x21')]]={'$like':'%'+_0x168206[_0xba32('0x29')][_0xba32('0x37')]+'%'};return _0x475893;}})});}_0xd00fcd=_[_0xba32('0x35')]({},_0xd00fcd,_0x168206['options']);var _0x19a677={'where':_0xd00fcd[_0xba32('0x33')]};return db[_0xba32('0x25')][_0xba32('0x19')](_0x19a677)['then'](function(_0x2c179a){_0x5dbba9['count']=_0x2c179a;if(_0x168206[_0xba32('0x29')]['includeAll']){_0xd00fcd[_0xba32('0x38')]=[{'all':!![]}];}return db[_0xba32('0x25')][_0xba32('0x39')](_0xd00fcd);})[_0xba32('0x1e')](function(_0x26284e){_0x5dbba9[_0xba32('0x3a')]=_0x26284e;return _0x5dbba9;})['then'](respondWithFilteredResult(_0x27bc6f,_0xd00fcd))[_0xba32('0x3b')](handleError(_0x27bc6f,null));};exports['show']=function(_0x469041,_0x6f4d9d){var _0x1d00eb={'raw':!![],'where':{'id':_0x469041[_0xba32('0x3c')]['id']}},_0x558d2b={};_0x558d2b[_0xba32('0x28')]=_['keys'](db[_0xba32('0x25')][_0xba32('0x26')]);_0x558d2b[_0xba32('0x29')]=_['keys'](_0x469041[_0xba32('0x29')]);_0x558d2b[_0xba32('0x2b')]=_['intersection'](_0x558d2b[_0xba32('0x28')],_0x558d2b[_0xba32('0x29')]);_0x1d00eb[_0xba32('0x2e')]=_[_0xba32('0x2c')](_0x558d2b['model'],qs[_0xba32('0x2d')](_0x469041[_0xba32('0x29')]['fields']));_0x1d00eb[_0xba32('0x2e')]=_0x1d00eb[_0xba32('0x2e')]['length']?_0x1d00eb[_0xba32('0x2e')]:_0x558d2b['model'];if(_0x469041[_0xba32('0x29')][_0xba32('0x3d')]){_0x1d00eb[_0xba32('0x38')]=[{'all':!![]}];}_0x1d00eb=_[_0xba32('0x35')]({},_0x1d00eb,_0x469041[_0xba32('0x3e')]);return db[_0xba32('0x25')]['find'](_0x1d00eb)[_0xba32('0x1e')](handleEntityNotFound(_0x6f4d9d,null))[_0xba32('0x1e')](respondWithResult(_0x6f4d9d,null))[_0xba32('0x3b')](handleError(_0x6f4d9d,null));};exports[_0xba32('0x3f')]=function(_0x2850fe,_0x4a7d85){return db[_0xba32('0x25')][_0xba32('0x3f')](_0x2850fe[_0xba32('0x40')],{})['then'](respondWithResult(_0x4a7d85,0xc9))['catch'](handleError(_0x4a7d85,null));};exports[_0xba32('0x1d')]=function(_0xc8624,_0x58309d){if(_0xc8624['body']['id']){delete _0xc8624[_0xba32('0x40')]['id'];}return db[_0xba32('0x25')][_0xba32('0x41')]({'where':{'id':_0xc8624['params']['id']}})['then'](handleEntityNotFound(_0x58309d,null))[_0xba32('0x1e')](saveUpdates(_0xc8624[_0xba32('0x40')],null))[_0xba32('0x1e')](respondWithResult(_0x58309d,null))[_0xba32('0x3b')](handleError(_0x58309d,null));};exports['destroy']=function(_0x20508f,_0x165c34){return db[_0xba32('0x25')][_0xba32('0x41')]({'where':{'id':_0x20508f['params']['id']}})[_0xba32('0x1e')](handleEntityNotFound(_0x165c34,null))[_0xba32('0x1e')](removeEntity(_0x165c34,null))[_0xba32('0x3b')](handleError(_0x165c34,null));};exports[_0xba32('0x42')]=function(_0x4be4de,_0x15da05){return db[_0xba32('0x25')][_0xba32('0x42')]()[_0xba32('0x1e')](respondWithResult(_0x15da05,null))[_0xba32('0x3b')](handleError(_0x15da05,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index ea8e728..ee6d63c 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 _0xab34=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappTransferReport'];(function(_0x5cd3eb,_0x2a6310){var _0x4b22d0=function(_0x511ad7){while(--_0x511ad7){_0x5cd3eb['push'](_0x5cd3eb['shift']());}};_0x4b22d0(++_0x2a6310);}(_0xab34,0xd1));var _0x4ab3=function(_0x2b8765,_0x59211e){_0x2b8765=_0x2b8765-0x0;var _0x2ce7f9=_0xab34[_0x2b8765];return _0x2ce7f9;};'use strict';var _=require('lodash');var util=require(_0x4ab3('0x0'));var logger=require(_0x4ab3('0x1'))(_0x4ab3('0x2'));var moment=require(_0x4ab3('0x3'));var BPromise=require(_0x4ab3('0x4'));var rp=require(_0x4ab3('0x5'));var fs=require('fs');var path=require(_0x4ab3('0x6'));var rimraf=require(_0x4ab3('0x7'));var config=require(_0x4ab3('0x8'));var attributes=require('./whatsappTransferReport.attributes');module[_0x4ab3('0x9')]=function(_0x31a22c,_0x520742){return _0x31a22c[_0x4ab3('0xa')](_0x4ab3('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x4ab3('0xc'),'fields':[_0x4ab3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc8fd=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc8fd,0xd2));var _0xdc8f=function(_0x31266c,_0x2953ff){_0x31266c=_0x31266c-0x0;var _0x527749=_0xc8fd[_0x31266c];return _0x527749;};'use strict';var _=require('lodash');var util=require(_0xdc8f('0x0'));var logger=require('../../config/logger')(_0xdc8f('0x1'));var moment=require(_0xdc8f('0x2'));var BPromise=require(_0xdc8f('0x3'));var rp=require(_0xdc8f('0x4'));var fs=require('fs');var path=require(_0xdc8f('0x5'));var rimraf=require(_0xdc8f('0x6'));var config=require(_0xdc8f('0x7'));var attributes=require(_0xdc8f('0x8'));module[_0xdc8f('0x9')]=function(_0x5c761a,_0x225505){return _0x5c761a[_0xdc8f('0xa')](_0xdc8f('0xb'),attributes,{'tableName':_0xdc8f('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdc8f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 942f206..542a849 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 _0x7cc1=['client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4aeb00,_0x7d4272){var _0x4ef49b=function(_0x325aa3){while(--_0x325aa3){_0x4aeb00['push'](_0x4aeb00['shift']());}};_0x4ef49b(++_0x7d4272);}(_0x7cc1,0xcd));var _0x17cc=function(_0xcf5e23,_0x199d9c){_0xcf5e23=_0xcf5e23-0x0;var _0x3035fb=_0x7cc1[_0xcf5e23];return _0x3035fb;};'use strict';var _=require(_0x17cc('0x0'));var util=require(_0x17cc('0x1'));var moment=require(_0x17cc('0x2'));var BPromise=require(_0x17cc('0x3'));var rs=require(_0x17cc('0x4'));var fs=require('fs');var Redis=require(_0x17cc('0x5'));var db=require(_0x17cc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x17cc('0x7'))(_0x17cc('0x8'));var config=require(_0x17cc('0x9'));var jayson=require(_0x17cc('0xa'));var client=jayson[_0x17cc('0xb')][_0x17cc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b6483,_0x5b8aba,_0x24807f){return new BPromise(function(_0x4ee8b9,_0x109e9f){return client[_0x17cc('0xd')](_0x3b6483,_0x24807f)['then'](function(_0x3c2f4b){logger[_0x17cc('0xe')](_0x17cc('0xf'),_0x5b8aba,_0x17cc('0x10'));logger[_0x17cc('0x11')](_0x17cc('0x12'),_0x5b8aba,'request\x20sent',JSON[_0x17cc('0x13')](_0x3c2f4b));if(_0x3c2f4b[_0x17cc('0x14')]){if(_0x3c2f4b['error']['code']===0x1f4){logger[_0x17cc('0x14')](_0x17cc('0xf'),_0x5b8aba,_0x3c2f4b['error'][_0x17cc('0x15')]);return _0x109e9f(_0x3c2f4b[_0x17cc('0x14')]['message']);}logger['error'](_0x17cc('0xf'),_0x5b8aba,_0x3c2f4b[_0x17cc('0x14')][_0x17cc('0x15')]);return _0x4ee8b9(_0x3c2f4b[_0x17cc('0x14')][_0x17cc('0x15')]);}else{logger[_0x17cc('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x5b8aba,'request\x20sent');_0x4ee8b9(_0x3c2f4b[_0x17cc('0x16')][_0x17cc('0x15')]);}})[_0x17cc('0x17')](function(_0x94f150){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x5b8aba,_0x94f150);_0x109e9f(_0x94f150);});});} \ No newline at end of file +var _0x14a8=['message','info','result','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3a2952,_0x1600d4){var _0x381fc0=function(_0x223964){while(--_0x223964){_0x3a2952['push'](_0x3a2952['shift']());}};_0x381fc0(++_0x1600d4);}(_0x14a8,0xab));var _0x814a=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x14a8[_0x174ef5];return _0x1cc379;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x814a('0x0'));var BPromise=require(_0x814a('0x1'));var rs=require(_0x814a('0x2'));var fs=require('fs');var Redis=require(_0x814a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x814a('0x4'));var logger=require('../../config/logger')(_0x814a('0x5'));var config=require(_0x814a('0x6'));var jayson=require(_0x814a('0x7'));var client=jayson[_0x814a('0x8')][_0x814a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1715ad,_0x4321dc,_0x5e3ba8){return new BPromise(function(_0x50878c,_0x288f84){return client[_0x814a('0xa')](_0x1715ad,_0x5e3ba8)[_0x814a('0xb')](function(_0x4bfcf3){logger['info'](_0x814a('0xc'),_0x4321dc,_0x814a('0xd'));logger[_0x814a('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x4321dc,_0x814a('0xd'),JSON[_0x814a('0xf')](_0x4bfcf3));if(_0x4bfcf3[_0x814a('0x10')]){if(_0x4bfcf3[_0x814a('0x10')][_0x814a('0x11')]===0x1f4){logger['error'](_0x814a('0xc'),_0x4321dc,_0x4bfcf3[_0x814a('0x10')][_0x814a('0x12')]);return _0x288f84(_0x4bfcf3[_0x814a('0x10')][_0x814a('0x12')]);}logger[_0x814a('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4321dc,_0x4bfcf3[_0x814a('0x10')][_0x814a('0x12')]);return _0x50878c(_0x4bfcf3[_0x814a('0x10')][_0x814a('0x12')]);}else{logger[_0x814a('0x13')](_0x814a('0xc'),_0x4321dc,_0x814a('0xd'));_0x50878c(_0x4bfcf3[_0x814a('0x14')][_0x814a('0x12')]);}})['catch'](function(_0xac0587){logger['error'](_0x814a('0xc'),_0x4321dc,_0xac0587);_0x288f84(_0xac0587);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 657fbda..39e7b80 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf95f=['exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','name','Offline\x20apps:','status','online','join','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','filter'];(function(_0x402ef7,_0x2d6c25){var _0x11e359=function(_0x2af3b7){while(--_0x2af3b7){_0x402ef7['push'](_0x402ef7['shift']());}};_0x11e359(++_0x2d6c25);}(_0xf95f,0x142));var _0xff95=function(_0x2179f2,_0x2dff7c){_0x2179f2=_0x2179f2-0x0;var _0x236d1b=_0xf95f[_0x2179f2];return _0x236d1b;};'use strict';var _=require(_0xff95('0x0'));var db=require(_0xff95('0x1'))['db'];var seedDb=require(_0xff95('0x2'));var checkLicense=require(_0xff95('0x3'));var rpc=require(_0xff95('0x4'));var config=require(_0xff95('0x5'));var logger=require(_0xff95('0x6'))(_0xff95('0x7'));var pm2=require(_0xff95('0x8'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xff95('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xff95('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xff95('0xb'));function main(){return db[_0xff95('0xc')][_0xff95('0xd')]()[_0xff95('0xe')](function(){if(config[_0xff95('0xf')]){return seedDb[_0xff95('0x10')]();}})[_0xff95('0xe')](function(){return checkLicense[_0xff95('0x10')]();})['then'](function(){return rpc['listen']();})[_0xff95('0xe')](function(_0x4547b5){logger[_0xff95('0x11')](_0x4547b5);return chat[_0xff95('0x12')]();})[_0xff95('0xe')](function(){return whatsapp[_0xff95('0x12')]();})[_0xff95('0xe')](function(){return schedule['start']();})['then'](function(){return transcribe[_0xff95('0x12')]();})[_0xff95('0xe')](function(){return provider['start']();})[_0xff95('0xe')](function(_0x5b05ea){logger['info'](_0x5b05ea);return pm2['start'](pm2Config);})[_0xff95('0xe')](function(_0x27a82b){var _0x3c59ec=_0x27a82b[_0xff95('0x13')](function(_0x28a795){return typeof _0x28a795[_0xff95('0x14')]==='number'&&_0x28a795['exitCode']>=0x0;});if(_0x3c59ec[_0xff95('0x15')]>0x0){throw new Error(_0x3c59ec[_0xff95('0x15')]+_0xff95('0x16')+_[_0xff95('0x17')](_0x3c59ec,function(_0x21697b){return'\x22'+_0x21697b[_0xff95('0x18')]['name']+'\x22';}));}logger[_0xff95('0x11')](_0xff95('0x19'),_[_0xff95('0x17')](_['filter'](_0x27a82b,{'status':'online'}),_0xff95('0x1a'))['join']());logger[_0xff95('0x11')](_0xff95('0x1b'),_[_0xff95('0x17')](_[_0xff95('0x13')](_0x27a82b,function(_0x134b3c){return _0x134b3c[_0xff95('0x1c')]!==_0xff95('0x1d');}),_0xff95('0x1a'))[_0xff95('0x1e')]()||_0xff95('0x1f'));console[_0xff95('0x20')]('App\x20Ready!');})[_0xff95('0x21')](function(_0x50d605){console[_0xff95('0x20')](_0xff95('0x22'),_0x50d605);logger[_0xff95('0x23')](_0xff95('0x24'),_0x50d605);process[_0xff95('0x25')](0x1);});}main(); \ No newline at end of file +var _0x5294=['map','pm2_env','name','Online\x20apps:','filter','join','Offline\x20apps:','status','online','None','log','catch','error','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20'];(function(_0x17aa6b,_0x375e08){var _0x5da3e7=function(_0x5963c3){while(--_0x5963c3){_0x17aa6b['push'](_0x17aa6b['shift']());}};_0x5da3e7(++_0x375e08);}(_0x5294,0x111));var _0x4529=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x5294[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x4529('0x0'));var db=require(_0x4529('0x1'))['db'];var seedDb=require(_0x4529('0x2'));var checkLicense=require(_0x4529('0x3'));var rpc=require(_0x4529('0x4'));var config=require(_0x4529('0x5'));var logger=require('./config/logger')(_0x4529('0x6'));var pm2=require(_0x4529('0x7'));var pm2Config=require(_0x4529('0x8'));var schedule=require('./config/schedule');var chat=require(_0x4529('0x9'));var whatsapp=require(_0x4529('0xa'));var transcribe=require(_0x4529('0xb'));var provider=require(_0x4529('0xc'));function main(){return db['sequelize'][_0x4529('0xd')]()[_0x4529('0xe')](function(){if(config[_0x4529('0xf')]){return seedDb['default']();}})['then'](function(){return checkLicense['default']();})[_0x4529('0xe')](function(){return rpc[_0x4529('0x10')]();})[_0x4529('0xe')](function(_0x579574){logger[_0x4529('0x11')](_0x579574);return chat[_0x4529('0x12')]();})[_0x4529('0xe')](function(){return whatsapp[_0x4529('0x12')]();})[_0x4529('0xe')](function(){return schedule[_0x4529('0x12')]();})['then'](function(){return transcribe['start']();})[_0x4529('0xe')](function(){return provider[_0x4529('0x12')]();})['then'](function(_0x2539ea){logger['info'](_0x2539ea);return pm2[_0x4529('0x12')](pm2Config);})[_0x4529('0xe')](function(_0x19dff1){var _0x3313e0=_0x19dff1['filter'](function(_0x3fa1a0){return typeof _0x3fa1a0[_0x4529('0x13')]===_0x4529('0x14')&&_0x3fa1a0['exitCode']>=0x0;});if(_0x3313e0[_0x4529('0x15')]>0x0){throw new Error(_0x3313e0[_0x4529('0x15')]+_0x4529('0x16')+_[_0x4529('0x17')](_0x3313e0,function(_0x4e17dd){return'\x22'+_0x4e17dd[_0x4529('0x18')][_0x4529('0x19')]+'\x22';}));}logger['info'](_0x4529('0x1a'),_[_0x4529('0x17')](_[_0x4529('0x1b')](_0x19dff1,{'status':'online'}),'name')[_0x4529('0x1c')]());logger[_0x4529('0x11')](_0x4529('0x1d'),_[_0x4529('0x17')](_[_0x4529('0x1b')](_0x19dff1,function(_0x5c7e39){return _0x5c7e39[_0x4529('0x1e')]!==_0x4529('0x1f');}),_0x4529('0x19'))[_0x4529('0x1c')]()||_0x4529('0x20'));console[_0x4529('0x21')]('App\x20Ready!');})[_0x4529('0x22')](function(_0xee9870){console[_0x4529('0x21')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0xee9870);logger[_0x4529('0x23')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0xee9870);process[_0x4529('0x24')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index b6156eb..486eead 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 _0xce5e=['use','user','ChatInteraction','findOne','params','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','User','find','authenticate','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','getUuid','sub','Setting','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blockDuration','add','minutes','Invalid\x20API\x20access\x20key','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','apikey','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','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','decryptString','split','length','splice','unshift','encryptString','join','promisify','sign','secret','session','payload','verify','secrets','randomBytes','toString','hex','floor','../../mysqldb','../encryptor','express-jwt','basic-auth','crypto','bluebird','util','moment','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification'];(function(_0x39ef3c,_0x51e30a){var _0x4e95df=function(_0x539514){while(--_0x539514){_0x39ef3c['push'](_0x39ef3c['shift']());}};_0x4e95df(++_0x51e30a);}(_0xce5e,0x1f0));var _0xece5=function(_0x73d8d2,_0x53f65c){_0x73d8d2=_0x73d8d2-0x0;var _0x46a017=_0xce5e[_0x73d8d2];return _0x46a017;};'use strict';var db=require(_0xece5('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0xece5('0x1'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0xece5('0x2'));var compose=require('composable-middleware');var basicAuth=require(_0xece5('0x3'));var crypto=require(_0xece5('0x4'));var BPromise=require(_0xece5('0x5'));var util=require(_0xece5('0x6'));var moment=require(_0xece5('0x7'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xece5('0x8'),_0xece5('0x9'),_0xece5('0xa'),_0xece5('0xb'),_0xece5('0xc'),_0xece5('0xd'),_0xece5('0xe'),_0xece5('0xf'),_0xece5('0x10'),_0xece5('0x11'),_0xece5('0x12'),_0xece5('0x13'),_0xece5('0x14'),_0xece5('0x15'),_0xece5('0x16'),_0xece5('0x17'),_0xece5('0x18'),_0xece5('0x19'),'crudPermissions','allowmessenger',_0xece5('0x1a'),_0xece5('0x1b'),_0xece5('0x1c'),_0xece5('0x1d'),_0xece5('0x1e'),_0xece5('0x1f'),_0xece5('0x20'),_0xece5('0x21'),_0xece5('0x22'),_0xece5('0x23'),_0xece5('0x24'),'phoneBarRemoteControlPort',_0xece5('0x25'),_0xece5('0x26'),'userProfileId',_0xece5('0x27'),_0xece5('0x28'),_0xece5('0x29'),_0xece5('0x2a'),'downloadOmnichannelInteractions',_0xece5('0x2b'),_0xece5('0x2c'),'selectRecallMeCampaign',_0xece5('0x2d'),_0xece5('0x2e'),_0xece5('0x2f'),_0xece5('0x30'),'smsAutoanswer',_0xece5('0x31'),_0xece5('0x32'),_0xece5('0x33'),_0xece5('0x34'),_0xece5('0x35'),'whatsappAutoanswer',_0xece5('0x36'),_0xece5('0x37')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0xece5('0x38')](function(_0x5dfc3d,_0x2ce41b,_0x35d22d){if(_0x5dfc3d[_0xece5('0x39')]){_0x35d22d();}else{return db[_0xece5('0x3a')][_0xece5('0x3b')]({'where':{'id':_0x5dfc3d[_0xece5('0x3c')]['id']},'attributes':['id',_0xece5('0x3d'),'disposition'],'raw':!![]})[_0xece5('0x3e')](function(_0x3086cd){if(_0x3086cd&&_0x3086cd[_0xece5('0x3d')]&&!_0x5dfc3d['query']['forceDownload']){return _0x2ce41b[_0xece5('0x3f')](_0x3086cd[_0xece5('0x40')]===_0xece5('0x41')?0x195:0x193)[_0xece5('0x42')]({'message':_0x3086cd[_0xece5('0x40')]===_0xece5('0x41')?_0xece5('0x43'):_0xece5('0x44')});}else{_0x35d22d();}})[_0xece5('0x45')](function(_0x1ae9af){_0x35d22d(_0x1ae9af);});}});};exports[_0xece5('0x46')]=function isAuthenticated(_0x3b3f31){return compose()[_0xece5('0x38')](function(_0x55e9e8,_0x3e06eb,_0x5e17ac){var _0x5c486c;if(_0x55e9e8[_0xece5('0x47')][_0xece5('0x48')]){if(_[_0xece5('0x49')](_0x55e9e8[_0xece5('0x47')][_0xece5('0x48')],_0xece5('0x4a'))){var _0x1f844c=basicAuth(_0x55e9e8);db[_0xece5('0x4b')][_0xece5('0x4c')]({'where':{'name':_0x1f844c[_0xece5('0xa')]}})[_0xece5('0x3e')](function(_0x843f25){if(!_0x843f25||!_0x843f25[_0xece5('0x4d')](_0x1f844c['pass'])){return _0x3e06eb[_0xece5('0x3f')](0x191)[_0xece5('0x42')]({'message':_0xece5('0x4e')});}_0x55e9e8['user']={'id':_0x843f25['id']};_0x5e17ac();})['catch'](function(_0x52b025){_0x5e17ac(_0x52b025);});}else if(_[_0xece5('0x49')](_0x55e9e8['headers'][_0xece5('0x48')],_0xece5('0x4f'))){validateJwt(_0x55e9e8,_0x3e06eb,_0x5e17ac);}else{if(_0x3b3f31){_0x5e17ac();}else{return _0x3e06eb[_0xece5('0x3f')](0x193)[_0xece5('0x42')]({'message':_0xece5('0x50')});}}}else if(_0x55e9e8[_0xece5('0x51')]['apikey']){try{var _0x108272={'audience':hardwareConf[_0xece5('0x52')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x55e9e8[_0xece5('0x51')]['apikey'],_0x108272)[_0xece5('0x3e')](function(_0x324393){return db[_0xece5('0x4b')][_0xece5('0x4c')]({'where':{'id':_0x324393[_0xece5('0x53')]}})['then'](function(_0x1f0949){_0x5c486c=_0x1f0949;return db[_0xece5('0x54')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0xece5('0x3e')](function(_0xeaf812){if(!_0x5c486c||!_[_0xece5('0x55')](_0x5c486c[_0xece5('0x56')],_0x324393['nonce'])){return _0x3e06eb['status'](0x191)[_0xece5('0x42')]({'message':_0xece5('0x57')});}if(_0x5c486c['disabled']){return _0x3e06eb[_0xece5('0x3f')](0x191)[_0xece5('0x42')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x5c486c['blocked']){if(_0xeaf812[_0xece5('0x58')]>0x0){if(moment(_0x5c486c['blockedAt'])[_0xece5('0x59')](_0xeaf812[_0xece5('0x58')],_0xece5('0x5a'))>moment()){return _0x3e06eb[_0xece5('0x3f')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x3e06eb['status'](0x191)[_0xece5('0x42')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x55e9e8[_0xece5('0x39')]={'id':_0x5c486c['id']};_0x5e17ac();});})[_0xece5('0x45')](function(){return _0x3e06eb[_0xece5('0x3f')](0x191)['json']({'message':_0xece5('0x5b')});});}catch(_0x1a0e0d){_0x5e17ac(_0x1a0e0d);}}else if(_0x3b3f31){_0x5e17ac();}else{return _0x3e06eb[_0xece5('0x3f')](0x193)[_0xece5('0x42')]({'message':'Unknown\x20authorization\x20format'});}})[_0xece5('0x38')](function(_0x2a04bc,_0x597918,_0x1ee5a4){if(_0x2a04bc[_0xece5('0x39')]){db[_0xece5('0x4b')][_0xece5('0x4c')]({'where':{'id':_0x2a04bc['user']['id']},'attributes':userAttributes})[_0xece5('0x3e')](function(_0x5aa2e2){if(!_0x5aa2e2){return _0x597918[_0xece5('0x3f')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x2a04bc[_0xece5('0x39')]=_0x5aa2e2;_0x1ee5a4();})['catch'](function(_0x1f1124){_0x1ee5a4(_0x1f1124);});}else if(_0x3b3f31){_0x1ee5a4();}else{return _0x597918['status'](0x194)[_0xece5('0x42')]({'message':_0xece5('0x5c')});}});};exports[_0xece5('0x5d')]=function canUpdate(){return compose()[_0xece5('0x38')](function(_0x4efc4,_0x54abc0,_0x1194b3){return licenseUtil[_0xece5('0x5e')]()[_0xece5('0x3e')](function(_0x362659){if(_0x362659['update']){_0x1194b3();}else{return _0x54abc0[_0xece5('0x3f')](0x193)[_0xece5('0x42')]({'message':_0xece5('0x5f')});}})[_0xece5('0x45')](function(_0x3f0004){_0x1194b3(_0x3f0004);});});};exports[_0xece5('0x60')]=function isWebrtcLicence(){return compose()[_0xece5('0x38')](function(_0x3d13dc,_0x392e80,_0x30947a){return licenseUtil[_0xece5('0x5e')]()[_0xece5('0x3e')](function(_0x546551){if(_0x546551['webrtc']){_0x30947a();}else{return _0x392e80[_0xece5('0x3f')](0x193)[_0xece5('0x42')]({'message':_0xece5('0x5f')});}})[_0xece5('0x45')](function(_0x5adb11){_0x30947a(_0x5adb11);});});};exports[_0xece5('0x61')]=function(_0x4e350a,_0x331b48,_0x35104b){_0x4e350a[_0xece5('0x61')]=!![];return _0x35104b();};exports[_0xece5('0x62')]=function signToken(_0x7c6c1b){return signJwt(_0x7c6c1b);};exports[_0xece5('0x63')]=function(_0x430477,_0x376b7d){if(!_0x430477['user']){return _0x376b7d[_0xece5('0x3f')](0x194)['json']({'message':_0xece5('0x64')});}var _0x2a4659={'payload':{'id':_0x430477[_0xece5('0x39')]['id'],'role':_0x430477[_0xece5('0x39')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x2a4659)[_0xece5('0x3e')](function(_0x3231c1){_0x376b7d['cookie'](_0xece5('0x65'),_0x3231c1);_0x376b7d[_0xece5('0x66')](_0xece5('0x67'));})['catch'](function(_0x495e67){return _0x376b7d[_0xece5('0x3f')](0x1f4)['send'](_0x495e67);});};exports[_0xece5('0x68')]=function(_0xe09acf){if(_[_0xece5('0x69')](_0xe09acf[_0xece5('0x56')])||_[_0xece5('0x69')](_0xe09acf[_0xece5('0x6a')])){return null;}else{return createJwt(_0xe09acf);}};exports[_0xece5('0x6b')]=function(_0x251d71){_0x251d71[_0xece5('0x56')]=generateNonce();_0x251d71['apiKeyIat']=generateIssuedAt();return createJwt(_0x251d71);};exports[_0xece5('0x6c')]=function(_0x3dbc1c,_0x5cd7c8){var _0xc6730=_0x3dbc1c[_0xece5('0x51')][_0xece5('0x6d')];if(_0xc6730){var _0x26c132={'nonce':_0x5cd7c8[_0xece5('0x56')],'iat':_0x5cd7c8['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xece5('0x52')]()};return verifyJwt(_0xc6730,_0x26c132)[_0xece5('0x3e')](function(){return generateApiKey(_0x5cd7c8);});}else{throw{'message':_0xece5('0x6e')};}};exports[_0xece5('0x6f')]=function(_0x2414a2){var _0x3cbb5a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3cbb5a['test'](_0x2414a2))throw new db[(_0xece5('0x70'))]['ValidationError'](_0xece5('0x71'));return;};exports[_0xece5('0x72')]=function(_0x2f43c7,_0x42c97b,_0x2dace5){var _0x3ce7db=encryptor['decryptString'](_0x42c97b)['split'](',');for(var _0xf62f8f=0x0;_0xf62f8f<_0x2dace5;_0xf62f8f++){if(!_0x3ce7db[_0xf62f8f])break;if(_0x2f43c7[_0xece5('0x73')]()===_0x3ce7db[_0xf62f8f]['toLowerCase']()){var _0x551a27=util['format'](_0xece5('0x74'),_0x2dace5);if(_0x2dace5===0x1){_0x551a27=_0xece5('0x75');}throw new db[(_0xece5('0x70'))][(_0xece5('0x76'))](_0x551a27);}}return;};exports[_0xece5('0x77')]=function(_0x4cdc40,_0x4adbc7){var _0x5813af=_0x4adbc7?encryptor[_0xece5('0x78')](_0x4adbc7)[_0xece5('0x79')](','):[];if(_0x5813af[_0xece5('0x7a')]===0x5){_0x5813af[_0xece5('0x7b')](-0x1,0x1);}_0x5813af[_0xece5('0x7c')](_0x4cdc40);return encryptor[_0xece5('0x7d')](_0x5813af[_0xece5('0x7e')](','));};function signJwt(_0x513903){var _0x595b5f=BPromise[_0xece5('0x7f')](jwt[_0xece5('0x80')],{'context':jwt});var _0x542b58=_0x513903[_0xece5('0x81')]||config['secrets'][_0xece5('0x82')];return new BPromise(function(_0x2f4238,_0xb035a8){_0x595b5f(_0x513903[_0xece5('0x83')],_0x542b58,_0x513903['options'])[_0xece5('0x3e')](function(_0x50e2ef){_0x2f4238(_0x50e2ef);})[_0xece5('0x45')](function(_0xbe0ebb){_0xb035a8(_0xbe0ebb);});});}function verifyJwt(_0x51136b,_0x4265f3,_0x1336ce){var _0x305aac=BPromise[_0xece5('0x7f')](jwt[_0xece5('0x84')],{'context':jwt});var _0x10821b=_0x1336ce||config[_0xece5('0x85')][_0xece5('0x82')];return new BPromise(function(_0x344f1e,_0x45ef55){_0x305aac(_0x51136b,_0x10821b,_0x4265f3)[_0xece5('0x3e')](function(_0x3c7145){_0x344f1e(_0x3c7145);})[_0xece5('0x45')](function(_0x5d638e){_0x45ef55(_0x5d638e);});});}function generateNonce(){return crypto[_0xece5('0x86')](0x10)[_0xece5('0x87')](_0xece5('0x88'));}function generateIssuedAt(){return Math[_0xece5('0x89')](Date['now']()/0x3e8)[_0xece5('0x87')]();}function createJwt(_0xd52f17){var _0x2dd669={'payload':{'iat':_0xd52f17['apiKeyIat'],'nonce':_0xd52f17[_0xece5('0x56')]},'options':{'algorithm':'HS512','subject':_0xd52f17['id']['toString'](),'issuer':hardwareConf[_0xece5('0x52')](),'audience':hardwareConf[_0xece5('0x52')]()}};return signJwt(_0x2dd669)[_0xece5('0x3e')](function(_0x101390){return{'iat':_0xd52f17['apiKeyIat'],'nonce':_0xd52f17[_0xece5('0x56')],'token':_0x101390};});} \ No newline at end of file +var _0x2aa4=['../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','session','role','fullname','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','user','ChatInteraction','findOne','closed','forceDownload','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','use','headers','authorization','startsWith','Basic','User','find','name','then','pass','Wrong\x20credentials.','Bearer','status','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockedAt','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','isMiddleware','cookie','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','encryptString','join','promisify','sign','secrets','payload','hex','floor','now','toString','HS512','../../config/environment'];(function(_0x58bad5,_0x25e45){var _0x438344=function(_0x2a8451){while(--_0x2a8451){_0x58bad5['push'](_0x58bad5['shift']());}};_0x438344(++_0x25e45);}(_0x2aa4,0x8c));var _0x42aa=function(_0x3f4fd5,_0x581a7e){_0x3f4fd5=_0x3f4fd5-0x0;var _0x5b765f=_0x2aa4[_0x3f4fd5];return _0x5b765f;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x42aa('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0x42aa('0x1'));var _=require(_0x42aa('0x2'));var jwt=require(_0x42aa('0x3'));var expressJwt=require(_0x42aa('0x4'));var compose=require(_0x42aa('0x5'));var basicAuth=require(_0x42aa('0x6'));var crypto=require(_0x42aa('0x7'));var BPromise=require(_0x42aa('0x8'));var util=require(_0x42aa('0x9'));var moment=require(_0x42aa('0xa'));var validateJwt=expressJwt({'secret':config['secrets'][_0x42aa('0xb')]});var userAttributes=['id',_0x42aa('0xc'),_0x42aa('0xd'),'name','internal',_0x42aa('0xe'),_0x42aa('0xf'),_0x42aa('0x10'),_0x42aa('0x11'),_0x42aa('0x12'),_0x42aa('0x13'),_0x42aa('0x14'),_0x42aa('0x15'),'smsPause',_0x42aa('0x16'),_0x42aa('0x17'),'showWebBar','lastLoginAt',_0x42aa('0x18'),_0x42aa('0x19'),'allowmessenger',_0x42aa('0x1a'),_0x42aa('0x1b'),_0x42aa('0x1c'),_0x42aa('0x1d'),_0x42aa('0x1e'),_0x42aa('0x1f'),_0x42aa('0x20'),_0x42aa('0x21'),_0x42aa('0x22'),_0x42aa('0x23'),_0x42aa('0x24'),_0x42aa('0x25'),_0x42aa('0x26'),_0x42aa('0x27'),_0x42aa('0x28'),_0x42aa('0x29'),_0x42aa('0x2a'),_0x42aa('0x2b'),_0x42aa('0x2c'),_0x42aa('0x2d'),_0x42aa('0x2e'),'ignorePauseForPreviewCalls',_0x42aa('0x2f'),_0x42aa('0x30'),_0x42aa('0x31'),_0x42aa('0x32'),_0x42aa('0x33'),_0x42aa('0x34'),'smsAutoanswerDelay',_0x42aa('0x35'),_0x42aa('0x36'),_0x42aa('0x37'),_0x42aa('0x38'),_0x42aa('0x39'),_0x42aa('0x3a'),_0x42aa('0x3b')];exports[_0x42aa('0x3c')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x2ef6a4,_0x5bb570,_0x1673df){if(_0x2ef6a4[_0x42aa('0x3d')]){_0x1673df();}else{return db[_0x42aa('0x3e')][_0x42aa('0x3f')]({'where':{'id':_0x2ef6a4['params']['id']},'attributes':['id','closed','disposition'],'raw':!![]})['then'](function(_0x4792b3){if(_0x4792b3&&_0x4792b3[_0x42aa('0x40')]&&!_0x2ef6a4['query'][_0x42aa('0x41')]){return _0x5bb570['status'](_0x4792b3[_0x42aa('0x42')]===_0x42aa('0x43')?0x195:0x193)[_0x42aa('0x44')]({'message':_0x4792b3[_0x42aa('0x42')]===_0x42aa('0x43')?_0x42aa('0x45'):_0x42aa('0x46')});}else{_0x1673df();}})[_0x42aa('0x47')](function(_0x12719a){_0x1673df(_0x12719a);});}});};exports[_0x42aa('0x48')]=function isAuthenticated(_0x33e322){return compose()[_0x42aa('0x49')](function(_0x4e3310,_0x4667db,_0x240370){var _0x2032f1;if(_0x4e3310[_0x42aa('0x4a')][_0x42aa('0x4b')]){if(_[_0x42aa('0x4c')](_0x4e3310[_0x42aa('0x4a')]['authorization'],_0x42aa('0x4d'))){var _0x538f49=basicAuth(_0x4e3310);db[_0x42aa('0x4e')][_0x42aa('0x4f')]({'where':{'name':_0x538f49[_0x42aa('0x50')]}})[_0x42aa('0x51')](function(_0x4ab9ba){if(!_0x4ab9ba||!_0x4ab9ba['authenticate'](_0x538f49[_0x42aa('0x52')])){return _0x4667db['status'](0x191)[_0x42aa('0x44')]({'message':_0x42aa('0x53')});}_0x4e3310['user']={'id':_0x4ab9ba['id']};_0x240370();})['catch'](function(_0x382471){_0x240370(_0x382471);});}else if(_['startsWith'](_0x4e3310[_0x42aa('0x4a')][_0x42aa('0x4b')],_0x42aa('0x54'))){validateJwt(_0x4e3310,_0x4667db,_0x240370);}else{if(_0x33e322){_0x240370();}else{return _0x4667db[_0x42aa('0x55')](0x193)[_0x42aa('0x44')]({'message':_0x42aa('0x56')});}}}else if(_0x4e3310['query'][_0x42aa('0x57')]){try{var _0xe4c921={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x42aa('0x58')]()};verifyJwt(_0x4e3310[_0x42aa('0x59')]['apikey'],_0xe4c921)['then'](function(_0xfb936d){return db[_0x42aa('0x4e')][_0x42aa('0x4f')]({'where':{'id':_0xfb936d[_0x42aa('0x5a')]}})[_0x42aa('0x51')](function(_0x36eab4){_0x2032f1=_0x36eab4;return db[_0x42aa('0x5b')][_0x42aa('0x3f')]({'where':{'id':0x1},'attributes':[_0x42aa('0x5c'),_0x42aa('0x5d')],'raw':!![]});})[_0x42aa('0x51')](function(_0x29613b){if(!_0x2032f1||!_[_0x42aa('0x5e')](_0x2032f1[_0x42aa('0x5f')],_0xfb936d[_0x42aa('0x60')])){return _0x4667db[_0x42aa('0x55')](0x191)[_0x42aa('0x44')]({'message':_0x42aa('0x61')});}if(_0x2032f1[_0x42aa('0x62')]){return _0x4667db[_0x42aa('0x55')](0x191)[_0x42aa('0x44')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x2032f1['blocked']){if(_0x29613b[_0x42aa('0x5d')]>0x0){if(moment(_0x2032f1[_0x42aa('0x63')])['add'](_0x29613b['blockDuration'],_0x42aa('0x64'))>moment()){return _0x4667db[_0x42aa('0x55')](0x191)[_0x42aa('0x44')]({'message':_0x42aa('0x65')});}}else{return _0x4667db[_0x42aa('0x55')](0x191)[_0x42aa('0x44')]({'message':_0x42aa('0x65')});}}_0x4e3310[_0x42aa('0x3d')]={'id':_0x2032f1['id']};_0x240370();});})[_0x42aa('0x47')](function(){return _0x4667db[_0x42aa('0x55')](0x191)[_0x42aa('0x44')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x35eb46){_0x240370(_0x35eb46);}}else if(_0x33e322){_0x240370();}else{return _0x4667db[_0x42aa('0x55')](0x193)[_0x42aa('0x44')]({'message':_0x42aa('0x56')});}})[_0x42aa('0x49')](function(_0xeb583,_0xe0fc21,_0x33a428){if(_0xeb583[_0x42aa('0x3d')]){db[_0x42aa('0x4e')][_0x42aa('0x4f')]({'where':{'id':_0xeb583[_0x42aa('0x3d')]['id']},'attributes':userAttributes})[_0x42aa('0x51')](function(_0x57270a){if(!_0x57270a){return _0xe0fc21[_0x42aa('0x55')](0x194)[_0x42aa('0x44')]({'message':_0x42aa('0x66')});}_0xeb583[_0x42aa('0x3d')]=_0x57270a;_0x33a428();})[_0x42aa('0x47')](function(_0x3d4854){_0x33a428(_0x3d4854);});}else if(_0x33e322){_0x33a428();}else{return _0xe0fc21['status'](0x194)[_0x42aa('0x44')]({'message':_0x42aa('0x67')});}});};exports[_0x42aa('0x68')]=function canUpdate(){return compose()[_0x42aa('0x49')](function(_0x5619af,_0x207042,_0x48ca1f){return licenseUtil['getLicense']()[_0x42aa('0x51')](function(_0x2079a0){if(_0x2079a0[_0x42aa('0x69')]){_0x48ca1f();}else{return _0x207042[_0x42aa('0x55')](0x193)[_0x42aa('0x44')]({'message':_0x42aa('0x6a')});}})[_0x42aa('0x47')](function(_0xf00430){_0x48ca1f(_0xf00430);});});};exports[_0x42aa('0x6b')]=function isWebrtcLicence(){return compose()[_0x42aa('0x49')](function(_0x588ac3,_0x48ac8e,_0x5b31ba){return licenseUtil[_0x42aa('0x6c')]()[_0x42aa('0x51')](function(_0x25d23d){if(_0x25d23d['webrtc']){_0x5b31ba();}else{return _0x48ac8e[_0x42aa('0x55')](0x193)[_0x42aa('0x44')]({'message':_0x42aa('0x6a')});}})[_0x42aa('0x47')](function(_0x580943){_0x5b31ba(_0x580943);});});};exports['isMiddleware']=function(_0x320350,_0x2e68de,_0x22b9ea){_0x320350[_0x42aa('0x6d')]=!![];return _0x22b9ea();};exports['signToken']=function signToken(_0x87eb5a){return signJwt(_0x87eb5a);};exports['setTokenCookie']=function(_0x4e2517,_0xc1d21d){if(!_0x4e2517[_0x42aa('0x3d')]){return _0xc1d21d[_0x42aa('0x55')](0x194)[_0x42aa('0x44')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x26b412={'payload':{'id':_0x4e2517[_0x42aa('0x3d')]['id'],'role':_0x4e2517['user'][_0x42aa('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x26b412)[_0x42aa('0x51')](function(_0x5aa9d4){_0xc1d21d[_0x42aa('0x6e')]('motion.token',_0x5aa9d4);_0xc1d21d[_0x42aa('0x6f')]('/dashboards/general');})['catch'](function(_0x208832){return _0xc1d21d[_0x42aa('0x55')](0x1f4)[_0x42aa('0x70')](_0x208832);});};exports[_0x42aa('0x71')]=function(_0x4dbe45){if(_[_0x42aa('0x72')](_0x4dbe45[_0x42aa('0x5f')])||_['isNil'](_0x4dbe45[_0x42aa('0x73')])){return null;}else{return createJwt(_0x4dbe45);}};exports[_0x42aa('0x74')]=function(_0x4dc2fb){_0x4dc2fb[_0x42aa('0x5f')]=generateNonce();_0x4dc2fb[_0x42aa('0x73')]=generateIssuedAt();return createJwt(_0x4dc2fb);};exports[_0x42aa('0x75')]=function(_0x4f8a91,_0x2fb5e0){var _0x5048ff=_0x4f8a91[_0x42aa('0x59')][_0x42aa('0x57')];if(_0x5048ff){var _0xed62bc={'nonce':_0x2fb5e0[_0x42aa('0x5f')],'iat':_0x2fb5e0[_0x42aa('0x73')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x42aa('0x58')]()};return verifyJwt(_0x5048ff,_0xed62bc)[_0x42aa('0x51')](function(){return generateApiKey(_0x2fb5e0);});}else{throw{'message':_0x42aa('0x76')};}};exports[_0x42aa('0x77')]=function(_0x2a28e3){var _0x104d0e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x104d0e['test'](_0x2a28e3))throw new db['Sequelize']['ValidationError'](_0x42aa('0x78'));return;};exports[_0x42aa('0x79')]=function(_0x3640e7,_0x214923,_0x5660d7){var _0x44e199=encryptor['decryptString'](_0x214923)[_0x42aa('0x7a')](',');for(var _0x19c080=0x0;_0x19c080<_0x5660d7;_0x19c080++){if(!_0x44e199[_0x19c080])break;if(_0x3640e7[_0x42aa('0x7b')]()===_0x44e199[_0x19c080]['toLowerCase']()){var _0x44906c=util[_0x42aa('0x7c')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x5660d7);if(_0x5660d7===0x1){_0x44906c=_0x42aa('0x7d');}throw new db[(_0x42aa('0x7e'))]['ValidationError'](_0x44906c);}}return;};exports[_0x42aa('0x7f')]=function(_0x583dd6,_0x415deb){var _0x6ebc97=_0x415deb?encryptor['decryptString'](_0x415deb)[_0x42aa('0x7a')](','):[];if(_0x6ebc97[_0x42aa('0x80')]===0x5){_0x6ebc97[_0x42aa('0x81')](-0x1,0x1);}_0x6ebc97['unshift'](_0x583dd6);return encryptor[_0x42aa('0x82')](_0x6ebc97[_0x42aa('0x83')](','));};function signJwt(_0x29b2e8){var _0x1d2bce=BPromise[_0x42aa('0x84')](jwt[_0x42aa('0x85')],{'context':jwt});var _0x2395e0=_0x29b2e8['secret']||config[_0x42aa('0x86')]['session'];return new BPromise(function(_0x1a6782,_0x1d467b){_0x1d2bce(_0x29b2e8[_0x42aa('0x87')],_0x2395e0,_0x29b2e8['options'])['then'](function(_0x352756){_0x1a6782(_0x352756);})['catch'](function(_0x45de90){_0x1d467b(_0x45de90);});});}function verifyJwt(_0x17258d,_0x33caa9,_0x5129fa){var _0x1e7967=BPromise[_0x42aa('0x84')](jwt['verify'],{'context':jwt});var _0x17e492=_0x5129fa||config[_0x42aa('0x86')]['session'];return new BPromise(function(_0x34e83d,_0x4ae327){_0x1e7967(_0x17258d,_0x17e492,_0x33caa9)[_0x42aa('0x51')](function(_0x3e01d1){_0x34e83d(_0x3e01d1);})[_0x42aa('0x47')](function(_0x9305a5){_0x4ae327(_0x9305a5);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x42aa('0x88'));}function generateIssuedAt(){return Math[_0x42aa('0x89')](Date[_0x42aa('0x8a')]()/0x3e8)[_0x42aa('0x8b')]();}function createJwt(_0x4ddae6){var _0x23649c={'payload':{'iat':_0x4ddae6['apiKeyIat'],'nonce':_0x4ddae6[_0x42aa('0x5f')]},'options':{'algorithm':_0x42aa('0x8c'),'subject':_0x4ddae6['id']['toString'](),'issuer':hardwareConf[_0x42aa('0x58')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x23649c)['then'](function(_0x2edcec){return{'iat':_0x4ddae6[_0x42aa('0x73')],'nonce':_0x4ddae6[_0x42aa('0x5f')],'token':_0x2edcec};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 9376bef..4803be9 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7be=['tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','User','clause','getFilteredContacts','describe','CmContact','filter','startsWith','cf_','map','CmCustomField','findOne','slice','length','fieldType','keys','type','catch','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','user'];(function(_0x305022,_0x2d2c28){var _0x33d739=function(_0x59b63c){while(--_0x59b63c){_0x305022['push'](_0x305022['shift']());}};_0x33d739(++_0x2d2c28);}(_0xd7be,0xfb));var _0xed7b=function(_0x4afb48,_0x21e3d6){_0x4afb48=_0x4afb48-0x0;var _0x5b166c=_0xd7be[_0x4afb48];return _0x5b166c;};'use strict';var _=require(_0xed7b('0x0'));var sqlUtils=require(_0xed7b('0x1'));var db=require(_0xed7b('0x2'))['db'];exports[_0xed7b('0x3')]=function(_0x23c1a3,_0x3512fb,_0x221e6,_0x1e66dc){var _0xc752ac={'count':0x0,'rows':[]};var _0x3f0132=sqlUtils[_0xed7b('0x4')](_0x3512fb,_0x23c1a3);if(_0x3f0132){return Promise[_0xed7b('0x5')](_0xc752ac);}var _0x336276=sqlUtils[_0xed7b('0x6')]();var _0x1ac7d0={};var _0x44ea6f=![];var _0x4f2059=![];return Promise['resolve']()[_0xed7b('0x7')](function(){if(_0x23c1a3[_0xed7b('0x8')]){return sqlUtils[_0xed7b('0x9')](_0x23c1a3[_0xed7b('0x8')],_0x1e66dc);}else{return sqlUtils[_0xed7b('0xa')](_0x23c1a3,_0x1e66dc);}})[_0xed7b('0x7')](function(_0x11f34c){_0x336276[_0xed7b('0xb')](_0x11f34c[_0xed7b('0xc')]);_0x336276['where'](_0x11f34c[_0xed7b('0xd')]);_0x336276['where'](_0x11f34c['filter']);_0x336276[_0xed7b('0xb')](_0x11f34c[_0xed7b('0xe')]['clause']);_0x1ac7d0=_0x11f34c[_0xed7b('0xf')];_0x4f2059=_0x11f34c[_0xed7b('0xe')][_0xed7b('0x10')];return sqlUtils[_0xed7b('0x11')](_0x3512fb,_0x23c1a3,_0x4f2059);})[_0xed7b('0x7')](function(_0x10db00){_0x336276[_0xed7b('0xb')](_0x10db00);var _0x3a888d=_0x23c1a3['search']?_0x1ac7d0[_0xed7b('0x12')]:_0x23c1a3[_0xed7b('0x13')];_0x44ea6f=_0x3a888d?!![]:![];return sqlUtils[_0xed7b('0x14')](_0x336276,_0x3a888d);})['then'](function(_0x49059b){_0xc752ac['count']=_0x49059b;if(_0xc752ac['count']===0x0){return;}if(_0x23c1a3[_0xed7b('0x15')]){_0x4f2059=!![];}return sqlUtils['buildContactsQuery'](_0x336276,_0x23c1a3['fields'],_0x221e6,_0x44ea6f,_0x1ac7d0[_0xed7b('0x16')],_0x4f2059);})['then'](function(_0x2aba0e){if(!_0x2aba0e){return[];}return sqlUtils[_0xed7b('0x17')](_0x2aba0e,_0x23c1a3,_0x221e6);})[_0xed7b('0x7')](function(_0x243b6c){_0xc752ac['rows']=_0x243b6c;return _0xc752ac;})['catch'](function(_0x56505d){throw _0x56505d;});};exports[_0xed7b('0x18')]=function(){var _0x43028a={};var _0x4e55cc=[];return db[_0xed7b('0x19')][_0xed7b('0x18')]()[_0xed7b('0x7')](function(_0x1186c8){_0x43028a=_0x1186c8;var _0x24d115=Object['keys'](_0x43028a)[_0xed7b('0x1a')](function(_0x176988){return _[_0xed7b('0x1b')](_0x176988,_0xed7b('0x1c'))?_0x176988:undefined;});var _0x13b369=_0x24d115[_0xed7b('0x1d')](function(_0x534163){return db[_0xed7b('0x1e')][_0xed7b('0x1f')]({'where':{'id':_0x534163[_0xed7b('0x20')](0x3)},'raw':!![]});});return Promise['all'](_0x13b369);})['then'](function(_0x278b98){for(var _0x22a43f=0x0;_0x22a43f<_0x278b98[_0xed7b('0x21')];_0x22a43f++){if(_0x278b98[_0x22a43f]){var _0x4c018c='cf_'+_0x278b98[_0x22a43f]['id'];_0x43028a[_0x4c018c][_0xed7b('0x22')]=_0x278b98[_0x22a43f]['type'];}}_0x4e55cc=_[_0xed7b('0x1d')](Object[_0xed7b('0x23')](_0x43028a),function(_0xa8d04f){return{'name':_0xa8d04f,'type':_0x43028a[_0xa8d04f][_0xed7b('0x24')]};});return _0x4e55cc;})[_0xed7b('0x25')](function(_0x15fa18){throw _0x15fa18;});}; \ No newline at end of file +var _0x8ef7=['skipContactsQuery','getContactsSubquery','resolve','search','parseQueryParameters','where','filter','user','tags','skip','then','ids','tag','countFilteredContacts','count','User','buildContactsQuery','rows','catch','describe','CmContact','keys','startsWith','all','fieldType','map','type','../../mysqldb'];(function(_0x3ca06c,_0x27e494){var _0x33231a=function(_0x451594){while(--_0x451594){_0x3ca06c['push'](_0x3ca06c['shift']());}};_0x33231a(++_0x27e494);}(_0x8ef7,0x14f));var _0x78ef=function(_0x2a2553,_0xce8a50){_0x2a2553=_0x2a2553-0x0;var _0x2fc9cd=_0x8ef7[_0x2a2553];return _0x2fc9cd;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var db=require(_0x78ef('0x0'))['db'];exports['findAll']=function(_0x38b8dd,_0x2f868a,_0x1c0c1d,_0x3d4635){var _0x359a8f={'count':0x0,'rows':[]};var _0xfa730d=sqlUtils[_0x78ef('0x1')](_0x2f868a,_0x38b8dd);if(_0xfa730d){return Promise['resolve'](_0x359a8f);}var _0x37f8f6=sqlUtils[_0x78ef('0x2')]();var _0x221969={};var _0x2c5108=![];var _0x178152=![];return Promise[_0x78ef('0x3')]()['then'](function(){if(_0x38b8dd[_0x78ef('0x4')]){return sqlUtils['parseAdvancedSearchFilter'](_0x38b8dd['search'],_0x3d4635);}else{return sqlUtils[_0x78ef('0x5')](_0x38b8dd,_0x3d4635);}})['then'](function(_0x74718a){_0x37f8f6['where'](_0x74718a['default']);_0x37f8f6[_0x78ef('0x6')](_0x74718a['fields']);_0x37f8f6[_0x78ef('0x6')](_0x74718a[_0x78ef('0x7')]);_0x37f8f6[_0x78ef('0x6')](_0x74718a[_0x78ef('0x8')]['clause']);_0x221969=_0x74718a[_0x78ef('0x9')];_0x178152=_0x74718a[_0x78ef('0x8')][_0x78ef('0xa')];return sqlUtils['checkListsRestrictions'](_0x2f868a,_0x38b8dd,_0x178152);})[_0x78ef('0xb')](function(_0x1ca8f5){_0x37f8f6[_0x78ef('0x6')](_0x1ca8f5);var _0x419714=_0x38b8dd[_0x78ef('0x4')]?_0x221969[_0x78ef('0xc')]:_0x38b8dd[_0x78ef('0xd')];_0x2c5108=_0x419714?!![]:![];return sqlUtils[_0x78ef('0xe')](_0x37f8f6,_0x419714);})[_0x78ef('0xb')](function(_0x3cfa71){_0x359a8f[_0x78ef('0xf')]=_0x3cfa71;if(_0x359a8f[_0x78ef('0xf')]===0x0){return;}if(_0x38b8dd[_0x78ef('0x10')]){_0x178152=!![];}return sqlUtils[_0x78ef('0x11')](_0x37f8f6,_0x38b8dd['fields'],_0x1c0c1d,_0x2c5108,_0x221969['clause'],_0x178152);})[_0x78ef('0xb')](function(_0x58f1c9){if(!_0x58f1c9){return[];}return sqlUtils['getFilteredContacts'](_0x58f1c9,_0x38b8dd,_0x1c0c1d);})[_0x78ef('0xb')](function(_0x3e2114){_0x359a8f[_0x78ef('0x12')]=_0x3e2114;return _0x359a8f;})[_0x78ef('0x13')](function(_0x44d20e){throw _0x44d20e;});};exports[_0x78ef('0x14')]=function(){var _0x104fc9={};var _0x7ced2d=[];return db[_0x78ef('0x15')][_0x78ef('0x14')]()[_0x78ef('0xb')](function(_0x4474c6){_0x104fc9=_0x4474c6;var _0x4fac86=Object[_0x78ef('0x16')](_0x104fc9)[_0x78ef('0x7')](function(_0x116ee2){return _[_0x78ef('0x17')](_0x116ee2,'cf_')?_0x116ee2:undefined;});var _0x33aa94=_0x4fac86['map'](function(_0x51f938){return db['CmCustomField']['findOne']({'where':{'id':_0x51f938['slice'](0x3)},'raw':!![]});});return Promise[_0x78ef('0x18')](_0x33aa94);})[_0x78ef('0xb')](function(_0x590773){for(var _0xb90176=0x0;_0xb90176<_0x590773['length'];_0xb90176++){if(_0x590773[_0xb90176]){var _0x490dfc='cf_'+_0x590773[_0xb90176]['id'];_0x104fc9[_0x490dfc][_0x78ef('0x19')]=_0x590773[_0xb90176]['type'];}}_0x7ced2d=_[_0x78ef('0x1a')](Object[_0x78ef('0x16')](_0x104fc9),function(_0x35e1ab){return{'name':_0x35e1ab,'type':_0x104fc9[_0x35e1ab][_0x78ef('0x1b')]};});return _0x7ced2d;})[_0x78ef('0x13')](function(_0xfda1dd){throw _0xfda1dd;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index bc32b8d..7b9e485 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x479d=['ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','firstName','lastName','phone','fax','CompanyId','createdAt','updatedAt','includes','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','start','value','end','Tag','split','map','tags','clause','and','ids','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','User','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','name','color','QueryTypes','SELECT','CmContact','query','toString','Tags','isEmpty','sequelize','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','role','agent','search','ListId','autocomplete','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','.id','left_join','cm_contact_has_tags'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0x479d,0x133));var _0xd479=function(_0x515a0c,_0x288768){_0x515a0c=_0x515a0c-0x0;var _0x599fb5=_0x479d[_0x515a0c];return _0x599fb5;};'use strict';var _=require(_0xd479('0x0'));var squel=require(_0xd479('0x1'));var as=require(_0xd479('0x2'));var qs=require('../parsers/qs');var utils=require(_0xd479('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x45f773,_0x5c228c){var _0x1b81fd=![];if(_0x45f773[_0xd479('0x4')]===_0xd479('0x5')&&!_0x5c228c[_0xd479('0x6')]&&!_0x5c228c[_0xd479('0x7')]&&_0x5c228c[_0xd479('0x8')]!=='true'){_0x1b81fd=!![];}return _0x1b81fd;}function getContactsSubquery(){return squel[_0xd479('0x9')]()[_0xd479('0xa')](_0xd479('0xb'),'c')['where'](_0xd479('0xc'));}function applyJoinClauses(_0x47e896,_0x2473a0){var _0x383f46=_0x2473a0?'c':_0xd479('0xd');_0x47e896['left_join']('cm_user_has_contacts','uc','uc.CmContactId\x20=\x20'+_0x383f46+_0xd479('0xe'))[_0xd479('0xf')](_0xd479('0x10'),'ct',_0xd479('0x11')+_0x383f46+_0xd479('0xe'))['left_join']('tools_tags','t',_0xd479('0x12'));return _0x47e896;}function addFieldsToQuery(_0x2ce91a,_0x4741a9,_0x6edc72,_0x5343a9,_0x12f19b){var _0x247975=_0x12f19b?'c':_0xd479('0xd');if(!_0x4741a9){_0x4741a9=['id',_0xd479('0x13'),_0xd479('0x14'),_0xd479('0x15'),'mobile',_0xd479('0x16'),'email',_0xd479('0x7'),_0xd479('0x17'),_0xd479('0x18'),_0xd479('0x19'),'deletedAt','TagIds'];}else if(!_0x4741a9[_0xd479('0x1a')]('id')){_0x4741a9[_0xd479('0x1b')]('id');}var _0x59820d=_0x6edc72&&_0x12f19b||!_0x6edc72&&!_0x12f19b;if(_0x5343a9){_0x59820d=_0x5343a9&&_0x12f19b||!_0x5343a9&&!_0x12f19b;}_0x4741a9[_0xd479('0x1c')](function(_0x14c229){if(_0x14c229===_0xd479('0x1d')){if(_0x59820d){_0x2ce91a[_0xd479('0x1e')](_0xd479('0x1f'),_0x14c229);}else if(_0x6edc72||_0x5343a9){_0x2ce91a[_0xd479('0x1e')](_0x247975+'.'+_0x14c229);}}else{_0x2ce91a[_0xd479('0x1e')](_0x247975+'.'+_0x14c229);}});return _0x2ce91a;}function getSqlClauses(){var _0x576ea7={'default':squel[_0xd479('0x20')](),'fields':squel[_0xd479('0x20')](),'filter':squel[_0xd479('0x20')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x576ea7;}function parseTagParameter(_0x3913e1){var _0xa69ba9=squel[_0xd479('0x20')]();if(_0x3913e1){var _0x1c6daf=utils[_0xd479('0x21')](_0x3913e1);_0x1c6daf[_0xd479('0x1c')](function(_0x174905){_0xa69ba9['or'](_0xd479('0x22'),'%,'+_0x174905+',%');});}return _0xa69ba9;}function parseSearchFilter(_0x1949e2){var _0x46094c=squel[_0xd479('0x20')]();if(_0x1949e2){var _0x33a860=_0x1949e2[_0xd479('0x23')]('\x5c','\x5c\x5c')[_0xd479('0x23')](/'/g,'\x27\x27');if(_0x33a860['split']('\x20')[_0xd479('0x24')]>0x1){_0x46094c['or'](_0xd479('0x25'),qs[_0xd479('0x26')](_0x33a860,!![]),null);}else{if(qs[_0xd479('0x27')](_0x33a860)){_0x46094c['or'](_0xd479('0x28'),_0x33a860+'%');_0x46094c['or'](_0xd479('0x29'),_0x33a860+'%');_0x46094c['or']('c.mobile\x20LIKE\x20?',_0x33a860+'%');_0x46094c['or']('c.fax\x20LIKE\x20?',_0x33a860+'%');}else if(qs[_0xd479('0x2a')](_0x33a860)){_0x46094c['or']('c.email\x20LIKE\x20?',_0x33a860+'%');}else{_0x46094c['or'](_0xd479('0x2b'),'%'+_0x33a860+'%');_0x46094c['or'](_0xd479('0x2c'),'%'+_0x33a860+'%');_0x46094c['or'](_0xd479('0x2d'),'%'+_0x33a860+'%');}}}return _0x46094c;}function parseAdvancedSearchFilter(_0x417d89,_0x2583ac){var _0x39c998=getSqlClauses();var _0x595e5f=as[_0xd479('0x2e')](_0x417d89);var _0x2a2c50=_0x595e5f[_0xd479('0x2f')];for(var _0x1cc083=0x0;_0x1cc083<_0x595e5f[_0xd479('0x30')][_0xd479('0x24')];_0x1cc083++){var _0x55f3ee=_0x595e5f[_0xd479('0x30')][_0x1cc083];var _0x1b3c09='c';var _0x36ad37=_[_0xd479('0x31')](_0x2583ac,['name',_0x55f3ee['field']]);if(_0x36ad37){if(_0x55f3ee[_0xd479('0x1e')]===_0xd479('0x32')||_0x36ad37[_0xd479('0x33')]===_0xd479('0x34')){_0x55f3ee[_0xd479('0x35')]=_0xd479('0x36');}var _0x1a303d=as[_0xd479('0x37')](_0x1b3c09,_0x36ad37[_0xd479('0x38')],_0x55f3ee);_0x39c998[_0xd479('0x39')][_0x2a2c50](_0x1a303d['text'],_0x1a303d['value'][_0xd479('0x3a')],_0x1a303d[_0xd479('0x3b')][_0xd479('0x3c')]);}else{if(_0x55f3ee['field']===_0xd479('0x3d')){var _0x5f2c10=_0x55f3ee[_0xd479('0x3b')][_0xd479('0x3e')](',')[_0xd479('0x3f')](function(_0x4a5295){return Number(_0x4a5295);});var _0x2697ed=parseTagParameter(_0x5f2c10);_0x39c998[_0xd479('0x40')][_0xd479('0x41')][_0xd479('0x42')](_0x2697ed);_0x39c998[_0xd479('0x40')][_0xd479('0x43')]=_0x5f2c10;}else if(_0x55f3ee[_0xd479('0x1e')]==='User'){_0x39c998[_0xd479('0x44')]['clause']['and'](_0xd479('0x45'),_0x55f3ee[_0xd479('0x3b')]);_0x39c998[_0xd479('0x44')][_0xd479('0x46')]=!![];}}}return _0x39c998;}function parseModelFields(_0x2fa274,_0x1dbfee){var _0x5f51a4=squel['expr']();var _0x5c9922=_(_0x2fa274)[_0xd479('0x47')]()['map'](function(_0x2497d2){return _[_0xd479('0x48')](_0x1dbfee,['name',_0x2497d2])?_0x2497d2:undefined;})[_0xd479('0x49')]()[_0xd479('0x3b')]();if(_0x2fa274[_0xd479('0x4a')]){_0x5c9922['push'](_0xd479('0x4a'));}if(_0x2fa274[_0xd479('0x4b')]){_0x5c9922[_0xd479('0x1b')](_0xd479('0x4b'));}if(_0x5c9922[_0xd479('0x24')]>0x0){_0x5c9922['forEach'](function(_0x3eff4f){if(_0x3eff4f===_0xd479('0x7')){_0x5f51a4[_0xd479('0x42')]('c.ListId\x20IN\x20?',[]['concat'](_0x2fa274[_0x3eff4f]));}else if(_0x3eff4f==='Contact'){var _0xc5aac='%'+_0x2fa274[_0x3eff4f]+'%';_0x5f51a4['and'](_0xd479('0x4c'),_0xc5aac);}else if(_0x3eff4f===_0xd479('0x4b')){_0x5f51a4['and'](_0xd479('0x45'),_0x2fa274[_0x3eff4f]);}else{_0x5f51a4[_0xd479('0x42')]('c.'+_0x3eff4f+_0xd479('0x4d'),_0x2fa274[_0x3eff4f]);}});}return _0x5f51a4;}function parseQueryParameters(_0x30e1f8,_0x55217a){var _0x96786a=getSqlClauses();return Promise[_0xd479('0x4e')]()[_0xd479('0x4f')](function(){return parseModelFields(_0x30e1f8,_0x55217a);})[_0xd479('0x4f')](function(_0x14d13a){_0x96786a[_0xd479('0x50')]['and'](_0x14d13a);return parseTagParameter(_0x30e1f8[_0xd479('0x51')]);})[_0xd479('0x4f')](function(_0x4ef278){_0x96786a[_0xd479('0x40')][_0xd479('0x41')][_0xd479('0x42')](_0x4ef278);return parseSearchFilter(_0x30e1f8[_0xd479('0x52')]);})[_0xd479('0x4f')](function(_0x4cda07){_0x96786a['filter']=_0x4cda07;return _0x96786a;});}function checkListsRestrictions(_0x432cd5,_0x4a4b1d,_0xc8643a){var _0x1b170=squel[_0xd479('0x20')]();return Promise[_0xd479('0x4e')]()[_0xd479('0x4f')](function(){if(_0x4a4b1d['search']&&_0x432cd5[_0xd479('0x4')]===_0xd479('0x5')&&!_0xc8643a){return _0x432cd5[_0xd479('0x53')]({'attributes':['id'],'raw':!![]});}})[_0xd479('0x4f')](function(_0x12cbe9){if(_0x12cbe9){if(_0x12cbe9['length']===0x0){_0x1b170[_0xd479('0x42')](_0xd479('0x54'));}else{_0x1b170[_0xd479('0x42')]('c.ListId\x20IN\x20?',_[_0xd479('0x3f')](_0x12cbe9,'id'));}}})[_0xd479('0x4f')](function(){return _0x1b170;});}function buildContactsQuery(_0x442eb2,_0x50db84,_0x2c1e3e,_0x12f270,_0x35d233,_0x3cfdd2){if(_0x50db84){_0x50db84=_0x2c1e3e[_0xd479('0x55')];}_0x442eb2=addFieldsToQuery(_0x442eb2,_0x50db84,_0x12f270,_0x3cfdd2,!![]);var _0x4c1390=squel[_0xd479('0x9')]();_0x4c1390=addFieldsToQuery(_0x4c1390,_0x50db84,_0x12f270,_0x3cfdd2,![]);if(_0x12f270||_0x3cfdd2){_0x442eb2=applyJoinClauses(_0x442eb2,!![]);_0x442eb2[_0xd479('0x56')](_0xd479('0x57'));if(_0x2c1e3e[_0xd479('0x58')]){_0x4c1390[_0xd479('0x58')](_0x2c1e3e[_0xd479('0x58')]);}if(_0x2c1e3e[_0xd479('0x59')]){_0x4c1390['offset'](_0x2c1e3e[_0xd479('0x59')]);}}else{_0x4c1390=applyJoinClauses(_0x4c1390,![]);_0x4c1390[_0xd479('0x56')](_0xd479('0x5a'));if(_0x2c1e3e['limit']){_0x442eb2[_0xd479('0x58')](_0x2c1e3e['limit']);}if(_0x2c1e3e[_0xd479('0x59')]){_0x442eb2[_0xd479('0x59')](_0x2c1e3e['offset']);}}_0x4c1390[_0xd479('0x5b')](_0x35d233);if(_0x2c1e3e[_0xd479('0x5c')]){_0x2c1e3e[_0xd479('0x5c')]['forEach'](function(_0x116f25){_0x442eb2['order']('c.'+_0x116f25[0x0],_0x116f25[0x1]===_0xd479('0x5d')?![]:!![]);_0x4c1390[_0xd479('0x5c')](_0xd479('0x5e')+_0x116f25[0x0],_0x116f25[0x1]===_0xd479('0x5d')?![]:!![]);});}_0x4c1390[_0xd479('0xa')](_0x442eb2,'subqry');return _0x4c1390;}function getFilteredContacts(_0x812332){var _0x1fe4d7=[];return db[_0xd479('0x3d')][_0xd479('0x5f')]({'attributes':['id',_0xd479('0x60'),_0xd479('0x61')],'raw':!![]})[_0xd479('0x4f')](function(_0x3825d3){_0x1fe4d7=_['keyBy'](_0x3825d3,'id');var _0x50f807={'type':db['Sequelize'][_0xd479('0x62')][_0xd479('0x63')],'model':db[_0xd479('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xd479('0x65')](_0x812332[_0xd479('0x66')](),_0x50f807);})['then'](function(_0x1dfd61){_0x1dfd61[_0xd479('0x1c')](function(_0x505b99){if(_0x505b99[_0xd479('0x1d')]){_0x505b99['Tags']=[];_0x505b99[_0xd479('0x1d')][_0xd479('0x3e')](',')[_0xd479('0x1c')](function(_0x5b5baf){_0x505b99[_0xd479('0x67')]['push'](_0x1fe4d7[_0x5b5baf]);});}delete _0x505b99['TagIds'];});return _0x1dfd61;});}function countFilteredContacts(_0x5a18a6,_0x4b8db8){var _0x576e83=_0x5a18a6['clone']();_0x576e83[_0xd479('0x1e')]('COUNT(*)');_0x576e83=applyJoinClauses(_0x576e83,!![]);_0x5a18a6['group']('c.id');var _0x36d658=utils[_0xd479('0x21')](_0x4b8db8);if(!_[_0xd479('0x68')](_0x36d658)){_0x576e83['where']('t.id\x20IN\x20?',_0x36d658);}var _0x2719e8={'type':db['Sequelize']['QueryTypes'][_0xd479('0x63')],'raw':!![]};return db[_0xd479('0x69')][_0xd479('0x65')](_0x576e83[_0xd479('0x66')](),_0x2719e8)[_0xd479('0x4f')](function(_0x55f969){return _0x55f969[0x0][_0xd479('0x6a')];});}module[_0xd479('0x6b')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0xff8e=['group','c.id','limit','offset','having','DESC','order','Tag','findAll','keyBy','Sequelize','QueryTypes','SELECT','sequelize','query','toString','Tags','getSelectedTags','isEmpty','t.id\x20IN\x20?','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','ListId','true','select','from','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','ct.CmContactId\x20=\x20','.id','tools_tags','subqry','firstName','lastName','phone','fax','email','createdAt','deletedAt','TagIds','push','forEach','field','expr','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','name','fieldType','castTo','type','default','text','value','start','end','map','tags','clause','ids','and','uc.UserId\x20=\x20?','keys','some','compact','User','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','agent','getLists','c.ListId\x20IS\x20NULL','attributes'];(function(_0x2af5c9,_0x34d919){var _0x3c1e5e=function(_0x39716c){while(--_0x39716c){_0x2af5c9['push'](_0x2af5c9['shift']());}};_0x3c1e5e(++_0x34d919);}(_0xff8e,0xe0));var _0xeff8=function(_0x3142e2,_0x3e93da){_0x3142e2=_0x3142e2-0x0;var _0x19f5f0=_0xff8e[_0x3142e2];return _0x19f5f0;};'use strict';var _=require(_0xeff8('0x0'));var squel=require(_0xeff8('0x1'));var as=require(_0xeff8('0x2'));var qs=require(_0xeff8('0x3'));var utils=require(_0xeff8('0x4'));var db=require(_0xeff8('0x5'))['db'];function skipContactsQuery(_0x21c9e7,_0x177eaa){var _0x59c877=![];if(_0x21c9e7[_0xeff8('0x6')]==='agent'&&!_0x177eaa['search']&&!_0x177eaa[_0xeff8('0x7')]&&_0x177eaa['autocomplete']!==_0xeff8('0x8')){_0x59c877=!![];}return _0x59c877;}function getContactsSubquery(){return squel[_0xeff8('0x9')]()[_0xeff8('0xa')]('cm_contacts','c')[_0xeff8('0xb')](_0xeff8('0xc'));}function applyJoinClauses(_0x4a107e,_0x50ba05){var _0x401c24=_0x50ba05?'c':'subqry';_0x4a107e[_0xeff8('0xd')](_0xeff8('0xe'),'uc',_0xeff8('0xf')+_0x401c24+'.id')[_0xeff8('0xd')]('cm_contact_has_tags','ct',_0xeff8('0x10')+_0x401c24+_0xeff8('0x11'))[_0xeff8('0xd')](_0xeff8('0x12'),'t','t.id\x20=\x20ct.TagId');return _0x4a107e;}function addFieldsToQuery(_0x87a203,_0x1fe9ef,_0x24b14c,_0x2073f8,_0x227747){var _0x309a05=_0x227747?'c':_0xeff8('0x13');if(!_0x1fe9ef){_0x1fe9ef=['id',_0xeff8('0x14'),_0xeff8('0x15'),_0xeff8('0x16'),'mobile',_0xeff8('0x17'),_0xeff8('0x18'),_0xeff8('0x7'),'CompanyId',_0xeff8('0x19'),'updatedAt',_0xeff8('0x1a'),_0xeff8('0x1b')];}else if(!_0x1fe9ef['includes']('id')){_0x1fe9ef[_0xeff8('0x1c')]('id');}var _0x15004d=_0x24b14c&&_0x227747||!_0x24b14c&&!_0x227747;if(_0x2073f8){_0x15004d=_0x2073f8&&_0x227747||!_0x2073f8&&!_0x227747;}_0x1fe9ef[_0xeff8('0x1d')](function(_0x2398e0){if(_0x2398e0===_0xeff8('0x1b')){if(_0x15004d){_0x87a203[_0xeff8('0x1e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2398e0);}else if(_0x24b14c||_0x2073f8){_0x87a203[_0xeff8('0x1e')](_0x309a05+'.'+_0x2398e0);}}else{_0x87a203['field'](_0x309a05+'.'+_0x2398e0);}});return _0x87a203;}function getSqlClauses(){var _0x1570fa={'default':squel[_0xeff8('0x1f')](),'fields':squel[_0xeff8('0x1f')](),'filter':squel[_0xeff8('0x1f')](),'tags':{'clause':squel[_0xeff8('0x1f')](),'ids':null},'user':{'clause':squel[_0xeff8('0x1f')](),'skip':![]}};return _0x1570fa;}function parseTagParameter(_0x264e65){var _0x20c079=squel[_0xeff8('0x1f')]();if(_0x264e65){var _0x398830=utils['getSelectedTags'](_0x264e65);_0x398830[_0xeff8('0x1d')](function(_0x340bf6){_0x20c079['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x340bf6+',%');});}return _0x20c079;}function parseSearchFilter(_0x195320){var _0x5d1699=squel['expr']();if(_0x195320){var _0x368810=_0x195320[_0xeff8('0x20')]('\x5c','\x5c\x5c')[_0xeff8('0x20')](/'/g,'\x27\x27');if(_0x368810[_0xeff8('0x21')]('\x20')['length']>0x1){_0x5d1699['or'](_0xeff8('0x22'),qs['getFullTextValue'](_0x368810,!![]),null);}else{if(qs[_0xeff8('0x23')](_0x368810)){_0x5d1699['or'](_0xeff8('0x24'),_0x368810+'%');_0x5d1699['or'](_0xeff8('0x25'),_0x368810+'%');_0x5d1699['or']('c.mobile\x20LIKE\x20?',_0x368810+'%');_0x5d1699['or']('c.fax\x20LIKE\x20?',_0x368810+'%');}else if(qs[_0xeff8('0x26')](_0x368810)){_0x5d1699['or'](_0xeff8('0x27'),_0x368810+'%');}else{_0x5d1699['or'](_0xeff8('0x28'),'%'+_0x368810+'%');_0x5d1699['or'](_0xeff8('0x29'),'%'+_0x368810+'%');_0x5d1699['or']('c.email\x20LIKE\x20?','%'+_0x368810+'%');}}}return _0x5d1699;}function parseAdvancedSearchFilter(_0x209612,_0x92e339){var _0x254b08=getSqlClauses();var _0x5655ac=as[_0xeff8('0x2a')](_0x209612);var _0x5bc84b=_0x5655ac[_0xeff8('0x2b')];for(var _0x3df6dc=0x0;_0x3df6dc<_0x5655ac[_0xeff8('0x2c')][_0xeff8('0x2d')];_0x3df6dc++){var _0x3642ef=_0x5655ac[_0xeff8('0x2c')][_0x3df6dc];var _0x1c063f='c';var _0x2b41a4=_[_0xeff8('0x2e')](_0x92e339,[_0xeff8('0x2f'),_0x3642ef[_0xeff8('0x1e')]]);if(_0x2b41a4){if(_0x3642ef['field']==='dateOfBirth'||_0x2b41a4[_0xeff8('0x30')]==='datetime'){_0x3642ef[_0xeff8('0x31')]='DATE';}var _0x19b6bd=as['buildExpression'](_0x1c063f,_0x2b41a4[_0xeff8('0x32')],_0x3642ef);_0x254b08[_0xeff8('0x33')][_0x5bc84b](_0x19b6bd[_0xeff8('0x34')],_0x19b6bd[_0xeff8('0x35')][_0xeff8('0x36')],_0x19b6bd[_0xeff8('0x35')][_0xeff8('0x37')]);}else{if(_0x3642ef[_0xeff8('0x1e')]==='Tag'){var _0x2a3325=_0x3642ef['value'][_0xeff8('0x21')](',')[_0xeff8('0x38')](function(_0x3b1d96){return Number(_0x3b1d96);});var _0x3c1866=parseTagParameter(_0x2a3325);_0x254b08[_0xeff8('0x39')][_0xeff8('0x3a')]['and'](_0x3c1866);_0x254b08[_0xeff8('0x39')][_0xeff8('0x3b')]=_0x2a3325;}else if(_0x3642ef['field']==='User'){_0x254b08['user'][_0xeff8('0x3a')][_0xeff8('0x3c')](_0xeff8('0x3d'),_0x3642ef[_0xeff8('0x35')]);_0x254b08['user']['skip']=!![];}}}return _0x254b08;}function parseModelFields(_0x11ddc8,_0x3a0a23){var _0x3175ab=squel[_0xeff8('0x1f')]();var _0xf08053=_(_0x11ddc8)[_0xeff8('0x3e')]()[_0xeff8('0x38')](function(_0xc91251){return _[_0xeff8('0x3f')](_0x3a0a23,[_0xeff8('0x2f'),_0xc91251])?_0xc91251:undefined;})[_0xeff8('0x40')]()[_0xeff8('0x35')]();if(_0x11ddc8['Contact']){_0xf08053['push']('Contact');}if(_0x11ddc8['User']){_0xf08053[_0xeff8('0x1c')](_0xeff8('0x41'));}if(_0xf08053[_0xeff8('0x2d')]>0x0){_0xf08053['forEach'](function(_0x18c24e){if(_0x18c24e===_0xeff8('0x7')){_0x3175ab[_0xeff8('0x3c')](_0xeff8('0x42'),[][_0xeff8('0x43')](_0x11ddc8[_0x18c24e]));}else if(_0x18c24e==='Contact'){var _0x134c00='%'+_0x11ddc8[_0x18c24e]+'%';_0x3175ab[_0xeff8('0x3c')](_0xeff8('0x44'),_0x134c00);}else if(_0x18c24e===_0xeff8('0x41')){_0x3175ab[_0xeff8('0x3c')](_0xeff8('0x3d'),_0x11ddc8[_0x18c24e]);}else{_0x3175ab[_0xeff8('0x3c')]('c.'+_0x18c24e+_0xeff8('0x45'),_0x11ddc8[_0x18c24e]);}});}return _0x3175ab;}function parseQueryParameters(_0x6f8fe0,_0x3f8487){var _0x1c150a=getSqlClauses();return Promise[_0xeff8('0x46')]()[_0xeff8('0x47')](function(){return parseModelFields(_0x6f8fe0,_0x3f8487);})[_0xeff8('0x47')](function(_0x3530d2){_0x1c150a[_0xeff8('0x48')][_0xeff8('0x3c')](_0x3530d2);return parseTagParameter(_0x6f8fe0[_0xeff8('0x49')]);})[_0xeff8('0x47')](function(_0x3e13b6){_0x1c150a['tags'][_0xeff8('0x3a')]['and'](_0x3e13b6);return parseSearchFilter(_0x6f8fe0[_0xeff8('0x4a')]);})[_0xeff8('0x47')](function(_0x2c6814){_0x1c150a['filter']=_0x2c6814;return _0x1c150a;});}function checkListsRestrictions(_0x4ca438,_0x53befe,_0x3fd6a3){var _0x247beb=squel[_0xeff8('0x1f')]();return Promise[_0xeff8('0x46')]()[_0xeff8('0x47')](function(){if(_0x53befe['search']&&_0x4ca438[_0xeff8('0x6')]===_0xeff8('0x4b')&&!_0x3fd6a3){return _0x4ca438[_0xeff8('0x4c')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x5029b9){if(_0x5029b9){if(_0x5029b9['length']===0x0){_0x247beb['and'](_0xeff8('0x4d'));}else{_0x247beb[_0xeff8('0x3c')](_0xeff8('0x42'),_[_0xeff8('0x38')](_0x5029b9,'id'));}}})[_0xeff8('0x47')](function(){return _0x247beb;});}function buildContactsQuery(_0x4fdedd,_0x35859a,_0x59e5f7,_0x4a4d70,_0x5660a7,_0x496731){if(_0x35859a){_0x35859a=_0x59e5f7[_0xeff8('0x4e')];}_0x4fdedd=addFieldsToQuery(_0x4fdedd,_0x35859a,_0x4a4d70,_0x496731,!![]);var _0x1067f6=squel[_0xeff8('0x9')]();_0x1067f6=addFieldsToQuery(_0x1067f6,_0x35859a,_0x4a4d70,_0x496731,![]);if(_0x4a4d70||_0x496731){_0x4fdedd=applyJoinClauses(_0x4fdedd,!![]);_0x4fdedd[_0xeff8('0x4f')](_0xeff8('0x50'));if(_0x59e5f7[_0xeff8('0x51')]){_0x1067f6[_0xeff8('0x51')](_0x59e5f7['limit']);}if(_0x59e5f7[_0xeff8('0x52')]){_0x1067f6[_0xeff8('0x52')](_0x59e5f7[_0xeff8('0x52')]);}}else{_0x1067f6=applyJoinClauses(_0x1067f6,![]);_0x1067f6[_0xeff8('0x4f')]('subqry.id');if(_0x59e5f7[_0xeff8('0x51')]){_0x4fdedd[_0xeff8('0x51')](_0x59e5f7[_0xeff8('0x51')]);}if(_0x59e5f7[_0xeff8('0x52')]){_0x4fdedd[_0xeff8('0x52')](_0x59e5f7['offset']);}}_0x1067f6[_0xeff8('0x53')](_0x5660a7);if(_0x59e5f7['order']){_0x59e5f7['order']['forEach'](function(_0x3fb1f5){_0x4fdedd['order']('c.'+_0x3fb1f5[0x0],_0x3fb1f5[0x1]===_0xeff8('0x54')?![]:!![]);_0x1067f6[_0xeff8('0x55')]('subqry.'+_0x3fb1f5[0x0],_0x3fb1f5[0x1]===_0xeff8('0x54')?![]:!![]);});}_0x1067f6['from'](_0x4fdedd,_0xeff8('0x13'));return _0x1067f6;}function getFilteredContacts(_0x18af0f){var _0x35f43d=[];return db[_0xeff8('0x56')][_0xeff8('0x57')]({'attributes':['id',_0xeff8('0x2f'),'color'],'raw':!![]})[_0xeff8('0x47')](function(_0x2119f0){_0x35f43d=_[_0xeff8('0x58')](_0x2119f0,'id');var _0x5e02ee={'type':db[_0xeff8('0x59')][_0xeff8('0x5a')][_0xeff8('0x5b')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xeff8('0x5c')][_0xeff8('0x5d')](_0x18af0f[_0xeff8('0x5e')](),_0x5e02ee);})[_0xeff8('0x47')](function(_0x20bee9){_0x20bee9['forEach'](function(_0x9788a3){if(_0x9788a3[_0xeff8('0x1b')]){_0x9788a3['Tags']=[];_0x9788a3[_0xeff8('0x1b')][_0xeff8('0x21')](',')[_0xeff8('0x1d')](function(_0x332d14){_0x9788a3[_0xeff8('0x5f')][_0xeff8('0x1c')](_0x35f43d[_0x332d14]);});}delete _0x9788a3['TagIds'];});return _0x20bee9;});}function countFilteredContacts(_0x4fc910,_0xbd17f3){var _0x37c734=_0x4fc910['clone']();_0x37c734['field']('COUNT(*)');_0x37c734=applyJoinClauses(_0x37c734,!![]);_0x4fc910['group'](_0xeff8('0x50'));var _0x38d31b=utils[_0xeff8('0x60')](_0xbd17f3);if(!_[_0xeff8('0x61')](_0x38d31b)){_0x37c734[_0xeff8('0xb')](_0xeff8('0x62'),_0x38d31b);}var _0x45e8e7={'type':db['Sequelize'][_0xeff8('0x5a')][_0xeff8('0x5b')],'raw':!![]};return db['sequelize'][_0xeff8('0x5d')](_0x37c734['toString'](),_0x45e8e7)['then'](function(_0x2f767c){return _0x2f767c[0x0][_0xeff8('0x63')];});}module[_0xeff8('0x64')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index dea6b42..a5325c6 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 _0x7600=['test','getCiphers','filter','indexOf','hasOwnProperty','createWriteStream','createCipher','update','binary','end','final','write','close','unlink','decryptFile','createReadStream','createDecipher','data','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/logger','app','secrets','session','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:'];(function(_0xd2ba55,_0x21b25a){var _0x3f0763=function(_0x2e58d6){while(--_0x2e58d6){_0xd2ba55['push'](_0xd2ba55['shift']());}};_0x3f0763(++_0x21b25a);}(_0x7600,0x16b));var _0x0760=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x7600[_0x5f1391];return _0x50ebe3;};'use strict';var crypto=require(_0x0760('0x0'));var fs=require('fs');var BPromise=require(_0x0760('0x1'));var _=require(_0x0760('0x2'));var config=require('../../config/environment');var logger=require(_0x0760('0x3'))(_0x0760('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0760('0x5')][_0x0760('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0x0760('0x7')]&&config[_0x0760('0x7')][_0x0760('0x8')]){var isSupported=isAlgorithmSupported(config[_0x0760('0x7')][_0x0760('0x8')]);if(isSupported){fileOptions[_0x0760('0x8')]=config[_0x0760('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0760('0x9')](',\x20');logger['error'](config[_0x0760('0x7')][_0x0760('0x8')],_0x0760('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x3eca61){return AES_SUPPORTED_RX[_0x0760('0xb')](_0x3eca61);}function getSupportedCiphers(){return crypto[_0x0760('0xc')]()[_0x0760('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x4437ce){return getSupportedCiphers()[_0x0760('0xe')](_0x4437ce)>-0x1;}function combineOptions(_0x41a369){var _0x5caf8f={};for(var _0x493014 in fileOptions){if(fileOptions[_0x0760('0xf')](_0x493014)){_0x5caf8f[_0x493014]=fileOptions[_0x493014];}}if(_0x41a369){for(var _0x17378e in _0x41a369){if(_0x41a369['hasOwnProperty'](_0x17378e)){_0x5caf8f[_0x17378e]=_0x41a369[_0x17378e];}}}return _0x5caf8f;}exports['encryptFile']=function(_0x77580b,_0x3dbb75,_0x161d29,_0x4542e6){return new BPromise(function(_0x21a2a8,_0xee89a0){_0x4542e6=combineOptions(_0x4542e6);var _0x44b0a7=new Buffer(_0x161d29);var _0x4096b0=fs['createReadStream'](_0x77580b);var _0x3a2c68=fs[_0x0760('0x10')](_0x3dbb75);var _0x5898ba=crypto[_0x0760('0x11')](_0x4542e6[_0x0760('0x8')],_0x44b0a7);_0x4096b0['on']('data',function(_0x540645){var _0x252022=new Buffer(_0x5898ba[_0x0760('0x12')](_0x540645),_0x0760('0x13'));_0x3a2c68['write'](_0x252022);});_0x4096b0['on'](_0x0760('0x14'),function(){try{var _0x5aee75=new Buffer(_0x5898ba[_0x0760('0x15')](_0x0760('0x13')),_0x0760('0x13'));_0x3a2c68[_0x0760('0x16')](_0x5aee75);_0x3a2c68['end']();_0x3a2c68['on'](_0x0760('0x17'),function(){return _0x21a2a8(_0x3dbb75);});}catch(_0x309e15){fs[_0x0760('0x18')](_0x3dbb75);return _0xee89a0(_0x309e15);}});});};exports[_0x0760('0x19')]=function(_0x1bbc17,_0x412d05,_0x2c2b5f,_0x1e143e){return new BPromise(function(_0x3e9e4d,_0x21ce2f){_0x1e143e=combineOptions(_0x1e143e);var _0x15f37c=new Buffer(_0x2c2b5f);var _0x2d6303=fs[_0x0760('0x1a')](_0x1bbc17);var _0x34162d=fs['createWriteStream'](_0x412d05);var _0x28cfa2=crypto[_0x0760('0x1b')](_0x1e143e['algorithm'],_0x15f37c);_0x2d6303['on'](_0x0760('0x1c'),function(_0x143bfd){var _0x1dcea2=new Buffer(_0x28cfa2['update'](_0x143bfd),_0x0760('0x13'));_0x34162d[_0x0760('0x16')](_0x1dcea2);});_0x2d6303['on'](_0x0760('0x14'),function(){try{var _0xe85a08=new Buffer(_0x28cfa2[_0x0760('0x15')](_0x0760('0x13')),_0x0760('0x13'));_0x34162d['write'](_0xe85a08);_0x34162d['end']();_0x34162d['on'](_0x0760('0x17'),function(){return _0x3e9e4d(_0x412d05);});}catch(_0x564614){fs[_0x0760('0x18')](_0x412d05);return _0x21ce2f(_0x564614);}});});};exports[_0x0760('0x1d')]=function(_0xbe0a51,_0x393616,_0xc00399){var _0x3f3c3e=_0xc00399||stringOptions[_0x0760('0x8')];var _0x22db45=_0x393616||stringOptions[_0x0760('0x1e')];var _0x580e57=crypto[_0x0760('0x11')](_0x3f3c3e,_0x22db45);var _0x4da345=_0x580e57[_0x0760('0x12')](_0xbe0a51,_0x0760('0x1f'),'base64');_0x4da345+=_0x580e57[_0x0760('0x15')](_0x0760('0x20'));return _0x4da345;};exports[_0x0760('0x21')]=function(_0x3bda4e,_0x42c7f5,_0x3a9041){var _0x25f5a8=_0x3a9041||stringOptions['algorithm'];var _0x46d3f8=_0x42c7f5||stringOptions[_0x0760('0x1e')];var _0x44b7bb=crypto[_0x0760('0x1b')](_0x25f5a8,_0x46d3f8);var _0x249d45=_0x44b7bb['update'](_0x3bda4e,'base64',_0x0760('0x1f'));_0x249d45+=_0x44b7bb[_0x0760('0x15')]('utf8');return _0x249d45;}; \ No newline at end of file +var _0xc04b=['createDecipher','final','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','close','unlink','decryptFile'];(function(_0x254744,_0x219e6b){var _0x2a6a96=function(_0x26aceb){while(--_0x26aceb){_0x254744['push'](_0x254744['shift']());}};_0x2a6a96(++_0x219e6b);}(_0xc04b,0x1a9));var _0xbc04=function(_0x13bc7d,_0xd6efde){_0x13bc7d=_0x13bc7d-0x0;var _0x46cbbf=_0xc04b[_0x13bc7d];return _0x46cbbf;};'use strict';var crypto=require(_0xbc04('0x0'));var fs=require('fs');var BPromise=require(_0xbc04('0x1'));var _=require(_0xbc04('0x2'));var config=require(_0xbc04('0x3'));var logger=require('../../config/logger')(_0xbc04('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xbc04('0x5')][_0xbc04('0x6')],'algorithm':_0xbc04('0x7')};const fileOptions={'algorithm':_0xbc04('0x8')};if(config[_0xbc04('0x9')]&&config[_0xbc04('0x9')][_0xbc04('0xa')]){var isSupported=isAlgorithmSupported(config[_0xbc04('0x9')][_0xbc04('0xa')]);if(isSupported){fileOptions['algorithm']=config[_0xbc04('0x9')][_0xbc04('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xbc04('0xb')](',\x20');logger[_0xbc04('0xc')](config[_0xbc04('0x9')]['algorithm'],_0xbc04('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x1329a5){return AES_SUPPORTED_RX[_0xbc04('0xe')](_0x1329a5);}function getSupportedCiphers(){return crypto[_0xbc04('0xf')]()[_0xbc04('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x58f310){return getSupportedCiphers()[_0xbc04('0x11')](_0x58f310)>-0x1;}function combineOptions(_0x2735bf){var _0x4ed60c={};for(var _0xf722a1 in fileOptions){if(fileOptions[_0xbc04('0x12')](_0xf722a1)){_0x4ed60c[_0xf722a1]=fileOptions[_0xf722a1];}}if(_0x2735bf){for(var _0x3b994b in _0x2735bf){if(_0x2735bf[_0xbc04('0x12')](_0x3b994b)){_0x4ed60c[_0x3b994b]=_0x2735bf[_0x3b994b];}}}return _0x4ed60c;}exports[_0xbc04('0x13')]=function(_0x1e4ab6,_0x12730e,_0x5f4ebd,_0x3ac67a){return new BPromise(function(_0x2c27c1,_0x1be5ef){_0x3ac67a=combineOptions(_0x3ac67a);var _0x543e25=new Buffer(_0x5f4ebd);var _0x10ec5c=fs[_0xbc04('0x14')](_0x1e4ab6);var _0x5a75aa=fs[_0xbc04('0x15')](_0x12730e);var _0x1c7603=crypto[_0xbc04('0x16')](_0x3ac67a[_0xbc04('0xa')],_0x543e25);_0x10ec5c['on'](_0xbc04('0x17'),function(_0x5d0aa3){var _0x3bae9a=new Buffer(_0x1c7603[_0xbc04('0x18')](_0x5d0aa3),_0xbc04('0x19'));_0x5a75aa[_0xbc04('0x1a')](_0x3bae9a);});_0x10ec5c['on'](_0xbc04('0x1b'),function(){try{var _0x351071=new Buffer(_0x1c7603['final'](_0xbc04('0x19')),'binary');_0x5a75aa[_0xbc04('0x1a')](_0x351071);_0x5a75aa[_0xbc04('0x1b')]();_0x5a75aa['on'](_0xbc04('0x1c'),function(){return _0x2c27c1(_0x12730e);});}catch(_0x121a92){fs[_0xbc04('0x1d')](_0x12730e);return _0x1be5ef(_0x121a92);}});});};exports[_0xbc04('0x1e')]=function(_0x4382fb,_0x51772b,_0x22e0bb,_0x498ad0){return new BPromise(function(_0x277d2f,_0x2698fe){_0x498ad0=combineOptions(_0x498ad0);var _0x5b7501=new Buffer(_0x22e0bb);var _0x270167=fs['createReadStream'](_0x4382fb);var _0xe918dd=fs[_0xbc04('0x15')](_0x51772b);var _0x31f6aa=crypto[_0xbc04('0x1f')](_0x498ad0['algorithm'],_0x5b7501);_0x270167['on'](_0xbc04('0x17'),function(_0x2606de){var _0x100143=new Buffer(_0x31f6aa[_0xbc04('0x18')](_0x2606de),_0xbc04('0x19'));_0xe918dd[_0xbc04('0x1a')](_0x100143);});_0x270167['on'](_0xbc04('0x1b'),function(){try{var _0x4745e8=new Buffer(_0x31f6aa[_0xbc04('0x20')](_0xbc04('0x19')),_0xbc04('0x19'));_0xe918dd[_0xbc04('0x1a')](_0x4745e8);_0xe918dd[_0xbc04('0x1b')]();_0xe918dd['on'](_0xbc04('0x1c'),function(){return _0x277d2f(_0x51772b);});}catch(_0x5309a9){fs[_0xbc04('0x1d')](_0x51772b);return _0x2698fe(_0x5309a9);}});});};exports[_0xbc04('0x21')]=function(_0x1c8399,_0xe97821,_0x3722dc){var _0x8b525d=_0x3722dc||stringOptions[_0xbc04('0xa')];var _0x223a7f=_0xe97821||stringOptions[_0xbc04('0x22')];var _0x8866fc=crypto[_0xbc04('0x16')](_0x8b525d,_0x223a7f);var _0x35ab72=_0x8866fc[_0xbc04('0x18')](_0x1c8399,_0xbc04('0x23'),_0xbc04('0x24'));_0x35ab72+=_0x8866fc[_0xbc04('0x20')]('base64');return _0x35ab72;};exports[_0xbc04('0x25')]=function(_0x7c4570,_0x33225b,_0x34ca8c){var _0x1da9bd=_0x34ca8c||stringOptions[_0xbc04('0xa')];var _0x197529=_0x33225b||stringOptions[_0xbc04('0x22')];var _0x2de762=crypto[_0xbc04('0x1f')](_0x1da9bd,_0x197529);var _0x4ef7b9=_0x2de762[_0xbc04('0x18')](_0x7c4570,'base64',_0xbc04('0x23'));_0x4ef7b9+=_0x2de762[_0xbc04('0x20')](_0xbc04('0x23'));return _0x4ef7b9;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index d5688af..99a34c3 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 _0x706e=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','length','range','isInteger','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','existsSync','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch'];(function(_0xff1f88,_0x5e8c17){var _0x52da3f=function(_0x422db5){while(--_0x422db5){_0xff1f88['push'](_0xff1f88['shift']());}};_0x52da3f(++_0x5e8c17);}(_0x706e,0x104));var _0xe706=function(_0x26a1aa,_0x496224){_0x26a1aa=_0x26a1aa-0x0;var _0x5ab14a=_0x706e[_0x26a1aa];return _0x5ab14a;};'use strict';var util=require(_0xe706('0x0'));var path=require(_0xe706('0x1'));var _=require('lodash');var csv=require(_0xe706('0x2'));var fs=require('fs');var BPromise=require(_0xe706('0x3'));var zipdir=require(_0xe706('0x4'));var rimraf=require(_0xe706('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe706('0x6'))['dbH'];var logger=require(_0xe706('0x7'))(_0xe706('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xe706('0x9')][0x3];var PATH=process[_0xe706('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x267054,_0x35aedc){var _0x4e302e={'status':_0x267054};var _0x43f8b3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x35aedc){_0x4e302e['savename']=_0x35aedc;}return db[_0xe706('0xa')][_0xe706('0xb')](_0x4e302e,_0x43f8b3);}function main(){var _0x4ac7c3=0x1388;var _0x7e95af;logger[_0xe706('0xc')](util[_0xe706('0xd')](_0xe706('0xe'),EXTRACTED_REPORT_ID,_0xe706('0xf')));return db[_0xe706('0x10')][_0xe706('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe706('0x12'),_0xe706('0x13')]})[_0xe706('0x14')](function(_0x32c047){if(_0x32c047){_0x7e95af=_0x32c047;_0x4ac7c3=_0x7e95af[_0xe706('0x13')]||0x1388;}})[_0xe706('0x14')](function(){return dbH[_0xe706('0x15')][_0xe706('0x16')](util[_0xe706('0xd')](_0xe706('0x17'),QUERY),{'type':dbH[_0xe706('0x15')]['QueryTypes'][_0xe706('0x18')]});})['then'](function(_0x3d4915){if(!_0x3d4915[0x0]['num']){return analyticExtractedReport('Empty');}var _0xc2becf=[];var _0x256fd0=0x0;if(_0x7e95af[_0xe706('0x12')]){if(_0x3d4915&&_0x3d4915[_0xe706('0x19')]){var _0x1fafb4=_[_0xe706('0x1a')](_0x3d4915[0x0]['num']/_0x4ac7c3);var _0x16696c=Number[_0xe706('0x1b')](_0x3d4915[0x0][_0xe706('0x1c')]/_0x4ac7c3)?_0x3d4915[0x0][_0xe706('0x1c')]%_0x4ac7c3:0x0;_0x1fafb4[_0xe706('0x1d')](function(_0x189bc2){if(_0x189bc2>0x0){_0x256fd0+=_0x4ac7c3;}_0xc2becf[_0xe706('0x1e')](dbH[_0xe706('0x15')]['query'](util['format'](_0xe706('0x1f'),QUERY,_0x4ac7c3,_0x256fd0),{'type':dbH[_0xe706('0x15')][_0xe706('0x20')][_0xe706('0x18')]}));});if(_0x16696c>0x0){_0x256fd0+=_0x4ac7c3;_0xc2becf['push'](dbH[_0xe706('0x15')][_0xe706('0x16')](util['format'](_0xe706('0x1f'),QUERY,_0x16696c,_0x256fd0),{'type':dbH['sequelize']['QueryTypes'][_0xe706('0x18')]}));}}}else{_0xc2becf[_0xe706('0x1e')](dbH[_0xe706('0x15')][_0xe706('0x16')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xe706('0x18')]}));}var _0x1617ce=path[_0xe706('0x21')](PATH);var _0x46be4a=path[_0xe706('0x22')](PATH,'.csv');var _0x22f2e1=_0x7e95af['split']&&_0xc2becf[_0xe706('0x19')]>0x1;var _0x1791ec=[];if(!fs[_0xe706('0x23')](path[_0xe706('0x24')](_0x1617ce,_0x46be4a))&&_0x22f2e1){fs[_0xe706('0x25')](path[_0xe706('0x24')](_0x1617ce,_0x46be4a));}return BPromise['each'](_0xc2becf,function(_0xe68fb2){_0x1791ec[_0xe706('0x1e')](_0xe68fb2);})[_0xe706('0x14')](function(){for(var _0x1961ab=0x0;_0x1961ab<_0x1791ec['length'];_0x1961ab+=0x1){var _0x1bff27;var _0x20f100=_0x1791ec[_0x1961ab];if(_0x22f2e1){_0x1bff27=path[_0xe706('0x24')](_0x1617ce,_0x46be4a,util[_0xe706('0xd')](_0xe706('0x26'),_0x46be4a,_0x1961ab,_0xe706('0x27')));}else{_0x1bff27=path['join'](_0x1617ce,util['format'](_0xe706('0x28'),_0x46be4a,_0xe706('0x27')));}fs[_0xe706('0x29')](_0x1bff27,csv(_0x20f100));}})[_0xe706('0x14')](function(){if(_0x22f2e1){return new Promise(function(_0x9514d5){zipdir(path[_0xe706('0x24')](_0x1617ce,_0x46be4a),{'saveTo':path[_0xe706('0x24')](_0x1617ce,util['format'](_0xe706('0x28'),_0x46be4a,_0xe706('0x2a')))},function(_0x3d44b1,_0x10223c){rimraf(path[_0xe706('0x24')](_0x1617ce,_0x46be4a),function(){});_0x9514d5('zip\x20finished');});});}})['then'](function(){logger[_0xe706('0xc')](util[_0xe706('0xd')](_0xe706('0x2b'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xe706('0x2c'),_0x22f2e1?util[_0xe706('0xd')](_0xe706('0x28'),_0x46be4a,_0x22f2e1?'zip':_0xe706('0x27')):null);});})[_0xe706('0x2d')](function(_0x4ce1ad){logger[_0xe706('0xc')](util['format'](_0xe706('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0xe706('0x2f')](_0x4ce1ad,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe706('0x30'));})[_0xe706('0x31')](function(){process[_0xe706('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe034=['Setting','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','rimraf','../../mysqldb','../../config/logger','analytics','argv','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV'];(function(_0x27e658,_0x49b8d5){var _0x15925d=function(_0x1291fb){while(--_0x1291fb){_0x27e658['push'](_0x27e658['shift']());}};_0x15925d(++_0x49b8d5);}(_0xe034,0x108));var _0x4e03=function(_0x526a5f,_0xdac7cb){_0x526a5f=_0x526a5f-0x0;var _0x4bf666=_0xe034[_0x526a5f];return _0x4bf666;};'use strict';var util=require(_0x4e03('0x0'));var path=require(_0x4e03('0x1'));var _=require(_0x4e03('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x4e03('0x3'));var db=require(_0x4e03('0x4'))['db'];var dbH=require(_0x4e03('0x4'))['dbH'];var logger=require(_0x4e03('0x5'))(_0x4e03('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x4e03('0x7')][0x2]);var QUERY=process[_0x4e03('0x7')][0x3];var PATH=process[_0x4e03('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x57be0a,_0x239c3a){var _0x5d617d={'status':_0x57be0a};var _0x40fd30={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x239c3a){_0x5d617d['savename']=_0x239c3a;}return db['AnalyticExtractedReport'][_0x4e03('0x8')](_0x5d617d,_0x40fd30);}function main(){var _0x46fcdb=0x1388;var _0x18ca96;logger['info'](util[_0x4e03('0x9')](_0x4e03('0xa'),EXTRACTED_REPORT_ID,_0x4e03('0xb')));return db[_0x4e03('0xc')][_0x4e03('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4e03('0xe'),_0x4e03('0xf')]})[_0x4e03('0x10')](function(_0xd9f060){if(_0xd9f060){_0x18ca96=_0xd9f060;_0x46fcdb=_0x18ca96[_0x4e03('0xf')]||0x1388;}})[_0x4e03('0x10')](function(){return dbH[_0x4e03('0x11')][_0x4e03('0x12')](util[_0x4e03('0x9')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x4e03('0x13')][_0x4e03('0x14')]});})['then'](function(_0x1bd620){if(!_0x1bd620[0x0]['num']){return analyticExtractedReport(_0x4e03('0x15'));}var _0x5aa9c9=[];var _0x27b9f4=0x0;if(_0x18ca96[_0x4e03('0xe')]){if(_0x1bd620&&_0x1bd620[_0x4e03('0x16')]){var _0x9ff3=_[_0x4e03('0x17')](_0x1bd620[0x0]['num']/_0x46fcdb);var _0x4d9109=Number[_0x4e03('0x18')](_0x1bd620[0x0]['num']/_0x46fcdb)?_0x1bd620[0x0]['num']%_0x46fcdb:0x0;_0x9ff3['forEach'](function(_0x134541){if(_0x134541>0x0){_0x27b9f4+=_0x46fcdb;}_0x5aa9c9[_0x4e03('0x19')](dbH[_0x4e03('0x11')][_0x4e03('0x12')](util[_0x4e03('0x9')](_0x4e03('0x1a'),QUERY,_0x46fcdb,_0x27b9f4),{'type':dbH[_0x4e03('0x11')][_0x4e03('0x13')][_0x4e03('0x14')]}));});if(_0x4d9109>0x0){_0x27b9f4+=_0x46fcdb;_0x5aa9c9[_0x4e03('0x19')](dbH[_0x4e03('0x11')][_0x4e03('0x12')](util['format'](_0x4e03('0x1a'),QUERY,_0x4d9109,_0x27b9f4),{'type':dbH[_0x4e03('0x11')][_0x4e03('0x13')][_0x4e03('0x14')]}));}}}else{_0x5aa9c9[_0x4e03('0x19')](dbH[_0x4e03('0x11')]['query'](QUERY,{'type':dbH[_0x4e03('0x11')]['QueryTypes'][_0x4e03('0x14')]}));}var _0x1f70f6=path['dirname'](PATH);var _0x562b56=path[_0x4e03('0x1b')](PATH,_0x4e03('0x1c'));var _0x3853f2=_0x18ca96[_0x4e03('0xe')]&&_0x5aa9c9[_0x4e03('0x16')]>0x1;var _0x138667=[];if(!fs['existsSync'](path[_0x4e03('0x1d')](_0x1f70f6,_0x562b56))&&_0x3853f2){fs[_0x4e03('0x1e')](path['join'](_0x1f70f6,_0x562b56));}return BPromise[_0x4e03('0x1f')](_0x5aa9c9,function(_0x502936){_0x138667[_0x4e03('0x19')](_0x502936);})['then'](function(){for(var _0x3229b2=0x0;_0x3229b2<_0x138667[_0x4e03('0x16')];_0x3229b2+=0x1){var _0x2d4730;var _0x3c47f2=_0x138667[_0x3229b2];if(_0x3853f2){_0x2d4730=path['join'](_0x1f70f6,_0x562b56,util[_0x4e03('0x9')](_0x4e03('0x20'),_0x562b56,_0x3229b2,_0x4e03('0x21')));}else{_0x2d4730=path['join'](_0x1f70f6,util['format']('%s.%s',_0x562b56,'csv'));}fs[_0x4e03('0x22')](_0x2d4730,csv(_0x3c47f2));}})[_0x4e03('0x10')](function(){if(_0x3853f2){return new Promise(function(_0x34cbfc){zipdir(path[_0x4e03('0x1d')](_0x1f70f6,_0x562b56),{'saveTo':path[_0x4e03('0x1d')](_0x1f70f6,util[_0x4e03('0x9')](_0x4e03('0x23'),_0x562b56,_0x4e03('0x24')))},function(_0xa70f95,_0x34efec){rimraf(path['join'](_0x1f70f6,_0x562b56),function(){});_0x34cbfc('zip\x20finished');});});}})[_0x4e03('0x10')](function(){logger[_0x4e03('0x25')](util[_0x4e03('0x9')](_0x4e03('0x26'),EXTRACTED_REPORT_ID,_0x4e03('0xb')));return analyticExtractedReport(_0x4e03('0x27'),_0x3853f2?util[_0x4e03('0x9')]('%s.%s',_0x562b56,_0x3853f2?'zip':_0x4e03('0x21')):null);});})[_0x4e03('0x28')](function(_0x770838){logger[_0x4e03('0x25')](util[_0x4e03('0x9')](_0x4e03('0x29'),EXTRACTED_REPORT_ID,_0x4e03('0xb')),util[_0x4e03('0x2a')](_0x770838,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4e03('0x2b'));})[_0x4e03('0x2c')](function(){process[_0x4e03('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 6c0c2d6..abf61b7 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 _0x8bc0=['existsSync','join','mkdirSync','each','flatten','%s%d.%s','%s.%s','pdf','all','info','PDF','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','tableHeader','map','pick','toString','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','right','num','Empty','find','split','splitSizePdf','then','isInteger','sequelize','QueryTypes','SELECT','dirname','basename','.pdf'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8bc0,0x192));var _0x08bc=function(_0x1ac308,_0x3a8419){_0x1ac308=_0x1ac308-0x0;var _0x4fcd90=_0x8bc0[_0x1ac308];return _0x4fcd90;};'use strict';var _=require(_0x08bc('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x08bc('0x1'));var moment=require(_0x08bc('0x2'));var htmlToPdfmake=require(_0x08bc('0x3'));var PdfPrinter=require(_0x08bc('0x4'));var zipdir=require(_0x08bc('0x5'));var rimraf=require(_0x08bc('0x6'));var JSDOM=require(_0x08bc('0x7'))['JSDOM'];var window=new JSDOM('')[_0x08bc('0x8')];var BPromise=require(_0x08bc('0x9'));var db=require(_0x08bc('0xa'))['db'];var dbH=require(_0x08bc('0xa'))[_0x08bc('0xb')];var logger=require(_0x08bc('0xc'))(_0x08bc('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x08bc('0xe')][0x2]);var QUERY=process[_0x08bc('0xe')][0x3];var PATH=process[_0x08bc('0xe')][0x4];var NAME=process[_0x08bc('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4aeb5f,_0x28f52e){var _0x44e95c={'status':_0x4aeb5f};var _0x109472={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x28f52e){_0x44e95c[_0x08bc('0xf')]=_0x28f52e;}return db[_0x08bc('0x10')][_0x08bc('0x11')](_0x44e95c,_0x109472);}function getHeaders(_0x21e424){return _['map'](_0x21e424,function(_0x1551d4){return{'text':_0x1551d4,'style':_0x08bc('0x12')};});}function getRows(_0x93c066,_0x4340c8){return _[_0x08bc('0x13')](_0x4340c8,function(_0x48a957){return _(_0x48a957)[_0x08bc('0x14')](_0x93c066)[_0x08bc('0x13')](function(_0x8a9147){return _0x8a9147?_[_0x08bc('0x15')](_0x8a9147):'';})['value']();});}function createTable(_0x551c44,_0x53139d){var _0x1010ac={'widths':_[_0x08bc('0x16')](Array(_0x551c44[_0x08bc('0x17')]),0x91),'heights':function(_0x3e18f4){return _0x3e18f4===0x0?_0x08bc('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2634a5=getHeaders(_0x551c44);_0x1010ac[_0x08bc('0x19')][_0x08bc('0x1a')](_0x2634a5);var _0x500b3f=getRows(_0x551c44,_0x53139d);_0x1010ac[_0x08bc('0x19')]=_0x1010ac[_0x08bc('0x19')][_0x08bc('0x1b')](_0x500b3f);return _0x1010ac;}function createTables(_0x4cfd7f){var _0x47f3e7=[];var _0x29b4de=_[_0x08bc('0x1c')](Object[_0x08bc('0x1d')](_0x4cfd7f[0x0]),0x5);_0x29b4de[_0x08bc('0x1e')](function(_0x4e64b6){_0x47f3e7['push'](createTable(_0x4e64b6,_0x4cfd7f));});return _0x47f3e7;}function getPDFDocDefinition(_0x462809){var _0x52a65d=util[_0x08bc('0x1f')](_0x08bc('0x20'),NAME,EXTRACTED_REPORT[_0x08bc('0x21')],moment(EXTRACTED_REPORT[_0x08bc('0x22')])[_0x08bc('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0x08bc('0x23')])[_0x08bc('0x1f')](FORMAT));var _0x52ecb5=[];for(var _0xe0e3c=0x0;_0xe0e3c<_0x462809['length'];_0xe0e3c++){var _0x35601f=[];if(_0xe0e3c===0x0){_0x35601f[_0x08bc('0x1a')]({'text':_0x52a65d,'style':_0x08bc('0x24')});}var _0x4ad7f5={'table':_0x462809[_0xe0e3c]};if(_0xe0e3c>0x0){_0x4ad7f5[_0x08bc('0x25')]=_0x08bc('0x26');_0x4ad7f5[_0x08bc('0x27')]=[0x0,0x46,0x0,0x0];}_0x35601f['push'](_0x4ad7f5);_0x52ecb5[_0x08bc('0x1a')](_0x35601f);}return{'pageSize':'A4','pageOrientation':_0x08bc('0x28'),'content':_0x52ecb5,'footer':function(_0x1b128f,_0x3a9913){return{'text':_0x1b128f[_0x08bc('0x15')]()+_0x08bc('0x29')+_0x3a9913,'style':_0x08bc('0x2a')};},'defaultStyle':{'font':_0x08bc('0x2b')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x08bc('0x2c'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1adc9){var _0x1d4e30=0x1388;var _0xd12d8b;if(!_0x1adc9[0x0][_0x08bc('0x2d')]){return analyticExtractedReport(_0x08bc('0x2e'));}return db['Setting'][_0x08bc('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x08bc('0x30'),_0x08bc('0x31')]})[_0x08bc('0x32')](function(_0x33a81e){if(_0x33a81e){_0xd12d8b=_0x33a81e;_0x1d4e30=_0xd12d8b['splitSizePdf']||0x3e8;}})[_0x08bc('0x32')](function(){var _0xda731=[];var _0xb13b1d=0x0;if(_0xd12d8b['split']){if(_0x1adc9&&_0x1adc9[_0x08bc('0x17')]){var _0x2f9626=_['range'](_0x1adc9[0x0][_0x08bc('0x2d')]/_0x1d4e30);var _0x1c3f4a=Number[_0x08bc('0x33')](_0x1adc9[0x0][_0x08bc('0x2d')]/_0x1d4e30)?_0x1adc9[0x0][_0x08bc('0x2d')]%_0x1d4e30:0x0;_0x2f9626[_0x08bc('0x1e')](function(_0x2111f1){if(_0x2111f1>0x0){_0xb13b1d+=_0x1d4e30;}_0xda731[_0x08bc('0x1a')](dbH[_0x08bc('0x34')]['query'](util[_0x08bc('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1d4e30,_0xb13b1d),{'type':dbH[_0x08bc('0x34')][_0x08bc('0x35')][_0x08bc('0x36')]}));});if(_0x1c3f4a>0x0){_0xb13b1d+=_0x1d4e30;_0xda731['push'](dbH[_0x08bc('0x34')]['query'](util[_0x08bc('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1c3f4a,_0xb13b1d),{'type':dbH[_0x08bc('0x34')][_0x08bc('0x35')][_0x08bc('0x36')]}));}}}else{_0xda731[_0x08bc('0x1a')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x08bc('0x34')][_0x08bc('0x35')][_0x08bc('0x36')]}));}var _0x318af9=path[_0x08bc('0x37')](PATH);var _0x7fda98=path[_0x08bc('0x38')](PATH,_0x08bc('0x39'));var _0x56eee1=_0xd12d8b[_0x08bc('0x30')]&&_0xda731[_0x08bc('0x17')]>0x1;var _0x4e3866=[];if(!fs[_0x08bc('0x3a')](path[_0x08bc('0x3b')](_0x318af9,_0x7fda98))&&_0x56eee1){fs[_0x08bc('0x3c')](path[_0x08bc('0x3b')](_0x318af9,_0x7fda98));}return BPromise[_0x08bc('0x3d')](_0xda731,function(_0x5147ff){_0x4e3866[_0x08bc('0x1a')](_0x5147ff);})[_0x08bc('0x32')](function(){var _0x3b2343=[];for(var _0x194bbd=0x0;_0x194bbd<_0x4e3866[_0x08bc('0x17')];_0x194bbd+=0x1){var _0x5e9218=_0x4e3866[_0x194bbd];var _0x1dc0c8=createTables(_[_0x08bc('0x3e')](_0x5e9218));var _0x3a8253;var _0x36c032=getPDFDocDefinition(_0x1dc0c8);var _0x4bd41e=getPDFPrinter();var _0x33c4d5=_0x4bd41e['createPdfKitDocument'](_0x36c032);if(_0x56eee1){_0x3a8253=path['join'](_0x318af9,_0x7fda98,util['format'](_0x08bc('0x3f'),_0x7fda98,_0x194bbd,'pdf'));}else{_0x3a8253=path[_0x08bc('0x3b')](_0x318af9,util[_0x08bc('0x1f')](_0x08bc('0x40'),_0x7fda98,_0x08bc('0x41')));}_0x3b2343[_0x08bc('0x1a')](writePDFDocument(_0x33c4d5,_0x3a8253));}return Promise[_0x08bc('0x42')](_0x3b2343);})[_0x08bc('0x32')](function(){if(_0x56eee1){return new Promise(function(_0x1d1d03){zipdir(path['join'](_0x318af9,_0x7fda98),{'saveTo':path[_0x08bc('0x3b')](_0x318af9,util[_0x08bc('0x1f')](_0x08bc('0x40'),_0x7fda98,'zip'))},function(){rimraf(path['join'](_0x318af9,_0x7fda98),function(){});_0x1d1d03('zip\x20finished');});});}})['then'](function(){if(!_0x56eee1)return;rimraf(path[_0x08bc('0x3b')](_0x318af9,_0x7fda98),function(){});})['then'](function(){logger[_0x08bc('0x43')](util[_0x08bc('0x1f')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x08bc('0x44')));return analyticExtractedReport('Completed',_0x56eee1?util['format']('%s.%s',_0x7fda98,_0x56eee1?_0x08bc('0x45'):_0x08bc('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0x08bc('0x46'),EXTRACTED_REPORT_ID,_0x08bc('0x44')));return db[_0x08bc('0x10')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x08bc('0x32')](function(_0x45427f){EXTRACTED_REPORT=_0x45427f;return dbH['sequelize'][_0x08bc('0x47')](util['format'](_0x08bc('0x48'),QUERY),{'type':dbH[_0x08bc('0x34')][_0x08bc('0x35')]['SELECT']});})[_0x08bc('0x32')](extractReport)[_0x08bc('0x49')](function(_0x4174af){logger[_0x08bc('0x43')](util[_0x08bc('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x08bc('0x44')),util[_0x08bc('0x4a')](_0x4174af,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x08bc('0x4b'));})[_0x08bc('0x4c')](function(){process[_0x08bc('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2887e6=new PdfPrinter({'Arial':{'normal':__dirname+_0x08bc('0x4e'),'bold':__dirname+_0x08bc('0x4f'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x08bc('0x50')}});return _0x2887e6;}function getPDFDocDefinitionFromHTML(_0x36532a,_0x14a6ae){var _0x345767=util[_0x08bc('0x1f')](_0x08bc('0x51'),_0x14a6ae[_0x08bc('0x52')],_0x14a6ae[_0x08bc('0x53')]);var _0x12524e=moment()[_0x08bc('0x1f')](_0x08bc('0x54'))[_0x08bc('0x15')]();var _0x4fc28a=htmlToPdfmake(_0x36532a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4fc28a],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x08bc('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x08bc('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x08bc('0x24')}];},'footer':function(_0x5e19c8,_0x273c75){return[{'text':util[_0x08bc('0x1f')](_0x08bc('0x56'),_0x345767,_0x5e19c8,_0x273c75,_0x12524e),'style':_0x08bc('0x2a')}];}};}function writePDFDocument(_0x34ae77,_0x2f2e61){return new Promise(function(_0x29de61,_0x5c6f77){var _0x45be2c=_0x34ae77[_0x08bc('0x57')](fs['createWriteStream'](_0x2f2e61));_0x45be2c['on'](_0x08bc('0x58'),function(){_0x29de61(_0x08bc('0x58'));});_0x45be2c['on'](_0x08bc('0x59'),function(_0x143ac5){_0x5c6f77(_0x143ac5);});_0x34ae77[_0x08bc('0x5a')]();});}exports[_0x08bc('0x5b')]=function(_0xb433e6,_0xc6ce39){var _0x257723=getPDFPrinter();var _0x499eda=getPDFDocDefinitionFromHTML(_0xb433e6,_0xc6ce39);var _0x5a3cde=_0x257723['createPdfKitDocument'](_0x499eda);return writePDFDocument(_0x5a3cde,_0xc6ce39['path'])['catch'](function(_0x3602d2){throw _0x3602d2;});}; \ No newline at end of file +var _0x9ba4=['zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','info','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','header','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','tableHeader','map','toString','fill','length','auto','body','push','concat','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','endDate','pageBreak','before','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','splitSizePdf','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','SELECT','QueryTypes','dirname','basename','.pdf','split','join','mkdirSync','each','then','flatten','pdf','%s.%s','all'];(function(_0x51bad8,_0x2e6a7a){var _0x28c579=function(_0x41ecb7){while(--_0x41ecb7){_0x51bad8['push'](_0x51bad8['shift']());}};_0x28c579(++_0x2e6a7a);}(_0x9ba4,0x74));var _0x49ba=function(_0xa72afc,_0x2d116c){_0xa72afc=_0xa72afc-0x0;var _0x2002ce=_0x9ba4[_0xa72afc];return _0x2002ce;};'use strict';var _=require(_0x49ba('0x0'));var fs=require('fs');var util=require(_0x49ba('0x1'));var path=require(_0x49ba('0x2'));var moment=require(_0x49ba('0x3'));var htmlToPdfmake=require(_0x49ba('0x4'));var PdfPrinter=require(_0x49ba('0x5'));var zipdir=require(_0x49ba('0x6'));var rimraf=require(_0x49ba('0x7'));var JSDOM=require(_0x49ba('0x8'))[_0x49ba('0x9')];var window=new JSDOM('')[_0x49ba('0xa')];var BPromise=require(_0x49ba('0xb'));var db=require(_0x49ba('0xc'))['db'];var dbH=require('../../mysqldb')[_0x49ba('0xd')];var logger=require(_0x49ba('0xe'))(_0x49ba('0xf'));var EXTRACTED_REPORT_ID=Number(process[_0x49ba('0x10')][0x2]);var QUERY=process[_0x49ba('0x10')][0x3];var PATH=process[_0x49ba('0x10')][0x4];var NAME=process[_0x49ba('0x10')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4aa69d,_0x26a681){var _0x2d6296={'status':_0x4aa69d};var _0x580b4b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x26a681){_0x2d6296[_0x49ba('0x11')]=_0x26a681;}return db[_0x49ba('0x12')]['update'](_0x2d6296,_0x580b4b);}function getHeaders(_0x4f3f36){return _['map'](_0x4f3f36,function(_0x5db7a9){return{'text':_0x5db7a9,'style':_0x49ba('0x13')};});}function getRows(_0x51dfbe,_0x464912){return _[_0x49ba('0x14')](_0x464912,function(_0x3f2c7b){return _(_0x3f2c7b)['pick'](_0x51dfbe)[_0x49ba('0x14')](function(_0x5e18d7){return _0x5e18d7?_[_0x49ba('0x15')](_0x5e18d7):'';})['value']();});}function createTable(_0x53cb09,_0x37a208){var _0x754775={'widths':_[_0x49ba('0x16')](Array(_0x53cb09[_0x49ba('0x17')]),0x91),'heights':function(_0x35cb01){return _0x35cb01===0x0?_0x49ba('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5afcea=getHeaders(_0x53cb09);_0x754775[_0x49ba('0x19')][_0x49ba('0x1a')](_0x5afcea);var _0x2b8e8e=getRows(_0x53cb09,_0x37a208);_0x754775[_0x49ba('0x19')]=_0x754775['body'][_0x49ba('0x1b')](_0x2b8e8e);return _0x754775;}function createTables(_0x5583b4){var _0x2b23bf=[];var _0x47669d=_['chunk'](Object['keys'](_0x5583b4[0x0]),0x5);_0x47669d[_0x49ba('0x1c')](function(_0x1f4d11){_0x2b23bf[_0x49ba('0x1a')](createTable(_0x1f4d11,_0x5583b4));});return _0x2b23bf;}function getPDFDocDefinition(_0x364ab0){var _0x31324b=util[_0x49ba('0x1d')](_0x49ba('0x1e'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x49ba('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x49ba('0x1f')])[_0x49ba('0x1d')](FORMAT));var _0x543e0c=[];for(var _0xf7d143=0x0;_0xf7d143<_0x364ab0[_0x49ba('0x17')];_0xf7d143++){var _0x4b2b32=[];if(_0xf7d143===0x0){_0x4b2b32[_0x49ba('0x1a')]({'text':_0x31324b,'style':'header'});}var _0x6bc285={'table':_0x364ab0[_0xf7d143]};if(_0xf7d143>0x0){_0x6bc285[_0x49ba('0x20')]=_0x49ba('0x21');_0x6bc285['margin']=[0x0,0x46,0x0,0x0];}_0x4b2b32['push'](_0x6bc285);_0x543e0c[_0x49ba('0x1a')](_0x4b2b32);}return{'pageSize':'A4','pageOrientation':_0x49ba('0x22'),'content':_0x543e0c,'footer':function(_0x303bd1,_0x359554){return{'text':_0x303bd1['toString']()+_0x49ba('0x23')+_0x359554,'style':_0x49ba('0x24')};},'defaultStyle':{'font':_0x49ba('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x49ba('0x26')},'footer':{'alignment':_0x49ba('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x20b23b){var _0x287f4b=0x1388;var _0x32a058;if(!_0x20b23b[0x0][_0x49ba('0x28')]){return analyticExtractedReport(_0x49ba('0x29'));}return db[_0x49ba('0x2a')][_0x49ba('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x49ba('0x2c')]})['then'](function(_0x42c045){if(_0x42c045){_0x32a058=_0x42c045;_0x287f4b=_0x32a058['splitSizePdf']||0x3e8;}})['then'](function(){var _0x40a53d=[];var _0xe3871d=0x0;if(_0x32a058['split']){if(_0x20b23b&&_0x20b23b[_0x49ba('0x17')]){var _0x24c025=_[_0x49ba('0x2d')](_0x20b23b[0x0]['num']/_0x287f4b);var _0x397897=Number[_0x49ba('0x2e')](_0x20b23b[0x0][_0x49ba('0x28')]/_0x287f4b)?_0x20b23b[0x0][_0x49ba('0x28')]%_0x287f4b:0x0;_0x24c025[_0x49ba('0x1c')](function(_0x5a6d0e){if(_0x5a6d0e>0x0){_0xe3871d+=_0x287f4b;}_0x40a53d[_0x49ba('0x1a')](dbH['sequelize'][_0x49ba('0x2f')](util[_0x49ba('0x1d')](_0x49ba('0x30'),QUERY,_0x287f4b,_0xe3871d),{'type':dbH[_0x49ba('0x31')]['QueryTypes'][_0x49ba('0x32')]}));});if(_0x397897>0x0){_0xe3871d+=_0x287f4b;_0x40a53d[_0x49ba('0x1a')](dbH[_0x49ba('0x31')][_0x49ba('0x2f')](util[_0x49ba('0x1d')](_0x49ba('0x30'),QUERY,_0x397897,_0xe3871d),{'type':dbH[_0x49ba('0x31')][_0x49ba('0x33')][_0x49ba('0x32')]}));}}}else{_0x40a53d['push'](dbH['sequelize'][_0x49ba('0x2f')](QUERY,{'type':dbH['sequelize'][_0x49ba('0x33')][_0x49ba('0x32')]}));}var _0x471ecb=path[_0x49ba('0x34')](PATH);var _0x5c8b25=path[_0x49ba('0x35')](PATH,_0x49ba('0x36'));var _0x482c2c=_0x32a058[_0x49ba('0x37')]&&_0x40a53d[_0x49ba('0x17')]>0x1;var _0x488710=[];if(!fs['existsSync'](path[_0x49ba('0x38')](_0x471ecb,_0x5c8b25))&&_0x482c2c){fs[_0x49ba('0x39')](path[_0x49ba('0x38')](_0x471ecb,_0x5c8b25));}return BPromise[_0x49ba('0x3a')](_0x40a53d,function(_0x2cbe8b){_0x488710['push'](_0x2cbe8b);})[_0x49ba('0x3b')](function(){var _0x16881d=[];for(var _0x941193=0x0;_0x941193<_0x488710[_0x49ba('0x17')];_0x941193+=0x1){var _0x5b0529=_0x488710[_0x941193];var _0x90d5db=createTables(_[_0x49ba('0x3c')](_0x5b0529));var _0x15c4f8;var _0x3b4f91=getPDFDocDefinition(_0x90d5db);var _0x4856bc=getPDFPrinter();var _0x2b8671=_0x4856bc['createPdfKitDocument'](_0x3b4f91);if(_0x482c2c){_0x15c4f8=path[_0x49ba('0x38')](_0x471ecb,_0x5c8b25,util['format']('%s%d.%s',_0x5c8b25,_0x941193,_0x49ba('0x3d')));}else{_0x15c4f8=path['join'](_0x471ecb,util['format'](_0x49ba('0x3e'),_0x5c8b25,_0x49ba('0x3d')));}_0x16881d[_0x49ba('0x1a')](writePDFDocument(_0x2b8671,_0x15c4f8));}return Promise[_0x49ba('0x3f')](_0x16881d);})[_0x49ba('0x3b')](function(){if(_0x482c2c){return new Promise(function(_0x3ea661){zipdir(path[_0x49ba('0x38')](_0x471ecb,_0x5c8b25),{'saveTo':path[_0x49ba('0x38')](_0x471ecb,util['format'](_0x49ba('0x3e'),_0x5c8b25,'zip'))},function(){rimraf(path[_0x49ba('0x38')](_0x471ecb,_0x5c8b25),function(){});_0x3ea661(_0x49ba('0x40'));});});}})['then'](function(){if(!_0x482c2c)return;rimraf(path[_0x49ba('0x38')](_0x471ecb,_0x5c8b25),function(){});})[_0x49ba('0x3b')](function(){logger['info'](util[_0x49ba('0x1d')](_0x49ba('0x41'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x482c2c?util[_0x49ba('0x1d')]('%s.%s',_0x5c8b25,_0x482c2c?_0x49ba('0x42'):_0x49ba('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x49ba('0x43')](util[_0x49ba('0x1d')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x49ba('0x44')));return db['AnalyticExtractedReport'][_0x49ba('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x49ba('0x3b')](function(_0xf03e67){EXTRACTED_REPORT=_0xf03e67;return dbH[_0x49ba('0x31')][_0x49ba('0x2f')](util[_0x49ba('0x1d')](_0x49ba('0x46'),QUERY),{'type':dbH[_0x49ba('0x31')][_0x49ba('0x33')]['SELECT']});})[_0x49ba('0x3b')](extractReport)['catch'](function(_0x50a587){logger['info'](util[_0x49ba('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0x49ba('0x47')](_0x50a587,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x49ba('0x48'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x9eb789=new PdfPrinter({'Arial':{'normal':__dirname+_0x49ba('0x49'),'bold':__dirname+_0x49ba('0x4a'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x49ba('0x4b')}});return _0x9eb789;}function getPDFDocDefinitionFromHTML(_0x4b497f,_0x2c2c59){var _0x272cf5=util['format'](_0x49ba('0x4c'),_0x2c2c59[_0x49ba('0x4d')],_0x2c2c59[_0x49ba('0x4e')]);var _0x222172=moment()[_0x49ba('0x1d')]('YYYY-MM-DD')[_0x49ba('0x15')]();var _0x3ef902=htmlToPdfmake(_0x4b497f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3ef902],'defaultStyle':{'font':_0x49ba('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x49ba('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x49ba('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x49ba('0x50'),'style':_0x49ba('0x51')}];},'footer':function(_0x43ac85,_0x32f662){return[{'text':util[_0x49ba('0x1d')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x272cf5,_0x43ac85,_0x32f662,_0x222172),'style':'footer'}];}};}function writePDFDocument(_0x116b50,_0x7b83c0){return new Promise(function(_0x4463b1,_0x9c07bf){var _0x2fe5ce=_0x116b50[_0x49ba('0x52')](fs[_0x49ba('0x53')](_0x7b83c0));_0x2fe5ce['on'](_0x49ba('0x54'),function(){_0x4463b1(_0x49ba('0x54'));});_0x2fe5ce['on'](_0x49ba('0x55'),function(_0x22b6b5){_0x9c07bf(_0x22b6b5);});_0x116b50[_0x49ba('0x56')]();});}exports[_0x49ba('0x57')]=function(_0x47cf39,_0x18b725){var _0x1e94f6=getPDFPrinter();var _0x2ec713=getPDFDocDefinitionFromHTML(_0x47cf39,_0x18b725);var _0x192114=_0x1e94f6[_0x49ba('0x58')](_0x2ec713);return writePDFDocument(_0x192114,_0x18b725[_0x49ba('0x2')])[_0x49ba('0x59')](function(_0x8eba4f){throw _0x8eba4f;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 1d711d1..b264bfb 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 _0x9dde=['mkdirSync','join','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','finally','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','then','splitSizeXlsx','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9dde,0x1e2));var _0xe9dd=function(_0x61ff91,_0x550519){_0x61ff91=_0x61ff91-0x0;var _0xbd0ed7=_0x9dde[_0x61ff91];return _0xbd0ed7;};'use strict';var util=require('util');var path=require(_0xe9dd('0x0'));var _=require(_0xe9dd('0x1'));var fs=require('fs');var json2xls=require(_0xe9dd('0x2'));var BPromise=require(_0xe9dd('0x3'));var zipdir=require(_0xe9dd('0x4'));var rimraf=require(_0xe9dd('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe9dd('0x6'))['dbH'];var logger=require(_0xe9dd('0x7'))(_0xe9dd('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xe9dd('0x9')][0x2]);var QUERY=process[_0xe9dd('0x9')][0x3];var PATH=process[_0xe9dd('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x477a38,_0x2ea5b7){var _0x38d736={'status':_0x477a38};var _0x4b2a68={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ea5b7){_0x38d736[_0xe9dd('0xa')]=_0x2ea5b7;}return db['AnalyticExtractedReport'][_0xe9dd('0xb')](_0x38d736,_0x4b2a68);}function main(){var _0x4cd34e=0x1388;var _0x59fb2f;logger[_0xe9dd('0xc')](util[_0xe9dd('0xd')](_0xe9dd('0xe'),EXTRACTED_REPORT_ID,_0xe9dd('0xf')));return db[_0xe9dd('0x10')][_0xe9dd('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0xe9dd('0x12')](function(_0x7461b2){if(_0x7461b2){_0x59fb2f=_0x7461b2;_0x4cd34e=_0x59fb2f[_0xe9dd('0x13')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0xe9dd('0x14')](util['format'](_0xe9dd('0x15'),QUERY),{'type':dbH[_0xe9dd('0x16')][_0xe9dd('0x17')][_0xe9dd('0x18')]});})[_0xe9dd('0x12')](function(_0x1e5eaa){if(!_0x1e5eaa[0x0][_0xe9dd('0x19')]){return analyticExtractedReport(_0xe9dd('0x1a'));}var _0x13038c=[];var _0x1e5256=0x0;if(_0x59fb2f[_0xe9dd('0x1b')]){if(_0x1e5eaa&&_0x1e5eaa[_0xe9dd('0x1c')]){var _0x368b3d=_[_0xe9dd('0x1d')](_0x1e5eaa[0x0][_0xe9dd('0x19')]/_0x4cd34e);var _0x57cc59=Number[_0xe9dd('0x1e')](_0x1e5eaa[0x0][_0xe9dd('0x19')]/_0x4cd34e)?_0x1e5eaa[0x0][_0xe9dd('0x19')]%_0x4cd34e:0x0;_0x368b3d[_0xe9dd('0x1f')](function(_0x394ec2){if(_0x394ec2>0x0){_0x1e5256+=_0x4cd34e;}_0x13038c[_0xe9dd('0x20')](dbH[_0xe9dd('0x16')]['query'](util[_0xe9dd('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4cd34e,_0x1e5256),{'type':dbH[_0xe9dd('0x16')]['QueryTypes']['SELECT']}));});if(_0x57cc59>0x0){_0x1e5256+=_0x4cd34e;_0x13038c[_0xe9dd('0x20')](dbH['sequelize'][_0xe9dd('0x14')](util[_0xe9dd('0xd')](_0xe9dd('0x21'),QUERY,_0x57cc59,_0x1e5256),{'type':dbH[_0xe9dd('0x16')][_0xe9dd('0x17')]['SELECT']}));}}}else{_0x13038c['push'](dbH['sequelize'][_0xe9dd('0x14')](QUERY,{'type':dbH[_0xe9dd('0x16')][_0xe9dd('0x17')][_0xe9dd('0x18')]}));}var _0x5b3468=path[_0xe9dd('0x22')](PATH);var _0x497eb9=path[_0xe9dd('0x23')](PATH,_0xe9dd('0x24'));var _0x30342b=_0x59fb2f[_0xe9dd('0x1b')]&&_0x13038c[_0xe9dd('0x1c')]>0x1;var _0x2f5f59=[];if(!fs[_0xe9dd('0x25')](path['join'](_0x5b3468,_0x497eb9))&&_0x30342b){fs[_0xe9dd('0x26')](path[_0xe9dd('0x27')](_0x5b3468,_0x497eb9));}return BPromise['each'](_0x13038c,function(_0x178718){_0x2f5f59['push'](_0x178718);})[_0xe9dd('0x12')](function(){for(var _0x1ec997=0x0;_0x1ec997<_0x2f5f59[_0xe9dd('0x1c')];_0x1ec997+=0x1){var _0x2e0a34;var _0x409567=_0x2f5f59[_0x1ec997];if(_0x30342b){_0x2e0a34=path[_0xe9dd('0x27')](_0x5b3468,_0x497eb9,util[_0xe9dd('0xd')](_0xe9dd('0x28'),_0x497eb9,_0x1ec997,_0xe9dd('0x29')));}else{_0x2e0a34=path[_0xe9dd('0x27')](_0x5b3468,util[_0xe9dd('0xd')](_0xe9dd('0x2a'),_0x497eb9,_0xe9dd('0x29')));}fs[_0xe9dd('0x2b')](_0x2e0a34,json2xls(_0x409567),_0xe9dd('0x2c'));}})[_0xe9dd('0x12')](function(){if(_0x30342b){return new Promise(function(_0x381878){zipdir(path[_0xe9dd('0x27')](_0x5b3468,_0x497eb9),{'saveTo':path[_0xe9dd('0x27')](_0x5b3468,util[_0xe9dd('0xd')](_0xe9dd('0x2a'),_0x497eb9,_0xe9dd('0x2d')))},function(_0x5e4a60,_0x1c3ef1){rimraf(path[_0xe9dd('0x27')](_0x5b3468,_0x497eb9),function(){});_0x381878('zip\x20finished');});});}})[_0xe9dd('0x12')](function(){logger[_0xe9dd('0xc')](util[_0xe9dd('0xd')](_0xe9dd('0x2e'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xe9dd('0x2f'),_0x30342b?util[_0xe9dd('0xd')](_0xe9dd('0x2a'),_0x497eb9,_0x30342b?_0xe9dd('0x2d'):_0xe9dd('0x29')):null);});})[_0xe9dd('0x30')](function(_0x4b44cb){logger[_0xe9dd('0xc')](util[_0xe9dd('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x4b44cb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe9dd('0x31'));})[_0xe9dd('0x32')](function(){process[_0xe9dd('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xffea=['../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf'];(function(_0x5e9913,_0x4552cc){var _0x4ac3f2=function(_0x4cdfcb){while(--_0x4cdfcb){_0x5e9913['push'](_0x5e9913['shift']());}};_0x4ac3f2(++_0x4552cc);}(_0xffea,0x199));var _0xaffe=function(_0x5b37f2,_0x184ebd){_0x5b37f2=_0x5b37f2-0x0;var _0x10b879=_0xffea[_0x5b37f2];return _0x10b879;};'use strict';var util=require(_0xaffe('0x0'));var path=require(_0xaffe('0x1'));var _=require(_0xaffe('0x2'));var fs=require('fs');var json2xls=require(_0xaffe('0x3'));var BPromise=require(_0xaffe('0x4'));var zipdir=require(_0xaffe('0x5'));var rimraf=require(_0xaffe('0x6'));var db=require(_0xaffe('0x7'))['db'];var dbH=require(_0xaffe('0x7'))[_0xaffe('0x8')];var logger=require(_0xaffe('0x9'))(_0xaffe('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xaffe('0xb')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5c332c,_0x105cc1){var _0x52ea0a={'status':_0x5c332c};var _0x28cd3f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x105cc1){_0x52ea0a[_0xaffe('0xc')]=_0x105cc1;}return db[_0xaffe('0xd')]['update'](_0x52ea0a,_0x28cd3f);}function main(){var _0x24c50b=0x1388;var _0x4e92cd;logger[_0xaffe('0xe')](util['format'](_0xaffe('0xf'),EXTRACTED_REPORT_ID,_0xaffe('0x10')));return db[_0xaffe('0x11')][_0xaffe('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xaffe('0x13'),_0xaffe('0x14')]})[_0xaffe('0x15')](function(_0x3d4c76){if(_0x3d4c76){_0x4e92cd=_0x3d4c76;_0x24c50b=_0x4e92cd[_0xaffe('0x14')]||0x1388;}})[_0xaffe('0x15')](function(){return dbH[_0xaffe('0x16')][_0xaffe('0x17')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xaffe('0x18')][_0xaffe('0x19')]});})[_0xaffe('0x15')](function(_0x56a493){if(!_0x56a493[0x0][_0xaffe('0x1a')]){return analyticExtractedReport(_0xaffe('0x1b'));}var _0x1d9491=[];var _0x6671d0=0x0;if(_0x4e92cd[_0xaffe('0x13')]){if(_0x56a493&&_0x56a493[_0xaffe('0x1c')]){var _0x26da09=_[_0xaffe('0x1d')](_0x56a493[0x0][_0xaffe('0x1a')]/_0x24c50b);var _0x282874=Number[_0xaffe('0x1e')](_0x56a493[0x0]['num']/_0x24c50b)?_0x56a493[0x0]['num']%_0x24c50b:0x0;_0x26da09[_0xaffe('0x1f')](function(_0x2fb089){if(_0x2fb089>0x0){_0x6671d0+=_0x24c50b;}_0x1d9491[_0xaffe('0x20')](dbH['sequelize'][_0xaffe('0x17')](util[_0xaffe('0x21')](_0xaffe('0x22'),QUERY,_0x24c50b,_0x6671d0),{'type':dbH[_0xaffe('0x16')][_0xaffe('0x18')]['SELECT']}));});if(_0x282874>0x0){_0x6671d0+=_0x24c50b;_0x1d9491[_0xaffe('0x20')](dbH[_0xaffe('0x16')][_0xaffe('0x17')](util['format'](_0xaffe('0x22'),QUERY,_0x282874,_0x6671d0),{'type':dbH[_0xaffe('0x16')][_0xaffe('0x18')]['SELECT']}));}}}else{_0x1d9491[_0xaffe('0x20')](dbH['sequelize'][_0xaffe('0x17')](QUERY,{'type':dbH[_0xaffe('0x16')][_0xaffe('0x18')][_0xaffe('0x19')]}));}var _0x45f81e=path[_0xaffe('0x23')](PATH);var _0x2e7648=path[_0xaffe('0x24')](PATH,_0xaffe('0x25'));var _0x377255=_0x4e92cd[_0xaffe('0x13')]&&_0x1d9491['length']>0x1;var _0x18d48a=[];if(!fs[_0xaffe('0x26')](path[_0xaffe('0x27')](_0x45f81e,_0x2e7648))&&_0x377255){fs[_0xaffe('0x28')](path[_0xaffe('0x27')](_0x45f81e,_0x2e7648));}return BPromise[_0xaffe('0x29')](_0x1d9491,function(_0x2146f1){_0x18d48a[_0xaffe('0x20')](_0x2146f1);})[_0xaffe('0x15')](function(){for(var _0x2df832=0x0;_0x2df832<_0x18d48a[_0xaffe('0x1c')];_0x2df832+=0x1){var _0x329338;var _0x4860a2=_0x18d48a[_0x2df832];if(_0x377255){_0x329338=path['join'](_0x45f81e,_0x2e7648,util[_0xaffe('0x21')](_0xaffe('0x2a'),_0x2e7648,_0x2df832,_0xaffe('0x2b')));}else{_0x329338=path['join'](_0x45f81e,util[_0xaffe('0x21')](_0xaffe('0x2c'),_0x2e7648,_0xaffe('0x2b')));}fs[_0xaffe('0x2d')](_0x329338,json2xls(_0x4860a2),'binary');}})[_0xaffe('0x15')](function(){if(_0x377255){return new Promise(function(_0x1a1a75){zipdir(path[_0xaffe('0x27')](_0x45f81e,_0x2e7648),{'saveTo':path[_0xaffe('0x27')](_0x45f81e,util['format']('%s.%s',_0x2e7648,'zip'))},function(_0x58f36e,_0x4af98b){rimraf(path['join'](_0x45f81e,_0x2e7648),function(){});_0x1a1a75('zip\x20finished');});});}})['then'](function(){logger[_0xaffe('0xe')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xaffe('0x2e'),_0x377255?util[_0xaffe('0x21')](_0xaffe('0x2c'),_0x2e7648,_0x377255?_0xaffe('0x2f'):'xlsx'):null);});})['catch'](function(_0x3feeb8){logger['info'](util[_0xaffe('0x21')](_0xaffe('0x30'),EXTRACTED_REPORT_ID,_0xaffe('0x10')),util[_0xaffe('0x31')](_0x3feeb8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xaffe('0x32')](function(){process[_0xaffe('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 4c80b61..5d3572d 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 _0x4a7e=['XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','intervals','CDR(tag)=','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','toLowerCase','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','rewrite','lodash','util','Interval','then','models','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','VoiceExtensionId','inbound','Set','outbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','context','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav'];(function(_0x25408e,_0x457e2d){var _0xd3099d=function(_0x44fe35){while(--_0x44fe35){_0x25408e['push'](_0x25408e['shift']());}};_0xd3099d(++_0x457e2d);}(_0x4a7e,0x1d8));var _0xe4a7=function(_0x3d8c14,_0x2b788e){_0x3d8c14=_0x3d8c14-0x0;var _0x1694fd=_0x4a7e[_0x3d8c14];return _0x1694fd;};'use strict';var _=require(_0xe4a7('0x0'));var util=require(_0xe4a7('0x1'));function rewrite(_0x20c726,_0x31b8ea){var _0x1956a4=this;return _0x20c726['models'][_0xe4a7('0x2')]['findAll']({'raw':!![]})[_0xe4a7('0x3')](function(_0x382981){_0x1956a4['intervals']=_0x382981;return _0x20c726[_0xe4a7('0x4')][_0xe4a7('0x5')][_0xe4a7('0x6')]({'where':{'IntervalId':_0x31b8ea[_0xe4a7('0x7')]},'raw':!![]});})[_0xe4a7('0x3')](function(_0x16e0e6){return _0x20c726[_0xe4a7('0x4')][_0xe4a7('0x5')][_0xe4a7('0x6')]({'where':{'exten':{'$in':_[_0xe4a7('0x8')](_[_0xe4a7('0x9')](_0x16e0e6,_0xe4a7('0xa')))}},'order':[{'raw':_0xe4a7('0xb')}],'raw':!![]});})['then'](function(_0x535b70){var _0x520584=_[_0xe4a7('0xc')](_0x535b70,{'priority':'1'});var _0x1bd86a=_[_0xe4a7('0xc')](_0x535b70,{'isApp':0x1});var _0x1708c3=_['groupBy'](_0x1bd86a,_0xe4a7('0xa'));var _0x2857de=['queue','playback'];var _0x469e24=[];var _0x47aa19=[];for(var _0x554468 in _0x1708c3){if(_0x1708c3[_0xe4a7('0xd')](_0x554468)){_0x1956a4[_0xe4a7('0xe')]=0x2;_0x1956a4[_0xe4a7('0xf')]=[];_0x1956a4[_0xe4a7('0x10')]=_[_0xe4a7('0x11')](_0x520584,{'exten':_0x1708c3[_0x554468][0x0][_0xe4a7('0xa')]});_0x1956a4[_0xe4a7('0xf')][_0xe4a7('0x12')]({'type':_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')],'app':'Set','appdata':util[_0xe4a7('0x14')](_0xe4a7('0x15'),_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')]),'context':_0x1708c3[_0x554468][0x0]['context'],'exten':_0x1708c3[_0x554468][0x0][_0xe4a7('0xa')],'priority':_0x1956a4[_0xe4a7('0xe')]++,'VoiceExtensionId':_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')]});if(_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')]===_0xe4a7('0x17')){_0x1956a4[_0xe4a7('0xf')][_0xe4a7('0x12')]({'type':_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')],'app':_0xe4a7('0x18'),'appdata':'CDR(routeid)='+_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')],'context':_0x1708c3[_0x554468][0x0]['context'],'exten':_0x1708c3[_0x554468][0x0][_0xe4a7('0xa')],'priority':_0x1956a4[_0xe4a7('0xe')]++,'VoiceExtensionId':_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')]});}else if(_0x1708c3[_0x554468][0x0]['type']===_0xe4a7('0x19')){if(_0x1956a4[_0xe4a7('0x10')]){_0x1956a4[_0xe4a7('0xf')][_0xe4a7('0x12')]({'type':_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')],'app':_0xe4a7('0x18'),'appdata':_0xe4a7('0x1a')+(_0x1956a4[_0xe4a7('0x10')][_0xe4a7('0x1b')]?_0xe4a7('0x1c')+_0x1956a4['extension'][_0xe4a7('0x1b')]+'}':'${EXTEN}'),'context':_0x1708c3[_0x554468][0x0]['context'],'exten':_0x1708c3[_0x554468][0x0][_0xe4a7('0xa')],'priority':_0x1956a4[_0xe4a7('0xe')]++,'VoiceExtensionId':_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')]});}_0x1956a4[_0xe4a7('0xf')][_0xe4a7('0x12')]({'type':_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')],'app':_0xe4a7('0x18'),'appdata':_0xe4a7('0x1d')+_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')],'context':_0x1708c3[_0x554468][0x0][_0xe4a7('0x1e')],'exten':_0x1708c3[_0x554468][0x0][_0xe4a7('0xa')],'priority':_0x1956a4[_0xe4a7('0xe')]++,'VoiceExtensionId':_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')]});var _0x35f63b=_0x1956a4[_0xe4a7('0xe')]++;_0x1956a4['extensions'][_0xe4a7('0x12')]({'type':_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')],'app':'ExecIf','appdata':_0xe4a7('0x1f')+(_0x35f63b+0x2)+_0xe4a7('0x20')+(_0x35f63b+0x1)+')','context':_0x1708c3[_0x554468][0x0][_0xe4a7('0x1e')],'exten':_0x1708c3[_0x554468][0x0][_0xe4a7('0xa')],'priority':_0x35f63b,'VoiceExtensionId':_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')]});if(_0x1956a4[_0xe4a7('0x10')]){_0x1956a4[_0xe4a7('0xf')][_0xe4a7('0x12')]({'type':_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')],'app':'Set','appdata':_0x1956a4[_0xe4a7('0x10')][_0xe4a7('0x1b')]?_0xe4a7('0x21')+_0x1956a4[_0xe4a7('0x10')][_0xe4a7('0x1b')]+'}':_0xe4a7('0x22'),'context':_0x1708c3[_0x554468][0x0]['context'],'exten':_0x1708c3[_0x554468][0x0][_0xe4a7('0xa')],'priority':_0x1956a4[_0xe4a7('0xe')]++,'VoiceExtensionId':_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')]});}_0x1956a4[_0xe4a7('0xf')][_0xe4a7('0x12')]({'type':_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')],'app':_0xe4a7('0x18'),'appdata':'outboundrouteid='+_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')],'context':_0x1708c3[_0x554468][0x0][_0xe4a7('0x1e')],'exten':_0x1708c3[_0x554468][0x0]['exten'],'priority':_0x1956a4[_0xe4a7('0xe')]++,'VoiceExtensionId':_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')]});if(_0x1956a4[_0xe4a7('0x10')]&&_0x1956a4[_0xe4a7('0x10')]['hasOwnProperty'](_0xe4a7('0x23'))&&_0x1956a4[_0xe4a7('0x10')][_0xe4a7('0x23')]!=='none'){_0x1956a4[_0xe4a7('0xf')][_0xe4a7('0x12')]({'type':_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')],'app':'Set','appdata':_0xe4a7('0x24'),'context':_0x1708c3[_0x554468][0x0]['context'],'exten':_0x1708c3[_0x554468][0x0][_0xe4a7('0xa')],'priority':_0x1956a4['priority']++,'VoiceExtensionId':_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')]});_0x1956a4[_0xe4a7('0xf')][_0xe4a7('0x12')]({'type':_0x1708c3[_0x554468][0x0]['type'],'app':'Set','appdata':_0xe4a7('0x25')+_0x1956a4[_0xe4a7('0x10')]['recordingFormat']||_0xe4a7('0x26'),'context':_0x1708c3[_0x554468][0x0]['context'],'exten':_0x1708c3[_0x554468][0x0][_0xe4a7('0xa')],'priority':_0x1956a4[_0xe4a7('0xe')]++,'VoiceExtensionId':_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')]});}}_0x1956a4[_0xe4a7('0xf')][_0xe4a7('0x12')]({'type':_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')],'app':_0xe4a7('0x18'),'appdata':_0xe4a7('0x27'),'context':_0x1708c3[_0x554468][0x0][_0xe4a7('0x1e')],'exten':_0x1708c3[_0x554468][0x0]['exten'],'priority':_0x1956a4['priority']++,'VoiceExtensionId':_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')]});_0x1956a4['extensions'][_0xe4a7('0x12')]({'type':_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')],'app':_0xe4a7('0x18'),'appdata':_0xe4a7('0x28'),'context':_0x1708c3[_0x554468][0x0]['context'],'exten':_0x1708c3[_0x554468][0x0][_0xe4a7('0xa')],'priority':_0x1956a4[_0xe4a7('0xe')]++,'VoiceExtensionId':_0x1708c3[_0x554468][0x0]['VoiceExtensionId']});_0x1956a4[_0xe4a7('0xf')][_0xe4a7('0x12')]({'type':_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')],'app':_0xe4a7('0x18'),'appdata':_0xe4a7('0x29'),'context':_0x1708c3[_0x554468][0x0]['context'],'exten':_0x1708c3[_0x554468][0x0]['exten'],'priority':_0x1956a4[_0xe4a7('0xe')]++,'VoiceExtensionId':_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')]});for(var _0x216148=0x0,_0x38cc39=0x0;_0x216148<_0x1708c3[_0x554468][_0xe4a7('0x2a')];_0x216148+=0x1,_0x38cc39=0x0){var _0x40fb66=_0x1708c3[_0x554468][_0x216148];if(_0x40fb66['type']){_0x40fb66[_0xe4a7('0x13')]=_0x40fb66[_0xe4a7('0x13')]['toLowerCase']();}var _0x37f374=[];var _0x3a00bf=[];delete _0x40fb66['id'];delete _0x40fb66[_0xe4a7('0x2b')];delete _0x40fb66[_0xe4a7('0x2c')];var _0x363a2=_0x40fb66[_0xe4a7('0x2d')]!==_0xe4a7('0x2e')?[_0x40fb66['interval']]:_0x40fb66[_0xe4a7('0x7')]?_[_0xe4a7('0x9')](_[_0xe4a7('0xc')](_0x1956a4[_0xe4a7('0x2f')],{'IntervalId':_0x40fb66[_0xe4a7('0x7')]}),'interval'):[];if(_0x40fb66[_0xe4a7('0xd')]('tag')){if(_0x40fb66['tag']&&_0x40fb66['tag']!=='--'){_0x37f374[_0xe4a7('0x12')]({'type':_0x40fb66[_0xe4a7('0x13')],'app':'Set','appdata':_0xe4a7('0x30')+_0x40fb66[_0xe4a7('0x31')],'context':_0x40fb66['context'],'exten':_0x40fb66['exten'],'priority':_0x363a2[_0xe4a7('0x2a')]+_0x1956a4[_0xe4a7('0xe')]+_0x38cc39++,'VoiceExtensionId':_0x40fb66['VoiceExtensionId']});}}if(_0x40fb66[_0xe4a7('0x13')]===_0xe4a7('0x19')&&_0x40fb66['hasOwnProperty'](_0xe4a7('0x32'))){if(_0x40fb66[_0xe4a7('0x32')]){_0x37f374[_0xe4a7('0x12')]({'type':_0x40fb66['type'],'app':'ExecIf','appdata':_0xe4a7('0x33')+_0x40fb66['callerID']+')','context':_0x40fb66[_0xe4a7('0x1e')],'exten':_0x40fb66[_0xe4a7('0xa')],'priority':_0x363a2[_0xe4a7('0x2a')]+_0x1956a4[_0xe4a7('0xe')]+_0x38cc39++,'VoiceExtensionId':_0x40fb66['VoiceExtensionId']});}else{_0x37f374[_0xe4a7('0x12')]({'type':_0x40fb66[_0xe4a7('0x13')],'app':_0xe4a7('0x34'),'appdata':_0xe4a7('0x35'),'context':_0x40fb66[_0xe4a7('0x1e')],'exten':_0x40fb66[_0xe4a7('0xa')],'priority':_0x363a2[_0xe4a7('0x2a')]+_0x1956a4[_0xe4a7('0xe')]+_0x38cc39++,'VoiceExtensionId':_0x40fb66[_0xe4a7('0x16')]});}}if(_0x40fb66[_0xe4a7('0xd')](_0xe4a7('0x36'))){if(_0x2857de[_0xe4a7('0x37')](_0x40fb66['app'][_0xe4a7('0x38')]())>=0x0&&_0x40fb66[_0xe4a7('0x39')]!==_0xe4a7('0x3a')){if(_0x40fb66[_0xe4a7('0x36')]){_0x37f374['push']({'type':_0x40fb66[_0xe4a7('0x13')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x40fb66[_0xe4a7('0x1e')],'exten':_0x40fb66[_0xe4a7('0xa')],'priority':_0x363a2[_0xe4a7('0x2a')]+_0x1956a4[_0xe4a7('0xe')]+_0x38cc39++,'VoiceExtensionId':_0x40fb66['VoiceExtensionId']});_0x37f374[_0xe4a7('0x12')]({'type':_0x40fb66[_0xe4a7('0x13')],'app':_0xe4a7('0x18'),'appdata':_0xe4a7('0x3b'),'context':_0x40fb66[_0xe4a7('0x1e')],'exten':_0x40fb66[_0xe4a7('0xa')],'priority':_0x363a2[_0xe4a7('0x2a')]+_0x1956a4['priority']+_0x38cc39++,'VoiceExtensionId':_0x40fb66[_0xe4a7('0x16')]});}else{_0x37f374[_0xe4a7('0x12')]({'type':_0x40fb66[_0xe4a7('0x13')],'app':_0xe4a7('0x34'),'appdata':_0xe4a7('0x3c'),'context':_0x40fb66[_0xe4a7('0x1e')],'exten':_0x40fb66[_0xe4a7('0xa')],'priority':_0x363a2[_0xe4a7('0x2a')]+_0x1956a4['priority']+_0x38cc39++,'VoiceExtensionId':_0x40fb66[_0xe4a7('0x16')]});_0x37f374[_0xe4a7('0x12')]({'type':_0x40fb66[_0xe4a7('0x13')],'app':_0xe4a7('0x18'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x40fb66[_0xe4a7('0x1e')],'exten':_0x40fb66[_0xe4a7('0xa')],'priority':_0x363a2[_0xe4a7('0x2a')]+_0x1956a4['priority']+_0x38cc39++,'VoiceExtensionId':_0x40fb66[_0xe4a7('0x16')]});}}}for(var _0x4d669f=0x0;_0x4d669f<_0x363a2[_0xe4a7('0x2a')];_0x4d669f+=0x1){var _0x38d4ba=_0x1956a4[_0xe4a7('0xe')]+_0x363a2[_0xe4a7('0x2a')];var _0x339218=_0x4d669f===_0x363a2['length']-0x1?_0x1956a4['priority']+_0x37f374[_0xe4a7('0x2a')]+_0x3a00bf[_0xe4a7('0x2a')]+0x2:_0x1956a4['priority']+_0x4d669f+0x1;_0x37f374[_0xe4a7('0x3d')](_0x4d669f,0x0,{'type':_0x40fb66[_0xe4a7('0x13')],'app':_0xe4a7('0x3e'),'appdata':_0x363a2[_0x4d669f]+'?'+_0x40fb66[_0xe4a7('0x1e')]+_0xe4a7('0x3f')+_0x38d4ba+':'+_0x40fb66[_0xe4a7('0x1e')]+',${EXTEN},'+_0x339218,'exten':_0x40fb66['exten'],'context':_0x40fb66['context'],'priority':_0x1956a4[_0xe4a7('0xe')]+_0x4d669f,'VoiceExtensionId':_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')]});}_0x40fb66['priority']=_0x37f374[_0xe4a7('0x2a')]?_[_0xe4a7('0x40')](_0x37f374)[_0xe4a7('0xe')]+0x1:_0x1956a4[_0xe4a7('0xe')];_0x1956a4[_0xe4a7('0xe')]=(_0x3a00bf[_0xe4a7('0x2a')]?_[_0xe4a7('0x40')](_0x3a00bf)[_0xe4a7('0xe')]:_0x40fb66[_0xe4a7('0xe')])+0x1;_0x1956a4[_0xe4a7('0xf')]=_[_0xe4a7('0x41')](_0x1956a4[_0xe4a7('0xf')],_0x37f374,[_0x40fb66],_0x3a00bf);}_0x1956a4[_0xe4a7('0xf')][_0xe4a7('0x12')]({'type':_0x1708c3[_0x554468][0x0][_0xe4a7('0x13')],'app':_0xe4a7('0x42'),'exten':_0x1708c3[_0x554468][0x0]['exten'],'context':_0x1708c3[_0x554468][0x0][_0xe4a7('0x1e')],'priority':_0x1956a4[_0xe4a7('0xe')],'VoiceExtensionId':_0x1708c3[_0x554468][0x0][_0xe4a7('0x16')]});_0x469e24[_0xe4a7('0x12')](_0x1708c3[_0x554468][0x0]['VoiceExtensionId']);_0x47aa19=_[_0xe4a7('0x41')](_0x47aa19,_0x1956a4[_0xe4a7('0xf')]);}}return _0x20c726[_0xe4a7('0x43')](function(_0x6adf78){return _0x20c726[_0xe4a7('0x4')][_0xe4a7('0x5')][_0xe4a7('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x469e24}},'transaction':_0x6adf78})[_0xe4a7('0x3')](function(_0x445677){return _0x20c726[_0xe4a7('0x4')][_0xe4a7('0x5')][_0xe4a7('0x45')](_[_0xe4a7('0x46')](_0x47aa19,'priority'),{'transaction':_0x6adf78});});});})['catch'](function(_0x286abe){console[_0xe4a7('0x47')](_0x286abe);});}exports[_0xe4a7('0x48')]=rewrite; \ No newline at end of file +var _0x9efb=['exten','CAST(priority\x20AS\x20UNSIGNED)','filter','hasOwnProperty','priority','extensions','extension','push','Set','format','type','context','VoiceExtensionId','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','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)','indexOf','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','error','rewrite','util','findAll','intervals','models','VoiceExtension','then','uniq','map'];(function(_0x1a6a4c,_0x1488f2){var _0x1b9e0f=function(_0x3b133a){while(--_0x3b133a){_0x1a6a4c['push'](_0x1a6a4c['shift']());}};_0x1b9e0f(++_0x1488f2);}(_0x9efb,0xca));var _0xb9ef=function(_0x168fe6,_0x39f019){_0x168fe6=_0x168fe6-0x0;var _0x2eca7d=_0x9efb[_0x168fe6];return _0x2eca7d;};'use strict';var _=require('lodash');var util=require(_0xb9ef('0x0'));function rewrite(_0x3597ea,_0x3f753b){var _0xe0e6e1=this;return _0x3597ea['models']['Interval'][_0xb9ef('0x1')]({'raw':!![]})['then'](function(_0x25c76b){_0xe0e6e1[_0xb9ef('0x2')]=_0x25c76b;return _0x3597ea[_0xb9ef('0x3')][_0xb9ef('0x4')][_0xb9ef('0x1')]({'where':{'IntervalId':_0x3f753b['IntervalId']},'raw':!![]});})[_0xb9ef('0x5')](function(_0x42c77b){return _0x3597ea[_0xb9ef('0x3')][_0xb9ef('0x4')]['findAll']({'where':{'exten':{'$in':_[_0xb9ef('0x6')](_[_0xb9ef('0x7')](_0x42c77b,_0xb9ef('0x8')))}},'order':[{'raw':_0xb9ef('0x9')}],'raw':!![]});})['then'](function(_0x2e5d81){var _0x5960e4=_[_0xb9ef('0xa')](_0x2e5d81,{'priority':'1'});var _0x12a440=_['filter'](_0x2e5d81,{'isApp':0x1});var _0x1ccb8a=_['groupBy'](_0x12a440,_0xb9ef('0x8'));var _0x8c0dfc=['queue','playback'];var _0x120cd8=[];var _0x4205b0=[];for(var _0x55b601 in _0x1ccb8a){if(_0x1ccb8a[_0xb9ef('0xb')](_0x55b601)){_0xe0e6e1[_0xb9ef('0xc')]=0x2;_0xe0e6e1[_0xb9ef('0xd')]=[];_0xe0e6e1[_0xb9ef('0xe')]=_['find'](_0x5960e4,{'exten':_0x1ccb8a[_0x55b601][0x0]['exten']});_0xe0e6e1['extensions'][_0xb9ef('0xf')]({'type':_0x1ccb8a[_0x55b601][0x0]['type'],'app':_0xb9ef('0x10'),'appdata':util[_0xb9ef('0x11')]('CDR(type)=%s',_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x12')]),'context':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x13')],'exten':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x8')],'priority':_0xe0e6e1[_0xb9ef('0xc')]++,'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')]});if(_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x12')]==='inbound'){_0xe0e6e1[_0xb9ef('0xd')]['push']({'type':_0x1ccb8a[_0x55b601][0x0]['type'],'app':_0xb9ef('0x10'),'appdata':_0xb9ef('0x15')+_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')],'context':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x13')],'exten':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x8')],'priority':_0xe0e6e1[_0xb9ef('0xc')]++,'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')]});}else if(_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x12')]===_0xb9ef('0x16')){if(_0xe0e6e1[_0xb9ef('0xe')]){_0xe0e6e1[_0xb9ef('0xd')][_0xb9ef('0xf')]({'type':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x12')],'app':_0xb9ef('0x10'),'appdata':_0xb9ef('0x17')+(_0xe0e6e1[_0xb9ef('0xe')][_0xb9ef('0x18')]?_0xb9ef('0x19')+_0xe0e6e1['extension']['cutdigits']+'}':_0xb9ef('0x1a')),'context':_0x1ccb8a[_0x55b601][0x0]['context'],'exten':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x8')],'priority':_0xe0e6e1[_0xb9ef('0xc')]++,'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')]});}_0xe0e6e1[_0xb9ef('0xd')][_0xb9ef('0xf')]({'type':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x12')],'app':_0xb9ef('0x10'),'appdata':_0xb9ef('0x15')+_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')],'context':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x13')],'exten':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x8')],'priority':_0xe0e6e1[_0xb9ef('0xc')]++,'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0]['VoiceExtensionId']});var _0xb64d00=_0xe0e6e1['priority']++;_0xe0e6e1[_0xb9ef('0xd')]['push']({'type':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x12')],'app':'ExecIf','appdata':_0xb9ef('0x1b')+(_0xb64d00+0x2)+_0xb9ef('0x1c')+(_0xb64d00+0x1)+')','context':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x13')],'exten':_0x1ccb8a[_0x55b601][0x0]['exten'],'priority':_0xb64d00,'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0]['VoiceExtensionId']});if(_0xe0e6e1[_0xb9ef('0xe')]){_0xe0e6e1[_0xb9ef('0xd')][_0xb9ef('0xf')]({'type':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x12')],'app':_0xb9ef('0x10'),'appdata':_0xe0e6e1['extension'][_0xb9ef('0x18')]?_0xb9ef('0x1d')+_0xe0e6e1['extension']['cutdigits']+'}':_0xb9ef('0x1e'),'context':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x13')],'exten':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x8')],'priority':_0xe0e6e1[_0xb9ef('0xc')]++,'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')]});}_0xe0e6e1[_0xb9ef('0xd')]['push']({'type':_0x1ccb8a[_0x55b601][0x0]['type'],'app':'Set','appdata':_0xb9ef('0x1f')+_0x1ccb8a[_0x55b601][0x0]['VoiceExtensionId'],'context':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x13')],'exten':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x8')],'priority':_0xe0e6e1[_0xb9ef('0xc')]++,'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')]});if(_0xe0e6e1['extension']&&_0xe0e6e1[_0xb9ef('0xe')][_0xb9ef('0xb')](_0xb9ef('0x20'))&&_0xe0e6e1[_0xb9ef('0xe')]['recordingFormat']!==_0xb9ef('0x21')){_0xe0e6e1[_0xb9ef('0xd')][_0xb9ef('0xf')]({'type':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x12')],'app':_0xb9ef('0x10'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1ccb8a[_0x55b601][0x0]['context'],'exten':_0x1ccb8a[_0x55b601][0x0]['exten'],'priority':_0xe0e6e1[_0xb9ef('0xc')]++,'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')]});_0xe0e6e1[_0xb9ef('0xd')][_0xb9ef('0xf')]({'type':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x12')],'app':'Set','appdata':_0xb9ef('0x22')+_0xe0e6e1['extension'][_0xb9ef('0x20')]||_0xb9ef('0x23'),'context':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x13')],'exten':_0x1ccb8a[_0x55b601][0x0]['exten'],'priority':_0xe0e6e1[_0xb9ef('0xc')]++,'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')]});}}_0xe0e6e1[_0xb9ef('0xd')]['push']({'type':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x12')],'app':_0xb9ef('0x10'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x13')],'exten':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x8')],'priority':_0xe0e6e1['priority']++,'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0]['VoiceExtensionId']});_0xe0e6e1['extensions'][_0xb9ef('0xf')]({'type':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x12')],'app':_0xb9ef('0x10'),'appdata':_0xb9ef('0x24'),'context':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x13')],'exten':_0x1ccb8a[_0x55b601][0x0]['exten'],'priority':_0xe0e6e1[_0xb9ef('0xc')]++,'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')]});_0xe0e6e1['extensions'][_0xb9ef('0xf')]({'type':_0x1ccb8a[_0x55b601][0x0]['type'],'app':_0xb9ef('0x10'),'appdata':_0xb9ef('0x25'),'context':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x13')],'exten':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x8')],'priority':_0xe0e6e1[_0xb9ef('0xc')]++,'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')]});for(var _0x439c2c=0x0,_0x192135=0x0;_0x439c2c<_0x1ccb8a[_0x55b601][_0xb9ef('0x26')];_0x439c2c+=0x1,_0x192135=0x0){var _0x3e7496=_0x1ccb8a[_0x55b601][_0x439c2c];if(_0x3e7496[_0xb9ef('0x12')]){_0x3e7496[_0xb9ef('0x12')]=_0x3e7496[_0xb9ef('0x12')][_0xb9ef('0x27')]();}var _0xdd6cff=[];var _0x33cea5=[];delete _0x3e7496['id'];delete _0x3e7496[_0xb9ef('0x28')];delete _0x3e7496[_0xb9ef('0x29')];var _0xca9f09=_0x3e7496[_0xb9ef('0x2a')]!==_0xb9ef('0x2b')?[_0x3e7496[_0xb9ef('0x2a')]]:_0x3e7496['IntervalId']?_[_0xb9ef('0x7')](_[_0xb9ef('0xa')](_0xe0e6e1[_0xb9ef('0x2')],{'IntervalId':_0x3e7496[_0xb9ef('0x2c')]}),'interval'):[];if(_0x3e7496[_0xb9ef('0xb')]('tag')){if(_0x3e7496[_0xb9ef('0x2d')]&&_0x3e7496[_0xb9ef('0x2d')]!=='--'){_0xdd6cff[_0xb9ef('0xf')]({'type':_0x3e7496['type'],'app':'Set','appdata':_0xb9ef('0x2e')+_0x3e7496[_0xb9ef('0x2d')],'context':_0x3e7496[_0xb9ef('0x13')],'exten':_0x3e7496[_0xb9ef('0x8')],'priority':_0xca9f09['length']+_0xe0e6e1['priority']+_0x192135++,'VoiceExtensionId':_0x3e7496['VoiceExtensionId']});}}if(_0x3e7496['type']===_0xb9ef('0x16')&&_0x3e7496[_0xb9ef('0xb')](_0xb9ef('0x2f'))){if(_0x3e7496[_0xb9ef('0x2f')]){_0xdd6cff['push']({'type':_0x3e7496[_0xb9ef('0x12')],'app':_0xb9ef('0x30'),'appdata':_0xb9ef('0x31')+_0x3e7496[_0xb9ef('0x2f')]+')','context':_0x3e7496[_0xb9ef('0x13')],'exten':_0x3e7496['exten'],'priority':_0xca9f09['length']+_0xe0e6e1[_0xb9ef('0xc')]+_0x192135++,'VoiceExtensionId':_0x3e7496[_0xb9ef('0x14')]});}else{_0xdd6cff['push']({'type':_0x3e7496[_0xb9ef('0x12')],'app':_0xb9ef('0x30'),'appdata':_0xb9ef('0x32'),'context':_0x3e7496[_0xb9ef('0x13')],'exten':_0x3e7496[_0xb9ef('0x8')],'priority':_0xca9f09['length']+_0xe0e6e1[_0xb9ef('0xc')]+_0x192135++,'VoiceExtensionId':_0x3e7496[_0xb9ef('0x14')]});}}if(_0x3e7496[_0xb9ef('0xb')]('answer')){if(_0x8c0dfc[_0xb9ef('0x33')](_0x3e7496['app'][_0xb9ef('0x27')]())>=0x0&&_0x3e7496[_0xb9ef('0x34')]!==_0xb9ef('0x35')){if(_0x3e7496[_0xb9ef('0x36')]){_0xdd6cff[_0xb9ef('0xf')]({'type':_0x3e7496[_0xb9ef('0x12')],'app':'ExecIf','appdata':_0xb9ef('0x37'),'context':_0x3e7496[_0xb9ef('0x13')],'exten':_0x3e7496[_0xb9ef('0x8')],'priority':_0xca9f09[_0xb9ef('0x26')]+_0xe0e6e1['priority']+_0x192135++,'VoiceExtensionId':_0x3e7496[_0xb9ef('0x14')]});_0xdd6cff[_0xb9ef('0xf')]({'type':_0x3e7496['type'],'app':_0xb9ef('0x10'),'appdata':_0xb9ef('0x38'),'context':_0x3e7496[_0xb9ef('0x13')],'exten':_0x3e7496[_0xb9ef('0x8')],'priority':_0xca9f09[_0xb9ef('0x26')]+_0xe0e6e1[_0xb9ef('0xc')]+_0x192135++,'VoiceExtensionId':_0x3e7496[_0xb9ef('0x14')]});}else{_0xdd6cff[_0xb9ef('0xf')]({'type':_0x3e7496[_0xb9ef('0x12')],'app':_0xb9ef('0x30'),'appdata':_0xb9ef('0x39'),'context':_0x3e7496['context'],'exten':_0x3e7496[_0xb9ef('0x8')],'priority':_0xca9f09['length']+_0xe0e6e1[_0xb9ef('0xc')]+_0x192135++,'VoiceExtensionId':_0x3e7496['VoiceExtensionId']});_0xdd6cff[_0xb9ef('0xf')]({'type':_0x3e7496['type'],'app':_0xb9ef('0x10'),'appdata':_0xb9ef('0x3a'),'context':_0x3e7496[_0xb9ef('0x13')],'exten':_0x3e7496[_0xb9ef('0x8')],'priority':_0xca9f09[_0xb9ef('0x26')]+_0xe0e6e1[_0xb9ef('0xc')]+_0x192135++,'VoiceExtensionId':_0x3e7496[_0xb9ef('0x14')]});}}}for(var _0x13798a=0x0;_0x13798a<_0xca9f09[_0xb9ef('0x26')];_0x13798a+=0x1){var _0x435089=_0xe0e6e1['priority']+_0xca9f09[_0xb9ef('0x26')];var _0x42e484=_0x13798a===_0xca9f09[_0xb9ef('0x26')]-0x1?_0xe0e6e1[_0xb9ef('0xc')]+_0xdd6cff[_0xb9ef('0x26')]+_0x33cea5[_0xb9ef('0x26')]+0x2:_0xe0e6e1[_0xb9ef('0xc')]+_0x13798a+0x1;_0xdd6cff[_0xb9ef('0x3b')](_0x13798a,0x0,{'type':_0x3e7496[_0xb9ef('0x12')],'app':_0xb9ef('0x3c'),'appdata':_0xca9f09[_0x13798a]+'?'+_0x3e7496[_0xb9ef('0x13')]+_0xb9ef('0x3d')+_0x435089+':'+_0x3e7496['context']+',${EXTEN},'+_0x42e484,'exten':_0x3e7496[_0xb9ef('0x8')],'context':_0x3e7496[_0xb9ef('0x13')],'priority':_0xe0e6e1[_0xb9ef('0xc')]+_0x13798a,'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')]});}_0x3e7496[_0xb9ef('0xc')]=_0xdd6cff[_0xb9ef('0x26')]?_['last'](_0xdd6cff)[_0xb9ef('0xc')]+0x1:_0xe0e6e1['priority'];_0xe0e6e1[_0xb9ef('0xc')]=(_0x33cea5[_0xb9ef('0x26')]?_[_0xb9ef('0x3e')](_0x33cea5)[_0xb9ef('0xc')]:_0x3e7496['priority'])+0x1;_0xe0e6e1[_0xb9ef('0xd')]=_['concat'](_0xe0e6e1['extensions'],_0xdd6cff,[_0x3e7496],_0x33cea5);}_0xe0e6e1[_0xb9ef('0xd')]['push']({'type':_0x1ccb8a[_0x55b601][0x0]['type'],'app':_0xb9ef('0x3f'),'exten':_0x1ccb8a[_0x55b601][0x0]['exten'],'context':_0x1ccb8a[_0x55b601][0x0]['context'],'priority':_0xe0e6e1[_0xb9ef('0xc')],'VoiceExtensionId':_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')]});_0x120cd8[_0xb9ef('0xf')](_0x1ccb8a[_0x55b601][0x0][_0xb9ef('0x14')]);_0x4205b0=_[_0xb9ef('0x40')](_0x4205b0,_0xe0e6e1['extensions']);}}return _0x3597ea[_0xb9ef('0x41')](function(_0x594274){return _0x3597ea[_0xb9ef('0x3')][_0xb9ef('0x4')][_0xb9ef('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x120cd8}},'transaction':_0x594274})[_0xb9ef('0x5')](function(_0x5499ca){return _0x3597ea[_0xb9ef('0x3')]['VoiceExtension'][_0xb9ef('0x43')](_['sortBy'](_0x4205b0,_0xb9ef('0xc')),{'transaction':_0x594274});});});})['catch'](function(_0x3c2aa9){console[_0xb9ef('0x44')](_0x3c2aa9);});}exports[_0xb9ef('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index c4f01a4..d71ea67 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 _0x3594=['CmContact','create','then','push','pick','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','fromQuery','scheduledAt','ContactId','updatedAt','field','NOW()','toString','ListId','createdAt','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','select','cm_contacts','id\x20IN\x20?','str','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','catch','query','all','Campaign','onlyIfOpen','BlackLists','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','ioredis','../../../mysqldb','../../../config/logger','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact'];(function(_0x403a6c,_0xbd5654){var _0x51e0d8=function(_0x506fb4){while(--_0x506fb4){_0x403a6c['push'](_0x403a6c['shift']());}};_0x51e0d8(++_0xbd5654);}(_0x3594,0xaa));var _0x4359=function(_0x35f10f,_0x29d43b){_0x35f10f=_0x35f10f-0x0;var _0x55d1d2=_0x3594[_0x35f10f];return _0x55d1d2;};'use strict';var BPromise=require(_0x4359('0x0'));var util=require(_0x4359('0x1'));var _=require(_0x4359('0x2'));var fs=require('fs');var squel=require(_0x4359('0x3'));var Papa=require('papaparse');var Redis=require(_0x4359('0x4'));var db=require(_0x4359('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x4359('0x6'))('api');config['redis']=_['defaults'](config[_0x4359('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x4359('0x8'))(new Redis(config[_0x4359('0x7')]));require(_0x4359('0x9'))[_0x4359('0xa')](socket);try{if(!process['argv'][0x2]||process[_0x4359('0xb')][0x2]===_0x4359('0xc')||process[_0x4359('0xb')][0x2]===_0x4359('0xd')){throw new Error(_0x4359('0xe'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0x4359('0xb')][0x3]===_0x4359('0xc')||process[_0x4359('0xb')][0x3]==='null'||!process['argv'][0x4]||process[_0x4359('0xb')][0x4]===_0x4359('0xc')||process[_0x4359('0xb')][0x4]===_0x4359('0xd')){throw new Error(_0x4359('0xf'));}var FIELDS=_[_0x4359('0x10')](process['argv'][0x3][_0x4359('0x11')](','),process[_0x4359('0xb')][0x4]['split'](','));if(!process[_0x4359('0xb')][0x5]||process[_0x4359('0xb')][0x5]===_0x4359('0xc')||process[_0x4359('0xb')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x4359('0xb')][0x5];var COMPANYID=process[_0x4359('0xb')][0x6]&&process[_0x4359('0xb')][0x6]!==_0x4359('0xc')&&process[_0x4359('0xb')][0x6]!==_0x4359('0xd')?process[_0x4359('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x4359('0xb')][0x7]!==_0x4359('0xc')&&process[_0x4359('0xb')][0x7]!==_0x4359('0xd')?process[_0x4359('0xb')][0x7]:null;if(!process[_0x4359('0xb')][0x8]||process['argv'][0x8]===_0x4359('0xc')||process[_0x4359('0xb')][0x8]===_0x4359('0xd')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0xd3ca0d){logger[_0x4359('0x12')](_0xd3ca0d);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(_0x53f891,_0x100147,_0x26d78d,_0x17433d){var _0x2a75a1={'message':_0x100147};_0x2a75a1[_0x53f891]=!![];if(_0x26d78d){_0x2a75a1[_0x4359('0x13')]=_0x26d78d;}if(_0x17433d){_0x2a75a1[_0x4359('0x14')]=_0x17433d;}return _0x2a75a1;}function isEmail(_0x2bbabb){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))*$/[_0x4359('0x15')](_0x2bbabb);}function checkRow(_0x9d1680,_0x48bf8e,_0x3bf5bf){return new BPromise(function(_0x14cb78,_0x24686a){if(_[_0x4359('0x16')](_0x9d1680)){return _0x24686a(handleCheckRowError(_0x4359('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3bf5bf));}if(_0x9d1680[_0x4359('0x17')]&&_0x9d1680['errors'][_0x4359('0x18')]){var _0x3c83c6=_[_0x4359('0x19')](_0x9d1680['errors'],'message')[_0x4359('0x1a')](';');return _0x24686a(handleCheckRowError(_0x4359('0x12'),_0x3c83c6,null,_0x3bf5bf));}var _0x243f52={};for(var _0x1af65c in FIELDS){if(FIELDS['hasOwnProperty'](_0x1af65c)&&FIELDS[_0x1af65c]){_0x243f52[_0x1af65c]=_0x9d1680[_0x4359('0x1b')][0x0][FIELDS[_0x1af65c]]||_0x9d1680[_0x4359('0x1b')][0x0]['\ufeff'+FIELDS[_0x1af65c]];}}if(!_0x243f52[_0x4359('0x1c')]){return _0x24686a(handleCheckRowError('error',_0x4359('0x1d'),null,_0x3bf5bf));}if(!_0x243f52[_0x4359('0x1e')]){return _0x24686a(handleCheckRowError(_0x4359('0x12'),'phone\x20not\x20specified!',null,_0x3bf5bf));}if(_0x243f52[_0x4359('0x1f')]){var _0x4ef10b=moment(_0x243f52['birthDate'],_0x4359('0x20'));if(!_0x4ef10b['isValid']()){return _0x24686a(handleCheckRowError(_0x4359('0x12'),_0x4359('0x21'),null,_0x3bf5bf));}}if(_0x243f52[_0x4359('0x22')]){if(!isEmail(_0x243f52[_0x4359('0x22')])){return _0x24686a(handleCheckRowError('error',_0x4359('0x23'),null,_0x3bf5bf));}}_0x243f52['ListId']=LISTID;_0x243f52[_0x4359('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x4359('0x18')]&&_0x48bf8e){var _0x4b246d={};for(var _0x1402da=0x0,_0x340142=DUPLICATES[_0x4359('0x18')];_0x1402da<_0x340142;_0x1402da+=0x1){_0x4b246d[DUPLICATES[_0x1402da]]=_0x243f52[DUPLICATES[_0x1402da]];}var _0x598319=_[_0x4359('0x25')](_0x48bf8e,_0x4b246d);if(_0x598319){return _0x24686a(handleCheckRowError(_0x4359('0x26'),_0x4359('0x27'),_0x598319,_0x3bf5bf));}}return db[_0x4359('0x28')][_0x4359('0x29')](_0x243f52,{'raw':!![],'hooks':![],'fields':_['keys'](_0x243f52)})[_0x4359('0x2a')](function(_0x1cc1db){if(DUPLICATES&&DUPLICATES[_0x4359('0x18')]&&_0x48bf8e){_0x48bf8e[_0x4359('0x2b')](_[_0x4359('0x2c')](_0x243f52,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1cc1db['id'];return _0x14cb78();})['catch'](function(_0x5df656){return _0x24686a(handleCheckRowError(_0x4359('0x12'),_0x4359('0x2d')+(_0x5df656[_0x4359('0x2e')]||JSON[_0x4359('0x2f')](_0x5df656)),null,_0x3bf5bf));});});}function checkHopper(){function _0x315e53(){return function(_0x1d30c0){logger['error'](_0x4359('0x30'),_0x4359('0x31'),util['inspect'](_0x1d30c0,{'showHidden':![],'depth':null}));};}var _0x536f97=function(_0x1f7e84,_0x5c4c63){var _0x330e80=squel[_0x4359('0x32')]()[_0x4359('0x33')]('cm_hopper')[_0x4359('0x34')]([_0x4359('0x1e'),_0x4359('0x35'),_0x4359('0x36'),'ListId',_0x5c4c63,'createdAt',_0x4359('0x37')],squel['select']()['field'](_0x4359('0x1e'),'phone')[_0x4359('0x38')](_0x4359('0x39'),_0x4359('0x35'))[_0x4359('0x38')]('id',_0x4359('0x36'))[_0x4359('0x38')](LISTID[_0x4359('0x3a')](),_0x4359('0x3b'))[_0x4359('0x38')](_0x1f7e84['id'][_0x4359('0x3a')](),_0x5c4c63)[_0x4359('0x38')](_0x4359('0x39'),_0x4359('0x3c'))['field'](_0x4359('0x39'),'updatedAt')[_0x4359('0x3d')]('cm_contacts')[_0x4359('0x3e')](_0x4359('0x3f'))[_0x4359('0x3e')](_0x4359('0x40'),LISTID[_0x4359('0x3a')]())[_0x4359('0x3e')](_0x4359('0x41'))['where'](_0x4359('0x42'),squel['select']()[_0x4359('0x38')](_0x4359('0x1e'))[_0x4359('0x3d')](_0x4359('0x43'))[_0x4359('0x3e')](_0x5c4c63+_0x4359('0x44'),_0x1f7e84['id']['toString']())))['toString']();return _0x330e80;};var _0x33b5e1=function(_0x51edad,_0x4bf67e){var _0x4a06a8=squel[_0x4359('0x32')]()[_0x4359('0x33')]('cm_hopper')['fromQuery'](['phone',_0x4359('0x35'),_0x4359('0x36'),_0x4359('0x3b'),_0x4bf67e,_0x4359('0x3c'),_0x4359('0x37')],squel[_0x4359('0x45')]()['field'](_0x4359('0x1e'),'phone')[_0x4359('0x38')]('NOW()',_0x4359('0x35'))[_0x4359('0x38')]('id',_0x4359('0x36'))[_0x4359('0x38')](LISTID['toString'](),_0x4359('0x3b'))[_0x4359('0x38')](_0x51edad['id'][_0x4359('0x3a')](),_0x4bf67e)[_0x4359('0x38')](_0x4359('0x39'),'createdAt')[_0x4359('0x38')](_0x4359('0x39'),_0x4359('0x37'))[_0x4359('0x3d')](_0x4359('0x46'))['where'](_0x4359('0x3f'))['where'](_0x4359('0x40'),LISTID[_0x4359('0x3a')]())['where'](_0x4359('0x47'),squel[_0x4359('0x48')](hopperContacts))[_0x4359('0x3e')](_0x4359('0x41'))[_0x4359('0x3e')](_0x4359('0x42'),squel['select']()[_0x4359('0x38')]('calleridnum')[_0x4359('0x3d')](_0x4359('0x49'))[_0x4359('0x3e')](_0x4bf67e+_0x4359('0x44'),_0x51edad['id'][_0x4359('0x3a')]()))[_0x4359('0x3e')](_0x4359('0x42'),squel['select']()[_0x4359('0x38')](_0x4359('0x1e'))[_0x4359('0x3d')]('cm_hopper')[_0x4359('0x3e')](_0x4bf67e+_0x4359('0x44'),_0x51edad['id'][_0x4359('0x3a')]())))['toString']();return _0x4a06a8;};function _0x841598(_0x21a475,_0x4c4477){var _0x2f0609=squel[_0x4359('0x32')]()[_0x4359('0x33')](_0x4359('0x43'))[_0x4359('0x34')]([_0x4359('0x1e'),'scheduledAt',_0x4359('0x36'),_0x4359('0x3b'),_0x4c4477,_0x4359('0x3c'),'updatedAt'],squel[_0x4359('0x45')]()[_0x4359('0x38')](_0x4359('0x1e'),_0x4359('0x1e'))[_0x4359('0x38')](_0x4359('0x39'),_0x4359('0x35'))[_0x4359('0x38')]('id',_0x4359('0x36'))[_0x4359('0x38')](LISTID[_0x4359('0x3a')](),_0x4359('0x3b'))['field'](_0x21a475['id'][_0x4359('0x3a')](),_0x4c4477)[_0x4359('0x38')](_0x4359('0x39'),_0x4359('0x3c'))[_0x4359('0x38')]('NOW()',_0x4359('0x37'))[_0x4359('0x3d')](_0x4359('0x46'))[_0x4359('0x3e')](_0x4359('0x3f'))[_0x4359('0x3e')](_0x4359('0x40'),LISTID['toString']())['where'](_0x4359('0x47'),squel[_0x4359('0x48')](hopperContacts))[_0x4359('0x3e')](_0x4359('0x41')))[_0x4359('0x3a')]();return _0x2f0609;}function _0x523e6f(_0x21e487,_0x3e6975){var _0x4d6c0e=squel[_0x4359('0x32')]()[_0x4359('0x33')](_0x4359('0x4a'))[_0x4359('0x34')](['phone','ContactId',_0x4359('0x3b'),_0x3e6975,_0x4359('0x3c'),_0x4359('0x37')],squel[_0x4359('0x45')]()[_0x4359('0x38')](_0x4359('0x1e'),_0x4359('0x1e'))[_0x4359('0x38')]('id',_0x4359('0x36'))[_0x4359('0x38')](LISTID[_0x4359('0x3a')](),'ListId')[_0x4359('0x38')](_0x21e487['id']['toString'](),_0x3e6975)[_0x4359('0x38')](_0x4359('0x39'),_0x4359('0x3c'))[_0x4359('0x38')]('NOW()','updatedAt')[_0x4359('0x3d')](_0x4359('0x46'))[_0x4359('0x3e')]('deletedAt\x20IS\x20NULL')['where'](_0x4359('0x40'),LISTID[_0x4359('0x3a')]())[_0x4359('0x3e')](_0x4359('0x47'),squel['str'](hopperContacts))[_0x4359('0x3e')](_0x4359('0x41')))[_0x4359('0x3a')]();return _0x4d6c0e;}return db[_0x4359('0x4b')][_0x4359('0x4c')]({'where':{'type':_0x4359('0x4d')},'attributes':['id',_0x4359('0x4e')],'include':[{'model':db[_0x4359('0x4f')],'as':_0x4359('0x50'),'where':{'id':LISTID}}]})[_0x4359('0x2a')](function(_0x45d31e){var _0x5f38d9=[];if(_0x45d31e){var _0x5028a5;for(var _0x3a19aa=0x0,_0x5b7ec9;_0x3a19aa<_0x45d31e[_0x4359('0x18')];_0x3a19aa+=0x1){_0x5b7ec9=_0x45d31e[_0x3a19aa][_0x4359('0x51')]({'plain':!![]});switch(_0x5b7ec9['dialCheckDuplicateType']){case _0x4359('0x52'):_0x5f38d9[_0x4359('0x2b')](db[_0x4359('0x53')]['query'](_0x33b5e1(_0x5b7ec9,_0x4359('0x54')))[_0x4359('0x2a')](function(){})[_0x4359('0x55')](_0x315e53()));break;case'onlyIfOpen':_0x5f38d9[_0x4359('0x2b')](db[_0x4359('0x53')][_0x4359('0x56')](_0x536f97(_0x5b7ec9,'VoiceQueueId'))[_0x4359('0x2a')](function(){})[_0x4359('0x55')](_0x315e53()));break;default:_0x5f38d9[_0x4359('0x2b')](db['sequelize'][_0x4359('0x56')](_0x841598(_0x5b7ec9,_0x4359('0x54')))[_0x4359('0x2a')](function(){})[_0x4359('0x55')](_0x315e53()));}}}return _0x5f38d9;})[_0x4359('0x57')]()[_0x4359('0x2a')](function(){return db[_0x4359('0x4b')][_0x4359('0x4c')]({'where':{'type':_0x4359('0x4d')},'attributes':['id'],'include':[{'model':db[_0x4359('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x4359('0x2a')](function(_0x74a7ea){var _0xade99c=[];if(_0x74a7ea){var _0x4f1cbc;for(var _0x3ea639=0x0,_0x497701;_0x3ea639<_0x74a7ea[_0x4359('0x18')];_0x3ea639+=0x1){_0x497701=_0x74a7ea[_0x3ea639][_0x4359('0x51')]({'plain':!![]});_0xade99c[_0x4359('0x2b')](db[_0x4359('0x53')][_0x4359('0x56')](_0x523e6f(_0x497701,_0x4359('0x54')))['then'](function(){})[_0x4359('0x55')](_0x315e53()));}}return _0xade99c;})[_0x4359('0x57')]();})[_0x4359('0x2a')](function(){return db[_0x4359('0x58')][_0x4359('0x4c')]({'attributes':['id',_0x4359('0x4e')],'include':[{'model':db[_0x4359('0x4f')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x47d4e7){var _0x22272a=[];if(_0x47d4e7){for(var _0x41edcc=0x0,_0x46ff8c;_0x41edcc<_0x47d4e7[_0x4359('0x18')];_0x41edcc+=0x1){_0x46ff8c=_0x47d4e7[_0x41edcc][_0x4359('0x51')]({'plain':!![]});switch(_0x46ff8c[_0x4359('0x4e')]){case _0x4359('0x52'):_0x22272a[_0x4359('0x2b')](db[_0x4359('0x53')]['query'](_0x33b5e1(_0x46ff8c,'CampaignId'))['then'](function(){})[_0x4359('0x55')](_0x315e53()));break;case _0x4359('0x59'):_0x22272a[_0x4359('0x2b')](db[_0x4359('0x53')][_0x4359('0x56')](_0x536f97(_0x46ff8c,'CampaignId'))[_0x4359('0x2a')](function(){})[_0x4359('0x55')](_0x315e53()));break;default:_0x22272a[_0x4359('0x2b')](db[_0x4359('0x53')][_0x4359('0x56')](_0x841598(_0x46ff8c,'CampaignId'))[_0x4359('0x2a')](function(){})[_0x4359('0x55')](_0x315e53()));}}}return _0x22272a;})[_0x4359('0x57')]();})[_0x4359('0x2a')](function(){return db['Campaign'][_0x4359('0x4c')]({'attributes':['id'],'include':[{'model':db[_0x4359('0x4f')],'as':_0x4359('0x5a'),'where':{'id':LISTID}}]})[_0x4359('0x2a')](function(_0x34d968){var _0x2a5d37=[];if(_0x34d968){for(var _0x3be9e5=0x0,_0x1d2868;_0x3be9e5<_0x34d968[_0x4359('0x18')];_0x3be9e5+=0x1){_0x1d2868=_0x34d968[_0x3be9e5]['get']({'plain':!![]});_0x2a5d37[_0x4359('0x2b')](db['sequelize']['query'](_0x523e6f(_0x1d2868,'CampaignId'))[_0x4359('0x2a')](function(){})[_0x4359('0x55')](_0x315e53()));}}return _0x2a5d37;})[_0x4359('0x57')]();})[_0x4359('0x55')](function(_0xf45ddc){logger['error']('cmContact,\x20%s,\x20%s',_0x4359('0x5b'),_0xf45ddc[_0x4359('0x2e')]);});}var processPromises=function(_0x29ab28){return BPromise[_0x4359('0x57')](promises)[_0x4359('0x2a')](function(_0x25883a){})[_0x4359('0x55')](function(_0x1a598a){logger[_0x4359('0x12')](_0x4359('0x5c'),JSON[_0x4359('0x2f')](_0x1a598a));})[_0x4359('0x5d')](function(){socket[_0x4359('0x5e')](_0x4359('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x29ab28){return _0x29ab28[_0x4359('0x60')]();}});};var endCsv=function(){return BPromise[_0x4359('0x61')]()[_0x4359('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x4359('0x2a')](function(){socket['emit'](_0x4359('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1db23c){logger[_0x4359('0x12')](_0x4359('0x62'),JSON[_0x4359('0x2f')](_0x1db23c));}finally{process['exit'](0x0);}});};process['on'](_0x4359('0x63'),function(){logger[_0x4359('0x64')](_0x4359('0x65'));endCsv();});function main(){return BPromise['resolve']()[_0x4359('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x4359('0x28')][_0x4359('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x4359('0x2a')](function(_0x12470f){var _0x35c7ca=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x4359('0x66')](_0x35c7ca,{'header':!![],'skipEmptyLines':!![],'step':function(_0x36e0a6,_0x52f42b){total+=0x1;var _0x5b903a=total;promises[_0x4359('0x2b')](checkRow(_0x36e0a6,_0x12470f,_0x5b903a)['then'](function(){success+=0x1;})[_0x4359('0x55')](function(_0x3e2696){if(_0x3e2696[_0x4359('0x12')]){errors+=0x1;delete _0x3e2696[_0x4359('0x12')];}else if(_0x3e2696['duplicate']){duplicates+=0x1;delete _0x3e2696[_0x4359('0x26')];}rows['push'](_0x3e2696);}));if(total%0xc8===0x0){_0x52f42b['pause']();return processPromises(_0x52f42b);}},'complete':function(){return processPromises()[_0x4359('0x2a')](function(){logger[_0x4359('0x64')](_0x4359('0x67'));endCsv();});},'error':function(_0xc7b217,_0x459734){logger[_0x4359('0x64')](_0x4359('0x68'),JSON[_0x4359('0x2f')](_0xc7b217));endCsv();}});})[_0x4359('0x55')](function(_0xe54673){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x4359('0x2f')](_0xe54673));});}main(); \ No newline at end of file +var _0x8c2b=['find','duplicate','create','then','push','pick','Error\x20while\x20creating\x20contact:\x20','checkHopper','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','into','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','outbound','CmList','Lists','get','dialCheckDuplicateType','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','VoiceQueue','findAll','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resolve','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','ioredis','redis','localhost','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId'];(function(_0x360276,_0x113a91){var _0x20af1a=function(_0x369405){while(--_0x369405){_0x360276['push'](_0x360276['shift']());}};_0x20af1a(++_0x113a91);}(_0x8c2b,0xa4));var _0xb8c2=function(_0x158071,_0x4cbe5f){_0x158071=_0x158071-0x0;var _0xba35a7=_0x8c2b[_0x158071];return _0xba35a7;};'use strict';var BPromise=require(_0xb8c2('0x0'));var util=require('util');var _=require(_0xb8c2('0x1'));var fs=require('fs');var squel=require(_0xb8c2('0x2'));var Papa=require('papaparse');var Redis=require(_0xb8c2('0x3'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('api');config[_0xb8c2('0x4')]=_['defaults'](config[_0xb8c2('0x4')],{'host':_0xb8c2('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb8c2('0x4')]));require(_0xb8c2('0x6'))[_0xb8c2('0x7')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]==='undefined'||process[_0xb8c2('0x8')][0x2]===_0xb8c2('0x9')){throw new Error(_0xb8c2('0xa'));}var FILEPATH=process[_0xb8c2('0x8')][0x2];if(!process['argv'][0x3]||process[_0xb8c2('0x8')][0x3]==='undefined'||process['argv'][0x3]===_0xb8c2('0x9')||!process['argv'][0x4]||process[_0xb8c2('0x8')][0x4]===_0xb8c2('0xb')||process[_0xb8c2('0x8')][0x4]==='null'){throw new Error(_0xb8c2('0xc'));}var FIELDS=_[_0xb8c2('0xd')](process[_0xb8c2('0x8')][0x3][_0xb8c2('0xe')](','),process['argv'][0x4][_0xb8c2('0xe')](','));if(!process[_0xb8c2('0x8')][0x5]||process['argv'][0x5]===_0xb8c2('0xb')||process[_0xb8c2('0x8')][0x5]==='null'){throw new Error(_0xb8c2('0xf'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xb8c2('0x8')][0x6]&&process[_0xb8c2('0x8')][0x6]!==_0xb8c2('0xb')&&process['argv'][0x6]!==_0xb8c2('0x9')?process[_0xb8c2('0x8')][0x6]:null;var DUPLICATES=process[_0xb8c2('0x8')][0x7]&&process[_0xb8c2('0x8')][0x7]!=='undefined'&&process[_0xb8c2('0x8')][0x7]!==_0xb8c2('0x9')?process[_0xb8c2('0x8')][0x7]:null;if(!process['argv'][0x8]||process[_0xb8c2('0x8')][0x8]===_0xb8c2('0xb')||process[_0xb8c2('0x8')][0x8]==='null'){throw new Error(_0xb8c2('0x10'));}var SOCKET_TIMESTAMP=process[_0xb8c2('0x8')][0x8];}catch(_0xd783a1){logger[_0xb8c2('0x11')](_0xd783a1);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(_0x28d27e,_0x225bfc,_0x266dfb,_0x14acea){var _0x47fac8={'message':_0x225bfc};_0x47fac8[_0x28d27e]=!![];if(_0x266dfb){_0x47fac8[_0xb8c2('0x12')]=_0x266dfb;}if(_0x14acea){_0x47fac8['index']=_0x14acea;}return _0x47fac8;}function isEmail(_0x42a830){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'](_0x42a830);}function checkRow(_0x4ce0f1,_0x58d8d9,_0x20ffab){return new BPromise(function(_0x594a1a,_0xe48ac1){if(_['isNil'](_0x4ce0f1)){return _0xe48ac1(handleCheckRowError(_0xb8c2('0x11'),_0xb8c2('0x13'),null,_0x20ffab));}if(_0x4ce0f1[_0xb8c2('0x14')]&&_0x4ce0f1[_0xb8c2('0x14')][_0xb8c2('0x15')]){var _0x1f7c1e=_[_0xb8c2('0x16')](_0x4ce0f1['errors'],_0xb8c2('0x17'))[_0xb8c2('0x18')](';');return _0xe48ac1(handleCheckRowError(_0xb8c2('0x11'),_0x1f7c1e,null,_0x20ffab));}var _0x21baab={};for(var _0x1a4ac7 in FIELDS){if(FIELDS['hasOwnProperty'](_0x1a4ac7)&&FIELDS[_0x1a4ac7]){_0x21baab[_0x1a4ac7]=_0x4ce0f1['data'][0x0][FIELDS[_0x1a4ac7]]||_0x4ce0f1[_0xb8c2('0x19')][0x0]['\ufeff'+FIELDS[_0x1a4ac7]];}}if(!_0x21baab[_0xb8c2('0x1a')]){return _0xe48ac1(handleCheckRowError(_0xb8c2('0x11'),'firstName\x20not\x20specified!',null,_0x20ffab));}if(!_0x21baab[_0xb8c2('0x1b')]){return _0xe48ac1(handleCheckRowError(_0xb8c2('0x11'),'phone\x20not\x20specified!',null,_0x20ffab));}if(_0x21baab[_0xb8c2('0x1c')]){var _0x33e1f7=moment(_0x21baab[_0xb8c2('0x1c')],_0xb8c2('0x1d'));if(!_0x33e1f7[_0xb8c2('0x1e')]()){return _0xe48ac1(handleCheckRowError(_0xb8c2('0x11'),_0xb8c2('0x1f'),null,_0x20ffab));}}if(_0x21baab[_0xb8c2('0x20')]){if(!isEmail(_0x21baab['email'])){return _0xe48ac1(handleCheckRowError(_0xb8c2('0x11'),_0xb8c2('0x21'),null,_0x20ffab));}}_0x21baab[_0xb8c2('0x22')]=LISTID;_0x21baab[_0xb8c2('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xb8c2('0x15')]&&_0x58d8d9){var _0x282b0b={};for(var _0x4db20c=0x0,_0x392739=DUPLICATES['length'];_0x4db20c<_0x392739;_0x4db20c+=0x1){_0x282b0b[DUPLICATES[_0x4db20c]]=_0x21baab[DUPLICATES[_0x4db20c]];}var _0x2338c9=_[_0xb8c2('0x24')](_0x58d8d9,_0x282b0b);if(_0x2338c9){return _0xe48ac1(handleCheckRowError(_0xb8c2('0x25'),'Duplicate\x20Contact',_0x2338c9,_0x20ffab));}}return db['CmContact'][_0xb8c2('0x26')](_0x21baab,{'raw':!![],'hooks':![],'fields':_['keys'](_0x21baab)})[_0xb8c2('0x27')](function(_0x386ab3){if(DUPLICATES&&DUPLICATES[_0xb8c2('0x15')]&&_0x58d8d9){_0x58d8d9[_0xb8c2('0x28')](_[_0xb8c2('0x29')](_0x21baab,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x386ab3['id'];return _0x594a1a();})['catch'](function(_0x4659ad){return _0xe48ac1(handleCheckRowError(_0xb8c2('0x11'),_0xb8c2('0x2a')+(_0x4659ad[_0xb8c2('0x17')]||JSON['stringify'](_0x4659ad)),null,_0x20ffab));});});}function checkHopper(){function _0x11dae2(){return function(_0x373fec){logger[_0xb8c2('0x11')]('cmContact',_0xb8c2('0x2b'),util['inspect'](_0x373fec,{'showHidden':![],'depth':null}));};}var _0x4b2011=function(_0x1fa93b,_0x5c4c12){var _0x3de185=squel[_0xb8c2('0x2c')]()['into'](_0xb8c2('0x2d'))[_0xb8c2('0x2e')]([_0xb8c2('0x1b'),_0xb8c2('0x2f'),_0xb8c2('0x30'),_0xb8c2('0x22'),_0x5c4c12,_0xb8c2('0x31'),_0xb8c2('0x32')],squel[_0xb8c2('0x33')]()[_0xb8c2('0x34')](_0xb8c2('0x1b'),_0xb8c2('0x1b'))[_0xb8c2('0x34')](_0xb8c2('0x35'),_0xb8c2('0x2f'))[_0xb8c2('0x34')]('id',_0xb8c2('0x30'))[_0xb8c2('0x34')](LISTID[_0xb8c2('0x36')](),_0xb8c2('0x22'))[_0xb8c2('0x34')](_0x1fa93b['id'][_0xb8c2('0x36')](),_0x5c4c12)['field'](_0xb8c2('0x35'),'createdAt')[_0xb8c2('0x34')](_0xb8c2('0x35'),_0xb8c2('0x32'))['from'](_0xb8c2('0x37'))[_0xb8c2('0x38')](_0xb8c2('0x39'))[_0xb8c2('0x38')](_0xb8c2('0x3a'),LISTID['toString']())['where'](_0xb8c2('0x3b'))[_0xb8c2('0x38')](_0xb8c2('0x3c'),squel['select']()[_0xb8c2('0x34')]('phone')[_0xb8c2('0x3d')](_0xb8c2('0x2d'))[_0xb8c2('0x38')](_0x5c4c12+_0xb8c2('0x3e'),_0x1fa93b['id'][_0xb8c2('0x36')]())))[_0xb8c2('0x36')]();return _0x3de185;};var _0x2b539b=function(_0x3c36a1,_0x316885){var _0x48e733=squel[_0xb8c2('0x2c')]()[_0xb8c2('0x3f')](_0xb8c2('0x2d'))['fromQuery']([_0xb8c2('0x1b'),'scheduledAt',_0xb8c2('0x30'),'ListId',_0x316885,_0xb8c2('0x31'),_0xb8c2('0x32')],squel['select']()[_0xb8c2('0x34')](_0xb8c2('0x1b'),_0xb8c2('0x1b'))[_0xb8c2('0x34')](_0xb8c2('0x35'),'scheduledAt')[_0xb8c2('0x34')]('id',_0xb8c2('0x30'))[_0xb8c2('0x34')](LISTID[_0xb8c2('0x36')](),_0xb8c2('0x22'))[_0xb8c2('0x34')](_0x3c36a1['id'][_0xb8c2('0x36')](),_0x316885)[_0xb8c2('0x34')](_0xb8c2('0x35'),_0xb8c2('0x31'))[_0xb8c2('0x34')]('NOW()',_0xb8c2('0x32'))[_0xb8c2('0x3d')](_0xb8c2('0x37'))[_0xb8c2('0x38')](_0xb8c2('0x39'))[_0xb8c2('0x38')]('ListId\x20=\x20?',LISTID[_0xb8c2('0x36')]())[_0xb8c2('0x38')](_0xb8c2('0x40'),squel[_0xb8c2('0x41')](hopperContacts))[_0xb8c2('0x38')]('phone\x20IS\x20NOT\x20NULL')[_0xb8c2('0x38')](_0xb8c2('0x3c'),squel[_0xb8c2('0x33')]()[_0xb8c2('0x34')](_0xb8c2('0x42'))[_0xb8c2('0x3d')](_0xb8c2('0x43'))[_0xb8c2('0x38')](_0x316885+_0xb8c2('0x3e'),_0x3c36a1['id'][_0xb8c2('0x36')]()))[_0xb8c2('0x38')](_0xb8c2('0x3c'),squel[_0xb8c2('0x33')]()[_0xb8c2('0x34')](_0xb8c2('0x1b'))['from'](_0xb8c2('0x2d'))['where'](_0x316885+_0xb8c2('0x3e'),_0x3c36a1['id'][_0xb8c2('0x36')]())))[_0xb8c2('0x36')]();return _0x48e733;};function _0x1dbf04(_0xcc8e84,_0x310ce9){var _0x501a6d=squel[_0xb8c2('0x2c')]()['into'](_0xb8c2('0x2d'))[_0xb8c2('0x2e')]([_0xb8c2('0x1b'),_0xb8c2('0x2f'),_0xb8c2('0x30'),_0xb8c2('0x22'),_0x310ce9,_0xb8c2('0x31'),_0xb8c2('0x32')],squel['select']()['field'](_0xb8c2('0x1b'),_0xb8c2('0x1b'))[_0xb8c2('0x34')](_0xb8c2('0x35'),_0xb8c2('0x2f'))['field']('id',_0xb8c2('0x30'))[_0xb8c2('0x34')](LISTID[_0xb8c2('0x36')](),_0xb8c2('0x22'))['field'](_0xcc8e84['id'][_0xb8c2('0x36')](),_0x310ce9)[_0xb8c2('0x34')](_0xb8c2('0x35'),_0xb8c2('0x31'))[_0xb8c2('0x34')](_0xb8c2('0x35'),_0xb8c2('0x32'))[_0xb8c2('0x3d')](_0xb8c2('0x37'))[_0xb8c2('0x38')](_0xb8c2('0x39'))[_0xb8c2('0x38')](_0xb8c2('0x3a'),LISTID[_0xb8c2('0x36')]())[_0xb8c2('0x38')](_0xb8c2('0x40'),squel['str'](hopperContacts))[_0xb8c2('0x38')](_0xb8c2('0x3b')))[_0xb8c2('0x36')]();return _0x501a6d;}function _0x4e1cb2(_0x11b68c,_0x5d7ddc){var _0x382e52=squel[_0xb8c2('0x2c')]()[_0xb8c2('0x3f')](_0xb8c2('0x44'))[_0xb8c2('0x2e')]([_0xb8c2('0x1b'),_0xb8c2('0x30'),_0xb8c2('0x22'),_0x5d7ddc,'createdAt',_0xb8c2('0x32')],squel['select']()[_0xb8c2('0x34')](_0xb8c2('0x1b'),'phone')[_0xb8c2('0x34')]('id','ContactId')[_0xb8c2('0x34')](LISTID[_0xb8c2('0x36')](),_0xb8c2('0x22'))[_0xb8c2('0x34')](_0x11b68c['id'][_0xb8c2('0x36')](),_0x5d7ddc)[_0xb8c2('0x34')](_0xb8c2('0x35'),_0xb8c2('0x31'))[_0xb8c2('0x34')](_0xb8c2('0x35'),_0xb8c2('0x32'))[_0xb8c2('0x3d')]('cm_contacts')[_0xb8c2('0x38')](_0xb8c2('0x39'))[_0xb8c2('0x38')](_0xb8c2('0x3a'),LISTID[_0xb8c2('0x36')]())[_0xb8c2('0x38')](_0xb8c2('0x40'),squel['str'](hopperContacts))[_0xb8c2('0x38')](_0xb8c2('0x3b')))[_0xb8c2('0x36')]();return _0x382e52;}return db['VoiceQueue']['findAll']({'where':{'type':_0xb8c2('0x45')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xb8c2('0x46')],'as':_0xb8c2('0x47'),'where':{'id':LISTID}}]})['then'](function(_0x5f0ce0){var _0xb284b7=[];if(_0x5f0ce0){var _0x1717fd;for(var _0x46f3ce=0x0,_0x209e6d;_0x46f3ce<_0x5f0ce0[_0xb8c2('0x15')];_0x46f3ce+=0x1){_0x209e6d=_0x5f0ce0[_0x46f3ce][_0xb8c2('0x48')]({'plain':!![]});switch(_0x209e6d[_0xb8c2('0x49')]){case'always':_0xb284b7[_0xb8c2('0x28')](db[_0xb8c2('0x4a')][_0xb8c2('0x4b')](_0x2b539b(_0x209e6d,_0xb8c2('0x4c')))[_0xb8c2('0x27')](function(){})['catch'](_0x11dae2()));break;case _0xb8c2('0x4d'):_0xb284b7[_0xb8c2('0x28')](db[_0xb8c2('0x4a')][_0xb8c2('0x4b')](_0x4b2011(_0x209e6d,_0xb8c2('0x4c')))[_0xb8c2('0x27')](function(){})[_0xb8c2('0x4e')](_0x11dae2()));break;default:_0xb284b7[_0xb8c2('0x28')](db[_0xb8c2('0x4a')]['query'](_0x1dbf04(_0x209e6d,_0xb8c2('0x4c')))['then'](function(){})[_0xb8c2('0x4e')](_0x11dae2()));}}}return _0xb284b7;})[_0xb8c2('0x4f')]()['then'](function(){return db[_0xb8c2('0x50')][_0xb8c2('0x51')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xb8c2('0x46')],'as':_0xb8c2('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x5837ef){var _0x48800b=[];if(_0x5837ef){var _0x378417;for(var _0x203cc1=0x0,_0xb3511;_0x203cc1<_0x5837ef[_0xb8c2('0x15')];_0x203cc1+=0x1){_0xb3511=_0x5837ef[_0x203cc1][_0xb8c2('0x48')]({'plain':!![]});_0x48800b[_0xb8c2('0x28')](db[_0xb8c2('0x4a')][_0xb8c2('0x4b')](_0x4e1cb2(_0xb3511,'VoiceQueueId'))[_0xb8c2('0x27')](function(){})[_0xb8c2('0x4e')](_0x11dae2()));}}return _0x48800b;})[_0xb8c2('0x4f')]();})[_0xb8c2('0x27')](function(){return db[_0xb8c2('0x53')][_0xb8c2('0x51')]({'attributes':['id',_0xb8c2('0x49')],'include':[{'model':db['CmList'],'as':_0xb8c2('0x47'),'where':{'id':LISTID}}]})[_0xb8c2('0x27')](function(_0x1992f9){var _0x14f4e8=[];if(_0x1992f9){for(var _0x4a7161=0x0,_0xcfc302;_0x4a7161<_0x1992f9[_0xb8c2('0x15')];_0x4a7161+=0x1){_0xcfc302=_0x1992f9[_0x4a7161][_0xb8c2('0x48')]({'plain':!![]});switch(_0xcfc302[_0xb8c2('0x49')]){case'always':_0x14f4e8[_0xb8c2('0x28')](db[_0xb8c2('0x4a')][_0xb8c2('0x4b')](_0x2b539b(_0xcfc302,_0xb8c2('0x54')))[_0xb8c2('0x27')](function(){})[_0xb8c2('0x4e')](_0x11dae2()));break;case'onlyIfOpen':_0x14f4e8[_0xb8c2('0x28')](db['sequelize']['query'](_0x4b2011(_0xcfc302,'CampaignId'))[_0xb8c2('0x27')](function(){})[_0xb8c2('0x4e')](_0x11dae2()));break;default:_0x14f4e8[_0xb8c2('0x28')](db['sequelize'][_0xb8c2('0x4b')](_0x1dbf04(_0xcfc302,_0xb8c2('0x54')))['then'](function(){})[_0xb8c2('0x4e')](_0x11dae2()));}}}return _0x14f4e8;})['all']();})[_0xb8c2('0x27')](function(){return db[_0xb8c2('0x53')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xb8c2('0x46')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x40c4a5){var _0xd4393c=[];if(_0x40c4a5){for(var _0xe0ab6e=0x0,_0x45ea4a;_0xe0ab6e<_0x40c4a5[_0xb8c2('0x15')];_0xe0ab6e+=0x1){_0x45ea4a=_0x40c4a5[_0xe0ab6e][_0xb8c2('0x48')]({'plain':!![]});_0xd4393c[_0xb8c2('0x28')](db[_0xb8c2('0x4a')][_0xb8c2('0x4b')](_0x4e1cb2(_0x45ea4a,_0xb8c2('0x54')))[_0xb8c2('0x27')](function(){})[_0xb8c2('0x4e')](_0x11dae2()));}}return _0xd4393c;})[_0xb8c2('0x4f')]();})[_0xb8c2('0x4e')](function(_0x21dc1b){logger[_0xb8c2('0x11')](_0xb8c2('0x55'),_0xb8c2('0x56'),_0x21dc1b[_0xb8c2('0x17')]);});}var processPromises=function(_0x23c0d8){return BPromise[_0xb8c2('0x4f')](promises)['then'](function(_0xed10aa){})[_0xb8c2('0x4e')](function(_0x49e772){logger[_0xb8c2('0x11')](_0xb8c2('0x57'),JSON[_0xb8c2('0x58')](_0x49e772));})[_0xb8c2('0x59')](function(){socket[_0xb8c2('0x5a')](_0xb8c2('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x23c0d8){return _0x23c0d8['resume']();}});};var endCsv=function(){return BPromise[_0xb8c2('0x5c')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xb8c2('0x27')](function(){socket[_0xb8c2('0x5a')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x4a0de1){logger['error'](_0xb8c2('0x5d'),JSON[_0xb8c2('0x58')](_0x4a0de1));}finally{process['exit'](0x0);}});};process['on'](_0xb8c2('0x5e'),function(){logger[_0xb8c2('0x5f')](_0xb8c2('0x60'));endCsv();});function main(){return BPromise[_0xb8c2('0x5c')]()[_0xb8c2('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xb8c2('0xe')](',');return db['CmContact'][_0xb8c2('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xb8c2('0x27')](function(_0x1ba10d){var _0x502eb4=fs[_0xb8c2('0x61')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x502eb4,{'header':!![],'skipEmptyLines':!![],'step':function(_0x6081c5,_0x597f4b){total+=0x1;var _0xba8ceb=total;promises[_0xb8c2('0x28')](checkRow(_0x6081c5,_0x1ba10d,_0xba8ceb)[_0xb8c2('0x27')](function(){success+=0x1;})['catch'](function(_0x2dea65){if(_0x2dea65[_0xb8c2('0x11')]){errors+=0x1;delete _0x2dea65[_0xb8c2('0x11')];}else if(_0x2dea65[_0xb8c2('0x25')]){duplicates+=0x1;delete _0x2dea65[_0xb8c2('0x25')];}rows[_0xb8c2('0x28')](_0x2dea65);}));if(total%0xc8===0x0){_0x597f4b[_0xb8c2('0x62')]();return processPromises(_0x597f4b);}},'complete':function(){return processPromises()[_0xb8c2('0x27')](function(){logger[_0xb8c2('0x5f')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x3d205a,_0x3f3bb6){logger['info']('CSV\x20parse\x20error',JSON[_0xb8c2('0x58')](_0x3d205a));endCsv();}});})[_0xb8c2('0x4e')](function(_0x42af87){logger[_0xb8c2('0x11')](_0xb8c2('0x63'),JSON[_0xb8c2('0x58')](_0x42af87));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 4db7d6b..f5018c6 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 _0x6f19=['findOne','CmContactHasItem','updated','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','ListId','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','into','priority','ListId\x20=\x20?','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','scheduledAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','errors','code','message','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','send','start','server/files/tmp','.csv','header','ContactItemType','name','_description','parse','createReadStream','data','find','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','hasOwnProperty','trim','itemTypeId','description','SystemRow','appendFileSync','rows','emit','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','duplicates','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues','VoiceQueueId','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','finish','affectedRows','contact:import:','unlink','exit','complete','argv','arguments\x20\x20\x20','root','existsSync','binding','phone\x20is\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../config/environment','../../../config/logger','redis','defaults','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','length','push','all','split','then','isNil'];(function(_0xedf8ff,_0x2baa35){var _0x26a1d1=function(_0x168808){while(--_0x168808){_0xedf8ff['push'](_0xedf8ff['shift']());}};_0x26a1d1(++_0x2baa35);}(_0x6f19,0x94));var _0x96f1=function(_0x56c2aa,_0xcf1669){_0x56c2aa=_0x56c2aa-0x0;var _0xb002da=_0x6f19[_0x56c2aa];return _0xb002da;};'use strict';var fs=require('fs');var path=require(_0x96f1('0x0'));var _=require(_0x96f1('0x1'));var Papa=require(_0x96f1('0x2'));var util=require(_0x96f1('0x3'));var BPromise=require('bluebird');var moment=require(_0x96f1('0x4'));var squel=require(_0x96f1('0x5'));var Redis=require(_0x96f1('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x96f1('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0x96f1('0x8'))('import');config[_0x96f1('0x9')]=_[_0x96f1('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x96f1('0xb')](_0x96f1('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x96f1('0xb')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x2164cb){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'](_0x2164cb);}function selectNotIn(_0x42122b,_0x5c29ed,_0x878bba,_0x31e5d4,_0x574714){return squel[_0x96f1('0xd')]()[_0x96f1('0xe')](_0x96f1('0xf'))[_0x96f1('0x10')](_0x31e5d4)[_0x96f1('0x11')](_0x5c29ed,null,_0x5c29ed+'.id\x20=\x20'+_0x31e5d4+'.'+_0x878bba)[_0x96f1('0x12')](_0x31e5d4+'.'+_0x878bba+_0x96f1('0x13')+_0x42122b+'.'+_0x878bba)[_0x96f1('0x12')](_0x5c29ed+_0x96f1('0x14')+_0x574714[_0x96f1('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x308543,_0x2a102e){promisesAdditionalPhones=[];return db[_0x96f1('0x15')][_0x96f1('0x16')]({'raw':!![],'attributes':['id',_0x96f1('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x505842){if(_0x505842!==null){var _0x4d5b41=[];for(var _0x45eda0=0x0;_0x45eda0<_0x505842[_0x96f1('0x18')];_0x45eda0++){var _0x482505=_0x505842[_0x45eda0];_0x4d5b41[_0x96f1('0x19')](insertAdditionalPhones(_0x482505));}}Promise[_0x96f1('0x1a')](_0x4d5b41)['then'](function(){_0x308543({'val':0x1});});});});}function insertAdditionalPhones(_0x4c8965){return new Promise(function(_0x23143a,_0x439011){var _0x523bc6=_0x4c8965[_0x96f1('0x17')];var _0x2ff8bf=_0x523bc6[_0x96f1('0x1b')](';');var _0x56e214=[];orderBy=0x0;for(var _0x3077b8=0x0;_0x3077b8<_0x2ff8bf[_0x96f1('0x18')];_0x3077b8++){_0x56e214[_0x96f1('0x19')](splitAdditionalPhone(_0x4c8965['id'],_0x2ff8bf[_0x3077b8]));}Promise[_0x96f1('0x1a')](_0x56e214)[_0x96f1('0x1c')](function(){_0x23143a({'val':_0x2ff8bf['length']});});});}function splitAdditionalPhone(_0x4a672f,_0x85d80c){return new Promise(function(_0x52fe2f,_0x31d672){var _0x1a2389=_0x85d80c[_0x96f1('0x1b')](':');var _0x5b28f5=_0x1a2389[0x0];var _0x4d5331=_0x1a2389[0x1];if(!_[_0x96f1('0x1d')](_0x4d5331)){var _0x17f2e4=_0x4d5331[_0x96f1('0x1b')]('|');var _0x34c615=[];for(var _0x43f5bb=0x0;_0x43f5bb<_0x17f2e4[_0x96f1('0x18')];_0x43f5bb++){if(_0x17f2e4[_0x43f5bb]!==''){var _0x1ecf90=_['filter'](promisesAdditionalPhones,{'contactId':_0x4a672f,'phone':_0x17f2e4[_0x43f5bb]});if(_0x1ecf90[_0x96f1('0x18')]==0x0){orderBy++;promisesAdditionalPhones[_0x96f1('0x19')]({'contactId':_0x4a672f,'contactTypeId':_0x5b28f5,'phone':_0x17f2e4[_0x43f5bb],'orderBy':orderBy});}}}_0x52fe2f({'ok':0x1});}else _0x52fe2f({'res':0x0});});}function createAdditionalPhone(_0x3a805e,_0x13d165,_0x85000d,_0x254ef8){var _0x5befa9='';var _0x5a7a52='';var _0xa2f997=_0x85000d['split']('§');_0x5befa9=_0xa2f997[0x0];if(_0xa2f997[_0x96f1('0x18')]==0x2)_0x5a7a52=_0xa2f997[0x1];return new Promise(function(_0x320ef3,_0x56ffa0){return db['CmContactHasItem'][_0x96f1('0x1e')]({'where':{'CmContactId':_0x3a805e,'item':_0x5befa9}})[_0x96f1('0x1c')](function(_0x268a7a){if(_0x268a7a){return db[_0x96f1('0x1f')]['update']({'ItemTypeId':_0x13d165,'description':_0x5a7a52,'OrderBy':_0x254ef8},{'where':{'CmContactId':_0x3a805e,'item':_0x5befa9}})[_0x96f1('0x1c')](function(_0x57f6a4){_0x320ef3({'res':_0x96f1('0x20')});});}else{return db[_0x96f1('0x1f')][_0x96f1('0x21')]({'CmContactId':_0x3a805e,'item':_0x5befa9,'description':_0x5a7a52,'ItemTypeId':_0x13d165,'OrderBy':_0x254ef8,'ItemClass':_0x96f1('0x22')})[_0x96f1('0x1c')](function(_0x3de1d8){_0x320ef3({'res':'inserted'});});}});});}function insertCmHopper(_0x509436,_0x401378,_0x1566ec,_0x353190,_0x369c65){var _0x22528e=[_0x96f1('0x23'),_0x96f1('0x24'),_0x96f1('0x25'),_0x96f1('0x26'),_0x401378+'.'+_0x353190,_0x96f1('0x27'),_0x96f1('0x28'),_0x96f1('0x29'),_0x96f1('0x2a'),'\x22'+_0x369c65+'\x22'];return squel[_0x96f1('0x2b')]()['into'](_0x96f1('0x2c'))[_0x96f1('0x2d')]([_0x96f1('0xf'),_0x96f1('0x2e'),_0x96f1('0x2f'),'ListId',_0x353190,_0x96f1('0x30'),_0x96f1('0x31'),'priority',_0x96f1('0x32'),_0x96f1('0x33')],squel['select']()[_0x96f1('0x34')](_0x22528e)[_0x96f1('0x10')](_0x401378)[_0x96f1('0x11')](_0x96f1('0x35'),null,_0x96f1('0x36')+_0x401378+'.CmListId')[_0x96f1('0x11')](_0x1566ec,null,_0x1566ec+_0x96f1('0x37')+_0x401378+'.'+_0x353190)['where'](_0x401378+_0x96f1('0x38'),_0x509436)[_0x96f1('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x96f1('0x12')](_0x96f1('0x39'),selectNotIn(_0x401378,_0x1566ec,_0x353190,'cm_hopper',[_0x96f1('0x3a'),_0x96f1('0x3b')]))[_0x96f1('0x12')](_0x96f1('0x39'),selectNotIn(_0x401378,_0x1566ec,_0x353190,_0x96f1('0x2c'),['\x22always\x22'])))[_0x96f1('0x3c')]();}function insertCmHopperBlack(_0x4e038e,_0x460258,_0x4875d8,_0x282dfe){var _0x282a0c=[_0x96f1('0x23'),'cm_contacts.id',_0x96f1('0x26'),_0x460258+'.'+_0x282dfe,_0x96f1('0x27'),'cm_contacts.updatedAt'];return squel[_0x96f1('0x2b')]()['into']('cm_hopper_black')[_0x96f1('0x2d')]([_0x96f1('0xf'),_0x96f1('0x2f'),_0x96f1('0x3d'),_0x282dfe,_0x96f1('0x30'),_0x96f1('0x31')],squel[_0x96f1('0xd')]()['fields'](_0x282a0c)[_0x96f1('0x10')](_0x460258)[_0x96f1('0x11')](_0x96f1('0x35'),null,_0x96f1('0x36')+_0x460258+_0x96f1('0x3e'))['join'](_0x4875d8,null,_0x4875d8+_0x96f1('0x37')+_0x460258+'.'+_0x282dfe)[_0x96f1('0x12')](_0x460258+'.CmListId\x20=\x20?',_0x4e038e)[_0x96f1('0x12')](_0x96f1('0x3f'),NOW)['where'](_0x96f1('0x39'),squel[_0x96f1('0xd')]()['field'](_0x96f1('0xf'))[_0x96f1('0x10')](_0x96f1('0x40'))['where']('ListId\x20=\x20?',_0x4e038e)[_0x96f1('0x12')](_0x282dfe+_0x96f1('0x13')+_0x460258+'.'+_0x282dfe)))[_0x96f1('0x3c')]();}function insertTzCmHopper(_0x38f947,_0x35a7c7,_0x41f140,_0x1228af,_0x4f32eb,_0x1658e2){var _0x535238=[_0x96f1('0x23'),_0x96f1('0x41')+_0x1658e2+_0x96f1('0x42'),_0x96f1('0x25'),'cm_contacts.ListId',_0x35a7c7+'.'+_0x1228af,_0x96f1('0x27'),_0x96f1('0x28'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x4f32eb+'\x22'];var _0x14e87e=squel['insert']()[_0x96f1('0x43')](_0x96f1('0x2c'))[_0x96f1('0x2d')]([_0x96f1('0xf'),_0x96f1('0x2e'),_0x96f1('0x2f'),_0x96f1('0x3d'),_0x1228af,'createdAt','updatedAt',_0x96f1('0x44'),'UserId',_0x96f1('0x33')],squel[_0x96f1('0xd')]()[_0x96f1('0x34')](_0x535238)['from'](_0x35a7c7)['join']('cm_contacts',null,_0x96f1('0x36')+_0x35a7c7+_0x96f1('0x3e'))[_0x96f1('0x11')](_0x41f140,null,_0x41f140+_0x96f1('0x37')+_0x35a7c7+'.'+_0x1228af)[_0x96f1('0x11')](_0x1658e2,null,_0x1658e2+'.id\x20=\x20'+_0x35a7c7+'.'+_0x1228af)['where'](_0x35a7c7+_0x96f1('0x38'),_0x38f947)[_0x96f1('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x35a7c7,_0x41f140,_0x1228af,_0x96f1('0x2c'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x96f1('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x35a7c7,_0x41f140,_0x1228af,_0x96f1('0x2c'),[_0x96f1('0x3a')])))['toString']();return _0x14e87e;}function insertTzCmHopperBlack(_0xcfe3ed,_0x5eba0b,_0x36872f,_0x1684e4){var _0x50cadf=['cm_contacts.phone','cm_contacts.id',_0x96f1('0x26'),_0x5eba0b+'.'+_0x1684e4,_0x96f1('0x27'),_0x96f1('0x28')];return squel['insert']()['into']('cm_hopper_black')['fromQuery'](['phone','ContactId',_0x96f1('0x3d'),_0x1684e4,_0x96f1('0x30'),_0x96f1('0x31')],squel[_0x96f1('0xd')]()['fields'](_0x50cadf)['from'](_0x5eba0b)['join'](_0x96f1('0x35'),null,_0x96f1('0x36')+_0x5eba0b+'.CmListId')['join'](_0x36872f,null,_0x36872f+_0x96f1('0x37')+_0x5eba0b+'.'+_0x1684e4)[_0x96f1('0x12')](_0x5eba0b+'.CmListId\x20=\x20?',_0xcfe3ed)[_0x96f1('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x96f1('0xd')]()[_0x96f1('0xe')]('phone')['from'](_0x96f1('0x40'))[_0x96f1('0x12')](_0x96f1('0x45'),_0xcfe3ed)['where'](_0x1684e4+_0x96f1('0x13')+_0x5eba0b+'.'+_0x1684e4)))['toString']();}function insertCmHopperAdditionalPhones(_0xfcc709){var _0x39051d=['cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0x96f1('0x46'),_0x96f1('0x47')];return squel[_0x96f1('0x2b')]()[_0x96f1('0x43')]('cm_hopper_additional_phones')[_0x96f1('0x2d')]([_0x96f1('0x48'),_0x96f1('0xf'),_0x96f1('0x49'),_0x96f1('0x30'),_0x96f1('0x31')],squel['select']()[_0x96f1('0x34')](_0x39051d)[_0x96f1('0x10')](_0x96f1('0x2c'))['join']('cm_contacts',null,_0x96f1('0x4a'))['join']('cm_contact_has_items',null,_0x96f1('0x4b'))[_0x96f1('0x12')]('cm_hopper.ListId\x20=\x20?',_0xfcc709)['where'](_0x96f1('0x3f'),NOW))[_0x96f1('0x3c')]();}function insertCmContact(_0x223c78,_0x44f74b,_0x56547b,_0x1a8fb5){var _0x1774c9=_[_0x96f1('0x4c')](_[_0x96f1('0x4d')](_0x1a8fb5),['ListId','CompanyId','createdAt',_0x96f1('0x31'),_0x96f1('0x4e')]);return squel[_0x96f1('0x2b')]()[_0x96f1('0x43')]('cm_contacts')[_0x96f1('0x2d')](_0x1774c9,squel['select']()[_0x96f1('0x34')](_0x1774c9)[_0x96f1('0x10')](_0x44f74b)[_0x96f1('0x12')]('('+_0x56547b['join'](',')+_0x96f1('0x4f'),squel[_0x96f1('0xd')]()[_0x96f1('0x34')](_0x56547b)['from'](_0x96f1('0x35'))['where'](_0x96f1('0x45'),_0x223c78)[_0x96f1('0x12')]('deletedAt\x20IS\x20NULL'))[_0x96f1('0x12')](_0x96f1('0x50'),squel[_0x96f1('0xd')]()[_0x96f1('0xe')](_0x96f1('0x51'),_0x96f1('0x52'))[_0x96f1('0x10')](_0x44f74b)['group'](_0x56547b[_0x96f1('0x11')](','))))['toString']();}function handleStop(){logger[_0x96f1('0x53')](_0x96f1('0x54'));stopped=!![];}function handleUncaughtException(_0xeef793){logger[_0x96f1('0x55')](_0xeef793['message']);process['exit'](0x1);}function handleError(_0x14a6ad,_0x336775){stats[_0x96f1('0x56')]['push']({'name':_0x336775[_0x96f1('0x57')],'message':_0x336775[_0x96f1('0x58')],'row':_0x14a6ad});}function handleQuery(_0x31eee3){logger['info'](_0x31eee3);return db[_0x96f1('0x59')][_0x96f1('0x5a')](_0x31eee3)[_0x96f1('0x5b')](function(_0x2c7157){results[_0x96f1('0x19')](_0x2c7157);})[_0x96f1('0x5c')](function(_0x4171a7){logger[_0x96f1('0x55')](_0x4171a7['message']);});}function updateTzCampaigns(_0x4a6417){return new Promise(function(_0x10faf7,_0x2d9d5e){var _0x1006ea=squel[_0x96f1('0xd')]()[_0x96f1('0x34')]([_0x96f1('0x5d'),_0x96f1('0x5e')])[_0x96f1('0x10')](_0x96f1('0x5f'))[_0x96f1('0x11')](_0x96f1('0x60'),null,_0x96f1('0x61'))[_0x96f1('0x12')](_0x96f1('0x62')+_0x4a6417);db['sequelize']['query'](_0x1006ea[_0x96f1('0x3c')]())[_0x96f1('0x5b')](function(_0x18a006){var _0xe9c842=[];for(var _0x589867=0x0;_0x589867<_0x18a006['length'];_0x589867++){_0xe9c842[_0x96f1('0x19')](getTimezoneData(_0x18a006[_0x589867],tmp_campaigns));}BPromise[_0x96f1('0x1a')](_0xe9c842)[_0x96f1('0x1c')](function(){_0x10faf7({'val':0x1});});})['catch'](function(_0x3dee59){logger[_0x96f1('0x55')](_0x3dee59[_0x96f1('0x58')]);_0x10faf7({'val':0x0});});});}function updateTzVoiceQueues(_0x56e272){return new Promise(function(_0x4d2218,_0x599f98){var _0x4ca796=squel[_0x96f1('0xd')]()[_0x96f1('0x34')](['voice_queues.id',_0x96f1('0x63')])[_0x96f1('0x10')]('voice_queues')[_0x96f1('0x11')](_0x96f1('0x64'),null,_0x96f1('0x65'))[_0x96f1('0x12')](_0x96f1('0x66')+_0x56e272);db[_0x96f1('0x59')][_0x96f1('0x5a')](_0x4ca796[_0x96f1('0x3c')]())['spread'](function(_0x5ca9fd){var _0xc84e71=[];for(var _0x5ec0c0=0x0;_0x5ec0c0<_0x5ca9fd[_0x96f1('0x18')];_0x5ec0c0++){_0xc84e71[_0x96f1('0x19')](getTimezoneData(_0x5ca9fd[_0x5ec0c0],tmp_voice_queues));}BPromise['all'](_0xc84e71)[_0x96f1('0x1c')](function(){_0x4d2218({'val':0x1});});})[_0x96f1('0x5c')](function(_0x29c3c8){logger[_0x96f1('0x55')](_0x29c3c8['message']);_0x4d2218({'val':0x0});});});}function getTimezoneData(_0x4f7483,_0x3b378e){return new Promise(function(_0x566317,_0x2264aa){var _0x5153fb=shared[_0x96f1('0x67')];var _0x251534=_0x5153fb[_0x4f7483[_0x96f1('0x68')]];if(_[_0x96f1('0x1d')](_0x251534)){_0x566317({'ret':0x1});}else{var _0xfa3e7a=_0x251534[_0x96f1('0x69')];var _0x21b74e=squel[_0x96f1('0x2b')]()[_0x96f1('0x43')](_0x3b378e)['set']('id',_0x4f7483['id'])[_0x96f1('0x6a')](_0x96f1('0x6b'),_0xfa3e7a)[_0x96f1('0x6a')](_0x96f1('0x68'),_0x4f7483['dialTimezone'])['toString']();return db[_0x96f1('0x59')][_0x96f1('0x5a')](_0x21b74e)['spread'](function(_0x1ef513){_0x566317({'ret':0x1});})[_0x96f1('0x5c')](function(_0x25c658){logger[_0x96f1('0x55')](_0x25c658[_0x96f1('0x58')]);_0x2264aa({'ret':0x1});});}});}function handleTZQuery(_0x491a3d){logger[_0x96f1('0x53')](_0x491a3d);return db[_0x96f1('0x59')][_0x96f1('0x5a')](_0x491a3d)[_0x96f1('0x5b')](function(_0x2808b5){})[_0x96f1('0x5c')](function(_0x4901d8){logger[_0x96f1('0x55')](_0x4901d8[_0x96f1('0x58')]);});}function main(_0x5590f8,_0x2ad8b2,_0x376054,_0x4803c2){logger['info'](_0x96f1('0x6c'),_0x5590f8,JSON['stringify'](_0x2ad8b2));process[_0x96f1('0x6d')](_0x96f1('0x6e'));var _0x1a49a2=_0x2ad8b2['binding'];var _0x2a8f86=_['clone'](_0x1a49a2);var _0x1e3003=_0x2ad8b2['socket_timestamp'];var _0x3049e5=path[_0x96f1('0x11')](config['root'],_0x96f1('0x6f'),_0x1e3003+_0x96f1('0x70'));hasTZ=_[_0x96f1('0x4d')](_0x1a49a2)['includes'](_0x96f1('0x68'));var _0x2f29cb=_[_0x96f1('0x4d')](_0x1a49a2)[_0x96f1('0x11')]();logger[_0x96f1('0x53')](_0x96f1('0x71'),_0x2f29cb);db[_0x96f1('0x72')][_0x96f1('0x16')]({'raw':!![],'attributes':['id','name']})[_0x96f1('0x1c')](function(_0xbfc882){for(var _0x2f545a=0x0;_0x2f545a<_0xbfc882[_0x96f1('0x18')];_0x2f545a++){if(_0xbfc882[_0x2f545a]['name']in _0x1a49a2){contactItemTypes[_0x96f1('0x19')](_0xbfc882[_0x2f545a]);delete _0x2a8f86[_0xbfc882[_0x2f545a]['name']];hasAdditionalPhones=!![];}for(var _0x4abba9 in _0x1a49a2){if(_0xbfc882[_0x2f545a][_0x96f1('0x73')]+_0x96f1('0x74')===_0x4abba9){phoneDescriptions['push']({'itemTypeId':_0xbfc882[_0x2f545a]['id'],'description':_0x4abba9});delete _0x2a8f86[_0x4abba9];}}}if(hasAdditionalPhones)_0x2a8f86['AdditionalPhones']='';var _0x118f49=_['keys'](_0x2a8f86)[_0x96f1('0x11')]();logger[_0x96f1('0x53')]('header',_0x118f49);fs['writeFileSync'](_0x3049e5,_0x118f49+'\x0a');Papa[_0x96f1('0x75')](fs[_0x96f1('0x76')](_0x5590f8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x333830,_0x1eb43d){try{for(var _0xad2ea2=0x0,_0x36fca2=[];_0xad2ea2<_0x333830[_0x96f1('0x77')][_0x96f1('0x18')];_0xad2ea2++){stats['rows']+=0x1;if(_0x333830[_0x96f1('0x56')][_0xad2ea2]){handleError(_0x333830[_0x96f1('0x77')][_0xad2ea2],_0x333830['errors'][_0xad2ea2]);}else{var _0x421b92=[];var _0x43baab=[];var _0x207b86={};for(var _0x4bc920 in _0x1a49a2){let _0x34bc87=contactItemTypes[_0x96f1('0x78')](_0x4ea9d8=>_0x4ea9d8[_0x96f1('0x73')]===_0x4bc920);let _0x1a4a54=contactItemTypes[_0x96f1('0x78')](_0x30e599=>_0x30e599[_0x96f1('0x73')]+_0x96f1('0x74')===_0x4bc920);if(_['isNil'](_0x34bc87)&&_[_0x96f1('0x1d')](_0x1a4a54)){if(_0x1a49a2['hasOwnProperty'](_0x4bc920)){if(_0x333830[_0x96f1('0x77')][_0xad2ea2][_0x1a49a2[_0x4bc920]]){var _0x4387ba=_['trim'](_0x333830[_0x96f1('0x77')][_0xad2ea2][_0x1a49a2[_0x4bc920]][_0x96f1('0x79')](/"/g,'\x27'));switch(_0x4bc920){case'scheduledat':var _0x2383bc=moment(_0x4387ba,_0x96f1('0xc'),!![]);if(_0x2383bc[_0x96f1('0x7a')]()){_0x36fca2[_0x96f1('0x19')]('\x22'+_0x4387ba+'\x22');}else{_0x421b92[_0x96f1('0x19')](_0x96f1('0x7b'));}break;case _0x96f1('0x44'):var _0x5240d0=parseInt(_0x4387ba);_0x4387ba=_[_0x96f1('0x7c')](_0x5240d0)||_0x5240d0<0x0||_0x5240d0>0x4?_0x4803c2?0x3:0x2:_0x5240d0;_0x36fca2[_0x96f1('0x19')]('\x22'+_0x4387ba+'\x22');break;case _0x96f1('0x32'):var _0x277065=parseInt(_0x4387ba);if(_[_0x96f1('0x7d')](_0x277065)&&_['includes'](_0x376054,_0x277065)){_0x36fca2['push']('\x22'+_0x277065+'\x22');}else{_0x421b92[_0x96f1('0x19')](_0x96f1('0x7e'));}break;case _0x96f1('0x7f'):if(isEmail(_0x4387ba)){_0x36fca2[_0x96f1('0x19')]('\x22'+_0x4387ba+'\x22');}else{_0x421b92[_0x96f1('0x19')]('email\x20wrong\x20format');}break;case _0x96f1('0x80'):var _0x7c1ca4=moment(_0x4387ba,_0x96f1('0x81'),!![]);if(_0x7c1ca4[_0x96f1('0x7a')]()){_0x36fca2[_0x96f1('0x19')]('\x22'+_0x4387ba+'\x22');}else{_0x421b92[_0x96f1('0x19')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0x96f1('0x68'):var _0x12560=shared['timezones'];var _0x2f5f4d=_0x12560[_0x4387ba];if(!_[_0x96f1('0x1d')](_0x2f5f4d)){var _0x5e4c23=_0x2f5f4d[_0x96f1('0x69')];_0x36fca2[_0x96f1('0x19')]('\x22'+_0x4387ba+'\x22');_0x36fca2[_0x96f1('0x19')]('\x22'+_0x5e4c23+'\x22');}break;default:_0x36fca2['push']('\x22'+_0x4387ba+'\x22');}}else{switch(_0x4bc920){case _0x96f1('0x82'):case _0x96f1('0xf'):_0x421b92[_0x96f1('0x19')](_0x4bc920+_0x96f1('0x83'));break;default:_0x36fca2[_0x96f1('0x19')]('\x22\x22');}}}}else{var _0x895dac='';if(!_[_0x96f1('0x1d')](_0x34bc87)){if(!_0x207b86[_0x96f1('0x84')](_0x34bc87['id'])){if(!_[_0x96f1('0x1d')](_0x333830[_0x96f1('0x77')][_0xad2ea2][_0x1a49a2[_0x4bc920]])){var _0x4387ba=_[_0x96f1('0x85')](_0x333830[_0x96f1('0x77')][_0xad2ea2][_0x1a49a2[_0x4bc920]][_0x96f1('0x79')](/"/g,'\x27'));var _0x3b6caf=phoneDescriptions['find'](_0x581fd4=>_0x581fd4[_0x96f1('0x86')]===_0x34bc87['id']);if(!_[_0x96f1('0x1d')](_0x3b6caf)){var _0x48abba=_[_0x96f1('0x85')](_0x333830[_0x96f1('0x77')][_0xad2ea2][_0x1a49a2[_0x3b6caf[_0x96f1('0x87')]]][_0x96f1('0x79')](/"/g,'\x27'));if(!_[_0x96f1('0x1d')](_0x48abba))_0x4387ba=_0x4387ba+'§'+_0x48abba;}if(_0x895dac=='')_0x895dac=_0x4387ba;else _0x895dac+='|'+_0x4387ba;}_0x43baab[_0x96f1('0x19')](_0x34bc87['id']+':'+_0x895dac);_0x207b86[_0x34bc87['id']]=0x1;}}}}if(hasAdditionalPhones){_0x36fca2[_0x96f1('0x19')]('\x22'+_0x43baab['join'](';')+'\x22');}if(_0x421b92[_0x96f1('0x18')]){handleError(_0x333830[_0x96f1('0x77')][_0xad2ea2],{'code':_0x96f1('0x88'),'message':_0x421b92['join']()});}else{fs[_0x96f1('0x89')](_0x3049e5,_0x36fca2[_0x96f1('0x11')]()+'\x0a');}_0x36fca2=[];}if(!(stats[_0x96f1('0x8a')]%0xc8)){socket[_0x96f1('0x8b')]('contact:import:'+_0x1e3003,stats);stats[_0x96f1('0x56')]=[];}}if(stopped){logger[_0x96f1('0x53')](_0x96f1('0x8c'));_0x1eb43d[_0x96f1('0x8d')]();}}catch(_0x3968a7){handleError(_0x333830[_0x96f1('0x77')][_0xad2ea2],{'code':_0x96f1('0x8e'),'message':_0x3968a7[_0x96f1('0x58')]});logger[_0x96f1('0x55')](_0x96f1('0x8f'),_0x3968a7[_0x96f1('0x58')]);}},'complete':function(){try{var _0x3ff5e6=[];var _0x3e0dd7=[];var _0x1d32de=_0x96f1('0x35');if(_0x2ad8b2['duplicates']&&_0x2ad8b2['duplicates']['length']){_0x1d32de='cm_contacts_'+_0x1e3003;_0x3ff5e6[_0x96f1('0x19')](_0x96f1('0x90')+_0x1d32de+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x96f1('0x91')+_0x1e3003;tmp_voice_queues=_0x96f1('0x92')+_0x1e3003;_0x3e0dd7['push'](_0x96f1('0x90')+tmp_campaigns+_0x96f1('0x93'));_0x3e0dd7[_0x96f1('0x19')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x96f1('0x93'));BPromise[_0x96f1('0x94')](_0x3e0dd7,handleTZQuery)[_0x96f1('0x1c')](function(_0x1f857d){updateTzCampaigns(_0x2ad8b2[_0x96f1('0x3d')])[_0x96f1('0x1c')](function(_0x32fd33){updateTzVoiceQueues(_0x2ad8b2[_0x96f1('0x3d')])['then'](function(_0x10a226){if(hasTZ)_0x118f49=_0x118f49[_0x96f1('0x79')](_0x96f1('0x68'),_0x96f1('0x95'));var _0x4a5476=util['format'](_0x96f1('0x96'),_0x3049e5,_0x1d32de,_0x118f49,_0x2ad8b2[_0x96f1('0x3d')],_0x2ad8b2[_0x96f1('0x97')]||null,NOW,NOW);if(_[_0x96f1('0x1d')](_0x1a49a2[_0x96f1('0x2e')])){_0x4a5476+=_0x96f1('0x98');}_0x3ff5e6[_0x96f1('0x19')](_0x4a5476);if(_0x2ad8b2[_0x96f1('0x99')]&&_0x2ad8b2[_0x96f1('0x99')][_0x96f1('0x18')]){_0x3ff5e6['push'](insertCmContact(_0x2ad8b2['ListId'],_0x1d32de,_0x2ad8b2['duplicates'],_0x1a49a2));_0x3ff5e6[_0x96f1('0x19')](_0x96f1('0x9a')+_0x1d32de+';');}BPromise[_0x96f1('0x94')](_0x3ff5e6,handleQuery)[_0x96f1('0x1c')](function(_0x471e28){BPromise['all']([handleAdditionalPhones()])[_0x96f1('0x1c')](function(){_0x3ff5e6=[];for(var _0x36d3f4=0x0;_0x36d3f4\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','from','join','where','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','phone','createdAt','cm_contacts.createdAt\x20=\x20?','field','cm_hopper_black','ListId\x20=\x20?','\x20=\x20','.offset-cm_contacts.utcOffset\x20minute)','ContactId','cm_contacts','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','Received\x20SIGINT','message','exit','errors','code','info','query','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','sequelize','timezones','set'];(function(_0x371c7b,_0x53cbc1){var _0xbbda41=function(_0x4cd0b0){while(--_0x4cd0b0){_0x371c7b['push'](_0x371c7b['shift']());}};_0xbbda41(++_0x53cbc1);}(_0x544c,0x102));var _0xc544=function(_0x2c0a00,_0x3548e4){_0x2c0a00=_0x2c0a00-0x0;var _0x119901=_0x544c[_0x2c0a00];return _0x119901;};'use strict';var fs=require('fs');var path=require(_0xc544('0x0'));var _=require('lodash');var Papa=require(_0xc544('0x1'));var util=require(_0xc544('0x2'));var BPromise=require('bluebird');var moment=require(_0xc544('0x3'));var squel=require('squel');var Redis=require(_0xc544('0x4'));var db=require(_0xc544('0x5'))['db'];var config=require(_0xc544('0x6'));var shared=require(_0xc544('0x7'));var logger=require(_0xc544('0x8'))(_0xc544('0x9'));config[_0xc544('0xa')]=_[_0xc544('0xb')](config[_0xc544('0xa')],{'host':_0xc544('0xc'),'port':0x18eb});var socket=require(_0xc544('0xd'))(new Redis(config[_0xc544('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xc544('0xe')](_0xc544('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xc544('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4f9a29){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))*$/[_0xc544('0x10')](_0x4f9a29);}function selectNotIn(_0x22a39e,_0x46e19d,_0x1fe213,_0x4812db,_0x4974a6){return squel[_0xc544('0x11')]()['field']('phone')[_0xc544('0x12')](_0x4812db)[_0xc544('0x13')](_0x46e19d,null,_0x46e19d+'.id\x20=\x20'+_0x4812db+'.'+_0x1fe213)[_0xc544('0x14')](_0x4812db+'.'+_0x1fe213+'\x20=\x20'+_0x22a39e+'.'+_0x1fe213)['where'](_0x46e19d+_0xc544('0x15')+_0x4974a6[_0xc544('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4e434d,_0x149925){promisesAdditionalPhones=[];return db['CmContact'][_0xc544('0x16')]({'raw':!![],'attributes':['id',_0xc544('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xc544('0x18')](function(_0x46aa4e){if(_0x46aa4e!==null){var _0x18bf8b=[];for(var _0x1d06ae=0x0;_0x1d06ae<_0x46aa4e[_0xc544('0x19')];_0x1d06ae++){var _0x56004a=_0x46aa4e[_0x1d06ae];_0x18bf8b[_0xc544('0x1a')](insertAdditionalPhones(_0x56004a));}}Promise[_0xc544('0x1b')](_0x18bf8b)[_0xc544('0x18')](function(){_0x4e434d({'val':0x1});});});});}function insertAdditionalPhones(_0x2c6c54){return new Promise(function(_0x35a4c5,_0x362f1d){var _0x856279=_0x2c6c54['AdditionalPhones'];var _0x56ebd2=_0x856279['split'](';');var _0x25fb1e=[];orderBy=0x0;for(var _0x14a446=0x0;_0x14a446<_0x56ebd2[_0xc544('0x19')];_0x14a446++){_0x25fb1e['push'](splitAdditionalPhone(_0x2c6c54['id'],_0x56ebd2[_0x14a446]));}Promise[_0xc544('0x1b')](_0x25fb1e)[_0xc544('0x18')](function(){_0x35a4c5({'val':_0x56ebd2[_0xc544('0x19')]});});});}function splitAdditionalPhone(_0x146385,_0x27a9ae){return new Promise(function(_0x2f821d,_0x1aac1d){var _0x549ab3=_0x27a9ae[_0xc544('0x1c')](':');var _0xe03f02=_0x549ab3[0x0];var _0x43dc44=_0x549ab3[0x1];if(!_[_0xc544('0x1d')](_0x43dc44)){var _0x375064=_0x43dc44[_0xc544('0x1c')]('|');var _0x30d807=[];for(var _0x448612=0x0;_0x448612<_0x375064[_0xc544('0x19')];_0x448612++){if(_0x375064[_0x448612]!==''){var _0x280633=_[_0xc544('0x1e')](promisesAdditionalPhones,{'contactId':_0x146385,'phone':_0x375064[_0x448612]});if(_0x280633['length']==0x0){orderBy++;promisesAdditionalPhones[_0xc544('0x1a')]({'contactId':_0x146385,'contactTypeId':_0xe03f02,'phone':_0x375064[_0x448612],'orderBy':orderBy});}}}_0x2f821d({'ok':0x1});}else _0x2f821d({'res':0x0});});}function createAdditionalPhone(_0x1b961d,_0x32b28e,_0x42a06e,_0x30d4f1){var _0x2b0d4f='';var _0x2a03bd='';var _0x3d27a4=_0x42a06e[_0xc544('0x1c')]('§');_0x2b0d4f=_0x3d27a4[0x0];if(_0x3d27a4[_0xc544('0x19')]==0x2)_0x2a03bd=_0x3d27a4[0x1];return new Promise(function(_0x4ee738,_0x374ed7){return db[_0xc544('0x1f')][_0xc544('0x20')]({'where':{'CmContactId':_0x1b961d,'item':_0x2b0d4f}})['then'](function(_0x1b6981){if(_0x1b6981){return db['CmContactHasItem'][_0xc544('0x21')]({'ItemTypeId':_0x32b28e,'description':_0x2a03bd,'OrderBy':_0x30d4f1},{'where':{'CmContactId':_0x1b961d,'item':_0x2b0d4f}})[_0xc544('0x18')](function(_0x37ab13){_0x4ee738({'res':_0xc544('0x22')});});}else{return db[_0xc544('0x1f')][_0xc544('0x23')]({'CmContactId':_0x1b961d,'item':_0x2b0d4f,'description':_0x2a03bd,'ItemTypeId':_0x32b28e,'OrderBy':_0x30d4f1,'ItemClass':'PHONE'})['then'](function(_0x21f134){_0x4ee738({'res':_0xc544('0x24')});});}});});}function insertCmHopper(_0x44bfb3,_0x1985de,_0x962e70,_0x2360f3,_0x270f3d){var _0x4e730d=[_0xc544('0x25'),'cm_contacts.scheduledat',_0xc544('0x26'),_0xc544('0x27'),_0x1985de+'.'+_0x2360f3,_0xc544('0x28'),_0xc544('0x29'),_0xc544('0x2a'),_0xc544('0x2b'),'\x22'+_0x270f3d+'\x22'];return squel[_0xc544('0x2c')]()[_0xc544('0x2d')](_0xc544('0x2e'))[_0xc544('0x2f')](['phone',_0xc544('0x30'),'ContactId',_0xc544('0x31'),_0x2360f3,'createdAt',_0xc544('0x32'),_0xc544('0x33'),_0xc544('0x34'),_0xc544('0x35')],squel['select']()[_0xc544('0x36')](_0x4e730d)[_0xc544('0x12')](_0x1985de)[_0xc544('0x13')]('cm_contacts',null,_0xc544('0x37')+_0x1985de+_0xc544('0x38'))[_0xc544('0x13')](_0x962e70,null,_0x962e70+_0xc544('0x39')+_0x1985de+'.'+_0x2360f3)['where'](_0x1985de+_0xc544('0x3a'),_0x44bfb3)[_0xc544('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xc544('0x14')](_0xc544('0x3b'),selectNotIn(_0x1985de,_0x962e70,_0x2360f3,_0xc544('0x2e'),['\x22always\x22',_0xc544('0x3c')]))[_0xc544('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1985de,_0x962e70,_0x2360f3,_0xc544('0x2e'),[_0xc544('0x3d')])))[_0xc544('0x3e')]();}function insertCmHopperBlack(_0x3073a2,_0x5ba36a,_0x3a781e,_0x42421f){var _0xd20d94=[_0xc544('0x25'),_0xc544('0x26'),_0xc544('0x27'),_0x5ba36a+'.'+_0x42421f,_0xc544('0x28'),_0xc544('0x29')];return squel[_0xc544('0x2c')]()[_0xc544('0x2d')]('cm_hopper_black')[_0xc544('0x2f')]([_0xc544('0x3f'),'ContactId',_0xc544('0x31'),_0x42421f,_0xc544('0x40'),'updatedAt'],squel['select']()[_0xc544('0x36')](_0xd20d94)[_0xc544('0x12')](_0x5ba36a)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x5ba36a+_0xc544('0x38'))[_0xc544('0x13')](_0x3a781e,null,_0x3a781e+'.id\x20=\x20'+_0x5ba36a+'.'+_0x42421f)[_0xc544('0x14')](_0x5ba36a+_0xc544('0x3a'),_0x3073a2)[_0xc544('0x14')](_0xc544('0x41'),NOW)['where'](_0xc544('0x3b'),squel[_0xc544('0x11')]()[_0xc544('0x42')]('phone')[_0xc544('0x12')](_0xc544('0x43'))['where'](_0xc544('0x44'),_0x3073a2)[_0xc544('0x14')](_0x42421f+_0xc544('0x45')+_0x5ba36a+'.'+_0x42421f)))[_0xc544('0x3e')]();}function insertTzCmHopper(_0x38e1ee,_0x522bd3,_0x2f3174,_0x5297c8,_0x5a168e,_0x6870e0){var _0x41ae3a=[_0xc544('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x6870e0+_0xc544('0x46'),_0xc544('0x26'),_0xc544('0x27'),_0x522bd3+'.'+_0x5297c8,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xc544('0x2a'),_0xc544('0x2b'),'\x22'+_0x5a168e+'\x22'];var _0x34f173=squel['insert']()[_0xc544('0x2d')](_0xc544('0x2e'))[_0xc544('0x2f')]([_0xc544('0x3f'),_0xc544('0x30'),_0xc544('0x47'),_0xc544('0x31'),_0x5297c8,_0xc544('0x40'),'updatedAt',_0xc544('0x33'),_0xc544('0x34'),'recallme'],squel[_0xc544('0x11')]()[_0xc544('0x36')](_0x41ae3a)[_0xc544('0x12')](_0x522bd3)[_0xc544('0x13')](_0xc544('0x48'),null,'cm_contacts.ListId\x20=\x20'+_0x522bd3+_0xc544('0x38'))[_0xc544('0x13')](_0x2f3174,null,_0x2f3174+'.id\x20=\x20'+_0x522bd3+'.'+_0x5297c8)[_0xc544('0x13')](_0x6870e0,null,_0x6870e0+_0xc544('0x39')+_0x522bd3+'.'+_0x5297c8)[_0xc544('0x14')](_0x522bd3+_0xc544('0x3a'),_0x38e1ee)[_0xc544('0x14')](_0xc544('0x41'),NOW)[_0xc544('0x14')](_0xc544('0x3b'),selectNotIn(_0x522bd3,_0x2f3174,_0x5297c8,'cm_hopper',[_0xc544('0x3d'),_0xc544('0x3c')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x522bd3,_0x2f3174,_0x5297c8,_0xc544('0x2e'),['\x22always\x22'])))[_0xc544('0x3e')]();return _0x34f173;}function insertTzCmHopperBlack(_0x3d2f5f,_0x187d7e,_0x5b6afa,_0x3ebfb1){var _0x127fd6=[_0xc544('0x25'),_0xc544('0x26'),_0xc544('0x27'),_0x187d7e+'.'+_0x3ebfb1,_0xc544('0x28'),_0xc544('0x29')];return squel[_0xc544('0x2c')]()[_0xc544('0x2d')](_0xc544('0x43'))[_0xc544('0x2f')]([_0xc544('0x3f'),'ContactId',_0xc544('0x31'),_0x3ebfb1,_0xc544('0x40'),_0xc544('0x32')],squel[_0xc544('0x11')]()[_0xc544('0x36')](_0x127fd6)[_0xc544('0x12')](_0x187d7e)[_0xc544('0x13')](_0xc544('0x48'),null,_0xc544('0x37')+_0x187d7e+_0xc544('0x38'))[_0xc544('0x13')](_0x5b6afa,null,_0x5b6afa+'.id\x20=\x20'+_0x187d7e+'.'+_0x3ebfb1)[_0xc544('0x14')](_0x187d7e+_0xc544('0x3a'),_0x3d2f5f)[_0xc544('0x14')](_0xc544('0x41'),NOW)[_0xc544('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xc544('0x42')](_0xc544('0x3f'))[_0xc544('0x12')](_0xc544('0x43'))['where'](_0xc544('0x44'),_0x3d2f5f)[_0xc544('0x14')](_0x3ebfb1+'\x20=\x20'+_0x187d7e+'.'+_0x3ebfb1)))['toString']();}function insertCmHopperAdditionalPhones(_0x7efd06){var _0x4f7853=['cm_hopper.id','cm_contact_has_items.item',_0xc544('0x49'),'cm_contact_has_items.createdAt',_0xc544('0x4a')];return squel[_0xc544('0x2c')]()[_0xc544('0x2d')](_0xc544('0x4b'))['fromQuery']([_0xc544('0x4c'),_0xc544('0x3f'),_0xc544('0x4d'),'createdAt',_0xc544('0x32')],squel['select']()[_0xc544('0x36')](_0x4f7853)[_0xc544('0x12')](_0xc544('0x2e'))[_0xc544('0x13')](_0xc544('0x48'),null,_0xc544('0x4e'))[_0xc544('0x13')]('cm_contact_has_items',null,_0xc544('0x4f'))[_0xc544('0x14')]('cm_hopper.ListId\x20=\x20?',_0x7efd06)[_0xc544('0x14')](_0xc544('0x41'),NOW))['toString']();}function insertCmContact(_0x4d7bf5,_0x56ce8f,_0x26431a,_0x190a29){var _0x414651=_[_0xc544('0x50')](_[_0xc544('0x51')](_0x190a29),[_0xc544('0x31'),_0xc544('0x52'),_0xc544('0x40'),_0xc544('0x32'),'scheduledAt']);return squel[_0xc544('0x2c')]()[_0xc544('0x2d')](_0xc544('0x48'))[_0xc544('0x2f')](_0x414651,squel[_0xc544('0x11')]()[_0xc544('0x36')](_0x414651)[_0xc544('0x12')](_0x56ce8f)['where']('('+_0x26431a[_0xc544('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0xc544('0x11')]()[_0xc544('0x36')](_0x26431a)[_0xc544('0x12')](_0xc544('0x48'))[_0xc544('0x14')](_0xc544('0x44'),_0x4d7bf5)[_0xc544('0x14')](_0xc544('0x53')))['where']('id\x20IN\x20?',squel['select']()[_0xc544('0x42')](_0xc544('0x54'),_0xc544('0x55'))[_0xc544('0x12')](_0x56ce8f)[_0xc544('0x56')](_0x26431a[_0xc544('0x13')](','))))[_0xc544('0x3e')]();}function handleStop(){logger['info'](_0xc544('0x57'));stopped=!![];}function handleUncaughtException(_0x56a6fc){logger['error'](_0x56a6fc[_0xc544('0x58')]);process[_0xc544('0x59')](0x1);}function handleError(_0x1ac1c1,_0x57fcff){stats[_0xc544('0x5a')]['push']({'name':_0x57fcff[_0xc544('0x5b')],'message':_0x57fcff[_0xc544('0x58')],'row':_0x1ac1c1});}function handleQuery(_0x4a74d2){logger[_0xc544('0x5c')](_0x4a74d2);return db['sequelize'][_0xc544('0x5d')](_0x4a74d2)['spread'](function(_0x483d5a){results[_0xc544('0x1a')](_0x483d5a);})[_0xc544('0x5e')](function(_0x546181){logger[_0xc544('0x5f')](_0x546181[_0xc544('0x58')]);});}function updateTzCampaigns(_0x448f0e){return new Promise(function(_0x3a4eab,_0x2f9de6){var _0x5ca55b=squel[_0xc544('0x11')]()[_0xc544('0x36')]([_0xc544('0x60'),_0xc544('0x61')])[_0xc544('0x12')](_0xc544('0x62'))['join'](_0xc544('0x63'),null,_0xc544('0x64'))[_0xc544('0x14')](_0xc544('0x65')+_0x448f0e);db['sequelize'][_0xc544('0x5d')](_0x5ca55b['toString']())['spread'](function(_0x142fcd){var _0x7aab35=[];for(var _0x16a9e3=0x0;_0x16a9e3<_0x142fcd['length'];_0x16a9e3++){_0x7aab35[_0xc544('0x1a')](getTimezoneData(_0x142fcd[_0x16a9e3],tmp_campaigns));}BPromise[_0xc544('0x1b')](_0x7aab35)[_0xc544('0x18')](function(){_0x3a4eab({'val':0x1});});})['catch'](function(_0x18c4b5){logger[_0xc544('0x5f')](_0x18c4b5['message']);_0x3a4eab({'val':0x0});});});}function updateTzVoiceQueues(_0x1612f7){return new Promise(function(_0x2f8030,_0x99cee7){var _0x39e6eb=squel[_0xc544('0x11')]()['fields']([_0xc544('0x66'),_0xc544('0x67')])['from'](_0xc544('0x68'))[_0xc544('0x13')](_0xc544('0x69'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xc544('0x14')](_0xc544('0x6a')+_0x1612f7);db[_0xc544('0x6b')][_0xc544('0x5d')](_0x39e6eb[_0xc544('0x3e')]())['spread'](function(_0xdf4f03){var _0x4128cf=[];for(var _0x151184=0x0;_0x151184<_0xdf4f03[_0xc544('0x19')];_0x151184++){_0x4128cf['push'](getTimezoneData(_0xdf4f03[_0x151184],tmp_voice_queues));}BPromise[_0xc544('0x1b')](_0x4128cf)[_0xc544('0x18')](function(){_0x2f8030({'val':0x1});});})[_0xc544('0x5e')](function(_0x1947b4){logger[_0xc544('0x5f')](_0x1947b4[_0xc544('0x58')]);_0x2f8030({'val':0x0});});});}function getTimezoneData(_0x8534c7,_0x478232){return new Promise(function(_0x2d4214,_0x222d62){var _0x1e60d4=shared[_0xc544('0x6c')];var _0x2d0ac0=_0x1e60d4[_0x8534c7['dialTimezone']];if(_[_0xc544('0x1d')](_0x2d0ac0)){_0x2d4214({'ret':0x1});}else{var _0x5d4f49=_0x2d0ac0['utcOffset'];var _0x32b07b=squel[_0xc544('0x2c')]()['into'](_0x478232)[_0xc544('0x6d')]('id',_0x8534c7['id'])[_0xc544('0x6d')](_0xc544('0x6e'),_0x5d4f49)[_0xc544('0x6d')](_0xc544('0x6f'),_0x8534c7[_0xc544('0x6f')])[_0xc544('0x3e')]();return db[_0xc544('0x6b')][_0xc544('0x5d')](_0x32b07b)[_0xc544('0x70')](function(_0x416233){_0x2d4214({'ret':0x1});})[_0xc544('0x5e')](function(_0x520d7b){logger[_0xc544('0x5f')](_0x520d7b['message']);_0x222d62({'ret':0x1});});}});}function handleTZQuery(_0x3c5c26){logger['info'](_0x3c5c26);return db[_0xc544('0x6b')][_0xc544('0x5d')](_0x3c5c26)[_0xc544('0x70')](function(_0x1e7b07){})[_0xc544('0x5e')](function(_0x4ebda0){logger[_0xc544('0x5f')](_0x4ebda0['message']);});}function main(_0x4703cf,_0x57af41,_0x5f24c1,_0x206339){logger['info'](_0xc544('0x71'),_0x4703cf,JSON[_0xc544('0x72')](_0x57af41));process[_0xc544('0x73')](_0xc544('0x74'));var _0xf65b13=_0x57af41[_0xc544('0x75')];var _0x49ccf1=_[_0xc544('0x76')](_0xf65b13);var _0x393c61=_0x57af41[_0xc544('0x77')];var _0x2bab6a=path[_0xc544('0x13')](config[_0xc544('0x78')],_0xc544('0x79'),_0x393c61+_0xc544('0x7a'));hasTZ=_[_0xc544('0x51')](_0xf65b13)[_0xc544('0x7b')](_0xc544('0x6f'));var _0x3e6a37=_['keys'](_0xf65b13)['join']();logger[_0xc544('0x5c')](_0xc544('0x7c'),_0x3e6a37);db['ContactItemType'][_0xc544('0x16')]({'raw':!![],'attributes':['id',_0xc544('0x7d')]})[_0xc544('0x18')](function(_0x527a0c){for(var _0x151012=0x0;_0x151012<_0x527a0c['length'];_0x151012++){if(_0x527a0c[_0x151012][_0xc544('0x7d')]in _0xf65b13){contactItemTypes[_0xc544('0x1a')](_0x527a0c[_0x151012]);delete _0x49ccf1[_0x527a0c[_0x151012][_0xc544('0x7d')]];hasAdditionalPhones=!![];}for(var _0x34320d in _0xf65b13){if(_0x527a0c[_0x151012]['name']+_0xc544('0x7e')===_0x34320d){phoneDescriptions[_0xc544('0x1a')]({'itemTypeId':_0x527a0c[_0x151012]['id'],'description':_0x34320d});delete _0x49ccf1[_0x34320d];}}}if(hasAdditionalPhones)_0x49ccf1[_0xc544('0x17')]='';var _0x5ae7c4=_[_0xc544('0x51')](_0x49ccf1)[_0xc544('0x13')]();logger['info']('header',_0x5ae7c4);fs[_0xc544('0x7f')](_0x2bab6a,_0x5ae7c4+'\x0a');Papa[_0xc544('0x80')](fs[_0xc544('0x81')](_0x4703cf),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5eee75,_0x28a5c4){try{for(var _0x12dd13=0x0,_0x240299=[];_0x12dd13<_0x5eee75['data']['length'];_0x12dd13++){stats['rows']+=0x1;if(_0x5eee75['errors'][_0x12dd13]){handleError(_0x5eee75[_0xc544('0x82')][_0x12dd13],_0x5eee75[_0xc544('0x5a')][_0x12dd13]);}else{var _0x1370fd=[];var _0x31a025=[];var _0x2beca8={};for(var _0x4fb889 in _0xf65b13){let _0x188d56=contactItemTypes[_0xc544('0x83')](_0x3aa94d=>_0x3aa94d[_0xc544('0x7d')]===_0x4fb889);let _0x514c9c=contactItemTypes[_0xc544('0x83')](_0x2edee8=>_0x2edee8['name']+_0xc544('0x7e')===_0x4fb889);if(_['isNil'](_0x188d56)&&_['isNil'](_0x514c9c)){if(_0xf65b13[_0xc544('0x84')](_0x4fb889)){if(_0x5eee75[_0xc544('0x82')][_0x12dd13][_0xf65b13[_0x4fb889]]){var _0x34ff34=_[_0xc544('0x85')](_0x5eee75[_0xc544('0x82')][_0x12dd13][_0xf65b13[_0x4fb889]][_0xc544('0x86')](/"/g,'\x27'));switch(_0x4fb889){case'scheduledat':var _0x4e50db=moment(_0x34ff34,_0xc544('0xf'),!![]);if(_0x4e50db[_0xc544('0x87')]()){_0x240299[_0xc544('0x1a')]('\x22'+_0x34ff34+'\x22');}else{_0x1370fd[_0xc544('0x1a')](_0xc544('0x88'));}break;case _0xc544('0x33'):var _0x47742f=parseInt(_0x34ff34);_0x34ff34=_['isNaN'](_0x47742f)||_0x47742f<0x0||_0x47742f>0x4?_0x206339?0x3:0x2:_0x47742f;_0x240299[_0xc544('0x1a')]('\x22'+_0x34ff34+'\x22');break;case _0xc544('0x34'):var _0xce4166=parseInt(_0x34ff34);if(_[_0xc544('0x89')](_0xce4166)&&_[_0xc544('0x7b')](_0x5f24c1,_0xce4166)){_0x240299['push']('\x22'+_0xce4166+'\x22');}else{_0x1370fd[_0xc544('0x1a')](_0xc544('0x8a'));}break;case _0xc544('0x8b'):if(isEmail(_0x34ff34)){_0x240299[_0xc544('0x1a')]('\x22'+_0x34ff34+'\x22');}else{_0x1370fd[_0xc544('0x1a')]('email\x20wrong\x20format');}break;case _0xc544('0x8c'):var _0x343dcd=moment(_0x34ff34,_0xc544('0x8d'),!![]);if(_0x343dcd[_0xc544('0x87')]()){_0x240299[_0xc544('0x1a')]('\x22'+_0x34ff34+'\x22');}else{_0x1370fd[_0xc544('0x1a')](_0xc544('0x8e'));}break;case _0xc544('0x6f'):var _0x4a6666=shared[_0xc544('0x6c')];var _0x298f6e=_0x4a6666[_0x34ff34];if(!_[_0xc544('0x1d')](_0x298f6e)){var _0x10a8d8=_0x298f6e[_0xc544('0x8f')];_0x240299[_0xc544('0x1a')]('\x22'+_0x34ff34+'\x22');_0x240299[_0xc544('0x1a')]('\x22'+_0x10a8d8+'\x22');}break;default:_0x240299[_0xc544('0x1a')]('\x22'+_0x34ff34+'\x22');}}else{switch(_0x4fb889){case'firstName':case _0xc544('0x3f'):_0x1370fd[_0xc544('0x1a')](_0x4fb889+'\x20not\x20specified');break;default:_0x240299[_0xc544('0x1a')]('\x22\x22');}}}}else{var _0x108c99='';if(!_[_0xc544('0x1d')](_0x188d56)){if(!_0x2beca8['hasOwnProperty'](_0x188d56['id'])){if(!_['isNil'](_0x5eee75['data'][_0x12dd13][_0xf65b13[_0x4fb889]])){var _0x34ff34=_[_0xc544('0x85')](_0x5eee75[_0xc544('0x82')][_0x12dd13][_0xf65b13[_0x4fb889]][_0xc544('0x86')](/"/g,'\x27'));var _0x2c96e2=phoneDescriptions['find'](_0x559e8e=>_0x559e8e[_0xc544('0x90')]===_0x188d56['id']);if(!_[_0xc544('0x1d')](_0x2c96e2)){var _0x8f437a=_[_0xc544('0x85')](_0x5eee75[_0xc544('0x82')][_0x12dd13][_0xf65b13[_0x2c96e2['description']]][_0xc544('0x86')](/"/g,'\x27'));if(!_[_0xc544('0x1d')](_0x8f437a))_0x34ff34=_0x34ff34+'§'+_0x8f437a;}if(_0x108c99=='')_0x108c99=_0x34ff34;else _0x108c99+='|'+_0x34ff34;}_0x31a025[_0xc544('0x1a')](_0x188d56['id']+':'+_0x108c99);_0x2beca8[_0x188d56['id']]=0x1;}}}}if(hasAdditionalPhones){_0x240299[_0xc544('0x1a')]('\x22'+_0x31a025['join'](';')+'\x22');}if(_0x1370fd[_0xc544('0x19')]){handleError(_0x5eee75[_0xc544('0x82')][_0x12dd13],{'code':_0xc544('0x91'),'message':_0x1370fd[_0xc544('0x13')]()});}else{fs[_0xc544('0x92')](_0x2bab6a,_0x240299['join']()+'\x0a');}_0x240299=[];}if(!(stats['rows']%0xc8)){socket[_0xc544('0x93')](_0xc544('0x94')+_0x393c61,stats);stats[_0xc544('0x5a')]=[];}}if(stopped){logger[_0xc544('0x5c')](_0xc544('0x95'));_0x28a5c4[_0xc544('0x96')]();}}catch(_0xb16a66){handleError(_0x5eee75[_0xc544('0x82')][_0x12dd13],{'code':_0xc544('0x97'),'message':_0xb16a66[_0xc544('0x58')]});logger[_0xc544('0x5f')](_0xc544('0x98'),_0xb16a66[_0xc544('0x58')]);}},'complete':function(){try{var _0x118aeb=[];var _0x5d9d1b=[];var _0x25ea59='cm_contacts';if(_0x57af41[_0xc544('0x99')]&&_0x57af41['duplicates']['length']){_0x25ea59=_0xc544('0x9a')+_0x393c61;_0x118aeb[_0xc544('0x1a')](_0xc544('0x9b')+_0x25ea59+_0xc544('0x9c'));}tmp_campaigns=_0xc544('0x9d')+_0x393c61;tmp_voice_queues='voice_queues_'+_0x393c61;_0x5d9d1b[_0xc544('0x1a')](_0xc544('0x9b')+tmp_campaigns+_0xc544('0x9e'));_0x5d9d1b[_0xc544('0x1a')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xc544('0x9f')](_0x5d9d1b,handleTZQuery)[_0xc544('0x18')](function(_0x15a86f){updateTzCampaigns(_0x57af41['ListId'])[_0xc544('0x18')](function(_0x36156d){updateTzVoiceQueues(_0x57af41[_0xc544('0x31')])[_0xc544('0x18')](function(_0x441910){if(hasTZ)_0x5ae7c4=_0x5ae7c4['replace'](_0xc544('0x6f'),_0xc544('0xa0'));var _0x1603f8=util['format'](_0xc544('0xa1'),_0x2bab6a,_0x25ea59,_0x5ae7c4,_0x57af41[_0xc544('0x31')],_0x57af41[_0xc544('0x52')]||null,NOW,NOW);if(_[_0xc544('0x1d')](_0xf65b13[_0xc544('0x30')])){_0x1603f8+=',\x20scheduledAt\x20=\x20NOW()';}_0x118aeb[_0xc544('0x1a')](_0x1603f8);if(_0x57af41[_0xc544('0x99')]&&_0x57af41['duplicates']['length']){_0x118aeb[_0xc544('0x1a')](insertCmContact(_0x57af41[_0xc544('0x31')],_0x25ea59,_0x57af41[_0xc544('0x99')],_0xf65b13));_0x118aeb['push'](_0xc544('0xa2')+_0x25ea59+';');}BPromise[_0xc544('0x9f')](_0x118aeb,handleQuery)['then'](function(_0x50604c){BPromise[_0xc544('0x1b')]([handleAdditionalPhones()])['then'](function(){_0x118aeb=[];for(var _0x52b9a9=0x0;_0x52b9a9\x20\x20','root','binding','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','push','all','then','split','filter','CmContactHasItem','findOne','update','create','PHONE','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','priority','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper_black','ListId','createdAt','updatedAt','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','toString','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','errors','code','error','main','stringify','send','start','clone','server/files/tmp','.csv','body','ContactItemType','findAll','name','AdditionalPhones','header','parse','createReadStream','data','rows','find','_description','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','catch','complete','argv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb3f,0xa8));var _0xfeb3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeb3f[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require(_0xfeb3('0x0'));var _=require(_0xfeb3('0x1'));var Papa=require(_0xfeb3('0x2'));var util=require(_0xfeb3('0x3'));var BPromise=require(_0xfeb3('0x4'));var moment=require(_0xfeb3('0x5'));var squel=require(_0xfeb3('0x6'));var Redis=require(_0xfeb3('0x7'));var db=require(_0xfeb3('0x8'))['db'];var config=require(_0xfeb3('0x9'));var logger=require(_0xfeb3('0xa'))(_0xfeb3('0xb'));config[_0xfeb3('0xc')]=_[_0xfeb3('0xd')](config[_0xfeb3('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfeb3('0xe'))(new Redis(config[_0xfeb3('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xfeb3('0xf')](_0xfeb3('0x10'));var tempTableName=_0xfeb3('0x11')+moment()[_0xfeb3('0xf')](_0xfeb3('0x12'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2b9150){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))*$/[_0xfeb3('0x13')](_0x2b9150);}function selectNotIn(_0x5c8ad1,_0x1e9d62,_0x211b73,_0x438541,_0x1838b3){return squel[_0xfeb3('0x14')]()[_0xfeb3('0x15')](_0xfeb3('0x16'))[_0xfeb3('0x17')](_0x438541)['join'](_0x1e9d62,null,_0x1e9d62+_0xfeb3('0x18')+_0x438541+'.'+_0x211b73)[_0xfeb3('0x19')](_0x438541+'.'+_0x211b73+_0xfeb3('0x1a')+_0x5c8ad1+'.'+_0x211b73)[_0xfeb3('0x19')](_0x1e9d62+'.dialCheckDuplicateType\x20IN\x20('+_0x1838b3[_0xfeb3('0x1b')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5afbd1,_0xd96c31){promisesAdditionalPhones=[];promisesContact=[];return db[_0xfeb3('0x1c')][_0xfeb3('0x1d')](_0xfeb3('0x1e')+tempTableName)[_0xfeb3('0x1f')](function(_0x572a86){if(_0x572a86!==null){var _0x320464=[];for(var _0x363a9c=0x0;_0x363a9c<_0x572a86[_0xfeb3('0x20')];_0x363a9c++){var _0x4fe242=_0x572a86[_0x363a9c];if(!_['isNil'](_0x4fe242['phone'])){if(!_[_0xfeb3('0x21')](_0x4fe242['AdditionalPhones']))_0x320464[_0xfeb3('0x22')](insertAdditionalPhones(_0x4fe242));promisesContact[_0xfeb3('0x22')]({'contact':_0x4fe242});}}}Promise[_0xfeb3('0x23')](_0x320464)[_0xfeb3('0x24')](function(){_0x5afbd1({'val':0x1});});})['catch'](function(_0x338c37){logger['error'](_0x338c37['message']);});});}function insertAdditionalPhones(_0x4d48a2){return new Promise(function(_0x3c714b,_0xd684e1){var _0x3bedfa=_0x4d48a2['AdditionalPhones'];if(_[_0xfeb3('0x21')](_0x3bedfa))_0xd684e1({'val':0x0});else{var _0x2d77a3=_0x3bedfa[_0xfeb3('0x25')](';');var _0x43a21f=[];orderBy=0x0;for(var _0x8b1cc1=0x0;_0x8b1cc1<_0x2d77a3[_0xfeb3('0x20')];_0x8b1cc1++){_0x43a21f[_0xfeb3('0x22')](splitAdditionalPhone(_0x4d48a2['id'],_0x2d77a3[_0x8b1cc1]));}Promise[_0xfeb3('0x23')](_0x43a21f)['then'](function(){_0x3c714b({'val':_0x2d77a3[_0xfeb3('0x20')]});});}});}function splitAdditionalPhone(_0x460a28,_0x9580ae){return new Promise(function(_0x2b4fa1,_0x133e2a){var _0x17b5f4=_0x9580ae[_0xfeb3('0x25')](':');var _0x5ed5ec=_0x17b5f4[0x0];var _0x44b140=_0x17b5f4[0x1];if(_0x44b140!==''){var _0x5d6b65=_0x44b140[_0xfeb3('0x25')]('|');var _0x205e0c=[];for(var _0x53192b=0x0;_0x53192b<_0x5d6b65[_0xfeb3('0x20')];_0x53192b++){if(_0x5d6b65[_0x53192b]!==''){var _0x3007b8=_[_0xfeb3('0x26')](promisesAdditionalPhones,{'contactId':_0x460a28,'phone':_0x5d6b65[_0x53192b]});if(_0x3007b8[_0xfeb3('0x20')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x460a28,'contactTypeId':_0x5ed5ec,'phone':_0x5d6b65[_0x53192b],'orderBy':orderBy});}}}_0x2b4fa1({'ok':0x1});}else _0x2b4fa1({'res':0x0});});}function createAdditionalPhone(_0x1d8c33,_0x2c71cd,_0x92fc34,_0x4c3781){var _0x2d0a5d='';var _0x499096='';var _0x437d49=_0x92fc34[_0xfeb3('0x25')]('§');_0x2d0a5d=_0x437d49[0x0];if(_0x437d49[_0xfeb3('0x20')]==0x2)_0x499096=_0x437d49[0x1];return new Promise(function(_0x2fc2f7,_0x388987){return db[_0xfeb3('0x27')][_0xfeb3('0x28')]({'where':{'CmContactId':_0x1d8c33,'item':_0x2d0a5d}})[_0xfeb3('0x24')](function(_0x38cbec){if(_0x38cbec){return db[_0xfeb3('0x27')][_0xfeb3('0x29')]({'ItemTypeId':_0x2c71cd,'description':_0x499096,'OrderBy':_0x4c3781},{'where':{'CmContactId':_0x1d8c33,'item':_0x2d0a5d}})[_0xfeb3('0x24')](function(_0x49947b){_0x2fc2f7({'res':'updated'});});}else{return db[_0xfeb3('0x27')][_0xfeb3('0x2a')]({'CmContactId':_0x1d8c33,'item':_0x2d0a5d,'ItemTypeId':_0x2c71cd,'description':_0x499096,'OrderBy':_0x4c3781,'ItemClass':_0xfeb3('0x2b')})[_0xfeb3('0x24')](function(_0x4ecedb){_0x2fc2f7({'res':'inserted'});});}});});}function updateContact(_0x421ee7){return new Promise(function(_0x1430bb,_0x17f02d){var _0x12b176=_0x421ee7['id'];delete _0x421ee7['id'];return db[_0xfeb3('0x2c')][_0xfeb3('0x29')](_0x421ee7,{'where':{'id':_0x12b176}})[_0xfeb3('0x24')](function(_0x776539){updatedRows+=0x1;return db[_0xfeb3('0x2d')][_0xfeb3('0x29')]({'phone':_0x421ee7[_0xfeb3('0x16')]},{'where':{'ContactId':_0x12b176}})[_0xfeb3('0x24')](function(_0x2539c1){_0x1430bb({'ret':'OK'});});});});}function insertCmHopper(_0x245925,_0x175304,_0x390bc3,_0x2a6115,_0x3500c5){var _0x52bfc6=[_0xfeb3('0x2e'),_0xfeb3('0x2f'),_0xfeb3('0x30'),_0xfeb3('0x31'),_0x175304+'.'+_0x2a6115,_0xfeb3('0x32'),_0xfeb3('0x33'),_0xfeb3('0x34'),'cm_contacts.UserId','\x22'+_0x3500c5+'\x22'];return squel[_0xfeb3('0x35')]()[_0xfeb3('0x36')](_0xfeb3('0x37'))[_0xfeb3('0x38')]([_0xfeb3('0x16'),_0xfeb3('0x39'),_0xfeb3('0x3a'),'ListId',_0x2a6115,'createdAt','updatedAt',_0xfeb3('0x3b'),'UserId',_0xfeb3('0x3c')],squel[_0xfeb3('0x14')]()[_0xfeb3('0x3d')](_0x52bfc6)[_0xfeb3('0x17')](_0x175304)[_0xfeb3('0x1b')](_0xfeb3('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x175304+_0xfeb3('0x3f'))['join'](_0x390bc3,null,_0x390bc3+_0xfeb3('0x18')+_0x175304+'.'+_0x2a6115)[_0xfeb3('0x19')](_0x175304+_0xfeb3('0x40'),_0x245925)[_0xfeb3('0x19')](_0xfeb3('0x41'),NOW)[_0xfeb3('0x19')](_0xfeb3('0x42'),selectNotIn(_0x175304,_0x390bc3,_0x2a6115,_0xfeb3('0x37'),[_0xfeb3('0x43'),_0xfeb3('0x44')]))[_0xfeb3('0x19')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x175304,_0x390bc3,_0x2a6115,_0xfeb3('0x37'),[_0xfeb3('0x43')])))['toString']();}function insertCmHopperBlack(_0x436ffa,_0x5e029f,_0x31de0f,_0x596772){var _0x220cf8=['cm_contacts.phone',_0xfeb3('0x30'),'cm_contacts.ListId',_0x5e029f+'.'+_0x596772,_0xfeb3('0x32'),_0xfeb3('0x33')];return squel['insert']()['into'](_0xfeb3('0x45'))['fromQuery']([_0xfeb3('0x16'),_0xfeb3('0x3a'),_0xfeb3('0x46'),_0x596772,_0xfeb3('0x47'),_0xfeb3('0x48')],squel[_0xfeb3('0x14')]()[_0xfeb3('0x3d')](_0x220cf8)[_0xfeb3('0x17')](_0x5e029f)[_0xfeb3('0x1b')](_0xfeb3('0x3e'),null,_0xfeb3('0x49')+_0x5e029f+_0xfeb3('0x3f'))[_0xfeb3('0x1b')](_0x31de0f,null,_0x31de0f+'.id\x20=\x20'+_0x5e029f+'.'+_0x596772)[_0xfeb3('0x19')](_0x5e029f+'.CmListId\x20=\x20?',_0x436ffa)[_0xfeb3('0x19')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xfeb3('0x19')](_0xfeb3('0x42'),squel[_0xfeb3('0x14')]()[_0xfeb3('0x15')](_0xfeb3('0x16'))['from'](_0xfeb3('0x45'))['where'](_0xfeb3('0x4a'),_0x436ffa)['where'](_0x596772+_0xfeb3('0x4b'),_0x5e029f+'.'+_0x596772)))[_0xfeb3('0x4c')]();}function insertCmHopperAdditionalPhones(_0x3efdc7){var _0x38ad13=['cm_hopper.id',_0xfeb3('0x4d'),_0xfeb3('0x4e'),_0xfeb3('0x4f'),_0xfeb3('0x50')];return squel[_0xfeb3('0x35')]()[_0xfeb3('0x36')](_0xfeb3('0x51'))[_0xfeb3('0x38')]([_0xfeb3('0x52'),_0xfeb3('0x16'),_0xfeb3('0x53'),_0xfeb3('0x47'),'updatedAt'],squel[_0xfeb3('0x14')]()[_0xfeb3('0x3d')](_0x38ad13)[_0xfeb3('0x17')](_0xfeb3('0x37'))[_0xfeb3('0x1b')](_0xfeb3('0x3e'),null,_0xfeb3('0x54'))[_0xfeb3('0x1b')]('cm_contact_has_items',null,_0xfeb3('0x55'))[_0xfeb3('0x19')]('cm_hopper.ListId\x20=\x20?',_0x3efdc7)[_0xfeb3('0x19')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xfeb3('0x4c')]();}function insertCmContact(_0x5d438b,_0xf61925,_0x234bb9,_0x5463ee){var _0x26e086=_[_0xfeb3('0x56')](_[_0xfeb3('0x57')](_0x5463ee),[_0xfeb3('0x46'),_0xfeb3('0x58'),_0xfeb3('0x47'),_0xfeb3('0x48')]);return squel['insert']()[_0xfeb3('0x36')](_0xfeb3('0x3e'))[_0xfeb3('0x38')](_0x26e086,squel[_0xfeb3('0x14')]()['fields'](_0x26e086)['from'](_0xf61925)[_0xfeb3('0x19')]('('+_0x234bb9[_0xfeb3('0x1b')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0xfeb3('0x3d')](_0x234bb9)[_0xfeb3('0x17')]('cm_contacts')[_0xfeb3('0x19')]('ListId\x20=\x20?',_0x5d438b))[_0xfeb3('0x19')](_0xfeb3('0x59'),squel['select']()[_0xfeb3('0x15')](_0xfeb3('0x5a'),_0xfeb3('0x5b'))['from'](_0xf61925)[_0xfeb3('0x5c')](_0x234bb9[_0xfeb3('0x1b')](','))))[_0xfeb3('0x4c')]();}function handleStop(){logger[_0xfeb3('0x5d')](_0xfeb3('0x5e'));stopped=!![];}function handleUncaughtException(_0x1c7929){logger['error'](_0x1c7929[_0xfeb3('0x5f')]);process[_0xfeb3('0x60')](0x1);}function handleError(_0x198243,_0x29b702){stats[_0xfeb3('0x61')]['push']({'name':_0x29b702[_0xfeb3('0x62')],'message':_0x29b702[_0xfeb3('0x5f')],'row':_0x198243});}function handleQuery(_0x37798a){logger['info'](_0x37798a);return db[_0xfeb3('0x1c')][_0xfeb3('0x1d')](_0x37798a)['spread'](function(_0x1791b3){results[_0xfeb3('0x22')](_0x1791b3);})['catch'](function(_0x4c4d24){logger[_0xfeb3('0x63')](_0x4c4d24[_0xfeb3('0x5f')]);});}function main(_0x94f804,_0x40d8fd,_0x323df6,_0x222e5e){logger['info'](_0xfeb3('0x64'),_0x94f804,JSON[_0xfeb3('0x65')](_0x40d8fd));process[_0xfeb3('0x66')](_0xfeb3('0x67'));var _0x314a2f=_0x40d8fd['binding'];var _0x9aef79=_[_0xfeb3('0x68')](_0x314a2f);var _0x1e5535=_0x40d8fd['socket_timestamp'];var _0xbdfa85=path['join'](config['root'],_0xfeb3('0x69'),_0x1e5535+_0xfeb3('0x6a'));logger[_0xfeb3('0x5d')](_0xfeb3('0x6b'),_0x40d8fd);db[_0xfeb3('0x6c')][_0xfeb3('0x6d')]({'raw':!![],'attributes':['id',_0xfeb3('0x6e')]})['then'](function(_0x343a7e){for(var _0x527dfc=0x0;_0x527dfc<_0x343a7e[_0xfeb3('0x20')];_0x527dfc++){if(_0x343a7e[_0x527dfc][_0xfeb3('0x6e')]in _0x314a2f){contactItemTypes['push'](_0x343a7e[_0x527dfc]);delete _0x9aef79[_0x343a7e[_0x527dfc]['name']];hasAdditionalPhones=!![];}for(var _0x2609f7 in _0x314a2f){if(_0x343a7e[_0x527dfc][_0xfeb3('0x6e')]+'_description'===_0x2609f7){phoneDescriptions['push']({'itemTypeId':_0x343a7e[_0x527dfc]['id'],'description':_0x2609f7});delete _0x9aef79[_0x2609f7];}}}if(hasAdditionalPhones)_0x9aef79[_0xfeb3('0x6f')]='';var _0x1cb115=_[_0xfeb3('0x57')](_0x9aef79)[_0xfeb3('0x1b')]();logger['info'](_0xfeb3('0x70'),_0x1cb115);fs['writeFileSync'](_0xbdfa85,_0x1cb115+'\x0a');Papa[_0xfeb3('0x71')](fs[_0xfeb3('0x72')](_0x94f804),{'header':!![],'skipEmptyLines':!![],'step':function(_0x22de92,_0x222b4a){try{for(var _0x98679b=0x0,_0x5e7c57=[];_0x98679b<_0x22de92[_0xfeb3('0x73')][_0xfeb3('0x20')];_0x98679b++){stats[_0xfeb3('0x74')]+=0x1;if(_0x22de92[_0xfeb3('0x61')][_0x98679b]){handleError(_0x22de92[_0xfeb3('0x73')][_0x98679b],_0x22de92[_0xfeb3('0x61')][_0x98679b]);}else{var _0x35e9a9=[];var _0x4de0a3=[];var _0x28e796={};for(var _0x583fb9 in _0x314a2f){let _0x518de3=contactItemTypes['find'](_0x5b9372=>_0x5b9372['name']===_0x583fb9);let _0x389cd0=contactItemTypes[_0xfeb3('0x75')](_0x349c02=>_0x349c02[_0xfeb3('0x6e')]+_0xfeb3('0x76')===_0x583fb9);if(_[_0xfeb3('0x21')](_0x518de3)&&_['isNil'](_0x389cd0)){if(_0x314a2f[_0xfeb3('0x77')](_0x583fb9)){if(_0x22de92[_0xfeb3('0x73')][_0x98679b][_0x314a2f[_0x583fb9]]){var _0x549524=_[_0xfeb3('0x78')](_0x22de92[_0xfeb3('0x73')][_0x98679b][_0x314a2f[_0x583fb9]][_0xfeb3('0x79')](/"/g,'\x27'));switch(_0x583fb9){case _0xfeb3('0x39'):var _0x37a3b2=moment(_0x549524,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x37a3b2['isValid']()){_0x5e7c57[_0xfeb3('0x22')]('\x22'+_0x549524+'\x22');}else{_0x35e9a9[_0xfeb3('0x22')](_0xfeb3('0x7a'));}break;case'priority':var _0x285c22=parseInt(_0x549524);_0x549524=_['isNaN'](_0x285c22)||_0x285c22<0x0||_0x285c22>0x4?_0x222e5e?0x3:0x2:_0x285c22;_0x5e7c57[_0xfeb3('0x22')]('\x22'+_0x549524+'\x22');break;case'UserId':var _0x439d68=parseInt(_0x549524);if(_[_0xfeb3('0x7b')](_0x439d68)&&_['includes'](_0x323df6,_0x439d68)){_0x5e7c57[_0xfeb3('0x22')]('\x22'+_0x439d68+'\x22');}else{_0x35e9a9[_0xfeb3('0x22')](_0xfeb3('0x7c'));}break;case'email':if(isEmail(_0x549524)){_0x5e7c57[_0xfeb3('0x22')]('\x22'+_0x549524+'\x22');}else{_0x35e9a9[_0xfeb3('0x22')]('email\x20wrong\x20format');}break;case _0xfeb3('0x7d'):var _0x5b27a4=moment(_0x549524,_0xfeb3('0x7e'),!![]);if(_0x5b27a4[_0xfeb3('0x7f')]()){_0x5e7c57[_0xfeb3('0x22')]('\x22'+_0x549524+'\x22');}else{_0x35e9a9[_0xfeb3('0x22')](_0xfeb3('0x80'));}break;default:_0x5e7c57[_0xfeb3('0x22')]('\x22'+_0x549524+'\x22');}}else{switch(_0x583fb9){case _0xfeb3('0x81'):case _0xfeb3('0x16'):_0x35e9a9['push'](_0x583fb9+'\x20not\x20specified');break;default:_0x5e7c57[_0xfeb3('0x22')]('\x22\x22');}}}}else{var _0x264afc='';if(!_[_0xfeb3('0x21')](_0x518de3)){if(!_0x28e796['hasOwnProperty'](_0x518de3['id'])){for(var _0x36389a=0x0;_0x36389a<_0x314a2f[_0x583fb9][_0xfeb3('0x20')];_0x36389a++){var _0x549524=_['trim'](_0x22de92[_0xfeb3('0x73')][_0x98679b][_0x314a2f[_0x583fb9][_0x36389a]]['replace'](/"/g,'\x27'));var _0x409aee=phoneDescriptions[_0xfeb3('0x75')](_0x112a60=>_0x112a60[_0xfeb3('0x82')]===_0x518de3['id']);if(!_[_0xfeb3('0x21')](_0x409aee)){var _0xce6dc9=_[_0xfeb3('0x78')](_0x22de92[_0xfeb3('0x73')][_0x98679b][_0x314a2f[_0x409aee[_0xfeb3('0x83')]][0x0]][_0xfeb3('0x79')](/"/g,'\x27'));if(!_[_0xfeb3('0x21')](_0xce6dc9))_0x549524=_0x549524+'§'+_0xce6dc9;}if(_0x264afc=='')_0x264afc=_0x549524;else _0x264afc+='|'+_0x549524;}_0x4de0a3[_0xfeb3('0x22')](_0x518de3['id']+':'+_0x264afc);_0x28e796[_0x518de3['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5e7c57[_0xfeb3('0x22')]('\x22'+_0x4de0a3[_0xfeb3('0x1b')](';')+'\x22');}if(_0x35e9a9['length']){handleError(_0x22de92['data'][_0x98679b],{'code':_0xfeb3('0x84'),'message':_0x35e9a9['join']()});}else{fs[_0xfeb3('0x85')](_0xbdfa85,_0x5e7c57['join']()+'\x0a');}_0x5e7c57=[];}if(!(stats[_0xfeb3('0x74')]%0xc8)){socket[_0xfeb3('0x86')](_0xfeb3('0x87')+_0x1e5535,stats);stats['errors']=[];}}if(stopped){logger[_0xfeb3('0x5d')]('Abort\x20parser');_0x222b4a[_0xfeb3('0x88')]();}}catch(_0x4f892f){handleError(_0x22de92[_0xfeb3('0x73')][_0x98679b],{'code':_0xfeb3('0x89'),'message':_0x4f892f[_0xfeb3('0x5f')]});logger[_0xfeb3('0x63')](_0xfeb3('0x8a'),_0x4f892f[_0xfeb3('0x5f')]);}},'complete':function(){try{var _0x3b9054=[];var _0xb9ee59=tempTableName;_0x3b9054[_0xfeb3('0x22')](_0xfeb3('0x8b')+_0xb9ee59+'\x20LIKE\x20cm_contacts;');logger[_0xfeb3('0x5d')]('CIS\x20len',contactItemTypes[_0xfeb3('0x20')]);var _0x1d426e=util[_0xfeb3('0xf')](_0xfeb3('0x8c'),_0xbdfa85,_0xb9ee59,_0x1cb115,_0x40d8fd[_0xfeb3('0x46')],_0x40d8fd[_0xfeb3('0x58')]||null,NOW,NOW);if(_[_0xfeb3('0x21')](_0x314a2f[_0xfeb3('0x39')])){_0x1d426e+=_0xfeb3('0x8d');}_0x3b9054['push'](_0x1d426e);BPromise[_0xfeb3('0x8e')](_0x3b9054,handleQuery)[_0xfeb3('0x24')](function(_0x5af0b6){BPromise[_0xfeb3('0x23')]([handleAdditionalPhones()])[_0xfeb3('0x24')](function(){_0x3b9054=[];for(var _0x3efb83=0x0;_0x3efb83\x20\x20','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','lodash','bluebird','ioredis','../../../mysqldb','../../../config/environment','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','from','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','error','message','split','all','filter','CmContactHasItem','findOne','then','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','where','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone','cm_hopper_black','updatedAt','.CmListId','.CmListId\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.updatedAt','CmHopperId','cm_hopper','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','exit','errors','catch','main','stringify','send','clone','socket_timestamp','root','server/files/tmp','body','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x6fae,0x15b));var _0xe6fa=function(_0x58445e,_0x5dae0e){_0x58445e=_0x58445e-0x0;var _0x5605a4=_0x6fae[_0x58445e];return _0x5605a4;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xe6fa('0x0'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xe6fa('0x1'));var moment=require('moment');var squel=require('squel');var Redis=require(_0xe6fa('0x2'));var db=require(_0xe6fa('0x3'))['db'];var config=require(_0xe6fa('0x4'));var logger=require('../../../config/logger')(_0xe6fa('0x5'));config[_0xe6fa('0x6')]=_['defaults'](config[_0xe6fa('0x6')],{'host':_0xe6fa('0x7'),'port':0x18eb});var socket=require(_0xe6fa('0x8'))(new Redis(config[_0xe6fa('0x6')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xe6fa('0x9')](_0xe6fa('0xa'));var tempTableName=_0xe6fa('0xb')+moment()[_0xe6fa('0x9')](_0xe6fa('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3eea9f){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'](_0x3eea9f);}function selectNotIn(_0x3bdd57,_0x4535bd,_0x37a6f9,_0x592dd8,_0x1082fb){return squel[_0xe6fa('0xd')]()[_0xe6fa('0xe')](_0xe6fa('0xf'))[_0xe6fa('0x10')](_0x592dd8)['join'](_0x4535bd,null,_0x4535bd+_0xe6fa('0x11')+_0x592dd8+'.'+_0x37a6f9)['where'](_0x592dd8+'.'+_0x37a6f9+_0xe6fa('0x12')+_0x3bdd57+'.'+_0x37a6f9)['where'](_0x4535bd+_0xe6fa('0x13')+_0x1082fb[_0xe6fa('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4f811f,_0x13827d){promisesAdditionalPhones=[];promisesContact=[];return db[_0xe6fa('0x15')][_0xe6fa('0x16')](_0xe6fa('0x17')+tempTableName)[_0xe6fa('0x18')](function(_0x55b749){if(_0x55b749!==null){var _0x3670ce=[];for(var _0x3c88b5=0x0;_0x3c88b5<_0x55b749[_0xe6fa('0x19')];_0x3c88b5++){var _0x2dc570=_0x55b749[_0x3c88b5];if(!_[_0xe6fa('0x1a')](_0x2dc570['phone'])){if(!_['isNil'](_0x2dc570[_0xe6fa('0x1b')]))_0x3670ce['push'](insertAdditionalPhones(_0x2dc570));promisesContact[_0xe6fa('0x1c')]({'contact':_0x2dc570});}}}Promise['all'](_0x3670ce)['then'](function(){_0x4f811f({'val':0x1});});})['catch'](function(_0x6edfdb){logger[_0xe6fa('0x1d')](_0x6edfdb[_0xe6fa('0x1e')]);});});}function insertAdditionalPhones(_0x114406){return new Promise(function(_0x18f3c9,_0x503462){var _0x477e5d=_0x114406['AdditionalPhones'];if(_[_0xe6fa('0x1a')](_0x477e5d))_0x503462({'val':0x0});else{var _0x1f05b0=_0x477e5d[_0xe6fa('0x1f')](';');var _0x444ebf=[];orderBy=0x0;for(var _0x1432cb=0x0;_0x1432cb<_0x1f05b0['length'];_0x1432cb++){_0x444ebf['push'](splitAdditionalPhone(_0x114406['id'],_0x1f05b0[_0x1432cb]));}Promise[_0xe6fa('0x20')](_0x444ebf)['then'](function(){_0x18f3c9({'val':_0x1f05b0[_0xe6fa('0x19')]});});}});}function splitAdditionalPhone(_0x354a46,_0x483225){return new Promise(function(_0x251617,_0x4e9f12){var _0x5634d6=_0x483225[_0xe6fa('0x1f')](':');var _0x2e68ea=_0x5634d6[0x0];var _0x40f509=_0x5634d6[0x1];if(_0x40f509!==''){var _0x280d62=_0x40f509['split']('|');var _0x3bfb57=[];for(var _0xa851e2=0x0;_0xa851e2<_0x280d62[_0xe6fa('0x19')];_0xa851e2++){if(_0x280d62[_0xa851e2]!==''){var _0x41bb99=_[_0xe6fa('0x21')](promisesAdditionalPhones,{'contactId':_0x354a46,'phone':_0x280d62[_0xa851e2]});if(_0x41bb99[_0xe6fa('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0xe6fa('0x1c')]({'contactId':_0x354a46,'contactTypeId':_0x2e68ea,'phone':_0x280d62[_0xa851e2],'orderBy':orderBy});}}}_0x251617({'ok':0x1});}else _0x251617({'res':0x0});});}function createAdditionalPhone(_0x174bd8,_0x54f7a5,_0x6297ed,_0x16e0b7){var _0x555511='';var _0x221fdb='';var _0xe29d3e=_0x6297ed[_0xe6fa('0x1f')]('§');_0x555511=_0xe29d3e[0x0];if(_0xe29d3e[_0xe6fa('0x19')]==0x2)_0x221fdb=_0xe29d3e[0x1];return new Promise(function(_0xf3179a,_0x27ca70){return db[_0xe6fa('0x22')][_0xe6fa('0x23')]({'where':{'CmContactId':_0x174bd8,'item':_0x555511}})[_0xe6fa('0x24')](function(_0x12a849){if(_0x12a849){return db[_0xe6fa('0x22')][_0xe6fa('0x25')]({'ItemTypeId':_0x54f7a5,'description':_0x221fdb,'OrderBy':_0x16e0b7},{'where':{'CmContactId':_0x174bd8,'item':_0x555511}})[_0xe6fa('0x24')](function(_0x4eb671){_0xf3179a({'res':_0xe6fa('0x26')});});}else{return db['CmContactHasItem'][_0xe6fa('0x27')]({'CmContactId':_0x174bd8,'item':_0x555511,'ItemTypeId':_0x54f7a5,'description':_0x221fdb,'OrderBy':_0x16e0b7,'ItemClass':_0xe6fa('0x28')})[_0xe6fa('0x24')](function(_0x4e8bc7){_0xf3179a({'res':_0xe6fa('0x29')});});}});});}function updateContact(_0x50838b){return new Promise(function(_0xdd2c4c,_0x45ae6b){var _0x564e3c=_0x50838b['id'];delete _0x50838b['id'];return db[_0xe6fa('0x2a')][_0xe6fa('0x25')](_0x50838b,{'where':{'id':_0x564e3c}})[_0xe6fa('0x24')](function(_0x18955f){updatedRows+=0x1;return db[_0xe6fa('0x2b')]['update']({'phone':_0x50838b[_0xe6fa('0xf')]},{'where':{'ContactId':_0x564e3c}})[_0xe6fa('0x24')](function(_0x800f3a){_0xdd2c4c({'ret':'OK'});});});});}function insertCmHopper(_0x323bd3,_0xefa3c8,_0x121e7c,_0x53a7ba,_0x4de349){var _0xe2f43a=['cm_contacts.phone',_0xe6fa('0x2c'),_0xe6fa('0x2d'),_0xe6fa('0x2e'),_0xefa3c8+'.'+_0x53a7ba,_0xe6fa('0x2f'),_0xe6fa('0x30'),_0xe6fa('0x31'),_0xe6fa('0x32'),'\x22'+_0x4de349+'\x22'];return squel[_0xe6fa('0x33')]()[_0xe6fa('0x34')]('cm_hopper')[_0xe6fa('0x35')]([_0xe6fa('0xf'),_0xe6fa('0x36'),_0xe6fa('0x37'),_0xe6fa('0x38'),_0x53a7ba,_0xe6fa('0x39'),'updatedAt','priority',_0xe6fa('0x3a'),_0xe6fa('0x3b')],squel[_0xe6fa('0xd')]()[_0xe6fa('0x3c')](_0xe2f43a)[_0xe6fa('0x10')](_0xefa3c8)[_0xe6fa('0x14')](_0xe6fa('0x3d'),null,_0xe6fa('0x3e')+_0xefa3c8+'.CmListId')[_0xe6fa('0x14')](_0x121e7c,null,_0x121e7c+_0xe6fa('0x11')+_0xefa3c8+'.'+_0x53a7ba)[_0xe6fa('0x3f')](_0xefa3c8+'.CmListId\x20=\x20?',_0x323bd3)['where'](_0xe6fa('0x40'),NOW)[_0xe6fa('0x3f')](_0xe6fa('0x41'),selectNotIn(_0xefa3c8,_0x121e7c,_0x53a7ba,'cm_hopper',[_0xe6fa('0x42'),_0xe6fa('0x43')]))['where'](_0xe6fa('0x41'),selectNotIn(_0xefa3c8,_0x121e7c,_0x53a7ba,'cm_hopper',['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x53f25a,_0x54c992,_0x3e8047,_0x1317db){var _0x2f59dd=[_0xe6fa('0x44'),_0xe6fa('0x2d'),_0xe6fa('0x2e'),_0x54c992+'.'+_0x1317db,'cm_contacts.createdAt',_0xe6fa('0x30')];return squel[_0xe6fa('0x33')]()[_0xe6fa('0x34')](_0xe6fa('0x45'))[_0xe6fa('0x35')](['phone','ContactId',_0xe6fa('0x38'),_0x1317db,_0xe6fa('0x39'),_0xe6fa('0x46')],squel[_0xe6fa('0xd')]()[_0xe6fa('0x3c')](_0x2f59dd)['from'](_0x54c992)['join']('cm_contacts',null,_0xe6fa('0x3e')+_0x54c992+_0xe6fa('0x47'))['join'](_0x3e8047,null,_0x3e8047+'.id\x20=\x20'+_0x54c992+'.'+_0x1317db)['where'](_0x54c992+_0xe6fa('0x48'),_0x53f25a)['where'](_0xe6fa('0x40'),NOW)[_0xe6fa('0x3f')](_0xe6fa('0x41'),squel[_0xe6fa('0xd')]()[_0xe6fa('0xe')]('phone')[_0xe6fa('0x10')](_0xe6fa('0x45'))[_0xe6fa('0x3f')]('ListId\x20=\x20?',_0x53f25a)['where'](_0x1317db+'\x20=\x20?',_0x54c992+'.'+_0x1317db)))[_0xe6fa('0x49')]();}function insertCmHopperAdditionalPhones(_0x3f6473){var _0x486902=[_0xe6fa('0x4a'),_0xe6fa('0x4b'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0xe6fa('0x4c')];return squel[_0xe6fa('0x33')]()[_0xe6fa('0x34')]('cm_hopper_additional_phones')[_0xe6fa('0x35')]([_0xe6fa('0x4d'),_0xe6fa('0xf'),'OrderBy','createdAt',_0xe6fa('0x46')],squel[_0xe6fa('0xd')]()['fields'](_0x486902)[_0xe6fa('0x10')](_0xe6fa('0x4e'))[_0xe6fa('0x14')](_0xe6fa('0x3d'),null,_0xe6fa('0x4f'))[_0xe6fa('0x14')](_0xe6fa('0x50'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xe6fa('0x3f')](_0xe6fa('0x51'),_0x3f6473)['where'](_0xe6fa('0x40'),NOW))['toString']();}function insertCmContact(_0x3b45d7,_0x383fc3,_0x24c9f9,_0x282720){var _0x3b232e=_[_0xe6fa('0x52')](_[_0xe6fa('0x53')](_0x282720),[_0xe6fa('0x38'),'CompanyId','createdAt',_0xe6fa('0x46')]);return squel['insert']()[_0xe6fa('0x34')](_0xe6fa('0x3d'))[_0xe6fa('0x35')](_0x3b232e,squel[_0xe6fa('0xd')]()[_0xe6fa('0x3c')](_0x3b232e)[_0xe6fa('0x10')](_0x383fc3)[_0xe6fa('0x3f')]('('+_0x24c9f9[_0xe6fa('0x14')](',')+_0xe6fa('0x54'),squel['select']()['fields'](_0x24c9f9)[_0xe6fa('0x10')]('cm_contacts')[_0xe6fa('0x3f')](_0xe6fa('0x55'),_0x3b45d7))[_0xe6fa('0x3f')](_0xe6fa('0x56'),squel['select']()[_0xe6fa('0xe')](_0xe6fa('0x57'),_0xe6fa('0x58'))['from'](_0x383fc3)['group'](_0x24c9f9['join'](','))))[_0xe6fa('0x49')]();}function handleStop(){logger[_0xe6fa('0x59')](_0xe6fa('0x5a'));stopped=!![];}function handleUncaughtException(_0x19c076){logger[_0xe6fa('0x1d')](_0x19c076[_0xe6fa('0x1e')]);process[_0xe6fa('0x5b')](0x1);}function handleError(_0x2311c2,_0x504e1d){stats[_0xe6fa('0x5c')][_0xe6fa('0x1c')]({'name':_0x504e1d['code'],'message':_0x504e1d['message'],'row':_0x2311c2});}function handleQuery(_0x273e5b){logger[_0xe6fa('0x59')](_0x273e5b);return db['sequelize'][_0xe6fa('0x16')](_0x273e5b)['spread'](function(_0x47859c){results[_0xe6fa('0x1c')](_0x47859c);})[_0xe6fa('0x5d')](function(_0x28e3af){logger[_0xe6fa('0x1d')](_0x28e3af[_0xe6fa('0x1e')]);});}function main(_0x2b4c86,_0x4cde4a,_0x4a2403,_0x5a114f){logger['info'](_0xe6fa('0x5e'),_0x2b4c86,JSON[_0xe6fa('0x5f')](_0x4cde4a));process[_0xe6fa('0x60')]('start');var _0x3d1edb=_0x4cde4a['binding'];var _0x494b12=_[_0xe6fa('0x61')](_0x3d1edb);var _0x48f390=_0x4cde4a[_0xe6fa('0x62')];var _0xa31e4d=path[_0xe6fa('0x14')](config[_0xe6fa('0x63')],_0xe6fa('0x64'),_0x48f390+'.csv');logger[_0xe6fa('0x59')](_0xe6fa('0x65'),_0x4cde4a);db['ContactItemType'][_0xe6fa('0x66')]({'raw':!![],'attributes':['id','name']})[_0xe6fa('0x24')](function(_0x4d96b9){for(var _0x28a82a=0x0;_0x28a82a<_0x4d96b9['length'];_0x28a82a++){if(_0x4d96b9[_0x28a82a][_0xe6fa('0x67')]in _0x3d1edb){contactItemTypes[_0xe6fa('0x1c')](_0x4d96b9[_0x28a82a]);delete _0x494b12[_0x4d96b9[_0x28a82a][_0xe6fa('0x67')]];hasAdditionalPhones=!![];}for(var _0x57ef30 in _0x3d1edb){if(_0x4d96b9[_0x28a82a][_0xe6fa('0x67')]+_0xe6fa('0x68')===_0x57ef30){phoneDescriptions[_0xe6fa('0x1c')]({'itemTypeId':_0x4d96b9[_0x28a82a]['id'],'description':_0x57ef30});delete _0x494b12[_0x57ef30];}}}if(hasAdditionalPhones)_0x494b12[_0xe6fa('0x1b')]='';var _0x48abb5=_['keys'](_0x494b12)[_0xe6fa('0x14')]();logger[_0xe6fa('0x59')](_0xe6fa('0x69'),_0x48abb5);fs[_0xe6fa('0x6a')](_0xa31e4d,_0x48abb5+'\x0a');Papa[_0xe6fa('0x6b')](fs[_0xe6fa('0x6c')](_0x2b4c86),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2855de,_0x3816fa){try{for(var _0x290dbd=0x0,_0x12017a=[];_0x290dbd<_0x2855de[_0xe6fa('0x6d')]['length'];_0x290dbd++){stats[_0xe6fa('0x6e')]+=0x1;if(_0x2855de[_0xe6fa('0x5c')][_0x290dbd]){handleError(_0x2855de[_0xe6fa('0x6d')][_0x290dbd],_0x2855de[_0xe6fa('0x5c')][_0x290dbd]);}else{var _0x35f6fa=[];var _0x135f87=[];var _0x15f2db={};for(var _0x2e02eb in _0x3d1edb){let _0x51b50c=contactItemTypes[_0xe6fa('0x6f')](_0x53c879=>_0x53c879[_0xe6fa('0x67')]===_0x2e02eb);let _0x4f4ade=contactItemTypes[_0xe6fa('0x6f')](_0x5ddd0d=>_0x5ddd0d[_0xe6fa('0x67')]+'_description'===_0x2e02eb);if(_[_0xe6fa('0x1a')](_0x51b50c)&&_[_0xe6fa('0x1a')](_0x4f4ade)){if(_0x3d1edb[_0xe6fa('0x70')](_0x2e02eb)){if(_0x2855de[_0xe6fa('0x6d')][_0x290dbd][_0x3d1edb[_0x2e02eb]]){var _0x135677=_[_0xe6fa('0x71')](_0x2855de[_0xe6fa('0x6d')][_0x290dbd][_0x3d1edb[_0x2e02eb]]['replace'](/"/g,'\x27'));switch(_0x2e02eb){case'scheduledat':var _0x28dce1=moment(_0x135677,_0xe6fa('0xa'),!![]);if(_0x28dce1['isValid']()){_0x12017a['push']('\x22'+_0x135677+'\x22');}else{_0x35f6fa['push'](_0xe6fa('0x72'));}break;case _0xe6fa('0x73'):var _0x5956de=parseInt(_0x135677);_0x135677=_[_0xe6fa('0x74')](_0x5956de)||_0x5956de<0x0||_0x5956de>0x4?_0x5a114f?0x3:0x2:_0x5956de;_0x12017a['push']('\x22'+_0x135677+'\x22');break;case _0xe6fa('0x3a'):var _0x6dec64=parseInt(_0x135677);if(_[_0xe6fa('0x75')](_0x6dec64)&&_[_0xe6fa('0x76')](_0x4a2403,_0x6dec64)){_0x12017a[_0xe6fa('0x1c')]('\x22'+_0x6dec64+'\x22');}else{_0x35f6fa['push'](_0xe6fa('0x77'));}break;case _0xe6fa('0x78'):if(isEmail(_0x135677)){_0x12017a['push']('\x22'+_0x135677+'\x22');}else{_0x35f6fa[_0xe6fa('0x1c')](_0xe6fa('0x79'));}break;case _0xe6fa('0x7a'):var _0x4ea703=moment(_0x135677,'YYYY-MM-DD',!![]);if(_0x4ea703['isValid']()){_0x12017a[_0xe6fa('0x1c')]('\x22'+_0x135677+'\x22');}else{_0x35f6fa[_0xe6fa('0x1c')](_0xe6fa('0x7b'));}break;default:_0x12017a[_0xe6fa('0x1c')]('\x22'+_0x135677+'\x22');}}else{switch(_0x2e02eb){case _0xe6fa('0x7c'):case _0xe6fa('0xf'):_0x35f6fa['push'](_0x2e02eb+_0xe6fa('0x7d'));break;default:_0x12017a[_0xe6fa('0x1c')]('\x22\x22');}}}}else{var _0x49a7e5='';if(!_[_0xe6fa('0x1a')](_0x51b50c)){if(!_0x15f2db[_0xe6fa('0x70')](_0x51b50c['id'])){for(var _0x24b81d=0x0;_0x24b81d<_0x3d1edb[_0x2e02eb][_0xe6fa('0x19')];_0x24b81d++){var _0x135677=_[_0xe6fa('0x71')](_0x2855de['data'][_0x290dbd][_0x3d1edb[_0x2e02eb][_0x24b81d]][_0xe6fa('0x7e')](/"/g,'\x27'));var _0x3fa848=phoneDescriptions[_0xe6fa('0x6f')](_0x4e4aa8=>_0x4e4aa8[_0xe6fa('0x7f')]===_0x51b50c['id']);if(!_[_0xe6fa('0x1a')](_0x3fa848)){var _0x2645ed=_['trim'](_0x2855de[_0xe6fa('0x6d')][_0x290dbd][_0x3d1edb[_0x3fa848['description']][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xe6fa('0x1a')](_0x2645ed))_0x135677=_0x135677+'§'+_0x2645ed;}if(_0x49a7e5=='')_0x49a7e5=_0x135677;else _0x49a7e5+='|'+_0x135677;}_0x135f87[_0xe6fa('0x1c')](_0x51b50c['id']+':'+_0x49a7e5);_0x15f2db[_0x51b50c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x12017a[_0xe6fa('0x1c')]('\x22'+_0x135f87[_0xe6fa('0x14')](';')+'\x22');}if(_0x35f6fa['length']){handleError(_0x2855de[_0xe6fa('0x6d')][_0x290dbd],{'code':'SystemRow','message':_0x35f6fa[_0xe6fa('0x14')]()});}else{fs[_0xe6fa('0x80')](_0xa31e4d,_0x12017a[_0xe6fa('0x14')]()+'\x0a');}_0x12017a=[];}if(!(stats[_0xe6fa('0x6e')]%0xc8)){socket[_0xe6fa('0x81')](_0xe6fa('0x82')+_0x48f390,stats);stats[_0xe6fa('0x5c')]=[];}}if(stopped){logger[_0xe6fa('0x59')](_0xe6fa('0x83'));_0x3816fa[_0xe6fa('0x84')]();}}catch(_0x3c0de7){handleError(_0x2855de[_0xe6fa('0x6d')][_0x290dbd],{'code':'SystemError','message':_0x3c0de7[_0xe6fa('0x1e')]});logger[_0xe6fa('0x1d')]('step',_0x3c0de7['message']);}},'complete':function(){try{var _0x357ff6=[];var _0x111fcb=tempTableName;_0x357ff6['push'](_0xe6fa('0x85')+_0x111fcb+_0xe6fa('0x86'));logger[_0xe6fa('0x59')](_0xe6fa('0x87'),contactItemTypes['length']);var _0x5ce60c=util[_0xe6fa('0x9')](_0xe6fa('0x88'),_0xa31e4d,_0x111fcb,_0x48abb5,_0x4cde4a[_0xe6fa('0x38')],_0x4cde4a[_0xe6fa('0x89')]||null,NOW,NOW);if(_[_0xe6fa('0x1a')](_0x3d1edb[_0xe6fa('0x36')])){_0x5ce60c+=_0xe6fa('0x8a');}_0x357ff6[_0xe6fa('0x1c')](_0x5ce60c);BPromise['each'](_0x357ff6,handleQuery)[_0xe6fa('0x24')](function(_0x37078a){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x357ff6=[];for(var _0x5530c5=0x0;_0x5530c5\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.to','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','clone','isEmpty','t.id\x20IN\x20?','QueryTypes','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','ui.','left_join','users','length','where','\x20IN\x20?','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','isNumeric','i.id\x20LIKE\x20?','sms','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','value','start','end','unreadMessages','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','map','tags','clause','ids','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','some','compact','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','read','tag','filter','get','capitalize','chat','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','SELECT'];(function(_0x3de5f3,_0x8cbf99){var _0x556e9b=function(_0x424a2b){while(--_0x424a2b){_0x3de5f3['push'](_0x3de5f3['shift']());}};_0x556e9b(++_0x8cbf99);}(_0xdeb1,0xd5));var _0x1deb=function(_0x2cb880,_0x268f4e){_0x2cb880=_0x2cb880-0x0;var _0x4e465a=_0xdeb1[_0x2cb880];return _0x4e465a;};'use strict';var _=require(_0x1deb('0x0'));var squel=require('squel');var as=require(_0x1deb('0x1'));var qs=require(_0x1deb('0x2'));var updateInteraction=require(_0x1deb('0x3'))[_0x1deb('0x4')];var utils=require(_0x1deb('0x5'));var db=require(_0x1deb('0x6'))['db'];function skipInteractionsQuery(_0x37161a,_0x92f63f,_0x5d1d25){var _0x643f25=![];var _0x16b7ec=utils[_0x1deb('0x7')](_0x37161a);if(_0x92f63f[_0x1deb('0x8')]===_0x1deb('0x9')&&!_0x5d1d25[_0x1deb('0xa')]&&!_0x5d1d25[_0x16b7ec]){_0x643f25=!![];}return _0x643f25;}function getTagsQuery(){return squel[_0x1deb('0xb')]()[_0x1deb('0xc')]('id')[_0x1deb('0xc')](_0x1deb('0xd'))['field']('color')[_0x1deb('0xe')](_0x1deb('0xf'));}function getUsersQuery(_0x49afd3,_0x334cd9){var _0x29b5bf=utils[_0x1deb('0x10')](_0x49afd3);var _0x368c24=_0x1deb('0x11')+_0x49afd3+_0x1deb('0x12');var _0x48f69e=squel[_0x1deb('0xb')]()['field'](_0x1deb('0x13'))['field']('u.fullname')[_0x1deb('0xc')](_0x1deb('0x14')+_0x29b5bf)[_0x1deb('0xe')](_0x368c24,'ui')[_0x1deb('0x15')](_0x1deb('0x16'),'u','u.id\x20=\x20ui.UserId');if(_0x334cd9[_0x1deb('0x17')]>0x0){_0x48f69e[_0x1deb('0x18')](_0x1deb('0x14')+_0x29b5bf+_0x1deb('0x19'),_['map'](_0x334cd9,'id'));}return _0x48f69e;}function getInteractionsQuery(_0x410a22){var _0x2d7347=utils[_0x1deb('0x1a')](_0x410a22);var _0x5176c0=utils[_0x1deb('0x7')](_0x410a22);var _0xa6658e=utils[_0x1deb('0x10')](_0x410a22);return squel[_0x1deb('0xb')]()[_0x1deb('0xe')](_0x2d7347[_0x1deb('0x1b')],'i')[_0x1deb('0x15')](_0x1deb('0x1c'),'c',_0x1deb('0x1d'))[_0x1deb('0x15')](_0x1deb('0x16'),'o',_0x1deb('0x1e'))[_0x1deb('0x15')](_0x2d7347[_0x1deb('0x1f')],'a',_0x1deb('0x20')+_0x5176c0)['left_join'](_0x2d7347[_0x1deb('0x21')],'me',_0x1deb('0x22')+_0xa6658e+_0x1deb('0x23'))[_0x1deb('0x15')](_0x2d7347[_0x1deb('0x24')],'it',_0x1deb('0x25')+_0xa6658e+_0x1deb('0x23'))[_0x1deb('0x15')](_0x1deb('0xf'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x432049={'body':squel[_0x1deb('0x26')](),'contact':squel[_0x1deb('0x26')](),'default':squel[_0x1deb('0x26')](),'fields':squel[_0x1deb('0x26')](),'filter':squel[_0x1deb('0x26')](),'read':squel[_0x1deb('0x26')](),'tags':{'clause':squel[_0x1deb('0x26')](),'ids':null},'user':squel[_0x1deb('0x26')]()};return _0x432049;}function parseTagParameter(_0x285096){var _0x4d338f=squel[_0x1deb('0x26')]();if(_0x285096){var _0x12171d=utils[_0x1deb('0x27')](_0x285096);_0x12171d[_0x1deb('0x28')](function(_0x55d49b){_0x4d338f['or'](_0x1deb('0x29'),'%,'+_0x55d49b+',%');});}return _0x4d338f;}function parseReadParameter(_0x1f8dd0){var _0x1e050e='';if(_0x1f8dd0){_0x1e050e=_0x1deb('0x2a');if(_0x1f8dd0==='1'){_0x1e050e=_0x1e050e[_0x1deb('0x2b')]('{OPERATOR}','=');}else{_0x1e050e=_0x1e050e[_0x1deb('0x2b')]('{OPERATOR}','>');}}return _0x1e050e;}function parseSearchFilter(_0x3c532a,_0x2ca980){var _0x11cfa7=squel[_0x1deb('0x26')]();if(_0x2ca980){var _0x17d0b2=_0x2ca980['replace']('\x5c','\x5c\x5c')[_0x1deb('0x2b')](/'/g,'\x27\x27');if(qs[_0x1deb('0x2c')](_0x17d0b2)){_0x11cfa7['or'](_0x1deb('0x2d'),_0x17d0b2+'%');if([_0x1deb('0x2e'),'whatsapp']['includes'](_0x3c532a)){_0x11cfa7['or']('i.phone\x20LIKE\x20?',_0x17d0b2+'%');}else if(_0x3c532a===_0x1deb('0x2f')){_0x11cfa7['or'](_0x1deb('0x30'),_0x17d0b2+'%');}else if(_0x3c532a===_0x1deb('0x31')){_0x11cfa7['or'](_0x1deb('0x32'),_0x17d0b2+'%');}}else if(_0x3c532a===_0x1deb('0x33')&&qs[_0x1deb('0x34')](_0x17d0b2)){_0x11cfa7['or']('c.email\x20LIKE\x20?',_0x17d0b2+'%');}else{if(_0x3c532a==='mail'){_0x11cfa7['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1deb('0x35')](_0x17d0b2,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1deb('0x35')](_0x17d0b2));}else if(_0x3c532a!==_0x1deb('0x2f')){_0x11cfa7['or'](_0x1deb('0x36'),qs[_0x1deb('0x35')](_0x17d0b2));}_0x11cfa7['or'](_0x1deb('0x37'),qs[_0x1deb('0x35')](_0x17d0b2,!![]),null);}}return _0x11cfa7;}function parseAdvancedSearchFilter(_0x56b3aa,_0x6379ac){var _0x93d3fa=getSqlClauses();var _0x5e7c8b=as[_0x1deb('0x38')](_0x56b3aa);var _0x3ca626=_0x5e7c8b[_0x1deb('0x39')];for(var _0x4036ad=0x0;_0x4036ad<_0x5e7c8b[_0x1deb('0x3a')][_0x1deb('0x17')];_0x4036ad++){var _0x271ea7=_0x5e7c8b[_0x1deb('0x3a')][_0x4036ad];var _0x51c723='i';var _0x3a7527=_[_0x1deb('0x3b')](_0x6379ac,['name',_0x271ea7['field']]);if(_0x3a7527){var _0x16cef3=as[_0x1deb('0x3c')](_0x51c723,_0x3a7527[_0x1deb('0x3d')],_0x271ea7);_0x93d3fa['default'][_0x3ca626](_0x16cef3['text'],_0x16cef3[_0x1deb('0x3e')][_0x1deb('0x3f')],_0x16cef3['value'][_0x1deb('0x40')]);}else{switch(_0x271ea7['field']){case _0x1deb('0x41'):var _0x31ab2c=parseReadParameter(_0x271ea7['value']);_0x93d3fa['read'][_0x1deb('0x42')](_0x31ab2c);break;case _0x1deb('0x43'):if(_0x271ea7[_0x1deb('0x44')]===_0x1deb('0x45')){if(_0x271ea7[_0x1deb('0x3e')][_0x1deb('0x46')]('\x20')[_0x1deb('0x17')]>0x1){_0x93d3fa['contact'][_0x3ca626]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1deb('0x35')](_0x271ea7[_0x1deb('0x3e')],!![]),null);}else{var _0x3a487b='%'+_0x271ea7[_0x1deb('0x3e')]+'%';_0x93d3fa[_0x1deb('0x47')][_0x3ca626](_0x1deb('0x48'),_0x3a487b,_0x3a487b,_0x3a487b);}}else{_0x3a7527=_[_0x1deb('0x3b')](_0x6379ac,[_0x1deb('0xd'),_0x1deb('0x49')]);_0x271ea7[_0x1deb('0xc')]=_0x1deb('0x49');_0x16cef3=as['buildExpression'](_0x51c723,_0x3a7527[_0x1deb('0x3d')],_0x271ea7);_0x93d3fa['contact'][_0x3ca626](_0x16cef3[_0x1deb('0x4a')],_0x16cef3['value'][_0x1deb('0x3f')],_0x16cef3[_0x1deb('0x3e')][_0x1deb('0x40')]);}break;case'Tag':var _0x3dbef2=_0x271ea7[_0x1deb('0x3e')][_0x1deb('0x46')](',')[_0x1deb('0x4b')](function(_0x5393cd){return Number(_0x5393cd);});var _0x3b8a83=parseTagParameter(_0x3dbef2);_0x93d3fa[_0x1deb('0x4c')][_0x1deb('0x4d')]['and'](_0x3b8a83);_0x93d3fa[_0x1deb('0x4c')][_0x1deb('0x4e')]=_0x3dbef2;break;case'User':if(_0x271ea7['operator']===_0x1deb('0x45')){_0x93d3fa[_0x1deb('0x4f')][_0x3ca626](_0x1deb('0x50'),'%'+_0x271ea7[_0x1deb('0x3e')]+'%',null);}else{_0x3a7527=_[_0x1deb('0x3b')](_0x6379ac,[_0x1deb('0xd'),'UserId']);_0x271ea7[_0x1deb('0xc')]=_0x1deb('0x51');_0x16cef3=as[_0x1deb('0x3c')](_0x51c723,_0x3a7527[_0x1deb('0x3d')],_0x271ea7);_0x93d3fa['user'][_0x3ca626](_0x16cef3[_0x1deb('0x4a')],_0x16cef3[_0x1deb('0x3e')][_0x1deb('0x3f')],_0x16cef3[_0x1deb('0x3e')][_0x1deb('0x40')]);}break;case _0x1deb('0x52'):case _0x1deb('0x53'):_0x16cef3=as[_0x1deb('0x3c')]('me',null,_0x271ea7);_0x93d3fa[_0x1deb('0x52')][_0x3ca626](_0x16cef3[_0x1deb('0x4a')],_0x16cef3['value'][_0x1deb('0x3f')],_0x16cef3[_0x1deb('0x3e')]['end']);break;}}}return _0x93d3fa;}function parseModelFields(_0x3eed04,_0x1c726a,_0x49db89){var _0x2da725=utils[_0x1deb('0x7')](_0x3eed04);var _0x1bd897=squel['expr']();var _0x47f1f2=_(_0x1c726a)['keys']()[_0x1deb('0x4b')](function(_0x328ddd){return _[_0x1deb('0x54')](_0x49db89,[_0x1deb('0xd'),_0x328ddd])?_0x328ddd:undefined;})[_0x1deb('0x55')]()[_0x1deb('0x3e')]();if(_0x47f1f2['length']>0x0){_0x47f1f2[_0x1deb('0x28')](function(_0x1f9454){if(_0x1f9454===_0x2da725){_0x1bd897[_0x1deb('0x42')]('i.'+_0x2da725+_0x1deb('0x19'),[][_0x1deb('0x56')](_0x1c726a[_0x1f9454]));}else if(_0x1f9454===_0x1deb('0x57')){var _0x287199=JSON['parse'](_0x1c726a[_0x1f9454])[_0x1deb('0x58')];var _0x50993e=JSON['parse'](_0x1c726a[_0x1f9454])[_0x1deb('0x59')];_0x1bd897[_0x1deb('0x42')](_0x1deb('0x5a'),_0x287199,_0x50993e);}else{if(_0x1c726a[_0x1f9454]===_0x1deb('0x5b')){_0x1bd897[_0x1deb('0x42')]('i.'+_0x1f9454+_0x1deb('0x5c'));}else{_0x1bd897[_0x1deb('0x42')]('i.'+_0x1f9454+_0x1deb('0x5d'),_0x1c726a[_0x1f9454]);}}});}return _0x1bd897;}function parseQueryParameters(_0x4d08b5,_0x2e79af,_0x3016c7){var _0x4380e4=getSqlClauses();return Promise[_0x1deb('0x5e')]()[_0x1deb('0x5f')](function(){return parseModelFields(_0x4d08b5,_0x2e79af,_0x3016c7);})[_0x1deb('0x5f')](function(_0x15d9dd){_0x4380e4['fields'][_0x1deb('0x42')](_0x15d9dd);return parseReadParameter(_0x2e79af['read']);})[_0x1deb('0x5f')](function(_0x1356c0){_0x4380e4[_0x1deb('0x60')][_0x1deb('0x42')](_0x1356c0);return parseTagParameter(_0x2e79af[_0x1deb('0x61')]);})['then'](function(_0x2032e7){_0x4380e4[_0x1deb('0x4c')][_0x1deb('0x4d')]['and'](_0x2032e7);return parseSearchFilter(_0x4d08b5,_0x2e79af[_0x1deb('0x62')]);})['then'](function(_0x2d0e3b){_0x4380e4[_0x1deb('0x62')]=_0x2d0e3b;return _0x4380e4;});}function checkAccountsRestrictions(_0x4152d1,_0x2e95e7,_0xd2d130){var _0x19cd9d=utils[_0x1deb('0x7')](_0x4152d1);var _0x86fedd=_0x1deb('0x63')+_[_0x1deb('0x64')](_0x4152d1)+(_0x4152d1===_0x1deb('0x65')?'Websites':'Accounts');var _0x16db1f=squel[_0x1deb('0x26')]();return Promise[_0x1deb('0x5e')]()[_0x1deb('0x5f')](function(){if(_0xd2d130[_0x1deb('0xa')]&&_0x2e95e7[_0x1deb('0x8')]===_0x1deb('0x9')){return _0x2e95e7[_0x86fedd]({'attributes':['id'],'raw':!![]});}})[_0x1deb('0x5f')](function(_0x1acf56){if(_0x1acf56){if(_0x1acf56[_0x1deb('0x17')]===0x0){_0x16db1f[_0x1deb('0x42')]('i.'+_0x19cd9d+_0x1deb('0x5c'));}else{_0x16db1f[_0x1deb('0x42')]('i.'+_0x19cd9d+'\x20IN\x20?',_[_0x1deb('0x4b')](_0x1acf56,'id'));}}else if(!_0xd2d130[_0x19cd9d]){_0x16db1f[_0x1deb('0x42')]('i.'+_0x19cd9d+_0x1deb('0x66'));}})[_0x1deb('0x5f')](function(){return _0x16db1f;});}function getClosedOrderClause(_0x4942ba,_0x3fbcb3){var _0x769aee='';var _0x1778fe=[_0x1deb('0x67'),_0x1deb('0x68'),_0x1deb('0x69')];if(_0x4942ba===_0x1deb('0x33')){_0x1778fe[_0x1deb('0x6a')](_0x1deb('0x6b'));}if(_0x3fbcb3[_0x1deb('0x6c')]==='0'&&_0x4942ba==='mail'){_0x769aee=_0x1deb('0x6b');}else{if(_0x3fbcb3[_0x1deb('0x6c')]==='1'){_0x1778fe[_0x1deb('0x6d')]();}_0x769aee=_0x1deb('0x6e')+_0x1778fe[_0x1deb('0x6f')](',\x20')+')';}return _0x769aee;}function getFilteredInteractions(_0x25480b,_0x56df8f,_0x3421d7,_0x365a74){var _0x2b6131=utils[_0x1deb('0x10')](_0x25480b);var _0x10e1d5=_[_0x1deb('0x64')](_0x25480b)+_0x1deb('0x70');var _0x118ad8=[];var _0x480855=getTagsQuery();var _0xad4f4a={'type':db[_0x1deb('0x71')]['QueryTypes'][_0x1deb('0x72')],'raw':!![]};var _0x113105=[];var _0x2e85f1=[];return db[_0x1deb('0x73')][_0x1deb('0x74')](_0x480855[_0x1deb('0x75')](),_0xad4f4a)['then'](function(_0x1086a9){_0x118ad8=_[_0x1deb('0x76')](_0x1086a9,'id');_0xad4f4a=_[_0x1deb('0x77')](_0xad4f4a,{'model':db[_0x10e1d5],'mapToModel':!![],'nest':!![]});if(_0x3421d7[_0x1deb('0x78')]){_0x365a74[_0x1deb('0x79')]['forEach'](function(_0x574528){_0x56df8f['field']('i.'+_0x574528);});}else{_0x56df8f[_0x1deb('0xc')](_0x1deb('0x7a'),_0x1deb('0x41'));_0x56df8f[_0x1deb('0xc')](_0x1deb('0x7b'),_0x1deb('0x7c'));_0x56df8f['field'](_0x1deb('0x7d'),_0x1deb('0x7e'));if(_0x25480b===_0x1deb('0x33')){_0x56df8f[_0x1deb('0xc')](_0x1deb('0x7f'),'Account.email');_0x56df8f[_0x1deb('0xc')](_0x1deb('0x80'),_0x1deb('0x81'));_0x56df8f[_0x1deb('0xc')](_0x1deb('0x82'));_0x56df8f[_0x1deb('0xc')](_0x1deb('0x83'));_0x56df8f[_0x1deb('0xc')](_0x1deb('0x84'));_0x56df8f[_0x1deb('0xc')](_0x1deb('0x85'));_0x56df8f[_0x1deb('0xc')](_0x1deb('0x86'));_0x56df8f[_0x1deb('0xc')](_0x1deb('0x87'));_0x56df8f[_0x1deb('0xc')](_0x1deb('0x88'));_0x56df8f['field']('i.lastMsgDirection');_0x56df8f['field']('i.subject');_0x56df8f['field'](_0x1deb('0x69'));_0x56df8f[_0x1deb('0xc')](_0x1deb('0x68'));_0x56df8f['field']('i.thirdDisposition');_0x56df8f[_0x1deb('0xc')](_0x1deb('0x6b'));_0x56df8f[_0x1deb('0xc')](_0x1deb('0x89'));_0x56df8f[_0x1deb('0xc')]('i.ContactId');_0x56df8f[_0x1deb('0xc')](_0x1deb('0x8a'));_0x56df8f[_0x1deb('0xc')](_0x1deb('0x8b'));}else if(_0x25480b===_0x1deb('0x31')){_0x56df8f[_0x1deb('0xc')](_0x1deb('0x8c'),_0x1deb('0x81'));}else{_0x56df8f[_0x1deb('0xc')]('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',_0x1deb('0x81'));}if(_0x25480b!==_0x1deb('0x33')){_0x56df8f[_0x1deb('0xc')](_0x1deb('0x8d'));}_0x56df8f[_0x1deb('0xc')](_0x1deb('0x8e'),'Contact.firstName');_0x56df8f[_0x1deb('0xc')](_0x1deb('0x8f'),'Contact.lastName');_0x56df8f[_0x1deb('0xc')](_0x1deb('0x90'),_0x1deb('0x91'));_0x56df8f[_0x1deb('0xc')](_0x1deb('0x92'),'Contact.phone');_0x56df8f[_0x1deb('0xc')](_0x1deb('0x93'),_0x1deb('0x94'));_0x56df8f[_0x1deb('0xc')]('c.fax',_0x1deb('0x95'));_0x56df8f[_0x1deb('0xc')]('o.fullname','Owner.fullname');_0x56df8f['field']('o.internal','Owner.internal');_0x56df8f['field'](_0x1deb('0x96'),_0x1deb('0x97'));}if(_0x365a74[_0x1deb('0x98')]){_0x56df8f['limit'](_0x365a74[_0x1deb('0x98')]);}if(_0x365a74['offset']){_0x56df8f[_0x1deb('0x99')](_0x365a74[_0x1deb('0x99')]);}return db[_0x1deb('0x73')][_0x1deb('0x74')](_0x56df8f['toString'](),_0xad4f4a);})['then'](function(_0x3ead8e){_0x113105=_0x3ead8e;var _0x7260f7=getUsersQuery(_0x25480b,_0x113105);return db[_0x1deb('0x73')][_0x1deb('0x74')](_0x7260f7[_0x1deb('0x75')](),_0xad4f4a);})['then'](function(_0xd6b253){_0x2e85f1=_[_0x1deb('0x9a')](_0xd6b253,_0x2b6131);if(_0x25480b==='mail'){return db[_0x1deb('0x9b')][_0x1deb('0x9c')]({'attributes':[_0x1deb('0x9d')],'raw':!![]});}})[_0x1deb('0x5f')](function(_0x454ed5){var _0x16255b=_0x454ed5?_0x454ed5[_0x1deb('0x9d')]:undefined;var _0x2be5db=_0x113105[_0x1deb('0x4b')](function(_0x2996db){return updateInteraction(_0x2996db,_0x118ad8,_0x2e85f1,_0x16255b);});return Promise[_0x1deb('0x9e')](_0x2be5db);});}function countFilteredInteractions(_0x59d124,_0x583886){var _0x4dd391=_0x59d124[_0x1deb('0x9f')]();_0x4dd391[_0x1deb('0xc')]('COUNT(*)');_0x4dd391[_0x1deb('0xc')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1deb('0x41'));var _0x265513=utils[_0x1deb('0x27')](_0x583886);if(!_[_0x1deb('0xa0')](_0x265513)){_0x4dd391[_0x1deb('0x18')](_0x1deb('0xa1'),_0x265513);}var _0x9e8ede={'type':db['Sequelize'][_0x1deb('0xa2')][_0x1deb('0x72')],'raw':!![]};return db[_0x1deb('0x73')][_0x1deb('0x74')](_0x4dd391['toString'](),_0x9e8ede);}module[_0x1deb('0xa3')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xa0c9=['whatsapp','fax','i.fax\x20LIKE\x20?','openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','find','name','buildExpression','type','default','text','value','end','read','and','Contact','operator','contact','ContactId','start','Tag','split','tags','clause','ids','User','$substring','user','UserId','plainBody','body','keys','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','filter','get','capitalize','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Sequelize','QueryTypes','SELECT','sequelize','query','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.ContactId','i.UserId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','toString','groupBy','Setting','enableEmailPreview','all','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','role','agent','search','select','field','from','tools_tags','getInteractionFK','user_has_','_interactions','u.fullname','ui.','users','length','\x20IN\x20?','map','getInteractionsTables','getAccountFK','interactions','left_join','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms'];(function(_0x51862f,_0x2bbea0){var _0x2d9b01=function(_0x1a4fcf){while(--_0x1a4fcf){_0x51862f['push'](_0x51862f['shift']());}};_0x2d9b01(++_0x2bbea0);}(_0xa0c9,0x74));var _0x9a0c=function(_0x2abd46,_0x5b3ba5){_0x2abd46=_0x2abd46-0x0;var _0x5c7bef=_0xa0c9[_0x2abd46];return _0x5c7bef;};'use strict';var _=require('lodash');var squel=require(_0x9a0c('0x0'));var as=require(_0x9a0c('0x1'));var qs=require(_0x9a0c('0x2'));var updateInteraction=require(_0x9a0c('0x3'))[_0x9a0c('0x4')];var utils=require(_0x9a0c('0x5'));var db=require(_0x9a0c('0x6'))['db'];function skipInteractionsQuery(_0x5ccb41,_0x5cb43b,_0x379077){var _0x291120=![];var _0x2488bf=utils['getAccountFK'](_0x5ccb41);if(_0x5cb43b[_0x9a0c('0x7')]===_0x9a0c('0x8')&&!_0x379077[_0x9a0c('0x9')]&&!_0x379077[_0x2488bf]){_0x291120=!![];}return _0x291120;}function getTagsQuery(){return squel[_0x9a0c('0xa')]()[_0x9a0c('0xb')]('id')[_0x9a0c('0xb')]('name')[_0x9a0c('0xb')]('color')[_0x9a0c('0xc')](_0x9a0c('0xd'));}function getUsersQuery(_0x571a4d,_0xd5e6d9){var _0x3cdeff=utils[_0x9a0c('0xe')](_0x571a4d);var _0x211aaa=_0x9a0c('0xf')+_0x571a4d+_0x9a0c('0x10');var _0x2fba12=squel[_0x9a0c('0xa')]()['field']('u.id')[_0x9a0c('0xb')](_0x9a0c('0x11'))[_0x9a0c('0xb')](_0x9a0c('0x12')+_0x3cdeff)[_0x9a0c('0xc')](_0x211aaa,'ui')['left_join'](_0x9a0c('0x13'),'u','u.id\x20=\x20ui.UserId');if(_0xd5e6d9[_0x9a0c('0x14')]>0x0){_0x2fba12['where']('ui.'+_0x3cdeff+_0x9a0c('0x15'),_[_0x9a0c('0x16')](_0xd5e6d9,'id'));}return _0x2fba12;}function getInteractionsQuery(_0x1a12f2){var _0x58aeff=utils[_0x9a0c('0x17')](_0x1a12f2);var _0x41f163=utils[_0x9a0c('0x18')](_0x1a12f2);var _0x5d4da2=utils[_0x9a0c('0xe')](_0x1a12f2);return squel[_0x9a0c('0xa')]()['from'](_0x58aeff[_0x9a0c('0x19')],'i')[_0x9a0c('0x1a')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x9a0c('0x1a')](_0x9a0c('0x13'),'o',_0x9a0c('0x1b'))[_0x9a0c('0x1a')](_0x58aeff[_0x9a0c('0x1c')],'a',_0x9a0c('0x1d')+_0x41f163)[_0x9a0c('0x1a')](_0x58aeff['messages'],'me',_0x9a0c('0x1e')+_0x5d4da2+_0x9a0c('0x1f'))[_0x9a0c('0x1a')](_0x58aeff[_0x9a0c('0x20')],'it',_0x9a0c('0x21')+_0x5d4da2+_0x9a0c('0x1f'))[_0x9a0c('0x1a')](_0x9a0c('0xd'),'t',_0x9a0c('0x22'));}function getSqlClauses(){var _0xb2e535={'body':squel[_0x9a0c('0x23')](),'contact':squel[_0x9a0c('0x23')](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel[_0x9a0c('0x23')](),'tags':{'clause':squel[_0x9a0c('0x23')](),'ids':null},'user':squel[_0x9a0c('0x23')]()};return _0xb2e535;}function parseTagParameter(_0xba8674){var _0x4aa1f3=squel[_0x9a0c('0x23')]();if(_0xba8674){var _0x1e875f=utils[_0x9a0c('0x24')](_0xba8674);_0x1e875f[_0x9a0c('0x25')](function(_0x1f1da4){_0x4aa1f3['or'](_0x9a0c('0x26'),'%,'+_0x1f1da4+',%');});}return _0x4aa1f3;}function parseReadParameter(_0x2eeda8){var _0x4104ce='';if(_0x2eeda8){_0x4104ce=_0x9a0c('0x27');if(_0x2eeda8==='1'){_0x4104ce=_0x4104ce[_0x9a0c('0x28')](_0x9a0c('0x29'),'=');}else{_0x4104ce=_0x4104ce[_0x9a0c('0x28')]('{OPERATOR}','>');}}return _0x4104ce;}function parseSearchFilter(_0x1e7b89,_0x2edebd){var _0x539919=squel[_0x9a0c('0x23')]();if(_0x2edebd){var _0x5b6f5a=_0x2edebd[_0x9a0c('0x28')]('\x5c','\x5c\x5c')[_0x9a0c('0x28')](/'/g,'\x27\x27');if(qs[_0x9a0c('0x2a')](_0x5b6f5a)){_0x539919['or'](_0x9a0c('0x2b'),_0x5b6f5a+'%');if([_0x9a0c('0x2c'),_0x9a0c('0x2d')]['includes'](_0x1e7b89)){_0x539919['or']('i.phone\x20LIKE\x20?',_0x5b6f5a+'%');}else if(_0x1e7b89===_0x9a0c('0x2e')){_0x539919['or'](_0x9a0c('0x2f'),_0x5b6f5a+'%');}else if(_0x1e7b89===_0x9a0c('0x30')){_0x539919['or']('i.from\x20LIKE\x20?',_0x5b6f5a+'%');}}else if(_0x1e7b89===_0x9a0c('0x31')&&qs[_0x9a0c('0x32')](_0x5b6f5a)){_0x539919['or'](_0x9a0c('0x33'),_0x5b6f5a+'%');}else{if(_0x1e7b89===_0x9a0c('0x31')){_0x539919['or'](_0x9a0c('0x34'),qs['getFullTextValue'](_0x5b6f5a,!![]))['or'](_0x9a0c('0x35'),qs[_0x9a0c('0x36')](_0x5b6f5a));}else if(_0x1e7b89!==_0x9a0c('0x2e')){_0x539919['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9a0c('0x36')](_0x5b6f5a));}_0x539919['or'](_0x9a0c('0x37'),qs['getFullTextValue'](_0x5b6f5a,!![]),null);}}return _0x539919;}function parseAdvancedSearchFilter(_0x432e8a,_0x336fda){var _0x721719=getSqlClauses();var _0x3406ab=as[_0x9a0c('0x38')](_0x432e8a);var _0x2fdd0f=_0x3406ab['sqlOperator'];for(var _0x1f7434=0x0;_0x1f7434<_0x3406ab[_0x9a0c('0x39')]['length'];_0x1f7434++){var _0x4597b6=_0x3406ab[_0x9a0c('0x39')][_0x1f7434];var _0x5bb7e9='i';var _0x3ec03e=_[_0x9a0c('0x3a')](_0x336fda,[_0x9a0c('0x3b'),_0x4597b6[_0x9a0c('0xb')]]);if(_0x3ec03e){var _0x3255b1=as[_0x9a0c('0x3c')](_0x5bb7e9,_0x3ec03e[_0x9a0c('0x3d')],_0x4597b6);_0x721719[_0x9a0c('0x3e')][_0x2fdd0f](_0x3255b1[_0x9a0c('0x3f')],_0x3255b1['value']['start'],_0x3255b1[_0x9a0c('0x40')][_0x9a0c('0x41')]);}else{switch(_0x4597b6[_0x9a0c('0xb')]){case'unreadMessages':var _0x3d1a5d=parseReadParameter(_0x4597b6[_0x9a0c('0x40')]);_0x721719[_0x9a0c('0x42')][_0x9a0c('0x43')](_0x3d1a5d);break;case _0x9a0c('0x44'):if(_0x4597b6[_0x9a0c('0x45')]==='$substring'){if(_0x4597b6[_0x9a0c('0x40')]['split']('\x20')[_0x9a0c('0x14')]>0x1){_0x721719[_0x9a0c('0x46')][_0x2fdd0f](_0x9a0c('0x37'),qs[_0x9a0c('0x36')](_0x4597b6[_0x9a0c('0x40')],!![]),null);}else{var _0x51ad04='%'+_0x4597b6[_0x9a0c('0x40')]+'%';_0x721719[_0x9a0c('0x46')][_0x2fdd0f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x51ad04,_0x51ad04,_0x51ad04);}}else{_0x3ec03e=_[_0x9a0c('0x3a')](_0x336fda,[_0x9a0c('0x3b'),_0x9a0c('0x47')]);_0x4597b6[_0x9a0c('0xb')]=_0x9a0c('0x47');_0x3255b1=as[_0x9a0c('0x3c')](_0x5bb7e9,_0x3ec03e[_0x9a0c('0x3d')],_0x4597b6);_0x721719[_0x9a0c('0x46')][_0x2fdd0f](_0x3255b1['text'],_0x3255b1[_0x9a0c('0x40')][_0x9a0c('0x48')],_0x3255b1['value']['end']);}break;case _0x9a0c('0x49'):var _0x2d36c8=_0x4597b6[_0x9a0c('0x40')][_0x9a0c('0x4a')](',')['map'](function(_0x180cc8){return Number(_0x180cc8);});var _0x5b88be=parseTagParameter(_0x2d36c8);_0x721719[_0x9a0c('0x4b')][_0x9a0c('0x4c')][_0x9a0c('0x43')](_0x5b88be);_0x721719[_0x9a0c('0x4b')][_0x9a0c('0x4d')]=_0x2d36c8;break;case _0x9a0c('0x4e'):if(_0x4597b6[_0x9a0c('0x45')]===_0x9a0c('0x4f')){_0x721719[_0x9a0c('0x50')][_0x2fdd0f]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4597b6[_0x9a0c('0x40')]+'%',null);}else{_0x3ec03e=_[_0x9a0c('0x3a')](_0x336fda,[_0x9a0c('0x3b'),_0x9a0c('0x51')]);_0x4597b6['field']=_0x9a0c('0x51');_0x3255b1=as[_0x9a0c('0x3c')](_0x5bb7e9,_0x3ec03e[_0x9a0c('0x3d')],_0x4597b6);_0x721719[_0x9a0c('0x50')][_0x2fdd0f](_0x3255b1['text'],_0x3255b1[_0x9a0c('0x40')][_0x9a0c('0x48')],_0x3255b1[_0x9a0c('0x40')][_0x9a0c('0x41')]);}break;case'body':case _0x9a0c('0x52'):_0x3255b1=as[_0x9a0c('0x3c')]('me',null,_0x4597b6);_0x721719[_0x9a0c('0x53')][_0x2fdd0f](_0x3255b1[_0x9a0c('0x3f')],_0x3255b1[_0x9a0c('0x40')][_0x9a0c('0x48')],_0x3255b1[_0x9a0c('0x40')]['end']);break;}}}return _0x721719;}function parseModelFields(_0x21ad92,_0x5b4d47,_0x2e8371){var _0x30604e=utils[_0x9a0c('0x18')](_0x21ad92);var _0xa9d311=squel[_0x9a0c('0x23')]();var _0x4e6f70=_(_0x5b4d47)[_0x9a0c('0x54')]()[_0x9a0c('0x16')](function(_0xf65164){return _['some'](_0x2e8371,[_0x9a0c('0x3b'),_0xf65164])?_0xf65164:undefined;})[_0x9a0c('0x55')]()['value']();if(_0x4e6f70[_0x9a0c('0x14')]>0x0){_0x4e6f70[_0x9a0c('0x25')](function(_0x3a377b){if(_0x3a377b===_0x30604e){_0xa9d311['and']('i.'+_0x30604e+_0x9a0c('0x15'),[][_0x9a0c('0x56')](_0x5b4d47[_0x3a377b]));}else if(_0x3a377b===_0x9a0c('0x57')){var _0x44f041=JSON[_0x9a0c('0x58')](_0x5b4d47[_0x3a377b])[_0x9a0c('0x59')];var _0x499bff=JSON[_0x9a0c('0x58')](_0x5b4d47[_0x3a377b])[_0x9a0c('0x5a')];_0xa9d311[_0x9a0c('0x43')](_0x9a0c('0x5b'),_0x44f041,_0x499bff);}else{if(_0x5b4d47[_0x3a377b]===_0x9a0c('0x5c')){_0xa9d311[_0x9a0c('0x43')]('i.'+_0x3a377b+_0x9a0c('0x5d'));}else{_0xa9d311[_0x9a0c('0x43')]('i.'+_0x3a377b+_0x9a0c('0x5e'),_0x5b4d47[_0x3a377b]);}}});}return _0xa9d311;}function parseQueryParameters(_0x10e820,_0x116d7f,_0x415296){var _0x4b5bfa=getSqlClauses();return Promise[_0x9a0c('0x5f')]()['then'](function(){return parseModelFields(_0x10e820,_0x116d7f,_0x415296);})[_0x9a0c('0x60')](function(_0x358b86){_0x4b5bfa[_0x9a0c('0x61')][_0x9a0c('0x43')](_0x358b86);return parseReadParameter(_0x116d7f[_0x9a0c('0x42')]);})['then'](function(_0x3a7e87){_0x4b5bfa[_0x9a0c('0x42')][_0x9a0c('0x43')](_0x3a7e87);return parseTagParameter(_0x116d7f['tag']);})['then'](function(_0x35dc80){_0x4b5bfa[_0x9a0c('0x4b')][_0x9a0c('0x4c')]['and'](_0x35dc80);return parseSearchFilter(_0x10e820,_0x116d7f[_0x9a0c('0x62')]);})['then'](function(_0x32f3ca){_0x4b5bfa[_0x9a0c('0x62')]=_0x32f3ca;return _0x4b5bfa;});}function checkAccountsRestrictions(_0xb8faeb,_0x2c6481,_0x42d927){var _0xc38189=utils[_0x9a0c('0x18')](_0xb8faeb);var _0x34637d=_0x9a0c('0x63')+_[_0x9a0c('0x64')](_0xb8faeb)+(_0xb8faeb==='chat'?_0x9a0c('0x65'):_0x9a0c('0x66'));var _0xb684c8=squel['expr']();return Promise['resolve']()[_0x9a0c('0x60')](function(){if(_0x42d927['search']&&_0x2c6481[_0x9a0c('0x7')]===_0x9a0c('0x8')){return _0x2c6481[_0x34637d]({'attributes':['id'],'raw':!![]});}})[_0x9a0c('0x60')](function(_0x322b21){if(_0x322b21){if(_0x322b21['length']===0x0){_0xb684c8[_0x9a0c('0x43')]('i.'+_0xc38189+'\x20IS\x20NULL');}else{_0xb684c8[_0x9a0c('0x43')]('i.'+_0xc38189+_0x9a0c('0x15'),_[_0x9a0c('0x16')](_0x322b21,'id'));}}else if(!_0x42d927[_0xc38189]){_0xb684c8['and']('i.'+_0xc38189+_0x9a0c('0x67'));}})['then'](function(){return _0xb684c8;});}function getClosedOrderClause(_0x3df941,_0x3fa070){var _0x3ef940='';var _0x7e6946=[_0x9a0c('0x68'),_0x9a0c('0x69'),_0x9a0c('0x6a')];if(_0x3df941==='mail'){_0x7e6946['unshift'](_0x9a0c('0x6b'));}if(_0x3fa070[_0x9a0c('0x6c')]==='0'&&_0x3df941===_0x9a0c('0x31')){_0x3ef940=_0x9a0c('0x6b');}else{if(_0x3fa070[_0x9a0c('0x6c')]==='1'){_0x7e6946[_0x9a0c('0x6d')]();}_0x3ef940=_0x9a0c('0x6e')+_0x7e6946[_0x9a0c('0x6f')](',\x20')+')';}return _0x3ef940;}function getFilteredInteractions(_0x59813c,_0x5ddebf,_0x23b535,_0xf045b4){var _0x3ef5d3=utils[_0x9a0c('0xe')](_0x59813c);var _0x501b58=_[_0x9a0c('0x64')](_0x59813c)+'Interaction';var _0x4488ce=[];var _0x3f54ce=getTagsQuery();var _0x471ef1={'type':db[_0x9a0c('0x70')][_0x9a0c('0x71')][_0x9a0c('0x72')],'raw':!![]};var _0x2cf25b=[];var _0x2b1a8e=[];return db[_0x9a0c('0x73')][_0x9a0c('0x74')](_0x3f54ce['toString'](),_0x471ef1)['then'](function(_0xeead33){_0x4488ce=_[_0x9a0c('0x75')](_0xeead33,'id');_0x471ef1=_['merge'](_0x471ef1,{'model':db[_0x501b58],'mapToModel':!![],'nest':!![]});if(_0x23b535[_0x9a0c('0x61')]){_0xf045b4['attributes'][_0x9a0c('0x25')](function(_0x5ceadd){_0x5ddebf['field']('i.'+_0x5ceadd);});}else{_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x76'),_0x9a0c('0x77'));_0x5ddebf['field'](_0x9a0c('0x78'),'Account.key');_0x5ddebf[_0x9a0c('0xb')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0x59813c===_0x9a0c('0x31')){_0x5ddebf[_0x9a0c('0xb')]('a.email',_0x9a0c('0x79'));_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x7a'),_0x9a0c('0x7b'));_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x7c'));_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x7d'));_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x7e'));_0x5ddebf['field'](_0x9a0c('0x7f'));_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x80'));_0x5ddebf[_0x9a0c('0xb')]('i.attach');_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x81'));_0x5ddebf['field'](_0x9a0c('0x82'));_0x5ddebf[_0x9a0c('0xb')]('i.subject');_0x5ddebf[_0x9a0c('0xb')]('i.disposition');_0x5ddebf['field'](_0x9a0c('0x69'));_0x5ddebf[_0x9a0c('0xb')]('i.thirdDisposition');_0x5ddebf[_0x9a0c('0xb')]('i.substatus');_0x5ddebf[_0x9a0c('0xb')]('i.to');_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x83'));_0x5ddebf[_0x9a0c('0xb')]('i.MailAccountId');_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x84'));}else if(_0x59813c==='openchannel'){_0x5ddebf[_0x9a0c('0xb')]('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','contactName');}else{_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x85'),_0x9a0c('0x7b'));}if(_0x59813c!==_0x9a0c('0x31')){_0x5ddebf[_0x9a0c('0xb')]('i.*');}_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x86'),_0x9a0c('0x87'));_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x88'),_0x9a0c('0x89'));_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x8a'),_0x9a0c('0x8b'));_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x8c'),_0x9a0c('0x8d'));_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x8e'),_0x9a0c('0x8f'));_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x90'),_0x9a0c('0x91'));_0x5ddebf['field'](_0x9a0c('0x92'),_0x9a0c('0x93'));_0x5ddebf['field'](_0x9a0c('0x94'),_0x9a0c('0x95'));_0x5ddebf[_0x9a0c('0xb')](_0x9a0c('0x96'),'TagIds');}if(_0xf045b4[_0x9a0c('0x97')]){_0x5ddebf['limit'](_0xf045b4[_0x9a0c('0x97')]);}if(_0xf045b4[_0x9a0c('0x98')]){_0x5ddebf['offset'](_0xf045b4[_0x9a0c('0x98')]);}return db[_0x9a0c('0x73')][_0x9a0c('0x74')](_0x5ddebf['toString'](),_0x471ef1);})['then'](function(_0x1e9f2c){_0x2cf25b=_0x1e9f2c;var _0x582f9c=getUsersQuery(_0x59813c,_0x2cf25b);return db[_0x9a0c('0x73')][_0x9a0c('0x74')](_0x582f9c[_0x9a0c('0x99')](),_0x471ef1);})['then'](function(_0x2fd5b5){_0x2b1a8e=_[_0x9a0c('0x9a')](_0x2fd5b5,_0x3ef5d3);if(_0x59813c==='mail'){return db[_0x9a0c('0x9b')]['findOne']({'attributes':[_0x9a0c('0x9c')],'raw':!![]});}})[_0x9a0c('0x60')](function(_0x493975){var _0x1de172=_0x493975?_0x493975[_0x9a0c('0x9c')]:undefined;var _0x51bf1b=_0x2cf25b[_0x9a0c('0x16')](function(_0x3ad00a){return updateInteraction(_0x3ad00a,_0x4488ce,_0x2b1a8e,_0x1de172);});return Promise[_0x9a0c('0x9d')](_0x51bf1b);});}function countFilteredInteractions(_0x568bdf,_0x1e61c3){var _0x1da7c4=_0x568bdf['clone']();_0x1da7c4['field']('COUNT(*)');_0x1da7c4[_0x9a0c('0xb')](_0x9a0c('0x76'),_0x9a0c('0x77'));var _0x572ed5=utils[_0x9a0c('0x24')](_0x1e61c3);if(!_[_0x9a0c('0x9e')](_0x572ed5)){_0x1da7c4['where'](_0x9a0c('0x9f'),_0x572ed5);}var _0x13bb36={'type':db[_0x9a0c('0x70')][_0x9a0c('0x71')]['SELECT'],'raw':!![]};return db[_0x9a0c('0x73')]['query'](_0x1da7c4[_0x9a0c('0x99')](),_0x13bb36);}module[_0x9a0c('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 9933fae..dd7569f 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x45c9=['Tags','TagIds','lodash','../../mysqldb','fullname','split','forEach','push','waiting','unmanaged','closed','disposition','abandoned','UserId','answered','talking','MailMessage','out','plainBody','then','trimStart','catch','Users'];(function(_0x4191af,_0x5783da){var _0x27bebf=function(_0x355be7){while(--_0x355be7){_0x4191af['push'](_0x4191af['shift']());}};_0x27bebf(++_0x5783da);}(_0x45c9,0x1b7));var _0x945c=function(_0x13c0bf,_0x59b9f2){_0x13c0bf=_0x13c0bf-0x0;var _0x3b0e91=_0x45c9[_0x13c0bf];return _0x3b0e91;};'use strict';var _=require(_0x945c('0x0'));var db=require(_0x945c('0x1'))['db'];function getInteractionUsers(_0x1d61de,_0x53f3ea){return new Promise(function(_0x5ad15f,_0x2053fe){try{var _0x53f271=[];if(_0x53f3ea[_0x1d61de]){_0x53f271=_0x53f3ea[_0x1d61de]['map'](function(_0x1b0c09){return{'id':_0x1b0c09['id'],'fullname':_0x1b0c09[_0x945c('0x2')]};});}return _0x5ad15f(_0x53f271);}catch(_0x4ce0af){_0x2053fe(_0x4ce0af);}});}function getInteractionTags(_0x1a8115,_0x2e3d74){var _0x41f486=[];if(_0x1a8115){_0x1a8115[_0x945c('0x3')](',')[_0x945c('0x4')](function(_0x547dcb){_0x41f486[_0x945c('0x5')](_0x2e3d74[_0x547dcb]);});}return _0x41f486;}function updateWaitingCounter(_0x2916d9){if(_0x2916d9['waiting']){_0x2916d9[_0x945c('0x6')]-=0x1;}}function updateInteractionCounters(_0x1f68f2){_0x1f68f2['waiting']=0x0;_0x1f68f2['talking']=0x0;_0x1f68f2['answered']=0x0;_0x1f68f2[_0x945c('0x7')]=0x0;_0x1f68f2['abandoned']=0x0;_0x1f68f2['total']=0x0;if(_0x1f68f2[_0x945c('0x8')]){if(_0x1f68f2[_0x945c('0x9')]===_0x945c('0xa')){_0x1f68f2[_0x945c('0xa')]+=0x1;updateWaitingCounter(_0x1f68f2);}if(_0x1f68f2[_0x945c('0xb')]){_0x1f68f2[_0x945c('0xc')]+=0x1;if(_0x1f68f2[_0x945c('0xd')]){_0x1f68f2[_0x945c('0xd')]-=0x1;}}else{if(_0x1f68f2[_0x945c('0x9')]){_0x1f68f2[_0x945c('0x7')]+=0x1;updateWaitingCounter(_0x1f68f2);}}}else{if(!_0x1f68f2[_0x945c('0xb')]){_0x1f68f2['waiting']+=0x1;}if(_0x1f68f2['UserId']){_0x1f68f2[_0x945c('0xd')]+=0x1;updateWaitingCounter(_0x1f68f2);}}_0x1f68f2['total']+=0x1;return _0x1f68f2;}function getLastMessageText(_0x28e359){return db[_0x945c('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x28e359['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x945c('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x945c('0x10')],'order':'-id','raw':!![]})[_0x945c('0x11')](function(_0x17a23c){if(_0x17a23c&&_0x17a23c[_0x945c('0x10')]){_0x28e359['lastMsgText']=_[_0x945c('0x12')](_0x17a23c[_0x945c('0x10')]);}return _0x28e359;})[_0x945c('0x13')](function(_0x1d9b21){throw _0x1d9b21;});}exports['updateInteraction']=function(_0x33a743,_0x328727,_0x52540f,_0x2fbdac){return new Promise(function(_0x5719d4,_0x3ada25){return getInteractionUsers(_0x33a743['id'],_0x52540f)[_0x945c('0x11')](function(_0x1da218){_0x33a743[_0x945c('0x14')]=_0x1da218;return getInteractionTags(_0x33a743['TagIds'],_0x328727);})['then'](function(_0x34cf8b){_0x33a743[_0x945c('0x15')]=_0x34cf8b;delete _0x33a743[_0x945c('0x16')];return updateInteractionCounters(_0x33a743);})[_0x945c('0x11')](function(_0x9fecb4){if(_0x2fbdac){return getLastMessageText(_0x9fecb4);}else{return _0x9fecb4;}})[_0x945c('0x11')](function(_0x416eb5){_0x5719d4(_0x416eb5);})[_0x945c('0x13')](function(_0x6f11bb){_0x3ada25(_0x6f11bb);});});}; \ No newline at end of file +var _0x307b=['Users','TagIds','catch','lodash','../../mysqldb','fullname','forEach','waiting','answered','unmanaged','abandoned','total','closed','UserId','talking','disposition','findOne','out','plainBody','-id','then','lastMsgText','trimStart'];(function(_0xddc012,_0x5cf07a){var _0x395581=function(_0x483e9d){while(--_0x483e9d){_0xddc012['push'](_0xddc012['shift']());}};_0x395581(++_0x5cf07a);}(_0x307b,0xd2));var _0xb307=function(_0x3c943d,_0xf3b509){_0x3c943d=_0x3c943d-0x0;var _0x5291c2=_0x307b[_0x3c943d];return _0x5291c2;};'use strict';var _=require(_0xb307('0x0'));var db=require(_0xb307('0x1'))['db'];function getInteractionUsers(_0x55bec5,_0x370161){return new Promise(function(_0x239659,_0x52d02f){try{var _0x160fdb=[];if(_0x370161[_0x55bec5]){_0x160fdb=_0x370161[_0x55bec5]['map'](function(_0x1f17e9){return{'id':_0x1f17e9['id'],'fullname':_0x1f17e9[_0xb307('0x2')]};});}return _0x239659(_0x160fdb);}catch(_0x1b52f8){_0x52d02f(_0x1b52f8);}});}function getInteractionTags(_0x551d90,_0x482023){var _0x48147a=[];if(_0x551d90){_0x551d90['split'](',')[_0xb307('0x3')](function(_0x5a97ba){_0x48147a['push'](_0x482023[_0x5a97ba]);});}return _0x48147a;}function updateWaitingCounter(_0x7aa4ba){if(_0x7aa4ba[_0xb307('0x4')]){_0x7aa4ba[_0xb307('0x4')]-=0x1;}}function updateInteractionCounters(_0x42fde4){_0x42fde4['waiting']=0x0;_0x42fde4['talking']=0x0;_0x42fde4[_0xb307('0x5')]=0x0;_0x42fde4[_0xb307('0x6')]=0x0;_0x42fde4[_0xb307('0x7')]=0x0;_0x42fde4[_0xb307('0x8')]=0x0;if(_0x42fde4[_0xb307('0x9')]){if(_0x42fde4['disposition']==='abandoned'){_0x42fde4['abandoned']+=0x1;updateWaitingCounter(_0x42fde4);}if(_0x42fde4[_0xb307('0xa')]){_0x42fde4[_0xb307('0x5')]+=0x1;if(_0x42fde4[_0xb307('0xb')]){_0x42fde4[_0xb307('0xb')]-=0x1;}}else{if(_0x42fde4[_0xb307('0xc')]){_0x42fde4[_0xb307('0x6')]+=0x1;updateWaitingCounter(_0x42fde4);}}}else{if(!_0x42fde4['UserId']){_0x42fde4[_0xb307('0x4')]+=0x1;}if(_0x42fde4[_0xb307('0xa')]){_0x42fde4[_0xb307('0xb')]+=0x1;updateWaitingCounter(_0x42fde4);}}_0x42fde4['total']+=0x1;return _0x42fde4;}function getLastMessageText(_0x3a987c){return db['MailMessage'][_0xb307('0xd')]({'where':{'$and':[{'MailInteractionId':_0x3a987c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb307('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xb307('0xf')],'order':_0xb307('0x10'),'raw':!![]})[_0xb307('0x11')](function(_0x49c7ef){if(_0x49c7ef&&_0x49c7ef[_0xb307('0xf')]){_0x3a987c[_0xb307('0x12')]=_[_0xb307('0x13')](_0x49c7ef['plainBody']);}return _0x3a987c;})['catch'](function(_0x1ef493){throw _0x1ef493;});}exports['updateInteraction']=function(_0x4d2fb7,_0x15bab4,_0x6e5524,_0x22dec4){return new Promise(function(_0x3b0c09,_0x58cbfb){return getInteractionUsers(_0x4d2fb7['id'],_0x6e5524)['then'](function(_0x5877af){_0x4d2fb7[_0xb307('0x14')]=_0x5877af;return getInteractionTags(_0x4d2fb7[_0xb307('0x15')],_0x15bab4);})[_0xb307('0x11')](function(_0x5ed4a6){_0x4d2fb7['Tags']=_0x5ed4a6;delete _0x4d2fb7['TagIds'];return updateInteractionCounters(_0x4d2fb7);})[_0xb307('0x11')](function(_0x31f6d8){if(_0x22dec4){return getLastMessageText(_0x31f6d8);}else{return _0x31f6d8;}})[_0xb307('0x11')](function(_0x50a171){_0x3b0c09(_0x50a171);})[_0xb307('0x16')](function(_0x12fe3e){_0x58cbfb(_0x12fe3e);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index c38d964..1894632 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa139=['../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','name','role','null','Interaction','findOne','then','update','info','catch','error','exports','lodash'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0xa139,0x95));var _0x9a13=function(_0x24eede,_0x1661ff){_0x24eede=_0x24eede-0x0;var _0x447b69=_0xa139[_0x24eede];return _0x447b69;};'use strict';var _=require(_0x9a13('0x0'));var db=require(_0x9a13('0x1'))['db'];var loggers={'openchannel':require(_0x9a13('0x2'))(_0x9a13('0x3')),'mail':require(_0x9a13('0x2'))(_0x9a13('0x4')),'fax':require(_0x9a13('0x2'))('fax-interactions'),'sms':require(_0x9a13('0x2'))(_0x9a13('0x5')),'chat':require(_0x9a13('0x2'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0x9a13('0x6'))};function getAccountFK(_0x2adf62){return _[_0x9a13('0x7')](_0x2adf62)+(_0x2adf62===_0x9a13('0x8')?_0x9a13('0x9'):_0x9a13('0xa'))+'Id';}function getInteractionFK(_0x3a366c){return _[_0x9a13('0x7')](_0x3a366c)+_0x9a13('0xb');}function getInteractionId(_0x48f024,_0x319897,_0x4100c0){if(_0x48f024&&_0x48f024[_[_0x9a13('0xc')](_0x4100c0)+_0x9a13('0xb')]){return _0x48f024[_['upperFirst'](_0x4100c0)+_0x9a13('0xb')];}else if(_0x48f024&&_0x48f024['id']){return _0x48f024['id'];}else if(_0x319897&&_0x319897['id']){return _0x319897['id'];}else{return'unknown';}}function getInteractionsTables(_0xedea08){return{'accounts':_0xedea08+'_'+(_0xedea08==='chat'?'websites':_0x9a13('0xd')),'interactions':_0xedea08+_0x9a13('0xe'),'interactionsTags':_0xedea08+_0x9a13('0xf'),'messages':_0xedea08+_0x9a13('0x10'),'userInteractions':_0x9a13('0x11')+_0xedea08+_0x9a13('0xe')};}function getSelectedTags(_0x1297fc){var _0x18f989=[];if(_0x1297fc){_0x18f989=Array['isArray'](_0x1297fc)?_0x1297fc:[_0x1297fc];}return _0x18f989;}function log(_0x3ef356,_0x51c11e,_0x1f5e4a,_0x181971,_0x44eb29,_0x401159){loggers[_0x44eb29[_0x9a13('0x12')]()][_0x3ef356]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x401159['toUpperCase'](),_0x51c11e?_0x51c11e['id']:null,_0x51c11e?_0x51c11e[_0x9a13('0x13')]:null,_0x51c11e?_0x51c11e[_0x9a13('0x14')]:null,getInteractionId(_0x1f5e4a,_0x181971,_0x44eb29),_0x1f5e4a?JSON['stringify'](_0x1f5e4a):_0x9a13('0x15'));}function updateUser(_0x3b7bde,_0x735f7c,_0x4ba65e,_0x30ae74,_0x459213){db[_[_0x9a13('0xc')](_0x30ae74)+_0x9a13('0x16')][_0x9a13('0x17')]({'where':{'id':getInteractionId(_0x735f7c,_0x4ba65e,_0x30ae74)}})[_0x9a13('0x18')](function(_0x4f4ced){if(_0x4f4ced){return _0x4f4ced[_0x9a13('0x19')]({'UserId':_0x3b7bde?_0x3b7bde['id']:null});}})['then'](function(_0x5f1aa3){if(_0x5f1aa3){log(_0x9a13('0x1a'),_0x3b7bde,_0x735f7c,_0x4ba65e,_0x30ae74,_0x459213);}})[_0x9a13('0x1b')](function(){log(_0x9a13('0x1c'),_0x3b7bde,_0x735f7c,_0x4ba65e,_0x30ae74,_0x459213);});}module[_0x9a13('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x160c=['findOne','then','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','upperFirst','InteractionId','unknown','websites','_interactions','_interaction_has_tags','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','Interaction'];(function(_0x1acc2d,_0x1cfdac){var _0x1cc820=function(_0x4b7492){while(--_0x4b7492){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0x1cc820(++_0x1cfdac);}(_0x160c,0xca));var _0xc160=function(_0x387f13,_0x4d0cb6){_0x387f13=_0x387f13-0x0;var _0x2247d0=_0x160c[_0x387f13];return _0x2247d0;};'use strict';var _=require(_0xc160('0x0'));var db=require(_0xc160('0x1'))['db'];var loggers={'openchannel':require(_0xc160('0x2'))(_0xc160('0x3')),'mail':require(_0xc160('0x2'))(_0xc160('0x4')),'fax':require(_0xc160('0x2'))(_0xc160('0x5')),'sms':require('../../config/logger')(_0xc160('0x6')),'chat':require(_0xc160('0x2'))(_0xc160('0x7')),'whatsapp':require(_0xc160('0x2'))(_0xc160('0x8'))};function getAccountFK(_0x579ad6){return _[_0xc160('0x9')](_0x579ad6)+(_0x579ad6==='chat'?'Website':'Account')+'Id';}function getInteractionFK(_0xe78c10){return _[_0xc160('0x9')](_0xe78c10)+'InteractionId';}function getInteractionId(_0x148c7f,_0x2652ae,_0x1375ff){if(_0x148c7f&&_0x148c7f[_[_0xc160('0xa')](_0x1375ff)+_0xc160('0xb')]){return _0x148c7f[_[_0xc160('0xa')](_0x1375ff)+_0xc160('0xb')];}else if(_0x148c7f&&_0x148c7f['id']){return _0x148c7f['id'];}else if(_0x2652ae&&_0x2652ae['id']){return _0x2652ae['id'];}else{return _0xc160('0xc');}}function getInteractionsTables(_0x225747){return{'accounts':_0x225747+'_'+(_0x225747==='chat'?_0xc160('0xd'):'accounts'),'interactions':_0x225747+_0xc160('0xe'),'interactionsTags':_0x225747+_0xc160('0xf'),'messages':_0x225747+'_messages','userInteractions':'user_has_'+_0x225747+_0xc160('0xe')};}function getSelectedTags(_0x1eafa4){var _0x27645c=[];if(_0x1eafa4){_0x27645c=Array[_0xc160('0x10')](_0x1eafa4)?_0x1eafa4:[_0x1eafa4];}return _0x27645c;}function log(_0x157d79,_0x1cdf15,_0x434ed7,_0x20732a,_0x1cab8d,_0x5a767b){loggers[_0x1cab8d[_0xc160('0x11')]()][_0x157d79](_0xc160('0x12'),_0x5a767b['toUpperCase'](),_0x1cdf15?_0x1cdf15['id']:null,_0x1cdf15?_0x1cdf15['name']:null,_0x1cdf15?_0x1cdf15[_0xc160('0x13')]:null,getInteractionId(_0x434ed7,_0x20732a,_0x1cab8d),_0x434ed7?JSON[_0xc160('0x14')](_0x434ed7):'null');}function updateUser(_0x2a2a11,_0x2a304c,_0x3a83c9,_0xf758e4,_0x20fc29){db[_[_0xc160('0xa')](_0xf758e4)+_0xc160('0x15')][_0xc160('0x16')]({'where':{'id':getInteractionId(_0x2a304c,_0x3a83c9,_0xf758e4)}})[_0xc160('0x17')](function(_0x674a9a){if(_0x674a9a){return _0x674a9a['update']({'UserId':_0x2a2a11?_0x2a2a11['id']:null});}})['then'](function(_0x14d61b){if(_0x14d61b){log(_0xc160('0x18'),_0x2a2a11,_0x2a304c,_0x3a83c9,_0xf758e4,_0x20fc29);}})[_0xc160('0x19')](function(){log(_0xc160('0x1a'),_0x2a2a11,_0x2a304c,_0x3a83c9,_0xf758e4,_0x20fc29);});}module[_0xc160('0x1b')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 5f494e8..1ca0c0b 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 _0x7317=['catch','users','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached'];(function(_0x27c51a,_0xee668e){var _0x438a89=function(_0xd42580){while(--_0xd42580){_0x27c51a['push'](_0x27c51a['shift']());}};_0x438a89(++_0xee668e);}(_0x7317,0x127));var _0x7731=function(_0x43bf33,_0x182bf6){_0x43bf33=_0x43bf33-0x0;var _0x599ae4=_0x7317[_0x43bf33];return _0x599ae4;};'use strict';var crypto=require(_0x7731('0x0'));var util=require(_0x7731('0x1'));var compose=require(_0x7731('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x7731('0x3'));function getValueFromLicense(_0x53c481,_0x50cbc2){if(_0x53c481&&_0x50cbc2){if(_0x50cbc2[_0x7731('0x4')]&&_0x50cbc2[_0x7731('0x5')]){var _0x4c69b4=_0x50cbc2[_0x7731('0x4')];var _0x2fd0ef=_0x50cbc2[_0x7731('0x5')];var _0x42c3eb=_0x4c69b4['split']('-')[0x4];var _0x2e3261=_0x4c69b4['split']('-')[0x0];var _0x505544=crypto[_0x7731('0x6')](_0x7731('0x7'),util[_0x7731('0x8')](_0x7731('0x9'),_0x42c3eb,_0x4c69b4,_0x2e3261));var _0x5465c1=_0x505544[_0x7731('0xa')](_0x2fd0ef,_0x7731('0xb'),_0x7731('0xc'));_0x5465c1+=_0x505544[_0x7731('0xd')](_0x7731('0xc'));var _0x5c8010=JSON[_0x7731('0xe')](_0x5465c1);return _0x5c8010[_0x7731('0xf')](_0x53c481)?_0x5c8010[_0x53c481]:null;}}return null;}function isLimit(_0xb78518,_0x58e419,_0x3c48fb,_0x2f9cc4){var _0x556f4d=_0x58e419;return compose()[_0x7731('0x10')](function(_0x126104,_0x12a678,_0x543374){return db[_0x7731('0x11')][_0x7731('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x7731('0x13')](function(_0x9a0d2e){var _0x38dc6f=getValueFromLicense(_0xb78518,_0x9a0d2e);return _0x38dc6f?_0x38dc6f:_0x556f4d;})['then'](function(_0xfd8fe9){_0x556f4d=_0xfd8fe9;return _0x3c48fb[_0x7731('0x14')](_0x2f9cc4);})[_0x7731('0x13')](function(_0x3e162a){if(_0x3e162a>=_0x556f4d){return _0x12a678[_0x7731('0x15')](0x193)[_0x7731('0x16')]({'message':util[_0x7731('0x8')](_0x7731('0x17'),_0xb78518)});}_0x543374();})[_0x7731('0x18')](function(_0x5e2cb7){_0x543374(_0x5e2cb7);});});}function isUserLimit(){return isLimit(_0x7731('0x19'),0x1,db['User'],{'where':{'$or':[{'role':_0x7731('0x1a')},{'role':_0x7731('0x1b')}]}});}exports[_0x7731('0x1c')]=isUserLimit; \ No newline at end of file +var _0x7d62=['format','%s:%s:%s','final','utf8','parse','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr'];(function(_0x4d911b,_0x511d8e){var _0x364a16=function(_0x1ca972){while(--_0x1ca972){_0x4d911b['push'](_0x4d911b['shift']());}};_0x364a16(++_0x511d8e);}(_0x7d62,0x123));var _0x27d6=function(_0x1d0aee,_0x2c4454){_0x1d0aee=_0x1d0aee-0x0;var _0x34ee2c=_0x7d62[_0x1d0aee];return _0x34ee2c;};'use strict';var crypto=require(_0x27d6('0x0'));var util=require(_0x27d6('0x1'));var compose=require(_0x27d6('0x2'));var db=require(_0x27d6('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5e50f3,_0x41497a){if(_0x5e50f3&&_0x41497a){if(_0x41497a[_0x27d6('0x4')]&&_0x41497a[_0x27d6('0x5')]){var _0x4d3b2b=_0x41497a[_0x27d6('0x4')];var _0x48490d=_0x41497a['license'];var _0xab16b6=_0x4d3b2b[_0x27d6('0x6')]('-')[0x4];var _0x444563=_0x4d3b2b[_0x27d6('0x6')]('-')[0x0];var _0x2b3e77=crypto[_0x27d6('0x7')](_0x27d6('0x8'),util[_0x27d6('0x9')](_0x27d6('0xa'),_0xab16b6,_0x4d3b2b,_0x444563));var _0x51c0b1=_0x2b3e77['update'](_0x48490d,'base64','utf8');_0x51c0b1+=_0x2b3e77[_0x27d6('0xb')](_0x27d6('0xc'));var _0x20624a=JSON[_0x27d6('0xd')](_0x51c0b1);return _0x20624a['hasOwnProperty'](_0x5e50f3)?_0x20624a[_0x5e50f3]:null;}}return null;}function isLimit(_0x193782,_0x3467ba,_0x401e63,_0x356a25){var _0x264e46=_0x3467ba;return compose()[_0x27d6('0xe')](function(_0x573b8f,_0x3e2e05,_0x1091c4){return db[_0x27d6('0xf')][_0x27d6('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x27d6('0x11')](function(_0x3d9810){var _0x4c1b1b=getValueFromLicense(_0x193782,_0x3d9810);return _0x4c1b1b?_0x4c1b1b:_0x264e46;})[_0x27d6('0x11')](function(_0x2398c0){_0x264e46=_0x2398c0;return _0x401e63[_0x27d6('0x12')](_0x356a25);})[_0x27d6('0x11')](function(_0x2e1724){if(_0x2e1724>=_0x264e46){return _0x3e2e05[_0x27d6('0x13')](0x193)[_0x27d6('0x14')]({'message':util[_0x27d6('0x9')](_0x27d6('0x15'),_0x193782)});}_0x1091c4();})['catch'](function(_0x163eb6){_0x1091c4(_0x163eb6);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x27d6('0x16')},{'role':_0x27d6('0x17')}]}});}exports[_0x27d6('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 8ed4ef9..d2799f2 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 _0x109a=['push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','format','hours','minutes','seconds','lodash','moment','parseSearch','[$or]','and','replace','[$and]','length','split','slice','forEach','shift','match','indexOf','map'];(function(_0x135bcd,_0x4c1e2f){var _0x3f56ff=function(_0x5899f2){while(--_0x5899f2){_0x135bcd['push'](_0x135bcd['shift']());}};_0x3f56ff(++_0x4c1e2f);}(_0x109a,0x1e9));var _0xa109=function(_0x503d29,_0x53bb89){_0x503d29=_0x503d29-0x0;var _0x443335=_0x109a[_0x503d29];return _0x443335;};'use strict';var _=require(_0xa109('0x0'));var moment=require(_0xa109('0x1'));exports[_0xa109('0x2')]=function(_0xef51db){var _0x4172a5={'conditions':[]};_0x4172a5['sqlOperator']=_['startsWith'](_0xef51db,_0xa109('0x3'))?'or':_0xa109('0x4');var _0x547a6b=_0xef51db[_0xa109('0x5')](_0xa109('0x6'),'')[_0xa109('0x5')](_0xa109('0x3'),'')['split']('||');for(var _0xa3b31d=0x0;_0xa3b31d<_0x547a6b[_0xa109('0x7')];_0xa3b31d++){var _0xb43cd=_0x547a6b[_0xa3b31d][_0xa109('0x8')](':=');var _0x51c2d0=_0xb43cd[0x0];var _0x3dd31e=_0xb43cd[_0xa109('0x9')](0x1);_0x3dd31e[_0xa109('0xa')](function(_0x9eb2f7){var _0x27991c=_0x9eb2f7[_0xa109('0x8')]('[')[_0xa109('0xb')]();var _0x216c99=_0x9eb2f7[_0xa109('0xc')](/\[(.*?)\]/g);_0x216c99['forEach'](function(_0x56533a){var _0x3fb012=_0x56533a['split']('[')['filter'](function(_0x2f5606){return _0x2f5606[_0xa109('0xd')](']')>-0x1;})[_0xa109('0xe')](function(_0x2e04d1){return _0x2e04d1[_0xa109('0x8')](']')[0x0];})[0x0];_0x4172a5['conditions'][_0xa109('0xf')]({'field':_0x51c2d0,'operator':_0x27991c,'value':_0x3fb012});});});}return _0x4172a5;};exports[_0xa109('0x10')]=function(_0x36106a,_0x247457,_0x49ec32){var _0x203f01={};if(_0x247457===_0xa109('0x11')){if(_0x49ec32[_0xa109('0x12')]===_0xa109('0x13')){_0x49ec32[_0xa109('0x12')]=_0xa109('0x14');_0x49ec32[_0xa109('0x15')]+=','+_0x49ec32[_0xa109('0x15')];}else if(_[_0xa109('0x16')]([_0xa109('0x17'),_0xa109('0x18')],_0x49ec32['operator'])){_0x49ec32[_0xa109('0x15')]=moment(_0x49ec32[_0xa109('0x15')])[_0xa109('0x19')](0x1,'days')['format'](_0xa109('0x1a'));}}if(_0x49ec32['castTo']){_0x247457=_0x49ec32[_0xa109('0x1b')];_0x203f01['text']=_0xa109('0x1c')+_0x36106a+'.'+_0x49ec32[_0xa109('0x1d')]+_0xa109('0x1e')+_0x49ec32[_0xa109('0x1b')]+')\x20'+parseOperator(_0x49ec32[_0xa109('0x12')]);}else{_0x203f01[_0xa109('0x1f')]=_0x36106a+'.'+_0x49ec32[_0xa109('0x1d')]+'\x20'+parseOperator(_0x49ec32[_0xa109('0x12')]);}if(_[_0xa109('0x16')]([_0xa109('0x20'),_0xa109('0x21')],_0x49ec32[_0xa109('0x12')]))_0x203f01[_0xa109('0x1f')]='('+_0x203f01['text']+_0xa109('0x22')+_0x36106a+'.'+_0x49ec32['field']+_0xa109('0x23');_0x203f01[_0xa109('0x15')]=parseValue(_0x247457,_0x49ec32[_0xa109('0x12')],_0x49ec32['value']);return _0x203f01;};function parseOperator(_0x4bdb59){var _0x534589;switch(_0x4bdb59){case _0xa109('0x24'):_0x534589=_0xa109('0x25');break;case _0xa109('0x21'):_0x534589=_0xa109('0x26');break;case _0xa109('0x13'):_0x534589='=\x20?';break;case _0xa109('0x20'):_0x534589=_0xa109('0x27');break;case _0xa109('0x28'):case _0xa109('0x29'):case _0xa109('0x2a'):_0x534589=_0xa109('0x2b');break;case'$lt':_0x534589='<\x20?';break;case _0xa109('0x17'):_0x534589=_0xa109('0x2c');break;case'$lte':_0x534589=_0xa109('0x2d');break;case _0xa109('0x2e'):_0x534589=_0xa109('0x2f');break;case _0xa109('0x14'):_0x534589=_0xa109('0x30');break;}return _0x534589;}function parseValue(_0x4f53c6,_0x2cd499,_0x328e57){var _0x277955={'start':undefined,'end':undefined};switch(_0x2cd499){case _0xa109('0x24'):case _0xa109('0x21'):_0x277955[_0xa109('0x31')]=_0x328e57['split'](',');break;case _0xa109('0x28'):_0x277955[_0xa109('0x31')]='%'+_0x328e57+'%';break;case'$startsWith':_0x277955[_0xa109('0x31')]=_0x328e57+'%';break;case'$endsWith':_0x277955[_0xa109('0x31')]='%'+_0x328e57;break;case _0xa109('0x14'):var _0xc386d5=_0x328e57[_0xa109('0x8')](',');var _0x328e57=_0xc386d5[_0xa109('0xb')]();var _0x4f3724=_0xc386d5[_0xa109('0x32')]();if(_0x4f53c6===_0xa109('0x11')){_0x328e57=moment(_0x328e57)[_0xa109('0x33')](0x0,!![])[_0xa109('0x34')]();_0x4f3724=moment(_0x4f3724)[_0xa109('0x33')](0x0,!![])[_0xa109('0x19')](0x17,_0xa109('0x35'))[_0xa109('0x19')](0x3b,_0xa109('0x36'))[_0xa109('0x19')](0x3b,_0xa109('0x37'))[_0xa109('0x34')]();}_0x277955={'start':_0x328e57,'end':_0x4f3724};break;default:_0x277955[_0xa109('0x31')]=_0x328e57;break;}return _0x277955;} \ No newline at end of file +var _0x6e87=['filter','indexOf','conditions','buildExpression','$eq','operator','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','shift','pop','DATE','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','length','slice','split','match','forEach'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0x6e87,0x1bb));var _0x76e8=function(_0x362e42,_0x1bda75){_0x362e42=_0x362e42-0x0;var _0x49f81a=_0x6e87[_0x362e42];return _0x49f81a;};'use strict';var _=require(_0x76e8('0x0'));var moment=require(_0x76e8('0x1'));exports[_0x76e8('0x2')]=function(_0x52175d){var _0x5e8604={'conditions':[]};_0x5e8604[_0x76e8('0x3')]=_[_0x76e8('0x4')](_0x52175d,_0x76e8('0x5'))?'or':'and';var _0x5df29a=_0x52175d[_0x76e8('0x6')](_0x76e8('0x7'),'')[_0x76e8('0x6')](_0x76e8('0x5'),'')['split']('||');for(var _0x305968=0x0;_0x305968<_0x5df29a[_0x76e8('0x8')];_0x305968++){var _0x1b1dc8=_0x5df29a[_0x305968]['split'](':=');var _0x5470ff=_0x1b1dc8[0x0];var _0x38ac9c=_0x1b1dc8[_0x76e8('0x9')](0x1);_0x38ac9c['forEach'](function(_0x16f1d3){var _0x4d4bdf=_0x16f1d3[_0x76e8('0xa')]('[')['shift']();var _0xd990d3=_0x16f1d3[_0x76e8('0xb')](/\[(.*?)\]/g);_0xd990d3[_0x76e8('0xc')](function(_0x4e6aba){var _0x1b9af0=_0x4e6aba[_0x76e8('0xa')]('[')[_0x76e8('0xd')](function(_0x5dd0a1){return _0x5dd0a1[_0x76e8('0xe')](']')>-0x1;})['map'](function(_0x52a7a1){return _0x52a7a1[_0x76e8('0xa')](']')[0x0];})[0x0];_0x5e8604[_0x76e8('0xf')]['push']({'field':_0x5470ff,'operator':_0x4d4bdf,'value':_0x1b9af0});});});}return _0x5e8604;};exports[_0x76e8('0x10')]=function(_0x1f2fb8,_0x23c55b,_0x500733){var _0x10ac7a={};if(_0x23c55b==='DATE'){if(_0x500733['operator']===_0x76e8('0x11')){_0x500733[_0x76e8('0x12')]=_0x76e8('0x13');_0x500733[_0x76e8('0x14')]+=','+_0x500733['value'];}else if(_['includes']([_0x76e8('0x15'),_0x76e8('0x16')],_0x500733[_0x76e8('0x12')])){_0x500733[_0x76e8('0x14')]=moment(_0x500733[_0x76e8('0x14')])[_0x76e8('0x17')](0x1,_0x76e8('0x18'))[_0x76e8('0x19')](_0x76e8('0x1a'));}}if(_0x500733[_0x76e8('0x1b')]){_0x23c55b=_0x500733[_0x76e8('0x1b')];_0x10ac7a[_0x76e8('0x1c')]=_0x76e8('0x1d')+_0x1f2fb8+'.'+_0x500733['field']+_0x76e8('0x1e')+_0x500733[_0x76e8('0x1b')]+')\x20'+parseOperator(_0x500733[_0x76e8('0x12')]);}else{_0x10ac7a['text']=_0x1f2fb8+'.'+_0x500733[_0x76e8('0x1f')]+'\x20'+parseOperator(_0x500733[_0x76e8('0x12')]);}if(_[_0x76e8('0x20')]([_0x76e8('0x21'),_0x76e8('0x22')],_0x500733[_0x76e8('0x12')]))_0x10ac7a['text']='('+_0x10ac7a['text']+_0x76e8('0x23')+_0x1f2fb8+'.'+_0x500733[_0x76e8('0x1f')]+_0x76e8('0x24');_0x10ac7a[_0x76e8('0x14')]=parseValue(_0x23c55b,_0x500733['operator'],_0x500733['value']);return _0x10ac7a;};function parseOperator(_0x128ec1){var _0xba1e53;switch(_0x128ec1){case _0x76e8('0x25'):_0xba1e53=_0x76e8('0x26');break;case _0x76e8('0x22'):_0xba1e53=_0x76e8('0x27');break;case _0x76e8('0x11'):_0xba1e53=_0x76e8('0x28');break;case'$ne':_0xba1e53=_0x76e8('0x29');break;case _0x76e8('0x2a'):case _0x76e8('0x2b'):case'$endsWith':_0xba1e53=_0x76e8('0x2c');break;case _0x76e8('0x2d'):_0xba1e53=_0x76e8('0x2e');break;case _0x76e8('0x15'):_0xba1e53=_0x76e8('0x2f');break;case _0x76e8('0x16'):_0xba1e53='<=\x20?';break;case'$gte':_0xba1e53='>=\x20?';break;case'$between':_0xba1e53=_0x76e8('0x30');break;}return _0xba1e53;}function parseValue(_0x11094e,_0x405a2f,_0x2649b8){var _0x5635f={'start':undefined,'end':undefined};switch(_0x405a2f){case _0x76e8('0x25'):case _0x76e8('0x22'):_0x5635f[_0x76e8('0x31')]=_0x2649b8[_0x76e8('0xa')](',');break;case _0x76e8('0x2a'):_0x5635f[_0x76e8('0x31')]='%'+_0x2649b8+'%';break;case _0x76e8('0x2b'):_0x5635f[_0x76e8('0x31')]=_0x2649b8+'%';break;case _0x76e8('0x32'):_0x5635f[_0x76e8('0x31')]='%'+_0x2649b8;break;case _0x76e8('0x13'):var _0x58467f=_0x2649b8[_0x76e8('0xa')](',');var _0x2649b8=_0x58467f[_0x76e8('0x33')]();var _0x55f076=_0x58467f[_0x76e8('0x34')]();if(_0x11094e===_0x76e8('0x35')){_0x2649b8=moment(_0x2649b8)[_0x76e8('0x36')](0x0,!![])['format']();_0x55f076=moment(_0x55f076)[_0x76e8('0x36')](0x0,!![])[_0x76e8('0x17')](0x17,_0x76e8('0x37'))[_0x76e8('0x17')](0x3b,'minutes')[_0x76e8('0x17')](0x3b,_0x76e8('0x38'))[_0x76e8('0x19')]();}_0x5635f={'start':_0x2649b8,'end':_0x55f076};break;default:_0x5635f['start']=_0x2649b8;break;}return _0x5635f;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 9d2ad19..144170e 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 _0x052a=['keys','model','alias','raw','split','filters','isEmpty','forOwn','find','DATE','format','YYYY-MM-DD','utc','uniqueid','isArray','offset','map','indexOf','col','priority','unsigned','cast','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','join','getOptions','$id','query','name','attributes','fields','nolimit','limit','sort','where','pick','filter','object','columns','merge','lower','options','include','includeAll','push','sequelize','moment','../../mysqldb','parse','includes'];(function(_0x17798a,_0x5be977){var _0x5b08ac=function(_0x1b22de){while(--_0x1b22de){_0x17798a['push'](_0x17798a['shift']());}};_0x5b08ac(++_0x5be977);}(_0x052a,0x16f));var _0xa052=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x052a[_0x5caf7e];return _0x5c3435;};'use strict';var _=require('lodash');var sequelize=require(_0xa052('0x0'));var moment=require(_0xa052('0x1'));var db=require(_0xa052('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x19d4e6){var _0x348585=['ne'];try{var _0x192c9a=JSON[_0xa052('0x3')](_0x19d4e6);var _0x3d695a=Object['keys'](_0x192c9a)[0x0];return _0x348585[_0xa052('0x4')](_0x3d695a);}catch(_0x174ba5){return![];}}function getOperatorValue(_0x2cddac){var _0x36190b=JSON[_0xa052('0x3')](_0x2cddac);var _0x4daf61=Object[_0xa052('0x5')](_0x36190b)[0x0];var _0x4b0273=_0x36190b[_0x4daf61];return{['$'+_0x4daf61]:_0x4b0273};}function parseIncludeModel(_0x40814b){var _0x19c8ac=JSON[_0xa052('0x3')](_0x40814b);return{'model':db[_0x19c8ac[_0xa052('0x6')]],'as':_0x19c8ac[_0xa052('0x7')],'attributes':_0x19c8ac['fields'],'raw':_0x19c8ac[_0xa052('0x8')]};}exports['fields']=function(_0x185d83){var _0x1bf4c1=null;if(_0x185d83){_0x1bf4c1=_0x185d83[_0xa052('0x9')](',');}return _0x1bf4c1;};exports[_0xa052('0xa')]=function(_0x36b465,_0x2365b4){var _0x4231bd={};if(!_[_0xa052('0xb')](_0x36b465)){_[_0xa052('0xc')](_0x36b465,function(_0x1ef6e3,_0x5a8931){try{if(_0x2365b4){var _0x5438cc=_[_0xa052('0xd')](_0x2365b4,{'name':_0x5a8931})||{};if(hasSequelizeOperator(_0x1ef6e3)){_0x4231bd[_0x5a8931]=getOperatorValue(_0x1ef6e3);}else if(_0x5438cc['type']===_0xa052('0xe')&&_['isPlainObject'](_0x1ef6e3)){var _0x291709=JSON['parse'](_0x1ef6e3);var _0x2387d0={'$gte':moment(moment(_0x291709['$gte'])[_0xa052('0xf')](_0xa052('0x10')))[_0xa052('0x11')]()['format'](),'$lte':moment(moment(_0x291709['$lte'])[_0xa052('0xf')](_0xa052('0x10')))[_0xa052('0x11')]()['subtract'](0x1,'s')[_0xa052('0xf')]()};_0x4231bd[_0x5a8931]=_0x2387d0;}else if(_0x5438cc['name']===_0xa052('0x12')){_0x4231bd[_0x5a8931]=_0x1ef6e3;}else{_0x4231bd[_0x5a8931]=_[_0xa052('0x13')](_0x1ef6e3)?_0x1ef6e3:JSON[_0xa052('0x3')](_0x1ef6e3);}}else{_0x4231bd[_0x5a8931]=_[_0xa052('0x13')](_0x1ef6e3)?_0x1ef6e3:JSON['parse'](_0x1ef6e3);}}catch(_0x371bd2){_0x4231bd[_0x5a8931]=_0x1ef6e3[_0xa052('0x9')](',');}});}return _0x4231bd;};exports['limit']=function(_0x1913ec){_0x1913ec=parseInt(_0x1913ec,0xa);if(!_0x1913ec||_0x1913ec<0x0){_0x1913ec=LIMIT_VALUE;}return _0x1913ec;};exports[_0xa052('0x14')]=function(_0x39b104){_0x39b104=parseInt(_0x39b104,0xa);if(!_0x39b104||_0x39b104<0x0){_0x39b104=0x0;}return _0x39b104;};exports['sort']=function(_0x1ba059){var _0xf03c6d,_0x5d3bea=null;if(_0x1ba059){_0xf03c6d=_0x1ba059[_0xa052('0x9')](',');_0x5d3bea=_[_0xa052('0x15')](_0xf03c6d,function(_0x45a66a){if(_0x45a66a[_0xa052('0x16')]('-')===0x0){return[_0x45a66a==='priority'?sequelize['cast'](sequelize[_0xa052('0x17')](_0xa052('0x18')),_0xa052('0x19')):_0x45a66a['substr'](0x1),'DESC'];}else{return[_0x45a66a===_0xa052('0x18')?sequelize[_0xa052('0x1a')](sequelize[_0xa052('0x17')](_0xa052('0x18')),_0xa052('0x19')):_0x45a66a,_0xa052('0x1b')];}});}return _0x5d3bea;};exports[_0xa052('0x1c')]=function(_0x21cca2,_0x541e4f){if(_[_0xa052('0xb')](_0x21cca2)){return _0x21cca2;}if(_['isArray'](_0x21cca2)){for(var _0x3cc544=0x0;_0x3cc544<_0x21cca2[_0xa052('0x1d')];_0x3cc544+=0x1){_0x21cca2[_0x3cc544]=this['omit'](_0x21cca2[_0x3cc544],_0x541e4f);}return _0x21cca2;}if(!_[_0xa052('0x1e')](_0x21cca2)){return _0x21cca2;}if(_[_0xa052('0x1f')](_0x541e4f)){_0x541e4f=[_0x541e4f];}if(!_[_0xa052('0x13')](_0x541e4f)){return _0x21cca2;}for(var _0x218696=0x0;_0x218696<_0x541e4f['length'];_0x218696+=0x1){_[_0xa052('0x20')](_0x21cca2,_0x541e4f[_0x218696]);}for(var _0x432d8a in _0x21cca2){if(_0x21cca2[_0xa052('0x21')](_0x432d8a)){_0x21cca2[_0x432d8a]=this['omit'](_0x21cca2[_0x432d8a],_0x541e4f);}}return _0x21cca2;};exports[_0xa052('0x22')]=function(_0x57bc66){return _0x57bc66[_0xa052('0x23')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xa052('0x24')]=function(_0x4ddee7){return _0x4ddee7[_0xa052('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0xa052('0x25')]=function(_0x1ee468,_0xb3c08e){var _0x39aff7=[];var _0x1b836e=/[ `!@#$%^&*()_\-?~]/;var _0x1abfbc=_0xb3c08e?_0xa052('0x26'):_0xa052('0x27');_0x1ee468[_0xa052('0x9')](/[ ,]+/)['forEach'](function(_0x45f7a2){_0x45f7a2=_0x45f7a2[_0xa052('0x28')](/([^:]")"+/g,'$1');_0x45f7a2='+'+_0x45f7a2+'*';var _0x6319a1=_0x45f7a2[_0xa052('0x23')](_0x1b836e);if(_0x6319a1){_0x45f7a2='\x22'+_0x45f7a2+'\x22';}_0x39aff7['push'](_0x45f7a2);});_0x1abfbc=_0x1abfbc[_0xa052('0x28')](_0xa052('0x27'),_0x39aff7[_0xa052('0x29')]('\x20'));return _0x1abfbc;};exports[_0xa052('0x2a')]=function(_0x2ce27e,_0x47a332,_0x1622f6){var _0x2471c7={},_0x3a062c={};if(_0x47a332['query'][_0xa052('0x2b')]){_0x47a332[_0xa052('0x2c')]['id']=_0x47a332[_0xa052('0x2c')]['$id'];delete _0x47a332[_0xa052('0x2c')][_0xa052('0x2b')];}_0x2471c7[_0xa052('0x6')]=_[_0xa052('0x15')](_0x2ce27e,_0xa052('0x2d'));_0x2471c7['query']=_[_0xa052('0x5')](_0x47a332[_0xa052('0x2c')]);_0x2471c7[_0xa052('0xa')]=_['intersection'](_0x2471c7[_0xa052('0x6')],_0x2471c7[_0xa052('0x2c')]);_0x3a062c[_0xa052('0x2e')]=_['intersection'](_0x2471c7[_0xa052('0x6')],this[_0xa052('0x2f')](_0x47a332[_0xa052('0x2c')]['fields']));_0x3a062c[_0xa052('0x2e')]=_0x3a062c['attributes'][_0xa052('0x1d')]?_0x3a062c[_0xa052('0x2e')]:_0x2471c7['model'];if(!_0x47a332[_0xa052('0x2c')][_0xa052('0x21')](_0xa052('0x30'))){_0x3a062c[_0xa052('0x31')]=this[_0xa052('0x31')](_0x47a332[_0xa052('0x2c')][_0xa052('0x31')]);_0x3a062c[_0xa052('0x14')]=this[_0xa052('0x14')](_0x47a332['query']['offset']);}_0x3a062c['order']=this['sort'](_0x47a332[_0xa052('0x2c')][_0xa052('0x32')]);_0x3a062c[_0xa052('0x33')]=this['filters'](_[_0xa052('0x34')](_0x47a332[_0xa052('0x2c')],_0x2471c7[_0xa052('0xa')]),_0x2ce27e);if(_0x47a332['query'][_0xa052('0x35')]){var _0xe32945=_0x2ce27e;var _0x4c491e=_0x47a332[_0xa052('0x2c')][_0xa052('0x35')];if(typeof _0x4c491e===_0xa052('0x36')){_0xe32945=_[_0xa052('0x35')](_0x2ce27e,function(_0x40e461){return _[_0xa052('0x4')](_0x4c491e[_0xa052('0x37')],_0x40e461[_0xa052('0x2d')]);});_0x4c491e=_0x4c491e['value'];}_0x3a062c[_0xa052('0x33')]=_[_0xa052('0x38')](_0x3a062c['where'],{'$or':_['map'](_0xe32945,function(_0x2de2bb){if(_0x2de2bb['type']!=='VIRTUAL'){if(_0x1622f6){return sequelize['where'](sequelize['fn'](_0xa052('0x39'),sequelize[_0xa052('0x17')](_0x2de2bb['name'])),{'$like':sequelize['fn'](_0xa052('0x39'),'%'+_0x47a332[_0xa052('0x2c')]['filter']+'%')});}else{var _0x340233={};_0x340233[_0x2de2bb[_0xa052('0x2d')]]={'$like':'%'+_0x47a332['query'][_0xa052('0x35')]+'%'};return _0x340233;}}})});}_0x3a062c=_[_0xa052('0x38')]({},_0x3a062c,_0x47a332[_0xa052('0x3a')]);return _0x3a062c;};exports[_0xa052('0x3b')]=function(_0x527215){var _0xcc6ac7=[];if(_0x527215[_0xa052('0x3c')]){_0xcc6ac7[_0xa052('0x3d')]({'all':!![]});}else if(_0x527215[_0xa052('0x3b')]){if(Array[_0xa052('0x13')](_0x527215[_0xa052('0x3b')])){_0xcc6ac7=Object[_0xa052('0x5')](_0x527215[_0xa052('0x3b')])[_0xa052('0x15')](function(_0x2bf3a6){return parseIncludeModel(_0x527215[_0xa052('0x3b')][_0x2bf3a6]);});}else{var _0x2d65e2=parseIncludeModel(_0x527215[_0xa052('0x3b')]);_0xcc6ac7[_0xa052('0x3d')](_0x2d65e2);}}return _0xcc6ac7;}; \ No newline at end of file +var _0x154f=['push','include','sequelize','../../mysqldb','parse','keys','includes','model','alias','fields','raw','split','filters','isEmpty','forOwn','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','offset','indexOf','priority','cast','col','unsigned','DESC','omit','length','isObject','isString','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','\x22{EXPR}\x22','{EXPR}','forEach','replace','join','getOptions','$id','query','map','intersection','attributes','limit','order','sort','where','pick','filter','object','columns','merge','VIRTUAL','lower','options'];(function(_0x3d2189,_0x1fb57f){var _0x20ad50=function(_0x33b288){while(--_0x33b288){_0x3d2189['push'](_0x3d2189['shift']());}};_0x20ad50(++_0x1fb57f);}(_0x154f,0x82));var _0xf154=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x154f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var sequelize=require(_0xf154('0x0'));var moment=require('moment');var db=require(_0xf154('0x1'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xdc5719){var _0x37df6f=['ne'];try{var _0x4e5e7c=JSON[_0xf154('0x2')](_0xdc5719);var _0x2e74b4=Object[_0xf154('0x3')](_0x4e5e7c)[0x0];return _0x37df6f[_0xf154('0x4')](_0x2e74b4);}catch(_0x301460){return![];}}function getOperatorValue(_0x5c356d){var _0x312043=JSON[_0xf154('0x2')](_0x5c356d);var _0x333300=Object[_0xf154('0x3')](_0x312043)[0x0];var _0x201cfb=_0x312043[_0x333300];return{['$'+_0x333300]:_0x201cfb};}function parseIncludeModel(_0x47cd79){var _0x9c503e=JSON['parse'](_0x47cd79);return{'model':db[_0x9c503e[_0xf154('0x5')]],'as':_0x9c503e[_0xf154('0x6')],'attributes':_0x9c503e[_0xf154('0x7')],'raw':_0x9c503e[_0xf154('0x8')]};}exports[_0xf154('0x7')]=function(_0x2076c0){var _0x280fa6=null;if(_0x2076c0){_0x280fa6=_0x2076c0[_0xf154('0x9')](',');}return _0x280fa6;};exports[_0xf154('0xa')]=function(_0xd60b67,_0x35ea49){var _0x419f05={};if(!_[_0xf154('0xb')](_0xd60b67)){_[_0xf154('0xc')](_0xd60b67,function(_0x1328b3,_0x5c7b4e){try{if(_0x35ea49){var _0x1668eb=_['find'](_0x35ea49,{'name':_0x5c7b4e})||{};if(hasSequelizeOperator(_0x1328b3)){_0x419f05[_0x5c7b4e]=getOperatorValue(_0x1328b3);}else if(_0x1668eb[_0xf154('0xd')]==='DATE'&&_[_0xf154('0xe')](_0x1328b3)){var _0x2cc345=JSON[_0xf154('0x2')](_0x1328b3);var _0x164ed0={'$gte':moment(moment(_0x2cc345[_0xf154('0xf')])[_0xf154('0x10')](_0xf154('0x11')))[_0xf154('0x12')]()[_0xf154('0x10')](),'$lte':moment(moment(_0x2cc345['$lte'])[_0xf154('0x10')](_0xf154('0x11')))[_0xf154('0x12')]()[_0xf154('0x13')](0x1,'s')[_0xf154('0x10')]()};_0x419f05[_0x5c7b4e]=_0x164ed0;}else if(_0x1668eb[_0xf154('0x14')]===_0xf154('0x15')){_0x419f05[_0x5c7b4e]=_0x1328b3;}else{_0x419f05[_0x5c7b4e]=_[_0xf154('0x16')](_0x1328b3)?_0x1328b3:JSON[_0xf154('0x2')](_0x1328b3);}}else{_0x419f05[_0x5c7b4e]=_['isArray'](_0x1328b3)?_0x1328b3:JSON[_0xf154('0x2')](_0x1328b3);}}catch(_0x1bd73a){_0x419f05[_0x5c7b4e]=_0x1328b3[_0xf154('0x9')](',');}});}return _0x419f05;};exports['limit']=function(_0x357444){_0x357444=parseInt(_0x357444,0xa);if(!_0x357444||_0x357444<0x0){_0x357444=LIMIT_VALUE;}return _0x357444;};exports[_0xf154('0x17')]=function(_0x443668){_0x443668=parseInt(_0x443668,0xa);if(!_0x443668||_0x443668<0x0){_0x443668=0x0;}return _0x443668;};exports['sort']=function(_0x22c73c){var _0x12cf88,_0x423eb0=null;if(_0x22c73c){_0x12cf88=_0x22c73c[_0xf154('0x9')](',');_0x423eb0=_['map'](_0x12cf88,function(_0xfb2661){if(_0xfb2661[_0xf154('0x18')]('-')===0x0){return[_0xfb2661===_0xf154('0x19')?sequelize[_0xf154('0x1a')](sequelize[_0xf154('0x1b')](_0xf154('0x19')),_0xf154('0x1c')):_0xfb2661['substr'](0x1),_0xf154('0x1d')];}else{return[_0xfb2661==='priority'?sequelize[_0xf154('0x1a')](sequelize[_0xf154('0x1b')](_0xf154('0x19')),_0xf154('0x1c')):_0xfb2661,'ASC'];}});}return _0x423eb0;};exports[_0xf154('0x1e')]=function(_0x5255b2,_0x565f4e){if(_[_0xf154('0xb')](_0x5255b2)){return _0x5255b2;}if(_['isArray'](_0x5255b2)){for(var _0x13f5fb=0x0;_0x13f5fb<_0x5255b2[_0xf154('0x1f')];_0x13f5fb+=0x1){_0x5255b2[_0x13f5fb]=this[_0xf154('0x1e')](_0x5255b2[_0x13f5fb],_0x565f4e);}return _0x5255b2;}if(!_[_0xf154('0x20')](_0x5255b2)){return _0x5255b2;}if(_[_0xf154('0x21')](_0x565f4e)){_0x565f4e=[_0x565f4e];}if(!_[_0xf154('0x16')](_0x565f4e)){return _0x5255b2;}for(var _0xcad592=0x0;_0xcad592<_0x565f4e['length'];_0xcad592+=0x1){_[_0xf154('0x22')](_0x5255b2,_0x565f4e[_0xcad592]);}for(var _0x556335 in _0x5255b2){if(_0x5255b2[_0xf154('0x23')](_0x556335)){_0x5255b2[_0x556335]=this['omit'](_0x5255b2[_0x556335],_0x565f4e);}}return _0x5255b2;};exports['isNumeric']=function(_0x5b328c){return _0x5b328c['match'](RegExp(_0xf154('0x24')))?!![]:![];};exports[_0xf154('0x25')]=function(_0x360d2f){return _0x360d2f[_0xf154('0x26')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x164705,_0x935708){var _0xe188a=[];var _0x4a4987=/[ `!@#$%^&*()_\-?~]/;var _0x318020=_0x935708?_0xf154('0x27'):_0xf154('0x28');_0x164705[_0xf154('0x9')](/[ ,]+/)[_0xf154('0x29')](function(_0x41572e){_0x41572e=_0x41572e[_0xf154('0x2a')](/([^:]")"+/g,'$1');_0x41572e='+'+_0x41572e+'*';var _0x3127d0=_0x41572e[_0xf154('0x26')](_0x4a4987);if(_0x3127d0){_0x41572e='\x22'+_0x41572e+'\x22';}_0xe188a['push'](_0x41572e);});_0x318020=_0x318020[_0xf154('0x2a')]('{EXPR}',_0xe188a[_0xf154('0x2b')]('\x20'));return _0x318020;};exports[_0xf154('0x2c')]=function(_0x458867,_0x59a2f7,_0x2dbe9b){var _0x222b62={},_0x52c177={};if(_0x59a2f7['query'][_0xf154('0x2d')]){_0x59a2f7['query']['id']=_0x59a2f7[_0xf154('0x2e')][_0xf154('0x2d')];delete _0x59a2f7[_0xf154('0x2e')][_0xf154('0x2d')];}_0x222b62[_0xf154('0x5')]=_[_0xf154('0x2f')](_0x458867,_0xf154('0x14'));_0x222b62['query']=_[_0xf154('0x3')](_0x59a2f7['query']);_0x222b62['filters']=_[_0xf154('0x30')](_0x222b62[_0xf154('0x5')],_0x222b62['query']);_0x52c177['attributes']=_[_0xf154('0x30')](_0x222b62[_0xf154('0x5')],this[_0xf154('0x7')](_0x59a2f7[_0xf154('0x2e')][_0xf154('0x7')]));_0x52c177[_0xf154('0x31')]=_0x52c177[_0xf154('0x31')][_0xf154('0x1f')]?_0x52c177[_0xf154('0x31')]:_0x222b62[_0xf154('0x5')];if(!_0x59a2f7['query'][_0xf154('0x23')]('nolimit')){_0x52c177['limit']=this[_0xf154('0x32')](_0x59a2f7[_0xf154('0x2e')][_0xf154('0x32')]);_0x52c177['offset']=this[_0xf154('0x17')](_0x59a2f7[_0xf154('0x2e')][_0xf154('0x17')]);}_0x52c177[_0xf154('0x33')]=this['sort'](_0x59a2f7[_0xf154('0x2e')][_0xf154('0x34')]);_0x52c177[_0xf154('0x35')]=this[_0xf154('0xa')](_[_0xf154('0x36')](_0x59a2f7['query'],_0x222b62[_0xf154('0xa')]),_0x458867);if(_0x59a2f7[_0xf154('0x2e')][_0xf154('0x37')]){var _0x356e21=_0x458867;var _0x5b2115=_0x59a2f7[_0xf154('0x2e')][_0xf154('0x37')];if(typeof _0x5b2115===_0xf154('0x38')){_0x356e21=_['filter'](_0x458867,function(_0x45b546){return _['includes'](_0x5b2115[_0xf154('0x39')],_0x45b546['name']);});_0x5b2115=_0x5b2115['value'];}_0x52c177['where']=_[_0xf154('0x3a')](_0x52c177[_0xf154('0x35')],{'$or':_[_0xf154('0x2f')](_0x356e21,function(_0x48623f){if(_0x48623f[_0xf154('0xd')]!==_0xf154('0x3b')){if(_0x2dbe9b){return sequelize[_0xf154('0x35')](sequelize['fn'](_0xf154('0x3c'),sequelize['col'](_0x48623f['name'])),{'$like':sequelize['fn'](_0xf154('0x3c'),'%'+_0x59a2f7[_0xf154('0x2e')][_0xf154('0x37')]+'%')});}else{var _0x4a9c1c={};_0x4a9c1c[_0x48623f[_0xf154('0x14')]]={'$like':'%'+_0x59a2f7['query']['filter']+'%'};return _0x4a9c1c;}}})});}_0x52c177=_[_0xf154('0x3a')]({},_0x52c177,_0x59a2f7[_0xf154('0x3d')]);return _0x52c177;};exports['include']=function(_0x530b8f){var _0xe7f144=[];if(_0x530b8f['includeAll']){_0xe7f144[_0xf154('0x3e')]({'all':!![]});}else if(_0x530b8f[_0xf154('0x3f')]){if(Array[_0xf154('0x16')](_0x530b8f[_0xf154('0x3f')])){_0xe7f144=Object[_0xf154('0x3')](_0x530b8f['include'])[_0xf154('0x2f')](function(_0x98d80f){return parseIncludeModel(_0x530b8f[_0xf154('0x3f')][_0x98d80f]);});}else{var _0x2bc51f=parseIncludeModel(_0x530b8f[_0xf154('0x3f')]);_0xe7f144[_0xf154('0x3e')](_0x2bc51f);}}return _0xe7f144;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 05b00b8..30a3d50 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x425d=['getAgents','all','flatten','uniq','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','name','fullname','whatsappPause','find','merge','catch','getSortedAgentsIdsByStatus','split','globalStatus','order','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','openchannelStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','pick','value','filterAgentAttributes','chatStatusTime','mailStatusTime','smsStatusTime','mailCapacity','openchannelCurrentCapacity','onhold','routealias','getRealtimeAgentsQueryFields','lodash','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','Queue','map','findOne'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x425d,0x1e0));var _0xd425=function(_0x237868,_0x267e95){_0x237868=_0x237868-0x0;var _0x3bc4f6=_0x425d[_0x237868];return _0x3bc4f6;};'use strict';var _=require(_0xd425('0x0'));var jayson=require('jayson/promise');var db=require(_0xd425('0x1'))['db'];var amiClient=jayson[_0xd425('0x2')][_0xd425('0x3')]({'port':0x232a});var routingClient=jayson[_0xd425('0x2')][_0xd425('0x3')]({'port':0x232c});function isAgentPaused(_0x44ba48,_0x47043f){var _0x596be7=[_0x44ba48[_0xd425('0x4')],_0x44ba48[_0xd425('0x5')],_0x44ba48[_0xd425('0x6')],_0x44ba48[_0xd425('0x7')],_0x44ba48[_0xd425('0x8')],_0x44ba48[_0xd425('0x9')],_0x44ba48['whatsappPause']];if(!_0x47043f)return _[_0xd425('0xa')](_0x596be7);var _0x374c3d=_[_0xd425('0xb')](_0x596be7);return _0x374c3d[_0xd425('0xc')]>0x0&&_0x374c3d[_0xd425('0xc')]<_0x596be7[_0xd425('0xc')]?!![]:![];}function isIdle(_0x30111e){return _0x30111e===_0xd425('0xd')||_0x30111e===_0xd425('0xe')||_0x30111e===_0xd425('0xf')||_0x30111e===_0xd425('0x10')||_[_0xd425('0x11')](_0x30111e);}function isAgentIdle(_0x26f6d2){if(_0x26f6d2[_0xd425('0x12')]!==_0xd425('0xd')&&_0x26f6d2[_0xd425('0x9')]){_0x26f6d2[_0xd425('0x12')]=_0xd425('0x13');return![];}return _[_0xd425('0xa')]([_0x26f6d2[_0xd425('0x14')],_0x26f6d2['faxStatus'],_0x26f6d2[_0xd425('0x15')],_0x26f6d2[_0xd425('0x16')],_0x26f6d2[_0xd425('0x17')],_0x26f6d2['voiceStatus'],_0x26f6d2[_0xd425('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xd425('0x19')](_0xd425('0x1a'),{})[_0xd425('0x1b')](function(_0x1fc822){if(_0x1fc822['error']){throw new Error(_0xd425('0x1c'));}var _0x471267=_0x1fc822[_0xd425('0x1d')];return routingClient[_0xd425('0x19')]('Agents',{})[_0xd425('0x1b')](function(_0x434d97){if(_0x434d97[_0xd425('0x1e')]){throw new Error(_0xd425('0x1f'));}var _0x4e88fa=_0x434d97['result'];return _['merge']({},_0x471267,_0x4e88fa);});})['catch'](function(_0x427304){throw _0x427304;});}exports[_0xd425('0x20')]=getRealtimeAgents;function getAgentStatus(_0x3c98db){var _0x5e797a=_0xd425('0xe');if(isAgentPaused(_0x3c98db))_0x5e797a=_0xd425('0x13');else if(isAgentPaused(_0x3c98db,!![]))_0x5e797a='*pause';else if(isAgentIdle(_0x3c98db))_0x5e797a=_0xd425('0xd');else _0x5e797a=_0xd425('0x21');return _0x5e797a;}exports[_0xd425('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x1d3fc0,_0x3e93db){var _0xb240c4=_[_0xd425('0x23')](_0x1d3fc0)?_0x1d3fc0:[_0x1d3fc0];var _0x3500bb=_[_0xd425('0x24')](_0x3e93db)+_0xd425('0x25');var _0x151ad9=_[_0xd425('0x26')](_0xb240c4,function(_0x47f44a){return db[_0x3500bb][_0xd425('0x27')]({'where':{'id':_0x47f44a}})[_0xd425('0x1b')](function(_0x398985){if(!_0x398985)return[];return _0x398985[_0xd425('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xd425('0x29')](_0x151ad9)[_0xd425('0x1b')](function(_0x3c3402){var _0x577e4b=_(_0x3c3402)[_0xd425('0x2a')]()[_0xd425('0x26')]('id')[_0xd425('0x2b')]()['value']();return _0x577e4b;});}exports[_0xd425('0x2c')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3ad9bd,_0x433189,_0x999fb9){try{if(_0x433189[_0xd425('0xc')]>0x0){_0x3ad9bd=_0x3ad9bd[_0xd425('0xb')](function(_0x2fd17a){return _0x433189[_0xd425('0x2d')](_0x2fd17a['id']);});}var _0x24da23=_0x3ad9bd[_0xd425('0xb')](function(_0x482ba6){var _0x471e3e=_0xd425('0x21');if(isAgentIdle(_0x482ba6)){_0x471e3e=_0xd425('0xd');}return _0x471e3e===_0x999fb9;});return _[_0xd425('0x26')](_0x24da23,'id');}catch(_0x3275b1){throw _0x3275b1;}}exports[_0xd425('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x47405f,_0x40c392,_0x3ec51b){return Promise[_0xd425('0x2f')]()[_0xd425('0x1b')](function(){if(_0x40c392['length']>0x0){_0x47405f=_0x47405f[_0xd425('0xb')](function(_0x2a2a9b){return _0x40c392[_0xd425('0x2d')](_0x2a2a9b['id']);});}return _0x47405f;})[_0xd425('0x1b')](function(){return db[_0xd425('0x30')]['findAll']({'attributes':['id',_0xd425('0x31'),_0xd425('0x32'),'chatPause','faxPause','mailPause',_0xd425('0x7'),_0xd425('0x8'),_0xd425('0x9'),_0xd425('0x33'),'pauseType'],'where':{'id':{'$in':_[_0xd425('0x26')](_0x47405f,'id')}},'raw':!![]});})[_0xd425('0x1b')](function(_0x30a9dc){return _0x30a9dc[_0xd425('0x26')](function(_0x27b9e2){var _0x1e12f2=_[_0xd425('0x34')](_0x47405f,['id',_0x27b9e2['id']]);var _0x533af1=filterAgentAttributes(_0x1e12f2);_[_0xd425('0x35')](_0x27b9e2,_0x533af1);_0x27b9e2['globalStatus']=getAgentStatus(_0x27b9e2);return _0x27b9e2;});})[_0xd425('0x1b')](function(_0x29cca9){var _0x36c8da=sortAgentsByStatus(_0x29cca9,_0x3ec51b);return _['map'](_0x36c8da,'id');})[_0xd425('0x36')](function(_0x26806c){throw _0x26806c;});}exports[_0xd425('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x46cfe2){var _0x58f36d={'fields':[],'order':null};var _0x1d38fa=_0x46cfe2[_0xd425('0x38')](',');_0x58f36d['fields']=_['filter'](_0x1d38fa,function(_0x48fc85){if(!_0x48fc85[_0xd425('0x2d')](_0xd425('0x39'))){return!![];}_0x58f36d[_0xd425('0x3a')]=_['startsWith'](_0x48fc85,'-')?'DESC':'ASC';return![];});return _0x58f36d;}exports[_0xd425('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x3f9090){if(!_0x3f9090){_0x3f9090=_0xd425('0x3c');}if(_0x3f9090[_0xd425('0x2d')](_0xd425('0x32'))&&!_0x3f9090[_0xd425('0x2d')](_0xd425('0x3d'))){var _0x4b922f=_0x3f9090[_0xd425('0x3e')](0x0,_0x3f9090[_0xd425('0x3f')](_0xd425('0x32')));_0x3f9090+=','+_0x4b922f+'internal';}return _0x3f9090;}exports[_0xd425('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x2dffc7,_0x336a87){var _0x5dc4c4=_0x2dffc7[_0xd425('0x41')](function(_0x12b970,_0x1c5ba6){if(_0x12b970[_0xd425('0x39')]===_0x1c5ba6['globalStatus']){if(_0x12b970[_0xd425('0x39')]===_0xd425('0x13')){if(_0x336a87===_0xd425('0x42')){return(_0x12b970[_0xd425('0x43')]||'')<(_0x1c5ba6[_0xd425('0x43')]||'')||_0x12b970[_0xd425('0x32')][_0xd425('0x44')]()>_0x1c5ba6['fullname'][_0xd425('0x44')]()?0x1:-0x1;}else{return(_0x12b970[_0xd425('0x43')]||'')<(_0x1c5ba6['pauseType']||'')||_0x12b970[_0xd425('0x32')]['toLowerCase']()>_0x1c5ba6['fullname'][_0xd425('0x44')]()?-0x1:0x1;}}else{if(_0x336a87==='DESC'){return _0x12b970[_0xd425('0x32')]['toLowerCase']()<_0x1c5ba6[_0xd425('0x32')][_0xd425('0x44')]()?0x1:-0x1;}else{return _0x12b970[_0xd425('0x32')][_0xd425('0x44')]()<_0x1c5ba6[_0xd425('0x32')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x336a87===_0xd425('0x42')){return _0x12b970['globalStatus']<_0x1c5ba6[_0xd425('0x39')]?0x1:-0x1;}else{return _0x12b970['globalStatus']<_0x1c5ba6[_0xd425('0x39')]?-0x1:0x1;}}});return _0x5dc4c4;}exports[_0xd425('0x45')]=sortAgentsByStatus;function filterAgentAttributes(_0x3fd2ce){var _0x15d8fd=[_0xd425('0x46'),'online',_0xd425('0x47'),_0xd425('0x48'),_0xd425('0x43'),_0xd425('0x48'),_0xd425('0x3d'),'address',_0xd425('0x4'),_0xd425('0x7'),_0xd425('0x6'),_0xd425('0x8'),_0xd425('0x33'),_0xd425('0x5'),'voicePause',_0xd425('0x49'),_0xd425('0x4a'),'mailCapacity',_0xd425('0x4b'),_0xd425('0x4c'),_0xd425('0x4d'),_0xd425('0x4e'),'openchannelCurrentCapacity',_0xd425('0x4f'),_0xd425('0x50'),_0xd425('0x51'),_0xd425('0x52'),_0xd425('0x14'),'openchannelStatus','mailStatus',_0xd425('0x17'),'whatsappStatus',_0xd425('0x53'),_0xd425('0x12'),'chatStatusTime',_0xd425('0x54'),'mailStatusTime','smsStatusTime',_0xd425('0x55'),_0xd425('0x56'),_0xd425('0x57'),_0xd425('0x58'),_0xd425('0x59'),_0xd425('0x5a'),_0xd425('0x5b'),_0xd425('0x5c'),'routealias'];var _0x11ed71=[_0xd425('0x4'),_0xd425('0x7'),_0xd425('0x6'),_0xd425('0x8'),_0xd425('0x33'),_0xd425('0x5'),_0xd425('0x9'),'online'];var _0x4a2508=_(_0x3fd2ce)['omit'](_0x11ed71)[_0xd425('0x5d')](_0x15d8fd)[_0xd425('0x5e')]();return _0x4a2508;}exports[_0xd425('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xd425('0x31'),'fullname','role','internal','online',_0xd425('0x39'),_0xd425('0x46'),'lastLoginAt',_0xd425('0x43'),_0xd425('0x48'),_0xd425('0x5'),'chatPause','mailPause',_0xd425('0x7'),'smsPause','voicePause','whatsappPause',_0xd425('0x14'),_0xd425('0x53'),_0xd425('0x15'),'openchannelStatus',_0xd425('0x17'),'voiceStatus',_0xd425('0x18'),_0xd425('0x60'),_0xd425('0x56'),_0xd425('0x61'),_0xd425('0x54'),_0xd425('0x62'),_0xd425('0x57'),_0xd425('0x55'),_0xd425('0x49'),'faxCapacity',_0xd425('0x63'),_0xd425('0x4a'),_0xd425('0x4b'),_0xd425('0x4c'),'chatCurrentCapacity','faxCurrentCapacity',_0xd425('0x4f'),_0xd425('0x64'),_0xd425('0x50'),_0xd425('0x51'),_0xd425('0x5b'),_0xd425('0x5c'),_0xd425('0x59'),_0xd425('0x65'),_0xd425('0x58'),_0xd425('0x66'),_0xd425('0x5a')];}exports[_0xd425('0x67')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x814b=['mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','filterAgentAttributes','openchannelStatusTime','voiceStatusTime','faxCapacity','chatCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','routealias','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','smsPause','voicePause','every','filter','length','idle','unknown','unavailable','ringing','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','*pause','busy','getAgentStatus','isArray','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','resolve','findAll','name','fullname','openchannelPause','whatsappPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','fields','order','fullname,internal','indexOf','internal','validateSortParameter','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','openchannelCurrentCapacity'];(function(_0x4051ac,_0x3cd535){var _0xa0a220=function(_0x410bae){while(--_0x410bae){_0x4051ac['push'](_0x4051ac['shift']());}};_0xa0a220(++_0x3cd535);}(_0x814b,0x1a2));var _0xb814=function(_0x1b640f,_0x215390){_0x1b640f=_0x1b640f-0x0;var _0x560770=_0x814b[_0x1b640f];return _0x560770;};'use strict';var _=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var db=require(_0xb814('0x2'))['db'];var amiClient=jayson[_0xb814('0x3')][_0xb814('0x4')]({'port':0x232a});var routingClient=jayson[_0xb814('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x38c21a,_0x3e1e9){var _0x258866=[_0x38c21a[_0xb814('0x5')],_0x38c21a[_0xb814('0x6')],_0x38c21a[_0xb814('0x7')],_0x38c21a['openchannelPause'],_0x38c21a[_0xb814('0x8')],_0x38c21a[_0xb814('0x9')],_0x38c21a['whatsappPause']];if(!_0x3e1e9)return _[_0xb814('0xa')](_0x258866);var _0x2913a6=_[_0xb814('0xb')](_0x258866);return _0x2913a6[_0xb814('0xc')]>0x0&&_0x2913a6[_0xb814('0xc')]<_0x258866[_0xb814('0xc')]?!![]:![];}function isIdle(_0x1086f8){return _0x1086f8===_0xb814('0xd')||_0x1086f8===_0xb814('0xe')||_0x1086f8===_0xb814('0xf')||_0x1086f8===_0xb814('0x10')||_['isNil'](_0x1086f8);}function isAgentIdle(_0x43dfe6){if(_0x43dfe6['voiceStatus']!==_0xb814('0xd')&&_0x43dfe6[_0xb814('0x9')]){_0x43dfe6[_0xb814('0x11')]=_0xb814('0x12');return![];}return _[_0xb814('0xa')]([_0x43dfe6[_0xb814('0x13')],_0x43dfe6[_0xb814('0x14')],_0x43dfe6[_0xb814('0x15')],_0x43dfe6[_0xb814('0x16')],_0x43dfe6[_0xb814('0x17')],_0x43dfe6[_0xb814('0x11')],_0x43dfe6[_0xb814('0x18')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xb814('0x19')](_0xb814('0x1a'),{})[_0xb814('0x1b')](function(_0x3a71d6){if(_0x3a71d6[_0xb814('0x1c')]){throw new Error(_0xb814('0x1d'));}var _0x125ce2=_0x3a71d6[_0xb814('0x1e')];return routingClient[_0xb814('0x19')]('Agents',{})[_0xb814('0x1b')](function(_0x55ba16){if(_0x55ba16[_0xb814('0x1c')]){throw new Error(_0xb814('0x1f'));}var _0x4c3007=_0x55ba16['result'];return _['merge']({},_0x125ce2,_0x4c3007);});})[_0xb814('0x20')](function(_0x4d5276){throw _0x4d5276;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0xb684ea){var _0x24211d=_0xb814('0xe');if(isAgentPaused(_0xb684ea))_0x24211d='pause';else if(isAgentPaused(_0xb684ea,!![]))_0x24211d=_0xb814('0x21');else if(isAgentIdle(_0xb684ea))_0x24211d='idle';else _0x24211d=_0xb814('0x22');return _0x24211d;}exports[_0xb814('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x3b267e,_0x470e81){var _0x27352e=_[_0xb814('0x24')](_0x3b267e)?_0x3b267e:[_0x3b267e];var _0x1f5d40=_['startCase'](_0x470e81)+_0xb814('0x25');var _0x52b7a3=_[_0xb814('0x26')](_0x27352e,function(_0x457dac){return db[_0x1f5d40][_0xb814('0x27')]({'where':{'id':_0x457dac}})[_0xb814('0x1b')](function(_0x1c8a2e){if(!_0x1c8a2e)return[];return _0x1c8a2e[_0xb814('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xb814('0x29')](_0x52b7a3)['then'](function(_0x392222){var _0xc0ef66=_(_0x392222)[_0xb814('0x2a')]()[_0xb814('0x26')]('id')[_0xb814('0x2b')]()[_0xb814('0x2c')]();return _0xc0ef66;});}exports[_0xb814('0x2d')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1e4e89,_0x5a6291,_0x271aa8){try{if(_0x5a6291[_0xb814('0xc')]>0x0){_0x1e4e89=_0x1e4e89['filter'](function(_0x9008b2){return _0x5a6291[_0xb814('0x2e')](_0x9008b2['id']);});}var _0x530744=_0x1e4e89['filter'](function(_0x20577b){var _0x2051d0='busy';if(isAgentIdle(_0x20577b)){_0x2051d0=_0xb814('0xd');}return _0x2051d0===_0x271aa8;});return _['map'](_0x530744,'id');}catch(_0x6efe9a){throw _0x6efe9a;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4cfc58,_0x419cd9,_0x4a4f27){return Promise[_0xb814('0x2f')]()[_0xb814('0x1b')](function(){if(_0x419cd9[_0xb814('0xc')]>0x0){_0x4cfc58=_0x4cfc58['filter'](function(_0x51d5ae){return _0x419cd9[_0xb814('0x2e')](_0x51d5ae['id']);});}return _0x4cfc58;})[_0xb814('0x1b')](function(){return db['User'][_0xb814('0x30')]({'attributes':['id',_0xb814('0x31'),_0xb814('0x32'),_0xb814('0x5'),_0xb814('0x6'),_0xb814('0x7'),_0xb814('0x33'),'smsPause',_0xb814('0x9'),_0xb814('0x34'),_0xb814('0x35')],'where':{'id':{'$in':_[_0xb814('0x26')](_0x4cfc58,'id')}},'raw':!![]});})[_0xb814('0x1b')](function(_0x4ff31a){return _0x4ff31a[_0xb814('0x26')](function(_0x57e6e6){var _0x43db67=_[_0xb814('0x36')](_0x4cfc58,['id',_0x57e6e6['id']]);var _0xe0f509=filterAgentAttributes(_0x43db67);_['merge'](_0x57e6e6,_0xe0f509);_0x57e6e6[_0xb814('0x37')]=getAgentStatus(_0x57e6e6);return _0x57e6e6;});})[_0xb814('0x1b')](function(_0x4ea6f8){var _0x2fcd92=sortAgentsByStatus(_0x4ea6f8,_0x4a4f27);return _[_0xb814('0x26')](_0x2fcd92,'id');})[_0xb814('0x20')](function(_0x1f7cd8){throw _0x1f7cd8;});}exports[_0xb814('0x38')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x467cf9){var _0x4d81eb={'fields':[],'order':null};var _0xa6ce87=_0x467cf9['split'](',');_0x4d81eb[_0xb814('0x39')]=_['filter'](_0xa6ce87,function(_0x4492ef){if(!_0x4492ef['includes'](_0xb814('0x37'))){return!![];}_0x4d81eb[_0xb814('0x3a')]=_['startsWith'](_0x4492ef,'-')?'DESC':'ASC';return![];});return _0x4d81eb;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x17549e){if(!_0x17549e){_0x17549e=_0xb814('0x3b');}if(_0x17549e[_0xb814('0x2e')](_0xb814('0x32'))&&!_0x17549e['includes']('internal')){var _0x6f15d3=_0x17549e['substring'](0x0,_0x17549e[_0xb814('0x3c')](_0xb814('0x32')));_0x17549e+=','+_0x6f15d3+_0xb814('0x3d');}return _0x17549e;}exports[_0xb814('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x42653f,_0x37369f){var _0x3b7f5a=_0x42653f[_0xb814('0x3f')](function(_0x31989d,_0x4b6ff8){if(_0x31989d['globalStatus']===_0x4b6ff8['globalStatus']){if(_0x31989d[_0xb814('0x37')]==='pause'){if(_0x37369f===_0xb814('0x40')){return(_0x31989d['pauseType']||'')<(_0x4b6ff8[_0xb814('0x35')]||'')||_0x31989d[_0xb814('0x32')][_0xb814('0x41')]()>_0x4b6ff8[_0xb814('0x32')]['toLowerCase']()?0x1:-0x1;}else{return(_0x31989d[_0xb814('0x35')]||'')<(_0x4b6ff8[_0xb814('0x35')]||'')||_0x31989d[_0xb814('0x32')][_0xb814('0x41')]()>_0x4b6ff8[_0xb814('0x32')][_0xb814('0x41')]()?-0x1:0x1;}}else{if(_0x37369f==='DESC'){return _0x31989d[_0xb814('0x32')][_0xb814('0x41')]()<_0x4b6ff8[_0xb814('0x32')][_0xb814('0x41')]()?0x1:-0x1;}else{return _0x31989d[_0xb814('0x32')][_0xb814('0x41')]()<_0x4b6ff8[_0xb814('0x32')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x37369f==='DESC'){return _0x31989d[_0xb814('0x37')]<_0x4b6ff8[_0xb814('0x37')]?0x1:-0x1;}else{return _0x31989d[_0xb814('0x37')]<_0x4b6ff8[_0xb814('0x37')]?-0x1:0x1;}}});return _0x3b7f5a;}exports[_0xb814('0x42')]=sortAgentsByStatus;function filterAgentAttributes(_0x40e627){var _0x24b697=[_0xb814('0x43'),_0xb814('0x44'),_0xb814('0x45'),_0xb814('0x46'),'pauseType',_0xb814('0x46'),_0xb814('0x3d'),'address',_0xb814('0x5'),'openchannelPause',_0xb814('0x7'),_0xb814('0x8'),_0xb814('0x34'),_0xb814('0x6'),_0xb814('0x9'),_0xb814('0x47'),_0xb814('0x48'),_0xb814('0x49'),_0xb814('0x4a'),_0xb814('0x4b'),'faxCapacity','chatCurrentCapacity',_0xb814('0x4c'),_0xb814('0x4d'),_0xb814('0x4e'),_0xb814('0x4f'),_0xb814('0x50'),_0xb814('0x13'),_0xb814('0x16'),'mailStatus',_0xb814('0x17'),_0xb814('0x18'),_0xb814('0x14'),'voiceStatus',_0xb814('0x51'),'openchannelStatusTime',_0xb814('0x52'),'smsStatusTime',_0xb814('0x53'),_0xb814('0x54'),'voiceStatusTime',_0xb814('0x55'),_0xb814('0x56'),_0xb814('0x57'),'phoneBarEnableScreenRecordingByAgent',_0xb814('0x58'),'routealias'];var _0x13bdcf=[_0xb814('0x5'),'openchannelPause',_0xb814('0x7'),'smsPause','whatsappPause',_0xb814('0x6'),_0xb814('0x9'),_0xb814('0x44')];var _0x47a814=_(_0x40e627)[_0xb814('0x59')](_0x13bdcf)['pick'](_0x24b697)[_0xb814('0x2c')]();return _0x47a814;}exports[_0xb814('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0xb814('0x32'),'role',_0xb814('0x3d'),_0xb814('0x44'),_0xb814('0x37'),_0xb814('0x43'),_0xb814('0x45'),_0xb814('0x35'),_0xb814('0x46'),_0xb814('0x6'),'chatPause',_0xb814('0x7'),_0xb814('0x33'),'smsPause',_0xb814('0x9'),_0xb814('0x34'),'chatStatus',_0xb814('0x14'),'mailStatus','openchannelStatus',_0xb814('0x17'),'voiceStatus',_0xb814('0x18'),_0xb814('0x51'),_0xb814('0x54'),'mailStatusTime',_0xb814('0x5b'),'smsStatusTime',_0xb814('0x5c'),_0xb814('0x53'),_0xb814('0x47'),_0xb814('0x5d'),_0xb814('0x49'),_0xb814('0x48'),_0xb814('0x4a'),_0xb814('0x4b'),_0xb814('0x5e'),'faxCurrentCapacity',_0xb814('0x4d'),_0xb814('0x4c'),_0xb814('0x4e'),_0xb814('0x4f'),_0xb814('0x5f'),_0xb814('0x58'),'destconnectedlinenum',_0xb814('0x60'),'queue',_0xb814('0x61'),_0xb814('0x57')];}exports[_0xb814('0x62')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 0b53959..69561e2 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3851=['util','http','client','available','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','talking','unavailable','pTalking','originated','message','dialActive','startPredictive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','voice','request','startCase','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','concat','outbound','map','get','loggedIn','find','merge','pick','initializeQueues','lodash','jayson/promise'];(function(_0x5814f6,_0x48654b){var _0x54e653=function(_0x550278){while(--_0x550278){_0x5814f6['push'](_0x5814f6['shift']());}};_0x54e653(++_0x48654b);}(_0x3851,0x94));var _0x1385=function(_0x5e9332,_0x12b55a){_0x5e9332=_0x5e9332-0x0;var _0x4196f4=_0x3851[_0x5e9332];return _0x4196f4;};'use strict';var _=require(_0x1385('0x0'));var jayson=require(_0x1385('0x1'));var util=require(_0x1385('0x2'));var amiClient=jayson['client'][_0x1385('0x3')]({'port':0x232a});var routingClient=jayson[_0x1385('0x4')][_0x1385('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x1385('0x5'),'loggedIn',_0x1385('0x6'),_0x1385('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x1385('0x8'),_0x1385('0x9'),_0x1385('0xa'),_0x1385('0xb'),_0x1385('0xc'),_0x1385('0xd'),_0x1385('0xe'),_0x1385('0xf'),_0x1385('0x10'),_0x1385('0x11'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x1385('0x12'),_0x1385('0x13'),_0x1385('0x14'),'statusMessage',_0x1385('0x15'),'dialMethod','Trunk',_0x1385('0x16'),'startProgressive',_0x1385('0x17'),_0x1385('0x18'),'erlangAbandonmentRate',_0x1385('0x19'),_0x1385('0x1a'),_0x1385('0x1b'),_0x1385('0x1c'),'predictiveIntervalAvailable',_0x1385('0x1d'),_0x1385('0x1e'),_0x1385('0x1f'),'predictiveIntervalDroppedCallsCallersExit',_0x1385('0x20'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x2d07df,_0x231d73){var _0x5d4218=_0x231d73===_0x1385('0x21')?amiClient:routingClient;return _0x5d4218[_0x1385('0x22')](_[_0x1385('0x23')](_0x231d73)+'Queues',_0x2d07df)['then'](function(_0x4e2ccf){if(_0x4e2ccf[_0x1385('0x24')])throw new Error(util[_0x1385('0x25')](_0x1385('0x26'),_0x231d73));return _0x4e2ccf[_0x1385('0x27')];})[_0x1385('0x28')](function(_0x1bfb3d){throw _0x1bfb3d;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x34db4f,_0x27ae46,_0x5bbd29,_0x2d6825){var _0x40e8f9=DEFAULT_QUEUE_ATTRIBUTES;if(_0x5bbd29==='voice'){if(_0x2d6825==='inbound'){_0x40e8f9=_0x40e8f9[_0x1385('0x29')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2d6825===_0x1385('0x2a')){_0x40e8f9=_0x40e8f9[_0x1385('0x29')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x34db4f[_0x1385('0x2b')](function(_0x25fbd1){var _0x27f7ec=_0x25fbd1[_0x1385('0x2c')]({'plain':!![]});_0x27f7ec[_0x1385('0x6')]=0x0;_0x27f7ec['loggedInDb']=0x0;_0x27f7ec[_0x1385('0x2d')]=0x0;_0x27f7ec[_0x1385('0x5')]=0x0;_0x27f7ec[_0x1385('0x7')]=0x0;if(_0x5bbd29===_0x1385('0x21')){_0x27f7ec[_0x1385('0x10')]=0x0;_0x27f7ec[_0x1385('0x8')]=0x0;if(_0x2d6825===_0x1385('0x2a')){_0x27f7ec[_0x1385('0x12')]=0x0;_0x27f7ec[_0x1385('0x13')]=0x0;}}var _0x148cb3=_[_0x1385('0x2e')](_0x27ae46,['id',_0x27f7ec['id']]);if(_0x148cb3){_[_0x1385('0x2f')](_0x27f7ec,_[_0x1385('0x30')](_0x148cb3,_0x40e8f9));}return _0x27f7ec;});}exports[_0x1385('0x31')]=initializeQueues; \ No newline at end of file +var _0xcc3d=['predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','voice','inbound','concat','map','get','talking','outbound','pTalking','find','pick','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','invalid','loggedInDb','onHold','ringing','ringInUse','unavailable','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','erlangBusyFactor','dialPredictiveInterval','predictiveIntervalAvailable'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xcc3d,0x1b2));var _0xdcc3=function(_0x494dfa,_0x34171b){_0x494dfa=_0x494dfa-0x0;var _0x4be2a6=_0xcc3d[_0x494dfa];return _0x4be2a6;};'use strict';var _=require(_0xdcc3('0x0'));var jayson=require(_0xdcc3('0x1'));var util=require(_0xdcc3('0x2'));var amiClient=jayson[_0xdcc3('0x3')][_0xdcc3('0x4')]({'port':0x232a});var routingClient=jayson[_0xdcc3('0x3')][_0xdcc3('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xdcc3('0x5'),_0xdcc3('0x6'),_0xdcc3('0x7'),_0xdcc3('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0xdcc3('0x9'),'inUse',_0xdcc3('0xa'),_0xdcc3('0xb'),'notInUse',_0xdcc3('0xc'),_0xdcc3('0xd'),_0xdcc3('0xe'),'talking',_0xdcc3('0xf'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated',_0xdcc3('0x10'),_0xdcc3('0x11'),_0xdcc3('0x12'),_0xdcc3('0x13'),_0xdcc3('0x14'),_0xdcc3('0x15'),'startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate',_0xdcc3('0x16'),_0xdcc3('0x17'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0xdcc3('0x18'),_0xdcc3('0x19'),_0xdcc3('0x1a'),_0xdcc3('0x1b'),_0xdcc3('0x1c'),_0xdcc3('0x1d'),_0xdcc3('0x1e')];function getRealtimeQueues(_0x24160a,_0x14155d){var _0x17ba62=_0x14155d==='voice'?amiClient:routingClient;return _0x17ba62[_0xdcc3('0x1f')](_[_0xdcc3('0x20')](_0x14155d)+_0xdcc3('0x21'),_0x24160a)[_0xdcc3('0x22')](function(_0x286645){if(_0x286645[_0xdcc3('0x23')])throw new Error(util[_0xdcc3('0x24')](_0xdcc3('0x25'),_0x14155d));return _0x286645[_0xdcc3('0x26')];})[_0xdcc3('0x27')](function(_0x1600ea){throw _0x1600ea;});}exports[_0xdcc3('0x28')]=getRealtimeQueues;function initializeQueues(_0x5f8691,_0x4a494c,_0x32fcd9,_0x3984e0){var _0x532c14=DEFAULT_QUEUE_ATTRIBUTES;if(_0x32fcd9===_0xdcc3('0x29')){if(_0x3984e0===_0xdcc3('0x2a')){_0x532c14=_0x532c14[_0xdcc3('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3984e0==='outbound'){_0x532c14=_0x532c14['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x5f8691[_0xdcc3('0x2c')](function(_0x4ee0dd){var _0x360f83=_0x4ee0dd[_0xdcc3('0x2d')]({'plain':!![]});_0x360f83[_0xdcc3('0x7')]=0x0;_0x360f83[_0xdcc3('0xb')]=0x0;_0x360f83[_0xdcc3('0x6')]=0x0;_0x360f83[_0xdcc3('0x5')]=0x0;_0x360f83[_0xdcc3('0x8')]=0x0;if(_0x32fcd9===_0xdcc3('0x29')){_0x360f83[_0xdcc3('0x2e')]=0x0;_0x360f83[_0xdcc3('0x9')]=0x0;if(_0x3984e0===_0xdcc3('0x2f')){_0x360f83[_0xdcc3('0x30')]=0x0;_0x360f83['originated']=0x0;}}var _0x415f39=_[_0xdcc3('0x31')](_0x4a494c,['id',_0x360f83['id']]);if(_0x415f39){_['merge'](_0x360f83,_[_0xdcc3('0x32')](_0x415f39,_0x532c14));}return _0x360f83;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 14aa072..4810efe 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x1b60d9,_0x514a3a){var _0x24e3c1=function(_0x457e4e){while(--_0x457e4e){_0x1b60d9['push'](_0x1b60d9['shift']());}};_0x24e3c1(++_0x514a3a);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0xd73d53,_0x598443){var _0x560148=function(_0x3c8918){while(--_0x3c8918){_0xd73d53['push'](_0xd73d53['shift']());}};_0x560148(++_0x598443);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 6f11193..57a6cdb 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 _0x0646=['crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','keys','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','substring'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x0646,0xf5));var _0x6064=function(_0x56a077,_0x528fcf){_0x56a077=_0x56a077-0x0;var _0x107e4b=_0x0646[_0x56a077];return _0x107e4b;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x6064('0x0'));var machine=require(_0x6064('0x1'));var exec=require(_0x6064('0x2'))[_0x6064('0x3')];var config=require(_0x6064('0x4'));function getInterfaces(){var _0x151d08=[];var _0x11326a=os[_0x6064('0x5')]();var _0x3313f4=_['orderBy'](_[_0x6064('0x6')](_0x11326a));for(var _0xc7edf6=0x0;_0xc7edf6<_0x3313f4['length'];_0xc7edf6++){var _0x11b170=_0x11326a[_0x3313f4[_0xc7edf6]][_0x6064('0x7')](function(_0x1652cb){return _0x1652cb['family']===_0x6064('0x8')&&_0x1652cb[_0x6064('0x9')]===![];});_0x151d08=_0x151d08[_0x6064('0xa')](_0x11b170);}return _0x151d08;}function getFirstInterface(){var _0x2f5f53=_[_0x6064('0xb')](getInterfaces());return{'macAddress':_0x2f5f53&&_0x2f5f53[_0x6064('0xc')]?_0x2f5f53[_0x6064('0xc')]:_0x6064('0xd'),'ipAddress':_0x2f5f53&&_0x2f5f53['address']?_0x2f5f53[_0x6064('0xe')]:_0x6064('0xf')};}exports[_0x6064('0x10')]=getFirstInterface;function getCPUhash(){var _0x370c06=_[_0x6064('0x11')](os[_0x6064('0x12')]()['map'](function(_0x86e20b){return _0x86e20b['model'];}))['join'](':');return crypto[_0x6064('0x13')](_0x6064('0x14'))[_0x6064('0x15')](_0x370c06)[_0x6064('0x16')](_0x6064('0x17'));}exports[_0x6064('0x18')]=function(){var _0xd35bd=os[_0x6064('0x19')]();var _0x326259=/[0-9a-f-]{36}/;if(config[_0x6064('0x1a')]&&_0x326259[_0x6064('0x1b')](config[_0x6064('0x1a')])){return config[_0x6064('0x1a')];}else if(_0xd35bd===_0x6064('0x1c')){return exec(_0x6064('0x1d'),{'encoding':_0x6064('0x1e')})['replace']('\x0d\x0a','');}else{var _0x4b7aac=getFirstInterface();var _0x382855=getCPUhash();var _0x4fbca5=_0x382855+'|'+os[_0x6064('0x1f')]()+'|'+_0x4b7aac[_0x6064('0x20')]+'|'+_0x4b7aac[_0x6064('0x21')];var _0x3cb6c9=crypto[_0x6064('0x13')]('md5')[_0x6064('0x15')](_0x4fbca5)[_0x6064('0x16')](_0x6064('0x17'));return _0x3cb6c9[_0x6064('0x22')](0x0,0x8)+'-'+_0x3cb6c9[_0x6064('0x22')](0x8,0xc)+'-'+_0x3cb6c9['substring'](0xc,0x10)+'-'+_0x3cb6c9[_0x6064('0x22')](0x10,0x14)+'-'+_0x3cb6c9[_0x6064('0x22')](0x14);}}; \ No newline at end of file +var _0x9f9c=['127.0.0.1','cpus','map','model','join','createHash','md5','update','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','digest','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address'];(function(_0x10fdc3,_0x2ac01f){var _0xd7c0c2=function(_0x12180d){while(--_0x12180d){_0x10fdc3['push'](_0x10fdc3['shift']());}};_0xd7c0c2(++_0x2ac01f);}(_0x9f9c,0x19b));var _0xc9f9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9f9c[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xc9f9('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xc9f9('0x1'));var exec=require(_0xc9f9('0x2'))[_0xc9f9('0x3')];var config=require(_0xc9f9('0x4'));function getInterfaces(){var _0x1bbca6=[];var _0x1b9d70=os[_0xc9f9('0x5')]();var _0x14bc0e=_[_0xc9f9('0x6')](_[_0xc9f9('0x7')](_0x1b9d70));for(var _0x6765f5=0x0;_0x6765f5<_0x14bc0e[_0xc9f9('0x8')];_0x6765f5++){var _0x259b00=_0x1b9d70[_0x14bc0e[_0x6765f5]][_0xc9f9('0x9')](function(_0x5164b0){return _0x5164b0[_0xc9f9('0xa')]===_0xc9f9('0xb')&&_0x5164b0[_0xc9f9('0xc')]===![];});_0x1bbca6=_0x1bbca6[_0xc9f9('0xd')](_0x259b00);}return _0x1bbca6;}function getFirstInterface(){var _0x518f25=_[_0xc9f9('0xe')](getInterfaces());return{'macAddress':_0x518f25&&_0x518f25[_0xc9f9('0xf')]?_0x518f25['mac']:_0xc9f9('0x10'),'ipAddress':_0x518f25&&_0x518f25[_0xc9f9('0x11')]?_0x518f25[_0xc9f9('0x11')]:_0xc9f9('0x12')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x44c8ab=_[_0xc9f9('0x6')](os[_0xc9f9('0x13')]()[_0xc9f9('0x14')](function(_0x5e53de){return _0x5e53de[_0xc9f9('0x15')];}))[_0xc9f9('0x16')](':');return crypto[_0xc9f9('0x17')](_0xc9f9('0x18'))[_0xc9f9('0x19')](_0x44c8ab)['digest'](_0xc9f9('0x1a'));}exports[_0xc9f9('0x1b')]=function(){var _0x3185ee=os[_0xc9f9('0x1c')]();var _0x11ae94=/[0-9a-f-]{36}/;if(config[_0xc9f9('0x1d')]&&_0x11ae94[_0xc9f9('0x1e')](config[_0xc9f9('0x1d')])){return config[_0xc9f9('0x1d')];}else if(_0x3185ee==='win32'){return exec(_0xc9f9('0x1f'),{'encoding':_0xc9f9('0x20')})[_0xc9f9('0x21')]('\x0d\x0a','');}else{var _0xc482cb=getFirstInterface();var _0x4f074a=getCPUhash();var _0x48ff99=_0x4f074a+'|'+os[_0xc9f9('0x22')]()+'|'+_0xc482cb[_0xc9f9('0x23')]+'|'+_0xc482cb[_0xc9f9('0x24')];var _0x4b8135=crypto[_0xc9f9('0x17')](_0xc9f9('0x18'))['update'](_0x48ff99)[_0xc9f9('0x25')]('hex');return _0x4b8135[_0xc9f9('0x26')](0x0,0x8)+'-'+_0x4b8135[_0xc9f9('0x26')](0x8,0xc)+'-'+_0x4b8135[_0xc9f9('0x26')](0xc,0x10)+'-'+_0x4b8135[_0xc9f9('0x26')](0x10,0x14)+'-'+_0x4b8135[_0xc9f9('0x26')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 1cafb66..cd895a3 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 _0x3f33=['info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','bluebird','version','../../components/encryptor','./hardware','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','data1','active','license'];(function(_0x45f608,_0x3c5349){var _0x33b8db=function(_0x577212){while(--_0x577212){_0x45f608['push'](_0x45f608['shift']());}};_0x33b8db(++_0x3c5349);}(_0x3f33,0x1d3));var _0x33f3=function(_0x24a26b,_0x49c278){_0x24a26b=_0x24a26b-0x0;var _0x3ebfd0=_0x3f33[_0x24a26b];return _0x3ebfd0;};'use strict';var util=require(_0x33f3('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0x33f3('0x1'));var pkginfo=require('pkginfo')(module,_0x33f3('0x2'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x33f3('0x3'));var hardware=require(_0x33f3('0x4'));var logger=require('../logger')('license');var HOST=_0x33f3('0x5');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5d2815){return new BPromise(function(_0x38b33e,_0x3f3594){var _0x308538=util[_0x33f3('0x6')](_0x33f3('0x7'),HOST,_0x5d2815,module['exports'][_0x33f3('0x2')]);if(oldToken){_0x308538=util[_0x33f3('0x6')](_0x33f3('0x8'),HOST,_0x5d2815,module['exports'][_0x33f3('0x2')],oldToken);}var _0x436e47={'uri':_0x308538,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x436e47)[_0x33f3('0x9')](function(_0x160964){_0x38b33e(_0x160964);})[_0x33f3('0xa')](function(_0x31a60d){_0x3f3594(_0x31a60d);});});}function manageLicense(_0xdd2716,_0x3dac2a){var _0x3da3c9=_0x3dac2a['get']({'plain':!![]});if(!isOldTokenSent&&_0x3da3c9[_0x33f3('0xb')]!==_0xdd2716&&!_0x3da3c9['data2']){oldToken=_0x3da3c9[_0x33f3('0xb')];}httpRequest(_0xdd2716)[_0x33f3('0x9')](function(_0x1318c2){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1318c2[_0x33f3('0xc')]){isOldTokenSent=![];if(!_0x3da3c9['license']&&_0x3da3c9['license']!=_0x1318c2[_0x33f3('0xd')]||_0x3da3c9[_0x33f3('0xd')]&&_0x3da3c9['data2']){logger[_0x33f3('0xe')](_0x33f3('0xf'));}if(_0x3da3c9['license']&&!_0x3da3c9[_0x33f3('0x10')]&&_0x3da3c9['license']!=_0x1318c2[_0x33f3('0xd')]){logger[_0x33f3('0xe')](_0x33f3('0x11'));}if(_0x3da3c9['license']&&!_0x3da3c9[_0x33f3('0x10')]&&_0x3da3c9[_0x33f3('0xd')]==_0x1318c2[_0x33f3('0xd')]){return _0x3dac2a;}return _0x3dac2a[_0x33f3('0x12')]({'data1':_0xdd2716,'data2':null,'license':_0x1318c2[_0x33f3('0xd')]});}else{if(_0x1318c2[_0x33f3('0xd')]||_0x3da3c9[_0x33f3('0xd')]){if(!_0x3da3c9[_0x33f3('0x10')]){if(_0x3da3c9[_0x33f3('0xb')]==_0xdd2716){GRAY_PERIOD_REASON=_0x33f3('0x13');logger['info'](_0x33f3('0x14'));}else{GRAY_PERIOD_REASON=_0x33f3('0x15');logger[_0x33f3('0xe')](_0x33f3('0x16'),_0x3da3c9[_0x33f3('0xb')],_0xdd2716);}logger['info']('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x33f3('0x17')](),moment()[_0x33f3('0x6')](_0x33f3('0x18')));return _0x3dac2a[_0x33f3('0x12')]({'data2':encryptor['encryptString'](moment()['format'](_0x33f3('0x18')))});}else{if(moment()[_0x33f3('0x19')](encryptor[_0x33f3('0x1a')](_0x3da3c9[_0x33f3('0x10')]),_0x33f3('0x1b'))>DAYS){logger[_0x33f3('0xe')](_0x33f3('0x1c'),moment()['format'](_0x33f3('0x18')));isOldTokenSent=![];return _0x3dac2a['update']({'data1':_0xdd2716,'data2':null,'license':null});}}}else{if(_0x3da3c9[_0x33f3('0xb')]!=_0xdd2716){logger['info'](_0x33f3('0x16'),_0x3da3c9[_0x33f3('0xb')],_0xdd2716);return _0x3dac2a['update']({'data1':_0xdd2716,'data2':null,'license':null});}}}return _0x3dac2a;})[_0x33f3('0x9')](function(_0xff5d5d){_0x3dac2a=_0xff5d5d;})[_0x33f3('0xa')](function(_0x1541cd){logger[_0x33f3('0x1d')](_0x1541cd[_0x33f3('0x1e')]);})[_0x33f3('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0x33f3('0x20')](),_0x3dac2a);},TIME);});}function defaultLicense(){var _0xc5e9b8=hardware['getUuid']();if(_0xc5e9b8){return db[_0x33f3('0x21')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0xc5e9b8}})[_0x33f3('0x22')](function(_0x5be220,_0x195238){logger['info'](_0x33f3('0x23'),_0xc5e9b8);manageLicense(_0xc5e9b8,_0x5be220);})[_0x33f3('0xa')](function(_0x2a05d0){logger[_0x33f3('0x1d')](_0x2a05d0[_0x33f3('0x1e')]);});}}exports[_0x33f3('0x24')]=defaultLicense; \ No newline at end of file +var _0x9b97=['License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid'];(function(_0xd3234,_0x4cb3e5){var _0xc3ce5=function(_0x250f3){while(--_0x250f3){_0xd3234['push'](_0xd3234['shift']());}};_0xc3ce5(++_0x4cb3e5);}(_0x9b97,0xb5));var _0x79b9=function(_0x5f53ba,_0x58a94f){_0x5f53ba=_0x5f53ba-0x0;var _0x32dfb0=_0x9b97[_0x5f53ba];return _0x32dfb0;};'use strict';var util=require('util');var moment=require(_0x79b9('0x0'));var rp=require(_0x79b9('0x1'));var BPromise=require(_0x79b9('0x2'));var pkginfo=require(_0x79b9('0x3'))(module,_0x79b9('0x4'));var db=require(_0x79b9('0x5'))['db'];var encryptor=require(_0x79b9('0x6'));var hardware=require(_0x79b9('0x7'));var logger=require(_0x79b9('0x8'))(_0x79b9('0x9'));var HOST=_0x79b9('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x16965a){return new BPromise(function(_0x5bae83,_0x5077f3){var _0x4a3a33=util[_0x79b9('0xb')](_0x79b9('0xc'),HOST,_0x16965a,module[_0x79b9('0xd')][_0x79b9('0x4')]);if(oldToken){_0x4a3a33=util['format'](_0x79b9('0xe'),HOST,_0x16965a,module[_0x79b9('0xd')][_0x79b9('0x4')],oldToken);}var _0x2f40de={'uri':_0x4a3a33,'method':_0x79b9('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x2f40de)[_0x79b9('0x10')](function(_0x5b5241){_0x5bae83(_0x5b5241);})[_0x79b9('0x11')](function(_0xc59fdd){_0x5077f3(_0xc59fdd);});});}function manageLicense(_0x2fbcba,_0x1eb0ba){var _0x373247=_0x1eb0ba['get']({'plain':!![]});if(!isOldTokenSent&&_0x373247[_0x79b9('0x12')]!==_0x2fbcba&&!_0x373247[_0x79b9('0x13')]){oldToken=_0x373247[_0x79b9('0x12')];}httpRequest(_0x2fbcba)['then'](function(_0x44f2ef){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x44f2ef[_0x79b9('0x14')]){isOldTokenSent=![];if(!_0x373247[_0x79b9('0x9')]&&_0x373247[_0x79b9('0x9')]!=_0x44f2ef[_0x79b9('0x9')]||_0x373247[_0x79b9('0x9')]&&_0x373247[_0x79b9('0x13')]){logger['info'](_0x79b9('0x15'));}if(_0x373247[_0x79b9('0x9')]&&!_0x373247[_0x79b9('0x13')]&&_0x373247[_0x79b9('0x9')]!=_0x44f2ef[_0x79b9('0x9')]){logger[_0x79b9('0x16')](_0x79b9('0x17'));}if(_0x373247[_0x79b9('0x9')]&&!_0x373247[_0x79b9('0x13')]&&_0x373247[_0x79b9('0x9')]==_0x44f2ef[_0x79b9('0x9')]){return _0x1eb0ba;}return _0x1eb0ba['update']({'data1':_0x2fbcba,'data2':null,'license':_0x44f2ef[_0x79b9('0x9')]});}else{if(_0x44f2ef[_0x79b9('0x9')]||_0x373247[_0x79b9('0x9')]){if(!_0x373247[_0x79b9('0x13')]){if(_0x373247[_0x79b9('0x12')]==_0x2fbcba){GRAY_PERIOD_REASON=_0x79b9('0x18');logger[_0x79b9('0x16')](_0x79b9('0x19'));}else{GRAY_PERIOD_REASON=_0x79b9('0x1a');logger[_0x79b9('0x16')](_0x79b9('0x1b'),_0x373247[_0x79b9('0x12')],_0x2fbcba);}logger[_0x79b9('0x16')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x79b9('0x1c')](),moment()['format'](_0x79b9('0x1d')));return _0x1eb0ba[_0x79b9('0x1e')]({'data2':encryptor[_0x79b9('0x1f')](moment()[_0x79b9('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x79b9('0x20')](encryptor[_0x79b9('0x21')](_0x373247['data2']),_0x79b9('0x22'))>DAYS){logger['info'](_0x79b9('0x23'),moment()[_0x79b9('0xb')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x1eb0ba['update']({'data1':_0x2fbcba,'data2':null,'license':null});}}}else{if(_0x373247['data1']!=_0x2fbcba){logger[_0x79b9('0x16')](_0x79b9('0x1b'),_0x373247[_0x79b9('0x12')],_0x2fbcba);return _0x1eb0ba['update']({'data1':_0x2fbcba,'data2':null,'license':null});}}}return _0x1eb0ba;})[_0x79b9('0x10')](function(_0x21ad00){_0x1eb0ba=_0x21ad00;})[_0x79b9('0x11')](function(_0x132595){logger[_0x79b9('0x24')](_0x132595['message']);})[_0x79b9('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0x79b9('0x26')](),_0x1eb0ba);},TIME);});}function defaultLicense(){var _0x299153=hardware[_0x79b9('0x26')]();if(_0x299153){return db[_0x79b9('0x27')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x299153}})[_0x79b9('0x28')](function(_0x380eac,_0x55c74e){logger[_0x79b9('0x16')](_0x79b9('0x29'),_0x299153);manageLicense(_0x299153,_0x380eac);})['catch'](function(_0x5364de){logger[_0x79b9('0x24')](_0x5364de[_0x79b9('0x2a')]);});}}exports[_0x79b9('0x2b')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 1970e25..dbc89a4 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 _0x8086=['changed','disabled','message','then','sequelize','role','count','admin','telephone','users','telephones','forEach','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults','catch','uuid','data1','License\x20key\x20value\x20not\x20found','decryptString','format','%s:%s:%s','machineUuid','gray','deadline','add','days','grayReason'];(function(_0x2a725c,_0x3b0a65){var _0x57cf40=function(_0xd338e9){while(--_0xd338e9){_0x2a725c['push'](_0x2a725c['shift']());}};_0x57cf40(++_0x3b0a65);}(_0x8086,0x93));var _0x6808=function(_0x505de9,_0x1a2186){_0x505de9=_0x505de9-0x0;var _0x3b23f7=_0x8086[_0x505de9];return _0x3b23f7;};'use strict';var util=require(_0x6808('0x0'));var _=require(_0x6808('0x1'));var moment=require(_0x6808('0x2'));var BPromise=require(_0x6808('0x3'));var hardware=require('./hardware');var encryptor=require(_0x6808('0x4'));var db=require(_0x6808('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6808('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6808('0x7'),'machineUuid':hardware[_0x6808('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6808('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6808('0x9'),'machineUuid':hardware[_0x6808('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1e726f){return new BPromise(function(_0x451112,_0x32b1d7){return db['License'][_0x6808('0xa')](_[_0x6808('0xb')](_0x1e726f,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x362976){return checkLicense(_0x362976,null);})['then'](function(_0xa5bb9c){_0x451112(_0xa5bb9c);return;})[_0x6808('0xc')](function(_0x3399b3){_0x32b1d7(_0x3399b3);});});}function checkLicense(_0x1b2183,_0x526c6e){if(!_0x1b2183){demoLicense[_0x6808('0xd')]=_0x1b2183[_0x6808('0xe')];return demoLicense;}try{var _0x7ea52f=_0x526c6e||_0x1b2183['license'];if(_['isEmpty'](_0x7ea52f)){throw new Error(_0x6808('0xf'));}var _0x30bad1=_0x1b2183['data1'];var _0xc59cf9=_0x1b2183['data2'];var _0x114dc4=_0x30bad1['split']('-')[0x4];var _0x291857=_0x30bad1['split']('-')[0x0];var _0x12566d=encryptor[_0x6808('0x10')](_0x7ea52f,util[_0x6808('0x11')](_0x6808('0x12'),_0x114dc4,_0x30bad1,_0x291857));var _0x1a5534=JSON['parse'](_0x12566d);_0x1a5534['demo']=![];_0x1a5534[_0x6808('0xd')]=_0x30bad1;_0x1a5534[_0x6808('0x13')]=hardware[_0x6808('0x8')]();if(_0xc59cf9){var _0x3430a3=encryptor[_0x6808('0x10')](_0xc59cf9);_0x1a5534[_0x6808('0x14')]=_0x3430a3;_0x1a5534[_0x6808('0x15')]=moment(_0x3430a3)[_0x6808('0x16')](0x7,_0x6808('0x17'))['format']();_0x1a5534[_0x6808('0x18')]=_0x1a5534[_0x6808('0xd')]!=_0x1a5534[_0x6808('0x13')]?_0x6808('0x19'):_0x6808('0x1a');}return _0x1a5534;}catch(_0x23ca47){breakingLicense[_0x6808('0xd')]=_0x1b2183[_0x6808('0xe')];breakingLicense[_0x6808('0x1b')]=_0x23ca47['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5178f3,_0x570c4a){getLicense()[_0x6808('0x1c')](function(_0x337e84){return db['User']['findAll']({'attributes':['role',[db[_0x6808('0x1d')]['fn']('COUNT',db['sequelize']['col'](_0x6808('0x1e'))),_0x6808('0x1f')]],'group':'role','where':{'role':{'$or':[_0x6808('0x20'),'user',_0x6808('0x21')]}},'raw':!![]})[_0x6808('0x1c')](function(_0x40b301){var _0x11e0a7={'user':_0x337e84[_0x6808('0x22')]||0x0,'telephone':_0x337e84[_0x6808('0x23')]||0x0};_0x40b301[_0x6808('0x24')](function(_0x1b6290){var _0x8e0355=_0x1b6290['role']===_0x6808('0x20')?_0x6808('0x25'):_0x1b6290[_0x6808('0x1e')];_0x11e0a7[_0x8e0355]-=_0x1b6290['count'];if(_0x11e0a7[_0x8e0355]<0x0)_0x11e0a7[_0x8e0355]=0x0;});_0x5178f3(_0x11e0a7);return;});})[_0x6808('0xc')](function(_0x1728e1){_0x570c4a(_0x1728e1);});});}function checkUserLimits(_0x16ca80){return new BPromise(function(_0x319d36,_0x36cc7e){getLimits()[_0x6808('0x1c')](function(_0x2ba77c){var _0x53377b=_[_0x6808('0x26')](_[_0x6808('0x27')](_0x16ca80,_0x6808('0x1e')),['admin',_0x6808('0x25'),_0x6808('0x21')]);var _0x223a82=(_0x53377b['admin']||0x0)+(_0x53377b[_0x6808('0x25')]||0x0);var _0x50c22f=_0x53377b[_0x6808('0x21')]||0x0;if(_0x223a82>_0x2ba77c[_0x6808('0x25')])return _0x36cc7e(_0x6808('0x28'));if(_0x50c22f>_0x2ba77c[_0x6808('0x21')])return _0x36cc7e(_0x6808('0x29'));return _0x319d36();})[_0x6808('0xc')](function(_0x3052c1){_0x36cc7e(_0x3052c1);});});}module[_0x6808('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x1674=['COUNT','col','telephone','users','telephones','forEach','user','count','pick','admin','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch','uuid','license','isEmpty','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','gray','deadline','days','grayReason','machineUuid','disabled','message','User','findAll','role','sequelize'];(function(_0xffe902,_0x21dc31){var _0x569b2c=function(_0x4bc865){while(--_0x4bc865){_0xffe902['push'](_0xffe902['shift']());}};_0x569b2c(++_0x21dc31);}(_0x1674,0x9c));var _0x4167=function(_0x15f236,_0x59a12b){_0x15f236=_0x15f236-0x0;var _0x3645c0=_0x1674[_0x15f236];return _0x3645c0;};'use strict';var util=require(_0x4167('0x0'));var _=require(_0x4167('0x1'));var moment=require(_0x4167('0x2'));var BPromise=require(_0x4167('0x3'));var hardware=require(_0x4167('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x4167('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4167('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x4167('0x7'),'machineUuid':hardware[_0x4167('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4167('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x525b86){return new BPromise(function(_0x1e66dc,_0x27d8e9){return db[_0x4167('0x9')][_0x4167('0xa')](_[_0x4167('0xb')](_0x525b86,{'raw':!![],'where':{'id':0x1}}))[_0x4167('0xc')](function(_0x26dd81){return checkLicense(_0x26dd81,null);})[_0x4167('0xc')](function(_0x2b55b5){_0x1e66dc(_0x2b55b5);return;})[_0x4167('0xd')](function(_0x2944b5){_0x27d8e9(_0x2944b5);});});}function checkLicense(_0x2647b8,_0x58d526){if(!_0x2647b8){demoLicense[_0x4167('0xe')]=_0x2647b8['data1'];return demoLicense;}try{var _0x28bcf3=_0x58d526||_0x2647b8[_0x4167('0xf')];if(_[_0x4167('0x10')](_0x28bcf3)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x32b15d=_0x2647b8[_0x4167('0x11')];var _0x427471=_0x2647b8[_0x4167('0x12')];var _0x5527c5=_0x32b15d['split']('-')[0x4];var _0xda4f6b=_0x32b15d[_0x4167('0x13')]('-')[0x0];var _0x3acfbb=encryptor[_0x4167('0x14')](_0x28bcf3,util[_0x4167('0x15')](_0x4167('0x16'),_0x5527c5,_0x32b15d,_0xda4f6b));var _0xeca185=JSON[_0x4167('0x17')](_0x3acfbb);_0xeca185[_0x4167('0x18')]=![];_0xeca185[_0x4167('0xe')]=_0x32b15d;_0xeca185['machineUuid']=hardware[_0x4167('0x8')]();if(_0x427471){var _0x4ad062=encryptor[_0x4167('0x14')](_0x427471);_0xeca185[_0x4167('0x19')]=_0x4ad062;_0xeca185[_0x4167('0x1a')]=moment(_0x4ad062)['add'](0x7,_0x4167('0x1b'))[_0x4167('0x15')]();_0xeca185[_0x4167('0x1c')]=_0xeca185[_0x4167('0xe')]!=_0xeca185[_0x4167('0x1d')]?'changed':_0x4167('0x1e');}return _0xeca185;}catch(_0x4c4afe){breakingLicense['uuid']=_0x2647b8[_0x4167('0x11')];breakingLicense[_0x4167('0x1f')]=_0x4c4afe[_0x4167('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4bc181,_0x54e82e){getLicense()[_0x4167('0xc')](function(_0x46b2da){return db[_0x4167('0x20')][_0x4167('0x21')]({'attributes':[_0x4167('0x22'),[db[_0x4167('0x23')]['fn'](_0x4167('0x24'),db['sequelize'][_0x4167('0x25')](_0x4167('0x22'))),'count']],'group':_0x4167('0x22'),'where':{'role':{'$or':['admin','user',_0x4167('0x26')]}},'raw':!![]})[_0x4167('0xc')](function(_0x3e0b95){var _0xfcf42f={'user':_0x46b2da[_0x4167('0x27')]||0x0,'telephone':_0x46b2da[_0x4167('0x28')]||0x0};_0x3e0b95[_0x4167('0x29')](function(_0x4acabb){var _0x46bab1=_0x4acabb[_0x4167('0x22')]==='admin'?_0x4167('0x2a'):_0x4acabb[_0x4167('0x22')];_0xfcf42f[_0x46bab1]-=_0x4acabb[_0x4167('0x2b')];if(_0xfcf42f[_0x46bab1]<0x0)_0xfcf42f[_0x46bab1]=0x0;});_0x4bc181(_0xfcf42f);return;});})[_0x4167('0xd')](function(_0x134233){_0x54e82e(_0x134233);});});}function checkUserLimits(_0xc264ea){return new BPromise(function(_0xa37ad3,_0x5a95b4){getLimits()['then'](function(_0x433693){var _0x456c61=_[_0x4167('0x2c')](_['countBy'](_0xc264ea,_0x4167('0x22')),[_0x4167('0x2d'),_0x4167('0x2a'),'telephone']);var _0x23e55e=(_0x456c61[_0x4167('0x2d')]||0x0)+(_0x456c61[_0x4167('0x2a')]||0x0);var _0x3d3512=_0x456c61[_0x4167('0x26')]||0x0;if(_0x23e55e>_0x433693[_0x4167('0x2a')])return _0x5a95b4('License\x20limit\x20reached\x20for\x20users');if(_0x3d3512>_0x433693['telephone'])return _0x5a95b4(_0x4167('0x2e'));return _0xa37ad3();})[_0x4167('0xd')](function(_0xbd47fb){_0x5a95b4(_0xbd47fb);});});}module[_0x4167('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index dbd4445..e8c03ea 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 _0x8952=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8952,0x17e));var _0x2895=function(_0x27c2ac,_0x3c31d0){_0x27c2ac=_0x27c2ac-0x0;var _0x5b9fd5=_0x8952[_0x27c2ac];return _0x5b9fd5;};'use strict';module['exports']={'DOMAIN':_0x2895('0x0'),'SESSION_SECRET':_0x2895('0x1'),'GOOGLE_ID':_0x2895('0x2'),'GOOGLE_SECRET':_0x2895('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x5b12=['http://localhost:9000','myappanuglar-secret','secret','exports'];(function(_0x21c2eb,_0x48fa0e){var _0x3eff17=function(_0x930284){while(--_0x930284){_0x21c2eb['push'](_0x21c2eb['shift']());}};_0x3eff17(++_0x48fa0e);}(_0x5b12,0xa3));var _0x25b1=function(_0x5f2f1f,_0x2cb37c){_0x5f2f1f=_0x5f2f1f-0x0;var _0x1903c7=_0x5b12[_0x5f2f1f];return _0x1903c7;};'use strict';module[_0x25b1('0x0')]={'DOMAIN':_0x25b1('0x1'),'SESSION_SECRET':_0x25b1('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x25b1('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index f189ef3..e7c25cd 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5fc=['fileLogger','exports','../utils/loggers'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd5fc,0xe6));var _0xcd5f=function(_0x33fbe7,_0x40d8a8){_0x33fbe7=_0x33fbe7-0x0;var _0x231e1f=_0xd5fc[_0x33fbe7];return _0x231e1f;};'use strict';var fileLogger=require(_0xcd5f('0x0'))[_0xcd5f('0x1')];module[_0xcd5f('0x2')]=fileLogger; \ No newline at end of file +var _0x427c=['fileLogger','exports','../utils/loggers'];(function(_0x43f98a,_0xb8241e){var _0x54e647=function(_0x2f2c8a){while(--_0x2f2c8a){_0x43f98a['push'](_0x43f98a['shift']());}};_0x54e647(++_0xb8241e);}(_0x427c,0x1e8));var _0xc427=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x427c[_0x321bb2];return _0x9c12ed;};'use strict';var fileLogger=require(_0xc427('0x0'))[_0xc427('0x1')];module[_0xc427('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 52f4f49..8d60908 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 _0xa421=['../../services/ami/index.js','email','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','join','root','legacy-libs','../../services/express/index.js'];(function(_0xb2be7b,_0x48f626){var _0x13245f=function(_0x59d386){while(--_0x59d386){_0xb2be7b['push'](_0xb2be7b['shift']());}};_0x13245f(++_0x48f626);}(_0xa421,0x132));var _0x1a42=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xa421[_0x494d1f];return _0x457b6e;};'use strict';var path=require(_0x1a42('0x0'));var cfg=require(_0x1a42('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x1a42('0x2')](cfg[_0x1a42('0x3')],_0x1a42('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x1a42('0x2')](__dirname,_0x1a42('0x5')),'env':env},{'name':'ami','script':path['join'](__dirname,_0x1a42('0x6')),'env':env},{'name':'agi','script':path[_0x1a42('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x1a42('0x7'),'script':path[_0x1a42('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':'routing','script':path[_0x1a42('0x2')](__dirname,_0x1a42('0x8')),'env':env},{'name':_0x1a42('0x9'),'script':path[_0x1a42('0x2')](__dirname,_0x1a42('0xa')),'env':env}]};module[_0x1a42('0xb')]=pm2config; \ No newline at end of file +var _0x0ebe=['../../services/express/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','resolve','join','root','legacy-libs'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0ebe,0x175));var _0xe0eb=function(_0xc4145c,_0x463cb7){_0xc4145c=_0xc4145c-0x0;var _0x6ddad9=_0x0ebe[_0xc4145c];return _0x6ddad9;};'use strict';var path=require(_0xe0eb('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0xe0eb('0x1')](path[_0xe0eb('0x2')](cfg[_0xe0eb('0x3')],_0xe0eb('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0xe0eb('0x2')](__dirname,_0xe0eb('0x5')),'env':env},{'name':'ami','script':path[_0xe0eb('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0xe0eb('0x6'),'script':path['join'](__dirname,_0xe0eb('0x7')),'env':env},{'name':_0xe0eb('0x8'),'script':path[_0xe0eb('0x2')](__dirname,_0xe0eb('0x9')),'env':env},{'name':_0xe0eb('0xa'),'script':path[_0xe0eb('0x2')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xe0eb('0xb'),'script':path[_0xe0eb('0x2')](__dirname,_0xe0eb('0xc')),'env':env}]};module[_0xe0eb('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 96129d2..f7db7c6 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 _0x71f7=['restart','list','describe','delete','dump','saved','bluebird','./config','connect','connected','start','then','disconnect','stop'];(function(_0x70fa60,_0x1460c0){var _0xa48a63=function(_0x158a8d){while(--_0x158a8d){_0x70fa60['push'](_0x70fa60['shift']());}};_0xa48a63(++_0x1460c0);}(_0x71f7,0xbc));var _0x771f=function(_0x3b340c,_0xa0ae57){_0x3b340c=_0x3b340c-0x0;var _0x3efb6f=_0x71f7[_0x3b340c];return _0x3efb6f;};'use strict';var pm2=require('pm2');var BPromise=require(_0x771f('0x0'));var config=require(_0x771f('0x1'));function connect(){return new BPromise(function(_0x5d036b,_0x5914af){return pm2[_0x771f('0x2')](function(_0xe0dd7c){if(_0xe0dd7c){return _0x5914af(_0xe0dd7c);}return _0x5d036b(_0x771f('0x3'));});});};exports[_0x771f('0x4')]=function(_0x5eded3){return connect()[_0x771f('0x5')](function(){return new BPromise(function(_0x93fa7,_0x143afc){return pm2[_0x771f('0x4')](_0x5eded3,function(_0x47d2bb,_0x458497){if(_0x47d2bb){return _0x143afc(_0x47d2bb);}pm2[_0x771f('0x6')]();return _0x93fa7(_0x458497);});});});};exports[_0x771f('0x7')]=function(_0x3bddf9){return connect()['then'](function(){return new BPromise(function(_0x411066,_0x44710d){return pm2['stop'](_0x3bddf9,function(_0x2f349d,_0x490aa3){if(_0x2f349d){return _0x44710d(_0x2f349d);}pm2[_0x771f('0x6')]();return _0x411066(_0x490aa3);});});});};exports[_0x771f('0x8')]=function(_0x2426d9){return connect()[_0x771f('0x5')](function(){return new BPromise(function(_0x56dc44,_0x2c3724){return pm2['restart'](_0x2426d9,function(_0x23b4aa,_0x14b900){if(_0x23b4aa){return _0x2c3724(_0x23b4aa);}pm2[_0x771f('0x6')]();return _0x56dc44(_0x14b900);});});});};exports[_0x771f('0x9')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1f6404,_0x56236e){return pm2['list'](function(_0x44e456,_0x1db836){if(_0x44e456){return _0x56236e(_0x44e456);}pm2[_0x771f('0x6')]();return _0x1f6404(_0x1db836);});});});};exports['describe']=function(_0x15cfb2){return connect()['then'](function(){return new BPromise(function(_0x35c273,_0x41b493){return pm2[_0x771f('0xa')](_0x15cfb2,function(_0xefb3aa,_0x340066){if(_0xefb3aa){return _0x41b493(_0xefb3aa);}pm2[_0x771f('0x6')]();return _0x35c273(_0x340066);});});});};exports[_0x771f('0xb')]=function(_0x4964ca){return connect()['then'](function(){return new BPromise(function(_0x3816f0,_0x23bc9f){return pm2[_0x771f('0xb')](_0x4964ca,function(_0xc05f2d,_0x32d2ad){if(_0xc05f2d){return _0x23bc9f(_0xc05f2d);}pm2['disconnect']();return _0x3816f0(_0x32d2ad);});});});};exports[_0x771f('0xc')]=function(){return connect()[_0x771f('0x5')](function(){return new BPromise(function(_0x93e39e,_0x3ad705){return pm2[_0x771f('0xc')](function(_0xec8eb0){if(_0xec8eb0){return _0x3ad705(_0xec8eb0);}return _0x93e39e(_0x771f('0xd'));});});});}; \ No newline at end of file +var _0x5872=['describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','stop','restart','disconnect','list'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5872,0xa9));var _0x2587=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0x5872[_0x1ab0e6];return _0x248815;};'use strict';var pm2=require(_0x2587('0x0'));var BPromise=require(_0x2587('0x1'));var config=require(_0x2587('0x2'));function connect(){return new BPromise(function(_0x3f6786,_0x188e21){return pm2[_0x2587('0x3')](function(_0x5ae48d){if(_0x5ae48d){return _0x188e21(_0x5ae48d);}return _0x3f6786(_0x2587('0x4'));});});};exports[_0x2587('0x5')]=function(_0x4dd011){return connect()[_0x2587('0x6')](function(){return new BPromise(function(_0x140562,_0x5500e2){return pm2[_0x2587('0x5')](_0x4dd011,function(_0x6a7b97,_0x373cfb){if(_0x6a7b97){return _0x5500e2(_0x6a7b97);}pm2['disconnect']();return _0x140562(_0x373cfb);});});});};exports['stop']=function(_0x26e7cb){return connect()['then'](function(){return new BPromise(function(_0x55bc42,_0x4c03cc){return pm2[_0x2587('0x7')](_0x26e7cb,function(_0x2e5a1d,_0x3ff3c8){if(_0x2e5a1d){return _0x4c03cc(_0x2e5a1d);}pm2['disconnect']();return _0x55bc42(_0x3ff3c8);});});});};exports[_0x2587('0x8')]=function(_0x12b204){return connect()[_0x2587('0x6')](function(){return new BPromise(function(_0x393bf8,_0x5a09ca){return pm2[_0x2587('0x8')](_0x12b204,function(_0x314861,_0x11a8e7){if(_0x314861){return _0x5a09ca(_0x314861);}pm2[_0x2587('0x9')]();return _0x393bf8(_0x11a8e7);});});});};exports[_0x2587('0xa')]=function(){return connect()[_0x2587('0x6')](function(){return new BPromise(function(_0x54581b,_0x4616cc){return pm2['list'](function(_0x38a5f3,_0x3870a2){if(_0x38a5f3){return _0x4616cc(_0x38a5f3);}pm2['disconnect']();return _0x54581b(_0x3870a2);});});});};exports[_0x2587('0xb')]=function(_0x4aafeb){return connect()[_0x2587('0x6')](function(){return new BPromise(function(_0x23d2b6,_0x3d5d13){return pm2[_0x2587('0xb')](_0x4aafeb,function(_0x3c5834,_0x4716ed){if(_0x3c5834){return _0x3d5d13(_0x3c5834);}pm2[_0x2587('0x9')]();return _0x23d2b6(_0x4716ed);});});});};exports[_0x2587('0xc')]=function(_0x282677){return connect()['then'](function(){return new BPromise(function(_0x1587f9,_0x2aa046){return pm2[_0x2587('0xc')](_0x282677,function(_0x72ee0b,_0x1596f8){if(_0x72ee0b){return _0x2aa046(_0x72ee0b);}pm2[_0x2587('0x9')]();return _0x1587f9(_0x1596f8);});});});};exports['dump']=function(){return connect()[_0x2587('0x6')](function(){return new BPromise(function(_0x259807,_0x3cd722){return pm2[_0x2587('0xd')](function(_0x43b9a3){if(_0x43b9a3){return _0x3cd722(_0x43b9a3);}return _0x259807(_0x2587('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 6a4c0a9..bcbbfdd 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 _0x8ec3=['minutes','then','map','[CHAT]\x20Interactions\x20to\x20close:','join','system','YYYY-MM-DD\x20HH:mm:ss','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','util','../../mysqldb','redis','defaults','localhost','Setting','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x8ec3,0x85));var _0x38ec=function(_0x40168a,_0x47eef7){_0x40168a=_0x40168a-0x0;var _0xc738de=_0x8ec3[_0x40168a];return _0xc738de;};'use strict';var _=require('lodash');var moment=require(_0x38ec('0x0'));var Redis=require('ioredis');var util=require(_0x38ec('0x1'));var config=require('../../config/environment');var db=require(_0x38ec('0x2'))['db'];var logger=require('../logger')('schedule');config[_0x38ec('0x3')]=_[_0x38ec('0x4')](config[_0x38ec('0x3')],{'host':_0x38ec('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x38ec('0x3')]));function closeInteractions(){var _0x1fc77e=0x0;var _0x26397e=[];return db[_0x38ec('0x6')]['find']({'raw':!![],'attributes':['id',_0x38ec('0x7')],'where':{'id':0x1}})['then'](function(_0x3df44a){_0x1fc77e=_0x3df44a[_0x38ec('0x7')];if(_0x1fc77e){return db[_0x38ec('0x8')][_0x38ec('0x9')]({'raw':!![],'attributes':['id',_0x38ec('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x38ec('0xb')](_0x3df44a[_0x38ec('0x7')],_0x38ec('0xc'))}}});}else{return[];}})[_0x38ec('0xd')](function(_0x1059e6){if(_0x1059e6&&_0x1059e6['length']){_0x26397e=_[_0x38ec('0xe')](_0x1059e6||[],'id');logger['info'](_0x38ec('0xf'),_0x26397e[_0x38ec('0x10')]());return db[_0x38ec('0x8')]['update']({'closeReason':_0x38ec('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x38ec('0x12'))},{'where':{'id':_0x26397e}});}})[_0x38ec('0xd')](function(){if(_0x26397e&&_0x26397e[_0x38ec('0x13')]){logger[_0x38ec('0x14')](_0x38ec('0x15'),_0x26397e[_0x38ec('0x10')]());for(var _0xee654d=0x0;_0xee654d<_0x26397e[_0x38ec('0x13')];_0xee654d++){io[_0x38ec('0x16')](_0x38ec('0x17'),{'id':_0x26397e[_0xee654d],'closed':!![]});}}})[_0x38ec('0x18')](function(_0x302526){logger[_0x38ec('0x19')](_0x38ec('0x1a'),_0x302526?util[_0x38ec('0x1b')](_0x302526,{'showHidden':![],'depth':null}):'');});}exports[_0x38ec('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9601=['catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x9601,0x13f));var _0x1960=function(_0x18522f,_0x5aaa5c){_0x18522f=_0x18522f-0x0;var _0x31fbcc=_0x9601[_0x18522f];return _0x31fbcc;};'use strict';var _=require('lodash');var moment=require(_0x1960('0x0'));var Redis=require(_0x1960('0x1'));var util=require(_0x1960('0x2'));var config=require('../../config/environment');var db=require(_0x1960('0x3'))['db'];var logger=require(_0x1960('0x4'))(_0x1960('0x5'));config[_0x1960('0x6')]=_[_0x1960('0x7')](config['redis'],{'host':_0x1960('0x8'),'port':0x18eb});var io=require(_0x1960('0x9'))(new Redis(config[_0x1960('0x6')]));function closeInteractions(){var _0x21a48=0x0;var _0x423103=[];return db[_0x1960('0xa')][_0x1960('0xb')]({'raw':!![],'attributes':['id',_0x1960('0xc')],'where':{'id':0x1}})[_0x1960('0xd')](function(_0x2a4728){_0x21a48=_0x2a4728[_0x1960('0xc')];if(_0x21a48){return db[_0x1960('0xe')][_0x1960('0xf')]({'raw':!![],'attributes':['id',_0x1960('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x1960('0x11')](_0x2a4728[_0x1960('0xc')],_0x1960('0x12'))}}});}else{return[];}})[_0x1960('0xd')](function(_0x4fecaf){if(_0x4fecaf&&_0x4fecaf[_0x1960('0x13')]){_0x423103=_['map'](_0x4fecaf||[],'id');logger[_0x1960('0x14')](_0x1960('0x15'),_0x423103[_0x1960('0x16')]());return db[_0x1960('0xe')][_0x1960('0x17')]({'closeReason':_0x1960('0x18'),'disposition':_0x1960('0x19'),'closed':!![],'closedAt':moment()[_0x1960('0x1a')](_0x1960('0x1b'))},{'where':{'id':_0x423103}});}})['then'](function(){if(_0x423103&&_0x423103[_0x1960('0x13')]){logger[_0x1960('0x14')](_0x1960('0x1c'),_0x423103[_0x1960('0x16')]());for(var _0x2713a7=0x0;_0x2713a7<_0x423103[_0x1960('0x13')];_0x2713a7++){io[_0x1960('0x1d')](_0x1960('0x1e'),{'id':_0x423103[_0x2713a7],'closed':!![]});}}})[_0x1960('0x1f')](function(_0x1ab60c){logger[_0x1960('0x20')](_0x1960('0x21'),_0x1ab60c?util[_0x1960('0x22')](_0x1ab60c,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index d3b5f83..e8da58a 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa290=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x4d6387,_0x3747b4){var _0x2eeea5=function(_0x3ff986){while(--_0x3ff986){_0x4d6387['push'](_0x4d6387['shift']());}};_0x2eeea5(++_0x3747b4);}(_0xa290,0xae));var _0x0a29=function(_0x16fa65,_0x339edc){_0x16fa65=_0x16fa65-0x0;var _0x4ac9d4=_0xa290[_0x16fa65];return _0x4ac9d4;};'use strict';function start(){var _0xae7b11=require(_0x0a29('0x0'));return _0xae7b11['startAllRefreshIntervals']();}module[_0x0a29('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xf535=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x556141,_0x56b516){var _0x5ee4d6=function(_0x1bac79){while(--_0x1bac79){_0x556141['push'](_0x556141['shift']());}};_0x5ee4d6(++_0x56b516);}(_0xf535,0x183));var _0x5f53=function(_0x2cca6a,_0x148243){_0x2cca6a=_0x2cca6a-0x0;var _0x2630cf=_0xf535[_0x2cca6a];return _0x2630cf;};'use strict';function start(){var _0x2f2de6=require(_0x5f53('0x0'));return _0x2f2de6[_0x5f53('0x1')]();}module[_0x5f53('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index e42abc4..e1f49cb 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 _0xbdcb=['index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','basename','extname','zip','status','Sent','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','message','attachments','text','sendIfEmpty','SendMail','error','error\x20mail','email\x20sent','catch','data','Smtp','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','runReport','then','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','jobs','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xbdcb,0x65));var _0xbbdc=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xbdcb[_0x3e5086];return _0xfeb102;};'use strict';var fs=require('fs');var util=require(_0xbbdc('0x0'));var path=require(_0xbbdc('0x1'));var _=require(_0xbbdc('0x2'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0xbbdc('0x3'));var BPromise=require(_0xbbdc('0x4'));var logger=require(_0xbbdc('0x5'))(_0xbbdc('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xbbdc('0x7'));var analyticDefaultReportController=require(_0xbbdc('0x8'));var client=jayson[_0xbbdc('0x9')][_0xbbdc('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4ad59f,_0x2862d1){return function(){logger[_0xbbdc('0xb')](_0xbbdc('0xc'),_0x4ad59f[_0xbbdc('0xd')]);var _0x5dc743=!![];var _0x43494d=_0x4ad59f[_0xbbdc('0xe')][_0xbbdc('0xf')]();var _0x4b9b41={'account':_0x43494d,'message':{'from':util[_0xbbdc('0x10')]('\x22%s\x22\x20<%s>',_0x4ad59f[_0xbbdc('0xe')][_0xbbdc('0x11')],_0x4ad59f[_0xbbdc('0xe')][_0xbbdc('0xd')]||_0x4ad59f[_0xbbdc('0xe')]['Smtp'][_0xbbdc('0x12')]),'to':_0x4ad59f['email'],'cc':_0x4ad59f['cc'],'bcc':_0x4ad59f[_0xbbdc('0x13')],'subject':util[_0xbbdc('0x10')](_0xbbdc('0x14'),_0x2862d1['name'],_0x4ad59f['subtractNumber'],_0x4ad59f[_0xbbdc('0x15')])}};var _0x19626d=path[_0xbbdc('0x16')](__dirname,_0xbbdc('0x17'));var _0x2caf67=_0x2862d1[_0xbbdc('0x18')];var _0x1e3a10=util[_0xbbdc('0x10')]('%s.%s',path[_0xbbdc('0x19')](_0x2862d1['savename'],path[_0xbbdc('0x1a')](_0x2862d1[_0xbbdc('0x18')])),_0xbbdc('0x1b'));var _0x2cebb7=path['join'](_0x19626d,_0x2caf67);var _0x487dca=path[_0xbbdc('0x16')](_0x19626d,_0x1e3a10);if(fs['existsSync'](_0x2cebb7)){_0x2862d1[_0xbbdc('0x1c')]=_0xbbdc('0x1d');_0x4b9b41['message']['attachments']=[{'filename':_0x2caf67,'path':_0x2cebb7}];_0x4b9b41['message']['text']=util[_0xbbdc('0x10')](_0xbbdc('0x1e'),JSON[_0xbbdc('0x1f')](_0x2862d1,null,0x2));}else if(fs[_0xbbdc('0x20')](_0x487dca)){_0x2862d1[_0xbbdc('0x1c')]=_0xbbdc('0x1d');_0x4b9b41[_0xbbdc('0x21')][_0xbbdc('0x22')]=[{'filename':_0x1e3a10,'path':_0x487dca}];}else{_0x4b9b41['message'][_0xbbdc('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x4ad59f[_0xbbdc('0x24')]){_0x5dc743=![];logger[_0xbbdc('0xb')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x5dc743){return client['request'](_0xbbdc('0x25'),_0x4b9b41)['then'](function(_0x14c646){if(_0x14c646[_0xbbdc('0x26')]){return logger[_0xbbdc('0x26')](_0xbbdc('0x27'),JSON[_0xbbdc('0x1f')](_0x14c646));}return logger[_0xbbdc('0xb')](_0xbbdc('0x28'));})[_0xbbdc('0x29')](function(_0x91a70e){return logger[_0xbbdc('0x26')](_0xbbdc('0x27'),JSON['stringify'](_0x91a70e));});}};}function handleError(){return function(_0x29bb78){return logger[_0xbbdc('0x26')](JSON[_0xbbdc('0x1f')](_0x29bb78));};}function handleResult(_0xc72295){return function(_0x251ebb){logger[_0xbbdc('0xb')](_0xbbdc('0x2a'),JSON[_0xbbdc('0x1f')](_0x251ebb));if(_0xc72295[_0xbbdc('0xe')]&&_0xc72295[_0xbbdc('0xe')][_0xbbdc('0x2b')]&&!_['isNil'](_0xc72295['email'])){setTimeout(handleSendEmail(_0xc72295,_0x251ebb),0x3c*0x3e8);}};}function handleJob(_0x598b61){return function(){try{if(_[_0xbbdc('0x2c')](_0x598b61[_0xbbdc('0x2d')])){return logger[_0xbbdc('0xb')](_0xbbdc('0x2e'));}if(_['isNil'](_0x598b61['subtractUnit'])){return logger['info'](_0xbbdc('0x2f'));}var _0x5b3dcd={'startDate':moment()[_0xbbdc('0x30')](_0x598b61[_0xbbdc('0x2d')],_0x598b61[_0xbbdc('0x15')])['format'](_0xbbdc('0x31')),'endDate':moment()[_0xbbdc('0x10')](_0xbbdc('0x31')),'type':_0xbbdc('0x32'),'output':_0x598b61['output'],'name':_0x598b61['name']};if(!_['isNil'](_0x598b61[_0xbbdc('0x33')])){logger[_0xbbdc('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x598b61[_0xbbdc('0x33')]);return analyticDefaultReportController[_0xbbdc('0x34')]({'id':_0x598b61[_0xbbdc('0x33')]},_0x5b3dcd)[_0xbbdc('0x35')](handleResult(_0x598b61))['catch'](handleError());}if(!_['isNil'](_0x598b61[_0xbbdc('0x36')])){logger[_0xbbdc('0xb')]('exec\x20custom\x20report\x20id:%s',_0x598b61['CustomReportId']);return analyticCustomReportController[_0xbbdc('0x34')]({'id':_0x598b61[_0xbbdc('0x36')]},_0x5b3dcd)[_0xbbdc('0x35')](handleResult(_0x598b61))[_0xbbdc('0x29')](handleError());}}catch(_0x12ae9b){logger[_0xbbdc('0x26')](JSON['stringify'](_0x12ae9b));}return logger[_0xbbdc('0xb')](_0xbbdc('0x37'));};}function getJobs(_0x300295){var _0x327927={};if(_0x300295){_0x327927['id']=_0x300295;}return db[_0xbbdc('0x38')]['findAll']({'where':_0x327927,'include':[{'model':db[_0xbbdc('0xe')],'attributes':['id',_0xbbdc('0x11'),_0xbbdc('0xd')],'include':[{'model':db[_0xbbdc('0x39')],'as':_0xbbdc('0x2b'),'include':[{'model':db[_0xbbdc('0x3a')],'as':'CloudProvider'}]}]}]})[_0xbbdc('0x35')](function(_0x276ba2){var _0x27a11c=_[_0xbbdc('0x3b')](manager[_0xbbdc('0x3c')]);var _0x224e08=_['map'](_0x276ba2,function(_0x117d55){return _0x117d55['id'][_0xbbdc('0x3d')]();});var _0x1be81a=_[_0xbbdc('0x3e')](_0x276ba2,function(_0x11d91e){return _0x11d91e['id'][_0xbbdc('0x3d')]();});var _0x4727cd=_0x300295?_0x224e08:_[_0xbbdc('0x3f')](_0x224e08,_0x27a11c);var _0x5b5156=_[_0xbbdc('0x40')](_0x224e08,_0x27a11c);var _0x918f2=_[_0xbbdc('0x3f')](_0x27a11c,_0x224e08);var _0x4be9b3;var _0x6d8848;for(_0x4be9b3=0x0;_0x4be9b3<_0x918f2[_0xbbdc('0x41')]&&!_0x300295;_0x4be9b3+=0x1){_0x6d8848=_0x918f2[_0x4be9b3][_0xbbdc('0x3d')]();if(manager[_0xbbdc('0x42')](_0x6d8848)){manager[_0xbbdc('0x43')](_0x6d8848);manager[_0xbbdc('0x44')](_0x6d8848);logger[_0xbbdc('0xb')](_0xbbdc('0x45'),_0x6d8848);}}logger[_0xbbdc('0xb')](_0xbbdc('0x46'),JSON[_0xbbdc('0x1f')](_0x4727cd));for(_0x4be9b3=0x0;_0x4be9b3<_0x4727cd[_0xbbdc('0x41')];_0x4be9b3+=0x1){_0x6d8848=_0x4727cd[_0x4be9b3][_0xbbdc('0x3d')]();logger['info'](_0xbbdc('0x47'),_0x6d8848);if(_0x300295){logger[_0xbbdc('0xb')](_0xbbdc('0x48'),_0x300295);logger[_0xbbdc('0xb')](JSON[_0xbbdc('0x1f')](_0x1be81a[_0x6d8848]));BPromise[_0xbbdc('0x49')]()[_0xbbdc('0x35')](handleJob(_0x1be81a[_0x6d8848]));logger[_0xbbdc('0xb')](_0xbbdc('0x4a'),_0x1be81a[_0x6d8848][_0xbbdc('0x11')],_0x1be81a[_0x6d8848][_0xbbdc('0x4b')]);}else if(_0x1be81a[_0x6d8848][_0xbbdc('0x4b')]&&_0x1be81a[_0x6d8848][_0xbbdc('0x4c')]&&moment()[_0xbbdc('0x4d')](_0x1be81a[_0x6d8848][_0xbbdc('0x4e')],_0x1be81a[_0x6d8848][_0xbbdc('0x4f')])){manager['add'](_0x6d8848,_0x1be81a[_0x6d8848][_0xbbdc('0x4b')],handleJob(_0x1be81a[_0x6d8848]));manager[_0xbbdc('0x50')](_0x6d8848);logger[_0xbbdc('0xb')](_0xbbdc('0x51'),_0x1be81a[_0x6d8848][_0xbbdc('0x11')],_0x1be81a[_0x6d8848][_0xbbdc('0x4b')]);}else if(manager['exists'](_0x6d8848)){manager[_0xbbdc('0x43')](_0x6d8848);manager[_0xbbdc('0x44')](_0x6d8848);logger[_0xbbdc('0xb')](_0xbbdc('0x52'),_0x1be81a[_0x6d8848][_0xbbdc('0x11')],_0x1be81a[_0x6d8848][_0xbbdc('0x4b')]);}}for(_0x4be9b3=0x0,_0x6d8848;_0x4be9b3<_0x5b5156[_0xbbdc('0x41')]&&!_0x300295;_0x4be9b3+=0x1){_0x6d8848=_0x5b5156[_0x4be9b3][_0xbbdc('0x3d')]();if(manager['exists'](_0x6d8848)){if(_0x1be81a[_0x6d8848]['cron']&&_0x1be81a[_0x6d8848][_0xbbdc('0x4c')]&&moment()['isBetween'](_0x1be81a[_0x6d8848][_0xbbdc('0x4e')],_0x1be81a[_0x6d8848][_0xbbdc('0x4f')])){manager[_0xbbdc('0x53')](_0x6d8848,_0x1be81a[_0x6d8848]['cron'],handleJob(_0x1be81a[_0x6d8848]));logger[_0xbbdc('0xb')](_0xbbdc('0x54'),_0x1be81a[_0x6d8848][_0xbbdc('0x11')],_0x1be81a[_0x6d8848]['cron']);}else{manager[_0xbbdc('0x43')](_0x6d8848);manager[_0xbbdc('0x44')](_0x6d8848);logger['info'](_0xbbdc('0x52'),_0x1be81a[_0x6d8848][_0xbbdc('0x11')],_0x1be81a[_0x6d8848][_0xbbdc('0x4b')]);}}}})[_0xbbdc('0x29')](function(_0x70e8f5){logger[_0xbbdc('0x26')](JSON[_0xbbdc('0x1f')](_0x70e8f5));});}exports[_0xbbdc('0x55')]=function(_0xe4c2cf){return getJobs(_0xe4c2cf);};exports[_0xbbdc('0x50')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x8c9d=['startAt','add','start','add\x20cron','stop','length','active','isBetween','endAt','update','update\x20cron','stop\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','savename','%s.%s','basename','extname','zip','existsSync','status','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','info','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','Smtp','CloudProvider','keys','jobs','map','toString','intersection','difference','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0x8c9d,0x171));var _0xd8c9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8c9d[_0xa464c9];return _0x3d73c4;};'use strict';var fs=require('fs');var util=require(_0xd8c9('0x0'));var path=require('path');var _=require(_0xd8c9('0x1'));var moment=require(_0xd8c9('0x2'));var CronJobManager=require(_0xd8c9('0x3'));var jayson=require(_0xd8c9('0x4'));var BPromise=require(_0xd8c9('0x5'));var logger=require(_0xd8c9('0x6'))(_0xd8c9('0x7'));var db=require(_0xd8c9('0x8'))['db'];var analyticCustomReportController=require(_0xd8c9('0x9'));var analyticDefaultReportController=require(_0xd8c9('0xa'));var client=jayson[_0xd8c9('0xb')][_0xd8c9('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xdcfb77,_0x46351e){return function(){logger['info'](_0xd8c9('0xd'),_0xdcfb77[_0xd8c9('0xe')]);var _0x54a542=!![];var _0x380de0=_0xdcfb77[_0xd8c9('0xf')][_0xd8c9('0x10')]();var _0x3b67c9={'account':_0x380de0,'message':{'from':util['format'](_0xd8c9('0x11'),_0xdcfb77[_0xd8c9('0xf')]['name'],_0xdcfb77['MailAccount'][_0xd8c9('0xe')]||_0xdcfb77[_0xd8c9('0xf')]['Smtp'][_0xd8c9('0x12')]),'to':_0xdcfb77['email'],'cc':_0xdcfb77['cc'],'bcc':_0xdcfb77[_0xd8c9('0x13')],'subject':util[_0xd8c9('0x14')](_0xd8c9('0x15'),_0x46351e[_0xd8c9('0x16')],_0xdcfb77[_0xd8c9('0x17')],_0xdcfb77['subtractUnit'])}};var _0x287c08=path[_0xd8c9('0x18')](__dirname,'../../files/reports');var _0x27e335=_0x46351e[_0xd8c9('0x19')];var _0x7c2598=util[_0xd8c9('0x14')](_0xd8c9('0x1a'),path[_0xd8c9('0x1b')](_0x46351e[_0xd8c9('0x19')],path[_0xd8c9('0x1c')](_0x46351e[_0xd8c9('0x19')])),_0xd8c9('0x1d'));var _0x11aa59=path['join'](_0x287c08,_0x27e335);var _0x1302f9=path['join'](_0x287c08,_0x7c2598);if(fs[_0xd8c9('0x1e')](_0x11aa59)){_0x46351e[_0xd8c9('0x1f')]='Sent';_0x3b67c9[_0xd8c9('0x20')][_0xd8c9('0x21')]=[{'filename':_0x27e335,'path':_0x11aa59}];_0x3b67c9['message']['text']=util['format'](_0xd8c9('0x22'),JSON[_0xd8c9('0x23')](_0x46351e,null,0x2));}else if(fs[_0xd8c9('0x1e')](_0x1302f9)){_0x46351e[_0xd8c9('0x1f')]=_0xd8c9('0x24');_0x3b67c9[_0xd8c9('0x20')][_0xd8c9('0x21')]=[{'filename':_0x7c2598,'path':_0x1302f9}];}else{_0x3b67c9[_0xd8c9('0x20')][_0xd8c9('0x25')]=_0xd8c9('0x26');if(!_0xdcfb77['sendIfEmpty']){_0x54a542=![];logger['info'](_0xd8c9('0x27'));}}if(_0x54a542){return client['request'](_0xd8c9('0x28'),_0x3b67c9)[_0xd8c9('0x29')](function(_0x4bc793){if(_0x4bc793[_0xd8c9('0x2a')]){return logger[_0xd8c9('0x2a')](_0xd8c9('0x2b'),JSON[_0xd8c9('0x23')](_0x4bc793));}return logger['info']('email\x20sent');})['catch'](function(_0x478a84){return logger[_0xd8c9('0x2a')](_0xd8c9('0x2b'),JSON[_0xd8c9('0x23')](_0x478a84));});}};}function handleError(){return function(_0x290072){return logger[_0xd8c9('0x2a')](JSON[_0xd8c9('0x23')](_0x290072));};}function handleResult(_0x319095){return function(_0x17e8a8){logger[_0xd8c9('0x2c')](_0xd8c9('0x2d'),JSON[_0xd8c9('0x23')](_0x17e8a8));if(_0x319095['MailAccount']&&_0x319095[_0xd8c9('0xf')]['Smtp']&&!_[_0xd8c9('0x2e')](_0x319095[_0xd8c9('0xe')])){setTimeout(handleSendEmail(_0x319095,_0x17e8a8),0x3c*0x3e8);}};}function handleJob(_0x44a65f){return function(){try{if(_[_0xd8c9('0x2e')](_0x44a65f[_0xd8c9('0x17')])){return logger[_0xd8c9('0x2c')](_0xd8c9('0x2f'));}if(_['isNil'](_0x44a65f[_0xd8c9('0x30')])){return logger['info'](_0xd8c9('0x31'));}var _0x2e5b59={'startDate':moment()['subtract'](_0x44a65f[_0xd8c9('0x17')],_0x44a65f['subtractUnit'])[_0xd8c9('0x14')](_0xd8c9('0x32')),'endDate':moment()[_0xd8c9('0x14')](_0xd8c9('0x32')),'type':_0xd8c9('0x33'),'output':_0x44a65f[_0xd8c9('0x34')],'name':_0x44a65f[_0xd8c9('0x16')]};if(!_[_0xd8c9('0x2e')](_0x44a65f[_0xd8c9('0x35')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x44a65f['DefaultReportId']);return analyticDefaultReportController[_0xd8c9('0x36')]({'id':_0x44a65f[_0xd8c9('0x35')]},_0x2e5b59)['then'](handleResult(_0x44a65f))[_0xd8c9('0x37')](handleError());}if(!_[_0xd8c9('0x2e')](_0x44a65f[_0xd8c9('0x38')])){logger[_0xd8c9('0x2c')](_0xd8c9('0x39'),_0x44a65f[_0xd8c9('0x38')]);return analyticCustomReportController[_0xd8c9('0x36')]({'id':_0x44a65f[_0xd8c9('0x38')]},_0x2e5b59)['then'](handleResult(_0x44a65f))['catch'](handleError());}}catch(_0x38108a){logger[_0xd8c9('0x2a')](JSON['stringify'](_0x38108a));}return logger[_0xd8c9('0x2c')]('no\x20report\x20id');};}function getJobs(_0x16059e){var _0x10b52d={};if(_0x16059e){_0x10b52d['id']=_0x16059e;}return db[_0xd8c9('0x3a')][_0xd8c9('0x3b')]({'where':_0x10b52d,'include':[{'model':db['MailAccount'],'attributes':['id',_0xd8c9('0x16'),_0xd8c9('0xe')],'include':[{'model':db['MailServerOut'],'as':_0xd8c9('0x3c'),'include':[{'model':db[_0xd8c9('0x3d')],'as':'CloudProvider'}]}]}]})[_0xd8c9('0x29')](function(_0x537924){var _0x71a5f5=_[_0xd8c9('0x3e')](manager[_0xd8c9('0x3f')]);var _0x488b09=_[_0xd8c9('0x40')](_0x537924,function(_0x33a1a3){return _0x33a1a3['id'][_0xd8c9('0x41')]();});var _0x1cb7e3=_['keyBy'](_0x537924,function(_0x12193c){return _0x12193c['id'][_0xd8c9('0x41')]();});var _0x46a15c=_0x16059e?_0x488b09:_['difference'](_0x488b09,_0x71a5f5);var _0xcc0a84=_[_0xd8c9('0x42')](_0x488b09,_0x71a5f5);var _0x14b65e=_[_0xd8c9('0x43')](_0x71a5f5,_0x488b09);var _0x183370;var _0x3f5cf0;for(_0x183370=0x0;_0x183370<_0x14b65e['length']&&!_0x16059e;_0x183370+=0x1){_0x3f5cf0=_0x14b65e[_0x183370][_0xd8c9('0x41')]();if(manager[_0xd8c9('0x44')](_0x3f5cf0)){manager['stop'](_0x3f5cf0);manager[_0xd8c9('0x45')](_0x3f5cf0);logger['info'](_0xd8c9('0x46'),_0x3f5cf0);}}logger[_0xd8c9('0x2c')](_0xd8c9('0x47'),JSON[_0xd8c9('0x23')](_0x46a15c));for(_0x183370=0x0;_0x183370<_0x46a15c['length'];_0x183370+=0x1){_0x3f5cf0=_0x46a15c[_0x183370]['toString']();logger[_0xd8c9('0x2c')](_0xd8c9('0x48'),_0x3f5cf0);if(_0x16059e){logger[_0xd8c9('0x2c')](_0xd8c9('0x49'),_0x16059e);logger['info'](JSON[_0xd8c9('0x23')](_0x1cb7e3[_0x3f5cf0]));BPromise['resolve']()['then'](handleJob(_0x1cb7e3[_0x3f5cf0]));logger['info'](_0xd8c9('0x4a'),_0x1cb7e3[_0x3f5cf0]['name'],_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x4b')]);}else if(_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x4b')]&&_0x1cb7e3[_0x3f5cf0]['active']&&moment()['isBetween'](_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x4c')],_0x1cb7e3[_0x3f5cf0]['endAt'])){manager[_0xd8c9('0x4d')](_0x3f5cf0,_0x1cb7e3[_0x3f5cf0]['cron'],handleJob(_0x1cb7e3[_0x3f5cf0]));manager[_0xd8c9('0x4e')](_0x3f5cf0);logger[_0xd8c9('0x2c')](_0xd8c9('0x4f'),_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x16')],_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x4b')]);}else if(manager[_0xd8c9('0x44')](_0x3f5cf0)){manager[_0xd8c9('0x50')](_0x3f5cf0);manager[_0xd8c9('0x45')](_0x3f5cf0);logger[_0xd8c9('0x2c')]('stop\x20cron',_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x16')],_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x4b')]);}}for(_0x183370=0x0,_0x3f5cf0;_0x183370<_0xcc0a84[_0xd8c9('0x51')]&&!_0x16059e;_0x183370+=0x1){_0x3f5cf0=_0xcc0a84[_0x183370][_0xd8c9('0x41')]();if(manager['exists'](_0x3f5cf0)){if(_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x4b')]&&_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x52')]&&moment()[_0xd8c9('0x53')](_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x4c')],_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x54')])){manager[_0xd8c9('0x55')](_0x3f5cf0,_0x1cb7e3[_0x3f5cf0]['cron'],handleJob(_0x1cb7e3[_0x3f5cf0]));logger[_0xd8c9('0x2c')](_0xd8c9('0x56'),_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x16')],_0x1cb7e3[_0x3f5cf0]['cron']);}else{manager[_0xd8c9('0x50')](_0x3f5cf0);manager['deleteJob'](_0x3f5cf0);logger[_0xd8c9('0x2c')](_0xd8c9('0x57'),_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x16')],_0x1cb7e3[_0x3f5cf0][_0xd8c9('0x4b')]);}}}})[_0xd8c9('0x37')](function(_0x4222bf){logger['error'](JSON[_0xd8c9('0x23')](_0x4222bf));});}exports[_0xd8c9('0x58')]=function(_0x52ff45){return getJobs(_0x52ff45);};exports[_0xd8c9('0x4e')]=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 34d1952..227d406 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 _0x7e05=['Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20configured','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','start','lodash','aws-sdk','util','../../mysqldb','../../config/logger','getTranscriptionJob','detectSentiment','substring','info','format','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','sentiment','sentimentAccountId','sentimentRegion','language','ValidationError','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative'];(function(_0x50aadc,_0x2a21bc){var _0x9d369b=function(_0x3d1e9e){while(--_0x3d1e9e){_0x50aadc['push'](_0x50aadc['shift']());}};_0x9d369b(++_0x2a21bc);}(_0x7e05,0x69));var _0x57e0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7e05[_0x2dafbe];return _0x58a45a;};var _=require(_0x57e0('0x0'));var AWS=require(_0x57e0('0x1'));var rp=require('request-promise');var util=require(_0x57e0('0x2'));var BPromise=require('bluebird');var db=require(_0x57e0('0x3'))['db'];var logger=require(_0x57e0('0x4'))('transcribe');function getTranscriptionJob(_0x5bd11c,_0x1a083e,_0x2b6095,_0x3aa2b9){return new Promise(function(_0x327596,_0x5f4f7e){var _0xa9c84c=new AWS['TranscribeService']({'accessKeyId':_0x1a083e,'secretAccessKey':_0x5bd11c,'region':_0x2b6095});_0xa9c84c[_0x57e0('0x5')]({'TranscriptionJobName':_0x3aa2b9},function(_0x42e95c,_0x17f3da){if(_0x42e95c){return _0x5f4f7e(_0x42e95c);}else{return _0x327596(_0x17f3da);}});});}function sentiment(_0x36ace0,_0x18c9b8,_0x2c4baa,_0x421be4,_0x551964){return new Promise(function(_0x3f82e2,_0x5ec428){var _0x3577ec=new AWS['Comprehend']({'accessKeyId':_0x18c9b8,'secretAccessKey':_0x36ace0,'region':_0x2c4baa});_0x3577ec[_0x57e0('0x6')]({'Text':_0x421be4,'LanguageCode':_0x551964[_0x57e0('0x7')](0x0,0x2)},function(_0x44183b,_0x60ef7f){if(_0x44183b){return _0x5ec428(_0x44183b);}else{return _0x3f82e2(_0x60ef7f);}});});}function checkTranscribeJob(_0x3eb495,_0x254141,_0x142d1f){var _0x114d14;return new BPromise(function(_0x1ce916,_0x53bdb7){logger[_0x57e0('0x8')](util[_0x57e0('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3eb495['id'],_0x3eb495[_0x57e0('0xa')]));return getTranscriptionJob(_0x142d1f['data1'],_0x142d1f[_0x57e0('0xb')],_0x254141[_0x57e0('0xc')],_0x3eb495[_0x57e0('0xa')])[_0x57e0('0xd')](function(_0x304ec4){logger['info'](util[_0x57e0('0x9')](_0x57e0('0xe'),_0x3eb495['id'],_0x3eb495[_0x57e0('0xa')],_0x304ec4[_0x57e0('0xf')][_0x57e0('0x10')]));if(!_0x3eb495['fileText']){switch(_0x304ec4[_0x57e0('0xf')][_0x57e0('0x10')]){case _0x57e0('0x11'):var _0x1e3cfe={'transcribeStatus':_0x304ec4[_0x57e0('0xf')][_0x57e0('0x10')],'fileUri':_0x304ec4[_0x57e0('0xf')]['Transcript'][_0x57e0('0x12')]};logger[_0x57e0('0x8')](util[_0x57e0('0x9')](_0x57e0('0x13'),_0x3eb495['id']));return rp({'uri':_0x304ec4['TranscriptionJob'][_0x57e0('0x14')][_0x57e0('0x12')],'json':!![]})[_0x57e0('0xd')](function(_0x3bc1c0){logger['info'](util[_0x57e0('0x9')](_0x57e0('0x15'),_0x3eb495['id']));if(_0x3bc1c0&&_0x3bc1c0[_0x57e0('0x16')]&&_0x3bc1c0['results']['transcripts']&&_0x3bc1c0[_0x57e0('0x16')][_0x57e0('0x17')][_0x57e0('0x18')]){_0x1e3cfe[_0x57e0('0x19')]='';for(var _0xe9c8b=0x0;_0xe9c8b<_0x3bc1c0[_0x57e0('0x16')][_0x57e0('0x17')][_0x57e0('0x18')];_0xe9c8b++){_0x1e3cfe[_0x57e0('0x19')]+=_0x3bc1c0['results'][_0x57e0('0x17')][_0xe9c8b]['transcript']+'';}}return _0x3eb495[_0x57e0('0x1a')](_0x1e3cfe);})[_0x57e0('0xd')](function(){logger['info'](util[_0x57e0('0x9')](_0x57e0('0x1b'),_0x3eb495['id']));if(!_0x3eb495['tempSentiment']){throw new db[(_0x57e0('0x1c'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x254141[_0x57e0('0x1d')]||!_0x254141[_0x57e0('0x1e')]||!_0x254141[_0x57e0('0x1f')]||!_0x254141[_0x57e0('0x20')]||!_0x254141['bucket']){throw new db[(_0x57e0('0x1c'))][(_0x57e0('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1e3cfe['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x254141[_0x57e0('0x1e')]===_0x142d1f['id']){return _0x142d1f;}else{return db[_0x57e0('0x22')]['findOne']({'where':{'id':_settings[_0x57e0('0x1e')]}});}})[_0x57e0('0xd')](function(_0x2766f9){if(!_0x2766f9){throw new db[(_0x57e0('0x1c'))]['ValidationError'](_0x57e0('0x23'));}if(!_0x2766f9[_0x57e0('0x24')]||!_0x2766f9['data2']){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x114d14=_0x2766f9;logger['info'](util[_0x57e0('0x9')](_0x57e0('0x25'),_0x3eb495['id']));return sentiment(_0x114d14[_0x57e0('0x24')],_0x114d14[_0x57e0('0xb')],_0x254141[_0x57e0('0x1f')],_0x1e3cfe['fileText'],_0x254141['language']);})[_0x57e0('0xd')](function(_0x30cadf){logger[_0x57e0('0x8')](util[_0x57e0('0x9')](_0x57e0('0x26'),_0x3eb495['id']));return _0x3eb495[_0x57e0('0x1a')]({'sentiment':_0x30cadf[_0x57e0('0x27')],'sPositive':_0x30cadf[_0x57e0('0x28')][_0x57e0('0x29')],'sNegative':_0x30cadf[_0x57e0('0x28')][_0x57e0('0x2a')],'sMixed':_0x30cadf['SentimentScore'][_0x57e0('0x2b')],'sNeutral':_0x30cadf[_0x57e0('0x28')]['Neutral']});})['then'](function(){logger[_0x57e0('0x8')](util['format'](_0x57e0('0x1b'),_0x3eb495['id']));_0x1ce916();});case _0x57e0('0x2c'):return _0x3eb495['update']({'transcribeStatus':'FAILED','failureReason':_0x304ec4[_0x57e0('0xf')][_0x57e0('0x2d')]})[_0x57e0('0xd')](function(){logger[_0x57e0('0x8')](util[_0x57e0('0x9')](_0x57e0('0x1b'),_0x3eb495['id']));_0x1ce916();});default:logger['info'](util[_0x57e0('0x9')](_0x57e0('0x2e'),_0x3eb495['id']));break;}}else{return BPromise[_0x57e0('0x2f')]()['then'](function(){if(!_0x3eb495[_0x57e0('0x30')]){throw new db[(_0x57e0('0x1c'))][(_0x57e0('0x21'))](_0x57e0('0x31'));}if(!_0x254141['sentiment']||!_0x254141[_0x57e0('0x1e')]||!_0x254141[_0x57e0('0x1f')]||!_0x254141[_0x57e0('0x20')]||!_0x254141[_0x57e0('0x32')]){throw new db[(_0x57e0('0x1c'))][(_0x57e0('0x21'))](_0x57e0('0x33'));}if(!_0x3eb495[_0x57e0('0x19')]){throw new Error(_0x57e0('0x34'));}if(_0x254141[_0x57e0('0x1e')]===_0x142d1f['id']){return _0x142d1f;}else{return db[_0x57e0('0x22')][_0x57e0('0x35')]({'where':{'id':_settings[_0x57e0('0x1e')]}});}})['then'](function(_0xc83af6){if(!_0xc83af6){throw new db['Sequelize']['ValidationError'](_0x57e0('0x23'));}if(!_0xc83af6[_0x57e0('0x24')]||!_0xc83af6[_0x57e0('0xb')]){throw new db[(_0x57e0('0x1c'))][(_0x57e0('0x21'))](_0x57e0('0x36'));}_0x114d14=_0xc83af6;logger['info'](util[_0x57e0('0x9')](_0x57e0('0x25'),_0x3eb495['id']));return sentiment(_0x114d14[_0x57e0('0x24')],_0x114d14[_0x57e0('0xb')],_0x254141[_0x57e0('0x1f')],_0x3eb495[_0x57e0('0x19')],_0x254141['language']);})['then'](function(_0x43c8e3){logger[_0x57e0('0x8')](util[_0x57e0('0x9')](_0x57e0('0x26'),_0x3eb495['id']));return _0x3eb495[_0x57e0('0x1a')]({'sentiment':_0x43c8e3[_0x57e0('0x27')],'sPositive':_0x43c8e3[_0x57e0('0x28')][_0x57e0('0x29')],'sNegative':_0x43c8e3['SentimentScore']['Negative'],'sMixed':_0x43c8e3[_0x57e0('0x28')]['Mixed'],'sNeutral':_0x43c8e3[_0x57e0('0x28')]['Neutral'],'transcribeStatus':_0x57e0('0x11')});})['then'](function(){logger[_0x57e0('0x8')](util[_0x57e0('0x9')](_0x57e0('0x1b'),_0x3eb495['id']));_0x1ce916();});}})['catch'](function(_0x3b91e3){if(_0x3b91e3){if(!_0x3b91e3[_0x57e0('0x37')]||_0x3b91e3[_0x57e0('0x37')]!==_0x57e0('0x38')){logger[_0x57e0('0x39')](util[_0x57e0('0x9')](_0x57e0('0x3a'),_0x3eb495['id']),util[_0x57e0('0x3b')](_0x3b91e3,{'showHidden':![],'depth':null}));}}_0x1ce916();});});}function checkTranscribe(){var _0x1b1507;var _0x50b75a;var _0x646ee4;return db[_0x57e0('0x3c')][_0x57e0('0x3d')]({'where':{'transcribeStatus':_0x57e0('0x3e')}})[_0x57e0('0xd')](function(_0x54db2){if(!_0x54db2||!_0x54db2[_0x57e0('0x18')]){throw new db[(_0x57e0('0x1c'))][(_0x57e0('0x21'))](_0x57e0('0x3f'));}_0x1b1507=_0x54db2;return db[_0x57e0('0x40')][_0x57e0('0x35')]({'where':{'id':0x1}});})[_0x57e0('0xd')](function(_0x5178aa){if(!_0x5178aa){throw new db[(_0x57e0('0x1c'))]['ValidationError'](_0x57e0('0x41'));}_0x50b75a=_0x5178aa;if(!_0x50b75a[_0x57e0('0x42')]||!_0x50b75a[_0x57e0('0x43')]||!_0x50b75a[_0x57e0('0xc')]||!_0x50b75a['language']||!_0x50b75a['bucket']){throw new db[(_0x57e0('0x1c'))]['ValidationError'](_0x57e0('0x44'));}return db[_0x57e0('0x22')][_0x57e0('0x35')]({'where':{'id':_0x50b75a['transcribeAccountId']}});})[_0x57e0('0xd')](function(_0x7a9807){if(!_0x7a9807){throw new db[(_0x57e0('0x1c'))][(_0x57e0('0x21'))](_0x57e0('0x23'));}if(!_0x7a9807[_0x57e0('0x24')]||!_0x7a9807[_0x57e0('0xb')]){throw new db[(_0x57e0('0x1c'))][(_0x57e0('0x21'))](_0x57e0('0x36'));}_0x646ee4=_0x7a9807;var _0x59a547=[];_0x1b1507[_0x57e0('0x45')](function(_0x5bed1d){_0x59a547[_0x57e0('0x46')](checkTranscribeJob(_0x5bed1d,_0x50b75a,_0x646ee4));});return BPromise[_0x57e0('0x47')](_0x59a547);})[_0x57e0('0x48')](function(_0x321f9f){if(_0x321f9f){if(!_0x321f9f[_0x57e0('0x37')]||_0x321f9f[_0x57e0('0x37')]!==_0x57e0('0x38')){logger[_0x57e0('0x39')](util[_0x57e0('0x3b')](_0x321f9f,{'showHidden':![],'depth':null}));}}});}exports[_0x57e0('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x4ca7=['sentimentRegion','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','findOne','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Cloud\x20Provider\x20not\x20configured','forEach','all','catch','inspect','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis'];(function(_0x1c66fa,_0x4549b0){var _0x1b1303=function(_0x518df8){while(--_0x518df8){_0x1c66fa['push'](_0x1c66fa['shift']());}};_0x1b1303(++_0x4549b0);}(_0x4ca7,0x1e3));var _0x74ca=function(_0x28f9b1,_0x5ad6b4){_0x28f9b1=_0x28f9b1-0x0;var _0x538c8e=_0x4ca7[_0x28f9b1];return _0x538c8e;};var _=require(_0x74ca('0x0'));var AWS=require(_0x74ca('0x1'));var rp=require(_0x74ca('0x2'));var util=require('util');var BPromise=require(_0x74ca('0x3'));var db=require(_0x74ca('0x4'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x878a54,_0x4afef6,_0x1be1ff,_0x196a5f){return new Promise(function(_0x4bccc5,_0x352e08){var _0x572dc2=new AWS[(_0x74ca('0x5'))]({'accessKeyId':_0x4afef6,'secretAccessKey':_0x878a54,'region':_0x1be1ff});_0x572dc2[_0x74ca('0x6')]({'TranscriptionJobName':_0x196a5f},function(_0x33cabd,_0x407524){if(_0x33cabd){return _0x352e08(_0x33cabd);}else{return _0x4bccc5(_0x407524);}});});}function sentiment(_0xec5de5,_0x33507a,_0x116715,_0x589f6a,_0x2d6679){return new Promise(function(_0x4b4f09,_0x578574){var _0x16764e=new AWS['Comprehend']({'accessKeyId':_0x33507a,'secretAccessKey':_0xec5de5,'region':_0x116715});_0x16764e[_0x74ca('0x7')]({'Text':_0x589f6a,'LanguageCode':_0x2d6679[_0x74ca('0x8')](0x0,0x2)},function(_0x21e965,_0x1885c9){if(_0x21e965){return _0x578574(_0x21e965);}else{return _0x4b4f09(_0x1885c9);}});});}function checkTranscribeJob(_0x13423a,_0x13505a,_0x3417d9){var _0x3ace02;return new BPromise(function(_0x4dc3ee,_0x7583b1){logger[_0x74ca('0x9')](util[_0x74ca('0xa')](_0x74ca('0xb'),_0x13423a['id'],_0x13423a[_0x74ca('0xc')]));return getTranscriptionJob(_0x3417d9[_0x74ca('0xd')],_0x3417d9[_0x74ca('0xe')],_0x13505a[_0x74ca('0xf')],_0x13423a[_0x74ca('0xc')])[_0x74ca('0x10')](function(_0x440310){logger[_0x74ca('0x9')](util[_0x74ca('0xa')](_0x74ca('0x11'),_0x13423a['id'],_0x13423a['transcribeName'],_0x440310[_0x74ca('0x12')][_0x74ca('0x13')]));if(!_0x13423a[_0x74ca('0x14')]){switch(_0x440310[_0x74ca('0x12')][_0x74ca('0x13')]){case'COMPLETED':var _0x522014={'transcribeStatus':_0x440310[_0x74ca('0x12')][_0x74ca('0x13')],'fileUri':_0x440310[_0x74ca('0x12')][_0x74ca('0x15')][_0x74ca('0x16')]};logger[_0x74ca('0x9')](util['format'](_0x74ca('0x17'),_0x13423a['id']));return rp({'uri':_0x440310[_0x74ca('0x12')]['Transcript']['TranscriptFileUri'],'json':!![]})['then'](function(_0x22be63){logger[_0x74ca('0x9')](util[_0x74ca('0xa')](_0x74ca('0x18'),_0x13423a['id']));if(_0x22be63&&_0x22be63[_0x74ca('0x19')]&&_0x22be63[_0x74ca('0x19')][_0x74ca('0x1a')]&&_0x22be63[_0x74ca('0x19')][_0x74ca('0x1a')][_0x74ca('0x1b')]){_0x522014['fileText']='';for(var _0x4c020c=0x0;_0x4c020c<_0x22be63[_0x74ca('0x19')][_0x74ca('0x1a')][_0x74ca('0x1b')];_0x4c020c++){_0x522014[_0x74ca('0x14')]+=_0x22be63[_0x74ca('0x19')]['transcripts'][_0x4c020c][_0x74ca('0x1c')]+'';}}return _0x13423a[_0x74ca('0x1d')](_0x522014);})[_0x74ca('0x10')](function(){logger[_0x74ca('0x9')](util[_0x74ca('0xa')](_0x74ca('0x1e'),_0x13423a['id']));if(!_0x13423a[_0x74ca('0x1f')]){throw new db[(_0x74ca('0x20'))][(_0x74ca('0x21'))](_0x74ca('0x22'));}if(!_0x13505a[_0x74ca('0x23')]||!_0x13505a[_0x74ca('0x24')]||!_0x13505a['sentimentRegion']||!_0x13505a['language']||!_0x13505a[_0x74ca('0x25')]){throw new db[(_0x74ca('0x20'))][(_0x74ca('0x21'))](_0x74ca('0x26'));}if(!_0x522014[_0x74ca('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x13505a[_0x74ca('0x24')]===_0x3417d9['id']){return _0x3417d9;}else{return db[_0x74ca('0x27')]['findOne']({'where':{'id':_settings[_0x74ca('0x24')]}});}})[_0x74ca('0x10')](function(_0x55d3ac){if(!_0x55d3ac){throw new db[(_0x74ca('0x20'))][(_0x74ca('0x21'))](_0x74ca('0x28'));}if(!_0x55d3ac[_0x74ca('0xd')]||!_0x55d3ac[_0x74ca('0xe')]){throw new db[(_0x74ca('0x20'))][(_0x74ca('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x3ace02=_0x55d3ac;logger['info'](util[_0x74ca('0xa')](_0x74ca('0x29'),_0x13423a['id']));return sentiment(_0x3ace02[_0x74ca('0xd')],_0x3ace02[_0x74ca('0xe')],_0x13505a[_0x74ca('0x2a')],_0x522014[_0x74ca('0x14')],_0x13505a[_0x74ca('0x2b')]);})['then'](function(_0x385eff){logger[_0x74ca('0x9')](util[_0x74ca('0xa')](_0x74ca('0x2c'),_0x13423a['id']));return _0x13423a[_0x74ca('0x1d')]({'sentiment':_0x385eff[_0x74ca('0x2d')],'sPositive':_0x385eff[_0x74ca('0x2e')][_0x74ca('0x2f')],'sNegative':_0x385eff['SentimentScore'][_0x74ca('0x30')],'sMixed':_0x385eff['SentimentScore'][_0x74ca('0x31')],'sNeutral':_0x385eff['SentimentScore'][_0x74ca('0x32')]});})[_0x74ca('0x10')](function(){logger[_0x74ca('0x9')](util[_0x74ca('0xa')](_0x74ca('0x1e'),_0x13423a['id']));_0x4dc3ee();});case'FAILED':return _0x13423a[_0x74ca('0x1d')]({'transcribeStatus':_0x74ca('0x33'),'failureReason':_0x440310['TranscriptionJob'][_0x74ca('0x34')]})['then'](function(){logger[_0x74ca('0x9')](util[_0x74ca('0xa')](_0x74ca('0x1e'),_0x13423a['id']));_0x4dc3ee();});default:logger[_0x74ca('0x9')](util[_0x74ca('0xa')](_0x74ca('0x35'),_0x13423a['id']));break;}}else{return BPromise[_0x74ca('0x36')]()['then'](function(){if(!_0x13423a[_0x74ca('0x1f')]){throw new db[(_0x74ca('0x20'))][(_0x74ca('0x21'))](_0x74ca('0x22'));}if(!_0x13505a[_0x74ca('0x23')]||!_0x13505a[_0x74ca('0x24')]||!_0x13505a[_0x74ca('0x2a')]||!_0x13505a[_0x74ca('0x2b')]||!_0x13505a[_0x74ca('0x25')]){throw new db[(_0x74ca('0x20'))][(_0x74ca('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x13423a['fileText']){throw new Error(_0x74ca('0x37'));}if(_0x13505a[_0x74ca('0x24')]===_0x3417d9['id']){return _0x3417d9;}else{return db['CloudProvider'][_0x74ca('0x38')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x74ca('0x10')](function(_0x2e9a37){if(!_0x2e9a37){throw new db[(_0x74ca('0x20'))][(_0x74ca('0x21'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2e9a37[_0x74ca('0xd')]||!_0x2e9a37[_0x74ca('0xe')]){throw new db[(_0x74ca('0x20'))][(_0x74ca('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x3ace02=_0x2e9a37;logger['info'](util[_0x74ca('0xa')](_0x74ca('0x29'),_0x13423a['id']));return sentiment(_0x3ace02['data1'],_0x3ace02['data2'],_0x13505a[_0x74ca('0x2a')],_0x13423a[_0x74ca('0x14')],_0x13505a[_0x74ca('0x2b')]);})[_0x74ca('0x10')](function(_0x5aa051){logger['info'](util['format'](_0x74ca('0x2c'),_0x13423a['id']));return _0x13423a[_0x74ca('0x1d')]({'sentiment':_0x5aa051[_0x74ca('0x2d')],'sPositive':_0x5aa051[_0x74ca('0x2e')]['Positive'],'sNegative':_0x5aa051['SentimentScore'][_0x74ca('0x30')],'sMixed':_0x5aa051[_0x74ca('0x2e')][_0x74ca('0x31')],'sNeutral':_0x5aa051[_0x74ca('0x2e')][_0x74ca('0x32')],'transcribeStatus':_0x74ca('0x39')});})[_0x74ca('0x10')](function(){logger[_0x74ca('0x9')](util['format'](_0x74ca('0x1e'),_0x13423a['id']));_0x4dc3ee();});}})['catch'](function(_0x38380c){if(_0x38380c){if(!_0x38380c[_0x74ca('0x3a')]||_0x38380c[_0x74ca('0x3a')]!==_0x74ca('0x3b')){logger[_0x74ca('0x3c')](util[_0x74ca('0xa')](_0x74ca('0x3d'),_0x13423a['id']),util['inspect'](_0x38380c,{'showHidden':![],'depth':null}));}}_0x4dc3ee();});});}function checkTranscribe(){var _0xcec81d;var _0x3ccaf2;var _0x3bc83d;return db[_0x74ca('0x3e')]['findAll']({'where':{'transcribeStatus':_0x74ca('0x3f')}})[_0x74ca('0x10')](function(_0x2c5fd3){if(!_0x2c5fd3||!_0x2c5fd3['length']){throw new db['Sequelize'][(_0x74ca('0x21'))](_0x74ca('0x40'));}_0xcec81d=_0x2c5fd3;return db[_0x74ca('0x41')]['findOne']({'where':{'id':0x1}});})[_0x74ca('0x10')](function(_0x56a4e7){if(!_0x56a4e7){throw new db[(_0x74ca('0x20'))][(_0x74ca('0x21'))](_0x74ca('0x42'));}_0x3ccaf2=_0x56a4e7;if(!_0x3ccaf2[_0x74ca('0x43')]||!_0x3ccaf2['transcribeAccountId']||!_0x3ccaf2[_0x74ca('0xf')]||!_0x3ccaf2[_0x74ca('0x2b')]||!_0x3ccaf2[_0x74ca('0x25')]){throw new db[(_0x74ca('0x20'))][(_0x74ca('0x21'))]('Transcribe\x20not\x20configured');}return db[_0x74ca('0x27')][_0x74ca('0x38')]({'where':{'id':_0x3ccaf2[_0x74ca('0x44')]}});})['then'](function(_0x20533d){if(!_0x20533d){throw new db['Sequelize'][(_0x74ca('0x21'))](_0x74ca('0x28'));}if(!_0x20533d[_0x74ca('0xd')]||!_0x20533d[_0x74ca('0xe')]){throw new db[(_0x74ca('0x20'))][(_0x74ca('0x21'))](_0x74ca('0x45'));}_0x3bc83d=_0x20533d;var _0x253fc2=[];_0xcec81d[_0x74ca('0x46')](function(_0x36cbb7){_0x253fc2['push'](checkTranscribeJob(_0x36cbb7,_0x3ccaf2,_0x3bc83d));});return BPromise[_0x74ca('0x47')](_0x253fc2);})[_0x74ca('0x48')](function(_0x41d5dd){if(_0x41d5dd){if(!_0x41d5dd[_0x74ca('0x3a')]||_0x41d5dd[_0x74ca('0x3a')]!==_0x74ca('0x3b')){logger[_0x74ca('0x3c')](util[_0x74ca('0x49')](_0x41d5dd,{'showHidden':![],'depth':null}));}}});}exports[_0x74ca('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 96776c5..b6c8679 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 _0x0406=['catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','map','info','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','then','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update'];(function(_0x73018c,_0x2ee76f){var _0x24a504=function(_0x5e6a3b){while(--_0x5e6a3b){_0x73018c['push'](_0x73018c['shift']());}};_0x24a504(++_0x2ee76f);}(_0x0406,0x165));var _0x6040=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0406[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6040('0x0'));var moment=require(_0x6040('0x1'));var Redis=require(_0x6040('0x2'));var util=require(_0x6040('0x3'));var config=require('../../config/environment');var db=require(_0x6040('0x4'))['db'];var logger=require(_0x6040('0x5'))(_0x6040('0x6'));config[_0x6040('0x7')]=_[_0x6040('0x8')](config[_0x6040('0x7')],{'host':_0x6040('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x4a9df8=[];return db[_0x6040('0xa')][_0x6040('0xb')]({'raw':!![],'attributes':['id',_0x6040('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x6040('0xd')](0x18,_0x6040('0xe'))}}})['then'](function(_0x44eddb){if(_0x44eddb&&_0x44eddb['length']){_0x4a9df8=_[_0x6040('0xf')](_0x44eddb||[],'id');logger[_0x6040('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4a9df8[_0x6040('0x11')]());return db['WhatsappInteraction'][_0x6040('0x12')]({'closeReason':_0x6040('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x6040('0x14')](_0x6040('0x15'))},{'where':{'id':_0x4a9df8}});}})[_0x6040('0x16')](function(){if(_0x4a9df8&&_0x4a9df8[_0x6040('0x17')]){logger[_0x6040('0x10')](_0x6040('0x18'),_0x4a9df8[_0x6040('0x11')]());for(var _0x395972=0x0;_0x395972<_0x4a9df8[_0x6040('0x17')];_0x395972++){io[_0x6040('0x19')](_0x6040('0x1a'),{'id':_0x4a9df8[_0x395972],'closed':!![]});}}})[_0x6040('0x1b')](function(_0x107797){logger[_0x6040('0x1c')](_0x6040('0x1d'),_0x107797?util[_0x6040('0x1e')](_0x107797,{'showHidden':![],'depth':null}):'');});}exports[_0x6040('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb7bf=['join','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','util','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x37a0ab,_0x34b900){var _0x13ca1d=function(_0x3c6a41){while(--_0x3c6a41){_0x37a0ab['push'](_0x37a0ab['shift']());}};_0x13ca1d(++_0x34b900);}(_0xb7bf,0x1e3));var _0xfb7b=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xb7bf[_0xd09668];return _0x68726;};'use strict';var _=require(_0xfb7b('0x0'));var moment=require('moment');var Redis=require(_0xfb7b('0x1'));var util=require(_0xfb7b('0x2'));var config=require('../../config/environment');var db=require(_0xfb7b('0x3'))['db'];var logger=require(_0xfb7b('0x4'))(_0xfb7b('0x5'));config[_0xfb7b('0x6')]=_['defaults'](config['redis'],{'host':_0xfb7b('0x7'),'port':0x18eb});var io=require(_0xfb7b('0x8'))(new Redis(config[_0xfb7b('0x6')]));function closeInteractions(){var _0x45ebc7=[];return db[_0xfb7b('0x9')][_0xfb7b('0xa')]({'raw':!![],'attributes':['id',_0xfb7b('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xfb7b('0xc'))}}})[_0xfb7b('0xd')](function(_0x2a9b51){if(_0x2a9b51&&_0x2a9b51[_0xfb7b('0xe')]){_0x45ebc7=_['map'](_0x2a9b51||[],'id');logger[_0xfb7b('0xf')](_0xfb7b('0x10'),_0x45ebc7['join']());return db[_0xfb7b('0x9')]['update']({'closeReason':_0xfb7b('0x11'),'disposition':_0xfb7b('0x12'),'closed':!![],'closedAt':moment()[_0xfb7b('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x45ebc7}});}})['then'](function(){if(_0x45ebc7&&_0x45ebc7[_0xfb7b('0xe')]){logger[_0xfb7b('0xf')](_0xfb7b('0x14'),_0x45ebc7[_0xfb7b('0x15')]());for(var _0x36e96b=0x0;_0x36e96b<_0x45ebc7['length'];_0x36e96b++){io[_0xfb7b('0x16')](_0xfb7b('0x17'),{'id':_0x45ebc7[_0x36e96b],'closed':!![]});}}})[_0xfb7b('0x18')](function(_0x2db401){logger['error'](_0xfb7b('0x19'),_0x2db401?util[_0xfb7b('0x1a')](_0x2db401,{'showHidden':![],'depth':null}):'');});}exports[_0xfb7b('0x1b')]=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 9d70b56..73e2fdd 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe40d=['hopper1','contacts2','catch','util','../mysqldb','push','Innocenzo','@xcally.com','now','Biondo','innocenzo.biondo','CmContact','destroy','then','bulkCreate','log','CmHopper','finished\x20populating'];(function(_0x3f6f58,_0x31da89){var _0x31f738=function(_0x447e9c){while(--_0x447e9c){_0x3f6f58['push'](_0x3f6f58['shift']());}};_0x31f738(++_0x31da89);}(_0xe40d,0x18f));var _0xde40=function(_0x4ec46f,_0x2cc0c3){_0x4ec46f=_0x4ec46f-0x0;var _0x2b8f3a=_0xe40d[_0x4ec46f];return _0x2b8f3a;};'use strict';var util=require(_0xde40('0x0'));var db=require(_0xde40('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xde40('0x2')]({'id':i,'firstName':_0xde40('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xde40('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xde40('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xde40('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xde40('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xde40('0x2')]({'id':i,'firstName':_0xde40('0x3')+i,'lastName':_0xde40('0x6')+i,'phone':0xf879fb460+i,'email':_0xde40('0x7')+i+_0xde40('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xde40('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xde40('0x5')]()});}db[_0xde40('0x8')][_0xde40('0x9')]({'where':{}})[_0xde40('0xa')](function(){return db[_0xde40('0x8')][_0xde40('0xb')](contacts);})[_0xde40('0xa')](function(){console[_0xde40('0xc')]('finished\x20populating','contacts1');return db[_0xde40('0xd')][_0xde40('0x9')]({'where':{}});})[_0xde40('0xa')](function(){return db[_0xde40('0xd')][_0xde40('0xb')](hopper);})[_0xde40('0xa')](function(){console[_0xde40('0xc')](_0xde40('0xe'),_0xde40('0xf'));return db[_0xde40('0x8')]['bulkCreate'](contacts2);})['then'](function(){console[_0xde40('0xc')]('finished\x20populating',_0xde40('0x10'));return db[_0xde40('0xd')][_0xde40('0xb')](hopper2);})['then'](function(){console['log'](_0xde40('0xe'),'hopper2');})[_0xde40('0x11')](function(_0x7eea01){console[_0xde40('0xc')](_0x7eea01);}); \ No newline at end of file +var _0x120d=['finished\x20populating','hopper2','util','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','then','log','CmHopper','destroy','bulkCreate','hopper1','contacts2'];(function(_0x44fc62,_0x44eaa3){var _0x31b9e9=function(_0x48e5b1){while(--_0x48e5b1){_0x44fc62['push'](_0x44fc62['shift']());}};_0x31b9e9(++_0x44eaa3);}(_0x120d,0x79));var _0xd120=function(_0x4b935a,_0x327ee3){_0x4b935a=_0x4b935a-0x0;var _0xa298f0=_0x120d[_0x4b935a];return _0xa298f0;};'use strict';var util=require(_0xd120('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xd120('0x1')+i,'lastName':_0xd120('0x2')+i,'phone':0xf879fb460+i,'email':_0xd120('0x3')+i+_0xd120('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd120('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xd120('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd120('0x6')](),'updatedAt':Date[_0xd120('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xd120('0x5')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xd120('0x3')+i+_0xd120('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd120('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xd120('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xd120('0x6')]()});}db[_0xd120('0x7')]['destroy']({'where':{}})[_0xd120('0x8')](function(){return db[_0xd120('0x7')]['bulkCreate'](contacts);})[_0xd120('0x8')](function(){console[_0xd120('0x9')]('finished\x20populating','contacts1');return db[_0xd120('0xa')][_0xd120('0xb')]({'where':{}});})[_0xd120('0x8')](function(){return db[_0xd120('0xa')][_0xd120('0xc')](hopper);})[_0xd120('0x8')](function(){console[_0xd120('0x9')]('finished\x20populating',_0xd120('0xd'));return db[_0xd120('0x7')][_0xd120('0xc')](contacts2);})[_0xd120('0x8')](function(){console[_0xd120('0x9')]('finished\x20populating',_0xd120('0xe'));return db[_0xd120('0xa')][_0xd120('0xc')](hopper2);})[_0xd120('0x8')](function(){console['log'](_0xd120('0xf'),_0xd120('0x10'));})['catch'](function(_0x115bbc){console[_0xd120('0x9')](_0x115bbc);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 820db5d..e6c5323 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7905=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','catch','util','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','friend','udp','all'];(function(_0x1830ce,_0x305798){var _0x2bce9f=function(_0x9ea7dc){while(--_0x9ea7dc){_0x1830ce['push'](_0x1830ce['shift']());}};_0x2bce9f(++_0x305798);}(_0x7905,0x6e));var _0x5790=function(_0x36a124,_0x560db5){_0x36a124=_0x36a124-0x0;var _0x1e04eb=_0x7905[_0x36a124];return _0x1e04eb;};'use strict';var util=require(_0x5790('0x0'));var db=require(_0x5790('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5790('0x2')]({'name':util['format'](_0x5790('0x3'),_0x5790('0x4'),i),'fullname':util['format'](_0x5790('0x3'),_0x5790('0x4'),i),'email':util[_0x5790('0x5')](_0x5790('0x6'),_0x5790('0x4'),i),'role':_0x5790('0x4'),'password':'password','internal':0xfa0+i,'type':_0x5790('0x7'),'transport':[_0x5790('0x8'),'ws','wss'],'disallow':[_0x5790('0x9')],'allow':[_0x5790('0xa')],'defaultuser':util[_0x5790('0x5')](_0x5790('0x3'),_0x5790('0x4'),i),'encryption':_0x5790('0xb'),'avpf':_0x5790('0xb'),'force_avp':_0x5790('0xb'),'icesupport':_0x5790('0xb'),'dtlsenable':_0x5790('0xb'),'dtlsverify':'no','dtlscertfile':_0x5790('0xc'),'dtlsprivatekey':_0x5790('0xd'),'dtlssetup':_0x5790('0xe'),'callerid':util[_0x5790('0x5')](_0x5790('0xf'),util[_0x5790('0x5')](_0x5790('0x3'),_0x5790('0x4'),i),0xfa0+i)});}db[_0x5790('0x10')][_0x5790('0x11')](users)['then'](function(){console[_0x5790('0x12')]('add\x20user');})[_0x5790('0x13')](function(_0x462986){console[_0x5790('0x12')](_0x462986);}); \ No newline at end of file +var _0xfd51=['udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util','push','format','%s%s','agent','friend'];(function(_0x57e865,_0x3f12d6){var _0x3803ec=function(_0x191b91){while(--_0x191b91){_0x57e865['push'](_0x57e865['shift']());}};_0x3803ec(++_0x3f12d6);}(_0xfd51,0xae));var _0x1fd5=function(_0x24e509,_0x1f327d){_0x24e509=_0x24e509-0x0;var _0x3f9e6a=_0xfd51[_0x24e509];return _0x3f9e6a;};'use strict';var util=require(_0x1fd5('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1fd5('0x1')]({'name':util[_0x1fd5('0x2')](_0x1fd5('0x3'),_0x1fd5('0x4'),i),'fullname':util[_0x1fd5('0x2')](_0x1fd5('0x3'),_0x1fd5('0x4'),i),'email':util[_0x1fd5('0x2')]('%s%s@xcally.com',_0x1fd5('0x4'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0x1fd5('0x5'),'transport':[_0x1fd5('0x6'),'ws',_0x1fd5('0x7')],'disallow':[_0x1fd5('0x8')],'allow':[_0x1fd5('0x9')],'defaultuser':util['format'](_0x1fd5('0x3'),_0x1fd5('0x4'),i),'encryption':_0x1fd5('0xa'),'avpf':_0x1fd5('0xa'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0x1fd5('0xa'),'dtlsverify':'no','dtlscertfile':_0x1fd5('0xb'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x1fd5('0x2')](_0x1fd5('0xc'),util[_0x1fd5('0x2')](_0x1fd5('0x3'),'agent',i),0xfa0+i)});}db[_0x1fd5('0xd')][_0x1fd5('0xe')](users)[_0x1fd5('0xf')](function(){console[_0x1fd5('0x10')](_0x1fd5('0x11'));})['catch'](function(_0x13678b){console['log'](_0x13678b);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 1d1ee3b..08bb7df 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacc6=['getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','leave','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','emit','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','map','where','role','Campaign','%s:queue:%s','length','format','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','Trunk','user','voice:inbound','userProfileId','OpenchannelQueue','WhatsappQueue','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues'];(function(_0x221ca3,_0xb25dd3){var _0x5974e4=function(_0x4c1607){while(--_0x4c1607){_0x221ca3['push'](_0x221ca3['shift']());}};_0x5974e4(++_0xb25dd3);}(_0xacc6,0x150));var _0x6acc=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0xacc6[_0x202d24];return _0x2b3a8e;};'use strict';var _=require(_0x6acc('0x0'));var util=require(_0x6acc('0x1'));var BPromise=require(_0x6acc('0x2'));var db=require(_0x6acc('0x3'))['db'];var config=require(_0x6acc('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x6acc('0x5'),'model':db[_0x6acc('0x6')],'attributes':['id',_0x6acc('0x7'),'role'],'raw':!![],'where':{'role':_0x6acc('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x6acc('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x6acc('0x7')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x6acc('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x6acc('0xa')],'where':{'type':_0x6acc('0xb')}};function getAssociatedResources(_0x23d253,_0x3b248e,_0x4d6b7f){return db[_0x6acc('0xc')]['findOne']({'where':{'name':_0x23d253,'userProfileId':_0x3b248e},'raw':!![]})[_0x6acc('0xd')](function(_0x21b624){if(_0x21b624){if(_0x21b624[_0x6acc('0xe')]){switch(_0x23d253){case _0x6acc('0xf'):case _0x6acc('0x10'):case _0x6acc('0x11'):case'SmsQueues':case _0x6acc('0x12'):case _0x6acc('0x13'):case _0x6acc('0x14'):return db[_0x4d6b7f][_0x6acc('0x15')](queryQueues);case _0x6acc('0x16'):return db[_0x4d6b7f]['findAll'](queryTelephones);case'Trunks':return db[_0x4d6b7f][_0x6acc('0x15')](queryTrunks);case _0x6acc('0x17'):return db[_0x4d6b7f][_0x6acc('0x15')](queryCampaigns);}}else{return db[_0x6acc('0x18')][_0x6acc('0x15')]({'attributes':[_0x6acc('0x19')],'where':{'sectionId':_0x21b624['id']},'raw':!![]})[_0x6acc('0xd')](function(_0x4034fb){if(_0x4034fb){var _0xf24527={'where':{'id':_[_0x6acc('0x1a')](_0x4034fb,_0x6acc('0x19'))},'raw':!![]};switch(_0x4d6b7f){case _0x6acc('0x6'):_0xf24527[_0x6acc('0x1b')][_0x6acc('0x1c')]=_0x6acc('0x9');break;case _0x6acc('0x1d'):_0xf24527[_0x6acc('0x1b')][_0x6acc('0xa')]='ivr';break;}return db[_0x4d6b7f][_0x6acc('0x15')](_0xf24527);}else{return[];}});}}else{return[];}})[_0x6acc('0xd')](function(_0x37a627){return _0x37a627;});}function joinOrLeaveQueues(_0x151282,_0x49b426,_0x342043,_0x531f7c){_0x151282[_0x49b426](util['format'](_0x6acc('0x1e'),_0x342043,_0x531f7c['name']));if(_0x531f7c[_0x6acc('0x5')]){for(var _0x3edf4a=0x0;_0x3edf4a<_0x531f7c[_0x6acc('0x5')][_0x6acc('0x1f')];_0x3edf4a+=0x1){_0x151282[_0x49b426](util[_0x6acc('0x20')]('user:%s',_0x531f7c[_0x6acc('0x5')][_0x3edf4a][_0x6acc('0x7')]));}}}function joinOrLeave(_0x5bca9d,_0x334416,_0x5ba0b6){var _0x22abf1;if(_0x5bca9d[_0x6acc('0x21')][_0x6acc('0x22')]['id']){db[_0x6acc('0x6')]['find']({'attributes':['id',_0x6acc('0x7'),_0x6acc('0x1c'),'userProfileId'],'where':{'id':_0x5bca9d[_0x6acc('0x21')][_0x6acc('0x22')]['id']},'include':[{'model':db[_0x6acc('0x23')],'as':_0x6acc('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x6acc('0x25')],'as':_0x6acc('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x6acc('0x27')],'as':_0x6acc('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x6acc('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x6acc('0x2a')],'as':_0x6acc('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x6acc('0x2c')],'as':_0x6acc('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x6acc('0xd')](function(_0x3c8c95){if(_0x3c8c95){_0x22abf1=_0x3c8c95;_0x5bca9d[_0x334416](util[_0x6acc('0x20')](_0x6acc('0x2e'),_0x3c8c95[_0x6acc('0x7')]));var _0x4b6498=[];switch(_0x3c8c95['role']){case'admin':_0x5bca9d[_0x334416]('voice:inbound');_0x5bca9d[_0x334416](_0x6acc('0x2f'));if(queryQueues[_0x6acc('0x30')](_0x6acc('0x31'))){delete queryQueues[_0x6acc('0x31')];}_0x4b6498[_0x6acc('0x32')](db[_0x6acc('0x33')]['findAll'](queryQueues));_0x4b6498['push'](db[_0x6acc('0x34')][_0x6acc('0x15')](queryQueues));_0x4b6498[_0x6acc('0x32')](db[_0x6acc('0x35')]['findAll'](queryQueues));_0x4b6498[_0x6acc('0x32')](db[_0x6acc('0x36')]['findAll'](queryQueues));_0x4b6498[_0x6acc('0x32')](db[_0x6acc('0x37')][_0x6acc('0x15')](queryQueues));_0x4b6498['push'](db['OpenchannelQueue'][_0x6acc('0x15')](queryQueues));_0x4b6498[_0x6acc('0x32')](db['WhatsappQueue']['findAll'](queryQueues));_0x4b6498[_0x6acc('0x32')](db[_0x6acc('0x6')][_0x6acc('0x15')](queryTelephones));_0x4b6498['push'](db[_0x6acc('0x38')][_0x6acc('0x15')](queryTrunks));_0x4b6498[_0x6acc('0x32')](db[_0x6acc('0x1d')][_0x6acc('0x15')](queryCampaigns));_0x4b6498['push'](db[_0x6acc('0x6')]['findAll'](queryAgents));break;case _0x6acc('0x39'):_0x5bca9d[_0x334416](_0x6acc('0x3a'));_0x5bca9d[_0x334416]('voice:outbound');_0x4b6498[_0x6acc('0x32')](getAssociatedResources('VoiceQueues',_0x3c8c95['userProfileId'],_0x6acc('0x33')));_0x4b6498[_0x6acc('0x32')](getAssociatedResources(_0x6acc('0x10'),_0x3c8c95['userProfileId'],_0x6acc('0x34')));_0x4b6498['push'](getAssociatedResources(_0x6acc('0x11'),_0x3c8c95['userProfileId'],_0x6acc('0x35')));_0x4b6498[_0x6acc('0x32')](getAssociatedResources('SmsQueues',_0x3c8c95[_0x6acc('0x3b')],_0x6acc('0x36')));_0x4b6498[_0x6acc('0x32')](getAssociatedResources(_0x6acc('0x12'),_0x3c8c95[_0x6acc('0x3b')],_0x6acc('0x37')));_0x4b6498[_0x6acc('0x32')](getAssociatedResources('OpenchannelQueues',_0x3c8c95['userProfileId'],_0x6acc('0x3c')));_0x4b6498[_0x6acc('0x32')](getAssociatedResources(_0x6acc('0x14'),_0x3c8c95['userProfileId'],_0x6acc('0x3d')));_0x4b6498[_0x6acc('0x32')](getAssociatedResources(_0x6acc('0x16'),_0x3c8c95[_0x6acc('0x3b')],_0x6acc('0x6')));_0x4b6498[_0x6acc('0x32')](getAssociatedResources(_0x6acc('0x3e'),_0x3c8c95[_0x6acc('0x3b')],_0x6acc('0x38')));_0x4b6498[_0x6acc('0x32')](getAssociatedResources(_0x6acc('0x17'),_0x3c8c95[_0x6acc('0x3b')],'Campaign'));_0x4b6498['push'](db['User'][_0x6acc('0x15')](queryAgents));break;case'agent':_0x5bca9d[_0x334416]('voice:inbound');_0x5bca9d[_0x334416](_0x6acc('0x2f'));_0x4b6498[_0x6acc('0x32')](_0x3c8c95[_0x6acc('0x3f')]({'attributes':['id',_0x6acc('0x7')]}));_0x4b6498[_0x6acc('0x32')](_0x3c8c95[_0x6acc('0x40')]({'attributes':['id',_0x6acc('0x7')]}));_0x4b6498[_0x6acc('0x32')](_0x3c8c95[_0x6acc('0x41')]({'attributes':['id',_0x6acc('0x7')]}));_0x4b6498[_0x6acc('0x32')](_0x3c8c95[_0x6acc('0x42')]({'attributes':['id',_0x6acc('0x7')]}));_0x4b6498['push'](_0x3c8c95[_0x6acc('0x43')]({'attributes':['id',_0x6acc('0x7')]}));_0x4b6498['push'](_0x3c8c95[_0x6acc('0x44')]({'attributes':['id','name']}));_0x4b6498[_0x6acc('0x32')](_0x3c8c95[_0x6acc('0x45')]({'attributes':['id','name']}));break;}return BPromise[_0x6acc('0x46')](_0x4b6498);}})[_0x6acc('0xd')](function(_0x28c568){if(_0x28c568&&_0x28c568[_0x6acc('0x1f')]){for(var _0x2af3f8=0x0;_0x2af3f8<_0x28c568['length'];_0x2af3f8+=0x1){for(var _0x37b6e7=0x0;_0x37b6e7<_0x28c568[_0x2af3f8][_0x6acc('0x1f')];_0x37b6e7+=0x1){switch(_0x2af3f8){case 0x0:joinOrLeaveQueues(_0x5bca9d,_0x334416,_0x6acc('0x47'),_0x28c568[_0x2af3f8][_0x37b6e7]);break;case 0x1:joinOrLeaveQueues(_0x5bca9d,_0x334416,_0x6acc('0x48'),_0x28c568[_0x2af3f8][_0x37b6e7]);break;case 0x2:joinOrLeaveQueues(_0x5bca9d,_0x334416,_0x6acc('0x49'),_0x28c568[_0x2af3f8][_0x37b6e7]);break;case 0x3:joinOrLeaveQueues(_0x5bca9d,_0x334416,_0x6acc('0x4a'),_0x28c568[_0x2af3f8][_0x37b6e7]);break;case 0x4:joinOrLeaveQueues(_0x5bca9d,_0x334416,_0x6acc('0x4b'),_0x28c568[_0x2af3f8][_0x37b6e7]);break;case 0x5:joinOrLeaveQueues(_0x5bca9d,_0x334416,_0x6acc('0x4c'),_0x28c568[_0x2af3f8][_0x37b6e7]);break;case 0x6:joinOrLeaveQueues(_0x5bca9d,_0x334416,_0x6acc('0x4d'),_0x28c568[_0x2af3f8][_0x37b6e7]);break;case 0x7:if(_0x22abf1[_0x6acc('0x1c')]!==_0x6acc('0x8'))_0x5bca9d[_0x334416](util[_0x6acc('0x20')](_0x6acc('0x4e'),_0x28c568[_0x2af3f8][_0x37b6e7][_0x6acc('0x7')]));break;case 0x8:if(_0x22abf1[_0x6acc('0x1c')]!==_0x6acc('0x8'))_0x5bca9d[_0x334416](util[_0x6acc('0x20')]('trunk:%s',_0x28c568[_0x2af3f8][_0x37b6e7]['name']));break;case 0x9:if(_0x22abf1['role']!==_0x6acc('0x8'))_0x5bca9d[_0x334416](util[_0x6acc('0x20')]('campaign:%s:%s',_0x28c568[_0x2af3f8][_0x37b6e7][_0x6acc('0xa')],_0x28c568[_0x2af3f8][_0x37b6e7][_0x6acc('0x7')]));break;case 0xa:_0x5bca9d[_0x334416](util[_0x6acc('0x20')](_0x6acc('0x2e'),_0x28c568[_0x2af3f8][_0x37b6e7]['name']));break;}}}}})[_0x6acc('0xd')](function(){if(_0x334416===_0x6acc('0x4f')){var _0x3a3f7c=_[_0x6acc('0x1a')](_0x22abf1[_0x6acc('0x24')],'id');return _0x22abf1['removeChatInteractions'](_0x3a3f7c)[_0x6acc('0xd')](function(){for(var _0x101ed9=0x0;_0x101ed9<_0x3a3f7c[_0x6acc('0x1f')];_0x101ed9+=0x1){_0x5ba0b6['emit'](_0x6acc('0x50'),{'ChatInteractionId':Number(_0x3a3f7c[_0x101ed9]),'UserId':Number(_0x22abf1['id'])});}});}})[_0x6acc('0xd')](function(){if(_0x334416===_0x6acc('0x4f')){var _0x35957c=_['map'](_0x22abf1[_0x6acc('0x26')],'id');return _0x22abf1[_0x6acc('0x51')](_0x35957c)['then'](function(){for(var _0x362613=0x0;_0x362613<_0x35957c['length'];_0x362613+=0x1){_0x5ba0b6['emit'](_0x6acc('0x52'),{'MailInteractionId':Number(_0x35957c[_0x362613]),'UserId':Number(_0x22abf1['id'])});}});}})[_0x6acc('0xd')](function(){if(_0x334416===_0x6acc('0x4f')){var _0x508f79=_['map'](_0x22abf1[_0x6acc('0x28')],'id');return _0x22abf1[_0x6acc('0x53')](_0x508f79)['then'](function(){for(var _0xae3072=0x0;_0xae3072<_0x508f79[_0x6acc('0x1f')];_0xae3072+=0x1){_0x5ba0b6[_0x6acc('0x54')](_0x6acc('0x55'),{'FaxInteractionId':Number(_0x508f79[_0xae3072]),'UserId':Number(_0x22abf1['id'])});}});}})[_0x6acc('0xd')](function(){if(_0x334416===_0x6acc('0x4f')){var _0x357232=_['map'](_0x22abf1['SmsInteractions'],'id');return _0x22abf1['removeSmsInteractions'](_0x357232)[_0x6acc('0xd')](function(){for(var _0x43d3d=0x0;_0x43d3d<_0x357232['length'];_0x43d3d+=0x1){_0x5ba0b6[_0x6acc('0x54')](_0x6acc('0x56'),{'SmsInteractionId':Number(_0x357232[_0x43d3d]),'UserId':Number(_0x22abf1['id'])});}});}})['then'](function(){if(_0x334416===_0x6acc('0x4f')){var _0x4bcb57=_[_0x6acc('0x1a')](_0x22abf1[_0x6acc('0x2b')],'id');return _0x22abf1[_0x6acc('0x57')](_0x4bcb57)[_0x6acc('0xd')](function(){for(var _0x4b27b0=0x0;_0x4b27b0<_0x4bcb57['length'];_0x4b27b0+=0x1){_0x5ba0b6['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x4bcb57[_0x4b27b0]),'UserId':Number(_0x22abf1['id'])});}});}})['then'](function(){if(_0x334416===_0x6acc('0x4f')){var _0x6a2d56=_[_0x6acc('0x1a')](_0x22abf1[_0x6acc('0x2d')],'id');return _0x22abf1['removeWhatsappInteractions'](_0x6a2d56)['then'](function(){for(var _0x31d1cf=0x0;_0x31d1cf<_0x6a2d56['length'];_0x31d1cf+=0x1){_0x5ba0b6[_0x6acc('0x54')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x6a2d56[_0x31d1cf]),'UserId':Number(_0x22abf1['id'])});}});}})[_0x6acc('0x58')](function(_0x1e2a63){_0x5bca9d[_0x6acc('0x59')](_0x1e2a63);});}}function onDisconnect(_0x40435c,_0x215075){joinOrLeave(_0x40435c,_0x6acc('0x4f'),_0x215075);}function onConnect(_0x2890b0){joinOrLeave(_0x2890b0,_0x6acc('0x5a'));}exports[_0x6acc('0x5b')]=function(_0x211cf5){_0x211cf5['on'](_0x6acc('0x5c'),function(_0x430034){_0x430034[_0x6acc('0x5d')](0x0);_0x430034[_0x6acc('0x5e')]=_0x430034[_0x6acc('0x5f')][_0x6acc('0x5c')][_0x6acc('0x60')]+':'+_0x430034[_0x6acc('0x5f')][_0x6acc('0x5c')]['remotePort'];_0x430034[_0x6acc('0x61')]=new Date();_0x430034['log']=function(_0x34dbe2){console['log'](_0x6acc('0x62')+_0x430034['nsp'][_0x6acc('0x7')]+'['+_0x430034['address']+']',_0x34dbe2);};_0x430034['on']('disconnect',function(){onDisconnect(_0x430034,_0x211cf5);_0x430034[_0x6acc('0x59')](_0x6acc('0x63'));});onConnect(_0x430034);_0x430034['log'](_0x6acc('0x64'));});}; \ No newline at end of file +var _0xfd2e=['join','default','connection','remoteAddress','request','log','SocketIO\x20','nsp','address','DISCONNECTED','CONNECTED','lodash','bluebird','./environment','Agents','User','name','role','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','type','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','Trunks','getChatQueues','getSmsQueues','getWhatsappQueues','all','chat','sms','openchannel','whatsapp','telephone:%s','trunk:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch'];(function(_0x1cbc47,_0x58b1e4){var _0x2759ff=function(_0x4294af){while(--_0x4294af){_0x1cbc47['push'](_0x1cbc47['shift']());}};_0x2759ff(++_0x58b1e4);}(_0xfd2e,0x6e));var _0xefd2=function(_0x1a6e74,_0x162d21){_0x1a6e74=_0x1a6e74-0x0;var _0x54f0b4=_0xfd2e[_0x1a6e74];return _0x54f0b4;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var BPromise=require(_0xefd2('0x1'));var db=require('../mysqldb')['db'];var config=require(_0xefd2('0x2'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xefd2('0x3'),'model':db[_0xefd2('0x4')],'attributes':['id',_0xefd2('0x5'),_0xefd2('0x6')],'raw':!![],'where':{'role':_0xefd2('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xefd2('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xefd2('0x5'),'type'],'where':{'type':_0xefd2('0x8')}};function getAssociatedResources(_0x2cfcf2,_0x4483e5,_0xded765){return db[_0xefd2('0x9')][_0xefd2('0xa')]({'where':{'name':_0x2cfcf2,'userProfileId':_0x4483e5},'raw':!![]})[_0xefd2('0xb')](function(_0x490a6d){if(_0x490a6d){if(_0x490a6d[_0xefd2('0xc')]){switch(_0x2cfcf2){case _0xefd2('0xd'):case _0xefd2('0xe'):case _0xefd2('0xf'):case _0xefd2('0x10'):case _0xefd2('0x11'):case _0xefd2('0x12'):case _0xefd2('0x13'):return db[_0xded765]['findAll'](queryQueues);case'Telephones':return db[_0xded765][_0xefd2('0x14')](queryTelephones);case'Trunks':return db[_0xded765]['findAll'](queryTrunks);case _0xefd2('0x15'):return db[_0xded765][_0xefd2('0x14')](queryCampaigns);}}else{return db[_0xefd2('0x16')][_0xefd2('0x14')]({'attributes':[_0xefd2('0x17')],'where':{'sectionId':_0x490a6d['id']},'raw':!![]})['then'](function(_0x1a35b7){if(_0x1a35b7){var _0x20192b={'where':{'id':_[_0xefd2('0x18')](_0x1a35b7,_0xefd2('0x17'))},'raw':!![]};switch(_0xded765){case _0xefd2('0x4'):_0x20192b[_0xefd2('0x19')]['role']='telephone';break;case _0xefd2('0x1a'):_0x20192b[_0xefd2('0x19')][_0xefd2('0x1b')]=_0xefd2('0x8');break;}return db[_0xded765][_0xefd2('0x14')](_0x20192b);}else{return[];}});}}else{return[];}})['then'](function(_0x129ada){return _0x129ada;});}function joinOrLeaveQueues(_0x1ca355,_0x33c88f,_0x11baea,_0x4d2e38){_0x1ca355[_0x33c88f](util[_0xefd2('0x1c')](_0xefd2('0x1d'),_0x11baea,_0x4d2e38[_0xefd2('0x5')]));if(_0x4d2e38[_0xefd2('0x3')]){for(var _0x570473=0x0;_0x570473<_0x4d2e38[_0xefd2('0x3')][_0xefd2('0x1e')];_0x570473+=0x1){_0x1ca355[_0x33c88f](util[_0xefd2('0x1c')](_0xefd2('0x1f'),_0x4d2e38[_0xefd2('0x3')][_0x570473][_0xefd2('0x5')]));}}}function joinOrLeave(_0x41918a,_0x49146f,_0x491286){var _0x31180b;if(_0x41918a[_0xefd2('0x20')][_0xefd2('0x21')]['id']){db[_0xefd2('0x4')][_0xefd2('0x22')]({'attributes':['id',_0xefd2('0x5'),_0xefd2('0x6'),_0xefd2('0x23')],'where':{'id':_0x41918a[_0xefd2('0x20')][_0xefd2('0x21')]['id']},'include':[{'model':db[_0xefd2('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xefd2('0x25')],'as':_0xefd2('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xefd2('0x27')],'as':_0xefd2('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xefd2('0x29')],'as':_0xefd2('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0xefd2('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xefd2('0x2c')],'as':_0xefd2('0x2d'),'attributes':['id'],'raw':!![]}]})[_0xefd2('0xb')](function(_0x46e68d){if(_0x46e68d){_0x31180b=_0x46e68d;_0x41918a[_0x49146f](util[_0xefd2('0x1c')]('user:%s',_0x46e68d[_0xefd2('0x5')]));var _0x328714=[];switch(_0x46e68d['role']){case _0xefd2('0x2e'):_0x41918a[_0x49146f](_0xefd2('0x2f'));_0x41918a[_0x49146f](_0xefd2('0x30'));if(queryQueues[_0xefd2('0x31')](_0xefd2('0x32'))){delete queryQueues[_0xefd2('0x32')];}_0x328714[_0xefd2('0x33')](db[_0xefd2('0x34')][_0xefd2('0x14')](queryQueues));_0x328714[_0xefd2('0x33')](db[_0xefd2('0x35')]['findAll'](queryQueues));_0x328714[_0xefd2('0x33')](db[_0xefd2('0x36')][_0xefd2('0x14')](queryQueues));_0x328714[_0xefd2('0x33')](db[_0xefd2('0x37')][_0xefd2('0x14')](queryQueues));_0x328714[_0xefd2('0x33')](db[_0xefd2('0x38')][_0xefd2('0x14')](queryQueues));_0x328714[_0xefd2('0x33')](db[_0xefd2('0x39')]['findAll'](queryQueues));_0x328714[_0xefd2('0x33')](db[_0xefd2('0x3a')]['findAll'](queryQueues));_0x328714[_0xefd2('0x33')](db[_0xefd2('0x4')]['findAll'](queryTelephones));_0x328714['push'](db[_0xefd2('0x3b')]['findAll'](queryTrunks));_0x328714[_0xefd2('0x33')](db[_0xefd2('0x1a')][_0xefd2('0x14')](queryCampaigns));_0x328714[_0xefd2('0x33')](db[_0xefd2('0x4')]['findAll'](queryAgents));break;case _0xefd2('0x3c'):_0x41918a[_0x49146f](_0xefd2('0x2f'));_0x41918a[_0x49146f](_0xefd2('0x30'));_0x328714[_0xefd2('0x33')](getAssociatedResources(_0xefd2('0xd'),_0x46e68d[_0xefd2('0x23')],_0xefd2('0x34')));_0x328714[_0xefd2('0x33')](getAssociatedResources(_0xefd2('0xe'),_0x46e68d[_0xefd2('0x23')],_0xefd2('0x35')));_0x328714[_0xefd2('0x33')](getAssociatedResources(_0xefd2('0xf'),_0x46e68d[_0xefd2('0x23')],_0xefd2('0x36')));_0x328714[_0xefd2('0x33')](getAssociatedResources(_0xefd2('0x10'),_0x46e68d[_0xefd2('0x23')],_0xefd2('0x37')));_0x328714[_0xefd2('0x33')](getAssociatedResources(_0xefd2('0x11'),_0x46e68d['userProfileId'],_0xefd2('0x38')));_0x328714['push'](getAssociatedResources(_0xefd2('0x12'),_0x46e68d['userProfileId'],'OpenchannelQueue'));_0x328714[_0xefd2('0x33')](getAssociatedResources(_0xefd2('0x13'),_0x46e68d[_0xefd2('0x23')],_0xefd2('0x3a')));_0x328714[_0xefd2('0x33')](getAssociatedResources('Telephones',_0x46e68d['userProfileId'],_0xefd2('0x4')));_0x328714['push'](getAssociatedResources(_0xefd2('0x3d'),_0x46e68d[_0xefd2('0x23')],'Trunk'));_0x328714[_0xefd2('0x33')](getAssociatedResources(_0xefd2('0x15'),_0x46e68d[_0xefd2('0x23')],_0xefd2('0x1a')));_0x328714['push'](db[_0xefd2('0x4')][_0xefd2('0x14')](queryAgents));break;case'agent':_0x41918a[_0x49146f](_0xefd2('0x2f'));_0x41918a[_0x49146f]('voice:outbound');_0x328714[_0xefd2('0x33')](_0x46e68d['getVoiceQueues']({'attributes':['id','name']}));_0x328714[_0xefd2('0x33')](_0x46e68d[_0xefd2('0x3e')]({'attributes':['id','name']}));_0x328714[_0xefd2('0x33')](_0x46e68d['getFaxQueues']({'attributes':['id',_0xefd2('0x5')]}));_0x328714['push'](_0x46e68d[_0xefd2('0x3f')]({'attributes':['id',_0xefd2('0x5')]}));_0x328714[_0xefd2('0x33')](_0x46e68d['getMailQueues']({'attributes':['id',_0xefd2('0x5')]}));_0x328714[_0xefd2('0x33')](_0x46e68d['getOpenchannelQueues']({'attributes':['id','name']}));_0x328714[_0xefd2('0x33')](_0x46e68d[_0xefd2('0x40')]({'attributes':['id','name']}));break;}return BPromise[_0xefd2('0x41')](_0x328714);}})[_0xefd2('0xb')](function(_0x18c4ed){if(_0x18c4ed&&_0x18c4ed[_0xefd2('0x1e')]){for(var _0x53841d=0x0;_0x53841d<_0x18c4ed[_0xefd2('0x1e')];_0x53841d+=0x1){for(var _0x359ab3=0x0;_0x359ab3<_0x18c4ed[_0x53841d][_0xefd2('0x1e')];_0x359ab3+=0x1){switch(_0x53841d){case 0x0:joinOrLeaveQueues(_0x41918a,_0x49146f,'voice',_0x18c4ed[_0x53841d][_0x359ab3]);break;case 0x1:joinOrLeaveQueues(_0x41918a,_0x49146f,_0xefd2('0x42'),_0x18c4ed[_0x53841d][_0x359ab3]);break;case 0x2:joinOrLeaveQueues(_0x41918a,_0x49146f,'fax',_0x18c4ed[_0x53841d][_0x359ab3]);break;case 0x3:joinOrLeaveQueues(_0x41918a,_0x49146f,_0xefd2('0x43'),_0x18c4ed[_0x53841d][_0x359ab3]);break;case 0x4:joinOrLeaveQueues(_0x41918a,_0x49146f,'mail',_0x18c4ed[_0x53841d][_0x359ab3]);break;case 0x5:joinOrLeaveQueues(_0x41918a,_0x49146f,_0xefd2('0x44'),_0x18c4ed[_0x53841d][_0x359ab3]);break;case 0x6:joinOrLeaveQueues(_0x41918a,_0x49146f,_0xefd2('0x45'),_0x18c4ed[_0x53841d][_0x359ab3]);break;case 0x7:if(_0x31180b['role']!==_0xefd2('0x7'))_0x41918a[_0x49146f](util[_0xefd2('0x1c')](_0xefd2('0x46'),_0x18c4ed[_0x53841d][_0x359ab3]['name']));break;case 0x8:if(_0x31180b['role']!==_0xefd2('0x7'))_0x41918a[_0x49146f](util['format'](_0xefd2('0x47'),_0x18c4ed[_0x53841d][_0x359ab3][_0xefd2('0x5')]));break;case 0x9:if(_0x31180b[_0xefd2('0x6')]!=='agent')_0x41918a[_0x49146f](util['format']('campaign:%s:%s',_0x18c4ed[_0x53841d][_0x359ab3][_0xefd2('0x1b')],_0x18c4ed[_0x53841d][_0x359ab3][_0xefd2('0x5')]));break;case 0xa:_0x41918a[_0x49146f](util[_0xefd2('0x1c')](_0xefd2('0x1f'),_0x18c4ed[_0x53841d][_0x359ab3][_0xefd2('0x5')]));break;}}}}})['then'](function(){if(_0x49146f===_0xefd2('0x48')){var _0x2c93cd=_[_0xefd2('0x18')](_0x31180b[_0xefd2('0x49')],'id');return _0x31180b[_0xefd2('0x4a')](_0x2c93cd)[_0xefd2('0xb')](function(){for(var _0x2dc474=0x0;_0x2dc474<_0x2c93cd[_0xefd2('0x1e')];_0x2dc474+=0x1){_0x491286[_0xefd2('0x4b')](_0xefd2('0x4c'),{'ChatInteractionId':Number(_0x2c93cd[_0x2dc474]),'UserId':Number(_0x31180b['id'])});}});}})[_0xefd2('0xb')](function(){if(_0x49146f===_0xefd2('0x48')){var _0x1445ed=_[_0xefd2('0x18')](_0x31180b[_0xefd2('0x26')],'id');return _0x31180b[_0xefd2('0x4d')](_0x1445ed)[_0xefd2('0xb')](function(){for(var _0x3226d3=0x0;_0x3226d3<_0x1445ed[_0xefd2('0x1e')];_0x3226d3+=0x1){_0x491286['emit'](_0xefd2('0x4e'),{'MailInteractionId':Number(_0x1445ed[_0x3226d3]),'UserId':Number(_0x31180b['id'])});}});}})[_0xefd2('0xb')](function(){if(_0x49146f===_0xefd2('0x48')){var _0x139468=_['map'](_0x31180b[_0xefd2('0x28')],'id');return _0x31180b[_0xefd2('0x4f')](_0x139468)[_0xefd2('0xb')](function(){for(var _0x421906=0x0;_0x421906<_0x139468[_0xefd2('0x1e')];_0x421906+=0x1){_0x491286[_0xefd2('0x4b')](_0xefd2('0x50'),{'FaxInteractionId':Number(_0x139468[_0x421906]),'UserId':Number(_0x31180b['id'])});}});}})[_0xefd2('0xb')](function(){if(_0x49146f===_0xefd2('0x48')){var _0x80b817=_[_0xefd2('0x18')](_0x31180b['SmsInteractions'],'id');return _0x31180b[_0xefd2('0x51')](_0x80b817)[_0xefd2('0xb')](function(){for(var _0x111c38=0x0;_0x111c38<_0x80b817[_0xefd2('0x1e')];_0x111c38+=0x1){_0x491286[_0xefd2('0x4b')](_0xefd2('0x52'),{'SmsInteractionId':Number(_0x80b817[_0x111c38]),'UserId':Number(_0x31180b['id'])});}});}})[_0xefd2('0xb')](function(){if(_0x49146f===_0xefd2('0x48')){var _0x3b45df=_[_0xefd2('0x18')](_0x31180b[_0xefd2('0x53')],'id');return _0x31180b[_0xefd2('0x54')](_0x3b45df)[_0xefd2('0xb')](function(){for(var _0x38b642=0x0;_0x38b642<_0x3b45df['length'];_0x38b642+=0x1){_0x491286[_0xefd2('0x4b')](_0xefd2('0x55'),{'OpenchannelInteractionId':Number(_0x3b45df[_0x38b642]),'UserId':Number(_0x31180b['id'])});}});}})['then'](function(){if(_0x49146f===_0xefd2('0x48')){var _0x2ccbc2=_[_0xefd2('0x18')](_0x31180b['WhatsappInteractions'],'id');return _0x31180b['removeWhatsappInteractions'](_0x2ccbc2)[_0xefd2('0xb')](function(){for(var _0x28d690=0x0;_0x28d690<_0x2ccbc2['length'];_0x28d690+=0x1){_0x491286[_0xefd2('0x4b')](_0xefd2('0x56'),{'WhatsappInteractionId':Number(_0x2ccbc2[_0x28d690]),'UserId':Number(_0x31180b['id'])});}});}})[_0xefd2('0x57')](function(_0x5cb14c){_0x41918a['log'](_0x5cb14c);});}}function onDisconnect(_0x468670,_0x61ed2a){joinOrLeave(_0x468670,'leave',_0x61ed2a);}function onConnect(_0x414746){joinOrLeave(_0x414746,_0xefd2('0x58'));}exports[_0xefd2('0x59')]=function(_0x1698e0){_0x1698e0['on']('connection',function(_0x917297){_0x917297['setMaxListeners'](0x0);_0x917297['address']=_0x917297['request'][_0xefd2('0x5a')][_0xefd2('0x5b')]+':'+_0x917297[_0xefd2('0x5c')]['connection']['remotePort'];_0x917297['connectedAt']=new Date();_0x917297['log']=function(_0x24824d){console[_0xefd2('0x5d')](_0xefd2('0x5e')+_0x917297[_0xefd2('0x5f')][_0xefd2('0x5')]+'['+_0x917297[_0xefd2('0x60')]+']',_0x24824d);};_0x917297['on']('disconnect',function(){onDisconnect(_0x917297,_0x1698e0);_0x917297[_0xefd2('0x5d')](_0xefd2('0x61'));});onConnect(_0x917297);_0x917297['log'](_0xefd2('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index b287c58..cf0ea51 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 _0xf078=['ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','then','error','code','Trigger,\x20%s','EventManager','catch','get','channel','motionChannel','resolve','undefined','ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','UserId','format','SIP/%s','name','agent','offlineMessage','event','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','AfterCreate','changed','closed','substatus','contact','User','fullname','email','default','length','hasOwnProperty','model','callback','toLowerCase','condition','../../mysqldb','jayson/promise','../logger','triggers','client','Chat'];(function(_0xcd26a9,_0x512e77){var _0x3afcbc=function(_0x40e770){while(--_0x40e770){_0xcd26a9['push'](_0xcd26a9['shift']());}};_0x3afcbc(++_0x512e77);}(_0xf078,0x82));var _0x8f07=function(_0x37870c,_0x1930f4){_0x37870c=_0x37870c-0x0;var _0x4fa321=_0xf078[_0x37870c];return _0x4fa321;};'use strict';var util=require('util');var db=require(_0x8f07('0x0'))['db'];var jayson=require(_0x8f07('0x1'));var logger=require(_0x8f07('0x2'))(_0x8f07('0x3'));var client=jayson[_0x8f07('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x8f07('0x5'),'model':_0x8f07('0x6'),'event':'afterCreate','condition':_0x8f07('0x7'),'callback':afterCreate},{'channel':_0x8f07('0x5'),'model':_0x8f07('0x6'),'event':_0x8f07('0x8'),'condition':_0x8f07('0x9'),'callback':afterUpdate},{'channel':_0x8f07('0x5'),'model':_0x8f07('0xa'),'event':_0x8f07('0xb'),'condition':_0x8f07('0xc'),'callback':afterCreateMessage},{'channel':_0x8f07('0x5'),'model':'ChatOfflineMessage','event':_0x8f07('0xb'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x8f07('0xd'),'model':_0x8f07('0xe'),'event':_0x8f07('0xb'),'condition':_0x8f07('0x7'),'callback':afterCreate},{'channel':_0x8f07('0xd'),'model':'SmsInteraction','event':_0x8f07('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x8f07('0xd'),'model':_0x8f07('0xf'),'event':_0x8f07('0xb'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8f07('0x10'),'model':_0x8f07('0x11'),'event':_0x8f07('0xb'),'condition':_0x8f07('0x7'),'callback':afterCreate},{'channel':_0x8f07('0x10'),'model':_0x8f07('0x11'),'event':_0x8f07('0x8'),'condition':_0x8f07('0x9'),'callback':afterUpdate},{'channel':_0x8f07('0x10'),'model':'WhatsappMessage','event':_0x8f07('0xb'),'condition':_0x8f07('0xc'),'callback':afterCreateMessage},{'channel':_0x8f07('0x12'),'model':_0x8f07('0x13'),'event':_0x8f07('0xb'),'condition':_0x8f07('0x7'),'callback':afterCreate},{'channel':_0x8f07('0x12'),'model':'FaxInteraction','event':_0x8f07('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x8f07('0x12'),'model':'FaxMessage','event':_0x8f07('0xb'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8f07('0x14'),'model':_0x8f07('0x15'),'event':_0x8f07('0xb'),'condition':_0x8f07('0x7'),'callback':afterCreate},{'channel':_0x8f07('0x14'),'model':_0x8f07('0x15'),'event':_0x8f07('0x8'),'condition':_0x8f07('0x9'),'callback':afterUpdate},{'channel':_0x8f07('0x14'),'model':_0x8f07('0x16'),'event':_0x8f07('0xb'),'condition':_0x8f07('0xc'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x8f07('0x17'),'event':_0x8f07('0xb'),'condition':_0x8f07('0x7'),'callback':afterCreate},{'channel':_0x8f07('0x18'),'model':'OpenchannelInteraction','event':_0x8f07('0x8'),'condition':_0x8f07('0x9'),'callback':afterUpdate},{'channel':_0x8f07('0x18'),'model':_0x8f07('0x19'),'event':_0x8f07('0xb'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x23ae91){return client[_0x8f07('0x1a')]('EventManager',_0x23ae91)[_0x8f07('0x1b')](function(_0x2635da){logger['info']('Trigger,\x20%s','EventManager',_0x2635da);if(_0x2635da[_0x8f07('0x1c')]){if(_0x2635da['error'][_0x8f07('0x1d')]===0x1f4){logger[_0x8f07('0x1c')](_0x8f07('0x1e'),_0x8f07('0x1f'),_0x2635da[_0x8f07('0x1c')]);}}})[_0x8f07('0x20')](function(_0x53a139){logger[_0x8f07('0x1c')](_0x8f07('0x1e'),_0x8f07('0x1f'),_0x53a139);});}function afterCreateMessage(_0x194d3b){return function(_0x5826e3){_0x5826e3=_0x5826e3[_0x8f07('0x21')]({'plain':!![]});_0x5826e3[_0x8f07('0x22')]=_0x194d3b;_0x5826e3[_0x8f07('0x23')]=_0x194d3b;_0x5826e3['event']=_0x5826e3['direction'];Promise[_0x8f07('0x24')]()[_0x8f07('0x1b')](function(){if(typeof _0x5826e3['ContactId']===_0x8f07('0x25'))return null;var _0x17e0c2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5826e3[_0x8f07('0x26')];return db[_0x8f07('0x27')][_0x8f07('0x28')](_0x17e0c2,{'type':db[_0x8f07('0x29')][_0x8f07('0x2a')][_0x8f07('0x2b')],'raw':!![]});})[_0x8f07('0x1b')](function(_0x3af030){if(_0x3af030){_0x5826e3['contact']=_0x3af030[0x0];}if(typeof _0x5826e3[_0x8f07('0x2c')]===_0x8f07('0x25'))return;return getAgent(_0x5826e3[_0x8f07('0x2c')]);})[_0x8f07('0x1b')](function(_0x4102ac){if(_0x4102ac){_0x5826e3['interface']=util[_0x8f07('0x2d')](_0x8f07('0x2e'),_0x4102ac[_0x8f07('0x2f')]);_0x5826e3[_0x8f07('0x30')]=_0x4102ac;_0x5826e3[_0x8f07('0x22')]=_0x194d3b;return request({'event':'incomingmessage','message':_0x5826e3});}else{return request({'event':'outgoingmessage','message':_0x5826e3});}})[_0x8f07('0x20')](function(_0x59e79b){logger[_0x8f07('0x1c')]('Trigger,\x20%s','AfterCreateMessage',_0x59e79b);});};}function afterCreateOfflineMessage(_0x24aa83){return function(_0x31c209){_0x31c209=_0x31c209[_0x8f07('0x21')]({'plain':!![]});_0x31c209[_0x8f07('0x22')]=_0x24aa83;_0x31c209[_0x8f07('0x23')]=_0x24aa83;_0x31c209['event']=_0x8f07('0x31');return request({'event':_0x31c209[_0x8f07('0x32')],'message':_0x31c209});};}function afterCreate(_0x560abd,_0xed4ccd){return function(_0x1c6cf4){_0x1c6cf4=_0x1c6cf4[_0x8f07('0x21')]({'plain':!![]});_0x1c6cf4[_0x8f07('0x22')]=_0x560abd;_0x1c6cf4[_0x8f07('0x23')]=_0x560abd;_0x1c6cf4[_0x8f07('0x32')]=_0x8f07('0x33');Promise[_0x8f07('0x24')]()[_0x8f07('0x1b')](function(){var _0x5e0d56=_0x8f07('0x34')+_0x1c6cf4[_0x8f07('0x26')];return db[_0x8f07('0x27')][_0x8f07('0x28')](_0x5e0d56,{'type':db[_0x8f07('0x29')][_0x8f07('0x2a')][_0x8f07('0x2b')],'raw':!![]});})[_0x8f07('0x1b')](function(_0x47fd08){if(_0x47fd08){_0x1c6cf4['contact']=_0x47fd08[0x0];}if(typeof _0x1c6cf4[_0x8f07('0x2c')]===_0x8f07('0x25'))return;return getAgent(_0x1c6cf4['UserId']);})[_0x8f07('0x1b')](function(_0x121852){if(_0x121852){_0x1c6cf4['interface']=util[_0x8f07('0x2d')](_0x8f07('0x2e'),_0x121852['name']);_0x1c6cf4[_0x8f07('0x30')]=_0x121852;}return request({'event':_0xed4ccd,'message':_0x1c6cf4});})[_0x8f07('0x20')](function(_0x452299){logger[_0x8f07('0x1c')]('Trigger,\x20%s',_0x8f07('0x35'),_0x452299);});};}function afterUpdate(_0x1b916a){return function(_0x594bf9){var _0x262dde=_0x594bf9[_0x8f07('0x36')]('closed')&&_0x594bf9[_0x8f07('0x37')];var _0x40affe=_0x594bf9[_0x8f07('0x36')](_0x8f07('0x38'));if(_0x262dde||_0x40affe){var _0x2e18ae=_0x262dde?'closedinteraction':'substatus';var _0x155806=_0x594bf9[_0x8f07('0x21')]({'plain':!![]});_0x155806[_0x8f07('0x22')]=_0x1b916a;_0x155806[_0x8f07('0x23')]=_0x1b916a;_0x155806[_0x8f07('0x32')]=_0x262dde?_0x8f07('0x37'):'substatus';var _0xc6d7e7=_0x8f07('0x34')+_0x155806[_0x8f07('0x26')];return db[_0x8f07('0x27')]['query'](_0xc6d7e7,{'type':db[_0x8f07('0x29')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x35658c){if(_0x35658c){_0x155806[_0x8f07('0x39')]=_0x35658c[0x0];}if(typeof _0x155806[_0x8f07('0x2c')]==='undefined')return;return getAgent(_0x155806[_0x8f07('0x2c')]);})[_0x8f07('0x1b')](function(_0x4bf9ff){if(_0x4bf9ff){_0x155806['interface']=util[_0x8f07('0x2d')]('SIP/%s',_0x4bf9ff[_0x8f07('0x2f')]);_0x155806['agent']=_0x4bf9ff;}return request({'event':_0x2e18ae,'message':_0x155806});})[_0x8f07('0x20')](function(_0x5e17b4){logger[_0x8f07('0x1c')](_0x8f07('0x1e'),'AfterUpdate',_0x5e17b4);});}};}function getAgent(_0xce435){return db[_0x8f07('0x3a')]['find']({'where':{'id':_0xce435},'attributes':['id',_0x8f07('0x2f'),_0x8f07('0x3b'),_0x8f07('0x3c'),'internal'],'raw':!![]})[_0x8f07('0x1b')](function(_0x165214){return _0x165214;});}exports[_0x8f07('0x3d')]=function(){for(var _0x6e2e64=0x0;_0x6e2e64=_0xd9e43[_0xf776('0xf')]){throw Error(_0xf776('0x10'));}_0x1a4d57(_0x4e2479);})[_0xf776('0x11')](function(_0x120ad8){_0x58e982(_0x120ad8);});});}; \ No newline at end of file +var _0xb2c8=['bluebird','../mysqldb','voice','mail','chat','fax','sms','whatsapp','getChannels','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch'];(function(_0x2f876b,_0x2b426e){var _0x2aec7=function(_0x3af656){while(--_0x3af656){_0x2f876b['push'](_0x2f876b['shift']());}};_0x2aec7(++_0x2b426e);}(_0xb2c8,0xc0));var _0x8b2c=function(_0x1c195e,_0x48c703){_0x1c195e=_0x1c195e-0x0;var _0x1020c3=_0xb2c8[_0x1c195e];return _0x1020c3;};'use strict';var _=require('lodash');var BPromise=require(_0x8b2c('0x0'));var db=require(_0x8b2c('0x1'))['db'];var util=require('./license/util');var channels=[_0x8b2c('0x2'),_0x8b2c('0x3'),_0x8b2c('0x4'),_0x8b2c('0x5'),_0x8b2c('0x6'),_0x8b2c('0x7'),'openchannel'];exports[_0x8b2c('0x8')]=function(){return channels;};exports['isValidChannel']=function(_0x2817e9){_0x2817e9=_0x2817e9[_0x8b2c('0x9')]();return _[_0x8b2c('0xa')](channels,_0x2817e9);};exports[_0x8b2c('0xb')]=function(_0x91bd2a,_0x42c00c,_0x1570ee,_0x4f12de){var _0x5eb9c9={'loginAttempts':_0x42c00c,'blocked':_0x1570ee};if(!_[_0x8b2c('0xc')](_0x4f12de)){_0x5eb9c9[_0x8b2c('0xd')]=_0x4f12de;}return _0x91bd2a[_0x8b2c('0xe')](_0x5eb9c9);};exports[_0x8b2c('0xf')]=function(_0x4f2b58){return new BPromise(function(_0x265d4e,_0x1087b6){var _0x9dd56c=0x0;if(_0x4f2b58[_0x8b2c('0x10')]!==_0x8b2c('0x11')){_0x265d4e(_0x4f2b58);}db[_0x8b2c('0x12')][_0x8b2c('0x13')]({'where':{'role':_0x8b2c('0x11'),'online':!![],'id':{'$ne':_0x4f2b58['id']}}})[_0x8b2c('0x14')](function(_0x2feef1){_0x9dd56c=_0x2feef1;return util[_0x8b2c('0xf')]();})[_0x8b2c('0x14')](function(_0x19b197){if(_0x19b197&&_0x19b197['agents']&&_0x9dd56c>=_0x19b197[_0x8b2c('0x15')]){throw Error(_0x8b2c('0x16'));}_0x265d4e(_0x4f2b58);})[_0x8b2c('0x17')](function(_0x295bbe){_0x1087b6(_0x295bbe);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 72d56f4..cb5aa0c 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad0a=['name','inherits','message','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','error','stack','statusMessage','exports','util'];(function(_0x197407,_0x137544){var _0x52b5e4=function(_0x2d4bca){while(--_0x2d4bca){_0x197407['push'](_0x197407['shift']());}};_0x52b5e4(++_0x137544);}(_0xad0a,0x168));var _0xaad0=function(_0x1d93e2,_0x370879){_0x1d93e2=_0x1d93e2-0x0;var _0x20be50=_0xad0a[_0x1d93e2];return _0x20be50;};'use strict';var util=require(_0xaad0('0x0'));var logger=require('../config/logger')('api');var APIError=function(_0x17333b,_0x55296d){this['message']=_0x17333b||'Internal\x20Server\x20Error';this[_0xaad0('0x1')]=_0x55296d||'Error';util[_0xaad0('0x2')](APIError,Error);};var APIBadRequestError=function(_0x3893e4){this[_0xaad0('0x3')]=_0x3893e4||_0xaad0('0x4');this[_0xaad0('0x1')]=_0xaad0('0x4');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x2977e6){this[_0xaad0('0x3')]=_0x2977e6||_0xaad0('0x5');this['name']=_0xaad0('0x5');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x327809){this[_0xaad0('0x3')]=_0x327809||_0xaad0('0x6');this[_0xaad0('0x1')]=_0xaad0('0x7');util[_0xaad0('0x2')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x49ecf8){this[_0xaad0('0x3')]=_0x49ecf8||_0xaad0('0x8');this[_0xaad0('0x1')]=_0xaad0('0x9');this[_0xaad0('0xa')]=0x193;this[_0xaad0('0xb')]={'type':_0xaad0('0xc')};util[_0xaad0('0x2')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0xc8956a){this[_0xaad0('0x3')]=_0xc8956a||_0xaad0('0xd');this['name']=_0xaad0('0xe');util[_0xaad0('0x2')](APIBadRequestError,APIError);};function getStatusCode(_0x246c6c){switch(_0x246c6c){case'Bad\x20Request':return 0x190;case _0xaad0('0x5'),_0xaad0('0x9'):return 0x193;case _0xaad0('0x7'):return 0x194;case _0xaad0('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x298f80){if(_0x298f80===_0xaad0('0x9'))return _0x298f80;return null;}function handleError(_0x49e35c){return function(_0x4a0845){logger[_0xaad0('0xf')](_0x4a0845[_0xaad0('0x10')]);var _0x23636f=getStatusCode(_0x4a0845[_0xaad0('0x1')]);var _0x2bfe46=getCustomStatusMessage(_0x4a0845[_0xaad0('0x1')]);if(_0x4a0845[_0xaad0('0x1')]){delete _0x4a0845['name'];}if(_0x2bfe46){_0x49e35c[_0xaad0('0x11')]=_0x2bfe46;}return _0x49e35c['status'](_0x23636f)['send'](_0x4a0845);};}module[_0xaad0('0x12')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xb8c9=['inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','Resource\x20Conflict','Conflict','error','stack','statusMessage','status','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error'];(function(_0x1f29a8,_0x15ee9b){var _0xc62ab7=function(_0x276fce){while(--_0x276fce){_0x1f29a8['push'](_0x1f29a8['shift']());}};_0xc62ab7(++_0x15ee9b);}(_0xb8c9,0x13b));var _0x9b8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8c9[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x9b8c('0x0'));var logger=require(_0x9b8c('0x1'))(_0x9b8c('0x2'));var APIError=function(_0x1911c6,_0x149daa){this[_0x9b8c('0x3')]=_0x1911c6||_0x9b8c('0x4');this[_0x9b8c('0x5')]=_0x149daa||_0x9b8c('0x6');util[_0x9b8c('0x7')](APIError,Error);};var APIBadRequestError=function(_0x4377dd){this[_0x9b8c('0x3')]=_0x4377dd||_0x9b8c('0x8');this['name']=_0x9b8c('0x8');util[_0x9b8c('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x5656f6){this['message']=_0x5656f6||_0x9b8c('0x9');this[_0x9b8c('0x5')]=_0x9b8c('0x9');util[_0x9b8c('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x1941c5){this[_0x9b8c('0x3')]=_0x1941c5||_0x9b8c('0xa');this[_0x9b8c('0x5')]=_0x9b8c('0xb');util[_0x9b8c('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x576bf6){this['message']=_0x576bf6||_0x9b8c('0xc');this[_0x9b8c('0x5')]=_0x9b8c('0xd');this[_0x9b8c('0xe')]=0x193;this[_0x9b8c('0xf')]={'type':'OutOfInterval'};util[_0x9b8c('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x589666){this[_0x9b8c('0x3')]=_0x589666||_0x9b8c('0x10');this['name']=_0x9b8c('0x11');util[_0x9b8c('0x7')](APIBadRequestError,APIError);};function getStatusCode(_0x4fe627){switch(_0x4fe627){case'Bad\x20Request':return 0x190;case'Forbidden',_0x9b8c('0xd'):return 0x193;case _0x9b8c('0xb'):return 0x194;case _0x9b8c('0x11'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x708b8){if(_0x708b8===_0x9b8c('0xd'))return _0x708b8;return null;}function handleError(_0x4feb58){return function(_0x2152f0){logger[_0x9b8c('0x12')](_0x2152f0[_0x9b8c('0x13')]);var _0x117e96=getStatusCode(_0x2152f0['name']);var _0x298cdc=getCustomStatusMessage(_0x2152f0['name']);if(_0x2152f0['name']){delete _0x2152f0[_0x9b8c('0x5')];}if(_0x298cdc){_0x4feb58[_0x9b8c('0x14')]=_0x298cdc;}return _0x4feb58[_0x9b8c('0x15')](_0x117e96)['send'](_0x2152f0);};}module[_0x9b8c('0x16')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index d23364e..9163762 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f2a=['status','render','exports','404'];(function(_0x10ff18,_0x11a300){var _0x76d79c=function(_0x10cd21){while(--_0x10cd21){_0x10ff18['push'](_0x10ff18['shift']());}};_0x76d79c(++_0x11a300);}(_0x0f2a,0x12e));var _0xa0f2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0f2a[_0x2641f9];return _0x585741;};'use strict';module[_0xa0f2('0x0')][0x194]=function pageNotFound(_0x3867de,_0x639f47){var _0xc6cb26=_0xa0f2('0x1');var _0x327a2f=0x194;var _0x301858={'status':_0x327a2f};_0x639f47['status'](_0x301858[_0xa0f2('0x2')]);_0x639f47[_0xa0f2('0x3')](_0xc6cb26,{},function(_0xe9494,_0x56a16e){if(_0xe9494){return _0x639f47[_0xa0f2('0x2')](_0x301858[_0xa0f2('0x2')])['json'](_0x301858);}_0x639f47['send'](_0x56a16e);});}; \ No newline at end of file +var _0x9d11=['status','render','send','exports'];(function(_0x22b92e,_0x5aeeaf){var _0x192059=function(_0x1081b7){while(--_0x1081b7){_0x22b92e['push'](_0x22b92e['shift']());}};_0x192059(++_0x5aeeaf);}(_0x9d11,0xb7));var _0x19d1=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x9d11[_0x424a9a];return _0xa7831c;};'use strict';module[_0x19d1('0x0')][0x194]=function pageNotFound(_0x34272c,_0x338f83){var _0x15c8ab='404';var _0x346cec=0x194;var _0x22d70e={'status':_0x346cec};_0x338f83[_0x19d1('0x1')](_0x22d70e[_0x19d1('0x1')]);_0x338f83[_0x19d1('0x2')](_0x15c8ab,{},function(_0x1e644b,_0x4dcf38){if(_0x1e644b){return _0x338f83[_0x19d1('0x1')](_0x22d70e[_0x19d1('0x1')])['json'](_0x22d70e);}_0x338f83[_0x19d1('0x3')](_0x4dcf38);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 111d659..1404d4e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6526=['../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','Integration','../api/integration/integration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','../api/license/license.model','../api/campaign/campaign.model','../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','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','MailInteractionHasTag','hasOne','UserId','userSetting','cascade','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteraction','UserNotification','UserNotifications','SenderId','Hoppers','belongsTo','UserProfile','userProfileId','Groups','chat_group_has_users','belongsToMany','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoicePrefixes','MailQueue','MailQueues','UserMailQueue','ChatQueues','UserChatQueue','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','OpenchannelAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','VoiceChanSpy','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','MailServerOut','Imap','Smtp','Answers','MailApplication','List','ListId','Template','TemplateId','mandatoryDispositionPause','user_has_mail_accounts','team_has_mail_queues','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','TagId','Items','FaxAccount','Dispositions','FaxAccountId','Interactions','Exntensions','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','CannedAnswer','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','Agent','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatProactiveAction','Website','CmCompany','Contacts','CompanyId','Phones','CmContactId','Company','cm_contact_has_tags','CmHopperId','Queue','Campaign','CampaignId','OwnerId','Automation','All','OneAll','AutomationAllId','Condition','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','Schedule','DefaultReportId','CustomReportId','moh_has_sounds','whatsapp_interaction_has_tags','ContactItemType','ItemType','ItemTypeId','Hopper','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','AnalyticFieldReport','Fields','MetricId','SalesforceAccount','Configurations','SalesforceField','Subjects','DescriptionId','AccountId','SubjectId','Field','FieldId','Variable','Descriptions','Subject','Description','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','VariableId','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','ServicenowAccount','ServicenowField','ToId','SessionId','ProjectId','VoiceQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromUserId','FromAgent','ToUserId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','UserSetting','user','MailServerIn','exports','sequelize','determine','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','127.0.0.1','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmContact','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','../api/automation/automation.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','../api/sound/sound.model','Tag','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account'];(function(_0x4c59bc,_0x368fdd){var _0x5350bf=function(_0x57574e){while(--_0x57574e){_0x4c59bc['push'](_0x4c59bc['shift']());}};_0x5350bf(++_0x368fdd);}(_0x6526,0x146));var _0x6652=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0x6526[_0x5db657];return _0x2d6e70;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x6652('0x0'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x6652('0x1')]();config[_0x6652('0x0')]=_['defaultsDeep'](config[_0x6652('0x0')],{'database':_0x6652('0x2'),'username':_0x6652('0x3'),'password':_0x6652('0x4'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x6652('0x5'),'dialectOptions':{'charset':_0x6652('0x6')},'logging':![],'timezone':timezone[_0x6652('0x7')](),'define':{'charset':_0x6652('0x8'),'collate':_0x6652('0x9')}}});config[_0x6652('0xa')]=_[_0x6652('0xb')](config[_0x6652('0xa')],{'database':'motion2','username':_0x6652('0x3'),'password':_0x6652('0x4'),'options':{'host':_0x6652('0xc'),'port':0xcea,'dialect':_0x6652('0x5'),'dialectOptions':{'charset':_0x6652('0x6')},'logging':![],'timezone':timezone[_0x6652('0x7')](),'define':{'charset':_0x6652('0x8'),'collate':_0x6652('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x6652('0xd')],config[_0x6652('0x0')][_0x6652('0xe')],config['sequelize'][_0x6652('0xf')],config['sequelize'][_0x6652('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory']['database'],config['sequelizeHistory'][_0x6652('0xe')],config[_0x6652('0xa')][_0x6652('0xf')],config['sequelizeHistory'][_0x6652('0x10')])};db[_0x6652('0x11')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x13'));db['VoiceChanSpy']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x14'));db[_0x6652('0x15')]=db[_0x6652('0x0')]['import'](_0x6652('0x16'));db['VoiceExtension']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x17'));db['VoiceMusicOnHold']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x18'));db[_0x6652('0x19')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x1a'));db[_0x6652('0x1b')]=db[_0x6652('0x0')]['import'](_0x6652('0x1c'));db[_0x6652('0x1d')]=db[_0x6652('0x0')]['import']('../api/screenRecording/screenRecording.model');db[_0x6652('0x1e')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x1f'));db[_0x6652('0x20')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x21'));db[_0x6652('0x22')]=db['sequelize']['import'](_0x6652('0x23'));db[_0x6652('0x24')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x25'));db[_0x6652('0x26')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x27'));db['VoiceQueueReport']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x28'));db[_0x6652('0x29')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x2a'));db[_0x6652('0x2b')]=db['sequelize']['import'](_0x6652('0x2c'));db[_0x6652('0x2d')]=db['sequelize'][_0x6652('0x12')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x6652('0x2e')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x2f'));db[_0x6652('0x30')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x31'));db['UserChatQueue']=db['sequelize'][_0x6652('0x12')](_0x6652('0x32'));db['UserMailQueue']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x33'));db[_0x6652('0x34')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/userFaxQueue/userFaxQueue.model');db[_0x6652('0x35')]=db[_0x6652('0x0')]['import'](_0x6652('0x36'));db[_0x6652('0x37')]=db['sequelize'][_0x6652('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x6652('0x38')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x39'));db['MailServerIn']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x3a'));db['MailServerOut']=db['sequelize']['import'](_0x6652('0x3b'));db[_0x6652('0x3c')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x3d'));db['MailQueue']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x3e'));db[_0x6652('0x3f')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x40'));db['MailInteraction']=db[_0x6652('0x0')][_0x6652('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x6652('0x41')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x42'));db['MailApplication']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x43'));db[_0x6652('0x44')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x45'));db[_0x6652('0x46')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x47'));db['DashboardItem']=db['sequelize'][_0x6652('0x12')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x48'));db[_0x6652('0x49')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x4a'));db[_0x6652('0x4b')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x4c'));db[_0x6652('0x4d')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x4e'));db['FaxQueue']=db[_0x6652('0x0')][_0x6652('0x12')]('../api/faxQueue/faxQueue.model');db[_0x6652('0x4f')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x50'));db[_0x6652('0x51')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x52'));db[_0x6652('0x53')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/smsApplication/smsApplication.model');db[_0x6652('0x54')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/smsInteraction/smsInteraction.model');db[_0x6652('0x55')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x56'));db[_0x6652('0x57')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x58'));db[_0x6652('0x59')]=db['sequelize'][_0x6652('0x12')]('../api/openchannelAccount/openchannelAccount.model');db[_0x6652('0x5a')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x5b'));db[_0x6652('0x5c')]=db['sequelize']['import'](_0x6652('0x5d'));db[_0x6652('0x5e')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/openchannelMessage/openchannelMessage.model');db[_0x6652('0x5f')]=db['sequelize'][_0x6652('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0x6652('0x60')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x61'));db[_0x6652('0x62')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x63'));db[_0x6652('0x64')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x65'));db[_0x6652('0x66')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x67'));db[_0x6652('0x68')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x69'));db[_0x6652('0x6a')]=db['sequelize'][_0x6652('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x6652('0x6b')]=db[_0x6652('0x0')]['import'](_0x6652('0x6c'));db[_0x6652('0x6d')]=db[_0x6652('0x0')]['import'](_0x6652('0x6e'));db['ChatProactiveAction']=db[_0x6652('0x0')]['import'](_0x6652('0x6f'));db['CmCompany']=db[_0x6652('0x0')][_0x6652('0x12')]('../api/cmCompany/cmCompany.model');db[_0x6652('0x70')]=db['sequelize']['import']('../api/cmContact/cmContact.model');db[_0x6652('0x71')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/cmHopper/cmHopper.model');db[_0x6652('0x72')]=db[_0x6652('0x0')]['import'](_0x6652('0x73'));db[_0x6652('0x74')]=db[_0x6652('0x0')]['import'](_0x6652('0x75'));db[_0x6652('0x76')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x77'));db[_0x6652('0x78')]=db[_0x6652('0x0')]['import'](_0x6652('0x79'));db[_0x6652('0x7a')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x6652('0x7b')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x7c'));db['Automation']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x7d'));db['CannedAnswer']=db[_0x6652('0x0')][_0x6652('0x12')]('../api/cannedAnswer/cannedAnswer.model');db[_0x6652('0x7e')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x7f'));db['Condition']=db[_0x6652('0x0')]['import'](_0x6652('0x80'));db[_0x6652('0x81')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x82'));db[_0x6652('0x83')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/pause/pause.model');db[_0x6652('0x84')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x85'));db[_0x6652('0x86')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x87'));db['Schedule']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x88'));db['Sound']=db['sequelize']['import'](_0x6652('0x89'));db[_0x6652('0x8a')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/tag/tag.model');db['ContactItemType']=db[_0x6652('0x0')]['import']('../api/contactItemType/contactItemType.model');db[_0x6652('0x8b')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x8c'));db[_0x6652('0x8d')]=db['sequelize'][_0x6652('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x8e'));db[_0x6652('0x8f')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x90'));db['Variable']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x91'));db['Integration']=db[_0x6652('0x0')][_0x6652('0x12')]('../api/integration/integration.model');db['IntegrationReport']=db[_0x6652('0x0')][_0x6652('0x12')]('../api/integrationReport/integrationReport.model');db[_0x6652('0x92')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x93'));db[_0x6652('0x94')]=db[_0x6652('0x0')]['import'](_0x6652('0x95'));db[_0x6652('0x96')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x97'));db[_0x6652('0x98')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x99'));db['AnalyticFieldReport']=db[_0x6652('0x0')][_0x6652('0x12')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x6652('0x0')][_0x6652('0x12')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0x6652('0x0')]['import'](_0x6652('0x9a'));db[_0x6652('0x9b')]=db['sequelize'][_0x6652('0x12')](_0x6652('0x9c'));db['SalesforceField']=db['sequelize'][_0x6652('0x12')](_0x6652('0x9d'));db[_0x6652('0x9e')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x9f'));db[_0x6652('0xa0')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xa1'));db[_0x6652('0xa2')]=db[_0x6652('0x0')]['import'](_0x6652('0xa3'));db[_0x6652('0xa4')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xa5'));db[_0x6652('0xa6')]=db[_0x6652('0x0')]['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x6652('0xa7')]=db['sequelize'][_0x6652('0x12')](_0x6652('0xa8'));db['ZohoAccount']=db[_0x6652('0x0')]['import']('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xa9'));db[_0x6652('0xaa')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xab'));db[_0x6652('0xac')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xad'));db[_0x6652('0xae')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xaf'));db['ZendeskField']=db[_0x6652('0x0')][_0x6652('0x12')]('../api/intZendeskField/intZendeskField.model');db[_0x6652('0xb0')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xb1'));db['FreshdeskConfiguration']=db['sequelize']['import'](_0x6652('0xb2'));db[_0x6652('0xb3')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xb4'));db[_0x6652('0xb5')]=db[_0x6652('0x0')]['import'](_0x6652('0xb6'));db[_0x6652('0xb7')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x6652('0xb8')]=db['sequelize']['import'](_0x6652('0xb9'));db['ServicenowAccount']=db[_0x6652('0x0')]['import'](_0x6652('0xba'));db[_0x6652('0xbb')]=db['sequelize'][_0x6652('0x12')](_0x6652('0xbc'));db['ServicenowField']=db['sequelize'][_0x6652('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x6652('0xbd')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xbe'));db[_0x6652('0xbf')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x6652('0xc0')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xc1'));db[_0x6652('0xc2')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x6652('0xc3')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x6652('0xc4')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x6652('0xc5')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xc6'));db[_0x6652('0xc7')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/network/network.model');db[_0x6652('0xc8')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xc9'));db['ChatInternalMessage']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xca'));db[_0x6652('0xcb')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x6652('0xcc')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xcd'));db['JscriptySessionReport']=db['sequelize'][_0x6652('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x6652('0xce')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xcf'));db[_0x6652('0xd0')]=db['sequelize'][_0x6652('0x12')](_0x6652('0xd1'));db[_0x6652('0xd2')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xd3'));db[_0x6652('0xd4')]=db[_0x6652('0x0')]['import'](_0x6652('0xd5'));db[_0x6652('0xd6')]=db[_0x6652('0x0')]['import'](_0x6652('0xd7'));db[_0x6652('0xd8')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xd9'));db[_0x6652('0xda')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xdb'));db[_0x6652('0xdc')]=db['sequelize'][_0x6652('0x12')](_0x6652('0xdd'));db[_0x6652('0xde')]=db['sequelize']['import'](_0x6652('0xdf'));db['Team']=db[_0x6652('0x0')]['import']('../api/team/team.model');db[_0x6652('0xe0')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xe1'));db['Campaign']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xe2'));db['Migration']=db[_0x6652('0x0')]['import'](_0x6652('0xe3'));db[_0x6652('0xe4')]=db[_0x6652('0x0')]['import'](_0x6652('0xe5'));db[_0x6652('0xe6')]=db[_0x6652('0x0')]['import'](_0x6652('0xe7'));db[_0x6652('0xe8')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xe9'));db[_0x6652('0xea')]=db[_0x6652('0x0')]['import'](_0x6652('0xeb'));db[_0x6652('0xec')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/faxTransferReport/faxTransferReport.model');db[_0x6652('0xed')]=db[_0x6652('0x0')]['import'](_0x6652('0xee'));db[_0x6652('0xef')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xf0'));db[_0x6652('0xf1')]=db[_0x6652('0x0')][_0x6652('0x12')]('../api/cmList/cmList.model');db[_0x6652('0xf2')]=db[_0x6652('0x0')]['import'](_0x6652('0xf3'));db['UserProfile']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xf4'));db[_0x6652('0xf5')]=db[_0x6652('0x0')]['import'](_0x6652('0xf6'));db[_0x6652('0xf7')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xf8'));db['UserNotification']=db[_0x6652('0x0')]['import']('../api/userNotification/userNotification.model');db[_0x6652('0xf9')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xfa'));db[_0x6652('0xfb')]=db[_0x6652('0x0')]['import'](_0x6652('0xfc'));db[_0x6652('0xfd')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0xfe'));db[_0x6652('0xff')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x100'));db['WhatsappQueueReport']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x101'));db[_0x6652('0x102')]=db[_0x6652('0x0')]['import'](_0x6652('0x103'));db[_0x6652('0x104')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x105'));db['CloudProvider']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x106'));db[_0x6652('0x107')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x108'));db[_0x6652('0x109')]=db[_0x6652('0x0')]['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x6652('0x10a')]=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x10b'));db['UserSetting']=db[_0x6652('0x0')][_0x6652('0x12')](_0x6652('0x10c'));db[_0x6652('0x10d')]=db['sequelize'][_0x6652('0x12')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db[_0x6652('0x11')][_0x6652('0x10e')](db[_0x6652('0x1e')],{'as':_0x6652('0x1e'),'onDelete':'cascade','foreignKey':_0x6652('0x10f')});db[_0x6652('0x11')][_0x6652('0x10e')](db['UserSetting'],{'as':_0x6652('0x110'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x10f')});db[_0x6652('0x11')][_0x6652('0x112')](db[_0x6652('0x1b')],{'as':_0x6652('0x113'),'foreignKey':_0x6652('0x10f')});db[_0x6652('0x11')][_0x6652('0x112')](db[_0x6652('0x2e')],{'as':_0x6652('0x114'),'foreignKey':'UserId'});db[_0x6652('0x11')][_0x6652('0x112')](db[_0x6652('0x115')],{'as':_0x6652('0x116'),'onDelete':'cascade','hooks':!![]});db[_0x6652('0x11')][_0x6652('0x112')](db['CmHopperFinal'],{'as':_0x6652('0x117'),'foreignKey':_0x6652('0x10f')});db[_0x6652('0x11')][_0x6652('0x112')](db['CmHopperHistory'],{'as':_0x6652('0x118'),'foreignKey':'UserId'});db[_0x6652('0x11')]['hasMany'](db[_0x6652('0x78')],{'as':_0x6652('0x78'),'foreignKey':_0x6652('0x10f')});db[_0x6652('0x11')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x6652('0x119'),'foreignKey':_0x6652('0x10f')});db[_0x6652('0x11')][_0x6652('0x112')](db[_0x6652('0x66')],{'as':_0x6652('0x11a'),'foreignKey':_0x6652('0x10f')});db[_0x6652('0x11')]['hasMany'](db[_0x6652('0x54')],{'as':'SmsInteractions','foreignKey':_0x6652('0x10f')});db[_0x6652('0x11')][_0x6652('0x112')](db[_0x6652('0x4b')],{'as':_0x6652('0x11b'),'foreignKey':_0x6652('0x10f')});db[_0x6652('0x11')][_0x6652('0x112')](db[_0x6652('0x11c')],{'as':'MailInteractions','foreignKey':'UserId'});db['User'][_0x6652('0x112')](db[_0x6652('0xfd')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x6652('0x11')][_0x6652('0x112')](db[_0x6652('0x11d')],{'as':_0x6652('0x11e'),'foreignKey':_0x6652('0x11f')});db[_0x6652('0x11')][_0x6652('0x112')](db[_0x6652('0x71')],{'as':_0x6652('0x120'),'foreignKey':_0x6652('0x10f'),'onDelete':'SET\x20NULL'});db[_0x6652('0x11')][_0x6652('0x121')](db[_0x6652('0x122')],{'as':_0x6652('0x122'),'foreignKey':_0x6652('0x123')});db[_0x6652('0x11')]['belongsToMany'](db[_0x6652('0x6d')],{'as':_0x6652('0x124'),'through':_0x6652('0x125')});db['User'][_0x6652('0x126')](db[_0x6652('0x70')],{'as':'Contacts','through':_0x6652('0x127')});db['User'][_0x6652('0x126')](db[_0x6652('0xf1')],{'as':_0x6652('0x128'),'through':_0x6652('0x129')});db['User'][_0x6652('0x126')](db[_0x6652('0x12a')],{'through':_0x6652('0x12b')});db['User'][_0x6652('0x126')](db[_0x6652('0x11c')],{'as':_0x6652('0x12c'),'through':_0x6652('0x12d')});db[_0x6652('0x11')][_0x6652('0x126')](db['ChatInteraction'],{'as':_0x6652('0x11a'),'through':_0x6652('0x12e')});db[_0x6652('0x11')][_0x6652('0x126')](db['FaxInteraction'],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x6652('0x11')][_0x6652('0x126')](db[_0x6652('0x54')],{'as':_0x6652('0x12f'),'through':_0x6652('0x130')});db[_0x6652('0x11')]['belongsToMany'](db[_0x6652('0x5c')],{'as':'OpenchannelInteractions','through':_0x6652('0x131')});db[_0x6652('0x11')][_0x6652('0x126')](db[_0x6652('0xfd')],{'as':_0x6652('0x132'),'through':_0x6652('0x133')});db[_0x6652('0x11')][_0x6652('0x126')](db[_0x6652('0x19')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db['User'][_0x6652('0x126')](db[_0x6652('0xf2')],{'as':_0x6652('0x134'),'through':_0x6652('0x10a'),'required':![]});db['User'][_0x6652('0x126')](db[_0x6652('0x135')],{'as':_0x6652('0x136'),'through':_0x6652('0x137'),'required':![]});db[_0x6652('0x11')][_0x6652('0x126')](db[_0x6652('0x6b')],{'as':_0x6652('0x138'),'through':_0x6652('0x139'),'required':![],'hooks':!![]});db['User'][_0x6652('0x126')](db[_0x6652('0x13a')],{'as':_0x6652('0x13b'),'through':_0x6652('0x34'),'required':![]});db[_0x6652('0x11')][_0x6652('0x126')](db['SmsQueue'],{'as':_0x6652('0x13c'),'through':_0x6652('0x35'),'required':![]});db['User'][_0x6652('0x126')](db[_0x6652('0x5f')],{'as':_0x6652('0x13d'),'through':_0x6652('0x37'),'required':![]});db[_0x6652('0x11')][_0x6652('0x126')](db['WhatsappQueue'],{'as':_0x6652('0x13e'),'through':_0x6652('0x38'),'required':![]});db[_0x6652('0x11')][_0x6652('0x126')](db[_0x6652('0xf1')],{'through':_0x6652('0x129')});db[_0x6652('0x11')][_0x6652('0x126')](db[_0x6652('0x60')],{'as':'ChatWebsites','through':_0x6652('0x13f')});db[_0x6652('0x11')]['belongsToMany'](db['FaxAccount'],{'as':_0x6652('0x140'),'through':_0x6652('0x141')});db[_0x6652('0x11')]['belongsToMany'](db[_0x6652('0x3c')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db['User'][_0x6652('0x126')](db['OpenchannelAccount'],{'as':_0x6652('0x142'),'through':'user_has_openchannel_accounts'});db[_0x6652('0x11')][_0x6652('0x126')](db[_0x6652('0x51')],{'as':'SmsAccounts','through':_0x6652('0x143')});db['User'][_0x6652('0x126')](db[_0x6652('0xf9')],{'as':'WhatsappAccounts','through':_0x6652('0x144')});db[_0x6652('0x145')]['hasMany'](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x146')});db['VoiceContext'][_0x6652('0x112')](db['VoiceExtension'],{'onDelete':_0x6652('0x111')});db[_0x6652('0x115')][_0x6652('0x112')](db[_0x6652('0x115')],{'as':_0x6652('0x147'),'onDelete':_0x6652('0x111')});db[_0x6652('0x148')][_0x6652('0x126')](db['Sound'],{'as':_0x6652('0x149'),'through':'moh_has_sounds'});db['VoiceQueue'][_0x6652('0x112')](db[_0x6652('0x2e')],{'as':_0x6652('0x14a'),'foreignKey':_0x6652('0x14b')});db[_0x6652('0x19')][_0x6652('0x112')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x6652('0x14b')});db['VoiceQueue']['hasMany'](db[_0x6652('0x74')],{'as':'HopperFinals','foreignKey':_0x6652('0x14b')});db['VoiceQueue'][_0x6652('0x112')](db[_0x6652('0x76')],{'as':_0x6652('0x14c'),'foreignKey':_0x6652('0x14b')});db[_0x6652('0x19')][_0x6652('0x112')](db[_0x6652('0x78')],{'as':_0x6652('0x78'),'foreignKey':_0x6652('0x14b')});db[_0x6652('0x19')][_0x6652('0x112')](db[_0x6652('0x72')],{'as':_0x6652('0x14d'),'foreignKey':_0x6652('0x14b')});db[_0x6652('0x19')][_0x6652('0x112')](db[_0x6652('0x14e')],{'as':_0x6652('0x14f'),'foreignKey':_0x6652('0x14b')});db[_0x6652('0x19')][_0x6652('0x121')](db[_0x6652('0x2b')],{'as':_0x6652('0x2b'),'foreignKey':_0x6652('0x150')});db[_0x6652('0x19')][_0x6652('0x121')](db[_0x6652('0x2b')],{'as':_0x6652('0x151'),'foreignKey':_0x6652('0x152')});db[_0x6652('0x19')][_0x6652('0x121')](db['Interval'],{'as':_0x6652('0x81'),'foreignKey':_0x6652('0x153')});db['VoiceQueue']['belongsTo'](db[_0x6652('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x6652('0x154')});db['VoiceQueue'][_0x6652('0x126')](db[_0x6652('0xf1')],{'as':_0x6652('0x128'),'through':_0x6652('0x155')});db['VoiceQueue']['belongsToMany'](db[_0x6652('0x11')],{'as':_0x6652('0x156'),'through':_0x6652('0x30')});db[_0x6652('0x19')][_0x6652('0x126')](db[_0x6652('0x12a')],{'as':_0x6652('0x157'),'through':_0x6652('0x107')});db['VoiceQueue'][_0x6652('0x126')](db[_0x6652('0xf1')],{'as':_0x6652('0x158'),'through':'voice_queues_has_cm_blacklists'});db[_0x6652('0x1b')]['belongsTo'](db[_0x6652('0x11')],{'as':'User','foreignKey':'UserId'});db[_0x6652('0x1d')][_0x6652('0x121')](db[_0x6652('0x11')],{'as':_0x6652('0x11'),'foreignKey':_0x6652('0x10f')});db['VoiceMail'][_0x6652('0x112')](db[_0x6652('0x20')],{'as':_0x6652('0x159'),'onDelete':'cascade','foreignKey':_0x6652('0x15a'),'sourceKey':_0x6652('0x15b')});db['VoiceMailMessage'][_0x6652('0x121')](db[_0x6652('0x1e')],{'foreignKey':_0x6652('0x15a'),'targetKey':'mailbox'});db['VoiceCallReport']['hasMany'](db[_0x6652('0x15c')],{'as':_0x6652('0x15d'),'foreignKey':_0x6652('0x15e'),'constraints':![]});db[_0x6652('0x22')][_0x6652('0x112')](db[_0x6652('0x26')],{'as':'AgentReports','foreignKey':_0x6652('0x15e'),'constraints':![]});db[_0x6652('0x22')][_0x6652('0x121')](db[_0x6652('0x11')],{'as':_0x6652('0x11'),'foreignKey':'UserId'});db[_0x6652('0x22')][_0x6652('0x121')](db[_0x6652('0x70')],{'as':_0x6652('0x15f'),'foreignKey':_0x6652('0x160')});db['MailServerIn']['belongsTo'](db[_0x6652('0x3c')],{'as':_0x6652('0x3c'),'foreignKey':_0x6652('0x161')});db['MailServerIn'][_0x6652('0x121')](db[_0x6652('0x162')],{'as':_0x6652('0x162'),'foreignKey':_0x6652('0x163'),'onDelete':_0x6652('0x164')});db['MailServerOut'][_0x6652('0x121')](db[_0x6652('0x3c')],{'as':'MailAccount','foreignKey':_0x6652('0x161')});db[_0x6652('0x165')]['belongsTo'](db[_0x6652('0x162')],{'as':_0x6652('0x162'),'foreignKey':'CloudProviderId','onDelete':_0x6652('0x164')});db[_0x6652('0x3c')]['hasOne'](db['MailServerIn'],{'as':_0x6652('0x166'),'onDelete':_0x6652('0x111')});db['MailAccount'][_0x6652('0x10e')](db[_0x6652('0x165')],{'as':_0x6652('0x167'),'onDelete':'cascade'});db[_0x6652('0x3c')]['hasMany'](db[_0x6652('0x7e')],{'as':'Dispositions','foreignKey':_0x6652('0x161'),'onDelete':'cascade'});db[_0x6652('0x3c')][_0x6652('0x112')](db['CannedAnswer'],{'as':_0x6652('0x168'),'foreignKey':_0x6652('0x161')});db[_0x6652('0x3c')][_0x6652('0x112')](db[_0x6652('0x41')],{'as':_0x6652('0x159'),'foreignKey':_0x6652('0x161')});db[_0x6652('0x3c')][_0x6652('0x112')](db[_0x6652('0x11c')],{'as':'Interactions'});db[_0x6652('0x3c')]['hasMany'](db[_0x6652('0x169')],{'as':_0x6652('0x147'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0x6652('0x3c')][_0x6652('0x121')](db[_0x6652('0xf1')],{'as':_0x6652('0x16a'),'foreignKey':_0x6652('0x16b')});db[_0x6652('0x3c')][_0x6652('0x121')](db[_0x6652('0x16c')],{'as':_0x6652('0x16c'),'foreignKey':_0x6652('0x16d')});db[_0x6652('0x3c')]['belongsTo'](db['Pause'],{'as':_0x6652('0x16e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6652('0x3c')]['belongsToMany'](db[_0x6652('0x11')],{'as':_0x6652('0x156'),'through':_0x6652('0x16f')});db[_0x6652('0x135')][_0x6652('0x126')](db['User'],{'as':'Agents','through':_0x6652('0x137')});db['MailQueue'][_0x6652('0x126')](db['Team'],{'through':_0x6652('0x170'),'as':_0x6652('0x157')});db[_0x6652('0x11c')][_0x6652('0x112')](db[_0x6652('0x41')],{'as':'Messages','onDelete':_0x6652('0x111'),'foreignKey':'MailInteractionId'});db[_0x6652('0x11c')][_0x6652('0x121')](db[_0x6652('0x3c')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x6652('0x11c')][_0x6652('0x121')](db['CmContact'],{'as':_0x6652('0x15f'),'foreignKey':_0x6652('0x160')});db[_0x6652('0x11c')][_0x6652('0x121')](db[_0x6652('0x11')],{'as':_0x6652('0x171'),'foreignKey':'UserId'});db[_0x6652('0x11c')][_0x6652('0x126')](db[_0x6652('0x8a')],{'through':_0x6652('0x172'),'as':_0x6652('0x173')});db[_0x6652('0x11c')][_0x6652('0x126')](db[_0x6652('0x8a')],{'through':_0x6652('0x172'),'as':_0x6652('0x174')});db[_0x6652('0x11c')][_0x6652('0x126')](db['User'],{'as':_0x6652('0x175'),'through':'user_has_mail_interactions','foreignKey':_0x6652('0x176')});db['MailMessage'][_0x6652('0x112')](db[_0x6652('0xe4')],{'as':_0x6652('0x177'),'onDelete':_0x6652('0x111')});db['MailMessage'][_0x6652('0x121')](db[_0x6652('0x11')],{'as':_0x6652('0x11')});db[_0x6652('0x41')]['belongsTo'](db[_0x6652('0x70')],{'onDelete':_0x6652('0x111'),'as':_0x6652('0x15f')});db[_0x6652('0x41')]['belongsTo'](db[_0x6652('0x11c')],{'as':_0x6652('0x178'),'foreignKey':_0x6652('0x176')});db['MailMessage'][_0x6652('0x121')](db[_0x6652('0x3c')],{'as':_0x6652('0x179'),'foreignKey':'MailAccountId'});db[_0x6652('0x41')][_0x6652('0x121')](db[_0x6652('0x60')],{'as':_0x6652('0x60'),'foreignKey':_0x6652('0x17a')});db[_0x6652('0x41')]['belongsTo'](db[_0x6652('0x6a')],{'as':_0x6652('0x6a'),'foreignKey':_0x6652('0x17b')});db[_0x6652('0x169')][_0x6652('0x121')](db[_0x6652('0x11')],{'onDelete':_0x6652('0x164')});db[_0x6652('0x169')][_0x6652('0x121')](db[_0x6652('0x135')],{'onDelete':_0x6652('0x164')});db['MailApplication'][_0x6652('0x121')](db[_0x6652('0x3c')],{'onDelete':'restrict'});db[_0x6652('0x169')][_0x6652('0x121')](db[_0x6652('0x81')],{'onDelete':'restrict','foreignKey':_0x6652('0x153')});db[_0x6652('0x169')][_0x6652('0x121')](db[_0x6652('0x8a')],{'onDelete':_0x6652('0x164'),'foreignKey':_0x6652('0x17c')});db[_0x6652('0x44')][_0x6652('0x121')](db['MailAccount'],{});db['MailQueueReport'][_0x6652('0x121')](db[_0x6652('0xf1')],{'as':_0x6652('0x16a'),'foreignKey':_0x6652('0x16b')});db[_0x6652('0x44')]['belongsTo'](db[_0x6652('0x70')],{'as':_0x6652('0x15f'),'foreignKey':_0x6652('0x160')});db[_0x6652('0x44')][_0x6652('0x121')](db[_0x6652('0x11c')],{});db['MailQueueReport'][_0x6652('0x121')](db['MailMessage'],{});db[_0x6652('0x44')][_0x6652('0x121')](db[_0x6652('0x11')],{});db[_0x6652('0x44')]['belongsTo'](db['MailQueue'],{});db[_0x6652('0x46')][_0x6652('0x112')](db['DashboardItem'],{'as':_0x6652('0x17d'),'onDelete':_0x6652('0x111')});db[_0x6652('0x17e')][_0x6652('0x112')](db[_0x6652('0x7e')],{'as':_0x6652('0x17f'),'foreignKey':_0x6652('0x180'),'onDelete':_0x6652('0x111')});db['FaxAccount'][_0x6652('0x112')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x6652('0x180')});db[_0x6652('0x17e')][_0x6652('0x112')](db[_0x6652('0x4b')],{'as':_0x6652('0x181')});db[_0x6652('0x17e')]['hasMany'](db[_0x6652('0x49')],{'as':'Applications','foreignKey':_0x6652('0x180'),'onDelete':_0x6652('0x111')});db[_0x6652('0x17e')][_0x6652('0x112')](db[_0x6652('0x115')],{'as':_0x6652('0x182'),'onDelete':_0x6652('0x111')});db[_0x6652('0x17e')][_0x6652('0x112')](db[_0x6652('0x4d')],{'as':_0x6652('0x159')});db[_0x6652('0x17e')][_0x6652('0x121')](db[_0x6652('0x2b')],{'as':_0x6652('0x2b')});db[_0x6652('0x17e')]['belongsTo'](db[_0x6652('0xf1')],{'as':_0x6652('0x16a'),'foreignKey':_0x6652('0x16b')});db[_0x6652('0x17e')][_0x6652('0x121')](db[_0x6652('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x6652('0x154')});db['FaxAccount'][_0x6652('0x126')](db[_0x6652('0x11')],{'as':'Agents','through':_0x6652('0x141')});db['FaxApplication'][_0x6652('0x121')](db[_0x6652('0x11')],{'onDelete':'restrict'});db[_0x6652('0x49')][_0x6652('0x121')](db[_0x6652('0x13a')],{'onDelete':'restrict'});db['FaxApplication'][_0x6652('0x121')](db[_0x6652('0x17e')],{'onDelete':_0x6652('0x164')});db['FaxApplication'][_0x6652('0x121')](db[_0x6652('0x8a')],{'onDelete':_0x6652('0x164'),'foreignKey':'TagId'});db[_0x6652('0x4b')][_0x6652('0x112')](db[_0x6652('0x4d')],{'as':_0x6652('0x159'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x183')});db['FaxInteraction']['belongsTo'](db[_0x6652('0x17e')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x6652('0x4b')][_0x6652('0x121')](db[_0x6652('0x70')],{'as':_0x6652('0x15f'),'foreignKey':_0x6652('0x160')});db[_0x6652('0x4b')][_0x6652('0x121')](db[_0x6652('0x11')],{'as':_0x6652('0x171'),'foreignKey':_0x6652('0x10f')});db['FaxInteraction'][_0x6652('0x126')](db['Tag'],{'through':_0x6652('0x184'),'as':_0x6652('0x173')});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':_0x6652('0x184'),'as':'ThroughTags'});db[_0x6652('0x4b')][_0x6652('0x126')](db[_0x6652('0x11')],{'as':_0x6652('0x175'),'through':_0x6652('0x185'),'foreignKey':_0x6652('0x183')});db[_0x6652('0x4d')][_0x6652('0x121')](db[_0x6652('0x11')],{'onDelete':_0x6652('0x111'),'as':_0x6652('0x11')});db['FaxMessage'][_0x6652('0x121')](db[_0x6652('0x4b')],{'as':_0x6652('0x178'),'foreignKey':'FaxInteractionId'});db[_0x6652('0x4d')][_0x6652('0x121')](db[_0x6652('0x70')],{'onDelete':'cascade','as':_0x6652('0x15f')});db[_0x6652('0x4d')]['belongsTo'](db['Attachment'],{'as':_0x6652('0xe4'),'foreignKey':_0x6652('0x186')});db[_0x6652('0x4d')][_0x6652('0x121')](db[_0x6652('0x17e')],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x180')});db[_0x6652('0x13a')][_0x6652('0x126')](db[_0x6652('0x11')],{'as':_0x6652('0x156'),'through':_0x6652('0x34')});db['FaxQueue'][_0x6652('0x126')](db[_0x6652('0x12a')],{'through':_0x6652('0x187'),'as':_0x6652('0x157')});db['FaxQueueReport'][_0x6652('0x121')](db[_0x6652('0x17e')],{});db[_0x6652('0x4f')][_0x6652('0x121')](db['CmList'],{'as':_0x6652('0x16a'),'foreignKey':_0x6652('0x16b')});db['FaxQueueReport'][_0x6652('0x121')](db[_0x6652('0x70')],{'as':_0x6652('0x15f'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x6652('0x121')](db[_0x6652('0x4b')],{});db['FaxQueueReport'][_0x6652('0x121')](db['FaxMessage'],{});db[_0x6652('0x4f')]['belongsTo'](db[_0x6652('0x11')],{});db['FaxQueueReport'][_0x6652('0x121')](db[_0x6652('0x13a')],{});db[_0x6652('0x51')][_0x6652('0x112')](db['Disposition'],{'as':_0x6652('0x17f'),'foreignKey':'SmsAccountId','onDelete':_0x6652('0x111')});db['SmsAccount'][_0x6652('0x112')](db[_0x6652('0x188')],{'as':_0x6652('0x168'),'foreignKey':_0x6652('0x189')});db['SmsAccount'][_0x6652('0x112')](db[_0x6652('0x55')],{'as':'Messages','foreignKey':_0x6652('0x189')});db[_0x6652('0x51')][_0x6652('0x112')](db[_0x6652('0x54')],{'as':'Interactions'});db['SmsAccount'][_0x6652('0x112')](db[_0x6652('0x53')],{'as':_0x6652('0x147'),'foreignKey':_0x6652('0x189'),'onDelete':_0x6652('0x111')});db['SmsAccount'][_0x6652('0x121')](db[_0x6652('0xf1')],{'as':'List','foreignKey':_0x6652('0x16b')});db[_0x6652('0x51')][_0x6652('0x121')](db['Pause'],{'as':_0x6652('0x16e'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount']['belongsToMany'](db['User'],{'as':_0x6652('0x156'),'through':_0x6652('0x143')});db[_0x6652('0x53')][_0x6652('0x121')](db['User'],{'onDelete':_0x6652('0x164')});db['SmsApplication'][_0x6652('0x121')](db['SmsQueue'],{'onDelete':_0x6652('0x164')});db[_0x6652('0x53')]['belongsTo'](db[_0x6652('0x51')],{'onDelete':'restrict'});db[_0x6652('0x53')][_0x6652('0x121')](db[_0x6652('0x81')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['SmsApplication'][_0x6652('0x121')](db[_0x6652('0x8a')],{'onDelete':_0x6652('0x164'),'foreignKey':'TagId'});db['SmsInteraction'][_0x6652('0x112')](db[_0x6652('0x55')],{'as':_0x6652('0x159'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x18a')});db['SmsInteraction'][_0x6652('0x121')](db[_0x6652('0x51')],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x189')});db[_0x6652('0x54')][_0x6652('0x121')](db['CmContact'],{'as':_0x6652('0x15f'),'foreignKey':_0x6652('0x160')});db[_0x6652('0x54')][_0x6652('0x121')](db['User'],{'as':_0x6652('0x171'),'foreignKey':_0x6652('0x10f')});db[_0x6652('0x54')]['belongsToMany'](db[_0x6652('0x8a')],{'through':_0x6652('0x18b'),'as':'Tags'});db[_0x6652('0x54')][_0x6652('0x126')](db[_0x6652('0x8a')],{'through':_0x6652('0x18b'),'as':_0x6652('0x174')});db[_0x6652('0x54')][_0x6652('0x126')](db[_0x6652('0x11')],{'as':_0x6652('0x175'),'through':_0x6652('0x130'),'foreignKey':_0x6652('0x18a')});db[_0x6652('0x55')][_0x6652('0x121')](db[_0x6652('0x11')],{'as':_0x6652('0x11')});db[_0x6652('0x55')]['belongsTo'](db['CmContact'],{'onDelete':_0x6652('0x111'),'as':'Contact'});db[_0x6652('0x55')][_0x6652('0x121')](db[_0x6652('0x54')],{'onDelete':_0x6652('0x111'),'as':_0x6652('0x178'),'foreignKey':_0x6652('0x18a')});db[_0x6652('0x55')]['belongsTo'](db[_0x6652('0x51')],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x189')});db[_0x6652('0x57')][_0x6652('0x126')](db[_0x6652('0x11')],{'as':_0x6652('0x156'),'through':_0x6652('0x35'),'foreignKey':_0x6652('0x18c')});db[_0x6652('0x57')][_0x6652('0x126')](db[_0x6652('0x12a')],{'through':_0x6652('0x18d'),'as':_0x6652('0x157')});db[_0x6652('0x59')][_0x6652('0x112')](db['Disposition'],{'as':_0x6652('0x17f'),'foreignKey':_0x6652('0x18e'),'onDelete':_0x6652('0x111')});db[_0x6652('0x59')][_0x6652('0x112')](db[_0x6652('0x188')],{'as':_0x6652('0x168'),'foreignKey':_0x6652('0x18e')});db[_0x6652('0x59')][_0x6652('0x112')](db[_0x6652('0x5c')],{'as':_0x6652('0x181'),'foreignKey':_0x6652('0x18e')});db[_0x6652('0x59')][_0x6652('0x112')](db[_0x6652('0x5e')],{'as':_0x6652('0x159'),'foreignKey':'OpenchannelAccountId'});db[_0x6652('0x59')]['hasMany'](db['OpenchannelApplication'],{'as':_0x6652('0x147'),'foreignKey':_0x6652('0x18e'),'onDelete':_0x6652('0x111')});db[_0x6652('0x59')][_0x6652('0x121')](db[_0x6652('0xf1')],{'as':_0x6652('0x16a'),'foreignKey':_0x6652('0x16b')});db[_0x6652('0x59')][_0x6652('0x121')](db[_0x6652('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x6652('0x154')});db[_0x6652('0x59')][_0x6652('0x126')](db[_0x6652('0x11')],{'as':'Agents','through':_0x6652('0x18f')});db['OpenchannelApplication'][_0x6652('0x121')](db[_0x6652('0x11')],{'onDelete':_0x6652('0x164')});db[_0x6652('0x5a')][_0x6652('0x121')](db[_0x6652('0x5f')],{'onDelete':_0x6652('0x164'),'foreignKey':_0x6652('0x190')});db['OpenchannelApplication']['belongsTo'](db[_0x6652('0x59')],{'onDelete':'restrict','foreignKey':_0x6652('0x18e')});db['OpenchannelApplication'][_0x6652('0x121')](db[_0x6652('0x81')],{'onDelete':_0x6652('0x164'),'foreignKey':_0x6652('0x153')});db[_0x6652('0x5a')][_0x6652('0x121')](db[_0x6652('0x8a')],{'onDelete':_0x6652('0x164'),'foreignKey':_0x6652('0x17c')});db[_0x6652('0x5c')][_0x6652('0x112')](db[_0x6652('0x5e')],{'as':'Messages','onDelete':_0x6652('0x111'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction'][_0x6652('0x121')](db[_0x6652('0x59')],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x18e')});db[_0x6652('0x5c')][_0x6652('0x121')](db['CmContact'],{'as':_0x6652('0x15f'),'foreignKey':'ContactId'});db[_0x6652('0x5c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x6652('0x10f')});db[_0x6652('0x5c')][_0x6652('0x126')](db[_0x6652('0x8a')],{'through':'openchannel_interaction_has_tags','as':_0x6652('0x173')});db[_0x6652('0x5c')][_0x6652('0x126')](db['Tag'],{'through':_0x6652('0x191'),'as':_0x6652('0x174')});db[_0x6652('0x5c')][_0x6652('0x126')](db[_0x6652('0x11')],{'as':_0x6652('0x175'),'through':_0x6652('0x131'),'foreignKey':_0x6652('0x192')});db[_0x6652('0x5e')][_0x6652('0x121')](db[_0x6652('0x11')],{'onDelete':'cascade','as':_0x6652('0x11')});db[_0x6652('0x5e')][_0x6652('0x121')](db[_0x6652('0x70')],{'onDelete':_0x6652('0x111'),'as':_0x6652('0x15f')});db[_0x6652('0x5e')]['belongsTo'](db[_0x6652('0x5c')],{'onDelete':_0x6652('0x111'),'as':_0x6652('0x178'),'foreignKey':_0x6652('0x192')});db[_0x6652('0x5e')][_0x6652('0x121')](db[_0x6652('0xe4')],{'as':'Attachment','foreignKey':_0x6652('0x186')});db['OpenchannelMessage'][_0x6652('0x121')](db[_0x6652('0x59')],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x18e')});db[_0x6652('0x5f')][_0x6652('0x126')](db[_0x6652('0x11')],{'as':_0x6652('0x156'),'through':_0x6652('0x37'),'foreignKey':'OpenchannelQueueId'});db[_0x6652('0x5f')][_0x6652('0x126')](db[_0x6652('0x12a')],{'through':_0x6652('0x193'),'as':_0x6652('0x157')});db['ChatWebsite']['hasMany'](db[_0x6652('0x7e')],{'as':_0x6652('0x17f'),'foreignKey':_0x6652('0x17a'),'onDelete':_0x6652('0x111')});db['ChatWebsite']['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x6652('0x17a')});db['ChatWebsite']['hasMany'](db['ChatProactiveAction'],{'as':_0x6652('0x194')});db['ChatWebsite'][_0x6652('0x112')](db['ChatInteraction'],{'as':_0x6652('0x181')});db[_0x6652('0x60')][_0x6652('0x112')](db[_0x6652('0x64')],{'as':_0x6652('0x147'),'foreignKey':_0x6652('0x17a'),'onDelete':'cascade'});db[_0x6652('0x60')][_0x6652('0x112')](db[_0x6652('0x68')],{'as':_0x6652('0x159')});db[_0x6652('0x60')][_0x6652('0x121')](db[_0x6652('0xf1')],{'as':'List','foreignKey':_0x6652('0x16b')});db[_0x6652('0x60')][_0x6652('0x121')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x6652('0x60')][_0x6652('0x121')](db[_0x6652('0x3c')],{'as':_0x6652('0x3c'),'foreignKey':'MailAccountId'});db[_0x6652('0x60')]['belongsTo'](db[_0x6652('0x83')],{'as':_0x6652('0x16e'),'foreignKey':_0x6652('0x154')});db[_0x6652('0x60')][_0x6652('0x126')](db[_0x6652('0x11')],{'as':'Agents','through':_0x6652('0x13f')});db[_0x6652('0x62')][_0x6652('0x121')](db[_0x6652('0x59')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x6652('0xf1')],{'as':'List','foreignKey':_0x6652('0x16b')});db['OpenchannelQueueReport'][_0x6652('0x121')](db[_0x6652('0x70')],{'as':_0x6652('0x15f'),'foreignKey':_0x6652('0x160')});db['OpenchannelQueueReport'][_0x6652('0x121')](db[_0x6652('0x5c')],{});db[_0x6652('0x62')][_0x6652('0x121')](db[_0x6652('0x5e')],{});db[_0x6652('0x62')][_0x6652('0x121')](db[_0x6652('0x11')],{});db[_0x6652('0x62')]['belongsTo'](db[_0x6652('0x5f')],{});db[_0x6652('0x64')][_0x6652('0x121')](db[_0x6652('0x11')],{'as':_0x6652('0x195'),'foreignKey':_0x6652('0x10f'),'onDelete':_0x6652('0x164')});db[_0x6652('0x64')][_0x6652('0x121')](db[_0x6652('0x6b')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x6652('0x164')});db[_0x6652('0x64')][_0x6652('0x121')](db[_0x6652('0x60')],{'as':'Website','foreignKey':_0x6652('0x17a'),'onDelete':_0x6652('0x164')});db[_0x6652('0x64')][_0x6652('0x121')](db['Tag'],{'onDelete':_0x6652('0x164'),'foreignKey':_0x6652('0x17c')});db['ChatInteraction'][_0x6652('0x112')](db[_0x6652('0x68')],{'as':_0x6652('0x159'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x196')});db['ChatInteraction'][_0x6652('0x121')](db[_0x6652('0x60')],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x17a')});db[_0x6652('0x66')][_0x6652('0x121')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x6652('0x66')]['belongsTo'](db[_0x6652('0x11')],{'as':_0x6652('0x171'),'foreignKey':_0x6652('0x10f')});db[_0x6652('0x66')][_0x6652('0x126')](db[_0x6652('0x8a')],{'through':_0x6652('0x197'),'as':'Tags'});db[_0x6652('0x66')][_0x6652('0x126')](db[_0x6652('0x8a')],{'through':'chat_interaction_has_tags','as':_0x6652('0x174')});db[_0x6652('0x66')][_0x6652('0x126')](db['User'],{'as':'Users','through':_0x6652('0x12e'),'foreignKey':_0x6652('0x196')});db['ChatMessage'][_0x6652('0x121')](db['User'],{'onDelete':'cascade','as':_0x6652('0x11')});db[_0x6652('0x68')][_0x6652('0x121')](db[_0x6652('0x70')],{'onDelete':_0x6652('0x111'),'as':_0x6652('0x15f'),'foreignKey':'ContactId'});db[_0x6652('0x68')][_0x6652('0x121')](db[_0x6652('0x66')],{'onDelete':_0x6652('0x111'),'as':_0x6652('0x178'),'foreignKey':'ChatInteractionId'});db[_0x6652('0x68')][_0x6652('0x121')](db['Attachment'],{'as':_0x6652('0xe4'),'foreignKey':_0x6652('0x186')});db['ChatMessage'][_0x6652('0x121')](db[_0x6652('0x60')],{'as':'Account','foreignKey':_0x6652('0x17a')});db['ChatOfflineMessage'][_0x6652('0x112')](db['Attachment'],{'as':_0x6652('0x177'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x6652('0x111'),'hooks':!![]});db[_0x6652('0x6a')][_0x6652('0x121')](db[_0x6652('0x70')],{'onDelete':_0x6652('0x111'),'as':_0x6652('0x15f'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x6652('0x121')](db[_0x6652('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x6652('0x6b')]['belongsToMany'](db[_0x6652('0x11')],{'as':_0x6652('0x156'),'through':'UserChatQueue','hooks':!![]});db[_0x6652('0x6b')][_0x6652('0x126')](db[_0x6652('0x12a')],{'through':_0x6652('0x198'),'as':_0x6652('0x157')});db['ChatGroup'][_0x6652('0x112')](db[_0x6652('0x199')],{'as':_0x6652('0x159'),'foreignKey':'ChatGroupId','onDelete':_0x6652('0x111')});db[_0x6652('0x6d')][_0x6652('0x126')](db['User'],{'as':_0x6652('0x14a'),'through':_0x6652('0x125')});db[_0x6652('0x19a')][_0x6652('0x121')](db[_0x6652('0x60')],{'as':_0x6652('0x19b'),'foreignKey':_0x6652('0x17a')});db[_0x6652('0x19c')][_0x6652('0x112')](db[_0x6652('0x70')],{'as':_0x6652('0x19d'),'foreignKey':_0x6652('0x19e')});db[_0x6652('0x70')][_0x6652('0x112')](db[_0x6652('0x8b')],{'as':_0x6652('0x19f'),'foreignKey':_0x6652('0x1a0')});db[_0x6652('0x70')][_0x6652('0x112')](db['CmHopper'],{'as':_0x6652('0x120'),'foreignKey':_0x6652('0x160')});db['CmContact'][_0x6652('0x112')](db[_0x6652('0x74')],{'as':_0x6652('0x117'),'foreignKey':_0x6652('0x160')});db[_0x6652('0x70')][_0x6652('0x112')](db[_0x6652('0x76')],{'as':'HopperHistories','foreignKey':_0x6652('0x160')});db[_0x6652('0x70')][_0x6652('0x112')](db[_0x6652('0x78')],{'as':'ReportAgentPreview','foreignKey':_0x6652('0x160')});db[_0x6652('0x70')][_0x6652('0x112')](db['JscriptySessionReport'],{'as':_0x6652('0x14f'),'foreignKey':_0x6652('0x160')});db['CmContact']['hasMany'](db[_0x6652('0x5c')],{'as':_0x6652('0x119'),'foreignKey':_0x6652('0x160'),'onDelete':_0x6652('0x164')});db[_0x6652('0x70')][_0x6652('0x112')](db[_0x6652('0x66')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x6652('0x112')](db[_0x6652('0x54')],{'as':_0x6652('0x12f'),'foreignKey':_0x6652('0x160'),'onDelete':_0x6652('0x164')});db[_0x6652('0x70')][_0x6652('0x112')](db[_0x6652('0x4b')],{'as':_0x6652('0x11b'),'foreignKey':_0x6652('0x160'),'onDelete':'restrict'});db[_0x6652('0x70')]['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x6652('0x160'),'onDelete':'restrict'});db['CmContact'][_0x6652('0x121')](db['CmCompany'],{'as':_0x6652('0x1a1'),'foreignKey':_0x6652('0x19e')});db[_0x6652('0x70')][_0x6652('0x121')](db[_0x6652('0xf1')],{'as':_0x6652('0x16a'),'foreignKey':'ListId','onDelete':_0x6652('0x111')});db['CmContact']['belongsToMany'](db[_0x6652('0x11')],{'as':'Users','through':'cm_user_has_contacts'});db[_0x6652('0x70')][_0x6652('0x126')](db[_0x6652('0x8a')],{'as':_0x6652('0x173'),'through':_0x6652('0x1a2')});db['CmContact'][_0x6652('0x126')](db['Tag'],{'through':'cm_contact_has_tags','as':'ThroughTags'});db[_0x6652('0x71')]['hasMany'](db['CmHopperAdditionalPhone'],{'as':'AdditionalPhones','foreignKey':_0x6652('0x1a3')});db[_0x6652('0x71')][_0x6652('0x121')](db['CmContact'],{'as':_0x6652('0x15f'),'foreignKey':_0x6652('0x160'),'onDelete':'cascade'});db[_0x6652('0x71')]['belongsTo'](db[_0x6652('0xf1')],{'as':_0x6652('0x16a'),'foreignKey':_0x6652('0x16b'),'onDelete':_0x6652('0x111')});db[_0x6652('0x71')]['belongsTo'](db[_0x6652('0x11')],{'as':_0x6652('0x195'),'foreignKey':'UserId'});db[_0x6652('0x71')][_0x6652('0x121')](db[_0x6652('0x19')],{'as':_0x6652('0x1a4'),'foreignKey':_0x6652('0x14b'),'onDelete':_0x6652('0x111')});db[_0x6652('0x71')][_0x6652('0x121')](db['Campaign'],{'as':_0x6652('0x1a5'),'foreignKey':_0x6652('0x1a6'),'onDelete':'cascade'});db['CmHopper'][_0x6652('0x121')](db['User'],{'as':'Owner','foreignKey':_0x6652('0x1a7')});db['CmHopperBlack'][_0x6652('0x121')](db[_0x6652('0x70')],{'as':_0x6652('0x15f'),'foreignKey':_0x6652('0x160'),'onDelete':_0x6652('0x111')});db[_0x6652('0x72')][_0x6652('0x121')](db[_0x6652('0xf1')],{'as':_0x6652('0x16a'),'foreignKey':_0x6652('0x16b'),'onDelete':_0x6652('0x111')});db['CmHopperBlack'][_0x6652('0x121')](db[_0x6652('0x19')],{'as':_0x6652('0x1a4'),'foreignKey':_0x6652('0x14b'),'onDelete':'cascade'});db[_0x6652('0x72')][_0x6652('0x121')](db['Campaign'],{'as':_0x6652('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x6652('0x111')});db[_0x6652('0x1a8')]['hasMany'](db['Condition'],{'as':{'plural':_0x6652('0x1a9'),'singular':_0x6652('0x1aa')},'foreignKey':_0x6652('0x1ab'),'onDelete':_0x6652('0x111'),'hooks':!![]});db['Automation'][_0x6652('0x112')](db[_0x6652('0x1ac')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x6652('0x111'),'hooks':!![]});db[_0x6652('0x1a8')]['hasMany'](db[_0x6652('0x7b')],{'as':'Actions','foreignKey':_0x6652('0x1ad'),'onDelete':_0x6652('0x111'),'hooks':!![]});db['Disposition'][_0x6652('0x112')](db[_0x6652('0x7e')],{'as':_0x6652('0x17f'),'foreignKey':'ParentId','onDelete':_0x6652('0x111')});db[_0x6652('0x81')][_0x6652('0x112')](db['Interval'],{'as':_0x6652('0x1ae'),'foreignKey':_0x6652('0x153'),'onDelete':_0x6652('0x111'),'hooks':!![],'required':![]});db[_0x6652('0x81')][_0x6652('0x112')](db['VoiceExtension'],{'as':_0x6652('0x116'),'foreignKey':'IntervalId','onDelete':_0x6652('0x164')});db['Interval']['hasMany'](db[_0x6652('0x169')],{'as':_0x6652('0x1af'),'foreignKey':'IntervalId'});db[_0x6652('0x81')][_0x6652('0x112')](db[_0x6652('0x64')],{'as':_0x6652('0x1b0'),'foreignKey':_0x6652('0x153')});db[_0x6652('0x81')][_0x6652('0x112')](db['FaxApplication'],{'as':_0x6652('0x1b1'),'foreignKey':'IntervalId'});db[_0x6652('0x81')][_0x6652('0x112')](db[_0x6652('0x53')],{'as':'SmsApplications','foreignKey':'IntervalId'});db['Schedule'][_0x6652('0x121')](db[_0x6652('0x3c')],{});db[_0x6652('0x1b2')][_0x6652('0x121')](db[_0x6652('0x94')],{'foreignKey':_0x6652('0x1b3')});db[_0x6652('0x1b2')][_0x6652('0x121')](db[_0x6652('0x92')],{'foreignKey':_0x6652('0x1b4')});db['Sound'][_0x6652('0x126')](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0x6652('0x1b5'),'onDelete':'restrict'});db[_0x6652('0x8a')][_0x6652('0x126')](db[_0x6652('0x70')],{'through':_0x6652('0x1a2')});db[_0x6652('0x8a')][_0x6652('0x126')](db[_0x6652('0x66')],{'through':_0x6652('0x197')});db[_0x6652('0x8a')][_0x6652('0x126')](db[_0x6652('0x11c')],{'through':_0x6652('0x172')});db[_0x6652('0x8a')][_0x6652('0x126')](db[_0x6652('0x54')],{'through':_0x6652('0x18b')});db[_0x6652('0x8a')][_0x6652('0x126')](db[_0x6652('0x4b')],{'through':'fax_interaction_has_tags'});db['Tag'][_0x6652('0x126')](db[_0x6652('0x5c')],{'through':_0x6652('0x191')});db[_0x6652('0x8a')][_0x6652('0x126')](db[_0x6652('0xfd')],{'through':_0x6652('0x1b6')});db[_0x6652('0x8b')][_0x6652('0x121')](db[_0x6652('0x1b7')],{'as':_0x6652('0x1b8'),'foreignKey':_0x6652('0x1b9')});db[_0x6652('0x8d')][_0x6652('0x121')](db[_0x6652('0x71')],{'as':_0x6652('0x1ba'),'foreignKey':_0x6652('0x1a3')});db[_0x6652('0x8b')][_0x6652('0x121')](db[_0x6652('0x70')],{'as':_0x6652('0x15f'),'foreignKey':_0x6652('0x1a0')});db[_0x6652('0x8f')][_0x6652('0x112')](db[_0x6652('0x1ac')],{'as':{'plural':_0x6652('0x1bb'),'singular':'AllCondition'},'foreignKey':_0x6652('0x1bc'),'onDelete':_0x6652('0x111'),'hooks':!![]});db[_0x6652('0x8f')]['hasMany'](db[_0x6652('0x1ac')],{'as':{'plural':_0x6652('0x1bd'),'singular':_0x6652('0x1be')},'foreignKey':_0x6652('0x1bf'),'onDelete':_0x6652('0x111'),'hooks':!![]});db[_0x6652('0x8f')][_0x6652('0x112')](db[_0x6652('0x7b')],{'as':_0x6652('0x1c0'),'foreignKey':_0x6652('0x1c1'),'onDelete':_0x6652('0x111'),'hooks':!![]});db[_0x6652('0x92')][_0x6652('0x112')](db[_0x6652('0x1c2')],{'as':'Fields','onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1b4'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0x6652('0x1c2')],{'as':_0x6652('0x1c3'),'onDelete':_0x6652('0x111'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0x6652('0x112')](db[_0x6652('0x1c2')],{'as':_0x6652('0x1c3'),'onDelete':_0x6652('0x111'),'foreignKey':'MetricId'});db[_0x6652('0x1c2')][_0x6652('0x121')](db[_0x6652('0x98')],{'foreignKey':_0x6652('0x1c4')});db[_0x6652('0x1c5')][_0x6652('0x112')](db[_0x6652('0x9b')],{'as':_0x6652('0x1c6'),'onDelete':_0x6652('0x111'),'foreignKey':'AccountId'});db[_0x6652('0x9b')][_0x6652('0x112')](db[_0x6652('0x1c7')],{'as':_0x6652('0x1c8'),'onDelete':_0x6652('0x111'),'foreignKey':'SubjectId'});db[_0x6652('0x9b')]['hasMany'](db[_0x6652('0x1c7')],{'as':'Descriptions','onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1c9')});db[_0x6652('0x9b')]['hasMany'](db['SalesforceField'],{'as':_0x6652('0x1c3'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x6652('0x9b')][_0x6652('0x121')](db[_0x6652('0x1c5')],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x1ca')});db[_0x6652('0x1c7')][_0x6652('0x112')](db['SalesforceField'],{'as':'Subject','foreignKey':_0x6652('0x1cb')});db[_0x6652('0x1c7')][_0x6652('0x112')](db[_0x6652('0x1c7')],{'as':'Description','foreignKey':_0x6652('0x1c9')});db[_0x6652('0x1c7')][_0x6652('0x112')](db[_0x6652('0x1c7')],{'as':_0x6652('0x1cc'),'foreignKey':_0x6652('0x1cd')});db[_0x6652('0x1c7')]['belongsTo'](db[_0x6652('0x1ce')],{'as':'Variable','foreignKey':'VariableId'});db[_0x6652('0x9e')]['hasMany'](db[_0x6652('0xa0')],{'as':_0x6652('0x1c6'),'onDelete':_0x6652('0x111'),'foreignKey':'AccountId'});db['SugarcrmConfiguration']['hasMany'](db[_0x6652('0xa2')],{'as':_0x6652('0x1c8'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1cb')});db[_0x6652('0xa0')]['hasMany'](db[_0x6652('0xa2')],{'as':_0x6652('0x1cf'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1c9')});db[_0x6652('0xa0')][_0x6652('0x112')](db[_0x6652('0xa2')],{'as':_0x6652('0x1c3'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1cd')});db['SugarcrmConfiguration'][_0x6652('0x121')](db[_0x6652('0x9e')],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x1ca')});db[_0x6652('0xa2')]['hasMany'](db['SugarcrmField'],{'as':_0x6652('0x1d0'),'foreignKey':_0x6652('0x1cb')});db[_0x6652('0xa2')][_0x6652('0x112')](db[_0x6652('0xa2')],{'as':_0x6652('0x1d1'),'foreignKey':_0x6652('0x1c9')});db['SugarcrmField'][_0x6652('0x112')](db[_0x6652('0xa2')],{'as':_0x6652('0x1cc'),'foreignKey':_0x6652('0x1cd')});db[_0x6652('0xa2')][_0x6652('0x121')](db[_0x6652('0x1ce')],{'as':_0x6652('0x1ce'),'foreignKey':'VariableId'});db[_0x6652('0xa4')][_0x6652('0x112')](db[_0x6652('0xa6')],{'as':_0x6652('0x1c6'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1ca')});db[_0x6652('0xa6')][_0x6652('0x112')](db[_0x6652('0xa7')],{'as':_0x6652('0x1c8'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1cb')});db[_0x6652('0xa6')][_0x6652('0x112')](db[_0x6652('0xa7')],{'as':_0x6652('0x1cf'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1c9')});db[_0x6652('0xa6')][_0x6652('0x112')](db[_0x6652('0xa7')],{'as':'Fields','onDelete':_0x6652('0x111'),'foreignKey':'FieldId'});db[_0x6652('0xa6')][_0x6652('0x121')](db[_0x6652('0xa4')],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x1ca')});db[_0x6652('0xa6')][_0x6652('0x126')](db[_0x6652('0x8a')],{'through':_0x6652('0x1d2')});db[_0x6652('0xa7')][_0x6652('0x112')](db['DeskField'],{'as':_0x6652('0x1d0'),'foreignKey':_0x6652('0x1cb')});db['DeskField'][_0x6652('0x112')](db[_0x6652('0xa7')],{'as':_0x6652('0x1d1'),'foreignKey':_0x6652('0x1c9')});db[_0x6652('0xa7')][_0x6652('0x112')](db[_0x6652('0xa7')],{'as':'Field','foreignKey':_0x6652('0x1cd')});db['DeskField'][_0x6652('0x121')](db[_0x6652('0x1ce')],{'as':_0x6652('0x1ce'),'foreignKey':'VariableId'});db[_0x6652('0x1d3')][_0x6652('0x112')](db[_0x6652('0x1d4')],{'as':_0x6652('0x1c6'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1ca')});db[_0x6652('0x1d4')][_0x6652('0x112')](db[_0x6652('0xaa')],{'as':_0x6652('0x1c8'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1cb')});db['ZohoConfiguration'][_0x6652('0x112')](db[_0x6652('0xaa')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x6652('0x1c9')});db[_0x6652('0x1d4')]['hasMany'](db[_0x6652('0xaa')],{'as':_0x6652('0x1c3'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1cd')});db[_0x6652('0x1d4')][_0x6652('0x121')](db[_0x6652('0x1d3')],{'as':_0x6652('0x179'),'foreignKey':'AccountId'});db[_0x6652('0xaa')][_0x6652('0x112')](db[_0x6652('0xaa')],{'as':_0x6652('0x1d0'),'foreignKey':_0x6652('0x1cb')});db[_0x6652('0xaa')][_0x6652('0x112')](db[_0x6652('0xaa')],{'as':_0x6652('0x1d1'),'foreignKey':'DescriptionId'});db[_0x6652('0xaa')]['hasMany'](db[_0x6652('0xaa')],{'as':_0x6652('0x1cc'),'foreignKey':'FieldId'});db[_0x6652('0xaa')][_0x6652('0x121')](db[_0x6652('0x1ce')],{'as':_0x6652('0x1ce'),'foreignKey':_0x6652('0x1d5')});db[_0x6652('0xac')][_0x6652('0x112')](db[_0x6652('0xae')],{'as':_0x6652('0x1c6'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1ca')});db[_0x6652('0xae')]['hasMany'](db[_0x6652('0x1d6')],{'as':_0x6652('0x1c8'),'foreignKey':_0x6652('0x1cb')});db[_0x6652('0xae')][_0x6652('0x112')](db['ZendeskField'],{'as':_0x6652('0x1cf'),'foreignKey':_0x6652('0x1c9')});db[_0x6652('0xae')][_0x6652('0x112')](db[_0x6652('0x1d6')],{'as':'Fields','foreignKey':_0x6652('0x1cd')});db[_0x6652('0xae')][_0x6652('0x121')](db[_0x6652('0xac')],{'as':'Account','foreignKey':_0x6652('0x1ca')});db[_0x6652('0xae')][_0x6652('0x126')](db[_0x6652('0x8a')],{'through':_0x6652('0x1d7')});db[_0x6652('0x1d6')][_0x6652('0x112')](db[_0x6652('0x1d6')],{'as':_0x6652('0x1d0'),'foreignKey':_0x6652('0x1cb')});db[_0x6652('0x1d6')][_0x6652('0x112')](db[_0x6652('0x1d6')],{'as':_0x6652('0x1d1'),'foreignKey':_0x6652('0x1c9')});db[_0x6652('0x1d6')][_0x6652('0x112')](db[_0x6652('0x1d6')],{'as':_0x6652('0x1cc'),'foreignKey':'FieldId'});db['ZendeskField'][_0x6652('0x121')](db[_0x6652('0x1ce')],{'as':_0x6652('0x1ce'),'foreignKey':_0x6652('0x1d5')});db[_0x6652('0xb0')]['hasMany'](db[_0x6652('0x1d8')],{'as':_0x6652('0x1c6'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1ca')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':'Subjects','onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1cb')});db[_0x6652('0x1d8')][_0x6652('0x112')](db[_0x6652('0xb3')],{'as':'Descriptions','onDelete':_0x6652('0x111'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x6652('0x112')](db[_0x6652('0xb3')],{'as':_0x6652('0x1c3'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x6652('0x1d8')][_0x6652('0x121')](db['FreshdeskAccount'],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x1ca')});db[_0x6652('0x1d8')][_0x6652('0x126')](db[_0x6652('0x8a')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x6652('0xb3')][_0x6652('0x112')](db[_0x6652('0xb3')],{'as':_0x6652('0x1d0'),'foreignKey':_0x6652('0x1cb')});db[_0x6652('0xb3')]['hasMany'](db[_0x6652('0xb3')],{'as':'Description','foreignKey':_0x6652('0x1c9')});db[_0x6652('0xb3')][_0x6652('0x112')](db[_0x6652('0xb3')],{'as':_0x6652('0x1cc'),'foreignKey':_0x6652('0x1cd')});db['FreshdeskField'][_0x6652('0x121')](db[_0x6652('0x1ce')],{'as':'Variable','foreignKey':_0x6652('0x1d5')});db['VtigerAccount']['hasMany'](db[_0x6652('0xb7')],{'as':_0x6652('0x1c6'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1ca')});db[_0x6652('0xb7')][_0x6652('0x112')](db['VtigerField'],{'as':_0x6652('0x1c8'),'foreignKey':'SubjectId'});db[_0x6652('0xb7')]['hasMany'](db[_0x6652('0xb8')],{'as':_0x6652('0x1cf'),'foreignKey':'DescriptionId'});db[_0x6652('0xb7')]['hasMany'](db[_0x6652('0xb8')],{'as':_0x6652('0x1c3'),'foreignKey':_0x6652('0x1cd')});db[_0x6652('0xb7')][_0x6652('0x121')](db[_0x6652('0xb5')],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x1ca')});db['VtigerField'][_0x6652('0x112')](db['VtigerField'],{'as':'Subject','foreignKey':_0x6652('0x1cb')});db[_0x6652('0xb8')]['hasMany'](db[_0x6652('0xb8')],{'as':_0x6652('0x1d1'),'foreignKey':_0x6652('0x1c9')});db[_0x6652('0xb8')]['hasMany'](db['VtigerField'],{'as':_0x6652('0x1cc'),'foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0x6652('0x1ce')],{'as':_0x6652('0x1ce'),'foreignKey':_0x6652('0x1d5')});db[_0x6652('0x1d9')][_0x6652('0x112')](db[_0x6652('0xbb')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x6652('0x1ca')});db[_0x6652('0xbb')][_0x6652('0x112')](db[_0x6652('0x1da')],{'as':_0x6652('0x1c8'),'foreignKey':_0x6652('0x1cb')});db[_0x6652('0xbb')][_0x6652('0x112')](db[_0x6652('0x1da')],{'as':_0x6652('0x1cf'),'foreignKey':_0x6652('0x1c9')});db[_0x6652('0xbb')][_0x6652('0x112')](db['ServicenowField'],{'as':_0x6652('0x1c3'),'foreignKey':_0x6652('0x1cd')});db['ServicenowConfiguration'][_0x6652('0x121')](db[_0x6652('0x1d9')],{'as':'Account','foreignKey':_0x6652('0x1ca')});db[_0x6652('0x1da')]['hasMany'](db[_0x6652('0x1da')],{'as':_0x6652('0x1d0'),'foreignKey':_0x6652('0x1cb')});db['ServicenowField']['hasMany'](db[_0x6652('0x1da')],{'as':_0x6652('0x1d1'),'foreignKey':_0x6652('0x1c9')});db['ServicenowField'][_0x6652('0x112')](db[_0x6652('0x1da')],{'as':'Field','foreignKey':_0x6652('0x1cd')});db['ServicenowField'][_0x6652('0x121')](db[_0x6652('0x1ce')],{'as':_0x6652('0x1ce'),'foreignKey':_0x6652('0x1d5')});db['Dynamics365Account'][_0x6652('0x112')](db['Dynamics365Configuration'],{'as':_0x6652('0x1c6'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1ca')});db[_0x6652('0xbd')]['belongsTo'](db[_0x6652('0x162')],{'as':_0x6652('0x162'),'foreignKey':'CloudProviderId'});db[_0x6652('0xbf')][_0x6652('0x112')](db[_0x6652('0xc0')],{'as':'Subjects','onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1cb')});db['Dynamics365Configuration'][_0x6652('0x112')](db[_0x6652('0xc0')],{'as':'Descriptions','onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1c9')});db[_0x6652('0xbf')][_0x6652('0x112')](db['Dynamics365Field'],{'as':_0x6652('0x1c3'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1cd')});db[_0x6652('0xbf')]['belongsTo'](db['Dynamics365Account'],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x1ca')});db[_0x6652('0xc0')][_0x6652('0x112')](db[_0x6652('0xc0')],{'as':'Subject','foreignKey':_0x6652('0x1cb')});db[_0x6652('0xc0')]['hasMany'](db[_0x6652('0xc0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x6652('0xc0')][_0x6652('0x112')](db[_0x6652('0xc0')],{'as':_0x6652('0x1cc'),'foreignKey':_0x6652('0x1cd')});db['Dynamics365Field'][_0x6652('0x121')](db[_0x6652('0x1ce')],{'as':_0x6652('0x1ce'),'foreignKey':_0x6652('0x1d5')});db['FreshsalesAccount'][_0x6652('0x112')](db[_0x6652('0xc3')],{'as':_0x6652('0x1c6'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1ca')});db['FreshsalesConfiguration'][_0x6652('0x112')](db['FreshsalesField'],{'as':_0x6652('0x1c8'),'foreignKey':_0x6652('0x1cb')});db[_0x6652('0xc3')][_0x6652('0x112')](db[_0x6652('0xc4')],{'as':_0x6652('0x1cf'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x6652('0x112')](db[_0x6652('0xc4')],{'as':_0x6652('0x1c3'),'foreignKey':_0x6652('0x1cd')});db[_0x6652('0xc3')]['belongsTo'](db[_0x6652('0xc2')],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x1ca')});db['FreshsalesField'][_0x6652('0x112')](db[_0x6652('0xc4')],{'as':_0x6652('0x1d0'),'foreignKey':_0x6652('0x1cb')});db['FreshsalesField'][_0x6652('0x112')](db[_0x6652('0xc4')],{'as':_0x6652('0x1d1'),'foreignKey':_0x6652('0x1c9')});db[_0x6652('0xc4')][_0x6652('0x112')](db['FreshsalesField'],{'as':_0x6652('0x1cc'),'foreignKey':_0x6652('0x1cd')});db[_0x6652('0xc4')][_0x6652('0x121')](db['Variable'],{'as':_0x6652('0x1ce'),'foreignKey':_0x6652('0x1d5')});db['ChatQueueReport']['belongsTo'](db[_0x6652('0x60')],{});db[_0x6652('0xc8')]['belongsTo'](db[_0x6652('0xf1')],{'as':_0x6652('0x16a'),'foreignKey':'ListId'});db['ChatQueueReport']['belongsTo'](db['CmContact'],{'as':_0x6652('0x15f'),'foreignKey':_0x6652('0x160')});db[_0x6652('0xc8')][_0x6652('0x121')](db[_0x6652('0x66')],{});db[_0x6652('0xc8')][_0x6652('0x121')](db[_0x6652('0x68')],{});db[_0x6652('0xc8')][_0x6652('0x121')](db[_0x6652('0x11')],{});db[_0x6652('0xc8')]['belongsTo'](db['ChatQueue'],{});db[_0x6652('0x199')]['belongsTo'](db[_0x6652('0x11')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0x6652('0x199')][_0x6652('0x121')](db[_0x6652('0x11')],{'onDelete':'cascade','foreignKey':_0x6652('0x1db')});db[_0x6652('0x14e')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':_0x6652('0x111')});db['JscriptySessionReport'][_0x6652('0x112')](db['JscriptyAnswerReport'],{'foreignKey':_0x6652('0x1dc'),'onDelete':'cascade'});db[_0x6652('0xce')][_0x6652('0x121')](db['SmsAccount'],{});db[_0x6652('0xce')][_0x6652('0x121')](db[_0x6652('0xf1')],{'as':_0x6652('0x16a'),'foreignKey':_0x6652('0x16b')});db[_0x6652('0xce')][_0x6652('0x121')](db[_0x6652('0x70')],{'as':_0x6652('0x15f'),'foreignKey':_0x6652('0x160')});db[_0x6652('0xce')]['belongsTo'](db[_0x6652('0x54')],{});db[_0x6652('0xce')][_0x6652('0x121')](db[_0x6652('0x55')],{});db['SmsQueueReport']['belongsTo'](db[_0x6652('0x11')],{});db[_0x6652('0xce')][_0x6652('0x121')](db[_0x6652('0x57')],{});db[_0x6652('0xd4')][_0x6652('0x112')](db[_0x6652('0x14e')],{'foreignKey':'ProjectId'});db[_0x6652('0xd4')][_0x6652('0x112')](db[_0x6652('0xcc')],{'foreignKey':_0x6652('0x1dd')});db[_0x6652('0xd4')][_0x6652('0x112')](db[_0x6652('0xcb')],{'foreignKey':_0x6652('0x1dd')});db[_0x6652('0x12a')][_0x6652('0x126')](db[_0x6652('0x11')],{'as':_0x6652('0x156'),'through':'user_has_teams'});db[_0x6652('0x12a')][_0x6652('0x126')](db[_0x6652('0x19')],{'through':'TeamVoiceQueue','as':_0x6652('0x1de')});db[_0x6652('0x12a')][_0x6652('0x126')](db[_0x6652('0x135')],{'through':_0x6652('0x170'),'as':'MailQueues'});db[_0x6652('0x12a')][_0x6652('0x126')](db['ChatQueue'],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x6652('0x12a')][_0x6652('0x126')](db[_0x6652('0x13a')],{'through':'team_has_fax_queues','as':_0x6652('0x13b')});db['Team']['belongsToMany'](db[_0x6652('0x57')],{'through':_0x6652('0x18d'),'as':_0x6652('0x13c')});db['Team'][_0x6652('0x126')](db['OpenchannelQueue'],{'through':_0x6652('0x193'),'as':_0x6652('0x13d')});db[_0x6652('0x12a')][_0x6652('0x126')](db[_0x6652('0x104')],{'through':'team_has_whatsapp_queues','as':_0x6652('0x13e')});db[_0x6652('0x12a')]['belongsToMany'](db['VoicePrefix'],{'through':_0x6652('0x109'),'as':_0x6652('0x134')});db[_0x6652('0x1a5')]['hasMany'](db['CmHopper'],{'as':_0x6652('0x120'),'foreignKey':'CampaignId'});db[_0x6652('0x1a5')][_0x6652('0x112')](db[_0x6652('0x74')],{'as':_0x6652('0x117'),'foreignKey':_0x6652('0x1a6')});db[_0x6652('0x1a5')][_0x6652('0x112')](db[_0x6652('0x76')],{'as':_0x6652('0x14c'),'foreignKey':'CampaignId'});db['Campaign'][_0x6652('0x112')](db[_0x6652('0x72')],{'as':_0x6652('0x14d'),'foreignKey':'CampaignId'});db[_0x6652('0x1a5')][_0x6652('0x121')](db[_0x6652('0x2b')],{'as':_0x6652('0x2b'),'foreignKey':'TrunkId'});db['Campaign'][_0x6652('0x121')](db[_0x6652('0x2b')],{'as':_0x6652('0x151'),'foreignKey':_0x6652('0x152')});db[_0x6652('0x1a5')][_0x6652('0x121')](db[_0x6652('0x81')],{'as':_0x6652('0x81'),'foreignKey':_0x6652('0x153')});db['Campaign']['belongsTo'](db[_0x6652('0xda')],{'as':_0x6652('0xda'),'foreignKey':_0x6652('0x1df')});db[_0x6652('0x1a5')][_0x6652('0x126')](db[_0x6652('0xf1')],{'as':_0x6652('0x128'),'through':_0x6652('0x1e0')});db[_0x6652('0x1a5')][_0x6652('0x126')](db['CmList'],{'as':'BlackLists','through':_0x6652('0x1e1')});db[_0x6652('0xe4')][_0x6652('0x121')](db[_0x6652('0x6a')],{'as':_0x6652('0x6a'),'foreignKey':_0x6652('0x17b')});db[_0x6652('0xe8')]['belongsTo'](db[_0x6652('0x41')],{});db[_0x6652('0xe8')]['belongsTo'](db[_0x6652('0x11c')],{});db[_0x6652('0xe8')]['belongsTo'](db[_0x6652('0x3c')],{'foreignKey':'FromMailAccountId','as':_0x6652('0x1e2')});db[_0x6652('0xe8')][_0x6652('0x121')](db[_0x6652('0x11')],{'foreignKey':_0x6652('0x1e3'),'as':_0x6652('0x1e4')});db[_0x6652('0xe8')]['belongsTo'](db[_0x6652('0x11')],{'foreignKey':_0x6652('0x1e5'),'as':'ToAgent'});db[_0x6652('0xe8')][_0x6652('0x121')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0x6652('0x1e6')});db['MailTransferReport'][_0x6652('0x121')](db[_0x6652('0x3c')],{'foreignKey':_0x6652('0x1e7'),'as':_0x6652('0x1e8')});db['ChatTransferReport'][_0x6652('0x121')](db[_0x6652('0x68')],{});db[_0x6652('0xea')][_0x6652('0x121')](db[_0x6652('0x66')],{});db['ChatTransferReport'][_0x6652('0x121')](db[_0x6652('0x60')],{'foreignKey':_0x6652('0x1e9'),'as':_0x6652('0x1e2')});db[_0x6652('0xea')]['belongsTo'](db['User'],{'foreignKey':_0x6652('0x1e3'),'as':_0x6652('0x1e4')});db[_0x6652('0xea')]['belongsTo'](db[_0x6652('0x11')],{'foreignKey':'ToUserId','as':_0x6652('0x1ea')});db[_0x6652('0xea')][_0x6652('0x121')](db[_0x6652('0x6b')],{'foreignKey':_0x6652('0x1eb'),'as':_0x6652('0x1e6')});db[_0x6652('0xea')][_0x6652('0x121')](db[_0x6652('0x60')],{'foreignKey':_0x6652('0x1ec'),'as':_0x6652('0x1e8')});db[_0x6652('0xec')][_0x6652('0x121')](db[_0x6652('0x4d')],{});db['FaxTransferReport']['belongsTo'](db[_0x6652('0x4b')],{});db[_0x6652('0xec')][_0x6652('0x121')](db[_0x6652('0x17e')],{'foreignKey':_0x6652('0x1ed'),'as':_0x6652('0x1e2')});db[_0x6652('0xec')]['belongsTo'](db[_0x6652('0x11')],{'foreignKey':_0x6652('0x1e3'),'as':_0x6652('0x1e4')});db[_0x6652('0xec')][_0x6652('0x121')](db[_0x6652('0x11')],{'foreignKey':_0x6652('0x1e5'),'as':_0x6652('0x1ea')});db[_0x6652('0xec')][_0x6652('0x121')](db[_0x6652('0x13a')],{'foreignKey':_0x6652('0x1ee'),'as':'ToQueue'});db[_0x6652('0xec')][_0x6652('0x121')](db['FaxAccount'],{'foreignKey':_0x6652('0x1ef'),'as':'ToAccount'});db[_0x6652('0xed')][_0x6652('0x121')](db[_0x6652('0x5e')],{});db[_0x6652('0xed')][_0x6652('0x121')](db[_0x6652('0x5c')],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x6652('0x59')],{'foreignKey':_0x6652('0x1f0'),'as':_0x6652('0x1e2')});db[_0x6652('0xed')]['belongsTo'](db[_0x6652('0x11')],{'foreignKey':_0x6652('0x1e3'),'as':'FromAgent'});db[_0x6652('0xed')][_0x6652('0x121')](db[_0x6652('0x11')],{'foreignKey':_0x6652('0x1e5'),'as':'ToAgent'});db[_0x6652('0xed')][_0x6652('0x121')](db[_0x6652('0x5f')],{'foreignKey':'ToOpenchannelQueueId','as':_0x6652('0x1e6')});db['OpenchannelTransferReport'][_0x6652('0x121')](db[_0x6652('0x59')],{'foreignKey':_0x6652('0x1f1'),'as':_0x6652('0x1e8')});db[_0x6652('0xef')][_0x6652('0x121')](db[_0x6652('0x55')],{});db[_0x6652('0xef')][_0x6652('0x121')](db[_0x6652('0x54')],{});db[_0x6652('0xef')][_0x6652('0x121')](db[_0x6652('0x51')],{'foreignKey':'FromSmsAccountId','as':_0x6652('0x1e2')});db[_0x6652('0xef')][_0x6652('0x121')](db['User'],{'foreignKey':_0x6652('0x1e3'),'as':_0x6652('0x1e4')});db['SmsTransferReport'][_0x6652('0x121')](db[_0x6652('0x11')],{'foreignKey':'ToUserId','as':_0x6652('0x1ea')});db['SmsTransferReport'][_0x6652('0x121')](db[_0x6652('0x57')],{'foreignKey':_0x6652('0x1f2'),'as':_0x6652('0x1e6')});db[_0x6652('0xef')][_0x6652('0x121')](db[_0x6652('0x51')],{'foreignKey':_0x6652('0x1f3'),'as':_0x6652('0x1e8')});db[_0x6652('0xf1')]['hasMany'](db[_0x6652('0x7e')],{'as':_0x6652('0x17f'),'foreignKey':_0x6652('0x16b'),'onDelete':'cascade'});db[_0x6652('0xf1')][_0x6652('0x112')](db[_0x6652('0x7a')],{'as':_0x6652('0x1f4'),'foreignKey':_0x6652('0x16b')});db['CmList'][_0x6652('0x112')](db[_0x6652('0x70')],{'as':_0x6652('0x19d'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x16b')});db['CmList'][_0x6652('0x112')](db['CmHopperFinal'],{'as':_0x6652('0x117'),'foreignKey':_0x6652('0x16b')});db[_0x6652('0xf1')][_0x6652('0x112')](db[_0x6652('0x76')],{'as':_0x6652('0x118'),'foreignKey':_0x6652('0x16b')});db[_0x6652('0xf1')][_0x6652('0x112')](db[_0x6652('0x78')],{'as':_0x6652('0x78'),'foreignKey':_0x6652('0x16b')});db[_0x6652('0xf1')][_0x6652('0x126')](db[_0x6652('0x19')],{'as':_0x6652('0x1f5'),'through':_0x6652('0x155')});db[_0x6652('0xf1')][_0x6652('0x126')](db[_0x6652('0x11')],{'as':'Agents','through':_0x6652('0x129')});db[_0x6652('0xf2')]['hasMany'](db['VoiceExtension'],{'as':_0x6652('0x116'),'onDelete':_0x6652('0x111')});db['VoicePrefix'][_0x6652('0x126')](db[_0x6652('0x11')],{'as':_0x6652('0x156'),'through':_0x6652('0x10a')});db[_0x6652('0xf2')][_0x6652('0x126')](db[_0x6652('0x12a')],{'through':_0x6652('0x109'),'as':_0x6652('0x157')});db[_0x6652('0x122')][_0x6652('0x112')](db['User'],{'as':_0x6652('0x175'),'foreignKey':_0x6652('0x123')});db['UserProfile'][_0x6652('0x112')](db[_0x6652('0xf5')],{'as':'UserProfileSections','foreignKey':_0x6652('0x123'),'onDelete':_0x6652('0x111')});db[_0x6652('0xf5')][_0x6652('0x112')](db[_0x6652('0xf7')],{'as':_0x6652('0x1f6'),'foreignKey':_0x6652('0x1f7'),'onDelete':'cascade'});db[_0x6652('0xf9')][_0x6652('0x112')](db[_0x6652('0x7e')],{'as':'Dispositions','foreignKey':_0x6652('0x1f8'),'onDelete':_0x6652('0x111')});db[_0x6652('0xf9')][_0x6652('0x112')](db[_0x6652('0x188')],{'as':_0x6652('0x168'),'foreignKey':_0x6652('0x1f8')});db[_0x6652('0xf9')]['hasMany'](db[_0x6652('0xff')],{'as':_0x6652('0x159'),'foreignKey':_0x6652('0x1f8')});db[_0x6652('0xf9')]['hasMany'](db[_0x6652('0xfd')],{'as':'Interactions'});db[_0x6652('0xf9')][_0x6652('0x112')](db['WhatsappApplication'],{'as':_0x6652('0x147'),'foreignKey':_0x6652('0x1f8'),'onDelete':'cascade'});db[_0x6652('0xf9')][_0x6652('0x121')](db[_0x6652('0xf1')],{'as':_0x6652('0x16a'),'foreignKey':'ListId'});db['WhatsappAccount'][_0x6652('0x121')](db[_0x6652('0x83')],{'as':_0x6652('0x16e'),'foreignKey':_0x6652('0x154')});db[_0x6652('0xf9')][_0x6652('0x126')](db[_0x6652('0x11')],{'as':'Agents','through':_0x6652('0x144')});db[_0x6652('0xfb')][_0x6652('0x121')](db['User'],{'onDelete':_0x6652('0x164')});db[_0x6652('0xfb')][_0x6652('0x121')](db[_0x6652('0x104')],{'onDelete':'restrict'});db[_0x6652('0xfb')][_0x6652('0x121')](db[_0x6652('0xf9')],{'onDelete':'restrict'});db[_0x6652('0xfb')]['belongsTo'](db[_0x6652('0x81')],{'onDelete':_0x6652('0x164'),'foreignKey':_0x6652('0x153')});db[_0x6652('0xfb')]['belongsTo'](db[_0x6652('0x8a')],{'onDelete':'restrict','foreignKey':_0x6652('0x17c')});db[_0x6652('0xfd')]['hasMany'](db[_0x6652('0xff')],{'as':_0x6652('0x159'),'onDelete':_0x6652('0x111'),'foreignKey':_0x6652('0x1f9')});db[_0x6652('0xfd')][_0x6652('0x121')](db[_0x6652('0xf9')],{'as':_0x6652('0x179'),'foreignKey':_0x6652('0x1f8')});db[_0x6652('0xfd')][_0x6652('0x121')](db['CmContact'],{'as':_0x6652('0x15f'),'foreignKey':_0x6652('0x160')});db['WhatsappInteraction'][_0x6652('0x121')](db[_0x6652('0x11')],{'as':_0x6652('0x171'),'foreignKey':_0x6652('0x10f')});db[_0x6652('0xfd')][_0x6652('0x126')](db[_0x6652('0x8a')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db['WhatsappInteraction'][_0x6652('0x126')](db[_0x6652('0x8a')],{'through':_0x6652('0x1b6'),'as':_0x6652('0x174')});db[_0x6652('0xfd')][_0x6652('0x126')](db['User'],{'as':_0x6652('0x175'),'through':_0x6652('0x133'),'foreignKey':'WhatsappInteractionId'});db[_0x6652('0xff')][_0x6652('0x121')](db['User'],{'as':_0x6652('0x11')});db[_0x6652('0xff')][_0x6652('0x121')](db[_0x6652('0x70')],{'onDelete':_0x6652('0x111'),'as':_0x6652('0x15f')});db[_0x6652('0xff')][_0x6652('0x121')](db[_0x6652('0xfd')],{'onDelete':_0x6652('0x111'),'as':'Interaction','foreignKey':_0x6652('0x1f9')});db['WhatsappMessage'][_0x6652('0x121')](db[_0x6652('0xf9')],{'as':_0x6652('0x179'),'foreignKey':'WhatsappAccountId'});db[_0x6652('0x1fa')][_0x6652('0x121')](db[_0x6652('0xf9')],{});db[_0x6652('0x1fa')]['belongsTo'](db[_0x6652('0xf1')],{'as':_0x6652('0x16a'),'foreignKey':_0x6652('0x16b')});db[_0x6652('0x1fa')][_0x6652('0x121')](db['CmContact'],{'as':_0x6652('0x15f'),'foreignKey':_0x6652('0x160')});db[_0x6652('0x1fa')]['belongsTo'](db[_0x6652('0xfd')],{});db[_0x6652('0x1fa')][_0x6652('0x121')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x6652('0x121')](db['WhatsappMessage'],{});db['WhatsappQueueReport'][_0x6652('0x121')](db[_0x6652('0x11')],{});db['WhatsappTransferReport'][_0x6652('0x121')](db['WhatsappMessage'],{});db['WhatsappTransferReport']['belongsTo'](db[_0x6652('0xfd')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x6652('0xf9')],{'foreignKey':_0x6652('0x1fb'),'as':_0x6652('0x1e2')});db[_0x6652('0x102')][_0x6652('0x121')](db[_0x6652('0xf9')],{'foreignKey':_0x6652('0x1fc'),'as':_0x6652('0x1e8')});db[_0x6652('0x102')][_0x6652('0x121')](db[_0x6652('0x104')],{'foreignKey':_0x6652('0x1fd'),'as':'ToQueue'});db[_0x6652('0x102')][_0x6652('0x121')](db[_0x6652('0x11')],{'foreignKey':_0x6652('0x1e3'),'as':_0x6652('0x1e4')});db[_0x6652('0x102')]['belongsTo'](db['User'],{'foreignKey':_0x6652('0x1e5'),'as':_0x6652('0x1ea')});db[_0x6652('0x104')][_0x6652('0x126')](db[_0x6652('0x11')],{'as':_0x6652('0x156'),'through':_0x6652('0x38'),'foreignKey':_0x6652('0x1fe')});db['WhatsappQueue'][_0x6652('0x126')](db[_0x6652('0x12a')],{'through':_0x6652('0x1ff'),'as':_0x6652('0x157')});db[_0x6652('0x200')][_0x6652('0x121')](db[_0x6652('0x11')],{'as':_0x6652('0x201'),'foreignKey':_0x6652('0x10f'),'onDelete':'cascade','hooks':!![]});db[_0x6652('0x162')][_0x6652('0x10e')](db[_0x6652('0xbd')],{'as':'Dynamics365Account','onDelete':_0x6652('0x164')});db[_0x6652('0x162')][_0x6652('0x10e')](db[_0x6652('0x202')],{'as':'Imap','onDelete':_0x6652('0x164')});db[_0x6652('0x162')][_0x6652('0x10e')](db['MailServerOut'],{'as':_0x6652('0x167'),'onDelete':_0x6652('0x164')});module[_0x6652('0x203')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x317b=['restrict','MailAccountId','Imap','Smtp','Dispositions','Answers','List','Teams','MailInteractionId','Account','Owner','Tags','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','ListId','Items','FaxAccountId','Interactions','FaxApplication','fax_interaction_has_tags','ThroughTags','FaxInteractionId','AttachmentId','SmsAccountId','SmsApplication','mandatoryDispositionPauseId','Users','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Members','chat_group_has_users','Phones','CmContactId','Company','CompanyId','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','CampaignId','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','CustomReportId','VoiceMusicOnHold','Mohs','mail_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','Trigger','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','MetricId','Configurations','AccountId','SalesforceField','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Field','VariableId','SugarcrmAccount','Description','Subjects','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskAccount','ServicenowAccount','FromId','ProjectId','team_has_sms_queues','OpenchannelQueues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToAgent','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','Extensions','UserProfileSection','UserProfileSections','Resources','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','user','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','mysql','username','password','database','options','User','import','VoiceChanSpy','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceQueue','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxApplication/faxApplication.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','VoiceMail','cascade','UserId','userSetting','Recordings','hasMany','UserVoiceQueueRt','VoiceQueuesRt','HopperHistory','ReportAgentPreview','OpenchannelInteraction','OpenchannelInteractions','SmsInteractions','FaxInteractions','WhatsappInteractions','UserNotifications','SenderId','Hoppers','SET\x20NULL','userProfileId','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteraction','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserMailQueue','ChatQueue','FaxQueues','WhatsappQueues','UserWhatsappQueue','ChatWebsite','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccount','user_has_mail_accounts','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','VoiceQueueId','CmHopperFinal','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','uniqueid','Contact','ContactId','CloudProvider','CloudProviderId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x317b,0x96));var _0xb317=function(_0x18cdd6,_0x4537fa){_0x18cdd6=_0x18cdd6-0x0;var _0xe1bfa5=_0x317b[_0x18cdd6];return _0xe1bfa5;};'use strict';var config=require(_0xb317('0x0'));var Sequelize=require(_0xb317('0x1'));var _=require(_0xb317('0x2'));var jstz=require(_0xb317('0x3'));var timezone=jstz[_0xb317('0x4')]();config[_0xb317('0x1')]=_[_0xb317('0x5')](config[_0xb317('0x1')],{'database':_0xb317('0x6'),'username':_0xb317('0x7'),'password':_0xb317('0x8'),'options':{'host':_0xb317('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xb317('0xa')},'logging':![],'timezone':timezone[_0xb317('0xb')](),'define':{'charset':_0xb317('0xc'),'collate':_0xb317('0xd')}}});config['sequelizeHistory']=_['defaultsDeep'](config[_0xb317('0xe')],{'database':_0xb317('0x6'),'username':_0xb317('0x7'),'password':'xC@LL1234','options':{'host':_0xb317('0x9'),'port':0xcea,'dialect':_0xb317('0xf'),'dialectOptions':{'charset':_0xb317('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xb317('0xc'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb317('0x1')]['database'],config[_0xb317('0x1')][_0xb317('0x10')],config['sequelize'][_0xb317('0x11')],config[_0xb317('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb317('0xe')][_0xb317('0x12')],config['sequelizeHistory'][_0xb317('0x10')],config[_0xb317('0xe')]['password'],config[_0xb317('0xe')][_0xb317('0x13')])};db[_0xb317('0x14')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/user/user.model');db[_0xb317('0x16')]=db[_0xb317('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db[_0xb317('0x1')]['import']('../api/voiceContext/voiceContext.model');db[_0xb317('0x17')]=db['sequelize'][_0xb317('0x15')](_0xb317('0x18'));db['VoiceMusicOnHold']=db['sequelize'][_0xb317('0x15')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xb317('0x19')]=db[_0xb317('0x1')]['import']('../api/voiceQueue/voiceQueue.model');db[_0xb317('0x1a')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/voiceRecording/voiceRecording.model');db[_0xb317('0x1b')]=db[_0xb317('0x1')]['import'](_0xb317('0x1c'));db['VoiceMail']=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x1d'));db[_0xb317('0x1e')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xb317('0x1f')]=db['sequelize']['import'](_0xb317('0x20'));db[_0xb317('0x21')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x22'));db[_0xb317('0x23')]=db['sequelize'][_0xb317('0x15')](_0xb317('0x24'));db[_0xb317('0x25')]=db['sequelize'][_0xb317('0x15')](_0xb317('0x26'));db[_0xb317('0x27')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x28'));db['Trunk']=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x29'));db[_0xb317('0x2a')]=db['sequelize'][_0xb317('0x15')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x2b'));db[_0xb317('0x2c')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x2d'));db[_0xb317('0x2e')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x2f'));db['UserMailQueue']=db['sequelize'][_0xb317('0x15')]('../api/userMailQueue/userMailQueue.model');db[_0xb317('0x30')]=db['sequelize'][_0xb317('0x15')]('../api/userFaxQueue/userFaxQueue.model');db[_0xb317('0x31')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x32'));db[_0xb317('0x33')]=db['sequelize'][_0xb317('0x15')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db[_0xb317('0x1')][_0xb317('0x15')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xb317('0x34')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x35'));db[_0xb317('0x36')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x37'));db['MailAccount']=db[_0xb317('0x1')]['import']('../api/mailAccount/mailAccount.model');db[_0xb317('0x38')]=db['sequelize'][_0xb317('0x15')]('../api/mailQueue/mailQueue.model');db[_0xb317('0x39')]=db[_0xb317('0x1')]['import'](_0xb317('0x3a'));db[_0xb317('0x3b')]=db[_0xb317('0x1')]['import']('../api/mailInteraction/mailInteraction.model');db[_0xb317('0x3c')]=db['sequelize']['import'](_0xb317('0x3d'));db[_0xb317('0x3e')]=db['sequelize']['import'](_0xb317('0x3f'));db[_0xb317('0x40')]=db['sequelize']['import'](_0xb317('0x41'));db[_0xb317('0x42')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x43'));db[_0xb317('0x44')]=db['sequelize'][_0xb317('0x15')]('../api/dashboardItem/dashboardItem.model');db[_0xb317('0x45')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xb317('0x1')]['import'](_0xb317('0x46'));db['FaxInteraction']=db[_0xb317('0x1')][_0xb317('0x15')]('../api/faxInteraction/faxInteraction.model');db[_0xb317('0x47')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x48'));db[_0xb317('0x49')]=db[_0xb317('0x1')]['import'](_0xb317('0x4a'));db[_0xb317('0x4b')]=db['sequelize'][_0xb317('0x15')](_0xb317('0x4c'));db['SmsAccount']=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x4d'));db['SmsApplication']=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x4e'));db[_0xb317('0x4f')]=db['sequelize'][_0xb317('0x15')](_0xb317('0x50'));db[_0xb317('0x51')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x52'));db[_0xb317('0x53')]=db[_0xb317('0x1')]['import'](_0xb317('0x54'));db[_0xb317('0x55')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db[_0xb317('0x1')][_0xb317('0x15')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize'][_0xb317('0x15')](_0xb317('0x56'));db[_0xb317('0x57')]=db['sequelize'][_0xb317('0x15')](_0xb317('0x58'));db[_0xb317('0x59')]=db[_0xb317('0x1')]['import'](_0xb317('0x5a'));db['ChatWebsite']=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x5b'));db['OpenchannelQueueReport']=db[_0xb317('0x1')][_0xb317('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xb317('0x5c')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/chatApplication/chatApplication.model');db[_0xb317('0x5d')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x5e'));db[_0xb317('0x5f')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x60'));db[_0xb317('0x61')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0xb317('0x1')][_0xb317('0x15')]('../api/chatQueue/chatQueue.model');db[_0xb317('0x62')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/chatGroup/chatGroup.model');db[_0xb317('0x63')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x64'));db[_0xb317('0x65')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/cmCompany/cmCompany.model');db[_0xb317('0x66')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/cmContact/cmContact.model');db[_0xb317('0x67')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x68'));db[_0xb317('0x69')]=db['sequelize']['import'](_0xb317('0x6a'));db['CmHopperFinal']=db['sequelize'][_0xb317('0x15')](_0xb317('0x6b'));db[_0xb317('0x6c')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x6d'));db['ReportAgentPreview']=db[_0xb317('0x1')]['import'](_0xb317('0x6e'));db['CmCustomField']=db['sequelize']['import']('../api/cmCustomField/cmCustomField.model');db['Action']=db['sequelize']['import'](_0xb317('0x6f'));db[_0xb317('0x70')]=db['sequelize'][_0xb317('0x15')]('../api/automation/automation.model');db[_0xb317('0x71')]=db['sequelize']['import'](_0xb317('0x72'));db[_0xb317('0x73')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x74'));db['Condition']=db[_0xb317('0x1')]['import'](_0xb317('0x75'));db[_0xb317('0x76')]=db['sequelize'][_0xb317('0x15')](_0xb317('0x77'));db[_0xb317('0x78')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x79'));db[_0xb317('0x7a')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x7b'));db[_0xb317('0x7c')]=db[_0xb317('0x1')]['import'](_0xb317('0x7d'));db[_0xb317('0x7e')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x7f'));db[_0xb317('0x80')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/sound/sound.model');db[_0xb317('0x81')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x82'));db[_0xb317('0x83')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x84'));db[_0xb317('0x85')]=db['sequelize']['import'](_0xb317('0x86'));db['CmHopperAdditionalPhone']=db[_0xb317('0x1')][_0xb317('0x15')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xb317('0x87')]=db['sequelize'][_0xb317('0x15')](_0xb317('0x88'));db['Trigger']=db['sequelize'][_0xb317('0x15')](_0xb317('0x89'));db[_0xb317('0x8a')]=db['sequelize'][_0xb317('0x15')](_0xb317('0x8b'));db['Integration']=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x8c'));db['IntegrationReport']=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x8d'));db[_0xb317('0x8e')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x8f'));db[_0xb317('0x90')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x91'));db[_0xb317('0x92')]=db['sequelize']['import'](_0xb317('0x93'));db[_0xb317('0x94')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x95'));db[_0xb317('0x96')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x97'));db[_0xb317('0x98')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xb317('0x99')]=db['sequelize']['import'](_0xb317('0x9a'));db[_0xb317('0x9b')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x9c'));db['SalesforceField']=db['sequelize'][_0xb317('0x15')](_0xb317('0x9d'));db['SugarcrmAccount']=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x9e'));db[_0xb317('0x9f')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xa0'));db[_0xb317('0xa1')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xa2'));db[_0xb317('0xa3')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xa4'));db[_0xb317('0xa5')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xb317('0xa6')]=db['sequelize'][_0xb317('0x15')](_0xb317('0xa7'));db[_0xb317('0xa8')]=db[_0xb317('0x1')]['import'](_0xb317('0xa9'));db[_0xb317('0xaa')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xab'));db[_0xb317('0xac')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xad'));db[_0xb317('0xae')]=db[_0xb317('0x1')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0xb317('0xaf')]=db[_0xb317('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xb317('0xb0')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xb1'));db['FreshdeskAccount']=db['sequelize'][_0xb317('0x15')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xb317('0xb2')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xb3'));db[_0xb317('0xb4')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xb5'));db[_0xb317('0xb6')]=db[_0xb317('0x1')]['import'](_0xb317('0xb7'));db[_0xb317('0xb8')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xb9'));db[_0xb317('0xba')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xbb'));db['ServicenowAccount']=db[_0xb317('0x1')][_0xb317('0x15')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xb317('0xbc')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xbd'));db[_0xb317('0xbe')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/intServicenowField/intServicenowField.model');db[_0xb317('0xbf')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xc0'));db[_0xb317('0xc1')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xc2'));db[_0xb317('0xc3')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xc4'));db[_0xb317('0xc5')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xc6'));db[_0xb317('0xc7')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xb317('0xc8')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xc9'));db[_0xb317('0xca')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x8c'));db[_0xb317('0xcb')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/network/network.model');db[_0xb317('0xcc')]=db[_0xb317('0x1')]['import']('../api/chatQueueReport/chatQueueReport.model');db[_0xb317('0xcd')]=db['sequelize']['import'](_0xb317('0xce'));db[_0xb317('0xcf')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xd0'));db[_0xb317('0xd1')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xd2'));db[_0xb317('0xd3')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xb317('0xd4')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xd5'));db[_0xb317('0xd6')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xd7'));db[_0xb317('0xd8')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xd9'));db[_0xb317('0xda')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/jscriptyProject/jscriptyProject.model');db[_0xb317('0xdb')]=db['sequelize'][_0xb317('0x15')](_0xb317('0xdc'));db[_0xb317('0xdd')]=db[_0xb317('0x1')]['import'](_0xb317('0xde'));db[_0xb317('0xdf')]=db['sequelize']['import'](_0xb317('0xe0'));db[_0xb317('0xe1')]=db[_0xb317('0x1')]['import'](_0xb317('0xe2'));db[_0xb317('0xe3')]=db['sequelize'][_0xb317('0x15')](_0xb317('0xe4'));db[_0xb317('0xe5')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xe6'));db[_0xb317('0xe7')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xe8'));db[_0xb317('0xe9')]=db['sequelize']['import'](_0xb317('0xea'));db['Migration']=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xeb'));db[_0xb317('0xec')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xed'));db[_0xb317('0xee')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xef'));db[_0xb317('0xf0')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xf1'));db[_0xb317('0xf2')]=db[_0xb317('0x1')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0xb317('0xf3')]=db['sequelize']['import']('../api/faxTransferReport/faxTransferReport.model');db[_0xb317('0xf4')]=db['sequelize'][_0xb317('0x15')](_0xb317('0xf5'));db[_0xb317('0xf6')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xf7'));db[_0xb317('0xf8')]=db['sequelize']['import'](_0xb317('0xf9'));db[_0xb317('0xfa')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xfb'));db[_0xb317('0xfc')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0xfd'));db[_0xb317('0xfe')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0xb317('0xff')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x100'));db['WhatsappAccount']=db['sequelize'][_0xb317('0x15')](_0xb317('0x101'));db['WhatsappApplication']=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x102'));db[_0xb317('0x103')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x104'));db[_0xb317('0x105')]=db[_0xb317('0x1')]['import'](_0xb317('0x106'));db[_0xb317('0x107')]=db[_0xb317('0x1')][_0xb317('0x15')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xb317('0x108')]=db['sequelize'][_0xb317('0x15')](_0xb317('0x109'));db[_0xb317('0x10a')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x10b'));db['CloudProvider']=db[_0xb317('0x1')]['import'](_0xb317('0x10c'));db[_0xb317('0x10d')]=db[_0xb317('0x1')]['import'](_0xb317('0x10e'));db[_0xb317('0x10f')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x110'));db[_0xb317('0x111')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x112'));db[_0xb317('0x113')]=db[_0xb317('0x1')][_0xb317('0x15')](_0xb317('0x114'));db['MailInteractionHasTag']=db[_0xb317('0x1')]['import'](_0xb317('0x115'));db[_0xb317('0x14')][_0xb317('0x116')](db[_0xb317('0x117')],{'as':_0xb317('0x117'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x119')});db['User']['hasOne'](db[_0xb317('0x113')],{'as':_0xb317('0x11a'),'onDelete':'cascade','foreignKey':_0xb317('0x119')});db[_0xb317('0x14')]['hasMany'](db[_0xb317('0x1a')],{'as':_0xb317('0x11b'),'foreignKey':_0xb317('0x119')});db[_0xb317('0x14')][_0xb317('0x11c')](db[_0xb317('0x11d')],{'as':_0xb317('0x11e'),'foreignKey':_0xb317('0x119')});db[_0xb317('0x14')][_0xb317('0x11c')](db[_0xb317('0x17')],{'as':'Extensions','onDelete':_0xb317('0x118'),'hooks':!![]});db[_0xb317('0x14')][_0xb317('0x11c')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xb317('0x119')});db[_0xb317('0x14')][_0xb317('0x11c')](db[_0xb317('0x6c')],{'as':_0xb317('0x11f'),'foreignKey':_0xb317('0x119')});db[_0xb317('0x14')][_0xb317('0x11c')](db['ReportAgentPreview'],{'as':_0xb317('0x120'),'foreignKey':'UserId'});db['User'][_0xb317('0x11c')](db[_0xb317('0x121')],{'as':_0xb317('0x122'),'foreignKey':_0xb317('0x119')});db[_0xb317('0x14')][_0xb317('0x11c')](db[_0xb317('0x5d')],{'as':'ChatInteractions','foreignKey':_0xb317('0x119')});db[_0xb317('0x14')][_0xb317('0x11c')](db[_0xb317('0x4f')],{'as':_0xb317('0x123'),'foreignKey':_0xb317('0x119')});db[_0xb317('0x14')][_0xb317('0x11c')](db['FaxInteraction'],{'as':_0xb317('0x124'),'foreignKey':_0xb317('0x119')});db[_0xb317('0x14')][_0xb317('0x11c')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'UserId'});db[_0xb317('0x14')][_0xb317('0x11c')](db[_0xb317('0x103')],{'as':_0xb317('0x125'),'foreignKey':_0xb317('0x119')});db[_0xb317('0x14')]['hasMany'](db[_0xb317('0xff')],{'as':_0xb317('0x126'),'foreignKey':_0xb317('0x127')});db[_0xb317('0x14')]['hasMany'](db[_0xb317('0x67')],{'as':_0xb317('0x128'),'foreignKey':_0xb317('0x119'),'onDelete':_0xb317('0x129')});db['User']['belongsTo'](db['UserProfile'],{'as':_0xb317('0xfc'),'foreignKey':_0xb317('0x12a')});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0x62')],{'as':'Groups','through':'chat_group_has_users'});db['User']['belongsToMany'](db[_0xb317('0x66')],{'as':_0xb317('0x12c'),'through':_0xb317('0x12d')});db[_0xb317('0x14')]['belongsToMany'](db[_0xb317('0xf8')],{'as':_0xb317('0x12e'),'through':_0xb317('0x12f')});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0xe5')],{'through':_0xb317('0x130')});db['User'][_0xb317('0x12b')](db[_0xb317('0x3b')],{'as':_0xb317('0x131'),'through':_0xb317('0x132')});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0x5d')],{'as':_0xb317('0x133'),'through':_0xb317('0x134')});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0x135')],{'as':_0xb317('0x124'),'through':_0xb317('0x136')});db['User'][_0xb317('0x12b')](db['SmsInteraction'],{'as':_0xb317('0x123'),'through':'user_has_sms_interactions'});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0x121')],{'as':_0xb317('0x122'),'through':_0xb317('0x137')});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0x103')],{'as':_0xb317('0x125'),'through':_0xb317('0x138')});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0x19')],{'as':_0xb317('0x139'),'through':_0xb317('0x2c'),'required':![]});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0xfa')],{'as':_0xb317('0x13a'),'through':_0xb317('0x111'),'required':![]});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0x38')],{'as':'MailQueues','through':_0xb317('0x13b'),'required':![]});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0x13c')],{'as':'ChatQueues','through':_0xb317('0x2e'),'required':![],'hooks':!![]});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0x49')],{'as':_0xb317('0x13d'),'through':_0xb317('0x30'),'required':![]});db[_0xb317('0x14')]['belongsToMany'](db[_0xb317('0x53')],{'as':'SmsQueues','through':_0xb317('0x31'),'required':![]});db['User'][_0xb317('0x12b')](db[_0xb317('0x59')],{'as':'OpenchannelQueues','through':_0xb317('0x33'),'required':![]});db[_0xb317('0x14')]['belongsToMany'](db[_0xb317('0x10a')],{'as':_0xb317('0x13e'),'through':_0xb317('0x13f'),'required':![]});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0xf8')],{'through':'cm_user_has_lists'});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0x140')],{'as':_0xb317('0x141'),'through':_0xb317('0x142')});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0x45')],{'as':'FaxAccounts','through':_0xb317('0x143')});db['User'][_0xb317('0x12b')](db[_0xb317('0x144')],{'as':'MailAccounts','through':_0xb317('0x145')});db[_0xb317('0x14')]['belongsToMany'](db[_0xb317('0x55')],{'as':_0xb317('0x146'),'through':'user_has_openchannel_accounts'});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0x147')],{'as':_0xb317('0x148'),'through':_0xb317('0x149')});db[_0xb317('0x14')][_0xb317('0x12b')](db[_0xb317('0x14a')],{'as':_0xb317('0x14b'),'through':_0xb317('0x14c')});db['VoiceChanSpy'][_0xb317('0x11c')](db[_0xb317('0x17')],{'as':_0xb317('0x14d'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x14e')});db[_0xb317('0x14f')]['hasMany'](db['VoiceExtension'],{'onDelete':_0xb317('0x118')});db[_0xb317('0x17')]['hasMany'](db[_0xb317('0x17')],{'as':_0xb317('0x150'),'onDelete':_0xb317('0x118')});db['VoiceMusicOnHold']['belongsToMany'](db[_0xb317('0x80')],{'as':_0xb317('0x151'),'through':_0xb317('0x152')});db[_0xb317('0x19')][_0xb317('0x11c')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0xb317('0x153')});db[_0xb317('0x19')]['hasMany'](db[_0xb317('0x67')],{'as':'Hoppers','foreignKey':_0xb317('0x153')});db[_0xb317('0x19')]['hasMany'](db[_0xb317('0x154')],{'as':_0xb317('0x155'),'foreignKey':_0xb317('0x153')});db['VoiceQueue']['hasMany'](db[_0xb317('0x6c')],{'as':_0xb317('0x156'),'foreignKey':_0xb317('0x153')});db[_0xb317('0x19')][_0xb317('0x11c')](db['ReportAgentPreview'],{'as':_0xb317('0x120'),'foreignKey':_0xb317('0x153')});db['VoiceQueue'][_0xb317('0x11c')](db[_0xb317('0x69')],{'as':_0xb317('0x157'),'foreignKey':_0xb317('0x153')});db[_0xb317('0x19')][_0xb317('0x11c')](db[_0xb317('0xd3')],{'as':_0xb317('0x158'),'foreignKey':_0xb317('0x153')});db[_0xb317('0x19')]['belongsTo'](db[_0xb317('0x159')],{'as':_0xb317('0x159'),'foreignKey':_0xb317('0x15a')});db[_0xb317('0x19')][_0xb317('0x15b')](db[_0xb317('0x159')],{'as':_0xb317('0x15c'),'foreignKey':_0xb317('0x15d')});db[_0xb317('0x19')][_0xb317('0x15b')](db[_0xb317('0x76')],{'as':_0xb317('0x76'),'foreignKey':_0xb317('0x15e')});db[_0xb317('0x19')][_0xb317('0x15b')](db[_0xb317('0x78')],{'as':_0xb317('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0xb317('0x12b')](db[_0xb317('0xf8')],{'as':_0xb317('0x12e'),'through':_0xb317('0x160')});db[_0xb317('0x19')]['belongsToMany'](db[_0xb317('0x14')],{'as':_0xb317('0x161'),'through':_0xb317('0x2c')});db[_0xb317('0x19')][_0xb317('0x12b')](db[_0xb317('0xe5')],{'as':'Teams','through':_0xb317('0x10d')});db[_0xb317('0x19')]['belongsToMany'](db[_0xb317('0xf8')],{'as':_0xb317('0x162'),'through':_0xb317('0x163')});db[_0xb317('0x1a')][_0xb317('0x15b')](db[_0xb317('0x14')],{'as':'User','foreignKey':_0xb317('0x119')});db[_0xb317('0x1b')]['belongsTo'](db[_0xb317('0x14')],{'as':'User','foreignKey':'UserId'});db[_0xb317('0x117')][_0xb317('0x11c')](db['VoiceMailMessage'],{'as':_0xb317('0x164'),'onDelete':'cascade','foreignKey':_0xb317('0x165'),'sourceKey':'mailbox'});db[_0xb317('0x1e')][_0xb317('0x15b')](db[_0xb317('0x117')],{'foreignKey':_0xb317('0x165'),'targetKey':_0xb317('0x166')});db['VoiceCallReport'][_0xb317('0x11c')](db['VoiceQueueReport'],{'as':_0xb317('0x167'),'foreignKey':'uniqueid','constraints':![]});db[_0xb317('0x1f')][_0xb317('0x11c')](db[_0xb317('0x23')],{'as':_0xb317('0x168'),'foreignKey':_0xb317('0x169'),'constraints':![]});db[_0xb317('0x1f')][_0xb317('0x15b')](db[_0xb317('0x14')],{'as':'User','foreignKey':_0xb317('0x119')});db['VoiceCallReport']['belongsTo'](db[_0xb317('0x66')],{'as':_0xb317('0x16a'),'foreignKey':_0xb317('0x16b')});db[_0xb317('0x34')][_0xb317('0x15b')](db[_0xb317('0x144')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xb317('0x34')][_0xb317('0x15b')](db[_0xb317('0x16c')],{'as':_0xb317('0x16c'),'foreignKey':_0xb317('0x16d'),'onDelete':_0xb317('0x16e')});db['MailServerOut'][_0xb317('0x15b')](db[_0xb317('0x144')],{'as':_0xb317('0x144'),'foreignKey':_0xb317('0x16f')});db[_0xb317('0x36')][_0xb317('0x15b')](db[_0xb317('0x16c')],{'as':_0xb317('0x16c'),'foreignKey':'CloudProviderId','onDelete':_0xb317('0x16e')});db['MailAccount'][_0xb317('0x116')](db[_0xb317('0x34')],{'as':_0xb317('0x170'),'onDelete':_0xb317('0x118')});db[_0xb317('0x144')][_0xb317('0x116')](db[_0xb317('0x36')],{'as':_0xb317('0x171'),'onDelete':_0xb317('0x118')});db[_0xb317('0x144')][_0xb317('0x11c')](db[_0xb317('0x73')],{'as':_0xb317('0x172'),'foreignKey':_0xb317('0x16f'),'onDelete':'cascade'});db[_0xb317('0x144')][_0xb317('0x11c')](db[_0xb317('0x71')],{'as':_0xb317('0x173'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xb317('0x11c')](db[_0xb317('0x3c')],{'as':_0xb317('0x164'),'foreignKey':'MailAccountId'});db[_0xb317('0x144')]['hasMany'](db['MailInteraction'],{'as':'Interactions'});db[_0xb317('0x144')][_0xb317('0x11c')](db[_0xb317('0x3e')],{'as':_0xb317('0x150'),'foreignKey':_0xb317('0x16f'),'onDelete':_0xb317('0x118')});db[_0xb317('0x144')][_0xb317('0x15b')](db['CmList'],{'as':_0xb317('0x174'),'foreignKey':'ListId'});db[_0xb317('0x144')]['belongsTo'](db[_0xb317('0x87')],{'as':_0xb317('0x87'),'foreignKey':'TemplateId'});db[_0xb317('0x144')][_0xb317('0x15b')](db['Pause'],{'as':_0xb317('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb317('0x144')][_0xb317('0x12b')](db['User'],{'as':_0xb317('0x161'),'through':_0xb317('0x145')});db[_0xb317('0x38')][_0xb317('0x12b')](db[_0xb317('0x14')],{'as':'Agents','through':_0xb317('0x13b')});db[_0xb317('0x38')]['belongsToMany'](db[_0xb317('0xe5')],{'through':'team_has_mail_queues','as':_0xb317('0x175')});db[_0xb317('0x3b')][_0xb317('0x11c')](db[_0xb317('0x3c')],{'as':_0xb317('0x164'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x176')});db[_0xb317('0x3b')]['belongsTo'](db[_0xb317('0x144')],{'as':_0xb317('0x177'),'foreignKey':'MailAccountId'});db[_0xb317('0x3b')][_0xb317('0x15b')](db[_0xb317('0x66')],{'as':_0xb317('0x16a'),'foreignKey':_0xb317('0x16b')});db[_0xb317('0x3b')][_0xb317('0x15b')](db[_0xb317('0x14')],{'as':_0xb317('0x178'),'foreignKey':_0xb317('0x119')});db[_0xb317('0x3b')][_0xb317('0x12b')](db[_0xb317('0x81')],{'through':'mail_interaction_has_tags','as':_0xb317('0x179')});db[_0xb317('0x3b')][_0xb317('0x12b')](db[_0xb317('0x81')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0xb317('0x3b')][_0xb317('0x12b')](db[_0xb317('0x14')],{'as':'Users','through':_0xb317('0x132'),'foreignKey':_0xb317('0x176')});db[_0xb317('0x3c')][_0xb317('0x11c')](db[_0xb317('0xec')],{'as':_0xb317('0x17a'),'onDelete':_0xb317('0x118')});db['MailMessage']['belongsTo'](db[_0xb317('0x14')],{'as':_0xb317('0x14')});db[_0xb317('0x3c')]['belongsTo'](db['CmContact'],{'onDelete':_0xb317('0x118'),'as':_0xb317('0x16a')});db[_0xb317('0x3c')]['belongsTo'](db[_0xb317('0x3b')],{'as':_0xb317('0x17b'),'foreignKey':_0xb317('0x176')});db['MailMessage'][_0xb317('0x15b')](db[_0xb317('0x144')],{'as':_0xb317('0x177'),'foreignKey':'MailAccountId'});db[_0xb317('0x3c')]['belongsTo'](db[_0xb317('0x140')],{'as':'ChatWebsite','foreignKey':_0xb317('0x17c')});db['MailMessage'][_0xb317('0x15b')](db[_0xb317('0x61')],{'as':_0xb317('0x61'),'foreignKey':_0xb317('0x17d')});db[_0xb317('0x3e')][_0xb317('0x15b')](db[_0xb317('0x14')],{'onDelete':_0xb317('0x16e')});db[_0xb317('0x3e')][_0xb317('0x15b')](db[_0xb317('0x38')],{'onDelete':'restrict'});db[_0xb317('0x3e')][_0xb317('0x15b')](db[_0xb317('0x144')],{'onDelete':_0xb317('0x16e')});db[_0xb317('0x3e')]['belongsTo'](db[_0xb317('0x76')],{'onDelete':_0xb317('0x16e'),'foreignKey':'IntervalId'});db['MailApplication'][_0xb317('0x15b')](db[_0xb317('0x81')],{'onDelete':_0xb317('0x16e'),'foreignKey':_0xb317('0x17e')});db[_0xb317('0x40')][_0xb317('0x15b')](db[_0xb317('0x144')],{});db[_0xb317('0x40')]['belongsTo'](db['CmList'],{'as':_0xb317('0x174'),'foreignKey':_0xb317('0x17f')});db[_0xb317('0x40')][_0xb317('0x15b')](db[_0xb317('0x66')],{'as':_0xb317('0x16a'),'foreignKey':_0xb317('0x16b')});db[_0xb317('0x40')][_0xb317('0x15b')](db[_0xb317('0x3b')],{});db[_0xb317('0x40')][_0xb317('0x15b')](db[_0xb317('0x3c')],{});db[_0xb317('0x40')][_0xb317('0x15b')](db[_0xb317('0x14')],{});db['MailQueueReport'][_0xb317('0x15b')](db['MailQueue'],{});db[_0xb317('0x42')][_0xb317('0x11c')](db[_0xb317('0x44')],{'as':_0xb317('0x180'),'onDelete':_0xb317('0x118')});db[_0xb317('0x45')]['hasMany'](db['Disposition'],{'as':_0xb317('0x172'),'foreignKey':_0xb317('0x181'),'onDelete':_0xb317('0x118')});db[_0xb317('0x45')][_0xb317('0x11c')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xb317('0x181')});db['FaxAccount'][_0xb317('0x11c')](db['FaxInteraction'],{'as':_0xb317('0x182')});db['FaxAccount']['hasMany'](db[_0xb317('0x183')],{'as':'Applications','foreignKey':'FaxAccountId','onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0xb317('0x17')],{'as':'Exntensions','onDelete':_0xb317('0x118')});db[_0xb317('0x45')][_0xb317('0x11c')](db[_0xb317('0x47')],{'as':'Messages'});db[_0xb317('0x45')][_0xb317('0x15b')](db[_0xb317('0x159')],{'as':_0xb317('0x159')});db['FaxAccount'][_0xb317('0x15b')](db[_0xb317('0xf8')],{'as':_0xb317('0x174'),'foreignKey':'ListId'});db['FaxAccount'][_0xb317('0x15b')](db['Pause'],{'as':_0xb317('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb317('0x45')][_0xb317('0x12b')](db[_0xb317('0x14')],{'as':'Agents','through':_0xb317('0x143')});db[_0xb317('0x183')]['belongsTo'](db[_0xb317('0x14')],{'onDelete':'restrict'});db[_0xb317('0x183')][_0xb317('0x15b')](db[_0xb317('0x49')],{'onDelete':'restrict'});db[_0xb317('0x183')][_0xb317('0x15b')](db['FaxAccount'],{'onDelete':_0xb317('0x16e')});db[_0xb317('0x183')][_0xb317('0x15b')](db['Tag'],{'onDelete':_0xb317('0x16e'),'foreignKey':'TagId'});db[_0xb317('0x135')]['hasMany'](db['FaxMessage'],{'as':_0xb317('0x164'),'onDelete':_0xb317('0x118'),'foreignKey':'FaxInteractionId'});db[_0xb317('0x135')][_0xb317('0x15b')](db['FaxAccount'],{'as':'Account','foreignKey':_0xb317('0x181')});db['FaxInteraction']['belongsTo'](db[_0xb317('0x66')],{'as':_0xb317('0x16a'),'foreignKey':'ContactId'});db['FaxInteraction']['belongsTo'](db['User'],{'as':_0xb317('0x178'),'foreignKey':_0xb317('0x119')});db[_0xb317('0x135')][_0xb317('0x12b')](db[_0xb317('0x81')],{'through':_0xb317('0x184'),'as':_0xb317('0x179')});db[_0xb317('0x135')][_0xb317('0x12b')](db[_0xb317('0x81')],{'through':'fax_interaction_has_tags','as':_0xb317('0x185')});db[_0xb317('0x135')]['belongsToMany'](db['User'],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0xb317('0x186')});db['FaxMessage'][_0xb317('0x15b')](db[_0xb317('0x14')],{'onDelete':_0xb317('0x118'),'as':_0xb317('0x14')});db[_0xb317('0x47')][_0xb317('0x15b')](db[_0xb317('0x135')],{'as':_0xb317('0x17b'),'foreignKey':_0xb317('0x186')});db['FaxMessage'][_0xb317('0x15b')](db[_0xb317('0x66')],{'onDelete':'cascade','as':'Contact'});db[_0xb317('0x47')][_0xb317('0x15b')](db['Attachment'],{'as':_0xb317('0xec'),'foreignKey':_0xb317('0x187')});db[_0xb317('0x47')][_0xb317('0x15b')](db[_0xb317('0x45')],{'as':_0xb317('0x177'),'foreignKey':'FaxAccountId'});db[_0xb317('0x49')][_0xb317('0x12b')](db[_0xb317('0x14')],{'as':'Agents','through':'UserFaxQueue'});db[_0xb317('0x49')]['belongsToMany'](db['Team'],{'through':'team_has_fax_queues','as':_0xb317('0x175')});db[_0xb317('0x4b')][_0xb317('0x15b')](db[_0xb317('0x45')],{});db['FaxQueueReport']['belongsTo'](db['CmList'],{'as':_0xb317('0x174'),'foreignKey':_0xb317('0x17f')});db[_0xb317('0x4b')][_0xb317('0x15b')](db[_0xb317('0x66')],{'as':'Contact','foreignKey':_0xb317('0x16b')});db[_0xb317('0x4b')]['belongsTo'](db['FaxInteraction'],{});db[_0xb317('0x4b')][_0xb317('0x15b')](db[_0xb317('0x47')],{});db['FaxQueueReport'][_0xb317('0x15b')](db[_0xb317('0x14')],{});db[_0xb317('0x4b')][_0xb317('0x15b')](db['FaxQueue'],{});db[_0xb317('0x147')][_0xb317('0x11c')](db[_0xb317('0x73')],{'as':_0xb317('0x172'),'foreignKey':_0xb317('0x188'),'onDelete':_0xb317('0x118')});db[_0xb317('0x147')]['hasMany'](db['CannedAnswer'],{'as':_0xb317('0x173'),'foreignKey':_0xb317('0x188')});db[_0xb317('0x147')][_0xb317('0x11c')](db[_0xb317('0x51')],{'as':'Messages','foreignKey':_0xb317('0x188')});db['SmsAccount'][_0xb317('0x11c')](db['SmsInteraction'],{'as':_0xb317('0x182')});db[_0xb317('0x147')][_0xb317('0x11c')](db[_0xb317('0x189')],{'as':_0xb317('0x150'),'foreignKey':_0xb317('0x188'),'onDelete':_0xb317('0x118')});db[_0xb317('0x147')][_0xb317('0x15b')](db['CmList'],{'as':_0xb317('0x174'),'foreignKey':_0xb317('0x17f')});db[_0xb317('0x147')][_0xb317('0x15b')](db[_0xb317('0x78')],{'as':_0xb317('0x15f'),'foreignKey':_0xb317('0x18a')});db[_0xb317('0x147')][_0xb317('0x12b')](db[_0xb317('0x14')],{'as':_0xb317('0x161'),'through':_0xb317('0x149')});db[_0xb317('0x189')][_0xb317('0x15b')](db[_0xb317('0x14')],{'onDelete':'restrict'});db[_0xb317('0x189')][_0xb317('0x15b')](db[_0xb317('0x53')],{'onDelete':_0xb317('0x16e')});db['SmsApplication'][_0xb317('0x15b')](db[_0xb317('0x147')],{'onDelete':_0xb317('0x16e')});db[_0xb317('0x189')][_0xb317('0x15b')](db[_0xb317('0x76')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['SmsApplication'][_0xb317('0x15b')](db[_0xb317('0x81')],{'onDelete':_0xb317('0x16e'),'foreignKey':'TagId'});db[_0xb317('0x4f')][_0xb317('0x11c')](db[_0xb317('0x51')],{'as':_0xb317('0x164'),'onDelete':_0xb317('0x118'),'foreignKey':'SmsInteractionId'});db[_0xb317('0x4f')]['belongsTo'](db[_0xb317('0x147')],{'as':'Account','foreignKey':_0xb317('0x188')});db[_0xb317('0x4f')][_0xb317('0x15b')](db[_0xb317('0x66')],{'as':_0xb317('0x16a'),'foreignKey':'ContactId'});db['SmsInteraction'][_0xb317('0x15b')](db[_0xb317('0x14')],{'as':_0xb317('0x178'),'foreignKey':_0xb317('0x119')});db[_0xb317('0x4f')][_0xb317('0x12b')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xb317('0x179')});db['SmsInteraction']['belongsToMany'](db['Tag'],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0xb317('0x4f')][_0xb317('0x12b')](db['User'],{'as':_0xb317('0x18b'),'through':'user_has_sms_interactions','foreignKey':_0xb317('0x18c')});db['SmsMessage'][_0xb317('0x15b')](db[_0xb317('0x14')],{'as':_0xb317('0x14')});db['SmsMessage'][_0xb317('0x15b')](db[_0xb317('0x66')],{'onDelete':_0xb317('0x118'),'as':'Contact'});db[_0xb317('0x51')][_0xb317('0x15b')](db[_0xb317('0x4f')],{'onDelete':_0xb317('0x118'),'as':_0xb317('0x17b'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xb317('0x15b')](db[_0xb317('0x147')],{'as':_0xb317('0x177'),'foreignKey':_0xb317('0x188')});db[_0xb317('0x53')]['belongsToMany'](db['User'],{'as':_0xb317('0x161'),'through':'UserSmsQueue','foreignKey':_0xb317('0x18d')});db[_0xb317('0x53')][_0xb317('0x12b')](db['Team'],{'through':'team_has_sms_queues','as':_0xb317('0x175')});db[_0xb317('0x55')][_0xb317('0x11c')](db['Disposition'],{'as':_0xb317('0x172'),'foreignKey':'OpenchannelAccountId','onDelete':_0xb317('0x118')});db[_0xb317('0x55')][_0xb317('0x11c')](db[_0xb317('0x71')],{'as':_0xb317('0x173'),'foreignKey':'OpenchannelAccountId'});db[_0xb317('0x55')][_0xb317('0x11c')](db['OpenchannelInteraction'],{'as':_0xb317('0x182'),'foreignKey':_0xb317('0x18e')});db['OpenchannelAccount'][_0xb317('0x11c')](db[_0xb317('0x57')],{'as':'Messages','foreignKey':_0xb317('0x18e')});db[_0xb317('0x55')][_0xb317('0x11c')](db[_0xb317('0x18f')],{'as':'Applications','foreignKey':_0xb317('0x18e'),'onDelete':_0xb317('0x118')});db[_0xb317('0x55')][_0xb317('0x15b')](db[_0xb317('0xf8')],{'as':_0xb317('0x174'),'foreignKey':_0xb317('0x17f')});db[_0xb317('0x55')][_0xb317('0x15b')](db[_0xb317('0x78')],{'as':_0xb317('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb317('0x55')]['belongsToMany'](db['User'],{'as':_0xb317('0x161'),'through':_0xb317('0x190')});db[_0xb317('0x18f')][_0xb317('0x15b')](db['User'],{'onDelete':'restrict'});db['OpenchannelApplication'][_0xb317('0x15b')](db[_0xb317('0x59')],{'onDelete':_0xb317('0x16e'),'foreignKey':_0xb317('0x191')});db[_0xb317('0x18f')]['belongsTo'](db[_0xb317('0x55')],{'onDelete':_0xb317('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0xb317('0x18f')][_0xb317('0x15b')](db[_0xb317('0x76')],{'onDelete':_0xb317('0x16e'),'foreignKey':_0xb317('0x15e')});db[_0xb317('0x18f')][_0xb317('0x15b')](db[_0xb317('0x81')],{'onDelete':'restrict','foreignKey':_0xb317('0x17e')});db[_0xb317('0x121')][_0xb317('0x11c')](db[_0xb317('0x57')],{'as':_0xb317('0x164'),'onDelete':'cascade','foreignKey':_0xb317('0x192')});db[_0xb317('0x121')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xb317('0x177'),'foreignKey':_0xb317('0x18e')});db[_0xb317('0x121')][_0xb317('0x15b')](db['CmContact'],{'as':_0xb317('0x16a'),'foreignKey':_0xb317('0x16b')});db[_0xb317('0x121')][_0xb317('0x15b')](db[_0xb317('0x14')],{'as':_0xb317('0x178'),'foreignKey':_0xb317('0x119')});db[_0xb317('0x121')][_0xb317('0x12b')](db[_0xb317('0x81')],{'through':_0xb317('0x193'),'as':'Tags'});db['OpenchannelInteraction'][_0xb317('0x12b')](db[_0xb317('0x81')],{'through':_0xb317('0x193'),'as':_0xb317('0x185')});db[_0xb317('0x121')][_0xb317('0x12b')](db[_0xb317('0x14')],{'as':_0xb317('0x18b'),'through':_0xb317('0x137'),'foreignKey':_0xb317('0x192')});db[_0xb317('0x57')][_0xb317('0x15b')](db[_0xb317('0x14')],{'onDelete':'cascade','as':_0xb317('0x14')});db[_0xb317('0x57')]['belongsTo'](db[_0xb317('0x66')],{'onDelete':_0xb317('0x118'),'as':'Contact'});db['OpenchannelMessage'][_0xb317('0x15b')](db[_0xb317('0x121')],{'onDelete':_0xb317('0x118'),'as':_0xb317('0x17b'),'foreignKey':_0xb317('0x192')});db['OpenchannelMessage']['belongsTo'](db[_0xb317('0xec')],{'as':_0xb317('0xec'),'foreignKey':'AttachmentId'});db[_0xb317('0x57')][_0xb317('0x15b')](db[_0xb317('0x55')],{'as':_0xb317('0x177'),'foreignKey':_0xb317('0x18e')});db[_0xb317('0x59')][_0xb317('0x12b')](db['User'],{'as':_0xb317('0x161'),'through':'UserOpenchannelQueue','foreignKey':_0xb317('0x191')});db[_0xb317('0x59')][_0xb317('0x12b')](db['Team'],{'through':_0xb317('0x194'),'as':'Teams'});db[_0xb317('0x140')]['hasMany'](db['Disposition'],{'as':_0xb317('0x172'),'foreignKey':_0xb317('0x17c'),'onDelete':_0xb317('0x118')});db[_0xb317('0x140')]['hasMany'](db[_0xb317('0x71')],{'as':'Answers','foreignKey':_0xb317('0x17c')});db['ChatWebsite']['hasMany'](db[_0xb317('0x63')],{'as':_0xb317('0x195')});db[_0xb317('0x140')][_0xb317('0x11c')](db[_0xb317('0x5d')],{'as':'Interactions'});db[_0xb317('0x140')][_0xb317('0x11c')](db[_0xb317('0x5c')],{'as':'Applications','foreignKey':_0xb317('0x17c'),'onDelete':_0xb317('0x118')});db[_0xb317('0x140')]['hasMany'](db[_0xb317('0x5f')],{'as':_0xb317('0x164')});db[_0xb317('0x140')][_0xb317('0x15b')](db[_0xb317('0xf8')],{'as':_0xb317('0x174'),'foreignKey':_0xb317('0x17f')});db[_0xb317('0x140')][_0xb317('0x15b')](db[_0xb317('0x76')],{'as':_0xb317('0x76'),'foreignKey':'IntervalId'});db[_0xb317('0x140')][_0xb317('0x15b')](db[_0xb317('0x144')],{'as':_0xb317('0x144'),'foreignKey':_0xb317('0x16f')});db['ChatWebsite'][_0xb317('0x15b')](db[_0xb317('0x78')],{'as':_0xb317('0x15f'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0xb317('0x12b')](db[_0xb317('0x14')],{'as':_0xb317('0x161'),'through':_0xb317('0x142')});db[_0xb317('0x196')]['belongsTo'](db[_0xb317('0x55')],{});db[_0xb317('0x196')]['belongsTo'](db[_0xb317('0xf8')],{'as':_0xb317('0x174'),'foreignKey':_0xb317('0x17f')});db[_0xb317('0x196')][_0xb317('0x15b')](db[_0xb317('0x66')],{'as':'Contact','foreignKey':'ContactId'});db[_0xb317('0x196')][_0xb317('0x15b')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0xb317('0x15b')](db['OpenchannelMessage'],{});db[_0xb317('0x196')]['belongsTo'](db[_0xb317('0x14')],{});db[_0xb317('0x196')][_0xb317('0x15b')](db[_0xb317('0x59')],{});db[_0xb317('0x5c')][_0xb317('0x15b')](db[_0xb317('0x14')],{'as':_0xb317('0x197'),'foreignKey':_0xb317('0x119'),'onDelete':_0xb317('0x16e')});db[_0xb317('0x5c')][_0xb317('0x15b')](db['ChatQueue'],{'as':_0xb317('0x198'),'foreignKey':_0xb317('0x199'),'onDelete':_0xb317('0x16e')});db[_0xb317('0x5c')][_0xb317('0x15b')](db['ChatWebsite'],{'as':_0xb317('0x19a'),'foreignKey':_0xb317('0x17c'),'onDelete':_0xb317('0x16e')});db[_0xb317('0x5c')][_0xb317('0x15b')](db[_0xb317('0x81')],{'onDelete':_0xb317('0x16e'),'foreignKey':'TagId'});db['ChatInteraction'][_0xb317('0x11c')](db[_0xb317('0x5f')],{'as':_0xb317('0x164'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x19b')});db[_0xb317('0x5d')][_0xb317('0x15b')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xb317('0x17c')});db[_0xb317('0x5d')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xb317('0x16b')});db[_0xb317('0x5d')]['belongsTo'](db[_0xb317('0x14')],{'as':_0xb317('0x178'),'foreignKey':_0xb317('0x119')});db['ChatInteraction'][_0xb317('0x12b')](db[_0xb317('0x81')],{'through':_0xb317('0x19c'),'as':'Tags'});db['ChatInteraction']['belongsToMany'](db[_0xb317('0x81')],{'through':'chat_interaction_has_tags','as':_0xb317('0x185')});db['ChatInteraction'][_0xb317('0x12b')](db[_0xb317('0x14')],{'as':_0xb317('0x18b'),'through':_0xb317('0x134'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xb317('0x15b')](db[_0xb317('0x14')],{'onDelete':'cascade','as':_0xb317('0x14')});db['ChatMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xb317('0x118'),'as':_0xb317('0x16a'),'foreignKey':_0xb317('0x16b')});db[_0xb317('0x5f')][_0xb317('0x15b')](db[_0xb317('0x5d')],{'onDelete':_0xb317('0x118'),'as':_0xb317('0x17b'),'foreignKey':_0xb317('0x19b')});db[_0xb317('0x5f')][_0xb317('0x15b')](db['Attachment'],{'as':_0xb317('0xec'),'foreignKey':_0xb317('0x187')});db['ChatMessage'][_0xb317('0x15b')](db[_0xb317('0x140')],{'as':_0xb317('0x177'),'foreignKey':_0xb317('0x17c')});db[_0xb317('0x61')][_0xb317('0x11c')](db['Attachment'],{'as':'Attachments','foreignKey':_0xb317('0x17d'),'onDelete':_0xb317('0x118'),'hooks':!![]});db[_0xb317('0x61')]['belongsTo'](db[_0xb317('0x66')],{'onDelete':'cascade','as':_0xb317('0x16a'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0xb317('0x15b')](db[_0xb317('0x140')],{'as':_0xb317('0x177'),'foreignKey':_0xb317('0x17c')});db[_0xb317('0x13c')][_0xb317('0x12b')](db['User'],{'as':_0xb317('0x161'),'through':_0xb317('0x2e'),'hooks':!![]});db[_0xb317('0x13c')][_0xb317('0x12b')](db['Team'],{'through':_0xb317('0x19d'),'as':_0xb317('0x175')});db[_0xb317('0x62')][_0xb317('0x11c')](db[_0xb317('0xcd')],{'as':_0xb317('0x164'),'foreignKey':_0xb317('0x19e'),'onDelete':'cascade'});db[_0xb317('0x62')]['belongsToMany'](db['User'],{'as':_0xb317('0x19f'),'through':_0xb317('0x1a0')});db[_0xb317('0x63')][_0xb317('0x15b')](db[_0xb317('0x140')],{'as':_0xb317('0x19a'),'foreignKey':_0xb317('0x17c')});db[_0xb317('0x65')]['hasMany'](db['CmContact'],{'as':'Contacts','foreignKey':'CompanyId'});db[_0xb317('0x66')]['hasMany'](db[_0xb317('0x85')],{'as':_0xb317('0x1a1'),'foreignKey':_0xb317('0x1a2')});db['CmContact'][_0xb317('0x11c')](db[_0xb317('0x67')],{'as':_0xb317('0x128'),'foreignKey':_0xb317('0x16b')});db[_0xb317('0x66')][_0xb317('0x11c')](db[_0xb317('0x154')],{'as':_0xb317('0x155'),'foreignKey':'ContactId'});db[_0xb317('0x66')]['hasMany'](db[_0xb317('0x6c')],{'as':_0xb317('0x156'),'foreignKey':_0xb317('0x16b')});db[_0xb317('0x66')][_0xb317('0x11c')](db['ReportAgentPreview'],{'as':_0xb317('0x120'),'foreignKey':_0xb317('0x16b')});db[_0xb317('0x66')]['hasMany'](db[_0xb317('0xd3')],{'as':_0xb317('0x158'),'foreignKey':_0xb317('0x16b')});db[_0xb317('0x66')][_0xb317('0x11c')](db['OpenchannelInteraction'],{'as':_0xb317('0x122'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xb317('0x66')]['hasMany'](db[_0xb317('0x5d')],{'as':_0xb317('0x133'),'foreignKey':_0xb317('0x16b'),'onDelete':_0xb317('0x16e')});db[_0xb317('0x66')][_0xb317('0x11c')](db['SmsInteraction'],{'as':_0xb317('0x123'),'foreignKey':_0xb317('0x16b'),'onDelete':_0xb317('0x16e')});db[_0xb317('0x66')][_0xb317('0x11c')](db[_0xb317('0x135')],{'as':_0xb317('0x124'),'foreignKey':_0xb317('0x16b'),'onDelete':_0xb317('0x16e')});db[_0xb317('0x66')][_0xb317('0x11c')](db[_0xb317('0x3b')],{'as':_0xb317('0x131'),'foreignKey':_0xb317('0x16b'),'onDelete':'restrict'});db['CmContact'][_0xb317('0x15b')](db['CmCompany'],{'as':_0xb317('0x1a3'),'foreignKey':_0xb317('0x1a4')});db[_0xb317('0x66')][_0xb317('0x15b')](db[_0xb317('0xf8')],{'as':_0xb317('0x174'),'foreignKey':_0xb317('0x17f'),'onDelete':_0xb317('0x118')});db[_0xb317('0x66')][_0xb317('0x12b')](db[_0xb317('0x14')],{'as':_0xb317('0x18b'),'through':_0xb317('0x12d')});db['CmContact']['belongsToMany'](db[_0xb317('0x81')],{'as':_0xb317('0x179'),'through':_0xb317('0x1a5')});db[_0xb317('0x66')][_0xb317('0x12b')](db[_0xb317('0x81')],{'through':_0xb317('0x1a5'),'as':_0xb317('0x185')});db[_0xb317('0x67')]['hasMany'](db[_0xb317('0x1a6')],{'as':_0xb317('0x1a7'),'foreignKey':_0xb317('0x1a8')});db[_0xb317('0x67')]['belongsTo'](db['CmContact'],{'as':_0xb317('0x16a'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0xb317('0x67')][_0xb317('0x15b')](db['CmList'],{'as':_0xb317('0x174'),'foreignKey':_0xb317('0x17f'),'onDelete':_0xb317('0x118')});db[_0xb317('0x67')][_0xb317('0x15b')](db[_0xb317('0x14')],{'as':_0xb317('0x197'),'foreignKey':'UserId'});db[_0xb317('0x67')][_0xb317('0x15b')](db[_0xb317('0x19')],{'as':_0xb317('0x198'),'foreignKey':_0xb317('0x153'),'onDelete':_0xb317('0x118')});db[_0xb317('0x67')]['belongsTo'](db['Campaign'],{'as':_0xb317('0xe9'),'foreignKey':_0xb317('0x1a9'),'onDelete':_0xb317('0x118')});db['CmHopper'][_0xb317('0x15b')](db[_0xb317('0x14')],{'as':_0xb317('0x178'),'foreignKey':'OwnerId'});db[_0xb317('0x69')][_0xb317('0x15b')](db[_0xb317('0x66')],{'as':'Contact','foreignKey':_0xb317('0x16b'),'onDelete':_0xb317('0x118')});db[_0xb317('0x69')][_0xb317('0x15b')](db['CmList'],{'as':_0xb317('0x174'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xb317('0x69')][_0xb317('0x15b')](db[_0xb317('0x19')],{'as':_0xb317('0x198'),'foreignKey':_0xb317('0x153'),'onDelete':'cascade'});db[_0xb317('0x69')][_0xb317('0x15b')](db[_0xb317('0xe9')],{'as':_0xb317('0xe9'),'foreignKey':_0xb317('0x1a9'),'onDelete':_0xb317('0x118')});db['Automation']['hasMany'](db[_0xb317('0x1aa')],{'as':{'plural':_0xb317('0x1ab'),'singular':_0xb317('0x1ac')},'foreignKey':_0xb317('0x1ad'),'onDelete':'cascade','hooks':!![]});db['Automation']['hasMany'](db[_0xb317('0x1aa')],{'as':{'plural':_0xb317('0x1ae'),'singular':_0xb317('0x1af')},'foreignKey':_0xb317('0x1b0'),'onDelete':_0xb317('0x118'),'hooks':!![]});db[_0xb317('0x70')][_0xb317('0x11c')](db[_0xb317('0x1b1')],{'as':_0xb317('0x1b2'),'foreignKey':_0xb317('0x1b3'),'onDelete':_0xb317('0x118'),'hooks':!![]});db[_0xb317('0x73')]['hasMany'](db[_0xb317('0x73')],{'as':_0xb317('0x172'),'foreignKey':_0xb317('0x1b4'),'onDelete':_0xb317('0x118')});db[_0xb317('0x76')][_0xb317('0x11c')](db[_0xb317('0x76')],{'as':_0xb317('0x1b5'),'foreignKey':'IntervalId','onDelete':_0xb317('0x118'),'hooks':!![],'required':![]});db[_0xb317('0x76')][_0xb317('0x11c')](db[_0xb317('0x17')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':'restrict'});db[_0xb317('0x76')][_0xb317('0x11c')](db[_0xb317('0x3e')],{'as':_0xb317('0x1b6'),'foreignKey':_0xb317('0x15e')});db[_0xb317('0x76')]['hasMany'](db[_0xb317('0x5c')],{'as':'ChatApplications','foreignKey':_0xb317('0x15e')});db['Interval'][_0xb317('0x11c')](db[_0xb317('0x183')],{'as':_0xb317('0x1b7'),'foreignKey':_0xb317('0x15e')});db[_0xb317('0x76')][_0xb317('0x11c')](db[_0xb317('0x189')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0xb317('0x7e')][_0xb317('0x15b')](db['MailAccount'],{});db[_0xb317('0x7e')]['belongsTo'](db[_0xb317('0x90')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0xb317('0x15b')](db[_0xb317('0x8e')],{'foreignKey':_0xb317('0x1b8')});db[_0xb317('0x80')][_0xb317('0x12b')](db[_0xb317('0x1b9')],{'as':_0xb317('0x1ba'),'through':_0xb317('0x152'),'onDelete':_0xb317('0x16e')});db[_0xb317('0x81')][_0xb317('0x12b')](db['CmContact'],{'through':_0xb317('0x1a5')});db['Tag']['belongsToMany'](db[_0xb317('0x5d')],{'through':_0xb317('0x19c')});db[_0xb317('0x81')]['belongsToMany'](db[_0xb317('0x3b')],{'through':_0xb317('0x1bb')});db[_0xb317('0x81')][_0xb317('0x12b')](db[_0xb317('0x4f')],{'through':'sms_interaction_has_tags'});db[_0xb317('0x81')][_0xb317('0x12b')](db[_0xb317('0x135')],{'through':'fax_interaction_has_tags'});db['Tag'][_0xb317('0x12b')](db[_0xb317('0x121')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0xb317('0x12b')](db[_0xb317('0x103')],{'through':_0xb317('0x1bc')});db['CmContactHasItem'][_0xb317('0x15b')](db[_0xb317('0x83')],{'as':_0xb317('0x1bd'),'foreignKey':_0xb317('0x1be')});db['CmHopperAdditionalPhone'][_0xb317('0x15b')](db[_0xb317('0x67')],{'as':_0xb317('0x1bf'),'foreignKey':_0xb317('0x1a8')});db['CmContactHasItem'][_0xb317('0x15b')](db['CmContact'],{'as':_0xb317('0x16a'),'foreignKey':_0xb317('0x1a2')});db[_0xb317('0x1c0')]['hasMany'](db[_0xb317('0x1aa')],{'as':{'plural':'AllConditions','singular':_0xb317('0x1c1')},'foreignKey':_0xb317('0x1c2'),'onDelete':'cascade','hooks':!![]});db[_0xb317('0x1c0')][_0xb317('0x11c')](db[_0xb317('0x1aa')],{'as':{'plural':_0xb317('0x1c3'),'singular':_0xb317('0x1c4')},'foreignKey':_0xb317('0x1c5'),'onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0xb317('0x1b1')],{'as':_0xb317('0x1b2'),'foreignKey':'TriggerId','onDelete':_0xb317('0x118'),'hooks':!![]});db[_0xb317('0x8e')][_0xb317('0x11c')](db[_0xb317('0x96')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xb317('0x1b8'),'hooks':!![]});db[_0xb317('0x90')][_0xb317('0x11c')](db[_0xb317('0x96')],{'as':_0xb317('0x1c6'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db['AnalyticMetric']['hasMany'](db[_0xb317('0x96')],{'as':_0xb317('0x1c6'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1c7')});db[_0xb317('0x96')][_0xb317('0x15b')](db[_0xb317('0x94')],{'foreignKey':'MetricId'});db[_0xb317('0x99')][_0xb317('0x11c')](db[_0xb317('0x9b')],{'as':_0xb317('0x1c8'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1c9')});db[_0xb317('0x9b')][_0xb317('0x11c')](db[_0xb317('0x1ca')],{'as':'Subjects','onDelete':_0xb317('0x118'),'foreignKey':'SubjectId'});db[_0xb317('0x9b')][_0xb317('0x11c')](db['SalesforceField'],{'as':_0xb317('0x1cb'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1cc')});db[_0xb317('0x9b')][_0xb317('0x11c')](db['SalesforceField'],{'as':_0xb317('0x1c6'),'onDelete':'cascade','foreignKey':_0xb317('0x1cd')});db[_0xb317('0x9b')][_0xb317('0x15b')](db[_0xb317('0x99')],{'as':_0xb317('0x177'),'foreignKey':'AccountId'});db[_0xb317('0x1ca')][_0xb317('0x11c')](db[_0xb317('0x1ca')],{'as':_0xb317('0x1ce'),'foreignKey':_0xb317('0x1cf')});db[_0xb317('0x1ca')][_0xb317('0x11c')](db[_0xb317('0x1ca')],{'as':'Description','foreignKey':_0xb317('0x1cc')});db['SalesforceField'][_0xb317('0x11c')](db[_0xb317('0x1ca')],{'as':_0xb317('0x1d0'),'foreignKey':_0xb317('0x1cd')});db[_0xb317('0x1ca')][_0xb317('0x15b')](db[_0xb317('0x8a')],{'as':_0xb317('0x8a'),'foreignKey':_0xb317('0x1d1')});db[_0xb317('0x1d2')][_0xb317('0x11c')](db[_0xb317('0x9f')],{'as':_0xb317('0x1c8'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xb317('0x9f')][_0xb317('0x11c')](db[_0xb317('0xa1')],{'as':'Subjects','onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1cf')});db[_0xb317('0x9f')][_0xb317('0x11c')](db[_0xb317('0xa1')],{'as':_0xb317('0x1cb'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1cc')});db['SugarcrmConfiguration'][_0xb317('0x11c')](db[_0xb317('0xa1')],{'as':_0xb317('0x1c6'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1cd')});db[_0xb317('0x9f')]['belongsTo'](db[_0xb317('0x1d2')],{'as':_0xb317('0x177'),'foreignKey':'AccountId'});db[_0xb317('0xa1')][_0xb317('0x11c')](db[_0xb317('0xa1')],{'as':'Subject','foreignKey':_0xb317('0x1cf')});db[_0xb317('0xa1')]['hasMany'](db[_0xb317('0xa1')],{'as':_0xb317('0x1d3'),'foreignKey':_0xb317('0x1cc')});db[_0xb317('0xa1')][_0xb317('0x11c')](db['SugarcrmField'],{'as':_0xb317('0x1d0'),'foreignKey':_0xb317('0x1cd')});db[_0xb317('0xa1')][_0xb317('0x15b')](db['Variable'],{'as':_0xb317('0x8a'),'foreignKey':'VariableId'});db[_0xb317('0xa3')]['hasMany'](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0xb317('0x118'),'foreignKey':'AccountId'});db[_0xb317('0xa5')]['hasMany'](db['DeskField'],{'as':_0xb317('0x1d4'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1cf')});db[_0xb317('0xa5')]['hasMany'](db[_0xb317('0xa6')],{'as':'Descriptions','onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1cc')});db['DeskConfiguration'][_0xb317('0x11c')](db[_0xb317('0xa6')],{'as':_0xb317('0x1c6'),'onDelete':_0xb317('0x118'),'foreignKey':'FieldId'});db[_0xb317('0xa5')][_0xb317('0x15b')](db[_0xb317('0xa3')],{'as':'Account','foreignKey':_0xb317('0x1c9')});db['DeskConfiguration']['belongsToMany'](db[_0xb317('0x81')],{'through':_0xb317('0x1d5')});db[_0xb317('0xa6')][_0xb317('0x11c')](db[_0xb317('0xa6')],{'as':_0xb317('0x1ce'),'foreignKey':_0xb317('0x1cf')});db[_0xb317('0xa6')][_0xb317('0x11c')](db['DeskField'],{'as':'Description','foreignKey':_0xb317('0x1cc')});db[_0xb317('0xa6')][_0xb317('0x11c')](db['DeskField'],{'as':_0xb317('0x1d0'),'foreignKey':_0xb317('0x1cd')});db[_0xb317('0xa6')][_0xb317('0x15b')](db[_0xb317('0x8a')],{'as':_0xb317('0x8a'),'foreignKey':_0xb317('0x1d1')});db[_0xb317('0xa8')][_0xb317('0x11c')](db[_0xb317('0xaa')],{'as':_0xb317('0x1c8'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xb317('0xaa')][_0xb317('0x11c')](db['ZohoField'],{'as':_0xb317('0x1d4'),'onDelete':_0xb317('0x118'),'foreignKey':'SubjectId'});db[_0xb317('0xaa')]['hasMany'](db[_0xb317('0xac')],{'as':_0xb317('0x1cb'),'onDelete':'cascade','foreignKey':_0xb317('0x1cc')});db[_0xb317('0xaa')][_0xb317('0x11c')](db[_0xb317('0xac')],{'as':_0xb317('0x1c6'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1cd')});db[_0xb317('0xaa')][_0xb317('0x15b')](db['ZohoAccount'],{'as':_0xb317('0x177'),'foreignKey':_0xb317('0x1c9')});db[_0xb317('0xac')][_0xb317('0x11c')](db[_0xb317('0xac')],{'as':_0xb317('0x1ce'),'foreignKey':_0xb317('0x1cf')});db[_0xb317('0xac')][_0xb317('0x11c')](db[_0xb317('0xac')],{'as':'Description','foreignKey':_0xb317('0x1cc')});db[_0xb317('0xac')]['hasMany'](db['ZohoField'],{'as':_0xb317('0x1d0'),'foreignKey':_0xb317('0x1cd')});db[_0xb317('0xac')][_0xb317('0x15b')](db[_0xb317('0x8a')],{'as':'Variable','foreignKey':_0xb317('0x1d1')});db[_0xb317('0xae')][_0xb317('0x11c')](db[_0xb317('0xaf')],{'as':'Configurations','onDelete':_0xb317('0x118'),'foreignKey':'AccountId'});db[_0xb317('0xaf')][_0xb317('0x11c')](db['ZendeskField'],{'as':_0xb317('0x1d4'),'foreignKey':_0xb317('0x1cf')});db[_0xb317('0xaf')][_0xb317('0x11c')](db[_0xb317('0xb0')],{'as':_0xb317('0x1cb'),'foreignKey':_0xb317('0x1cc')});db['ZendeskConfiguration'][_0xb317('0x11c')](db['ZendeskField'],{'as':_0xb317('0x1c6'),'foreignKey':_0xb317('0x1cd')});db['ZendeskConfiguration']['belongsTo'](db[_0xb317('0xae')],{'as':_0xb317('0x177'),'foreignKey':_0xb317('0x1c9')});db[_0xb317('0xaf')][_0xb317('0x12b')](db[_0xb317('0x81')],{'through':_0xb317('0x1d6')});db[_0xb317('0xb0')][_0xb317('0x11c')](db[_0xb317('0xb0')],{'as':'Subject','foreignKey':_0xb317('0x1cf')});db['ZendeskField'][_0xb317('0x11c')](db[_0xb317('0xb0')],{'as':_0xb317('0x1d3'),'foreignKey':_0xb317('0x1cc')});db[_0xb317('0xb0')][_0xb317('0x11c')](db[_0xb317('0xb0')],{'as':_0xb317('0x1d0'),'foreignKey':'FieldId'});db[_0xb317('0xb0')][_0xb317('0x15b')](db['Variable'],{'as':_0xb317('0x8a'),'foreignKey':_0xb317('0x1d1')});db[_0xb317('0x1d7')][_0xb317('0x11c')](db['FreshdeskConfiguration'],{'as':_0xb317('0x1c8'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1c9')});db[_0xb317('0xb2')][_0xb317('0x11c')](db[_0xb317('0xb4')],{'as':_0xb317('0x1d4'),'onDelete':_0xb317('0x118'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0xb317('0x11c')](db[_0xb317('0xb4')],{'as':_0xb317('0x1cb'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xb317('0xb2')][_0xb317('0x11c')](db[_0xb317('0xb4')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xb317('0x1cd')});db[_0xb317('0xb2')][_0xb317('0x15b')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0xb317('0x1c9')});db[_0xb317('0xb2')][_0xb317('0x12b')](db[_0xb317('0x81')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0xb317('0x11c')](db[_0xb317('0xb4')],{'as':_0xb317('0x1ce'),'foreignKey':_0xb317('0x1cf')});db[_0xb317('0xb4')]['hasMany'](db[_0xb317('0xb4')],{'as':_0xb317('0x1d3'),'foreignKey':_0xb317('0x1cc')});db[_0xb317('0xb4')]['hasMany'](db['FreshdeskField'],{'as':_0xb317('0x1d0'),'foreignKey':'FieldId'});db[_0xb317('0xb4')]['belongsTo'](db['Variable'],{'as':_0xb317('0x8a'),'foreignKey':_0xb317('0x1d1')});db['VtigerAccount'][_0xb317('0x11c')](db['VtigerConfiguration'],{'as':_0xb317('0x1c8'),'onDelete':'cascade','foreignKey':_0xb317('0x1c9')});db[_0xb317('0xb8')][_0xb317('0x11c')](db[_0xb317('0xba')],{'as':_0xb317('0x1d4'),'foreignKey':_0xb317('0x1cf')});db[_0xb317('0xb8')][_0xb317('0x11c')](db[_0xb317('0xba')],{'as':_0xb317('0x1cb'),'foreignKey':'DescriptionId'});db[_0xb317('0xb8')][_0xb317('0x11c')](db['VtigerField'],{'as':_0xb317('0x1c6'),'foreignKey':_0xb317('0x1cd')});db[_0xb317('0xb8')]['belongsTo'](db['VtigerAccount'],{'as':_0xb317('0x177'),'foreignKey':'AccountId'});db[_0xb317('0xba')][_0xb317('0x11c')](db[_0xb317('0xba')],{'as':_0xb317('0x1ce'),'foreignKey':'SubjectId'});db[_0xb317('0xba')]['hasMany'](db[_0xb317('0xba')],{'as':'Description','foreignKey':'DescriptionId'});db['VtigerField']['hasMany'](db[_0xb317('0xba')],{'as':'Field','foreignKey':_0xb317('0x1cd')});db[_0xb317('0xba')][_0xb317('0x15b')](db['Variable'],{'as':_0xb317('0x8a'),'foreignKey':'VariableId'});db[_0xb317('0x1d8')][_0xb317('0x11c')](db[_0xb317('0xbc')],{'as':_0xb317('0x1c8'),'onDelete':_0xb317('0x118'),'foreignKey':'AccountId'});db[_0xb317('0xbc')][_0xb317('0x11c')](db[_0xb317('0xbe')],{'as':_0xb317('0x1d4'),'foreignKey':_0xb317('0x1cf')});db[_0xb317('0xbc')][_0xb317('0x11c')](db[_0xb317('0xbe')],{'as':'Descriptions','foreignKey':_0xb317('0x1cc')});db[_0xb317('0xbc')]['hasMany'](db[_0xb317('0xbe')],{'as':_0xb317('0x1c6'),'foreignKey':_0xb317('0x1cd')});db[_0xb317('0xbc')][_0xb317('0x15b')](db[_0xb317('0x1d8')],{'as':_0xb317('0x177'),'foreignKey':_0xb317('0x1c9')});db[_0xb317('0xbe')]['hasMany'](db[_0xb317('0xbe')],{'as':_0xb317('0x1ce'),'foreignKey':_0xb317('0x1cf')});db[_0xb317('0xbe')]['hasMany'](db['ServicenowField'],{'as':'Description','foreignKey':_0xb317('0x1cc')});db[_0xb317('0xbe')][_0xb317('0x11c')](db[_0xb317('0xbe')],{'as':_0xb317('0x1d0'),'foreignKey':_0xb317('0x1cd')});db['ServicenowField']['belongsTo'](db['Variable'],{'as':_0xb317('0x8a'),'foreignKey':_0xb317('0x1d1')});db[_0xb317('0xbf')]['hasMany'](db[_0xb317('0xc1')],{'as':_0xb317('0x1c8'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1c9')});db[_0xb317('0xbf')][_0xb317('0x15b')](db['CloudProvider'],{'as':_0xb317('0x16c'),'foreignKey':_0xb317('0x16d')});db[_0xb317('0xc1')]['hasMany'](db[_0xb317('0xc3')],{'as':'Subjects','onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1cf')});db['Dynamics365Configuration'][_0xb317('0x11c')](db[_0xb317('0xc3')],{'as':_0xb317('0x1cb'),'onDelete':'cascade','foreignKey':_0xb317('0x1cc')});db['Dynamics365Configuration'][_0xb317('0x11c')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1cd')});db['Dynamics365Configuration'][_0xb317('0x15b')](db[_0xb317('0xbf')],{'as':_0xb317('0x177'),'foreignKey':_0xb317('0x1c9')});db[_0xb317('0xc3')]['hasMany'](db[_0xb317('0xc3')],{'as':_0xb317('0x1ce'),'foreignKey':'SubjectId'});db[_0xb317('0xc3')][_0xb317('0x11c')](db['Dynamics365Field'],{'as':_0xb317('0x1d3'),'foreignKey':_0xb317('0x1cc')});db[_0xb317('0xc3')]['hasMany'](db[_0xb317('0xc3')],{'as':'Field','foreignKey':_0xb317('0x1cd')});db['Dynamics365Field']['belongsTo'](db[_0xb317('0x8a')],{'as':_0xb317('0x8a'),'foreignKey':_0xb317('0x1d1')});db[_0xb317('0xc5')]['hasMany'](db[_0xb317('0xc7')],{'as':_0xb317('0x1c8'),'onDelete':_0xb317('0x118'),'foreignKey':'AccountId'});db[_0xb317('0xc7')]['hasMany'](db[_0xb317('0xc8')],{'as':_0xb317('0x1d4'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0xb317('0x11c')](db[_0xb317('0xc8')],{'as':_0xb317('0x1cb'),'foreignKey':_0xb317('0x1cc')});db[_0xb317('0xc7')][_0xb317('0x11c')](db[_0xb317('0xc8')],{'as':'Fields','foreignKey':_0xb317('0x1cd')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0xb317('0x177'),'foreignKey':_0xb317('0x1c9')});db['FreshsalesField'][_0xb317('0x11c')](db[_0xb317('0xc8')],{'as':'Subject','foreignKey':'SubjectId'});db['FreshsalesField'][_0xb317('0x11c')](db['FreshsalesField'],{'as':_0xb317('0x1d3'),'foreignKey':_0xb317('0x1cc')});db['FreshsalesField'][_0xb317('0x11c')](db[_0xb317('0xc8')],{'as':_0xb317('0x1d0'),'foreignKey':'FieldId'});db['FreshsalesField']['belongsTo'](db[_0xb317('0x8a')],{'as':'Variable','foreignKey':_0xb317('0x1d1')});db['ChatQueueReport'][_0xb317('0x15b')](db[_0xb317('0x140')],{});db['ChatQueueReport'][_0xb317('0x15b')](db[_0xb317('0xf8')],{'as':_0xb317('0x174'),'foreignKey':_0xb317('0x17f')});db[_0xb317('0xcc')][_0xb317('0x15b')](db[_0xb317('0x66')],{'as':'Contact','foreignKey':_0xb317('0x16b')});db[_0xb317('0xcc')][_0xb317('0x15b')](db[_0xb317('0x5d')],{});db['ChatQueueReport']['belongsTo'](db[_0xb317('0x5f')],{});db[_0xb317('0xcc')][_0xb317('0x15b')](db['User'],{});db[_0xb317('0xcc')][_0xb317('0x15b')](db[_0xb317('0x13c')],{});db[_0xb317('0xcd')][_0xb317('0x15b')](db[_0xb317('0x14')],{'onDelete':'cascade','foreignKey':_0xb317('0x1d9')});db['ChatInternalMessage'][_0xb317('0x15b')](db[_0xb317('0x14')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0xb317('0xd3')][_0xb317('0x11c')](db[_0xb317('0xd1')],{'foreignKey':'SessionId','onDelete':_0xb317('0x118')});db[_0xb317('0xd3')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0xb317('0x118')});db[_0xb317('0xd4')]['belongsTo'](db['SmsAccount'],{});db[_0xb317('0xd4')][_0xb317('0x15b')](db[_0xb317('0xf8')],{'as':'List','foreignKey':_0xb317('0x17f')});db['SmsQueueReport'][_0xb317('0x15b')](db[_0xb317('0x66')],{'as':_0xb317('0x16a'),'foreignKey':_0xb317('0x16b')});db[_0xb317('0xd4')][_0xb317('0x15b')](db[_0xb317('0x4f')],{});db[_0xb317('0xd4')][_0xb317('0x15b')](db[_0xb317('0x51')],{});db[_0xb317('0xd4')][_0xb317('0x15b')](db['User'],{});db[_0xb317('0xd4')]['belongsTo'](db[_0xb317('0x53')],{});db[_0xb317('0xda')]['hasMany'](db[_0xb317('0xd3')],{'foreignKey':_0xb317('0x1da')});db[_0xb317('0xda')]['hasMany'](db[_0xb317('0xd1')],{'foreignKey':'ProjectId'});db[_0xb317('0xda')][_0xb317('0x11c')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0xb317('0xe5')][_0xb317('0x12b')](db[_0xb317('0x14')],{'as':_0xb317('0x161'),'through':_0xb317('0x130')});db['Team']['belongsToMany'](db[_0xb317('0x19')],{'through':'TeamVoiceQueue','as':_0xb317('0x139')});db[_0xb317('0xe5')]['belongsToMany'](db[_0xb317('0x38')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0xb317('0xe5')]['belongsToMany'](db[_0xb317('0x13c')],{'through':_0xb317('0x19d'),'as':'ChatQueues'});db[_0xb317('0xe5')][_0xb317('0x12b')](db[_0xb317('0x49')],{'through':'team_has_fax_queues','as':_0xb317('0x13d')});db[_0xb317('0xe5')][_0xb317('0x12b')](db[_0xb317('0x53')],{'through':_0xb317('0x1db'),'as':'SmsQueues'});db['Team'][_0xb317('0x12b')](db[_0xb317('0x59')],{'through':'team_has_openchannel_queues','as':_0xb317('0x1dc')});db[_0xb317('0xe5')][_0xb317('0x12b')](db[_0xb317('0x10a')],{'through':'team_has_whatsapp_queues','as':_0xb317('0x13e')});db['Team']['belongsToMany'](db[_0xb317('0xfa')],{'through':_0xb317('0x10f'),'as':_0xb317('0x13a')});db[_0xb317('0xe9')][_0xb317('0x11c')](db[_0xb317('0x67')],{'as':_0xb317('0x128'),'foreignKey':_0xb317('0x1a9')});db['Campaign']['hasMany'](db[_0xb317('0x154')],{'as':_0xb317('0x155'),'foreignKey':_0xb317('0x1a9')});db[_0xb317('0xe9')][_0xb317('0x11c')](db['CmHopperHistory'],{'as':_0xb317('0x156'),'foreignKey':_0xb317('0x1a9')});db[_0xb317('0xe9')][_0xb317('0x11c')](db[_0xb317('0x69')],{'as':'HopperBlacks','foreignKey':_0xb317('0x1a9')});db[_0xb317('0xe9')][_0xb317('0x15b')](db['Trunk'],{'as':_0xb317('0x159'),'foreignKey':_0xb317('0x15a')});db['Campaign'][_0xb317('0x15b')](db[_0xb317('0x159')],{'as':_0xb317('0x15c'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0xb317('0x15b')](db[_0xb317('0x76')],{'as':_0xb317('0x76'),'foreignKey':'IntervalId'});db[_0xb317('0xe9')][_0xb317('0x15b')](db['SquareProject'],{'as':_0xb317('0xdf'),'foreignKey':_0xb317('0x1dd')});db[_0xb317('0xe9')][_0xb317('0x12b')](db[_0xb317('0xf8')],{'as':_0xb317('0x12e'),'through':_0xb317('0x1de')});db[_0xb317('0xe9')][_0xb317('0x12b')](db[_0xb317('0xf8')],{'as':_0xb317('0x162'),'through':_0xb317('0x1df')});db['Attachment'][_0xb317('0x15b')](db[_0xb317('0x61')],{'as':'ChatOfflineMessage','foreignKey':_0xb317('0x17d')});db[_0xb317('0xf0')][_0xb317('0x15b')](db['MailMessage'],{});db[_0xb317('0xf0')]['belongsTo'](db[_0xb317('0x3b')],{});db['MailTransferReport'][_0xb317('0x15b')](db['MailAccount'],{'foreignKey':_0xb317('0x1e0'),'as':_0xb317('0x1e1')});db[_0xb317('0xf0')][_0xb317('0x15b')](db[_0xb317('0x14')],{'foreignKey':_0xb317('0x1e2'),'as':_0xb317('0x1e3')});db[_0xb317('0xf0')][_0xb317('0x15b')](db[_0xb317('0x14')],{'foreignKey':_0xb317('0x1e4'),'as':'ToAgent'});db[_0xb317('0xf0')][_0xb317('0x15b')](db[_0xb317('0x38')],{'foreignKey':_0xb317('0x1e5'),'as':_0xb317('0x1e6')});db['MailTransferReport'][_0xb317('0x15b')](db[_0xb317('0x144')],{'foreignKey':_0xb317('0x1e7'),'as':_0xb317('0x1e8')});db[_0xb317('0xf2')][_0xb317('0x15b')](db[_0xb317('0x5f')],{});db[_0xb317('0xf2')]['belongsTo'](db[_0xb317('0x5d')],{});db[_0xb317('0xf2')][_0xb317('0x15b')](db[_0xb317('0x140')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db['ChatTransferReport'][_0xb317('0x15b')](db[_0xb317('0x14')],{'foreignKey':'FromUserId','as':_0xb317('0x1e3')});db[_0xb317('0xf2')][_0xb317('0x15b')](db[_0xb317('0x14')],{'foreignKey':_0xb317('0x1e4'),'as':_0xb317('0x1e9')});db[_0xb317('0xf2')][_0xb317('0x15b')](db['ChatQueue'],{'foreignKey':_0xb317('0x1ea'),'as':_0xb317('0x1e6')});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0xb317('0xf3')][_0xb317('0x15b')](db[_0xb317('0x47')],{});db[_0xb317('0xf3')]['belongsTo'](db[_0xb317('0x135')],{});db[_0xb317('0xf3')][_0xb317('0x15b')](db[_0xb317('0x45')],{'foreignKey':_0xb317('0x1eb'),'as':_0xb317('0x1e1')});db['FaxTransferReport'][_0xb317('0x15b')](db[_0xb317('0x14')],{'foreignKey':_0xb317('0x1e2'),'as':_0xb317('0x1e3')});db['FaxTransferReport'][_0xb317('0x15b')](db[_0xb317('0x14')],{'foreignKey':_0xb317('0x1e4'),'as':_0xb317('0x1e9')});db[_0xb317('0xf3')][_0xb317('0x15b')](db[_0xb317('0x49')],{'foreignKey':_0xb317('0x1ec'),'as':_0xb317('0x1e6')});db['FaxTransferReport'][_0xb317('0x15b')](db[_0xb317('0x45')],{'foreignKey':_0xb317('0x1ed'),'as':_0xb317('0x1e8')});db[_0xb317('0xf4')][_0xb317('0x15b')](db['OpenchannelMessage'],{});db[_0xb317('0xf4')][_0xb317('0x15b')](db[_0xb317('0x121')],{});db[_0xb317('0xf4')][_0xb317('0x15b')](db[_0xb317('0x55')],{'foreignKey':_0xb317('0x1ee'),'as':_0xb317('0x1e1')});db[_0xb317('0xf4')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xb317('0xf4')][_0xb317('0x15b')](db[_0xb317('0x14')],{'foreignKey':_0xb317('0x1e4'),'as':'ToAgent'});db[_0xb317('0xf4')][_0xb317('0x15b')](db[_0xb317('0x59')],{'foreignKey':_0xb317('0x1ef'),'as':_0xb317('0x1e6')});db[_0xb317('0xf4')][_0xb317('0x15b')](db[_0xb317('0x55')],{'foreignKey':_0xb317('0x1f0'),'as':_0xb317('0x1e8')});db[_0xb317('0xf6')][_0xb317('0x15b')](db['SmsMessage'],{});db[_0xb317('0xf6')][_0xb317('0x15b')](db[_0xb317('0x4f')],{});db['SmsTransferReport'][_0xb317('0x15b')](db[_0xb317('0x147')],{'foreignKey':_0xb317('0x1f1'),'as':_0xb317('0x1e1')});db['SmsTransferReport'][_0xb317('0x15b')](db['User'],{'foreignKey':_0xb317('0x1e2'),'as':_0xb317('0x1e3')});db[_0xb317('0xf6')][_0xb317('0x15b')](db['User'],{'foreignKey':_0xb317('0x1e4'),'as':_0xb317('0x1e9')});db[_0xb317('0xf6')][_0xb317('0x15b')](db[_0xb317('0x53')],{'foreignKey':_0xb317('0x1f2'),'as':'ToQueue'});db[_0xb317('0xf6')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xb317('0x1f3'),'as':'ToAccount'});db[_0xb317('0xf8')][_0xb317('0x11c')](db['Disposition'],{'as':_0xb317('0x172'),'foreignKey':_0xb317('0x17f'),'onDelete':_0xb317('0x118')});db['CmList'][_0xb317('0x11c')](db[_0xb317('0x1f4')],{'as':_0xb317('0x1f5'),'foreignKey':'ListId'});db[_0xb317('0xf8')]['hasMany'](db[_0xb317('0x66')],{'as':_0xb317('0x12c'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x17f')});db[_0xb317('0xf8')][_0xb317('0x11c')](db[_0xb317('0x154')],{'as':_0xb317('0x155'),'foreignKey':'ListId'});db[_0xb317('0xf8')]['hasMany'](db[_0xb317('0x6c')],{'as':_0xb317('0x11f'),'foreignKey':'ListId'});db[_0xb317('0xf8')]['hasMany'](db[_0xb317('0x120')],{'as':'ReportAgentPreview','foreignKey':_0xb317('0x17f')});db[_0xb317('0xf8')]['belongsToMany'](db['VoiceQueue'],{'as':_0xb317('0x1f6'),'through':_0xb317('0x160')});db[_0xb317('0xf8')][_0xb317('0x12b')](db[_0xb317('0x14')],{'as':_0xb317('0x161'),'through':_0xb317('0x12f')});db[_0xb317('0xfa')][_0xb317('0x11c')](db[_0xb317('0x17')],{'as':_0xb317('0x1f7'),'onDelete':_0xb317('0x118')});db[_0xb317('0xfa')][_0xb317('0x12b')](db[_0xb317('0x14')],{'as':_0xb317('0x161'),'through':_0xb317('0x111')});db[_0xb317('0xfa')][_0xb317('0x12b')](db[_0xb317('0xe5')],{'through':_0xb317('0x10f'),'as':_0xb317('0x175')});db[_0xb317('0xfc')][_0xb317('0x11c')](db['User'],{'as':_0xb317('0x18b'),'foreignKey':_0xb317('0x12a')});db[_0xb317('0xfc')][_0xb317('0x11c')](db[_0xb317('0x1f8')],{'as':_0xb317('0x1f9'),'foreignKey':_0xb317('0x12a'),'onDelete':_0xb317('0x118')});db[_0xb317('0x1f8')]['hasMany'](db[_0xb317('0xfe')],{'as':_0xb317('0x1fa'),'foreignKey':'sectionId','onDelete':_0xb317('0x118')});db['WhatsappAccount'][_0xb317('0x11c')](db[_0xb317('0x73')],{'as':'Dispositions','foreignKey':_0xb317('0x1fb'),'onDelete':_0xb317('0x118')});db[_0xb317('0x14a')][_0xb317('0x11c')](db[_0xb317('0x71')],{'as':_0xb317('0x173'),'foreignKey':_0xb317('0x1fb')});db['WhatsappAccount'][_0xb317('0x11c')](db[_0xb317('0x105')],{'as':_0xb317('0x164'),'foreignKey':'WhatsappAccountId'});db[_0xb317('0x14a')][_0xb317('0x11c')](db[_0xb317('0x103')],{'as':'Interactions'});db[_0xb317('0x14a')]['hasMany'](db[_0xb317('0x1fc')],{'as':_0xb317('0x150'),'foreignKey':_0xb317('0x1fb'),'onDelete':_0xb317('0x118')});db[_0xb317('0x14a')][_0xb317('0x15b')](db['CmList'],{'as':'List','foreignKey':_0xb317('0x17f')});db['WhatsappAccount'][_0xb317('0x15b')](db['Pause'],{'as':_0xb317('0x15f'),'foreignKey':_0xb317('0x18a')});db['WhatsappAccount'][_0xb317('0x12b')](db[_0xb317('0x14')],{'as':'Agents','through':_0xb317('0x14c')});db[_0xb317('0x1fc')][_0xb317('0x15b')](db[_0xb317('0x14')],{'onDelete':_0xb317('0x16e')});db[_0xb317('0x1fc')][_0xb317('0x15b')](db[_0xb317('0x10a')],{'onDelete':_0xb317('0x16e')});db[_0xb317('0x1fc')]['belongsTo'](db[_0xb317('0x14a')],{'onDelete':_0xb317('0x16e')});db['WhatsappApplication'][_0xb317('0x15b')](db[_0xb317('0x76')],{'onDelete':_0xb317('0x16e'),'foreignKey':_0xb317('0x15e')});db[_0xb317('0x1fc')][_0xb317('0x15b')](db[_0xb317('0x81')],{'onDelete':'restrict','foreignKey':_0xb317('0x17e')});db['WhatsappInteraction']['hasMany'](db['WhatsappMessage'],{'as':_0xb317('0x164'),'onDelete':_0xb317('0x118'),'foreignKey':_0xb317('0x1fd')});db['WhatsappInteraction'][_0xb317('0x15b')](db[_0xb317('0x14a')],{'as':_0xb317('0x177'),'foreignKey':'WhatsappAccountId'});db[_0xb317('0x103')][_0xb317('0x15b')](db[_0xb317('0x66')],{'as':_0xb317('0x16a'),'foreignKey':'ContactId'});db[_0xb317('0x103')][_0xb317('0x15b')](db[_0xb317('0x14')],{'as':_0xb317('0x178'),'foreignKey':'UserId'});db[_0xb317('0x103')][_0xb317('0x12b')](db[_0xb317('0x81')],{'through':_0xb317('0x1bc'),'as':_0xb317('0x179')});db['WhatsappInteraction']['belongsToMany'](db[_0xb317('0x81')],{'through':_0xb317('0x1bc'),'as':_0xb317('0x185')});db['WhatsappInteraction'][_0xb317('0x12b')](db['User'],{'as':_0xb317('0x18b'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db[_0xb317('0x105')]['belongsTo'](db[_0xb317('0x14')],{'as':_0xb317('0x14')});db[_0xb317('0x105')][_0xb317('0x15b')](db[_0xb317('0x66')],{'onDelete':_0xb317('0x118'),'as':_0xb317('0x16a')});db['WhatsappMessage'][_0xb317('0x15b')](db[_0xb317('0x103')],{'onDelete':'cascade','as':_0xb317('0x17b'),'foreignKey':_0xb317('0x1fd')});db[_0xb317('0x105')][_0xb317('0x15b')](db[_0xb317('0x14a')],{'as':_0xb317('0x177'),'foreignKey':_0xb317('0x1fb')});db[_0xb317('0x107')][_0xb317('0x15b')](db[_0xb317('0x14a')],{});db['WhatsappQueueReport'][_0xb317('0x15b')](db[_0xb317('0xf8')],{'as':_0xb317('0x174'),'foreignKey':_0xb317('0x17f')});db[_0xb317('0x107')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xb317('0x16b')});db[_0xb317('0x107')][_0xb317('0x15b')](db[_0xb317('0x103')],{});db[_0xb317('0x107')][_0xb317('0x15b')](db[_0xb317('0x10a')],{});db[_0xb317('0x107')]['belongsTo'](db['WhatsappMessage'],{});db[_0xb317('0x107')][_0xb317('0x15b')](db[_0xb317('0x14')],{});db[_0xb317('0x108')]['belongsTo'](db[_0xb317('0x105')],{});db[_0xb317('0x108')][_0xb317('0x15b')](db[_0xb317('0x103')],{});db[_0xb317('0x108')][_0xb317('0x15b')](db[_0xb317('0x14a')],{'foreignKey':_0xb317('0x1fe'),'as':'FromAccount'});db[_0xb317('0x108')][_0xb317('0x15b')](db[_0xb317('0x14a')],{'foreignKey':_0xb317('0x1ff'),'as':_0xb317('0x1e8')});db[_0xb317('0x108')][_0xb317('0x15b')](db[_0xb317('0x10a')],{'foreignKey':_0xb317('0x200'),'as':'ToQueue'});db[_0xb317('0x108')][_0xb317('0x15b')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xb317('0x108')][_0xb317('0x15b')](db[_0xb317('0x14')],{'foreignKey':'ToUserId','as':_0xb317('0x1e9')});db[_0xb317('0x10a')]['belongsToMany'](db['User'],{'as':_0xb317('0x161'),'through':_0xb317('0x13f'),'foreignKey':'WhatsappQueueId'});db[_0xb317('0x10a')][_0xb317('0x12b')](db[_0xb317('0xe5')],{'through':_0xb317('0x201'),'as':_0xb317('0x175')});db[_0xb317('0x113')][_0xb317('0x15b')](db['User'],{'as':_0xb317('0x202'),'foreignKey':'UserId','onDelete':_0xb317('0x118'),'hooks':!![]});db[_0xb317('0x16c')][_0xb317('0x116')](db[_0xb317('0xbf')],{'as':_0xb317('0xbf'),'onDelete':_0xb317('0x16e')});db['CloudProvider'][_0xb317('0x116')](db[_0xb317('0x34')],{'as':_0xb317('0x170'),'onDelete':_0xb317('0x16e')});db['CloudProvider']['hasOne'](db[_0xb317('0x36')],{'as':_0xb317('0x171'),'onDelete':'restrict'});module[_0xb317('0x203')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index ac804aa..56f20fc 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2574=['/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','root','/apidoc','/www','/demo','/snippet','snippet','3.9.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','default','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','./api/chatGroup','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/cdr','/api/voiceQueuesLog','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./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/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration'];(function(_0x251ac7,_0x45b1e9){var _0x27bd27=function(_0x125b66){while(--_0x125b66){_0x251ac7['push'](_0x251ac7['shift']());}};_0x27bd27(++_0x45b1e9);}(_0x2574,0x16c));var _0x4257=function(_0x261ec0,_0xe8b118){_0x261ec0=_0x261ec0-0x0;var _0x20c447=_0x2574[_0x261ec0];return _0x20c447;};'use strict';var path=require(_0x4257('0x0'));var express=require(_0x4257('0x1'));var errors=require(_0x4257('0x2'));var config=require(_0x4257('0x3'));var setupLoggers=require(_0x4257('0x4'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0x4257('0x5')]=function(_0x3a6606){return setupLoggers(_0x3a6606)['then'](function(){_0x3a6606[_0x4257('0x6')]('/api/users',require(_0x4257('0x7')));_0x3a6606[_0x4257('0x6')]('/api/voice/chanspy',require(_0x4257('0x8')));_0x3a6606[_0x4257('0x6')](_0x4257('0x9'),require(_0x4257('0xa')));_0x3a6606[_0x4257('0x6')](_0x4257('0xb'),require(_0x4257('0xc')));_0x3a6606[_0x4257('0x6')]('/api/voice/mohs',require(_0x4257('0xd')));_0x3a6606['use']('/api/voice/queues',require('./api/voiceQueue'));_0x3a6606['use'](_0x4257('0xe'),require(_0x4257('0xf')));_0x3a6606[_0x4257('0x6')](_0x4257('0x10'),require('./api/screenRecording'));_0x3a6606[_0x4257('0x6')](_0x4257('0x11'),require(_0x4257('0x12')));_0x3a6606['use'](_0x4257('0x13'),require('./api/voiceMailMessage'));_0x3a6606['use']('/api/voice/calls/reports',require(_0x4257('0x14')));_0x3a6606[_0x4257('0x6')]('/api/voice/dials/reports',require(_0x4257('0x15')));_0x3a6606[_0x4257('0x6')](_0x4257('0x16'),require(_0x4257('0x17')));_0x3a6606[_0x4257('0x6')](_0x4257('0x18'),require(_0x4257('0x19')));_0x3a6606[_0x4257('0x6')](_0x4257('0x1a'),require('./api/memberReport'));_0x3a6606[_0x4257('0x6')]('/api/trunks',require('./api/trunk'));_0x3a6606[_0x4257('0x6')](_0x4257('0x1b'),require(_0x4257('0x1c')));_0x3a6606[_0x4257('0x6')](_0x4257('0x1d'),require(_0x4257('0x1e')));_0x3a6606[_0x4257('0x6')]('/api/mail/accounts',require('./api/mailAccount'));_0x3a6606[_0x4257('0x6')]('/api/mail/queues',require('./api/mailQueue'));_0x3a6606[_0x4257('0x6')](_0x4257('0x1f'),require(_0x4257('0x20')));_0x3a6606['use'](_0x4257('0x21'),require(_0x4257('0x22')));_0x3a6606[_0x4257('0x6')]('/api/mail/messages',require(_0x4257('0x23')));_0x3a6606[_0x4257('0x6')](_0x4257('0x24'),require(_0x4257('0x25')));_0x3a6606[_0x4257('0x6')](_0x4257('0x26'),require(_0x4257('0x27')));_0x3a6606[_0x4257('0x6')]('/api/dashboards',require(_0x4257('0x28')));_0x3a6606['use']('/api/dashboards/items',require('./api/dashboardItem'));_0x3a6606[_0x4257('0x6')](_0x4257('0x29'),require('./api/faxAccount'));_0x3a6606[_0x4257('0x6')](_0x4257('0x2a'),require(_0x4257('0x2b')));_0x3a6606[_0x4257('0x6')](_0x4257('0x2c'),require(_0x4257('0x2d')));_0x3a6606[_0x4257('0x6')](_0x4257('0x2e'),require('./api/faxMessage'));_0x3a6606['use'](_0x4257('0x2f'),require(_0x4257('0x30')));_0x3a6606['use'](_0x4257('0x31'),require(_0x4257('0x32')));_0x3a6606[_0x4257('0x6')](_0x4257('0x33'),require('./api/smsAccount'));_0x3a6606['use'](_0x4257('0x34'),require(_0x4257('0x35')));_0x3a6606[_0x4257('0x6')](_0x4257('0x36'),require(_0x4257('0x37')));_0x3a6606[_0x4257('0x6')]('/api/sms/messages',require(_0x4257('0x38')));_0x3a6606[_0x4257('0x6')](_0x4257('0x39'),require('./api/smsQueue'));_0x3a6606[_0x4257('0x6')](_0x4257('0x3a'),require('./api/openchannelAccount'));_0x3a6606[_0x4257('0x6')](_0x4257('0x3b'),require('./api/openchannelApplication'));_0x3a6606['use'](_0x4257('0x3c'),require(_0x4257('0x3d')));_0x3a6606[_0x4257('0x6')](_0x4257('0x3e'),require(_0x4257('0x3f')));_0x3a6606['use'](_0x4257('0x40'),require('./api/openchannelQueue'));_0x3a6606['use'](_0x4257('0x41'),require('./api/chatWebsite'));_0x3a6606[_0x4257('0x6')](_0x4257('0x42'),require(_0x4257('0x43')));_0x3a6606['use']('/api/chat/applications',require(_0x4257('0x44')));_0x3a6606[_0x4257('0x6')](_0x4257('0x45'),require(_0x4257('0x46')));_0x3a6606[_0x4257('0x6')]('/api/chat/messages',require('./api/chatMessage'));_0x3a6606['use'](_0x4257('0x47'),require(_0x4257('0x48')));_0x3a6606[_0x4257('0x6')]('/api/chat/queues',require(_0x4257('0x49')));_0x3a6606['use']('/api/chat/groups',require(_0x4257('0x4a')));_0x3a6606[_0x4257('0x6')]('/api/chat/proactive_actions',require(_0x4257('0x4b')));_0x3a6606[_0x4257('0x6')]('/api/cm/companies',require(_0x4257('0x4c')));_0x3a6606[_0x4257('0x6')](_0x4257('0x4d'),require(_0x4257('0x4e')));_0x3a6606[_0x4257('0x6')]('/api/cm/hopper',require('./api/cmHopper'));_0x3a6606['use'](_0x4257('0x4f'),require('./api/cmHopperBlack'));_0x3a6606['use'](_0x4257('0x50'),require(_0x4257('0x51')));_0x3a6606[_0x4257('0x6')](_0x4257('0x52'),require(_0x4257('0x53')));_0x3a6606[_0x4257('0x6')]('/api/cm/custom_fields',require(_0x4257('0x54')));_0x3a6606[_0x4257('0x6')](_0x4257('0x55'),require(_0x4257('0x56')));_0x3a6606[_0x4257('0x6')](_0x4257('0x57'),require('./api/automation'));_0x3a6606[_0x4257('0x6')](_0x4257('0x58'),require(_0x4257('0x59')));_0x3a6606['use'](_0x4257('0x5a'),require(_0x4257('0x5b')));_0x3a6606['use'](_0x4257('0x5c'),require(_0x4257('0x5d')));_0x3a6606['use'](_0x4257('0x5e'),require(_0x4257('0x5f')));_0x3a6606[_0x4257('0x6')]('/api/pauses',require('./api/pause'));_0x3a6606['use']('/api/cdr',require(_0x4257('0x60')));_0x3a6606['use'](_0x4257('0x61'),require('./api/voiceQueuesLog'));_0x3a6606['use']('/api/schedules',require('./api/schedule'));_0x3a6606['use'](_0x4257('0x62'),require('./api/sound'));_0x3a6606[_0x4257('0x6')](_0x4257('0x63'),require(_0x4257('0x64')));_0x3a6606['use'](_0x4257('0x65'),require(_0x4257('0x66')));_0x3a6606[_0x4257('0x6')](_0x4257('0x67'),require(_0x4257('0x68')));_0x3a6606[_0x4257('0x6')](_0x4257('0x69'),require('./api/cmHopperAdditionalPhone'));_0x3a6606[_0x4257('0x6')](_0x4257('0x6a'),require(_0x4257('0x6b')));_0x3a6606['use'](_0x4257('0x6c'),require('./api/trigger'));_0x3a6606[_0x4257('0x6')](_0x4257('0x6d'),require(_0x4257('0x6e')));_0x3a6606[_0x4257('0x6')](_0x4257('0x6f'),require('./api/integration'));_0x3a6606[_0x4257('0x6')]('/api/integrations/reports',require('./api/integrationReport'));_0x3a6606[_0x4257('0x6')](_0x4257('0x70'),require(_0x4257('0x71')));_0x3a6606[_0x4257('0x6')](_0x4257('0x72'),require('./api/analyticDefaultReport'));_0x3a6606[_0x4257('0x6')](_0x4257('0x73'),require(_0x4257('0x74')));_0x3a6606[_0x4257('0x6')](_0x4257('0x75'),require('./api/analyticMetric'));_0x3a6606[_0x4257('0x6')](_0x4257('0x76'),require(_0x4257('0x77')));_0x3a6606['use'](_0x4257('0x78'),require('./api/analyticTreeReport'));_0x3a6606[_0x4257('0x6')](_0x4257('0x79'),require('./api/intSalesforceAccount'));_0x3a6606['use'](_0x4257('0x7a'),require(_0x4257('0x7b')));_0x3a6606[_0x4257('0x6')](_0x4257('0x7c'),require(_0x4257('0x7d')));_0x3a6606[_0x4257('0x6')](_0x4257('0x7e'),require(_0x4257('0x7f')));_0x3a6606[_0x4257('0x6')](_0x4257('0x80'),require(_0x4257('0x81')));_0x3a6606[_0x4257('0x6')](_0x4257('0x82'),require(_0x4257('0x83')));_0x3a6606[_0x4257('0x6')](_0x4257('0x84'),require(_0x4257('0x85')));_0x3a6606[_0x4257('0x6')](_0x4257('0x86'),require(_0x4257('0x87')));_0x3a6606[_0x4257('0x6')](_0x4257('0x88'),require('./api/intDeskField'));_0x3a6606[_0x4257('0x6')]('/api/integrations/zoho/accounts',require(_0x4257('0x89')));_0x3a6606['use']('/api/integrations/zoho/configurations',require(_0x4257('0x8a')));_0x3a6606['use'](_0x4257('0x8b'),require(_0x4257('0x8c')));_0x3a6606[_0x4257('0x6')](_0x4257('0x8d'),require(_0x4257('0x8e')));_0x3a6606[_0x4257('0x6')](_0x4257('0x8f'),require(_0x4257('0x90')));_0x3a6606[_0x4257('0x6')](_0x4257('0x91'),require(_0x4257('0x92')));_0x3a6606[_0x4257('0x6')](_0x4257('0x93'),require(_0x4257('0x94')));_0x3a6606[_0x4257('0x6')](_0x4257('0x95'),require('./api/intFreshdeskConfiguration'));_0x3a6606[_0x4257('0x6')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x3a6606['use']('/api/integrations/vtiger/accounts',require(_0x4257('0x96')));_0x3a6606[_0x4257('0x6')](_0x4257('0x97'),require(_0x4257('0x98')));_0x3a6606['use'](_0x4257('0x99'),require(_0x4257('0x9a')));_0x3a6606[_0x4257('0x6')](_0x4257('0x9b'),require('./api/intServicenowAccount'));_0x3a6606[_0x4257('0x6')](_0x4257('0x9c'),require(_0x4257('0x9d')));_0x3a6606['use'](_0x4257('0x9e'),require(_0x4257('0x9f')));_0x3a6606['use'](_0x4257('0xa0'),require(_0x4257('0xa1')));_0x3a6606[_0x4257('0x6')](_0x4257('0xa2'),require(_0x4257('0xa3')));_0x3a6606[_0x4257('0x6')](_0x4257('0xa4'),require(_0x4257('0xa5')));_0x3a6606['use'](_0x4257('0xa6'),require('./api/intFreshsalesAccount'));_0x3a6606['use']('/api/integrations/freshsales/configurations',require(_0x4257('0xa7')));_0x3a6606[_0x4257('0x6')](_0x4257('0xa8'),require(_0x4257('0xa9')));_0x3a6606[_0x4257('0x6')](_0x4257('0xaa'),require(_0x4257('0xab')));_0x3a6606[_0x4257('0x6')](_0x4257('0xac'),require(_0x4257('0xad')));_0x3a6606[_0x4257('0x6')](_0x4257('0xae'),require(_0x4257('0xaf')));_0x3a6606[_0x4257('0x6')]('/api/jscripty/answers/reports',require(_0x4257('0xb0')));_0x3a6606['use'](_0x4257('0xb1'),require(_0x4257('0xb2')));_0x3a6606[_0x4257('0x6')](_0x4257('0xb3'),require(_0x4257('0xb4')));_0x3a6606['use']('/api/sms/reports/queue',require(_0x4257('0xb5')));_0x3a6606[_0x4257('0x6')]('/api/square/reports',require('./api/squareReport'));_0x3a6606['use']('/api/square/details/reports',require('./api/squareReportDetail'));_0x3a6606[_0x4257('0x6')](_0x4257('0xb6'),require(_0x4257('0xb7')));_0x3a6606[_0x4257('0x6')](_0x4257('0xb8'),require(_0x4257('0xb9')));_0x3a6606['use'](_0x4257('0xba'),require(_0x4257('0xbb')));_0x3a6606[_0x4257('0x6')]('/api/square/projects',require(_0x4257('0xbc')));_0x3a6606[_0x4257('0x6')](_0x4257('0xbd'),require(_0x4257('0xbe')));_0x3a6606[_0x4257('0x6')]('/api/square/messages',require(_0x4257('0xbf')));_0x3a6606[_0x4257('0x6')](_0x4257('0xc0'),require(_0x4257('0xc1')));_0x3a6606['use'](_0x4257('0xc2'),require('./api/license'));_0x3a6606[_0x4257('0x6')](_0x4257('0xc3'),require(_0x4257('0xc4')));_0x3a6606[_0x4257('0x6')](_0x4257('0xc5'),require('./api/migration'));_0x3a6606[_0x4257('0x6')](_0x4257('0xc6'),require(_0x4257('0xc7')));_0x3a6606[_0x4257('0x6')]('/api/plugins',require('./api/plugin'));_0x3a6606[_0x4257('0x6')](_0x4257('0xc8'),require(_0x4257('0xc9')));_0x3a6606[_0x4257('0x6')](_0x4257('0xca'),require(_0x4257('0xcb')));_0x3a6606[_0x4257('0x6')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x3a6606[_0x4257('0x6')]('/api/openchannel/reports/transfer',require(_0x4257('0xcc')));_0x3a6606['use'](_0x4257('0xcd'),require(_0x4257('0xce')));_0x3a6606[_0x4257('0x6')](_0x4257('0xcf'),require(_0x4257('0xd0')));_0x3a6606[_0x4257('0x6')](_0x4257('0xd1'),require('./api/voicePrefix'));_0x3a6606[_0x4257('0x6')](_0x4257('0xd2'),require('./api/userProfile'));_0x3a6606[_0x4257('0x6')](_0x4257('0xd3'),require(_0x4257('0xd4')));_0x3a6606[_0x4257('0x6')]('/api/userProfile/resources',require(_0x4257('0xd5')));_0x3a6606[_0x4257('0x6')](_0x4257('0xd6'),require('./api/userNotification'));_0x3a6606[_0x4257('0x6')](_0x4257('0xd7'),require('./api/whatsappAccount'));_0x3a6606[_0x4257('0x6')](_0x4257('0xd8'),require(_0x4257('0xd9')));_0x3a6606[_0x4257('0x6')](_0x4257('0xda'),require('./api/whatsappInteraction'));_0x3a6606[_0x4257('0x6')](_0x4257('0xdb'),require('./api/whatsappMessage'));_0x3a6606[_0x4257('0x6')](_0x4257('0xdc'),require(_0x4257('0xdd')));_0x3a6606['use'](_0x4257('0xde'),require(_0x4257('0xdf')));_0x3a6606[_0x4257('0x6')]('/api/whatsapp/queues',require(_0x4257('0xe0')));_0x3a6606[_0x4257('0x6')](_0x4257('0xe1'),require(_0x4257('0xe2')));_0x3a6606[_0x4257('0x6')]('/api/realtime',require(_0x4257('0xe3')));_0x3a6606[_0x4257('0x6')](_0x4257('0xe4'),require('./api/user-setting'));_0x3a6606[_0x4257('0x6')]('/api/mail_interaction_has_tags',require(_0x4257('0xe5')));_0x3a6606['use'](_0x4257('0xe6'),require(_0x4257('0xe7')));_0x3a6606[_0x4257('0x6')](_0x4257('0xe8'),require(_0x4257('0xe9')));_0x3a6606[_0x4257('0x6')](_0x4257('0xea'),require(_0x4257('0xeb')));_0x3a6606['use']('/api/jira',require(_0x4257('0xec')));_0x3a6606['use']('/api/rpc',require('./api/rpc'));_0x3a6606[_0x4257('0x6')](_0x4257('0xed'),require(_0x4257('0xee')));_0x3a6606[_0x4257('0x6')](_0x4257('0xef'),require(_0x4257('0xf0')));_0x3a6606['use'](_0x4257('0xf1'),require(_0x4257('0xf2')));_0x3a6606[_0x4257('0x6')](_0x4257('0xf3'),require(_0x4257('0xf4')));_0x3a6606['use'](_0x4257('0xf5'),clientSideLogs);_0x3a6606[_0x4257('0x6')]('/apidoc',express[_0x4257('0xf6')](path[_0x4257('0xf7')](config[_0x4257('0xf8')],_0x4257('0xf9'))));_0x3a6606[_0x4257('0x6')](_0x4257('0xfa'),express[_0x4257('0xf6')](path['join'](config[_0x4257('0xf8')],_0x4257('0xfa'))));_0x3a6606[_0x4257('0x6')](_0x4257('0xfb'),express['static'](path[_0x4257('0xf7')](config[_0x4257('0xf8')],_0x4257('0xfb'))));_0x3a6606[_0x4257('0x6')](_0x4257('0xfc'),express[_0x4257('0xf6')](path[_0x4257('0xf7')](config['root'],_0x4257('0xfd'),_0x4257('0xfe'))));_0x3a6606['use'](_0x4257('0xff'),express[_0x4257('0xf6')](path[_0x4257('0xf7')](config[_0x4257('0xf8')],_0x4257('0x100'))));_0x3a6606[_0x4257('0x101')](_0x4257('0x102'))[_0x4257('0x103')](errors[0x194]);_0x3a6606['route']('/*')[_0x4257('0x103')](function(_0x2bedb0,_0x4b11b5){_0x4b11b5[_0x4257('0x104')](path[_0x4257('0x105')](_0x3a6606[_0x4257('0x103')](_0x4257('0x106'))+_0x4257('0x107')));});return _0x3a6606;});}; \ No newline at end of file +var _0x5672=['./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','/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/chatTransferReport','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','/api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','./errors','./config/environment','setupLoggers','use','/api/voice/chanspy','./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/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','/api/mail/out_servers','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/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/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_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/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField'];(function(_0x2fb465,_0x49588d){var _0x1e10ad=function(_0x1b3bd5){while(--_0x1b3bd5){_0x2fb465['push'](_0x2fb465['shift']());}};_0x1e10ad(++_0x49588d);}(_0x5672,0x174));var _0x2567=function(_0x5ece84,_0xc06c9f){_0x5ece84=_0x5ece84-0x0;var _0x2a12c4=_0x5672[_0x5ece84];return _0x2a12c4;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x2567('0x0'));var config=require(_0x2567('0x1'));var setupLoggers=require('./utils/client-side-logger')[_0x2567('0x2')];var clientSideLogs=require('./api/client-side-logs');exports['default']=function(_0x44ee2f){return setupLoggers(_0x44ee2f)['then'](function(){_0x44ee2f[_0x2567('0x3')]('/api/users',require('./api/user'));_0x44ee2f['use'](_0x2567('0x4'),require(_0x2567('0x5')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x6'),require('./api/voiceContext'));_0x44ee2f['use'](_0x2567('0x7'),require(_0x2567('0x8')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x9'),require(_0x2567('0xa')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xb'),require(_0x2567('0xc')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xd'),require(_0x2567('0xe')));_0x44ee2f[_0x2567('0x3')]('/api/screen/recordings',require(_0x2567('0xf')));_0x44ee2f['use'](_0x2567('0x10'),require(_0x2567('0x11')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x12'),require(_0x2567('0x13')));_0x44ee2f['use']('/api/voice/calls/reports',require(_0x2567('0x14')));_0x44ee2f[_0x2567('0x3')]('/api/voice/dials/reports',require(_0x2567('0x15')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x16'),require('./api/voiceAgentReport'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x17'),require(_0x2567('0x18')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x19'),require('./api/memberReport'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x1a'),require('./api/trunk'));_0x44ee2f[_0x2567('0x3')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x1b'),require('./api/mailServerOut'));_0x44ee2f[_0x2567('0x3')]('/api/mail/accounts',require('./api/mailAccount'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x1c'),require(_0x2567('0x1d')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x1e'),require('./api/mailSubstatus'));_0x44ee2f[_0x2567('0x3')]('/api/mail/interactions',require('./api/mailInteraction'));_0x44ee2f['use'](_0x2567('0x1f'),require(_0x2567('0x20')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x21'),require(_0x2567('0x22')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x23'),require('./api/mailQueueReport'));_0x44ee2f[_0x2567('0x3')]('/api/dashboards',require(_0x2567('0x24')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x25'),require(_0x2567('0x26')));_0x44ee2f['use'](_0x2567('0x27'),require('./api/faxAccount'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x28'),require(_0x2567('0x29')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x2a'),require(_0x2567('0x2b')));_0x44ee2f[_0x2567('0x3')]('/api/fax/messages',require(_0x2567('0x2c')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x2d'),require('./api/faxQueue'));_0x44ee2f[_0x2567('0x3')]('/api/fax/reports/queue',require(_0x2567('0x2e')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x2f'),require(_0x2567('0x30')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x31'),require(_0x2567('0x32')));_0x44ee2f[_0x2567('0x3')]('/api/sms/interactions',require(_0x2567('0x33')));_0x44ee2f[_0x2567('0x3')]('/api/sms/messages',require(_0x2567('0x34')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x35'),require(_0x2567('0x36')));_0x44ee2f['use']('/api/openchannel/accounts',require(_0x2567('0x37')));_0x44ee2f['use'](_0x2567('0x38'),require(_0x2567('0x39')));_0x44ee2f['use'](_0x2567('0x3a'),require('./api/openchannelInteraction'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x3b'),require(_0x2567('0x3c')));_0x44ee2f['use'](_0x2567('0x3d'),require(_0x2567('0x3e')));_0x44ee2f['use'](_0x2567('0x3f'),require('./api/chatWebsite'));_0x44ee2f[_0x2567('0x3')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x40'),require('./api/chatApplication'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x41'),require(_0x2567('0x42')));_0x44ee2f['use'](_0x2567('0x43'),require(_0x2567('0x44')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x45'),require(_0x2567('0x46')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x47'),require('./api/chatQueue'));_0x44ee2f[_0x2567('0x3')]('/api/chat/groups',require('./api/chatGroup'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x48'),require(_0x2567('0x49')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x4a'),require(_0x2567('0x4b')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x4c'),require('./api/cmContact'));_0x44ee2f[_0x2567('0x3')]('/api/cm/hopper',require(_0x2567('0x4d')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x4e'),require(_0x2567('0x4f')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x50'),require('./api/cmHopperFinal'));_0x44ee2f[_0x2567('0x3')]('/api/cm/hopper_history',require(_0x2567('0x51')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x52'),require('./api/cmCustomField'));_0x44ee2f['use'](_0x2567('0x53'),require(_0x2567('0x54')));_0x44ee2f['use'](_0x2567('0x55'),require('./api/automation'));_0x44ee2f['use'](_0x2567('0x56'),require(_0x2567('0x57')));_0x44ee2f['use'](_0x2567('0x58'),require('./api/disposition'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x59'),require(_0x2567('0x5a')));_0x44ee2f['use'](_0x2567('0x5b'),require(_0x2567('0x5c')));_0x44ee2f['use'](_0x2567('0x5d'),require(_0x2567('0x5e')));_0x44ee2f[_0x2567('0x3')]('/api/cdr',require(_0x2567('0x5f')));_0x44ee2f['use'](_0x2567('0x60'),require(_0x2567('0x61')));_0x44ee2f['use']('/api/schedules',require(_0x2567('0x62')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x63'),require(_0x2567('0x64')));_0x44ee2f['use'](_0x2567('0x65'),require(_0x2567('0x66')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x67'),require(_0x2567('0x68')));_0x44ee2f['use'](_0x2567('0x69'),require('./api/cmContactHasItem'));_0x44ee2f['use'](_0x2567('0x6a'),require('./api/cmHopperAdditionalPhone'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x6b'),require(_0x2567('0x6c')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x6d'),require(_0x2567('0x6e')));_0x44ee2f['use'](_0x2567('0x6f'),require('./api/variable'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x70'),require(_0x2567('0x71')));_0x44ee2f['use'](_0x2567('0x72'),require('./api/integrationReport'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x73'),require(_0x2567('0x74')));_0x44ee2f['use'](_0x2567('0x75'),require(_0x2567('0x76')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x77'),require('./api/analyticExtractedReport'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x78'),require(_0x2567('0x79')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x7a'),require(_0x2567('0x7b')));_0x44ee2f[_0x2567('0x3')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x7c'),require(_0x2567('0x7d')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x7e'),require(_0x2567('0x7f')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x80'),require(_0x2567('0x81')));_0x44ee2f['use'](_0x2567('0x82'),require(_0x2567('0x83')));_0x44ee2f['use'](_0x2567('0x84'),require(_0x2567('0x85')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x86'),require(_0x2567('0x87')));_0x44ee2f['use'](_0x2567('0x88'),require(_0x2567('0x89')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x8a'),require('./api/intDeskConfiguration'));_0x44ee2f[_0x2567('0x3')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x8b'),require(_0x2567('0x8c')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x8d'),require('./api/intZohoConfiguration'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x8e'),require(_0x2567('0x8f')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x90'),require(_0x2567('0x91')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x92'),require(_0x2567('0x93')));_0x44ee2f[_0x2567('0x3')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x44ee2f['use'](_0x2567('0x94'),require(_0x2567('0x95')));_0x44ee2f['use'](_0x2567('0x96'),require('./api/intFreshdeskConfiguration'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x97'),require(_0x2567('0x98')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x99'),require(_0x2567('0x9a')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x9b'),require('./api/intVtigerConfiguration'));_0x44ee2f[_0x2567('0x3')](_0x2567('0x9c'),require(_0x2567('0x9d')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x9e'),require(_0x2567('0x9f')));_0x44ee2f['use'](_0x2567('0xa0'),require(_0x2567('0xa1')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xa2'),require(_0x2567('0xa3')));_0x44ee2f['use']('/api/integrations/dynamics365/accounts',require(_0x2567('0xa4')));_0x44ee2f['use'](_0x2567('0xa5'),require(_0x2567('0xa6')));_0x44ee2f[_0x2567('0x3')]('/api/integrations/dynamics365/fields',require(_0x2567('0xa7')));_0x44ee2f['use'](_0x2567('0xa8'),require('./api/intFreshsalesAccount'));_0x44ee2f[_0x2567('0x3')](_0x2567('0xa9'),require(_0x2567('0xaa')));_0x44ee2f['use']('/api/integrations/freshsales/fields',require(_0x2567('0xab')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xac'),require('./api/network'));_0x44ee2f[_0x2567('0x3')](_0x2567('0xad'),require(_0x2567('0xae')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xaf'),require(_0x2567('0xb0')));_0x44ee2f['use']('/api/jscripty/answers/reports',require(_0x2567('0xb1')));_0x44ee2f[_0x2567('0x3')]('/api/jscripty/questions/reports',require(_0x2567('0xb2')));_0x44ee2f['use'](_0x2567('0xb3'),require('./api/jscriptySessionReport'));_0x44ee2f[_0x2567('0x3')](_0x2567('0xb4'),require(_0x2567('0xb5')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xb6'),require(_0x2567('0xb7')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xb8'),require(_0x2567('0xb9')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xba'),require('./api/jscriptyProject'));_0x44ee2f[_0x2567('0x3')](_0x2567('0xbb'),require(_0x2567('0xbc')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xbd'),require(_0x2567('0xbe')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xbf'),require('./api/squareProject'));_0x44ee2f[_0x2567('0x3')](_0x2567('0xc0'),require(_0x2567('0xc1')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xc2'),require('./api/squareMessage'));_0x44ee2f['use'](_0x2567('0xc3'),require(_0x2567('0xc4')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xc5'),require(_0x2567('0xc6')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xc7'),require(_0x2567('0xc8')));_0x44ee2f['use'](_0x2567('0xc9'),require(_0x2567('0xca')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xcb'),require('./api/attachment'));_0x44ee2f[_0x2567('0x3')](_0x2567('0xcc'),require(_0x2567('0xcd')));_0x44ee2f['use'](_0x2567('0xce'),require(_0x2567('0xcf')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xd0'),require(_0x2567('0xd1')));_0x44ee2f[_0x2567('0x3')]('/api/fax/reports/transfer',require(_0x2567('0xd2')));_0x44ee2f['use']('/api/openchannel/reports/transfer',require(_0x2567('0xd3')));_0x44ee2f['use'](_0x2567('0xd4'),require(_0x2567('0xd5')));_0x44ee2f[_0x2567('0x3')]('/api/cm/lists',require(_0x2567('0xd6')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xd7'),require(_0x2567('0xd8')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xd9'),require('./api/userProfile'));_0x44ee2f['use']('/api/userProfile/sections',require('./api/userProfileSection'));_0x44ee2f[_0x2567('0x3')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x44ee2f[_0x2567('0x3')]('/api/userNotifications',require(_0x2567('0xda')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xdb'),require(_0x2567('0xdc')));_0x44ee2f[_0x2567('0x3')]('/api/whatsapp/applications',require(_0x2567('0xdd')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xde'),require(_0x2567('0xdf')));_0x44ee2f['use']('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x44ee2f[_0x2567('0x3')](_0x2567('0xe0'),require(_0x2567('0xe1')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xe2'),require(_0x2567('0xe3')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xe4'),require('./api/whatsappQueue'));_0x44ee2f[_0x2567('0x3')](_0x2567('0xe5'),require('./api/cloudProvider'));_0x44ee2f[_0x2567('0x3')](_0x2567('0xe6'),require('./api/realtime'));_0x44ee2f[_0x2567('0x3')](_0x2567('0xe7'),require(_0x2567('0xe8')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xe9'),require(_0x2567('0xea')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xeb'),require(_0x2567('0xec')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xed'),require(_0x2567('0xee')));_0x44ee2f[_0x2567('0x3')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x44ee2f[_0x2567('0x3')](_0x2567('0xef'),require('./api/jira'));_0x44ee2f[_0x2567('0x3')](_0x2567('0xf0'),require(_0x2567('0xf1')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xf2'),require(_0x2567('0xf3')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xf4'),require(_0x2567('0xf5')));_0x44ee2f[_0x2567('0x3')](_0x2567('0xf6'),require(_0x2567('0xf7')));_0x44ee2f['use'](_0x2567('0xf8'),require(_0x2567('0xf9')));_0x44ee2f['use'](_0x2567('0xfa'),clientSideLogs);_0x44ee2f[_0x2567('0x3')](_0x2567('0xfb'),express[_0x2567('0xfc')](path['join'](config[_0x2567('0xfd')],_0x2567('0xfb'))));_0x44ee2f[_0x2567('0x3')](_0x2567('0xfe'),express['static'](path[_0x2567('0xff')](config[_0x2567('0xfd')],_0x2567('0xfe'))));_0x44ee2f[_0x2567('0x3')](_0x2567('0x100'),express['static'](path[_0x2567('0xff')](config[_0x2567('0xfd')],'/demo')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x101'),express[_0x2567('0xfc')](path[_0x2567('0xff')](config['root'],_0x2567('0x102'),'3.9.0')));_0x44ee2f[_0x2567('0x3')](_0x2567('0x103'),express[_0x2567('0xfc')](path[_0x2567('0xff')](config[_0x2567('0xfd')],_0x2567('0x104'))));_0x44ee2f[_0x2567('0x105')](_0x2567('0x106'))[_0x2567('0x107')](errors[0x194]);_0x44ee2f['route']('/*')[_0x2567('0x107')](function(_0x10b643,_0x435dec){_0x435dec[_0x2567('0x108')](path[_0x2567('0x109')](_0x44ee2f['get'](_0x2567('0x10a'))+_0x2567('0x10b')));});return _0x44ee2f;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index cf5f823..e40c4ef 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5495=['../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','rpc','localhost','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.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/openchannelApplication/openchannelApplication.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/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc'];(function(_0x4c7f10,_0x5991a9){var _0x281ba5=function(_0x36d524){while(--_0x36d524){_0x4c7f10['push'](_0x4c7f10['shift']());}};_0x281ba5(++_0x5991a9);}(_0x5495,0x12a));var _0x5549=function(_0x5a62fb,_0xeeb063){_0x5a62fb=_0x5a62fb-0x0;var _0x26670f=_0x5495[_0x5a62fb];return _0x26670f;};'use strict';var jayson=require('jayson/promise');var _=require(_0x5549('0x0'));var config=require('../config/environment');exports[_0x5549('0x1')]=function(){return new Promise(function(_0x5b5c87,_0x1c7de9){var _0x14307a={};_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x3')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x4')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x5')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require('../api/voiceRecording/voiceRecording.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x6')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x7')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x8')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x9')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0xa')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0xb')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0xc')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0xd')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require('../api/mailServerIn/mailServerIn.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0xe')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0xf')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x10')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x11')));_0x14307a=_['merge'](_0x14307a,require('../api/mailApplication/mailApplication.rpc'));_0x14307a=_['merge'](_0x14307a,require(_0x5549('0x12')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require('../api/faxAccount/faxAccount.rpc'));_0x14307a=_['merge'](_0x14307a,require(_0x5549('0x13')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require('../api/faxInteraction/faxInteraction.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x14')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x15')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x16')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x17')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x18')));_0x14307a=_['merge'](_0x14307a,require(_0x5549('0x19')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x1a')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x1b')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x1c')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x1d')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x1e')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x1f')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x20')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x21')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x22')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x23')));_0x14307a=_['merge'](_0x14307a,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x14307a=_['merge'](_0x14307a,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x24')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x25')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x26')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x27')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x28')));_0x14307a=_['merge'](_0x14307a,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require('../api/template/template.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require('../api/trigger/trigger.rpc'));_0x14307a=_['merge'](_0x14307a,require('../api/variable/variable.rpc'));_0x14307a=_['merge'](_0x14307a,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x14307a=_['merge'](_0x14307a,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x29')));_0x14307a=_['merge'](_0x14307a,require(_0x5549('0x2a')));_0x14307a=_['merge'](_0x14307a,require(_0x5549('0x2b')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x2c')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x2d')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x2e')));_0x14307a=_['merge'](_0x14307a,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x2f')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x30')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x31')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x32')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x33')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require('../api/squareOdbc/squareOdbc.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x34')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x35')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require('../api/squareMessage/squareMessage.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require('../api/campaign/campaign.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x36')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x37')));_0x14307a=_['merge'](_0x14307a,require(_0x5549('0x38')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x39')));_0x14307a=_[_0x5549('0x2')](_0x14307a,require(_0x5549('0x3a')));_0x14307a=_['merge'](_0x14307a,require(_0x5549('0x3b')));var _0x32992a=jayson[_0x5549('0x3c')](_0x14307a)['http']();var _0x318d06=config['rpc']['port']||config[_0x5549('0x3d')]+0x1;var _0x53a80c=config[_0x5549('0x3e')]['ip']||_0x5549('0x3f');_0x32992a['on'](_0x5549('0x40'),function(_0x551a88){return _0x1c7de9(_0x551a88);});_0x32992a[_0x5549('0x1')](_0x318d06,_0x53a80c,function(){console[_0x5549('0x41')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x53a80c,_0x318d06);require(_0x5549('0x42'))[_0x5549('0x43')]();return _0x5b5c87(_0x5549('0x44')+_0x53a80c+':'+_0x318d06);});});}; \ No newline at end of file +var _0x9bb8=['../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/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/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','localhost','error','log','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x89bb('0x0'));var _=require(_0x89bb('0x1'));var config=require(_0x89bb('0x2'));exports[_0x89bb('0x3')]=function(){return new Promise(function(_0x3126b8,_0x1ec568){var _0x3e766d={};_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x5')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x6')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/voiceQueue/voiceQueue.rpc'));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x7')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x8')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x9')));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0xa')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/memberReport/memberReport.rpc'));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/trunk/trunk.rpc'));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0xb')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0xc')));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0xd')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0xe')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/mailInteraction/mailInteraction.rpc'));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0xf')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x10')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x11')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/faxAccount/faxAccount.rpc'));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x12')));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0x13')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x14')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x15')));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0x16')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x17')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x18')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x19')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x1a')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x1b')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x1c')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x1d')));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0x1e')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x1f')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x20')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x21')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x22')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/cmHopper/cmHopper.rpc'));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0x23')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x24')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x25')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x26')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x27')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x28')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/sound/sound.rpc'));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x29')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/template/template.rpc'));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x2a')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x2b')));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0x2c')));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0x2d')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x2e')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x2f')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x30')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x31')));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0x32')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x33')));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0x34')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x35')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x36')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x37')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x38')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x39')));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0x3a')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require('../api/squareRecording/squareRecording.rpc'));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x3b')));_0x3e766d=_['merge'](_0x3e766d,require('../api/campaign/campaign.rpc'));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0x3c')));_0x3e766d=_['merge'](_0x3e766d,require('../api/plugin/plugin.rpc'));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0x3d')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x3e')));_0x3e766d=_['merge'](_0x3e766d,require(_0x89bb('0x3f')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x40')));_0x3e766d=_[_0x89bb('0x4')](_0x3e766d,require(_0x89bb('0x41')));var _0x109cfc=jayson['server'](_0x3e766d)[_0x89bb('0x42')]();var _0x30f389=config['rpc'][_0x89bb('0x43')]||config[_0x89bb('0x43')]+0x1;var _0x15b152=config[_0x89bb('0x44')]['ip']||_0x89bb('0x45');_0x109cfc['on'](_0x89bb('0x46'),function(_0x3ca81b){return _0x1ec568(_0x3ca81b);});_0x109cfc[_0x89bb('0x3')](_0x30f389,_0x15b152,function(){console[_0x89bb('0x47')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x15b152,_0x30f389);require('../config/triggers')[_0x89bb('0x48')]();return _0x3126b8(_0x89bb('0x49')+_0x15b152+':'+_0x30f389);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b9c0c2b..3cd292f 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 _0x6744=['extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','wait','WAIT','label','exports','util','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','headers','emit','ready','hangup','substring','search','function','replace','result=','indexOf','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt'];(function(_0x95dc65,_0x3d1e6e){var _0x300e16=function(_0x4b3a68){while(--_0x4b3a68){_0x95dc65['push'](_0x95dc65['shift']());}};_0x300e16(++_0x3d1e6e);}(_0x6744,0xf1));var _0x4674=function(_0x41ebb1,_0x39a838){_0x41ebb1=_0x41ebb1-0x0;var _0xb98e24=_0x6744[_0x41ebb1];return _0xb98e24;};'use strict';var util=require(_0x4674('0x0'));var _=require(_0x4674('0x1'));var EventEmitter=require(_0x4674('0x2'))[_0x4674('0x3')];var AGIReply=require(_0x4674('0x4'));var AGIError=require(_0x4674('0x5'));function AGIChannel(_0x2232a9){var _0x45a9b3=this,_0x1ab4e8=new AGIReply(),_0x3b837a=![],_0x3b56e5={};EventEmitter['call'](_0x45a9b3);_0x2232a9[_0x4674('0x6')](_0x4674('0x7'));_0x2232a9[_0x4674('0x8')](0x8*0x3c*0x3c*0x3e8);_0x1ab4e8[_0x4674('0x6')](_0x4674('0x7'));_0x1ab4e8['on'](_0x4674('0x9'),function(_0x47505a){for(var _0x4f8181 in _0x47505a){_0x45a9b3[_0x4f8181]=_0x47505a[_0x4f8181];}_0x45a9b3[_0x4674('0xa')](_0x4674('0xb'));});_0x1ab4e8['on']('line',function(_0x3900d5){if(_0x3900d5['toLowerCase']()==_0x4674('0xc')){_0x45a9b3[_0x4674('0xa')]('hangup');return;}if(_0x3900d5[_0x4674('0xd')](0x0,0xb)=='520-Invalid'){_0x3b837a=!![];}if(_0x3b837a){_0x3b56e5['rx']+=_0x3900d5+'\x0a';if(_0x3900d5[_0x4674('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x3b837a=![];}}else{_0x3b56e5['rx']=_0x3900d5;}if(_0x3b837a){return;}if(typeof _0x3b56e5['cb']==_0x4674('0xf')){var _0x3023c6=_0x3b56e5['rx'][_0x4674('0xd')](0x0,0x3),_0x410009=null,_0x23d171=null;_0x3023c6=parseInt(_0x3023c6);if(isNaN(_0x3023c6)){_0x3b56e5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x3023c6!=0xc8){_0x3b56e5['cb'](null,{'code':_0x3023c6,'result':-0x1,'extra':'KO'});return;}_0x410009=_0x3b56e5['rx'][_0x4674('0xd')](0x4)[_0x4674('0x10')](_0x4674('0x11'),'');if(_0x410009[_0x4674('0x12')]('\x20')!=-0x1){_0x410009=_0x410009['substr'](0x0,_0x410009[_0x4674('0x12')]('\x20'));}if(_['startsWith'](_0x410009,'-1')){_0x410009=parseInt(_0x410009);}_0x23d171=_0x3b56e5['rx'][_0x4674('0x13')]('\x20');if(_0x23d171[_0x4674('0x14')]==0x3){_0x23d171=_0x23d171[0x2][_0x4674('0xd')](0x1,_0x23d171[0x2][_0x4674('0x14')]-0x1);}else if(_0x23d171['length']>0x3){var _0x5857ea=/\((.+)\)/;var _0x41790a=_0x3b56e5['rx'][_0x4674('0x15')](_0x5857ea);if(_0x41790a){_0x23d171=_0x41790a[0x1];}else{_0x23d171=null;}}else{_0x23d171=null;}_0x3b56e5['cb'](null,{'code':_0x3023c6,'result':_0x410009,'extra':_0x23d171});}});_0x2232a9['on'](_0x4674('0x16'),function(_0x2b4646){_0x45a9b3['emit']('error',new AGIError('E_AGI_SOCKET_ERROR',_0x2b4646[_0x4674('0x17')]));});_0x2232a9['on'](_0x4674('0x18'),function(){_0x45a9b3[_0x4674('0xa')](_0x4674('0x18'),new AGIError(_0x4674('0x19')));});_0x2232a9['on'](_0x4674('0x1a'),function(){_0x45a9b3[_0x4674('0xa')](_0x4674('0x1a'),new AGIError(_0x4674('0x1b')));_0x2232a9[_0x4674('0x1c')]();});_0x2232a9[_0x4674('0x1d')](_0x1ab4e8);this[_0x4674('0x1e')]=function(_0x4759d6,_0x548da2){var _0x4759d6=_0x4759d6||'',_0x548da2=typeof _0x548da2==_0x4674('0xf')?_0x548da2:new Function();_0x3b56e5={'tx':_0x4759d6,'rx':'','cb':_0x548da2};_0x2232a9[_0x4674('0x1f')](_0x4759d6+'\x0a');},this[_0x4674('0x18')]=function(){_0x2232a9[_0x4674('0x1c')]();};}util[_0x4674('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x4674('0x21')][_0x4674('0x22')]=function(_0x535081){return this['command'][_0x4674('0x23')](this,_0x535081);};AGIChannel[_0x4674('0x21')][_0x4674('0x24')]=function(){return this[_0x4674('0x22')](_0x4674('0x25'));};AGIChannel['prototype'][_0x4674('0x26')]=function(_0x5ec6f9,_0x2f9fee,_0x110a78){_0x5ec6f9=_0x5ec6f9===undefined?_0x4674('0x27'):_0x5ec6f9;_0x2f9fee=_0x2f9fee===undefined?'5':_0x2f9fee;_0x110a78=_0x110a78===undefined?'1':_0x110a78;return this[_0x4674('0x22')](util[_0x4674('0x28')](_0x4674('0x29'),_0x5ec6f9,_0x2f9fee*0x3e8,_0x110a78));};AGIChannel[_0x4674('0x21')][_0x4674('0x2a')]=function(_0x298417){_0x298417=_0x298417||_0x4674('0x2b');return this[_0x4674('0x22')](util['format'](_0x4674('0x2c'),_0x298417));};AGIChannel[_0x4674('0x21')][_0x4674('0x2d')]=function(_0x227e6e,_0x182950){if(_['isArray'](_0x182950)){return this[_0x4674('0x22')](util['format']('EXEC\x20%s\x20%s',_0x227e6e,_0x182950[_0x4674('0x2e')](',')));}return this[_0x4674('0x22')](util[_0x4674('0x28')](_0x4674('0x2f'),_0x227e6e,_0x182950));};AGIChannel[_0x4674('0x21')]['setContext']=function(_0x13d786){return this[_0x4674('0x22')](util['format'](_0x4674('0x30'),_0x13d786));};AGIChannel[_0x4674('0x21')][_0x4674('0x31')]=function(_0x2caba6){return this['sendRequest'](util['format'](_0x4674('0x32'),_0x2caba6));};AGIChannel[_0x4674('0x21')][_0x4674('0x33')]=function(_0x53b43e){return this[_0x4674('0x22')](util[_0x4674('0x28')]('SET\x20PRIORITY\x20%s',_0x53b43e));};AGIChannel[_0x4674('0x21')]['hangup']=function(){return this[_0x4674('0x22')](_0x4674('0x34'));};AGIChannel[_0x4674('0x21')][_0x4674('0x35')]=function(_0x586b0b,_0x5a278a){var _0x5af9fb=_[_0x4674('0x36')](_0x5a278a)||_[_0x4674('0x37')](_0x5a278a)?_0x5a278a['toString']():_0x5a278a;return this[_0x4674('0x22')](util[_0x4674('0x28')](_0x4674('0x38'),_0x586b0b,_0x5af9fb?_0x5af9fb[_0x4674('0x39')]()[_0x4674('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4674('0x21')]['sayNumber']=function(_0x15f8f0,_0x492419){return this['sendRequest'](util[_0x4674('0x28')](_0x4674('0x3a'),_0x15f8f0,_0x492419));};AGIChannel[_0x4674('0x21')][_0x4674('0x3b')]=function(_0x2e7c90,_0x2dee50){return this['sendRequest'](util['format'](_0x4674('0x3c'),_0x2e7c90,_0x2dee50));};AGIChannel[_0x4674('0x21')]['sayPhonetic']=function(_0x2af595,_0x151b02){return this['sendRequest'](util[_0x4674('0x28')](_0x4674('0x3d'),_0x2af595,_0x151b02));};AGIChannel[_0x4674('0x21')][_0x4674('0x3e')]=function(_0x4e007f,_0x3db662,_0x4b5b2f){_0x3db662=_0x3db662||this[_0x4674('0x3f')];_0x4b5b2f=_0x4b5b2f||0x1;this[_0x4674('0x40')](_0x4e007f);this['setExtension'](_0x3db662);this[_0x4674('0x33')](_0x4b5b2f);return this[_0x4674('0x2a')](util[_0x4674('0x28')](_0x4674('0x41'),_0x4e007f,_0x3db662,_0x4b5b2f));};AGIChannel[_0x4674('0x21')][_0x4674('0x42')]=function(_0x2663d1){return this[_0x4674('0x22')](util[_0x4674('0x28')](_0x4674('0x43'),_0x2663d1));};AGIChannel[_0x4674('0x21')]['recordFile']=function(_0x873e80,_0x39328f,_0x10f63f,_0x240afe,_0x2d757e,_0x19be18){_0x39328f=_0x39328f||_0x4674('0x44');_0x10f63f=_0x10f63f||'';_0x240afe=_0x240afe===undefined?-0x1:_0x240afe==='-1'?-0x1:_0x240afe*0x3e8;_0x2d757e=_0x2d757e===undefined?'':'s='+_0x2d757e;_0x19be18=_0x19be18?_0x4674('0x45'):'';return this[_0x4674('0x22')](util[_0x4674('0x28')](_0x4674('0x46'),_0x873e80,_0x39328f,_0x10f63f,_0x240afe,_0x19be18,_0x2d757e));};AGIChannel[_0x4674('0x21')][_0x4674('0x47')]=function(_0x18a460,_0x481636){_0x481636=_0x481636||'';return this[_0x4674('0x22')](util[_0x4674('0x28')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x18a460,_0x481636));};AGIChannel[_0x4674('0x21')]['agi']=function(_0x33a113){return this[_0x4674('0x2d')]('AGI',_0x33a113);};AGIChannel['prototype'][_0x4674('0x48')]=function(_0x19eedc){return this[_0x4674('0x2d')](_0x4674('0x49'),_0x19eedc);};AGIChannel[_0x4674('0x21')][_0x4674('0x16')]=function(_0xdb8a7e,_0x3db43e){this[_0x4674('0x2a')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0xdb8a7e['id'],_0xdb8a7e[_0x4674('0x4a')],_0x3db43e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4674('0x4b')]=AGIChannel; \ No newline at end of file +var _0xa742=['AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','emit','toLowerCase','hangup','substring','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','sendRequest','prototype','answer','ANSWER','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0xa742,0xc7));var _0x2a74=function(_0x851d2b,_0x22fa94){_0x851d2b=_0x851d2b-0x0;var _0x5253a8=_0xa742[_0x851d2b];return _0x5253a8;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require('events')[_0x2a74('0x0')];var AGIReply=require(_0x2a74('0x1'));var AGIError=require('./error');function AGIChannel(_0x521a66){var _0x3b4081=this,_0x555ddc=new AGIReply(),_0x460764=![],_0x45bb06={};EventEmitter[_0x2a74('0x2')](_0x3b4081);_0x521a66[_0x2a74('0x3')](_0x2a74('0x4'));_0x521a66[_0x2a74('0x5')](0x8*0x3c*0x3c*0x3e8);_0x555ddc[_0x2a74('0x3')](_0x2a74('0x4'));_0x555ddc['on'](_0x2a74('0x6'),function(_0x2ad653){for(var _0x4d84d1 in _0x2ad653){_0x3b4081[_0x4d84d1]=_0x2ad653[_0x4d84d1];}_0x3b4081[_0x2a74('0x7')]('ready');});_0x555ddc['on']('line',function(_0x1ddab2){if(_0x1ddab2[_0x2a74('0x8')]()==_0x2a74('0x9')){_0x3b4081[_0x2a74('0x7')]('hangup');return;}if(_0x1ddab2[_0x2a74('0xa')](0x0,0xb)=='520-Invalid'){_0x460764=!![];}if(_0x460764){_0x45bb06['rx']+=_0x1ddab2+'\x0a';if(_0x1ddab2['search']('520\x20End\x20of\x20proper')!=-0x1){_0x460764=![];}}else{_0x45bb06['rx']=_0x1ddab2;}if(_0x460764){return;}if(typeof _0x45bb06['cb']=='function'){var _0x3867ae=_0x45bb06['rx'][_0x2a74('0xa')](0x0,0x3),_0x526011=null,_0x5e1fac=null;_0x3867ae=parseInt(_0x3867ae);if(isNaN(_0x3867ae)){_0x45bb06['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x2a74('0xb')});return;}if(_0x3867ae!=0xc8){_0x45bb06['cb'](null,{'code':_0x3867ae,'result':-0x1,'extra':'KO'});return;}_0x526011=_0x45bb06['rx'][_0x2a74('0xa')](0x4)[_0x2a74('0xc')](_0x2a74('0xd'),'');if(_0x526011[_0x2a74('0xe')]('\x20')!=-0x1){_0x526011=_0x526011[_0x2a74('0xf')](0x0,_0x526011[_0x2a74('0xe')]('\x20'));}if(_[_0x2a74('0x10')](_0x526011,'-1')){_0x526011=parseInt(_0x526011);}_0x5e1fac=_0x45bb06['rx'][_0x2a74('0x11')]('\x20');if(_0x5e1fac[_0x2a74('0x12')]==0x3){_0x5e1fac=_0x5e1fac[0x2][_0x2a74('0xa')](0x1,_0x5e1fac[0x2][_0x2a74('0x12')]-0x1);}else if(_0x5e1fac['length']>0x3){var _0x1f9fd6=/\((.+)\)/;var _0x5760d6=_0x45bb06['rx'][_0x2a74('0x13')](_0x1f9fd6);if(_0x5760d6){_0x5e1fac=_0x5760d6[0x1];}else{_0x5e1fac=null;}}else{_0x5e1fac=null;}_0x45bb06['cb'](null,{'code':_0x3867ae,'result':_0x526011,'extra':_0x5e1fac});}});_0x521a66['on'](_0x2a74('0x14'),function(_0x1c249d){_0x3b4081[_0x2a74('0x7')](_0x2a74('0x14'),new AGIError(_0x2a74('0x15'),_0x1c249d[_0x2a74('0x16')]));});_0x521a66['on']('close',function(){_0x3b4081['emit'](_0x2a74('0x17'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x521a66['on'](_0x2a74('0x18'),function(){_0x3b4081[_0x2a74('0x7')](_0x2a74('0x18'),new AGIError(_0x2a74('0x19')));_0x521a66[_0x2a74('0x1a')]();});_0x521a66[_0x2a74('0x1b')](_0x555ddc);this[_0x2a74('0x1c')]=function(_0x15ccf6,_0x3e760b){var _0x15ccf6=_0x15ccf6||'',_0x3e760b=typeof _0x3e760b=='function'?_0x3e760b:new Function();_0x45bb06={'tx':_0x15ccf6,'rx':'','cb':_0x3e760b};_0x521a66[_0x2a74('0x1d')](_0x15ccf6+'\x0a');},this[_0x2a74('0x17')]=function(){_0x521a66[_0x2a74('0x1a')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x2a74('0x1e')]=function(_0xb4fa29){return this[_0x2a74('0x1c')]['sync'](this,_0xb4fa29);};AGIChannel[_0x2a74('0x1f')][_0x2a74('0x20')]=function(){return this[_0x2a74('0x1e')](_0x2a74('0x21'));};AGIChannel[_0x2a74('0x1f')]['getData']=function(_0x493bac,_0xc91467,_0x1e6c76){_0x493bac=_0x493bac===undefined?'beep':_0x493bac;_0xc91467=_0xc91467===undefined?'5':_0xc91467;_0x1e6c76=_0x1e6c76===undefined?'1':_0x1e6c76;return this[_0x2a74('0x1e')](util[_0x2a74('0x22')](_0x2a74('0x23'),_0x493bac,_0xc91467*0x3e8,_0x1e6c76));};AGIChannel[_0x2a74('0x1f')]['noop']=function(_0x221179){_0x221179=_0x221179||_0x2a74('0x24');return this[_0x2a74('0x1e')](util[_0x2a74('0x22')](_0x2a74('0x25'),_0x221179));};AGIChannel[_0x2a74('0x1f')][_0x2a74('0x26')]=function(_0xf78e97,_0x7859d){if(_[_0x2a74('0x27')](_0x7859d)){return this['sendRequest'](util[_0x2a74('0x22')](_0x2a74('0x28'),_0xf78e97,_0x7859d[_0x2a74('0x29')](',')));}return this[_0x2a74('0x1e')](util['format']('EXEC\x20%s\x20%s',_0xf78e97,_0x7859d));};AGIChannel[_0x2a74('0x1f')]['setContext']=function(_0x1a2a0c){return this['sendRequest'](util[_0x2a74('0x22')](_0x2a74('0x2a'),_0x1a2a0c));};AGIChannel['prototype'][_0x2a74('0x2b')]=function(_0x261d8d){return this[_0x2a74('0x1e')](util['format'](_0x2a74('0x2c'),_0x261d8d));};AGIChannel[_0x2a74('0x1f')][_0x2a74('0x2d')]=function(_0x2ad323){return this['sendRequest'](util['format'](_0x2a74('0x2e'),_0x2ad323));};AGIChannel['prototype'][_0x2a74('0x9')]=function(){return this['sendRequest'](_0x2a74('0x2f'));};AGIChannel[_0x2a74('0x1f')][_0x2a74('0x30')]=function(_0x455f85,_0xde3edb){var _0x3e70c8=_[_0x2a74('0x31')](_0xde3edb)||_['isNumber'](_0xde3edb)?_0xde3edb[_0x2a74('0x32')]():_0xde3edb;return this[_0x2a74('0x1e')](util[_0x2a74('0x22')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x455f85,_0x3e70c8?_0x3e70c8[_0x2a74('0x32')]()[_0x2a74('0xc')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2a74('0x1f')]['sayNumber']=function(_0x47c41f,_0x2cef59){return this[_0x2a74('0x1e')](util[_0x2a74('0x22')](_0x2a74('0x33'),_0x47c41f,_0x2cef59));};AGIChannel[_0x2a74('0x1f')]['sayDigits']=function(_0x5e14bd,_0x3ef60a){return this[_0x2a74('0x1e')](util[_0x2a74('0x22')](_0x2a74('0x34'),_0x5e14bd,_0x3ef60a));};AGIChannel[_0x2a74('0x1f')]['sayPhonetic']=function(_0x16905c,_0x9b92d9){return this[_0x2a74('0x1e')](util[_0x2a74('0x22')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x16905c,_0x9b92d9));};AGIChannel[_0x2a74('0x1f')][_0x2a74('0x35')]=function(_0x59a2a8,_0x1d4db0,_0x3e10f4){_0x1d4db0=_0x1d4db0||this[_0x2a74('0x36')];_0x3e10f4=_0x3e10f4||0x1;this['setContext'](_0x59a2a8);this[_0x2a74('0x2b')](_0x1d4db0);this[_0x2a74('0x2d')](_0x3e10f4);return this[_0x2a74('0x37')](util[_0x2a74('0x22')](_0x2a74('0x38'),_0x59a2a8,_0x1d4db0,_0x3e10f4));};AGIChannel['prototype']['getVariable']=function(_0x4b7eea){return this[_0x2a74('0x1e')](util[_0x2a74('0x22')](_0x2a74('0x39'),_0x4b7eea));};AGIChannel[_0x2a74('0x1f')][_0x2a74('0x3a')]=function(_0x303d40,_0xa2229,_0x23a4a4,_0x58ef5e,_0x15322d,_0x19a7e6){_0xa2229=_0xa2229||'wav';_0x23a4a4=_0x23a4a4||'';_0x58ef5e=_0x58ef5e===undefined?-0x1:_0x58ef5e==='-1'?-0x1:_0x58ef5e*0x3e8;_0x15322d=_0x15322d===undefined?'':'s='+_0x15322d;_0x19a7e6=_0x19a7e6?'BEEP':'';return this[_0x2a74('0x1e')](util[_0x2a74('0x22')](_0x2a74('0x3b'),_0x303d40,_0xa2229,_0x23a4a4,_0x58ef5e,_0x19a7e6,_0x15322d));};AGIChannel['prototype']['streamFile']=function(_0x5d3cf3,_0x40e5e1){_0x40e5e1=_0x40e5e1||'';return this['sendRequest'](util[_0x2a74('0x22')](_0x2a74('0x3c'),_0x5d3cf3,_0x40e5e1));};AGIChannel[_0x2a74('0x1f')]['agi']=function(_0x346f0d){return this['exec'](_0x2a74('0x3d'),_0x346f0d);};AGIChannel[_0x2a74('0x1f')]['wait']=function(_0x5b239c){return this['exec'](_0x2a74('0x3e'),_0x5b239c);};AGIChannel[_0x2a74('0x1f')][_0x2a74('0x14')]=function(_0x4132b5,_0x34d37c){this[_0x2a74('0x37')](util['format'](_0x2a74('0x3f'),_0x4132b5['id'],_0x4132b5['label'],_0x34d37c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x2a74('0x40')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 5404ab6..334770a 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 _0x55df=['format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x55df,0x16a));var _0xf55d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x55df[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0xf55d('0x0'));var error={'E_AGI_UNDEFINED':_0xf55d('0x1'),'E_AGI_ARGUMENT_PORT':_0xf55d('0x2'),'E_AGI_SERVER_ERROR':_0xf55d('0x3'),'E_AGI_SERVER_CLOSE':_0xf55d('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xf55d('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xf55d('0x6'),'E_AGI_SOCKET_ERROR':_0xf55d('0x7'),'E_AGI_SOCKET_CLOSE':_0xf55d('0x8'),'E_AGI_SOCKET_TIMEOUT':_0xf55d('0x9'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xf55d('0xa'),'E_AGI_IVR_ENTRY':_0xf55d('0xb')};function AGIError(_0x1d4937){var _0x1d4937=_0x1d4937||null,_0x5223ed=_0x5223ed||[],_0x3842c7=0x1,_0x24a300='';if(!error[_0x1d4937]){_0x1d4937='E_AGI_UNDEFINED';}_0x5223ed['push'](error[_0x1d4937]);while(arguments[_0x3842c7]){_0x5223ed['push'](arguments[_0x3842c7]);_0x3842c7++;}_0x24a300=util[_0xf55d('0xc')][_0xf55d('0xd')](util,_0x5223ed);this[_0xf55d('0xe')]=_0x24a300;this[_0xf55d('0xf')]=_0x1d4937;}module[_0xf55d('0x10')]=AGIError; \ No newline at end of file +var _0xd18a=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xd18a,0x89));var _0xad18=function(_0x58b29f,_0x50dc9b){_0x58b29f=_0x58b29f-0x0;var _0x46595c=_0xd18a[_0x58b29f];return _0x46595c;};'use strict';var util=require(_0xad18('0x0'));var error={'E_AGI_UNDEFINED':_0xad18('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xad18('0x2'),'E_AGI_SERVER_CLOSE':_0xad18('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xad18('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xad18('0x5'),'E_AGI_SOCKET_CLOSE':_0xad18('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xad18('0x7'),'E_AGI_COMMAND_EMPTY':_0xad18('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xad18('0x9'),'E_AGI_IVR_ENTRY':_0xad18('0xa')};function AGIError(_0x310e88){var _0x310e88=_0x310e88||null,_0x4f1f09=_0x4f1f09||[],_0x26ea6c=0x1,_0x1dd1fd='';if(!error[_0x310e88]){_0x310e88=_0xad18('0xb');}_0x4f1f09[_0xad18('0xc')](error[_0x310e88]);while(arguments[_0x26ea6c]){_0x4f1f09['push'](arguments[_0x26ea6c]);_0x26ea6c++;}_0x1dd1fd=util['format'][_0xad18('0xd')](util,_0x4f1f09);this['message']=_0x1dd1fd;this[_0xad18('0xe')]=_0x310e88;}module[_0xad18('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 8523494..417f987 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14f7=['EventEmitter','ioredis','../../config/environment','redis','defaults','subscribe','error','E_AGI_SERVER_ERROR','message','emit','projectUpdate','exports','lodash','events'];(function(_0x4e7185,_0x316607){var _0x54ecb6=function(_0x2e427c){while(--_0x2e427c){_0x4e7185['push'](_0x4e7185['shift']());}};_0x54ecb6(++_0x316607);}(_0x14f7,0x15c));var _0x714f=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x14f7[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x714f('0x0'));var EventEmitter=require(_0x714f('0x1'))[_0x714f('0x2')];var Redis=require(_0x714f('0x3'));var AGIError=require('./error');var config=require(_0x714f('0x4'));config[_0x714f('0x5')]=_[_0x714f('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x714f('0x5')]);sub[_0x714f('0x7')]('agi',function(_0x50beb0){if(_0x50beb0)return eventEmitter['emit'](_0x714f('0x8'),new AGIError(_0x714f('0x9'),_0x50beb0));});sub['on'](_0x714f('0xa'),function(_0x49f2f8,_0x543d97){if(_0x49f2f8!=='agi')return;try{var _0x99702a=JSON['parse'](_0x543d97);eventEmitter[_0x714f('0xb')](_0x714f('0xc'),_0x99702a);}catch(_0x4f2a10){eventEmitter[_0x714f('0xb')](_0x714f('0x8'),new AGIError(_0x714f('0x9'),_0x4f2a10));}});module[_0x714f('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xc205=['message','parse','projectUpdate','emit','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','subscribe','agi','error','E_AGI_SERVER_ERROR'];(function(_0x447bf0,_0x22fe51){var _0x1e2325=function(_0x1f2f81){while(--_0x1f2f81){_0x447bf0['push'](_0x447bf0['shift']());}};_0x1e2325(++_0x22fe51);}(_0xc205,0x1f2));var _0x5c20=function(_0x547e4a,_0x516c2a){_0x547e4a=_0x547e4a-0x0;var _0x157121=_0xc205[_0x547e4a];return _0x157121;};'use strict';var _=require(_0x5c20('0x0'));var EventEmitter=require(_0x5c20('0x1'))[_0x5c20('0x2')];var Redis=require(_0x5c20('0x3'));var AGIError=require(_0x5c20('0x4'));var config=require(_0x5c20('0x5'));config[_0x5c20('0x6')]=_[_0x5c20('0x7')](config[_0x5c20('0x6')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x5c20('0x6')]);sub[_0x5c20('0x8')](_0x5c20('0x9'),function(_0xe19a5d){if(_0xe19a5d)return eventEmitter['emit'](_0x5c20('0xa'),new AGIError(_0x5c20('0xb'),_0xe19a5d));});sub['on'](_0x5c20('0xc'),function(_0x2b4773,_0x484b61){if(_0x2b4773!==_0x5c20('0x9'))return;try{var _0x3255f2=JSON[_0x5c20('0xd')](_0x484b61);eventEmitter['emit'](_0x5c20('0xe'),_0x3255f2);}catch(_0x1abd97){eventEmitter[_0x5c20('0xf')](_0x5c20('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x1abd97));}});module[_0x5c20('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 1375167..33d79b2 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 _0x11e7=['no\x20edge/s\x20available','length','condition','split','agicommand','vswitch','target','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','stop\x20traverse','info'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x11e7,0x10e));var _0x711e=function(_0x90489f,_0x51f02c){_0x90489f=_0x90489f-0x0;var _0x122f1e=_0x11e7[_0x90489f];return _0x122f1e;};'use strict';var _=require(_0x711e('0x0'));var logger=require(_0x711e('0x1'))(_0x711e('0x2'));var verticesWithRetry=[_0x711e('0x3'),_0x711e('0x4'),_0x711e('0x5')];var Graph=function(){this[_0x711e('0x6')]={};this[_0x711e('0x7')]={};this[_0x711e('0x8')]=0x0;};Graph[_0x711e('0x9')][_0x711e('0xa')]=function(_0x4bf11c){this[_0x711e('0x6')][_0x4bf11c['id']]=_0x4bf11c;this[_0x711e('0x7')][_0x4bf11c['id']]=[];};Graph[_0x711e('0x9')][_0x711e('0xb')]=function(_0x4ace4e,_0x65af07,_0x5930fd){this[_0x711e('0x7')][_0x4ace4e][_0x711e('0xc')]({'target':_0x65af07,'condition':_0x5930fd});this[_0x711e('0x8')]+=0x1;};Graph[_0x711e('0x9')][_0x711e('0xd')]=function(){return _[_0x711e('0xd')](this[_0x711e('0x6')]);};Graph['prototype'][_0x711e('0xe')]=function(){return this[_0x711e('0x8')];};Graph['prototype'][_0x711e('0xf')]=function(_0x491fe1){return this[_0x711e('0x6')][_0x491fe1];};Graph['prototype'][_0x711e('0x10')]=function(_0x4cc31d,_0x3045dd){if(!this[_0x711e('0x6')][_0x4cc31d]){return logger['info'](_0x711e('0x11'));}var _0x9d62fd=_0x3045dd(this[_0x711e('0x6')][_0x4cc31d]);if(!_0x9d62fd){return logger['info'](_0x711e('0x12'));}if(this[_0x711e('0x7')][_0x4cc31d]['length']===0x0){return logger[_0x711e('0x13')](_0x711e('0x14'));}for(var _0x39e6de=0x0,_0x287ed0=[],_0x32e4c2=![];_0x39e6de\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','agi_','substring','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','find','production','handleUnpublished','initialize','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','finally','./server','connection','lodash','syncho','util','../../config/logger','agi','../../config/license/util','./events','EventEmitter','127.0.0.1','projectUpdate','nextTick','error','stack','deleted','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','[%s]\x20%s','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid'];(function(_0x43547c,_0x7fa379){var _0x38d944=function(_0x5e401f){while(--_0x5e401f){_0x43547c['push'](_0x43547c['shift']());}};_0x38d944(++_0x7fa379);}(_0x068a,0xbf));var _0xa068=function(_0x4010b4,_0x417559){_0x4010b4=_0x4010b4-0x0;var _0x73c218=_0x068a[_0x4010b4];return _0x73c218;};'use strict';var _=require(_0xa068('0x0'));var syncho=require(_0xa068('0x1'));var util=require(_0xa068('0x2'));var config=require('../../config/environment');var logger=require(_0xa068('0x3'))(_0xa068('0x4'));var utilLicense=require(_0xa068('0x5'));var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require(_0xa068('0x6'))[_0xa068('0x7')];var projects=[];config[_0xa068('0x4')]=_['defaults'](config[_0xa068('0x4')],{'ip':_0xa068('0x8'),'port':0x11dd});AGIEmitter['on'](_0xa068('0x9'),projectUpdateHandler);function connectionHandler(_0x2610f7){process[_0xa068('0xa')](function(){syncho(function(){try{setChannelVariables(_0x2610f7);agiHandler(_0x2610f7);}catch(_0x4c6c3f){logger[_0xa068('0xb')](_0x4c6c3f[_0xa068('0xc')]);}});});}function projectUpdateHandler(_0x4df028){try{var _0x3e4833=_['findIndex'](projects,['id',_0x4df028['id']]);if(_0x3e4833>-0x1){if(_0x4df028[_0xa068('0xd')]===!![]){projects['splice'](_0x3e4833,0x1);}else{projects[_0x3e4833]=_0x4df028;}}else{projects['push'](_0x4df028);}}catch(_0x2bf7f7){logger[_0xa068('0xb')](_0x2bf7f7[_0xa068('0xc')]);}}function listeningHandler(){console[_0xa068('0xe')](_0xa068('0xf'),config[_0xa068('0x4')]['port']);logger[_0xa068('0x10')](util[_0xa068('0x11')](_0xa068('0x12'),config['agi']['ip'],config[_0xa068('0x4')][_0xa068('0x13')]));}function errorHandler(_0x43753c){if(_0x43753c&&_0x43753c[_0xa068('0x14')]&&_0x43753c['message']){logger[_0xa068('0xb')](util[_0xa068('0x11')](_0xa068('0x15'),_0x43753c[_0xa068('0x14')],_0x43753c[_0xa068('0x16')]));}else{logger[_0xa068('0xb')](util['format'](_0xa068('0x17'),_0x43753c[_0xa068('0xc')]));}}function closeHandler(){logger[_0xa068('0x10')](util['format'](_0xa068('0x18'),this[_0xa068('0x19')],this[_0xa068('0x1a')],this[_0xa068('0x1b')],this[_0xa068('0x1c')],this[_0xa068('0x1d')]));try{createSquareReport(this);}catch(_0x859d53){logger['error'](_0x859d53[_0xa068('0xc')]);}}function timeoutHandler(){logger['info'](util[_0xa068('0x11')](_0xa068('0x1e'),this[_0xa068('0x19')],this[_0xa068('0x1a')],this[_0xa068('0x1b')],this[_0xa068('0x1c')],this[_0xa068('0x1d')]));}function hangupHandler(){logger['info'](util[_0xa068('0x11')](_0xa068('0x1f'),this[_0xa068('0x19')],this[_0xa068('0x1a')],this[_0xa068('0x1b')],this[_0xa068('0x1c')],this[_0xa068('0x1d')]));this['evtHangup']=!![];}function createSquareReport(_0x2700fe,_0x22b691){rpc['createSquareReport'](_0x2700fe)['then'](function(_0x4e6b2f){if(_0x22b691){_0x22b691(null,_0x4e6b2f);}})['catch'](function(_0x201343){if(_0x22b691){_0x22b691(null,_0x201343);}});}function setChannelVariables(_0x3f0031){for(var _0x4fbf3d in _0x3f0031){if(_0x3f0031['hasOwnProperty'](_0x4fbf3d)){if(_0x4fbf3d['indexOf'](_0xa068('0x20'))===0x0){_0x3f0031[_0x4fbf3d[_0xa068('0x21')](0x4)]=_0x3f0031[_0x4fbf3d];delete _0x3f0031[_0x4fbf3d];}}}}function agiHandler(_0x5e6718){logger[_0xa068('0x22')]('variables',JSON[_0xa068('0x23')](_0x5e6718,null,0x2));logger['info'](util[_0xa068('0x11')](_0xa068('0x24'),_0x5e6718[_0xa068('0x19')],_0x5e6718[_0xa068('0x1a')],_0x5e6718['callerid'],_0x5e6718['dnid'],_0x5e6718['uniqueid']));_0x5e6718['on'](_0xa068('0xb'),errorHandler);_0x5e6718['on'](_0xa068('0x25'),closeHandler);_0x5e6718['on'](_0xa068('0x26'),timeoutHandler);_0x5e6718[_0xa068('0x27')]=![];_0x5e6718['on'](_0xa068('0x28'),hangupHandler);var _0x459c3d=_[_0xa068('0x29')](projects,['name',_0x5e6718['arg_1']]);if(!_0x459c3d)return Project['handleNotFound'](_0x5e6718);if(!_0x459c3d[_0xa068('0x2a')])return Project[_0xa068('0x2b')](_0x5e6718);return Project[_0xa068('0x2c')](_0x459c3d,_0x5e6718);}function main(){var _0x10beba;return utilLicense['getLicense']()[_0xa068('0x2d')](function(_0x4a2b69){if(!_0x4a2b69)return;if(_0x4a2b69[_0xa068('0x2e')]){if(_0x4a2b69[_0xa068('0x2f')]&&_0x4a2b69[_0xa068('0x2f')]>0x0){logger[_0xa068('0x10')](util[_0xa068('0x11')](_0xa068('0x30'),_0x4a2b69[_0xa068('0x2f')]));_0x10beba=_0x4a2b69[_0xa068('0x2f')];}else{logger['info'](_0xa068('0x31'));}}else{logger['info'](_0xa068('0x32'));_0x10beba=-0x1;}})[_0xa068('0x2d')](function(){return Project['getAll']();})[_0xa068('0x2d')](function(_0x1098c7){projects=_0x1098c7;return;})[_0xa068('0x33')](function(_0x4a7718){logger['error']('[LICENSE]',_0x4a7718[_0xa068('0xc')]);})[_0xa068('0x34')](function(){var _0xaea3ed=require(_0xa068('0x35'))(config[_0xa068('0x4')][_0xa068('0x13')],config['agi']['ip'],_0x10beba);_0xaea3ed['on'](_0xa068('0xb'),errorHandler);_0xaea3ed['on']('listening',listeningHandler);_0xaea3ed['on'](_0xa068('0x36'),connectionHandler);_0xaea3ed['on'](_0xa068('0x25'),closeHandler);});}main(); \ No newline at end of file +var _0xe9ed=['stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','find','handleNotFound','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','finally','./server','listening','connection','close','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','deleted','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%s]\x20%s','[ERROR]\x20%s','arg_1','calleridname','dnid','info','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables'];(function(_0x3e2489,_0x41d9dd){var _0x2254ce=function(_0x227e46){while(--_0x227e46){_0x3e2489['push'](_0x3e2489['shift']());}};_0x2254ce(++_0x41d9dd);}(_0xe9ed,0x1bc));var _0xde9e=function(_0x5482fb,_0x515e8b){_0x5482fb=_0x5482fb-0x0;var _0x299da2=_0xe9ed[_0x5482fb];return _0x299da2;};'use strict';var _=require(_0xde9e('0x0'));var syncho=require(_0xde9e('0x1'));var util=require(_0xde9e('0x2'));var config=require(_0xde9e('0x3'));var logger=require(_0xde9e('0x4'))(_0xde9e('0x5'));var utilLicense=require(_0xde9e('0x6'));var rpc=require(_0xde9e('0x7'));var Project=require(_0xde9e('0x8'));var AGIEmitter=require(_0xde9e('0x9'))['EventEmitter'];var projects=[];config['agi']=_[_0xde9e('0xa')](config[_0xde9e('0x5')],{'ip':_0xde9e('0xb'),'port':0x11dd});AGIEmitter['on'](_0xde9e('0xc'),projectUpdateHandler);function connectionHandler(_0x1bb393){process[_0xde9e('0xd')](function(){syncho(function(){try{setChannelVariables(_0x1bb393);agiHandler(_0x1bb393);}catch(_0x401e8b){logger[_0xde9e('0xe')](_0x401e8b[_0xde9e('0xf')]);}});});}function projectUpdateHandler(_0x27a505){try{var _0x30cc9b=_['findIndex'](projects,['id',_0x27a505['id']]);if(_0x30cc9b>-0x1){if(_0x27a505[_0xde9e('0x10')]===!![]){projects[_0xde9e('0x11')](_0x30cc9b,0x1);}else{projects[_0x30cc9b]=_0x27a505;}}else{projects['push'](_0x27a505);}}catch(_0x906bf){logger['error'](_0x906bf[_0xde9e('0xf')]);}}function listeningHandler(){console[_0xde9e('0x12')](_0xde9e('0x13'),config['agi'][_0xde9e('0x14')]);logger['info'](util['format'](_0xde9e('0x15'),config[_0xde9e('0x5')]['ip'],config[_0xde9e('0x5')][_0xde9e('0x14')]));}function errorHandler(_0x29d0ab){if(_0x29d0ab&&_0x29d0ab[_0xde9e('0x16')]&&_0x29d0ab[_0xde9e('0x17')]){logger[_0xde9e('0xe')](util[_0xde9e('0x18')](_0xde9e('0x19'),_0x29d0ab['name'],_0x29d0ab[_0xde9e('0x17')]));}else{logger[_0xde9e('0xe')](util[_0xde9e('0x18')](_0xde9e('0x1a'),_0x29d0ab[_0xde9e('0xf')]));}}function closeHandler(){logger['info'](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xde9e('0x1b')],this[_0xde9e('0x1c')],this['callerid'],this[_0xde9e('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x47b6d5){logger[_0xde9e('0xe')](_0x47b6d5['stack']);}}function timeoutHandler(){logger[_0xde9e('0x1e')](util[_0xde9e('0x18')](_0xde9e('0x1f'),this[_0xde9e('0x1b')],this[_0xde9e('0x1c')],this['callerid'],this[_0xde9e('0x1d')],this[_0xde9e('0x20')]));}function hangupHandler(){logger[_0xde9e('0x1e')](util[_0xde9e('0x18')](_0xde9e('0x21'),this[_0xde9e('0x1b')],this[_0xde9e('0x1c')],this[_0xde9e('0x22')],this[_0xde9e('0x1d')],this[_0xde9e('0x20')]));this['evtHangup']=!![];}function createSquareReport(_0x56266f,_0x234f01){rpc[_0xde9e('0x23')](_0x56266f)[_0xde9e('0x24')](function(_0x13742d){if(_0x234f01){_0x234f01(null,_0x13742d);}})[_0xde9e('0x25')](function(_0x4beae9){if(_0x234f01){_0x234f01(null,_0x4beae9);}});}function setChannelVariables(_0x6ad3){for(var _0x32affe in _0x6ad3){if(_0x6ad3[_0xde9e('0x26')](_0x32affe)){if(_0x32affe[_0xde9e('0x27')](_0xde9e('0x28'))===0x0){_0x6ad3[_0x32affe[_0xde9e('0x29')](0x4)]=_0x6ad3[_0x32affe];delete _0x6ad3[_0x32affe];}}}}function agiHandler(_0x379f9b){logger[_0xde9e('0x2a')](_0xde9e('0x2b'),JSON[_0xde9e('0x2c')](_0x379f9b,null,0x2));logger['info'](util[_0xde9e('0x18')](_0xde9e('0x2d'),_0x379f9b[_0xde9e('0x1b')],_0x379f9b['calleridname'],_0x379f9b['callerid'],_0x379f9b['dnid'],_0x379f9b[_0xde9e('0x20')]));_0x379f9b['on'](_0xde9e('0xe'),errorHandler);_0x379f9b['on']('close',closeHandler);_0x379f9b['on']('timeout',timeoutHandler);_0x379f9b['evtHangup']=![];_0x379f9b['on'](_0xde9e('0x2e'),hangupHandler);var _0x360678=_[_0xde9e('0x2f')](projects,[_0xde9e('0x16'),_0x379f9b[_0xde9e('0x1b')]]);if(!_0x360678)return Project[_0xde9e('0x30')](_0x379f9b);if(!_0x360678['production'])return Project['handleUnpublished'](_0x379f9b);return Project[_0xde9e('0x31')](_0x360678,_0x379f9b);}function main(){var _0x1c17cf;return utilLicense[_0xde9e('0x32')]()['then'](function(_0x5b0d2d){if(!_0x5b0d2d)return;if(_0x5b0d2d[_0xde9e('0x33')]){if(_0x5b0d2d['callysquare']&&_0x5b0d2d[_0xde9e('0x34')]>0x0){logger[_0xde9e('0x1e')](util[_0xde9e('0x18')](_0xde9e('0x35'),_0x5b0d2d[_0xde9e('0x34')]));_0x1c17cf=_0x5b0d2d[_0xde9e('0x34')];}else{logger[_0xde9e('0x1e')](_0xde9e('0x36'));}}else{logger['info'](_0xde9e('0x37'));_0x1c17cf=-0x1;}})['then'](function(){return Project['getAll']();})[_0xde9e('0x24')](function(_0x7dffeb){projects=_0x7dffeb;return;})[_0xde9e('0x25')](function(_0xdb5024){logger[_0xde9e('0xe')]('[LICENSE]',_0xdb5024[_0xde9e('0xf')]);})[_0xde9e('0x38')](function(){var _0x164bb6=require(_0xde9e('0x39'))(config[_0xde9e('0x5')][_0xde9e('0x14')],config[_0xde9e('0x5')]['ip'],_0x1c17cf);_0x164bb6['on']('error',errorHandler);_0x164bb6['on'](_0xde9e('0x3a'),listeningHandler);_0x164bb6['on'](_0xde9e('0x3b'),connectionHandler);_0x164bb6['on'](_0xde9e('0x3c'),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 2a1bf16..052a124 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 _0xfd64=['SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result','sendMailMessage'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xfd64,0x114));var _0x4fd6=function(_0x582240,_0x2064df){_0x582240=_0x582240-0x0;var _0x3caef4=_0xfd64[_0x582240];return _0x3caef4;};'use strict';var BPromise=require(_0x4fd6('0x0'));var jayson=require(_0x4fd6('0x1'));var client=jayson[_0x4fd6('0x2')][_0x4fd6('0x3')]({'port':0x232b});function request(_0x5b93ec,_0x18a402){return new BPromise(function(_0x3a028b,_0x3b57e2){return client[_0x4fd6('0x4')](_0x5b93ec,_0x18a402)[_0x4fd6('0x5')](function(_0x1da782){if(_0x1da782['error']){return _0x3b57e2(_0x1da782[_0x4fd6('0x6')][_0x4fd6('0x7')]);}else{return _0x3a028b(_0x1da782[_0x4fd6('0x8')]);}})['catch'](function(_0x519e1e){return _0x3b57e2(_0x519e1e);});});}exports[_0x4fd6('0x9')]=function(_0x310610,_0x55b16f){return request(_0x4fd6('0xa'),{'account':_0x310610,'message':_0x55b16f});}; \ No newline at end of file +var _0x01eb=['catch','sendMailMessage','bluebird','jayson/promise','client','http','request','then','error','message','result'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x01eb,0x1f1));var _0xb01e=function(_0x1793cf,_0x583e4b){_0x1793cf=_0x1793cf-0x0;var _0x4ce5da=_0x01eb[_0x1793cf];return _0x4ce5da;};'use strict';var BPromise=require(_0xb01e('0x0'));var jayson=require(_0xb01e('0x1'));var client=jayson[_0xb01e('0x2')][_0xb01e('0x3')]({'port':0x232b});function request(_0x1d5b98,_0x2c82c0){return new BPromise(function(_0x4d98d2,_0x5e4319){return client[_0xb01e('0x4')](_0x1d5b98,_0x2c82c0)[_0xb01e('0x5')](function(_0x545ccf){if(_0x545ccf[_0xb01e('0x6')]){return _0x5e4319(_0x545ccf['error'][_0xb01e('0x7')]);}else{return _0x4d98d2(_0x545ccf[_0xb01e('0x8')]);}})[_0xb01e('0x9')](function(_0x49f35c){return _0x5e4319(_0x49f35c);});});}exports[_0xb01e('0xa')]=function(_0x13fa40,_0x376b47){return request('SendMail',{'account':_0x13fa40,'message':_0x376b47});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 694fc16..75f2ac5 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee5d=['callerid','dnid','traverseBFS','clear','debug','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','error','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','continueAt','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','agi','./rpc','./mailRpc','./vertices','getSquareProjects','catch','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','production','start','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','arg_1','calleridname'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xee5d,0x98));var _0xdee5=function(_0x32d46a,_0x2a0c47){_0x32d46a=_0x32d46a-0x0;var _0x3649fc=_0xee5d[_0x32d46a];return _0x3649fc;};'use strict';var _=require(_0xdee5('0x0'));var moment=require(_0xdee5('0x1'));var parser=require(_0xdee5('0x2'));var util=require(_0xdee5('0x3'));var logger=require('../../config/logger')(_0xdee5('0x4'));var rpc=require(_0xdee5('0x5'));var mailRpc=require(_0xdee5('0x6'));var Graph=require('./graph');var Vertices=require(_0xdee5('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xdee5('0x8')]()[_0xdee5('0x9')](function(_0x1c2ee2){logger['error']('Unable\x20to\x20download\x20CallySquare\x20projects',_0x1c2ee2[_0xdee5('0xa')]);return[];});}function addVertex(_0x59f6b1,_0x59703f,_0x56cf6a){_0x59703f[_0xdee5('0xb')]=_0x56cf6a;if(_0x59703f[_0xdee5('0xc')](_0xdee5('0xd'))){_0x59703f[_0xdee5('0xe')]=parseInt(_0x59703f[_0xdee5('0xd')],0xa);}_0x59f6b1[_0xdee5('0xf')](_[_0xdee5('0x10')](_0x59703f,_0xdee5('0x11')));}function initGraph(_0x580146,_0x4ba253){var _0x518b88=new Graph();for(var _0x4dcc53 in _0x580146){if(_0x580146[_0xdee5('0xc')](_0x4dcc53)){if(_[_0xdee5('0x12')](_0x580146[_0x4dcc53])){for(var _0x1ce96c=0x0;_0x1ce96c<_0x580146[_0x4dcc53][_0xdee5('0x13')];_0x1ce96c+=0x1){addVertex(_0x518b88,_0x580146[_0x4dcc53][_0x1ce96c],_0x4dcc53);}}else{addVertex(_0x518b88,_0x580146[_0x4dcc53],_0x4dcc53);}}}for(var _0x45ba9b=0x0;_0x45ba9b<_0x4ba253['length'];_0x45ba9b+=0x1){if(_0x4ba253[_0x45ba9b][_0xdee5('0x14')]&&_0x4ba253[_0x45ba9b][_0xdee5('0x15')]){_0x518b88[_0xdee5('0x16')](_0x4ba253[_0x45ba9b]['source'],_0x4ba253[_0x45ba9b][_0xdee5('0x15')],_0x4ba253[_0x45ba9b][_0xdee5('0x17')]);}}return _0x518b88;}function getRoot(_0x32d3cb){return parser[_0xdee5('0x18')](_0x32d3cb,{'object':!![]})[_0xdee5('0x19')][_0xdee5('0x1a')];}function inspect(_0x142030){return util['inspect'](_0x142030,{'showHidden':![],'depth':null});}function initialize(_0x42251d,_0x2a0982){var _0x419c34=getRoot(_0x42251d[_0xdee5('0x1b')]);if(!_0x419c34||!_0x419c34[_0xdee5('0x1c')])return;var _0xe7cf19,_0x3187c7,_0xcf525d;logger['debug'](_0xdee5('0x1a'),JSON['stringify'](_0x419c34,null,0x2));_0x2a0982[_0xdee5('0x1d')]=moment()[_0xdee5('0x1e')](_0xdee5('0x1f'));_0xe7cf19=initGraph(_[_0xdee5('0x10')](_0x419c34,_0xdee5('0x11')),_0x419c34[_0xdee5('0x11')]);_0x3187c7=new Vertices(_0x2a0982,rpc,mailRpc);logger['info'](util[_0xdee5('0x1e')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2a0982[_0xdee5('0x20')],_0x2a0982[_0xdee5('0x21')],_0x2a0982[_0xdee5('0x22')],_0x2a0982[_0xdee5('0x23')],_0x2a0982['uniqueid']));_0xe7cf19[_0xdee5('0x24')](_0x419c34[_0xdee5('0x1c')]['id'],function(_0x4a3169){try{_0x4a3169=_0x3187c7[_0xdee5('0x25')](_0x4a3169);logger[_0xdee5('0x26')](_0xdee5('0x27'),JSON['stringify'](_0x4a3169,null,0x2));if(_0x4a3169[_0xdee5('0xb')]===_0xdee5('0x28')){logger[_0xdee5('0x29')](_0xdee5('0x2a'));_0x2a0982[_0xdee5('0x2b')]=_0x4a3169['context']||_0x2a0982[_0xdee5('0x2b')];_0x2a0982[_0xdee5('0x2c')]=_0x4a3169[_0xdee5('0x2c')];_0x2a0982[_0xdee5('0x2d')]=_0x4a3169['priority']?_0x4a3169[_0xdee5('0x2d')]-0x1:0x1;return null;}else if(_0x4a3169&&_0x3187c7[_0x4a3169[_0xdee5('0xb')]]){_0xcf525d=_0x3187c7[_0x4a3169[_0xdee5('0xb')]](_0x4a3169);logger[_0xdee5('0x29')](_0xdee5('0x2e'),JSON['stringify'](_0xcf525d,null,0x2));if(_0xcf525d&&_0xcf525d['code']===AGI_CODE_SUCCESS&&_0xcf525d[_0xdee5('0x2f')]!==AGI_RESULT_ERROR&&!_0x2a0982[_0xdee5('0x30')]){logger['debug'](_0xdee5('0x2e'),inspect(_0xcf525d));return _[_0xdee5('0x31')](_0xcf525d[_0xdee5('0x2f')])?null:_0xcf525d[_0xdee5('0x2f')][_0xdee5('0x32')]();}else{logger['error'](_0xdee5('0x2e'),inspect(_0xcf525d));return null;}}else{logger['error'](_0xdee5('0x33'));return null;}}catch(_0x51d6d7){logger[_0xdee5('0x34')](_0x51d6d7[_0xdee5('0xa')]);return null;}});if(_0x419c34[_0xdee5('0x35')]){logger[_0xdee5('0x29')](util[_0xdee5('0x1e')](_0xdee5('0x36'),_0x2a0982[_0xdee5('0x20')],_0x2a0982[_0xdee5('0x21')],_0x2a0982[_0xdee5('0x22')],_0x2a0982[_0xdee5('0x23')],_0x2a0982['uniqueid']));_0xe7cf19['traverseBFS'](_0x419c34[_0xdee5('0x35')]['id'],function(_0x5b520c){try{_0x5b520c=_0x3187c7[_0xdee5('0x25')](_0x5b520c);logger[_0xdee5('0x26')](_0xdee5('0x27'),JSON['stringify'](_0x5b520c,null,0x2));if(_0x5b520c&&_0x3187c7[_0x5b520c[_0xdee5('0xb')]]){_0xcf525d=_0x3187c7[_0x5b520c[_0xdee5('0xb')]](_0x5b520c);if(_0xcf525d){logger[_0xdee5('0x26')](_0xdee5('0x2e'),inspect(_0xcf525d));return _[_0xdee5('0x31')](_0xcf525d[_0xdee5('0x2f')])?null:_0xcf525d[_0xdee5('0x2f')][_0xdee5('0x32')]();}else{logger[_0xdee5('0x34')]('response',inspect(_0xcf525d));return null;}}else{logger[_0xdee5('0x34')](_0xdee5('0x33'));return null;}}catch(_0x42e1a7){logger[_0xdee5('0x34')](_0x42e1a7[_0xdee5('0xa')]);return null;}});}logger['info'](util[_0xdee5('0x1e')](_0xdee5('0x37'),_0x2a0982[_0xdee5('0x20')],_0x2a0982[_0xdee5('0x21')],_0x2a0982[_0xdee5('0x22')],_0x2a0982[_0xdee5('0x23')],_0x2a0982[_0xdee5('0x38')]));logger[_0xdee5('0x29')](util[_0xdee5('0x1e')](_0xdee5('0x39'),_0x2a0982['context'],_0x2a0982[_0xdee5('0x2c')],parseInt(_0x2a0982[_0xdee5('0x2d')],0xa)+0x1));_0x2a0982['continueAt'](_0x2a0982[_0xdee5('0x2b')],_0x2a0982['extension'],parseInt(_0x2a0982[_0xdee5('0x2d')],0xa)+0x1);_0x2a0982[_0xdee5('0x3a')]();}function handleNotFound(_0x48611a){logger[_0xdee5('0x34')](util[_0xdee5('0x1e')]('Project\x20%s\x20not\x20found',_0x48611a[_0xdee5('0x20')]));_0x48611a[_0xdee5('0x3b')](_0x48611a[_0xdee5('0x2b')],_0x48611a[_0xdee5('0x2c')],parseInt(_0x48611a[_0xdee5('0x2d')],0xa)+0x1);_0x48611a['close']();}function handleUnpublished(_0x514d5d){logger['error'](util[_0xdee5('0x1e')](_0xdee5('0x3c'),_0x514d5d[_0xdee5('0x20')]));_0x514d5d[_0xdee5('0x3b')](_0x514d5d[_0xdee5('0x2b')],_0x514d5d[_0xdee5('0x2c')],parseInt(_0x514d5d['priority'],0xa)+0x1);_0x514d5d[_0xdee5('0x3a')]();}module[_0xdee5('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x03f8=['close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','./rpc','./mailRpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','retry','maxRetry','addVertex','omit','hasOwnProperty','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','inspect','production','start','debug','root','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','agicommand\x20not\x20found','stack','[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'];(function(_0x2a2b21,_0x4e2709){var _0x3b02b7=function(_0x1ab6aa){while(--_0x1ab6aa){_0x2a2b21['push'](_0x2a2b21['shift']());}};_0x3b02b7(++_0x4e2709);}(_0x03f8,0x18a));var _0x803f=function(_0x45a099,_0x20ea5c){_0x45a099=_0x45a099-0x0;var _0x557e01=_0x03f8[_0x45a099];return _0x557e01;};'use strict';var _=require(_0x803f('0x0'));var moment=require(_0x803f('0x1'));var parser=require(_0x803f('0x2'));var util=require('util');var logger=require('../../config/logger')('agi');var rpc=require(_0x803f('0x3'));var mailRpc=require(_0x803f('0x4'));var Graph=require(_0x803f('0x5'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x803f('0x6')]()[_0x803f('0x7')](function(_0x136fd1){logger[_0x803f('0x8')](_0x803f('0x9'),_0x136fd1['stack']);return[];});}function addVertex(_0x52f9b6,_0x31ca6e,_0x26a9a4){_0x31ca6e['agicommand']=_0x26a9a4;if(_0x31ca6e['hasOwnProperty'](_0x803f('0xa'))){_0x31ca6e[_0x803f('0xb')]=parseInt(_0x31ca6e[_0x803f('0xa')],0xa);}_0x52f9b6[_0x803f('0xc')](_[_0x803f('0xd')](_0x31ca6e,'mxCell'));}function initGraph(_0x23b0b8,_0x168302){var _0x2a02d7=new Graph();for(var _0x4f8577 in _0x23b0b8){if(_0x23b0b8[_0x803f('0xe')](_0x4f8577)){if(_[_0x803f('0xf')](_0x23b0b8[_0x4f8577])){for(var _0x24d52c=0x0;_0x24d52c<_0x23b0b8[_0x4f8577]['length'];_0x24d52c+=0x1){addVertex(_0x2a02d7,_0x23b0b8[_0x4f8577][_0x24d52c],_0x4f8577);}}else{addVertex(_0x2a02d7,_0x23b0b8[_0x4f8577],_0x4f8577);}}}for(var _0x36ac6b=0x0;_0x36ac6b<_0x168302[_0x803f('0x10')];_0x36ac6b+=0x1){if(_0x168302[_0x36ac6b][_0x803f('0x11')]&&_0x168302[_0x36ac6b][_0x803f('0x12')]){_0x2a02d7[_0x803f('0x13')](_0x168302[_0x36ac6b][_0x803f('0x11')],_0x168302[_0x36ac6b][_0x803f('0x12')],_0x168302[_0x36ac6b][_0x803f('0x14')]);}}return _0x2a02d7;}function getRoot(_0x4823ef){return parser[_0x803f('0x15')](_0x4823ef,{'object':!![]})[_0x803f('0x16')]['root'];}function inspect(_0x23e9b1){return util[_0x803f('0x17')](_0x23e9b1,{'showHidden':![],'depth':null});}function initialize(_0x17c868,_0x4741aa){var _0x1dc6b6=getRoot(_0x17c868[_0x803f('0x18')]);if(!_0x1dc6b6||!_0x1dc6b6[_0x803f('0x19')])return;var _0x35ae20,_0x10ac40,_0x2d1f0a;logger[_0x803f('0x1a')](_0x803f('0x1b'),JSON[_0x803f('0x1c')](_0x1dc6b6,null,0x2));_0x4741aa[_0x803f('0x1d')]=moment()[_0x803f('0x1e')](_0x803f('0x1f'));_0x35ae20=initGraph(_[_0x803f('0xd')](_0x1dc6b6,_0x803f('0x20')),_0x1dc6b6['mxCell']);_0x10ac40=new Vertices(_0x4741aa,rpc,mailRpc);logger[_0x803f('0x21')](util[_0x803f('0x1e')](_0x803f('0x22'),_0x4741aa[_0x803f('0x23')],_0x4741aa[_0x803f('0x24')],_0x4741aa[_0x803f('0x25')],_0x4741aa[_0x803f('0x26')],_0x4741aa[_0x803f('0x27')]));_0x35ae20[_0x803f('0x28')](_0x1dc6b6[_0x803f('0x19')]['id'],function(_0xc045bc){try{_0xc045bc=_0x10ac40[_0x803f('0x29')](_0xc045bc);logger['debug'](_0x803f('0x2a'),JSON[_0x803f('0x1c')](_0xc045bc,null,0x2));if(_0xc045bc[_0x803f('0x2b')]===_0x803f('0x2c')){logger[_0x803f('0x21')](_0x803f('0x2d'));_0x4741aa[_0x803f('0x2e')]=_0xc045bc[_0x803f('0x2e')]||_0x4741aa[_0x803f('0x2e')];_0x4741aa[_0x803f('0x2f')]=_0xc045bc[_0x803f('0x2f')];_0x4741aa[_0x803f('0x30')]=_0xc045bc[_0x803f('0x30')]?_0xc045bc[_0x803f('0x30')]-0x1:0x1;return null;}else if(_0xc045bc&&_0x10ac40[_0xc045bc[_0x803f('0x2b')]]){_0x2d1f0a=_0x10ac40[_0xc045bc['agicommand']](_0xc045bc);logger['info'](_0x803f('0x31'),JSON[_0x803f('0x1c')](_0x2d1f0a,null,0x2));if(_0x2d1f0a&&_0x2d1f0a['code']===AGI_CODE_SUCCESS&&_0x2d1f0a[_0x803f('0x32')]!==AGI_RESULT_ERROR&&!_0x4741aa[_0x803f('0x33')]){logger[_0x803f('0x1a')]('response',inspect(_0x2d1f0a));return _[_0x803f('0x34')](_0x2d1f0a[_0x803f('0x32')])?null:_0x2d1f0a[_0x803f('0x32')][_0x803f('0x35')]();}else{logger[_0x803f('0x8')](_0x803f('0x31'),inspect(_0x2d1f0a));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x103733){logger['error'](_0x103733['stack']);return null;}});if(_0x1dc6b6[_0x803f('0x36')]){logger['info'](util[_0x803f('0x1e')](_0x803f('0x37'),_0x4741aa[_0x803f('0x23')],_0x4741aa[_0x803f('0x24')],_0x4741aa[_0x803f('0x25')],_0x4741aa[_0x803f('0x26')],_0x4741aa['uniqueid']));_0x35ae20[_0x803f('0x28')](_0x1dc6b6['finally']['id'],function(_0xe8e8d2){try{_0xe8e8d2=_0x10ac40[_0x803f('0x29')](_0xe8e8d2);logger[_0x803f('0x1a')](_0x803f('0x2a'),JSON['stringify'](_0xe8e8d2,null,0x2));if(_0xe8e8d2&&_0x10ac40[_0xe8e8d2['agicommand']]){_0x2d1f0a=_0x10ac40[_0xe8e8d2[_0x803f('0x2b')]](_0xe8e8d2);if(_0x2d1f0a){logger[_0x803f('0x1a')](_0x803f('0x31'),inspect(_0x2d1f0a));return _[_0x803f('0x34')](_0x2d1f0a[_0x803f('0x32')])?null:_0x2d1f0a['result']['toString']();}else{logger[_0x803f('0x8')](_0x803f('0x31'),inspect(_0x2d1f0a));return null;}}else{logger[_0x803f('0x8')](_0x803f('0x38'));return null;}}catch(_0x5a368c){logger['error'](_0x5a368c[_0x803f('0x39')]);return null;}});}logger[_0x803f('0x21')](util['format'](_0x803f('0x3a'),_0x4741aa['arg_1'],_0x4741aa['calleridname'],_0x4741aa[_0x803f('0x25')],_0x4741aa[_0x803f('0x26')],_0x4741aa[_0x803f('0x27')]));logger[_0x803f('0x21')](util[_0x803f('0x1e')](_0x803f('0x3b'),_0x4741aa['context'],_0x4741aa[_0x803f('0x2f')],parseInt(_0x4741aa['priority'],0xa)+0x1));_0x4741aa[_0x803f('0x3c')](_0x4741aa['context'],_0x4741aa[_0x803f('0x2f')],parseInt(_0x4741aa[_0x803f('0x30')],0xa)+0x1);_0x4741aa[_0x803f('0x3d')]();}function handleNotFound(_0x4c0232){logger[_0x803f('0x8')](util[_0x803f('0x1e')](_0x803f('0x3e'),_0x4c0232['arg_1']));_0x4c0232[_0x803f('0x3c')](_0x4c0232[_0x803f('0x2e')],_0x4c0232['extension'],parseInt(_0x4c0232[_0x803f('0x30')],0xa)+0x1);_0x4c0232[_0x803f('0x3d')]();}function handleUnpublished(_0x2230f3){logger[_0x803f('0x8')](util[_0x803f('0x1e')](_0x803f('0x3f'),_0x2230f3['arg_1']));_0x2230f3[_0x803f('0x3c')](_0x2230f3[_0x803f('0x2e')],_0x2230f3['extension'],parseInt(_0x2230f3['priority'],0xa)+0x1);_0x2230f3[_0x803f('0x3d')]();}module[_0x803f('0x40')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index d29f7a7..1158be6 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 _0x38b3=['Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit','headers','line','exports','util','stream'];(function(_0x27bb6c,_0x1cf81a){var _0x3a4309=function(_0x13f424){while(--_0x13f424){_0x27bb6c['push'](_0x27bb6c['shift']());}};_0x3a4309(++_0x1cf81a);}(_0x38b3,0xda));var _0x338b=function(_0x159f9b,_0x246265){_0x159f9b=_0x159f9b-0x0;var _0x19df24=_0x38b3[_0x159f9b];return _0x19df24;};'use strict';var util=require(_0x338b('0x0'));var Transform=require(_0x338b('0x1'))[_0x338b('0x2')];function AGIReply(_0x167295){Transform[_0x338b('0x3')](this,_0x167295);this[_0x338b('0x4')]='';this[_0x338b('0x5')]=![];}util[_0x338b('0x6')](AGIReply,Transform);AGIReply[_0x338b('0x7')][_0x338b('0x8')]=function(_0x10bb9b,_0x163ba0,_0x2227b3){var _0x3d5274='\x0a',_0x5f3ef2=['\x0a\x0a',_0x338b('0x9')],_0x193685=-0x1,_0xbf679b=-0x1,_0x48bafd='',_0x3c5014=0x0,_0x7f85ed='',_0x586906='';this[_0x338b('0x4')]+=_0x10bb9b[_0x338b('0xa')]();_0x7f85ed=this[_0x338b('0x4')];if(!this['_inBody']){_0x3c5014=0x0;while(_0x5f3ef2[_0x3c5014]){while((_0xbf679b=_0x7f85ed[_0x338b('0xb')](_0x5f3ef2[_0x3c5014]))!=-0x1){_0x48bafd=_0x5f3ef2[_0x3c5014];_0x586906=_0x7f85ed[_0x338b('0xc')](0x0,_0xbf679b);_0x7f85ed=_0x7f85ed['substring'](_0xbf679b+_0x48bafd[_0x338b('0xd')]);var _0x50b207=_0x586906['split'](_0x3d5274),_0x56383f=0x0,_0x583522={},_0x5bfe66='',_0x1d7544='',_0x4bf80b=-0x1;while(_0x50b207[_0x56383f]){_0x4bf80b=_0x50b207[_0x56383f][_0x338b('0xb')](':');if(_0x4bf80b!=-0x1){_0x5bfe66=_0x50b207[_0x56383f][_0x338b('0xe')](0x0,_0x4bf80b)[_0x338b('0xf')]();_0x1d7544=_0x50b207[_0x56383f]['slice'](_0x4bf80b+0x1)[_0x338b('0xf')]();if(_0x5bfe66[_0x338b('0xd')]>0x0){_0x583522[_0x5bfe66]=_0x1d7544;}}else{}_0x56383f++;}this[_0x338b('0x10')](_0x338b('0x11'),_0x583522);this[_0x338b('0x5')]=!![];}_0x3c5014++;}this[_0x338b('0x4')]=_0x7f85ed;}else{while((_0x193685=_0x7f85ed[_0x338b('0xb')](_0x3d5274))!=-0x1){_0x586906=_0x7f85ed[_0x338b('0xc')](0x0,_0x193685);this[_0x338b('0x10')](_0x338b('0x12'),_0x586906);_0x7f85ed=_0x7f85ed[_0x338b('0xc')](_0x193685+_0x3d5274[_0x338b('0xd')]);}this[_0x338b('0x4')]=_0x7f85ed;}_0x2227b3();};module[_0x338b('0x13')]=AGIReply; \ No newline at end of file +var _0xc639=['slice','trim','emit','line','exports','util','Transform','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length'];(function(_0x717f3e,_0x173e5d){var _0x12df3a=function(_0x574636){while(--_0x574636){_0x717f3e['push'](_0x717f3e['shift']());}};_0x12df3a(++_0x173e5d);}(_0xc639,0xc0));var _0x9c63=function(_0x24e9c5,_0x10803d){_0x24e9c5=_0x24e9c5-0x0;var _0x346ae8=_0xc639[_0x24e9c5];return _0x346ae8;};'use strict';var util=require(_0x9c63('0x0'));var Transform=require('stream')[_0x9c63('0x1')];function AGIReply(_0x4cfe47){Transform['call'](this,_0x4cfe47);this[_0x9c63('0x2')]='';this['_inBody']=![];}util[_0x9c63('0x3')](AGIReply,Transform);AGIReply[_0x9c63('0x4')][_0x9c63('0x5')]=function(_0x297191,_0x481a15,_0x4b3138){var _0x37a3b8='\x0a',_0x308cf3=['\x0a\x0a',_0x9c63('0x6')],_0x1b9365=-0x1,_0x490321=-0x1,_0x506234='',_0x52c13d=0x0,_0x4a8f83='',_0x2c473a='';this['_localBuffer']+=_0x297191[_0x9c63('0x7')]();_0x4a8f83=this[_0x9c63('0x2')];if(!this[_0x9c63('0x8')]){_0x52c13d=0x0;while(_0x308cf3[_0x52c13d]){while((_0x490321=_0x4a8f83[_0x9c63('0x9')](_0x308cf3[_0x52c13d]))!=-0x1){_0x506234=_0x308cf3[_0x52c13d];_0x2c473a=_0x4a8f83[_0x9c63('0xa')](0x0,_0x490321);_0x4a8f83=_0x4a8f83[_0x9c63('0xa')](_0x490321+_0x506234[_0x9c63('0xb')]);var _0x153c10=_0x2c473a['split'](_0x37a3b8),_0x2f00b4=0x0,_0x3df2bb={},_0x29d0ae='',_0x460d50='',_0x4050c9=-0x1;while(_0x153c10[_0x2f00b4]){_0x4050c9=_0x153c10[_0x2f00b4]['indexOf'](':');if(_0x4050c9!=-0x1){_0x29d0ae=_0x153c10[_0x2f00b4][_0x9c63('0xc')](0x0,_0x4050c9)[_0x9c63('0xd')]();_0x460d50=_0x153c10[_0x2f00b4][_0x9c63('0xc')](_0x4050c9+0x1)[_0x9c63('0xd')]();if(_0x29d0ae['length']>0x0){_0x3df2bb[_0x29d0ae]=_0x460d50;}}else{}_0x2f00b4++;}this[_0x9c63('0xe')]('headers',_0x3df2bb);this[_0x9c63('0x8')]=!![];}_0x52c13d++;}this['_localBuffer']=_0x4a8f83;}else{while((_0x1b9365=_0x4a8f83[_0x9c63('0x9')](_0x37a3b8))!=-0x1){_0x2c473a=_0x4a8f83['substring'](0x0,_0x1b9365);this['emit'](_0x9c63('0xf'),_0x2c473a);_0x4a8f83=_0x4a8f83[_0x9c63('0xa')](_0x1b9365+_0x37a3b8[_0x9c63('0xb')]);}this[_0x9c63('0x2')]=_0x4a8f83;}_0x4b3138();};module[_0x9c63('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 30251bf..ddbad94 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 _0x9a19=['GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','LogoutUser','lodash','moment','jayson/promise','http','request','then','error','message','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone'];(function(_0x17af96,_0x22780d){var _0x5f028d=function(_0x266257){while(--_0x266257){_0x17af96['push'](_0x17af96['shift']());}};_0x5f028d(++_0x22780d);}(_0x9a19,0x114));var _0x99a1=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x9a19[_0x23b655];return _0x364b32;};'use strict';var _=require(_0x99a1('0x0'));var moment=require(_0x99a1('0x1'));var jayson=require(_0x99a1('0x2'));var client=jayson['client'][_0x99a1('0x3')]({'port':0x2329});function request(_0x2ba463,_0x112bcc){return new Promise(function(_0x25da2d,_0x214082){return client[_0x99a1('0x4')](_0x2ba463,_0x112bcc)[_0x99a1('0x5')](function(_0x1f1a31){if(_0x1f1a31[_0x99a1('0x6')]){return _0x214082(_0x1f1a31[_0x99a1('0x6')][_0x99a1('0x7')]);}else{return _0x25da2d(_0x1f1a31['result']);}})['catch'](function(_0x5aa6c2){return _0x214082(_0x5aa6c2);});});}exports[_0x99a1('0x8')]=function(){return request(_0x99a1('0x9'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x99a1('0xa')]=function(_0xd7b568){return request(_0x99a1('0xb'),{'options':{'raw':![],'where':{'name':_0xd7b568},'attributes':[_0x99a1('0xc')]}});};exports[_0x99a1('0xd')]=function(_0x537032){return request(_0x99a1('0xe'),{'options':{'raw':![],'where':{'id':_0x537032},'include':[{'model':_0x99a1('0xf'),'as':_0x99a1('0x10'),'include':[{'model':_0x99a1('0x11'),'as':_0x99a1('0x11')}]}],'attributes':['id',_0x99a1('0x12'),_0x99a1('0x13')],'smtp':!![]}});};exports[_0x99a1('0x14')]=function(_0xf713b9){return request(_0x99a1('0xb'),{'options':{'where':{'id':_0xf713b9},'attributes':[_0x99a1('0x12')]}});};exports[_0x99a1('0x15')]=function(_0xe1a1f){return request(_0x99a1('0x16'),{'options':{'where':{'id':_0xe1a1f},'attributes':[_0x99a1('0x12')]}});};exports['getVariableById']=function(_0x2d81ed){return request(_0x99a1('0x17'),{'options':{'where':{'id':_0x2d81ed},'attributes':[_0x99a1('0x12')]}});};exports[_0x99a1('0x18')]=function(_0x384f05){return request(_0x99a1('0x19'),{'options':{'where':{'id':_0x384f05},'attributes':[_0x99a1('0x1a')]}});};exports['getUserById']=function(_0x4f049c){return request(_0x99a1('0x1b'),{'options':{'where':{'id':_0x4f049c},'attributes':[_0x99a1('0x12')]}});};exports[_0x99a1('0x1c')]=function(_0x1fcd00){return request(_0x99a1('0x1d'),{'options':{'where':{'phone':_0x1fcd00[_0x99a1('0x1e')]},'attributes':['id']}});};exports[_0x99a1('0x1f')]=function(_0x3cd62c){return request(_0x99a1('0x20'),{'options':{'where':{'id':_0x3cd62c},'attributes':[_0x99a1('0x12')]}});};exports[_0x99a1('0x21')]=function(_0x5eabcb){return request(_0x99a1('0x22'),{'options':{'where':{'id':_0x5eabcb},'attributes':[_0x99a1('0x23')]}});};exports['getIntervalById']=function(_0x38435b){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x38435b},'include':[{'model':_0x99a1('0x24'),'as':_0x99a1('0x25')}]}});};exports[_0x99a1('0x26')]=function(_0x2d3b82){return request('ShowSmsAccount',{'options':{'where':{'id':_0x2d3b82},'attributes':['id',_0x99a1('0x12')]}});};exports[_0x99a1('0x27')]=function(_0x483c17){return request(_0x99a1('0x28'),{'body':_0x483c17});};exports['createSquareDetailsReport']=function(_0x1f9800){return request(_0x99a1('0x29'),{'body':_0x1f9800});};exports[_0x99a1('0x2a')]=function(_0xdaa27d){return request(_0x99a1('0x2b'),{'body':_[_0x99a1('0x2c')](_0xdaa27d,{'project_name':_0xdaa27d['arg_1'],'prev_project_name':_0xdaa27d[_0x99a1('0x2d')]||'','is_subproject':_0xdaa27d['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x99a1('0x2e'))})});};exports[_0x99a1('0x2f')]=function(_0xa6799b){return request(_0x99a1('0x30'),{'body':_0xa6799b});};exports[_0x99a1('0x31')]=function(_0x309b93){return request(_0x99a1('0x32'),{'body':_0x309b93});};exports['createCmContact']=function(_0xf41b0d){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0xf41b0d[_0x99a1('0x1e')],'ListId':_0xf41b0d[_0x99a1('0x33')]}}})[_0x99a1('0x5')](function(_0x523668){if(_0x523668){return _0x523668;}return request(_0x99a1('0x34'),{'body':_0xf41b0d});});};exports[_0x99a1('0x35')]=function(_0x5718b9){return request(_0x99a1('0x36'),{'options':{'where':{'id':_0x5718b9},'attributes':[_0x99a1('0x12')]}});};exports[_0x99a1('0x37')]=function(_0x303d1e,_0x2a5b8c){return request(_0x99a1('0x38'),{'body':{'interface':_0x2a5b8c},'options':{'where':_0x303d1e}});};exports[_0x99a1('0x39')]=function(_0x26c23c,_0x52da8d,_0x4960e4){return request(_0x99a1('0x3a'),{'body':{'type':_0x52da8d,'uniqueid':_0x4960e4},'options':{'where':_0x26c23c}});};exports['agentUnpause']=function(_0x38e383){return request(_0x99a1('0x3b'),{'body':{},'options':{'where':_0x38e383}});};exports['agentLogout']=function(_0xa5972b){return request(_0x99a1('0x3c'),{'body':{},'options':{'where':_0xa5972b}});}; \ No newline at end of file +var _0x26bc=['error','message','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','CreateSquareMessage','ShowCmHopper','ListId','getPauseById','ShowPause','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','then'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x26bc,0x162));var _0xc26b=function(_0x4066c7,_0x2d9239){_0x4066c7=_0x4066c7-0x0;var _0x57b83a=_0x26bc[_0x4066c7];return _0x57b83a;};'use strict';var _=require(_0xc26b('0x0'));var moment=require(_0xc26b('0x1'));var jayson=require(_0xc26b('0x2'));var client=jayson[_0xc26b('0x3')][_0xc26b('0x4')]({'port':0x2329});function request(_0x4eda53,_0x21c373){return new Promise(function(_0x1bb460,_0x381ceb){return client['request'](_0x4eda53,_0x21c373)[_0xc26b('0x5')](function(_0x5c87f7){if(_0x5c87f7[_0xc26b('0x6')]){return _0x381ceb(_0x5c87f7[_0xc26b('0x6')][_0xc26b('0x7')]);}else{return _0x1bb460(_0x5c87f7['result']);}})[_0xc26b('0x8')](function(_0x453491){return _0x381ceb(_0x453491);});});}exports[_0xc26b('0x9')]=function(){return request(_0xc26b('0xa'),{'options':{'raw':![],'attributes':['id',_0xc26b('0xb'),_0xc26b('0xc')]}});};exports[_0xc26b('0xd')]=function(_0x9deb12){return request(_0xc26b('0xe'),{'options':{'raw':![],'where':{'name':_0x9deb12},'attributes':[_0xc26b('0xc')]}});};exports['getMailAccountById']=function(_0x466f32){return request(_0xc26b('0xf'),{'options':{'raw':![],'where':{'id':_0x466f32},'include':[{'model':_0xc26b('0x10'),'as':_0xc26b('0x11'),'include':[{'model':_0xc26b('0x12'),'as':_0xc26b('0x12')}]}],'attributes':['id','name',_0xc26b('0x13')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x56da8b){return request(_0xc26b('0xe'),{'options':{'where':{'id':_0x56da8b},'attributes':[_0xc26b('0xb')]}});};exports[_0xc26b('0x14')]=function(_0x27d81c){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x27d81c},'attributes':[_0xc26b('0xb')]}});};exports[_0xc26b('0x15')]=function(_0x19be02){return request(_0xc26b('0x16'),{'options':{'where':{'id':_0x19be02},'attributes':[_0xc26b('0xb')]}});};exports[_0xc26b('0x17')]=function(_0x4dc407){return request(_0xc26b('0x18'),{'options':{'where':{'id':_0x4dc407},'attributes':[_0xc26b('0x19')]}});};exports['getUserById']=function(_0x1dba27){return request('ShowUser',{'options':{'where':{'id':_0x1dba27},'attributes':['name']}});};exports[_0xc26b('0x1a')]=function(_0x47e75b){return request(_0xc26b('0x1b'),{'options':{'where':{'phone':_0x47e75b[_0xc26b('0x1c')]},'attributes':['id']}});};exports[_0xc26b('0x1d')]=function(_0x9d9098){return request('ShowTrunk',{'options':{'where':{'id':_0x9d9098},'attributes':[_0xc26b('0xb')]}});};exports[_0xc26b('0x1e')]=function(_0x2523b5){return request(_0xc26b('0x1f'),{'options':{'where':{'id':_0x2523b5},'attributes':[_0xc26b('0x20')]}});};exports[_0xc26b('0x21')]=function(_0x4f90f3){return request(_0xc26b('0x22'),{'options':{'raw':![],'where':{'id':_0x4f90f3},'include':[{'model':'Interval','as':_0xc26b('0x23')}]}});};exports[_0xc26b('0x24')]=function(_0x282928){return request(_0xc26b('0x25'),{'options':{'where':{'id':_0x282928},'attributes':['id','name']}});};exports[_0xc26b('0x26')]=function(_0x297286){return request(_0xc26b('0x27'),{'body':_0x297286});};exports[_0xc26b('0x28')]=function(_0x5bdf6b){return request(_0xc26b('0x29'),{'body':_0x5bdf6b});};exports[_0xc26b('0x2a')]=function(_0x5b974b){return request('CreateSquareReport',{'body':_[_0xc26b('0x2b')](_0x5b974b,{'project_name':_0x5b974b[_0xc26b('0x2c')],'prev_project_name':_0x5b974b[_0xc26b('0x2d')]||'','is_subproject':_0x5b974b[_0xc26b('0x2d')]?!![]:![],'leaveAt':moment()[_0xc26b('0x2e')](_0xc26b('0x2f'))})});};exports['createSquareRecording']=function(_0x3eea3b){return request('CreateSquareRecording',{'body':_0x3eea3b});};exports[_0xc26b('0x30')]=function(_0x6ec732){return request(_0xc26b('0x31'),{'body':_0x6ec732});};exports['createCmContact']=function(_0x1f7d2e){return request(_0xc26b('0x32'),{'options':{'raw':![],'where':{'phone':_0x1f7d2e[_0xc26b('0x1c')],'ListId':_0x1f7d2e[_0xc26b('0x33')]}}})[_0xc26b('0x5')](function(_0x2a9d83){if(_0x2a9d83){return _0x2a9d83;}return request('CreateCmContact',{'body':_0x1f7d2e});});};exports[_0xc26b('0x34')]=function(_0x5eaa9a){return request(_0xc26b('0x35'),{'options':{'where':{'id':_0x5eaa9a},'attributes':['name']}});};exports['agentLogin']=function(_0x4681ac,_0x405e37){return request(_0xc26b('0x36'),{'body':{'interface':_0x405e37},'options':{'where':_0x4681ac}});};exports['agentPause']=function(_0x37fb7f,_0x1e192c,_0x555907){return request(_0xc26b('0x37'),{'body':{'type':_0x1e192c,'uniqueid':_0x555907},'options':{'where':_0x37fb7f}});};exports[_0xc26b('0x38')]=function(_0x16fc15){return request(_0xc26b('0x39'),{'body':{},'options':{'where':_0x16fc15}});};exports[_0xc26b('0x3a')]=function(_0x1a17bd){return request(_0xc26b('0x3b'),{'body':{},'options':{'where':_0x1a17bd}});}; \ 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 119b0a2..567f7af 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 _0x2e65=['exports','./polly','./lex'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x2e65,0x193));var _0x52e6=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x2e65[_0x2be8c2];return _0x97f531;};var polly=require(_0x52e6('0x0'));var lex=require(_0x52e6('0x1'));module[_0x52e6('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x6808=['./lex','exports','./polly'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0x6808,0xd1));var _0x8680=function(_0x253f8d,_0x3a57a2){_0x253f8d=_0x253f8d-0x0;var _0x14bd6a=_0x6808[_0x253f8d];return _0x14bd6a;};var polly=require(_0x8680('0x0'));var lex=require(_0x8680('0x1'));module[_0x8680('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index a094183..7823843 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 _0x4483=['exports','./lib/api'];(function(_0x5ef3f4,_0x3d7246){var _0x2c6f8e=function(_0x30aba7){while(--_0x30aba7){_0x5ef3f4['push'](_0x5ef3f4['shift']());}};_0x2c6f8e(++_0x3d7246);}(_0x4483,0x1a3));var _0x3448=function(_0x3b116e,_0x38a899){_0x3b116e=_0x3b116e-0x0;var _0x13ac2a=_0x4483[_0x3b116e];return _0x13ac2a;};'use strict';var lex=require(_0x3448('0x0'));module[_0x3448('0x1')]=function(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178){return lex(_0x229c0c,_0x481d0c,_0x202d3d,_0x1fe72d,_0x27ef60,_0x3a7178);}; \ No newline at end of file +var _0x9354=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9354,0x96));var _0x4935=function(_0x4147ff,_0x154530){_0x4147ff=_0x4147ff-0x0;var _0x1e71e6=_0x9354[_0x4147ff];return _0x1e71e6;};'use strict';var lex=require('./lib/api');module[_0x4935('0x0')]=function(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc){return lex(_0xc3c1f3,_0x4896da,_0x263dd5,_0x2a4993,_0x29d1eb,_0x280bbc);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 81f66a0..e815f7b 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(_0xc8c882,_0x4ba0cd){var _0x9b1938=function(_0x5575aa){while(--_0x5575aa){_0xc8c882['push'](_0xc8c882['shift']());}};_0x9b1938(++_0x4ba0cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x50ef81,_0x35742c){var _0x3f2065=function(_0x3a55a2){while(--_0x3a55a2){_0x50ef81['push'](_0x50ef81['shift']());}};_0x3f2065(++_0x35742c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 e50d413..92aa627 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 _0xe062=['exports','./lib/api'];(function(_0x5ee823,_0x24650b){var _0x209bd2=function(_0xa72379){while(--_0xa72379){_0x5ee823['push'](_0x5ee823['shift']());}};_0x209bd2(++_0x24650b);}(_0xe062,0x179));var _0x2e06=function(_0x225f03,_0x27d3db){_0x225f03=_0x225f03-0x0;var _0x57a16f=_0xe062[_0x225f03];return _0x57a16f;};'use strict';var polly=require(_0x2e06('0x0'));module[_0x2e06('0x1')]=function(_0x1a9ede,_0x2ca8db,_0x1e6174,_0x264c3b,_0x10d247,_0x2f4b0c,_0x30108d){return polly(_0x1a9ede,_0x2ca8db,_0x1e6174,_0x264c3b,_0x10d247,_0x2f4b0c,_0x30108d);}; \ No newline at end of file +var _0x9fc0=['./lib/api'];(function(_0x23b57c,_0xdc7f98){var _0x4c3b1d=function(_0x283147){while(--_0x283147){_0x23b57c['push'](_0x23b57c['shift']());}};_0x4c3b1d(++_0xdc7f98);}(_0x9fc0,0x1ea));var _0x09fc=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0x9fc0[_0x35d3a8];return _0x182378;};'use strict';var polly=require(_0x09fc('0x0'));module['exports']=function(_0x4b420c,_0xe99383,_0xb9ba5,_0x22cc96,_0x565491,_0x4729bc,_0x48e9cc){return polly(_0x4b420c,_0xe99383,_0xb9ba5,_0x22cc96,_0x565491,_0x4729bc,_0x48e9cc);}; \ 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 454f190..1d28162 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 _0x2150=['bluebird','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3','path'];(function(_0x3ad3c0,_0x3fd292){var _0x3fbfea=function(_0x2463ed){while(--_0x2463ed){_0x3ad3c0['push'](_0x3ad3c0['shift']());}};_0x3fbfea(++_0x3fd292);}(_0x2150,0xef));var _0x0215=function(_0xf53094,_0x7be480){_0xf53094=_0xf53094-0x0;var _0x2013b0=_0x2150[_0xf53094];return _0x2013b0;};'use strict';var fs=require('fs');var path=require(_0x0215('0x0'));var BPromise=require(_0x0215('0x1'));var rs=require('randomstring');var AWS=require(_0x0215('0x2'));function pollyResult(_0x498142,_0xd2011c,_0x712574){return new BPromise(function(_0x264709,_0x316c16){_0x498142[_0x0215('0x3')](_0xd2011c,function(_0x408c7f,_0x44e58){if(_0x408c7f){_0x316c16(_0x408c7f);}else if(_0x44e58){if(_0x44e58['AudioStream']instanceof Buffer){fs[_0x0215('0x4')](_0x712574,_0x44e58[_0x0215('0x5')],function(_0x5a5273){if(_0x5a5273){_0x316c16(_0x5a5273);}else{_0x264709();}});}else{_0x316c16(new Error(_0x0215('0x6')));}}else{_0x316c16(new Error(_0x0215('0x7')));}});});}module['exports']=function(_0x32ec69,_0x153ca3,_0x227d05,_0x11a086,_0xc1c3a6,_0x405037,_0xda683b){var _0x7671d7=new AWS['Polly']({'accessKeyId':_0x32ec69,'secretAccessKey':_0x153ca3,'region':_0x227d05});var _0xf353f0={'Text':_0xc1c3a6,'TextType':_0x405037||_0x0215('0x8'),'OutputFormat':_0x0215('0x9'),'VoiceId':_0x11a086};return pollyResult(_0x7671d7,_0xf353f0,_0xda683b);}; \ No newline at end of file +var _0x303f=['synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','text','path','bluebird','randomstring','aws-sdk'];(function(_0x4fa65e,_0x44276a){var _0x53b425=function(_0x470836){while(--_0x470836){_0x4fa65e['push'](_0x4fa65e['shift']());}};_0x53b425(++_0x44276a);}(_0x303f,0x83));var _0xf303=function(_0x24f25d,_0xb146dc){_0x24f25d=_0x24f25d-0x0;var _0x4e39a4=_0x303f[_0x24f25d];return _0x4e39a4;};'use strict';var fs=require('fs');var path=require(_0xf303('0x0'));var BPromise=require(_0xf303('0x1'));var rs=require(_0xf303('0x2'));var AWS=require(_0xf303('0x3'));function pollyResult(_0x1092c2,_0x304360,_0xd9ebf5){return new BPromise(function(_0x1fdc9f,_0x1d18e9){_0x1092c2[_0xf303('0x4')](_0x304360,function(_0x45f1ce,_0x3fe380){if(_0x45f1ce){_0x1d18e9(_0x45f1ce);}else if(_0x3fe380){if(_0x3fe380[_0xf303('0x5')]instanceof Buffer){fs['writeFile'](_0xd9ebf5,_0x3fe380['AudioStream'],function(_0x1e44e0){if(_0x1e44e0){_0x1d18e9(_0x1e44e0);}else{_0x1fdc9f();}});}else{_0x1d18e9(new Error(_0xf303('0x6')));}}else{_0x1d18e9(new Error(_0xf303('0x7')));}});});}module['exports']=function(_0x437a67,_0x4c8da7,_0x59f2cb,_0x209559,_0x2c4ac0,_0x5a250f,_0xf46a54){var _0x37b732=new AWS['Polly']({'accessKeyId':_0x437a67,'secretAccessKey':_0x4c8da7,'region':_0x59f2cb});var _0x1f028b={'Text':_0x2c4ac0,'TextType':_0x5a250f||_0xf303('0x8'),'OutputFormat':'mp3','VoiceId':_0x209559};return pollyResult(_0x37b732,_0x1f028b,_0xf46a54);}; \ 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 424d3ec..9a88550 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 _0x51c4=['exports','./lib/api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x51c4,0x91));var _0x451c=function(_0x28ccb6,_0x14c679){_0x28ccb6=_0x28ccb6-0x0;var _0x538f02=_0x51c4[_0x28ccb6];return _0x538f02;};'use strict';var asr=require(_0x451c('0x0'));module[_0x451c('0x1')]=function(_0x1c5b04,_0xf95a05,_0x39e2fc,_0x491df8){return asr(_0x1c5b04,_0xf95a05,_0x39e2fc);}; \ No newline at end of file +var _0x716a=['exports','./lib/api'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x716a,0xf1));var _0xa716=function(_0x9c3c56,_0x169b56){_0x9c3c56=_0x9c3c56-0x0;var _0x2dd782=_0x716a[_0x9c3c56];return _0x2dd782;};'use strict';var asr=require(_0xa716('0x0'));module[_0xa716('0x1')]=function(_0x256f73,_0x11e4ba,_0x10a693,_0x36688c){return asr(_0x256f73,_0x11e4ba,_0x10a693);}; \ 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 a046cd0..c03ea76 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 _0xe829=['filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xe829,0x1d8));var _0x9e82=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0xe829[_0x1bc013];return _0x55df36;};'use strict';var url=require(_0x9e82('0x0'));var BPromise=require(_0x9e82('0x1'));var fs=require('fs');var host=_0x9e82('0x2');module['exports']=function(_0x559076,_0xf56525,_0x337730){return new BPromise(function(_0x1b47d8,_0x168d3e){var _0x31591a;if(typeof _0x559076!==_0x9e82('0x3')||_0x559076['length']===0x0){return _0x168d3e(_0x9e82('0x4'));}if(typeof _0xf56525!==_0x9e82('0x3')||_0xf56525[_0x9e82('0x5')]===0x0){return _0x168d3e(_0x9e82('0x6'));}if(typeof _0x337730!==_0x9e82('0x7')&&(typeof _0x337730!=='string'||_0x337730[_0x9e82('0x5')]===0x0)){return _0x168d3e('lang\x20should\x20be\x20a\x20string');}try{_0x31591a=fs[_0x9e82('0x8')](_0x559076)[_0x9e82('0x9')]('base64');}catch(_0x5965b0){return _0x168d3e(_0x5965b0);}return _0x1b47d8({'method':_0x9e82('0xa'),'uri':host+_0x9e82('0xb')+_0xf56525,'body':{'config':{'encoding':_0x9e82('0xc'),'sampleRateHertz':_0x9e82('0xd'),'languageCode':_0x337730},'audio':{'content':_0x31591a}},'json':!![]});});}; \ No newline at end of file +var _0xd6ce=['https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','url','bluebird'];(function(_0x3f8f04,_0x150f21){var _0x1e99a5=function(_0x4bffe5){while(--_0x4bffe5){_0x3f8f04['push'](_0x3f8f04['shift']());}};_0x1e99a5(++_0x150f21);}(_0xd6ce,0x127));var _0xed6c=function(_0x4e7706,_0x36f61c){_0x4e7706=_0x4e7706-0x0;var _0x439419=_0xd6ce[_0x4e7706];return _0x439419;};'use strict';var url=require(_0xed6c('0x0'));var BPromise=require(_0xed6c('0x1'));var fs=require('fs');var host=_0xed6c('0x2');module[_0xed6c('0x3')]=function(_0x1a0166,_0xb43dee,_0x21fe5d){return new BPromise(function(_0x111385,_0x5cc704){var _0x5881f5;if(typeof _0x1a0166!==_0xed6c('0x4')||_0x1a0166[_0xed6c('0x5')]===0x0){return _0x5cc704(_0xed6c('0x6'));}if(typeof _0xb43dee!==_0xed6c('0x4')||_0xb43dee['length']===0x0){return _0x5cc704('key\x20should\x20be\x20a\x20string');}if(typeof _0x21fe5d!==_0xed6c('0x7')&&(typeof _0x21fe5d!==_0xed6c('0x4')||_0x21fe5d['length']===0x0)){return _0x5cc704('lang\x20should\x20be\x20a\x20string');}try{_0x5881f5=fs[_0xed6c('0x8')](_0x1a0166)[_0xed6c('0x9')](_0xed6c('0xa'));}catch(_0x3ae670){return _0x5cc704(_0x3ae670);}return _0x111385({'method':'POST','uri':host+'/v1/speech:recognize?key='+_0xb43dee,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x21fe5d},'audio':{'content':_0x5881f5}},'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 5be7921..e0f2660 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 _0x0052=['exports','./asr'];(function(_0x587bef,_0x594a13){var _0x5b0192=function(_0x44c197){while(--_0x44c197){_0x587bef['push'](_0x587bef['shift']());}};_0x5b0192(++_0x594a13);}(_0x0052,0x8f));var _0x2005=function(_0x24bac7,_0x28d84c){_0x24bac7=_0x24bac7-0x0;var _0x192c37=_0x0052[_0x24bac7];return _0x192c37;};var asr=require(_0x2005('0x0'));module[_0x2005('0x1')]={'asr':asr}; \ No newline at end of file +var _0xffbf=['exports','./asr'];(function(_0x17ab67,_0x5dbd3f){var _0x3a9ad8=function(_0x5795ef){while(--_0x5795ef){_0x17ab67['push'](_0x17ab67['shift']());}};_0x3a9ad8(++_0x5dbd3f);}(_0xffbf,0xe7));var _0xfffb=function(_0x22ff14,_0x4b6bc0){_0x22ff14=_0x22ff14-0x0;var _0x297bad=_0xffbf[_0x22ff14];return _0x297bad;};var asr=require(_0xfffb('0x0'));module[_0xfffb('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 f1b87ef..8e4ab87 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 _0xea86=['toString','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','tmp','.mp3','from','audioContent','writeFile','777','resolve','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','data','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','replace','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','ispeechASR','freeform=3','sestekNDA','nda','text','channelData','AudioFromTts','Data','apiai-promise','bluebird','dialogflow','https','md5','querystring','request-promise','sox','url','parse','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','unlink','download\x20error','get','end','transcode','info','finish\x20to\x20convert','start','generate','.wav','writeFileSync','base64','then','chmodSync','split','readFileSync'];(function(_0x1c9f84,_0x12db77){var _0x250013=function(_0x48ec8f){while(--_0x48ec8f){_0x1c9f84['push'](_0x1c9f84['shift']());}};_0x250013(++_0x12db77);}(_0xea86,0xdd));var _0x6ea8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xea86[_0x14add3];return _0x4a174f;};'use strict';var apiai=require(_0x6ea8('0x0'));var BPromise=require(_0x6ea8('0x1'));var dialogflow=require(_0x6ea8('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x6ea8('0x3'));var md5=require(_0x6ea8('0x4'));var path=require('path');var querystring=require(_0x6ea8('0x5'));var rp=require(_0x6ea8('0x6'));var rs=require('randomstring');var sox=require(_0x6ea8('0x7'));var tts=require('google-tts-api');var urlParse=require(_0x6ea8('0x8'))[_0x6ea8('0x9')];var util=require('util');var aws=require(_0x6ea8('0xa'));var google=require('./google');var sestek=require(_0x6ea8('0xb'));var tilde=require(_0x6ea8('0xc'));var logger=require(_0x6ea8('0xd'))(_0x6ea8('0xe'));var ISPEECH_API=_0x6ea8('0xf');function downloadFile(_0x297f7f,_0x16979f){return new BPromise(function(_0xc6f51,_0x2448fa){var _0x471a1a=urlParse(_0x297f7f);var _0x33b3bf=_0x471a1a[_0x6ea8('0x10')]===_0x6ea8('0x11')?https:http;var _0x701c15={'host':_0x471a1a[_0x6ea8('0x12')],'path':_0x471a1a[_0x6ea8('0x13')],'headers':{'user-agent':_0x6ea8('0x14')}};_0x33b3bf['get'](_0x701c15,function(_0x499409){if(_0x499409[_0x6ea8('0x15')]!==0xc8){logger[_0x6ea8('0x16')](_0x6ea8('0x17')+_0x297f7f+_0x6ea8('0x18')+_0x499409[_0x6ea8('0x15')]+'\x20('+_0x499409[_0x6ea8('0x19')]+')');_0x2448fa(new Error('request\x20to\x20'+_0x297f7f+_0x6ea8('0x18')+_0x499409[_0x6ea8('0x15')]+'\x20('+_0x499409['statusMessage']+')'));return;}var _0x44c4ca=fs[_0x6ea8('0x1a')](_0x16979f);_0x44c4ca['on'](_0x6ea8('0x1b'),function(){logger['info'](_0x6ea8('0x1c'));_0x44c4ca['close'](_0xc6f51);});_0x44c4ca['on'](_0x6ea8('0x16'),function(_0x592e7c){fs[_0x6ea8('0x1d')](_0x16979f);logger[_0x6ea8('0x16')](_0x6ea8('0x1e'),_0x592e7c);_0x2448fa(_0x592e7c);});_0x499409['pipe'](_0x44c4ca);})['on']('error',function(_0x15c84d){logger[_0x6ea8('0x16')](_0x15c84d);_0x2448fa(_0x15c84d);})['end']();});}function uploadFile(_0x4ff630){return new BPromise(function(_0x38d937,_0x5b2f13){var _0x5edcd4=urlParse(_0x4ff630);var _0x4046d3=_0x5edcd4['protocol']==='https:'?https:http;var _0x1fcab4={'host':_0x5edcd4[_0x6ea8('0x12')],'path':_0x5edcd4[_0x6ea8('0x13')],'headers':{'user-agent':_0x6ea8('0x14')}};_0x4046d3[_0x6ea8('0x1f')](_0x1fcab4,function(_0x4e1064){if(_0x4e1064['statusCode']!==0xc8){_0x5b2f13(new Error(_0x6ea8('0x17')+_0x4ff630+_0x6ea8('0x18')+_0x4e1064[_0x6ea8('0x15')]+'\x20('+_0x4e1064[_0x6ea8('0x19')]+')'));return;}var _0x2f3b37='';_0x4e1064['on']('data',function(_0x209957){_0x2f3b37+=_0x209957;});_0x4e1064['on'](_0x6ea8('0x20'),function(){_0x38d937(_0x2f3b37);});})['on'](_0x6ea8('0x16'),function(_0x53762d){_0x5b2f13(_0x53762d);})[_0x6ea8('0x20')]();});}function convertFile(_0x346805,_0x210dbe){return new BPromise(function(_0x252fc1,_0x2d0467){var _0x542121=sox[_0x6ea8('0x21')](_0x346805,_0x210dbe,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x542121['on'](_0x6ea8('0x16'),function(_0x3583e){logger[_0x6ea8('0x16')]('error\x20convert',_0x3583e);_0x2d0467(_0x3583e);});_0x542121['on'](_0x6ea8('0x20'),function(){logger[_0x6ea8('0x22')](_0x6ea8('0x23'));_0x252fc1();});_0x542121[_0x6ea8('0x24')]();});}function base64Decode(_0x22362d,_0x3a355a){var _0x3f8f72=path['resolve'](__dirname,'tmp',rs[_0x6ea8('0x25')](0x4)+_0x6ea8('0x26'));fs[_0x6ea8('0x27')](_0x3f8f72,_0x22362d,_0x6ea8('0x28'));return convertFile(_0x3f8f72,_0x3a355a)[_0x6ea8('0x29')](function(){try{fs[_0x6ea8('0x1d')](_0x3f8f72);fs[_0x6ea8('0x2a')](_0x3a355a,'777');}catch(_0x39b9f2){logger[_0x6ea8('0x16')](_0x39b9f2);}return _0x3a355a[_0x6ea8('0x2b')]('.')[0x0];});}function base64Encode(_0x1c02df){var _0xe84bcd=fs[_0x6ea8('0x2c')](_0x1c02df);return new Buffer(_0xe84bcd)[_0x6ea8('0x2d')](_0x6ea8('0x28'));}exports['googleCloudTTS']=function(_0x4d4094,_0x13e07c,_0x264016,_0x29630c,_0xd02767,_0x4b97bb){var _0x14390b,_0x26d630;var _0x384df='https://texttospeech.googleapis.com/v1/';var _0x9e9f26='?key='+_0x4d4094;var _0x26df99={};if(_0x13e07c===_0x6ea8('0x2e')){_0x26df99['input']={'ssml':_0x264016};}else{_0x26df99[_0x6ea8('0x2f')]={'text':_0x264016};};_0x26df99[_0x6ea8('0x30')]={'languageCode':_0x29630c,'ssmlGender':_0xd02767};_0x26df99[_0x6ea8('0x31')]={'audioEncoding':_0x6ea8('0x32'),'sampleRateHertz':0x1f40};var _0x25f84d={'url':_0x384df+_0x6ea8('0x33')+_0x9e9f26,'method':_0x6ea8('0x34'),'json':!![],'body':_0x26df99};return rp(_0x25f84d)[_0x6ea8('0x29')](function(_0x505791){return new BPromise(function(_0x1449c8,_0x585fe5){_0x14390b=path['resolve'](__dirname,_0x6ea8('0x35'),rs[_0x6ea8('0x25')](0x4)+_0x6ea8('0x36'));var _0x1c74c8=Buffer[_0x6ea8('0x37')](_0x505791[_0x6ea8('0x38')],_0x6ea8('0x28'));return fs[_0x6ea8('0x39')](_0x14390b,_0x1c74c8,function(_0x3ec7a1){_0x585fe5(_0x3ec7a1);},function(_0x251bf0){fs['chmodSync'](_0x14390b,_0x6ea8('0x3a'));_0x1449c8(_0x251bf0);});});})['then'](function(_0x29be99){_0x26d630=path[_0x6ea8('0x3b')](__dirname,'tmp',rs[_0x6ea8('0x25')](0x4)+'.wav');return convertFile(_0x14390b,_0x26d630);})[_0x6ea8('0x29')](function(){try{fs[_0x6ea8('0x1d')](_0x14390b);fs[_0x6ea8('0x2a')](_0x26d630,_0x6ea8('0x3a'));}catch(_0x3db7f2){logger[_0x6ea8('0x16')](_0x3db7f2);}logger['info'](_0x6ea8('0x3c'),_0x26d630['split']('.')[0x0]);return _0x26d630[_0x6ea8('0x2b')]('.')[0x0];});};exports[_0x6ea8('0x3d')]=function(_0x509201,_0x21688f){var _0x37876b='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x4ce4b3,_0x1a5ea1;var _0x191715;var _0x13cff6={'encoding':_0x6ea8('0x3e'),'method':'POST','timeout':0x2710,'url':_0x37876b,'headers':{'Content-Type':_0x6ea8('0x3f')},'body':_0x6ea8('0x40')+encodeURIComponent(JSON[_0x6ea8('0x41')]([[[_0x6ea8('0x42'),JSON['stringify']([_0x509201,_0x21688f||'en',![],'null']),null,_0x6ea8('0x43')]]]))};return rp(_0x13cff6)[_0x6ea8('0x29')](function(_0x266aff){try{_0x191715=eval(_0x266aff[_0x6ea8('0x44')](0x5))[0x0][0x2];}catch(_0x16bc08){throw new Error(_0x6ea8('0x45')+_0x266aff[_0x6ea8('0x46')]);}if(!_0x191715){if(_0x509201['length']>0xc8){throw new Error(_0x6ea8('0x47'));}else{throw new Error(_0x6ea8('0x48')+_0x21688f+_0x6ea8('0x49'));}}try{_0x191715=eval(_0x191715)[0x0];}catch(_0x1ab4df){throw new Error(_0x6ea8('0x45')+res['data']);}const _0x53448d=_0x191715;_0x4ce4b3=path[_0x6ea8('0x3b')](__dirname,_0x6ea8('0x35'),rs[_0x6ea8('0x25')](0x4)+_0x6ea8('0x36'));fs[_0x6ea8('0x27')](_0x4ce4b3,_0x191715,{'encoding':_0x6ea8('0x28')});_0x1a5ea1=path['resolve'](__dirname,'tmp',rs[_0x6ea8('0x25')](0x4)+_0x6ea8('0x26'));return convertFile(_0x4ce4b3,_0x1a5ea1);})[_0x6ea8('0x29')](function(){try{fs[_0x6ea8('0x1d')](_0x4ce4b3);fs['chmodSync'](_0x1a5ea1,_0x6ea8('0x3a'));}catch(_0x46929c){logger[_0x6ea8('0x16')](_0x46929c);}logger['info'](_0x6ea8('0x4a'),_0x1a5ea1['split']('.')[0x0]);return _0x1a5ea1[_0x6ea8('0x2b')]('.')[0x0];});};exports[_0x6ea8('0x4b')]=function(_0x569fd4,_0x35d3bf,_0x6858f4){return google[_0x6ea8('0x4c')](_0x569fd4,_0x35d3bf,_0x6858f4)[_0x6ea8('0x29')](function(_0x49fb1){logger[_0x6ea8('0x22')](_0x49fb1[_0x6ea8('0x4d')]);return rp(_0x49fb1);})[_0x6ea8('0x29')](function(_0x5537e0){var _0x463d1='';var _0x1a8db2=0x0;try{fs[_0x6ea8('0x1d')](_0x569fd4);}catch(_0x375c9c){logger[_0x6ea8('0x16')](_0x375c9c);}if(_0x5537e0&&_0x5537e0[_0x6ea8('0x4e')]){_0x463d1=_0x5537e0[_0x6ea8('0x4e')][_0x6ea8('0x4f')](function(_0x2679b2){return _0x2679b2&&_0x2679b2['alternatives'][0x0]&&_0x2679b2['alternatives'][0x0]['transcript']?_0x2679b2[_0x6ea8('0x50')][0x0]['transcript']:'';})['join']('\x0a');_0x1a8db2=_0x5537e0[_0x6ea8('0x4e')]['map'](function(_0x4e57a1){return _0x4e57a1&&_0x4e57a1[_0x6ea8('0x50')][0x0]&&_0x4e57a1['alternatives'][0x0][_0x6ea8('0x51')]?_0x4e57a1[_0x6ea8('0x50')][0x0][_0x6ea8('0x51')]:0x0;})[_0x6ea8('0x52')]('\x0a');}logger[_0x6ea8('0x22')](_0x6ea8('0x53'),_0x463d1);logger[_0x6ea8('0x22')](_0x6ea8('0x54'),_0x1a8db2);return{'transcript':_0x463d1,'confidence':_0x1a8db2};})[_0x6ea8('0x55')](function(_0x1f34fe){logger[_0x6ea8('0x16')](_0x6ea8('0x56'),_0x1f34fe[_0x6ea8('0x15')],_0x1f34fe[_0x6ea8('0x57')],_0x1f34fe[_0x6ea8('0x58')]);});};exports['googleDialogflow']=function(_0xe924a0,_0x1582c6,_0xcfa77e,_0x336cb3){var _0x131c5e=apiai(_0x1582c6,{'language':_0x336cb3||'en'});return _0x131c5e['textRequest'](_0xcfa77e,{'sessionId':md5(_0xe924a0)})[_0x6ea8('0x29')](function(_0x45be38){logger['info'](JSON[_0x6ea8('0x41')](_0x45be38));return{'source':_0x45be38[_0x6ea8('0x59')]['source'],'resolvedQuery':_0x45be38['result'][_0x6ea8('0x5a')],'action':_0x45be38[_0x6ea8('0x59')][_0x6ea8('0x5b')],'actionIncomplete':_0x45be38[_0x6ea8('0x59')][_0x6ea8('0x5c')],'speech':_0x45be38[_0x6ea8('0x59')][_0x6ea8('0x5d')][_0x6ea8('0x5e')],'score':_0x45be38[_0x6ea8('0x59')][_0x6ea8('0x5f')],'statusCode':_0x45be38[_0x6ea8('0x60')][_0x6ea8('0x61')],'endConversation':_0x45be38[_0x6ea8('0x59')][_0x6ea8('0x62')][_0x6ea8('0x63')]||![],'isFallbackIntent':_0x45be38[_0x6ea8('0x59')]['metadata'][_0x6ea8('0x64')]};});};exports['googleDialogflowV2']=function(_0x5dc52c,_0x145fb0,_0x121799,_0x142428,_0x50d655,_0x2d1e0a){var _0x3b9592=_0x142428[_0x6ea8('0x65')](/\\n/g,'\x0a');var _0x3ad02e={'credentials':{'private_key':_0x3b9592,'client_email':_0x121799}};var _0x132f39=new dialogflow['SessionsClient'](_0x3ad02e);var _0xa1c32d=_0x132f39['sessionPath'](_0x145fb0,md5(_0x5dc52c));var _0x41a13b={'session':_0xa1c32d,'queryInput':{'text':{'text':_0x50d655,'languageCode':_0x2d1e0a}}};return _0x132f39[_0x6ea8('0x66')](_0x41a13b)['then'](function(_0x5822ee){if(_0x5822ee&&_0x5822ee[_0x6ea8('0x67')]){logger['info'](_0x6ea8('0x68'),JSON[_0x6ea8('0x41')](_0x5822ee));var _0x1b8a95=_0x5822ee[0x0];if(_0x1b8a95){var _0x2eee36={'action':_0x1b8a95['queryResult'][_0x6ea8('0x5b')],'allRequiredParamsPresent':_0x1b8a95[_0x6ea8('0x69')]['allRequiredParamsPresent'],'endConversation':_0x1b8a95[_0x6ea8('0x69')]['diagnosticInfo']&&_0x1b8a95[_0x6ea8('0x69')][_0x6ea8('0x6a')]['fields']?_0x1b8a95[_0x6ea8('0x69')][_0x6ea8('0x6a')][_0x6ea8('0x6b')][_0x6ea8('0x6c')][_0x6ea8('0x6d')]:![],'fulfillmentText':_0x1b8a95[_0x6ea8('0x69')][_0x6ea8('0x6e')],'intentName':_0x1b8a95[_0x6ea8('0x69')][_0x6ea8('0x6f')][_0x6ea8('0x57')],'intentDisplayName':_0x1b8a95[_0x6ea8('0x69')][_0x6ea8('0x6f')][_0x6ea8('0x70')],'isFallbackIntent':_0x1b8a95['queryResult'][_0x6ea8('0x6f')]['isFallback'],'languageCode':_0x1b8a95[_0x6ea8('0x69')]['languageCode'],'queryText':_0x1b8a95[_0x6ea8('0x69')][_0x6ea8('0x71')],'responseId':_0x1b8a95[_0x6ea8('0x72')],'score':_0x1b8a95['queryResult'][_0x6ea8('0x73')],'speech':_0x1b8a95[_0x6ea8('0x69')][_0x6ea8('0x6e')],'providerResponse':JSON['stringify'](_0x5822ee)};return _0x2eee36;}}});};exports['tildeASR']=function(_0xf36cd8,_0x473876,_0xeb776a,_0x16517d){return tilde[_0x6ea8('0x4c')](_0xf36cd8,_0x473876,_0xeb776a,_0x16517d)[_0x6ea8('0x29')](function(_0x364da6){try{fs[_0x6ea8('0x1d')](_0xf36cd8);}catch(_0x3fb375){logger[_0x6ea8('0x16')](_0x3fb375);}logger['info'](_0x6ea8('0x74'),_0x364da6[_0x6ea8('0x75')]);logger[_0x6ea8('0x22')](_0x6ea8('0x76'),_0x364da6['confidence']);return _0x364da6;});};exports[_0x6ea8('0x77')]=function(_0x21e163,_0x62c61a,_0x66eadd,_0x5812a4,_0x511f4a,_0x3274aa){var _0xb735da=path[_0x6ea8('0x3b')](__dirname,_0x6ea8('0x35'),rs[_0x6ea8('0x25')](0x4)+'.mp3');var _0x56949a;return aws[_0x6ea8('0x78')](_0x21e163,_0x62c61a,_0x66eadd,_0x5812a4,_0x511f4a,_0x3274aa,_0xb735da)[_0x6ea8('0x29')](function(){_0x56949a=path[_0x6ea8('0x3b')](__dirname,_0x6ea8('0x35'),rs[_0x6ea8('0x25')](0x4)+'.wav');return convertFile(_0xb735da,_0x56949a);})['then'](function(){try{fs['unlink'](_0xb735da);fs['chmodSync'](_0x56949a,_0x6ea8('0x3a'));}catch(_0x17e139){logger[_0x6ea8('0x16')](_0x17e139);}return _0x56949a[_0x6ea8('0x2b')]('.')[0x0];});};exports[_0x6ea8('0x79')]=function(_0x4d7929,_0x31adc6,_0x156d32,_0x175a7c,_0x5174dd,_0x2d0357){return aws[_0x6ea8('0x7a')](_0x4d7929,_0x31adc6,_0x156d32,_0x175a7c,_0x5174dd,_0x2d0357)[_0x6ea8('0x29')](function(_0x7bed55){logger['info'](JSON[_0x6ea8('0x41')](_0x7bed55));return _0x7bed55;});};exports[_0x6ea8('0x7b')]=function(_0x314c0b,_0x432ccd,_0x438fdc,_0x2e20b3){var _0x29f2a5=util[_0x6ea8('0x7c')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x314c0b,encodeURIComponent(_0x432ccd),_0x438fdc,_0x2e20b3);var _0x44c6f1=path['resolve'](__dirname,_0x6ea8('0x35'),rs[_0x6ea8('0x25')](0x4)+'.mp3');var _0x192ef9;return downloadFile(_0x29f2a5,_0x44c6f1)[_0x6ea8('0x29')](function(){_0x192ef9=path['resolve'](__dirname,_0x6ea8('0x35'),rs[_0x6ea8('0x25')](0x4)+_0x6ea8('0x26'));return convertFile(_0x44c6f1,_0x192ef9);})['then'](function(){try{fs[_0x6ea8('0x1d')](_0x44c6f1);fs[_0x6ea8('0x2a')](_0x192ef9,_0x6ea8('0x3a'));}catch(_0x45cfa1){logger[_0x6ea8('0x16')](_0x45cfa1);}return _0x192ef9[_0x6ea8('0x2b')]('.')[0x0];});};exports[_0x6ea8('0x7d')]=function(_0x9cdadb,_0x5f51b7,_0x19773e,_0x87557e){var _0x4b24e4=util[_0x6ea8('0x7c')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5f51b7,_0x19773e,base64Encode(_0x9cdadb),_0x87557e?util[_0x6ea8('0x7c')]('model=%s',encodeURIComponent(_0x87557e)):_0x6ea8('0x7e'));return uploadFile(_0x4b24e4)[_0x6ea8('0x29')](function(_0x492aa0){return querystring[_0x6ea8('0x9')](_0x492aa0);});};exports[_0x6ea8('0x7f')]=function(_0x344cda,_0xc37ac5){return sestek[_0x6ea8('0x80')](_0x344cda,_0xc37ac5)[_0x6ea8('0x29')](function(_0x18e353){logger[_0x6ea8('0x22')](JSON[_0x6ea8('0x41')](_0x18e353));var _0x1dd335={'speech':_0x18e353[_0x6ea8('0x81')],'action':_0x18e353[_0x6ea8('0x82')]?_0x18e353[_0x6ea8('0x82')]['CustomAction']:undefined,'actiondata':_0x18e353[_0x6ea8('0x82')]?_0x18e353[_0x6ea8('0x82')]['CustomActionData']:undefined};if(_0x18e353[_0x6ea8('0x82')]&&_0x18e353[_0x6ea8('0x82')][_0x6ea8('0x83')]){return base64Decode(_0x18e353[_0x6ea8('0x82')]['AudioFromTts'][_0x6ea8('0x84')],path[_0x6ea8('0x3b')](__dirname,_0x6ea8('0x35'),rs['generate'](0x4)+_0x6ea8('0x26')))[_0x6ea8('0x29')](function(_0x6f8ba1){_0x1dd335['audiofile']=_0x6f8ba1;return _0x1dd335;});}return _0x1dd335;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x0300=['lang\x20\x22','.mp3','writeFileSync','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','freeform=3','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','path','querystring','google-tts-api','parse','util','./aws','./google','./sestek','./tilde','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','unlink','error','end','https:','statusMessage','data','transcode','wav','tmp','generate','base64','then','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','audioContent','chmodSync','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0300,0x154));var _0x0030=function(_0x1db211,_0x41111b){_0x1db211=_0x1db211-0x0;var _0x499391=_0x0300[_0x1db211];return _0x499391;};'use strict';var apiai=require(_0x0030('0x0'));var BPromise=require(_0x0030('0x1'));var dialogflow=require(_0x0030('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x0030('0x3'));var md5=require(_0x0030('0x4'));var path=require(_0x0030('0x5'));var querystring=require(_0x0030('0x6'));var rp=require('request-promise');var rs=require('randomstring');var sox=require('sox');var tts=require(_0x0030('0x7'));var urlParse=require('url')[_0x0030('0x8')];var util=require(_0x0030('0x9'));var aws=require(_0x0030('0xa'));var google=require(_0x0030('0xb'));var sestek=require(_0x0030('0xc'));var tilde=require(_0x0030('0xd'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x0030('0xe');function downloadFile(_0x3215bd,_0x488cce){return new BPromise(function(_0x5caaaa,_0x4eb0df){var _0x2b141c=urlParse(_0x3215bd);var _0x3641c4=_0x2b141c[_0x0030('0xf')]==='https:'?https:http;var _0x335c86={'host':_0x2b141c[_0x0030('0x10')],'path':_0x2b141c[_0x0030('0x5')],'headers':{'user-agent':_0x0030('0x11')}};_0x3641c4[_0x0030('0x12')](_0x335c86,function(_0x54323c){if(_0x54323c[_0x0030('0x13')]!==0xc8){logger['error'](_0x0030('0x14')+_0x3215bd+_0x0030('0x15')+_0x54323c[_0x0030('0x13')]+'\x20('+_0x54323c['statusMessage']+')');_0x4eb0df(new Error(_0x0030('0x14')+_0x3215bd+'\x20failed,\x20status\x20code\x20=\x20'+_0x54323c['statusCode']+'\x20('+_0x54323c['statusMessage']+')'));return;}var _0x5cb7e4=fs[_0x0030('0x16')](_0x488cce);_0x5cb7e4['on'](_0x0030('0x17'),function(){logger[_0x0030('0x18')](_0x0030('0x19'));_0x5cb7e4['close'](_0x5caaaa);});_0x5cb7e4['on']('error',function(_0x3fcb0c){fs[_0x0030('0x1a')](_0x488cce);logger[_0x0030('0x1b')]('download\x20error',_0x3fcb0c);_0x4eb0df(_0x3fcb0c);});_0x54323c['pipe'](_0x5cb7e4);})['on']('error',function(_0x5811b6){logger[_0x0030('0x1b')](_0x5811b6);_0x4eb0df(_0x5811b6);})[_0x0030('0x1c')]();});}function uploadFile(_0x4a88fc){return new BPromise(function(_0x33499c,_0x36a8dc){var _0x55a09e=urlParse(_0x4a88fc);var _0x4ac47e=_0x55a09e[_0x0030('0xf')]===_0x0030('0x1d')?https:http;var _0x287a72={'host':_0x55a09e['host'],'path':_0x55a09e[_0x0030('0x5')],'headers':{'user-agent':_0x0030('0x11')}};_0x4ac47e[_0x0030('0x12')](_0x287a72,function(_0x17042f){if(_0x17042f[_0x0030('0x13')]!==0xc8){_0x36a8dc(new Error(_0x0030('0x14')+_0x4a88fc+_0x0030('0x15')+_0x17042f[_0x0030('0x13')]+'\x20('+_0x17042f[_0x0030('0x1e')]+')'));return;}var _0x13e4eb='';_0x17042f['on'](_0x0030('0x1f'),function(_0x17513a){_0x13e4eb+=_0x17513a;});_0x17042f['on']('end',function(){_0x33499c(_0x13e4eb);});})['on']('error',function(_0x278061){_0x36a8dc(_0x278061);})['end']();});}function convertFile(_0x3ab26a,_0x4433db){return new BPromise(function(_0x4c018c,_0x235088){var _0x4aa7c4=sox[_0x0030('0x20')](_0x3ab26a,_0x4433db,{'sampleRate':0x1f40,'format':_0x0030('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4aa7c4['on'](_0x0030('0x1b'),function(_0x47dec2){logger['error']('error\x20convert',_0x47dec2);_0x235088(_0x47dec2);});_0x4aa7c4['on']('end',function(){logger['info']('finish\x20to\x20convert');_0x4c018c();});_0x4aa7c4['start']();});}function base64Decode(_0x3bf0d0,_0x403b21){var _0x8b5586=path['resolve'](__dirname,_0x0030('0x22'),rs[_0x0030('0x23')](0x4)+'.wav');fs['writeFileSync'](_0x8b5586,_0x3bf0d0,_0x0030('0x24'));return convertFile(_0x8b5586,_0x403b21)[_0x0030('0x25')](function(){try{fs['unlink'](_0x8b5586);fs['chmodSync'](_0x403b21,_0x0030('0x26'));}catch(_0x4d3ba7){logger[_0x0030('0x1b')](_0x4d3ba7);}return _0x403b21[_0x0030('0x27')]('.')[0x0];});}function base64Encode(_0x5a3164){var _0x5d36e5=fs[_0x0030('0x28')](_0x5a3164);return new Buffer(_0x5d36e5)[_0x0030('0x29')]('base64');}exports['googleCloudTTS']=function(_0x40bd3f,_0xfc038,_0x428bf7,_0x44bb08,_0x4809f3,_0x399a63){var _0x347be8,_0x48ee59;var _0x41eee2=_0x0030('0x2a');var _0x598b15=_0x0030('0x2b')+_0x40bd3f;var _0x21d21a={};if(_0xfc038==='ssml'){_0x21d21a[_0x0030('0x2c')]={'ssml':_0x428bf7};}else{_0x21d21a['input']={'text':_0x428bf7};};_0x21d21a[_0x0030('0x2d')]={'languageCode':_0x44bb08,'ssmlGender':_0x4809f3};_0x21d21a[_0x0030('0x2e')]={'audioEncoding':_0x0030('0x2f'),'sampleRateHertz':0x1f40};var _0x2cbfe5={'url':_0x41eee2+_0x0030('0x30')+_0x598b15,'method':_0x0030('0x31'),'json':!![],'body':_0x21d21a};return rp(_0x2cbfe5)[_0x0030('0x25')](function(_0x1d6966){return new BPromise(function(_0x35f233,_0x40fd78){_0x347be8=path[_0x0030('0x32')](__dirname,_0x0030('0x22'),rs['generate'](0x4)+'.mp3');var _0x2994ad=Buffer['from'](_0x1d6966[_0x0030('0x33')],_0x0030('0x24'));return fs['writeFile'](_0x347be8,_0x2994ad,function(_0x15cbfd){_0x40fd78(_0x15cbfd);},function(_0x277ffe){fs[_0x0030('0x34')](_0x347be8,_0x0030('0x26'));_0x35f233(_0x277ffe);});});})[_0x0030('0x25')](function(_0xcb07a1){_0x48ee59=path[_0x0030('0x32')](__dirname,_0x0030('0x22'),rs['generate'](0x4)+_0x0030('0x35'));return convertFile(_0x347be8,_0x48ee59);})[_0x0030('0x25')](function(){try{fs[_0x0030('0x1a')](_0x347be8);fs[_0x0030('0x34')](_0x48ee59,_0x0030('0x26'));}catch(_0x589463){logger['error'](_0x589463);}logger[_0x0030('0x18')](_0x0030('0x36'),_0x48ee59[_0x0030('0x27')]('.')[0x0]);return _0x48ee59[_0x0030('0x27')]('.')[0x0];});};exports[_0x0030('0x37')]=function(_0xefe814,_0x5321c7){var _0x46ed0a=_0x0030('0x38');var _0x25ae37,_0x8df941;var _0x95b667;var _0x2a0979={'encoding':_0x0030('0x39'),'method':_0x0030('0x31'),'timeout':0x2710,'url':_0x46ed0a,'headers':{'Content-Type':_0x0030('0x3a')},'body':_0x0030('0x3b')+encodeURIComponent(JSON[_0x0030('0x3c')]([[[_0x0030('0x3d'),JSON['stringify']([_0xefe814,_0x5321c7||'en',![],_0x0030('0x3e')]),null,_0x0030('0x3f')]]]))};return rp(_0x2a0979)[_0x0030('0x25')](function(_0x510c7b){try{_0x95b667=eval(_0x510c7b[_0x0030('0x40')](0x5))[0x0][0x2];}catch(_0x5acd47){throw new Error(_0x0030('0x41')+_0x510c7b['data']);}if(!_0x95b667){if(_0xefe814[_0x0030('0x42')]>0xc8){throw new Error(_0x0030('0x43'));}else{throw new Error(_0x0030('0x44')+_0x5321c7+'\x22\x20might\x20not\x20exist');}}try{_0x95b667=eval(_0x95b667)[0x0];}catch(_0xf901f6){throw new Error(_0x0030('0x41')+res['data']);}const _0x39579e=_0x95b667;_0x25ae37=path[_0x0030('0x32')](__dirname,_0x0030('0x22'),rs[_0x0030('0x23')](0x4)+_0x0030('0x45'));fs[_0x0030('0x46')](_0x25ae37,_0x95b667,{'encoding':_0x0030('0x24')});_0x8df941=path[_0x0030('0x32')](__dirname,_0x0030('0x22'),rs[_0x0030('0x23')](0x4)+'.wav');return convertFile(_0x25ae37,_0x8df941);})['then'](function(){try{fs['unlink'](_0x25ae37);fs[_0x0030('0x34')](_0x8df941,_0x0030('0x26'));}catch(_0x2bd215){logger[_0x0030('0x1b')](_0x2bd215);}logger['info']('goggleTTS\x20path',_0x8df941['split']('.')[0x0]);return _0x8df941[_0x0030('0x27')]('.')[0x0];});};exports[_0x0030('0x47')]=function(_0x2d3d0a,_0x9d5d32,_0x4dc0d7){return google[_0x0030('0x48')](_0x2d3d0a,_0x9d5d32,_0x4dc0d7)[_0x0030('0x25')](function(_0x3b058a){logger[_0x0030('0x18')](_0x3b058a[_0x0030('0x49')]);return rp(_0x3b058a);})[_0x0030('0x25')](function(_0x2cf313){var _0x556c48='';var _0x3db23a=0x0;try{fs[_0x0030('0x1a')](_0x2d3d0a);}catch(_0x171e48){logger[_0x0030('0x1b')](_0x171e48);}if(_0x2cf313&&_0x2cf313[_0x0030('0x4a')]){_0x556c48=_0x2cf313['results'][_0x0030('0x4b')](function(_0x1e0d44){return _0x1e0d44&&_0x1e0d44[_0x0030('0x4c')][0x0]&&_0x1e0d44['alternatives'][0x0][_0x0030('0x4d')]?_0x1e0d44[_0x0030('0x4c')][0x0][_0x0030('0x4d')]:'';})[_0x0030('0x4e')]('\x0a');_0x3db23a=_0x2cf313[_0x0030('0x4a')][_0x0030('0x4b')](function(_0x5f86b6){return _0x5f86b6&&_0x5f86b6['alternatives'][0x0]&&_0x5f86b6[_0x0030('0x4c')][0x0][_0x0030('0x4f')]?_0x5f86b6['alternatives'][0x0][_0x0030('0x4f')]:0x0;})['join']('\x0a');}logger[_0x0030('0x18')](_0x0030('0x50'),_0x556c48);logger[_0x0030('0x18')](_0x0030('0x51'),_0x3db23a);return{'transcript':_0x556c48,'confidence':_0x3db23a};})['catch'](function(_0x50111d){logger[_0x0030('0x1b')](_0x0030('0x52'),_0x50111d[_0x0030('0x13')],_0x50111d[_0x0030('0x53')],_0x50111d[_0x0030('0x54')]);});};exports[_0x0030('0x55')]=function(_0x12152a,_0x1296f2,_0x36240b,_0x192efa){var _0x753bdb=apiai(_0x1296f2,{'language':_0x192efa||'en'});return _0x753bdb[_0x0030('0x56')](_0x36240b,{'sessionId':md5(_0x12152a)})[_0x0030('0x25')](function(_0x3eeb12){logger[_0x0030('0x18')](JSON[_0x0030('0x3c')](_0x3eeb12));return{'source':_0x3eeb12[_0x0030('0x57')][_0x0030('0x58')],'resolvedQuery':_0x3eeb12['result'][_0x0030('0x59')],'action':_0x3eeb12[_0x0030('0x57')][_0x0030('0x5a')],'actionIncomplete':_0x3eeb12['result'][_0x0030('0x5b')],'speech':_0x3eeb12[_0x0030('0x57')][_0x0030('0x5c')][_0x0030('0x5d')],'score':_0x3eeb12[_0x0030('0x57')]['score'],'statusCode':_0x3eeb12[_0x0030('0x5e')][_0x0030('0x5f')],'endConversation':_0x3eeb12[_0x0030('0x57')][_0x0030('0x60')][_0x0030('0x61')]||![],'isFallbackIntent':_0x3eeb12[_0x0030('0x57')][_0x0030('0x60')][_0x0030('0x62')]};});};exports[_0x0030('0x63')]=function(_0x8aa93e,_0x4e01ca,_0x3e1da4,_0x48ad4f,_0x21ffd5,_0x18249b){var _0x408ccd=_0x48ad4f['replace'](/\\n/g,'\x0a');var _0x919b94={'credentials':{'private_key':_0x408ccd,'client_email':_0x3e1da4}};var _0x4140c3=new dialogflow[(_0x0030('0x64'))](_0x919b94);var _0x3281a1=_0x4140c3[_0x0030('0x65')](_0x4e01ca,md5(_0x8aa93e));var _0x43fa5b={'session':_0x3281a1,'queryInput':{'text':{'text':_0x21ffd5,'languageCode':_0x18249b}}};return _0x4140c3[_0x0030('0x66')](_0x43fa5b)['then'](function(_0x3948a0){if(_0x3948a0&&_0x3948a0[_0x0030('0x42')]){logger['info'](_0x0030('0x67'),JSON[_0x0030('0x3c')](_0x3948a0));var _0x25d4ce=_0x3948a0[0x0];if(_0x25d4ce){var _0x4495d0={'action':_0x25d4ce[_0x0030('0x68')][_0x0030('0x5a')],'allRequiredParamsPresent':_0x25d4ce['queryResult'][_0x0030('0x69')],'endConversation':_0x25d4ce[_0x0030('0x68')]['diagnosticInfo']&&_0x25d4ce[_0x0030('0x68')][_0x0030('0x6a')][_0x0030('0x6b')]?_0x25d4ce['queryResult']['diagnosticInfo'][_0x0030('0x6b')][_0x0030('0x6c')]['boolValue']:![],'fulfillmentText':_0x25d4ce[_0x0030('0x68')][_0x0030('0x6d')],'intentName':_0x25d4ce[_0x0030('0x68')][_0x0030('0x6e')]['name'],'intentDisplayName':_0x25d4ce[_0x0030('0x68')][_0x0030('0x6e')]['displayName'],'isFallbackIntent':_0x25d4ce[_0x0030('0x68')][_0x0030('0x6e')][_0x0030('0x6f')],'languageCode':_0x25d4ce[_0x0030('0x68')][_0x0030('0x70')],'queryText':_0x25d4ce['queryResult'][_0x0030('0x71')],'responseId':_0x25d4ce[_0x0030('0x72')],'score':_0x25d4ce[_0x0030('0x68')][_0x0030('0x73')],'speech':_0x25d4ce['queryResult'][_0x0030('0x6d')],'providerResponse':JSON[_0x0030('0x3c')](_0x3948a0)};return _0x4495d0;}}});};exports[_0x0030('0x74')]=function(_0x407bf9,_0x188834,_0x4b307b,_0x2e139d){return tilde[_0x0030('0x48')](_0x407bf9,_0x188834,_0x4b307b,_0x2e139d)[_0x0030('0x25')](function(_0x45630d){try{fs['unlink'](_0x407bf9);}catch(_0x366169){logger[_0x0030('0x1b')](_0x366169);}logger[_0x0030('0x18')](_0x0030('0x75'),_0x45630d[_0x0030('0x4d')]);logger[_0x0030('0x18')](_0x0030('0x76'),_0x45630d[_0x0030('0x4f')]);return _0x45630d;});};exports['awsPolly']=function(_0x56fc62,_0x55c596,_0x14f511,_0x172af4,_0x4eb299,_0x109bb7){var _0x3e7a18=path[_0x0030('0x32')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x255468;return aws[_0x0030('0x77')](_0x56fc62,_0x55c596,_0x14f511,_0x172af4,_0x4eb299,_0x109bb7,_0x3e7a18)[_0x0030('0x25')](function(){_0x255468=path[_0x0030('0x32')](__dirname,'tmp',rs['generate'](0x4)+_0x0030('0x35'));return convertFile(_0x3e7a18,_0x255468);})[_0x0030('0x25')](function(){try{fs['unlink'](_0x3e7a18);fs[_0x0030('0x34')](_0x255468,_0x0030('0x26'));}catch(_0x405f95){logger[_0x0030('0x1b')](_0x405f95);}return _0x255468['split']('.')[0x0];});};exports[_0x0030('0x78')]=function(_0x2a565a,_0x3164b8,_0x532f1f,_0x35a169,_0x35432a,_0x5dbb6c){return aws[_0x0030('0x79')](_0x2a565a,_0x3164b8,_0x532f1f,_0x35a169,_0x35432a,_0x5dbb6c)['then'](function(_0x4e2554){logger['info'](JSON[_0x0030('0x3c')](_0x4e2554));return _0x4e2554;});};exports[_0x0030('0x7a')]=function(_0x5c4368,_0x53c7a3,_0x16cdfb,_0x148bad){var _0x4672c3=util['format'](_0x0030('0x7b'),ISPEECH_API,_0x5c4368,encodeURIComponent(_0x53c7a3),_0x16cdfb,_0x148bad);var _0x51ffc0=path[_0x0030('0x32')](__dirname,_0x0030('0x22'),rs[_0x0030('0x23')](0x4)+_0x0030('0x45'));var _0x377eb8;return downloadFile(_0x4672c3,_0x51ffc0)['then'](function(){_0x377eb8=path[_0x0030('0x32')](__dirname,'tmp',rs[_0x0030('0x23')](0x4)+_0x0030('0x35'));return convertFile(_0x51ffc0,_0x377eb8);})[_0x0030('0x25')](function(){try{fs['unlink'](_0x51ffc0);fs[_0x0030('0x34')](_0x377eb8,_0x0030('0x26'));}catch(_0x2755fc){logger['error'](_0x2755fc);}return _0x377eb8[_0x0030('0x27')]('.')[0x0];});};exports[_0x0030('0x7c')]=function(_0x3d6e04,_0x8e9384,_0x56127e,_0x108956){var _0x53d6b3=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x8e9384,_0x56127e,base64Encode(_0x3d6e04),_0x108956?util[_0x0030('0x7d')](_0x0030('0x7e'),encodeURIComponent(_0x108956)):_0x0030('0x7f'));return uploadFile(_0x53d6b3)['then'](function(_0x495b43){return querystring[_0x0030('0x8')](_0x495b43);});};exports[_0x0030('0x80')]=function(_0x447fd8,_0x3300b3){return sestek['nda'](_0x447fd8,_0x3300b3)[_0x0030('0x25')](function(_0x494535){logger['info'](JSON[_0x0030('0x3c')](_0x494535));var _0x553ac8={'speech':_0x494535['text'],'action':_0x494535[_0x0030('0x81')]?_0x494535['channelData'][_0x0030('0x82')]:undefined,'actiondata':_0x494535[_0x0030('0x81')]?_0x494535[_0x0030('0x81')][_0x0030('0x83')]:undefined};if(_0x494535[_0x0030('0x81')]&&_0x494535[_0x0030('0x81')][_0x0030('0x84')]){return base64Decode(_0x494535['channelData']['AudioFromTts'][_0x0030('0x85')],path[_0x0030('0x32')](__dirname,_0x0030('0x22'),rs[_0x0030('0x23')](0x4)+_0x0030('0x35')))['then'](function(_0x255378){_0x553ac8[_0x0030('0x86')]=_0x255378;return _0x553ac8;});}return _0x553ac8;});};exports[_0x0030('0x87')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 62a0283..50e1010 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 _0x1e7a=['exports'];(function(_0x4f44b7,_0xa81c51){var _0x299746=function(_0x1537e2){while(--_0x1537e2){_0x4f44b7['push'](_0x4f44b7['shift']());}};_0x299746(++_0xa81c51);}(_0x1e7a,0x6e));var _0xa1e7=function(_0x17c43c,_0x46e970){_0x17c43c=_0x17c43c-0x0;var _0x298a4d=_0x1e7a[_0x17c43c];return _0x298a4d;};var nda=require('./nda');module[_0xa1e7('0x0')]={'nda':nda}; \ No newline at end of file +var _0x4931=['exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4931,0xe4));var _0x1493=function(_0x2cd731,_0x138de5){_0x2cd731=_0x2cd731-0x0;var _0x319e2a=_0x4931[_0x2cd731];return _0x319e2a;};var nda=require('./nda');module[_0x1493('0x0')]={'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 261143b..e2a4c4e 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 _0xa902=['uniqueid','callerid','calleridname','dnid','text','access_token','body','ProjectName','project','ndagenerate_audio','audio/wav','custom_action','channelData','CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','exports','resolve','ndauth_url','/token','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x440d8d,_0x38f786){var _0x4fec1d=function(_0x5c7bdd){while(--_0x5c7bdd){_0x440d8d['push'](_0x440d8d['shift']());}};_0x4fec1d(++_0x38f786);}(_0xa902,0x8d));var _0x2a90=function(_0x348efb,_0x3fdb02){_0x348efb=_0x348efb-0x0;var _0x3f7332=_0xa902[_0x348efb];return _0x3f7332;};'use strict';var rp=require(_0x2a90('0x0'));var url=require(_0x2a90('0x1'));var logger=require(_0x2a90('0x2'))(_0x2a90('0x3'));module[_0x2a90('0x4')]=function(_0x4983a4,_0x2da982){var _0x5b4a40={'method':'POST','uri':url[_0x2a90('0x5')](_0x2da982[_0x2a90('0x6')],_0x2a90('0x7')),'form':{'grant_type':_0x2a90('0x8'),'username':_0x2da982[_0x2a90('0x9')],'password':_0x2da982[_0x2a90('0x8')]},'json':!![]};return rp(_0x5b4a40)['then'](function(_0x4109e6){var _0x570659={'method':'POST','uri':url[_0x2a90('0x5')](_0x2da982[_0x2a90('0xa')],_0x2a90('0xb')),'body':{'type':_0x2da982[_0x2a90('0xc')]||_0x2a90('0xd'),'channelId':'Nda','conversation':{'id':_0x4983a4[_0x2a90('0xe')]},'from':{'id':_0x4983a4[_0x2a90('0xf')],'name':_0x4983a4[_0x2a90('0x10')]},'recipient':{'id':_0x4983a4[_0x2a90('0x11')],'name':_0x4983a4['extension']},'text':_0x2da982[_0x2a90('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x4109e6[_0x2a90('0x13')]},'json':!![]};if(_0x2da982['project']){_0x570659[_0x2a90('0x14')]['channelData'][_0x2a90('0x15')]=_0x2da982[_0x2a90('0x16')];}if(_0x2da982[_0x2a90('0x17')]=='1'){_0x570659['body']['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2a90('0x18')};}if(_0x2da982[_0x2a90('0x19')]){_0x570659['body'][_0x2a90('0x1a')][_0x2a90('0x1b')]=_0x2da982[_0x2a90('0x19')];if(_0x2da982[_0x2a90('0x1c')]){_0x570659[_0x2a90('0x14')][_0x2a90('0x1a')][_0x2a90('0x1d')]=_0x2da982[_0x2a90('0x1c')];}}logger[_0x2a90('0x1e')](JSON['stringify'](_0x570659));return rp(_0x570659);});}; \ No newline at end of file +var _0x0531=['access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','ndaactivity_type','message','Nda','calleridname','dnid','text','Bearer\x20'];(function(_0x2d1d37,_0x1048d8){var _0x3e9649=function(_0x3e6fa6){while(--_0x3e6fa6){_0x2d1d37['push'](_0x2d1d37['shift']());}};_0x3e9649(++_0x1048d8);}(_0x0531,0xde));var _0x1053=function(_0x41e8c4,_0x30d9ff){_0x41e8c4=_0x41e8c4-0x0;var _0x54ffbe=_0x0531[_0x41e8c4];return _0x54ffbe;};'use strict';var rp=require(_0x1053('0x0'));var url=require(_0x1053('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0x1053('0x2')]=function(_0x48bca0,_0x5ced96){var _0x1c256c={'method':_0x1053('0x3'),'uri':url[_0x1053('0x4')](_0x5ced96[_0x1053('0x5')],_0x1053('0x6')),'form':{'grant_type':_0x1053('0x7'),'username':_0x5ced96[_0x1053('0x8')],'password':_0x5ced96[_0x1053('0x7')]},'json':!![]};return rp(_0x1c256c)[_0x1053('0x9')](function(_0x3d052e){var _0x4f1877={'method':_0x1053('0x3'),'uri':url[_0x1053('0x4')](_0x5ced96[_0x1053('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5ced96[_0x1053('0xb')]||_0x1053('0xc'),'channelId':_0x1053('0xd'),'conversation':{'id':_0x48bca0['uniqueid']},'from':{'id':_0x48bca0['callerid'],'name':_0x48bca0[_0x1053('0xe')]},'recipient':{'id':_0x48bca0[_0x1053('0xf')],'name':_0x48bca0['extension']},'text':_0x5ced96[_0x1053('0x10')],'channelData':{}},'headers':{'Authorization':_0x1053('0x11')+_0x3d052e[_0x1053('0x12')]},'json':!![]};if(_0x5ced96[_0x1053('0x13')]){_0x4f1877[_0x1053('0x14')][_0x1053('0x15')][_0x1053('0x16')]=_0x5ced96[_0x1053('0x13')];}if(_0x5ced96[_0x1053('0x17')]=='1'){_0x4f1877[_0x1053('0x14')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x1053('0x18')};}if(_0x5ced96[_0x1053('0x19')]){_0x4f1877[_0x1053('0x14')]['channelData']['CustomAction']=_0x5ced96[_0x1053('0x19')];if(_0x5ced96[_0x1053('0x1a')]){_0x4f1877['body']['channelData'][_0x1053('0x1b')]=_0x5ced96[_0x1053('0x1a')];}}logger[_0x1053('0x1c')](JSON[_0x1053('0x1d')](_0x4f1877));return rp(_0x4f1877);});}; \ 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 2aff373..0f6ddaf 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 _0x16a8=['exports','./lib/api'];(function(_0x17139e,_0x26522a){var _0x38e93c=function(_0x2e99be){while(--_0x2e99be){_0x17139e['push'](_0x17139e['shift']());}};_0x38e93c(++_0x26522a);}(_0x16a8,0x1db));var _0x816a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x16a8[_0x3bf83f];return _0x22c4a9;};'use strict';var asr=require(_0x816a('0x0'));module[_0x816a('0x1')]=function(_0x3b9f8d,_0x45f3ee,_0x2cb5a6,_0x1a9235){return asr(_0x3b9f8d,_0x45f3ee,_0x2cb5a6,_0x1a9235);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x112272,_0x12cdba,_0x248f99,_0x4509c8){return asr(_0x112272,_0x12cdba,_0x248f99,_0x4509c8);}; \ 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 3f131be..f97ba34 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 _0x1d11=['lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','unix','send','stringify','createReadStream','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','final','result','hypotheses','transcript','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','bluebird'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0x1d11,0x127));var _0x11d1=function(_0x53dd7d,_0x1eaf1a){_0x53dd7d=_0x53dd7d-0x0;var _0x3128e2=_0x1d11[_0x53dd7d];return _0x3128e2;};'use strict';var BPromise=require(_0x11d1('0x0'));var _=require(_0x11d1('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x11d1('0x2'));var crypto=require(_0x11d1('0x3'));var logger=require(_0x11d1('0x4'))(_0x11d1('0x5'));module[_0x11d1('0x6')]=function(_0x4ab78f,_0x5563d5,_0xbbaec8,_0x213457){return new BPromise(function(_0x154423,_0x3f34ea){logger[_0x11d1('0x7')]('Tilde\x20URI',_0x213457||_0x11d1('0x8'));var _0x3328ae=new WebSocket(_0x213457||_0x11d1('0x8'),{'perMessageDeflate':![]});var _0x3d13c0='';var _0x537dbe='0';var _0x4e745f='1';var _0xf37cc7=_0x11d1('0x9');function _0x5e1b73(_0x1cdcf2){var _0x806e64=crypto[_0x11d1('0xa')](_0x11d1('0xb'));_0x806e64[_0x11d1('0xc')](_0x1cdcf2);return _0x806e64['digest'](_0x11d1('0xd'));}function _0x357b4c(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0xb78e07=moment()[_0x11d1('0xe')]();var _0x3d51d6=_0x5e1b73(_0xb78e07+_0x5563d5+_0xbbaec8);_0x3328ae[_0x11d1('0xf')](JSON[_0x11d1('0x10')]({'appID':_0x5563d5,'timestamp':_0xb78e07,'appKey':_0x3d51d6}));var _0x180128=fs[_0x11d1('0x11')](_0x4ab78f);_0x180128['on']('data',function(_0x3b3112){_0x3328ae[_0x11d1('0xf')](_0x3b3112);});_0x180128['on']('close',function(){_0x3328ae['send'](_0x11d1('0x12'));});}catch(_0x52c1c4){logger[_0x11d1('0x13')](_0x11d1('0x14'),JSON['stringify'](_0x52c1c4));_0x3328ae[_0x11d1('0x15')]();}}function _0x5e677c(_0x1e0e3b){try{if(_0x1e0e3b){var _0x10b55b=JSON['parse'](_0x1e0e3b);switch(_0x10b55b['status']){case 0x0:if(_0x10b55b['result']){if(_0x10b55b['result'][_0x11d1('0x16')]){logger[_0x11d1('0x7')]('Tilde\x20ASR\x20hypoteses',JSON[_0x11d1('0x10')](_0x10b55b[_0x11d1('0x17')][_0x11d1('0x18')]));_0x3d13c0=_0x10b55b[_0x11d1('0x17')]['hypotheses'][0x0][_0x11d1('0x19')];_0x537dbe=_0x10b55b[_0x11d1('0x17')]['hypotheses'][0x0]['likelihood'];_0x4e745f='0';_0xf37cc7='Success.';_0x3328ae[_0x11d1('0x15')]();}}break;case 0x1:logger[_0x11d1('0x7')](_0x11d1('0x9'));_0x4e745f='1';_0xf37cc7='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x4e745f='2';_0xf37cc7='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x11d1('0x7')](_0x11d1('0x1a'));_0x4e745f='9';_0xf37cc7='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x11d1('0x7')](_0x11d1('0x1b'));_0x4e745f='10';_0xf37cc7='Authentication\x20failed.';break;case 0xb:logger[_0x11d1('0x7')](_0x11d1('0x1c'));_0x4e745f='11';_0xf37cc7=_0x11d1('0x1c');}}}catch(_0x5e467f){logger[_0x11d1('0x13')](_0x11d1('0x1d'),JSON[_0x11d1('0x10')](_0x5e467f));_0x3328ae['terminate']();}}function _0x516dbf(){logger[_0x11d1('0x7')](_0x11d1('0x1e'));_0x154423({'transcript':_0x3d13c0,'confidence':_0x537dbe,'status':_0x4e745f,'status_message':_0xf37cc7});}function _0x283ecc(_0x220b0d){logger[_0x11d1('0x13')](_0x11d1('0x1f'));if(!_[_0x11d1('0x20')](_0x220b0d)){logger['error'](_[_0x11d1('0x21')](_0x220b0d)?JSON[_0x11d1('0x10')](_0x220b0d):_0x220b0d);}}_0x3328ae['on'](_0x11d1('0x22'),_0x357b4c);_0x3328ae['on'](_0x11d1('0x23'),_0x5e677c);_0x3328ae['on'](_0x11d1('0x24'),_0x516dbf);_0x3328ae['on'](_0x11d1('0x13'),_0x283ecc);});}; \ No newline at end of file +var _0x7d97=['moment','crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','hex','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash'];(function(_0x4ec6df,_0x555853){var _0x4f4dfc=function(_0x5d14ce){while(--_0x5d14ce){_0x4ec6df['push'](_0x4ec6df['shift']());}};_0x4f4dfc(++_0x555853);}(_0x7d97,0x110));var _0x77d9=function(_0x1f9bec,_0x29b02f){_0x1f9bec=_0x1f9bec-0x0;var _0x923069=_0x7d97[_0x1f9bec];return _0x923069;};'use strict';var BPromise=require('bluebird');var _=require(_0x77d9('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x77d9('0x1'));var crypto=require(_0x77d9('0x2'));var logger=require('../../../../../../config/logger')(_0x77d9('0x3'));module[_0x77d9('0x4')]=function(_0x1e8656,_0xea77c7,_0xcf3d1e,_0x4036fc){return new BPromise(function(_0x36159b,_0x123666){logger[_0x77d9('0x5')](_0x77d9('0x6'),_0x4036fc||_0x77d9('0x7'));var _0xbb2a51=new WebSocket(_0x4036fc||_0x77d9('0x7'),{'perMessageDeflate':![]});var _0x55533d='';var _0xc0f2b='0';var _0x2951aa='1';var _0x7a3df7='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x25a7f5(_0x45f30a){var _0x2986fd=crypto['createHash'](_0x77d9('0x8'));_0x2986fd[_0x77d9('0x9')](_0x45f30a);return _0x2986fd['digest'](_0x77d9('0xa'));}function _0x362c91(){try{logger[_0x77d9('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x1da154=moment()['unix']();var _0x3e2616=_0x25a7f5(_0x1da154+_0xea77c7+_0xcf3d1e);_0xbb2a51[_0x77d9('0xb')](JSON[_0x77d9('0xc')]({'appID':_0xea77c7,'timestamp':_0x1da154,'appKey':_0x3e2616}));var _0x19d9a3=fs[_0x77d9('0xd')](_0x1e8656);_0x19d9a3['on'](_0x77d9('0xe'),function(_0x1a8bac){_0xbb2a51[_0x77d9('0xb')](_0x1a8bac);});_0x19d9a3['on'](_0x77d9('0xf'),function(){_0xbb2a51[_0x77d9('0xb')]('EOS');});}catch(_0xd98d14){logger[_0x77d9('0x10')](_0x77d9('0x11'),JSON[_0x77d9('0xc')](_0xd98d14));_0xbb2a51[_0x77d9('0x12')]();}}function _0x418815(_0x495103){try{if(_0x495103){var _0x585e82=JSON[_0x77d9('0x13')](_0x495103);switch(_0x585e82[_0x77d9('0x14')]){case 0x0:if(_0x585e82['result']){if(_0x585e82[_0x77d9('0x15')][_0x77d9('0x16')]){logger['info'](_0x77d9('0x17'),JSON[_0x77d9('0xc')](_0x585e82[_0x77d9('0x15')][_0x77d9('0x18')]));_0x55533d=_0x585e82[_0x77d9('0x15')][_0x77d9('0x18')][0x0][_0x77d9('0x19')];_0xc0f2b=_0x585e82['result']['hypotheses'][0x0]['likelihood'];_0x2951aa='0';_0x7a3df7=_0x77d9('0x1a');_0xbb2a51[_0x77d9('0x12')]();}}break;case 0x1:logger[_0x77d9('0x5')](_0x77d9('0x1b'));_0x2951aa='1';_0x7a3df7=_0x77d9('0x1b');break;case 0x2:logger[_0x77d9('0x5')](_0x77d9('0x1c'));_0x2951aa='2';_0x7a3df7=_0x77d9('0x1c');break;case 0x9:logger[_0x77d9('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2951aa='9';_0x7a3df7=_0x77d9('0x1d');break;case 0xa:logger[_0x77d9('0x5')](_0x77d9('0x1e'));_0x2951aa='10';_0x7a3df7=_0x77d9('0x1e');break;case 0xb:logger['info'](_0x77d9('0x1f'));_0x2951aa='11';_0x7a3df7=_0x77d9('0x1f');}}}catch(_0x4a9eaa){logger[_0x77d9('0x10')](_0x77d9('0x20'),JSON[_0x77d9('0xc')](_0x4a9eaa));_0xbb2a51[_0x77d9('0x12')]();}}function _0x4c47e8(){logger['info'](_0x77d9('0x21'));_0x36159b({'transcript':_0x55533d,'confidence':_0xc0f2b,'status':_0x2951aa,'status_message':_0x7a3df7});}function _0x15795e(_0xfb7c9d){logger['error'](_0x77d9('0x22'));if(!_[_0x77d9('0x23')](_0xfb7c9d)){logger[_0x77d9('0x10')](_[_0x77d9('0x24')](_0xfb7c9d)?JSON[_0x77d9('0xc')](_0xfb7c9d):_0xfb7c9d);}}_0xbb2a51['on'](_0x77d9('0x25'),_0x362c91);_0xbb2a51['on'](_0x77d9('0x26'),_0x418815);_0xbb2a51['on']('close',_0x4c47e8);_0xbb2a51['on'](_0x77d9('0x10'),_0x15795e);});}; \ 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 c7d7fd6..10cb4be 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 _0x7699=['./asr'];(function(_0x22b588,_0x262a48){var _0x20a551=function(_0x36ca56){while(--_0x36ca56){_0x22b588['push'](_0x22b588['shift']());}};_0x20a551(++_0x262a48);}(_0x7699,0x16a));var _0x9769=function(_0x1c0a25,_0x227201){_0x1c0a25=_0x1c0a25-0x0;var _0x4ddd7e=_0x7699[_0x1c0a25];return _0x4ddd7e;};var asr=require(_0x9769('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var asr=require('./asr');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 f246241..b286cb5 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x373dbb,_0x17bbae){var _0x353d96=function(_0x2fe404){while(--_0x2fe404){_0x373dbb['push'](_0x373dbb['shift']());}};_0x353d96(++_0x17bbae);}(_0x34e8,0x12c));var _0x834e=function(_0x4b2f8d,_0x44259d){_0x4b2f8d=_0x4b2f8d-0x0;var _0x2360a0=_0x34e8[_0x4b2f8d];return _0x2360a0;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x1c6089,_0x3816e2){var _0x4d97c1=function(_0x3e631b){while(--_0x3e631b){_0x1c6089['push'](_0x1c6089['shift']());}};_0x4d97c1(++_0x3816e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 472b988..d3ae5d9 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 _0x9649=['Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','dnid','file','createSquareMessage','createCmContact','isNil','random','isEmpty','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','callback_priority','getPause','getPauseById','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','agentLogin','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','parse','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','Amy','aws_text_type','awsLex','aws_access_key_id','googleASR','tildeASR','appsecret','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','format','%s.%s','setVariable','length','split','replaceAll','extra','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','MRCPSynth','result','noop','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','hiddendigitsnum','generate','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','bcc','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','sms_text','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','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','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','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','moment','mustache','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','getVariable','getVariableById','catch','getVoiceQueue','getVoiceQueueById','then','name','prototype','getSquareProjectById','getSquareOdbcById','dsn','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','mailRpc','getIntervals','interval','map','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x9649,0x19f));var _0x9964=function(_0x3d12df,_0x79d68f){_0x3d12df=_0x3d12df-0x0;var _0x597da5=_0x9649[_0x3d12df];return _0x597da5;};'use strict';var fs=require('fs');var util=require(_0x9964('0x0'));var _=require(_0x9964('0x1'));var sh=require(_0x9964('0x2'));var odbc=require(_0x9964('0x3'))();var rs=require('randomstring');var moment=require(_0x9964('0x4'));var Mustache=require(_0x9964('0x5'));var rp=require('request-promise');var logger=require(_0x9964('0x6'))('agi');var config=require(_0x9964('0x7'));var scripts=require(_0x9964('0x8'));var FILES_PATH=_0x9964('0x9');var recursiveMapAttributes=[_0x9964('0xa'),_0x9964('0xb')];var verticesWithRetry=[_0x9964('0xc'),_0x9964('0xd'),'getsecretdigits'];var AGIVertices=function(_0x45dda7,_0x67291b,_0x5071f7){this[_0x9964('0xe')]=_0x45dda7;this[_0x9964('0xf')]=_0x67291b;this['mailRpc']=_0x5071f7;};AGIVertices['prototype'][_0x9964('0x10')]=function(_0x4c4a3d,_0xe205db){this[_0x9964('0xf')][_0x9964('0x11')](_0x4c4a3d)['then'](function(_0x2be3fc){_0xe205db(null,_0x2be3fc?_0x2be3fc['name']:![]);})[_0x9964('0x12')](function(_0x39c624){_0xe205db(_0x39c624);});};AGIVertices['prototype'][_0x9964('0x13')]=function(_0x39ef74,_0x5aa1a8){this[_0x9964('0xf')][_0x9964('0x14')](_0x39ef74)[_0x9964('0x15')](function(_0x46688a){_0x5aa1a8(null,_0x46688a?_0x46688a[_0x9964('0x16')]:![]);})['catch'](function(_0x411544){_0x5aa1a8(_0x411544);});};AGIVertices[_0x9964('0x17')]['getSquareProject']=function(_0x2fd50d,_0x3fe796){this['rpc'][_0x9964('0x18')](_0x2fd50d)[_0x9964('0x15')](function(_0x69994d){_0x3fe796(null,_0x69994d?_0x69994d[_0x9964('0x16')]:![]);})['catch'](function(_0x40b3dd){_0x3fe796(_0x40b3dd);});};AGIVertices[_0x9964('0x17')]['getSquareOdbc']=function(_0x2eb3a8,_0x3f6472){this[_0x9964('0xf')][_0x9964('0x19')](_0x2eb3a8)[_0x9964('0x15')](function(_0x1bf791){_0x3f6472(null,_0x1bf791?_0x1bf791[_0x9964('0x1a')]:![]);})[_0x9964('0x12')](function(_0x1072b5){_0x3f6472(_0x1072b5);});};AGIVertices[_0x9964('0x17')]['getUser']=function(_0x455b62,_0x447026){this['rpc'][_0x9964('0x1b')](_0x455b62)['then'](function(_0x242e0a){_0x447026(null,_0x242e0a?_0x242e0a[_0x9964('0x16')]:![]);})[_0x9964('0x12')](function(_0x167525){_0x447026(_0x167525);});};AGIVertices[_0x9964('0x17')][_0x9964('0x1c')]=function(_0x5f30e8,_0x452c96){this[_0x9964('0xf')]['getTrunkById'](_0x5f30e8)[_0x9964('0x15')](function(_0x15a14c){_0x452c96(null,_0x15a14c?_0x15a14c[_0x9964('0x16')]:![]);})[_0x9964('0x12')](function(_0x26cd95){_0x452c96(_0x26cd95);});};AGIVertices['prototype'][_0x9964('0x1d')]=function(_0x4c2b44,_0x44cb60){var _0x512f6b=this;this[_0x9964('0xf')]['getSoundById'](_0x4c2b44)[_0x9964('0x15')](function(_0x162b83){_0x44cb60(null,_0x162b83?_0x512f6b[_0x9964('0x1e')](_0x162b83[_0x9964('0x1f')]):![]);})[_0x9964('0x12')](function(_0x23df5e){_0x44cb60(_0x23df5e);});};AGIVertices[_0x9964('0x17')][_0x9964('0x20')]=function(_0x46c57d,_0x58ce2c){this['rpc']['getMailAccountById'](_0x46c57d)['then'](function(_0x36220b){_0x58ce2c(null,_0x36220b?_0x36220b:![]);})[_0x9964('0x12')](function(_0x4efb43){_0x58ce2c(_0x4efb43);});};AGIVertices[_0x9964('0x17')][_0x9964('0x21')]=function(_0x3092b2,_0x17a244,_0x9d4eaf){this[_0x9964('0x22')]['sendMailMessage'](_0x3092b2,_0x17a244)[_0x9964('0x15')](function(){_0x9d4eaf(null);})[_0x9964('0x12')](function(_0x59ab78){_0x9d4eaf(_0x59ab78);});};AGIVertices[_0x9964('0x17')][_0x9964('0x23')]=function(_0x3e5154,_0x257430){this['rpc']['getIntervalById'](_0x3e5154)[_0x9964('0x15')](function(_0x4e517c){if(_0x4e517c){if(_0x4e517c['IntervalId']){_0x257430(null,[_0x4e517c[_0x9964('0x24')]]);}else{_0x257430(null,_[_0x9964('0x25')](_0x4e517c['Intervals'],'interval'));}}else{_0x257430(null,![]);}})[_0x9964('0x12')](function(_0x71d436){_0x257430(_0x71d436);});};AGIVertices['prototype'][_0x9964('0x1e')]=function(_0x4fca90){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x4fca90);};AGIVertices[_0x9964('0x17')][_0x9964('0x26')]=function(_0x168f41,_0x1df24e,_0x2cdbbc){odbc[_0x9964('0x27')](_0x168f41,function(_0x31b296){if(_0x31b296){logger[_0x9964('0x28')](_0x9964('0x29'),_0x31b296);_0x2cdbbc(_0x31b296);}else{logger['info'](_0x9964('0x2a'));odbc[_0x9964('0x2b')](_0x1df24e,function(_0x39cd4a,_0x132c7c){if(_0x39cd4a){logger['info']('Error\x20executing\x20query\x20%s',_0x1df24e);_0x2cdbbc(_0x39cd4a);}else{logger[_0x9964('0x2c')](_0x9964('0x2d'),_0x1df24e);odbc[_0x9964('0x2e')](function(_0x1bad9d){if(_0x1bad9d){logger[_0x9964('0x28')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1bad9d);}_0x2cdbbc(null,_0x132c7c);});}});}});};AGIVertices[_0x9964('0x17')][_0x9964('0x2f')]=function(_0x2b9684,_0x3bde2b){this[_0x9964('0xf')][_0x9964('0x30')](_0x2b9684)[_0x9964('0x15')](function(_0x178f52){_0x3bde2b(null,_0x178f52?_0x178f52:![]);})[_0x9964('0x12')](function(_0x29efe7){_0x3bde2b(_0x29efe7);});};AGIVertices[_0x9964('0x17')][_0x9964('0x31')]=function(_0x3539bf,_0xdc12f7){this[_0x9964('0xf')][_0x9964('0x31')](_0x3539bf)['then'](function(_0x344c6c){_0xdc12f7(null,_0x344c6c);})['catch'](function(_0x366b93){_0xdc12f7(_0x366b93);});};AGIVertices[_0x9964('0x17')][_0x9964('0x32')]=function(_0x4c3d38,_0xf4a80e,_0x5f5312){this[_0x9964('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0x9964('0xe')][_0x9964('0x33')],'node':_0x4c3d38[_0x9964('0x34')],'application':_0x4c3d38[_0x9964('0x35')],'data':_0xf4a80e||null,'project_name':this[_0x9964('0xe')][_0x9964('0x36')],'callerid':this[_0x9964('0xe')][_0x9964('0x37')]})['then'](function(_0x2d83ea){if(_0x5f5312){_0x5f5312(null,_0x2d83ea);}})[_0x9964('0x12')](function(_0x2948f2){if(_0x5f5312){_0x5f5312(_0x2948f2);}});};AGIVertices[_0x9964('0x17')][_0x9964('0x38')]=function(_0x307787,_0xc717aa,_0x28ac20,_0x9841f8){this[_0x9964('0xf')]['createSquareRecording']({'uniqueid':this['channel'][_0x9964('0x33')],'callerid':this['channel'][_0x9964('0x37')],'calleridname':this['channel']['calleridname'],'context':this['channel'][_0x9964('0x39')],'extension':this[_0x9964('0xe')][_0x9964('0x3a')],'priority':this['channel']['priority'],'accountcode':this[_0x9964('0xe')]['accountcode'],'dnid':this[_0x9964('0xe')][_0x9964('0x3b')],'projectName':this[_0x9964('0xe')][_0x9964('0x36')],'saveName':_0xc717aa,'filename':_0x307787[_0x9964('0x3c')]||_0xc717aa,'savePath':_0x28ac20})[_0x9964('0x15')](function(_0x521d03){_0x9841f8(null,_0x521d03);})[_0x9964('0x12')](function(_0x323995){_0x9841f8(_0x323995);});};AGIVertices[_0x9964('0x17')][_0x9964('0x3d')]=function(_0x1c575b,_0x506c24,_0x1e7c32,_0x3873f5,_0x2847e8){this['rpc'][_0x9964('0x3d')]({'uniqueid':this[_0x9964('0xe')][_0x9964('0x33')],'body':_0x1c575b,'direction':_0x506c24,'providerName':_0x1e7c32,'providerResponse':_0x3873f5})[_0x9964('0x15')](function(_0x338140){if(_0x2847e8){_0x2847e8(null,_0x338140);}})[_0x9964('0x12')](function(_0x1a5344){if(_0x2847e8){_0x2847e8(_0x1a5344);}});};AGIVertices[_0x9964('0x17')]['createCmContact']=function(_0x67f068,_0x52566e){this['rpc'][_0x9964('0x3e')]({'firstName':_['isEmpty'](_0x67f068[_0x9964('0x16')])||_[_0x9964('0x3f')](_0x67f068[_0x9964('0x16')])?'callback_'+Math[_0x9964('0x40')]():_0x67f068[_0x9964('0x16')],'lastName':_[_0x9964('0x41')](_0x67f068[_0x9964('0x42')])||_[_0x9964('0x3f')](_0x67f068[_0x9964('0x42')])?null:_0x67f068[_0x9964('0x42')],'phone':_0x67f068[_0x9964('0x43')],'ListId':_0x67f068[_0x9964('0x44')],'scheduledat':_0x67f068['scheduledAt'],'callbackUniqueid':this[_0x9964('0xe')]['uniqueid'],'tags':_0x9964('0x45'),'description':_0x9964('0x46')+_0x67f068[_0x9964('0x47')]['toString'](),'priority':_0x67f068[_0x9964('0x48')]})[_0x9964('0x15')](function(_0x238867){_0x52566e(null,_0x238867);})[_0x9964('0x12')](function(_0xaf7e23){_0x52566e(_0xaf7e23);});};AGIVertices['prototype'][_0x9964('0x49')]=function(_0x205f12,_0x29c074){this[_0x9964('0xf')][_0x9964('0x4a')](_0x205f12)['then'](function(_0x5a0ece){_0x29c074(null,_0x5a0ece?_0x5a0ece['name']:![]);})['catch'](function(_0x368c1a){_0x29c074(_0x368c1a);});};AGIVertices['prototype']['agentPause']=function(_0x5b8892,_0x275535,_0x498c8f){var _0x28201d={'role':_0x9964('0x4b')};_0x28201d[_0x5b8892]=this[_0x9964('0xe')]['callerid'];this[_0x9964('0xf')]['agentPause'](_0x28201d,_0x275535,this['channel'][_0x9964('0x33')])[_0x9964('0x15')](function(_0x2ffa8e){_0x498c8f(null,_['isNil'](_0x2ffa8e)?![]:!![]);})[_0x9964('0x12')](function(_0x1b0752){logger[_0x9964('0x28')](_0x1b0752);_0x498c8f(null,![]);});};AGIVertices['prototype'][_0x9964('0x4c')]=function(_0x2f97c5,_0x3c846d){var _0x4e0e7c={'role':'agent'};_0x4e0e7c[_0x2f97c5]=this[_0x9964('0xe')][_0x9964('0x37')];this[_0x9964('0xf')][_0x9964('0x4c')](_0x4e0e7c)[_0x9964('0x15')](function(_0x222fd1){_0x3c846d(null,_[_0x9964('0x3f')](_0x222fd1)?![]:!![]);})[_0x9964('0x12')](function(_0x21a16f){logger[_0x9964('0x28')](_0x21a16f);_0x3c846d(null,![]);});};AGIVertices[_0x9964('0x17')][_0x9964('0x4d')]=function(_0x36d0c1,_0xc4ba66){var _0x3c706e={'role':'agent'};_0x3c706e[_0x36d0c1]=this[_0x9964('0xe')][_0x9964('0x37')];this[_0x9964('0xf')][_0x9964('0x4d')](_0x3c706e)['then'](function(_0x56bf70){_0xc4ba66(null,_['isNil'](_0x56bf70)?![]:!![]);})['catch'](function(_0x4e374e){logger[_0x9964('0x28')](_0x4e374e);_0xc4ba66(null,![]);});};AGIVertices[_0x9964('0x17')]['agentLogin']=function(_0x249fa7,_0x4434ac){var _0x61b486={'role':_0x9964('0x4b')};_0x61b486[_0x249fa7]=this[_0x9964('0xe')]['callerid'];var _0x3446c8=_0x249fa7!=_0x9964('0x4e')?util['format'](_0x9964('0x4f'),'LOCAL',this[_0x9964('0xe')]['callerid']):undefined;this[_0x9964('0xf')][_0x9964('0x50')](_0x61b486,_0x3446c8)['then'](function(_0x476dba){_0x4434ac(null,_['isNil'](_0x476dba)?![]:!![]);})['catch'](function(_0x1614ad){logger['error'](_0x1614ad);_0x4434ac(null,![]);});};AGIVertices[_0x9964('0x17')]['shellCommand']=function(_0x39acbe,_0x5666c0){sh[_0x9964('0x51')](_[_0x9964('0x52')](_0x39acbe),function(_0x336f52,_0x41144f){var _0x2d0b16=_0x41144f[_0x9964('0x53')](/(\r\n|\n|\r)/gm,'');_0x5666c0(null,_0x2d0b16);});};AGIVertices['prototype'][_0x9964('0x54')]=function(_0x2d90c9,_0xa59931){scripts['googleCloudTTS'](_0x2d90c9[_0x9964('0x55')],_0x2d90c9[_0x9964('0x56')]||_0x9964('0x57'),_0x2d90c9[_0x9964('0x57')],_0x2d90c9[_0x9964('0x58')]||_0x9964('0x59'),_0x2d90c9[_0x9964('0x5a')]||_0x9964('0x5b'),_0x2d90c9[_0x9964('0x5c')]||_0x9964('0x5d'))[_0x9964('0x15')](function(_0x5c6920){_0xa59931(null,_0x5c6920);})[_0x9964('0x12')](function(_0x587874){_0xa59931(_0x587874);});};AGIVertices[_0x9964('0x17')][_0x9964('0x5e')]=function(_0x19fbef,_0xcb9b08){scripts['googleTTS'](_0x19fbef[_0x9964('0x57')],_0x19fbef[_0x9964('0x5f')]||'en',0x1)[_0x9964('0x15')](function(_0x4727aa){_0xcb9b08(null,_0x4727aa);})[_0x9964('0x12')](function(_0x39d044){_0xcb9b08(_0x39d044);});};AGIVertices[_0x9964('0x17')][_0x9964('0x60')]=function(_0x24b96d,_0x16ba3a){var _0x4e3b67={'uri':_0x24b96d[_0x9964('0x61')],'method':_0x24b96d[_0x9964('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x24b96d[_0x9964('0x63')])===_0x9964('0x64')&&parseInt(_0x24b96d[_0x9964('0x63')])>=0x1?parseInt(_0x24b96d[_0x9964('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x9964('0x65'),_0x9964('0x66')],_0x4e3b67[_0x9964('0x62')][_0x9964('0x67')]())){try{_0x4e3b67['body']=_0x24b96d['rawBody']?JSON['parse'](_0x24b96d[_0x9964('0xb')]):{};}catch(_0x373c88){logger['error'](_0x9964('0x68'),_0x373c88);}}try{_0x4e3b67[_0x9964('0x69')]=_0x24b96d[_0x9964('0xa')]?JSON['parse'](_0x24b96d[_0x9964('0xa')]):{};}catch(_0x43964c){logger['error'](_0x9964('0x6a'),_0x43964c);}if(_0x24b96d[_0x9964('0x6b')]){try{var _0x4a9a78=require(_0x24b96d[_0x9964('0x6b')])[_0x9964('0x6c')](this,_0x4e3b67);_0x4e3b67[_0x9964('0x6d')]=Mustache[_0x9964('0x6e')](_0x24b96d[_0x9964('0x61')],_0x4a9a78,{},['$$','$$']);if(_0x4e3b67['headers']){_0x4e3b67[_0x9964('0x69')]=JSON['parse'](Mustache[_0x9964('0x6e')](JSON[_0x9964('0x6f')](_0x4e3b67['headers']),_0x4a9a78,{},['$$','$$']));}if(_0x4e3b67[_0x9964('0x70')]){_0x4e3b67[_0x9964('0x70')]=JSON[_0x9964('0x71')](Mustache[_0x9964('0x6e')](JSON['stringify'](_0x4e3b67[_0x9964('0x70')]),_0x4a9a78,{},['$$','$$']));}}catch(_0x1abca3){logger[_0x9964('0x28')](_0x9964('0x72'),_0x1abca3);}}rp(_0x4e3b67)[_0x9964('0x15')](function(_0x265d7e){var _0x128882={'statusCode':_0x265d7e[_0x9964('0x73')]||0xc8,'statusMessage':_0x265d7e[_0x9964('0x74')]||'OK','headers':_0x265d7e[_0x9964('0x69')]||{},'body':_0x265d7e[_0x9964('0x70')]||{}};_0x16ba3a(null,_0x128882);})[_0x9964('0x12')](function(_0x4d6ac6){var _0x424e6e={'statusCode':_0x4d6ac6['statusCode']||0x1f4,'statusMessage':_0x4d6ac6[_0x9964('0x75')]||_0x9964('0x76'),'headers':_0x4d6ac6['options'][_0x9964('0x69')]||{},'body':_0x4d6ac6[_0x9964('0x77')][_0x9964('0x70')]||{}};_0x16ba3a(null,_0x424e6e);});};AGIVertices[_0x9964('0x17')][_0x9964('0x78')]=function(_0x2fefdc,_0x411413){scripts[_0x9964('0x78')](this['channel'][_0x9964('0x33')],_0x2fefdc[_0x9964('0x79')],_0x2fefdc[_0x9964('0x57')],_0x2fefdc['dialogflow_language']||'en')[_0x9964('0x15')](function(_0x3a2be8){_0x411413(null,_0x3a2be8);})[_0x9964('0x12')](function(_0x4d9cd3){_0x411413(_0x4d9cd3);});};AGIVertices[_0x9964('0x17')][_0x9964('0x7a')]=function(_0x3072e8,_0xc99eac){scripts[_0x9964('0x7a')](this[_0x9964('0xe')][_0x9964('0x33')],_0x3072e8[_0x9964('0x7b')],_0x3072e8[_0x9964('0x7c')],_0x3072e8['private_key'],_0x3072e8[_0x9964('0x57')],_0x3072e8[_0x9964('0x7d')]||'en')[_0x9964('0x15')](function(_0x582b39){_0xc99eac(null,_0x582b39);})[_0x9964('0x12')](function(_0x5bb243){_0xc99eac(_0x5bb243);});};AGIVertices[_0x9964('0x17')][_0x9964('0x7e')]=function(_0x463365,_0x540bac){scripts[_0x9964('0x7e')](this[_0x9964('0xe')],_0x463365)[_0x9964('0x15')](function(_0x5ae9ee){_0x540bac(null,_0x5ae9ee);})[_0x9964('0x12')](function(_0x292836){_0x540bac(_0x292836);});};AGIVertices[_0x9964('0x17')]['ispeechTTS']=function(_0x14db69,_0x22e298){scripts[_0x9964('0x7f')](_0x14db69['key'],_0x14db69[_0x9964('0x57')],_0x14db69[_0x9964('0x80')]||_0x9964('0x59'),_0x14db69['speed'])[_0x9964('0x15')](function(_0x2f8d1d){_0x22e298(null,_0x2f8d1d);})[_0x9964('0x12')](function(_0x31b5ab){_0x22e298(_0x31b5ab);});};AGIVertices[_0x9964('0x17')][_0x9964('0x81')]=function(_0x5bdd6d,_0x107967,_0x13caf7){scripts[_0x9964('0x81')](_0x107967,_0x5bdd6d[_0x9964('0x79')],_0x5bdd6d[_0x9964('0x82')]||_0x9964('0x59'),this[_0x9964('0x83')](_0x5bdd6d['model'])?_0x5bdd6d[_0x9964('0x84')]:undefined)[_0x9964('0x15')](function(_0x1570fc){_0x13caf7(null,_0x1570fc);})[_0x9964('0x12')](function(_0x1d1822){_0x13caf7(_0x1d1822);});};AGIVertices[_0x9964('0x17')][_0x9964('0x85')]=function(_0x3b03af,_0x2a9a53){scripts[_0x9964('0x85')](_0x3b03af['aws_access_key_id'],_0x3b03af['aws_secret_access_key'],_0x3b03af['aws_polly_region'],_0x3b03af['aws_polly_voice']||_0x9964('0x86'),_0x3b03af[_0x9964('0x57')],_0x3b03af[_0x9964('0x87')]||_0x9964('0x57'))[_0x9964('0x15')](function(_0xf61611){_0x2a9a53(null,_0xf61611);})[_0x9964('0x12')](function(_0x5b5ece){_0x2a9a53(_0x5b5ece);});};AGIVertices['prototype'][_0x9964('0x88')]=function(_0x53d1e0,_0x30f32){scripts[_0x9964('0x88')](this[_0x9964('0xe')][_0x9964('0x33')],_0x53d1e0[_0x9964('0x89')],_0x53d1e0['aws_secret_access_key'],_0x53d1e0['aws_lex_region'],_0x53d1e0['text'],_0x53d1e0['aws_bot_name'])['then'](function(_0x4783a5){_0x30f32(null,_0x4783a5);})[_0x9964('0x12')](function(_0x88cb7b){_0x30f32(_0x88cb7b);});};AGIVertices[_0x9964('0x17')][_0x9964('0x8a')]=function(_0x43959b,_0x3b61fe,_0x353abf){scripts['googleASR'](_0x3b61fe,_0x43959b[_0x9964('0x79')],_0x43959b['google_asr_language']||_0x9964('0x59'))[_0x9964('0x15')](function(_0x2c9461){_0x353abf(null,_0x2c9461);})['catch'](function(_0x9ad7a8){_0x353abf(_0x9ad7a8);});};AGIVertices['prototype'][_0x9964('0x8b')]=function(_0x2c2d39,_0x2b8be7,_0xd7906f){scripts[_0x9964('0x8b')](_0x2b8be7,_0x2c2d39['appid'],_0x2c2d39[_0x9964('0x8c')],_0x2c2d39[_0x9964('0x6d')])[_0x9964('0x15')](function(_0x457d52){_0xd7906f(null,_0x457d52);})[_0x9964('0x12')](function(_0x3a9149){_0xd7906f(_0x3a9149);});};AGIVertices['prototype'][_0x9964('0x8d')]=function(_0x110c3a){var _0x5d691b=_[_0x9964('0x8e')](verticesWithRetry,_0x110c3a[_0x9964('0x35')])?_0x110c3a:_[_0x9964('0x8f')](_0x110c3a);for(var _0x527c0d in _0x5d691b){if(_0x5d691b[_0x9964('0x90')](_0x527c0d)){if(_0x5d691b[_0x527c0d]&&_[_0x9964('0x91')](_0x5d691b[_0x527c0d])){if(_[_0x9964('0x8e')](recursiveMapAttributes,_0x527c0d)){_0x5d691b[_0x527c0d]=this[_0x9964('0x92')](_0x5d691b[_0x527c0d]);}else{_0x5d691b[_0x527c0d]=this[_0x9964('0x93')](_0x5d691b[_0x527c0d]);}}}}return _0x5d691b;};AGIVertices['prototype'][_0x9964('0x94')]=function(_0x12d128){for(var _0xe15ec5 in _0x12d128){if(_0x12d128['hasOwnProperty'](_0xe15ec5)){if(_[_0x9964('0x95')](_0x12d128[_0xe15ec5])){this[_0x9964('0x94')](_0x12d128[_0xe15ec5]);}else if(_[_0x9964('0x96')](_0x12d128[_0xe15ec5])){for(var _0x30743e=0x0;_0x30743e<_0x12d128[_0xe15ec5]['length'];_0x30743e++){this[_0x9964('0x94')](_0x12d128[_0xe15ec5][_0x30743e]);}}else if(_[_0x9964('0x91')](_0x12d128[_0xe15ec5])){_0x12d128[_0xe15ec5]=this[_0x9964('0x93')](_0x12d128[_0xe15ec5]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x4ca948,_0x280577){for(var _0x1d0890 in _0x4ca948){if(_0x4ca948[_0x9964('0x90')](_0x1d0890)){if(_[_0x9964('0x95')](_0x4ca948[_0x1d0890])){if(!_[_0x9964('0x41')](_0x4ca948[_0x1d0890])){this[_0x9964('0x97')](_0x4ca948[_0x1d0890],util[_0x9964('0x98')](_0x9964('0x99'),_0x280577,_0x1d0890));}}else if(_[_0x9964('0x96')](_0x4ca948[_0x1d0890])){for(var _0x4b8bbb=0x0;_0x4b8bbb<_0x4ca948[_0x1d0890]['length'];_0x4b8bbb++){this[_0x9964('0x97')](_0x4ca948[_0x1d0890][_0x4b8bbb],util[_0x9964('0x98')](_0x9964('0x99'),_0x280577,_0x1d0890+'['+_0x4b8bbb+']'));}}else{if(!_['isNil'](_0x4ca948[_0x1d0890])){this[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0x99'),_0x280577,_0x1d0890),_0x4ca948[_0x1d0890]);}}}}};AGIVertices['prototype'][_0x9964('0x92')]=function(_0x120714){try{var _0x2ddaf6=JSON[_0x9964('0x71')](_0x120714);this['recursiveNodeIndex'](_0x2ddaf6);return JSON[_0x9964('0x6f')](_0x2ddaf6);}catch(_0x3754fa){return this[_0x9964('0x93')](_0x120714);}};AGIVertices[_0x9964('0x17')][_0x9964('0x93')]=function(_0x29ba52){var _0x36c913=_0x29ba52['split']('{');for(var _0x46f14b=0x1;_0x46f14b<_0x36c913[_0x9964('0x9b')];_0x46f14b+=0x1){var _0x5748d1=_0x36c913[_0x46f14b][_0x9964('0x9c')]('}');if(_0x5748d1[_0x9964('0x9b')]>0x1){_0x29ba52=_0x29ba52[_0x9964('0x9d')]('{'+_0x5748d1[0x0]+'}',this[_0x9964('0xe')][_0x9964('0x10')](_0x5748d1[0x0])[_0x9964('0x9e')]||_0x5748d1[0x0]);}}if(_0x36c913['length']===0x1){return _0x29ba52[_0x9964('0x9f')]();}return this[_0x9964('0x93')](_0x29ba52);};AGIVertices[_0x9964('0x17')][_0x9964('0xa0')]=function(_0x4a42ab,_0x3d40fd){var _0x383702=this[_0x9964('0xe')]['getVariable'](_0x4a42ab);if(_0x383702['result']===-0x1){return _0x383702;}logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xa1'),_0x3d40fd,_0x383702['extra']));return this[_0x9964('0xe')][_0x9964('0x9a')](_0x3d40fd,_0x383702[_0x9964('0x9e')]);};AGIVertices[_0x9964('0x17')][_0x9964('0x83')]=function(_0x39c568){return _0x39c568&&_0x39c568!=='0'&&_0x39c568!=='-1'&&_0x39c568!=='';};AGIVertices[_0x9964('0x17')][_0x9964('0xa2')]=function(_0x434b3f){this[_0x9964('0x32')]['sync'](this,_0x434b3f,'-');_0x434b3f[_0x9964('0xa3')]=_0x434b3f[_0x9964('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x9964('0xa4')]=function(_0x15a129){logger['info'](util[_0x9964('0x98')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x15a129['label']));if(!this['isConfigured'](_0x15a129['text'])){return this[_0x9964('0xe')]['noop']('no\x20text\x20configured');}var _0x467218='\x22'+_0x15a129[_0x9964('0x57')]+'\x22';if(this[_0x9964('0x83')](_0x15a129['options'])){_0x467218+=','+_0x15a129[_0x9964('0x77')];}var _0x38c329=this[_0x9964('0xe')]['exec'](_0x9964('0xa5'),_0x467218);if(_0x38c329[_0x9964('0xa6')]===-0x1){return _0x38c329;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('Executed\x20command\x20MRCPSynth\x20%s',_0x467218));};AGIVertices[_0x9964('0x17')]['mrcprecog']=function(_0x88702d){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xa8'),_0x88702d[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x88702d[_0x9964('0xa9')])){return this['channel']['noop'](_0x9964('0xaa'));}var _0x501be0=_0x88702d[_0x9964('0xa9')];if(this[_0x9964('0x83')](_0x88702d['options'])){_0x501be0+=','+_0x88702d[_0x9964('0x77')];}var _0x403040=this[_0x9964('0xe')][_0x9964('0x51')](_0x9964('0xab'),_0x501be0);if(_0x403040[_0x9964('0xa6')]===-0x1){return _0x403040;}var _0x1bd26d=this[_0x9964('0xa0')](_0x9964('0xac'),'MRCP_RECOG_CONFIDENCE');if(_0x1bd26d['result']===-0x1){return _0x1bd26d;}var _0x5107fd=this['getAndSetVariable']('RECOG_INPUT()',_0x9964('0xad'));if(_0x5107fd[_0x9964('0xa6')]===-0x1){return _0x5107fd;}var _0x132c1b=this[_0x9964('0xa0')](_0x9964('0xae'),_0x9964('0xaf'));if(_0x132c1b[_0x9964('0xa6')]===-0x1){return _0x132c1b;}return this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0xb0'),_0x501be0));};AGIVertices[_0x9964('0x17')][_0x9964('0xb1')]=function(_0x2eba6a){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x2eba6a['label']));return this[_0x9964('0xe')][_0x9964('0xb1')]([_0x2eba6a[_0x9964('0xb2')],_0x2eba6a[_0x9964('0xb3')]]);};AGIVertices[_0x9964('0x17')][_0x9964('0xb4')]=function(_0x1f961e){logger['info'](util['format'](_0x9964('0xb5'),_0x1f961e[_0x9964('0x34')]));if(this[_0x9964('0x83')](_0x1f961e['timeout'])){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xb6'),_0x1f961e[_0x9964('0x63')]));var _0x5961e9=this[_0x9964('0xe')]['wait'](_0x1f961e[_0x9964('0x63')]);if(_0x5961e9['result']===-0x1){return _0x5961e9;}}return this[_0x9964('0xe')][_0x9964('0xb4')]();};AGIVertices[_0x9964('0x17')][_0x9964('0x45')]=function(_0x19c945){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xb7'),_0x19c945['label']));if(!this[_0x9964('0x83')](_0x19c945[_0x9964('0x44')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x19c945,_0x9964('0xb8'));}_0x19c945[_0x9964('0x47')]=moment();if(this['isConfigured'](_0x19c945['delay'])){_0x19c945['scheduledAt']=moment()['add'](_0x19c945[_0x9964('0xb9')],_0x9964('0xba'));}if(!this['isConfigured'](_0x19c945[_0x9964('0x48')])){_0x19c945['callback_priority']=0x2;}this[_0x9964('0x3e')][_0x9964('0x6c')](this,_0x19c945);return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xbb'),_0x19c945['phone'],_0x19c945[_0x9964('0x44')],_0x19c945['scheduledAt']));};AGIVertices[_0x9964('0x17')][_0x9964('0xbc')]=function(_0x13ec8){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xbd'),_0x13ec8['label']));var _0x244c6c=this[_0x9964('0xe')][_0x9964('0x51')](_0x13ec8['application'],_0x13ec8[_0x9964('0x77')]);if(_0x244c6c[_0x9964('0xa6')]===-0x1){return _0x244c6c;}return this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0xbe'),_0x13ec8[_0x9964('0xbf')],_0x13ec8[_0x9964('0x77')]));};AGIVertices[_0x9964('0x17')][_0x9964('0xc0')]=function(_0x518095){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xc1'),_0x518095['label']));if(!this[_0x9964('0x83')](_0x518095[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xc2'));}var _0x22d02e='\x22'+_0x518095['text']+'\x22';if(this[_0x9964('0x83')](_0x518095['options'])){_0x22d02e+=','+_0x518095[_0x9964('0x77')];}var _0x5b26e5=this[_0x9964('0xe')]['exec'](_0x9964('0xa5'),_0x22d02e);if(_0x5b26e5[_0x9964('0xa6')]===-0x1){return _0x5b26e5;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xc3'),_0x22d02e));};AGIVertices['prototype'][_0x9964('0xc4')]=function(_0xec910){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xec910[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0xec910[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}var _0x483b0e='\x22'+_0xec910['text']+'\x22';if(this[_0x9964('0x83')](_0xec910[_0x9964('0x77')])){_0x483b0e+=','+_0xec910[_0x9964('0x77')];}var _0x5972f6=this[_0x9964('0xe')][_0x9964('0x51')]('MRCPSynth',_0x483b0e);if(_0x5972f6[_0x9964('0xa6')]===-0x1){return _0x5972f6;}return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xc3'),_0x483b0e));};AGIVertices[_0x9964('0x17')][_0x9964('0xc5')]=function(_0x148483){logger['info'](util[_0x9964('0x98')](_0x9964('0xc6'),_0x148483[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x148483[_0x9964('0xa9')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xaa'));}var _0x29a8ae=_0x148483[_0x9964('0xa9')];if(this[_0x9964('0x83')](_0x148483[_0x9964('0x77')])){_0x29a8ae+=','+_0x148483['options'];}var _0x19242c=this['channel']['exec'](_0x9964('0xab'),_0x29a8ae);if(_0x19242c[_0x9964('0xa6')]===-0x1){return _0x19242c;}var _0x10f924=this[_0x9964('0xa0')](_0x9964('0xac'),_0x9964('0xc7'));if(_0x10f924[_0x9964('0xa6')]===-0x1){return _0x10f924;}var _0x5ca24f=this['getAndSetVariable']('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x5ca24f[_0x9964('0xa6')]===-0x1){return _0x5ca24f;}var _0x45b0ff=this[_0x9964('0xa0')](_0x9964('0xae'),_0x9964('0xc8'));if(_0x45b0ff['result']===-0x1){return _0x45b0ff;}return this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0xb0'),_0x29a8ae));};AGIVertices[_0x9964('0x17')]['sestekasr']=function(_0x945844){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x945844[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x945844[_0x9964('0xa9')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xaa'));}var _0x1ee9ee=_0x945844[_0x9964('0xa9')];if(this[_0x9964('0x83')](_0x945844[_0x9964('0x77')])){_0x1ee9ee+=','+_0x945844[_0x9964('0x77')];}var _0x19e6bb=this[_0x9964('0xe')]['exec'](_0x9964('0xab'),_0x1ee9ee);if(_0x19e6bb[_0x9964('0xa6')]===-0x1){return _0x19e6bb;}var _0x7cb84e=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x9964('0xc9'));if(_0x7cb84e[_0x9964('0xa6')]===-0x1){return _0x7cb84e;}var _0x309300=this[_0x9964('0xa0')](_0x9964('0xca'),_0x9964('0xcb'));if(_0x309300[_0x9964('0xa6')]===-0x1){return _0x309300;}var _0x1f3f21=this['getAndSetVariable'](_0x9964('0xae'),_0x9964('0xcc'));if(_0x1f3f21[_0x9964('0xa6')]===-0x1){return _0x1f3f21;}return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xb0'),_0x1ee9ee));};AGIVertices[_0x9964('0x17')][_0x9964('0xcd')]=function(_0x269aaa){logger['info'](util[_0x9964('0x98')](_0x9964('0xce'),_0x269aaa['label']));if(!this['isConfigured'](_0x269aaa[_0x9964('0xcf')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x269aaa,_0x9964('0xd0'));}var _0x5abf5e=this[_0x9964('0xd1')][_0x9964('0x6c')](this,_0x269aaa[_0x9964('0xcf')]);if(!_0x5abf5e){return this[_0x9964('0xe')][_0x9964('0x28')](_0x269aaa,_0x9964('0xd2'));}if(!this['isConfigured'](_0x269aaa[_0x9964('0x2b')])){return this['channel'][_0x9964('0x28')](_0x269aaa,_0x9964('0xd3'));}var _0x431a7c=_0x269aaa['query'][_0x9964('0x53')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xd4'),_0x431a7c));var _0xb2de82=this[_0x9964('0x26')][_0x9964('0x6c')](this,_0x5abf5e,_0x431a7c);this['createSquareDetailsReport'][_0x9964('0x6c')](this,_0x269aaa,_0x431a7c);if(!this[_0x9964('0x83')](_0x269aaa[_0x9964('0xd5')])){return this[_0x9964('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4e5e4a=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x269aaa[_0x9964('0xd5')]);if(!_0x4e5e4a){return this[_0x9964('0xe')][_0x9964('0x28')](_0x269aaa,_0x9964('0xd6'));}var _0x49087f=this;_0xb2de82[_0x9964('0xd7')](function(_0x584d9d,_0x2a3235){Object[_0x9964('0xd8')](_0x584d9d)['forEach'](function(_0x3f46eb){_0x49087f[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0xd9'),_0x4e5e4a,_0x2a3235,_0x3f46eb),_0x584d9d[_0x3f46eb]);});});this[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0xda'),_0x4e5e4a),_0xb2de82['length']);return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('variable\x20%s\x20set',_0x4e5e4a));};AGIVertices['prototype']['dial']=function(_0x1a99a5){logger['debug'](util['format'](_0x9964('0xdb'),_0x1a99a5['label']));if(!this[_0x9964('0x83')](_0x1a99a5[_0x9964('0xdc')])){return this['channel'][_0x9964('0x28')](_0x1a99a5,_0x9964('0xdd'));}var _0x32a37e=this['getUser'][_0x9964('0x6c')](this,_0x1a99a5['sip_id']);if(!_0x32a37e){return this[_0x9964('0xe')]['error'](_0x1a99a5,_0x9964('0xde'));}var _0x58e727=this[_0x9964('0xe')][_0x9964('0x51')](_0x9964('0xdf'),[util['format'](_0x9964('0xe0'),_0x32a37e),_0x1a99a5['timeout'],_0x1a99a5[_0x9964('0xe1')],_0x1a99a5['url']]);if(_0x58e727['result']===-0x1){return _0x58e727;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('Executed\x20command\x20%s',_0x9964('0xdf')));};AGIVertices[_0x9964('0x17')][_0x9964('0xe2')]=function(_0x29984d){logger[_0x9964('0x2c')](util['format'](_0x9964('0xe3'),_0x29984d[_0x9964('0x34')]));if(!this['isConfigured'](_0x29984d[_0x9964('0x79')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xe4'));}if(!this[_0x9964('0x83')](_0x29984d[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}this['channel'][_0x9964('0xe5')]=!![];this[_0x9964('0x32')](_0x29984d);this[_0x9964('0x3d')](_0x29984d[_0x9964('0x57')],'in','','');this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xe6'),_0x29984d[_0x9964('0x57')]));var _0x3da78c=this[_0x9964('0x78')][_0x9964('0x6c')](this,_0x29984d);if(_0x3da78c){for(var _0x10c006 in _0x3da78c){if(_0x3da78c[_0x9964('0x90')](_0x10c006)){this[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0xe7'),_0x10c006[_0x9964('0x67')]()),_0x3da78c[_0x10c006]);}}this[_0x9964('0x3d')](_0x3da78c['speech'],_0x9964('0xe8'),_0x9964('0xe2'),'');return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xe9'),_0x3da78c[_0x9964('0xea')]));}return this[_0x9964('0xe')]['error'](_0x29984d,_0x9964('0xeb'));};AGIVertices[_0x9964('0x17')][_0x9964('0xec')]=function(_0x4dfbca){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0xed'),_0x4dfbca['label']));if(!this[_0x9964('0x83')](_0x4dfbca[_0x9964('0x7b')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20project_id\x20configured');}if(!this[_0x9964('0x83')](_0x4dfbca[_0x9964('0x7c')])){return this[_0x9964('0xe')]['noop'](_0x9964('0xee'));}if(!this[_0x9964('0x83')](_0x4dfbca[_0x9964('0xef')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x4dfbca['dialogflowV2_language'])){return this[_0x9964('0xe')]['noop'](_0x9964('0xf0'));}if(!this[_0x9964('0x83')](_0x4dfbca[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xc2'));}this['channel'][_0x9964('0xe5')]=!![];this['createSquareDetailsReport'](_0x4dfbca);this[_0x9964('0x3d')](_0x4dfbca[_0x9964('0x57')],'in','','');this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0xf1'),_0x4dfbca[_0x9964('0x57')]));var _0x235d7f=this[_0x9964('0x7a')][_0x9964('0x6c')](this,_0x4dfbca);if(_0x235d7f){for(var _0x1b61ca in _0x235d7f){if(_0x235d7f['hasOwnProperty'](_0x1b61ca)){if(_0x1b61ca!=='providerResponse'){this[_0x9964('0xe')]['setVariable'](util[_0x9964('0x98')](_0x9964('0xe7'),_0x1b61ca[_0x9964('0x67')]()),_0x235d7f[_0x1b61ca]);}}}this[_0x9964('0x3d')](_0x235d7f[_0x9964('0xea')],_0x9964('0xe8'),_0x9964('0xec'),_0x235d7f['providerResponse']);return this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')]('DialogflowV2\x20Result\x20%s',_0x235d7f['speech']));}return this[_0x9964('0xe')][_0x9964('0x28')](_0x4dfbca,_0x9964('0xf2'));};AGIVertices[_0x9964('0x17')][_0x9964('0xf3')]=function(_0x519238){logger['info'](util[_0x9964('0x98')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x519238[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x519238[_0x9964('0xf4')])){return this[_0x9964('0xe')]['noop'](_0x9964('0xf5'));}if(!this['isConfigured'](_0x519238[_0x9964('0xf6')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20username\x20configured');}if(!this[_0x9964('0x83')](_0x519238[_0x9964('0xf7')])){return this[_0x9964('0xe')]['noop'](_0x9964('0xf8'));}if(!this[_0x9964('0x83')](_0x519238[_0x9964('0xf9')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}this['channel'][_0x9964('0xe5')]=!![];this['createSquareDetailsReport'](_0x519238);this[_0x9964('0x3d')](_0x519238[_0x9964('0x57')],'in','','');this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xfa'),_0x519238[_0x9964('0x57')]));var _0x599510=this[_0x9964('0x7e')]['sync'](this,_0x519238);if(_0x599510){for(var _0x34a50b in _0x599510){if(_0x599510[_0x9964('0x90')](_0x34a50b)){this[_0x9964('0xe')]['setVariable'](util[_0x9964('0x98')](_0x9964('0xfb'),_0x34a50b[_0x9964('0x67')]()),_0x599510[_0x34a50b]);}}this[_0x9964('0x3d')](_0x599510[_0x9964('0xea')],_0x9964('0xe8'),_0x9964('0xf3'),'');if(_0x599510['audiofile']){this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xfc'),_0x599510[_0x9964('0xfd')]));var _0x396803=this[_0x9964('0xe')][_0x9964('0xfe')](_0x599510['audiofile']);try{fs[_0x9964('0xff')](_0x599510[_0x9964('0xfd')]+_0x9964('0x100'));}catch(_0x38c44e){logger[_0x9964('0x28')](_0x38c44e);}return _0x396803;}else{return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('SestekNDA\x20Result\x20%s',_0x599510[_0x9964('0xea')]));}}return this[_0x9964('0xe')][_0x9964('0x28')](_0x519238,_0x9964('0x101'));};AGIVertices[_0x9964('0x17')][_0x9964('0x102')]=function(_0x17c7fb){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x103'),_0x17c7fb['label']));return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x102'));};AGIVertices[_0x9964('0x17')]['ext_dial']=function(_0x3df1f0){logger[_0x9964('0x2c')](util['format'](_0x9964('0x104'),_0x3df1f0['label']));var _0x4e1c9c='';if(_0x3df1f0['trunk_id']){if(!this['isConfigured'](_0x3df1f0[_0x9964('0x105')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x3df1f0,_0x9964('0x106'));}else{var _0x2415ae=parseInt(_0x3df1f0[_0x9964('0x105')],0xa);if(isNaN(_0x2415ae)){_0x4e1c9c=_0x3df1f0[_0x9964('0x105')];}else{_0x4e1c9c=this['getTrunk'][_0x9964('0x6c')](this,_0x3df1f0[_0x9964('0x105')]);if(!_0x4e1c9c){return this['channel']['error'](_0x3df1f0,_0x9964('0x107'));}}}}else if(_0x3df1f0[_0x9964('0x108')]){_0x4e1c9c=_0x3df1f0[_0x9964('0x108')];}else{return this[_0x9964('0xe')][_0x9964('0x28')](_0x3df1f0,_0x9964('0x106'));}var _0x4f20a0=this[_0x9964('0xe')][_0x9964('0x51')](_0x9964('0xdf'),[util[_0x9964('0x98')](_0x9964('0x109'),_0x4e1c9c,_0x3df1f0['phone']),_0x3df1f0['timeout'],_0x3df1f0['opts'],_0x3df1f0[_0x9964('0x61')]]);if(_0x4f20a0[_0x9964('0xa6')]===-0x1){return _0x4f20a0;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x10a'),_0x9964('0xdf')));};AGIVertices['prototype'][_0x9964('0x10b')]=function(_0x1e90d8){logger['info'](util[_0x9964('0x98')](_0x9964('0x10c'),_0x1e90d8[_0x9964('0x34')]));return this['channel'][_0x9964('0xa7')](_0x9964('0x10b'));};AGIVertices[_0x9964('0x17')][_0x9964('0xd')]=function(_0x50e53f){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x50e53f[_0x9964('0x34')]));if(_0x50e53f[_0x9964('0xa3')]===0x0){return this[_0x9964('0xa2')](_0x50e53f);}_0x50e53f[_0x9964('0xa3')]-=0x1;if(!this[_0x9964('0x83')](_0x50e53f[_0x9964('0x10d')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x50e53f,_0x9964('0x10e'));}var _0x5659ff=this[_0x9964('0x1d')][_0x9964('0x6c')](this,_0x50e53f[_0x9964('0x10d')]);if(!_0x5659ff){return this[_0x9964('0xe')][_0x9964('0x28')](_0x50e53f,_0x9964('0x10f'));}if(!this['isConfigured'](_0x50e53f[_0x9964('0xd5')])){return this[_0x9964('0xe')][_0x9964('0x28')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4e4505=this[_0x9964('0xe')]['getData'](_0x5659ff,_0x50e53f[_0x9964('0x110')],_0x50e53f[_0x9964('0x111')]);var _0x10836c=_0x4e4505['result']?_0x4e4505[_0x9964('0xa6')][_0x9964('0x9f')]():'';logger['info']('test',JSON[_0x9964('0x6f')](_0x4e4505));if(_0x4e4505[_0x9964('0xa6')]===-0x1){this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x50e53f,_0x10836c);return _0x4e4505;}else if(_0x4e4505[_0x9964('0x9e')]==='timeout'){_0x4e4505[_0x9964('0xa6')]=_0x10836c['length']>=parseInt(_0x50e53f['mindigit'])?'x':'i';}else{_0x4e4505[_0x9964('0xa6')]=_0x10836c['length']>=parseInt(_0x50e53f['mindigit'])&&_0x10836c['length']<=parseInt(_0x50e53f['maxdigit'])?'x':'i';}var _0x1a4dfd=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x50e53f[_0x9964('0xd5')]);if(!_0x1a4dfd){return this[_0x9964('0xe')][_0x9964('0x28')](_0x50e53f,'no\x20variable\x20found');}this[_0x9964('0xe')][_0x9964('0x9a')](_0x1a4dfd,_0x10836c);if(this['isConfigured'](_0x50e53f[_0x9964('0x112')])){var _0xd3ef5c=parseInt(_0x50e53f['hiddendigitsnum'],0xa);var _0x506efc=rs[_0x9964('0x113')]({'charset':'*','length':_0xd3ef5c});var _0x34f0de=_0x10836c[_0x9964('0x9b')];if(_0x34f0de>0x0){if(_0x34f0de>_0xd3ef5c){this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x50e53f,_0x50e53f['hiddendigitspos']===_0x9964('0x114')?_0x506efc+_0x10836c[_0x9964('0x115')](_0xd3ef5c):_0x10836c[_0x9964('0x115')](0x0,_0x34f0de-_0xd3ef5c)+_0x506efc);}else{this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x50e53f,rs[_0x9964('0x113')]({'charset':'*','length':_0x34f0de}));}}else{this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x50e53f,'');}}else{this[_0x9964('0x32')]['sync'](this,_0x50e53f,_0x10836c);}return _0x4e4505;};AGIVertices[_0x9964('0x17')][_0x9964('0x116')]=function(_0x368456){logger['info'](util[_0x9964('0x98')](_0x9964('0x117'),_0x368456[_0x9964('0x34')]));return this[_0x9964('0xd')](_0x368456);};AGIVertices[_0x9964('0x17')][_0x9964('0x118')]=function(_0x37265){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x119'),_0x37265[_0x9964('0x34')]));this['createSquareDetailsReport']['sync'](this,_0x37265,_0x37265[_0x9964('0x11a')]);return this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x11b'),_0x37265[_0x9964('0x11a')]));};AGIVertices['prototype']['awspolly']=function(_0x57fbf7){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x11c'),_0x57fbf7[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x57fbf7[_0x9964('0x89')])||!this[_0x9964('0x83')](_0x57fbf7[_0x9964('0x11d')])){return this['channel'][_0x9964('0xa7')](_0x9964('0x11e'));}if(!this[_0x9964('0x83')](_0x57fbf7[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xc2'));}this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x11f'),_0x57fbf7[_0x9964('0x57')]));var _0x4350f8=this['awsPolly'][_0x9964('0x6c')](this,_0x57fbf7);if(_0x4350f8){this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x120'),_0x4350f8));var _0x1dda2d=this[_0x9964('0xe')]['streamFile'](_0x4350f8);try{fs[_0x9964('0xff')](_0x4350f8+'.wav');}catch(_0x164b4c){logger[_0x9964('0x28')](_0x164b4c);}return _0x1dda2d;}return this[_0x9964('0xe')][_0x9964('0x28')](_0x57fbf7,_0x9964('0x121'));};AGIVertices[_0x9964('0x17')]['awslex']=function(_0x420faa){logger['info'](util[_0x9964('0x98')](_0x9964('0x122'),_0x420faa[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x420faa['aws_access_key_id'])||!this['isConfigured'](_0x420faa['aws_secret_access_key'])){return this['channel']['noop'](_0x9964('0x11e'));}if(!this['isConfigured'](_0x420faa['aws_bot_name'])){return this[_0x9964('0xe')]['noop'](_0x9964('0x123'));}if(!this['isConfigured'](_0x420faa[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}this[_0x9964('0xe')][_0x9964('0xe5')]=!![];this[_0x9964('0x32')](_0x420faa);this[_0x9964('0x3d')](_0x420faa[_0x9964('0x57')],'in','','');this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x124'),_0x420faa['text']));var _0x3deff7=this[_0x9964('0x88')][_0x9964('0x6c')](this,_0x420faa);if(_0x3deff7){for(var _0x4e0bc7 in _0x3deff7){if(_0x3deff7[_0x9964('0x90')](_0x4e0bc7)&&_['isString'](_0x3deff7[_0x4e0bc7])){this[_0x9964('0xe')]['setVariable'](util[_0x9964('0x98')](_0x9964('0x125'),_0x4e0bc7['toUpperCase']()),_0x3deff7[_0x4e0bc7]);}}if(_[_0x9964('0x3f')](_0x3deff7[_0x9964('0x75')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x3deff7[_0x9964('0x75')],'out',_0x9964('0x126'),'');return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x127'),_0x3deff7['message']));}}return this[_0x9964('0xe')][_0x9964('0x28')](_0x420faa,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x9964('0x17')][_0x9964('0x128')]=function(_0x57369d){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x129'),_0x57369d['label'],_0x57369d[_0x9964('0x63')]));if(!this[_0x9964('0x83')](_0x57369d[_0x9964('0x79')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xe4'));}var _0x569fd6=_0x9964('0x12a');var _0x1b4a64=util[_0x9964('0x98')](_0x9964('0x12b'),FILES_PATH,rs[_0x9964('0x113')](0x4));var _0x25278d=util[_0x9964('0x98')]('%s.%s',_0x1b4a64,_0x569fd6);var _0x3c7901=!![];if(_0x57369d[_0x9964('0x12c')]===_0x9964('0x12d')){_0x3c7901=![];}var _0x1d7638=this[_0x9964('0xe')][_0x9964('0x12e')](_0x1b4a64,_0x569fd6,_0x57369d['intKey'],_0x57369d[_0x9964('0x63')],undefined,_0x3c7901);if(_0x1d7638[_0x9964('0xa6')]!==-0x1){this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('google\x20%s\x20file\x20created',_0x25278d));var _0x4ec225=this['googleASR'][_0x9964('0x6c')](this,_0x57369d,_0x25278d);if(_0x4ec225){for(var _0x127a1f in _0x4ec225){if(_0x4ec225['hasOwnProperty'](_0x127a1f)){this[_0x9964('0xe')]['setVariable'](util[_0x9964('0x98')](_0x9964('0x12f'),_0x127a1f[_0x9964('0x67')]()),_0x4ec225[_0x127a1f]);}}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x130'),JSON[_0x9964('0x6f')](_0x4ec225)));}}return _0x1d7638;};AGIVertices[_0x9964('0x17')]['tildeasr']=function(_0x34671b){logger['info'](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x34671b[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x34671b[_0x9964('0x131')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x132'));}if(!this[_0x9964('0x83')](_0x34671b[_0x9964('0x8c')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x133'));}var _0x211488=_0x9964('0x12a');var _0x580a19=util[_0x9964('0x98')](_0x9964('0x12b'),FILES_PATH,rs[_0x9964('0x113')](0x4));var _0x18e305=util['format'](_0x9964('0x99'),_0x580a19,_0x211488);var _0x23543c=!![];if(_0x34671b['beep']===_0x9964('0x12d')){_0x23543c=![];}var _0x3b3e6b=this[_0x9964('0xe')][_0x9964('0x12e')](_0x580a19,_0x211488,_0x34671b[_0x9964('0x134')],_0x34671b['timeout'],undefined,_0x23543c);if(_0x3b3e6b['result']!==-0x1){this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x135'),_0x18e305));var _0x11f382=this['tildeASR'][_0x9964('0x6c')](this,_0x34671b,_0x18e305);if(_0x11f382){for(var _0x7703d in _0x11f382){if(_0x11f382[_0x9964('0x90')](_0x7703d)){this[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')]('TILDE_ASR_%s',_0x7703d['toUpperCase']()),_0x11f382[_0x7703d]);}}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('TildeASR\x20Result\x20%s',JSON[_0x9964('0x6f')](_0x11f382)));}}return _0x3b3e6b;};AGIVertices[_0x9964('0x17')][_0x9964('0x136')]=function(_0x3b744a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x137'),_0x3b744a[_0x9964('0x34')]));return this[_0x9964('0xe')][_0x9964('0x138')](_0x3b744a[_0x9964('0x39')],_0x3b744a[_0x9964('0x3a')],_0x3b744a[_0x9964('0x139')]);};AGIVertices[_0x9964('0x17')]['gotoif']=function(_0x56268a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x13a'),_0x56268a[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x56268a[_0x9964('0x13b')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x56268a,_0x9964('0x13c'));}try{var _0x593a02=eval(_0x56268a['condition'])?_0x9964('0x13d'):'false';this['channel']['noop'](util[_0x9964('0x98')](_0x9964('0x13e'),_0x56268a[_0x9964('0x13b')],_0x593a02));return{'code':0xc8,'result':_0x593a02};}catch(_0x1440a4){return{'code':0xc8,'result':_0x9964('0x13f')};}};AGIVertices[_0x9964('0x17')][_0x9964('0x140')]=function(_0x3a09d1){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x141'),_0x3a09d1['label']));if(!this[_0x9964('0x83')](_0x3a09d1[_0x9964('0x142')])){return this[_0x9964('0xe')]['error'](_0x3a09d1,_0x9964('0x143'));}var _0x21659b=this[_0x9964('0x23')][_0x9964('0x6c')](this,_0x3a09d1[_0x9964('0x142')]);if(!_0x21659b){return this[_0x9964('0xe')][_0x9964('0x28')](_0x3a09d1,_0x9964('0x144'));}for(var _0x509f1e=0x0;_0x509f1e<_0x21659b[_0x9964('0x9b')];_0x509f1e+=0x1){var _0x4c45a3=this[_0x9964('0xe')]['getVariable'](util[_0x9964('0x98')](_0x9964('0x145'),_0x21659b[_0x509f1e]));if(_0x4c45a3[_0x9964('0xa6')]===-0x1){return _0x4c45a3;}logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x146'),_0x21659b[_0x509f1e],_0x4c45a3[_0x9964('0x9e')]));if(_0x4c45a3[_0x9964('0x9e')]==='true'){logger['info'](util[_0x9964('0x98')](_0x9964('0x146'),_0x21659b[_0x509f1e],'true'));this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x146'),_0x21659b[_0x509f1e],'true'));return{'code':0xc8,'result':_0x9964('0x13d')};}else{logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x146'),_0x21659b[_0x509f1e],_0x9964('0x13f')));this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0x146'),_0x21659b[_0x509f1e],'false'));}}return{'code':0xc8,'result':_0x9964('0x13f')};};AGIVertices[_0x9964('0x17')][_0x9964('0x147')]=function(_0x47e48f){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x148'),_0x47e48f['label']));return this[_0x9964('0xe')][_0x9964('0x147')]();};AGIVertices['prototype'][_0x9964('0x149')]=function(_0x136039){logger[_0x9964('0x2c')](util['format'](_0x9964('0x14a'),_0x136039[_0x9964('0x34')]));if(!this['isConfigured'](_0x136039[_0x9964('0x79')])){return this['channel']['noop'](_0x9964('0xe4'));}var _0x5775d0='wav';var _0x266979=util[_0x9964('0x98')](_0x9964('0x12b'),FILES_PATH,rs['generate'](0x4));var _0x4ff92f=util[_0x9964('0x98')](_0x9964('0x99'),_0x266979,_0x5775d0);var _0x2021dc=!![];if(_0x136039[_0x9964('0x12c')]===_0x9964('0x12d')){_0x2021dc=![];}var _0x515ed6=this[_0x9964('0xe')][_0x9964('0x12e')](_0x266979,_0x5775d0,_0x136039[_0x9964('0x134')],_0x136039['timeout'],undefined,_0x2021dc);if(_0x515ed6[_0x9964('0xa6')]!==-0x1){this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0x14b'),_0x4ff92f));var _0x2c717d=this[_0x9964('0x81')][_0x9964('0x6c')](this,_0x136039,_0x4ff92f);if(_0x2c717d){for(var _0x32f6d4 in _0x2c717d){if(_0x2c717d['hasOwnProperty'](_0x32f6d4)){this['channel']['setVariable'](util[_0x9964('0x98')](_0x9964('0x14c'),_0x32f6d4['toUpperCase']()),_0x2c717d[_0x32f6d4]);}}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x14d'),JSON[_0x9964('0x6f')](_0x2c717d)));}}return _0x515ed6;};AGIVertices['prototype'][_0x9964('0x14e')]=function(_0x3ca89b){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x14f'),_0x3ca89b[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x3ca89b['key'])){return this[_0x9964('0xe')]['noop']('no\x20key\x20configured');}if(!this[_0x9964('0x83')](_0x3ca89b[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')]('no\x20text\x20configured');}this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')]('Trying\x20ispeech\x20TTS\x20%s',_0x3ca89b['text']));var _0xfbb7f2=this[_0x9964('0x7f')][_0x9964('0x6c')](this,_0x3ca89b);if(_0xfbb7f2){this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x14b'),_0xfbb7f2));var _0x1a9631=this[_0x9964('0xe')][_0x9964('0xfe')](_0xfbb7f2,_0x3ca89b['intKey']);try{fs['unlink'](_0xfbb7f2+_0x9964('0x100'));}catch(_0x73d597){logger[_0x9964('0x28')](_0x73d597);}return _0x1a9631;}return this[_0x9964('0xe')][_0x9964('0x28')](_0x3ca89b,_0x9964('0x150'));};AGIVertices[_0x9964('0x17')][_0x9964('0x151')]=function(_0x787730){logger['info'](util['format'](_0x9964('0x152'),_0x787730[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x787730[_0x9964('0x153')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x787730,_0x9964('0x154'));}logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x155'),this[_0x9964('0xe')][_0x9964('0x37')],_0x787730[_0x9964('0x153')]));var _0x1a11b9=this[_0x9964('0x50')][_0x9964('0x6c')](this,_0x787730['findBy']);if(_0x1a11b9){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')]['callerid'],_0x787730[_0x9964('0x153')]));this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')][_0x9964('0x37')],_0x787730[_0x9964('0x153')]));return{'code':0xc8,'result':_0x9964('0x157')};}else{logger[_0x9964('0x2c')](util['format'](_0x9964('0x158'),this[_0x9964('0xe')][_0x9964('0x37')],_0x787730[_0x9964('0x153')]));this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9964('0xe')]['callerid'],_0x787730['findBy']));return{'code':0xc8,'result':_0x9964('0x159')};}};AGIVertices[_0x9964('0x17')]['logout']=function(_0x3ca563){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x15a'),_0x3ca563['label']));if(!this[_0x9964('0x83')](_0x3ca563[_0x9964('0x153')])){return this[_0x9964('0xe')]['error'](_0x3ca563,_0x9964('0x154'));}logger[_0x9964('0x2c')](util['format'](_0x9964('0x155'),this[_0x9964('0xe')][_0x9964('0x37')],_0x3ca563[_0x9964('0x153')]));var _0x4fde68=this[_0x9964('0x4d')][_0x9964('0x6c')](this,_0x3ca563['findBy']);if(_0x4fde68){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')][_0x9964('0x37')],_0x3ca563['findBy']));this[_0x9964('0xe')][_0x9964('0xa7')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x9964('0xe')][_0x9964('0x37')],_0x3ca563[_0x9964('0x153')]));return{'code':0xc8,'result':_0x9964('0x157')};}else{logger['info'](util[_0x9964('0x98')](_0x9964('0x158'),this['channel'][_0x9964('0x37')],_0x3ca563[_0x9964('0x153')]));this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9964('0xe')][_0x9964('0x37')],_0x3ca563['findBy']));return{'code':0xc8,'result':_0x9964('0x159')};}};AGIVertices[_0x9964('0x17')][_0x9964('0x15b')]=function(_0x399ba2){logger[_0x9964('0x2c')](util['format'](_0x9964('0x15c'),_0x399ba2['label']));if(!this[_0x9964('0x83')](_0x399ba2[_0x9964('0x15d')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x399ba2,_0x9964('0x15e'));}this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x15f'),_0x399ba2[_0x9964('0x15d')]));var _0x16b2a3=eval(_0x399ba2[_0x9964('0x15d')]);if(!this['isConfigured'](_0x399ba2[_0x9964('0xd5')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x160'));}var _0x4bf8a9=this[_0x9964('0x10')]['sync'](this,_0x399ba2[_0x9964('0xd5')]);if(!_0x4bf8a9){return this[_0x9964('0xe')]['error'](_0x399ba2,_0x9964('0xd6'));}if(_['isArray'](_0x16b2a3)){var _0x3c0494=this;_0x16b2a3[_0x9964('0xd7')](function(_0x2c2542,_0x224d94){_0x3c0494[_0x9964('0xe')][_0x9964('0x9a')](util[_0x9964('0x98')](_0x9964('0x161'),_0x4bf8a9,_0x224d94),_0x2c2542);});return this['channel'][_0x9964('0xa7')](util['format'](_0x9964('0x162'),_0x4bf8a9));}else{return this[_0x9964('0xe')][_0x9964('0x9a')](_0x4bf8a9,_0x16b2a3);}};AGIVertices['prototype'][_0x9964('0xc')]=function(_0x32f80f){logger['info'](util['format'](_0x9964('0x163'),_0x32f80f['label']));if(_0x32f80f['retry']===0x0){return this[_0x9964('0xa2')](_0x32f80f);}_0x32f80f['retry']-=0x1;if(!this[_0x9964('0x83')](_0x32f80f[_0x9964('0x10d')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x32f80f,_0x9964('0x10e'));}var _0x5c041b=this[_0x9964('0x1d')][_0x9964('0x6c')](this,_0x32f80f[_0x9964('0x10d')]);if(!_0x5c041b){return this['channel']['error'](_0x32f80f,'no\x20file\x20audio\x20found');}var _0x114abe=this[_0x9964('0xe')][_0x9964('0x164')](_0x5c041b,_0x32f80f[_0x9964('0x110')],_0x32f80f[_0x9964('0x165')]);var _0x31bbd1=_0x114abe[_0x9964('0xa6')];if(_0x114abe[_0x9964('0xa6')]===-0x1){this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x32f80f,'-1');return _0x114abe;}else if(_0x114abe[_0x9964('0x9e')]===_0x9964('0x63')){_0x114abe[_0x9964('0xa6')]=_0x114abe[_0x9964('0xa6')]['length']>0x0?_0x114abe[_0x9964('0xa6')]:'t';}else if(_[_0x9964('0x41')](_0x114abe[_0x9964('0xa6')])){_0x114abe[_0x9964('0xa6')]='#';_0x31bbd1='#';}if(!this[_0x9964('0x83')](_0x32f80f[_0x9964('0xd5')])){this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x160'));}else{var _0x420452=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x32f80f[_0x9964('0xd5')]);if(!_0x420452){return this[_0x9964('0xe')][_0x9964('0x28')](_0x32f80f,_0x9964('0xd6'));}this[_0x9964('0xe')][_0x9964('0x9a')](_0x420452,_0x31bbd1);}this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x32f80f,_0x31bbd1);return _0x114abe;};AGIVertices[_0x9964('0x17')]['noop']=function(_0x2956ba){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x166'),_0x2956ba['label']));return this[_0x9964('0xe')][_0x9964('0xa7')](_0x2956ba['output']||_0x2956ba[_0x9964('0x34')]);};AGIVertices[_0x9964('0x17')]['pause']=function(_0x5d1692){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x167'),_0x5d1692['label']));if(!this[_0x9964('0x83')](_0x5d1692[_0x9964('0x153')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x5d1692,_0x9964('0x154'));}logger[_0x9964('0x2c')](util[_0x9964('0x98')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9964('0xe')][_0x9964('0x37')],_0x5d1692[_0x9964('0x153')]));var _0x5af231=this[_0x9964('0x49')][_0x9964('0x6c')](this,_0x5d1692[_0x9964('0x168')]);var _0x464f04=this[_0x9964('0x169')]['sync'](this,_0x5d1692['findBy'],_0x5af231);if(_0x464f04){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')][_0x9964('0x37')],_0x5d1692['findBy']));this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x156'),this['channel'][_0x9964('0x37')],_0x5d1692[_0x9964('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x158'),this[_0x9964('0xe')]['callerid'],_0x5d1692[_0x9964('0x153')]));this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')]['callerid'],_0x5d1692['findBy']));return{'code':0xc8,'result':_0x9964('0x159')};}};AGIVertices[_0x9964('0x17')][_0x9964('0x16a')]=function(_0x4414b4){logger[_0x9964('0x2c')](util['format'](_0x9964('0x16b'),_0x4414b4[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x4414b4['file_id'])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x4414b4,'no\x20file\x20audio\x20selected');}var _0xebef3a=this[_0x9964('0x1d')][_0x9964('0x6c')](this,_0x4414b4[_0x9964('0x10d')]);if(!_0xebef3a){return this[_0x9964('0xe')]['error'](_0x4414b4,_0x9964('0x10f'));}var _0x27a326=this['channel']['exec'](_0x9964('0x16c'),[_0xebef3a,_0x4414b4[_0x9964('0xe1')]]);if(_0x27a326['result']===-0x1){return _0x27a326;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xbe'),'PLAYBACK',_0xebef3a));};AGIVertices[_0x9964('0x17')]['queue']=function(_0x57a83a){logger[_0x9964('0x2c')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x57a83a[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x57a83a[_0x9964('0x16d')])){return this[_0x9964('0xe')]['error'](_0x57a83a,_0x9964('0x16e'));}var _0x129784='';var _0x2ac83b=parseInt(_0x57a83a[_0x9964('0x16d')],0xa);if(isNaN(_0x2ac83b)){_0x129784=_0x57a83a['queue_id'];}else{_0x129784=this['getVoiceQueue'][_0x9964('0x6c')](this,_0x57a83a[_0x9964('0x16d')]);if(!_0x129784){return this[_0x9964('0xe')][_0x9964('0x28')](_0x57a83a,_0x9964('0x16f'));}}var _0x2e9604='';if(this['isConfigured'](_0x57a83a[_0x9964('0x10d')])){var _0x304435=this[_0x9964('0x1d')][_0x9964('0x6c')](this,_0x57a83a[_0x9964('0x10d')]);if(_0x304435){_0x2e9604=_0x304435;}}this[_0x9964('0x32')]['sync'](this,_0x57a83a,_0x129784);if(_0x57a83a['opts'][_0x9964('0x170')]('x')<0x0){_0x57a83a[_0x9964('0xe1')]+='x';}if(_0x57a83a['opts'][_0x9964('0x170')]('X')<0x0){_0x57a83a[_0x9964('0xe1')]+='X';}this[_0x9964('0xe')][_0x9964('0x9a')](_0x9964('0x171'),_0x129784?_0x129784[_0x9964('0x172')]():'');var _0x1424d9=this[_0x9964('0xe')][_0x9964('0x51')](_0x9964('0x173'),[_0x129784,_0x57a83a[_0x9964('0xe1')],_0x57a83a[_0x9964('0x61')],_0x2e9604,_0x57a83a[_0x9964('0x63')],_0x57a83a[_0x9964('0xb1')],_0x57a83a[_0x9964('0x174')],_0x57a83a[_0x9964('0x175')],'',_0x57a83a['position']]);if(_0x1424d9[_0x9964('0xa6')]===-0x1){return _0x1424d9;}return this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0xbe'),_0x9964('0x173'),_0x129784));};AGIVertices[_0x9964('0x17')][_0x9964('0x176')]=function(_0x5273ee){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x177'),_0x5273ee['label']));var _0xb20037=_0x5273ee[_0x9964('0x178')]||_0x9964('0x12a');var _0x4b54ae=util['format']('%s_%s',this['channel'][_0x9964('0x33')],rs['generate'](0x5));var _0x505265=util[_0x9964('0x98')]('%s/recordings/%s.%s',FILES_PATH,_0x4b54ae,_0xb20037);var _0x47c8ca=util[_0x9964('0x98')](_0x9964('0x12b'),FILES_PATH,_0x4b54ae);this[_0x9964('0x38')][_0x9964('0x6c')](this,_0x5273ee,_0x4b54ae,_0x505265);this[_0x9964('0xe')][_0x9964('0x9a')](_0x9964('0x179'),_0x4b54ae);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x47c8ca,_0xb20037,_0x5273ee[_0x9964('0x17a')],_0x5273ee[_0x9964('0x63')]);return this[_0x9964('0xe')][_0x9964('0x12e')](_0x47c8ca,_0xb20037,_0x5273ee['escape_digits'],_0x5273ee[_0x9964('0x63')],undefined,!![]);};AGIVertices[_0x9964('0x17')][_0x9964('0x17b')]=function(_0x314e2a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x17c'),_0x314e2a[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x314e2a['url'])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x17d'));}var _0x93b3f8=this[_0x9964('0x60')][_0x9964('0x6c')](this,_0x314e2a);logger['info'](util[_0x9964('0x98')]('Response:',util['inspect'](_0x93b3f8,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x314e2a[_0x9964('0xd5')])){return this[_0x9964('0xe')]['noop'](_0x9964('0x17e'));}var _0xa848ad=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x314e2a[_0x9964('0xd5')]);if(!_0xa848ad){return this['channel'][_0x9964('0x28')](_0x314e2a,_0x9964('0xd6'));}this[_0x9964('0xe')][_0x9964('0x9a')](util['format'](_0x9964('0x17f'),_0xa848ad),_0x93b3f8[_0x9964('0x73')]?_0x93b3f8[_0x9964('0x73')]:_0x9964('0x180'));this[_0x9964('0xe')]['setVariable'](util['format']('%s_STATUS_MESSAGE',_0xa848ad),_0x93b3f8[_0x9964('0x74')]?_0x93b3f8[_0x9964('0x74')]:'OK');if(_0x93b3f8[_0x9964('0x70')]){try{this['saveRestApiResult'](_0x93b3f8[_0x9964('0x70')],_0xa848ad);}catch(_0x1725e2){logger[_0x9964('0x28')](util[_0x9964('0x98')](_0x9964('0x181'),_0xa848ad));}}return this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')]('variable\x20%s\x20set',_0xa848ad));};AGIVertices['prototype'][_0x9964('0x182')]=function(_0x8996c3){logger[_0x9964('0x2c')](util['format'](_0x9964('0x183'),_0x8996c3[_0x9964('0x34')]));return this[_0x9964('0xe')][_0x9964('0x184')](_0x8996c3[_0x9964('0x185')][_0x9964('0x53')](/\s+/g,''),_0x8996c3[_0x9964('0x17a')]);};AGIVertices[_0x9964('0x17')][_0x9964('0x186')]=function(_0x4dc77a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x187'),_0x4dc77a[_0x9964('0x34')]));return this['channel'][_0x9964('0x188')](_0x4dc77a[_0x9964('0x64')][_0x9964('0x53')](/\s+/g,''),_0x4dc77a['escape_digits']);};AGIVertices[_0x9964('0x17')][_0x9964('0x189')]=function(_0x2c9045){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x18a'),_0x2c9045['label']));return this[_0x9964('0xe')][_0x9964('0x18b')](_0x2c9045['text'],_0x2c9045[_0x9964('0x17a')]);};AGIVertices[_0x9964('0x17')][_0x9964('0x18c')]=function(_0x2989e5){logger['info'](util[_0x9964('0x98')](_0x9964('0x18d'),_0x2989e5[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x2989e5['account_id'])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x18e'));}var _0x37539c=this[_0x9964('0x20')][_0x9964('0x6c')](this,_0x2989e5[_0x9964('0x18f')]);if(!_0x37539c||!_0x37539c['Smtp']){return this[_0x9964('0xe')]['error'](_0x2989e5,_0x9964('0x190'));}var _0x4aecc9={'from':util[_0x9964('0x98')](_0x9964('0x191'),_0x37539c[_0x9964('0x16')],_0x37539c[_0x9964('0x192')]||_0x37539c[_0x9964('0x193')]['user']),'to':_0x2989e5['to']||'','cc':_0x2989e5['cc']||'','bcc':_0x2989e5[_0x9964('0x194')]||'','subject':_0x2989e5['subject'],'html':_0x2989e5[_0x9964('0x57')],'text':_0x2989e5[_0x9964('0x57')]};if(this[_0x9964('0x83')](_0x2989e5[_0x9964('0x195')])){}logger[_0x9964('0x196')]('sendMail\x20message',JSON[_0x9964('0x6f')](_0x4aecc9));this['createSquareDetailsReport'][_0x9964('0x6c')](this,_0x2989e5,_0x2989e5[_0x9964('0x18f')]);this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x197'),_0x37539c[_0x9964('0x16')]));this[_0x9964('0x21')][_0x9964('0x6c')](this,_0x37539c[_0x9964('0x198')],_0x4aecc9);return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x199'));};AGIVertices[_0x9964('0x17')][_0x9964('0x19a')]=function(_0x273ace){logger[_0x9964('0x2c')](util['format'](_0x9964('0x19b'),_0x273ace[_0x9964('0x34')]));return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x19c'));};AGIVertices[_0x9964('0x17')][_0x9964('0x19d')]=function(_0x3631cb){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x3631cb[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x3631cb[_0x9964('0x19e')])){return this[_0x9964('0xe')]['noop'](_0x9964('0x19f'));}var _0x4dbf83=this[_0x9964('0x2f')][_0x9964('0x6c')](this,_0x3631cb['sms_account_id']);if(!_0x4dbf83){return this[_0x9964('0xe')]['error'](_0x3631cb,'no\x20sms\x20account\x20found');}var _0x5b14cc={'body':_0x3631cb[_0x9964('0x1a0')],'phone':_0x3631cb['to']||'','SmsAccountId':_0x4dbf83['id']};logger[_0x9964('0x196')]('sendSMS\x20message',JSON[_0x9964('0x6f')](_0x5b14cc));this[_0x9964('0x32')][_0x9964('0x6c')](this,_0x3631cb,_0x3631cb[_0x9964('0x19e')]);this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x1a1'),_0x4dbf83[_0x9964('0x16')]));this[_0x9964('0x31')][_0x9964('0x6c')](this,_0x5b14cc);return this[_0x9964('0xe')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x9964('0x17')][_0x9964('0x1a2')]=function(_0x205314){logger[_0x9964('0x2c')](util['format'](_0x9964('0x1a3'),_0x205314[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x205314[_0x9964('0xd5')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x205314,_0x9964('0x1a4'));}var _0x3629fe=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x205314[_0x9964('0xd5')]);if(!_0x3629fe){return this['channel'][_0x9964('0x28')](_0x205314,_0x9964('0xd6'));}return this[_0x9964('0xe')][_0x9964('0x9a')](_0x3629fe,_0x205314[_0x9964('0x1a5')]);};AGIVertices['prototype'][_0x9964('0x1a6')]=function(_0x4a5bbf){logger['info'](util['format'](_0x9964('0x1a7'),_0x4a5bbf['label']));this[_0x9964('0xe')][_0x9964('0xa7')]('START\x20CALLY\x20SQUARE');var _0x34ce44=this[_0x9964('0xe')][_0x9964('0x10')](_0x9964('0x1a8'));if(!_[_0x9964('0x41')](_0x34ce44['extra'])){this['channel'][_0x9964('0x33')]=_0x34ce44[_0x9964('0x9e')];}if(_0x4a5bbf[_0x9964('0xb4')]===_0x9964('0x1a9')){this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x1aa'));return this[_0x9964('0xe')][_0x9964('0xb4')]();}return this[_0x9964('0xe')]['noop'](_0x9964('0x1ab'));};AGIVertices[_0x9964('0x17')][_0x9964('0x1ac')]=function(_0x5a21f3){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x1ad'),_0x5a21f3[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x5a21f3['project_id'])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x5a21f3,_0x9964('0x1ae'));}var _0x98277c=this[_0x9964('0x1af')][_0x9964('0x6c')](this,_0x5a21f3['project_id']);if(!this['isConfigured'](_0x98277c)){return this[_0x9964('0xe')][_0x9964('0x28')](_0x5a21f3,util['format'](_0x9964('0x1b0'),_0x5a21f3[_0x9964('0x1b1')]));}if(_0x98277c===this[_0x9964('0xe')][_0x9964('0x36')]){return this['channel'][_0x9964('0x28')](_0x5a21f3,_0x9964('0x1b2'));}this['createSquareDetailsReport'][_0x9964('0x6c')](this,_0x5a21f3,_0x98277c);var _0x33cd78=this[_0x9964('0xe')]['exec'](_0x9964('0x1b3'),util[_0x9964('0x98')](_0x9964('0x1b4'),config['agi']['host']||_0x9964('0x1b5'),_0x98277c,this[_0x9964('0xe')][_0x9964('0x36')]));if(_0x33cd78['result']===-0x1){return _0x33cd78;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0xbe'),_0x9964('0x1b3'),_0x98277c));};AGIVertices[_0x9964('0x17')][_0x9964('0x1b6')]=function(_0x4a2a33){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x4a2a33['label']));var _0x575a01=this[_0x9964('0x1b7')][_0x9964('0x6c')](this,_0x4a2a33[_0x9964('0xb2')]);this[_0x9964('0x32')]['sync'](this,_0x4a2a33,_0x4a2a33[_0x9964('0xb2')]);if(this['isConfigured'](_0x4a2a33['variable_id'])){var _0x3f7189=this['getVariable'][_0x9964('0x6c')](this,_0x4a2a33[_0x9964('0xd5')]);if(_0x3f7189){this[_0x9964('0xe')][_0x9964('0x9a')](_0x3f7189,_0x575a01);return this['channel'][_0x9964('0xa7')](util['format'](_0x9964('0x1b8'),_0x4a2a33[_0x9964('0xb2')],_0x3f7189));}}return this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0x1b9'),_0x4a2a33[_0x9964('0xb2')]));};AGIVertices[_0x9964('0x17')]['google_cloud_tts']=function(_0x3db5f5){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x1ba'),_0x3db5f5[_0x9964('0x34')]));_0x3db5f5['text']=_0x3db5f5[_0x9964('0x57')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9964('0x83')](_0x3db5f5['apiKey'])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0x1bb'));}if(!this['isConfigured'](_0x3db5f5[_0x9964('0x57')])){return this[_0x9964('0xe')][_0x9964('0xa7')](_0x9964('0xc2'));}this[_0x9964('0xe')]['noop'](util[_0x9964('0x98')](_0x9964('0x1bc'),_0x3db5f5[_0x9964('0x57')]));var _0x4a30f7=this['googleCloudTTS']['sync'](this,_0x3db5f5);if(_0x4a30f7){this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x1bd'),_0x4a30f7));var _0x2161f3=this[_0x9964('0xe')]['streamFile'](_0x4a30f7);try{fs[_0x9964('0xff')](_0x4a30f7+_0x9964('0x100'));}catch(_0x42d2c2){logger[_0x9964('0x28')](_0x42d2c2);}return _0x2161f3;}return this[_0x9964('0xe')][_0x9964('0x28')](_0x3db5f5,_0x9964('0x1be'));};AGIVertices[_0x9964('0x17')][_0x9964('0x1bf')]=function(_0x6ada9a){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x1c0'),_0x6ada9a[_0x9964('0x34')]));_0x6ada9a['text']=_0x6ada9a[_0x9964('0x57')][_0x9964('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9964('0x83')](_0x6ada9a[_0x9964('0x57')])){return this['channel'][_0x9964('0xa7')]('no\x20text\x20configured');}this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x1c1'),_0x6ada9a[_0x9964('0x57')]));var _0x175b70=this[_0x9964('0x5e')][_0x9964('0x6c')](this,_0x6ada9a);if(_0x175b70){this[_0x9964('0xe')][_0x9964('0xa7')](util['format'](_0x9964('0x1c2'),_0x175b70));var _0x159555=this[_0x9964('0xe')]['streamFile'](_0x175b70);try{fs['unlink'](_0x175b70+'.wav');}catch(_0x1daf82){logger[_0x9964('0x28')](_0x1daf82);}return _0x159555;}return this[_0x9964('0xe')][_0x9964('0x28')](_0x6ada9a,_0x9964('0x1c3'));};AGIVertices[_0x9964('0x17')][_0x9964('0x1c4')]=function(_0x1a5649){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x1c5'),_0x1a5649[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x1a5649[_0x9964('0x153')])){return this[_0x9964('0xe')][_0x9964('0x28')](_0x1a5649,_0x9964('0x154'));}logger[_0x9964('0x2c')](util['format'](_0x9964('0x155'),this['channel'][_0x9964('0x37')],_0x1a5649[_0x9964('0x153')]));var _0x1b516b=this['agentUnpause'][_0x9964('0x6c')](this,_0x1a5649[_0x9964('0x153')]);if(_0x1b516b){logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x156'),this[_0x9964('0xe')][_0x9964('0x37')],_0x1a5649[_0x9964('0x153')]));this['channel'][_0x9964('0xa7')](util[_0x9964('0x98')](_0x9964('0x156'),this['channel'][_0x9964('0x37')],_0x1a5649['findBy']));return{'code':0xc8,'result':_0x9964('0x157')};}else{logger[_0x9964('0x2c')](util[_0x9964('0x98')](_0x9964('0x158'),this[_0x9964('0xe')][_0x9964('0x37')],_0x1a5649['findBy']));this[_0x9964('0xe')][_0x9964('0xa7')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9964('0xe')][_0x9964('0x37')],_0x1a5649[_0x9964('0x153')]));return{'code':0xc8,'result':_0x9964('0x159')};}};AGIVertices[_0x9964('0x17')]['voicemail']=function(_0x48c502){logger[_0x9964('0x2c')](util[_0x9964('0x98')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x48c502[_0x9964('0x34')]));var _0x1e6dec=this[_0x9964('0xe')]['exec'](_0x9964('0x1c6'),[_0x48c502[_0x9964('0x1c7')],_0x48c502[_0x9964('0x77')]]);if(_0x1e6dec[_0x9964('0xa6')]===-0x1){return _0x1e6dec;}return this[_0x9964('0xe')][_0x9964('0xa7')](util[_0x9964('0x98')]('Executed\x20command\x20%s\x20%s',_0x9964('0x1c6'),_0x48c502['mailbox']));};AGIVertices[_0x9964('0x17')][_0x9964('0x1c8')]=function(_0x5a9fe9){logger['info'](util['format'](_0x9964('0x1c9'),_0x5a9fe9[_0x9964('0x34')]));if(!this[_0x9964('0x83')](_0x5a9fe9['variable_id'])){return this['channel']['error'](_0x5a9fe9,_0x9964('0x1a4'));}var _0x144ea7=this[_0x9964('0x10')][_0x9964('0x6c')](this,_0x5a9fe9[_0x9964('0xd5')]);if(!_0x144ea7){return this[_0x9964('0xe')][_0x9964('0x28')](_0x5a9fe9,_0x9964('0xd6'));}var _0x4f5681=this[_0x9964('0xe')]['getVariable'](_0x144ea7);return{'code':0xc8,'result':_0x4f5681['extra']?_0x4f5681[_0x9964('0x9e')]:'-'};};String[_0x9964('0x17')]['replaceAll']=function(_0x2110b9,_0x50add4){return this[_0x9964('0x9c')](_0x2110b9)[_0x9964('0x1ca')](_0x50add4);};module[_0x9964('0x1cb')]=AGIVertices; \ No newline at end of file +var _0xf725=['hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','isArray','%s[%s]','variable\x20%s[key]\x20set','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','subject','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','host','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','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','rpc','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','catch','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','key','googleDialogflowV2','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','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','google_asr_language','appid','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','length','replaceAllVariables','saveRestApiResult','isEmpty','%s.%s','setVariable','split','replaceAll','extra','getVariable','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','options','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','getAndSetVariable','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Wait\x20%s\x20seconds\x20before\x20answer','answer','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','dialogflow','Dialogflow\x20Result\x20%s','speech','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','out','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','googleASR','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','Enter\x20in\x20HANGUP\x20(%s)\x20block'];(function(_0x248a43,_0x59e52a){var _0x451379=function(_0x2c5209){while(--_0x2c5209){_0x248a43['push'](_0x248a43['shift']());}};_0x451379(++_0x59e52a);}(_0xf725,0x7e));var _0x5f72=function(_0x526ee,_0x3345bf){_0x526ee=_0x526ee-0x0;var _0x293916=_0xf725[_0x526ee];return _0x293916;};'use strict';var fs=require('fs');var util=require(_0x5f72('0x0'));var _=require(_0x5f72('0x1'));var sh=require(_0x5f72('0x2'));var odbc=require(_0x5f72('0x3'))();var rs=require(_0x5f72('0x4'));var moment=require(_0x5f72('0x5'));var Mustache=require(_0x5f72('0x6'));var rp=require(_0x5f72('0x7'));var logger=require(_0x5f72('0x8'))(_0x5f72('0x9'));var config=require('../../config/environment');var scripts=require(_0x5f72('0xa'));var FILES_PATH=_0x5f72('0xb');var recursiveMapAttributes=[_0x5f72('0xc'),_0x5f72('0xd')];var verticesWithRetry=[_0x5f72('0xe'),_0x5f72('0xf'),_0x5f72('0x10')];var AGIVertices=function(_0x523365,_0x499e28,_0x16de9b){this[_0x5f72('0x11')]=_0x523365;this['rpc']=_0x499e28;this[_0x5f72('0x12')]=_0x16de9b;};AGIVertices[_0x5f72('0x13')]['getVariable']=function(_0x3a3b76,_0x3f4614){this[_0x5f72('0x14')][_0x5f72('0x15')](_0x3a3b76)[_0x5f72('0x16')](function(_0x283d20){_0x3f4614(null,_0x283d20?_0x283d20[_0x5f72('0x17')]:![]);})['catch'](function(_0x1ac591){_0x3f4614(_0x1ac591);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x18')]=function(_0x136591,_0x333d9a){this['rpc'][_0x5f72('0x19')](_0x136591)['then'](function(_0x50f8c8){_0x333d9a(null,_0x50f8c8?_0x50f8c8[_0x5f72('0x17')]:![]);})['catch'](function(_0x3267a){_0x333d9a(_0x3267a);});};AGIVertices['prototype'][_0x5f72('0x1a')]=function(_0x4e0c32,_0x44893b){this[_0x5f72('0x14')]['getSquareProjectById'](_0x4e0c32)[_0x5f72('0x16')](function(_0x276323){_0x44893b(null,_0x276323?_0x276323[_0x5f72('0x17')]:![]);})['catch'](function(_0x490d14){_0x44893b(_0x490d14);});};AGIVertices['prototype'][_0x5f72('0x1b')]=function(_0x36e1a8,_0x269dae){this[_0x5f72('0x14')][_0x5f72('0x1c')](_0x36e1a8)[_0x5f72('0x16')](function(_0x47ec64){_0x269dae(null,_0x47ec64?_0x47ec64['dsn']:![]);})[_0x5f72('0x1d')](function(_0x315b71){_0x269dae(_0x315b71);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x1e')]=function(_0x471a9c,_0x2c599a){this[_0x5f72('0x14')][_0x5f72('0x1f')](_0x471a9c)[_0x5f72('0x16')](function(_0x1d5b00){_0x2c599a(null,_0x1d5b00?_0x1d5b00[_0x5f72('0x17')]:![]);})['catch'](function(_0x433935){_0x2c599a(_0x433935);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x20')]=function(_0xdac9cc,_0x57afb3){this[_0x5f72('0x14')][_0x5f72('0x21')](_0xdac9cc)['then'](function(_0x447019){_0x57afb3(null,_0x447019?_0x447019[_0x5f72('0x17')]:![]);})[_0x5f72('0x1d')](function(_0x521174){_0x57afb3(_0x521174);});};AGIVertices['prototype'][_0x5f72('0x22')]=function(_0xf36295,_0x3936ed){var _0x18374d=this;this[_0x5f72('0x14')][_0x5f72('0x23')](_0xf36295)[_0x5f72('0x16')](function(_0x59af82){_0x3936ed(null,_0x59af82?_0x18374d[_0x5f72('0x24')](_0x59af82['save_name']):![]);})[_0x5f72('0x1d')](function(_0x35fa31){_0x3936ed(_0x35fa31);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x25')]=function(_0xbed98f,_0x5278d9){this['rpc'][_0x5f72('0x26')](_0xbed98f)[_0x5f72('0x16')](function(_0x25ab30){_0x5278d9(null,_0x25ab30?_0x25ab30:![]);})[_0x5f72('0x1d')](function(_0xce2370){_0x5278d9(_0xce2370);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x27')]=function(_0x48912a,_0x4c6909,_0x2d4bbe){this[_0x5f72('0x12')][_0x5f72('0x27')](_0x48912a,_0x4c6909)[_0x5f72('0x16')](function(){_0x2d4bbe(null);})['catch'](function(_0x3fcaa3){_0x2d4bbe(_0x3fcaa3);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x28')]=function(_0x2581df,_0x3a7aaa){this[_0x5f72('0x14')]['getIntervalById'](_0x2581df)['then'](function(_0x11299c){if(_0x11299c){if(_0x11299c[_0x5f72('0x29')]){_0x3a7aaa(null,[_0x11299c['interval']]);}else{_0x3a7aaa(null,_[_0x5f72('0x2a')](_0x11299c[_0x5f72('0x2b')],_0x5f72('0x2c')));}}else{_0x3a7aaa(null,![]);}})[_0x5f72('0x1d')](function(_0x3bec42){_0x3a7aaa(_0x3bec42);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x24')]=function(_0x37c178){return util[_0x5f72('0x2d')](_0x5f72('0x2e'),FILES_PATH,_0x37c178);};AGIVertices[_0x5f72('0x13')][_0x5f72('0x2f')]=function(_0x441633,_0x38d7bd,_0x52fab3){odbc[_0x5f72('0x30')](_0x441633,function(_0x479510){if(_0x479510){logger['error'](_0x5f72('0x31'),_0x479510);_0x52fab3(_0x479510);}else{logger[_0x5f72('0x32')](_0x5f72('0x33'));odbc[_0x5f72('0x34')](_0x38d7bd,function(_0x281168,_0x1da045){if(_0x281168){logger['info'](_0x5f72('0x35'),_0x38d7bd);_0x52fab3(_0x281168);}else{logger[_0x5f72('0x32')](_0x5f72('0x36'),_0x38d7bd);odbc[_0x5f72('0x37')](function(_0x148cd6){if(_0x148cd6){logger[_0x5f72('0x38')](_0x5f72('0x39'),_0x148cd6);}_0x52fab3(null,_0x1da045);});}});}});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x3a')]=function(_0x2b8549,_0x39c2af){this[_0x5f72('0x14')][_0x5f72('0x3b')](_0x2b8549)[_0x5f72('0x16')](function(_0xefdf17){_0x39c2af(null,_0xefdf17?_0xefdf17:![]);})['catch'](function(_0x594bb4){_0x39c2af(_0x594bb4);});};AGIVertices[_0x5f72('0x13')]['createSmsMessage']=function(_0x58508d,_0x3b438f){this[_0x5f72('0x14')]['createSmsMessage'](_0x58508d)[_0x5f72('0x16')](function(_0x42298c){_0x3b438f(null,_0x42298c);})['catch'](function(_0x339890){_0x3b438f(_0x339890);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x3c')]=function(_0xcfefc5,_0x4f57a6,_0x5720d4){this[_0x5f72('0x14')][_0x5f72('0x3c')]({'uniqueid':this[_0x5f72('0x11')][_0x5f72('0x3d')],'node':_0xcfefc5[_0x5f72('0x3e')],'application':_0xcfefc5[_0x5f72('0x3f')],'data':_0x4f57a6||null,'project_name':this[_0x5f72('0x11')]['arg_1'],'callerid':this[_0x5f72('0x11')][_0x5f72('0x40')]})[_0x5f72('0x16')](function(_0x62f48e){if(_0x5720d4){_0x5720d4(null,_0x62f48e);}})['catch'](function(_0x28e912){if(_0x5720d4){_0x5720d4(_0x28e912);}});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x41')]=function(_0x32e530,_0x5a84fe,_0x40d158,_0x160d65){this[_0x5f72('0x14')][_0x5f72('0x41')]({'uniqueid':this['channel'][_0x5f72('0x3d')],'callerid':this[_0x5f72('0x11')]['callerid'],'calleridname':this[_0x5f72('0x11')][_0x5f72('0x42')],'context':this['channel'][_0x5f72('0x43')],'extension':this[_0x5f72('0x11')][_0x5f72('0x44')],'priority':this['channel'][_0x5f72('0x45')],'accountcode':this[_0x5f72('0x11')][_0x5f72('0x46')],'dnid':this[_0x5f72('0x11')]['dnid'],'projectName':this[_0x5f72('0x11')][_0x5f72('0x47')],'saveName':_0x5a84fe,'filename':_0x32e530[_0x5f72('0x48')]||_0x5a84fe,'savePath':_0x40d158})[_0x5f72('0x16')](function(_0x506774){_0x160d65(null,_0x506774);})[_0x5f72('0x1d')](function(_0xff5cb5){_0x160d65(_0xff5cb5);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x49')]=function(_0x4a8bf8,_0x16a452,_0x4de14c,_0x2f1a8f,_0x7dd3){this[_0x5f72('0x14')][_0x5f72('0x49')]({'uniqueid':this[_0x5f72('0x11')][_0x5f72('0x3d')],'body':_0x4a8bf8,'direction':_0x16a452,'providerName':_0x4de14c,'providerResponse':_0x2f1a8f})[_0x5f72('0x16')](function(_0x35116c){if(_0x7dd3){_0x7dd3(null,_0x35116c);}})[_0x5f72('0x1d')](function(_0x1d4a2f){if(_0x7dd3){_0x7dd3(_0x1d4a2f);}});};AGIVertices['prototype'][_0x5f72('0x4a')]=function(_0x1b817f,_0x5c5d94){this[_0x5f72('0x14')][_0x5f72('0x4a')]({'firstName':_['isEmpty'](_0x1b817f[_0x5f72('0x17')])||_[_0x5f72('0x4b')](_0x1b817f[_0x5f72('0x17')])?_0x5f72('0x4c')+Math[_0x5f72('0x4d')]():_0x1b817f['name'],'lastName':_['isEmpty'](_0x1b817f[_0x5f72('0x4e')])||_[_0x5f72('0x4b')](_0x1b817f[_0x5f72('0x4e')])?null:_0x1b817f['lastName'],'phone':_0x1b817f[_0x5f72('0x4f')],'ListId':_0x1b817f[_0x5f72('0x50')],'scheduledat':_0x1b817f[_0x5f72('0x51')],'callbackUniqueid':this['channel'][_0x5f72('0x3d')],'tags':_0x5f72('0x52'),'description':'Callback\x20scheduled\x20at\x20'+_0x1b817f['scheduledAt'][_0x5f72('0x53')](),'priority':_0x1b817f['callback_priority']})['then'](function(_0x2d889c){_0x5c5d94(null,_0x2d889c);})[_0x5f72('0x1d')](function(_0x1b9cab){_0x5c5d94(_0x1b9cab);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x54')]=function(_0xc32b04,_0x38d38a){this['rpc'][_0x5f72('0x55')](_0xc32b04)['then'](function(_0x3b0baf){_0x38d38a(null,_0x3b0baf?_0x3b0baf[_0x5f72('0x17')]:![]);})['catch'](function(_0x4c3930){_0x38d38a(_0x4c3930);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x56')]=function(_0x39036d,_0x167ea7,_0x4c6951){var _0xa9dbb9={'role':_0x5f72('0x57')};_0xa9dbb9[_0x39036d]=this[_0x5f72('0x11')]['callerid'];this[_0x5f72('0x14')][_0x5f72('0x56')](_0xa9dbb9,_0x167ea7,this[_0x5f72('0x11')][_0x5f72('0x3d')])[_0x5f72('0x16')](function(_0x36774e){_0x4c6951(null,_[_0x5f72('0x4b')](_0x36774e)?![]:!![]);})[_0x5f72('0x1d')](function(_0x1cc153){logger[_0x5f72('0x38')](_0x1cc153);_0x4c6951(null,![]);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x58')]=function(_0x56bfa2,_0x2545fd){var _0x343d19={'role':_0x5f72('0x57')};_0x343d19[_0x56bfa2]=this[_0x5f72('0x11')][_0x5f72('0x40')];this[_0x5f72('0x14')]['agentUnpause'](_0x343d19)[_0x5f72('0x16')](function(_0x46596f){_0x2545fd(null,_[_0x5f72('0x4b')](_0x46596f)?![]:!![]);})[_0x5f72('0x1d')](function(_0x559877){logger[_0x5f72('0x38')](_0x559877);_0x2545fd(null,![]);});};AGIVertices['prototype'][_0x5f72('0x59')]=function(_0x4665c8,_0x1380fb){var _0x6b865d={'role':'agent'};_0x6b865d[_0x4665c8]=this[_0x5f72('0x11')][_0x5f72('0x40')];this[_0x5f72('0x14')][_0x5f72('0x59')](_0x6b865d)['then'](function(_0x50bd1a){_0x1380fb(null,_[_0x5f72('0x4b')](_0x50bd1a)?![]:!![]);})['catch'](function(_0x4b6a90){logger[_0x5f72('0x38')](_0x4b6a90);_0x1380fb(null,![]);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x5a')]=function(_0x5e1686,_0x318717){var _0x1801d7={'role':_0x5f72('0x57')};_0x1801d7[_0x5e1686]=this[_0x5f72('0x11')][_0x5f72('0x40')];var _0xeed004=_0x5e1686!=_0x5f72('0x5b')?util[_0x5f72('0x2d')](_0x5f72('0x5c'),_0x5f72('0x5d'),this[_0x5f72('0x11')][_0x5f72('0x40')]):undefined;this[_0x5f72('0x14')]['agentLogin'](_0x1801d7,_0xeed004)[_0x5f72('0x16')](function(_0x21d978){_0x318717(null,_[_0x5f72('0x4b')](_0x21d978)?![]:!![]);})['catch'](function(_0x2a0cfc){logger['error'](_0x2a0cfc);_0x318717(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x5ca842,_0x49d3d7){sh[_0x5f72('0x5e')](_['trim'](_0x5ca842),function(_0x551736,_0x2a846b){var _0x2404fd=_0x2a846b[_0x5f72('0x5f')](/(\r\n|\n|\r)/gm,'');_0x49d3d7(null,_0x2404fd);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x60')]=function(_0x3352c5,_0x25ed96){scripts[_0x5f72('0x60')](_0x3352c5['apiKey'],_0x3352c5[_0x5f72('0x61')]||_0x5f72('0x62'),_0x3352c5[_0x5f72('0x62')],_0x3352c5[_0x5f72('0x63')]||_0x5f72('0x64'),_0x3352c5[_0x5f72('0x65')]||_0x5f72('0x66'),_0x3352c5[_0x5f72('0x67')]||_0x5f72('0x68'))[_0x5f72('0x16')](function(_0x18e110){_0x25ed96(null,_0x18e110);})[_0x5f72('0x1d')](function(_0x6a5a6c){_0x25ed96(_0x6a5a6c);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x69')]=function(_0x5d3dd5,_0x164fba){scripts[_0x5f72('0x69')](_0x5d3dd5[_0x5f72('0x62')],_0x5d3dd5['google_tts_language']||'en',0x1)[_0x5f72('0x16')](function(_0x492c93){_0x164fba(null,_0x492c93);})[_0x5f72('0x1d')](function(_0x16e71a){_0x164fba(_0x16e71a);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x6a')]=function(_0x4ee2f6,_0x8886b4){var _0x1145a1={'uri':_0x4ee2f6['url'],'method':_0x4ee2f6[_0x5f72('0x6b')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4ee2f6[_0x5f72('0x6c')])===_0x5f72('0x6d')&&parseInt(_0x4ee2f6[_0x5f72('0x6c')])>=0x1?parseInt(_0x4ee2f6[_0x5f72('0x6c')])*0x3e8:0x5*0x3e8};if(_[_0x5f72('0x6e')]([_0x5f72('0x6f'),_0x5f72('0x70')],_0x1145a1['method'][_0x5f72('0x71')]())){try{_0x1145a1[_0x5f72('0x72')]=_0x4ee2f6[_0x5f72('0xd')]?JSON[_0x5f72('0x73')](_0x4ee2f6[_0x5f72('0xd')]):{};}catch(_0x19281a){logger[_0x5f72('0x38')](_0x5f72('0x74'),_0x19281a);}}try{_0x1145a1['headers']=_0x4ee2f6[_0x5f72('0xc')]?JSON[_0x5f72('0x73')](_0x4ee2f6[_0x5f72('0xc')]):{};}catch(_0x4fc610){logger[_0x5f72('0x38')](_0x5f72('0x75'),_0x4fc610);}if(_0x4ee2f6[_0x5f72('0x76')]){try{var _0x54b9cd=require(_0x4ee2f6[_0x5f72('0x76')])[_0x5f72('0x77')](this,_0x1145a1);_0x1145a1[_0x5f72('0x78')]=Mustache[_0x5f72('0x79')](_0x4ee2f6[_0x5f72('0x7a')],_0x54b9cd,{},['$$','$$']);if(_0x1145a1[_0x5f72('0x7b')]){_0x1145a1[_0x5f72('0x7b')]=JSON['parse'](Mustache['render'](JSON['stringify'](_0x1145a1['headers']),_0x54b9cd,{},['$$','$$']));}if(_0x1145a1['body']){_0x1145a1[_0x5f72('0x72')]=JSON['parse'](Mustache[_0x5f72('0x79')](JSON[_0x5f72('0x7c')](_0x1145a1[_0x5f72('0x72')]),_0x54b9cd,{},['$$','$$']));}}catch(_0x38a654){logger[_0x5f72('0x38')](_0x5f72('0x7d'),_0x38a654);}}rp(_0x1145a1)[_0x5f72('0x16')](function(_0xa154bb){var _0x3d7eee={'statusCode':_0xa154bb[_0x5f72('0x7e')]||0xc8,'statusMessage':_0xa154bb[_0x5f72('0x7f')]||'OK','headers':_0xa154bb['headers']||{},'body':_0xa154bb[_0x5f72('0x72')]||{}};_0x8886b4(null,_0x3d7eee);})[_0x5f72('0x1d')](function(_0x3b56db){var _0x39c3bd={'statusCode':_0x3b56db['statusCode']||0x1f4,'statusMessage':_0x3b56db[_0x5f72('0x80')]||_0x5f72('0x81'),'headers':_0x3b56db['options']['headers']||{},'body':_0x3b56db['options'][_0x5f72('0x72')]||{}};_0x8886b4(null,_0x39c3bd);});};AGIVertices['prototype']['googleDialogflow']=function(_0x5cd8dc,_0x170c22){scripts['googleDialogflow'](this[_0x5f72('0x11')]['uniqueid'],_0x5cd8dc[_0x5f72('0x82')],_0x5cd8dc[_0x5f72('0x62')],_0x5cd8dc['dialogflow_language']||'en')[_0x5f72('0x16')](function(_0x56a6a7){_0x170c22(null,_0x56a6a7);})['catch'](function(_0x2b4411){_0x170c22(_0x2b4411);});};AGIVertices['prototype'][_0x5f72('0x83')]=function(_0x5666eb,_0x5b1a94){scripts['googleDialogflowV2'](this[_0x5f72('0x11')]['uniqueid'],_0x5666eb['dialogflowV2_project_id'],_0x5666eb['client_email'],_0x5666eb['private_key'],_0x5666eb[_0x5f72('0x62')],_0x5666eb[_0x5f72('0x84')]||'en')[_0x5f72('0x16')](function(_0x2722e0){_0x5b1a94(null,_0x2722e0);})['catch'](function(_0x58232f){_0x5b1a94(_0x58232f);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x85')]=function(_0x162139,_0x1bf453){scripts['sestekNDA'](this[_0x5f72('0x11')],_0x162139)[_0x5f72('0x16')](function(_0x552bb9){_0x1bf453(null,_0x552bb9);})[_0x5f72('0x1d')](function(_0x12e4c3){_0x1bf453(_0x12e4c3);});};AGIVertices['prototype'][_0x5f72('0x86')]=function(_0x7c0325,_0x4357b0){scripts[_0x5f72('0x86')](_0x7c0325['key'],_0x7c0325['text'],_0x7c0325[_0x5f72('0x87')]||_0x5f72('0x64'),_0x7c0325['speed'])['then'](function(_0x3ee9be){_0x4357b0(null,_0x3ee9be);})[_0x5f72('0x1d')](function(_0x5b25de){_0x4357b0(_0x5b25de);});};AGIVertices['prototype']['ispeechASR']=function(_0x2fd743,_0x214b42,_0x348f8b){scripts[_0x5f72('0x88')](_0x214b42,_0x2fd743['key'],_0x2fd743[_0x5f72('0x89')]||_0x5f72('0x64'),this[_0x5f72('0x8a')](_0x2fd743[_0x5f72('0x8b')])?_0x2fd743[_0x5f72('0x8b')]:undefined)[_0x5f72('0x16')](function(_0x6e945a){_0x348f8b(null,_0x6e945a);})['catch'](function(_0x2697e0){_0x348f8b(_0x2697e0);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x8c')]=function(_0x71e01e,_0x48fcb5){scripts[_0x5f72('0x8c')](_0x71e01e[_0x5f72('0x8d')],_0x71e01e[_0x5f72('0x8e')],_0x71e01e[_0x5f72('0x8f')],_0x71e01e[_0x5f72('0x90')]||_0x5f72('0x91'),_0x71e01e[_0x5f72('0x62')],_0x71e01e['aws_text_type']||_0x5f72('0x62'))[_0x5f72('0x16')](function(_0x69d056){_0x48fcb5(null,_0x69d056);})[_0x5f72('0x1d')](function(_0x80d5bd){_0x48fcb5(_0x80d5bd);});};AGIVertices[_0x5f72('0x13')][_0x5f72('0x92')]=function(_0x4aad69,_0x10f3f8){scripts[_0x5f72('0x92')](this['channel'][_0x5f72('0x3d')],_0x4aad69['aws_access_key_id'],_0x4aad69[_0x5f72('0x8e')],_0x4aad69[_0x5f72('0x93')],_0x4aad69[_0x5f72('0x62')],_0x4aad69[_0x5f72('0x94')])[_0x5f72('0x16')](function(_0x3c6243){_0x10f3f8(null,_0x3c6243);})[_0x5f72('0x1d')](function(_0x516a6c){_0x10f3f8(_0x516a6c);});};AGIVertices['prototype']['googleASR']=function(_0x4123d9,_0xe9589,_0x166e1c){scripts['googleASR'](_0xe9589,_0x4123d9[_0x5f72('0x82')],_0x4123d9[_0x5f72('0x95')]||'en-US')['then'](function(_0x22a5ed){_0x166e1c(null,_0x22a5ed);})['catch'](function(_0x52de22){_0x166e1c(_0x52de22);});};AGIVertices[_0x5f72('0x13')]['tildeASR']=function(_0x61951a,_0x42ba29,_0x12fc33){scripts['tildeASR'](_0x42ba29,_0x61951a[_0x5f72('0x96')],_0x61951a[_0x5f72('0x97')],_0x61951a[_0x5f72('0x78')])[_0x5f72('0x16')](function(_0x5de456){_0x12fc33(null,_0x5de456);})['catch'](function(_0x5e6c2d){_0x12fc33(_0x5e6c2d);});};AGIVertices['prototype']['clear']=function(_0x2e5c8b){var _0x4781cd=_[_0x5f72('0x6e')](verticesWithRetry,_0x2e5c8b[_0x5f72('0x3f')])?_0x2e5c8b:_[_0x5f72('0x98')](_0x2e5c8b);for(var _0x20b398 in _0x4781cd){if(_0x4781cd[_0x5f72('0x99')](_0x20b398)){if(_0x4781cd[_0x20b398]&&_[_0x5f72('0x9a')](_0x4781cd[_0x20b398])){if(_[_0x5f72('0x6e')](recursiveMapAttributes,_0x20b398)){_0x4781cd[_0x20b398]=this[_0x5f72('0x9b')](_0x4781cd[_0x20b398]);}else{_0x4781cd[_0x20b398]=this['replaceAllVariables'](_0x4781cd[_0x20b398]);}}}}return _0x4781cd;};AGIVertices['prototype'][_0x5f72('0x9c')]=function(_0x11b286){for(var _0x49c211 in _0x11b286){if(_0x11b286[_0x5f72('0x99')](_0x49c211)){if(_[_0x5f72('0x9d')](_0x11b286[_0x49c211])){this[_0x5f72('0x9c')](_0x11b286[_0x49c211]);}else if(_['isArray'](_0x11b286[_0x49c211])){for(var _0x2bfc8d=0x0;_0x2bfc8d<_0x11b286[_0x49c211][_0x5f72('0x9e')];_0x2bfc8d++){this[_0x5f72('0x9c')](_0x11b286[_0x49c211][_0x2bfc8d]);}}else if(_[_0x5f72('0x9a')](_0x11b286[_0x49c211])){_0x11b286[_0x49c211]=this[_0x5f72('0x9f')](_0x11b286[_0x49c211]);}}}};AGIVertices['prototype'][_0x5f72('0xa0')]=function(_0x122fea,_0x28e334){for(var _0x16eeaa in _0x122fea){if(_0x122fea['hasOwnProperty'](_0x16eeaa)){if(_[_0x5f72('0x9d')](_0x122fea[_0x16eeaa])){if(!_[_0x5f72('0xa1')](_0x122fea[_0x16eeaa])){this[_0x5f72('0xa0')](_0x122fea[_0x16eeaa],util['format']('%s.%s',_0x28e334,_0x16eeaa));}}else if(_['isArray'](_0x122fea[_0x16eeaa])){for(var _0x1a23b3=0x0;_0x1a23b3<_0x122fea[_0x16eeaa][_0x5f72('0x9e')];_0x1a23b3++){this['saveRestApiResult'](_0x122fea[_0x16eeaa][_0x1a23b3],util['format'](_0x5f72('0xa2'),_0x28e334,_0x16eeaa+'['+_0x1a23b3+']'));}}else{if(!_[_0x5f72('0x4b')](_0x122fea[_0x16eeaa])){this[_0x5f72('0x11')][_0x5f72('0xa3')](util[_0x5f72('0x2d')]('%s.%s',_0x28e334,_0x16eeaa),_0x122fea[_0x16eeaa]);}}}}};AGIVertices[_0x5f72('0x13')][_0x5f72('0x9b')]=function(_0xd324f4){try{var _0x59633c=JSON[_0x5f72('0x73')](_0xd324f4);this['recursiveNodeIndex'](_0x59633c);return JSON[_0x5f72('0x7c')](_0x59633c);}catch(_0x188c0e){return this[_0x5f72('0x9f')](_0xd324f4);}};AGIVertices[_0x5f72('0x13')][_0x5f72('0x9f')]=function(_0x3a1834){var _0x11c846=_0x3a1834[_0x5f72('0xa4')]('{');for(var _0x50c3c8=0x1;_0x50c3c8<_0x11c846[_0x5f72('0x9e')];_0x50c3c8+=0x1){var _0x582da0=_0x11c846[_0x50c3c8][_0x5f72('0xa4')]('}');if(_0x582da0[_0x5f72('0x9e')]>0x1){_0x3a1834=_0x3a1834[_0x5f72('0xa5')]('{'+_0x582da0[0x0]+'}',this['channel']['getVariable'](_0x582da0[0x0])[_0x5f72('0xa6')]||_0x582da0[0x0]);}}if(_0x11c846['length']===0x1){return _0x3a1834[_0x5f72('0x53')]();}return this[_0x5f72('0x9f')](_0x3a1834);};AGIVertices['prototype']['getAndSetVariable']=function(_0x9d0259,_0x266204){var _0x5587a3=this[_0x5f72('0x11')][_0x5f72('0xa7')](_0x9d0259);if(_0x5587a3['result']===-0x1){return _0x5587a3;}logger[_0x5f72('0x32')](util[_0x5f72('0x2d')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x266204,_0x5587a3[_0x5f72('0xa6')]));return this[_0x5f72('0x11')][_0x5f72('0xa3')](_0x266204,_0x5587a3[_0x5f72('0xa6')]);};AGIVertices['prototype'][_0x5f72('0x8a')]=function(_0x180f4f){return _0x180f4f&&_0x180f4f!=='0'&&_0x180f4f!=='-1'&&_0x180f4f!=='';};AGIVertices[_0x5f72('0x13')][_0x5f72('0xa8')]=function(_0x24a65c){this['createSquareDetailsReport'][_0x5f72('0x77')](this,_0x24a65c,'-');_0x24a65c[_0x5f72('0xa9')]=_0x24a65c['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x2898b3){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0xaa'),_0x2898b3[_0x5f72('0x3e')]));if(!this['isConfigured'](_0x2898b3['text'])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0xac'));}var _0x4bbdc6='\x22'+_0x2898b3['text']+'\x22';if(this[_0x5f72('0x8a')](_0x2898b3[_0x5f72('0xad')])){_0x4bbdc6+=','+_0x2898b3[_0x5f72('0xad')];}var _0x1525fa=this[_0x5f72('0x11')][_0x5f72('0x5e')]('MRCPSynth',_0x4bbdc6);if(_0x1525fa[_0x5f72('0xae')]===-0x1){return _0x1525fa;}return this[_0x5f72('0x11')]['noop'](util[_0x5f72('0x2d')](_0x5f72('0xaf'),_0x4bbdc6));};AGIVertices[_0x5f72('0x13')][_0x5f72('0xb0')]=function(_0x4e7f9c){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0xb1'),_0x4e7f9c[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0x4e7f9c[_0x5f72('0xb2')])){return this[_0x5f72('0x11')][_0x5f72('0xab')]('no\x20grammar\x20configured');}var _0x40f31b=_0x4e7f9c[_0x5f72('0xb2')];if(this[_0x5f72('0x8a')](_0x4e7f9c['options'])){_0x40f31b+=','+_0x4e7f9c[_0x5f72('0xad')];}var _0x36445c=this[_0x5f72('0x11')][_0x5f72('0x5e')](_0x5f72('0xb3'),_0x40f31b);if(_0x36445c['result']===-0x1){return _0x36445c;}var _0x2c0ecf=this[_0x5f72('0xb4')]('RECOG_CONFIDENCE()',_0x5f72('0xb5'));if(_0x2c0ecf[_0x5f72('0xae')]===-0x1){return _0x2c0ecf;}var _0x4691e9=this[_0x5f72('0xb4')]('RECOG_INPUT()',_0x5f72('0xb6'));if(_0x4691e9[_0x5f72('0xae')]===-0x1){return _0x4691e9;}var _0x327bd7=this['getAndSetVariable'](_0x5f72('0xb7'),_0x5f72('0xb8'));if(_0x327bd7[_0x5f72('0xae')]===-0x1){return _0x327bd7;}return this[_0x5f72('0x11')]['noop'](util[_0x5f72('0x2d')]('Executed\x20command\x20MRCPRecog\x20%s',_0x40f31b));};AGIVertices[_0x5f72('0x13')][_0x5f72('0x9')]=function(_0x23daa6){logger[_0x5f72('0x32')](util['format'](_0x5f72('0xb9'),_0x23daa6[_0x5f72('0x3e')]));return this[_0x5f72('0x11')][_0x5f72('0x9')]([_0x23daa6[_0x5f72('0xba')],_0x23daa6[_0x5f72('0xbb')]]);};AGIVertices[_0x5f72('0x13')]['answer']=function(_0x38a244){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x38a244[_0x5f72('0x3e')]));if(this[_0x5f72('0x8a')](_0x38a244[_0x5f72('0x6c')])){logger['info'](util[_0x5f72('0x2d')](_0x5f72('0xbc'),_0x38a244[_0x5f72('0x6c')]));var _0x5a5964=this[_0x5f72('0x11')]['wait'](_0x38a244[_0x5f72('0x6c')]);if(_0x5a5964[_0x5f72('0xae')]===-0x1){return _0x5a5964;}}return this['channel'][_0x5f72('0xbd')]();};AGIVertices['prototype'][_0x5f72('0x52')]=function(_0x49cf65){logger['info'](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x49cf65[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0x49cf65[_0x5f72('0x50')])){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x49cf65,_0x5f72('0xbe'));}_0x49cf65[_0x5f72('0x51')]=moment();if(this['isConfigured'](_0x49cf65[_0x5f72('0xbf')])){_0x49cf65[_0x5f72('0x51')]=moment()[_0x5f72('0xc0')](_0x49cf65[_0x5f72('0xbf')],_0x5f72('0xc1'));}if(!this[_0x5f72('0x8a')](_0x49cf65[_0x5f72('0xc2')])){_0x49cf65[_0x5f72('0xc2')]=0x2;}this['createCmContact']['sync'](this,_0x49cf65);return this[_0x5f72('0x11')]['noop'](util[_0x5f72('0x2d')](_0x5f72('0xc3'),_0x49cf65[_0x5f72('0x4f')],_0x49cf65[_0x5f72('0x50')],_0x49cf65[_0x5f72('0x51')]));};AGIVertices[_0x5f72('0x13')][_0x5f72('0xc4')]=function(_0x431927){logger['info'](util[_0x5f72('0x2d')](_0x5f72('0xc5'),_0x431927[_0x5f72('0x3e')]));var _0x28bd0d=this['channel'][_0x5f72('0x5e')](_0x431927['application'],_0x431927[_0x5f72('0xad')]);if(_0x28bd0d['result']===-0x1){return _0x28bd0d;}return this[_0x5f72('0x11')][_0x5f72('0xab')](util['format'](_0x5f72('0xc6'),_0x431927['application'],_0x431927[_0x5f72('0xad')]));};AGIVertices['prototype'][_0x5f72('0xc7')]=function(_0x3634f7){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0xc8'),_0x3634f7[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0x3634f7['text'])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0xac'));}var _0x218a6c='\x22'+_0x3634f7[_0x5f72('0x62')]+'\x22';if(this[_0x5f72('0x8a')](_0x3634f7[_0x5f72('0xad')])){_0x218a6c+=','+_0x3634f7[_0x5f72('0xad')];}var _0x3c6ebf=this[_0x5f72('0x11')][_0x5f72('0x5e')](_0x5f72('0xc9'),_0x218a6c);if(_0x3c6ebf[_0x5f72('0xae')]===-0x1){return _0x3c6ebf;}return this[_0x5f72('0x11')]['noop'](util[_0x5f72('0x2d')](_0x5f72('0xaf'),_0x218a6c));};AGIVertices['prototype']['sestektts']=function(_0x24918d){logger[_0x5f72('0x32')](util['format'](_0x5f72('0xca'),_0x24918d['label']));if(!this[_0x5f72('0x8a')](_0x24918d[_0x5f72('0x62')])){return this[_0x5f72('0x11')]['noop'](_0x5f72('0xac'));}var _0x1c8278='\x22'+_0x24918d[_0x5f72('0x62')]+'\x22';if(this[_0x5f72('0x8a')](_0x24918d[_0x5f72('0xad')])){_0x1c8278+=','+_0x24918d[_0x5f72('0xad')];}var _0x2f2fda=this[_0x5f72('0x11')][_0x5f72('0x5e')](_0x5f72('0xc9'),_0x1c8278);if(_0x2f2fda[_0x5f72('0xae')]===-0x1){return _0x2f2fda;}return this['channel'][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0xaf'),_0x1c8278));};AGIVertices[_0x5f72('0x13')]['lumenvoxasr']=function(_0x1df638){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0xcb'),_0x1df638[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0x1df638[_0x5f72('0xb2')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0xcc'));}var _0x1ec112=_0x1df638['grammar'];if(this['isConfigured'](_0x1df638['options'])){_0x1ec112+=','+_0x1df638[_0x5f72('0xad')];}var _0x5a427f=this[_0x5f72('0x11')][_0x5f72('0x5e')](_0x5f72('0xb3'),_0x1ec112);if(_0x5a427f['result']===-0x1){return _0x5a427f;}var _0x1235ca=this['getAndSetVariable'](_0x5f72('0xcd'),_0x5f72('0xce'));if(_0x1235ca[_0x5f72('0xae')]===-0x1){return _0x1235ca;}var _0x3e1f6f=this['getAndSetVariable']('RECOG_INPUT()',_0x5f72('0xcf'));if(_0x3e1f6f['result']===-0x1){return _0x3e1f6f;}var _0x110f4b=this[_0x5f72('0xb4')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x110f4b[_0x5f72('0xae')]===-0x1){return _0x110f4b;}return this[_0x5f72('0x11')][_0x5f72('0xab')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1ec112));};AGIVertices[_0x5f72('0x13')][_0x5f72('0xd0')]=function(_0x572d7f){logger['info'](util['format'](_0x5f72('0xd1'),_0x572d7f[_0x5f72('0x3e')]));if(!this['isConfigured'](_0x572d7f[_0x5f72('0xb2')])){return this[_0x5f72('0x11')]['noop']('no\x20grammar\x20configured');}var _0x3b9dd0=_0x572d7f[_0x5f72('0xb2')];if(this[_0x5f72('0x8a')](_0x572d7f[_0x5f72('0xad')])){_0x3b9dd0+=','+_0x572d7f[_0x5f72('0xad')];}var _0xa14494=this['channel'][_0x5f72('0x5e')](_0x5f72('0xb3'),_0x3b9dd0);if(_0xa14494[_0x5f72('0xae')]===-0x1){return _0xa14494;}var _0x23c09c=this['getAndSetVariable'](_0x5f72('0xcd'),'SESTEK_ASR_CONFIDENCE');if(_0x23c09c[_0x5f72('0xae')]===-0x1){return _0x23c09c;}var _0x10a642=this[_0x5f72('0xb4')](_0x5f72('0xd2'),_0x5f72('0xd3'));if(_0x10a642[_0x5f72('0xae')]===-0x1){return _0x10a642;}var _0x20d01c=this['getAndSetVariable'](_0x5f72('0xb7'),_0x5f72('0xd4'));if(_0x20d01c[_0x5f72('0xae')]===-0x1){return _0x20d01c;}return this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0xd5'),_0x3b9dd0));};AGIVertices[_0x5f72('0x13')][_0x5f72('0xd6')]=function(_0x109177){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0xd7'),_0x109177[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0x109177['odbc_id'])){return this['channel'][_0x5f72('0x38')](_0x109177,_0x5f72('0xd8'));}var _0x208143=this[_0x5f72('0x1b')][_0x5f72('0x77')](this,_0x109177[_0x5f72('0xd9')]);if(!_0x208143){return this['channel']['error'](_0x109177,_0x5f72('0xda'));}if(!this[_0x5f72('0x8a')](_0x109177[_0x5f72('0x34')])){return this[_0x5f72('0x11')]['error'](_0x109177,'no\x20query\x20configured');}var _0x2b9bf8=_0x109177[_0x5f72('0x34')][_0x5f72('0x5f')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0xdb'),_0x2b9bf8));var _0x1e019c=this[_0x5f72('0x2f')]['sync'](this,_0x208143,_0x2b9bf8);this[_0x5f72('0x3c')][_0x5f72('0x77')](this,_0x109177,_0x2b9bf8);if(!this[_0x5f72('0x8a')](_0x109177[_0x5f72('0xdc')])){return this['channel'][_0x5f72('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5e1a07=this[_0x5f72('0xa7')][_0x5f72('0x77')](this,_0x109177[_0x5f72('0xdc')]);if(!_0x5e1a07){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x109177,'no\x20variable\x20found');}var _0x50aa1b=this;_0x1e019c[_0x5f72('0xdd')](function(_0x1d149c,_0x4d18b4){Object['keys'](_0x1d149c)[_0x5f72('0xdd')](function(_0x44286c){_0x50aa1b[_0x5f72('0x11')]['setVariable'](util['format'](_0x5f72('0xde'),_0x5e1a07,_0x4d18b4,_0x44286c),_0x1d149c[_0x44286c]);});});this[_0x5f72('0x11')][_0x5f72('0xa3')](util['format'](_0x5f72('0xdf'),_0x5e1a07),_0x1e019c[_0x5f72('0x9e')]);return this[_0x5f72('0x11')][_0x5f72('0xab')](util['format'](_0x5f72('0xe0'),_0x5e1a07));};AGIVertices[_0x5f72('0x13')][_0x5f72('0xe1')]=function(_0x54d6da){logger['debug'](util['format'](_0x5f72('0xe2'),_0x54d6da['label']));if(!this['isConfigured'](_0x54d6da['sip_id'])){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x54d6da,'no\x20user\x20selected');}var _0x3655de=this[_0x5f72('0x1e')]['sync'](this,_0x54d6da[_0x5f72('0xe3')]);if(!_0x3655de){return this['channel'][_0x5f72('0x38')](_0x54d6da,_0x5f72('0xe4'));}var _0x5233a=this[_0x5f72('0x11')][_0x5f72('0x5e')](_0x5f72('0xe5'),[util[_0x5f72('0x2d')](_0x5f72('0xe6'),_0x3655de),_0x54d6da['timeout'],_0x54d6da[_0x5f72('0xe7')],_0x54d6da['url']]);if(_0x5233a[_0x5f72('0xae')]===-0x1){return _0x5233a;}return this['channel'][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0xe8'),_0x5f72('0xe5')));};AGIVertices[_0x5f72('0x13')]['dialogflow']=function(_0x5eb8f3){logger['info'](util[_0x5f72('0x2d')](_0x5f72('0xe9'),_0x5eb8f3[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0x5eb8f3[_0x5f72('0x82')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0xea'));}if(!this[_0x5f72('0x8a')](_0x5eb8f3[_0x5f72('0x62')])){return this['channel']['noop'](_0x5f72('0xac'));}this[_0x5f72('0x11')][_0x5f72('0xeb')]=!![];this[_0x5f72('0x3c')](_0x5eb8f3);this[_0x5f72('0x49')](_0x5eb8f3[_0x5f72('0x62')],'in','','');this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0xec'),_0x5eb8f3[_0x5f72('0x62')]));var _0x2658e1=this['googleDialogflow'][_0x5f72('0x77')](this,_0x5eb8f3);if(_0x2658e1){for(var _0x797437 in _0x2658e1){if(_0x2658e1[_0x5f72('0x99')](_0x797437)){this[_0x5f72('0x11')]['setVariable'](util[_0x5f72('0x2d')](_0x5f72('0xed'),_0x797437['toUpperCase']()),_0x2658e1[_0x797437]);}}this['createSquareMessage'](_0x2658e1['speech'],'out',_0x5f72('0xee'),'');return this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0xef'),_0x2658e1[_0x5f72('0xf0')]));}return this['channel'][_0x5f72('0x38')](_0x5eb8f3,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x5f72('0x13')][_0x5f72('0xf1')]=function(_0x18149c){logger['info'](util[_0x5f72('0x2d')](_0x5f72('0xf2'),_0x18149c[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0x18149c[_0x5f72('0xf3')])){return this['channel'][_0x5f72('0xab')]('no\x20project_id\x20configured');}if(!this[_0x5f72('0x8a')](_0x18149c['client_email'])){return this[_0x5f72('0x11')]['noop'](_0x5f72('0xf4'));}if(!this[_0x5f72('0x8a')](_0x18149c[_0x5f72('0xf5')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0xf6'));}if(!this[_0x5f72('0x8a')](_0x18149c[_0x5f72('0x84')])){return this['channel']['noop'](_0x5f72('0xf7'));}if(!this[_0x5f72('0x8a')](_0x18149c[_0x5f72('0x62')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0xac'));}this[_0x5f72('0x11')][_0x5f72('0xeb')]=!![];this['createSquareDetailsReport'](_0x18149c);this[_0x5f72('0x49')](_0x18149c[_0x5f72('0x62')],'in','','');this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')]('Trying\x20DialogflowV2:\x20%s',_0x18149c[_0x5f72('0x62')]));var _0x2b03dd=this[_0x5f72('0x83')]['sync'](this,_0x18149c);if(_0x2b03dd){for(var _0x2d7f99 in _0x2b03dd){if(_0x2b03dd['hasOwnProperty'](_0x2d7f99)){if(_0x2d7f99!=='providerResponse'){this['channel']['setVariable'](util[_0x5f72('0x2d')](_0x5f72('0xed'),_0x2d7f99['toUpperCase']()),_0x2b03dd[_0x2d7f99]);}}}this[_0x5f72('0x49')](_0x2b03dd[_0x5f72('0xf0')],_0x5f72('0xf8'),_0x5f72('0xf1'),_0x2b03dd[_0x5f72('0xf9')]);return this[_0x5f72('0x11')]['noop'](util[_0x5f72('0x2d')]('DialogflowV2\x20Result\x20%s',_0x2b03dd[_0x5f72('0xf0')]));}return this[_0x5f72('0x11')]['error'](_0x18149c,_0x5f72('0xfa'));};AGIVertices['prototype'][_0x5f72('0xfb')]=function(_0x1a07b5){logger['info'](util[_0x5f72('0x2d')](_0x5f72('0xfc'),_0x1a07b5[_0x5f72('0x3e')]));if(!this['isConfigured'](_0x1a07b5[_0x5f72('0xfd')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0xfe'));}if(!this[_0x5f72('0x8a')](_0x1a07b5[_0x5f72('0xff')])){return this['channel'][_0x5f72('0xab')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x1a07b5[_0x5f72('0x100')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0x101'));}if(!this[_0x5f72('0x8a')](_0x1a07b5[_0x5f72('0x102')])){return this['channel']['noop'](_0x5f72('0xac'));}this[_0x5f72('0x11')][_0x5f72('0xeb')]=!![];this[_0x5f72('0x3c')](_0x1a07b5);this[_0x5f72('0x49')](_0x1a07b5[_0x5f72('0x62')],'in','','');this[_0x5f72('0x11')][_0x5f72('0xab')](util['format'](_0x5f72('0x103'),_0x1a07b5[_0x5f72('0x62')]));var _0x4d83c6=this[_0x5f72('0x85')][_0x5f72('0x77')](this,_0x1a07b5);if(_0x4d83c6){for(var _0x40ed22 in _0x4d83c6){if(_0x4d83c6[_0x5f72('0x99')](_0x40ed22)){this[_0x5f72('0x11')]['setVariable'](util['format']('SESTEK_NDA_%s',_0x40ed22[_0x5f72('0x71')]()),_0x4d83c6[_0x40ed22]);}}this['createSquareMessage'](_0x4d83c6[_0x5f72('0xf0')],_0x5f72('0xf8'),_0x5f72('0xfb'),'');if(_0x4d83c6[_0x5f72('0x104')]){this[_0x5f72('0x11')]['noop'](util[_0x5f72('0x2d')](_0x5f72('0x105'),_0x4d83c6['audiofile']));var _0x9681ae=this['channel'][_0x5f72('0x106')](_0x4d83c6[_0x5f72('0x104')]);try{fs[_0x5f72('0x107')](_0x4d83c6[_0x5f72('0x104')]+'.wav');}catch(_0x37ea9a){logger['error'](_0x37ea9a);}return _0x9681ae;}else{return this['channel'][_0x5f72('0xab')](util[_0x5f72('0x2d')]('SestekNDA\x20Result\x20%s',_0x4d83c6[_0x5f72('0xf0')]));}}return this[_0x5f72('0x11')]['error'](_0x1a07b5,_0x5f72('0x108'));};AGIVertices[_0x5f72('0x13')]['end']=function(_0x520e42){logger['info'](util[_0x5f72('0x2d')](_0x5f72('0x109'),_0x520e42['label']));return this['channel'][_0x5f72('0xab')](_0x5f72('0x10a'));};AGIVertices[_0x5f72('0x13')]['ext_dial']=function(_0x450b06){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x10b'),_0x450b06[_0x5f72('0x3e')]));var _0x1971c2='';if(_0x450b06[_0x5f72('0x10c')]){if(!this[_0x5f72('0x8a')](_0x450b06['trunk_id'])){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x450b06,_0x5f72('0x10d'));}else{var _0x3f8ab8=parseInt(_0x450b06[_0x5f72('0x10c')],0xa);if(isNaN(_0x3f8ab8)){_0x1971c2=_0x450b06[_0x5f72('0x10c')];}else{_0x1971c2=this[_0x5f72('0x20')][_0x5f72('0x77')](this,_0x450b06['trunk_id']);if(!_0x1971c2){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x450b06,'no\x20trunk\x20found');}}}}else if(_0x450b06[_0x5f72('0x10e')]){_0x1971c2=_0x450b06[_0x5f72('0x10e')];}else{return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x450b06,_0x5f72('0x10d'));}var _0x4d9e8e=this['channel'][_0x5f72('0x5e')](_0x5f72('0xe5'),[util[_0x5f72('0x2d')](_0x5f72('0x10f'),_0x1971c2,_0x450b06[_0x5f72('0x4f')]),_0x450b06[_0x5f72('0x6c')],_0x450b06['opts'],_0x450b06[_0x5f72('0x7a')]]);if(_0x4d9e8e['result']===-0x1){return _0x4d9e8e;}return this['channel'][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0xe8'),_0x5f72('0xe5')));};AGIVertices[_0x5f72('0x13')][_0x5f72('0x110')]=function(_0x104d10){logger['info'](util[_0x5f72('0x2d')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x104d10[_0x5f72('0x3e')]));return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0x110'));};AGIVertices['prototype'][_0x5f72('0xf')]=function(_0x99fce2){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x111'),_0x99fce2['label']));if(_0x99fce2[_0x5f72('0xa9')]===0x0){return this[_0x5f72('0xa8')](_0x99fce2);}_0x99fce2[_0x5f72('0xa9')]-=0x1;if(!this[_0x5f72('0x8a')](_0x99fce2[_0x5f72('0x112')])){return this[_0x5f72('0x11')]['error'](_0x99fce2,_0x5f72('0x113'));}var _0x197efa=this[_0x5f72('0x22')][_0x5f72('0x77')](this,_0x99fce2['file_id']);if(!_0x197efa){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x99fce2,_0x5f72('0x114'));}if(!this[_0x5f72('0x8a')](_0x99fce2[_0x5f72('0xdc')])){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x5f72('0x115'));}var _0x3daaa0=this[_0x5f72('0x11')][_0x5f72('0x116')](_0x197efa,_0x99fce2[_0x5f72('0x117')],_0x99fce2[_0x5f72('0x118')]);var _0xd31ac3=_0x3daaa0[_0x5f72('0xae')]?_0x3daaa0[_0x5f72('0xae')]['toString']():'';logger[_0x5f72('0x32')](_0x5f72('0x119'),JSON[_0x5f72('0x7c')](_0x3daaa0));if(_0x3daaa0[_0x5f72('0xae')]===-0x1){this[_0x5f72('0x3c')]['sync'](this,_0x99fce2,_0xd31ac3);return _0x3daaa0;}else if(_0x3daaa0[_0x5f72('0xa6')]===_0x5f72('0x6c')){_0x3daaa0[_0x5f72('0xae')]=_0xd31ac3[_0x5f72('0x9e')]>=parseInt(_0x99fce2[_0x5f72('0x11a')])?'x':'i';}else{_0x3daaa0[_0x5f72('0xae')]=_0xd31ac3[_0x5f72('0x9e')]>=parseInt(_0x99fce2[_0x5f72('0x11a')])&&_0xd31ac3[_0x5f72('0x9e')]<=parseInt(_0x99fce2[_0x5f72('0x118')])?'x':'i';}var _0x5b194b=this['getVariable']['sync'](this,_0x99fce2[_0x5f72('0xdc')]);if(!_0x5b194b){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x99fce2,_0x5f72('0x11b'));}this[_0x5f72('0x11')][_0x5f72('0xa3')](_0x5b194b,_0xd31ac3);if(this[_0x5f72('0x8a')](_0x99fce2[_0x5f72('0x11c')])){var _0x35042a=parseInt(_0x99fce2['hiddendigitsnum'],0xa);var _0x3e66bb=rs[_0x5f72('0x11d')]({'charset':'*','length':_0x35042a});var _0x132b50=_0xd31ac3[_0x5f72('0x9e')];if(_0x132b50>0x0){if(_0x132b50>_0x35042a){this[_0x5f72('0x3c')][_0x5f72('0x77')](this,_0x99fce2,_0x99fce2[_0x5f72('0x11e')]===_0x5f72('0x11f')?_0x3e66bb+_0xd31ac3[_0x5f72('0x120')](_0x35042a):_0xd31ac3[_0x5f72('0x120')](0x0,_0x132b50-_0x35042a)+_0x3e66bb);}else{this[_0x5f72('0x3c')][_0x5f72('0x77')](this,_0x99fce2,rs[_0x5f72('0x11d')]({'charset':'*','length':_0x132b50}));}}else{this['createSquareDetailsReport'][_0x5f72('0x77')](this,_0x99fce2,'');}}else{this['createSquareDetailsReport'][_0x5f72('0x77')](this,_0x99fce2,_0xd31ac3);}return _0x3daaa0;};AGIVertices[_0x5f72('0x13')][_0x5f72('0x10')]=function(_0x4f96bc){logger[_0x5f72('0x32')](util['format'](_0x5f72('0x121'),_0x4f96bc['label']));return this[_0x5f72('0xf')](_0x4f96bc);};AGIVertices['prototype'][_0x5f72('0x122')]=function(_0x5870f5){logger['info'](util['format'](_0x5f72('0x123'),_0x5870f5[_0x5f72('0x3e')]));this['createSquareDetailsReport'][_0x5f72('0x77')](this,_0x5870f5,_0x5870f5['goalname']);return this['channel']['noop'](util['format'](_0x5f72('0x124'),_0x5870f5[_0x5f72('0x125')]));};AGIVertices[_0x5f72('0x13')][_0x5f72('0x126')]=function(_0x46aae4){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x127'),_0x46aae4['label']));if(!this[_0x5f72('0x8a')](_0x46aae4[_0x5f72('0x8d')])||!this[_0x5f72('0x8a')](_0x46aae4[_0x5f72('0x8e')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0x128'));}if(!this['isConfigured'](_0x46aae4[_0x5f72('0x62')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0xac'));}this[_0x5f72('0x11')][_0x5f72('0xab')](util['format'](_0x5f72('0x129'),_0x46aae4['text']));var _0x3dffcd=this[_0x5f72('0x8c')][_0x5f72('0x77')](this,_0x46aae4);if(_0x3dffcd){this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x12a'),_0x3dffcd));var _0x52db9a=this[_0x5f72('0x11')][_0x5f72('0x106')](_0x3dffcd);try{fs[_0x5f72('0x107')](_0x3dffcd+_0x5f72('0x12b'));}catch(_0x45198c){logger[_0x5f72('0x38')](_0x45198c);}return _0x52db9a;}return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x46aae4,_0x5f72('0x12c'));};AGIVertices[_0x5f72('0x13')]['awslex']=function(_0x5bf96b){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x12d'),_0x5bf96b[_0x5f72('0x3e')]));if(!this['isConfigured'](_0x5bf96b[_0x5f72('0x8d')])||!this[_0x5f72('0x8a')](_0x5bf96b['aws_secret_access_key'])){return this[_0x5f72('0x11')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x5f72('0x8a')](_0x5bf96b[_0x5f72('0x94')])){return this[_0x5f72('0x11')][_0x5f72('0xab')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x5bf96b[_0x5f72('0x62')])){return this['channel'][_0x5f72('0xab')](_0x5f72('0xac'));}this[_0x5f72('0x11')][_0x5f72('0xeb')]=!![];this[_0x5f72('0x3c')](_0x5bf96b);this[_0x5f72('0x49')](_0x5bf96b[_0x5f72('0x62')],'in','','');this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x12e'),_0x5bf96b['text']));var _0x5b0e52=this[_0x5f72('0x92')][_0x5f72('0x77')](this,_0x5bf96b);if(_0x5b0e52){for(var _0xdd9d3f in _0x5b0e52){if(_0x5b0e52[_0x5f72('0x99')](_0xdd9d3f)&&_['isString'](_0x5b0e52[_0xdd9d3f])){this['channel'][_0x5f72('0xa3')](util['format']('AWS_LEX_%s',_0xdd9d3f[_0x5f72('0x71')]()),_0x5b0e52[_0xdd9d3f]);}}if(_['isNil'](_0x5b0e52[_0x5f72('0x80')])){return this[_0x5f72('0x11')]['noop'](_0x5f72('0x12f'));}else{this[_0x5f72('0x49')](_0x5b0e52['message'],_0x5f72('0xf8'),_0x5f72('0x130'),'');return this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x131'),_0x5b0e52[_0x5f72('0x80')]));}}return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x5bf96b,_0x5f72('0x132'));};AGIVertices[_0x5f72('0x13')]['googleasr']=function(_0x5cff23){logger['info'](util[_0x5f72('0x2d')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5cff23[_0x5f72('0x3e')],_0x5cff23[_0x5f72('0x6c')]));if(!this[_0x5f72('0x8a')](_0x5cff23[_0x5f72('0x82')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0xea'));}var _0x3bfb6d=_0x5f72('0x133');var _0x40242f=util[_0x5f72('0x2d')](_0x5f72('0x134'),FILES_PATH,rs[_0x5f72('0x11d')](0x4));var _0x3f2543=util[_0x5f72('0x2d')]('%s.%s',_0x40242f,_0x3bfb6d);var _0x3ae2f5=!![];if(_0x5cff23['beep']===_0x5f72('0x135')){_0x3ae2f5=![];}var _0x157b22=this[_0x5f72('0x11')][_0x5f72('0x136')](_0x40242f,_0x3bfb6d,_0x5cff23[_0x5f72('0x137')],_0x5cff23[_0x5f72('0x6c')],undefined,_0x3ae2f5);if(_0x157b22[_0x5f72('0xae')]!==-0x1){this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x138'),_0x3f2543));var _0x264633=this[_0x5f72('0x139')][_0x5f72('0x77')](this,_0x5cff23,_0x3f2543);if(_0x264633){for(var _0xd32c3 in _0x264633){if(_0x264633['hasOwnProperty'](_0xd32c3)){this[_0x5f72('0x11')][_0x5f72('0xa3')](util[_0x5f72('0x2d')](_0x5f72('0x13a'),_0xd32c3[_0x5f72('0x71')]()),_0x264633[_0xd32c3]);}}return this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x13b'),JSON[_0x5f72('0x7c')](_0x264633)));}}return _0x157b22;};AGIVertices[_0x5f72('0x13')]['tildeasr']=function(_0x1a6bf6){logger[_0x5f72('0x32')](util['format'](_0x5f72('0x13c'),_0x1a6bf6[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0x1a6bf6[_0x5f72('0x96')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0x13d'));}if(!this[_0x5f72('0x8a')](_0x1a6bf6[_0x5f72('0x97')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0x13e'));}var _0x26dbc6=_0x5f72('0x133');var _0x3fe97d=util[_0x5f72('0x2d')](_0x5f72('0x134'),FILES_PATH,rs['generate'](0x4));var _0x314ead=util[_0x5f72('0x2d')](_0x5f72('0xa2'),_0x3fe97d,_0x26dbc6);var _0x3cb2d3=!![];if(_0x1a6bf6[_0x5f72('0x13f')]===_0x5f72('0x135')){_0x3cb2d3=![];}var _0x52bfa8=this[_0x5f72('0x11')][_0x5f72('0x136')](_0x3fe97d,_0x26dbc6,_0x1a6bf6[_0x5f72('0x137')],_0x1a6bf6[_0x5f72('0x6c')],undefined,_0x3cb2d3);if(_0x52bfa8['result']!==-0x1){this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x140'),_0x314ead));var _0x57497d=this[_0x5f72('0x141')][_0x5f72('0x77')](this,_0x1a6bf6,_0x314ead);if(_0x57497d){for(var _0x166636 in _0x57497d){if(_0x57497d['hasOwnProperty'](_0x166636)){this[_0x5f72('0x11')][_0x5f72('0xa3')](util[_0x5f72('0x2d')](_0x5f72('0x142'),_0x166636[_0x5f72('0x71')]()),_0x57497d[_0x166636]);}}return this['channel'][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x143'),JSON[_0x5f72('0x7c')](_0x57497d)));}}return _0x52bfa8;};AGIVertices[_0x5f72('0x13')][_0x5f72('0x144')]=function(_0x303589){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x145'),_0x303589[_0x5f72('0x3e')]));return this[_0x5f72('0x11')][_0x5f72('0x146')](_0x303589[_0x5f72('0x43')],_0x303589['extension'],_0x303589['priority']);};AGIVertices[_0x5f72('0x13')][_0x5f72('0x147')]=function(_0x4c7586){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x148'),_0x4c7586['label']));if(!this['isConfigured'](_0x4c7586[_0x5f72('0x149')])){return this[_0x5f72('0x11')]['error'](_0x4c7586,_0x5f72('0x14a'));}try{var _0x344eea=eval(_0x4c7586[_0x5f72('0x149')])?'true':'false';this['channel']['noop'](util[_0x5f72('0x2d')](_0x5f72('0x14b'),_0x4c7586[_0x5f72('0x149')],_0x344eea));return{'code':0xc8,'result':_0x344eea};}catch(_0x30d311){return{'code':0xc8,'result':_0x5f72('0x14c')};}};AGIVertices['prototype'][_0x5f72('0x14d')]=function(_0x38e7ae){logger['info'](util[_0x5f72('0x2d')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x38e7ae['label']));if(!this[_0x5f72('0x8a')](_0x38e7ae[_0x5f72('0x14e')])){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x38e7ae,'no\x20interval\x20configured');}var _0x83a18f=this[_0x5f72('0x28')][_0x5f72('0x77')](this,_0x38e7ae[_0x5f72('0x14e')]);if(!_0x83a18f){return this['channel']['error'](_0x38e7ae,_0x5f72('0x14f'));}for(var _0x1bc546=0x0;_0x1bc546<_0x83a18f[_0x5f72('0x9e')];_0x1bc546+=0x1){var _0x44ad9c=this[_0x5f72('0x11')][_0x5f72('0xa7')](util['format'](_0x5f72('0x150'),_0x83a18f[_0x1bc546]));if(_0x44ad9c[_0x5f72('0xae')]===-0x1){return _0x44ad9c;}logger[_0x5f72('0x32')](util['format'](_0x5f72('0x151'),_0x83a18f[_0x1bc546],_0x44ad9c[_0x5f72('0xa6')]));if(_0x44ad9c['extra']==='true'){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x151'),_0x83a18f[_0x1bc546],'true'));this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x151'),_0x83a18f[_0x1bc546],'true'));return{'code':0xc8,'result':_0x5f72('0x152')};}else{logger['info'](util['format'](_0x5f72('0x151'),_0x83a18f[_0x1bc546],_0x5f72('0x14c')));this['channel'][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x151'),_0x83a18f[_0x1bc546],'false'));}}return{'code':0xc8,'result':_0x5f72('0x14c')};};AGIVertices['prototype']['hangup']=function(_0x2e430a){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x153'),_0x2e430a[_0x5f72('0x3e')]));return this[_0x5f72('0x11')][_0x5f72('0x154')]();};AGIVertices[_0x5f72('0x13')][_0x5f72('0x155')]=function(_0x30fabc){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x30fabc[_0x5f72('0x3e')]));if(!this['isConfigured'](_0x30fabc[_0x5f72('0x82')])){return this['channel'][_0x5f72('0xab')](_0x5f72('0xea'));}var _0x8c40c7=_0x5f72('0x133');var _0x9c22dc=util[_0x5f72('0x2d')](_0x5f72('0x134'),FILES_PATH,rs[_0x5f72('0x11d')](0x4));var _0x3e5c19=util[_0x5f72('0x2d')](_0x5f72('0xa2'),_0x9c22dc,_0x8c40c7);var _0x42c988=!![];if(_0x30fabc['beep']===_0x5f72('0x135')){_0x42c988=![];}var _0x50079b=this[_0x5f72('0x11')]['recordFile'](_0x9c22dc,_0x8c40c7,_0x30fabc[_0x5f72('0x137')],_0x30fabc['timeout'],undefined,_0x42c988);if(_0x50079b[_0x5f72('0xae')]!==-0x1){this['channel'][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x156'),_0x3e5c19));var _0x537d13=this['ispeechASR'][_0x5f72('0x77')](this,_0x30fabc,_0x3e5c19);if(_0x537d13){for(var _0x353f6b in _0x537d13){if(_0x537d13[_0x5f72('0x99')](_0x353f6b)){this[_0x5f72('0x11')]['setVariable'](util[_0x5f72('0x2d')](_0x5f72('0x157'),_0x353f6b[_0x5f72('0x71')]()),_0x537d13[_0x353f6b]);}}return this[_0x5f72('0x11')][_0x5f72('0xab')](util['format'](_0x5f72('0x158'),JSON[_0x5f72('0x7c')](_0x537d13)));}}return _0x50079b;};AGIVertices['prototype'][_0x5f72('0x159')]=function(_0x259b7f){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x15a'),_0x259b7f[_0x5f72('0x3e')]));if(!this['isConfigured'](_0x259b7f[_0x5f72('0x82')])){return this['channel'][_0x5f72('0xab')](_0x5f72('0xea'));}if(!this[_0x5f72('0x8a')](_0x259b7f[_0x5f72('0x62')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0xac'));}this[_0x5f72('0x11')][_0x5f72('0xab')](util['format'](_0x5f72('0x15b'),_0x259b7f[_0x5f72('0x62')]));var _0x54b2df=this[_0x5f72('0x86')][_0x5f72('0x77')](this,_0x259b7f);if(_0x54b2df){this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')]('ispeech\x20%s\x20file\x20created',_0x54b2df));var _0x3d74ef=this[_0x5f72('0x11')][_0x5f72('0x106')](_0x54b2df,_0x259b7f['intKey']);try{fs[_0x5f72('0x107')](_0x54b2df+_0x5f72('0x12b'));}catch(_0x20ef1e){logger[_0x5f72('0x38')](_0x20ef1e);}return _0x3d74ef;}return this['channel'][_0x5f72('0x38')](_0x259b7f,_0x5f72('0x15c'));};AGIVertices['prototype'][_0x5f72('0x15d')]=function(_0x22a9ce){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x15e'),_0x22a9ce[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0x22a9ce[_0x5f72('0x15f')])){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x22a9ce,_0x5f72('0x160'));}logger[_0x5f72('0x32')](util[_0x5f72('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5f72('0x11')][_0x5f72('0x40')],_0x22a9ce['findBy']));var _0x44557f=this[_0x5f72('0x5a')][_0x5f72('0x77')](this,_0x22a9ce[_0x5f72('0x15f')]);if(_0x44557f){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x161'),this[_0x5f72('0x11')][_0x5f72('0x40')],_0x22a9ce[_0x5f72('0x15f')]));this[_0x5f72('0x11')]['noop'](util['format'](_0x5f72('0x161'),this[_0x5f72('0x11')][_0x5f72('0x40')],_0x22a9ce[_0x5f72('0x15f')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x5f72('0x2d')](_0x5f72('0x162'),this['channel'][_0x5f72('0x40')],_0x22a9ce[_0x5f72('0x15f')]));this['channel'][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x162'),this[_0x5f72('0x11')]['callerid'],_0x22a9ce['findBy']));return{'code':0xc8,'result':_0x5f72('0x163')};}};AGIVertices[_0x5f72('0x13')]['logout']=function(_0x26d026){logger['info'](util[_0x5f72('0x2d')](_0x5f72('0x164'),_0x26d026[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0x26d026[_0x5f72('0x15f')])){return this['channel'][_0x5f72('0x38')](_0x26d026,_0x5f72('0x160'));}logger[_0x5f72('0x32')](util['format'](_0x5f72('0x165'),this[_0x5f72('0x11')]['callerid'],_0x26d026['findBy']));var _0x357bf0=this[_0x5f72('0x59')][_0x5f72('0x77')](this,_0x26d026[_0x5f72('0x15f')]);if(_0x357bf0){logger['info'](util[_0x5f72('0x2d')](_0x5f72('0x161'),this[_0x5f72('0x11')][_0x5f72('0x40')],_0x26d026['findBy']));this['channel'][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x161'),this[_0x5f72('0x11')][_0x5f72('0x40')],_0x26d026[_0x5f72('0x15f')]));return{'code':0xc8,'result':_0x5f72('0x166')};}else{logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x162'),this['channel'][_0x5f72('0x40')],_0x26d026[_0x5f72('0x15f')]));this[_0x5f72('0x11')][_0x5f72('0xab')](util['format'](_0x5f72('0x162'),this[_0x5f72('0x11')][_0x5f72('0x40')],_0x26d026[_0x5f72('0x15f')]));return{'code':0xc8,'result':_0x5f72('0x163')};}};AGIVertices['prototype'][_0x5f72('0x167')]=function(_0x16e110){logger[_0x5f72('0x32')](util['format'](_0x5f72('0x168'),_0x16e110[_0x5f72('0x3e')]));if(!this['isConfigured'](_0x16e110['operation'])){return this['channel'][_0x5f72('0x38')](_0x16e110,_0x5f72('0x169'));}this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x16a'),_0x16e110['operation']));var _0x2edea1=eval(_0x16e110[_0x5f72('0x16b')]);if(!this[_0x5f72('0x8a')](_0x16e110[_0x5f72('0xdc')])){return this['channel'][_0x5f72('0xab')](_0x5f72('0x115'));}var _0x804a73=this['getVariable'][_0x5f72('0x77')](this,_0x16e110[_0x5f72('0xdc')]);if(!_0x804a73){return this['channel'][_0x5f72('0x38')](_0x16e110,'no\x20variable\x20found');}if(_[_0x5f72('0x16c')](_0x2edea1)){var _0x25c3cd=this;_0x2edea1[_0x5f72('0xdd')](function(_0x52d7e4,_0x5be0bf){_0x25c3cd[_0x5f72('0x11')][_0x5f72('0xa3')](util[_0x5f72('0x2d')](_0x5f72('0x16d'),_0x804a73,_0x5be0bf),_0x52d7e4);});return this[_0x5f72('0x11')][_0x5f72('0xab')](util['format'](_0x5f72('0x16e'),_0x804a73));}else{return this[_0x5f72('0x11')][_0x5f72('0xa3')](_0x804a73,_0x2edea1);}};AGIVertices[_0x5f72('0x13')][_0x5f72('0xe')]=function(_0x474853){logger['info'](util[_0x5f72('0x2d')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x474853[_0x5f72('0x3e')]));if(_0x474853['retry']===0x0){return this['maxRetry'](_0x474853);}_0x474853[_0x5f72('0xa9')]-=0x1;if(!this[_0x5f72('0x8a')](_0x474853[_0x5f72('0x112')])){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x474853,_0x5f72('0x113'));}var _0x491a75=this[_0x5f72('0x22')][_0x5f72('0x77')](this,_0x474853['file_id']);if(!_0x491a75){return this['channel'][_0x5f72('0x38')](_0x474853,'no\x20file\x20audio\x20found');}var _0x3d175b=this[_0x5f72('0x11')][_0x5f72('0x116')](_0x491a75,_0x474853[_0x5f72('0x117')],_0x474853[_0x5f72('0x16f')]);var _0x2a6bf4=_0x3d175b[_0x5f72('0xae')];if(_0x3d175b[_0x5f72('0xae')]===-0x1){this[_0x5f72('0x3c')][_0x5f72('0x77')](this,_0x474853,'-1');return _0x3d175b;}else if(_0x3d175b['extra']===_0x5f72('0x6c')){_0x3d175b[_0x5f72('0xae')]=_0x3d175b['result'][_0x5f72('0x9e')]>0x0?_0x3d175b[_0x5f72('0xae')]:'t';}else if(_[_0x5f72('0xa1')](_0x3d175b[_0x5f72('0xae')])){_0x3d175b[_0x5f72('0xae')]='#';_0x2a6bf4='#';}if(!this[_0x5f72('0x8a')](_0x474853['variable_id'])){this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0x115'));}else{var _0x4030d2=this[_0x5f72('0xa7')][_0x5f72('0x77')](this,_0x474853[_0x5f72('0xdc')]);if(!_0x4030d2){return this['channel'][_0x5f72('0x38')](_0x474853,_0x5f72('0x11b'));}this[_0x5f72('0x11')][_0x5f72('0xa3')](_0x4030d2,_0x2a6bf4);}this[_0x5f72('0x3c')][_0x5f72('0x77')](this,_0x474853,_0x2a6bf4);return _0x3d175b;};AGIVertices[_0x5f72('0x13')][_0x5f72('0xab')]=function(_0x4d36aa){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x170'),_0x4d36aa['label']));return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x4d36aa[_0x5f72('0x171')]||_0x4d36aa[_0x5f72('0x3e')]);};AGIVertices[_0x5f72('0x13')][_0x5f72('0x172')]=function(_0x1f8550){logger[_0x5f72('0x32')](util['format'](_0x5f72('0x173'),_0x1f8550['label']));if(!this[_0x5f72('0x8a')](_0x1f8550[_0x5f72('0x15f')])){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x1f8550,_0x5f72('0x160'));}logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x165'),this[_0x5f72('0x11')][_0x5f72('0x40')],_0x1f8550[_0x5f72('0x15f')]));var _0x554064=this[_0x5f72('0x54')]['sync'](this,_0x1f8550['pause_id']);var _0x137e4e=this[_0x5f72('0x56')]['sync'](this,_0x1f8550[_0x5f72('0x15f')],_0x554064);if(_0x137e4e){logger[_0x5f72('0x32')](util['format'](_0x5f72('0x161'),this[_0x5f72('0x11')]['callerid'],_0x1f8550[_0x5f72('0x15f')]));this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x161'),this[_0x5f72('0x11')][_0x5f72('0x40')],_0x1f8550[_0x5f72('0x15f')]));return{'code':0xc8,'result':'success'};}else{logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x162'),this[_0x5f72('0x11')][_0x5f72('0x40')],_0x1f8550['findBy']));this[_0x5f72('0x11')]['noop'](util['format'](_0x5f72('0x161'),this['channel'][_0x5f72('0x40')],_0x1f8550[_0x5f72('0x15f')]));return{'code':0xc8,'result':_0x5f72('0x163')};}};AGIVertices[_0x5f72('0x13')]['playback']=function(_0x4d785a){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x174'),_0x4d785a[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0x4d785a['file_id'])){return this['channel'][_0x5f72('0x38')](_0x4d785a,_0x5f72('0x113'));}var _0xf0b800=this[_0x5f72('0x22')][_0x5f72('0x77')](this,_0x4d785a[_0x5f72('0x112')]);if(!_0xf0b800){return this[_0x5f72('0x11')]['error'](_0x4d785a,'no\x20file\x20audio\x20found');}var _0x3558b0=this[_0x5f72('0x11')][_0x5f72('0x5e')]('PLAYBACK',[_0xf0b800,_0x4d785a[_0x5f72('0xe7')]]);if(_0x3558b0[_0x5f72('0xae')]===-0x1){return _0x3558b0;}return this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0xc6'),'PLAYBACK',_0xf0b800));};AGIVertices[_0x5f72('0x13')][_0x5f72('0x175')]=function(_0xcc9924){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0xcc9924['label']));if(!this['isConfigured'](_0xcc9924[_0x5f72('0x176')])){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0xcc9924,_0x5f72('0x177'));}var _0x11ba9d='';var _0x5b42d1=parseInt(_0xcc9924[_0x5f72('0x176')],0xa);if(isNaN(_0x5b42d1)){_0x11ba9d=_0xcc9924[_0x5f72('0x176')];}else{_0x11ba9d=this['getVoiceQueue']['sync'](this,_0xcc9924[_0x5f72('0x176')]);if(!_0x11ba9d){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0xcc9924,_0x5f72('0x178'));}}var _0xeb2e8a='';if(this[_0x5f72('0x8a')](_0xcc9924[_0x5f72('0x112')])){var _0x202310=this[_0x5f72('0x22')][_0x5f72('0x77')](this,_0xcc9924[_0x5f72('0x112')]);if(_0x202310){_0xeb2e8a=_0x202310;}}this[_0x5f72('0x3c')][_0x5f72('0x77')](this,_0xcc9924,_0x11ba9d);if(_0xcc9924[_0x5f72('0xe7')][_0x5f72('0x179')]('x')<0x0){_0xcc9924[_0x5f72('0xe7')]+='x';}if(_0xcc9924[_0x5f72('0xe7')][_0x5f72('0x179')]('X')<0x0){_0xcc9924[_0x5f72('0xe7')]+='X';}this[_0x5f72('0x11')][_0x5f72('0xa3')](_0x5f72('0x17a'),_0x11ba9d?_0x11ba9d[_0x5f72('0x17b')]():'');var _0x3ba9a4=this[_0x5f72('0x11')][_0x5f72('0x5e')]('QUEUE',[_0x11ba9d,_0xcc9924[_0x5f72('0xe7')],_0xcc9924[_0x5f72('0x7a')],_0xeb2e8a,_0xcc9924[_0x5f72('0x6c')],_0xcc9924[_0x5f72('0x9')],_0xcc9924[_0x5f72('0x17c')],_0xcc9924[_0x5f72('0x17d')],'',_0xcc9924[_0x5f72('0x17e')]]);if(_0x3ba9a4['result']===-0x1){return _0x3ba9a4;}return this[_0x5f72('0x11')]['noop'](util[_0x5f72('0x2d')](_0x5f72('0xc6'),_0x5f72('0x17f'),_0x11ba9d));};AGIVertices[_0x5f72('0x13')][_0x5f72('0x180')]=function(_0x51dcdc){logger[_0x5f72('0x32')](util['format'](_0x5f72('0x181'),_0x51dcdc[_0x5f72('0x3e')]));var _0x3721b3=_0x51dcdc[_0x5f72('0x182')]||'wav';var _0x624f6=util[_0x5f72('0x2d')](_0x5f72('0x183'),this[_0x5f72('0x11')][_0x5f72('0x3d')],rs[_0x5f72('0x11d')](0x5));var _0x35c20a=util['format'](_0x5f72('0x184'),FILES_PATH,_0x624f6,_0x3721b3);var _0x603b8f=util[_0x5f72('0x2d')]('%s/recordings/%s',FILES_PATH,_0x624f6);this[_0x5f72('0x41')][_0x5f72('0x77')](this,_0x51dcdc,_0x624f6,_0x35c20a);this[_0x5f72('0x11')][_0x5f72('0xa3')](_0x5f72('0x185'),_0x624f6);logger[_0x5f72('0x32')](_0x5f72('0x186'),_0x603b8f,_0x3721b3,_0x51dcdc[_0x5f72('0x187')],_0x51dcdc['timeout']);return this['channel'][_0x5f72('0x136')](_0x603b8f,_0x3721b3,_0x51dcdc[_0x5f72('0x187')],_0x51dcdc[_0x5f72('0x6c')],undefined,!![]);};AGIVertices[_0x5f72('0x13')][_0x5f72('0x188')]=function(_0x1b9afe){logger[_0x5f72('0x32')](util['format'](_0x5f72('0x189'),_0x1b9afe[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0x1b9afe['url'])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0x18a'));}var _0x33b2dd=this[_0x5f72('0x6a')]['sync'](this,_0x1b9afe);logger[_0x5f72('0x32')](util['format'](_0x5f72('0x18b'),util['inspect'](_0x33b2dd,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1b9afe[_0x5f72('0xdc')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0x18c'));}var _0x330734=this['getVariable'][_0x5f72('0x77')](this,_0x1b9afe[_0x5f72('0xdc')]);if(!_0x330734){return this['channel']['error'](_0x1b9afe,'no\x20variable\x20found');}this[_0x5f72('0x11')]['setVariable'](util[_0x5f72('0x2d')](_0x5f72('0x18d'),_0x330734),_0x33b2dd[_0x5f72('0x7e')]?_0x33b2dd['statusCode']:_0x5f72('0x18e'));this['channel'][_0x5f72('0xa3')](util[_0x5f72('0x2d')]('%s_STATUS_MESSAGE',_0x330734),_0x33b2dd[_0x5f72('0x7f')]?_0x33b2dd[_0x5f72('0x7f')]:'OK');if(_0x33b2dd['body']){try{this[_0x5f72('0xa0')](_0x33b2dd[_0x5f72('0x72')],_0x330734);}catch(_0x919987){logger[_0x5f72('0x38')](util[_0x5f72('0x2d')](_0x5f72('0x18f'),_0x330734));}}return this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0xe0'),_0x330734));};AGIVertices[_0x5f72('0x13')][_0x5f72('0x190')]=function(_0x31483a){logger['info'](util['format'](_0x5f72('0x191'),_0x31483a[_0x5f72('0x3e')]));return this['channel']['sayDigits'](_0x31483a[_0x5f72('0x192')][_0x5f72('0x5f')](/\s+/g,''),_0x31483a[_0x5f72('0x187')]);};AGIVertices[_0x5f72('0x13')][_0x5f72('0x193')]=function(_0x33a2b){logger['info'](util[_0x5f72('0x2d')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x33a2b['label']));return this['channel']['sayNumber'](_0x33a2b[_0x5f72('0x6d')][_0x5f72('0x5f')](/\s+/g,''),_0x33a2b[_0x5f72('0x187')]);};AGIVertices['prototype'][_0x5f72('0x194')]=function(_0x154fca){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x195'),_0x154fca[_0x5f72('0x3e')]));return this[_0x5f72('0x11')][_0x5f72('0x196')](_0x154fca['text'],_0x154fca['escape_digits']);};AGIVertices[_0x5f72('0x13')][_0x5f72('0x197')]=function(_0x350d48){logger['info'](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x350d48[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0x350d48[_0x5f72('0x198')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0x199'));}var _0x300c5d=this['getMailAccount'][_0x5f72('0x77')](this,_0x350d48[_0x5f72('0x198')]);if(!_0x300c5d||!_0x300c5d[_0x5f72('0x19a')]){return this[_0x5f72('0x11')]['error'](_0x350d48,_0x5f72('0x19b'));}var _0x7132f3={'from':util[_0x5f72('0x2d')](_0x5f72('0x19c'),_0x300c5d['name'],_0x300c5d[_0x5f72('0x19d')]||_0x300c5d['Smtp']['user']),'to':_0x350d48['to']||'','cc':_0x350d48['cc']||'','bcc':_0x350d48['bcc']||'','subject':_0x350d48[_0x5f72('0x19e')],'html':_0x350d48['text'],'text':_0x350d48[_0x5f72('0x62')]};if(this[_0x5f72('0x8a')](_0x350d48[_0x5f72('0x19f')])){}logger[_0x5f72('0x1a0')](_0x5f72('0x1a1'),JSON[_0x5f72('0x7c')](_0x7132f3));this[_0x5f72('0x3c')][_0x5f72('0x77')](this,_0x350d48,_0x350d48['account_id']);this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x1a2'),_0x300c5d[_0x5f72('0x17')]));this[_0x5f72('0x27')][_0x5f72('0x77')](this,_0x300c5d[_0x5f72('0x1a3')],_0x7132f3);return this['channel']['noop'](_0x5f72('0x1a4'));};AGIVertices[_0x5f72('0x13')][_0x5f72('0x1a5')]=function(_0x538e86){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x1a6'),_0x538e86[_0x5f72('0x3e')]));return this[_0x5f72('0x11')][_0x5f72('0xab')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x5f72('0x13')]['sendSMS']=function(_0x4cce93){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4cce93['label']));if(!this[_0x5f72('0x8a')](_0x4cce93[_0x5f72('0x1a7')])){return this[_0x5f72('0x11')]['noop'](_0x5f72('0x1a8'));}var _0x577c5d=this[_0x5f72('0x3a')][_0x5f72('0x77')](this,_0x4cce93[_0x5f72('0x1a7')]);if(!_0x577c5d){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x4cce93,'no\x20sms\x20account\x20found');}var _0x14a0ae={'body':_0x4cce93['sms_text'],'phone':_0x4cce93['to']||'','SmsAccountId':_0x577c5d['id']};logger[_0x5f72('0x1a0')](_0x5f72('0x1a9'),JSON[_0x5f72('0x7c')](_0x14a0ae));this['createSquareDetailsReport'][_0x5f72('0x77')](this,_0x4cce93,_0x4cce93[_0x5f72('0x1a7')]);this[_0x5f72('0x11')]['noop'](util[_0x5f72('0x2d')](_0x5f72('0x1aa'),_0x577c5d[_0x5f72('0x17')]));this['createSmsMessage'][_0x5f72('0x77')](this,_0x14a0ae);return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0x1ab'));};AGIVertices[_0x5f72('0x13')][_0x5f72('0x1ac')]=function(_0x3ead86){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x3ead86['label']));if(!this[_0x5f72('0x8a')](_0x3ead86[_0x5f72('0xdc')])){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x3ead86,_0x5f72('0x1ad'));}var _0x241f2d=this[_0x5f72('0xa7')][_0x5f72('0x77')](this,_0x3ead86[_0x5f72('0xdc')]);if(!_0x241f2d){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x3ead86,_0x5f72('0x11b'));}return this['channel'][_0x5f72('0xa3')](_0x241f2d,_0x3ead86[_0x5f72('0x1ae')]);};AGIVertices[_0x5f72('0x13')][_0x5f72('0x1af')]=function(_0x4bf06f){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')]('Enter\x20in\x20START\x20(%s)\x20block',_0x4bf06f[_0x5f72('0x3e')]));this['channel'][_0x5f72('0xab')]('START\x20CALLY\x20SQUARE');var _0x5bb77f=this[_0x5f72('0x11')][_0x5f72('0xa7')](_0x5f72('0x1b0'));if(!_['isEmpty'](_0x5bb77f[_0x5f72('0xa6')])){this[_0x5f72('0x11')][_0x5f72('0x3d')]=_0x5bb77f[_0x5f72('0xa6')];}if(_0x4bf06f[_0x5f72('0xbd')]===_0x5f72('0x1b1')){this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0x1b2'));return this['channel'][_0x5f72('0xbd')]();}return this[_0x5f72('0x11')]['noop'](_0x5f72('0x1b3'));};AGIVertices['prototype'][_0x5f72('0x1b4')]=function(_0x41191f){logger['info'](util[_0x5f72('0x2d')](_0x5f72('0x1b5'),_0x41191f['label']));if(!this[_0x5f72('0x8a')](_0x41191f[_0x5f72('0x1b6')])){return this[_0x5f72('0x11')]['error'](_0x41191f,_0x5f72('0x1b7'));}var _0x5284af=this['getSquareProject'][_0x5f72('0x77')](this,_0x41191f[_0x5f72('0x1b6')]);if(!this[_0x5f72('0x8a')](_0x5284af)){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x41191f,util[_0x5f72('0x2d')](_0x5f72('0x1b8'),_0x41191f[_0x5f72('0x1b6')]));}if(_0x5284af===this[_0x5f72('0x11')][_0x5f72('0x47')]){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x41191f,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x5f72('0x3c')]['sync'](this,_0x41191f,_0x5284af);var _0x4e54fe=this[_0x5f72('0x11')][_0x5f72('0x5e')](_0x5f72('0x1b9'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x5f72('0x9')][_0x5f72('0x1ba')]||_0x5f72('0x1bb'),_0x5284af,this[_0x5f72('0x11')][_0x5f72('0x47')]));if(_0x4e54fe[_0x5f72('0xae')]===-0x1){return _0x4e54fe;}return this['channel'][_0x5f72('0xab')](util[_0x5f72('0x2d')]('Executed\x20command\x20%s\x20%s',_0x5f72('0x1b9'),_0x5284af));};AGIVertices[_0x5f72('0x13')][_0x5f72('0x1bc')]=function(_0x2a21d4){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x1bd'),_0x2a21d4['label']));var _0x3bd435=this['shellCommand'][_0x5f72('0x77')](this,_0x2a21d4[_0x5f72('0xba')]);this['createSquareDetailsReport'][_0x5f72('0x77')](this,_0x2a21d4,_0x2a21d4[_0x5f72('0xba')]);if(this[_0x5f72('0x8a')](_0x2a21d4['variable_id'])){var _0x3aec95=this[_0x5f72('0xa7')][_0x5f72('0x77')](this,_0x2a21d4['variable_id']);if(_0x3aec95){this[_0x5f72('0x11')][_0x5f72('0xa3')](_0x3aec95,_0x3bd435);return this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x1be'),_0x2a21d4[_0x5f72('0xba')],_0x3aec95));}}return this[_0x5f72('0x11')][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0x1bf'),_0x2a21d4[_0x5f72('0xba')]));};AGIVertices[_0x5f72('0x13')][_0x5f72('0x1c0')]=function(_0x4b9e28){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x1c1'),_0x4b9e28['label']));_0x4b9e28[_0x5f72('0x62')]=_0x4b9e28['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5f72('0x8a')](_0x4b9e28[_0x5f72('0x1c2')])){return this['channel'][_0x5f72('0xab')](_0x5f72('0x1c3'));}if(!this['isConfigured'](_0x4b9e28[_0x5f72('0x62')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0xac'));}this[_0x5f72('0x11')]['noop'](util['format'](_0x5f72('0x1c4'),_0x4b9e28[_0x5f72('0x62')]));var _0xa4fbaf=this[_0x5f72('0x60')]['sync'](this,_0x4b9e28);if(_0xa4fbaf){this[_0x5f72('0x11')]['noop'](util[_0x5f72('0x2d')](_0x5f72('0x1c5'),_0xa4fbaf));var _0x5355be=this[_0x5f72('0x11')][_0x5f72('0x106')](_0xa4fbaf);try{fs[_0x5f72('0x107')](_0xa4fbaf+_0x5f72('0x12b'));}catch(_0x55ac60){logger[_0x5f72('0x38')](_0x55ac60);}return _0x5355be;}return this['channel']['error'](_0x4b9e28,_0x5f72('0x1c6'));};AGIVertices[_0x5f72('0x13')][_0x5f72('0x1c7')]=function(_0xa15d15){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0xa15d15[_0x5f72('0x3e')]));_0xa15d15[_0x5f72('0x62')]=_0xa15d15[_0x5f72('0x62')][_0x5f72('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5f72('0x8a')](_0xa15d15[_0x5f72('0x62')])){return this[_0x5f72('0x11')][_0x5f72('0xab')](_0x5f72('0xac'));}this['channel'][_0x5f72('0xab')](util['format'](_0x5f72('0x1c8'),_0xa15d15['text']));var _0xd86fb6=this[_0x5f72('0x69')]['sync'](this,_0xa15d15);if(_0xd86fb6){this[_0x5f72('0x11')][_0x5f72('0xab')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0xd86fb6));var _0x419977=this[_0x5f72('0x11')][_0x5f72('0x106')](_0xd86fb6);try{fs[_0x5f72('0x107')](_0xd86fb6+'.wav');}catch(_0x4d4ecc){logger[_0x5f72('0x38')](_0x4d4ecc);}return _0x419977;}return this[_0x5f72('0x11')][_0x5f72('0x38')](_0xa15d15,_0x5f72('0x1c9'));};AGIVertices[_0x5f72('0x13')][_0x5f72('0x1ca')]=function(_0x5bce1f){logger[_0x5f72('0x32')](util[_0x5f72('0x2d')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x5bce1f[_0x5f72('0x3e')]));if(!this['isConfigured'](_0x5bce1f['findBy'])){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0x5bce1f,_0x5f72('0x160'));}logger[_0x5f72('0x32')](util['format'](_0x5f72('0x165'),this[_0x5f72('0x11')][_0x5f72('0x40')],_0x5bce1f[_0x5f72('0x15f')]));var _0xb7224b=this[_0x5f72('0x58')][_0x5f72('0x77')](this,_0x5bce1f['findBy']);if(_0xb7224b){logger[_0x5f72('0x32')](util['format'](_0x5f72('0x161'),this[_0x5f72('0x11')][_0x5f72('0x40')],_0x5bce1f[_0x5f72('0x15f')]));this['channel']['noop'](util[_0x5f72('0x2d')](_0x5f72('0x161'),this[_0x5f72('0x11')]['callerid'],_0x5bce1f[_0x5f72('0x15f')]));return{'code':0xc8,'result':_0x5f72('0x166')};}else{logger[_0x5f72('0x32')](util[_0x5f72('0x2d')](_0x5f72('0x162'),this['channel']['callerid'],_0x5bce1f[_0x5f72('0x15f')]));this['channel']['noop'](util[_0x5f72('0x2d')](_0x5f72('0x162'),this[_0x5f72('0x11')][_0x5f72('0x40')],_0x5bce1f['findBy']));return{'code':0xc8,'result':_0x5f72('0x163')};}};AGIVertices[_0x5f72('0x13')]['voicemail']=function(_0xfc95cf){logger[_0x5f72('0x32')](util['format'](_0x5f72('0x1cb'),_0xfc95cf['label']));var _0x501bbe=this[_0x5f72('0x11')][_0x5f72('0x5e')]('VOICEMAIL',[_0xfc95cf['mailbox'],_0xfc95cf[_0x5f72('0xad')]]);if(_0x501bbe['result']===-0x1){return _0x501bbe;}return this['channel'][_0x5f72('0xab')](util[_0x5f72('0x2d')](_0x5f72('0xc6'),_0x5f72('0x1cc'),_0xfc95cf[_0x5f72('0x1cd')]));};AGIVertices[_0x5f72('0x13')][_0x5f72('0x1ce')]=function(_0xe1e543){logger[_0x5f72('0x32')](util['format'](_0x5f72('0x1cf'),_0xe1e543[_0x5f72('0x3e')]));if(!this[_0x5f72('0x8a')](_0xe1e543['variable_id'])){return this[_0x5f72('0x11')]['error'](_0xe1e543,'no\x20variable\x20selected');}var _0x11ffed=this['getVariable'][_0x5f72('0x77')](this,_0xe1e543['variable_id']);if(!_0x11ffed){return this[_0x5f72('0x11')][_0x5f72('0x38')](_0xe1e543,_0x5f72('0x11b'));}var _0x7cf306=this['channel'][_0x5f72('0xa7')](_0x11ffed);return{'code':0xc8,'result':_0x7cf306[_0x5f72('0xa6')]?_0x7cf306['extra']:'-'};};String['prototype'][_0x5f72('0xa5')]=function(_0x54e554,_0x2ec762){return this[_0x5f72('0xa4')](_0x54e554)[_0x5f72('0x1d0')](_0x2ec762);};module[_0x5f72('0x1d1')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 57df571..0ccd70a 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 _0xe54b=['syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','bind','syncBlindTransfer','diff','seconds','prototype','updateAcw','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','startAcw','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','acwTimeout','lastPauseAt','format','queue','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','ACW','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','lodash','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','hangup','syncHangup'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe54b,0x1d9));var _0xbe54=function(_0x41d86e,_0x2ef580){_0x41d86e=_0x41d86e-0x0;var _0x32aff9=_0xe54b[_0x41d86e];return _0x32aff9;};'use strict';var _=require(_0xbe54('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require('../../../config/logger')(_0xbe54('0x1'));var RpcUser=require(_0xbe54('0x2'));var RpcVoiceAgentReport=require(_0xbe54('0x3'));function Acw(_0xdfcf24){this[_0xbe54('0x4')]=_0xdfcf24[_0xbe54('0x4')];this[_0xbe54('0x5')]=_0xdfcf24[_0xbe54('0x5')];this[_0xbe54('0x6')]=_0xdfcf24[_0xbe54('0x6')];this[_0xbe54('0x7')]={};ami['on'](_0xbe54('0x8'),this[_0xbe54('0x9')]['bind'](this));ami['on'](_0xbe54('0xa'),this['syncHangupRequest']['bind'](this));ami['on'](_0xbe54('0xb'),this[_0xbe54('0xc')]['bind'](this));ami['on']('agentringnoanswer',this[_0xbe54('0xd')]['bind'](this));ami['on'](_0xbe54('0xe'),this[_0xbe54('0xf')][_0xbe54('0x10')](this));ami['on']('blindtransfer',this[_0xbe54('0x11')][_0xbe54('0x10')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0xbe54('0x10')](this));}function getDiff(_0x456197){var _0x5f1ada=moment()['milliseconds'](0x0);var _0x17c9f1=moment(_0x456197)['milliseconds'](0x0);return _0x5f1ada[_0xbe54('0x12')](_0x17c9f1,_0xbe54('0x13'));}Acw[_0xbe54('0x14')][_0xbe54('0x15')]=function(_0x576157,_0x479022){var _0x3334e9=this;var _0x5c22b4=getDiff(_0x3334e9[_0xbe54('0x6')][_0x576157]['lastPauseAt']);clearTimeout(_0x3334e9[_0xbe54('0x6')][_0x576157]['timer']);_0x3334e9[_0xbe54('0x6')][_0x576157][_0xbe54('0x16')]=![];return RpcVoiceAgentReport[_0xbe54('0x17')]({'acwtime':_0x5c22b4},_0x3334e9[_0xbe54('0x6')][_0x576157][_0xbe54('0x18')],_0x576157)['then'](function(_0x3156f5){logger['info'](_0xbe54('0x19'),_0x479022,_0x5c22b4,_0x3156f5);})[_0xbe54('0x1a')](function(_0x29f75e){logger[_0xbe54('0x1b')]('[%s][UPDATE][ERRORS:%s]',_0x479022,_0x29f75e);})[_0xbe54('0x1c')](function(){delete _0x3334e9[_0xbe54('0x6')][_0x576157];});};Acw[_0xbe54('0x14')][_0xbe54('0x1d')]=function(_0x40a606){try{var _0x4f89af=this;var _0x391035=this[_0xbe54('0x7')][_0x40a606]['interface'];var _0x2ae6d7=this[_0xbe54('0x7')][_0x40a606]['queue'];var _0x36a7d6=this['voiceQueues'][_0x2ae6d7];var _0x16df42=![];var _0x23a5e6='ACW';if(_0x36a7d6[_0xbe54('0x1e')]&&_0x36a7d6[_0xbe54('0x1f')][_0xbe54('0x20')]){_0x16df42=!![];_0x23a5e6=_0x36a7d6[_0xbe54('0x1f')][_0xbe54('0x20')];}return ami['Action']({'action':_0xbe54('0x21'),'interface':_0x391035,'paused':!![],'reason':_0x23a5e6})[_0xbe54('0x22')](function(){if(_0x4f89af[_0xbe54('0x5')][_0x391035]){return RpcUser[_0xbe54('0x23')](_0x4f89af['agents'][_0x391035]['id'])['then'](function(_0x100611){if(!_0x100611||_0x100611[_0xbe54('0x24')]){logger[_0xbe54('0x25')](_0xbe54('0x26'),_0x40a606,_0x391035,_0x2ae6d7);return;}logger[_0xbe54('0x25')](_0xbe54('0x27'),_0x40a606,_0x391035,_0x2ae6d7);var _0x24ebbe=_0x4f89af[_0xbe54('0x7')][_0x40a606][_0xbe54('0x28')]&&_0x4f89af[_0xbe54('0x7')][_0x40a606][_0xbe54('0x29')]?_0x4f89af[_0xbe54('0x7')][_0x40a606][_0xbe54('0x29')]:_0x40a606;return RpcUser[_0xbe54('0x2a')](_0x4f89af[_0xbe54('0x5')][_0x391035],_0x23a5e6,_0x24ebbe)['then'](function(_0x45ec67){_0x4f89af[_0xbe54('0x4')][_0x2ae6d7][_0xbe54('0x2b')]-=0x1;_0x4f89af[_0xbe54('0x4')][_0x2ae6d7][_0xbe54('0x2c')]+=0x1;return _0x45ec67;});})[_0xbe54('0x22')](function(_0x20b186){if(_0x16df42||!_0x20b186){return;}_0x4f89af[_0xbe54('0x6')][_0x391035]={};logger[_0xbe54('0x25')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x40a606,_0x4f89af[_0xbe54('0x4')][_0x2ae6d7][_0xbe54('0x2d')],_0x391035,_0x2ae6d7);_0x4f89af[_0xbe54('0x6')][_0x391035][_0xbe54('0x16')]=setTimeout(_0x4f89af['stopAcw'][_0xbe54('0x10')](_0x4f89af,_0x391035),_0x4f89af[_0xbe54('0x4')][_0x2ae6d7][_0xbe54('0x2d')]*0x3e8);_0x4f89af[_0xbe54('0x6')][_0x391035][_0xbe54('0x2e')]=moment()[_0xbe54('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f89af[_0xbe54('0x6')][_0x391035][_0xbe54('0x18')]=_0x40a606;_0x4f89af[_0xbe54('0x6')][_0x391035][_0xbe54('0x30')]=_0x2ae6d7;_0x4f89af['timers'][_0x391035][_0xbe54('0x15')]=_0x4f89af[_0xbe54('0x15')]['bind'](_0x4f89af,_0x391035,_0x40a606);});}})[_0xbe54('0x1a')](function(){logger[_0xbe54('0x1b')](_0xbe54('0x31'),_0x40a606,_0x4f89af[_0xbe54('0x4')][_0x2ae6d7][_0xbe54('0x2d')],_0x391035,_0x2ae6d7);})[_0xbe54('0x1c')](function(){delete _0x4f89af['channels'][_0x40a606];});}catch(_0x1ffdbf){logger[_0xbe54('0x1b')](_0xbe54('0x32'),_0x1ffdbf[_0xbe54('0x33')]);}};Acw[_0xbe54('0x14')][_0xbe54('0x34')]=function(_0x5cdfa7){try{var _0x3d03ba=this;if(_0x3d03ba['timers'][_0x5cdfa7]){_0x3d03ba[_0xbe54('0x6')][_0x5cdfa7]['timer']=![];var _0x33e9be=_0x3d03ba[_0xbe54('0x6')][_0x5cdfa7][_0xbe54('0x18')];var _0x4ad308=_0x3d03ba['timers'][_0x5cdfa7][_0xbe54('0x30')];var _0x1413b1=_0x3d03ba['voiceQueues'][_0x4ad308][_0xbe54('0x2d')];logger[_0xbe54('0x25')](_0xbe54('0x35'),_0x33e9be,_0x5cdfa7);RpcUser[_0xbe54('0x23')](this[_0xbe54('0x5')][_0x5cdfa7]['id'])[_0xbe54('0x22')](function(_0x48018b){if(_0x48018b['pauseType']===_0xbe54('0x36')){return RpcUser['saveUnpause'](_0x3d03ba[_0xbe54('0x5')][_0x5cdfa7]);}});RpcVoiceAgentReport['update']({'acwtime':_0x1413b1,'agentacw':!![]},_0x33e9be,_0x5cdfa7)[_0xbe54('0x22')](function(_0xbb63f6){logger[_0xbe54('0x25')](_0xbe54('0x19'),_0x33e9be,_0x1413b1,_0xbb63f6);})[_0xbe54('0x1a')](function(_0x5694c8){logger['error'](_0xbe54('0x37'),_0x33e9be,_0x5694c8);});}else{logger[_0xbe54('0x1b')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x5cdfa7);if(_0x3d03ba[_0xbe54('0x6')]){logger['info'](_0xbe54('0x38'),JSON['stringify'](_0x3d03ba[_0xbe54('0x6')]));}}}catch(_0x25ddc8){logger[_0xbe54('0x1b')]('[ACW][STOP]\x20%s',_0x25ddc8[_0xbe54('0x33')]);}};Acw[_0xbe54('0x14')]['syncAgentConnect']=function(_0x37b149){try{if(this[_0xbe54('0x4')][_0x37b149[_0xbe54('0x30')]]&&(this[_0xbe54('0x4')][_0x37b149[_0xbe54('0x30')]][_0xbe54('0x1')]||this['voiceQueues'][_0x37b149[_0xbe54('0x30')]]['mandatoryDisposition'])){if(this[_0xbe54('0x5')][_0x37b149[_0xbe54('0x39')]]){this[_0xbe54('0x7')][_0x37b149[_0xbe54('0x18')]]={'queue':_0x37b149[_0xbe54('0x30')],'interface':_0x37b149[_0xbe54('0x39')],'destlinkedid':_0x37b149[_0xbe54('0x29')]};}}}catch(_0x9c6746){logger[_0xbe54('0x1b')](_0xbe54('0x3a'),_0x9c6746[_0xbe54('0x33')]);}};Acw['prototype'][_0xbe54('0x3b')]=function(_0x2e9b0e){try{if(this[_0xbe54('0x4')][_0x2e9b0e['queue']]&&(this[_0xbe54('0x4')][_0x2e9b0e['queue']][_0xbe54('0x1')]||this[_0xbe54('0x4')][_0x2e9b0e[_0xbe54('0x30')]]['mandatoryDisposition'])){if(this[_0xbe54('0x5')][_0x2e9b0e[_0xbe54('0x39')]]){this['channels'][_0x2e9b0e[_0xbe54('0x18')]]={'queue':_0x2e9b0e[_0xbe54('0x30')],'interface':_0x2e9b0e[_0xbe54('0x39')]};}}}catch(_0x3dce3b){logger[_0xbe54('0x1b')](_0xbe54('0x3c'),_0x3dce3b['message']);}};Acw[_0xbe54('0x14')]['syncHangupRequest']=function(_0x1f584e){try{if(this['channels'][_0x1f584e[_0xbe54('0x18')]]&&_[_0xbe54('0x3d')](this[_0xbe54('0x7')][_0x1f584e[_0xbe54('0x18')]][_0xbe54('0x28')])){logger[_0xbe54('0x25')]('[%s][HANGUP:UNIQUEID]',_0x1f584e[_0xbe54('0x18')]);this[_0xbe54('0x1d')](_0x1f584e[_0xbe54('0x18')]);}else if(this[_0xbe54('0x7')][_0x1f584e[_0xbe54('0x3e')]]&&_[_0xbe54('0x3d')](this[_0xbe54('0x7')][_0x1f584e[_0xbe54('0x3e')]]['attended'])){logger[_0xbe54('0x25')](_0xbe54('0x3f'),_0x1f584e['linkedid']);this[_0xbe54('0x1d')](_0x1f584e[_0xbe54('0x3e')]);}}catch(_0x4f5a03){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x4f5a03[_0xbe54('0x33')]);}};Acw['prototype'][_0xbe54('0xc')]=function(_0x24dd14){try{if(this[_0xbe54('0x7')][_0x24dd14[_0xbe54('0x18')]]&&this[_0xbe54('0x7')][_0x24dd14['uniqueid']][_0xbe54('0x28')]){logger['info'](_0xbe54('0x40'),_0x24dd14[_0xbe54('0x18')]);this['startAcw'](_0x24dd14[_0xbe54('0x18')]);}else if(this[_0xbe54('0x7')][_0x24dd14['linkedid']]&&this[_0xbe54('0x7')][_0x24dd14[_0xbe54('0x3e')]][_0xbe54('0x28')]){logger[_0xbe54('0x25')](_0xbe54('0x41'),_0x24dd14['linkedid']);this[_0xbe54('0x1d')](_0x24dd14[_0xbe54('0x3e')]);}}catch(_0x533811){logger['error']('[ACW][syncHangup]\x20%s',_0x533811['message']);}};Acw['prototype'][_0xbe54('0xf')]=function(_0x216b4d){try{if(!_[_0xbe54('0x42')](this['channels'][_0x216b4d[_0xbe54('0x43')]])){this['startAcw'](_0x216b4d['transfereeuniqueid']);if(this[_0xbe54('0x7')][_0x216b4d[_0xbe54('0x44')]]){this['channels'][_0x216b4d[_0xbe54('0x44')]][_0xbe54('0x28')]=!![];this[_0xbe54('0x7')][_0x216b4d[_0xbe54('0x45')]]=this[_0xbe54('0x7')][_0x216b4d[_0xbe54('0x44')]];delete this[_0xbe54('0x7')][_0x216b4d['secondtransfereruniqueid']];}}else if(!_[_0xbe54('0x42')](this[_0xbe54('0x7')][_0x216b4d['transfertargetuniqueid']])){this['startAcw'](_0x216b4d[_0xbe54('0x45')]);if(this[_0xbe54('0x7')][_0x216b4d['origtransfereruniqueid']]){this[_0xbe54('0x7')][_0x216b4d[_0xbe54('0x46')]][_0xbe54('0x28')]=!![];this[_0xbe54('0x7')][_0x216b4d[_0xbe54('0x43')]]=this[_0xbe54('0x7')][_0x216b4d[_0xbe54('0x46')]];delete this['channels'][_0x216b4d[_0xbe54('0x46')]];}}}catch(_0x5458fa){logger[_0xbe54('0x1b')](_0xbe54('0x47'),_0x5458fa[_0xbe54('0x33')]);}};Acw['prototype'][_0xbe54('0x11')]=function(_0x55d610){try{if(this[_0xbe54('0x7')][_0x55d610[_0xbe54('0x48')]]){logger[_0xbe54('0x25')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xbe54('0x49')](_0x55d610[_0xbe54('0x48')]));this[_0xbe54('0x1d')](_0x55d610['transfereruniqueid']);}else if(this['channels'][_0x55d610['transfererlinkedid']]){logger[_0xbe54('0x25')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x55d610[_0xbe54('0x4a')]));this[_0xbe54('0x1d')](_0x55d610[_0xbe54('0x4a')]);}}catch(_0x457f77){logger['error'](_0xbe54('0x4b'),_0x457f77['message']);}};Acw[_0xbe54('0x14')][_0xbe54('0xd')]=function(_0x1f632d){try{if(this['voiceQueues'][_0x1f632d[_0xbe54('0x30')]]&&this[_0xbe54('0x4')][_0x1f632d[_0xbe54('0x30')]][_0xbe54('0x4c')]===_0xbe54('0x4d')){if(this[_0xbe54('0x5')][_0x1f632d[_0xbe54('0x39')]]){logger['info'](_0xbe54('0x4e'),_0x1f632d[_0xbe54('0x18')],_0x1f632d[_0xbe54('0x39')],_0x1f632d[_0xbe54('0x30')]);return RpcUser[_0xbe54('0x2a')](this[_0xbe54('0x5')][_0x1f632d[_0xbe54('0x39')]],_0xbe54('0x4f'),_0x1f632d[_0xbe54('0x18')]);}}}catch(_0x40517d){logger[_0xbe54('0x1b')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x40517d[_0xbe54('0x33')]);}};module[_0xbe54('0x50')]=Acw; \ No newline at end of file +var _0xfdf9=['acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','startAcw','interface','queue','mandatoryDisposition','name','Action','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','paused','acwTimeout','YYYY-MM-DD\x20HH:mm:ss','updateAcw','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','prototype','pauseType','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s'];(function(_0x36ed8a,_0x123397){var _0x2f2e4f=function(_0x4cdbe0){while(--_0x4cdbe0){_0x36ed8a['push'](_0x36ed8a['shift']());}};_0x2f2e4f(++_0x123397);}(_0xfdf9,0x16e));var _0x9fdf=function(_0x56c501,_0x1a8666){_0x56c501=_0x56c501-0x0;var _0x350c59=_0xfdf9[_0x56c501];return _0x350c59;};'use strict';var _=require(_0x9fdf('0x0'));var moment=require(_0x9fdf('0x1'));var ami=require(_0x9fdf('0x2'));var logger=require('../../../config/logger')('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x9fdf('0x3'));function Acw(_0x158f7a){this[_0x9fdf('0x4')]=_0x158f7a['voiceQueues'];this[_0x9fdf('0x5')]=_0x158f7a['agents'];this[_0x9fdf('0x6')]=_0x158f7a['timers'];this[_0x9fdf('0x7')]={};ami['on'](_0x9fdf('0x8'),this[_0x9fdf('0x9')]['bind'](this));ami['on'](_0x9fdf('0xa'),this['syncHangupRequest'][_0x9fdf('0xb')](this));ami['on'](_0x9fdf('0xc'),this[_0x9fdf('0xd')][_0x9fdf('0xb')](this));ami['on'](_0x9fdf('0xe'),this[_0x9fdf('0xf')][_0x9fdf('0xb')](this));ami['on'](_0x9fdf('0x10'),this[_0x9fdf('0x11')]['bind'](this));ami['on'](_0x9fdf('0x12'),this[_0x9fdf('0x13')][_0x9fdf('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x9fdf('0x14')]['bind'](this));}function getDiff(_0x43dcf5){var _0x165c6d=moment()[_0x9fdf('0x15')](0x0);var _0x3c9f5f=moment(_0x43dcf5)[_0x9fdf('0x15')](0x0);return _0x165c6d[_0x9fdf('0x16')](_0x3c9f5f,'seconds');}Acw['prototype']['updateAcw']=function(_0x1575d2,_0x106595){var _0x4f5882=this;var _0x415e8f=getDiff(_0x4f5882[_0x9fdf('0x6')][_0x1575d2][_0x9fdf('0x17')]);clearTimeout(_0x4f5882[_0x9fdf('0x6')][_0x1575d2]['timer']);_0x4f5882[_0x9fdf('0x6')][_0x1575d2][_0x9fdf('0x18')]=![];return RpcVoiceAgentReport[_0x9fdf('0x19')]({'acwtime':_0x415e8f},_0x4f5882['timers'][_0x1575d2][_0x9fdf('0x1a')],_0x1575d2)[_0x9fdf('0x1b')](function(_0x160a5c){logger[_0x9fdf('0x1c')](_0x9fdf('0x1d'),_0x106595,_0x415e8f,_0x160a5c);})[_0x9fdf('0x1e')](function(_0x1b216a){logger[_0x9fdf('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x106595,_0x1b216a);})[_0x9fdf('0x20')](function(){delete _0x4f5882[_0x9fdf('0x6')][_0x1575d2];});};Acw['prototype'][_0x9fdf('0x21')]=function(_0x3041e8){try{var _0x1dc005=this;var _0x10d838=this[_0x9fdf('0x7')][_0x3041e8][_0x9fdf('0x22')];var _0x3fef5b=this[_0x9fdf('0x7')][_0x3041e8][_0x9fdf('0x23')];var _0x77ab31=this[_0x9fdf('0x4')][_0x3fef5b];var _0x3f7cc3=![];var _0x83eaad='ACW';if(_0x77ab31[_0x9fdf('0x24')]&&_0x77ab31['mandatoryDispositionPause'][_0x9fdf('0x25')]){_0x3f7cc3=!![];_0x83eaad=_0x77ab31['mandatoryDispositionPause']['name'];}return ami[_0x9fdf('0x26')]({'action':_0x9fdf('0x27'),'interface':_0x10d838,'paused':!![],'reason':_0x83eaad})[_0x9fdf('0x1b')](function(){if(_0x1dc005['agents'][_0x10d838]){return RpcUser[_0x9fdf('0x28')](_0x1dc005['agents'][_0x10d838]['id'])['then'](function(_0x1a3a2d){if(!_0x1a3a2d||_0x1a3a2d[_0x9fdf('0x29')]){logger[_0x9fdf('0x1c')](_0x9fdf('0x2a'),_0x3041e8,_0x10d838,_0x3fef5b);return;}logger[_0x9fdf('0x1c')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x3041e8,_0x10d838,_0x3fef5b);var _0x3a374d=_0x1dc005[_0x9fdf('0x7')][_0x3041e8][_0x9fdf('0x2b')]&&_0x1dc005[_0x9fdf('0x7')][_0x3041e8]['destlinkedid']?_0x1dc005['channels'][_0x3041e8][_0x9fdf('0x2c')]:_0x3041e8;return RpcUser[_0x9fdf('0x2d')](_0x1dc005[_0x9fdf('0x5')][_0x10d838],_0x83eaad,_0x3a374d)[_0x9fdf('0x1b')](function(_0x4308d0){_0x1dc005[_0x9fdf('0x4')][_0x3fef5b]['available']-=0x1;_0x1dc005[_0x9fdf('0x4')][_0x3fef5b][_0x9fdf('0x2e')]+=0x1;return _0x4308d0;});})[_0x9fdf('0x1b')](function(_0x4a73c5){if(_0x3f7cc3||!_0x4a73c5){return;}_0x1dc005[_0x9fdf('0x6')][_0x10d838]={};logger[_0x9fdf('0x1c')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3041e8,_0x1dc005[_0x9fdf('0x4')][_0x3fef5b][_0x9fdf('0x2f')],_0x10d838,_0x3fef5b);_0x1dc005['timers'][_0x10d838][_0x9fdf('0x18')]=setTimeout(_0x1dc005['stopAcw']['bind'](_0x1dc005,_0x10d838),_0x1dc005[_0x9fdf('0x4')][_0x3fef5b][_0x9fdf('0x2f')]*0x3e8);_0x1dc005[_0x9fdf('0x6')][_0x10d838]['lastPauseAt']=moment()['format'](_0x9fdf('0x30'));_0x1dc005[_0x9fdf('0x6')][_0x10d838]['uniqueid']=_0x3041e8;_0x1dc005[_0x9fdf('0x6')][_0x10d838][_0x9fdf('0x23')]=_0x3fef5b;_0x1dc005[_0x9fdf('0x6')][_0x10d838][_0x9fdf('0x31')]=_0x1dc005['updateAcw'][_0x9fdf('0xb')](_0x1dc005,_0x10d838,_0x3041e8);});}})[_0x9fdf('0x1e')](function(){logger['error'](_0x9fdf('0x32'),_0x3041e8,_0x1dc005['voiceQueues'][_0x3fef5b][_0x9fdf('0x2f')],_0x10d838,_0x3fef5b);})['finally'](function(){delete _0x1dc005[_0x9fdf('0x7')][_0x3041e8];});}catch(_0x31aa4e){logger[_0x9fdf('0x1f')](_0x9fdf('0x33'),_0x31aa4e[_0x9fdf('0x34')]);}};Acw[_0x9fdf('0x35')]['stopAcw']=function(_0x374f92){try{var _0x2c9d68=this;if(_0x2c9d68[_0x9fdf('0x6')][_0x374f92]){_0x2c9d68[_0x9fdf('0x6')][_0x374f92][_0x9fdf('0x18')]=![];var _0x11227a=_0x2c9d68[_0x9fdf('0x6')][_0x374f92][_0x9fdf('0x1a')];var _0x404771=_0x2c9d68[_0x9fdf('0x6')][_0x374f92]['queue'];var _0x1bec75=_0x2c9d68[_0x9fdf('0x4')][_0x404771]['acwTimeout'];logger[_0x9fdf('0x1c')]('[%s][TIMER][STOP][AGENT:%s]',_0x11227a,_0x374f92);RpcUser[_0x9fdf('0x28')](this[_0x9fdf('0x5')][_0x374f92]['id'])[_0x9fdf('0x1b')](function(_0x52629b){if(_0x52629b[_0x9fdf('0x36')]==='ACW'){return RpcUser['saveUnpause'](_0x2c9d68[_0x9fdf('0x5')][_0x374f92]);}});RpcVoiceAgentReport['update']({'acwtime':_0x1bec75,'agentacw':!![]},_0x11227a,_0x374f92)[_0x9fdf('0x1b')](function(_0x3061ff){logger[_0x9fdf('0x1c')](_0x9fdf('0x1d'),_0x11227a,_0x1bec75,_0x3061ff);})[_0x9fdf('0x1e')](function(_0x2dac9d){logger[_0x9fdf('0x1f')](_0x9fdf('0x37'),_0x11227a,_0x2dac9d);});}else{logger[_0x9fdf('0x1f')](_0x9fdf('0x38'),_0x374f92);if(_0x2c9d68['timers']){logger[_0x9fdf('0x1c')]('[ACW][TIMERS]',JSON[_0x9fdf('0x39')](_0x2c9d68['timers']));}}}catch(_0x2ef890){logger[_0x9fdf('0x1f')](_0x9fdf('0x3a'),_0x2ef890[_0x9fdf('0x34')]);}};Acw[_0x9fdf('0x35')][_0x9fdf('0x9')]=function(_0x1508c5){try{if(this[_0x9fdf('0x4')][_0x1508c5[_0x9fdf('0x23')]]&&(this[_0x9fdf('0x4')][_0x1508c5[_0x9fdf('0x23')]][_0x9fdf('0x3b')]||this[_0x9fdf('0x4')][_0x1508c5[_0x9fdf('0x23')]][_0x9fdf('0x24')])){if(this[_0x9fdf('0x5')][_0x1508c5[_0x9fdf('0x22')]]){this[_0x9fdf('0x7')][_0x1508c5[_0x9fdf('0x1a')]]={'queue':_0x1508c5[_0x9fdf('0x23')],'interface':_0x1508c5[_0x9fdf('0x22')],'destlinkedid':_0x1508c5[_0x9fdf('0x2c')]};}}}catch(_0x4f3126){logger[_0x9fdf('0x1f')](_0x9fdf('0x3c'),_0x4f3126['message']);}};Acw[_0x9fdf('0x35')][_0x9fdf('0x14')]=function(_0x55c4c0){try{if(this[_0x9fdf('0x4')][_0x55c4c0[_0x9fdf('0x23')]]&&(this[_0x9fdf('0x4')][_0x55c4c0['queue']][_0x9fdf('0x3b')]||this[_0x9fdf('0x4')][_0x55c4c0[_0x9fdf('0x23')]][_0x9fdf('0x24')])){if(this[_0x9fdf('0x5')][_0x55c4c0[_0x9fdf('0x22')]]){this[_0x9fdf('0x7')][_0x55c4c0[_0x9fdf('0x1a')]]={'queue':_0x55c4c0[_0x9fdf('0x23')],'interface':_0x55c4c0[_0x9fdf('0x22')]};}}}catch(_0x452c30){logger[_0x9fdf('0x1f')](_0x9fdf('0x3d'),_0x452c30[_0x9fdf('0x34')]);}};Acw[_0x9fdf('0x35')][_0x9fdf('0x3e')]=function(_0xac18e){try{if(this[_0x9fdf('0x7')][_0xac18e[_0x9fdf('0x1a')]]&&_[_0x9fdf('0x3f')](this[_0x9fdf('0x7')][_0xac18e[_0x9fdf('0x1a')]]['attended'])){logger['info'](_0x9fdf('0x40'),_0xac18e['uniqueid']);this[_0x9fdf('0x21')](_0xac18e[_0x9fdf('0x1a')]);}else if(this['channels'][_0xac18e[_0x9fdf('0x41')]]&&_['isUndefined'](this[_0x9fdf('0x7')][_0xac18e[_0x9fdf('0x41')]][_0x9fdf('0x2b')])){logger[_0x9fdf('0x1c')](_0x9fdf('0x42'),_0xac18e['linkedid']);this['startAcw'](_0xac18e[_0x9fdf('0x41')]);}}catch(_0x53edd0){logger[_0x9fdf('0x1f')]('[ACW][syncHangupRequest]\x20%s',_0x53edd0[_0x9fdf('0x34')]);}};Acw['prototype'][_0x9fdf('0xd')]=function(_0x310640){try{if(this['channels'][_0x310640[_0x9fdf('0x1a')]]&&this[_0x9fdf('0x7')][_0x310640[_0x9fdf('0x1a')]][_0x9fdf('0x2b')]){logger[_0x9fdf('0x1c')](_0x9fdf('0x43'),_0x310640['uniqueid']);this['startAcw'](_0x310640[_0x9fdf('0x1a')]);}else if(this[_0x9fdf('0x7')][_0x310640['linkedid']]&&this[_0x9fdf('0x7')][_0x310640[_0x9fdf('0x41')]]['attended']){logger[_0x9fdf('0x1c')](_0x9fdf('0x44'),_0x310640['linkedid']);this[_0x9fdf('0x21')](_0x310640[_0x9fdf('0x41')]);}}catch(_0x2a2072){logger[_0x9fdf('0x1f')](_0x9fdf('0x45'),_0x2a2072[_0x9fdf('0x34')]);}};Acw['prototype'][_0x9fdf('0x11')]=function(_0x506f67){try{if(!_[_0x9fdf('0x46')](this[_0x9fdf('0x7')][_0x506f67[_0x9fdf('0x47')]])){this[_0x9fdf('0x21')](_0x506f67[_0x9fdf('0x47')]);if(this[_0x9fdf('0x7')][_0x506f67[_0x9fdf('0x48')]]){this[_0x9fdf('0x7')][_0x506f67[_0x9fdf('0x48')]][_0x9fdf('0x2b')]=!![];this[_0x9fdf('0x7')][_0x506f67['transfertargetuniqueid']]=this['channels'][_0x506f67[_0x9fdf('0x48')]];delete this[_0x9fdf('0x7')][_0x506f67[_0x9fdf('0x48')]];}}else if(!_[_0x9fdf('0x46')](this[_0x9fdf('0x7')][_0x506f67[_0x9fdf('0x49')]])){this['startAcw'](_0x506f67[_0x9fdf('0x49')]);if(this['channels'][_0x506f67[_0x9fdf('0x4a')]]){this[_0x9fdf('0x7')][_0x506f67['origtransfereruniqueid']][_0x9fdf('0x2b')]=!![];this[_0x9fdf('0x7')][_0x506f67['transfereeuniqueid']]=this['channels'][_0x506f67['origtransfereruniqueid']];delete this['channels'][_0x506f67['origtransfereruniqueid']];}}}catch(_0x2915c6){logger[_0x9fdf('0x1f')]('[ACW][syncAttendedTransfer]\x20%s',_0x2915c6[_0x9fdf('0x34')]);}};Acw[_0x9fdf('0x35')][_0x9fdf('0x13')]=function(_0x3e86c5){try{if(this[_0x9fdf('0x7')][_0x3e86c5[_0x9fdf('0x4b')]]){logger[_0x9fdf('0x1c')](_0x9fdf('0x4c'),JSON[_0x9fdf('0x39')](_0x3e86c5[_0x9fdf('0x4b')]));this['startAcw'](_0x3e86c5[_0x9fdf('0x4b')]);}else if(this['channels'][_0x3e86c5[_0x9fdf('0x4d')]]){logger[_0x9fdf('0x1c')](_0x9fdf('0x4e'),JSON[_0x9fdf('0x39')](_0x3e86c5[_0x9fdf('0x4d')]));this[_0x9fdf('0x21')](_0x3e86c5['transfererlinkedid']);}}catch(_0x5e0c58){logger[_0x9fdf('0x1f')](_0x9fdf('0x4f'),_0x5e0c58[_0x9fdf('0x34')]);}};Acw[_0x9fdf('0x35')][_0x9fdf('0xf')]=function(_0x36059a){try{if(this['voiceQueues'][_0x36059a['queue']]&&this[_0x9fdf('0x4')][_0x36059a[_0x9fdf('0x23')]][_0x9fdf('0x50')]===_0x9fdf('0x51')){if(this[_0x9fdf('0x5')][_0x36059a[_0x9fdf('0x22')]]){logger[_0x9fdf('0x1c')](_0x9fdf('0x52'),_0x36059a[_0x9fdf('0x1a')],_0x36059a['interface'],_0x36059a['queue']);return RpcUser[_0x9fdf('0x2d')](this[_0x9fdf('0x5')][_0x36059a['interface']],'Auto-Pause',_0x36059a[_0x9fdf('0x1a')]);}}}catch(_0x8f19b){logger[_0x9fdf('0x1f')](_0x9fdf('0x53'),_0x8f19b['message']);}};module[_0x9fdf('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 8441d9d..a9c39ed 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 _0xdec9=['password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','format','Action','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','catch','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username'];(function(_0xe383e0,_0x2dc8d1){var _0x5f17ee=function(_0x1fc1da){while(--_0x1fc1da){_0xe383e0['push'](_0xe383e0['shift']());}};_0x5f17ee(++_0x2dc8d1);}(_0xdec9,0xab));var _0x9dec=function(_0x3cadee,_0x42a92e){_0x3cadee=_0x3cadee-0x0;var _0xd46158=_0xdec9[_0x3cadee];return _0xd46158;};'use strict';var Manager=require(_0x9dec('0x0'));var BPromise=require(_0x9dec('0x1'));var util=require(_0x9dec('0x2'));var logger=require(_0x9dec('0x3'))(_0x9dec('0x4'));var config=require(_0x9dec('0x5'));var ami=new Manager(config[_0x9dec('0x6')][_0x9dec('0x7')],config['asterisk']['ip'],config[_0x9dec('0x6')][_0x9dec('0x8')],config[_0x9dec('0x6')][_0x9dec('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0x9dec('0xa')](ami[_0x9dec('0xb')]);function error(_0x267f2c){logger[_0x9dec('0xc')](util['format'](_0x9dec('0xd'),config[_0x9dec('0x6')][_0x9dec('0x8')],config[_0x9dec('0x6')]['ip'],config[_0x9dec('0x6')][_0x9dec('0x7')],util['inspect'](_0x267f2c,![],null)));}function close(){logger[_0x9dec('0xc')](util[_0x9dec('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x9dec('0x6')][_0x9dec('0x8')],config[_0x9dec('0x6')]['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x9dec('0xf')]({'action':_0x9dec('0x10')});};};ami[_0x9dec('0x11')]=function(){return function(){return ami[_0x9dec('0xf')]({'action':'devicestatelist'});};};ami[_0x9dec('0x12')]=function(){return function(){return ami['Action']({'action':_0x9dec('0x13')});};};ami[_0x9dec('0x14')]=function(){return function(){return ami[_0x9dec('0xf')]({'action':'queuesummary'});};};ami[_0x9dec('0x15')]=function(){return function(){return ami[_0x9dec('0xf')]({'action':_0x9dec('0x16')});};};function connect(){logger[_0x9dec('0x17')](util[_0x9dec('0xe')](_0x9dec('0x18'),config['asterisk']['username'],config[_0x9dec('0x6')]['ip'],config[_0x9dec('0x6')]['port']));ami[_0x9dec('0x19')]('error',error);ami[_0x9dec('0x19')](_0x9dec('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x9dec('0x1b'),function(_0x2945d9){logger[_0x9dec('0x17')](util[_0x9dec('0xe')](_0x9dec('0x1c'),config[_0x9dec('0x6')]['username'],config[_0x9dec('0x6')]['ip'],config[_0x9dec('0x6')][_0x9dec('0x7')],util[_0x9dec('0x1d')](_0x2945d9,![],null)));});ami['on']('fullybooted',function(){logger[_0x9dec('0x17')](util['format'](_0x9dec('0x1e'),config[_0x9dec('0x6')][_0x9dec('0x8')],config['asterisk']['ip'],config[_0x9dec('0x6')]['port']));return Promise[_0x9dec('0x1f')]()[_0x9dec('0x20')](ami[_0x9dec('0x21')]())['then'](ami['actionDeviceStateList']())[_0x9dec('0x20')](ami[_0x9dec('0x12')]())[_0x9dec('0x20')](ami['actionQueueSummary']())[_0x9dec('0x20')](ami[_0x9dec('0x15')]())[_0x9dec('0x22')](function(_0x32b185){logger[_0x9dec('0xc')]('[ami.js][fullybooted]',util[_0x9dec('0x1d')](_0x32b185,{'showHidden':![],'depth':null}));});});ami[_0x9dec('0x19')](_0x9dec('0xc'),error);ami[_0x9dec('0x19')]('close',close);module[_0x9dec('0x23')]=ami; \ No newline at end of file +var _0xfcf8=['catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','asterisk','port','username','password','keepConnected','Action','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','format','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','actionQueueSummary'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0xfcf8,0xf1));var _0x8fcf=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xfcf8[_0x1035c1];return _0x308d67;};'use strict';var Manager=require(_0x8fcf('0x0'));var BPromise=require(_0x8fcf('0x1'));var util=require('util');var logger=require(_0x8fcf('0x2'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x8fcf('0x3')][_0x8fcf('0x4')],config['asterisk']['ip'],config[_0x8fcf('0x3')][_0x8fcf('0x5')],config[_0x8fcf('0x3')][_0x8fcf('0x6')],!![]);ami[_0x8fcf('0x7')]();ami[_0x8fcf('0x8')]=BPromise['promisify'](ami[_0x8fcf('0x9')]);function error(_0x5601c7){logger[_0x8fcf('0xa')](util['format'](_0x8fcf('0xb'),config[_0x8fcf('0x3')][_0x8fcf('0x5')],config[_0x8fcf('0x3')]['ip'],config[_0x8fcf('0x3')][_0x8fcf('0x4')],util['inspect'](_0x5601c7,![],null)));}function close(){logger['error'](util[_0x8fcf('0xc')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x8fcf('0x3')][_0x8fcf('0x5')],config[_0x8fcf('0x3')]['ip'],config['asterisk'][_0x8fcf('0x4')]));}ami[_0x8fcf('0xd')]=function(){return function(){return ami[_0x8fcf('0x8')]({'action':_0x8fcf('0xe')});};};ami[_0x8fcf('0xf')]=function(){return function(){return ami[_0x8fcf('0x8')]({'action':_0x8fcf('0x10')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x8fcf('0x8')]({'action':_0x8fcf('0x11')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x8fcf('0x8')]({'action':_0x8fcf('0x12')});};};ami[_0x8fcf('0x13')]=function(){return function(){return ami[_0x8fcf('0x8')]({'action':_0x8fcf('0x14')});};};function connect(){logger[_0x8fcf('0x15')](util[_0x8fcf('0xc')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x8fcf('0x3')][_0x8fcf('0x5')],config[_0x8fcf('0x3')]['ip'],config[_0x8fcf('0x3')][_0x8fcf('0x4')]));ami[_0x8fcf('0x16')](_0x8fcf('0xa'),error);ami[_0x8fcf('0x16')](_0x8fcf('0x17'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x484eb4){logger[_0x8fcf('0x15')](util[_0x8fcf('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x8fcf('0x3')]['username'],config[_0x8fcf('0x3')]['ip'],config['asterisk'][_0x8fcf('0x4')],util[_0x8fcf('0x18')](_0x484eb4,![],null)));});ami['on'](_0x8fcf('0x19'),function(){logger[_0x8fcf('0x15')](util['format'](_0x8fcf('0x1a'),config[_0x8fcf('0x3')][_0x8fcf('0x5')],config[_0x8fcf('0x3')]['ip'],config[_0x8fcf('0x3')][_0x8fcf('0x4')]));return Promise[_0x8fcf('0x1b')]()[_0x8fcf('0x1c')](ami['actionSipShowRegistry']())[_0x8fcf('0x1c')](ami[_0x8fcf('0xf')]())['then'](ami[_0x8fcf('0x1d')]())[_0x8fcf('0x1c')](ami[_0x8fcf('0x1e')]())[_0x8fcf('0x1c')](ami['actionCoreShowChannels']())[_0x8fcf('0x1f')](function(_0x995fc2){logger['error'](_0x8fcf('0x20'),util[_0x8fcf('0x18')](_0x995fc2,{'showHidden':![],'depth':null}));});});ami[_0x8fcf('0x16')](_0x8fcf('0xa'),error);ami[_0x8fcf('0x16')](_0x8fcf('0x17'),close);module[_0x8fcf('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index c862046..8ea7d07 100644 --- a/server/services/ami/client.js +++ b/server/services/ami/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x32c9b9,_0x21a0cf){var _0x239eab=function(_0x25fceb){while(--_0x25fceb){_0x32c9b9['push'](_0x32c9b9['shift']());}};_0x239eab(++_0x21a0cf);}(_0xac4a,0x13f));var _0xaac4=function(_0x43715f,_0x199b77){_0x43715f=_0x43715f-0x0;var _0x52244d=_0xac4a[_0x43715f];return _0x52244d;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xda3f,0xec));var _0xfda3=function(_0x1f2741,_0x402d08){_0x1f2741=_0x1f2741-0x0;var _0x40904f=_0xda3f[_0x1f2741];return _0x40904f;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 7df1cfb..7f36da8 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 _0x9751=['stringify','Interval','Intervals','NULL_INTERVAL','isEmpty','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','Action','then','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','resolve','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','power','handlePower','dialPowerLevel','Queue','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','queue','uniqueId','uniqueid','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','getSeconds','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','minutes','VoiceQueueId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','roundrobin','isNil','locked','paused','stateinterface','rrmemory','merge','pick','idHopper','run','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','preview','[Catch][Preview][syncQueueStatusComplete]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','response','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','membername','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','countmachineretry','dialMachineRetryFrequency','[rescheduleContact][Machine]','value','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countagentrejectretry','dialGlobalMaxRetry','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','cause-txt','Normal\x20Clearing','outboundUnknownCallsDay','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','enqueue','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','notFound','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','Trunk','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','trim','substring','dialPrefix','dialCutDigit','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countnosuchnumberretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalAvailable','round','predictiveIntervalMinThreshold','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','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(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','busyFactor','startMethodPredictive','floor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','temp','NO_AVAILABLE_CONTACTS','RUNNING','Contact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','dialOrderByScheduledAt','checkContactEmpty','countReScheduled','emptyContact','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','interval\x20=\x20','Amax\x20=\x20','erlangb','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]'];(function(_0x4fecd5,_0x51490c){var _0x8091c7=function(_0x492211){while(--_0x492211){_0x4fecd5['push'](_0x4fecd5['shift']());}};_0x8091c7(++_0x51490c);}(_0x9751,0x1b3));var _0x1975=function(_0x4517cf,_0x3aaaca){_0x4517cf=_0x4517cf-0x0;var _0x408bf4=_0x9751[_0x4517cf];return _0x408bf4;};'use strict';var util=require(_0x1975('0x0'));var _=require(_0x1975('0x1'));var uuid=require(_0x1975('0x2'));var moment=require(_0x1975('0x3'));var rr=require('rr');var Redis=require(_0x1975('0x4'));var utils=require(_0x1975('0x5'));var hopperUtils=require(_0x1975('0x6'));var ut=require(_0x1975('0x7'));var config=require(_0x1975('0x8'));var logger=require(_0x1975('0x9'))(_0x1975('0xa'));var loggerBooked=require(_0x1975('0x9'))(_0x1975('0xb'));var loggerPredictive=require(_0x1975('0x9'))('predictive');var loggerPredictiveCalls=require(_0x1975('0x9'))(_0x1975('0xc'));var loggerSyncQueueSummary=require(_0x1975('0x9'))(_0x1975('0xd'));var ami=require(_0x1975('0xe'));config[_0x1975('0xf')]=_['defaults'](config['redis'],{'host':_0x1975('0x10'),'port':0x18eb});var io=require(_0x1975('0x11'))(new Redis(config[_0x1975('0xf')]));var cmHopper=require(_0x1975('0x12'));var voiceQueueRt=require(_0x1975('0x13'));var RpcSetting=require(_0x1975('0x14'));var Interval=require('../rpc/interval');var Action=require(_0x1975('0x15'));var History=require(_0x1975('0x16'));var Final=require(_0x1975('0x17'));var AgentComplete=require(_0x1975('0x18'));var QueueCallerAbandon=require(_0x1975('0x19'));var Hangup=require(_0x1975('0x1a'));var ipAgi=process[_0x1975('0x1b')][_0x1975('0x1c')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1975('0x1d')]['enqueue']=function(_0x1267bf){this[_0x1975('0x1e')]=this[_0x1975('0x1e')]?this[_0x1975('0x1e')][_0x1975('0x1f')](_0x1267bf):_0x1267bf();};function Dialer(_0x222852,_0x3f0b05){this[_0x1975('0x20')]=new Sequence();this['preview']=_0x3f0b05;this[_0x1975('0x21')]=_0x222852[_0x1975('0x21')];this['campaigns']=_0x222852[_0x1975('0x22')];this[_0x1975('0x23')]=_0x222852[_0x1975('0x23')];this['trunks']=_0x222852[_0x1975('0x24')];this[_0x1975('0x25')]=config[_0x1975('0x25')]||0x2;this[_0x1975('0x26')]={};this[_0x1975('0x27')]={};this[_0x1975('0x28')]={};this['uniqueId']={};this[_0x1975('0x29')]={};this[_0x1975('0x2a')]={};this[_0x1975('0x2b')]={};this['ivrOriginated']={};this[_0x1975('0x2c')]={};this[_0x1975('0x2d')]={};this[_0x1975('0x2e')]={};ami['on'](_0x1975('0x2f'),this[_0x1975('0x30')][_0x1975('0x31')](this));ami['on'](_0x1975('0x32'),this[_0x1975('0x33')][_0x1975('0x31')](this));ami['on'](_0x1975('0x34'),this[_0x1975('0x35')][_0x1975('0x31')](this));ami['on'](_0x1975('0x36'),this[_0x1975('0x37')][_0x1975('0x31')](this));ami['on'](_0x1975('0x38'),this[_0x1975('0xd')][_0x1975('0x31')](this));ami['on'](_0x1975('0x39'),this[_0x1975('0x3a')][_0x1975('0x31')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x1975('0x3b'),this[_0x1975('0x3c')][_0x1975('0x31')](this));ami['on']('varset',this[_0x1975('0x3d')]['bind'](this));ami['on'](_0x1975('0x3e'),this[_0x1975('0x3f')][_0x1975('0x31')](this));ami['on'](_0x1975('0x40'),this[_0x1975('0x41')]['bind'](this));this[_0x1975('0x42')]();this[_0x1975('0x43')]();RpcSetting[_0x1975('0x44')]()['then'](function(_0x23e509){previewRecallmeReminderInterval=_0x23e509[_0x1975('0x45')];});}function isNotNull(_0x466811){return _0x466811!==null&&!_['isUndefined'](_0x466811);}function msgResponse(_0xc94374,_0x5f251d,_0x37fe92){return{'action':_0xc94374,'response':_0x5f251d,'message':_0x37fe92,'stack':_0x37fe92};}function emit(_0x12c769,_0x783a3,_0x535792){io['to'](_0x12c769)[_0x1975('0x46')](_0x783a3,_0x535792);}function emitOutboundVoiceQueueSummary(_0x356ce7){if(_0x356ce7[_0x1975('0x47')]===_0x1975('0x48')){logger[_0x1975('0x49')](_0x1975('0x4a'),util['inspect'](_0x356ce7,{'showHidden':![],'depth':null}));emit(util[_0x1975('0x4b')](_0x1975('0x4c'),_0x356ce7[_0x1975('0x4d')]),_0x1975('0x4e'),_0x356ce7);}}function checkGetDataPredictive(_0x454b82){if(isNotNull(_0x454b82)&&!_['isEmpty'](_0x454b82)){loggerPredictive[_0x1975('0x4f')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x1975('0x4f')](_0x1975('0x50'),_0x454b82[_0x1975('0x51')]);loggerPredictive[_0x1975('0x4f')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x454b82[_0x1975('0x52')]);loggerPredictive['info'](_0x1975('0x53'),_0x454b82[_0x1975('0x54')]);loggerPredictive[_0x1975('0x4f')](_0x1975('0x55'),_0x454b82[_0x1975('0x56')]);loggerPredictive['info'](_0x1975('0x57'),_0x454b82[_0x1975('0x58')]);loggerPredictive['info'](_0x1975('0x59'),_0x454b82[_0x1975('0x5a')]);loggerPredictive[_0x1975('0x4f')](_0x1975('0x5b'));if(_0x454b82[_0x1975('0x51')]>0x0){if(!_[_0x1975('0x5c')](_0x454b82[_0x1975('0x5a')])&&_0x454b82[_0x1975('0x5a')]>0x0){return!![];}loggerPredictive['info'](_0x1975('0x5d'));if(!_[_0x1975('0x5c')](_0x454b82[_0x1975('0x58')])&&_0x454b82[_0x1975('0x58')]>0x0){return!![];}loggerPredictive[_0x1975('0x4f')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x1975('0x5e'));}}else{loggerPredictive['info'](_0x1975('0x5f'));}return![];}function mergeDataErlangB(_0x1c7e4c){return function(_0x3f84c2){loggerPredictive['info'](_0x1975('0x60'));loggerPredictive[_0x1975('0x4f')](_0x1975('0x61'),_0x3f84c2['erlangCalls']);loggerPredictive[_0x1975('0x4f')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3f84c2[_0x1975('0x62')]);loggerPredictive[_0x1975('0x4f')](_0x1975('0x63'),_0x3f84c2[_0x1975('0x64')]);loggerPredictive[_0x1975('0x4f')](_0x1975('0x65'),_0x3f84c2['erlangBusyFactor']);loggerPredictive[_0x1975('0x4f')](_0x1975('0x63'),_0x3f84c2[_0x1975('0x64')]);loggerPredictive['info'](_0x1975('0x5b'));_['merge'](_0x1c7e4c,_0x3f84c2);};}function ifInterval(_0x118210,_0x4f2625){if(_[_0x1975('0x5c')](_0x4f2625)){return![];}return utils['getSeconds'](undefined,_0x4f2625)<_0x118210*0x3c;}function clearPredictiveAttributes(_0x544186){if(_0x544186[_0x1975('0x2b')]){_0x544186['startProgressive']=undefined;loggerPredictive[_0x1975('0x49')](_0x544186[_0x1975('0x4d')],'startProgressive\x20value\x20cleared');}if(_0x544186[_0x1975('0x2a')]){_0x544186['startPredictive']=undefined;loggerPredictive['debug'](_0x544186[_0x1975('0x4d')],_0x1975('0x66'));}if(_0x544186[_0x1975('0x67')]){clearInterval(_0x544186[_0x1975('0x67')]);_0x544186[_0x1975('0x67')]=undefined;loggerPredictive['debug'](_0x544186[_0x1975('0x4d')],_0x1975('0x68'));}}function loggerCatchPredictive(_0x38a227,_0x40087f){return function(_0x4c2059){loggerPredictive[_0x1975('0x69')](_0x40087f[_0x1975('0x4d')],_0x38a227);loggerPredictive[_0x1975('0x69')](_0x4c2059[_0x1975('0x6a')]);clearPredictiveAttributes(_0x40087f);};}function loggerCatch(_0x3e6e70){return function(_0x4c0e94){logger[_0x1975('0x69')](_0x3e6e70,util[_0x1975('0x6b')](_0x4c0e94,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x12056c,_0x547deb,_0x5b7349){return function(_0xe5ab50){utils[_0x1975('0x6c')](_0x547deb,_0x5b7349,0x0);_0x547deb['temp']=0x0;logger[_0x1975('0x69')](_0x12056c,util[_0x1975('0x6b')](_0xe5ab50,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x340f66){return function(_0x2df196){if(isNotNull(_0x2df196)&&isNotNull(_0x2df196[0x0])){if(_0x2df196[0x0][_0x1975('0x6d')]>0x0){_0x340f66[_0x1975('0x6e')]=utils[_0x1975('0x6f')][_0x1975('0x70')];logger[_0x1975('0x4f')](_0x1975('0x71')+_0x340f66[_0x1975('0x4d')],_0x2df196[0x0]['contactsRescheduled'],'contacts');}else{_0x340f66[_0x1975('0x6e')]=utils[_0x1975('0x6f')]['NO_AVAILABLE_CONTACTS'];logger[_0x1975('0x4f')](_0x1975('0x72')+_0x340f66[_0x1975('0x4d')]);}}};}function createObjHistory(_0x47e128,_0x5480ec,_0x14eda5,_0x13abb1,_0x3183f6){_0x47e128[_0x1975('0x6e')]=_0x14eda5;var _0x39936c=new Action(_0x47e128,_0x5480ec);var _0x5182b4=new History(_0x39936c);_0x5182b4[_0x1975('0x73')]=_0x13abb1;_0x5182b4[_0x1975('0x74')]=_0x3183f6;_0x5182b4[_0x1975('0x75')]=_0x39936c[_0x1975('0x76')];return _0x5182b4;}function unlockQueueStatus(_0x376547,_0x4d1126){setTimeout(function(){if(_['isUndefined'](_0x376547[_0x1975('0x77')])){loggerBooked[_0x1975('0x69')](_0x1975('0x78'),_0x4d1126);}_0x376547['queueStatusComplete']=!![];loggerBooked[_0x1975('0x4f')](_0x1975('0x79'),_0x4d1126,JSON[_0x1975('0x7a')](_['pick'](_0x376547,[_0x1975('0x4d'),_0x1975('0x77')])));},0x1f3);}function checkInterval(_0x230b43){return function(){if(!isNotNull(_0x230b43[_0x1975('0x7b')])){_0x230b43[_0x1975('0x6e')]=utils[_0x1975('0x6f')]['NULL_INTERVAL'];throw _0x230b43[_0x1975('0x4d')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x230b43[_0x1975('0x7b')][_0x1975('0x7c')])){_0x230b43[_0x1975('0x6e')]=utils[_0x1975('0x6f')][_0x1975('0x7d')];throw _0x230b43[_0x1975('0x4d')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x1975('0x7e')](_0x230b43[_0x1975('0x7b')]['Intervals']))){_0x230b43[_0x1975('0x6e')]=utils[_0x1975('0x6f')]['NULL_INTERVAL'];throw _0x230b43[_0x1975('0x4d')]+_0x1975('0x7f');}};}function checkIsIVRCampaignActive(_0x535938){return function(){if(!utils[_0x1975('0x80')](_0x535938)){_0x535938[_0x1975('0x6e')]=utils['CAMPAIGN_STATUS'][_0x1975('0x81')];throw _0x535938[_0x1975('0x4d')]+_0x1975('0x82');}};}function emitCampaignSummary(_0x5b8df0){if(utils[_0x1975('0x83')](_0x5b8df0)){emit(util[_0x1975('0x4b')](_0x1975('0x84'),_0x5b8df0[_0x1975('0x4d')]),_0x1975('0x85'),_0x5b8df0);}}function loggerCatchQueueSummary(_0xcd510c,_0x31bcff){return function(_0x2584e5){clearPredictiveAttributes(_0x31bcff);emitCampaignSummary(_0x31bcff);loggerSyncQueueSummary[_0x1975('0x49')](_0xcd510c,util['inspect'](_0x2584e5,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2a53ae){if(_0x2a53ae[_0x1975('0x86')]){if(_0x2a53ae[_0x1975('0x87')]===0x0){_0x2a53ae[_0x1975('0x86')]=![];_0x2a53ae[_0x1975('0x6e')]=utils[_0x1975('0x6f')][_0x1975('0x81')];loggerSyncQueueSummary[_0x1975('0x49')](_0x1975('0x88'),_0x2a53ae[_0x1975('0x4d')],_0x1975('0x89'));}else{_0x2a53ae[_0x1975('0x6e')]=utils[_0x1975('0x6f')][_0x1975('0x8a')];loggerSyncQueueSummary[_0x1975('0x49')](_0x1975('0x88'),_0x2a53ae[_0x1975('0x4d')],'is\x20disactive');}emitCampaignSummary(_0x2a53ae);}}function myreject(_0x16932f){return function(_0x4646f7){return _0x16932f(msgResponse(_0x1975('0x8b'),_0x1975('0x8c'),JSON[_0x1975('0x7a')](_0x4646f7)));};}Dialer[_0x1975('0x1d')][_0x1975('0x8d')]=function(_0x3bab59){return!_[_0x1975('0x5c')](_0x3bab59)&&_0x3bab59&&!_['isUndefined'](_0x3bab59['name'])&&!_[_0x1975('0x5c')](_0x3bab59[_0x1975('0x8e')])&&_0x3bab59[_0x1975('0x8e')]&&(this[_0x1975('0x24')][util['format'](_0x1975('0x8f'),_0x3bab59[_0x1975('0x4d')])][_0x1975('0x90')]===_0x1975('0x91')||this[_0x1975('0x24')][util[_0x1975('0x4b')](_0x1975('0x8f'),_0x3bab59['name'])][_0x1975('0x90')]===_0x1975('0x92'));};Dialer[_0x1975('0x1d')][_0x1975('0x93')]=function(_0x353ed0){var _0x19961a=this;return function(){if(!_0x19961a['isTrunkReachable'](_0x353ed0['Trunk'])){if(!_0x19961a[_0x1975('0x8d')](_0x353ed0[_0x1975('0x94')])){_0x353ed0[_0x1975('0x6e')]=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x353ed0[_0x1975('0x4d')]+_0x1975('0x95');}}};};Dialer[_0x1975('0x1d')][_0x1975('0x96')]=function(_0x125aeb,_0x103eb8,_0x44ffd5,_0x3fd7ff){var _0x3bc5f9=this;return function(){var _0x25dd0d=!![];return _0x3bc5f9[_0x1975('0x97')](_0x125aeb,_0x103eb8,_0x44ffd5,_0x3fd7ff,_0x25dd0d);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0x1705e2,_0x1e8e64,_0xd8ef5b,_0x529972){var _0x3d73e7=this;return function(){var _0x13fc8a=![];return _0x3d73e7[_0x1975('0x97')](_0x1705e2[_0x1975('0x7c')],_0x1e8e64,_0xd8ef5b,_0x529972,_0x13fc8a);};};Dialer[_0x1975('0x1d')]['ifTimeIvr']=function(_0x22a346,_0x405ee7,_0x110b6f,_0x301479,_0x467599){var _0x31e502=[];return new Promise(function(_0x5673bd,_0x339d1d){if(!isNotNull(_0x22a346)){_0x301479[_0x1975('0x6e')]=utils[_0x1975('0x6f')][_0x1975('0x7d')];return _0x339d1d(msgResponse('ifTime',_0x1975('0x98'),_0x110b6f+_0x1975('0x99')));}if(_['isEmpty'](_0x22a346)){_0x301479[_0x1975('0x6e')]=utils[_0x1975('0x6f')][_0x1975('0x9a')];return _0x339d1d(msgResponse(_0x1975('0x9b'),_0x1975('0x98'),_0x110b6f+_0x1975('0x9c')));}if(_0x405ee7&&_['isUndefined'](config[_0x1975('0x9d')][_0x405ee7])){_0x301479[_0x1975('0x6e')]=utils[_0x1975('0x6f')][_0x1975('0x9e')];return _0x339d1d(msgResponse(_0x1975('0x9b'),'Failure',_0x110b6f+_0x1975('0x9f')+_0x405ee7));}if(_[_0x1975('0xa0')](_0x22a346)){for(var _0x262493=0x0;_0x262493<_0x22a346[_0x1975('0xa1')];_0x262493+=0x1){_0x31e502[_0x1975('0xa2')](ami['Action']({'action':_0x1975('0xa3'),'command':util[_0x1975('0x4b')](_0x1975('0xa4'),_0x22a346[_0x262493][_0x1975('0xa5')],!_[_0x1975('0x5c')](config[_0x1975('0x9d')][_0x405ee7])?_0x405ee7:'')})['then'](function(_0x3a5571){return _0x3a5571[_0x1975('0xa6')][_0x1975('0xa7')](_0x1975('0xa8'))>=0x0;})[_0x1975('0xa9')](myreject(_0x339d1d)));}}else{_0x31e502[_0x1975('0xa2')](ami[_0x1975('0xaa')]({'action':_0x1975('0xa3'),'command':util['format'](_0x1975('0xa4'),_0x22a346,!_[_0x1975('0x5c')](config[_0x1975('0x9d')][_0x405ee7])?_0x405ee7:'')})[_0x1975('0xab')](function(_0x368c8d){return _0x368c8d[_0x1975('0xa6')][_0x1975('0xa7')](_0x1975('0xa8'))>=0x0;})['catch'](myreject(_0x339d1d)));}Promise[_0x1975('0xac')](_0x31e502)[_0x1975('0xab')](function(_0x437cba){var _0x414547=_['some'](_0x437cba);if(_0x414547){return _0x5673bd(_0x414547);}else{_0x301479[_0x1975('0x6e')]=_0x467599?utils[_0x1975('0x6f')][_0x1975('0xad')]:utils[_0x1975('0x6f')][_0x1975('0xae')];return _0x339d1d(msgResponse(_0x1975('0xaf'),'Failure',_0x1975('0xb0')+_0x467599+'\x20'+_0x110b6f+_0x1975('0xb1')+util[_0x1975('0x6b')](_0x22a346,{'showHidden':![],'depth':null})+_0x1975('0xb2')+_0x405ee7));}})['catch'](function(_0x3dc44e){return _0x339d1d(msgResponse('ifTime',_0x1975('0x98'),JSON[_0x1975('0x7a')](_0x3dc44e)));});});};Dialer[_0x1975('0x1d')][_0x1975('0x42')]=function(){var _0x50aaac=this;return cmHopper[_0x1975('0xb3')]({'active':![]},{'where':{'active':!![]}})[_0x1975('0xab')](function(){setInterval(function(){_0x50aaac['syncCampaigns']();},0x3e8);});};Dialer[_0x1975('0x1d')][_0x1975('0xb4')]=function(){var _0x1f4573=this;var _0x135360;for(var _0x50a173 in this['campaigns']){if(typeof this[_0x1975('0x22')][_0x50a173]!=='undefined'){_0x135360=this[_0x1975('0x22')][_0x50a173];if(utils[_0x1975('0x83')](_0x135360)&&utils[_0x1975('0x80')](_0x135360)){_0x135360[_0x1975('0x86')]=!![];Promise[_0x1975('0xb5')]()[_0x1975('0xab')](checkIsIVRCampaignActive(_0x135360))[_0x1975('0xab')](checkInterval(_0x135360))['then'](_0x1f4573['checkIsTrunkReachable'](_0x135360))[_0x1975('0xab')](_0x1f4573[_0x1975('0x96')](_0x135360[_0x1975('0xb6')],_0x135360[_0x1975('0xb7')],_0x135360['name'],_0x135360))[_0x1975('0xab')](_0x1f4573[_0x1975('0xb8')](_0x135360[_0x1975('0x7b')],_0x135360['dialTimezone'],_0x135360[_0x1975('0x4d')],_0x135360))['then'](_0x1f4573[_0x1975('0xb9')](_0x135360))['catch'](loggerCatchQueueSummary(_0x1975('0xba'),_0x135360));}else{notSendMessagesCampaign(_0x135360);}}}};Dialer[_0x1975('0x1d')][_0x1975('0xbb')]=function(_0x1efac8){if(_0x1efac8[_0x1975('0xbc')]!==_0x1975('0xbd')){clearPredictiveAttributes(_0x1efac8);}switch(_0x1efac8['dialMethod']){case _0x1975('0xbe'):this['handlePower'](_0x1efac8,0x1);break;case _0x1975('0xbf'):this[_0x1975('0xc0')](_0x1efac8,_0x1efac8[_0x1975('0xc1')]);break;case _0x1975('0xbd'):this[_0x1975('0xbd')](_0x1efac8);break;case _0x1975('0xb'):this['handlePower'](_0x1efac8,0x1);break;default:logger[_0x1975('0x69')](_0x1975('0xc2'),_0x1efac8['name'],'method\x20not\x20recognized');}};Dialer['prototype'][_0x1975('0x9b')]=function(_0x54664b,_0x596098){var _0x397f3f=_0x54664b[_0x1975('0xb7')];var _0x357bd1=_0x596098?_0x54664b[_0x1975('0xb6')]:_0x54664b[_0x1975('0x7b')][_0x1975('0x7c')];logger['silly']('Dialer::ifTime()',_0x357bd1,_0x397f3f,_0x54664b[_0x1975('0x4d')],util[_0x1975('0x4b')](_0x1975('0xc3'),_0x54664b[_0x1975('0x4d')],_0x54664b['id']));var _0x32c9d9=null;return Interval[_0x1975('0xc4')](_0x357bd1,_0x397f3f)[_0x1975('0xab')](function(_0x149a1d){if(_0x149a1d===!![]){return _0x149a1d;}else{_0x54664b[_0x1975('0x6e')]=_0x596098?utils[_0x1975('0x6f')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x1975('0x6f')][_0x1975('0xae')];_0x32c9d9=msgResponse(_0x1975('0xaf'),'Failure','Global:\x20'+_0x596098+'\x20'+_0x54664b[_0x1975('0x4d')]+_0x1975('0xb1')+util[_0x1975('0x6b')](_0x357bd1,{'showHidden':![],'depth':null})+_0x1975('0xb2')+_0x397f3f);}if(_0x32c9d9!==null){logger['silly'](_0x1975('0xc5'),_0x32c9d9);_0x32c9d9[_0x1975('0xc6')]=_0x596098;throw _0x32c9d9;}})[_0x1975('0xa9')](function(_0x412cc4){logger[_0x1975('0x69')]('AMI\x20IfTime',_0x412cc4);throw msgResponse(_0x1975('0x8b'),_0x1975('0x8c'),util[_0x1975('0x6b')](_0x412cc4,{'showHidden':![],'depth':null}));});};Dialer[_0x1975('0x1d')][_0x1975('0x30')]=function(_0x556c3e){if(this[_0x1975('0x21')][_0x556c3e[_0x1975('0xc7')]]){if(this[_0x1975('0xc8')][_0x556c3e[_0x1975('0xc9')]]&&this[_0x1975('0xc8')][_0x556c3e[_0x1975('0xc9')]]['type']!=='ivr'){this[_0x1975('0xca')](this[_0x1975('0x21')][_0x556c3e['queue']]);this[_0x1975('0xc8')][_0x556c3e['uniqueid']][_0x1975('0xcb')]=moment()[_0x1975('0x4b')](_0x1975('0xcc'));}}};Dialer[_0x1975('0x1d')][_0x1975('0x37')]=function(_0x3d0af3){var _0x50e6a5=this['uniqueId'][_0x3d0af3[_0x1975('0xc9')]];if(this[_0x1975('0x21')][_0x3d0af3[_0x1975('0xc7')]]){if(_0x50e6a5&&_0x50e6a5[_0x1975('0x47')]!==_0x1975('0xcd')){delete this[_0x1975('0xc8')][_0x3d0af3['uniqueid']];this[_0x1975('0x21')][_0x3d0af3['queue']]['outboundAnswerCallsDay']+=0x1;var _0x4c7342=new AgentComplete(_0x50e6a5,_0x3d0af3);if(_0x3d0af3['reason']===_0x1975('0xce')){_0x4c7342[_0x1975('0xcf')]=this['voiceQueues'][_0x3d0af3[_0x1975('0xc7')]]['dialQueueProject2']&&this['voiceQueues'][_0x3d0af3['queue']][_0x1975('0xd0')]?moment()['format'](_0x1975('0xcc')):undefined;}hopperUtils[_0x1975('0xd1')](_0x4c7342)['catch'](loggerCatch(_0x1975('0xd2')));hopperUtils[_0x1975('0xd3')](_0x4c7342)[_0x1975('0xa9')](loggerCatch(_0x1975('0xd4')));}}};Dialer[_0x1975('0x1d')]['syncQueueCallerAbandon']=function(_0x4cb6da){var _0xa55df1=this[_0x1975('0xc8')][_0x4cb6da[_0x1975('0xc9')]];var _0x454343=this;var _0x1b9cf2=![];var _0x1ae5bd;var _0xd809a1;if(this[_0x1975('0x21')][_0x4cb6da[_0x1975('0xc7')]]){if(_0xa55df1&&_0xa55df1['type']!==_0x1975('0xcd')){delete this[_0x1975('0xc8')][_0x4cb6da[_0x1975('0xc9')]];this[_0x1975('0xca')](this['voiceQueues'][_0x4cb6da[_0x1975('0xc7')]]);_0xa55df1[_0x1975('0xd5')]=moment()[_0x1975('0x4b')](_0x1975('0xcc'));var _0x42d204=new QueueCallerAbandon(_0xa55df1,_0x4cb6da);if(utils[_0x1975('0xd6')](_0xa55df1['droptime'],_0xa55df1['responsetime'])>=_0xa55df1[_0x1975('0xd7')]){this['voiceQueues'][_0x4cb6da[_0x1975('0xc7')]][_0x1975('0x54')]+=0x1;this[_0x1975('0x21')][_0x4cb6da[_0x1975('0xc7')]][_0x1975('0xd8')]+=0x1;this[_0x1975('0x21')][_0x4cb6da[_0x1975('0xc7')]][_0x1975('0xd9')]+=0x1;_0x42d204[_0x1975('0x73')]=0xa;_0x42d204[_0x1975('0x74')]='Drop';_0x42d204[_0x1975('0xda')]=_0x1975('0xdb');_0x42d204[_0x1975('0xcf')]=this[_0x1975('0x21')][_0x4cb6da['queue']]['dialQueueProject2']?moment()[_0x1975('0x4b')](_0x1975('0xcc')):undefined;_0x42d204[_0x1975('0xdc')]+=0x1;_0x42d204[_0x1975('0xdd')]+=0x1;_0x1ae5bd=this[_0x1975('0x21')][_0x4cb6da[_0x1975('0xc7')]]['dialDropRetryFrequency'];_0xd809a1=this[_0x1975('0x21')][_0x4cb6da[_0x1975('0xc7')]][_0x1975('0xde')];hopperUtils[_0x1975('0xdf')](_0x42d204,_0x42d204['state'],_0xa55df1[_0x1975('0xe0')])[_0x1975('0xab')](function(_0x1ddc31){_0x1b9cf2=_0x1ddc31[_0x1975('0xe1')]==0x1;if(_0x42d204[_0x1975('0xdc')]>=_0x454343['voiceQueues'][_0x4cb6da[_0x1975('0xc7')]]['dialDropMaxRetry']){_0x454343[_0x1975('0xe2')](_0x42d204,_0x1ddc31[_0x1975('0xe1')]);}else{hopperUtils[_0x1975('0xe3')]({'active':![],'countdropretry':_0x42d204[_0x1975('0xdc')],'scheduledat':moment()[_0x1975('0xe4')](_0x454343[_0x1975('0x21')][_0x4cb6da[_0x1975('0xc7')]][_0x1975('0xe5')],'minutes')[_0x1975('0x4b')](_0x1975('0xcc')),'ContactId':_0xa55df1[_0x1975('0xe6')],'ListId':_0xa55df1[_0x1975('0xe7')],'VoiceQueueId':_0xa55df1['VoiceQueueId']||undefined,'CampaignId':_0xa55df1[_0x1975('0xe8')]||undefined})[_0x1975('0xa9')](loggerCatch(_0x1975('0xe9')));var _0x1f3856=new History(_0x42d204);_0x1f3856[_0x1975('0x73')]=0xa;_0x1f3856[_0x1975('0x74')]=_0x1975('0xea');_0x1f3856[_0x1975('0x76')]=moment()['format'](_0x1975('0xcc'));_0x1f3856[_0x1975('0x75')]=_0x1f3856['starttime'];_0x1f3856['calleridname']=_0x42d204[_0x1975('0xeb')];_0x1f3856[_0x1975('0xec')]=_0x42d204[_0x1975('0xec')];hopperUtils[_0x1975('0xd1')](_0x1f3856)[_0x1975('0xa9')](loggerCatch(_0x1975('0xed')));}})[_0x1975('0xab')](function(){if(_0x1b9cf2)hopperUtils[_0x1975('0xee')](_0x42d204,_0x1ae5bd,_0xd809a1)['then'](function(){return 0x1;});});}else{this[_0x1975('0x21')][_0x4cb6da[_0x1975('0xc7')]][_0x1975('0x56')]+=0x1;this['voiceQueues'][_0x4cb6da[_0x1975('0xc7')]][_0x1975('0xef')]+=0x1;_0x42d204['state']=0xb;_0x42d204[_0x1975('0x74')]=_0x1975('0xf0');_0x42d204[_0x1975('0xda')]='CALLEREXIT';_0x42d204[_0x1975('0xf1')]+=0x1;_0x42d204[_0x1975('0xdd')]+=0x1;_0x1ae5bd=this[_0x1975('0x21')][_0x4cb6da['queue']][_0x1975('0xf2')];_0xd809a1=this[_0x1975('0x21')][_0x4cb6da[_0x1975('0xc7')]][_0x1975('0xde')];hopperUtils[_0x1975('0xdf')](_0x42d204,_0x42d204[_0x1975('0x73')],_0xa55df1[_0x1975('0xe0')])['then'](function(_0x4b8603){if(_0x42d204['countabandonedretry']>=_0x454343[_0x1975('0x21')][_0x4cb6da[_0x1975('0xc7')]][_0x1975('0xf3')]){_0x454343[_0x1975('0xe2')](_0x42d204,_0x4b8603['additional']);}else{hopperUtils[_0x1975('0xe3')]({'active':![],'countabandonedretry':_0x42d204[_0x1975('0xf1')],'scheduledat':moment()[_0x1975('0xe4')](_0x454343[_0x1975('0x21')][_0x4cb6da['queue']][_0x1975('0xf2')],_0x1975('0xf4'))[_0x1975('0x4b')](_0x1975('0xcc')),'ContactId':_0xa55df1[_0x1975('0xe6')],'ListId':_0xa55df1[_0x1975('0xe7')],'VoiceQueueId':_0xa55df1[_0x1975('0xf5')]||undefined,'CampaignId':_0xa55df1[_0x1975('0xe8')]||undefined})['catch'](loggerCatch(_0x1975('0xf6')));var _0x5a54be=new History(_0x42d204);_0x5a54be[_0x1975('0x73')]=0xb;_0x5a54be[_0x1975('0x74')]='Abandoned';_0x5a54be['starttime']=moment()[_0x1975('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a54be[_0x1975('0x75')]=_0x5a54be[_0x1975('0x76')];_0x5a54be[_0x1975('0xeb')]=_0x42d204[_0x1975('0xeb')];_0x5a54be[_0x1975('0xec')]=_0x42d204['calleridnum'];hopperUtils['createHistory'](_0x5a54be)['catch'](loggerCatch(_0x1975('0xf7')));}})[_0x1975('0xab')](function(){if(_0x1b9cf2)hopperUtils['swapAdditionalPhones'](_0x42d204,_0x1ae5bd,_0xd809a1)[_0x1975('0xab')](function(){return 0x1;});});}}}};Dialer[_0x1975('0x1d')][_0x1975('0x3c')]=function(_0x55e905){if(this[_0x1975('0x27')][_0x55e905['uniqueid']]){this['actions'][_0x55e905[_0x1975('0xc9')]][_0x1975('0xf8')]=_0x55e905[_0x1975('0xf8')];}if(this['uniqueId'][_0x55e905[_0x1975('0xc9')]]){this[_0x1975('0xc8')][_0x55e905[_0x1975('0xc9')]][_0x1975('0xf8')]=_0x55e905['channel'];}};Dialer[_0x1975('0x1d')][_0x1975('0x3f')]=function(_0x1c944b){if(!this[_0x1975('0x27')][_0x1c944b[_0x1975('0xf9')]]){return;}var _0x53cb2e=this[_0x1975('0x21')][this[_0x1975('0x27')][_0x1c944b[_0x1975('0xf9')]][_0x1975('0xc7')]][_0x1975('0xfa')]||'rrmemory';if(_0x53cb2e===_0x1975('0xfb')){if(this['actions'][_0x1c944b[_0x1975('0xf9')]]&&_[_0x1975('0xfc')](this[_0x1975('0x27')][_0x1c944b['actionid']][_0x1975('0xfd')])&&_0x1c944b[_0x1975('0x90')]==='1'&&_0x1c944b[_0x1975('0xfe')]==='0'){if(this[_0x1975('0x23')][_0x1c944b[_0x1975('0xff')]]){if(!this['agents'][_0x1c944b[_0x1975('0xff')]][_0x1975('0xfd')]){this[_0x1975('0x23')][_0x1c944b[_0x1975('0xff')]]['locked']=!![];this['actions'][_0x1c944b['actionid']][_0x1975('0xfd')]=!![];this['actions'][_0x1c944b['actionid']][_0x1975('0xff')]=_0x1c944b[_0x1975('0xff')];}}}}else if(_0x53cb2e===_0x1975('0x100')){if(this[_0x1975('0x27')][_0x1c944b['actionid']]){if(this['agents'][_0x1c944b[_0x1975('0xff')]]){this[_0x1975('0x27')][_0x1c944b[_0x1975('0xf9')]][_0x1975('0xff')]=_0x1c944b['stateinterface'];if(_[_0x1975('0xfc')](this[_0x1975('0x2c')][this[_0x1975('0x27')][_0x1c944b[_0x1975('0xf9')]][_0x1975('0xc7')]])){this[_0x1975('0x2c')][this[_0x1975('0x27')][_0x1c944b[_0x1975('0xf9')]][_0x1975('0xc7')]]=[];}this[_0x1975('0x2c')][this['actions'][_0x1c944b[_0x1975('0xf9')]][_0x1975('0xc7')]][_0x1975('0xa2')](_[_0x1975('0x101')](_[_0x1975('0x102')](this[_0x1975('0x27')][_0x1c944b['actionid']],[_0x1975('0x103'),_0x1975('0xff')]),{'status':_0x1c944b[_0x1975('0x90')],'paused':_0x1c944b['paused']}));}}}};Dialer[_0x1975('0x1d')]['syncQueueStatusComplete']=function(_0x300a8a){if(!this[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]]){return;}var _0x115bc1=this;var _0x2997fc=this[_0x1975('0x21')][this[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]][_0x1975('0xc7')]];var _0x536069=_0x2997fc[_0x1975('0xfa')]||_0x1975('0x100');if(_0x536069===_0x1975('0xfb')){if(this['actions'][_0x300a8a[_0x1975('0xf9')]]&&this[_0x1975('0x27')][_0x300a8a['actionid']]['stateinterface']){this['preview'][_0x1975('0x104')](this[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]]['idHopper'],this[_0x1975('0x27')][_0x300a8a['actionid']]['stateinterface'])[_0x1975('0xa9')](function(_0x4895b3){logger[_0x1975('0x69')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x4895b3,{'showHidden':![],'depth':null}));})['finally'](function(){_0x115bc1[_0x1975('0xca')](_0x115bc1[_0x1975('0x21')][_0x115bc1['actions'][_0x300a8a[_0x1975('0xf9')]][_0x1975('0xc7')]]);_0x115bc1[_0x1975('0x23')][_0x115bc1[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]][_0x1975('0xff')]][_0x1975('0xfd')]=![];delete _0x115bc1[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]];unlockQueueStatus(_0x2997fc);});}else{this[_0x1975('0xca')](this['voiceQueues'][this['actions'][_0x300a8a[_0x1975('0xf9')]]['queue']]);hopperUtils[_0x1975('0xe3')]({'active':![],'ContactId':this[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]]['ContactId'],'ListId':this['actions'][_0x300a8a[_0x1975('0xf9')]][_0x1975('0xe7')],'VoiceQueueId':this[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]][_0x1975('0xf5')]||undefined,'CampaignId':this[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]][_0x1975('0xe8')]||undefined})[_0x1975('0xa9')](loggerCatch(_0x1975('0x105')));delete this[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]];unlockQueueStatus(_0x2997fc);}}else if(_0x536069==='rrmemory'){var _0x1826fb;if(this[_0x1975('0x27')][_0x300a8a['actionid']]&&!_[_0x1975('0x7e')](this[_0x1975('0x2c')][this[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]][_0x1975('0xc7')]])){if(this['queueBookedRR'][_0x115bc1[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]][_0x1975('0xc7')]]){this['queueBookedRR'][_0x115bc1[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]]['queue']]=this[_0x1975('0x2d')][this[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]][_0x1975('0xc7')]]?this[_0x1975('0x2d')][this[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]][_0x1975('0xc7')]]:this[_0x1975('0x2c')][this['actions'][_0x300a8a['actionid']][_0x1975('0xc7')]]?this[_0x1975('0x2c')][this[_0x1975('0x27')][_0x300a8a['actionid']][_0x1975('0xc7')]][_0x1975('0x106')]||0x0:0x0;}this[_0x1975('0x2c')][this[_0x1975('0x27')][_0x300a8a[_0x1975('0xf9')]][_0x1975('0xc7')]][_0x1975('0x106')]=this[_0x1975('0x2d')][this[_0x1975('0x27')][_0x300a8a['actionid']][_0x1975('0xc7')]];for(var _0x545206=0x0;_0x545206=_0x1e5654['dialGlobalMaxRetry']){_0x37c90e[_0x1975('0x12b')](_0x116d27,_0x16ff04,_0x15951c,_0x1975('0x12c'));}else{if(_0x116d27['countmachineretry']>=_0x1e5654[_0x1975('0x12d')]){_0x37c90e[_0x1975('0x12e')](_0x116d27,_0x16ff04,_0x15951c,_0x1975('0x12f'));}else{hopperUtils[_0x1975('0xe3')]({'active':![],'countmachineretry':_0x116d27[_0x1975('0x130')],'scheduledat':moment()['add'](_0x1e5654[_0x1975('0x131')],_0x1975('0xf4'))['format'](_0x1975('0xcc')),'ContactId':_0x116d27['ContactId'],'ListId':_0x116d27[_0x1975('0xe7')],'VoiceQueueId':_0x116d27[_0x1975('0xf5')]||undefined,'CampaignId':_0x116d27['CampaignId']||undefined})[_0x1975('0xa9')](loggerCatch(_0x1975('0x132')));_0x16ff04({'reschedule':0x1});}}});}if(_0x366d7b[_0x1975('0x47')]==='ivr'&&this[_0x1975('0x22')][_0x366d7b[_0x1975('0xc7')]][_0x1975('0x119')]&&_0x35259a[_0x1975('0x133')]===_0x1975('0x11a')){delete this[_0x1975('0xc8')][_0x35259a[_0x1975('0xc9')]];this[_0x1975('0xca')](this[_0x1975('0x22')][_0x366d7b['queue']]);_0x160bb1=new Hangup(_0x366d7b,_0x35259a);_0x160bb1[_0x1975('0x73')]=0x12;_0x160bb1['statedesc']=_0x1975('0x11d');_0x160bb1[_0x1975('0x127')]='AMD';ami[_0x1975('0x46')]('custom:amd',ut['buildObj'](_0x160bb1,_0x1975('0x121')));this['saveInDb'](_0x160bb1,_0x1975('0x134'),_0x1975('0x135'));}if(_0x366d7b['type']===_0x1975('0xcd')&&this[_0x1975('0x22')][_0x366d7b['queue']][_0x1975('0x119')]&&_0x35259a['value']===_0x1975('0x125')){return new Promise(function(_0xdd0835,_0x31c027){delete _0x37c90e[_0x1975('0xc8')][_0x35259a[_0x1975('0xc9')]];_0x37c90e['updateOriginated'](_0x37c90e[_0x1975('0x22')][_0x366d7b[_0x1975('0xc7')]]);_0x37c90e[_0x1975('0x22')][_0x366d7b['queue']][_0x1975('0x11b')]+=0x1;_0x37c90e[_0x1975('0x22')][_0x366d7b[_0x1975('0xc7')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3b1164=_0x37c90e[_0x1975('0x22')][_0x366d7b[_0x1975('0xc7')]];var _0x3bf776=new Hangup(_0x366d7b,_0x35259a);_0x3bf776[_0x1975('0x73')]=0x13;_0x3bf776[_0x1975('0x74')]=_0x1975('0x126');_0x3bf776['membername']='AMD';_0x3bf776['countmachineretry']+=0x1;_0x3bf776[_0x1975('0xdd')]+=0x1;_0x3bf776['amd']=!![];ami[_0x1975('0x46')]('custom:amd',ut['buildObj'](_0x3bf776,_0x1975('0x121')));hopperUtils['createHistory'](_0x3bf776)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3bf776[_0x1975('0x136')]+_0x3bf776[_0x1975('0x129')]+_0x3bf776['countnoanswerretry']+_0x3bf776['countnosuchnumberretry']+_0x3bf776[_0x1975('0xdc')]+_0x3bf776[_0x1975('0xf1')]+_0x3bf776[_0x1975('0x130')]+_0x3bf776[_0x1975('0x137')]>=_0x3b1164[_0x1975('0x138')]){_0x37c90e[_0x1975('0x12b')](_0x3bf776,_0xdd0835,_0x31c027,_0x1975('0x12c'));}else{if(_0x3bf776[_0x1975('0x130')]>=_0x3b1164['dialMachineMaxRetry']){_0x37c90e[_0x1975('0x12e')](_0x3bf776,_0xdd0835,_0x31c027,_0x1975('0x12f'));}else{hopperUtils[_0x1975('0xe3')]({'active':![],'countmachineretry':_0x3bf776[_0x1975('0x130')],'scheduledat':moment()['add'](_0x3b1164[_0x1975('0x131')],'minutes')['format'](_0x1975('0xcc')),'ContactId':_0x3bf776['ContactId'],'ListId':_0x3bf776[_0x1975('0xe7')],'VoiceQueueId':_0x3bf776[_0x1975('0xf5')]||undefined,'CampaignId':_0x3bf776[_0x1975('0xe8')]||undefined})['catch'](loggerCatch(_0x1975('0x132')));_0xdd0835({'reschedule':0x1});}}});}}};Dialer[_0x1975('0x1d')][_0x1975('0x139')]=function(_0xbb4fe){var _0x2f2026=this['uniqueId'][_0xbb4fe[_0x1975('0xc9')]];var _0xdfbb72;if(_0x2f2026&&_0x2f2026['type']===_0x1975('0xcd')){delete this[_0x1975('0xc8')][_0xbb4fe[_0x1975('0xc9')]];this[_0x1975('0xca')](this[_0x1975('0x22')][_0x2f2026[_0x1975('0xc7')]]);this[_0x1975('0x22')][_0x2f2026[_0x1975('0xc7')]][_0x1975('0x13a')]+=0x1;_0xdfbb72=new Hangup(_0x2f2026,_0xbb4fe);hopperUtils[_0x1975('0xd1')](_0xdfbb72)['catch'](loggerCatch(_0x1975('0x13b')));hopperUtils[_0x1975('0xd3')](_0xdfbb72)['catch'](loggerCatch(_0x1975('0x13c')));}if(_0x2f2026&&_0x2f2026[_0x1975('0x47')]!==_0x1975('0xcd')&&isNotNull(this[_0x1975('0x21')][_0x2f2026['queue']][_0x1975('0x13d')])){delete this[_0x1975('0xc8')][_0xbb4fe[_0x1975('0xc9')]];this[_0x1975('0xca')](this['voiceQueues'][_0x2f2026[_0x1975('0xc7')]]);this['voiceQueues'][_0x2f2026[_0x1975('0xc7')]][_0x1975('0x11b')]+=0x1;this[_0x1975('0x21')][_0x2f2026['queue']][_0x1975('0x11c')]+=0x1;_0xdfbb72=new Hangup(_0x2f2026,_0xbb4fe);_0xdfbb72[_0x1975('0x73')]=0x10;_0xdfbb72[_0x1975('0x74')]='AnswerAGI';_0xdfbb72['membername']='AGI';hopperUtils[_0x1975('0xd1')](_0xdfbb72)['catch'](loggerCatch(_0x1975('0x13b')));hopperUtils[_0x1975('0xd3')](_0xdfbb72)[_0x1975('0xa9')](loggerCatch(_0x1975('0x13c')));}if(_0x2f2026&&_0x2f2026['type']!==_0x1975('0xcd')&&!isNotNull(this['voiceQueues'][_0x2f2026[_0x1975('0xc7')]]['dialQueueProject'])){if(_0xbb4fe[_0x1975('0x13e')]===_0x1975('0x13f')){delete this[_0x1975('0xc8')][_0xbb4fe[_0x1975('0xc9')]];this[_0x1975('0x21')][_0x2f2026['queue']][_0x1975('0x11b')]+=0x1;const _0x2ec975=new AgentComplete(_0x2f2026,_0xbb4fe);_0x2ec975[_0x1975('0xe8')]=this[_0x1975('0x21')][_0x2f2026[_0x1975('0xc7')]]['id'];hopperUtils[_0x1975('0xd1')](_0x2ec975)[_0x1975('0xa9')](loggerCatch(_0x1975('0xd2')));hopperUtils[_0x1975('0xd3')](_0x2ec975)[_0x1975('0xa9')](loggerCatch(_0x1975('0xd4')));}else{delete this[_0x1975('0xc8')][_0xbb4fe[_0x1975('0xc9')]];this[_0x1975('0xca')](this[_0x1975('0x21')][_0x2f2026[_0x1975('0xc7')]]);this[_0x1975('0x21')][_0x2f2026[_0x1975('0xc7')]][_0x1975('0x140')]+=0x1;_0xdfbb72=new Hangup(_0x2f2026,_0xbb4fe);_0xdfbb72[_0x1975('0x73')]=0xc;_0xdfbb72[_0x1975('0x74')]=_0xbb4fe[_0x1975('0x13e')];_0xdfbb72[_0x1975('0x127')]='Unknow';hopperUtils[_0x1975('0xd1')](_0xdfbb72)[_0x1975('0xa9')](loggerCatch(_0x1975('0x13b')));hopperUtils[_0x1975('0xd3')](_0xdfbb72)['catch'](loggerCatch(_0x1975('0x13c')));}}};Dialer['prototype'][_0x1975('0xd')]=function(_0x1c7227){var _0x2e0116=this;if(!_0x2e0116[_0x1975('0x2e')][_0x1c7227['name']]){_0x2e0116[_0x1975('0x2e')][_0x1c7227[_0x1975('0x4d')]]={'running':![]};}else if(_0x2e0116[_0x1975('0x2e')][_0x1c7227[_0x1975('0x4d')]][_0x1975('0x141')]===!![]){return;}else if(_0x2e0116[_0x1975('0x2e')][_0x1c7227['name']][_0x1975('0x141')]===![]){_0x2e0116[_0x1975('0x2e')][_0x1c7227[_0x1975('0x4d')]]['running']=!![];}var _0x2d2f5f=_0x2e0116['voiceQueues'][_0x1c7227[_0x1975('0x4d')]];var _0x4530f0=_0x2d2f5f['message']!==utils[_0x1975('0x6f')][_0x1975('0x81')];var _0x4d99ed=utils[_0x1975('0x142')](_0x2d2f5f);_0x2d2f5f['statusMessage']=utils[_0x1975('0x143')](_0x2d2f5f,_0x2e0116[_0x1975('0x24')]);Promise[_0x1975('0xb5')]()[_0x1975('0xab')](function(){if(_0x2d2f5f[_0x1975('0x144')]===utils[_0x1975('0x6f')]['INACTIVE']){if(_0x4530f0){clearPredictiveAttributes(_0x2d2f5f);_0x1c7227[_0x1975('0x2a')]=undefined;_0x1c7227[_0x1975('0x2b')]=undefined;}if(_0x2d2f5f[_0x1975('0x144')]===utils['CAMPAIGN_STATUS'][_0x1975('0x81')]){_0x1c7227[_0x1975('0x145')]=0x0;_0x1c7227[_0x1975('0xfe')]=0x0;_0x1c7227[_0x1975('0x146')]=0x0;_0x1c7227[_0x1975('0x147')]=0x0;_0x1c7227['pTalking']=0x0;}}else if(_0x2d2f5f[_0x1975('0x144')]===utils['CAMPAIGN_STATUS'][_0x1975('0x148')]&&!_0x4d99ed){return _0x2e0116[_0x1975('0x9b')](_0x2d2f5f,!![])[_0x1975('0xab')](function(){return _0x2e0116[_0x1975('0x9b')](_0x2d2f5f,![]);})[_0x1975('0xab')](function(){return _0x2e0116[_0x1975('0xbb')](_0x2d2f5f);})[_0x1975('0xa9')](function(_0x35b5de){loggerSyncQueueSummary['debug'](_0x1975('0x149'),util['inspect'](_0x35b5de,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2d2f5f);});}else{clearPredictiveAttributes(_0x2d2f5f);}})[_0x1975('0xab')](function(){var _0x1dc7bc=_0x1c7227[_0x1975('0x14a')](_0x2d2f5f);if(_0x1dc7bc||_0x2d2f5f[_0x1975('0x14b')]){_0x2d2f5f[_0x1975('0x14b')]=![];_0x1c7227['updateReportFromOutboundQueue'](_0x2d2f5f);Object[_0x1975('0x14c')](_0x2d2f5f,_0x1c7227);emitOutboundVoiceQueueSummary(_0x1c7227);}_0x2e0116[_0x1975('0x2e')][_0x2d2f5f[_0x1975('0x4d')]][_0x1975('0x141')]=![];})['catch'](function(_0x9fca60){logger[_0x1975('0x69')](_0x1975('0x149'),util['inspect'](_0x9fca60,{'showHidden':![],'depth':null}));_0x2e0116[_0x1975('0x2e')][_0x2d2f5f['name']]['running']=![];});};Dialer[_0x1975('0x1d')][_0x1975('0x3a')]=_['throttle'](function(){var _0x299304=_[_0x1975('0x14d')](this['voiceQueues'],function(_0x39a7ab){return _0x39a7ab[_0x1975('0x14e')];});var _0x3b431c=_[_0x1975('0x14d')](this['agents'],function(_0x20e11a){return _0x20e11a['online']&&_0x20e11a[_0x1975('0x90')]===_0x1975('0x91');});if(_0x299304[_0x1975('0xa1')]>0x0&&_0x3b431c[_0x1975('0xa1')]>0x0){return Promise[_0x1975('0xb5')]()['then'](cmHopper[_0x1975('0x14f')](_[_0x1975('0x150')](_0x299304,'id'),previewRecallmeReminderInterval,_[_0x1975('0x150')](_0x3b431c,'id')))[_0x1975('0xab')](function(_0x761587){for(var _0x4feb50=0x0;_0x4feb50<_0x761587['length'];_0x4feb50++){var _0x44aca2=_0x761587[_0x4feb50][_0x1975('0x151')][_0x1975('0x4d')];if(_0x44aca2)io['to'](util['format'](_0x1975('0x152'),_0x44aca2))['emit'](_0x1975('0x153'),{'hopper':_0x761587[_0x4feb50]});}})['catch'](function(_0x22bf08){logger[_0x1975('0x69')](_0x1975('0x154'),_0x22bf08);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x1975('0x43')]=function(){var _0x15b071=this;setInterval(function(){_0x15b071[_0x1975('0x155')](_0x15b071[_0x1975('0xc8')],_0x1975('0x156'));_0x15b071[_0x1975('0x155')](_0x15b071['actions'],'[actions]');},0x32c8);};Dialer['prototype'][_0x1975('0x155')]=function(_0x4413c6,_0x546ff3){var _0x4a3556=this;for(var _0x322418 in _0x4413c6){if(typeof _0x4413c6[_0x322418]!=='undefined'){this[_0x1975('0x20')][_0x1975('0x157')](function(){if(!_[_0x1975('0xfc')](_0x4413c6[_0x322418])){return ami[_0x1975('0xaa')]({'action':_0x1975('0x90'),'channel':_0x4413c6[_0x322418][_0x1975('0xf8')]})[_0x1975('0xa9')](function(_0x3e3a5c){if(_0x3e3a5c['message']===_0x1975('0x158')){setTimeout(function(){if(_0x4413c6[_0x322418]&&_0x4413c6[_0x322418][_0x1975('0x47')]!=='ivr'){_0x4a3556[_0x1975('0xca')](_0x4a3556[_0x1975('0x21')][_0x4413c6[_0x322418]['queue']]);logger['error']('[Dialer][checkChannel]',_0x546ff3,_0x322418,_0x4413c6[_0x322418]['queue']);delete _0x4413c6[_0x322418];}if(_0x4413c6[_0x322418]&&_0x4413c6[_0x322418][_0x1975('0x47')]==='ivr'){_0x4a3556['updateOriginated'](_0x4a3556['campaigns'][_0x4413c6[_0x322418][_0x1975('0xc7')]]);logger['error'](_0x1975('0x159'),_0x546ff3,_0x322418,_0x4413c6[_0x322418][_0x1975('0xc7')]);delete _0x4413c6[_0x322418];}},0x2328);}});}});}}};Dialer[_0x1975('0x1d')][_0x1975('0x15a')]=function(_0x543063){return Promise[_0x1975('0xb5')]()[_0x1975('0xab')](voiceQueueRt[_0x1975('0x15a')](_0x543063))['catch'](loggerCatch(_0x1975('0x15b')));};Dialer[_0x1975('0x1d')][_0x1975('0xca')]=function(_0x3abdc7){if(!_['isUndefined'](_0x3abdc7)&&_0x3abdc7!==null){if(typeof _0x3abdc7[_0x1975('0x87')]!=='undefined'){if(_0x3abdc7[_0x1975('0x87')]>0x0){_0x3abdc7['originated']-=0x1;}else{logger[_0x1975('0x69')](_0x1975('0x15c'));}}}else{logger[_0x1975('0x69')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x1975('0x1d')][_0x1975('0x15d')]=function(_0xd1e6c9,_0x181eb3){var _0x4b0726=this;return function(_0x443a60){_0x4b0726[_0x1975('0xca')](_0x181eb3);logger['error'](_0xd1e6c9,util[_0x1975('0x6b')](_0x443a60,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x2a6d70,_0x433717,_0x3097e4){var _0x757c33={'state':0x19,'statedesc':_0x1975('0x15e')};this[_0x1975('0xca')](_0x433717);this[_0x1975('0x122')](_[_0x1975('0x101')](_0x757c33,_[_0x1975('0x102')](_0x3097e4,['ContactId',_0x1975('0xe7'),'UserId','VoiceQueueId','CampaignId'])),_0x1975('0x15f'),_0x1975('0x160'));logger[_0x1975('0x69')](_0x2a6d70);};Dialer[_0x1975('0x1d')][_0x1975('0x122')]=function(_0x19e27,_0x493ebf,_0x57c8fe){hopperUtils[_0x1975('0xd1')](_0x19e27)[_0x1975('0xa9')](loggerCatch(_0x493ebf));hopperUtils[_0x1975('0xd3')](_0x19e27)[_0x1975('0xa9')](loggerCatch(_0x57c8fe));};Dialer[_0x1975('0x1d')][_0x1975('0xe2')]=function(_0x276b87,_0x493caa){hopperUtils[_0x1975('0xd1')](_0x276b87)[_0x1975('0xa9')](loggerCatch(_0x1975('0xd2')));if(_0x493caa==0x0){hopperUtils[_0x1975('0xd3')](_0x276b87)['catch'](loggerCatch(_0x1975('0x161')));}};Dialer[_0x1975('0x1d')][_0x1975('0x154')]=function(_0x22bf00){return Promise['resolve']()['then'](cmHopper[_0x1975('0x14f')](_0x22bf00['id'],previewRecallmeReminderInterval))[_0x1975('0xab')](function(_0x149970){for(var _0x7fa87e=0x0;_0x7fa87e<_0x149970[_0x1975('0xa1')];_0x7fa87e++){var _0x171b6d=_0x149970[_0x7fa87e]['Agent']['name'];if(_0x171b6d)io['to'](util[_0x1975('0x4b')]('user:%s',_0x171b6d))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x149970[_0x7fa87e]});}})[_0x1975('0xa9')](function(){});};Dialer[_0x1975('0x1d')][_0x1975('0xb9')]=function(_0x14eff3){var _0x29c555=this;return function(){_0x29c555[_0x1975('0x162')](_0x14eff3);};};Dialer[_0x1975('0x1d')][_0x1975('0x163')]=function(_0x4f9ddb,_0x179810){var _0x2a62f0=this;var _0x4682a9=uuid['v4']();this['actions'][_0x4682a9]=new Action(_0x4f9ddb,_0x179810,_0x4682a9);return new Promise(function(_0x4685ec,_0x550be7){if(_[_0x1975('0x5c')](_0x4f9ddb)&&typeof _0x4f9ddb!=='object'){return _0x550be7(msgResponse(_0x1975('0x164'),_0x1975('0x98'),_0x1975('0x165')));}if(_[_0x1975('0x5c')](_0x179810[_0x1975('0x166')])||_0x179810['phone']===null){return _0x550be7(msgResponse(_0x1975('0x164'),_0x1975('0x98'),'contact\x20is\x20undefine'));}var _0x206199={'XMD-CALLERID':_0x2a62f0[_0x1975('0x27')][_0x4682a9][_0x1975('0x167')](),'XMD-AGI':_0x4f9ddb[_0x1975('0x13d')]?util['format'](_0x1975('0x168'),ipAgi,_0x4f9ddb['dialQueueProject']):_0x1975('0x169'),'XMD-AGIAFTER':_0x4f9ddb['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4f9ddb[_0x1975('0x16a')]):_0x1975('0x169'),'XMD-QUEUE':utils[_0x1975('0x16b')](_0x4f9ddb)?util[_0x1975('0x4b')](_0x1975('0x16c'),_0x4f9ddb[_0x1975('0x4d')],_0x4f9ddb[_0x1975('0x16d')]||'',_0x4f9ddb['dialAgiAfterHangupAgent']?'c':'',_0x4f9ddb['dialQueueTimeout']||0x3):_0x1975('0x169'),'XMD-CONTACTID':_0x179810['ContactId'],'XMD-CDRTYPE':_0x1975('0xa'),'CALLERID(all)':_0x2a62f0[_0x1975('0x27')][_0x4682a9][_0x1975('0x167')](),'XMD-AMD':_0x4f9ddb[_0x1975('0x119')]?_0x1975('0x148'):_0x1975('0x169'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4f9ddb[_0x1975('0x119')]){_0x206199[_0x1975('0x16e')]=_0x4f9ddb[_0x1975('0x16f')]||0x9c4;_0x206199['XMD-AMDGREETING']=_0x4f9ddb['dialAMDGreeting']||0x5dc;_0x206199[_0x1975('0x170')]=_0x4f9ddb[_0x1975('0x171')]||0x320;_0x206199[_0x1975('0x172')]=_0x4f9ddb['dialAMDTotalAnalysisTime']||0x1388;_0x206199['XMD-AMDMINWORDLENGTH']=_0x4f9ddb[_0x1975('0x173')]||0x64;_0x206199[_0x1975('0x174')]=_0x4f9ddb[_0x1975('0x175')]||0x32;_0x206199[_0x1975('0x176')]=_0x4f9ddb[_0x1975('0x177')]||0x3;_0x206199['XMD-AMDSILENCETHRESHOLD']=_0x4f9ddb['dialAMDSilenceThreshold']||0x100;_0x206199[_0x1975('0x178')]=_0x4f9ddb['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x1975('0x16b')](_0x4f9ddb)){_0x206199[_0x1975('0x179')]=_0x179810[_0x1975('0xf5')];}else{_0x206199[_0x1975('0x17a')]=_0x179810[_0x1975('0xe8')];}var _0x2dfc8a=utils['setXMDContactVariables'](_0x179810['Contact']);Object['assign'](_0x206199,_0x2dfc8a);var _0x40b41b=_0x2a62f0['isTrunkReachable'](_0x4f9ddb['Trunk'])?utils[_0x1975('0x17b')](_0x4f9ddb['Trunk'][_0x1975('0x17c')],_0x4f9ddb[_0x1975('0x17d')],_0x4f9ddb[_0x1975('0x17e')]>0x0?utils['getCallerIdRandom'](_0x4f9ddb['dialOriginateCallerIdNumber'],_0x4f9ddb['dialRandomLastDigitCallerIdNumber']):_0x4f9ddb[_0x1975('0x17f')]):utils['getCallerId'](_['isNil'](_0x4f9ddb[_0x1975('0x94')])?_0x4f9ddb[_0x1975('0x180')][_0x1975('0x17c')]:_0x4f9ddb[_0x1975('0x94')]['callerid'],_0x4f9ddb['dialOriginateCallerIdName'],_0x4f9ddb[_0x1975('0x17e')]>0x0?utils[_0x1975('0x181')](_0x4f9ddb[_0x1975('0x17f')],_0x4f9ddb[_0x1975('0x17e')]):_0x4f9ddb[_0x1975('0x17f')]);if(_0x40b41b){_0x206199[_0x1975('0x182')]=_0x2a62f0[_0x1975('0x27')][_0x4682a9][_0x1975('0x183')]=utils[_0x1975('0x184')](_0x40b41b);_0x206199[_0x1975('0x185')]=_0x179810[_0x1975('0x166')];}_0x4f9ddb[_0x1975('0x186')]=_0x206199;return ami[_0x1975('0xaa')]({'actionid':_0x4682a9,'action':_0x1975('0x164'),'channel':_0x2a62f0['isTrunkReachable'](_0x4f9ddb[_0x1975('0x180')])?util[_0x1975('0x4b')](_0x1975('0x187'),_0x4f9ddb[_0x1975('0x180')][_0x1975('0x4d')],isNotNull(_0x4f9ddb['dialPrefix'])?_0x4f9ddb['dialPrefix'][_0x1975('0x188')]()||'':'',_0x4f9ddb['dialCutDigit']>0x0?_0x179810[_0x1975('0x166')][_0x1975('0x189')](_0x4f9ddb['dialCutDigit']):_0x179810['phone']):util[_0x1975('0x4b')](_0x1975('0x187'),_[_0x1975('0xfc')](_0x4f9ddb[_0x1975('0x94')])?_0x4f9ddb[_0x1975('0x180')][_0x1975('0x4d')]:_0x4f9ddb[_0x1975('0x94')][_0x1975('0x4d')],isNotNull(_0x4f9ddb[_0x1975('0x18a')])?_0x4f9ddb[_0x1975('0x18a')][_0x1975('0x188')]()||'':'',_0x4f9ddb[_0x1975('0x18b')]>0x0?_0x179810[_0x1975('0x166')][_0x1975('0x189')](_0x4f9ddb['dialCutDigit']):_0x179810[_0x1975('0x166')]),'callerid':_0x40b41b,'Exten':_0x1975('0x118'),'Context':_0x1975('0x18c'),'Priority':'1','variable':_0x206199,'timeout':(_0x4f9ddb[_0x1975('0x18d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4682a9})['then'](function(_0x5df69a){return _0x4685ec(_0x5df69a);})[_0x1975('0xa9')](function(_0x5da2ac){_0x4f9ddb[_0x1975('0x18e')]+=0x1;var _0x742c8f=new History(_0x2a62f0[_0x1975('0x27')][_0x4682a9]);logger[_0x1975('0x69')](util[_0x1975('0x4b')]('[originateError]:\x20%s',JSON[_0x1975('0x7a')](_0x5da2ac)));_0x742c8f[_0x1975('0x73')]=0xe;_0x742c8f[_0x1975('0x74')]=_0x1975('0x18f');_0x742c8f[_0x1975('0x76')]=moment()[_0x1975('0x4b')](_0x1975('0xcc'));_0x742c8f[_0x1975('0x75')]=_0x742c8f['starttime'];hopperUtils[_0x1975('0xd1')](_0x742c8f)[_0x1975('0xa9')](loggerCatch('[originate][error]'));_0x2a62f0[_0x1975('0xd3')](_0x742c8f)['catch'](loggerCatch(_0x1975('0x190')))[_0x1975('0x1f')](function(){delete _0x2a62f0[_0x1975('0x27')][_0x4682a9];return _0x550be7(msgResponse('originate',_0x1975('0x8c'),_0x1975('0x191')));});});});};Dialer[_0x1975('0x1d')][_0x1975('0x192')]=function(_0x2d94d5,_0x1829ea,_0x3c6c03){var _0x2e48d5=new History(_0x1829ea);if(_0x2e48d5[_0x1975('0x136')]+_0x2e48d5[_0x1975('0x129')]+_0x2e48d5[_0x1975('0x12a')]+_0x2e48d5[_0x1975('0x193')]+_0x2e48d5[_0x1975('0xdc')]+_0x2e48d5[_0x1975('0xf1')]+_0x2e48d5[_0x1975('0x130')]+_0x2e48d5[_0x1975('0x137')]>=_0x3c6c03[_0x1975('0x138')]-0x1){return!![];}switch(_0x2d94d5){case 0x3:if(_0x2e48d5[_0x1975('0x12a')]>=_0x3c6c03[_0x1975('0x194')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x2e48d5['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x1975('0xe4')](_0x3c6c03[_0x1975('0x195')],'minutes')[_0x1975('0x4b')](_0x1975('0xcc')),'ContactId':_0x2e48d5[_0x1975('0xe6')],'ListId':_0x2e48d5[_0x1975('0xe7')],'VoiceQueueId':_0x2e48d5[_0x1975('0xf5')]||undefined,'CampaignId':_0x2e48d5[_0x1975('0xe8')]||undefined})[_0x1975('0xa9')](loggerCatch(_0x1975('0x196')));break;case 0x5:if(_0x2e48d5[_0x1975('0x136')]>=_0x3c6c03[_0x1975('0x197')]-0x1){return!![];}hopperUtils[_0x1975('0xe3')]({'active':![],'countbusyretry':_0x2e48d5['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x3c6c03[_0x1975('0x198')],'minutes')[_0x1975('0x4b')](_0x1975('0xcc')),'ContactId':_0x2e48d5[_0x1975('0xe6')],'ListId':_0x2e48d5['ListId'],'VoiceQueueId':_0x2e48d5[_0x1975('0xf5')]||undefined,'CampaignId':_0x2e48d5[_0x1975('0xe8')]||undefined})[_0x1975('0xa9')](loggerCatch(_0x1975('0x199')));break;case 0x8:if(_0x2e48d5[_0x1975('0x129')]>=_0x3c6c03[_0x1975('0x19a')]-0x1){return!![];}hopperUtils[_0x1975('0xe3')]({'active':![],'countcongestionretry':_0x2e48d5[_0x1975('0x129')]+=0x1,'scheduledat':moment()[_0x1975('0xe4')](_0x3c6c03[_0x1975('0x19b')],_0x1975('0xf4'))['format'](_0x1975('0xcc')),'ContactId':_0x2e48d5[_0x1975('0xe6')],'ListId':_0x2e48d5[_0x1975('0xe7')],'VoiceQueueId':_0x2e48d5[_0x1975('0xf5')]||undefined,'CampaignId':_0x2e48d5[_0x1975('0xe8')]||undefined})[_0x1975('0xa9')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2e48d5[_0x1975('0x193')]>=_0x3c6c03['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x1975('0xe3')]({'active':![],'countnosuchnumberretry':_0x2e48d5[_0x1975('0x193')]+=0x1,'scheduledat':moment()['add'](_0x3c6c03[_0x1975('0x19c')],_0x1975('0xf4'))[_0x1975('0x4b')](_0x1975('0xcc')),'ContactId':_0x2e48d5[_0x1975('0xe6')],'ListId':_0x2e48d5['ListId'],'VoiceQueueId':_0x2e48d5[_0x1975('0xf5')]||undefined,'CampaignId':_0x2e48d5['CampaignId']||undefined})[_0x1975('0xa9')](loggerCatch(_0x1975('0x19d')));}break;case 0xa:if(_0x2e48d5[_0x1975('0xdc')]>=_0x3c6c03[_0x1975('0x19e')]-0x1){return!![];}hopperUtils[_0x1975('0xe3')]({'active':![],'countdropretry':_0x2e48d5['countdropretry']+=0x1,'scheduledat':moment()[_0x1975('0xe4')](_0x3c6c03['dialDropRetryFrequency'],_0x1975('0xf4'))[_0x1975('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2e48d5[_0x1975('0xe6')],'ListId':_0x2e48d5[_0x1975('0xe7')],'VoiceQueueId':_0x2e48d5[_0x1975('0xf5')]||undefined,'CampaignId':_0x2e48d5[_0x1975('0xe8')]||undefined})[_0x1975('0xa9')](loggerCatch(_0x1975('0xe9')));break;case 0xb:if(_0x2e48d5[_0x1975('0xf1')]>=_0x3c6c03[_0x1975('0xf3')]-0x1){return!![];}hopperUtils[_0x1975('0xe3')]({'active':![],'countabandonedretry':_0x2e48d5[_0x1975('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x3c6c03[_0x1975('0xf2')],_0x1975('0xf4'))[_0x1975('0x4b')](_0x1975('0xcc')),'ContactId':_0x2e48d5['ContactId'],'ListId':_0x2e48d5[_0x1975('0xe7')],'VoiceQueueId':_0x2e48d5['VoiceQueueId']||undefined,'CampaignId':_0x2e48d5[_0x1975('0xe8')]||undefined})[_0x1975('0xa9')](loggerCatch(_0x1975('0xf6')));break;case 0x13:if(_0x2e48d5[_0x1975('0x130')]>=_0x3c6c03[_0x1975('0x12d')]-0x1){return!![];}hopperUtils[_0x1975('0xe3')]({'active':![],'countmachineretry':_0x2e48d5[_0x1975('0x130')]+=0x1,'scheduledat':moment()[_0x1975('0xe4')](_0x3c6c03['dialMachineRetryFrequency'],_0x1975('0xf4'))[_0x1975('0x4b')](_0x1975('0xcc')),'ContactId':_0x2e48d5['ContactId'],'ListId':_0x2e48d5[_0x1975('0xe7')],'VoiceQueueId':_0x2e48d5[_0x1975('0xf5')]||undefined,'CampaignId':_0x2e48d5[_0x1975('0xe8')]||undefined})['catch'](loggerCatch(_0x1975('0x132')));break;case 0x14:if(_0x2e48d5[_0x1975('0x137')]>=_0x3c6c03['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x1975('0xe3')]({'active':![],'countagentrejectretry':_0x2e48d5[_0x1975('0x137')]+=0x1,'scheduledat':moment()[_0x1975('0xe4')](_0x3c6c03[_0x1975('0x19f')],_0x1975('0xf4'))[_0x1975('0x4b')](_0x1975('0xcc')),'ContactId':_0x2e48d5[_0x1975('0xe6')],'ListId':_0x2e48d5['ListId'],'VoiceQueueId':_0x2e48d5['VoiceQueueId']||undefined,'CampaignId':_0x2e48d5[_0x1975('0xe8')]||undefined})[_0x1975('0xa9')](loggerCatch(_0x1975('0x1a0')));break;default:return!![];}};Dialer['prototype'][_0x1975('0x114')]=function(_0x2cf3c2,_0x6139fa,_0x2be0da){var _0x4ee5e2=this;var _0x5ce9fe=new History(_0x2cf3c2);var _0x55e78e=![];var _0x3d03b0;var _0xc97da2;return new Promise(function(_0x259d85,_0x5062e4){if(_[_0x1975('0x5c')](_0x6139fa)&&typeof _0x6139fa!==_0x1975('0x1a1')){return _0x5062e4(msgResponse(_0x1975('0x1a2'),_0x1975('0x98'),_0x1975('0x1a3')));}if(_[_0x1975('0x5c')](_0x2be0da)&&typeof _0x2be0da!=='object'){return _0x5062e4(msgResponse(_0x1975('0x1a2'),_0x1975('0x98'),_0x1975('0x1a4')));}hopperUtils[_0x1975('0xdf')](_0x5ce9fe,_0x2be0da[_0x1975('0x1a5')],_0x6139fa)[_0x1975('0xab')](function(_0xd95555){if(_0xd95555[_0x1975('0xe1')]==0x1)_0x55e78e=!![];switch(_0x2be0da[_0x1975('0x1a5')]){case'0':_0x6139fa['outboundNoSuchCallsDay']+=0x1;_0x5ce9fe[_0x1975('0x73')]=0x0;_0x5ce9fe[_0x1975('0x74')]=_0x1975('0x1a6');_0x5ce9fe[_0x1975('0x193')]+=0x1;_0x5ce9fe[_0x1975('0xdd')]+=0x1;ami[_0x1975('0x46')](_0x1975('0x1a7'),ut[_0x1975('0x120')](_0x2cf3c2,'nosuchnumber'));_0x3d03b0=_0x6139fa[_0x1975('0x19c')];_0xc97da2=_0x6139fa['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x5ce9fe)[_0x1975('0xa9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4ee5e2[_0x1975('0x192')](0x0,_0x2cf3c2,_0x6139fa)&&!_0x55e78e){if(_0x5ce9fe[_0x1975('0x193')]>=_0x6139fa[_0x1975('0x1a8')]){_0x4ee5e2[_0x1975('0x12e')](_0x5ce9fe,_0x259d85,_0x5062e4,_0x1975('0x1a9'));}else{_0x4ee5e2[_0x1975('0x12b')](_0x5ce9fe,_0x259d85,_0x5062e4,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x6139fa[_0x1975('0x1aa')]+=0x1;_0x5ce9fe['state']=0x3;_0x5ce9fe[_0x1975('0x74')]='NoAnswer';_0x5ce9fe[_0x1975('0x12a')]+=0x1;_0x5ce9fe[_0x1975('0xdd')]+=0x1;var _0x2b315a=ut[_0x1975('0x1ab')](_0x2cf3c2,_0x6139fa);ami[_0x1975('0x46')](_0x1975('0x1ac'),_0x2b315a);_0x3d03b0=_0x6139fa[_0x1975('0x195')];_0xc97da2=_0x6139fa['callAdditionalPhoneAfterMin'];hopperUtils[_0x1975('0xd1')](_0x5ce9fe)['catch'](loggerCatch(_0x1975('0x1ad')));if(_0x4ee5e2[_0x1975('0x192')](0x3,_0x2cf3c2,_0x6139fa)&&!_0x55e78e){if(_0x5ce9fe[_0x1975('0x12a')]>=_0x6139fa[_0x1975('0x194')]){_0x4ee5e2[_0x1975('0x12e')](_0x5ce9fe,_0x259d85,_0x5062e4,'reason\x203\x20ringing\x20no\x20answer');}else{_0x4ee5e2[_0x1975('0x12b')](_0x5ce9fe,_0x259d85,_0x5062e4,_0x1975('0x1ae'));}}break;case'5':_0x6139fa['outboundBusyCallsDay']+=0x1;_0x5ce9fe['state']=0x5;_0x5ce9fe[_0x1975('0x74')]='Busy';_0x5ce9fe['countbusyretry']+=0x1;_0x5ce9fe[_0x1975('0xdd')]+=0x1;ami[_0x1975('0x46')](_0x1975('0x1af'),ut['buildObj'](_0x2cf3c2,_0x1975('0x1b0')));_0x3d03b0=_0x6139fa[_0x1975('0x198')];_0xc97da2=_0x6139fa[_0x1975('0xde')];hopperUtils[_0x1975('0xd1')](_0x5ce9fe)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4ee5e2[_0x1975('0x192')](0x5,_0x2cf3c2,_0x6139fa)&&!_0x55e78e){if(_0x5ce9fe[_0x1975('0x136')]>=_0x6139fa[_0x1975('0x197')]){_0x4ee5e2['createStateFinal'](_0x5ce9fe,_0x259d85,_0x5062e4,_0x1975('0x1b1'));}else{_0x4ee5e2['stateGlobal'](_0x5ce9fe,_0x259d85,_0x5062e4,_0x1975('0x1b1'));}}break;case'8':_0x6139fa[_0x1975('0x1b2')]+=0x1;_0x5ce9fe['state']=0x8;_0x5ce9fe['statedesc']=_0x1975('0x1b3');_0x5ce9fe[_0x1975('0x129')]+=0x1;_0x5ce9fe[_0x1975('0xdd')]+=0x1;_0x3d03b0=_0x6139fa[_0x1975('0x19b')];_0xc97da2=_0x6139fa[_0x1975('0xde')];ami[_0x1975('0x46')](_0x1975('0x1b4'),ut[_0x1975('0x120')](_0x2cf3c2,_0x1975('0x1b5')));hopperUtils[_0x1975('0xd1')](_0x5ce9fe)['catch'](loggerCatch(_0x1975('0x1b6')));if(_0x4ee5e2[_0x1975('0x192')](0x8,_0x2cf3c2,_0x6139fa)&&!_0x55e78e){if(_0x5ce9fe['countcongestionretry']>=_0x6139fa[_0x1975('0x19a')]){_0x4ee5e2[_0x1975('0x12e')](_0x5ce9fe,_0x259d85,_0x5062e4,_0x1975('0x1b7'));}else{_0x4ee5e2[_0x1975('0x12b')](_0x5ce9fe,_0x259d85,_0x5062e4,_0x1975('0x1b7'));}}break;case'11':_0x6139fa[_0x1975('0x1b8')]+=0x1;_0x5ce9fe[_0x1975('0x73')]=0xb;_0x5ce9fe['statedesc']=_0x1975('0xf0');_0x5ce9fe[_0x1975('0xf1')]+=0x1;_0x5ce9fe[_0x1975('0xdd')]+=0x1;_0x3d03b0=_0x6139fa[_0x1975('0xf2')];_0xc97da2=_0x6139fa['callAdditionalPhoneAfterMin'];hopperUtils[_0x1975('0xd1')](_0x5ce9fe)[_0x1975('0xa9')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x4ee5e2[_0x1975('0x192')](0xb,_0x2cf3c2,_0x6139fa)&&!_0x55e78e){if(_0x5ce9fe[_0x1975('0xf1')]>=_0x6139fa[_0x1975('0xf3')]){_0x4ee5e2[_0x1975('0x12e')](_0x5ce9fe,_0x259d85,_0x5062e4,_0x1975('0x1b9'));}else{_0x4ee5e2[_0x1975('0x12b')](_0x5ce9fe,_0x259d85,_0x5062e4,_0x1975('0x1b9'));}}break;case'20':_0x6139fa[_0x1975('0x1ba')]+=0x1;_0x5ce9fe[_0x1975('0x73')]=0x14;_0x5ce9fe[_0x1975('0x74')]=_0x1975('0x1bb');_0x5ce9fe['countagentrejectretry']+=0x1;_0x5ce9fe['countglobal']+=0x1;_0x3d03b0=_0x6139fa['dialAgentRejectRetryFrequency'];_0xc97da2=_0x6139fa[_0x1975('0xde')];ami['emit'](_0x1975('0x1bc'),ut[_0x1975('0x120')](_0x2cf3c2,_0x1975('0x1bd')));hopperUtils[_0x1975('0xd1')](_0x5ce9fe)[_0x1975('0xa9')](loggerCatch(_0x1975('0x1be')));if(_0x4ee5e2[_0x1975('0x192')](0x14,_0x2cf3c2,_0x6139fa)&&!_0x55e78e){if(_0x5ce9fe[_0x1975('0x137')]>=_0x6139fa[_0x1975('0x1bf')]){_0x4ee5e2['createStateFinal'](_0x5ce9fe,_0x259d85,_0x5062e4,_0x1975('0x1c0'));}else{_0x4ee5e2[_0x1975('0x12b')](_0x5ce9fe,_0x259d85,_0x5062e4,_0x1975('0x1c0'));}}break;default:_0x6139fa[_0x1975('0x140')]+=0x1;_0x5ce9fe[_0x1975('0x73')]=0xc;_0x5ce9fe[_0x1975('0x74')]=_0x2be0da['reason'];_0x3d03b0=_0x6139fa[_0x1975('0x19f')];_0xc97da2=_0x6139fa[_0x1975('0xde')];hopperUtils[_0x1975('0xd1')](_0x5ce9fe)[_0x1975('0xa9')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4ee5e2[_0x1975('0x192')](_0x2be0da[_0x1975('0x1a5')],_0x2cf3c2,_0x6139fa)&&!_0x55e78e){if(_0x5ce9fe['countbusyretry']+_0x5ce9fe['countcongestionretry']+_0x5ce9fe[_0x1975('0x12a')]+_0x5ce9fe[_0x1975('0x193')]+_0x5ce9fe[_0x1975('0xdc')]+_0x5ce9fe['countabandonedretry']+_0x5ce9fe[_0x1975('0x130')]+_0x5ce9fe[_0x1975('0x137')]>=_0x6139fa[_0x1975('0x138')]){_0x4ee5e2['stateGlobal'](_0x5ce9fe,_0x259d85,_0x5062e4,_0x2be0da['reason']);}else{_0x4ee5e2[_0x1975('0x12e')](_0x5ce9fe,_0x259d85,_0x5062e4,_0x2be0da[_0x1975('0x1a5')]);}}}})[_0x1975('0xab')](function(){if(_0x55e78e){hopperUtils['swapAdditionalPhones'](_0x5ce9fe,_0x3d03b0,_0xc97da2)[_0x1975('0xab')](function(){return _0x259d85(0x1);});}});});};Dialer[_0x1975('0x1d')][_0x1975('0x12b')]=function(_0x30b5e8,_0x321764,_0x21b7d5,_0x5497a7){var _0x5a4eda=new Final(_0x30b5e8);_0x5a4eda['state']=0xf;_0x5a4eda[_0x1975('0x74')]=_0x1975('0x1c1');this[_0x1975('0x12e')](_0x5a4eda,_0x321764,_0x21b7d5,_0x5497a7);};Dialer[_0x1975('0x1d')][_0x1975('0x12e')]=function(_0x23a13d,_0x5d978f,_0x2acc9b,_0x542ccb){hopperUtils[_0x1975('0xd3')](_0x23a13d)[_0x1975('0xab')](function(){return _0x5d978f(msgResponse('[callProgressDetecting]',_0x1975('0x1c2'),_0x542ccb));})[_0x1975('0xa9')](function(){return _0x2acc9b(msgResponse(_0x1975('0x1c3'),_0x1975('0x98'),_0x1975('0x1c4')));});};Dialer[_0x1975('0x1d')][_0x1975('0xbd')]=function(_0x500af4){var _0x3b1bf2=_0x500af4['dialPredictiveOptimizationPercentage']/0x64;var _0x16e838=_0x500af4['outboundDropCallsDayTimeout']/(_0x500af4[_0x1975('0xd8')]+_0x500af4['outboundAnswerCallsDay']);var _0x5dbc3c=Math['round'](_0x500af4[_0x1975('0x1c5')]*(_0x500af4['predictiveIntervalMaxThreshold']/0x64));var _0x232103=Math[_0x1975('0x1c6')](_0x500af4[_0x1975('0x1c5')]*(_0x500af4[_0x1975('0x1c7')]/0x64));var _0x190312=_0x500af4['available']+_0x500af4[_0x1975('0x147')];var _0x1464dc=Math['floor'](_0x500af4[_0x1975('0x1c8')]*_0x500af4[_0x1975('0x64')]*_0x500af4[_0x1975('0x1c9')]*_0x500af4['predictiveIntervalMultiplicativeFactor']);if(_[_0x1975('0x5c')](_0x500af4[_0x1975('0x2b')])){if(!_[_0x1975('0x5c')](_0x500af4[_0x1975('0x2a')])){_0x500af4[_0x1975('0x2a')]=undefined;loggerPredictive[_0x1975('0x69')](_0x1975('0x1ca'),_0x1975('0x1cb'));}if(!_['isUndefined'](_0x500af4[_0x1975('0x67')])){loggerPredictive['error'](_0x1975('0x1ca'),_0x1975('0x1cc'));clearInterval(_0x500af4[_0x1975('0x67')]);_0x500af4['handlePredictive']=undefined;}_0x500af4[_0x1975('0x2b')]=moment()[_0x1975('0x4b')](_0x1975('0xcc'));loggerPredictive[_0x1975('0x4f')](_0x500af4[_0x1975('0x4d')],_0x1975('0x1cd'),_0x500af4['startProgressive']);this[_0x1975('0xc0')](_0x500af4,0x1);}else if(ifInterval(_0x500af4[_0x1975('0x1ce')],_0x500af4[_0x1975('0x2b')])){this[_0x1975('0xc0')](_0x500af4,0x1);loggerPredictiveCalls[_0x1975('0x4f')](_0x1975('0x1cf'),_0x500af4[_0x1975('0x2b')],_0x500af4[_0x1975('0x4d')]);_0x500af4['erlangCalls']=0x0;_0x500af4[_0x1975('0xd9')]=0x0;}else if(_0x3b1bf2<_0x16e838&&_0x500af4[_0x1975('0x1d0')]===_0x1975('0x1d1')){clearPredictiveAttributes(_0x500af4);loggerPredictive[_0x1975('0x4f')](_0x1975('0x1d2'),_0x1975('0x1d3'),_0x16e838,'startProgressive',_0x500af4[_0x1975('0x4d')]);}else if(_0x1464dc<_0x500af4[_0x1975('0xd9')]&&_0x500af4['dialPredictiveOptimization']===_0x1975('0x1d1')){clearPredictiveAttributes(_0x500af4);loggerPredictive[_0x1975('0x4f')](_0x1975('0x1d4'),_0x1975('0x1d5'),_0x1464dc,_0x1975('0x1d6'),_0x500af4['predictiveIntervalErlangCallsDroppedCalls'],_0x1975('0x2b'),_0x500af4[_0x1975('0x4d')]);}else if(!ifInterval(_0x500af4[_0x1975('0x1ce')],_0x500af4['startProgressive'])&&_[_0x1975('0x5c')](_0x500af4[_0x1975('0x2a')])&&!_[_0x1975('0x5c')](_0x500af4[_0x1975('0x2b')])){_0x500af4[_0x1975('0x2a')]=moment()[_0x1975('0x4b')](_0x1975('0xcc'));loggerPredictive['info'](_0x500af4[_0x1975('0x4d')],'started\x20in\x20predictive\x20at',_0x500af4['startPredictive']);hopperUtils[_0x1975('0x1d7')](_0x500af4[_0x1975('0x1ce')])[_0x1975('0xab')](this['getDataPredictive'](_0x500af4))[_0x1975('0xab')](mergeDataErlangB(_0x500af4))['then'](this['startMethodPredictive'](_0x500af4))[_0x1975('0xa9')](loggerCatchPredictive(_0x1975('0x1d8'),_0x500af4));}else if(!ifInterval(_0x500af4[_0x1975('0x1ce')],_0x500af4[_0x1975('0x2a')])){_0x500af4[_0x1975('0xd9')]=0x0;_0x500af4[_0x1975('0x2a')]=moment()[_0x1975('0x4b')](_0x1975('0xcc'));loggerPredictive[_0x1975('0x4f')](_0x500af4[_0x1975('0x4d')],_0x1975('0x1d9'),_0x500af4[_0x1975('0x2a')]);clearInterval(_0x500af4[_0x1975('0x67')]);_0x500af4[_0x1975('0x67')]=undefined;hopperUtils['avgHandleTime'](_0x500af4[_0x1975('0x1ce')])[_0x1975('0xab')](this[_0x1975('0x1da')](_0x500af4))['then'](mergeDataErlangB(_0x500af4))['then'](this['startMethodPredictive'](_0x500af4))[_0x1975('0xa9')](loggerCatchPredictive(_0x1975('0x1db'),_0x500af4));}else if(_0x500af4[_0x1975('0x1c5')]&&_0x190312<_0x500af4[_0x1975('0x1c5')]-_0x232103){clearPredictiveAttributes(_0x500af4);loggerPredictive[_0x1975('0x4f')](_0x500af4[_0x1975('0x4d')],_0x1975('0x1dc'),_0x190312,_0x1975('0x1dd'),_0x500af4[_0x1975('0x1c5')],'-',_0x232103,'=',_0x500af4[_0x1975('0x1c5')]-_0x232103,')');}else if(_0x500af4[_0x1975('0x1c5')]&&_0x190312>_0x500af4[_0x1975('0x1c5')]+_0x5dbc3c){clearPredictiveAttributes(_0x500af4);loggerPredictive['info'](_0x500af4['name'],_0x1975('0x1dc'),_0x190312,_0x1975('0x1de'),_0x500af4[_0x1975('0x1c5')],'+',_0x5dbc3c,'=',_0x500af4[_0x1975('0x1c5')]+_0x5dbc3c,')');}};Dialer[_0x1975('0x1d')][_0x1975('0x1da')]=function(_0x1392f5){var _0x1cf3c3=this;return function(_0x3ee8e0){return new Promise(function(_0x334809,_0x2fba43){_[_0x1975('0x101')](_0x1392f5,_0x3ee8e0[0x0]);if(checkGetDataPredictive(_0x3ee8e0[0x0])){var _0x2ad4ee=_0x1392f5[_0x1975('0x1c5')]=_0x1392f5[_0x1975('0x147')]+_0x1392f5['available'];var _0x1b802c=_0x1392f5[_0x1975('0x1ce')]*0x3c;var _0x34706c=_0x3ee8e0[0x0][_0x1975('0x5a')]+_0x3ee8e0[0x0][_0x1975('0x58')];var _0x40f2b7=(_0x3ee8e0[0x0][_0x1975('0x52')]+_0x3ee8e0[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3ee8e0[0x0][_0x1975('0x56')])/_0x3ee8e0[0x0][_0x1975('0x51')];_0x1392f5['predictiveIntervalHitRate']=_0x40f2b7>0x0?_0x40f2b7:0x1;switch(_0x1392f5[_0x1975('0x1d0')]){case _0x1975('0x1d1'):var _0x4a9497=_0x1392f5['dialPredictiveOptimizationPercentage']/0x64;return _0x1cf3c3[_0x1975('0x1df')](_0x2ad4ee,_0x1b802c,_0x34706c,_0x40f2b7,_0x4a9497)[_0x1975('0xab')](function(_0x369c10){return _0x334809(_0x369c10);});case _0x1975('0x1e0'):var _0x51f1fd=_0x1392f5[_0x1975('0x1e1')]/0x64;return _0x1cf3c3['busyFactor'](_0x2ad4ee,_0x1b802c,_0x34706c,_0x40f2b7,_0x51f1fd)[_0x1975('0xab')](function(_0x34c9af){return _0x334809(_0x34c9af);});default:return _0x2fba43(msgResponse(_0x1975('0x1e2'),'Failure',_0x1975('0x1e3')));}}else{return _0x2fba43(msgResponse('[getDataPredictive]',_0x1975('0x98'),_0x1975('0x1e4')));}});};};Dialer[_0x1975('0x1d')][_0x1975('0x1e5')]=function(_0x2ca6db){var _0x54d3ae=this;return function(_0xd99753){return new Promise(function(_0x16aa53,_0x442125){_['merge'](_0x2ca6db,_0xd99753[0x0]);if(checkGetDataPredictive(_0xd99753[0x0])){loggerPredictive[_0x1975('0x4f')](JSON[_0x1975('0x7a')](_0xd99753[0x0]));if(_0x2ca6db[_0x1975('0x1d0')]===_0x1975('0x1d1')){return _0x54d3ae['getVoiceQueueRtPauses'](_0x2ca6db['id'])[_0x1975('0xab')](function(_0x23f94a){var _0x1de6da=_0x2ca6db[_0x1975('0x1e6')]-_0x23f94a[0x0]['outboundQueuePauses'];var _0xd9e73a=_0x2ca6db[_0x1975('0x1ce')]*0x3c;var _0x4e6cdf=_0xd99753[0x0][_0x1975('0x5a')]+_0xd99753[0x0][_0x1975('0x58')];var _0x57f531=(_0xd99753[0x0][_0x1975('0x52')]+_0xd99753[0x0][_0x1975('0x54')]+_0xd99753[0x0][_0x1975('0x56')])/_0xd99753[0x0][_0x1975('0x51')];var _0x48805b=_0x2ca6db[_0x1975('0x1e1')]/0x64;_0x2ca6db[_0x1975('0x1e7')]=_0x23f94a[0x0][_0x1975('0x1e8')]||0x0;_0x2ca6db[_0x1975('0x1c9')]=_0x57f531>0x0?_0x57f531:0x1;return _0x54d3ae[_0x1975('0x1df')](_0x1de6da,_0xd9e73a,_0x4e6cdf,_0x57f531,_0x48805b);})['then'](function(_0x4122f9){return _0x16aa53(_0x4122f9);})[_0x1975('0xa9')](function(_0x1f0aae){return _0x442125(msgResponse(_0x1975('0x1e9'),_0x1975('0x98'),JSON[_0x1975('0x7a')](_0x1f0aae)));});}if(_0x2ca6db[_0x1975('0x1d0')]===_0x1975('0x1e0')){return _0x54d3ae[_0x1975('0x15a')](_0x2ca6db['id'])[_0x1975('0xab')](function(_0x53fd2f){var _0x3d1adb=_0x2ca6db['loggedIn']-_0x53fd2f[0x0][_0x1975('0x1e8')];var _0x37e46b=_0x2ca6db['dialPredictiveInterval']*0x3c;var _0x3d495a=_0xd99753[0x0][_0x1975('0x5a')]+_0xd99753[0x0]['predictiveIntervalAvgHoldtime'];var _0x5a1f76=(_0xd99753[0x0][_0x1975('0x52')]+_0xd99753[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xd99753[0x0][_0x1975('0x56')])/_0xd99753[0x0]['predictiveIntervalTotalCalls'];var _0x5608f5=_0x2ca6db[_0x1975('0x1e1')]/0x64;_0x2ca6db[_0x1975('0x1e7')]=_0x53fd2f[0x0][_0x1975('0x1e8')]||0x0;_0x2ca6db[_0x1975('0x1c9')]=_0x5a1f76>0x0?_0x5a1f76:0x1;return _0x54d3ae[_0x1975('0x1ea')](_0x3d1adb,_0x37e46b,_0x3d495a,_0x5a1f76,_0x5608f5);})[_0x1975('0xab')](function(_0x5b79d4){return _0x16aa53(_0x5b79d4);})[_0x1975('0xa9')](function(_0x3f705f){return _0x442125(msgResponse(_0x1975('0x1e9'),_0x1975('0x98'),JSON[_0x1975('0x7a')](_0x3f705f)));});}}else{return _0x442125(msgResponse(_0x1975('0x1e2'),_0x1975('0x98'),_0x1975('0x1e4')));}});};};Dialer[_0x1975('0x1d')][_0x1975('0x1eb')]=function(_0x5f432b){var _0x1fcaec=this;return function(){var _0x1ba2f8=0x0;var _0x5a0de2=Math[_0x1975('0x1ec')](_0x5f432b[_0x1975('0x62')]*0x3e8);if(_0x5a0de2>0x0){_0x5a0de2=_0x5a0de2<0x64?0x64:_0x5a0de2;loggerPredictive[_0x1975('0x4f')](_0x5f432b['name'],_0x1975('0x1ed'),_0x5a0de2,_0x1975('0x1ee'));_0x5f432b[_0x1975('0x67')]=setInterval(function(){_0x1fcaec[_0x1975('0x67')](_0x5f432b);loggerPredictiveCalls[_0x1975('0x4f')](_0x1975('0x1ef'),_0x1ba2f8+=0x1);},_0x5a0de2);}else{loggerPredictive['info'](_0x5f432b['name'],_0x1975('0x1f0'));}};};Dialer[_0x1975('0x1d')][_0x1975('0x1f1')]=function(_0x27ad2e,_0x178d5c){var _0x96beb8=this;return function(_0x5f2d85){if(_[_0x1975('0x7e')](_0x5f2d85)){if(_[_0x1975('0xfc')](_0x178d5c[_0x1975('0x1f2')])||!_0x178d5c[_0x1975('0x1f3')]){if(_0x27ad2e[_0x1975('0xbc')]===_0x1975('0xb')){_0x27ad2e[_0x1975('0x77')]=_[_0x1975('0x5c')](_0x27ad2e[_0x1975('0x77')])?!![]:_0x27ad2e[_0x1975('0x77')];var _0x2a95b7=uuid['v4']();_0x96beb8[_0x1975('0x27')][_0x2a95b7]=new Action(_0x27ad2e,_0x178d5c,_0x2a95b7);loggerBooked[_0x1975('0x4f')](_0x1975('0x1f4'),_0x2a95b7,_0x1975('0x1f5'),JSON[_0x1975('0x7a')](_0x27ad2e[_0x1975('0x77')]),_0x1975('0x1f6'),_0x27ad2e['name']);if(_0x27ad2e['queueStatusComplete']){_0x27ad2e[_0x1975('0x77')]=![];_0x96beb8[_0x1975('0x2c')][_0x96beb8['actions'][_0x2a95b7][_0x1975('0xc7')]]=[];ami[_0x1975('0xaa')]({'actionid':_0x2a95b7,'action':_0x1975('0x1f7'),'queue':_0x27ad2e[_0x1975('0x4d')]})[_0x1975('0xa9')](function(){_0x96beb8[_0x1975('0xca')](_0x27ad2e);hopperUtils[_0x1975('0xe3')]({'active':![],'ContactId':_0x96beb8[_0x1975('0x27')][_0x2a95b7][_0x1975('0xe6')],'ListId':_0x96beb8[_0x1975('0x27')][_0x2a95b7][_0x1975('0xe7')],'VoiceQueueId':_0x96beb8[_0x1975('0x27')][_0x2a95b7][_0x1975('0xf5')]||undefined,'CampaignId':_0x96beb8['actions'][_0x2a95b7]['CampaignId']||undefined})[_0x1975('0xa9')](loggerCatch(_0x1975('0x1f8')));delete _0x96beb8[_0x1975('0x27')][_0x2a95b7];});}else{loggerBooked['info'](_0x1975('0x1f9'),JSON[_0x1975('0x7a')](_0x27ad2e[_0x1975('0x77')]),_0x1975('0x1f6'),_0x27ad2e[_0x1975('0x4d')]);_0x96beb8[_0x1975('0xca')](_0x27ad2e);hopperUtils[_0x1975('0xe3')]({'active':![],'ContactId':_0x96beb8['actions'][_0x2a95b7][_0x1975('0xe6')],'ListId':_0x96beb8[_0x1975('0x27')][_0x2a95b7][_0x1975('0xe7')],'VoiceQueueId':_0x96beb8[_0x1975('0x27')][_0x2a95b7][_0x1975('0xf5')]||undefined,'CampaignId':_0x96beb8['actions'][_0x2a95b7][_0x1975('0xe8')]||undefined})['catch'](loggerCatch(_0x1975('0x1f8')));delete _0x96beb8[_0x1975('0x27')][_0x2a95b7];}}else{return _0x96beb8['actionOriginate'](_0x27ad2e,_0x178d5c);}}else{if(utils[_0x1975('0xd6')](undefined,_0x178d5c['scheduledat'])<_0x27ad2e[_0x1975('0x1fa')]*0x3c){if(_0x178d5c[_0x1975('0x151')]&&!_0x178d5c[_0x1975('0x151')][_0x1975('0x1fb')]){_0x96beb8['preview']['run'](_0x178d5c['id'])[_0x1975('0x1f')](function(){_0x96beb8[_0x1975('0xca')](_0x27ad2e);});}else{hopperUtils[_0x1975('0x1fc')]({'active':![]},_0x178d5c['id'],0x1)[_0x1975('0x1f')](function(){_0x96beb8[_0x1975('0xca')](_0x27ad2e);});}}else{_0x27ad2e[_0x1975('0x1fd')]+=0x1;_0x96beb8[_0x1975('0xca')](_0x27ad2e);if(_0x27ad2e['dialRecallInQueue']){hopperUtils[_0x1975('0xe3')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x178d5c[_0x1975('0xe6')],'ListId':_0x178d5c[_0x1975('0xe7')],'VoiceQueueId':_0x178d5c[_0x1975('0xf5')]||undefined,'CampaignId':_0x178d5c[_0x1975('0xe8')]||undefined})[_0x1975('0xa9')](loggerCatch(_0x1975('0x1fe')));hopperUtils[_0x1975('0xd1')](createObjHistory(_0x27ad2e,_0x178d5c,utils[_0x1975('0x6f')][_0x1975('0x1ff')],0x17,_0x1975('0x200')))[_0x1975('0xa9')](loggerCatch(_0x1975('0x201')));}else{_0x96beb8[_0x1975('0x122')](createObjHistory(_0x27ad2e,_0x178d5c,utils['CAMPAIGN_STATUS'][_0x1975('0x202')],0x16,'RecallFailedTimeout'),_0x1975('0x203'),'[Originate][HistoryRecallClose]');}}}}else{_0x27ad2e['outboundBlacklistCallsDay']+=0x1;_0x96beb8[_0x1975('0x122')](createObjHistory(_0x27ad2e,_0x178d5c,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,_0x1975('0x204')),_0x1975('0x205'),_0x1975('0x206'));throw'inBlackList';}};};Dialer[_0x1975('0x1d')][_0x1975('0x162')]=function(_0x8d660d){var _0x2f1228=this;var _0x5cd369=_0x8d660d['limitCalls']-_0x8d660d[_0x1975('0x87')];emitCampaignSummary(_0x8d660d);if(_0x5cd369>0x0&&_0x8d660d[_0x1975('0x207')]==0x0){if(_0x5cd369>this[_0x1975('0x25')]){_0x5cd369=this[_0x1975('0x25')];}_0x8d660d[_0x1975('0x207')]=0x1;hopperUtils['getContactDialerIvr'](_0x8d660d,_0x5cd369)[_0x1975('0xab')](function(_0x474f79){_0x8d660d[_0x1975('0x207')]=0x0;if(_0x474f79){if(!utils['checkContactEmpty'](_0x474f79)){_0x8d660d[_0x1975('0x6e')]=utils[_0x1975('0x6f')][_0x1975('0x208')];logger['info']('[getContactCampaign2][Empty]'+_0x8d660d[_0x1975('0x4d')]);}else{_0x8d660d[_0x1975('0x87')]+=_0x474f79[_0x1975('0xa1')];_0x8d660d[_0x1975('0x6e')]=utils[_0x1975('0x6f')][_0x1975('0x209')];for(var _0x3e2754=0x0;_0x3e2754<_0x474f79[_0x1975('0xa1')];_0x3e2754+=0x1){_0x8d660d['ivrTotalCallsDays']+=0x1;if(_[_0x1975('0xfc')](_0x474f79[_0x3e2754])||_[_0x1975('0xfc')](_0x474f79[_0x3e2754][_0x1975('0x20a')])||_[_0x1975('0xfc')](_0x474f79[_0x3e2754][_0x1975('0x166')])){_0x2f1228['emptyContact'](_0x1975('0x20b'),_0x8d660d,_0x474f79[_0x3e2754]);}else{hopperUtils[_0x1975('0x20c')](_[_0x1975('0x102')](_0x474f79[_0x3e2754],[_0x1975('0xe8'),'phone']))['then'](_0x2f1228[_0x1975('0x1f1')](_0x8d660d,_0x474f79[_0x3e2754]))[_0x1975('0xa9')](_0x2f1228[_0x1975('0x15d')](_0x1975('0x20d'),_0x8d660d));}}}}})[_0x1975('0xa9')](loggerGetContactDialer(_0x1975('0x20e'),_0x8d660d,_0x5cd369));}};Dialer[_0x1975('0x1d')][_0x1975('0xc0')]=function(_0x2e31ea,_0x47422e){var _0x40b30b=this;var _0x523bac=[];if(_0x47422e<0x1||_0x2e31ea[_0x1975('0xbc')]===_0x1975('0xb')){_0x47422e=0x1;}var _0x34360a=Math[_0x1975('0x1ec')](_0x2e31ea['available']*_0x47422e)-_0x2e31ea[_0x1975('0x87')];if(_0x2e31ea[_0x1975('0x20f')]>0x0){var _0x3cb285=_0x2e31ea[_0x1975('0x20f')]-_0x2e31ea[_0x1975('0x87')]-_0x2e31ea['talking']-_0x2e31ea[_0x1975('0x210')];if(_0x34360a>_0x3cb285){_0x34360a=_0x3cb285;}}if(_0x34360a>0x0&&_0x2e31ea['temp']==0x0){if(_0x2e31ea[_0x1975('0xbc')]===_0x1975('0xb')){_0x34360a=0x1;}if(_0x34360a>this[_0x1975('0x25')]){_0x34360a=this[_0x1975('0x25')];}for(var _0x47719c in this[_0x1975('0x23')]){if(typeof this[_0x1975('0x23')][_0x47719c]!=='undefined'){if(this[_0x1975('0x23')][_0x47719c][_0x1975('0x73')]===_0x1975('0x211')&&this[_0x1975('0x23')][_0x47719c][_0x1975('0x90')]===_0x1975('0x91')){_0x523bac['push'](this['agents'][_0x47719c]['id']);}}}_0x2e31ea[_0x1975('0x207')]=0x1;hopperUtils['getContactDialer'](_0x2e31ea,_0x523bac,_0x34360a)['then'](function(_0x5f4a21){_0x2e31ea[_0x1975('0x207')]=0x0;if(_0x5f4a21){if(!utils['checkContactEmpty'](_0x5f4a21)){hopperUtils['countReScheduled'](_0x2e31ea)['then'](sendMessageReschedule(_0x2e31ea))[_0x1975('0xa9')](loggerCatch(_0x1975('0x212')));}else{_0x2e31ea[_0x1975('0x87')]+=_0x5f4a21[_0x1975('0xa1')];_0x2e31ea[_0x1975('0x6e')]=_0x2e31ea[_0x1975('0xbc')]===_0x1975('0xb')?utils[_0x1975('0x6f')]['ACTIVE']:utils['CAMPAIGN_STATUS'][_0x1975('0x209')];for(var _0x85105e=0x0;_0x85105e<_0x5f4a21[_0x1975('0xa1')];_0x85105e+=0x1){if(_['isNil'](_0x5f4a21[_0x85105e])||_[_0x1975('0xfc')](_0x5f4a21[_0x85105e]['Contact'])||_[_0x1975('0xfc')](_0x5f4a21[_0x85105e][_0x1975('0x166')])){_0x40b30b['emptyContact']('[actionOriginate]\x20',_0x2e31ea,_0x5f4a21[_0x85105e]);}else{hopperUtils[_0x1975('0x213')](_[_0x1975('0x102')](_0x5f4a21[_0x85105e],[_0x1975('0xf5'),_0x1975('0x166')]))['then'](_0x40b30b['checkContactBlack'](_0x2e31ea,_0x5f4a21[_0x85105e]))[_0x1975('0xa9')](_0x40b30b[_0x1975('0x15d')](_0x1975('0x20b'),_0x2e31ea));}}}}})[_0x1975('0xa9')](loggerGetContactDialer(_0x1975('0x214'),_0x2e31ea,_0x34360a));}};Dialer[_0x1975('0x1d')][_0x1975('0x67')]=function(_0x42f25c){if(_0x42f25c[_0x1975('0x20f')]>0x0){var _0x45b389=_0x42f25c['dialLimitQueue']-_0x42f25c[_0x1975('0x87')]-_0x42f25c[_0x1975('0x147')];if(_0x45b389>0x0&&_0x42f25c[_0x1975('0x207')]==0x0){this[_0x1975('0x215')](_0x42f25c);}else{loggerPredictiveCalls[_0x1975('0x4f')](_0x1975('0x216'));}}else{this[_0x1975('0x215')](_0x42f25c);}};Dialer[_0x1975('0x1d')]['tryOriginatePredictive']=function(_0x5668f1){var _0x184d78=this;var _0x48a989=[];_0x5668f1[_0x1975('0x87')]+=0x1;for(var _0x2a8bc7 in this[_0x1975('0x23')]){if(typeof this['agents'][_0x2a8bc7]!=='undefined'){if(this[_0x1975('0x23')][_0x2a8bc7][_0x1975('0x73')]===_0x1975('0x211')&&this[_0x1975('0x23')][_0x2a8bc7][_0x1975('0x90')]==='reachable'){_0x48a989[_0x1975('0xa2')](this[_0x1975('0x23')][_0x2a8bc7]['id']);}}}_0x5668f1[_0x1975('0x207')]=0x1;return this[_0x1975('0x217')](_0x5668f1['id'],_0x48a989,0x1,_0x5668f1[_0x1975('0x218')],_0x5668f1)[_0x1975('0xab')](function(_0x594bae){_0x5668f1[_0x1975('0x207')]=0x1;if(_0x594bae){if(!utils[_0x1975('0x219')](_0x594bae)){utils[_0x1975('0x6c')](_0x5668f1,0x1,0x0);return hopperUtils[_0x1975('0x21a')](_0x5668f1)[_0x1975('0xab')](sendMessageReschedule(_0x5668f1))[_0x1975('0xa9')](loggerCatch('[countReScheduled]\x20'));}else{_0x5668f1['message']=utils[_0x1975('0x6f')][_0x1975('0x209')];if(_[_0x1975('0xfc')](_0x594bae[0x0])||_[_0x1975('0xfc')](_0x594bae[0x0][_0x1975('0x20a')])||_[_0x1975('0xfc')](_0x594bae[0x0][_0x1975('0x166')])){_0x184d78[_0x1975('0x21b')](_0x1975('0x20b'),_0x5668f1,_0x594bae[0x0]);}else{return hopperUtils[_0x1975('0x213')](_[_0x1975('0x102')](_0x594bae[0x0],[_0x1975('0xf5'),'phone']))[_0x1975('0xab')](_0x184d78[_0x1975('0x1f1')](_0x5668f1,_0x594bae[0x0]))['catch'](_0x184d78[_0x1975('0x15d')](_0x1975('0x21c'),_0x5668f1));}}}})[_0x1975('0xa9')](loggerGetContactDialer(_0x1975('0x21d'),_0x5668f1,0x1));};Dialer[_0x1975('0x1d')][_0x1975('0x1df')]=function(_0x82c1c7,_0x2ae3c4,_0x3cf969,_0xfecfd1,_0x1956a6,_0x1b6593){loggerPredictive[_0x1975('0x4f')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x1975('0x4f')](_0x1975('0x21e'),_0x82c1c7);loggerPredictive['info'](_0x1975('0x21f'),_0x2ae3c4);loggerPredictive[_0x1975('0x4f')](_0x1975('0x220'),_0x3cf969);loggerPredictive[_0x1975('0x4f')](_0x1975('0x221'),_0xfecfd1);loggerPredictive[_0x1975('0x4f')](_0x1975('0x222'),_0x1956a6);loggerPredictive['info'](_0x1975('0x5b'));return new Promise(function(_0x28c8ca,_0x47482e){if(_0x82c1c7<=0x0||isNaN(_0x82c1c7)){return _0x47482e(msgResponse(_0x1975('0x223'),_0x1975('0x8c'),_0x1975('0x224')+_0x82c1c7));}if(_0x3cf969<=0x0||isNaN(_0x3cf969)){return _0x47482e(msgResponse('[abandonmentRate]','Error',_0x1975('0x225')+_0x3cf969));}if(_0xfecfd1<=0x0||isNaN(_0xfecfd1)){return _0x47482e(msgResponse(_0x1975('0x223'),_0x1975('0x8c'),'p\x20=\x20'+_0xfecfd1));}if(_0x2ae3c4<=0x0||isNaN(_0x2ae3c4)){return _0x47482e(msgResponse(_0x1975('0x223'),_0x1975('0x8c'),_0x1975('0x226')+_0x2ae3c4));}if(_0x1956a6<=0x0||isNaN(_0x1956a6)){return _0x47482e(msgResponse(_0x1975('0x223'),'Error',_0x1975('0x227')+_0x1956a6));}_0x1b6593=_0x1b6593||0x0;var _0x36e68e=0x1/_0x3cf969;var _0x20acb4=0x0;var _0xe6e686=0x0;var _0x353578=0x0;var _0x5bc220=0x0;for(var _0x2e9513=0x0;_0x353578<_0x1956a6;_0x2e9513+=0x1){_0xe6e686=_0x2e9513/_0x2ae3c4;_0x20acb4=(_0xfecfd1*_0xe6e686+_0x1b6593)/_0x36e68e;_0x353578=utils['erlangb'](_0x20acb4,_0x82c1c7);_0x5bc220=_0x20acb4/_0x82c1c7*(0x1-utils[_0x1975('0x228')](_0x20acb4,_0x82c1c7));}return _0x28c8ca({'erlangCalls':_0x2e9513,'erlangCallToSecond':_0x2ae3c4/_0x2e9513,'erlangAbandonmentRate':_0x353578,'erlangBusyFactor':_0x5bc220});});};Dialer[_0x1975('0x1d')][_0x1975('0x1ea')]=function(_0x4bc4aa,_0x34aa38,_0x261ae9,_0x545f6c,_0x3da62e,_0x4948f5){loggerPredictive[_0x1975('0x4f')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x1975('0x4f')](_0x1975('0x21e'),_0x4bc4aa);loggerPredictive[_0x1975('0x4f')](_0x1975('0x21f'),_0x34aa38);loggerPredictive[_0x1975('0x4f')](_0x1975('0x220'),_0x261ae9);loggerPredictive[_0x1975('0x4f')](_0x1975('0x221'),_0x545f6c);loggerPredictive[_0x1975('0x4f')](_0x1975('0x229'),_0x3da62e);loggerPredictive[_0x1975('0x4f')](_0x1975('0x5b'));return new Promise(function(_0x1d434,_0x591b63){if(_0x4bc4aa<=0x0||isNaN(_0x4bc4aa)){return _0x591b63(msgResponse('[busyFactor]',_0x1975('0x8c'),'m\x20=\x20'+_0x4bc4aa));}if(_0x261ae9<=0x0||isNaN(_0x261ae9)){return _0x591b63(msgResponse(_0x1975('0x22a'),_0x1975('0x8c'),_0x1975('0x225')+_0x261ae9));}if(_0x545f6c<=0x0||isNaN(_0x545f6c)){return _0x591b63(msgResponse(_0x1975('0x22a'),_0x1975('0x8c'),_0x1975('0x22b')+_0x545f6c));}if(_0x34aa38<=0x0||isNaN(_0x34aa38)){return _0x591b63(msgResponse(_0x1975('0x22a'),_0x1975('0x8c'),_0x1975('0x226')+_0x34aa38));}if(_0x3da62e<=0x0||isNaN(_0x3da62e)){return _0x591b63(msgResponse(_0x1975('0x22a'),_0x1975('0x8c'),_0x1975('0x22c')+_0x3da62e));}_0x4948f5=_0x4948f5||0x0;var _0x1b78ea=0x1/_0x261ae9;var _0x9d6f7d=0x0;var _0x3e3b3f=0x0;var _0x1a6e3b=0x0;var _0x79ed4d=0x0;for(var _0x5ace2b=0x0;_0x79ed4d<_0x3da62e;_0x5ace2b+=0x1){_0x3e3b3f=_0x5ace2b/_0x34aa38;_0x9d6f7d=(_0x545f6c*_0x3e3b3f+_0x4948f5)/_0x1b78ea;_0x1a6e3b=utils[_0x1975('0x228')](_0x9d6f7d,_0x4bc4aa);_0x79ed4d=_0x9d6f7d/_0x4bc4aa*(0x1-utils[_0x1975('0x228')](_0x9d6f7d,_0x4bc4aa));}return _0x1d434({'erlangCalls':_0x5ace2b,'erlangCallToSecond':_0x34aa38/_0x5ace2b,'erlangAbandonmentRate':_0x1a6e3b,'erlangBusyFactor':_0x79ed4d});});};module['exports']=Dialer; \ No newline at end of file +var _0x72b9=['predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','stringify','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','INACTIVE','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','[ifTime][Action]','prototype','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','push','Action','command','iftime\x20%s,%s','interval','then','true','catch','timezones','content','indexOf','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','booked','method\x20not\x20recognized','silly','intervalIftime','\x20Interval\x20is\x20overtime:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','Error','queue','ivr','updateOriginated','uniqueid','answertime','YYYY-MM-DD\x20HH:mm:ss','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','ContactId','VoiceQueueId','CampaignId','starttime','calleridname','calleridnum','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','minutes','ListId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','pick','run','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','idHopper','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','Machine','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','dialMachineMaxRetry','add','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[syncHangupIvr][createHistory]','dialQueueProject','AGI','[syncHangupIvr]','cause-txt','outboundUnknownCallsDay','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','ACTIVE','[syncQueueSummary]','updateReportFromOutboundQueue','assign','throttle','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','getCaller','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','getCallerId','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','callAdditionalPhoneAfterMin','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dialPredictiveOptimization','dropRate','Max\x20Drop\x20','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','milliseconds','[handlePredictive]','recallme','queueStatusComplete','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','limitCalls','temp','checkContactEmpty','ivrTotalCallsDays','Contact','emptyContact','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]\x20','dialLimitQueue','getContactDialer','countReScheduled','[countReScheduled]\x20','RUNNING','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','not_inuse','checkContactLowerLimitOriginate','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\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','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','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','syncQueueSummary','../ami','defaults','redis','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/final','./models/queueCallerAbandon','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','isUndefined','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'];(function(_0x334e47,_0xe2ed4){var _0x39e34e=function(_0xf4aedd){while(--_0xf4aedd){_0x334e47['push'](_0x334e47['shift']());}};_0x39e34e(++_0xe2ed4);}(_0x72b9,0x1c7));var _0x972b=function(_0x4492af,_0x47e25d){_0x4492af=_0x4492af-0x0;var _0x216729=_0x72b9[_0x4492af];return _0x216729;};'use strict';var util=require('util');var _=require('lodash');var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require(_0x972b('0x0'));var utils=require(_0x972b('0x1'));var hopperUtils=require(_0x972b('0x2'));var ut=require(_0x972b('0x3'));var config=require(_0x972b('0x4'));var logger=require(_0x972b('0x5'))(_0x972b('0x6'));var loggerBooked=require(_0x972b('0x5'))('booked');var loggerPredictive=require(_0x972b('0x5'))(_0x972b('0x7'));var loggerPredictiveCalls=require(_0x972b('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x972b('0x8'));var ami=require(_0x972b('0x9'));config['redis']=_[_0x972b('0xa')](config[_0x972b('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x972b('0xc'))(new Redis(config[_0x972b('0xb')]));var cmHopper=require(_0x972b('0xd'));var voiceQueueRt=require(_0x972b('0xe'));var RpcSetting=require(_0x972b('0xf'));var Interval=require('../rpc/interval');var Action=require(_0x972b('0x10'));var History=require('./models/history');var Final=require(_0x972b('0x11'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x972b('0x12'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0x972b('0x13')]||_0x972b('0x14');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x972b('0x15')]=function(_0x594c9b){this[_0x972b('0x16')]=this[_0x972b('0x16')]?this['tail'][_0x972b('0x17')](_0x594c9b):_0x594c9b();};function Dialer(_0x126f95,_0x19ff58){this[_0x972b('0x18')]=new Sequence();this[_0x972b('0x19')]=_0x19ff58;this['voiceQueues']=_0x126f95[_0x972b('0x1a')];this[_0x972b('0x1b')]=_0x126f95[_0x972b('0x1b')];this[_0x972b('0x1c')]=_0x126f95[_0x972b('0x1c')];this[_0x972b('0x1d')]=_0x126f95['trunks'];this[_0x972b('0x1e')]=config['maxNumberOriginate']||0x2;this[_0x972b('0x1f')]={};this['actions']={};this[_0x972b('0x20')]={};this[_0x972b('0x21')]={};this['optionPredictive']={};this[_0x972b('0x22')]={};this[_0x972b('0x23')]={};this[_0x972b('0x24')]={};this[_0x972b('0x25')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on']('agentconnect',this[_0x972b('0x26')][_0x972b('0x27')](this));ami['on'](_0x972b('0x28'),this[_0x972b('0x29')][_0x972b('0x27')](this));ami['on']('originateresponse',this[_0x972b('0x2a')][_0x972b('0x27')](this));ami['on'](_0x972b('0x2b'),this[_0x972b('0x2c')]['bind'](this));ami['on']('custom:queuesummary',this[_0x972b('0x8')][_0x972b('0x27')](this));ami['on'](_0x972b('0x2d'),this[_0x972b('0x2e')][_0x972b('0x27')](this));ami['on'](_0x972b('0x2f'),this[_0x972b('0x30')][_0x972b('0x27')](this));ami['on'](_0x972b('0x31'),this['syncNewExten'][_0x972b('0x27')](this));ami['on'](_0x972b('0x32'),this[_0x972b('0x33')][_0x972b('0x27')](this));ami['on'](_0x972b('0x34'),this[_0x972b('0x35')][_0x972b('0x27')](this));ami['on'](_0x972b('0x36'),this[_0x972b('0x37')][_0x972b('0x27')](this));this[_0x972b('0x38')]();this[_0x972b('0x39')]();RpcSetting[_0x972b('0x3a')]()['then'](function(_0x4fb2f6){previewRecallmeReminderInterval=_0x4fb2f6['previewRecallmeReminderInterval'];});}function isNotNull(_0x2b6b1f){return _0x2b6b1f!==null&&!_[_0x972b('0x3b')](_0x2b6b1f);}function msgResponse(_0xf5bb51,_0x4b02e1,_0x55be71){return{'action':_0xf5bb51,'response':_0x4b02e1,'message':_0x55be71,'stack':_0x55be71};}function emit(_0x3d77f7,_0x3f626e,_0x1d2049){io['to'](_0x3d77f7)['emit'](_0x3f626e,_0x1d2049);}function emitOutboundVoiceQueueSummary(_0x5017ec){if(_0x5017ec[_0x972b('0x3c')]===_0x972b('0x3d')){logger[_0x972b('0x3e')](_0x972b('0x3f'),util[_0x972b('0x40')](_0x5017ec,{'showHidden':![],'depth':null}));emit(util[_0x972b('0x41')]('voice:queue:%s',_0x5017ec[_0x972b('0x42')]),_0x972b('0x43'),_0x5017ec);}}function checkGetDataPredictive(_0x53410b){if(isNotNull(_0x53410b)&&!_[_0x972b('0x44')](_0x53410b)){loggerPredictive[_0x972b('0x45')](_0x972b('0x46'));loggerPredictive[_0x972b('0x45')](_0x972b('0x47'),_0x53410b[_0x972b('0x48')]);loggerPredictive[_0x972b('0x45')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x53410b[_0x972b('0x49')]);loggerPredictive[_0x972b('0x45')](_0x972b('0x4a'),_0x53410b[_0x972b('0x4b')]);loggerPredictive['info'](_0x972b('0x4c'),_0x53410b[_0x972b('0x4d')]);loggerPredictive[_0x972b('0x45')](_0x972b('0x4e'),_0x53410b['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x972b('0x45')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x53410b['predictiveIntervalAvgTalktime']);loggerPredictive['info']('---------------------------');if(_0x53410b[_0x972b('0x48')]>0x0){if(!_[_0x972b('0x3b')](_0x53410b[_0x972b('0x4f')])&&_0x53410b[_0x972b('0x4f')]>0x0){return!![];}loggerPredictive[_0x972b('0x45')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x972b('0x3b')](_0x53410b[_0x972b('0x50')])&&_0x53410b['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x972b('0x45')](_0x972b('0x51'));}else{loggerPredictive[_0x972b('0x45')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x972b('0x52'));}return![];}function mergeDataErlangB(_0x3fe23b){return function(_0x27d3e7){loggerPredictive[_0x972b('0x45')](_0x972b('0x53'));loggerPredictive['info'](_0x972b('0x54'),_0x27d3e7[_0x972b('0x55')]);loggerPredictive['info'](_0x972b('0x56'),_0x27d3e7[_0x972b('0x57')]);loggerPredictive[_0x972b('0x45')](_0x972b('0x58'),_0x27d3e7[_0x972b('0x59')]);loggerPredictive['info'](_0x972b('0x5a'),_0x27d3e7['erlangBusyFactor']);loggerPredictive[_0x972b('0x45')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x27d3e7[_0x972b('0x59')]);loggerPredictive[_0x972b('0x45')](_0x972b('0x5b'));_[_0x972b('0x5c')](_0x3fe23b,_0x27d3e7);};}function ifInterval(_0x56985c,_0x2cc827){if(_[_0x972b('0x3b')](_0x2cc827)){return![];}return utils[_0x972b('0x5d')](undefined,_0x2cc827)<_0x56985c*0x3c;}function clearPredictiveAttributes(_0xa2fd80){if(_0xa2fd80[_0x972b('0x23')]){_0xa2fd80[_0x972b('0x23')]=undefined;loggerPredictive['debug'](_0xa2fd80[_0x972b('0x42')],_0x972b('0x5e'));}if(_0xa2fd80[_0x972b('0x22')]){_0xa2fd80[_0x972b('0x22')]=undefined;loggerPredictive[_0x972b('0x3e')](_0xa2fd80['name'],_0x972b('0x5f'));}if(_0xa2fd80[_0x972b('0x60')]){clearInterval(_0xa2fd80[_0x972b('0x60')]);_0xa2fd80['handlePredictive']=undefined;loggerPredictive[_0x972b('0x3e')](_0xa2fd80['name'],_0x972b('0x61'));}}function loggerCatchPredictive(_0x23a6e7,_0x42c4af){return function(_0x578a6c){loggerPredictive[_0x972b('0x62')](_0x42c4af[_0x972b('0x42')],_0x23a6e7);loggerPredictive[_0x972b('0x62')](_0x578a6c[_0x972b('0x63')]);clearPredictiveAttributes(_0x42c4af);};}function loggerCatch(_0x4a8c83){return function(_0x2e7121){logger[_0x972b('0x62')](_0x4a8c83,util['inspect'](_0x2e7121,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x322cd2,_0x23c067,_0x53fdf7){return function(_0x534948){utils['checkContactLowerLimitOriginate'](_0x23c067,_0x53fdf7,0x0);_0x23c067['temp']=0x0;logger['error'](_0x322cd2,util['inspect'](_0x534948,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x26bb85){return function(_0x1fdff1){if(isNotNull(_0x1fdff1)&&isNotNull(_0x1fdff1[0x0])){if(_0x1fdff1[0x0][_0x972b('0x64')]>0x0){_0x26bb85[_0x972b('0x65')]=utils[_0x972b('0x66')][_0x972b('0x67')];logger[_0x972b('0x45')](_0x972b('0x68')+_0x26bb85[_0x972b('0x42')],_0x1fdff1[0x0][_0x972b('0x64')],_0x972b('0x69'));}else{_0x26bb85[_0x972b('0x65')]=utils[_0x972b('0x66')][_0x972b('0x6a')];logger[_0x972b('0x45')](_0x972b('0x6b')+_0x26bb85[_0x972b('0x42')]);}}};}function createObjHistory(_0x1862d0,_0x12c512,_0x5c4590,_0x129dc2,_0x4e0226){_0x1862d0[_0x972b('0x65')]=_0x5c4590;var _0x36bc6d=new Action(_0x1862d0,_0x12c512);var _0x5e0aa8=new History(_0x36bc6d);_0x5e0aa8[_0x972b('0x6c')]=_0x129dc2;_0x5e0aa8[_0x972b('0x6d')]=_0x4e0226;_0x5e0aa8[_0x972b('0x6e')]=_0x36bc6d['starttime'];return _0x5e0aa8;}function unlockQueueStatus(_0x2c27c4,_0x34d01e){setTimeout(function(){if(_['isUndefined'](_0x2c27c4['queueStatusComplete'])){loggerBooked[_0x972b('0x62')]('[unlockQueueStatus][undefined]',_0x34d01e);}_0x2c27c4['queueStatusComplete']=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x34d01e,JSON[_0x972b('0x6f')](_['pick'](_0x2c27c4,[_0x972b('0x42'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x2a2d11){return function(){if(!isNotNull(_0x2a2d11[_0x972b('0x70')])){_0x2a2d11[_0x972b('0x65')]=utils[_0x972b('0x66')][_0x972b('0x71')];throw _0x2a2d11[_0x972b('0x42')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x2a2d11[_0x972b('0x70')][_0x972b('0x72')])){_0x2a2d11['message']=utils[_0x972b('0x66')]['NULL_INTERVAL'];throw _0x2a2d11[_0x972b('0x42')]+_0x972b('0x73');}if(!isNotNull(_[_0x972b('0x44')](_0x2a2d11[_0x972b('0x70')]['Intervals']))){_0x2a2d11[_0x972b('0x65')]=utils['CAMPAIGN_STATUS'][_0x972b('0x71')];throw _0x2a2d11[_0x972b('0x42')]+_0x972b('0x73');}};}function checkIsIVRCampaignActive(_0x41295d){return function(){if(!utils['isIVRCampaignActive'](_0x41295d)){_0x41295d[_0x972b('0x65')]=utils['CAMPAIGN_STATUS'][_0x972b('0x74')];throw _0x41295d[_0x972b('0x42')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x1e727c){if(utils[_0x972b('0x75')](_0x1e727c)){emit(util[_0x972b('0x41')](_0x972b('0x76'),_0x1e727c[_0x972b('0x42')]),_0x972b('0x77'),_0x1e727c);}}function loggerCatchQueueSummary(_0x2e7139,_0x5234e1){return function(_0x14a74a){clearPredictiveAttributes(_0x5234e1);emitCampaignSummary(_0x5234e1);loggerSyncQueueSummary[_0x972b('0x3e')](_0x2e7139,util[_0x972b('0x40')](_0x14a74a,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x53dd46){if(_0x53dd46[_0x972b('0x78')]){if(_0x53dd46[_0x972b('0x79')]===0x0){_0x53dd46['sendMessageOneNotActive']=![];_0x53dd46[_0x972b('0x65')]=utils[_0x972b('0x66')][_0x972b('0x74')];loggerSyncQueueSummary[_0x972b('0x3e')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x53dd46['name'],_0x972b('0x7a'));}else{_0x53dd46['message']=utils[_0x972b('0x66')][_0x972b('0x7b')];loggerSyncQueueSummary['debug'](_0x972b('0x7c'),_0x53dd46[_0x972b('0x42')],'is\x20disactive');}emitCampaignSummary(_0x53dd46);}}function myreject(_0x4414e0){return function(_0x288d19){return _0x4414e0(msgResponse(_0x972b('0x7d'),'Error',JSON[_0x972b('0x6f')](_0x288d19)));};}Dialer[_0x972b('0x7e')][_0x972b('0x7f')]=function(_0x4380fa){return!_[_0x972b('0x3b')](_0x4380fa)&&_0x4380fa&&!_['isUndefined'](_0x4380fa[_0x972b('0x42')])&&!_[_0x972b('0x3b')](_0x4380fa[_0x972b('0x80')])&&_0x4380fa[_0x972b('0x80')]&&(this[_0x972b('0x1d')][util[_0x972b('0x41')](_0x972b('0x81'),_0x4380fa[_0x972b('0x42')])][_0x972b('0x82')]===_0x972b('0x83')||this[_0x972b('0x1d')][util[_0x972b('0x41')]('SIP/%s',_0x4380fa[_0x972b('0x42')])]['status']===_0x972b('0x84'));};Dialer['prototype'][_0x972b('0x85')]=function(_0x2fdf6c){var _0x4dd568=this;return function(){if(!_0x4dd568['isTrunkReachable'](_0x2fdf6c[_0x972b('0x86')])){if(!_0x4dd568[_0x972b('0x7f')](_0x2fdf6c[_0x972b('0x87')])){_0x2fdf6c[_0x972b('0x65')]=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x2fdf6c[_0x972b('0x42')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0x972b('0x88')]=function(_0x92ce32,_0x2b94e8,_0x354984,_0x2bc69d){var _0x2dc76b=this;return function(){var _0x5c5102=!![];return _0x2dc76b[_0x972b('0x89')](_0x92ce32,_0x2b94e8,_0x354984,_0x2bc69d,_0x5c5102);};};Dialer[_0x972b('0x7e')][_0x972b('0x8a')]=function(_0x2ff656,_0xbbba12,_0x56fe5e,_0x1ba2de){var _0x8c53b6=this;return function(){var _0x4bf05d=![];return _0x8c53b6[_0x972b('0x89')](_0x2ff656[_0x972b('0x72')],_0xbbba12,_0x56fe5e,_0x1ba2de,_0x4bf05d);};};Dialer[_0x972b('0x7e')][_0x972b('0x89')]=function(_0x1c2d6b,_0xbc0226,_0x5dd142,_0x208887,_0x2d55d0){var _0x3e695f=[];return new Promise(function(_0x461acb,_0x5c7ce4){if(!isNotNull(_0x1c2d6b)){_0x208887['message']=utils[_0x972b('0x66')]['NULL_INTERVAL'];return _0x5c7ce4(msgResponse(_0x972b('0x8b'),_0x972b('0x8c'),_0x5dd142+'\x20Intervals\x20is\x20null\x20'));}if(_['isEmpty'](_0x1c2d6b)){_0x208887['message']=utils[_0x972b('0x66')]['EMPTY_INTERVAL'];return _0x5c7ce4(msgResponse('ifTime',_0x972b('0x8c'),_0x5dd142+_0x972b('0x8d')));}if(_0xbc0226&&_[_0x972b('0x3b')](config['timezones'][_0xbc0226])){_0x208887['message']=utils['CAMPAIGN_STATUS']['UNKNOWN_TIMEZONE'];return _0x5c7ce4(msgResponse('ifTime',_0x972b('0x8c'),_0x5dd142+_0x972b('0x8e')+_0xbc0226));}if(_[_0x972b('0x8f')](_0x1c2d6b)){for(var _0x47c93a=0x0;_0x47c93a<_0x1c2d6b['length'];_0x47c93a+=0x1){_0x3e695f[_0x972b('0x90')](ami[_0x972b('0x91')]({'action':_0x972b('0x92'),'command':util['format'](_0x972b('0x93'),_0x1c2d6b[_0x47c93a][_0x972b('0x94')],!_['isUndefined'](config['timezones'][_0xbc0226])?_0xbc0226:'')})[_0x972b('0x95')](function(_0x452963){return _0x452963['content']['indexOf'](_0x972b('0x96'))>=0x0;})[_0x972b('0x97')](myreject(_0x5c7ce4)));}}else{_0x3e695f['push'](ami['Action']({'action':_0x972b('0x92'),'command':util[_0x972b('0x41')](_0x972b('0x93'),_0x1c2d6b,!_[_0x972b('0x3b')](config[_0x972b('0x98')][_0xbc0226])?_0xbc0226:'')})[_0x972b('0x95')](function(_0x58379c){return _0x58379c[_0x972b('0x99')][_0x972b('0x9a')](_0x972b('0x96'))>=0x0;})[_0x972b('0x97')](myreject(_0x5c7ce4)));}Promise[_0x972b('0x9b')](_0x3e695f)[_0x972b('0x95')](function(_0x878e0a){var _0xdbdb92=_[_0x972b('0x9c')](_0x878e0a);if(_0xdbdb92){return _0x461acb(_0xdbdb92);}else{_0x208887[_0x972b('0x65')]=_0x2d55d0?utils[_0x972b('0x66')][_0x972b('0x9d')]:utils[_0x972b('0x66')][_0x972b('0x9e')];return _0x5c7ce4(msgResponse(_0x972b('0x9f'),_0x972b('0x8c'),_0x972b('0xa0')+_0x2d55d0+'\x20'+_0x5dd142+'\x20Interval\x20is\x20overtime:\x20'+util[_0x972b('0x40')](_0x1c2d6b,{'showHidden':![],'depth':null})+_0x972b('0xa1')+_0xbc0226));}})[_0x972b('0x97')](function(_0x473cc5){return _0x5c7ce4(msgResponse(_0x972b('0x8b'),_0x972b('0x8c'),JSON[_0x972b('0x6f')](_0x473cc5)));});});};Dialer[_0x972b('0x7e')][_0x972b('0x38')]=function(){var _0x40ee4b=this;return cmHopper[_0x972b('0xa2')]({'active':![]},{'where':{'active':!![]}})[_0x972b('0x95')](function(){setInterval(function(){_0x40ee4b[_0x972b('0xa3')]();},0x3e8);});};Dialer[_0x972b('0x7e')]['syncCampaigns']=function(){var _0x3f39e2=this;var _0x509ec6;for(var _0x558001 in this[_0x972b('0x1b')]){if(typeof this[_0x972b('0x1b')][_0x558001]!==_0x972b('0xa4')){_0x509ec6=this[_0x972b('0x1b')][_0x558001];if(utils[_0x972b('0x75')](_0x509ec6)&&utils[_0x972b('0xa5')](_0x509ec6)){_0x509ec6[_0x972b('0x78')]=!![];Promise[_0x972b('0xa6')]()['then'](checkIsIVRCampaignActive(_0x509ec6))[_0x972b('0x95')](checkInterval(_0x509ec6))[_0x972b('0x95')](_0x3f39e2['checkIsTrunkReachable'](_0x509ec6))[_0x972b('0x95')](_0x3f39e2['checkIfTime'](_0x509ec6[_0x972b('0xa7')],_0x509ec6['dialTimezone'],_0x509ec6[_0x972b('0x42')],_0x509ec6))[_0x972b('0x95')](_0x3f39e2[_0x972b('0x8a')](_0x509ec6[_0x972b('0x70')],_0x509ec6[_0x972b('0xa8')],_0x509ec6['name'],_0x509ec6))[_0x972b('0x95')](_0x3f39e2[_0x972b('0xa9')](_0x509ec6))[_0x972b('0x97')](loggerCatchQueueSummary(_0x972b('0xaa'),_0x509ec6));}else{notSendMessagesCampaign(_0x509ec6);}}}};Dialer[_0x972b('0x7e')][_0x972b('0xab')]=function(_0x132cb0){if(_0x132cb0[_0x972b('0xac')]!=='predictive'){clearPredictiveAttributes(_0x132cb0);}switch(_0x132cb0[_0x972b('0xac')]){case _0x972b('0xad'):this[_0x972b('0xae')](_0x132cb0,0x1);break;case _0x972b('0xaf'):this[_0x972b('0xae')](_0x132cb0,_0x132cb0['dialPowerLevel']);break;case _0x972b('0x7'):this['predictive'](_0x132cb0);break;case _0x972b('0xb0'):this[_0x972b('0xae')](_0x132cb0,0x1);break;default:logger[_0x972b('0x62')]('Queue',_0x132cb0[_0x972b('0x42')],_0x972b('0xb1'));}};Dialer['prototype'][_0x972b('0x8b')]=function(_0x23a289,_0x105d25){var _0x78ece0=_0x23a289[_0x972b('0xa8')];var _0x294ccf=_0x105d25?_0x23a289[_0x972b('0xa7')]:_0x23a289['Interval'][_0x972b('0x72')];logger[_0x972b('0xb2')]('Dialer::ifTime()',_0x294ccf,_0x78ece0,_0x23a289[_0x972b('0x42')],util['format']('Voice\x20Queue\x20%s\x20$s',_0x23a289['name'],_0x23a289['id']));var _0x4676b9=null;return Interval[_0x972b('0xb3')](_0x294ccf,_0x78ece0)[_0x972b('0x95')](function(_0x3dcf91){if(_0x3dcf91===!![]){return _0x3dcf91;}else{_0x23a289[_0x972b('0x65')]=_0x105d25?utils[_0x972b('0x66')][_0x972b('0x9d')]:utils[_0x972b('0x66')]['OVERTIME_INTERVAL'];_0x4676b9=msgResponse(_0x972b('0x9f'),_0x972b('0x8c'),_0x972b('0xa0')+_0x105d25+'\x20'+_0x23a289[_0x972b('0x42')]+_0x972b('0xb4')+util[_0x972b('0x40')](_0x294ccf,{'showHidden':![],'depth':null})+_0x972b('0xa1')+_0x78ece0);}if(_0x4676b9!==null){logger[_0x972b('0xb2')](_0x972b('0xb5'),_0x4676b9);_0x4676b9['isGlobal']=_0x105d25;throw _0x4676b9;}})[_0x972b('0x97')](function(_0x1fa111){logger[_0x972b('0x62')](_0x972b('0xb6'),_0x1fa111);throw msgResponse(_0x972b('0x7d'),_0x972b('0xb7'),util[_0x972b('0x40')](_0x1fa111,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x972b('0x26')]=function(_0xfbc7bd){if(this[_0x972b('0x1a')][_0xfbc7bd[_0x972b('0xb8')]]){if(this[_0x972b('0x21')][_0xfbc7bd['uniqueid']]&&this[_0x972b('0x21')][_0xfbc7bd['uniqueid']]['type']!==_0x972b('0xb9')){this[_0x972b('0xba')](this['voiceQueues'][_0xfbc7bd[_0x972b('0xb8')]]);this[_0x972b('0x21')][_0xfbc7bd[_0x972b('0xbb')]][_0x972b('0xbc')]=moment()[_0x972b('0x41')](_0x972b('0xbd'));}}};Dialer[_0x972b('0x7e')][_0x972b('0x2c')]=function(_0x2ac10c){var _0x386341=this[_0x972b('0x21')][_0x2ac10c[_0x972b('0xbb')]];if(this[_0x972b('0x1a')][_0x2ac10c['queue']]){if(_0x386341&&_0x386341[_0x972b('0x3c')]!==_0x972b('0xb9')){delete this[_0x972b('0x21')][_0x2ac10c['uniqueid']];this['voiceQueues'][_0x2ac10c['queue']]['outboundAnswerCallsDay']+=0x1;var _0x41c685=new AgentComplete(_0x386341,_0x2ac10c);if(_0x2ac10c[_0x972b('0xbe')]===_0x972b('0xbf')){_0x41c685[_0x972b('0xc0')]=this[_0x972b('0x1a')][_0x2ac10c[_0x972b('0xb8')]][_0x972b('0xc1')]&&this['voiceQueues'][_0x2ac10c['queue']][_0x972b('0xc2')]?moment()[_0x972b('0x41')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils[_0x972b('0xc3')](_0x41c685)[_0x972b('0x97')](loggerCatch(_0x972b('0xc4')));hopperUtils[_0x972b('0xc5')](_0x41c685)[_0x972b('0x97')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x972b('0x7e')][_0x972b('0x29')]=function(_0xf7891e){var _0x4e2323=this['uniqueId'][_0xf7891e[_0x972b('0xbb')]];var _0x397d3b=this;var _0x2b67b9=![];var _0x3dc685;var _0x2fd0b3;if(this[_0x972b('0x1a')][_0xf7891e['queue']]){if(_0x4e2323&&_0x4e2323[_0x972b('0x3c')]!==_0x972b('0xb9')){delete this[_0x972b('0x21')][_0xf7891e['uniqueid']];this['updateOriginated'](this[_0x972b('0x1a')][_0xf7891e[_0x972b('0xb8')]]);_0x4e2323[_0x972b('0xc6')]=moment()[_0x972b('0x41')](_0x972b('0xbd'));var _0x145df8=new QueueCallerAbandon(_0x4e2323,_0xf7891e);if(utils[_0x972b('0x5d')](_0x4e2323[_0x972b('0xc6')],_0x4e2323[_0x972b('0xc7')])>=_0x4e2323[_0x972b('0xc8')]){this[_0x972b('0x1a')][_0xf7891e[_0x972b('0xb8')]][_0x972b('0x4b')]+=0x1;this['voiceQueues'][_0xf7891e[_0x972b('0xb8')]][_0x972b('0xc9')]+=0x1;this['voiceQueues'][_0xf7891e['queue']][_0x972b('0xca')]+=0x1;_0x145df8[_0x972b('0x6c')]=0xa;_0x145df8['statedesc']='Drop';_0x145df8[_0x972b('0xcb')]=_0x972b('0xcc');_0x145df8[_0x972b('0xc0')]=this[_0x972b('0x1a')][_0xf7891e['queue']][_0x972b('0xc1')]?moment()[_0x972b('0x41')](_0x972b('0xbd')):undefined;_0x145df8[_0x972b('0xcd')]+=0x1;_0x145df8[_0x972b('0xce')]+=0x1;_0x3dc685=this[_0x972b('0x1a')][_0xf7891e[_0x972b('0xb8')]][_0x972b('0xcf')];_0x2fd0b3=this[_0x972b('0x1a')][_0xf7891e[_0x972b('0xb8')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x972b('0xd0')](_0x145df8,_0x145df8['state'],_0x4e2323[_0x972b('0xd1')])['then'](function(_0x308512){_0x2b67b9=_0x308512[_0x972b('0xd2')]==0x1;if(_0x145df8[_0x972b('0xcd')]>=_0x397d3b['voiceQueues'][_0xf7891e[_0x972b('0xb8')]]['dialDropMaxRetry']){_0x397d3b[_0x972b('0xd3')](_0x145df8,_0x308512['additional']);}else{hopperUtils[_0x972b('0xd4')]({'active':![],'countdropretry':_0x145df8[_0x972b('0xcd')],'scheduledat':moment()['add'](_0x397d3b[_0x972b('0x1a')][_0xf7891e[_0x972b('0xb8')]]['dialDropRetryFrequency'],'minutes')[_0x972b('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4e2323[_0x972b('0xd5')],'ListId':_0x4e2323['ListId'],'VoiceQueueId':_0x4e2323[_0x972b('0xd6')]||undefined,'CampaignId':_0x4e2323[_0x972b('0xd7')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x959fa8=new History(_0x145df8);_0x959fa8[_0x972b('0x6c')]=0xa;_0x959fa8['statedesc']='Drop';_0x959fa8[_0x972b('0xd8')]=moment()[_0x972b('0x41')](_0x972b('0xbd'));_0x959fa8[_0x972b('0x6e')]=_0x959fa8[_0x972b('0xd8')];_0x959fa8[_0x972b('0xd9')]=_0x145df8[_0x972b('0xd9')];_0x959fa8['calleridnum']=_0x145df8[_0x972b('0xda')];hopperUtils[_0x972b('0xc3')](_0x959fa8)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x972b('0x95')](function(){if(_0x2b67b9)hopperUtils[_0x972b('0xdb')](_0x145df8,_0x3dc685,_0x2fd0b3)[_0x972b('0x95')](function(){return 0x1;});});}else{this['voiceQueues'][_0xf7891e[_0x972b('0xb8')]][_0x972b('0x4d')]+=0x1;this[_0x972b('0x1a')][_0xf7891e['queue']][_0x972b('0xdc')]+=0x1;_0x145df8[_0x972b('0x6c')]=0xb;_0x145df8[_0x972b('0x6d')]=_0x972b('0xdd');_0x145df8[_0x972b('0xcb')]=_0x972b('0xde');_0x145df8[_0x972b('0xdf')]+=0x1;_0x145df8[_0x972b('0xce')]+=0x1;_0x3dc685=this[_0x972b('0x1a')][_0xf7891e[_0x972b('0xb8')]][_0x972b('0xe0')];_0x2fd0b3=this[_0x972b('0x1a')][_0xf7891e[_0x972b('0xb8')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x972b('0xd0')](_0x145df8,_0x145df8[_0x972b('0x6c')],_0x4e2323[_0x972b('0xd1')])[_0x972b('0x95')](function(_0x4ca9ea){if(_0x145df8[_0x972b('0xdf')]>=_0x397d3b[_0x972b('0x1a')][_0xf7891e[_0x972b('0xb8')]][_0x972b('0xe1')]){_0x397d3b[_0x972b('0xd3')](_0x145df8,_0x4ca9ea['additional']);}else{hopperUtils[_0x972b('0xd4')]({'active':![],'countabandonedretry':_0x145df8[_0x972b('0xdf')],'scheduledat':moment()['add'](_0x397d3b[_0x972b('0x1a')][_0xf7891e['queue']][_0x972b('0xe0')],_0x972b('0xe2'))[_0x972b('0x41')](_0x972b('0xbd')),'ContactId':_0x4e2323[_0x972b('0xd5')],'ListId':_0x4e2323[_0x972b('0xe3')],'VoiceQueueId':_0x4e2323[_0x972b('0xd6')]||undefined,'CampaignId':_0x4e2323[_0x972b('0xd7')]||undefined})[_0x972b('0x97')](loggerCatch(_0x972b('0xe4')));var _0x1f975a=new History(_0x145df8);_0x1f975a['state']=0xb;_0x1f975a[_0x972b('0x6d')]=_0x972b('0xdd');_0x1f975a['starttime']=moment()[_0x972b('0x41')](_0x972b('0xbd'));_0x1f975a[_0x972b('0x6e')]=_0x1f975a[_0x972b('0xd8')];_0x1f975a['calleridname']=_0x145df8[_0x972b('0xd9')];_0x1f975a[_0x972b('0xda')]=_0x145df8['calleridnum'];hopperUtils[_0x972b('0xc3')](_0x1f975a)[_0x972b('0x97')](loggerCatch(_0x972b('0xe5')));}})[_0x972b('0x95')](function(){if(_0x2b67b9)hopperUtils['swapAdditionalPhones'](_0x145df8,_0x3dc685,_0x2fd0b3)['then'](function(){return 0x1;});});}}}};Dialer[_0x972b('0x7e')]['syncNewExten']=function(_0xf05c99){if(this[_0x972b('0xe6')][_0xf05c99[_0x972b('0xbb')]]){this[_0x972b('0xe6')][_0xf05c99[_0x972b('0xbb')]][_0x972b('0xe7')]=_0xf05c99['channel'];}if(this[_0x972b('0x21')][_0xf05c99['uniqueid']]){this[_0x972b('0x21')][_0xf05c99[_0x972b('0xbb')]][_0x972b('0xe7')]=_0xf05c99[_0x972b('0xe7')];}};Dialer['prototype']['syncQueueMember']=function(_0x3879e8){if(!this['actions'][_0x3879e8[_0x972b('0xe8')]]){return;}var _0x46d4e0=this[_0x972b('0x1a')][this[_0x972b('0xe6')][_0x3879e8[_0x972b('0xe8')]]['queue']][_0x972b('0xe9')]||_0x972b('0xea');if(_0x46d4e0===_0x972b('0xeb')){if(this[_0x972b('0xe6')][_0x3879e8['actionid']]&&_[_0x972b('0xec')](this[_0x972b('0xe6')][_0x3879e8['actionid']][_0x972b('0xed')])&&_0x3879e8['status']==='1'&&_0x3879e8[_0x972b('0xee')]==='0'){if(this[_0x972b('0x1c')][_0x3879e8[_0x972b('0xef')]]){if(!this[_0x972b('0x1c')][_0x3879e8[_0x972b('0xef')]]['locked']){this['agents'][_0x3879e8[_0x972b('0xef')]][_0x972b('0xed')]=!![];this[_0x972b('0xe6')][_0x3879e8[_0x972b('0xe8')]]['locked']=!![];this[_0x972b('0xe6')][_0x3879e8['actionid']]['stateinterface']=_0x3879e8[_0x972b('0xef')];}}}}else if(_0x46d4e0===_0x972b('0xea')){if(this['actions'][_0x3879e8[_0x972b('0xe8')]]){if(this[_0x972b('0x1c')][_0x3879e8[_0x972b('0xef')]]){this[_0x972b('0xe6')][_0x3879e8[_0x972b('0xe8')]][_0x972b('0xef')]=_0x3879e8[_0x972b('0xef')];if(_['isNil'](this[_0x972b('0x25')][this[_0x972b('0xe6')][_0x3879e8['actionid']][_0x972b('0xb8')]])){this[_0x972b('0x25')][this[_0x972b('0xe6')][_0x3879e8[_0x972b('0xe8')]][_0x972b('0xb8')]]=[];}this[_0x972b('0x25')][this['actions'][_0x3879e8[_0x972b('0xe8')]][_0x972b('0xb8')]][_0x972b('0x90')](_[_0x972b('0x5c')](_[_0x972b('0xf0')](this[_0x972b('0xe6')][_0x3879e8['actionid']],['idHopper','stateinterface']),{'status':_0x3879e8[_0x972b('0x82')],'paused':_0x3879e8[_0x972b('0xee')]}));}}}};Dialer['prototype'][_0x972b('0x37')]=function(_0x5dec68){if(!this[_0x972b('0xe6')][_0x5dec68['actionid']]){return;}var _0x3babe8=this;var _0x16a0b6=this[_0x972b('0x1a')][this[_0x972b('0xe6')][_0x5dec68['actionid']][_0x972b('0xb8')]];var _0x9c67ff=_0x16a0b6[_0x972b('0xe9')]||_0x972b('0xea');if(_0x9c67ff==='roundrobin'){if(this[_0x972b('0xe6')][_0x5dec68[_0x972b('0xe8')]]&&this[_0x972b('0xe6')][_0x5dec68[_0x972b('0xe8')]][_0x972b('0xef')]){this['preview'][_0x972b('0xf1')](this[_0x972b('0xe6')][_0x5dec68['actionid']]['idHopper'],this[_0x972b('0xe6')][_0x5dec68[_0x972b('0xe8')]][_0x972b('0xef')])[_0x972b('0x97')](function(_0x1537b5){logger[_0x972b('0x62')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x972b('0x40')](_0x1537b5,{'showHidden':![],'depth':null}));})['finally'](function(){_0x3babe8['updateOriginated'](_0x3babe8[_0x972b('0x1a')][_0x3babe8[_0x972b('0xe6')][_0x5dec68[_0x972b('0xe8')]][_0x972b('0xb8')]]);_0x3babe8[_0x972b('0x1c')][_0x3babe8[_0x972b('0xe6')][_0x5dec68['actionid']][_0x972b('0xef')]]['locked']=![];delete _0x3babe8[_0x972b('0xe6')][_0x5dec68[_0x972b('0xe8')]];unlockQueueStatus(_0x16a0b6);});}else{this[_0x972b('0xba')](this[_0x972b('0x1a')][this[_0x972b('0xe6')][_0x5dec68[_0x972b('0xe8')]][_0x972b('0xb8')]]);hopperUtils[_0x972b('0xd4')]({'active':![],'ContactId':this['actions'][_0x5dec68[_0x972b('0xe8')]][_0x972b('0xd5')],'ListId':this[_0x972b('0xe6')][_0x5dec68['actionid']][_0x972b('0xe3')],'VoiceQueueId':this[_0x972b('0xe6')][_0x5dec68[_0x972b('0xe8')]][_0x972b('0xd6')]||undefined,'CampaignId':this[_0x972b('0xe6')][_0x5dec68[_0x972b('0xe8')]][_0x972b('0xd7')]||undefined})[_0x972b('0x97')](loggerCatch(_0x972b('0xf2')));delete this[_0x972b('0xe6')][_0x5dec68[_0x972b('0xe8')]];unlockQueueStatus(_0x16a0b6);}}else if(_0x9c67ff===_0x972b('0xea')){var _0x28a6d1;if(this['actions'][_0x5dec68['actionid']]&&!_[_0x972b('0x44')](this[_0x972b('0x25')][this[_0x972b('0xe6')][_0x5dec68[_0x972b('0xe8')]]['queue']])){if(this[_0x972b('0xf3')][_0x3babe8[_0x972b('0xe6')][_0x5dec68[_0x972b('0xe8')]][_0x972b('0xb8')]]){this[_0x972b('0xf3')][_0x3babe8[_0x972b('0xe6')][_0x5dec68[_0x972b('0xe8')]][_0x972b('0xb8')]]=this['queueBookedRR'][this['actions'][_0x5dec68[_0x972b('0xe8')]]['queue']]?this[_0x972b('0xf3')][this[_0x972b('0xe6')][_0x5dec68['actionid']]['queue']]:this['queueBooked'][this['actions'][_0x5dec68['actionid']]['queue']]?this[_0x972b('0x25')][this['actions'][_0x5dec68[_0x972b('0xe8')]][_0x972b('0xb8')]][_0x972b('0xf4')]||0x0:0x0;}this[_0x972b('0x25')][this[_0x972b('0xe6')][_0x5dec68['actionid']][_0x972b('0xb8')]][_0x972b('0xf4')]=this[_0x972b('0xf3')][this[_0x972b('0xe6')][_0x5dec68[_0x972b('0xe8')]][_0x972b('0xb8')]];for(var _0x12d06b=0x0;_0x12d06b=_0x4253a4['dialGlobalMaxRetry']){_0x5c4a86['stateGlobal'](_0x5c8192,_0x52b0b6,_0x1134b9,'reason19\x20machine....');}else{if(_0x5c8192[_0x972b('0x118')]>=_0x4253a4[_0x972b('0x11f')]){_0x5c4a86['createStateFinal'](_0x5c8192,_0x52b0b6,_0x1134b9,'reason\x2019\x20machine....');}else{hopperUtils[_0x972b('0xd4')]({'active':![],'countmachineretry':_0x5c8192[_0x972b('0x118')],'scheduledat':moment()[_0x972b('0x120')](_0x4253a4['dialMachineRetryFrequency'],_0x972b('0xe2'))[_0x972b('0x41')](_0x972b('0xbd')),'ContactId':_0x5c8192[_0x972b('0xd5')],'ListId':_0x5c8192[_0x972b('0xe3')],'VoiceQueueId':_0x5c8192[_0x972b('0xd6')]||undefined,'CampaignId':_0x5c8192[_0x972b('0xd7')]||undefined})[_0x972b('0x97')](loggerCatch(_0x972b('0x121')));_0x52b0b6({'reschedule':0x1});}}});}if(_0x1dda1e['type']===_0x972b('0xb9')&&this['campaigns'][_0x1dda1e[_0x972b('0xb8')]][_0x972b('0x108')]&&_0x581069['value']===_0x972b('0x10a')){delete this[_0x972b('0x21')][_0x581069[_0x972b('0xbb')]];this[_0x972b('0xba')](this[_0x972b('0x1b')][_0x1dda1e[_0x972b('0xb8')]]);_0x4e8b9d=new Hangup(_0x1dda1e,_0x581069);_0x4e8b9d[_0x972b('0x6c')]=0x12;_0x4e8b9d[_0x972b('0x6d')]='HangupInAMD';_0x4e8b9d[_0x972b('0x10d')]=_0x972b('0x10e');ami[_0x972b('0x10f')](_0x972b('0x110'),ut[_0x972b('0x119')](_0x4e8b9d,_0x972b('0x111')));this[_0x972b('0x112')](_0x4e8b9d,_0x972b('0x122'),_0x972b('0x123'));}if(_0x1dda1e['type']===_0x972b('0xb9')&&this[_0x972b('0x1b')][_0x1dda1e[_0x972b('0xb8')]][_0x972b('0x108')]&&_0x581069[_0x972b('0x109')]===_0x972b('0x115')){return new Promise(function(_0x4c91af,_0x470fb6){delete _0x5c4a86[_0x972b('0x21')][_0x581069[_0x972b('0xbb')]];_0x5c4a86[_0x972b('0xba')](_0x5c4a86['campaigns'][_0x1dda1e[_0x972b('0xb8')]]);_0x5c4a86[_0x972b('0x1b')][_0x1dda1e[_0x972b('0xb8')]]['outboundAnswerCallsDay']+=0x1;_0x5c4a86[_0x972b('0x1b')][_0x1dda1e[_0x972b('0xb8')]][_0x972b('0x116')]+=0x1;var _0x4360f5=_0x5c4a86[_0x972b('0x1b')][_0x1dda1e[_0x972b('0xb8')]];var _0x70acde=new Hangup(_0x1dda1e,_0x581069);_0x70acde[_0x972b('0x6c')]=0x13;_0x70acde['statedesc']=_0x972b('0x117');_0x70acde[_0x972b('0x10d')]='AMD';_0x70acde['countmachineretry']+=0x1;_0x70acde['countglobal']+=0x1;_0x70acde[_0x972b('0x111')]=!![];ami[_0x972b('0x10f')](_0x972b('0x110'),ut[_0x972b('0x119')](_0x70acde,'amd'));hopperUtils[_0x972b('0xc3')](_0x70acde)['catch'](loggerCatch(_0x972b('0x11a')));if(_0x70acde[_0x972b('0x11b')]+_0x70acde[_0x972b('0x11c')]+_0x70acde[_0x972b('0x11d')]+_0x70acde[_0x972b('0x124')]+_0x70acde[_0x972b('0xcd')]+_0x70acde[_0x972b('0xdf')]+_0x70acde[_0x972b('0x118')]+_0x70acde['countagentrejectretry']>=_0x4360f5[_0x972b('0x125')]){_0x5c4a86[_0x972b('0x126')](_0x70acde,_0x4c91af,_0x470fb6,_0x972b('0x127'));}else{if(_0x70acde[_0x972b('0x118')]>=_0x4360f5[_0x972b('0x11f')]){_0x5c4a86[_0x972b('0x128')](_0x70acde,_0x4c91af,_0x470fb6,_0x972b('0x129'));}else{hopperUtils[_0x972b('0xd4')]({'active':![],'countmachineretry':_0x70acde[_0x972b('0x118')],'scheduledat':moment()['add'](_0x4360f5[_0x972b('0x12a')],_0x972b('0xe2'))[_0x972b('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x70acde['ContactId'],'ListId':_0x70acde['ListId'],'VoiceQueueId':_0x70acde[_0x972b('0xd6')]||undefined,'CampaignId':_0x70acde[_0x972b('0xd7')]||undefined})[_0x972b('0x97')](loggerCatch('[rescheduleContact][Machine]'));_0x4c91af({'reschedule':0x1});}}});}}};Dialer[_0x972b('0x7e')][_0x972b('0x30')]=function(_0x26f29f){var _0x5470ca=this[_0x972b('0x21')][_0x26f29f['uniqueid']];var _0x4fedf8;if(_0x5470ca&&_0x5470ca[_0x972b('0x3c')]==='ivr'){delete this[_0x972b('0x21')][_0x26f29f[_0x972b('0xbb')]];this['updateOriginated'](this['campaigns'][_0x5470ca[_0x972b('0xb8')]]);this['campaigns'][_0x5470ca[_0x972b('0xb8')]]['ivrAnswerCallsDay']+=0x1;_0x4fedf8=new Hangup(_0x5470ca,_0x26f29f);hopperUtils[_0x972b('0xc3')](_0x4fedf8)['catch'](loggerCatch(_0x972b('0x12b')));hopperUtils['moveContactManagedDialer'](_0x4fedf8)[_0x972b('0x97')](loggerCatch('[syncHangupIvr]'));}if(_0x5470ca&&_0x5470ca[_0x972b('0x3c')]!==_0x972b('0xb9')&&isNotNull(this['voiceQueues'][_0x5470ca[_0x972b('0xb8')]][_0x972b('0x12c')])){delete this[_0x972b('0x21')][_0x26f29f[_0x972b('0xbb')]];this[_0x972b('0xba')](this['voiceQueues'][_0x5470ca[_0x972b('0xb8')]]);this['voiceQueues'][_0x5470ca[_0x972b('0xb8')]][_0x972b('0x10b')]+=0x1;this[_0x972b('0x1a')][_0x5470ca['queue']][_0x972b('0x116')]+=0x1;_0x4fedf8=new Hangup(_0x5470ca,_0x26f29f);_0x4fedf8['state']=0x10;_0x4fedf8[_0x972b('0x6d')]='AnswerAGI';_0x4fedf8[_0x972b('0x10d')]=_0x972b('0x12d');hopperUtils[_0x972b('0xc3')](_0x4fedf8)['catch'](loggerCatch(_0x972b('0x12b')));hopperUtils[_0x972b('0xc5')](_0x4fedf8)[_0x972b('0x97')](loggerCatch(_0x972b('0x12e')));}if(_0x5470ca&&_0x5470ca[_0x972b('0x3c')]!=='ivr'&&!isNotNull(this[_0x972b('0x1a')][_0x5470ca[_0x972b('0xb8')]][_0x972b('0x12c')])){if(_0x26f29f[_0x972b('0x12f')]==='Normal\x20Clearing'){delete this['uniqueId'][_0x26f29f['uniqueid']];this['voiceQueues'][_0x5470ca[_0x972b('0xb8')]][_0x972b('0x10b')]+=0x1;const _0xdc047f=new AgentComplete(_0x5470ca,_0x26f29f);_0xdc047f[_0x972b('0xd7')]=this[_0x972b('0x1a')][_0x5470ca[_0x972b('0xb8')]]['id'];hopperUtils[_0x972b('0xc3')](_0xdc047f)['catch'](loggerCatch(_0x972b('0xc4')));hopperUtils[_0x972b('0xc5')](_0xdc047f)['catch'](loggerCatch('[syncAgentComplete]'));}else{delete this['uniqueId'][_0x26f29f[_0x972b('0xbb')]];this[_0x972b('0xba')](this[_0x972b('0x1a')][_0x5470ca[_0x972b('0xb8')]]);this['voiceQueues'][_0x5470ca['queue']][_0x972b('0x130')]+=0x1;_0x4fedf8=new Hangup(_0x5470ca,_0x26f29f);_0x4fedf8[_0x972b('0x6c')]=0xc;_0x4fedf8[_0x972b('0x6d')]=_0x26f29f[_0x972b('0x12f')];_0x4fedf8['membername']=_0x972b('0x131');hopperUtils['createHistory'](_0x4fedf8)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x972b('0xc5')](_0x4fedf8)[_0x972b('0x97')](loggerCatch(_0x972b('0x12e')));}}};Dialer[_0x972b('0x7e')][_0x972b('0x8')]=function(_0x1313b8){var _0xb473fd=this;if(!_0xb473fd[_0x972b('0x132')][_0x1313b8[_0x972b('0x42')]]){_0xb473fd[_0x972b('0x132')][_0x1313b8[_0x972b('0x42')]]={'running':![]};}else if(_0xb473fd['queuesSummary'][_0x1313b8[_0x972b('0x42')]][_0x972b('0x133')]===!![]){return;}else if(_0xb473fd['queuesSummary'][_0x1313b8[_0x972b('0x42')]][_0x972b('0x133')]===![]){_0xb473fd['queuesSummary'][_0x1313b8[_0x972b('0x42')]][_0x972b('0x133')]=!![];}var _0x5c6418=_0xb473fd[_0x972b('0x1a')][_0x1313b8['name']];var _0x1bed35=_0x5c6418[_0x972b('0x65')]!==utils[_0x972b('0x66')][_0x972b('0x74')];var _0xd3812c=utils[_0x972b('0x134')](_0x5c6418);_0x5c6418[_0x972b('0x135')]=utils[_0x972b('0x136')](_0x5c6418,_0xb473fd[_0x972b('0x1d')]);Promise[_0x972b('0xa6')]()[_0x972b('0x95')](function(){if(_0x5c6418[_0x972b('0x135')]===utils[_0x972b('0x66')][_0x972b('0x74')]){if(_0x1bed35){clearPredictiveAttributes(_0x5c6418);_0x1313b8[_0x972b('0x22')]=undefined;_0x1313b8['startProgressive']=undefined;}if(_0x5c6418[_0x972b('0x135')]===utils[_0x972b('0x66')]['INACTIVE']){_0x1313b8[_0x972b('0x137')]=0x0;_0x1313b8[_0x972b('0xee')]=0x0;_0x1313b8[_0x972b('0x138')]=0x0;_0x1313b8['talking']=0x0;_0x1313b8[_0x972b('0x139')]=0x0;}}else if(_0x5c6418[_0x972b('0x135')]===utils[_0x972b('0x66')][_0x972b('0x13a')]&&!_0xd3812c){return _0xb473fd[_0x972b('0x8b')](_0x5c6418,!![])[_0x972b('0x95')](function(){return _0xb473fd[_0x972b('0x8b')](_0x5c6418,![]);})[_0x972b('0x95')](function(){return _0xb473fd[_0x972b('0xab')](_0x5c6418);})[_0x972b('0x97')](function(_0x3b9def){loggerSyncQueueSummary[_0x972b('0x3e')](_0x972b('0x13b'),util['inspect'](_0x3b9def,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5c6418);});}else{clearPredictiveAttributes(_0x5c6418);}})[_0x972b('0x95')](function(){var _0x3b01d2=_0x1313b8['compareToOutboundQueue'](_0x5c6418);if(_0x3b01d2||_0x5c6418['queueSummaryCountersUpdated']){_0x5c6418['queueSummaryCountersUpdated']=![];_0x1313b8[_0x972b('0x13c')](_0x5c6418);Object[_0x972b('0x13d')](_0x5c6418,_0x1313b8);emitOutboundVoiceQueueSummary(_0x1313b8);}_0xb473fd['queuesSummary'][_0x5c6418['name']][_0x972b('0x133')]=![];})['catch'](function(_0xde0dcc){logger['error']('[syncQueueSummary]',util[_0x972b('0x40')](_0xde0dcc,{'showHidden':![],'depth':null}));_0xb473fd[_0x972b('0x132')][_0x5c6418[_0x972b('0x42')]][_0x972b('0x133')]=![];});};Dialer['prototype']['syncQueueSummaryComplete']=_[_0x972b('0x13e')](function(){var _0x708097=_['filter'](this[_0x972b('0x1a')],function(_0x45ed33){return _0x45ed33[_0x972b('0x13f')];});var _0x456aa3=_['filter'](this[_0x972b('0x1c')],function(_0xe4a8f0){return _0xe4a8f0[_0x972b('0x140')]&&_0xe4a8f0['status']===_0x972b('0x83');});if(_0x708097['length']>0x0&&_0x456aa3['length']>0x0){return Promise[_0x972b('0xa6')]()[_0x972b('0x95')](cmHopper[_0x972b('0x141')](_[_0x972b('0x142')](_0x708097,'id'),previewRecallmeReminderInterval,_[_0x972b('0x142')](_0x456aa3,'id')))[_0x972b('0x95')](function(_0xc9105b){for(var _0x35b519=0x0;_0x35b519<_0xc9105b[_0x972b('0xf5')];_0x35b519++){var _0x477b84=_0xc9105b[_0x35b519][_0x972b('0x143')][_0x972b('0x42')];if(_0x477b84)io['to'](util[_0x972b('0x41')](_0x972b('0x144'),_0x477b84))['emit'](_0x972b('0x145'),{'hopper':_0xc9105b[_0x35b519]});}})[_0x972b('0x97')](function(_0x4d3002){logger[_0x972b('0x62')](_0x972b('0x146'),_0x4d3002);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x972b('0x7e')][_0x972b('0x39')]=function(){var _0x57033e=this;setInterval(function(){_0x57033e[_0x972b('0x147')](_0x57033e['uniqueId'],_0x972b('0x148'));_0x57033e[_0x972b('0x147')](_0x57033e[_0x972b('0xe6')],_0x972b('0x149'));},0x32c8);};Dialer[_0x972b('0x7e')][_0x972b('0x147')]=function(_0x2ed934,_0xa71c8a){var _0x5256fb=this;for(var _0x3f085d in _0x2ed934){if(typeof _0x2ed934[_0x3f085d]!==_0x972b('0xa4')){this[_0x972b('0x18')][_0x972b('0x15')](function(){if(!_['isNil'](_0x2ed934[_0x3f085d])){return ami[_0x972b('0x91')]({'action':_0x972b('0x82'),'channel':_0x2ed934[_0x3f085d][_0x972b('0xe7')]})[_0x972b('0x97')](function(_0x10eac6){if(_0x10eac6['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x2ed934[_0x3f085d]&&_0x2ed934[_0x3f085d][_0x972b('0x3c')]!=='ivr'){_0x5256fb[_0x972b('0xba')](_0x5256fb[_0x972b('0x1a')][_0x2ed934[_0x3f085d][_0x972b('0xb8')]]);logger[_0x972b('0x62')](_0x972b('0x14a'),_0xa71c8a,_0x3f085d,_0x2ed934[_0x3f085d][_0x972b('0xb8')]);delete _0x2ed934[_0x3f085d];}if(_0x2ed934[_0x3f085d]&&_0x2ed934[_0x3f085d][_0x972b('0x3c')]===_0x972b('0xb9')){_0x5256fb[_0x972b('0xba')](_0x5256fb['campaigns'][_0x2ed934[_0x3f085d]['queue']]);logger[_0x972b('0x62')](_0x972b('0x14b'),_0xa71c8a,_0x3f085d,_0x2ed934[_0x3f085d][_0x972b('0xb8')]);delete _0x2ed934[_0x3f085d];}},0x2328);}});}});}}};Dialer[_0x972b('0x7e')]['getVoiceQueueRtPauses']=function(_0x5cf948){return Promise[_0x972b('0xa6')]()[_0x972b('0x95')](voiceQueueRt[_0x972b('0x14c')](_0x5cf948))[_0x972b('0x97')](loggerCatch(_0x972b('0x14d')));};Dialer['prototype'][_0x972b('0xba')]=function(_0x526cc5){if(!_[_0x972b('0x3b')](_0x526cc5)&&_0x526cc5!==null){if(typeof _0x526cc5[_0x972b('0x79')]!==_0x972b('0xa4')){if(_0x526cc5['originated']>0x0){_0x526cc5['originated']-=0x1;}else{logger['error'](_0x972b('0x14e'));}}}else{logger[_0x972b('0x62')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x972b('0x7e')][_0x972b('0x14f')]=function(_0x363cfa,_0x59257c){var _0x383abe=this;return function(_0x47845f){_0x383abe['updateOriginated'](_0x59257c);logger[_0x972b('0x62')](_0x363cfa,util[_0x972b('0x40')](_0x47845f,{'showHidden':![],'depth':null}));};};Dialer[_0x972b('0x7e')]['emptyContact']=function(_0x2bcc85,_0x365a9e,_0x31bbcf){var _0x2a911f={'state':0x19,'statedesc':_0x972b('0x150')};this['updateOriginated'](_0x365a9e);this[_0x972b('0x112')](_[_0x972b('0x5c')](_0x2a911f,_[_0x972b('0xf0')](_0x31bbcf,[_0x972b('0xd5'),_0x972b('0xe3'),_0x972b('0x151'),'VoiceQueueId',_0x972b('0xd7')])),_0x972b('0x152'),_0x972b('0x153'));logger[_0x972b('0x62')](_0x2bcc85);};Dialer[_0x972b('0x7e')][_0x972b('0x112')]=function(_0x41444f,_0x45a374,_0x1896d7){hopperUtils[_0x972b('0xc3')](_0x41444f)['catch'](loggerCatch(_0x45a374));hopperUtils[_0x972b('0xc5')](_0x41444f)[_0x972b('0x97')](loggerCatch(_0x1896d7));};Dialer[_0x972b('0x7e')][_0x972b('0xd3')]=function(_0x26ac71,_0x20ad67){hopperUtils[_0x972b('0xc3')](_0x26ac71)[_0x972b('0x97')](loggerCatch(_0x972b('0xc4')));if(_0x20ad67==0x0){hopperUtils[_0x972b('0xc5')](_0x26ac71)[_0x972b('0x97')](loggerCatch(_0x972b('0x154')));}};Dialer[_0x972b('0x7e')]['checkPreviewRecallReminder']=function(_0xd4923a){return Promise[_0x972b('0xa6')]()['then'](cmHopper[_0x972b('0x141')](_0xd4923a['id'],previewRecallmeReminderInterval))[_0x972b('0x95')](function(_0x221880){for(var _0x3e1443=0x0;_0x3e1443<_0x221880[_0x972b('0xf5')];_0x3e1443++){var _0x49617e=_0x221880[_0x3e1443][_0x972b('0x143')][_0x972b('0x42')];if(_0x49617e)io['to'](util[_0x972b('0x41')](_0x972b('0x144'),_0x49617e))[_0x972b('0x10f')](_0x972b('0x145'),{'hopper':_0x221880[_0x3e1443]});}})[_0x972b('0x97')](function(){});};Dialer[_0x972b('0x7e')]['launchHandleIvr']=function(_0x316e45){var _0x1ee541=this;return function(){_0x1ee541[_0x972b('0x155')](_0x316e45);};};Dialer[_0x972b('0x7e')][_0x972b('0x156')]=function(_0x340d0e,_0x491b0b){var _0x43a838=this;var _0x43807f=uuid['v4']();this[_0x972b('0xe6')][_0x43807f]=new Action(_0x340d0e,_0x491b0b,_0x43807f);return new Promise(function(_0x5e3d3e,_0xe6c328){if(_['isUndefined'](_0x340d0e)&&typeof _0x340d0e!==_0x972b('0x157')){return _0xe6c328(msgResponse(_0x972b('0x158'),_0x972b('0x8c'),_0x972b('0x159')));}if(_['isUndefined'](_0x491b0b[_0x972b('0x15a')])||_0x491b0b[_0x972b('0x15a')]===null){return _0xe6c328(msgResponse(_0x972b('0x158'),'Failure','contact\x20is\x20undefine'));}var _0x4a30f1={'XMD-CALLERID':_0x43a838[_0x972b('0xe6')][_0x43807f]['getCaller'](),'XMD-AGI':_0x340d0e[_0x972b('0x12c')]?util[_0x972b('0x41')](_0x972b('0x15b'),ipAgi,_0x340d0e[_0x972b('0x12c')]):_0x972b('0x15c'),'XMD-AGIAFTER':_0x340d0e[_0x972b('0xc1')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x340d0e['dialQueueProject2']):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0x340d0e)?util[_0x972b('0x41')](_0x972b('0x15d'),_0x340d0e['name'],_0x340d0e[_0x972b('0x15e')]||'',_0x340d0e[_0x972b('0xc2')]?'c':'',_0x340d0e[_0x972b('0xc8')]||0x3):_0x972b('0x15c'),'XMD-CONTACTID':_0x491b0b[_0x972b('0xd5')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x43a838[_0x972b('0xe6')][_0x43807f][_0x972b('0x15f')](),'XMD-AMD':_0x340d0e[_0x972b('0x108')]?'ACTIVE':_0x972b('0x15c'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x340d0e['dialAMDActive']){_0x4a30f1[_0x972b('0x160')]=_0x340d0e[_0x972b('0x161')]||0x9c4;_0x4a30f1[_0x972b('0x162')]=_0x340d0e['dialAMDGreeting']||0x5dc;_0x4a30f1['XMD-AMDAFTERGREETINGSILENCE']=_0x340d0e[_0x972b('0x163')]||0x320;_0x4a30f1[_0x972b('0x164')]=_0x340d0e[_0x972b('0x165')]||0x1388;_0x4a30f1[_0x972b('0x166')]=_0x340d0e[_0x972b('0x167')]||0x64;_0x4a30f1[_0x972b('0x168')]=_0x340d0e[_0x972b('0x169')]||0x32;_0x4a30f1[_0x972b('0x16a')]=_0x340d0e[_0x972b('0x16b')]||0x3;_0x4a30f1[_0x972b('0x16c')]=_0x340d0e[_0x972b('0x16d')]||0x100;_0x4a30f1[_0x972b('0x16e')]=_0x340d0e[_0x972b('0x16f')]||0x1388;}if(utils['isOutboundQueue'](_0x340d0e)){_0x4a30f1[_0x972b('0x170')]=_0x491b0b[_0x972b('0xd6')];}else{_0x4a30f1['XMD-CAMPAIGNID']=_0x491b0b[_0x972b('0xd7')];}var _0x5f1e5a=utils[_0x972b('0x171')](_0x491b0b['Contact']);Object[_0x972b('0x13d')](_0x4a30f1,_0x5f1e5a);var _0x1c75d8=_0x43a838[_0x972b('0x7f')](_0x340d0e[_0x972b('0x86')])?utils[_0x972b('0x172')](_0x340d0e[_0x972b('0x86')]['callerid'],_0x340d0e['dialOriginateCallerIdName'],_0x340d0e[_0x972b('0x173')]>0x0?utils['getCallerIdRandom'](_0x340d0e[_0x972b('0x174')],_0x340d0e[_0x972b('0x173')]):_0x340d0e[_0x972b('0x174')]):utils[_0x972b('0x172')](_[_0x972b('0xec')](_0x340d0e['TrunkBackup'])?_0x340d0e[_0x972b('0x86')][_0x972b('0x175')]:_0x340d0e[_0x972b('0x87')][_0x972b('0x175')],_0x340d0e['dialOriginateCallerIdName'],_0x340d0e[_0x972b('0x173')]>0x0?utils[_0x972b('0x176')](_0x340d0e[_0x972b('0x174')],_0x340d0e[_0x972b('0x173')]):_0x340d0e[_0x972b('0x174')]);if(_0x1c75d8){_0x4a30f1[_0x972b('0x177')]=_0x43a838['actions'][_0x43807f][_0x972b('0x178')]=utils[_0x972b('0x179')](_0x1c75d8);_0x4a30f1[_0x972b('0x17a')]=_0x491b0b[_0x972b('0x15a')];}_0x340d0e['variables']=_0x4a30f1;return ami[_0x972b('0x91')]({'actionid':_0x43807f,'action':_0x972b('0x158'),'channel':_0x43a838[_0x972b('0x7f')](_0x340d0e[_0x972b('0x86')])?util[_0x972b('0x41')](_0x972b('0x17b'),_0x340d0e[_0x972b('0x86')][_0x972b('0x42')],isNotNull(_0x340d0e[_0x972b('0x17c')])?_0x340d0e[_0x972b('0x17c')][_0x972b('0x17d')]()||'':'',_0x340d0e[_0x972b('0x17e')]>0x0?_0x491b0b['phone']['substring'](_0x340d0e['dialCutDigit']):_0x491b0b['phone']):util[_0x972b('0x41')](_0x972b('0x17b'),_[_0x972b('0xec')](_0x340d0e[_0x972b('0x87')])?_0x340d0e[_0x972b('0x86')][_0x972b('0x42')]:_0x340d0e[_0x972b('0x87')]['name'],isNotNull(_0x340d0e[_0x972b('0x17c')])?_0x340d0e[_0x972b('0x17c')][_0x972b('0x17d')]()||'':'',_0x340d0e['dialCutDigit']>0x0?_0x491b0b[_0x972b('0x15a')]['substring'](_0x340d0e['dialCutDigit']):_0x491b0b['phone']),'callerid':_0x1c75d8,'Exten':'xcally-motion-dialer','Context':_0x972b('0x17f'),'Priority':'1','variable':_0x4a30f1,'timeout':(_0x340d0e['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x43807f})['then'](function(_0x14ecc5){return _0x5e3d3e(_0x14ecc5);})[_0x972b('0x97')](function(_0x9da05c){_0x340d0e['outboundOriginateFailureCallsDay']+=0x1;var _0x266516=new History(_0x43a838[_0x972b('0xe6')][_0x43807f]);logger[_0x972b('0x62')](util[_0x972b('0x41')](_0x972b('0x180'),JSON[_0x972b('0x6f')](_0x9da05c)));_0x266516['state']=0xe;_0x266516[_0x972b('0x6d')]=_0x972b('0x181');_0x266516['starttime']=moment()[_0x972b('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x266516[_0x972b('0x6e')]=_0x266516[_0x972b('0xd8')];hopperUtils[_0x972b('0xc3')](_0x266516)['catch'](loggerCatch(_0x972b('0x182')));_0x43a838[_0x972b('0xc5')](_0x266516)['catch'](loggerCatch(_0x972b('0x182')))[_0x972b('0x17')](function(){delete _0x43a838[_0x972b('0xe6')][_0x43807f];return _0xe6c328(msgResponse('originate',_0x972b('0xb7'),_0x972b('0x183')));});});});};Dialer[_0x972b('0x7e')][_0x972b('0x184')]=function(_0x26e389,_0x31a872,_0x4068c4){var _0x2c3aaa=new History(_0x31a872);if(_0x2c3aaa['countbusyretry']+_0x2c3aaa['countcongestionretry']+_0x2c3aaa[_0x972b('0x11d')]+_0x2c3aaa[_0x972b('0x124')]+_0x2c3aaa[_0x972b('0xcd')]+_0x2c3aaa[_0x972b('0xdf')]+_0x2c3aaa['countmachineretry']+_0x2c3aaa[_0x972b('0x11e')]>=_0x4068c4['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x26e389){case 0x3:if(_0x2c3aaa[_0x972b('0x11d')]>=_0x4068c4['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x972b('0xd4')]({'active':![],'countnoanswerretry':_0x2c3aaa['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x972b('0x120')](_0x4068c4[_0x972b('0x185')],'minutes')[_0x972b('0x41')](_0x972b('0xbd')),'ContactId':_0x2c3aaa['ContactId'],'ListId':_0x2c3aaa[_0x972b('0xe3')],'VoiceQueueId':_0x2c3aaa[_0x972b('0xd6')]||undefined,'CampaignId':_0x2c3aaa[_0x972b('0xd7')]||undefined})[_0x972b('0x97')](loggerCatch(_0x972b('0x186')));break;case 0x5:if(_0x2c3aaa['countbusyretry']>=_0x4068c4[_0x972b('0x187')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x2c3aaa[_0x972b('0x11b')]+=0x1,'scheduledat':moment()[_0x972b('0x120')](_0x4068c4[_0x972b('0x188')],'minutes')[_0x972b('0x41')](_0x972b('0xbd')),'ContactId':_0x2c3aaa[_0x972b('0xd5')],'ListId':_0x2c3aaa['ListId'],'VoiceQueueId':_0x2c3aaa[_0x972b('0xd6')]||undefined,'CampaignId':_0x2c3aaa[_0x972b('0xd7')]||undefined})[_0x972b('0x97')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2c3aaa[_0x972b('0x11c')]>=_0x4068c4[_0x972b('0x189')]-0x1){return!![];}hopperUtils[_0x972b('0xd4')]({'active':![],'countcongestionretry':_0x2c3aaa[_0x972b('0x11c')]+=0x1,'scheduledat':moment()[_0x972b('0x120')](_0x4068c4[_0x972b('0x18a')],_0x972b('0xe2'))[_0x972b('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2c3aaa[_0x972b('0xd5')],'ListId':_0x2c3aaa[_0x972b('0xe3')],'VoiceQueueId':_0x2c3aaa[_0x972b('0xd6')]||undefined,'CampaignId':_0x2c3aaa[_0x972b('0xd7')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2c3aaa['countnosuchnumberretry']>=_0x4068c4[_0x972b('0x18b')]-0x1){return!![];}else{hopperUtils[_0x972b('0xd4')]({'active':![],'countnosuchnumberretry':_0x2c3aaa[_0x972b('0x124')]+=0x1,'scheduledat':moment()[_0x972b('0x120')](_0x4068c4[_0x972b('0x18c')],_0x972b('0xe2'))['format'](_0x972b('0xbd')),'ContactId':_0x2c3aaa[_0x972b('0xd5')],'ListId':_0x2c3aaa[_0x972b('0xe3')],'VoiceQueueId':_0x2c3aaa[_0x972b('0xd6')]||undefined,'CampaignId':_0x2c3aaa[_0x972b('0xd7')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x2c3aaa[_0x972b('0xcd')]>=_0x4068c4[_0x972b('0x18d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2c3aaa[_0x972b('0xcd')]+=0x1,'scheduledat':moment()[_0x972b('0x120')](_0x4068c4[_0x972b('0xcf')],'minutes')['format'](_0x972b('0xbd')),'ContactId':_0x2c3aaa[_0x972b('0xd5')],'ListId':_0x2c3aaa['ListId'],'VoiceQueueId':_0x2c3aaa[_0x972b('0xd6')]||undefined,'CampaignId':_0x2c3aaa[_0x972b('0xd7')]||undefined})[_0x972b('0x97')](loggerCatch(_0x972b('0x18e')));break;case 0xb:if(_0x2c3aaa[_0x972b('0xdf')]>=_0x4068c4[_0x972b('0xe1')]-0x1){return!![];}hopperUtils[_0x972b('0xd4')]({'active':![],'countabandonedretry':_0x2c3aaa[_0x972b('0xdf')]+=0x1,'scheduledat':moment()['add'](_0x4068c4['dialAbandonedRetryFrequency'],_0x972b('0xe2'))['format'](_0x972b('0xbd')),'ContactId':_0x2c3aaa[_0x972b('0xd5')],'ListId':_0x2c3aaa[_0x972b('0xe3')],'VoiceQueueId':_0x2c3aaa[_0x972b('0xd6')]||undefined,'CampaignId':_0x2c3aaa[_0x972b('0xd7')]||undefined})[_0x972b('0x97')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x2c3aaa[_0x972b('0x118')]>=_0x4068c4[_0x972b('0x11f')]-0x1){return!![];}hopperUtils[_0x972b('0xd4')]({'active':![],'countmachineretry':_0x2c3aaa['countmachineretry']+=0x1,'scheduledat':moment()[_0x972b('0x120')](_0x4068c4['dialMachineRetryFrequency'],_0x972b('0xe2'))[_0x972b('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2c3aaa['ContactId'],'ListId':_0x2c3aaa['ListId'],'VoiceQueueId':_0x2c3aaa[_0x972b('0xd6')]||undefined,'CampaignId':_0x2c3aaa['CampaignId']||undefined})[_0x972b('0x97')](loggerCatch(_0x972b('0x121')));break;case 0x14:if(_0x2c3aaa['countagentrejectretry']>=_0x4068c4['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x2c3aaa[_0x972b('0x11e')]+=0x1,'scheduledat':moment()[_0x972b('0x120')](_0x4068c4[_0x972b('0x18f')],_0x972b('0xe2'))[_0x972b('0x41')](_0x972b('0xbd')),'ContactId':_0x2c3aaa['ContactId'],'ListId':_0x2c3aaa[_0x972b('0xe3')],'VoiceQueueId':_0x2c3aaa['VoiceQueueId']||undefined,'CampaignId':_0x2c3aaa[_0x972b('0xd7')]||undefined})[_0x972b('0x97')](loggerCatch(_0x972b('0x190')));break;default:return!![];}};Dialer[_0x972b('0x7e')][_0x972b('0x104')]=function(_0x9a18f8,_0x3ff4e1,_0x6b1baf){var _0x22c04c=this;var _0x2950af=new History(_0x9a18f8);var _0xfc1acf=![];var _0x19a691;var _0xa45ec3;return new Promise(function(_0x409b8f,_0x3e0bf9){if(_[_0x972b('0x3b')](_0x3ff4e1)&&typeof _0x3ff4e1!=='object'){return _0x3e0bf9(msgResponse(_0x972b('0x191'),'Failure','entity\x20is\x20undefine'));}if(_['isUndefined'](_0x6b1baf)&&typeof _0x6b1baf!==_0x972b('0x157')){return _0x3e0bf9(msgResponse('[callProgressDetecting]',_0x972b('0x8c'),_0x972b('0x192')));}hopperUtils[_0x972b('0xd0')](_0x2950af,_0x6b1baf[_0x972b('0xbe')],_0x3ff4e1)[_0x972b('0x95')](function(_0x29d380){if(_0x29d380[_0x972b('0xd2')]==0x1)_0xfc1acf=!![];switch(_0x6b1baf[_0x972b('0xbe')]){case'0':_0x3ff4e1[_0x972b('0x193')]+=0x1;_0x2950af[_0x972b('0x6c')]=0x0;_0x2950af[_0x972b('0x6d')]=_0x972b('0x194');_0x2950af[_0x972b('0x124')]+=0x1;_0x2950af[_0x972b('0xce')]+=0x1;ami[_0x972b('0x10f')](_0x972b('0x195'),ut[_0x972b('0x119')](_0x9a18f8,'nosuchnumber'));_0x19a691=_0x3ff4e1['dialNoSuchNumberRetryFrequency'];_0xa45ec3=_0x3ff4e1[_0x972b('0x196')];hopperUtils['createHistory'](_0x2950af)[_0x972b('0x97')](loggerCatch(_0x972b('0x11a')));if(_0x22c04c[_0x972b('0x184')](0x0,_0x9a18f8,_0x3ff4e1)&&!_0xfc1acf){if(_0x2950af['countnosuchnumberretry']>=_0x3ff4e1[_0x972b('0x18b')]){_0x22c04c[_0x972b('0x128')](_0x2950af,_0x409b8f,_0x3e0bf9,_0x972b('0x197'));}else{_0x22c04c[_0x972b('0x126')](_0x2950af,_0x409b8f,_0x3e0bf9,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3ff4e1[_0x972b('0x198')]+=0x1;_0x2950af[_0x972b('0x6c')]=0x3;_0x2950af[_0x972b('0x6d')]='NoAnswer';_0x2950af[_0x972b('0x11d')]+=0x1;_0x2950af[_0x972b('0xce')]+=0x1;var _0x389e97=ut['buildNoAnswerEventPayload'](_0x9a18f8,_0x3ff4e1);ami['emit'](_0x972b('0x199'),_0x389e97);_0x19a691=_0x3ff4e1[_0x972b('0x185')];_0xa45ec3=_0x3ff4e1[_0x972b('0x196')];hopperUtils[_0x972b('0xc3')](_0x2950af)[_0x972b('0x97')](loggerCatch(_0x972b('0x19a')));if(_0x22c04c['checkRetriveMax'](0x3,_0x9a18f8,_0x3ff4e1)&&!_0xfc1acf){if(_0x2950af[_0x972b('0x11d')]>=_0x3ff4e1['dialNoAnswerMaxRetry']){_0x22c04c['createStateFinal'](_0x2950af,_0x409b8f,_0x3e0bf9,'reason\x203\x20ringing\x20no\x20answer');}else{_0x22c04c[_0x972b('0x126')](_0x2950af,_0x409b8f,_0x3e0bf9,_0x972b('0x19b'));}}break;case'5':_0x3ff4e1[_0x972b('0x19c')]+=0x1;_0x2950af[_0x972b('0x6c')]=0x5;_0x2950af[_0x972b('0x6d')]=_0x972b('0x19d');_0x2950af[_0x972b('0x11b')]+=0x1;_0x2950af['countglobal']+=0x1;ami[_0x972b('0x10f')](_0x972b('0x19e'),ut[_0x972b('0x119')](_0x9a18f8,'busy'));_0x19a691=_0x3ff4e1['dialBusyRetryFrequency'];_0xa45ec3=_0x3ff4e1[_0x972b('0x196')];hopperUtils['createHistory'](_0x2950af)[_0x972b('0x97')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x22c04c[_0x972b('0x184')](0x5,_0x9a18f8,_0x3ff4e1)&&!_0xfc1acf){if(_0x2950af[_0x972b('0x11b')]>=_0x3ff4e1[_0x972b('0x187')]){_0x22c04c[_0x972b('0x128')](_0x2950af,_0x409b8f,_0x3e0bf9,'reason\x205\x20busy');}else{_0x22c04c[_0x972b('0x126')](_0x2950af,_0x409b8f,_0x3e0bf9,_0x972b('0x19f'));}}break;case'8':_0x3ff4e1[_0x972b('0x1a0')]+=0x1;_0x2950af['state']=0x8;_0x2950af[_0x972b('0x6d')]=_0x972b('0x1a1');_0x2950af['countcongestionretry']+=0x1;_0x2950af[_0x972b('0xce')]+=0x1;_0x19a691=_0x3ff4e1[_0x972b('0x18a')];_0xa45ec3=_0x3ff4e1['callAdditionalPhoneAfterMin'];ami['emit'](_0x972b('0x1a2'),ut[_0x972b('0x119')](_0x9a18f8,'congestion'));hopperUtils[_0x972b('0xc3')](_0x2950af)[_0x972b('0x97')](loggerCatch(_0x972b('0x1a3')));if(_0x22c04c['checkRetriveMax'](0x8,_0x9a18f8,_0x3ff4e1)&&!_0xfc1acf){if(_0x2950af['countcongestionretry']>=_0x3ff4e1[_0x972b('0x189')]){_0x22c04c[_0x972b('0x128')](_0x2950af,_0x409b8f,_0x3e0bf9,'reason\x208\x20congestion');}else{_0x22c04c[_0x972b('0x126')](_0x2950af,_0x409b8f,_0x3e0bf9,_0x972b('0x1a4'));}}break;case'11':_0x3ff4e1['outboundAbandonedCallsDay']+=0x1;_0x2950af[_0x972b('0x6c')]=0xb;_0x2950af['statedesc']=_0x972b('0xdd');_0x2950af['countabandonedretry']+=0x1;_0x2950af[_0x972b('0xce')]+=0x1;_0x19a691=_0x3ff4e1[_0x972b('0xe0')];_0xa45ec3=_0x3ff4e1[_0x972b('0x196')];hopperUtils[_0x972b('0xc3')](_0x2950af)[_0x972b('0x97')](loggerCatch(_0x972b('0xe5')));if(_0x22c04c[_0x972b('0x184')](0xb,_0x9a18f8,_0x3ff4e1)&&!_0xfc1acf){if(_0x2950af[_0x972b('0xdf')]>=_0x3ff4e1[_0x972b('0xe1')]){_0x22c04c['createStateFinal'](_0x2950af,_0x409b8f,_0x3e0bf9,_0x972b('0x1a5'));}else{_0x22c04c[_0x972b('0x126')](_0x2950af,_0x409b8f,_0x3e0bf9,_0x972b('0x1a5'));}}break;case'20':_0x3ff4e1[_0x972b('0x1a6')]+=0x1;_0x2950af[_0x972b('0x6c')]=0x14;_0x2950af[_0x972b('0x6d')]=_0x972b('0x1a7');_0x2950af[_0x972b('0x11e')]+=0x1;_0x2950af[_0x972b('0xce')]+=0x1;_0x19a691=_0x3ff4e1[_0x972b('0x18f')];_0xa45ec3=_0x3ff4e1['callAdditionalPhoneAfterMin'];ami['emit'](_0x972b('0x1a8'),ut['buildObj'](_0x9a18f8,_0x972b('0x1a9')));hopperUtils[_0x972b('0xc3')](_0x2950af)['catch'](loggerCatch(_0x972b('0x1aa')));if(_0x22c04c['checkRetriveMax'](0x14,_0x9a18f8,_0x3ff4e1)&&!_0xfc1acf){if(_0x2950af[_0x972b('0x11e')]>=_0x3ff4e1['dialAgentRejectMaxRetry']){_0x22c04c['createStateFinal'](_0x2950af,_0x409b8f,_0x3e0bf9,_0x972b('0x1ab'));}else{_0x22c04c[_0x972b('0x126')](_0x2950af,_0x409b8f,_0x3e0bf9,_0x972b('0x1ab'));}}break;default:_0x3ff4e1['outboundUnknownCallsDay']+=0x1;_0x2950af[_0x972b('0x6c')]=0xc;_0x2950af['statedesc']=_0x6b1baf[_0x972b('0xbe')];_0x19a691=_0x3ff4e1['dialAgentRejectRetryFrequency'];_0xa45ec3=_0x3ff4e1[_0x972b('0x196')];hopperUtils[_0x972b('0xc3')](_0x2950af)[_0x972b('0x97')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x22c04c[_0x972b('0x184')](_0x6b1baf[_0x972b('0xbe')],_0x9a18f8,_0x3ff4e1)&&!_0xfc1acf){if(_0x2950af[_0x972b('0x11b')]+_0x2950af[_0x972b('0x11c')]+_0x2950af['countnoanswerretry']+_0x2950af['countnosuchnumberretry']+_0x2950af[_0x972b('0xcd')]+_0x2950af[_0x972b('0xdf')]+_0x2950af[_0x972b('0x118')]+_0x2950af[_0x972b('0x11e')]>=_0x3ff4e1[_0x972b('0x125')]){_0x22c04c[_0x972b('0x126')](_0x2950af,_0x409b8f,_0x3e0bf9,_0x6b1baf['reason']);}else{_0x22c04c[_0x972b('0x128')](_0x2950af,_0x409b8f,_0x3e0bf9,_0x6b1baf[_0x972b('0xbe')]);}}}})['then'](function(){if(_0xfc1acf){hopperUtils['swapAdditionalPhones'](_0x2950af,_0x19a691,_0xa45ec3)[_0x972b('0x95')](function(){return _0x409b8f(0x1);});}});});};Dialer['prototype'][_0x972b('0x126')]=function(_0x29c7b9,_0x38e708,_0x409f3b,_0x50ec40){var _0xe59d33=new Final(_0x29c7b9);_0xe59d33[_0x972b('0x6c')]=0xf;_0xe59d33[_0x972b('0x6d')]=_0x972b('0x1ac');this[_0x972b('0x128')](_0xe59d33,_0x38e708,_0x409f3b,_0x50ec40);};Dialer[_0x972b('0x7e')][_0x972b('0x128')]=function(_0x25e91c,_0x416b3e,_0x265e77,_0x533687){hopperUtils[_0x972b('0xc5')](_0x25e91c)[_0x972b('0x95')](function(){return _0x416b3e(msgResponse(_0x972b('0x191'),_0x972b('0x103'),_0x533687));})[_0x972b('0x97')](function(){return _0x265e77(msgResponse(_0x972b('0x1ad'),_0x972b('0x8c'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x972b('0x7')]=function(_0x56ec2d){var _0x2b7625=_0x56ec2d[_0x972b('0x1ae')]/0x64;var _0x338c58=_0x56ec2d[_0x972b('0xc9')]/(_0x56ec2d[_0x972b('0xc9')]+_0x56ec2d[_0x972b('0x10b')]);var _0x33e2a8=Math[_0x972b('0x1af')](_0x56ec2d[_0x972b('0x1b0')]*(_0x56ec2d[_0x972b('0x1b1')]/0x64));var _0x56b917=Math[_0x972b('0x1af')](_0x56ec2d[_0x972b('0x1b0')]*(_0x56ec2d[_0x972b('0x1b2')]/0x64));var _0x3d0e9e=_0x56ec2d['available']+_0x56ec2d[_0x972b('0x1b3')];var _0x5a5140=Math[_0x972b('0x1b4')](_0x56ec2d[_0x972b('0x55')]*_0x56ec2d[_0x972b('0x59')]*_0x56ec2d[_0x972b('0x1b5')]*_0x56ec2d['predictiveIntervalMultiplicativeFactor']);if(_[_0x972b('0x3b')](_0x56ec2d[_0x972b('0x23')])){if(!_['isUndefined'](_0x56ec2d[_0x972b('0x22')])){_0x56ec2d[_0x972b('0x22')]=undefined;loggerPredictive['error'](_0x972b('0x1b6'),_0x972b('0x1b7'));}if(!_['isUndefined'](_0x56ec2d[_0x972b('0x60')])){loggerPredictive[_0x972b('0x62')]('[startMethodPredictive][StartProgressive]',_0x972b('0x1b8'));clearInterval(_0x56ec2d[_0x972b('0x60')]);_0x56ec2d[_0x972b('0x60')]=undefined;}_0x56ec2d[_0x972b('0x23')]=moment()['format'](_0x972b('0xbd'));loggerPredictive['info'](_0x56ec2d['name'],_0x972b('0x1b9'),_0x56ec2d['startProgressive']);this['handlePower'](_0x56ec2d,0x1);}else if(ifInterval(_0x56ec2d[_0x972b('0x1ba')],_0x56ec2d[_0x972b('0x23')])){this[_0x972b('0xae')](_0x56ec2d,0x1);loggerPredictiveCalls[_0x972b('0x45')](_0x972b('0x1bb'),_0x56ec2d[_0x972b('0x23')],_0x56ec2d[_0x972b('0x42')]);_0x56ec2d[_0x972b('0x55')]=0x0;_0x56ec2d[_0x972b('0xca')]=0x0;}else if(_0x2b7625<_0x338c58&&_0x56ec2d['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x56ec2d);loggerPredictive['info'](_0x972b('0x1bc'),'Dropped\x20calls\x20day',_0x338c58,'startProgressive',_0x56ec2d[_0x972b('0x42')]);}else if(_0x5a5140<_0x56ec2d[_0x972b('0xca')]&&_0x56ec2d[_0x972b('0x1bd')]===_0x972b('0x1be')){clearPredictiveAttributes(_0x56ec2d);loggerPredictive[_0x972b('0x45')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x972b('0x1bf'),_0x5a5140,'Drop\x20in\x20this\x20interval',_0x56ec2d['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x56ec2d['name']);}else if(!ifInterval(_0x56ec2d[_0x972b('0x1ba')],_0x56ec2d['startProgressive'])&&_[_0x972b('0x3b')](_0x56ec2d['startPredictive'])&&!_[_0x972b('0x3b')](_0x56ec2d[_0x972b('0x23')])){_0x56ec2d[_0x972b('0x22')]=moment()[_0x972b('0x41')](_0x972b('0xbd'));loggerPredictive['info'](_0x56ec2d[_0x972b('0x42')],'started\x20in\x20predictive\x20at',_0x56ec2d[_0x972b('0x22')]);hopperUtils[_0x972b('0x1c0')](_0x56ec2d[_0x972b('0x1ba')])[_0x972b('0x95')](this[_0x972b('0x1c1')](_0x56ec2d))[_0x972b('0x95')](mergeDataErlangB(_0x56ec2d))[_0x972b('0x95')](this[_0x972b('0x1c2')](_0x56ec2d))['catch'](loggerCatchPredictive(_0x972b('0x1c3'),_0x56ec2d));}else if(!ifInterval(_0x56ec2d['dialPredictiveInterval'],_0x56ec2d[_0x972b('0x22')])){_0x56ec2d[_0x972b('0xca')]=0x0;_0x56ec2d[_0x972b('0x22')]=moment()['format'](_0x972b('0xbd'));loggerPredictive[_0x972b('0x45')](_0x56ec2d[_0x972b('0x42')],'recalculate\x20predictive\x20at',_0x56ec2d[_0x972b('0x22')]);clearInterval(_0x56ec2d[_0x972b('0x60')]);_0x56ec2d['handlePredictive']=undefined;hopperUtils[_0x972b('0x1c0')](_0x56ec2d[_0x972b('0x1ba')])['then'](this['getDataPredictive'](_0x56ec2d))[_0x972b('0x95')](mergeDataErlangB(_0x56ec2d))['then'](this[_0x972b('0x1c2')](_0x56ec2d))[_0x972b('0x97')](loggerCatchPredictive(_0x972b('0x1c4'),_0x56ec2d));}else if(_0x56ec2d[_0x972b('0x1b0')]&&_0x3d0e9e<_0x56ec2d['predictiveIntervalAvailable']-_0x56b917){clearPredictiveAttributes(_0x56ec2d);loggerPredictive[_0x972b('0x45')](_0x56ec2d[_0x972b('0x42')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3d0e9e,_0x972b('0x1c5'),_0x56ec2d[_0x972b('0x1b0')],'-',_0x56b917,'=',_0x56ec2d[_0x972b('0x1b0')]-_0x56b917,')');}else if(_0x56ec2d[_0x972b('0x1b0')]&&_0x3d0e9e>_0x56ec2d['predictiveIntervalAvailable']+_0x33e2a8){clearPredictiveAttributes(_0x56ec2d);loggerPredictive[_0x972b('0x45')](_0x56ec2d['name'],_0x972b('0x1c6'),_0x3d0e9e,_0x972b('0x1c7'),_0x56ec2d['predictiveIntervalAvailable'],'+',_0x33e2a8,'=',_0x56ec2d[_0x972b('0x1b0')]+_0x33e2a8,')');}};Dialer[_0x972b('0x7e')][_0x972b('0x1c1')]=function(_0x545aea){var _0x175ec5=this;return function(_0x2045fc){return new Promise(function(_0x287b11,_0x2e75fa){_[_0x972b('0x5c')](_0x545aea,_0x2045fc[0x0]);if(checkGetDataPredictive(_0x2045fc[0x0])){var _0x16f094=_0x545aea[_0x972b('0x1b0')]=_0x545aea[_0x972b('0x1b3')]+_0x545aea['available'];var _0x13f8d5=_0x545aea['dialPredictiveInterval']*0x3c;var _0xb73246=_0x2045fc[0x0]['predictiveIntervalAvgTalktime']+_0x2045fc[0x0][_0x972b('0x50')];var _0x506199=(_0x2045fc[0x0][_0x972b('0x49')]+_0x2045fc[0x0][_0x972b('0x4b')]+_0x2045fc[0x0][_0x972b('0x4d')])/_0x2045fc[0x0]['predictiveIntervalTotalCalls'];_0x545aea[_0x972b('0x1b5')]=_0x506199>0x0?_0x506199:0x1;switch(_0x545aea['dialPredictiveOptimization']){case _0x972b('0x1be'):var _0xe1338a=_0x545aea[_0x972b('0x1ae')]/0x64;return _0x175ec5[_0x972b('0x1c8')](_0x16f094,_0x13f8d5,_0xb73246,_0x506199,_0xe1338a)['then'](function(_0x535890){return _0x287b11(_0x535890);});case _0x972b('0x1c9'):var _0xc7f4f7=_0x545aea[_0x972b('0x1ae')]/0x64;return _0x175ec5['busyFactor'](_0x16f094,_0x13f8d5,_0xb73246,_0x506199,_0xc7f4f7)[_0x972b('0x95')](function(_0xda705e){return _0x287b11(_0xda705e);});default:return _0x2e75fa(msgResponse(_0x972b('0x1ca'),_0x972b('0x8c'),_0x972b('0x1cb')));}}else{return _0x2e75fa(msgResponse(_0x972b('0x1ca'),'Failure',_0x972b('0x1cc')));}});};};Dialer[_0x972b('0x7e')][_0x972b('0x1cd')]=function(_0x509248){var _0x1ec3c1=this;return function(_0x411676){return new Promise(function(_0x223fce,_0x1b7c0d){_['merge'](_0x509248,_0x411676[0x0]);if(checkGetDataPredictive(_0x411676[0x0])){loggerPredictive[_0x972b('0x45')](JSON['stringify'](_0x411676[0x0]));if(_0x509248[_0x972b('0x1bd')]===_0x972b('0x1be')){return _0x1ec3c1[_0x972b('0x14c')](_0x509248['id'])[_0x972b('0x95')](function(_0x20d0ce){var _0x495329=_0x509248[_0x972b('0x1ce')]-_0x20d0ce[0x0][_0x972b('0x1cf')];var _0xa55481=_0x509248[_0x972b('0x1ba')]*0x3c;var _0xe26613=_0x411676[0x0]['predictiveIntervalAvgTalktime']+_0x411676[0x0][_0x972b('0x50')];var _0x556d83=(_0x411676[0x0][_0x972b('0x49')]+_0x411676[0x0][_0x972b('0x4b')]+_0x411676[0x0][_0x972b('0x4d')])/_0x411676[0x0][_0x972b('0x48')];var _0x36f823=_0x509248[_0x972b('0x1ae')]/0x64;_0x509248[_0x972b('0x1d0')]=_0x20d0ce[0x0][_0x972b('0x1cf')]||0x0;_0x509248[_0x972b('0x1b5')]=_0x556d83>0x0?_0x556d83:0x1;return _0x1ec3c1[_0x972b('0x1c8')](_0x495329,_0xa55481,_0xe26613,_0x556d83,_0x36f823);})['then'](function(_0x2e0e69){return _0x223fce(_0x2e0e69);})['catch'](function(_0x368e86){return _0x1b7c0d(msgResponse(_0x972b('0x1d1'),_0x972b('0x8c'),JSON[_0x972b('0x6f')](_0x368e86)));});}if(_0x509248['dialPredictiveOptimization']===_0x972b('0x1c9')){return _0x1ec3c1[_0x972b('0x14c')](_0x509248['id'])[_0x972b('0x95')](function(_0x2a5e83){var _0x3fb53f=_0x509248['loggedIn']-_0x2a5e83[0x0][_0x972b('0x1cf')];var _0x3cd535=_0x509248[_0x972b('0x1ba')]*0x3c;var _0x5cbb7c=_0x411676[0x0][_0x972b('0x4f')]+_0x411676[0x0][_0x972b('0x50')];var _0x248948=(_0x411676[0x0]['predictiveIntervalAnsweredCalls']+_0x411676[0x0][_0x972b('0x4b')]+_0x411676[0x0][_0x972b('0x4d')])/_0x411676[0x0][_0x972b('0x48')];var _0x45f924=_0x509248[_0x972b('0x1ae')]/0x64;_0x509248[_0x972b('0x1d0')]=_0x2a5e83[0x0]['outboundQueuePauses']||0x0;_0x509248[_0x972b('0x1b5')]=_0x248948>0x0?_0x248948:0x1;return _0x1ec3c1[_0x972b('0x1d2')](_0x3fb53f,_0x3cd535,_0x5cbb7c,_0x248948,_0x45f924);})['then'](function(_0x2c6a72){return _0x223fce(_0x2c6a72);})[_0x972b('0x97')](function(_0x27d846){return _0x1b7c0d(msgResponse(_0x972b('0x1d1'),_0x972b('0x8c'),JSON[_0x972b('0x6f')](_0x27d846)));});}}else{return _0x1b7c0d(msgResponse(_0x972b('0x1ca'),'Failure',_0x972b('0x1cc')));}});};};Dialer[_0x972b('0x7e')][_0x972b('0x1c2')]=function(_0x55603e){var _0x3b837a=this;return function(){var _0x4fc372=0x0;var _0x5ec214=Math['floor'](_0x55603e[_0x972b('0x57')]*0x3e8);if(_0x5ec214>0x0){_0x5ec214=_0x5ec214<0x64?0x64:_0x5ec214;loggerPredictive[_0x972b('0x45')](_0x55603e['name'],_0x972b('0x1d3'),_0x5ec214,_0x972b('0x1d4'));_0x55603e[_0x972b('0x60')]=setInterval(function(){_0x3b837a['handlePredictive'](_0x55603e);loggerPredictiveCalls['info'](_0x972b('0x1d5'),_0x4fc372+=0x1);},_0x5ec214);}else{loggerPredictive[_0x972b('0x45')](_0x55603e[_0x972b('0x42')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x972b('0x7e')]['checkContactBlack']=function(_0x3a555e,_0x29c8c9){var _0x17c124=this;return function(_0x5168c3){if(_['isEmpty'](_0x5168c3)){if(_[_0x972b('0xec')](_0x29c8c9['UserId'])||!_0x29c8c9[_0x972b('0x1d6')]){if(_0x3a555e['dialMethod']===_0x972b('0xb0')){_0x3a555e[_0x972b('0x1d7')]=_[_0x972b('0x3b')](_0x3a555e[_0x972b('0x1d7')])?!![]:_0x3a555e[_0x972b('0x1d7')];var _0x2003ce=uuid['v4']();_0x17c124['actions'][_0x2003ce]=new Action(_0x3a555e,_0x29c8c9,_0x2003ce);loggerBooked[_0x972b('0x45')]('[booked][checkContactBlack]',_0x2003ce,'queueStatusComplete:\x20',JSON[_0x972b('0x6f')](_0x3a555e[_0x972b('0x1d7')]),_0x972b('0x1d8'),_0x3a555e[_0x972b('0x42')]);if(_0x3a555e[_0x972b('0x1d7')]){_0x3a555e[_0x972b('0x1d7')]=![];_0x17c124[_0x972b('0x25')][_0x17c124[_0x972b('0xe6')][_0x2003ce]['queue']]=[];ami[_0x972b('0x91')]({'actionid':_0x2003ce,'action':_0x972b('0x1d9'),'queue':_0x3a555e['name']})[_0x972b('0x97')](function(){_0x17c124[_0x972b('0xba')](_0x3a555e);hopperUtils[_0x972b('0xd4')]({'active':![],'ContactId':_0x17c124['actions'][_0x2003ce][_0x972b('0xd5')],'ListId':_0x17c124[_0x972b('0xe6')][_0x2003ce][_0x972b('0xe3')],'VoiceQueueId':_0x17c124[_0x972b('0xe6')][_0x2003ce]['VoiceQueueId']||undefined,'CampaignId':_0x17c124[_0x972b('0xe6')][_0x2003ce]['CampaignId']||undefined})[_0x972b('0x97')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x17c124[_0x972b('0xe6')][_0x2003ce];});}else{loggerBooked[_0x972b('0x45')]('[booked][checkContactBlack][else]',JSON[_0x972b('0x6f')](_0x3a555e['queueStatusComplete']),_0x972b('0x1d8'),_0x3a555e['name']);_0x17c124[_0x972b('0xba')](_0x3a555e);hopperUtils[_0x972b('0xd4')]({'active':![],'ContactId':_0x17c124[_0x972b('0xe6')][_0x2003ce]['ContactId'],'ListId':_0x17c124[_0x972b('0xe6')][_0x2003ce][_0x972b('0xe3')],'VoiceQueueId':_0x17c124['actions'][_0x2003ce][_0x972b('0xd6')]||undefined,'CampaignId':_0x17c124[_0x972b('0xe6')][_0x2003ce][_0x972b('0xd7')]||undefined})[_0x972b('0x97')](loggerCatch(_0x972b('0x1da')));delete _0x17c124[_0x972b('0xe6')][_0x2003ce];}}else{return _0x17c124['actionOriginate'](_0x3a555e,_0x29c8c9);}}else{if(utils['getSeconds'](undefined,_0x29c8c9[_0x972b('0x1db')])<_0x3a555e[_0x972b('0x1dc')]*0x3c){if(_0x29c8c9[_0x972b('0x143')]&&!_0x29c8c9[_0x972b('0x143')][_0x972b('0x1dd')]){_0x17c124['preview'][_0x972b('0xf1')](_0x29c8c9['id'])['finally'](function(){_0x17c124['updateOriginated'](_0x3a555e);});}else{hopperUtils[_0x972b('0x1de')]({'active':![]},_0x29c8c9['id'],0x1)[_0x972b('0x17')](function(){_0x17c124[_0x972b('0xba')](_0x3a555e);});}}else{_0x3a555e[_0x972b('0x1df')]+=0x1;_0x17c124[_0x972b('0xba')](_0x3a555e);if(_0x3a555e[_0x972b('0x1e0')]){hopperUtils[_0x972b('0xd4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x29c8c9['ContactId'],'ListId':_0x29c8c9[_0x972b('0xe3')],'VoiceQueueId':_0x29c8c9[_0x972b('0xd6')]||undefined,'CampaignId':_0x29c8c9[_0x972b('0xd7')]||undefined})[_0x972b('0x97')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x972b('0xc3')](createObjHistory(_0x3a555e,_0x29c8c9,utils[_0x972b('0x66')]['QUEUE_RECALL'],0x17,_0x972b('0x1e1')))[_0x972b('0x97')](loggerCatch(_0x972b('0x1e2')));}else{_0x17c124['saveInDb'](createObjHistory(_0x3a555e,_0x29c8c9,utils[_0x972b('0x66')][_0x972b('0x1e3')],0x16,_0x972b('0x1e4')),_0x972b('0x1e5'),_0x972b('0x1e6'));}}}}else{_0x3a555e['outboundBlacklistCallsDay']+=0x1;_0x17c124['saveInDb'](createObjHistory(_0x3a555e,_0x29c8c9,utils[_0x972b('0x66')][_0x972b('0x1e7')],0xd,'Blacklist'),_0x972b('0x1e8'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x972b('0x7e')]['handleIvr']=function(_0x5a42f0){var _0x19347e=this;var _0x15d480=_0x5a42f0[_0x972b('0x1e9')]-_0x5a42f0[_0x972b('0x79')];emitCampaignSummary(_0x5a42f0);if(_0x15d480>0x0&&_0x5a42f0[_0x972b('0x1ea')]==0x0){if(_0x15d480>this[_0x972b('0x1e')]){_0x15d480=this[_0x972b('0x1e')];}_0x5a42f0['temp']=0x1;hopperUtils['getContactDialerIvr'](_0x5a42f0,_0x15d480)['then'](function(_0x5a9f2d){_0x5a42f0[_0x972b('0x1ea')]=0x0;if(_0x5a9f2d){if(!utils[_0x972b('0x1eb')](_0x5a9f2d)){_0x5a42f0[_0x972b('0x65')]=utils[_0x972b('0x66')][_0x972b('0x6a')];logger[_0x972b('0x45')]('[getContactCampaign2][Empty]'+_0x5a42f0[_0x972b('0x42')]);}else{_0x5a42f0[_0x972b('0x79')]+=_0x5a9f2d['length'];_0x5a42f0[_0x972b('0x65')]=utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0xa3cd01=0x0;_0xa3cd01<_0x5a9f2d['length'];_0xa3cd01+=0x1){_0x5a42f0[_0x972b('0x1ec')]+=0x1;if(_[_0x972b('0xec')](_0x5a9f2d[_0xa3cd01])||_[_0x972b('0xec')](_0x5a9f2d[_0xa3cd01][_0x972b('0x1ed')])||_[_0x972b('0xec')](_0x5a9f2d[_0xa3cd01][_0x972b('0x15a')])){_0x19347e[_0x972b('0x1ee')]('[actionOriginate]\x20',_0x5a42f0,_0x5a9f2d[_0xa3cd01]);}else{hopperUtils[_0x972b('0x1ef')](_[_0x972b('0xf0')](_0x5a9f2d[_0xa3cd01],[_0x972b('0xd7'),_0x972b('0x15a')]))[_0x972b('0x95')](_0x19347e[_0x972b('0x1f0')](_0x5a42f0,_0x5a9f2d[_0xa3cd01]))[_0x972b('0x97')](_0x19347e['loggerHandler'](_0x972b('0x1f1'),_0x5a42f0));}}}}})[_0x972b('0x97')](loggerGetContactDialer('[getContactCampaign2]',_0x5a42f0,_0x15d480));}};Dialer['prototype'][_0x972b('0xae')]=function(_0x33ceb8,_0x257c52){var _0x2c2682=this;var _0x223bac=[];if(_0x257c52<0x1||_0x33ceb8[_0x972b('0xac')]==='booked'){_0x257c52=0x1;}var _0x1714e5=Math[_0x972b('0x1b4')](_0x33ceb8[_0x972b('0x137')]*_0x257c52)-_0x33ceb8[_0x972b('0x79')];if(_0x33ceb8['dialLimitQueue']>0x0){var _0x470c25=_0x33ceb8[_0x972b('0x1f2')]-_0x33ceb8['originated']-_0x33ceb8[_0x972b('0x1b3')]-_0x33ceb8[_0x972b('0x139')];if(_0x1714e5>_0x470c25){_0x1714e5=_0x470c25;}}if(_0x1714e5>0x0&&_0x33ceb8[_0x972b('0x1ea')]==0x0){if(_0x33ceb8[_0x972b('0xac')]===_0x972b('0xb0')){_0x1714e5=0x1;}if(_0x1714e5>this[_0x972b('0x1e')]){_0x1714e5=this[_0x972b('0x1e')];}for(var _0x8d70e8 in this[_0x972b('0x1c')]){if(typeof this[_0x972b('0x1c')][_0x8d70e8]!==_0x972b('0xa4')){if(this[_0x972b('0x1c')][_0x8d70e8][_0x972b('0x6c')]==='not_inuse'&&this[_0x972b('0x1c')][_0x8d70e8][_0x972b('0x82')]===_0x972b('0x83')){_0x223bac[_0x972b('0x90')](this[_0x972b('0x1c')][_0x8d70e8]['id']);}}}_0x33ceb8['temp']=0x1;hopperUtils[_0x972b('0x1f3')](_0x33ceb8,_0x223bac,_0x1714e5)[_0x972b('0x95')](function(_0x135354){_0x33ceb8[_0x972b('0x1ea')]=0x0;if(_0x135354){if(!utils[_0x972b('0x1eb')](_0x135354)){hopperUtils[_0x972b('0x1f4')](_0x33ceb8)[_0x972b('0x95')](sendMessageReschedule(_0x33ceb8))[_0x972b('0x97')](loggerCatch(_0x972b('0x1f5')));}else{_0x33ceb8['originated']+=_0x135354[_0x972b('0xf5')];_0x33ceb8[_0x972b('0x65')]=_0x33ceb8[_0x972b('0xac')]==='booked'?utils[_0x972b('0x66')][_0x972b('0x13a')]:utils['CAMPAIGN_STATUS'][_0x972b('0x1f6')];for(var _0x1db975=0x0;_0x1db975<_0x135354[_0x972b('0xf5')];_0x1db975+=0x1){if(_[_0x972b('0xec')](_0x135354[_0x1db975])||_[_0x972b('0xec')](_0x135354[_0x1db975][_0x972b('0x1ed')])||_[_0x972b('0xec')](_0x135354[_0x1db975][_0x972b('0x15a')])){_0x2c2682[_0x972b('0x1ee')](_0x972b('0x1f7'),_0x33ceb8,_0x135354[_0x1db975]);}else{hopperUtils[_0x972b('0x1f8')](_[_0x972b('0xf0')](_0x135354[_0x1db975],['VoiceQueueId',_0x972b('0x15a')]))[_0x972b('0x95')](_0x2c2682[_0x972b('0x1f0')](_0x33ceb8,_0x135354[_0x1db975]))[_0x972b('0x97')](_0x2c2682[_0x972b('0x14f')](_0x972b('0x1f7'),_0x33ceb8));}}}}})[_0x972b('0x97')](loggerGetContactDialer(_0x972b('0x1f9'),_0x33ceb8,_0x1714e5));}};Dialer[_0x972b('0x7e')][_0x972b('0x60')]=function(_0x23e286){if(_0x23e286[_0x972b('0x1f2')]>0x0){var _0xeeafd8=_0x23e286[_0x972b('0x1f2')]-_0x23e286[_0x972b('0x79')]-_0x23e286[_0x972b('0x1b3')];if(_0xeeafd8>0x0&&_0x23e286[_0x972b('0x1ea')]==0x0){this[_0x972b('0x1fa')](_0x23e286);}else{loggerPredictiveCalls[_0x972b('0x45')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x23e286);}};Dialer[_0x972b('0x7e')][_0x972b('0x1fa')]=function(_0x3dbcd4){var _0x100c8c=this;var _0x36af19=[];_0x3dbcd4['originated']+=0x1;for(var _0x15bc6b in this[_0x972b('0x1c')]){if(typeof this[_0x972b('0x1c')][_0x15bc6b]!==_0x972b('0xa4')){if(this['agents'][_0x15bc6b][_0x972b('0x6c')]===_0x972b('0x1fb')&&this['agents'][_0x15bc6b][_0x972b('0x82')]===_0x972b('0x83')){_0x36af19['push'](this[_0x972b('0x1c')][_0x15bc6b]['id']);}}}_0x3dbcd4[_0x972b('0x1ea')]=0x1;return this['getContactDialer'](_0x3dbcd4['id'],_0x36af19,0x1,_0x3dbcd4['dialOrderByScheduledAt'],_0x3dbcd4)[_0x972b('0x95')](function(_0xd2ef73){_0x3dbcd4[_0x972b('0x1ea')]=0x1;if(_0xd2ef73){if(!utils['checkContactEmpty'](_0xd2ef73)){utils[_0x972b('0x1fc')](_0x3dbcd4,0x1,0x0);return hopperUtils[_0x972b('0x1f4')](_0x3dbcd4)[_0x972b('0x95')](sendMessageReschedule(_0x3dbcd4))[_0x972b('0x97')](loggerCatch(_0x972b('0x1f5')));}else{_0x3dbcd4[_0x972b('0x65')]=utils[_0x972b('0x66')][_0x972b('0x1f6')];if(_[_0x972b('0xec')](_0xd2ef73[0x0])||_[_0x972b('0xec')](_0xd2ef73[0x0][_0x972b('0x1ed')])||_[_0x972b('0xec')](_0xd2ef73[0x0]['phone'])){_0x100c8c[_0x972b('0x1ee')](_0x972b('0x1f7'),_0x3dbcd4,_0xd2ef73[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0xd2ef73[0x0],[_0x972b('0xd6'),_0x972b('0x15a')]))[_0x972b('0x95')](_0x100c8c[_0x972b('0x1f0')](_0x3dbcd4,_0xd2ef73[0x0]))[_0x972b('0x97')](_0x100c8c[_0x972b('0x14f')](_0x972b('0x1fd'),_0x3dbcd4));}}}})[_0x972b('0x97')](loggerGetContactDialer(_0x972b('0x1fe'),_0x3dbcd4,0x1));};Dialer['prototype'][_0x972b('0x1c8')]=function(_0x5676dd,_0x3c4b52,_0x45a4f2,_0xd275d5,_0x5cebe2,_0x50879b){loggerPredictive[_0x972b('0x45')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x972b('0x45')](_0x972b('0x1ff'),_0x5676dd);loggerPredictive[_0x972b('0x45')](_0x972b('0x200'),_0x3c4b52);loggerPredictive[_0x972b('0x45')]('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',_0x45a4f2);loggerPredictive[_0x972b('0x45')]('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',_0xd275d5);loggerPredictive[_0x972b('0x45')](_0x972b('0x201'),_0x5cebe2);loggerPredictive['info'](_0x972b('0x5b'));return new Promise(function(_0x4fe127,_0x4329a4){if(_0x5676dd<=0x0||isNaN(_0x5676dd)){return _0x4329a4(msgResponse('[abandonmentRate]',_0x972b('0xb7'),_0x972b('0x202')+_0x5676dd));}if(_0x45a4f2<=0x0||isNaN(_0x45a4f2)){return _0x4329a4(msgResponse(_0x972b('0x203'),_0x972b('0xb7'),_0x972b('0x204')+_0x45a4f2));}if(_0xd275d5<=0x0||isNaN(_0xd275d5)){return _0x4329a4(msgResponse('[abandonmentRate]',_0x972b('0xb7'),_0x972b('0x205')+_0xd275d5));}if(_0x3c4b52<=0x0||isNaN(_0x3c4b52)){return _0x4329a4(msgResponse(_0x972b('0x203'),_0x972b('0xb7'),'interval\x20=\x20'+_0x3c4b52));}if(_0x5cebe2<=0x0||isNaN(_0x5cebe2)){return _0x4329a4(msgResponse(_0x972b('0x203'),_0x972b('0xb7'),_0x972b('0x206')+_0x5cebe2));}_0x50879b=_0x50879b||0x0;var _0x4e1ec8=0x1/_0x45a4f2;var _0xc4e943=0x0;var _0x4cca64=0x0;var _0x3c47d3=0x0;var _0x3bc815=0x0;for(var _0x28dfa1=0x0;_0x3c47d3<_0x5cebe2;_0x28dfa1+=0x1){_0x4cca64=_0x28dfa1/_0x3c4b52;_0xc4e943=(_0xd275d5*_0x4cca64+_0x50879b)/_0x4e1ec8;_0x3c47d3=utils[_0x972b('0x207')](_0xc4e943,_0x5676dd);_0x3bc815=_0xc4e943/_0x5676dd*(0x1-utils[_0x972b('0x207')](_0xc4e943,_0x5676dd));}return _0x4fe127({'erlangCalls':_0x28dfa1,'erlangCallToSecond':_0x3c4b52/_0x28dfa1,'erlangAbandonmentRate':_0x3c47d3,'erlangBusyFactor':_0x3bc815});});};Dialer[_0x972b('0x7e')][_0x972b('0x1d2')]=function(_0xe963c1,_0x4c665d,_0x38c03f,_0x1dfe61,_0x3bdab8,_0x1bdd3b){loggerPredictive['info'](_0x972b('0x208'));loggerPredictive[_0x972b('0x45')](_0x972b('0x1ff'),_0xe963c1);loggerPredictive['info'](_0x972b('0x200'),_0x4c665d);loggerPredictive[_0x972b('0x45')](_0x972b('0x209'),_0x38c03f);loggerPredictive['info'](_0x972b('0x20a'),_0x1dfe61);loggerPredictive[_0x972b('0x45')](_0x972b('0x20b'),_0x3bdab8);loggerPredictive[_0x972b('0x45')](_0x972b('0x5b'));return new Promise(function(_0x2e9407,_0x587bdb){if(_0xe963c1<=0x0||isNaN(_0xe963c1)){return _0x587bdb(msgResponse(_0x972b('0x20c'),'Error','m\x20=\x20'+_0xe963c1));}if(_0x38c03f<=0x0||isNaN(_0x38c03f)){return _0x587bdb(msgResponse(_0x972b('0x20c'),'Error',_0x972b('0x204')+_0x38c03f));}if(_0x1dfe61<=0x0||isNaN(_0x1dfe61)){return _0x587bdb(msgResponse(_0x972b('0x20c'),_0x972b('0xb7'),_0x972b('0x205')+_0x1dfe61));}if(_0x4c665d<=0x0||isNaN(_0x4c665d)){return _0x587bdb(msgResponse('[busyFactor]','Error','interval\x20=\x20'+_0x4c665d));}if(_0x3bdab8<=0x0||isNaN(_0x3bdab8)){return _0x587bdb(msgResponse(_0x972b('0x20c'),_0x972b('0xb7'),_0x972b('0x20d')+_0x3bdab8));}_0x1bdd3b=_0x1bdd3b||0x0;var _0xaf2590=0x1/_0x38c03f;var _0x4aa2db=0x0;var _0x32bc29=0x0;var _0x3f0040=0x0;var _0x1f4c13=0x0;for(var _0x2ba0c7=0x0;_0x1f4c13<_0x3bdab8;_0x2ba0c7+=0x1){_0x32bc29=_0x2ba0c7/_0x4c665d;_0x4aa2db=(_0x1dfe61*_0x32bc29+_0x1bdd3b)/_0xaf2590;_0x3f0040=utils['erlangb'](_0x4aa2db,_0xe963c1);_0x1f4c13=_0x4aa2db/_0xe963c1*(0x1-utils[_0x972b('0x207')](_0x4aa2db,_0xe963c1));}return _0x2e9407({'erlangCalls':_0x2ba0c7,'erlangCallToSecond':_0x4c665d/_0x2ba0c7,'erlangAbandonmentRate':_0x3f0040,'erlangBusyFactor':_0x1f4c13});});};module[_0x972b('0x20e')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index cc4a3d4..ea2fcab 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe74f=['prototype','getCaller','dialCutDigit','substring','number','getQueue','util','lodash','moment','isNil','string','voiceQueue','name','Contact','firstName','lastName','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme'];(function(_0x58dc47,_0xf8c4a8){var _0x2256ae=function(_0x5bc6f9){while(--_0x5bc6f9){_0x58dc47['push'](_0x58dc47['shift']());}};_0x2256ae(++_0xf8c4a8);}(_0xe74f,0xa6));var _0xfe74=function(_0x4e198a,_0x5a6bad){_0x4e198a=_0x4e198a-0x0;var _0xb84bfe=_0xe74f[_0x4e198a];return _0xb84bfe;};'use strict';var util=require(_0xfe74('0x0'));var _=require(_0xfe74('0x1'));var moment=require(_0xfe74('0x2'));function checkNameSurname(_0x5eca1b,_0x191813,_0x24af86){var _0x274ec9='';if(!_[_0xfe74('0x3')](_0x191813)&&_0xfe74('0x4')===typeof _0x191813){_0x274ec9+=_0x191813;}if(!_['isNil'](_0x24af86)&&_0xfe74('0x4')===typeof _0x24af86){_0x274ec9+='\x20'+_0x24af86;}if(_0x274ec9!==''){return _0x274ec9;}return _0x5eca1b;}function Action(_0x1861f6,_0x976207,_0xaec3af){this[_0xfe74('0x5')]=_0x1861f6;this['uniqueid']=_0xaec3af||undefined;this[_0xfe74('0x6')]=checkNameSurname(_0x976207[_0xfe74('0x7')]['phone'],_0x976207[_0xfe74('0x7')][_0xfe74('0x8')],_0x976207[_0xfe74('0x7')][_0xfe74('0x9')]);this['number']=_0x976207[_0xfe74('0xa')];this[_0xfe74('0xb')]=_0x1861f6[_0xfe74('0x6')];this[_0xfe74('0xc')]=_0x976207[_0xfe74('0xc')]||![];this[_0xfe74('0xd')]=_0x1861f6[_0xfe74('0xd')];this[_0xfe74('0xe')]=_0x1861f6['dialQueueTimeout']||0x3;this[_0xfe74('0xf')]=_0x976207['scheduledat'];this[_0xfe74('0x10')]=_0x976207[_0xfe74('0x10')];this[_0xfe74('0x11')]=_0x976207['countcongestionretry'];this['countnoanswerretry']=_0x976207[_0xfe74('0x12')];this['countnosuchnumberretry']=_0x976207['countnosuchnumberretry'];this['countdropretry']=_0x976207[_0xfe74('0x13')];this[_0xfe74('0x14')]=_0x976207[_0xfe74('0x14')];this['countmachineretry']=_0x976207[_0xfe74('0x15')];this[_0xfe74('0x16')]=_0x976207[_0xfe74('0x16')];this[_0xfe74('0x17')]=_0x976207[_0xfe74('0x17')];this[_0xfe74('0x18')]=_0x976207['ListId'];this['UserId']=_0x976207[_0xfe74('0x19')];this[_0xfe74('0x1a')]=_0x976207['VoiceQueueId'];this['CampaignId']=_0x976207['CampaignId'];this[_0xfe74('0x1b')]=_0x976207['id'];this['ContactFirstName']=_0x976207['Contact'][_0xfe74('0x8')]||'';this[_0xfe74('0x1c')]=moment()['format'](_0xfe74('0x1d'));this[_0xfe74('0x1e')]=_0x976207['callback'];this[_0xfe74('0x1f')]=_0x976207[_0xfe74('0x1f')];this[_0xfe74('0x20')]=_0x976207[_0xfe74('0x20')];this[_0xfe74('0x21')]=_0x976207[_0xfe74('0x21')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xfe74('0x22')][_0xfe74('0x23')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xfe74('0x6')],this[_0xfe74('0x5')][_0xfe74('0x24')]>0x0?this['number'][_0xfe74('0x25')](this['voiceQueue'][_0xfe74('0x24')]):this[_0xfe74('0x26')]);};Action['prototype'][_0xfe74('0x27')]=function(){return this[_0xfe74('0xb')];};module['exports']=Action; \ No newline at end of file +var _0x28c0=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','format','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28c0,0x160));var _0x028c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x28c0[_0x42cae2];return _0x5f256f;};'use strict';var util=require(_0x028c('0x0'));var _=require(_0x028c('0x1'));var moment=require(_0x028c('0x2'));function checkNameSurname(_0x260395,_0x16f647,_0x13fb2c){var _0xadc58c='';if(!_[_0x028c('0x3')](_0x16f647)&&_0x028c('0x4')===typeof _0x16f647){_0xadc58c+=_0x16f647;}if(!_[_0x028c('0x3')](_0x13fb2c)&&_0x028c('0x4')===typeof _0x13fb2c){_0xadc58c+='\x20'+_0x13fb2c;}if(_0xadc58c!==''){return _0xadc58c;}return _0x260395;}function Action(_0x90f1e1,_0x386f26,_0x1bf614){this['voiceQueue']=_0x90f1e1;this[_0x028c('0x5')]=_0x1bf614||undefined;this[_0x028c('0x6')]=checkNameSurname(_0x386f26[_0x028c('0x7')][_0x028c('0x8')],_0x386f26[_0x028c('0x7')][_0x028c('0x9')],_0x386f26[_0x028c('0x7')][_0x028c('0xa')]);this[_0x028c('0xb')]=_0x386f26[_0x028c('0x8')];this[_0x028c('0xc')]=_0x90f1e1[_0x028c('0x6')];this['active']=_0x386f26[_0x028c('0xd')]||![];this[_0x028c('0xe')]=_0x90f1e1[_0x028c('0xe')];this[_0x028c('0xf')]=_0x90f1e1['dialQueueTimeout']||0x3;this[_0x028c('0x10')]=_0x386f26[_0x028c('0x10')];this[_0x028c('0x11')]=_0x386f26['countbusyretry'];this[_0x028c('0x12')]=_0x386f26[_0x028c('0x12')];this[_0x028c('0x13')]=_0x386f26[_0x028c('0x13')];this[_0x028c('0x14')]=_0x386f26[_0x028c('0x14')];this[_0x028c('0x15')]=_0x386f26['countdropretry'];this[_0x028c('0x16')]=_0x386f26[_0x028c('0x16')];this[_0x028c('0x17')]=_0x386f26[_0x028c('0x17')];this[_0x028c('0x18')]=_0x386f26[_0x028c('0x18')];this[_0x028c('0x19')]=_0x386f26['ContactId'];this[_0x028c('0x1a')]=_0x386f26[_0x028c('0x1a')];this['UserId']=_0x386f26[_0x028c('0x1b')];this[_0x028c('0x1c')]=_0x386f26[_0x028c('0x1c')];this[_0x028c('0x1d')]=_0x386f26[_0x028c('0x1d')];this[_0x028c('0x1e')]=_0x386f26['id'];this['ContactFirstName']=_0x386f26[_0x028c('0x7')]['firstName']||'';this[_0x028c('0x1f')]=moment()['format'](_0x028c('0x20'));this[_0x028c('0x21')]=_0x386f26['callback'];this[_0x028c('0x22')]=_0x386f26[_0x028c('0x22')];this[_0x028c('0x23')]=_0x386f26[_0x028c('0x23')];this[_0x028c('0x24')]=_0x386f26[_0x028c('0x24')];this[_0x028c('0x25')]='';this['originatecalleridname']='';}Action[_0x028c('0x26')][_0x028c('0x27')]=function(){return util[_0x028c('0x28')](_0x028c('0x29'),this[_0x028c('0x6')],this[_0x028c('0x2a')][_0x028c('0x2b')]>0x0?this[_0x028c('0xb')][_0x028c('0x2c')](this[_0x028c('0x2a')][_0x028c('0x2b')]):this[_0x028c('0xb')]);};Action[_0x028c('0x26')][_0x028c('0x2d')]=function(){return this[_0x028c('0xc')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index dd504eb..9573d05 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa73=['talktime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime'];(function(_0x49eb72,_0x2e9242){var _0x47b9a0=function(_0x6e66){while(--_0x6e66){_0x49eb72['push'](_0x49eb72['shift']());}};_0x47b9a0(++_0x2e9242);}(_0xfa73,0x179));var _0x3fa7=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xfa73[_0x3b380d];return _0x54502b;};'use strict';var moment=require('moment');var utils=require(_0x3fa7('0x0'));function AgentComplete(_0x5c12e9,_0x2f77f3){this['state']=0x4;this[_0x3fa7('0x1')]=_0x3fa7('0x2');this[_0x3fa7('0x3')]=_0x5c12e9[_0x3fa7('0x3')];this[_0x3fa7('0x4')]=_0x5c12e9[_0x3fa7('0x4')];this[_0x3fa7('0x5')]=_0x5c12e9[_0x3fa7('0x4')]===_0x3fa7('0x6')?'queue':_0x5c12e9['type'];this[_0x3fa7('0x7')]=_0x5c12e9['countbusyretry'];this[_0x3fa7('0x8')]=_0x5c12e9[_0x3fa7('0x8')];this[_0x3fa7('0x9')]=_0x5c12e9[_0x3fa7('0x9')];this[_0x3fa7('0xa')]=_0x5c12e9[_0x3fa7('0x7')]+_0x5c12e9[_0x3fa7('0x8')]+_0x5c12e9['countnoanswerretry']+_0x5c12e9[_0x3fa7('0xb')]+_0x5c12e9['countdropretry']+_0x5c12e9[_0x3fa7('0xc')]+_0x5c12e9['countmachineretry']+_0x5c12e9[_0x3fa7('0xd')];this[_0x3fa7('0xb')]=_0x5c12e9[_0x3fa7('0xb')];this[_0x3fa7('0xe')]=_0x5c12e9['countdropretry'];this['countabandonedretry']=_0x5c12e9[_0x3fa7('0xc')];this[_0x3fa7('0xf')]=_0x5c12e9['countmachineretry'];this[_0x3fa7('0xd')]=_0x5c12e9[_0x3fa7('0xd')];this['uniqueid']=_0x2f77f3[_0x3fa7('0x10')];this[_0x3fa7('0x11')]=_0x5c12e9[_0x3fa7('0x12')];this[_0x3fa7('0x13')]=_0x5c12e9['number'];this[_0x3fa7('0x14')]=_0x5c12e9['starttime'];this[_0x3fa7('0x15')]=_0x5c12e9[_0x3fa7('0x15')];this[_0x3fa7('0x16')]=_0x5c12e9[_0x3fa7('0x16')];this['endtime']=moment()[_0x3fa7('0x17')](_0x3fa7('0x18'));this[_0x3fa7('0x19')]=utils[_0x3fa7('0x1a')](_0x5c12e9[_0x3fa7('0x15')],_0x5c12e9[_0x3fa7('0x14')]);this[_0x3fa7('0x1b')]=utils[_0x3fa7('0x1a')](_0x5c12e9[_0x3fa7('0x16')],_0x5c12e9[_0x3fa7('0x15')]);this[_0x3fa7('0x1c')]=utils[_0x3fa7('0x1a')](this[_0x3fa7('0x1d')],_0x5c12e9['answertime']);this[_0x3fa7('0x1e')]=_0x2f77f3[_0x3fa7('0x1e')];this[_0x3fa7('0x1f')]=_0x2f77f3[_0x3fa7('0x1f')];this['reason']=_0x2f77f3[_0x3fa7('0x20')];this['callback']=_0x5c12e9[_0x3fa7('0x21')];this[_0x3fa7('0x22')]=_0x5c12e9[_0x3fa7('0x22')];this[_0x3fa7('0x23')]=_0x5c12e9[_0x3fa7('0x23')];this[_0x3fa7('0x24')]=_0x5c12e9[_0x3fa7('0x24')];this[_0x3fa7('0x25')]=_0x5c12e9[_0x3fa7('0x25')];this['ListId']=_0x5c12e9[_0x3fa7('0x26')];this[_0x3fa7('0x27')]=_0x5c12e9[_0x3fa7('0x27')];this[_0x3fa7('0x28')]=_0x5c12e9['VoiceQueueId'];this['CampaignId']=_0x5c12e9['CampaignId'];this['originatecalleridnum']=_0x5c12e9[_0x3fa7('0x29')]||'';this[_0x3fa7('0x2a')]=_0x5c12e9[_0x3fa7('0x2a')]||'';this['agiafterat']=_0x5c12e9[_0x3fa7('0x2b')];}module[_0x3fa7('0x2c')]=AgentComplete; \ No newline at end of file +var _0xf364=['originatecalleridname','agiafterat','exports','../utils','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','talktime','getSeconds','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x1ca864,_0x1cce7c){var _0x563495=function(_0x269861){while(--_0x269861){_0x1ca864['push'](_0x1ca864['shift']());}};_0x563495(++_0x1cce7c);}(_0xf364,0x130));var _0x4f36=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xf364[_0xa1e3e3];return _0xc980e9;};'use strict';var moment=require('moment');var utils=require(_0x4f36('0x0'));function AgentComplete(_0x38afb5,_0x382015){this[_0x4f36('0x1')]=0x4;this[_0x4f36('0x2')]='Answer';this[_0x4f36('0x3')]=_0x38afb5['scheduledat'];this[_0x4f36('0x4')]=_0x38afb5[_0x4f36('0x4')];this['campaigntype']=_0x38afb5['type']===_0x4f36('0x5')?_0x4f36('0x6'):_0x38afb5[_0x4f36('0x4')];this[_0x4f36('0x7')]=_0x38afb5[_0x4f36('0x7')];this[_0x4f36('0x8')]=_0x38afb5['countcongestionretry'];this['countnoanswerretry']=_0x38afb5[_0x4f36('0x9')];this['countglobal']=_0x38afb5[_0x4f36('0x7')]+_0x38afb5[_0x4f36('0x8')]+_0x38afb5[_0x4f36('0x9')]+_0x38afb5['countnosuchnumberretry']+_0x38afb5['countdropretry']+_0x38afb5[_0x4f36('0xa')]+_0x38afb5[_0x4f36('0xb')]+_0x38afb5[_0x4f36('0xc')];this[_0x4f36('0xd')]=_0x38afb5[_0x4f36('0xd')];this[_0x4f36('0xe')]=_0x38afb5[_0x4f36('0xe')];this[_0x4f36('0xa')]=_0x38afb5[_0x4f36('0xa')];this['countmachineretry']=_0x38afb5[_0x4f36('0xb')];this['countagentrejectretry']=_0x38afb5[_0x4f36('0xc')];this[_0x4f36('0xf')]=_0x382015[_0x4f36('0xf')];this[_0x4f36('0x10')]=_0x38afb5[_0x4f36('0x11')];this[_0x4f36('0x12')]=_0x38afb5[_0x4f36('0x13')];this[_0x4f36('0x14')]=_0x38afb5[_0x4f36('0x14')];this[_0x4f36('0x15')]=_0x38afb5[_0x4f36('0x15')];this[_0x4f36('0x16')]=_0x38afb5['answertime'];this[_0x4f36('0x17')]=moment()[_0x4f36('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4f36('0x19')]=utils['getSeconds'](_0x38afb5[_0x4f36('0x15')],_0x38afb5[_0x4f36('0x14')]);this['holdtime']=utils['getSeconds'](_0x38afb5[_0x4f36('0x16')],_0x38afb5[_0x4f36('0x15')]);this[_0x4f36('0x1a')]=utils[_0x4f36('0x1b')](this[_0x4f36('0x17')],_0x38afb5[_0x4f36('0x16')]);this[_0x4f36('0x6')]=_0x382015[_0x4f36('0x6')];this[_0x4f36('0x1c')]=_0x382015[_0x4f36('0x1c')];this[_0x4f36('0x1d')]=_0x382015[_0x4f36('0x1d')];this[_0x4f36('0x1e')]=_0x38afb5[_0x4f36('0x1e')];this[_0x4f36('0x1f')]=_0x38afb5['callbackuniqueid'];this[_0x4f36('0x20')]=_0x38afb5[_0x4f36('0x20')];this[_0x4f36('0x21')]=_0x38afb5[_0x4f36('0x21')];this[_0x4f36('0x22')]=_0x38afb5[_0x4f36('0x22')];this[_0x4f36('0x23')]=_0x38afb5[_0x4f36('0x23')];this[_0x4f36('0x24')]=_0x38afb5['UserId'];this[_0x4f36('0x25')]=_0x38afb5[_0x4f36('0x25')];this['CampaignId']=_0x38afb5[_0x4f36('0x26')];this[_0x4f36('0x27')]=_0x38afb5[_0x4f36('0x27')]||'';this[_0x4f36('0x28')]=_0x38afb5[_0x4f36('0x28')]||'';this[_0x4f36('0x29')]=_0x38afb5[_0x4f36('0x29')];}module[_0x4f36('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 36433ef..603b758 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fdf=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme'];(function(_0xe2fa3a,_0x27c80f){var _0x3d5680=function(_0x47d2e3){while(--_0x47d2e3){_0xe2fa3a['push'](_0xe2fa3a['shift']());}};_0x3d5680(++_0x27c80f);}(_0x7fdf,0x168));var _0xf7fd=function(_0x41f882,_0x360760){_0x41f882=_0x41f882-0x0;var _0x402761=_0x7fdf[_0x41f882];return _0x402761;};'use strict';function Final(_0x38df73){this[_0xf7fd('0x0')]=_0x38df73['uniqueid'];this[_0xf7fd('0x1')]=_0x38df73[_0xf7fd('0x1')];this['type']=_0x38df73[_0xf7fd('0x2')];this['campaigntype']=_0x38df73[_0xf7fd('0x2')]===_0xf7fd('0x3')?_0xf7fd('0x4'):_0x38df73[_0xf7fd('0x2')];this[_0xf7fd('0x5')]=_0x38df73[_0xf7fd('0x5')];this[_0xf7fd('0x6')]=_0x38df73[_0xf7fd('0x6')];this['countnoanswerretry']=_0x38df73[_0xf7fd('0x7')];this[_0xf7fd('0x8')]=_0x38df73[_0xf7fd('0x5')]+_0x38df73[_0xf7fd('0x6')]+_0x38df73[_0xf7fd('0x7')]+_0x38df73[_0xf7fd('0x9')]+_0x38df73['countdropretry']+_0x38df73[_0xf7fd('0xa')]+_0x38df73[_0xf7fd('0xb')]+_0x38df73['countagentrejectretry'];this['countnosuchnumberretry']=_0x38df73[_0xf7fd('0x9')];this['countdropretry']=_0x38df73[_0xf7fd('0xc')];this[_0xf7fd('0xa')]=_0x38df73[_0xf7fd('0xa')];this[_0xf7fd('0xb')]=_0x38df73[_0xf7fd('0xb')];this[_0xf7fd('0xd')]=_0x38df73['countagentrejectretry'];this[_0xf7fd('0x4')]=_0x38df73['queue'];this[_0xf7fd('0xe')]=_0x38df73[_0xf7fd('0xe')];this[_0xf7fd('0xf')]=_0x38df73[_0xf7fd('0xf')];this[_0xf7fd('0x10')]=_0x38df73['starttime'];this[_0xf7fd('0x11')]=_0x38df73[_0xf7fd('0x11')];this[_0xf7fd('0x12')]=_0x38df73[_0xf7fd('0x11')];this[_0xf7fd('0x13')]=_0x38df73[_0xf7fd('0x13')]||0x0;this[_0xf7fd('0x14')]=_0x38df73[_0xf7fd('0x14')]||0x0;this['talktime']=_0x38df73[_0xf7fd('0x15')]||0x0;this['callback']=_0x38df73['callback'];this['callbackuniqueid']=_0x38df73[_0xf7fd('0x16')];this['callbackat']=_0x38df73[_0xf7fd('0x17')];this[_0xf7fd('0x18')]=_0x38df73['recallme'];this['ContactId']=_0x38df73[_0xf7fd('0x19')];this['ListId']=_0x38df73[_0xf7fd('0x1a')];this[_0xf7fd('0x1b')]=_0x38df73[_0xf7fd('0x1b')];this[_0xf7fd('0x1c')]=_0x38df73['VoiceQueueId'];this['CampaignId']=_0x38df73[_0xf7fd('0x1d')];this[_0xf7fd('0x1e')]=_0x38df73[_0xf7fd('0x1e')]||'';this[_0xf7fd('0x1f')]=_0x38df73[_0xf7fd('0x1f')]||'';this[_0xf7fd('0x20')]=_0x38df73[_0xf7fd('0x20')];this[_0xf7fd('0x21')]=_0x38df73['statedesc'];}module[_0xf7fd('0x22')]=Final; \ No newline at end of file +var _0x0e54=['state','statedesc','exports','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','queue','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x21417b,_0x49805b){var _0xb08fcc=function(_0x1b4e7a){while(--_0x1b4e7a){_0x21417b['push'](_0x21417b['shift']());}};_0xb08fcc(++_0x49805b);}(_0x0e54,0x14d));var _0x40e5=function(_0x3b6f1a,_0x475ecb){_0x3b6f1a=_0x3b6f1a-0x0;var _0x3cea0a=_0x0e54[_0x3b6f1a];return _0x3cea0a;};'use strict';function Final(_0x59ff5d){this['uniqueid']=_0x59ff5d[_0x40e5('0x0')];this[_0x40e5('0x1')]=_0x59ff5d[_0x40e5('0x1')];this['type']=_0x59ff5d['type'];this['campaigntype']=_0x59ff5d[_0x40e5('0x2')]===_0x40e5('0x3')?'queue':_0x59ff5d[_0x40e5('0x2')];this['countbusyretry']=_0x59ff5d[_0x40e5('0x4')];this['countcongestionretry']=_0x59ff5d[_0x40e5('0x5')];this['countnoanswerretry']=_0x59ff5d[_0x40e5('0x6')];this['countglobal']=_0x59ff5d[_0x40e5('0x4')]+_0x59ff5d['countcongestionretry']+_0x59ff5d['countnoanswerretry']+_0x59ff5d['countnosuchnumberretry']+_0x59ff5d['countdropretry']+_0x59ff5d['countabandonedretry']+_0x59ff5d[_0x40e5('0x7')]+_0x59ff5d[_0x40e5('0x8')];this['countnosuchnumberretry']=_0x59ff5d['countnosuchnumberretry'];this[_0x40e5('0x9')]=_0x59ff5d['countdropretry'];this[_0x40e5('0xa')]=_0x59ff5d['countabandonedretry'];this[_0x40e5('0x7')]=_0x59ff5d[_0x40e5('0x7')];this[_0x40e5('0x8')]=_0x59ff5d[_0x40e5('0x8')];this[_0x40e5('0xb')]=_0x59ff5d[_0x40e5('0xb')];this[_0x40e5('0xc')]=_0x59ff5d[_0x40e5('0xc')];this['calleridnum']=_0x59ff5d[_0x40e5('0xd')];this['starttime']=_0x59ff5d['starttime'];this[_0x40e5('0xe')]=_0x59ff5d[_0x40e5('0xe')];this[_0x40e5('0xf')]=_0x59ff5d[_0x40e5('0xe')];this['ringtime']=_0x59ff5d[_0x40e5('0x10')]||0x0;this[_0x40e5('0x11')]=_0x59ff5d[_0x40e5('0x11')]||0x0;this[_0x40e5('0x12')]=_0x59ff5d[_0x40e5('0x12')]||0x0;this[_0x40e5('0x13')]=_0x59ff5d['callback'];this[_0x40e5('0x14')]=_0x59ff5d[_0x40e5('0x14')];this[_0x40e5('0x15')]=_0x59ff5d[_0x40e5('0x15')];this[_0x40e5('0x16')]=_0x59ff5d[_0x40e5('0x16')];this[_0x40e5('0x17')]=_0x59ff5d[_0x40e5('0x17')];this[_0x40e5('0x18')]=_0x59ff5d[_0x40e5('0x18')];this[_0x40e5('0x19')]=_0x59ff5d[_0x40e5('0x19')];this[_0x40e5('0x1a')]=_0x59ff5d['VoiceQueueId'];this[_0x40e5('0x1b')]=_0x59ff5d[_0x40e5('0x1b')];this[_0x40e5('0x1c')]=_0x59ff5d[_0x40e5('0x1c')]||'';this[_0x40e5('0x1d')]=_0x59ff5d['originatecalleridname']||'';this[_0x40e5('0x1e')]=_0x59ff5d[_0x40e5('0x1e')];this[_0x40e5('0x1f')]=_0x59ff5d[_0x40e5('0x1f')];}module[_0x40e5('0x20')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index ec4c7a1..40a8f0d 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e39=['statedesc','Answer','scheduledat','type','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','endtime','queue','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x6e39,0x1cc));var _0x96e3=function(_0x39b7fb,_0x3f1237){_0x39b7fb=_0x39b7fb-0x0;var _0x247ab1=_0x6e39[_0x39b7fb];return _0x247ab1;};'use strict';var moment=require(_0x96e3('0x0'));var utils=require('../utils');function Hangup(_0x1dd1ce,_0x2fd7f3){this[_0x96e3('0x1')]=0x4;this[_0x96e3('0x2')]=_0x96e3('0x3');this[_0x96e3('0x4')]=_0x1dd1ce[_0x96e3('0x4')];this[_0x96e3('0x5')]=_0x1dd1ce[_0x96e3('0x5')];this['campaigntype']=_0x1dd1ce[_0x96e3('0x5')]===_0x96e3('0x6')?'queue':_0x1dd1ce[_0x96e3('0x5')];this['amd']=_0x1dd1ce[_0x96e3('0x7')]||![];this['countbusyretry']=_0x1dd1ce[_0x96e3('0x8')];this['countcongestionretry']=_0x1dd1ce[_0x96e3('0x9')];this['countnoanswerretry']=_0x1dd1ce[_0x96e3('0xa')];this['countglobal']=_0x1dd1ce[_0x96e3('0x8')]+_0x1dd1ce['countcongestionretry']+_0x1dd1ce[_0x96e3('0xa')]+_0x1dd1ce[_0x96e3('0xb')]+_0x1dd1ce['countdropretry']+_0x1dd1ce['countabandonedretry']+_0x1dd1ce[_0x96e3('0xc')]+_0x1dd1ce[_0x96e3('0xd')];this[_0x96e3('0xb')]=_0x1dd1ce[_0x96e3('0xb')];this[_0x96e3('0xe')]=_0x1dd1ce[_0x96e3('0xe')];this[_0x96e3('0xf')]=_0x1dd1ce['countabandonedretry'];this[_0x96e3('0xc')]=_0x1dd1ce[_0x96e3('0xc')];this[_0x96e3('0xd')]=_0x1dd1ce['countagentrejectretry'];this[_0x96e3('0x10')]=_0x2fd7f3[_0x96e3('0x10')];this[_0x96e3('0x11')]=_0x1dd1ce[_0x96e3('0x12')];this[_0x96e3('0x13')]=_0x1dd1ce['number'];this[_0x96e3('0x14')]=_0x1dd1ce['starttime'];this[_0x96e3('0x15')]=_0x1dd1ce[_0x96e3('0x15')];this['endtime']=moment()[_0x96e3('0x16')](_0x96e3('0x17'));this[_0x96e3('0x18')]=utils[_0x96e3('0x19')](_0x1dd1ce[_0x96e3('0x15')],_0x1dd1ce['starttime']);this['holdtime']=0x0;this['talktime']=utils[_0x96e3('0x19')](this[_0x96e3('0x1a')],_0x1dd1ce[_0x96e3('0x15')]);this[_0x96e3('0x1b')]=_0x1dd1ce[_0x96e3('0x1b')];this[_0x96e3('0x1c')]=_0x96e3('0x1d');this[_0x96e3('0x1e')]=_0x2fd7f3[_0x96e3('0x1f')];this[_0x96e3('0x20')]=_0x1dd1ce[_0x96e3('0x20')];this[_0x96e3('0x21')]=_0x1dd1ce[_0x96e3('0x21')];this[_0x96e3('0x22')]=_0x1dd1ce[_0x96e3('0x22')];this['recallme']=_0x1dd1ce[_0x96e3('0x23')];this[_0x96e3('0x24')]=_0x1dd1ce[_0x96e3('0x24')];this['ListId']=_0x1dd1ce[_0x96e3('0x25')];this[_0x96e3('0x26')]=_0x1dd1ce[_0x96e3('0x26')];this[_0x96e3('0x27')]=_0x1dd1ce[_0x96e3('0x27')];this[_0x96e3('0x28')]=_0x1dd1ce[_0x96e3('0x28')];}module[_0x96e3('0x29')]=Hangup; \ No newline at end of file +var _0x538c=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','starttime','responsetime','endtime','format','ringtime','holdtime','getSeconds','membername','reason'];(function(_0x405053,_0x125f4b){var _0x3d8a1a=function(_0x2116fd){while(--_0x2116fd){_0x405053['push'](_0x405053['shift']());}};_0x3d8a1a(++_0x125f4b);}(_0x538c,0xa1));var _0xc538=function(_0x4f1a2b,_0x4ec8d1){_0x4f1a2b=_0x4f1a2b-0x0;var _0x319cb5=_0x538c[_0x4f1a2b];return _0x319cb5;};'use strict';var moment=require('moment');var utils=require(_0xc538('0x0'));function Hangup(_0x5c58cf,_0x3e2ed7){this[_0xc538('0x1')]=0x4;this[_0xc538('0x2')]=_0xc538('0x3');this['scheduledat']=_0x5c58cf[_0xc538('0x4')];this['type']=_0x5c58cf[_0xc538('0x5')];this[_0xc538('0x6')]=_0x5c58cf['type']==='outbound'?_0xc538('0x7'):_0x5c58cf[_0xc538('0x5')];this[_0xc538('0x8')]=_0x5c58cf[_0xc538('0x8')]||![];this[_0xc538('0x9')]=_0x5c58cf[_0xc538('0x9')];this[_0xc538('0xa')]=_0x5c58cf['countcongestionretry'];this[_0xc538('0xb')]=_0x5c58cf[_0xc538('0xb')];this['countglobal']=_0x5c58cf[_0xc538('0x9')]+_0x5c58cf[_0xc538('0xa')]+_0x5c58cf[_0xc538('0xb')]+_0x5c58cf[_0xc538('0xc')]+_0x5c58cf['countdropretry']+_0x5c58cf[_0xc538('0xd')]+_0x5c58cf[_0xc538('0xe')]+_0x5c58cf[_0xc538('0xf')];this[_0xc538('0xc')]=_0x5c58cf[_0xc538('0xc')];this[_0xc538('0x10')]=_0x5c58cf[_0xc538('0x10')];this['countabandonedretry']=_0x5c58cf[_0xc538('0xd')];this[_0xc538('0xe')]=_0x5c58cf[_0xc538('0xe')];this[_0xc538('0xf')]=_0x5c58cf[_0xc538('0xf')];this[_0xc538('0x11')]=_0x3e2ed7['uniqueid'];this[_0xc538('0x12')]=_0x5c58cf['name'];this[_0xc538('0x13')]=_0x5c58cf['number'];this[_0xc538('0x14')]=_0x5c58cf[_0xc538('0x14')];this[_0xc538('0x15')]=_0x5c58cf[_0xc538('0x15')];this[_0xc538('0x16')]=moment()[_0xc538('0x17')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc538('0x18')]=utils['getSeconds'](_0x5c58cf[_0xc538('0x15')],_0x5c58cf[_0xc538('0x14')]);this[_0xc538('0x19')]=0x0;this['talktime']=utils[_0xc538('0x1a')](this[_0xc538('0x16')],_0x5c58cf[_0xc538('0x15')]);this[_0xc538('0x7')]=_0x5c58cf['queue'];this[_0xc538('0x1b')]='IVR';this[_0xc538('0x1c')]=_0x3e2ed7['cause-txt'];this['callback']=_0x5c58cf[_0xc538('0x1d')];this[_0xc538('0x1e')]=_0x5c58cf[_0xc538('0x1e')];this['callbackat']=_0x5c58cf[_0xc538('0x1f')];this[_0xc538('0x20')]=_0x5c58cf[_0xc538('0x20')];this[_0xc538('0x21')]=_0x5c58cf[_0xc538('0x21')];this[_0xc538('0x22')]=_0x5c58cf[_0xc538('0x22')];this['UserId']=_0x5c58cf['UserId'];this[_0xc538('0x23')]=_0x5c58cf[_0xc538('0x23')];this[_0xc538('0x24')]=_0x5c58cf[_0xc538('0x24')];}module[_0xc538('0x25')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 57b8559..1254b09 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81f5=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x81f5,0xc6));var _0x581f=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x81f5[_0x187ee1];return _0x388160;};'use strict';var utils=require(_0x581f('0x0'));function History(_0x156ed1){this[_0x581f('0x1')]=_0x156ed1[_0x581f('0x1')];this[_0x581f('0x2')]=_0x156ed1[_0x581f('0x2')]||undefined;this[_0x581f('0x3')]=_0x156ed1[_0x581f('0x3')];this[_0x581f('0x4')]=_0x156ed1['type']===_0x581f('0x5')?_0x581f('0x6'):_0x156ed1[_0x581f('0x3')];this[_0x581f('0x7')]=_0x156ed1[_0x581f('0x7')];this[_0x581f('0x8')]=_0x156ed1[_0x581f('0x8')];this[_0x581f('0x9')]=_0x156ed1[_0x581f('0x9')];this[_0x581f('0xa')]=_0x156ed1[_0x581f('0x7')]+_0x156ed1[_0x581f('0x8')]+_0x156ed1[_0x581f('0x9')]+_0x156ed1['countnosuchnumberretry']+_0x156ed1[_0x581f('0xb')]+_0x156ed1[_0x581f('0xc')]+_0x156ed1[_0x581f('0xd')]+_0x156ed1['countagentrejectretry'];this[_0x581f('0xe')]=_0x156ed1[_0x581f('0xe')];this[_0x581f('0xb')]=_0x156ed1[_0x581f('0xb')];this['countabandonedretry']=_0x156ed1[_0x581f('0xc')];this['countmachineretry']=_0x156ed1[_0x581f('0xd')];this[_0x581f('0xf')]=_0x156ed1[_0x581f('0xf')];this[_0x581f('0x6')]=_0x156ed1['queue'];this[_0x581f('0x10')]=_0x156ed1[_0x581f('0x11')];this[_0x581f('0x12')]=_0x156ed1[_0x581f('0x13')];this[_0x581f('0x14')]=_0x156ed1[_0x581f('0x14')];this[_0x581f('0x15')]=_0x156ed1[_0x581f('0x15')];this[_0x581f('0x16')]=_0x156ed1['responsetime'];this[_0x581f('0x17')]=utils[_0x581f('0x18')](_0x156ed1[_0x581f('0x15')],_0x156ed1[_0x581f('0x14')]);this['holdtime']=0x0;this[_0x581f('0x19')]=0x0;this['callback']=_0x156ed1[_0x581f('0x1a')];this[_0x581f('0x1b')]=_0x156ed1[_0x581f('0x1b')];this[_0x581f('0x1c')]=_0x156ed1[_0x581f('0x1c')];this[_0x581f('0x1d')]=_0x156ed1[_0x581f('0x1d')];this[_0x581f('0x1e')]=_0x156ed1[_0x581f('0x1e')];this[_0x581f('0x1f')]=_0x156ed1[_0x581f('0x1f')];this['UserId']=_0x156ed1[_0x581f('0x20')];this['VoiceQueueId']=_0x156ed1[_0x581f('0x21')];this['CampaignId']=_0x156ed1[_0x581f('0x22')];this[_0x581f('0x23')]=_0x156ed1['originatecalleridnum']||'';this['originatecalleridname']=_0x156ed1[_0x581f('0x24')]||'';this[_0x581f('0x25')]=_0x156ed1['state'];this[_0x581f('0x26')]=_0x156ed1['statedesc'];}module[_0x581f('0x27')]=History; \ No newline at end of file +var _0x6348=['countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','name','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x2a5b38,_0x2eaa7b){var _0x42c6f2=function(_0x19a95b){while(--_0x19a95b){_0x2a5b38['push'](_0x2a5b38['shift']());}};_0x42c6f2(++_0x2eaa7b);}(_0x6348,0x90));var _0x8634=function(_0x41bbaa,_0x532d97){_0x41bbaa=_0x41bbaa-0x0;var _0x2f639f=_0x6348[_0x41bbaa];return _0x2f639f;};'use strict';var utils=require(_0x8634('0x0'));function History(_0x30ceed){this['uniqueid']=_0x30ceed[_0x8634('0x1')];this[_0x8634('0x2')]=_0x30ceed['scheduledat']||undefined;this[_0x8634('0x3')]=_0x30ceed[_0x8634('0x3')];this[_0x8634('0x4')]=_0x30ceed[_0x8634('0x3')]===_0x8634('0x5')?_0x8634('0x6'):_0x30ceed['type'];this[_0x8634('0x7')]=_0x30ceed[_0x8634('0x7')];this['countcongestionretry']=_0x30ceed['countcongestionretry'];this[_0x8634('0x8')]=_0x30ceed[_0x8634('0x8')];this[_0x8634('0x9')]=_0x30ceed['countbusyretry']+_0x30ceed[_0x8634('0xa')]+_0x30ceed['countnoanswerretry']+_0x30ceed[_0x8634('0xb')]+_0x30ceed[_0x8634('0xc')]+_0x30ceed['countabandonedretry']+_0x30ceed[_0x8634('0xd')]+_0x30ceed[_0x8634('0xe')];this[_0x8634('0xb')]=_0x30ceed[_0x8634('0xb')];this[_0x8634('0xc')]=_0x30ceed[_0x8634('0xc')];this['countabandonedretry']=_0x30ceed[_0x8634('0xf')];this[_0x8634('0xd')]=_0x30ceed[_0x8634('0xd')];this['countagentrejectretry']=_0x30ceed[_0x8634('0xe')];this[_0x8634('0x6')]=_0x30ceed['queue'];this['calleridname']=_0x30ceed[_0x8634('0x10')];this['calleridnum']=_0x30ceed[_0x8634('0x11')];this[_0x8634('0x12')]=_0x30ceed[_0x8634('0x12')];this[_0x8634('0x13')]=_0x30ceed[_0x8634('0x13')];this[_0x8634('0x14')]=_0x30ceed['responsetime'];this[_0x8634('0x15')]=utils[_0x8634('0x16')](_0x30ceed[_0x8634('0x13')],_0x30ceed['starttime']);this[_0x8634('0x17')]=0x0;this[_0x8634('0x18')]=0x0;this['callback']=_0x30ceed[_0x8634('0x19')];this['callbackuniqueid']=_0x30ceed['callbackuniqueid'];this[_0x8634('0x1a')]=_0x30ceed[_0x8634('0x1a')];this[_0x8634('0x1b')]=_0x30ceed[_0x8634('0x1b')];this[_0x8634('0x1c')]=_0x30ceed['ContactId'];this['ListId']=_0x30ceed[_0x8634('0x1d')];this[_0x8634('0x1e')]=_0x30ceed[_0x8634('0x1e')];this[_0x8634('0x1f')]=_0x30ceed[_0x8634('0x1f')];this[_0x8634('0x20')]=_0x30ceed['CampaignId'];this['originatecalleridnum']=_0x30ceed[_0x8634('0x21')]||'';this['originatecalleridname']=_0x30ceed[_0x8634('0x22')]||'';this[_0x8634('0x23')]=_0x30ceed[_0x8634('0x23')];this[_0x8634('0x24')]=_0x30ceed[_0x8634('0x24')];}module[_0x8634('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index f12b4d3..32fc811 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0009=['countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','droptime','endtime','ringtime','getSeconds','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0x0009,0x94));var _0x9000=function(_0x258b00,_0x28e9b0){_0x258b00=_0x258b00-0x0;var _0x3ca676=_0x0009[_0x258b00];return _0x3ca676;};'use strict';var utils=require(_0x9000('0x0'));function QueueCallerAbandon(_0x36803b,_0x48dd57){this[_0x9000('0x1')]=_0x36803b[_0x9000('0x1')];this[_0x9000('0x2')]=_0x36803b[_0x9000('0x2')];this[_0x9000('0x3')]=_0x36803b[_0x9000('0x2')]==='outbound'?'queue':_0x36803b[_0x9000('0x2')];this[_0x9000('0x4')]=_0x36803b['countbusyretry'];this[_0x9000('0x5')]=_0x36803b['countcongestionretry'];this[_0x9000('0x6')]=_0x36803b[_0x9000('0x6')];this[_0x9000('0x7')]=_0x36803b[_0x9000('0x4')]+_0x36803b[_0x9000('0x5')]+_0x36803b[_0x9000('0x6')]+_0x36803b[_0x9000('0x8')]+_0x36803b[_0x9000('0x9')]+_0x36803b[_0x9000('0xa')]+_0x36803b[_0x9000('0xb')]+_0x36803b[_0x9000('0xc')];this[_0x9000('0x8')]=_0x36803b[_0x9000('0x8')];this['countdropretry']=_0x36803b['countdropretry'];this[_0x9000('0xa')]=_0x36803b[_0x9000('0xa')];this['countmachineretry']=_0x36803b[_0x9000('0xb')];this[_0x9000('0xc')]=_0x36803b['countagentrejectretry'];this[_0x9000('0xd')]=_0x48dd57[_0x9000('0xd')];this[_0x9000('0xe')]=_0x36803b['name'];this['calleridnum']=_0x36803b[_0x9000('0xf')];this[_0x9000('0x10')]=_0x36803b[_0x9000('0x10')];this[_0x9000('0x11')]=_0x36803b['responsetime'];this[_0x9000('0x12')]=_0x36803b[_0x9000('0x12')];this['dropreason']=_0x36803b['dropreason'];this[_0x9000('0x13')]=this[_0x9000('0x12')];this[_0x9000('0x14')]=utils[_0x9000('0x15')](_0x36803b[_0x9000('0x11')],_0x36803b[_0x9000('0x10')]);this[_0x9000('0x16')]=utils[_0x9000('0x15')](this['droptime'],_0x36803b[_0x9000('0x11')]);this[_0x9000('0x17')]=0x0;this[_0x9000('0x18')]=_0x48dd57['queue'];this[_0x9000('0x19')]=_0x48dd57['connectedlinename'];this[_0x9000('0x1a')]=_0x48dd57[_0x9000('0x1a')];this[_0x9000('0x1b')]=_0x36803b[_0x9000('0x1b')];this[_0x9000('0x1c')]=_0x36803b[_0x9000('0x1c')];this[_0x9000('0x1d')]=_0x36803b[_0x9000('0x1d')];this['recallme']=_0x36803b[_0x9000('0x1e')];this[_0x9000('0x1f')]=_0x36803b[_0x9000('0x1f')];this[_0x9000('0x20')]=_0x36803b['ListId'];this[_0x9000('0x21')]=_0x36803b[_0x9000('0x21')];this['VoiceQueueId']=_0x36803b[_0x9000('0x22')];this[_0x9000('0x23')]=_0x36803b['CampaignId'];this[_0x9000('0x24')]=_0x36803b[_0x9000('0x24')]||'';this[_0x9000('0x25')]=_0x36803b[_0x9000('0x25')]||'';this['agiafterat']=_0x36803b['agiafterat'];this[_0x9000('0x26')]=_0x36803b[_0x9000('0x26')];this[_0x9000('0x27')]=_0x36803b['statedesc'];}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xa97d=['agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa97d,0x88));var _0xda97=function(_0x537b97,_0x3f5cc8){_0x537b97=_0x537b97-0x0;var _0x8d8eb9=_0xa97d[_0x537b97];return _0x8d8eb9;};'use strict';var utils=require(_0xda97('0x0'));function QueueCallerAbandon(_0x206ccf,_0x1fbcea){this[_0xda97('0x1')]=_0x206ccf['scheduledat'];this['type']=_0x206ccf[_0xda97('0x2')];this[_0xda97('0x3')]=_0x206ccf[_0xda97('0x2')]==='outbound'?'queue':_0x206ccf[_0xda97('0x2')];this['countbusyretry']=_0x206ccf[_0xda97('0x4')];this[_0xda97('0x5')]=_0x206ccf[_0xda97('0x5')];this[_0xda97('0x6')]=_0x206ccf[_0xda97('0x6')];this[_0xda97('0x7')]=_0x206ccf[_0xda97('0x4')]+_0x206ccf[_0xda97('0x5')]+_0x206ccf[_0xda97('0x6')]+_0x206ccf[_0xda97('0x8')]+_0x206ccf[_0xda97('0x9')]+_0x206ccf[_0xda97('0xa')]+_0x206ccf[_0xda97('0xb')]+_0x206ccf[_0xda97('0xc')];this['countnosuchnumberretry']=_0x206ccf[_0xda97('0x8')];this['countdropretry']=_0x206ccf['countdropretry'];this['countabandonedretry']=_0x206ccf[_0xda97('0xa')];this[_0xda97('0xb')]=_0x206ccf['countmachineretry'];this['countagentrejectretry']=_0x206ccf[_0xda97('0xc')];this[_0xda97('0xd')]=_0x1fbcea['uniqueid'];this[_0xda97('0xe')]=_0x206ccf[_0xda97('0xf')];this[_0xda97('0x10')]=_0x206ccf['number'];this[_0xda97('0x11')]=_0x206ccf[_0xda97('0x11')];this['responsetime']=_0x206ccf[_0xda97('0x12')];this[_0xda97('0x13')]=_0x206ccf[_0xda97('0x13')];this[_0xda97('0x14')]=_0x206ccf[_0xda97('0x14')];this[_0xda97('0x15')]=this['droptime'];this['ringtime']=utils[_0xda97('0x16')](_0x206ccf[_0xda97('0x12')],_0x206ccf['starttime']);this[_0xda97('0x17')]=utils['getSeconds'](this['droptime'],_0x206ccf[_0xda97('0x12')]);this[_0xda97('0x18')]=0x0;this['queue']=_0x1fbcea[_0xda97('0x19')];this[_0xda97('0x1a')]=_0x1fbcea[_0xda97('0x1b')];this['reason']=_0x1fbcea[_0xda97('0x1c')];this[_0xda97('0x1d')]=_0x206ccf[_0xda97('0x1d')];this[_0xda97('0x1e')]=_0x206ccf[_0xda97('0x1e')];this['callbackat']=_0x206ccf[_0xda97('0x1f')];this[_0xda97('0x20')]=_0x206ccf['recallme'];this['ContactId']=_0x206ccf[_0xda97('0x21')];this['ListId']=_0x206ccf[_0xda97('0x22')];this[_0xda97('0x23')]=_0x206ccf['UserId'];this[_0xda97('0x24')]=_0x206ccf[_0xda97('0x24')];this['CampaignId']=_0x206ccf[_0xda97('0x25')];this[_0xda97('0x26')]=_0x206ccf[_0xda97('0x26')]||'';this[_0xda97('0x27')]=_0x206ccf['originatecalleridname']||'';this['agiafterat']=_0x206ccf[_0xda97('0x28')];this[_0xda97('0x29')]=_0x206ccf[_0xda97('0x29')];this[_0xda97('0x2a')]=_0x206ccf[_0xda97('0x2a')];}module[_0xda97('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 1d59649..3c5c7aa 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcf0=['[avgHandleTime]','createHistory','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime'];(function(_0xe022c7,_0x412d44){var _0x5d5cd9=function(_0x4f2076){while(--_0x4f2076){_0xe022c7['push'](_0xe022c7['shift']());}};_0x5d5cd9(++_0x412d44);}(_0xfcf0,0x138));var _0x0fcf=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0xfcf0[_0x15fc3c];return _0x94c5c8;};'use strict';var util=require(_0x0fcf('0x0'));var logger=require(_0x0fcf('0x1'))('dialer');var cmHopper=require(_0x0fcf('0x2'));var cmHopperAdditionalPhone=require(_0x0fcf('0x3'));var cmHopperBlack=require(_0x0fcf('0x4'));var cmHopperHistory=require(_0x0fcf('0x5'));function inspectError(_0x5c865e){return util[_0x0fcf('0x6')](_0x5c865e,{'showHidden':![],'depth':null});}function getContactDialer(_0x265968,_0x3bd34d,_0x3af316){return cmHopper[_0x0fcf('0x7')](_0x265968['id'],_0x3bd34d,_0x3af316,_0x265968[_0x0fcf('0x8')])[_0x0fcf('0x9')](function(_0x2dfdf8){_0x265968['temp']=0x0;logger[_0x0fcf('0xa')](_0x0fcf('0xb'),inspectError(_0x2dfdf8));});}exports[_0x0fcf('0x7')]=getContactDialer;function getContactDialerIvr(_0x4de593,_0x69a840){return cmHopper[_0x0fcf('0xc')](_0x4de593['id'],_0x69a840,_0x4de593[_0x0fcf('0x8')])['catch'](function(_0x369959){_0x4de593['temp']=0x0;logger[_0x0fcf('0xa')](_0x0fcf('0xd'),inspectError(_0x369959));});}exports[_0x0fcf('0xc')]=getContactDialerIvr;function countReScheduled(_0x48619c){return cmHopper['countReScheduled'](_0x48619c)[_0x0fcf('0x9')](function(_0x3c999e){logger['error'](_0x0fcf('0xe'),inspectError(_0x3c999e));});}exports[_0x0fcf('0xf')]=countReScheduled;function rescheduleContact(_0x160d2c){return cmHopper[_0x0fcf('0x10')](_0x160d2c)[_0x0fcf('0x9')](function(_0x48bba6){logger[_0x0fcf('0xa')](_0x0fcf('0x11'),inspectError(_0x48bba6));});}exports[_0x0fcf('0x10')]=rescheduleContact;function unlockContact(_0x5e867f,_0x3c09c4,_0x610106){return cmHopper[_0x0fcf('0x12')](_0x5e867f,_0x3c09c4,_0x610106)[_0x0fcf('0x9')](function(_0x48dd53){logger[_0x0fcf('0xa')](_0x0fcf('0x13'),inspectError(_0x48dd53));});}exports[_0x0fcf('0x12')]=unlockContact;function moveContactManagedDialer(_0x8581bd){return cmHopper[_0x0fcf('0x14')](_0x8581bd)['catch'](function(_0x18ea32){logger[_0x0fcf('0xa')]('[moveContactManagedDialer]',inspectError(_0x18ea32));});}exports[_0x0fcf('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x1b9a90){return cmHopperBlack['checkIsBlackList'](_0x1b9a90)[_0x0fcf('0x9')](function(_0x50ac4a){logger[_0x0fcf('0xa')](_0x0fcf('0x15'),inspectError(_0x50ac4a));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x457880){return cmHopperBlack[_0x0fcf('0x16')](_0x457880)[_0x0fcf('0x9')](function(_0x5c459c){logger[_0x0fcf('0xa')](_0x0fcf('0x17'),inspectError(_0x5c459c));});}exports[_0x0fcf('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x41b20b,_0x18af5c,_0x30e1b0){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x41b20b,_0x18af5c,_0x30e1b0)[_0x0fcf('0x9')](function(_0x253641){logger[_0x0fcf('0xa')](_0x0fcf('0x18'),inspectError(_0x253641));});}exports[_0x0fcf('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x3cf074,_0x2ce990,_0x18f269){return cmHopperAdditionalPhone[_0x0fcf('0x1a')](_0x3cf074,_0x2ce990,_0x18f269)['catch'](function(_0x18965e){logger[_0x0fcf('0xa')](_0x0fcf('0x1b'),inspectError(_0x18965e));});}exports[_0x0fcf('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x3876ed){return cmHopperHistory[_0x0fcf('0x1c')](_0x3876ed)[_0x0fcf('0x9')](function(_0x527d43){logger[_0x0fcf('0xa')](_0x0fcf('0x1d'),inspectError(_0x527d43));});}exports[_0x0fcf('0x1c')]=avgHandleTime;function createHistory(_0x35180d){return cmHopperHistory['createHistory'](_0x35180d)['catch'](function(_0x4af80d){logger[_0x0fcf('0xa')]('[createHistory]',inspectError(_0x4af80d));});}exports[_0x0fcf('0x1e')]=createHistory; \ No newline at end of file +var _0x32f4=['catch','[getContactDialerIvr]','countReScheduled','error','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','temp','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt'];(function(_0x4ecd2d,_0x1615d8){var _0x291fc6=function(_0x561511){while(--_0x561511){_0x4ecd2d['push'](_0x4ecd2d['shift']());}};_0x291fc6(++_0x1615d8);}(_0x32f4,0x154));var _0x432f=function(_0x2ac8f0,_0x21d3df){_0x2ac8f0=_0x2ac8f0-0x0;var _0x4e9e93=_0x32f4[_0x2ac8f0];return _0x4e9e93;};'use strict';var util=require(_0x432f('0x0'));var logger=require(_0x432f('0x1'))(_0x432f('0x2'));var cmHopper=require(_0x432f('0x3'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x432f('0x4'));var cmHopperHistory=require(_0x432f('0x5'));function inspectError(_0x51a71a){return util[_0x432f('0x6')](_0x51a71a,{'showHidden':![],'depth':null});}function getContactDialer(_0x1eabac,_0x344a29,_0x355b02){return cmHopper[_0x432f('0x7')](_0x1eabac['id'],_0x344a29,_0x355b02,_0x1eabac['dialOrderByScheduledAt'])['catch'](function(_0x2f66fd){_0x1eabac[_0x432f('0x8')]=0x0;logger['error'](_0x432f('0x9'),inspectError(_0x2f66fd));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1cdcfd,_0x340fe9){return cmHopper[_0x432f('0xa')](_0x1cdcfd['id'],_0x340fe9,_0x1cdcfd[_0x432f('0xb')])[_0x432f('0xc')](function(_0x5d0155){_0x1cdcfd[_0x432f('0x8')]=0x0;logger['error'](_0x432f('0xd'),inspectError(_0x5d0155));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x138967){return cmHopper[_0x432f('0xe')](_0x138967)['catch'](function(_0x457389){logger[_0x432f('0xf')]('[countReScheduled]',inspectError(_0x457389));});}exports[_0x432f('0xe')]=countReScheduled;function rescheduleContact(_0x26aa9a){return cmHopper['rescheduleContact'](_0x26aa9a)['catch'](function(_0x28d9e9){logger[_0x432f('0xf')](_0x432f('0x10'),inspectError(_0x28d9e9));});}exports[_0x432f('0x11')]=rescheduleContact;function unlockContact(_0x419bfe,_0x4f91c5,_0x175ba7){return cmHopper[_0x432f('0x12')](_0x419bfe,_0x4f91c5,_0x175ba7)[_0x432f('0xc')](function(_0x1504db){logger['error'](_0x432f('0x13'),inspectError(_0x1504db));});}exports[_0x432f('0x12')]=unlockContact;function moveContactManagedDialer(_0x42c2d2){return cmHopper[_0x432f('0x14')](_0x42c2d2)[_0x432f('0xc')](function(_0x129582){logger['error'](_0x432f('0x15'),inspectError(_0x129582));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x3d545d){return cmHopperBlack[_0x432f('0x16')](_0x3d545d)[_0x432f('0xc')](function(_0x391fd8){logger[_0x432f('0xf')](_0x432f('0x17'),inspectError(_0x391fd8));});}exports[_0x432f('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x1899e6){return cmHopperBlack[_0x432f('0x18')](_0x1899e6)[_0x432f('0xc')](function(_0x40176d){logger[_0x432f('0xf')]('[checkIsBlackListIvr]',inspectError(_0x40176d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x343d13,_0x5c4deb,_0x28968e){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x343d13,_0x5c4deb,_0x28968e)[_0x432f('0xc')](function(_0x175d1b){logger[_0x432f('0xf')](_0x432f('0x19'),inspectError(_0x175d1b));});}exports[_0x432f('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1e347a,_0x59f352,_0x252b3b){return cmHopperAdditionalPhone[_0x432f('0x1b')](_0x1e347a,_0x59f352,_0x252b3b)['catch'](function(_0x2cbde9){logger[_0x432f('0xf')](_0x432f('0x1c'),inspectError(_0x2cbde9));});}exports[_0x432f('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x44839){return cmHopperHistory[_0x432f('0x1d')](_0x44839)[_0x432f('0xc')](function(_0x5a3d18){logger[_0x432f('0xf')]('[avgHandleTime]',inspectError(_0x5a3d18));});}exports[_0x432f('0x1d')]=avgHandleTime;function createHistory(_0x573cc5){return cmHopperHistory[_0x432f('0x1e')](_0x573cc5)['catch'](function(_0x3f768b){logger['error'](_0x432f('0x1f'),inspectError(_0x3f768b));});}exports[_0x432f('0x1e')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 1601c41..cdfc8cb 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23aa=['includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','match','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','pow','format','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','isNil','toUpperCase','XMD-','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialGlobalInterval','Interval','Intervals','isEmpty','EMPTY_INTERVAL','SIP/','unmonitored'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x23aa,0x1d0));var _0xa23a=function(_0x11939b,_0x1e9814){_0x11939b=_0x11939b-0x0;var _0x212d55=_0x23aa[_0x11939b];return _0x212d55;};'use strict';var _=require(_0xa23a('0x0'));var moment=require(_0xa23a('0x1'));var util=require(_0xa23a('0x2'));var logger=require(_0xa23a('0x3'))(_0xa23a('0x4'));var timezones=require(_0xa23a('0x5'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xa23a('0x6'),'BLACKLIST':_0xa23a('0x7'),'CONTACTS_RESCHEDULED':_0xa23a('0x8'),'DEACTIVATED':_0xa23a('0x9'),'DISACTIVED':_0xa23a('0xa'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xa23a('0xb'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xa23a('0xc'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xa23a('0xd'),'QUEUE_RECALL':_0xa23a('0xe'),'RECALL_TIMEOUT':_0xa23a('0xf'),'RUNNING':_0xa23a('0x10'),'UNKNOWN_TIMEZONE':_0xa23a('0x11'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xa23a('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1c8558){return _0x1c8558[_0xa23a('0x13')]===_0xa23a('0x14');}exports[_0xa23a('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x19597b){return _0x19597b[_0xa23a('0x16')]===_0xa23a('0x17');}exports[_0xa23a('0x18')]=isIVRCampaign;function isOutboundQueue(_0x360a6c){return _0x360a6c[_0xa23a('0x16')]===_0xa23a('0x19');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x356691){return _0x356691[_0xa23a('0x1a')];}exports[_0xa23a('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4f53ee){return _0x4f53ee['active'];}exports[_0xa23a('0x1c')]=isIVRCampaignActive;function getSeconds(_0x4ea48e,_0x56babb){var _0x4a8575=moment(_0x4ea48e)['milliseconds'](0x0);var _0x4353ed=moment(_0x56babb)[_0xa23a('0x1d')](0x0);return _0x4a8575['diff'](_0x4353ed,_0xa23a('0x1e'));}exports[_0xa23a('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x11e7b5,_0x4d448d){var _0x36195a=![];var _0x38f0e9=_0x11e7b5['dialMethod']!==_0x4d448d[_0xa23a('0x13')]||_0x11e7b5[_0xa23a('0x1a')]!==_0x4d448d[_0xa23a('0x1a')]||_0x11e7b5[_0xa23a('0x20')]!==_0x4d448d['message'];var _0x1304fb=_0x11e7b5[_0xa23a('0x21')]!==_0x4d448d[_0xa23a('0x21')]||_0x11e7b5[_0xa23a('0x22')]!==_0x4d448d[_0xa23a('0x22')]||_0x11e7b5[_0xa23a('0x23')]!==_0x4d448d['loggedInDb']||_0x11e7b5[_0xa23a('0x24')]!==_0x4d448d[_0xa23a('0x24')]||_0x11e7b5[_0xa23a('0x25')]!==_0x4d448d[_0xa23a('0x25')]||_0x11e7b5[_0xa23a('0x26')]!==_0x4d448d['pTalking']||_0x11e7b5[_0xa23a('0x27')]!==_0x4d448d['waiting']||_0x11e7b5['inUse']!==_0x4d448d['inUse']||_0x11e7b5['originated']!==_0x4d448d[_0xa23a('0x28')];if(_0x11e7b5[_0xa23a('0x29')]&&_0x4d448d[_0xa23a('0x29')]){_0x36195a=_0x11e7b5['Trunk'][_0xa23a('0x2a')]!==_0x4d448d['Trunk']['name']||_0x11e7b5[_0xa23a('0x29')][_0xa23a('0x2b')]!==_0x4d448d[_0xa23a('0x29')]['active'];}return _0x38f0e9||_0x1304fb||_0x36195a;}exports[_0xa23a('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x7cc168){var _0x49c89a=null;var _0xa9031b=_0x7cc168['dialTimezone'];if(_['isNil'](_0x7cc168[_0xa23a('0x2d')])||_['isNil'](_0x7cc168[_0xa23a('0x2e')])||_['isNil'](_0x7cc168[_0xa23a('0x2e')][_0xa23a('0x2f')])){_0x49c89a=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xa23a('0x30')](_0x7cc168['dialGlobalInterval'])||_['isEmpty'](_0x7cc168[_0xa23a('0x2e')]['Intervals'])){_0x49c89a=CAMPAIGN_STATUS[_0xa23a('0x31')];}else if(_0xa9031b&&!timezones[_0xa9031b]){_0x49c89a=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x49c89a;}function checkAnyValidTrunk(_0x682b27,_0x14f74e){var _0x2302b0=null;var _0x26ae8e=_0xa23a('0x32');var _0x1522bf=['reachable',_0xa23a('0x33')];var _0x12430a=!![];if(_0x682b27['Trunk']&&_0x682b27[_0xa23a('0x29')][_0xa23a('0x2b')]){_0x26ae8e+=_0x682b27[_0xa23a('0x29')][_0xa23a('0x2a')];_0x2302b0=_0x14f74e[_0x26ae8e];_0x12430a=_0x1522bf[_0xa23a('0x34')](_0x2302b0[_0xa23a('0x35')]);}else if(_0x682b27[_0xa23a('0x36')]&&_0x682b27[_0xa23a('0x36')][_0xa23a('0x2b')]){_0x26ae8e+=_0x682b27[_0xa23a('0x36')][_0xa23a('0x2a')];_0x2302b0=_0x14f74e[_0x26ae8e];_0x12430a=_0x1522bf[_0xa23a('0x34')](_0x2302b0[_0xa23a('0x35')]);}return _0x12430a;}function getQueueCampaignStatusMessage(_0x4bf78a,_0x29296f){var _0x831e58=CAMPAIGN_STATUS[_0xa23a('0x6')];var _0x28a8ac=isPreviewCampaign(_0x4bf78a);if(!isQueueCampaignActive(_0x4bf78a)){if(_0x28a8ac){_0x831e58=CAMPAIGN_STATUS[_0xa23a('0x37')];}else{if(_0x4bf78a['originated']===0x0&&_0x4bf78a['talking']===0x0&&_0x4bf78a[_0xa23a('0x27')]===0x0&&(_0x4bf78a[_0xa23a('0x26')]||0x0)===0x0){_0x831e58=CAMPAIGN_STATUS['INACTIVE'];}else{_0x831e58=CAMPAIGN_STATUS[_0xa23a('0x38')];}}}else if(_0x4bf78a['loggedIn']===0x0){_0x831e58=CAMPAIGN_STATUS[_0xa23a('0x39')];}else if(!checkAnyValidTrunk(_0x4bf78a,_0x29296f)){_0x831e58=CAMPAIGN_STATUS[_0xa23a('0x3a')];}else if(!isPreviewCampaign(_0x4bf78a)){var _0x5d0919=checkAnyValidQueueCampaignInterval(_0x4bf78a);if(_0x5d0919){_0x831e58=_0x5d0919;}}return _0x831e58;}exports[_0xa23a('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3bb56){var _0x3eac7b=CAMPAIGN_STATUS[_0xa23a('0x38')];if(_0x3bb56['originated']===0x0&&_0x3bb56[_0xa23a('0x25')]===0x0&&_0x3bb56[_0xa23a('0x27')]===0x0&&(_0x3bb56[_0xa23a('0x26')]||0x0)===0x0){_0x3eac7b=CAMPAIGN_STATUS[_0xa23a('0x37')];}return _0x3eac7b;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4b97f4){var _0x26df6a=_0x4b97f4[_0xa23a('0x3c')](/"(.*?)"/);return _0x26df6a?_0x26df6a[0x1]:_0x4b97f4;}exports[_0xa23a('0x3d')]=extractCalleridName;function getCallerId(_0x4edff3,_0x510091,_0x2448f3){if(!_[_0xa23a('0x3e')](_0x2448f3)&&typeof _0x2448f3==='string'&&!_[_0xa23a('0x30')](_0x2448f3)){if(!_[_0xa23a('0x3e')](_0x510091)&&typeof _0x510091===_0xa23a('0x3f')&&!_[_0xa23a('0x30')](_0x510091)){return util['format'](_0xa23a('0x40'),_0x510091,_0x2448f3);}return util['format'](_0xa23a('0x40'),_0x2448f3,_0x2448f3);}if(!_[_0xa23a('0x3e')](_0x4edff3)&&typeof _0x4edff3===_0xa23a('0x3f')&&!_[_0xa23a('0x30')](_0x4edff3)){return _0x4edff3;}return _0xa23a('0x41');}exports[_0xa23a('0x42')]=getCallerId;function getCallerIdRandom(_0x1ca89e,_0x2168ad){var _0x5321aa;var _0x342724;var _0x42c744;if(_0x2168ad<=0x0){_0x2168ad=0x1;}_0x5321aa=new RegExp('\x5cw{0,'+_0x2168ad+'}$');_0x342724=Math['pow'](0xa,_0x2168ad-0x1);_0x42c744=Math[_0xa23a('0x43')](0xa,_0x2168ad)-0x1;return util[_0xa23a('0x44')]('%s',_['replace'](_0x1ca89e,_0x5321aa,_[_0xa23a('0x45')](_0x342724,_0x42c744)[_0xa23a('0x46')]()));}exports[_0xa23a('0x47')]=getCallerIdRandom;function decrementOriginate(_0x53460b){if(_0x53460b['originated']&&_0x53460b['originated']>0x0){_0x53460b[_0xa23a('0x28')]-=0x1;}else{logger[_0xa23a('0x48')](_0xa23a('0x49'));}}exports[_0xa23a('0x4a')]=decrementOriginate;function checkContactEmpty(_0x420f05){return _0x420f05&&_0x420f05[_0xa23a('0x4b')]>0x0;}exports[_0xa23a('0x4c')]=checkContactEmpty;function erlangb(_0x40feec,_0x271605){if(_0x271605===0x0){return 0x0;}var _0x10415=0x1;for(var _0x357671=0x1;_0x357671<=_0x271605;_0x357671+=0x1){_0x10415=0x1+_0x10415*_0x357671/_0x40feec;}return 0x1/_0x10415;}exports[_0xa23a('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0x308817,_0x220993,_0x5cfbad){if(_0x220993>_0x5cfbad){for(var _0x5b3403=0x0;_0x5b3403<_0x220993-_0x5cfbad;_0x5b3403+=0x1){decrementOriginate(_0x308817);}}}exports[_0xa23a('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x28b59c){var _0x577855={};var _0x16b4d4=['id',_0xa23a('0x4f'),_0xa23a('0x50'),_0xa23a('0x51')];const _0xef4702=0xfa;if(_0x28b59c){for(var _0x11b6e7 in _0x28b59c){if(typeof _0x28b59c[_0x11b6e7]!=='undefined'){if(!_[_0xa23a('0x52')](_0x28b59c[_0x11b6e7])&&!_0x16b4d4[_0xa23a('0x34')](_0x11b6e7)){if(_0x11b6e7==='description'&&_0x28b59c[_0x11b6e7][_0xa23a('0x4b')]>_0xef4702){_0x577855['XMD-'+_0x11b6e7[_0xa23a('0x53')]()]=_0x28b59c[_0x11b6e7]['toString']()['substring'](0x0,_0xef4702);}else{_0x577855[_0xa23a('0x54')+_0x11b6e7[_0xa23a('0x53')]()]=_0x28b59c[_0x11b6e7];}}}}}return _0x577855;}exports[_0xa23a('0x55')]=setXMDContactVariables; \ No newline at end of file +var _0x83d4=['AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','unmonitored','status','TrunkBackup','INACTIVE','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','updatedAt','undefined','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE'];(function(_0x417ea1,_0x1587cc){var _0x238363=function(_0x44a155){while(--_0x44a155){_0x417ea1['push'](_0x417ea1['shift']());}};_0x238363(++_0x1587cc);}(_0x83d4,0xff));var _0x483d=function(_0x2abe66,_0x5dcf3d){_0x2abe66=_0x2abe66-0x0;var _0x21fa9a=_0x83d4[_0x2abe66];return _0x21fa9a;};'use strict';var _=require(_0x483d('0x0'));var moment=require('moment');var util=require(_0x483d('0x1'));var logger=require('../../../../config/logger')(_0x483d('0x2'));var timezones=require(_0x483d('0x3'))[_0x483d('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x483d('0x5'),'BLACKLIST':_0x483d('0x6'),'CONTACTS_RESCHEDULED':_0x483d('0x7'),'DEACTIVATED':_0x483d('0x8'),'DISACTIVED':_0x483d('0x9'),'EMPTY_INTERVAL':_0x483d('0xa'),'INACTIVE':_0x483d('0xb'),'NO_AGENTS_LOGGED':_0x483d('0xc'),'NO_AVAILABLE_CONTACTS':_0x483d('0xd'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x483d('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0x483d('0xf'),'QUEUE_RECALL':_0x483d('0x10'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x483d('0x11'),'UNREACHABLE_TRUNK':_0x483d('0x12')};exports[_0x483d('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x5f20d1){return _0x5f20d1[_0x483d('0x14')]===_0x483d('0x15');}exports[_0x483d('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x3bb5e){return _0x3bb5e[_0x483d('0x17')]===_0x483d('0x18');}exports[_0x483d('0x19')]=isIVRCampaign;function isOutboundQueue(_0x2a0225){return _0x2a0225['type']===_0x483d('0x1a');}exports[_0x483d('0x1b')]=isOutboundQueue;function isQueueCampaignActive(_0x13b210){return _0x13b210[_0x483d('0x1c')];}exports[_0x483d('0x1d')]=isQueueCampaignActive;function isIVRCampaignActive(_0x5f39e5){return _0x5f39e5[_0x483d('0x1e')];}exports[_0x483d('0x1f')]=isIVRCampaignActive;function getSeconds(_0x5ea325,_0x4f12c8){var _0x3f7848=moment(_0x5ea325)['milliseconds'](0x0);var _0x4f4d42=moment(_0x4f12c8)[_0x483d('0x20')](0x0);return _0x3f7848[_0x483d('0x21')](_0x4f4d42,_0x483d('0x22'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x2c9ff0,_0x360d45){var _0x2ac191=![];var _0x4181bd=_0x2c9ff0[_0x483d('0x14')]!==_0x360d45['dialMethod']||_0x2c9ff0[_0x483d('0x1c')]!==_0x360d45[_0x483d('0x1c')]||_0x2c9ff0[_0x483d('0x23')]!==_0x360d45[_0x483d('0x23')];var _0x42e1e5=_0x2c9ff0[_0x483d('0x24')]!==_0x360d45[_0x483d('0x24')]||_0x2c9ff0[_0x483d('0x25')]!==_0x360d45[_0x483d('0x25')]||_0x2c9ff0[_0x483d('0x26')]!==_0x360d45[_0x483d('0x26')]||_0x2c9ff0[_0x483d('0x27')]!==_0x360d45[_0x483d('0x27')]||_0x2c9ff0[_0x483d('0x28')]!==_0x360d45[_0x483d('0x28')]||_0x2c9ff0[_0x483d('0x29')]!==_0x360d45[_0x483d('0x29')]||_0x2c9ff0[_0x483d('0x2a')]!==_0x360d45[_0x483d('0x2a')]||_0x2c9ff0[_0x483d('0x2b')]!==_0x360d45[_0x483d('0x2b')]||_0x2c9ff0[_0x483d('0x2c')]!==_0x360d45[_0x483d('0x2c')];if(_0x2c9ff0[_0x483d('0x2d')]&&_0x360d45[_0x483d('0x2d')]){_0x2ac191=_0x2c9ff0[_0x483d('0x2d')][_0x483d('0x2e')]!==_0x360d45[_0x483d('0x2d')][_0x483d('0x2e')]||_0x2c9ff0['Trunk'][_0x483d('0x1e')]!==_0x360d45[_0x483d('0x2d')]['active'];}return _0x4181bd||_0x42e1e5||_0x2ac191;}exports[_0x483d('0x2f')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1d6296){var _0x189d05=null;var _0x4243d9=_0x1d6296[_0x483d('0x30')];if(_['isNil'](_0x1d6296[_0x483d('0x31')])||_[_0x483d('0x32')](_0x1d6296[_0x483d('0x33')])||_[_0x483d('0x32')](_0x1d6296[_0x483d('0x33')][_0x483d('0x34')])){_0x189d05=CAMPAIGN_STATUS[_0x483d('0x35')];}else if(_[_0x483d('0x36')](_0x1d6296[_0x483d('0x31')])||_[_0x483d('0x36')](_0x1d6296[_0x483d('0x33')][_0x483d('0x34')])){_0x189d05=CAMPAIGN_STATUS[_0x483d('0x37')];}else if(_0x4243d9&&!timezones[_0x4243d9]){_0x189d05=CAMPAIGN_STATUS[_0x483d('0x38')];}return _0x189d05;}function checkAnyValidTrunk(_0x3f3f5c,_0x458204){var _0x35c216=null;var _0x584f4f='SIP/';var _0x558279=['reachable',_0x483d('0x39')];var _0x2333c2=!![];if(_0x3f3f5c['Trunk']&&_0x3f3f5c[_0x483d('0x2d')][_0x483d('0x1e')]){_0x584f4f+=_0x3f3f5c[_0x483d('0x2d')][_0x483d('0x2e')];_0x35c216=_0x458204[_0x584f4f];_0x2333c2=_0x558279['includes'](_0x35c216[_0x483d('0x3a')]);}else if(_0x3f3f5c[_0x483d('0x3b')]&&_0x3f3f5c['TrunkBackup']['active']){_0x584f4f+=_0x3f3f5c[_0x483d('0x3b')][_0x483d('0x2e')];_0x35c216=_0x458204[_0x584f4f];_0x2333c2=_0x558279['includes'](_0x35c216['status']);}return _0x2333c2;}function getQueueCampaignStatusMessage(_0xa70d7f,_0x13ce6f){var _0x28e3e6=CAMPAIGN_STATUS['ACTIVE'];var _0x7ae6e=isPreviewCampaign(_0xa70d7f);if(!isQueueCampaignActive(_0xa70d7f)){if(_0x7ae6e){_0x28e3e6=CAMPAIGN_STATUS[_0x483d('0x3c')];}else{if(_0xa70d7f[_0x483d('0x2c')]===0x0&&_0xa70d7f[_0x483d('0x28')]===0x0&&_0xa70d7f['waiting']===0x0&&(_0xa70d7f[_0x483d('0x29')]||0x0)===0x0){_0x28e3e6=CAMPAIGN_STATUS['INACTIVE'];}else{_0x28e3e6=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0xa70d7f[_0x483d('0x25')]===0x0){_0x28e3e6=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0xa70d7f,_0x13ce6f)){_0x28e3e6=CAMPAIGN_STATUS[_0x483d('0x3d')];}else if(!isPreviewCampaign(_0xa70d7f)){var _0x427348=checkAnyValidQueueCampaignInterval(_0xa70d7f);if(_0x427348){_0x28e3e6=_0x427348;}}return _0x28e3e6;}exports[_0x483d('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0xe76320){var _0x3f7c15=CAMPAIGN_STATUS[_0x483d('0x3f')];if(_0xe76320[_0x483d('0x2c')]===0x0&&_0xe76320[_0x483d('0x28')]===0x0&&_0xe76320[_0x483d('0x2a')]===0x0&&(_0xe76320[_0x483d('0x29')]||0x0)===0x0){_0x3f7c15=CAMPAIGN_STATUS['INACTIVE'];}return _0x3f7c15;}exports[_0x483d('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x53b38b){var _0x1794ec=_0x53b38b['match'](/"(.*?)"/);return _0x1794ec?_0x1794ec[0x1]:_0x53b38b;}exports[_0x483d('0x41')]=extractCalleridName;function getCallerId(_0x363fb7,_0x4e5c49,_0x19ab56){if(!_[_0x483d('0x42')](_0x19ab56)&&typeof _0x19ab56===_0x483d('0x43')&&!_[_0x483d('0x36')](_0x19ab56)){if(!_[_0x483d('0x42')](_0x4e5c49)&&typeof _0x4e5c49===_0x483d('0x43')&&!_[_0x483d('0x36')](_0x4e5c49)){return util[_0x483d('0x44')](_0x483d('0x45'),_0x4e5c49,_0x19ab56);}return util[_0x483d('0x44')]('\x22%s\x22\x20<%s>',_0x19ab56,_0x19ab56);}if(!_['isUndefined'](_0x363fb7)&&typeof _0x363fb7===_0x483d('0x43')&&!_[_0x483d('0x36')](_0x363fb7)){return _0x363fb7;}return _0x483d('0x46');}exports[_0x483d('0x47')]=getCallerId;function getCallerIdRandom(_0x454ad5,_0x1d85ff){var _0x518b10;var _0x40c8bd;var _0x2f2414;if(_0x1d85ff<=0x0){_0x1d85ff=0x1;}_0x518b10=new RegExp(_0x483d('0x48')+_0x1d85ff+'}$');_0x40c8bd=Math['pow'](0xa,_0x1d85ff-0x1);_0x2f2414=Math['pow'](0xa,_0x1d85ff)-0x1;return util[_0x483d('0x44')]('%s',_['replace'](_0x454ad5,_0x518b10,_[_0x483d('0x49')](_0x40c8bd,_0x2f2414)[_0x483d('0x4a')]()));}exports[_0x483d('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x2e5d4f){if(_0x2e5d4f['originated']&&_0x2e5d4f[_0x483d('0x2c')]>0x0){_0x2e5d4f[_0x483d('0x2c')]-=0x1;}else{logger[_0x483d('0x4c')](_0x483d('0x4d'));}}exports[_0x483d('0x4e')]=decrementOriginate;function checkContactEmpty(_0x232177){return _0x232177&&_0x232177[_0x483d('0x4f')]>0x0;}exports[_0x483d('0x50')]=checkContactEmpty;function erlangb(_0x3dd1db,_0x4910de){if(_0x4910de===0x0){return 0x0;}var _0x5a3515=0x1;for(var _0x389fbb=0x1;_0x389fbb<=_0x4910de;_0x389fbb+=0x1){_0x5a3515=0x1+_0x5a3515*_0x389fbb/_0x3dd1db;}return 0x1/_0x5a3515;}exports[_0x483d('0x51')]=erlangb;function checkContactLowerLimitOriginate(_0x31cbb7,_0x5a1c01,_0x3f3883){if(_0x5a1c01>_0x3f3883){for(var _0x58ef7a=0x0;_0x58ef7a<_0x5a1c01-_0x3f3883;_0x58ef7a+=0x1){decrementOriginate(_0x31cbb7);}}}exports[_0x483d('0x52')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x286d2a){var _0x4ab13f={};var _0x2d8e57=['id','createdAt','tags',_0x483d('0x53')];const _0x53eb41=0xfa;if(_0x286d2a){for(var _0x4b75c4 in _0x286d2a){if(typeof _0x286d2a[_0x4b75c4]!==_0x483d('0x54')){if(!_[_0x483d('0x32')](_0x286d2a[_0x4b75c4])&&!_0x2d8e57['includes'](_0x4b75c4)){if(_0x4b75c4==='description'&&_0x286d2a[_0x4b75c4][_0x483d('0x4f')]>_0x53eb41){_0x4ab13f[_0x483d('0x55')+_0x4b75c4[_0x483d('0x56')]()]=_0x286d2a[_0x4b75c4]['toString']()[_0x483d('0x57')](0x0,_0x53eb41);}else{_0x4ab13f[_0x483d('0x55')+_0x4b75c4[_0x483d('0x56')]()]=_0x286d2a[_0x4b75c4];}}}}}return _0x4ab13f;}exports[_0x483d('0x58')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 0969619..4bc8ea2 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(_0x5e11c6,_0x338cf8){var _0x4734ef=function(_0x14e62a){while(--_0x14e62a){_0x5e11c6['push'](_0x5e11c6['shift']());}};_0x4734ef(++_0x338cf8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x10ebe7,_0x116650){var _0xc03446=function(_0x46527c){while(--_0x46527c){_0x10ebe7['push'](_0x10ebe7['shift']());}};_0xc03446(++_0x116650);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 e4045f1..5e5195f 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 _0xb245=['newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','%s/%s.tif','dir','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState'];(function(_0x5e847c,_0x373db5){var _0x4dd394=function(_0x3118ff){while(--_0x3118ff){_0x5e847c['push'](_0x5e847c['shift']());}};_0x4dd394(++_0x373db5);}(_0xb245,0xc5));var _0x5b24=function(_0x1c6de2,_0x12907b){_0x1c6de2=_0x1c6de2-0x0;var _0x16920e=_0xb245[_0x1c6de2];return _0x16920e;};'use strict';var util=require(_0x5b24('0x0'));var _=require(_0x5b24('0x1'));var BPromise=require(_0x5b24('0x2'));var uuid=require('uuid');var moment=require(_0x5b24('0x3'));var path=require(_0x5b24('0x4'));var tiff2pdf=require(_0x5b24('0x5'));var gs=require('./util/gs');var logger=require(_0x5b24('0x6'))(_0x5b24('0x7'));var ami=require(_0x5b24('0x8'));var rpcDb=require(_0x5b24('0x9'));var Channel=require('./channel');var ut=require(_0x5b24('0xa'));var Action=require(_0x5b24('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x59d07e){this['channels']={};this[_0x5b24('0xc')]=_0x59d07e[_0x5b24('0xc')];this[_0x5b24('0xd')]=_0x59d07e[_0x5b24('0xd')];this[_0x5b24('0xe')]={};ami['on']('newchannel',this[_0x5b24('0xf')][_0x5b24('0x10')](this));ami['on'](_0x5b24('0x11'),this[_0x5b24('0x12')][_0x5b24('0x10')](this));ami['on'](_0x5b24('0x13'),this[_0x5b24('0x14')][_0x5b24('0x10')](this));ami['on'](_0x5b24('0x15'),this[_0x5b24('0x16')][_0x5b24('0x10')](this));ami['on'](_0x5b24('0x17'),this[_0x5b24('0x18')][_0x5b24('0x10')](this));ami['on'](_0x5b24('0x19'),this['syncReceiveFax'][_0x5b24('0x10')](this));ami['on'](_0x5b24('0x1a'),this['syncHangup'][_0x5b24('0x10')](this));ami['on'](_0x5b24('0x1b'),this['syncOriginateResponse'][_0x5b24('0x10')](this));}Fax[_0x5b24('0x1c')]['syncNewchannel']=function(_0x8cbe05){if(_0x8cbe05[_0x5b24('0x1d')]===_0x5b24('0x1e')){for(var _0x6ccdd9 in this[_0x5b24('0xc')]){if(this[_0x5b24('0xc')][_0x5b24('0x1f')](_0x6ccdd9)){if(_0x8cbe05[_0x5b24('0x20')]===this[_0x5b24('0xc')][_0x6ccdd9][_0x5b24('0x21')]){this[_0x5b24('0x22')][_0x8cbe05[_0x5b24('0x23')]]={};this[_0x5b24('0x22')][_0x8cbe05[_0x5b24('0x23')]][_0x5b24('0x24')]=_0x8cbe05['channel'];this['channels'][_0x8cbe05[_0x5b24('0x23')]]['id']=this[_0x5b24('0xc')][_0x6ccdd9]['id'];this[_0x5b24('0x22')][_0x8cbe05[_0x5b24('0x23')]]['name']=this['faxAccounts'][_0x6ccdd9][_0x5b24('0x25')];logger[_0x5b24('0x26')](_0x8cbe05[_0x5b24('0x23')],_0x5b24('0x27'));}}}}if(this[_0x5b24('0xe')][_0x8cbe05['uniqueid']]){this[_0x5b24('0x22')][_0x8cbe05['uniqueid']]={};this[_0x5b24('0x22')][_0x8cbe05[_0x5b24('0x23')]]['channel']=_0x8cbe05[_0x5b24('0x24')];logger[_0x5b24('0x26')](_0x8cbe05[_0x5b24('0x23')],'\x20syncNewchannel\x20');}};Fax[_0x5b24('0x1c')][_0x5b24('0x12')]=function(_0x1fb2e1){if(this[_0x5b24('0x22')][_0x1fb2e1[_0x5b24('0x23')]]){for(var _0x166c97 in _0x1fb2e1[_0x5b24('0x28')]){if(_0x1fb2e1['variable'][_0x5b24('0x1f')](_0x166c97)){this['channels'][_0x1fb2e1['uniqueid']][_0x166c97]=_0x1fb2e1[_0x5b24('0x29')];}}}};Fax[_0x5b24('0x1c')][_0x5b24('0x14')]=function(_0x4daef0){if(this['channels'][_0x4daef0['uniqueid']]){this[_0x5b24('0x22')][_0x4daef0[_0x5b24('0x23')]]['channelstate']=_0x4daef0[_0x5b24('0x2a')];this[_0x5b24('0x22')][_0x4daef0['uniqueid']][_0x5b24('0x2b')]=_0x4daef0[_0x5b24('0x2b')];}};Fax['prototype'][_0x5b24('0x16')]=function(_0x350339){if(this['channels'][_0x350339[_0x5b24('0x23')]]){for(var _0x1cc271 in _0x350339['variable']){if(_0x350339['variable'][_0x5b24('0x1f')](_0x1cc271)){this['channels'][_0x350339['uniqueid']][_0x1cc271]=_0x350339[_0x5b24('0x29')];}}}};Fax[_0x5b24('0x1c')][_0x5b24('0x18')]=function(_0x1dfbe0){if(this[_0x5b24('0x22')][_0x1dfbe0[_0x5b24('0x23')]]){this[_0x5b24('0x22')][_0x1dfbe0['uniqueid']][_0x5b24('0x2c')]=_0x1dfbe0[_0x5b24('0x2c')];this['channels'][_0x1dfbe0[_0x5b24('0x23')]][_0x5b24('0x2d')]=_0x1dfbe0[_0x5b24('0x2d')];this['channels'][_0x1dfbe0[_0x5b24('0x23')]][_0x5b24('0x21')]=_0x1dfbe0[_0x5b24('0x21')];this[_0x5b24('0x22')][_0x1dfbe0[_0x5b24('0x23')]]['filename']=_0x1dfbe0['filename'];logger[_0x5b24('0x26')](_0x1dfbe0[_0x5b24('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0x5b24('0x1c')]['syncReceiveFax']=function(_0x2c444b){var _0x2fa66b=this;if(this[_0x5b24('0x22')][_0x2c444b[_0x5b24('0x23')]]){var _0xbdf818=this[_0x5b24('0x22')][_0x2c444b[_0x5b24('0x23')]]['id'];this[_0x5b24('0x22')][_0x2c444b[_0x5b24('0x23')]][_0x5b24('0x2e')]=_0x2c444b['remotestationid'];this[_0x5b24('0x22')][_0x2c444b['uniqueid']][_0x5b24('0x2f')]=_0x2c444b[_0x5b24('0x2f')];this[_0x5b24('0x22')][_0x2c444b[_0x5b24('0x23')]][_0x5b24('0x21')]=_0x2c444b[_0x5b24('0x21')];this['channels'][_0x2c444b[_0x5b24('0x23')]][_0x5b24('0x30')]=_0x2c444b['resolution'];this[_0x5b24('0x22')][_0x2c444b[_0x5b24('0x23')]][_0x5b24('0x31')]=_0x2c444b[_0x5b24('0x31')];this[_0x5b24('0x22')][_0x2c444b[_0x5b24('0x23')]][_0x5b24('0x32')]=_0x2c444b[_0x5b24('0x32')];this['channels'][_0x2c444b[_0x5b24('0x23')]][_0x5b24('0x33')]=_0x2c444b[_0x5b24('0x33')];if(this[_0x5b24('0x22')][_0x2c444b[_0x5b24('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x2c444b[_0x5b24('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x2c7546){logger[_0x5b24('0x26')](_0x2c444b[_0x5b24('0x23')],_0x5b24('0x34'),_0x2c7546[_0x5b24('0x35')]);attachment[_0x5b24('0x36')]({'name':path[_0x5b24('0x37')](_0x2c444b['filename'])[_0x5b24('0x25')],'basename':path['parse'](_0x2c444b[_0x5b24('0x32')])[_0x5b24('0x25')]+_0x5b24('0x38'),'type':_0x5b24('0x39')})[_0x5b24('0x3a')](function(_0x3c86c1){faxAccount['notify'](_0xbdf818,{'from':_0x2c444b[_0x5b24('0x33')],'mapKey':_0x5b24('0x7'),'body':path[_0x5b24('0x37')](_0x2c444b[_0x5b24('0x32')])[_0x5b24('0x25')]+_0x5b24('0x38'),'AttachmentId':_0x3c86c1['id']})['catch'](function(_0x1e8d2e){logger['error'](_0x2c444b[_0x5b24('0x23')],_0x5b24('0x3b'),JSON[_0x5b24('0x3c')](_0x1e8d2e));});})[_0x5b24('0x3d')](function(_0x18bfb7){logger['error'](_0x2c444b[_0x5b24('0x23')],_0x5b24('0x3e'),JSON[_0x5b24('0x3c')](_0x18bfb7));});});}logger[_0x5b24('0x26')](_0x2c444b[_0x5b24('0x23')],_0x5b24('0x3e'));}};Fax[_0x5b24('0x1c')]['syncOriginateResponse']=function(_0x2e54fd){if(this[_0x5b24('0xe')][_0x2e54fd[_0x5b24('0x23')]]){_[_0x5b24('0x3f')](this[_0x5b24('0x22')][_0x2e54fd[_0x5b24('0x23')]],_['pick'](_0x2e54fd,['response','reason']));}};function updateStatus(_0x1045b8){if(_0x1045b8[_0x5b24('0x40')]){faxMessage[_0x5b24('0x41')](_0x1045b8[_0x5b24('0x40')],{'failMessage':_0x5b24('0x42')})[_0x5b24('0x3a')](function(_0x2c3635){ut[_0x5b24('0x43')]('[Fax][Message][Error][Updated]',_0x2c3635);})[_0x5b24('0x3d')](function(_0x458aa4){ut[_0x5b24('0x43')](_0x5b24('0x44'),_0x458aa4);});}else{ut[_0x5b24('0x43')](_0x5b24('0x45'));}}Fax[_0x5b24('0x1c')][_0x5b24('0x46')]=function(_0x7fa341,_0x4e045c,_0x5c3298){var _0x4ce53b=this;var _0x7f499b={};if(_0x4e045c){_0x7f499b={'read':_0x4e045c};}else{_0x7f499b={'failMessage':_0x5c3298};}if(this['actions'][_0x7fa341][_0x5b24('0x40')]){faxMessage[_0x5b24('0x41')](this[_0x5b24('0xe')][_0x7fa341][_0x5b24('0x40')],_0x7f499b)[_0x5b24('0x3a')](function(_0x2d3711){ut[_0x5b24('0x43')](_0x5b24('0x47'),_0x2d3711);})[_0x5b24('0x3d')](function(_0x3541ae){ut[_0x5b24('0x43')](_0x5b24('0x48'),_0x3541ae);})['finally'](function(){delete _0x4ce53b[_0x5b24('0x22')][_0x7fa341];delete _0x4ce53b[_0x5b24('0xe')][_0x7fa341];});}else{ut[_0x5b24('0x43')](_0x5b24('0x49'));delete this['channels'][_0x7fa341];delete this[_0x5b24('0xe')][_0x7fa341];}};Fax[_0x5b24('0x1c')][_0x5b24('0x4a')]=function(_0x27298f){var _0x2e3661=this;if(this[_0x5b24('0x22')][_0x27298f[_0x5b24('0x23')]]){if(this[_0x5b24('0xe')][_0x27298f[_0x5b24('0x23')]]){this[_0x5b24('0x22')][_0x27298f[_0x5b24('0x23')]]['id']=this[_0x5b24('0xe')][_0x27298f['uniqueid']]['id'];this[_0x5b24('0x22')][_0x27298f[_0x5b24('0x23')]]['name']=this['actions'][_0x27298f[_0x5b24('0x23')]][_0x5b24('0x25')];}logger[_0x5b24('0x26')](_0x27298f['uniqueid'],this[_0x5b24('0xe')][_0x27298f[_0x5b24('0x23')]]?'\x20hangup\x20sendFile\x20':_0x5b24('0x4b'),JSON[_0x5b24('0x3c')](this[_0x5b24('0x22')][_0x27298f[_0x5b24('0x23')]]));if(this[_0x5b24('0xe')][_0x27298f[_0x5b24('0x23')]]){if(this[_0x5b24('0x22')][_0x27298f[_0x5b24('0x23')]][_0x5b24('0x4c')]>0x0&&this[_0x5b24('0x22')][_0x27298f[_0x5b24('0x23')]][_0x5b24('0x17')]==='SUCCESS'){this[_0x5b24('0x46')](_0x27298f[_0x5b24('0x23')],!![]);}else{this[_0x5b24('0x46')](_0x27298f[_0x5b24('0x23')],![],this[_0x5b24('0x22')][_0x27298f['uniqueid']][_0x5b24('0x4d')]?_0x5b24('0x4e')+this[_0x5b24('0x22')][_0x27298f['uniqueid']][_0x5b24('0x4d')]:_0x5b24('0x4f'));}}}};Fax[_0x5b24('0x1c')][_0x5b24('0x50')]=function(_0xa1c333){var _0xc46242=this;return new BPromise(function(_0x3b2a3d,_0x199484){_0xc46242[_0x5b24('0x51')](_0xa1c333,_0xc46242[_0x5b24('0xc')][_0xa1c333[_0x5b24('0x52')]])[_0x5b24('0x3a')](function(_0x30d7ce){ut[_0x5b24('0x43')]('[Fax][execOriginate][success]',_0x30d7ce);_0x3b2a3d(ut[_0x5b24('0x35')]('Fax\x20received'));})[_0x5b24('0x3d')](function(_0x5cc6bc){ut[_0x5b24('0x43')](_0x5b24('0x53'),_0x5cc6bc);updateStatus(_0xa1c333);_0x199484(ut[_0x5b24('0x35')]('Fax\x20failed'));});});};Fax['prototype'][_0x5b24('0x54')]=function(_0x43cca4){var _0x104555=this;return new BPromise(function(_0x4b4639,_0x54cd20){var _0x7a2e80=_0x104555[_0x5b24('0x55')](_0x104555['faxAccounts'][_0x43cca4['FaxAccountId']]['Trunk'],_0x43cca4);if(_0x7a2e80[_0x5b24('0x56')]){_0x4b4639(ut['message'](_0x5b24('0x57')));}else{_0x54cd20(ut[_0x5b24('0x35')](_0x7a2e80['message']));}});};function originate(_0xe38052,_0x2ca0fc,_0x4cc11d){return new BPromise(function(_0x145740,_0x3d0bac){if(_0x4cc11d){var _0x19a97d=util['format'](_0x5b24('0x58'),path[_0x5b24('0x37')](_0xe38052[_0x5b24('0x4')])['name'],_0xe38052[_0x5b24('0x4')]);gs[_0x5b24('0x59')](_0x19a97d)[_0x5b24('0x3a')](function(){_0xe38052[_0x5b24('0x4')]=util[_0x5b24('0x5a')](_0x5b24('0x5b'),path[_0x5b24('0x37')](_0xe38052[_0x5b24('0x4')])[_0x5b24('0x5c')],path[_0x5b24('0x37')](_0xe38052[_0x5b24('0x4')])[_0x5b24('0x25')]);_0x2ca0fc['XMF-PATH']=_0xe38052[_0x5b24('0x4')];ut['logger']('Convert\x20pdf\x20to\x20tif','');ami[_0x5b24('0x5d')](ut['variablesAction'](_0xe38052,_0x2ca0fc))['then'](function(_0x45d06b){_0x145740(_0x45d06b);})[_0x5b24('0x3d')](function(_0x18c312){_0x3d0bac(_0x18c312);});})['catch'](function(_0x47d174){_0x3d0bac(_0x47d174);});}else{ami[_0x5b24('0x5d')](ut[_0x5b24('0x5e')](_0xe38052,_0x2ca0fc))[_0x5b24('0x3a')](function(_0x594f64){_0x145740(_0x594f64);})[_0x5b24('0x3d')](function(_0xb12715){_0x3d0bac(_0xb12715);});}});}Fax[_0x5b24('0x1c')][_0x5b24('0x51')]=function(_0x2372b3,_0x137189){var _0x4c359b=this;return new BPromise(function(_0x25167a,_0x3800c5){var _0x263b0e=uuid['v4']();var _0x2faedb=ut[_0x5b24('0x5f')](_0x2372b3,_0x137189);_0x4c359b[_0x5b24('0xe')][_0x263b0e]=new Action(_0x263b0e,_0x137189,_0x2372b3);var _0x3ab65e=_0x4c359b[_0x5b24('0xe')][_0x263b0e];if(path[_0x5b24('0x37')](_0x2372b3[_0x5b24('0x4')])['ext']===_0x5b24('0x38')){originate(_0x3ab65e,_0x2faedb,!![])[_0x5b24('0x3a')](function(_0x27d68c){_0x25167a(_0x27d68c);})[_0x5b24('0x3d')](function(_0x12221a){_0x3800c5(_0x12221a);});}else{originate(_0x3ab65e,_0x2faedb,![])[_0x5b24('0x3a')](function(_0x184a40){_0x25167a(_0x184a40);})[_0x5b24('0x3d')](function(_0x480656){_0x3800c5(_0x480656);});}});};Fax[_0x5b24('0x1c')][_0x5b24('0x60')]=function(_0xbe0f86){return!_['isNil'](_0xbe0f86)&&!_[_0x5b24('0x61')](_0xbe0f86[_0x5b24('0x25')])&&!_[_0x5b24('0x61')](_0xbe0f86['active'])&&_0xbe0f86[_0x5b24('0x62')]&&!_[_0x5b24('0x61')](this[_0x5b24('0xd')][util['format'](_0x5b24('0x63'),_0xbe0f86[_0x5b24('0x25')])])&&!_['isNil'](this[_0x5b24('0xd')][util['format'](_0x5b24('0x63'),_0xbe0f86[_0x5b24('0x25')])][_0x5b24('0x2d')])&&(this[_0x5b24('0xd')][util[_0x5b24('0x5a')](_0x5b24('0x63'),_0xbe0f86['name'])][_0x5b24('0x2d')]===_0x5b24('0x64')||this[_0x5b24('0xd')][util[_0x5b24('0x5a')](_0x5b24('0x63'),_0xbe0f86[_0x5b24('0x25')])]['status']===_0x5b24('0x65'));};Fax[_0x5b24('0x1c')][_0x5b24('0x55')]=function(_0x555e1a,_0x2a80b5){if(!this[_0x5b24('0x60')](_0x555e1a)){ut[_0x5b24('0x43')](_0x5b24('0x66'),_[_0x5b24('0x61')](_0x555e1a)?'':_0x555e1a[_0x5b24('0x25')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x5b24('0x67')};}if(_[_0x5b24('0x61')](_0x2a80b5[_0x5b24('0x7')])){ut[_0x5b24('0x43')](_0x5b24('0x68'),JSON[_0x5b24('0x3c')](_0x2a80b5));return{'isValid':![],'message':_0x5b24('0x69')};}if(_['isNil'](_0x2a80b5[_0x5b24('0x4')])){ut['logger'](_0x5b24('0x6a'),JSON[_0x5b24('0x3c')](_0x2a80b5));return{'isValid':![],'message':_0x5b24('0x6b')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x5b24('0x6c')]=Fax; \ No newline at end of file +var _0x83c2=['./util/gs','../../../config/logger','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','faxAccounts','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','hasOwnProperty','channelstate','channelstatedesc','syncNewExten','value','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','application/pdf','notify','fax','.pdf','catch','error','\x20receiveFax\x20','stringify','merge','pick','reason','AttachmentId','update','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Action','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','tiff2pdf'];(function(_0x3d52d4,_0x38d0c5){var _0x4dd6f7=function(_0x6f1851){while(--_0x6f1851){_0x3d52d4['push'](_0x3d52d4['shift']());}};_0x4dd6f7(++_0x38d0c5);}(_0x83c2,0xed));var _0x283c=function(_0x24a88e,_0x22a0b8){_0x24a88e=_0x24a88e-0x0;var _0x232cbb=_0x83c2[_0x24a88e];return _0x232cbb;};'use strict';var util=require(_0x283c('0x0'));var _=require(_0x283c('0x1'));var BPromise=require('bluebird');var uuid=require(_0x283c('0x2'));var moment=require(_0x283c('0x3'));var path=require('path');var tiff2pdf=require(_0x283c('0x4'));var gs=require(_0x283c('0x5'));var logger=require(_0x283c('0x6'))('fax');var ami=require('../ami');var rpcDb=require(_0x283c('0x7'));var Channel=require(_0x283c('0x8'));var ut=require(_0x283c('0x9'));var Action=require(_0x283c('0xa'));var faxAccount=require(_0x283c('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x283c('0xc'));function Fax(_0x15b39c){this[_0x283c('0xd')]={};this['faxAccounts']=_0x15b39c['faxAccounts'];this[_0x283c('0xe')]=_0x15b39c['trunks'];this[_0x283c('0xf')]={};ami['on'](_0x283c('0x10'),this[_0x283c('0x11')][_0x283c('0x12')](this));ami['on'](_0x283c('0x13'),this['syncVarSet'][_0x283c('0x12')](this));ami['on'](_0x283c('0x14'),this[_0x283c('0x15')][_0x283c('0x12')](this));ami['on'](_0x283c('0x16'),this['syncNewExten'][_0x283c('0x12')](this));ami['on'](_0x283c('0x17'),this[_0x283c('0x18')][_0x283c('0x12')](this));ami['on'](_0x283c('0x19'),this['syncReceiveFax'][_0x283c('0x12')](this));ami['on'](_0x283c('0x1a'),this[_0x283c('0x1b')][_0x283c('0x12')](this));ami['on']('originateresponse',this[_0x283c('0x1c')][_0x283c('0x12')](this));}Fax[_0x283c('0x1d')][_0x283c('0x11')]=function(_0x50dc39){if(_0x50dc39[_0x283c('0x1e')]===_0x283c('0x1f')){for(var _0x1d2fdd in this[_0x283c('0x20')]){if(this[_0x283c('0x20')]['hasOwnProperty'](_0x1d2fdd)){if(_0x50dc39[_0x283c('0x21')]===this[_0x283c('0x20')][_0x1d2fdd][_0x283c('0x22')]){this[_0x283c('0xd')][_0x50dc39[_0x283c('0x23')]]={};this['channels'][_0x50dc39[_0x283c('0x23')]][_0x283c('0x24')]=_0x50dc39['channel'];this[_0x283c('0xd')][_0x50dc39[_0x283c('0x23')]]['id']=this['faxAccounts'][_0x1d2fdd]['id'];this['channels'][_0x50dc39['uniqueid']][_0x283c('0x25')]=this['faxAccounts'][_0x1d2fdd][_0x283c('0x25')];logger['info'](_0x50dc39['uniqueid'],_0x283c('0x26'));}}}}if(this[_0x283c('0xf')][_0x50dc39[_0x283c('0x23')]]){this['channels'][_0x50dc39[_0x283c('0x23')]]={};this[_0x283c('0xd')][_0x50dc39[_0x283c('0x23')]][_0x283c('0x24')]=_0x50dc39[_0x283c('0x24')];logger[_0x283c('0x27')](_0x50dc39[_0x283c('0x23')],'\x20syncNewchannel\x20');}};Fax[_0x283c('0x1d')]['syncVarSet']=function(_0x6ea8af){if(this[_0x283c('0xd')][_0x6ea8af['uniqueid']]){for(var _0x4beb82 in _0x6ea8af[_0x283c('0x28')]){if(_0x6ea8af[_0x283c('0x28')][_0x283c('0x29')](_0x4beb82)){this[_0x283c('0xd')][_0x6ea8af['uniqueid']][_0x4beb82]=_0x6ea8af['value'];}}}};Fax[_0x283c('0x1d')]['syncNewState']=function(_0x109805){if(this[_0x283c('0xd')][_0x109805['uniqueid']]){this[_0x283c('0xd')][_0x109805[_0x283c('0x23')]][_0x283c('0x2a')]=_0x109805[_0x283c('0x2a')];this['channels'][_0x109805[_0x283c('0x23')]][_0x283c('0x2b')]=_0x109805['channelstatedesc'];}};Fax[_0x283c('0x1d')][_0x283c('0x2c')]=function(_0xdcb9b7){if(this[_0x283c('0xd')][_0xdcb9b7[_0x283c('0x23')]]){for(var _0x9b1209 in _0xdcb9b7['variable']){if(_0xdcb9b7[_0x283c('0x28')][_0x283c('0x29')](_0x9b1209)){this['channels'][_0xdcb9b7[_0x283c('0x23')]][_0x9b1209]=_0xdcb9b7[_0x283c('0x2d')];}}}};Fax[_0x283c('0x1d')][_0x283c('0x18')]=function(_0x1cc1e6){if(this[_0x283c('0xd')][_0x1cc1e6[_0x283c('0x23')]]){this[_0x283c('0xd')][_0x1cc1e6['uniqueid']]['operation']=_0x1cc1e6[_0x283c('0x2e')];this[_0x283c('0xd')][_0x1cc1e6[_0x283c('0x23')]][_0x283c('0x2f')]=_0x1cc1e6[_0x283c('0x2f')];this[_0x283c('0xd')][_0x1cc1e6[_0x283c('0x23')]][_0x283c('0x22')]=_0x1cc1e6[_0x283c('0x22')];this[_0x283c('0xd')][_0x1cc1e6[_0x283c('0x23')]]['filename']=_0x1cc1e6[_0x283c('0x30')];logger[_0x283c('0x27')](_0x1cc1e6[_0x283c('0x23')],_0x283c('0x31'));}};Fax[_0x283c('0x1d')][_0x283c('0x32')]=function(_0x4a0dfd){var _0x49cbce=this;if(this['channels'][_0x4a0dfd['uniqueid']]){var _0x2f11ba=this['channels'][_0x4a0dfd[_0x283c('0x23')]]['id'];this[_0x283c('0xd')][_0x4a0dfd[_0x283c('0x23')]]['remotestationid']=_0x4a0dfd[_0x283c('0x33')];this[_0x283c('0xd')][_0x4a0dfd['uniqueid']][_0x283c('0x34')]=_0x4a0dfd[_0x283c('0x34')];this['channels'][_0x4a0dfd[_0x283c('0x23')]]['localstationid']=_0x4a0dfd[_0x283c('0x22')];this[_0x283c('0xd')][_0x4a0dfd[_0x283c('0x23')]][_0x283c('0x35')]=_0x4a0dfd[_0x283c('0x35')];this[_0x283c('0xd')][_0x4a0dfd[_0x283c('0x23')]][_0x283c('0x36')]=_0x4a0dfd[_0x283c('0x36')];this[_0x283c('0xd')][_0x4a0dfd[_0x283c('0x23')]][_0x283c('0x30')]=_0x4a0dfd[_0x283c('0x30')];this[_0x283c('0xd')][_0x4a0dfd[_0x283c('0x23')]]['calleridnum']=_0x4a0dfd['calleridnum'];if(this[_0x283c('0xd')][_0x4a0dfd[_0x283c('0x23')]][_0x283c('0x34')]>0x0){tiff2pdf(_0x4a0dfd['filename'],_0x283c('0x37'),function(_0x2d9cb0){logger['info'](_0x4a0dfd[_0x283c('0x23')],_0x283c('0x38'),_0x2d9cb0['message']);attachment[_0x283c('0x39')]({'name':path[_0x283c('0x3a')](_0x4a0dfd[_0x283c('0x30')])[_0x283c('0x25')],'basename':path[_0x283c('0x3a')](_0x4a0dfd['filename'])[_0x283c('0x25')]+'.pdf','type':_0x283c('0x3b')})['then'](function(_0x35595c){faxAccount[_0x283c('0x3c')](_0x2f11ba,{'from':_0x4a0dfd['calleridnum'],'mapKey':_0x283c('0x3d'),'body':path['parse'](_0x4a0dfd[_0x283c('0x30')])[_0x283c('0x25')]+_0x283c('0x3e'),'AttachmentId':_0x35595c['id']})[_0x283c('0x3f')](function(_0x7bd246){logger[_0x283c('0x40')](_0x4a0dfd['uniqueid'],'\x20notify\x20',JSON['stringify'](_0x7bd246));});})[_0x283c('0x3f')](function(_0x346b44){logger[_0x283c('0x40')](_0x4a0dfd[_0x283c('0x23')],_0x283c('0x41'),JSON[_0x283c('0x42')](_0x346b44));});});}logger[_0x283c('0x27')](_0x4a0dfd[_0x283c('0x23')],_0x283c('0x41'));}};Fax['prototype'][_0x283c('0x1c')]=function(_0x50c58d){if(this[_0x283c('0xf')][_0x50c58d[_0x283c('0x23')]]){_[_0x283c('0x43')](this[_0x283c('0xd')][_0x50c58d['uniqueid']],_[_0x283c('0x44')](_0x50c58d,['response',_0x283c('0x45')]));}};function updateStatus(_0x2ac13e){if(_0x2ac13e[_0x283c('0x46')]){faxMessage[_0x283c('0x47')](_0x2ac13e['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x283c('0x48')](function(_0x534b56){ut[_0x283c('0x49')](_0x283c('0x4a'),_0x534b56);})[_0x283c('0x3f')](function(_0x3cbe67){ut[_0x283c('0x49')](_0x283c('0x4b'),_0x3cbe67);});}else{ut[_0x283c('0x49')](_0x283c('0x4c'));}}Fax[_0x283c('0x1d')][_0x283c('0x4d')]=function(_0x1d249a,_0x964783,_0x4af21b){var _0x5c3ca1=this;var _0x303d9d={};if(_0x964783){_0x303d9d={'read':_0x964783};}else{_0x303d9d={'failMessage':_0x4af21b};}if(this[_0x283c('0xf')][_0x1d249a][_0x283c('0x46')]){faxMessage['update'](this[_0x283c('0xf')][_0x1d249a][_0x283c('0x46')],_0x303d9d)[_0x283c('0x48')](function(_0x1f5413){ut['logger'](_0x283c('0x4e'),_0x1f5413);})[_0x283c('0x3f')](function(_0x25ff3b){ut[_0x283c('0x49')]('[Fax][Message][NoUpdate1]',_0x25ff3b);})['finally'](function(){delete _0x5c3ca1[_0x283c('0xd')][_0x1d249a];delete _0x5c3ca1['actions'][_0x1d249a];});}else{ut[_0x283c('0x49')](_0x283c('0x4f'));delete this[_0x283c('0xd')][_0x1d249a];delete this[_0x283c('0xf')][_0x1d249a];}};Fax['prototype'][_0x283c('0x1b')]=function(_0x5eb7db){var _0x5a4e42=this;if(this['channels'][_0x5eb7db[_0x283c('0x23')]]){if(this[_0x283c('0xf')][_0x5eb7db[_0x283c('0x23')]]){this['channels'][_0x5eb7db['uniqueid']]['id']=this[_0x283c('0xf')][_0x5eb7db[_0x283c('0x23')]]['id'];this['channels'][_0x5eb7db[_0x283c('0x23')]][_0x283c('0x25')]=this[_0x283c('0xf')][_0x5eb7db[_0x283c('0x23')]][_0x283c('0x25')];}logger['info'](_0x5eb7db['uniqueid'],this['actions'][_0x5eb7db['uniqueid']]?_0x283c('0x50'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0x283c('0xd')][_0x5eb7db[_0x283c('0x23')]]));if(this[_0x283c('0xf')][_0x5eb7db[_0x283c('0x23')]]){if(this[_0x283c('0xd')][_0x5eb7db['uniqueid']]['faxpages']>0x0&&this[_0x283c('0xd')][_0x5eb7db['uniqueid']][_0x283c('0x17')]===_0x283c('0x51')){this[_0x283c('0x4d')](_0x5eb7db[_0x283c('0x23')],!![]);}else{this[_0x283c('0x4d')](_0x5eb7db[_0x283c('0x23')],![],this[_0x283c('0xd')][_0x5eb7db[_0x283c('0x23')]][_0x283c('0x52')]?_0x283c('0x53')+this['channels'][_0x5eb7db[_0x283c('0x23')]]['faxstatusstring']:_0x283c('0x54'));}}}};Fax[_0x283c('0x1d')]['send']=function(_0x5b5413){var _0x23d1d9=this;return new BPromise(function(_0x5c4898,_0xf1107a){_0x23d1d9[_0x283c('0x55')](_0x5b5413,_0x23d1d9[_0x283c('0x20')][_0x5b5413[_0x283c('0x56')]])[_0x283c('0x48')](function(_0x445631){ut[_0x283c('0x49')](_0x283c('0x57'),_0x445631);_0x5c4898(ut[_0x283c('0x58')](_0x283c('0x59')));})['catch'](function(_0x25a3fc){ut[_0x283c('0x49')]('[Fax][execOriginate][failure]',_0x25a3fc);updateStatus(_0x5b5413);_0xf1107a(ut[_0x283c('0x58')](_0x283c('0x5a')));});});};Fax[_0x283c('0x1d')][_0x283c('0x5b')]=function(_0x54662c){var _0x2f4a65=this;return new BPromise(function(_0x2ea8ed,_0x3d11fb){var _0x3d9d8c=_0x2f4a65[_0x283c('0x5c')](_0x2f4a65['faxAccounts'][_0x54662c[_0x283c('0x56')]][_0x283c('0x5d')],_0x54662c);if(_0x3d9d8c[_0x283c('0x5e')]){_0x2ea8ed(ut[_0x283c('0x58')](_0x283c('0x5f')));}else{_0x3d11fb(ut[_0x283c('0x58')](_0x3d9d8c[_0x283c('0x58')]));}});};function originate(_0x2269e3,_0x484ea5,_0x177b51){return new BPromise(function(_0x3bf66b,_0x112f50){if(_0x177b51){var _0x284df7=util[_0x283c('0x60')](_0x283c('0x61'),path[_0x283c('0x3a')](_0x2269e3[_0x283c('0x62')])[_0x283c('0x25')],_0x2269e3[_0x283c('0x62')]);gs[_0x283c('0x63')](_0x284df7)[_0x283c('0x48')](function(){_0x2269e3[_0x283c('0x62')]=util[_0x283c('0x60')](_0x283c('0x64'),path['parse'](_0x2269e3['path'])[_0x283c('0x65')],path[_0x283c('0x3a')](_0x2269e3['path'])[_0x283c('0x25')]);_0x484ea5[_0x283c('0x66')]=_0x2269e3[_0x283c('0x62')];ut[_0x283c('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0x283c('0x67')](ut['variablesAction'](_0x2269e3,_0x484ea5))[_0x283c('0x48')](function(_0x29bfd7){_0x3bf66b(_0x29bfd7);})[_0x283c('0x3f')](function(_0x2e6135){_0x112f50(_0x2e6135);});})[_0x283c('0x3f')](function(_0x18c19a){_0x112f50(_0x18c19a);});}else{ami['Action'](ut['variablesAction'](_0x2269e3,_0x484ea5))['then'](function(_0x228680){_0x3bf66b(_0x228680);})[_0x283c('0x3f')](function(_0x2ef628){_0x112f50(_0x2ef628);});}});}Fax[_0x283c('0x1d')][_0x283c('0x55')]=function(_0x118289,_0x2524bb){var _0x1edba4=this;return new BPromise(function(_0x5eda81,_0x5d7250){var _0x4f4c93=uuid['v4']();var _0x4f5dd6=ut[_0x283c('0x68')](_0x118289,_0x2524bb);_0x1edba4[_0x283c('0xf')][_0x4f4c93]=new Action(_0x4f4c93,_0x2524bb,_0x118289);var _0x124b31=_0x1edba4['actions'][_0x4f4c93];if(path['parse'](_0x118289[_0x283c('0x62')])[_0x283c('0x69')]===_0x283c('0x3e')){originate(_0x124b31,_0x4f5dd6,!![])[_0x283c('0x48')](function(_0xe40a81){_0x5eda81(_0xe40a81);})[_0x283c('0x3f')](function(_0x1e4616){_0x5d7250(_0x1e4616);});}else{originate(_0x124b31,_0x4f5dd6,![])[_0x283c('0x48')](function(_0x195430){_0x5eda81(_0x195430);})[_0x283c('0x3f')](function(_0x267fbe){_0x5d7250(_0x267fbe);});}});};Fax['prototype']['isTrunkReachable']=function(_0x12a21a){return!_[_0x283c('0x6a')](_0x12a21a)&&!_[_0x283c('0x6a')](_0x12a21a[_0x283c('0x25')])&&!_[_0x283c('0x6a')](_0x12a21a[_0x283c('0x6b')])&&_0x12a21a[_0x283c('0x6b')]&&!_['isNil'](this[_0x283c('0xe')][util['format']('SIP/%s',_0x12a21a['name'])])&&!_[_0x283c('0x6a')](this[_0x283c('0xe')][util[_0x283c('0x60')](_0x283c('0x6c'),_0x12a21a['name'])][_0x283c('0x2f')])&&(this[_0x283c('0xe')][util[_0x283c('0x60')](_0x283c('0x6c'),_0x12a21a[_0x283c('0x25')])][_0x283c('0x2f')]===_0x283c('0x6d')||this[_0x283c('0xe')][util[_0x283c('0x60')](_0x283c('0x6c'),_0x12a21a[_0x283c('0x25')])][_0x283c('0x2f')]===_0x283c('0x6e'));};Fax['prototype'][_0x283c('0x5c')]=function(_0x3a1c24,_0x50a4c6){if(!this[_0x283c('0x6f')](_0x3a1c24)){ut[_0x283c('0x49')](_0x283c('0x70'),_[_0x283c('0x6a')](_0x3a1c24)?'':_0x3a1c24['name']+_0x283c('0x71'));return{'isValid':![],'message':_0x283c('0x72')};}if(_[_0x283c('0x6a')](_0x50a4c6['fax'])){ut['logger'](_0x283c('0x73'),JSON[_0x283c('0x42')](_0x50a4c6));return{'isValid':![],'message':_0x283c('0x74')};}if(_[_0x283c('0x6a')](_0x50a4c6[_0x283c('0x62')])){ut['logger'](_0x283c('0x75'),JSON[_0x283c('0x42')](_0x50a4c6));return{'isValid':![],'message':_0x283c('0x76')};}return{'isValid':!![],'message':_0x283c('0x77')};};module[_0x283c('0x78')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index bf4a2ad..6495712 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 _0xd0c9=['bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','notify','resolve','then'];(function(_0x43de9c,_0x4f125f){var _0x385881=function(_0xfe0ed){while(--_0xfe0ed){_0x43de9c['push'](_0x43de9c['shift']());}};_0x385881(++_0x4f125f);}(_0xd0c9,0x1f0));var _0x9d0c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd0c9[_0x122ef9];return _0x42fba0;};'use strict';var util=require('util');var BPromise=require(_0x9d0c('0x0'));var logger=require(_0x9d0c('0x1'))(_0x9d0c('0x2'));var _=require(_0x9d0c('0x3'));var faxAccount=require(_0x9d0c('0x4'));function loggerCatch(_0x5ae494){return function(_0x4acaaf){logger['error'](_0x5ae494,util['inspect'](_0x4acaaf,{'showHidden':![],'depth':null}));};}exports[_0x9d0c('0x5')]=function(_0x4a47df,_0x49183f){return BPromise[_0x9d0c('0x6')]()[_0x9d0c('0x7')](faxAccount[_0x9d0c('0x5')](_0x4a47df,_0x49183f))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x782f=['error','inspect','notify','resolve','catch','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x3b8a8e,_0x269ce6){var _0x3051e2=function(_0x47151a){while(--_0x47151a){_0x3b8a8e['push'](_0x3b8a8e['shift']());}};_0x3051e2(++_0x269ce6);}(_0x782f,0x7e));var _0xf782=function(_0x141219,_0x468261){_0x141219=_0x141219-0x0;var _0x16a953=_0x782f[_0x141219];return _0x16a953;};'use strict';var util=require(_0xf782('0x0'));var BPromise=require(_0xf782('0x1'));var logger=require(_0xf782('0x2'))(_0xf782('0x3'));var _=require(_0xf782('0x4'));var faxAccount=require(_0xf782('0x5'));function loggerCatch(_0x4516e2){return function(_0x1318b9){logger[_0xf782('0x6')](_0x4516e2,util[_0xf782('0x7')](_0x1318b9,{'showHidden':![],'depth':null}));};}exports[_0xf782('0x8')]=function(_0x13e290,_0x84a8e3){return BPromise[_0xf782('0x9')]()['then'](faxAccount[_0xf782('0x8')](_0x13e290,_0x84a8e3))[_0xf782('0xa')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 8fea618..6124de8 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 _0xe6fb=['exec','execute','info','Exec\x20gs','inspect','util','../../../../config/logger','fax','bluebird','child_process'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe6fb,0xeb));var _0xbe6f=function(_0x3ad2e5,_0x94d414){_0x3ad2e5=_0x3ad2e5-0x0;var _0xc4e565=_0xe6fb[_0x3ad2e5];return _0xc4e565;};'use strict';var util=require(_0xbe6f('0x0'));var logger=require(_0xbe6f('0x1'))(_0xbe6f('0x2'));var BPromise=require(_0xbe6f('0x3'));var exec=require(_0xbe6f('0x4'))[_0xbe6f('0x5')];exports[_0xbe6f('0x6')]=function(_0x2e620c){return new BPromise(function(_0x3a6989,_0x2d8fc1){exec(_0x2e620c,function(_0x19b575,_0x2b27,_0x46d706){logger[_0xbe6f('0x7')](_0xbe6f('0x8'),_0x2b27);if(_0x19b575){logger[_0xbe6f('0x7')](_0xbe6f('0x8'),'\x20Error\x20:',util[_0xbe6f('0x9')](_0x19b575,{'showHidden':![],'depth':null}),_0x2b27,_0x46d706);_0x2d8fc1(_0x19b575);}_0x3a6989(_0x2b27);});});}; \ No newline at end of file +var _0x3704=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','exec','execute'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x3704,0x1bd));var _0x4370=function(_0x469779,_0x219e01){_0x469779=_0x469779-0x0;var _0x4a61f4=_0x3704[_0x469779];return _0x4a61f4;};'use strict';var util=require(_0x4370('0x0'));var logger=require(_0x4370('0x1'))(_0x4370('0x2'));var BPromise=require('bluebird');var exec=require('child_process')[_0x4370('0x3')];exports[_0x4370('0x4')]=function(_0x4110e0){return new BPromise(function(_0xcd8317,_0xabced1){exec(_0x4110e0,function(_0x10e9a7,_0x4847ee,_0x51d24a){logger[_0x4370('0x5')](_0x4370('0x6'),_0x4847ee);if(_0x10e9a7){logger['info'](_0x4370('0x6'),_0x4370('0x7'),util[_0x4370('0x8')](_0x10e9a7,{'showHidden':![],'depth':null}),_0x4847ee,_0x51d24a);_0xabced1(_0x10e9a7);}_0xcd8317(_0x4847ee);});});}; \ 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 40136e3..d185be2 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 _0xdecb=['uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','fax','message','inspect','addVariables','ecm','minrate','format','\x22%s\x22','gateway','faxdetect','localstationid','variablesAction'];(function(_0x44029c,_0x426690){var _0x547fa1=function(_0x37b1f9){while(--_0x37b1f9){_0x44029c['push'](_0x44029c['shift']());}};_0x547fa1(++_0x426690);}(_0xdecb,0xed));var _0xbdec=function(_0x434438,_0x2905b5){_0x434438=_0x434438-0x0;var _0x19a1fc=_0xdecb[_0x434438];return _0x19a1fc;};'use strict';var util=require(_0xbdec('0x0'));var _=require(_0xbdec('0x1'));var moment=require(_0xbdec('0x2'));var logger=require(_0xbdec('0x3'))(_0xbdec('0x4'));exports[_0xbdec('0x5')]=function(_0x54ee3c){return{'message':_0x54ee3c};};exports['logger']=function(_0x196f73,_0x5d28fc){logger['info'](_0x196f73,util[_0xbdec('0x6')](_0x5d28fc,{'showHidden':![],'depth':null}));};exports[_0xbdec('0x7')]=function(_0x5f19db,_0xfbf1d0){var _0x2b02c9={'XMF-ECM':_0xfbf1d0[_0xbdec('0x8')],'XMF-HEADERINFO':_0xfbf1d0['headerinfo'],'XMF-MINRATE':_0xfbf1d0[_0xbdec('0x9')],'XMF-MAXRATE':_0xfbf1d0['maxrate'],'XMF-MODEM':util[_0xbdec('0xa')](_0xbdec('0xb'),_0xfbf1d0['modem']),'XMF-GATEWAY':_0xfbf1d0[_0xbdec('0xc')],'XMF-FAXDETECT':_0xfbf1d0[_0xbdec('0xd')],'XMF-T38TIMEOUT':_0xfbf1d0['t38timeout'],'XMF-LOCALSTATIONID':_0xfbf1d0[_0xbdec('0xe')],'XMF-PATH':_0x5f19db['path']};return _0x2b02c9;};exports[_0xbdec('0xf')]=function(_0x2933f3,_0x1d0390){return{'actionid':_0x2933f3[_0xbdec('0x10')],'action':_0xbdec('0x11'),'channel':_0x2933f3[_0xbdec('0x12')],'Exten':_0xbdec('0x13'),'Context':_0xbdec('0x14'),'Priority':'1','callerid':util['format'](_0xbdec('0x15'),_0x2933f3['headerinfo']?_0x2933f3[_0xbdec('0x16')]:'',_0x2933f3[_0xbdec('0xe')]),'variable':_0x1d0390,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2933f3['uniqueid']};}; \ No newline at end of file +var _0xc09a=['format','util','lodash','moment','fax','message','logger','info','ecm','headerinfo','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax'];(function(_0x9943fd,_0x1037ed){var _0x5bc053=function(_0x3c77b2){while(--_0x3c77b2){_0x9943fd['push'](_0x9943fd['shift']());}};_0x5bc053(++_0x1037ed);}(_0xc09a,0xdd));var _0xac09=function(_0x399a5e,_0x426331){_0x399a5e=_0x399a5e-0x0;var _0x575fdd=_0xc09a[_0x399a5e];return _0x575fdd;};'use strict';var util=require(_0xac09('0x0'));var _=require(_0xac09('0x1'));var moment=require(_0xac09('0x2'));var logger=require('../../../../config/logger')(_0xac09('0x3'));exports[_0xac09('0x4')]=function(_0x155775){return{'message':_0x155775};};exports[_0xac09('0x5')]=function(_0x341089,_0x250194){logger[_0xac09('0x6')](_0x341089,util['inspect'](_0x250194,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x450014,_0x316b0d){var _0x2bb3cb={'XMF-ECM':_0x316b0d[_0xac09('0x7')],'XMF-HEADERINFO':_0x316b0d[_0xac09('0x8')],'XMF-MINRATE':_0x316b0d['minrate'],'XMF-MAXRATE':_0x316b0d[_0xac09('0x9')],'XMF-MODEM':util['format'](_0xac09('0xa'),_0x316b0d[_0xac09('0xb')]),'XMF-GATEWAY':_0x316b0d[_0xac09('0xc')],'XMF-FAXDETECT':_0x316b0d[_0xac09('0xd')],'XMF-T38TIMEOUT':_0x316b0d[_0xac09('0xe')],'XMF-LOCALSTATIONID':_0x316b0d[_0xac09('0xf')],'XMF-PATH':_0x450014['path']};return _0x2bb3cb;};exports[_0xac09('0x10')]=function(_0x162448,_0xfd2d30){return{'actionid':_0x162448[_0xac09('0x11')],'action':_0xac09('0x12'),'channel':_0x162448[_0xac09('0x13')],'Exten':_0xac09('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0xac09('0x15')]('\x22%s\x22\x20<%s>',_0x162448[_0xac09('0x8')]?_0x162448[_0xac09('0x8')]:'',_0x162448[_0xac09('0xf')]),'variable':_0xfd2d30,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x162448['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 2961823..7860dfc 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 _0xb450=['inspect','listen','sync','catch','[index.js][main]','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','getAgents','initAgents','then','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getCampaignHopperHistory','getVoiceCallReports','error','[index.js][initParams]'];(function(_0x4bc322,_0x10e9a9){var _0x234a77=function(_0xc9c998){while(--_0xc9c998){_0x4bc322['push'](_0x4bc322['shift']());}};_0x234a77(++_0x10e9a9);}(_0xb450,0x14f));var _0x0b45=function(_0x2bcd32,_0x225451){_0x2bcd32=_0x2bcd32-0x0;var _0x26b77d=_0xb450[_0x2bcd32];return _0x26b77d;};'use strict';var util=require('util');var moment=require(_0x0b45('0x0'));var server=require(_0x0b45('0x1'));var Realtime=require(_0x0b45('0x2'));var Report=require(_0x0b45('0x3'));var Acw=require(_0x0b45('0x4'));var Trigger=require(_0x0b45('0x5'));var Dialer=require(_0x0b45('0x6'));var Preview=require('./preview');var Fax=require(_0x0b45('0x7'));var user=require(_0x0b45('0x8'));var voiceQueue=require(_0x0b45('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x0b45('0xa'));var trunk=require(_0x0b45('0xb'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x0b45('0xc'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x0b45('0xd'));var salesforce=require(_0x0b45('0xe'));var sugarcrm=require(_0x0b45('0xf'));var freshdesk=require(_0x0b45('0x10'));var desk=require(_0x0b45('0x11'));var zoho=require(_0x0b45('0x12'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x0b45('0x13'));var dynamics365=require(_0x0b45('0x14'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x0b45('0x15'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0b45('0x16')](_0x0b45('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0b45('0x16')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x0b45('0x18')]()['then'](user[_0x0b45('0x19')]())['then'](realtime[_0x0b45('0x1a')]())[_0x0b45('0x1b')](user['getTelephones']())[_0x0b45('0x1b')](realtime[_0x0b45('0x1c')]())[_0x0b45('0x1b')](trunk[_0x0b45('0x1d')]())['then'](realtime[_0x0b45('0x1e')]())['then'](voiceQueue[_0x0b45('0x1f')]())[_0x0b45('0x1b')](realtime[_0x0b45('0x20')]())[_0x0b45('0x1b')](trigger[_0x0b45('0x21')]())[_0x0b45('0x1b')](realtime[_0x0b45('0x22')]())['then'](template[_0x0b45('0x23')]())['then'](realtime[_0x0b45('0x24')]())['then'](zendesk[_0x0b45('0x25')]())['then'](realtime['initZendeskAccounts']())[_0x0b45('0x1b')](salesforce['getSalesforceAccounts']())['then'](realtime['initSalesforceAccounts']())[_0x0b45('0x1b')](sugarcrm[_0x0b45('0x26')]())['then'](realtime[_0x0b45('0x27')]())[_0x0b45('0x1b')](freshdesk[_0x0b45('0x28')]())[_0x0b45('0x1b')](realtime[_0x0b45('0x29')]())[_0x0b45('0x1b')](desk['getDeskAccounts']())[_0x0b45('0x1b')](realtime[_0x0b45('0x2a')]())[_0x0b45('0x1b')](zoho[_0x0b45('0x2b')]())[_0x0b45('0x1b')](realtime[_0x0b45('0x2c')]())[_0x0b45('0x1b')](vtiger['getVtigerAccounts']())[_0x0b45('0x1b')](realtime[_0x0b45('0x2d')]())[_0x0b45('0x1b')](freshsales[_0x0b45('0x2e')]())[_0x0b45('0x1b')](realtime[_0x0b45('0x2f')]())[_0x0b45('0x1b')](servicenow[_0x0b45('0x30')]())[_0x0b45('0x1b')](realtime[_0x0b45('0x31')]())[_0x0b45('0x1b')](dynamics365[_0x0b45('0x32')]())[_0x0b45('0x1b')](realtime['initDynamics365Accounts']())['then'](campaign['getCampaigns']())[_0x0b45('0x1b')](realtime[_0x0b45('0x33')]())[_0x0b45('0x1b')](voiceExtension[_0x0b45('0x34')]())['then'](realtime[_0x0b45('0x35')]())['then'](faxAccount[_0x0b45('0x36')]())[_0x0b45('0x1b')](realtime[_0x0b45('0x37')]())[_0x0b45('0x1b')](function(){return realtime;});}function initParams(){return Promise[_0x0b45('0x18')]()[_0x0b45('0x1b')](voiceQueueReport[_0x0b45('0x38')]())['then'](realtime['initVoiceQueueReports']())[_0x0b45('0x1b')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x0b45('0x1b')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x0b45('0x39')]())[_0x0b45('0x1b')](realtime['initCampaignHopperHistory']())[_0x0b45('0x1b')](voiceCallReport[_0x0b45('0x3a')]())[_0x0b45('0x1b')](realtime['initVoiceCallReports']())['catch'](function(_0x2e85c9){logger[_0x0b45('0x3b')](_0x0b45('0x3c'),util[_0x0b45('0x3d')](_0x2e85c9,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0b45('0x3e')](realtime,preview,fax)[_0x0b45('0x1b')](function(){return initRealtime();})[_0x0b45('0x1b')](function(){return initParams();})[_0x0b45('0x1b')](function(){report[_0x0b45('0x3f')]();setInterval(initRealtime,0x1388);})[_0x0b45('0x40')](function(_0x28083c){logger['error'](_0x0b45('0x41'),util[_0x0b45('0x3d')](_0x28083c,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x9fb0=['initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','[index.js][initParams]','inspect','listen','sync','catch','[index.js][main]','util','moment','./server','./realtime','./acw','./trigger','./fax','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','get','hour','then','initAgents','getTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates'];(function(_0x44416b,_0x44ce18){var _0x132fe3=function(_0x41edf9){while(--_0x41edf9){_0x44416b['push'](_0x44416b['shift']());}};_0x132fe3(++_0x44ce18);}(_0x9fb0,0x123));var _0x09fb=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0x9fb0[_0x1d558c];return _0x15767d;};'use strict';var util=require(_0x09fb('0x0'));var moment=require(_0x09fb('0x1'));var server=require(_0x09fb('0x2'));var Realtime=require(_0x09fb('0x3'));var Report=require('./report');var Acw=require(_0x09fb('0x4'));var Trigger=require(_0x09fb('0x5'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x09fb('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0x09fb('0x7'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x09fb('0x8'));var trunk=require(_0x09fb('0x9'));var trigger=require(_0x09fb('0xa'));var template=require('./rpc/template');var cmHopperHistory=require(_0x09fb('0xb'));var campaign=require(_0x09fb('0xc'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x09fb('0xd'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x09fb('0xe'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x09fb('0xf'));var desk=require(_0x09fb('0x10'));var zoho=require(_0x09fb('0x11'));var vtiger=require(_0x09fb('0x12'));var freshsales=require(_0x09fb('0x13'));var servicenow=require(_0x09fb('0x14'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x09fb('0x15'))(_0x09fb('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x09fb('0x17')](_0x09fb('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x09fb('0x17')](_0x09fb('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x09fb('0x19')](user['getAgents']())[_0x09fb('0x19')](realtime[_0x09fb('0x1a')]())[_0x09fb('0x19')](user[_0x09fb('0x1b')]())['then'](realtime['initTelephones']())[_0x09fb('0x19')](trunk[_0x09fb('0x1c')]())[_0x09fb('0x19')](realtime['initTrunks']())[_0x09fb('0x19')](voiceQueue[_0x09fb('0x1d')]())[_0x09fb('0x19')](realtime[_0x09fb('0x1e')]())[_0x09fb('0x19')](trigger[_0x09fb('0x1f')]())[_0x09fb('0x19')](realtime[_0x09fb('0x20')]())[_0x09fb('0x19')](template[_0x09fb('0x21')]())[_0x09fb('0x19')](realtime[_0x09fb('0x22')]())[_0x09fb('0x19')](zendesk[_0x09fb('0x23')]())[_0x09fb('0x19')](realtime[_0x09fb('0x24')]())[_0x09fb('0x19')](salesforce[_0x09fb('0x25')]())[_0x09fb('0x19')](realtime[_0x09fb('0x26')]())[_0x09fb('0x19')](sugarcrm['getSugarcrmAccounts']())[_0x09fb('0x19')](realtime['initSugarcrmAccounts']())[_0x09fb('0x19')](freshdesk[_0x09fb('0x27')]())[_0x09fb('0x19')](realtime[_0x09fb('0x28')]())[_0x09fb('0x19')](desk[_0x09fb('0x29')]())[_0x09fb('0x19')](realtime[_0x09fb('0x2a')]())[_0x09fb('0x19')](zoho[_0x09fb('0x2b')]())[_0x09fb('0x19')](realtime['initZohoAccounts']())[_0x09fb('0x19')](vtiger['getVtigerAccounts']())['then'](realtime[_0x09fb('0x2c')]())['then'](freshsales[_0x09fb('0x2d')]())['then'](realtime['initFreshsalesAccounts']())[_0x09fb('0x19')](servicenow['getServicenowAccounts']())[_0x09fb('0x19')](realtime['initServicenowAccounts']())[_0x09fb('0x19')](dynamics365[_0x09fb('0x2e')]())[_0x09fb('0x19')](realtime[_0x09fb('0x2f')]())[_0x09fb('0x19')](campaign[_0x09fb('0x30')]())[_0x09fb('0x19')](realtime['initCampaigns']())[_0x09fb('0x19')](voiceExtension[_0x09fb('0x31')]())['then'](realtime[_0x09fb('0x32')]())[_0x09fb('0x19')](faxAccount[_0x09fb('0x33')]())['then'](realtime[_0x09fb('0x34')]())[_0x09fb('0x19')](function(){return realtime;});}function initParams(){return Promise[_0x09fb('0x35')]()[_0x09fb('0x19')](voiceQueueReport['getVoiceQueueReports']())[_0x09fb('0x19')](realtime['initVoiceQueueReports']())[_0x09fb('0x19')](cmHopperHistory[_0x09fb('0x36')]())[_0x09fb('0x19')](realtime[_0x09fb('0x37')]())['then'](cmHopperHistory[_0x09fb('0x38')]())['then'](realtime[_0x09fb('0x39')]())[_0x09fb('0x19')](voiceCallReport[_0x09fb('0x3a')]())['then'](realtime['initVoiceCallReports']())['catch'](function(_0x490eaf){logger['error'](_0x09fb('0x3b'),util[_0x09fb('0x3c')](_0x490eaf,{'showHidden':![],'depth':null}));});}function main(){return server[_0x09fb('0x3d')](realtime,preview,fax)[_0x09fb('0x19')](function(){return initRealtime();})[_0x09fb('0x19')](function(){return initParams();})[_0x09fb('0x19')](function(){report[_0x09fb('0x3e')]();setInterval(initRealtime,0x1388);})[_0x09fb('0x3f')](function(_0x55f895){logger['error'](_0x09fb('0x40'),util[_0x09fb('0x3c')](_0x55f895,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 8eca1d5..5ac86a1 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 _0xc224=['redis','defaults','localhost','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','state','not_inuse','talking','voiceStatusTime','stringify','format','emit','omit','user:presence','exports','lodash','moment','ioredis','../../../config/environment'];(function(_0x5b4f7d,_0x93377b){var _0x5db4d8=function(_0x2702af){while(--_0x2702af){_0x5b4f7d['push'](_0x5b4f7d['shift']());}};_0x5db4d8(++_0x93377b);}(_0xc224,0x8c));var _0x4c22=function(_0x2254a2,_0x5be612){_0x2254a2=_0x2254a2-0x0;var _0x1706e3=_0xc224[_0x2254a2];return _0x1706e3;};'use strict';var _=require(_0x4c22('0x0'));var util=require('util');var moment=require(_0x4c22('0x1'));var md5=require('md5');var Redis=require(_0x4c22('0x2'));var config=require(_0x4c22('0x3'));config[_0x4c22('0x4')]=_[_0x4c22('0x5')](config['redis'],{'host':_0x4c22('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4c22('0x4')]));function Agent(_0x2ab298){this['id']=_0x2ab298['id']||0x0;this[_0x4c22('0x7')]=_0x2ab298['name']||'';this[_0x4c22('0x8')]=_0x2ab298[_0x4c22('0x8')]||'';this[_0x4c22('0x9')]=_0x2ab298['accountcode']||'';this['fullname']=_0x2ab298[_0x4c22('0xa')]||'';this['state']=_0x4c22('0xb');this[_0x4c22('0xc')]=0x0;this[_0x4c22('0xd')]='unknown';this[_0x4c22('0xe')]='';this['phone']='';this[_0x4c22('0xf')]='';this[_0x4c22('0x10')]='';this[_0x4c22('0x11')]=_0x2ab298[_0x4c22('0x11')]||![];this[_0x4c22('0x12')]=_0x4c22('0xb');this['voiceStatusTime']=0x0;this[_0x4c22('0x13')]='';this[_0x4c22('0x14')]='';this[_0x4c22('0x15')]=![];this[_0x4c22('0x16')]=![];this[_0x4c22('0x17')]='';}Agent[_0x4c22('0x18')][_0x4c22('0x19')]=function(_0x4cc574){var _0xe8beaf;if(_0x4cc574&&_0x4cc574[_0x4c22('0x1a')]){_0xe8beaf=_0x4cc574['state']['toLowerCase']();switch(_0xe8beaf){case _0x4c22('0x1b'):_0xe8beaf='idle';break;case'inuse':_0xe8beaf=_0x4c22('0x1c');break;}}if(_0xe8beaf&&this[_0x4c22('0x12')]!==_0xe8beaf||_0x4cc574['statePause']){this[_0x4c22('0x1d')]=_['toNumber'](moment()['format']('x'));}if(_0xe8beaf){this[_0x4c22('0x12')]=_0xe8beaf;}var _0x216b6d={'id':this['id'],'name':this['name'],'email':this[_0x4c22('0x8')],'accountcode':this[_0x4c22('0x9')],'fullname':this[_0x4c22('0xa')],'state':this[_0x4c22('0x1a')],'stateTime':this[_0x4c22('0xc')],'status':this[_0x4c22('0xd')],'address':this[_0x4c22('0xe')],'online':this['online'],'voiceStatus':this[_0x4c22('0x12')],'voiceStatusTime':this[_0x4c22('0x1d')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x4c22('0x14')],'interface':this['interface'],'onhold':this[_0x4c22('0x15')]};var _0x4525a9=md5(JSON[_0x4c22('0x1e')](_0x216b6d));if(this[_0x4c22('0x17')]!==_0x4525a9){this[_0x4c22('0x17')]=_0x4525a9;io['to'](util[_0x4c22('0x1f')]('user:%s',_0x216b6d[_0x4c22('0x7')]))[_0x4c22('0x20')]('user:ami:update',_[_0x4c22('0x21')](_0x216b6d,['online']));io[_0x4c22('0x20')](_0x4c22('0x22'),_0x216b6d);}};module[_0x4c22('0x23')]=Agent; \ No newline at end of file +var _0xd4e8=['omit','emit','user:presence','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','stateTime','status','address','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','interface','stringify','format','user:%s','user:ami:update'];(function(_0x161f8c,_0x3b7a8f){var _0x2a9180=function(_0x1b04d0){while(--_0x1b04d0){_0x161f8c['push'](_0x161f8c['shift']());}};_0x2a9180(++_0x3b7a8f);}(_0xd4e8,0xe7));var _0x8d4e=function(_0x206338,_0x2d800b){_0x206338=_0x206338-0x0;var _0x2b87f2=_0xd4e8[_0x206338];return _0x2b87f2;};'use strict';var _=require(_0x8d4e('0x0'));var util=require(_0x8d4e('0x1'));var moment=require(_0x8d4e('0x2'));var md5=require(_0x8d4e('0x3'));var Redis=require('ioredis');var config=require(_0x8d4e('0x4'));config[_0x8d4e('0x5')]=_[_0x8d4e('0x6')](config[_0x8d4e('0x5')],{'host':_0x8d4e('0x7'),'port':0x18eb});var io=require(_0x8d4e('0x8'))(new Redis(config[_0x8d4e('0x5')]));function Agent(_0x5a2bbc){this['id']=_0x5a2bbc['id']||0x0;this[_0x8d4e('0x9')]=_0x5a2bbc[_0x8d4e('0x9')]||'';this['email']=_0x5a2bbc[_0x8d4e('0xa')]||'';this[_0x8d4e('0xb')]=_0x5a2bbc['accountcode']||'';this[_0x8d4e('0xc')]=_0x5a2bbc[_0x8d4e('0xc')]||'';this['state']='unknown';this[_0x8d4e('0xd')]=0x0;this[_0x8d4e('0xe')]='unknown';this[_0x8d4e('0xf')]='';this[_0x8d4e('0x10')]='';this[_0x8d4e('0x11')]='';this['interface']='';this[_0x8d4e('0x12')]=_0x5a2bbc[_0x8d4e('0x12')]||![];this[_0x8d4e('0x13')]='unknown';this[_0x8d4e('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x8d4e('0x15')]='';this[_0x8d4e('0x16')]=![];this['local']=![];this[_0x8d4e('0x3')]='';}Agent[_0x8d4e('0x17')][_0x8d4e('0x18')]=function(_0x3f1ee2){var _0x42a517;if(_0x3f1ee2&&_0x3f1ee2[_0x8d4e('0x19')]){_0x42a517=_0x3f1ee2[_0x8d4e('0x19')][_0x8d4e('0x1a')]();switch(_0x42a517){case'not_inuse':_0x42a517=_0x8d4e('0x1b');break;case _0x8d4e('0x1c'):_0x42a517=_0x8d4e('0x1d');break;}}if(_0x42a517&&this[_0x8d4e('0x13')]!==_0x42a517||_0x3f1ee2['statePause']){this[_0x8d4e('0x14')]=_['toNumber'](moment()['format']('x'));}if(_0x42a517){this[_0x8d4e('0x13')]=_0x42a517;}var _0x4d0aaf={'id':this['id'],'name':this[_0x8d4e('0x9')],'email':this[_0x8d4e('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x8d4e('0xc')],'state':this[_0x8d4e('0x19')],'stateTime':this[_0x8d4e('0xd')],'status':this[_0x8d4e('0xe')],'address':this['address'],'online':this[_0x8d4e('0x12')],'voiceStatus':this[_0x8d4e('0x13')],'voiceStatusTime':this[_0x8d4e('0x14')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x8d4e('0x15')],'interface':this[_0x8d4e('0x1e')],'onhold':this[_0x8d4e('0x16')]};var _0x4fcacc=md5(JSON[_0x8d4e('0x1f')](_0x4d0aaf));if(this['md5']!==_0x4fcacc){this[_0x8d4e('0x3')]=_0x4fcacc;io['to'](util[_0x8d4e('0x20')](_0x8d4e('0x21'),_0x4d0aaf['name']))['emit'](_0x8d4e('0x22'),_[_0x8d4e('0x23')](_0x4d0aaf,[_0x8d4e('0x12')]));io[_0x8d4e('0x24')](_0x8d4e('0x25'),_0x4d0aaf);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 7656acd..4a0ea88 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 _0xd0fc=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd0fc,0x1a3));var _0xcd0f=function(_0x39096c,_0x507a7a){_0x39096c=_0x39096c-0x0;var _0x33b09e=_0xd0fc[_0x39096c];return _0x33b09e;};'use strict';function Campaign(_0x192eae){this['id']=_0x192eae['id']||0x0;this[_0xcd0f('0x0')]=_0x192eae[_0xcd0f('0x0')]||'';this[_0xcd0f('0x1')]=_0x192eae[_0xcd0f('0x1')]||_0xcd0f('0x2');this[_0xcd0f('0x3')]=0x0;this[_0xcd0f('0x4')]=0x0;this[_0xcd0f('0x5')]=0x0;this[_0xcd0f('0x6')]=0x0;this[_0xcd0f('0x7')]='';this[_0xcd0f('0x8')]=!![];this['active']=_0x192eae[_0xcd0f('0x9')];this[_0xcd0f('0xa')]=_0x192eae[_0xcd0f('0xa')];this[_0xcd0f('0xb')]=_0x192eae[_0xcd0f('0xb')]||null;this[_0xcd0f('0xc')]=_0x192eae[_0xcd0f('0xc')]?_0x192eae['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x192eae['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x192eae[_0xcd0f('0xd')];this['dialOriginateTimeout']=_0x192eae[_0xcd0f('0xe')]||0x1e;this[_0xcd0f('0xf')]=_0x192eae['dialCongestionMaxRetry'];this[_0xcd0f('0x10')]=_0x192eae['dialCongestionRetryFrequency'];this[_0xcd0f('0x11')]=_0x192eae['dialBusyMaxRetry'];this[_0xcd0f('0x12')]=_0x192eae[_0xcd0f('0x12')];this['dialNoAnswerMaxRetry']=_0x192eae[_0xcd0f('0x13')];this[_0xcd0f('0x14')]=_0x192eae['dialNoAnswerRetryFrequency'];this[_0xcd0f('0x15')]=_0x192eae[_0xcd0f('0x15')];this[_0xcd0f('0x16')]=_0x192eae[_0xcd0f('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x192eae['dialNoSuchNumberRetryFrequency']||0x96;this[_0xcd0f('0x17')]=_0x192eae[_0xcd0f('0x17')]||0x3;this[_0xcd0f('0x18')]=_0x192eae['dialDropRetryFrequency']||0x96;this[_0xcd0f('0x19')]=_0x192eae[_0xcd0f('0x19')]||0x3;this[_0xcd0f('0x1a')]=_0x192eae[_0xcd0f('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x192eae[_0xcd0f('0x1b')]||0x3;this[_0xcd0f('0x1c')]=_0x192eae[_0xcd0f('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x192eae[_0xcd0f('0x1d')]||0x3;this[_0xcd0f('0x1e')]=_0x192eae[_0xcd0f('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x192eae['dialOrderByScheduledAt']||'DESC';this['dialPrefix']=_0x192eae[_0xcd0f('0x1f')]||undefined;this[_0xcd0f('0x20')]=_0x192eae[_0xcd0f('0x20')]||undefined;this['dialCutDigit']=_0x192eae[_0xcd0f('0x21')]||undefined;this[_0xcd0f('0x22')]=_0x192eae[_0xcd0f('0x22')]?_0x192eae[_0xcd0f('0x22')]:undefined;this[_0xcd0f('0x23')]=_0x192eae['Trunk']?_0x192eae['Trunk']:undefined;this[_0xcd0f('0x24')]=_0x192eae[_0xcd0f('0x24')]?_0x192eae[_0xcd0f('0x24')]:undefined;this[_0xcd0f('0x25')]=_0x192eae[_0xcd0f('0x25')]?_0x192eae[_0xcd0f('0x25')]:undefined;this['dialQueueProject']=_0x192eae[_0xcd0f('0x25')]?_0x192eae[_0xcd0f('0x25')]['name']:undefined;this[_0xcd0f('0x26')]=_0x192eae[_0xcd0f('0x26')]||![];this['dialAMDInitialSilence']=_0x192eae['dialAMDInitialSilence'];this[_0xcd0f('0x27')]=_0x192eae[_0xcd0f('0x27')];this[_0xcd0f('0x28')]=_0x192eae['dialAMDAfterGreetingSilence'];this[_0xcd0f('0x29')]=_0x192eae['dialAMDTotalAnalysisTime'];this[_0xcd0f('0x2a')]=_0x192eae['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x192eae[_0xcd0f('0x2b')];this[_0xcd0f('0x2c')]=_0x192eae[_0xcd0f('0x2c')];this[_0xcd0f('0x2d')]=_0x192eae[_0xcd0f('0x2d')];this[_0xcd0f('0x2e')]=_0x192eae[_0xcd0f('0x2e')];}module[_0xcd0f('0x2f')]=Campaign; \ No newline at end of file +var _0x4ef9=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName'];(function(_0x5f4a33,_0x5a9b58){var _0x3f19b6=function(_0x4d637a){while(--_0x4d637a){_0x5f4a33['push'](_0x5f4a33['shift']());}};_0x3f19b6(++_0x5a9b58);}(_0x4ef9,0x189));var _0x94ef=function(_0x3fc5d8,_0x3eb153){_0x3fc5d8=_0x3fc5d8-0x0;var _0x25307a=_0x4ef9[_0x3fc5d8];return _0x25307a;};'use strict';function Campaign(_0x1efc4b){this['id']=_0x1efc4b['id']||0x0;this[_0x94ef('0x0')]=_0x1efc4b['name']||'';this['type']=_0x1efc4b[_0x94ef('0x1')]||'campaign';this[_0x94ef('0x2')]=0x0;this[_0x94ef('0x3')]=0x0;this[_0x94ef('0x4')]=0x0;this[_0x94ef('0x5')]=0x0;this[_0x94ef('0x6')]='';this[_0x94ef('0x7')]=!![];this['active']=_0x1efc4b['active'];this['limitCalls']=_0x1efc4b[_0x94ef('0x8')];this[_0x94ef('0x9')]=_0x1efc4b[_0x94ef('0x9')]||null;this[_0x94ef('0xa')]=_0x1efc4b[_0x94ef('0xa')]?_0x1efc4b['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x1efc4b[_0x94ef('0xb')];this['dialOriginateCallerIdNumber']=_0x1efc4b[_0x94ef('0xc')];this[_0x94ef('0xd')]=_0x1efc4b[_0x94ef('0xd')]||0x1e;this[_0x94ef('0xe')]=_0x1efc4b[_0x94ef('0xe')];this[_0x94ef('0xf')]=_0x1efc4b[_0x94ef('0xf')];this[_0x94ef('0x10')]=_0x1efc4b[_0x94ef('0x10')];this[_0x94ef('0x11')]=_0x1efc4b[_0x94ef('0x11')];this['dialNoAnswerMaxRetry']=_0x1efc4b[_0x94ef('0x12')];this[_0x94ef('0x13')]=_0x1efc4b[_0x94ef('0x13')];this[_0x94ef('0x14')]=_0x1efc4b['dialGlobalMaxRetry'];this[_0x94ef('0x15')]=_0x1efc4b[_0x94ef('0x15')]||0x3;this[_0x94ef('0x16')]=_0x1efc4b[_0x94ef('0x16')]||0x96;this['dialDropMaxRetry']=_0x1efc4b[_0x94ef('0x17')]||0x3;this[_0x94ef('0x18')]=_0x1efc4b[_0x94ef('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x1efc4b['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x1efc4b['dialAbandonedRetryFrequency']||0x96;this[_0x94ef('0x19')]=_0x1efc4b[_0x94ef('0x19')]||0x3;this['dialMachineRetryFrequency']=_0x1efc4b[_0x94ef('0x1a')]||0x96;this[_0x94ef('0x1b')]=_0x1efc4b[_0x94ef('0x1b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1efc4b['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x1efc4b['dialOrderByScheduledAt']||_0x94ef('0x1c');this[_0x94ef('0x1d')]=_0x1efc4b[_0x94ef('0x1d')]||undefined;this[_0x94ef('0x1e')]=_0x1efc4b['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x94ef('0x1f')]=_0x1efc4b[_0x94ef('0x1f')]||undefined;this['TrunkBackup']=_0x1efc4b['TrunkBackup']?_0x1efc4b[_0x94ef('0x20')]:undefined;this[_0x94ef('0x21')]=_0x1efc4b[_0x94ef('0x21')]?_0x1efc4b[_0x94ef('0x21')]:undefined;this[_0x94ef('0x22')]=_0x1efc4b[_0x94ef('0x22')]?_0x1efc4b['Interval']:undefined;this[_0x94ef('0x23')]=_0x1efc4b[_0x94ef('0x23')]?_0x1efc4b[_0x94ef('0x23')]:undefined;this['dialQueueProject']=_0x1efc4b[_0x94ef('0x23')]?_0x1efc4b[_0x94ef('0x23')]['name']:undefined;this['dialAMDActive']=_0x1efc4b[_0x94ef('0x24')]||![];this[_0x94ef('0x25')]=_0x1efc4b[_0x94ef('0x25')];this[_0x94ef('0x26')]=_0x1efc4b[_0x94ef('0x26')];this[_0x94ef('0x27')]=_0x1efc4b['dialAMDAfterGreetingSilence'];this[_0x94ef('0x28')]=_0x1efc4b[_0x94ef('0x28')];this['dialAMDMinWordLength']=_0x1efc4b[_0x94ef('0x29')];this['dialAMDBetweenWordsSilence']=_0x1efc4b['dialAMDBetweenWordsSilence'];this[_0x94ef('0x2a')]=_0x1efc4b[_0x94ef('0x2a')];this[_0x94ef('0x2b')]=_0x1efc4b[_0x94ef('0x2b')];this[_0x94ef('0x2c')]=_0x1efc4b[_0x94ef('0x2c')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index a71bcf6..5124b10 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 _0x66d4=['transfercalleridnum','transferconnectedlinenum','exports','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','linkedid','answered','answertime','endtime','unmanaged','lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x66d4,0x10b));var _0x466d=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0x66d4[_0x5c72ee];return _0x231876;};'use strict';function Channel(){this['starttime']=null;this[_0x466d('0x0')]='';this['destinationchannel']='';this[_0x466d('0x1')]=0x0;this[_0x466d('0x2')]='';this[_0x466d('0x3')]=undefined;this[_0x466d('0x4')]=undefined;this[_0x466d('0x5')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0x466d('0x6')]=0x0;this['exten']=0x0;this[_0x466d('0x7')]=![];this[_0x466d('0x8')]=null;this[_0x466d('0x9')]=null;this[_0x466d('0xa')]=![];this['abandoned']=![];this['lastapplication']='';this[_0x466d('0xb')]='';this[_0x466d('0xc')]=0x0;this[_0x466d('0xd')]=0x0;this[_0x466d('0xe')]=0x0;this['type']=null;this[_0x466d('0xf')]=null;this[_0x466d('0x10')]=null;this[_0x466d('0x11')]=![];this[_0x466d('0x12')]=null;this[_0x466d('0x13')]=null;this[_0x466d('0x14')]=[];this[_0x466d('0x15')]=undefined;this[_0x466d('0x16')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0x466d('0x17')]=Channel; \ No newline at end of file +var _0x94c2=['linkedid','exten','answertime','abandoned','lastapplication','lastdata','duration','type','tag','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid'];(function(_0x42a1e4,_0x3bd601){var _0x1d66c8=function(_0x47dd21){while(--_0x47dd21){_0x42a1e4['push'](_0x42a1e4['shift']());}};_0x1d66c8(++_0x3bd601);}(_0x94c2,0x13d));var _0x294c=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x94c2[_0x422905];return _0x33dc6c;};'use strict';function Channel(){this['starttime']=null;this[_0x294c('0x0')]='';this['destinationchannel']='';this[_0x294c('0x1')]=0x0;this[_0x294c('0x2')]='';this[_0x294c('0x3')]=undefined;this[_0x294c('0x4')]=undefined;this[_0x294c('0x5')]=0x0;this[_0x294c('0x6')]='';this[_0x294c('0x7')]=0x0;this[_0x294c('0x8')]=0x0;this[_0x294c('0x9')]=0x0;this['answered']=![];this[_0x294c('0xa')]=null;this['endtime']=null;this['unmanaged']=![];this[_0x294c('0xb')]=![];this[_0x294c('0xc')]='';this[_0x294c('0xd')]='';this[_0x294c('0xe')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x294c('0xf')]=null;this[_0x294c('0x10')]=null;this['disposition']=null;this['monitor']=![];this[_0x294c('0x11')]=null;this[_0x294c('0x12')]=null;this[_0x294c('0x13')]=[];this[_0x294c('0x14')]=undefined;this[_0x294c('0x15')]=undefined;this[_0x294c('0x16')]=undefined;this[_0x294c('0x17')]=0x0;}module[_0x294c('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 9d139be..5492d2a 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 _0xc16b=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xc16b,0x116));var _0xbc16=function(_0x14d0e3,_0x1ee29e){_0x14d0e3=_0x14d0e3-0x0;var _0x4fd284=_0xc16b[_0x14d0e3];return _0x4fd284;};'use strict';function DeskAccount(_0xe468a9){this['id']=_0xe468a9['id']||0x0;this[_0xbc16('0x0')]=_0xe468a9[_0xbc16('0x0')]||'';this[_0xbc16('0x1')]=_0xe468a9['username']||'';this[_0xbc16('0x2')]=_0xe468a9[_0xbc16('0x2')]||'';this[_0xbc16('0x3')]=_0xe468a9[_0xbc16('0x3')]||'';this['password']=_0xe468a9[_0xbc16('0x4')]||'';this['consumerKey']=_0xe468a9[_0xbc16('0x5')]||'';this[_0xbc16('0x6')]=_0xe468a9['consumerSecret']||'';this[_0xbc16('0x7')]=_0xe468a9[_0xbc16('0x7')]||'';this[_0xbc16('0x8')]=_0xe468a9[_0xbc16('0x8')]||'';this[_0xbc16('0x9')]=_0xe468a9[_0xbc16('0x9')]||'';this[_0xbc16('0xa')]=_0xe468a9['serverUrl']||'';this[_0xbc16('0xb')]=_0xe468a9[_0xbc16('0xb')]||{};}module[_0xbc16('0xc')]=DeskAccount; \ No newline at end of file +var _0x9529=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','username'];(function(_0x152635,_0x5dac8b){var _0x24f4a4=function(_0x4cd88f){while(--_0x4cd88f){_0x152635['push'](_0x152635['shift']());}};_0x24f4a4(++_0x5dac8b);}(_0x9529,0x107));var _0x9952=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9529[_0x20a584];return _0x4b41a8;};'use strict';function DeskAccount(_0x54b7ce){this['id']=_0x54b7ce['id']||0x0;this['name']=_0x54b7ce['name']||'';this[_0x9952('0x0')]=_0x54b7ce[_0x9952('0x0')]||'';this[_0x9952('0x1')]=_0x54b7ce[_0x9952('0x1')]||'';this[_0x9952('0x2')]=_0x54b7ce['authType']||'';this['password']=_0x54b7ce[_0x9952('0x3')]||'';this[_0x9952('0x4')]=_0x54b7ce[_0x9952('0x4')]||'';this[_0x9952('0x5')]=_0x54b7ce[_0x9952('0x5')]||'';this[_0x9952('0x6')]=_0x54b7ce['token']||'';this[_0x9952('0x7')]=_0x54b7ce[_0x9952('0x7')]||'';this['type']=_0x54b7ce[_0x9952('0x8')]||'';this[_0x9952('0x9')]=_0x54b7ce[_0x9952('0x9')]||'';this[_0x9952('0xa')]=_0x54b7ce['Configurations']||{};}module[_0x9952('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 0531ef3..0712be5 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 _0xdb17=['remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password'];(function(_0x4f9d91,_0x5bb18f){var _0x10e4b5=function(_0x430662){while(--_0x430662){_0x4f9d91['push'](_0x4f9d91['shift']());}};_0x10e4b5(++_0x5bb18f);}(_0xdb17,0x99));var _0x7db1=function(_0x1c15ea,_0xd5c9ed){_0x1c15ea=_0x1c15ea-0x0;var _0x43884c=_0xdb17[_0x1c15ea];return _0x43884c;};'use strict';function Dynamics365Account(_0x27af21){this['id']=_0x27af21['id']||0x0;this[_0x7db1('0x0')]=_0x27af21[_0x7db1('0x0')]||'';this[_0x7db1('0x1')]=_0x27af21[_0x7db1('0x1')]||'';this['password']=_0x27af21[_0x7db1('0x2')]||'';this[_0x7db1('0x3')]=_0x27af21[_0x7db1('0x3')]||'';this['tenantId']=_0x27af21[_0x7db1('0x4')]||'';this['clientId']=_0x27af21[_0x7db1('0x5')]||'';this[_0x7db1('0x6')]=_0x27af21['clientSecret']||{};this[_0x7db1('0x7')]=_0x27af21['serverUrl']||'';this[_0x7db1('0x8')]=_0x27af21[_0x7db1('0x8')]||![];this[_0x7db1('0x9')]=_0x27af21[_0x7db1('0x9')]||{};this[_0x7db1('0xa')]=_0x27af21[_0x7db1('0xa')]||{};}module[_0x7db1('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x39cf=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x1183d8,_0x5d90ab){var _0x48348f=function(_0x52d9be){while(--_0x52d9be){_0x1183d8['push'](_0x1183d8['shift']());}};_0x48348f(++_0x5d90ab);}(_0x39cf,0xb8));var _0xf39c=function(_0x47bc5e,_0x6fc500){_0x47bc5e=_0x47bc5e-0x0;var _0x323a59=_0x39cf[_0x47bc5e];return _0x323a59;};'use strict';function Dynamics365Account(_0x119576){this['id']=_0x119576['id']||0x0;this[_0xf39c('0x0')]=_0x119576[_0xf39c('0x0')]||'';this['username']=_0x119576[_0xf39c('0x1')]||'';this[_0xf39c('0x2')]=_0x119576[_0xf39c('0x2')]||'';this[_0xf39c('0x3')]=_0x119576[_0xf39c('0x3')]||'';this['tenantId']=_0x119576[_0xf39c('0x4')]||'';this[_0xf39c('0x5')]=_0x119576['clientId']||'';this[_0xf39c('0x6')]=_0x119576[_0xf39c('0x6')]||{};this[_0xf39c('0x7')]=_0x119576[_0xf39c('0x7')]||'';this[_0xf39c('0x8')]=_0x119576[_0xf39c('0x8')]||![];this[_0xf39c('0x9')]=_0x119576[_0xf39c('0x9')]||{};this[_0xf39c('0xa')]=_0x119576['CloudProvider']||{};}module[_0xf39c('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 4853552..6b77be4 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 _0xd2f0=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0xd2f0,0xcd));var _0x0d2f=function(_0x133eab,_0x1872aa){_0x133eab=_0x133eab-0x0;var _0x20a88f=_0xd2f0[_0x133eab];return _0x20a88f;};'use strict';function FaxAccount(_0x5243a0){this['id']=_0x5243a0['id']||0x0;this[_0x0d2f('0x0')]=_0x5243a0[_0x0d2f('0x0')]||'';this[_0x0d2f('0x1')]=_0x5243a0[_0x0d2f('0x1')];this[_0x0d2f('0x2')]=_0x5243a0[_0x0d2f('0x2')];this[_0x0d2f('0x3')]=_0x5243a0['headerinfo'];this[_0x0d2f('0x4')]=_0x5243a0[_0x0d2f('0x4')];this[_0x0d2f('0x5')]=_0x5243a0[_0x0d2f('0x5')]||0x960;this[_0x0d2f('0x6')]=_0x5243a0['maxrate']||0x3840;this[_0x0d2f('0x7')]=_0x5243a0[_0x0d2f('0x7')]||'v17,v27,v29';this[_0x0d2f('0x8')]=_0x5243a0[_0x0d2f('0x8')]||'no';this[_0x0d2f('0x9')]=_0x5243a0['faxdetect']||'no';this[_0x0d2f('0xa')]=_0x5243a0[_0x0d2f('0xa')]||0x1388;this[_0x0d2f('0xb')]=_0x5243a0[_0x0d2f('0xb')]||_0x0d2f('0xc');this[_0x0d2f('0xd')]=_0x5243a0[_0x0d2f('0xd')]?_0x5243a0[_0x0d2f('0xd')]:undefined;this[_0x0d2f('0xe')]=_0x5243a0[_0x0d2f('0xe')];this[_0x0d2f('0xf')]=_0x5243a0[_0x0d2f('0xf')];}module[_0x0d2f('0x10')]=FaxAccount; \ No newline at end of file +var _0x11c5=['description','ecm','headerinfo','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','tech','Trunk','ListId','key','exports','name'];(function(_0x2dd22e,_0xec41fe){var _0x257b01=function(_0x26de99){while(--_0x26de99){_0x2dd22e['push'](_0x2dd22e['shift']());}};_0x257b01(++_0xec41fe);}(_0x11c5,0xfe));var _0x511c=function(_0x20fe5f,_0x2ab48f){_0x20fe5f=_0x20fe5f-0x0;var _0x21494a=_0x11c5[_0x20fe5f];return _0x21494a;};'use strict';function FaxAccount(_0x5d2e87){this['id']=_0x5d2e87['id']||0x0;this[_0x511c('0x0')]=_0x5d2e87[_0x511c('0x0')]||'';this['description']=_0x5d2e87[_0x511c('0x1')];this[_0x511c('0x2')]=_0x5d2e87[_0x511c('0x2')];this['headerinfo']=_0x5d2e87[_0x511c('0x3')];this['localstationid']=_0x5d2e87['localstationid'];this['minrate']=_0x5d2e87[_0x511c('0x4')]||0x960;this[_0x511c('0x5')]=_0x5d2e87['maxrate']||0x3840;this[_0x511c('0x6')]=_0x5d2e87[_0x511c('0x6')]||_0x511c('0x7');this[_0x511c('0x8')]=_0x5d2e87[_0x511c('0x8')]||'no';this[_0x511c('0x9')]=_0x5d2e87[_0x511c('0x9')]||'no';this['t38timeout']=_0x5d2e87['t38timeout']||0x1388;this[_0x511c('0xa')]=_0x5d2e87[_0x511c('0xa')]||'SIP';this[_0x511c('0xb')]=_0x5d2e87[_0x511c('0xb')]?_0x5d2e87[_0x511c('0xb')]:undefined;this['ListId']=_0x5d2e87[_0x511c('0xc')];this[_0x511c('0xd')]=_0x5d2e87[_0x511c('0xd')];}module[_0x511c('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index eeeb678..67a6e05 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 _0x7900=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x35ab22,_0x44ebd8){var _0x121d43=function(_0x3a9192){while(--_0x3a9192){_0x35ab22['push'](_0x35ab22['shift']());}};_0x121d43(++_0x44ebd8);}(_0x7900,0x14b));var _0x0790=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7900[_0x20a584];return _0x4b41a8;};'use strict';function FreshdeskAccount(_0x70c006){this['id']=_0x70c006['id']||0x0;this[_0x0790('0x0')]=_0x70c006['name']||'';this[_0x0790('0x1')]=_0x70c006['username']||'';this[_0x0790('0x2')]=_0x70c006[_0x0790('0x3')]||'';this[_0x0790('0x4')]=_0x70c006['remoteUri']||'';this['serverUrl']=_0x70c006[_0x0790('0x5')]||'';this[_0x0790('0x6')]=_0x70c006['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xe847=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5010f7,_0x2acee8){var _0x3e887d=function(_0x5d2632){while(--_0x5d2632){_0x5010f7['push'](_0x5010f7['shift']());}};_0x3e887d(++_0x2acee8);}(_0xe847,0x148));var _0x7e84=function(_0x1d8f1d,_0x5d66ea){_0x1d8f1d=_0x1d8f1d-0x0;var _0x5069a6=_0xe847[_0x1d8f1d];return _0x5069a6;};'use strict';function FreshdeskAccount(_0x1d8f3e){this['id']=_0x1d8f3e['id']||0x0;this[_0x7e84('0x0')]=_0x1d8f3e[_0x7e84('0x0')]||'';this[_0x7e84('0x1')]=_0x1d8f3e[_0x7e84('0x1')]||'';this['apiKey']=_0x1d8f3e['token']||'';this[_0x7e84('0x2')]=_0x1d8f3e['remoteUri']||'';this['serverUrl']=_0x1d8f3e[_0x7e84('0x3')]||'';this['Configurations']=_0x1d8f3e[_0x7e84('0x4')]||{};}module[_0x7e84('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index f7a8a1a..3df2894 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 _0x8ba0=['name','username','remoteUri','serverUrl','Configurations'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x4f0ee5,_0x4aaec5){_0x4f0ee5=_0x4f0ee5-0x0;var _0x1661dc=_0x8ba0[_0x4f0ee5];return _0x1661dc;};'use strict';function FreshsalesAccount(_0x58b7fb){this['id']=_0x58b7fb['id']||0x0;this[_0x08ba('0x0')]=_0x58b7fb[_0x08ba('0x0')]||'';this[_0x08ba('0x1')]=_0x58b7fb[_0x08ba('0x1')]||'';this['apiKey']=_0x58b7fb['token']||'';this[_0x08ba('0x2')]=_0x58b7fb[_0x08ba('0x2')]||'';this[_0x08ba('0x3')]=_0x58b7fb[_0x08ba('0x3')]||'';this[_0x08ba('0x4')]=_0x58b7fb[_0x08ba('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x5e8d=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0xfbb69e,_0x1c65dd){var _0x31666f=function(_0x344c9f){while(--_0x344c9f){_0xfbb69e['push'](_0xfbb69e['shift']());}};_0x31666f(++_0x1c65dd);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x2c6310,_0x3e502e){_0x2c6310=_0x2c6310-0x0;var _0x45f1da=_0x5e8d[_0x2c6310];return _0x45f1da;};'use strict';function FreshsalesAccount(_0xa5bfa6){this['id']=_0xa5bfa6['id']||0x0;this[_0xd5e8('0x0')]=_0xa5bfa6[_0xd5e8('0x0')]||'';this[_0xd5e8('0x1')]=_0xa5bfa6[_0xd5e8('0x1')]||'';this[_0xd5e8('0x2')]=_0xa5bfa6[_0xd5e8('0x3')]||'';this['remoteUri']=_0xa5bfa6[_0xd5e8('0x4')]||'';this[_0xd5e8('0x5')]=_0xa5bfa6['serverUrl']||'';this[_0xd5e8('0x6')]=_0xa5bfa6[_0xd5e8('0x6')]||{};}module[_0xd5e8('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 1cb4bff..a2e8f43 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 _0xe182=['motionChannel','mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','queuecallercomplete','queuecallerexitAt','channel','connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo'];(function(_0xed9c99,_0x2217b1){var _0x5443a1=function(_0xb7c751){while(--_0xb7c751){_0xed9c99['push'](_0xed9c99['shift']());}};_0x5443a1(++_0x2217b1);}(_0xe182,0xdf));var _0x2e18=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe182[_0x1cc8fe];return _0x230054;};'use strict';function QueueReport(){this[_0x2e18('0x0')]=_0x2e18('0x1');this[_0x2e18('0x2')]='';this[_0x2e18('0x3')]='';this[_0x2e18('0x4')]='';this[_0x2e18('0x5')]='';this['queuecallerjoinAt']=null;this[_0x2e18('0x6')]=null;this['position']=0x1;this['count']=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0x2e18('0x7')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x2e18('0x8')]=null;this['originalposition']=0x1;this[_0x2e18('0x9')]='';this['connectedlinenum']='';this[_0x2e18('0xa')]='';this[_0x2e18('0xb')]='';this[_0x2e18('0xc')]='';this[_0x2e18('0xd')]='';this['priority']='';this[_0x2e18('0xe')]=0x0;this[_0x2e18('0xf')]=![];this[_0x2e18('0x10')]='';this[_0x2e18('0x11')]='voice';this['routealias']=null;this[_0x2e18('0x12')]=0x0;this[_0x2e18('0x13')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xd113=['motionChannel','voice','routealias','mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','originalposition','channel','connectedlinename','accountcode','context','priority','holdtime','lastAssignedTo'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xd113,0x19d));var _0x3d11=function(_0x342de6,_0x343927){_0x342de6=_0x342de6-0x0;var _0x6b7e5a=_0xd113[_0x342de6];return _0x6b7e5a;};'use strict';function QueueReport(){this[_0x3d11('0x0')]=_0x3d11('0x1');this[_0x3d11('0x2')]='';this[_0x3d11('0x3')]='';this[_0x3d11('0x4')]='';this[_0x3d11('0x5')]='';this[_0x3d11('0x6')]=null;this['queuecallerleaveAt']=null;this[_0x3d11('0x7')]=0x1;this['count']=0x1;this[_0x3d11('0x8')]=![];this[_0x3d11('0x9')]=null;this[_0x3d11('0xa')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0x3d11('0xb')]=0x1;this[_0x3d11('0xc')]='';this['connectedlinenum']='';this[_0x3d11('0xd')]='';this[_0x3d11('0xe')]='';this[_0x3d11('0xf')]='';this['exten']='';this[_0x3d11('0x10')]='';this[_0x3d11('0x11')]=0x0;this['assigned']=![];this[_0x3d11('0x12')]='';this[_0x3d11('0x13')]=_0x3d11('0x14');this[_0x3d11('0x15')]=null;this[_0x3d11('0x16')]=0x0;this[_0x3d11('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index ccd8e27..8855502 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 _0x3c6a=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x4d73b1,_0x91ab71){var _0xe394f9=function(_0x47dd5d){while(--_0x47dd5d){_0x4d73b1['push'](_0x4d73b1['shift']());}};_0xe394f9(++_0x91ab71);}(_0x3c6a,0xd1));var _0xa3c6=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0x3c6a[_0x16bb4b];return _0x8aeb84;};'use strict';function SalesforceAccount(_0x29146a){this['id']=_0x29146a['id']||0x0;this[_0xa3c6('0x0')]=_0x29146a[_0xa3c6('0x0')]||'';this[_0xa3c6('0x1')]=_0x29146a[_0xa3c6('0x1')]||'';this[_0xa3c6('0x2')]=_0x29146a[_0xa3c6('0x2')]||'';this[_0xa3c6('0x3')]=_0x29146a[_0xa3c6('0x3')]||'';this[_0xa3c6('0x4')]=_0x29146a[_0xa3c6('0x4')]||'';this[_0xa3c6('0x5')]=_0x29146a['clientSecret']||'';this[_0xa3c6('0x6')]=_0x29146a[_0xa3c6('0x6')]||'';this[_0xa3c6('0x7')]=_0x29146a[_0xa3c6('0x7')]||_0xa3c6('0x8');this[_0xa3c6('0x9')]=_0x29146a[_0xa3c6('0x9')]||'';this[_0xa3c6('0xa')]=_0x29146a[_0xa3c6('0xa')]||{};}module[_0xa3c6('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xa0bf=['Configurations','exports','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x59ee41,_0xaf7db8){var _0x3ecd3e=function(_0x2f9291){while(--_0x2f9291){_0x59ee41['push'](_0x59ee41['shift']());}};_0x3ecd3e(++_0xaf7db8);}(_0xa0bf,0xb6));var _0xfa0b=function(_0x4dc109,_0x292871){_0x4dc109=_0x4dc109-0x0;var _0x2039ca=_0xa0bf[_0x4dc109];return _0x2039ca;};'use strict';function SalesforceAccount(_0x384469){this['id']=_0x384469['id']||0x0;this['name']=_0x384469['name']||'';this['username']=_0x384469['username']||'';this[_0xfa0b('0x0')]=_0x384469['remoteUri']||'';this[_0xfa0b('0x1')]=_0x384469['password']||'';this[_0xfa0b('0x2')]=_0x384469['clientId']||'';this[_0xfa0b('0x3')]=_0x384469[_0xfa0b('0x3')]||'';this[_0xfa0b('0x4')]=_0x384469[_0xfa0b('0x4')]||'';this[_0xfa0b('0x5')]=_0x384469[_0xfa0b('0x5')]||_0xfa0b('0x6');this[_0xfa0b('0x7')]=_0x384469[_0xfa0b('0x7')]||'';this[_0xfa0b('0x8')]=_0x384469['Configurations']||{};}module[_0xfa0b('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 803f023..8a52475 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 _0x5020=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5020,0xc2));var _0x0502=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x5020[_0x5c351c];return _0x26f3b3;};'use strict';function ServicenowAccount(_0x75cc71){this['id']=_0x75cc71['id']||0x0;this[_0x0502('0x0')]=_0x75cc71[_0x0502('0x0')]||'';this[_0x0502('0x1')]=_0x75cc71['username']||'';this[_0x0502('0x2')]=_0x75cc71[_0x0502('0x2')]||'';this[_0x0502('0x3')]=_0x75cc71[_0x0502('0x3')]||'';this['serverUrl']=_0x75cc71[_0x0502('0x4')]||'';this[_0x0502('0x5')]=_0x75cc71['Configurations']||{};}module[_0x0502('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x6156=['serverUrl','Configurations','username','remoteUri'];(function(_0x344128,_0x9b9e88){var _0x693fae=function(_0x3e2b2e){while(--_0x3e2b2e){_0x344128['push'](_0x344128['shift']());}};_0x693fae(++_0x9b9e88);}(_0x6156,0x12e));var _0x6615=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x6156[_0x15c421];return _0x5e5ed5;};'use strict';function ServicenowAccount(_0x291a63){this['id']=_0x291a63['id']||0x0;this['name']=_0x291a63['name']||'';this[_0x6615('0x0')]=_0x291a63[_0x6615('0x0')]||'';this['password']=_0x291a63['password']||'';this['remoteUri']=_0x291a63[_0x6615('0x1')]||'';this[_0x6615('0x2')]=_0x291a63[_0x6615('0x2')]||'';this['Configurations']=_0x291a63[_0x6615('0x3')]||{};}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 7888244..13c97ae 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 _0xd793=['username','remoteUri','serverUrl','exports','name'];(function(_0x3787d7,_0x821963){var _0x5c9214=function(_0x4998e6){while(--_0x4998e6){_0x3787d7['push'](_0x3787d7['shift']());}};_0x5c9214(++_0x821963);}(_0xd793,0x16c));var _0x3d79=function(_0x4b12a6,_0x31f46b){_0x4b12a6=_0x4b12a6-0x0;var _0x16f236=_0xd793[_0x4b12a6];return _0x16f236;};'use strict';function SugarcrmAccount(_0x295a17){this['id']=_0x295a17['id']||0x0;this[_0x3d79('0x0')]=_0x295a17[_0x3d79('0x0')]||'';this[_0x3d79('0x1')]=_0x295a17[_0x3d79('0x1')]||'';this['password']=_0x295a17['password']||'';this[_0x3d79('0x2')]=_0x295a17[_0x3d79('0x2')]||'';this[_0x3d79('0x3')]=_0x295a17[_0x3d79('0x3')]||'';this['Configurations']=_0x295a17['Configurations']||{};}module[_0x3d79('0x4')]=SugarcrmAccount; \ No newline at end of file +var _0xc2be=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2a6754,_0x277259){var _0x17feda=function(_0x5745be){while(--_0x5745be){_0x2a6754['push'](_0x2a6754['shift']());}};_0x17feda(++_0x277259);}(_0xc2be,0x9f));var _0xec2b=function(_0x578a25,_0x368f7a){_0x578a25=_0x578a25-0x0;var _0x2a6ec0=_0xc2be[_0x578a25];return _0x2a6ec0;};'use strict';function SugarcrmAccount(_0x1c5614){this['id']=_0x1c5614['id']||0x0;this[_0xec2b('0x0')]=_0x1c5614[_0xec2b('0x0')]||'';this[_0xec2b('0x1')]=_0x1c5614[_0xec2b('0x1')]||'';this[_0xec2b('0x2')]=_0x1c5614['password']||'';this[_0xec2b('0x3')]=_0x1c5614['remoteUri']||'';this['serverUrl']=_0x1c5614[_0xec2b('0x4')]||'';this[_0xec2b('0x5')]=_0x1c5614[_0xec2b('0x5')]||{};}module[_0xec2b('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 26f64dd..227ea75 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 _0xb3a3=['unknown','stateTime','status','address','exports','name','state'];(function(_0x332a92,_0x23a7ca){var _0x4ff7b3=function(_0x39c1c7){while(--_0x39c1c7){_0x332a92['push'](_0x332a92['shift']());}};_0x4ff7b3(++_0x23a7ca);}(_0xb3a3,0x132));var _0x3b3a=function(_0x4d7862,_0x19da8e){_0x4d7862=_0x4d7862-0x0;var _0xed14f0=_0xb3a3[_0x4d7862];return _0xed14f0;};'use strict';function Telephone(_0x26fc4f){this['id']=_0x26fc4f['id']||0x0;this['name']=_0x26fc4f[_0x3b3a('0x0')]||'';this['accountcode']=_0x26fc4f['accountcode']||'';this[_0x3b3a('0x1')]=_0x3b3a('0x2');this[_0x3b3a('0x3')]=0x0;this[_0x3b3a('0x4')]='unknown';this[_0x3b3a('0x5')]='';}module[_0x3b3a('0x6')]=Telephone; \ No newline at end of file +var _0x261b=['status','address','name','unknown'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x261b,0x15a));var _0xb261=function(_0xda6c4d,_0x52f338){_0xda6c4d=_0xda6c4d-0x0;var _0x278278=_0x261b[_0xda6c4d];return _0x278278;};'use strict';function Telephone(_0x5c3b92){this['id']=_0x5c3b92['id']||0x0;this[_0xb261('0x0')]=_0x5c3b92['name']||'';this['accountcode']=_0x5c3b92['accountcode']||'';this['state']=_0xb261('0x1');this['stateTime']=0x0;this[_0xb261('0x2')]='unknown';this[_0xb261('0x3')]='';}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 3e52bfa..51ea782 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(_0x207f20,_0x37ee90){var _0xaa7960=function(_0x203fb6){while(--_0x203fb6){_0x207f20['push'](_0x207f20['shift']());}};_0xaa7960(++_0x37ee90);}(_0xb10b,0x12a));var _0xbb10=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0xb10b[_0x228ac9];return _0x69fe02;};'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(_0xdaf012,_0x170120){var _0x3b6c21=function(_0x2ff3a2){while(--_0x2ff3a2){_0xdaf012['push'](_0xdaf012['shift']());}};_0x3b6c21(++_0x170120);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 0fb3d08..d8c1e61 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 _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x1aa832,_0x93f678){var _0x334378=function(_0x3ccb67){while(--_0x3ccb67){_0x1aa832['push'](_0x1aa832['shift']());}};_0x334378(++_0x93f678);}(_0x4fc2,0x111));var _0x24fc=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x4fc2[_0x500c0];return _0xdd146f;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x0b0e[_0x221b8c];return _0x3fab9f;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 8023770..23ec962 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 _0x1e0a=['port','domain','refresh','stateRegistry','address','defaultuser','exports','active','name','state','unknown','status','registry','host'];(function(_0x32c81b,_0x2945f7){var _0x54fd24=function(_0x3749ed){while(--_0x3749ed){_0x32c81b['push'](_0x32c81b['shift']());}};_0x54fd24(++_0x2945f7);}(_0x1e0a,0x157));var _0xa1e0=function(_0x4e2917,_0x2f70e7){_0x4e2917=_0x4e2917-0x0;var _0x3031a0=_0x1e0a[_0x4e2917];return _0x3031a0;};'use strict';function Trunk(_0x203478){this['id']=_0x203478['id']||0x0;this[_0xa1e0('0x0')]=_0x203478[_0xa1e0('0x0')]||![];this['name']=_0x203478[_0xa1e0('0x1')]||'';this[_0xa1e0('0x2')]=_0xa1e0('0x3');this['stateTime']=0x0;this[_0xa1e0('0x4')]='unknown';this[_0xa1e0('0x5')]=_0x203478['registry']&&_0x203478[_0xa1e0('0x5')]['indexOf'](':')?_0x203478[_0xa1e0('0x5')]['split'](':')[0x0]:'';this[_0xa1e0('0x6')]='';this[_0xa1e0('0x7')]='';this[_0xa1e0('0x8')]='';this['domainport']='';this[_0xa1e0('0x9')]='';this[_0xa1e0('0xa')]=_0xa1e0('0x3');this['registrationtime']='';this[_0xa1e0('0xb')]='';this[_0xa1e0('0xc')]=_0x203478[_0xa1e0('0xc')]||'';}module[_0xa1e0('0xd')]=Trunk; \ No newline at end of file +var _0xb1d5=['exports','active','name','stateTime','status','registry','indexOf','split','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser'];(function(_0x2dd568,_0x4349ab){var _0xd4f80b=function(_0x57d032){while(--_0x57d032){_0x2dd568['push'](_0x2dd568['shift']());}};_0xd4f80b(++_0x4349ab);}(_0xb1d5,0xe1));var _0x5b1d=function(_0xfc5df5,_0x5935dc){_0xfc5df5=_0xfc5df5-0x0;var _0x3a9b2c=_0xb1d5[_0xfc5df5];return _0x3a9b2c;};'use strict';function Trunk(_0x39662f){this['id']=_0x39662f['id']||0x0;this[_0x5b1d('0x0')]=_0x39662f[_0x5b1d('0x0')]||![];this[_0x5b1d('0x1')]=_0x39662f['name']||'';this['state']='unknown';this[_0x5b1d('0x2')]=0x0;this[_0x5b1d('0x3')]='unknown';this[_0x5b1d('0x4')]=_0x39662f[_0x5b1d('0x4')]&&_0x39662f[_0x5b1d('0x4')][_0x5b1d('0x5')](':')?_0x39662f['registry'][_0x5b1d('0x6')](':')[0x0]:'';this['host']='';this[_0x5b1d('0x7')]='';this[_0x5b1d('0x8')]='';this[_0x5b1d('0x9')]='';this[_0x5b1d('0xa')]='';this[_0x5b1d('0xb')]='unknown';this[_0x5b1d('0xc')]='';this[_0x5b1d('0xd')]='';this['defaultuser']=_0x39662f[_0x5b1d('0xe')]||'';}module[_0x5b1d('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index f360377..69a0262 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 _0x8f6c=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x5ac7d7,_0x109040){var _0x23955f=function(_0x52a2ac){while(--_0x52a2ac){_0x5ac7d7['push'](_0x5ac7d7['shift']());}};_0x23955f(++_0x109040);}(_0x8f6c,0x180));var _0xc8f6=function(_0x42a026,_0x4cd74c){_0x42a026=_0x42a026-0x0;var _0x37e35b=_0x8f6c[_0x42a026];return _0x37e35b;};'use strict';function voiceExtension(_0x1a077c){this['id']=_0x1a077c['id']||0x0;this[_0xc8f6('0x0')]=_0x1a077c[_0xc8f6('0x0')]||'';this[_0xc8f6('0x1')]=_0x1a077c[_0xc8f6('0x1')]||_0xc8f6('0x2');this[_0xc8f6('0x3')]=_0x1a077c[_0xc8f6('0x3')]||![];}module[_0xc8f6('0x4')]=voiceExtension; \ No newline at end of file +var _0x2709=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x24a97b,_0x2feac0){var _0x186301=function(_0x4c1a25){while(--_0x4c1a25){_0x24a97b['push'](_0x24a97b['shift']());}};_0x186301(++_0x2feac0);}(_0x2709,0xbe));var _0x9270=function(_0x33d24a,_0x41dcac){_0x33d24a=_0x33d24a-0x0;var _0x74ebff=_0x2709[_0x33d24a];return _0x74ebff;};'use strict';function voiceExtension(_0x31e381){this['id']=_0x31e381['id']||0x0;this[_0x9270('0x0')]=_0x31e381[_0x9270('0x0')]||'';this[_0x9270('0x1')]=_0x31e381['recordingFormat']||_0x9270('0x2');this[_0x9270('0x3')]=_0x31e381['mandatoryDisposition']||![];}module[_0x9270('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index a1b5352..f419a7a 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 _0x9752=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav49','gsm','fewestcalls','leastrecent','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','total','answered','sumHoldTime','unmanaged','abandoned','available','busy','inUse','invalid','notInUse','onHold','ringing','ringInUse','talking','acw','acwTimeout','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls'];(function(_0x46ca2f,_0x33689f){var _0x54d3c5=function(_0x484ca6){while(--_0x484ca6){_0x46ca2f['push'](_0x46ca2f['shift']());}};_0x54d3c5(++_0x33689f);}(_0x9752,0x90));var _0x2975=function(_0x31c8d5,_0x5c5547){_0x31c8d5=_0x31c8d5-0x0;var _0x222beb=_0x9752[_0x31c8d5];return _0x222beb;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x2975('0x0'),'gsm':_0x2975('0x1')};var strategy={'fewestcalls':_0x2975('0x2'),'leastrecent':_0x2975('0x3'),'linear':'linear','random':_0x2975('0x4'),'ringall':_0x2975('0x5'),'rr':_0x2975('0x6'),'rrmemory':_0x2975('0x7'),'rrordered':_0x2975('0x8'),'wrandom':_0x2975('0x9')};function VoiceQueue(_0x8d643d){this['id']=_0x8d643d['id']||0x0;this[_0x2975('0xa')]=_0x8d643d[_0x2975('0xa')]||'';this['monitor_format']=_0x8d643d[_0x2975('0xb')]||'';this[_0x2975('0xc')]=_0x8d643d[_0x2975('0xc')]||'inbound';this[_0x2975('0xd')]=0x0;this[_0x2975('0xe')]=0x0;this[_0x2975('0xf')]=0x0;this['sumDuration']=0x0;this[_0x2975('0x10')]=0x0;this['sumBillable']=0x0;this[_0x2975('0x11')]=0x0;this[_0x2975('0x12')]=0x0;this[_0x2975('0x13')]=0x0;this[_0x2975('0x14')]=0x0;this[_0x2975('0x15')]=0x0;this[_0x2975('0x16')]=0x0;this['loggedIn']=0x0;this[_0x2975('0x17')]=0x0;this[_0x2975('0x18')]=0x0;this['paused']=0x0;this[_0x2975('0x19')]=0x0;this[_0x2975('0x1a')]=0x0;this[_0x2975('0x1b')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this['acw']=_0x8d643d[_0x2975('0x1c')]||![];this[_0x2975('0x1d')]=_0x8d643d[_0x2975('0x1d')]||0xa;this['autopause']=_0x8d643d['autopause']||'no';this[_0x2975('0x1e')]=!![];this[_0x2975('0x1f')]='';this[_0x2975('0x20')]='';this[_0x2975('0x21')]=0x0;this[_0x2975('0x22')]=0x0;this[_0x2975('0x23')]=_0x8d643d[_0x2975('0x23')]||null;this['dialGlobalInterval']=_0x8d643d[_0x2975('0x24')]?_0x8d643d['dialGlobalInterval']:null;this['dialActive']=_0x8d643d[_0x2975('0x25')];this[_0x2975('0x26')]=_0x8d643d[_0x2975('0x26')]||'progressive';this['dialLimitChannel']=_0x8d643d[_0x2975('0x27')]||0x0;this[_0x2975('0x28')]=_0x8d643d[_0x2975('0x28')]||0x0;this[_0x2975('0x29')]=_0x8d643d[_0x2975('0x29')]||0x1;this[_0x2975('0x2a')]=_0x8d643d[_0x2975('0x2a')]||'dropRate';this[_0x2975('0x2b')]=_0x8d643d[_0x2975('0x2b')]||0.03;this[_0x2975('0x2c')]=_0x8d643d[_0x2975('0x2c')]||0x258;this[_0x2975('0x2d')]=_0x8d643d[_0x2975('0x2d')]||_0x2975('0x2e');this['dialOriginateCallerIdNumber']=_0x8d643d[_0x2975('0x2f')]||_0x2975('0x2e');this['dialOriginateTimeout']=_0x8d643d[_0x2975('0x30')]||0x1e;this[_0x2975('0x31')]=_0x8d643d['dialQueueOptions']||_0x2975('0x32');this[_0x2975('0x33')]=_0x8d643d[_0x2975('0x33')]||0x3;this[_0x2975('0x34')]=_0x8d643d[_0x2975('0x34')]||undefined;this[_0x2975('0x35')]=_0x8d643d['dialCongestionMaxRetry']||0x3;this[_0x2975('0x36')]=_0x8d643d['dialCongestionRetryFrequency']||0x96;this[_0x2975('0x37')]=_0x8d643d[_0x2975('0x37')]||0x3;this[_0x2975('0x38')]=_0x8d643d['dialBusyRetryFrequency']||0x96;this[_0x2975('0x39')]=_0x8d643d['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x8d643d['dialNoAnswerRetryFrequency']||0x96;this[_0x2975('0x3a')]=_0x8d643d['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x8d643d['dialNoSuchNumberRetryFrequency']||0x96;this[_0x2975('0x3b')]=_0x8d643d[_0x2975('0x3b')]||0x3;this['dialDropRetryFrequency']=_0x8d643d['dialDropRetryFrequency']||0x96;this[_0x2975('0x3c')]=_0x8d643d['dialAbandonedMaxRetry']||0x3;this[_0x2975('0x3d')]=_0x8d643d[_0x2975('0x3d')]||0x96;this['dialMachineMaxRetry']=_0x8d643d[_0x2975('0x3e')]||0x3;this[_0x2975('0x3f')]=_0x8d643d[_0x2975('0x3f')]||0x96;this['dialAgentRejectMaxRetry']=_0x8d643d[_0x2975('0x40')]||0x3;this[_0x2975('0x41')]=_0x8d643d['dialAgentRejectRetryFrequency']||0x96;this[_0x2975('0x42')]=_0x8d643d[_0x2975('0x42')]||0x3;this[_0x2975('0x43')]=_0x8d643d[_0x2975('0x43')]||0x4;this[_0x2975('0x44')]=_0x8d643d[_0x2975('0x44')]?_0x8d643d[_0x2975('0x44')]:undefined;this[_0x2975('0x45')]=_0x8d643d[_0x2975('0x45')]?_0x8d643d[_0x2975('0x45')]:undefined;this[_0x2975('0x46')]=_0x8d643d[_0x2975('0x46')]||undefined;this[_0x2975('0x47')]=_0x8d643d[_0x2975('0x47')]?_0x8d643d[_0x2975('0x47')]:undefined;this[_0x2975('0x48')]=_0x8d643d[_0x2975('0x48')]||_0x2975('0x49');this['dialRandomLastDigitCallerIdNumber']=_0x8d643d[_0x2975('0x4a')]||undefined;this[_0x2975('0x4b')]=_0x8d643d[_0x2975('0x4b')]||undefined;this['strategy']=strategy[_0x8d643d[_0x2975('0x4c')]];this['queueStatusComplete']=!![];this[_0x2975('0x4d')]=_0x8d643d[_0x2975('0x4d')]||![];this[_0x2975('0x4e')]=_0x8d643d[_0x2975('0x4e')];this[_0x2975('0x4f')]=_0x8d643d[_0x2975('0x4f')];this[_0x2975('0x50')]=_0x8d643d[_0x2975('0x50')];this[_0x2975('0x51')]=_0x8d643d[_0x2975('0x51')];this[_0x2975('0x52')]=_0x8d643d['dialAMDMinWordLength'];this[_0x2975('0x53')]=_0x8d643d['dialAMDBetweenWordsSilence'];this[_0x2975('0x54')]=_0x8d643d[_0x2975('0x54')];this[_0x2975('0x55')]=_0x8d643d[_0x2975('0x55')];this['dialAMDMaximumWordLength']=_0x8d643d['dialAMDMaximumWordLength'];this[_0x2975('0x56')]=0x0;this[_0x2975('0x57')]=0x0;this[_0x2975('0x58')]=_0x8d643d['timeout'];this[_0x2975('0x59')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x2975('0x5a')]=0x0;this[_0x2975('0x5b')]=0x0;this[_0x2975('0x5c')]=0x0;this[_0x2975('0x5d')]=0x0;this[_0x2975('0x5e')]=0x0;this[_0x2975('0x5f')]=0x0;this[_0x2975('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x2975('0x61')]=0x0;this[_0x2975('0x62')]=0x0;this[_0x2975('0x63')]=undefined;this[_0x2975('0x64')]=undefined;this[_0x2975('0x65')]=undefined;this[_0x2975('0x66')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x2975('0x67')]=0x0;this[_0x2975('0x68')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x2975('0x69')]=0x0;this[_0x2975('0x6a')]=0x0;this[_0x2975('0x6b')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x2975('0x6c')]=_0x8d643d['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x2975('0x6d')]=_0x8d643d['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x2975('0x6e')]=0x0;this[_0x2975('0x6f')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x2975('0x70')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x2975('0x71')]=0x0;this[_0x2975('0x72')]=_0x8d643d[_0x2975('0x72')]||0x1e;this[_0x2975('0x73')]=_0x8d643d['dialRecallInQueue']||![];this[_0x2975('0x74')]=!!_0x8d643d[_0x2975('0x74')]||![];this[_0x2975('0x75')]=!!_0x8d643d['dialPreviewRecallmeReminder']||![];this[_0x2975('0x76')]=_0x8d643d[_0x2975('0x76')]||undefined;this[_0x2975('0x77')]=_0x8d643d['dialAgiAfterHangupClient']||![];this[_0x2975('0x78')]=_0x8d643d[_0x2975('0x78')]||![];this[_0x2975('0xb')]=monitorFormat[_0x8d643d[_0x2975('0xb')]]?monitorFormat[_0x8d643d['monitor_format']]:undefined;this[_0x2975('0x79')]=_0x8d643d[_0x2975('0x79')]||![];this['mandatoryDispositionPause']=_0x8d643d[_0x2975('0x7a')]?_0x8d643d[_0x2975('0x7a')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x2975('0x7b')]=VoiceQueue; \ No newline at end of file +var _0x7c49=['progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','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','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','strategy','queueStatusComplete','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','leastrecent','random','ringall','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','abandoned','available','inUse','invalid','loggedIn','paused','ringing','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7c49,0x141));var _0x97c4=function(_0x1d1ed1,_0x274cb8){_0x1d1ed1=_0x1d1ed1-0x0;var _0xcc79a5=_0x7c49[_0x1d1ed1];return _0xcc79a5;};'use strict';var monitorFormat={'wav':_0x97c4('0x0'),'wav49':_0x97c4('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x97c4('0x2'),'linear':'linear','random':_0x97c4('0x3'),'ringall':_0x97c4('0x4'),'rr':'roundrobin','rrmemory':'rrmemory','rrordered':_0x97c4('0x5'),'wrandom':_0x97c4('0x6')};function VoiceQueue(_0x2f02ec){this['id']=_0x2f02ec['id']||0x0;this['name']=_0x2f02ec[_0x97c4('0x7')]||'';this[_0x97c4('0x8')]=_0x2f02ec[_0x97c4('0x8')]||'';this[_0x97c4('0x9')]=_0x2f02ec[_0x97c4('0x9')]||_0x97c4('0xa');this[_0x97c4('0xb')]=0x0;this[_0x97c4('0xc')]=0x0;this[_0x97c4('0xd')]=0x0;this[_0x97c4('0xe')]=0x0;this[_0x97c4('0xf')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0x97c4('0x10')]=0x0;this[_0x97c4('0x11')]=0x0;this['busy']=0x0;this[_0x97c4('0x12')]=0x0;this[_0x97c4('0x13')]=0x0;this[_0x97c4('0x14')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0x97c4('0x15')]=0x0;this[_0x97c4('0x16')]=0x0;this['ringInUse']=0x0;this[_0x97c4('0x17')]=0x0;this['unavailable']=0x0;this[_0x97c4('0x18')]=0x0;this[_0x97c4('0x19')]=_0x2f02ec[_0x97c4('0x19')]||![];this[_0x97c4('0x1a')]=_0x2f02ec[_0x97c4('0x1a')]||0xa;this[_0x97c4('0x1b')]=_0x2f02ec['autopause']||'no';this[_0x97c4('0x1c')]=!![];this['message']='';this[_0x97c4('0x1d')]='';this[_0x97c4('0x1e')]=0x0;this[_0x97c4('0x1f')]=0x0;this[_0x97c4('0x20')]=_0x2f02ec[_0x97c4('0x20')]||null;this[_0x97c4('0x21')]=_0x2f02ec[_0x97c4('0x21')]?_0x2f02ec[_0x97c4('0x21')]:null;this[_0x97c4('0x22')]=_0x2f02ec[_0x97c4('0x22')];this['dialMethod']=_0x2f02ec[_0x97c4('0x23')]||_0x97c4('0x24');this[_0x97c4('0x25')]=_0x2f02ec['dialLimitChannel']||0x0;this[_0x97c4('0x26')]=_0x2f02ec[_0x97c4('0x26')]||0x0;this[_0x97c4('0x27')]=_0x2f02ec['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x2f02ec['dialPredictiveOptimization']||'dropRate';this[_0x97c4('0x28')]=_0x2f02ec[_0x97c4('0x28')]||0.03;this[_0x97c4('0x29')]=_0x2f02ec[_0x97c4('0x29')]||0x258;this[_0x97c4('0x2a')]=_0x2f02ec[_0x97c4('0x2a')]||_0x97c4('0x2b');this[_0x97c4('0x2c')]=_0x2f02ec[_0x97c4('0x2c')]||_0x97c4('0x2b');this[_0x97c4('0x2d')]=_0x2f02ec[_0x97c4('0x2d')]||0x1e;this[_0x97c4('0x2e')]=_0x2f02ec['dialQueueOptions']||_0x97c4('0x2f');this[_0x97c4('0x30')]=_0x2f02ec[_0x97c4('0x30')]||0x3;this['dialQueueProject']=_0x2f02ec[_0x97c4('0x31')]||undefined;this['dialCongestionMaxRetry']=_0x2f02ec[_0x97c4('0x32')]||0x3;this[_0x97c4('0x33')]=_0x2f02ec[_0x97c4('0x33')]||0x96;this[_0x97c4('0x34')]=_0x2f02ec[_0x97c4('0x34')]||0x3;this[_0x97c4('0x35')]=_0x2f02ec[_0x97c4('0x35')]||0x96;this[_0x97c4('0x36')]=_0x2f02ec[_0x97c4('0x36')]||0x3;this[_0x97c4('0x37')]=_0x2f02ec[_0x97c4('0x37')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2f02ec[_0x97c4('0x38')]||0x3;this[_0x97c4('0x39')]=_0x2f02ec['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x2f02ec[_0x97c4('0x3a')]||0x3;this['dialDropRetryFrequency']=_0x2f02ec[_0x97c4('0x3b')]||0x96;this['dialAbandonedMaxRetry']=_0x2f02ec[_0x97c4('0x3c')]||0x3;this[_0x97c4('0x3d')]=_0x2f02ec[_0x97c4('0x3d')]||0x96;this[_0x97c4('0x3e')]=_0x2f02ec[_0x97c4('0x3e')]||0x3;this[_0x97c4('0x3f')]=_0x2f02ec[_0x97c4('0x3f')]||0x96;this[_0x97c4('0x40')]=_0x2f02ec[_0x97c4('0x40')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2f02ec['dialAgentRejectRetryFrequency']||0x96;this[_0x97c4('0x41')]=_0x2f02ec[_0x97c4('0x41')]||0x3;this[_0x97c4('0x42')]=_0x2f02ec[_0x97c4('0x42')]||0x4;this[_0x97c4('0x43')]=_0x2f02ec[_0x97c4('0x43')]?_0x2f02ec[_0x97c4('0x43')]:undefined;this[_0x97c4('0x44')]=_0x2f02ec['TrunkBackup']?_0x2f02ec[_0x97c4('0x44')]:undefined;this[_0x97c4('0x45')]=_0x2f02ec[_0x97c4('0x45')]||undefined;this[_0x97c4('0x46')]=_0x2f02ec[_0x97c4('0x46')]?_0x2f02ec[_0x97c4('0x46')]:undefined;this[_0x97c4('0x47')]=_0x2f02ec['dialOrderByScheduledAt']||_0x97c4('0x48');this['dialRandomLastDigitCallerIdNumber']=_0x2f02ec['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x97c4('0x49')]=_0x2f02ec[_0x97c4('0x49')]||undefined;this[_0x97c4('0x4a')]=strategy[_0x2f02ec[_0x97c4('0x4a')]];this[_0x97c4('0x4b')]=!![];this['dialAMDActive']=_0x2f02ec['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x2f02ec['dialAMDInitialSilence'];this[_0x97c4('0x4c')]=_0x2f02ec[_0x97c4('0x4c')];this[_0x97c4('0x4d')]=_0x2f02ec[_0x97c4('0x4d')];this[_0x97c4('0x4e')]=_0x2f02ec[_0x97c4('0x4e')];this[_0x97c4('0x4f')]=_0x2f02ec['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x2f02ec[_0x97c4('0x50')];this[_0x97c4('0x51')]=_0x2f02ec['dialAMDMaximumNumberOfWords'];this[_0x97c4('0x52')]=_0x2f02ec['dialAMDSilenceThreshold'];this[_0x97c4('0x53')]=_0x2f02ec[_0x97c4('0x53')];this[_0x97c4('0x54')]=0x0;this['pTalking']=0x0;this[_0x97c4('0x55')]=_0x2f02ec[_0x97c4('0x55')];this[_0x97c4('0x56')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x97c4('0x57')]=0x0;this[_0x97c4('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x97c4('0x59')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x97c4('0x5a')]=0x0;this[_0x97c4('0x5b')]=0x0;this[_0x97c4('0x5c')]=0x0;this[_0x97c4('0x5d')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x97c4('0x5e')]=0x0;this[_0x97c4('0x5f')]=0x0;this[_0x97c4('0x60')]=undefined;this[_0x97c4('0x61')]=undefined;this['handlePredictive']=undefined;this[_0x97c4('0x62')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x97c4('0x63')]=0x0;this[_0x97c4('0x64')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x97c4('0x65')]=0x0;this[_0x97c4('0x66')]=0x0;this[_0x97c4('0x67')]=0x0;this[_0x97c4('0x68')]=_0x2f02ec[_0x97c4('0x69')]||0x14;this[_0x97c4('0x6a')]=_0x2f02ec[_0x97c4('0x69')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x97c4('0x6b')]=0x1;this[_0x97c4('0x6c')]=0x0;this[_0x97c4('0x6d')]=0x0;this[_0x97c4('0x6e')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x2f02ec['dialRecallMeTimeout']||0x1e;this[_0x97c4('0x6f')]=_0x2f02ec['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0x2f02ec['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x2f02ec[_0x97c4('0x70')]||![];this['dialQueueProject2']=_0x2f02ec[_0x97c4('0x71')]||undefined;this['dialAgiAfterHangupClient']=_0x2f02ec['dialAgiAfterHangupClient']||![];this[_0x97c4('0x72')]=_0x2f02ec[_0x97c4('0x72')]||![];this[_0x97c4('0x8')]=monitorFormat[_0x2f02ec[_0x97c4('0x8')]]?monitorFormat[_0x2f02ec[_0x97c4('0x8')]]:undefined;this[_0x97c4('0x73')]=_0x2f02ec['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x2f02ec[_0x97c4('0x74')]?_0x2f02ec[_0x97c4('0x74')]:undefined;this[_0x97c4('0x75')]=![];}module[_0x97c4('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index c271453..5cae7da 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf95f=['dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','name','callerid','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','exten','prototype','compareToInboundQueue','some','compareToOutboundQueue','dialActive','active','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x1c3f8e,_0x2f7794){var _0x40b720=function(_0xd92bec){while(--_0xd92bec){_0x1c3f8e['push'](_0x1c3f8e['shift']());}};_0x40b720(++_0x2f7794);}(_0xf95f,0x142));var _0xff95=function(_0x134764,_0x112da5){_0x134764=_0x134764-0x0;var _0x2fe527=_0xf95f[_0x134764];return _0x2fe527;};'use strict';var INBOUND_COUNTERS=[_0xff95('0x0'),_0xff95('0x1'),_0xff95('0x2'),_0xff95('0x3'),_0xff95('0x4'),_0xff95('0x5'),_0xff95('0x6')];var OUTBOUND_COUNTERS=[_0xff95('0x0'),_0xff95('0x7'),'inUse',_0xff95('0x1'),'loggedInDb',_0xff95('0x8'),'outboundAbandonedCallsDay',_0xff95('0x9'),_0xff95('0xa'),_0xff95('0xb'),_0xff95('0xc'),_0xff95('0xd'),_0xff95('0xe'),_0xff95('0xf'),_0xff95('0x10'),'outboundUnknownCallsDay','paused',_0xff95('0x11'),_0xff95('0x5'),_0xff95('0x12'),_0xff95('0x13'),_0xff95('0x14'),_0xff95('0x6')];function VoiceQueueSummary(_0x26647e){this['id']=_0x26647e['id'];this['name']=_0x26647e['name'];this[_0xff95('0x15')]=_0x26647e[_0xff95('0x15')];this['abandoned']=_0x26647e[_0xff95('0x16')]||0x0;this['answered']=_0x26647e['answered']||0x0;this['available']=_0x26647e[_0xff95('0x0')]||0x0;this[_0xff95('0x17')]=_0x26647e[_0xff95('0x17')]||0x0;this[_0xff95('0x18')]=_0x26647e[_0xff95('0x18')]||0x0;this[_0xff95('0x19')]=_0x26647e['invalid']||0x0;this['loggedIn']=_0x26647e[_0xff95('0x1')]||0x0;this[_0xff95('0x2')]=_0x26647e[_0xff95('0x2')]||0x0;this[_0xff95('0x1a')]=_0x26647e[_0xff95('0x1a')]||0x0;this[_0xff95('0x1b')]=_0x26647e['notInUse']||0x0;this[_0xff95('0x3')]=_0x26647e[_0xff95('0x3')]||0x0;this[_0xff95('0x4')]=_0x26647e['ringing']||0x0;this['ringInUse']=_0x26647e[_0xff95('0x1c')];this['sumBillable']=_0x26647e[_0xff95('0x12')];this[_0xff95('0x13')]=_0x26647e[_0xff95('0x13')];this[_0xff95('0x1d')]=_0x26647e[_0xff95('0x1d')]||0x0;this[_0xff95('0x5')]=_0x26647e[_0xff95('0x5')]||0x0;this[_0xff95('0x14')]=_0x26647e[_0xff95('0x14')]||0x0;this[_0xff95('0x1e')]=_0x26647e[_0xff95('0x1e')];this['unavailable']=_0x26647e[_0xff95('0x1f')]||0x0;this[_0xff95('0x20')]=_0x26647e[_0xff95('0x20')]||0x0;this[_0xff95('0x21')]=_0x26647e[_0xff95('0x21')]||0x0;this[_0xff95('0x6')]=_0x26647e[_0xff95('0x6')]||0x0;if(_0x26647e[_0xff95('0x1e')]===_0xff95('0x22')){this[_0xff95('0x11')]=_0x26647e['pTalking']||0x0;this['dialActive']=_0x26647e['dialActive'];this['dialMethod']=_0x26647e[_0xff95('0x23')];this[_0xff95('0x24')]=_0x26647e[_0xff95('0x24')];this[_0xff95('0x25')]=_0x26647e[_0xff95('0x25')];this['dialOriginateTimeout']=_0x26647e[_0xff95('0x26')];this[_0xff95('0x27')]=_0x26647e[_0xff95('0x27')];this[_0xff95('0x28')]=_0x26647e[_0xff95('0x28')];this[_0xff95('0x29')]=_0x26647e[_0xff95('0x29')];this[_0xff95('0x9')]=_0x26647e[_0xff95('0x9')];this['outboundBlacklistCallsDay']=_0x26647e[_0xff95('0xa')];this[_0xff95('0xb')]=_0x26647e['outboundBusyCallsDay'];this[_0xff95('0xc')]=_0x26647e['outboundCongestionCallsDay'];this[_0xff95('0x2a')]=_0x26647e['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x26647e[_0xff95('0x2b')];this[_0xff95('0x2c')]=_0x26647e[_0xff95('0x2c')];this[_0xff95('0xd')]=_0x26647e[_0xff95('0xd')];this['outboundNoSuchCallsDay']=_0x26647e['outboundNoSuchCallsDay'];this[_0xff95('0x2d')]=_0x26647e['outboundOriginateFailureCallsDay'];this[_0xff95('0xf')]=_0x26647e['outboundReCallsDay'];this[_0xff95('0x10')]=_0x26647e['outboundRejectCallsDay'];this[_0xff95('0x2e')]=_0x26647e[_0xff95('0x2e')];this[_0xff95('0x2f')]=_0x26647e[_0xff95('0x2f')];this[_0xff95('0x30')]=_0x26647e[_0xff95('0x30')];this[_0xff95('0x31')]=_0x26647e[_0xff95('0x31')];this[_0xff95('0x32')]=_0x26647e[_0xff95('0x32')];this[_0xff95('0x33')]=_0x26647e[_0xff95('0x33')];this[_0xff95('0x34')]=_0x26647e[_0xff95('0x34')];this[_0xff95('0x35')]=_0x26647e[_0xff95('0x35')];this[_0xff95('0x36')]=_0x26647e[_0xff95('0x36')];this['predictiveIntervalMultiplicativeFactor']=_0x26647e[_0xff95('0x37')];this[_0xff95('0x38')]=_0x26647e[_0xff95('0x38')];this[_0xff95('0x39')]=_0x26647e[_0xff95('0x39')];this['predictiveIntervalTotalCalls']=_0x26647e['predictiveIntervalTotalCalls'];this[_0xff95('0x8')]=_0x26647e[_0xff95('0x8')];this[_0xff95('0x3a')]=_0x26647e[_0xff95('0x3a')];this['erlangCallToSecond']=_0x26647e[_0xff95('0x3b')];this[_0xff95('0x3c')]=_0x26647e[_0xff95('0x3c')];this['erlangBusyFactor']=_0x26647e[_0xff95('0x3d')];this[_0xff95('0x3e')]=_0x26647e[_0xff95('0x3e')];this[_0xff95('0x3f')]=_0x26647e[_0xff95('0x3f')];this[_0xff95('0x40')]=_0x26647e[_0xff95('0x40')];this[_0xff95('0x41')]=_0x26647e[_0xff95('0x41')];}if(_0x26647e[_0xff95('0x42')]){this[_0xff95('0x42')]={'id':_0x26647e[_0xff95('0x42')]['id'],'name':_0x26647e[_0xff95('0x42')][_0xff95('0x43')],'active':_0x26647e['Trunk']['active'],'callerid':_0x26647e['Trunk'][_0xff95('0x44')]};}}VoiceQueueSummary['prototype']['createReport']=function(_0x482f91,_0x509efa,_0xca015e,_0x5911c4){this['loggedInDb']=0x0;this[_0xff95('0x5')]=0x0;this[_0xff95('0x3')]=0x0;this[_0xff95('0x20')]=0x0;this[_0xff95('0x1b')]=0x0;this[_0xff95('0x18')]=0x0;this['busy']=0x0;this['invalid']=0x0;this[_0xff95('0x1f')]=0x0;this[_0xff95('0x4')]=0x0;this[_0xff95('0x1c')]=0x0;this['onHold']=0x0;if(_0xca015e){if(_0xca015e[_0xff95('0x0')]){this[_0xff95('0x0')]=Number(_0xca015e[_0xff95('0x0')]);}if(_0xca015e[_0xff95('0x45')]){this['loggedIn']=Number(_0xca015e[_0xff95('0x45')]);}if(_0xca015e['callers']){this[_0xff95('0x6')]=Number(_0xca015e[_0xff95('0x46')]);}}for(var _0x576c21=0x0;_0x576c21<_0x482f91[_0xff95('0x47')];_0x576c21++){var _0x17ce37=_0x509efa[_0xff95('0x48')+_0x482f91[_0x576c21][_0xff95('0x43')]];if(_0x17ce37&&_0x17ce37[_0xff95('0x49')]){this[_0xff95('0x2')]+=0x1;}if(_0x482f91[_0x576c21][_0xff95('0x4a')]==='1'){this[_0xff95('0x5')]+=0x1;}if(_0x482f91[_0x576c21]['paused']==='1'&&!['2','7','8'][_0xff95('0x4b')](_0x482f91[_0x576c21][_0xff95('0x4c')])){this[_0xff95('0x3')]+=0x1;}switch(_0x482f91[_0x576c21][_0xff95('0x4c')]){case'0':this[_0xff95('0x20')]+=0x1;break;case'1':this[_0xff95('0x1b')]+=0x1;break;case'2':this[_0xff95('0x18')]+=0x1;break;case'3':this[_0xff95('0x17')]+=0x1;break;case'4':this[_0xff95('0x19')]+=0x1;break;case'5':this[_0xff95('0x1f')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xff95('0x23')]===_0xff95('0x4d')){var _0xb56ef3=Object[_0xff95('0x4e')](_0x5911c4);for(var _0x385b61=0x0;_0x385b61<_0xb56ef3['length'];_0x385b61++){var _0x7eece0=_0xb56ef3[_0x385b61];var _0x25db87=_0x5911c4[_0x7eece0];if(_0x25db87[_0xff95('0x4f')]===this[_0xff95('0x43')]&&_0x25db87['type']==='dialer'&&_0x25db87[_0xff95('0x50')]==='xcally-motion-preview'){this[_0xff95('0x5')]+=0x1;}}if(this[_0xff95('0x5')]>this[_0xff95('0x18')]){this['talking']=this[_0xff95('0x18')];}this[_0xff95('0x11')]=0x0;}return this;};VoiceQueueSummary[_0xff95('0x51')][_0xff95('0x52')]=function(_0x57f04c){var _0x59e206=![];if(_0x57f04c){_0x59e206=INBOUND_COUNTERS[_0xff95('0x53')](function(_0x400f2d){return this[_0x400f2d]!==_0x57f04c[_0x400f2d];},this);}return _0x59e206;};VoiceQueueSummary[_0xff95('0x51')][_0xff95('0x54')]=function(_0x303e37){var _0x7e71f0=![];var _0x80b5bb=![];var _0x55016e=![];if(_0x303e37){_0x7e71f0=this[_0xff95('0x23')]!==_0x303e37[_0xff95('0x23')]||this[_0xff95('0x55')]!==_0x303e37[_0xff95('0x55')]||this['message']!==_0x303e37['message']||this[_0xff95('0x41')]!==_0x303e37[_0xff95('0x41')];_0x80b5bb=OUTBOUND_COUNTERS[_0xff95('0x53')](function(_0x251350){return this[_0x251350]!==_0x303e37[_0x251350];},this);if(this['Trunk']&&_0x303e37[_0xff95('0x42')]){_0x55016e=this[_0xff95('0x42')][_0xff95('0x43')]!==_0x303e37['Trunk'][_0xff95('0x43')]||this[_0xff95('0x42')][_0xff95('0x56')]!==_0x303e37['Trunk'][_0xff95('0x56')];}}return _0x7e71f0||_0x80b5bb||_0x55016e;};VoiceQueueSummary[_0xff95('0x51')][_0xff95('0x57')]=function(_0x14acf3){this['answered']=_0x14acf3[_0xff95('0x7')];this[_0xff95('0x40')]=_0x14acf3[_0xff95('0x40')];this[_0xff95('0x41')]=_0x14acf3[_0xff95('0x41')];this[_0xff95('0x8')]=_0x14acf3['originated'];this[_0xff95('0x58')]=_0x14acf3[_0xff95('0x58')];this['outboundAnswerCallsDay']=_0x14acf3['outboundAnswerCallsDay'];this[_0xff95('0xa')]=_0x14acf3[_0xff95('0xa')];this[_0xff95('0xb')]=_0x14acf3[_0xff95('0xb')];this[_0xff95('0xc')]=_0x14acf3[_0xff95('0xc')];this['outboundNoAnswerCallsDay']=_0x14acf3['outboundNoAnswerCallsDay'];this[_0xff95('0xe')]=_0x14acf3[_0xff95('0xe')];this['outboundReCallsDay']=_0x14acf3[_0xff95('0xf')];this[_0xff95('0x10')]=_0x14acf3[_0xff95('0x10')];this[_0xff95('0x2e')]=_0x14acf3['outboundUnknownCallsDay'];this[_0xff95('0x12')]=_0x14acf3[_0xff95('0x12')];this['sumDuration']=_0x14acf3[_0xff95('0x13')];this[_0xff95('0x14')]=_0x14acf3[_0xff95('0x14')];if(this['dialMethod']===_0xff95('0x59')){this['pTalking']=_0x14acf3[_0xff95('0x11')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0xeedf=['startProgressive','statusMessage','Trunk','name','active','callerid','prototype','createReport','callers','SIP/','online','incall','status','booked','length','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','dialActive','message','updateReportFromOutboundQueue','outboundAbandonedCallsDay','exports','available','loggedIn','loggedInDb','ringing','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundUnknownCallsDay','paused','pTalking','talking','sumDuration','total','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0xeedf,0x12c));var _0xfeed=function(_0x9c6c46,_0x21ad67){_0x9c6c46=_0x9c6c46-0x0;var _0x339663=_0xeedf[_0x9c6c46];return _0x339663;};'use strict';var INBOUND_COUNTERS=[_0xfeed('0x0'),_0xfeed('0x1'),_0xfeed('0x2'),'paused',_0xfeed('0x3'),'talking',_0xfeed('0x4')];var OUTBOUND_COUNTERS=[_0xfeed('0x0'),_0xfeed('0x5'),_0xfeed('0x6'),'loggedIn',_0xfeed('0x2'),_0xfeed('0x7'),'outboundAbandonedCallsDay',_0xfeed('0x8'),'outboundBlacklistCallsDay',_0xfeed('0x9'),'outboundCongestionCallsDay',_0xfeed('0xa'),'outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay',_0xfeed('0xb'),_0xfeed('0xc'),_0xfeed('0xd'),_0xfeed('0xe'),'sumBillable',_0xfeed('0xf'),_0xfeed('0x10'),_0xfeed('0x4')];function VoiceQueueSummary(_0x1aa14a){this['id']=_0x1aa14a['id'];this['name']=_0x1aa14a['name'];this[_0xfeed('0x11')]=_0x1aa14a[_0xfeed('0x11')];this[_0xfeed('0x12')]=_0x1aa14a[_0xfeed('0x12')]||0x0;this[_0xfeed('0x5')]=_0x1aa14a[_0xfeed('0x5')]||0x0;this['available']=_0x1aa14a[_0xfeed('0x0')]||0x0;this[_0xfeed('0x13')]=_0x1aa14a[_0xfeed('0x13')]||0x0;this[_0xfeed('0x6')]=_0x1aa14a[_0xfeed('0x6')]||0x0;this[_0xfeed('0x14')]=_0x1aa14a[_0xfeed('0x14')]||0x0;this[_0xfeed('0x1')]=_0x1aa14a[_0xfeed('0x1')]||0x0;this[_0xfeed('0x2')]=_0x1aa14a[_0xfeed('0x2')]||0x0;this[_0xfeed('0x15')]=_0x1aa14a[_0xfeed('0x15')]||0x0;this[_0xfeed('0x16')]=_0x1aa14a['notInUse']||0x0;this[_0xfeed('0xc')]=_0x1aa14a[_0xfeed('0xc')]||0x0;this[_0xfeed('0x3')]=_0x1aa14a[_0xfeed('0x3')]||0x0;this[_0xfeed('0x17')]=_0x1aa14a[_0xfeed('0x17')];this[_0xfeed('0x18')]=_0x1aa14a[_0xfeed('0x18')];this[_0xfeed('0xf')]=_0x1aa14a[_0xfeed('0xf')];this['sumHoldTime']=_0x1aa14a[_0xfeed('0x19')]||0x0;this[_0xfeed('0xe')]=_0x1aa14a[_0xfeed('0xe')]||0x0;this['total']=_0x1aa14a[_0xfeed('0x10')]||0x0;this[_0xfeed('0x1a')]=_0x1aa14a[_0xfeed('0x1a')];this[_0xfeed('0x1b')]=_0x1aa14a[_0xfeed('0x1b')]||0x0;this[_0xfeed('0x1c')]=_0x1aa14a[_0xfeed('0x1c')]||0x0;this[_0xfeed('0x1d')]=_0x1aa14a[_0xfeed('0x1d')]||0x0;this[_0xfeed('0x4')]=_0x1aa14a[_0xfeed('0x4')]||0x0;if(_0x1aa14a[_0xfeed('0x1a')]===_0xfeed('0x1e')){this[_0xfeed('0xd')]=_0x1aa14a['pTalking']||0x0;this['dialActive']=_0x1aa14a['dialActive'];this[_0xfeed('0x1f')]=_0x1aa14a[_0xfeed('0x1f')];this['dialOriginateCallerIdName']=_0x1aa14a[_0xfeed('0x20')];this[_0xfeed('0x21')]=_0x1aa14a[_0xfeed('0x21')];this[_0xfeed('0x22')]=_0x1aa14a['dialOriginateTimeout'];this[_0xfeed('0x23')]=_0x1aa14a[_0xfeed('0x23')];this[_0xfeed('0x24')]=_0x1aa14a['temp'];this[_0xfeed('0x25')]=_0x1aa14a[_0xfeed('0x25')];this['outboundAnswerCallsDay']=_0x1aa14a[_0xfeed('0x8')];this['outboundBlacklistCallsDay']=_0x1aa14a[_0xfeed('0x26')];this[_0xfeed('0x9')]=_0x1aa14a[_0xfeed('0x9')];this[_0xfeed('0x27')]=_0x1aa14a[_0xfeed('0x27')];this[_0xfeed('0x28')]=_0x1aa14a[_0xfeed('0x28')];this[_0xfeed('0x29')]=_0x1aa14a[_0xfeed('0x29')];this[_0xfeed('0x2a')]=_0x1aa14a[_0xfeed('0x2a')];this['outboundNoAnswerCallsDay']=_0x1aa14a['outboundNoAnswerCallsDay'];this[_0xfeed('0x2b')]=_0x1aa14a[_0xfeed('0x2b')];this[_0xfeed('0x2c')]=_0x1aa14a[_0xfeed('0x2c')];this[_0xfeed('0x2d')]=_0x1aa14a[_0xfeed('0x2d')];this[_0xfeed('0x2e')]=_0x1aa14a[_0xfeed('0x2e')];this['outboundUnknownCallsDay']=_0x1aa14a[_0xfeed('0xb')];this['predictiveIntervalAnsweredCalls']=_0x1aa14a[_0xfeed('0x2f')];this[_0xfeed('0x30')]=_0x1aa14a['predictiveIntervalAvgHoldtime'];this[_0xfeed('0x31')]=_0x1aa14a[_0xfeed('0x31')];this['predictiveIntervalDroppedCallsCallersExit']=_0x1aa14a[_0xfeed('0x32')];this['predictiveIntervalDroppedCallsTimeout']=_0x1aa14a[_0xfeed('0x33')];this[_0xfeed('0x34')]=_0x1aa14a[_0xfeed('0x34')];this[_0xfeed('0x35')]=_0x1aa14a['predictiveIntervalErlangCallsDroppedCalls'];this[_0xfeed('0x36')]=_0x1aa14a['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0x1aa14a[_0xfeed('0x37')];this[_0xfeed('0x38')]=_0x1aa14a[_0xfeed('0x38')];this[_0xfeed('0x39')]=_0x1aa14a[_0xfeed('0x39')];this[_0xfeed('0x3a')]=_0x1aa14a[_0xfeed('0x3a')];this[_0xfeed('0x7')]=_0x1aa14a[_0xfeed('0x7')];this['erlangCalls']=_0x1aa14a[_0xfeed('0x3b')];this[_0xfeed('0x3c')]=_0x1aa14a['erlangCallToSecond'];this[_0xfeed('0x3d')]=_0x1aa14a[_0xfeed('0x3d')];this['erlangBusyFactor']=_0x1aa14a[_0xfeed('0x3e')];this[_0xfeed('0x3f')]=_0x1aa14a[_0xfeed('0x3f')];this['startProgressive']=_0x1aa14a[_0xfeed('0x40')];this['message']=_0x1aa14a['message'];this[_0xfeed('0x41')]=_0x1aa14a[_0xfeed('0x41')];}if(_0x1aa14a['Trunk']){this[_0xfeed('0x42')]={'id':_0x1aa14a[_0xfeed('0x42')]['id'],'name':_0x1aa14a[_0xfeed('0x42')][_0xfeed('0x43')],'active':_0x1aa14a[_0xfeed('0x42')][_0xfeed('0x44')],'callerid':_0x1aa14a['Trunk'][_0xfeed('0x45')]};}}VoiceQueueSummary[_0xfeed('0x46')][_0xfeed('0x47')]=function(_0x5c8fef,_0x3e3e3a,_0x2d2b8f,_0x54f7a1){this['loggedInDb']=0x0;this[_0xfeed('0xe')]=0x0;this['paused']=0x0;this['unknown']=0x0;this[_0xfeed('0x16')]=0x0;this[_0xfeed('0x6')]=0x0;this[_0xfeed('0x13')]=0x0;this[_0xfeed('0x14')]=0x0;this[_0xfeed('0x1b')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0xfeed('0x15')]=0x0;if(_0x2d2b8f){if(_0x2d2b8f[_0xfeed('0x0')]){this[_0xfeed('0x0')]=Number(_0x2d2b8f[_0xfeed('0x0')]);}if(_0x2d2b8f['loggedin']){this[_0xfeed('0x1')]=Number(_0x2d2b8f['loggedin']);}if(_0x2d2b8f[_0xfeed('0x48')]){this[_0xfeed('0x4')]=Number(_0x2d2b8f['callers']);}}for(var _0x387154=0x0;_0x387154<_0x5c8fef['length'];_0x387154++){var _0x3aa814=_0x3e3e3a[_0xfeed('0x49')+_0x5c8fef[_0x387154][_0xfeed('0x43')]];if(_0x3aa814&&_0x3aa814[_0xfeed('0x4a')]){this[_0xfeed('0x2')]+=0x1;}if(_0x5c8fef[_0x387154][_0xfeed('0x4b')]==='1'){this[_0xfeed('0xe')]+=0x1;}if(_0x5c8fef[_0x387154][_0xfeed('0xc')]==='1'&&!['2','7','8']['includes'](_0x5c8fef[_0x387154][_0xfeed('0x4c')])){this['paused']+=0x1;}switch(_0x5c8fef[_0x387154][_0xfeed('0x4c')]){case'0':this[_0xfeed('0x1c')]+=0x1;break;case'1':this[_0xfeed('0x16')]+=0x1;break;case'2':this[_0xfeed('0x6')]+=0x1;break;case'3':this[_0xfeed('0x13')]+=0x1;break;case'4':this[_0xfeed('0x14')]+=0x1;break;case'5':this[_0xfeed('0x1b')]+=0x1;break;case'6':this[_0xfeed('0x3')]+=0x1;break;case'7':this[_0xfeed('0x17')]+=0x1;break;case'8':this[_0xfeed('0x15')]+=0x1;break;}}if(this[_0xfeed('0x1f')]===_0xfeed('0x4d')){var _0x5b6eee=Object['keys'](_0x54f7a1);for(var _0xeb69cc=0x0;_0xeb69cc<_0x5b6eee[_0xfeed('0x4e')];_0xeb69cc++){var _0x451be9=_0x5b6eee[_0xeb69cc];var _0x44842b=_0x54f7a1[_0x451be9];if(_0x44842b[_0xfeed('0x4f')]===this['name']&&_0x44842b[_0xfeed('0x1a')]===_0xfeed('0x50')&&_0x44842b[_0xfeed('0x51')]===_0xfeed('0x52')){this[_0xfeed('0xe')]+=0x1;}}if(this[_0xfeed('0xe')]>this[_0xfeed('0x6')]){this[_0xfeed('0xe')]=this[_0xfeed('0x6')];}this[_0xfeed('0xd')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0xfeed('0x53')]=function(_0x3c395b){var _0x176b98=![];if(_0x3c395b){_0x176b98=INBOUND_COUNTERS[_0xfeed('0x54')](function(_0x1f3e3a){return this[_0x1f3e3a]!==_0x3c395b[_0x1f3e3a];},this);}return _0x176b98;};VoiceQueueSummary['prototype'][_0xfeed('0x55')]=function(_0x48f7c8){var _0xba0071=![];var _0x18f9d1=![];var _0x5eabae=![];if(_0x48f7c8){_0xba0071=this[_0xfeed('0x1f')]!==_0x48f7c8[_0xfeed('0x1f')]||this['dialActive']!==_0x48f7c8[_0xfeed('0x56')]||this[_0xfeed('0x57')]!==_0x48f7c8['message']||this['statusMessage']!==_0x48f7c8['statusMessage'];_0x18f9d1=OUTBOUND_COUNTERS[_0xfeed('0x54')](function(_0x3c7b2d){return this[_0x3c7b2d]!==_0x48f7c8[_0x3c7b2d];},this);if(this[_0xfeed('0x42')]&&_0x48f7c8[_0xfeed('0x42')]){_0x5eabae=this[_0xfeed('0x42')][_0xfeed('0x43')]!==_0x48f7c8['Trunk'][_0xfeed('0x43')]||this[_0xfeed('0x42')][_0xfeed('0x44')]!==_0x48f7c8[_0xfeed('0x42')]['active'];}}return _0xba0071||_0x18f9d1||_0x5eabae;};VoiceQueueSummary[_0xfeed('0x46')][_0xfeed('0x58')]=function(_0xe5f840){this[_0xfeed('0x5')]=_0xe5f840[_0xfeed('0x5')];this[_0xfeed('0x57')]=_0xe5f840[_0xfeed('0x57')];this[_0xfeed('0x41')]=_0xe5f840[_0xfeed('0x41')];this['originated']=_0xe5f840[_0xfeed('0x7')];this[_0xfeed('0x59')]=_0xe5f840[_0xfeed('0x59')];this[_0xfeed('0x8')]=_0xe5f840[_0xfeed('0x8')];this['outboundBlacklistCallsDay']=_0xe5f840[_0xfeed('0x26')];this[_0xfeed('0x9')]=_0xe5f840[_0xfeed('0x9')];this[_0xfeed('0x27')]=_0xe5f840['outboundCongestionCallsDay'];this[_0xfeed('0xa')]=_0xe5f840[_0xfeed('0xa')];this['outboundNoSuchCallsDay']=_0xe5f840[_0xfeed('0x2b')];this[_0xfeed('0x2d')]=_0xe5f840[_0xfeed('0x2d')];this[_0xfeed('0x2e')]=_0xe5f840[_0xfeed('0x2e')];this['outboundUnknownCallsDay']=_0xe5f840[_0xfeed('0xb')];this[_0xfeed('0x18')]=_0xe5f840[_0xfeed('0x18')];this['sumDuration']=_0xe5f840['sumDuration'];this['total']=_0xe5f840[_0xfeed('0x10')];if(this[_0xfeed('0x1f')]==='preview'){this['pTalking']=_0xe5f840[_0xfeed('0xd')];}};module[_0xfeed('0x5a')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 8663e8b..f25914c 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 _0xddf5=['exports','name','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xddf5,0x97));var _0x5ddf=function(_0x469f0f,_0x895337){_0x469f0f=_0x469f0f-0x0;var _0x5ce7bf=_0xddf5[_0x469f0f];return _0x5ce7bf;};'use strict';function VtigerAccount(_0x261ded){this['id']=_0x261ded['id']||0x0;this[_0x5ddf('0x0')]=_0x261ded['name']||'';this['username']=_0x261ded['username']||'';this[_0x5ddf('0x1')]=_0x261ded[_0x5ddf('0x1')]||'';this['remoteUri']=_0x261ded[_0x5ddf('0x2')]||'';this[_0x5ddf('0x3')]=_0x261ded['serverUrl']||'';this[_0x5ddf('0x4')]=_0x261ded[_0x5ddf('0x4')]||{};}module[_0x5ddf('0x5')]=VtigerAccount; \ No newline at end of file +var _0xddce=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x8cf296,_0x151d36){var _0x1b956d=function(_0x337916){while(--_0x337916){_0x8cf296['push'](_0x8cf296['shift']());}};_0x1b956d(++_0x151d36);}(_0xddce,0x1d3));var _0xeddc=function(_0x5716ff,_0x11586b){_0x5716ff=_0x5716ff-0x0;var _0x675c7=_0xddce[_0x5716ff];return _0x675c7;};'use strict';function VtigerAccount(_0x1374b3){this['id']=_0x1374b3['id']||0x0;this['name']=_0x1374b3[_0xeddc('0x0')]||'';this[_0xeddc('0x1')]=_0x1374b3['username']||'';this[_0xeddc('0x2')]=_0x1374b3[_0xeddc('0x2')]||'';this[_0xeddc('0x3')]=_0x1374b3['remoteUri']||'';this['serverUrl']=_0x1374b3[_0xeddc('0x4')]||'';this[_0xeddc('0x5')]=_0x1374b3['Configurations']||{};}module[_0xeddc('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 fb42292..a7dbf42 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 _0xd9b0=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','authType','type'];(function(_0x28342d,_0x444ec8){var _0x473526=function(_0x2a40b9){while(--_0x2a40b9){_0x28342d['push'](_0x28342d['shift']());}};_0x473526(++_0x444ec8);}(_0xd9b0,0xd6));var _0x0d9b=function(_0xc84302,_0x558251){_0xc84302=_0xc84302-0x0;var _0xff6c2=_0xd9b0[_0xc84302];return _0xff6c2;};'use strict';function ZendeskAccount(_0x14ae49){this['id']=_0x14ae49['id']||0x0;this[_0x0d9b('0x0')]=_0x14ae49['name']||'';this['username']=_0x14ae49[_0x0d9b('0x1')]||'';this[_0x0d9b('0x2')]=_0x14ae49[_0x0d9b('0x2')]||'';this[_0x0d9b('0x3')]=_0x14ae49[_0x0d9b('0x3')]||'';this['remoteUri']=_0x14ae49['remoteUri']||'';this[_0x0d9b('0x4')]=_0x14ae49['authType']||'';this[_0x0d9b('0x5')]=_0x14ae49[_0x0d9b('0x5')]||_0x0d9b('0x6');this[_0x0d9b('0x7')]=_0x14ae49['serverUrl']||'';this[_0x0d9b('0x8')]=_0x14ae49[_0x0d9b('0x8')]||{};}module[_0x0d9b('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xd777=['Configurations','name','username','password','token','remoteUri','type','integrationTab','serverUrl'];(function(_0xed6f46,_0x1c9006){var _0x5b267c=function(_0x59f0d2){while(--_0x59f0d2){_0xed6f46['push'](_0xed6f46['shift']());}};_0x5b267c(++_0x1c9006);}(_0xd777,0x1cc));var _0x7d77=function(_0x100e0c,_0x5523b8){_0x100e0c=_0x100e0c-0x0;var _0x4db1aa=_0xd777[_0x100e0c];return _0x4db1aa;};'use strict';function ZendeskAccount(_0x2ae0d4){this['id']=_0x2ae0d4['id']||0x0;this['name']=_0x2ae0d4[_0x7d77('0x0')]||'';this[_0x7d77('0x1')]=_0x2ae0d4[_0x7d77('0x1')]||'';this['password']=_0x2ae0d4[_0x7d77('0x2')]||'';this[_0x7d77('0x3')]=_0x2ae0d4['token']||'';this[_0x7d77('0x4')]=_0x2ae0d4[_0x7d77('0x4')]||'';this['authType']=_0x2ae0d4['authType']||'';this['type']=_0x2ae0d4[_0x7d77('0x5')]||_0x7d77('0x6');this[_0x7d77('0x7')]=_0x2ae0d4[_0x7d77('0x7')]||'';this[_0x7d77('0x8')]=_0x2ae0d4[_0x7d77('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index f9e1ce3..7f36a6a 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 _0xf121=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x2433a6,_0x30458b){var _0x53dc26=function(_0x4efc0f){while(--_0x4efc0f){_0x2433a6['push'](_0x2433a6['shift']());}};_0x53dc26(++_0x30458b);}(_0xf121,0xec));var _0x1f12=function(_0x3f448b,_0x1c4055){_0x3f448b=_0x3f448b-0x0;var _0x104efd=_0xf121[_0x3f448b];return _0x104efd;};'use strict';function ZohoAccount(_0xe0f860){this['id']=_0xe0f860['id']||0x0;this[_0x1f12('0x0')]=_0xe0f860[_0x1f12('0x0')]||'';this[_0x1f12('0x1')]=_0xe0f860[_0x1f12('0x1')]||'';this['host']=_0xe0f860[_0x1f12('0x2')]||'';this[_0x1f12('0x3')]=_0xe0f860[_0x1f12('0x3')]||'';this['clientId']=_0xe0f860[_0x1f12('0x4')]||'';this[_0x1f12('0x5')]=_0xe0f860['clientSecret']||'';this[_0x1f12('0x6')]=_0xe0f860['serverUrl']||'';this[_0x1f12('0x7')]=_0xe0f860[_0x1f12('0x7')]||'';this[_0x1f12('0x8')]=_0xe0f860[_0x1f12('0x8')]||'';this[_0x1f12('0x9')]=_0xe0f860[_0x1f12('0x9')]||{};}module[_0x1f12('0xa')]=ZohoAccount; \ No newline at end of file +var _0x7a0d=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x12de92,_0x24ef7c){var _0x2d348d=function(_0x28346d){while(--_0x28346d){_0x12de92['push'](_0x12de92['shift']());}};_0x2d348d(++_0x24ef7c);}(_0x7a0d,0x113));var _0xd7a0=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x7a0d[_0x22cc16];return _0x399b70;};'use strict';function ZohoAccount(_0x4f4d91){this['id']=_0x4f4d91['id']||0x0;this[_0xd7a0('0x0')]=_0x4f4d91[_0xd7a0('0x0')]||'';this['description']=_0x4f4d91[_0xd7a0('0x1')]||'';this[_0xd7a0('0x2')]=_0x4f4d91[_0xd7a0('0x2')]||'';this[_0xd7a0('0x3')]=_0x4f4d91['zone']||'';this[_0xd7a0('0x4')]=_0x4f4d91[_0xd7a0('0x4')]||'';this['clientSecret']=_0x4f4d91[_0xd7a0('0x5')]||'';this['serverUrl']=_0x4f4d91[_0xd7a0('0x6')]||'';this[_0xd7a0('0x7')]=_0x4f4d91[_0xd7a0('0x7')]||'';this[_0xd7a0('0x8')]=_0x4f4d91[_0xd7a0('0x8')]||'';this[_0xd7a0('0x9')]=_0x4f4d91['Configurations']||{};}module[_0xd7a0('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 18499d6..c8a4c84 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 _0x2da6=['queue','type','campaigntype','membername','Agent','name','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact'];(function(_0x398331,_0x327bf1){var _0x60e75a=function(_0xdf675d){while(--_0xdf675d){_0x398331['push'](_0x398331['shift']());}};_0x60e75a(++_0x327bf1);}(_0x2da6,0x1dd));var _0x62da=function(_0x274f81,_0x3b65aa){_0x274f81=_0x274f81-0x0;var _0x436bd4=_0x2da6[_0x274f81];return _0x436bd4;};'use strict';var util=require(_0x62da('0x0'));var _=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));function checkNameSurname(_0xbbb39b,_0xd62c5c,_0x12b8ad){var _0x19081e='';if(!_[_0x62da('0x3')](_0xd62c5c)&&'string'===typeof _0xd62c5c){_0x19081e+=_0xd62c5c;}if(!_['isNil'](_0x12b8ad)&&_0x62da('0x4')===typeof _0x12b8ad){_0x19081e+='\x20'+_0x12b8ad;}if(_0x19081e!==''){return _0x19081e;}return _0xbbb39b;}function Action(_0x3163df,_0x3a59f8,_0x30437f,_0x100e73,_0x9d9139){this[_0x62da('0x5')]=_0x30437f||undefined;this[_0x62da('0x6')]=_0x3163df['id'];this[_0x62da('0x7')]=_0x3a59f8['name'];this[_0x62da('0x8')]=_0x3a59f8[_0x62da('0x8')];this[_0x62da('0x9')]=_0x62da('0x7');this['dialAnswer']=![];this[_0x62da('0xa')]=_[_0x62da('0x3')](_0x3163df[_0x62da('0xb')])?undefined:_0x3163df[_0x62da('0xb')][_0x62da('0xc')];this['channelAgent']=this[_0x62da('0xa')]?util[_0x62da('0xd')](_0x62da('0xe'),this[_0x62da('0xa')]):_0x100e73||undefined;this[_0x62da('0xf')]=checkNameSurname(_0x3163df['Contact']['phone'],_0x3163df[_0x62da('0x10')][_0x62da('0x11')],_0x3163df[_0x62da('0x10')][_0x62da('0x12')]);this[_0x62da('0x13')]=_0x3163df[_0x62da('0x13')]||![];this[_0x62da('0x14')]=_0x3163df[_0x62da('0x15')];this[_0x62da('0x16')]=_0x3163df[_0x62da('0x16')];this[_0x62da('0x17')]=_0x3163df[_0x62da('0x17')]||0x0;this[_0x62da('0x18')]=_0x3163df[_0x62da('0x18')]||0x0;this['countnoanswerretry']=_0x3163df['countnoanswerretry']||0x0;this[_0x62da('0x19')]=(_0x3163df['countbusyretry']||0x0)+(_0x3163df[_0x62da('0x18')]||0x0)+(_0x3163df[_0x62da('0x1a')]||0x0)+(_0x3163df[_0x62da('0x1b')]||0x0)+(_0x3163df['countdropretry']||0x0)+(_0x3163df[_0x62da('0x1c')]||0x0)+(_0x3163df['countmachineretry']||0x0)+(_0x3163df[_0x62da('0x1d')]||0x0);this[_0x62da('0x1b')]=_0x3163df[_0x62da('0x1b')]||0x0;this[_0x62da('0x1e')]=_0x3163df[_0x62da('0x1e')]||0x0;this[_0x62da('0x1c')]=_0x3163df[_0x62da('0x1c')]||0x0;this[_0x62da('0x1f')]=_0x3163df[_0x62da('0x1f')]||0x0;this['countagentrejectretry']=_0x3163df[_0x62da('0x1d')]||0x0;this[_0x62da('0x20')]=_0x3163df[_0x62da('0x20')];this[_0x62da('0x21')]=_0x3163df[_0x62da('0x21')];this[_0x62da('0x22')]=_0x3163df[_0x62da('0x22')];this['recallme']=_0x3163df['recallme'];this['ContactId']=_0x3163df[_0x62da('0x23')];this[_0x62da('0x24')]=_0x3163df[_0x62da('0x24')];this[_0x62da('0x25')]=_['isNil'](_0x3163df[_0x62da('0xb')])?_0x3163df[_0x62da('0x25')]:_0x3163df['Agent']['id'];this[_0x62da('0x26')]=_0x3163df[_0x62da('0x26')];this[_0x62da('0x27')]='';this['originatecalleridname']='';}Action[_0x62da('0x28')][_0x62da('0x29')]=function(){return util[_0x62da('0xd')]('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x62da('0x2a')]);};module[_0x62da('0x2b')]=Action; \ No newline at end of file +var _0x4991=['ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','SIP/%s','calleridname','Contact','phone','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x104bc1,_0x486a71){var _0x546052=function(_0x36a2e8){while(--_0x36a2e8){_0x104bc1['push'](_0x104bc1['shift']());}};_0x546052(++_0x486a71);}(_0x4991,0xf7));var _0x1499=function(_0x29b506,_0x25d530){_0x29b506=_0x29b506-0x0;var _0x3b2567=_0x4991[_0x29b506];return _0x3b2567;};'use strict';var util=require(_0x1499('0x0'));var _=require('lodash');var moment=require(_0x1499('0x1'));function checkNameSurname(_0x5bd577,_0x30d640,_0x256e41){var _0x16ac22='';if(!_[_0x1499('0x2')](_0x30d640)&&_0x1499('0x3')===typeof _0x30d640){_0x16ac22+=_0x30d640;}if(!_[_0x1499('0x2')](_0x256e41)&&_0x1499('0x3')===typeof _0x256e41){_0x16ac22+='\x20'+_0x256e41;}if(_0x16ac22!==''){return _0x16ac22;}return _0x5bd577;}function Action(_0x209616,_0x4b6154,_0x2a8e96,_0x1c3bd7,_0x1c65c3){this[_0x1499('0x4')]=_0x2a8e96||undefined;this[_0x1499('0x5')]=_0x209616['id'];this[_0x1499('0x6')]=_0x4b6154[_0x1499('0x7')];this[_0x1499('0x8')]=_0x4b6154['type'];this[_0x1499('0x9')]=_0x1499('0x6');this['dialAnswer']=![];this[_0x1499('0xa')]=_[_0x1499('0x2')](_0x209616['Agent'])?undefined:_0x209616[_0x1499('0xb')][_0x1499('0x7')];this['channelAgent']=this['membername']?util['format'](_0x1499('0xc'),this[_0x1499('0xa')]):_0x1c3bd7||undefined;this[_0x1499('0xd')]=checkNameSurname(_0x209616[_0x1499('0xe')][_0x1499('0xf')],_0x209616['Contact']['firstName'],_0x209616[_0x1499('0xe')]['lastName']);this[_0x1499('0x10')]=_0x209616[_0x1499('0x10')]||![];this[_0x1499('0x11')]=_0x209616[_0x1499('0xf')];this['scheduledat']=_0x209616[_0x1499('0x12')];this[_0x1499('0x13')]=_0x209616['countbusyretry']||0x0;this[_0x1499('0x14')]=_0x209616[_0x1499('0x14')]||0x0;this[_0x1499('0x15')]=_0x209616[_0x1499('0x15')]||0x0;this[_0x1499('0x16')]=(_0x209616[_0x1499('0x13')]||0x0)+(_0x209616['countcongestionretry']||0x0)+(_0x209616['countnoanswerretry']||0x0)+(_0x209616['countnosuchnumberretry']||0x0)+(_0x209616[_0x1499('0x17')]||0x0)+(_0x209616[_0x1499('0x18')]||0x0)+(_0x209616['countmachineretry']||0x0)+(_0x209616[_0x1499('0x19')]||0x0);this[_0x1499('0x1a')]=_0x209616[_0x1499('0x1a')]||0x0;this[_0x1499('0x17')]=_0x209616[_0x1499('0x17')]||0x0;this[_0x1499('0x18')]=_0x209616[_0x1499('0x18')]||0x0;this[_0x1499('0x1b')]=_0x209616[_0x1499('0x1b')]||0x0;this[_0x1499('0x19')]=_0x209616[_0x1499('0x19')]||0x0;this[_0x1499('0x1c')]=_0x209616[_0x1499('0x1c')];this[_0x1499('0x1d')]=_0x209616[_0x1499('0x1d')];this[_0x1499('0x1e')]=_0x209616[_0x1499('0x1e')];this['recallme']=_0x209616[_0x1499('0x1f')];this[_0x1499('0x20')]=_0x209616[_0x1499('0x20')];this[_0x1499('0x21')]=_0x209616[_0x1499('0x21')];this[_0x1499('0x22')]=_['isNil'](_0x209616['Agent'])?_0x209616[_0x1499('0x22')]:_0x209616[_0x1499('0xb')]['id'];this[_0x1499('0x23')]=_0x209616[_0x1499('0x23')];this[_0x1499('0x24')]='';this['originatecalleridname']='';}Action[_0x1499('0x25')]['getCaller']=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x1499('0xd')],this[_0x1499('0x26')]);};module[_0x1499('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index f6040be..140a44e 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x1c1fcc,_0x5e8e88){var _0x3e4053=function(_0xfe5816){while(--_0xfe5816){_0x1c1fcc['push'](_0x1c1fcc['shift']());}};_0x3e4053(++_0x5e8e88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x218c57,_0x2357d0){var _0x23f174=function(_0x149cdb){while(--_0x149cdb){_0x218c57['push'](_0x218c57['shift']());}};_0x23f174(++_0x2357d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 158624f..50c4194 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 _0x3061=['../rpc/cmHopper','../rpc/voiceQueueReport','error','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird'];(function(_0x205f6f,_0x1a40dd){var _0x3ded6e=function(_0x367237){while(--_0x367237){_0x205f6f['push'](_0x205f6f['shift']());}};_0x3ded6e(++_0x1a40dd);}(_0x3061,0xc6));var _0x1306=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0x3061[_0x25a0b9];return _0x30b9ab;};'use strict';var util=require(_0x1306('0x0'));var BPromise=require(_0x1306('0x1'));var logger=require('../../../config/logger')('preview');var cmHopper=require(_0x1306('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x1306('0x3'));function loggerCatch(_0x4aaea6){return function(_0x789d1f){logger[_0x1306('0x4')](_0x4aaea6,util['inspect'](_0x789d1f,{'showHidden':![],'depth':null}));};}function create(_0x2d8842){return cmHopperHistory[_0x1306('0x5')](_0x2d8842)[_0x1306('0x6')](loggerCatch(_0x1306('0x7')));}function createAgent(_0x3485f2){return BPromise[_0x1306('0x8')]()[_0x1306('0x9')](agentReportPreview[_0x1306('0x5')](_0x3485f2))[_0x1306('0x6')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x493446){return cmHopper[_0x1306('0xa')](_0x493446,!![])[_0x1306('0x6')](loggerCatch(_0x1306('0xb')));}exports[_0x1306('0xc')]=function(_0x50bc24){return cmHopperBlack[_0x1306('0xc')](_0x50bc24)[_0x1306('0x6')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x1306('0xd')]=function(_0x5cdbfe){return BPromise['resolve']()[_0x1306('0x9')](cmHopper[_0x1306('0xd')](_0x5cdbfe))[_0x1306('0x6')](loggerCatch(_0x1306('0xe')));};exports[_0x1306('0x5')]=function(_0x2a5fda,_0x5df14c){create(_0x2a5fda)[_0x1306('0x6')](loggerCatch(_0x5df14c));moveContact(_0x2a5fda)['catch'](loggerCatch(_0x5df14c));};exports['createAgentHistory']=function(_0x3fc1b9,_0x10bcc6){createAgent(_0x3fc1b9)['catch'](loggerCatch(_0x10bcc6));};exports[_0x1306('0xf')]=function(_0x4c58b6,_0x20cb9c){create(_0x4c58b6)[_0x1306('0x6')](loggerCatch(_0x20cb9c));};exports[_0x1306('0x10')]=function(_0x4e1b2b,_0x1db7fc){moveContact(_0x4e1b2b)[_0x1306('0x6')](loggerCatch(_0x1db7fc));};exports[_0x1306('0x11')]=function(_0x50e1a7,_0x3cbb85,_0x2571bb){if(_0x3cbb85){_0x50e1a7['UserId']=null;}if(_0x2571bb){_0x50e1a7[_0x1306('0x12')]=![];}return cmHopper[_0x1306('0x11')](_0x50e1a7)['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0x1306('0x13')]=function(_0x476dbf){return cmHopper[_0x1306('0x13')](_0x476dbf)[_0x1306('0x6')](loggerCatch(_0x1306('0x14')));};exports['unlockContact']=function(_0x5f3614){return cmHopper[_0x1306('0x15')]({'UserId':null},_0x5f3614,0x1)[_0x1306('0x6')](loggerCatch(_0x1306('0x16')));};exports[_0x1306('0x17')]=function(_0x2be4d1){return cmHopper[_0x1306('0x15')]({'active':![]},_0x2be4d1,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x1306('0x18')]=function(_0x2c5169){var _0x35016d={};_0x35016d[_0x1306('0x19')]=_0x2c5169[_0x1306('0x19')];_0x35016d[_0x1306('0x1a')]=_0x2c5169[_0x1306('0x1a')];_0x35016d['calleridnum']=_0x2c5169[_0x1306('0x1b')];_0x35016d[_0x1306('0x1c')]=_0x2c5169['calleridname'];_0x35016d['queue']=_0x2c5169[_0x1306('0x1d')];_0x35016d[_0x1306('0x1e')]=_0x2c5169[_0x1306('0x1f')];_0x35016d[_0x1306('0x20')]=_0x2c5169[_0x1306('0x1f')];_0x35016d[_0x1306('0x21')]=0x1;_0x35016d['queuecallercompleteAt']=_0x2c5169[_0x1306('0x22')];_0x35016d[_0x1306('0x23')]=_0x2c5169[_0x1306('0x24')];_0x35016d[_0x1306('0x25')]=_0x1306('0x26');_0x35016d[_0x1306('0x27')]=_0x1306('0x28');_0x35016d[_0x1306('0x29')]=0x0;_0x35016d[_0x1306('0x2a')]=0x1;_0x35016d[_0x1306('0x2b')]=_0x2c5169[_0x1306('0x24')];_0x35016d[_0x1306('0x2c')]='COMPLETED';return BPromise['resolve']()['then'](voiceQueueReport[_0x1306('0x2d')](_0x35016d))[_0x1306('0x6')](loggerCatch(_0x1306('0x2e')));};exports['getContactRecallMe']=function(_0x16bd6c,_0x655e23){return BPromise[_0x1306('0x8')]()[_0x1306('0x9')](cmHopper[_0x1306('0x2f')](_0x16bd6c,_0x655e23))[_0x1306('0x6')](loggerCatch(_0x1306('0x30')));};exports['rescheduleContactInQueue']=function(_0x570c9e){return cmHopper['rescheduleContact'](_0x570c9e,!![],!![])[_0x1306('0x6')](loggerCatch(_0x1306('0x31')));}; \ No newline at end of file +var _0xf7e6=['type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','resolve','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0xf7e6,0x1ec));var _0x6f7e=function(_0x1824c9,_0x1d8941){_0x1824c9=_0x1824c9-0x0;var _0x4358d7=_0xf7e6[_0x1824c9];return _0x4358d7;};'use strict';var util=require(_0x6f7e('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x6f7e('0x1'));var cmHopper=require(_0x6f7e('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x6f7e('0x3'));var agentReportPreview=require(_0x6f7e('0x4'));var voiceQueueReport=require(_0x6f7e('0x5'));function loggerCatch(_0x14e941){return function(_0x6f2781){logger[_0x6f7e('0x6')](_0x14e941,util[_0x6f7e('0x7')](_0x6f2781,{'showHidden':![],'depth':null}));};}function create(_0x1a7c51){return cmHopperHistory[_0x6f7e('0x8')](_0x1a7c51)[_0x6f7e('0x9')](loggerCatch(_0x6f7e('0xa')));}function createAgent(_0x47ab10){return BPromise['resolve']()['then'](agentReportPreview['createHistory'](_0x47ab10))[_0x6f7e('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x202ab9){return cmHopper[_0x6f7e('0xb')](_0x202ab9,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x6f7e('0xc')]=function(_0x484272){return cmHopperBlack[_0x6f7e('0xc')](_0x484272)['catch'](loggerCatch(_0x6f7e('0xd')));};exports['getContactPreview']=function(_0x49eb26){return BPromise[_0x6f7e('0xe')]()[_0x6f7e('0xf')](cmHopper['getContactPreview'](_0x49eb26))['catch'](loggerCatch(_0x6f7e('0x10')));};exports['createHistory']=function(_0x4e5283,_0x490fa6){create(_0x4e5283)[_0x6f7e('0x9')](loggerCatch(_0x490fa6));moveContact(_0x4e5283)[_0x6f7e('0x9')](loggerCatch(_0x490fa6));};exports[_0x6f7e('0x11')]=function(_0x13196e,_0x3398b1){createAgent(_0x13196e)[_0x6f7e('0x9')](loggerCatch(_0x3398b1));};exports[_0x6f7e('0x12')]=function(_0xed2b3e,_0x32cc73){create(_0xed2b3e)[_0x6f7e('0x9')](loggerCatch(_0x32cc73));};exports[_0x6f7e('0x13')]=function(_0x26b66a,_0x5e18ce){moveContact(_0x26b66a)[_0x6f7e('0x9')](loggerCatch(_0x5e18ce));};exports[_0x6f7e('0x14')]=function(_0x208f03,_0x2caadf,_0x2e8647){if(_0x2caadf){_0x208f03[_0x6f7e('0x15')]=null;}if(_0x2e8647){_0x208f03[_0x6f7e('0x16')]=![];}return cmHopper[_0x6f7e('0x14')](_0x208f03)[_0x6f7e('0x9')](loggerCatch(_0x6f7e('0x17')));};exports['countReScheduled']=function(_0x3b2cc5){return cmHopper[_0x6f7e('0x18')](_0x3b2cc5)[_0x6f7e('0x9')](loggerCatch(_0x6f7e('0x19')));};exports[_0x6f7e('0x1a')]=function(_0x46d97a){return cmHopper['unlockContact']({'UserId':null},_0x46d97a,0x1)['catch'](loggerCatch(_0x6f7e('0x1b')));};exports['disableContact']=function(_0x48e76a){return cmHopper['unlockContact']({'active':![]},_0x48e76a,0x1)[_0x6f7e('0x9')](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0xca7583){var _0x33334d={};_0x33334d[_0x6f7e('0x1c')]=_0xca7583[_0x6f7e('0x1c')];_0x33334d[_0x6f7e('0x1d')]=_0xca7583[_0x6f7e('0x1d')];_0x33334d[_0x6f7e('0x1e')]=_0xca7583[_0x6f7e('0x1e')];_0x33334d[_0x6f7e('0x1f')]=_0xca7583[_0x6f7e('0x1f')];_0x33334d[_0x6f7e('0x20')]=_0xca7583['queue'];_0x33334d['queuecallerjoinAt']=_0xca7583[_0x6f7e('0x21')];_0x33334d[_0x6f7e('0x22')]=_0xca7583[_0x6f7e('0x21')];_0x33334d[_0x6f7e('0x23')]=0x1;_0x33334d[_0x6f7e('0x24')]=_0xca7583[_0x6f7e('0x25')];_0x33334d[_0x6f7e('0x26')]=_0xca7583[_0x6f7e('0x27')];_0x33334d[_0x6f7e('0x28')]=_0x6f7e('0x29');_0x33334d['exten']=_0x6f7e('0x2a');_0x33334d[_0x6f7e('0x2b')]=0x0;_0x33334d[_0x6f7e('0x2c')]=0x1;_0x33334d[_0x6f7e('0x2d')]=_0xca7583[_0x6f7e('0x27')];_0x33334d[_0x6f7e('0x2e')]='COMPLETED';return BPromise[_0x6f7e('0xe')]()[_0x6f7e('0xf')](voiceQueueReport[_0x6f7e('0x2f')](_0x33334d))[_0x6f7e('0x9')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x6f7e('0x30')]=function(_0x1b2827,_0x255ba9){return BPromise[_0x6f7e('0xe')]()['then'](cmHopper[_0x6f7e('0x30')](_0x1b2827,_0x255ba9))[_0x6f7e('0x9')](loggerCatch(_0x6f7e('0x31')));};exports[_0x6f7e('0x32')]=function(_0x850c){return cmHopper['rescheduleContact'](_0x850c,!![],!![])[_0x6f7e('0x9')](loggerCatch(_0x6f7e('0x33')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 181c8b2..b4f813f 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 _0x082e=['isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','Blacklist','starttime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','statedesc','responsetime','logLookAgent','membername','logCustomer','talktime','answertime','getSeconds','isFailure','variablesAction','calleridname','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','interface','mandatoryDisposition','buildObj','not_inuse','status','reachable','diff','seconds','createBody','CampaignId','idContact','queue','dialAnswer','scheduledat','countcongestionretry','callback','callbackuniqueid','callbackat','recallme','UserId','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqosloss','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','variables','keys','forEach','util','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','string','isEmpty'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x082e,0x7a));var _0xe082=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x082e[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xe082('0x0'));var _=require(_0xe082('0x1'));var moment=require(_0xe082('0x2'));var logger=require(_0xe082('0x3'))('preview');var ipAgi=process[_0xe082('0x4')][_0xe082('0x5')]||'127.0.0.1';var utils=require(_0xe082('0x6'));exports[_0xe082('0x7')]=function(_0xba8a6e){return function(_0x29039f){logger[_0xe082('0x8')](_0xba8a6e,util[_0xe082('0x9')](_0x29039f,{'showHidden':![],'depth':null}));};};exports[_0xe082('0xa')]=function(_0x3a8e0c,_0x59d6cc){logger[_0xe082('0xb')](_0x3a8e0c,util[_0xe082('0x9')](_0x59d6cc,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x27fb05,_0x2d7055){logger[_0xe082('0x8')](_0x27fb05,util[_0xe082('0x9')](_0x2d7055,{'showHidden':![],'depth':null}));};exports[_0xe082('0xc')]=function(_0x18f2ff){return function(_0xbd7b67){logger['info'](_0x18f2ff,util[_0xe082('0x9')](_0xbd7b67,{'showHidden':![],'depth':null}));};};exports[_0xe082('0xd')]=function(_0x580219,_0x897cd2,_0x260185){return{'message':_0x580219,'unlock':_0x897cd2,'active':_0x260185};};exports[_0xe082('0xe')]=function(_0x11fe0a,_0x50853c,_0x43f59c){if(!_['isUndefined'](_0x43f59c)&&_0xe082('0xf')===typeof _0x43f59c&&!_[_0xe082('0x10')](_0x43f59c)){if(!_[_0xe082('0x11')](_0x50853c)&&_0xe082('0xf')===typeof _0x50853c&&!_[_0xe082('0x10')](_0x50853c)){return util[_0xe082('0x12')](_0xe082('0x13'),_0x50853c,_0x43f59c);}return util[_0xe082('0x12')]('\x22%s\x22\x20<%s>',_0x43f59c,_0x43f59c);}if(!_[_0xe082('0x11')](_0x11fe0a)&&'string'===typeof _0x11fe0a&&!_[_0xe082('0x10')](_0x11fe0a)){return _0x11fe0a;}return _0xe082('0x14');};exports[_0xe082('0x15')]=function(_0x2cd748){if(_[_0xe082('0x16')](_0x2cd748)){return![];}return _0x2cd748;};exports[_0xe082('0x17')]=function(_0x435bc6,_0x2bf19e,_0x25765a,_0x33a591,_0x28fc8c,_0x4d95f9){var _0x310ab8={'XMD-QUEUE':_0x2bf19e['Queue']?_0x2bf19e[_0xe082('0x18')][_0xe082('0x19')]:'','XMD-CALLERID':_0x33a591,'XMD-CALLERID-PREVIEW':_0x4d95f9?util[_0xe082('0x12')](_0xe082('0x13'),_0x4d95f9['calleridname'],_0x4d95f9[_0xe082('0x1a')]):_0x33a591,'XMD-DIALID':_0x28fc8c,'XMD-CONTACTID':_0x2bf19e[_0xe082('0x1b')],'XMD-CDRTYPE':_0xe082('0x1c'),'CALLERID(all)':_0x33a591,'XMD-VOICEQUEUEID':_0x2bf19e[_0xe082('0x1d')],'XMD-DIALCHANNEL':_0x25765a,'XMD-DIALTIMEOUT':_0x435bc6[_0xe082('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xe082('0x12')]('\x22rtTxX%s%s\x22',_0x435bc6['dialQueueProject2']?'g':'',_[_0xe082('0x10')](_0x435bc6[_0xe082('0x1f')])?'':_0xe082('0x20')),'XMD-DIALURL':_0x435bc6[_0xe082('0x21')]||'','XMD-AGI':_0x435bc6['dialQueueProject']?util[_0xe082('0x12')](_0xe082('0x22'),ipAgi,_0x435bc6['dialQueueProject']):_0xe082('0x23'),'XMD-AGIAFTER':_0x435bc6['dialQueueProject2']?util[_0xe082('0x12')](_0xe082('0x22'),ipAgi,_0x435bc6[_0xe082('0x24')]):_0xe082('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x4d95f9?_0x4d95f9['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x4d95f9?_0x4d95f9[_0xe082('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xe082('0x26')};if(!_['isEmpty'](_0x435bc6[_0xe082('0x1f')])){_0x310ab8[util[_0xe082('0x12')]('%s',_0xe082('0x27'))]=_0x435bc6[_0xe082('0x1f')];_0x310ab8[util[_0xe082('0x12')]('%s',_0xe082('0x28'))]=_0x28fc8c;}return _0x310ab8;};exports['toLowerVariables']=function(_0x400090){var _0x517a75={};for(var _0x347411 in _0x400090){if(_0x400090[_0xe082('0x29')](_0x347411)){_0x517a75[util['format']('%s',_[_0xe082('0x2a')](_0x347411))]=_0x400090[_0x347411];}}return{'variables':_0x517a75};};exports['updateOriginated']=function(_0x5c5f65,_0x3ba2d2){if(!_[_0xe082('0x16')](_0x5c5f65)){if(_0x5c5f65[_0xe082('0x29')](_0xe082('0x2b'))){if(_0x5c5f65[_0xe082('0x2b')]>0x0){_0x5c5f65[_0xe082('0x2b')]-=0x1;}else{logger[_0xe082('0x8')](_0xe082('0x2c'),_0x3ba2d2);}}}else{logger[_0xe082('0x8')](_0xe082('0x2d'),_0x3ba2d2);}};exports['logBlacklist']=function(_0x2fa170){var _0x29b40e=moment()[_0xe082('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x2fa170[_0xe082('0x2e')]=0xd;_0x2fa170['statedesc']=_0xe082('0x2f');_0x2fa170[_0xe082('0x30')]=_0x29b40e;_0x2fa170['responsetime']=_0x29b40e;_0x2fa170[_0xe082('0x31')]=_0x29b40e;};exports[_0xe082('0x32')]=function(_0x2a919d,_0x195b4d,_0x3e6582){var _0x2eef6f=moment()[_0xe082('0x12')](_0xe082('0x33'));_0x2a919d['state']=_0x195b4d;_0x2a919d[_0xe082('0x34')]=_0x3e6582;_0x2a919d[_0xe082('0x35')]=_0x2eef6f;_0x2a919d['ringtime']=utils['getSeconds'](_0x2a919d[_0xe082('0x35')],_0x2a919d[_0xe082('0x30')]);};exports[_0xe082('0x36')]=function(_0x4051a4,_0x52fac3,_0x3758b4){_0x4051a4[_0xe082('0x37')]=_0x52fac3;_0x4051a4['UserId']=_0x3758b4;};exports[_0xe082('0x38')]=function(_0x409e36,_0x1ac8e9,_0x50004c){var _0xab7775=moment()[_0xe082('0x12')](_0xe082('0x33'));_0x409e36[_0xe082('0x2e')]=_0x1ac8e9;_0x409e36[_0xe082('0x34')]=_0x50004c;_0x409e36[_0xe082('0x35')]=_0x409e36[_0xe082('0x35')]?_0x409e36[_0xe082('0x35')]:_0xab7775;_0x409e36[_0xe082('0x31')]=_0x409e36['endtime']?_0x409e36[_0xe082('0x31')]:_0xab7775;_0x409e36['ringtime']=utils['getSeconds'](_0x409e36[_0xe082('0x35')]||0x0,_0x409e36['starttime']||0x0);_0x409e36[_0xe082('0x39')]=_0x409e36[_0xe082('0x3a')]?utils[_0xe082('0x3b')](_0x409e36['endtime'],_0x409e36[_0xe082('0x3a')]):0x0;};exports[_0xe082('0x3c')]=function(_0x34bfd8){return _0x34bfd8==='Failure';};exports[_0xe082('0x3d')]=function(_0x192f83,_0x5750b8,_0xebafd7,_0x445514,_0x40b165){var _0x149e46=_0x445514?'RECALL':_0x192f83[_0xe082('0x3e')];_0x149e46=_0x40b165?_0xe082('0x3f'):_0x149e46;return{'actionid':_0x192f83[_0xe082('0x40')],'action':_0xe082('0x41'),'channel':_0x192f83[_0xe082('0x42')],'callerid':util[_0xe082('0x12')](_0xe082('0x13'),_0x149e46,_0x192f83[_0xe082('0x1a')]),'Exten':_0xe082('0x43'),'Context':_0xe082('0x44'),'Priority':'1','variable':_0xebafd7,'timeout':(_0x5750b8[_0xe082('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x192f83['uniqueid']};};exports[_0xe082('0x46')]=function(_0x57525d){return _0x57525d[_0xe082('0x47')]+_0x57525d['countcongestionretry']+_0x57525d[_0xe082('0x48')]+_0x57525d[_0xe082('0x49')]+_0x57525d[_0xe082('0x4a')];};exports[_0xe082('0x4b')]=function(_0x44d04b){var _0xc923e5=_[_0xe082('0x4c')](_0x44d04b);_0xc923e5[_0xe082('0x2e')]=0xf;_0xc923e5[_0xe082('0x34')]=_0xe082('0x4d');return _0xc923e5;};exports[_0xe082('0x4e')]=function(_0x55c6b7,_0xf9032b,_0xe633f4){var _0x56909f={};_0x56909f[_0xf9032b]=_0x55c6b7[_0xf9032b];_0x56909f[_0xe082('0x4f')]=![];_0x56909f['scheduledat']=moment()[_0xe082('0x50')](_0xe633f4,_0xe082('0x51'))[_0xe082('0x12')](_0xe082('0x33'));_0x56909f[_0xe082('0x1b')]=_0x55c6b7[_0xe082('0x1b')];_0x56909f['ListId']=_0x55c6b7[_0xe082('0x52')];_0x56909f[_0xe082('0x1d')]=_0x55c6b7[_0xe082('0x1d')]||undefined;return _0x56909f;};exports['decrementTalkink']=function(_0x2ffa0d,_0x29322b){if(!_['isNil'](_0x2ffa0d)){if(_0x2ffa0d[_0xe082('0x53')]>0x0){_0x2ffa0d[_0xe082('0x53')]-=0x1;}else{logger[_0xe082('0x8')](_0x29322b,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xe082('0x8')](_0x29322b,_0xe082('0x54'));}};exports[_0xe082('0x55')]=function(_0x308989){if(_0x308989<=0x0){return!![];}return![];};function buildObj(_0x850a1b,_0x2abe3a,_0x14a856){_0x850a1b[_0xe082('0x56')]=_0x2abe3a;_0x850a1b[_0xe082('0x19')]=_0x850a1b['queue'];_0x850a1b[_0xe082('0x57')]=_0x850a1b['channelAgent'];_0x850a1b['motionChannel']='voice';if(_0x14a856){_0x850a1b[_0xe082('0x58')]=_0x14a856[_0xe082('0x58')];}return _0x850a1b;}exports[_0xe082('0x59')]=buildObj;exports['agentReadyId']=function(_0x417900){var _0x5a3fca=[];for(var _0x3b7beb in _0x417900){if(_0x417900[_0xe082('0x29')](_0x3b7beb)){if(!_[_0xe082('0x16')](_0x417900[_0x3b7beb])&&_0x417900[_0x3b7beb][_0xe082('0x2e')]===_0xe082('0x5a')&&_0x417900[_0x3b7beb][_0xe082('0x5b')]===_0xe082('0x5c')){_0x5a3fca['push'](_0x417900[_0x3b7beb]['id']);}}}return _0x5a3fca;};exports['getDiff']=function(_0x44f59e){var _0x41c50c=moment()['milliseconds'](0x0);var _0x409a74=moment(_0x44f59e)['milliseconds'](0x0);return _0x41c50c[_0xe082('0x5d')](_0x409a74,_0xe082('0x5e'));};exports[_0xe082('0x5f')]=function(_0x324e92){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x324e92['ContactId'],'ListId':_0x324e92['ListId'],'VoiceQueueId':_0x324e92[_0xe082('0x1d')]||undefined,'CampaignId':_0x324e92[_0xe082('0x60')]||undefined};};exports['filterKey']=function(_0xafc2ca){if(_0xafc2ca==='uniqueid'||_0xafc2ca===_0xe082('0x61')||_0xafc2ca===_0xe082('0x62')||_0xafc2ca==='type'||_0xafc2ca==='campaigntype'||_0xafc2ca===_0xe082('0x63')||_0xafc2ca===_0xe082('0x37')||_0xafc2ca==='channelAgent'||_0xafc2ca===_0xe082('0x3e')||_0xafc2ca==='active'||_0xafc2ca===_0xe082('0x1a')||_0xafc2ca===_0xe082('0x64')||_0xafc2ca===_0xe082('0x47')||_0xafc2ca===_0xe082('0x65')||_0xafc2ca===_0xe082('0x48')||_0xafc2ca==='countglobal'||_0xafc2ca===_0xe082('0x66')||_0xafc2ca===_0xe082('0x67')||_0xafc2ca===_0xe082('0x68')||_0xafc2ca===_0xe082('0x69')||_0xafc2ca===_0xe082('0x1b')||_0xafc2ca===_0xe082('0x52')||_0xafc2ca===_0xe082('0x6a')||_0xafc2ca===_0xe082('0x1d')||_0xafc2ca==='sipcallid'||_0xafc2ca===_0xe082('0x6b')||_0xafc2ca===_0xe082('0x6c')||_0xafc2ca===_0xe082('0x6d')||_0xafc2ca===_0xe082('0x6e')||_0xafc2ca===_0xe082('0x6f')||_0xafc2ca==='xmd-dialtimeout'||_0xafc2ca===_0xe082('0x70')||_0xafc2ca===_0xe082('0x71')||_0xafc2ca===_0xe082('0x72')||_0xafc2ca===_0xe082('0x73')||_0xafc2ca===_0xe082('0x74')||_0xafc2ca===_0xe082('0x75')||_0xafc2ca===_0xe082('0x76')||_0xafc2ca===_0xe082('0x77')||_0xafc2ca===_0xe082('0x78')||_0xafc2ca==='rtpaudioqosbridged'||_0xafc2ca===_0xe082('0x79')||_0xafc2ca===_0xe082('0x7a')||_0xafc2ca==='rtpaudioqosloss'||_0xafc2ca===_0xe082('0x7b')||_0xafc2ca===_0xe082('0x7c')||_0xafc2ca==='rtpaudioqosrttbridged'||_0xafc2ca===_0xe082('0x78')||_0xafc2ca===_0xe082('0x7d')||_0xafc2ca===_0xe082('0x79')||_0xafc2ca===_0xe082('0x7a')||_0xafc2ca===_0xe082('0x7e')||_0xafc2ca===_0xe082('0x7b')||_0xafc2ca==='rtpaudioqosrtt'||_0xafc2ca==='rtpaudioqosrttbridged'||_0xafc2ca===_0xe082('0x7f')||_0xafc2ca==='bridgepvtcallid'||_0xafc2ca===_0xe082('0x2e')||_0xafc2ca===_0xe082('0x34')){return![];}return!![];};exports[_0xe082('0x80')]=function(_0x45295d,_0x24ea9f){var _0x21c4d2,_0x166317,_0x5cf66e;if(_0x24ea9f<=0x0){_0x24ea9f=0x1;}_0x21c4d2=new RegExp(_0xe082('0x81')+_0x24ea9f+'}$');_0x166317=Math[_0xe082('0x82')](0xa,_0x24ea9f-0x1);_0x5cf66e=Math['pow'](0xa,_0x24ea9f)-0x1;return util['format']('%s',_[_0xe082('0x83')](_0x45295d,_0x21c4d2,_[_0xe082('0x84')](_0x166317,_0x5cf66e)));};exports[_0xe082('0x85')]=function(_0x28a8ad){var _0x5e0769=_0x28a8ad[_0xe082('0x86')](/"(.*?)"/);return _0x5e0769?_0x5e0769[0x1]:_0x28a8ad;};exports[_0xe082('0x87')]=function(_0x198cc2){var _0x31f978=_0x198cc2[_0xe082('0x86')](/<(.*?)>/);return _0x31f978?_0x31f978[0x1]:_0x198cc2;};function buildNoAnswerEventPayload(_0x1c33c6,_0x335307){var _0x4be08b=buildObj(_0x1c33c6,'noanswer');if(!_[_0xe082('0x10')](_0x335307[_0xe082('0x88')])){Object[_0xe082('0x89')](_0x335307[_0xe082('0x88')])[_0xe082('0x8a')](function(_0x3909ba){_0x4be08b[_0x3909ba['toLowerCase']()]=_0x335307['variables'][_0x3909ba];});}return _0x4be08b;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x025a=['hasOwnProperty','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','getSeconds','logLookAgent','UserId','logCustomer','answertime','isFailure','variablesAction','RECALL','calleridname','BOOKED','originate','calleridnum','xcally-motion-preview','from-sip','timeout','uniqueid','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ContactId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','ListId','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','scheduledat','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','noanswer','variables','forEach','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isActive','isNil','Queue','name','\x22%s\x22\x20<%s>','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables'];(function(_0xfeb477,_0x252fe7){var _0x1e96e6=function(_0x308ddc){while(--_0x308ddc){_0xfeb477['push'](_0xfeb477['shift']());}};_0x1e96e6(++_0x252fe7);}(_0x025a,0x68));var _0xa025=function(_0x4ccde3,_0x38ca57){_0x4ccde3=_0x4ccde3-0x0;var _0x3348ac=_0x025a[_0x4ccde3];return _0x3348ac;};'use strict';var util=require(_0xa025('0x0'));var _=require(_0xa025('0x1'));var moment=require('moment');var logger=require(_0xa025('0x2'))('preview');var ipAgi=process['env'][_0xa025('0x3')]||_0xa025('0x4');var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0x2515a1){return function(_0x4752c5){logger[_0xa025('0x5')](_0x2515a1,util[_0xa025('0x6')](_0x4752c5,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x59f1cf,_0x1744ae){logger[_0xa025('0x7')](_0x59f1cf,util[_0xa025('0x6')](_0x1744ae,{'showHidden':![],'depth':null}));};exports[_0xa025('0x8')]=function(_0x27e0f7,_0x4c9a71){logger[_0xa025('0x5')](_0x27e0f7,util[_0xa025('0x6')](_0x4c9a71,{'showHidden':![],'depth':null}));};exports[_0xa025('0x9')]=function(_0x26f660){return function(_0x214455){logger[_0xa025('0x7')](_0x26f660,util[_0xa025('0x6')](_0x214455,{'showHidden':![],'depth':null}));};};exports[_0xa025('0xa')]=function(_0x4012e1,_0x2628da,_0x946068){return{'message':_0x4012e1,'unlock':_0x2628da,'active':_0x946068};};exports[_0xa025('0xb')]=function(_0x30942c,_0x17a455,_0xac21f8){if(!_[_0xa025('0xc')](_0xac21f8)&&_0xa025('0xd')===typeof _0xac21f8&&!_[_0xa025('0xe')](_0xac21f8)){if(!_[_0xa025('0xc')](_0x17a455)&&_0xa025('0xd')===typeof _0x17a455&&!_[_0xa025('0xe')](_0x17a455)){return util[_0xa025('0xf')]('\x22%s\x22\x20<%s>',_0x17a455,_0xac21f8);}return util[_0xa025('0xf')]('\x22%s\x22\x20<%s>',_0xac21f8,_0xac21f8);}if(!_[_0xa025('0xc')](_0x30942c)&&'string'===typeof _0x30942c&&!_['isEmpty'](_0x30942c)){return _0x30942c;}return _0xa025('0x10');};exports[_0xa025('0x11')]=function(_0x46491e){if(_[_0xa025('0x12')](_0x46491e)){return![];}return _0x46491e;};exports['addVariables']=function(_0x491936,_0x45090f,_0xb3d068,_0x2b8881,_0x17c9d5,_0x287e1a){var _0x4dbccc={'XMD-QUEUE':_0x45090f[_0xa025('0x13')]?_0x45090f[_0xa025('0x13')][_0xa025('0x14')]:'','XMD-CALLERID':_0x2b8881,'XMD-CALLERID-PREVIEW':_0x287e1a?util['format'](_0xa025('0x15'),_0x287e1a['calleridname'],_0x287e1a['calleridnum']):_0x2b8881,'XMD-DIALID':_0x17c9d5,'XMD-CONTACTID':_0x45090f['ContactId'],'XMD-CDRTYPE':_0xa025('0x16'),'CALLERID(all)':_0x2b8881,'XMD-VOICEQUEUEID':_0x45090f[_0xa025('0x17')],'XMD-DIALCHANNEL':_0xb3d068,'XMD-DIALTIMEOUT':_0x491936[_0xa025('0x18')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xa025('0x19'),_0x491936['dialQueueProject2']?'g':'',_[_0xa025('0xe')](_0x491936[_0xa025('0x1a')])?'':_0xa025('0x1b')),'XMD-DIALURL':_0x491936['dialPreviewUrl']||'','XMD-AGI':_0x491936[_0xa025('0x1c')]?util[_0xa025('0xf')](_0xa025('0x1d'),ipAgi,_0x491936[_0xa025('0x1c')]):_0xa025('0x1e'),'XMD-AGIAFTER':_0x491936[_0xa025('0x1f')]?util['format'](_0xa025('0x1d'),ipAgi,_0x491936['dialQueueProject2']):_0xa025('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x287e1a?_0x287e1a[_0xa025('0x20')]:'','XMD-ORIGINATECALLERIDNAME':_0x287e1a?_0x287e1a[_0xa025('0x21')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xa025('0xe')](_0x491936[_0xa025('0x1a')])){_0x4dbccc[util['format']('%s',_0xa025('0x22'))]=_0x491936[_0xa025('0x1a')];_0x4dbccc[util[_0xa025('0xf')]('%s',_0xa025('0x23'))]=_0x17c9d5;}return _0x4dbccc;};exports[_0xa025('0x24')]=function(_0xaa7c7a){var _0x14c4c3={};for(var _0x15c2d1 in _0xaa7c7a){if(_0xaa7c7a[_0xa025('0x25')](_0x15c2d1)){_0x14c4c3[util[_0xa025('0xf')]('%s',_['toLower'](_0x15c2d1))]=_0xaa7c7a[_0x15c2d1];}}return{'variables':_0x14c4c3};};exports['updateOriginated']=function(_0x417ec0,_0x2296f7){if(!_[_0xa025('0x12')](_0x417ec0)){if(_0x417ec0['hasOwnProperty'](_0xa025('0x26'))){if(_0x417ec0[_0xa025('0x26')]>0x0){_0x417ec0[_0xa025('0x26')]-=0x1;}else{logger[_0xa025('0x5')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x2296f7);}}}else{logger[_0xa025('0x5')](_0xa025('0x27'),_0x2296f7);}};exports[_0xa025('0x28')]=function(_0x55ce12){var _0x59e6cd=moment()[_0xa025('0xf')](_0xa025('0x29'));_0x55ce12[_0xa025('0x2a')]=0xd;_0x55ce12[_0xa025('0x2b')]=_0xa025('0x2c');_0x55ce12[_0xa025('0x2d')]=_0x59e6cd;_0x55ce12[_0xa025('0x2e')]=_0x59e6cd;_0x55ce12[_0xa025('0x2f')]=_0x59e6cd;};exports[_0xa025('0x30')]=function(_0x4a7abb,_0x2c0dd6,_0x8dd31f){var _0x3aac44=moment()[_0xa025('0xf')](_0xa025('0x29'));_0x4a7abb[_0xa025('0x2a')]=_0x2c0dd6;_0x4a7abb[_0xa025('0x2b')]=_0x8dd31f;_0x4a7abb[_0xa025('0x2e')]=_0x3aac44;_0x4a7abb['ringtime']=utils[_0xa025('0x31')](_0x4a7abb[_0xa025('0x2e')],_0x4a7abb[_0xa025('0x2d')]);};exports[_0xa025('0x32')]=function(_0x4cdaa4,_0x2563ed,_0x57beb5){_0x4cdaa4['membername']=_0x2563ed;_0x4cdaa4[_0xa025('0x33')]=_0x57beb5;};exports[_0xa025('0x34')]=function(_0x41535d,_0x1c284e,_0x2cf736){var _0x1e817b=moment()[_0xa025('0xf')](_0xa025('0x29'));_0x41535d[_0xa025('0x2a')]=_0x1c284e;_0x41535d[_0xa025('0x2b')]=_0x2cf736;_0x41535d[_0xa025('0x2e')]=_0x41535d[_0xa025('0x2e')]?_0x41535d[_0xa025('0x2e')]:_0x1e817b;_0x41535d[_0xa025('0x2f')]=_0x41535d[_0xa025('0x2f')]?_0x41535d[_0xa025('0x2f')]:_0x1e817b;_0x41535d['ringtime']=utils[_0xa025('0x31')](_0x41535d[_0xa025('0x2e')]||0x0,_0x41535d['starttime']||0x0);_0x41535d['talktime']=_0x41535d[_0xa025('0x35')]?utils[_0xa025('0x31')](_0x41535d['endtime'],_0x41535d[_0xa025('0x35')]):0x0;};exports[_0xa025('0x36')]=function(_0x486204){return _0x486204==='Failure';};exports[_0xa025('0x37')]=function(_0x1a920d,_0x567dd9,_0x2e92cf,_0x1112f0,_0x5e3f2b){var _0xebe8c5=_0x1112f0?_0xa025('0x38'):_0x1a920d[_0xa025('0x39')];_0xebe8c5=_0x5e3f2b?_0xa025('0x3a'):_0xebe8c5;return{'actionid':_0x1a920d['uniqueid'],'action':_0xa025('0x3b'),'channel':_0x1a920d['channelAgent'],'callerid':util[_0xa025('0xf')](_0xa025('0x15'),_0xebe8c5,_0x1a920d[_0xa025('0x3c')]),'Exten':_0xa025('0x3d'),'Context':_0xa025('0x3e'),'Priority':'1','variable':_0x2e92cf,'timeout':(_0x567dd9[_0xa025('0x3f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1a920d[_0xa025('0x40')]};};exports['totalGlobal']=function(_0x174c73){return _0x174c73[_0xa025('0x41')]+_0x174c73[_0xa025('0x42')]+_0x174c73['countnoanswerretry']+_0x174c73[_0xa025('0x43')]+_0x174c73[_0xa025('0x44')];};exports[_0xa025('0x45')]=function(_0x166384){var _0x436899=_[_0xa025('0x46')](_0x166384);_0x436899[_0xa025('0x2a')]=0xf;_0x436899['statedesc']=_0xa025('0x47');return _0x436899;};exports[_0xa025('0x48')]=function(_0x444fa2,_0x9206c4,_0x36f8fc){var _0x3de48d={};_0x3de48d[_0x9206c4]=_0x444fa2[_0x9206c4];_0x3de48d[_0xa025('0x49')]=![];_0x3de48d['scheduledat']=moment()[_0xa025('0x4a')](_0x36f8fc,_0xa025('0x4b'))[_0xa025('0xf')](_0xa025('0x29'));_0x3de48d[_0xa025('0x4c')]=_0x444fa2[_0xa025('0x4c')];_0x3de48d['ListId']=_0x444fa2['ListId'];_0x3de48d[_0xa025('0x17')]=_0x444fa2['VoiceQueueId']||undefined;return _0x3de48d;};exports[_0xa025('0x4d')]=function(_0x129ba8,_0x567395){if(!_[_0xa025('0x12')](_0x129ba8)){if(_0x129ba8[_0xa025('0x4e')]>0x0){_0x129ba8['pTalking']-=0x1;}else{logger[_0xa025('0x5')](_0x567395,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xa025('0x5')](_0x567395,_0xa025('0x4f'));}};exports[_0xa025('0x50')]=function(_0x550844){if(_0x550844<=0x0){return!![];}return![];};function buildObj(_0xb78c49,_0x410ab3,_0x1c511a){_0xb78c49[_0xa025('0x51')]=_0x410ab3;_0xb78c49[_0xa025('0x14')]=_0xb78c49[_0xa025('0x52')];_0xb78c49[_0xa025('0x53')]=_0xb78c49[_0xa025('0x54')];_0xb78c49[_0xa025('0x55')]=_0xa025('0x56');if(_0x1c511a){_0xb78c49['mandatoryDisposition']=_0x1c511a[_0xa025('0x57')];}return _0xb78c49;}exports[_0xa025('0x58')]=buildObj;exports[_0xa025('0x59')]=function(_0x431545){var _0x36ec3f=[];for(var _0x357b6f in _0x431545){if(_0x431545[_0xa025('0x25')](_0x357b6f)){if(!_['isNil'](_0x431545[_0x357b6f])&&_0x431545[_0x357b6f][_0xa025('0x2a')]==='not_inuse'&&_0x431545[_0x357b6f][_0xa025('0x5a')]===_0xa025('0x5b')){_0x36ec3f[_0xa025('0x5c')](_0x431545[_0x357b6f]['id']);}}}return _0x36ec3f;};exports[_0xa025('0x5d')]=function(_0x2b6daf){var _0x1c6a8d=moment()[_0xa025('0x5e')](0x0);var _0x9557a=moment(_0x2b6daf)[_0xa025('0x5e')](0x0);return _0x1c6a8d[_0xa025('0x5f')](_0x9557a,_0xa025('0x60'));};exports[_0xa025('0x61')]=function(_0x1b6a4a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1b6a4a[_0xa025('0x4c')],'ListId':_0x1b6a4a[_0xa025('0x62')],'VoiceQueueId':_0x1b6a4a['VoiceQueueId']||undefined,'CampaignId':_0x1b6a4a[_0xa025('0x63')]||undefined};};exports[_0xa025('0x64')]=function(_0x117aac){if(_0x117aac===_0xa025('0x40')||_0x117aac===_0xa025('0x65')||_0x117aac===_0xa025('0x52')||_0x117aac===_0xa025('0x66')||_0x117aac===_0xa025('0x67')||_0x117aac===_0xa025('0x68')||_0x117aac===_0xa025('0x69')||_0x117aac==='channelAgent'||_0x117aac===_0xa025('0x39')||_0x117aac===_0xa025('0x49')||_0x117aac===_0xa025('0x3c')||_0x117aac===_0xa025('0x6a')||_0x117aac==='countbusyretry'||_0x117aac===_0xa025('0x42')||_0x117aac===_0xa025('0x6b')||_0x117aac===_0xa025('0x6c')||_0x117aac===_0xa025('0x6d')||_0x117aac===_0xa025('0x6e')||_0x117aac===_0xa025('0x6f')||_0x117aac==='recallme'||_0x117aac==='ContactId'||_0x117aac==='ListId'||_0x117aac==='UserId'||_0x117aac===_0xa025('0x17')||_0x117aac==='sipcallid'||_0x117aac==='xmd-voicequeueid'||_0x117aac===_0xa025('0x70')||_0x117aac===_0xa025('0x71')||_0x117aac===_0xa025('0x72')||_0x117aac===_0xa025('0x73')||_0x117aac==='xmd-dialtimeout'||_0x117aac===_0xa025('0x74')||_0x117aac===_0xa025('0x75')||_0x117aac===_0xa025('0x76')||_0x117aac===_0xa025('0x77')||_0x117aac===_0xa025('0x78')||_0x117aac==='xmd-callerid'||_0x117aac===_0xa025('0x79')||_0x117aac==='xmd-agi'||_0x117aac===_0xa025('0x7a')||_0x117aac==='rtpaudioqosbridged'||_0x117aac===_0xa025('0x7b')||_0x117aac==='rtpaudioqosjitterbridged'||_0x117aac===_0xa025('0x7c')||_0x117aac==='rtpaudioqoslossbridged'||_0x117aac==='rtpaudioqosrtt'||_0x117aac==='rtpaudioqosrttbridged'||_0x117aac==='rtpaudioqos'||_0x117aac===_0xa025('0x7d')||_0x117aac==='rtpaudioqosjitter'||_0x117aac===_0xa025('0x7e')||_0x117aac===_0xa025('0x7c')||_0x117aac===_0xa025('0x7f')||_0x117aac==='rtpaudioqosrtt'||_0x117aac===_0xa025('0x80')||_0x117aac===_0xa025('0x81')||_0x117aac===_0xa025('0x82')||_0x117aac===_0xa025('0x2a')||_0x117aac===_0xa025('0x2b')){return![];}return!![];};exports[_0xa025('0x83')]=function(_0x1ed78e,_0x360b70){var _0x458834,_0x316fa9,_0x23da60;if(_0x360b70<=0x0){_0x360b70=0x1;}_0x458834=new RegExp(_0xa025('0x84')+_0x360b70+'}$');_0x316fa9=Math[_0xa025('0x85')](0xa,_0x360b70-0x1);_0x23da60=Math[_0xa025('0x85')](0xa,_0x360b70)-0x1;return util[_0xa025('0xf')]('%s',_['replace'](_0x1ed78e,_0x458834,_[_0xa025('0x86')](_0x316fa9,_0x23da60)));};exports[_0xa025('0x87')]=function(_0x105369){var _0x18b730=_0x105369['match'](/"(.*?)"/);return _0x18b730?_0x18b730[0x1]:_0x105369;};exports['extractCalleridNumber']=function(_0x4a8a2d){var _0x27f9cd=_0x4a8a2d[_0xa025('0x88')](/<(.*?)>/);return _0x27f9cd?_0x27f9cd[0x1]:_0x4a8a2d;};function buildNoAnswerEventPayload(_0x4e4b23,_0x365ad0){var _0x3ab163=buildObj(_0x4e4b23,_0xa025('0x89'));if(!_['isEmpty'](_0x365ad0[_0xa025('0x8a')])){Object['keys'](_0x365ad0[_0xa025('0x8a')])[_0xa025('0x8b')](function(_0x5d575b){_0x3ab163[_0x5d575b['toLowerCase']()]=_0x365ad0[_0xa025('0x8a')][_0x5d575b];});}return _0x3ab163;}exports[_0xa025('0x8c')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index de35584..48e8ceb 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 _0xb5e8=['voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','queueremove','queuepause','boolean'];(function(_0x5a5a32,_0x1b26e1){var _0x27499f=function(_0x108f5f){while(--_0x108f5f){_0x5a5a32['push'](_0x5a5a32['shift']());}};_0x27499f(++_0x1b26e1);}(_0xb5e8,0x123));var _0x8b5e=function(_0x539f28,_0x361f28){_0x539f28=_0x539f28-0x0;var _0x41ab5e=_0xb5e8[_0x539f28];return _0x41ab5e;};'use strict';exports[_0x8b5e('0x0')]={'queue':{'type':_0x8b5e('0x1'),'required':!![]},'interface':{'type':_0x8b5e('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x8b5e('0x2')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8b5e('0x1'),'required':!![]}};exports[_0x8b5e('0x3')]={'interface':{'type':_0x8b5e('0x1'),'required':!![]},'paused':{'type':_0x8b5e('0x4')},'reason':{'type':_0x8b5e('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0x8b5e('0x5')]={'uniqueid':{'type':_0x8b5e('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x8b5e('0x1')},'format':{'type':_0x8b5e('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x8b5e('0x6')]={'uniqueid':{'type':_0x8b5e('0x1'),'required':!![]}};exports[_0x8b5e('0x7')]={'uniqueid':{'type':_0x8b5e('0x1'),'required':!![]},'exten':{'type':_0x8b5e('0x1'),'required':!![]},'context':{'type':_0x8b5e('0x1')}}; \ No newline at end of file +var _0x793c=['voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause','boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x29b62d,_0x5cabb7){var _0x19bb61=function(_0x4e39dd){while(--_0x4e39dd){_0x29b62d['push'](_0x29b62d['shift']());}};_0x19bb61(++_0x5cabb7);}(_0x793c,0xe8));var _0xc793=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x793c[_0x9dfc10];return _0x4f938a;};'use strict';exports[_0xc793('0x0')]={'queue':{'type':_0xc793('0x1'),'required':!![]},'interface':{'type':_0xc793('0x1'),'required':!![]},'membername':{'type':_0xc793('0x1'),'required':!![]},'penalty':{'type':_0xc793('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xc793('0x3')]={'queue':{'type':_0xc793('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xc793('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xc793('0x5')},'reason':{'type':_0xc793('0x1'),'required':![]}};exports[_0xc793('0x6')]={'module':{'type':_0xc793('0x1'),'required':![]}};exports[_0xc793('0x7')]={'uniqueid':{'type':_0xc793('0x1'),'required':!![]}};exports[_0xc793('0x8')]={'uniqueid':{'type':_0xc793('0x1'),'required':!![]},'filename':{'type':_0xc793('0x1')},'format':{'type':_0xc793('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xc793('0x9')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xc793('0xa')]={'uniqueid':{'type':_0xc793('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xc793('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 0624407..67a033e 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x32ef6e,_0x53fdb9){var _0x571979=function(_0x165fe3){while(--_0x165fe3){_0x32ef6e['push'](_0x32ef6e['shift']());}};_0x571979(++_0x53fdb9);}(_0xb10b,0x12a));var _0xbb10=function(_0x5daeb2,_0x4b007c){_0x5daeb2=_0x5daeb2-0x0;var _0x2dbb9f=_0xb10b[_0x5daeb2];return _0x2dbb9f;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x19c981,_0x2e3e69){var _0x5923f4=function(_0x175c52){while(--_0x175c52){_0x19c981['push'](_0x19c981['shift']());}};_0x5923f4(++_0x2e3e69);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 8902460..1d95543 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x478e=['mergeDBDataToRealtime','hasOwnProperty'];(function(_0x4db715,_0x377fb4){var _0x47a929=function(_0x26f242){while(--_0x26f242){_0x4db715['push'](_0x4db715['shift']());}};_0x47a929(++_0x377fb4);}(_0x478e,0x1bf));var _0xe478=function(_0x39b316,_0x3def1e){_0x39b316=_0x39b316-0x0;var _0x182ab1=_0x478e[_0x39b316];return _0x182ab1;};'use strict';function mergeDBDataToRealtime(_0x101a9b,_0x25a942){var _0x5e5108=Object['assign']({},_0x101a9b);for(var _0x20e073 in _0x25a942){if(_0x5e5108[_0xe478('0x0')](_0x20e073)){_0x5e5108[_0x20e073]=_0x25a942[_0x20e073];}}return _0x5e5108;}exports[_0xe478('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xcb30=['assign','mergeDBDataToRealtime'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcb30,0x1a2));var _0x0cb3=function(_0x459335,_0x2e95dd){_0x459335=_0x459335-0x0;var _0x50f00b=_0xcb30[_0x459335];return _0x50f00b;};'use strict';function mergeDBDataToRealtime(_0x208a99,_0x50d8ec){var _0x48010b=Object[_0x0cb3('0x0')]({},_0x208a99);for(var _0x5b0d78 in _0x50d8ec){if(_0x48010b['hasOwnProperty'](_0x5b0d78)){_0x48010b[_0x5b0d78]=_0x50d8ec[_0x5b0d78];}}return _0x48010b;}exports[_0x0cb3('0x1')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 0095627..6f89d30 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 _0xf392=['lodash','util','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','agents','interface','format','SIP/%s','length','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','lastdata','queue','from-voip-provider','context','from-sip','xcally-motion-preview','destinationchannel','calleridpreview','originatecalleridnum','ANSWERED','callerid','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','UserId','monitors','filename','createdAt','connectedlinenum','connectedlinename','membername','xcally-motion-dialer','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports'];(function(_0x3c0693,_0xa38582){var _0x2313ac=function(_0x2d4130){while(--_0x2d4130){_0x3c0693['push'](_0x3c0693['shift']());}};_0x2313ac(++_0xa38582);}(_0xf392,0x126));var _0x2f39=function(_0x571a09,_0x879b52){_0x571a09=_0x571a09-0x0;var _0x40487f=_0xf392[_0x571a09];return _0x40487f;};'use strict';var _=require(_0x2f39('0x0'));var moment=require('moment');var util=require(_0x2f39('0x1'));var config=require(_0x2f39('0x2'));var ami=require(_0x2f39('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x2f39('0x4'));var RpcMemberReport=require(_0x2f39('0x5'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x2f39('0x6'));var RpcVoiceTransferReport=require(_0x2f39('0x7'));var VoiceQueueReport=require(_0x2f39('0x8'));var VoiceCallReport=require(_0x2f39('0x9'));var VoiceAgentReport=require(_0x2f39('0xa'));var VoiceDialReport=require(_0x2f39('0xb'));var UserReport=require(_0x2f39('0xc'));function Report(_0x13e3c1){this[_0x2f39('0xd')]=_0x13e3c1;this['agents']=_0x13e3c1['agents'];this[_0x2f39('0xe')]=_0x13e3c1[_0x2f39('0xe')];}Report[_0x2f39('0xf')][_0x2f39('0x10')]=function(_0xfd2a41){var _0x4b5c5d=new VoiceQueueReport(this[_0x2f39('0xd')]);var _0x1e4e1a=new VoiceAgentReport(this[_0x2f39('0xd')]);var _0x4c6a90=new VoiceDialReport(this[_0x2f39('0xd')]);var _0xa9057a=new VoiceCallReport(this[_0x2f39('0xd')]);var _0x34150a=new UserReport(this[_0x2f39('0xd')]);if(config[_0x2f39('0x11')]&&config[_0x2f39('0x11')][_0x2f39('0x12')]){ami['on'](_0x2f39('0x13'),this[_0x2f39('0x14')]['bind'](this));ami['on'](_0x2f39('0x15'),this[_0x2f39('0x16')][_0x2f39('0x17')](this));ami['on'](_0x2f39('0x18'),this[_0x2f39('0x19')][_0x2f39('0x17')](this));ami['on']('custom:voiceDialReport',this[_0x2f39('0x1a')][_0x2f39('0x17')](this));ami['on'](_0x2f39('0x1b'),this['blindTransfer'][_0x2f39('0x17')](this));ami['on'](_0x2f39('0x1c'),this[_0x2f39('0x1d')][_0x2f39('0x17')](this));}};Report[_0x2f39('0xf')][_0x2f39('0x1e')]=function(_0x5262ec){var _0x350001;_0x350001=_[_0x2f39('0x1f')](this['agents'],function(_0x3b5d88){return _0x3b5d88[_0x2f39('0x20')]==_0x5262ec||_0x3b5d88[_0x2f39('0x21')]==_0x5262ec;});if(_[_0x2f39('0x22')](_0x350001)){var _0x421a28=_['find'](this[_0x2f39('0xe')],function(_0x27c614){return _0x27c614[_0x2f39('0x20')]==_0x5262ec||_0x27c614['name']==_0x5262ec;});if(_0x421a28){_0x350001=_[_0x2f39('0x1f')](this[_0x2f39('0x23')],function(_0x3bed43){return _0x3bed43[_0x2f39('0x24')]==util[_0x2f39('0x25')](_0x2f39('0x26'),_0x421a28[_0x2f39('0x21')]);});}}return _0x350001;};Report[_0x2f39('0xf')]['voiceQueueReport']=function(_0x53fe30){for(var _0x5c0760=0x0;_0x5c0760<_0x53fe30[_0x2f39('0x27')];_0x5c0760+=0x1){var _0x3a60f7=this[_0x2f39('0x1e')](_0x53fe30[_0x5c0760]['connectedlinenum']);if(_0x3a60f7){_0x53fe30[_0x5c0760][_0x2f39('0x20')]=_0x3a60f7[_0x2f39('0x20')];_0x53fe30[_0x5c0760][_0x2f39('0x28')]=!![];_0x53fe30[_0x5c0760][_0x2f39('0x29')]=_0x3a60f7[_0x2f39('0x21')];_0x53fe30[_0x5c0760]['interface']=_[_0x2f39('0x22')](_0x3a60f7['interface'])?util[_0x2f39('0x25')](_0x2f39('0x26'),_0x3a60f7[_0x2f39('0x21')]):_0x3a60f7[_0x2f39('0x24')];if(_0x53fe30[_0x5c0760][_0x2f39('0x2a')]){_0x53fe30[_0x5c0760][_0x2f39('0x2b')]=moment()[_0x2f39('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x53fe30[_0x5c0760][_0x2f39('0x2c')]){_0x53fe30[_0x5c0760][_0x2f39('0x2d')]=moment()[_0x2f39('0x25')](_0x2f39('0x2e'));}RpcMemberReport[_0x2f39('0x14')](_0x53fe30[_0x5c0760]);}RpcVoiceQueueReport[_0x2f39('0x2f')](_0x53fe30[_0x5c0760]);}};function extractCalleridNumber(_0x26e722){var _0x1fd42d=_0x26e722[_0x2f39('0x30')](/<(.*?)>/);return _0x1fd42d?_0x1fd42d[0x1]:_0x26e722;}Report[_0x2f39('0xf')][_0x2f39('0x31')]=function(_0x17e5ae){for(var _0x5312db=0x0;_0x5312db','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','monitor','monitors','filename','createdAt','connectedlinename','originatecalleridnum','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf'];(function(_0x43a044,_0xa28956){var _0x462db0=function(_0x15f1b0){while(--_0x15f1b0){_0x43a044['push'](_0x43a044['shift']());}};_0x462db0(++_0xa28956);}(_0xef02,0x1d7));var _0x2ef0=function(_0x9c8b4a,_0x2387ff){_0x9c8b4a=_0x9c8b4a-0x0;var _0x198bef=_0xef02[_0x9c8b4a];return _0x198bef;};'use strict';var _=require(_0x2ef0('0x0'));var moment=require(_0x2ef0('0x1'));var util=require(_0x2ef0('0x2'));var config=require(_0x2ef0('0x3'));var ami=require(_0x2ef0('0x4'));var RpcVoiceAgentReport=require(_0x2ef0('0x5'));var RpcVoiceCallReport=require(_0x2ef0('0x6'));var RpcVoiceDialReport=require(_0x2ef0('0x7'));var RpcMemberReport=require(_0x2ef0('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x2ef0('0x9'));var RpcVoiceTransferReport=require(_0x2ef0('0xa'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x2ef0('0xb'));var VoiceAgentReport=require(_0x2ef0('0xc'));var VoiceDialReport=require(_0x2ef0('0xd'));var UserReport=require(_0x2ef0('0xe'));function Report(_0x37f410){this['realtime']=_0x37f410;this['agents']=_0x37f410[_0x2ef0('0xf')];this['telephones']=_0x37f410[_0x2ef0('0x10')];}Report[_0x2ef0('0x11')][_0x2ef0('0x12')]=function(_0xcab69f){var _0x247d14=new VoiceQueueReport(this[_0x2ef0('0x13')]);var _0x26ce69=new VoiceAgentReport(this['realtime']);var _0x197042=new VoiceDialReport(this[_0x2ef0('0x13')]);var _0x1ad7ad=new VoiceCallReport(this[_0x2ef0('0x13')]);var _0x46ad6a=new UserReport(this[_0x2ef0('0x13')]);if(config[_0x2ef0('0x14')]&&config[_0x2ef0('0x14')][_0x2ef0('0x15')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x2ef0('0x16')](this));ami['on'](_0x2ef0('0x17'),this['voiceCallReport'][_0x2ef0('0x16')](this));ami['on'](_0x2ef0('0x18'),this[_0x2ef0('0x19')][_0x2ef0('0x16')](this));ami['on'](_0x2ef0('0x1a'),this[_0x2ef0('0x1b')][_0x2ef0('0x16')](this));ami['on']('blindtransfer',this[_0x2ef0('0x1c')][_0x2ef0('0x16')](this));ami['on'](_0x2ef0('0x1d'),this[_0x2ef0('0x1e')][_0x2ef0('0x16')](this));}};Report[_0x2ef0('0x11')][_0x2ef0('0x1f')]=function(_0x32d5d3){var _0x56b3a2;_0x56b3a2=_['find'](this['agents'],function(_0x47361e){return _0x47361e['accountcode']==_0x32d5d3||_0x47361e['name']==_0x32d5d3;});if(_[_0x2ef0('0x20')](_0x56b3a2)){var _0x709c2c=_[_0x2ef0('0x21')](this[_0x2ef0('0x10')],function(_0x334926){return _0x334926[_0x2ef0('0x22')]==_0x32d5d3||_0x334926['name']==_0x32d5d3;});if(_0x709c2c){_0x56b3a2=_['find'](this[_0x2ef0('0xf')],function(_0x544929){return _0x544929['interface']==util['format'](_0x2ef0('0x23'),_0x709c2c[_0x2ef0('0x24')]);});}}return _0x56b3a2;};Report[_0x2ef0('0x11')][_0x2ef0('0x25')]=function(_0x1a2b61){for(var _0x20fcd7=0x0;_0x20fcd7<_0x1a2b61[_0x2ef0('0x26')];_0x20fcd7+=0x1){var _0x34ba60=this[_0x2ef0('0x1f')](_0x1a2b61[_0x20fcd7]['connectedlinenum']);if(_0x34ba60){_0x1a2b61[_0x20fcd7][_0x2ef0('0x22')]=_0x34ba60[_0x2ef0('0x22')];_0x1a2b61[_0x20fcd7]['assigned']=!![];_0x1a2b61[_0x20fcd7][_0x2ef0('0x27')]=_0x34ba60[_0x2ef0('0x24')];_0x1a2b61[_0x20fcd7][_0x2ef0('0x28')]=_['isNil'](_0x34ba60['interface'])?util[_0x2ef0('0x29')](_0x2ef0('0x23'),_0x34ba60['name']):_0x34ba60[_0x2ef0('0x28')];if(_0x1a2b61[_0x20fcd7][_0x2ef0('0x2a')]){_0x1a2b61[_0x20fcd7][_0x2ef0('0x2b')]=moment()[_0x2ef0('0x29')](_0x2ef0('0x2c'));}if(_0x1a2b61[_0x20fcd7]['queuecallerexit']){_0x1a2b61[_0x20fcd7][_0x2ef0('0x2d')]=moment()[_0x2ef0('0x29')](_0x2ef0('0x2c'));}RpcMemberReport[_0x2ef0('0x25')](_0x1a2b61[_0x20fcd7]);}RpcVoiceQueueReport[_0x2ef0('0x2e')](_0x1a2b61[_0x20fcd7]);}};function extractCalleridNumber(_0x442397){var _0x9edc4=_0x442397[_0x2ef0('0x2f')](/<(.*?)>/);return _0x9edc4?_0x9edc4[0x1]:_0x442397;}Report['prototype'][_0x2ef0('0x30')]=function(_0x585319){for(var _0x359bce=0x0;_0x359bce0x0?!![]:![];if(!_0x5ce3c1){return this[_0x5637('0x18')](this[_0x5637('0x14')][_0x5637('0x68')]);}};VoiceQueueReport['prototype'][_0x5637('0x1b')]=function(_0x194cb2){var _0x46eaa6=this[_0x5637('0x14')]['id'];if(this[_0x5637('0x14')][_0x5637('0x64')][_0x46eaa6]&&this[_0x5637('0x14')][_0x5637('0x64')][_0x46eaa6][_0x194cb2[_0x5637('0x5d')]]){this[_0x5637('0x14')][_0x5637('0x64')][_0x46eaa6][_0x194cb2['actionid']]['agents']['push'](_0x194cb2);}};VoiceQueueReport[_0x5637('0x43')][_0x5637('0x16')]=function(_0xf09c43){var _0x32e4cf=this;try{if(this[_0x5637('0x57')](_0xf09c43)&&this[_0x5637('0x57')](_0xf09c43[_0x5637('0x4e')])){logger['debug'](_0x5637('0x69'),util[_0x5637('0x40')](_0xf09c43,{'showHidden':![],'depth':null}));var _0x2cdf1b=this['voiceQueues'][_0xf09c43['queue']];if(_0x2cdf1b){logger[_0x5637('0x49')](_0x5637('0x6a'),_0x2cdf1b[_0x5637('0x5f')]);this[_0x5637('0x14')][_0x5637('0x5e')][_0x2cdf1b['name']]={'summaryEvent':_0xf09c43};this[_0x5637('0x14')][_0x5637('0x67')]+=0x1;return ami[_0x5637('0x39')]({'action':_0x5637('0x64'),'queue':_0x2cdf1b[_0x5637('0x5f')]})[_0x5637('0x5c')](function(_0x18d437){if(!_0x32e4cf['summary'][_0x5637('0x64')][_0xf09c43['actionid']]){_0x32e4cf['summary']['queuestatus'][_0xf09c43[_0x5637('0x5d')]]={};}_0x32e4cf['summary'][_0x5637('0x64')][_0xf09c43['actionid']][_0x18d437[_0x5637('0x5d')]]={'queue':_0x2cdf1b[_0x5637('0x5f')],'agents':[]};})[_0x5637('0x3b')](function(_0x2604ee){throw _0x2604ee;});}}}catch(_0x4d2e7d){logger[_0x5637('0x3e')](_0x5637('0x6b'),util['inspect'](_0x4d2e7d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5637('0x18')]=function(_0x494c92){if(this[_0x5637('0x14')][_0x5637('0x67')]>0x0){this[_0x5637('0x14')][_0x5637('0x68')]=_0x494c92;return;}logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x494c92,{'showHidden':![],'depth':null}));this[_0x5637('0x14')]=initializeSummary();ami[_0x5637('0x48')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x5637('0x43')][_0x5637('0x1f')]=function(_0x26b841){try{if(this[_0x5637('0x57')](_0x26b841)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x26b841[_0x5637('0x4c')],util['inspect'](_0x26b841,{'showHidden':![],'depth':null}));if(_[_0x5637('0x58')](this['queueReports'][_0x26b841['uniqueid']])){this[_0x5637('0xd')][_0x26b841[_0x5637('0x4c')]]=[];}if(_['isUndefined'](this[_0x5637('0x10')][_0x26b841[_0x5637('0x4c')]])){this[_0x5637('0x10')][_0x26b841[_0x5637('0x4c')]]={};}var _0x139d14=new QueueReport();_0x139d14['queue']=_0x26b841[_0x5637('0x4e')];_0x139d14['type']=this[_0x5637('0x12')][_0x139d14[_0x5637('0x4e')]]&&this['voiceQueues'][_0x139d14[_0x5637('0x4e')]][_0x5637('0x54')]?this[_0x5637('0x12')][_0x139d14[_0x5637('0x4e')]][_0x5637('0x54')]||'inbound':'inbound';_0x139d14[_0x5637('0x6c')]=moment()[_0x5637('0x51')](_0x5637('0x6d'));_0x139d14[_0x5637('0x6e')]=_0x26b841['position'];_0x139d14[_0x5637('0x6f')]=_0x26b841[_0x5637('0x6f')];_0x139d14[_0x5637('0x4c')]=_0x26b841['uniqueid'];_0x139d14[_0x5637('0x70')]=this['channels'][_0x26b841['uniqueid']][_0x5637('0x70')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x139d14[_0x5637('0x4e')],_0x139d14[_0x5637('0x54')]);Object[_0x5637('0x71')](_0x139d14,_[_0x5637('0x72')](_0x26b841,_[_0x5637('0x73')](_0x139d14)));this[_0x5637('0xd')][_0x26b841[_0x5637('0x4c')]][_0x5637('0x74')](_0x139d14);this[_0x5637('0x10')][_0x26b841[_0x5637('0x4c')]]=_0x139d14;this[_0x5637('0x75')](_0x139d14,_0x5637('0x1e'));}}catch(_0x409f10){logger['error'](_0x5637('0x76'),_0x26b841[_0x5637('0x4c')],util[_0x5637('0x40')](_0x409f10,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5637('0x43')][_0x5637('0x20')]=function(_0x5f3194){try{if(this['isNotNull'](_0x5f3194)){logger[_0x5637('0x49')](_0x5637('0x77'),_0x5f3194['uniqueid'],util[_0x5637('0x40')](_0x5f3194,{'showHidden':![],'depth':null}));if(this[_0x5637('0xd')][_0x5f3194[_0x5637('0x4c')]]){var _0xca6b9e=_[_0x5637('0x78')](this[_0x5637('0xd')][_0x5f3194[_0x5637('0x4c')]]);_0xca6b9e[_0x5637('0x79')]=![];_0xca6b9e['queuecallercompleteAt']=null;_0xca6b9e[_0x5637('0x7a')]=_0x5f3194[_0x5637('0x7a')];_0xca6b9e['originalposition']=_0x5f3194[_0x5637('0x7b')];_0xca6b9e[_0x5637('0x35')]=!![];_0xca6b9e[_0x5637('0x7c')]=moment()[_0x5637('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0xca6b9e[_0x5637('0x7d')]=_0x5637('0x7e');_0xca6b9e[_0x5637('0x7f')]=null;logger['info'](_0x5637('0x80'),_0xca6b9e[_0x5637('0x4e')],_0xca6b9e[_0x5637('0x54')]);this[_0x5637('0x10')][_0x5f3194[_0x5637('0x4c')]]=_0xca6b9e;this[_0x5637('0x46')](_0xca6b9e,'queuecallerabandon');}}}catch(_0x48cded){logger[_0x5637('0x3e')](_0x5637('0x77'),_0x5f3194[_0x5637('0x4c')],util[_0x5637('0x40')](_0x48cded,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5637('0x43')]['syncQueueCallerLeave']=function(_0x12a51e){try{if(this[_0x5637('0x57')](_0x12a51e)){logger[_0x5637('0x49')](_0x5637('0x81'),_0x12a51e[_0x5637('0x4c')],util[_0x5637('0x40')](_0x12a51e,{'showHidden':![],'depth':null}));if(this[_0x5637('0xd')][_0x12a51e[_0x5637('0x4c')]]){var _0x56010e=_[_0x5637('0x78')](this[_0x5637('0xd')][_0x12a51e[_0x5637('0x4c')]]);_0x56010e['queuecallerleaveAt']=moment()[_0x5637('0x51')](_0x5637('0x6d'));_0x56010e[_0x5637('0x82')]=_0x12a51e[_0x5637('0x82')];_0x56010e['connectedlinename']=_0x12a51e[_0x5637('0x83')];logger[_0x5637('0x84')](_0x5637('0x85'),_0x56010e[_0x5637('0x4e')],_0x56010e[_0x5637('0x54')],_0x12a51e[_0x5637('0x82')],_0x12a51e[_0x5637('0x83')]);this['channels'][_0x12a51e[_0x5637('0x4c')]]=_0x56010e;this['emitVoiceQueueChannelSave'](_0x56010e,_0x5637('0x21'));}}}catch(_0x1c7ca1){logger[_0x5637('0x3e')](_0x5637('0x81'),_0x12a51e['uniqueid'],util['inspect'](_0x1c7ca1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5637('0x43')][_0x5637('0x86')]=function(_0x3c6e2a){try{if(this[_0x5637('0x57')](_0x3c6e2a)){logger[_0x5637('0x49')](_0x5637('0x87'),_0x3c6e2a[_0x5637('0x4c')],util[_0x5637('0x40')](_0x3c6e2a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3c6e2a[_0x5637('0x4c')]]){var _0x13e9ce=_['last'](this[_0x5637('0xd')][_0x3c6e2a['uniqueid']]);_0x13e9ce[_0x5637('0x79')]=!![];_0x13e9ce[_0x5637('0x7d')]=_0x5637('0x88');logger[_0x5637('0x84')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x13e9ce['queue'],_0x13e9ce[_0x5637('0x54')]);}}}catch(_0x3062bb){logger[_0x5637('0x3e')](_0x5637('0x87'),_0x3c6e2a[_0x5637('0x4c')],util[_0x5637('0x40')](_0x3062bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5637('0x23')]=function(_0x480820){try{if(this['isNotNull'](_0x480820)){logger[_0x5637('0x49')](_0x5637('0x89'),_0x480820[_0x5637('0x4c')],util['inspect'](_0x480820,{'showHidden':![],'depth':null}));if(this[_0x5637('0xd')][_0x480820[_0x5637('0x4c')]]){var _0x47b6fe=_['last'](this[_0x5637('0xd')][_0x480820[_0x5637('0x4c')]]);_0x47b6fe[_0x5637('0x35')]=![];_0x47b6fe[_0x5637('0x7c')]=null;_0x47b6fe[_0x5637('0x8a')]=!![];_0x47b6fe[_0x5637('0x7f')]=_0x480820[_0x5637('0x8b')];_0x47b6fe[_0x5637('0x7a')]=_0x480820[_0x5637('0x7a')];_0x47b6fe['queuecallercomplete']=!![];_0x47b6fe[_0x5637('0x34')]=![];_0x47b6fe[_0x5637('0x8c')]=null;if(!_0x47b6fe['transfer']){if(_0x480820['reason']==_0x5637('0x8d')){_0x47b6fe['queuecallerexitreason']='COMPLETED';logger[_0x5637('0x84')](_0x5637('0x8e'),_0x47b6fe[_0x5637('0x4e')],_0x47b6fe[_0x5637('0x54')]);}else{if(_[_0x5637('0x8f')](_0x480820[_0x5637('0x3a')]['toLowerCase'](),'local/')){if(this['queueReports'][_0x480820[_0x5637('0x90')]]){var _0x20e2c5=_[_0x5637('0x78')](this[_0x5637('0xd')][_0x480820[_0x5637('0x90')]]);_0x20e2c5[_0x5637('0x79')]=![];_0x20e2c5[_0x5637('0x34')]=!![];_0x20e2c5[_0x5637('0x8c')]=moment(_0x47b6fe[_0x5637('0x6c')])[_0x5637('0x91')](_0x480820[_0x5637('0x7a')],_0x5637('0x92'))[_0x5637('0x51')](_0x5637('0x6d'));_0x20e2c5[_0x5637('0x7d')]='FORWARDTRANSFER';_0x20e2c5[_0x5637('0x8d')]=!![];_0x20e2c5[_0x5637('0x93')]=_0x5637('0x94');_0x20e2c5['transferexten']=_0x480820['destexten'];_0x20e2c5[_0x5637('0x95')]=_0x480820[_0x5637('0x4c')];logger[_0x5637('0x84')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x20e2c5[_0x5637('0x4e')],_0x20e2c5[_0x5637('0x54')]);var _0x5411d7=this[_0x5637('0xd')][_0x480820[_0x5637('0x90')]];this['queueReports'][_0x480820['linkedid']]=this[_0x5637('0xd')][_0x480820[_0x5637('0x4c')]];this[_0x5637('0xd')][_0x480820[_0x5637('0x4c')]]=_0x5411d7;}}else{_0x47b6fe[_0x5637('0x7d')]=_0x5637('0x96')+_0x480820[_0x5637('0x97')][_0x5637('0x98')]();logger[_0x5637('0x84')](_0x5637('0x99'),_0x47b6fe[_0x5637('0x4e')],_0x47b6fe[_0x5637('0x54')],_0x47b6fe[_0x5637('0x7d')]);}}}this['channels'][_0x480820['uniqueid']]=_0x47b6fe;}}}catch(_0x5a7fe7){logger[_0x5637('0x3e')](_0x5637('0x89'),_0x480820[_0x5637('0x4c')],util[_0x5637('0x40')](_0x5a7fe7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5637('0x43')][_0x5637('0x9a')]=function(_0x3b8645){try{if(this[_0x5637('0x57')](_0x3b8645)){logger['debug'](_0x5637('0x9b'),_0x3b8645[_0x5637('0x4c')],util[_0x5637('0x40')](_0x3b8645,{'showHidden':![],'depth':null}));this[_0x5637('0x9c')](_0x3b8645[_0x5637('0x4c')],_[_0x5637('0x73')](_0x3b8645[_0x5637('0x9d')])[0x0],_0x3b8645['value']);if(this[_0x5637('0xd')][_0x3b8645[_0x5637('0x4c')]]){var _0x420966=_['last'](this[_0x5637('0xd')][_0x3b8645[_0x5637('0x4c')]]);if(_0x420966){if(this[_0x5637('0x57')](_0x3b8645[_0x5637('0x9d')])&&this[_0x5637('0x57')](_0x3b8645[_0x5637('0x9d')][_0x5637('0x64')])){switch(_0x3b8645[_0x5637('0x9e')]){case'CONTINUE':_0x420966[_0x5637('0x34')]=![];_0x420966[_0x5637('0x8c')]=null;break;case'TIMEOUT':_0x420966[_0x5637('0x9f')]='timeout';_0x420966[_0x5637('0x34')]=!![];_0x420966[_0x5637('0x8c')]=moment()[_0x5637('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x420966[_0x5637('0xa0')]=moment()[_0x5637('0x51')](_0x5637('0x6d'));logger['debug'](_0x5637('0xa1'),_0x3b8645[_0x5637('0x4c')],util[_0x5637('0x40')](_0x420966,{'showHidden':![],'depth':null}));ami[_0x5637('0x48')](_0x5637('0xa2'),_0x420966);break;default:_0x420966[_0x5637('0x34')]=!![];_0x420966[_0x5637('0x8c')]=moment()[_0x5637('0x51')](_0x5637('0x6d'));_0x420966[_0x5637('0xa0')]=moment()[_0x5637('0x51')](_0x5637('0x6d'));}_0x420966[_0x5637('0x35')]=![];_0x420966['queuecallerabandonAt']=null;_0x420966[_0x5637('0x7d')]=_0x3b8645['value'];this['channels'][_0x3b8645[_0x5637('0x4c')]]=_0x420966;this['emitVoiceQueueChannelRemove'](_0x420966,'varset');}else if(this['isNotNull'](_0x3b8645['variable'])&&this['isNotNull'](_0x3b8645[_0x5637('0x9d')]['queueposition'])){if(!_0x420966['queuecallerabandon']){_0x420966[_0x5637('0x34')]=!![];_0x420966['queuecallerexitAt']=moment()[_0x5637('0x51')](_0x5637('0x6d'));_0x420966[_0x5637('0x7d')]='EXITWITHKEY';_0x420966[_0x5637('0xa0')]=moment()['format'](_0x5637('0x6d'));this[_0x5637('0x10')][_0x3b8645[_0x5637('0x4c')]]=_0x420966;}}logger[_0x5637('0x84')](_0x5637('0xa3'),_0x3b8645[_0x5637('0x4c')],_0x420966['queue'],_0x420966[_0x5637('0x54')],_['keys'](_0x3b8645[_0x5637('0x9d')])[0x0],_0x3b8645[_0x5637('0x9e')]);_0x420966[_0x5637('0x15')]=this[_0x5637('0x15')][_0x3b8645[_0x5637('0x4c')]];}}}}catch(_0x304ee4){logger[_0x5637('0x3e')](_0x5637('0x9b'),_0x3b8645[_0x5637('0x4c')],util['inspect'](_0x304ee4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5637('0x9c')]=function(_0x55ebc5,_0x5569ff,_0xa631f){var _0x2737ba=[_0x5637('0xa4'),_0x5637('0xa5'),'rtpaudioqosjitter',_0x5637('0xa6'),_0x5637('0xa7'),_0x5637('0xa8'),'rtpaudioqosrtt',_0x5637('0xa9'),_0x5637('0xaa'),'sipuri','bridgepeer',_0x5637('0xab'),_0x5637('0xac'),'memberdynamic',_0x5637('0xad'),'memberlastcall',_0x5637('0x8b'),_0x5637('0xae'),_0x5637('0xaf')];if(!_[_0x5637('0x38')](_0x5569ff)&&!_[_0x5637('0xb0')](_0x2737ba,_0x5569ff)){if(_[_0x5637('0x58')](this[_0x5637('0x15')][_0x55ebc5])){this[_0x5637('0x15')][_0x55ebc5]={};}this[_0x5637('0x15')][_0x55ebc5][_0x5569ff]=_0xa631f;}};VoiceQueueReport['prototype'][_0x5637('0xb1')]=function(_0x3abcb4,_0xa15c02,_0x5b90f9){try{var _0x1c3448={};if(this[_0x5637('0xd')][_0x3abcb4]){for(var _0x55ae76=0x0;_0x55ae760x0?!![]:![];if(!_0x15c782){return this[_0x5c64('0x18')](this[_0x5c64('0x4b')]['completeEvent']);}};VoiceQueueReport[_0x5c64('0x8')][_0x5c64('0x1a')]=function(_0x5b4e32){var _0x3eb475=this[_0x5c64('0x4b')]['id'];if(this[_0x5c64('0x4b')][_0x5c64('0x69')][_0x3eb475]&&this[_0x5c64('0x4b')][_0x5c64('0x69')][_0x3eb475][_0x5b4e32[_0x5c64('0x67')]]){this[_0x5c64('0x4b')]['queuestatus'][_0x3eb475][_0x5b4e32[_0x5c64('0x67')]][_0x5c64('0xe')]['push'](_0x5b4e32);}};VoiceQueueReport[_0x5c64('0x8')][_0x5c64('0x15')]=function(_0x4958d3){var _0x144642=this;try{if(this['isNotNull'](_0x4958d3)&&this[_0x5c64('0x61')](_0x4958d3[_0x5c64('0x59')])){logger[_0x5c64('0x4f')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x4958d3,{'showHidden':![],'depth':null}));var _0x4fe7bd=this[_0x5c64('0x11')][_0x4958d3[_0x5c64('0x59')]];if(_0x4fe7bd){logger[_0x5c64('0x4f')](_0x5c64('0x71'),_0x4fe7bd[_0x5c64('0x5f')]);this[_0x5c64('0x4b')]['queues'][_0x4fe7bd['name']]={'summaryEvent':_0x4958d3};this[_0x5c64('0x4b')]['statusRequests']+=0x1;return ami['Action']({'action':_0x5c64('0x69'),'queue':_0x4fe7bd[_0x5c64('0x5f')]})[_0x5c64('0x66')](function(_0xe71fc6){if(!_0x144642[_0x5c64('0x4b')][_0x5c64('0x69')][_0x4958d3[_0x5c64('0x67')]]){_0x144642[_0x5c64('0x4b')]['queuestatus'][_0x4958d3['actionid']]={};}_0x144642[_0x5c64('0x4b')][_0x5c64('0x69')][_0x4958d3[_0x5c64('0x67')]][_0xe71fc6['actionid']]={'queue':_0x4fe7bd[_0x5c64('0x5f')],'agents':[]};})[_0x5c64('0x43')](function(_0x350a8b){throw _0x350a8b;});}}}catch(_0x245642){logger['error'](_0x5c64('0x6a'),util[_0x5c64('0x49')](_0x245642,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c64('0x8')][_0x5c64('0x18')]=function(_0x25947c){if(this[_0x5c64('0x4b')][_0x5c64('0x70')]>0x0){this[_0x5c64('0x4b')][_0x5c64('0x72')]=_0x25947c;return;}logger[_0x5c64('0x4f')](_0x5c64('0x73'),util[_0x5c64('0x49')](_0x25947c,{'showHidden':![],'depth':null}));this[_0x5c64('0x4b')]=initializeSummary();ami[_0x5c64('0x4d')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x5c64('0x8')][_0x5c64('0x1d')]=function(_0x421f7f){try{if(this[_0x5c64('0x61')](_0x421f7f)){logger['debug'](_0x5c64('0x74'),_0x421f7f[_0x5c64('0x75')],util[_0x5c64('0x49')](_0x421f7f,{'showHidden':![],'depth':null}));if(_[_0x5c64('0x62')](this[_0x5c64('0xc')][_0x421f7f[_0x5c64('0x75')]])){this[_0x5c64('0xc')][_0x421f7f[_0x5c64('0x75')]]=[];}if(_[_0x5c64('0x62')](this[_0x5c64('0xf')][_0x421f7f[_0x5c64('0x75')]])){this[_0x5c64('0xf')][_0x421f7f[_0x5c64('0x75')]]={};}var _0x5316b7=new QueueReport();_0x5316b7[_0x5c64('0x59')]=_0x421f7f['queue'];_0x5316b7['type']=this[_0x5c64('0x11')][_0x5316b7['queue']]&&this[_0x5c64('0x11')][_0x5316b7[_0x5c64('0x59')]]['type']?this['voiceQueues'][_0x5316b7['queue']][_0x5c64('0x5c')]||_0x5c64('0x5d'):_0x5c64('0x5d');_0x5316b7[_0x5c64('0x76')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5316b7[_0x5c64('0x77')]=_0x421f7f[_0x5c64('0x77')];_0x5316b7[_0x5c64('0x78')]=_0x421f7f[_0x5c64('0x78')];_0x5316b7[_0x5c64('0x75')]=_0x421f7f[_0x5c64('0x75')];_0x5316b7[_0x5c64('0x79')]=this['channels'][_0x421f7f[_0x5c64('0x75')]][_0x5c64('0x79')];logger[_0x5c64('0x7a')](_0x5c64('0x7b'),_0x5316b7[_0x5c64('0x59')],_0x5316b7['type']);Object[_0x5c64('0x6e')](_0x5316b7,_[_0x5c64('0x7c')](_0x421f7f,_[_0x5c64('0x7d')](_0x5316b7)));this[_0x5c64('0xc')][_0x421f7f[_0x5c64('0x75')]]['push'](_0x5316b7);this['channels'][_0x421f7f[_0x5c64('0x75')]]=_0x5316b7;this['emitVoiceQueueChannelSave'](_0x5316b7,'queuecallerjoin');}}catch(_0x4a326f){logger[_0x5c64('0x46')]('[%s][voiceQueueReport][queuecallerjoin]',_0x421f7f[_0x5c64('0x75')],util[_0x5c64('0x49')](_0x4a326f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c64('0x8')][_0x5c64('0x1f')]=function(_0x56dcd5){try{if(this[_0x5c64('0x61')](_0x56dcd5)){logger[_0x5c64('0x4f')]('[%s][voiceQueueReport][queuecallerabandon]',_0x56dcd5[_0x5c64('0x75')],util['inspect'](_0x56dcd5,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x56dcd5[_0x5c64('0x75')]]){var _0x2a7288=_[_0x5c64('0x7e')](this['queueReports'][_0x56dcd5[_0x5c64('0x75')]]);_0x2a7288['queuecallercomplete']=![];_0x2a7288[_0x5c64('0x7f')]=null;_0x2a7288[_0x5c64('0x80')]=_0x56dcd5[_0x5c64('0x80')];_0x2a7288[_0x5c64('0x81')]=_0x56dcd5['originalposition'];_0x2a7288[_0x5c64('0x1e')]=!![];_0x2a7288['queuecallerabandonAt']=moment()[_0x5c64('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a7288[_0x5c64('0x56')]=_0x5c64('0x82');_0x2a7288[_0x5c64('0x83')]=null;logger['info'](_0x5c64('0x84'),_0x2a7288[_0x5c64('0x59')],_0x2a7288['type']);this[_0x5c64('0xf')][_0x56dcd5['uniqueid']]=_0x2a7288;this[_0x5c64('0x4c')](_0x2a7288,_0x5c64('0x1e'));}}}catch(_0x39e893){logger[_0x5c64('0x46')](_0x5c64('0x85'),_0x56dcd5[_0x5c64('0x75')],util[_0x5c64('0x49')](_0x39e893,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5c64('0x21')]=function(_0x2090d2){try{if(this[_0x5c64('0x61')](_0x2090d2)){logger['debug'](_0x5c64('0x86'),_0x2090d2[_0x5c64('0x75')],util[_0x5c64('0x49')](_0x2090d2,{'showHidden':![],'depth':null}));if(this[_0x5c64('0xc')][_0x2090d2[_0x5c64('0x75')]]){var _0x4b3058=_[_0x5c64('0x7e')](this[_0x5c64('0xc')][_0x2090d2[_0x5c64('0x75')]]);_0x4b3058[_0x5c64('0x87')]=moment()['format'](_0x5c64('0x88'));_0x4b3058[_0x5c64('0x89')]=_0x2090d2[_0x5c64('0x89')];_0x4b3058[_0x5c64('0x8a')]=_0x2090d2[_0x5c64('0x8a')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4b3058[_0x5c64('0x59')],_0x4b3058['type'],_0x2090d2[_0x5c64('0x89')],_0x2090d2[_0x5c64('0x8a')]);this[_0x5c64('0xf')][_0x2090d2[_0x5c64('0x75')]]=_0x4b3058;this['emitVoiceQueueChannelSave'](_0x4b3058,_0x5c64('0x20'));}}}catch(_0x4e29ca){logger[_0x5c64('0x46')]('[%s][voiceQueueReport][queuecallerleave]',_0x2090d2[_0x5c64('0x75')],util['inspect'](_0x4e29ca,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5c64('0x24')]=function(_0x5d3eb8){try{if(this[_0x5c64('0x61')](_0x5d3eb8)){logger[_0x5c64('0x4f')]('[%s][voiceQueueReport][agentconnect]',_0x5d3eb8[_0x5c64('0x75')],util['inspect'](_0x5d3eb8,{'showHidden':![],'depth':null}));if(this[_0x5c64('0xc')][_0x5d3eb8[_0x5c64('0x75')]]){var _0x19beed=_[_0x5c64('0x7e')](this['queueReports'][_0x5d3eb8[_0x5c64('0x75')]]);_0x19beed[_0x5c64('0x3b')]=!![];_0x19beed[_0x5c64('0x56')]=_0x5c64('0x8b');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x19beed[_0x5c64('0x59')],_0x19beed[_0x5c64('0x5c')]);}}}catch(_0x1cb3c5){logger[_0x5c64('0x46')](_0x5c64('0x8c'),_0x5d3eb8[_0x5c64('0x75')],util[_0x5c64('0x49')](_0x1cb3c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5c64('0x22')]=function(_0x35e4c3){try{if(this['isNotNull'](_0x35e4c3)){logger[_0x5c64('0x4f')](_0x5c64('0x8d'),_0x35e4c3[_0x5c64('0x75')],util['inspect'](_0x35e4c3,{'showHidden':![],'depth':null}));if(this[_0x5c64('0xc')][_0x35e4c3[_0x5c64('0x75')]]){var _0x8efcbd=_['last'](this[_0x5c64('0xc')][_0x35e4c3[_0x5c64('0x75')]]);_0x8efcbd[_0x5c64('0x1e')]=![];_0x8efcbd[_0x5c64('0x8e')]=null;_0x8efcbd[_0x5c64('0x8f')]=!![];_0x8efcbd['lastAssignedTo']=_0x35e4c3[_0x5c64('0x90')];_0x8efcbd['holdtime']=_0x35e4c3[_0x5c64('0x80')];_0x8efcbd['queuecallercomplete']=!![];_0x8efcbd[_0x5c64('0x3a')]=![];_0x8efcbd[_0x5c64('0x91')]=null;if(!_0x8efcbd[_0x5c64('0x92')]){if(_0x35e4c3[_0x5c64('0x93')]==_0x5c64('0x92')){_0x8efcbd[_0x5c64('0x56')]=_0x5c64('0x94');logger[_0x5c64('0x7a')](_0x5c64('0x95'),_0x8efcbd['queue'],_0x8efcbd[_0x5c64('0x5c')]);}else{if(_[_0x5c64('0x96')](_0x35e4c3[_0x5c64('0x42')][_0x5c64('0x97')](),_0x5c64('0x98'))){if(this[_0x5c64('0xc')][_0x35e4c3['linkedid']]){var _0x5b20a8=_[_0x5c64('0x7e')](this[_0x5c64('0xc')][_0x35e4c3['linkedid']]);_0x5b20a8[_0x5c64('0x3b')]=![];_0x5b20a8[_0x5c64('0x3a')]=!![];_0x5b20a8['queuecallerexitAt']=moment(_0x8efcbd['queuecallerjoinAt'])[_0x5c64('0x99')](_0x35e4c3[_0x5c64('0x80')],_0x5c64('0x9a'))[_0x5c64('0x52')](_0x5c64('0x88'));_0x5b20a8[_0x5c64('0x56')]='FORWARDTRANSFER';_0x5b20a8[_0x5c64('0x92')]=!![];_0x5b20a8[_0x5c64('0x9b')]=_0x5c64('0x9c');_0x5b20a8[_0x5c64('0x9d')]=_0x35e4c3[_0x5c64('0x9e')];_0x5b20a8[_0x5c64('0x9f')]=_0x35e4c3[_0x5c64('0x75')];logger[_0x5c64('0x7a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x5b20a8['queue'],_0x5b20a8[_0x5c64('0x5c')]);var _0x4a2112=this['queueReports'][_0x35e4c3[_0x5c64('0xa0')]];this['queueReports'][_0x35e4c3[_0x5c64('0xa0')]]=this['queueReports'][_0x35e4c3[_0x5c64('0x75')]];this[_0x5c64('0xc')][_0x35e4c3[_0x5c64('0x75')]]=_0x4a2112;}}else{_0x8efcbd[_0x5c64('0x56')]='COMPLETEDBY'+_0x35e4c3[_0x5c64('0x93')][_0x5c64('0xa1')]();logger[_0x5c64('0x7a')](_0x5c64('0xa2'),_0x8efcbd[_0x5c64('0x59')],_0x8efcbd[_0x5c64('0x5c')],_0x8efcbd[_0x5c64('0x56')]);}}}this['channels'][_0x35e4c3[_0x5c64('0x75')]]=_0x8efcbd;}}}catch(_0xdbc1a2){logger[_0x5c64('0x46')](_0x5c64('0x8d'),_0x35e4c3[_0x5c64('0x75')],util[_0x5c64('0x49')](_0xdbc1a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c64('0x8')]['syncVarSet']=function(_0x1ec8cf){try{if(this[_0x5c64('0x61')](_0x1ec8cf)){logger['debug'](_0x5c64('0xa3'),_0x1ec8cf['uniqueid'],util[_0x5c64('0x49')](_0x1ec8cf,{'showHidden':![],'depth':null}));this[_0x5c64('0xa4')](_0x1ec8cf[_0x5c64('0x75')],_[_0x5c64('0x7d')](_0x1ec8cf[_0x5c64('0xa5')])[0x0],_0x1ec8cf[_0x5c64('0xa6')]);if(this[_0x5c64('0xc')][_0x1ec8cf['uniqueid']]){var _0x6cbf88=_['last'](this['queueReports'][_0x1ec8cf[_0x5c64('0x75')]]);if(_0x6cbf88){if(this['isNotNull'](_0x1ec8cf[_0x5c64('0xa5')])&&this[_0x5c64('0x61')](_0x1ec8cf['variable']['queuestatus'])){switch(_0x1ec8cf['value']){case _0x5c64('0xa7'):_0x6cbf88['queuecallerexit']=![];_0x6cbf88[_0x5c64('0x91')]=null;break;case _0x5c64('0xa8'):_0x6cbf88[_0x5c64('0xa9')]=_0x5c64('0xaa');_0x6cbf88[_0x5c64('0x3a')]=!![];_0x6cbf88[_0x5c64('0x91')]=moment()['format'](_0x5c64('0x88'));_0x6cbf88['queuecallerleaveAt']=moment()[_0x5c64('0x52')](_0x5c64('0x88'));logger[_0x5c64('0x4f')](_0x5c64('0xab'),_0x1ec8cf['uniqueid'],util['inspect'](_0x6cbf88,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x6cbf88);break;default:_0x6cbf88[_0x5c64('0x3a')]=!![];_0x6cbf88[_0x5c64('0x91')]=moment()[_0x5c64('0x52')](_0x5c64('0x88'));_0x6cbf88[_0x5c64('0x87')]=moment()[_0x5c64('0x52')](_0x5c64('0x88'));}_0x6cbf88[_0x5c64('0x1e')]=![];_0x6cbf88[_0x5c64('0x8e')]=null;_0x6cbf88['queuecallerexitreason']=_0x1ec8cf[_0x5c64('0xa6')];this['channels'][_0x1ec8cf[_0x5c64('0x75')]]=_0x6cbf88;this[_0x5c64('0x4c')](_0x6cbf88,_0x5c64('0x25'));}else if(this[_0x5c64('0x61')](_0x1ec8cf[_0x5c64('0xa5')])&&this[_0x5c64('0x61')](_0x1ec8cf[_0x5c64('0xa5')][_0x5c64('0xac')])){if(!_0x6cbf88[_0x5c64('0x1e')]){_0x6cbf88[_0x5c64('0x3a')]=!![];_0x6cbf88[_0x5c64('0x91')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x6cbf88[_0x5c64('0x56')]='EXITWITHKEY';_0x6cbf88[_0x5c64('0x87')]=moment()['format'](_0x5c64('0x88'));this['channels'][_0x1ec8cf[_0x5c64('0x75')]]=_0x6cbf88;}}logger['info'](_0x5c64('0xad'),_0x1ec8cf['uniqueid'],_0x6cbf88['queue'],_0x6cbf88[_0x5c64('0x5c')],_['keys'](_0x1ec8cf['variable'])[0x0],_0x1ec8cf['value']);_0x6cbf88[_0x5c64('0x13')]=this['variables'][_0x1ec8cf[_0x5c64('0x75')]];}}}}catch(_0xb472d6){logger['error'](_0x5c64('0xa3'),_0x1ec8cf['uniqueid'],util[_0x5c64('0x49')](_0xb472d6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5c64('0x8')][_0x5c64('0xa4')]=function(_0x39fe25,_0x711169,_0x23befa){var _0x53f985=[_0x5c64('0xae'),_0x5c64('0xaf'),'rtpaudioqosjitter',_0x5c64('0xb0'),'rtpaudioqosloss',_0x5c64('0xb1'),_0x5c64('0xb2'),_0x5c64('0xb3'),_0x5c64('0xb4'),'sipuri',_0x5c64('0xb5'),_0x5c64('0xb6'),_0x5c64('0xb7'),_0x5c64('0xb8'),_0x5c64('0xb9'),'memberlastcall',_0x5c64('0x90'),_0x5c64('0xba'),_0x5c64('0xbb')];if(!_[_0x5c64('0x3f')](_0x711169)&&!_[_0x5c64('0xbc')](_0x53f985,_0x711169)){if(_['isUndefined'](this[_0x5c64('0x13')][_0x39fe25])){this[_0x5c64('0x13')][_0x39fe25]={};}this[_0x5c64('0x13')][_0x39fe25][_0x711169]=_0x23befa;}};VoiceQueueReport[_0x5c64('0x8')][_0x5c64('0xbd')]=function(_0xccb0ad,_0x2e132a,_0x48ba8f){try{var _0x17ed71={};if(this['queueReports'][_0xccb0ad]){for(var _0x464e09=0x0;_0x464e09=0x0?moment(_0x13ffed['endtime'])['diff'](_0x13ffed[_0x54d8('0x19')],_0x54d8('0xf')):null,'data1':_0x54d8('0x1a'),'data2':_0x13ffed['accountcode'],'data3':_0x13ffed[_0x54d8('0x1b')],'data4':_0x13ffed[_0x54d8('0x1c')]||null,'role':_0x54d8('0x13'),'internal':_0x13ffed[_0x54d8('0x14')]?_[_0x54d8('0x15')](_0x13ffed[_0x54d8('0x14')]):undefined,'uniqueid':_0x13ffed['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xe74c=['interface','queuecallerleaveAt','calleridnum','queue','agent','toNumber','accountcode','membername','starttime','endtime','seconds','diff','outbound','exten','dialstring','uniqueid','moment','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','format','SIP/%s'];(function(_0x521fcc,_0x5f469d){var _0x33f3e2=function(_0x316609){while(--_0x316609){_0x521fcc['push'](_0x521fcc['shift']());}};_0x33f3e2(++_0x5f469d);}(_0xe74c,0x115));var _0xce74=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe74c[_0x3ff085];return _0x2b68c3;};'use strict';var moment=require(_0xce74('0x0'));var _=require(_0xce74('0x1'));var util=require(_0xce74('0x2'));var client=require(_0xce74('0x3'));exports['voiceQueueReport']=function(_0x357339){var _0xaaa027=_0x357339[_0xce74('0x4')]||_0x357339[_0xce74('0x5')];return client[_0xce74('0x6')](_0xce74('0x7'),{'body':{'channel':_0xce74('0x8'),'membername':_0x357339[_0xce74('0x9')],'interface':_[_0xce74('0xa')](_0x357339['interface'])?util[_0xce74('0xb')](_0xce74('0xc'),_0x357339[_0xce74('0x9')]):_0x357339[_0xce74('0xd')],'type':'TALKING','enterAt':_0x357339[_0xce74('0xe')],'exitAt':_0xaaa027,'duration':moment(_0xaaa027)['diff'](_0x357339[_0xce74('0xe')],'seconds'),'data1':'inbound','data2':_0x357339[_0xce74('0xf')],'data3':_0x357339['exten'],'data4':null,'data5':_0x357339[_0xce74('0x10')],'role':_0xce74('0x11'),'internal':_0x357339['accountcode']?_[_0xce74('0x12')](_0x357339[_0xce74('0x13')]):undefined,'uniqueid':_0x357339['uniqueid']},'log':_0xce74('0x7')});};exports['voiceDialReport']=function(_0x10c963){return client[_0xce74('0x6')](_0xce74('0x7'),{'body':{'channel':_0xce74('0x8'),'membername':_0x10c963[_0xce74('0x14')],'interface':_0x10c963[_0xce74('0xd')],'type':'TALKING','enterAt':_0x10c963[_0xce74('0x15')],'exitAt':_0x10c963[_0xce74('0x16')],'duration':moment(_0x10c963[_0xce74('0x16')])['diff'](_0x10c963['starttime'],_0xce74('0x17'))>=0x0?moment(_0x10c963[_0xce74('0x16')])[_0xce74('0x18')](_0x10c963[_0xce74('0x15')],_0xce74('0x17')):null,'data1':_0xce74('0x19'),'data2':_0x10c963[_0xce74('0x13')],'data3':_0x10c963[_0xce74('0x1a')],'data4':_0x10c963[_0xce74('0x1b')]||null,'role':_0xce74('0x11'),'internal':_0x10c963[_0xce74('0x13')]?_[_0xce74('0x12')](_0x10c963[_0xce74('0x13')]):undefined,'uniqueid':_0x10c963[_0xce74('0x1c')]},'log':_0xce74('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 559d2a1..9496631 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 _0x9972=['../client','getSettings','Request','ShowSetting','previewRecallmeReminderInterval'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9972,0xaa));var _0x2997=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9972[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0x2997('0x0'));exports[_0x2997('0x1')]=function(){return client[_0x2997('0x2')](_0x2997('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x2997('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xaecf=['getSettings','Request','stopRecordingOnTransfer','GetSettings','../client'];(function(_0x598b6d,_0x24b0e5){var _0x132bbf=function(_0x299844){while(--_0x299844){_0x598b6d['push'](_0x598b6d['shift']());}};_0x132bbf(++_0x24b0e5);}(_0xaecf,0x149));var _0xfaec=function(_0x2a6bf2,_0x2fde81){_0x2a6bf2=_0x2a6bf2-0x0;var _0x5c5be2=_0xaecf[_0x2a6bf2];return _0x5c5be2;};'use strict';var client=require(_0xfaec('0x0'));exports[_0xfaec('0x1')]=function(){return client[_0xfaec('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xfaec('0x3'),'previewRecallmeReminderInterval']},'log':_0xfaec('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 74602c5..9b28cad 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 _0x700c=['getTemplates','Request','GetTemplate','html','../client'];(function(_0x4cb4e8,_0x289826){var _0x28fc20=function(_0x4d638e){while(--_0x4d638e){_0x4cb4e8['push'](_0x4cb4e8['shift']());}};_0x28fc20(++_0x289826);}(_0x700c,0x1b2));var _0xc700=function(_0x11a3e6,_0x530ca4){_0x11a3e6=_0x11a3e6-0x0;var _0x21302d=_0x700c[_0x11a3e6];return _0x21302d;};'use strict';var client=require(_0xc700('0x0'));exports[_0xc700('0x1')]=function(_0x48f5ba){return function(_0x29da4b){return client[_0xc700('0x2')](_0xc700('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xc700('0x4')]},'log':_0xc700('0x3')});};}; \ No newline at end of file +var _0x1395=['getTemplates','GetTemplate','name','html','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1395,0xc2));var _0x5139=function(_0x2fa389,_0x103bb5){_0x2fa389=_0x2fa389-0x0;var _0x54ee4d=_0x1395[_0x2fa389];return _0x54ee4d;};'use strict';var client=require(_0x5139('0x0'));exports[_0x5139('0x1')]=function(_0x75a30){return function(_0x756e7){return client['Request'](_0x5139('0x2'),{'options':{'raw':!![],'attributes':['id',_0x5139('0x3'),_0x5139('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index efb8d16..e68d5a0 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 _0x500c=['data1','data2','data4','data6','data7','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','value','AnyConditions','operator','Action','Actions','action'];(function(_0x4bdb53,_0x29d2d3){var _0x2c2195=function(_0x24e490){while(--_0x24e490){_0x4bdb53['push'](_0x4bdb53['shift']());}};_0x2c2195(++_0x29d2d3);}(_0x500c,0xd6));var _0xc500=function(_0x394930,_0x50bc44){_0x394930=_0x394930-0x0;var _0x297393=_0x500c[_0x394930];return _0x297393;};'use strict';var client=require('../client');exports[_0xc500('0x0')]=function(_0x56e509){return function(_0x3113db){return client[_0xc500('0x1')](_0xc500('0x2'),{'options':{'raw':![],'attributes':['id',_0xc500('0x3'),_0xc500('0x4'),'status'],'include':[{'model':_0xc500('0x5'),'as':_0xc500('0x6'),'attributes':['id',_0xc500('0x7'),'operator',_0xc500('0x8')]},{'model':_0xc500('0x5'),'as':_0xc500('0x9'),'attributes':['id','field',_0xc500('0xa'),'value']},{'model':_0xc500('0xb'),'as':_0xc500('0xc'),'attributes':['id',_0xc500('0xd'),_0xc500('0xe'),_0xc500('0xf'),'data3',_0xc500('0x10'),'data5',_0xc500('0x11'),_0xc500('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xdea8=['GetTrigger','channel','status','field','operator','AnyConditions','value','Actions','action','data1','data3','data4','data5','data6','data7','../client','Request'];(function(_0x2cdf5a,_0x4c6217){var _0x4ae504=function(_0x3b1c8b){while(--_0x3b1c8b){_0x2cdf5a['push'](_0x2cdf5a['shift']());}};_0x4ae504(++_0x4c6217);}(_0xdea8,0x152));var _0x8dea=function(_0x3869f0,_0x429794){_0x3869f0=_0x3869f0-0x0;var _0x66b2b=_0xdea8[_0x3869f0];return _0x66b2b;};'use strict';var client=require(_0x8dea('0x0'));exports['getTriggers']=function(_0x27e445){return function(_0x31b3da){return client[_0x8dea('0x1')](_0x8dea('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x8dea('0x3'),_0x8dea('0x4')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x8dea('0x5'),_0x8dea('0x6'),'value']},{'model':'Condition','as':_0x8dea('0x7'),'attributes':['id',_0x8dea('0x5'),_0x8dea('0x6'),_0x8dea('0x8')]},{'model':'Action','as':_0x8dea('0x9'),'attributes':['id',_0x8dea('0xa'),_0x8dea('0xb'),'data2',_0x8dea('0xc'),_0x8dea('0xd'),_0x8dea('0xe'),_0x8dea('0xf'),_0x8dea('0x10')]}]},'log':_0x8dea('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 1228873..c1e381f 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 _0xb71d=['../client','getTrunks','Request','GetTrunk','registry','defaultuser'];(function(_0x5a7cbc,_0x573d85){var _0x44d2cc=function(_0x154862){while(--_0x154862){_0x5a7cbc['push'](_0x5a7cbc['shift']());}};_0x44d2cc(++_0x573d85);}(_0xb71d,0xc0));var _0xdb71=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb71d[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0xdb71('0x0'));exports[_0xdb71('0x1')]=function(_0x34b09a){return function(_0xa51c1f){return client[_0xdb71('0x2')](_0xdb71('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xdb71('0x4'),_0xdb71('0x5')]},'log':_0xdb71('0x3')});};}; \ No newline at end of file +var _0x4134=['GetTrunk','name','registry','../client','getTrunks'];(function(_0x20f96a,_0x19e99b){var _0x185622=function(_0x369438){while(--_0x369438){_0x20f96a['push'](_0x20f96a['shift']());}};_0x185622(++_0x19e99b);}(_0x4134,0x1ac));var _0x4413=function(_0x2dea94,_0x1cec63){_0x2dea94=_0x2dea94-0x0;var _0x5795e5=_0x4134[_0x2dea94];return _0x5795e5;};'use strict';var client=require(_0x4413('0x0'));exports[_0x4413('0x1')]=function(_0x282e5a){return function(_0x2c977d){return client['Request'](_0x4413('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x4413('0x3'),_0x4413('0x4'),'defaultuser']},'log':_0x4413('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 8378fe2..67afd19 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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x4991dd,_0x5ce5f6){var _0xf86545=function(_0xe9373f){while(--_0xe9373f){_0x4991dd['push'](_0x4991dd['shift']());}};_0xf86545(++_0x5ce5f6);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 243950a..ca2294c 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 _0x6331=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x229b22,_0x2b84a8){var _0x3e7104=function(_0x537269){while(--_0x537269){_0x229b22['push'](_0x229b22['shift']());}};_0x3e7104(++_0x2b84a8);}(_0x6331,0x17e));var _0x1633=function(_0x464999,_0x3c826a){_0x464999=_0x464999-0x0;var _0x764e1c=_0x6331[_0x464999];return _0x764e1c;};'use strict';var client=require(_0x1633('0x0'));exports[_0x1633('0x1')]=function(_0x416881){return client[_0x1633('0x2')](_0x1633('0x3'),{'body':_0x416881,'log':_0x1633('0x3')});};exports[_0x1633('0x4')]=function(_0x31fdf1,_0x38dfef,_0x12bafe){return client[_0x1633('0x2')]('UpdateVoiceAgentReport',{'body':_0x31fdf1,'options':{'where':{'uniqueid':_0x38dfef,'interface':_0x12bafe,'agentcomplete':!![]}},'log':_0x1633('0x5')});}; \ No newline at end of file +var _0xedc2=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x3d0a99,_0x27346f){var _0x11f77f=function(_0x4f93c4){while(--_0x4f93c4){_0x3d0a99['push'](_0x3d0a99['shift']());}};_0x11f77f(++_0x27346f);}(_0xedc2,0x1cf));var _0x2edc=function(_0x5bc567,_0x3dcbfe){_0x5bc567=_0x5bc567-0x0;var _0x25f179=_0xedc2[_0x5bc567];return _0x25f179;};'use strict';var client=require(_0x2edc('0x0'));exports[_0x2edc('0x1')]=function(_0x1efb8a){return client[_0x2edc('0x2')](_0x2edc('0x3'),{'body':_0x1efb8a,'log':'CreateVoiceAgentReport'});};exports[_0x2edc('0x4')]=function(_0x51dd76,_0x51f28b,_0x4b87b5){return client[_0x2edc('0x2')](_0x2edc('0x5'),{'body':_0x51dd76,'options':{'where':{'uniqueid':_0x51f28b,'interface':_0x4b87b5,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 5d76498..f4e36e9 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 _0x60b9=['duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','Request','CreateVoiceCallReport','merge','context','callerid','getVoiceCallReports','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition'];(function(_0x27cb15,_0x10fc19){var _0x2b7eec=function(_0x1164e8){while(--_0x1164e8){_0x27cb15['push'](_0x27cb15['shift']());}};_0x2b7eec(++_0x10fc19);}(_0x60b9,0x192));var _0x960b=function(_0x3b1f91,_0x882609){_0x3b1f91=_0x3b1f91-0x0;var _0x1c0b56=_0x60b9[_0x3b1f91];return _0x1c0b56;};'use strict';var moment=require(_0x960b('0x0'));var util=require(_0x960b('0x1'));var _=require(_0x960b('0x2'));var client=require(_0x960b('0x3'));exports['create']=function(_0x12aa7a){return client[_0x960b('0x4')](_0x960b('0x5'),{'body':_[_0x960b('0x6')](_0x12aa7a,{'source':_0x12aa7a['calleridnum'],'destinationcontext':_0x12aa7a[_0x960b('0x7')],'callerid':_0x12aa7a[_0x960b('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x960b('0x5')});};exports[_0x960b('0x9')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x960b('0xa')],'createdAt':{'$between':[moment()[_0x960b('0xb')](_0x960b('0xc'))['format'](_0x960b('0xd')),moment()[_0x960b('0xe')](_0x960b('0xc'))[_0x960b('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x960b('0x10'),_0x960b('0x11'),_0x960b('0x12'),_0x960b('0x13')]},'log':_0x960b('0x14')});};}; \ No newline at end of file +var _0x2f77=['CreateVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','merge','calleridnum','callerid','DOCUMENTATION'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0x2f77,0x19a));var _0x72f7=function(_0x50a6d4,_0x7a7ac5){_0x50a6d4=_0x50a6d4-0x0;var _0x166fdf=_0x2f77[_0x50a6d4];return _0x166fdf;};'use strict';var moment=require(_0x72f7('0x0'));var util=require(_0x72f7('0x1'));var _=require(_0x72f7('0x2'));var client=require(_0x72f7('0x3'));exports[_0x72f7('0x4')]=function(_0x5652e0){return client[_0x72f7('0x5')]('CreateVoiceCallReport',{'body':_[_0x72f7('0x6')](_0x5652e0,{'source':_0x5652e0[_0x72f7('0x7')],'destinationcontext':_0x5652e0['context'],'callerid':_0x5652e0[_0x72f7('0x8')],'amaflags':_0x72f7('0x9')}),'log':_0x72f7('0xa')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x72f7('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x72f7('0xb')](_0x72f7('0xc'))[_0x72f7('0xd')](_0x72f7('0xe')),moment()[_0x72f7('0xf')](_0x72f7('0xc'))[_0x72f7('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x72f7('0x10'),_0x72f7('0x11'),_0x72f7('0x12'),_0x72f7('0x13')]},'log':_0x72f7('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index edd0cef..ca58791 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 _0x5f7a=['Request','CreateVoiceDialReport','../client'];(function(_0x3a24a4,_0x4b7ccc){var _0x326941=function(_0x4b7b3c){while(--_0x4b7b3c){_0x3a24a4['push'](_0x3a24a4['shift']());}};_0x326941(++_0x4b7ccc);}(_0x5f7a,0xad));var _0xa5f7=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5f7a[_0x160c73];return _0xd9302;};'use strict';var client=require(_0xa5f7('0x0'));exports['create']=function(_0x420e86){return client[_0xa5f7('0x1')](_0xa5f7('0x2'),{'body':_0x420e86,'log':_0xa5f7('0x2')});}; \ No newline at end of file +var _0xc684=['../client','create','Request','CreateVoiceDialReport'];(function(_0x41961e,_0xa9694f){var _0x1e7e1e=function(_0x3b522b){while(--_0x3b522b){_0x41961e['push'](_0x41961e['shift']());}};_0x1e7e1e(++_0xa9694f);}(_0xc684,0x118));var _0x4c68=function(_0x435a71,_0x34d273){_0x435a71=_0x435a71-0x0;var _0x54dce8=_0xc684[_0x435a71];return _0x54dce8;};'use strict';var client=require(_0x4c68('0x0'));exports[_0x4c68('0x1')]=function(_0x7f14b3){return client[_0x4c68('0x2')]('CreateVoiceDialReport',{'body':_0x7f14b3,'log':_0x4c68('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 2e545d0..33967af 100644 --- a/server/services/ami/rpc/voiceExtension.js +++ b/server/services/ami/rpc/voiceExtension.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa45c=['exten','../client','getVoiceExtensions'];(function(_0x319342,_0x224a84){var _0x3957d6=function(_0x32d128){while(--_0x32d128){_0x319342['push'](_0x319342['shift']());}};_0x3957d6(++_0x224a84);}(_0xa45c,0x6d));var _0xca45=function(_0x54daec,_0x567428){_0x54daec=_0x54daec-0x0;var _0x59392c=_0xa45c[_0x54daec];return _0x59392c;};'use strict';var client=require(_0xca45('0x0'));exports[_0xca45('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xca45('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xca45('0x1')});};}; \ No newline at end of file +var _0xee11=['getVoiceExtensions','../client','GetVoiceExtension','exten','recordingFormat'];(function(_0x1909f4,_0x395371){var _0x82ddf8=function(_0x87049c){while(--_0x87049c){_0x1909f4['push'](_0x1909f4['shift']());}};_0x82ddf8(++_0x395371);}(_0xee11,0x146));var _0x1ee1=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0xee11[_0x5a2d3f];return _0x5c65d8;};'use strict';var client=require(_0x1ee1('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x1ee1('0x1'),{'options':{'raw':!![],'attributes':['id',_0x1ee1('0x2'),_0x1ee1('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x1ee1('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 03783b7..eb59907 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 _0x475f=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','getVoiceQueues','Request','name','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropRetryFrequency'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x475f,0x113));var _0xf475=function(_0x3f44d9,_0x350353){_0x3f44d9=_0x3f44d9-0x0;var _0x328df7=_0x475f[_0x3f44d9];return _0x328df7;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0xf475('0x0')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xf475('0x1'),'acw','acwTimeout',_0xf475('0x2'),_0xf475('0x3'),_0xf475('0x4'),_0xf475('0x5'),_0xf475('0x6'),_0xf475('0x7'),_0xf475('0x8'),_0xf475('0x9'),_0xf475('0xa'),_0xf475('0xb'),_0xf475('0xc'),'dialOriginateCallerIdName',_0xf475('0xd'),_0xf475('0xe'),_0xf475('0xf'),_0xf475('0x10'),'dialQueueProject',_0xf475('0x11'),_0xf475('0x12'),'dialBusyMaxRetry',_0xf475('0x13'),_0xf475('0x14'),_0xf475('0x15'),'dialGlobalMaxRetry',_0xf475('0x16'),_0xf475('0x17'),_0xf475('0x18'),_0xf475('0x19'),_0xf475('0x1a'),_0xf475('0x1b'),_0xf475('0x1c'),_0xf475('0x1d'),_0xf475('0x1e'),_0xf475('0x1f'),_0xf475('0x20'),_0xf475('0x21'),_0xf475('0x22'),_0xf475('0x23'),_0xf475('0x24'),_0xf475('0x25'),'dialRecallInQueue',_0xf475('0x26'),'dialAgiAfterHangupAgent',_0xf475('0x27'),_0xf475('0x28'),_0xf475('0x3'),_0xf475('0x29'),_0xf475('0x2a'),'dialCutDigit',_0xf475('0x2b'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xf475('0x2c'),_0xf475('0x2d'),_0xf475('0x2e'),_0xf475('0x2f'),_0xf475('0x30'),_0xf475('0x31'),_0xf475('0x32'),_0xf475('0x33'),_0xf475('0x34'),_0xf475('0x35'),'dialPreviewAutoRecallMe',_0xf475('0x36')],'include':[{'model':'Trunk','as':_0xf475('0x37'),'attributes':['id',_0xf475('0x1'),_0xf475('0x38'),_0xf475('0x39')]},{'model':_0xf475('0x3a'),'as':_0xf475('0x3b'),'attributes':['id',_0xf475('0x1')]},{'model':_0xf475('0x37'),'as':'TrunkBackup','attributes':['id',_0xf475('0x1'),_0xf475('0x38'),_0xf475('0x39')]},{'model':'Interval','as':_0xf475('0x3c'),'attributes':['id',_0xf475('0x1')],'include':[{'model':'Interval','as':_0xf475('0x3d'),'attributes':['id',_0xf475('0x1'),_0xf475('0x3e')]}]}]},'log':_0xf475('0x3f')});};}; \ No newline at end of file +var _0xf7eb=['autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','name','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout'];(function(_0x5a7345,_0x52bd66){var _0x5337bb=function(_0x1cef2b){while(--_0x1cef2b){_0x5a7345['push'](_0x5a7345['shift']());}};_0x5337bb(++_0x52bd66);}(_0xf7eb,0x106));var _0xbf7e=function(_0x3293a1,_0x27d6da){_0x3293a1=_0x3293a1-0x0;var _0x1be8a5=_0xf7eb[_0x3293a1];return _0x1be8a5;};'use strict';var client=require(_0xbf7e('0x0'));exports[_0xbf7e('0x1')]=function(){return function(){return client[_0xbf7e('0x2')](_0xbf7e('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xbf7e('0x4'),_0xbf7e('0x5'),_0xbf7e('0x6'),_0xbf7e('0x7'),_0xbf7e('0x8'),_0xbf7e('0x9'),_0xbf7e('0xa'),_0xbf7e('0xb'),_0xbf7e('0xc'),_0xbf7e('0xd'),'dialPredictiveOptimization',_0xbf7e('0xe'),_0xbf7e('0xf'),_0xbf7e('0x10'),_0xbf7e('0x11'),_0xbf7e('0x12'),_0xbf7e('0x13'),_0xbf7e('0x14'),'dialQueueProject','dialCongestionMaxRetry',_0xbf7e('0x15'),_0xbf7e('0x16'),_0xbf7e('0x17'),_0xbf7e('0x18'),_0xbf7e('0x19'),_0xbf7e('0x1a'),'dialTimezone',_0xbf7e('0x1b'),_0xbf7e('0x1c'),_0xbf7e('0x1d'),_0xbf7e('0x1e'),_0xbf7e('0x1f'),_0xbf7e('0x20'),_0xbf7e('0x21'),_0xbf7e('0x22'),_0xbf7e('0x23'),_0xbf7e('0x24'),_0xbf7e('0x25'),_0xbf7e('0x26'),_0xbf7e('0x27'),_0xbf7e('0x28'),_0xbf7e('0x29'),_0xbf7e('0x2a'),_0xbf7e('0x2b'),_0xbf7e('0x2c'),_0xbf7e('0x2d'),_0xbf7e('0x2e'),_0xbf7e('0x7'),'strategy',_0xbf7e('0x2f'),_0xbf7e('0x30'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xbf7e('0x31'),_0xbf7e('0x32'),_0xbf7e('0x33'),_0xbf7e('0x34'),_0xbf7e('0x35'),'dialAgentRejectMaxRetry',_0xbf7e('0x36'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0xbf7e('0x37'),_0xbf7e('0x38'),_0xbf7e('0x39')],'include':[{'model':_0xbf7e('0x3a'),'as':_0xbf7e('0x3a'),'attributes':['id','name',_0xbf7e('0x3b'),_0xbf7e('0x3c')]},{'model':_0xbf7e('0x3d'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0xbf7e('0x3a'),'as':_0xbf7e('0x3e'),'attributes':['id',_0xbf7e('0x3f'),_0xbf7e('0x3b'),_0xbf7e('0x3c')]},{'model':_0xbf7e('0x40'),'as':_0xbf7e('0x40'),'attributes':['id',_0xbf7e('0x3f')],'include':[{'model':'Interval','as':_0xbf7e('0x41'),'attributes':['id',_0xbf7e('0x3f'),_0xbf7e('0x42')]}]}]},'log':_0xbf7e('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 97b69a6..7b60a7f 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(_0xbbfb2d,_0x1535ac){var _0x4335dc=function(_0xbe4d19){while(--_0xbe4d19){_0xbbfb2d['push'](_0xbbfb2d['shift']());}};_0x4335dc(++_0x1535ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +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(_0x2109f3,_0x45d757){var _0x1f700a=function(_0x1cb798){while(--_0x1cb798){_0x2109f3['push'](_0x2109f3['shift']());}};_0x1f700a(++_0x45d757);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 a5c9b7c..c8f84aa 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 _0x16d1=['../client','getVoiceQueueRtPauses','Request'];(function(_0x1c9aa3,_0x1c10b9){var _0xf80e75=function(_0x5909d3){while(--_0x5909d3){_0x1c9aa3['push'](_0x1c9aa3['shift']());}};_0xf80e75(++_0x1c10b9);}(_0x16d1,0xab));var _0x116d=function(_0x3c83c5,_0x2440f0){_0x3c83c5=_0x3c83c5-0x0;var _0x1f52b9=_0x16d1[_0x3c83c5];return _0x1f52b9;};'use strict';var client=require(_0x116d('0x0'));exports[_0x116d('0x1')]=function(_0x5e0f54){return function(){return client[_0x116d('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x5e0f54,'paused':!![]},'raw':!![]},'log':_0x116d('0x1')});};}; \ No newline at end of file +var _0x4f01=['Request','../client','getVoiceQueueRtPauses'];(function(_0x58f245,_0x3e4f31){var _0x1f0cfb=function(_0x515942){while(--_0x515942){_0x58f245['push'](_0x58f245['shift']());}};_0x1f0cfb(++_0x3e4f31);}(_0x4f01,0x190));var _0x14f0=function(_0x3a51f0,_0x84e1c7){_0x3a51f0=_0x3a51f0-0x0;var _0x11c7c8=_0x4f01[_0x3a51f0];return _0x11c7c8;};'use strict';var client=require(_0x14f0('0x0'));exports[_0x14f0('0x1')]=function(_0x48c9e5){return function(){return client[_0x14f0('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x48c9e5,'paused':!![]},'raw':!![]},'log':_0x14f0('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 3331424..8d2c445 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(_0x55892e,_0x49d888){var _0x49a4c1=function(_0x24d51a){while(--_0x24d51a){_0x55892e['push'](_0x55892e['shift']());}};_0x49a4c1(++_0x49d888);}(_0x7a54,0x106));var _0x47a5=function(_0xad3e7d,_0x1955c4){_0xad3e7d=_0xad3e7d-0x0;var _0x214f7e=_0x7a54[_0xad3e7d];return _0x214f7e;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x35dc2a,_0x4d12ae){var _0x48ae23=function(_0x42def0){while(--_0x42def0){_0x35dc2a['push'](_0x35dc2a['shift']());}};_0x48ae23(++_0x4d12ae);}(_0x7a54,0x106));var _0x47a5=function(_0x585762,_0x5215db){_0x585762=_0x585762-0x0;var _0x4102e0=_0x7a54[_0x585762];return _0x4102e0;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 873748e..88a4367 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 _0x6cff=['secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','Request','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x48cf09,_0x46d381){var _0x3cc617=function(_0x50feed){while(--_0x50feed){_0x48cf09['push'](_0x48cf09['shift']());}};_0x3cc617(++_0x46d381);}(_0x6cff,0x167));var _0xf6cf=function(_0x171520,_0x1cee8c){_0x171520=_0x171520-0x0;var _0x3cc729=_0x6cff[_0x171520];return _0x3cc729;};'use strict';var client=require('../client');exports[_0xf6cf('0x0')]={};exports[_0xf6cf('0x1')]=function(_0xc38c58){return client['Request'](_0xf6cf('0x2'),{'body':{'result':_0xc38c58[_0xf6cf('0x3')],'transfererchannel':_0xc38c58['transfererchannel'],'transferercalleridnum':_0xc38c58[_0xf6cf('0x4')],'transferercalleridname':_0xc38c58[_0xf6cf('0x5')],'transfererconnectedlinenum':_0xc38c58[_0xf6cf('0x6')],'transfererconnectedlinename':_0xc38c58[_0xf6cf('0x7')],'transfereraccountcode':_0xc38c58[_0xf6cf('0x8')],'transferercontext':_0xc38c58['transferercontext'],'transfererexten':_0xc38c58[_0xf6cf('0x9')],'transfererlinkedid':_0xc38c58['transfererlinkedid'],'transfereechannel':_0xc38c58[_0xf6cf('0xa')],'transfereecalleridnum':_0xc38c58[_0xf6cf('0xb')],'transfereecalleridname':_0xc38c58[_0xf6cf('0xc')],'transfereeconnectedlinenum':_0xc38c58[_0xf6cf('0xd')],'transfereeconnectedlinename':_0xc38c58['transfereeconnectedlinename'],'transfereeaccountcode':_0xc38c58[_0xf6cf('0xe')],'transfereecontext':_0xc38c58[_0xf6cf('0xf')],'transfereeexten':_0xc38c58[_0xf6cf('0x10')],'transfereelinkedid':_0xc38c58['transfereelinkedid'],'isexternal':_0xc38c58[_0xf6cf('0x11')],'context':_0xc38c58[_0xf6cf('0x12')],'extension':_0xc38c58[_0xf6cf('0x13')],'type':_0xf6cf('0x14')},'log':_0xf6cf('0x2')});};exports[_0xf6cf('0x15')]=function(_0x57128d){return client[_0xf6cf('0x16')]('CreateVoiceTransferReport',{'body':{'result':_0x57128d[_0xf6cf('0x3')],'transfererchannel':_0x57128d['origtransfererchannel'],'transferercalleridnum':_0x57128d[_0xf6cf('0x17')],'transferercalleridname':_0x57128d[_0xf6cf('0x18')],'transfererconnectedlinenum':_0x57128d[_0xf6cf('0x19')],'transfererconnectedlinename':_0x57128d[_0xf6cf('0x1a')],'transfereraccountcode':_0x57128d[_0xf6cf('0x1b')],'transferercontext':_0x57128d[_0xf6cf('0x1c')],'transfererexten':_0x57128d[_0xf6cf('0x1d')],'transfererlinkedid':_0x57128d[_0xf6cf('0x1e')],'transfereechannel':_0x57128d[_0xf6cf('0x1f')],'transfereecalleridnum':_0x57128d[_0xf6cf('0x20')],'transfereecalleridname':_0x57128d[_0xf6cf('0x21')],'transfereeconnectedlinenum':_0x57128d[_0xf6cf('0x22')],'transfereeconnectedlinename':_0x57128d[_0xf6cf('0x23')],'transfereeaccountcode':_0x57128d[_0xf6cf('0x24')],'transfereecontext':_0x57128d[_0xf6cf('0x25')],'transfereeexten':_0x57128d[_0xf6cf('0x26')],'transfereelinkedid':_0x57128d[_0xf6cf('0x27')],'isexternal':_0x57128d[_0xf6cf('0x11')],'context':_0x57128d[_0xf6cf('0x28')],'extension':_0x57128d[_0xf6cf('0x29')],'type':_0xf6cf('0x2a')},'log':_0xf6cf('0x2')});}; \ No newline at end of file +var _0x9258=['transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x9258,0x18e));var _0x8925=function(_0x343177,_0x3b37d5){_0x343177=_0x343177-0x0;var _0x1849e7=_0x9258[_0x343177];return _0x1849e7;};'use strict';var client=require(_0x8925('0x0'));exports[_0x8925('0x1')]={};exports['blindTransfer']=function(_0x4154ed){return client[_0x8925('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x4154ed[_0x8925('0x3')],'transfererchannel':_0x4154ed[_0x8925('0x4')],'transferercalleridnum':_0x4154ed[_0x8925('0x5')],'transferercalleridname':_0x4154ed[_0x8925('0x6')],'transfererconnectedlinenum':_0x4154ed[_0x8925('0x7')],'transfererconnectedlinename':_0x4154ed[_0x8925('0x8')],'transfereraccountcode':_0x4154ed[_0x8925('0x9')],'transferercontext':_0x4154ed['transferercontext'],'transfererexten':_0x4154ed[_0x8925('0xa')],'transfererlinkedid':_0x4154ed[_0x8925('0xb')],'transfereechannel':_0x4154ed[_0x8925('0xc')],'transfereecalleridnum':_0x4154ed[_0x8925('0xd')],'transfereecalleridname':_0x4154ed[_0x8925('0xe')],'transfereeconnectedlinenum':_0x4154ed[_0x8925('0xf')],'transfereeconnectedlinename':_0x4154ed['transfereeconnectedlinename'],'transfereeaccountcode':_0x4154ed[_0x8925('0x10')],'transfereecontext':_0x4154ed['transfereecontext'],'transfereeexten':_0x4154ed[_0x8925('0x11')],'transfereelinkedid':_0x4154ed[_0x8925('0x12')],'isexternal':_0x4154ed[_0x8925('0x13')],'context':_0x4154ed[_0x8925('0x14')],'extension':_0x4154ed[_0x8925('0x15')],'type':_0x8925('0x16')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x198923){return client[_0x8925('0x2')](_0x8925('0x17'),{'body':{'result':_0x198923['result'],'transfererchannel':_0x198923[_0x8925('0x18')],'transferercalleridnum':_0x198923[_0x8925('0x19')],'transferercalleridname':_0x198923[_0x8925('0x1a')],'transfererconnectedlinenum':_0x198923[_0x8925('0x1b')],'transfererconnectedlinename':_0x198923[_0x8925('0x1c')],'transfereraccountcode':_0x198923['origtransfereraccountcode'],'transferercontext':_0x198923[_0x8925('0x1d')],'transfererexten':_0x198923[_0x8925('0x1e')],'transfererlinkedid':_0x198923[_0x8925('0x1f')],'transfereechannel':_0x198923[_0x8925('0x20')],'transfereecalleridnum':_0x198923[_0x8925('0x21')],'transfereecalleridname':_0x198923[_0x8925('0x22')],'transfereeconnectedlinenum':_0x198923['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x198923[_0x8925('0x23')],'transfereeaccountcode':_0x198923[_0x8925('0x24')],'transfereecontext':_0x198923['transfertargetcontext'],'transfereeexten':_0x198923[_0x8925('0x25')],'transfereelinkedid':_0x198923[_0x8925('0x26')],'isexternal':_0x198923[_0x8925('0x13')],'context':_0x198923[_0x8925('0x27')],'extension':_0x198923['origtransfererexten'],'type':_0x8925('0x28')},'log':_0x8925('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index cf92a78..45a6e41 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x25135a,_0x3d3df9){var _0x4eb042=function(_0x2de77c){while(--_0x2de77c){_0x25135a['push'](_0x25135a['shift']());}};_0x4eb042(++_0x3d3df9);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ad00b,_0x22c334){_0x5ad00b=_0x5ad00b-0x0;var _0x2aab79=_0xb10b[_0x5ad00b];return _0x2aab79;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x4c4679,_0x332d90){var _0xffa460=function(_0x908278){while(--_0x908278){_0x4c4679['push'](_0x4c4679['shift']());}};_0xffa460(++_0x332d90);}(_0x7a54,0x106));var _0x47a5=function(_0x5a43fe,_0x1fd4fe){_0x5a43fe=_0x5a43fe-0x0;var _0x384973=_0x7a54[_0x5a43fe];return _0x384973;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 63d4f75..a7b19ac 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 _0x6ec8=['data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','action','toLowerCase','merge','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','union','resolve','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join'];(function(_0x576f50,_0x17c60f){var _0x260943=function(_0x583c93){while(--_0x583c93){_0x576f50['push'](_0x576f50['shift']());}};_0x260943(++_0x17c60f);}(_0x6ec8,0x18a));var _0x86ec=function(_0x1c97c8,_0x28d564){_0x1c97c8=_0x1c97c8-0x0;var _0x2c096d=_0x6ec8[_0x1c97c8];return _0x2c096d;};'use strict';var _=require('lodash');var BPromise=require(_0x86ec('0x0'));var Redis=require('ioredis');var util=require(_0x86ec('0x1'));var config=require(_0x86ec('0x2'));var logger=require(_0x86ec('0x3'))(_0x86ec('0x4'));var cmContactRpc=require(_0x86ec('0x5'));config[_0x86ec('0x6')]=_['defaults'](config[_0x86ec('0x6')],{'host':_0x86ec('0x7'),'port':0x18eb});var io=require(_0x86ec('0x8'))(new Redis(config[_0x86ec('0x6')]));function emit(_0x4ad761,_0x5ee31f,_0x5adef5,_0x447f94,_0x48c542){logger['info'](_0x86ec('0x9'),_0x4ad761,_0x5ee31f['id'],_0x5adef5,_0x447f94,JSON[_0x86ec('0xa')](_0x48c542));io['to'](_0x5adef5)[_0x86ec('0xb')](_0x447f94,_0x48c542);}exports['exec']=function(_0x2ac552,_0x1db05c,_0x4e8353,_0x3cb4a7){var _0x13b51e,_0x3d7325;var _0x3e8218={};var _0x4fa638;var _0x39c0cc=Number(_0x4e8353['data1']);var _0x3634ea=_0x4e8353[_0x86ec('0xc')]?Boolean(Number(_0x4e8353[_0x86ec('0xc')])):![];var _0x282f27;var _0x3f199f=![];if(!_[_0x86ec('0xd')](_0x4e8353[_0x86ec('0xe')])){if(_0x4e8353[_0x86ec('0xe')]=='1')_0x3f199f=!![];}if(!_0x3f199f){if(_0x3cb4a7[_0x86ec('0xf')]){_0x3e8218['id']=_0x3cb4a7[_0x86ec('0xf')];}}if(!_0x3e8218['id']){_0x3e8218[_0x86ec('0x10')]=_0x39c0cc;_0x282f27=_0x4e8353[_0x86ec('0x11')]&&_0x4e8353[_0x86ec('0x11')]!=='0'?_0x4e8353[_0x86ec('0x11')][_0x86ec('0x12')](','):[_0x86ec('0x13')];_0x3e8218[_0x86ec('0x14')]=_[_0x86ec('0x15')](_0x282f27,function(_0x5a9ef3){var _0x4022b2={};_0x4022b2[_0x5a9ef3]=_0x3cb4a7[_0x86ec('0x16')]?_0x3cb4a7[_0x86ec('0x17')]:_0x3cb4a7[_0x86ec('0x18')];return _0x4022b2;});_0x4fa638=_0x3cb4a7[_0x86ec('0x16')]?_0x3cb4a7[_0x86ec('0x17')]:_0x3cb4a7['calleridnum'];}var _0x49532c=['id','firstName',_0x86ec('0x19'),_0x86ec('0x13'),_0x86ec('0x1a'),_0x86ec('0x1b'),_0x86ec('0x10'),'createdAt','scheduledAt','updatedAt'];var _0x5b608c=_[_0x86ec('0x1c')](_0x49532c,_0x282f27);BPromise[_0x86ec('0x1d')]()[_0x86ec('0x1e')](cmContactRpc[_0x86ec('0x1f')]({'attributes':_0x5b608c,'where':_0x3e8218,'phone':_0x4fa638}))[_0x86ec('0x1e')](function(_0x3b303e){_0x3d7325=_0x3b303e;if(!_['isEmpty'](_0x3d7325)){if(_0x3d7325[_0x86ec('0x20')]===0x1){_0x13b51e=_0x3d7325[0x0];logger[_0x86ec('0x21')](_0x86ec('0x22'),_0x3cb4a7['uniqueid'],_0x1db05c['id'],_0x13b51e['id']);}else{logger[_0x86ec('0x21')](_0x86ec('0x23'),_0x3cb4a7[_0x86ec('0x24')],_0x1db05c['id'],_[_0x86ec('0x15')](_0x3d7325,'id')[_0x86ec('0x25')](','));}return;}else{logger[_0x86ec('0x21')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x3cb4a7[_0x86ec('0x24')],_0x1db05c['id']);var _0x323f2c={'ListId':_0x39c0cc};var _0x5290bb=_0x4e8353[_0x86ec('0x26')]&&_0x4e8353[_0x86ec('0x26')]!=='0'?_0x4e8353['data4']:_0x86ec('0x13');if(_0x3634ea){logger[_0x86ec('0x21')](_0x86ec('0x27'),_0x3cb4a7[_0x86ec('0x24')],_0x1db05c['id']);_0x323f2c[_0x5290bb]=_[_0x86ec('0xd')](_0x3cb4a7[_0x86ec('0x16')])?_0x3cb4a7[_0x86ec('0x18')]:_0x3cb4a7[_0x86ec('0x17')];if(_[_0x86ec('0xd')](_0x3cb4a7[_0x86ec('0x16')])){_0x323f2c[_0x86ec('0x28')]=_0x3cb4a7[_0x86ec('0x29')]&&_0x3cb4a7[_0x86ec('0x29')]!==_0x86ec('0x2a')?_0x3cb4a7['calleridname']:_0x86ec('0x2b');}else{_0x323f2c['firstName']=_0x3cb4a7['destcalleridname']&&_0x3cb4a7[_0x86ec('0x2c')]!==_0x86ec('0x2a')?_0x3cb4a7[_0x86ec('0x2c')]:_0x86ec('0x2b');}return BPromise[_0x86ec('0x1d')]()['then'](cmContactRpc[_0x86ec('0x2d')](_0x323f2c))['then'](function(_0x7fb553){_0x13b51e=_0x7fb553;_0x3d7325[_0x86ec('0x2e')](_0x7fb553);if(_0x13b51e){logger[_0x86ec('0x21')](_0x86ec('0x2f'),_0x3cb4a7[_0x86ec('0x24')],_0x1db05c['id'],_0x13b51e['id']);}return;});}else{logger[_0x86ec('0x21')](_0x86ec('0x30'),_0x3cb4a7[_0x86ec('0x24')],_0x1db05c['id']);_0x323f2c[_0x5290bb]=_[_0x86ec('0xd')](_0x3cb4a7[_0x86ec('0x16')])?_0x3cb4a7[_0x86ec('0x18')]:_0x3cb4a7[_0x86ec('0x17')];if(_[_0x86ec('0xd')](_0x3cb4a7[_0x86ec('0x16')])){_0x323f2c[_0x86ec('0x28')]=_0x3cb4a7[_0x86ec('0x29')]&&_0x3cb4a7['calleridname']!==_0x86ec('0x2a')?_0x3cb4a7[_0x86ec('0x29')]:_0x86ec('0x2b');}else{_0x323f2c[_0x86ec('0x28')]=_0x3cb4a7[_0x86ec('0x2c')]&&_0x3cb4a7[_0x86ec('0x2c')]!==_0x86ec('0x2a')?_0x3cb4a7['destcalleridname']:_0x86ec('0x2b');}_0x13b51e=_0x323f2c;_0x3d7325['push'](_0x323f2c);return;}}})[_0x86ec('0x1e')](function(){if(_0x2ac552){emit(_0x3cb4a7[_0x86ec('0x24')],_0x1db05c,util[_0x86ec('0x31')](_0x86ec('0x32'),_0x2ac552['name']),util[_0x86ec('0x31')]('trigger:%s',_0x4e8353[_0x86ec('0x33')][_0x86ec('0x34')]()),{'evt':_[_0x86ec('0x35')](_0x3cb4a7,{'autoCreate':_0x3634ea}),'contact':_0x13b51e===undefined?{}:_0x13b51e,'contacts':_0x3d7325[_0x86ec('0x20')]===0x0?undefined:_0x3d7325});}});}; \ No newline at end of file +var _0x533d=['$or','destcalleridnum','calleridnum','routeId','firstName','lastName','mobile','fax','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','data4','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','action','lodash','bluebird','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone'];(function(_0x592d4b,_0x39b2aa){var _0x167226=function(_0x21960f){while(--_0x21960f){_0x592d4b['push'](_0x592d4b['shift']());}};_0x167226(++_0x39b2aa);}(_0x533d,0x16b));var _0xd533=function(_0x14e585,_0x31bf4e){_0x14e585=_0x14e585-0x0;var _0x46d5e4=_0x533d[_0x14e585];return _0x46d5e4;};'use strict';var _=require(_0xd533('0x0'));var BPromise=require(_0xd533('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xd533('0x2'));var logger=require(_0xd533('0x3'))(_0xd533('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0xd533('0x5')]=_[_0xd533('0x6')](config[_0xd533('0x5')],{'host':_0xd533('0x7'),'port':0x18eb});var io=require(_0xd533('0x8'))(new Redis(config[_0xd533('0x5')]));function emit(_0x28f371,_0xbd652,_0x38e979,_0x3b9c01,_0x252840){logger[_0xd533('0x9')](_0xd533('0xa'),_0x28f371,_0xbd652['id'],_0x38e979,_0x3b9c01,JSON[_0xd533('0xb')](_0x252840));io['to'](_0x38e979)[_0xd533('0xc')](_0x3b9c01,_0x252840);}exports['exec']=function(_0x48e46e,_0x2fdeeb,_0x4d6883,_0x1299a6){var _0x22dfa0,_0x58e300;var _0x51f9db={};var _0x353ba8;var _0x4eb443=Number(_0x4d6883[_0xd533('0xd')]);var _0x55b89a=_0x4d6883[_0xd533('0xe')]?Boolean(Number(_0x4d6883[_0xd533('0xe')])):![];var _0x68e1c;var _0x5e840=![];if(!_[_0xd533('0xf')](_0x4d6883[_0xd533('0x10')])){if(_0x4d6883[_0xd533('0x10')]=='1')_0x5e840=!![];}if(!_0x5e840){if(_0x1299a6[_0xd533('0x11')]){_0x51f9db['id']=_0x1299a6[_0xd533('0x11')];}}if(!_0x51f9db['id']){_0x51f9db[_0xd533('0x12')]=_0x4eb443;_0x68e1c=_0x4d6883['data3']&&_0x4d6883[_0xd533('0x13')]!=='0'?_0x4d6883['data3'][_0xd533('0x14')](','):[_0xd533('0x15')];_0x51f9db[_0xd533('0x16')]=_['map'](_0x68e1c,function(_0x29c5c7){var _0x39df09={};_0x39df09[_0x29c5c7]=_0x1299a6['routeId']?_0x1299a6[_0xd533('0x17')]:_0x1299a6[_0xd533('0x18')];return _0x39df09;});_0x353ba8=_0x1299a6[_0xd533('0x19')]?_0x1299a6[_0xd533('0x17')]:_0x1299a6[_0xd533('0x18')];}var _0x1aa89f=['id',_0xd533('0x1a'),_0xd533('0x1b'),_0xd533('0x15'),_0xd533('0x1c'),_0xd533('0x1d'),'ListId','createdAt',_0xd533('0x1e'),_0xd533('0x1f')];var _0x392cd3=_[_0xd533('0x20')](_0x1aa89f,_0x68e1c);BPromise['resolve']()[_0xd533('0x21')](cmContactRpc[_0xd533('0x22')]({'attributes':_0x392cd3,'where':_0x51f9db,'phone':_0x353ba8}))['then'](function(_0x3c8489){_0x58e300=_0x3c8489;if(!_[_0xd533('0x23')](_0x58e300)){if(_0x58e300[_0xd533('0x24')]===0x1){_0x22dfa0=_0x58e300[0x0];logger[_0xd533('0x9')](_0xd533('0x25'),_0x1299a6[_0xd533('0x26')],_0x2fdeeb['id'],_0x22dfa0['id']);}else{logger[_0xd533('0x9')](_0xd533('0x27'),_0x1299a6[_0xd533('0x26')],_0x2fdeeb['id'],_[_0xd533('0x28')](_0x58e300,'id')['join'](','));}return;}else{logger[_0xd533('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x1299a6[_0xd533('0x26')],_0x2fdeeb['id']);var _0x34b2f8={'ListId':_0x4eb443};var _0x2fc74d=_0x4d6883[_0xd533('0x29')]&&_0x4d6883[_0xd533('0x29')]!=='0'?_0x4d6883['data4']:'phone';if(_0x55b89a){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x1299a6[_0xd533('0x26')],_0x2fdeeb['id']);_0x34b2f8[_0x2fc74d]=_[_0xd533('0xf')](_0x1299a6['routeId'])?_0x1299a6['calleridnum']:_0x1299a6['destcalleridnum'];if(_['isNil'](_0x1299a6[_0xd533('0x19')])){_0x34b2f8[_0xd533('0x1a')]=_0x1299a6[_0xd533('0x2a')]&&_0x1299a6['calleridname']!==_0xd533('0x2b')?_0x1299a6[_0xd533('0x2a')]:_0xd533('0x2c');}else{_0x34b2f8[_0xd533('0x1a')]=_0x1299a6[_0xd533('0x2d')]&&_0x1299a6[_0xd533('0x2d')]!==_0xd533('0x2b')?_0x1299a6['destcalleridname']:_0xd533('0x2c');}return BPromise[_0xd533('0x2e')]()[_0xd533('0x21')](cmContactRpc[_0xd533('0x2f')](_0x34b2f8))[_0xd533('0x21')](function(_0x370787){_0x22dfa0=_0x370787;_0x58e300[_0xd533('0x30')](_0x370787);if(_0x22dfa0){logger[_0xd533('0x9')](_0xd533('0x31'),_0x1299a6[_0xd533('0x26')],_0x2fdeeb['id'],_0x22dfa0['id']);}return;});}else{logger['info'](_0xd533('0x32'),_0x1299a6[_0xd533('0x26')],_0x2fdeeb['id']);_0x34b2f8[_0x2fc74d]=_[_0xd533('0xf')](_0x1299a6[_0xd533('0x19')])?_0x1299a6[_0xd533('0x18')]:_0x1299a6[_0xd533('0x17')];if(_[_0xd533('0xf')](_0x1299a6['routeId'])){_0x34b2f8[_0xd533('0x1a')]=_0x1299a6[_0xd533('0x2a')]&&_0x1299a6['calleridname']!==_0xd533('0x2b')?_0x1299a6[_0xd533('0x2a')]:_0xd533('0x2c');}else{_0x34b2f8[_0xd533('0x1a')]=_0x1299a6[_0xd533('0x2d')]&&_0x1299a6[_0xd533('0x2d')]!==_0xd533('0x2b')?_0x1299a6['destcalleridname']:_0xd533('0x2c');}_0x22dfa0=_0x34b2f8;_0x58e300[_0xd533('0x30')](_0x34b2f8);return;}}})[_0xd533('0x21')](function(){if(_0x48e46e){emit(_0x1299a6[_0xd533('0x26')],_0x2fdeeb,util[_0xd533('0x33')](_0xd533('0x34'),_0x48e46e['name']),util[_0xd533('0x33')](_0xd533('0x35'),_0x4d6883[_0xd533('0x36')]['toLowerCase']()),{'evt':_['merge'](_0x1299a6,{'autoCreate':_0x55b89a}),'contact':_0x22dfa0===undefined?{}:_0x22dfa0,'contacts':_0x58e300['length']===0x0?undefined:_0x58e300});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index fb95ba4..177baf4 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 _0x867f=['length','Actions','action','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','html','render','template\x20not\x20found','buildUri','isNil','data3','data4','uriLocation','data5','windowHeight','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','data1','merge','jscripty','trigger:%s','exec','integration','accounts','queue','routeId','urlforward','parse','query','search','replace','channel','every','AllConditions','checkConditions','AnyConditions','checkTrigger:\x20trigger','evt','field','ChatWebsiteId','operator','value','upperFirst','AccountId','event','membername','lastevent','mailSubstatus','null','substatus','created','equals','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','bind','custom:agentconnect','custom:agentcomplete','syncCustomEvent','custom:agentnosuchnumber','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','info','emit','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','checkTrigger','variables'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x867f,0xbc));var _0xf867=function(_0x3cb773,_0x3ba3b7){_0x3cb773=_0x3cb773-0x0;var _0x520be6=_0x867f[_0x3cb773];return _0x520be6;};'use strict';var util=require(_0xf867('0x0'));var _=require(_0xf867('0x1'));var url=require(_0xf867('0x2'));var Mustache=require(_0xf867('0x3'));var Redis=require(_0xf867('0x4'));var urlforward=require(_0xf867('0x5'));var integration=require(_0xf867('0x6'));var cmContact=require('./cmContact');var script=require(_0xf867('0x7'));var config=require(_0xf867('0x8'));var logger=require(_0xf867('0x9'))(_0xf867('0xa'));var ami=require(_0xf867('0xb'));config[_0xf867('0xc')]=_[_0xf867('0xd')](config[_0xf867('0xc')],{'host':_0xf867('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf867('0xc')]));var operators={'equals':function(_0x1591c4,_0x3de789){return _0x1591c4==_0x3de789;},'not_equals':function(_0x40a573,_0x5cc7b7){return _0x40a573!=_0x5cc7b7;}};var barAndWebActions=[_0xf867('0xf'),_0xf867('0x2'),_0xf867('0x10')];function Trigger(_0x57228f){this['triggers']=_0x57228f[_0xf867('0x11')];this[_0xf867('0x12')]=_0x57228f[_0xf867('0x12')];this[_0xf867('0x13')]=_0x57228f['voiceQueues'];this[_0xf867('0x14')]=_0x57228f['templates'];this[_0xf867('0x15')]=_0x57228f[_0xf867('0x15')];this[_0xf867('0x16')]=_0x57228f[_0xf867('0x16')];this[_0xf867('0x17')]=_0x57228f[_0xf867('0x17')];this['salesforceAccounts']=_0x57228f[_0xf867('0x18')];this[_0xf867('0x19')]=_0x57228f[_0xf867('0x19')];this[_0xf867('0x1a')]=_0x57228f[_0xf867('0x1a')];this[_0xf867('0x1b')]=_0x57228f[_0xf867('0x1b')];this[_0xf867('0x1c')]=_0x57228f[_0xf867('0x1c')];this[_0xf867('0x1d')]=_0x57228f[_0xf867('0x1d')];this[_0xf867('0x1e')]=_0x57228f[_0xf867('0x1e')];this[_0xf867('0x1f')]=_0x57228f[_0xf867('0x1f')];this['accounts']={'zendesk':this[_0xf867('0x16')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xf867('0x17')],'sugarcrm':this[_0xf867('0x19')],'zoho':this[_0xf867('0x1a')],'desk':this[_0xf867('0x1b')],'vtiger':this[_0xf867('0x1c')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xf867('0x1f')],'servicenow':this[_0xf867('0x1d')]};ami['on'](_0xf867('0x20'),this['syncCustomEvent'][_0xf867('0x21')](this));ami['on'](_0xf867('0x22'),this['syncCustomEvent'][_0xf867('0x21')](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent'][_0xf867('0x21')](this));ami['on'](_0xf867('0x23'),this[_0xf867('0x24')][_0xf867('0x21')](this));ami['on'](_0xf867('0x25'),this[_0xf867('0x24')][_0xf867('0x21')](this));ami['on']('custom:agentnoanswer',this[_0xf867('0x24')][_0xf867('0x21')](this));ami['on']('custom:agentbusy',this[_0xf867('0x24')][_0xf867('0x21')](this));ami['on'](_0xf867('0x26'),this[_0xf867('0x24')][_0xf867('0x21')](this));ami['on'](_0xf867('0x27'),this[_0xf867('0x24')][_0xf867('0x21')](this));ami['on'](_0xf867('0x28'),this[_0xf867('0x24')][_0xf867('0x21')](this));ami['on'](_0xf867('0x29'),this[_0xf867('0x24')][_0xf867('0x21')](this));ami['on']('custom:timeout',this[_0xf867('0x24')]['bind'](this));ami['on']('custom:dialbegin',this['syncAgentDial'][_0xf867('0x21')](this));ami['on']('custom:dialconnect',this[_0xf867('0x2a')][_0xf867('0x21')](this));ami['on'](_0xf867('0x2b'),this[_0xf867('0x2a')]['bind'](this));ami['on'](_0xf867('0x2c'),this['syncCustomEvent'][_0xf867('0x21')](this));ami['on'](_0xf867('0x2d'),this[_0xf867('0x24')][_0xf867('0x21')](this));ami['on'](_0xf867('0x2e'),this[_0xf867('0x24')][_0xf867('0x21')](this));ami['on'](_0xf867('0x2f'),this['syncCustomEvent'][_0xf867('0x21')](this));ami['on'](_0xf867('0x30'),this[_0xf867('0x24')]['bind'](this));ami['on']('custom:acceptmessage',this[_0xf867('0x24')][_0xf867('0x21')](this));ami['on'](_0xf867('0x31'),this[_0xf867('0x24')][_0xf867('0x21')](this));ami['on']('custom:offlineMessage',this[_0xf867('0x24')]['bind'](this));}Trigger[_0xf867('0x32')]['emit']=function(_0x7ad3ca,_0xadda22,_0x1a752c){logger[_0xf867('0x33')](_0x7ad3ca,_0xadda22,JSON['stringify'](_0x1a752c));io['to'](_0x7ad3ca)[_0xf867('0x34')](_0xadda22,_0x1a752c);};Trigger[_0xf867('0x32')][_0xf867('0x24')]=function(_0x1f01bf){var _0x5dceee=_[_0xf867('0x35')](_0x1f01bf);if(typeof _0x5dceee[_0xf867('0x36')]===_0xf867('0x37')){_0x5dceee[_0xf867('0x36')]=_0xf867('0x38');}logger[_0xf867('0x39')](_0xf867('0x24'),util[_0xf867('0x3a')](_0x5dceee,{'showHidden':!![],'depth':null}));this[_0xf867('0x3b')](_0x5dceee);};Trigger[_0xf867('0x32')]['syncAgentDial']=function(_0x311e44){if(this[_0xf867('0x12')][_0x311e44[_0xf867('0x3c')]]){this['syncCustomEvent'](_0x311e44);}};Trigger[_0xf867('0x32')][_0xf867('0x3b')]=function(_0x4d65b6){var _0x3377c3;for(var _0x26d572 in this[_0xf867('0x11')]){if(this[_0xf867('0x11')][_0xf867('0x3d')](_0x26d572)){if(this[_0xf867('0x11')][_0x26d572]['status']){_0x3377c3=this[_0xf867('0x3e')](this['triggers'][_0x26d572],_0x4d65b6);if(_0x3377c3){_['merge'](_0x4d65b6,_0x4d65b6[_0xf867('0x3f')]);for(var _0x39dfb8=0x0,_0x1c4095,_0x11b178,_0x123237;_0x39dfb80x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x5886d2,_0x13d410){var _0x2174c9=function(_0x3181f6){while(--_0x3181f6){_0x5886d2['push'](_0x5886d2['shift']());}};_0x2174c9(++_0x13d410);}(_0x3e74,0x175));var _0x43e7=function(_0x3366ad,_0x59482f){_0x3366ad=_0x3366ad-0x0;var _0x3f6dcd=_0x3e74[_0x3366ad];return _0x3f6dcd;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 1c7b408..36caeeb 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 _0x00d6=['getString','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','assign','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','uniqueid','monitor_format','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','resolve','POST','clientId','username','password','access_token','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','then','validateEmail','email','userEmail','internalemailaddress','isdisabled','info','toUpperCase','systemuserid','userId','catch','toLowerCase','outbound','contacts','/systemusers(','4.0','headers','odata-entityid','substring','lastIndexOf','destcalleridnum','calleridnum','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','length','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents'];(function(_0x419f6c,_0x409269){var _0x2c1a58=function(_0x1952dc){while(--_0x1952dc){_0x419f6c['push'](_0x419f6c['shift']());}};_0x2c1a58(++_0x409269);}(_0x00d6,0x91));var _0x600d=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x00d6[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x600d('0x0'));var rp=require(_0x600d('0x1'));var util=require('util');var intUtil=require(_0x600d('0x2'));var md5=require('md5');var Redis=require(_0x600d('0x3'));var logger=require(_0x600d('0x4'))(_0x600d('0x5'));var config=require(_0x600d('0x6'));config['redis']=_['defaults'](config[_0x600d('0x7')],{'host':_0x600d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x600d('0x7')]));function getAuthToken(_0x4d6b30,_0x56900d,_0x257a78){if(_0x4d6b30[_0x600d('0x9')]){_0x4d6b30[_0x600d('0xa')]=_0x4d6b30[_0x600d('0xb')][_0x600d('0xc')];_0x4d6b30[_0x600d('0xd')]=_0x4d6b30[_0x600d('0xb')]['data2'];return Promise[_0x600d('0xe')](_0x4d6b30[_0x600d('0xb')]['data5']);}var _0x14d201={'method':_0x600d('0xf'),'uri':_0x56900d,'form':{'client_id':_0x4d6b30[_0x600d('0x10')],'resource':_0x4d6b30[_0x600d('0xa')],'username':_0x4d6b30[_0x600d('0x11')],'password':_0x4d6b30[_0x600d('0x12')],'grant_type':_0x600d('0x12'),'client_secret':_0x4d6b30['clientSecret']},'json':!![]};return rp(_0x14d201)['then'](function(_0x3ab51e){return _0x3ab51e[_0x600d('0x13')];})['catch'](function(_0x2a67a2){logger[_0x600d('0x14')]('['+[_0x257a78['toUpperCase']()]+_0x600d('0x15'));return _0x2a67a2[_0x600d('0x16')];});}function getUser(_0xdff68e,_0x627d,_0x26736d,_0x54fd42,_0x31e1fe,_0x313909){return new Promise(function(_0x27d287,_0x3f377d){return getAuthToken(_0x627d,_0x54fd42,_0x313909)['then'](function(_0x1f5038){var _0x505e07={'method':_0x600d('0x17'),'uri':_0x31e1fe+_0x600d('0x18'),'headers':{'Authorization':_0x600d('0x19')+_0x1f5038,'OData-Version':'4.0'},'json':!![]};return rp(_0x505e07);})[_0x600d('0x1a')](function(_0x46702f){var _0x12ee01=_0x46702f['value'];var _0x14aa35=![];var _0x52e439=null;if(!_['isNil'](_0x26736d)){if(intUtil[_0x600d('0x1b')](_0x26736d[_0x600d('0x1c')])){_0xdff68e[_0x600d('0x1d')]=_0x26736d['email'];for(_0x52e439=0x0;_0x52e439<_0x12ee01['length'];_0x52e439++){if(_0x12ee01[_0x52e439][_0x600d('0x1e')]===_0x26736d[_0x600d('0x1c')]&&!_0x12ee01[_0x52e439][_0x600d('0x1f')]){_0x14aa35=!![];logger[_0x600d('0x20')]('['+[_0x313909[_0x600d('0x21')]()]+']\x20Agent\x20found\x20'+_0x12ee01[_0x52e439][_0x600d('0x22')]+'!');_0xdff68e[_0x600d('0x23')]=_0x12ee01[_0x52e439][_0x600d('0x22')];}}}}if(!_0x14aa35){logger[_0x600d('0x20')]('['+[_0x313909[_0x600d('0x21')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0xdff68e[_0x600d('0x1d')]=_0x627d[_0x600d('0x11')];for(_0x52e439=0x0;_0x52e439<_0x12ee01['length'];_0x52e439++){if(_0x12ee01[_0x52e439][_0x600d('0x1e')]===_0x627d[_0x600d('0x11')]){_0xdff68e[_0x600d('0x23')]=_0x12ee01[_0x52e439][_0x600d('0x22')];}}}_0x27d287(_0xdff68e);})[_0x600d('0x24')](function(_0x5195db){_0x3f377d(_0x5195db[_0x600d('0x16')]);});});}function createEndUser(_0x5d6760,_0x3d1ea1,_0x2ebc22,_0x262765,_0x234e1f,_0x1dcc7b,_0x229e5c){return new Promise(function(_0x3492d7,_0x5c3c84){return getAuthToken(_0x3d1ea1,_0x2ebc22,_0x1dcc7b)[_0x600d('0x1a')](function(_0x437989){var _0x28faac=_0x1dcc7b[_0x600d('0x25')]()===_0x600d('0x26')?_0x234e1f['destcalleridnum']:_0x234e1f['calleridnum'];var _0x3fcebf={'method':_0x600d('0xf'),'uri':_0x262765+_0x600d('0x27'),'body':{'fullname':_0x28faac,'firstname':_0x28faac,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x600d('0x28')+_0x5d6760[_0x600d('0x23')]+')'},'headers':{'Authorization':_0x600d('0x19')+_0x437989,'OData-Version':_0x600d('0x29')},'json':!![],'resolveWithFullResponse':!![]};_0x3fcebf['body'][_0x229e5c]=_0x28faac;return rp(_0x3fcebf);})[_0x600d('0x1a')](function(_0x51ae61){var _0x4866d9=_0x51ae61[_0x600d('0x2a')][_0x600d('0x2b')];var _0x1e25a7=_0x4866d9[_0x600d('0x2c')](_0x4866d9[_0x600d('0x2d')]('(')+0x1,_0x4866d9['lastIndexOf'](')'));_0x5d6760['enduserId']=_0x1e25a7;_0x3492d7(_0x5d6760);})['catch'](function(_0x21cb2d){_0x5c3c84(_0x21cb2d[_0x600d('0x16')]);});});}function getEndUser(_0x28ce4a,_0x58fed3,_0x40e271,_0xe25463,_0x50e972,_0xf578ef,_0x34a303,_0x2ed4a3){var _0x5c18fb=_0xf578ef[_0x600d('0x25')]()===_0x600d('0x26')?_0x50e972[_0x600d('0x2e')]:_0x50e972[_0x600d('0x2f')];return getAuthToken(_0x58fed3,_0x40e271,_0xf578ef)['then'](function(_0x1c2d4a){_0x2ed4a3=_0x2ed4a3?_0x2ed4a3:'telephone1';var _0x19be72={'method':_0x600d('0x17'),'uri':_0xe25463+_0x600d('0x30')+_0x2ed4a3+_0x600d('0x31')+_0x2ed4a3+_0x600d('0x32')+_0x5c18fb[_0x600d('0x33')]('+',_0x600d('0x34'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x1c2d4a,'If-None-Match':null,'OData-Version':_0x600d('0x29')},'json':!![]};return rp(_0x19be72);})[_0x600d('0x1a')](function(_0x373f7a){var _0x4c6984=![];if(!_0x373f7a)return _0x4c6984;var _0x29010d=_0x373f7a['value'];for(var _0x52076d=0x0;_0x52076d<_0x29010d[_0x600d('0x35')];_0x52076d++){if(_0x29010d[_0x52076d][_0x2ed4a3]===_0x5c18fb){_0x4c6984=!![];_0x28ce4a[_0x600d('0x36')]=_0x29010d[_0x52076d][_0x600d('0x37')];}}return _0x4c6984;})[_0x600d('0x1a')](function(_0x3009e5){if(_0x3009e5)return _0x28ce4a;if(_0x34a303===_0x600d('0x38')){logger[_0x600d('0x20')]('['+[_0xf578ef[_0x600d('0x21')]()]+_0x600d('0x39'));return _0x28ce4a;}return createEndUser(_0x28ce4a,_0x58fed3,_0x40e271,_0xe25463,_0x50e972,_0xf578ef,_0x2ed4a3)[_0x600d('0x1a')](function(_0x1649e9){logger[_0x600d('0x20')]('['+[_0xf578ef[_0x600d('0x21')]()]+_0x600d('0x3a'),_0x1649e9[_0x600d('0x36')]);return _0x1649e9;});});}function getCustomFields(_0x4ccfa3,_0x14ef68,_0x5514c0){var _0x3f1889={};if(_0x4ccfa3[_0x600d('0x35')]>0x0){_[_0x600d('0x3b')](_0x4ccfa3,function(_0x403d76){if(_[_0x600d('0x3c')](['string',_0x600d('0x3d')],_0x403d76[_0x600d('0x3e')])&&_0x403d76[_0x600d('0x3f')]&&!_0x403d76[_0x600d('0x40')]){var _0xbebeed=_0x403d76[_0x600d('0x41')][_0x600d('0x25')]();var _0x5a43e0=_0xbebeed[_0x600d('0x2c')](0x0,_0xbebeed[_0x600d('0x42')]('_'));var _0x11da73=_0xbebeed[_0x600d('0x2c')](_0xbebeed['indexOf']('_')+0x1);if(_0x5a43e0===_0x5514c0){_0x3f1889[_0x11da73]=_0x403d76[_0x600d('0x43')];}}});}return _0x3f1889;}function getTicket(_0x3b784a,_0x4c6eaa,_0x4da56d,_0x3aee99,_0x55760f,_0x541856,_0x575c52){return new Promise(function(_0x45a37c,_0x54e717){var _0x44aaa4;return getAuthToken(_0x4c6eaa,_0x4da56d,_0x575c52)[_0x600d('0x1a')](function(_0x448dab){if(_0x541856[_0x600d('0x44')]===_0x600d('0x45')){_0x44aaa4={'method':_0x600d('0xf'),'uri':_0x3aee99+_0x600d('0x46'),'body':Object['assign']({},{'title':intUtil[_0x600d('0x47')](_0x541856['Subjects'],_0x55760f,'\x20'),'description':intUtil['getString'](_0x541856[_0x600d('0x48')],_0x55760f,'\x0a'),'customerid_contact@odata.bind':_0x3b784a[_0x600d('0x36')]?_0x600d('0x49')+_0x3b784a[_0x600d('0x36')]+')':undefined,'ownerid@odata.bind':_0x600d('0x28')+_0x3b784a[_0x600d('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x541856[_0x600d('0x4a')],_0x55760f,_0x541856[_0x600d('0x44')])),'headers':{'Authorization':_0x600d('0x19')+_0x448dab,'OData-Version':_0x600d('0x29')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x541856['ticketType']===_0x600d('0x4b')){var _0x1c1b9f=_0x3b784a[_0x600d('0x36')]?[{'partyid_systemuser@odata.bind':_0x600d('0x28')+_0x3b784a[_0x600d('0x23')]+')','participationtypemask':_0x3b784a[_0x600d('0x4c')]===_0x600d('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x600d('0x49')+_0x3b784a[_0x600d('0x36')]+')','participationtypemask':_0x3b784a['callDirection']===_0x600d('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3b784a[_0x600d('0x23')]+')','participationtypemask':_0x3b784a[_0x600d('0x4c')]==='queue'?0x2:0x1}];_0x44aaa4={'method':'POST','uri':_0x3aee99+_0x600d('0x4e'),'body':Object[_0x600d('0x4f')]({},{'subject':intUtil[_0x600d('0x47')](_0x541856['Subjects'],_0x55760f,'\x20'),'phonenumber':String(_0x55760f[_0x600d('0x2f')]),'description':intUtil['getString'](_0x541856['Descriptions'],_0x55760f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3b784a[_0x600d('0x36')]?'/contacts('+_0x3b784a[_0x600d('0x36')]+')':undefined,'ownerid@odata.bind':_0x600d('0x28')+_0x3b784a[_0x600d('0x23')]+')','directioncode':_0x3b784a[_0x600d('0x4c')]==='queue'?![]:!![],'phonecall_activity_parties':_0x1c1b9f},getCustomFields(_0x541856[_0x600d('0x4a')],_0x55760f,_0x541856[_0x600d('0x44')])),'headers':{'Authorization':_0x600d('0x19')+_0x448dab,'OData-Version':_0x600d('0x29')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x44aaa4);})['then'](function(_0x41021d){var _0x5adbfc=_0x41021d[_0x600d('0x2a')][_0x600d('0x2b')];var _0x306c98=_0x5adbfc[_0x600d('0x2c')](_0x5adbfc[_0x600d('0x2d')]('(')+0x1,_0x5adbfc[_0x600d('0x2d')](')'));_0x3b784a[_0x600d('0x50')]=_0x306c98;_0x45a37c(_0x3b784a);})[_0x600d('0x24')](function(_0x3df512){_0x54e717(_0x3df512[_0x600d('0x16')]);});});}function emit(_0xc89ef8,_0x12eca6,_0x187b8a,_0x45bbb5){var _0x42d011={'uri':util[_0x600d('0x51')](_0x600d('0x52'),_0xc89ef8,_0x187b8a,_0x45bbb5)};io['to'](util[_0x600d('0x51')](_0x600d('0x53'),_0x12eca6))[_0x600d('0x54')](_0x600d('0x55'),_0x42d011);}exports['cs']=function(_0x4de3bb,_0x1fbf13,_0x146eb2,_0x5c3af9,_0x5bbc43,_0x93f4c4,_0x27e5f7,_0x45f6ab){var _0xdd4f87={};_0x93f4c4['remoteUri']=_0x93f4c4[_0x600d('0x9')]?intUtil['stripTrailingSlash'](_0x93f4c4[_0x600d('0xb')][_0x600d('0xc')]):intUtil[_0x600d('0x56')](_0x93f4c4['remoteUri']);_0x93f4c4[_0x600d('0x57')]=intUtil['stripTrailingSlash'](_0x93f4c4['serverUrl']);_0xdd4f87['callDirection']=_0x45f6ab===_0x600d('0x4d')||_0x45f6ab==='unmanaged'?_0x600d('0x4d'):'outbound';var _0x26326a=_0x93f4c4[_0x600d('0x9')]?util['format']('%s/api/data/v9.0/',_0x93f4c4[_0x600d('0xb')][_0x600d('0xc')]):util['format'](_0x600d('0x58'),_0x93f4c4['remoteUri']);var _0x444922=util[_0x600d('0x51')]('https://login.microsoftonline.com/%s/oauth2/token',_0x93f4c4[_0x600d('0xd')]);var _0x1784d2=util[_0x600d('0x51')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x93f4c4[_0x600d('0x57')],_0x1fbf13['uniqueid'],md5(_0x1fbf13[_0x600d('0x59')]));if(_0x5bbc43&&_0x5bbc43[_0x600d('0x5a')]){logger[_0x600d('0x20')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1fbf13[_0x600d('0x5b')]=_0x1784d2;}else if(_0x27e5f7&&_0x27e5f7[_0x600d('0x5c')]&&_0x27e5f7[_0x600d('0x5c')]!=='none'){logger[_0x600d('0x20')](_0x600d('0x5d'),_0x600d('0x5e'));_0x1fbf13['recordingURL']=_0x1784d2;}else{_0x1fbf13[_0x600d('0x5b')]='';}return getUser(_0xdd4f87,_0x93f4c4,_0x5c3af9,_0x444922,_0x26326a,_0x45f6ab)[_0x600d('0x1a')](function(_0x5f33f2){logger[_0x600d('0x20')]('['+_0x45f6ab['toUpperCase']()+_0x600d('0x5f'),_0x5f33f2[_0x600d('0x23')]);logger[_0x600d('0x20')]('['+_0x45f6ab[_0x600d('0x21')]()+_0x600d('0x60'),_0x5f33f2[_0x600d('0x1d')]);return getEndUser(_0x5f33f2,_0x93f4c4,_0x444922,_0x26326a,_0x1fbf13,_0x45f6ab,_0x146eb2[_0x600d('0x61')],_0x146eb2[_0x600d('0x62')]);})[_0x600d('0x1a')](function(_0x553042){logger[_0x600d('0x20')]('['+_0x45f6ab[_0x600d('0x21')]()+_0x600d('0x63'),_0x553042[_0x600d('0x36')]);logger[_0x600d('0x20')]('['+_0x45f6ab['toUpperCase']()+_0x600d('0x64'),_0x1fbf13[_0x600d('0x2f')]);return getTicket(_0x553042,_0x93f4c4,_0x444922,_0x26326a,_0x1fbf13,_0x146eb2,_0x45f6ab);})[_0x600d('0x1a')](function(_0x1c6dee){logger[_0x600d('0x20')](util['format']('['+_0x45f6ab[_0x600d('0x21')]()+_0x600d('0x65'),_0x146eb2[_0x600d('0x44')],_0x1c6dee[_0x600d('0x50')]));logger['info'](util[_0x600d('0x51')]('['+_0x45f6ab[_0x600d('0x21')]()+_0x600d('0x66'),_0x45f6ab));if(_0x45f6ab!==_0x600d('0x67')&&_0x146eb2[_0x600d('0x68')]){logger[_0x600d('0x20')]('['+_0x45f6ab[_0x600d('0x21')]()+']',_0x600d('0x69'));emit(_0x93f4c4[_0x600d('0xa')],_0x5c3af9[_0x600d('0x6a')],_0x146eb2[_0x600d('0x44')],_0x1c6dee[_0x600d('0x50')]);}})[_0x600d('0x24')](function(_0x173f6a){logger[_0x600d('0x14')]('['+_0x45f6ab[_0x600d('0x21')]()+_0x600d('0x6b'),_0x173f6a[_0x600d('0x16')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x173f6a);});}; \ No newline at end of file +var _0xb663=['headers','odata-entityid','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','string','picklist','type','nameField','customField','toLowerCase','substring','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','phonecall','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','modernAuthentication','%s/api/data/v9.0/','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','CloudProvider','data7','tenantId','data2','resolve','POST','clientId','remoteUri','username','password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','internalemailaddress','email','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info','length','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body'];(function(_0x3a3f77,_0x400a0a){var _0x24e317=function(_0x2b4af6){while(--_0x2b4af6){_0x3a3f77['push'](_0x3a3f77['shift']());}};_0x24e317(++_0x400a0a);}(_0xb663,0x111));var _0x3b66=function(_0x4ea0e3,_0x3e3d31){_0x4ea0e3=_0x4ea0e3-0x0;var _0x32128b=_0xb663[_0x4ea0e3];return _0x32128b;};'use strict';var _=require(_0x3b66('0x0'));var rp=require('request-promise');var util=require(_0x3b66('0x1'));var intUtil=require(_0x3b66('0x2'));var md5=require(_0x3b66('0x3'));var Redis=require(_0x3b66('0x4'));var logger=require(_0x3b66('0x5'))(_0x3b66('0x6'));var config=require(_0x3b66('0x7'));config[_0x3b66('0x8')]=_[_0x3b66('0x9')](config[_0x3b66('0x8')],{'host':_0x3b66('0xa'),'port':0x18eb});var io=require(_0x3b66('0xb'))(new Redis(config[_0x3b66('0x8')]));function getAuthToken(_0x32fada,_0x314e35,_0xb0aa8){if(_0x32fada['modernAuthentication']){_0x32fada['remoteUri']=_0x32fada[_0x3b66('0xc')][_0x3b66('0xd')];_0x32fada[_0x3b66('0xe')]=_0x32fada[_0x3b66('0xc')][_0x3b66('0xf')];return Promise[_0x3b66('0x10')](_0x32fada[_0x3b66('0xc')]['data5']);}var _0x1ee624={'method':_0x3b66('0x11'),'uri':_0x314e35,'form':{'client_id':_0x32fada[_0x3b66('0x12')],'resource':_0x32fada[_0x3b66('0x13')],'username':_0x32fada[_0x3b66('0x14')],'password':_0x32fada[_0x3b66('0x15')],'grant_type':_0x3b66('0x15'),'client_secret':_0x32fada[_0x3b66('0x16')]},'json':!![]};return rp(_0x1ee624)['then'](function(_0x4d9c89){return _0x4d9c89['access_token'];})[_0x3b66('0x17')](function(_0x59f2cf){logger[_0x3b66('0x18')]('['+[_0xb0aa8[_0x3b66('0x19')]()]+_0x3b66('0x1a'));return _0x59f2cf[_0x3b66('0x1b')];});}function getUser(_0x1e618f,_0x59c055,_0xacbbdc,_0x516a14,_0xcb0bfd,_0x59502a){return new Promise(function(_0x31933e,_0x4ab0e3){return getAuthToken(_0x59c055,_0x516a14,_0x59502a)[_0x3b66('0x1c')](function(_0x2a37eb){var _0x5dd90b={'method':_0x3b66('0x1d'),'uri':_0xcb0bfd+_0x3b66('0x1e'),'headers':{'Authorization':_0x3b66('0x1f')+_0x2a37eb,'OData-Version':_0x3b66('0x20')},'json':!![]};return rp(_0x5dd90b);})[_0x3b66('0x1c')](function(_0x526dfa){var _0xbf280e=_0x526dfa[_0x3b66('0x21')];var _0x40226c=![];var _0x4e2df0=null;if(!_[_0x3b66('0x22')](_0xacbbdc)){if(intUtil[_0x3b66('0x23')](_0xacbbdc['email'])){_0x1e618f[_0x3b66('0x24')]=_0xacbbdc['email'];for(_0x4e2df0=0x0;_0x4e2df0<_0xbf280e['length'];_0x4e2df0++){if(_0xbf280e[_0x4e2df0][_0x3b66('0x25')]===_0xacbbdc[_0x3b66('0x26')]&&!_0xbf280e[_0x4e2df0][_0x3b66('0x27')]){_0x40226c=!![];logger['info']('['+[_0x59502a[_0x3b66('0x19')]()]+_0x3b66('0x28')+_0xbf280e[_0x4e2df0][_0x3b66('0x29')]+'!');_0x1e618f[_0x3b66('0x2a')]=_0xbf280e[_0x4e2df0][_0x3b66('0x29')];}}}}if(!_0x40226c){logger[_0x3b66('0x2b')]('['+[_0x59502a[_0x3b66('0x19')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x1e618f[_0x3b66('0x24')]=_0x59c055[_0x3b66('0x14')];for(_0x4e2df0=0x0;_0x4e2df0<_0xbf280e[_0x3b66('0x2c')];_0x4e2df0++){if(_0xbf280e[_0x4e2df0][_0x3b66('0x25')]===_0x59c055['username']){_0x1e618f[_0x3b66('0x2a')]=_0xbf280e[_0x4e2df0]['systemuserid'];}}}_0x31933e(_0x1e618f);})['catch'](function(_0x1c2e9c){_0x4ab0e3(_0x1c2e9c['message']);});});}function createEndUser(_0x1a9310,_0x162f69,_0xa7632,_0x490d47,_0x432336,_0x2e70f9,_0x440f6e){return new Promise(function(_0x1e4f6b,_0x5b75d9){return getAuthToken(_0x162f69,_0xa7632,_0x2e70f9)[_0x3b66('0x1c')](function(_0x5c5a12){var _0x183691=_0x2e70f9['toLowerCase']()===_0x3b66('0x2d')?_0x432336[_0x3b66('0x2e')]:_0x432336[_0x3b66('0x2f')];var _0x493eef={'method':_0x3b66('0x11'),'uri':_0x490d47+_0x3b66('0x30'),'body':{'fullname':_0x183691,'firstname':_0x183691,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3b66('0x31')+_0x1a9310[_0x3b66('0x2a')]+')'},'headers':{'Authorization':_0x3b66('0x1f')+_0x5c5a12,'OData-Version':_0x3b66('0x20')},'json':!![],'resolveWithFullResponse':!![]};_0x493eef[_0x3b66('0x32')][_0x440f6e]=_0x183691;return rp(_0x493eef);})[_0x3b66('0x1c')](function(_0x298e3d){var _0x1f58ae=_0x298e3d[_0x3b66('0x33')][_0x3b66('0x34')];var _0x4da202=_0x1f58ae['substring'](_0x1f58ae[_0x3b66('0x35')]('(')+0x1,_0x1f58ae['lastIndexOf'](')'));_0x1a9310[_0x3b66('0x36')]=_0x4da202;_0x1e4f6b(_0x1a9310);})[_0x3b66('0x17')](function(_0x41a147){_0x5b75d9(_0x41a147[_0x3b66('0x1b')]);});});}function getEndUser(_0xca4fcc,_0x21e075,_0x29d013,_0x19cc60,_0xb4adcc,_0x2f5407,_0x46c6a4,_0x132bd1){var _0x29a5da=_0x2f5407['toLowerCase']()==='outbound'?_0xb4adcc[_0x3b66('0x2e')]:_0xb4adcc[_0x3b66('0x2f')];return getAuthToken(_0x21e075,_0x29d013,_0x2f5407)[_0x3b66('0x1c')](function(_0x46c147){_0x132bd1=_0x132bd1?_0x132bd1:_0x3b66('0x37');var _0x2f91a1={'method':'GET','uri':_0x19cc60+_0x3b66('0x38')+_0x132bd1+_0x3b66('0x39')+_0x132bd1+_0x3b66('0x3a')+_0x29a5da[_0x3b66('0x3b')]('+',_0x3b66('0x3c'))+'\x27','headers':{'Authorization':_0x3b66('0x1f')+_0x46c147,'If-None-Match':null,'OData-Version':_0x3b66('0x20')},'json':!![]};return rp(_0x2f91a1);})[_0x3b66('0x1c')](function(_0x12bd31){var _0x5e0af2=![];if(!_0x12bd31)return _0x5e0af2;var _0x1ba6c7=_0x12bd31[_0x3b66('0x21')];for(var _0x42d567=0x0;_0x42d567<_0x1ba6c7[_0x3b66('0x2c')];_0x42d567++){if(_0x1ba6c7[_0x42d567][_0x132bd1]===_0x29a5da){_0x5e0af2=!![];_0xca4fcc[_0x3b66('0x36')]=_0x1ba6c7[_0x42d567][_0x3b66('0x3d')];}}return _0x5e0af2;})[_0x3b66('0x1c')](function(_0x19cd4c){if(_0x19cd4c)return _0xca4fcc;if(_0x46c6a4==='nothing'){logger[_0x3b66('0x2b')]('['+[_0x2f5407[_0x3b66('0x19')]()]+_0x3b66('0x3e'));return _0xca4fcc;}return createEndUser(_0xca4fcc,_0x21e075,_0x29d013,_0x19cc60,_0xb4adcc,_0x2f5407,_0x132bd1)[_0x3b66('0x1c')](function(_0x23b663){logger[_0x3b66('0x2b')]('['+[_0x2f5407['toUpperCase']()]+']\x20Enduser\x20created!',_0x23b663[_0x3b66('0x36')]);return _0x23b663;});});}function getCustomFields(_0x287fbd,_0x4db3d1,_0x5f3203){var _0x503f91={};if(_0x287fbd[_0x3b66('0x2c')]>0x0){_[_0x3b66('0x3f')](_0x287fbd,function(_0x1d927a){if(_['includes']([_0x3b66('0x40'),_0x3b66('0x41')],_0x1d927a[_0x3b66('0x42')])&&_0x1d927a[_0x3b66('0x43')]&&!_0x1d927a[_0x3b66('0x44')]){var _0x3cc540=_0x1d927a['idField'][_0x3b66('0x45')]();var _0x4aa5f7=_0x3cc540[_0x3b66('0x46')](0x0,_0x3cc540['indexOf']('_'));var _0x287801=_0x3cc540[_0x3b66('0x46')](_0x3cc540[_0x3b66('0x47')]('_')+0x1);if(_0x4aa5f7===_0x5f3203){_0x503f91[_0x287801]=_0x1d927a[_0x3b66('0x48')];}}});}return _0x503f91;}function getTicket(_0x1f63e5,_0x240f96,_0x2f5ca2,_0x89925,_0x340449,_0x2f718b,_0x1542ec){return new Promise(function(_0xfea402,_0x520c7a){var _0x3afb89;return getAuthToken(_0x240f96,_0x2f5ca2,_0x1542ec)[_0x3b66('0x1c')](function(_0x251c79){if(_0x2f718b[_0x3b66('0x49')]===_0x3b66('0x4a')){_0x3afb89={'method':_0x3b66('0x11'),'uri':_0x89925+_0x3b66('0x4b'),'body':Object[_0x3b66('0x4c')]({},{'title':intUtil[_0x3b66('0x4d')](_0x2f718b[_0x3b66('0x4e')],_0x340449,'\x20'),'description':intUtil[_0x3b66('0x4d')](_0x2f718b[_0x3b66('0x4f')],_0x340449,'\x0a'),'customerid_contact@odata.bind':_0x1f63e5[_0x3b66('0x36')]?_0x3b66('0x50')+_0x1f63e5[_0x3b66('0x36')]+')':undefined,'ownerid@odata.bind':_0x3b66('0x31')+_0x1f63e5[_0x3b66('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x2f718b['Fields'],_0x340449,_0x2f718b[_0x3b66('0x49')])),'headers':{'Authorization':_0x3b66('0x1f')+_0x251c79,'OData-Version':_0x3b66('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2f718b[_0x3b66('0x49')]===_0x3b66('0x51')){var _0x391b0f=_0x1f63e5['enduserId']?[{'partyid_systemuser@odata.bind':_0x3b66('0x31')+_0x1f63e5[_0x3b66('0x2a')]+')','participationtypemask':_0x1f63e5[_0x3b66('0x52')]===_0x3b66('0x53')?0x2:0x1},{'partyid_contact@odata.bind':_0x3b66('0x50')+_0x1f63e5[_0x3b66('0x36')]+')','participationtypemask':_0x1f63e5[_0x3b66('0x52')]===_0x3b66('0x53')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x3b66('0x31')+_0x1f63e5['userId']+')','participationtypemask':_0x1f63e5[_0x3b66('0x52')]===_0x3b66('0x53')?0x2:0x1}];_0x3afb89={'method':_0x3b66('0x11'),'uri':_0x89925+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x3b66('0x4d')](_0x2f718b[_0x3b66('0x4e')],_0x340449,'\x20'),'phonenumber':String(_0x340449[_0x3b66('0x2f')]),'description':intUtil['getString'](_0x2f718b['Descriptions'],_0x340449,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1f63e5[_0x3b66('0x36')]?_0x3b66('0x50')+_0x1f63e5['enduserId']+')':undefined,'ownerid@odata.bind':_0x3b66('0x31')+_0x1f63e5[_0x3b66('0x2a')]+')','directioncode':_0x1f63e5[_0x3b66('0x52')]===_0x3b66('0x53')?![]:!![],'phonecall_activity_parties':_0x391b0f},getCustomFields(_0x2f718b['Fields'],_0x340449,_0x2f718b[_0x3b66('0x49')])),'headers':{'Authorization':_0x3b66('0x1f')+_0x251c79,'OData-Version':_0x3b66('0x20')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3afb89);})[_0x3b66('0x1c')](function(_0x2a1805){var _0x3971e1=_0x2a1805[_0x3b66('0x33')][_0x3b66('0x34')];var _0x4e5469=_0x3971e1['substring'](_0x3971e1['lastIndexOf']('(')+0x1,_0x3971e1[_0x3b66('0x35')](')'));_0x1f63e5[_0x3b66('0x54')]=_0x4e5469;_0xfea402(_0x1f63e5);})[_0x3b66('0x17')](function(_0x2d7876){_0x520c7a(_0x2d7876[_0x3b66('0x1b')]);});});}function emit(_0x225314,_0xf8068f,_0xf7516a,_0x341064){var _0x54d5f1={'uri':util[_0x3b66('0x55')](_0x3b66('0x56'),_0x225314,_0xf7516a,_0x341064)};io['to'](util[_0x3b66('0x55')](_0x3b66('0x57'),_0xf8068f))[_0x3b66('0x58')](_0x3b66('0x59'),_0x54d5f1);}exports['cs']=function(_0x26b68a,_0xcf3277,_0x59a7bd,_0x58b8ea,_0x4464ca,_0x395049,_0x5e9b86,_0x1595d2){var _0x251fee={};_0x395049['remoteUri']=_0x395049['modernAuthentication']?intUtil[_0x3b66('0x5a')](_0x395049[_0x3b66('0xc')][_0x3b66('0xd')]):intUtil[_0x3b66('0x5a')](_0x395049['remoteUri']);_0x395049[_0x3b66('0x5b')]=intUtil['stripTrailingSlash'](_0x395049['serverUrl']);_0x251fee[_0x3b66('0x52')]=_0x1595d2===_0x3b66('0x53')||_0x1595d2===_0x3b66('0x5c')?'queue':_0x3b66('0x2d');var _0x373a56=_0x395049[_0x3b66('0x5d')]?util[_0x3b66('0x55')]('%s/api/data/v9.0/',_0x395049[_0x3b66('0xc')][_0x3b66('0xd')]):util[_0x3b66('0x55')](_0x3b66('0x5e'),_0x395049[_0x3b66('0x13')]);var _0x50c633=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x395049[_0x3b66('0xe')]);var _0x41f01e=util[_0x3b66('0x55')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395049[_0x3b66('0x5b')],_0xcf3277[_0x3b66('0x5f')],md5(_0xcf3277['uniqueid']));if(_0x4464ca&&_0x4464ca['monitor_format']){logger[_0x3b66('0x2b')](_0x3b66('0x60'),_0x3b66('0x61'));_0xcf3277['recordingURL']=_0x41f01e;}else if(_0x5e9b86&&_0x5e9b86[_0x3b66('0x62')]&&_0x5e9b86[_0x3b66('0x62')]!==_0x3b66('0x63')){logger['info'](_0x3b66('0x64'),_0x3b66('0x61'));_0xcf3277[_0x3b66('0x65')]=_0x41f01e;}else{_0xcf3277[_0x3b66('0x65')]='';}return getUser(_0x251fee,_0x395049,_0x58b8ea,_0x50c633,_0x373a56,_0x1595d2)['then'](function(_0x496bd7){logger['info']('['+_0x1595d2[_0x3b66('0x19')]()+_0x3b66('0x66'),_0x496bd7['userId']);logger[_0x3b66('0x2b')]('['+_0x1595d2[_0x3b66('0x19')]()+']\x20The\x20User\x20email\x20is:',_0x496bd7['userEmail']);return getEndUser(_0x496bd7,_0x395049,_0x50c633,_0x373a56,_0xcf3277,_0x1595d2,_0x59a7bd['moduleCreate'],_0x59a7bd['additionalSearchContact']);})[_0x3b66('0x1c')](function(_0x738307){logger[_0x3b66('0x2b')]('['+_0x1595d2[_0x3b66('0x19')]()+_0x3b66('0x67'),_0x738307[_0x3b66('0x36')]);logger[_0x3b66('0x2b')]('['+_0x1595d2[_0x3b66('0x19')]()+_0x3b66('0x68'),_0xcf3277['calleridnum']);return getTicket(_0x738307,_0x395049,_0x50c633,_0x373a56,_0xcf3277,_0x59a7bd,_0x1595d2);})[_0x3b66('0x1c')](function(_0x23ed1c){logger['info'](util[_0x3b66('0x55')]('['+_0x1595d2[_0x3b66('0x19')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x59a7bd[_0x3b66('0x49')],_0x23ed1c[_0x3b66('0x54')]));logger[_0x3b66('0x2b')](util['format']('['+_0x1595d2[_0x3b66('0x19')]()+_0x3b66('0x69'),_0x1595d2));if(_0x1595d2!==_0x3b66('0x5c')&&_0x59a7bd[_0x3b66('0x6a')]){logger['info']('['+_0x1595d2[_0x3b66('0x19')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x395049[_0x3b66('0x13')],_0x58b8ea['name'],_0x59a7bd[_0x3b66('0x49')],_0x23ed1c['ticketId']);}})[_0x3b66('0x17')](function(_0x1940c8){logger[_0x3b66('0x18')]('['+_0x1595d2['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x1940c8[_0x3b66('0x1b')]);console[_0x3b66('0x18')](_0x3b66('0x6b'),_0x1940c8);});}; \ 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 bf4e66d..9d60729 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 _0x5e56=['format','%s/api/v2/agents','remoteUri','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','apiKey','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','type','nameField','toLowerCase','content','toString','picklist','idField','customField','variable','push','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','toUpperCase','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','then','Ticket\x20created!','validateEmail'];(function(_0x5be878,_0x245c4e){var _0xfa27f4=function(_0x10c7b0){while(--_0x10c7b0){_0x5be878['push'](_0x5be878['shift']());}};_0xfa27f4(++_0x245c4e);}(_0x5e56,0x9e));var _0x65e5=function(_0x1095d3,_0x287bef){_0x1095d3=_0x1095d3-0x0;var _0x26f681=_0x5e56[_0x1095d3];return _0x26f681;};'use strict';var _=require(_0x65e5('0x0'));var rp=require(_0x65e5('0x1'));var md5=require(_0x65e5('0x2'));var util=require(_0x65e5('0x3'));var Redis=require(_0x65e5('0x4'));var intUtil=require(_0x65e5('0x5'));var config=require(_0x65e5('0x6'));var logger=require('../../../../config/logger')(_0x65e5('0x7'));config['redis']=_['defaults'](config[_0x65e5('0x8')],{'host':_0x65e5('0x9'),'port':0x18eb});var io=require(_0x65e5('0xa'))(new Redis(config[_0x65e5('0x8')]));var headers={'Content-Type':_0x65e5('0xb'),'Accept':_0x65e5('0xb')};function emit(_0x51bac0,_0x1257cf,_0x1e8eed){io['to'](_0x51bac0)[_0x65e5('0xc')](_0x1257cf,_0x1e8eed);}function getTicket(_0x43fe84,_0x40d2fe,_0x501ea4,_0x4ae2cc,_0x1a7ed0){logger[_0x65e5('0xd')]('Creating\x20new\x20ticket...');var _0x260fed=_[_0x65e5('0xe')]({'responder_id':_0x40d2fe['id'],'requester_id':_0x501ea4['id'],'name':util['format'](_0x65e5('0xf'),_0x1a7ed0[_0x65e5('0x10')]),'phone':_0x1a7ed0[_0x65e5('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x65e5('0x12')](_0x4ae2cc[_0x65e5('0x13')],_0x1a7ed0,'\x20'),'description':intUtil[_0x65e5('0x12')](_0x4ae2cc[_0x65e5('0x14')],_0x1a7ed0,_0x65e5('0x15')),'tags':getTags(_0x4ae2cc[_0x65e5('0x16')],_0x65e5('0x17'))},getCustomFields(_0x4ae2cc[_0x65e5('0x18')],_0x1a7ed0));_0x260fed[_0x65e5('0x19')]=_['mapValues'](_[_0x65e5('0x1a')](_0x260fed[_0x65e5('0x19')],'id'),_0x65e5('0x1b'));return request({'uri':util['format'](_0x65e5('0x1c'),_0x43fe84['remoteUri']),'method':'POST','body':_0x260fed})[_0x65e5('0x1d')](function(_0x4ebfc8){logger[_0x65e5('0xd')](_0x65e5('0x1e'));return _0x4ebfc8;});}function getUser(_0xcee22d,_0x52f589){if(intUtil[_0x65e5('0x1f')](_0x52f589)){return request({'uri':util[_0x65e5('0x20')](_0x65e5('0x21'),_0xcee22d[_0x65e5('0x22')]),'qs':{'email':_0x52f589}})[_0x65e5('0x1d')](function(_0x25fbdf){if(_0x25fbdf['length']){logger[_0x65e5('0xd')](_0x65e5('0x23'));return _[_0x65e5('0x24')](_0x25fbdf,function(_0x4cf58d){return _0x4cf58d[_0x65e5('0x25')][_0x65e5('0x26')]===_0x52f589;});}else{logger['info'](_0x65e5('0x27'));return request({'uri':util[_0x65e5('0x20')]('%s/api/v2/agents/me',_0xcee22d[_0x65e5('0x22')])})[_0x65e5('0x1d')](function(_0x147d61){logger['info'](_0x65e5('0x28'));return _0x147d61;});}});}else{logger[_0x65e5('0xd')](_0x65e5('0x29'));return request({'uri':util[_0x65e5('0x20')](_0x65e5('0x2a'),_0xcee22d[_0x65e5('0x22')])})['then'](function(_0x403add){logger['info']('Admin\x20account\x20selected.');return _0x403add;});}}function getEndUser(_0x256d82,_0x5cc699,_0x447bcc){logger[_0x65e5('0xd')](_0x65e5('0x2b'),_0x447bcc);return request({'uri':util[_0x65e5('0x20')](_0x65e5('0x2c'),_0x256d82[_0x65e5('0x22')]),'qs':{'phone':_0x447bcc}})[_0x65e5('0x1d')](function(_0x14281d){if(_0x14281d[_0x65e5('0x2d')]){logger[_0x65e5('0xd')]('Enduser\x20found!');return _[_0x65e5('0x24')](_0x14281d,{'phone':_0x447bcc});}else{logger[_0x65e5('0xd')](_0x65e5('0x2e'));return request({'uri':util[_0x65e5('0x20')](_0x65e5('0x2c'),_0x256d82[_0x65e5('0x22')]),'method':_0x65e5('0x2f'),'body':{'name':_0x5cc699,'phone':_0x447bcc}})[_0x65e5('0x1d')](function(_0x3c3a40){logger[_0x65e5('0xd')](_0x65e5('0x30'));return _0x3c3a40;});}});}function getAuth(_0xa30fb6){return util['format']('Basic\x20%s',new Buffer(_0xa30fb6[_0x65e5('0x31')]+':X')['toString']('base64'));}function request(_0x23c444){logger['debug'](_0x65e5('0x32'),JSON[_0x65e5('0x33')](_0x23c444));return rp(_[_0x65e5('0x34')](_0x23c444,{'method':_0x65e5('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x2158fa,_0x337dd2){var _0x5e1362=[];if(_0x2158fa&&_0x2158fa[_0x65e5('0x2d')]>0x0){_0x5e1362=_[_0x65e5('0x36')](_0x2158fa,_0x337dd2);}return _0x5e1362;}function getCustomFields(_0x4b26fc,_0x333d8f){var _0x4d93dc=[];var _0x428dbb={'custom_fields':[]};if(_0x4b26fc[_0x65e5('0x2d')]>0x0){_[_0x65e5('0x37')](_0x4b26fc,function(_0x2be877){if(_[_0x65e5('0x38')]([_0x65e5('0x39'),'picklist'],_0x2be877[_0x65e5('0x3a')])&&_0x2be877[_0x65e5('0x3b')]&&!_0x2be877['customField']){_0x428dbb[_0x2be877['nameField'][_0x65e5('0x3c')]()]=_0x2be877[_0x65e5('0x3d')][_0x65e5('0x3e')]();}else if(_['includes']([_0x65e5('0x39'),_0x65e5('0x3f')],_0x2be877[_0x65e5('0x3a')])&&_0x2be877[_0x65e5('0x40')]&&_0x2be877[_0x65e5('0x41')]){_0x428dbb[_0x65e5('0x19')]['push']({'id':_0x2be877[_0x65e5('0x40')],'value':_0x2be877[_0x65e5('0x3d')][_0x65e5('0x3e')]()});}else if(_0x2be877[_0x65e5('0x3a')]===_0x65e5('0x42')&&_0x2be877['variableName']&&_0x2be877[_0x65e5('0x40')]&&_0x2be877[_0x65e5('0x41')]){_0x333d8f[_0x2be877['variableName']]&&_0x428dbb[_0x65e5('0x19')][_0x65e5('0x43')]({'id':_0x2be877[_0x65e5('0x40')],'value':_0x333d8f[_0x2be877[_0x65e5('0x44')]][_0x65e5('0x3e')]()});}else if(_0x2be877[_0x65e5('0x3a')]===_0x65e5('0x45')&&_0x2be877[_0x65e5('0x46')]&&_0x2be877['Variable'][_0x65e5('0x17')]&&_0x2be877[_0x65e5('0x40')]&&_0x2be877[_0x65e5('0x41')]){_0x333d8f[_0x2be877[_0x65e5('0x46')][_0x65e5('0x17')][_0x65e5('0x3c')]()]&&_0x428dbb[_0x65e5('0x19')][_0x65e5('0x43')]({'id':_0x2be877[_0x65e5('0x40')],'value':_0x333d8f[_0x2be877[_0x65e5('0x46')]['name'][_0x65e5('0x3c')]()][_0x65e5('0x3e')]()});}});}return _0x428dbb;}exports[_0x65e5('0x47')]=function(_0x12716f,_0x56d4ae,_0x49ce82,_0x26c763,_0x295f5f,_0x5e88a9){var _0x2629f8,_0x2a968f;_0x5e88a9[_0x65e5('0x22')]=intUtil['stripTrailingSlash'](_0x5e88a9[_0x65e5('0x22')]);_0x5e88a9[_0x65e5('0x48')]=intUtil[_0x65e5('0x49')](_0x5e88a9[_0x65e5('0x48')]);if(_0x295f5f&&_0x295f5f[_0x65e5('0x4a')]){logger[_0x65e5('0xd')](_0x65e5('0x4b'),_0x65e5('0x4c'));_0x56d4ae['recordingURL']=util[_0x65e5('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5e88a9[_0x65e5('0x48')],_0x56d4ae['uniqueid'],md5(_0x56d4ae[_0x65e5('0x4d')]));}else{_0x56d4ae[_0x65e5('0x4e')]='';}headers[_0x65e5('0x4f')]=getAuth(_0x5e88a9);return getUser(_0x5e88a9,_0x26c763[_0x65e5('0x26')])['then'](function(_0x9f60b4){_0x2629f8=_0x9f60b4;logger['info']('The\x20User\x20ID\x20is:',_0x2629f8['id']);return getEndUser(_0x5e88a9,_0x56d4ae[_0x65e5('0x10')],_0x56d4ae[_0x65e5('0x11')]);})[_0x65e5('0x1d')](function(_0x131174){_0x2a968f=_0x131174;logger[_0x65e5('0xd')](_0x65e5('0x50'),_0x2a968f['id']);return getTicket(_0x5e88a9,_0x2629f8,_0x2a968f,_0x49ce82,_0x56d4ae);})[_0x65e5('0x1d')](function(_0x3c5631){if(_0x3c5631&&_0x3c5631['id']){logger[_0x65e5('0xd')](_0x65e5('0x1e'));logger['info'](_0x65e5('0x51'),_0x3c5631['id']);logger['info'](_0x65e5('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x65e5('0x52'),_0x26c763['name']),_0x65e5('0x53'),{'uri':util['format'](_0x65e5('0x54'),_0x5e88a9['remoteUri'],_0x3c5631['id'])});}})['catch'](function(_0x5ae01f){logger[_0x65e5('0x55')]('[QUEUE]',JSON['stringify'](_0x5ae01f));});};exports[_0x65e5('0x56')]=function(_0x35e6c3,_0x2f6d41,_0x89cf8a,_0x42d991,_0x3e9834,_0xb278e4,_0x62c3d5){var _0x28a249,_0x497bde;_0xb278e4[_0x65e5('0x22')]=intUtil[_0x65e5('0x49')](_0xb278e4[_0x65e5('0x22')]);_0xb278e4[_0x65e5('0x48')]=intUtil['stripTrailingSlash'](_0xb278e4['serverUrl']);if(_0x62c3d5&&_0x62c3d5[_0x65e5('0x57')]&&_0x62c3d5[_0x65e5('0x57')]!=='none'){logger[_0x65e5('0xd')](_0x65e5('0x58'),'Recording\x20is\x20enabled!');_0x2f6d41[_0x65e5('0x4e')]=util['format'](_0x65e5('0x59'),_0xb278e4['serverUrl'],_0x2f6d41['uniqueid'],md5(_0x2f6d41[_0x65e5('0x4d')]));}headers['Authorization']=getAuth(_0xb278e4);return getUser(_0xb278e4,_0x42d991[_0x65e5('0x26')])[_0x65e5('0x1d')](function(_0x2ab4ce){_0x28a249=_0x2ab4ce;logger['info'](_0x65e5('0x5a'),_0x28a249['id']);return getEndUser(_0xb278e4,_0x2f6d41['destcalleridname'],_0x2f6d41['destcalleridnum']);})[_0x65e5('0x1d')](function(_0x200a4a){_0x497bde=_0x200a4a;logger[_0x65e5('0xd')](_0x65e5('0x50'),_0x497bde['id']);return getTicket(_0xb278e4,_0x28a249,_0x497bde,_0x89cf8a,_0x2f6d41);})[_0x65e5('0x1d')](function(_0x5637d2){if(_0x5637d2&&_0x5637d2['id']){logger['info'](_0x65e5('0x1e'));logger[_0x65e5('0xd')]('The\x20Ticket\x20ID\x20is:',_0x5637d2['id']);logger[_0x65e5('0xd')](_0x65e5('0x58'),_0x65e5('0x5b'));emit(util[_0x65e5('0x20')](_0x65e5('0x52'),_0x42d991['name']),_0x65e5('0x53'),{'uri':util[_0x65e5('0x20')](_0x65e5('0x54'),_0xb278e4[_0x65e5('0x22')],_0x5637d2['id'])});}})[_0x65e5('0x5c')](function(_0x13e764){logger[_0x65e5('0x55')](_0x65e5('0x58'),JSON[_0x65e5('0x33')](_0x13e764));});};exports['unmanaged']=function(_0x23cf2b,_0x2dc0f8,_0x4cd7aa,_0xa05852,_0x4031be,_0x10c2a9){var _0x57f020,_0x48dab4;_0x10c2a9['remoteUri']=intUtil[_0x65e5('0x49')](_0x10c2a9[_0x65e5('0x22')]);_0x10c2a9[_0x65e5('0x48')]=intUtil[_0x65e5('0x49')](_0x10c2a9[_0x65e5('0x48')]);if(_0x4031be&&_0x4031be[_0x65e5('0x4a')]){logger[_0x65e5('0xd')]('['+_0x2dc0f8['lastevent'][_0x65e5('0x5d')]()+']','Recording\x20is\x20enabled!');_0x2dc0f8[_0x65e5('0x4e')]=util[_0x65e5('0x20')](_0x65e5('0x59'),_0x10c2a9[_0x65e5('0x48')],_0x2dc0f8[_0x65e5('0x4d')],md5(_0x2dc0f8[_0x65e5('0x4d')]));}else{_0x2dc0f8[_0x65e5('0x4e')]='';}headers[_0x65e5('0x4f')]=getAuth(_0x10c2a9);return getUser(_0x10c2a9,'')['then'](function(_0x378ebc){_0x57f020=_0x378ebc;logger['info'](_0x65e5('0x5a'),_0x57f020['id']);return getEndUser(_0x10c2a9,_0x2dc0f8['calleridname'],_0x2dc0f8[_0x65e5('0x11')]);})[_0x65e5('0x1d')](function(_0x24aa26){_0x48dab4=_0x24aa26;logger[_0x65e5('0xd')]('The\x20Enduser\x20ID\x20is:',_0x48dab4['id']);return getTicket(_0x10c2a9,_0x57f020,_0x48dab4,_0x4cd7aa,_0x2dc0f8);})['then'](function(_0x5a9908){if(_0x5a9908){logger[_0x65e5('0xd')](_0x65e5('0x1e'));logger[_0x65e5('0xd')](_0x65e5('0x51'),_0x5a9908['id']);}})[_0x65e5('0x5c')](function(_0x58eb3c){logger['error']('['+_0x2dc0f8[_0x65e5('0x5e')][_0x65e5('0x5d')]()+']',JSON[_0x65e5('0x33')](_0x58eb3c));});}; \ No newline at end of file +var _0xb202=['Tags','name','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','length','Agent\x20found!','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20created.','apiKey','base64','debug','[HTTP]','stringify','GET','forEach','includes','string','nameField','customField','toLowerCase','content','toString','picklist','type','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','error','outbound','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','trigger:browser:url','unmanaged','toUpperCase','lastevent','lodash','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','defaults','redis','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','getString','
'];(function(_0x4f4de2,_0x257b5d){var _0x1cbf3a=function(_0x68163){while(--_0x68163){_0x4f4de2['push'](_0x4f4de2['shift']());}};_0x1cbf3a(++_0x257b5d);}(_0xb202,0x9f));var _0x2b20=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xb202[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x2b20('0x0'));var rp=require(_0x2b20('0x1'));var md5=require('md5');var util=require(_0x2b20('0x2'));var Redis=require(_0x2b20('0x3'));var intUtil=require('./util');var config=require(_0x2b20('0x4'));var logger=require(_0x2b20('0x5'))('freshdesk');config['redis']=_[_0x2b20('0x6')](config[_0x2b20('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2b20('0x7')]));var headers={'Content-Type':_0x2b20('0x8'),'Accept':_0x2b20('0x8')};function emit(_0x17d5c0,_0x3daf7c,_0x2525d4){io['to'](_0x17d5c0)[_0x2b20('0x9')](_0x3daf7c,_0x2525d4);}function getTicket(_0x24cecf,_0x105cc1,_0x67f693,_0x5be928,_0x39bfbd){logger[_0x2b20('0xa')]('Creating\x20new\x20ticket...');var _0x15ded7=_[_0x2b20('0xb')]({'responder_id':_0x105cc1['id'],'requester_id':_0x67f693['id'],'name':util[_0x2b20('0xc')](_0x2b20('0xd'),_0x39bfbd[_0x2b20('0xe')]),'phone':_0x39bfbd['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x5be928['Subjects'],_0x39bfbd,'\x20'),'description':intUtil[_0x2b20('0xf')](_0x5be928['Descriptions'],_0x39bfbd,_0x2b20('0x10')),'tags':getTags(_0x5be928[_0x2b20('0x11')],_0x2b20('0x12'))},getCustomFields(_0x5be928['Fields'],_0x39bfbd));_0x15ded7[_0x2b20('0x13')]=_[_0x2b20('0x14')](_[_0x2b20('0x15')](_0x15ded7[_0x2b20('0x13')],'id'),_0x2b20('0x16'));return request({'uri':util['format'](_0x2b20('0x17'),_0x24cecf[_0x2b20('0x18')]),'method':_0x2b20('0x19'),'body':_0x15ded7})[_0x2b20('0x1a')](function(_0x2563da){logger[_0x2b20('0xa')](_0x2b20('0x1b'));return _0x2563da;});}function getUser(_0x1dee62,_0x1080b0){if(intUtil['validateEmail'](_0x1080b0)){return request({'uri':util[_0x2b20('0xc')]('%s/api/v2/agents',_0x1dee62['remoteUri']),'qs':{'email':_0x1080b0}})['then'](function(_0x25ba5c){if(_0x25ba5c[_0x2b20('0x1c')]){logger['info'](_0x2b20('0x1d'));return _['find'](_0x25ba5c,function(_0x132e75){return _0x132e75['contact'][_0x2b20('0x1e')]===_0x1080b0;});}else{logger['info'](_0x2b20('0x1f'));return request({'uri':util['format'](_0x2b20('0x20'),_0x1dee62[_0x2b20('0x18')])})['then'](function(_0x5171d4){logger[_0x2b20('0xa')](_0x2b20('0x21'));return _0x5171d4;});}});}else{logger[_0x2b20('0xa')](_0x2b20('0x22'));return request({'uri':util[_0x2b20('0xc')]('%s/api/v2/agents/me',_0x1dee62[_0x2b20('0x18')])})[_0x2b20('0x1a')](function(_0x3a54a4){logger['info'](_0x2b20('0x21'));return _0x3a54a4;});}}function getEndUser(_0x36f7b1,_0x478e8a,_0x24ff1a){logger['info'](_0x2b20('0x23'),_0x24ff1a);return request({'uri':util[_0x2b20('0xc')](_0x2b20('0x24'),_0x36f7b1[_0x2b20('0x18')]),'qs':{'phone':_0x24ff1a}})[_0x2b20('0x1a')](function(_0x3719a1){if(_0x3719a1[_0x2b20('0x1c')]){logger[_0x2b20('0xa')](_0x2b20('0x25'));return _[_0x2b20('0x26')](_0x3719a1,{'phone':_0x24ff1a});}else{logger[_0x2b20('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x2b20('0xc')]('%s/api/v2/contacts',_0x36f7b1[_0x2b20('0x18')]),'method':_0x2b20('0x19'),'body':{'name':_0x478e8a,'phone':_0x24ff1a}})[_0x2b20('0x1a')](function(_0x33c5f0){logger[_0x2b20('0xa')](_0x2b20('0x27'));return _0x33c5f0;});}});}function getAuth(_0x5d6ff3){return util[_0x2b20('0xc')]('Basic\x20%s',new Buffer(_0x5d6ff3[_0x2b20('0x28')]+':X')['toString'](_0x2b20('0x29')));}function request(_0x279388){logger[_0x2b20('0x2a')](_0x2b20('0x2b'),JSON[_0x2b20('0x2c')](_0x279388));return rp(_[_0x2b20('0x6')](_0x279388,{'method':_0x2b20('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x4ee8bb,_0x3b6476){var _0x42c0ec=[];if(_0x4ee8bb&&_0x4ee8bb['length']>0x0){_0x42c0ec=_['map'](_0x4ee8bb,_0x3b6476);}return _0x42c0ec;}function getCustomFields(_0x27c43d,_0x4bbf6b){var _0x37f60f=[];var _0x2443a8={'custom_fields':[]};if(_0x27c43d[_0x2b20('0x1c')]>0x0){_[_0x2b20('0x2e')](_0x27c43d,function(_0x1321d4){if(_[_0x2b20('0x2f')]([_0x2b20('0x30'),'picklist'],_0x1321d4['type'])&&_0x1321d4[_0x2b20('0x31')]&&!_0x1321d4[_0x2b20('0x32')]){_0x2443a8[_0x1321d4[_0x2b20('0x31')][_0x2b20('0x33')]()]=_0x1321d4[_0x2b20('0x34')][_0x2b20('0x35')]();}else if(_[_0x2b20('0x2f')](['string',_0x2b20('0x36')],_0x1321d4[_0x2b20('0x37')])&&_0x1321d4[_0x2b20('0x38')]&&_0x1321d4[_0x2b20('0x32')]){_0x2443a8[_0x2b20('0x13')][_0x2b20('0x39')]({'id':_0x1321d4[_0x2b20('0x38')],'value':_0x1321d4['content']['toString']()});}else if(_0x1321d4[_0x2b20('0x37')]===_0x2b20('0x3a')&&_0x1321d4[_0x2b20('0x3b')]&&_0x1321d4[_0x2b20('0x38')]&&_0x1321d4['customField']){_0x4bbf6b[_0x1321d4[_0x2b20('0x3b')]]&&_0x2443a8[_0x2b20('0x13')][_0x2b20('0x39')]({'id':_0x1321d4[_0x2b20('0x38')],'value':_0x4bbf6b[_0x1321d4[_0x2b20('0x3b')]][_0x2b20('0x35')]()});}else if(_0x1321d4[_0x2b20('0x37')]===_0x2b20('0x3c')&&_0x1321d4[_0x2b20('0x3d')]&&_0x1321d4[_0x2b20('0x3d')][_0x2b20('0x12')]&&_0x1321d4[_0x2b20('0x38')]&&_0x1321d4['customField']){_0x4bbf6b[_0x1321d4[_0x2b20('0x3d')][_0x2b20('0x12')][_0x2b20('0x33')]()]&&_0x2443a8[_0x2b20('0x13')][_0x2b20('0x39')]({'id':_0x1321d4[_0x2b20('0x38')],'value':_0x4bbf6b[_0x1321d4[_0x2b20('0x3d')]['name'][_0x2b20('0x33')]()]['toString']()});}});}return _0x2443a8;}exports[_0x2b20('0x3e')]=function(_0x457cd6,_0x27a882,_0x3ed855,_0x5e054b,_0x47fb11,_0x22e04e){var _0x3080f5,_0x55b2fc;_0x22e04e[_0x2b20('0x18')]=intUtil[_0x2b20('0x3f')](_0x22e04e[_0x2b20('0x18')]);_0x22e04e[_0x2b20('0x40')]=intUtil['stripTrailingSlash'](_0x22e04e[_0x2b20('0x40')]);if(_0x47fb11&&_0x47fb11[_0x2b20('0x41')]){logger[_0x2b20('0xa')]('[QUEUE]',_0x2b20('0x42'));_0x27a882[_0x2b20('0x43')]=util[_0x2b20('0xc')](_0x2b20('0x44'),_0x22e04e[_0x2b20('0x40')],_0x27a882['uniqueid'],md5(_0x27a882[_0x2b20('0x45')]));}else{_0x27a882[_0x2b20('0x43')]='';}headers[_0x2b20('0x46')]=getAuth(_0x22e04e);return getUser(_0x22e04e,_0x5e054b[_0x2b20('0x1e')])[_0x2b20('0x1a')](function(_0x3d5cde){_0x3080f5=_0x3d5cde;logger['info']('The\x20User\x20ID\x20is:',_0x3080f5['id']);return getEndUser(_0x22e04e,_0x27a882[_0x2b20('0xe')],_0x27a882[_0x2b20('0x47')]);})[_0x2b20('0x1a')](function(_0x5925c7){_0x55b2fc=_0x5925c7;logger[_0x2b20('0xa')](_0x2b20('0x48'),_0x55b2fc['id']);return getTicket(_0x22e04e,_0x3080f5,_0x55b2fc,_0x3ed855,_0x27a882);})[_0x2b20('0x1a')](function(_0x56334b){if(_0x56334b&&_0x56334b['id']){logger[_0x2b20('0xa')](_0x2b20('0x1b'));logger['info'](_0x2b20('0x49'),_0x56334b['id']);logger['info']('[QUEUE]',_0x2b20('0x4a'));emit(util[_0x2b20('0xc')](_0x2b20('0x4b'),_0x5e054b[_0x2b20('0x12')]),'trigger:browser:url',{'uri':util[_0x2b20('0xc')](_0x2b20('0x4c'),_0x22e04e[_0x2b20('0x18')],_0x56334b['id'])});}})[_0x2b20('0x4d')](function(_0x168c93){logger[_0x2b20('0x4e')]('[QUEUE]',JSON[_0x2b20('0x2c')](_0x168c93));});};exports[_0x2b20('0x4f')]=function(_0x42062e,_0x41fc18,_0x4fcdca,_0x4acf7a,_0x340322,_0x5b1a57,_0x2d9655){var _0x328d08,_0x422b73;_0x5b1a57[_0x2b20('0x18')]=intUtil['stripTrailingSlash'](_0x5b1a57[_0x2b20('0x18')]);_0x5b1a57[_0x2b20('0x40')]=intUtil[_0x2b20('0x3f')](_0x5b1a57['serverUrl']);if(_0x2d9655&&_0x2d9655['recordingFormat']&&_0x2d9655['recordingFormat']!==_0x2b20('0x50')){logger[_0x2b20('0xa')](_0x2b20('0x51'),_0x2b20('0x42'));_0x41fc18[_0x2b20('0x43')]=util[_0x2b20('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b1a57[_0x2b20('0x40')],_0x41fc18[_0x2b20('0x45')],md5(_0x41fc18[_0x2b20('0x45')]));}headers['Authorization']=getAuth(_0x5b1a57);return getUser(_0x5b1a57,_0x4acf7a[_0x2b20('0x1e')])['then'](function(_0x3a37be){_0x328d08=_0x3a37be;logger['info'](_0x2b20('0x52'),_0x328d08['id']);return getEndUser(_0x5b1a57,_0x41fc18['destcalleridname'],_0x41fc18[_0x2b20('0x53')]);})[_0x2b20('0x1a')](function(_0x4d3919){_0x422b73=_0x4d3919;logger[_0x2b20('0xa')](_0x2b20('0x48'),_0x422b73['id']);return getTicket(_0x5b1a57,_0x328d08,_0x422b73,_0x4fcdca,_0x41fc18);})[_0x2b20('0x1a')](function(_0x1277fa){if(_0x1277fa&&_0x1277fa['id']){logger[_0x2b20('0xa')](_0x2b20('0x1b'));logger[_0x2b20('0xa')](_0x2b20('0x49'),_0x1277fa['id']);logger['info'](_0x2b20('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2b20('0xc')](_0x2b20('0x4b'),_0x4acf7a[_0x2b20('0x12')]),_0x2b20('0x54'),{'uri':util[_0x2b20('0xc')]('%s/helpdesk/tickets/%d',_0x5b1a57['remoteUri'],_0x1277fa['id'])});}})[_0x2b20('0x4d')](function(_0x16e8ea){logger[_0x2b20('0x4e')]('[OUTBOUND]',JSON[_0x2b20('0x2c')](_0x16e8ea));});};exports[_0x2b20('0x55')]=function(_0x21dfb4,_0x1e18c9,_0x5575c0,_0x5d0b42,_0x6ae0c5,_0x54365f){var _0x1dad04,_0x5cd7af;_0x54365f['remoteUri']=intUtil['stripTrailingSlash'](_0x54365f[_0x2b20('0x18')]);_0x54365f[_0x2b20('0x40')]=intUtil[_0x2b20('0x3f')](_0x54365f[_0x2b20('0x40')]);if(_0x6ae0c5&&_0x6ae0c5[_0x2b20('0x41')]){logger['info']('['+_0x1e18c9['lastevent'][_0x2b20('0x56')]()+']',_0x2b20('0x42'));_0x1e18c9['recordingURL']=util[_0x2b20('0xc')](_0x2b20('0x44'),_0x54365f['serverUrl'],_0x1e18c9['uniqueid'],md5(_0x1e18c9[_0x2b20('0x45')]));}else{_0x1e18c9[_0x2b20('0x43')]='';}headers['Authorization']=getAuth(_0x54365f);return getUser(_0x54365f,'')[_0x2b20('0x1a')](function(_0x23d08b){_0x1dad04=_0x23d08b;logger[_0x2b20('0xa')](_0x2b20('0x52'),_0x1dad04['id']);return getEndUser(_0x54365f,_0x1e18c9[_0x2b20('0xe')],_0x1e18c9[_0x2b20('0x47')]);})[_0x2b20('0x1a')](function(_0x5a2958){_0x5cd7af=_0x5a2958;logger['info'](_0x2b20('0x48'),_0x5cd7af['id']);return getTicket(_0x54365f,_0x1dad04,_0x5cd7af,_0x5575c0,_0x1e18c9);})['then'](function(_0x18cc6e){if(_0x18cc6e){logger[_0x2b20('0xa')](_0x2b20('0x1b'));logger[_0x2b20('0xa')](_0x2b20('0x49'),_0x18cc6e['id']);}})[_0x2b20('0x4d')](function(_0x49b3ca){logger[_0x2b20('0x4e')]('['+_0x1e18c9[_0x2b20('0x57')]['toUpperCase']()+']',JSON[_0x2b20('0x2c')](_0x49b3ca));});}; \ 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 313a074..7d64b33 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 _0x5dd9=['Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','task','Task\x20created:','/contacts/','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','callDirection','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','ticketId','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','moment','bluebird','ioredis','./util','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','users','length','email','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','info','Getting\x20user\x20list','then','agentEmail','userEmail','userId','Admin\x20selected','adminEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId'];(function(_0x1c7586,_0x1d46bd){var _0x3bd9a1=function(_0x2f2d4d){while(--_0x2f2d4d){_0x1c7586['push'](_0x1c7586['shift']());}};_0x3bd9a1(++_0x1d46bd);}(_0x5dd9,0xbd));var _0x95dd=function(_0x1865f3,_0x5154be){_0x1865f3=_0x1865f3-0x0;var _0xb69290=_0x5dd9[_0x1865f3];return _0xb69290;};'use strict';var _=require(_0x95dd('0x0'));var rp=require(_0x95dd('0x1'));var md5=require(_0x95dd('0x2'));var util=require('util');var moment=require(_0x95dd('0x3'));var Promise=require(_0x95dd('0x4'));var Redis=require(_0x95dd('0x5'));var intUtil=require(_0x95dd('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x95dd('0x7'));config[_0x95dd('0x8')]=_['defaults'](config[_0x95dd('0x8')],{'host':_0x95dd('0x9'),'port':0x18eb});var io=require(_0x95dd('0xa'))(new Redis(config[_0x95dd('0x8')]));function getAdminId(_0x463517,_0x2b6f63,_0x1250d0,_0x45768b){return new Promise(function(_0x5d8295,_0x3fd77e){var _0x1a3ebe=![];var _0x3013a1={'method':_0x95dd('0xb'),'uri':_0x45768b+_0x95dd('0xc'),'json':!![]};_0x3013a1[_0x95dd('0xd')]=_0x1250d0;logger['info'](_0x95dd('0xe'));return rp(_0x3013a1)['then'](function(_0x3e5882){if(_0x3e5882){var _0x45f7cf=_0x3e5882[_0x95dd('0xf')];var _0x1f140f=null;for(_0x1f140f=0x0;_0x1f140f<_0x45f7cf[_0x95dd('0x10')];_0x1f140f++){if(_0x45f7cf[_0x1f140f][_0x95dd('0x11')]===_0x463517['adminEmail']){_0x463517[_0x95dd('0x12')]=_0x45f7cf[_0x1f140f]['id'];_0x1a3ebe=!![];}}if(_0x1a3ebe){logger['info']('Admin\x20found:',_0x463517['adminId']);_0x5d8295(_0x463517);}else{_0x3fd77e({'statusCode':0x194,'message':_0x95dd('0x13')});}}else{_0x3fd77e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x95dd('0x14')](function(_0x545e51){logger[_0x95dd('0x15')]('['+[_0x2b6f63[_0x95dd('0x16')]()]+']',_0x545e51[_0x95dd('0x17')]);_0x3fd77e(_0x545e51);});});}function getUser(_0x5b445e,_0x4a1175,_0x2e7cc3){return function(_0x2da855){return new Promise(function(_0x127f50,_0x2e0fcc){var _0x38720c={'method':_0x95dd('0xb'),'uri':_0x2e7cc3+_0x95dd('0xc'),'json':!![]};_0x38720c[_0x95dd('0xd')]=_0x4a1175;logger[_0x95dd('0x18')](_0x95dd('0x19'));return rp(_0x38720c)[_0x95dd('0x1a')](function(_0x14a8a1){if(_0x14a8a1){var _0x42bc94=_0x14a8a1[_0x95dd('0xf')];var _0x52fa91=![];var _0x495cbe=null;if(_0x2da855[_0x95dd('0x1b')]!==null){logger[_0x95dd('0x18')]('Getting\x20user\x20with\x20email',_0x2da855[_0x95dd('0x1b')]);_0x2da855[_0x95dd('0x1c')]=_0x2da855[_0x95dd('0x1b')];for(_0x495cbe=0x0;_0x495cbe<_0x42bc94['length'];_0x495cbe++){if(_0x42bc94[_0x495cbe][_0x95dd('0x11')]===_0x2da855[_0x95dd('0x1b')]){_0x52fa91=!![];_0x2da855[_0x95dd('0x1d')]=_0x42bc94[_0x495cbe]['id'];logger[_0x95dd('0x18')]('User\x20found:',_0x2da855[_0x95dd('0x1d')]);}}}if(!_0x52fa91){logger[_0x95dd('0x18')](_0x95dd('0x1e'));_0x2da855['userEmail']=_0x2da855[_0x95dd('0x1f')];_0x2da855[_0x95dd('0x1d')]=_0x2da855[_0x95dd('0x12')];_0x52fa91=!![];}if(_0x52fa91){_0x127f50(_0x2da855);}else{_0x2e0fcc({'statusCode':0x194,'message':_0x95dd('0x13')});}}else{_0x2e0fcc({'statusCode':0x194,'message':_0x95dd('0x13')});}})[_0x95dd('0x14')](function(_0x5488e7){logger[_0x95dd('0x15')]('['+[_0x5b445e[_0x95dd('0x16')]()]+']',_0x5488e7[_0x95dd('0x17')]);_0x2e0fcc(_0x5488e7);});});};}function searchContact(_0xfb9093,_0x46c31a,_0x55881e,_0x50eba0){return new Promise(function(_0x1d6621,_0xa9f417){var _0x44061f={'method':_0x95dd('0xb'),'headers':_0x46c31a,'uri':_0xfb9093+_0x95dd('0x20')+_0x50eba0+_0x95dd('0x21')+_0x55881e+_0x95dd('0x22'),'json':!![]};rp(_0x44061f)[_0x95dd('0x1a')](function(_0x5ca0bc){var _0x314e66=_[_0x95dd('0x23')](_0x5ca0bc['contacts'][_0x95dd('0x24')],[_0x55881e,_0x50eba0]);_0x1d6621(_0x314e66);})[_0x95dd('0x14')](function(_0x49179c){_0xa9f417(_0x49179c);});});}function getEndUser(_0x1394a1,_0x48035f,_0x571a41){return function(_0x4a5e8e){return new Promise(function(_0x4d503a,_0x4dd927){logger[_0x95dd('0x18')](util[_0x95dd('0x25')](_0x95dd('0x26'),_0x4a5e8e[_0x95dd('0x27')]));searchContact(_0x571a41,_0x48035f,_0x95dd('0x28'),_0x4a5e8e['contactNumber'])[_0x95dd('0x1a')](function(_0x36b5d1){if(_0x36b5d1){_0x4a5e8e[_0x95dd('0x29')]=_0x36b5d1['id'];logger[_0x95dd('0x18')](_0x95dd('0x2a'),_0x4a5e8e[_0x95dd('0x29')]);return _0x4d503a(_0x4a5e8e);}searchContact(_0x571a41,_0x48035f,_0x95dd('0x2b'),_0x4a5e8e['contactNumber'])[_0x95dd('0x1a')](function(_0x4cf59){if(_0x4cf59){_0x4a5e8e['endUserId']=_0x4cf59['id'];logger['info']('Contact\x20found\x20work_number:',_0x4a5e8e[_0x95dd('0x29')]);return _0x4d503a(_0x4a5e8e);}createEndUser(_0x4a5e8e,_0x1394a1,_0x48035f,_0x571a41)[_0x95dd('0x1a')](function(_0x4a3482){logger['info'](_0x95dd('0x2c'),_0x4a3482[_0x95dd('0x29')]);return _0x4d503a(_0x4a3482);});});})['catch'](function(_0x267a9b){_0x4dd927(_0x267a9b);});});};}function createEndUser(_0xab948f,_0x2d0cc6,_0x352880,_0x338dd3){return new Promise(function(_0x1b2c99,_0x4f5c89){var _0x275400=moment();var _0x4d0eca={'method':_0x95dd('0x2d'),'uri':_0x338dd3+_0x95dd('0x2e'),'body':{'contact':{'last_name':_0xab948f[_0x95dd('0x27')],'work_number':_0xab948f[_0x95dd('0x27')],'mobile_number':_0xab948f[_0x95dd('0x27')],'owner_id':_0xab948f['userId'],'created_at':_0x275400[_0x95dd('0x25')](_0x95dd('0x2f'))}},'json':!![]};_0x4d0eca[_0x95dd('0xd')]=_0x352880;logger[_0x95dd('0x18')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4d0eca)[_0x95dd('0x1a')](function(_0x242077){_0xab948f[_0x95dd('0x29')]=_0x242077['contact']['id'];_0x1b2c99(_0xab948f);})['catch'](function(_0xf57c39){logger[_0x95dd('0x15')]('['+[_0x2d0cc6[_0x95dd('0x16')]()]+']',_0xf57c39[_0x95dd('0x17')]);_0x4f5c89(_0xf57c39['message']);});});}function getTicket(_0x535de3,_0x1fe1b8,_0x19e181,_0x2f620b,_0x654cc8){return function(_0x2a2458){logger['info'](_0x95dd('0x30'));return new Promise(function(_0x1813d3,_0x5741d1){var _0x1604c0=moment();var _0x2d8aa1={'method':'POST','uri':_0x19e181+_0x95dd('0x31'),'body':{'title':intUtil[_0x95dd('0x32')](_0x2f620b['Subjects'],_0x654cc8,'\x20'),'description':intUtil['getString'](_0x2f620b[_0x95dd('0x33')],_0x654cc8,'\x0a'),'owner_id':_0x2a2458[_0x95dd('0x1d')],'creater_id':_0x2a2458[_0x95dd('0x12')],'targetable_id':_0x2a2458[_0x95dd('0x29')],'targetable_type':_0x95dd('0x34'),'created_at':_0x1604c0['format'](_0x95dd('0x2f')),'due_date':_0x1604c0['add'](0x1e,'m')[_0x95dd('0x25')](_0x95dd('0x2f'))},'json':!![]};_0x2d8aa1[_0x95dd('0xd')]=_0x1fe1b8;return rp(_0x2d8aa1)[_0x95dd('0x1a')](function(_0x3f8b9f){_0x2a2458['ticketId']=_0x3f8b9f[_0x95dd('0x35')]['id'];logger[_0x95dd('0x18')](_0x95dd('0x36'),_0x2a2458['ticketId']);_0x1813d3(_0x2a2458);})['catch'](function(_0x224b2e){logger['error']('['+[_0x535de3['toUpperCase']()]+']',_0x224b2e[_0x95dd('0x17')]);_0x5741d1(_0x224b2e[_0x95dd('0x17')]);});});};}function emit(_0x527b83,_0x5bfc4f,_0x36bc03){var _0x117b78={'uri':_0x527b83+_0x95dd('0x37')+_0x36bc03};io['to'](util[_0x95dd('0x25')]('user:%s',_0x5bfc4f))['emit'](_0x95dd('0x38'),_0x117b78);}exports['cs']=function(_0x16ded5,_0x8ea2f4,_0xfa9f1d,_0x327724,_0x4c7d48,_0x14d3cc,_0x56fb33,_0x37d212){var _0x43eec2={};var _0x8a834b={'Authorization':'Token\x20token='+_0x14d3cc[_0x95dd('0x39')]};_0x14d3cc[_0x95dd('0x3a')]=intUtil[_0x95dd('0x3b')](_0x14d3cc[_0x95dd('0x3a')]);_0x14d3cc['serverUrl']=intUtil[_0x95dd('0x3b')](_0x14d3cc[_0x95dd('0x3c')]);var _0x1c5ef6=_0x14d3cc[_0x95dd('0x3a')];_0x43eec2[_0x95dd('0x1f')]=_0x14d3cc[_0x95dd('0x3d')];_0x43eec2[_0x95dd('0x27')]=_0x37d212['toLowerCase']()===_0x95dd('0x3e')?_0x8ea2f4[_0x95dd('0x3f')]:_0x8ea2f4['calleridnum'];_0x43eec2[_0x95dd('0x40')]=_0x37d212==='queue'||_0x37d212===_0x95dd('0x41')?'queue':_0x95dd('0x3e');if(_0x327724){_0x43eec2[_0x95dd('0x1b')]=_0x327724[_0x95dd('0x11')];}var _0x93d893=util[_0x95dd('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x14d3cc[_0x95dd('0x3c')],_0x8ea2f4[_0x95dd('0x42')],md5(_0x8ea2f4[_0x95dd('0x42')]));if(_0x4c7d48&&_0x4c7d48[_0x95dd('0x43')]){logger[_0x95dd('0x18')](_0x95dd('0x44'),'Recording\x20is\x20enabled!');_0x8ea2f4['recordingURL']=_0x93d893;}else if(_0x56fb33&&_0x56fb33[_0x95dd('0x45')]&&_0x56fb33[_0x95dd('0x45')]!=='none'){logger[_0x95dd('0x18')](_0x95dd('0x46'),_0x95dd('0x47'));_0x8ea2f4[_0x95dd('0x48')]=_0x93d893;}else{_0x8ea2f4[_0x95dd('0x48')]='';}return getAdminId(_0x43eec2,_0x37d212,_0x8a834b,_0x1c5ef6)[_0x95dd('0x1a')](getUser(_0x37d212,_0x8a834b,_0x1c5ef6))[_0x95dd('0x1a')](getEndUser(_0x37d212,_0x8a834b,_0x1c5ef6))[_0x95dd('0x1a')](getTicket(_0x37d212,_0x8a834b,_0x1c5ef6,_0xfa9f1d,_0x8ea2f4))[_0x95dd('0x1a')](function(_0x5c0f33){logger[_0x95dd('0x18')](util[_0x95dd('0x25')](_0x95dd('0x49'),_0x5c0f33[_0x95dd('0x4a')]));if(_0x37d212!==_0x95dd('0x41')){logger[_0x95dd('0x18')]('['+[_0x37d212[_0x95dd('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x1c5ef6,_0x327724[_0x95dd('0x4b')],_0x5c0f33['endUserId']);}})[_0x95dd('0x14')](function(_0x151220){logger[_0x95dd('0x15')]('['+[_0x37d212['toUpperCase']()]+_0x95dd('0x4c'),util['inspect'](_0x151220,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4b04=['adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','message','Getting\x20user\x20list','then','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','catch','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','POST','/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','add','YYYY-MM-DDTHH:mm:ss','task','Task\x20created:','ticketId','error','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','destcalleridnum','calleridnum','callDirection','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','GET','/api/selector/owners','headers','info','length','email'];(function(_0x2eb3db,_0x4a32c0){var _0x358f33=function(_0x1d0588){while(--_0x1d0588){_0x2eb3db['push'](_0x2eb3db['shift']());}};_0x358f33(++_0x4a32c0);}(_0x4b04,0x13f));var _0x44b0=function(_0x17b43e,_0x47540b){_0x17b43e=_0x17b43e-0x0;var _0x2ea7b7=_0x4b04[_0x17b43e];return _0x2ea7b7;};'use strict';var _=require('lodash');var rp=require(_0x44b0('0x0'));var md5=require('md5');var util=require(_0x44b0('0x1'));var moment=require('moment');var Promise=require(_0x44b0('0x2'));var Redis=require(_0x44b0('0x3'));var intUtil=require(_0x44b0('0x4'));var config=require(_0x44b0('0x5'));var logger=require(_0x44b0('0x6'))(_0x44b0('0x7'));config['redis']=_[_0x44b0('0x8')](config[_0x44b0('0x9')],{'host':_0x44b0('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x44b0('0x9')]));function getAdminId(_0x3f062e,_0xfa650f,_0x9ae0db,_0x1b657e){return new Promise(function(_0x49b4be,_0x3203be){var _0x52a50a=![];var _0x37fe2f={'method':_0x44b0('0xb'),'uri':_0x1b657e+_0x44b0('0xc'),'json':!![]};_0x37fe2f[_0x44b0('0xd')]=_0x9ae0db;logger[_0x44b0('0xe')]('Getting\x20admin\x20information');return rp(_0x37fe2f)['then'](function(_0xdaa28e){if(_0xdaa28e){var _0x4ef649=_0xdaa28e['users'];var _0x496f80=null;for(_0x496f80=0x0;_0x496f80<_0x4ef649[_0x44b0('0xf')];_0x496f80++){if(_0x4ef649[_0x496f80][_0x44b0('0x10')]===_0x3f062e[_0x44b0('0x11')]){_0x3f062e[_0x44b0('0x12')]=_0x4ef649[_0x496f80]['id'];_0x52a50a=!![];}}if(_0x52a50a){logger[_0x44b0('0xe')](_0x44b0('0x13'),_0x3f062e[_0x44b0('0x12')]);_0x49b4be(_0x3f062e);}else{_0x3203be({'statusCode':0x194,'message':_0x44b0('0x14')});}}else{_0x3203be({'statusCode':0x194,'message':_0x44b0('0x14')});}})['catch'](function(_0x623658){logger['error']('['+[_0xfa650f[_0x44b0('0x15')]()]+']',_0x623658[_0x44b0('0x16')]);_0x3203be(_0x623658);});});}function getUser(_0x17f1ce,_0x43a867,_0x2b402e){return function(_0x2b3817){return new Promise(function(_0x14e568,_0x492845){var _0x40ed19={'method':_0x44b0('0xb'),'uri':_0x2b402e+'/api/selector/owners','json':!![]};_0x40ed19['headers']=_0x43a867;logger[_0x44b0('0xe')](_0x44b0('0x17'));return rp(_0x40ed19)[_0x44b0('0x18')](function(_0x13f342){if(_0x13f342){var _0x42ace3=_0x13f342[_0x44b0('0x19')];var _0x451550=![];var _0x36e358=null;if(_0x2b3817[_0x44b0('0x1a')]!==null){logger['info'](_0x44b0('0x1b'),_0x2b3817['agentEmail']);_0x2b3817[_0x44b0('0x1c')]=_0x2b3817[_0x44b0('0x1a')];for(_0x36e358=0x0;_0x36e358<_0x42ace3[_0x44b0('0xf')];_0x36e358++){if(_0x42ace3[_0x36e358][_0x44b0('0x10')]===_0x2b3817[_0x44b0('0x1a')]){_0x451550=!![];_0x2b3817[_0x44b0('0x1d')]=_0x42ace3[_0x36e358]['id'];logger[_0x44b0('0xe')](_0x44b0('0x1e'),_0x2b3817[_0x44b0('0x1d')]);}}}if(!_0x451550){logger['info'](_0x44b0('0x1f'));_0x2b3817[_0x44b0('0x1c')]=_0x2b3817[_0x44b0('0x11')];_0x2b3817[_0x44b0('0x1d')]=_0x2b3817[_0x44b0('0x12')];_0x451550=!![];}if(_0x451550){_0x14e568(_0x2b3817);}else{_0x492845({'statusCode':0x194,'message':_0x44b0('0x14')});}}else{_0x492845({'statusCode':0x194,'message':_0x44b0('0x14')});}})[_0x44b0('0x20')](function(_0x4b30e0){logger['error']('['+[_0x17f1ce[_0x44b0('0x15')]()]+']',_0x4b30e0[_0x44b0('0x16')]);_0x492845(_0x4b30e0);});});};}function searchContact(_0x19714e,_0xf53ebd,_0x28a51e,_0x1851c0){return new Promise(function(_0x573e37,_0x151c33){var _0x4c04c4={'method':_0x44b0('0xb'),'headers':_0xf53ebd,'uri':_0x19714e+'/api/lookup?q='+_0x1851c0+_0x44b0('0x21')+_0x28a51e+_0x44b0('0x22'),'json':!![]};rp(_0x4c04c4)[_0x44b0('0x18')](function(_0x3dcc90){var _0x113684=_[_0x44b0('0x23')](_0x3dcc90[_0x44b0('0x24')][_0x44b0('0x24')],[_0x28a51e,_0x1851c0]);_0x573e37(_0x113684);})['catch'](function(_0x561719){_0x151c33(_0x561719);});});}function getEndUser(_0x17e34d,_0x3e7fd0,_0x3fb7e3){return function(_0x4cd6a7){return new Promise(function(_0x26419c,_0x5e35ed){logger[_0x44b0('0xe')](util['format'](_0x44b0('0x25'),_0x4cd6a7['contactNumber']));searchContact(_0x3fb7e3,_0x3e7fd0,_0x44b0('0x26'),_0x4cd6a7[_0x44b0('0x27')])[_0x44b0('0x18')](function(_0x41303d){if(_0x41303d){_0x4cd6a7[_0x44b0('0x28')]=_0x41303d['id'];logger[_0x44b0('0xe')](_0x44b0('0x29'),_0x4cd6a7['endUserId']);return _0x26419c(_0x4cd6a7);}searchContact(_0x3fb7e3,_0x3e7fd0,'work_number',_0x4cd6a7['contactNumber'])[_0x44b0('0x18')](function(_0x288d3c){if(_0x288d3c){_0x4cd6a7['endUserId']=_0x288d3c['id'];logger[_0x44b0('0xe')](_0x44b0('0x2a'),_0x4cd6a7[_0x44b0('0x28')]);return _0x26419c(_0x4cd6a7);}createEndUser(_0x4cd6a7,_0x17e34d,_0x3e7fd0,_0x3fb7e3)['then'](function(_0x45616e){logger[_0x44b0('0xe')]('Contact\x20created:',_0x45616e['endUserId']);return _0x26419c(_0x45616e);});});})[_0x44b0('0x20')](function(_0x200d54){_0x5e35ed(_0x200d54);});});};}function createEndUser(_0x5dfdd2,_0x4ca37e,_0x297d71,_0x5950dd){return new Promise(function(_0x3c406e,_0x3ac406){var _0x351db2=moment();var _0x5420d9={'method':_0x44b0('0x2b'),'uri':_0x5950dd+_0x44b0('0x2c'),'body':{'contact':{'last_name':_0x5dfdd2[_0x44b0('0x27')],'work_number':_0x5dfdd2[_0x44b0('0x27')],'mobile_number':_0x5dfdd2[_0x44b0('0x27')],'owner_id':_0x5dfdd2['userId'],'created_at':_0x351db2[_0x44b0('0x2d')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x5420d9[_0x44b0('0xd')]=_0x297d71;logger[_0x44b0('0xe')](_0x44b0('0x2e'));return rp(_0x5420d9)[_0x44b0('0x18')](function(_0x5a8a97){_0x5dfdd2[_0x44b0('0x28')]=_0x5a8a97[_0x44b0('0x2f')]['id'];_0x3c406e(_0x5dfdd2);})['catch'](function(_0x1a04a1){logger['error']('['+[_0x4ca37e[_0x44b0('0x15')]()]+']',_0x1a04a1['message']);_0x3ac406(_0x1a04a1[_0x44b0('0x16')]);});});}function getTicket(_0x3436d9,_0x4549df,_0x4446b9,_0x5e2b3e,_0x3288c1){return function(_0x464696){logger['info'](_0x44b0('0x30'));return new Promise(function(_0x26119f,_0x3227d7){var _0x443b8d=moment();var _0x350149={'method':_0x44b0('0x2b'),'uri':_0x4446b9+_0x44b0('0x31'),'body':{'title':intUtil['getString'](_0x5e2b3e['Subjects'],_0x3288c1,'\x20'),'description':intUtil[_0x44b0('0x32')](_0x5e2b3e[_0x44b0('0x33')],_0x3288c1,'\x0a'),'owner_id':_0x464696[_0x44b0('0x1d')],'creater_id':_0x464696['adminId'],'targetable_id':_0x464696[_0x44b0('0x28')],'targetable_type':_0x44b0('0x34'),'created_at':_0x443b8d[_0x44b0('0x2d')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x443b8d[_0x44b0('0x35')](0x1e,'m')['format'](_0x44b0('0x36'))},'json':!![]};_0x350149[_0x44b0('0xd')]=_0x4549df;return rp(_0x350149)[_0x44b0('0x18')](function(_0xdd248){_0x464696['ticketId']=_0xdd248[_0x44b0('0x37')]['id'];logger[_0x44b0('0xe')](_0x44b0('0x38'),_0x464696[_0x44b0('0x39')]);_0x26119f(_0x464696);})[_0x44b0('0x20')](function(_0x4864e7){logger[_0x44b0('0x3a')]('['+[_0x3436d9[_0x44b0('0x15')]()]+']',_0x4864e7[_0x44b0('0x16')]);_0x3227d7(_0x4864e7['message']);});});};}function emit(_0x5a2071,_0x4e4dd1,_0xf8907f){var _0x112c05={'uri':_0x5a2071+_0x44b0('0x3b')+_0xf8907f};io['to'](util[_0x44b0('0x2d')](_0x44b0('0x3c'),_0x4e4dd1))[_0x44b0('0x3d')](_0x44b0('0x3e'),_0x112c05);}exports['cs']=function(_0x1b7f10,_0x126013,_0x6e23bc,_0x4860fe,_0xf5e5f,_0x514d83,_0x23b17d,_0x51f1d5){var _0x28cabf={};var _0x46c464={'Authorization':_0x44b0('0x3f')+_0x514d83['apiKey']};_0x514d83[_0x44b0('0x40')]=intUtil[_0x44b0('0x41')](_0x514d83[_0x44b0('0x40')]);_0x514d83[_0x44b0('0x42')]=intUtil[_0x44b0('0x41')](_0x514d83['serverUrl']);var _0x3243d0=_0x514d83['remoteUri'];_0x28cabf[_0x44b0('0x11')]=_0x514d83['username'];_0x28cabf[_0x44b0('0x27')]=_0x51f1d5[_0x44b0('0x43')]()==='outbound'?_0x126013[_0x44b0('0x44')]:_0x126013[_0x44b0('0x45')];_0x28cabf[_0x44b0('0x46')]=_0x51f1d5==='queue'||_0x51f1d5==='unmanaged'?'queue':_0x44b0('0x47');if(_0x4860fe){_0x28cabf[_0x44b0('0x1a')]=_0x4860fe['email'];}var _0xa584fe=util[_0x44b0('0x2d')](_0x44b0('0x48'),_0x514d83[_0x44b0('0x42')],_0x126013[_0x44b0('0x49')],md5(_0x126013['uniqueid']));if(_0xf5e5f&&_0xf5e5f[_0x44b0('0x4a')]){logger[_0x44b0('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x126013[_0x44b0('0x4b')]=_0xa584fe;}else if(_0x23b17d&&_0x23b17d[_0x44b0('0x4c')]&&_0x23b17d[_0x44b0('0x4c')]!==_0x44b0('0x4d')){logger[_0x44b0('0xe')](_0x44b0('0x4e'),'Recording\x20is\x20enabled!');_0x126013['recordingURL']=_0xa584fe;}else{_0x126013['recordingURL']='';}return getAdminId(_0x28cabf,_0x51f1d5,_0x46c464,_0x3243d0)[_0x44b0('0x18')](getUser(_0x51f1d5,_0x46c464,_0x3243d0))[_0x44b0('0x18')](getEndUser(_0x51f1d5,_0x46c464,_0x3243d0))[_0x44b0('0x18')](getTicket(_0x51f1d5,_0x46c464,_0x3243d0,_0x6e23bc,_0x126013))['then'](function(_0x4ebd7c){logger[_0x44b0('0xe')](util[_0x44b0('0x2d')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4ebd7c[_0x44b0('0x39')]));if(_0x51f1d5!==_0x44b0('0x4f')){logger[_0x44b0('0xe')]('['+[_0x51f1d5[_0x44b0('0x15')]()]+']',_0x44b0('0x50'));emit(_0x3243d0,_0x4860fe[_0x44b0('0x51')],_0x4ebd7c[_0x44b0('0x28')]);}})[_0x44b0('0x20')](function(_0x3e3878){logger['error']('['+[_0x51f1d5[_0x44b0('0x15')]()]+_0x44b0('0x52'),util[_0x44b0('0x53')](_0x3e3878,{'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 9d00678..0210bfa 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 _0x182c=['[EXEC]','%s\x20account\x20#%s\x20not\x20found','./zendesk','./salesforce','./sugarcrm','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1','data2','find','Configurations','queue','outbound','log','EVENT\x20UNKNOWN','zoho','unknown\x20integration','../../../../config/logger','error','format'];(function(_0x5e0804,_0x401053){var _0x1c34a3=function(_0x37a23e){while(--_0x37a23e){_0x5e0804['push'](_0x5e0804['shift']());}};_0x1c34a3(++_0x401053);}(_0x182c,0xc8));var _0xc182=function(_0x7fd9e9,_0x1765d0){_0x7fd9e9=_0x7fd9e9-0x0;var _0x285d92=_0x182c[_0x7fd9e9];return _0x285d92;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0xc182('0x0'));var salesforce=require(_0xc182('0x1'));var sugarcrm=require(_0xc182('0x2'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0xc182('0x3'));var servicenow=require(_0xc182('0x4'));var dynamics365=require(_0xc182('0x5'));var freshsales=require('./freshsales');var integrations=[_0xc182('0x6'),_0xc182('0x7'),_0xc182('0x8'),_0xc182('0x9'),'zoho',_0xc182('0xa'),_0xc182('0xb'),_0xc182('0xc'),_0xc182('0xd'),_0xc182('0xe')];exports[_0xc182('0xf')]=function(_0x1573b2,_0x433b39,_0x34de59,_0x28bbd5,_0x44b7dd,_0x5ed4cc){if(_0x34de59){if(_[_0xc182('0x10')](integrations,_0x1573b2['data1'][_0xc182('0x11')]())){try{var _0x2e516c=null;var _0x49a168='';var _0xfebc68=_0x34de59[_0x1573b2[_0xc182('0x12')][_0xc182('0x11')]()];if(_0xfebc68){var _0x59e915=_0xfebc68[_0x1573b2[_0xc182('0x13')]];if(_0x59e915){var _0x291944=_[_0xc182('0x14')](_0x59e915[_0xc182('0x15')],{'id':parseInt(_0x1573b2['data3'],0xa)});if(_0x291944){if(_0x28bbd5){if(_0x44b7dd&&_0x433b39[_0xc182('0x16')]){_0x49a168=_0xc182('0x16');}else if(_0x433b39['routeId']){_0x49a168=_0xc182('0x17');}else{console[_0xc182('0x18')](_0xc182('0x19'),_0x433b39);}}else{_0x49a168='unmanaged';}switch(_0x1573b2[_0xc182('0x12')][_0xc182('0x11')]()){case'zendesk':zendesk[_0x49a168](_0x1573b2,_0x433b39,_0x291944,_0x28bbd5,_0x44b7dd,_0x59e915,_0x5ed4cc);break;case _0xc182('0x7'):salesforce[_0x49a168](_0x1573b2,_0x433b39,_0x291944,_0x28bbd5,_0x44b7dd,_0x59e915,_0x5ed4cc);break;case _0xc182('0x8'):sugarcrm[_0x49a168](_0x1573b2,_0x433b39,_0x291944,_0x28bbd5,_0x44b7dd,_0x59e915,_0x5ed4cc);break;case _0xc182('0x9'):freshdesk[_0x49a168](_0x1573b2,_0x433b39,_0x291944,_0x28bbd5,_0x44b7dd,_0x59e915,_0x5ed4cc);break;case _0xc182('0x1a'):zoho[_0x49a168](_0x1573b2,_0x433b39,_0x291944,_0x28bbd5,_0x44b7dd,_0x59e915,_0x5ed4cc);break;case'desk':desk[_0x49a168](_0x1573b2,_0x433b39,_0x291944,_0x28bbd5,_0x44b7dd,_0x59e915,_0x5ed4cc);break;case'vtiger':vtiger[_0x49a168](_0x1573b2,_0x433b39,_0x291944,_0x28bbd5,_0x44b7dd,_0x59e915,_0x5ed4cc);break;case'freshsales':freshsales['cs'](_0x1573b2,_0x433b39,_0x291944,_0x28bbd5,_0x44b7dd,_0x59e915,_0x5ed4cc,_0x49a168);break;case'servicenow':servicenow['cs'](_0x1573b2,_0x433b39,_0x291944,_0x28bbd5,_0x44b7dd,_0x59e915,_0x5ed4cc,_0x49a168);break;case _0xc182('0xc'):dynamics365['cs'](_0x1573b2,_0x433b39,_0x291944,_0x28bbd5,_0x44b7dd,_0x59e915,_0x5ed4cc,_0x49a168);break;default:console[_0xc182('0x18')](_0xc182('0x1b'));}}else{_0x2e516c=require(_0xc182('0x1c'))(_0x1573b2[_0xc182('0x12')][_0xc182('0x11')]());_0x2e516c[_0xc182('0x1d')]('[EXEC]',util[_0xc182('0x1e')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1573b2[_0xc182('0x12')]['toLowerCase'](),_0x1573b2['data3']));}}else{_0x2e516c=require(_0xc182('0x1c'))(_0x1573b2['data1'][_0xc182('0x11')]());_0x2e516c[_0xc182('0x1d')](_0xc182('0x1f'),util[_0xc182('0x1e')](_0xc182('0x20'),_0x1573b2[_0xc182('0x12')][_0xc182('0x11')](),_0x1573b2[_0xc182('0x13')]));}}else{}}catch(_0xa14ac4){console[_0xc182('0x1d')](_0xa14ac4);}}}}; \ No newline at end of file +var _0xa2fe=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util','./salesforce','./zoho'];(function(_0x5e33d4,_0x30e775){var _0x7a5156=function(_0x2d270b){while(--_0x2d270b){_0x5e33d4['push'](_0x5e33d4['shift']());}};_0x7a5156(++_0x30e775);}(_0xa2fe,0x95));var _0xea2f=function(_0x414166,_0x5e87f3){_0x414166=_0x414166-0x0;var _0x373505=_0xa2fe[_0x414166];return _0x373505;};'use strict';var _=require('lodash');var util=require(_0xea2f('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0xea2f('0x1'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xea2f('0x2'));var desk=require(_0xea2f('0x3'));var vtiger=require(_0xea2f('0x4'));var servicenow=require(_0xea2f('0x5'));var dynamics365=require(_0xea2f('0x6'));var freshsales=require(_0xea2f('0x7'));var integrations=[_0xea2f('0x8'),_0xea2f('0x9'),_0xea2f('0xa'),_0xea2f('0xb'),_0xea2f('0xc'),_0xea2f('0xd'),_0xea2f('0xe'),_0xea2f('0xf'),_0xea2f('0x10'),_0xea2f('0x11')];exports[_0xea2f('0x12')]=function(_0x246a3c,_0x1a277e,_0x1fd230,_0x5a0c84,_0x96da17,_0x41e0c9){if(_0x1fd230){if(_[_0xea2f('0x13')](integrations,_0x246a3c[_0xea2f('0x14')][_0xea2f('0x15')]())){try{var _0x1e5e6f=null;var _0x16d069='';var _0x547a03=_0x1fd230[_0x246a3c[_0xea2f('0x14')]['toLowerCase']()];if(_0x547a03){var _0x19679b=_0x547a03[_0x246a3c[_0xea2f('0x16')]];if(_0x19679b){var _0x57c235=_[_0xea2f('0x17')](_0x19679b[_0xea2f('0x18')],{'id':parseInt(_0x246a3c['data3'],0xa)});if(_0x57c235){if(_0x5a0c84){if(_0x96da17&&_0x1a277e[_0xea2f('0x19')]){_0x16d069=_0xea2f('0x19');}else if(_0x1a277e[_0xea2f('0x1a')]){_0x16d069='outbound';}else{console[_0xea2f('0x1b')](_0xea2f('0x1c'),_0x1a277e);}}else{_0x16d069=_0xea2f('0x1d');}switch(_0x246a3c[_0xea2f('0x14')][_0xea2f('0x15')]()){case _0xea2f('0x8'):zendesk[_0x16d069](_0x246a3c,_0x1a277e,_0x57c235,_0x5a0c84,_0x96da17,_0x19679b,_0x41e0c9);break;case _0xea2f('0x9'):salesforce[_0x16d069](_0x246a3c,_0x1a277e,_0x57c235,_0x5a0c84,_0x96da17,_0x19679b,_0x41e0c9);break;case _0xea2f('0xa'):sugarcrm[_0x16d069](_0x246a3c,_0x1a277e,_0x57c235,_0x5a0c84,_0x96da17,_0x19679b,_0x41e0c9);break;case _0xea2f('0xb'):freshdesk[_0x16d069](_0x246a3c,_0x1a277e,_0x57c235,_0x5a0c84,_0x96da17,_0x19679b,_0x41e0c9);break;case'zoho':zoho[_0x16d069](_0x246a3c,_0x1a277e,_0x57c235,_0x5a0c84,_0x96da17,_0x19679b,_0x41e0c9);break;case _0xea2f('0xd'):desk[_0x16d069](_0x246a3c,_0x1a277e,_0x57c235,_0x5a0c84,_0x96da17,_0x19679b,_0x41e0c9);break;case'vtiger':vtiger[_0x16d069](_0x246a3c,_0x1a277e,_0x57c235,_0x5a0c84,_0x96da17,_0x19679b,_0x41e0c9);break;case _0xea2f('0x10'):freshsales['cs'](_0x246a3c,_0x1a277e,_0x57c235,_0x5a0c84,_0x96da17,_0x19679b,_0x41e0c9,_0x16d069);break;case _0xea2f('0x11'):servicenow['cs'](_0x246a3c,_0x1a277e,_0x57c235,_0x5a0c84,_0x96da17,_0x19679b,_0x41e0c9,_0x16d069);break;case _0xea2f('0xf'):dynamics365['cs'](_0x246a3c,_0x1a277e,_0x57c235,_0x5a0c84,_0x96da17,_0x19679b,_0x41e0c9,_0x16d069);break;default:console[_0xea2f('0x1b')](_0xea2f('0x1e'));}}else{_0x1e5e6f=require(_0xea2f('0x1f'))(_0x246a3c[_0xea2f('0x14')][_0xea2f('0x15')]());_0x1e5e6f[_0xea2f('0x20')](_0xea2f('0x21'),util[_0xea2f('0x22')](_0xea2f('0x23'),_0x246a3c[_0xea2f('0x14')][_0xea2f('0x15')](),_0x246a3c[_0xea2f('0x24')]));}}else{_0x1e5e6f=require(_0xea2f('0x1f'))(_0x246a3c['data1'][_0xea2f('0x15')]());_0x1e5e6f[_0xea2f('0x20')](_0xea2f('0x21'),util[_0xea2f('0x22')](_0xea2f('0x25'),_0x246a3c[_0xea2f('0x14')][_0xea2f('0x15')](),_0x246a3c[_0xea2f('0x16')]));}}else{}}catch(_0x3da32e){console[_0xea2f('0x20')](_0x3da32e);}}}}; \ 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 aa41050..b5ba076 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 _0x162e=['user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.','catch','lodash','request-promise','moment','bluebird','jsforce','./util','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','Task','IsReminderSet','IsRecurrence','endUserType','WhoId','account','WhatId','Case','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','User','find','then','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','sobject','Contact','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','contact','lead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','LastName','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','No\x20Company','forEach','string','idField','content','variable','toString','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x162e,0x191));var _0xe162=function(_0x440a7b,_0x28a817){_0x440a7b=_0x440a7b-0x0;var _0x1fb531=_0x162e[_0x440a7b];return _0x1fb531;};'use strict';var _=require(_0xe162('0x0'));var rp=require(_0xe162('0x1'));var moment=require(_0xe162('0x2'));var BPromise=require(_0xe162('0x3'));var md5=require('md5');var jsforce=require(_0xe162('0x4'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xe162('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xe162('0x6'));config[_0xe162('0x7')]=_[_0xe162('0x8')](config[_0xe162('0x7')],{'host':_0xe162('0x9'),'port':0x18eb});var io=require(_0xe162('0xa'))(new Redis(config[_0xe162('0x7')]));function emit(_0x17ae1a,_0x3ff6f8,_0x19da1b){io['to'](_0x17ae1a)[_0xe162('0xb')](_0x3ff6f8,_0x19da1b);}function getTicket(_0x1cc752,_0xcaeb31,_0xdea306,_0x428067,_0x4242f8,_0x3ff4c5,_0x20a965,_0x13fb5e){var _0x5add34=Object[_0xe162('0xc')]({},{'OwnerId':_0xcaeb31['id'],'Subject':intUtil[_0xe162('0xd')](_0x428067['Subjects'],_0x4242f8,'\x20'),'Description':intUtil[_0xe162('0xd')](_0x428067[_0xe162('0xe')],_0x4242f8,'\x0a')},getCustomFields(_0x3ff4c5,_0x4242f8));if(_0xdea306){if(_0x428067[_0xe162('0xf')]===_0xe162('0x10')){_0x5add34['ActivityDate']=moment['utc']();_0x5add34[_0xe162('0x11')]=![];_0x5add34[_0xe162('0x12')]=![];if(_0xdea306[_0xe162('0x13')]==='contact'||_0xdea306[_0xe162('0x13')]==='lead'){_0x5add34[_0xe162('0x14')]=_0xdea306['id'];}else if(_0xdea306[_0xe162('0x13')]===_0xe162('0x15')){_0x5add34[_0xe162('0x16')]=_0xdea306['id'];}}else if(_0x428067[_0xe162('0xf')]===_0xe162('0x17')){if(_0xdea306[_0xe162('0x13')]==='contact'){_0x5add34['ContactId']=_0xdea306['id'];}else if(_0xdea306[_0xe162('0x13')]===_0xe162('0x15')){_0x5add34[_0xe162('0x18')]=_0xdea306['id'];}else if(_0xdea306[_0xe162('0x13')]==='lead'&&_0x428067[_0xe162('0x19')]){_0x5add34[_0x428067[_0xe162('0x19')]]=_0xdea306['id'];}else{logger[_0xe162('0x1a')](_0xe162('0x1b'));}}}return _0x20a965['sobject'](_0x428067[_0xe162('0xf')])[_0xe162('0x1c')](_0x5add34);}function getUser(_0x5ec3d2,_0x16a814,_0xa544a2){if(!_[_0xe162('0x1d')](_0x16a814)&&intUtil[_0xe162('0x1e')](_0x16a814)){var _0x185f4b={'Email':_0x16a814};var _0x3df173={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xa544a2['sobject'](_0xe162('0x1f'))[_0xe162('0x20')](_0x185f4b,_0x3df173)['execute']()[_0xe162('0x21')](function(_0x509830){if(_0x509830[_0xe162('0x22')]){var _0x594286=_[_0xe162('0x20')](_0x509830,function(_0x3aced2){return _0x3aced2['Email']===_0x16a814;});if(_0x594286){logger['info'](_0xe162('0x23'),_0x16a814);return BPromise[_0xe162('0x24')]({'id':_0x594286['Id'],'name':_0x594286[_0xe162('0x25')]});}}else{logger[_0xe162('0x1a')](_0xe162('0x26'),_0x16a814);return _0xa544a2[_0xe162('0x27')]()['then'](function(_0x17bb01){return BPromise[_0xe162('0x24')]({'id':_0x17bb01['user_id'],'name':_0x17bb01['display_name']});});}});}else{logger[_0xe162('0x1a')](_0xe162('0x26'),_0x16a814);return _0xa544a2[_0xe162('0x27')]()[_0xe162('0x21')](function(_0x3b3086){return BPromise[_0xe162('0x24')]({'id':_0x3b3086['user_id'],'name':_0x3b3086[_0xe162('0x28')]});});}}function getEndUser(_0x26b07b,_0x3d4341,_0x2e965c,_0x49be67,_0x3a71e2){var _0x1ee128={'$or':{'Phone':_0x49be67}};var _0x25e897={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe162('0x24')]()[_0xe162('0x21')](function(){logger[_0xe162('0x1a')](_0xe162('0x29'),_0x49be67,_0x3d4341[_0xe162('0x2a')]);switch(_0x3d4341[_0xe162('0x2a')]){case _0xe162('0x2b'):var _0x217369=_[_0xe162('0x2c')](_0x1ee128);if(_0x3d4341[_0xe162('0x2d')]){var _0x4f184f={};_0x4f184f[_0x3d4341['additionalSearchContact']]=_0x49be67;_[_0xe162('0x2e')](_0x217369[_0xe162('0x2f')],_0x4f184f);}return _0x3a71e2[_0xe162('0x30')](_0xe162('0x31'))['find'](_0x217369,_0x25e897)[_0xe162('0x32')]()[_0xe162('0x21')](function(_0x3b1326){if(_0x3b1326&&_0x3b1326[_0xe162('0x22')]){return _0x3b1326;}else{var _0x40d506=_[_0xe162('0x2c')](_0x1ee128);if(_0x3d4341[_0xe162('0x33')]){var _0x34f127={};_0x34f127[_0x3d4341[_0xe162('0x33')]]=_0x49be67;_['merge'](_0x40d506[_0xe162('0x2f')],_0x34f127);}return _0x3a71e2[_0xe162('0x30')](_0xe162('0x34'))[_0xe162('0x20')](_0x40d506,_0x25e897);}});case _0xe162('0x35'):var _0x231acb=_[_0xe162('0x2c')](_0x1ee128);if(_0x3d4341['additionalSearchAccount']){var _0x4f184f={};_0x4f184f[_0x3d4341[_0xe162('0x36')]]=_0x49be67;_['merge'](_0x231acb[_0xe162('0x2f')],_0x4f184f);}return _0x3a71e2[_0xe162('0x30')](_0xe162('0x37'))[_0xe162('0x20')](_0x231acb,_0x25e897)[_0xe162('0x32')]()['then'](function(_0x1ad4ed){if(_0x1ad4ed&&_0x1ad4ed[_0xe162('0x22')]){return _0x1ad4ed;}else{var _0x5f01f6=_['cloneDeep'](_0x1ee128);if(_0x3d4341['additionalSearchContact']){var _0x1ac1e1={};_0x1ac1e1[_0x3d4341[_0xe162('0x2d')]]=_0x49be67;_[_0xe162('0x2e')](_0x5f01f6['$or'],_0x1ac1e1);}return _0x3a71e2[_0xe162('0x30')]('Contact')['find'](_0x5f01f6,_0x25e897)['then'](function(_0x598080){if(_0x598080&&_0x598080[_0xe162('0x22')]){return _0x598080;}else{var _0x2a47eb=_[_0xe162('0x2c')](_0x1ee128);if(_0x3d4341[_0xe162('0x33')]){var _0x7684e8={};_0x7684e8[_0x3d4341[_0xe162('0x33')]]=_0x49be67;_[_0xe162('0x2e')](_0x2a47eb[_0xe162('0x2f')],_0x7684e8);}return _0x3a71e2['sobject'](_0xe162('0x34'))['find'](_0x2a47eb,_0x25e897);}});}});case _0xe162('0x38'):var _0x217369=_['cloneDeep'](_0x1ee128);if(_0x3d4341[_0xe162('0x2d')]){var _0x4f184f={};_0x4f184f[_0x3d4341[_0xe162('0x2d')]]=_0x49be67;_[_0xe162('0x2e')](_0x217369[_0xe162('0x2f')],_0x4f184f);}return _0x3a71e2[_0xe162('0x30')](_0xe162('0x31'))[_0xe162('0x20')](_0x217369,_0x25e897)[_0xe162('0x32')]();case _0xe162('0x39'):var _0x38b4f5=_['cloneDeep'](_0x1ee128);if(_0x3d4341[_0xe162('0x33')]){var _0x4f184f={};_0x4f184f[_0x3d4341[_0xe162('0x33')]]=_0x49be67;_[_0xe162('0x2e')](_0x38b4f5['$or'],_0x4f184f);}return _0x3a71e2[_0xe162('0x30')](_0xe162('0x34'))[_0xe162('0x20')](_0x38b4f5,_0x25e897);case _0xe162('0x15'):var _0x231acb=_[_0xe162('0x2c')](_0x1ee128);if(_0x3d4341[_0xe162('0x36')]){var _0x4f184f={};_0x4f184f[_0x3d4341[_0xe162('0x36')]]=_0x49be67;_[_0xe162('0x2e')](_0x231acb[_0xe162('0x2f')],_0x4f184f);}return _0x3a71e2[_0xe162('0x30')]('Account')['find'](_0x231acb,_0x25e897);default:return null;}})['then'](function(_0x4f8c05){if(_0x4f8c05&&_0x4f8c05['length']){var _0x554538=_[_0xe162('0x3a')](_0x4f8c05);if(_0x554538){return BPromise[_0xe162('0x24')]({'id':_0x554538['Id'],'name':_0x554538[_0xe162('0x25')],'phone':_0x554538[_0xe162('0x3b')],'endUserType':_0x554538[_0xe162('0x3c')][_0xe162('0x3d')][_0xe162('0x3e')]()});}}})['then'](function(_0x38e18d){if(_0x38e18d){logger[_0xe162('0x1a')](_0xe162('0x3f'),_0x38e18d[_0xe162('0x13')],_0x49be67);return BPromise[_0xe162('0x24')](_0x38e18d);}else{logger[_0xe162('0x1a')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x49be67);var _0x51fb2d={'Phone':_0x49be67};if(_0x3d4341[_0xe162('0x40')]){if(_0x3d4341['moduleCreate']===_0xe162('0x38')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x49be67,_0x3d4341[_0xe162('0x40')]);_0x51fb2d[_0xe162('0x41')]=_0x2e965c!==_0xe162('0x42')?_0x2e965c:util['format'](_0xe162('0x43'),_0x49be67);}else if(_0x3d4341[_0xe162('0x40')]===_0xe162('0x39')){logger[_0xe162('0x1a')](_0xe162('0x44'),_0x49be67,_0x3d4341[_0xe162('0x40')]);_0x51fb2d[_0xe162('0x41')]=_0x2e965c!==_0xe162('0x42')?_0x2e965c:util[_0xe162('0x45')]('Caller\x20-\x20%s',_0x49be67);_0x51fb2d['Company']=_0xe162('0x46');}else if(_0x3d4341[_0xe162('0x40')]==='account'){logger[_0xe162('0x1a')](_0xe162('0x44'),_0x49be67,_0x3d4341['moduleCreate']);_0x51fb2d['Name']=_0x2e965c!==''?_0x2e965c:util[_0xe162('0x45')](_0xe162('0x43'),_0x49be67);}else{return null;}}return _0x3a71e2[_0xe162('0x30')](_['upperFirst'](_0x3d4341[_0xe162('0x40')]))[_0xe162('0x1c')](_0x51fb2d)[_0xe162('0x21')](function(_0x17c7ec){return BPromise[_0xe162('0x24')]({'id':_0x17c7ec['id'],'endUserType':_0x3d4341[_0xe162('0x40')]});});}});}function getCustomFields(_0xddd035,_0x2e0cea){var _0x25827c={};if(_0xddd035[_0xe162('0x22')]>0x0){_[_0xe162('0x47')](_0xddd035,function(_0x5bccf5){if(_['includes']([_0xe162('0x48'),'picklist'],_0x5bccf5['type'])&&_0x5bccf5[_0xe162('0x49')]){_0x25827c[_0x5bccf5[_0xe162('0x49')]]=_0x5bccf5[_0xe162('0x4a')]['toString']();}else if(_0x5bccf5[_0xe162('0x3d')]===_0xe162('0x4b')&&_0x5bccf5['variableName']&&_0x5bccf5[_0xe162('0x49')]){_0x2e0cea[_0x5bccf5['variableName']]&&(_0x25827c[_0x5bccf5[_0xe162('0x49')]]=_0x2e0cea[_0x5bccf5['variableName']][_0xe162('0x4c')]());}else if(_0x5bccf5[_0xe162('0x3d')]===_0xe162('0x4d')&&_0x5bccf5[_0xe162('0x4e')]&&_0x5bccf5['Variable'][_0xe162('0x4f')]&&_0x5bccf5[_0xe162('0x49')]){_0x2e0cea[_0x5bccf5[_0xe162('0x4e')]['name'][_0xe162('0x3e')]()]&&(_0x25827c[_0x5bccf5['idField']]=_0x2e0cea[_0x5bccf5[_0xe162('0x4e')][_0xe162('0x4f')][_0xe162('0x3e')]()][_0xe162('0x4c')]());}});}return _0x25827c;}function getConnection(_0x34830c){var _0x12e53b=_0x34830c[_0xe162('0x50')][_0xe162('0x51')](_0x34830c[_0xe162('0x52')]);var _0xa31dfb=new jsforce[(_0xe162('0x53'))]({'oauth2':{'loginUrl':_0x34830c[_0xe162('0x54')]||'https://login.salesforce.com','clientId':_0x34830c[_0xe162('0x55')],'clientSecret':_0x34830c[_0xe162('0x56')]}});return _0xa31dfb[_0xe162('0x57')](_0x34830c['username'],_0x12e53b)[_0xe162('0x21')](function(){logger[_0xe162('0x1a')](_0xe162('0x58'));return _0xa31dfb;});}exports[_0xe162('0x59')]=function(_0x29dbf9,_0x421bab,_0x37a6ef,_0x21a2ce,_0x38de37,_0x366757){var _0x1440e1,_0x32552f,_0x1aac02,_0x519e31;_0x366757[_0xe162('0x5a')]=intUtil[_0xe162('0x5b')](_0x366757[_0xe162('0x5a')]);_0x366757[_0xe162('0x54')]=intUtil['stripTrailingSlash'](_0x366757[_0xe162('0x54')]);if(_0x38de37&&_0x38de37[_0xe162('0x5c')]){logger['info'](_0xe162('0x5d'),_0xe162('0x5e'));_0x421bab[_0xe162('0x5f')]=util[_0xe162('0x45')](_0xe162('0x60'),_0x366757[_0xe162('0x5a')],_0x421bab['uniqueid'],md5(_0x421bab[_0xe162('0x61')]));}else{_0x421bab[_0xe162('0x5f')]='';}return getConnection(_0x366757)[_0xe162('0x21')](function(_0x165a7e){_0x519e31=_0x165a7e;return getUser(_0x366757,_0x21a2ce[_0xe162('0x62')],_0x519e31);})[_0xe162('0x21')](function(_0x33de4f){_0x1440e1=_0x33de4f;return getEndUser(_0x366757,_0x37a6ef,_0x421bab[_0xe162('0x63')],_0x421bab['calleridnum'],_0x519e31);})[_0xe162('0x21')](function(_0x23be5e){_0x32552f=_0x23be5e;return getTicket(_0x366757,_0x1440e1,_0x32552f,_0x37a6ef,_0x421bab,_0x37a6ef[_0xe162('0x64')],_0x519e31,_0xe162('0x59'));})[_0xe162('0x21')](function(_0x90d3a3){_0x1aac02=_0x90d3a3;logger[_0xe162('0x1a')](_0xe162('0x65'),_0x1aac02['id']);logger[_0xe162('0x1a')](_0xe162('0x66'),_0x1aac02['id'],_0x21a2ce[_0xe162('0x4f')],_0x366757[_0xe162('0x3d')]);switch(_0x366757[_0xe162('0x3d')]){case'integrationTab':emit(util['format'](_0xe162('0x67'),_0x21a2ce[_0xe162('0x4f')]),_0xe162('0x68'),{'recordId':_0x1aac02['id']});break;case _0xe162('0x69'):emit(util['format'](_0xe162('0x67'),_0x21a2ce[_0xe162('0x4f')]),_0xe162('0x6a'),{'uri':util[_0xe162('0x45')](_0xe162('0x6b'),_0x519e31[_0xe162('0x6c')],_0x1aac02['id'])});break;default:logger[_0xe162('0x6d')](_0xe162('0x6e'));}})['catch'](function(_0x56378e){logger[_0xe162('0x6d')](_0xe162('0x5d'),_0x56378e);});};exports[_0xe162('0x6f')]=function(_0x1c122c,_0xe90820,_0x56b8eb,_0xe71b85,_0x2cca87,_0x2c0bbe,_0x20d0b2){var _0x5a0353,_0x4229ed,_0x33d4ba,_0x3aee0f;_0x2c0bbe[_0xe162('0x5a')]=intUtil[_0xe162('0x5b')](_0x2c0bbe[_0xe162('0x5a')]);_0x2c0bbe['remoteUri']=intUtil[_0xe162('0x5b')](_0x2c0bbe[_0xe162('0x54')]);if(_0x20d0b2&&_0x20d0b2[_0xe162('0x70')]&&_0x20d0b2[_0xe162('0x70')]!==_0xe162('0x71')){logger['info'](_0xe162('0x72'),_0xe162('0x5e'));_0xe90820[_0xe162('0x5f')]=util['format'](_0xe162('0x60'),_0x2c0bbe[_0xe162('0x5a')],_0xe90820[_0xe162('0x61')],md5(_0xe90820[_0xe162('0x61')]));}return getConnection(_0x2c0bbe)['then'](function(_0x3fcf1b){_0x3aee0f=_0x3fcf1b;return getUser(_0x2c0bbe,_0xe71b85[_0xe162('0x62')],_0x3aee0f);})['then'](function(_0x5c95c6){_0x5a0353=_0x5c95c6;return getEndUser(_0x2c0bbe,_0x56b8eb,_0xe90820[_0xe162('0x73')],_0xe90820[_0xe162('0x74')],_0x3aee0f);})['then'](function(_0x29ce4a){_0x4229ed=_0x29ce4a;return getTicket(_0x2c0bbe,_0x5a0353,_0x4229ed,_0x56b8eb,_0xe90820,_0x56b8eb[_0xe162('0x64')],_0x3aee0f,'outbound');})[_0xe162('0x21')](function(_0xb5fc31){_0x33d4ba=_0xb5fc31;logger[_0xe162('0x1a')](_0xe162('0x75'),_0x33d4ba['id']);logger[_0xe162('0x1a')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x33d4ba['id'],_0xe71b85[_0xe162('0x4f')],_0x2c0bbe[_0xe162('0x3d')]);switch(_0x2c0bbe[_0xe162('0x3d')]){case _0xe162('0x76'):emit(util[_0xe162('0x45')](_0xe162('0x67'),_0xe71b85[_0xe162('0x4f')]),'trigger:salesforce:display',{'recordId':_0x33d4ba['id']});break;case _0xe162('0x69'):emit(util[_0xe162('0x45')](_0xe162('0x67'),_0xe71b85[_0xe162('0x4f')]),_0xe162('0x6a'),{'uri':util[_0xe162('0x45')]('%s/%s/e',_0x3aee0f[_0xe162('0x6c')],_0x33d4ba['id'])});break;default:logger[_0xe162('0x6d')](_0xe162('0x72'),_0xe162('0x77'));}})['catch'](function(_0x4bfb0b){logger[_0xe162('0x6d')](_0xe162('0x72'),_0x4bfb0b);});};exports[_0xe162('0x78')]=function(_0x2e284f,_0x121ad1,_0x219c99,_0x455dba,_0x419f91,_0x47cffb){var _0x43664e,_0x54acec,_0x1e63a1,_0x55259d;_0x47cffb[_0xe162('0x5a')]=intUtil['stripTrailingSlash'](_0x47cffb['serverUrl']);_0x47cffb['remoteUri']=intUtil['stripTrailingSlash'](_0x47cffb[_0xe162('0x54')]);if(_0x419f91&&_0x419f91[_0xe162('0x5c')]){logger[_0xe162('0x1a')]('['+_0x121ad1['lastevent'][_0xe162('0x79')]()+']',_0xe162('0x5e'));_0x121ad1[_0xe162('0x5f')]=util[_0xe162('0x45')](_0xe162('0x60'),_0x47cffb[_0xe162('0x5a')],_0x121ad1[_0xe162('0x61')],md5(_0x121ad1['uniqueid']));}else{_0x121ad1[_0xe162('0x5f')]='';}return getConnection(_0x47cffb)[_0xe162('0x21')](function(_0x230684){_0x55259d=_0x230684;if(!_['isNil'](_0x455dba)){return getUser(_0x47cffb,_0x455dba[_0xe162('0x4f')],_0x55259d);}else{return getUser(_0x47cffb,null,_0x55259d);}})[_0xe162('0x21')](function(_0x44146f){_0x43664e=_0x44146f;return getEndUser(_0x47cffb,_0x219c99,_0x121ad1[_0xe162('0x63')],_0x121ad1[_0xe162('0x7a')],_0x55259d);})[_0xe162('0x21')](function(_0x5e02c5){_0x54acec=_0x5e02c5;return getTicket(_0x47cffb,_0x43664e,_0x54acec,_0x219c99,_0x121ad1,_0x219c99[_0xe162('0x64')],_0x55259d);})[_0xe162('0x21')](function(_0xcf2b80){_0x1e63a1=_0xcf2b80;logger[_0xe162('0x1a')]('['+_0x121ad1[_0xe162('0x7b')][_0xe162('0x79')]()+_0xe162('0x7c'),_0x1e63a1['id']);logger[_0xe162('0x1a')]('['+_0x121ad1['lastevent'][_0xe162('0x79')]()+']\x20Integration\x20account\x20type\x20%s.',_0x47cffb['type']);})[_0xe162('0x7d')](function(_0x282fee){logger['error']('['+_0x121ad1[_0xe162('0x7b')][_0xe162('0x79')]()+']',_0x282fee);});}; \ No newline at end of file +var _0x6cd0=['Account','first','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','Company','No\x20Company','format','forEach','picklist','type','idField','content','variableName','Variable','name','toString','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','assign','getString','Descriptions','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','contact','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','contact_lead','additionalSearchContact','merge','$or','Contact','execute','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','lead'];(function(_0x365656,_0x44e514){var _0x309f71=function(_0x1ca4c8){while(--_0x1ca4c8){_0x365656['push'](_0x365656['shift']());}};_0x309f71(++_0x44e514);}(_0x6cd0,0x145));var _0x06cd=function(_0x27ef7d,_0x12ceff){_0x27ef7d=_0x27ef7d-0x0;var _0x10eeda=_0x6cd0[_0x27ef7d];return _0x10eeda;};'use strict';var _=require(_0x06cd('0x0'));var rp=require(_0x06cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x06cd('0x2'));var util=require(_0x06cd('0x3'));var Redis=require(_0x06cd('0x4'));var intUtil=require(_0x06cd('0x5'));var config=require(_0x06cd('0x6'));var logger=require(_0x06cd('0x7'))(_0x06cd('0x8'));config[_0x06cd('0x9')]=_[_0x06cd('0xa')](config[_0x06cd('0x9')],{'host':_0x06cd('0xb'),'port':0x18eb});var io=require(_0x06cd('0xc'))(new Redis(config[_0x06cd('0x9')]));function emit(_0xd32377,_0x253475,_0x14f3f8){io['to'](_0xd32377)['emit'](_0x253475,_0x14f3f8);}function getTicket(_0x25b728,_0x3ffb0c,_0x2156d0,_0x20b0fc,_0x451ad5,_0x37711a,_0x2d471b,_0x108bb6){var _0x4580b9=Object[_0x06cd('0xd')]({},{'OwnerId':_0x3ffb0c['id'],'Subject':intUtil[_0x06cd('0xe')](_0x20b0fc['Subjects'],_0x451ad5,'\x20'),'Description':intUtil['getString'](_0x20b0fc[_0x06cd('0xf')],_0x451ad5,'\x0a')},getCustomFields(_0x37711a,_0x451ad5));if(_0x2156d0){if(_0x20b0fc[_0x06cd('0x10')]==='Task'){_0x4580b9['ActivityDate']=moment[_0x06cd('0x11')]();_0x4580b9[_0x06cd('0x12')]=![];_0x4580b9[_0x06cd('0x13')]=![];if(_0x2156d0[_0x06cd('0x14')]===_0x06cd('0x15')||_0x2156d0[_0x06cd('0x14')]==='lead'){_0x4580b9['WhoId']=_0x2156d0['id'];}else if(_0x2156d0['endUserType']==='account'){_0x4580b9['WhatId']=_0x2156d0['id'];}}else if(_0x20b0fc['ticketType']==='Case'){if(_0x2156d0[_0x06cd('0x14')]==='contact'){_0x4580b9[_0x06cd('0x16')]=_0x2156d0['id'];}else if(_0x2156d0[_0x06cd('0x14')]===_0x06cd('0x17')){_0x4580b9[_0x06cd('0x18')]=_0x2156d0['id'];}else if(_0x2156d0[_0x06cd('0x14')]==='lead'&&_0x20b0fc[_0x06cd('0x19')]){_0x4580b9[_0x20b0fc[_0x06cd('0x19')]]=_0x2156d0['id'];}else{logger[_0x06cd('0x1a')](_0x06cd('0x1b'));}}}return _0x2d471b[_0x06cd('0x1c')](_0x20b0fc[_0x06cd('0x10')])[_0x06cd('0x1d')](_0x4580b9);}function getUser(_0x317bea,_0x36a822,_0x39c813){if(!_[_0x06cd('0x1e')](_0x36a822)&&intUtil[_0x06cd('0x1f')](_0x36a822)){var _0xa4f46f={'Email':_0x36a822};var _0x40fba9={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x39c813['sobject'](_0x06cd('0x20'))[_0x06cd('0x21')](_0xa4f46f,_0x40fba9)['execute']()['then'](function(_0x187cbc){if(_0x187cbc[_0x06cd('0x22')]){var _0x439450=_[_0x06cd('0x21')](_0x187cbc,function(_0x504bdd){return _0x504bdd[_0x06cd('0x23')]===_0x36a822;});if(_0x439450){logger[_0x06cd('0x1a')](_0x06cd('0x24'),_0x36a822);return BPromise[_0x06cd('0x25')]({'id':_0x439450['Id'],'name':_0x439450[_0x06cd('0x26')]});}}else{logger[_0x06cd('0x1a')](_0x06cd('0x27'),_0x36a822);return _0x39c813[_0x06cd('0x28')]()[_0x06cd('0x29')](function(_0x35544c){return BPromise['resolve']({'id':_0x35544c[_0x06cd('0x2a')],'name':_0x35544c['display_name']});});}});}else{logger[_0x06cd('0x1a')](_0x06cd('0x27'),_0x36a822);return _0x39c813['identity']()[_0x06cd('0x29')](function(_0x4dba26){return BPromise[_0x06cd('0x25')]({'id':_0x4dba26['user_id'],'name':_0x4dba26[_0x06cd('0x2b')]});});}}function getEndUser(_0x27a78f,_0x28d77f,_0x580b2f,_0x2c9c29,_0x486438){var _0x4f9a82={'$or':{'Phone':_0x2c9c29}};var _0x11c85f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x06cd('0x25')]()[_0x06cd('0x29')](function(){logger[_0x06cd('0x1a')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x2c9c29,_0x28d77f['moduleSearch']);switch(_0x28d77f['moduleSearch']){case _0x06cd('0x2c'):var _0x434124=_['cloneDeep'](_0x4f9a82);if(_0x28d77f[_0x06cd('0x2d')]){var _0x4fe88a={};_0x4fe88a[_0x28d77f[_0x06cd('0x2d')]]=_0x2c9c29;_[_0x06cd('0x2e')](_0x434124[_0x06cd('0x2f')],_0x4fe88a);}return _0x486438[_0x06cd('0x1c')](_0x06cd('0x30'))['find'](_0x434124,_0x11c85f)[_0x06cd('0x31')]()[_0x06cd('0x29')](function(_0x4f56c7){if(_0x4f56c7&&_0x4f56c7[_0x06cd('0x22')]){return _0x4f56c7;}else{var _0x5e3ffd=_[_0x06cd('0x32')](_0x4f9a82);if(_0x28d77f[_0x06cd('0x33')]){var _0x2f7315={};_0x2f7315[_0x28d77f[_0x06cd('0x33')]]=_0x2c9c29;_[_0x06cd('0x2e')](_0x5e3ffd[_0x06cd('0x2f')],_0x2f7315);}return _0x486438[_0x06cd('0x1c')](_0x06cd('0x34'))[_0x06cd('0x21')](_0x5e3ffd,_0x11c85f);}});case _0x06cd('0x35'):var _0x24cc42=_[_0x06cd('0x32')](_0x4f9a82);if(_0x28d77f[_0x06cd('0x36')]){var _0x4fe88a={};_0x4fe88a[_0x28d77f['additionalSearchAccount']]=_0x2c9c29;_[_0x06cd('0x2e')](_0x24cc42['$or'],_0x4fe88a);}return _0x486438[_0x06cd('0x1c')]('Account')[_0x06cd('0x21')](_0x24cc42,_0x11c85f)['execute']()[_0x06cd('0x29')](function(_0x46f4ed){if(_0x46f4ed&&_0x46f4ed[_0x06cd('0x22')]){return _0x46f4ed;}else{var _0x3c8a54=_[_0x06cd('0x32')](_0x4f9a82);if(_0x28d77f[_0x06cd('0x2d')]){var _0x5d9878={};_0x5d9878[_0x28d77f[_0x06cd('0x2d')]]=_0x2c9c29;_[_0x06cd('0x2e')](_0x3c8a54[_0x06cd('0x2f')],_0x5d9878);}return _0x486438[_0x06cd('0x1c')]('Contact')[_0x06cd('0x21')](_0x3c8a54,_0x11c85f)[_0x06cd('0x29')](function(_0x1bcf5c){if(_0x1bcf5c&&_0x1bcf5c[_0x06cd('0x22')]){return _0x1bcf5c;}else{var _0x3026cc=_[_0x06cd('0x32')](_0x4f9a82);if(_0x28d77f[_0x06cd('0x33')]){var _0x497c98={};_0x497c98[_0x28d77f[_0x06cd('0x33')]]=_0x2c9c29;_['merge'](_0x3026cc[_0x06cd('0x2f')],_0x497c98);}return _0x486438[_0x06cd('0x1c')](_0x06cd('0x34'))[_0x06cd('0x21')](_0x3026cc,_0x11c85f);}});}});case _0x06cd('0x15'):var _0x434124=_[_0x06cd('0x32')](_0x4f9a82);if(_0x28d77f[_0x06cd('0x2d')]){var _0x4fe88a={};_0x4fe88a[_0x28d77f[_0x06cd('0x2d')]]=_0x2c9c29;_['merge'](_0x434124[_0x06cd('0x2f')],_0x4fe88a);}return _0x486438[_0x06cd('0x1c')](_0x06cd('0x30'))[_0x06cd('0x21')](_0x434124,_0x11c85f)[_0x06cd('0x31')]();case _0x06cd('0x37'):var _0x1224f8=_[_0x06cd('0x32')](_0x4f9a82);if(_0x28d77f['additionalSearchLead']){var _0x4fe88a={};_0x4fe88a[_0x28d77f['additionalSearchLead']]=_0x2c9c29;_['merge'](_0x1224f8[_0x06cd('0x2f')],_0x4fe88a);}return _0x486438['sobject'](_0x06cd('0x34'))['find'](_0x1224f8,_0x11c85f);case _0x06cd('0x17'):var _0x24cc42=_[_0x06cd('0x32')](_0x4f9a82);if(_0x28d77f[_0x06cd('0x36')]){var _0x4fe88a={};_0x4fe88a[_0x28d77f['additionalSearchAccount']]=_0x2c9c29;_[_0x06cd('0x2e')](_0x24cc42[_0x06cd('0x2f')],_0x4fe88a);}return _0x486438[_0x06cd('0x1c')](_0x06cd('0x38'))[_0x06cd('0x21')](_0x24cc42,_0x11c85f);default:return null;}})['then'](function(_0x4bf1fa){if(_0x4bf1fa&&_0x4bf1fa[_0x06cd('0x22')]){var _0x309f8d=_[_0x06cd('0x39')](_0x4bf1fa);if(_0x309f8d){return BPromise[_0x06cd('0x25')]({'id':_0x309f8d['Id'],'name':_0x309f8d[_0x06cd('0x26')],'phone':_0x309f8d[_0x06cd('0x3a')],'endUserType':_0x309f8d[_0x06cd('0x3b')]['type'][_0x06cd('0x3c')]()});}}})[_0x06cd('0x29')](function(_0x2ca35e){if(_0x2ca35e){logger[_0x06cd('0x1a')](_0x06cd('0x3d'),_0x2ca35e['endUserType'],_0x2c9c29);return BPromise[_0x06cd('0x25')](_0x2ca35e);}else{logger[_0x06cd('0x1a')](_0x06cd('0x3e'),_0x2c9c29);var _0x2a6809={'Phone':_0x2c9c29};if(_0x28d77f[_0x06cd('0x3f')]){if(_0x28d77f[_0x06cd('0x3f')]===_0x06cd('0x15')){logger[_0x06cd('0x1a')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2c9c29,_0x28d77f[_0x06cd('0x3f')]);_0x2a6809['LastName']=_0x580b2f!==_0x06cd('0x40')?_0x580b2f:util['format'](_0x06cd('0x41'),_0x2c9c29);}else if(_0x28d77f[_0x06cd('0x3f')]==='lead'){logger['info'](_0x06cd('0x42'),_0x2c9c29,_0x28d77f[_0x06cd('0x3f')]);_0x2a6809[_0x06cd('0x43')]=_0x580b2f!==_0x06cd('0x40')?_0x580b2f:util['format']('Caller\x20-\x20%s',_0x2c9c29);_0x2a6809[_0x06cd('0x44')]=_0x06cd('0x45');}else if(_0x28d77f[_0x06cd('0x3f')]===_0x06cd('0x17')){logger[_0x06cd('0x1a')](_0x06cd('0x42'),_0x2c9c29,_0x28d77f[_0x06cd('0x3f')]);_0x2a6809[_0x06cd('0x26')]=_0x580b2f!==_0x06cd('0x40')?_0x580b2f:util[_0x06cd('0x46')](_0x06cd('0x41'),_0x2c9c29);}else{return null;}}return _0x486438[_0x06cd('0x1c')](_['upperFirst'](_0x28d77f[_0x06cd('0x3f')]))[_0x06cd('0x1d')](_0x2a6809)[_0x06cd('0x29')](function(_0x2c3603){return BPromise['resolve']({'id':_0x2c3603['id'],'endUserType':_0x28d77f[_0x06cd('0x3f')]});});}});}function getCustomFields(_0x1d0f8e,_0x428157){var _0xfb4c50={};if(_0x1d0f8e[_0x06cd('0x22')]>0x0){_[_0x06cd('0x47')](_0x1d0f8e,function(_0x4355c1){if(_['includes'](['string',_0x06cd('0x48')],_0x4355c1[_0x06cd('0x49')])&&_0x4355c1['idField']){_0xfb4c50[_0x4355c1[_0x06cd('0x4a')]]=_0x4355c1[_0x06cd('0x4b')]['toString']();}else if(_0x4355c1[_0x06cd('0x49')]==='variable'&&_0x4355c1[_0x06cd('0x4c')]&&_0x4355c1['idField']){_0x428157[_0x4355c1[_0x06cd('0x4c')]]&&(_0xfb4c50[_0x4355c1[_0x06cd('0x4a')]]=_0x428157[_0x4355c1['variableName']]['toString']());}else if(_0x4355c1[_0x06cd('0x49')]==='customVariable'&&_0x4355c1[_0x06cd('0x4d')]&&_0x4355c1[_0x06cd('0x4d')][_0x06cd('0x4e')]&&_0x4355c1[_0x06cd('0x4a')]){_0x428157[_0x4355c1['Variable'][_0x06cd('0x4e')][_0x06cd('0x3c')]()]&&(_0xfb4c50[_0x4355c1['idField']]=_0x428157[_0x4355c1['Variable'][_0x06cd('0x4e')][_0x06cd('0x3c')]()][_0x06cd('0x4f')]());}});}return _0xfb4c50;}function getConnection(_0x3af1b2){var _0x29d374=_0x3af1b2[_0x06cd('0x50')][_0x06cd('0x51')](_0x3af1b2['securityToken']);var _0x1d111b=new jsforce[(_0x06cd('0x52'))]({'oauth2':{'loginUrl':_0x3af1b2[_0x06cd('0x53')]||_0x06cd('0x54'),'clientId':_0x3af1b2[_0x06cd('0x55')],'clientSecret':_0x3af1b2[_0x06cd('0x56')]}});return _0x1d111b[_0x06cd('0x57')](_0x3af1b2[_0x06cd('0x58')],_0x29d374)[_0x06cd('0x29')](function(){logger['info'](_0x06cd('0x59'));return _0x1d111b;});}exports[_0x06cd('0x5a')]=function(_0x2ead71,_0x3d749c,_0x2e7288,_0x254f06,_0x5a562e,_0x30068f){var _0x4774f7,_0x4f8902,_0x47aa84,_0x442797;_0x30068f[_0x06cd('0x5b')]=intUtil[_0x06cd('0x5c')](_0x30068f[_0x06cd('0x5b')]);_0x30068f[_0x06cd('0x53')]=intUtil[_0x06cd('0x5c')](_0x30068f[_0x06cd('0x53')]);if(_0x5a562e&&_0x5a562e[_0x06cd('0x5d')]){logger[_0x06cd('0x1a')](_0x06cd('0x5e'),_0x06cd('0x5f'));_0x3d749c[_0x06cd('0x60')]=util['format'](_0x06cd('0x61'),_0x30068f[_0x06cd('0x5b')],_0x3d749c[_0x06cd('0x62')],md5(_0x3d749c['uniqueid']));}else{_0x3d749c[_0x06cd('0x60')]='';}return getConnection(_0x30068f)[_0x06cd('0x29')](function(_0x1ee30a){_0x442797=_0x1ee30a;return getUser(_0x30068f,_0x254f06[_0x06cd('0x63')],_0x442797);})[_0x06cd('0x29')](function(_0x79b3a4){_0x4774f7=_0x79b3a4;return getEndUser(_0x30068f,_0x2e7288,_0x3d749c[_0x06cd('0x64')],_0x3d749c[_0x06cd('0x65')],_0x442797);})[_0x06cd('0x29')](function(_0xc28ed7){_0x4f8902=_0xc28ed7;return getTicket(_0x30068f,_0x4774f7,_0x4f8902,_0x2e7288,_0x3d749c,_0x2e7288[_0x06cd('0x66')],_0x442797,_0x06cd('0x5a'));})['then'](function(_0x4dc38e){_0x47aa84=_0x4dc38e;logger[_0x06cd('0x1a')](_0x06cd('0x67'),_0x47aa84['id']);logger[_0x06cd('0x1a')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x47aa84['id'],_0x254f06[_0x06cd('0x4e')],_0x30068f[_0x06cd('0x49')]);switch(_0x30068f[_0x06cd('0x49')]){case _0x06cd('0x68'):emit(util[_0x06cd('0x46')](_0x06cd('0x69'),_0x254f06[_0x06cd('0x4e')]),_0x06cd('0x6a'),{'recordId':_0x47aa84['id']});break;case _0x06cd('0x6b'):emit(util[_0x06cd('0x46')]('user:%s',_0x254f06['name']),_0x06cd('0x6c'),{'uri':util[_0x06cd('0x46')](_0x06cd('0x6d'),_0x442797['instanceUrl'],_0x47aa84['id'])});break;default:logger[_0x06cd('0x6e')](_0x06cd('0x6f'));}})['catch'](function(_0x19c9f0){logger[_0x06cd('0x6e')](_0x06cd('0x5e'),_0x19c9f0);});};exports['outbound']=function(_0x38071a,_0x36832a,_0x3d88b5,_0x495692,_0x2278e1,_0x441429,_0x25a243){var _0xdb7d9e,_0x3d8f9b,_0x2d768e,_0x1a1979;_0x441429[_0x06cd('0x5b')]=intUtil[_0x06cd('0x5c')](_0x441429[_0x06cd('0x5b')]);_0x441429[_0x06cd('0x53')]=intUtil[_0x06cd('0x5c')](_0x441429['remoteUri']);if(_0x25a243&&_0x25a243[_0x06cd('0x70')]&&_0x25a243['recordingFormat']!==_0x06cd('0x71')){logger[_0x06cd('0x1a')](_0x06cd('0x72'),_0x06cd('0x5f'));_0x36832a['recordingURL']=util['format'](_0x06cd('0x61'),_0x441429[_0x06cd('0x5b')],_0x36832a[_0x06cd('0x62')],md5(_0x36832a[_0x06cd('0x62')]));}return getConnection(_0x441429)['then'](function(_0xb07dc8){_0x1a1979=_0xb07dc8;return getUser(_0x441429,_0x495692[_0x06cd('0x63')],_0x1a1979);})[_0x06cd('0x29')](function(_0x149498){_0xdb7d9e=_0x149498;return getEndUser(_0x441429,_0x3d88b5,_0x36832a[_0x06cd('0x73')],_0x36832a[_0x06cd('0x74')],_0x1a1979);})[_0x06cd('0x29')](function(_0x30db84){_0x3d8f9b=_0x30db84;return getTicket(_0x441429,_0xdb7d9e,_0x3d8f9b,_0x3d88b5,_0x36832a,_0x3d88b5[_0x06cd('0x66')],_0x1a1979,'outbound');})['then'](function(_0x206d56){_0x2d768e=_0x206d56;logger[_0x06cd('0x1a')](_0x06cd('0x75'),_0x2d768e['id']);logger['info'](_0x06cd('0x76'),_0x2d768e['id'],_0x495692[_0x06cd('0x4e')],_0x441429['type']);switch(_0x441429[_0x06cd('0x49')]){case'integrationTab':emit(util['format'](_0x06cd('0x69'),_0x495692['name']),_0x06cd('0x6a'),{'recordId':_0x2d768e['id']});break;case _0x06cd('0x6b'):emit(util[_0x06cd('0x46')](_0x06cd('0x69'),_0x495692[_0x06cd('0x4e')]),_0x06cd('0x6c'),{'uri':util[_0x06cd('0x46')]('%s/%s/e',_0x1a1979[_0x06cd('0x77')],_0x2d768e['id'])});break;default:logger[_0x06cd('0x6e')](_0x06cd('0x72'),_0x06cd('0x78'));}})[_0x06cd('0x79')](function(_0x55f173){logger['error'](_0x06cd('0x72'),_0x55f173);});};exports[_0x06cd('0x7a')]=function(_0x30f3cb,_0x48043a,_0x2ba20f,_0x26c547,_0x526884,_0x4b1b95){var _0x1f8d0b,_0x4d5ec6,_0x2b4a9f,_0x5ae0e1;_0x4b1b95[_0x06cd('0x5b')]=intUtil[_0x06cd('0x5c')](_0x4b1b95[_0x06cd('0x5b')]);_0x4b1b95[_0x06cd('0x53')]=intUtil[_0x06cd('0x5c')](_0x4b1b95[_0x06cd('0x53')]);if(_0x526884&&_0x526884['monitor_format']){logger[_0x06cd('0x1a')]('['+_0x48043a['lastevent'][_0x06cd('0x7b')]()+']',_0x06cd('0x5f'));_0x48043a['recordingURL']=util['format'](_0x06cd('0x61'),_0x4b1b95[_0x06cd('0x5b')],_0x48043a[_0x06cd('0x62')],md5(_0x48043a['uniqueid']));}else{_0x48043a['recordingURL']='';}return getConnection(_0x4b1b95)[_0x06cd('0x29')](function(_0x23eb57){_0x5ae0e1=_0x23eb57;if(!_['isNil'](_0x26c547)){return getUser(_0x4b1b95,_0x26c547[_0x06cd('0x4e')],_0x5ae0e1);}else{return getUser(_0x4b1b95,null,_0x5ae0e1);}})[_0x06cd('0x29')](function(_0x3918e0){_0x1f8d0b=_0x3918e0;return getEndUser(_0x4b1b95,_0x2ba20f,_0x48043a['calleridname'],_0x48043a[_0x06cd('0x65')],_0x5ae0e1);})[_0x06cd('0x29')](function(_0x3853c9){_0x4d5ec6=_0x3853c9;return getTicket(_0x4b1b95,_0x1f8d0b,_0x4d5ec6,_0x2ba20f,_0x48043a,_0x2ba20f[_0x06cd('0x66')],_0x5ae0e1);})['then'](function(_0x5d5da6){_0x2b4a9f=_0x5d5da6;logger[_0x06cd('0x1a')]('['+_0x48043a[_0x06cd('0x7c')][_0x06cd('0x7b')]()+_0x06cd('0x7d'),_0x2b4a9f['id']);logger[_0x06cd('0x1a')]('['+_0x48043a['lastevent'][_0x06cd('0x7b')]()+_0x06cd('0x7e'),_0x4b1b95[_0x06cd('0x49')]);})[_0x06cd('0x79')](function(_0x1d0668){logger['error']('['+_0x48043a[_0x06cd('0x7c')]['toUpperCase']()+']',_0x1d0668);});}; \ 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 b0a2d7e..0590995 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 _0x254d=['?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','true','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','type','nameField','toLowerCase','content','toString','string','picklist','idField','customField','variable','variableName',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0x254d,0x173));var _0xd254=function(_0x1505e5,_0x5cc291){_0x1505e5=_0x1505e5-0x0;var _0x5b1dcd=_0x254d[_0x1505e5];return _0x5b1dcd;};'use strict';var _=require(_0xd254('0x0'));var Promise=require(_0xd254('0x1'));var rp=require(_0xd254('0x2'));var util=require(_0xd254('0x3'));var md5=require(_0xd254('0x4'));var Redis=require(_0xd254('0x5'));var intUtil=require('./util');var config=require(_0xd254('0x6'));var logger=require('../../../../config/logger')(_0xd254('0x7'));config['redis']=_['defaults'](config[_0xd254('0x8')],{'host':_0xd254('0x9'),'port':0x18eb});var io=require(_0xd254('0xa'))(new Redis(config[_0xd254('0x8')]));function getAdminUser(_0x4b9168,_0x5738d5,_0x319e6f,_0x5497bd,_0x380345,_0x39e592){return new Promise(function(_0xdf0342,_0x41ab14){var _0x4c3ae9={'method':_0xd254('0xb'),'uri':_0x5497bd+_0xd254('0xc')+'&'+_0x380345+'&'+_0x39e592,'auth':_0x5738d5,'json':!![]};return rp(_0x4c3ae9)[_0xd254('0xd')](function(_0x2d7e47){if(_0x2d7e47[_0xd254('0xe')][_0xd254('0xf')]>0x0){_0x319e6f[_0xd254('0x10')]=_0x2d7e47[_0xd254('0xe')][0x0][_0xd254('0x11')];}logger[_0xd254('0x12')]('['+[_0x4b9168[_0xd254('0x13')]()]+_0xd254('0x14'),_0x319e6f);_0xdf0342(_0x319e6f);})[_0xd254('0x15')](function(_0x113609){logger['error']('['+[_0x4b9168[_0xd254('0x13')]()]+']',_0x113609['message']);_0x41ab14(_0x113609[_0xd254('0x16')]);});});}function getUser(_0xa0835,_0x46eb1f,_0x3f6838,_0x42fe82,_0x48e0f5){return function(_0x1a0eef){logger[_0xd254('0x12')]('['+[_0xa0835[_0xd254('0x13')]()]+_0xd254('0x17'),_0x1a0eef);return new Promise(function(_0xbbe7c1,_0xe2941a){if(intUtil[_0xd254('0x18')](_0x1a0eef[_0xd254('0x19')])){var _0xbe0414={'method':'GET','uri':_0x3f6838+_0xd254('0x1a')+_0x1a0eef['userEmail']+'&'+_0x42fe82+'&'+_0x48e0f5,'auth':_0x46eb1f,'json':!![]};logger[_0xd254('0x12')]('['+[_0xa0835['toUpperCase']()]+_0xd254('0x1b'),_0xbe0414);return rp(_0xbe0414)[_0xd254('0xd')](function(_0x5753f5){logger[_0xd254('0x12')]('['+[_0xa0835[_0xd254('0x13')]()]+'],\x20getUser\x20entity',_0x5753f5);if(_0x5753f5[_0xd254('0xe')]['length']>0x0&&String(_0x5753f5[_0xd254('0xe')][0x0]['active'])===_0xd254('0x1c')){_0x1a0eef['userId']=_0x5753f5[_0xd254('0xe')][0x0][_0xd254('0x11')];}else{_0x1a0eef['userId']=_0x1a0eef['adminId'];_0x1a0eef['userEmail']=_0x1a0eef['adminEmail'];}logger[_0xd254('0x12')]('['+[_0xa0835[_0xd254('0x13')]()]+_0xd254('0x1d'),_0x1a0eef);_0xbbe7c1(_0x1a0eef);})[_0xd254('0x15')](function(_0x4fa852){logger[_0xd254('0x1e')]('['+[_0xa0835['toUpperCase']()]+']',_0x4fa852[_0xd254('0x16')]);_0xe2941a(_0x4fa852['message']);});}else{logger[_0xd254('0x12')]('['+[_0xa0835[_0xd254('0x13')]()]+_0xd254('0x1f'));_0x1a0eef[_0xd254('0x20')]=_0x1a0eef[_0xd254('0x10')];_0x1a0eef[_0xd254('0x19')]=_0x1a0eef[_0xd254('0x21')];_0xbbe7c1(_0x1a0eef);}});};}function createEndUser(_0x1506df,_0x2768a3,_0x32964b,_0x219526,_0x41add4){logger[_0xd254('0x12')]('['+[_0x1506df[_0xd254('0x13')]()]+_0xd254('0x22'),_0x32964b);return new Promise(function(_0x52615f,_0x3822df){var _0x197bc1={'method':_0xd254('0x23'),'uri':_0x219526+_0xd254('0x24')+_0x41add4,'body':{'user_name':_0x32964b[_0xd254('0x25')],'roles':'user','first_name':_0x32964b[_0xd254('0x25')],'active':_0xd254('0x1c'),'date_format':'System','phone':_0x32964b[_0xd254('0x25')]},'auth':_0x2768a3,'json':!![]};return rp(_0x197bc1)[_0xd254('0xd')](function(_0x49d6de){logger['info']('['+[_0x1506df['toUpperCase']()]+_0xd254('0x26'),_0x49d6de['result']);_0x32964b[_0xd254('0x27')]=_0x49d6de[_0xd254('0xe')][_0xd254('0x11')];_0x52615f(_0x32964b);})[_0xd254('0x15')](function(_0x2093b1){logger['error']('['+[_0x1506df[_0xd254('0x13')]()]+']',_0x2093b1[_0xd254('0x16')]);_0x3822df(_0x2093b1['message']);});});}function getEndUser(_0xdd7da4,_0xcb653d,_0x23b527,_0x49137e,_0x1ffcaf){return function(_0x13ce2b){logger[_0xd254('0x12')]('['+[_0xdd7da4[_0xd254('0x13')]()]+_0xd254('0x28'),_0x13ce2b);return new Promise(function(_0x472128,_0x1f3388){var _0x5a9187={'method':_0xd254('0xb'),'uri':_0x23b527+_0xd254('0x29')+_0x13ce2b['endUserNumber']+'&'+_0x49137e+'&'+_0x1ffcaf,'auth':_0xcb653d,'json':!![]};return rp(_0x5a9187)[_0xd254('0xd')](function(_0x5e0293){if(_0x5e0293[_0xd254('0xe')][_0xd254('0xf')]>0x0){_0x13ce2b[_0xd254('0x27')]=_0x5e0293[_0xd254('0xe')][0x0][_0xd254('0x11')];logger[_0xd254('0x12')]('['+[_0xdd7da4['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x13ce2b);_0x472128(_0x13ce2b);}else{return createEndUser(_0xdd7da4,_0xcb653d,_0x13ce2b,_0x23b527,_0x49137e)[_0xd254('0xd')](function(_0xaa43ce){logger[_0xd254('0x12')]('['+[_0xdd7da4[_0xd254('0x13')]()]+_0xd254('0x2a'),_0xaa43ce);_0x472128(_0xaa43ce);});}})['catch'](function(_0x583852){logger[_0xd254('0x1e')]('['+[_0xdd7da4['toUpperCase']()]+']',_0x583852[_0xd254('0x16')]);_0x1f3388(_0x583852['message']);});});};}function getCustomFields(_0x1d9f12,_0x3584f6){var _0x53dff5={};if(_0x1d9f12[_0xd254('0xf')]>0x0){_[_0xd254('0x2b')](_0x1d9f12,function(_0x2db9b3){if(_[_0xd254('0x2c')](['string','picklist'],_0x2db9b3[_0xd254('0x2d')])&&_0x2db9b3[_0xd254('0x2e')]&&!_0x2db9b3['customField']){_0x53dff5[_0x2db9b3[_0xd254('0x2e')][_0xd254('0x2f')]()]=_0x2db9b3[_0xd254('0x30')][_0xd254('0x31')]();}else if(_[_0xd254('0x2c')]([_0xd254('0x32'),_0xd254('0x33')],_0x2db9b3[_0xd254('0x2d')])&&_0x2db9b3[_0xd254('0x34')]&&_0x2db9b3[_0xd254('0x35')]){_0x53dff5[_0x2db9b3[_0xd254('0x34')]['toLowerCase']()]=_0x2db9b3[_0xd254('0x30')][_0xd254('0x31')]();}else if(_0x2db9b3[_0xd254('0x2d')]===_0xd254('0x36')&&_0x2db9b3[_0xd254('0x37')]&&_0x2db9b3[_0xd254('0x34')]&&_0x2db9b3[_0xd254('0x35')]){_0x53dff5[_0x2db9b3[_0xd254('0x34')][_0xd254('0x2f')]()]=_0x3584f6[_0x2db9b3[_0xd254('0x37')]][_0xd254('0x31')]();}else if(_0x2db9b3['type']==='customVariable'&&_0x2db9b3['Variable']&&_0x2db9b3['Variable']['name']&&_0x2db9b3[_0xd254('0x34')]&&_0x2db9b3[_0xd254('0x35')]){_0x53dff5[_0x2db9b3[_0xd254('0x34')][_0xd254('0x2f')]()]=_0x3584f6[_0x2db9b3['Variable']['name'][_0xd254('0x2f')]()][_0xd254('0x31')]();}});}return _0x53dff5;}function getTicket(_0xaed54f,_0x54815c,_0x23b625,_0x2ce47c,_0xe5c4cb,_0x36c80e){return function(_0x1a0dc0){logger[_0xd254('0x12')]('['+[_0xaed54f[_0xd254('0x13')]()]+_0xd254('0x38'),_0x1a0dc0);return new Promise(function(_0x3cadc1,_0x4fb6f9){var _0x228add=_0xaed54f[_0xd254('0x2f')]()===_0xd254('0x39')?_0x1a0dc0[_0xd254('0x20')]:_0x1a0dc0[_0xd254('0x27')];var _0x5e0b13={'method':_0xd254('0x23'),'uri':_0x23b625+_0xd254('0x3a')+'?'+_0x36c80e,'body':Object[_0xd254('0x3b')]({},{'active':'true','caller_id':_0x228add,'assigned_to':_0x1a0dc0[_0xd254('0x20')],'short_description':intUtil['getString'](_0x2ce47c[_0xd254('0x3c')],_0xe5c4cb,'\x20'),'description':intUtil[_0xd254('0x3d')](_0x2ce47c['Descriptions'],_0xe5c4cb,'\x0a')},getCustomFields(_0x2ce47c[_0xd254('0x3e')],_0xe5c4cb)),'auth':_0x54815c,'json':!![]};return rp(_0x5e0b13)[_0xd254('0xd')](function(_0x3d5a4f){logger['info']('['+[_0xaed54f[_0xd254('0x13')]()]+_0xd254('0x3f'),_0x3d5a4f[_0xd254('0xe')]);_0x1a0dc0[_0xd254('0x40')]=_0x3d5a4f[_0xd254('0xe')][_0xd254('0x11')];_0x1a0dc0[_0xd254('0x41')]=_0x3d5a4f[_0xd254('0xe')][_0xd254('0x42')];logger[_0xd254('0x12')]('['+[_0xaed54f[_0xd254('0x13')]()]+_0xd254('0x43'),_0x1a0dc0);_0x3cadc1(_0x1a0dc0);})[_0xd254('0x15')](function(_0x28371c){logger[_0xd254('0x1e')]('['+[_0xaed54f[_0xd254('0x13')]()]+']',_0x28371c['message']);_0x4fb6f9(_0x28371c[_0xd254('0x16')]);});});};}function createRemoteTag(_0x45c224,_0xc78187,_0x48ee50,_0x709c8){return new Promise(function(_0x1e0df1,_0x3786ea){var _0x1c2d20={'method':_0xd254('0x23'),'uri':_0x48ee50+_0xd254('0x44')+'?'+_0x709c8,'body':{'short_description':_0x45c224,'global':!![],'active':!![],'name':_0x45c224},'auth':_0xc78187,'json':!![]};return rp(_0x1c2d20)[_0xd254('0xd')](function(_0x9312ea){var _0x413dc1=_0x9312ea[_0xd254('0xe')][_0xd254('0x11')];_0x1e0df1(_0x413dc1);});});}function getRemoteTag(_0x424b6a,_0x4f00f4,_0x198e15,_0x448922,_0x24ed2c){return new Promise(function(_0x4a667e,_0x3a460d){var _0x1e35e8={'method':'GET','uri':_0x198e15+_0xd254('0x44')+_0xd254('0x45')+_0x424b6a+'&'+_0x448922,'auth':_0x4f00f4,'json':!![]};return rp(_0x1e35e8)['then'](function(_0x487ceb){if(_0x487ceb[_0xd254('0xe')][_0xd254('0xf')]>0x0){var _0x5ee53f=_0x487ceb[_0xd254('0xe')][0x0][_0xd254('0x11')];_0x4a667e(_0x5ee53f);}else{return createRemoteTag(_0x424b6a,_0x4f00f4,_0x198e15,_0x448922)[_0xd254('0xd')](function(_0x1d0634){_0x4a667e(_0x1d0634);});}});});}function assignTagToIncident(_0x45f4d2,_0x3c38de,_0x2477df,_0x342f94,_0x5c5e2c){return new Promise(function(_0x45cbb7,_0x249f57){var _0x417441={'method':_0xd254('0x23'),'uri':_0x2477df+_0xd254('0x46')+'?'+_0x5c5e2c,'body':{'label':_0x45f4d2,'table':'incident','id_type':_0xd254('0x47'),'table_key':_0x342f94[_0xd254('0x40')],'title':_0xd254('0x48')+_0x342f94['ticketNumber'],'id_display':_0x342f94['ticketNumber']},'auth':_0x3c38de,'json':!![]};return rp(_0x417441)[_0xd254('0xd')](function(_0x4cfa69){_0x45cbb7();})[_0xd254('0x15')](function(){_0x45cbb7();});});}function manageTags(_0x2d8e1c,_0x406e3b,_0x3a4f3f,_0x51a837,_0x2cd401,_0x5ab085,_0x5d72a7){return new Promise(function(_0x1f858a,_0x53f853){var _0x1b4194=[];_0x406e3b[_0xd254('0x2b')](function(_0x41412a){_0x1b4194['push'](getRemoteTag(_0x41412a,_0x3a4f3f,_0x51a837,_0x5ab085,_0x5d72a7));});return Promise[_0xd254('0x49')](_0x1b4194)['then'](function(_0x5d0e1c){if(_0x5d0e1c[_0xd254('0xf')]){logger[_0xd254('0x12')]('['+[_0x2d8e1c[_0xd254('0x13')]()]+_0xd254('0x4a'),_0x5d0e1c);var _0x10b819=[];_0x5d0e1c[_0xd254('0x2b')](function(_0x3a240a){_0x10b819['push'](assignTagToIncident(_0x3a240a,_0x3a4f3f,_0x51a837,_0x2cd401,_0x5ab085));});return Promise[_0xd254('0x49')](_0x10b819)[_0xd254('0xd')](function(){_0x1f858a();})[_0xd254('0x15')](function(){_0x1f858a();});}else{_0x1f858a();}});});}function getTags(_0x4b8325,_0x193227,_0x426d8c,_0x114529,_0x1f4e06,_0x260f7e){return function(_0x1771f4){return new Promise(function(_0x266b65,_0x3bb286){var _0x2bb28f=[];var _0x4c5301=_0x114529[_0xd254('0x4b')];if(_0x4c5301&&_0x4c5301['length']>0x0){_0x2bb28f=_['map'](_0x4c5301,_0xd254('0x4c'));}if(_0x2bb28f['length']>0x0){return manageTags(_0x4b8325,_0x2bb28f,_0x193227,_0x426d8c,_0x1771f4,_0x1f4e06,_0x260f7e)['then'](function(){_0x266b65(_0x1771f4);});}else{_0x266b65(_0x1771f4);}});};}function emit(_0xb13cee,_0x4fc95a,_0x19bada){var _0x227f82=_0xd254('0x4d')+_0xd254('0x4e')+_0xd254('0x4f')+_0xd254('0x50');var _0x12b686={'uri':_0xb13cee+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x19bada+_0x227f82};io['to'](util[_0xd254('0x51')](_0xd254('0x52'),_0x4fc95a))[_0xd254('0x53')]('trigger:browser:url',_0x12b686);}exports['cs']=function(_0x494c69,_0x595853,_0x44bf34,_0x3178bb,_0xd5b5d6,_0xe0430f,_0x71e4c8,_0x345018){var _0x338992={};var _0x16b930={'user':_0xe0430f[_0xd254('0x54')],'pass':_0xe0430f[_0xd254('0x55')]};var _0x40180a=_0xd254('0x56');var _0x64bf3f='sysparm_display_value=true';_0xe0430f[_0xd254('0x57')]=intUtil[_0xd254('0x58')](_0xe0430f['remoteUri']);_0xe0430f[_0xd254('0x59')]=intUtil['stripTrailingSlash'](_0xe0430f[_0xd254('0x59')]);var _0x188eab=util[_0xd254('0x51')](_0xd254('0x5a'),_0xe0430f['remoteUri']);_0x338992[_0xd254('0x19')]=!_[_0xd254('0x5b')](_0x3178bb)?_0x3178bb['email']:null;_0x338992[_0xd254('0x21')]=_0xe0430f[_0xd254('0x5c')];_0x338992[_0xd254('0x25')]=_0x345018[_0xd254('0x2f')]()===_0xd254('0x39')?_0x595853[_0xd254('0x5d')]:_0x595853[_0xd254('0x5e')];_0x338992[_0xd254('0x5f')]=_0x345018===_0xd254('0x60')||_0x345018===_0xd254('0x61')?'queue':_0xd254('0x39');var _0x1481e9=util[_0xd254('0x51')](_0xd254('0x62'),_0xe0430f[_0xd254('0x59')],_0x595853[_0xd254('0x63')],md5(_0x595853[_0xd254('0x63')]));if(_0xd5b5d6&&_0xd5b5d6[_0xd254('0x64')]){logger[_0xd254('0x12')](_0xd254('0x65'),'Recording\x20is\x20enabled!');_0x595853[_0xd254('0x66')]=_0x1481e9;}else if(_0x71e4c8&&_0x71e4c8[_0xd254('0x67')]&&_0x71e4c8[_0xd254('0x67')]!=='none'){logger[_0xd254('0x12')](_0xd254('0x68'),'Recording\x20is\x20enabled!');_0x595853[_0xd254('0x66')]=_0x1481e9;}else{_0x595853[_0xd254('0x66')]='';}return getAdminUser(_0x345018,_0x16b930,_0x338992,_0x188eab,_0x64bf3f,_0x40180a)['then'](getUser(_0x345018,_0x16b930,_0x188eab,_0x64bf3f,_0x40180a))[_0xd254('0xd')](getEndUser(_0x345018,_0x16b930,_0x188eab,_0x64bf3f,_0x40180a))[_0xd254('0xd')](getTicket(_0x345018,_0x16b930,_0x188eab,_0x44bf34,_0x595853,_0x64bf3f))[_0xd254('0xd')](function(_0x14f400){logger[_0xd254('0x12')](util[_0xd254('0x51')](_0xd254('0x69'),_0x14f400[_0xd254('0x40')]));logger['info'](util['format'](_0xd254('0x6a'),_0x345018));if(_0x345018!==_0xd254('0x61')){logger[_0xd254('0x12')]('['+[_0x345018[_0xd254('0x13')]()]+']',_0xd254('0x6b'));emit(_0xe0430f[_0xd254('0x57')],_0x3178bb[_0xd254('0x4c')],_0x14f400[_0xd254('0x40')]);}})[_0xd254('0x15')](function(_0x4837cb){logger['error']('['+[_0x345018[_0xd254('0x13')]()]+_0xd254('0x6c'),util[_0xd254('0x6d')](_0x4837cb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9fc2=['recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','userId',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','type','customField','toLowerCase','content','idField','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','Incident','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!'];(function(_0x3fef9c,_0x415093){var _0x24787b=function(_0x302a26){while(--_0x302a26){_0x3fef9c['push'](_0x3fef9c['shift']());}};_0x24787b(++_0x415093);}(_0x9fc2,0x1bc));var _0x29fc=function(_0x23626d,_0x31ade5){_0x23626d=_0x23626d-0x0;var _0x3afce4=_0x9fc2[_0x23626d];return _0x3afce4;};'use strict';var _=require(_0x29fc('0x0'));var Promise=require('bluebird');var rp=require(_0x29fc('0x1'));var util=require(_0x29fc('0x2'));var md5=require(_0x29fc('0x3'));var Redis=require(_0x29fc('0x4'));var intUtil=require(_0x29fc('0x5'));var config=require(_0x29fc('0x6'));var logger=require(_0x29fc('0x7'))(_0x29fc('0x8'));config['redis']=_[_0x29fc('0x9')](config[_0x29fc('0xa')],{'host':_0x29fc('0xb'),'port':0x18eb});var io=require(_0x29fc('0xc'))(new Redis(config[_0x29fc('0xa')]));function getAdminUser(_0x13cf73,_0x26f585,_0x390a45,_0x293797,_0x2d7217,_0x7b7517){return new Promise(function(_0x37c457,_0x2ab305){var _0xc0da5b={'method':_0x29fc('0xd'),'uri':_0x293797+_0x29fc('0xe')+'&'+_0x2d7217+'&'+_0x7b7517,'auth':_0x26f585,'json':!![]};return rp(_0xc0da5b)[_0x29fc('0xf')](function(_0x140b7c){if(_0x140b7c['result'][_0x29fc('0x10')]>0x0){_0x390a45[_0x29fc('0x11')]=_0x140b7c[_0x29fc('0x12')][0x0][_0x29fc('0x13')];}logger[_0x29fc('0x14')]('['+[_0x13cf73['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x390a45);_0x37c457(_0x390a45);})[_0x29fc('0x15')](function(_0x2a8614){logger[_0x29fc('0x16')]('['+[_0x13cf73[_0x29fc('0x17')]()]+']',_0x2a8614[_0x29fc('0x18')]);_0x2ab305(_0x2a8614[_0x29fc('0x18')]);});});}function getUser(_0x4512dd,_0x1535fe,_0x544f41,_0x9e398f,_0x34a84c){return function(_0x1a9bdf){logger[_0x29fc('0x14')]('['+[_0x4512dd[_0x29fc('0x17')]()]+_0x29fc('0x19'),_0x1a9bdf);return new Promise(function(_0x48d42f,_0x1152c2){if(intUtil[_0x29fc('0x1a')](_0x1a9bdf[_0x29fc('0x1b')])){var _0x115d86={'method':_0x29fc('0xd'),'uri':_0x544f41+_0x29fc('0x1c')+_0x1a9bdf[_0x29fc('0x1b')]+'&'+_0x9e398f+'&'+_0x34a84c,'auth':_0x1535fe,'json':!![]};logger[_0x29fc('0x14')]('['+[_0x4512dd[_0x29fc('0x17')]()]+_0x29fc('0x1d'),_0x115d86);return rp(_0x115d86)[_0x29fc('0xf')](function(_0x5647a0){logger['info']('['+[_0x4512dd[_0x29fc('0x17')]()]+_0x29fc('0x1e'),_0x5647a0);if(_0x5647a0[_0x29fc('0x12')][_0x29fc('0x10')]>0x0&&String(_0x5647a0[_0x29fc('0x12')][0x0]['active'])===_0x29fc('0x1f')){_0x1a9bdf[_0x29fc('0x20')]=_0x5647a0['result'][0x0][_0x29fc('0x13')];}else{_0x1a9bdf[_0x29fc('0x20')]=_0x1a9bdf[_0x29fc('0x11')];_0x1a9bdf[_0x29fc('0x1b')]=_0x1a9bdf['adminEmail'];}logger['info']('['+[_0x4512dd[_0x29fc('0x17')]()]+'],\x20getUser\x20crm',_0x1a9bdf);_0x48d42f(_0x1a9bdf);})[_0x29fc('0x15')](function(_0x2367d0){logger[_0x29fc('0x16')]('['+[_0x4512dd[_0x29fc('0x17')]()]+']',_0x2367d0[_0x29fc('0x18')]);_0x1152c2(_0x2367d0[_0x29fc('0x18')]);});}else{logger['info']('['+[_0x4512dd['toUpperCase']()]+_0x29fc('0x21'));_0x1a9bdf['userId']=_0x1a9bdf[_0x29fc('0x11')];_0x1a9bdf[_0x29fc('0x1b')]=_0x1a9bdf[_0x29fc('0x22')];_0x48d42f(_0x1a9bdf);}});};}function createEndUser(_0x1bf443,_0x36340d,_0x44b38e,_0x16ea7a,_0x218db3){logger['info']('['+[_0x1bf443['toUpperCase']()]+_0x29fc('0x23'),_0x44b38e);return new Promise(function(_0x11cf62,_0x38a288){var _0xcf870f={'method':_0x29fc('0x24'),'uri':_0x16ea7a+_0x29fc('0x25')+_0x218db3,'body':{'user_name':_0x44b38e[_0x29fc('0x26')],'roles':_0x29fc('0x27'),'first_name':_0x44b38e[_0x29fc('0x26')],'active':_0x29fc('0x1f'),'date_format':'System','phone':_0x44b38e[_0x29fc('0x26')]},'auth':_0x36340d,'json':!![]};return rp(_0xcf870f)['then'](function(_0x1098ff){logger['info']('['+[_0x1bf443[_0x29fc('0x17')]()]+_0x29fc('0x28'),_0x1098ff[_0x29fc('0x12')]);_0x44b38e[_0x29fc('0x29')]=_0x1098ff[_0x29fc('0x12')]['sys_id'];_0x11cf62(_0x44b38e);})['catch'](function(_0x273acd){logger['error']('['+[_0x1bf443['toUpperCase']()]+']',_0x273acd['message']);_0x38a288(_0x273acd[_0x29fc('0x18')]);});});}function getEndUser(_0x3eac10,_0x5f913b,_0x100854,_0x222d01,_0xd710d2){return function(_0x21fef2){logger[_0x29fc('0x14')]('['+[_0x3eac10[_0x29fc('0x17')]()]+_0x29fc('0x2a'),_0x21fef2);return new Promise(function(_0x3e172d,_0x450148){var _0x24aedb={'method':_0x29fc('0xd'),'uri':_0x100854+'sys_user?sysparm_query=phone%3D'+_0x21fef2[_0x29fc('0x26')]+'&'+_0x222d01+'&'+_0xd710d2,'auth':_0x5f913b,'json':!![]};return rp(_0x24aedb)[_0x29fc('0xf')](function(_0x199eca){if(_0x199eca[_0x29fc('0x12')][_0x29fc('0x10')]>0x0){_0x21fef2[_0x29fc('0x29')]=_0x199eca[_0x29fc('0x12')][0x0][_0x29fc('0x13')];logger['info']('['+[_0x3eac10[_0x29fc('0x17')]()]+_0x29fc('0x2b'),_0x21fef2);_0x3e172d(_0x21fef2);}else{return createEndUser(_0x3eac10,_0x5f913b,_0x21fef2,_0x100854,_0x222d01)[_0x29fc('0xf')](function(_0x41115b){logger[_0x29fc('0x14')]('['+[_0x3eac10[_0x29fc('0x17')]()]+_0x29fc('0x2c'),_0x41115b);_0x3e172d(_0x41115b);});}})[_0x29fc('0x15')](function(_0x1a4880){logger['error']('['+[_0x3eac10[_0x29fc('0x17')]()]+']',_0x1a4880[_0x29fc('0x18')]);_0x450148(_0x1a4880[_0x29fc('0x18')]);});});};}function getCustomFields(_0x4ffde6,_0x2e54ce){var _0x202276={};if(_0x4ffde6[_0x29fc('0x10')]>0x0){_['forEach'](_0x4ffde6,function(_0x485741){if(_[_0x29fc('0x2d')]([_0x29fc('0x2e'),'picklist'],_0x485741[_0x29fc('0x2f')])&&_0x485741['nameField']&&!_0x485741[_0x29fc('0x30')]){_0x202276[_0x485741['nameField'][_0x29fc('0x31')]()]=_0x485741[_0x29fc('0x32')]['toString']();}else if(_[_0x29fc('0x2d')]([_0x29fc('0x2e'),'picklist'],_0x485741[_0x29fc('0x2f')])&&_0x485741[_0x29fc('0x33')]&&_0x485741[_0x29fc('0x30')]){_0x202276[_0x485741[_0x29fc('0x33')]['toLowerCase']()]=_0x485741[_0x29fc('0x32')][_0x29fc('0x34')]();}else if(_0x485741['type']===_0x29fc('0x35')&&_0x485741[_0x29fc('0x36')]&&_0x485741[_0x29fc('0x33')]&&_0x485741[_0x29fc('0x30')]){_0x202276[_0x485741[_0x29fc('0x33')][_0x29fc('0x31')]()]=_0x2e54ce[_0x485741[_0x29fc('0x36')]]['toString']();}else if(_0x485741[_0x29fc('0x2f')]===_0x29fc('0x37')&&_0x485741[_0x29fc('0x38')]&&_0x485741[_0x29fc('0x38')][_0x29fc('0x39')]&&_0x485741[_0x29fc('0x33')]&&_0x485741['customField']){_0x202276[_0x485741[_0x29fc('0x33')][_0x29fc('0x31')]()]=_0x2e54ce[_0x485741[_0x29fc('0x38')][_0x29fc('0x39')][_0x29fc('0x31')]()][_0x29fc('0x34')]();}});}return _0x202276;}function getTicket(_0x26b16b,_0x4dbb5b,_0x41c9b6,_0x219a6c,_0x48e950,_0x13cda6){return function(_0x439145){logger[_0x29fc('0x14')]('['+[_0x26b16b[_0x29fc('0x17')]()]+_0x29fc('0x3a'),_0x439145);return new Promise(function(_0x1779dc,_0x2a26ab){var _0x3482d9=_0x26b16b[_0x29fc('0x31')]()===_0x29fc('0x3b')?_0x439145[_0x29fc('0x20')]:_0x439145[_0x29fc('0x29')];var _0x3983f4={'method':_0x29fc('0x24'),'uri':_0x41c9b6+_0x29fc('0x3c')+'?'+_0x13cda6,'body':Object[_0x29fc('0x3d')]({},{'active':'true','caller_id':_0x3482d9,'assigned_to':_0x439145[_0x29fc('0x20')],'short_description':intUtil[_0x29fc('0x3e')](_0x219a6c[_0x29fc('0x3f')],_0x48e950,'\x20'),'description':intUtil['getString'](_0x219a6c[_0x29fc('0x40')],_0x48e950,'\x0a')},getCustomFields(_0x219a6c[_0x29fc('0x41')],_0x48e950)),'auth':_0x4dbb5b,'json':!![]};return rp(_0x3983f4)['then'](function(_0x1f29bf){logger[_0x29fc('0x14')]('['+[_0x26b16b[_0x29fc('0x17')]()]+_0x29fc('0x42'),_0x1f29bf[_0x29fc('0x12')]);_0x439145[_0x29fc('0x43')]=_0x1f29bf[_0x29fc('0x12')][_0x29fc('0x13')];_0x439145[_0x29fc('0x44')]=_0x1f29bf['result'][_0x29fc('0x45')];logger[_0x29fc('0x14')]('['+[_0x26b16b[_0x29fc('0x17')]()]+']\x20getTicket\x20crm',_0x439145);_0x1779dc(_0x439145);})[_0x29fc('0x15')](function(_0x48e905){logger[_0x29fc('0x16')]('['+[_0x26b16b[_0x29fc('0x17')]()]+']',_0x48e905[_0x29fc('0x18')]);_0x2a26ab(_0x48e905['message']);});});};}function createRemoteTag(_0x1b4fbd,_0x4347c1,_0x3cdb4f,_0x52cfa9){return new Promise(function(_0x15598a,_0x2a340a){var _0x1c0a7d={'method':_0x29fc('0x24'),'uri':_0x3cdb4f+_0x29fc('0x46')+'?'+_0x52cfa9,'body':{'short_description':_0x1b4fbd,'global':!![],'active':!![],'name':_0x1b4fbd},'auth':_0x4347c1,'json':!![]};return rp(_0x1c0a7d)[_0x29fc('0xf')](function(_0x3fd8eb){var _0x1d392a=_0x3fd8eb['result']['sys_id'];_0x15598a(_0x1d392a);});});}function getRemoteTag(_0x14a48e,_0x45b3f3,_0x361104,_0x4cce87,_0x4cd6a8){return new Promise(function(_0x468f29,_0x58ed9f){var _0x5dda2b={'method':_0x29fc('0xd'),'uri':_0x361104+'label'+_0x29fc('0x47')+_0x14a48e+'&'+_0x4cce87,'auth':_0x45b3f3,'json':!![]};return rp(_0x5dda2b)['then'](function(_0x3cae5f){if(_0x3cae5f['result'][_0x29fc('0x10')]>0x0){var _0x16f048=_0x3cae5f[_0x29fc('0x12')][0x0][_0x29fc('0x13')];_0x468f29(_0x16f048);}else{return createRemoteTag(_0x14a48e,_0x45b3f3,_0x361104,_0x4cce87)[_0x29fc('0xf')](function(_0x2edfd4){_0x468f29(_0x2edfd4);});}});});}function assignTagToIncident(_0x3b885b,_0x3b1bb3,_0x3ccb15,_0x4cb88c,_0x3678aa){return new Promise(function(_0x57bb6e,_0x462643){var _0x37516f={'method':_0x29fc('0x24'),'uri':_0x3ccb15+'label_entry'+'?'+_0x3678aa,'body':{'label':_0x3b885b,'table':'incident','id_type':_0x29fc('0x48'),'table_key':_0x4cb88c['ticketId'],'title':'Incident\x20-\x20'+_0x4cb88c[_0x29fc('0x44')],'id_display':_0x4cb88c[_0x29fc('0x44')]},'auth':_0x3b1bb3,'json':!![]};return rp(_0x37516f)[_0x29fc('0xf')](function(_0x6b4da){_0x57bb6e();})['catch'](function(){_0x57bb6e();});});}function manageTags(_0x48e845,_0x455de7,_0x2f1728,_0x29f612,_0x495c0f,_0x36d351,_0x1ef594){return new Promise(function(_0x43062c,_0x1f3d4e){var _0x341a27=[];_0x455de7['forEach'](function(_0x3692d5){_0x341a27[_0x29fc('0x49')](getRemoteTag(_0x3692d5,_0x2f1728,_0x29f612,_0x36d351,_0x1ef594));});return Promise['all'](_0x341a27)['then'](function(_0x1ead7c){if(_0x1ead7c[_0x29fc('0x10')]){logger[_0x29fc('0x14')]('['+[_0x48e845['toUpperCase']()]+_0x29fc('0x4a'),_0x1ead7c);var _0x2a2a1e=[];_0x1ead7c['forEach'](function(_0x4ab296){_0x2a2a1e[_0x29fc('0x49')](assignTagToIncident(_0x4ab296,_0x2f1728,_0x29f612,_0x495c0f,_0x36d351));});return Promise[_0x29fc('0x4b')](_0x2a2a1e)[_0x29fc('0xf')](function(){_0x43062c();})[_0x29fc('0x15')](function(){_0x43062c();});}else{_0x43062c();}});});}function getTags(_0xd9a6cf,_0x3b53b4,_0xa31c83,_0x6906d,_0x2e10a2,_0x3f9a89){return function(_0x561cab){return new Promise(function(_0xe45b6e,_0xecf1e7){var _0x59f363=[];var _0xe56e07=_0x6906d[_0x29fc('0x4c')];if(_0xe56e07&&_0xe56e07[_0x29fc('0x10')]>0x0){_0x59f363=_[_0x29fc('0x4d')](_0xe56e07,_0x29fc('0x39'));}if(_0x59f363[_0x29fc('0x10')]>0x0){return manageTags(_0xd9a6cf,_0x59f363,_0x3b53b4,_0xa31c83,_0x561cab,_0x2e10a2,_0x3f9a89)[_0x29fc('0xf')](function(){_0xe45b6e(_0x561cab);});}else{_0xe45b6e(_0x561cab);}});};}function emit(_0x51f543,_0x2cbf6f,_0x4b81df){var _0x4e72b5=_0x29fc('0x4e')+_0x29fc('0x4f')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x29fc('0x50');var _0x112b71={'uri':_0x51f543+_0x29fc('0x51')+_0x4b81df+_0x4e72b5};io['to'](util['format']('user:%s',_0x2cbf6f))['emit'](_0x29fc('0x52'),_0x112b71);}exports['cs']=function(_0x478b42,_0x57e1dd,_0x50da93,_0x436afc,_0x40cc0c,_0x1dc966,_0x42e86d,_0x28adeb){var _0x4b62d8={};var _0x2a657d={'user':_0x1dc966[_0x29fc('0x53')],'pass':_0x1dc966[_0x29fc('0x54')]};var _0x331810=_0x29fc('0x55');var _0x494919=_0x29fc('0x56');_0x1dc966[_0x29fc('0x57')]=intUtil['stripTrailingSlash'](_0x1dc966[_0x29fc('0x57')]);_0x1dc966[_0x29fc('0x58')]=intUtil['stripTrailingSlash'](_0x1dc966[_0x29fc('0x58')]);var _0x4f4344=util['format'](_0x29fc('0x59'),_0x1dc966[_0x29fc('0x57')]);_0x4b62d8[_0x29fc('0x1b')]=!_['isNil'](_0x436afc)?_0x436afc[_0x29fc('0x5a')]:null;_0x4b62d8['adminEmail']=_0x1dc966['email'];_0x4b62d8['endUserNumber']=_0x28adeb['toLowerCase']()===_0x29fc('0x3b')?_0x57e1dd[_0x29fc('0x5b')]:_0x57e1dd[_0x29fc('0x5c')];_0x4b62d8[_0x29fc('0x5d')]=_0x28adeb==='queue'||_0x28adeb===_0x29fc('0x5e')?_0x29fc('0x5f'):'outbound';var _0x29f242=util[_0x29fc('0x60')](_0x29fc('0x61'),_0x1dc966[_0x29fc('0x58')],_0x57e1dd[_0x29fc('0x62')],md5(_0x57e1dd[_0x29fc('0x62')]));if(_0x40cc0c&&_0x40cc0c['monitor_format']){logger[_0x29fc('0x14')](_0x29fc('0x63'),_0x29fc('0x64'));_0x57e1dd[_0x29fc('0x65')]=_0x29f242;}else if(_0x42e86d&&_0x42e86d[_0x29fc('0x66')]&&_0x42e86d[_0x29fc('0x66')]!==_0x29fc('0x67')){logger[_0x29fc('0x14')](_0x29fc('0x68'),'Recording\x20is\x20enabled!');_0x57e1dd[_0x29fc('0x65')]=_0x29f242;}else{_0x57e1dd[_0x29fc('0x65')]='';}return getAdminUser(_0x28adeb,_0x2a657d,_0x4b62d8,_0x4f4344,_0x494919,_0x331810)[_0x29fc('0xf')](getUser(_0x28adeb,_0x2a657d,_0x4f4344,_0x494919,_0x331810))[_0x29fc('0xf')](getEndUser(_0x28adeb,_0x2a657d,_0x4f4344,_0x494919,_0x331810))[_0x29fc('0xf')](getTicket(_0x28adeb,_0x2a657d,_0x4f4344,_0x50da93,_0x57e1dd,_0x494919))[_0x29fc('0xf')](function(_0x5e2703){logger[_0x29fc('0x14')](util['format'](_0x29fc('0x69'),_0x5e2703[_0x29fc('0x43')]));logger[_0x29fc('0x14')](util[_0x29fc('0x60')]('call\x20direction:\x20%s',_0x28adeb));if(_0x28adeb!=='unmanaged'){logger[_0x29fc('0x14')]('['+[_0x28adeb['toUpperCase']()]+']',_0x29fc('0x6a'));emit(_0x1dc966[_0x29fc('0x57')],_0x436afc[_0x29fc('0x39')],_0x5e2703[_0x29fc('0x43')]);}})[_0x29fc('0x15')](function(_0x132131){logger[_0x29fc('0x16')]('['+[_0x28adeb[_0x29fc('0x17')]()]+_0x29fc('0x6b'),util[_0x29fc('0x6c')](_0x132131,{'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 8b44ca8..5731906 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 _0xc0ea=['%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Outbound','version','catch','unmanaged','monitor_format','toUpperCase','lastevent','bluebird','md5','util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','Subjects','assigned_user_id','created_by','getString','Descriptions','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','name','length','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','get_server_info','stringify','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','find','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','debug','map','type','nameField','customField','toLowerCase','content','toString','string','custom_fields','variable','customVariable','Variable','POST','login','username','password','then','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s'];(function(_0x3eed23,_0x3fcee5){var _0x499086=function(_0x594e1b){while(--_0x594e1b){_0x3eed23['push'](_0x3eed23['shift']());}};_0x499086(++_0x3fcee5);}(_0xc0ea,0xfe));var _0xac0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0ea[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0xac0e('0x0'));var md5=require(_0xac0e('0x1'));var util=require(_0xac0e('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xac0e('0x3'));var logger=require(_0xac0e('0x4'))(_0xac0e('0x5'));config[_0xac0e('0x6')]=_[_0xac0e('0x7')](config[_0xac0e('0x6')],{'host':_0xac0e('0x8'),'port':0x18eb});var io=require(_0xac0e('0x9'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x4366bf,_0x28dc10,_0x5185b1){io['to'](_0x4366bf)[_0xac0e('0xa')](_0x28dc10,_0x5185b1);}function getTicket(_0x50b179,_0x5d9350,_0x22cf11,_0x5c121a,_0x3409e3,_0x34fa8e,_0x5375b9,_0x281b18){logger['info'](_0xac0e('0xb'));var _0x3549fe=new Date();var _0x4df4fe=[{'name':'name','value':intUtil['getString'](_0x5c121a[_0xac0e('0xc')],_0x3409e3,'\x20')},{'name':_0xac0e('0xd'),'value':_0x5d9350['id']},{'name':_0xac0e('0xe'),'value':_0x5d9350['id']},{'name':'description','value':intUtil[_0xac0e('0xf')](_0x5c121a[_0xac0e('0x10')],_0x3409e3,'\x0a')},{'name':'date_start','value':_0x3549fe[_0xac0e('0x11')]()['slice'](0x0,0x13)[_0xac0e('0x12')]('T','\x20')},{'name':_0xac0e('0x13'),'value':'0'},{'name':_0xac0e('0x14'),'value':'15'},{'name':_0xac0e('0x15'),'value':_0x22cf11['id']},{'name':_0xac0e('0x16'),'value':_0xac0e('0x17')},{'name':'parent_name','value':_0x22cf11[_0xac0e('0x18')]},{'name':'direction','value':_0x281b18}];if(_0x34fa8e[_0xac0e('0x19')]){_[_0xac0e('0x1a')](_0x34fa8e,function(_0x467905){if(_0x3409e3[_0x467905[_0xac0e('0x1b')]]){_0x4df4fe[_0xac0e('0x1c')]({'name':_0x467905[_0xac0e('0x1d')],'value':_0x3409e3[_0x467905[_0xac0e('0x1b')]]});}});}return request({'form':{'method':_0xac0e('0x1e'),'input_type':_0xac0e('0x1f'),'response_type':_0xac0e('0x1f'),'rest_data':JSON['stringify']({'session':_0x5375b9['id'],'module_name':_0xac0e('0x20'),'name_value_list':_0x4df4fe})}});}function getAuth(_0x1a00e8){return util[_0xac0e('0x21')](_0xac0e('0x22'),new Buffer(_0x1a00e8['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x59e1af){return request({'form':{'method':_0xac0e('0x23'),'input_type':'JSON','response_type':_0xac0e('0x1f'),'rest_data':JSON[_0xac0e('0x24')]({'session':_0x59e1af['id']})}});}function getUser(_0x23bc8a,_0x1c66c6,_0x48ba46){if(!_[_0xac0e('0x25')](_0x1c66c6)){logger[_0xac0e('0x26')](_0xac0e('0x27'),_0x1c66c6);return request({'form':{'method':_0xac0e('0x28'),'input_type':'JSON','response_type':_0xac0e('0x1f'),'rest_data':JSON[_0xac0e('0x24')]({'session':_0x48ba46['id'],'module_name':'Employees','query':util[_0xac0e('0x21')](_0xac0e('0x29'),_0x1c66c6),'order_by':'','offset':'0','select_fields':['id',_0xac0e('0x18'),_0xac0e('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x530425){if(_0x530425['entry_list']['length']){var _0x2b702=_[_0xac0e('0x2b')](_0x530425[_0xac0e('0x2c')],function(_0x589c07){return _0x589c07[_0xac0e('0x2d')][_0xac0e('0x2a')][_0xac0e('0x2e')]===_0x1c66c6;});if(_0x2b702){logger['info'](_0xac0e('0x2f'));return BPromise[_0xac0e('0x30')]({'id':_0x2b702[_0xac0e('0x2d')]['id'][_0xac0e('0x2e')],'name':_0x2b702[_0xac0e('0x2d')]['name'][_0xac0e('0x2e')]});}}logger[_0xac0e('0x26')](_0xac0e('0x31'));return BPromise[_0xac0e('0x30')]({'id':_0x48ba46[_0xac0e('0x2d')][_0xac0e('0x32')][_0xac0e('0x2e')],'name':_0x48ba46['name_value_list'][_0xac0e('0x2a')][_0xac0e('0x2e')]});});}else{logger[_0xac0e('0x26')](_0xac0e('0x33'));return BPromise[_0xac0e('0x30')]({'id':_0x48ba46[_0xac0e('0x2d')][_0xac0e('0x32')]['value'],'name':_0x48ba46[_0xac0e('0x2d')][_0xac0e('0x2a')][_0xac0e('0x2e')]});}}function getEndUser(_0x131277,_0x15adf3,_0x31e8e4,_0x34c498){logger['info'](_0xac0e('0x34'),_0x31e8e4);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xac0e('0x1f'),'rest_data':JSON[_0xac0e('0x24')]({'session':_0x34c498['id'],'module_name':'Contacts','query':util[_0xac0e('0x21')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x31e8e4),'order_by':'','offset':'0','select_fields':['id',_0xac0e('0x18'),_0xac0e('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2abbe7){if(_0x2abbe7[_0xac0e('0x2c')][_0xac0e('0x19')]){var _0x3b15e3=_[_0xac0e('0x2b')](_0x2abbe7[_0xac0e('0x2c')],function(_0x40b59e){return _0x40b59e[_0xac0e('0x2d')][_0xac0e('0x35')]['value']===_0x31e8e4;});if(_0x3b15e3){logger[_0xac0e('0x26')](_0xac0e('0x36'));return BPromise[_0xac0e('0x30')]({'id':_0x3b15e3['name_value_list']['id'][_0xac0e('0x2e')],'name':_0x3b15e3[_0xac0e('0x2d')][_0xac0e('0x18')][_0xac0e('0x2e')],'phone':_0x3b15e3[_0xac0e('0x2d')][_0xac0e('0x35')]['value']});}}else{logger[_0xac0e('0x26')](_0xac0e('0x37'));return request({'form':{'method':_0xac0e('0x1e'),'input_type':_0xac0e('0x1f'),'response_type':_0xac0e('0x1f'),'rest_data':JSON['stringify']({'session':_0x34c498['id'],'module_name':_0xac0e('0x17'),'name_value_list':[{'name':_0xac0e('0x38'),'value':_0x15adf3!==_0xac0e('0x39')?_0x15adf3:util[_0xac0e('0x21')]('Caller\x20-\x20%s',_0x31e8e4)},{'name':_0xac0e('0x35'),'value':_0x31e8e4}]})}})['then'](function(_0x5ee9e3){logger[_0xac0e('0x26')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x5ee9e3['id'],'name':_0x5ee9e3['entry_list'][_0xac0e('0x38')]['value'],'phone':_0x5ee9e3[_0xac0e('0x2c')][_0xac0e('0x35')]['value']});});}});}function request(_0x1c5ce9){logger[_0xac0e('0x3a')]('[HTTP]',JSON[_0xac0e('0x24')](_0x1c5ce9));return rp(_['merge'](def,_0x1c5ce9));}function getTags(_0x42cb71,_0x58a2f0){var _0x2f4a1c=[];if(_0x42cb71&&_0x42cb71['length']>0x0){_0x2f4a1c=_[_0xac0e('0x3b')](_0x42cb71,_0x58a2f0);}return _0x2f4a1c;}function getCustomFields(_0x4dd887,_0x174f30){var _0x21ffab=[];var _0xc1f882={'custom_fields':[]};if(_0x4dd887[_0xac0e('0x19')]>0x0){_['forEach'](_0x4dd887,function(_0x1c9c6e){if(_0x1c9c6e[_0xac0e('0x3c')]==='string'&&_0x1c9c6e[_0xac0e('0x3d')]&&!_0x1c9c6e[_0xac0e('0x3e')]){_0xc1f882[_0x1c9c6e[_0xac0e('0x3d')][_0xac0e('0x3f')]()]=_0x1c9c6e[_0xac0e('0x40')][_0xac0e('0x41')]();}else if(_0x1c9c6e[_0xac0e('0x3c')]===_0xac0e('0x42')&&_0x1c9c6e['idField']&&_0x1c9c6e[_0xac0e('0x3e')]){_0xc1f882[_0xac0e('0x43')][_0xac0e('0x1c')]({'id':_0x1c9c6e['idField'],'value':_0x1c9c6e['content'][_0xac0e('0x41')]()});}else if(_0x1c9c6e[_0xac0e('0x3c')]===_0xac0e('0x44')&&_0x1c9c6e[_0xac0e('0x1b')]&&_0x1c9c6e[_0xac0e('0x1d')]&&_0x1c9c6e[_0xac0e('0x3e')]){_0x174f30[_0x1c9c6e[_0xac0e('0x1b')]]&&_0xc1f882[_0xac0e('0x43')][_0xac0e('0x1c')]({'id':_0x1c9c6e[_0xac0e('0x1d')],'value':_0x174f30[_0x1c9c6e[_0xac0e('0x1b')]][_0xac0e('0x41')]()});}else if(_0x1c9c6e['type']===_0xac0e('0x45')&&_0x1c9c6e[_0xac0e('0x46')]&&_0x1c9c6e[_0xac0e('0x46')]['name']&&_0x1c9c6e[_0xac0e('0x1d')]&&_0x1c9c6e['customField']){_0x174f30[_0x1c9c6e[_0xac0e('0x46')]['name'][_0xac0e('0x3f')]()]&&_0xc1f882[_0xac0e('0x43')][_0xac0e('0x1c')]({'id':_0x1c9c6e[_0xac0e('0x1d')],'value':_0x174f30[_0x1c9c6e[_0xac0e('0x46')][_0xac0e('0x18')]['toLowerCase']()][_0xac0e('0x41')]()});}});}return _0xc1f882;}function getConnection(_0x259693){return request({'method':_0xac0e('0x47'),'form':{'method':_0xac0e('0x48'),'input_type':_0xac0e('0x1f'),'response_type':_0xac0e('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x259693[_0xac0e('0x49')],'password':_0x259693[_0xac0e('0x4a')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xac0e('0x4b')](function(_0x188419){var _0x5696d3=_0x188419;if(_0x5696d3['id']){def['sessionID']=_0x5696d3['id'];return BPromise[_0xac0e('0x30')](_0x5696d3);}else{throw new Error(util[_0xac0e('0x21')](_0xac0e('0x4c'),_0x259693['id']));}});}function setRelationship(_0x11b821,_0x3b0d5a,_0x4d7b5c,_0xa7698a){return request({'form':{'method':_0xac0e('0x4d'),'input_type':'JSON','response_type':_0xac0e('0x1f'),'rest_data':JSON[_0xac0e('0x24')]({'session':_0x11b821['id'],'module_name':_0xac0e('0x20'),'module_id':_0x4d7b5c['id'],'link_field_name':_0xa7698a,'related_ids':[_0x3b0d5a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xac0e('0x4e')]=function(_0x4ae169,_0x4b2c57,_0x38e25f,_0x53e46f,_0x27e2a6,_0x707cf1){var _0x223dd5,_0x24feac,_0x30465c,_0x2c92a8;_0x707cf1[_0xac0e('0x4f')]=intUtil[_0xac0e('0x50')](_0x707cf1[_0xac0e('0x4f')]);_0x707cf1[_0xac0e('0x51')]=intUtil['stripTrailingSlash'](_0x707cf1[_0xac0e('0x51')]);def[_0xac0e('0x52')]=util['format'](_0xac0e('0x53'),_0x707cf1['remoteUri']);if(_0x27e2a6&&_0x27e2a6['monitor_format']){logger['info'](_0xac0e('0x54'),'Recording\x20is\x20enabled!');_0x4b2c57[_0xac0e('0x55')]=util[_0xac0e('0x21')](_0xac0e('0x56'),_0x707cf1[_0xac0e('0x51')],_0x4b2c57['uniqueid'],md5(_0x4b2c57[_0xac0e('0x57')]));}else{_0x4b2c57[_0xac0e('0x55')]='';}return getConnection(_0x707cf1)['then'](function(_0x3f96ab){_0x2c92a8=_0x3f96ab;return getUser(_0x707cf1,_0x53e46f[_0xac0e('0x18')],_0x2c92a8);})['then'](function(_0x5638aa){_0x223dd5=_0x5638aa;logger[_0xac0e('0x26')](_0xac0e('0x58'),_0x223dd5['id']);return getEndUser(_0x707cf1,_0x4b2c57[_0xac0e('0x59')],_0x4b2c57[_0xac0e('0x5a')],_0x2c92a8);})['then'](function(_0x4d44af){_0x24feac=_0x4d44af;logger[_0xac0e('0x26')](_0xac0e('0x5b'),_0x24feac['id']);return getTicket(_0x707cf1,_0x223dd5,_0x24feac,_0x38e25f,_0x4b2c57,_0x38e25f[_0xac0e('0x5c')],_0x2c92a8,_0xac0e('0x5d'));})['then'](function(_0x8f71bf){_0x30465c=_0x8f71bf;logger[_0xac0e('0x26')](_0xac0e('0x5e'));logger[_0xac0e('0x26')](_0xac0e('0x5f'),_0x30465c['id']);return setRelationship(_0x2c92a8,_0x223dd5,_0x30465c,_0xac0e('0x60'));})[_0xac0e('0x4b')](function(){return setRelationship(_0x2c92a8,_0x24feac,_0x30465c,_0xac0e('0x61'));})[_0xac0e('0x4b')](function(){return getServerInfo(_0x2c92a8);})[_0xac0e('0x4b')](function(_0xc03e0b){var _0x23fc26=parseInt(_0xc03e0b['version'][_0xac0e('0x62')](0x0));var _0x142526=util[_0xac0e('0x21')](_0xac0e('0x63'),_0x707cf1[_0xac0e('0x4f')],_0x30465c['id']);if(_0x23fc26>0x6){_0x142526=util[_0xac0e('0x21')](_0xac0e('0x64'),_0x707cf1[_0xac0e('0x4f')],_0x30465c['id']);}logger[_0xac0e('0x26')]('[QUEUE]',_0xac0e('0x65'));emit(util['format'](_0xac0e('0x66'),_0x53e46f[_0xac0e('0x18')]),_0xac0e('0x67'),{'uri':_0x142526});})['catch'](function(_0x2443fd){logger[_0xac0e('0x68')](_0xac0e('0x54'),JSON[_0xac0e('0x24')](_0x2443fd));});};exports[_0xac0e('0x69')]=function(_0x1021f2,_0x389745,_0x343107,_0x4cef46,_0x944167,_0x40c581,_0x3e44fc){var _0x173b9f,_0x58f0ad,_0x40438e,_0x5741df;_0x40c581[_0xac0e('0x4f')]=intUtil['stripTrailingSlash'](_0x40c581[_0xac0e('0x4f')]);_0x40c581[_0xac0e('0x51')]=intUtil[_0xac0e('0x50')](_0x40c581[_0xac0e('0x51')]);def[_0xac0e('0x52')]=util['format']('%s/service/v4_1/rest.php',_0x40c581[_0xac0e('0x4f')]);if(_0x3e44fc&&_0x3e44fc['recordingFormat']&&_0x3e44fc[_0xac0e('0x6a')]!==_0xac0e('0x6b')){logger['info'](_0xac0e('0x6c'),_0xac0e('0x6d'));_0x389745['recordingURL']=util[_0xac0e('0x21')](_0xac0e('0x56'),_0x40c581['serverUrl'],_0x389745[_0xac0e('0x57')],md5(_0x389745['uniqueid']));}return getConnection(_0x40c581)['then'](function(_0x116d85){_0x5741df=_0x116d85;return getUser(_0x40c581,_0x4cef46[_0xac0e('0x18')],_0x5741df);})['then'](function(_0x26a8f9){_0x173b9f=_0x26a8f9;logger['info'](_0xac0e('0x58'),_0x173b9f['id']);return getEndUser(_0x40c581,_0x389745['destcalleridname'],_0x389745[_0xac0e('0x6e')],_0x5741df);})[_0xac0e('0x4b')](function(_0x50ee07){_0x58f0ad=_0x50ee07;logger[_0xac0e('0x26')]('The\x20Enduser\x20ID\x20is:',_0x58f0ad['id']);return getTicket(_0x40c581,_0x173b9f,_0x58f0ad,_0x343107,_0x389745,_0x343107[_0xac0e('0x5c')],_0x5741df,_0xac0e('0x6f'));})[_0xac0e('0x4b')](function(_0x268d6a){_0x40438e=_0x268d6a;logger[_0xac0e('0x26')](_0xac0e('0x5e'));logger[_0xac0e('0x26')](_0xac0e('0x5f'),_0x40438e['id']);return setRelationship(_0x5741df,_0x173b9f,_0x40438e,_0xac0e('0x60'));})[_0xac0e('0x4b')](function(){return setRelationship(_0x5741df,_0x58f0ad,_0x40438e,_0xac0e('0x61'));})['then'](function(){return getServerInfo(_0x5741df);})[_0xac0e('0x4b')](function(_0x252335){var _0x2c302f=parseInt(_0x252335[_0xac0e('0x70')]['charAt'](0x0));var _0x5563cc=util[_0xac0e('0x21')](_0xac0e('0x63'),_0x40c581['remoteUri'],_0x40438e['id']);if(_0x2c302f>0x6){_0x5563cc=util[_0xac0e('0x21')](_0xac0e('0x64'),_0x40c581[_0xac0e('0x4f')],_0x40438e['id']);}logger[_0xac0e('0x26')](_0xac0e('0x6c'),_0xac0e('0x65'));emit(util[_0xac0e('0x21')]('user:%s',_0x4cef46[_0xac0e('0x18')]),_0xac0e('0x67'),{'uri':_0x5563cc});})[_0xac0e('0x71')](function(_0x94604e){logger[_0xac0e('0x68')](_0xac0e('0x6c'),JSON[_0xac0e('0x24')](_0x94604e));});};exports[_0xac0e('0x72')]=function(_0x211d87,_0x4f6445,_0x2bbeb8,_0x156e98,_0x2e39d8,_0x532cde){var _0x29c225,_0x567666,_0x5151b8,_0x580a01;_0x532cde['remoteUri']=intUtil[_0xac0e('0x50')](_0x532cde[_0xac0e('0x4f')]);_0x532cde[_0xac0e('0x51')]=intUtil[_0xac0e('0x50')](_0x532cde[_0xac0e('0x51')]);def[_0xac0e('0x52')]=util['format'](_0xac0e('0x53'),_0x532cde[_0xac0e('0x4f')]);if(_0x2e39d8&&_0x2e39d8[_0xac0e('0x73')]){logger[_0xac0e('0x26')]('['+_0x4f6445['lastevent'][_0xac0e('0x74')]()+']',_0xac0e('0x6d'));_0x4f6445[_0xac0e('0x55')]=util[_0xac0e('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x532cde[_0xac0e('0x51')],_0x4f6445['uniqueid'],md5(_0x4f6445[_0xac0e('0x57')]));}else{_0x4f6445[_0xac0e('0x55')]='';}return getConnection(_0x532cde)[_0xac0e('0x4b')](function(_0x7090b8){_0x580a01=_0x7090b8;if(!_[_0xac0e('0x25')](_0x156e98)){return getUser(_0x532cde,_0x156e98['name'],_0x580a01);}else{return getUser(_0x532cde,null,_0x580a01);}})[_0xac0e('0x4b')](function(_0x5d47e1){_0x29c225=_0x5d47e1;logger['info']('The\x20User\x20ID\x20is:',_0x29c225['id']);return getEndUser(_0x532cde,_0x4f6445[_0xac0e('0x59')],_0x4f6445[_0xac0e('0x5a')],_0x580a01);})['then'](function(_0x5668e1){_0x567666=_0x5668e1;logger[_0xac0e('0x26')](_0xac0e('0x5b'),_0x567666['id']);return getTicket(_0x532cde,_0x29c225,_0x567666,_0x2bbeb8,_0x4f6445,_0x2bbeb8['Fields'],_0x580a01,_0xac0e('0x5d'));})['then'](function(_0x3c9b28){_0x5151b8=_0x3c9b28;logger[_0xac0e('0x26')](_0xac0e('0x5e'));logger[_0xac0e('0x26')]('The\x20Ticket\x20ID\x20is:',_0x5151b8['id']);return setRelationship(_0x580a01,_0x29c225,_0x5151b8,_0xac0e('0x60'));})['then'](function(){return setRelationship(_0x580a01,_0x567666,_0x5151b8,_0xac0e('0x61'));})[_0xac0e('0x4b')](function(){return getServerInfo(_0x580a01);})[_0xac0e('0x71')](function(_0x3e7aee){logger[_0xac0e('0x68')]('['+_0x4f6445[_0xac0e('0x75')]['toUpperCase']()+']',JSON[_0xac0e('0x24')](_0x3e7aee));});}; \ No newline at end of file +var _0x3d46=['type','customField','nameField','toLowerCase','content','string','idField','variable','custom_fields','customVariable','Variable','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','trigger:browser:url','error','toUpperCase','isNil','lastevent','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','socket.io-emitter','emit','info','name','assigned_user_id','created_by','description','Descriptions','date_start','slice','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','Getting\x20agent\x20with\x20name','get_entry_list','Employees','then','entry_list','find','user_name','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug'];(function(_0x298b2,_0x2ab3a1){var _0x48005a=function(_0x4b55fd){while(--_0x4b55fd){_0x298b2['push'](_0x298b2['shift']());}};_0x48005a(++_0x2ab3a1);}(_0x3d46,0x128));var _0x63d4=function(_0x22bc6c,_0x3efcd9){_0x22bc6c=_0x22bc6c-0x0;var _0x5c7ef8=_0x3d46[_0x22bc6c];return _0x5c7ef8;};'use strict';var _=require(_0x63d4('0x0'));var rp=require(_0x63d4('0x1'));var BPromise=require(_0x63d4('0x2'));var md5=require('md5');var util=require(_0x63d4('0x3'));var Redis=require(_0x63d4('0x4'));var intUtil=require(_0x63d4('0x5'));var config=require(_0x63d4('0x6'));var logger=require(_0x63d4('0x7'))(_0x63d4('0x8'));config['redis']=_[_0x63d4('0x9')](config[_0x63d4('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x63d4('0xb'))(new Redis(config[_0x63d4('0xa')]));var def={'method':'POST','json':!![]};function emit(_0x4257d4,_0x26c838,_0x204755){io['to'](_0x4257d4)[_0x63d4('0xc')](_0x26c838,_0x204755);}function getTicket(_0x110f2c,_0x376ee6,_0x1ffeb8,_0x2e7992,_0x5df8e0,_0x1329b9,_0x3629fe,_0xe6dda0){logger[_0x63d4('0xd')]('Creating\x20new\x20ticket...');var _0x1cef10=new Date();var _0x22e971=[{'name':_0x63d4('0xe'),'value':intUtil['getString'](_0x2e7992['Subjects'],_0x5df8e0,'\x20')},{'name':_0x63d4('0xf'),'value':_0x376ee6['id']},{'name':_0x63d4('0x10'),'value':_0x376ee6['id']},{'name':_0x63d4('0x11'),'value':intUtil['getString'](_0x2e7992[_0x63d4('0x12')],_0x5df8e0,'\x0a')},{'name':_0x63d4('0x13'),'value':_0x1cef10['toISOString']()[_0x63d4('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':_0x63d4('0x15'),'value':'0'},{'name':_0x63d4('0x16'),'value':'15'},{'name':_0x63d4('0x17'),'value':_0x1ffeb8['id']},{'name':_0x63d4('0x18'),'value':_0x63d4('0x19')},{'name':_0x63d4('0x1a'),'value':_0x1ffeb8[_0x63d4('0xe')]},{'name':'direction','value':_0xe6dda0}];if(_0x1329b9[_0x63d4('0x1b')]){_[_0x63d4('0x1c')](_0x1329b9,function(_0x397252){if(_0x5df8e0[_0x397252[_0x63d4('0x1d')]]){_0x22e971[_0x63d4('0x1e')]({'name':_0x397252['idField'],'value':_0x5df8e0[_0x397252['variableName']]});}});}return request({'form':{'method':_0x63d4('0x1f'),'input_type':_0x63d4('0x20'),'response_type':'JSON','rest_data':JSON[_0x63d4('0x21')]({'session':_0x3629fe['id'],'module_name':_0x63d4('0x22'),'name_value_list':_0x22e971})}});}function getAuth(_0x7709b8){return util[_0x63d4('0x23')](_0x63d4('0x24'),new Buffer(_0x7709b8[_0x63d4('0x25')]+':X')[_0x63d4('0x26')](_0x63d4('0x27')));}function getServerInfo(_0x4bcd28){return request({'form':{'method':_0x63d4('0x28'),'input_type':_0x63d4('0x20'),'response_type':_0x63d4('0x20'),'rest_data':JSON[_0x63d4('0x21')]({'session':_0x4bcd28['id']})}});}function getUser(_0x4e4366,_0x14b441,_0x335a86){if(!_['isNil'](_0x14b441)){logger[_0x63d4('0xd')](_0x63d4('0x29'),_0x14b441);return request({'form':{'method':_0x63d4('0x2a'),'input_type':_0x63d4('0x20'),'response_type':'JSON','rest_data':JSON[_0x63d4('0x21')]({'session':_0x335a86['id'],'module_name':_0x63d4('0x2b'),'query':util[_0x63d4('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x14b441),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x63d4('0x2c')](function(_0x561d36){if(_0x561d36[_0x63d4('0x2d')][_0x63d4('0x1b')]){var _0x253ec7=_[_0x63d4('0x2e')](_0x561d36[_0x63d4('0x2d')],function(_0x3f72ea){return _0x3f72ea['name_value_list'][_0x63d4('0x2f')][_0x63d4('0x30')]===_0x14b441;});if(_0x253ec7){logger[_0x63d4('0xd')](_0x63d4('0x31'));return BPromise['resolve']({'id':_0x253ec7[_0x63d4('0x32')]['id'][_0x63d4('0x30')],'name':_0x253ec7[_0x63d4('0x32')][_0x63d4('0xe')]['value']});}}logger[_0x63d4('0xd')](_0x63d4('0x33'));return BPromise[_0x63d4('0x34')]({'id':_0x335a86[_0x63d4('0x32')][_0x63d4('0x35')][_0x63d4('0x30')],'name':_0x335a86['name_value_list'][_0x63d4('0x2f')]['value']});});}else{logger[_0x63d4('0xd')](_0x63d4('0x36'));return BPromise[_0x63d4('0x34')]({'id':_0x335a86[_0x63d4('0x32')][_0x63d4('0x35')]['value'],'name':_0x335a86[_0x63d4('0x32')]['user_name'][_0x63d4('0x30')]});}}function getEndUser(_0x4ec29c,_0x788434,_0x4868d9,_0x5ad13b){logger[_0x63d4('0xd')](_0x63d4('0x37'),_0x4868d9);return request({'form':{'method':_0x63d4('0x2a'),'input_type':'JSON','response_type':_0x63d4('0x20'),'rest_data':JSON[_0x63d4('0x21')]({'session':_0x5ad13b['id'],'module_name':_0x63d4('0x19'),'query':util[_0x63d4('0x23')](_0x63d4('0x38'),_0x4868d9),'order_by':'','offset':'0','select_fields':['id',_0x63d4('0xe'),_0x63d4('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x63d4('0x2c')](function(_0x353f7e){if(_0x353f7e[_0x63d4('0x2d')][_0x63d4('0x1b')]){var _0x2298e0=_[_0x63d4('0x2e')](_0x353f7e[_0x63d4('0x2d')],function(_0xdecef0){return _0xdecef0['name_value_list']['phone_home'][_0x63d4('0x30')]===_0x4868d9;});if(_0x2298e0){logger['info']('Enduser\x20found!');return BPromise['resolve']({'id':_0x2298e0[_0x63d4('0x32')]['id'][_0x63d4('0x30')],'name':_0x2298e0[_0x63d4('0x32')]['name'][_0x63d4('0x30')],'phone':_0x2298e0[_0x63d4('0x32')][_0x63d4('0x39')][_0x63d4('0x30')]});}}else{logger[_0x63d4('0xd')](_0x63d4('0x3a'));return request({'form':{'method':_0x63d4('0x1f'),'input_type':_0x63d4('0x20'),'response_type':_0x63d4('0x20'),'rest_data':JSON[_0x63d4('0x21')]({'session':_0x5ad13b['id'],'module_name':_0x63d4('0x19'),'name_value_list':[{'name':_0x63d4('0x3b'),'value':_0x788434!==_0x63d4('0x3c')?_0x788434:util[_0x63d4('0x23')](_0x63d4('0x3d'),_0x4868d9)},{'name':_0x63d4('0x39'),'value':_0x4868d9}]})}})[_0x63d4('0x2c')](function(_0x3cf869){logger[_0x63d4('0xd')](_0x63d4('0x3e'));return BPromise['resolve']({'id':_0x3cf869['id'],'name':_0x3cf869[_0x63d4('0x2d')]['first_name'][_0x63d4('0x30')],'phone':_0x3cf869['entry_list'][_0x63d4('0x39')]['value']});});}});}function request(_0x1c2505){logger[_0x63d4('0x3f')]('[HTTP]',JSON[_0x63d4('0x21')](_0x1c2505));return rp(_['merge'](def,_0x1c2505));}function getTags(_0x9e2789,_0x14f6df){var _0x841d29=[];if(_0x9e2789&&_0x9e2789[_0x63d4('0x1b')]>0x0){_0x841d29=_['map'](_0x9e2789,_0x14f6df);}return _0x841d29;}function getCustomFields(_0x472eee,_0x1afdda){var _0xb76541=[];var _0x491319={'custom_fields':[]};if(_0x472eee[_0x63d4('0x1b')]>0x0){_[_0x63d4('0x1c')](_0x472eee,function(_0x35ce5d){if(_0x35ce5d[_0x63d4('0x40')]==='string'&&_0x35ce5d['nameField']&&!_0x35ce5d[_0x63d4('0x41')]){_0x491319[_0x35ce5d[_0x63d4('0x42')][_0x63d4('0x43')]()]=_0x35ce5d[_0x63d4('0x44')]['toString']();}else if(_0x35ce5d[_0x63d4('0x40')]===_0x63d4('0x45')&&_0x35ce5d[_0x63d4('0x46')]&&_0x35ce5d[_0x63d4('0x41')]){_0x491319['custom_fields'][_0x63d4('0x1e')]({'id':_0x35ce5d[_0x63d4('0x46')],'value':_0x35ce5d[_0x63d4('0x44')]['toString']()});}else if(_0x35ce5d[_0x63d4('0x40')]===_0x63d4('0x47')&&_0x35ce5d[_0x63d4('0x1d')]&&_0x35ce5d[_0x63d4('0x46')]&&_0x35ce5d['customField']){_0x1afdda[_0x35ce5d['variableName']]&&_0x491319[_0x63d4('0x48')]['push']({'id':_0x35ce5d[_0x63d4('0x46')],'value':_0x1afdda[_0x35ce5d['variableName']]['toString']()});}else if(_0x35ce5d[_0x63d4('0x40')]===_0x63d4('0x49')&&_0x35ce5d['Variable']&&_0x35ce5d[_0x63d4('0x4a')][_0x63d4('0xe')]&&_0x35ce5d[_0x63d4('0x46')]&&_0x35ce5d['customField']){_0x1afdda[_0x35ce5d[_0x63d4('0x4a')]['name'][_0x63d4('0x43')]()]&&_0x491319['custom_fields'][_0x63d4('0x1e')]({'id':_0x35ce5d['idField'],'value':_0x1afdda[_0x35ce5d[_0x63d4('0x4a')][_0x63d4('0xe')][_0x63d4('0x43')]()][_0x63d4('0x26')]()});}});}return _0x491319;}function getConnection(_0x4bfe69){return request({'method':'POST','form':{'method':'login','input_type':_0x63d4('0x20'),'response_type':'JSON','rest_data':JSON[_0x63d4('0x21')]({'user_auth':{'user_name':_0x4bfe69[_0x63d4('0x4b')],'password':_0x4bfe69['password'],'encryption':_0x63d4('0x4c')},'application':_0x63d4('0x4d')})}})['then'](function(_0x469535){var _0xd81d3f=_0x469535;if(_0xd81d3f['id']){def[_0x63d4('0x4e')]=_0xd81d3f['id'];return BPromise[_0x63d4('0x34')](_0xd81d3f);}else{throw new Error(util[_0x63d4('0x23')](_0x63d4('0x4f'),_0x4bfe69['id']));}});}function setRelationship(_0x365ff1,_0x229604,_0x4767d2,_0x1f97ce){return request({'form':{'method':_0x63d4('0x50'),'input_type':'JSON','response_type':_0x63d4('0x20'),'rest_data':JSON['stringify']({'session':_0x365ff1['id'],'module_name':_0x63d4('0x22'),'module_id':_0x4767d2['id'],'link_field_name':_0x1f97ce,'related_ids':[_0x229604['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x63d4('0x51')]=function(_0x5bc841,_0x44e0b8,_0x80764d,_0x3fa88f,_0x256ec8,_0x3d1074){var _0xc7a35b,_0x18a8bc,_0x5d9765,_0x3c15e7;_0x3d1074[_0x63d4('0x52')]=intUtil[_0x63d4('0x53')](_0x3d1074[_0x63d4('0x52')]);_0x3d1074[_0x63d4('0x54')]=intUtil['stripTrailingSlash'](_0x3d1074[_0x63d4('0x54')]);def[_0x63d4('0x55')]=util[_0x63d4('0x23')](_0x63d4('0x56'),_0x3d1074['remoteUri']);if(_0x256ec8&&_0x256ec8[_0x63d4('0x57')]){logger[_0x63d4('0xd')]('[QUEUE]',_0x63d4('0x58'));_0x44e0b8[_0x63d4('0x59')]=util[_0x63d4('0x23')](_0x63d4('0x5a'),_0x3d1074[_0x63d4('0x54')],_0x44e0b8['uniqueid'],md5(_0x44e0b8[_0x63d4('0x5b')]));}else{_0x44e0b8[_0x63d4('0x59')]='';}return getConnection(_0x3d1074)[_0x63d4('0x2c')](function(_0x4a166b){_0x3c15e7=_0x4a166b;return getUser(_0x3d1074,_0x3fa88f[_0x63d4('0xe')],_0x3c15e7);})[_0x63d4('0x2c')](function(_0xd6b8ab){_0xc7a35b=_0xd6b8ab;logger[_0x63d4('0xd')](_0x63d4('0x5c'),_0xc7a35b['id']);return getEndUser(_0x3d1074,_0x44e0b8[_0x63d4('0x5d')],_0x44e0b8[_0x63d4('0x5e')],_0x3c15e7);})[_0x63d4('0x2c')](function(_0x507eba){_0x18a8bc=_0x507eba;logger['info'](_0x63d4('0x5f'),_0x18a8bc['id']);return getTicket(_0x3d1074,_0xc7a35b,_0x18a8bc,_0x80764d,_0x44e0b8,_0x80764d[_0x63d4('0x60')],_0x3c15e7,_0x63d4('0x61'));})[_0x63d4('0x2c')](function(_0x24870b){_0x5d9765=_0x24870b;logger[_0x63d4('0xd')]('Ticket\x20created!');logger[_0x63d4('0xd')](_0x63d4('0x62'),_0x5d9765['id']);return setRelationship(_0x3c15e7,_0xc7a35b,_0x5d9765,_0x63d4('0x63'));})[_0x63d4('0x2c')](function(){return setRelationship(_0x3c15e7,_0x18a8bc,_0x5d9765,_0x63d4('0x64'));})[_0x63d4('0x2c')](function(){return getServerInfo(_0x3c15e7);})['then'](function(_0x58b052){var _0x28a226=parseInt(_0x58b052[_0x63d4('0x65')][_0x63d4('0x66')](0x0));var _0x4e092c=util[_0x63d4('0x23')](_0x63d4('0x67'),_0x3d1074[_0x63d4('0x52')],_0x5d9765['id']);if(_0x28a226>0x6){_0x4e092c=util['format'](_0x63d4('0x68'),_0x3d1074[_0x63d4('0x52')],_0x5d9765['id']);}logger[_0x63d4('0xd')]('[QUEUE]',_0x63d4('0x69'));emit(util['format'](_0x63d4('0x6a'),_0x3fa88f[_0x63d4('0xe')]),'trigger:browser:url',{'uri':_0x4e092c});})[_0x63d4('0x6b')](function(_0x44f53a){logger['error']('[QUEUE]',JSON[_0x63d4('0x21')](_0x44f53a));});};exports[_0x63d4('0x6c')]=function(_0x2cbdb0,_0x577b8a,_0x8c9f57,_0x418e4d,_0x570052,_0x6261a9,_0x1173a8){var _0x40c2ab,_0x1ef055,_0x178221,_0x55f688;_0x6261a9['remoteUri']=intUtil[_0x63d4('0x53')](_0x6261a9[_0x63d4('0x52')]);_0x6261a9[_0x63d4('0x54')]=intUtil[_0x63d4('0x53')](_0x6261a9[_0x63d4('0x54')]);def[_0x63d4('0x55')]=util['format'](_0x63d4('0x56'),_0x6261a9[_0x63d4('0x52')]);if(_0x1173a8&&_0x1173a8['recordingFormat']&&_0x1173a8['recordingFormat']!==_0x63d4('0x6d')){logger['info'](_0x63d4('0x6e'),_0x63d4('0x58'));_0x577b8a[_0x63d4('0x59')]=util[_0x63d4('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6261a9[_0x63d4('0x54')],_0x577b8a['uniqueid'],md5(_0x577b8a[_0x63d4('0x5b')]));}return getConnection(_0x6261a9)[_0x63d4('0x2c')](function(_0x4931af){_0x55f688=_0x4931af;return getUser(_0x6261a9,_0x418e4d[_0x63d4('0xe')],_0x55f688);})[_0x63d4('0x2c')](function(_0x537ae3){_0x40c2ab=_0x537ae3;logger[_0x63d4('0xd')](_0x63d4('0x5c'),_0x40c2ab['id']);return getEndUser(_0x6261a9,_0x577b8a[_0x63d4('0x6f')],_0x577b8a[_0x63d4('0x70')],_0x55f688);})[_0x63d4('0x2c')](function(_0x50609a){_0x1ef055=_0x50609a;logger[_0x63d4('0xd')](_0x63d4('0x5f'),_0x1ef055['id']);return getTicket(_0x6261a9,_0x40c2ab,_0x1ef055,_0x8c9f57,_0x577b8a,_0x8c9f57[_0x63d4('0x60')],_0x55f688,_0x63d4('0x71'));})[_0x63d4('0x2c')](function(_0x5d9cfc){_0x178221=_0x5d9cfc;logger[_0x63d4('0xd')](_0x63d4('0x72'));logger['info'](_0x63d4('0x62'),_0x178221['id']);return setRelationship(_0x55f688,_0x40c2ab,_0x178221,'users');})[_0x63d4('0x2c')](function(){return setRelationship(_0x55f688,_0x1ef055,_0x178221,_0x63d4('0x64'));})['then'](function(){return getServerInfo(_0x55f688);})['then'](function(_0x1e8d99){var _0x47ed9=parseInt(_0x1e8d99[_0x63d4('0x65')][_0x63d4('0x66')](0x0));var _0x5ea33f=util[_0x63d4('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x6261a9[_0x63d4('0x52')],_0x178221['id']);if(_0x47ed9>0x6){_0x5ea33f=util[_0x63d4('0x23')](_0x63d4('0x68'),_0x6261a9['remoteUri'],_0x178221['id']);}logger[_0x63d4('0xd')](_0x63d4('0x6e'),_0x63d4('0x69'));emit(util[_0x63d4('0x23')]('user:%s',_0x418e4d['name']),_0x63d4('0x73'),{'uri':_0x5ea33f});})['catch'](function(_0x55d0c1){logger[_0x63d4('0x74')]('[OUTBOUND]',JSON[_0x63d4('0x21')](_0x55d0c1));});};exports['unmanaged']=function(_0x174c90,_0x2904db,_0x36b355,_0x17dfe7,_0x3fc546,_0x44e303){var _0x2e81f9,_0x2ff229,_0x289b47,_0x557324;_0x44e303[_0x63d4('0x52')]=intUtil['stripTrailingSlash'](_0x44e303['remoteUri']);_0x44e303[_0x63d4('0x54')]=intUtil[_0x63d4('0x53')](_0x44e303[_0x63d4('0x54')]);def['uri']=util[_0x63d4('0x23')](_0x63d4('0x56'),_0x44e303[_0x63d4('0x52')]);if(_0x3fc546&&_0x3fc546[_0x63d4('0x57')]){logger['info']('['+_0x2904db['lastevent'][_0x63d4('0x75')]()+']',_0x63d4('0x58'));_0x2904db[_0x63d4('0x59')]=util[_0x63d4('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x44e303[_0x63d4('0x54')],_0x2904db[_0x63d4('0x5b')],md5(_0x2904db[_0x63d4('0x5b')]));}else{_0x2904db[_0x63d4('0x59')]='';}return getConnection(_0x44e303)[_0x63d4('0x2c')](function(_0x1a3940){_0x557324=_0x1a3940;if(!_[_0x63d4('0x76')](_0x17dfe7)){return getUser(_0x44e303,_0x17dfe7[_0x63d4('0xe')],_0x557324);}else{return getUser(_0x44e303,null,_0x557324);}})['then'](function(_0x4e8f42){_0x2e81f9=_0x4e8f42;logger['info']('The\x20User\x20ID\x20is:',_0x2e81f9['id']);return getEndUser(_0x44e303,_0x2904db[_0x63d4('0x5d')],_0x2904db[_0x63d4('0x5e')],_0x557324);})[_0x63d4('0x2c')](function(_0x42aee7){_0x2ff229=_0x42aee7;logger['info'](_0x63d4('0x5f'),_0x2ff229['id']);return getTicket(_0x44e303,_0x2e81f9,_0x2ff229,_0x36b355,_0x2904db,_0x36b355[_0x63d4('0x60')],_0x557324,_0x63d4('0x61'));})[_0x63d4('0x2c')](function(_0x4f16e1){_0x289b47=_0x4f16e1;logger['info']('Ticket\x20created!');logger[_0x63d4('0xd')](_0x63d4('0x62'),_0x289b47['id']);return setRelationship(_0x557324,_0x2e81f9,_0x289b47,_0x63d4('0x63'));})[_0x63d4('0x2c')](function(){return setRelationship(_0x557324,_0x2ff229,_0x289b47,'contacts');})[_0x63d4('0x2c')](function(){return getServerInfo(_0x557324);})[_0x63d4('0x6b')](function(_0x22fc7f){logger[_0x63d4('0x74')]('['+_0x2904db[_0x63d4('0x77')][_0x63d4('0x75')]()+']',JSON['stringify'](_0x22fc7f));});}; \ 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 4daa2e7..fdca3ba 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 _0xdc3c=['test','lodash','util','getString','sortBy','type','content','variable','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','validateEmail','isNil'];(function(_0x3bbc07,_0x596706){var _0x1eca5a=function(_0x3ecdd3){while(--_0x3ecdd3){_0x3bbc07['push'](_0x3bbc07['shift']());}};_0x1eca5a(++_0x596706);}(_0xdc3c,0xbe));var _0xcdc3=function(_0xc87585,_0x39b8df){_0xc87585=_0xc87585-0x0;var _0x50a292=_0xdc3c[_0xc87585];return _0x50a292;};'use strict';var _=require(_0xcdc3('0x0'));var util=require(_0xcdc3('0x1'));exports[_0xcdc3('0x2')]=function(_0x53dd59,_0x719239,_0x19a016){var _0xfc2dc0=[];if(_0x53dd59['length']>0x0){var _0x1da859=_[_0xcdc3('0x3')](_0x53dd59,['id']);for(var _0x50cb30=0x0;_0x50cb30<_0x1da859['length'];_0x50cb30++){var _0x15afab=_0x1da859[_0x50cb30];if(_0x15afab[_0xcdc3('0x4')]==='string'){_0xfc2dc0['push'](_0x15afab[_0xcdc3('0x5')]);}else if(_0x15afab[_0xcdc3('0x4')]===_0xcdc3('0x6')&&_0x15afab[_0xcdc3('0x7')]){_0x719239[_0x15afab['variableName']]&&_0xfc2dc0[_0xcdc3('0x8')](_0x719239[_0x15afab[_0xcdc3('0x7')]][_0xcdc3('0x9')]());}else if(_0x15afab['type']===_0xcdc3('0xa')&&_0x15afab['Variable']&&_0x15afab[_0xcdc3('0xb')][_0xcdc3('0xc')]){_0x719239[_0x15afab['Variable']['name'][_0xcdc3('0xd')]()]&&_0xfc2dc0[_0xcdc3('0x8')](_0x719239[_0x15afab[_0xcdc3('0xb')]['name'][_0xcdc3('0xd')]()][_0xcdc3('0x9')]());}else if(_0x15afab[_0xcdc3('0x4')]===_0xcdc3('0xe')){if(_0x15afab[_0xcdc3('0xf')]===_0xcdc3('0x10')&&_0x15afab[_0xcdc3('0x11')]){_0xfc2dc0[_0xcdc3('0x8')](util[_0xcdc3('0x12')](_0xcdc3('0x13'),_0x15afab['key'],_0x15afab[_0xcdc3('0x14')]));}else if(_0x15afab['keyType']===_0xcdc3('0x6')&&_0x15afab[_0xcdc3('0x7')]&&_0x15afab[_0xcdc3('0x11')]){_0x719239[_0x15afab[_0xcdc3('0x7')]]&&_0xfc2dc0[_0xcdc3('0x8')](util['format'](_0xcdc3('0x13'),_0x15afab[_0xcdc3('0x11')],_0x719239[_0x15afab[_0xcdc3('0x7')]]));}else if(_0x15afab[_0xcdc3('0xf')]==='customVariable'&&_0x15afab[_0xcdc3('0xb')]&&_0x15afab[_0xcdc3('0xb')][_0xcdc3('0xc')]&&_0x15afab['key']){_0x719239[_0x15afab[_0xcdc3('0xb')][_0xcdc3('0xc')][_0xcdc3('0xd')]()]&&_0xfc2dc0['push'](util[_0xcdc3('0x12')](_0xcdc3('0x13'),_0x15afab[_0xcdc3('0x11')],_0x719239[_0x15afab[_0xcdc3('0xb')][_0xcdc3('0xc')][_0xcdc3('0xd')]()]));}}}}return _0xfc2dc0[_0xcdc3('0x15')](_0x19a016);};exports[_0xcdc3('0x16')]=function(_0x93d2e5){var _0x1ed777=_0x93d2e5[_0xcdc3('0x17')](-0x1);if(_0x1ed777==='/'){_0x93d2e5=_0x93d2e5['substring'](0x0,_0x93d2e5['lastIndexOf'](_0x1ed777));}return _0x93d2e5;};exports[_0xcdc3('0x18')]=function(_0xe9a345){if(!_[_0xcdc3('0x19')](_0xe9a345)&&_0xe9a345!==''){var _0x2e198c=/^(([^<>()\[\]\\.,;:\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 _0x2e198c[_0xcdc3('0x1a')](String(_0xe9a345)[_0xcdc3('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x31d7=['push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','util','getString','length','sortBy','type','string'];(function(_0x4e9df6,_0x5218a6){var _0x440983=function(_0x5f1d58){while(--_0x5f1d58){_0x4e9df6['push'](_0x4e9df6['shift']());}};_0x440983(++_0x5218a6);}(_0x31d7,0x173));var _0x731d=function(_0x1ec08c,_0x1eae46){_0x1ec08c=_0x1ec08c-0x0;var _0x5cbfae=_0x31d7[_0x1ec08c];return _0x5cbfae;};'use strict';var _=require(_0x731d('0x0'));var util=require(_0x731d('0x1'));exports[_0x731d('0x2')]=function(_0x390322,_0x5712bc,_0x1f5e78){var _0x1b3ea0=[];if(_0x390322[_0x731d('0x3')]>0x0){var _0xc9bdf1=_[_0x731d('0x4')](_0x390322,['id']);for(var _0x10e9f3=0x0;_0x10e9f3<_0xc9bdf1[_0x731d('0x3')];_0x10e9f3++){var _0x7788f7=_0xc9bdf1[_0x10e9f3];if(_0x7788f7[_0x731d('0x5')]===_0x731d('0x6')){_0x1b3ea0[_0x731d('0x7')](_0x7788f7[_0x731d('0x8')]);}else if(_0x7788f7[_0x731d('0x5')]===_0x731d('0x9')&&_0x7788f7['variableName']){_0x5712bc[_0x7788f7[_0x731d('0xa')]]&&_0x1b3ea0[_0x731d('0x7')](_0x5712bc[_0x7788f7[_0x731d('0xa')]][_0x731d('0xb')]());}else if(_0x7788f7[_0x731d('0x5')]===_0x731d('0xc')&&_0x7788f7[_0x731d('0xd')]&&_0x7788f7[_0x731d('0xd')][_0x731d('0xe')]){_0x5712bc[_0x7788f7[_0x731d('0xd')]['name']['toLowerCase']()]&&_0x1b3ea0['push'](_0x5712bc[_0x7788f7[_0x731d('0xd')][_0x731d('0xe')][_0x731d('0xf')]()][_0x731d('0xb')]());}else if(_0x7788f7[_0x731d('0x5')]==='keyValue'){if(_0x7788f7[_0x731d('0x10')]===_0x731d('0x6')&&_0x7788f7[_0x731d('0x11')]){_0x1b3ea0[_0x731d('0x7')](util[_0x731d('0x12')](_0x731d('0x13'),_0x7788f7[_0x731d('0x11')],_0x7788f7[_0x731d('0x14')]));}else if(_0x7788f7[_0x731d('0x10')]===_0x731d('0x9')&&_0x7788f7[_0x731d('0xa')]&&_0x7788f7[_0x731d('0x11')]){_0x5712bc[_0x7788f7[_0x731d('0xa')]]&&_0x1b3ea0['push'](util[_0x731d('0x12')](_0x731d('0x13'),_0x7788f7[_0x731d('0x11')],_0x5712bc[_0x7788f7[_0x731d('0xa')]]));}else if(_0x7788f7[_0x731d('0x10')]===_0x731d('0xc')&&_0x7788f7[_0x731d('0xd')]&&_0x7788f7[_0x731d('0xd')]['name']&&_0x7788f7[_0x731d('0x11')]){_0x5712bc[_0x7788f7[_0x731d('0xd')][_0x731d('0xe')][_0x731d('0xf')]()]&&_0x1b3ea0[_0x731d('0x7')](util[_0x731d('0x12')](_0x731d('0x13'),_0x7788f7[_0x731d('0x11')],_0x5712bc[_0x7788f7[_0x731d('0xd')][_0x731d('0xe')][_0x731d('0xf')]()]));}}}}return _0x1b3ea0['join'](_0x1f5e78);};exports[_0x731d('0x15')]=function(_0x3c0dc6){var _0xdccd70=_0x3c0dc6[_0x731d('0x16')](-0x1);if(_0xdccd70==='/'){_0x3c0dc6=_0x3c0dc6[_0x731d('0x17')](0x0,_0x3c0dc6[_0x731d('0x18')](_0xdccd70));}return _0x3c0dc6;};exports[_0x731d('0x19')]=function(_0x4720d6){if(!_['isNil'](_0x4720d6)&&_0x4720d6!==''){var _0xcf99a5=/^(([^<>()\[\]\\.,;:\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 _0xcf99a5[_0x731d('0x1a')](String(_0x4720d6)[_0x731d('0xf')]());}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 d27fe48..7ab5896 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(_0x402a43,_0x68abb5){var _0xe8bc0=function(_0x107f92){while(--_0x107f92){_0x402a43['push'](_0x402a43['shift']());}};_0xe8bc0(++_0x68abb5);}(_0xe706,0xa3));var _0x6e70=function(_0xc9396b,_0x734ceb){_0xc9396b=_0xc9396b-0x0;var _0x56d6ee=_0xe706[_0xc9396b];return _0x56d6ee;};'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 _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(_0x2191a9,_0xc1526f){var _0x5a7e23=function(_0x1356eb){while(--_0x1356eb){_0x2191a9['push'](_0x2191a9['shift']());}};_0x5a7e23(++_0xc1526f);}(_0xe706,0xa3));var _0x6e70=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0xe706[_0xf48cce];return _0x2a5c38;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 4271869..6408100 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 _0xb3d0=['toLowerCase','content','idField','customField','custom_fields','push','toString','variable','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:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','catch','inspect','recordingFormat','none','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','Zendesk\x20account\x20type\x20not\x20recognized','error','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','then','info','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','%s/token:%s','username','token','Basic\x20%s','base64','[HTTP]','stringify','GET','forEach','includes','string','picklist','type','nameField'];(function(_0x10a8d8,_0x28f292){var _0x3b2b79=function(_0x55a3fe){while(--_0x55a3fe){_0x10a8d8['push'](_0x10a8d8['shift']());}};_0x3b2b79(++_0x28f292);}(_0xb3d0,0xa1));var _0x0b3d=function(_0x3a0c33,_0x115b8e){_0x3a0c33=_0x3a0c33-0x0;var _0x474757=_0xb3d0[_0x3a0c33];return _0x474757;};'use strict';var _=require(_0x0b3d('0x0'));var rp=require(_0x0b3d('0x1'));var md5=require('md5');var util=require(_0x0b3d('0x2'));var Redis=require('ioredis');var intUtil=require(_0x0b3d('0x3'));var config=require(_0x0b3d('0x4'));var logger=require(_0x0b3d('0x5'))(_0x0b3d('0x6'));config['redis']=_[_0x0b3d('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0b3d('0x8'))(new Redis(config['redis']));function emit(_0x1af55e,_0x232bc7,_0x407137){io['to'](_0x1af55e)[_0x0b3d('0x9')](_0x232bc7,_0x407137);}var headers={'Content-Type':_0x0b3d('0xa'),'Accept':_0x0b3d('0xa')};function getTicket(_0x2a358c,_0x1a69a2,_0x2c9846,_0x2eeb5e,_0x4d3ede){logger['info'](_0x0b3d('0xb'));return request({'uri':util['format'](_0x0b3d('0xc'),_0x2a358c[_0x0b3d('0xd')]),'method':_0x0b3d('0xe'),'body':{'ticket':_[_0x0b3d('0xf')]({'requester_id':_0x2c9846['id'],'submitter_id':_0x1a69a2?_0x1a69a2['id']:undefined,'assignee_id':_0x1a69a2?_0x1a69a2['id']:undefined,'tags':getTags(_0x2eeb5e['Tags'],_0x0b3d('0x10')),'subject':intUtil[_0x0b3d('0x11')](_0x2eeb5e[_0x0b3d('0x12')],_0x4d3ede,'\x20'),'description':intUtil[_0x0b3d('0x11')](_0x2eeb5e[_0x0b3d('0x13')],_0x4d3ede,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0b3d('0x11')](_0x2eeb5e['Descriptions'],_0x4d3ede,'\x0a')}},getCustomFields(_0x2eeb5e[_0x0b3d('0x14')],_0x4d3ede))}})['then'](function(_0x432a9a){logger['info'](_0x0b3d('0x15'));return _0x432a9a[_0x0b3d('0x16')];});}function getUser(_0x24a99a,_0x454368){if(intUtil[_0x0b3d('0x17')](_0x454368)){logger['info'](_0x0b3d('0x18'),_0x454368);return request({'uri':util[_0x0b3d('0x19')](_0x0b3d('0x1a'),_0x24a99a['remoteUri']),'qs':{'query':util[_0x0b3d('0x19')](_0x0b3d('0x1b'),_0x454368)}})[_0x0b3d('0x1c')](function(_0x445194){if(_0x445194['count']){logger[_0x0b3d('0x1d')](_0x0b3d('0x1e'));return _[_0x0b3d('0x1f')](_0x445194[_0x0b3d('0x20')],{'email':_0x454368,'role':_0x0b3d('0x21')});}else{logger[_0x0b3d('0x1d')](_0x0b3d('0x22'));return request({'uri':util[_0x0b3d('0x19')]('%s/users/me.json',_0x24a99a[_0x0b3d('0xd')])})[_0x0b3d('0x1c')](function(_0x307c93){logger[_0x0b3d('0x1d')](_0x0b3d('0x23'));return _0x307c93[_0x0b3d('0x24')];});}});}else{logger[_0x0b3d('0x1d')](_0x0b3d('0x22'));return request({'uri':util[_0x0b3d('0x19')](_0x0b3d('0x25'),_0x24a99a[_0x0b3d('0xd')])})[_0x0b3d('0x1c')](function(_0x3e2702){logger[_0x0b3d('0x1d')](_0x0b3d('0x23'));return _0x3e2702['user'];});}}function getEndUser(_0x2f9d45,_0x3996db,_0x556408){logger[_0x0b3d('0x1d')]('Searching\x20enduser\x20with\x20phone',_0x556408);return request({'uri':util[_0x0b3d('0x19')](_0x0b3d('0x1a'),_0x2f9d45[_0x0b3d('0xd')]),'qs':{'query':util[_0x0b3d('0x19')](_0x0b3d('0x26'),_0x556408)}})[_0x0b3d('0x1c')](function(_0x3dfa76){var _0x83e87d;if(_0x3dfa76['results'][_0x0b3d('0x27')]){_0x3dfa76[_0x0b3d('0x20')]=_[_0x0b3d('0x28')](_0x3dfa76[_0x0b3d('0x20')],{'suspended':![],'role':_0x0b3d('0x29')});if(_0x3dfa76[_0x0b3d('0x20')][_0x0b3d('0x27')]){_0x83e87d=_[_0x0b3d('0x2a')](_0x3dfa76[_0x0b3d('0x20')]);}}if(_0x83e87d){logger[_0x0b3d('0x1d')](_0x0b3d('0x2b'));return _0x83e87d;}else{logger['info'](_0x0b3d('0x2c'));return request({'uri':util['format'](_0x0b3d('0x2d'),_0x2f9d45['remoteUri']),'method':'POST','body':{'user':{'role':_0x0b3d('0x29'),'name':util[_0x0b3d('0x19')](_0x0b3d('0x2e'),_0x3996db||_0x556408),'phone':_0x556408}}})[_0x0b3d('0x1c')](function(_0x1463f1){logger[_0x0b3d('0x1d')](_0x0b3d('0x2f'));return _0x1463f1['user'];});}});}function getAuth(_0x5a7e94){var _0x4dd413;if(_0x5a7e94[_0x0b3d('0x30')]===_0x0b3d('0x31')){_0x4dd413=util[_0x0b3d('0x19')](_0x0b3d('0x32'),_0x5a7e94['username'],_0x5a7e94[_0x0b3d('0x31')]);}else if(_0x5a7e94[_0x0b3d('0x30')]==='token'){_0x4dd413=util[_0x0b3d('0x19')](_0x0b3d('0x33'),_0x5a7e94[_0x0b3d('0x34')],_0x5a7e94[_0x0b3d('0x35')]);}return util['format'](_0x0b3d('0x36'),new Buffer(_0x4dd413)['toString'](_0x0b3d('0x37')));}function request(_0x46e67b){logger['debug'](_0x0b3d('0x38'),JSON[_0x0b3d('0x39')](_0x46e67b));return rp(_[_0x0b3d('0x7')](_0x46e67b,{'method':_0x0b3d('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x529a24,_0xbd79c3){var _0x4c71ab=[];if(_0x529a24&&_0x529a24[_0x0b3d('0x27')]>0x0){_0x4c71ab=_['map'](_0x529a24,_0xbd79c3);}return _0x4c71ab;}function getCustomFields(_0x5906bb,_0x11d068){var _0x47a6a2=[];var _0x445f52={'custom_fields':[]};if(_0x5906bb[_0x0b3d('0x27')]>0x0){_[_0x0b3d('0x3b')](_0x5906bb,function(_0xb96f36){if(_[_0x0b3d('0x3c')]([_0x0b3d('0x3d'),_0x0b3d('0x3e')],_0xb96f36[_0x0b3d('0x3f')])&&_0xb96f36[_0x0b3d('0x40')]&&!_0xb96f36['customField']){_0x445f52[_0xb96f36[_0x0b3d('0x40')][_0x0b3d('0x41')]()]=_0xb96f36[_0x0b3d('0x42')]['toString']();}else if(_['includes']([_0x0b3d('0x3d'),_0x0b3d('0x3e')],_0xb96f36[_0x0b3d('0x3f')])&&_0xb96f36[_0x0b3d('0x43')]&&_0xb96f36[_0x0b3d('0x44')]){_0x445f52[_0x0b3d('0x45')][_0x0b3d('0x46')]({'id':_0xb96f36['idField'],'value':_0xb96f36['content'][_0x0b3d('0x47')]()});}else if(_0xb96f36[_0x0b3d('0x3f')]===_0x0b3d('0x48')&&_0xb96f36[_0x0b3d('0x49')]&&_0xb96f36['idField']&&_0xb96f36['customField']){_0x11d068[_0xb96f36['variableName']]&&_0x445f52[_0x0b3d('0x45')][_0x0b3d('0x46')]({'id':_0xb96f36[_0x0b3d('0x43')],'value':_0x11d068[_0xb96f36[_0x0b3d('0x49')]]['toString']()});}else if(_0xb96f36['type']===_0x0b3d('0x4a')&&_0xb96f36['Variable']&&_0xb96f36[_0x0b3d('0x4b')][_0x0b3d('0x10')]&&_0xb96f36[_0x0b3d('0x43')]&&_0xb96f36[_0x0b3d('0x44')]){_0x11d068[_0xb96f36[_0x0b3d('0x4b')][_0x0b3d('0x10')][_0x0b3d('0x41')]()]&&_0x445f52[_0x0b3d('0x45')][_0x0b3d('0x46')]({'id':_0xb96f36[_0x0b3d('0x43')],'value':_0x11d068[_0xb96f36['Variable'][_0x0b3d('0x10')]['toLowerCase']()]['toString']()});}});}return _0x445f52;}exports[_0x0b3d('0x4c')]=function(_0x19c16a,_0x1b8837,_0x249cc0,_0x35b108,_0x2409f8,_0x1629ae){var _0x15b5c4,_0x4619e3;_0x1629ae[_0x0b3d('0xd')]=intUtil[_0x0b3d('0x4d')](_0x1629ae[_0x0b3d('0xd')]);_0x1629ae[_0x0b3d('0x4e')]=intUtil[_0x0b3d('0x4d')](_0x1629ae['serverUrl']);if(_0x2409f8&&_0x2409f8['monitor_format']){logger[_0x0b3d('0x1d')](_0x0b3d('0x4f'),_0x0b3d('0x50'));_0x1b8837[_0x0b3d('0x51')]=util[_0x0b3d('0x19')](_0x0b3d('0x52'),_0x1629ae[_0x0b3d('0x4e')],_0x1b8837[_0x0b3d('0x53')],md5(_0x1b8837['uniqueid']));}else{_0x1b8837[_0x0b3d('0x51')]='';}headers[_0x0b3d('0x54')]=getAuth(_0x1629ae);return getUser(_0x1629ae,_0x35b108[_0x0b3d('0x55')])['then'](function(_0xb8f2e2){_0x15b5c4=_0xb8f2e2;logger[_0x0b3d('0x1d')](_0x0b3d('0x56'),_0x15b5c4['id']);return getEndUser(_0x1629ae,_0x1b8837[_0x0b3d('0x57')],_0x1b8837[_0x0b3d('0x58')]);})[_0x0b3d('0x1c')](function(_0x55da0d){_0x4619e3=_0x55da0d;logger['info'](_0x0b3d('0x59'),_0x4619e3['id']);return getTicket(_0x1629ae,_0x15b5c4,_0x4619e3,_0x249cc0,_0x1b8837);})['then'](function(_0xf6cd6b){if(_0xf6cd6b){logger['info'](_0x0b3d('0x5a'),_0xf6cd6b['id']);switch(_0x1629ae[_0x0b3d('0x3f')]){case _0x0b3d('0x5b'):logger[_0x0b3d('0x1d')]('[QUEUE]',_0x0b3d('0x5c'));return request({'uri':util[_0x0b3d('0x19')](_0x0b3d('0x5d'),_0x1629ae['remoteUri'],_0x15b5c4['id'],_0xf6cd6b['id']),'method':_0x0b3d('0xe')});case'newTab':logger[_0x0b3d('0x1d')](_0x0b3d('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x0b3d('0x5e'),_0x35b108['name']),_0x0b3d('0x5f'),{'uri':util['format'](_0x0b3d('0x60'),_0x1629ae['remoteUri'][_0x0b3d('0x61')](_0x0b3d('0x62'),''),_0xf6cd6b['id'])});break;default:logger['error']('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x0b3d('0x63')](function(_0x15e3f2){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x0b3d('0x64')](_0x15e3f2,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x23a22a,_0x18477b,_0x1c55ea,_0x20d6d5,_0x175c4d,_0x43021b,_0x4fa1c4){var _0x1c2d9d,_0x58fd69;_0x43021b[_0x0b3d('0xd')]=intUtil[_0x0b3d('0x4d')](_0x43021b[_0x0b3d('0xd')]);_0x43021b['serverUrl']=intUtil[_0x0b3d('0x4d')](_0x43021b[_0x0b3d('0x4e')]);if(_0x4fa1c4&&_0x4fa1c4['recordingFormat']&&_0x4fa1c4[_0x0b3d('0x65')]!==_0x0b3d('0x66')){logger[_0x0b3d('0x1d')]('[OUTBOUND]',_0x0b3d('0x50'));_0x18477b[_0x0b3d('0x51')]=util[_0x0b3d('0x19')](_0x0b3d('0x52'),_0x43021b[_0x0b3d('0x4e')],_0x18477b[_0x0b3d('0x53')],md5(_0x18477b[_0x0b3d('0x53')]));}headers['Authorization']=getAuth(_0x43021b);return getUser(_0x43021b,_0x20d6d5[_0x0b3d('0x55')])[_0x0b3d('0x1c')](function(_0x3f9eac){_0x1c2d9d=_0x3f9eac;logger[_0x0b3d('0x1d')](_0x0b3d('0x56'),_0x1c2d9d['id']);return getEndUser(_0x43021b,_0x18477b['destcalleridname'],_0x18477b[_0x0b3d('0x67')]);})[_0x0b3d('0x1c')](function(_0x504cb7){_0x58fd69=_0x504cb7;logger[_0x0b3d('0x1d')]('The\x20Enduser\x20ID\x20is:',_0x58fd69['id']);return getTicket(_0x43021b,_0x1c2d9d,_0x58fd69,_0x1c55ea,_0x18477b);})[_0x0b3d('0x1c')](function(_0x5b301d){if(_0x5b301d){logger[_0x0b3d('0x1d')](_0x0b3d('0x5a'),_0x5b301d['id']);switch(_0x43021b[_0x0b3d('0x3f')]){case _0x0b3d('0x5b'):logger[_0x0b3d('0x1d')](_0x0b3d('0x68'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x0b3d('0x5d'),_0x43021b[_0x0b3d('0xd')],_0x1c2d9d['id'],_0x5b301d['id']),'method':'POST'});case'newTab':logger[_0x0b3d('0x1d')](_0x0b3d('0x68'),_0x0b3d('0x69'));emit(util[_0x0b3d('0x19')](_0x0b3d('0x5e'),_0x20d6d5[_0x0b3d('0x10')]),'trigger:browser:url',{'uri':util[_0x0b3d('0x19')](_0x0b3d('0x60'),_0x43021b[_0x0b3d('0xd')][_0x0b3d('0x61')](_0x0b3d('0x62'),''),_0x5b301d['id'])});break;default:logger['error'](_0x0b3d('0x68'),_0x0b3d('0x6a'));}}})['catch'](function(_0xbacef){logger[_0x0b3d('0x6b')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0xbacef,{'showHidden':!![],'depth':null}));});};exports[_0x0b3d('0x6c')]=function(_0x3cfba5,_0x4f477f,_0x1303ce,_0x50d929,_0x4e8973,_0x4566e9){var _0x11c3be,_0x64436c;_0x4566e9['remoteUri']=intUtil[_0x0b3d('0x4d')](_0x4566e9[_0x0b3d('0xd')]);_0x4566e9[_0x0b3d('0x4e')]=intUtil['stripTrailingSlash'](_0x4566e9['serverUrl']);if(_0x4e8973&&_0x4e8973[_0x0b3d('0x6d')]){logger[_0x0b3d('0x1d')]('['+_0x4f477f[_0x0b3d('0x6e')][_0x0b3d('0x6f')]()+']','Recording\x20is\x20enabled!');_0x4f477f[_0x0b3d('0x51')]=util[_0x0b3d('0x19')](_0x0b3d('0x52'),_0x4566e9[_0x0b3d('0x4e')],_0x4f477f[_0x0b3d('0x53')],md5(_0x4f477f[_0x0b3d('0x53')]));}else{_0x4f477f[_0x0b3d('0x51')]='';}headers[_0x0b3d('0x54')]=getAuth(_0x4566e9);return getUser(_0x4566e9)[_0x0b3d('0x1c')](function(_0x384d24){_0x11c3be=_0x384d24;logger[_0x0b3d('0x1d')](_0x0b3d('0x56'),_0x11c3be['id']);return getEndUser(_0x4566e9,_0x4f477f[_0x0b3d('0x57')],_0x4f477f['calleridnum']);})[_0x0b3d('0x1c')](function(_0x475e26){_0x64436c=_0x475e26;logger[_0x0b3d('0x1d')](_0x0b3d('0x59'),_0x64436c['id']);return getTicket(_0x4566e9,_0x11c3be,_0x64436c,_0x1303ce,_0x4f477f);})[_0x0b3d('0x1c')](function(_0x23ee5e){if(_0x23ee5e){logger[_0x0b3d('0x1d')](_0x0b3d('0x5a'),_0x23ee5e['id']);}})[_0x0b3d('0x63')](function(_0x32c462){logger['error']('['+_0x4f477f[_0x0b3d('0x6e')][_0x0b3d('0x6f')]()+']'+_0x0b3d('0x70'),util['inspect'](_0x32c462,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc734=['user:%s','trigger:browser:url','replace','error','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','calleridnum','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','defaults','localhost','socket.io-emitter','redis','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','count','info','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','%s/search.json','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','base64','debug','stringify','map','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string','custom_fields','idField','variable','variableName','push','customVariable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab'];(function(_0x3274ee,_0x246528){var _0x514a6c=function(_0x3cd5c7){while(--_0x3cd5c7){_0x3274ee['push'](_0x3274ee['shift']());}};_0x514a6c(++_0x246528);}(_0xc734,0x1bf));var _0x4c73=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0xc734[_0x23ec06];return _0x2831d4;};'use strict';var _=require(_0x4c73('0x0'));var rp=require(_0x4c73('0x1'));var md5=require(_0x4c73('0x2'));var util=require(_0x4c73('0x3'));var Redis=require(_0x4c73('0x4'));var intUtil=require(_0x4c73('0x5'));var config=require(_0x4c73('0x6'));var logger=require('../../../../config/logger')('zendesk');config['redis']=_[_0x4c73('0x7')](config['redis'],{'host':_0x4c73('0x8'),'port':0x18eb});var io=require(_0x4c73('0x9'))(new Redis(config[_0x4c73('0xa')]));function emit(_0x2fc644,_0x2dbb24,_0x1ea4a5){io['to'](_0x2fc644)[_0x4c73('0xb')](_0x2dbb24,_0x1ea4a5);}var headers={'Content-Type':_0x4c73('0xc'),'Accept':_0x4c73('0xc')};function getTicket(_0x1ffd79,_0x3a38aa,_0x4bd1a3,_0x171b7d,_0x195598){logger['info'](_0x4c73('0xd'));return request({'uri':util[_0x4c73('0xe')](_0x4c73('0xf'),_0x1ffd79[_0x4c73('0x10')]),'method':_0x4c73('0x11'),'body':{'ticket':_[_0x4c73('0x12')]({'requester_id':_0x4bd1a3['id'],'submitter_id':_0x3a38aa?_0x3a38aa['id']:undefined,'assignee_id':_0x3a38aa?_0x3a38aa['id']:undefined,'tags':getTags(_0x171b7d['Tags'],_0x4c73('0x13')),'subject':intUtil[_0x4c73('0x14')](_0x171b7d[_0x4c73('0x15')],_0x195598,'\x20'),'description':intUtil[_0x4c73('0x14')](_0x171b7d[_0x4c73('0x16')],_0x195598,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x171b7d[_0x4c73('0x16')],_0x195598,'\x0a')}},getCustomFields(_0x171b7d[_0x4c73('0x17')],_0x195598))}})[_0x4c73('0x18')](function(_0x471471){logger['info'](_0x4c73('0x19'));return _0x471471[_0x4c73('0x1a')];});}function getUser(_0x4a1013,_0x2d83ee){if(intUtil[_0x4c73('0x1b')](_0x2d83ee)){logger['info'](_0x4c73('0x1c'),_0x2d83ee);return request({'uri':util[_0x4c73('0xe')]('%s/search.json',_0x4a1013['remoteUri']),'qs':{'query':util[_0x4c73('0xe')]('type:user\x20role:agent\x20email:%s',_0x2d83ee)}})[_0x4c73('0x18')](function(_0xd29894){if(_0xd29894[_0x4c73('0x1d')]){logger[_0x4c73('0x1e')]('Agent\x20found!');return _[_0x4c73('0x1f')](_0xd29894[_0x4c73('0x20')],{'email':_0x2d83ee,'role':'agent'});}else{logger[_0x4c73('0x1e')](_0x4c73('0x21'));return request({'uri':util[_0x4c73('0xe')](_0x4c73('0x22'),_0x4a1013[_0x4c73('0x10')])})[_0x4c73('0x18')](function(_0x588fa8){logger[_0x4c73('0x1e')]('Admin\x20account\x20selected.');return _0x588fa8['user'];});}});}else{logger[_0x4c73('0x1e')](_0x4c73('0x21'));return request({'uri':util[_0x4c73('0xe')](_0x4c73('0x22'),_0x4a1013[_0x4c73('0x10')])})[_0x4c73('0x18')](function(_0x284937){logger['info']('Admin\x20account\x20selected.');return _0x284937[_0x4c73('0x23')];});}}function getEndUser(_0x93a83b,_0x35baf1,_0x3f6770){logger[_0x4c73('0x1e')](_0x4c73('0x24'),_0x3f6770);return request({'uri':util['format'](_0x4c73('0x25'),_0x93a83b['remoteUri']),'qs':{'query':util[_0x4c73('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x3f6770)}})[_0x4c73('0x18')](function(_0x1357fb){var _0x22d460;if(_0x1357fb[_0x4c73('0x20')]['length']){_0x1357fb[_0x4c73('0x20')]=_['filter'](_0x1357fb[_0x4c73('0x20')],{'suspended':![],'role':_0x4c73('0x26')});if(_0x1357fb[_0x4c73('0x20')][_0x4c73('0x27')]){_0x22d460=_[_0x4c73('0x28')](_0x1357fb[_0x4c73('0x20')]);}}if(_0x22d460){logger['info'](_0x4c73('0x29'));return _0x22d460;}else{logger[_0x4c73('0x1e')](_0x4c73('0x2a'));return request({'uri':util[_0x4c73('0xe')](_0x4c73('0x2b'),_0x93a83b[_0x4c73('0x10')]),'method':_0x4c73('0x11'),'body':{'user':{'role':_0x4c73('0x26'),'name':util[_0x4c73('0xe')](_0x4c73('0x2c'),_0x35baf1||_0x3f6770),'phone':_0x3f6770}}})[_0x4c73('0x18')](function(_0x395c18){logger['info'](_0x4c73('0x2d'));return _0x395c18[_0x4c73('0x23')];});}});}function getAuth(_0x4ac419){var _0x230708;if(_0x4ac419[_0x4c73('0x2e')]===_0x4c73('0x2f')){_0x230708=util[_0x4c73('0xe')]('%s:%s',_0x4ac419[_0x4c73('0x30')],_0x4ac419[_0x4c73('0x2f')]);}else if(_0x4ac419['authType']===_0x4c73('0x31')){_0x230708=util[_0x4c73('0xe')](_0x4c73('0x32'),_0x4ac419[_0x4c73('0x30')],_0x4ac419[_0x4c73('0x31')]);}return util['format']('Basic\x20%s',new Buffer(_0x230708)['toString'](_0x4c73('0x33')));}function request(_0x1658a5){logger[_0x4c73('0x34')]('[HTTP]',JSON[_0x4c73('0x35')](_0x1658a5));return rp(_[_0x4c73('0x7')](_0x1658a5,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x343bd2,_0x42a2c9){var _0x4be3b4=[];if(_0x343bd2&&_0x343bd2[_0x4c73('0x27')]>0x0){_0x4be3b4=_[_0x4c73('0x36')](_0x343bd2,_0x42a2c9);}return _0x4be3b4;}function getCustomFields(_0x56a8e7,_0x33ed0c){var _0x3ddd5a=[];var _0x2ff9b1={'custom_fields':[]};if(_0x56a8e7[_0x4c73('0x27')]>0x0){_['forEach'](_0x56a8e7,function(_0x5465f5){if(_[_0x4c73('0x37')](['string',_0x4c73('0x38')],_0x5465f5[_0x4c73('0x39')])&&_0x5465f5[_0x4c73('0x3a')]&&!_0x5465f5[_0x4c73('0x3b')]){_0x2ff9b1[_0x5465f5[_0x4c73('0x3a')][_0x4c73('0x3c')]()]=_0x5465f5[_0x4c73('0x3d')][_0x4c73('0x3e')]();}else if(_[_0x4c73('0x37')]([_0x4c73('0x3f'),_0x4c73('0x38')],_0x5465f5[_0x4c73('0x39')])&&_0x5465f5['idField']&&_0x5465f5['customField']){_0x2ff9b1[_0x4c73('0x40')]['push']({'id':_0x5465f5[_0x4c73('0x41')],'value':_0x5465f5[_0x4c73('0x3d')]['toString']()});}else if(_0x5465f5['type']===_0x4c73('0x42')&&_0x5465f5[_0x4c73('0x43')]&&_0x5465f5['idField']&&_0x5465f5['customField']){_0x33ed0c[_0x5465f5[_0x4c73('0x43')]]&&_0x2ff9b1[_0x4c73('0x40')][_0x4c73('0x44')]({'id':_0x5465f5['idField'],'value':_0x33ed0c[_0x5465f5[_0x4c73('0x43')]]['toString']()});}else if(_0x5465f5[_0x4c73('0x39')]===_0x4c73('0x45')&&_0x5465f5['Variable']&&_0x5465f5['Variable']['name']&&_0x5465f5['idField']&&_0x5465f5['customField']){_0x33ed0c[_0x5465f5['Variable'][_0x4c73('0x13')][_0x4c73('0x3c')]()]&&_0x2ff9b1[_0x4c73('0x40')][_0x4c73('0x44')]({'id':_0x5465f5[_0x4c73('0x41')],'value':_0x33ed0c[_0x5465f5['Variable']['name'][_0x4c73('0x3c')]()][_0x4c73('0x3e')]()});}});}return _0x2ff9b1;}exports[_0x4c73('0x46')]=function(_0x26ff2c,_0xdbd124,_0x84bfe9,_0x42ee6c,_0x2dc719,_0x2d30f5){var _0x14e058,_0x26fda4;_0x2d30f5[_0x4c73('0x10')]=intUtil[_0x4c73('0x47')](_0x2d30f5[_0x4c73('0x10')]);_0x2d30f5['serverUrl']=intUtil[_0x4c73('0x47')](_0x2d30f5[_0x4c73('0x48')]);if(_0x2dc719&&_0x2dc719[_0x4c73('0x49')]){logger[_0x4c73('0x1e')]('[QUEUE]',_0x4c73('0x4a'));_0xdbd124[_0x4c73('0x4b')]=util[_0x4c73('0xe')](_0x4c73('0x4c'),_0x2d30f5[_0x4c73('0x48')],_0xdbd124['uniqueid'],md5(_0xdbd124[_0x4c73('0x4d')]));}else{_0xdbd124[_0x4c73('0x4b')]='';}headers[_0x4c73('0x4e')]=getAuth(_0x2d30f5);return getUser(_0x2d30f5,_0x42ee6c[_0x4c73('0x4f')])['then'](function(_0x2e19dd){_0x14e058=_0x2e19dd;logger[_0x4c73('0x1e')]('The\x20User\x20ID\x20is:',_0x14e058['id']);return getEndUser(_0x2d30f5,_0xdbd124['calleridname'],_0xdbd124['calleridnum']);})[_0x4c73('0x18')](function(_0x50358e){_0x26fda4=_0x50358e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x26fda4['id']);return getTicket(_0x2d30f5,_0x14e058,_0x26fda4,_0x84bfe9,_0xdbd124);})[_0x4c73('0x18')](function(_0x4600ee){if(_0x4600ee){logger[_0x4c73('0x1e')]('The\x20Ticket\x20ID\x20is:',_0x4600ee['id']);switch(_0x2d30f5[_0x4c73('0x39')]){case'integrationTab':logger[_0x4c73('0x1e')](_0x4c73('0x50'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x4c73('0xe')](_0x4c73('0x51'),_0x2d30f5[_0x4c73('0x10')],_0x14e058['id'],_0x4600ee['id']),'method':_0x4c73('0x11')});case _0x4c73('0x52'):logger[_0x4c73('0x1e')](_0x4c73('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4c73('0xe')](_0x4c73('0x53'),_0x42ee6c[_0x4c73('0x13')]),_0x4c73('0x54'),{'uri':util[_0x4c73('0xe')]('%s/agent/tickets/%s',_0x2d30f5['remoteUri'][_0x4c73('0x55')]('/api/v2',''),_0x4600ee['id'])});break;default:logger[_0x4c73('0x56')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x227f4d){logger[_0x4c73('0x56')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x227f4d,{'showHidden':!![],'depth':null}));});};exports[_0x4c73('0x57')]=function(_0x111a8b,_0x7fb78c,_0x57511f,_0x3067a5,_0x813915,_0x57a6cf,_0x29b3a6){var _0x691b15,_0x99032e;_0x57a6cf[_0x4c73('0x10')]=intUtil['stripTrailingSlash'](_0x57a6cf[_0x4c73('0x10')]);_0x57a6cf[_0x4c73('0x48')]=intUtil[_0x4c73('0x47')](_0x57a6cf['serverUrl']);if(_0x29b3a6&&_0x29b3a6[_0x4c73('0x58')]&&_0x29b3a6['recordingFormat']!=='none'){logger[_0x4c73('0x1e')](_0x4c73('0x59'),'Recording\x20is\x20enabled!');_0x7fb78c[_0x4c73('0x4b')]=util[_0x4c73('0xe')](_0x4c73('0x4c'),_0x57a6cf[_0x4c73('0x48')],_0x7fb78c[_0x4c73('0x4d')],md5(_0x7fb78c[_0x4c73('0x4d')]));}headers[_0x4c73('0x4e')]=getAuth(_0x57a6cf);return getUser(_0x57a6cf,_0x3067a5[_0x4c73('0x4f')])[_0x4c73('0x18')](function(_0x294169){_0x691b15=_0x294169;logger[_0x4c73('0x1e')](_0x4c73('0x5a'),_0x691b15['id']);return getEndUser(_0x57a6cf,_0x7fb78c[_0x4c73('0x5b')],_0x7fb78c[_0x4c73('0x5c')]);})[_0x4c73('0x18')](function(_0x3cbb4d){_0x99032e=_0x3cbb4d;logger[_0x4c73('0x1e')](_0x4c73('0x5d'),_0x99032e['id']);return getTicket(_0x57a6cf,_0x691b15,_0x99032e,_0x57511f,_0x7fb78c);})[_0x4c73('0x18')](function(_0x3f78a4){if(_0x3f78a4){logger[_0x4c73('0x1e')]('The\x20Ticket\x20ID\x20is:',_0x3f78a4['id']);switch(_0x57a6cf[_0x4c73('0x39')]){case _0x4c73('0x5e'):logger[_0x4c73('0x1e')](_0x4c73('0x59'),_0x4c73('0x5f'));return request({'uri':util['format'](_0x4c73('0x51'),_0x57a6cf[_0x4c73('0x10')],_0x691b15['id'],_0x3f78a4['id']),'method':_0x4c73('0x11')});case'newTab':logger[_0x4c73('0x1e')](_0x4c73('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4c73('0xe')](_0x4c73('0x53'),_0x3067a5['name']),_0x4c73('0x54'),{'uri':util['format']('%s/agent/tickets/%s',_0x57a6cf[_0x4c73('0x10')][_0x4c73('0x55')](_0x4c73('0x60'),''),_0x3f78a4['id'])});break;default:logger[_0x4c73('0x56')]('[OUTBOUND]',_0x4c73('0x61'));}}})['catch'](function(_0x3dabfe){logger[_0x4c73('0x56')](_0x4c73('0x62'),util[_0x4c73('0x63')](_0x3dabfe,{'showHidden':!![],'depth':null}));});};exports[_0x4c73('0x64')]=function(_0x1d49c9,_0x328cba,_0x124cb,_0x141dc2,_0x53973e,_0x49bb99){var _0x3db8a9,_0x277cf3;_0x49bb99[_0x4c73('0x10')]=intUtil['stripTrailingSlash'](_0x49bb99['remoteUri']);_0x49bb99[_0x4c73('0x48')]=intUtil[_0x4c73('0x47')](_0x49bb99[_0x4c73('0x48')]);if(_0x53973e&&_0x53973e[_0x4c73('0x49')]){logger[_0x4c73('0x1e')]('['+_0x328cba[_0x4c73('0x65')][_0x4c73('0x66')]()+']',_0x4c73('0x4a'));_0x328cba[_0x4c73('0x4b')]=util['format'](_0x4c73('0x4c'),_0x49bb99[_0x4c73('0x48')],_0x328cba[_0x4c73('0x4d')],md5(_0x328cba[_0x4c73('0x4d')]));}else{_0x328cba[_0x4c73('0x4b')]='';}headers[_0x4c73('0x4e')]=getAuth(_0x49bb99);return getUser(_0x49bb99)[_0x4c73('0x18')](function(_0x9ab2a1){_0x3db8a9=_0x9ab2a1;logger[_0x4c73('0x1e')]('The\x20User\x20ID\x20is:',_0x3db8a9['id']);return getEndUser(_0x49bb99,_0x328cba['calleridname'],_0x328cba[_0x4c73('0x67')]);})[_0x4c73('0x18')](function(_0x4bab90){_0x277cf3=_0x4bab90;logger['info']('The\x20Enduser\x20ID\x20is:',_0x277cf3['id']);return getTicket(_0x49bb99,_0x3db8a9,_0x277cf3,_0x124cb,_0x328cba);})['then'](function(_0x58f3e6){if(_0x58f3e6){logger[_0x4c73('0x1e')]('The\x20Ticket\x20ID\x20is:',_0x58f3e6['id']);}})[_0x4c73('0x68')](function(_0x16f35f){logger[_0x4c73('0x56')]('['+_0x328cba[_0x4c73('0x65')][_0x4c73('0x66')]()+']'+_0x4c73('0x69'),util[_0x4c73('0x63')](_0x16f35f,{'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 4e0a578..85692b0 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 _0x0d3b=['role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Called','complete','connect','Call_Result','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','zoho.eu','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','unmanaged','/downloads?type=uniqueid&token=','com','toUpperCase','lodash','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/logger','localhost','socket.io-emitter','redis','emit','debug','[HTTP]','stringify','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','refreshToken','clientId','clientSecret','then','access_token','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','email','Agent\x20found!','info','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate'];(function(_0x512034,_0x38eef9){var _0x44940c=function(_0x3f6edf){while(--_0x3f6edf){_0x512034['push'](_0x512034['shift']());}};_0x44940c(++_0x38eef9);}(_0x0d3b,0xf4));var _0xb0d3=function(_0x2e083f,_0x393e0b){_0x2e083f=_0x2e083f-0x0;var _0xa6dc5b=_0x0d3b[_0x2e083f];return _0xa6dc5b;};'use strict';var _=require(_0xb0d3('0x0'));var rp=require(_0xb0d3('0x1'));var md5=require(_0xb0d3('0x2'));var util=require(_0xb0d3('0x3'));var intUtil=require(_0xb0d3('0x4'));var moment=require('moment');var Redis=require(_0xb0d3('0x5'));var BPromise=require(_0xb0d3('0x6'));var config=require('../../../../config/environment');var logger=require(_0xb0d3('0x7'))('zoho');config['redis']=_['defaults'](config['redis'],{'host':_0xb0d3('0x8'),'port':0x18eb});var io=require(_0xb0d3('0x9'))(new Redis(config[_0xb0d3('0xa')]));function emit(_0x2462f8,_0x5a9561,_0x1f3388){io['to'](_0x2462f8)[_0xb0d3('0xb')](_0x5a9561,_0x1f3388);}function request(_0x470432){logger[_0xb0d3('0xc')](_0xb0d3('0xd'),JSON[_0xb0d3('0xe')](_0x470432));return rp(_0x470432);}function getCustomFields(_0x761ea9,_0x410b31){var _0x3d1113={};if(_0x761ea9['length']>0x0){_[_0xb0d3('0xf')](_0x761ea9,function(_0x155b4e){if(_['includes']([_0xb0d3('0x10'),_0xb0d3('0x11')],_0x155b4e[_0xb0d3('0x12')])&&_0x155b4e[_0xb0d3('0x13')]){_0x3d1113[_0x155b4e['idField']]=_0x155b4e[_0xb0d3('0x14')][_0xb0d3('0x15')]();}else if(_0x155b4e['type']===_0xb0d3('0x16')&&_0x155b4e['variableName']&&_0x155b4e[_0xb0d3('0x13')]&&_0x410b31[_0x155b4e[_0xb0d3('0x17')]]){_0x3d1113[_0x155b4e['idField']]=_0x410b31[_0x155b4e['variableName']][_0xb0d3('0x15')]();}else if(_0x155b4e[_0xb0d3('0x12')]===_0xb0d3('0x18')&&_0x155b4e[_0xb0d3('0x19')]&&_0x155b4e[_0xb0d3('0x19')]['name']&&_0x155b4e[_0xb0d3('0x13')]&&_0x410b31[_0x155b4e['Variable'][_0xb0d3('0x1a')]['toLowerCase']()]){_0x3d1113[_0x155b4e[_0xb0d3('0x13')]]=_0x410b31[_0x155b4e[_0xb0d3('0x19')][_0xb0d3('0x1a')][_0xb0d3('0x1b')]()]['toString']();}});}return _0x3d1113;}function getName(_0x5d9259){if(_0x5d9259['indexOf']('\x20')>0x0){var _0x3ca2cf=_0x5d9259[_0xb0d3('0x1c')](/ (.+)/);if(_0x3ca2cf[0x1]){return _0x3ca2cf;}}return[_0x5d9259,_0x5d9259];}var accountsTokens={};function getAccessToken(_0x349be6){return new Promise(function(_0x1a5ec1,_0x51f615){if(!_[_0xb0d3('0x1d')](accountsTokens[_0x349be6['id']])&&!_[_0xb0d3('0x1d')](accountsTokens[_0x349be6['id']]['access_token'])){if(moment()[_0xb0d3('0x1e')](accountsTokens[_0x349be6['id']]['expires_in'])){_0x1a5ec1(accountsTokens[_0x349be6['id']]['access_token']);}}var _0xb1ca2;switch(_0x349be6[_0xb0d3('0x1f')]){case'US':_0xb1ca2=_0xb0d3('0x20');break;case'AU':_0xb1ca2=_0xb0d3('0x21');break;case'EU':_0xb1ca2='https://accounts.zoho.eu';break;case'IN':_0xb1ca2='https://accounts.zoho.in';break;case'CN':_0xb1ca2='https://accounts.zoho.com.cn';break;default:_0xb1ca2=_0xb0d3('0x22');break;}var _0x6afe7={'method':'POST','uri':_0xb1ca2+'/oauth/v2/token','qs':{'refresh_token':_0x349be6[_0xb0d3('0x23')],'client_id':_0x349be6[_0xb0d3('0x24')],'client_secret':_0x349be6[_0xb0d3('0x25')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x6afe7)[_0xb0d3('0x26')](function(_0x1d9ad1){accountsTokens[_0x349be6['id']]={'access_token':_0x1d9ad1[_0xb0d3('0x27')],'expires_in':moment()[_0xb0d3('0x28')](_0x1d9ad1['expires_in'],_0xb0d3('0x29'))};_0x1a5ec1(_0x1d9ad1[_0xb0d3('0x27')]);})[_0xb0d3('0x2a')](function(_0x44ec3f){logger[_0xb0d3('0x2b')](_0xb0d3('0x2c'),_0x44ec3f['stack']);_0x51f615(_0x44ec3f);});});}function getUser(_0x333c2b,_0x190513,_0x3d482e,_0x9d5b76){logger['info']('Search\x20user');return request({'method':_0xb0d3('0x2d'),'uri':util[_0xb0d3('0x2e')](_0xb0d3('0x2f'),_0x190513),'qs':{'type':_0xb0d3('0x30')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x333c2b},'json':!![]})['then'](function(_0x2f6631){if(_0x2f6631['users']){var _0x36ddf7=-0x1;if(_['isArrayLikeObject'](_0x2f6631['users'])){if(!_[_0xb0d3('0x1d')](_0x9d5b76)){_0x36ddf7=_['findIndex'](_0x2f6631[_0xb0d3('0x31')],function(_0x56da4c){return _0x56da4c[_0xb0d3('0x32')]===_0x9d5b76;});}if(_0x36ddf7>=0x0){logger['info'](_0xb0d3('0x33'));}else{logger[_0xb0d3('0x34')](_0xb0d3('0x35'));_0x36ddf7=_[_0xb0d3('0x36')](_0x2f6631[_0xb0d3('0x31')],function(_0x21afb1){return _0x21afb1[_0xb0d3('0x37')][_0xb0d3('0x1a')]==='Administrator';});}return _0x2f6631['users'][_0x36ddf7];}else{if(_0x2f6631['user'][_0xb0d3('0x37')]['name']===_0xb0d3('0x38')){logger[_0xb0d3('0x34')](_0xb0d3('0x35'));user=_0x2f6631[_0xb0d3('0x39')];return user;}else{logger[_0xb0d3('0x2b')](_0xb0d3('0x3a'),JSON[_0xb0d3('0xe')](_0x2f6631));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xb0d3('0xe')](_0x2f6631));}}}else{logger['error'](_0xb0d3('0x3a'),JSON[_0xb0d3('0xe')](_0x2f6631));throw new Error(_0xb0d3('0x3b')+JSON[_0xb0d3('0xe')](_0x2f6631));}})[_0xb0d3('0x2a')](function(_0x506942){console['error'](_0x506942);});}function getZohoUser(_0x3bb3b7,_0x2cc4de){return new BPromise(function(_0x58579f,_0x152ded){request(_0x3bb3b7)[_0xb0d3('0x26')](function(_0x46d051){var _0x2e1ab1=null;if(_0x46d051){_0x2e1ab1=_0x46d051[_0xb0d3('0x3c')][0x0];_0x2e1ab1[_0xb0d3('0x3d')]=_0x2cc4de;}_0x58579f(_0x2e1ab1);})[_0xb0d3('0x2a')](function(_0x5d1b76){_0x152ded(_0x5d1b76);});});}function createEndUser(_0x45314f,_0x43452b,_0x8a3c26,_0x16a74d,_0xfc740c,_0x133bd2){var _0x8a3c26=getName(_0x8a3c26);return request({'method':'POST','uri':_0xb0d3('0x3e')+_0x43452b+_0xb0d3('0x3f')+_[_0xb0d3('0x40')](_0x133bd2[_0xb0d3('0x41')])+'s','body':{'data':[{'Last_Name':_0x8a3c26[0x1],'First_Name':_0x8a3c26[0x0],'Phone':_0x16a74d,'Owner':{'name':!_[_0xb0d3('0x1d')](_0xfc740c['role'][_0xb0d3('0x1a')])?_0xfc740c[_0xb0d3('0x42')][_0xb0d3('0x1a')]:!_[_0xb0d3('0x1d')](_0xfc740c[_0xb0d3('0x43')])?_0xfc740c['first_name']+'\x20'+_0xfc740c[_0xb0d3('0x44')]:_0xfc740c[_0xb0d3('0x44')],'id':_0xfc740c['id']}}]},'headers':{'Authorization':_0xb0d3('0x45')+_0x45314f},'json':!![]})['then'](function(_0x4c7b19){if(_0x4c7b19&&_0x4c7b19[_0xb0d3('0x3c')][0x0][_0xb0d3('0x46')]===_0xb0d3('0x47')){var _0x18873b=_0x4c7b19[_0xb0d3('0x3c')][0x0][_0xb0d3('0x48')];_0x18873b['enduserType']=_[_0xb0d3('0x40')](_0x133bd2[_0xb0d3('0x41')])+'s';return _0x18873b;}logger[_0xb0d3('0x2b')](_0xb0d3('0x3a'),JSON[_0xb0d3('0xe')](data));throw new Error(_0xb0d3('0x49')+JSON[_0xb0d3('0xe')](data));})['catch'](function(_0x279674){console[_0xb0d3('0x4a')](_0xb0d3('0x4b'),_0x279674);});}function getEndUser(_0x5b15ed,_0x42da05,_0x4dc370,_0x1917ea,_0x3e434c,_0x398718,_0x1850bb){var _0x4223d9={'method':_0xb0d3('0x2d'),'uri':'','headers':{'Authorization':_0xb0d3('0x45')+_0x5b15ed},'json':!![]};switch(_0x1850bb[_0xb0d3('0x4c')]){case'contact_lead':_0x4223d9[_0xb0d3('0x4d')]='https://www.zohoapis.'+_0x42da05+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3e434c+'))';return getZohoUser(_0x4223d9,_0xb0d3('0x4e'))[_0xb0d3('0x26')](function(_0x5112c4){if(_0x5112c4)return _0x5112c4;_0x4223d9[_0xb0d3('0x4d')]=_0xb0d3('0x3e')+_0x42da05+_0xb0d3('0x4f')+_0x3e434c+'))';return getZohoUser(_0x4223d9,_0xb0d3('0x50'))[_0xb0d3('0x26')](function(_0x4e2fd9){if(_0x4e2fd9)return _0x4e2fd9;if(_0x1850bb[_0xb0d3('0x41')]!=_0xb0d3('0x51')){return createEndUser(_0x5b15ed,_0x42da05,_0x1917ea,_0x3e434c,_0x398718,_0x1850bb);}else{return{};}});});break;case'contact':_0x4223d9['uri']=_0xb0d3('0x3e')+_0x42da05+_0xb0d3('0x52')+_0x3e434c+'))';return getZohoUser(_0x4223d9,_0xb0d3('0x4e'))['then'](function(_0x2e53b5){if(_0x2e53b5)return _0x2e53b5;if(_0x1850bb['moduleCreate']!='nothing'){return createEndUser(_0x5b15ed,_0x42da05,_0x1917ea,_0x3e434c,_0x398718,_0x1850bb);}else{return{};}});break;case'lead':_0x4223d9['uri']=_0xb0d3('0x3e')+_0x42da05+_0xb0d3('0x4f')+_0x3e434c+'))';return getZohoUser(_0x4223d9,'Leads')[_0xb0d3('0x26')](function(_0xd1a82f){if(_0xd1a82f)return _0xd1a82f;if(_0x1850bb[_0xb0d3('0x41')]!=_0xb0d3('0x51')){return createEndUser(_0x5b15ed,_0x42da05,_0x1917ea,_0x3e434c,_0x398718,_0x1850bb);}else{return{};}});break;}}function getCall(_0x36d407,_0x5673de,_0xa08df,_0xa36eeb,_0x391878,_0x35e53f,_0x202cb2,_0x2c0998){logger[_0xb0d3('0x34')](_0xb0d3('0x53'));var _0x3e748f={};_0x3e748f['Owner']={'name':!_['isNil'](_0xa36eeb['role'][_0xb0d3('0x1a')])&&!_[_0xb0d3('0x1d')](_0xa36eeb[_0xb0d3('0x37')]['name'])&&_0xa36eeb[_0xb0d3('0x37')][_0xb0d3('0x1a')]===_0xb0d3('0x54')?_0xa36eeb[_0xb0d3('0x42')]['name']:!_[_0xb0d3('0x1d')](_0xa36eeb['first_name'])?_0xa36eeb['first_name']+'\x20'+_0xa36eeb[_0xb0d3('0x44')]:_0xa36eeb['last_name'],'id':_0xa36eeb['id']};_0x3e748f[_0xb0d3('0x55')]=intUtil[_0xb0d3('0x56')](_0x35e53f[_0xb0d3('0x57')],_0x202cb2,'\x20');_0x3e748f[_0xb0d3('0x58')]=intUtil[_0xb0d3('0x56')](_0x35e53f[_0xb0d3('0x59')],_0x202cb2,'\x0a');if(_0x391878[_0xb0d3('0x3d')]==='Contacts'){_0x3e748f[_0xb0d3('0x5a')]={'name':!_['isNil'](_0x391878['Full_Name'])?_0x391878[_0xb0d3('0x5b')]:!_[_0xb0d3('0x1d')](_0x391878['First_Name'])?_0x391878[_0xb0d3('0x5c')]+'\x20'+_0x391878[_0xb0d3('0x5d')]:_0x391878['Last_Name'],'id':_0x391878['id']};}if(_0x391878[_0xb0d3('0x3d')]===_0xb0d3('0x50')){_0x3e748f['What_Id']={'name':!_[_0xb0d3('0x1d')](_0x391878[_0xb0d3('0x5b')])?_0x391878[_0xb0d3('0x5b')]:!_[_0xb0d3('0x1d')](_0x391878[_0xb0d3('0x5c')])?_0x391878[_0xb0d3('0x5c')]+'\x20'+_0x391878[_0xb0d3('0x5d')]:_0x391878[_0xb0d3('0x5d')],'id':_0x391878['id']};_0x3e748f[_0xb0d3('0x5e')]=_[_0xb0d3('0x40')](_0x391878[_0xb0d3('0x3d')]);}if(_0x202cb2[_0xb0d3('0x5f')]){_0x3e748f[_0xb0d3('0x60')]=moment[_0xb0d3('0x61')](parseInt(_0x202cb2['talktime'])*0x3e8)[_0xb0d3('0x2e')](_0xb0d3('0x62'));}else if(_0x202cb2['answertime']&&_0x202cb2[_0xb0d3('0x63')]){_0x3e748f[_0xb0d3('0x60')]=moment['utc'](moment(_0x202cb2[_0xb0d3('0x63')],_0xb0d3('0x64'))[_0xb0d3('0x65')](moment(_0x202cb2['starttime'],_0xb0d3('0x64'))))['format'](_0xb0d3('0x62'));}switch(_0x202cb2[_0xb0d3('0x66')]){case'called':_0x3e748f['Call_Result']=_0xb0d3('0x67');break;case _0xb0d3('0x68'):case _0xb0d3('0x69'):_0x3e748f[_0xb0d3('0x6a')]=_0xb0d3('0x6b');break;case'rejected':_0x3e748f[_0xb0d3('0x6a')]=_0xb0d3('0x6c');break;case _0xb0d3('0x6d'):_0x3e748f[_0xb0d3('0x6a')]=_0xb0d3('0x6e');break;case _0xb0d3('0x6f'):_0x3e748f['Call_Result']=_0xb0d3('0x70');default:}_0x3e748f[_0xb0d3('0x71')]=(_0x2c0998===_0xb0d3('0x72')?moment(_0x202cb2[_0xb0d3('0x73')])[_0xb0d3('0x2e')](_0xb0d3('0x64')):moment(_0x202cb2[_0xb0d3('0x74')])[_0xb0d3('0x2e')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xb0d3('0x2e')](_0xb0d3('0x64'));_0x3e748f[_0xb0d3('0x75')]=_0x2c0998||_0xb0d3('0x76');_0x3e748f=_[_0xb0d3('0x77')](_0x3e748f,getCustomFields(_0x35e53f[_0xb0d3('0x78')],_0x202cb2));return request({'method':'POST','uri':_0xb0d3('0x3e')+_0x5673de+_0xb0d3('0x79'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x36d407},'body':{'data':[_0x3e748f]},'json':!![]})['then'](function(_0x5e04a1){if(_0x5e04a1&&_0x5e04a1[_0xb0d3('0x3c')][0x0]['code']==='SUCCESS'){logger[_0xb0d3('0x34')](_0xb0d3('0x7a'));return{'id':_0x5e04a1[_0xb0d3('0x3c')][0x0][_0xb0d3('0x48')]['id']};}})[_0xb0d3('0x2a')](function(_0x43575a){logger[_0xb0d3('0x34')](_0xb0d3('0x7b'),_0x43575a[_0xb0d3('0x7c')]);console['log'](_0xb0d3('0x7b'),_0x43575a);});}exports[_0xb0d3('0x7d')]=function(_0x3058d1,_0x26c2d4,_0x31071d,_0xb11f51,_0x2fc275,_0x4850a5){var _0x396d4c,_0x2d5ea5,_0x2a94a8;_0x4850a5[_0xb0d3('0x7e')]=intUtil[_0xb0d3('0x7f')](_0x4850a5[_0xb0d3('0x7e')]);_0x4850a5[_0xb0d3('0x80')]=intUtil[_0xb0d3('0x7f')](_0x4850a5[_0xb0d3('0x80')]);if(_0x2fc275&&_0x2fc275[_0xb0d3('0x81')]){logger[_0xb0d3('0x34')]('[QUEUE]',_0xb0d3('0x82'));_0x26c2d4[_0xb0d3('0x83')]=_0x4850a5['serverUrl']+'/api/voice/recordings/'+_0x26c2d4[_0xb0d3('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x26c2d4[_0xb0d3('0x84')]);}else{_0x26c2d4[_0xb0d3('0x83')]='';}var _0x54c9e3=_0x4850a5[_0xb0d3('0x7e')]===_0xb0d3('0x85')?'eu':'com';return getAccessToken(_0x4850a5)['then'](function(_0x3efc1c){_0x2a94a8=_0x3efc1c;return getUser(_0x2a94a8,_0x54c9e3,_0x4850a5,_0xb11f51['email']);})[_0xb0d3('0x26')](function(_0x2c6c2f){_0x396d4c=_0x2c6c2f;logger['info']('The\x20User\x20ID\x20is:',_0x396d4c['id']);return getEndUser(_0x2a94a8,_0x54c9e3,_0x4850a5,_0x26c2d4[_0xb0d3('0x86')],_0x26c2d4[_0xb0d3('0x87')],_0x396d4c,_0x31071d);})['then'](function(_0x342b28){_0x2d5ea5=_0x342b28;return getCall(_0x2a94a8,_0x54c9e3,_0x4850a5,_0x396d4c,_0x2d5ea5,_0x31071d,_0x26c2d4,'Inbound');})[_0xb0d3('0x26')](function(_0x5edc92){if(_0x5edc92){logger['info'](_0xb0d3('0x88'),_0x5edc92['id']);logger[_0xb0d3('0x34')](_0xb0d3('0x89'),_0xb0d3('0x8a'));emit(util[_0xb0d3('0x2e')](_0xb0d3('0x8b'),_0xb11f51[_0xb0d3('0x1a')]),_0xb0d3('0x8c'),{'uri':_0xb0d3('0x8d')+_0x4850a5['host']+_0xb0d3('0x8e')+_0x5edc92['id']});}})[_0xb0d3('0x2a')](function(_0x29b824){logger[_0xb0d3('0x2b')](_0xb0d3('0x89'),JSON[_0xb0d3('0xe')](_0x29b824));});};exports[_0xb0d3('0x72')]=function(_0x2f4d1b,_0x5659f4,_0x270461,_0x5f5892,_0x38e164,_0x41297a,_0x1ddef7){var _0x5951bc,_0x2b1ebb,_0x1b3ffa;_0x41297a[_0xb0d3('0x7e')]=intUtil['stripTrailingSlash'](_0x41297a[_0xb0d3('0x7e')]);_0x41297a['serverUrl']=intUtil[_0xb0d3('0x7f')](_0x41297a[_0xb0d3('0x80')]);if(_0x1ddef7&&_0x1ddef7['recordingFormat']&&_0x1ddef7[_0xb0d3('0x8f')]!==_0xb0d3('0x90')){logger['info'](_0xb0d3('0x91'),_0xb0d3('0x82'));_0x5659f4[_0xb0d3('0x83')]=_0x41297a[_0xb0d3('0x80')]+_0xb0d3('0x92')+_0x5659f4['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x5659f4[_0xb0d3('0x84')]);}var _0x333b96=_0x41297a[_0xb0d3('0x7e')]===_0xb0d3('0x85')?'eu':'com';return getAccessToken(_0x41297a)[_0xb0d3('0x26')](function(_0x22cbd9){_0x1b3ffa=_0x22cbd9;return getUser(_0x1b3ffa,_0x333b96,_0x41297a,_0x5f5892[_0xb0d3('0x32')]);})[_0xb0d3('0x26')](function(_0x5b7de7){_0x5951bc=_0x5b7de7;logger['info'](_0xb0d3('0x93'),_0x5951bc['id']);return getEndUser(_0x1b3ffa,_0x333b96,_0x41297a,_0x5659f4[_0xb0d3('0x94')],_0x5659f4[_0xb0d3('0x95')],_0x5951bc,_0x270461);})['then'](function(_0x3bb022){_0x2b1ebb=_0x3bb022;return getCall(_0x1b3ffa,_0x333b96,_0x41297a,_0x5951bc,_0x2b1ebb,_0x270461,_0x5659f4,_0xb0d3('0x96'));})[_0xb0d3('0x26')](function(_0x48f9bc){if(_0x48f9bc){logger[_0xb0d3('0x34')](_0xb0d3('0x88'),_0x48f9bc['id']);logger['info'](_0xb0d3('0x91'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x5f5892[_0xb0d3('0x1a')]),_0xb0d3('0x8c'),{'uri':'https://crm.'+_0x41297a[_0xb0d3('0x7e')]+_0xb0d3('0x8e')+_0x48f9bc['id']});}})[_0xb0d3('0x2a')](function(_0x1a77ea){logger['error']('[OUTBOUND]',JSON[_0xb0d3('0xe')](_0x1a77ea));});};exports[_0xb0d3('0x97')]=function(_0x2c0f09,_0xc8f5f7,_0x391de2,_0x37709e,_0x110b10,_0x414e1c){var _0x4e5250,_0x6fdd7f,_0x227044;_0x414e1c[_0xb0d3('0x7e')]=intUtil[_0xb0d3('0x7f')](_0x414e1c[_0xb0d3('0x7e')]);_0x414e1c[_0xb0d3('0x80')]=intUtil[_0xb0d3('0x7f')](_0x414e1c[_0xb0d3('0x80')]);if(_0x110b10&&_0x110b10['monitor_format']){logger[_0xb0d3('0x34')]('['+_0xc8f5f7['lastevent']['toUpperCase']()+']',_0xb0d3('0x82'));_0xc8f5f7[_0xb0d3('0x83')]=_0x414e1c['serverUrl']+_0xb0d3('0x92')+_0xc8f5f7['uniqueid']+_0xb0d3('0x98')+md5(_0xc8f5f7[_0xb0d3('0x84')]);}else{_0xc8f5f7[_0xb0d3('0x83')]='';}var _0x15d74d=_0x414e1c[_0xb0d3('0x7e')]===_0xb0d3('0x85')?'eu':_0xb0d3('0x99');return getAccessToken(_0x414e1c)[_0xb0d3('0x26')](function(_0x197de7){_0x227044=_0x197de7;return getUser(_0x227044,_0x15d74d,_0x414e1c);})[_0xb0d3('0x26')](function(_0x2ed170){_0x4e5250=_0x2ed170;logger[_0xb0d3('0x34')](_0xb0d3('0x93'),_0x4e5250['id']);return getEndUser(_0x227044,_0x15d74d,_0x414e1c,_0xc8f5f7['calleridname'],_0xc8f5f7['calleridnum'],_0x4e5250,_0x391de2);})[_0xb0d3('0x26')](function(_0x482e3c){_0x6fdd7f=_0x482e3c;return getCall(_0x227044,_0x15d74d,_0x414e1c,_0x4e5250,_0x6fdd7f,_0x391de2,_0xc8f5f7,'Inbound');})[_0xb0d3('0x26')](function(_0x58127c){if(_0x58127c){logger['info']('The\x20Call\x20ID\x20is:',_0x58127c['id']);}})['catch'](function(_0x1c7e23){logger[_0xb0d3('0x2b')]('['+_0xc8f5f7[_0xb0d3('0x66')][_0xb0d3('0x9a')]()+']',JSON[_0xb0d3('0xe')](_0x1c7e23));});}; \ No newline at end of file +var _0x1a5c=['emit','[HTTP]','forEach','includes','string','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','add','seconds','error','stack','info','format','ActiveUsers','Zoho-oauthtoken\x20','then','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','/crm/v2/','startCase','moduleCreate','role','last_name','details','Error:\x20','log','moduleSearch','uri','https://www.zohoapis.','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','administrator','first_name','Subjects','Description','getString','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','talktime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','mm:ss','lastevent','Call_Result','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','POST','/crm/v2/Calls','code','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','[QUEUE]','recordingFormat','none','/api/voice/recordings/','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','https://crm.','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x1a5c,0x12c));var _0xc1a5=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x1a5c[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0xc1a5('0x0'));var rp=require(_0xc1a5('0x1'));var md5=require(_0xc1a5('0x2'));var util=require(_0xc1a5('0x3'));var intUtil=require(_0xc1a5('0x4'));var moment=require(_0xc1a5('0x5'));var Redis=require(_0xc1a5('0x6'));var BPromise=require(_0xc1a5('0x7'));var config=require(_0xc1a5('0x8'));var logger=require(_0xc1a5('0x9'))('zoho');config[_0xc1a5('0xa')]=_[_0xc1a5('0xb')](config[_0xc1a5('0xa')],{'host':_0xc1a5('0xc'),'port':0x18eb});var io=require(_0xc1a5('0xd'))(new Redis(config[_0xc1a5('0xa')]));function emit(_0x369ea7,_0x23d907,_0x4fbe9e){io['to'](_0x369ea7)[_0xc1a5('0xe')](_0x23d907,_0x4fbe9e);}function request(_0x7167aa){logger['debug'](_0xc1a5('0xf'),JSON['stringify'](_0x7167aa));return rp(_0x7167aa);}function getCustomFields(_0x536121,_0x399129){var _0x2ef9c4={};if(_0x536121['length']>0x0){_[_0xc1a5('0x10')](_0x536121,function(_0x1b4e6b){if(_[_0xc1a5('0x11')]([_0xc1a5('0x12'),_0xc1a5('0x13')],_0x1b4e6b['type'])&&_0x1b4e6b[_0xc1a5('0x14')]){_0x2ef9c4[_0x1b4e6b[_0xc1a5('0x14')]]=_0x1b4e6b[_0xc1a5('0x15')][_0xc1a5('0x16')]();}else if(_0x1b4e6b[_0xc1a5('0x17')]===_0xc1a5('0x18')&&_0x1b4e6b[_0xc1a5('0x19')]&&_0x1b4e6b[_0xc1a5('0x14')]&&_0x399129[_0x1b4e6b[_0xc1a5('0x19')]]){_0x2ef9c4[_0x1b4e6b['idField']]=_0x399129[_0x1b4e6b['variableName']][_0xc1a5('0x16')]();}else if(_0x1b4e6b[_0xc1a5('0x17')]===_0xc1a5('0x1a')&&_0x1b4e6b['Variable']&&_0x1b4e6b[_0xc1a5('0x1b')][_0xc1a5('0x1c')]&&_0x1b4e6b[_0xc1a5('0x14')]&&_0x399129[_0x1b4e6b['Variable'][_0xc1a5('0x1c')]['toLowerCase']()]){_0x2ef9c4[_0x1b4e6b[_0xc1a5('0x14')]]=_0x399129[_0x1b4e6b[_0xc1a5('0x1b')][_0xc1a5('0x1c')][_0xc1a5('0x1d')]()][_0xc1a5('0x16')]();}});}return _0x2ef9c4;}function getName(_0xbccfb9){if(_0xbccfb9[_0xc1a5('0x1e')]('\x20')>0x0){var _0x4591df=_0xbccfb9[_0xc1a5('0x1f')](/ (.+)/);if(_0x4591df[0x1]){return _0x4591df;}}return[_0xbccfb9,_0xbccfb9];}var accountsTokens={};function getAccessToken(_0x1f327c){return new Promise(function(_0x45a3f5,_0x267ee0){if(!_[_0xc1a5('0x20')](accountsTokens[_0x1f327c['id']])&&!_[_0xc1a5('0x20')](accountsTokens[_0x1f327c['id']]['access_token'])){if(moment()[_0xc1a5('0x21')](accountsTokens[_0x1f327c['id']][_0xc1a5('0x22')])){_0x45a3f5(accountsTokens[_0x1f327c['id']]['access_token']);}}var _0x5a3228;switch(_0x1f327c[_0xc1a5('0x23')]){case'US':_0x5a3228=_0xc1a5('0x24');break;case'AU':_0x5a3228=_0xc1a5('0x25');break;case'EU':_0x5a3228=_0xc1a5('0x26');break;case'IN':_0x5a3228=_0xc1a5('0x27');break;case'CN':_0x5a3228=_0xc1a5('0x28');break;default:_0x5a3228=_0xc1a5('0x26');break;}var _0x4ba053={'method':'POST','uri':_0x5a3228+_0xc1a5('0x29'),'qs':{'refresh_token':_0x1f327c[_0xc1a5('0x2a')],'client_id':_0x1f327c[_0xc1a5('0x2b')],'client_secret':_0x1f327c['clientSecret'],'grant_type':_0xc1a5('0x2c')},'json':!![]};return rp(_0x4ba053)['then'](function(_0x5aba6b){accountsTokens[_0x1f327c['id']]={'access_token':_0x5aba6b[_0xc1a5('0x2d')],'expires_in':moment()[_0xc1a5('0x2e')](_0x5aba6b[_0xc1a5('0x22')],_0xc1a5('0x2f'))};_0x45a3f5(_0x5aba6b['access_token']);})['catch'](function(_0x4f3f99){logger[_0xc1a5('0x30')]('Failing\x20creating\x20the\x20access_token',_0x4f3f99[_0xc1a5('0x31')]);_0x267ee0(_0x4f3f99);});});}function getUser(_0x4dc158,_0x2bef7a,_0x3ba741,_0x29c00a){logger[_0xc1a5('0x32')]('Search\x20user');return request({'method':'GET','uri':util[_0xc1a5('0x33')]('https://www.zohoapis.%s/crm/v2/users',_0x2bef7a),'qs':{'type':_0xc1a5('0x34')},'headers':{'Authorization':_0xc1a5('0x35')+_0x4dc158},'json':!![]})[_0xc1a5('0x36')](function(_0x2b3792){if(_0x2b3792['users']){var _0x4dbf2f=-0x1;if(_[_0xc1a5('0x37')](_0x2b3792[_0xc1a5('0x38')])){if(!_[_0xc1a5('0x20')](_0x29c00a)){_0x4dbf2f=_[_0xc1a5('0x39')](_0x2b3792[_0xc1a5('0x38')],function(_0x12e3dc){return _0x12e3dc[_0xc1a5('0x3a')]===_0x29c00a;});}if(_0x4dbf2f>=0x0){logger[_0xc1a5('0x32')](_0xc1a5('0x3b'));}else{logger[_0xc1a5('0x32')](_0xc1a5('0x3c'));_0x4dbf2f=_[_0xc1a5('0x39')](_0x2b3792[_0xc1a5('0x38')],function(_0x4165fa){return _0x4165fa['profile'][_0xc1a5('0x1c')]===_0xc1a5('0x3d');});}return _0x2b3792[_0xc1a5('0x38')][_0x4dbf2f];}else{if(_0x2b3792[_0xc1a5('0x3e')][_0xc1a5('0x3f')][_0xc1a5('0x1c')]==='Administrator'){logger[_0xc1a5('0x32')](_0xc1a5('0x3c'));user=_0x2b3792[_0xc1a5('0x3e')];return user;}else{logger[_0xc1a5('0x30')]('The\x20failing\x20result\x20is',JSON[_0xc1a5('0x40')](_0x2b3792));throw new Error(_0xc1a5('0x41')+JSON[_0xc1a5('0x40')](_0x2b3792));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0xc1a5('0x40')](_0x2b3792));throw new Error(_0xc1a5('0x41')+JSON['stringify'](_0x2b3792));}})[_0xc1a5('0x42')](function(_0x5c2718){console['error'](_0x5c2718);});}function getZohoUser(_0x231570,_0x1039ce){return new BPromise(function(_0x135b54,_0xfec89d){request(_0x231570)[_0xc1a5('0x36')](function(_0x5672da){var _0x2d98a3=null;if(_0x5672da){_0x2d98a3=_0x5672da[_0xc1a5('0x43')][0x0];_0x2d98a3[_0xc1a5('0x44')]=_0x1039ce;}_0x135b54(_0x2d98a3);})[_0xc1a5('0x42')](function(_0x484c59){_0xfec89d(_0x484c59);});});}function createEndUser(_0x331e0b,_0xe28eff,_0x777914,_0x40fa26,_0x46180a,_0xd37c8d){var _0x777914=getName(_0x777914);return request({'method':'POST','uri':'https://www.zohoapis.'+_0xe28eff+_0xc1a5('0x45')+_[_0xc1a5('0x46')](_0xd37c8d[_0xc1a5('0x47')])+'s','body':{'data':[{'Last_Name':_0x777914[0x1],'First_Name':_0x777914[0x0],'Phone':_0x40fa26,'Owner':{'name':!_[_0xc1a5('0x20')](_0x46180a[_0xc1a5('0x48')][_0xc1a5('0x1c')])?_0x46180a[_0xc1a5('0x48')][_0xc1a5('0x1c')]:!_['isNil'](_0x46180a['first_name'])?_0x46180a['first_name']+'\x20'+_0x46180a['last_name']:_0x46180a[_0xc1a5('0x49')],'id':_0x46180a['id']}}]},'headers':{'Authorization':_0xc1a5('0x35')+_0x331e0b},'json':!![]})[_0xc1a5('0x36')](function(_0x5f0ea0){if(_0x5f0ea0&&_0x5f0ea0[_0xc1a5('0x43')][0x0]['code']==='SUCCESS'){var _0x536f30=_0x5f0ea0[_0xc1a5('0x43')][0x0][_0xc1a5('0x4a')];_0x536f30[_0xc1a5('0x44')]=_[_0xc1a5('0x46')](_0xd37c8d[_0xc1a5('0x47')])+'s';return _0x536f30;}logger[_0xc1a5('0x30')]('The\x20failing\x20result\x20is',JSON[_0xc1a5('0x40')](data));throw new Error(_0xc1a5('0x4b')+JSON[_0xc1a5('0x40')](data));})[_0xc1a5('0x42')](function(_0x1446d2){console[_0xc1a5('0x4c')]('CREATE\x20ERROR',_0x1446d2);});}function getEndUser(_0x330141,_0x112ef0,_0x46d4cc,_0x2fc0f2,_0x4da9ea,_0x5df3f6,_0x45abc1){var _0x4d04c4={'method':'GET','uri':'','headers':{'Authorization':_0xc1a5('0x35')+_0x330141},'json':!![]};switch(_0x45abc1[_0xc1a5('0x4d')]){case'contact_lead':_0x4d04c4[_0xc1a5('0x4e')]=_0xc1a5('0x4f')+_0x112ef0+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4da9ea+'))';return getZohoUser(_0x4d04c4,_0xc1a5('0x50'))['then'](function(_0x37d2b9){if(_0x37d2b9)return _0x37d2b9;_0x4d04c4[_0xc1a5('0x4e')]='https://www.zohoapis.'+_0x112ef0+_0xc1a5('0x51')+_0x4da9ea+'))';return getZohoUser(_0x4d04c4,_0xc1a5('0x52'))[_0xc1a5('0x36')](function(_0x6a9a49){if(_0x6a9a49)return _0x6a9a49;if(_0x45abc1[_0xc1a5('0x47')]!=_0xc1a5('0x53')){return createEndUser(_0x330141,_0x112ef0,_0x2fc0f2,_0x4da9ea,_0x5df3f6,_0x45abc1);}else{return{};}});});break;case _0xc1a5('0x54'):_0x4d04c4['uri']=_0xc1a5('0x4f')+_0x112ef0+_0xc1a5('0x55')+_0x4da9ea+'))';return getZohoUser(_0x4d04c4,_0xc1a5('0x50'))[_0xc1a5('0x36')](function(_0x2e6c77){if(_0x2e6c77)return _0x2e6c77;if(_0x45abc1[_0xc1a5('0x47')]!='nothing'){return createEndUser(_0x330141,_0x112ef0,_0x2fc0f2,_0x4da9ea,_0x5df3f6,_0x45abc1);}else{return{};}});break;case _0xc1a5('0x56'):_0x4d04c4[_0xc1a5('0x4e')]='https://www.zohoapis.'+_0x112ef0+_0xc1a5('0x51')+_0x4da9ea+'))';return getZohoUser(_0x4d04c4,_0xc1a5('0x52'))['then'](function(_0x3581ba){if(_0x3581ba)return _0x3581ba;if(_0x45abc1[_0xc1a5('0x47')]!='nothing'){return createEndUser(_0x330141,_0x112ef0,_0x2fc0f2,_0x4da9ea,_0x5df3f6,_0x45abc1);}else{return{};}});break;}}function getCall(_0x3973c8,_0x23b8ee,_0x3ac8b6,_0x3b1b9b,_0x46daf2,_0xa050e4,_0x4371e2,_0x532e5a){logger[_0xc1a5('0x32')](_0xc1a5('0x57'));var _0x2e2f6a={};_0x2e2f6a['Owner']={'name':!_[_0xc1a5('0x20')](_0x3b1b9b[_0xc1a5('0x48')]['name'])&&!_[_0xc1a5('0x20')](_0x3b1b9b[_0xc1a5('0x3f')]['name'])&&_0x3b1b9b[_0xc1a5('0x3f')]['name']===_0xc1a5('0x58')?_0x3b1b9b[_0xc1a5('0x48')][_0xc1a5('0x1c')]:!_[_0xc1a5('0x20')](_0x3b1b9b[_0xc1a5('0x59')])?_0x3b1b9b[_0xc1a5('0x59')]+'\x20'+_0x3b1b9b[_0xc1a5('0x49')]:_0x3b1b9b['last_name'],'id':_0x3b1b9b['id']};_0x2e2f6a['Subject']=intUtil['getString'](_0xa050e4[_0xc1a5('0x5a')],_0x4371e2,'\x20');_0x2e2f6a[_0xc1a5('0x5b')]=intUtil[_0xc1a5('0x5c')](_0xa050e4['Descriptions'],_0x4371e2,'\x0a');if(_0x46daf2[_0xc1a5('0x44')]==='Contacts'){_0x2e2f6a['Who_Id']={'name':!_['isNil'](_0x46daf2['Full_Name'])?_0x46daf2[_0xc1a5('0x5d')]:!_[_0xc1a5('0x20')](_0x46daf2[_0xc1a5('0x5e')])?_0x46daf2[_0xc1a5('0x5e')]+'\x20'+_0x46daf2[_0xc1a5('0x5f')]:_0x46daf2[_0xc1a5('0x5f')],'id':_0x46daf2['id']};}if(_0x46daf2[_0xc1a5('0x44')]==='Leads'){_0x2e2f6a[_0xc1a5('0x60')]={'name':!_[_0xc1a5('0x20')](_0x46daf2[_0xc1a5('0x5d')])?_0x46daf2[_0xc1a5('0x5d')]:!_[_0xc1a5('0x20')](_0x46daf2[_0xc1a5('0x5e')])?_0x46daf2[_0xc1a5('0x5e')]+'\x20'+_0x46daf2[_0xc1a5('0x5f')]:_0x46daf2[_0xc1a5('0x5f')],'id':_0x46daf2['id']};_0x2e2f6a[_0xc1a5('0x61')]=_[_0xc1a5('0x46')](_0x46daf2[_0xc1a5('0x44')]);}if(_0x4371e2['talktime']){_0x2e2f6a[_0xc1a5('0x62')]=moment['utc'](parseInt(_0x4371e2[_0xc1a5('0x63')])*0x3e8)['format']('mm:ss');}else if(_0x4371e2['answertime']&&_0x4371e2[_0xc1a5('0x64')]){_0x2e2f6a['Call_Duration']=moment[_0xc1a5('0x65')](moment(_0x4371e2[_0xc1a5('0x64')],_0xc1a5('0x66'))[_0xc1a5('0x67')](moment(_0x4371e2['starttime'],_0xc1a5('0x66'))))[_0xc1a5('0x33')](_0xc1a5('0x68'));}switch(_0x4371e2[_0xc1a5('0x69')]){case'called':_0x2e2f6a[_0xc1a5('0x6a')]='Called';break;case _0xc1a5('0x6b'):case _0xc1a5('0x6c'):_0x2e2f6a[_0xc1a5('0x6a')]=_0xc1a5('0x6d');break;case _0xc1a5('0x6e'):_0x2e2f6a[_0xc1a5('0x6a')]=_0xc1a5('0x6f');break;case'abandoned':_0x2e2f6a[_0xc1a5('0x6a')]=_0xc1a5('0x70');break;case _0xc1a5('0x71'):_0x2e2f6a[_0xc1a5('0x6a')]=_0xc1a5('0x72');default:}_0x2e2f6a[_0xc1a5('0x73')]=(_0x532e5a===_0xc1a5('0x74')?moment(_0x4371e2['starttime'])[_0xc1a5('0x33')](_0xc1a5('0x66')):moment(_0x4371e2[_0xc1a5('0x75')])[_0xc1a5('0x33')](_0xc1a5('0x66')))||moment()[_0xc1a5('0x33')](_0xc1a5('0x66'));_0x2e2f6a[_0xc1a5('0x76')]=_0x532e5a||_0xc1a5('0x77');_0x2e2f6a=_[_0xc1a5('0x78')](_0x2e2f6a,getCustomFields(_0xa050e4[_0xc1a5('0x79')],_0x4371e2));return request({'method':_0xc1a5('0x7a'),'uri':_0xc1a5('0x4f')+_0x23b8ee+_0xc1a5('0x7b'),'headers':{'Authorization':_0xc1a5('0x35')+_0x3973c8},'body':{'data':[_0x2e2f6a]},'json':!![]})[_0xc1a5('0x36')](function(_0x1b2911){if(_0x1b2911&&_0x1b2911[_0xc1a5('0x43')][0x0][_0xc1a5('0x7c')]===_0xc1a5('0x7d')){logger[_0xc1a5('0x32')](_0xc1a5('0x7e'));return{'id':_0x1b2911['data'][0x0][_0xc1a5('0x4a')]['id']};}})[_0xc1a5('0x42')](function(_0x460d71){logger[_0xc1a5('0x32')]('err',_0x460d71[_0xc1a5('0x31')]);console[_0xc1a5('0x4c')](_0xc1a5('0x7f'),_0x460d71);});}exports[_0xc1a5('0x80')]=function(_0x6a7c2,_0x2d1425,_0x277fad,_0x3491a3,_0x48e4ec,_0x28dee9){var _0x4d5b58,_0x26f13f,_0x23afc4;_0x28dee9[_0xc1a5('0x81')]=intUtil[_0xc1a5('0x82')](_0x28dee9['host']);_0x28dee9['serverUrl']=intUtil[_0xc1a5('0x82')](_0x28dee9[_0xc1a5('0x83')]);if(_0x48e4ec&&_0x48e4ec[_0xc1a5('0x84')]){logger[_0xc1a5('0x32')]('[QUEUE]',_0xc1a5('0x85'));_0x2d1425[_0xc1a5('0x86')]=_0x28dee9['serverUrl']+'/api/voice/recordings/'+_0x2d1425[_0xc1a5('0x87')]+'/downloads?type=uniqueid&token='+md5(_0x2d1425[_0xc1a5('0x87')]);}else{_0x2d1425[_0xc1a5('0x86')]='';}var _0xba4229=_0x28dee9[_0xc1a5('0x81')]===_0xc1a5('0x88')?'eu':_0xc1a5('0x89');return getAccessToken(_0x28dee9)[_0xc1a5('0x36')](function(_0x3d93de){_0x23afc4=_0x3d93de;return getUser(_0x23afc4,_0xba4229,_0x28dee9,_0x3491a3[_0xc1a5('0x3a')]);})['then'](function(_0x269012){_0x4d5b58=_0x269012;logger['info'](_0xc1a5('0x8a'),_0x4d5b58['id']);return getEndUser(_0x23afc4,_0xba4229,_0x28dee9,_0x2d1425[_0xc1a5('0x8b')],_0x2d1425[_0xc1a5('0x8c')],_0x4d5b58,_0x277fad);})['then'](function(_0x3e5142){_0x26f13f=_0x3e5142;return getCall(_0x23afc4,_0xba4229,_0x28dee9,_0x4d5b58,_0x26f13f,_0x277fad,_0x2d1425,'Inbound');})[_0xc1a5('0x36')](function(_0x36c05c){if(_0x36c05c){logger[_0xc1a5('0x32')](_0xc1a5('0x8d'),_0x36c05c['id']);logger[_0xc1a5('0x32')]('[QUEUE]',_0xc1a5('0x8e'));emit(util[_0xc1a5('0x33')](_0xc1a5('0x8f'),_0x3491a3[_0xc1a5('0x1c')]),_0xc1a5('0x90'),{'uri':'https://crm.'+_0x28dee9[_0xc1a5('0x81')]+'/crm/EntityInfo.do?module=Calls&id='+_0x36c05c['id']});}})[_0xc1a5('0x42')](function(_0x9cbd0){logger['error'](_0xc1a5('0x91'),JSON['stringify'](_0x9cbd0));});};exports['outbound']=function(_0x44e40c,_0x5d48be,_0xe11d96,_0x177c48,_0x436351,_0x4bf38e,_0x25abc1){var _0x5812a6,_0xf6e215,_0x1e7789;_0x4bf38e[_0xc1a5('0x81')]=intUtil[_0xc1a5('0x82')](_0x4bf38e[_0xc1a5('0x81')]);_0x4bf38e[_0xc1a5('0x83')]=intUtil[_0xc1a5('0x82')](_0x4bf38e[_0xc1a5('0x83')]);if(_0x25abc1&&_0x25abc1[_0xc1a5('0x92')]&&_0x25abc1[_0xc1a5('0x92')]!==_0xc1a5('0x93')){logger[_0xc1a5('0x32')]('[OUTBOUND]',_0xc1a5('0x85'));_0x5d48be[_0xc1a5('0x86')]=_0x4bf38e['serverUrl']+_0xc1a5('0x94')+_0x5d48be[_0xc1a5('0x87')]+_0xc1a5('0x95')+md5(_0x5d48be[_0xc1a5('0x87')]);}var _0x2b9701=_0x4bf38e['host']===_0xc1a5('0x88')?'eu':_0xc1a5('0x89');return getAccessToken(_0x4bf38e)[_0xc1a5('0x36')](function(_0x38b6f7){_0x1e7789=_0x38b6f7;return getUser(_0x1e7789,_0x2b9701,_0x4bf38e,_0x177c48[_0xc1a5('0x3a')]);})[_0xc1a5('0x36')](function(_0x37d344){_0x5812a6=_0x37d344;logger[_0xc1a5('0x32')](_0xc1a5('0x8a'),_0x5812a6['id']);return getEndUser(_0x1e7789,_0x2b9701,_0x4bf38e,_0x5d48be[_0xc1a5('0x96')],_0x5d48be[_0xc1a5('0x97')],_0x5812a6,_0xe11d96);})[_0xc1a5('0x36')](function(_0x56557a){_0xf6e215=_0x56557a;return getCall(_0x1e7789,_0x2b9701,_0x4bf38e,_0x5812a6,_0xf6e215,_0xe11d96,_0x5d48be,_0xc1a5('0x98'));})[_0xc1a5('0x36')](function(_0x4ddf8c){if(_0x4ddf8c){logger['info'](_0xc1a5('0x8d'),_0x4ddf8c['id']);logger[_0xc1a5('0x32')](_0xc1a5('0x99'),_0xc1a5('0x8e'));emit(util[_0xc1a5('0x33')]('user:%s',_0x177c48[_0xc1a5('0x1c')]),_0xc1a5('0x90'),{'uri':_0xc1a5('0x9a')+_0x4bf38e[_0xc1a5('0x81')]+'/crm/EntityInfo.do?module=Calls&id='+_0x4ddf8c['id']});}})['catch'](function(_0x1f8bb0){logger[_0xc1a5('0x30')]('[OUTBOUND]',JSON[_0xc1a5('0x40')](_0x1f8bb0));});};exports[_0xc1a5('0x9b')]=function(_0x2707fe,_0x5c9fd2,_0x53e3d8,_0x133f99,_0xf29bf9,_0x3aee2c){var _0x2c80ab,_0x3fba3e,_0x4d4606;_0x3aee2c['host']=intUtil[_0xc1a5('0x82')](_0x3aee2c[_0xc1a5('0x81')]);_0x3aee2c[_0xc1a5('0x83')]=intUtil[_0xc1a5('0x82')](_0x3aee2c[_0xc1a5('0x83')]);if(_0xf29bf9&&_0xf29bf9[_0xc1a5('0x84')]){logger[_0xc1a5('0x32')]('['+_0x5c9fd2[_0xc1a5('0x69')]['toUpperCase']()+']',_0xc1a5('0x85'));_0x5c9fd2[_0xc1a5('0x86')]=_0x3aee2c['serverUrl']+_0xc1a5('0x94')+_0x5c9fd2['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x5c9fd2['uniqueid']);}else{_0x5c9fd2['recordingURL']='';}var _0x408220=_0x3aee2c[_0xc1a5('0x81')]===_0xc1a5('0x88')?'eu':_0xc1a5('0x89');return getAccessToken(_0x3aee2c)[_0xc1a5('0x36')](function(_0x310249){_0x4d4606=_0x310249;return getUser(_0x4d4606,_0x408220,_0x3aee2c);})[_0xc1a5('0x36')](function(_0xdda3d1){_0x2c80ab=_0xdda3d1;logger[_0xc1a5('0x32')](_0xc1a5('0x8a'),_0x2c80ab['id']);return getEndUser(_0x4d4606,_0x408220,_0x3aee2c,_0x5c9fd2[_0xc1a5('0x8b')],_0x5c9fd2['calleridnum'],_0x2c80ab,_0x53e3d8);})['then'](function(_0x16a67e){_0x3fba3e=_0x16a67e;return getCall(_0x4d4606,_0x408220,_0x3aee2c,_0x2c80ab,_0x3fba3e,_0x53e3d8,_0x5c9fd2,'Inbound');})[_0xc1a5('0x36')](function(_0x2b06e4){if(_0x2b06e4){logger[_0xc1a5('0x32')]('The\x20Call\x20ID\x20is:',_0x2b06e4['id']);}})[_0xc1a5('0x42')](function(_0x2107d6){logger[_0xc1a5('0x30')]('['+_0x5c9fd2[_0xc1a5('0x69')][_0xc1a5('0x9c')]()+']',JSON[_0xc1a5('0x40')](_0x2107d6));});}; \ 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 3a93b21..bff9c4e 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 _0xb4cc=['mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xb4cc,0x124));var _0xcb4c=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0xb4cc[_0x308213];return _0x2e1619;};'use strict';var util=require(_0xcb4c('0x0'));var sh=require(_0xcb4c('0x1'));var Mustache=require(_0xcb4c('0x2'));var logger=require(_0xcb4c('0x3'))(_0xcb4c('0x4'));exports[_0xcb4c('0x5')]=function(_0x41e93d,_0x1a6dab){var _0x2155e1=_0x41e93d[_0xcb4c('0x6')]?_0x41e93d['data2']:_0xcb4c('0x7');var _0x49b030=_0x41e93d[_0xcb4c('0x8')]?Mustache[_0xcb4c('0x9')](_0x41e93d[_0xcb4c('0x8')],_0x1a6dab):_0x1a6dab;sh[_0xcb4c('0x5')](_0x49b030,function(_0x4b46ad,_0x23a701,_0x2362db){if(_0x4b46ad!==0x0){logger[_0xcb4c('0xa')](util[_0xcb4c('0xb')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x2155e1,_0x49b030,_0x4b46ad,_0x2362db));}else{logger[_0xcb4c('0xc')](util[_0xcb4c('0xb')](_0xcb4c('0xd'),_0x2155e1,_0x49b030,_0x23a701));}});}; \ No newline at end of file +var _0x7fd9=['data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','shelljs','mustache','../../../../config/logger','exec','data2','Script'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x7fd9,0xbf));var _0x97fd=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x7fd9[_0x3074f3];return _0x53f112;};'use strict';var util=require(_0x97fd('0x0'));var sh=require(_0x97fd('0x1'));var Mustache=require(_0x97fd('0x2'));var logger=require(_0x97fd('0x3'))('trigger');exports[_0x97fd('0x4')]=function(_0x450bfc,_0x37d626){var _0x562c42=_0x450bfc[_0x97fd('0x5')]?_0x450bfc[_0x97fd('0x5')]:_0x97fd('0x6');var _0x189b01=_0x450bfc[_0x97fd('0x7')]?Mustache['render'](_0x450bfc['data3'],_0x37d626):_0x37d626;sh[_0x97fd('0x4')](_0x189b01,function(_0x50e60e,_0x19170e,_0x2e0542){if(_0x50e60e!==0x0){logger[_0x97fd('0x8')](util['format'](_0x97fd('0x9'),_0x562c42,_0x189b01,_0x50e60e,_0x2e0542));}else{logger[_0x97fd('0xa')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x562c42,_0x189b01,_0x19170e));}});}; \ 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 e8ce554..623b429 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 _0x8d16=['parse','render','error','stack','GET','DELETE','POST','PUT','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','data2','then','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','number','data5','headers','data6'];(function(_0x5bf807,_0x4ef599){var _0x10be18=function(_0x2a26d4){while(--_0x2a26d4){_0x5bf807['push'](_0x5bf807['shift']());}};_0x10be18(++_0x4ef599);}(_0x8d16,0x141));var _0x68d1=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0x8d16[_0x5c6299];return _0x23b564;};'use strict';var rp=require(_0x68d1('0x0'));var util=require('util');var _=require(_0x68d1('0x1'));var Mustache=require(_0x68d1('0x2'));var logger=require(_0x68d1('0x3'))(_0x68d1('0x4'));exports[_0x68d1('0x5')]=function(_0x40bb90,_0x35989b){var _0x2d5a8f,_0x44693d;var _0x55e9a9={'method':_0x40bb90[_0x68d1('0x6')][_0x68d1('0x7')](),'uri':Mustache['render'](_0x40bb90['data2'],_0x35989b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x40bb90['data5'])===_0x68d1('0x8')&&parseInt(_0x40bb90[_0x68d1('0x9')])>=0x1&&parseInt(_0x40bb90['data5'])<=0xa?parseInt(_0x40bb90[_0x68d1('0x9')])*0x3e8:0x5*0x3e8};try{_0x55e9a9[_0x68d1('0xa')]=_0x40bb90[_0x68d1('0xb')]?JSON[_0x68d1('0xc')](Mustache[_0x68d1('0xd')](_0x40bb90[_0x68d1('0xb')],_0x35989b)):{};}catch(_0x544811){logger[_0x68d1('0xe')](_0x544811[_0x68d1('0xf')]);}switch(_0x40bb90['data1'][_0x68d1('0x7')]()){case _0x68d1('0x10'):case _0x68d1('0x11'):_0x2d5a8f=null;_0x55e9a9['qs']=_0x35989b;break;case _0x68d1('0x12'):case _0x68d1('0x13'):if(_0x40bb90['data7']){try{_0x2d5a8f=JSON['parse'](Mustache['render'](_0x40bb90[_0x68d1('0x14')],_0x35989b));_0x55e9a9['body']=_0x2d5a8f;}catch(_0x455e1a){logger[_0x68d1('0xe')](_0x455e1a[_0x68d1('0xf')]);logger[_0x68d1('0xe')](_0x68d1('0x15'));}}else{_0x2d5a8f=_0x35989b;_0x55e9a9[_0x68d1('0x16')]=_0x2d5a8f;}break;}logger[_0x68d1('0x17')](util[_0x68d1('0x18')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x40bb90['data1'],_0x40bb90[_0x68d1('0x19')],JSON['stringify'](_0x55e9a9)));rp(_0x55e9a9)[_0x68d1('0x1a')](function(_0x5ca214){_0x2d5a8f=!_[_0x68d1('0x1b')](_0x2d5a8f)?_0x68d1('0x1c')+_0x2d5a8f:'';_0x44693d=typeof _0x5ca214[_0x68d1('0x16')]===_0x68d1('0x1d')?JSON[_0x68d1('0x1e')](_0x5ca214[_0x68d1('0x16')]):_0x5ca214[_0x68d1('0x16')];logger[_0x68d1('0x17')](util['format'](_0x68d1('0x1f'),_0x40bb90[_0x68d1('0x6')],_0x40bb90[_0x68d1('0x19')],_0x5ca214[_0x68d1('0x20')],_0x44693d));})[_0x68d1('0x21')](function(_0xbffac1){logger[_0x68d1('0xe')](util[_0x68d1('0x18')](_0x68d1('0x22'),_0x40bb90[_0x68d1('0x6')],_0x40bb90[_0x68d1('0x19')],_0xbffac1[_0x68d1('0x20')],_0xbffac1[_0x68d1('0x23')],_0xbffac1[_0x68d1('0x24')]));});}; \ No newline at end of file +var _0x3fa0=['name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','toUpperCase','render','data2','number','data5','headers','data6','error','GET','POST','PUT','data7','parse','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','isNil',',\x20request\x20body:\x20','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s'];(function(_0x4b094b,_0x296fdb){var _0x32eac3=function(_0x4b0f39){while(--_0x4b0f39){_0x4b094b['push'](_0x4b094b['shift']());}};_0x32eac3(++_0x296fdb);}(_0x3fa0,0x8e));var _0x03fa=function(_0x5d1297,_0x14912b){_0x5d1297=_0x5d1297-0x0;var _0x542733=_0x3fa0[_0x5d1297];return _0x542733;};'use strict';var rp=require(_0x03fa('0x0'));var util=require(_0x03fa('0x1'));var _=require(_0x03fa('0x2'));var Mustache=require(_0x03fa('0x3'));var logger=require(_0x03fa('0x4'))(_0x03fa('0x5'));exports[_0x03fa('0x6')]=function(_0x443b3d,_0x1ce5c6){var _0x1cf621,_0x29bda0;var _0x349be5={'method':_0x443b3d['data1'][_0x03fa('0x7')](),'uri':Mustache[_0x03fa('0x8')](_0x443b3d[_0x03fa('0x9')],_0x1ce5c6),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x443b3d['data5'])===_0x03fa('0xa')&&parseInt(_0x443b3d[_0x03fa('0xb')])>=0x1&&parseInt(_0x443b3d['data5'])<=0xa?parseInt(_0x443b3d[_0x03fa('0xb')])*0x3e8:0x5*0x3e8};try{_0x349be5[_0x03fa('0xc')]=_0x443b3d[_0x03fa('0xd')]?JSON['parse'](Mustache[_0x03fa('0x8')](_0x443b3d[_0x03fa('0xd')],_0x1ce5c6)):{};}catch(_0x1361dc){logger[_0x03fa('0xe')](_0x1361dc['stack']);}switch(_0x443b3d['data1']['toUpperCase']()){case _0x03fa('0xf'):case'DELETE':_0x1cf621=null;_0x349be5['qs']=_0x1ce5c6;break;case _0x03fa('0x10'):case _0x03fa('0x11'):if(_0x443b3d[_0x03fa('0x12')]){try{_0x1cf621=JSON[_0x03fa('0x13')](Mustache['render'](_0x443b3d['data7'],_0x1ce5c6));_0x349be5[_0x03fa('0x14')]=_0x1cf621;}catch(_0x57d3d5){logger[_0x03fa('0xe')](_0x57d3d5[_0x03fa('0x15')]);logger[_0x03fa('0xe')](_0x03fa('0x16'));}}else{_0x1cf621=_0x1ce5c6;_0x349be5[_0x03fa('0x14')]=_0x1cf621;}break;}logger[_0x03fa('0x17')](util['format'](_0x03fa('0x18'),_0x443b3d['data1'],_0x443b3d[_0x03fa('0x9')],JSON['stringify'](_0x349be5)));rp(_0x349be5)['then'](function(_0x39ed7f){_0x1cf621=!_[_0x03fa('0x19')](_0x1cf621)?_0x03fa('0x1a')+_0x1cf621:'';_0x29bda0=typeof _0x39ed7f['body']==='object'?JSON['stringify'](_0x39ed7f[_0x03fa('0x14')]):_0x39ed7f['body'];logger[_0x03fa('0x17')](util[_0x03fa('0x1b')](_0x03fa('0x1c'),_0x443b3d[_0x03fa('0x1d')],_0x443b3d[_0x03fa('0x9')],_0x39ed7f[_0x03fa('0x1e')],_0x29bda0));})[_0x03fa('0x1f')](function(_0x2913bf){logger[_0x03fa('0xe')](util[_0x03fa('0x1b')](_0x03fa('0x20'),_0x443b3d[_0x03fa('0x1d')],_0x443b3d['data2'],_0x2913bf[_0x03fa('0x1e')],_0x2913bf[_0x03fa('0x21')],_0x2913bf[_0x03fa('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 4938329..4f13903 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 _0x289f=['Request','request','then','debug','error','rpc','message','result','catch','exports','jayson/promise','routing','client'];(function(_0x39784a,_0x42a996){var _0x5669e6=function(_0xdd891d){while(--_0xdd891d){_0x39784a['push'](_0x39784a['shift']());}};_0x5669e6(++_0x42a996);}(_0x289f,0x11b));var _0xf289=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x289f[_0x26f702];return _0x11417d;};'use strict';var jayson=require(_0xf289('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xf289('0x1'));var client=jayson[_0xf289('0x2')]['http']({'port':0x2329});client[_0xf289('0x3')]=function(_0xcb43af,_0x2ac89e){return new BPromise(function(_0x4e124b,_0x39052d){return client[_0xf289('0x4')](_0xcb43af,_0x2ac89e)[_0xf289('0x5')](function(_0x3d6966){logger[_0xf289('0x6')]('rpc',_0xf289('0x1'),_0xcb43af,_0x2ac89e,_0x3d6966);if(_0x3d6966[_0xf289('0x7')]){logger[_0xf289('0x7')](_0xf289('0x8'),_0xf289('0x1'),_0xcb43af,_0x3d6966['error'][_0xf289('0x9')],_0x2ac89e);return _0x39052d(_0x3d6966[_0xf289('0x7')]['message']);}else{return _0x4e124b(_0x3d6966[_0xf289('0xa')]);}})[_0xf289('0xb')](function(_0x23f9d3){logger['error'](_0xf289('0x8'),_0xf289('0x1'),_0xcb43af,_0x23f9d3,_0x2ac89e);return _0x39052d(_0x23f9d3);});});};module[_0xf289('0xc')]=client; \ No newline at end of file +var _0x3d12=['Request','request','rpc','error','routing','message','exports','jayson/promise','bluebird','../../config/logger','client','http'];(function(_0x2bc823,_0x57e79c){var _0x14c1ce=function(_0x1ae74e){while(--_0x1ae74e){_0x2bc823['push'](_0x2bc823['shift']());}};_0x14c1ce(++_0x57e79c);}(_0x3d12,0xf7));var _0x23d1=function(_0x459975,_0x4afac3){_0x459975=_0x459975-0x0;var _0x4db023=_0x3d12[_0x459975];return _0x4db023;};'use strict';var jayson=require(_0x23d1('0x0'));var BPromise=require(_0x23d1('0x1'));var logger=require(_0x23d1('0x2'))('routing');var client=jayson[_0x23d1('0x3')][_0x23d1('0x4')]({'port':0x2329});client[_0x23d1('0x5')]=function(_0x210e3f,_0xb1bdfd){return new BPromise(function(_0x110a4f,_0x3023c0){return client[_0x23d1('0x6')](_0x210e3f,_0xb1bdfd)['then'](function(_0x4e66d8){logger['debug'](_0x23d1('0x7'),'routing',_0x210e3f,_0xb1bdfd,_0x4e66d8);if(_0x4e66d8[_0x23d1('0x8')]){logger['error'](_0x23d1('0x7'),_0x23d1('0x9'),_0x210e3f,_0x4e66d8[_0x23d1('0x8')][_0x23d1('0xa')],_0xb1bdfd);return _0x3023c0(_0x4e66d8[_0x23d1('0x8')]['message']);}else{return _0x110a4f(_0x4e66d8['result']);}})['catch'](function(_0x243f98){logger[_0x23d1('0x8')](_0x23d1('0x7'),_0x23d1('0x9'),_0x210e3f,_0x243f98,_0xb1bdfd);return _0x3023c0(_0x243f98);});});};module[_0x23d1('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 1455d14..9efd50a 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 _0xf0a8=['error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','listen','getSettings','catch'];(function(_0x49bf94,_0x1b48c7){var _0x88831d=function(_0x555f68){while(--_0x555f68){_0x49bf94['push'](_0x49bf94['shift']());}};_0x88831d(++_0x1b48c7);}(_0xf0a8,0xbd));var _0x8f0a=function(_0x30eb64,_0x714398){_0x30eb64=_0x30eb64-0x0;var _0x3c3537=_0xf0a8[_0x30eb64];return _0x3c3537;};'use strict';var server=require(_0x8f0a('0x0'));var Realtime=require(_0x8f0a('0x1'));var EmailChannel=require(_0x8f0a('0x2'));var mailAccount=require(_0x8f0a('0x3'));var setting=require('./rpc/setting');var logger=require(_0x8f0a('0x4'))(_0x8f0a('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x8f0a('0x6')]()['then'](mailAccount[_0x8f0a('0x7')]())[_0x8f0a('0x8')](realtime[_0x8f0a('0x9')]())[_0x8f0a('0x8')](function(){email[_0x8f0a('0xa')](realtime[_0x8f0a('0xb')]);return realtime;});}function main(){return server[_0x8f0a('0xc')](realtime,email)['then'](function(){return initRealtime();})[_0x8f0a('0x8')](function(){return setting[_0x8f0a('0xd')]();})[_0x8f0a('0x8')](function(_0x4dc382){return setInterval(initRealtime,_0x4dc382['loginMailFrequency']*0x3e8);})[_0x8f0a('0xe')](function(_0x3f74e8){logger[_0x8f0a('0xf')](_0x8f0a('0x10'),_0x3f74e8);});}main(); \ No newline at end of file +var _0xd0a6=['./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','initMailAccounts','mailAccounts','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./realtime'];(function(_0x5d74c1,_0x14ef3f){var _0x26d575=function(_0x54e60d){while(--_0x54e60d){_0x5d74c1['push'](_0x5d74c1['shift']());}};_0x26d575(++_0x14ef3f);}(_0xd0a6,0x1da));var _0x6d0a=function(_0x41a328,_0xcd27ce){_0x41a328=_0x41a328-0x0;var _0x57b494=_0xd0a6[_0x41a328];return _0x57b494;};'use strict';var server=require(_0x6d0a('0x0'));var Realtime=require(_0x6d0a('0x1'));var EmailChannel=require(_0x6d0a('0x2'));var mailAccount=require(_0x6d0a('0x3'));var setting=require(_0x6d0a('0x4'));var logger=require(_0x6d0a('0x5'))(_0x6d0a('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x6d0a('0x7')]()[_0x6d0a('0x8')](mailAccount['getMailAccounts']())[_0x6d0a('0x8')](realtime[_0x6d0a('0x9')]())['then'](function(){email['refresh'](realtime[_0x6d0a('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x6d0a('0x8')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0x6d0a('0x8')](function(_0x561f8b){return setInterval(initRealtime,_0x561f8b[_0x6d0a('0xb')]*0x3e8);})[_0x6d0a('0xc')](function(_0x22cd17){logger['error'](_0x6d0a('0xd'),_0x22cd17);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 39135be..2bf731d 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 _0x04bb=['md5','ioredis','../../../config/environment','email','defaults','redis','localhost','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','status','Imap','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','provider','custom','box','bind','handleImapEmail','end','handleImapEnd','disabled','messageStatus','handleImapBox','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','verifySmtp','Smtp','verify','verified','bluebird'];(function(_0x4319d0,_0x3e86dc){var _0x1daf34=function(_0x256d31){while(--_0x256d31){_0x4319d0['push'](_0x4319d0['shift']());}};_0x1daf34(++_0x3e86dc);}(_0x04bb,0xa7));var _0xb04b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x04bb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xb04b('0x0'));var md5=require(_0xb04b('0x1'));var Redis=require(_0xb04b('0x2'));var config=require(_0xb04b('0x3'));var logger=require('../../../config/logger')(_0xb04b('0x4'));config['redis']=_[_0xb04b('0x5')](config[_0xb04b('0x6')],{'host':_0xb04b('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0xb04b('0x8'));var mailAccount=require(_0xb04b('0x9'));var md5Accounts={};function EmailChannel(_0x31c94e){logger['info'](_0xb04b('0xa'));this[_0xb04b('0xb')]=_0x31c94e[_0xb04b('0xb')];this[_0xb04b('0xc')]={};this[_0xb04b('0xd')]=new EmailSmtp();}EmailChannel[_0xb04b('0xe')][_0xb04b('0xf')]=function(_0x2c8eac){var _0x4f1cac=this[_0xb04b('0xb')][_0x2c8eac];var _0x46504b={'id':_0x4f1cac['id'],'name':_0x4f1cac[_0xb04b('0x10')],'key':_0x4f1cac[_0xb04b('0x11')],'active':_0x4f1cac[_0xb04b('0x12')],'Imap':{'status':_0x4f1cac['Imap'][_0xb04b('0x13')],'messageStatus':_0x4f1cac[_0xb04b('0x14')]['messageStatus'],'total':_0x4f1cac[_0xb04b('0x14')][_0xb04b('0x15')]}};if(_[_0xb04b('0x16')](md5Accounts[_0x2c8eac])){md5Accounts[_0x2c8eac]={};}var _0x508b1d=md5(JSON[_0xb04b('0x17')](_0x46504b));if(md5Accounts[_0x2c8eac]['md5']!==_0x508b1d){md5Accounts[_0x2c8eac][_0xb04b('0x1')]=_0x508b1d;io[_0xb04b('0xf')](_0xb04b('0x18'),_0x46504b);}};EmailChannel[_0xb04b('0xe')][_0xb04b('0x19')]=function(_0x2602a2){for(var _0x6ceb4c in _0x2602a2){if(_0x2602a2[_0xb04b('0x1a')](_0x6ceb4c)){if(_0x2602a2[_0x6ceb4c][_0xb04b('0x14')]&&_0x2602a2[_0x6ceb4c][_0xb04b('0x12')]){var _0x8fc106=_0x2602a2[_0x6ceb4c][_0xb04b('0x14')];if(!_0x8fc106['service']&&_0x2602a2[_0x6ceb4c][_0xb04b('0x1b')]!==_0xb04b('0x1c'))_0x8fc106['service']=_0x2602a2[_0x6ceb4c][_0xb04b('0x1b')];if(!this[_0xb04b('0xc')]['hasOwnProperty'](_0x8fc106['id'])){this[_0xb04b('0xc')][_0x8fc106['id']]=new EmailImap(_0x8fc106,_0x2602a2[_0x6ceb4c]['email']);this['imapAccounts'][_0x8fc106['id']]['on'](_0xb04b('0x1d'),this['handleImapBox'][_0xb04b('0x1e')](this,_0x6ceb4c));this[_0xb04b('0xc')][_0x8fc106['id']]['on'](_0xb04b('0x4'),this[_0xb04b('0x1f')]['bind'](this,_0x6ceb4c));this[_0xb04b('0xc')][_0x8fc106['id']]['on'](_0xb04b('0x20'),this[_0xb04b('0x21')]['bind'](this,_0x6ceb4c));this['imapAccounts'][_0x8fc106['id']]['on']('error',this['handleImapError'][_0xb04b('0x1e')](this,_0x6ceb4c));}}else{if(_['isNil'](this[_0xb04b('0xb')][_0x6ceb4c][_0xb04b('0x14')])){this['mailAccounts'][_0x6ceb4c][_0xb04b('0x14')]={};}this[_0xb04b('0xb')][_0x6ceb4c]['Imap']['status']=_0xb04b('0x22');this[_0xb04b('0xb')][_0x6ceb4c][_0xb04b('0x14')][_0xb04b('0x23')]='';this[_0xb04b('0xf')](_0x6ceb4c);}}}};EmailChannel[_0xb04b('0xe')][_0xb04b('0x24')]=function(_0x48d830,_0x3f3dd0){if(this[_0xb04b('0xb')][_0x48d830]){this[_0xb04b('0xb')][_0x48d830][_0xb04b('0x14')][_0xb04b('0x13')]='connected';this[_0xb04b('0xb')][_0x48d830][_0xb04b('0x14')][_0xb04b('0x23')]=_0x3f3dd0[_0xb04b('0x10')];if(_0x3f3dd0['messages']){this[_0xb04b('0xb')][_0x48d830][_0xb04b('0x14')][_0xb04b('0x15')]=_0x3f3dd0[_0xb04b('0x25')][_0xb04b('0x15')];}return this[_0xb04b('0xf')](_0x48d830);}};EmailChannel[_0xb04b('0xe')][_0xb04b('0x1f')]=function(_0x46309b,_0x28fd9c){logger[_0xb04b('0x26')](_0xb04b('0x27'),_0x28fd9c[_0xb04b('0x28')],_0x28fd9c[_0xb04b('0x29')],_0x28fd9c[_0xb04b('0x2a')],_0x46309b);if(this[_0xb04b('0xb')][_0x46309b]){return mailAccount[_0xb04b('0x2b')](_0x46309b,_0x28fd9c)[_0xb04b('0x2c')](function(_0x51f352){if(_0x51f352){logger[_0xb04b('0x26')](_0xb04b('0x2d'));}})[_0xb04b('0x2e')](function(_0x360cb2){logger[_0xb04b('0x2f')](_0xb04b('0x30'),JSON[_0xb04b('0x17')](_0x360cb2));});}};EmailChannel[_0xb04b('0xe')][_0xb04b('0x21')]=function(_0x614a55){if(this['mailAccounts'][_0x614a55]&&this[_0xb04b('0xb')][_0x614a55]['Imap']){if(this[_0xb04b('0xc')][this[_0xb04b('0xb')][_0x614a55]['Imap']['id']]){delete this[_0xb04b('0xc')][this[_0xb04b('0xb')][_0x614a55][_0xb04b('0x14')]['id']];}this[_0xb04b('0xb')][_0x614a55]['Imap'][_0xb04b('0x31')]=moment();this[_0xb04b('0xf')](_0x614a55);}};EmailChannel[_0xb04b('0xe')][_0xb04b('0x32')]=function(_0x10fa20,_0x2827a0){if(this[_0xb04b('0xb')][_0x10fa20]){this[_0xb04b('0xb')][_0x10fa20][_0xb04b('0x14')][_0xb04b('0x13')]='error';this[_0xb04b('0xb')][_0x10fa20][_0xb04b('0x14')]['messageStatus']=_0x2827a0;return this['emit'](_0x10fa20);}};EmailChannel['prototype'][_0xb04b('0x33')]=function(_0x563e64,_0x23e01f){return this[_0xb04b('0xd')]['send'](_0x563e64,_0x23e01f);};EmailChannel[_0xb04b('0xe')][_0xb04b('0x34')]=function(_0x4d1d39){var _0x7eedf9=this;if(this[_0xb04b('0xb')][_0x4d1d39['id']]){if(_[_0xb04b('0x16')](this['mailAccounts'][_0x4d1d39['id']][_0xb04b('0x35')])){this['mailAccounts'][_0x4d1d39['id']][_0xb04b('0x35')]={};}this[_0xb04b('0xb')][_0x4d1d39['id']]['Smtp'][_0xb04b('0x31')]=moment();return new BPromise(function(_0x3694a3,_0x4aee03){return _0x7eedf9[_0xb04b('0xd')][_0xb04b('0x36')](_0x4d1d39)[_0xb04b('0x2c')](function(_0x521c9e){_0x7eedf9['mailAccounts'][_0x4d1d39['id']][_0xb04b('0x35')][_0xb04b('0x13')]=_0xb04b('0x37');_0x7eedf9[_0xb04b('0xb')][_0x4d1d39['id']][_0xb04b('0x35')]['messageStatus']='';_0x7eedf9[_0xb04b('0xf')](_0x4d1d39['id']);_0x3694a3(_0x521c9e);})['catch'](function(_0x4b8ee2){_0x7eedf9['mailAccounts'][_0x4d1d39['id']][_0xb04b('0x35')][_0xb04b('0x13')]=_0xb04b('0x2f');_0x7eedf9[_0xb04b('0xb')][_0x4d1d39['id']]['Smtp'][_0xb04b('0x23')]=_0x4b8ee2;_0x7eedf9[_0xb04b('0xf')](_0x4d1d39['id']);_0x4aee03(_0x4b8ee2);});});}return this['smtp'][_0xb04b('0x36')](_0x4d1d39);};module['exports']=EmailChannel; \ No newline at end of file +var _0x590b=['exports','lodash','moment','bluebird','md5','ioredis','email','redis','localhost','./imap','./smtp','info','mailAccounts','imapAccounts','smtp','prototype','emit','key','Imap','status','isNil','mailAccount:update','active','custom','service','provider','hasOwnProperty','box','handleImapBox','bind','end','handleImapError','disabled','messageStatus','name','messages','total','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','catch','error','stringify','handleImapEnd','lastSync','sendMail','send','Smtp','verified','verify'];(function(_0x5777b7,_0x5a16f3){var _0x382792=function(_0x5743c4){while(--_0x5743c4){_0x5777b7['push'](_0x5777b7['shift']());}};_0x382792(++_0x5a16f3);}(_0x590b,0x69));var _0xb590=function(_0x2e785e,_0x232c0a){_0x2e785e=_0x2e785e-0x0;var _0x230f26=_0x590b[_0x2e785e];return _0x230f26;};'use strict';var _=require(_0xb590('0x0'));var moment=require(_0xb590('0x1'));var BPromise=require(_0xb590('0x2'));var md5=require(_0xb590('0x3'));var Redis=require(_0xb590('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xb590('0x5'));config[_0xb590('0x6')]=_['defaults'](config['redis'],{'host':_0xb590('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb590('0x6')]));var EmailImap=require(_0xb590('0x8'));var EmailSmtp=require(_0xb590('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x5a99ba){logger[_0xb590('0xa')]('start\x20email\x20channel');this['mailAccounts']=_0x5a99ba[_0xb590('0xb')];this[_0xb590('0xc')]={};this[_0xb590('0xd')]=new EmailSmtp();}EmailChannel[_0xb590('0xe')][_0xb590('0xf')]=function(_0x5e3e57){var _0x45764c=this[_0xb590('0xb')][_0x5e3e57];var _0x15af19={'id':_0x45764c['id'],'name':_0x45764c['name'],'key':_0x45764c[_0xb590('0x10')],'active':_0x45764c['active'],'Imap':{'status':_0x45764c[_0xb590('0x11')][_0xb590('0x12')],'messageStatus':_0x45764c[_0xb590('0x11')]['messageStatus'],'total':_0x45764c['Imap']['total']}};if(_[_0xb590('0x13')](md5Accounts[_0x5e3e57])){md5Accounts[_0x5e3e57]={};}var _0x5ad717=md5(JSON['stringify'](_0x15af19));if(md5Accounts[_0x5e3e57][_0xb590('0x3')]!==_0x5ad717){md5Accounts[_0x5e3e57][_0xb590('0x3')]=_0x5ad717;io[_0xb590('0xf')](_0xb590('0x14'),_0x15af19);}};EmailChannel['prototype']['refresh']=function(_0x53abb4){for(var _0x539459 in _0x53abb4){if(_0x53abb4['hasOwnProperty'](_0x539459)){if(_0x53abb4[_0x539459][_0xb590('0x11')]&&_0x53abb4[_0x539459][_0xb590('0x15')]){var _0x4a52b2=_0x53abb4[_0x539459]['Imap'];if(!_0x4a52b2['service']&&_0x53abb4[_0x539459]['provider']!==_0xb590('0x16'))_0x4a52b2[_0xb590('0x17')]=_0x53abb4[_0x539459][_0xb590('0x18')];if(!this[_0xb590('0xc')][_0xb590('0x19')](_0x4a52b2['id'])){this[_0xb590('0xc')][_0x4a52b2['id']]=new EmailImap(_0x4a52b2,_0x53abb4[_0x539459]['email']);this['imapAccounts'][_0x4a52b2['id']]['on'](_0xb590('0x1a'),this[_0xb590('0x1b')][_0xb590('0x1c')](this,_0x539459));this['imapAccounts'][_0x4a52b2['id']]['on']('email',this['handleImapEmail']['bind'](this,_0x539459));this[_0xb590('0xc')][_0x4a52b2['id']]['on'](_0xb590('0x1d'),this['handleImapEnd'][_0xb590('0x1c')](this,_0x539459));this[_0xb590('0xc')][_0x4a52b2['id']]['on']('error',this[_0xb590('0x1e')][_0xb590('0x1c')](this,_0x539459));}}else{if(_[_0xb590('0x13')](this[_0xb590('0xb')][_0x539459]['Imap'])){this['mailAccounts'][_0x539459][_0xb590('0x11')]={};}this[_0xb590('0xb')][_0x539459]['Imap'][_0xb590('0x12')]=_0xb590('0x1f');this[_0xb590('0xb')][_0x539459]['Imap'][_0xb590('0x20')]='';this['emit'](_0x539459);}}}};EmailChannel[_0xb590('0xe')]['handleImapBox']=function(_0x42ee09,_0x34c974){if(this[_0xb590('0xb')][_0x42ee09]){this[_0xb590('0xb')][_0x42ee09]['Imap']['status']='connected';this[_0xb590('0xb')][_0x42ee09][_0xb590('0x11')][_0xb590('0x20')]=_0x34c974[_0xb590('0x21')];if(_0x34c974[_0xb590('0x22')]){this[_0xb590('0xb')][_0x42ee09][_0xb590('0x11')]['total']=_0x34c974['messages'][_0xb590('0x23')];}return this['emit'](_0x42ee09);}};EmailChannel[_0xb590('0xe')][_0xb590('0x24')]=function(_0x4395b7,_0x216400){logger[_0xb590('0xa')](_0xb590('0x25'),_0x216400['firstName'],_0x216400['lastName'],_0x216400[_0xb590('0x26')],_0x4395b7);if(this['mailAccounts'][_0x4395b7]){return mailAccount[_0xb590('0x27')](_0x4395b7,_0x216400)[_0xb590('0x28')](function(_0x5f39ab){if(_0x5f39ab){logger[_0xb590('0xa')]('Mail\x20accepted\x20from\x20routing');}})[_0xb590('0x29')](function(_0x49de33){logger[_0xb590('0x2a')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xb590('0x2b')](_0x49de33));});}};EmailChannel[_0xb590('0xe')][_0xb590('0x2c')]=function(_0x2e53c2){if(this[_0xb590('0xb')][_0x2e53c2]&&this[_0xb590('0xb')][_0x2e53c2]['Imap']){if(this['imapAccounts'][this[_0xb590('0xb')][_0x2e53c2][_0xb590('0x11')]['id']]){delete this[_0xb590('0xc')][this[_0xb590('0xb')][_0x2e53c2][_0xb590('0x11')]['id']];}this[_0xb590('0xb')][_0x2e53c2]['Imap'][_0xb590('0x2d')]=moment();this[_0xb590('0xf')](_0x2e53c2);}};EmailChannel['prototype'][_0xb590('0x1e')]=function(_0x403703,_0x533d76){if(this[_0xb590('0xb')][_0x403703]){this[_0xb590('0xb')][_0x403703][_0xb590('0x11')][_0xb590('0x12')]=_0xb590('0x2a');this[_0xb590('0xb')][_0x403703][_0xb590('0x11')][_0xb590('0x20')]=_0x533d76;return this[_0xb590('0xf')](_0x403703);}};EmailChannel[_0xb590('0xe')][_0xb590('0x2e')]=function(_0x1040bc,_0x425159){return this[_0xb590('0xd')][_0xb590('0x2f')](_0x1040bc,_0x425159);};EmailChannel[_0xb590('0xe')]['verifySmtp']=function(_0x59c5d9){var _0x23df7f=this;if(this[_0xb590('0xb')][_0x59c5d9['id']]){if(_[_0xb590('0x13')](this['mailAccounts'][_0x59c5d9['id']]['Smtp'])){this['mailAccounts'][_0x59c5d9['id']][_0xb590('0x30')]={};}this['mailAccounts'][_0x59c5d9['id']][_0xb590('0x30')][_0xb590('0x2d')]=moment();return new BPromise(function(_0x2a9b9c,_0x219a59){return _0x23df7f[_0xb590('0xd')]['verify'](_0x59c5d9)['then'](function(_0x136893){_0x23df7f['mailAccounts'][_0x59c5d9['id']][_0xb590('0x30')][_0xb590('0x12')]=_0xb590('0x31');_0x23df7f[_0xb590('0xb')][_0x59c5d9['id']][_0xb590('0x30')][_0xb590('0x20')]='';_0x23df7f[_0xb590('0xf')](_0x59c5d9['id']);_0x2a9b9c(_0x136893);})[_0xb590('0x29')](function(_0x57ab54){_0x23df7f[_0xb590('0xb')][_0x59c5d9['id']]['Smtp']['status']='error';_0x23df7f['mailAccounts'][_0x59c5d9['id']][_0xb590('0x30')][_0xb590('0x20')]=_0x57ab54;_0x23df7f[_0xb590('0xf')](_0x59c5d9['id']);_0x219a59(_0x57ab54);});});}return this[_0xb590('0xd')][_0xb590('0x32')](_0x59c5d9);};module[_0xb590('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 58e6652..faa9304 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 _0x7e98=['handleReady','bind','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls','required','openBox','handleOpenBox','emit','box','readUnseen','end','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','handleCloseBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','closeBox','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','simpleParser','iconv','events','EventEmitter','./utils','mailbox','account','getAccount','once','ready'];(function(_0xf6e75d,_0xc70967){var _0x27514d=function(_0xc2c6dd){while(--_0xc2c6dd){_0xf6e75d['push'](_0xf6e75d['shift']());}};_0x27514d(++_0xc70967);}(_0x7e98,0xb3));var _0x87e9=function(_0x47bf89,_0x2d11c7){_0x47bf89=_0x47bf89-0x0;var _0x49d9ae=_0x7e98[_0x47bf89];return _0x49d9ae;};'use strict';var _=require(_0x87e9('0x0'));var util=require(_0x87e9('0x1'));var Imap=require(_0x87e9('0x2'));var simpleParser=require('mailparser')[_0x87e9('0x3')];var Iconv=require(_0x87e9('0x4'))['Iconv'];var EventEmitter=require(_0x87e9('0x5'))[_0x87e9('0x6')];var utils=require(_0x87e9('0x7'));var logger=require('../../../config/logger')('email');function EmailImap(_0x59ef4d,_0x56f876){this[_0x87e9('0x8')]=_0x59ef4d[_0x87e9('0x8')];this[_0x87e9('0x9')]=this[_0x87e9('0xa')](_0x59ef4d,_0x56f876);this[_0x87e9('0x2')]=new Imap(this[_0x87e9('0x9')]);this['imap'][_0x87e9('0xb')](_0x87e9('0xc'),this[_0x87e9('0xd')]['bind'](this));this[_0x87e9('0x2')]['once']('end',this['handleEnd'][_0x87e9('0xe')](this));this[_0x87e9('0x2')]['on']('error',this[_0x87e9('0xf')][_0x87e9('0xe')](this));this[_0x87e9('0x2')][_0x87e9('0x10')]();}util[_0x87e9('0x11')](EmailImap,EventEmitter);EmailImap[_0x87e9('0x12')]['getAccount']=function(_0x1ec14f,_0x4f2440){var _0x26ae6e={'connTimeout':_0x1ec14f[_0x87e9('0x13')]?_0x1ec14f[_0x87e9('0x13')]*0x3e8:0x2710,'authTimeout':_0x1ec14f['authTimeout']?_0x1ec14f[_0x87e9('0x14')]*0x3e8:0x1388};if(_0x1ec14f['service']){_0x26ae6e['user']=_0x1ec14f[_0x87e9('0x15')];if(_0x1ec14f['modernAuthentication']){_0x26ae6e[_0x87e9('0x16')]=utils[_0x87e9('0x17')](_0x1ec14f[_0x87e9('0x18')][_0x87e9('0x19')],_0x1ec14f[_0x87e9('0x15')]);}else{_0x26ae6e[_0x87e9('0x1a')]=_0x1ec14f[_0x87e9('0x1a')];}}else{if(_0x1ec14f[_0x87e9('0x1b')]){_0x26ae6e[_0x87e9('0x15')]=_0x1ec14f[_0x87e9('0x15')];_0x26ae6e['password']=_0x1ec14f[_0x87e9('0x1a')];}}_0x26ae6e[_0x87e9('0x1c')]=_0x4f2440||_0x1ec14f[_0x87e9('0x15')]||_0x87e9('0x1d');_0x26ae6e[_0x87e9('0x1e')]=_0x1ec14f['host'];_0x26ae6e['port']=_0x1ec14f[_0x87e9('0x1f')]||0x3e1;if(_0x1ec14f[_0x87e9('0x20')]){_0x26ae6e['tls']=!![];}else{_0x26ae6e[_0x87e9('0x20')]=![];_0x26ae6e[_0x87e9('0x21')]=_0x87e9('0x22');}return _0x26ae6e;};EmailImap[_0x87e9('0x12')]['handleReady']=function(){this['imap'][_0x87e9('0x23')](this[_0x87e9('0x8')],![],this[_0x87e9('0x24')][_0x87e9('0xe')](this));};EmailImap[_0x87e9('0x12')]['handleOpenBox']=function(_0x4b4c12,_0x25cafa){if(_0x4b4c12){this[_0x87e9('0xf')](_0x4b4c12,!![]);}else{this[_0x87e9('0x25')](_0x87e9('0x26'),_0x25cafa);this[_0x87e9('0x27')]();}};EmailImap[_0x87e9('0x12')]['handleCloseBox']=function(_0x653513){if(_0x653513){this[_0x87e9('0xf')](_0x653513,!![]);}else{this[_0x87e9('0x2')][_0x87e9('0x28')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0x87e9('0x2')][_0x87e9('0x29')]([_0x87e9('0x2a')],this[_0x87e9('0x2b')][_0x87e9('0xe')](this));};EmailImap[_0x87e9('0x12')][_0x87e9('0x2b')]=function(_0x29da63,_0x503d49){if(_0x29da63){this[_0x87e9('0xf')](_0x29da63,!![]);}else{if(_0x503d49[_0x87e9('0x2c')]){try{var _0xfab041=this[_0x87e9('0x2')][_0x87e9('0x2d')](_0x503d49,{'bodies':'','markSeen':!![]});_0xfab041['on'](_0x87e9('0x2e'),this[_0x87e9('0x2f')]['bind'](this));_0xfab041[_0x87e9('0xb')](_0x87e9('0x30'),this[_0x87e9('0x31')][_0x87e9('0xe')](this));_0xfab041[_0x87e9('0xb')](_0x87e9('0x28'),this[_0x87e9('0x32')][_0x87e9('0xe')](this));}catch(_0x56e48b){logger[_0x87e9('0x30')](_0x56e48b);}}else{this[_0x87e9('0x2')]['closeBox'](!![],this[_0x87e9('0x33')][_0x87e9('0xe')](this));}}};EmailImap['prototype'][_0x87e9('0x2f')]=function(_0x1416c1){_0x1416c1['on'](_0x87e9('0x34'),this[_0x87e9('0x35')]['bind'](this));_0x1416c1[_0x87e9('0xb')]('attributes',this[_0x87e9('0x36')][_0x87e9('0xe')](this));_0x1416c1[_0x87e9('0xb')](_0x87e9('0x28'),this[_0x87e9('0x37')][_0x87e9('0xe')](this));};EmailImap[_0x87e9('0x12')][_0x87e9('0x35')]=function(_0x4bd5fa){simpleParser(_0x4bd5fa,{'Iconv':Iconv},this[_0x87e9('0x38')][_0x87e9('0xe')](this));};EmailImap[_0x87e9('0x12')][_0x87e9('0x36')]=function(){};EmailImap[_0x87e9('0x12')]['handleMessageEnd']=function(){};EmailImap[_0x87e9('0x12')][_0x87e9('0x38')]=function(_0x30ee4a,_0x1c9805){if(_0x30ee4a){logger['error'](_0x30ee4a);}else{var _0x269a35=this;utils['parser'](this[_0x87e9('0x9')],_0x1c9805,function(_0xef92ee){_0x269a35[_0x87e9('0x25')](_0x87e9('0x1c'),_0xef92ee);});}};EmailImap[_0x87e9('0x12')][_0x87e9('0x32')]=function(){this['imap'][_0x87e9('0x39')](!![],this[_0x87e9('0x33')]['bind'](this));};EmailImap[_0x87e9('0x12')][_0x87e9('0x31')]=function(_0x491092){this['handleError'](_0x491092);this['imap'][_0x87e9('0x39')](!![],this[_0x87e9('0x33')][_0x87e9('0xe')](this));};EmailImap[_0x87e9('0x12')][_0x87e9('0x3a')]=function(){this[_0x87e9('0x25')](_0x87e9('0x28'));};EmailImap['prototype']['handleError']=function(_0x5f0985,_0x3a361a){logger[_0x87e9('0x30')]('handleError',this[_0x87e9('0x9')][_0x87e9('0x1c')],JSON[_0x87e9('0x3b')](_0x5f0985));var _0x2bdc7a='';if(_0x5f0985){if(_0x5f0985[_0x87e9('0x3c')]){_0x2bdc7a=_0x5f0985[_0x87e9('0x3c')];}else{for(var _0x4ad8f9 in _0x5f0985){if(_0x5f0985[_0x87e9('0x3d')](_0x4ad8f9)){_0x2bdc7a+=_[_0x87e9('0x3e')](_0x4ad8f9)+':\x20'+_0x5f0985[_0x4ad8f9]+'\x0a';}}}}if(_0x3a361a){this['imap'][_0x87e9('0x28')]();}else{this['emit']('error',_0x2bdc7a);this[_0x87e9('0x25')](_0x87e9('0x28'));}};module[_0x87e9('0x3f')]=EmailImap; \ No newline at end of file +var _0x6668=['handleFetchEnd','closeBox','body','handleMessageBody','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','inherits','prototype','connTimeout','authTimeout','service','user','generateXOAuth2Token','CloudProvider','data5','password','host','port','tls','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','handleError','length','fetch','message','handleFetchMessage'];(function(_0x249c1,_0x1c9acb){var _0x441050=function(_0x1b4af7){while(--_0x1b4af7){_0x249c1['push'](_0x249c1['shift']());}};_0x441050(++_0x1c9acb);}(_0x6668,0x1d5));var _0x8666=function(_0x5a6d11,_0x3f443b){_0x5a6d11=_0x5a6d11-0x0;var _0x2512ff=_0x6668[_0x5a6d11];return _0x2512ff;};'use strict';var _=require(_0x8666('0x0'));var util=require(_0x8666('0x1'));var Imap=require(_0x8666('0x2'));var simpleParser=require(_0x8666('0x3'))[_0x8666('0x4')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require('events')['EventEmitter'];var utils=require(_0x8666('0x5'));var logger=require(_0x8666('0x6'))(_0x8666('0x7'));function EmailImap(_0x53e969,_0x370238){this['mailbox']=_0x53e969[_0x8666('0x8')];this[_0x8666('0x9')]=this[_0x8666('0xa')](_0x53e969,_0x370238);this['imap']=new Imap(this[_0x8666('0x9')]);this[_0x8666('0x2')][_0x8666('0xb')](_0x8666('0xc'),this[_0x8666('0xd')][_0x8666('0xe')](this));this[_0x8666('0x2')][_0x8666('0xb')](_0x8666('0xf'),this[_0x8666('0x10')]['bind'](this));this[_0x8666('0x2')]['on'](_0x8666('0x11'),this['handleError']['bind'](this));this[_0x8666('0x2')]['connect']();}util[_0x8666('0x12')](EmailImap,EventEmitter);EmailImap[_0x8666('0x13')][_0x8666('0xa')]=function(_0x39d27b,_0x20e114){var _0x1c3954={'connTimeout':_0x39d27b[_0x8666('0x14')]?_0x39d27b[_0x8666('0x14')]*0x3e8:0x2710,'authTimeout':_0x39d27b[_0x8666('0x15')]?_0x39d27b['authTimeout']*0x3e8:0x1388};if(_0x39d27b[_0x8666('0x16')]){_0x1c3954[_0x8666('0x17')]=_0x39d27b[_0x8666('0x17')];if(_0x39d27b['modernAuthentication']){_0x1c3954['xoauth2']=utils[_0x8666('0x18')](_0x39d27b[_0x8666('0x19')][_0x8666('0x1a')],_0x39d27b['user']);}else{_0x1c3954['password']=_0x39d27b[_0x8666('0x1b')];}}else{if(_0x39d27b['authentication']){_0x1c3954[_0x8666('0x17')]=_0x39d27b[_0x8666('0x17')];_0x1c3954[_0x8666('0x1b')]=_0x39d27b['password'];}}_0x1c3954[_0x8666('0x7')]=_0x20e114||_0x39d27b['user']||'anonymous@xcally.com';_0x1c3954[_0x8666('0x1c')]=_0x39d27b[_0x8666('0x1c')];_0x1c3954[_0x8666('0x1d')]=_0x39d27b[_0x8666('0x1d')]||0x3e1;if(_0x39d27b[_0x8666('0x1e')]){_0x1c3954[_0x8666('0x1e')]=!![];}else{_0x1c3954[_0x8666('0x1e')]=![];_0x1c3954['autotls']='required';}return _0x1c3954;};EmailImap[_0x8666('0x13')][_0x8666('0xd')]=function(){this[_0x8666('0x2')][_0x8666('0x1f')](this['mailbox'],![],this[_0x8666('0x20')]['bind'](this));};EmailImap[_0x8666('0x13')][_0x8666('0x20')]=function(_0x2e627b,_0x5c0b43){if(_0x2e627b){this['handleError'](_0x2e627b,!![]);}else{this[_0x8666('0x21')](_0x8666('0x22'),_0x5c0b43);this[_0x8666('0x23')]();}};EmailImap[_0x8666('0x13')][_0x8666('0x24')]=function(_0x51d780){if(_0x51d780){this['handleError'](_0x51d780,!![]);}else{this[_0x8666('0x2')][_0x8666('0xf')]();}};EmailImap[_0x8666('0x13')]['readUnseen']=function(){this[_0x8666('0x2')][_0x8666('0x25')](['UNSEEN'],this[_0x8666('0x26')]['bind'](this));};EmailImap[_0x8666('0x13')][_0x8666('0x26')]=function(_0x11e970,_0x328eb6){if(_0x11e970){this[_0x8666('0x27')](_0x11e970,!![]);}else{if(_0x328eb6[_0x8666('0x28')]){try{var _0x6a685b=this['imap'][_0x8666('0x29')](_0x328eb6,{'bodies':'','markSeen':!![]});_0x6a685b['on'](_0x8666('0x2a'),this[_0x8666('0x2b')][_0x8666('0xe')](this));_0x6a685b[_0x8666('0xb')](_0x8666('0x11'),this['handleFetchError'][_0x8666('0xe')](this));_0x6a685b[_0x8666('0xb')](_0x8666('0xf'),this[_0x8666('0x2c')]['bind'](this));}catch(_0x40389f){logger[_0x8666('0x11')](_0x40389f);}}else{this[_0x8666('0x2')][_0x8666('0x2d')](!![],this[_0x8666('0x24')][_0x8666('0xe')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x57b1eb){_0x57b1eb['on'](_0x8666('0x2e'),this[_0x8666('0x2f')][_0x8666('0xe')](this));_0x57b1eb[_0x8666('0xb')]('attributes',this['handleMessageAttributes'][_0x8666('0xe')](this));_0x57b1eb[_0x8666('0xb')](_0x8666('0xf'),this[_0x8666('0x30')][_0x8666('0xe')](this));};EmailImap[_0x8666('0x13')][_0x8666('0x2f')]=function(_0x4bdf4b){simpleParser(_0x4bdf4b,{'Iconv':Iconv},this[_0x8666('0x31')][_0x8666('0xe')](this));};EmailImap[_0x8666('0x13')][_0x8666('0x32')]=function(){};EmailImap[_0x8666('0x13')][_0x8666('0x30')]=function(){};EmailImap[_0x8666('0x13')][_0x8666('0x31')]=function(_0x1e8d5f,_0xdd402c){if(_0x1e8d5f){logger[_0x8666('0x11')](_0x1e8d5f);}else{var _0x49538b=this;utils[_0x8666('0x33')](this[_0x8666('0x9')],_0xdd402c,function(_0x4fab21){_0x49538b[_0x8666('0x21')]('email',_0x4fab21);});}};EmailImap[_0x8666('0x13')][_0x8666('0x2c')]=function(){this[_0x8666('0x2')][_0x8666('0x2d')](!![],this[_0x8666('0x24')][_0x8666('0xe')](this));};EmailImap[_0x8666('0x13')]['handleFetchError']=function(_0xdae678){this[_0x8666('0x27')](_0xdae678);this[_0x8666('0x2')][_0x8666('0x2d')](!![],this[_0x8666('0x24')][_0x8666('0xe')](this));};EmailImap['prototype'][_0x8666('0x10')]=function(){this[_0x8666('0x21')]('end');};EmailImap['prototype'][_0x8666('0x27')]=function(_0x23f8c1,_0x343aed){logger['error']('handleError',this[_0x8666('0x9')][_0x8666('0x7')],JSON[_0x8666('0x34')](_0x23f8c1));var _0x1c2d16='';if(_0x23f8c1){if(_0x23f8c1[_0x8666('0x35')]){_0x1c2d16=_0x23f8c1[_0x8666('0x35')];}else{for(var _0xc8f2df in _0x23f8c1){if(_0x23f8c1[_0x8666('0x36')](_0xc8f2df)){_0x1c2d16+=_[_0x8666('0x37')](_0xc8f2df)+':\x20'+_0x23f8c1[_0xc8f2df]+'\x0a';}}}}if(_0x343aed){this[_0x8666('0x2')][_0x8666('0xf')]();}else{this[_0x8666('0x21')](_0x8666('0x11'),_0x1c2d16);this[_0x8666('0x21')]('end');}};module[_0x8666('0x38')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 34f3022..4857ca1 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 _0xdf41=['prototype','send','use','sendMail','toString','createTransport','Not\x20verifired','exports','nodemailer'];(function(_0xf2682d,_0x48f012){var _0x53dea0=function(_0x47235e){while(--_0x47235e){_0xf2682d['push'](_0xf2682d['shift']());}};_0x53dea0(++_0x48f012);}(_0xdf41,0x18b));var _0x1df4=function(_0x1b0467,_0x47cffd){_0x1b0467=_0x1b0467-0x0;var _0x96b657=_0xdf41[_0x1b0467];return _0x96b657;};'use strict';var nodemailer=require(_0x1df4('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x1df4('0x1')][_0x1df4('0x2')]=function(_0x2df908,_0x4fac65){return new Promise(function(_0x3a49ff,_0x1de5fc){var _0x2edc63=nodemailer['createTransport'](_0x2df908);_0x2edc63[_0x1df4('0x3')]('compile',inlineBase64());_0x2edc63[_0x1df4('0x4')](_0x4fac65,function(_0x5774ab,_0x2b9f19){if(_0x5774ab){_0x1de5fc(_0x5774ab[_0x1df4('0x5')]());}else{_0x3a49ff(_0x2b9f19);}});});};EmailSmtp['prototype']['verify']=function(_0x42459b){return new Promise(function(_0x4f1f3f,_0x3982c8){var _0x344c82=nodemailer[_0x1df4('0x6')](_0x42459b);_0x344c82['verify'](function(_0x1183b4,_0xf02946){if(_0x1183b4){_0x3982c8(_0x1183b4['toString']());}else{if(_0xf02946){_0x4f1f3f(_0xf02946);}else{_0x3982c8(_0x1df4('0x7'));}}});});};module[_0x1df4('0x8')]=EmailSmtp; \ No newline at end of file +var _0xc722=['prototype','use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer'];(function(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0xc722,0x1ee));var _0x2c72=function(_0x428320,_0x15b31a){_0x428320=_0x428320-0x0;var _0x181e04=_0xc722[_0x428320];return _0x181e04;};'use strict';var nodemailer=require(_0x2c72('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x2c72('0x1')]['send']=function(_0x1e7cb2,_0x216b62){return new Promise(function(_0x23a694,_0x4e7690){var _0x482650=nodemailer['createTransport'](_0x1e7cb2);_0x482650[_0x2c72('0x2')](_0x2c72('0x3'),inlineBase64());_0x482650[_0x2c72('0x4')](_0x216b62,function(_0x43916e,_0x2e6ef5){if(_0x43916e){_0x4e7690(_0x43916e[_0x2c72('0x5')]());}else{_0x23a694(_0x2e6ef5);}});});};EmailSmtp[_0x2c72('0x1')][_0x2c72('0x6')]=function(_0x5d6a4b){return new Promise(function(_0x257a00,_0x5b98a5){var _0x29d3c3=nodemailer['createTransport'](_0x5d6a4b);_0x29d3c3[_0x2c72('0x6')](function(_0x4b6432,_0x290edd){if(_0x4b6432){_0x5b98a5(_0x4b6432[_0x2c72('0x5')]());}else{if(_0x290edd){_0x257a00(_0x290edd);}else{_0x5b98a5(_0x2c72('0x7'));}}});});};module[_0x2c72('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 1fd7b11..a133820 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 _0x185a=['_IMG','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','../../../config/logger','email','../../../config/environment','head','address','generate','value','substring','name','indexOf','length','slice','Anonymous','split','pop','isEmpty','anonymous','@xcally.com','html','replace','includes','0x1?_0x549404[_0xa185('0xf')](0x0,-0x1)['join']('\x20'):_0xa7b3da[_0xa185('0xc')];}return _0xa185('0x10');}function getLastName(_0x439eae){var _0x49f0a1=_[_0xa185('0x7')](_0x439eae['value']);if(_0x49f0a1&&_0x49f0a1[_0xa185('0xc')]){var _0x48e978=_0x49f0a1[_0xa185('0xc')][_0xa185('0x11')](/\s+/);return _0x48e978[_0xa185('0xe')]>0x1?_0x48e978[_0xa185('0x12')]():'';}return'';}function getMails(_0x3c4351,_0x407df9){var _0x58aba5='';for(var _0x50380f=0x0;_0x50380f<_0x407df9['value'][_0xa185('0xe')];_0x50380f+=0x1){if(_0x407df9[_0xa185('0xa')][_0x50380f]['address']!==_0x3c4351){if(!_[_0xa185('0x13')](_0x58aba5)){_0x58aba5+=',';}_0x58aba5+=_0x407df9[_0xa185('0xa')][_0x50380f]['name']||_0x407df9['value'][_0x50380f][_0xa185('0x8')]||'';_0x58aba5+='\x20<';_0x58aba5+=_0x407df9[_0xa185('0xa')][_0x50380f]['address']?_0x407df9[_0xa185('0xa')][_0x50380f][_0xa185('0x8')]:_0xa185('0x14')+random['generate'](0x6)+_0xa185('0x15');_0x58aba5+='>';}}return _0x58aba5;}function parseEmail(_0x2fc7ea,_0x55e5ce,_0x1acf0f){if(_0x55e5ce[_0xa185('0x16')]){var _0x14653c=/)<[^<]*)*<\/script>/gi;while(_0x14653c['test'](_0x55e5ce[_0xa185('0x16')])){_0x55e5ce[_0xa185('0x16')]=_0x55e5ce[_0xa185('0x16')][_0xa185('0x17')](_0x14653c,'');}if(_0x55e5ce[_0xa185('0x16')][_0xa185('0x18')](_0xa185('0x19'))){var _0xfdeb5c=[];_0x55e5ce[_0xa185('0x1a')][_0xa185('0x1b')](_0x435f0d=>{_0xfdeb5c[_0xa185('0x1c')](_0x435f0d[_0xa185('0x1d')]);});var _0x49c8d0=/]+>/g;var _0x4b9a04=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2f9c5d=_0x55e5ce[_0xa185('0x16')][_0xa185('0x17')](_0x4b9a04,_0xa185('0x1e'));var _0x2c46df=_0x2f9c5d[_0xa185('0x17')](_0x49c8d0,_0xa185('0x1f'));for(let _0x5eb7d4=0x0;_0x5eb7d4<_0xfdeb5c[_0xa185('0xe')];_0x5eb7d4++){var _0x40f090=_0x2c46df[_0xa185('0x17')](_0xa185('0x1f'),_0xa185('0x20')+_0xfdeb5c[_0x5eb7d4]+'\x20]');_0x2c46df=_0x40f090;}_0x55e5ce[_0xa185('0x16')]=_0x2c46df;}_0x1acf0f[_0xa185('0x21')]=_0x55e5ce[_0xa185('0x16')];}else{_0x1acf0f[_0xa185('0x21')]=_0x55e5ce[_0xa185('0x22')];}if(_0x1acf0f['body']){_0x1acf0f[_0xa185('0x21')]=_0x1acf0f[_0xa185('0x21')][_0xa185('0x17')](/0x0){var _0x21b5e2=[_0xa185('0x32'),_0xa185('0x33'),_0xa185('0x34')];for(var _0x2ff3e1=0x0;_0x2ff3e1<_0x55e5ce[_0xa185('0x31')][_0xa185('0xe')];_0x2ff3e1++){var _0x530d77=_[_0xa185('0xd')](_0x21b5e2,_0x55e5ce[_0xa185('0x31')][_0x2ff3e1][_0xa185('0x35')]);if(_0x530d77>=0x0){_0x1acf0f[_0xa185('0x36')]=!![];}}}return _0x1acf0f;}exports[_0xa185('0x37')]=function(_0x5e5dbe,_0x1a3863,_0x5a924c){var _0x418235={'from':getAddress(_0x1a3863[_0xa185('0x38')]),'firstName':getFirstName(_0x1a3863[_0xa185('0x38')]),'lastName':getLastName(_0x1a3863['from']),'mapKey':'email','message':{'from':getMails(_0x5e5dbe[_0xa185('0x5')],_0x1a3863['from']),'to':_0x5e5dbe['email'],'cc':'','subject':_0x1a3863[_0xa185('0x39')]||'','messageId':_0x1a3863[_0xa185('0x3a')],'inReplyTo':_0x1a3863[_0xa185('0x3b')],'sentAt':moment(_0x1a3863[_0xa185('0x3c')])[_0xa185('0x2a')](_0xa185('0x3d')),'attach':![],'attachments':[]}};if(!_0x1a3863[_0xa185('0x16')]&&!_0x1a3863[_0xa185('0x22')]){var _0xf9c5e9=_['filter'](_0x1a3863['attachments'],{'contentType':'application/ms-tnef'});if(_0xf9c5e9[_0xa185('0xe')]){logger['info'](util[_0xa185('0x2a')](_0xa185('0x3e'),_0x1a3863[_0xa185('0x3a')]));tnef['parseBuffer'](_[_0xa185('0x3f')](_0xf9c5e9)[_0xa185('0x40')],function(_0x26e187,_0x25f242){if(_0x25f242){_0x1a3863[_0xa185('0x16')]=_0x25f242[_0xa185('0x41')]||'

Empty\x20message

';if(_0x25f242[_0xa185('0x42')]){for(var _0x31b352=0x0;_0x31b352<_0x25f242[_0xa185('0x42')][_0xa185('0xe')];_0x31b352++){var _0x50f9f3=_0x25f242[_0xa185('0x42')][_0x31b352];_0x418235[_0xa185('0x24')][_0xa185('0x1a')][_0xa185('0x1c')]({'filename':_0x50f9f3[_0xa185('0x43')],'content':Buffer[_0xa185('0x38')](_0x50f9f3[_0xa185('0x44')])});}}}_0x5a924c(parseEmail(_0x5e5dbe,_0x1a3863,_0x418235));});}else{_0x1a3863[_0xa185('0x16')]=_0xa185('0x45');_0x5a924c(parseEmail(_0x5e5dbe,_0x1a3863,_0x418235));}}else{_0x5a924c(parseEmail(_0x5e5dbe,_0x1a3863,_0x418235));}};exports[_0xa185('0x46')]=function(_0x57c0f6,_0x1a5ca3){var _0x439eab=['user='+(_0x1a5ca3||''),_0xa185('0x47')+_0x57c0f6,'',''];return Buffer[_0xa185('0x38')](_0x439eab[_0xa185('0x2d')](''),_0xa185('0x48'))[_0xa185('0x49')](_0xa185('0x4a'));}; \ No newline at end of file +var _0xecf8=['body','email','message','originCc','originTo','bcc','attach','type','attachment','attachment-','%s-%s','root','writeFileSync','content','push','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','format','first','BodyHTML','Attachments','Data','

Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','path','util','../../../config/logger','../../../config/environment','head','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','value','isEmpty','html','test','replace','includes','attachments','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]'];(function(_0x49cb71,_0x2f0149){var _0x3a50fd=function(_0x48c304){while(--_0x48c304){_0x49cb71['push'](_0x49cb71['shift']());}};_0x3a50fd(++_0x2f0149);}(_0xecf8,0x153));var _0x8ecf=function(_0x227801,_0x246332){_0x227801=_0x227801-0x0;var _0x4441ff=_0xecf8[_0x227801];return _0x4441ff;};'use strict';var _=require(_0x8ecf('0x0'));var moment=require(_0x8ecf('0x1'));var random=require(_0x8ecf('0x2'));var fs=require('fs');var path=require(_0x8ecf('0x3'));var util=require(_0x8ecf('0x4'));var tnef=require('node-tnef');var logger=require(_0x8ecf('0x5'))('email');var config=require(_0x8ecf('0x6'));function getAddress(_0x35d9b8){var _0x52cb30=_[_0x8ecf('0x7')](_0x35d9b8['value']);return _0x52cb30&&_0x52cb30['address']?_0x52cb30[_0x8ecf('0x8')]:_0x8ecf('0x9')+random[_0x8ecf('0xa')](0x6)+_0x8ecf('0xb');}function getFirstName(_0xa8b36a){var _0x3ae387=_[_0x8ecf('0x7')](_0xa8b36a['value']);if(_0x3ae387&&_0x3ae387['name']){if(_0x3ae387[_0x8ecf('0xc')]==_0x3ae387['address']){return _0x3ae387[_0x8ecf('0xc')][_0x8ecf('0xd')](0x0,_0x3ae387[_0x8ecf('0xc')][_0x8ecf('0xe')]('@'));}var _0xe66db8=_0x3ae387[_0x8ecf('0xc')][_0x8ecf('0xf')](/\s+/);return _0xe66db8[_0x8ecf('0x10')]>0x1?_0xe66db8[_0x8ecf('0x11')](0x0,-0x1)[_0x8ecf('0x12')]('\x20'):_0x3ae387[_0x8ecf('0xc')];}return'Anonymous';}function getLastName(_0x195da9){var _0x5da2c9=_[_0x8ecf('0x7')](_0x195da9[_0x8ecf('0x13')]);if(_0x5da2c9&&_0x5da2c9[_0x8ecf('0xc')]){var _0x3c4395=_0x5da2c9[_0x8ecf('0xc')]['split'](/\s+/);return _0x3c4395['length']>0x1?_0x3c4395['pop']():'';}return'';}function getMails(_0x1c18dd,_0x351790){var _0x233127='';for(var _0x1da055=0x0;_0x1da055<_0x351790[_0x8ecf('0x13')][_0x8ecf('0x10')];_0x1da055+=0x1){if(_0x351790['value'][_0x1da055][_0x8ecf('0x8')]!==_0x1c18dd){if(!_[_0x8ecf('0x14')](_0x233127)){_0x233127+=',';}_0x233127+=_0x351790['value'][_0x1da055][_0x8ecf('0xc')]||_0x351790[_0x8ecf('0x13')][_0x1da055][_0x8ecf('0x8')]||'';_0x233127+='\x20<';_0x233127+=_0x351790[_0x8ecf('0x13')][_0x1da055][_0x8ecf('0x8')]?_0x351790['value'][_0x1da055][_0x8ecf('0x8')]:_0x8ecf('0x9')+random[_0x8ecf('0xa')](0x6)+'@xcally.com';_0x233127+='>';}}return _0x233127;}function parseEmail(_0x493b26,_0x1a816d,_0x12a657){if(_0x1a816d[_0x8ecf('0x15')]){var _0x53d1eb=/)<[^<]*)*<\/script>/gi;while(_0x53d1eb[_0x8ecf('0x16')](_0x1a816d[_0x8ecf('0x15')])){_0x1a816d[_0x8ecf('0x15')]=_0x1a816d[_0x8ecf('0x15')][_0x8ecf('0x17')](_0x53d1eb,'');}if(_0x1a816d[_0x8ecf('0x15')][_0x8ecf('0x18')]('{_0x337ce4['push'](_0x37fad7[_0x8ecf('0x1a')]);});var _0xc89fd0=/]+>/g;var _0x38d46c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x33f517=_0x1a816d[_0x8ecf('0x15')][_0x8ecf('0x17')](_0x38d46c,_0x8ecf('0x1b'));var _0x3e1d47=_0x33f517[_0x8ecf('0x17')](_0xc89fd0,_0x8ecf('0x1c'));for(let _0x35e4fd=0x0;_0x35e4fd<_0x337ce4[_0x8ecf('0x10')];_0x35e4fd++){var _0x5bd581=_0x3e1d47[_0x8ecf('0x17')](_0x8ecf('0x1c'),_0x8ecf('0x1d')+_0x337ce4[_0x35e4fd]+_0x8ecf('0x1e'));_0x3e1d47=_0x5bd581;}_0x1a816d[_0x8ecf('0x15')]=_0x3e1d47;}_0x12a657[_0x8ecf('0x1f')]=_0x1a816d[_0x8ecf('0x15')];}else{_0x12a657[_0x8ecf('0x1f')]=_0x1a816d['textAsHtml'];}if(_0x12a657[_0x8ecf('0x1f')]){_0x12a657[_0x8ecf('0x1f')]=_0x12a657['body'][_0x8ecf('0x17')](/0x0){var _0x38d5b6=[_0x8ecf('0x30'),_0x8ecf('0x31'),_0x8ecf('0x32')];for(var _0x21cccf=0x0;_0x21cccf<_0x1a816d['headerLines'][_0x8ecf('0x10')];_0x21cccf++){var _0x49a79a=_[_0x8ecf('0xe')](_0x38d5b6,_0x1a816d[_0x8ecf('0x2f')][_0x21cccf][_0x8ecf('0x33')]);if(_0x49a79a>=0x0){_0x12a657[_0x8ecf('0x34')]=!![];}}}return _0x12a657;}exports[_0x8ecf('0x35')]=function(_0x5dc6ea,_0x1dc154,_0x4a1a51){var _0x1544eb={'from':getAddress(_0x1dc154[_0x8ecf('0x36')]),'firstName':getFirstName(_0x1dc154['from']),'lastName':getLastName(_0x1dc154[_0x8ecf('0x36')]),'mapKey':_0x8ecf('0x20'),'message':{'from':getMails(_0x5dc6ea['email'],_0x1dc154[_0x8ecf('0x36')]),'to':_0x5dc6ea[_0x8ecf('0x20')],'cc':'','subject':_0x1dc154[_0x8ecf('0x37')]||'','messageId':_0x1dc154[_0x8ecf('0x38')],'inReplyTo':_0x1dc154[_0x8ecf('0x39')],'sentAt':moment(_0x1dc154[_0x8ecf('0x3a')])['format'](_0x8ecf('0x3b')),'attach':![],'attachments':[]}};if(!_0x1dc154[_0x8ecf('0x15')]&&!_0x1dc154['textAsHtml']){var _0x4ea85a=_[_0x8ecf('0x3c')](_0x1dc154[_0x8ecf('0x19')],{'contentType':_0x8ecf('0x3d')});if(_0x4ea85a['length']){logger[_0x8ecf('0x3e')](util[_0x8ecf('0x3f')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x1dc154[_0x8ecf('0x38')]));tnef['parseBuffer'](_[_0x8ecf('0x40')](_0x4ea85a)[_0x8ecf('0x2c')],function(_0x3792f4,_0x48c027){if(_0x48c027){_0x1dc154['html']=_0x48c027[_0x8ecf('0x41')]||'

Empty\x20message

';if(_0x48c027[_0x8ecf('0x42')]){for(var _0x28a9d0=0x0;_0x28a9d0<_0x48c027[_0x8ecf('0x42')][_0x8ecf('0x10')];_0x28a9d0++){var _0x343dc1=_0x48c027[_0x8ecf('0x42')][_0x28a9d0];_0x1544eb[_0x8ecf('0x21')][_0x8ecf('0x19')][_0x8ecf('0x2d')]({'filename':_0x343dc1['Title'],'content':Buffer[_0x8ecf('0x36')](_0x343dc1[_0x8ecf('0x43')])});}}}_0x4a1a51(parseEmail(_0x5dc6ea,_0x1dc154,_0x1544eb));});}else{_0x1dc154['html']=_0x8ecf('0x44');_0x4a1a51(parseEmail(_0x5dc6ea,_0x1dc154,_0x1544eb));}}else{_0x4a1a51(parseEmail(_0x5dc6ea,_0x1dc154,_0x1544eb));}};exports[_0x8ecf('0x45')]=function(_0x3b4433,_0x375a6b){var _0x3bbc5d=[_0x8ecf('0x46')+(_0x375a6b||''),_0x8ecf('0x47')+_0x3b4433,'',''];return Buffer['from'](_0x3bbc5d[_0x8ecf('0x12')](''),_0x8ecf('0x48'))[_0x8ecf('0x49')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 09f5009..db098a4 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 _0x7cd0=['name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0x7cd0,0x1c0));var _0x07cd=function(_0x52ed18,_0x722adb){_0x52ed18=_0x52ed18-0x0;var _0x5d0a9e=_0x7cd0[_0x52ed18];return _0x5d0a9e;};'use strict';var _=require('lodash');function MailAccount(_0x40a7d2){this['id']=_0x40a7d2['id']||0x0;this[_0x07cd('0x0')]=_0x40a7d2[_0x07cd('0x0')]||_0x07cd('0x1');this[_0x07cd('0x2')]=_0x40a7d2['key']||_0x07cd('0x3');this[_0x07cd('0x4')]=_0x40a7d2[_0x07cd('0x4')]||![];this['Imap']=_0x40a7d2[_0x07cd('0x5')]||[];this[_0x07cd('0x6')]=_0x40a7d2['Smtp']||[];}module[_0x07cd('0x7')]=MailAccount; \ No newline at end of file +var _0xacc8=['lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x139bb4,_0xc8cf82){var _0x52f58a=function(_0x3482e5){while(--_0x3482e5){_0x139bb4['push'](_0x139bb4['shift']());}};_0x52f58a(++_0xc8cf82);}(_0xacc8,0x1f0));var _0x8acc=function(_0x5116f5,_0x5b95d2){_0x5116f5=_0x5116f5-0x0;var _0x36da70=_0xacc8[_0x5116f5];return _0x36da70;};'use strict';var _=require(_0x8acc('0x0'));function MailAccount(_0x545368){this['id']=_0x545368['id']||0x0;this[_0x8acc('0x1')]=_0x545368['name']||_0x8acc('0x2');this[_0x8acc('0x3')]=_0x545368[_0x8acc('0x3')]||_0x8acc('0x4');this[_0x8acc('0x5')]=_0x545368[_0x8acc('0x5')]||![];this[_0x8acc('0x6')]=_0x545368[_0x8acc('0x6')]||[];this[_0x8acc('0x7')]=_0x545368[_0x8acc('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index e40938f..b5123c4 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 _0x11b6=['initMailAccounts','length','isUndefined','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x21e767,_0x219c2c){var _0x331ff3=function(_0x22565e){while(--_0x22565e){_0x21e767['push'](_0x21e767['shift']());}};_0x331ff3(++_0x219c2c);}(_0x11b6,0x19b));var _0x611b=function(_0x3daac9,_0x5ca67d){_0x3daac9=_0x3daac9-0x0;var _0x1c5e70=_0x11b6[_0x3daac9];return _0x1c5e70;};'use strict';var _=require(_0x611b('0x0'));var MailAccount=require(_0x611b('0x1'));var Realtime=function(){this[_0x611b('0x2')]={};};function freeIsNotKey(_0x4ea384,_0x5e69ca,_0x466766){var _0x4e4fef=_[_0x611b('0x3')](_0x4ea384,function(_0x5bb3ff,_0x1c23bc){return _0x5bb3ff[_0x466766];});for(var _0x4659d8 in _0x5e69ca){if(_0x5e69ca[_0x611b('0x4')](_0x4659d8)){if(!_0x4e4fef[_0x4659d8]){delete _0x5e69ca[_0x4659d8];}}}}Realtime[_0x611b('0x5')][_0x611b('0x6')]=function(_0x4e4992,_0x27468f){for(var _0x543978 in _0x27468f){if(_0x4e4992[_0x611b('0x4')](_0x543978)){_0x4e4992[_0x543978]=_0x27468f[_0x543978];}}};Realtime[_0x611b('0x5')][_0x611b('0x7')]=function(){var _0x48abd9=this;return function(_0x350c8e){if(_0x350c8e){freeIsNotKey(_0x350c8e,_0x48abd9[_0x611b('0x2')],'id');for(var _0x564e84=0x0,_0x561557={},_0x13936e={};_0x564e84<_0x350c8e[_0x611b('0x8')];_0x564e84+=0x1){_0x561557=_0x350c8e[_0x564e84];if(_[_0x611b('0x9')](_0x48abd9[_0x611b('0x2')][_0x561557['id']])){_0x48abd9[_0x611b('0x2')][_0x561557['id']]=new MailAccount(_0x561557);}else{_[_0x611b('0xa')](_0x48abd9['mailAccounts'][_0x561557['id']],_0x561557);}}}return _0x48abd9['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0x99df=['prototype','initMailAccounts','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase'];(function(_0x3591d8,_0x1278f1){var _0x66c7ea=function(_0x291f32){while(--_0x291f32){_0x3591d8['push'](_0x3591d8['shift']());}};_0x66c7ea(++_0x1278f1);}(_0x99df,0x123));var _0xf99d=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x99df[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0xf99d('0x0'));var MailAccount=require(_0xf99d('0x1'));var Realtime=function(){this[_0xf99d('0x2')]={};};function freeIsNotKey(_0x4d93a5,_0x597bf8,_0x4d56b1){var _0x2fa819=_[_0xf99d('0x3')](_0x4d93a5,function(_0x333525,_0x49a1c3){return _0x333525[_0x4d56b1];});for(var _0x3a51be in _0x597bf8){if(_0x597bf8[_0xf99d('0x4')](_0x3a51be)){if(!_0x2fa819[_0x3a51be]){delete _0x597bf8[_0x3a51be];}}}}Realtime['prototype'][_0xf99d('0x5')]=function(_0x8957fb,_0x7a9bbf){for(var _0x253426 in _0x7a9bbf){if(_0x8957fb['hasOwnProperty'](_0x253426)){_0x8957fb[_0x253426]=_0x7a9bbf[_0x253426];}}};Realtime[_0xf99d('0x6')][_0xf99d('0x7')]=function(){var _0x400308=this;return function(_0xeec6a4){if(_0xeec6a4){freeIsNotKey(_0xeec6a4,_0x400308[_0xf99d('0x2')],'id');for(var _0x1fa155=0x0,_0x48b649={},_0x530b4b={};_0x1fa155<_0xeec6a4['length'];_0x1fa155+=0x1){_0x48b649=_0xeec6a4[_0x1fa155];if(_[_0xf99d('0x8')](_0x400308[_0xf99d('0x2')][_0x48b649['id']])){_0x400308[_0xf99d('0x2')][_0x48b649['id']]=new MailAccount(_0x48b649);}else{_[_0xf99d('0x9')](_0x400308[_0xf99d('0x2')][_0x48b649['id']],_0x48b649);}}}return _0x400308[_0xf99d('0x2')];};};module[_0xf99d('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index ad65f4f..d82c463 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 _0x1a3b=['service','email','key','ListId','TemplateId','MailServerIn','Imap','type','data5','CloudProvider','MailServerOut','getMailAccount','../client','getMailAccounts','Request','name','provider'];(function(_0x59a259,_0xc9ba83){var _0x45f49a=function(_0xde51c0){while(--_0xde51c0){_0x59a259['push'](_0x59a259['shift']());}};_0x45f49a(++_0xc9ba83);}(_0x1a3b,0x83));var _0xb1a3=function(_0x3bb00f,_0x5a972a){_0x3bb00f=_0x3bb00f-0x0;var _0x1e64b0=_0x1a3b[_0x3bb00f];return _0x1e64b0;};'use strict';var client=require(_0xb1a3('0x0'));exports[_0xb1a3('0x1')]=function(){return function(){return client[_0xb1a3('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0xb1a3('0x3'),_0xb1a3('0x4'),_0xb1a3('0x5'),_0xb1a3('0x6'),'active',_0xb1a3('0x7'),_0xb1a3('0x8'),_0xb1a3('0x9')],'raw':![],'include':[{'model':_0xb1a3('0xa'),'as':_0xb1a3('0xb'),'include':[{'model':'CloudProvider','attributes':['id',_0xb1a3('0x3'),_0xb1a3('0x5'),_0xb1a3('0xc'),_0xb1a3('0xd')],'as':_0xb1a3('0xe')}]},{'model':_0xb1a3('0xf'),'as':'Smtp','include':[{'model':_0xb1a3('0xe'),'attributes':['id',_0xb1a3('0x3'),_0xb1a3('0x5'),_0xb1a3('0xc'),_0xb1a3('0xd')],'as':_0xb1a3('0xe')}]}]},'log':_0xb1a3('0x10')});};};exports['notify']=function(_0x4957df,_0x1c27fa){return client[_0xb1a3('0x2')]('NotifyMailAccount',{'account':{'id':_0x4957df},'body':_0x1c27fa,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x88ff=['Request','GetMailAccount','name','provider','email','TemplateId','MailServerIn','Imap','CloudProvider','service','Smtp','type','data5','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x88ff,0x196));var _0xf88f=function(_0x3e5472,_0x44ab60){_0x3e5472=_0x3e5472-0x0;var _0x3d4dc3=_0x88ff[_0x3e5472];return _0x3d4dc3;};'use strict';var client=require(_0xf88f('0x0'));exports[_0xf88f('0x1')]=function(){return function(){return client[_0xf88f('0x2')](_0xf88f('0x3'),{'options':{'attributes':['id',_0xf88f('0x4'),_0xf88f('0x5'),'service',_0xf88f('0x6'),'active','key','ListId',_0xf88f('0x7')],'raw':![],'include':[{'model':_0xf88f('0x8'),'as':_0xf88f('0x9'),'include':[{'model':_0xf88f('0xa'),'attributes':['id',_0xf88f('0x4'),_0xf88f('0xb'),'type','data5'],'as':_0xf88f('0xa')}]},{'model':'MailServerOut','as':_0xf88f('0xc'),'include':[{'model':_0xf88f('0xa'),'attributes':['id',_0xf88f('0x4'),'service',_0xf88f('0xd'),_0xf88f('0xe')],'as':_0xf88f('0xa')}]}]},'log':'getMailAccount'});};};exports[_0xf88f('0xf')]=function(_0x18376b,_0x12dfcc){return client[_0xf88f('0x2')](_0xf88f('0x10'),{'account':{'id':_0x18376b},'body':_0x12dfcc,'log':_0xf88f('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 14efd23..2053f4c 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 _0xb89a=['GetSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x2e786f,_0xd389d3){var _0x5f24c2=function(_0x1b2b0d){while(--_0x1b2b0d){_0x2e786f['push'](_0x2e786f['shift']());}};_0x5f24c2(++_0xd389d3);}(_0xb89a,0x15d));var _0xab89=function(_0x26e0a4,_0x41c372){_0x26e0a4=_0x26e0a4-0x0;var _0x209666=_0xb89a[_0x26e0a4];return _0x209666;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xab89('0x0')](_0xab89('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xab89('0x2')]},'log':_0xab89('0x3')});}; \ No newline at end of file +var _0xdc82=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xdc82,0xa8));var _0x2dc8=function(_0x28343e,_0x2ca79f){_0x28343e=_0x28343e-0x0;var _0x233220=_0xdc82[_0x28343e];return _0x233220;};'use strict';var client=require(_0x2dc8('0x0'));exports[_0x2dc8('0x1')]=function(){return client['Request'](_0x2dc8('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2dc8('0x3')]},'log':_0x2dc8('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index a0e05c8..36effae 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(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 797d875..32b4ecd 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 _0xeb99=['socket.io','websocket','polling','redis','defaults','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','listening','log','exports','lodash','http','express','ioredis','../../config/environment','createServer','listen','port'];(function(_0x2268ab,_0x476ca1){var _0x1c1d5d=function(_0x48b4da){while(--_0x48b4da){_0x2268ab['push'](_0x2268ab['shift']());}};_0x1c1d5d(++_0x476ca1);}(_0xeb99,0x1ad));var _0x9eb9=function(_0x191c44,_0x20a896){_0x191c44=_0x191c44-0x0;var _0x1086cd=_0xeb99[_0x191c44];return _0x1086cd;};'use strict';var _=require(_0x9eb9('0x0'));var http=require(_0x9eb9('0x1'));var express=require(_0x9eb9('0x2'));var sticky=require('sticky-session');var Redis=require(_0x9eb9('0x3'));var config=require(_0x9eb9('0x4'));var app=express();var server=http[_0x9eb9('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0x9eb9('0x6')](server,config[_0x9eb9('0x7')])){var socketio=require(_0x9eb9('0x8'))(server,{'transports':[_0x9eb9('0x9'),_0x9eb9('0xa')]});config[_0x9eb9('0xb')]=_[_0x9eb9('0xc')](config[_0x9eb9('0xb')],{'host':_0x9eb9('0xd'),'port':0x18eb});socketio['adapter'](require(_0x9eb9('0xe'))({'pubClient':new Redis(config[_0x9eb9('0xb')]),'subClient':new Redis(config[_0x9eb9('0xb')])}));require(_0x9eb9('0xf'))[_0x9eb9('0x10')]();require(_0x9eb9('0x11'))[_0x9eb9('0x10')](socketio);require('../../config/express')['default'](app);require(_0x9eb9('0x12'))['default'](app);}else{server[_0x9eb9('0x13')](_0x9eb9('0x14'),function(){console[_0x9eb9('0x15')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x9eb9('0x7')]);});}exports=module[_0x9eb9('0x16')]=app; \ No newline at end of file +var _0x6aed=['express','ioredis','createServer','timeout','port','socket.io','websocket','polling','redis','defaults','localhost','../../config/triggers','default','../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports'];(function(_0x25b477,_0x46e6b7){var _0x4269e2=function(_0x5e9071){while(--_0x5e9071){_0x25b477['push'](_0x25b477['shift']());}};_0x4269e2(++_0x46e6b7);}(_0x6aed,0x1f4));var _0xd6ae=function(_0x4bf27e,_0x1d3c4e){_0x4bf27e=_0x4bf27e-0x0;var _0x2b1063=_0x6aed[_0x4bf27e];return _0x2b1063;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0xd6ae('0x0'));var sticky=require('sticky-session');var Redis=require(_0xd6ae('0x1'));var config=require('../../config/environment');var app=express();var server=http[_0xd6ae('0x2')](app);server[_0xd6ae('0x3')]=0xdbba0;if(sticky['listen'](server,config[_0xd6ae('0x4')])){var socketio=require(_0xd6ae('0x5'))(server,{'transports':[_0xd6ae('0x6'),_0xd6ae('0x7')]});config[_0xd6ae('0x8')]=_[_0xd6ae('0x9')](config[_0xd6ae('0x8')],{'host':_0xd6ae('0xa'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xd6ae('0x8')])}));require(_0xd6ae('0xb'))[_0xd6ae('0xc')]();require(_0xd6ae('0xd'))['default'](socketio);require(_0xd6ae('0xe'))['default'](app);require('../../routes')[_0xd6ae('0xc')](app);}else{server[_0xd6ae('0xf')](_0xd6ae('0x10'),function(){console[_0xd6ae('0x11')](_0xd6ae('0x12'),config[_0xd6ae('0x4')]);});}exports=module[_0xd6ae('0x13')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index db62134..9ab97e8 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 _0x3e4d=['message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then','debug','error','rpc'];(function(_0x386ece,_0x527b4a){var _0x1596a3=function(_0x23f3c2){while(--_0x23f3c2){_0x386ece['push'](_0x386ece['shift']());}};_0x1596a3(++_0x527b4a);}(_0x3e4d,0xa9));var _0xd3e4=function(_0x4d2102,_0x457120){_0x4d2102=_0x4d2102-0x0;var _0x484f15=_0x3e4d[_0x4d2102];return _0x484f15;};'use strict';var jayson=require(_0xd3e4('0x0'));var BPromise=require(_0xd3e4('0x1'));var logger=require(_0xd3e4('0x2'))(_0xd3e4('0x3'));var client=jayson[_0xd3e4('0x4')][_0xd3e4('0x5')]({'port':0x2329});client[_0xd3e4('0x6')]=function(_0x15fcc2,_0x1a42b4){return new BPromise(function(_0x461f4b,_0x352e07){return client['request'](_0x15fcc2,_0x1a42b4)[_0xd3e4('0x7')](function(_0x5386b7){logger[_0xd3e4('0x8')]('rpc',_0xd3e4('0x3'),_0x15fcc2,_0x1a42b4,_0x5386b7);if(_0x5386b7[_0xd3e4('0x9')]){logger[_0xd3e4('0x9')](_0xd3e4('0xa'),_0xd3e4('0x3'),_0x15fcc2,_0x5386b7[_0xd3e4('0x9')][_0xd3e4('0xb')],_0x1a42b4);return _0x352e07(_0x5386b7[_0xd3e4('0x9')]['message']);}else{return _0x461f4b(_0x5386b7[_0xd3e4('0xc')]);}})[_0xd3e4('0xd')](function(_0x3814f0){logger[_0xd3e4('0x9')](_0xd3e4('0xa'),_0xd3e4('0x3'),_0x15fcc2,_0x3814f0,_0x1a42b4);return _0x352e07(_0x3814f0);});});};module[_0xd3e4('0xe')]=client; \ No newline at end of file +var _0xfbdb=['message','result','catch','bluebird','../../config/logger','routing','client','http','Request','request','then','rpc','error'];(function(_0x5622b2,_0x5dc268){var _0x2c441b=function(_0x3a3f73){while(--_0x3a3f73){_0x5622b2['push'](_0x5622b2['shift']());}};_0x2c441b(++_0x5dc268);}(_0xfbdb,0x121));var _0xbfbd=function(_0x4dc12e,_0x203a26){_0x4dc12e=_0x4dc12e-0x0;var _0x542ac7=_0xfbdb[_0x4dc12e];return _0x542ac7;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xbfbd('0x0'));var logger=require(_0xbfbd('0x1'))(_0xbfbd('0x2'));var client=jayson[_0xbfbd('0x3')][_0xbfbd('0x4')]({'port':0x2329});client[_0xbfbd('0x5')]=function(_0x59d022,_0x56b9a0){return new BPromise(function(_0xfa2236,_0x3fe98a){return client[_0xbfbd('0x6')](_0x59d022,_0x56b9a0)[_0xbfbd('0x7')](function(_0x55e0ac){logger['debug'](_0xbfbd('0x8'),_0xbfbd('0x2'),_0x59d022,_0x56b9a0,_0x55e0ac);if(_0x55e0ac[_0xbfbd('0x9')]){logger['error'](_0xbfbd('0x8'),'routing',_0x59d022,_0x55e0ac[_0xbfbd('0x9')]['message'],_0x56b9a0);return _0x3fe98a(_0x55e0ac[_0xbfbd('0x9')][_0xbfbd('0xa')]);}else{return _0xfa2236(_0x55e0ac[_0xbfbd('0xb')]);}})[_0xbfbd('0xc')](function(_0x4a311d){logger[_0xbfbd('0x9')]('rpc','routing',_0x59d022,_0x4a311d,_0x56b9a0);return _0x3fe98a(_0x4a311d);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 793f5ca..799abf6 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 _0x92ae=['initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues'];(function(_0x371c48,_0x2b7352){var _0x467b68=function(_0x28e207){while(--_0x28e207){_0x371c48['push'](_0x371c48['shift']());}};_0x467b68(++_0x2b7352);}(_0x92ae,0xf4));var _0xe92a=function(_0x87db3a,_0x384ea4){_0x87db3a=_0x87db3a-0x0;var _0x249b85=_0x92ae[_0x87db3a];return _0x249b85;};'use strict';var BPromise=require(_0xe92a('0x0'));var server=require(_0xe92a('0x1'));var Realtime=require(_0xe92a('0x2'));var user=require(_0xe92a('0x3'));var interval=require(_0xe92a('0x4'));var openchannelQueue=require(_0xe92a('0x5'));var chatQueue=require(_0xe92a('0x6'));var smsQueue=require(_0xe92a('0x7'));var mailQueue=require(_0xe92a('0x8'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xe92a('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xe92a('0xa')]()[_0xe92a('0xb')](user[_0xe92a('0xc')]())[_0xe92a('0xb')](realtime['initAgents']())['then'](interval[_0xe92a('0xd')]())['then'](realtime[_0xe92a('0xe')]())[_0xe92a('0xb')](openchannelQueue[_0xe92a('0xf')]())[_0xe92a('0xb')](realtime[_0xe92a('0x10')]())[_0xe92a('0xb')](chatQueue[_0xe92a('0x11')]())[_0xe92a('0xb')](realtime[_0xe92a('0x12')]())[_0xe92a('0xb')](smsQueue[_0xe92a('0x13')]())[_0xe92a('0xb')](realtime[_0xe92a('0x14')]())[_0xe92a('0xb')](mailQueue['getMailQueues']())['then'](realtime[_0xe92a('0x15')]())[_0xe92a('0xb')](faxQueue[_0xe92a('0x16')]())['then'](realtime['initFaxQueues']())['then'](whatsappQueue[_0xe92a('0x17')]())['then'](realtime[_0xe92a('0x18')]())['then'](function(){return realtime;});}function main(){return server[_0xe92a('0x19')](realtime)[_0xe92a('0xb')](function(_0x128088){return initRealtime();})[_0xe92a('0xb')](function(_0x494a19){return setInterval(initRealtime,0x1388);})['catch'](function(_0x7d8769){console['log'](_0x7d8769);});}main(); \ No newline at end of file +var _0x7772=['catch','log','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen'];(function(_0xbb3fc9,_0x3f80fd){var _0xe3f2fb=function(_0x4852ec){while(--_0x4852ec){_0xbb3fc9['push'](_0xbb3fc9['shift']());}};_0xe3f2fb(++_0x3f80fd);}(_0x7772,0x84));var _0x2777=function(_0x44219c,_0x53701f){_0x44219c=_0x44219c-0x0;var _0x4af7bf=_0x7772[_0x44219c];return _0x4af7bf;};'use strict';var BPromise=require('bluebird');var server=require(_0x2777('0x0'));var Realtime=require('./realtime');var user=require(_0x2777('0x1'));var interval=require(_0x2777('0x2'));var openchannelQueue=require(_0x2777('0x3'));var chatQueue=require(_0x2777('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x2777('0x5'));var faxQueue=require(_0x2777('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x2777('0x7')]()[_0x2777('0x8')](user['getAgents']())[_0x2777('0x8')](realtime[_0x2777('0x9')]())[_0x2777('0x8')](interval[_0x2777('0xa')]())[_0x2777('0x8')](realtime[_0x2777('0xb')]())[_0x2777('0x8')](openchannelQueue[_0x2777('0xc')]())[_0x2777('0x8')](realtime[_0x2777('0xd')]())[_0x2777('0x8')](chatQueue[_0x2777('0xe')]())[_0x2777('0x8')](realtime[_0x2777('0xf')]())['then'](smsQueue[_0x2777('0x10')]())['then'](realtime[_0x2777('0x11')]())['then'](mailQueue[_0x2777('0x12')]())[_0x2777('0x8')](realtime['initMailQueues']())[_0x2777('0x8')](faxQueue[_0x2777('0x13')]())[_0x2777('0x8')](realtime[_0x2777('0x14')]())[_0x2777('0x8')](whatsappQueue[_0x2777('0x15')]())[_0x2777('0x8')](realtime[_0x2777('0x16')]())[_0x2777('0x8')](function(){return realtime;});}function main(){return server[_0x2777('0x17')](realtime)[_0x2777('0x8')](function(_0xee77d7){return initRealtime();})['then'](function(_0x43b3c3){return setInterval(initRealtime,0x1388);})[_0x2777('0x18')](function(_0x333885){console[_0x2777('0x19')](_0x333885);});}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 dfd42a1..23e03a2 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0xb55691,_0x316ec3){var _0x1daee5=function(_0x4c7195){while(--_0x4c7195){_0xb55691['push'](_0xb55691['shift']());}};_0x1daee5(++_0x316ec3);}(_0x7a54,0x106));var _0x47a5=function(_0x214282,_0x4b72b1){_0x214282=_0x214282-0x0;var _0x2cf536=_0x7a54[_0x214282];return _0x2cf536;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x4927b4,_0x5ed901){var _0x2b357c=function(_0x369d6e){while(--_0x369d6e){_0x4927b4['push'](_0x4927b4['shift']());}};_0x2b357c(++_0x5ed901);}(_0x7a54,0x106));var _0x47a5=function(_0x1f06f5,_0x55653f){_0x1f06f5=_0x1f06f5-0x0;var _0x2001c3=_0x7a54[_0x1f06f5];return _0x2001c3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 99ceee6..4ded4f7 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 _0x81e6=['SendMail','bluebird','jayson/promise','http','then','error','message','result','catch'];(function(_0x5c6138,_0x19e75d){var _0xd6ec55=function(_0x2ec75c){while(--_0x2ec75c){_0x5c6138['push'](_0x5c6138['shift']());}};_0xd6ec55(++_0x19e75d);}(_0x81e6,0xb5));var _0x681e=function(_0x42de3c,_0x182158){_0x42de3c=_0x42de3c-0x0;var _0x1caf35=_0x81e6[_0x42de3c];return _0x1caf35;};'use strict';var BPromise=require(_0x681e('0x0'));var jayson=require(_0x681e('0x1'));var client=jayson['client'][_0x681e('0x2')]({'port':0x232b});function request(_0x16a1e4,_0x220dff){return new BPromise(function(_0x3f10c0,_0x2a21dc){return client['request'](_0x16a1e4,_0x220dff)[_0x681e('0x3')](function(_0x272945){if(_0x272945[_0x681e('0x4')]){return _0x2a21dc(_0x272945[_0x681e('0x4')][_0x681e('0x5')]);}else{return _0x3f10c0(_0x272945[_0x681e('0x6')]);}})[_0x681e('0x7')](function(_0x596ca4){return _0x2a21dc(_0x596ca4);});});}exports['sendMailMessage']=function(_0x3aa829,_0x1ed9b3){return request(_0x681e('0x8'),{'account':_0x3aa829,'message':_0x1ed9b3});}; \ No newline at end of file +var _0x8f3e=['error','result','catch','sendMailMessage','SendMail','bluebird','http','request'];(function(_0x10bb32,_0x3970a2){var _0x2fd0eb=function(_0x190669){while(--_0x190669){_0x10bb32['push'](_0x10bb32['shift']());}};_0x2fd0eb(++_0x3970a2);}(_0x8f3e,0x175));var _0xe8f3=function(_0x366c50,_0x3a0fcd){_0x366c50=_0x366c50-0x0;var _0x813525=_0x8f3e[_0x366c50];return _0x813525;};'use strict';var BPromise=require(_0xe8f3('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8f3('0x1')]({'port':0x232b});function request(_0x522e80,_0x2a6bab){return new BPromise(function(_0x39dc94,_0x29922f){return client[_0xe8f3('0x2')](_0x522e80,_0x2a6bab)['then'](function(_0x4fc42b){if(_0x4fc42b[_0xe8f3('0x3')]){return _0x29922f(_0x4fc42b['error']['message']);}else{return _0x39dc94(_0x4fc42b[_0xe8f3('0x4')]);}})[_0xe8f3('0x5')](function(_0x2d0db7){return _0x29922f(_0x2d0db7);});});}exports[_0xe8f3('0x6')]=function(_0x531c0e,_0x356931){return request(_0xe8f3('0x7'),{'account':_0x531c0e,'message':_0x356931});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index db18836..9db2389 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 _0x426e=['working','idle','mail','chat','openchannel','length','StatusTime','toNumber','format','Status','faxStatusTime','smsStatus','smsCurrentCapacity','smsWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity'];(function(_0x387adb,_0xbfdcf8){var _0x53fbc0=function(_0x288400){while(--_0x288400){_0x387adb['push'](_0x387adb['shift']());}};_0x53fbc0(++_0xbfdcf8);}(_0x426e,0x1ab));var _0xe426=function(_0x594de8,_0x46d0d2){_0x594de8=_0x594de8-0x0;var _0x5fcbf=_0x426e[_0x594de8];return _0x5fcbf;};'use strict';var _=require(_0xe426('0x0'));var md5=require(_0xe426('0x1'));var moment=require(_0xe426('0x2'));var Redis=require(_0xe426('0x3'));var config=require(_0xe426('0x4'));config[_0xe426('0x5')]=_[_0xe426('0x6')](config[_0xe426('0x5')],{'host':_0xe426('0x7'),'port':0x18eb});var io=require(_0xe426('0x8'))(new Redis(config['redis']));function Agent(_0x4836f9){this['id']=_0x4836f9['id']||0x0;this[_0xe426('0x9')]=_0x4836f9[_0xe426('0x9')]||'';this[_0xe426('0xa')]=_0x4836f9[_0xe426('0xa')]||![];this[_0xe426('0xb')]=_0x4836f9['chatPause']||![];this[_0xe426('0xc')]=_0x4836f9['mailPause']||![];this['faxPause']=_0x4836f9[_0xe426('0xd')]||![];this['smsPause']=_0x4836f9[_0xe426('0xe')]||![];this[_0xe426('0xf')]=_0x4836f9[_0xe426('0xf')]||![];this[_0xe426('0x10')]=_0xe426('0x11');this[_0xe426('0x12')]=0x0;this[_0xe426('0x13')]=_0x4836f9[_0xe426('0x13')]||0x0;this[_0xe426('0x14')]=0x0;this['mailStatus']=_0xe426('0x11');this[_0xe426('0x15')]=0x0;this['mailCapacity']=_0x4836f9[_0xe426('0x16')]||0x0;this[_0xe426('0x17')]=0x0;this[_0xe426('0x18')]=_0xe426('0x11');this['faxStatusTime']=0x0;this[_0xe426('0x19')]=_0x4836f9['faxCapacity']||0x0;this[_0xe426('0x1a')]=0x0;this['smsStatus']=_0xe426('0x11');this[_0xe426('0x1b')]=0x0;this['smsCapacity']=_0x4836f9[_0xe426('0x1c')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']='unknown';this[_0xe426('0x1d')]=0x0;this[_0xe426('0x1e')]=_0x4836f9[_0xe426('0x1e')]||0x0;this[_0xe426('0x1f')]=0x0;this[_0xe426('0x20')]=_0xe426('0x11');this[_0xe426('0x21')]=0x0;this[_0xe426('0x22')]=_0x4836f9[_0xe426('0x22')]||0x0;this[_0xe426('0x23')]=0x0;this[_0xe426('0x24')]=![];this[_0xe426('0x25')]=undefined;this['md5']='';this[_0xe426('0x26')]={};this[_0xe426('0x27')]={};this[_0xe426('0x28')]={};this[_0xe426('0x29')]={};this['smsWaitingInteractions']={};this[_0xe426('0x2a')]={};this[_0xe426('0x2b')]();}Agent[_0xe426('0x2c')][_0xe426('0x2d')]=function(_0x200ff9){if(this[_0x200ff9+_0xe426('0x2e')]>0x0){if(this[_0x200ff9+_0xe426('0x2f')]>0x0&&this[_0x200ff9+'CurrentCapacity']>=this[_0x200ff9+_0xe426('0x2f')]){return _0xe426('0x30');}else{return _0xe426('0x31');}}else{return _0xe426('0x32');}};Agent[_0xe426('0x2c')][_0xe426('0x2b')]=function(){var _0x1eae01=[_0xe426('0x33'),_0xe426('0x34'),_0xe426('0x35'),'fax','sms','whatsapp'];for(var _0x384406=0x0;_0x384406<_0x1eae01[_0xe426('0x36')];_0x384406+=0x1){var _0x5505df=this[_0xe426('0x2d')](_0x1eae01[_0x384406]);if(this[_0x1eae01[_0x384406]+'Status']!==_0x5505df){this[_0x1eae01[_0x384406]+_0xe426('0x37')]=_[_0xe426('0x38')](moment()[_0xe426('0x39')]('x'));}this[_0x1eae01[_0x384406]+_0xe426('0x3a')]=_0x5505df;}var _0x42e4c9={'id':this['id'],'name':this[_0xe426('0x9')],'online':this['online'],'voicePause':this[_0xe426('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0xe426('0xc')],'smsPause':this[_0xe426('0xe')],'faxPause':this['faxPause'],'openchannelPause':this[_0xe426('0xf')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xe426('0x13')],'chatCurrentCapacity':this[_0xe426('0x14')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xe426('0x16')],'mailCurrentCapacity':this[_0xe426('0x17')],'faxStatus':this[_0xe426('0x18')],'faxStatusTime':this[_0xe426('0x3b')],'faxCapacity':this[_0xe426('0x19')],'faxCurrentCapacity':this[_0xe426('0x1a')],'smsStatus':this[_0xe426('0x3c')],'smsStatusTime':this[_0xe426('0x1b')],'smsCapacity':this[_0xe426('0x1c')],'smsCurrentCapacity':this[_0xe426('0x3d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xe426('0x1d')],'whatsappCapacity':this[_0xe426('0x1e')],'whatsappCurrentCapacity':this[_0xe426('0x1f')],'openchannelStatus':this[_0xe426('0x20')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xe426('0x22')],'openchannelCurrentCapacity':this[_0xe426('0x23')],'busy':this[_0xe426('0x24')],'busyQueue':this[_0xe426('0x25')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xe426('0x27')],'mailWaitingInteractions':this[_0xe426('0x28')],'openchannelWaitingInteractions':this[_0xe426('0x29')],'smsWaitingInteractions':this[_0xe426('0x3e')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x1f9ac9=md5(JSON[_0xe426('0x3f')](_0x42e4c9));if(this[_0xe426('0x1')]!==_0x1f9ac9){this['md5']=_0x1f9ac9;io[_0xe426('0x40')](_0xe426('0x41'),_[_0xe426('0x42')](_0x42e4c9,['online']));}};module[_0xe426('0x43')]=Agent; \ No newline at end of file +var _0x5797=['openchannel','whatsapp','length','StatusTime','toNumber','format','Status','online','mailStatusTime','smsStatusTime','whatsappStatusTime','openchannelStatus','mailWaitingInteractions','openchannelWaitingInteractions','stringify','emit','omit','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','chatWaitingInteractions','faxWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','chat'];(function(_0x564cbd,_0x59c032){var _0x4bb524=function(_0x4a42f9){while(--_0x4a42f9){_0x564cbd['push'](_0x564cbd['shift']());}};_0x4bb524(++_0x59c032);}(_0x5797,0x11a));var _0x7579=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x5797[_0x4b73a2];return _0x383c66;};'use strict';var _=require(_0x7579('0x0'));var md5=require('md5');var moment=require(_0x7579('0x1'));var Redis=require(_0x7579('0x2'));var config=require(_0x7579('0x3'));config[_0x7579('0x4')]=_[_0x7579('0x5')](config[_0x7579('0x4')],{'host':_0x7579('0x6'),'port':0x18eb});var io=require(_0x7579('0x7'))(new Redis(config[_0x7579('0x4')]));function Agent(_0x552e0d){this['id']=_0x552e0d['id']||0x0;this[_0x7579('0x8')]=_0x552e0d[_0x7579('0x8')]||'';this[_0x7579('0x9')]=_0x552e0d['voicePause']||![];this[_0x7579('0xa')]=_0x552e0d['chatPause']||![];this[_0x7579('0xb')]=_0x552e0d['mailPause']||![];this[_0x7579('0xc')]=_0x552e0d[_0x7579('0xc')]||![];this[_0x7579('0xd')]=_0x552e0d[_0x7579('0xd')]||![];this[_0x7579('0xe')]=_0x552e0d[_0x7579('0xe')]||![];this[_0x7579('0xf')]=_0x7579('0x10');this['chatStatusTime']=0x0;this[_0x7579('0x11')]=_0x552e0d[_0x7579('0x11')]||0x0;this[_0x7579('0x12')]=0x0;this[_0x7579('0x13')]=_0x7579('0x10');this['mailStatusTime']=0x0;this[_0x7579('0x14')]=_0x552e0d[_0x7579('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']='unknown';this[_0x7579('0x15')]=0x0;this['faxCapacity']=_0x552e0d[_0x7579('0x16')]||0x0;this[_0x7579('0x17')]=0x0;this[_0x7579('0x18')]='unknown';this['smsStatusTime']=0x0;this[_0x7579('0x19')]=_0x552e0d['smsCapacity']||0x0;this[_0x7579('0x1a')]=0x0;this[_0x7579('0x1b')]=_0x7579('0x10');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x552e0d[_0x7579('0x1c')]||0x0;this[_0x7579('0x1d')]=0x0;this['openchannelStatus']=_0x7579('0x10');this[_0x7579('0x1e')]=0x0;this[_0x7579('0x1f')]=_0x552e0d[_0x7579('0x1f')]||0x0;this[_0x7579('0x20')]=0x0;this[_0x7579('0x21')]=![];this[_0x7579('0x22')]=undefined;this[_0x7579('0x23')]='';this[_0x7579('0x24')]={};this[_0x7579('0x25')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0x7579('0x26')]={};this[_0x7579('0x27')]={};this[_0x7579('0x28')]();}Agent['prototype'][_0x7579('0x29')]=function(_0x5182a2){if(this[_0x5182a2+_0x7579('0x2a')]>0x0){if(this[_0x5182a2+'Capacity']>0x0&&this[_0x5182a2+_0x7579('0x2a')]>=this[_0x5182a2+_0x7579('0x2b')]){return _0x7579('0x2c');}else{return _0x7579('0x2d');}}else{return _0x7579('0x2e');}};Agent['prototype'][_0x7579('0x28')]=function(){var _0x1f242e=['mail',_0x7579('0x2f'),_0x7579('0x30'),'fax','sms',_0x7579('0x31')];for(var _0x23d5d4=0x0;_0x23d5d4<_0x1f242e[_0x7579('0x32')];_0x23d5d4+=0x1){var _0x423189=this[_0x7579('0x29')](_0x1f242e[_0x23d5d4]);if(this[_0x1f242e[_0x23d5d4]+'Status']!==_0x423189){this[_0x1f242e[_0x23d5d4]+_0x7579('0x33')]=_[_0x7579('0x34')](moment()[_0x7579('0x35')]('x'));}this[_0x1f242e[_0x23d5d4]+_0x7579('0x36')]=_0x423189;}var _0x386de8={'id':this['id'],'name':this['name'],'online':this[_0x7579('0x37')],'voicePause':this[_0x7579('0x9')],'chatPause':this[_0x7579('0xa')],'mailPause':this[_0x7579('0xb')],'smsPause':this[_0x7579('0xd')],'faxPause':this[_0x7579('0xc')],'openchannelPause':this[_0x7579('0xe')],'chatStatus':this[_0x7579('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x7579('0x11')],'chatCurrentCapacity':this[_0x7579('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x7579('0x38')],'mailCapacity':this[_0x7579('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x7579('0x15')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x7579('0x17')],'smsStatus':this[_0x7579('0x18')],'smsStatusTime':this[_0x7579('0x39')],'smsCapacity':this[_0x7579('0x19')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x7579('0x1b')],'whatsappStatusTime':this[_0x7579('0x3a')],'whatsappCapacity':this[_0x7579('0x1c')],'whatsappCurrentCapacity':this[_0x7579('0x1d')],'openchannelStatus':this[_0x7579('0x3b')],'openchannelStatusTime':this[_0x7579('0x1e')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x7579('0x20')],'busy':this[_0x7579('0x21')],'busyQueue':this[_0x7579('0x22')],'chatWaitingInteractions':this[_0x7579('0x24')],'faxWaitingInteractions':this[_0x7579('0x25')],'mailWaitingInteractions':this[_0x7579('0x3c')],'openchannelWaitingInteractions':this[_0x7579('0x3d')],'smsWaitingInteractions':this[_0x7579('0x26')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x157011=md5(JSON[_0x7579('0x3e')](_0x386de8));if(this[_0x7579('0x23')]!==_0x157011){this[_0x7579('0x23')]=_0x157011;io[_0x7579('0x3f')]('user:routing:update',_[_0x7579('0x40')](_0x386de8,[_0x7579('0x37')]));}};module[_0x7579('0x41')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 79f1a5d..01389a9 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 _0xb283=['strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x4a30f1,_0x2e75a8){var _0x1e0a09=function(_0xfc5f54){while(--_0xfc5f54){_0x4a30f1['push'](_0x4a30f1['shift']());}};_0x1e0a09(++_0x2e75a8);}(_0xb283,0x12d));var _0x3b28=function(_0x51690f,_0x21c9f1){_0x51690f=_0x51690f-0x0;var _0x4f65ea=_0xb283[_0x51690f];return _0x4f65ea;};'use strict';var _=require(_0x3b28('0x0'));var md5=require('md5');var util=require(_0x3b28('0x1'));var Redis=require('ioredis');var config=require(_0x3b28('0x2'));config[_0x3b28('0x3')]=_[_0x3b28('0x4')](config[_0x3b28('0x3')],{'host':_0x3b28('0x5'),'port':0x18eb});var io=require(_0x3b28('0x6'))(new Redis(config[_0x3b28('0x3')]));function ChatQueue(_0x33dd89){this['id']=_0x33dd89['id']||0x0;this[_0x3b28('0x7')]=_0x33dd89[_0x3b28('0x7')]||'';this[_0x3b28('0x8')]=_0x33dd89[_0x3b28('0x8')]||0xa;this[_0x3b28('0x9')]=_0x33dd89[_0x3b28('0x9')]||_0x3b28('0xa');this['Agents']=_0x33dd89[_0x3b28('0xb')];this[_0x3b28('0xc')]={};this[_0x3b28('0xd')]=0x0;this[_0x3b28('0xe')]='';this[_0x3b28('0xf')]();this[_0x3b28('0x10')]();}ChatQueue[_0x3b28('0x11')][_0x3b28('0xf')]=function(){var _0x31b069=this[_0x3b28('0xc')]['_rr'];this[_0x3b28('0xc')]=_[_0x3b28('0x12')](this[_0x3b28('0xb')],'id');this['mapAgentsId'][_0x3b28('0x13')]=_0x31b069;};ChatQueue[_0x3b28('0x11')][_0x3b28('0x10')]=function(){this[_0x3b28('0x14')]=0x0;this[_0x3b28('0x15')]=0x0;for(var _0x3216c8=0x0;_0x3216c8=0x0?this[_0x3b28('0x18')]:0x0;var _0x271081={'id':this['id'],'available':this[_0x3b28('0x18')],'loggedIn':this[_0x3b28('0x14')],'name':this[_0x3b28('0x7')],'paused':this[_0x3b28('0x15')],'waiting':this[_0x3b28('0xd')]};var _0x111d4b=md5(JSON[_0x3b28('0x19')](_0x271081));if(this['md5']!==_0x111d4b){this[_0x3b28('0xe')]=_0x111d4b;io['to'](util[_0x3b28('0x1a')](_0x3b28('0x1b'),_0x271081[_0x3b28('0x7')]))[_0x3b28('0x1c')](_0x3b28('0x1d'),_0x271081);}};module[_0x3b28('0x1e')]=ChatQueue; \ No newline at end of file +var _0x5c7b=['exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','chatPause','available','waiting','chat:queue:%s','emit','chat_queue:save'];(function(_0x5380f1,_0x1b54af){var _0x1b5d74=function(_0x29442a){while(--_0x29442a){_0x5380f1['push'](_0x5380f1['shift']());}};_0x1b5d74(++_0x1b54af);}(_0x5c7b,0x17b));var _0xb5c7=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x5c7b[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0xb5c7('0x0'));var md5=require(_0xb5c7('0x1'));var util=require('util');var Redis=require(_0xb5c7('0x2'));var config=require(_0xb5c7('0x3'));config[_0xb5c7('0x4')]=_[_0xb5c7('0x5')](config[_0xb5c7('0x4')],{'host':_0xb5c7('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x1b3bed){this['id']=_0x1b3bed['id']||0x0;this[_0xb5c7('0x7')]=_0x1b3bed[_0xb5c7('0x7')]||'';this['timeout']=_0x1b3bed['timeout']||0xa;this[_0xb5c7('0x8')]=_0x1b3bed[_0xb5c7('0x8')]||_0xb5c7('0x9');this[_0xb5c7('0xa')]=_0x1b3bed[_0xb5c7('0xa')];this[_0xb5c7('0xb')]={};this['waiting']=0x0;this[_0xb5c7('0x1')]='';this[_0xb5c7('0xc')]();this[_0xb5c7('0xd')]();}ChatQueue[_0xb5c7('0xe')][_0xb5c7('0xc')]=function(){var _0x372259=this[_0xb5c7('0xb')][_0xb5c7('0xf')];this[_0xb5c7('0xb')]=_['map'](this[_0xb5c7('0xa')],'id');this['mapAgentsId']['_rr']=_0x372259;};ChatQueue[_0xb5c7('0xe')][_0xb5c7('0xd')]=function(){this[_0xb5c7('0x10')]=0x0;this[_0xb5c7('0x11')]=0x0;for(var _0x554898=0x0;_0x554898=0x0?this[_0xb5c7('0x15')]:0x0;var _0x366301={'id':this['id'],'available':this['available'],'loggedIn':this[_0xb5c7('0x10')],'name':this[_0xb5c7('0x7')],'paused':this[_0xb5c7('0x11')],'waiting':this[_0xb5c7('0x16')]};var _0x38d782=md5(JSON['stringify'](_0x366301));if(this[_0xb5c7('0x1')]!==_0x38d782){this[_0xb5c7('0x1')]=_0x38d782;io['to'](util['format'](_0xb5c7('0x17'),_0x366301[_0xb5c7('0x7')]))[_0xb5c7('0x18')](_0xb5c7('0x19'),_0x366301);}};module[_0xb5c7('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 067708e..a0cf45e 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 _0xa640=['Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','faxPause','paused','available','stringify','format','fax:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xa640,0x18b));var _0x0a64=function(_0x3d81fe,_0x2e89c1){_0x3d81fe=_0x3d81fe-0x0;var _0x3e5d8a=_0xa640[_0x3d81fe];return _0x3e5d8a;};'use strict';var _=require(_0x0a64('0x0'));var md5=require(_0x0a64('0x1'));var util=require(_0x0a64('0x2'));var Redis=require(_0x0a64('0x3'));var config=require(_0x0a64('0x4'));config[_0x0a64('0x5')]=_['defaults'](config[_0x0a64('0x5')],{'host':_0x0a64('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a64('0x5')]));function FaxQueue(_0x3190a3){this['id']=_0x3190a3['id']||0x0;this[_0x0a64('0x7')]=_0x3190a3['name']||'';this['timeout']=_0x3190a3[_0x0a64('0x8')]||0xa;this[_0x0a64('0x9')]=_0x3190a3['strategy']||_0x0a64('0xa');this['Agents']=_0x3190a3[_0x0a64('0xb')];this[_0x0a64('0xc')]={};this[_0x0a64('0xd')]=0x0;this[_0x0a64('0x1')]='';this['updateRouting']();this[_0x0a64('0xe')]();}FaxQueue[_0x0a64('0xf')][_0x0a64('0x10')]=function(){var _0x308169=this['mapAgentsId'][_0x0a64('0x11')];this[_0x0a64('0xc')]=_[_0x0a64('0x12')](this[_0x0a64('0xb')],'id');this[_0x0a64('0xc')][_0x0a64('0x11')]=_0x308169;};FaxQueue[_0x0a64('0xf')][_0x0a64('0xe')]=function(){this[_0x0a64('0x13')]=0x0;this['paused']=0x0;for(var _0x4a2255=0x0;_0x4a2255=0x0?this[_0x0a64('0x17')]:0x0;var _0x40caf6={'id':this['id'],'available':this[_0x0a64('0x17')],'loggedIn':this[_0x0a64('0x13')],'name':this[_0x0a64('0x7')],'paused':this[_0x0a64('0x16')],'waiting':this[_0x0a64('0xd')]};var _0x2dd039=md5(JSON[_0x0a64('0x18')](_0x40caf6));if(this[_0x0a64('0x1')]!==_0x2dd039){this[_0x0a64('0x1')]=_0x2dd039;io['to'](util[_0x0a64('0x19')](_0x0a64('0x1a'),_0x40caf6['name']))[_0x0a64('0x1b')]('fax_queue:save',_0x40caf6);}};module[_0x0a64('0x1c')]=FaxQueue; \ No newline at end of file +var _0xa6e1=['loggedIn','paused','online','faxPause','available','stringify','format','fax:queue:%s','name','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime'];(function(_0x3fcc96,_0x1c65d4){var _0x5caa7a=function(_0x39962c){while(--_0x39962c){_0x3fcc96['push'](_0x3fcc96['shift']());}};_0x5caa7a(++_0x1c65d4);}(_0xa6e1,0x15c));var _0x1a6e=function(_0x20dd5c,_0x3786dc){_0x20dd5c=_0x20dd5c-0x0;var _0x52fcf0=_0xa6e1[_0x20dd5c];return _0x52fcf0;};'use strict';var _=require(_0x1a6e('0x0'));var md5=require(_0x1a6e('0x1'));var util=require(_0x1a6e('0x2'));var Redis=require('ioredis');var config=require(_0x1a6e('0x3'));config['redis']=_['defaults'](config[_0x1a6e('0x4')],{'host':_0x1a6e('0x5'),'port':0x18eb});var io=require(_0x1a6e('0x6'))(new Redis(config['redis']));function FaxQueue(_0x4bb489){this['id']=_0x4bb489['id']||0x0;this['name']=_0x4bb489['name']||'';this['timeout']=_0x4bb489['timeout']||0xa;this[_0x1a6e('0x7')]=_0x4bb489['strategy']||_0x1a6e('0x8');this[_0x1a6e('0x9')]=_0x4bb489[_0x1a6e('0x9')];this[_0x1a6e('0xa')]={};this[_0x1a6e('0xb')]=0x0;this[_0x1a6e('0x1')]='';this[_0x1a6e('0xc')]();this['updateRealtime']();}FaxQueue[_0x1a6e('0xd')][_0x1a6e('0xc')]=function(){var _0x5e9bb8=this[_0x1a6e('0xa')]['_rr'];this['mapAgentsId']=_['map'](this[_0x1a6e('0x9')],'id');this[_0x1a6e('0xa')][_0x1a6e('0xe')]=_0x5e9bb8;};FaxQueue[_0x1a6e('0xd')][_0x1a6e('0xf')]=function(){this[_0x1a6e('0x10')]=0x0;this[_0x1a6e('0x11')]=0x0;for(var _0x30862c=0x0;_0x30862c=0x0?this[_0x1a6e('0x14')]:0x0;var _0x4141a2={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1a6e('0x10')],'name':this['name'],'paused':this[_0x1a6e('0x11')],'waiting':this['waiting']};var _0x4b0e4e=md5(JSON[_0x1a6e('0x15')](_0x4141a2));if(this[_0x1a6e('0x1')]!==_0x4b0e4e){this['md5']=_0x4b0e4e;io['to'](util[_0x1a6e('0x16')](_0x1a6e('0x17'),_0x4141a2[_0x1a6e('0x18')]))[_0x1a6e('0x19')](_0x1a6e('0x1a'),_0x4141a2);}};module[_0x1a6e('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index bf56f48..93a290e 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 _0xb58c=['exports','name','Intervals'];(function(_0x2446d6,_0x5f3bea){var _0xcf90d3=function(_0x2bd75f){while(--_0x2bd75f){_0x2446d6['push'](_0x2446d6['shift']());}};_0xcf90d3(++_0x5f3bea);}(_0xb58c,0x94));var _0xcb58=function(_0x50a7f7,_0x3e7473){_0x50a7f7=_0x50a7f7-0x0;var _0x807bc5=_0xb58c[_0x50a7f7];return _0x807bc5;};'use strict';function Interval(_0x2ebab9){this['id']=_0x2ebab9['id']||0x0;this['name']=_0x2ebab9[_0xcb58('0x0')]||'';this[_0xcb58('0x1')]=_0x2ebab9[_0xcb58('0x1')]||{};}module[_0xcb58('0x2')]=Interval; \ No newline at end of file +var _0xf584=['exports','name','Intervals'];(function(_0x1363f4,_0x37f76d){var _0x58f3b3=function(_0x1a9bf0){while(--_0x1a9bf0){_0x1363f4['push'](_0x1363f4['shift']());}};_0x58f3b3(++_0x37f76d);}(_0xf584,0x73));var _0x4f58=function(_0x2ac4dd,_0x577b2c){_0x2ac4dd=_0x2ac4dd-0x0;var _0xa79d5e=_0xf584[_0x2ac4dd];return _0xa79d5e;};'use strict';function Interval(_0x538ad2){this['id']=_0x538ad2['id']||0x0;this[_0x4f58('0x0')]=_0x538ad2[_0x4f58('0x0')]||'';this[_0x4f58('0x1')]=_0x538ad2['Intervals']||{};}module[_0x4f58('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 b82312d..5223f25 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 _0x992e=['stringify','format','mail:queue:%s','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','mailPause','available'];(function(_0x58ee6e,_0x451295){var _0xcd795b=function(_0x4c906e){while(--_0x4c906e){_0x58ee6e['push'](_0x58ee6e['shift']());}};_0xcd795b(++_0x451295);}(_0x992e,0x7e));var _0xe992=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0x992e[_0x41bdd4];return _0x5c03a6;};'use strict';var _=require('lodash');var md5=require(_0xe992('0x0'));var util=require(_0xe992('0x1'));var Redis=require(_0xe992('0x2'));var config=require(_0xe992('0x3'));config[_0xe992('0x4')]=_[_0xe992('0x5')](config[_0xe992('0x4')],{'host':_0xe992('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x5780a3){this['id']=_0x5780a3['id']||0x0;this[_0xe992('0x7')]=_0x5780a3[_0xe992('0x7')]||'';this[_0xe992('0x8')]=_0x5780a3[_0xe992('0x8')]||0xa;this[_0xe992('0x9')]=_0x5780a3[_0xe992('0x9')]||_0xe992('0xa');this['Agents']=_0x5780a3[_0xe992('0xb')];this[_0xe992('0xc')]={};this[_0xe992('0xd')]=0x0;this[_0xe992('0x0')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0xe992('0xe')]['updateRouting']=function(){var _0xa396d6=this[_0xe992('0xc')][_0xe992('0xf')];this['mapAgentsId']=_[_0xe992('0x10')](this[_0xe992('0xb')],'id');this[_0xe992('0xc')][_0xe992('0xf')]=_0xa396d6;};MailQueue[_0xe992('0xe')][_0xe992('0x11')]=function(){this[_0xe992('0x12')]=0x0;this[_0xe992('0x13')]=0x0;for(var _0x45a29c=0x0;_0x45a29c=0x0?this[_0xe992('0x17')]:0x0;var _0x5427c1={'id':this['id'],'available':this[_0xe992('0x17')],'loggedIn':this[_0xe992('0x12')],'name':this[_0xe992('0x7')],'paused':this[_0xe992('0x13')],'waiting':this[_0xe992('0xd')]};var _0x2e35ac=md5(JSON[_0xe992('0x18')](_0x5427c1));if(this[_0xe992('0x0')]!==_0x2e35ac){this[_0xe992('0x0')]=_0x2e35ac;io['to'](util[_0xe992('0x19')](_0xe992('0x1a'),_0x5427c1[_0xe992('0x7')]))[_0xe992('0x1b')](_0xe992('0x1c'),_0x5427c1);}};module[_0xe992('0x1d')]=MailQueue; \ No newline at end of file +var _0x8729=['localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','paused','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','md5','util','defaults','redis'];(function(_0xeade8,_0x51f1e7){var _0x5b62c8=function(_0x36e8c1){while(--_0x36e8c1){_0xeade8['push'](_0xeade8['shift']());}};_0x5b62c8(++_0x51f1e7);}(_0x8729,0x68));var _0x9872=function(_0x358aa7,_0x4c8c87){_0x358aa7=_0x358aa7-0x0;var _0x3fbca5=_0x8729[_0x358aa7];return _0x3fbca5;};'use strict';var _=require('lodash');var md5=require(_0x9872('0x0'));var util=require(_0x9872('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x9872('0x2')](config[_0x9872('0x3')],{'host':_0x9872('0x4'),'port':0x18eb});var io=require(_0x9872('0x5'))(new Redis(config['redis']));function MailQueue(_0x45f0ec){this['id']=_0x45f0ec['id']||0x0;this[_0x9872('0x6')]=_0x45f0ec[_0x9872('0x6')]||'';this[_0x9872('0x7')]=_0x45f0ec[_0x9872('0x7')]||0xa;this['strategy']=_0x45f0ec['strategy']||_0x9872('0x8');this['Agents']=_0x45f0ec[_0x9872('0x9')];this[_0x9872('0xa')]={};this['waiting']=0x0;this[_0x9872('0x0')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x9872('0xb')][_0x9872('0xc')]=function(){var _0x43bb52=this[_0x9872('0xa')][_0x9872('0xd')];this['mapAgentsId']=_[_0x9872('0xe')](this[_0x9872('0x9')],'id');this[_0x9872('0xa')][_0x9872('0xd')]=_0x43bb52;};MailQueue[_0x9872('0xb')][_0x9872('0xf')]=function(){this[_0x9872('0x10')]=0x0;this[_0x9872('0x11')]=0x0;for(var _0x502a15=0x0;_0x502a15=0x0?this['available']:0x0;var _0x506aeb={'id':this['id'],'available':this[_0x9872('0x14')],'loggedIn':this[_0x9872('0x10')],'name':this['name'],'paused':this[_0x9872('0x11')],'waiting':this['waiting']};var _0x100864=md5(JSON[_0x9872('0x15')](_0x506aeb));if(this[_0x9872('0x0')]!==_0x100864){this[_0x9872('0x0')]=_0x100864;io['to'](util[_0x9872('0x16')](_0x9872('0x17'),_0x506aeb[_0x9872('0x6')]))[_0x9872('0x18')](_0x9872('0x19'),_0x506aeb);}};module[_0x9872('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9886574..c4b57c9 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 _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x7a54,0x106));var _0x47a5=function(_0x145e42,_0x5760f2){_0x145e42=_0x145e42-0x0;var _0x179b10=_0x7a54[_0x145e42];return _0x179b10;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0xadb5,0xad));var _0x5adb=function(_0x4be18a,_0x266c71){_0x4be18a=_0x4be18a-0x0;var _0x3b79a7=_0xadb5[_0x4be18a];return _0x3b79a7;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 2458e37..4fb02cf 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 _0xaa88=['map','loggedIn','online','smsPause','paused','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x4bba6d,_0x42f7ab){var _0x32d568=function(_0x1f5555){while(--_0x1f5555){_0x4bba6d['push'](_0x4bba6d['shift']());}};_0x32d568(++_0x42f7ab);}(_0xaa88,0x137));var _0x8aa8=function(_0x485f53,_0x104081){_0x485f53=_0x485f53-0x0;var _0x480f1e=_0xaa88[_0x485f53];return _0x480f1e;};'use strict';var _=require(_0x8aa8('0x0'));var md5=require(_0x8aa8('0x1'));var util=require(_0x8aa8('0x2'));var Redis=require(_0x8aa8('0x3'));var config=require('../../../config/environment');config[_0x8aa8('0x4')]=_[_0x8aa8('0x5')](config[_0x8aa8('0x4')],{'host':_0x8aa8('0x6'),'port':0x18eb});var io=require(_0x8aa8('0x7'))(new Redis(config[_0x8aa8('0x4')]));function SmsQueue(_0x5e2595){this['id']=_0x5e2595['id']||0x0;this['name']=_0x5e2595[_0x8aa8('0x8')]||'';this['timeout']=_0x5e2595[_0x8aa8('0x9')]||0xa;this[_0x8aa8('0xa')]=_0x5e2595[_0x8aa8('0xa')]||_0x8aa8('0xb');this['Agents']=_0x5e2595[_0x8aa8('0xc')];this[_0x8aa8('0xd')]={};this[_0x8aa8('0xe')]=0x0;this['md5']='';this[_0x8aa8('0xf')]();this[_0x8aa8('0x10')]();}SmsQueue[_0x8aa8('0x11')][_0x8aa8('0xf')]=function(){var _0x583688=this[_0x8aa8('0xd')][_0x8aa8('0x12')];this['mapAgentsId']=_[_0x8aa8('0x13')](this[_0x8aa8('0xc')],'id');this[_0x8aa8('0xd')]['_rr']=_0x583688;};SmsQueue[_0x8aa8('0x11')][_0x8aa8('0x10')]=function(){this[_0x8aa8('0x14')]=0x0;this['paused']=0x0;for(var _0x391642=0x0;_0x391642=0x0?this[_0x8aa8('0x18')]:0x0;var _0x49d80d={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8aa8('0x14')],'name':this['name'],'paused':this[_0x8aa8('0x17')],'waiting':this[_0x8aa8('0xe')]};var _0x2a9f56=md5(JSON[_0x8aa8('0x19')](_0x49d80d));if(this['md5']!==_0x2a9f56){this[_0x8aa8('0x1')]=_0x2a9f56;io['to'](util[_0x8aa8('0x1a')](_0x8aa8('0x1b'),_0x49d80d[_0x8aa8('0x8')]))[_0x8aa8('0x1c')](_0x8aa8('0x1d'),_0x49d80d);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x3eec=['smsPause','available','waiting','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','paused','length','online','loggedIn'];(function(_0xeb54bb,_0x2d8002){var _0x4d430f=function(_0x16bdd3){while(--_0x16bdd3){_0xeb54bb['push'](_0xeb54bb['shift']());}};_0x4d430f(++_0x2d8002);}(_0x3eec,0x1e9));var _0xc3ee=function(_0xa1511a,_0x126968){_0xa1511a=_0xa1511a-0x0;var _0x52d42e=_0x3eec[_0xa1511a];return _0x52d42e;};'use strict';var _=require(_0xc3ee('0x0'));var md5=require(_0xc3ee('0x1'));var util=require(_0xc3ee('0x2'));var Redis=require(_0xc3ee('0x3'));var config=require('../../../config/environment');config[_0xc3ee('0x4')]=_[_0xc3ee('0x5')](config[_0xc3ee('0x4')],{'host':_0xc3ee('0x6'),'port':0x18eb});var io=require(_0xc3ee('0x7'))(new Redis(config[_0xc3ee('0x4')]));function SmsQueue(_0x5e6534){this['id']=_0x5e6534['id']||0x0;this[_0xc3ee('0x8')]=_0x5e6534[_0xc3ee('0x8')]||'';this[_0xc3ee('0x9')]=_0x5e6534[_0xc3ee('0x9')]||0xa;this[_0xc3ee('0xa')]=_0x5e6534[_0xc3ee('0xa')]||_0xc3ee('0xb');this[_0xc3ee('0xc')]=_0x5e6534[_0xc3ee('0xc')];this[_0xc3ee('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0xc3ee('0xe')]();this[_0xc3ee('0xf')]();}SmsQueue[_0xc3ee('0x10')][_0xc3ee('0xe')]=function(){var _0x4f27b5=this[_0xc3ee('0xd')]['_rr'];this[_0xc3ee('0xd')]=_[_0xc3ee('0x11')](this['Agents'],'id');this['mapAgentsId'][_0xc3ee('0x12')]=_0x4f27b5;};SmsQueue['prototype'][_0xc3ee('0xf')]=function(){this['loggedIn']=0x0;this[_0xc3ee('0x13')]=0x0;for(var _0x58ebe7=0x0;_0x58ebe7=0x0?this[_0xc3ee('0x18')]:0x0;var _0x304889={'id':this['id'],'available':this[_0xc3ee('0x18')],'loggedIn':this[_0xc3ee('0x16')],'name':this[_0xc3ee('0x8')],'paused':this[_0xc3ee('0x13')],'waiting':this[_0xc3ee('0x19')]};var _0x2ce864=md5(JSON[_0xc3ee('0x1a')](_0x304889));if(this[_0xc3ee('0x1')]!==_0x2ce864){this[_0xc3ee('0x1')]=_0x2ce864;io['to'](util[_0xc3ee('0x1b')](_0xc3ee('0x1c'),_0x304889[_0xc3ee('0x8')]))[_0xc3ee('0x1d')](_0xc3ee('0x1e'),_0x304889);}};module[_0xc3ee('0x1f')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b8d0143..5456e55 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 _0x5c24=['timeout','strategy','beepall','Agents','waiting','updateRouting','_rr','mapAgentsId','map','prototype','updateRealtime','loggedIn','length','whatsappPause','available','paused','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x204a6f,_0xf149a){var _0x447627=function(_0x289b47){while(--_0x289b47){_0x204a6f['push'](_0x204a6f['shift']());}};_0x447627(++_0xf149a);}(_0x5c24,0x1f4));var _0x45c2=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x5c24[_0x296754];return _0x1d9f1d;};'use strict';var _=require(_0x45c2('0x0'));var md5=require(_0x45c2('0x1'));var util=require(_0x45c2('0x2'));var Redis=require(_0x45c2('0x3'));var config=require(_0x45c2('0x4'));config[_0x45c2('0x5')]=_[_0x45c2('0x6')](config[_0x45c2('0x5')],{'host':_0x45c2('0x7'),'port':0x18eb});var io=require(_0x45c2('0x8'))(new Redis(config[_0x45c2('0x5')]));function WhatsappQueue(_0x7908c1){this['id']=_0x7908c1['id']||0x0;this[_0x45c2('0x9')]=_0x7908c1[_0x45c2('0x9')]||'';this[_0x45c2('0xa')]=_0x7908c1['timeout']||0xa;this['strategy']=_0x7908c1[_0x45c2('0xb')]||_0x45c2('0xc');this['Agents']=_0x7908c1[_0x45c2('0xd')];this['mapAgentsId']={};this[_0x45c2('0xe')]=0x0;this['md5']='';this[_0x45c2('0xf')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0x45c2('0xf')]=function(){var _0x52584f=this['mapAgentsId'][_0x45c2('0x10')];this[_0x45c2('0x11')]=_[_0x45c2('0x12')](this['Agents'],'id');this[_0x45c2('0x11')][_0x45c2('0x10')]=_0x52584f;};WhatsappQueue[_0x45c2('0x13')][_0x45c2('0x14')]=function(){this[_0x45c2('0x15')]=0x0;this['paused']=0x0;for(var _0x5e67ae=0x0;_0x5e67ae=0x0?this[_0x45c2('0x18')]:0x0;var _0x25b35c={'id':this['id'],'available':this[_0x45c2('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x45c2('0x9')],'paused':this[_0x45c2('0x19')],'waiting':this[_0x45c2('0xe')]};var _0x7d1ece=md5(JSON[_0x45c2('0x1a')](_0x25b35c));if(this['md5']!==_0x7d1ece){this[_0x45c2('0x1')]=_0x7d1ece;io['to'](util['format'](_0x45c2('0x1b'),_0x25b35c['name']))[_0x45c2('0x1c')](_0x45c2('0x1d'),_0x25b35c);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x7c0b=['waiting','updateRouting','map','prototype','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','exports','lodash','md5','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x7c0b,0x80));var _0xb7c0=function(_0x166dcb,_0x3ad667){_0x166dcb=_0x166dcb-0x0;var _0xc5b243=_0x7c0b[_0x166dcb];return _0xc5b243;};'use strict';var _=require(_0xb7c0('0x0'));var md5=require(_0xb7c0('0x1'));var util=require('util');var Redis=require(_0xb7c0('0x2'));var config=require('../../../config/environment');config[_0xb7c0('0x3')]=_['defaults'](config[_0xb7c0('0x3')],{'host':_0xb7c0('0x4'),'port':0x18eb});var io=require(_0xb7c0('0x5'))(new Redis(config[_0xb7c0('0x3')]));function WhatsappQueue(_0x116dd0){this['id']=_0x116dd0['id']||0x0;this['name']=_0x116dd0[_0xb7c0('0x6')]||'';this['timeout']=_0x116dd0[_0xb7c0('0x7')]||0xa;this['strategy']=_0x116dd0[_0xb7c0('0x8')]||_0xb7c0('0x9');this[_0xb7c0('0xa')]=_0x116dd0[_0xb7c0('0xa')];this[_0xb7c0('0xb')]={};this[_0xb7c0('0xc')]=0x0;this[_0xb7c0('0x1')]='';this[_0xb7c0('0xd')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0xb7c0('0xd')]=function(){var _0x35a09e=this[_0xb7c0('0xb')]['_rr'];this['mapAgentsId']=_[_0xb7c0('0xe')](this[_0xb7c0('0xa')],'id');this[_0xb7c0('0xb')]['_rr']=_0x35a09e;};WhatsappQueue[_0xb7c0('0xf')][_0xb7c0('0x10')]=function(){this[_0xb7c0('0x11')]=0x0;this[_0xb7c0('0x12')]=0x0;for(var _0x3fb50f=0x0;_0x3fb50f=0x0?this[_0xb7c0('0x16')]:0x0;var _0x5a68ad={'id':this['id'],'available':this[_0xb7c0('0x16')],'loggedIn':this[_0xb7c0('0x11')],'name':this[_0xb7c0('0x6')],'paused':this[_0xb7c0('0x12')],'waiting':this[_0xb7c0('0xc')]};var _0x5ce097=md5(JSON[_0xb7c0('0x17')](_0x5a68ad));if(this['md5']!==_0x5ce097){this['md5']=_0x5ce097;io['to'](util[_0xb7c0('0x18')](_0xb7c0('0x19'),_0x5a68ad['name']))[_0xb7c0('0x1a')]('whatsapp_queue:save',_0x5a68ad);}};module[_0xb7c0('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index b58d0e3..652ead3 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(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 5b7eb6f..b723f88 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 _0x2968=['Request','addTagsToChatInteraction','../client','update','UpdateChatInteraction','addTags'];(function(_0x1cc6c9,_0x1be68d){var _0x22c4e2=function(_0x55f99b){while(--_0x55f99b){_0x1cc6c9['push'](_0x1cc6c9['shift']());}};_0x22c4e2(++_0x1be68d);}(_0x2968,0x16a));var _0x8296=function(_0x4220b9,_0xc17f0c){_0x4220b9=_0x4220b9-0x0;var _0x2c1ab4=_0x2968[_0x4220b9];return _0x2c1ab4;};'use strict';var client=require(_0x8296('0x0'));exports[_0x8296('0x1')]=function(_0x4ac368,_0x3f0be1){return client['Request'](_0x8296('0x2'),{'body':_0x3f0be1,'options':{'where':{'id':_0x4ac368}},'log':'updateChatInteraction'});};exports[_0x8296('0x3')]=function(_0x26695a,_0x5e7597){return client[_0x8296('0x4')]('AddTagsToChatInteraction',{'body':_0x5e7597,'options':{'where':{'id':_0x26695a}},'log':_0x8296('0x5')});}; \ No newline at end of file +var _0x04eb=['addTags','AddTagsToChatInteraction','../client','update','Request','updateChatInteraction'];(function(_0x424c0f,_0x31a27d){var _0x265bf4=function(_0x419f69){while(--_0x419f69){_0x424c0f['push'](_0x424c0f['shift']());}};_0x265bf4(++_0x31a27d);}(_0x04eb,0xe6));var _0xb04e=function(_0x480bdc,_0x4d7be3){_0x480bdc=_0x480bdc-0x0;var _0x3de225=_0x04eb[_0x480bdc];return _0x3de225;};'use strict';var client=require(_0xb04e('0x0'));exports[_0xb04e('0x1')]=function(_0x55fcdf,_0x6b9dcc){return client[_0xb04e('0x2')]('UpdateChatInteraction',{'body':_0x6b9dcc,'options':{'where':{'id':_0x55fcdf}},'log':_0xb04e('0x3')});};exports[_0xb04e('0x4')]=function(_0xc67e7a,_0x1384e2){return client[_0xb04e('0x2')](_0xb04e('0x5'),{'body':_0x1384e2,'options':{'where':{'id':_0xc67e7a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index b4320ab..0b9f6ed 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 _0x1b49=['../client','create','Request','createChatMessage'];(function(_0x2b4e30,_0x14abc8){var _0x568fae=function(_0x386301){while(--_0x386301){_0x2b4e30['push'](_0x2b4e30['shift']());}};_0x568fae(++_0x14abc8);}(_0x1b49,0x120));var _0x91b4=function(_0x14e001,_0x569bf){_0x14e001=_0x14e001-0x0;var _0x2c09da=_0x1b49[_0x14e001];return _0x2c09da;};'use strict';var client=require(_0x91b4('0x0'));exports[_0x91b4('0x1')]=function(_0x7779f6){return client[_0x91b4('0x2')]('CreateChatMessage',{'body':_0x7779f6,'log':_0x91b4('0x3')});}; \ No newline at end of file +var _0x8c04=['create','createChatMessage','../client'];(function(_0x5bff0,_0x20716d){var _0x3ead2e=function(_0x14f592){while(--_0x14f592){_0x5bff0['push'](_0x5bff0['shift']());}};_0x3ead2e(++_0x20716d);}(_0x8c04,0x7a));var _0x48c0=function(_0x5a648c,_0x3929c8){_0x5a648c=_0x5a648c-0x0;var _0x40e10a=_0x8c04[_0x5a648c];return _0x40e10a;};'use strict';var client=require(_0x48c0('0x0'));exports[_0x48c0('0x1')]=function(_0x5b3ff0){return client['Request']('CreateChatMessage',{'body':_0x5b3ff0,'log':_0x48c0('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 94898a4..c2e7ff9 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 _0x5178=['GetChatQueue','name','timeout','Agents','chatPause','getChatQueues','Request'];(function(_0x5cf083,_0x5b8ab7){var _0x399146=function(_0x34f26e){while(--_0x34f26e){_0x5cf083['push'](_0x5cf083['shift']());}};_0x399146(++_0x5b8ab7);}(_0x5178,0x171));var _0x8517=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5178[_0x6c993a];return _0x27f547;};'use strict';var client=require('../client');exports[_0x8517('0x0')]=function(){return function(){return client[_0x8517('0x1')](_0x8517('0x2'),{'options':{'raw':![],'attributes':['id',_0x8517('0x3'),_0x8517('0x4'),'strategy'],'include':[{'model':'User','as':_0x8517('0x5'),'attributes':['id',_0x8517('0x3'),'online',_0x8517('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x9305=['online','chatPause','../client','getChatQueues','Request','GetChatQueue','timeout','strategy','User','Agents'];(function(_0x255cab,_0x53a59e){var _0x53fd8b=function(_0x4268c4){while(--_0x4268c4){_0x255cab['push'](_0x255cab['shift']());}};_0x53fd8b(++_0x53a59e);}(_0x9305,0x1e2));var _0x5930=function(_0x371279,_0x583e26){_0x371279=_0x371279-0x0;var _0xf194b6=_0x9305[_0x371279];return _0xf194b6;};'use strict';var client=require(_0x5930('0x0'));exports[_0x5930('0x1')]=function(){return function(){return client[_0x5930('0x2')](_0x5930('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x5930('0x4'),_0x5930('0x5')],'include':[{'model':_0x5930('0x6'),'as':_0x5930('0x7'),'attributes':['id','name',_0x5930('0x8'),_0x5930('0x9')]}]},'log':_0x5930('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 8921e8a..e603302 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 _0x32ef=['CreateChatQueueReport','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x505620,_0x17657c){var _0xa1beed=function(_0xbb0bd4){while(--_0xbb0bd4){_0x505620['push'](_0x505620['shift']());}};_0xa1beed(++_0x17657c);}(_0x32ef,0xf9));var _0xf32e=function(_0x464e09,_0x5a3d2b){_0x464e09=_0x464e09-0x0;var _0x355928=_0x32ef[_0x464e09];return _0x355928;};'use strict';var client=require(_0xf32e('0x0'));exports[_0xf32e('0x1')]=function(_0x1ec4de){return client[_0xf32e('0x2')](_0xf32e('0x3'),{'body':_0x1ec4de,'log':_0xf32e('0x3')});};exports['update']=function(_0x232ead,_0x1ff6ab){return client['Request'](_0xf32e('0x4'),{'body':_0x1ff6ab,'options':{'where':{'uniqueid':_0x232ead},'order':[['id',_0xf32e('0x5')]],'limit':0x1},'log':_0xf32e('0x4')});}; \ No newline at end of file +var _0xdb4b=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create'];(function(_0x1bc090,_0x4ecf2f){var _0x2cb4e7=function(_0x5e38a6){while(--_0x5e38a6){_0x1bc090['push'](_0x1bc090['shift']());}};_0x2cb4e7(++_0x4ecf2f);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x37843a,_0xdfe28d){_0x37843a=_0x37843a-0x0;var _0x4e7142=_0xdb4b[_0x37843a];return _0x4e7142;};'use strict';var client=require('../client');exports[_0xbdb4('0x0')]=function(_0x5110a9){return client[_0xbdb4('0x1')](_0xbdb4('0x2'),{'body':_0x5110a9,'log':_0xbdb4('0x2')});};exports[_0xbdb4('0x3')]=function(_0x47a78c,_0x3cc8c2){return client[_0xbdb4('0x1')](_0xbdb4('0x4'),{'body':_0x3cc8c2,'options':{'where':{'uniqueid':_0x47a78c},'order':[['id',_0xbdb4('0x5')]],'limit':0x1},'log':_0xbdb4('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 42d7a6e..7c20507 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7a54,0x106));var _0x47a5=function(_0x2c2567,_0x1c60c3){_0x2c2567=_0x2c2567-0x0;var _0x26f931=_0x7a54[_0x2c2567];return _0x26f931;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 0930e27..e318a58 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 _0xf7e9=['createFaxMessage','../client','create','CreateFaxMessage'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xf7e9,0x195));var _0x9f7e=function(_0x2b1551,_0x1776fe){_0x2b1551=_0x2b1551-0x0;var _0x2fc2a1=_0xf7e9[_0x2b1551];return _0x2fc2a1;};'use strict';var client=require(_0x9f7e('0x0'));exports[_0x9f7e('0x1')]=function(_0xca4842){return client['Request'](_0x9f7e('0x2'),{'body':_0xca4842,'log':_0x9f7e('0x3')});}; \ No newline at end of file +var _0xe6c7=['createFaxMessage','../client','Request','CreateFaxMessage'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xe6c7,0x69));var _0x7e6c=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0xe6c7[_0x2e04ef];return _0x5722b0;};'use strict';var client=require(_0x7e6c('0x0'));exports['create']=function(_0x5d8b17){return client[_0x7e6c('0x1')](_0x7e6c('0x2'),{'body':_0x5d8b17,'log':_0x7e6c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b59fa8c..c83a978 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 _0x5a09=['Request','GetFaxQueue','name','strategy','User','online'];(function(_0x509ff5,_0x4b2eb6){var _0x315f13=function(_0x489960){while(--_0x489960){_0x509ff5['push'](_0x509ff5['shift']());}};_0x315f13(++_0x4b2eb6);}(_0x5a09,0xd2));var _0x95a0=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0x5a09[_0xe3e0af];return _0x4828e9;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x95a0('0x0')](_0x95a0('0x1'),{'options':{'raw':![],'attributes':['id',_0x95a0('0x2'),'timeout',_0x95a0('0x3')],'include':[{'model':_0x95a0('0x4'),'as':'Agents','attributes':['id',_0x95a0('0x2'),_0x95a0('0x5'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x27d3=['name','timeout','strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue'];(function(_0x2d0283,_0x5abea1){var _0x25a4b7=function(_0x57783a){while(--_0x57783a){_0x2d0283['push'](_0x2d0283['shift']());}};_0x25a4b7(++_0x5abea1);}(_0x27d3,0xe3));var _0x327d=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x27d3[_0x2dadb9];return _0x2f0097;};'use strict';var client=require(_0x327d('0x0'));exports[_0x327d('0x1')]=function(){return function(){return client[_0x327d('0x2')](_0x327d('0x3'),{'options':{'raw':![],'attributes':['id',_0x327d('0x4'),_0x327d('0x5'),_0x327d('0x6')],'include':[{'model':_0x327d('0x7'),'as':_0x327d('0x8'),'attributes':['id',_0x327d('0x4'),_0x327d('0x9'),_0x327d('0xa')]}]},'log':_0x327d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index af4c531..013a294 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 _0x9617=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create'];(function(_0x43b9a8,_0x3d2c61){var _0xb88c95=function(_0xd2db10){while(--_0xd2db10){_0x43b9a8['push'](_0x43b9a8['shift']());}};_0xb88c95(++_0x3d2c61);}(_0x9617,0x172));var _0x7961=function(_0x40a087,_0x448ac1){_0x40a087=_0x40a087-0x0;var _0xeb7c48=_0x9617[_0x40a087];return _0xeb7c48;};'use strict';var client=require(_0x7961('0x0'));exports[_0x7961('0x1')]=function(_0x3cf321){return client[_0x7961('0x2')](_0x7961('0x3'),{'body':_0x3cf321,'log':_0x7961('0x3')});};exports[_0x7961('0x4')]=function(_0x11c742,_0x18f5c2){return client[_0x7961('0x2')](_0x7961('0x5'),{'body':_0x18f5c2,'options':{'where':{'uniqueid':_0x11c742},'order':[['id','DESC']],'limit':0x1},'log':_0x7961('0x5')});}; \ No newline at end of file +var _0x4668=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport','update'];(function(_0xc6cdf0,_0x42471d){var _0x324298=function(_0x129fea){while(--_0x129fea){_0xc6cdf0['push'](_0xc6cdf0['shift']());}};_0x324298(++_0x42471d);}(_0x4668,0x1ec));var _0x8466=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4668[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x8466('0x0'));exports[_0x8466('0x1')]=function(_0x30fd73){return client[_0x8466('0x2')]('CreateFaxQueueReport',{'body':_0x30fd73,'log':_0x8466('0x3')});};exports[_0x8466('0x4')]=function(_0x275c85,_0x14cfe7){return client[_0x8466('0x2')](_0x8466('0x5'),{'body':_0x14cfe7,'options':{'where':{'uniqueid':_0x275c85},'order':[['id',_0x8466('0x6')]],'limit':0x1},'log':_0x8466('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index dda5cb7..ce43729 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 _0x9246=['Interval','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x344e99,_0x530098){var _0x172d28=function(_0x1e68f4){while(--_0x1e68f4){_0x344e99['push'](_0x344e99['shift']());}};_0x172d28(++_0x530098);}(_0x9246,0x113));var _0x6924=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x9246[_0x411017];return _0x2adeea;};'use strict';var client=require(_0x6924('0x0'));exports[_0x6924('0x1')]=function(){return function(){return client[_0x6924('0x2')](_0x6924('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6924('0x4')],'include':[{'model':_0x6924('0x5'),'as':'Intervals','attributes':['id',_0x6924('0x4'),_0x6924('0x6')]}]},'log':_0x6924('0x1')});};}; \ No newline at end of file +var _0xaf08=['name','getIntervals','../client','Request','GetInterval','Intervals'];(function(_0x2fb9fe,_0x2f4735){var _0x45ebe3=function(_0x409c7b){while(--_0x409c7b){_0x2fb9fe['push'](_0x2fb9fe['shift']());}};_0x45ebe3(++_0x2f4735);}(_0xaf08,0x10a));var _0x8af0=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xaf08[_0x2e4e19];return _0x9ba20b;};'use strict';var client=require(_0x8af0('0x0'));exports['getIntervals']=function(){return function(){return client[_0x8af0('0x1')](_0x8af0('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x8af0('0x3'),'attributes':['id',_0x8af0('0x4'),'interval']}]},'log':_0x8af0('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index a24edd7..c972dcd 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 _0x781d=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x4bc4f3,_0xb93bd2){var _0x478fab=function(_0x2404ea){while(--_0x2404ea){_0x4bc4f3['push'](_0x4bc4f3['shift']());}};_0x478fab(++_0xb93bd2);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'use strict';var client=require(_0xd781('0x0'));exports[_0xd781('0x1')]=function(_0x596ba2,_0x5c1007){return client[_0xd781('0x2')](_0xd781('0x3'),{'body':_0x5c1007,'options':{'where':{'id':_0x596ba2}},'log':_0xd781('0x4')});};exports[_0xd781('0x5')]=function(_0xfd915d,_0x42258e){return client[_0xd781('0x2')](_0xd781('0x6'),{'body':_0x42258e,'options':{'where':{'id':_0xfd915d}},'log':_0xd781('0x7')});}; \ No newline at end of file +var _0xadb5=['Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update'];(function(_0x171bcb,_0x24fc81){var _0x176bc8=function(_0x774f01){while(--_0x774f01){_0x171bcb['push'](_0x171bcb['shift']());}};_0x176bc8(++_0x24fc81);}(_0xadb5,0xad));var _0x5adb=function(_0x572783,_0x2da0a2){_0x572783=_0x572783-0x0;var _0x231ffb=_0xadb5[_0x572783];return _0x231ffb;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(_0x49fc17,_0x3d6340){return client[_0x5adb('0x1')](_0x5adb('0x2'),{'body':_0x3d6340,'options':{'where':{'id':_0x49fc17}},'log':'updateMailInteraction'});};exports[_0x5adb('0x3')]=function(_0x31457,_0x2e3ef4){return client['Request'](_0x5adb('0x4'),{'body':_0x2e3ef4,'options':{'where':{'id':_0x31457}},'log':_0x5adb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index c997cfc..66b270a 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 _0x9cc0=['CreateMailMessage','../client','create','Request'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0x9cc0,0x155));var _0x09cc=function(_0x24681b,_0x31424e){_0x24681b=_0x24681b-0x0;var _0x10d992=_0x9cc0[_0x24681b];return _0x10d992;};'use strict';var client=require(_0x09cc('0x0'));exports[_0x09cc('0x1')]=function(_0x2f89b7){return client[_0x09cc('0x2')](_0x09cc('0x3'),{'body':_0x2f89b7,'log':'createMailMessage'});}; \ No newline at end of file +var _0x8a3e=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x8a3e,0x192));var _0xe8a3=function(_0x5b9d87,_0x5a751c){_0x5b9d87=_0x5b9d87-0x0;var _0x1420f8=_0x8a3e[_0x5b9d87];return _0x1420f8;};'use strict';var client=require(_0xe8a3('0x0'));exports[_0xe8a3('0x1')]=function(_0x1850f3){return client[_0xe8a3('0x2')](_0xe8a3('0x3'),{'body':_0x1850f3,'log':_0xe8a3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index dd33a4b..8864478 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 _0x7f9e=['GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause','../client','getMailQueues','Request'];(function(_0x54431f,_0x2ae80e){var _0x5a5e67=function(_0x10217e){while(--_0x10217e){_0x54431f['push'](_0x54431f['shift']());}};_0x5a5e67(++_0x2ae80e);}(_0x7f9e,0x15d));var _0xe7f9=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x7f9e[_0x59d89e];return _0x554e93;};'use strict';var client=require(_0xe7f9('0x0'));exports[_0xe7f9('0x1')]=function(){return function(){return client[_0xe7f9('0x2')](_0xe7f9('0x3'),{'options':{'raw':![],'attributes':['id',_0xe7f9('0x4'),_0xe7f9('0x5'),_0xe7f9('0x6')],'include':[{'model':_0xe7f9('0x7'),'as':_0xe7f9('0x8'),'attributes':['id','name',_0xe7f9('0x9'),_0xe7f9('0xa')]}]},'log':_0xe7f9('0x1')});};}; \ No newline at end of file +var _0xed13=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User'];(function(_0x369d7d,_0x13ad79){var _0x3685ec=function(_0x3e564e){while(--_0x3e564e){_0x369d7d['push'](_0x369d7d['shift']());}};_0x3685ec(++_0x13ad79);}(_0xed13,0x1e2));var _0x3ed1=function(_0x3ddb6c,_0x18b77e){_0x3ddb6c=_0x3ddb6c-0x0;var _0x1d2c29=_0xed13[_0x3ddb6c];return _0x1d2c29;};'use strict';var client=require(_0x3ed1('0x0'));exports[_0x3ed1('0x1')]=function(){return function(){return client[_0x3ed1('0x2')](_0x3ed1('0x3'),{'options':{'raw':![],'attributes':['id',_0x3ed1('0x4'),_0x3ed1('0x5'),_0x3ed1('0x6')],'include':[{'model':_0x3ed1('0x7'),'as':'Agents','attributes':['id',_0x3ed1('0x4'),_0x3ed1('0x8'),_0x3ed1('0x9')]}]},'log':_0x3ed1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 9656111..50642ee 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 _0x6473=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','create','Request'];(function(_0x3d54aa,_0x54952f){var _0x2e82dd=function(_0xb429f4){while(--_0xb429f4){_0x3d54aa['push'](_0x3d54aa['shift']());}};_0x2e82dd(++_0x54952f);}(_0x6473,0xb1));var _0x3647=function(_0x89c759,_0x4cf56f){_0x89c759=_0x89c759-0x0;var _0x18c395=_0x6473[_0x89c759];return _0x18c395;};'use strict';var client=require(_0x3647('0x0'));exports[_0x3647('0x1')]=function(_0x2f1aac){return client[_0x3647('0x2')](_0x3647('0x3'),{'body':_0x2f1aac,'log':_0x3647('0x3')});};exports[_0x3647('0x4')]=function(_0x3e0503,_0x504bc0){return client[_0x3647('0x2')](_0x3647('0x5'),{'body':_0x504bc0,'options':{'where':{'uniqueid':_0x3e0503},'order':[['id','DESC']],'limit':0x1},'log':_0x3647('0x5')});}; \ No newline at end of file +var _0xa704=['UpdateMailQueueReport','DESC','Request','CreateMailQueueReport','update'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa704,0x93));var _0x4a70=function(_0x280c03,_0x5ba994){_0x280c03=_0x280c03-0x0;var _0x5e271e=_0xa704[_0x280c03];return _0x5e271e;};'use strict';var client=require('../client');exports['create']=function(_0x58c38d){return client[_0x4a70('0x0')](_0x4a70('0x1'),{'body':_0x58c38d,'log':_0x4a70('0x1')});};exports[_0x4a70('0x2')]=function(_0x10e51e,_0x13e75f){return client['Request'](_0x4a70('0x3'),{'body':_0x13e75f,'options':{'where':{'uniqueid':_0x10e51e},'order':[['id',_0x4a70('0x4')]],'limit':0x1},'log':_0x4a70('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index d5d1dd5..0784339 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 _0x7124=['updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction'];(function(_0x2edf94,_0x213b29){var _0x11dbff=function(_0x5b028d){while(--_0x5b028d){_0x2edf94['push'](_0x2edf94['shift']());}};_0x11dbff(++_0x213b29);}(_0x7124,0x6d));var _0x4712=function(_0x56ef59,_0x2d1bc9){_0x56ef59=_0x56ef59-0x0;var _0x2432a6=_0x7124[_0x56ef59];return _0x2432a6;};'use strict';var client=require(_0x4712('0x0'));exports[_0x4712('0x1')]=function(_0x2449d0,_0x4f65cf){return client['Request'](_0x4712('0x2'),{'body':_0x4f65cf,'options':{'where':{'id':_0x2449d0}},'log':_0x4712('0x3')});};exports[_0x4712('0x4')]=function(_0xcd898b,_0x28e859){return client[_0x4712('0x5')](_0x4712('0x6'),{'body':_0x28e859,'options':{'where':{'id':_0xcd898b}},'log':_0x4712('0x7')});}; \ No newline at end of file +var _0xf0b0=['Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x4e4509,_0x62163d){var _0xbec4c1=function(_0x23fe41){while(--_0x23fe41){_0x4e4509['push'](_0x4e4509['shift']());}};_0xbec4c1(++_0x62163d);}(_0xf0b0,0x18b));var _0x0f0b=function(_0x2a0e23,_0x23b285){_0x2a0e23=_0x2a0e23-0x0;var _0x43432b=_0xf0b0[_0x2a0e23];return _0x43432b;};'use strict';var client=require(_0x0f0b('0x0'));exports[_0x0f0b('0x1')]=function(_0x447686,_0x43bfb5){return client['Request'](_0x0f0b('0x2'),{'body':_0x43bfb5,'options':{'where':{'id':_0x447686}},'log':_0x0f0b('0x3')});};exports['addTags']=function(_0x32260e,_0xae6202){return client[_0x0f0b('0x4')](_0x0f0b('0x5'),{'body':_0xae6202,'options':{'where':{'id':_0x32260e}},'log':_0x0f0b('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e1bd047..866d2a5 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 _0x7a99=['create'];(function(_0x2ab76b,_0x176579){var _0x201126=function(_0x11d8c8){while(--_0x11d8c8){_0x2ab76b['push'](_0x2ab76b['shift']());}};_0x201126(++_0x176579);}(_0x7a99,0x18d));var _0x97a9=function(_0x2c802b,_0x3a4492){_0x2c802b=_0x2c802b-0x0;var _0x5f5d4b=_0x7a99[_0x2c802b];return _0x5f5d4b;};'use strict';var client=require('../client');exports[_0x97a9('0x0')]=function(_0x344d02){return client['Request']('CreateOpenchannelMessage',{'body':_0x344d02,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x58c8=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x552f12,_0x23873e){var _0x1ebd4a=function(_0x11f315){while(--_0x11f315){_0x552f12['push'](_0x552f12['shift']());}};_0x1ebd4a(++_0x23873e);}(_0x58c8,0x1a5));var _0x858c=function(_0x4a02e5,_0x2cdf02){_0x4a02e5=_0x4a02e5-0x0;var _0x2e75b9=_0x58c8[_0x4a02e5];return _0x2e75b9;};'use strict';var client=require(_0x858c('0x0'));exports[_0x858c('0x1')]=function(_0x4de248){return client[_0x858c('0x2')](_0x858c('0x3'),{'body':_0x4de248,'log':_0x858c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index dfe1978..2eb9604 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 _0xd332=['User','Agents','online','openchannelPause','getOpenchannelQueues','Request','name','timeout','strategy'];(function(_0x466f2e,_0x5e2a7f){var _0x22dfbb=function(_0x308bbf){while(--_0x308bbf){_0x466f2e['push'](_0x466f2e['shift']());}};_0x22dfbb(++_0x5e2a7f);}(_0xd332,0xaf));var _0x2d33=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xd332[_0x29d915];return _0x160f86;};'use strict';var client=require('../client');exports[_0x2d33('0x0')]=function(){return function(){return client[_0x2d33('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x2d33('0x2'),_0x2d33('0x3'),_0x2d33('0x4')],'include':[{'model':_0x2d33('0x5'),'as':_0x2d33('0x6'),'attributes':['id',_0x2d33('0x2'),_0x2d33('0x7'),_0x2d33('0x8')]}]},'log':_0x2d33('0x0')});};}; \ No newline at end of file +var _0x19ec=['Request','GetOpenchannelQueue','strategy','User','name','openchannelPause','../client','getOpenchannelQueues'];(function(_0x4f8111,_0x56b0f9){var _0x796f13=function(_0x224bf0){while(--_0x224bf0){_0x4f8111['push'](_0x4f8111['shift']());}};_0x796f13(++_0x56b0f9);}(_0x19ec,0x1d6));var _0xc19e=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x19ec[_0xdea41a];return _0x15d0d8;};'use strict';var client=require(_0xc19e('0x0'));exports[_0xc19e('0x1')]=function(){return function(){return client[_0xc19e('0x2')](_0xc19e('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xc19e('0x4')],'include':[{'model':_0xc19e('0x5'),'as':'Agents','attributes':['id',_0xc19e('0x6'),'online',_0xc19e('0x7')]}]},'log':_0xc19e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 8d94399..e5a40e7 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 _0x9d9a=['Request','UpdateOpenchannelQueueReport','create','CreateOpenchannelQueueReport'];(function(_0x2221d6,_0x2dcca3){var _0x20f786=function(_0x1490c1){while(--_0x1490c1){_0x2221d6['push'](_0x2221d6['shift']());}};_0x20f786(++_0x2dcca3);}(_0x9d9a,0x1ba));var _0xa9d9=function(_0x37afaa,_0x5a281f){_0x37afaa=_0x37afaa-0x0;var _0x53cfa1=_0x9d9a[_0x37afaa];return _0x53cfa1;};'use strict';var client=require('../client');exports[_0xa9d9('0x0')]=function(_0x1f0ee9){return client['Request'](_0xa9d9('0x1'),{'body':_0x1f0ee9,'log':_0xa9d9('0x1')});};exports['update']=function(_0x1897d1,_0x9cf54c){return client[_0xa9d9('0x2')](_0xa9d9('0x3'),{'body':_0x9cf54c,'options':{'where':{'uniqueid':_0x1897d1},'order':[['id','DESC']],'limit':0x1},'log':_0xa9d9('0x3')});}; \ No newline at end of file +var _0xde78=['CreateOpenchannelQueueReport','Request','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x26d5c4,_0x47c64b){var _0x22082c=function(_0x1c2d75){while(--_0x1c2d75){_0x26d5c4['push'](_0x26d5c4['shift']());}};_0x22082c(++_0x47c64b);}(_0xde78,0x166));var _0x8de7=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0xde78[_0x4fe19c];return _0x952ac7;};'use strict';var client=require(_0x8de7('0x0'));exports[_0x8de7('0x1')]=function(_0x280f17){return client['Request'](_0x8de7('0x2'),{'body':_0x280f17,'log':_0x8de7('0x2')});};exports['update']=function(_0xf0bb24,_0x5703d6){return client[_0x8de7('0x3')](_0x8de7('0x4'),{'body':_0x5703d6,'options':{'where':{'uniqueid':_0xf0bb24},'order':[['id',_0x8de7('0x5')]],'limit':0x1},'log':_0x8de7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index dddacb1..b7b5104 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 _0x4a9c=['../client','update','Request','UpdateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x460feb,_0x5c9dc6){var _0x1cb1d0=function(_0x200737){while(--_0x200737){_0x460feb['push'](_0x460feb['shift']());}};_0x1cb1d0(++_0x5c9dc6);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x4b01d0,_0x3d7fa5){_0x4b01d0=_0x4b01d0-0x0;var _0x37221f=_0x4a9c[_0x4b01d0];return _0x37221f;};'use strict';var client=require(_0xc4a9('0x0'));exports[_0xc4a9('0x1')]=function(_0x40eb25,_0xb74796){return client[_0xc4a9('0x2')](_0xc4a9('0x3'),{'body':_0xb74796,'options':{'where':{'id':_0x40eb25}},'log':'updateSmsInteraction'});};exports[_0xc4a9('0x4')]=function(_0x935998,_0x129b6f){return client['Request']('AddTagsToSmsInteraction',{'body':_0x129b6f,'options':{'where':{'id':_0x935998}},'log':_0xc4a9('0x5')});}; \ No newline at end of file +var _0x9a19=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x491fcb,_0x56477e){var _0x1cc71c=function(_0x520164){while(--_0x520164){_0x491fcb['push'](_0x491fcb['shift']());}};_0x1cc71c(++_0x56477e);}(_0x9a19,0x114));var _0x99a1=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x9a19[_0xd0b415];return _0x2bdf2c;};'use strict';var client=require(_0x99a1('0x0'));exports[_0x99a1('0x1')]=function(_0x3d860b,_0x51ef2b){return client[_0x99a1('0x2')](_0x99a1('0x3'),{'body':_0x51ef2b,'options':{'where':{'id':_0x3d860b}},'log':_0x99a1('0x4')});};exports[_0x99a1('0x5')]=function(_0x214082,_0x3d73c5){return client[_0x99a1('0x2')](_0x99a1('0x6'),{'body':_0x3d73c5,'options':{'where':{'id':_0x214082}},'log':_0x99a1('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 4492eb9..2b17d3d 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 _0x5f7c=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x175f6c,_0x3ce3ea){var _0x1ece99=function(_0x31484f){while(--_0x31484f){_0x175f6c['push'](_0x175f6c['shift']());}};_0x1ece99(++_0x3ce3ea);}(_0x5f7c,0x182));var _0xc5f7=function(_0x2a57a9,_0x1b7b0a){_0x2a57a9=_0x2a57a9-0x0;var _0x1a811c=_0x5f7c[_0x2a57a9];return _0x1a811c;};'use strict';var client=require(_0xc5f7('0x0'));exports[_0xc5f7('0x1')]=function(_0xeb2cfb){return client[_0xc5f7('0x2')](_0xc5f7('0x3'),{'body':_0xeb2cfb,'log':_0xc5f7('0x4')});}; \ No newline at end of file +var _0x9d78=['../client','CreateSmsMessage','createSmsMessage'];(function(_0x41dd05,_0x588d3d){var _0x417b71=function(_0x3a4c3e){while(--_0x3a4c3e){_0x41dd05['push'](_0x41dd05['shift']());}};_0x417b71(++_0x588d3d);}(_0x9d78,0x159));var _0x89d7=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0x9d78[_0x1ff575];return _0x48fc9e;};'use strict';var client=require(_0x89d7('0x0'));exports['create']=function(_0x382717){return client['Request'](_0x89d7('0x1'),{'body':_0x382717,'log':_0x89d7('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 3226b96..ff6ea46 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x45d8ec,_0x5706f5){var _0x4f9839=function(_0x517c42){while(--_0x517c42){_0x45d8ec['push'](_0x45d8ec['shift']());}};_0x4f9839(++_0x5706f5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xb7e7[_0x369151];return _0x4292d5;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x3baf46,_0x32663a){var _0x461b87=function(_0x2703df){while(--_0x2703df){_0x3baf46['push'](_0x3baf46['shift']());}};_0x461b87(++_0x32663a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 7406bfa..fba9bb8 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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x3b9859,_0x52b534){var _0x3bc080=function(_0x5c4e2e){while(--_0x5c4e2e){_0x3b9859['push'](_0x3b9859['shift']());}};_0x3bc080(++_0x52b534);}(_0x008c,0x188));var _0xc008=function(_0x205ef8,_0x21dd3a){_0x205ef8=_0x205ef8-0x0;var _0x6f359e=_0x008c[_0x205ef8];return _0x6f359e;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x1943d9,_0x245bb8){var _0x4b4f3f=function(_0x3bba90){while(--_0x3bba90){_0x1943d9['push'](_0x1943d9['shift']());}};_0x4b4f3f(++_0x245bb8);}(_0x70e0,0x17b));var _0x070e=function(_0x22bcce,_0x4f1010){_0x22bcce=_0x22bcce-0x0;var _0x4707c4=_0x70e0[_0x22bcce];return _0x4707c4;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 53ee910..f740234 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(_0x383323,_0x370b99){var _0x48a642=function(_0xf178e6){while(--_0xf178e6){_0x383323['push'](_0x383323['shift']());}};_0x48a642(++_0x370b99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x7b9de1,_0x490921){var _0xd72308=function(_0x1b1146){while(--_0x1b1146){_0x7b9de1['push'](_0x7b9de1['shift']());}};_0xd72308(++_0x490921);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 6886284..8c14abe 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 _0x5334=['../client','update','Request','updateWhatsappInteraction'];(function(_0x212565,_0x47b995){var _0x2c9cb1=function(_0x352d46){while(--_0x352d46){_0x212565['push'](_0x212565['shift']());}};_0x2c9cb1(++_0x47b995);}(_0x5334,0x84));var _0x4533=function(_0x291bad,_0x1662a3){_0x291bad=_0x291bad-0x0;var _0x3687cd=_0x5334[_0x291bad];return _0x3687cd;};'use strict';var client=require(_0x4533('0x0'));exports[_0x4533('0x1')]=function(_0x6499ca,_0x35fb80){return client[_0x4533('0x2')]('UpdateWhatsappInteraction',{'body':_0x35fb80,'options':{'where':{'id':_0x6499ca}},'log':_0x4533('0x3')});};exports['addTags']=function(_0x42184d,_0x11ce61){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x11ce61,'options':{'where':{'id':_0x42184d}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x44c2=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','../client','update'];(function(_0x4dd5f7,_0x20badf){var _0x1669ac=function(_0x3e597d){while(--_0x3e597d){_0x4dd5f7['push'](_0x4dd5f7['shift']());}};_0x1669ac(++_0x20badf);}(_0x44c2,0x100));var _0x244c=function(_0x4884a7,_0x18e38a){_0x4884a7=_0x4884a7-0x0;var _0x56b60e=_0x44c2[_0x4884a7];return _0x56b60e;};'use strict';var client=require(_0x244c('0x0'));exports[_0x244c('0x1')]=function(_0x277954,_0x204240){return client['Request'](_0x244c('0x2'),{'body':_0x204240,'options':{'where':{'id':_0x277954}},'log':_0x244c('0x3')});};exports[_0x244c('0x4')]=function(_0x3b2ff1,_0x134a84){return client[_0x244c('0x5')]('AddTagsToWhatsappInteraction',{'body':_0x134a84,'options':{'where':{'id':_0x3b2ff1}},'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 c8a7add..1217b5c 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 _0x1701=['CreateWhatsappMessage','createWhatsappMessage','../client','Request'];(function(_0x5d8c37,_0x2d820d){var _0x4dcd89=function(_0x2b3bdb){while(--_0x2b3bdb){_0x5d8c37['push'](_0x5d8c37['shift']());}};_0x4dcd89(++_0x2d820d);}(_0x1701,0x16a));var _0x1170=function(_0x52b789,_0x2f27d2){_0x52b789=_0x52b789-0x0;var _0x1ce5a8=_0x1701[_0x52b789];return _0x1ce5a8;};'use strict';var client=require(_0x1170('0x0'));exports['create']=function(_0x39f507){return client[_0x1170('0x1')](_0x1170('0x2'),{'body':_0x39f507,'log':_0x1170('0x3')});}; \ No newline at end of file +var _0x7d9d=['create','Request','CreateWhatsappMessage'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7d9d,0x1ad));var _0xd7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xd7d9('0x0')]=function(_0x276d6a){return client[_0xd7d9('0x1')](_0xd7d9('0x2'),{'body':_0x276d6a,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c25c2d8..bbdffef 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 _0x54e8=['timeout','strategy','Agents','getWhatsappQueues','../client','Request','GetWhatsappQueue','name'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x54e8,0x1e4));var _0x854e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x54e8[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x854e('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x854e('0x1')](_0x854e('0x2'),{'options':{'raw':![],'attributes':['id',_0x854e('0x3'),_0x854e('0x4'),_0x854e('0x5')],'include':[{'model':'User','as':_0x854e('0x6'),'attributes':['id','name','online','whatsappPause']}]},'log':_0x854e('0x7')});};}; \ No newline at end of file +var _0xa154=['whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','User','Agents','name'];(function(_0x550172,_0x3e61e8){var _0x360035=function(_0x346583){while(--_0x346583){_0x550172['push'](_0x550172['shift']());}};_0x360035(++_0x3e61e8);}(_0xa154,0x78));var _0x4a15=function(_0x18948a,_0x5a5770){_0x18948a=_0x18948a-0x0;var _0x9cbb9a=_0xa154[_0x18948a];return _0x9cbb9a;};'use strict';var client=require('../client');exports[_0x4a15('0x0')]=function(){return function(){return client[_0x4a15('0x1')](_0x4a15('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x4a15('0x3'),'as':_0x4a15('0x4'),'attributes':['id',_0x4a15('0x5'),'online',_0x4a15('0x6')]}]},'log':_0x4a15('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 38b68a9..e1f45f1 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 _0xb43c=['Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x41cdfc,_0x2d014e){var _0xc1653c=function(_0x4f0e62){while(--_0x4f0e62){_0x41cdfc['push'](_0x41cdfc['shift']());}};_0xc1653c(++_0x2d014e);}(_0xb43c,0x199));var _0xcb43=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb43c[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xcb43('0x0'));exports['create']=function(_0x1944b2){return client[_0xcb43('0x1')]('CreateWhatsappQueueReport',{'body':_0x1944b2,'log':_0xcb43('0x2')});};exports['update']=function(_0x15bd3c,_0x357969){return client[_0xcb43('0x1')](_0xcb43('0x3'),{'body':_0x357969,'options':{'where':{'uniqueid':_0x15bd3c},'order':[['id',_0xcb43('0x4')]],'limit':0x1},'log':_0xcb43('0x3')});}; \ No newline at end of file +var _0xa04d=['CreateWhatsappQueueReport','update','Request','DESC','UpdateWhatsappQueueReport','../client'];(function(_0x8f0755,_0x9b2637){var _0x2b2997=function(_0x3a5b77){while(--_0x3a5b77){_0x8f0755['push'](_0x8f0755['shift']());}};_0x2b2997(++_0x9b2637);}(_0xa04d,0x125));var _0xda04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa04d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xda04('0x0'));exports['create']=function(_0xa7767e){return client['Request'](_0xda04('0x1'),{'body':_0xa7767e,'log':_0xda04('0x1')});};exports[_0xda04('0x2')]=function(_0x305448,_0x4f4571){return client[_0xda04('0x3')]('UpdateWhatsappQueueReport',{'body':_0x4f4571,'options':{'where':{'uniqueid':_0x305448},'order':[['id',_0xda04('0x4')]],'limit':0x1},'log':_0xda04('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index ba1cb57..6da69fa 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 _0xca60=['string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','join','stop','find','atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy'];(function(_0x154cb5,_0x1a8d5a){var _0x3f574f=function(_0x597a52){while(--_0x597a52){_0x154cb5['push'](_0x154cb5['shift']());}};_0x3f574f(++_0x1a8d5a);}(_0xca60,0xef));var _0x0ca6=function(_0x2d460c,_0x4f08c0){_0x2d460c=_0x2d460c-0x0;var _0xf6fc4c=_0xca60[_0x2d460c];return _0xf6fc4c;};'use strict';var schema=require(_0x0ca6('0x0'));var _=require('lodash');var util=require(_0x0ca6('0x1'));var seqqueue=require(_0x0ca6('0x2'));var logger=require(_0x0ca6('0x3'))(_0x0ca6('0x4'));var strategy=require(_0x0ca6('0x5'));var queue=schema({'name':{'type':_0x0ca6('0x6'),'required':!![],'message':_0x0ca6('0x7')},'timeout':{'type':'number','message':_0x0ca6('0x8')}});function writeLog(_0x3347e9,_0x526fef,_0x5e6895){return logger[_0x0ca6('0x9')](util[_0x0ca6('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x3347e9,_0x526fef[_0x0ca6('0xb')],_0x5e6895));}function handleFindAgent(_0x1ef6d9){return function(_0x1c2a8e){return _0x1c2a8e['name'][_0x0ca6('0xc')]()===_0x1ef6d9['toLowerCase']();};}exports[_0x0ca6('0xd')]=function(_0x521176,_0x2d64df,_0x62e535,_0x3d2871){return function(_0x210962){try{var _0x3fab9f={'name':_0x2d64df[0x0],'timeout':_0x2d64df[0x1]};var _0x2b08b4=queue['validate'](_0x3fab9f,{'typecast':!![]});if(_0x2b08b4[_0x0ca6('0xe')]){logger[_0x0ca6('0xf')](_0x0ca6('0x10'),_0x521176,_['map'](_0x2b08b4,'message')[_0x0ca6('0x11')](',\x20'));_0x210962[_0x0ca6('0x12')]();}else{var _0x528079=_[_0x0ca6('0x13')](_0x62e535['agents'],handleFindAgent(_0x3fab9f[_0x0ca6('0xb')]));if(_0x528079){var _0x14ae3=(_0x3fab9f['timeout']||0xa)*0x3e8;var _0x5ebde5,_0xcaa521;var _0x5ac289=seqqueue['createQueue'](_0x14ae3);_0x5ac289['id']=_0x521176;_0x5ac289[_0x0ca6('0x14')]=_0x14ae3;_0x5ac289['channel']=_0x3d2871[_0x0ca6('0x15')];writeLog(_0x521176,_0x528079,util[_0x0ca6('0xa')](_0x0ca6('0x16'),_0x14ae3));_0x62e535['rules'][_0x521176]['on'](_0x0ca6('0x17'),function(){logger['info'](_0x0ca6('0x18'),_0x521176);clearTimeout(_0xcaa521);_0xcaa521=undefined;_0x5ac289['close']();if(_0x62e535['rules'][_0x521176]){delete _0x62e535[_0x0ca6('0x19')][_0x521176];}_0x210962['stop']();});_0x62e535[_0x0ca6('0x19')][_0x521176]['on'](_0x0ca6('0x1a'),function(){if(_0x62e535[_0x0ca6('0x19')][_0x521176]){delete _0x62e535['rules'][_0x521176];}});_0xcaa521=setTimeout(function(){logger['info'](_0x0ca6('0x1b'),_0x521176);clearTimeout(_0xcaa521);_0x5ac289[_0x0ca6('0x1c')]();_0x210962[_0x0ca6('0x1d')]();},_0x14ae3);strategy[_0x0ca6('0x1e')](_0x5ac289,_0x528079,_0x62e535,_0x3d2871);}else{logger['error'](_0x0ca6('0x1f'),_0x521176,_0x3fab9f[_0x0ca6('0xb')]);_0x210962[_0x0ca6('0x12')]();}}}catch(_0x11954e){console[_0x0ca6('0x20')](_0x11954e);logger[_0x0ca6('0xf')](_0x0ca6('0x21'),_0x521176,_0x11954e[_0x0ca6('0x22')]);_0x210962[_0x0ca6('0x12')]();}};}; \ No newline at end of file +var _0xbaae=['consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase'];(function(_0x3c9c4d,_0x1a2ef0){var _0x189ec2=function(_0x4d0b38){while(--_0x4d0b38){_0x3c9c4d['push'](_0x3c9c4d['shift']());}};_0x189ec2(++_0x1a2ef0);}(_0xbaae,0x67));var _0xebaa=function(_0x4b5293,_0x417142){_0x4b5293=_0x4b5293-0x0;var _0x564eb5=_0xbaae[_0x4b5293];return _0x564eb5;};'use strict';var schema=require(_0xebaa('0x0'));var _=require(_0xebaa('0x1'));var util=require(_0xebaa('0x2'));var seqqueue=require(_0xebaa('0x3'));var logger=require('../../../../config/logger')(_0xebaa('0x4'));var strategy=require(_0xebaa('0x5'));var queue=schema({'name':{'type':_0xebaa('0x6'),'required':!![],'message':_0xebaa('0x7')},'timeout':{'type':_0xebaa('0x8'),'message':_0xebaa('0x9')}});function writeLog(_0x3beadb,_0x349d31,_0x3477fe){return logger[_0xebaa('0xa')](util[_0xebaa('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x3beadb,_0x349d31[_0xebaa('0xc')],_0x3477fe));}function handleFindAgent(_0x5a84ac){return function(_0x5f4ab9){return _0x5f4ab9['name'][_0xebaa('0xd')]()===_0x5a84ac[_0xebaa('0xd')]();};}exports[_0xebaa('0xe')]=function(_0xdda747,_0x3db09c,_0x48c232,_0x1373f8){return function(_0xf959d2){try{var _0x4ab302={'name':_0x3db09c[0x0],'timeout':_0x3db09c[0x1]};var _0x3d7a45=queue[_0xebaa('0x0')](_0x4ab302,{'typecast':!![]});if(_0x3d7a45[_0xebaa('0xf')]){logger[_0xebaa('0x10')](_0xebaa('0x11'),_0xdda747,_[_0xebaa('0x12')](_0x3d7a45,_0xebaa('0x13'))[_0xebaa('0x14')](',\x20'));_0xf959d2[_0xebaa('0x15')]();}else{var _0x11842e=_['find'](_0x48c232[_0xebaa('0x16')],handleFindAgent(_0x4ab302['name']));if(_0x11842e){var _0x4c1489=(_0x4ab302[_0xebaa('0x17')]||0xa)*0x3e8;var _0x227956,_0x2c2304;var _0x213e5f=seqqueue[_0xebaa('0x18')](_0x4c1489);_0x213e5f['id']=_0xdda747;_0x213e5f['atimeout']=_0x4c1489;_0x213e5f[_0xebaa('0x19')]=_0x1373f8[_0xebaa('0x19')];writeLog(_0xdda747,_0x11842e,util[_0xebaa('0xb')](_0xebaa('0x1a'),_0x4c1489));_0x48c232[_0xebaa('0x1b')][_0xdda747]['on'](_0xebaa('0x1c'),function(){logger['info'](_0xebaa('0x1d'),_0xdda747);clearTimeout(_0x2c2304);_0x2c2304=undefined;_0x213e5f[_0xebaa('0x1e')]();if(_0x48c232[_0xebaa('0x1b')][_0xdda747]){delete _0x48c232[_0xebaa('0x1b')][_0xdda747];}_0xf959d2[_0xebaa('0x15')]();});_0x48c232[_0xebaa('0x1b')][_0xdda747]['on'](_0xebaa('0x1f'),function(){if(_0x48c232['rules'][_0xdda747]){delete _0x48c232[_0xebaa('0x1b')][_0xdda747];}});_0x2c2304=setTimeout(function(){logger[_0xebaa('0xa')](_0xebaa('0x20'),_0xdda747);clearTimeout(_0x2c2304);_0x213e5f[_0xebaa('0x1e')]();_0xf959d2[_0xebaa('0x21')]();},_0x4c1489);strategy[_0xebaa('0x22')](_0x213e5f,_0x11842e,_0x48c232,_0x1373f8);}else{logger[_0xebaa('0x10')](_0xebaa('0x23'),_0xdda747,_0x4ab302[_0xebaa('0xc')]);_0xf959d2['stop']();}}}catch(_0x7a3697){console[_0xebaa('0x24')](_0x7a3697);logger[_0xebaa('0x10')](_0xebaa('0x25'),_0xdda747,_0x7a3697[_0xebaa('0x26')]);_0xf959d2[_0xebaa('0x15')]();}};}; \ 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 2a69395..49c8575 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 _0xfc4d=['getMustacheRender','create','then','body','error','stringify','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','amazonlex','providerName','providerResponse','Message','dialogState','Failed','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','sms','whatsapp','phone','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','isEmpty'];(function(_0x497123,_0x14b6a8){var _0x5e5f40=function(_0x425605){while(--_0x425605){_0x497123['push'](_0x497123['shift']());}};_0x5e5f40(++_0x14b6a8);}(_0xfc4d,0x79));var _0xdfc4=function(_0x386b69,_0x5d9360){_0x386b69=_0x386b69-0x0;var _0x476415=_0xfc4d[_0x386b69];return _0x476415;};'use strict';var _=require(_0xdfc4('0x0'));var moment=require(_0xdfc4('0x1'));var AWS=require(_0xdfc4('0x2'));var utils=require(_0xdfc4('0x3'));var logger=require(_0xdfc4('0x4'))(_0xdfc4('0x5'));var rpc={'chatMessage':require(_0xdfc4('0x6')),'openchannelMessage':require(_0xdfc4('0x7')),'mailMessage':require(_0xdfc4('0x8')),'smsMessage':require(_0xdfc4('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xdfc4('0xa'))};exports[_0xdfc4('0xb')]=function(_0x2848a9,_0x1500a4){return function(_0x5e2c1f){try{if(!_[_0xdfc4('0xc')](this[_0xdfc4('0xd')][_0xdfc4('0xe')])){logger[_0xdfc4('0xf')](_0xdfc4('0x10'),_0x2848a9,_0xdfc4('0x11'));return _0x5e2c1f[_0xdfc4('0x12')]();}var _0x140a08={'ContactId':this[_0xdfc4('0x13')]['id'],'sentAt':moment()[_0xdfc4('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xdfc4('0x15')};if(this['channel']===_0xdfc4('0x16')||this['channel']===_0xdfc4('0x17')){_0x140a08[_0xdfc4('0x18')]=this[_0xdfc4('0xd')][_0xdfc4('0x18')];}var _0x52ae9f=this[_0xdfc4('0x19')];if(_0x52ae9f===_0xdfc4('0x1a')){_0x140a08[_0xdfc4('0x1b')]=this[_0xdfc4('0x1c')]['id'];}else{_0x140a08[_[_0xdfc4('0x1d')](_0x52ae9f)+'AccountId']=this[_0xdfc4('0x1c')]['id'];}_0x140a08[_['upperFirst'](_0x52ae9f)+_0xdfc4('0x1e')]=this[_0xdfc4('0xd')]['id'];if(this[_0xdfc4('0xd')]['created']){var _0x41d962=_0x1500a4[0x4];if(!_[_0xdfc4('0x1f')](_0x41d962)){_0x140a08['body']=utils[_0xdfc4('0x20')](_0x41d962,this);return rpc[_0x52ae9f+'Message'][_0xdfc4('0x21')](_0x140a08)[_0xdfc4('0x22')](function(_0x211e3f){logger[_0xdfc4('0xf')]('[%s][AMAZONLEX]\x20%s',_0x2848a9,_0x140a08[_0xdfc4('0x23')]);})['catch'](function(_0x3063a4){logger[_0xdfc4('0x24')]('[%s][AMAZONLEX]\x20%s',_0x2848a9,JSON[_0xdfc4('0x25')](_0x3063a4));})['finally'](function(){logger[_0xdfc4('0xf')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2848a9);_0x5e2c1f[_0xdfc4('0x26')]();});}else{logger['info'](_0xdfc4('0x27'),_0x2848a9);_0x5e2c1f[_0xdfc4('0x26')]();}}else{var _0x58f78f=this;var _0x4a8921=new AWS[(_0xdfc4('0x28'))]({'accessKeyId':_0x1500a4[0x0],'secretAccessKey':_0x1500a4[0x1],'region':_0x1500a4[0x2]});var _0x3df092={'botAlias':_0xdfc4('0x29'),'botName':_0x1500a4[0x3],'inputText':this[_0xdfc4('0x2a')][_0xdfc4('0x23')],'userId':this[_0xdfc4('0x19')]+':'+this['interaction']['id'][_0xdfc4('0x2b')]()};_0x4a8921['postText'](_0x3df092,function(_0x2774c8,_0x4f7a92){if(_0x2774c8){logger[_0xdfc4('0x24')](_0xdfc4('0x10'),_0x2848a9,_0x2774c8[_0xdfc4('0x2a')]);_0x5e2c1f[_0xdfc4('0x12')]();}else if(_0x4f7a92&&_0x4f7a92[_0xdfc4('0x2a')]){_0x58f78f['body'][_0xdfc4('0x2c')]=_0x4f7a92;_0x140a08[_0xdfc4('0x23')]=_0x4f7a92[_0xdfc4('0x2a')];_0x140a08[_0xdfc4('0x2d')]=_0xdfc4('0x2c');_0x140a08[_0xdfc4('0x2e')]=JSON[_0xdfc4('0x25')](_0x4f7a92);return rpc[_0x52ae9f+_0xdfc4('0x2f')][_0xdfc4('0x21')](_0x140a08)[_0xdfc4('0x22')](function(_0x5db606){logger[_0xdfc4('0xf')]('[%s][AMAZONLEX]\x20%s',_0x2848a9,_0x140a08[_0xdfc4('0x23')]);if(_0x4f7a92[_0xdfc4('0x30')]==_0xdfc4('0x31')){_0x5e2c1f[_0xdfc4('0x12')]();}else{_0x5e2c1f[_0xdfc4('0x26')]();}})[_0xdfc4('0x32')](function(_0x186546){logger[_0xdfc4('0x24')](_0xdfc4('0x10'),_0x2848a9,JSON[_0xdfc4('0x25')](_0x186546));_0x5e2c1f['next']();});}else{_0x5e2c1f['next']();}});}}catch(_0x374d25){logger['error'](_0xdfc4('0x10'),_0x2848a9,JSON[_0xdfc4('0x25')](_0x374d25));_0x5e2c1f[_0xdfc4('0x26')]();}};}; \ No newline at end of file +var _0xf790=['body','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','message','toString','postText','error','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','next','contact','format','out','sms','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','then','[%s][AMAZONLEX]\x20%s'];(function(_0x3605b7,_0x53e428){var _0x5365a8=function(_0x2411cc){while(--_0x2411cc){_0x3605b7['push'](_0x3605b7['shift']());}};_0x5365a8(++_0x53e428);}(_0xf790,0x76));var _0x0f79=function(_0x3a6286,_0x2fe81d){_0x3a6286=_0x3a6286-0x0;var _0x51be99=_0xf790[_0x3a6286];return _0x51be99;};'use strict';var _=require(_0x0f79('0x0'));var moment=require(_0x0f79('0x1'));var AWS=require(_0x0f79('0x2'));var utils=require(_0x0f79('0x3'));var logger=require(_0x0f79('0x4'))(_0x0f79('0x5'));var rpc={'chatMessage':require(_0x0f79('0x6')),'openchannelMessage':require(_0x0f79('0x7')),'mailMessage':require(_0x0f79('0x8')),'smsMessage':require(_0x0f79('0x9')),'faxMessage':require(_0x0f79('0xa')),'whatsappMessage':require(_0x0f79('0xb'))};exports[_0x0f79('0xc')]=function(_0x43b1ae,_0x4b520a){return function(_0xcba35b){try{if(!_['isNil'](this[_0x0f79('0xd')][_0x0f79('0xe')])){logger[_0x0f79('0xf')]('[%s][AMAZONLEX]\x20%s',_0x43b1ae,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xcba35b[_0x0f79('0x10')]();}var _0x26a28d={'ContactId':this[_0x0f79('0x11')]['id'],'sentAt':moment()[_0x0f79('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x0f79('0x13')};if(this['channel']===_0x0f79('0x14')||this[_0x0f79('0x15')]===_0x0f79('0x16')){_0x26a28d[_0x0f79('0x17')]=this[_0x0f79('0xd')]['phone'];}var _0x235a76=this[_0x0f79('0x15')];if(_0x235a76===_0x0f79('0x18')){_0x26a28d['ChatWebsiteId']=this[_0x0f79('0x19')]['id'];}else{_0x26a28d[_[_0x0f79('0x1a')](_0x235a76)+_0x0f79('0x1b')]=this[_0x0f79('0x19')]['id'];}_0x26a28d[_['upperFirst'](_0x235a76)+_0x0f79('0x1c')]=this[_0x0f79('0xd')]['id'];if(this[_0x0f79('0xd')][_0x0f79('0x1d')]){var _0x3eaedd=_0x4b520a[0x4];if(!_[_0x0f79('0x1e')](_0x3eaedd)){_0x26a28d['body']=utils[_0x0f79('0x1f')](_0x3eaedd,this);return rpc[_0x235a76+_0x0f79('0x20')]['create'](_0x26a28d)[_0x0f79('0x21')](function(_0x1ea17c){logger[_0x0f79('0xf')](_0x0f79('0x22'),_0x43b1ae,_0x26a28d[_0x0f79('0x23')]);})[_0x0f79('0x24')](function(_0x5d0022){logger['error'](_0x0f79('0x22'),_0x43b1ae,JSON[_0x0f79('0x25')](_0x5d0022));})[_0x0f79('0x26')](function(){logger[_0x0f79('0xf')](_0x0f79('0x27'),_0x43b1ae);_0xcba35b[_0x0f79('0x28')]();});}else{logger[_0x0f79('0xf')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x43b1ae);_0xcba35b['stop']();}}else{var _0x2c24fd=this;var _0x804aa2=new AWS[(_0x0f79('0x29'))]({'accessKeyId':_0x4b520a[0x0],'secretAccessKey':_0x4b520a[0x1],'region':_0x4b520a[0x2]});var _0x21b4cf={'botAlias':'$LATEST','botName':_0x4b520a[0x3],'inputText':this[_0x0f79('0x2a')][_0x0f79('0x23')],'userId':this['channel']+':'+this[_0x0f79('0xd')]['id'][_0x0f79('0x2b')]()};_0x804aa2[_0x0f79('0x2c')](_0x21b4cf,function(_0x1fd923,_0x897dbd){if(_0x1fd923){logger[_0x0f79('0x2d')]('[%s][AMAZONLEX]\x20%s',_0x43b1ae,_0x1fd923['message']);_0xcba35b['next']();}else if(_0x897dbd&&_0x897dbd[_0x0f79('0x2a')]){_0x2c24fd[_0x0f79('0x23')][_0x0f79('0x2e')]=_0x897dbd;_0x26a28d['body']=_0x897dbd[_0x0f79('0x2a')];_0x26a28d[_0x0f79('0x2f')]=_0x0f79('0x2e');_0x26a28d[_0x0f79('0x30')]=JSON[_0x0f79('0x25')](_0x897dbd);return rpc[_0x235a76+'Message']['create'](_0x26a28d)[_0x0f79('0x21')](function(_0x3bdf8e){logger[_0x0f79('0xf')]('[%s][AMAZONLEX]\x20%s',_0x43b1ae,_0x26a28d[_0x0f79('0x23')]);if(_0x897dbd[_0x0f79('0x31')]==_0x0f79('0x32')){_0xcba35b['next']();}else{_0xcba35b[_0x0f79('0x28')]();}})['catch'](function(_0x1975a4){logger[_0x0f79('0x2d')](_0x0f79('0x22'),_0x43b1ae,JSON[_0x0f79('0x25')](_0x1975a4));_0xcba35b[_0x0f79('0x10')]();});}else{_0xcba35b[_0x0f79('0x10')]();}});}}catch(_0x43564f){logger[_0x0f79('0x2d')]('[%s][AMAZONLEX]\x20%s',_0x43b1ae,JSON[_0x0f79('0x25')](_0x43564f));_0xcba35b['stop']();}};}; \ 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 46de55f..2bc2558 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 _0x92d9=['contact','format','channel','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','Message','mail','messageId','html','replace',''+_[_0x992d('0x2f')](_0x35ef06['body'],_0x992d('0x30'),_0x992d('0x31'))+'';_0x35ef06['headers']={'Auto-Submitted':_0x992d('0x32'),'X-Auto-Response-Suppress':_0x992d('0x33'),'Precedence':_0x992d('0x34')};return mailRpc[_0x992d('0x35')](this[_0x992d('0x28')][_0x992d('0x36')],_0x35ef06)[_0x992d('0x37')](function(_0x1f6135){logger[_0x992d('0x10')](_0x992d('0x38'),_0x2c90ec);_0x35ef06[_0x992d('0x2d')]=_0x1f6135[_0x992d('0x1e')][_0x992d('0x2d')];return rpc[_0x118acf+_0x992d('0x2b')]['create'](_0x35ef06);})[_0x992d('0x37')](function(_0x56470a){logger[_0x992d('0x10')](_0x992d('0x11'),_0x2c90ec,JSON['stringify'](_0x56470a));})['catch'](function(_0x335e31){logger[_0x992d('0x39')](_0x992d('0x3a'),_0x2c90ec,JSON['stringify'](_0x335e31));})[_0x992d('0x3b')](function(){Promise[_0x992d('0x3c')]()[_0x992d('0x37')](function(){if(_0x590854[0x0]!=='2'||_0x2c653e[_0x992d('0x16')])return;return rpc[_0x118acf+_0x992d('0x3d')][_0x992d('0x3e')](_0x2c653e['id'],{'autoreplyExecuted':!![]})[_0x992d('0x37')](function(_0xe213bb){logger[_0x992d('0x10')](_0x992d('0x17'),_0x2c90ec,JSON[_0x992d('0x3f')](_0xe213bb));})[_0x992d('0x40')](function(_0x4771fe){logger[_0x992d('0x39')](_0x992d('0x41'),_0x2c90ec,JSON[_0x992d('0x3f')](_0x4771fe));});})[_0x992d('0x37')](function(){_0x29aed0[_0x992d('0x13')]();});});}else{return rpc[this[_0x992d('0x1b')]+'Message'][_0x992d('0x42')](_0x35ef06)['then'](function(){logger[_0x992d('0x10')](_0x992d('0x11'),_0x2c90ec,_0x35ef06[_0x992d('0x1c')]);})[_0x992d('0x40')](function(_0xbf3f80){logger[_0x992d('0x39')](_0x992d('0x11'),_0x2c90ec,JSON['stringify'](_0xbf3f80));})[_0x992d('0x3b')](function(){Promise[_0x992d('0x3c')]()[_0x992d('0x37')](function(){if(_0x590854[0x0]!=='2'||_0x2c653e[_0x992d('0x16')])return;return rpc[_0x118acf+_0x992d('0x3d')][_0x992d('0x3e')](_0x2c653e['id'],{'autoreplyExecuted':!![]})[_0x992d('0x37')](function(_0x352fa6){logger[_0x992d('0x10')](_0x992d('0x17'),_0x2c90ec,JSON['stringify'](_0x352fa6));})[_0x992d('0x40')](function(_0x349c46){logger[_0x992d('0x39')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2c90ec,JSON['stringify'](_0x349c46));});})['then'](function(){_0x29aed0['next']();});});}}}catch(_0x208f79){logger[_0x992d('0x39')](_0x992d('0x11'),_0x2c90ec,JSON[_0x992d('0x3f')](_0x208f79));_0x29aed0[_0x992d('0x43')]();}};}; \ No newline at end of file +var _0xa25a=['replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','then','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','update','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','messageId','html'];(function(_0x5e7df2,_0x2facb5){var _0x6fe2df=function(_0x2b5234){while(--_0x2b5234){_0x5e7df2['push'](_0x5e7df2['shift']());}};_0x6fe2df(++_0x2facb5);}(_0xa25a,0xd8));var _0xaa25=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0xa25a[_0x10d670];return _0x20d6f8;};'use strict';var _=require('lodash');var moment=require(_0xaa25('0x0'));var utils=require(_0xaa25('0x1'));var logger=require(_0xaa25('0x2'))('routing');var rpc={'chatMessage':require(_0xaa25('0x3')),'openchannelMessage':require(_0xaa25('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xaa25('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xaa25('0x6')),'chatInteraction':require(_0xaa25('0x7')),'openchannelInteraction':require(_0xaa25('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0xaa25('0x9')),'faxInteraction':require(_0xaa25('0xa')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0xaa25('0xb'));exports[_0xaa25('0xc')]=function(_0x337614,_0x40770d,_0x4777b4,_0x44d2d3){return function(_0x5e3ccc){try{var _0x41a731=this[_0xaa25('0xd')];if(_0x41a731===_0xaa25('0xe')&&_0x44d2d3[_0xaa25('0xf')]['isAutoreply']){logger[_0xaa25('0x10')](_0xaa25('0x11'),_0x337614,_0xaa25('0x12'));return _0x5e3ccc[_0xaa25('0x13')]();}if(_0x40770d[0x0]==='1'&&(_['isNil'](this[_0xaa25('0x14')][_0xaa25('0x15')])||!this[_0xaa25('0x14')]['created'])){logger[_0xaa25('0x10')](_0xaa25('0x11'),_0x337614,_0xaa25('0x16'));return _0x5e3ccc[_0xaa25('0x13')]();}if(_0x40770d[0x0]==='2'&&this[_0xaa25('0x14')][_0xaa25('0x17')]){logger['info'](_0xaa25('0x18'),_0x337614,'One\x20Time\x20already\x20sent');return _0x5e3ccc[_0xaa25('0x13')]();}var _0x51ead0={'ContactId':this['contact']['id'],'sentAt':moment()[_0xaa25('0x19')](_0xaa25('0x1a')),'direction':_0xaa25('0x1b')};if(this[_0xaa25('0xd')]===_0xaa25('0xe')){_0x51ead0[_0xaa25('0xf')]=utils[_0xaa25('0x1c')](_0x40770d[0x2],this);}else{_0x51ead0[_0xaa25('0xf')]=utils[_0xaa25('0x1c')](_0x40770d[0x1],this);}if(this[_0xaa25('0x1d')]){_0x51ead0['to']=this[_0xaa25('0x1d')][_0xaa25('0x1e')]||'';if(this['channel']==='mail'&&_0x40770d[0x1]==='1'){_0x51ead0['cc']=this[_0xaa25('0x1d')]['cc']||'';}_0x51ead0[_0xaa25('0x1e')]=this['message']['to']||'';_0x51ead0[_0xaa25('0x1f')]=this[_0xaa25('0x1d')][_0xaa25('0x1f')]||'';_0x51ead0['read']=!![];if(this[_0xaa25('0x1d')][_0xaa25('0x20')]){_0x51ead0[_0xaa25('0x20')]='';_0x51ead0[_0xaa25('0x20')]+=_[_0xaa25('0x21')](this[_0xaa25('0x1d')]['subject'],_0xaa25('0x22'))?'':'Re:\x20';_0x51ead0[_0xaa25('0x20')]+=this[_0xaa25('0x1d')]['subject'];}}if(this[_0xaa25('0xd')]===_0xaa25('0x23')){_0x51ead0[_0xaa25('0x24')]=this[_0xaa25('0x25')]['id'];}else{_0x51ead0[_[_0xaa25('0x26')](this[_0xaa25('0xd')])+_0xaa25('0x27')]=this['account']['id'];}_0x51ead0[_['upperFirst'](this['channel'])+_0xaa25('0x28')]=this['interaction']['id'];var _0x4037c3=this[_0xaa25('0x14')];if(rpc[this[_0xaa25('0xd')]+_0xaa25('0x29')]){if(this[_0xaa25('0xd')]===_0xaa25('0xe')){_0x51ead0['inReplyTo']=this[_0xaa25('0x1d')][_0xaa25('0x2a')];_0x51ead0[_0xaa25('0x2b')]=''+_[_0xaa25('0x2c')](_0x51ead0[_0xaa25('0xf')],_0xaa25('0x2d'),_0xaa25('0x2e'))+_0xaa25('0x2f');_0x51ead0[_0xaa25('0x30')]={'Auto-Submitted':_0xaa25('0x31'),'X-Auto-Response-Suppress':_0xaa25('0x32'),'Precedence':_0xaa25('0x33')};return mailRpc[_0xaa25('0x34')](this['account'][_0xaa25('0x35')],_0x51ead0)['then'](function(_0x14c46e){logger[_0xaa25('0x10')](_0xaa25('0x36'),_0x337614);_0x51ead0['messageId']=_0x14c46e[_0xaa25('0x1d')][_0xaa25('0x2a')];return rpc[_0x41a731+'Message'][_0xaa25('0x37')](_0x51ead0);})['then'](function(_0xf07f63){logger[_0xaa25('0x10')](_0xaa25('0x11'),_0x337614,JSON[_0xaa25('0x38')](_0xf07f63));})[_0xaa25('0x39')](function(_0x520cce){logger[_0xaa25('0x3a')](_0xaa25('0x3b'),_0x337614,JSON['stringify'](_0x520cce));})[_0xaa25('0x3c')](function(){Promise[_0xaa25('0x3d')]()[_0xaa25('0x3e')](function(){if(_0x40770d[0x0]!=='2'||_0x4037c3[_0xaa25('0x17')])return;return rpc[_0x41a731+'Interaction']['update'](_0x4037c3['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1c7c3c){logger[_0xaa25('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x337614,JSON[_0xaa25('0x38')](_0x1c7c3c));})['catch'](function(_0x356a64){logger[_0xaa25('0x3a')](_0xaa25('0x3f'),_0x337614,JSON[_0xaa25('0x38')](_0x356a64));});})['then'](function(){_0x5e3ccc[_0xaa25('0x13')]();});});}else{return rpc[this[_0xaa25('0xd')]+_0xaa25('0x29')][_0xaa25('0x37')](_0x51ead0)[_0xaa25('0x3e')](function(){logger[_0xaa25('0x10')](_0xaa25('0x11'),_0x337614,_0x51ead0[_0xaa25('0xf')]);})['catch'](function(_0x806401){logger['error']('[%s][AUTOREPLY]\x20%s',_0x337614,JSON[_0xaa25('0x38')](_0x806401));})['finally'](function(){Promise[_0xaa25('0x3d')]()[_0xaa25('0x3e')](function(){if(_0x40770d[0x0]!=='2'||_0x4037c3[_0xaa25('0x17')])return;return rpc[_0x41a731+'Interaction'][_0xaa25('0x40')](_0x4037c3['id'],{'autoreplyExecuted':!![]})[_0xaa25('0x3e')](function(_0x2bb32b){logger[_0xaa25('0x10')](_0xaa25('0x18'),_0x337614,JSON[_0xaa25('0x38')](_0x2bb32b));})[_0xaa25('0x39')](function(_0x63504e){logger[_0xaa25('0x3a')](_0xaa25('0x3f'),_0x337614,JSON[_0xaa25('0x38')](_0x63504e));});})[_0xaa25('0x3e')](function(){_0x5e3ccc[_0xaa25('0x13')]();});});}}}catch(_0x522675){logger['error'](_0xaa25('0x11'),_0x337614,JSON[_0xaa25('0x38')](_0x522675));_0x5e3ccc['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 2bc72e9..6daac96 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 _0xe3df=['system','channel','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4cf652,_0x55bd71){var _0x32e7c2=function(_0x2b280e){while(--_0x2b280e){_0x4cf652['push'](_0x4cf652['shift']());}};_0x32e7c2(++_0x55bd71);}(_0xe3df,0x1ac));var _0xfe3d=function(_0x5da910,_0x2d6a33){_0x5da910=_0x5da910-0x0;var _0x2953ef=_0xe3df[_0x5da910];return _0x2953ef;};'use strict';var moment=require(_0xfe3d('0x0'));var logger=require(_0xfe3d('0x1'))(_0xfe3d('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xfe3d('0x3')),'smsInteraction':require(_0xfe3d('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xfe3d('0x5'))};exports['consequence']=function(_0x5beb4a,_0xfe8916,_0x12c8f3,_0x2070c7){return function(_0x31676c){try{logger['info'](_0xfe3d('0x6'),_0x5beb4a,_0xfe8916[0x0]);var _0x226922={'closed':0x1,'closedAt':moment()[_0xfe3d('0x7')](_0xfe3d('0x8')),'closeReason':_0xfe3d('0x9'),'disposition':_0xfe8916[0x0]};if(rpc[_0x2070c7[_0xfe3d('0xa')]+'Interaction']){rpc[_0x2070c7['channel']+'Interaction'][_0xfe3d('0xb')](_0x2070c7[_0xfe3d('0xc')]['id'],_0x226922)[_0xfe3d('0xd')](function(_0x2f05d3){logger['info'](_0xfe3d('0xe'),_0x5beb4a,_0x2070c7[_0xfe3d('0xc')]['id']);})['catch'](function(_0x3cfa97){logger['error'](_0xfe3d('0xf'),_0x5beb4a,JSON[_0xfe3d('0x10')](_0x3cfa97));})[_0xfe3d('0x11')](function(){_0x31676c[_0xfe3d('0x12')]();});}}catch(_0x1fc20c){logger['error']('[%s][CLOSE]\x20%s',_0x5beb4a,JSON['stringify'](_0x1fc20c));_0x31676c[_0xfe3d('0x12')]();}};}; \ No newline at end of file +var _0xa3ed=['error','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stop'];(function(_0x1496c1,_0x23cf40){var _0x48abc0=function(_0x5337d6){while(--_0x5337d6){_0x1496c1['push'](_0x1496c1['shift']());}};_0x48abc0(++_0x23cf40);}(_0xa3ed,0x105));var _0xda3e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xa3ed[_0x199572];return _0x13cfa3;};'use strict';var moment=require(_0xda3e('0x0'));var logger=require(_0xda3e('0x1'))(_0xda3e('0x2'));var rpc={'chatInteraction':require(_0xda3e('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xda3e('0x4')),'mailInteraction':require(_0xda3e('0x5')),'faxInteraction':require(_0xda3e('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xda3e('0x7')]=function(_0x4f251c,_0x453c51,_0x5b2b31,_0x221418){return function(_0x36118b){try{logger[_0xda3e('0x8')](_0xda3e('0x9'),_0x4f251c,_0x453c51[0x0]);var _0x5328fd={'closed':0x1,'closedAt':moment()['format'](_0xda3e('0xa')),'closeReason':_0xda3e('0xb'),'disposition':_0x453c51[0x0]};if(rpc[_0x221418['channel']+_0xda3e('0xc')]){rpc[_0x221418['channel']+_0xda3e('0xc')][_0xda3e('0xd')](_0x221418[_0xda3e('0xe')]['id'],_0x5328fd)['then'](function(_0x21081f){logger['info'](_0xda3e('0xf'),_0x4f251c,_0x221418[_0xda3e('0xe')]['id']);})[_0xda3e('0x10')](function(_0x3a1e2f){logger['error'](_0xda3e('0x11'),_0x4f251c,JSON['stringify'](_0x3a1e2f));})['finally'](function(){_0x36118b[_0xda3e('0x12')]();});}}catch(_0x108ff6){logger[_0xda3e('0x13')](_0xda3e('0x11'),_0x4f251c,JSON['stringify'](_0x108ff6));_0x36118b['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 592cd65..0dae0f1 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 _0xbd3c=['ChatWebsiteId','upperFirst','account','InteractionId','body','getMustacheRender','Message','create','then','catch','error','stringify','stop','message','dialogflow','fulfillment','providerName','providerResponse','result','metadata','endConversation','next','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','sms','channel','whatsapp','phone','chat'];(function(_0x1f8eb8,_0xfc4345){var _0x37ca05=function(_0x4595e2){while(--_0x4595e2){_0x1f8eb8['push'](_0x1f8eb8['shift']());}};_0x37ca05(++_0xfc4345);}(_0xbd3c,0xc2));var _0xcbd3=function(_0x43e17b,_0x24e023){_0x43e17b=_0x43e17b-0x0;var _0x8aca77=_0xbd3c[_0x43e17b];return _0x8aca77;};'use strict';var _=require(_0xcbd3('0x0'));var moment=require(_0xcbd3('0x1'));var apiai=require(_0xcbd3('0x2'));var md5=require('md5');var utils=require(_0xcbd3('0x3'));var logger=require(_0xcbd3('0x4'))(_0xcbd3('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xcbd3('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xcbd3('0x7')),'whatsappMessage':require(_0xcbd3('0x8'))};exports['consequence']=function(_0x348468,_0x1c1483){return function(_0x13b4aa){try{if(!_['isNil'](this[_0xcbd3('0x9')][_0xcbd3('0xa')])){logger[_0xcbd3('0xb')](_0xcbd3('0xc'),_0x348468,_0xcbd3('0xd'));return _0x13b4aa['next']();}var _0x4c4e8c={'ContactId':this[_0xcbd3('0xe')]['id'],'sentAt':moment()[_0xcbd3('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0xcbd3('0x10')||this[_0xcbd3('0x11')]===_0xcbd3('0x12')){_0x4c4e8c['phone']=this[_0xcbd3('0x9')][_0xcbd3('0x13')];}var _0x324ce5=this[_0xcbd3('0x11')];if(_0x324ce5===_0xcbd3('0x14')){_0x4c4e8c[_0xcbd3('0x15')]=this['account']['id'];}else{_0x4c4e8c[_[_0xcbd3('0x16')](_0x324ce5)+'AccountId']=this[_0xcbd3('0x17')]['id'];}_0x4c4e8c[_[_0xcbd3('0x16')](_0x324ce5)+_0xcbd3('0x18')]=this['interaction']['id'];if(this[_0xcbd3('0x9')]['created']){var _0x3a379c=_0x1c1483[0x2];if(!_['isEmpty'](_0x3a379c)){_0x4c4e8c[_0xcbd3('0x19')]=utils[_0xcbd3('0x1a')](_0x3a379c,this);return rpc[_0x324ce5+_0xcbd3('0x1b')][_0xcbd3('0x1c')](_0x4c4e8c)[_0xcbd3('0x1d')](function(_0x4ee6a2){logger['info'](_0xcbd3('0xc'),_0x348468,_0x4c4e8c[_0xcbd3('0x19')]);})[_0xcbd3('0x1e')](function(_0x4deefc){logger[_0xcbd3('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x348468,JSON[_0xcbd3('0x20')](_0x4deefc));})['finally'](function(){logger[_0xcbd3('0xb')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x348468);_0x13b4aa[_0xcbd3('0x21')]();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x348468);_0x13b4aa[_0xcbd3('0x21')]();}}else{var _0x443531=this;var _0x1369c5=apiai(_0x1c1483[0x0],{'language':_0x1c1483[0x1]||'en'});return _0x1369c5['textRequest'](this[_0xcbd3('0x22')][_0xcbd3('0x19')],{'sessionId':md5(this[_0xcbd3('0x9')]['id'])})[_0xcbd3('0x1d')](function(_0x2a68db){_0x443531[_0xcbd3('0x19')][_0xcbd3('0x23')]=_0x2a68db;_0x4c4e8c[_0xcbd3('0x19')]=_0x2a68db['result'][_0xcbd3('0x24')]['speech'];_0x4c4e8c[_0xcbd3('0x25')]='dialogflow';_0x4c4e8c[_0xcbd3('0x26')]=JSON[_0xcbd3('0x20')](_0x2a68db);return rpc[_0x324ce5+'Message'][_0xcbd3('0x1c')](_0x4c4e8c)['then'](function(_0x319837){logger[_0xcbd3('0xb')](_0xcbd3('0xc'),_0x348468,_0x4c4e8c[_0xcbd3('0x19')]);if(_0x2a68db[_0xcbd3('0x27')][_0xcbd3('0x28')][_0xcbd3('0x29')]){_0x13b4aa['next']();}else{_0x13b4aa[_0xcbd3('0x21')]();}})[_0xcbd3('0x1e')](function(_0x2c0fb3){logger[_0xcbd3('0x1f')](_0xcbd3('0xc'),_0x348468,JSON[_0xcbd3('0x20')](_0x2c0fb3));_0x13b4aa[_0xcbd3('0x2a')]();});})[_0xcbd3('0x1e')](function(_0x2df328){logger['error'](_0xcbd3('0xc'),_0x348468,_0x2df328['message']);_0x13b4aa['next']();});}}catch(_0x25b032){logger[_0xcbd3('0x1f')](_0xcbd3('0xc'),_0x348468,JSON[_0xcbd3('0x20')](_0x25b032));_0x13b4aa[_0xcbd3('0x21')]();}};}; \ No newline at end of file +var _0xb7b6=['channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','create','catch','error','stop','textRequest','message','then','dialogflow','result','fulfillment','speech','providerName','providerResponse','stringify','metadata','next','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out'];(function(_0x3cd415,_0x260f17){var _0x38fdea=function(_0xff97f0){while(--_0xff97f0){_0x3cd415['push'](_0x3cd415['shift']());}};_0x38fdea(++_0x260f17);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x3e707d,_0x408a8a){_0x3e707d=_0x3e707d-0x0;var _0x2479cc=_0xb7b6[_0x3e707d];return _0x2479cc;};'use strict';var _=require(_0x6b7b('0x0'));var moment=require(_0x6b7b('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x6b7b('0x2'));var logger=require(_0x6b7b('0x3'))('routing');var rpc={'chatMessage':require(_0x6b7b('0x4')),'openchannelMessage':require(_0x6b7b('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6b7b('0x6')),'whatsappMessage':require(_0x6b7b('0x7'))};exports[_0x6b7b('0x8')]=function(_0xff519e,_0x24359f){return function(_0x483b9c){try{if(!_['isNil'](this[_0x6b7b('0x9')][_0x6b7b('0xa')])){logger[_0x6b7b('0xb')](_0x6b7b('0xc'),_0xff519e,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x483b9c['next']();}var _0x553009={'ContactId':this[_0x6b7b('0xd')]['id'],'sentAt':moment()[_0x6b7b('0xe')](_0x6b7b('0xf')),'direction':_0x6b7b('0x10')};if(this[_0x6b7b('0x11')]===_0x6b7b('0x12')||this['channel']===_0x6b7b('0x13')){_0x553009[_0x6b7b('0x14')]=this['interaction'][_0x6b7b('0x14')];}var _0x31ee5a=this['channel'];if(_0x31ee5a===_0x6b7b('0x15')){_0x553009['ChatWebsiteId']=this[_0x6b7b('0x16')]['id'];}else{_0x553009[_[_0x6b7b('0x17')](_0x31ee5a)+_0x6b7b('0x18')]=this['account']['id'];}_0x553009[_['upperFirst'](_0x31ee5a)+_0x6b7b('0x19')]=this['interaction']['id'];if(this['interaction'][_0x6b7b('0x1a')]){var _0x4362dd=_0x24359f[0x2];if(!_['isEmpty'](_0x4362dd)){_0x553009[_0x6b7b('0x1b')]=utils[_0x6b7b('0x1c')](_0x4362dd,this);return rpc[_0x31ee5a+_0x6b7b('0x1d')][_0x6b7b('0x1e')](_0x553009)['then'](function(_0x3d025c){logger[_0x6b7b('0xb')](_0x6b7b('0xc'),_0xff519e,_0x553009[_0x6b7b('0x1b')]);})[_0x6b7b('0x1f')](function(_0x2279de){logger[_0x6b7b('0x20')](_0x6b7b('0xc'),_0xff519e,JSON['stringify'](_0x2279de));})['finally'](function(){logger[_0x6b7b('0xb')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xff519e);_0x483b9c['stop']();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xff519e);_0x483b9c[_0x6b7b('0x21')]();}}else{var _0x27a0e6=this;var _0x52f4aa=apiai(_0x24359f[0x0],{'language':_0x24359f[0x1]||'en'});return _0x52f4aa[_0x6b7b('0x22')](this[_0x6b7b('0x23')]['body'],{'sessionId':md5(this[_0x6b7b('0x9')]['id'])})[_0x6b7b('0x24')](function(_0x13ce96){_0x27a0e6[_0x6b7b('0x1b')][_0x6b7b('0x25')]=_0x13ce96;_0x553009[_0x6b7b('0x1b')]=_0x13ce96[_0x6b7b('0x26')][_0x6b7b('0x27')][_0x6b7b('0x28')];_0x553009[_0x6b7b('0x29')]=_0x6b7b('0x25');_0x553009[_0x6b7b('0x2a')]=JSON[_0x6b7b('0x2b')](_0x13ce96);return rpc[_0x31ee5a+_0x6b7b('0x1d')][_0x6b7b('0x1e')](_0x553009)['then'](function(_0x5309e1){logger[_0x6b7b('0xb')](_0x6b7b('0xc'),_0xff519e,_0x553009[_0x6b7b('0x1b')]);if(_0x13ce96['result'][_0x6b7b('0x2c')]['endConversation']){_0x483b9c[_0x6b7b('0x2d')]();}else{_0x483b9c[_0x6b7b('0x21')]();}})[_0x6b7b('0x1f')](function(_0x1f0479){logger['error']('[%s][DIALOGFLOW]\x20%s',_0xff519e,JSON[_0x6b7b('0x2b')](_0x1f0479));_0x483b9c[_0x6b7b('0x2d')]();});})[_0x6b7b('0x1f')](function(_0x3ee2b6){logger[_0x6b7b('0x20')](_0x6b7b('0xc'),_0xff519e,_0x3ee2b6[_0x6b7b('0x23')]);_0x483b9c['next']();});}}catch(_0x4d3948){logger[_0x6b7b('0x20')](_0x6b7b('0xc'),_0xff519e,JSON[_0x6b7b('0x2b')](_0x4d3948));_0x483b9c[_0x6b7b('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 54cebe0..7a6d546 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 _0x627f=['YYYY-MM-DD\x20HH:mm:ss','channel','phone','chat','account','upperFirst','InteractionId','created','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','SessionsClient','sessionPath','message','length','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','all','next','stack','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction'];(function(_0x3863b1,_0x6d4959){var _0x5d769a=function(_0x1857db){while(--_0x1857db){_0x3863b1['push'](_0x3863b1['shift']());}};_0x5d769a(++_0x6d4959);}(_0x627f,0x137));var _0xf627=function(_0x25665d,_0x6f6b1d){_0x25665d=_0x25665d-0x0;var _0x3deded=_0x627f[_0x25665d];return _0x3deded;};'use strict';var _=require(_0xf627('0x0'));var dialogflow=require(_0xf627('0x1'));var md5=require(_0xf627('0x2'));var moment=require(_0xf627('0x3'));var Promise=require(_0xf627('0x4'));var logger=require(_0xf627('0x5'))('routing');var utils=require(_0xf627('0x6'));var rpc={'chatMessage':require(_0xf627('0x7')),'openchannelMessage':require(_0xf627('0x8')),'mailMessage':require(_0xf627('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf627('0xa')),'whatsappMessage':require(_0xf627('0xb'))};function createMessage(_0x1b328b,_0x18248b,_0x270724,_0x33537f){return new Promise(function(_0x4d95cd,_0x5d8eae){var _0x3602fc=_[_0xf627('0xc')](_0x270724);_0x3602fc[_0xf627('0xd')]=_0x33537f;return rpc[_0x18248b+_0xf627('0xe')]['create'](_0x3602fc)[_0xf627('0xf')](function(){logger[_0xf627('0x10')](_0xf627('0x11'),_0x1b328b,_0x3602fc[_0xf627('0xd')]);_0x4d95cd();})[_0xf627('0x12')](function(_0x54a4e4){logger[_0xf627('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x1b328b,JSON[_0xf627('0x14')](_0x54a4e4));_0x5d8eae(_0x54a4e4);});});}exports[_0xf627('0x15')]=function(_0x39fae2,_0x4f4ef1){return function(_0x1ce63d){try{if(!_[_0xf627('0x16')](this[_0xf627('0x17')]['UserId'])){logger[_0xf627('0x10')](_0xf627('0x11'),_0x39fae2,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1ce63d['next']();}var _0x17cc85={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xf627('0x18')),'direction':'out'};if(this[_0xf627('0x19')]==='sms'||this[_0xf627('0x19')]==='whatsapp'){_0x17cc85[_0xf627('0x1a')]=this[_0xf627('0x17')][_0xf627('0x1a')];}var _0x4d93cd=this[_0xf627('0x19')];if(_0x4d93cd===_0xf627('0x1b')){_0x17cc85['ChatWebsiteId']=this[_0xf627('0x1c')]['id'];}else{_0x17cc85[_[_0xf627('0x1d')](_0x4d93cd)+'AccountId']=this['account']['id'];}_0x17cc85[_[_0xf627('0x1d')](_0x4d93cd)+_0xf627('0x1e')]=this['interaction']['id'];if(this[_0xf627('0x17')][_0xf627('0x1f')]){var _0x2460a7=_0x4f4ef1[0x4];if(!_['isEmpty'](_0x2460a7)){_0x17cc85['body']=utils[_0xf627('0x20')](_0x2460a7,this);return rpc[_0x4d93cd+_0xf627('0xe')]['create'](_0x17cc85)[_0xf627('0xf')](function(_0x385541){logger[_0xf627('0x10')](_0xf627('0x11'),_0x39fae2,_0x17cc85[_0xf627('0xd')]);})[_0xf627('0x12')](function(_0x30bf29){logger[_0xf627('0x13')](_0xf627('0x11'),_0x39fae2,JSON[_0xf627('0x14')](_0x30bf29));})[_0xf627('0x21')](function(){logger['info'](_0xf627('0x22'),_0x39fae2);_0x1ce63d[_0xf627('0x23')]();});}else{logger[_0xf627('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x39fae2);_0x1ce63d[_0xf627('0x23')]();}}else{var _0x26339f=this;var _0x16ebe8=_0x4f4ef1[0x2]['replace'](/\\n/g,'\x0a');var _0x55eac1={'credentials':{'private_key':_0x16ebe8,'client_email':_0x4f4ef1[0x1]}};var _0x3aa63d=new dialogflow[(_0xf627('0x24'))](_0x55eac1);var _0x2733b1=_0x3aa63d[_0xf627('0x25')](_0x4f4ef1[0x0],md5(_0x26339f[_0xf627('0x17')]['id']));var _0x4cab49={'session':_0x2733b1,'queryInput':{'text':{'text':_0x26339f[_0xf627('0x26')][_0xf627('0xd')],'languageCode':_0x4f4ef1[0x3]||'en'}}};return _0x3aa63d['detectIntent'](_0x4cab49)['then'](function(_0x3633a8){if(_0x3633a8&&_0x3633a8[_0xf627('0x27')]){_0x26339f[_0xf627('0xd')][_0xf627('0x28')]=_0x3633a8;var _0x3d57d9=_0x3633a8[0x0];var _0x2f7f90=_0x3d57d9['queryResult'][_0xf627('0x29')]&&_0x3d57d9[_0xf627('0x2a')][_0xf627('0x29')][_0xf627('0x2b')]?_0x3d57d9[_0xf627('0x2a')][_0xf627('0x29')][_0xf627('0x2b')][_0xf627('0x2c')][_0xf627('0x2d')]:![];_0x26339f[_0xf627('0xd')][_0xf627('0x2e')]=_0x3d57d9['queryResult'][_0xf627('0x2f')];_0x26339f[_0xf627('0xd')][_0xf627('0x30')]=_0x3d57d9['queryResult']['allRequiredParamsPresent'];_0x26339f[_0xf627('0xd')][_0xf627('0x31')]=_0x3d57d9[_0xf627('0x2a')][_0xf627('0x29')]&&_0x3d57d9['queryResult'][_0xf627('0x29')][_0xf627('0x2b')]?_0x3d57d9[_0xf627('0x2a')][_0xf627('0x29')][_0xf627('0x2b')][_0xf627('0x2c')][_0xf627('0x2d')]:![];_0x26339f['body'][_0xf627('0x32')]=_0x3d57d9[_0xf627('0x2a')][_0xf627('0x33')][_0xf627('0x34')];_0x26339f[_0xf627('0xd')][_0xf627('0x35')]=_0x3d57d9['queryResult'][_0xf627('0x33')]['displayName'];_0x26339f[_0xf627('0xd')][_0xf627('0x36')]=_0x3d57d9[_0xf627('0x2a')][_0xf627('0x33')]['isFallback'];_0x26339f['body'][_0xf627('0x37')]=_0x3d57d9[_0xf627('0x2a')][_0xf627('0x38')];_0x26339f[_0xf627('0xd')][_0xf627('0x39')]=_0x3d57d9['queryResult'][_0xf627('0x3a')];_0x26339f[_0xf627('0xd')][_0xf627('0x3b')]=_0x3d57d9['queryResult']['intentDetectionConfidence'];_0x17cc85[_0xf627('0x3c')]='dialogflowV2';_0x17cc85[_0xf627('0x3d')]=JSON[_0xf627('0x14')](_0x3633a8);var _0x5eca2a=[];for(var _0x36912f=0x0;_0x36912f<_0x3633a8[_0xf627('0x27')];_0x36912f++){var _0x24db58=_0x3633a8[_0x36912f];if(_0x24db58&&_0x24db58[_0xf627('0x2a')]&&_0x24db58[_0xf627('0x2a')][_0xf627('0x3e')]){_0x5eca2a[_0xf627('0x3f')](createMessage(_0x39fae2,_0x4d93cd,_0x17cc85,_0x24db58[_0xf627('0x2a')][_0xf627('0x3e')]));}}return Promise[_0xf627('0x40')](_0x5eca2a)[_0xf627('0xf')](function(){if(_0x2f7f90){_0x1ce63d[_0xf627('0x41')]();}else{_0x1ce63d[_0xf627('0x23')]();}})[_0xf627('0x12')](function(_0x525ec9){logger[_0xf627('0x13')](_0xf627('0x11'),_0x39fae2,JSON[_0xf627('0x14')](_0x525ec9));_0x1ce63d[_0xf627('0x41')]();});}})['catch'](function(_0x2bea38){logger[_0xf627('0x13')](_0xf627('0x11'),_0x39fae2,_0x2bea38[_0xf627('0x26')],_0x2bea38[_0xf627('0x42')]);_0x1ce63d[_0xf627('0x41')]();});}}catch(_0x1324f8){logger[_0xf627('0x13')](_0xf627('0x11'),_0x39fae2,JSON[_0xf627('0x14')](_0x1324f8));_0x1ce63d['stop']();}};}; \ No newline at end of file +var _0x91cf=['finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','length','fulfillmentText','all','message','stack','lodash','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender'];(function(_0x5d4314,_0x21f602){var _0x5b5259=function(_0x5d78ba){while(--_0x5d78ba){_0x5d4314['push'](_0x5d4314['shift']());}};_0x5b5259(++_0x21f602);}(_0x91cf,0x1e9));var _0xf91c=function(_0x275293,_0x31bf61){_0x275293=_0x275293-0x0;var _0x539b28=_0x91cf[_0x275293];return _0x539b28;};'use strict';var _=require(_0xf91c('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xf91c('0x1'));var moment=require(_0xf91c('0x2'));var Promise=require(_0xf91c('0x3'));var logger=require(_0xf91c('0x4'))(_0xf91c('0x5'));var utils=require(_0xf91c('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf91c('0x7')),'mailMessage':require(_0xf91c('0x8')),'smsMessage':require(_0xf91c('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf91c('0xa'))};function createMessage(_0x26ed0e,_0x596a07,_0x39c6a4,_0x3efc80){return new Promise(function(_0xac75be,_0x85a7c2){var _0x2e6992=_[_0xf91c('0xb')](_0x39c6a4);_0x2e6992[_0xf91c('0xc')]=_0x3efc80;return rpc[_0x596a07+_0xf91c('0xd')][_0xf91c('0xe')](_0x2e6992)[_0xf91c('0xf')](function(){logger[_0xf91c('0x10')](_0xf91c('0x11'),_0x26ed0e,_0x2e6992[_0xf91c('0xc')]);_0xac75be();})[_0xf91c('0x12')](function(_0x5cafc6){logger[_0xf91c('0x13')](_0xf91c('0x11'),_0x26ed0e,JSON[_0xf91c('0x14')](_0x5cafc6));_0x85a7c2(_0x5cafc6);});});}exports[_0xf91c('0x15')]=function(_0x3b3f7f,_0xe2acf0){return function(_0x29121f){try{if(!_['isNil'](this['interaction'][_0xf91c('0x16')])){logger['info'](_0xf91c('0x11'),_0x3b3f7f,_0xf91c('0x17'));return _0x29121f[_0xf91c('0x18')]();}var _0x340966={'ContactId':this[_0xf91c('0x19')]['id'],'sentAt':moment()[_0xf91c('0x1a')](_0xf91c('0x1b')),'direction':_0xf91c('0x1c')};if(this[_0xf91c('0x1d')]===_0xf91c('0x1e')||this['channel']===_0xf91c('0x1f')){_0x340966[_0xf91c('0x20')]=this[_0xf91c('0x21')][_0xf91c('0x20')];}var _0x3aadaa=this[_0xf91c('0x1d')];if(_0x3aadaa===_0xf91c('0x22')){_0x340966[_0xf91c('0x23')]=this[_0xf91c('0x24')]['id'];}else{_0x340966[_[_0xf91c('0x25')](_0x3aadaa)+_0xf91c('0x26')]=this[_0xf91c('0x24')]['id'];}_0x340966[_[_0xf91c('0x25')](_0x3aadaa)+_0xf91c('0x27')]=this['interaction']['id'];if(this['interaction'][_0xf91c('0x28')]){var _0x4bbf74=_0xe2acf0[0x4];if(!_[_0xf91c('0x29')](_0x4bbf74)){_0x340966['body']=utils[_0xf91c('0x2a')](_0x4bbf74,this);return rpc[_0x3aadaa+'Message'][_0xf91c('0xe')](_0x340966)[_0xf91c('0xf')](function(_0x1bc4b2){logger[_0xf91c('0x10')](_0xf91c('0x11'),_0x3b3f7f,_0x340966[_0xf91c('0xc')]);})['catch'](function(_0x4ae0c3){logger[_0xf91c('0x13')](_0xf91c('0x11'),_0x3b3f7f,JSON['stringify'](_0x4ae0c3));})[_0xf91c('0x2b')](function(){logger[_0xf91c('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3b3f7f);_0x29121f[_0xf91c('0x2c')]();});}else{logger[_0xf91c('0x10')](_0xf91c('0x2d'),_0x3b3f7f);_0x29121f[_0xf91c('0x2c')]();}}else{var _0x5c9f3a=this;var _0x485126=_0xe2acf0[0x2][_0xf91c('0x2e')](/\\n/g,'\x0a');var _0x2cdd17={'credentials':{'private_key':_0x485126,'client_email':_0xe2acf0[0x1]}};var _0x1316c6=new dialogflow[(_0xf91c('0x2f'))](_0x2cdd17);var _0x4d6805=_0x1316c6['sessionPath'](_0xe2acf0[0x0],md5(_0x5c9f3a['interaction']['id']));var _0x2ce6fa={'session':_0x4d6805,'queryInput':{'text':{'text':_0x5c9f3a['message'][_0xf91c('0xc')],'languageCode':_0xe2acf0[0x3]||'en'}}};return _0x1316c6['detectIntent'](_0x2ce6fa)[_0xf91c('0xf')](function(_0x1dae95){if(_0x1dae95&&_0x1dae95['length']){_0x5c9f3a['body'][_0xf91c('0x30')]=_0x1dae95;var _0x2d8b76=_0x1dae95[0x0];var _0x4966b3=_0x2d8b76['queryResult'][_0xf91c('0x31')]&&_0x2d8b76[_0xf91c('0x32')][_0xf91c('0x31')][_0xf91c('0x33')]?_0x2d8b76[_0xf91c('0x32')][_0xf91c('0x31')][_0xf91c('0x33')][_0xf91c('0x34')][_0xf91c('0x35')]:![];_0x5c9f3a[_0xf91c('0xc')]['DIALOGFLOWV2_ACTION']=_0x2d8b76['queryResult'][_0xf91c('0x36')];_0x5c9f3a[_0xf91c('0xc')][_0xf91c('0x37')]=_0x2d8b76[_0xf91c('0x32')][_0xf91c('0x38')];_0x5c9f3a['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x2d8b76[_0xf91c('0x32')][_0xf91c('0x31')]&&_0x2d8b76['queryResult']['diagnosticInfo']['fields']?_0x2d8b76[_0xf91c('0x32')][_0xf91c('0x31')]['fields'][_0xf91c('0x34')][_0xf91c('0x35')]:![];_0x5c9f3a[_0xf91c('0xc')][_0xf91c('0x39')]=_0x2d8b76['queryResult']['intent'][_0xf91c('0x3a')];_0x5c9f3a['body'][_0xf91c('0x3b')]=_0x2d8b76[_0xf91c('0x32')][_0xf91c('0x3c')][_0xf91c('0x3d')];_0x5c9f3a[_0xf91c('0xc')][_0xf91c('0x3e')]=_0x2d8b76[_0xf91c('0x32')][_0xf91c('0x3c')][_0xf91c('0x3f')];_0x5c9f3a[_0xf91c('0xc')][_0xf91c('0x40')]=_0x2d8b76['queryResult'][_0xf91c('0x41')];_0x5c9f3a[_0xf91c('0xc')][_0xf91c('0x42')]=_0x2d8b76[_0xf91c('0x32')][_0xf91c('0x43')];_0x5c9f3a['body'][_0xf91c('0x44')]=_0x2d8b76[_0xf91c('0x32')]['intentDetectionConfidence'];_0x340966[_0xf91c('0x45')]=_0xf91c('0x30');_0x340966[_0xf91c('0x46')]=JSON[_0xf91c('0x14')](_0x1dae95);var _0x5d89e5=[];for(var _0x476ed2=0x0;_0x476ed2<_0x1dae95[_0xf91c('0x47')];_0x476ed2++){var _0x296401=_0x1dae95[_0x476ed2];if(_0x296401&&_0x296401[_0xf91c('0x32')]&&_0x296401['queryResult'][_0xf91c('0x48')]){_0x5d89e5['push'](createMessage(_0x3b3f7f,_0x3aadaa,_0x340966,_0x296401['queryResult'][_0xf91c('0x48')]));}}return Promise[_0xf91c('0x49')](_0x5d89e5)[_0xf91c('0xf')](function(){if(_0x4966b3){_0x29121f['next']();}else{_0x29121f['stop']();}})[_0xf91c('0x12')](function(_0xf08dbb){logger['error'](_0xf91c('0x11'),_0x3b3f7f,JSON[_0xf91c('0x14')](_0xf08dbb));_0x29121f[_0xf91c('0x18')]();});}})['catch'](function(_0x31c445){logger['error'](_0xf91c('0x11'),_0x3b3f7f,_0x31c445[_0xf91c('0x4a')],_0x31c445[_0xf91c('0x4b')]);_0x29121f[_0xf91c('0x18')]();});}}catch(_0x4fcf2d){logger['error'](_0xf91c('0x11'),_0x3b3f7f,JSON['stringify'](_0x4fcf2d));_0x29121f[_0xf91c('0x2c')]();}};}; \ 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 b8dc0b4..421bd1d 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 _0x7385=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string'];(function(_0xc8e34a,_0x571a4a){var _0xb190a7=function(_0x266cb8){while(--_0x266cb8){_0xc8e34a['push'](_0xc8e34a['shift']());}};_0xb190a7(++_0x571a4a);}(_0x7385,0xd1));var _0x5738=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x7385[_0x3b380d];return _0x54502b;};'use strict';var schema=require(_0x5738('0x0'));var _=require(_0x5738('0x1'));var htmlToText=require(_0x5738('0x2'));var utils=require(_0x5738('0x3'));var logger=require(_0x5738('0x4'))(_0x5738('0x5'));var gotoif=schema({'condition':{'type':_0x5738('0x6'),'required':!![],'message':_0x5738('0x7')},'priorityTrue':{'type':_0x5738('0x8'),'message':_0x5738('0x9')},'priorityFalse':{'type':_0x5738('0x8'),'message':_0x5738('0xa')}});exports['consequence']=function(_0x58369e,_0x368c8b){return function(_0x3363d5){try{var _0x503930={'condition':htmlToText['fromString'](utils[_0x5738('0xb')](_0x368c8b[0x0],this),{'wordwrap':![]})[_0x5738('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x368c8b[0x1],'priorityFalse':_0x368c8b[0x2]};var _0x20bee6=gotoif[_0x5738('0x0')](_0x503930,{'typecast':!![]});if(_0x20bee6[_0x5738('0xd')]){logger[_0x5738('0xe')](_0x5738('0xf'),_0x58369e,_[_0x5738('0x10')](_0x20bee6,_0x5738('0x11'))[_0x5738('0x12')](',\x20'));_0x3363d5[_0x5738('0x13')]();}else{try{var _0x591fb4=eval('('+_0x503930[_0x5738('0x14')]+')');var _0x4d2222=_0x591fb4?_0x503930[_0x5738('0x15')]:_0x503930['priorityFalse'];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x58369e,_0x503930['condition'],_0x591fb4,_0x4d2222||_0x5738('0x16'));if(_0x4d2222){var _0x14407c=_[_0x5738('0x17')](_0x3363d5['rules'](),{'p':_0x4d2222});if(_0x14407c>=0x0){logger[_0x5738('0x18')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x58369e,_0x4d2222||_0x5738('0x16'),_0x14407c);_0x3363d5['next'](_0x14407c);}else{logger[_0x5738('0x18')](_0x5738('0x19'),_0x58369e,_0x4d2222||_0x5738('0x16'));_0x3363d5['stop']();}}else{_0x3363d5[_0x5738('0x16')]();}}catch(_0x4c9187){logger[_0x5738('0xe')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x58369e,_0x4c9187[_0x5738('0x11')]);_0x3363d5[_0x5738('0x13')]();}}}catch(_0x2ff856){logger[_0x5738('0xe')](_0x5738('0xf'),_0x58369e,JSON[_0x5738('0x1a')](_0x2ff856));_0x3363d5['stop']();}};}; \ No newline at end of file +var _0x70a6=['html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','message'];(function(_0x5ac600,_0x12f652){var _0x37e050=function(_0x14402b){while(--_0x14402b){_0x5ac600['push'](_0x5ac600['shift']());}};_0x37e050(++_0x12f652);}(_0x70a6,0x1d0));var _0x670a=function(_0x899868,_0x310f52){_0x899868=_0x899868-0x0;var _0x2215ba=_0x70a6[_0x899868];return _0x2215ba;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x670a('0x0'));var utils=require(_0x670a('0x1'));var logger=require(_0x670a('0x2'))(_0x670a('0x3'));var gotoif=schema({'condition':{'type':_0x670a('0x4'),'required':!![],'message':_0x670a('0x5')},'priorityTrue':{'type':_0x670a('0x6'),'message':_0x670a('0x7')},'priorityFalse':{'type':'number','message':_0x670a('0x8')}});exports[_0x670a('0x9')]=function(_0x65ff7b,_0xde717c){return function(_0x1333f2){try{var _0x15eb10={'condition':htmlToText[_0x670a('0xa')](utils[_0x670a('0xb')](_0xde717c[0x0],this),{'wordwrap':![]})[_0x670a('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xde717c[0x1],'priorityFalse':_0xde717c[0x2]};var _0x39b91a=gotoif[_0x670a('0xd')](_0x15eb10,{'typecast':!![]});if(_0x39b91a[_0x670a('0xe')]){logger['error'](_0x670a('0xf'),_0x65ff7b,_[_0x670a('0x10')](_0x39b91a,'message')[_0x670a('0x11')](',\x20'));_0x1333f2[_0x670a('0x12')]();}else{try{var _0x227db8=eval('('+_0x15eb10['condition']+')');var _0x3e426f=_0x227db8?_0x15eb10[_0x670a('0x13')]:_0x15eb10[_0x670a('0x14')];logger[_0x670a('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x65ff7b,_0x15eb10['condition'],_0x227db8,_0x3e426f||_0x670a('0x16'));if(_0x3e426f){var _0x159625=_[_0x670a('0x17')](_0x1333f2[_0x670a('0x18')](),{'p':_0x3e426f});if(_0x159625>=0x0){logger[_0x670a('0x15')](_0x670a('0x19'),_0x65ff7b,_0x3e426f||_0x670a('0x16'),_0x159625);_0x1333f2[_0x670a('0x16')](_0x159625);}else{logger[_0x670a('0x15')](_0x670a('0x1a'),_0x65ff7b,_0x3e426f||_0x670a('0x16'));_0x1333f2[_0x670a('0x12')]();}}else{_0x1333f2[_0x670a('0x16')]();}}catch(_0x4e8254){logger[_0x670a('0x1b')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x65ff7b,_0x4e8254[_0x670a('0x1c')]);_0x1333f2['stop']();}}}catch(_0xd711c9){logger[_0x670a('0x1b')](_0x670a('0xf'),_0x65ff7b,JSON['stringify'](_0xd711c9));_0x1333f2['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 0ad473d..f486004 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 _0xe690=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','stop','lodash','../../../../config/logger','routing','number','validate','length','error','[%s][GOTOP]\x20%s','map','message','join','priority','findIndex','rules'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe690,0x1c6));var _0x0e69=function(_0x5cf188,_0x3dba35){_0x5cf188=_0x5cf188-0x0;var _0x3a5afb=_0xe690[_0x5cf188];return _0x3a5afb;};'use strict';var schema=require('validate');var _=require(_0x0e69('0x0'));var logger=require(_0x0e69('0x1'))(_0x0e69('0x2'));var gotop=schema({'priority':{'type':_0x0e69('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x4eaf62,_0x114e79){return function(_0x51bb8a){try{var _0xa1497d={'priority':_0x114e79[0x0]};var _0x916b39=gotop[_0x0e69('0x4')](_0xa1497d,{'typecast':!![]});if(_0x916b39[_0x0e69('0x5')]){logger[_0x0e69('0x6')](_0x0e69('0x7'),_0x4eaf62,_[_0x0e69('0x8')](_0x916b39,_0x0e69('0x9'))[_0x0e69('0xa')](',\x20'));_0x51bb8a['stop']();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x4eaf62,_0xa1497d[_0x0e69('0xb')]);if(_0xa1497d[_0x0e69('0xb')]){var _0x186861=_[_0x0e69('0xc')](_0x51bb8a[_0x0e69('0xd')](),{'p':_0xa1497d['priority']});if(_0x186861>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4eaf62,_0xa1497d[_0x0e69('0xb')]||'next',_0x186861);_0x51bb8a[_0x0e69('0xe')](_0x186861);}else{logger['info'](_0x0e69('0xf'),_0x4eaf62,_0xa1497d[_0x0e69('0xb')]||_0x0e69('0xe'));_0x51bb8a['stop']();}}else{_0x51bb8a[_0x0e69('0xe')]();}}}catch(_0x49be24){logger[_0x0e69('0x6')](_0x0e69('0x7'),_0x4eaf62,JSON[_0x0e69('0x10')](_0x49be24));_0x51bb8a[_0x0e69('0x11')]();}};}; \ No newline at end of file +var _0xd99e=['routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','join','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','stop','stringify','validate'];(function(_0x5814e2,_0x4a0292){var _0x55be4a=function(_0x962ee7){while(--_0x962ee7){_0x5814e2['push'](_0x5814e2['shift']());}};_0x55be4a(++_0x4a0292);}(_0xd99e,0x167));var _0xed99=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0xd99e[_0x1e6659];return _0x4d16e4;};'use strict';var schema=require(_0xed99('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0xed99('0x1'));var gotop=schema({'priority':{'type':_0xed99('0x2'),'required':!![],'message':_0xed99('0x3')}});exports[_0xed99('0x4')]=function(_0x16e74e,_0x5ede16){return function(_0x2c185a){try{var _0x1d648f={'priority':_0x5ede16[0x0]};var _0x3fd9c0=gotop['validate'](_0x1d648f,{'typecast':!![]});if(_0x3fd9c0[_0xed99('0x5')]){logger[_0xed99('0x6')](_0xed99('0x7'),_0x16e74e,_[_0xed99('0x8')](_0x3fd9c0,'message')[_0xed99('0x9')](',\x20'));_0x2c185a['stop']();}else{logger['info'](_0xed99('0xa'),_0x16e74e,_0x1d648f[_0xed99('0xb')]);if(_0x1d648f[_0xed99('0xb')]){var _0x3cc639=_[_0xed99('0xc')](_0x2c185a[_0xed99('0xd')](),{'p':_0x1d648f[_0xed99('0xb')]});if(_0x3cc639>=0x0){logger['info'](_0xed99('0xe'),_0x16e74e,_0x1d648f[_0xed99('0xb')]||'next',_0x3cc639);_0x2c185a['next'](_0x3cc639);}else{logger[_0xed99('0xf')](_0xed99('0x10'),_0x16e74e,_0x1d648f['priority']||_0xed99('0x11'));_0x2c185a[_0xed99('0x12')]();}}else{_0x2c185a['next']();}}}catch(_0x264d0c){logger[_0xed99('0x6')](_0xed99('0x7'),_0x16e74e,JSON[_0xed99('0x13')](_0x264d0c));_0x2c185a[_0xed99('0x12')]();}};}; \ 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 04250a2..58c38ef 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 _0x28f2=['interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','account','AccountId','upperFirst','InteractionId'];(function(_0x1bb03d,_0x28efcc){var _0x4e5d53=function(_0x92ab29){while(--_0x92ab29){_0x1bb03d['push'](_0x1bb03d['shift']());}};_0x4e5d53(++_0x28efcc);}(_0x28f2,0x193));var _0x228f=function(_0x30c9cd,_0x2def5b){_0x30c9cd=_0x30c9cd-0x0;var _0x9e145b=_0x28f2[_0x30c9cd];return _0x9e145b;};'use strict';var _=require(_0x228f('0x0'));var utils=require(_0x228f('0x1'));var logger=require(_0x228f('0x2'))(_0x228f('0x3'));var rpc={'chatMessage':require(_0x228f('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x228f('0x5')),'smsMessage':require(_0x228f('0x6')),'faxMessage':require(_0x228f('0x7')),'whatsappMessage':require(_0x228f('0x8'))};exports[_0x228f('0x9')]=function(_0x3439f5,_0x32c5c3){return function(_0x485423){try{var _0x10da58={'body':utils['getMustacheRender'](_0x32c5c3[0x0],this),'ContactId':this[_0x228f('0xa')]['id']};if(this[_0x228f('0xb')]===_0x228f('0xc')){_0x10da58['ChatWebsiteId']=this[_0x228f('0xd')]['id'];}else{_0x10da58[_['upperFirst'](this[_0x228f('0xb')])+_0x228f('0xe')]=this['account']['id'];}_0x10da58[_[_0x228f('0xf')](this[_0x228f('0xb')])+_0x228f('0x10')]=this[_0x228f('0x11')]['id'];if(rpc[this[_0x228f('0xb')]+'Message']){return rpc[this[_0x228f('0xb')]+_0x228f('0x12')][_0x228f('0x13')](_0x10da58)[_0x228f('0x14')](function(_0x2e1a43){logger[_0x228f('0x15')](_0x228f('0x16'),_0x3439f5,_0x10da58[_0x228f('0x17')]);_0x485423['next']();})[_0x228f('0x18')](function(_0xfb6aff){logger[_0x228f('0x19')](_0x228f('0x16'),_0x3439f5,JSON[_0x228f('0x1a')](_0xfb6aff));_0x485423[_0x228f('0x1b')]();});}}catch(_0x272723){logger['error'](_0x228f('0x16'),_0x3439f5,JSON['stringify'](_0x272723));_0x485423[_0x228f('0x1b')]();}};}; \ No newline at end of file +var _0xd9b6=['channel','chat','ChatWebsiteId','account','AccountId','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact'];(function(_0x480db9,_0xeed660){var _0x66c040=function(_0x4fbca0){while(--_0x4fbca0){_0x480db9['push'](_0x480db9['shift']());}};_0x66c040(++_0xeed660);}(_0xd9b6,0x17b));var _0x6d9b=function(_0x5b7d6a,_0x63e6a2){_0x5b7d6a=_0x5b7d6a-0x0;var _0x992adf=_0xd9b6[_0x5b7d6a];return _0x992adf;};'use strict';var _=require(_0x6d9b('0x0'));var utils=require(_0x6d9b('0x1'));var logger=require(_0x6d9b('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6d9b('0x3')),'mailMessage':require(_0x6d9b('0x4')),'smsMessage':require(_0x6d9b('0x5')),'faxMessage':require(_0x6d9b('0x6')),'whatsappMessage':require(_0x6d9b('0x7'))};exports[_0x6d9b('0x8')]=function(_0x36d596,_0xc0b369){return function(_0x5525da){try{var _0x2ba696={'body':utils[_0x6d9b('0x9')](_0xc0b369[0x0],this),'ContactId':this[_0x6d9b('0xa')]['id']};if(this[_0x6d9b('0xb')]===_0x6d9b('0xc')){_0x2ba696[_0x6d9b('0xd')]=this[_0x6d9b('0xe')]['id'];}else{_0x2ba696[_['upperFirst'](this[_0x6d9b('0xb')])+_0x6d9b('0xf')]=this[_0x6d9b('0xe')]['id'];}_0x2ba696[_['upperFirst'](this[_0x6d9b('0xb')])+_0x6d9b('0x10')]=this[_0x6d9b('0x11')]['id'];if(rpc[this['channel']+_0x6d9b('0x12')]){return rpc[this[_0x6d9b('0xb')]+_0x6d9b('0x12')]['create'](_0x2ba696)[_0x6d9b('0x13')](function(_0x46775e){logger[_0x6d9b('0x14')](_0x6d9b('0x15'),_0x36d596,_0x2ba696[_0x6d9b('0x16')]);_0x5525da[_0x6d9b('0x17')]();})[_0x6d9b('0x18')](function(_0x22cd2a){logger['error'](_0x6d9b('0x15'),_0x36d596,JSON[_0x6d9b('0x19')](_0x22cd2a));_0x5525da['stop']();});}}catch(_0x544670){logger['error'](_0x6d9b('0x15'),_0x36d596,JSON[_0x6d9b('0x19')](_0x544670));_0x5525da['stop']();}};}; \ 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 3099912..af19153 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 _0x1463=['next','error','stringify','stop','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x570874,_0x2e6708){var _0x38e6be=function(_0x5380eb){while(--_0x5380eb){_0x570874['push'](_0x570874['shift']());}};_0x38e6be(++_0x2e6708);}(_0x1463,0x163));var _0x3146=function(_0x3b1fea,_0x1671cf){_0x3b1fea=_0x3b1fea-0x0;var _0xa3d088=_0x1463[_0x3b1fea];return _0xa3d088;};'use strict';var utils=require('./utils');var logger=require(_0x3146('0x0'))('routing');exports[_0x3146('0x1')]=function(_0x82283a,_0x3e273b){return function(_0x3327ff){try{logger[_0x3146('0x2')](_0x3146('0x3'),_0x82283a,utils[_0x3146('0x4')](_0x3e273b[0x0],this));_0x3327ff[_0x3146('0x5')]();}catch(_0x4bbc43){logger[_0x3146('0x6')](_0x3146('0x3'),_0x82283a,JSON[_0x3146('0x7')](_0x4bbc43));_0x3327ff[_0x3146('0x8')]();}};}; \ No newline at end of file +var _0xbda9=['info','[%s][NOOP]\x20%s','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence'];(function(_0x2312b7,_0xcb96d2){var _0x1fc0ac=function(_0x33cbc8){while(--_0x33cbc8){_0x2312b7['push'](_0x2312b7['shift']());}};_0x1fc0ac(++_0xcb96d2);}(_0xbda9,0x146));var _0x9bda=function(_0x39ce5a,_0x260622){_0x39ce5a=_0x39ce5a-0x0;var _0x46cd9a=_0xbda9[_0x39ce5a];return _0x46cd9a;};'use strict';var utils=require(_0x9bda('0x0'));var logger=require(_0x9bda('0x1'))(_0x9bda('0x2'));exports[_0x9bda('0x3')]=function(_0x1fb8de,_0xd1f5a5){return function(_0x509c19){try{logger[_0x9bda('0x4')](_0x9bda('0x5'),_0x1fb8de,utils['getMustacheRender'](_0xd1f5a5[0x0],this));_0x509c19[_0x9bda('0x6')]();}catch(_0x465fc7){logger[_0x9bda('0x7')](_0x9bda('0x5'),_0x1fb8de,JSON[_0x9bda('0x8')](_0x465fc7));_0x509c19[_0x9bda('0x9')]();}};}; \ 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 ec69cf2..e9f963c 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 _0x200a=['redis','defaults','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone','account','capitalize','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','then','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','ioredis','../../../../config/environment','routing','./strategy'];(function(_0x5d7fa6,_0x3118df){var _0x4eca90=function(_0x27dfab){while(--_0x27dfab){_0x5d7fa6['push'](_0x5d7fa6['shift']());}};_0x4eca90(++_0x3118df);}(_0x200a,0xf8));var _0xa200=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x200a[_0x46428c];return _0x16a677;};'use strict';var schema=require(_0xa200('0x0'));var _=require(_0xa200('0x1'));var util=require('util');var seqqueue=require(_0xa200('0x2'));var moment=require('moment');var Redis=require(_0xa200('0x3'));var config=require(_0xa200('0x4'));var logger=require('../../../../config/logger')(_0xa200('0x5'));var strategy=require(_0xa200('0x6'));config[_0xa200('0x7')]=_[_0xa200('0x8')](config['redis'],{'host':_0xa200('0x9'),'port':0x18eb});var io=require(_0xa200('0xa'))(new Redis(config[_0xa200('0x7')]));var attributes=['id',_0xa200('0xb'),'account',_0xa200('0xc'),_0xa200('0xd'),_0xa200('0xe')];function emit(_0x3a0c93,_0x59d801,_0x3f4eb1){io['to'](_0x3a0c93)[_0xa200('0xf')](_0x59d801,_0x3f4eb1);}function emitChannelQueueInteraction(_0x31a316,_0x1c8933,_0x5711a6,_0x423b38,_0x4ace75,_0x501292,_0x40a257,_0x363060){var _0x301c37=_[_0xa200('0x10')](_0x5711a6);_0x301c37[_0xa200('0xb')]=_0x363060;_0x301c37[_0xa200('0xc')]=_0x1c8933;_0x301c37[_0xa200('0x11')]=_0x423b38;_0x301c37['id']=_0x4ace75;if(_0x501292){attributes['push'](_[_0xa200('0x12')](_0x31a316)+'InteractionId');_0x40a257[util[_0xa200('0x13')](_0xa200('0x14'),_0x31a316)][_0x4ace75]=_['pick'](_0x301c37,attributes);}else{delete _0x40a257[util[_0xa200('0x13')]('%sQueuesWaitingInteractions',_0x31a316)][_0x4ace75];}emit(util['format']('%s:queue:%s',_0x31a316,_0x1c8933),util[_0xa200('0x13')](_0xa200('0x15'),_0x31a316,_0x501292?'save':_0xa200('0x16')),_[_0xa200('0x17')](_0x301c37,attributes));}var rpc={'openchannelQueueReport':require(_0xa200('0x18')),'mailQueueReport':require(_0xa200('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa200('0x1a')),'chatInteraction':require(_0xa200('0x1b')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0xa200('0x1c')),'openchannelInteraction':require(_0xa200('0x1d')),'smsInteraction':require(_0xa200('0x1e')),'whatsappInteraction':require(_0xa200('0x1f'))};var queue=schema({'name':{'type':_0xa200('0x20'),'required':!![],'message':_0xa200('0x21')},'timeout':{'type':_0xa200('0x22'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x1f442e,_0x1d99d2,_0x25a089,_0x103f1f){if(_0x1f442e&&_0x1d99d2&&_0x25a089){_0x1d99d2[_0xa200('0x23')]+=0x1;var _0x5c3efd={'uniqueid':_0x1f442e,'from':_0x25a089[_0xa200('0x24')]?_0x25a089[_0xa200('0x24')][_0xa200('0xd')]:'','joinAt':moment()[_0xa200('0x13')](_0xa200('0x25')),'ContactId':_0x25a089[_0xa200('0x26')]?_0x25a089[_0xa200('0x26')]['id']:null,'ListId':_0x25a089[_0xa200('0x27')]?_0x25a089[_0xa200('0x27')]['id']:null};_0x5c3efd[_['upperFirst'](_0x25a089[_0xa200('0x28')])+_0xa200('0x29')]=_0x1d99d2['id']||null;_0x5c3efd[_[_0xa200('0x2a')](_0x25a089[_0xa200('0x28')])+_0xa200('0x2b')]=_0x25a089[_0xa200('0x2c')]?_0x25a089[_0xa200('0x2c')]['id']:null;_0x5c3efd[_[_0xa200('0x2a')](_0x25a089['channel'])+_0xa200('0x2d')]=_0x25a089[_0xa200('0x2e')]?_0x25a089[_0xa200('0x2e')]['id']:null;_0x5c3efd[_['upperFirst'](_0x25a089[_0xa200('0x28')])+(_0x25a089[_0xa200('0x28')]!==_0xa200('0x2f')?_0xa200('0x30'):_0xa200('0x31'))]=_0x25a089[_0xa200('0x11')]?_0x25a089[_0xa200('0x11')]['id']:null;logger[_0xa200('0x32')](util[_0xa200('0x13')](_0xa200('0x33'),_0x1f442e,_0x1d99d2[_0xa200('0x34')]));emitChannelQueueInteraction(_0x25a089['channel'],_0x1d99d2['name'],_0x5c3efd,_0x25a089[_0xa200('0x11')][_0xa200('0x34')],_0x25a089[_0xa200('0x2e')]['id'],!![],_0x103f1f,_0x1d99d2['id']);if(rpc[_0x25a089[_0xa200('0x28')]+_0xa200('0x35')]){return rpc[_0x25a089[_0xa200('0x28')]+_0xa200('0x35')][_0xa200('0x36')](_0x5c3efd)[_0xa200('0x37')](function(_0x255e34){logger[_0xa200('0x38')]('create\x20queue\x20report',_0x255e34);});}}}function stopRouting(_0x22bb7e,_0x157071,_0xd1dcaa,_0x540d10){if(_0x22bb7e&&_0x157071){_0x157071[_0xa200('0x23')]-=0x1;var _0x54a5c2={'leaveAt':moment()[_0xa200('0x13')](_0xa200('0x25')),'acceptAt':moment()[_0xa200('0x13')](_0xa200('0x25')),'reason':_0xa200('0x39')};logger[_0xa200('0x32')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x22bb7e,_0x157071[_0xa200('0x34')]));emitChannelQueueInteraction(_0xd1dcaa[_0xa200('0x28')],_0x157071['name'],_0xd1dcaa['body'],_0xd1dcaa[_0xa200('0x11')]['name'],_0xd1dcaa[_0xa200('0x2e')]['id'],![],_0x540d10,_0x157071['id']);return rpc[_0xd1dcaa[_0xa200('0x28')]+'Interaction']['update'](_0xd1dcaa[_0xa200('0x2c')]['id'],{'queueId':_0x157071['id']})[_0xa200('0x3a')](function(){if(rpc[_0xd1dcaa['channel']+_0xa200('0x35')]){return rpc[_0xd1dcaa[_0xa200('0x28')]+_0xa200('0x35')][_0xa200('0x3b')](_0x22bb7e,_0x54a5c2)[_0xa200('0x37')](function(_0x132490){logger[_0xa200('0x38')](_0xa200('0x3c'),_0x132490);});}});}}function endRouting(_0x307d6c,_0x2b9950,_0x219461,_0xa15e21){if(_0x307d6c&&_0x2b9950){_0x2b9950[_0xa200('0x23')]-=0x1;var _0x23292={'leaveAt':moment()[_0xa200('0x13')](_0xa200('0x25')),'exitAt':moment()['format'](_0xa200('0x25')),'reason':_0xa200('0x3d')};logger[_0xa200('0x32')](util[_0xa200('0x13')](_0xa200('0x3e'),_0x307d6c,_0x2b9950[_0xa200('0x34')]));emitChannelQueueInteraction(_0x219461['channel'],_0x2b9950['name'],_0x219461[_0xa200('0x24')],_0x219461[_0xa200('0x11')]['name'],_0x219461[_0xa200('0x2e')]['id'],![],_0xa15e21);if(rpc[_0x219461[_0xa200('0x28')]+_0xa200('0x35')]){return rpc[_0x219461[_0xa200('0x28')]+'QueueReport'][_0xa200('0x3b')](_0x307d6c,_0x23292)[_0xa200('0x37')](function(_0x3abd89){logger[_0xa200('0x38')]('update\x20queue\x20report',_0x3abd89);});}}}function handleFindQueue(_0x429acd){return function(_0x2d5cbb){return _0x2d5cbb['name'][_0xa200('0x3f')]()===_0x429acd[_0xa200('0x3f')]();};}exports[_0xa200('0x40')]=function(_0x2355f7,_0x42356b,_0x52a3c8,_0x175de3){return function(_0xfa566a){try{var _0x2321f8={'name':_0x42356b[0x0],'timeout':_0x42356b[0x1]};var _0xce9184=queue[_0xa200('0x0')](_0x2321f8,{'typecast':!![]});if(_0xce9184[_0xa200('0x41')]){logger[_0xa200('0x38')](_0xa200('0x42'),_0x2355f7,_[_0xa200('0x43')](_0xce9184,_0xa200('0x2e'))[_0xa200('0x44')](',\x20'));_0xfa566a[_0xa200('0x45')]();}else{var _0x26600e=_[_0xa200('0x46')](_0x52a3c8[_0x175de3['channel']+_0xa200('0x47')],handleFindQueue(_0x2321f8[_0xa200('0x34')]));if(_0x26600e){startRouting(_0x2355f7,_0x26600e,_0x175de3,_0x52a3c8);var _0x415b20=(_0x26600e[_0xa200('0x3d')]||0xa)*0x3e8;var _0x86f10=(_0x2321f8['timeout']||0x14)*0x3e8;var _0x52fdcf;if(_0x415b20>_0x86f10){_0x86f10=_0x415b20;}var _0x2b1bcf=seqqueue[_0xa200('0x48')](_0x415b20);_0x2b1bcf['id']=_0x2355f7;_0x2b1bcf[_0xa200('0x49')]=_0x415b20;_0x2b1bcf[_0xa200('0x4a')]=_0x86f10;_0x2b1bcf['channel']=_0x175de3[_0xa200('0x28')];_0x52a3c8[_0xa200('0x4b')][_0x2355f7]['on']('end',function(){logger[_0xa200('0x32')](_0xa200('0x4c'),_0x2355f7);stopRouting(_0x2355f7,_0x26600e,_0x175de3,_0x52a3c8);clearTimeout(_0x52fdcf);_0x52fdcf=undefined;_0x2b1bcf[_0xa200('0x4d')](!![]);if(_0x52a3c8['rules'][_0x2355f7]){delete _0x52a3c8[_0xa200('0x4b')][_0x2355f7];}_0xfa566a[_0xa200('0x45')]();});_0x52a3c8[_0xa200('0x4b')][_0x2355f7]['on']('complete',function(){if(_0x52a3c8['rules'][_0x2355f7]){delete _0x52a3c8[_0xa200('0x4b')][_0x2355f7];}});_0x52fdcf=setTimeout(function(){logger[_0xa200('0x32')](_0xa200('0x4e'),_0x2355f7);endRouting(_0x2355f7,_0x26600e,_0x175de3,_0x52a3c8);clearTimeout(_0x52fdcf);_0x2b1bcf[_0xa200('0x4d')](!![]);_0xfa566a[_0xa200('0x4f')]();},_0x86f10);switch(_0x26600e[_0xa200('0x50')]){case _0xa200('0x51'):strategy[_0xa200('0x51')](_0x2b1bcf,_0x26600e,_0x52a3c8,_0x175de3);break;default:strategy[_0xa200('0x52')](_0x2b1bcf,_0x26600e,_0x52a3c8,_0x175de3);}}else{logger[_0xa200('0x38')](_0xa200('0x53'),_0x2355f7,_0x2321f8[_0xa200('0x34')]);_0xfa566a[_0xa200('0x45')]();}}}catch(_0x35ef7e){logger[_0xa200('0x38')]('[%s][QUEUE]\x20%s',_0x2355f7,_0x35ef7e[_0xa200('0x54')]);_0xfa566a[_0xa200('0x45')]();}};}; \ No newline at end of file +var _0x40b7=['QueueId','upperFirst','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','clone','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40b7,0x1f2));var _0x740b=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x40b7[_0x1f9f37];return _0x21c080;};'use strict';var schema=require(_0x740b('0x0'));var _=require(_0x740b('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0x740b('0x2'));var Redis=require('ioredis');var config=require(_0x740b('0x3'));var logger=require(_0x740b('0x4'))(_0x740b('0x5'));var strategy=require(_0x740b('0x6'));config[_0x740b('0x7')]=_[_0x740b('0x8')](config[_0x740b('0x7')],{'host':_0x740b('0x9'),'port':0x18eb});var io=require(_0x740b('0xa'))(new Redis(config[_0x740b('0x7')]));var attributes=['id',_0x740b('0xb'),_0x740b('0xc'),'queue',_0x740b('0xd'),_0x740b('0xe')];function emit(_0x16bc42,_0x27341c,_0x2bc48d){io['to'](_0x16bc42)[_0x740b('0xf')](_0x27341c,_0x2bc48d);}function emitChannelQueueInteraction(_0x11753c,_0x2a1fd5,_0xcd167d,_0x381f7c,_0x12eaa8,_0xe1bce4,_0x35207e,_0x471f29){var _0x5a6d09=_[_0x740b('0x10')](_0xcd167d);_0x5a6d09[_0x740b('0xb')]=_0x471f29;_0x5a6d09['queue']=_0x2a1fd5;_0x5a6d09[_0x740b('0xc')]=_0x381f7c;_0x5a6d09['id']=_0x12eaa8;if(_0xe1bce4){attributes['push'](_['capitalize'](_0x11753c)+_0x740b('0x11'));_0x35207e[util['format'](_0x740b('0x12'),_0x11753c)][_0x12eaa8]=_[_0x740b('0x13')](_0x5a6d09,attributes);}else{delete _0x35207e[util[_0x740b('0x14')]('%sQueuesWaitingInteractions',_0x11753c)][_0x12eaa8];}emit(util[_0x740b('0x14')](_0x740b('0x15'),_0x11753c,_0x2a1fd5),util[_0x740b('0x14')](_0x740b('0x16'),_0x11753c,_0xe1bce4?_0x740b('0x17'):_0x740b('0x18')),_[_0x740b('0x13')](_0x5a6d09,attributes));}var rpc={'openchannelQueueReport':require(_0x740b('0x19')),'mailQueueReport':require(_0x740b('0x1a')),'chatQueueReport':require(_0x740b('0x1b')),'smsQueueReport':require(_0x740b('0x1c')),'faxQueueReport':require(_0x740b('0x1d')),'whatsappQueueReport':require(_0x740b('0x1e')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x740b('0x1f')),'mailInteraction':require(_0x740b('0x20')),'openchannelInteraction':require(_0x740b('0x21')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x740b('0x22'))};var queue=schema({'name':{'type':_0x740b('0x23'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x740b('0x24'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x43b025,_0x16e750,_0x531938,_0x5a973f){if(_0x43b025&&_0x16e750&&_0x531938){_0x16e750[_0x740b('0x25')]+=0x1;var _0x46e799={'uniqueid':_0x43b025,'from':_0x531938[_0x740b('0x26')]?_0x531938[_0x740b('0x26')]['from']:'','joinAt':moment()[_0x740b('0x14')](_0x740b('0x27')),'ContactId':_0x531938[_0x740b('0x28')]?_0x531938[_0x740b('0x28')]['id']:null,'ListId':_0x531938[_0x740b('0x29')]?_0x531938[_0x740b('0x29')]['id']:null};_0x46e799[_['upperFirst'](_0x531938['channel'])+_0x740b('0x2a')]=_0x16e750['id']||null;_0x46e799[_[_0x740b('0x2b')](_0x531938['channel'])+_0x740b('0x11')]=_0x531938[_0x740b('0x2c')]?_0x531938[_0x740b('0x2c')]['id']:null;_0x46e799[_[_0x740b('0x2b')](_0x531938[_0x740b('0x2d')])+_0x740b('0x2e')]=_0x531938[_0x740b('0x2f')]?_0x531938[_0x740b('0x2f')]['id']:null;_0x46e799[_[_0x740b('0x2b')](_0x531938[_0x740b('0x2d')])+(_0x531938[_0x740b('0x2d')]!==_0x740b('0x30')?_0x740b('0x31'):_0x740b('0x32'))]=_0x531938[_0x740b('0xc')]?_0x531938[_0x740b('0xc')]['id']:null;logger['info'](util[_0x740b('0x14')](_0x740b('0x33'),_0x43b025,_0x16e750[_0x740b('0x34')]));emitChannelQueueInteraction(_0x531938[_0x740b('0x2d')],_0x16e750['name'],_0x46e799,_0x531938[_0x740b('0xc')][_0x740b('0x34')],_0x531938[_0x740b('0x2f')]['id'],!![],_0x5a973f,_0x16e750['id']);if(rpc[_0x531938['channel']+_0x740b('0x35')]){return rpc[_0x531938[_0x740b('0x2d')]+_0x740b('0x35')][_0x740b('0x36')](_0x46e799)[_0x740b('0x37')](function(_0x22bd8d){logger[_0x740b('0x38')](_0x740b('0x39'),_0x22bd8d);});}}}function stopRouting(_0x44116d,_0x51a290,_0x10fdd4,_0x37be28){if(_0x44116d&&_0x51a290){_0x51a290[_0x740b('0x25')]-=0x1;var _0x6172cd={'leaveAt':moment()[_0x740b('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x740b('0x14')](_0x740b('0x27')),'reason':'accepted'};logger[_0x740b('0x3a')](util[_0x740b('0x14')](_0x740b('0x3b'),_0x44116d,_0x51a290[_0x740b('0x34')]));emitChannelQueueInteraction(_0x10fdd4[_0x740b('0x2d')],_0x51a290[_0x740b('0x34')],_0x10fdd4[_0x740b('0x26')],_0x10fdd4[_0x740b('0xc')][_0x740b('0x34')],_0x10fdd4[_0x740b('0x2f')]['id'],![],_0x37be28,_0x51a290['id']);return rpc[_0x10fdd4[_0x740b('0x2d')]+_0x740b('0x3c')]['update'](_0x10fdd4[_0x740b('0x2c')]['id'],{'queueId':_0x51a290['id']})[_0x740b('0x3d')](function(){if(rpc[_0x10fdd4[_0x740b('0x2d')]+'QueueReport']){return rpc[_0x10fdd4[_0x740b('0x2d')]+'QueueReport']['update'](_0x44116d,_0x6172cd)['catch'](function(_0xe60fbb){logger[_0x740b('0x38')](_0x740b('0x3e'),_0xe60fbb);});}});}}function endRouting(_0x20a41c,_0x12f48d,_0x1cf650,_0x35ce7d){if(_0x20a41c&&_0x12f48d){_0x12f48d['waiting']-=0x1;var _0x4c988c={'leaveAt':moment()[_0x740b('0x14')](_0x740b('0x27')),'exitAt':moment()[_0x740b('0x14')](_0x740b('0x27')),'reason':_0x740b('0x3f')};logger['info'](util[_0x740b('0x14')](_0x740b('0x40'),_0x20a41c,_0x12f48d[_0x740b('0x34')]));emitChannelQueueInteraction(_0x1cf650[_0x740b('0x2d')],_0x12f48d['name'],_0x1cf650[_0x740b('0x26')],_0x1cf650['account'][_0x740b('0x34')],_0x1cf650[_0x740b('0x2f')]['id'],![],_0x35ce7d);if(rpc[_0x1cf650[_0x740b('0x2d')]+_0x740b('0x35')]){return rpc[_0x1cf650[_0x740b('0x2d')]+'QueueReport'][_0x740b('0x41')](_0x20a41c,_0x4c988c)[_0x740b('0x37')](function(_0x144963){logger[_0x740b('0x38')](_0x740b('0x3e'),_0x144963);});}}}function handleFindQueue(_0x1ec191){return function(_0x300a8a){return _0x300a8a[_0x740b('0x34')]['toLowerCase']()===_0x1ec191[_0x740b('0x42')]();};}exports[_0x740b('0x43')]=function(_0x4dc1d5,_0x203c79,_0x2f011a,_0x40e03c){return function(_0x32d40c){try{var _0xd0398c={'name':_0x203c79[0x0],'timeout':_0x203c79[0x1]};var _0x43783b=queue[_0x740b('0x0')](_0xd0398c,{'typecast':!![]});if(_0x43783b[_0x740b('0x44')]){logger['error']('[%s][QUEUE]\x20%s',_0x4dc1d5,_[_0x740b('0x45')](_0x43783b,_0x740b('0x2f'))[_0x740b('0x46')](',\x20'));_0x32d40c[_0x740b('0x47')]();}else{var _0x1141a5=_[_0x740b('0x48')](_0x2f011a[_0x40e03c[_0x740b('0x2d')]+_0x740b('0x49')],handleFindQueue(_0xd0398c[_0x740b('0x34')]));if(_0x1141a5){startRouting(_0x4dc1d5,_0x1141a5,_0x40e03c,_0x2f011a);var _0x2e3a1f=(_0x1141a5[_0x740b('0x3f')]||0xa)*0x3e8;var _0x28cab5=(_0xd0398c['timeout']||0x14)*0x3e8;var _0x316c2e;if(_0x2e3a1f>_0x28cab5){_0x28cab5=_0x2e3a1f;}var _0x5ec411=seqqueue[_0x740b('0x4a')](_0x2e3a1f);_0x5ec411['id']=_0x4dc1d5;_0x5ec411[_0x740b('0x4b')]=_0x2e3a1f;_0x5ec411[_0x740b('0x4c')]=_0x28cab5;_0x5ec411[_0x740b('0x2d')]=_0x40e03c[_0x740b('0x2d')];_0x2f011a[_0x740b('0x4d')][_0x4dc1d5]['on'](_0x740b('0x4e'),function(){logger[_0x740b('0x3a')](_0x740b('0x4f'),_0x4dc1d5);stopRouting(_0x4dc1d5,_0x1141a5,_0x40e03c,_0x2f011a);clearTimeout(_0x316c2e);_0x316c2e=undefined;_0x5ec411[_0x740b('0x50')](!![]);if(_0x2f011a[_0x740b('0x4d')][_0x4dc1d5]){delete _0x2f011a[_0x740b('0x4d')][_0x4dc1d5];}_0x32d40c['stop']();});_0x2f011a[_0x740b('0x4d')][_0x4dc1d5]['on'](_0x740b('0x51'),function(){if(_0x2f011a[_0x740b('0x4d')][_0x4dc1d5]){delete _0x2f011a[_0x740b('0x4d')][_0x4dc1d5];}});_0x316c2e=setTimeout(function(){logger['info'](_0x740b('0x52'),_0x4dc1d5);endRouting(_0x4dc1d5,_0x1141a5,_0x40e03c,_0x2f011a);clearTimeout(_0x316c2e);_0x5ec411[_0x740b('0x50')](!![]);_0x32d40c[_0x740b('0x53')]();},_0x28cab5);switch(_0x1141a5[_0x740b('0x54')]){case'rrmemory':strategy[_0x740b('0x55')](_0x5ec411,_0x1141a5,_0x2f011a,_0x40e03c);break;default:strategy[_0x740b('0x56')](_0x5ec411,_0x1141a5,_0x2f011a,_0x40e03c);}}else{logger[_0x740b('0x38')](_0x740b('0x57'),_0x4dc1d5,_0xd0398c['name']);_0x32d40c[_0x740b('0x47')]();}}}catch(_0x4a81e2){logger[_0x740b('0x38')](_0x740b('0x58'),_0x4dc1d5,_0x4a81e2[_0x740b('0x59')]);_0x32d40c[_0x740b('0x47')]();}};}; \ 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 e71c974..2aa248b 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 _0xa630=['handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','saveWaitingNotification','showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','lodash','uuid','routing','notificationId','squeue','agent','realtime','push'];(function(_0x2832a2,_0x1e34ea){var _0x2eb3c1=function(_0x1600fd){while(--_0x1600fd){_0x2832a2['push'](_0x2832a2['shift']());}};_0x2eb3c1(++_0x1e34ea);}(_0xa630,0xbe));var _0x0a63=function(_0x29f1e4,_0x428bc7){_0x29f1e4=_0x29f1e4-0x0;var _0x1911b6=_0xa630[_0x29f1e4];return _0x1911b6;};'use strict';var _=require(_0x0a63('0x0'));var uuid=require(_0x0a63('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x0a63('0x2'));var Agent=function(_0x4f6b34,_0xd0a045,_0x506b55,_0x91a747){this[_0x0a63('0x3')]=uuid['v4']();this[_0x0a63('0x4')]=_0x4f6b34;this[_0x0a63('0x5')]=_0xd0a045;this[_0x0a63('0x6')]=_0x506b55;this['routing']=_0x91a747;this[_0x0a63('0x4')][_0x0a63('0x7')](this[_0x0a63('0x8')][_0x0a63('0x9')](this),this[_0x0a63('0xa')][_0x0a63('0x9')](this));this['squeue']['on'](_0x0a63('0xb'),this[_0x0a63('0xa')][_0x0a63('0x9')](this));this[_0x0a63('0x4')]['on'](_0x0a63('0xc'),this[_0x0a63('0xd')][_0x0a63('0x9')](this));};Agent[_0x0a63('0xe')][_0x0a63('0x7')]=function(){this[_0x0a63('0x4')]['push'](this[_0x0a63('0x8')][_0x0a63('0x9')](this),this[_0x0a63('0xa')][_0x0a63('0x9')](this));};Agent['prototype'][_0x0a63('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0x0a63('0xe')][_0x0a63('0x8')]=function(){logger[_0x0a63('0xf')](_0x0a63('0x10'),this[_0x0a63('0x4')]['id'],this[_0x0a63('0x5')]['id']);if(_[_0x0a63('0x11')](this[_0x0a63('0x6')]['agents'][this[_0x0a63('0x5')]['id']])){logger['debug'](_0x0a63('0x12'),this[_0x0a63('0x4')]['id'],this[_0x0a63('0x5')]['id']);setTimeout(this[_0x0a63('0x7')][_0x0a63('0x9')](this),0x3e8);}else{if(this[_0x0a63('0x2')][_0x0a63('0x13')]||util[_0x0a63('0x14')](this[_0x0a63('0x4')]['id'],this[_0x0a63('0x6')][_0x0a63('0x15')][this['agent']['id']],this['squeue'][_0x0a63('0x16')],![])){this['realtime'][_0x0a63('0x15')][this['agent']['id']][_0x0a63('0x17')]=!![];this[_0x0a63('0x6')][_0x0a63('0x15')][this[_0x0a63('0x5')]['id']]['busyQueue']=undefined;util[_0x0a63('0x18')](this['realtime'],this[_0x0a63('0x2')],this[_0x0a63('0x5')],this[_0x0a63('0x4')][_0x0a63('0x16')]);util[_0x0a63('0x19')](this[_0x0a63('0x3')],this[_0x0a63('0x4')]['id'],this[_0x0a63('0x6')]['agents'][this['agent']['id']],null,this['routing']);util['writeLog'](this[_0x0a63('0x4')]['id'],this['realtime']['agents'][this[_0x0a63('0x5')]['id']],_0x0a63('0x1a')+(this[_0x0a63('0x2')][_0x0a63('0x13')]?':FORCED':''));}else{logger[_0x0a63('0xf')](_0x0a63('0x1b'),this[_0x0a63('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x0a63('0x7')][_0x0a63('0x9')](this),0x3e8);}}};Agent[_0x0a63('0xe')][_0x0a63('0xa')]=function(_0x32a52b){if(_[_0x0a63('0x11')](this[_0x0a63('0x6')][_0x0a63('0x15')][this['agent']['id']])){return logger[_0x0a63('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x0a63('0x4')]['id'],this[_0x0a63('0x5')]['id']);}else{logger[_0x0a63('0xf')](_0x0a63('0x1c'),this[_0x0a63('0x4')]['id'],this['agent']['id']);util[_0x0a63('0x1d')](this[_0x0a63('0x3')],this[_0x0a63('0x4')]['id'],this[_0x0a63('0x6')]['agents'][this[_0x0a63('0x5')]['id']],null,this[_0x0a63('0x2')]);this['realtime']['agents'][this[_0x0a63('0x5')]['id']]['busy']=![];this['realtime'][_0x0a63('0x15')][this[_0x0a63('0x5')]['id']]['busyQueue']=undefined;util[_0x0a63('0x1e')](this[_0x0a63('0x6')],this[_0x0a63('0x2')],this[_0x0a63('0x5')],this[_0x0a63('0x4')]['channel']);util['writeLog'](this[_0x0a63('0x4')]['id'],this[_0x0a63('0x6')][_0x0a63('0x15')][this[_0x0a63('0x5')]['id']],_0x32a52b?_0x0a63('0x1f'):_0x0a63('0x20'));}if(!_0x32a52b){setTimeout(this['push'][_0x0a63('0x9')](this),0x3e8);}};function agent(_0x276156,_0x4807b9,_0xf9c6ea,_0x5b62b7){return new Agent(_0x276156,_0x4807b9,_0xf9c6ea,_0x5b62b7);}module['exports']=agent; \ No newline at end of file +var _0xca9e=['handleDrained','prototype','handleTimeout','[%s][AGENT]\x20try\x20with\x20%s','isNil','debug','forcedOwnership','isAgentAvailable','agents','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busy','removeWaitingNotification','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','timeout','drained'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca9e,0x136));var _0xeca9=function(_0x4a4d1b,_0x371bc4){_0x4a4d1b=_0x4a4d1b-0x0;var _0x3486b3=_0xca9e[_0x4a4d1b];return _0x3486b3;};'use strict';var _=require(_0xeca9('0x0'));var uuid=require(_0xeca9('0x1'));var util=require(_0xeca9('0x2'));var logger=require(_0xeca9('0x3'))(_0xeca9('0x4'));var Agent=function(_0x1443e3,_0x8dbabb,_0x2c6185,_0x1b2864){this[_0xeca9('0x5')]=uuid['v4']();this[_0xeca9('0x6')]=_0x1443e3;this[_0xeca9('0x7')]=_0x8dbabb;this[_0xeca9('0x8')]=_0x2c6185;this[_0xeca9('0x4')]=_0x1b2864;this['squeue'][_0xeca9('0x9')](this[_0xeca9('0xa')]['bind'](this),this['handleTimeout'][_0xeca9('0xb')](this));this[_0xeca9('0x6')]['on'](_0xeca9('0xc'),this['handleTimeout'][_0xeca9('0xb')](this));this[_0xeca9('0x6')]['on'](_0xeca9('0xd'),this[_0xeca9('0xe')][_0xeca9('0xb')](this));};Agent[_0xeca9('0xf')]['push']=function(){this[_0xeca9('0x6')][_0xeca9('0x9')](this['handleRun'][_0xeca9('0xb')](this),this['handleTimeout'][_0xeca9('0xb')](this));};Agent[_0xeca9('0xf')]['handleDrained']=function(){this[_0xeca9('0x10')](!![]);};Agent[_0xeca9('0xf')][_0xeca9('0xa')]=function(){logger['debug'](_0xeca9('0x11'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);if(_[_0xeca9('0x12')](this['realtime']['agents'][this[_0xeca9('0x7')]['id']])){logger[_0xeca9('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0xeca9('0x14')]||util[_0xeca9('0x15')](this[_0xeca9('0x6')]['id'],this['realtime'][_0xeca9('0x16')][this['agent']['id']],this['squeue'][_0xeca9('0x17')],![])){this['realtime'][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']]['busy']=!![];this[_0xeca9('0x8')][_0xeca9('0x16')][this['agent']['id']][_0xeca9('0x18')]=undefined;util['saveWaitingNotification'](this[_0xeca9('0x8')],this[_0xeca9('0x4')],this[_0xeca9('0x7')],this['squeue'][_0xeca9('0x17')]);util[_0xeca9('0x19')](this['notificationId'],this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],null,this['routing']);util[_0xeca9('0x1a')](this['squeue']['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],_0xeca9('0x1b')+(this[_0xeca9('0x4')][_0xeca9('0x14')]?_0xeca9('0x1c'):''));}else{logger[_0xeca9('0x13')](_0xeca9('0x1d'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);setTimeout(this[_0xeca9('0x9')][_0xeca9('0xb')](this),0x3e8);}}};Agent[_0xeca9('0xf')][_0xeca9('0x10')]=function(_0x4910a3){if(_['isNil'](this['realtime'][_0xeca9('0x16')][this['agent']['id']])){return logger[_0xeca9('0x13')](_0xeca9('0x1e'),this[_0xeca9('0x6')]['id'],this[_0xeca9('0x7')]['id']);}else{logger[_0xeca9('0x13')](_0xeca9('0x1f'),this['squeue']['id'],this[_0xeca9('0x7')]['id']);util['hideNotification'](this[_0xeca9('0x5')],this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')]['agents'][this[_0xeca9('0x7')]['id']],null,this[_0xeca9('0x4')]);this[_0xeca9('0x8')][_0xeca9('0x16')][this['agent']['id']][_0xeca9('0x20')]=![];this['realtime'][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']][_0xeca9('0x18')]=undefined;util[_0xeca9('0x21')](this[_0xeca9('0x8')],this[_0xeca9('0x4')],this['agent'],this[_0xeca9('0x6')][_0xeca9('0x17')]);util[_0xeca9('0x1a')](this[_0xeca9('0x6')]['id'],this[_0xeca9('0x8')][_0xeca9('0x16')][this[_0xeca9('0x7')]['id']],_0x4910a3?'STOP':_0xeca9('0x22'));}if(!_0x4910a3){setTimeout(this[_0xeca9('0x9')][_0xeca9('0xb')](this),0x3e8);}};function agent(_0x178bd4,_0x3995fd,_0x1eeb0a,_0x576463){return new Agent(_0x178bd4,_0x3995fd,_0x1eeb0a,_0x576463);}module[_0xeca9('0x23')]=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 c6bbb4b..476b04a 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 _0x0b39=['TIMEOUT','removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','isNil','Agents','length','debug','isAgentAvailable','agents','channel','writeLog','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20EMPTY','hideNotification','STOP'];(function(_0x3c93b2,_0x2ae301){var _0x4add9b=function(_0x5e90aa){while(--_0x5e90aa){_0x3c93b2['push'](_0x3c93b2['shift']());}};_0x4add9b(++_0x2ae301);}(_0x0b39,0xa8));var _0x90b3=function(_0x1985fb,_0x15a1b2){_0x1985fb=_0x1985fb-0x0;var _0xfed84c=_0x0b39[_0x1985fb];return _0xfed84c;};'use strict';var _=require(_0x90b3('0x0'));var uuid=require('uuid');var util=require(_0x90b3('0x1'));var logger=require(_0x90b3('0x2'))(_0x90b3('0x3'));var Beepall=function(_0xb36080,_0x48e463,_0x54f68c,_0x476015){this[_0x90b3('0x4')]=uuid['v4']();this[_0x90b3('0x5')]=_0xb36080;this[_0x90b3('0x6')]=_0x48e463;this[_0x90b3('0x7')]=_0x54f68c;this[_0x90b3('0x3')]=_0x476015;this['squeue']['push'](this[_0x90b3('0x8')][_0x90b3('0x9')](this),this[_0x90b3('0xa')][_0x90b3('0x9')](this));this[_0x90b3('0x5')]['on'](_0x90b3('0xb'),this['handleTimeout'][_0x90b3('0x9')](this));this[_0x90b3('0x5')]['on'](_0x90b3('0xc'),this[_0x90b3('0xd')][_0x90b3('0x9')](this));};Beepall[_0x90b3('0xe')][_0x90b3('0xf')]=function(){this[_0x90b3('0x5')][_0x90b3('0xf')](this[_0x90b3('0x8')][_0x90b3('0x9')](this),this[_0x90b3('0xa')][_0x90b3('0x9')](this));};Beepall['prototype'][_0x90b3('0xd')]=function(){this[_0x90b3('0xa')](!![]);};Beepall[_0x90b3('0xe')][_0x90b3('0x8')]=function(){var _0x173777=!![];if(!_[_0x90b3('0x10')](this['queue'])&&!_[_0x90b3('0x10')](this[_0x90b3('0x6')][_0x90b3('0x11')])&&this[_0x90b3('0x6')][_0x90b3('0x11')][_0x90b3('0x12')]>0x0){for(var _0x1b603b=0x0,_0x15743d;_0x1b603b0x0){for(var _0x174d2d=0x0,_0xf98da4;_0x174d2d0x0&&_0x55bf52[_0xd71ef7+_0x896d('0x27')]>=_0x55bf52[_0xd71ef7+_0x896d('0x26')]){writeLog(_0xa41442,_0x55bf52,_0xd71ef7[_0x896d('0x28')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x1ed355,_0x5acbea,_0x49985f,_0x46e762,_0x558921){return sendNotification(!![],_0x1ed355,_0x5acbea,_0x49985f,_0x46e762,_0x558921);};exports['hideNotification']=function(_0x47737c,_0x1914ce,_0x36a04e,_0x2a58a4,_0x2b3d4){return sendNotification(![],_0x47737c,_0x1914ce,_0x36a04e,_0x2a58a4,_0x2b3d4);};exports[_0x896d('0x29')]=function(_0x1428a3,_0x5ecab6,_0x390b16){var _0x3c83a5=_0x5ecab6[_0x896d('0x2a')][_0x896d('0x2b')];if(!_0x3c83a5&&_0x390b16){_0x3c83a5=_0x390b16['id'];}var _0x5c9b94=_[_0x896d('0x2c')](_0x1428a3[_0x5ecab6[_0x896d('0x2d')]+_0x896d('0x2e')],function(_0xc97104){var _0x221545=_[_0x896d('0x2f')](_0x5ecab6[_0x896d('0x2d')])+'InteractionId';return _0xc97104[_0x221545]===_0x5ecab6['interaction']['id'];});if(!_0x5c9b94&&_0x3c83a5&&_0x1428a3['agents'][_0x3c83a5]){_0x5c9b94=_[_0x896d('0x2c')](_0x1428a3['agents'][_0x3c83a5][_0x5ecab6[_0x896d('0x2d')]+_0x896d('0x30')],function(_0x346f0a){return _0x346f0a['id']===_0x5ecab6[_0x896d('0x2a')]['id'];});}return _0x5c9b94;};exports['saveWaitingNotification']=function(_0x272f3e,_0x1d744a,_0x35ad2c,_0x1676f0){if(_0x35ad2c&&_0x35ad2c['id']&&_0x272f3e[_0x896d('0x31')]&&_0x272f3e[_0x896d('0x31')][_0x35ad2c['id']]){_0x272f3e[_0x896d('0x31')][_0x35ad2c['id']][_0x1676f0+_0x896d('0x30')][_0x1d744a[_0x896d('0x17')]['id']]={'id':_0x1d744a[_0x896d('0x2a')]['id']};}};exports[_0x896d('0x32')]=function(_0x3b3e88,_0x214a03,_0x4d7ece,_0x2b3345){if(_0x4d7ece&&_0x4d7ece['id']&&_0x3b3e88[_0x896d('0x31')]&&_0x3b3e88['agents'][_0x4d7ece['id']]){delete _0x3b3e88[_0x896d('0x31')][_0x4d7ece['id']][_0x2b3345+_0x896d('0x30')][_0x214a03[_0x896d('0x17')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file +var _0x46ec=['[%s][QUEUE]\x20%s','message','user:%s','emit','format','notification:%s','save','remove','isAgentAvailable','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','some','channel','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','\x20interaction','name','account','notificationSound','body','queue','getMustacheRender','msg','error'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x46ec,0x145));var _0xc46e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x46ec[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc46e('0x0'));var util=require('util');var utils=require('../utils');var Redis=require(_0xc46e('0x1'));var config=require(_0xc46e('0x2'));var logger=require(_0xc46e('0x3'))(_0xc46e('0x4'));config[_0xc46e('0x5')]=_[_0xc46e('0x6')](config['redis'],{'host':_0xc46e('0x7'),'port':0x18eb});var io=require(_0xc46e('0x8'))(new Redis(config[_0xc46e('0x5')]));function sendNotification(_0x229a7c,_0x5058da,_0x244922,_0x1c7405,_0x4ec314,_0x54de23){var _0x2b1051=_0x54de23||{};var _0x21f421=_0x244922['split']('.');var _0x36a3a3={'uniqueid':_0x5058da,'channel':_0x21f421[0x0],'id':_0x21f421[0x1],'title':_0x21f421[0x0]+_0xc46e('0x9'),'interactionId':_0x21f421[0x2],'queue':_0x4ec314?_0x4ec314[_0xc46e('0xa')]:null,'sound':_0x2b1051[_0xc46e('0xb')][_0xc46e('0xc')],'shake':_0x2b1051[_0xc46e('0xb')]['notificationShake']};try{if(!_0x2b1051[_0xc46e('0xd')]){_0x2b1051['body']={};}if(_0x4ec314){_0x2b1051[_0xc46e('0xd')]['queue']=_0x4ec314;}else if(_0x2b1051[_0xc46e('0xd')][_0xc46e('0xe')]){delete _0x2b1051[_0xc46e('0xd')][_0xc46e('0xe')];}_0x36a3a3['msg']=utils[_0xc46e('0xf')](_0x2b1051[_0xc46e('0xb')]['notificationTemplate'],_0x2b1051);}catch(_0x51affb){_0x36a3a3[_0xc46e('0x10')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xc46e('0x11')](util['format'](_0xc46e('0x12'),_0x5058da,_0x51affb[_0xc46e('0x13')]));}io['to'](util['format'](_0xc46e('0x14'),_0x1c7405['name']))[_0xc46e('0x15')](util[_0xc46e('0x16')](_0xc46e('0x17'),_0x229a7c?_0xc46e('0x18'):_0xc46e('0x19')),_0x36a3a3);}function writeLog(_0x35cf35,_0x216b72,_0xc8e1c2){return logger['debug'](util[_0xc46e('0x16')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x35cf35,_0x216b72[_0xc46e('0xa')],_0xc8e1c2));}exports[_0xc46e('0x1a')]=function(_0x280aed,_0x429e7b,_0x407c99,_0x5f53d0){if(_0x429e7b[_0xc46e('0x1b')]){writeLog(_0x280aed,_0x429e7b,'BUSY');return![];}if(!_0x429e7b[_0xc46e('0x1c')]){writeLog(_0x280aed,_0x429e7b,_0xc46e('0x1d'));return![];}if(_0x429e7b[_0x407c99+_0xc46e('0x1e')]){writeLog(_0x280aed,_0x429e7b,_0xc46e('0x1f'));return![];}if(_0x5f53d0&&_0x429e7b['hasOwnProperty'](_0x407c99+'Capacity')&&_0x429e7b[_0xc46e('0x20')](_0x407c99+_0xc46e('0x21'))){if(_0x429e7b[_0x407c99+'Capacity']>0x0&&_0x429e7b[_0x407c99+_0xc46e('0x21')]>=_0x429e7b[_0x407c99+_0xc46e('0x22')]){writeLog(_0x280aed,_0x429e7b,_0x407c99[_0xc46e('0x23')]()+_0xc46e('0x24'));return![];}}return!![];};exports[_0xc46e('0x25')]=function(_0x59edb9,_0x1731a2,_0x3ab660,_0x9193b4,_0x16a4d8){return sendNotification(!![],_0x59edb9,_0x1731a2,_0x3ab660,_0x9193b4,_0x16a4d8);};exports[_0xc46e('0x26')]=function(_0x5e5ae5,_0x4cc482,_0x348118,_0x5f4125,_0x5b709e){return sendNotification(![],_0x5e5ae5,_0x4cc482,_0x348118,_0x5f4125,_0x5b709e);};exports[_0xc46e('0x27')]=function(_0xe3066a,_0x2d7a88,_0xe91168){var _0x310ade=_0x2d7a88[_0xc46e('0x28')][_0xc46e('0x29')];if(!_0x310ade&&_0xe91168){_0x310ade=_0xe91168['id'];}var _0x1e137a=_[_0xc46e('0x2a')](_0xe3066a[_0x2d7a88[_0xc46e('0x2b')]+'QueuesWaitingInteractions'],function(_0x373d2f){var _0x1b625b=_['capitalize'](_0x2d7a88['channel'])+'InteractionId';return _0x373d2f[_0x1b625b]===_0x2d7a88['interaction']['id'];});if(!_0x1e137a&&_0x310ade&&_0xe3066a[_0xc46e('0x2c')][_0x310ade]){_0x1e137a=_[_0xc46e('0x2a')](_0xe3066a['agents'][_0x310ade][_0x2d7a88[_0xc46e('0x2b')]+_0xc46e('0x2d')],function(_0x5f5cbf){return _0x5f5cbf['id']===_0x2d7a88['interaction']['id'];});}return _0x1e137a;};exports[_0xc46e('0x2e')]=function(_0x8f692f,_0x1c8f26,_0x5b5454,_0x431957){if(_0x5b5454&&_0x5b5454['id']&&_0x8f692f['agents']&&_0x8f692f[_0xc46e('0x2c')][_0x5b5454['id']]){_0x8f692f[_0xc46e('0x2c')][_0x5b5454['id']][_0x431957+'WaitingInteractions'][_0x1c8f26['message']['id']]={'id':_0x1c8f26[_0xc46e('0x28')]['id']};}};exports[_0xc46e('0x2f')]=function(_0x121770,_0x545fad,_0x65a03d,_0x30e04c){if(_0x65a03d&&_0x65a03d['id']&&_0x121770[_0xc46e('0x2c')]&&_0x121770[_0xc46e('0x2c')][_0x65a03d['id']]){delete _0x121770[_0xc46e('0x2c')][_0x65a03d['id']][_0x30e04c+'WaitingInteractions'][_0x545fad['message']['id']];}};exports[_0xc46e('0x30')]=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 588ec55..16f3776 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 _0x732b=['isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','./utils','../../../../config/logger','routing','string','consequence','validate','length','error','map','message','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x4681a0,_0x1d1641){var _0xb5bfe1=function(_0x51c5c3){while(--_0x51c5c3){_0x4681a0['push'](_0x4681a0['shift']());}};_0xb5bfe1(++_0x1d1641);}(_0x732b,0x15a));var _0xb732=function(_0x2348dd,_0x15e41d){_0x2348dd=_0x2348dd-0x0;var _0x2e21ef=_0x732b[_0x2348dd];return _0x2e21ef;};'use strict';var schema=require('validate');var sh=require(_0xb732('0x0'));var _=require('lodash');var utils=require(_0xb732('0x1'));var logger=require(_0xb732('0x2'))(_0xb732('0x3'));var system=schema({'command':{'type':_0xb732('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xb732('0x5')]=function(_0x2e3039,_0x5c3ecf){return function(_0x3d00ce){try{var _0x557e6a={'command':_0x5c3ecf[0x0]};var _0x386d95=system[_0xb732('0x6')](_0x557e6a,{'typecast':!![]});if(_0x386d95[_0xb732('0x7')]){logger[_0xb732('0x8')]('[%s][SYSTEM]\x20%s',_0x2e3039,_[_0xb732('0x9')](_0x386d95,_0xb732('0xa'))[_0xb732('0xb')](',\x20'));logger[_0xb732('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2e3039);_0x3d00ce[_0xb732('0xd')]();}else{var _0x5d67ca=this;var _0x14bdbe=utils['getMustacheRender'](_0x5c3ecf[0x0],this);logger['info'](_0xb732('0xe'),_0x2e3039,_0x14bdbe);sh[_0xb732('0xf')](_['trim'](_0x14bdbe),function(_0x4935da,_0x5a67a4){logger[_0xb732('0xc')](_0xb732('0x10'),_0x2e3039,_0x4935da);if(_0x4935da==0x0){var _0x239c46=_0x5a67a4[_0xb732('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xb732('0x12')](_0x5c3ecf[0x1])||_[_0xb732('0x13')](_0x5c3ecf[0x1])){logger['info'](_0xb732('0x14'),_0x2e3039);_0x5d67ca[_0xb732('0x15')][_0x5c3ecf[0x1]]=_0x239c46;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2e3039,_0x5c3ecf[0x1],_0x239c46);_0x5d67ca[_0xb732('0x15')][_0x5c3ecf[0x1]]=_0x239c46;}}_0x3d00ce['next']();});}}catch(_0x8227a8){logger[_0xb732('0x8')](_0xb732('0x16'),_0x2e3039,_[_0xb732('0x17')](_0x8227a8)?JSON[_0xb732('0x18')](_0x8227a8):_0x8227a8);logger[_0xb732('0xc')](_0xb732('0x19'),_0x2e3039);_0x3d00ce[_0xb732('0xd')]();}};}; \ No newline at end of file +var _0x1782=['error','stringify','shelljs','lodash','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','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','body','next'];(function(_0x5284d1,_0x2f70b3){var _0x5986f6=function(_0x549def){while(--_0x549def){_0x5284d1['push'](_0x5284d1['shift']());}};_0x5986f6(++_0x2f70b3);}(_0x1782,0x188));var _0x2178=function(_0x2deabf,_0x165203){_0x2deabf=_0x2deabf-0x0;var _0x53b5a1=_0x1782[_0x2deabf];return _0x53b5a1;};'use strict';var schema=require('validate');var sh=require(_0x2178('0x0'));var _=require(_0x2178('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x2178('0x2'));var system=schema({'command':{'type':'string','required':!![],'message':_0x2178('0x3')}});exports[_0x2178('0x4')]=function(_0x4a3e99,_0x40f25d){return function(_0x4fddea){try{var _0x18664c={'command':_0x40f25d[0x0]};var _0x38aa85=system[_0x2178('0x5')](_0x18664c,{'typecast':!![]});if(_0x38aa85['length']){logger['error'](_0x2178('0x6'),_0x4a3e99,_[_0x2178('0x7')](_0x38aa85,_0x2178('0x8'))[_0x2178('0x9')](',\x20'));logger[_0x2178('0xa')](_0x2178('0xb'),_0x4a3e99);_0x4fddea['next']();}else{var _0x3558a2=this;var _0x1a356b=utils[_0x2178('0xc')](_0x40f25d[0x0],this);logger['info'](_0x2178('0xd'),_0x4a3e99,_0x1a356b);sh[_0x2178('0xe')](_[_0x2178('0xf')](_0x1a356b),function(_0x4d60a9,_0x41a802){logger['info'](_0x2178('0x10'),_0x4a3e99,_0x4d60a9);if(_0x4d60a9==0x0){var _0x2abe92=_0x41a802[_0x2178('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x2178('0x12')](_0x40f25d[0x1])||_[_0x2178('0x13')](_0x40f25d[0x1])){logger[_0x2178('0xa')](_0x2178('0x14'),_0x4a3e99);_0x3558a2['body'][_0x40f25d[0x1]]=_0x2abe92;}else{logger[_0x2178('0xa')](_0x2178('0x15'),_0x4a3e99,_0x40f25d[0x1],_0x2abe92);_0x3558a2[_0x2178('0x16')][_0x40f25d[0x1]]=_0x2abe92;}}_0x4fddea[_0x2178('0x17')]();});}}catch(_0x3808d7){logger[_0x2178('0x18')](_0x2178('0x6'),_0x4a3e99,_['isObject'](_0x3808d7)?JSON[_0x2178('0x19')](_0x3808d7):_0x3808d7);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4a3e99);_0x4fddea[_0x2178('0x17')]();}};}; \ 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 37d3594..f7ef5c3 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 _0xf800=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','consequence','validate','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','stringify','finally','isObject','lodash','../../rpc/chatInteraction'];(function(_0x52987e,_0x3b84f2){var _0x30fd41=function(_0x390566){while(--_0x390566){_0x52987e['push'](_0x52987e['shift']());}};_0x30fd41(++_0x3b84f2);}(_0xf800,0x132));var _0x0f80=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf800[_0x14add3];return _0x4a174f;};'use strict';var schema=require('validate');var _=require(_0x0f80('0x0'));var rpc={'chatInteraction':require(_0x0f80('0x1')),'openchannelInteraction':require(_0x0f80('0x2')),'smsInteraction':require(_0x0f80('0x3')),'mailInteraction':require(_0x0f80('0x4')),'faxInteraction':require(_0x0f80('0x5')),'whatsappInteraction':require(_0x0f80('0x6'))};var logger=require('../../../../config/logger')(_0x0f80('0x7'));var tag=schema({'tag':{'type':_0x0f80('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x0f80('0x9')]=function(_0x3514fd,_0xf106d4,_0x145f02,_0x39ce35){return function(_0x218eeb){try{var _0x48b671={'tag':_0xf106d4[0x0]};var _0x3c57ac=tag[_0x0f80('0xa')](_0x48b671,{'typecast':!![]});if(_0x3c57ac['length']){logger[_0x0f80('0xb')](_0x0f80('0xc'),_0x3514fd,_[_0x0f80('0xd')](_0x3c57ac,_0x0f80('0xe'))[_0x0f80('0xf')](',\x20'));logger['info'](_0x0f80('0x10'),_0x3514fd);_0x218eeb[_0x0f80('0x11')]();}else{var _0x12b8a1={'ids':[_0xf106d4[0x0]]};if(rpc[_0x39ce35[_0x0f80('0x12')]+'Interaction']){rpc[_0x39ce35[_0x0f80('0x12')]+_0x0f80('0x13')][_0x0f80('0x14')](_0x39ce35['interaction']['id'],_0x12b8a1)[_0x0f80('0x15')](function(_0x3bc846){logger[_0x0f80('0x16')](_0x0f80('0x17'),_0x3514fd,_0xf106d4[0x1],_0x39ce35['channel'],_0x39ce35[_0x0f80('0x18')]['id']);})['catch'](function(_0x449643){logger[_0x0f80('0xb')](_0x0f80('0xc'),_0x3514fd,JSON[_0x0f80('0x19')](_0x449643));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3514fd);})[_0x0f80('0x1a')](function(){_0x218eeb['next']();});}}}catch(_0x5312ad){logger[_0x0f80('0xb')](_0x0f80('0xc'),_0x3514fd,_[_0x0f80('0x1b')](_0x5312ad)?JSON[_0x0f80('0x19')](_0x5312ad):_0x5312ad);logger[_0x0f80('0x16')](_0x0f80('0x10'),_0x3514fd);_0x218eeb[_0x0f80('0x11')]();}};}; \ No newline at end of file +var _0x3110=['length','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','consequence'];(function(_0x74a34,_0x50b2d8){var _0x957f16=function(_0x5d05f4){while(--_0x5d05f4){_0x74a34['push'](_0x74a34['shift']());}};_0x957f16(++_0x50b2d8);}(_0x3110,0x161));var _0x0311=function(_0x46b45b,_0x238500){_0x46b45b=_0x46b45b-0x0;var _0x26131a=_0x3110[_0x46b45b];return _0x26131a;};'use strict';var schema=require(_0x0311('0x0'));var _=require(_0x0311('0x1'));var rpc={'chatInteraction':require(_0x0311('0x2')),'openchannelInteraction':require(_0x0311('0x3')),'smsInteraction':require(_0x0311('0x4')),'mailInteraction':require(_0x0311('0x5')),'faxInteraction':require(_0x0311('0x6')),'whatsappInteraction':require(_0x0311('0x7'))};var logger=require('../../../../config/logger')(_0x0311('0x8'));var tag=schema({'tag':{'type':_0x0311('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x0311('0xa')]=function(_0x533922,_0x111ca2,_0x346a8e,_0x123637){return function(_0x1cf5c5){try{var _0x573a06={'tag':_0x111ca2[0x0]};var _0xf3e5b2=tag[_0x0311('0x0')](_0x573a06,{'typecast':!![]});if(_0xf3e5b2[_0x0311('0xb')]){logger['error'](_0x0311('0xc'),_0x533922,_['map'](_0xf3e5b2,_0x0311('0xd'))[_0x0311('0xe')](',\x20'));logger[_0x0311('0xf')](_0x0311('0x10'),_0x533922);_0x1cf5c5[_0x0311('0x11')]();}else{var _0x40b38f={'ids':[_0x111ca2[0x0]]};if(rpc[_0x123637['channel']+_0x0311('0x12')]){rpc[_0x123637['channel']+'Interaction'][_0x0311('0x13')](_0x123637[_0x0311('0x14')]['id'],_0x40b38f)[_0x0311('0x15')](function(_0xd5cdeb){logger[_0x0311('0xf')](_0x0311('0x16'),_0x533922,_0x111ca2[0x1],_0x123637['channel'],_0x123637[_0x0311('0x14')]['id']);})[_0x0311('0x17')](function(_0x143fd9){logger[_0x0311('0x18')](_0x0311('0xc'),_0x533922,JSON[_0x0311('0x19')](_0x143fd9));logger[_0x0311('0xf')](_0x0311('0x10'),_0x533922);})[_0x0311('0x1a')](function(){_0x1cf5c5[_0x0311('0x11')]();});}}}catch(_0x51b522){logger[_0x0311('0x18')](_0x0311('0xc'),_0x533922,_[_0x0311('0x1b')](_0x51b522)?JSON[_0x0311('0x19')](_0x51b522):_0x51b522);logger[_0x0311('0xf')](_0x0311('0x10'),_0x533922);_0x1cf5c5[_0x0311('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 2d94fb5..fc02bc3 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbdd=['isObject','next','../../../../config/logger','routing','lodash','replace','push','?params=','urlOnRing','title','2.0','method','login','params','stringify','POST','application/json-rpc','then','result','logged','info','stop','catch'];(function(_0x3096b1,_0x4adeeb){var _0x3885e4=function(_0x157e12){while(--_0x157e12){_0x3096b1['push'](_0x3096b1['shift']());}};_0x3885e4(++_0x4adeeb);}(_0xbbdd,0xe8));var _0xdbbd=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xbbdd[_0x1694f5];return _0x5b4321;};'use strict';var rp=require('request-promise');var logger=require(_0xdbbd('0x0'))(_0xdbbd('0x1'));var _=require(_0xdbbd('0x2'));var arr=[];exports['consequence']=function(_0x20246a,_0x131d6e){return function(_0x5acee5){var _0x175e51=_0x131d6e[0xa];var _0x1f8862=_0x131d6e[0xb];var _0x532fb8=_0x131d6e[0xc];var _0x3d2a68=_0x131d6e[0xd];var _0x1d2425=_0x131d6e[0xe];var _0x560518=_0x131d6e[0xf][_0xdbbd('0x3')](/\n/g,'\x20-\x20');var _0x3bc176=_0x131d6e[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x1f8862)){arr[_0xdbbd('0x4')](_0x1f8862);var _0x4b2a28=_0x131d6e[0x3];var _0x19c137=_0x131d6e[0x4];var _0x272a0a=_0x131d6e[0x1];var _0x1083b7=_0x131d6e[0x0];var _0x3f5748={};_0x3f5748['urlOnAnswer']=_0x131d6e[0x8]+_0xdbbd('0x5')+_0x532fb8+'|'+_0x175e51+'|'+_0x3d2a68+'|'+_0x1f8862+'|'+_0x1d2425;_0x3f5748[_0xdbbd('0x6')]=_0x131d6e[0x7]+_0xdbbd('0x5')+_0x532fb8+'|'+_0x175e51+'|'+_0x3d2a68+'|'+_0x1f8862+'|'+_0x1d2425+'|'+_0x560518+'|'+_0x3bc176;_0x3f5748[_0xdbbd('0x7')]=_0x131d6e[0x9];var _0x2d922e={};_0x2d922e['jsonrpc']=_0xdbbd('0x8');_0x2d922e[_0xdbbd('0x9')]=_0xdbbd('0xa');var _0x44466b=[];_0x44466b[_0xdbbd('0x4')](_0x131d6e[0x2]);_0x44466b[_0xdbbd('0x4')](_0x131d6e[0x5]);_0x44466b[_0xdbbd('0x4')](_0x131d6e[0x6]);_0x2d922e[_0xdbbd('0xb')]=_0x44466b;_0x2d922e['id']=0x1;var _0xe86f7=JSON[_0xdbbd('0xc')](_0x2d922e);var _0x420448={'encoding':'utf8','method':_0xdbbd('0xd'),'timeout':0x2710,'url':_0x4b2a28,'headers':{'Content-Type':_0xdbbd('0xe')},'body':_0xe86f7};return rp(_0x420448)[_0xdbbd('0xf')](function(_0x1f638c){const _0xebf497=JSON['parse'](_0x1f638c);if(!_0xebf497[_0xdbbd('0x10')][_0xdbbd('0x11')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x3f0f9f=_0x1f8862;var _0x3a4125='channelId='+_0x272a0a+'&serviceId='+_0x1083b7+'&sessionId='+_0x3f0f9f+'&data='+JSON[_0xdbbd('0xc')](_0x3f5748);var _0x3f2dec=_0x19c137+'?'+_0x3a4125;return rp(_0x3f2dec);})['then'](function(_0xe7b01b){logger[_0xdbbd('0x12')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x20246a,_0xe7b01b);_0x5acee5[_0xdbbd('0x13')]();})[_0xdbbd('0x14')](function(_0x151da2){logger['error']('[%s][TVOX]\x20%s',_0x20246a,_[_0xdbbd('0x15')](_0x151da2)?JSON[_0xdbbd('0xc')](_0x151da2):_0x151da2);_0x5acee5[_0xdbbd('0x13')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x20246a);_0x5acee5[_0xdbbd('0x16')]();}};}; \ No newline at end of file +var _0x3d3c=['push','urlOnAnswer','urlOnRing','?params=','jsonrpc','2.0','method','stringify','POST','application/json-rpc','then','parse','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20'];(function(_0x292a0b,_0x3b2a29){var _0x2f3ccc=function(_0x337cff){while(--_0x337cff){_0x292a0b['push'](_0x292a0b['shift']());}};_0x2f3ccc(++_0x3b2a29);}(_0x3d3c,0x119));var _0xc3d3=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3d3c[_0x5ddb1c];return _0x354adc;};'use strict';var rp=require(_0xc3d3('0x0'));var logger=require(_0xc3d3('0x1'))(_0xc3d3('0x2'));var _=require(_0xc3d3('0x3'));var arr=[];exports[_0xc3d3('0x4')]=function(_0x13e09b,_0x5f3e91){return function(_0x388cb2){var _0x21d3a2=_0x5f3e91[0xa];var _0x67f8d=_0x5f3e91[0xb];var _0x40a64b=_0x5f3e91[0xc];var _0x142c4b=_0x5f3e91[0xd];var _0x4d3861=_0x5f3e91[0xe];var _0xab243c=_0x5f3e91[0xf][_0xc3d3('0x5')](/\n/g,_0xc3d3('0x6'));var _0x2e189d=_0x5f3e91[0x10][_0xc3d3('0x5')](/\n/g,'\x20');if(!arr['includes'](_0x67f8d)){arr[_0xc3d3('0x7')](_0x67f8d);var _0x25cd93=_0x5f3e91[0x3];var _0x28ef2a=_0x5f3e91[0x4];var _0x5464a6=_0x5f3e91[0x1];var _0x590e8e=_0x5f3e91[0x0];var _0x3b1f8e={};_0x3b1f8e[_0xc3d3('0x8')]=_0x5f3e91[0x8]+'?params='+_0x40a64b+'|'+_0x21d3a2+'|'+_0x142c4b+'|'+_0x67f8d+'|'+_0x4d3861;_0x3b1f8e[_0xc3d3('0x9')]=_0x5f3e91[0x7]+_0xc3d3('0xa')+_0x40a64b+'|'+_0x21d3a2+'|'+_0x142c4b+'|'+_0x67f8d+'|'+_0x4d3861+'|'+_0xab243c+'|'+_0x2e189d;_0x3b1f8e['title']=_0x5f3e91[0x9];var _0x2f2a65={};_0x2f2a65[_0xc3d3('0xb')]=_0xc3d3('0xc');_0x2f2a65[_0xc3d3('0xd')]='login';var _0x194b36=[];_0x194b36[_0xc3d3('0x7')](_0x5f3e91[0x2]);_0x194b36[_0xc3d3('0x7')](_0x5f3e91[0x5]);_0x194b36['push'](_0x5f3e91[0x6]);_0x2f2a65['params']=_0x194b36;_0x2f2a65['id']=0x1;var _0x5c143c=JSON[_0xc3d3('0xe')](_0x2f2a65);var _0x3dbfda={'encoding':'utf8','method':_0xc3d3('0xf'),'timeout':0x2710,'url':_0x25cd93,'headers':{'Content-Type':_0xc3d3('0x10')},'body':_0x5c143c};return rp(_0x3dbfda)[_0xc3d3('0x11')](function(_0x30f010){const _0x50d598=JSON[_0xc3d3('0x12')](_0x30f010);if(!_0x50d598['result']['logged']){throw new Error(_0xc3d3('0x13'));}var _0x46ba3b=_0x67f8d;var _0x50ad3d=_0xc3d3('0x14')+_0x5464a6+_0xc3d3('0x15')+_0x590e8e+_0xc3d3('0x16')+_0x46ba3b+_0xc3d3('0x17')+JSON[_0xc3d3('0xe')](_0x3b1f8e);var _0x4d7642=_0x28ef2a+'?'+_0x50ad3d;return rp(_0x4d7642);})['then'](function(_0x1cf6dc){logger['info'](_0xc3d3('0x18'),_0x13e09b,_0x1cf6dc);_0x388cb2[_0xc3d3('0x19')]();})[_0xc3d3('0x1a')](function(_0x44283e){logger[_0xc3d3('0x1b')](_0xc3d3('0x1c'),_0x13e09b,_[_0xc3d3('0x1d')](_0x44283e)?JSON[_0xc3d3('0xe')](_0x44283e):_0x44283e);_0x388cb2['stop']();});}else{logger['info'](_0xc3d3('0x1e'),_0x13e09b);_0x388cb2[_0xc3d3('0x1f')]();}};}; \ 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 f239325..e1c9264 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x494eeb,_0x35f532){var _0x387110=function(_0x1318f0){while(--_0x1318f0){_0x494eeb['push'](_0x494eeb['shift']());}};_0x387110(++_0x35f532);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x63ce8,_0x233104){var _0x1a365b=function(_0x1103bd){while(--_0x1103bd){_0x63ce8['push'](_0x63ce8['shift']());}};_0x1a365b(++_0x233104);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 99e3a59..400b0aa 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 _0x349f=['push','slice','dialogflow','appdata','split','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','condition','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','rules','info','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','lodash','util','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','mail'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0x349f,0xa8));var _0xf349=function(_0x4dfbf2,_0x499fa5){_0x4dfbf2=_0x4dfbf2-0x0;var _0x56dd91=_0x349f[_0x4dfbf2];return _0x56dd91;};'use strict';var _=require(_0xf349('0x0'));var util=require(_0xf349('0x1'));var path=require(_0xf349('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xf349('0x3'));var utils=require(_0xf349('0x4'));var sUtils=require(_0xf349('0x5'));var logger=require(_0xf349('0x6'))(_0xf349('0x7'));var rpc={'openchannelQueueReport':require(_0xf349('0x8')),'mailQueueReport':require(_0xf349('0x9')),'chatQueueReport':require(_0xf349('0xa')),'smsQueueReport':require(_0xf349('0xb')),'faxQueueReport':require(_0xf349('0xc')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xf349('0xd'));function getId(_0x23fb4b,_0x6c6cd2,_0x21a480){return util[_0xf349('0xe')](_0xf349('0xf'),_0x23fb4b,_0x6c6cd2||0x0,_0x21a480||0x0);}function getIntervals(_0x3e2147,_0x5e30ef){var _0x50652e=[];if(!_[_0xf349('0x10')](_0x5e30ef[_0xf349('0x11')])&&!_[_0xf349('0x10')](_0x3e2147[_0x5e30ef[_0xf349('0x11')]])&&!_[_0xf349('0x10')](_0x3e2147[_0x5e30ef['IntervalId']]['Intervals'])){_0x50652e=_['map'](_0x3e2147[_0x5e30ef[_0xf349('0x11')]][_0xf349('0x12')],_0xf349('0x13'));}else if(!_[_0xf349('0x10')](_0x5e30ef[_0xf349('0x13')])){_0x50652e=[_0x5e30ef['interval']];}return _0x50652e;}exports[_0xf349('0x14')]=function(_0x35d833){_0x35d833['rules']={};return new BPromise(function(_0x43b1ff,_0x3de88f){var _0x590f02={'Start':function(_0x358412){var _0x55479f=this;return new Promise(function(_0x401ada,_0x3bc4e4){if(_0x358412){try{var _0x26b561=[];var _0x1e2dcd=getId(_0x358412[_0xf349('0x15')],_0x358412[_0xf349('0x16')]?_0x358412[_0xf349('0x16')]['id']:0x0,_0x358412['interaction']?_0x358412[_0xf349('0x17')]['id']:0x0);var _0x5aec49=sUtils[_0xf349('0x18')](_0x35d833,_0x358412);if(_0x358412[_0xf349('0x19')]||!_0x5aec49&&_0x358412[_0xf349('0x1a')]&&_[_0xf349('0x1b')](_0x358412[_0xf349('0x1a')])&&_0x358412[_0xf349('0x1a')][_0xf349('0x1c')]){for(var _0x104f9b=0x0;_0x104f9b<_0x358412['applications'][_0xf349('0x1c')];_0x104f9b+=0x1){var _0x5eefe2=_0x358412[_0xf349('0x1a')][_0x104f9b];if(fs[_0xf349('0x1d')](path[_0xf349('0x1e')](__dirname,'applications',_0x5eefe2[_0xf349('0x1f')]+_0xf349('0x20')))){var _0x236970=[];switch(_0x5eefe2['app'][_0xf349('0x21')]()){case _0xf349('0x22'):var _0x4d574a=_0x5eefe2['appdata']['split'](',');if(_0x358412[_0xf349('0x15')]===_0xf349('0x23')){_0x236970[_0xf349('0x24')](_0x4d574a[0x0]);_0x236970['push'](_0x4d574a[0x1]);_0x236970[_0xf349('0x24')](_0x4d574a[_0xf349('0x25')](0x2,_0x4d574a[_0xf349('0x1c')])[_0xf349('0x1e')](','));}else{_0x236970[_0xf349('0x24')](_0x4d574a[0x0]);_0x236970[_0xf349('0x24')](_0x4d574a[_0xf349('0x25')](0x1,_0x4d574a[_0xf349('0x1c')])[_0xf349('0x1e')](','));}break;case _0xf349('0x26'):var _0x403816=_0x5eefe2[_0xf349('0x27')][_0xf349('0x28')](',');_0x236970[_0xf349('0x24')](_0x403816[0x0]);_0x236970['push'](_0x403816[0x1]);_0x236970['push'](_0x403816['slice'](0x2,_0x403816['length'])[_0xf349('0x1e')](','));break;case'dialogflowv2':var _0x1bd380=_0x5eefe2['appdata']['split'](',');_0x236970['push'](_0x1bd380[0x0]);_0x236970['push'](_0x1bd380[0x1]);_0x236970[_0xf349('0x24')](_0x1bd380[0x2]);_0x236970[_0xf349('0x24')](_0x1bd380[0x3]);_0x236970[_0xf349('0x24')](_0x1bd380[_0xf349('0x25')](0x4,_0x1bd380[_0xf349('0x1c')])['join'](','));break;case'amazonlex':var _0x2c0f9c=_0x5eefe2[_0xf349('0x27')][_0xf349('0x28')](',');_0x236970[_0xf349('0x24')](_0x2c0f9c[0x0]);_0x236970[_0xf349('0x24')](_0x2c0f9c[0x1]);_0x236970['push'](_0x2c0f9c[0x2]);_0x236970[_0xf349('0x24')](_0x2c0f9c[0x3]);_0x236970[_0xf349('0x24')](_0x2c0f9c['slice'](0x4,_0x2c0f9c['length'])['join'](','));break;case _0xf349('0x16'):_0x236970[_0xf349('0x24')](_0x5eefe2[_0xf349('0x27')]);break;case'tag':_0x236970[_0xf349('0x24')](_0x5eefe2[_0xf349('0x29')]);_0x236970[_0xf349('0x24')](_0x5eefe2[_0xf349('0x27')]);break;case _0xf349('0x2a'):var _0x5eae93=utils[_0xf349('0x2b')](_0x358412['account'][_0xf349('0x2c')],_0x358412);var _0x3b44bc=_0x5eefe2[_0xf349('0x27')][_0xf349('0x28')](',');_0x236970[_0xf349('0x24')](_0x3b44bc[0x0]);_0x236970[_0xf349('0x24')](_0x3b44bc[0x1]);_0x236970[_0xf349('0x24')](_0x3b44bc[0x2]);_0x236970['push'](_0x3b44bc[0x3]);_0x236970['push'](_0x3b44bc[0x4]);_0x236970['push'](_0x3b44bc[0x5]);_0x236970[_0xf349('0x24')](_0x3b44bc[0x6]);_0x236970[_0xf349('0x24')](_0x3b44bc[0x7]);_0x236970['push'](_0x3b44bc[0x8]);_0x236970[_0xf349('0x24')](_0x3b44bc[0x9]);_0x236970[_0xf349('0x24')](_0x3b44bc[0xa]);_0x236970['push'](_0x358412[_0xf349('0x17')]['id']);_0x236970[_0xf349('0x24')](_0x358412[_0xf349('0x16')]['id']);_0x236970[_0xf349('0x24')](_0x5eefe2[_0xf349('0x2d')]);_0x236970[_0xf349('0x24')](_0x358412['interaction'][_0xf349('0x2e')]);_0x236970['push'](_0x358412['body'][_0xf349('0x2f')]);_0x236970[_0xf349('0x24')](_0x5eae93);break;default:_0x236970=_[_0xf349('0x10')](_0x5eefe2[_0xf349('0x27')])?[]:_0x5eefe2['appdata'][_0xf349('0x28')](',');}var _0x25af45={'id':util['format'](_0xf349('0x30'),_0x1e2dcd,_0x5eefe2['id'],_0x5eefe2['app']),'condition':require('./interval')[_0xf349('0x31')](_0x1e2dcd,getIntervals(_0x35d833['intervals'],_0x5eefe2),_0x35d833),'consequence':require(_0xf349('0x32')+_0x5eefe2['app'])[_0xf349('0x33')](_0x1e2dcd,_0x236970,_0x35d833,_0x358412),'p':_0x5eefe2[_0xf349('0x34')]||0x0};logger['info'](_0xf349('0x35'),_0x25af45['id'],_0xf349('0x36'),getIntervals(_0x35d833[_0xf349('0x37')],_0x5eefe2)['join'](_0xf349('0x38')));_0x26b561[_0xf349('0x24')](_0x25af45);}else{logger[_0xf349('0x39')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xf349('0x1e')](__dirname,_0xf349('0x1a'),_0x5eefe2[_0xf349('0x1f')]+_0xf349('0x20')));}}_0x35d833[_0xf349('0x3a')][_0x1e2dcd]=new RuleEngine(_0x26b561);_0x35d833[_0xf349('0x3a')][_0x1e2dcd]['execute'](_0x358412,function(_0x4351d7){logger[_0xf349('0x3b')]('Applications\x20executed',JSON[_0xf349('0x3c')](_0x4351d7[_0xf349('0x3d')]));if(_0x35d833[_0xf349('0x3a')][_0x1e2dcd]){_0x35d833[_0xf349('0x3a')][_0x1e2dcd][_0xf349('0x3e')]('complete');}});return _0x401ada({'code':0xc8,'message':_0x358412});}else{if(_0x5aec49){logger[_0xf349('0x3b')](util[_0xf349('0xe')](_0xf349('0x3f'),_0x1e2dcd));}else{logger[_0xf349('0x3b')](_0xf349('0x40'));}return _0x401ada({'code':0xc8,'message':_0x358412});}}catch(_0x4a3cd9){logger['error'](_0x4a3cd9['stack']);return _0x3bc4e4(_0x55479f['error'](0x1f4,_0x4a3cd9));}}return _0x3bc4e4(_0xf349('0x41'));});},'AcceptMessage':function(_0x1c6cfe){var _0x423657=this;return new Promise(function(_0x3417a6,_0x18e3fe){if(_0x1c6cfe[_0xf349('0x42')]&&_0x1c6cfe[_0xf349('0x42')]['id']){if(_0x35d833[_0xf349('0x43')][_0x1c6cfe[_0xf349('0x42')]['id']]){_0x35d833[_0xf349('0x43')][_0x1c6cfe['agent']['id']]['busy']=![];_0x35d833[_0xf349('0x43')][_0x1c6cfe['agent']['id']][_0xf349('0x44')]=undefined;}}if(_0x1c6cfe[_0xf349('0x16')]&&_0x1c6cfe[_0xf349('0x16')]['id']){try{var _0x465ca7=getId(_0x1c6cfe['channel'],_0x1c6cfe[_0xf349('0x16')]?_0x1c6cfe[_0xf349('0x16')]['id']:0x0,_0x1c6cfe[_0xf349('0x17')]?_0x1c6cfe[_0xf349('0x17')]['id']:0x0);if(_0x35d833[_0xf349('0x3a')][_0x465ca7]){_0x35d833[_0xf349('0x3a')][_0x465ca7][_0xf349('0x3e')](_0xf349('0x45'));if(rpc[_0x1c6cfe['channel']+_0xf349('0x46')]){rpc[_0x1c6cfe[_0xf349('0x15')]+_0xf349('0x46')][_0xf349('0x47')](_0x465ca7,{'UserId':_0x1c6cfe[_0xf349('0x16')]['UserId']})[_0xf349('0x48')](function(){logger[_0xf349('0x39')](_0xf349('0x49'));});}}return _0x3417a6({'code':0xc8,'message':_0x1c6cfe});}catch(_0x220241){logger[_0xf349('0x39')](_0x220241[_0xf349('0x4a')]);return _0x18e3fe(_0x423657[_0xf349('0x39')](0x1f4,_0x220241));}}logger[_0xf349('0x39')]('message\x20is\x20empty');return _0x18e3fe(_0x423657['error'](0x1f4,_0xf349('0x4b')));});},'RejectMessage':function(_0x4d9fa8){var _0x37d6be=this;return new Promise(function(_0x3e497d,_0x40e760){if(_0x4d9fa8[_0xf349('0x42')]&&_0x4d9fa8[_0xf349('0x42')]['id']){try{if(_0x35d833[_0xf349('0x43')][_0x4d9fa8[_0xf349('0x42')]['id']]){_0x35d833['agents'][_0x4d9fa8['agent']['id']]['busy']=![];_0x35d833[_0xf349('0x43')][_0x4d9fa8[_0xf349('0x42')]['id']]['busyQueue']=undefined;}return _0x3e497d({'code':0xc8,'message':_0x4d9fa8});}catch(_0x53e7dc){logger[_0xf349('0x39')](_0x53e7dc[_0xf349('0x4a')]);return _0x40e760(_0x37d6be['error'](0x1f4,_0x53e7dc));}}logger[_0xf349('0x39')](_0xf349('0x4b'));return _0x40e760(_0x37d6be[_0xf349('0x39')](0x1f4,_0xf349('0x4b')));});},'AbandonInteraction':function(_0x1f5e01){var _0x1140df=this;return new Promise(function(_0xece401,_0x3d6b95){if(_0x1f5e01[_0xf349('0x15')]&&_0x1f5e01['interaction']&&_0x1f5e01['interaction']['id']){try{var _0x682854=getId(_0x1f5e01['channel'],_0x1f5e01['message']?_0x1f5e01[_0xf349('0x16')]['id']:0x0,_0x1f5e01[_0xf349('0x17')]?_0x1f5e01[_0xf349('0x17')]['id']:0x0);if(_0x35d833[_0xf349('0x3a')][_0x682854]){_0x35d833['rules'][_0x682854]['emit'](_0xf349('0x45'));}return _0xece401({'code':0xc8,'message':_0x1f5e01});}catch(_0x5752a9){logger[_0xf349('0x39')](_0x5752a9['stack']);return _0x3d6b95(_0x1140df[_0xf349('0x39')](0x1f4,_0x5752a9));}}logger[_0xf349('0x39')](_0xf349('0x4b'));return _0x3d6b95(_0x1140df[_0xf349('0x39')](0x1f4,_0xf349('0x4b')));});},'AgentCapacity':function(_0x2df135){var _0x1fdcbe=this;return new Promise(function(_0x125d26,_0x3a1ed0){if(_0x35d833[_0xf349('0x43')][_0xf349('0x4c')](_0x2df135['id'])){for(var _0x59d6e5 in _0x2df135['capacity']){if(_0x2df135[_0xf349('0x4d')][_0xf349('0x4c')](_0x59d6e5)){if(_0x35d833['agents'][_0x2df135['id']][_0xf349('0x4c')](_0x59d6e5+_0xf349('0x4e'))){_0x35d833[_0xf349('0x43')][_0x2df135['id']][_0x59d6e5+'CurrentCapacity']=parseInt(_0x2df135['capacity'][_0x59d6e5],0xa);}}}_0x35d833[_0xf349('0x43')][_0x2df135['id']][_0xf349('0x4f')]();return _0x125d26({'code':0xc8,'message':_0x35d833[_0xf349('0x43')][_0x2df135['id']]});}else{return _0x3a1ed0(_0x1fdcbe[_0xf349('0x39')](0x1f4,_0xf349('0x50')));}});},'Agents':function(_0x3ab664){return new Promise(function(_0x1a1336){var _0x3586f8=_[_0xf349('0x51')](_0x35d833[_0xf349('0x43')]);if(_0x3ab664&&_0x3ab664['id']){var _0x1809a4=_[_0xf349('0x52')](_0x3586f8,function(_0x209a0e){return _0x209a0e['id']===_0x3ab664['id'];});_0x1a1336(_0x1809a4);}else{_0x1a1336({'count':_0x3586f8[_0xf349('0x1c')],'rows':_0x3586f8});}});},'ChatQueues':function(){return new Promise(function(_0x53b904){var _0x1e695d=[];for(var _0x2e09a9 in _0x35d833[_0xf349('0x53')]){if(_0x35d833[_0xf349('0x53')][_0xf349('0x4c')](_0x2e09a9)){var _0x349261=_0x35d833[_0xf349('0x53')][_0x2e09a9];var _0x3e8bc4={'id':_0x349261['id'],'available':_0x349261[_0xf349('0x54')],'loggedIn':_0x349261['loggedIn'],'name':_0x349261[_0xf349('0x55')],'paused':_0x349261[_0xf349('0x56')],'waiting':_0x349261[_0xf349('0x57')]};_0x1e695d['push'](_0x3e8bc4);}}_0x53b904({'count':_0x1e695d['length'],'rows':_0x1e695d});});},'MailQueues':function(){return new Promise(function(_0x5bd91e){var _0x4e39be=[];for(var _0x167609 in _0x35d833[_0xf349('0x58')]){if(_0x35d833['mailQueues'][_0xf349('0x4c')](_0x167609)){var _0x1f126b=_0x35d833['mailQueues'][_0x167609];var _0x32669c={'id':_0x1f126b['id'],'available':_0x1f126b[_0xf349('0x54')],'loggedIn':_0x1f126b[_0xf349('0x59')],'name':_0x1f126b[_0xf349('0x55')],'paused':_0x1f126b[_0xf349('0x56')],'waiting':_0x1f126b[_0xf349('0x57')]};_0x4e39be[_0xf349('0x24')](_0x32669c);}}_0x5bd91e({'count':_0x4e39be[_0xf349('0x1c')],'rows':_0x4e39be});});},'OpenchannelQueues':function(){return new Promise(function(_0x4cc303){var _0x2da03f=[];for(var _0x1ec710 in _0x35d833['openchannelQueues']){if(_0x35d833[_0xf349('0x5a')][_0xf349('0x4c')](_0x1ec710)){var _0x49255f=_0x35d833[_0xf349('0x5a')][_0x1ec710];var _0x3c0efc={'id':_0x49255f['id'],'available':_0x49255f[_0xf349('0x54')],'loggedIn':_0x49255f[_0xf349('0x59')],'name':_0x49255f[_0xf349('0x55')],'paused':_0x49255f[_0xf349('0x56')],'waiting':_0x49255f[_0xf349('0x57')]};_0x2da03f[_0xf349('0x24')](_0x3c0efc);}}_0x4cc303({'count':_0x2da03f['length'],'rows':_0x2da03f});});},'SmsQueues':function(){return new Promise(function(_0x2838a4){var _0xff3eeb=[];for(var _0x247af4 in _0x35d833[_0xf349('0x5b')]){if(_0x35d833[_0xf349('0x5b')][_0xf349('0x4c')](_0x247af4)){var _0x62f4be=_0x35d833[_0xf349('0x5b')][_0x247af4];var _0x52c735={'id':_0x62f4be['id'],'available':_0x62f4be[_0xf349('0x54')],'loggedIn':_0x62f4be['loggedIn'],'name':_0x62f4be[_0xf349('0x55')],'paused':_0x62f4be[_0xf349('0x56')],'waiting':_0x62f4be[_0xf349('0x57')]};_0xff3eeb[_0xf349('0x24')](_0x52c735);}}_0x2838a4({'count':_0xff3eeb[_0xf349('0x1c')],'rows':_0xff3eeb});});},'FaxQueues':function(){return new Promise(function(_0x4f1493){var _0x4c06fc=[];for(var _0x3401e4 in _0x35d833[_0xf349('0x5c')]){if(_0x35d833['faxQueues'][_0xf349('0x4c')](_0x3401e4)){var _0x567a16=_0x35d833['faxQueues'][_0x3401e4];var _0x2b09a3={'id':_0x567a16['id'],'available':_0x567a16['available'],'loggedIn':_0x567a16[_0xf349('0x59')],'name':_0x567a16[_0xf349('0x55')],'paused':_0x567a16[_0xf349('0x56')],'waiting':_0x567a16[_0xf349('0x57')]};_0x4c06fc['push'](_0x2b09a3);}}_0x4f1493({'count':_0x4c06fc[_0xf349('0x1c')],'rows':_0x4c06fc});});},'WhatsappQueues':function(){return new Promise(function(_0x2dc232){var _0x2df60e=[];for(var _0x1d062b in _0x35d833[_0xf349('0x5d')]){if(_0x35d833[_0xf349('0x5d')][_0xf349('0x4c')](_0x1d062b)){var _0x5e792b=_0x35d833['whatsappQueues'][_0x1d062b];var _0x2e23a3={'id':_0x5e792b['id'],'available':_0x5e792b['available'],'loggedIn':_0x5e792b[_0xf349('0x59')],'name':_0x5e792b['name'],'paused':_0x5e792b['paused'],'waiting':_0x5e792b['waiting']};_0x2df60e[_0xf349('0x24')](_0x2e23a3);}}_0x2dc232({'count':_0x2df60e[_0xf349('0x1c')],'rows':_0x2df60e});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4ef4bf){var _0x4155e3=_[_0xf349('0x51')](_0x35d833['chatQueuesWaitingInteractions']);_0x4ef4bf({'count':_0x4155e3['length'],'rows':_0x4155e3});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3df826){var _0x169134=_[_0xf349('0x51')](_0x35d833[_0xf349('0x5e')]);_0x3df826({'count':_0x169134[_0xf349('0x1c')],'rows':_0x169134});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x79b5df){var _0x291362=_['values'](_0x35d833[_0xf349('0x5f')]);_0x79b5df({'count':_0x291362['length'],'rows':_0x291362});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x228627){var _0x3608ce=_['values'](_0x35d833[_0xf349('0x60')]);_0x228627({'count':_0x3608ce[_0xf349('0x1c')],'rows':_0x3608ce});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x2875e8){var _0x1b12b5=_[_0xf349('0x51')](_0x35d833['faxQueuesWaitingInteractions']);_0x2875e8({'count':_0x1b12b5['length'],'rows':_0x1b12b5});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5db289){var _0xaef933=_[_0xf349('0x51')](_0x35d833[_0xf349('0x61')]);_0x5db289({'count':_0xaef933[_0xf349('0x1c')],'rows':_0xaef933});});}};var _0x53f144=jayson[_0xf349('0x62')](_0x590f02)[_0xf349('0x63')]();_0x53f144['on'](_0xf349('0x39'),function(_0x2f2328){logger[_0xf349('0x39')](JSON['stringify'](_0x2f2328));return _0x3de88f(_0x2f2328);});_0x53f144['listen'](0x232c,_0xf349('0x64'),function(){console[_0xf349('0x65')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x43b1ff('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x1a15=['Applications\x20executed','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','QueueReport','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','paused','waiting','mailQueues','loggedIn','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','toLowerCase','appdata','split','mail','push','slice','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','condition','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','execute'];(function(_0x259ce3,_0x5f2daa){var _0x484e89=function(_0x549fde){while(--_0x549fde){_0x259ce3['push'](_0x259ce3['shift']());}};_0x484e89(++_0x5f2daa);}(_0x1a15,0x103));var _0x51a1=function(_0x46df61,_0x4102c0){_0x46df61=_0x46df61-0x0;var _0x40c70e=_0x1a15[_0x46df61];return _0x40c70e;};'use strict';var _=require(_0x51a1('0x0'));var util=require(_0x51a1('0x1'));var path=require(_0x51a1('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x51a1('0x3'));var utils=require(_0x51a1('0x4'));var sUtils=require(_0x51a1('0x5'));var logger=require(_0x51a1('0x6'))(_0x51a1('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x51a1('0x8')),'chatQueueReport':require(_0x51a1('0x9')),'smsQueueReport':require(_0x51a1('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x51a1('0xb'))};var RuleEngine=require(_0x51a1('0xc'));function getId(_0x4f6612,_0x47a3e3,_0x3b8377){return util[_0x51a1('0xd')](_0x51a1('0xe'),_0x4f6612,_0x47a3e3||0x0,_0x3b8377||0x0);}function getIntervals(_0xb8c2c4,_0x4e5c67){var _0xe80c91=[];if(!_['isNil'](_0x4e5c67[_0x51a1('0xf')])&&!_[_0x51a1('0x10')](_0xb8c2c4[_0x4e5c67[_0x51a1('0xf')]])&&!_[_0x51a1('0x10')](_0xb8c2c4[_0x4e5c67[_0x51a1('0xf')]][_0x51a1('0x11')])){_0xe80c91=_[_0x51a1('0x12')](_0xb8c2c4[_0x4e5c67[_0x51a1('0xf')]]['Intervals'],'interval');}else if(!_[_0x51a1('0x10')](_0x4e5c67[_0x51a1('0x13')])){_0xe80c91=[_0x4e5c67[_0x51a1('0x13')]];}return _0xe80c91;}exports[_0x51a1('0x14')]=function(_0x113745){_0x113745['rules']={};return new BPromise(function(_0x3c24ea,_0x492dcd){var _0x532e19={'Start':function(_0x2b73ae){var _0x164cd1=this;return new Promise(function(_0x1b0f32,_0x1b9c36){if(_0x2b73ae){try{var _0x2e654d=[];var _0x411668=getId(_0x2b73ae[_0x51a1('0x15')],_0x2b73ae[_0x51a1('0x16')]?_0x2b73ae[_0x51a1('0x16')]['id']:0x0,_0x2b73ae[_0x51a1('0x17')]?_0x2b73ae[_0x51a1('0x17')]['id']:0x0);var _0x14c5b4=sUtils[_0x51a1('0x18')](_0x113745,_0x2b73ae);if(_0x2b73ae[_0x51a1('0x19')]||!_0x14c5b4&&_0x2b73ae[_0x51a1('0x1a')]&&_[_0x51a1('0x1b')](_0x2b73ae[_0x51a1('0x1a')])&&_0x2b73ae[_0x51a1('0x1a')]['length']){for(var _0x1dbcec=0x0;_0x1dbcec<_0x2b73ae[_0x51a1('0x1a')][_0x51a1('0x1c')];_0x1dbcec+=0x1){var _0xefcf35=_0x2b73ae['applications'][_0x1dbcec];if(fs[_0x51a1('0x1d')](path[_0x51a1('0x1e')](__dirname,'applications',_0xefcf35['app']+'.js'))){var _0x39bf5f=[];switch(_0xefcf35[_0x51a1('0x1f')][_0x51a1('0x20')]()){case'autoreply':var _0x387611=_0xefcf35[_0x51a1('0x21')][_0x51a1('0x22')](',');if(_0x2b73ae[_0x51a1('0x15')]===_0x51a1('0x23')){_0x39bf5f[_0x51a1('0x24')](_0x387611[0x0]);_0x39bf5f[_0x51a1('0x24')](_0x387611[0x1]);_0x39bf5f[_0x51a1('0x24')](_0x387611['slice'](0x2,_0x387611[_0x51a1('0x1c')])[_0x51a1('0x1e')](','));}else{_0x39bf5f[_0x51a1('0x24')](_0x387611[0x0]);_0x39bf5f[_0x51a1('0x24')](_0x387611[_0x51a1('0x25')](0x1,_0x387611[_0x51a1('0x1c')])[_0x51a1('0x1e')](','));}break;case'dialogflow':var _0x1d3385=_0xefcf35[_0x51a1('0x21')][_0x51a1('0x22')](',');_0x39bf5f[_0x51a1('0x24')](_0x1d3385[0x0]);_0x39bf5f[_0x51a1('0x24')](_0x1d3385[0x1]);_0x39bf5f[_0x51a1('0x24')](_0x1d3385[_0x51a1('0x25')](0x2,_0x1d3385[_0x51a1('0x1c')])[_0x51a1('0x1e')](','));break;case _0x51a1('0x26'):var _0x124671=_0xefcf35['appdata'][_0x51a1('0x22')](',');_0x39bf5f[_0x51a1('0x24')](_0x124671[0x0]);_0x39bf5f['push'](_0x124671[0x1]);_0x39bf5f[_0x51a1('0x24')](_0x124671[0x2]);_0x39bf5f[_0x51a1('0x24')](_0x124671[0x3]);_0x39bf5f[_0x51a1('0x24')](_0x124671[_0x51a1('0x25')](0x4,_0x124671[_0x51a1('0x1c')])['join'](','));break;case _0x51a1('0x27'):var _0x104183=_0xefcf35['appdata']['split'](',');_0x39bf5f['push'](_0x104183[0x0]);_0x39bf5f[_0x51a1('0x24')](_0x104183[0x1]);_0x39bf5f[_0x51a1('0x24')](_0x104183[0x2]);_0x39bf5f[_0x51a1('0x24')](_0x104183[0x3]);_0x39bf5f[_0x51a1('0x24')](_0x104183[_0x51a1('0x25')](0x4,_0x104183[_0x51a1('0x1c')])[_0x51a1('0x1e')](','));break;case _0x51a1('0x16'):_0x39bf5f[_0x51a1('0x24')](_0xefcf35[_0x51a1('0x21')]);break;case'tag':_0x39bf5f[_0x51a1('0x24')](_0xefcf35[_0x51a1('0x28')]);_0x39bf5f[_0x51a1('0x24')](_0xefcf35[_0x51a1('0x21')]);break;case _0x51a1('0x29'):var _0x3c4eb8=utils[_0x51a1('0x2a')](_0x2b73ae[_0x51a1('0x2b')]['notificationTemplate'],_0x2b73ae);var _0x180155=_0xefcf35['appdata']['split'](',');_0x39bf5f['push'](_0x180155[0x0]);_0x39bf5f[_0x51a1('0x24')](_0x180155[0x1]);_0x39bf5f[_0x51a1('0x24')](_0x180155[0x2]);_0x39bf5f['push'](_0x180155[0x3]);_0x39bf5f[_0x51a1('0x24')](_0x180155[0x4]);_0x39bf5f[_0x51a1('0x24')](_0x180155[0x5]);_0x39bf5f[_0x51a1('0x24')](_0x180155[0x6]);_0x39bf5f['push'](_0x180155[0x7]);_0x39bf5f['push'](_0x180155[0x8]);_0x39bf5f['push'](_0x180155[0x9]);_0x39bf5f[_0x51a1('0x24')](_0x180155[0xa]);_0x39bf5f[_0x51a1('0x24')](_0x2b73ae[_0x51a1('0x17')]['id']);_0x39bf5f[_0x51a1('0x24')](_0x2b73ae[_0x51a1('0x16')]['id']);_0x39bf5f[_0x51a1('0x24')](_0xefcf35[_0x51a1('0x2c')]);_0x39bf5f[_0x51a1('0x24')](_0x2b73ae[_0x51a1('0x17')][_0x51a1('0x2d')]);_0x39bf5f[_0x51a1('0x24')](_0x2b73ae[_0x51a1('0x2e')]['body']);_0x39bf5f[_0x51a1('0x24')](_0x3c4eb8);break;default:_0x39bf5f=_['isNil'](_0xefcf35['appdata'])?[]:_0xefcf35[_0x51a1('0x21')][_0x51a1('0x22')](',');}var _0xa0e6b1={'id':util[_0x51a1('0xd')]('%s:%s:%s',_0x411668,_0xefcf35['id'],_0xefcf35['app']),'condition':require('./interval')[_0x51a1('0x2f')](_0x411668,getIntervals(_0x113745['intervals'],_0xefcf35),_0x113745),'consequence':require(_0x51a1('0x30')+_0xefcf35[_0x51a1('0x1f')])[_0x51a1('0x31')](_0x411668,_0x39bf5f,_0x113745,_0x2b73ae),'p':_0xefcf35['priority']||0x0};logger[_0x51a1('0x32')](_0x51a1('0x33'),_0xa0e6b1['id'],_0x51a1('0x34'),getIntervals(_0x113745[_0x51a1('0x35')],_0xefcf35)[_0x51a1('0x1e')]('\x20|\x20'));_0x2e654d[_0x51a1('0x24')](_0xa0e6b1);}else{logger[_0x51a1('0x36')](_0x51a1('0x37'),path['join'](__dirname,_0x51a1('0x1a'),_0xefcf35[_0x51a1('0x1f')]+_0x51a1('0x38')));}}_0x113745[_0x51a1('0x39')][_0x411668]=new RuleEngine(_0x2e654d);_0x113745[_0x51a1('0x39')][_0x411668][_0x51a1('0x3a')](_0x2b73ae,function(_0x1832f6){logger[_0x51a1('0x32')](_0x51a1('0x3b'),JSON[_0x51a1('0x3c')](_0x1832f6[_0x51a1('0x3d')]));if(_0x113745['rules'][_0x411668]){_0x113745[_0x51a1('0x39')][_0x411668]['emit'](_0x51a1('0x3e'));}});return _0x1b0f32({'code':0xc8,'message':_0x2b73ae});}else{if(_0x14c5b4){logger[_0x51a1('0x32')](util[_0x51a1('0xd')](_0x51a1('0x3f'),_0x411668));}else{logger[_0x51a1('0x32')](_0x51a1('0x40'));}return _0x1b0f32({'code':0xc8,'message':_0x2b73ae});}}catch(_0x375b59){logger[_0x51a1('0x36')](_0x375b59['stack']);return _0x1b9c36(_0x164cd1[_0x51a1('0x36')](0x1f4,_0x375b59));}}return _0x1b9c36(_0x51a1('0x41'));});},'AcceptMessage':function(_0x5baa67){var _0x2bfb7d=this;return new Promise(function(_0x3d3c1f,_0x337ead){if(_0x5baa67[_0x51a1('0x42')]&&_0x5baa67['agent']['id']){if(_0x113745['agents'][_0x5baa67['agent']['id']]){_0x113745[_0x51a1('0x43')][_0x5baa67['agent']['id']][_0x51a1('0x44')]=![];_0x113745[_0x51a1('0x43')][_0x5baa67[_0x51a1('0x42')]['id']][_0x51a1('0x45')]=undefined;}}if(_0x5baa67['message']&&_0x5baa67[_0x51a1('0x16')]['id']){try{var _0x1fd37b=getId(_0x5baa67[_0x51a1('0x15')],_0x5baa67[_0x51a1('0x16')]?_0x5baa67[_0x51a1('0x16')]['id']:0x0,_0x5baa67[_0x51a1('0x17')]?_0x5baa67[_0x51a1('0x17')]['id']:0x0);if(_0x113745['rules'][_0x1fd37b]){_0x113745[_0x51a1('0x39')][_0x1fd37b][_0x51a1('0x46')]('end');if(rpc[_0x5baa67[_0x51a1('0x15')]+_0x51a1('0x47')]){rpc[_0x5baa67[_0x51a1('0x15')]+'QueueReport']['update'](_0x1fd37b,{'UserId':_0x5baa67[_0x51a1('0x16')][_0x51a1('0x48')]})[_0x51a1('0x49')](function(){logger[_0x51a1('0x36')](_0x51a1('0x4a'));});}}return _0x3d3c1f({'code':0xc8,'message':_0x5baa67});}catch(_0x5d5e55){logger[_0x51a1('0x36')](_0x5d5e55[_0x51a1('0x4b')]);return _0x337ead(_0x2bfb7d['error'](0x1f4,_0x5d5e55));}}logger[_0x51a1('0x36')]('message\x20is\x20empty');return _0x337ead(_0x2bfb7d['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x2bdd45){var _0x5d5772=this;return new Promise(function(_0x194a49,_0x44e7a6){if(_0x2bdd45[_0x51a1('0x42')]&&_0x2bdd45[_0x51a1('0x42')]['id']){try{if(_0x113745[_0x51a1('0x43')][_0x2bdd45['agent']['id']]){_0x113745['agents'][_0x2bdd45[_0x51a1('0x42')]['id']][_0x51a1('0x44')]=![];_0x113745[_0x51a1('0x43')][_0x2bdd45[_0x51a1('0x42')]['id']][_0x51a1('0x45')]=undefined;}return _0x194a49({'code':0xc8,'message':_0x2bdd45});}catch(_0x10c5c5){logger['error'](_0x10c5c5[_0x51a1('0x4b')]);return _0x44e7a6(_0x5d5772['error'](0x1f4,_0x10c5c5));}}logger[_0x51a1('0x36')](_0x51a1('0x4c'));return _0x44e7a6(_0x5d5772[_0x51a1('0x36')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x10d863){var _0x14f582=this;return new Promise(function(_0x376367,_0x414db2){if(_0x10d863[_0x51a1('0x15')]&&_0x10d863[_0x51a1('0x17')]&&_0x10d863[_0x51a1('0x17')]['id']){try{var _0x12c965=getId(_0x10d863['channel'],_0x10d863[_0x51a1('0x16')]?_0x10d863[_0x51a1('0x16')]['id']:0x0,_0x10d863[_0x51a1('0x17')]?_0x10d863['interaction']['id']:0x0);if(_0x113745[_0x51a1('0x39')][_0x12c965]){_0x113745['rules'][_0x12c965][_0x51a1('0x46')](_0x51a1('0x4d'));}return _0x376367({'code':0xc8,'message':_0x10d863});}catch(_0x3fcfc1){logger['error'](_0x3fcfc1[_0x51a1('0x4b')]);return _0x414db2(_0x14f582[_0x51a1('0x36')](0x1f4,_0x3fcfc1));}}logger[_0x51a1('0x36')](_0x51a1('0x4c'));return _0x414db2(_0x14f582[_0x51a1('0x36')](0x1f4,_0x51a1('0x4c')));});},'AgentCapacity':function(_0x211226){var _0x295896=this;return new Promise(function(_0x1b45ed,_0x44d5ba){if(_0x113745['agents'][_0x51a1('0x4e')](_0x211226['id'])){for(var _0x64e725 in _0x211226[_0x51a1('0x4f')]){if(_0x211226[_0x51a1('0x4f')][_0x51a1('0x4e')](_0x64e725)){if(_0x113745[_0x51a1('0x43')][_0x211226['id']]['hasOwnProperty'](_0x64e725+_0x51a1('0x50'))){_0x113745[_0x51a1('0x43')][_0x211226['id']][_0x64e725+_0x51a1('0x50')]=parseInt(_0x211226[_0x51a1('0x4f')][_0x64e725],0xa);}}}_0x113745[_0x51a1('0x43')][_0x211226['id']][_0x51a1('0x51')]();return _0x1b45ed({'code':0xc8,'message':_0x113745[_0x51a1('0x43')][_0x211226['id']]});}else{return _0x44d5ba(_0x295896['error'](0x1f4,_0x51a1('0x52')));}});},'Agents':function(_0x38031c){return new Promise(function(_0x3fe6b6){var _0x2f5a5a=_[_0x51a1('0x53')](_0x113745[_0x51a1('0x43')]);if(_0x38031c&&_0x38031c['id']){var _0xb7f1dc=_[_0x51a1('0x54')](_0x2f5a5a,function(_0x5344e7){return _0x5344e7['id']===_0x38031c['id'];});_0x3fe6b6(_0xb7f1dc);}else{_0x3fe6b6({'count':_0x2f5a5a['length'],'rows':_0x2f5a5a});}});},'ChatQueues':function(){return new Promise(function(_0x4210b1){var _0x3aad12=[];for(var _0x19e80a in _0x113745['chatQueues']){if(_0x113745[_0x51a1('0x55')][_0x51a1('0x4e')](_0x19e80a)){var _0x250b0b=_0x113745['chatQueues'][_0x19e80a];var _0x4f4469={'id':_0x250b0b['id'],'available':_0x250b0b[_0x51a1('0x56')],'loggedIn':_0x250b0b['loggedIn'],'name':_0x250b0b['name'],'paused':_0x250b0b[_0x51a1('0x57')],'waiting':_0x250b0b[_0x51a1('0x58')]};_0x3aad12['push'](_0x4f4469);}}_0x4210b1({'count':_0x3aad12[_0x51a1('0x1c')],'rows':_0x3aad12});});},'MailQueues':function(){return new Promise(function(_0x37d1ae){var _0x986e10=[];for(var _0x2b8ff3 in _0x113745['mailQueues']){if(_0x113745['mailQueues'][_0x51a1('0x4e')](_0x2b8ff3)){var _0x5a7acc=_0x113745[_0x51a1('0x59')][_0x2b8ff3];var _0x5e7a90={'id':_0x5a7acc['id'],'available':_0x5a7acc[_0x51a1('0x56')],'loggedIn':_0x5a7acc[_0x51a1('0x5a')],'name':_0x5a7acc[_0x51a1('0x5b')],'paused':_0x5a7acc[_0x51a1('0x57')],'waiting':_0x5a7acc[_0x51a1('0x58')]};_0x986e10[_0x51a1('0x24')](_0x5e7a90);}}_0x37d1ae({'count':_0x986e10['length'],'rows':_0x986e10});});},'OpenchannelQueues':function(){return new Promise(function(_0x5d19fc){var _0x5b87f1=[];for(var _0x5ec7d2 in _0x113745[_0x51a1('0x5c')]){if(_0x113745[_0x51a1('0x5c')]['hasOwnProperty'](_0x5ec7d2)){var _0x163637=_0x113745[_0x51a1('0x5c')][_0x5ec7d2];var _0x3a774c={'id':_0x163637['id'],'available':_0x163637[_0x51a1('0x56')],'loggedIn':_0x163637['loggedIn'],'name':_0x163637[_0x51a1('0x5b')],'paused':_0x163637[_0x51a1('0x57')],'waiting':_0x163637[_0x51a1('0x58')]};_0x5b87f1[_0x51a1('0x24')](_0x3a774c);}}_0x5d19fc({'count':_0x5b87f1[_0x51a1('0x1c')],'rows':_0x5b87f1});});},'SmsQueues':function(){return new Promise(function(_0x1e649c){var _0x1df768=[];for(var _0x52b12b in _0x113745[_0x51a1('0x5d')]){if(_0x113745[_0x51a1('0x5d')][_0x51a1('0x4e')](_0x52b12b)){var _0x106506=_0x113745['smsQueues'][_0x52b12b];var _0x5e7324={'id':_0x106506['id'],'available':_0x106506[_0x51a1('0x56')],'loggedIn':_0x106506[_0x51a1('0x5a')],'name':_0x106506['name'],'paused':_0x106506['paused'],'waiting':_0x106506[_0x51a1('0x58')]};_0x1df768[_0x51a1('0x24')](_0x5e7324);}}_0x1e649c({'count':_0x1df768[_0x51a1('0x1c')],'rows':_0x1df768});});},'FaxQueues':function(){return new Promise(function(_0x8f50b2){var _0x50de4c=[];for(var _0x36ced6 in _0x113745[_0x51a1('0x5e')]){if(_0x113745[_0x51a1('0x5e')][_0x51a1('0x4e')](_0x36ced6)){var _0x3d4cfb=_0x113745[_0x51a1('0x5e')][_0x36ced6];var _0x44cba7={'id':_0x3d4cfb['id'],'available':_0x3d4cfb['available'],'loggedIn':_0x3d4cfb['loggedIn'],'name':_0x3d4cfb[_0x51a1('0x5b')],'paused':_0x3d4cfb[_0x51a1('0x57')],'waiting':_0x3d4cfb['waiting']};_0x50de4c['push'](_0x44cba7);}}_0x8f50b2({'count':_0x50de4c[_0x51a1('0x1c')],'rows':_0x50de4c});});},'WhatsappQueues':function(){return new Promise(function(_0x3d8c86){var _0x19114b=[];for(var _0x19acac in _0x113745[_0x51a1('0x5f')]){if(_0x113745[_0x51a1('0x5f')][_0x51a1('0x4e')](_0x19acac)){var _0x12cdf9=_0x113745[_0x51a1('0x5f')][_0x19acac];var _0x2638c9={'id':_0x12cdf9['id'],'available':_0x12cdf9['available'],'loggedIn':_0x12cdf9[_0x51a1('0x5a')],'name':_0x12cdf9[_0x51a1('0x5b')],'paused':_0x12cdf9['paused'],'waiting':_0x12cdf9[_0x51a1('0x58')]};_0x19114b[_0x51a1('0x24')](_0x2638c9);}}_0x3d8c86({'count':_0x19114b['length'],'rows':_0x19114b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x59614c){var _0xd163b=_[_0x51a1('0x53')](_0x113745[_0x51a1('0x60')]);_0x59614c({'count':_0xd163b[_0x51a1('0x1c')],'rows':_0xd163b});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1e1477){var _0xc7769d=_[_0x51a1('0x53')](_0x113745['mailQueuesWaitingInteractions']);_0x1e1477({'count':_0xc7769d[_0x51a1('0x1c')],'rows':_0xc7769d});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x559eca){var _0x2f7503=_['values'](_0x113745[_0x51a1('0x61')]);_0x559eca({'count':_0x2f7503[_0x51a1('0x1c')],'rows':_0x2f7503});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4eb032){var _0x379d44=_['values'](_0x113745[_0x51a1('0x62')]);_0x4eb032({'count':_0x379d44['length'],'rows':_0x379d44});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3dbc53){var _0x35207f=_[_0x51a1('0x53')](_0x113745[_0x51a1('0x63')]);_0x3dbc53({'count':_0x35207f[_0x51a1('0x1c')],'rows':_0x35207f});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5ed15a){var _0x567ba7=_[_0x51a1('0x53')](_0x113745[_0x51a1('0x64')]);_0x5ed15a({'count':_0x567ba7['length'],'rows':_0x567ba7});});}};var _0x3177d0=jayson['server'](_0x532e19)[_0x51a1('0x65')]();_0x3177d0['on']('error',function(_0x1ea1e1){logger[_0x51a1('0x36')](JSON[_0x51a1('0x3c')](_0x1ea1e1));return _0x492dcd(_0x1ea1e1);});_0x3177d0[_0x51a1('0x14')](0x232c,_0x51a1('0x66'),function(){console[_0x51a1('0x67')](_0x51a1('0x68'),0x232c);return _0x3c24ea(_0x51a1('0x69')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 267e0be..97b5a43 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 _0xd5fc=['some','info','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','stop','lodash','iftime','../../../config/logger','routing','rules','map'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0xd5fc,0x6a));var _0xcd5f=function(_0x36787a,_0x32cd8a){_0x36787a=_0x36787a-0x0;var _0x3b7557=_0xd5fc[_0x36787a];return _0x3b7557;};'use strict';var _=require(_0xcd5f('0x0'));var iftime=require('../../../utils/iftime')[_0xcd5f('0x1')];var logger=require(_0xcd5f('0x2'))(_0xcd5f('0x3'));exports['condition']=function(_0x49bab3,_0x2f78fc,_0x35aceb){return function(_0xc30a12){if(_0x35aceb[_0xcd5f('0x4')]&&!_0x35aceb[_0xcd5f('0x4')][_0x49bab3]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x49bab3);return _0xc30a12['stop']();}var _0x27dd92=_0x2f78fc[_0xcd5f('0x5')](function(_0x4dce5d){return iftime(_0x4dce5d);});var _0x1be2a2=_[_0xcd5f('0x6')](_0x27dd92);if(_0x1be2a2){logger[_0xcd5f('0x7')](_0xcd5f('0x8'),_0x49bab3,_0x2f78fc[_0xcd5f('0x9')](_0xcd5f('0xa')),_0x1be2a2);_0xc30a12[_0xcd5f('0xb')](_0x1be2a2);}else{logger[_0xcd5f('0x7')](_0xcd5f('0xc'),_0x49bab3,_0x2f78fc['join'](_0xcd5f('0xa')));_0xc30a12[_0xcd5f('0xd')]();}};}; \ No newline at end of file +var _0x1f9b=['rules','info','stop','some','join','\x20|\x20','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','iftime','../../../config/logger','routing','condition'];(function(_0xf820f9,_0x428bac){var _0x53756f=function(_0x717c80){while(--_0x717c80){_0xf820f9['push'](_0xf820f9['shift']());}};_0x53756f(++_0x428bac);}(_0x1f9b,0x11b));var _0xb1f9=function(_0x5d2f5b,_0x84dca7){_0x5d2f5b=_0x5d2f5b-0x0;var _0x3bdae1=_0x1f9b[_0x5d2f5b];return _0x3bdae1;};'use strict';var _=require(_0xb1f9('0x0'));var iftime=require('../../../utils/iftime')[_0xb1f9('0x1')];var logger=require(_0xb1f9('0x2'))(_0xb1f9('0x3'));exports[_0xb1f9('0x4')]=function(_0x17bc2d,_0x46f5c6,_0x3fc1ee){return function(_0x494746){if(_0x3fc1ee[_0xb1f9('0x5')]&&!_0x3fc1ee[_0xb1f9('0x5')][_0x17bc2d]){logger[_0xb1f9('0x6')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x17bc2d);return _0x494746[_0xb1f9('0x7')]();}var _0x4ce5a3=_0x46f5c6['map'](function(_0x77c231){return iftime(_0x77c231);});var _0x3a02e3=_[_0xb1f9('0x8')](_0x4ce5a3);if(_0x3a02e3){logger[_0xb1f9('0x6')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x17bc2d,_0x46f5c6[_0xb1f9('0x9')](_0xb1f9('0xa')),_0x3a02e3);_0x494746['when'](_0x3a02e3);}else{logger[_0xb1f9('0x6')](_0xb1f9('0xb'),_0x17bc2d,_0x46f5c6[_0xb1f9('0x9')]('\x20|\x20'));_0x494746[_0xb1f9('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 299308c..f4e18bd 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 _0x6cb4=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','interface','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','agentacw','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','agentcompleteAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','transfer','blind','transferexten','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfertype','secondtransfererexten','transfertargetuniqueid','hangup','cause'];(function(_0x524cbf,_0x5ef7a5){var _0x32ea21=function(_0x3b7ff9){while(--_0x3b7ff9){_0x524cbf['push'](_0x524cbf['shift']());}};_0x32ea21(++_0x5ef7a5);}(_0x6cb4,0xff));var _0x46cb=function(_0x187016,_0x4dd969){_0x187016=_0x187016-0x0;var _0x505000=_0x6cb4[_0x187016];return _0x505000;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var utils=require(_0x46cb('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3403fc,_0x375bef){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x5'),_0x3403fc[_0x46cb('0x6')],_0x3403fc['channel'],_0x3403fc[_0x46cb('0x7')],_0x3403fc['membername'],_0x3403fc[_0x46cb('0x8')],_0x3403fc['calleridnum'],_0x3403fc[_0x46cb('0x9')],_0x3403fc[_0x46cb('0xa')]));if(_0x3403fc[_0x46cb('0x7')]){utils[_0x46cb('0xb')](_0x3403fc[_0x46cb('0x7')])[_0x46cb('0xc')](function(_0x56258a){if(_0x56258a){_0x3403fc[_0x46cb('0xd')]=_0x56258a[_0x46cb('0xd')];_0x3403fc['agentacw']=_0x3403fc[_0x46cb('0xe')]?_0x56258a[_0x46cb('0xf')]:![];_0x3403fc['acwtime']=_0x3403fc[_0x46cb('0x10')]?_0x56258a[_0x46cb('0x11')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x3403fc);});}else{utils['request'](_0x46cb('0x12'),_0x3403fc);}if(_0x375bef){delete transfers[_0x3403fc[_0x46cb('0x6')]];}else{delete agents[_0x3403fc[_0x46cb('0x13')]];}}exports[_0x46cb('0x14')]=function(_0x553440){try{utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x16'),_0x553440[_0x46cb('0x6')]),_0x553440);agents[_0x553440[_0x46cb('0x13')]]=_0x553440;agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0x17')]=utils[_0x46cb('0x18')]();agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0xa')]=_0x46cb('0x19');agents[_0x553440['destuniqueid']][_0x46cb('0x9')]=null;agents[_0x553440['destuniqueid']][_0x46cb('0x1a')]=null;utils['info'](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x553440[_0x46cb('0x6')],agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0x1b')],_0x553440[_0x46cb('0x13')]));}catch(_0xbd488f){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x16'),_0x553440[_0x46cb('0x6')]),_0xbd488f);}};exports[_0x46cb('0x1d')]=function(_0x149483){try{if(!_[_0x46cb('0x1e')](agents[_0x149483[_0x46cb('0x13')]])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x1f'),_0x149483[_0x46cb('0x6')]),_0x149483);utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x20'),_0x149483[_0x46cb('0x6')],agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0x1b')],_0x149483[_0x46cb('0x13')]));agents[_0x149483[_0x46cb('0x13')]]['agentringnoanswer']=!![];agents[_0x149483['destuniqueid']][_0x46cb('0x21')]=utils[_0x46cb('0x18')]();agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0xa')]=_0x46cb('0x22');agents[_0x149483['destuniqueid']][_0x46cb('0x23')]='timeout';agents[_0x149483['destuniqueid']]['holdtime']=_0x149483[_0x46cb('0x24')]?parseInt(_0x149483[_0x46cb('0x24')])/0x3e8:0x0;agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0x25')]=0x0;unanswered[_0x46cb('0x26')](_0x149483[_0x46cb('0x13')]);}}catch(_0x378dc7){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x1f'),_0x149483[_0x46cb('0x6')]),_0x378dc7);}};exports['queuecallerabandon']=function(_0x1ce88f){try{_[_0x46cb('0x27')](agents,function(_0x4c73bd,_0x49e0bc){if(_0x4c73bd[_0x46cb('0x6')]==_0x1ce88f['uniqueid']&&!_[_0x46cb('0x28')](unanswered,_0x4c73bd[_0x46cb('0x13')])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x29'),_0x1ce88f[_0x46cb('0x6')]),_0x1ce88f);utils['info'](util[_0x46cb('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1ce88f[_0x46cb('0x6')],_0x4c73bd[_0x46cb('0x1b')],_0x4c73bd['destuniqueid']));_0x4c73bd[_0x46cb('0x1d')]=!![];_0x4c73bd[_0x46cb('0x21')]=utils[_0x46cb('0x18')]();_0x4c73bd[_0x46cb('0xa')]=_0x46cb('0x2a');_0x4c73bd['reason']=_0x46cb('0x2a');_0x4c73bd['holdtime']=_0x1ce88f[_0x46cb('0x2b')];_0x4c73bd[_0x46cb('0x25')]=0x0;writeDB(_0x4c73bd);}});}catch(_0x2630e0){utils['error'](util[_0x46cb('0x4')](_0x46cb('0x29'),_0x1ce88f['uniqueid']),_0x2630e0);}};exports[_0x46cb('0x2c')]=function(_0xf8be9){try{if(agents[_0xf8be9[_0x46cb('0x13')]]){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x2d'),_0xf8be9[_0x46cb('0x6')]),_0xf8be9);utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x2e'),_0xf8be9[_0x46cb('0x6')],agents[_0xf8be9['destuniqueid']]['membername'],_0xf8be9['destuniqueid']));agents[_0xf8be9[_0x46cb('0x13')]][_0x46cb('0x2f')]=utils[_0x46cb('0x18')]();agents[_0xf8be9[_0x46cb('0x13')]][_0x46cb('0x9')]=_0xf8be9[_0x46cb('0x9')];agents[_0xf8be9['destuniqueid']][_0x46cb('0x1a')]=_0xf8be9['connectedlinename'];agents[_0xf8be9['destuniqueid']][_0x46cb('0x2b')]=_0xf8be9['ringtime'];agents[_0xf8be9['destuniqueid']][_0x46cb('0xa')]='connect';_['forIn'](agents,function(_0x67bd14,_0x10017d){if(_0x67bd14[_0x46cb('0x13')]!=_0xf8be9[_0x46cb('0x13')]&&_0x67bd14[_0x46cb('0x6')]==_0xf8be9[_0x46cb('0x6')]){_0x67bd14[_0x46cb('0x25')]=0x0;_0x67bd14['holdtime']=_0xf8be9[_0x46cb('0x24')];_0x67bd14['agentringnoanswer']=!![];_0x67bd14[_0x46cb('0x21')]=utils['now']();_0x67bd14[_0x46cb('0xa')]=_0x46cb('0x30');_0x67bd14[_0x46cb('0x23')]='answered_elsewhere';_0x67bd14[_0x46cb('0x31')]=_0xf8be9[_0x46cb('0x13')];_0x67bd14['answeredelsewheremembername']=_0xf8be9[_0x46cb('0x1b')];writeDB(_0x67bd14);}});}}catch(_0x3d0b83){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x2d'),_0xf8be9['uniqueid']),_0x3d0b83);}};exports['agentcomplete']=function(_0x10bada){try{if(!_['isNil'](agents[_0x10bada[_0x46cb('0x13')]])){utils[_0x46cb('0x15')](util['format'](_0x46cb('0x32'),_0x10bada[_0x46cb('0x6')]),_0x10bada);utils[_0x46cb('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x10bada['uniqueid'],agents[_0x10bada['destuniqueid']][_0x46cb('0x1b')],_0x10bada[_0x46cb('0x13')]));agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0xe')]=!![];agents[_0x10bada[_0x46cb('0x13')]]['agentcompleteAt']=utils['now']();agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x25')]=utils['diffTime'](agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x33')],agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x2f')]);agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x23')]=_0x10bada[_0x46cb('0x23')];agents[_0x10bada['destuniqueid']]['lastevent']=_0x46cb('0x34');writeDB(agents[_0x10bada['destuniqueid']]);}}catch(_0x2c4ecb){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')]('[%s][agents][agentcomplete]',_0x10bada[_0x46cb('0x6')]),_0x2c4ecb);}};exports['blindtransfer']=function(_0x5c02c9){try{if(!_[_0x46cb('0x1e')](agents[_0x5c02c9[_0x46cb('0x35')]])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x36'),_0x5c02c9[_0x46cb('0x6')]),_0x5c02c9);utils[_0x46cb('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5c02c9[_0x46cb('0x6')],agents[_0x5c02c9[_0x46cb('0x35')]]['membername'],agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x6')]));agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x37')]=!![];agents[_0x5c02c9[_0x46cb('0x35')]]['transfertype']=_0x46cb('0x38');agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x39')]=_0x5c02c9['extension'];agents[_0x5c02c9[_0x46cb('0x35')]]['transferuniqueid']=agents[_0x5c02c9['transfereruniqueid']][_0x46cb('0x6')];}}catch(_0x2cfe6f){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x36'),_0x5c02c9['uniqueid']),_0x2cfe6f);}};exports[_0x46cb('0x3a')]=function(_0xd51a75){try{utils['debug'](util['format'](_0x46cb('0x3b'),_0xd51a75[_0x46cb('0x3c')]),_0xd51a75);if(_0xd51a75[_0x46cb('0x3c')]==_0xd51a75['origtransfererlinkedid']){if(!_[_0x46cb('0x1e')](agents[_0xd51a75[_0x46cb('0x3d')]])){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x3e'),_0xd51a75[_0x46cb('0x3c')],agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x1b')]));agents[_0xd51a75[_0x46cb('0x3d')]]['transfer']=!![];agents[_0xd51a75[_0x46cb('0x3d')]]['transfertype']=_0x46cb('0x3f');agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x39')]=_0xd51a75[_0x46cb('0x40')];agents[_0xd51a75['secondtransfereruniqueid']][_0x46cb('0x41')]=_0xd51a75[_0x46cb('0x3c')];}if(_0xd51a75[_0x46cb('0x42')]&&agents[_0xd51a75[_0x46cb('0x42')]]){agents[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x43')]=0x1;transfers[_0xd51a75[_0x46cb('0x42')]]=_[_0x46cb('0x44')](agents[_0xd51a75['transfereeuniqueid']]);transfers[_0xd51a75['transfereeuniqueid']]['calleridnum']=agents[_0xd51a75['secondtransfereruniqueid']][_0x46cb('0x45')];transfers[_0xd51a75[_0x46cb('0x42')]]['calleridname']=agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x46')];transfers[_0xd51a75[_0x46cb('0x42')]]['agentcalledAt']=utils['now']();transfers[_0xd51a75[_0x46cb('0x42')]]['agentconnectAt']=utils[_0x46cb('0x18')]();transfers[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x2b')]=0x0;transfers[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x43')]=0x2;}}else if(_0xd51a75[_0x46cb('0x3d')]==_0xd51a75[_0x46cb('0x47')]){if(!_[_0x46cb('0x1e')](agents[_0xd51a75[_0x46cb('0x3c')]])){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x3e'),_0xd51a75[_0x46cb('0x3c')],agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x1b')]));agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x37')]=!![];agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x48')]=_0x46cb('0x3f');agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x39')]=_0xd51a75[_0x46cb('0x49')];agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x41')]=_0xd51a75[_0x46cb('0x3d')];}if(_0xd51a75[_0x46cb('0x4a')]&&agents[_0xd51a75[_0x46cb('0x4a')]]){agents[_0xd51a75['transfertargetuniqueid']][_0x46cb('0x43')]=0x1;transfers[_0xd51a75[_0x46cb('0x4a')]]=_[_0x46cb('0x44')](agents[_0xd51a75[_0x46cb('0x4a')]]);transfers[_0xd51a75[_0x46cb('0x4a')]]['calleridnum']=agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x45')];transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x46')]=agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x46')];transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x17')]=utils['now']();transfers[_0xd51a75['transfertargetuniqueid']]['agentconnectAt']=utils[_0x46cb('0x18')]();transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x2b')]=0x0;transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x43')]=0x2;}}}catch(_0x1e3dca){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x3b'),_0xd51a75[_0x46cb('0x3c')]),_0x1e3dca);}};exports[_0x46cb('0x4b')]=function(_0x199dc0){try{utils[_0x46cb('0x15')](util[_0x46cb('0x4')]('[%s][agents][hangup]',_0x199dc0[_0x46cb('0x6')]),_0x199dc0);if(agents[_0x199dc0['uniqueid']]&&agents[_0x199dc0[_0x46cb('0x6')]]['reason']===_0x46cb('0x22')){if(_0x199dc0[_0x46cb('0x4c')]==='21'){agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')]='rejected';agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]='rejected';}utils['info'](util[_0x46cb('0x4')](_0x46cb('0x4d'),_0x199dc0[_0x46cb('0x6')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x1b')],agents[_0x199dc0['uniqueid']]['reason'],agents[_0x199dc0['uniqueid']][_0x46cb('0xa')]));writeDB(agents[_0x199dc0[_0x46cb('0x6')]]);var _0x30b303=unanswered[_0x46cb('0x4e')](_0x199dc0[_0x46cb('0x6')]);if(_0x30b303>-0x1){unanswered[_0x46cb('0x4f')](_0x30b303,0x1);}}if(transfers[_0x199dc0[_0x46cb('0x6')]]){transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xe')]=!![];transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x33')]=utils['now']();transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x25')]=utils[_0x46cb('0x50')](transfers[_0x199dc0[_0x46cb('0x6')]]['agentcompleteAt'],transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x2f')]);transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')]='agent';transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]=_0x46cb('0x34');utils[_0x46cb('0x3')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x199dc0['uniqueid'],transfers[_0x199dc0[_0x46cb('0x6')]]['membername'],transfers[_0x199dc0[_0x46cb('0x6')]]['reason'],transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]));writeDB(transfers[_0x199dc0[_0x46cb('0x6')]],!![]);}if(agents[_0x199dc0[_0x46cb('0x6')]]&&agents[_0x199dc0['uniqueid']][_0x46cb('0x2f')]){agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xe')]=!![];agents[_0x199dc0[_0x46cb('0x6')]]['agentcompleteAt']=utils['now']();agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x25')]=utils[_0x46cb('0x50')](agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x33')],agents[_0x199dc0[_0x46cb('0x6')]]['agentconnectAt']);agents[_0x199dc0['uniqueid']][_0x46cb('0x23')]=agents[_0x199dc0[_0x46cb('0x6')]]['transfer']?_0x46cb('0x37'):_0x46cb('0x51');agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]=_0x46cb('0x34');utils[_0x46cb('0x3')](util[_0x46cb('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x199dc0[_0x46cb('0x6')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x1b')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]));writeDB(agents[_0x199dc0[_0x46cb('0x6')]]);}}catch(_0x5567cc){utils['error'](util[_0x46cb('0x4')](_0x46cb('0x52'),_0x199dc0[_0x46cb('0x6')]),_0x5567cc);}}; \ No newline at end of file +var _0xd87e=['getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','format','[%s][agents][agentcalled]','uniqueid','destuniqueid','agentcalledAt','now','called','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','[%s][agents][agentringnoanswer]','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','lastevent'];(function(_0x4141a2,_0x363b61){var _0x321f3d=function(_0x24efcf){while(--_0x24efcf){_0x4141a2['push'](_0x4141a2['shift']());}};_0x321f3d(++_0x363b61);}(_0xd87e,0x1bf));var _0xed87=function(_0x53d172,_0x46611b){_0x53d172=_0x53d172-0x0;var _0x1bd0a2=_0xd87e[_0x53d172];return _0x1bd0a2;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x334485,_0x189fdd){utils[_0xed87('0x2')](util['format'](_0xed87('0x3'),_0x334485['uniqueid'],_0x334485[_0xed87('0x4')],_0x334485[_0xed87('0x5')],_0x334485['membername'],_0x334485[_0xed87('0x6')],_0x334485['calleridnum'],_0x334485['connectedlinenum'],_0x334485[_0xed87('0x7')]));if(_0x334485[_0xed87('0x5')]){utils[_0xed87('0x8')](_0x334485[_0xed87('0x5')])['then'](function(_0x191ca1){if(_0x191ca1){_0x334485[_0xed87('0x9')]=_0x191ca1[_0xed87('0x9')];_0x334485[_0xed87('0xa')]=_0x334485[_0xed87('0xb')]?_0x191ca1[_0xed87('0xc')]:![];_0x334485[_0xed87('0xd')]=_0x334485['agentacw']?_0x191ca1[_0xed87('0xe')]:0x0;}utils[_0xed87('0xf')]('CreateVoiceAgentReport',_0x334485);});}else{utils[_0xed87('0xf')](_0xed87('0x10'),_0x334485);}if(_0x189fdd){delete transfers[_0x334485['uniqueid']];}else{delete agents[_0x334485['destuniqueid']];}}exports[_0xed87('0x11')]=function(_0x32276e){try{utils[_0xed87('0x12')](util[_0xed87('0x13')](_0xed87('0x14'),_0x32276e[_0xed87('0x15')]),_0x32276e);agents[_0x32276e['destuniqueid']]=_0x32276e;agents[_0x32276e[_0xed87('0x16')]][_0xed87('0x17')]=utils[_0xed87('0x18')]();agents[_0x32276e[_0xed87('0x16')]][_0xed87('0x7')]=_0xed87('0x19');agents[_0x32276e[_0xed87('0x16')]][_0xed87('0x1a')]=null;agents[_0x32276e[_0xed87('0x16')]]['connectedlinename']=null;utils[_0xed87('0x2')](util[_0xed87('0x13')](_0xed87('0x1b'),_0x32276e[_0xed87('0x15')],agents[_0x32276e['destuniqueid']][_0xed87('0x1c')],_0x32276e[_0xed87('0x16')]));}catch(_0x8920a1){utils[_0xed87('0x1d')](util[_0xed87('0x13')](_0xed87('0x14'),_0x32276e[_0xed87('0x15')]),_0x8920a1);}};exports[_0xed87('0x1e')]=function(_0x3b7981){try{if(!_['isNil'](agents[_0x3b7981['destuniqueid']])){utils['debug'](util['format'](_0xed87('0x1f'),_0x3b7981['uniqueid']),_0x3b7981);utils[_0xed87('0x2')](util[_0xed87('0x13')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x3b7981[_0xed87('0x15')],agents[_0x3b7981['destuniqueid']][_0xed87('0x1c')],_0x3b7981[_0xed87('0x16')]));agents[_0x3b7981[_0xed87('0x16')]][_0xed87('0x1e')]=!![];agents[_0x3b7981[_0xed87('0x16')]]['agentringnoanswerAt']=utils[_0xed87('0x18')]();agents[_0x3b7981[_0xed87('0x16')]][_0xed87('0x7')]=_0xed87('0x20');agents[_0x3b7981[_0xed87('0x16')]][_0xed87('0x21')]=_0xed87('0x20');agents[_0x3b7981[_0xed87('0x16')]][_0xed87('0x22')]=_0x3b7981[_0xed87('0x23')]?parseInt(_0x3b7981[_0xed87('0x23')])/0x3e8:0x0;agents[_0x3b7981[_0xed87('0x16')]][_0xed87('0x24')]=0x0;unanswered[_0xed87('0x25')](_0x3b7981['destuniqueid']);}}catch(_0xb32b1c){utils[_0xed87('0x1d')](util['format'](_0xed87('0x1f'),_0x3b7981[_0xed87('0x15')]),_0xb32b1c);}};exports[_0xed87('0x26')]=function(_0x4b259e){try{_['forIn'](agents,function(_0xd0efba,_0x428b75){if(_0xd0efba[_0xed87('0x15')]==_0x4b259e['uniqueid']&&!_[_0xed87('0x27')](unanswered,_0xd0efba[_0xed87('0x16')])){utils[_0xed87('0x12')](util[_0xed87('0x13')](_0xed87('0x28'),_0x4b259e[_0xed87('0x15')]),_0x4b259e);utils[_0xed87('0x2')](util[_0xed87('0x13')](_0xed87('0x29'),_0x4b259e['uniqueid'],_0xd0efba[_0xed87('0x1c')],_0xd0efba[_0xed87('0x16')]));_0xd0efba['agentringnoanswer']=!![];_0xd0efba[_0xed87('0x2a')]=utils['now']();_0xd0efba[_0xed87('0x7')]=_0xed87('0x2b');_0xd0efba[_0xed87('0x21')]=_0xed87('0x2b');_0xd0efba[_0xed87('0x22')]=_0x4b259e[_0xed87('0x22')];_0xd0efba[_0xed87('0x24')]=0x0;writeDB(_0xd0efba);}});}catch(_0x37a694){utils[_0xed87('0x1d')](util[_0xed87('0x13')](_0xed87('0x28'),_0x4b259e['uniqueid']),_0x37a694);}};exports[_0xed87('0x2c')]=function(_0x167de8){try{if(agents[_0x167de8['destuniqueid']]){utils[_0xed87('0x12')](util['format'](_0xed87('0x2d'),_0x167de8[_0xed87('0x15')]),_0x167de8);utils['info'](util[_0xed87('0x13')](_0xed87('0x2e'),_0x167de8[_0xed87('0x15')],agents[_0x167de8[_0xed87('0x16')]][_0xed87('0x1c')],_0x167de8['destuniqueid']));agents[_0x167de8[_0xed87('0x16')]]['agentconnectAt']=utils[_0xed87('0x18')]();agents[_0x167de8['destuniqueid']][_0xed87('0x1a')]=_0x167de8[_0xed87('0x1a')];agents[_0x167de8[_0xed87('0x16')]][_0xed87('0x2f')]=_0x167de8[_0xed87('0x2f')];agents[_0x167de8[_0xed87('0x16')]][_0xed87('0x22')]=_0x167de8[_0xed87('0x23')];agents[_0x167de8[_0xed87('0x16')]]['lastevent']='connect';_[_0xed87('0x30')](agents,function(_0x206544,_0x1f16a8){if(_0x206544[_0xed87('0x16')]!=_0x167de8[_0xed87('0x16')]&&_0x206544[_0xed87('0x15')]==_0x167de8['uniqueid']){_0x206544[_0xed87('0x24')]=0x0;_0x206544[_0xed87('0x22')]=_0x167de8[_0xed87('0x23')];_0x206544['agentringnoanswer']=!![];_0x206544[_0xed87('0x2a')]=utils[_0xed87('0x18')]();_0x206544[_0xed87('0x7')]=_0xed87('0x31');_0x206544[_0xed87('0x21')]=_0xed87('0x31');_0x206544[_0xed87('0x32')]=_0x167de8[_0xed87('0x16')];_0x206544[_0xed87('0x33')]=_0x167de8[_0xed87('0x1c')];writeDB(_0x206544);}});}}catch(_0x5c6925){utils[_0xed87('0x1d')](util[_0xed87('0x13')](_0xed87('0x2d'),_0x167de8['uniqueid']),_0x5c6925);}};exports['agentcomplete']=function(_0xa31eec){try{if(!_[_0xed87('0x34')](agents[_0xa31eec[_0xed87('0x16')]])){utils[_0xed87('0x12')](util['format'](_0xed87('0x35'),_0xa31eec[_0xed87('0x15')]),_0xa31eec);utils['info'](util[_0xed87('0x13')](_0xed87('0x36'),_0xa31eec[_0xed87('0x15')],agents[_0xa31eec[_0xed87('0x16')]][_0xed87('0x1c')],_0xa31eec[_0xed87('0x16')]));agents[_0xa31eec[_0xed87('0x16')]][_0xed87('0xb')]=!![];agents[_0xa31eec[_0xed87('0x16')]][_0xed87('0x37')]=utils[_0xed87('0x18')]();agents[_0xa31eec['destuniqueid']][_0xed87('0x24')]=utils[_0xed87('0x38')](agents[_0xa31eec[_0xed87('0x16')]][_0xed87('0x37')],agents[_0xa31eec[_0xed87('0x16')]][_0xed87('0x39')]);agents[_0xa31eec[_0xed87('0x16')]][_0xed87('0x21')]=_0xa31eec[_0xed87('0x21')];agents[_0xa31eec[_0xed87('0x16')]][_0xed87('0x7')]=_0xed87('0x3a');writeDB(agents[_0xa31eec[_0xed87('0x16')]]);}}catch(_0x244e18){utils[_0xed87('0x1d')](util[_0xed87('0x13')](_0xed87('0x35'),_0xa31eec['uniqueid']),_0x244e18);}};exports[_0xed87('0x3b')]=function(_0x1a68a7){try{if(!_[_0xed87('0x34')](agents[_0x1a68a7['transfereruniqueid']])){utils[_0xed87('0x12')](util[_0xed87('0x13')]('[%s][agents][blindtransfer]',_0x1a68a7[_0xed87('0x15')]),_0x1a68a7);utils[_0xed87('0x2')](util[_0xed87('0x13')](_0xed87('0x3c'),_0x1a68a7['uniqueid'],agents[_0x1a68a7[_0xed87('0x3d')]][_0xed87('0x1c')],agents[_0x1a68a7[_0xed87('0x3d')]][_0xed87('0x15')]));agents[_0x1a68a7[_0xed87('0x3d')]][_0xed87('0x3e')]=!![];agents[_0x1a68a7[_0xed87('0x3d')]][_0xed87('0x3f')]=_0xed87('0x40');agents[_0x1a68a7[_0xed87('0x3d')]][_0xed87('0x41')]=_0x1a68a7[_0xed87('0x42')];agents[_0x1a68a7[_0xed87('0x3d')]]['transferuniqueid']=agents[_0x1a68a7[_0xed87('0x3d')]]['uniqueid'];}}catch(_0x17cad7){utils[_0xed87('0x1d')](util[_0xed87('0x13')](_0xed87('0x43'),_0x1a68a7[_0xed87('0x15')]),_0x17cad7);}};exports[_0xed87('0x44')]=function(_0x25f837){try{utils[_0xed87('0x12')](util[_0xed87('0x13')](_0xed87('0x45'),_0x25f837['origtransfereruniqueid']),_0x25f837);if(_0x25f837[_0xed87('0x46')]==_0x25f837[_0xed87('0x47')]){if(!_[_0xed87('0x34')](agents[_0x25f837[_0xed87('0x48')]])){utils[_0xed87('0x2')](util[_0xed87('0x13')](_0xed87('0x49'),_0x25f837[_0xed87('0x46')],agents[_0x25f837[_0xed87('0x48')]][_0xed87('0x1c')]));agents[_0x25f837[_0xed87('0x48')]]['transfer']=!![];agents[_0x25f837['secondtransfereruniqueid']][_0xed87('0x3f')]=_0xed87('0x4a');agents[_0x25f837[_0xed87('0x48')]][_0xed87('0x41')]=_0x25f837[_0xed87('0x4b')];agents[_0x25f837['secondtransfereruniqueid']][_0xed87('0x4c')]=_0x25f837[_0xed87('0x46')];}if(_0x25f837[_0xed87('0x4d')]&&agents[_0x25f837[_0xed87('0x4d')]]){agents[_0x25f837[_0xed87('0x4d')]][_0xed87('0x4e')]=0x1;transfers[_0x25f837[_0xed87('0x4d')]]=_[_0xed87('0x4f')](agents[_0x25f837[_0xed87('0x4d')]]);transfers[_0x25f837[_0xed87('0x4d')]][_0xed87('0x50')]=agents[_0x25f837[_0xed87('0x48')]][_0xed87('0x50')];transfers[_0x25f837[_0xed87('0x4d')]]['calleridname']=agents[_0x25f837[_0xed87('0x48')]][_0xed87('0x51')];transfers[_0x25f837[_0xed87('0x4d')]][_0xed87('0x17')]=utils[_0xed87('0x18')]();transfers[_0x25f837[_0xed87('0x4d')]][_0xed87('0x39')]=utils[_0xed87('0x18')]();transfers[_0x25f837['transfereeuniqueid']][_0xed87('0x22')]=0x0;transfers[_0x25f837[_0xed87('0x4d')]][_0xed87('0x4e')]=0x2;}}else if(_0x25f837[_0xed87('0x48')]==_0x25f837[_0xed87('0x52')]){if(!_[_0xed87('0x34')](agents[_0x25f837['origtransfereruniqueid']])){utils['info'](util[_0xed87('0x13')](_0xed87('0x49'),_0x25f837[_0xed87('0x46')],agents[_0x25f837[_0xed87('0x46')]][_0xed87('0x1c')]));agents[_0x25f837[_0xed87('0x46')]][_0xed87('0x3e')]=!![];agents[_0x25f837[_0xed87('0x46')]]['transfertype']=_0xed87('0x4a');agents[_0x25f837['origtransfereruniqueid']][_0xed87('0x41')]=_0x25f837[_0xed87('0x53')];agents[_0x25f837['origtransfereruniqueid']][_0xed87('0x4c')]=_0x25f837[_0xed87('0x48')];}if(_0x25f837['transfertargetuniqueid']&&agents[_0x25f837[_0xed87('0x54')]]){agents[_0x25f837[_0xed87('0x54')]][_0xed87('0x4e')]=0x1;transfers[_0x25f837[_0xed87('0x54')]]=_[_0xed87('0x4f')](agents[_0x25f837['transfertargetuniqueid']]);transfers[_0x25f837[_0xed87('0x54')]][_0xed87('0x50')]=agents[_0x25f837[_0xed87('0x46')]][_0xed87('0x50')];transfers[_0x25f837['transfertargetuniqueid']]['calleridname']=agents[_0x25f837[_0xed87('0x46')]][_0xed87('0x51')];transfers[_0x25f837['transfertargetuniqueid']][_0xed87('0x17')]=utils[_0xed87('0x18')]();transfers[_0x25f837[_0xed87('0x54')]][_0xed87('0x39')]=utils[_0xed87('0x18')]();transfers[_0x25f837[_0xed87('0x54')]][_0xed87('0x22')]=0x0;transfers[_0x25f837[_0xed87('0x54')]][_0xed87('0x4e')]=0x2;}}}catch(_0x38b588){utils[_0xed87('0x1d')](util[_0xed87('0x13')](_0xed87('0x45'),_0x25f837[_0xed87('0x46')]),_0x38b588);}};exports['hangup']=function(_0xa81cc8){try{utils[_0xed87('0x12')](util['format']('[%s][agents][hangup]',_0xa81cc8[_0xed87('0x15')]),_0xa81cc8);if(agents[_0xa81cc8[_0xed87('0x15')]]&&agents[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x21')]===_0xed87('0x20')){if(_0xa81cc8[_0xed87('0x55')]==='21'){agents[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x21')]='rejected';agents[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x7')]=_0xed87('0x56');}utils[_0xed87('0x2')](util[_0xed87('0x13')](_0xed87('0x57'),_0xa81cc8[_0xed87('0x15')],agents[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x1c')],agents[_0xa81cc8[_0xed87('0x15')]]['reason'],agents[_0xa81cc8['uniqueid']]['lastevent']));writeDB(agents[_0xa81cc8[_0xed87('0x15')]]);var _0x7d3e21=unanswered[_0xed87('0x58')](_0xa81cc8[_0xed87('0x15')]);if(_0x7d3e21>-0x1){unanswered[_0xed87('0x59')](_0x7d3e21,0x1);}}if(transfers[_0xa81cc8['uniqueid']]){transfers[_0xa81cc8[_0xed87('0x15')]][_0xed87('0xb')]=!![];transfers[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x37')]=utils[_0xed87('0x18')]();transfers[_0xa81cc8[_0xed87('0x15')]]['talktime']=utils['diffTime'](transfers[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x37')],transfers[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x39')]);transfers[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x21')]=_0xed87('0x5a');transfers[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x7')]=_0xed87('0x3a');utils[_0xed87('0x2')](util[_0xed87('0x13')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xa81cc8[_0xed87('0x15')],transfers[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x1c')],transfers[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x21')],transfers[_0xa81cc8[_0xed87('0x15')]]['lastevent']));writeDB(transfers[_0xa81cc8[_0xed87('0x15')]],!![]);}if(agents[_0xa81cc8[_0xed87('0x15')]]&&agents[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x39')]){agents[_0xa81cc8['uniqueid']]['agentcomplete']=!![];agents[_0xa81cc8['uniqueid']]['agentcompleteAt']=utils['now']();agents[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x24')]=utils[_0xed87('0x38')](agents[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x37')],agents[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x39')]);agents[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x21')]=agents[_0xa81cc8['uniqueid']]['transfer']?_0xed87('0x3e'):_0xed87('0x5a');agents[_0xa81cc8[_0xed87('0x15')]][_0xed87('0x7')]=_0xed87('0x3a');utils['info'](util['format'](_0xed87('0x57'),_0xa81cc8[_0xed87('0x15')],agents[_0xa81cc8['uniqueid']][_0xed87('0x1c')],agents[_0xa81cc8['uniqueid']][_0xed87('0x21')],agents[_0xa81cc8['uniqueid']][_0xed87('0x7')]));writeDB(agents[_0xa81cc8[_0xed87('0x15')]]);}}catch(_0x3dd107){utils[_0xed87('0x1d')](util[_0xed87('0x13')]('[%s][agents][hangup]',_0xa81cc8[_0xed87('0x15')]),_0x3dd107);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index d113231..aefe759 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 _0x2590=['split','lastIndexOf','includes','hangup','execif','gotoif','application','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','toNumber','[%s][calls][hangup]','callerid','endtime','duration','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','destinationchannel','_attended','userfield','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','ContactId','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','cdr'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x2590,0x1ec));var _0x0259=function(_0x2490a0,_0x54027f){_0x2490a0=_0x2490a0-0x0;var _0x28c0d8=_0x2590[_0x2490a0];return _0x28c0d8;};'use strict';var _=require(_0x0259('0x0'));var util=require(_0x0259('0x1'));var utils=require('./utils');var dispositions=[_0x0259('0x2'),_0x0259('0x3'),'FAILED',_0x0259('0x2'),'NO\x20ANSWER','NO\x20ANSWER',_0x0259('0x4'),_0x0259('0x5'),_0x0259('0x3'),_0x0259('0x3'),_0x0259('0x3')];var channels={};function writeDB(_0x5a8143){utils[_0x0259('0x6')](util['format'](_0x0259('0x7'),_0x5a8143[_0x0259('0x8')],_0x5a8143[_0x0259('0x9')],_0x5a8143[_0x0259('0xa')],_0x5a8143[_0x0259('0xb')],_0x5a8143[_0x0259('0xc')],_0x5a8143[_0x0259('0xd')],_0x5a8143[_0x0259('0xe')],_0x5a8143[_0x0259('0xf')]));if(_0x5a8143['accountcode']){utils[_0x0259('0x10')](_0x5a8143[_0x0259('0x11')])['then'](function(_0x3c9ce9){if(_0x3c9ce9){_0x5a8143['UserId']=_0x3c9ce9['id'];}utils[_0x0259('0x12')](_0x0259('0x13'),_0x5a8143);});}else{utils[_0x0259('0x12')](_0x0259('0x13'),_0x5a8143);}if(channels[_0x5a8143[_0x0259('0x8')]]){delete channels[_0x5a8143[_0x0259('0x8')]];}}exports[_0x0259('0x14')]=function(_0x15a434){try{utils[_0x0259('0x15')](util[_0x0259('0x16')](_0x0259('0x17'),_0x15a434['uniqueid']),_0x15a434);if(_0x15a434[_0x0259('0x8')]==_0x15a434[_0x0259('0x18')]&&_0x15a434[_0x0259('0x9')]!=_0x0259('0x19')){utils[_0x0259('0x6')](util['format'](_0x0259('0x1a'),_0x15a434[_0x0259('0x8')],_0x15a434[_0x0259('0x1b')],_0x15a434['exten']));channels[_0x15a434[_0x0259('0x8')]]={'uniqueid':_0x15a434[_0x0259('0x8')],'accountcode':_0x15a434[_0x0259('0x11')],'source':_0x15a434[_0x0259('0xd')],'destination':_0x15a434[_0x0259('0x1c')],'destinationcontext':_0x15a434['context'],'channel':_0x15a434['channel'],'starttime':utils[_0x0259('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x0259('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x45d5ba){utils[_0x0259('0x1e')](util[_0x0259('0x16')]('[%s][calls][newchannel]',_0x15a434[_0x0259('0x8')]),_0x45d5ba);}};exports[_0x0259('0x1f')]=function(_0x319207){try{utils[_0x0259('0x15')](util['format'](_0x0259('0x20'),_0x319207[_0x0259('0x8')]),_0x319207);if(!_[_0x0259('0x21')](channels[_0x319207['uniqueid']])&&_0x319207['channelstate']==0x6){utils[_0x0259('0x6')](util[_0x0259('0x16')](_0x0259('0x22'),_0x319207[_0x0259('0x8')],_0x319207['context'],_0x319207[_0x0259('0x9')]));if(_[_0x0259('0x21')](channels[_0x319207[_0x0259('0x8')]][_0x0259('0x23')])){channels[_0x319207[_0x0259('0x8')]][_0x0259('0x23')]=utils[_0x0259('0x1d')]();}}else if(!_[_0x0259('0x21')](channels[_0x319207[_0x0259('0x18')]])&&_0x319207[_0x0259('0x24')]==0x6&&_0x319207[_0x0259('0x1b')]!=_0x0259('0x25')){utils[_0x0259('0x6')](util[_0x0259('0x16')](_0x0259('0x26'),_0x319207['uniqueid'],_0x319207[_0x0259('0x18')],_0x319207['context'],_0x319207[_0x0259('0x9')]));channels[_0x319207[_0x0259('0x18')]][_0x0259('0x11')]=_0x319207[_0x0259('0x11')];channels[_0x319207['linkedid']]['destinationchannel']=_0x319207[_0x0259('0x9')];if(_[_0x0259('0x21')](channels[_0x319207[_0x0259('0x18')]][_0x0259('0x27')])){channels[_0x319207[_0x0259('0x18')]][_0x0259('0x27')]=utils[_0x0259('0x1d')]();}channels[_0x319207[_0x0259('0x18')]]['disposition']=dispositions[_[_0x0259('0x28')](_0x319207[_0x0259('0x24')])]||_0x0259('0x4');}}catch(_0x4852b4){utils['error'](util[_0x0259('0x16')](_0x0259('0x20'),_0x319207[_0x0259('0x8')]),_0x4852b4);}};exports['hangup']=function(_0xc6db65){try{if(!_['isNil'](channels[_0xc6db65[_0x0259('0x8')]])){utils[_0x0259('0x15')](util[_0x0259('0x16')](_0x0259('0x29'),_0xc6db65['uniqueid']),_0xc6db65);if(_[_0x0259('0x21')](channels[_0xc6db65[_0x0259('0x8')]][_0x0259('0x2a')])){channels[_0xc6db65[_0x0259('0x8')]][_0x0259('0x2a')]=_0xc6db65['calleridname']+'\x20<'+_0xc6db65[_0x0259('0xd')]+'>';}utils[_0x0259('0x6')](util[_0x0259('0x16')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0xc6db65[_0x0259('0x8')],channels[_0xc6db65['uniqueid']][_0x0259('0x2a')],_0xc6db65['cause-txt']));channels[_0xc6db65[_0x0259('0x8')]][_0x0259('0x2b')]=utils[_0x0259('0x1d')]();channels[_0xc6db65[_0x0259('0x8')]][_0x0259('0x2c')]=utils['diffTime'](channels[_0xc6db65[_0x0259('0x8')]][_0x0259('0x2b')],channels[_0xc6db65[_0x0259('0x8')]]['starttime']);channels[_0xc6db65['uniqueid']][_0x0259('0x2d')]=channels[_0xc6db65[_0x0259('0x8')]][_0x0259('0x27')]?utils[_0x0259('0x2e')](channels[_0xc6db65['uniqueid']][_0x0259('0x2b')],channels[_0xc6db65[_0x0259('0x8')]][_0x0259('0x27')]):0x0;writeDB(channels[_0xc6db65[_0x0259('0x8')]]);}}catch(_0x3caab8){utils['error'](util[_0x0259('0x16')](_0x0259('0x29'),_0xc6db65[_0x0259('0x8')]),_0x3caab8);}};exports[_0x0259('0x2f')]=function(_0x5b4686){try{if(!_[_0x0259('0x21')](channels[_0x5b4686[_0x0259('0x30')]])){utils['debug'](util[_0x0259('0x16')](_0x0259('0x31'),_0x5b4686[_0x0259('0x32')]),_0x5b4686);if(channels[_0x5b4686[_0x0259('0x30')]][_0x0259('0x9')]==_0x5b4686[_0x0259('0x33')]){utils[_0x0259('0x6')](util[_0x0259('0x16')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5b4686[_0x0259('0x32')],_0x5b4686[_0x0259('0x30')],_0x5b4686[_0x0259('0x34')]));channels[_0x5b4686[_0x0259('0x30')]][_0x0259('0x35')]=_0x5b4686['secondtransfererchannel'];channels[_0x5b4686[_0x0259('0x30')]]['userfield']=_0x0259('0x36');}else if(channels[_0x5b4686[_0x0259('0x30')]]['channel']=_0x5b4686['transfertargetchannel']){utils[_0x0259('0x6')](util[_0x0259('0x16')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5b4686[_0x0259('0x32')],_0x5b4686[_0x0259('0x30')],_0x5b4686['origtransfererchannel']));channels[_0x5b4686[_0x0259('0x30')]][_0x0259('0x35')]=_0x5b4686['origtransfererchannel'];channels[_0x5b4686[_0x0259('0x30')]][_0x0259('0x37')]=_0x0259('0x36');}}}catch(_0x1ff8e3){utils['error'](util[_0x0259('0x16')](_0x0259('0x31'),_0x5b4686[_0x0259('0x32')]),_0x1ff8e3);}};exports['musiconholdstart']=function(_0x136c58){try{if(!_[_0x0259('0x21')](channels[_0x136c58[_0x0259('0x8')]])){utils[_0x0259('0x15')](util['format'](_0x0259('0x38'),_0x136c58[_0x0259('0x8')]),_0x136c58);channels[_0x136c58['uniqueid']]['musiconholdstartAt']=utils[_0x0259('0x1d')]();utils['info'](util['format'](_0x0259('0x39'),_0x136c58['uniqueid'],channels[_0x136c58[_0x0259('0x8')]][_0x0259('0x3a')]));}}catch(_0x1334f9){utils['error'](util['format'](_0x0259('0x38'),_0x136c58[_0x0259('0x8')]),_0x1334f9);}};exports['musiconholdstop']=function(_0x503814){try{if(!_['isNil'](channels[_0x503814[_0x0259('0x8')]])){utils[_0x0259('0x15')](util[_0x0259('0x16')](_0x0259('0x3b'),_0x503814[_0x0259('0x8')]),_0x503814);if(!_['isNil'](channels[_0x503814[_0x0259('0x8')]][_0x0259('0x3a')])){channels[_0x503814[_0x0259('0x8')]]['mohtime']+=utils['diffTime'](utils[_0x0259('0x1d')](),channels[_0x503814['uniqueid']][_0x0259('0x3a')]);utils[_0x0259('0x6')](util['format'](_0x0259('0x3c'),_0x503814[_0x0259('0x8')],channels[_0x503814[_0x0259('0x8')]][_0x0259('0x3d')]));delete channels[_0x503814['uniqueid']][_0x0259('0x3a')];}}}catch(_0x106f71){utils[_0x0259('0x1e')](util[_0x0259('0x16')](_0x0259('0x3b'),_0x503814['uniqueid']),_0x106f71);}};exports[_0x0259('0x3e')]=function(_0x1cdfbe){try{if(!_[_0x0259('0x21')](channels[_0x1cdfbe[_0x0259('0x8')]])){utils[_0x0259('0x15')](util[_0x0259('0x16')](_0x0259('0x3f'),_0x1cdfbe[_0x0259('0x8')]),_0x1cdfbe);if(!_['isNil'](_0x1cdfbe[_0x0259('0x40')]['xmd-originatecalleridnum'])){utils['info'](util[_0x0259('0x16')](_0x0259('0x41'),_0x1cdfbe[_0x0259('0x8')],_0x1cdfbe[_0x0259('0x42')]));channels[_0x1cdfbe[_0x0259('0x8')]]['source']=_0x1cdfbe[_0x0259('0x42')];}if(!_[_0x0259('0x21')](_0x1cdfbe['variable'][_0x0259('0x43')])){utils[_0x0259('0x6')](util['format'](_0x0259('0x44'),_0x1cdfbe[_0x0259('0x8')],_0x1cdfbe[_0x0259('0x42')]));channels[_0x1cdfbe[_0x0259('0x8')]][_0x0259('0x45')]=_0x1cdfbe[_0x0259('0x42')];channels[_0x1cdfbe[_0x0259('0x8')]][_0x0259('0x2a')]='\x22'+_0x1cdfbe['value']+'\x22\x20<'+_0x1cdfbe[_0x0259('0x42')]+'>';}if(!_[_0x0259('0x21')](_0x1cdfbe[_0x0259('0x40')][_0x0259('0x46')])||!_[_0x0259('0x21')](_0x1cdfbe[_0x0259('0x40')]['xmd-callerid'])){utils[_0x0259('0x6')](util[_0x0259('0x16')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1cdfbe[_0x0259('0x8')],!_[_0x0259('0x21')](_0x1cdfbe['variable'][_0x0259('0x46')])?'xmd-callerid-preview':_0x0259('0x47'),_0x1cdfbe[_0x0259('0x42')]));channels[_0x1cdfbe[_0x0259('0x8')]][_0x0259('0x2a')]=_0x1cdfbe[_0x0259('0x42')];}if(!_['isNil'](_0x1cdfbe[_0x0259('0x40')][_0x0259('0x48')])||!_[_0x0259('0x21')](_0x1cdfbe[_0x0259('0x40')][_0x0259('0x49')])){utils['info'](util[_0x0259('0x16')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1cdfbe[_0x0259('0x8')],!_['isNil'](_0x1cdfbe[_0x0259('0x40')]['xmd-queue'])?_0x0259('0x48'):_0x0259('0x49'),_0x1cdfbe[_0x0259('0x42')]));channels[_0x1cdfbe[_0x0259('0x8')]][_0x0259('0x4a')]=_0x0259('0x4b');channels[_0x1cdfbe[_0x0259('0x8')]][_0x0259('0x4c')]=_0x1cdfbe[_0x0259('0x42')];channels[_0x1cdfbe[_0x0259('0x8')]][_0x0259('0xa')]=!![];}if(!_[_0x0259('0x21')](_0x1cdfbe[_0x0259('0x40')]['xmd-contactid'])){utils[_0x0259('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x1cdfbe[_0x0259('0x8')],_0x1cdfbe[_0x0259('0x42')]));channels[_0x1cdfbe[_0x0259('0x8')]][_0x0259('0x4d')]=_0x1cdfbe[_0x0259('0x42')];}if(!_['isNil'](_0x1cdfbe[_0x0259('0x40')]['xmd-cdrtype'])){utils['info'](util[_0x0259('0x16')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1cdfbe[_0x0259('0x8')],_0x1cdfbe[_0x0259('0x42')]));channels[_0x1cdfbe['uniqueid']]['type']=_0x1cdfbe['value'];}if(!_[_0x0259('0x21')](_0x1cdfbe['variable'][_0x0259('0x4e')])){utils['info'](util['format'](_0x0259('0x4f'),_0x1cdfbe['uniqueid'],_0x1cdfbe[_0x0259('0x42')]));channels[_0x1cdfbe[_0x0259('0x8')]][_0x0259('0x50')]=_0x1cdfbe[_0x0259('0x42')];}if(!_['isNil'](_0x1cdfbe[_0x0259('0x40')][_0x0259('0x51')])){utils[_0x0259('0x6')](util[_0x0259('0x16')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x1cdfbe['uniqueid'],_0x1cdfbe[_0x0259('0x42')]));channels[_0x1cdfbe[_0x0259('0x8')]][_0x0259('0x51')]=_0x1cdfbe['value'];}}}catch(_0x25e808){utils[_0x0259('0x1e')](util['format']('[%s][calls][varset]',_0x1cdfbe[_0x0259('0x8')]),_0x25e808);}};exports[_0x0259('0x52')]=function(_0x315bbd){try{if(!_[_0x0259('0x21')](channels[_0x315bbd[_0x0259('0x8')]])){utils['debug'](util['format'](_0x0259('0x53'),_0x315bbd[_0x0259('0x8')]),_0x315bbd);utils[_0x0259('0x6')](util['format'](_0x0259('0x54'),_0x315bbd[_0x0259('0x8')],_0x315bbd['application'],_0x315bbd[_0x0259('0x55')]));if(_0x315bbd['application'][_0x0259('0x56')]()==_0x0259('0x57')&&_[_0x0259('0x58')](_0x315bbd[_0x0259('0x55')][_0x0259('0x56')](),_0x0259('0x59'))){var _0x189159=_0x315bbd[_0x0259('0x55')][_0x0259('0x5a')]('=');var _0x3a5a62=_0x189159[0x0]['substring'](_0x189159[0x0][_0x0259('0x5b')]('(')+0x1,_0x189159[0x0]['lastIndexOf'](')'));var _0x421fba=_0x189159[0x1];channels[_0x315bbd[_0x0259('0x8')]][_0x3a5a62]=_0x421fba;}if(!_[_0x0259('0x5c')]([_0x0259('0x5d'),'noop',_0x0259('0x5e'),_0x0259('0x57'),_0x0259('0x5f')],_0x315bbd[_0x0259('0x60')][_0x0259('0x56')]())){channels[_0x315bbd[_0x0259('0x8')]][_0x0259('0x4a')]=_0x315bbd[_0x0259('0x60')];channels[_0x315bbd[_0x0259('0x8')]][_0x0259('0x4c')]=_0x315bbd[_0x0259('0x55')];}}}catch(_0x5baf98){utils[_0x0259('0x1e')](util[_0x0259('0x16')](_0x0259('0x53'),_0x315bbd[_0x0259('0x8')]),_0x5baf98);}}; \ No newline at end of file +var _0x6d6a=['mohtime','[%s][calls][musiconholdstop]','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','toLowerCase','startsWith','cdr','appdata','split','substring','lastIndexOf','includes','noop','execif','gotoif','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','channelstate','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','endtime','billableseconds','[%s][calls][hangup]','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s'];(function(_0x4f04f5,_0x57f7b9){var _0x13fa88=function(_0x1c99ec){while(--_0x1c99ec){_0x4f04f5['push'](_0x4f04f5['shift']());}};_0x13fa88(++_0x57f7b9);}(_0x6d6a,0x8f));var _0xa6d6=function(_0x58db4e,_0x439d8d){_0x58db4e=_0x58db4e-0x0;var _0x40139a=_0x6d6a[_0x58db4e];return _0x40139a;};'use strict';var _=require('lodash');var util=require(_0xa6d6('0x0'));var utils=require(_0xa6d6('0x1'));var dispositions=[_0xa6d6('0x2'),_0xa6d6('0x3'),_0xa6d6('0x3'),_0xa6d6('0x2'),_0xa6d6('0x2'),_0xa6d6('0x2'),_0xa6d6('0x4'),_0xa6d6('0x5'),_0xa6d6('0x3'),_0xa6d6('0x3'),'FAILED'];var channels={};function writeDB(_0x17751c){utils[_0xa6d6('0x6')](util[_0xa6d6('0x7')](_0xa6d6('0x8'),_0x17751c[_0xa6d6('0x9')],_0x17751c[_0xa6d6('0xa')],_0x17751c[_0xa6d6('0xb')],_0x17751c[_0xa6d6('0xc')],_0x17751c[_0xa6d6('0xd')],_0x17751c[_0xa6d6('0xe')],_0x17751c[_0xa6d6('0xf')],_0x17751c['lastevent']));if(_0x17751c[_0xa6d6('0x10')]){utils[_0xa6d6('0x11')](_0x17751c['accountcode'])['then'](function(_0x33a696){if(_0x33a696){_0x17751c[_0xa6d6('0x12')]=_0x33a696['id'];}utils[_0xa6d6('0x13')]('CreateVoiceCallReport',_0x17751c);});}else{utils['request'](_0xa6d6('0x14'),_0x17751c);}if(channels[_0x17751c[_0xa6d6('0x9')]]){delete channels[_0x17751c['uniqueid']];}}exports['newchannel']=function(_0x1702d7){try{utils[_0xa6d6('0x15')](util['format'](_0xa6d6('0x16'),_0x1702d7[_0xa6d6('0x9')]),_0x1702d7);if(_0x1702d7[_0xa6d6('0x9')]==_0x1702d7[_0xa6d6('0x17')]&&_0x1702d7['channel']!=_0xa6d6('0x18')){utils[_0xa6d6('0x6')](util[_0xa6d6('0x7')](_0xa6d6('0x19'),_0x1702d7[_0xa6d6('0x9')],_0x1702d7[_0xa6d6('0x1a')],_0x1702d7['exten']));channels[_0x1702d7[_0xa6d6('0x9')]]={'uniqueid':_0x1702d7[_0xa6d6('0x9')],'accountcode':_0x1702d7['accountcode'],'source':_0x1702d7[_0xa6d6('0xe')],'destination':_0x1702d7[_0xa6d6('0x1b')],'destinationcontext':_0x1702d7[_0xa6d6('0x1a')],'channel':_0x1702d7[_0xa6d6('0xa')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xa6d6('0x1c')};}}catch(_0x450dbe){utils[_0xa6d6('0x1d')](util[_0xa6d6('0x7')]('[%s][calls][newchannel]',_0x1702d7['uniqueid']),_0x450dbe);}};exports[_0xa6d6('0x1e')]=function(_0x46d510){try{utils['debug'](util[_0xa6d6('0x7')](_0xa6d6('0x1f'),_0x46d510['uniqueid']),_0x46d510);if(!_[_0xa6d6('0x20')](channels[_0x46d510[_0xa6d6('0x9')]])&&_0x46d510['channelstate']==0x6){utils['info'](util[_0xa6d6('0x7')](_0xa6d6('0x21'),_0x46d510[_0xa6d6('0x9')],_0x46d510[_0xa6d6('0x1a')],_0x46d510[_0xa6d6('0xa')]));if(_['isNil'](channels[_0x46d510[_0xa6d6('0x9')]][_0xa6d6('0x22')])){channels[_0x46d510['uniqueid']][_0xa6d6('0x22')]=utils[_0xa6d6('0x23')]();}}else if(!_[_0xa6d6('0x20')](channels[_0x46d510['linkedid']])&&_0x46d510[_0xa6d6('0x24')]==0x6&&_0x46d510[_0xa6d6('0x1a')]!='transfer'){utils[_0xa6d6('0x6')](util[_0xa6d6('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x46d510['uniqueid'],_0x46d510[_0xa6d6('0x17')],_0x46d510[_0xa6d6('0x1a')],_0x46d510['channel']));channels[_0x46d510[_0xa6d6('0x17')]]['accountcode']=_0x46d510[_0xa6d6('0x10')];channels[_0x46d510[_0xa6d6('0x17')]][_0xa6d6('0x25')]=_0x46d510['channel'];if(_[_0xa6d6('0x20')](channels[_0x46d510[_0xa6d6('0x17')]][_0xa6d6('0x26')])){channels[_0x46d510[_0xa6d6('0x17')]][_0xa6d6('0x26')]=utils['now']();}channels[_0x46d510[_0xa6d6('0x17')]][_0xa6d6('0x27')]=dispositions[_[_0xa6d6('0x28')](_0x46d510[_0xa6d6('0x24')])]||_0xa6d6('0x4');}}catch(_0x2c7ce9){utils[_0xa6d6('0x1d')](util[_0xa6d6('0x7')]('[%s][calls][newstate]',_0x46d510['uniqueid']),_0x2c7ce9);}};exports[_0xa6d6('0x29')]=function(_0x5e01ff){try{if(!_['isNil'](channels[_0x5e01ff[_0xa6d6('0x9')]])){utils[_0xa6d6('0x15')](util[_0xa6d6('0x7')]('[%s][calls][hangup]',_0x5e01ff[_0xa6d6('0x9')]),_0x5e01ff);if(_[_0xa6d6('0x20')](channels[_0x5e01ff[_0xa6d6('0x9')]][_0xa6d6('0x2a')])){channels[_0x5e01ff['uniqueid']][_0xa6d6('0x2a')]=_0x5e01ff[_0xa6d6('0x2b')]+'\x20<'+_0x5e01ff['calleridnum']+'>';}utils[_0xa6d6('0x6')](util[_0xa6d6('0x7')](_0xa6d6('0x2c'),_0x5e01ff['uniqueid'],channels[_0x5e01ff[_0xa6d6('0x9')]][_0xa6d6('0x2a')],_0x5e01ff[_0xa6d6('0x2d')]));channels[_0x5e01ff[_0xa6d6('0x9')]]['endtime']=utils[_0xa6d6('0x23')]();channels[_0x5e01ff['uniqueid']]['duration']=utils[_0xa6d6('0x2e')](channels[_0x5e01ff[_0xa6d6('0x9')]][_0xa6d6('0x2f')],channels[_0x5e01ff[_0xa6d6('0x9')]]['starttime']);channels[_0x5e01ff[_0xa6d6('0x9')]][_0xa6d6('0x30')]=channels[_0x5e01ff[_0xa6d6('0x9')]][_0xa6d6('0x26')]?utils[_0xa6d6('0x2e')](channels[_0x5e01ff[_0xa6d6('0x9')]][_0xa6d6('0x2f')],channels[_0x5e01ff['uniqueid']][_0xa6d6('0x26')]):0x0;writeDB(channels[_0x5e01ff[_0xa6d6('0x9')]]);}}catch(_0x1727f1){utils[_0xa6d6('0x1d')](util[_0xa6d6('0x7')](_0xa6d6('0x31'),_0x5e01ff[_0xa6d6('0x9')]),_0x1727f1);}};exports['attendedtransfer']=function(_0xce115d){try{if(!_[_0xa6d6('0x20')](channels[_0xce115d[_0xa6d6('0x32')]])){utils['debug'](util['format'](_0xa6d6('0x33'),_0xce115d[_0xa6d6('0x34')]),_0xce115d);if(channels[_0xce115d[_0xa6d6('0x32')]][_0xa6d6('0xa')]==_0xce115d[_0xa6d6('0x35')]){utils[_0xa6d6('0x6')](util[_0xa6d6('0x7')](_0xa6d6('0x36'),_0xce115d['origtransfereruniqueid'],_0xce115d[_0xa6d6('0x32')],_0xce115d[_0xa6d6('0x37')]));channels[_0xce115d['localtwolinkedid']]['destinationchannel']=_0xce115d[_0xa6d6('0x37')];channels[_0xce115d[_0xa6d6('0x32')]][_0xa6d6('0x38')]='_attended';}else if(channels[_0xce115d['localtwolinkedid']][_0xa6d6('0xa')]=_0xce115d[_0xa6d6('0x39')]){utils[_0xa6d6('0x6')](util[_0xa6d6('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xce115d[_0xa6d6('0x34')],_0xce115d['localtwolinkedid'],_0xce115d[_0xa6d6('0x3a')]));channels[_0xce115d[_0xa6d6('0x32')]]['destinationchannel']=_0xce115d[_0xa6d6('0x3a')];channels[_0xce115d[_0xa6d6('0x32')]][_0xa6d6('0x38')]=_0xa6d6('0x3b');}}}catch(_0x44d391){utils[_0xa6d6('0x1d')](util['format'](_0xa6d6('0x33'),_0xce115d[_0xa6d6('0x34')]),_0x44d391);}};exports['musiconholdstart']=function(_0x5c6d61){try{if(!_['isNil'](channels[_0x5c6d61[_0xa6d6('0x9')]])){utils['debug'](util[_0xa6d6('0x7')](_0xa6d6('0x3c'),_0x5c6d61[_0xa6d6('0x9')]),_0x5c6d61);channels[_0x5c6d61['uniqueid']]['musiconholdstartAt']=utils[_0xa6d6('0x23')]();utils['info'](util['format'](_0xa6d6('0x3d'),_0x5c6d61[_0xa6d6('0x9')],channels[_0x5c6d61[_0xa6d6('0x9')]][_0xa6d6('0x3e')]));}}catch(_0x113b0f){utils[_0xa6d6('0x1d')](util[_0xa6d6('0x7')](_0xa6d6('0x3c'),_0x5c6d61['uniqueid']),_0x113b0f);}};exports[_0xa6d6('0x3f')]=function(_0x32afe1){try{if(!_[_0xa6d6('0x20')](channels[_0x32afe1['uniqueid']])){utils[_0xa6d6('0x15')](util['format']('[%s][calls][musiconholdstop]',_0x32afe1['uniqueid']),_0x32afe1);if(!_['isNil'](channels[_0x32afe1[_0xa6d6('0x9')]]['musiconholdstartAt'])){channels[_0x32afe1['uniqueid']]['mohtime']+=utils[_0xa6d6('0x2e')](utils[_0xa6d6('0x23')](),channels[_0x32afe1['uniqueid']][_0xa6d6('0x3e')]);utils[_0xa6d6('0x6')](util[_0xa6d6('0x7')](_0xa6d6('0x40'),_0x32afe1[_0xa6d6('0x9')],channels[_0x32afe1['uniqueid']][_0xa6d6('0x41')]));delete channels[_0x32afe1[_0xa6d6('0x9')]][_0xa6d6('0x3e')];}}}catch(_0x21068c){utils[_0xa6d6('0x1d')](util['format'](_0xa6d6('0x42'),_0x32afe1[_0xa6d6('0x9')]),_0x21068c);}};exports['varset']=function(_0x5a5b52){try{if(!_['isNil'](channels[_0x5a5b52[_0xa6d6('0x9')]])){utils[_0xa6d6('0x15')](util[_0xa6d6('0x7')](_0xa6d6('0x43'),_0x5a5b52[_0xa6d6('0x9')]),_0x5a5b52);if(!_[_0xa6d6('0x20')](_0x5a5b52[_0xa6d6('0x44')]['xmd-originatecalleridnum'])){utils[_0xa6d6('0x6')](util[_0xa6d6('0x7')](_0xa6d6('0x45'),_0x5a5b52['uniqueid'],_0x5a5b52[_0xa6d6('0x46')]));channels[_0x5a5b52[_0xa6d6('0x9')]][_0xa6d6('0x47')]=_0x5a5b52[_0xa6d6('0x46')];}if(!_[_0xa6d6('0x20')](_0x5a5b52[_0xa6d6('0x44')][_0xa6d6('0x48')])){utils['info'](util[_0xa6d6('0x7')](_0xa6d6('0x49'),_0x5a5b52[_0xa6d6('0x9')],_0x5a5b52[_0xa6d6('0x46')]));channels[_0x5a5b52[_0xa6d6('0x9')]]['destination']=_0x5a5b52['value'];channels[_0x5a5b52[_0xa6d6('0x9')]][_0xa6d6('0x2a')]='\x22'+_0x5a5b52[_0xa6d6('0x46')]+_0xa6d6('0x4a')+_0x5a5b52[_0xa6d6('0x46')]+'>';}if(!_['isNil'](_0x5a5b52[_0xa6d6('0x44')][_0xa6d6('0x4b')])||!_['isNil'](_0x5a5b52[_0xa6d6('0x44')][_0xa6d6('0x4c')])){utils['info'](util[_0xa6d6('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5a5b52[_0xa6d6('0x9')],!_[_0xa6d6('0x20')](_0x5a5b52['variable'][_0xa6d6('0x4b')])?'xmd-callerid-preview':_0xa6d6('0x4c'),_0x5a5b52[_0xa6d6('0x46')]));channels[_0x5a5b52[_0xa6d6('0x9')]][_0xa6d6('0x2a')]=_0x5a5b52['value'];}if(!_[_0xa6d6('0x20')](_0x5a5b52[_0xa6d6('0x44')]['xmd-queue'])||!_[_0xa6d6('0x20')](_0x5a5b52[_0xa6d6('0x44')][_0xa6d6('0x4d')])){utils[_0xa6d6('0x6')](util[_0xa6d6('0x7')](_0xa6d6('0x4e'),_0x5a5b52[_0xa6d6('0x9')],!_[_0xa6d6('0x20')](_0x5a5b52['variable'][_0xa6d6('0x4f')])?'xmd-queue':_0xa6d6('0x4d'),_0x5a5b52['value']));channels[_0x5a5b52[_0xa6d6('0x9')]][_0xa6d6('0x50')]=_0xa6d6('0x51');channels[_0x5a5b52['uniqueid']]['lastdata']=_0x5a5b52[_0xa6d6('0x46')];channels[_0x5a5b52[_0xa6d6('0x9')]][_0xa6d6('0xb')]=!![];}if(!_['isNil'](_0x5a5b52[_0xa6d6('0x44')][_0xa6d6('0x52')])){utils[_0xa6d6('0x6')](util[_0xa6d6('0x7')](_0xa6d6('0x53'),_0x5a5b52[_0xa6d6('0x9')],_0x5a5b52['value']));channels[_0x5a5b52['uniqueid']]['ContactId']=_0x5a5b52[_0xa6d6('0x46')];}if(!_[_0xa6d6('0x20')](_0x5a5b52[_0xa6d6('0x44')]['xmd-cdrtype'])){utils[_0xa6d6('0x6')](util[_0xa6d6('0x7')](_0xa6d6('0x54'),_0x5a5b52[_0xa6d6('0x9')],_0x5a5b52[_0xa6d6('0x46')]));channels[_0x5a5b52[_0xa6d6('0x9')]]['type']=_0x5a5b52[_0xa6d6('0x46')];}if(!_[_0xa6d6('0x20')](_0x5a5b52[_0xa6d6('0x44')][_0xa6d6('0x55')])){utils[_0xa6d6('0x6')](util[_0xa6d6('0x7')](_0xa6d6('0x56'),_0x5a5b52[_0xa6d6('0x9')],_0x5a5b52['value']));channels[_0x5a5b52[_0xa6d6('0x9')]][_0xa6d6('0x57')]=_0x5a5b52[_0xa6d6('0x46')];}if(!_['isNil'](_0x5a5b52[_0xa6d6('0x44')][_0xa6d6('0x58')])){utils['info'](util[_0xa6d6('0x7')](_0xa6d6('0x59'),_0x5a5b52[_0xa6d6('0x9')],_0x5a5b52['value']));channels[_0x5a5b52[_0xa6d6('0x9')]]['sipcallid']=_0x5a5b52[_0xa6d6('0x46')];}}}catch(_0x4c0c9d){utils[_0xa6d6('0x1d')](util[_0xa6d6('0x7')](_0xa6d6('0x43'),_0x5a5b52['uniqueid']),_0x4c0c9d);}};exports[_0xa6d6('0x5a')]=function(_0x2de4b1){try{if(!_[_0xa6d6('0x20')](channels[_0x2de4b1[_0xa6d6('0x9')]])){utils['debug'](util[_0xa6d6('0x7')](_0xa6d6('0x5b'),_0x2de4b1[_0xa6d6('0x9')]),_0x2de4b1);utils[_0xa6d6('0x6')](util[_0xa6d6('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x2de4b1['uniqueid'],_0x2de4b1[_0xa6d6('0x5c')],_0x2de4b1['appdata']));if(_0x2de4b1[_0xa6d6('0x5c')][_0xa6d6('0x5d')]()=='set'&&_[_0xa6d6('0x5e')](_0x2de4b1['appdata'][_0xa6d6('0x5d')](),_0xa6d6('0x5f'))){var _0x42c524=_0x2de4b1[_0xa6d6('0x60')][_0xa6d6('0x61')]('=');var _0x353422=_0x42c524[0x0][_0xa6d6('0x62')](_0x42c524[0x0][_0xa6d6('0x63')]('(')+0x1,_0x42c524[0x0]['lastIndexOf'](')'));var _0x533702=_0x42c524[0x1];channels[_0x2de4b1['uniqueid']][_0x353422]=_0x533702;}if(!_[_0xa6d6('0x64')](['hangup',_0xa6d6('0x65'),_0xa6d6('0x66'),'set',_0xa6d6('0x67')],_0x2de4b1[_0xa6d6('0x5c')][_0xa6d6('0x5d')]())){channels[_0x2de4b1[_0xa6d6('0x9')]][_0xa6d6('0x50')]=_0x2de4b1[_0xa6d6('0x5c')];channels[_0x2de4b1[_0xa6d6('0x9')]]['lastdata']=_0x2de4b1[_0xa6d6('0x60')];}}}catch(_0x35a294){utils[_0xa6d6('0x1d')](util[_0xa6d6('0x7')]('[%s][calls][newexten]',_0x2de4b1[_0xa6d6('0x9')]),_0x35a294);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index c50cc5f..3d43d32 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 _0x9e42=['[core]\x20error','close','[core]\x20close','connect','info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x6cb242,_0x573c51){var _0x2d73e4=function(_0x550487){while(--_0x550487){_0x6cb242['push'](_0x6cb242['shift']());}};_0x2d73e4(++_0x573c51);}(_0x9e42,0x157));var _0x29e4=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0x9e42[_0x5235a6];return _0x1cf37e;};'use strict';var utils=require('./utils');exports[_0x29e4('0x0')]=function(){utils[_0x29e4('0x1')]('[core]\x20connected');};exports[_0x29e4('0x2')]=function(){utils[_0x29e4('0x1')](_0x29e4('0x3'));};exports[_0x29e4('0x4')]=function(){utils[_0x29e4('0x1')](_0x29e4('0x5'));};exports[_0x29e4('0x6')]=function(_0x369464){utils[_0x29e4('0x6')](_0x29e4('0x7'),_0x369464);};exports[_0x29e4('0x8')]=function(){utils[_0x29e4('0x1')](_0x29e4('0x9'));};exports['managerevent']=function(_0x2bfa7a){}; \ No newline at end of file +var _0x02cc=['close','[core]\x20close','./utils','connect','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x240ff2,_0x52010f){var _0xfa454=function(_0x1ff435){while(--_0x1ff435){_0x240ff2['push'](_0x240ff2['shift']());}};_0xfa454(++_0x52010f);}(_0x02cc,0xd4));var _0xc02c=function(_0x1bd8a0,_0x21a61f){_0x1bd8a0=_0x1bd8a0-0x0;var _0x870cd0=_0x02cc[_0x1bd8a0];return _0x870cd0;};'use strict';var utils=require(_0xc02c('0x0'));exports[_0xc02c('0x1')]=function(){utils['info'](_0xc02c('0x2'));};exports[_0xc02c('0x3')]=function(){utils['info']('[core]\x20shutdown');};exports[_0xc02c('0x4')]=function(){utils['info'](_0xc02c('0x5'));};exports[_0xc02c('0x6')]=function(_0x623e45){utils[_0xc02c('0x6')](_0xc02c('0x7'),_0x623e45);};exports[_0xc02c('0x8')]=function(){utils['info'](_0xc02c('0x9'));};exports['managerevent']=function(_0x3317c6){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index a42eab3..181edce 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 _0x5774=['startsWith','toLowerCase','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','dialstatus','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','calleridnum','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','[%s][dials][hangup]','lodash','./utils','info','format','uniqueid','dialstring','connectedlinenum','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set'];(function(_0x1bebb0,_0x1253ba){var _0x1cfd40=function(_0x1183b7){while(--_0x1183b7){_0x1bebb0['push'](_0x1bebb0['shift']());}};_0x1cfd40(++_0x1253ba);}(_0x5774,0x14f));var _0x4577=function(_0x32e22d,_0x1b9f19){_0x32e22d=_0x32e22d-0x0;var _0x4a919d=_0x5774[_0x32e22d];return _0x4a919d;};'use strict';var _=require(_0x4577('0x0'));var util=require('util');var utils=require(_0x4577('0x1'));var dials={};function writeDB(_0x277697){utils[_0x4577('0x2')](util[_0x4577('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x277697[_0x4577('0x4')],_0x277697['channel'],_0x277697[_0x4577('0x5')],_0x277697['calleridnum'],_0x277697[_0x4577('0x6')],_0x277697['dialstatus']));utils[_0x4577('0x7')]('CreateVoiceDialReport',_0x277697);delete dials[_0x277697[_0x4577('0x4')]];}exports[_0x4577('0x8')]=function(_0x36c2a2){try{utils[_0x4577('0x9')](util[_0x4577('0x3')](_0x4577('0xa'),_0x36c2a2['uniqueid']),_0x36c2a2);utils[_0x4577('0x2')](util[_0x4577('0x3')](_0x4577('0xb'),_0x36c2a2[_0x4577('0x4')],_0x36c2a2[_0x4577('0xc')],_0x36c2a2[_0x4577('0xd')]));if(_0x36c2a2[_0x4577('0xc')]['toLowerCase']()==_0x4577('0xe')&&_[_0x4577('0xf')](_0x36c2a2[_0x4577('0xd')][_0x4577('0x10')](),_0x4577('0x11'))){var _0x10258f=_0x36c2a2[_0x4577('0xd')][_0x4577('0x12')]('=');dials[_0x36c2a2[_0x4577('0x4')]]={'routeId':_0x10258f[0x1]};}}catch(_0x3e3cdb){utils[_0x4577('0x13')](util[_0x4577('0x3')](_0x4577('0xa'),_0x36c2a2['uniqueid']),_0x3e3cdb);}};exports[_0x4577('0x14')]=function(_0x2fad24){try{utils[_0x4577('0x9')](util[_0x4577('0x3')](_0x4577('0x15'),_0x2fad24[_0x4577('0x4')]),_0x2fad24);if(!_[_0x4577('0x16')](_0x2fad24[_0x4577('0x17')][_0x4577('0x18')])){utils[_0x4577('0x2')](util[_0x4577('0x3')](_0x4577('0x19'),_0x2fad24[_0x4577('0x4')],_0x2fad24[_0x4577('0x1a')]));dials[_0x2fad24[_0x4577('0x4')]]={'routeId':_0x2fad24['value']};}}catch(_0x55823c){utils[_0x4577('0x13')](util[_0x4577('0x3')]('[%s][dials][varset]',_0x2fad24[_0x4577('0x4')]),_0x55823c);}};exports[_0x4577('0x1b')]=function(_0x1e22bb){try{if(!_[_0x4577('0x16')](dials[_0x1e22bb[_0x4577('0x4')]])){utils['debug'](util['format'](_0x4577('0x1c'),_0x1e22bb[_0x4577('0x4')]),_0x1e22bb);dials[_0x1e22bb[_0x4577('0x4')]]=_[_0x4577('0x1d')](dials[_0x1e22bb[_0x4577('0x4')]],_0x1e22bb);dials[_0x1e22bb[_0x4577('0x4')]][_0x4577('0x1e')]=utils[_0x4577('0x1f')]();dials[_0x1e22bb['uniqueid']][_0x4577('0x20')]=_0x4577('0x21');utils['info'](util[_0x4577('0x3')](_0x4577('0x22'),_0x1e22bb[_0x4577('0x4')],dials[_0x1e22bb['uniqueid']][_0x4577('0x1e')]));}}catch(_0x2b2159){utils[_0x4577('0x13')](util[_0x4577('0x3')](_0x4577('0x1c'),_0x1e22bb[_0x4577('0x4')]),_0x2b2159);}};exports[_0x4577('0x23')]=function(_0x1c5c24){try{if(!_[_0x4577('0x16')](dials[_0x1c5c24[_0x4577('0x4')]])){utils['debug'](util[_0x4577('0x3')]('[%s][dials][dialend]',_0x1c5c24[_0x4577('0x4')]),_0x1c5c24);dials[_0x1c5c24[_0x4577('0x4')]][_0x4577('0x24')]=_0x1c5c24[_0x4577('0x24')];if(_0x1c5c24[_0x4577('0x24')]=='ANSWER'){dials[_0x1c5c24['uniqueid']]=_[_0x4577('0x1d')](dials[_0x1c5c24[_0x4577('0x4')]],_0x1c5c24);dials[_0x1c5c24[_0x4577('0x4')]][_0x4577('0x25')]=utils['now']();dials[_0x1c5c24[_0x4577('0x4')]][_0x4577('0x20')]=_0x4577('0x26');utils[_0x4577('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x1c5c24[_0x4577('0x4')],_0x1c5c24[_0x4577('0x24')],dials[_0x1c5c24[_0x4577('0x4')]]['answertime']));}else{utils[_0x4577('0x2')](util[_0x4577('0x3')](_0x4577('0x27'),_0x1c5c24[_0x4577('0x4')],_0x1c5c24[_0x4577('0x24')]));}}}catch(_0xca4857){utils[_0x4577('0x13')](util['format']('[%s][dials][dialend]',_0x1c5c24[_0x4577('0x4')]),_0xca4857);}};exports[_0x4577('0x28')]=function(_0x42a872){try{if(!_[_0x4577('0x16')](dials[_0x42a872[_0x4577('0x4')]])){utils[_0x4577('0x9')](util[_0x4577('0x3')]('[%s][dials][hangup]',_0x42a872[_0x4577('0x4')]),_0x42a872);utils['info'](util[_0x4577('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x42a872['uniqueid'],_0x42a872[_0x4577('0x29')],_0x42a872[_0x4577('0x2a')],_0x42a872[_0x4577('0x2b')]));dials[_0x42a872['uniqueid']]=_[_0x4577('0x1d')](dials[_0x42a872[_0x4577('0x4')]],{'endtime':utils[_0x4577('0x1f')](),'lastevent':_0x4577('0x2c')});dials[_0x42a872[_0x4577('0x4')]][_0x4577('0x2d')]=utils[_0x4577('0x2e')](dials[_0x42a872[_0x4577('0x4')]][_0x4577('0x2f')],dials[_0x42a872['uniqueid']]['starttime']);dials[_0x42a872[_0x4577('0x4')]][_0x4577('0x30')]=utils[_0x4577('0x2e')](dials[_0x42a872['uniqueid']][_0x4577('0x25')]||dials[_0x42a872['uniqueid']][_0x4577('0x2f')],dials[_0x42a872[_0x4577('0x4')]][_0x4577('0x1e')]);dials[_0x42a872['uniqueid']]['billableseconds']=dials[_0x42a872[_0x4577('0x4')]]['answertime']?utils[_0x4577('0x2e')](dials[_0x42a872[_0x4577('0x4')]]['endtime'],dials[_0x42a872['uniqueid']][_0x4577('0x25')]):0x0;writeDB(dials[_0x42a872[_0x4577('0x4')]]);}}catch(_0x482dd3){utils[_0x4577('0x13')](util[_0x4577('0x3')](_0x4577('0x31'),_0x42a872['uniqueid']),_0x482dd3);}}; \ No newline at end of file +var _0x0c3a=['dialstatus','request','CreateVoiceDialReport','uniqueid','debug','[%s][dials][newexten]','appdata','toLowerCase','startsWith','split','error','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','billableseconds','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0c3a,0xb3));var _0xa0c3=function(_0x4f320f,_0x56c1f6){_0x4f320f=_0x4f320f-0x0;var _0x341c69=_0x0c3a[_0x4f320f];return _0x341c69;};'use strict';var _=require(_0xa0c3('0x0'));var util=require(_0xa0c3('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x44ec1d){utils[_0xa0c3('0x2')](util[_0xa0c3('0x3')](_0xa0c3('0x4'),_0x44ec1d['uniqueid'],_0x44ec1d[_0xa0c3('0x5')],_0x44ec1d[_0xa0c3('0x6')],_0x44ec1d[_0xa0c3('0x7')],_0x44ec1d[_0xa0c3('0x8')],_0x44ec1d[_0xa0c3('0x9')]));utils[_0xa0c3('0xa')](_0xa0c3('0xb'),_0x44ec1d);delete dials[_0x44ec1d[_0xa0c3('0xc')]];}exports['newexten']=function(_0x509d84){try{utils[_0xa0c3('0xd')](util[_0xa0c3('0x3')](_0xa0c3('0xe'),_0x509d84[_0xa0c3('0xc')]),_0x509d84);utils[_0xa0c3('0x2')](util[_0xa0c3('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x509d84[_0xa0c3('0xc')],_0x509d84['application'],_0x509d84[_0xa0c3('0xf')]));if(_0x509d84['application'][_0xa0c3('0x10')]()=='set'&&_[_0xa0c3('0x11')](_0x509d84['appdata'][_0xa0c3('0x10')](),'cdr(routeid)')){var _0x46c2da=_0x509d84[_0xa0c3('0xf')][_0xa0c3('0x12')]('=');dials[_0x509d84[_0xa0c3('0xc')]]={'routeId':_0x46c2da[0x1]};}}catch(_0x27efb4){utils[_0xa0c3('0x13')](util[_0xa0c3('0x3')](_0xa0c3('0xe'),_0x509d84[_0xa0c3('0xc')]),_0x27efb4);}};exports['varset']=function(_0x5bc0fe){try{utils['debug'](util[_0xa0c3('0x3')](_0xa0c3('0x14'),_0x5bc0fe[_0xa0c3('0xc')]),_0x5bc0fe);if(!_[_0xa0c3('0x15')](_0x5bc0fe[_0xa0c3('0x16')][_0xa0c3('0x17')])){utils[_0xa0c3('0x2')](util[_0xa0c3('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x5bc0fe[_0xa0c3('0xc')],_0x5bc0fe[_0xa0c3('0x18')]));dials[_0x5bc0fe[_0xa0c3('0xc')]]={'routeId':_0x5bc0fe['value']};}}catch(_0x43a0a7){utils[_0xa0c3('0x13')](util[_0xa0c3('0x3')](_0xa0c3('0x14'),_0x5bc0fe[_0xa0c3('0xc')]),_0x43a0a7);}};exports[_0xa0c3('0x19')]=function(_0x5f7fb8){try{if(!_[_0xa0c3('0x15')](dials[_0x5f7fb8[_0xa0c3('0xc')]])){utils['debug'](util[_0xa0c3('0x3')]('[%s][dials][dialbegin]',_0x5f7fb8[_0xa0c3('0xc')]),_0x5f7fb8);dials[_0x5f7fb8[_0xa0c3('0xc')]]=_[_0xa0c3('0x1a')](dials[_0x5f7fb8[_0xa0c3('0xc')]],_0x5f7fb8);dials[_0x5f7fb8[_0xa0c3('0xc')]][_0xa0c3('0x1b')]=utils[_0xa0c3('0x1c')]();dials[_0x5f7fb8[_0xa0c3('0xc')]][_0xa0c3('0x1d')]=_0xa0c3('0x1e');utils['info'](util[_0xa0c3('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x5f7fb8['uniqueid'],dials[_0x5f7fb8['uniqueid']]['starttime']));}}catch(_0x23dca0){utils[_0xa0c3('0x13')](util[_0xa0c3('0x3')](_0xa0c3('0x1f'),_0x5f7fb8['uniqueid']),_0x23dca0);}};exports[_0xa0c3('0x20')]=function(_0x430c84){try{if(!_[_0xa0c3('0x15')](dials[_0x430c84[_0xa0c3('0xc')]])){utils[_0xa0c3('0xd')](util[_0xa0c3('0x3')](_0xa0c3('0x21'),_0x430c84[_0xa0c3('0xc')]),_0x430c84);dials[_0x430c84[_0xa0c3('0xc')]][_0xa0c3('0x9')]=_0x430c84['dialstatus'];if(_0x430c84[_0xa0c3('0x9')]=='ANSWER'){dials[_0x430c84[_0xa0c3('0xc')]]=_['assign'](dials[_0x430c84['uniqueid']],_0x430c84);dials[_0x430c84[_0xa0c3('0xc')]][_0xa0c3('0x22')]=utils['now']();dials[_0x430c84['uniqueid']][_0xa0c3('0x1d')]='connect';utils[_0xa0c3('0x2')](util[_0xa0c3('0x3')](_0xa0c3('0x23'),_0x430c84[_0xa0c3('0xc')],_0x430c84[_0xa0c3('0x9')],dials[_0x430c84[_0xa0c3('0xc')]][_0xa0c3('0x22')]));}else{utils[_0xa0c3('0x2')](util[_0xa0c3('0x3')](_0xa0c3('0x24'),_0x430c84[_0xa0c3('0xc')],_0x430c84[_0xa0c3('0x9')]));}}}catch(_0x4fb8b1){utils[_0xa0c3('0x13')](util['format']('[%s][dials][dialend]',_0x430c84[_0xa0c3('0xc')]),_0x4fb8b1);}};exports['hangup']=function(_0x423aa5){try{if(!_['isNil'](dials[_0x423aa5[_0xa0c3('0xc')]])){utils[_0xa0c3('0xd')](util['format'](_0xa0c3('0x25'),_0x423aa5[_0xa0c3('0xc')]),_0x423aa5);utils[_0xa0c3('0x2')](util['format'](_0xa0c3('0x26'),_0x423aa5['uniqueid'],_0x423aa5[_0xa0c3('0x7')],_0x423aa5[_0xa0c3('0x27')],_0x423aa5[_0xa0c3('0x28')]));dials[_0x423aa5[_0xa0c3('0xc')]]=_[_0xa0c3('0x1a')](dials[_0x423aa5['uniqueid']],{'endtime':utils[_0xa0c3('0x1c')](),'lastevent':_0xa0c3('0x29')});dials[_0x423aa5[_0xa0c3('0xc')]][_0xa0c3('0x2a')]=utils['diffTime'](dials[_0x423aa5['uniqueid']][_0xa0c3('0x2b')],dials[_0x423aa5[_0xa0c3('0xc')]]['starttime']);dials[_0x423aa5['uniqueid']][_0xa0c3('0x2c')]=utils[_0xa0c3('0x2d')](dials[_0x423aa5[_0xa0c3('0xc')]][_0xa0c3('0x22')]||dials[_0x423aa5[_0xa0c3('0xc')]]['endtime'],dials[_0x423aa5[_0xa0c3('0xc')]]['starttime']);dials[_0x423aa5[_0xa0c3('0xc')]][_0xa0c3('0x2e')]=dials[_0x423aa5[_0xa0c3('0xc')]][_0xa0c3('0x22')]?utils[_0xa0c3('0x2d')](dials[_0x423aa5[_0xa0c3('0xc')]][_0xa0c3('0x2b')],dials[_0x423aa5[_0xa0c3('0xc')]][_0xa0c3('0x22')]):0x0;writeDB(dials[_0x423aa5[_0xa0c3('0xc')]]);}}catch(_0x5ab8ac){utils[_0xa0c3('0x13')](util[_0xa0c3('0x3')](_0xa0c3('0x25'),_0x423aa5[_0xa0c3('0xc')]),_0x5ab8ac);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 38d49a5..6092e02 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 _0x98c3=['[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','./utils','util','xdr','disabled','production','local','asterisk','port','username','password','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','uniqueid','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','debug','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]'];(function(_0x26eaaf,_0x18f5af){var _0xff0850=function(_0x2c9f43){while(--_0x2c9f43){_0x26eaaf['push'](_0x26eaaf['shift']());}};_0xff0850(++_0x18f5af);}(_0x98c3,0x1f1));var _0x398c=function(_0x19091a,_0x48800c){_0x19091a=_0x19091a-0x0;var _0x227745=_0x98c3[_0x19091a];return _0x227745;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x398c('0x0'));var util=require(_0x398c('0x1'));var isXDREnabled=config['xdr']&&config[_0x398c('0x2')][_0x398c('0x3')]?!config['xdr'][_0x398c('0x3')]:!![];var isProduction=config['env']===_0x398c('0x4')||![];var isLocalAsterisk=config[_0x398c('0x2')]&&config['xdr'][_0x398c('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0x398c('0x6')][_0x398c('0x7')],config[_0x398c('0x6')]['ip'],config[_0x398c('0x6')][_0x398c('0x8')],config[_0x398c('0x6')][_0x398c('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x398c('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x398c('0xb'));}else{var agents=require(_0x398c('0xc'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x398c('0xd'));var members=require(_0x398c('0xe'));var dials=require(_0x398c('0xf'));var transfers=require(_0x398c('0x10'));var core=require(_0x398c('0x11'));ami['on']('connect',core['connect']);ami['on'](_0x398c('0x12'),core['shutdown']);ami['on'](_0x398c('0x13'),core['fullybooted']);ami['on'](_0x398c('0x14'),core[_0x398c('0x14')]);ami['on'](_0x398c('0x15'),core['close']);ami['on'](_0x398c('0x16'),core[_0x398c('0x16')]);ami['on'](_0x398c('0x17'),function(_0x42fb17){try{utils['debug'](util['format'](_0x398c('0x18'),_0x42fb17[_0x398c('0x19')]),_0x42fb17);members[_0x398c('0x17')](_0x42fb17);}catch(_0x22fdd3){utils['error'](util[_0x398c('0x1a')](_0x398c('0x18'),_0x42fb17[_0x398c('0x19')]),_0x22fdd3);}});ami['on']('agentcalled',function(_0x206edf){try{utils['debug'](util[_0x398c('0x1a')]('[%s][index][agentcalled]',_0x206edf[_0x398c('0x1b')]),_0x206edf);agents[_0x398c('0x1c')](_0x206edf);}catch(_0x48b00b){utils[_0x398c('0x14')](util[_0x398c('0x1a')](_0x398c('0x1d'),_0x206edf[_0x398c('0x1b')]),_0x48b00b);}});ami['on'](_0x398c('0x1e'),function(_0x44052d){try{utils['debug'](util['format'](_0x398c('0x1f'),_0x44052d['uniqueid']),_0x44052d);agents['agentringnoanswer'](_0x44052d);}catch(_0x47d940){utils[_0x398c('0x14')](util[_0x398c('0x1a')](_0x398c('0x1f'),_0x44052d['uniqueid']),_0x47d940);}});ami['on'](_0x398c('0x20'),function(_0x55ba63){try{utils[_0x398c('0x21')](util[_0x398c('0x1a')](_0x398c('0x22'),_0x55ba63['uniqueid']),_0x55ba63);agents['agentconnect'](_0x55ba63);queues[_0x398c('0x20')](_0x55ba63);}catch(_0x24333a){utils[_0x398c('0x14')](util[_0x398c('0x1a')](_0x398c('0x22'),_0x55ba63[_0x398c('0x1b')]),_0x24333a);}});ami['on'](_0x398c('0x23'),function(_0x561a75){try{utils[_0x398c('0x21')](util[_0x398c('0x1a')](_0x398c('0x24'),_0x561a75[_0x398c('0x1b')]),_0x561a75);agents['agentcomplete'](_0x561a75);queues[_0x398c('0x23')](_0x561a75);members['agentcomplete'](_0x561a75);}catch(_0x30c923){utils['error'](util[_0x398c('0x1a')](_0x398c('0x24'),_0x561a75[_0x398c('0x1b')]),_0x30c923);}});ami['on'](_0x398c('0x25'),function(_0x32bb0d){try{utils[_0x398c('0x21')](util[_0x398c('0x1a')]('[%s][index][queuecallerabandon]',_0x32bb0d['uniqueid']),_0x32bb0d);agents['queuecallerabandon'](_0x32bb0d);queues['queuecallerabandon'](_0x32bb0d);}catch(_0xa439ed){utils['error'](util[_0x398c('0x1a')](_0x398c('0x26'),_0x32bb0d[_0x398c('0x1b')]),_0xa439ed);}});ami['on']('queuecallerjoin',function(_0x4003d7){try{utils[_0x398c('0x21')](util[_0x398c('0x1a')](_0x398c('0x27'),_0x4003d7[_0x398c('0x1b')]),_0x4003d7);queues['queuecallerjoin'](_0x4003d7);recordings[_0x398c('0x28')](_0x4003d7);}catch(_0x4293fe){utils[_0x398c('0x14')](util[_0x398c('0x1a')]('[%s][index][queuecallerjoin]',_0x4003d7[_0x398c('0x1b')]),_0x4293fe);}});ami['on'](_0x398c('0x29'),function(_0x11bb1e){try{utils[_0x398c('0x21')](util[_0x398c('0x1a')](_0x398c('0x2a'),_0x11bb1e[_0x398c('0x1b')]),_0x11bb1e);queues['queuecallerleave'](_0x11bb1e);}catch(_0x3b887f){utils[_0x398c('0x14')](util['format']('[%s][index][queuecallerleave]',_0x11bb1e['uniqueid']),_0x3b887f);}});ami['on'](_0x398c('0x2b'),function(_0x353dd0){try{utils[_0x398c('0x21')](util[_0x398c('0x1a')]('[%s][index][musiconholdstart]',_0x353dd0[_0x398c('0x1b')]),_0x353dd0);queues['musiconholdstart'](_0x353dd0);calls[_0x398c('0x2b')](_0x353dd0);}catch(_0x5e318d){utils[_0x398c('0x14')](util[_0x398c('0x1a')](_0x398c('0x2c'),_0x353dd0[_0x398c('0x1b')]),_0x5e318d);}});ami['on'](_0x398c('0x2d'),function(_0x3826eb){try{utils['debug'](util['format'](_0x398c('0x2e'),_0x3826eb['uniqueid']),_0x3826eb);queues[_0x398c('0x2d')](_0x3826eb);calls[_0x398c('0x2d')](_0x3826eb);}catch(_0x4871c1){utils[_0x398c('0x14')](util['format'](_0x398c('0x2e'),_0x3826eb[_0x398c('0x1b')]),_0x4871c1);}});ami['on'](_0x398c('0x2f'),function(_0x5e38e2){try{utils[_0x398c('0x21')](util['format'](_0x398c('0x30'),_0x5e38e2['uniqueid']),_0x5e38e2);calls['newstate'](_0x5e38e2);recordings[_0x398c('0x2f')](_0x5e38e2);}catch(_0x1569e9){utils[_0x398c('0x14')](util[_0x398c('0x1a')](_0x398c('0x30'),_0x5e38e2[_0x398c('0x1b')]),_0x1569e9);}});ami['on']('hangup',function(_0x4cef61){try{utils['debug'](util[_0x398c('0x1a')]('[%s][index][hangup]',_0x4cef61[_0x398c('0x1b')]),_0x4cef61);calls[_0x398c('0x31')](_0x4cef61);recordings[_0x398c('0x31')](_0x4cef61);dials[_0x398c('0x31')](_0x4cef61);agents[_0x398c('0x31')](_0x4cef61);queues['hangup'](_0x4cef61);}catch(_0x53d843){utils[_0x398c('0x14')](util['format'](_0x398c('0x32'),_0x4cef61['uniqueid']),_0x53d843);}});ami['on'](_0x398c('0x33'),function(_0x5ac5d4){try{utils[_0x398c('0x21')](util['format'](_0x398c('0x34'),_0x5ac5d4[_0x398c('0x1b')]),_0x5ac5d4);members[_0x398c('0x33')](_0x5ac5d4);}catch(_0x119f32){utils[_0x398c('0x14')](util[_0x398c('0x1a')](_0x398c('0x34'),_0x5ac5d4[_0x398c('0x1b')]),_0x119f32);}});ami['on'](_0x398c('0x35'),function(_0x3bb3e5){try{utils[_0x398c('0x21')](util['format'](_0x398c('0x36'),_0x3bb3e5[_0x398c('0x1b')]),_0x3bb3e5);queues['blindtransfer'](_0x3bb3e5);agents[_0x398c('0x35')](_0x3bb3e5);transfers[_0x398c('0x35')](_0x3bb3e5);}catch(_0x283a79){utils[_0x398c('0x14')](util['format']('[%s][index][blindtransfer]',_0x3bb3e5[_0x398c('0x1b')]),_0x283a79);}});ami['on'](_0x398c('0x37'),function(_0x384147){try{utils[_0x398c('0x21')](util[_0x398c('0x1a')](_0x398c('0x38'),_0x384147['origtransfereruniqueid']),_0x384147);queues[_0x398c('0x37')](_0x384147);transfers[_0x398c('0x37')](_0x384147);agents[_0x398c('0x37')](_0x384147);calls[_0x398c('0x37')](_0x384147);}catch(_0x4219c8){utils['error'](util['format'](_0x398c('0x38'),_0x384147[_0x398c('0x39')]),_0x4219c8);}});ami['on'](_0x398c('0x3a'),function(_0xcd94c1){try{utils[_0x398c('0x21')](util[_0x398c('0x1a')]('[%s][index][varset]',_0xcd94c1[_0x398c('0x1b')]),_0xcd94c1);queues[_0x398c('0x3a')](_0xcd94c1);recordings[_0x398c('0x3a')](_0xcd94c1);calls[_0x398c('0x3a')](_0xcd94c1);dials[_0x398c('0x3a')](_0xcd94c1);}catch(_0x1f9236){utils[_0x398c('0x14')](util[_0x398c('0x1a')]('[%s][index][varset]',_0xcd94c1[_0x398c('0x1b')]),_0x1f9236);}});ami['on'](_0x398c('0x3b'),function(_0x53b56a){try{utils[_0x398c('0x21')](util[_0x398c('0x1a')]('[%s][index][newexten]',_0x53b56a[_0x398c('0x1b')]),_0x53b56a);calls[_0x398c('0x3b')](_0x53b56a);recordings[_0x398c('0x3b')](_0x53b56a);dials[_0x398c('0x3b')](_0x53b56a);}catch(_0x259df3){utils[_0x398c('0x14')](util[_0x398c('0x1a')]('[%s][index][newexten]',_0x53b56a[_0x398c('0x1b')]),_0x259df3);}});ami['on'](_0x398c('0x3c'),function(_0x234252){try{utils[_0x398c('0x21')](util[_0x398c('0x1a')](_0x398c('0x3d'),_0x234252[_0x398c('0x1b')]),_0x234252);calls[_0x398c('0x3c')](_0x234252);recordings['newchannel'](_0x234252);}catch(_0x28311c){utils[_0x398c('0x14')](util[_0x398c('0x1a')]('[%s][index][newchannel]',_0x234252[_0x398c('0x1b')]),_0x28311c);}});ami['on']('dialbegin',function(_0x413c63){try{utils[_0x398c('0x21')](util[_0x398c('0x1a')](_0x398c('0x3e'),_0x413c63[_0x398c('0x1b')]),_0x413c63);dials[_0x398c('0x3f')](_0x413c63);}catch(_0x2861d4){utils[_0x398c('0x14')](util['format'](_0x398c('0x40'),_0x413c63[_0x398c('0x1b')]),_0x2861d4);}});ami['on']('dialend',function(_0x5d65cd){try{utils[_0x398c('0x21')](util[_0x398c('0x1a')](_0x398c('0x41'),_0x5d65cd['uniqueid']),_0x5d65cd);dials[_0x398c('0x42')](_0x5d65cd);}catch(_0x1e9fe8){utils[_0x398c('0x14')](util['format']('[%s][index][dialend]',_0x5d65cd[_0x398c('0x1b')]),_0x1e9fe8);}});} \ No newline at end of file +var _0x7241=['./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','env','local','asterisk','username','password','XDR\x20DISABLED','info','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller'];(function(_0x5d233b,_0x223d8b){var _0xc4760d=function(_0x58ae57){while(--_0x58ae57){_0x5d233b['push'](_0x5d233b['shift']());}};_0xc4760d(++_0x223d8b);}(_0x7241,0x12a));var _0x1724=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x7241[_0x45d55e];return _0x29812a;};var AsteriskManager=require(_0x1724('0x0'));var config=require(_0x1724('0x1'));var utils=require(_0x1724('0x2'));var util=require(_0x1724('0x3'));var isXDREnabled=config['xdr']&&config[_0x1724('0x4')]['disabled']?!config[_0x1724('0x4')]['disabled']:!![];var isProduction=config[_0x1724('0x5')]==='production'||![];var isLocalAsterisk=config[_0x1724('0x4')]&&config['xdr'][_0x1724('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x1724('0x7')]['port'],config[_0x1724('0x7')]['ip'],config[_0x1724('0x7')][_0x1724('0x8')],config[_0x1724('0x7')][_0x1724('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x1724('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x1724('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x1724('0xc'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x1724('0xd'));var members=require(_0x1724('0xe'));var dials=require(_0x1724('0xf'));var transfers=require(_0x1724('0x10'));var core=require(_0x1724('0x11'));ami['on'](_0x1724('0x12'),core['connect']);ami['on'](_0x1724('0x13'),core[_0x1724('0x13')]);ami['on']('fullybooted',core[_0x1724('0x14')]);ami['on'](_0x1724('0x15'),core[_0x1724('0x15')]);ami['on'](_0x1724('0x16'),core[_0x1724('0x16')]);ami['on'](_0x1724('0x17'),core[_0x1724('0x17')]);ami['on'](_0x1724('0x18'),function(_0x46edb7){try{utils[_0x1724('0x19')](util['format']('[%s][index][devicestatechange]',_0x46edb7['device']),_0x46edb7);members[_0x1724('0x18')](_0x46edb7);}catch(_0x577338){utils[_0x1724('0x15')](util[_0x1724('0x1a')]('[%s][index][devicestatechange]',_0x46edb7[_0x1724('0x1b')]),_0x577338);}});ami['on'](_0x1724('0x1c'),function(_0x330907){try{utils[_0x1724('0x19')](util['format'](_0x1724('0x1d'),_0x330907[_0x1724('0x1e')]),_0x330907);agents[_0x1724('0x1c')](_0x330907);}catch(_0x5b9eac){utils[_0x1724('0x15')](util[_0x1724('0x1a')](_0x1724('0x1d'),_0x330907[_0x1724('0x1e')]),_0x5b9eac);}});ami['on']('agentringnoanswer',function(_0x37d6fd){try{utils[_0x1724('0x19')](util['format'](_0x1724('0x1f'),_0x37d6fd[_0x1724('0x1e')]),_0x37d6fd);agents['agentringnoanswer'](_0x37d6fd);}catch(_0x526a28){utils[_0x1724('0x15')](util[_0x1724('0x1a')](_0x1724('0x1f'),_0x37d6fd[_0x1724('0x1e')]),_0x526a28);}});ami['on'](_0x1724('0x20'),function(_0x5bd3f6){try{utils[_0x1724('0x19')](util[_0x1724('0x1a')](_0x1724('0x21'),_0x5bd3f6[_0x1724('0x1e')]),_0x5bd3f6);agents['agentconnect'](_0x5bd3f6);queues[_0x1724('0x20')](_0x5bd3f6);}catch(_0x1813cc){utils[_0x1724('0x15')](util[_0x1724('0x1a')](_0x1724('0x21'),_0x5bd3f6[_0x1724('0x1e')]),_0x1813cc);}});ami['on'](_0x1724('0x22'),function(_0x1a105c){try{utils[_0x1724('0x19')](util['format'](_0x1724('0x23'),_0x1a105c[_0x1724('0x1e')]),_0x1a105c);agents['agentcomplete'](_0x1a105c);queues[_0x1724('0x22')](_0x1a105c);members[_0x1724('0x22')](_0x1a105c);}catch(_0x317fdb){utils['error'](util[_0x1724('0x1a')](_0x1724('0x23'),_0x1a105c[_0x1724('0x1e')]),_0x317fdb);}});ami['on']('queuecallerabandon',function(_0x2fa4bd){try{utils[_0x1724('0x19')](util[_0x1724('0x1a')](_0x1724('0x24'),_0x2fa4bd['uniqueid']),_0x2fa4bd);agents[_0x1724('0x25')](_0x2fa4bd);queues[_0x1724('0x25')](_0x2fa4bd);}catch(_0x47da60){utils[_0x1724('0x15')](util[_0x1724('0x1a')](_0x1724('0x24'),_0x2fa4bd[_0x1724('0x1e')]),_0x47da60);}});ami['on'](_0x1724('0x26'),function(_0x3b32d9){try{utils[_0x1724('0x19')](util[_0x1724('0x1a')](_0x1724('0x27'),_0x3b32d9[_0x1724('0x1e')]),_0x3b32d9);queues[_0x1724('0x26')](_0x3b32d9);recordings[_0x1724('0x26')](_0x3b32d9);}catch(_0x2e292a){utils['error'](util['format'](_0x1724('0x27'),_0x3b32d9[_0x1724('0x1e')]),_0x2e292a);}});ami['on']('queuecallerleave',function(_0x699a8e){try{utils['debug'](util['format'](_0x1724('0x28'),_0x699a8e['uniqueid']),_0x699a8e);queues[_0x1724('0x29')](_0x699a8e);}catch(_0x2650b7){utils['error'](util['format'](_0x1724('0x28'),_0x699a8e[_0x1724('0x1e')]),_0x2650b7);}});ami['on'](_0x1724('0x2a'),function(_0x2dd84b){try{utils[_0x1724('0x19')](util['format'](_0x1724('0x2b'),_0x2dd84b['uniqueid']),_0x2dd84b);queues[_0x1724('0x2a')](_0x2dd84b);calls[_0x1724('0x2a')](_0x2dd84b);}catch(_0x2a772f){utils['error'](util[_0x1724('0x1a')](_0x1724('0x2b'),_0x2dd84b[_0x1724('0x1e')]),_0x2a772f);}});ami['on'](_0x1724('0x2c'),function(_0x263687){try{utils[_0x1724('0x19')](util[_0x1724('0x1a')](_0x1724('0x2d'),_0x263687[_0x1724('0x1e')]),_0x263687);queues[_0x1724('0x2c')](_0x263687);calls[_0x1724('0x2c')](_0x263687);}catch(_0x106412){utils[_0x1724('0x15')](util[_0x1724('0x1a')](_0x1724('0x2d'),_0x263687[_0x1724('0x1e')]),_0x106412);}});ami['on'](_0x1724('0x2e'),function(_0x33b46d){try{utils[_0x1724('0x19')](util[_0x1724('0x1a')](_0x1724('0x2f'),_0x33b46d[_0x1724('0x1e')]),_0x33b46d);calls['newstate'](_0x33b46d);recordings['newstate'](_0x33b46d);}catch(_0x37a5a5){utils['error'](util[_0x1724('0x1a')](_0x1724('0x2f'),_0x33b46d[_0x1724('0x1e')]),_0x37a5a5);}});ami['on']('hangup',function(_0x1b5018){try{utils[_0x1724('0x19')](util[_0x1724('0x1a')](_0x1724('0x30'),_0x1b5018['uniqueid']),_0x1b5018);calls['hangup'](_0x1b5018);recordings['hangup'](_0x1b5018);dials[_0x1724('0x31')](_0x1b5018);agents['hangup'](_0x1b5018);queues['hangup'](_0x1b5018);}catch(_0x258d25){utils[_0x1724('0x15')](util[_0x1724('0x1a')](_0x1724('0x30'),_0x1b5018['uniqueid']),_0x258d25);}});ami['on'](_0x1724('0x32'),function(_0x11f559){try{utils[_0x1724('0x19')](util[_0x1724('0x1a')]('[%s][index][cdr]',_0x11f559[_0x1724('0x1e')]),_0x11f559);members[_0x1724('0x32')](_0x11f559);}catch(_0x22e2c){utils[_0x1724('0x15')](util['format'](_0x1724('0x33'),_0x11f559[_0x1724('0x1e')]),_0x22e2c);}});ami['on'](_0x1724('0x34'),function(_0x584b96){try{utils[_0x1724('0x19')](util[_0x1724('0x1a')]('[%s][index][blindtransfer]',_0x584b96[_0x1724('0x1e')]),_0x584b96);queues[_0x1724('0x34')](_0x584b96);agents[_0x1724('0x34')](_0x584b96);transfers[_0x1724('0x34')](_0x584b96);}catch(_0x7ea67a){utils[_0x1724('0x15')](util[_0x1724('0x1a')](_0x1724('0x35'),_0x584b96[_0x1724('0x1e')]),_0x7ea67a);}});ami['on'](_0x1724('0x36'),function(_0x401c26){try{utils[_0x1724('0x19')](util[_0x1724('0x1a')](_0x1724('0x37'),_0x401c26[_0x1724('0x38')]),_0x401c26);queues[_0x1724('0x36')](_0x401c26);transfers[_0x1724('0x36')](_0x401c26);agents[_0x1724('0x36')](_0x401c26);calls[_0x1724('0x36')](_0x401c26);}catch(_0x122c58){utils[_0x1724('0x15')](util['format'](_0x1724('0x37'),_0x401c26[_0x1724('0x38')]),_0x122c58);}});ami['on']('varset',function(_0x591826){try{utils['debug'](util[_0x1724('0x1a')]('[%s][index][varset]',_0x591826[_0x1724('0x1e')]),_0x591826);queues['varset'](_0x591826);recordings[_0x1724('0x39')](_0x591826);calls[_0x1724('0x39')](_0x591826);dials['varset'](_0x591826);}catch(_0x330eae){utils['error'](util[_0x1724('0x1a')]('[%s][index][varset]',_0x591826[_0x1724('0x1e')]),_0x330eae);}});ami['on'](_0x1724('0x3a'),function(_0x47b032){try{utils[_0x1724('0x19')](util['format'](_0x1724('0x3b'),_0x47b032['uniqueid']),_0x47b032);calls[_0x1724('0x3a')](_0x47b032);recordings['newexten'](_0x47b032);dials[_0x1724('0x3a')](_0x47b032);}catch(_0x3baddf){utils[_0x1724('0x15')](util[_0x1724('0x1a')](_0x1724('0x3b'),_0x47b032[_0x1724('0x1e')]),_0x3baddf);}});ami['on']('newchannel',function(_0x5d08e9){try{utils[_0x1724('0x19')](util[_0x1724('0x1a')](_0x1724('0x3c'),_0x5d08e9[_0x1724('0x1e')]),_0x5d08e9);calls['newchannel'](_0x5d08e9);recordings[_0x1724('0x3d')](_0x5d08e9);}catch(_0x4f9e3d){utils[_0x1724('0x15')](util[_0x1724('0x1a')](_0x1724('0x3c'),_0x5d08e9[_0x1724('0x1e')]),_0x4f9e3d);}});ami['on']('dialbegin',function(_0x2a68f5){try{utils[_0x1724('0x19')](util['format']('[%s][index][dialbegin]',_0x2a68f5['uniqueid']),_0x2a68f5);dials['dialbegin'](_0x2a68f5);}catch(_0x3cae42){utils[_0x1724('0x15')](util[_0x1724('0x1a')]('[%s]dialbegin',_0x2a68f5[_0x1724('0x1e')]),_0x3cae42);}});ami['on'](_0x1724('0x3e'),function(_0x50a859){try{utils[_0x1724('0x19')](util[_0x1724('0x1a')]('[%s][index][dialend]',_0x50a859['uniqueid']),_0x50a859);dials[_0x1724('0x3e')](_0x50a859);}catch(_0x1e2326){utils['error'](util[_0x1724('0x1a')]('[%s][index][dialend]',_0x50a859[_0x1724('0x1e')]),_0x1e2326);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index d3d9ae8..7e69deb 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 _0x94b1=['data2','membername','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','request','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','info','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','debug','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','channel','split','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','assign','data1','type','[%s][members][cdr]','util','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface'];(function(_0x2306a6,_0x75134a){var _0x19d89e=function(_0x121319){while(--_0x121319){_0x2306a6['push'](_0x2306a6['shift']());}};_0x19d89e(++_0x75134a);}(_0x94b1,0x102));var _0x194b=function(_0x50183b,_0x236d69){_0x50183b=_0x50183b-0x0;var _0x32567f=_0x94b1[_0x50183b];return _0x32567f;};'use strict';var _=require('lodash');var util=require(_0x194b('0x0'));var utils=require('./utils');var members={};var exclude=[_0x194b('0x1'),_0x194b('0x2')];function writeDB(_0x3a7445){utils['info'](util[_0x194b('0x3')](_0x194b('0x4'),_0x3a7445[_0x194b('0x5')],_0x3a7445[_0x194b('0x6')],_0x3a7445['channel'],_0x3a7445[_0x194b('0x7')],_0x3a7445[_0x194b('0x8')],_0x3a7445['type']));if(_0x3a7445[_0x194b('0x6')]){utils[_0x194b('0x9')](_0x3a7445[_0x194b('0x6')])[_0x194b('0xa')](function(_0x20d6cd){if(_0x20d6cd){_0x3a7445[_0x194b('0x8')]=_0x20d6cd[_0x194b('0xb')];_0x3a7445[_0x194b('0xc')]=_0x20d6cd[_0x194b('0xc')];utils['request'](_0x194b('0xd'),_0x3a7445);}else{utils[_0x194b('0xe')](_0x3a7445[_0x194b('0x6')]['split']('/')[0x1])[_0x194b('0xa')](function(_0x331849){if(_0x331849){_0x3a7445[_0x194b('0x8')]=_0x331849[_0x194b('0xb')];_0x3a7445[_0x194b('0xc')]=_0x331849[_0x194b('0xc')];utils[_0x194b('0xf')](_0x194b('0xd'),_0x3a7445);}});}})[_0x194b('0x10')](function(_0x228392){utils[_0x194b('0x11')](util[_0x194b('0x3')](_0x194b('0x12'),_0x3a7445[_0x194b('0x5')]),_0x228392);});}delete members[_0x3a7445[_0x194b('0x6')]];}function startsWith(_0x15bac5,_0x1efd3f){return _[_0x194b('0x13')](_0x15bac5,function(_0x383579){return _[_0x194b('0x14')](_0x1efd3f,_0x383579);});}exports[_0x194b('0x15')]=function(_0x4a115a){try{utils['debug'](util[_0x194b('0x3')](_0x194b('0x16'),members[_0x4a115a[_0x194b('0x17')]]?members[_0x4a115a[_0x194b('0x17')]][_0x194b('0x5')]:_0x4a115a[_0x194b('0x17')]),_0x4a115a);utils[_0x194b('0x18')](util[_0x194b('0x3')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x4a115a[_0x194b('0x17')]]?members[_0x4a115a['device']][_0x194b('0x5')]:_0x4a115a[_0x194b('0x17')],_0x4a115a[_0x194b('0x19')],_0x4a115a[_0x194b('0x17')]));switch(_0x4a115a[_0x194b('0x19')]){case _0x194b('0x1a'):case _0x194b('0x1b'):if(!startsWith(exclude,_0x4a115a['device'])){members[_0x4a115a[_0x194b('0x17')]]={'channel':'voice','interface':_0x4a115a[_0x194b('0x17')],'type':_0x194b('0x1c'),'enterAt':utils[_0x194b('0x1d')](),'role':_0x194b('0x1e')};}break;case _0x194b('0x1f'):if(!_[_0x194b('0x20')](members[_0x4a115a[_0x194b('0x17')]])){members[_0x4a115a['device']][_0x194b('0x21')]=utils[_0x194b('0x1d')]();members[_0x4a115a[_0x194b('0x17')]][_0x194b('0x22')]=utils[_0x194b('0x23')](members[_0x4a115a[_0x194b('0x17')]][_0x194b('0x21')],members[_0x4a115a[_0x194b('0x17')]][_0x194b('0x24')]);if(members[_0x4a115a[_0x194b('0x17')]][_0x194b('0x5')]){writeDB(members[_0x4a115a[_0x194b('0x17')]]);}}break;default:break;}}catch(_0x3173e8){utils[_0x194b('0x11')](util[_0x194b('0x3')](_0x194b('0x16'),members[_0x4a115a[_0x194b('0x17')]]?members[_0x4a115a[_0x194b('0x17')]][_0x194b('0x5')]:_0x4a115a[_0x194b('0x17')]),_0x3173e8);}};exports[_0x194b('0x25')]=function(_0x59d2a8){try{if(!_[_0x194b('0x20')](members[_0x59d2a8[_0x194b('0x6')]])){utils[_0x194b('0x26')](util['format']('[%s][members][agentcomplete]',_0x59d2a8[_0x194b('0x5')]),_0x59d2a8);utils[_0x194b('0x18')](util[_0x194b('0x3')](_0x194b('0x27'),_0x59d2a8['uniqueid'],_0x59d2a8[_0x194b('0x6')],_0x59d2a8[_0x194b('0x28')]));members[_0x59d2a8[_0x194b('0x6')]]=_['assign'](members[_0x59d2a8['interface']],{'data4':_0x59d2a8[_0x194b('0x28')],'uniqueid':_0x59d2a8[_0x194b('0x5')]});}}catch(_0x45bb82){utils[_0x194b('0x11')](util[_0x194b('0x3')](_0x194b('0x29'),_0x59d2a8[_0x194b('0x5')]),_0x45bb82);}};exports[_0x194b('0x2a')]=function(_0x21915b){try{utils[_0x194b('0x26')](util[_0x194b('0x3')]('[%s][members][cdr]',_0x21915b[_0x194b('0x5')]),_0x21915b);if(_0x21915b['channel']){var _0x161192=_0x21915b[_0x194b('0x2b')][_0x194b('0x2c')]('-')[0x0];if(!_[_0x194b('0x20')](members[_0x161192])){members[_0x161192]=_['assign'](members[_0x161192],{'data1':members[_0x161192]['data1']||_0x21915b['type'],'data2':members[_0x161192][_0x194b('0x7')]||_0x21915b[_0x194b('0x2d')],'data3':members[_0x161192][_0x194b('0x2e')]||_0x21915b['destination'],'uniqueid':members[_0x161192][_0x194b('0x5')]||_0x21915b[_0x194b('0x5')]});utils['info'](util[_0x194b('0x3')](_0x194b('0x2f'),_0x21915b[_0x194b('0x5')],members[_0x161192]['data1'],members[_0x161192]['data2'],members[_0x161192][_0x194b('0x2e')]));if(members[_0x161192]['exitAt']){writeDB(members[_0x161192]);}}}if(_0x21915b[_0x194b('0x30')]){var _0x176730=_0x21915b[_0x194b('0x30')][_0x194b('0x2c')]('-')[0x0];if(!_[_0x194b('0x20')](members[_0x176730])){members[_0x176730]=_[_0x194b('0x31')](members[_0x176730],{'data1':members[_0x176730][_0x194b('0x32')]||_0x21915b[_0x194b('0x33')],'data2':members[_0x176730]['data2']||_0x21915b[_0x194b('0x2d')],'data3':members[_0x176730][_0x194b('0x2e')]||_0x21915b['destination'],'uniqueid':members[_0x176730][_0x194b('0x5')]||_0x21915b['uniqueid']});utils[_0x194b('0x18')](util[_0x194b('0x3')](_0x194b('0x2f'),_0x21915b[_0x194b('0x5')],members[_0x176730]['data1'],members[_0x176730]['data2'],members[_0x176730]['data3']));if(members[_0x176730][_0x194b('0x21')]){writeDB(members[_0x176730]);}}}}catch(_0x4ddcd8){utils[_0x194b('0x11')](util['format'](_0x194b('0x34'),_0x21915b['uniqueid']),_0x4ddcd8);}}; \ No newline at end of file +var _0x1625=['NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','cdr','[%s][members][cdr]','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','./utils','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','format','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now'];(function(_0x488e40,_0x473d0a){var _0x29f440=function(_0x2023f4){while(--_0x2023f4){_0x488e40['push'](_0x488e40['shift']());}};_0x29f440(++_0x473d0a);}(_0x1625,0xa7));var _0x5162=function(_0x39531f,_0x3e6ecd){_0x39531f=_0x39531f-0x0;var _0x519434=_0x1625[_0x39531f];return _0x519434;};'use strict';var _=require(_0x5162('0x0'));var util=require('util');var utils=require(_0x5162('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x5162('0x2')];function writeDB(_0x3869b7){utils[_0x5162('0x3')](util['format'](_0x5162('0x4'),_0x3869b7['uniqueid'],_0x3869b7[_0x5162('0x5')],_0x3869b7[_0x5162('0x6')],_0x3869b7[_0x5162('0x7')],_0x3869b7['membername'],_0x3869b7[_0x5162('0x8')]));if(_0x3869b7[_0x5162('0x5')]){utils[_0x5162('0x9')](_0x3869b7['interface'])[_0x5162('0xa')](function(_0x4588f0){if(_0x4588f0){_0x3869b7['membername']=_0x4588f0[_0x5162('0xb')];_0x3869b7[_0x5162('0xc')]=_0x4588f0['internal'];utils[_0x5162('0xd')](_0x5162('0xe'),_0x3869b7);}else{utils[_0x5162('0xf')](_0x3869b7[_0x5162('0x5')][_0x5162('0x10')]('/')[0x1])[_0x5162('0xa')](function(_0x2cded6){if(_0x2cded6){_0x3869b7['membername']=_0x2cded6[_0x5162('0xb')];_0x3869b7[_0x5162('0xc')]=_0x2cded6[_0x5162('0xc')];utils['request'](_0x5162('0xe'),_0x3869b7);}});}})[_0x5162('0x11')](function(_0x3ad5ef){utils[_0x5162('0x12')](util['format']('[%s][members][writeDB]',_0x3869b7['uniqueid']),_0x3ad5ef);});}delete members[_0x3869b7[_0x5162('0x5')]];}function startsWith(_0x5e0053,_0x2ec5b){return _[_0x5162('0x13')](_0x5e0053,function(_0x2ec27b){return _[_0x5162('0x14')](_0x2ec5b,_0x2ec27b);});}exports[_0x5162('0x15')]=function(_0x4284d8){try{utils[_0x5162('0x16')](util['format'](_0x5162('0x17'),members[_0x4284d8[_0x5162('0x18')]]?members[_0x4284d8['device']][_0x5162('0x19')]:_0x4284d8[_0x5162('0x18')]),_0x4284d8);utils['info'](util[_0x5162('0x1a')](_0x5162('0x1b'),members[_0x4284d8[_0x5162('0x18')]]?members[_0x4284d8[_0x5162('0x18')]]['uniqueid']:_0x4284d8[_0x5162('0x18')],_0x4284d8[_0x5162('0x1c')],_0x4284d8[_0x5162('0x18')]));switch(_0x4284d8[_0x5162('0x1c')]){case _0x5162('0x1d'):case'BUSY':if(!startsWith(exclude,_0x4284d8[_0x5162('0x18')])){members[_0x4284d8[_0x5162('0x18')]]={'channel':_0x5162('0x1e'),'interface':_0x4284d8[_0x5162('0x18')],'type':_0x5162('0x1f'),'enterAt':utils[_0x5162('0x20')](),'role':'agent'};}break;case _0x5162('0x21'):if(!_[_0x5162('0x22')](members[_0x4284d8[_0x5162('0x18')]])){members[_0x4284d8['device']][_0x5162('0x23')]=utils[_0x5162('0x20')]();members[_0x4284d8['device']]['duration']=utils[_0x5162('0x24')](members[_0x4284d8[_0x5162('0x18')]]['exitAt'],members[_0x4284d8[_0x5162('0x18')]][_0x5162('0x25')]);if(members[_0x4284d8[_0x5162('0x18')]][_0x5162('0x19')]){writeDB(members[_0x4284d8['device']]);}}break;default:break;}}catch(_0x15a052){utils[_0x5162('0x12')](util['format'](_0x5162('0x17'),members[_0x4284d8[_0x5162('0x18')]]?members[_0x4284d8[_0x5162('0x18')]][_0x5162('0x19')]:_0x4284d8[_0x5162('0x18')]),_0x15a052);}};exports[_0x5162('0x26')]=function(_0x185601){try{if(!_[_0x5162('0x22')](members[_0x185601['interface']])){utils['debug'](util['format'](_0x5162('0x27'),_0x185601[_0x5162('0x19')]),_0x185601);utils[_0x5162('0x3')](util['format'](_0x5162('0x28'),_0x185601[_0x5162('0x19')],_0x185601[_0x5162('0x5')],_0x185601['queue']));members[_0x185601[_0x5162('0x5')]]=_[_0x5162('0x29')](members[_0x185601[_0x5162('0x5')]],{'data4':_0x185601['queue'],'uniqueid':_0x185601[_0x5162('0x19')]});}}catch(_0x56fc82){utils[_0x5162('0x12')](util[_0x5162('0x1a')](_0x5162('0x27'),_0x185601[_0x5162('0x19')]),_0x56fc82);}};exports[_0x5162('0x2a')]=function(_0x459a78){try{utils[_0x5162('0x16')](util[_0x5162('0x1a')](_0x5162('0x2b'),_0x459a78['uniqueid']),_0x459a78);if(_0x459a78['channel']){var _0x22d3ec=_0x459a78['channel'][_0x5162('0x10')]('-')[0x0];if(!_[_0x5162('0x22')](members[_0x22d3ec])){members[_0x22d3ec]=_[_0x5162('0x29')](members[_0x22d3ec],{'data1':members[_0x22d3ec][_0x5162('0x2c')]||_0x459a78[_0x5162('0x8')],'data2':members[_0x22d3ec][_0x5162('0x7')]||_0x459a78[_0x5162('0x2d')],'data3':members[_0x22d3ec][_0x5162('0x2e')]||_0x459a78[_0x5162('0x2f')],'uniqueid':members[_0x22d3ec][_0x5162('0x19')]||_0x459a78[_0x5162('0x19')]});utils[_0x5162('0x3')](util[_0x5162('0x1a')](_0x5162('0x30'),_0x459a78['uniqueid'],members[_0x22d3ec]['data1'],members[_0x22d3ec]['data2'],members[_0x22d3ec]['data3']));if(members[_0x22d3ec][_0x5162('0x23')]){writeDB(members[_0x22d3ec]);}}}if(_0x459a78['destinationchannel']){var _0x2b02fa=_0x459a78[_0x5162('0x31')][_0x5162('0x10')]('-')[0x0];if(!_[_0x5162('0x22')](members[_0x2b02fa])){members[_0x2b02fa]=_[_0x5162('0x29')](members[_0x2b02fa],{'data1':members[_0x2b02fa]['data1']||_0x459a78['type'],'data2':members[_0x2b02fa][_0x5162('0x7')]||_0x459a78['source'],'data3':members[_0x2b02fa][_0x5162('0x2e')]||_0x459a78[_0x5162('0x2f')],'uniqueid':members[_0x2b02fa]['uniqueid']||_0x459a78[_0x5162('0x19')]});utils['info'](util[_0x5162('0x1a')](_0x5162('0x30'),_0x459a78['uniqueid'],members[_0x2b02fa]['data1'],members[_0x2b02fa]['data2'],members[_0x2b02fa][_0x5162('0x2e')]));if(members[_0x2b02fa]['exitAt']){writeDB(members[_0x2b02fa]);}}}}catch(_0x1bed98){utils[_0x5162('0x12')](util[_0x5162('0x1a')](_0x5162('0x2b'),_0x459a78['uniqueid']),_0x1bed98);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6e9d432..44f92b1 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 _0xbc0b=['./utils','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','error','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','count','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','agentcomplete','reason','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util'];(function(_0x44f443,_0x270115){var _0x5e5b2f=function(_0x38a012){while(--_0x38a012){_0x44f443['push'](_0x44f443['shift']());}};_0x5e5b2f(++_0x270115);}(_0xbc0b,0x1a2));var _0xbbc0=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xbc0b[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xbbc0('0x0'));var util=require(_0xbbc0('0x1'));var utils=require(_0xbbc0('0x2'));var queues={};function writeDB(_0x1da1de){utils['info'](util['format']('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x1da1de[_0xbbc0('0x3')],_0x1da1de[_0xbbc0('0x4')],_0x1da1de[_0xbbc0('0x5')],_0x1da1de[_0xbbc0('0x6')],_0x1da1de[_0xbbc0('0x7')],_0x1da1de['accountcode'],_0x1da1de[_0xbbc0('0x8')]));if(_0x1da1de[_0xbbc0('0x5')]){utils[_0xbbc0('0x9')](_0x1da1de['queue'])[_0xbbc0('0xa')](function(_0x2d4b9f){if(_0x2d4b9f){_0x1da1de[_0xbbc0('0xb')]=_0x2d4b9f[_0xbbc0('0xb')];}utils[_0xbbc0('0xc')](_0xbbc0('0xd'),_0x1da1de);});}else{utils[_0xbbc0('0xc')](_0xbbc0('0xd'),_0x1da1de);}if(_0x1da1de['transfereduniqueid']){delete queues[_0x1da1de[_0xbbc0('0xe')]];}else{delete queues[_0x1da1de[_0xbbc0('0x3')]];}}exports[_0xbbc0('0xf')]=function(_0x5a0122){try{utils[_0xbbc0('0x10')](util[_0xbbc0('0x11')](_0xbbc0('0x12'),_0x5a0122[_0xbbc0('0x3')]),_0x5a0122);utils[_0xbbc0('0x13')](util[_0xbbc0('0x11')](_0xbbc0('0x14'),_0x5a0122[_0xbbc0('0x3')],_0x5a0122['queue'],_0x5a0122[_0xbbc0('0x15')]));queues[_0x5a0122[_0xbbc0('0x3')]]=_[_0xbbc0('0x16')](_0x5a0122,{'originalposition':_0x5a0122[_0xbbc0('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0xb49c0){utils['error'](util[_0xbbc0('0x11')](_0xbbc0('0x12'),_0x5a0122['uniqueid']),_0xb49c0);}};exports['hangup']=function(_0xb551be){try{if(!_['isNil'](queues[_0xb551be[_0xbbc0('0x3')]])){utils['debug'](util[_0xbbc0('0x11')](_0xbbc0('0x17'),_0xb551be['uniqueid']),_0xb551be);if(queues[_0xb551be[_0xbbc0('0x3')]][_0xbbc0('0x18')]){if(!queues[_0xb551be[_0xbbc0('0x3')]][_0xbbc0('0x19')]&&!queues[_0xb551be[_0xbbc0('0x3')]][_0xbbc0('0x1a')]){queues[_0xb551be['uniqueid']][_0xbbc0('0x1b')]=!![];queues[_0xb551be[_0xbbc0('0x3')]][_0xbbc0('0x1c')]=utils[_0xbbc0('0x1d')]();queues[_0xb551be[_0xbbc0('0x3')]][_0xbbc0('0x8')]='COMPLETEDBYAGENT';}utils[_0xbbc0('0x13')](util[_0xbbc0('0x11')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0xb551be[_0xbbc0('0x3')],queues[_0xb551be[_0xbbc0('0x3')]][_0xbbc0('0x1e')],queues[_0xb551be[_0xbbc0('0x3')]][_0xbbc0('0x8')]));writeDB(queues[_0xb551be[_0xbbc0('0x3')]]);}else if(queues[_0xb551be['uniqueid']][_0xbbc0('0xe')]){utils['info'](util[_0xbbc0('0x11')](_0xbbc0('0x1f'),_0xb551be[_0xbbc0('0x3')],queues[_0xb551be['uniqueid']]['name'],queues[_0xb551be[_0xbbc0('0x3')]][_0xbbc0('0xe')]));queues[queues[_0xb551be[_0xbbc0('0x3')]]['transfereduniqueid']]=queues[_0xb551be[_0xbbc0('0x3')]];queues[queues[_0xb551be[_0xbbc0('0x3')]][_0xbbc0('0xe')]][_0xbbc0('0x20')]=0x2;delete queues[_0xb551be[_0xbbc0('0x3')]];}}}catch(_0x54e1ab){utils['error'](util['format'](_0xbbc0('0x17'),_0xb551be['uniqueid']),_0x54e1ab);}};exports['varset']=function(_0x5d7f2c){try{utils['debug'](util[_0xbbc0('0x11')](_0xbbc0('0x21'),_0x5d7f2c[_0xbbc0('0x3')]),_0x5d7f2c);if(!_[_0xbbc0('0x22')](_0x5d7f2c[_0xbbc0('0x23')][_0xbbc0('0x24')])&&_0x5d7f2c[_0xbbc0('0x25')][_0xbbc0('0x26')]()!==_0xbbc0('0x27')){if(!_[_0xbbc0('0x22')](queues[_0x5d7f2c[_0xbbc0('0x3')]])){queues[_0x5d7f2c['uniqueid']]['queuecallerabandon']=![];queues[_0x5d7f2c[_0xbbc0('0x3')]][_0xbbc0('0x28')]=null;queues[_0x5d7f2c[_0xbbc0('0x3')]][_0xbbc0('0x1a')]=!![];queues[_0x5d7f2c[_0xbbc0('0x3')]][_0xbbc0('0x29')]=utils[_0xbbc0('0x1d')]();queues[_0x5d7f2c[_0xbbc0('0x3')]][_0xbbc0('0x8')]=_0x5d7f2c[_0xbbc0('0x25')][_0xbbc0('0x26')]();utils[_0xbbc0('0x13')](util[_0xbbc0('0x11')](_0xbbc0('0x2a'),_0x5d7f2c[_0xbbc0('0x3')],queues[_0x5d7f2c[_0xbbc0('0x3')]][_0xbbc0('0x1e')],_0x5d7f2c['value'],queues[_0x5d7f2c['uniqueid']][_0xbbc0('0x8')]));writeDB(queues[_0x5d7f2c[_0xbbc0('0x3')]]);}}else if(!_[_0xbbc0('0x22')](_0x5d7f2c['variable'][_0xbbc0('0x2b')])){if(!_[_0xbbc0('0x22')](queues[_0x5d7f2c[_0xbbc0('0x3')]])&&!queues[_0x5d7f2c['uniqueid']][_0xbbc0('0x19')]){queues[_0x5d7f2c[_0xbbc0('0x3')]][_0xbbc0('0x19')]=![];queues[_0x5d7f2c[_0xbbc0('0x3')]][_0xbbc0('0x28')]=null;queues[_0x5d7f2c[_0xbbc0('0x3')]]['queuecallerexit']=!![];queues[_0x5d7f2c['uniqueid']][_0xbbc0('0x29')]=utils['now']();queues[_0x5d7f2c[_0xbbc0('0x3')]][_0xbbc0('0x8')]=_0xbbc0('0x2c');utils[_0xbbc0('0x13')](util[_0xbbc0('0x11')](_0xbbc0('0x2d'),_0x5d7f2c[_0xbbc0('0x3')],queues[_0x5d7f2c[_0xbbc0('0x3')]][_0xbbc0('0x1e')],_0x5d7f2c['value'],queues[_0x5d7f2c['uniqueid']]['queuecallerexitreason']));}}}catch(_0x34695e){utils[_0xbbc0('0x2e')](util[_0xbbc0('0x11')](_0xbbc0('0x21'),_0x5d7f2c[_0xbbc0('0x3')]),_0x34695e);}};exports[_0xbbc0('0x19')]=function(_0x5e4065){try{if(!_[_0xbbc0('0x22')](queues[_0x5e4065[_0xbbc0('0x3')]])){utils[_0xbbc0('0x10')](util[_0xbbc0('0x11')](_0xbbc0('0x2f'),_0x5e4065['uniqueid']),_0x5e4065);queues[_0x5e4065[_0xbbc0('0x3')]][_0xbbc0('0x1a')]=![];queues[_0x5e4065[_0xbbc0('0x3')]]['queuecallerexitAt']=null;queues[_0x5e4065[_0xbbc0('0x3')]][_0xbbc0('0x19')]=!![];queues[_0x5e4065['uniqueid']][_0xbbc0('0x28')]=utils[_0xbbc0('0x1d')]();queues[_0x5e4065['uniqueid']][_0xbbc0('0x8')]=_0xbbc0('0x30');utils[_0xbbc0('0x13')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x5e4065[_0xbbc0('0x3')],queues[_0x5e4065['uniqueid']]['name'],queues[_0x5e4065[_0xbbc0('0x3')]][_0xbbc0('0x8')]));}}catch(_0x533a66){utils[_0xbbc0('0x2e')](util[_0xbbc0('0x11')](_0xbbc0('0x2f'),_0x5e4065['uniqueid']),_0x533a66);}};exports[_0xbbc0('0x31')]=function(_0x4f9801){try{if(!_[_0xbbc0('0x22')](queues[_0x4f9801['uniqueid']])){utils['debug'](util[_0xbbc0('0x11')]('[%s][queues][queuecallerleave]',_0x4f9801['uniqueid']),_0x4f9801);utils['info'](util[_0xbbc0('0x11')](_0xbbc0('0x32'),_0x4f9801['uniqueid'],queues[_0x4f9801['uniqueid']]['name'],_0x4f9801[_0xbbc0('0x33')],_0x4f9801[_0xbbc0('0x34')]));queues[_0x4f9801[_0xbbc0('0x3')]][_0xbbc0('0x31')]=!![];queues[_0x4f9801[_0xbbc0('0x3')]][_0xbbc0('0x18')]=utils[_0xbbc0('0x1d')]();queues[_0x4f9801[_0xbbc0('0x3')]][_0xbbc0('0x35')]=utils[_0xbbc0('0x36')](queues[_0x4f9801[_0xbbc0('0x3')]][_0xbbc0('0x18')],queues[_0x4f9801[_0xbbc0('0x3')]]['queuecallerjoinAt']);queues[_0x4f9801[_0xbbc0('0x3')]][_0xbbc0('0x15')]=_0x4f9801[_0xbbc0('0x15')];queues[_0x4f9801[_0xbbc0('0x3')]][_0xbbc0('0x37')]=_0x4f9801['count'];queues[_0x4f9801[_0xbbc0('0x3')]][_0xbbc0('0x33')]=_0x4f9801[_0xbbc0('0x33')];queues[_0x4f9801[_0xbbc0('0x3')]][_0xbbc0('0x34')]=_0x4f9801['connectedlinename'];}}catch(_0x3f599b){utils['error'](util[_0xbbc0('0x11')](_0xbbc0('0x38'),_0x4f9801[_0xbbc0('0x3')]),_0x3f599b);}};exports['agentconnect']=function(_0x53ec64){try{if(!_[_0xbbc0('0x22')](queues[_0x53ec64['uniqueid']])){utils['debug'](util[_0xbbc0('0x11')](_0xbbc0('0x39'),_0x53ec64[_0xbbc0('0x3')]),_0x53ec64);utils[_0xbbc0('0x13')](util[_0xbbc0('0x11')](_0xbbc0('0x3a'),_0x53ec64['uniqueid'],queues[_0x53ec64[_0xbbc0('0x3')]][_0xbbc0('0x1e')],_0x53ec64[_0xbbc0('0x3b')],_0x53ec64[_0xbbc0('0x3c')]));queues[_0x53ec64['uniqueid']][_0xbbc0('0x19')]=![];queues[_0x53ec64[_0xbbc0('0x3')]][_0xbbc0('0x19')]=![];queues[_0x53ec64[_0xbbc0('0x3')]][_0xbbc0('0x28')]=null;queues[_0x53ec64['uniqueid']][_0xbbc0('0x1a')]=![];queues[_0x53ec64[_0xbbc0('0x3')]][_0xbbc0('0x8')]=null;queues[_0x53ec64[_0xbbc0('0x3')]][_0xbbc0('0x29')]=null;queues[_0x53ec64['uniqueid']][_0xbbc0('0x3d')]=!![];queues[_0x53ec64[_0xbbc0('0x3')]][_0xbbc0('0x3e')]=_0x53ec64[_0xbbc0('0x3c')];queues[_0x53ec64[_0xbbc0('0x3')]][_0xbbc0('0x6')]=_0x53ec64['membername'];}}catch(_0x36bc77){utils[_0xbbc0('0x2e')](util[_0xbbc0('0x11')]('[%s][queues][agentconnect]',_0x53ec64[_0xbbc0('0x3')]),_0x36bc77);}};exports[_0xbbc0('0x3f')]=function(_0x5f4549){try{if(!_['isNil'](queues[_0x5f4549[_0xbbc0('0x3')]])){if(queues[_0x5f4549['uniqueid']][_0xbbc0('0x18')]){utils[_0xbbc0('0x10')](util[_0xbbc0('0x11')]('[%s][queues][agentcomplete]',_0x5f4549[_0xbbc0('0x3')]),_0x5f4549);queues[_0x5f4549[_0xbbc0('0x3')]][_0xbbc0('0x19')]=![];queues[_0x5f4549[_0xbbc0('0x3')]]['queuecallerabandon']=![];queues[_0x5f4549[_0xbbc0('0x3')]]['queuecallerabandonAt']=null;queues[_0x5f4549[_0xbbc0('0x3')]]['queuecallerexit']=![];queues[_0x5f4549[_0xbbc0('0x3')]][_0xbbc0('0x29')]=null;queues[_0x5f4549['uniqueid']][_0xbbc0('0x3d')]=!![];queues[_0x5f4549[_0xbbc0('0x3')]][_0xbbc0('0x6')]=_0x5f4549[_0xbbc0('0x3b')];queues[_0x5f4549[_0xbbc0('0x3')]][_0xbbc0('0x1b')]=!![];queues[_0x5f4549[_0xbbc0('0x3')]]['queuecallercompleteAt']=utils[_0xbbc0('0x1d')]();if(_0x5f4549[_0xbbc0('0x40')]==_0xbbc0('0x41')){if(!queues[_0x5f4549[_0xbbc0('0x3')]][_0xbbc0('0x41')]){queues[_0x5f4549[_0xbbc0('0x3')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x5f4549[_0xbbc0('0x3')]]['queuecallerexitreason']='COMPLETEDBY'+_0x5f4549[_0xbbc0('0x40')]['toUpperCase']();}utils['info'](util[_0xbbc0('0x11')](_0xbbc0('0x42'),_0x5f4549[_0xbbc0('0x3')],queues[_0x5f4549[_0xbbc0('0x3')]][_0xbbc0('0x1e')],_0x5f4549[_0xbbc0('0x3b')],queues[_0x5f4549[_0xbbc0('0x3')]][_0xbbc0('0x8')]));writeDB(queues[_0x5f4549['uniqueid']]);}}}catch(_0x1cb9b2){utils['error'](util['format'](_0xbbc0('0x43'),_0x5f4549['uniqueid']),_0x1cb9b2);}};exports[_0xbbc0('0x44')]=function(_0x19f0cc){try{if(!_[_0xbbc0('0x22')](queues[_0x19f0cc[_0xbbc0('0x45')]])){utils[_0xbbc0('0x10')](util[_0xbbc0('0x11')](_0xbbc0('0x46'),_0x19f0cc[_0xbbc0('0x3')]),_0x19f0cc);queues[_0x19f0cc[_0xbbc0('0x45')]]['transfer']=!![];queues[_0x19f0cc[_0xbbc0('0x45')]][_0xbbc0('0x47')]=_0xbbc0('0x48');queues[_0x19f0cc['transfereeuniqueid']][_0xbbc0('0x49')]=_0x19f0cc[_0xbbc0('0x4a')];queues[_0x19f0cc['transfereeuniqueid']][_0xbbc0('0x4b')]=_0x19f0cc['transfereeuniqueid'];queues[_0x19f0cc[_0xbbc0('0x45')]]['queuecallerexitreason']=_0xbbc0('0x4c');utils[_0xbbc0('0x13')](util[_0xbbc0('0x11')](_0xbbc0('0x4d'),_0x19f0cc[_0xbbc0('0x3')],queues[_0x19f0cc[_0xbbc0('0x45')]]['name'],_0x19f0cc[_0xbbc0('0x45')],_0x19f0cc[_0xbbc0('0x4a')]));}}catch(_0x5d405f){utils[_0xbbc0('0x2e')](util[_0xbbc0('0x11')](_0xbbc0('0x46'),_0x19f0cc[_0xbbc0('0x3')]),_0x5d405f);}};exports['attendedtransfer']=function(_0x34b945){try{utils['debug'](util['format'](_0xbbc0('0x4e'),_0x34b945[_0xbbc0('0x4f')]),_0x34b945);if(_0x34b945[_0xbbc0('0x4f')]==_0x34b945[_0xbbc0('0x50')]){if(!_[_0xbbc0('0x22')](queues[_0x34b945[_0xbbc0('0x51')]])){utils['info'](util['format'](_0xbbc0('0x52'),_0x34b945[_0xbbc0('0x4f')],queues[_0x34b945[_0xbbc0('0x51')]][_0xbbc0('0x1e')],_0x34b945[_0xbbc0('0x53')]));queues[_0x34b945['secondtransfererlinkedid']][_0xbbc0('0x41')]=!![];queues[_0x34b945['secondtransfererlinkedid']]['transfertype']=_0xbbc0('0x54');queues[_0x34b945[_0xbbc0('0x51')]][_0xbbc0('0x49')]=_0x34b945[_0xbbc0('0x53')];queues[_0x34b945[_0xbbc0('0x51')]]['transferuniqueid']=_0x34b945[_0xbbc0('0x4f')];queues[_0x34b945[_0xbbc0('0x51')]]['queuecallerexitreason']=_0xbbc0('0x55');}if(!_[_0xbbc0('0x22')](queues[_0x34b945[_0xbbc0('0x50')]])){if(_0x34b945[_0xbbc0('0x56')]&&queues[_0x34b945[_0xbbc0('0x56')]]){queues[_0x34b945[_0xbbc0('0x56')]]['queuecallerenterreason']=0x1;queues[_0x34b945['transfereeuniqueid']]=_['clone'](queues[_0x34b945[_0xbbc0('0x56')]]);queues[_0x34b945[_0xbbc0('0x45')]][_0xbbc0('0xe')]=_0x34b945[_0xbbc0('0x57')];queues[_0x34b945[_0xbbc0('0x45')]][_0xbbc0('0x20')]=0x2;queues[_0x34b945[_0xbbc0('0x45')]]['calleridnum']=queues[_0x34b945[_0xbbc0('0x51')]][_0xbbc0('0x7')];queues[_0x34b945[_0xbbc0('0x45')]]['calleridname']=queues[_0x34b945[_0xbbc0('0x51')]]['calleridname'];queues[_0x34b945[_0xbbc0('0x45')]][_0xbbc0('0x58')]=utils[_0xbbc0('0x1d')]();queues[_0x34b945[_0xbbc0('0x45')]][_0xbbc0('0x18')]=utils[_0xbbc0('0x1d')]();queues[_0x34b945[_0xbbc0('0x45')]][_0xbbc0('0x35')]=0x0;queues[_0x34b945[_0xbbc0('0x45')]][_0xbbc0('0x59')]=0x0;utils[_0xbbc0('0x13')](util[_0xbbc0('0x11')](_0xbbc0('0x5a'),_0x34b945['origtransfereruniqueid'],queues[_0x34b945['transfereeuniqueid']][_0xbbc0('0x1e')],queues[_0x34b945['transfereeuniqueid']][_0xbbc0('0x7')],queues[_0x34b945[_0xbbc0('0x45')]][_0xbbc0('0x5b')]));}else{utils[_0xbbc0('0x13')](util[_0xbbc0('0x11')](_0xbbc0('0x5c'),_0x34b945[_0xbbc0('0x4f')],queues[_0x34b945[_0xbbc0('0x50')]][_0xbbc0('0x1e')],_0x34b945[_0xbbc0('0x51')]));queues[_0x34b945[_0xbbc0('0x50')]][_0xbbc0('0xe')]=_0x34b945['secondtransfererlinkedid'];}}}else if(_0x34b945[_0xbbc0('0x5d')]==_0x34b945['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x34b945['origtransfererlinkedid']])){utils[_0xbbc0('0x13')](util['format'](_0xbbc0('0x5e'),_0x34b945[_0xbbc0('0x4f')],queues[_0x34b945[_0xbbc0('0x50')]][_0xbbc0('0x1e')],_0x34b945[_0xbbc0('0x5d')],_0x34b945[_0xbbc0('0x5f')]));queues[_0x34b945['origtransfererlinkedid']][_0xbbc0('0x41')]=!![];queues[_0x34b945[_0xbbc0('0x50')]][_0xbbc0('0x47')]='ATTENDED';queues[_0x34b945[_0xbbc0('0x50')]][_0xbbc0('0x49')]=_0x34b945['secondtransfererexten'];queues[_0x34b945[_0xbbc0('0x50')]][_0xbbc0('0x4b')]=_0x34b945['secondtransfereruniqueid'];queues[_0x34b945[_0xbbc0('0x50')]][_0xbbc0('0x8')]=_0xbbc0('0x55');}if(!_['isNil'](queues[_0x34b945[_0xbbc0('0x51')]])){if(_0x34b945[_0xbbc0('0x60')]&&queues[_0x34b945[_0xbbc0('0x60')]]){queues[_0x34b945[_0xbbc0('0x60')]][_0xbbc0('0x20')]=0x1;queues[_0x34b945[_0xbbc0('0x57')]]=_[_0xbbc0('0x61')](queues[_0x34b945['transfertargetlinkedid']]);queues[_0x34b945['transfertargetuniqueid']]['transfereduniqueid']=_0x34b945[_0xbbc0('0x57')];queues[_0x34b945[_0xbbc0('0x57')]][_0xbbc0('0x20')]=0x2;queues[_0x34b945[_0xbbc0('0x57')]][_0xbbc0('0x7')]=queues[_0x34b945[_0xbbc0('0x50')]][_0xbbc0('0x7')];queues[_0x34b945[_0xbbc0('0x57')]][_0xbbc0('0x5b')]=queues[_0x34b945[_0xbbc0('0x50')]][_0xbbc0('0x5b')];queues[_0x34b945[_0xbbc0('0x57')]][_0xbbc0('0x58')]=utils[_0xbbc0('0x1d')]();queues[_0x34b945['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0xbbc0('0x1d')]();queues[_0x34b945['transfertargetuniqueid']][_0xbbc0('0x35')]=0x0;queues[_0x34b945['transfertargetuniqueid']][_0xbbc0('0x59')]=0x0;utils['info'](util[_0xbbc0('0x11')](_0xbbc0('0x62'),_0x34b945[_0xbbc0('0x4f')],queues[_0x34b945[_0xbbc0('0x57')]][_0xbbc0('0x1e')],queues[_0x34b945[_0xbbc0('0x57')]][_0xbbc0('0xe')],queues[_0x34b945['transfertargetuniqueid']][_0xbbc0('0x7')],queues[_0x34b945['transfertargetuniqueid']]['calleridname']));}else{utils[_0xbbc0('0x13')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x34b945[_0xbbc0('0x4f')],queues[_0x34b945[_0xbbc0('0x51')]][_0xbbc0('0x1e')],_0x34b945[_0xbbc0('0x50')]));queues[_0x34b945[_0xbbc0('0x51')]]['transfereduniqueid']=_0x34b945[_0xbbc0('0x50')];}}}}catch(_0xf826a2){utils['error'](util[_0xbbc0('0x11')](_0xbbc0('0x4e'),_0x34b945[_0xbbc0('0x4f')]),_0xf826a2);}};exports[_0xbbc0('0x63')]=function(_0x3ef803){try{if(!_['isNil'](queues[_0x3ef803['uniqueid']])){utils['debug'](util[_0xbbc0('0x11')](_0xbbc0('0x64'),_0x3ef803[_0xbbc0('0x3')]),_0x3ef803);queues[_0x3ef803['uniqueid']][_0xbbc0('0x65')]=utils[_0xbbc0('0x1d')]();utils[_0xbbc0('0x13')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3ef803[_0xbbc0('0x3')],queues[_0x3ef803['uniqueid']][_0xbbc0('0x1e')],queues[_0x3ef803[_0xbbc0('0x3')]]['musiconholdstartAt']));}}catch(_0x514f15){utils[_0xbbc0('0x2e')](util[_0xbbc0('0x11')](_0xbbc0('0x64'),_0x3ef803[_0xbbc0('0x3')]),_0x514f15);}};exports[_0xbbc0('0x66')]=function(_0x160819){try{if(!_['isNil'](queues[_0x160819[_0xbbc0('0x3')]])){if(!_[_0xbbc0('0x22')](queues[_0x160819[_0xbbc0('0x3')]][_0xbbc0('0x65')])){utils[_0xbbc0('0x10')](util[_0xbbc0('0x11')](_0xbbc0('0x67'),_0x160819['uniqueid']),_0x160819);queues[_0x160819[_0xbbc0('0x3')]]['mohtime']+=utils['diffTime'](utils[_0xbbc0('0x1d')](),queues[_0x160819[_0xbbc0('0x3')]][_0xbbc0('0x65')]);utils[_0xbbc0('0x13')](util[_0xbbc0('0x11')](_0xbbc0('0x68'),_0x160819['uniqueid'],queues[_0x160819[_0xbbc0('0x3')]][_0xbbc0('0x1e')],queues[_0x160819['uniqueid']][_0xbbc0('0x59')]));delete queues[_0x160819[_0xbbc0('0x3')]][_0xbbc0('0x65')];}}}catch(_0x3831b9){utils[_0xbbc0('0x2e')](util[_0xbbc0('0x11')](_0xbbc0('0x67'),_0x160819['uniqueid']),_0x3831b9);}}; \ No newline at end of file +var _0x6b19=['clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','mohtime','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','then','type','CreateVoiceQueueReport','request','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','hangup','debug','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','[%s][queues][varset]','isNil','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','membername','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid'];(function(_0x565d0a,_0x4927cc){var _0x24c211=function(_0x18ae2b){while(--_0x18ae2b){_0x565d0a['push'](_0x565d0a['shift']());}};_0x24c211(++_0x4927cc);}(_0x6b19,0x135));var _0x96b1=function(_0x488333,_0x32d6a3){_0x488333=_0x488333-0x0;var _0x5487ed=_0x6b19[_0x488333];return _0x5487ed;};'use strict';var _=require('lodash');var util=require(_0x96b1('0x0'));var utils=require(_0x96b1('0x1'));var queues={};function writeDB(_0x5c675c){utils[_0x96b1('0x2')](util[_0x96b1('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x5c675c[_0x96b1('0x4')],_0x5c675c[_0x96b1('0x5')],_0x5c675c[_0x96b1('0x6')],_0x5c675c[_0x96b1('0x7')],_0x5c675c[_0x96b1('0x8')],_0x5c675c[_0x96b1('0x9')],_0x5c675c['queuecallerexitreason']));if(_0x5c675c[_0x96b1('0x6')]){utils['getVoiceQueueByName'](_0x5c675c['queue'])[_0x96b1('0xa')](function(_0x2e6e40){if(_0x2e6e40){_0x5c675c['type']=_0x2e6e40[_0x96b1('0xb')];}utils['request'](_0x96b1('0xc'),_0x5c675c);});}else{utils[_0x96b1('0xd')]('CreateVoiceQueueReport',_0x5c675c);}if(_0x5c675c['transfereduniqueid']){delete queues[_0x5c675c['transfereduniqueid']];}else{delete queues[_0x5c675c['uniqueid']];}}exports[_0x96b1('0xe')]=function(_0x250575){try{utils['debug'](util['format'](_0x96b1('0xf'),_0x250575[_0x96b1('0x4')]),_0x250575);utils[_0x96b1('0x2')](util[_0x96b1('0x3')](_0x96b1('0x10'),_0x250575[_0x96b1('0x4')],_0x250575[_0x96b1('0x6')],_0x250575[_0x96b1('0x11')]));queues[_0x250575[_0x96b1('0x4')]]=_['assign'](_0x250575,{'originalposition':_0x250575[_0x96b1('0x11')],'queuecallerjoinAt':utils[_0x96b1('0x12')](),'mohtime':0x0});}catch(_0x5bc211){utils[_0x96b1('0x13')](util['format']('[%s][queues][queuecallerjoin]',_0x250575['uniqueid']),_0x5bc211);}};exports[_0x96b1('0x14')]=function(_0x12eaba){try{if(!_['isNil'](queues[_0x12eaba[_0x96b1('0x4')]])){utils[_0x96b1('0x15')](util[_0x96b1('0x3')]('[%s][queues][hangup]',_0x12eaba[_0x96b1('0x4')]),_0x12eaba);if(queues[_0x12eaba['uniqueid']][_0x96b1('0x16')]){if(!queues[_0x12eaba[_0x96b1('0x4')]][_0x96b1('0x17')]&&!queues[_0x12eaba[_0x96b1('0x4')]]['queuecallerexit']){queues[_0x12eaba[_0x96b1('0x4')]]['queuecallercomplete']=!![];queues[_0x12eaba[_0x96b1('0x4')]][_0x96b1('0x18')]=utils[_0x96b1('0x12')]();queues[_0x12eaba['uniqueid']][_0x96b1('0x19')]='COMPLETEDBYAGENT';}utils[_0x96b1('0x2')](util['format'](_0x96b1('0x1a'),_0x12eaba[_0x96b1('0x4')],queues[_0x12eaba['uniqueid']][_0x96b1('0x1b')],queues[_0x12eaba[_0x96b1('0x4')]][_0x96b1('0x19')]));writeDB(queues[_0x12eaba[_0x96b1('0x4')]]);}else if(queues[_0x12eaba['uniqueid']][_0x96b1('0x1c')]){utils[_0x96b1('0x2')](util['format'](_0x96b1('0x1d'),_0x12eaba[_0x96b1('0x4')],queues[_0x12eaba[_0x96b1('0x4')]]['name'],queues[_0x12eaba[_0x96b1('0x4')]][_0x96b1('0x1c')]));queues[queues[_0x12eaba[_0x96b1('0x4')]][_0x96b1('0x1c')]]=queues[_0x12eaba['uniqueid']];queues[queues[_0x12eaba[_0x96b1('0x4')]][_0x96b1('0x1c')]][_0x96b1('0x1e')]=0x2;delete queues[_0x12eaba[_0x96b1('0x4')]];}}}catch(_0x577c31){utils['error'](util['format'](_0x96b1('0x1f'),_0x12eaba[_0x96b1('0x4')]),_0x577c31);}};exports['varset']=function(_0x188157){try{utils[_0x96b1('0x15')](util['format'](_0x96b1('0x20'),_0x188157[_0x96b1('0x4')]),_0x188157);if(!_[_0x96b1('0x21')](_0x188157[_0x96b1('0x22')][_0x96b1('0x23')])&&_0x188157[_0x96b1('0x24')][_0x96b1('0x25')]()!==_0x96b1('0x26')){if(!_['isNil'](queues[_0x188157[_0x96b1('0x4')]])){queues[_0x188157['uniqueid']][_0x96b1('0x17')]=![];queues[_0x188157['uniqueid']][_0x96b1('0x27')]=null;queues[_0x188157[_0x96b1('0x4')]][_0x96b1('0x28')]=!![];queues[_0x188157[_0x96b1('0x4')]]['queuecallerexitAt']=utils[_0x96b1('0x12')]();queues[_0x188157['uniqueid']][_0x96b1('0x19')]=_0x188157[_0x96b1('0x24')][_0x96b1('0x25')]();utils['info'](util[_0x96b1('0x3')](_0x96b1('0x29'),_0x188157[_0x96b1('0x4')],queues[_0x188157['uniqueid']][_0x96b1('0x1b')],_0x188157[_0x96b1('0x24')],queues[_0x188157[_0x96b1('0x4')]][_0x96b1('0x19')]));writeDB(queues[_0x188157[_0x96b1('0x4')]]);}}else if(!_[_0x96b1('0x21')](_0x188157[_0x96b1('0x22')][_0x96b1('0x2a')])){if(!_[_0x96b1('0x21')](queues[_0x188157[_0x96b1('0x4')]])&&!queues[_0x188157['uniqueid']][_0x96b1('0x17')]){queues[_0x188157[_0x96b1('0x4')]][_0x96b1('0x17')]=![];queues[_0x188157[_0x96b1('0x4')]][_0x96b1('0x27')]=null;queues[_0x188157['uniqueid']][_0x96b1('0x28')]=!![];queues[_0x188157[_0x96b1('0x4')]][_0x96b1('0x2b')]=utils[_0x96b1('0x12')]();queues[_0x188157[_0x96b1('0x4')]][_0x96b1('0x19')]=_0x96b1('0x2c');utils[_0x96b1('0x2')](util[_0x96b1('0x3')](_0x96b1('0x2d'),_0x188157[_0x96b1('0x4')],queues[_0x188157[_0x96b1('0x4')]][_0x96b1('0x1b')],_0x188157['value'],queues[_0x188157[_0x96b1('0x4')]]['queuecallerexitreason']));}}}catch(_0x3c796c){utils[_0x96b1('0x13')](util[_0x96b1('0x3')](_0x96b1('0x20'),_0x188157[_0x96b1('0x4')]),_0x3c796c);}};exports[_0x96b1('0x17')]=function(_0x24c6af){try{if(!_[_0x96b1('0x21')](queues[_0x24c6af['uniqueid']])){utils[_0x96b1('0x15')](util[_0x96b1('0x3')]('[%s][queues][queuecallerabandon]',_0x24c6af['uniqueid']),_0x24c6af);queues[_0x24c6af['uniqueid']]['queuecallerexit']=![];queues[_0x24c6af[_0x96b1('0x4')]]['queuecallerexitAt']=null;queues[_0x24c6af['uniqueid']][_0x96b1('0x17')]=!![];queues[_0x24c6af[_0x96b1('0x4')]][_0x96b1('0x27')]=utils['now']();queues[_0x24c6af[_0x96b1('0x4')]][_0x96b1('0x19')]=_0x96b1('0x2e');utils['info'](util['format'](_0x96b1('0x2f'),_0x24c6af[_0x96b1('0x4')],queues[_0x24c6af[_0x96b1('0x4')]][_0x96b1('0x1b')],queues[_0x24c6af[_0x96b1('0x4')]][_0x96b1('0x19')]));}}catch(_0x14eb34){utils[_0x96b1('0x13')](util[_0x96b1('0x3')](_0x96b1('0x30'),_0x24c6af[_0x96b1('0x4')]),_0x14eb34);}};exports['queuecallerleave']=function(_0x36a0ad){try{if(!_[_0x96b1('0x21')](queues[_0x36a0ad[_0x96b1('0x4')]])){utils[_0x96b1('0x15')](util[_0x96b1('0x3')](_0x96b1('0x31'),_0x36a0ad['uniqueid']),_0x36a0ad);utils['info'](util[_0x96b1('0x3')](_0x96b1('0x32'),_0x36a0ad['uniqueid'],queues[_0x36a0ad[_0x96b1('0x4')]][_0x96b1('0x1b')],_0x36a0ad[_0x96b1('0x33')],_0x36a0ad['connectedlinename']));queues[_0x36a0ad['uniqueid']]['queuecallerleave']=!![];queues[_0x36a0ad['uniqueid']][_0x96b1('0x16')]=utils['now']();queues[_0x36a0ad[_0x96b1('0x4')]][_0x96b1('0x34')]=utils['diffTime'](queues[_0x36a0ad[_0x96b1('0x4')]][_0x96b1('0x16')],queues[_0x36a0ad[_0x96b1('0x4')]][_0x96b1('0x35')]);queues[_0x36a0ad[_0x96b1('0x4')]][_0x96b1('0x11')]=_0x36a0ad['position'];queues[_0x36a0ad[_0x96b1('0x4')]][_0x96b1('0x36')]=_0x36a0ad[_0x96b1('0x36')];queues[_0x36a0ad[_0x96b1('0x4')]][_0x96b1('0x33')]=_0x36a0ad[_0x96b1('0x33')];queues[_0x36a0ad[_0x96b1('0x4')]][_0x96b1('0x37')]=_0x36a0ad[_0x96b1('0x37')];}}catch(_0x18745b){utils['error'](util[_0x96b1('0x3')]('[%s][queues][queuecallerleave]',_0x36a0ad['uniqueid']),_0x18745b);}};exports['agentconnect']=function(_0x1732a5){try{if(!_['isNil'](queues[_0x1732a5[_0x96b1('0x4')]])){utils[_0x96b1('0x15')](util[_0x96b1('0x3')](_0x96b1('0x38'),_0x1732a5['uniqueid']),_0x1732a5);utils[_0x96b1('0x2')](util[_0x96b1('0x3')](_0x96b1('0x39'),_0x1732a5[_0x96b1('0x4')],queues[_0x1732a5['uniqueid']][_0x96b1('0x1b')],_0x1732a5['membername'],_0x1732a5[_0x96b1('0x3a')]));queues[_0x1732a5[_0x96b1('0x4')]]['queuecallerabandon']=![];queues[_0x1732a5['uniqueid']][_0x96b1('0x17')]=![];queues[_0x1732a5[_0x96b1('0x4')]][_0x96b1('0x27')]=null;queues[_0x1732a5[_0x96b1('0x4')]][_0x96b1('0x28')]=![];queues[_0x1732a5[_0x96b1('0x4')]]['queuecallerexitreason']=null;queues[_0x1732a5[_0x96b1('0x4')]][_0x96b1('0x2b')]=null;queues[_0x1732a5[_0x96b1('0x4')]][_0x96b1('0x3b')]=!![];queues[_0x1732a5[_0x96b1('0x4')]][_0x96b1('0x9')]=_0x1732a5['destaccountcode'];queues[_0x1732a5['uniqueid']][_0x96b1('0x7')]=_0x1732a5['membername'];}}catch(_0x55697a){utils['error'](util[_0x96b1('0x3')](_0x96b1('0x38'),_0x1732a5['uniqueid']),_0x55697a);}};exports[_0x96b1('0x3c')]=function(_0x4e7690){try{if(!_[_0x96b1('0x21')](queues[_0x4e7690[_0x96b1('0x4')]])){if(queues[_0x4e7690['uniqueid']]['queuecallerleaveAt']){utils['debug'](util['format']('[%s][queues][agentcomplete]',_0x4e7690[_0x96b1('0x4')]),_0x4e7690);queues[_0x4e7690[_0x96b1('0x4')]][_0x96b1('0x17')]=![];queues[_0x4e7690[_0x96b1('0x4')]][_0x96b1('0x17')]=![];queues[_0x4e7690[_0x96b1('0x4')]][_0x96b1('0x27')]=null;queues[_0x4e7690['uniqueid']]['queuecallerexit']=![];queues[_0x4e7690[_0x96b1('0x4')]]['queuecallerexitAt']=null;queues[_0x4e7690[_0x96b1('0x4')]][_0x96b1('0x3b')]=!![];queues[_0x4e7690[_0x96b1('0x4')]][_0x96b1('0x7')]=_0x4e7690['membername'];queues[_0x4e7690[_0x96b1('0x4')]][_0x96b1('0x3d')]=!![];queues[_0x4e7690['uniqueid']][_0x96b1('0x18')]=utils[_0x96b1('0x12')]();if(_0x4e7690[_0x96b1('0x3e')]==_0x96b1('0x3f')){if(!queues[_0x4e7690[_0x96b1('0x4')]][_0x96b1('0x3f')]){queues[_0x4e7690[_0x96b1('0x4')]][_0x96b1('0x19')]=_0x96b1('0x40');}}else{queues[_0x4e7690[_0x96b1('0x4')]][_0x96b1('0x19')]='COMPLETEDBY'+_0x4e7690[_0x96b1('0x3e')][_0x96b1('0x25')]();}utils[_0x96b1('0x2')](util['format'](_0x96b1('0x41'),_0x4e7690[_0x96b1('0x4')],queues[_0x4e7690[_0x96b1('0x4')]][_0x96b1('0x1b')],_0x4e7690[_0x96b1('0x42')],queues[_0x4e7690['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x4e7690[_0x96b1('0x4')]]);}}}catch(_0x45f689){utils[_0x96b1('0x13')](util['format'](_0x96b1('0x43'),_0x4e7690[_0x96b1('0x4')]),_0x45f689);}};exports[_0x96b1('0x44')]=function(_0x227c48){try{if(!_['isNil'](queues[_0x227c48['transfereeuniqueid']])){utils['debug'](util[_0x96b1('0x3')]('[%s][queues][blindtransfer]',_0x227c48[_0x96b1('0x4')]),_0x227c48);queues[_0x227c48[_0x96b1('0x45')]][_0x96b1('0x3f')]=!![];queues[_0x227c48['transfereeuniqueid']][_0x96b1('0x46')]='BLIND';queues[_0x227c48[_0x96b1('0x45')]][_0x96b1('0x47')]=_0x227c48[_0x96b1('0x48')];queues[_0x227c48[_0x96b1('0x45')]][_0x96b1('0x49')]=_0x227c48[_0x96b1('0x45')];queues[_0x227c48['transfereeuniqueid']][_0x96b1('0x19')]='BLINDTRANSFER';utils[_0x96b1('0x2')](util[_0x96b1('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x227c48['uniqueid'],queues[_0x227c48[_0x96b1('0x45')]][_0x96b1('0x1b')],_0x227c48['transfereeuniqueid'],_0x227c48[_0x96b1('0x48')]));}}catch(_0x4dadea){utils[_0x96b1('0x13')](util['format'](_0x96b1('0x4a'),_0x227c48[_0x96b1('0x4')]),_0x4dadea);}};exports[_0x96b1('0x4b')]=function(_0x499434){try{utils[_0x96b1('0x15')](util['format']('[%s][queues][attendedtransfer]',_0x499434[_0x96b1('0x4c')]),_0x499434);if(_0x499434['origtransfereruniqueid']==_0x499434[_0x96b1('0x4d')]){if(!_[_0x96b1('0x21')](queues[_0x499434[_0x96b1('0x4e')]])){utils[_0x96b1('0x2')](util[_0x96b1('0x3')](_0x96b1('0x4f'),_0x499434[_0x96b1('0x4c')],queues[_0x499434[_0x96b1('0x4e')]][_0x96b1('0x1b')],_0x499434[_0x96b1('0x50')]));queues[_0x499434[_0x96b1('0x4e')]][_0x96b1('0x3f')]=!![];queues[_0x499434[_0x96b1('0x4e')]][_0x96b1('0x46')]=_0x96b1('0x51');queues[_0x499434[_0x96b1('0x4e')]][_0x96b1('0x47')]=_0x499434['origtransfererexten'];queues[_0x499434[_0x96b1('0x4e')]][_0x96b1('0x49')]=_0x499434[_0x96b1('0x4c')];queues[_0x499434[_0x96b1('0x4e')]]['queuecallerexitreason']=_0x96b1('0x52');}if(!_[_0x96b1('0x21')](queues[_0x499434[_0x96b1('0x4d')]])){if(_0x499434['transfereelinkedid']&&queues[_0x499434[_0x96b1('0x53')]]){queues[_0x499434[_0x96b1('0x53')]][_0x96b1('0x1e')]=0x1;queues[_0x499434['transfereeuniqueid']]=_['clone'](queues[_0x499434[_0x96b1('0x53')]]);queues[_0x499434[_0x96b1('0x45')]][_0x96b1('0x1c')]=_0x499434[_0x96b1('0x54')];queues[_0x499434[_0x96b1('0x45')]][_0x96b1('0x1e')]=0x2;queues[_0x499434[_0x96b1('0x45')]][_0x96b1('0x8')]=queues[_0x499434[_0x96b1('0x4e')]]['calleridnum'];queues[_0x499434[_0x96b1('0x45')]][_0x96b1('0x55')]=queues[_0x499434[_0x96b1('0x4e')]][_0x96b1('0x55')];queues[_0x499434['transfereeuniqueid']][_0x96b1('0x35')]=utils[_0x96b1('0x12')]();queues[_0x499434['transfereeuniqueid']][_0x96b1('0x16')]=utils[_0x96b1('0x12')]();queues[_0x499434[_0x96b1('0x45')]][_0x96b1('0x34')]=0x0;queues[_0x499434[_0x96b1('0x45')]]['mohtime']=0x0;utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x499434[_0x96b1('0x4c')],queues[_0x499434['transfereeuniqueid']][_0x96b1('0x1b')],queues[_0x499434[_0x96b1('0x45')]][_0x96b1('0x8')],queues[_0x499434[_0x96b1('0x45')]]['calleridname']));}else{utils[_0x96b1('0x2')](util['format'](_0x96b1('0x56'),_0x499434['origtransfereruniqueid'],queues[_0x499434[_0x96b1('0x4d')]][_0x96b1('0x1b')],_0x499434[_0x96b1('0x4e')]));queues[_0x499434[_0x96b1('0x4d')]][_0x96b1('0x1c')]=_0x499434[_0x96b1('0x4e')];}}}else if(_0x499434[_0x96b1('0x57')]==_0x499434[_0x96b1('0x4e')]){if(!_[_0x96b1('0x21')](queues[_0x499434[_0x96b1('0x4d')]])){utils[_0x96b1('0x2')](util[_0x96b1('0x3')](_0x96b1('0x58'),_0x499434['origtransfereruniqueid'],queues[_0x499434[_0x96b1('0x4d')]][_0x96b1('0x1b')],_0x499434[_0x96b1('0x57')],_0x499434[_0x96b1('0x59')]));queues[_0x499434[_0x96b1('0x4d')]][_0x96b1('0x3f')]=!![];queues[_0x499434[_0x96b1('0x4d')]][_0x96b1('0x46')]=_0x96b1('0x51');queues[_0x499434[_0x96b1('0x4d')]][_0x96b1('0x47')]=_0x499434[_0x96b1('0x59')];queues[_0x499434['origtransfererlinkedid']][_0x96b1('0x49')]=_0x499434[_0x96b1('0x57')];queues[_0x499434['origtransfererlinkedid']][_0x96b1('0x19')]=_0x96b1('0x52');}if(!_[_0x96b1('0x21')](queues[_0x499434[_0x96b1('0x4e')]])){if(_0x499434[_0x96b1('0x5a')]&&queues[_0x499434[_0x96b1('0x5a')]]){queues[_0x499434[_0x96b1('0x5a')]][_0x96b1('0x1e')]=0x1;queues[_0x499434[_0x96b1('0x54')]]=_[_0x96b1('0x5b')](queues[_0x499434[_0x96b1('0x5a')]]);queues[_0x499434[_0x96b1('0x54')]]['transfereduniqueid']=_0x499434[_0x96b1('0x54')];queues[_0x499434[_0x96b1('0x54')]][_0x96b1('0x1e')]=0x2;queues[_0x499434['transfertargetuniqueid']][_0x96b1('0x8')]=queues[_0x499434[_0x96b1('0x4d')]]['calleridnum'];queues[_0x499434[_0x96b1('0x54')]][_0x96b1('0x55')]=queues[_0x499434['origtransfererlinkedid']][_0x96b1('0x55')];queues[_0x499434[_0x96b1('0x54')]]['queuecallerjoinAt']=utils['now']();queues[_0x499434[_0x96b1('0x54')]][_0x96b1('0x16')]=utils['now']();queues[_0x499434[_0x96b1('0x54')]]['holdtime']=0x0;queues[_0x499434['transfertargetuniqueid']]['mohtime']=0x0;utils[_0x96b1('0x2')](util['format'](_0x96b1('0x5c'),_0x499434['origtransfereruniqueid'],queues[_0x499434[_0x96b1('0x54')]][_0x96b1('0x1b')],queues[_0x499434['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x499434[_0x96b1('0x54')]][_0x96b1('0x8')],queues[_0x499434[_0x96b1('0x54')]][_0x96b1('0x55')]));}else{utils[_0x96b1('0x2')](util[_0x96b1('0x3')](_0x96b1('0x56'),_0x499434[_0x96b1('0x4c')],queues[_0x499434[_0x96b1('0x4e')]][_0x96b1('0x1b')],_0x499434[_0x96b1('0x4d')]));queues[_0x499434[_0x96b1('0x4e')]]['transfereduniqueid']=_0x499434[_0x96b1('0x4d')];}}}}catch(_0x5c32e4){utils[_0x96b1('0x13')](util['format'](_0x96b1('0x5d'),_0x499434[_0x96b1('0x4c')]),_0x5c32e4);}};exports['musiconholdstart']=function(_0x4ec3e3){try{if(!_[_0x96b1('0x21')](queues[_0x4ec3e3[_0x96b1('0x4')]])){utils['debug'](util[_0x96b1('0x3')](_0x96b1('0x5e'),_0x4ec3e3[_0x96b1('0x4')]),_0x4ec3e3);queues[_0x4ec3e3[_0x96b1('0x4')]][_0x96b1('0x5f')]=utils['now']();utils[_0x96b1('0x2')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x4ec3e3['uniqueid'],queues[_0x4ec3e3[_0x96b1('0x4')]][_0x96b1('0x1b')],queues[_0x4ec3e3[_0x96b1('0x4')]][_0x96b1('0x5f')]));}}catch(_0x9ba3a9){utils[_0x96b1('0x13')](util[_0x96b1('0x3')]('[%s][queues][musiconholdstart]',_0x4ec3e3[_0x96b1('0x4')]),_0x9ba3a9);}};exports[_0x96b1('0x60')]=function(_0xb62507){try{if(!_['isNil'](queues[_0xb62507[_0x96b1('0x4')]])){if(!_['isNil'](queues[_0xb62507[_0x96b1('0x4')]][_0x96b1('0x5f')])){utils[_0x96b1('0x15')](util['format'](_0x96b1('0x61'),_0xb62507['uniqueid']),_0xb62507);queues[_0xb62507['uniqueid']]['mohtime']+=utils['diffTime'](utils['now'](),queues[_0xb62507[_0x96b1('0x4')]][_0x96b1('0x5f')]);utils[_0x96b1('0x2')](util[_0x96b1('0x3')](_0x96b1('0x62'),_0xb62507['uniqueid'],queues[_0xb62507['uniqueid']][_0x96b1('0x1b')],queues[_0xb62507[_0x96b1('0x4')]][_0x96b1('0x63')]));delete queues[_0xb62507[_0x96b1('0x4')]][_0x96b1('0x5f')];}}}catch(_0xb5e3dc){utils[_0x96b1('0x13')](util[_0x96b1('0x3')]('[%s][queues][musiconholdstop]',_0xb62507[_0x96b1('0x4')]),_0xb5e3dc);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 0f981bf..fb96a1f 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 _0xe622=['appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','format','[%s][recordings][writeDB]','accountcode','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','uniqueid','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','debug','[%s][recordings][newstate]','isNil','info','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]','value','.wav49','replace','find','monitors','push','hangup','calleridnum','calleridname','cause-txt','connectedlinename','type','outbound','connectedlinenum','clone','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0xe622,0xc0));var _0x2e62=function(_0x41c703,_0x2009ba){_0x41c703=_0x41c703-0x0;var _0x4ec5a3=_0xe622[_0x41c703];return _0x4ec5a3;};'use strict';var _=require(_0x2e62('0x0'));var util=require(_0x2e62('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x58cb59){utils['info'](util[_0x2e62('0x2')](_0x2e62('0x3'),_0x58cb59['uniqueid']));if(_0x58cb59[_0x2e62('0x4')]){utils['getUserByInternal'](_0x58cb59[_0x2e62('0x4')])['then'](function(_0x518c19){if(_0x518c19){_0x58cb59[_0x2e62('0x5')]=_0x518c19[_0x2e62('0x6')];_0x58cb59[_0x2e62('0x7')]=_0x518c19['id'];}utils[_0x2e62('0x8')]('CreateVoiceRecording',_0x58cb59);});}else{utils[_0x2e62('0x8')](_0x2e62('0x9'),_0x58cb59);}}exports[_0x2e62('0xa')]=function(_0x4b4a62){try{utils['debug'](util[_0x2e62('0x2')](_0x2e62('0xb'),_0x4b4a62[_0x2e62('0xc')]),_0x4b4a62);if(_0x4b4a62[_0x2e62('0xc')]==_0x4b4a62[_0x2e62('0xd')]){utils['info'](util[_0x2e62('0x2')](_0x2e62('0xe'),_0x4b4a62[_0x2e62('0xc')],_0x4b4a62[_0x2e62('0xf')],_0x4b4a62[_0x2e62('0x10')]));recordings[_0x4b4a62[_0x2e62('0xc')]]={'uniqueid':_0x4b4a62[_0x2e62('0xc')],'accountcode':_0x4b4a62[_0x2e62('0x4')],'exten':_0x4b4a62[_0x2e62('0x10')],'context':_0x4b4a62[_0x2e62('0xf')],'channel':_0x4b4a62[_0x2e62('0x11')],'monitors':[]};}}catch(_0x1b6d7d){utils[_0x2e62('0x12')](util[_0x2e62('0x2')](_0x2e62('0xb'),_0x4b4a62[_0x2e62('0xc')]),_0x1b6d7d);}};exports[_0x2e62('0x13')]=function(_0x324828){try{utils[_0x2e62('0x14')](util[_0x2e62('0x2')](_0x2e62('0x15'),_0x324828[_0x2e62('0xc')]),_0x324828);if(!_[_0x2e62('0x16')](recordings[_0x324828[_0x2e62('0xc')]])&&_0x324828['channelstate']==0x6){utils[_0x2e62('0x17')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x324828[_0x2e62('0xc')],_0x324828[_0x2e62('0xf')],_0x324828[_0x2e62('0x11')]));}else if(!_['isNil'](recordings[_0x324828['linkedid']])&&_0x324828[_0x2e62('0x18')]==0x6&&_0x324828[_0x2e62('0xf')]!=_0x2e62('0x19')){utils['info'](util['format'](_0x2e62('0x1a'),_0x324828[_0x2e62('0xc')],_0x324828[_0x2e62('0xd')],_0x324828['context'],_0x324828[_0x2e62('0x11')]));recordings[_0x324828[_0x2e62('0xd')]][_0x2e62('0x4')]=_0x324828['accountcode'];}}catch(_0x22f81a){utils[_0x2e62('0x12')](util[_0x2e62('0x2')](_0x2e62('0x15'),_0x324828[_0x2e62('0xc')]),_0x22f81a);}};exports[_0x2e62('0x1b')]=function(_0x5d5d44){try{if(!_[_0x2e62('0x16')](_0x5d5d44[_0x2e62('0x1c')])&&!_[_0x2e62('0x16')](_0x5d5d44[_0x2e62('0x1c')]['mixmonitor_filename'])){utils[_0x2e62('0x14')](util[_0x2e62('0x2')](_0x2e62('0x1d'),_0x5d5d44[_0x2e62('0xc')]),_0x5d5d44);utils[_0x2e62('0x17')](util[_0x2e62('0x2')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x5d5d44[_0x2e62('0xc')],_0x5d5d44[_0x2e62('0x1c')],_0x5d5d44[_0x2e62('0x1e')]));if(_['endsWith'](_0x5d5d44[_0x2e62('0x1e')],_0x2e62('0x1f'))){_0x5d5d44[_0x2e62('0x1e')]=_0x5d5d44[_0x2e62('0x1e')][_0x2e62('0x20')](_0x2e62('0x1f'),'.WAV');}if(recordings[_0x5d5d44[_0x2e62('0xd')]]){var _0x19c08b=_[_0x2e62('0x21')](recordings[_0x5d5d44['linkedid']][_0x2e62('0x22')],{'value':_0x5d5d44['value']});if(_[_0x2e62('0x16')](_0x19c08b)){recordings[_0x5d5d44['linkedid']][_0x2e62('0x22')][_0x2e62('0x23')]({'value':_0x5d5d44['value']});}}}}catch(_0x344c39){utils[_0x2e62('0x12')](util[_0x2e62('0x2')](_0x2e62('0x1d'),_0x5d5d44[_0x2e62('0xc')]),_0x344c39);}};exports[_0x2e62('0x24')]=function(_0x24282f){try{if(!_[_0x2e62('0x16')](recordings[_0x24282f[_0x2e62('0xc')]])){utils[_0x2e62('0x14')](util['format']('[%s][recordings][hangup]',_0x24282f[_0x2e62('0xc')]),_0x24282f);utils[_0x2e62('0x17')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x24282f[_0x2e62('0xc')],_0x24282f[_0x2e62('0x25')],_0x24282f[_0x2e62('0x26')],_0x24282f[_0x2e62('0x27')]));recordings[_0x24282f['uniqueid']][_0x2e62('0x25')]=_0x24282f['calleridnum'];recordings[_0x24282f[_0x2e62('0xc')]][_0x2e62('0x26')]=_0x24282f[_0x2e62('0x26')];recordings[_0x24282f[_0x2e62('0xc')]]['connectedlinenum']=_0x24282f['connectedlinenum'];recordings[_0x24282f['uniqueid']][_0x2e62('0x28')]=_0x24282f['connectedlinename'];if(recordings[_0x24282f[_0x2e62('0xc')]][_0x2e62('0x29')]==_0x2e62('0x2a')&&recordings[_0x24282f['uniqueid']]['accountcode']){recordings[_0x24282f[_0x2e62('0xc')]][_0x2e62('0x2b')]=recordings[_0x24282f[_0x2e62('0xc')]][_0x2e62('0x4')];recordings[_0x24282f['uniqueid']][_0x2e62('0x28')]='';}recordings[_0x24282f[_0x2e62('0xc')]][_0x2e62('0x22')]['forEach'](function(_0x18597c){var _0xea5c09=_[_0x2e62('0x2c')](recordings[_0x24282f['uniqueid']]);_0xea5c09['value']=_0x18597c['value'];writeDB(_0xea5c09);});delete recordings[_0x24282f['uniqueid']];}}catch(_0x1dc1c1){utils[_0x2e62('0x12')](util[_0x2e62('0x2')](_0x2e62('0x2d'),_0x24282f['uniqueid']),_0x1dc1c1);}};exports['newexten']=function(_0x569634){try{if(!_['isNil'](recordings[_0x569634[_0x2e62('0xc')]])){utils['debug'](util['format'](_0x2e62('0x2e'),_0x569634[_0x2e62('0xc')]),_0x569634);utils['info'](util['format'](_0x2e62('0x2f'),_0x569634[_0x2e62('0xc')],_0x569634['application'],_0x569634['appdata']));if(_0x569634[_0x2e62('0x30')][_0x2e62('0x31')]()==_0x2e62('0x32')&&_[_0x2e62('0x33')](_0x569634[_0x2e62('0x34')][_0x2e62('0x31')](),_0x2e62('0x35'))){var _0x4ca015=_0x569634[_0x2e62('0x34')][_0x2e62('0x36')]('=');var _0x4c20d8=_0x4ca015[0x0][_0x2e62('0x37')](_0x4ca015[0x0][_0x2e62('0x38')]('(')+0x1,_0x4ca015[0x0]['lastIndexOf'](')'));var _0x216aef=_0x4ca015[0x1];recordings[_0x569634['uniqueid']][_0x4c20d8]=_0x216aef;}}}catch(_0x3b1d7f){utils[_0x2e62('0x12')](util[_0x2e62('0x2')]('[%s][recordings][newexten]',_0x569634[_0x2e62('0xc')]),_0x3b1d7f);}};exports[_0x2e62('0x39')]=function(_0x5b58f3){try{if(!_[_0x2e62('0x16')](recordings[_0x5b58f3[_0x2e62('0xc')]])){utils['debug'](util[_0x2e62('0x2')](_0x2e62('0x3a'),_0x5b58f3[_0x2e62('0xc')]),_0x5b58f3);utils[_0x2e62('0x17')](util[_0x2e62('0x2')](_0x2e62('0x3b'),_0x5b58f3[_0x2e62('0xc')],_0x5b58f3[_0x2e62('0x3c')]));recordings[_0x5b58f3['uniqueid']][_0x2e62('0x3c')]=_0x5b58f3['queue'];}}catch(_0x2c29d2){utils['error'](util[_0x2e62('0x2')](_0x2e62('0x3a'),_0x5b58f3[_0x2e62('0xc')]),_0x2c29d2);}}; \ No newline at end of file +var _0x4743=['monitors','push','error','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV'];(function(_0x549a49,_0x47010d){var _0x2d05ca=function(_0x1d1db7){while(--_0x1d1db7){_0x549a49['push'](_0x549a49['shift']());}};_0x2d05ca(++_0x47010d);}(_0x4743,0x96));var _0x3474=function(_0x37bcf9,_0x4d1a77){_0x37bcf9=_0x37bcf9-0x0;var _0x5049d3=_0x4743[_0x37bcf9];return _0x5049d3;};'use strict';var _=require(_0x3474('0x0'));var util=require(_0x3474('0x1'));var utils=require(_0x3474('0x2'));var recordings={};function writeDB(_0x5c8784){utils[_0x3474('0x3')](util[_0x3474('0x4')](_0x3474('0x5'),_0x5c8784[_0x3474('0x6')]));if(_0x5c8784[_0x3474('0x7')]){utils[_0x3474('0x8')](_0x5c8784[_0x3474('0x7')])['then'](function(_0x2624af){if(_0x2624af){_0x5c8784[_0x3474('0x9')]=_0x2624af[_0x3474('0xa')];_0x5c8784[_0x3474('0xb')]=_0x2624af['id'];}utils[_0x3474('0xc')](_0x3474('0xd'),_0x5c8784);});}else{utils[_0x3474('0xc')](_0x3474('0xd'),_0x5c8784);}}exports[_0x3474('0xe')]=function(_0x9dc5ef){try{utils[_0x3474('0xf')](util[_0x3474('0x4')](_0x3474('0x10'),_0x9dc5ef[_0x3474('0x6')]),_0x9dc5ef);if(_0x9dc5ef[_0x3474('0x6')]==_0x9dc5ef['linkedid']){utils[_0x3474('0x3')](util['format'](_0x3474('0x11'),_0x9dc5ef['uniqueid'],_0x9dc5ef[_0x3474('0x12')],_0x9dc5ef[_0x3474('0x13')]));recordings[_0x9dc5ef[_0x3474('0x6')]]={'uniqueid':_0x9dc5ef[_0x3474('0x6')],'accountcode':_0x9dc5ef[_0x3474('0x7')],'exten':_0x9dc5ef[_0x3474('0x13')],'context':_0x9dc5ef[_0x3474('0x12')],'channel':_0x9dc5ef['channel'],'monitors':[]};}}catch(_0x4c0e2d){utils['error'](util[_0x3474('0x4')](_0x3474('0x10'),_0x9dc5ef[_0x3474('0x6')]),_0x4c0e2d);}};exports[_0x3474('0x14')]=function(_0x2865f1){try{utils[_0x3474('0xf')](util[_0x3474('0x4')](_0x3474('0x15'),_0x2865f1[_0x3474('0x6')]),_0x2865f1);if(!_[_0x3474('0x16')](recordings[_0x2865f1[_0x3474('0x6')]])&&_0x2865f1[_0x3474('0x17')]==0x6){utils['info'](util[_0x3474('0x4')](_0x3474('0x18'),_0x2865f1[_0x3474('0x6')],_0x2865f1[_0x3474('0x12')],_0x2865f1['channel']));}else if(!_[_0x3474('0x16')](recordings[_0x2865f1[_0x3474('0x19')]])&&_0x2865f1[_0x3474('0x17')]==0x6&&_0x2865f1[_0x3474('0x12')]!=_0x3474('0x1a')){utils[_0x3474('0x3')](util[_0x3474('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2865f1[_0x3474('0x6')],_0x2865f1['linkedid'],_0x2865f1[_0x3474('0x12')],_0x2865f1['channel']));recordings[_0x2865f1[_0x3474('0x19')]][_0x3474('0x7')]=_0x2865f1['accountcode'];}}catch(_0x3e420b){utils['error'](util[_0x3474('0x4')](_0x3474('0x15'),_0x2865f1[_0x3474('0x6')]),_0x3e420b);}};exports[_0x3474('0x1b')]=function(_0x3e3996){try{if(!_[_0x3474('0x16')](_0x3e3996[_0x3474('0x1c')])&&!_['isNil'](_0x3e3996[_0x3474('0x1c')]['mixmonitor_filename'])){utils[_0x3474('0xf')](util['format'](_0x3474('0x1d'),_0x3e3996[_0x3474('0x6')]),_0x3e3996);utils[_0x3474('0x3')](util['format'](_0x3474('0x1e'),_0x3e3996[_0x3474('0x6')],_0x3e3996[_0x3474('0x1c')],_0x3e3996[_0x3474('0x1f')]));if(_[_0x3474('0x20')](_0x3e3996['value'],_0x3474('0x21'))){_0x3e3996[_0x3474('0x1f')]=_0x3e3996[_0x3474('0x1f')][_0x3474('0x22')](_0x3474('0x21'),_0x3474('0x23'));}if(recordings[_0x3e3996[_0x3474('0x19')]]){var _0x386eab=_['find'](recordings[_0x3e3996[_0x3474('0x19')]][_0x3474('0x24')],{'value':_0x3e3996[_0x3474('0x1f')]});if(_[_0x3474('0x16')](_0x386eab)){recordings[_0x3e3996[_0x3474('0x19')]][_0x3474('0x24')][_0x3474('0x25')]({'value':_0x3e3996[_0x3474('0x1f')]});}}}}catch(_0x5aeaa3){utils[_0x3474('0x26')](util['format']('[%s][recordings][varset]',_0x3e3996[_0x3474('0x6')]),_0x5aeaa3);}};exports['hangup']=function(_0x776412){try{if(!_[_0x3474('0x16')](recordings[_0x776412[_0x3474('0x6')]])){utils[_0x3474('0xf')](util['format']('[%s][recordings][hangup]',_0x776412[_0x3474('0x6')]),_0x776412);utils[_0x3474('0x3')](util[_0x3474('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x776412[_0x3474('0x6')],_0x776412[_0x3474('0x27')],_0x776412[_0x3474('0x28')],_0x776412[_0x3474('0x29')]));recordings[_0x776412[_0x3474('0x6')]][_0x3474('0x27')]=_0x776412['calleridnum'];recordings[_0x776412[_0x3474('0x6')]][_0x3474('0x28')]=_0x776412[_0x3474('0x28')];recordings[_0x776412[_0x3474('0x6')]][_0x3474('0x2a')]=_0x776412[_0x3474('0x2a')];recordings[_0x776412['uniqueid']][_0x3474('0x2b')]=_0x776412[_0x3474('0x2b')];if(recordings[_0x776412[_0x3474('0x6')]][_0x3474('0x2c')]==_0x3474('0x2d')&&recordings[_0x776412['uniqueid']]['accountcode']){recordings[_0x776412['uniqueid']][_0x3474('0x2a')]=recordings[_0x776412['uniqueid']]['accountcode'];recordings[_0x776412['uniqueid']][_0x3474('0x2b')]='';}recordings[_0x776412[_0x3474('0x6')]]['monitors'][_0x3474('0x2e')](function(_0x56d57c){var _0x2e2e9a=_[_0x3474('0x2f')](recordings[_0x776412[_0x3474('0x6')]]);_0x2e2e9a[_0x3474('0x1f')]=_0x56d57c[_0x3474('0x1f')];writeDB(_0x2e2e9a);});delete recordings[_0x776412[_0x3474('0x6')]];}}catch(_0x40708c){utils[_0x3474('0x26')](util[_0x3474('0x4')]('[%s][recordings][hangup]',_0x776412[_0x3474('0x6')]),_0x40708c);}};exports[_0x3474('0x30')]=function(_0x55090f){try{if(!_[_0x3474('0x16')](recordings[_0x55090f[_0x3474('0x6')]])){utils['debug'](util[_0x3474('0x4')]('[%s][recordings][newexten]',_0x55090f[_0x3474('0x6')]),_0x55090f);utils[_0x3474('0x3')](util[_0x3474('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x55090f[_0x3474('0x6')],_0x55090f[_0x3474('0x31')],_0x55090f[_0x3474('0x32')]));if(_0x55090f[_0x3474('0x31')][_0x3474('0x33')]()==_0x3474('0x34')&&_['startsWith'](_0x55090f[_0x3474('0x32')][_0x3474('0x33')](),_0x3474('0x35'))){var _0x14b316=_0x55090f[_0x3474('0x32')][_0x3474('0x36')]('=');var _0x3b18d7=_0x14b316[0x0][_0x3474('0x37')](_0x14b316[0x0]['lastIndexOf']('(')+0x1,_0x14b316[0x0][_0x3474('0x38')](')'));var _0x338665=_0x14b316[0x1];recordings[_0x55090f[_0x3474('0x6')]][_0x3b18d7]=_0x338665;}}}catch(_0x17b76a){utils[_0x3474('0x26')](util[_0x3474('0x4')](_0x3474('0x39'),_0x55090f[_0x3474('0x6')]),_0x17b76a);}};exports[_0x3474('0x3a')]=function(_0x4017b5){try{if(!_['isNil'](recordings[_0x4017b5[_0x3474('0x6')]])){utils[_0x3474('0xf')](util['format'](_0x3474('0x3b'),_0x4017b5[_0x3474('0x6')]),_0x4017b5);utils['info'](util[_0x3474('0x4')](_0x3474('0x3c'),_0x4017b5['uniqueid'],_0x4017b5[_0x3474('0x3d')]));recordings[_0x4017b5[_0x3474('0x6')]][_0x3474('0x3d')]=_0x4017b5['queue'];}}catch(_0x1499d0){utils[_0x3474('0x26')](util[_0x3474('0x4')](_0x3474('0x3b'),_0x4017b5['uniqueid']),_0x1499d0);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index cbc039b..49a2f3a 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 _0xd700=['origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','assign','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum'];(function(_0x4705bd,_0x4ba838){var _0x412401=function(_0x54f602){while(--_0x54f602){_0x4705bd['push'](_0x4705bd['shift']());}};_0x412401(++_0x4ba838);}(_0xd700,0xfa));var _0x0d70=function(_0x39bf66,_0x35c96c){_0x39bf66=_0x39bf66-0x0;var _0x431030=_0xd700[_0x39bf66];return _0x431030;};'use strict';var _=require(_0x0d70('0x0'));var util=require(_0x0d70('0x1'));var utils=require(_0x0d70('0x2'));function writeDB(_0xddecfa){utils[_0x0d70('0x3')](util['format'](_0x0d70('0x4'),_0xddecfa[_0x0d70('0x5')]==='attended'?_0xddecfa[_0x0d70('0x6')]:_0xddecfa[_0x0d70('0x7')],_0xddecfa[_0x0d70('0x5')]));utils[_0x0d70('0x8')]('CreateVoiceTransferReport',_0xddecfa);}exports[_0x0d70('0x9')]=function(_0x3d0543){try{utils[_0x0d70('0xa')](util[_0x0d70('0xb')](_0x0d70('0xc'),_0x3d0543[_0x0d70('0x7')]),_0x3d0543);utils[_0x0d70('0x3')](util[_0x0d70('0xb')](_0x0d70('0xd'),_0x3d0543['uniqueid'],_0x3d0543[_0x0d70('0xe')],_0x3d0543[_0x0d70('0xf')],_0x3d0543['transfereecalleridnum'],_0x3d0543['transfereecalleridname']));_0x3d0543[_0x0d70('0x5')]=_0x0d70('0x10');writeDB(_0x3d0543);}catch(_0x2ebab0){utils[_0x0d70('0x11')](util[_0x0d70('0xb')]('[%s][transfers][blindtransfer]',_0x3d0543[_0x0d70('0x7')]),_0x2ebab0);}};exports[_0x0d70('0x12')]=function(_0x2d5469){try{utils[_0x0d70('0xa')](util[_0x0d70('0xb')](_0x0d70('0x13'),_0x2d5469[_0x0d70('0x6')]),_0x2d5469);utils[_0x0d70('0x3')](util['format'](_0x0d70('0x14'),_0x2d5469[_0x0d70('0x6')],_0x2d5469[_0x0d70('0x15')],_0x2d5469['origtransferercalleridname'],_0x2d5469[_0x0d70('0x16')],_0x2d5469['transfertargetcalleridname']));_0x2d5469=_['assign'](_0x2d5469,{'transfererchannel':_0x2d5469[_0x0d70('0x17')],'transferercalleridnum':_0x2d5469[_0x0d70('0x15')],'transferercalleridname':_0x2d5469['origtransferercalleridname'],'transfererconnectedlinenum':_0x2d5469[_0x0d70('0x18')],'transfererconnectedlinename':_0x2d5469['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2d5469[_0x0d70('0x19')],'transferercontext':_0x2d5469[_0x0d70('0x1a')],'transfererexten':_0x2d5469[_0x0d70('0x1b')],'transfererlinkedid':_0x2d5469[_0x0d70('0x1c')],'context':_0x2d5469[_0x0d70('0x1d')],'extension':_0x2d5469[_0x0d70('0x1e')],'type':_0x0d70('0x1f')});if(_[_0x0d70('0x20')](_0x2d5469['transfereechannel'])){_0x2d5469=_[_0x0d70('0x21')](_0x2d5469,{'transfereechannel':_0x2d5469[_0x0d70('0x22')],'transfereecalleridnum':_0x2d5469[_0x0d70('0x16')],'transfereecalleridname':_0x2d5469[_0x0d70('0x23')],'transfereeconnectedlinenum':_0x2d5469[_0x0d70('0x24')],'transfereeconnectedlinename':_0x2d5469['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2d5469[_0x0d70('0x25')],'transfereecontext':_0x2d5469['transfertargetcontext'],'transfereeexten':_0x2d5469['transfertargetexten'],'transfereelinkedid':_0x2d5469[_0x0d70('0x26')]});}writeDB(_0x2d5469);}catch(_0x43bd0d){utils[_0x0d70('0x11')](util['format'](_0x0d70('0x13'),_0x2d5469['origtransfereruniqueid']),_0x43bd0d);}}; \ No newline at end of file +var _0xe13f=['secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x5cdae9,_0x5e30a9){var _0x417701=function(_0x3e0142){while(--_0x3e0142){_0x5cdae9['push'](_0x5cdae9['shift']());}};_0x417701(++_0x5e30a9);}(_0xe13f,0xb0));var _0xfe13=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe13f[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xfe13('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x4bf8fc){utils['info'](util[_0xfe13('0x1')](_0xfe13('0x2'),_0x4bf8fc[_0xfe13('0x3')]===_0xfe13('0x4')?_0x4bf8fc[_0xfe13('0x5')]:_0x4bf8fc[_0xfe13('0x6')],_0x4bf8fc[_0xfe13('0x3')]));utils['request'](_0xfe13('0x7'),_0x4bf8fc);}exports[_0xfe13('0x8')]=function(_0x1df307){try{utils['debug'](util[_0xfe13('0x1')](_0xfe13('0x9'),_0x1df307[_0xfe13('0x6')]),_0x1df307);utils[_0xfe13('0xa')](util[_0xfe13('0x1')](_0xfe13('0xb'),_0x1df307['uniqueid'],_0x1df307[_0xfe13('0xc')],_0x1df307[_0xfe13('0xd')],_0x1df307[_0xfe13('0xe')],_0x1df307[_0xfe13('0xf')]));_0x1df307['type']=_0xfe13('0x10');writeDB(_0x1df307);}catch(_0x266410){utils[_0xfe13('0x11')](util[_0xfe13('0x1')](_0xfe13('0x9'),_0x1df307[_0xfe13('0x6')]),_0x266410);}};exports[_0xfe13('0x12')]=function(_0xaf2898){try{utils['debug'](util[_0xfe13('0x1')]('[%s][transfers][attendedtransfer]',_0xaf2898['origtransfereruniqueid']),_0xaf2898);utils[_0xfe13('0xa')](util[_0xfe13('0x1')](_0xfe13('0x13'),_0xaf2898[_0xfe13('0x5')],_0xaf2898['origtransferercalleridnum'],_0xaf2898[_0xfe13('0x14')],_0xaf2898[_0xfe13('0x15')],_0xaf2898[_0xfe13('0x16')]));_0xaf2898=_[_0xfe13('0x17')](_0xaf2898,{'transfererchannel':_0xaf2898[_0xfe13('0x18')],'transferercalleridnum':_0xaf2898['origtransferercalleridnum'],'transferercalleridname':_0xaf2898['origtransferercalleridname'],'transfererconnectedlinenum':_0xaf2898[_0xfe13('0x19')],'transfererconnectedlinename':_0xaf2898[_0xfe13('0x1a')],'transfereraccountcode':_0xaf2898[_0xfe13('0x1b')],'transferercontext':_0xaf2898[_0xfe13('0x1c')],'transfererexten':_0xaf2898[_0xfe13('0x1d')],'transfererlinkedid':_0xaf2898[_0xfe13('0x1e')],'context':_0xaf2898[_0xfe13('0x1f')],'extension':_0xaf2898[_0xfe13('0x20')],'type':_0xfe13('0x4')});if(_[_0xfe13('0x21')](_0xaf2898[_0xfe13('0x22')])){_0xaf2898=_[_0xfe13('0x17')](_0xaf2898,{'transfereechannel':_0xaf2898[_0xfe13('0x23')],'transfereecalleridnum':_0xaf2898[_0xfe13('0x15')],'transfereecalleridname':_0xaf2898[_0xfe13('0x16')],'transfereeconnectedlinenum':_0xaf2898[_0xfe13('0x24')],'transfereeconnectedlinename':_0xaf2898['transfertargetconnectedlinename'],'transfereeaccountcode':_0xaf2898[_0xfe13('0x25')],'transfereecontext':_0xaf2898[_0xfe13('0x26')],'transfereeexten':_0xaf2898['transfertargetexten'],'transfereelinkedid':_0xaf2898[_0xfe13('0x27')]});}writeDB(_0xaf2898);}catch(_0x404b36){utils[_0xfe13('0x11')](util[_0xfe13('0x1')](_0xfe13('0x28'),_0xaf2898[_0xfe13('0x5')]),_0x404b36);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index e6d8683..487387a 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 _0xf151=['sumTime','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','GetUser','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','catch','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0xf151,0x1aa));var _0x1f15=function(_0x4b7b37,_0x35294d){_0x4b7b37=_0x4b7b37-0x0;var _0xcd1a8c=_0xf151[_0x4b7b37];return _0xcd1a8c;};'use strict';var BPromise=require(_0x1f15('0x0'));var jayson=require(_0x1f15('0x1'));var moment=require(_0x1f15('0x2'));var util=require(_0x1f15('0x3'));var client=jayson[_0x1f15('0x4')][_0x1f15('0x5')]({'port':0x2329});var logger=require(_0x1f15('0x6'))(_0x1f15('0x7'));exports[_0x1f15('0x8')]=function(_0x3cbfd0,_0x5b063e){logger[_0x1f15('0x8')](_0x3cbfd0,_0x5b063e?util['inspect'](_0x5b063e,{'showHidden':![],'depth':null}):'');};exports[_0x1f15('0x9')]=function(_0x2c4078,_0xf6a4cb){logger[_0x1f15('0x9')](_0x2c4078,_0xf6a4cb?util[_0x1f15('0xa')](_0xf6a4cb,{'showHidden':![],'depth':null}):'');};exports[_0x1f15('0xb')]=function(_0x4afcae,_0xb49c23){logger[_0x1f15('0xb')](_0x4afcae,_0xb49c23?util['inspect'](_0xb49c23,{'showHidden':![],'depth':null}):'');};exports[_0x1f15('0xc')]=function(_0x215b1d,_0x55ccda){return client[_0x1f15('0xc')](_0x215b1d,{'body':_0x55ccda})[_0x1f15('0xd')](function(_0x3b77e1){logger[_0x1f15('0x9')](_0x1f15('0xe'),_0x215b1d,_0x3b77e1?util[_0x1f15('0xa')](_0x3b77e1,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x33037b){logger[_0x1f15('0xb')]('[utils][request]\x20name:%s',_0x215b1d,_0x33037b?util[_0x1f15('0xa')](_0x33037b,{'showHidden':![],'depth':null}):'');});};function getUser(_0x44ceba){return client['request'](_0x1f15('0xf'),{'options':{'raw':!![],'attributes':['id','internal','name',_0x1f15('0x10')],'where':_0x44ceba,'limit':0x1}})[_0x1f15('0xd')](function(_0x142cc4){logger[_0x1f15('0x9')](_0x1f15('0x11'),JSON[_0x1f15('0x12')](_0x44ceba),_0x142cc4?util['inspect'](_0x142cc4,{'showHidden':![],'depth':null}):'');return _0x142cc4[_0x1f15('0x13')][_0x1f15('0x14')]?_0x142cc4['result'][0x0]:null;});}exports[_0x1f15('0x15')]=function(_0x358fa4){return new BPromise(function(_0x7ae5fa,_0x1b3e51){if(_0x358fa4){return getUser({'internal':_0x358fa4})[_0x1f15('0xd')](function(_0x46727a){logger[_0x1f15('0x8')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x358fa4,_0x46727a?_0x1f15('0x16'):_0x1f15('0x17'));return _0x7ae5fa(_0x46727a);})['catch'](function(_0x94c87f){logger['error']('[utils][getUserByInternal]',_0x94c87f?util[_0x1f15('0xa')](_0x94c87f,{'showHidden':![],'depth':null}):'');return _0x7ae5fa(null);});}return _0x7ae5fa(null);});};exports[_0x1f15('0x18')]=function(_0x5f5c24){return new BPromise(function(_0x235543,_0x16bdf2){if(_0x5f5c24){return getUser({'interface':_0x5f5c24})[_0x1f15('0xd')](function(_0x6b617e){logger[_0x1f15('0x8')](_0x1f15('0x19'),_0x5f5c24,_0x6b617e?_0x1f15('0x16'):'notfound');return _0x235543(_0x6b617e);})[_0x1f15('0x1a')](function(_0xf52d53){logger[_0x1f15('0xb')](_0x1f15('0x1b'),_0xf52d53?util[_0x1f15('0xa')](_0xf52d53,{'showHidden':![],'depth':null}):'');return _0x235543(null);});}return _0x235543(null);});};exports[_0x1f15('0x1c')]=function(_0x508715){return new BPromise(function(_0x1c1b14,_0x2cba60){if(_0x508715){return getUser({'name':_0x508715})[_0x1f15('0xd')](function(_0x400700){logger['info'](_0x1f15('0x1d'),_0x508715,_0x400700?_0x1f15('0x16'):'notfound');return _0x1c1b14(_0x400700);})[_0x1f15('0x1a')](function(_0x457e06){logger[_0x1f15('0xb')](_0x1f15('0x1e'),_0x457e06?util[_0x1f15('0xa')](_0x457e06,{'showHidden':![],'depth':null}):'');return _0x1c1b14(null);});}return _0x1c1b14(null);});};exports[_0x1f15('0x1f')]=function(_0x494fb5){return new BPromise(function(_0x47a48a,_0x4414c2){if(_0x494fb5){return client[_0x1f15('0xc')](_0x1f15('0x20'),{'options':{'raw':!![],'attributes':['id',_0x1f15('0x21'),_0x1f15('0x22'),_0x1f15('0x23'),_0x1f15('0x24')],'where':{'name':_0x494fb5},'limit':0x1}})['then'](function(_0x44ac19){logger[_0x1f15('0x9')](_0x1f15('0x25'),_0x494fb5,_0x44ac19?util['inspect'](_0x44ac19,{'showHidden':![],'depth':null}):'');logger[_0x1f15('0x8')](_0x1f15('0x26'),_0x494fb5,_0x44ac19?_0x1f15('0x16'):'notfound');return _0x47a48a(_0x44ac19[_0x1f15('0x13')][_0x1f15('0x14')]?_0x44ac19[_0x1f15('0x13')][0x0]:null);})[_0x1f15('0x1a')](function(_0x15bd58){logger[_0x1f15('0xb')]('[utils][getVoiceQueueByName]',_0x15bd58?util[_0x1f15('0xa')](_0x15bd58,{'showHidden':![],'depth':null}):'');return _0x47a48a(null);});}return _0x47a48a(null);});};exports['addTime']=function(_0x1f7de7,_0x1e1c2a){return moment(_0x1f7de7)['add'](_0x1e1c2a,_0x1f15('0x27'))['format'](_0x1f15('0x28'));};exports[_0x1f15('0x29')]=function(_0x43c0c5,_0x1cfd4c){return moment(_0x43c0c5)[_0x1f15('0x2a')](_0x1cfd4c,_0x1f15('0x27'))[_0x1f15('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x515c14,_0x119b3c){return moment(_0x515c14)['diff'](moment(_0x119b3c),_0x1f15('0x27'));};exports[_0x1f15('0x2c')]=function(_0x15bfc5,_0x3f6c36){return parseInt(_0x15bfc5,0xa)+parseInt(_0x3f6c36,0xa);};exports['now']=function(){return moment()[_0x1f15('0x2b')](_0x1f15('0x28'));};exports[_0x1f15('0x2d')]=function(_0x11184c,_0x50a8ec){if(_0x50a8ec){return moment(_0x11184c)['isAfter'](_0x50a8ec);}return!![];};exports[_0x1f15('0x2e')]=function(_0xc783b9,_0x1f95fe){if(_0x1f95fe){return moment(_0xc783b9)[_0x1f15('0x2e')](_0x1f95fe);}else if(_0xc783b9){return!![];}return![];}; \ No newline at end of file +var _0xda1e=['../../config/logger','xdr','info','inspect','debug','error','request','then','catch','[utils][request]\x20name:%s','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','format','isBefore','bluebird','moment','util','client','http'];(function(_0x2fa9ef,_0x11eb49){var _0x40a7db=function(_0x387c7c){while(--_0x387c7c){_0x2fa9ef['push'](_0x2fa9ef['shift']());}};_0x40a7db(++_0x11eb49);}(_0xda1e,0xeb));var _0xeda1=function(_0x1cfc39,_0x1d3913){_0x1cfc39=_0x1cfc39-0x0;var _0x957a28=_0xda1e[_0x1cfc39];return _0x957a28;};'use strict';var BPromise=require(_0xeda1('0x0'));var jayson=require('jayson/promise');var moment=require(_0xeda1('0x1'));var util=require(_0xeda1('0x2'));var client=jayson[_0xeda1('0x3')][_0xeda1('0x4')]({'port':0x2329});var logger=require(_0xeda1('0x5'))(_0xeda1('0x6'));exports[_0xeda1('0x7')]=function(_0x18312a,_0x4467f6){logger['info'](_0x18312a,_0x4467f6?util[_0xeda1('0x8')](_0x4467f6,{'showHidden':![],'depth':null}):'');};exports[_0xeda1('0x9')]=function(_0x3d3c8b,_0x9319d6){logger[_0xeda1('0x9')](_0x3d3c8b,_0x9319d6?util['inspect'](_0x9319d6,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x546115,_0x124267){logger[_0xeda1('0xa')](_0x546115,_0x124267?util[_0xeda1('0x8')](_0x124267,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x28bde1,_0x293001){return client[_0xeda1('0xb')](_0x28bde1,{'body':_0x293001})[_0xeda1('0xc')](function(_0x3616a6){logger[_0xeda1('0x9')]('[utils][request]\x20name:%s',_0x28bde1,_0x3616a6?util['inspect'](_0x3616a6,{'showHidden':![],'depth':null}):'');})[_0xeda1('0xd')](function(_0x22253c){logger[_0xeda1('0xa')](_0xeda1('0xe'),_0x28bde1,_0x22253c?util['inspect'](_0x22253c,{'showHidden':![],'depth':null}):'');});};function getUser(_0x540b6f){return client[_0xeda1('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0xeda1('0xf'),_0xeda1('0x10')],'where':_0x540b6f,'limit':0x1}})[_0xeda1('0xc')](function(_0x1e399e){logger['debug'](_0xeda1('0x11'),JSON[_0xeda1('0x12')](_0x540b6f),_0x1e399e?util[_0xeda1('0x8')](_0x1e399e,{'showHidden':![],'depth':null}):'');return _0x1e399e[_0xeda1('0x13')][_0xeda1('0x14')]?_0x1e399e[_0xeda1('0x13')][0x0]:null;});}exports[_0xeda1('0x15')]=function(_0x2f8cf8){return new BPromise(function(_0x1fd8f5,_0x48aaf4){if(_0x2f8cf8){return getUser({'internal':_0x2f8cf8})['then'](function(_0x49ff62){logger[_0xeda1('0x7')](_0xeda1('0x16'),_0x2f8cf8,_0x49ff62?_0xeda1('0x17'):_0xeda1('0x18'));return _0x1fd8f5(_0x49ff62);})[_0xeda1('0xd')](function(_0x1498b3){logger['error']('[utils][getUserByInternal]',_0x1498b3?util[_0xeda1('0x8')](_0x1498b3,{'showHidden':![],'depth':null}):'');return _0x1fd8f5(null);});}return _0x1fd8f5(null);});};exports[_0xeda1('0x19')]=function(_0x723334){return new BPromise(function(_0x28b5e0,_0x3d9ad7){if(_0x723334){return getUser({'interface':_0x723334})[_0xeda1('0xc')](function(_0x3f7075){logger['info'](_0xeda1('0x1a'),_0x723334,_0x3f7075?'found':_0xeda1('0x18'));return _0x28b5e0(_0x3f7075);})['catch'](function(_0x18f70b){logger['error']('[utils][getUserByInterface]',_0x18f70b?util['inspect'](_0x18f70b,{'showHidden':![],'depth':null}):'');return _0x28b5e0(null);});}return _0x28b5e0(null);});};exports[_0xeda1('0x1b')]=function(_0x26191c){return new BPromise(function(_0x472595,_0xf8eedb){if(_0x26191c){return getUser({'name':_0x26191c})[_0xeda1('0xc')](function(_0x3780ab){logger[_0xeda1('0x7')](_0xeda1('0x1c'),_0x26191c,_0x3780ab?_0xeda1('0x17'):'notfound');return _0x472595(_0x3780ab);})['catch'](function(_0x41206b){logger['error'](_0xeda1('0x1d'),_0x41206b?util[_0xeda1('0x8')](_0x41206b,{'showHidden':![],'depth':null}):'');return _0x472595(null);});}return _0x472595(null);});};exports[_0xeda1('0x1e')]=function(_0x5e057e){return new BPromise(function(_0x44f7f9,_0x128e4f){if(_0x5e057e){return client[_0xeda1('0xb')](_0xeda1('0x1f'),{'options':{'raw':!![],'attributes':['id',_0xeda1('0xf'),_0xeda1('0x20'),'acw','acwTimeout'],'where':{'name':_0x5e057e},'limit':0x1}})[_0xeda1('0xc')](function(_0x451e40){logger[_0xeda1('0x9')](_0xeda1('0x21'),_0x5e057e,_0x451e40?util[_0xeda1('0x8')](_0x451e40,{'showHidden':![],'depth':null}):'');logger[_0xeda1('0x7')](_0xeda1('0x22'),_0x5e057e,_0x451e40?_0xeda1('0x17'):_0xeda1('0x18'));return _0x44f7f9(_0x451e40[_0xeda1('0x13')]['length']?_0x451e40['result'][0x0]:null);})[_0xeda1('0xd')](function(_0x372b25){logger[_0xeda1('0xa')](_0xeda1('0x23'),_0x372b25?util[_0xeda1('0x8')](_0x372b25,{'showHidden':![],'depth':null}):'');return _0x44f7f9(null);});}return _0x44f7f9(null);});};exports[_0xeda1('0x24')]=function(_0x13aa87,_0x239b1a){return moment(_0x13aa87)[_0xeda1('0x25')](_0x239b1a,_0xeda1('0x26'))['format'](_0xeda1('0x27'));};exports[_0xeda1('0x28')]=function(_0x23fdb7,_0x1dc54e){return moment(_0x23fdb7)[_0xeda1('0x29')](_0x1dc54e,_0xeda1('0x26'))['format'](_0xeda1('0x27'));};exports[_0xeda1('0x2a')]=function(_0xd73e3,_0x3630f2){return moment(_0xd73e3)[_0xeda1('0x2b')](moment(_0x3630f2),_0xeda1('0x26'));};exports[_0xeda1('0x2c')]=function(_0x58b5dd,_0x465025){return parseInt(_0x58b5dd,0xa)+parseInt(_0x465025,0xa);};exports[_0xeda1('0x2d')]=function(){return moment()[_0xeda1('0x2e')](_0xeda1('0x27'));};exports['isAfter']=function(_0x5375d6,_0x5e0d39){if(_0x5e0d39){return moment(_0x5375d6)['isAfter'](_0x5e0d39);}return!![];};exports[_0xeda1('0x2f')]=function(_0x3d5e79,_0x42baf4){if(_0x42baf4){return moment(_0x3d5e79)[_0xeda1('0x2f')](_0x42baf4);}else if(_0x3d5e79){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index f4bee44..c6a32d9 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd143=['log','xcally','client','role','ensureDir','then','user','data','timestamp','catch','api','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','name','other','agent_name','test','setupLoggers','lodash','express-winston','path','util','./loggers','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var'];(function(_0x55c33c,_0x362ef1){var _0x2ea749=function(_0x3dfebd){while(--_0x3dfebd){_0x55c33c['push'](_0x55c33c['shift']());}};_0x2ea749(++_0x362ef1);}(_0xd143,0x1da));var _0x3d14=function(_0xb121a8,_0x12ae10){_0xb121a8=_0xb121a8-0x0;var _0x4c1f68=_0xd143[_0xb121a8];return _0x4c1f68;};var fs=require('fs-extra');var _=require(_0x3d14('0x0'));var ewinston=require(_0x3d14('0x1'));var path=require(_0x3d14('0x2'));var util=require(_0x3d14('0x3'));var fileLogger=require(_0x3d14('0x4'))['fileLogger'];var safeTemplate=require('./safe-template')[_0x3d14('0x5')];var maskSensitiveData=require(_0x3d14('0x6'))[_0x3d14('0x7')];function ClientSideLogger(){function _0x4a8deb(_0x2b38d6){var _0x47d837=path[_0x3d14('0x8')](_0x3d14('0x9'),_0x3d14('0xa'),_0x3d14('0xb'));var _0x3d2c5d=path[_0x3d14('0x8')](_0x3d14('0xc'),_0x2b38d6[_0x3d14('0xd')]+'-'+_0x2b38d6['name']);return fs[_0x3d14('0xe')](path[_0x3d14('0x8')](_0x47d837,_0x3d2c5d))[_0x3d14('0xf')](function(){var _0x39df69=fileLogger('client',path['join'](_0x47d837,_0x3d2c5d));return _0x39df69;})['catch'](function(_0x50ed2f){throw _0x50ed2f;});}this[_0x3d14('0xa')]=function(_0x5a21f4,_0xb813cd,_0x19b258,_0x5a3676){return _0x4a8deb(_0x5a21f4[_0x3d14('0x10')])[_0x3d14('0xf')](function(_0x3639c4){var _0x366bb9=_0x3639c4[_0xb813cd];return _0x366bb9;})[_0x3d14('0xf')](function(_0x51714d){var _0xa56e58=_0x5a21f4[_0x3d14('0x10')]?_0x5a21f4[_0x3d14('0x10')]['id']:'no-user';var _0x286e5c=_0x5a3676[_0x3d14('0x11')];var _0x3ff0cf=_0x5a3676[_0x3d14('0x12')];var _0x592bb6=new Date(Number(_0x3ff0cf));return _0x51714d(_0xa56e58,_0x592bb6,_0x19b258,_0x286e5c);})[_0x3d14('0x13')](function(_0x3c47a2){fileLogger('client')['error'](_0x3c47a2);});};}function setupLoggers(_0x596593){return new Promise(function(_0x16fa7c){var _0x32cbdf=new ClientSideLogger();var _0x7f027f=fileLogger(_0x3d14('0x14'));var _0x3903f0=fileLogger(_0x3d14('0x15'));_0x596593[_0x3d14('0x16')](_0x3d14('0x17'),_0x32cbdf);_0x596593['use'](ewinston[_0x3d14('0x18')]({'winstonInstance':_0x7f027f,'meta':![],'statusLevels':!![],'msg':function(_0x55c32a,_0x426fcf){var _0x5d0913=_0x3d14('0x19');if(!_['isEmpty'](_0x55c32a[_0x3d14('0x1a')])){_0x5d0913+='\x20body=%s';var _0x5c1d84=_0x55c32a['body'];maskSensitiveData(_0x5c1d84);}return safeTemplate(util[_0x3d14('0x1b')](_0x5d0913,_0x55c32a['method'],_0x55c32a[_0x3d14('0x1c')][_0x3d14('0x1d')]?_0x55c32a[_0x3d14('0x1c')][_0x3d14('0x1d')]:_0x55c32a[_0x3d14('0x1e')][_0x3d14('0x1f')]||_0x55c32a['ip'],_0x55c32a[_0x3d14('0x20')],_0x426fcf[_0x3d14('0x21')],_0x426fcf[_0x3d14('0x22')],_0x55c32a[_0x3d14('0x10')]?_0x55c32a['user']['id']:null,_0x55c32a[_0x3d14('0x10')]?_0x55c32a[_0x3d14('0x10')]['name']:null,_0x55c32a[_0x3d14('0x10')]?_0x55c32a[_0x3d14('0x10')][_0x3d14('0xd')]:null,_0x5c1d84?util['inspect'](_0x5c1d84,![],null):''));}}));_0x596593[_0x3d14('0x23')](ewinston[_0x3d14('0x18')]({'winstonInstance':_0x3903f0,'meta':![],'statusLevels':!![],'msg':function(_0x8370e6,_0x46b669){var _0x5d41d9=_0x3d14('0x24');if(_0x8370e6[_0x3d14('0x1a')]&&_0x8370e6[_0x3d14('0x1a')][_0x3d14('0x25')]&&_0x8370e6[_0x3d14('0x1a')][_0x3d14('0x26')]){_0x5d41d9='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x3d14('0x1b')](_0x5d41d9,_0x8370e6['method'],_0x8370e6['headers'][_0x3d14('0x1d')]?_0x8370e6['headers'][_0x3d14('0x1d')]:_0x8370e6[_0x3d14('0x1e')][_0x3d14('0x1f')]||_0x8370e6['ip'],_0x8370e6[_0x3d14('0x20')],_0x46b669[_0x3d14('0x21')],_0x46b669['responseTime'],_0x8370e6[_0x3d14('0x10')]?_0x8370e6[_0x3d14('0x10')]['id']:null,_0x8370e6[_0x3d14('0x10')]?_0x8370e6[_0x3d14('0x10')][_0x3d14('0x27')]:null,_0x8370e6[_0x3d14('0x10')]?_0x8370e6[_0x3d14('0x10')][_0x3d14('0xd')]:null,_0x8370e6[_0x3d14('0x1a')]&&_0x8370e6['body'][_0x3d14('0x25')]?_0x8370e6[_0x3d14('0x1a')][_0x3d14('0x25')]:_0x3d14('0x28'),_0x8370e6['body']&&_0x8370e6[_0x3d14('0x1a')][_0x3d14('0x26')]?_0x8370e6[_0x3d14('0x1a')]['agent_id']:'',_0x8370e6['body']&&_0x8370e6[_0x3d14('0x1a')][_0x3d14('0x29')]?_0x8370e6['body']['agent_name']:'');},'ignoreRoute':function(_0x261987){var _0x32dd3b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x32dd3b[_0x3d14('0x2a')](_0x261987[_0x3d14('0x20')]);}}));return _0x16fa7c();});}exports[_0x3d14('0x2b')]=setupLoggers; \ No newline at end of file +var _0xa6a3=['client','catch','user','no-user','data','error','api','auth','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','headers','url','statusCode','responseTime','name','inspect','logger','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','remoteAddress','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','role','ensureDir','then'];(function(_0x3ea852,_0x2beef0){var _0x285247=function(_0x22b246){while(--_0x22b246){_0x3ea852['push'](_0x3ea852['shift']());}};_0x285247(++_0x2beef0);}(_0xa6a3,0xa5));var _0x3a6a=function(_0x367284,_0x26688c){_0x367284=_0x367284-0x0;var _0xe5c015=_0xa6a3[_0x367284];return _0xe5c015;};var fs=require(_0x3a6a('0x0'));var _=require(_0x3a6a('0x1'));var ewinston=require(_0x3a6a('0x2'));var path=require('path');var util=require('util');var fileLogger=require(_0x3a6a('0x3'))[_0x3a6a('0x4')];var safeTemplate=require(_0x3a6a('0x5'))[_0x3a6a('0x6')];var maskSensitiveData=require(_0x3a6a('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x2e2ce6(_0x1a9794){var _0xfd9cb5=path[_0x3a6a('0x8')](_0x3a6a('0x9'),_0x3a6a('0xa'),_0x3a6a('0xb'));var _0x5c282f=path[_0x3a6a('0x8')]('client',_0x1a9794[_0x3a6a('0xc')]+'-'+_0x1a9794['name']);return fs[_0x3a6a('0xd')](path['join'](_0xfd9cb5,_0x5c282f))[_0x3a6a('0xe')](function(){var _0x55db50=fileLogger(_0x3a6a('0xf'),path[_0x3a6a('0x8')](_0xfd9cb5,_0x5c282f));return _0x55db50;})[_0x3a6a('0x10')](function(_0x4888da){throw _0x4888da;});}this[_0x3a6a('0xa')]=function(_0x37aa58,_0x3f9226,_0x4b05af,_0x2cc14e){return _0x2e2ce6(_0x37aa58[_0x3a6a('0x11')])[_0x3a6a('0xe')](function(_0x438dba){var _0x34f61f=_0x438dba[_0x3f9226];return _0x34f61f;})[_0x3a6a('0xe')](function(_0x159345){var _0x3d749a=_0x37aa58[_0x3a6a('0x11')]?_0x37aa58['user']['id']:_0x3a6a('0x12');var _0x201bd4=_0x2cc14e[_0x3a6a('0x13')];var _0x3c689c=_0x2cc14e['timestamp'];var _0x3ad8a4=new Date(Number(_0x3c689c));return _0x159345(_0x3d749a,_0x3ad8a4,_0x4b05af,_0x201bd4);})[_0x3a6a('0x10')](function(_0xebc9e9){fileLogger(_0x3a6a('0xf'))[_0x3a6a('0x14')](_0xebc9e9);});};}function setupLoggers(_0x1c8d44){return new Promise(function(_0x1d9149){var _0x56af47=new ClientSideLogger();var _0x4c49aa=fileLogger(_0x3a6a('0x15'));var _0x5d96db=fileLogger(_0x3a6a('0x16'));_0x1c8d44['set']('client-side-logger',_0x56af47);_0x1c8d44[_0x3a6a('0x17')](ewinston['logger']({'winstonInstance':_0x4c49aa,'meta':![],'statusLevels':!![],'msg':function(_0x3b0980,_0x539865){var _0x4a1bfc=_0x3a6a('0x18');if(!_[_0x3a6a('0x19')](_0x3b0980[_0x3a6a('0x1a')])){_0x4a1bfc+=_0x3a6a('0x1b');var _0x32b8d8=_0x3b0980[_0x3a6a('0x1a')];maskSensitiveData(_0x32b8d8);}return safeTemplate(util[_0x3a6a('0x1c')](_0x4a1bfc,_0x3b0980[_0x3a6a('0x1d')],_0x3b0980['headers'][_0x3a6a('0x1e')]?_0x3b0980[_0x3a6a('0x1f')]['x-forwarded-for']:_0x3b0980['connection']['remoteAddress']||_0x3b0980['ip'],_0x3b0980[_0x3a6a('0x20')],_0x539865[_0x3a6a('0x21')],_0x539865[_0x3a6a('0x22')],_0x3b0980[_0x3a6a('0x11')]?_0x3b0980[_0x3a6a('0x11')]['id']:null,_0x3b0980[_0x3a6a('0x11')]?_0x3b0980['user'][_0x3a6a('0x23')]:null,_0x3b0980[_0x3a6a('0x11')]?_0x3b0980[_0x3a6a('0x11')][_0x3a6a('0xc')]:null,_0x32b8d8?util[_0x3a6a('0x24')](_0x32b8d8,![],null):''));}}));_0x1c8d44[_0x3a6a('0x17')](ewinston[_0x3a6a('0x25')]({'winstonInstance':_0x5d96db,'meta':![],'statusLevels':!![],'msg':function(_0x34f51a,_0xbb8e50){var _0x179dde='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x34f51a['body']&&_0x34f51a['body'][_0x3a6a('0x26')]&&_0x34f51a[_0x3a6a('0x1a')]['agent_id']){_0x179dde=_0x3a6a('0x27');}return util[_0x3a6a('0x1c')](_0x179dde,_0x34f51a[_0x3a6a('0x1d')],_0x34f51a['headers'][_0x3a6a('0x1e')]?_0x34f51a['headers']['x-forwarded-for']:_0x34f51a['connection'][_0x3a6a('0x28')]||_0x34f51a['ip'],_0x34f51a['url'],_0xbb8e50[_0x3a6a('0x21')],_0xbb8e50[_0x3a6a('0x22')],_0x34f51a[_0x3a6a('0x11')]?_0x34f51a[_0x3a6a('0x11')]['id']:null,_0x34f51a[_0x3a6a('0x11')]?_0x34f51a[_0x3a6a('0x11')][_0x3a6a('0x23')]:null,_0x34f51a['user']?_0x34f51a[_0x3a6a('0x11')][_0x3a6a('0xc')]:null,_0x34f51a[_0x3a6a('0x1a')]&&_0x34f51a[_0x3a6a('0x1a')][_0x3a6a('0x26')]?_0x34f51a[_0x3a6a('0x1a')][_0x3a6a('0x26')]:'other',_0x34f51a[_0x3a6a('0x1a')]&&_0x34f51a[_0x3a6a('0x1a')][_0x3a6a('0x29')]?_0x34f51a['body'][_0x3a6a('0x29')]:'',_0x34f51a[_0x3a6a('0x1a')]&&_0x34f51a[_0x3a6a('0x1a')][_0x3a6a('0x2a')]?_0x34f51a['body'][_0x3a6a('0x2a')]:'');},'ignoreRoute':function(_0x151b80){var _0x32ef50=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x32ef50[_0x3a6a('0x2b')](_0x151b80['url']);}}));return _0x1d9149();});}exports[_0x3a6a('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 4a340c8..6f64bb6 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed92=['slice','concat','exports','locale','monthsShort','circularMonthInterval','clone','hours','minutes','day','isBetween','timeCompare','format','dowCompare','date','daysInMonth','min','domCompare','MMM','monthCompare','test','isMoment','length','padStart','iftime','lodash','moment-timezone','map','source','join','Date\x20not\x20valid','isValid','split','weekdaysShort','toLowerCase','indexOf'];(function(_0x313754,_0x147f5e){var _0x5a3f2a=function(_0x28267e){while(--_0x28267e){_0x313754['push'](_0x313754['shift']());}};_0x5a3f2a(++_0x147f5e);}(_0xed92,0x1a5));var _0x2ed9=function(_0x376571,_0x3e9234){_0x376571=_0x376571-0x0;var _0x26f58a=_0xed92[_0x376571];return _0x26f58a;};var _=require(_0x2ed9('0x0'));var moment=require(_0x2ed9('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x2ed9('0x2')](function(_0x144e4c){return _0x144e4c[_0x2ed9('0x3')];})[_0x2ed9('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x2ed9('0x5');function throwIfDateNotValid(_0x279995){if(!_0x279995[_0x2ed9('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x31584d){var _0x19e466=_0x31584d[_0x2ed9('0x7')](':')[_0x2ed9('0x2')](function(_0x283878){return parseInt(_0x283878,0xa);});var _0x59461d=_0x19e466[0x0];var _0x429976=_0x19e466[0x1];if(_0x59461d<0x0||_0x59461d>0x17||_0x429976<0x0||_0x429976>0x3b){throw new Error(EINVALID_DATE);}return[_0x59461d,_0x429976];}function circularDoWInterval(_0x258fc8,_0x585fd9){if(_0x258fc8===_0x585fd9){return[_0x258fc8];}else{var _0x87ab33=moment['locale']();moment['locale']('en');var _0xe990c5=moment[_0x2ed9('0x8')]()[_0x2ed9('0x2')](function(_0x5a3e55){return _0x5a3e55[_0x2ed9('0x9')]();});moment['locale'](_0x87ab33);var _0x35d2e3=_0xe990c5[_0x2ed9('0xa')](_0x258fc8);var _0x4d5eee=_0xe990c5[_0x2ed9('0xa')](_0x585fd9);if(_0x4d5eee>_0x35d2e3){return _0xe990c5[_0x2ed9('0xb')](_0x35d2e3,_0x4d5eee+0x1);}else{var _0x5dec96=_0xe990c5[_0x2ed9('0xb')](0x0,_0x4d5eee+0x1);var _0x51f3cb=_0xe990c5[_0x2ed9('0xb')](_0x35d2e3);return _0x51f3cb[_0x2ed9('0xc')](_0x5dec96);}}}module[_0x2ed9('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x172569,_0x1afd59){if(_0x172569===_0x1afd59){return[_0x172569];}else{var _0x398bf1=moment[_0x2ed9('0xe')]();moment['locale']('en');var _0x2a2ce7=moment[_0x2ed9('0xf')]()[_0x2ed9('0x2')](function(_0x16506e){return _0x16506e[_0x2ed9('0x9')]();});moment[_0x2ed9('0xe')](_0x398bf1);var _0x1c03a5=_0x2a2ce7['indexOf'](_0x172569);var _0x3da0f7=_0x2a2ce7[_0x2ed9('0xa')](_0x1afd59);if(_0x3da0f7>_0x1c03a5){return _0x2a2ce7[_0x2ed9('0xb')](_0x1c03a5,_0x3da0f7+0x1);}else{var _0x1b17b5=_0x2a2ce7[_0x2ed9('0xb')](0x0,_0x3da0f7+0x1);var _0x246428=_0x2a2ce7['slice'](_0x1c03a5);return _0x246428[_0x2ed9('0xc')](_0x1b17b5);}}}module[_0x2ed9('0xd')][_0x2ed9('0x10')]=circularMonthInterval;function parseDom(_0x4be46c){var _0x981539=parseInt(_0x4be46c,0xa);if(_0x981539<0x1||_0x981539>0x1f){throw new Error(EINVALID_DATE);}return _0x981539;}function timeCompare(_0x2241cd,_0x6591ed,_0x226760){var _0x2f2d96=_0x2241cd['clone']();var _0x190be6=extractTime(_0x6591ed);var _0x307134=_0x190be6[0x0];var _0x2abfa3=_0x190be6[0x1];var _0x141609=_0x2241cd[_0x2ed9('0x11')]()[_0x2ed9('0x12')](_0x307134)[_0x2ed9('0x13')](_0x2abfa3);throwIfDateNotValid(_0x141609);var _0x48da5a=extractTime(_0x226760);var _0x504ffc=_0x48da5a[0x0];var _0xf73b2b=_0x48da5a[0x1];var _0x445f53=_0x2241cd['clone']()['hours'](_0x504ffc)[_0x2ed9('0x13')](_0xf73b2b);throwIfDateNotValid(_0x445f53);if(_0x445f53['isBefore'](_0x141609)){var _0x4da0b9=_0x2f2d96[_0x2ed9('0x11')]()['startOf']('day');var _0x44a99c=_0x2f2d96['clone']()['endOf'](_0x2ed9('0x14'));return _0x2f2d96['isBetween'](_0x141609,_0x44a99c,undefined,'[]')||_0x2f2d96['isBetween'](_0x4da0b9,_0x445f53,undefined,'[]');}else{return _0x2f2d96[_0x2ed9('0x15')](_0x141609,_0x445f53,undefined,'[]');}}module[_0x2ed9('0xd')][_0x2ed9('0x16')]=timeCompare;function dowCompare(_0x16bbac,_0x563643,_0x1107a8){var _0x3ee9bc=_0x16bbac['locale']('en')[_0x2ed9('0x17')]('ddd')['toLowerCase']();return circularDoWInterval(_0x563643,_0x1107a8)['includes'](_0x3ee9bc);}module[_0x2ed9('0xd')][_0x2ed9('0x18')]=dowCompare;function domCompare(_0x30ce34,_0x1dd391,_0x2345f9){var _0x14be5c=_0x30ce34[_0x2ed9('0x19')]();if(_0x1dd391===_0x2345f9){return _0x14be5c===_0x1dd391;}else{var _0x401e2a=_0x30ce34[_0x2ed9('0x1a')]();var _0xb87810=_0x1dd391<_0x2345f9;let _0x4c06b2=![];var _0x5bb4cd=0x0;var _0x160e8a=0x0;if(_0xb87810){_0x5bb4cd=Math['max'](0x1,_0x1dd391);_0x160e8a=Math[_0x2ed9('0x1b')](_0x2345f9,_0x401e2a);_0x4c06b2=_0x14be5c>=_0x5bb4cd&&_0x14be5c<=_0x160e8a;}else{_0x5bb4cd=Math['min'](_0x1dd391,_0x401e2a);_0x160e8a=Math['max'](0x1,_0x2345f9);_0x4c06b2=_0x14be5c>=_0x5bb4cd||_0x14be5c<=_0x160e8a;}return _0x4c06b2;}}module['exports'][_0x2ed9('0x1c')]=domCompare;function monthCompare(_0x4ddcc3,_0x533a3d,_0x2bd3d7){var _0x2ee3d4=_0x4ddcc3[_0x2ed9('0xe')]('en')[_0x2ed9('0x17')](_0x2ed9('0x1d'))[_0x2ed9('0x9')]();return circularMonthInterval(_0x533a3d,_0x2bd3d7)['includes'](_0x2ee3d4);}module['exports'][_0x2ed9('0x1e')]=monthCompare;function iftime(_0x47d19d,_0x4379f0=moment['tz']['guess'](),_0x21258f=moment()){if(!validateRx[_0x2ed9('0x1f')](_0x47d19d)){throw new Error(EINVALID_STRING);}else{var _0x150b6e=(moment[_0x2ed9('0x20')](_0x21258f)?_0x21258f['clone']():moment(_0x21258f))['tz'](_0x4379f0)[_0x2ed9('0xe')]('en');throwIfDateNotValid(_0x150b6e);var _0xd316b8=_0x47d19d['split'](',');var _0x3e00da=_0xd316b8[0x0];var _0x557418=_0xd316b8[0x1];var _0x379195=_0xd316b8[0x2];var _0x4a8ba9=_0xd316b8[0x3];let _0x5cb433=!![];if(_0x3e00da!=='*'){var _0x56dc4d=_0x3e00da[_0x2ed9('0x7')]('-');var _0x6d7f21=_['padStart'](_0x56dc4d[0x0],0x5,'0');var _0x55e0d0=_0x56dc4d[_0x2ed9('0x21')]===0x2?_[_0x2ed9('0x22')](_0x56dc4d[0x1],0x5,'0'):_0x6d7f21;_0x5cb433=timeCompare(_0x150b6e,_0x6d7f21,_0x55e0d0);}let _0x56b0a0=!![];if(_0x557418!=='*'){var _0x2a92a4=_0x557418[_0x2ed9('0x7')]('-');var _0x23c9ea=_0x2a92a4[0x0];var _0xe17b2c=_0x2a92a4[_0x2ed9('0x21')]===0x2?_0x2a92a4[0x1]:_0x23c9ea;_0x56b0a0=dowCompare(_0x150b6e,_0x23c9ea,_0xe17b2c);}let _0x439a8c=!![];if(_0x379195!=='*'){var _0x35d980=_0x379195['split']('-');var _0x3d858d=parseDom(_0x35d980[0x0]);var _0x4e7243=_0x35d980[_0x2ed9('0x21')]===0x2?parseDom(_0x35d980[0x1]):_0x3d858d;_0x439a8c=domCompare(_0x150b6e,_0x3d858d,_0x4e7243);}let _0x193a44=!![];if(_0x4a8ba9!=='*'){var _0x38f999=_0x4a8ba9[_0x2ed9('0x7')]('-');var _0x3cf538=_0x38f999[0x0];var _0x410f8c=_0x38f999['length']===0x2?_0x38f999[0x1]:_0x38f999[0x0];_0x193a44=monthCompare(_0x150b6e,_0x3cf538,_0x410f8c);}return _0x5cb433&&_0x56b0a0&&_0x439a8c&&_0x193a44;}}module[_0x2ed9('0xd')][_0x2ed9('0x23')]=iftime; \ No newline at end of file +var _0xb08b=['concat','toLowerCase','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','includes','max','min','domCompare','MMM','test','isMoment','padStart','length','lodash','moment-timezone','source','join','isValid','split','map','locale','weekdaysShort','indexOf','slice'];(function(_0x127a5b,_0x46a722){var _0x1ddf6d=function(_0x33ba9e){while(--_0x33ba9e){_0x127a5b['push'](_0x127a5b['shift']());}};_0x1ddf6d(++_0x46a722);}(_0xb08b,0x149));var _0xbb08=function(_0x585dcd,_0x15f700){_0x585dcd=_0x585dcd-0x0;var _0x10aacb=_0xb08b[_0x585dcd];return _0x10aacb;};var _=require(_0xbb08('0x0'));var moment=require(_0xbb08('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x4de79b){return _0x4de79b[_0xbb08('0x2')];})[_0xbb08('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x55f533){if(!_0x55f533[_0xbb08('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x54f993){var _0x54bde4=_0x54f993[_0xbb08('0x5')](':')[_0xbb08('0x6')](function(_0x2db156){return parseInt(_0x2db156,0xa);});var _0x5c75df=_0x54bde4[0x0];var _0x5080f7=_0x54bde4[0x1];if(_0x5c75df<0x0||_0x5c75df>0x17||_0x5080f7<0x0||_0x5080f7>0x3b){throw new Error(EINVALID_DATE);}return[_0x5c75df,_0x5080f7];}function circularDoWInterval(_0x1d760d,_0x577778){if(_0x1d760d===_0x577778){return[_0x1d760d];}else{var _0x2f1640=moment[_0xbb08('0x7')]();moment[_0xbb08('0x7')]('en');var _0x81e132=moment[_0xbb08('0x8')]()['map'](function(_0x1219d3){return _0x1219d3['toLowerCase']();});moment[_0xbb08('0x7')](_0x2f1640);var _0x111870=_0x81e132[_0xbb08('0x9')](_0x1d760d);var _0x270b3a=_0x81e132[_0xbb08('0x9')](_0x577778);if(_0x270b3a>_0x111870){return _0x81e132['slice'](_0x111870,_0x270b3a+0x1);}else{var _0x3efa95=_0x81e132[_0xbb08('0xa')](0x0,_0x270b3a+0x1);var _0xb0672c=_0x81e132[_0xbb08('0xa')](_0x111870);return _0xb0672c[_0xbb08('0xb')](_0x3efa95);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x54e7bc,_0x56bb73){if(_0x54e7bc===_0x56bb73){return[_0x54e7bc];}else{var _0x5601f6=moment['locale']();moment[_0xbb08('0x7')]('en');var _0x84a115=moment['monthsShort']()[_0xbb08('0x6')](function(_0x4df2c9){return _0x4df2c9[_0xbb08('0xc')]();});moment[_0xbb08('0x7')](_0x5601f6);var _0x3fb0bf=_0x84a115['indexOf'](_0x54e7bc);var _0x18c935=_0x84a115[_0xbb08('0x9')](_0x56bb73);if(_0x18c935>_0x3fb0bf){return _0x84a115[_0xbb08('0xa')](_0x3fb0bf,_0x18c935+0x1);}else{var _0x43d290=_0x84a115[_0xbb08('0xa')](0x0,_0x18c935+0x1);var _0x3c7c87=_0x84a115[_0xbb08('0xa')](_0x3fb0bf);return _0x3c7c87[_0xbb08('0xb')](_0x43d290);}}}module[_0xbb08('0xd')][_0xbb08('0xe')]=circularMonthInterval;function parseDom(_0x36a67d){var _0x10f538=parseInt(_0x36a67d,0xa);if(_0x10f538<0x1||_0x10f538>0x1f){throw new Error(EINVALID_DATE);}return _0x10f538;}function timeCompare(_0x3d03af,_0x2b6e2b,_0x5f31b9){var _0x3f11ed=_0x3d03af[_0xbb08('0xf')]();var _0x600f1d=extractTime(_0x2b6e2b);var _0x344ddb=_0x600f1d[0x0];var _0x15e35b=_0x600f1d[0x1];var _0x4ced51=_0x3d03af[_0xbb08('0xf')]()[_0xbb08('0x10')](_0x344ddb)[_0xbb08('0x11')](_0x15e35b);throwIfDateNotValid(_0x4ced51);var _0x348401=extractTime(_0x5f31b9);var _0x3754bd=_0x348401[0x0];var _0x464015=_0x348401[0x1];var _0x10b050=_0x3d03af[_0xbb08('0xf')]()[_0xbb08('0x10')](_0x3754bd)[_0xbb08('0x11')](_0x464015);throwIfDateNotValid(_0x10b050);if(_0x10b050[_0xbb08('0x12')](_0x4ced51)){var _0x279897=_0x3f11ed[_0xbb08('0xf')]()[_0xbb08('0x13')](_0xbb08('0x14'));var _0x2853de=_0x3f11ed[_0xbb08('0xf')]()['endOf'](_0xbb08('0x14'));return _0x3f11ed[_0xbb08('0x15')](_0x4ced51,_0x2853de,undefined,'[]')||_0x3f11ed['isBetween'](_0x279897,_0x10b050,undefined,'[]');}else{return _0x3f11ed[_0xbb08('0x15')](_0x4ced51,_0x10b050,undefined,'[]');}}module[_0xbb08('0xd')][_0xbb08('0x16')]=timeCompare;function dowCompare(_0x2f2151,_0x3219d5,_0x24c200){var _0x23e89e=_0x2f2151[_0xbb08('0x7')]('en')[_0xbb08('0x17')](_0xbb08('0x18'))[_0xbb08('0xc')]();return circularDoWInterval(_0x3219d5,_0x24c200)[_0xbb08('0x19')](_0x23e89e);}module['exports']['dowCompare']=dowCompare;function domCompare(_0x4950cd,_0x2befbe,_0x3ce420){var _0x329e23=_0x4950cd['date']();if(_0x2befbe===_0x3ce420){return _0x329e23===_0x2befbe;}else{var _0xac1c35=_0x4950cd['daysInMonth']();var _0x2fab45=_0x2befbe<_0x3ce420;let _0x107062=![];var _0x49d878=0x0;var _0x1907eb=0x0;if(_0x2fab45){_0x49d878=Math[_0xbb08('0x1a')](0x1,_0x2befbe);_0x1907eb=Math[_0xbb08('0x1b')](_0x3ce420,_0xac1c35);_0x107062=_0x329e23>=_0x49d878&&_0x329e23<=_0x1907eb;}else{_0x49d878=Math[_0xbb08('0x1b')](_0x2befbe,_0xac1c35);_0x1907eb=Math[_0xbb08('0x1a')](0x1,_0x3ce420);_0x107062=_0x329e23>=_0x49d878||_0x329e23<=_0x1907eb;}return _0x107062;}}module[_0xbb08('0xd')][_0xbb08('0x1c')]=domCompare;function monthCompare(_0x301777,_0x1ff579,_0xc1ade1){var _0x35c298=_0x301777['locale']('en')['format'](_0xbb08('0x1d'))[_0xbb08('0xc')]();return circularMonthInterval(_0x1ff579,_0xc1ade1)[_0xbb08('0x19')](_0x35c298);}module[_0xbb08('0xd')]['monthCompare']=monthCompare;function iftime(_0xc093eb,_0x404fd1=moment['tz']['guess'](),_0x22dd12=moment()){if(!validateRx[_0xbb08('0x1e')](_0xc093eb)){throw new Error(EINVALID_STRING);}else{var _0x446aac=(moment[_0xbb08('0x1f')](_0x22dd12)?_0x22dd12[_0xbb08('0xf')]():moment(_0x22dd12))['tz'](_0x404fd1)[_0xbb08('0x7')]('en');throwIfDateNotValid(_0x446aac);var _0x123b98=_0xc093eb[_0xbb08('0x5')](',');var _0x8cdbfd=_0x123b98[0x0];var _0x132736=_0x123b98[0x1];var _0x2e8a52=_0x123b98[0x2];var _0x13bf71=_0x123b98[0x3];let _0x2cc59c=!![];if(_0x8cdbfd!=='*'){var _0x381201=_0x8cdbfd[_0xbb08('0x5')]('-');var _0x35d351=_[_0xbb08('0x20')](_0x381201[0x0],0x5,'0');var _0x42bc10=_0x381201['length']===0x2?_['padStart'](_0x381201[0x1],0x5,'0'):_0x35d351;_0x2cc59c=timeCompare(_0x446aac,_0x35d351,_0x42bc10);}let _0x1fd6ad=!![];if(_0x132736!=='*'){var _0x3177f3=_0x132736['split']('-');var _0x13a349=_0x3177f3[0x0];var _0x1db6ed=_0x3177f3['length']===0x2?_0x3177f3[0x1]:_0x13a349;_0x1fd6ad=dowCompare(_0x446aac,_0x13a349,_0x1db6ed);}let _0x509c1d=!![];if(_0x2e8a52!=='*'){var _0x4bd86a=_0x2e8a52[_0xbb08('0x5')]('-');var _0x10c4ec=parseDom(_0x4bd86a[0x0]);var _0x156598=_0x4bd86a[_0xbb08('0x21')]===0x2?parseDom(_0x4bd86a[0x1]):_0x10c4ec;_0x509c1d=domCompare(_0x446aac,_0x10c4ec,_0x156598);}let _0x5296cb=!![];if(_0x13bf71!=='*'){var _0x57787b=_0x13bf71[_0xbb08('0x5')]('-');var _0x127368=_0x57787b[0x0];var _0x3a14aa=_0x57787b[_0xbb08('0x21')]===0x2?_0x57787b[0x1]:_0x57787b[0x0];_0x5296cb=monthCompare(_0x446aac,_0x127368,_0x3a14aa);}return _0x2cc59c&&_0x1fd6ad&&_0x509c1d&&_0x5296cb;}}module['exports']['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 4fd697e..7de5f78 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb460=['moment','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','Logger','transports','Console','warn','%s-%s','error','File','consoleLogger','fileLogger','util'];(function(_0x2e20d9,_0x1bb821){var _0x4803d9=function(_0xfc6442){while(--_0xfc6442){_0x2e20d9['push'](_0x2e20d9['shift']());}};_0x4803d9(++_0x1bb821);}(_0xb460,0x137));var _0x0b46=function(_0x7deb1a,_0x5e20f5){_0x7deb1a=_0x7deb1a-0x0;var _0x5d7dd2=_0xb460[_0x7deb1a];return _0x5d7dd2;};'use strict';var path=require('path');var util=require(_0x0b46('0x0'));var moment=require(_0x0b46('0x1'));var winston=require('winston');var config=require(_0x0b46('0x2'));var debugLevel=config[_0x0b46('0x3')]?config[_0x0b46('0x3')][_0x0b46('0x4')]():_0x0b46('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x0b46('0x6'),'warn':_0x0b46('0x7'),'info':'white','print':_0x0b46('0x8'),'success':_0x0b46('0x9'),'http':_0x0b46('0xa'),'verbose':_0x0b46('0xb'),'debug':_0x0b46('0xc'),'silly':_0x0b46('0xd')};winston[_0x0b46('0xe')](XC_LOG_COLORS);function getLogFileName(_0x19faee,_0x420210,_0x54ae10){var _0x51cf4c=_0x19faee||_0x0b46('0xf');return path[_0x0b46('0x10')](_0x51cf4c,util[_0x0b46('0x11')](_0x0b46('0x12'),_0x420210,_0x54ae10));}function formatter(_0x22ec14,_0x1089bf){_0x1089bf[_0x0b46('0x13')]=_0x1089bf[_0x0b46('0x13')][_0x0b46('0x14')](/@@{/g,_0x0b46('0x15'))['replace'](/}@@/g,_0x0b46('0x16'))[_0x0b46('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x0b46('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x0b46('0x11')](_0x0b46('0x17')),_0x1089bf[_0x0b46('0x18')][_0x0b46('0x19')](),_0x22ec14,_0x1089bf[_0x0b46('0x13')]);}function fileFormat(_0x32a984,_0x44bb8e){_0x44bb8e[_0x0b46('0x13')]=_0x44bb8e['message']['replace'](/@@{/g,_0x0b46('0x15'))[_0x0b46('0x14')](/}@@/g,_0x0b46('0x16'))[_0x0b46('0x14')](/@{/g,'{{')[_0x0b46('0x14')](/}@/g,'}}');var _0x3ec775=_0x44bb8e[_0x0b46('0x1a')]&&Object[_0x0b46('0x1b')](_0x44bb8e['meta'])[_0x0b46('0x1c')]?'\x0a\x09'+JSON[_0x0b46('0x1d')](_0x44bb8e['meta']):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x0b46('0x11')](_0x0b46('0x17')),_0x44bb8e['level'][_0x0b46('0x19')](),_0x32a984,_0x44bb8e['message'],_0x3ec775);}function consoleLogger(){var _0x25ddea=new winston[(_0x0b46('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x0b46('0x1f'))][(_0x0b46('0x20'))]({'level':_0x0b46('0x21'),'json':![],'formatter':function(_0x38165a){return formatter('',_0x38165a);}})]});return _0x25ddea;}function fileLogger(_0x54859e,_0x51debf){var _0x4eda5f=new winston[(_0x0b46('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x0b46('0x1f'))]['File']({'name':util[_0x0b46('0x11')](_0x0b46('0x22'),_0x54859e,_0x0b46('0x23')),'filename':getLogFileName(_0x51debf,_0x54859e,_0x0b46('0x23')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1b4401){return fileFormat(_0x54859e,_0x1b4401);}}),new winston['transports'][(_0x0b46('0x24'))]({'name':util['format']('%s-%s',_0x54859e,debugLevel),'filename':getLogFileName(_0x51debf,_0x54859e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4c3733){return fileFormat(_0x54859e,_0x4c3733);}}),new winston[(_0x0b46('0x1f'))]['Console']({'level':_0x0b46('0x21'),'json':![],'formatter':function(_0x49cca4){return fileFormat(_0x54859e,_0x49cca4);}})]});return _0x4eda5f;}exports[_0x0b46('0x25')]=consoleLogger;exports[_0x0b46('0x26')]=fileLogger; \ No newline at end of file +var _0x2e93=['red','bold\x20yellow','white','bold\x20white','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message','replace','{{{','}}}','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','Logger','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white'];(function(_0x35a43d,_0x40c8ed){var _0x3198dd=function(_0x1b8ff3){while(--_0x1b8ff3){_0x35a43d['push'](_0x35a43d['shift']());}};_0x3198dd(++_0x40c8ed);}(_0x2e93,0xed));var _0x32e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2e93[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0x32e9('0x0'));var util=require(_0x32e9('0x1'));var moment=require(_0x32e9('0x2'));var winston=require(_0x32e9('0x3'));var config=require(_0x32e9('0x4'));var debugLevel=config[_0x32e9('0x5')]?config[_0x32e9('0x5')][_0x32e9('0x6')]():_0x32e9('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x32e9('0x8'),'error':_0x32e9('0x9'),'warn':_0x32e9('0xa'),'info':_0x32e9('0xb'),'print':_0x32e9('0xc'),'success':'bold\x20green','http':_0x32e9('0xd'),'verbose':_0x32e9('0xe'),'debug':'bold\x20blue','silly':_0x32e9('0xf')};winston[_0x32e9('0x10')](XC_LOG_COLORS);function getLogFileName(_0x1c2c87,_0x116c3f,_0x53ff75){var _0x5d74fd=_0x1c2c87||_0x32e9('0x11');return path[_0x32e9('0x12')](_0x5d74fd,util['format'](_0x32e9('0x13'),_0x116c3f,_0x53ff75));}function formatter(_0xff0893,_0x22e612){_0x22e612[_0x32e9('0x14')]=_0x22e612[_0x32e9('0x14')][_0x32e9('0x15')](/@@{/g,_0x32e9('0x16'))['replace'](/}@@/g,_0x32e9('0x17'))[_0x32e9('0x15')](/@{/g,'{{')[_0x32e9('0x15')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x32e9('0x18')](_0x32e9('0x19')),_0x22e612[_0x32e9('0x1a')][_0x32e9('0x1b')](),_0xff0893,_0x22e612[_0x32e9('0x14')]);}function fileFormat(_0x50b873,_0xb1c0ee){_0xb1c0ee['message']=_0xb1c0ee[_0x32e9('0x14')][_0x32e9('0x15')](/@@{/g,_0x32e9('0x16'))[_0x32e9('0x15')](/}@@/g,'}}}')[_0x32e9('0x15')](/@{/g,'{{')[_0x32e9('0x15')](/}@/g,'}}');var _0x4937c1=_0xb1c0ee[_0x32e9('0x1c')]&&Object[_0x32e9('0x1d')](_0xb1c0ee[_0x32e9('0x1c')])[_0x32e9('0x1e')]?'\x0a\x09'+JSON[_0x32e9('0x1f')](_0xb1c0ee['meta']):'';return util[_0x32e9('0x18')](_0x32e9('0x20'),moment()[_0x32e9('0x18')](_0x32e9('0x19')),_0xb1c0ee[_0x32e9('0x1a')][_0x32e9('0x1b')](),_0x50b873,_0xb1c0ee[_0x32e9('0x14')],_0x4937c1);}function consoleLogger(){var _0x282f42=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x32e9('0x21'))][(_0x32e9('0x22'))]({'level':'warn','json':![],'formatter':function(_0x5aab98){return formatter('',_0x5aab98);}})]});return _0x282f42;}function fileLogger(_0x11c0ac,_0x59176c){var _0x3ced09=new winston[(_0x32e9('0x23'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x32e9('0x24'))]({'name':util[_0x32e9('0x18')](_0x32e9('0x25'),_0x11c0ac,_0x32e9('0x26')),'filename':getLogFileName(_0x59176c,_0x11c0ac,_0x32e9('0x26')),'level':_0x32e9('0x26'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xdb8123){return fileFormat(_0x11c0ac,_0xdb8123);}}),new winston['transports'][(_0x32e9('0x24'))]({'name':util['format'](_0x32e9('0x25'),_0x11c0ac,debugLevel),'filename':getLogFileName(_0x59176c,_0x11c0ac,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5abddc){return fileFormat(_0x11c0ac,_0x5abddc);}}),new winston[(_0x32e9('0x21'))][(_0x32e9('0x22'))]({'level':'warn','json':![],'formatter':function(_0x57ddf0){return fileFormat(_0x11c0ac,_0x57ddf0);}})]});return _0x3ced09;}exports[_0x32e9('0x27')]=consoleLogger;exports[_0x32e9('0x28')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index b4be3f9..85a2fe6 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x1967,0x173));var _0x7196=function(_0x421520,_0x28f5c3){_0x421520=_0x421520-0x0;var _0x3fd7ff=_0x1967[_0x421520];return _0x3fd7ff;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x5f2f=['tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','membername','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','lodash','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','clientSecret','securityToken','code'];(function(_0x47767c,_0x3f8280){var _0x4a0d87=function(_0x51f9c7){while(--_0x51f9c7){_0x47767c['push'](_0x47767c['shift']());}};_0x4a0d87(++_0x3f8280);}(_0x5f2f,0x73));var _0xf5f2=function(_0x204af1,_0x57f5a0){_0x204af1=_0x204af1-0x0;var _0x314f4e=_0x5f2f[_0x204af1];return _0x314f4e;};var _=require(_0xf5f2('0x0'));var sensitiveFields=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'phone','mobile',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'accessKey',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'accessToken',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'consumerSecret',_0xf5f2('0x14'),'calleridname','calleridnum',_0xf5f2('0x15'),_0xf5f2('0x16'),'clientEmail',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'accountSid',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21')];function maskSensitiveData(_0x4d97fc){const _0xafe430=/(?!^)[\s\S](?!$)/g;if(_[_0xf5f2('0x22')](_0x4d97fc)){for(const _0x17d656 in _0x4d97fc){if(_[_0xf5f2('0x23')](_0x4d97fc[_0x17d656])){for(let _0x23e23a=0x0;_0x23e23a<_0x4d97fc[_0x17d656][_0xf5f2('0x24')];_0x23e23a++){maskSensitiveData(_0x4d97fc[_0x17d656][_0x23e23a]);}}else if(_[_0xf5f2('0x22')](_0x4d97fc[_0x17d656])){maskSensitiveData(_0x4d97fc[_0x17d656]);}else if(_[_0xf5f2('0x25')](_0x4d97fc[_0x17d656])){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](/{{{/g,_0xf5f2('0x27'))[_0xf5f2('0x26')](/}}}/g,_0xf5f2('0x28'))[_0xf5f2('0x26')](/{{/g,'@{')[_0xf5f2('0x26')](/}}/g,'}@');if(_[_0xf5f2('0x29')](sensitiveFields,_0x17d656)){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](_0xafe430,'*');}}}}}module[_0xf5f2('0x2a')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index fe64617..7f9fe4a 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['\x5c$&','exports','replace'];(function(_0x4d527e,_0x43c030){var _0x1fa3fb=function(_0x54fa09){while(--_0x54fa09){_0x4d527e['push'](_0x4d527e['shift']());}};_0x1fa3fb(++_0x43c030);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};module[_0xac4a('0x0')]={'escapeRegExp'(_0x5a86db,_0x40a0d0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x5a86db[_0xac4a('0x1')](_0x40a0d0,_0xac4a('0x2'));}}; \ No newline at end of file +var _0x0295=['exports','replace'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0x0295,0x1f0));var _0x5029=function(_0x5b8f6d,_0x15ecd0){_0x5b8f6d=_0x5b8f6d-0x0;var _0x729fba=_0x0295[_0x5b8f6d];return _0x729fba;};module[_0x5029('0x0')]={'escapeRegExp'(_0x4e737b,_0x5e71d0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4e737b[_0x5029('0x1')](_0x5e71d0,'\x5c$&');}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 2dec3ef..f82c85d 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xef0f=['lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','isPlainObject','keys','reduce','safeTemplate'];(function(_0x2315eb,_0x258290){var _0x31ad39=function(_0x17b5ee){while(--_0x17b5ee){_0x2315eb['push'](_0x2315eb['shift']());}};_0x31ad39(++_0x258290);}(_0xef0f,0x168));var _0xfef0=function(_0x57123b,_0x27ed2c){_0x57123b=_0x57123b-0x0;var _0x1b953a=_0xef0f[_0x57123b];return _0x1b953a;};var _=require(_0xfef0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x581303){return _0x581303==='{{'?_0xfef0('0x1'):_0xfef0('0x2');}function safeTemplate(_0x19f865){var _0x4d29e5=_0x19f865;if(typeof _0x19f865===_0xfef0('0x3')){_0x4d29e5=_0x19f865[_0xfef0('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfef0('0x5')](_0x19f865)){_0x4d29e5=_0x19f865['map'](function(_0x2a6fcf){return safeTemplate(_0x2a6fcf);});}else if(_[_0xfef0('0x6')](_0x19f865)){_0x4d29e5=Object[_0xfef0('0x7')](_0x19f865)[_0xfef0('0x8')](function(_0xad43e,_0x11dfd7){_0xad43e[_0x11dfd7]=safeTemplate(_0x19f865[_0x11dfd7]);return _0xad43e;},{});}return _0x4d29e5;}module['exports'][_0xfef0('0x9')]=safeTemplate; \ No newline at end of file +var _0x1eba=['\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20'];(function(_0x809314,_0xaf27c0){var _0x1a94b6=function(_0x450f50){while(--_0x450f50){_0x809314['push'](_0x809314['shift']());}};_0x1a94b6(++_0xaf27c0);}(_0x1eba,0x1d7));var _0xa1eb=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0x1eba[_0xfb0cfd];return _0x2fd8aa;};var _=require(_0xa1eb('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b1355){return _0x2b1355==='{{'?_0xa1eb('0x1'):_0xa1eb('0x2');}function safeTemplate(_0x3ef7ee){var _0x5865fc=_0x3ef7ee;if(typeof _0x3ef7ee==='string'){_0x5865fc=_0x3ef7ee[_0xa1eb('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xa1eb('0x4')](_0x3ef7ee)){_0x5865fc=_0x3ef7ee[_0xa1eb('0x5')](function(_0xf9d704){return safeTemplate(_0xf9d704);});}else if(_[_0xa1eb('0x6')](_0x3ef7ee)){_0x5865fc=Object[_0xa1eb('0x7')](_0x3ef7ee)[_0xa1eb('0x8')](function(_0x2bfbb0,_0x39a5a3){_0x2bfbb0[_0x39a5a3]=safeTemplate(_0x3ef7ee[_0x39a5a3]);return _0x2bfbb0;},{});}return _0x5865fc;}module[_0xa1eb('0x9')][_0xa1eb('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 5bc6712..270d037 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0db4=['then','info','writeJSON','exports','path','../config/environment','root','resolve','server/app.json','legacy-libs','isArray','apps','name','string','NODE_PATH','pathExists','readJSON'];(function(_0x4d96c7,_0x44ab61){var _0x495b6a=function(_0x48d01e){while(--_0x48d01e){_0x4d96c7['push'](_0x4d96c7['shift']());}};_0x495b6a(++_0x44ab61);}(_0x0db4,0x169));var _0x40db=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x0db4[_0x20a558];return _0x53d3f7;};var fs=require('fs-extra');var path=require(_0x40db('0x0'));var config=require(_0x40db('0x1'));var root=config[_0x40db('0x2')];var APP_JSON_PATH=path[_0x40db('0x3')](root,_0x40db('0x4'));var NODEPATH=path[_0x40db('0x3')](root,_0x40db('0x5'));function setLegacyLibsNodeEnvPath(_0x502d4c){let _0x2c7165=![];if(Array[_0x40db('0x6')](_0x502d4c[_0x40db('0x7')])){var _0x3d2042=_0x502d4c[_0x40db('0x7')]['findIndex'](function(_0x1c08dc){return _0x1c08dc[_0x40db('0x8')]==='motion2';});if(_0x3d2042>-0x1){var _0x528bf5=_0x502d4c[_0x40db('0x7')][_0x3d2042];if(typeof _0x528bf5['env']['NODE_PATH']!==_0x40db('0x9')){_0x528bf5['env'][_0x40db('0xa')]=NODEPATH;_0x2c7165=!![];}}return{'appConfig':_0x502d4c,'updated':_0x2c7165};}}function updateAppConfig(_0x524ba0){return fs[_0x40db('0xb')](APP_JSON_PATH)['then'](function(_0x4a5554){if(_0x4a5554){return fs[_0x40db('0xc')](APP_JSON_PATH)[_0x40db('0xd')](function(_0x29455b){var _0x19e38e=setLegacyLibsNodeEnvPath(_0x29455b);if(_0x19e38e['updated']){_0x524ba0[_0x40db('0xe')]('Updating\x20app.json');return fs[_0x40db('0xf')](APP_JSON_PATH,_0x29455b,{'spaces':0x2});}else{return Promise[_0x40db('0x3')]();}});}else{return Promise[_0x40db('0x3')]();}});}module[_0x40db('0x10')]=updateAppConfig; \ No newline at end of file +var _0x956a=['Updating\x20app.json','fs-extra','../config/environment','root','resolve','server/app.json','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated'];(function(_0xfd7d2d,_0x71e27c){var _0x52feab=function(_0x294d38){while(--_0x294d38){_0xfd7d2d['push'](_0xfd7d2d['shift']());}};_0x52feab(++_0x71e27c);}(_0x956a,0x18d));var _0xa956=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x956a[_0x19e35c];return _0x3e1fe8;};var fs=require(_0xa956('0x0'));var path=require('path');var config=require(_0xa956('0x1'));var root=config[_0xa956('0x2')];var APP_JSON_PATH=path[_0xa956('0x3')](root,_0xa956('0x4'));var NODEPATH=path[_0xa956('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x5e384d){let _0xe62d6=![];if(Array[_0xa956('0x5')](_0x5e384d['apps'])){var _0x25f7db=_0x5e384d[_0xa956('0x6')][_0xa956('0x7')](function(_0x242396){return _0x242396[_0xa956('0x8')]===_0xa956('0x9');});if(_0x25f7db>-0x1){var _0x42d0b3=_0x5e384d[_0xa956('0x6')][_0x25f7db];if(typeof _0x42d0b3[_0xa956('0xa')][_0xa956('0xb')]!==_0xa956('0xc')){_0x42d0b3[_0xa956('0xa')][_0xa956('0xb')]=NODEPATH;_0xe62d6=!![];}}return{'appConfig':_0x5e384d,'updated':_0xe62d6};}}function updateAppConfig(_0x99c469){return fs[_0xa956('0xd')](APP_JSON_PATH)[_0xa956('0xe')](function(_0x251735){if(_0x251735){return fs[_0xa956('0xf')](APP_JSON_PATH)[_0xa956('0xe')](function(_0x5b3caa){var _0xfe2f69=setLegacyLibsNodeEnvPath(_0x5b3caa);if(_0xfe2f69[_0xa956('0x10')]){_0x99c469['info'](_0xa956('0x11'));return fs['writeJSON'](APP_JSON_PATH,_0x5b3caa,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xa956('0x3')]();}});}module['exports']=updateAppConfig; \ No newline at end of file